From: Cris Di Sclafani Date: Sat, 31 Oct 2020 11:01:39 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.4 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=f9217df1c423e144c65b1d09f3bbf61265685a4f;p=motion2.git Built motion from commit (unavailable).|2.5.4 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 4efec6c..2002b05 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-31T09:36:07.100Z", "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-31T10:53:26.315Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index fb76059..52ef4bf 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-31T09:36:07.100Z", "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-31T10:53:26.315Z", "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 df829b1..4dabed6 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 _0x30a5=['motionbar','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','sequelize','getDataValue','action','contactManager'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x30a5,0xc2));var _0x530a=function(_0x4cd21c,_0x35fa45){_0x4cd21c=_0x4cd21c-0x0;var _0x5d8e5e=_0x30a5[_0x4cd21c];return _0x5d8e5e;};'use strict';var Sequelize=require(_0x530a('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x55f4a7){return this[_0x530a('0x1')](_0x530a('0x2'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x530a('0x3'),'integration',_0x530a('0x4'),'jscripty',_0x530a('0x5'),'browser',_0x530a('0x6'),_0x530a('0x7')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x530a('0x8')},'data1':{'type':Sequelize[_0x530a('0x9')](0x1000),'comment':_0x530a('0xa')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize[_0x530a('0x9')](0x1000)},'data5':{'type':Sequelize[_0x530a('0x9')](0x1000)},'data6':{'type':Sequelize[_0x530a('0x9')]},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x00ec=['jscripty','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','VIRTUAL','getDataValue','action','STRING','integration'];(function(_0x487395,_0x49cebc){var _0x5af5dd=function(_0x244247){while(--_0x244247){_0x487395['push'](_0x487395['shift']());}};_0x5af5dd(++_0x49cebc);}(_0x00ec,0xf6));var _0xc00e=function(_0x508926,_0xa05b4f){_0x508926=_0x508926-0x0;var _0x49ab00=_0x00ec[_0x508926];return _0x49ab00;};'use strict';var Sequelize=require(_0xc00e('0x0'));module['exports']={'name':{'type':Sequelize[_0xc00e('0x1')],'get':function(_0xaa0b95){return this[_0xc00e('0x2')](_0xc00e('0x3'));}},'action':{'type':Sequelize[_0xc00e('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xc00e('0x5'),'motionbar',_0xc00e('0x6'),'urlForward',_0xc00e('0x7'),_0xc00e('0x8'),_0xc00e('0x9')]],'msg':_0xc00e('0xa')}},'comment':_0xc00e('0xa')},'data1':{'type':Sequelize[_0xc00e('0x4')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xc00e('0xb')},'data3':{'type':Sequelize[_0xc00e('0x4')](0x1000),'comment':_0xc00e('0xc')},'data4':{'type':Sequelize[_0xc00e('0x4')](0x1000)},'data5':{'type':Sequelize[_0xc00e('0x4')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0xc00e('0xd')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 28607c1..613a4b3 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 _0x1ff0=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','body','Action','find','params','catch','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service'];(function(_0x2614b4,_0x4cad13){var _0x3180bc=function(_0x37fed0){while(--_0x37fed0){_0x2614b4['push'](_0x2614b4['shift']());}};_0x3180bc(++_0x4cad13);}(_0x1ff0,0xe6));var _0x01ff=function(_0x49809e,_0x216d55){_0x49809e=_0x49809e-0x0;var _0x4996f9=_0x1ff0[_0x49809e];return _0x4996f9;};'use strict';var pdf=require(_0x01ff('0x0'));var emlformat=require(_0x01ff('0x1'));var rimraf=require(_0x01ff('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x01ff('0x3'));var rp=require(_0x01ff('0x4'));var moment=require(_0x01ff('0x5'));var BPromise=require(_0x01ff('0x6'));var Mustache=require(_0x01ff('0x7'));var util=require(_0x01ff('0x8'));var path=require('path');var sox=require(_0x01ff('0x9'));var csv=require('to-csv');var ejs=require(_0x01ff('0xa'));var fs=require('fs');var _=require(_0x01ff('0xb'));var squel=require(_0x01ff('0xc'));var crypto=require(_0x01ff('0xd'));var jsforce=require(_0x01ff('0xe'));var deskjs=require(_0x01ff('0xf'));var toCsv=require(_0x01ff('0x10'));var querystring=require(_0x01ff('0x11'));var Papa=require('papaparse');var Redis=require(_0x01ff('0x12'));var authService=require(_0x01ff('0x13'));var qs=require(_0x01ff('0x14'));var as=require(_0x01ff('0x15'));var hardwareService=require(_0x01ff('0x16'));var logger=require(_0x01ff('0x17'))(_0x01ff('0x18'));var utils=require(_0x01ff('0x19'));var config=require(_0x01ff('0x1a'));var db=require(_0x01ff('0x1b'))['db'];function respondWithStatusCode(_0x5eabfa,_0xed59e2){_0xed59e2=_0xed59e2||0xcc;return function(_0x3e6809){if(_0x3e6809){return _0x5eabfa[_0x01ff('0x1c')](_0xed59e2);}return _0x5eabfa[_0x01ff('0x1d')](_0xed59e2)[_0x01ff('0x1e')]();};}function respondWithResult(_0x214289,_0x38729c){_0x38729c=_0x38729c||0xc8;return function(_0x361dd4){if(_0x361dd4){return _0x214289[_0x01ff('0x1d')](_0x38729c)[_0x01ff('0x1f')](_0x361dd4);}};}function respondWithFilteredResult(_0x25f6b4,_0x5a31e4){return function(_0x49c9be){if(_0x49c9be){var _0x3b26ad=_0x49c9be[_0x01ff('0x20')],_0x5990a0=_0x5a31e4['offset'],_0x571417=_0x5a31e4[_0x01ff('0x21')]+_0x5a31e4['limit'],_0x5965d7;if(_0x571417>=_0x3b26ad){_0x571417=_0x3b26ad;_0x5965d7=0xc8;}else{_0x5965d7=0xce;}_0x25f6b4[_0x01ff('0x1d')](_0x5965d7);return _0x25f6b4[_0x01ff('0x22')](_0x01ff('0x23'),_0x5990a0+'-'+_0x571417+'/'+_0x3b26ad)[_0x01ff('0x1f')](_0x49c9be);}return null;};}function patchUpdates(_0x4e56d1){return function(_0x41d8be){try{jsonpatch[_0x01ff('0x24')](_0x41d8be,_0x4e56d1,!![]);}catch(_0x2a5555){return BPromise[_0x01ff('0x25')](_0x2a5555);}return _0x41d8be[_0x01ff('0x26')]();};}function saveUpdates(_0xd7dcb5,_0x408544){return function(_0xef4b88){if(_0xef4b88){return _0xef4b88[_0x01ff('0x27')](_0xd7dcb5)[_0x01ff('0x28')](function(_0x184e3a){return _0x184e3a;});}return null;};}function removeEntity(_0x44ae92,_0x474759){return function(_0x37a0ab){if(_0x37a0ab){return _0x37a0ab[_0x01ff('0x29')]()[_0x01ff('0x28')](function(){_0x44ae92[_0x01ff('0x1d')](0xcc)[_0x01ff('0x1e')]();});}};}function handleEntityNotFound(_0x22f678,_0xde580a){return function(_0x2689c3){if(!_0x2689c3){_0x22f678[_0x01ff('0x1c')](0x194);}return _0x2689c3;};}function handleError(_0x48c11f,_0x257e45){_0x257e45=_0x257e45||0x1f4;return function(_0x521cbf){logger['error'](_0x521cbf[_0x01ff('0x2a')]);if(_0x521cbf['name']){delete _0x521cbf[_0x01ff('0x2b')];}_0x48c11f[_0x01ff('0x1d')](_0x257e45)[_0x01ff('0x2c')](_0x521cbf);};}exports['update']=function(_0xb883e5,_0x62a1bd){if(_0xb883e5['body']['id']){delete _0xb883e5[_0x01ff('0x2d')]['id'];}return db[_0x01ff('0x2e')][_0x01ff('0x2f')]({'where':{'id':_0xb883e5[_0x01ff('0x30')]['id']}})[_0x01ff('0x28')](handleEntityNotFound(_0x62a1bd,null))[_0x01ff('0x28')](saveUpdates(_0xb883e5[_0x01ff('0x2d')],null))['then'](respondWithResult(_0x62a1bd,null))[_0x01ff('0x31')](handleError(_0x62a1bd,null));};exports[_0x01ff('0x29')]=function(_0x282695,_0x5bcfa6){return db['Action'][_0x01ff('0x2f')]({'where':{'id':_0x282695[_0x01ff('0x30')]['id']}})[_0x01ff('0x28')](handleEntityNotFound(_0x5bcfa6,null))[_0x01ff('0x28')](removeEntity(_0x5bcfa6,null))[_0x01ff('0x31')](handleError(_0x5bcfa6,null));}; \ No newline at end of file +var _0xcbce=['offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','update','body','Action','params','find','catch','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json'];(function(_0x425f3c,_0x54feef){var _0xa873ee=function(_0x4212e9){while(--_0x4212e9){_0x425f3c['push'](_0x425f3c['shift']());}};_0xa873ee(++_0x54feef);}(_0xcbce,0x6d));var _0xecbc=function(_0x128128,_0xbb001d){_0x128128=_0x128128-0x0;var _0x223b01=_0xcbce[_0x128128];return _0x223b01;};'use strict';var pdf=require(_0xecbc('0x0'));var emlformat=require(_0xecbc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xecbc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xecbc('0x3'));var moment=require('moment');var BPromise=require(_0xecbc('0x4'));var Mustache=require(_0xecbc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xecbc('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xecbc('0x7'));var squel=require(_0xecbc('0x8'));var crypto=require(_0xecbc('0x9'));var jsforce=require(_0xecbc('0xa'));var deskjs=require(_0xecbc('0xb'));var toCsv=require(_0xecbc('0x6'));var querystring=require(_0xecbc('0xc'));var Papa=require(_0xecbc('0xd'));var Redis=require(_0xecbc('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xecbc('0xf'));var as=require(_0xecbc('0x10'));var hardwareService=require(_0xecbc('0x11'));var logger=require(_0xecbc('0x12'))(_0xecbc('0x13'));var utils=require(_0xecbc('0x14'));var config=require('../../config/environment');var db=require(_0xecbc('0x15'))['db'];function respondWithStatusCode(_0x2d2caa,_0x467f26){_0x467f26=_0x467f26||0xcc;return function(_0x1b5598){if(_0x1b5598){return _0x2d2caa[_0xecbc('0x16')](_0x467f26);}return _0x2d2caa[_0xecbc('0x17')](_0x467f26)[_0xecbc('0x18')]();};}function respondWithResult(_0x1c0fb3,_0x85cedb){_0x85cedb=_0x85cedb||0xc8;return function(_0x2db00d){if(_0x2db00d){return _0x1c0fb3['status'](_0x85cedb)[_0xecbc('0x19')](_0x2db00d);}};}function respondWithFilteredResult(_0x505a20,_0xa81831){return function(_0x5b6e4f){if(_0x5b6e4f){var _0x435a6f=_0x5b6e4f['count'],_0x131396=_0xa81831[_0xecbc('0x1a')],_0x8e7c27=_0xa81831[_0xecbc('0x1a')]+_0xa81831[_0xecbc('0x1b')],_0x26048c;if(_0x8e7c27>=_0x435a6f){_0x8e7c27=_0x435a6f;_0x26048c=0xc8;}else{_0x26048c=0xce;}_0x505a20[_0xecbc('0x17')](_0x26048c);return _0x505a20[_0xecbc('0x1c')](_0xecbc('0x1d'),_0x131396+'-'+_0x8e7c27+'/'+_0x435a6f)[_0xecbc('0x19')](_0x5b6e4f);}return null;};}function patchUpdates(_0x18a39a){return function(_0x541409){try{jsonpatch[_0xecbc('0x1e')](_0x541409,_0x18a39a,!![]);}catch(_0x9b5b51){return BPromise[_0xecbc('0x1f')](_0x9b5b51);}return _0x541409[_0xecbc('0x20')]();};}function saveUpdates(_0x2e9992,_0x273e5e){return function(_0x2c7710){if(_0x2c7710){return _0x2c7710['update'](_0x2e9992)['then'](function(_0x5a6baf){return _0x5a6baf;});}return null;};}function removeEntity(_0x579be1,_0xe129c7){return function(_0xd4e709){if(_0xd4e709){return _0xd4e709[_0xecbc('0x21')]()[_0xecbc('0x22')](function(){_0x579be1[_0xecbc('0x17')](0xcc)[_0xecbc('0x18')]();});}};}function handleEntityNotFound(_0x4eb4f8,_0x2186d6){return function(_0x3eb01f){if(!_0x3eb01f){_0x4eb4f8[_0xecbc('0x16')](0x194);}return _0x3eb01f;};}function handleError(_0x2be9ac,_0x1e192f){_0x1e192f=_0x1e192f||0x1f4;return function(_0xc6d970){logger[_0xecbc('0x23')](_0xc6d970[_0xecbc('0x24')]);if(_0xc6d970[_0xecbc('0x25')]){delete _0xc6d970[_0xecbc('0x25')];}_0x2be9ac[_0xecbc('0x17')](_0x1e192f)[_0xecbc('0x26')](_0xc6d970);};}exports[_0xecbc('0x27')]=function(_0x20c200,_0x335067){if(_0x20c200['body']['id']){delete _0x20c200[_0xecbc('0x28')]['id'];}return db[_0xecbc('0x29')]['find']({'where':{'id':_0x20c200[_0xecbc('0x2a')]['id']}})[_0xecbc('0x22')](handleEntityNotFound(_0x335067,null))[_0xecbc('0x22')](saveUpdates(_0x20c200['body'],null))['then'](respondWithResult(_0x335067,null))['catch'](handleError(_0x335067,null));};exports[_0xecbc('0x21')]=function(_0x2ef756,_0x330a3a){return db[_0xecbc('0x29')][_0xecbc('0x2b')]({'where':{'id':_0x2ef756[_0xecbc('0x2a')]['id']}})[_0xecbc('0x22')](handleEntityNotFound(_0x330a3a,null))[_0xecbc('0x22')](removeEntity(_0x330a3a,null))[_0xecbc('0x2c')](handleError(_0x330a3a,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index bd21614..0cda0f0 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 _0x5d08=['Action','tools_actions','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','exports','define'];(function(_0x579521,_0xc8efc){var _0x4a934d=function(_0x37c4fa){while(--_0x37c4fa){_0x579521['push'](_0x579521['shift']());}};_0x4a934d(++_0xc8efc);}(_0x5d08,0x157));var _0x85d0=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5d08[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x85d0('0x0'));var util=require(_0x85d0('0x1'));var logger=require(_0x85d0('0x2'))(_0x85d0('0x3'));var moment=require('moment');var BPromise=require(_0x85d0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x85d0('0x5'));var rimraf=require('rimraf');var config=require(_0x85d0('0x6'));var attributes=require('./action.attributes');module[_0x85d0('0x7')]=function(_0x9fe4e,_0xa991dd){return _0x9fe4e[_0x85d0('0x8')](_0x85d0('0x9'),attributes,{'tableName':_0x85d0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe50d=['rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','api','moment','bluebird','path'];(function(_0x256684,_0x529c1e){var _0x37a0c9=function(_0x4b431b){while(--_0x4b431b){_0x256684['push'](_0x256684['shift']());}};_0x37a0c9(++_0x529c1e);}(_0xe50d,0xeb));var _0xde50=function(_0x100a9d,_0x355cc6){_0x100a9d=_0x100a9d-0x0;var _0x5c2cec=_0xe50d[_0x100a9d];return _0x5c2cec;};'use strict';var _=require(_0xde50('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xde50('0x1'));var moment=require(_0xde50('0x2'));var BPromise=require(_0xde50('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xde50('0x4'));var rimraf=require(_0xde50('0x5'));var config=require(_0xde50('0x6'));var attributes=require(_0xde50('0x7'));module[_0xde50('0x8')]=function(_0x19689b,_0x24b911){return _0x19689b[_0xde50('0x9')](_0xde50('0xa'),attributes,{'tableName':_0xde50('0xb'),'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 d829b16..e5ad561 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x4498a2,_0x143689){var _0x411aa8=function(_0x1a85dc){while(--_0x1a85dc){_0x4498a2['push'](_0x4498a2['shift']());}};_0x411aa8(++_0x143689);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2008d3,_0x221527){var _0x51b7c8=function(_0x58a924){while(--_0x58a924){_0x2008d3['push'](_0x2008d3['shift']());}};_0x51b7c8(++_0x221527);}(_0xe706,0xa3));var _0x6e70=function(_0x33ec17,_0x1fd9e9){_0x33ec17=_0x33ec17-0x0;var _0x46eceb=_0xe706[_0x33ec17];return _0x46eceb;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('Action,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('Action,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 5e34088..9447cdb 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 _0x7625=['/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./action.controller','isAuthenticated','delete'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0x7625,0x73));var _0x5762=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7625[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x5762('0x0'));var util=require(_0x5762('0x1'));var path=require(_0x5762('0x2'));var timeout=require(_0x5762('0x3'));var express=require(_0x5762('0x4'));var router=express[_0x5762('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x5762('0x6'));var config=require(_0x5762('0x7'));var controller=require(_0x5762('0x8'));router['put']('/:id',auth[_0x5762('0x9')](),controller['update']);router[_0x5762('0xa')](_0x5762('0xb'),auth[_0x5762('0x9')](),controller[_0x5762('0xc')]);module[_0x5762('0xd')]=router; \ No newline at end of file +var _0x12a8=['delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','./action.controller','put','isAuthenticated'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x12a8,0x1d1));var _0x812a=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x12a8[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x812a('0x0'));var util=require(_0x812a('0x1'));var path=require(_0x812a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x812a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x812a('0x4'));var config=require('../../config/environment');var controller=require(_0x812a('0x5'));router[_0x812a('0x6')]('/:id',auth[_0x812a('0x7')](),controller['update']);router[_0x812a('0x8')]('/:id',auth[_0x812a('0x7')](),controller[_0x812a('0x9')]);module[_0x812a('0xa')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index ce728b0..630b0c0 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 _0x75b7=['TEXT','sequelize','exports','STRING'];(function(_0x2b040c,_0x4a2b5d){var _0x36532b=function(_0x1bff30){while(--_0x1bff30){_0x2b040c['push'](_0x2b040c['shift']());}};_0x36532b(++_0x4a2b5d);}(_0x75b7,0x81));var _0x775b=function(_0x5505e1,_0x4fcdce){_0x5505e1=_0x5505e1-0x0;var _0x326316=_0x75b7[_0x5505e1];return _0x326316;};'use strict';var Sequelize=require(_0x775b('0x0'));module[_0x775b('0x1')]={'name':{'type':Sequelize[_0x775b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x775b('0x2')]},'parent':{'type':Sequelize[_0x775b('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x775b('0x3')]}}; \ No newline at end of file +var _0x6aac=['STRING','TEXT','sequelize'];(function(_0xfecc77,_0x4661ab){var _0xa3472f=function(_0xc340dc){while(--_0xc340dc){_0xfecc77['push'](_0xfecc77['shift']());}};_0xa3472f(++_0x4661ab);}(_0x6aac,0x18e));var _0xc6aa=function(_0x452660,_0x21b20e){_0x452660=_0x452660-0x0;var _0x7567eb=_0x6aac[_0x452660];return _0x7567eb;};'use strict';var Sequelize=require(_0xc6aa('0x0'));module['exports']={'name':{'type':Sequelize[_0xc6aa('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xc6aa('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xc6aa('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 8565cb8..bef2993 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 _0x3dd5=['keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','include','AnalyticCustomReport','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Reports','userProfileId','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','toString','SELECT','left_join','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','operator','Limited\x20Query:','sequelize','QueryTypes','No\x20available\x20data','fullPath','%s-%s.%s','output','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','sendStatus','status','offset','limit','set','Content-Range','reject','update','then','destroy','get','UserProfileResource','end','stack','send','map','rawAttributes','fieldName','type','model','name','query'];(function(_0x2db48e,_0x313065){var _0xd2f8fd=function(_0x2f097f){while(--_0x2f097f){_0x2db48e['push'](_0x2db48e['shift']());}};_0xd2f8fd(++_0x313065);}(_0x3dd5,0x73));var _0x53dd=function(_0x1f066f,_0x4a6815){_0x1f066f=_0x1f066f-0x0;var _0xa1296a=_0x3dd5[_0x1f066f];return _0xa1296a;};'use strict';var pdf=require(_0x53dd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x53dd('0x1'));var zipdir=require(_0x53dd('0x2'));var jsonpatch=require(_0x53dd('0x3'));var rp=require(_0x53dd('0x4'));var moment=require(_0x53dd('0x5'));var BPromise=require(_0x53dd('0x6'));var Mustache=require(_0x53dd('0x7'));var util=require(_0x53dd('0x8'));var path=require(_0x53dd('0x9'));var sox=require('sox');var csv=require(_0x53dd('0xa'));var ejs=require(_0x53dd('0xb'));var fs=require('fs');var _=require(_0x53dd('0xc'));var squel=require(_0x53dd('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x53dd('0xe'));var toCsv=require('to-csv');var querystring=require(_0x53dd('0xf'));var Papa=require(_0x53dd('0x10'));var Redis=require(_0x53dd('0x11'));var authService=require(_0x53dd('0x12'));var qs=require(_0x53dd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x53dd('0x14'));var logger=require(_0x53dd('0x15'))(_0x53dd('0x16'));var utils=require(_0x53dd('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var dbH=require(_0x53dd('0x18'))[_0x53dd('0x19')];function respondWithStatusCode(_0xdddaa8,_0x5117a6){_0x5117a6=_0x5117a6||0xcc;return function(_0x3fc986){if(_0x3fc986){return _0xdddaa8[_0x53dd('0x1a')](_0x5117a6);}return _0xdddaa8[_0x53dd('0x1b')](_0x5117a6)['end']();};}function respondWithResult(_0x130671,_0x345f36){_0x345f36=_0x345f36||0xc8;return function(_0x1baf8b){if(_0x1baf8b){return _0x130671['status'](_0x345f36)['json'](_0x1baf8b);}};}function respondWithFilteredResult(_0x5364be,_0x595f18){return function(_0x1d8ecf){if(_0x1d8ecf){var _0x4449e1=_0x1d8ecf['count'],_0xef43a7=_0x595f18['offset'],_0x30052e=_0x595f18[_0x53dd('0x1c')]+_0x595f18[_0x53dd('0x1d')],_0x180d1e;if(_0x30052e>=_0x4449e1){_0x30052e=_0x4449e1;_0x180d1e=0xc8;}else{_0x180d1e=0xce;}_0x5364be[_0x53dd('0x1b')](_0x180d1e);return _0x5364be[_0x53dd('0x1e')](_0x53dd('0x1f'),_0xef43a7+'-'+_0x30052e+'/'+_0x4449e1)['json'](_0x1d8ecf);}return null;};}function patchUpdates(_0x5d0e96){return function(_0x586e47){try{jsonpatch['apply'](_0x586e47,_0x5d0e96,!![]);}catch(_0x52d48b){return BPromise[_0x53dd('0x20')](_0x52d48b);}return _0x586e47['save']();};}function saveUpdates(_0x5365a7,_0x180765){return function(_0x1dcc36){if(_0x1dcc36){return _0x1dcc36[_0x53dd('0x21')](_0x5365a7)[_0x53dd('0x22')](function(_0x17ac0a){return _0x17ac0a;});}return null;};}function removeEntity(_0x4a4b3b,_0x340da7){return function(_0x47f2c5){if(_0x47f2c5){return _0x47f2c5[_0x53dd('0x23')]()[_0x53dd('0x22')](function(){var _0x534ce0=_0x47f2c5[_0x53dd('0x24')]({'plain':!![]});var _0x13e087='CustomReports';return db[_0x53dd('0x25')]['destroy']({'where':{'type':_0x13e087,'resourceId':_0x534ce0['id']}})[_0x53dd('0x22')](function(){return _0x47f2c5;});})[_0x53dd('0x22')](function(){_0x4a4b3b[_0x53dd('0x1b')](0xcc)[_0x53dd('0x26')]();});}};}function handleEntityNotFound(_0x39e5f7,_0x234bf6){return function(_0x1c0b0d){if(!_0x1c0b0d){_0x39e5f7[_0x53dd('0x1a')](0x194);}return _0x1c0b0d;};}function handleError(_0x43ea8d,_0x895636){_0x895636=_0x895636||0x1f4;return function(_0x3cfbcd){logger['error'](_0x3cfbcd[_0x53dd('0x27')]);if(_0x3cfbcd['name']){delete _0x3cfbcd['name'];}_0x43ea8d[_0x53dd('0x1b')](_0x895636)[_0x53dd('0x28')](_0x3cfbcd);};}exports['index']=function(_0x24403d,_0x55443d){var _0x3b2f31={},_0x21e92d={},_0x578d1e={'count':0x0,'rows':[]};var _0x293957=_[_0x53dd('0x29')](db['AnalyticCustomReport'][_0x53dd('0x2a')],function(_0x4ebe0a){return{'name':_0x4ebe0a[_0x53dd('0x2b')],'type':_0x4ebe0a[_0x53dd('0x2c')]['key']};});_0x21e92d[_0x53dd('0x2d')]=_[_0x53dd('0x29')](_0x293957,_0x53dd('0x2e'));_0x21e92d[_0x53dd('0x2f')]=_[_0x53dd('0x30')](_0x24403d[_0x53dd('0x2f')]);_0x21e92d['filters']=_['intersection'](_0x21e92d[_0x53dd('0x2d')],_0x21e92d[_0x53dd('0x2f')]);_0x3b2f31[_0x53dd('0x31')]=_[_0x53dd('0x32')](_0x21e92d['model'],qs[_0x53dd('0x33')](_0x24403d[_0x53dd('0x2f')][_0x53dd('0x33')]));_0x3b2f31[_0x53dd('0x31')]=_0x3b2f31[_0x53dd('0x31')][_0x53dd('0x34')]?_0x3b2f31[_0x53dd('0x31')]:_0x21e92d['model'];if(!_0x24403d[_0x53dd('0x2f')]['hasOwnProperty'](_0x53dd('0x35'))){_0x3b2f31[_0x53dd('0x1d')]=qs[_0x53dd('0x1d')](_0x24403d['query'][_0x53dd('0x1d')]);_0x3b2f31['offset']=qs[_0x53dd('0x1c')](_0x24403d[_0x53dd('0x2f')][_0x53dd('0x1c')]);}_0x3b2f31[_0x53dd('0x36')]=qs[_0x53dd('0x37')](_0x24403d[_0x53dd('0x2f')][_0x53dd('0x37')]);_0x3b2f31[_0x53dd('0x38')]=qs[_0x53dd('0x39')](_[_0x53dd('0x3a')](_0x24403d['query'],_0x21e92d[_0x53dd('0x39')]),_0x293957);if(_0x24403d['query'][_0x53dd('0x3b')]){_0x3b2f31[_0x53dd('0x38')]=_[_0x53dd('0x3c')](_0x3b2f31[_0x53dd('0x38')],{'$or':_['map'](_0x293957,function(_0x13f789){if(_0x13f789[_0x53dd('0x2c')]!==_0x53dd('0x3d')){var _0x4d6b63={};_0x4d6b63[_0x13f789[_0x53dd('0x2e')]]={'$like':'%'+_0x24403d[_0x53dd('0x2f')][_0x53dd('0x3b')]+'%'};return _0x4d6b63;}})});}_0x3b2f31=_[_0x53dd('0x3c')]({},_0x3b2f31,_0x24403d[_0x53dd('0x3e')]);var _0x51e95f={'where':_0x3b2f31[_0x53dd('0x38')]};return db['AnalyticCustomReport'][_0x53dd('0x3f')](_0x51e95f)[_0x53dd('0x22')](function(_0x1e44b0){_0x578d1e[_0x53dd('0x3f')]=_0x1e44b0;if(_0x24403d['query']['includeAll']){_0x3b2f31[_0x53dd('0x40')]=[{'all':!![]}];}return db[_0x53dd('0x41')][_0x53dd('0x42')](_0x3b2f31);})[_0x53dd('0x22')](function(_0x34e641){_0x578d1e[_0x53dd('0x43')]=_0x34e641;return _0x578d1e;})[_0x53dd('0x22')](respondWithFilteredResult(_0x55443d,_0x3b2f31))[_0x53dd('0x44')](handleError(_0x55443d,null));};exports[_0x53dd('0x45')]=function(_0x8b9797,_0x1fbcf5){var _0x1195d3={'raw':![],'where':{'id':_0x8b9797[_0x53dd('0x46')]['id']}},_0x2cfa58={};_0x2cfa58[_0x53dd('0x2d')]=_[_0x53dd('0x30')](db[_0x53dd('0x41')][_0x53dd('0x2a')]);_0x2cfa58[_0x53dd('0x2f')]=_[_0x53dd('0x30')](_0x8b9797[_0x53dd('0x2f')]);_0x2cfa58[_0x53dd('0x39')]=_['intersection'](_0x2cfa58[_0x53dd('0x2d')],_0x2cfa58[_0x53dd('0x2f')]);_0x1195d3[_0x53dd('0x31')]=_[_0x53dd('0x32')](_0x2cfa58[_0x53dd('0x2d')],qs[_0x53dd('0x33')](_0x8b9797[_0x53dd('0x2f')]['fields']));_0x1195d3[_0x53dd('0x31')]=_0x1195d3[_0x53dd('0x31')]['length']?_0x1195d3[_0x53dd('0x31')]:_0x2cfa58[_0x53dd('0x2d')];if(_0x8b9797['query']['includeAll']){_0x1195d3[_0x53dd('0x40')]=[{'all':!![]}];}_0x1195d3=_[_0x53dd('0x3c')]({},_0x1195d3,_0x8b9797[_0x53dd('0x3e')]);return db[_0x53dd('0x41')][_0x53dd('0x47')](_0x1195d3)[_0x53dd('0x22')](handleEntityNotFound(_0x1fbcf5,null))[_0x53dd('0x22')](respondWithResult(_0x1fbcf5,null))['catch'](handleError(_0x1fbcf5,null));};exports[_0x53dd('0x48')]=function(_0x978acf,_0x2ec7d4){return db['AnalyticCustomReport'][_0x53dd('0x48')](_0x978acf[_0x53dd('0x49')],{})[_0x53dd('0x22')](function(_0x5c0775){var _0x375d89=_0x978acf['user'][_0x53dd('0x24')]({'plain':!![]});if(!_0x375d89)throw new Error(_0x53dd('0x4a'));if(_0x375d89['role']===_0x53dd('0x4b')){var _0x45e83e=_0x5c0775['get']({'plain':!![]});var _0x18f2e7=_0x53dd('0x4c');return db['UserProfileSection']['find']({'where':{'name':_0x18f2e7,'userProfileId':_0x375d89[_0x53dd('0x4d')]},'raw':!![]})['then'](function(_0x386858){if(_0x386858&&_0x386858['autoAssociation']===0x0){return db[_0x53dd('0x25')][_0x53dd('0x48')]({'name':_0x45e83e[_0x53dd('0x2e')],'resourceId':_0x45e83e['id'],'type':_0x53dd('0x4e'),'sectionId':_0x386858['id']},{})[_0x53dd('0x22')](function(){return _0x5c0775;});}else{return _0x5c0775;}})[_0x53dd('0x44')](function(_0x64d2ab){logger[_0x53dd('0x4f')](_0x53dd('0x50'),_0x64d2ab);throw _0x64d2ab;});}return _0x5c0775;})[_0x53dd('0x22')](respondWithResult(_0x2ec7d4,0xc9))[_0x53dd('0x44')](handleError(_0x2ec7d4,null));};exports[_0x53dd('0x21')]=function(_0x373244,_0xb82775){if(_0x373244[_0x53dd('0x49')]['id']){delete _0x373244[_0x53dd('0x49')]['id'];}return db[_0x53dd('0x41')][_0x53dd('0x47')]({'where':{'id':_0x373244['params']['id']}})[_0x53dd('0x22')](handleEntityNotFound(_0xb82775,null))[_0x53dd('0x22')](saveUpdates(_0x373244[_0x53dd('0x49')],null))[_0x53dd('0x22')](respondWithResult(_0xb82775,null))['catch'](handleError(_0xb82775,null));};exports[_0x53dd('0x23')]=function(_0x3f306b,_0x21e3ed){return db[_0x53dd('0x41')][_0x53dd('0x47')]({'where':{'id':_0x3f306b[_0x53dd('0x46')]['id']}})[_0x53dd('0x22')](handleEntityNotFound(_0x21e3ed,null))[_0x53dd('0x22')](removeEntity(_0x21e3ed,null))['catch'](handleError(_0x21e3ed,null));};exports['preview']=function(_0x1b08f2,_0x317189){var _0x26136e=0xa;var _0x2859f8=[_0x53dd('0x51'),'left_join',_0x53dd('0x52'),_0x53dd('0x53')];var _0x85ae38={'SUM':_0x53dd('0x54'),'COUNT':_0x53dd('0x55'),'COUNT DISTINCT':_0x53dd('0x56'),'MAX':_0x53dd('0x57'),'MIN':_0x53dd('0x58'),'AVG':_0x53dd('0x59'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x53dd('0x5a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5ab35d={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x53dd('0x5b'),'ROUND':_0x53dd('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x19d2ed=function(_0x5b7884){return!_[_0x53dd('0x5d')]([_0x53dd('0x5e'),'IS\x20NOT\x20NULL',_0x53dd('0x5f'),_0x53dd('0x60')],_0x5b7884);};var _0x447552=function(_0x1e4cf6){if(!_0x1e4cf6||!_0x1e4cf6[_0x53dd('0x61')][_0x53dd('0x34')]){return'';}for(var _0x592282='(',_0x2975e2=0x0;_0x2975e2<_0x1e4cf6[_0x53dd('0x61')][_0x53dd('0x34')];_0x2975e2+=0x1){_0x2975e2>0x0&&(_0x592282+='\x20'+_0x1e4cf6['operator']+'\x20');_0x592282+=_0x1e4cf6[_0x53dd('0x61')][_0x2975e2][_0x53dd('0x62')]?_0x447552(_0x1e4cf6[_0x53dd('0x61')][_0x2975e2][_0x53dd('0x62')]):_0x1e4cf6[_0x53dd('0x61')][_0x2975e2][_0x53dd('0x63')]+'\x20'+_0x1e4cf6[_0x53dd('0x61')][_0x2975e2]['condition']+(_0x19d2ed(_0x1e4cf6[_0x53dd('0x61')][_0x2975e2][_0x53dd('0x64')])?'\x20'+_0x1e4cf6[_0x53dd('0x61')][_0x2975e2][_0x53dd('0x65')]:'');}return _0x592282+')';};var _0x3f0775={'where':{'id':_0x1b08f2['params']['id']}},_0x1b550a,_0x50ac1e,_0x5a5ead,_0x3c3e56,_0x293010;_0x3f0775=_['merge']({},_0x3f0775,_0x1b08f2[_0x53dd('0x3e')]);return db['AnalyticCustomReport'][_0x53dd('0x47')](_0x3f0775)[_0x53dd('0x22')](function(_0x43c015){if(_0x43c015){_0x1b550a=_0x43c015;return _0x43c015[_0x53dd('0x66')]();}return null;})[_0x53dd('0x22')](function(_0xb355a9){if(_0xb355a9){if(!_0xb355a9[_0x53dd('0x34')]){throw new db[(_0x53dd('0x67'))][(_0x53dd('0x68'))](_0x53dd('0x69'),0x193);}_0x50ac1e=_0xb355a9;return db[_0x53dd('0x6a')][_0x53dd('0x42')]({'raw':!![]});}return null;})[_0x53dd('0x22')](function(_0x56f799){if(_0x56f799){_0x5a5ead=_[_0x53dd('0x6b')](_0x56f799,'id');var _0x255d9c;var _0x3ba030=squel[_0x53dd('0x6c')]();_0x3ba030[_0x53dd('0x6d')](_0x1b550a[_0x53dd('0x6e')]);for(var _0x13998d=0x0;_0x13998d<_0x50ac1e[_0x53dd('0x34')];_0x13998d+=0x1){_0x255d9c=_0x50ac1e[_0x13998d][_0x53dd('0x6f')]?_0x5a5ead[_0x50ac1e[_0x13998d][_0x53dd('0x6f')]][_0x53dd('0x70')]:_0x50ac1e[_0x13998d][_0x53dd('0x63')];_0x255d9c=_0x50ac1e[_0x13998d][_0x53dd('0x71')]?_[_0x53dd('0x72')](_0x85ae38[_0x50ac1e[_0x13998d][_0x53dd('0x71')]],'%s',_0x255d9c):_0x255d9c;_0x255d9c=_0x50ac1e[_0x13998d][_0x53dd('0x73')]?_['replace'](_0x5ab35d[_0x50ac1e[_0x13998d]['format']],'%s',_0x255d9c):_0x255d9c;if(_0x50ac1e[_0x13998d][_0x53dd('0x74')]){_0x3ba030['group'](_0x255d9c);}_0x50ac1e[_0x13998d][_0x53dd('0x75')]&&_0x3ba030[_0x53dd('0x36')](_0x255d9c,_0x50ac1e[_0x13998d][_0x53dd('0x75')]===_0x53dd('0x76')?![]:!![]);_0x3ba030['field'](_0x255d9c,_0x50ac1e[_0x13998d][_0x53dd('0x77')]||_0x255d9c);}if(_0x1b550a[_0x53dd('0x78')]){_0x1b550a[_0x53dd('0x78')]=JSON[_0x53dd('0x79')](_0x1b550a[_0x53dd('0x78')]);for(var _0x2f92fd=0x0;_0x2f92fd<_0x1b550a['joins'][_0x53dd('0x34')];_0x2f92fd+=0x1){if(_0x1b550a[_0x53dd('0x78')][_0x2f92fd][_0x53dd('0x2c')]&&_[_0x53dd('0x5d')](_0x2859f8,_0x1b550a[_0x53dd('0x78')][_0x2f92fd][_0x53dd('0x2c')])&&_0x1b550a[_0x53dd('0x78')][_0x2f92fd][_0x53dd('0x7a')]&&_0x1b550a['joins'][_0x2f92fd][_0x53dd('0x7b')]&&_0x1b550a[_0x53dd('0x78')][_0x2f92fd][_0x53dd('0x7c')]){_0x3ba030[_0x1b550a[_0x53dd('0x78')][_0x2f92fd][_0x53dd('0x2c')]](_0x1b550a['joins'][_0x2f92fd]['foreignTable'],null,util[_0x53dd('0x73')](_0x53dd('0x7d'),_0x1b550a[_0x53dd('0x6e')],_0x1b550a['joins'][_0x2f92fd][_0x53dd('0x7a')],_0x1b550a[_0x53dd('0x78')][_0x2f92fd][_0x53dd('0x7b')],_0x1b550a['joins'][_0x2f92fd][_0x53dd('0x7c')]));}}}if(_0x1b550a['conditions']){_0x1b550a[_0x53dd('0x7e')]=JSON[_0x53dd('0x79')](_0x1b550a[_0x53dd('0x7e')]);_0x3ba030[_0x53dd('0x38')](_0x447552(_0x1b550a[_0x53dd('0x7e')]['group']));}_0x293010=_0x3ba030[_0x53dd('0x7f')]();_0x3ba030[_0x53dd('0x1d')](_0x26136e);_0x3ba030[_0x53dd('0x1c')](0x0);logger[_0x53dd('0x80')]('Limited\x20Query:',_0x3ba030['toString']());return db['sequelize'][_0x53dd('0x2f')](_0x3ba030[_0x53dd('0x81')](),{'type':db['sequelize']['QueryTypes'][_0x53dd('0x82')]});}})['then'](respondWithResult(_0x317189,null))[_0x53dd('0x44')](handleError(_0x317189,null));};function runReport(_0xccf36,_0x414930,_0x279632){var _0x5db6c8=_0x414930['name'];var _0x432357=0xa;var _0x58894e=[_0x53dd('0x51'),_0x53dd('0x83'),'right_join',_0x53dd('0x53')];var _0x43e72d={'SUM':_0x53dd('0x54'),'COUNT':_0x53dd('0x55'),'COUNT DISTINCT':_0x53dd('0x56'),'MAX':_0x53dd('0x57'),'MIN':_0x53dd('0x58'),'AVG':_0x53dd('0x59'),'GROUP_CONCAT':_0x53dd('0x84'),'GROUP_CONCAT ASC':_0x53dd('0x5a'),'GROUP_CONCAT DESC':_0x53dd('0x85')};var _0x53606a={'SEC_TO_TIME':_0x53dd('0x86'),'DATE':_0x53dd('0x87'),'HOUR':'HOUR(%s)','ROUND':_0x53dd('0x5c'),'UNIX_TIMESTAMP':_0x53dd('0x88')};var _0x538870=function(_0x151fbc){return!_[_0x53dd('0x5d')]([_0x53dd('0x5e'),'IS\x20NOT\x20NULL',_0x53dd('0x5f'),_0x53dd('0x60')],_0x151fbc);};var _0xe7db25=function(_0xaf39e8){if(!_0xaf39e8||!_0xaf39e8[_0x53dd('0x61')]['length']){return'';}for(var _0x5ade9d='(',_0x3137d3=0x0;_0x3137d3<_0xaf39e8[_0x53dd('0x61')][_0x53dd('0x34')];_0x3137d3+=0x1){_0x3137d3>0x0&&(_0x5ade9d+='\x20'+_0xaf39e8[_0x53dd('0x89')]+'\x20');_0x5ade9d+=_0xaf39e8['rules'][_0x3137d3][_0x53dd('0x62')]?_0xe7db25(_0xaf39e8[_0x53dd('0x61')][_0x3137d3][_0x53dd('0x62')]):_0xaf39e8[_0x53dd('0x61')][_0x3137d3][_0x53dd('0x63')]+'\x20'+_0xaf39e8[_0x53dd('0x61')][_0x3137d3][_0x53dd('0x64')]+(_0x538870(_0xaf39e8[_0x53dd('0x61')][_0x3137d3][_0x53dd('0x64')])?'\x20'+_0xaf39e8[_0x53dd('0x61')][_0x3137d3]['value']:'');}return _0x5ade9d+')';};var _0x46e173={'where':{'id':_0xccf36['id']}},_0xd571f3,_0x2e3626,_0x48c4f1,_0x5753d1,_0x3f4f9d;_0x46e173=_[_0x53dd('0x3c')]({},_0x46e173,_0x279632);return db[_0x53dd('0x41')]['find'](_0x46e173)[_0x53dd('0x22')](function(_0x197ed2){if(_0x197ed2){_0xd571f3=_0x197ed2;return _0x197ed2[_0x53dd('0x66')]();}return null;})['then'](function(_0x171d50){if(_0x171d50){if(!_0x171d50['length']){throw new db[(_0x53dd('0x67'))][(_0x53dd('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2e3626=_0x171d50;return db[_0x53dd('0x6a')][_0x53dd('0x42')]({'raw':!![]});}return null;})[_0x53dd('0x22')](function(_0x405664){if(_0x405664){_0x48c4f1=_[_0x53dd('0x6b')](_0x405664,'id');var _0xcec1f7;var _0x11c4cb=squel[_0x53dd('0x6c')]();_0x11c4cb['from'](_0xd571f3[_0x53dd('0x6e')]);for(var _0x3e8058=0x0;_0x3e8058<_0x2e3626[_0x53dd('0x34')];_0x3e8058+=0x1){_0xcec1f7=_0x2e3626[_0x3e8058][_0x53dd('0x6f')]?_0x48c4f1[_0x2e3626[_0x3e8058][_0x53dd('0x6f')]][_0x53dd('0x70')]:_0x2e3626[_0x3e8058][_0x53dd('0x63')];_0xcec1f7=_0x2e3626[_0x3e8058][_0x53dd('0x71')]?_[_0x53dd('0x72')](_0x43e72d[_0x2e3626[_0x3e8058][_0x53dd('0x71')]],'%s',_0xcec1f7):_0xcec1f7;_0xcec1f7=_0x2e3626[_0x3e8058][_0x53dd('0x73')]?_[_0x53dd('0x72')](_0x53606a[_0x2e3626[_0x3e8058]['format']],'%s',_0xcec1f7):_0xcec1f7;if(_0x2e3626[_0x3e8058]['groupBy']){_0x11c4cb[_0x53dd('0x62')](_0xcec1f7);}_0x2e3626[_0x3e8058][_0x53dd('0x75')]&&_0x11c4cb[_0x53dd('0x36')](_0xcec1f7,_0x2e3626[_0x3e8058]['orderBy']==='DESC'?![]:!![]);_0x11c4cb[_0x53dd('0x63')](_0xcec1f7,_0x2e3626[_0x3e8058][_0x53dd('0x77')]||_0xcec1f7);}if(_0xd571f3[_0x53dd('0x78')]){_0xd571f3[_0x53dd('0x78')]=JSON[_0x53dd('0x79')](_0xd571f3['joins']);for(var _0x265325=0x0;_0x265325<_0xd571f3[_0x53dd('0x78')][_0x53dd('0x34')];_0x265325+=0x1){if(_0xd571f3[_0x53dd('0x78')][_0x265325]['type']&&_[_0x53dd('0x5d')](_0x58894e,_0xd571f3[_0x53dd('0x78')][_0x265325][_0x53dd('0x2c')])&&_0xd571f3['joins'][_0x265325][_0x53dd('0x7a')]&&_0xd571f3['joins'][_0x265325]['foreignTable']&&_0xd571f3[_0x53dd('0x78')][_0x265325][_0x53dd('0x7c')]){_0x11c4cb[_0xd571f3[_0x53dd('0x78')][_0x265325][_0x53dd('0x2c')]](_0xd571f3[_0x53dd('0x78')][_0x265325]['foreignTable'],null,util[_0x53dd('0x73')](_0x53dd('0x7d'),_0xd571f3[_0x53dd('0x6e')],_0xd571f3[_0x53dd('0x78')][_0x265325]['parentKey'],_0xd571f3[_0x53dd('0x78')][_0x265325][_0x53dd('0x7b')],_0xd571f3['joins'][_0x265325][_0x53dd('0x7c')]));}}}if(_0xd571f3[_0x53dd('0x7e')]){_0xd571f3['conditions']=JSON[_0x53dd('0x79')](_0xd571f3[_0x53dd('0x7e')]);_0x11c4cb[_0x53dd('0x38')](_0xe7db25(_0xd571f3[_0x53dd('0x7e')][_0x53dd('0x62')]));}_0x3f4f9d=_0x11c4cb['clone']();_0x11c4cb[_0x53dd('0x1d')](_0x432357);_0x11c4cb[_0x53dd('0x1c')](0x0);logger[_0x53dd('0x80')](_0x53dd('0x8a'),_0x11c4cb[_0x53dd('0x81')]());return db[_0x53dd('0x8b')][_0x53dd('0x2f')](_0x11c4cb['toString'](),{'type':db['sequelize'][_0x53dd('0x8c')][_0x53dd('0x82')]});}})[_0x53dd('0x22')](function(_0x40da04){if(!_0x40da04[_0x53dd('0x34')]){throw new db[(_0x53dd('0x67'))]['ValidationErrorItem'](_0x53dd('0x8d'),0xcc);}if(_0x414930['output']==='web'){return null;}var _0x5bf22e=_[_0x53dd('0x3c')](_0x414930,{'name':_0x414930[_0x53dd('0x8e')]||_0x414930[_0x53dd('0x2e')]||_0xd571f3[_0x53dd('0x2e')],'basename':_0x5db6c8,'savename':util[_0x53dd('0x73')](_0x53dd('0x8f'),_0x414930[_0x53dd('0x2e')]||_0xd571f3[_0x53dd('0x2e')],require('randomstring')['generate'](0x4),_0x414930[_0x53dd('0x90')]||_0x53dd('0x91')),'reportId':_0xd571f3['id'],'reportType':_0x53dd('0x92')});return db[_0x53dd('0x93')]['create'](_0x5bf22e,{'raw':!![]});})[_0x53dd('0x22')](function(_0x3e0c08){if(_0xd571f3[_0x53dd('0x6e')]===_0x53dd('0x94')){_0x3f4f9d['where'](_0xd571f3['table']+_0x53dd('0x95'),_0x414930[_0x53dd('0x96')],_0x414930[_0x53dd('0x97')]);}else{_0x3f4f9d[_0x53dd('0x38')](_0xd571f3[_0x53dd('0x6e')]+_0x53dd('0x98'),_0x414930[_0x53dd('0x96')],_0x414930[_0x53dd('0x97')]);}if(_0x3e0c08){logger[_0x53dd('0x99')](_0x53dd('0x9a'),_0x3f4f9d[_0x53dd('0x81')]());require(_0x53dd('0x9b'))[_0x53dd('0x9c')](path[_0x53dd('0x51')](__dirname,_0x53dd('0x9d'),_0x3e0c08[_0x53dd('0x90')]),[_0x3e0c08['id'],_0x3f4f9d[_0x53dd('0x81')](),path[_0x53dd('0x51')](__dirname,_0x53dd('0x9e'),_0x3e0c08[_0x53dd('0x9f')]),_0x5db6c8]);return _0x3e0c08;}else{var _0x5de872=squel[_0x53dd('0x6c')]();_0x5de872[_0x53dd('0x6d')]('('+_0x3f4f9d[_0x53dd('0x81')]()+')',_0x53dd('0xa0'));_0x5de872['field'](_0x53dd('0xa1'),_0x53dd('0x3f'));_0x3f4f9d[_0x53dd('0x1d')](_0x414930[_0x53dd('0x1d')]||_0x432357);_0x3f4f9d[_0x53dd('0x1c')](_0x414930[_0x53dd('0x1c')]||0x0);return dbH[_0x53dd('0x8b')][_0x53dd('0x2f')](_0x5de872[_0x53dd('0x81')](),{'type':dbH[_0x53dd('0x8b')][_0x53dd('0x8c')][_0x53dd('0x82')]})[_0x53dd('0x22')](function(_0x57134a){if(!_0x57134a[_0x53dd('0x34')]){_0x5753d1=0x0;}else{_0x5753d1=_0x57134a[0x0][_0x53dd('0x3f')]||0x0;}return dbH[_0x53dd('0x8b')][_0x53dd('0x2f')](_0x3f4f9d[_0x53dd('0x81')](),{'type':dbH['sequelize'][_0x53dd('0x8c')][_0x53dd('0x82')]});})[_0x53dd('0x22')](function(_0x2e2728){return{'rows':_0x2e2728||[],'count':_0x5753d1};});}});}exports[_0x53dd('0xa2')]=function(_0x57d1df,_0x4afc62){return runReport(_0x57d1df['params'],_0x57d1df[_0x53dd('0x2f')],_0x57d1df[_0x53dd('0x3e')])['then'](respondWithResult(_0x4afc62,null))[_0x53dd('0x44')](handleError(_0x4afc62,null));};exports['runReport']=runReport;exports['query']=function(_0x3a9241,_0x430bba){var _0x3cfeb0=0xa;var _0x522cfb=[_0x53dd('0x51'),_0x53dd('0x83'),_0x53dd('0x52'),_0x53dd('0x53')];var _0x54ae4a={'SUM':_0x53dd('0x54'),'COUNT':_0x53dd('0x55'),'COUNT DISTINCT':_0x53dd('0x56'),'MAX':_0x53dd('0x57'),'MIN':'MIN(%s)','AVG':_0x53dd('0x59'),'GROUP_CONCAT':_0x53dd('0x84'),'GROUP_CONCAT ASC':_0x53dd('0x5a'),'GROUP_CONCAT DESC':_0x53dd('0x85')};var _0x49a8a7={'SEC_TO_TIME':_0x53dd('0x86'),'DATE':_0x53dd('0x87'),'HOUR':_0x53dd('0x5b'),'ROUND':_0x53dd('0x5c'),'UNIX_TIMESTAMP':_0x53dd('0x88')};var _0x5f099b=function(_0x3d6d3d){return!_[_0x53dd('0x5d')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x53dd('0x5f'),'IS\x20NOT\x20EMPTY'],_0x3d6d3d);};var _0x24bcea=function(_0x41f3d9){if(!_0x41f3d9||!_0x41f3d9['rules'][_0x53dd('0x34')]){return'';}for(var _0x22a1cf='(',_0x3d833c=0x0;_0x3d833c<_0x41f3d9[_0x53dd('0x61')]['length'];_0x3d833c+=0x1){_0x3d833c>0x0&&(_0x22a1cf+='\x20'+_0x41f3d9[_0x53dd('0x89')]+'\x20');_0x22a1cf+=_0x41f3d9[_0x53dd('0x61')][_0x3d833c]['group']?_0x24bcea(_0x41f3d9['rules'][_0x3d833c]['group']):_0x41f3d9[_0x53dd('0x61')][_0x3d833c][_0x53dd('0x63')]+'\x20'+_0x41f3d9[_0x53dd('0x61')][_0x3d833c][_0x53dd('0x64')]+(_0x5f099b(_0x41f3d9[_0x53dd('0x61')][_0x3d833c][_0x53dd('0x64')])?'\x20'+_0x41f3d9[_0x53dd('0x61')][_0x3d833c][_0x53dd('0x65')]:'');}return _0x22a1cf+')';};var _0x3eebc2={'where':{'id':_0x3a9241[_0x53dd('0x46')]['id']}},_0x3b8b6e,_0x514efe,_0x285d62,_0x33693e,_0x26decb;_0x3eebc2=_['merge']({},_0x3eebc2,_0x3a9241[_0x53dd('0x3e')]);return db[_0x53dd('0x41')]['find'](_0x3eebc2)[_0x53dd('0x22')](function(_0x416550){if(_0x416550){_0x3b8b6e=_0x416550;return _0x416550[_0x53dd('0x66')]();}return null;})['then'](function(_0x21c0e4){if(_0x21c0e4){if(!_0x21c0e4[_0x53dd('0x34')]){throw new db[(_0x53dd('0x67'))][(_0x53dd('0x68'))](_0x53dd('0x69'),0x193);}_0x514efe=_0x21c0e4;return db[_0x53dd('0x6a')][_0x53dd('0x42')]({'raw':!![]});}return null;})[_0x53dd('0x22')](function(_0xeeb579){if(_0xeeb579){_0x285d62=_['keyBy'](_0xeeb579,'id');var _0x26e3c3;var _0x4877f1=squel['select']();_0x4877f1[_0x53dd('0x6d')](_0x3b8b6e[_0x53dd('0x6e')]);for(var _0x22d6cc=0x0;_0x22d6cc<_0x514efe[_0x53dd('0x34')];_0x22d6cc+=0x1){_0x26e3c3=_0x514efe[_0x22d6cc][_0x53dd('0x6f')]?_0x285d62[_0x514efe[_0x22d6cc][_0x53dd('0x6f')]][_0x53dd('0x70')]:_0x514efe[_0x22d6cc][_0x53dd('0x63')];_0x26e3c3=_0x514efe[_0x22d6cc]['function']?_[_0x53dd('0x72')](_0x54ae4a[_0x514efe[_0x22d6cc][_0x53dd('0x71')]],'%s',_0x26e3c3):_0x26e3c3;_0x26e3c3=_0x514efe[_0x22d6cc]['format']?_[_0x53dd('0x72')](_0x49a8a7[_0x514efe[_0x22d6cc][_0x53dd('0x73')]],'%s',_0x26e3c3):_0x26e3c3;if(_0x514efe[_0x22d6cc]['groupBy']){_0x4877f1[_0x53dd('0x62')](_0x26e3c3);}_0x514efe[_0x22d6cc][_0x53dd('0x75')]&&_0x4877f1['order'](_0x26e3c3,_0x514efe[_0x22d6cc]['orderBy']==='DESC'?![]:!![]);_0x4877f1[_0x53dd('0x63')](_0x26e3c3,_0x514efe[_0x22d6cc][_0x53dd('0x77')]||_0x26e3c3);}if(_0x3b8b6e[_0x53dd('0x78')]){_0x3b8b6e['joins']=JSON[_0x53dd('0x79')](_0x3b8b6e[_0x53dd('0x78')]);for(var _0x404113=0x0;_0x404113<_0x3b8b6e[_0x53dd('0x78')][_0x53dd('0x34')];_0x404113+=0x1){if(_0x3b8b6e[_0x53dd('0x78')][_0x404113]['type']&&_[_0x53dd('0x5d')](_0x522cfb,_0x3b8b6e['joins'][_0x404113]['type'])&&_0x3b8b6e['joins'][_0x404113][_0x53dd('0x7a')]&&_0x3b8b6e[_0x53dd('0x78')][_0x404113]['foreignTable']&&_0x3b8b6e[_0x53dd('0x78')][_0x404113][_0x53dd('0x7c')]){_0x4877f1[_0x3b8b6e[_0x53dd('0x78')][_0x404113][_0x53dd('0x2c')]](_0x3b8b6e['joins'][_0x404113][_0x53dd('0x7b')],null,util[_0x53dd('0x73')]('%s.%s\x20=\x20%s.%s',_0x3b8b6e[_0x53dd('0x6e')],_0x3b8b6e[_0x53dd('0x78')][_0x404113][_0x53dd('0x7a')],_0x3b8b6e[_0x53dd('0x78')][_0x404113][_0x53dd('0x7b')],_0x3b8b6e['joins'][_0x404113][_0x53dd('0x7c')]));}}}if(_0x3b8b6e['conditions']){_0x3b8b6e[_0x53dd('0x7e')]=JSON[_0x53dd('0x79')](_0x3b8b6e[_0x53dd('0x7e')]);_0x4877f1[_0x53dd('0x38')](_0x24bcea(_0x3b8b6e[_0x53dd('0x7e')][_0x53dd('0x62')]));}_0x26decb=_0x4877f1[_0x53dd('0x7f')]();_0x4877f1[_0x53dd('0x1d')](_0x3cfeb0);_0x4877f1[_0x53dd('0x1c')](0x0);logger['debug'](_0x53dd('0x8a'),_0x4877f1[_0x53dd('0x81')]());return db[_0x53dd('0x8b')][_0x53dd('0x2f')](_0x4877f1[_0x53dd('0x81')](),{'type':db[_0x53dd('0x8b')]['QueryTypes']['SELECT']});}})['then'](function(){return{'sql':_0x26decb['toString']()};})[_0x53dd('0x22')](respondWithResult(_0x430bba,null))[_0x53dd('0x44')](handleError(_0x430bba,null));}; \ No newline at end of file +var _0x8388=['group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','replace','function','format','groupBy','orderBy','DESC','parse','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20EMPTY','select','alias','debug','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','save','update','then','destroy','UserProfileResource','error','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','count','include','AnalyticCustomReport','findAll','rows','catch','show','params','filters','includeAll','merge','options','find','create','body','get','role','Reports','UserProfileSection','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator'];(function(_0x5b41de,_0x592d1b){var _0x894470=function(_0x316c07){while(--_0x316c07){_0x5b41de['push'](_0x5b41de['shift']());}};_0x894470(++_0x592d1b);}(_0x8388,0x18d));var _0x8838=function(_0x23a79e,_0x235f89){_0x23a79e=_0x23a79e-0x0;var _0x3dab57=_0x8388[_0x23a79e];return _0x3dab57;};'use strict';var pdf=require(_0x8838('0x0'));var emlformat=require(_0x8838('0x1'));var rimraf=require(_0x8838('0x2'));var zipdir=require(_0x8838('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8838('0x4'));var moment=require(_0x8838('0x5'));var BPromise=require(_0x8838('0x6'));var Mustache=require(_0x8838('0x7'));var util=require(_0x8838('0x8'));var path=require('path');var sox=require(_0x8838('0x9'));var csv=require(_0x8838('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8838('0xb'));var squel=require(_0x8838('0xc'));var crypto=require(_0x8838('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8838('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8838('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8838('0x10'));var as=require(_0x8838('0x11'));var hardwareService=require(_0x8838('0x12'));var logger=require(_0x8838('0x13'))('api');var utils=require(_0x8838('0x14'));var config=require(_0x8838('0x15'));var db=require(_0x8838('0x16'))['db'];var dbH=require(_0x8838('0x16'))['dbH'];function respondWithStatusCode(_0x157a82,_0x48dc7a){_0x48dc7a=_0x48dc7a||0xcc;return function(_0x530bac){if(_0x530bac){return _0x157a82[_0x8838('0x17')](_0x48dc7a);}return _0x157a82[_0x8838('0x18')](_0x48dc7a)[_0x8838('0x19')]();};}function respondWithResult(_0x43b446,_0x15936c){_0x15936c=_0x15936c||0xc8;return function(_0x22b3d4){if(_0x22b3d4){return _0x43b446[_0x8838('0x18')](_0x15936c)[_0x8838('0x1a')](_0x22b3d4);}};}function respondWithFilteredResult(_0x486dae,_0x44a342){return function(_0x377db0){if(_0x377db0){var _0x5eecf2=_0x377db0['count'],_0x10a41f=_0x44a342[_0x8838('0x1b')],_0xab3fb8=_0x44a342['offset']+_0x44a342[_0x8838('0x1c')],_0x1a089c;if(_0xab3fb8>=_0x5eecf2){_0xab3fb8=_0x5eecf2;_0x1a089c=0xc8;}else{_0x1a089c=0xce;}_0x486dae[_0x8838('0x18')](_0x1a089c);return _0x486dae[_0x8838('0x1d')]('Content-Range',_0x10a41f+'-'+_0xab3fb8+'/'+_0x5eecf2)[_0x8838('0x1a')](_0x377db0);}return null;};}function patchUpdates(_0x7b836e){return function(_0x4d34bd){try{jsonpatch[_0x8838('0x1e')](_0x4d34bd,_0x7b836e,!![]);}catch(_0x2a1ccd){return BPromise['reject'](_0x2a1ccd);}return _0x4d34bd[_0x8838('0x1f')]();};}function saveUpdates(_0xd59bca,_0x53cd4b){return function(_0x55ccbc){if(_0x55ccbc){return _0x55ccbc[_0x8838('0x20')](_0xd59bca)[_0x8838('0x21')](function(_0xe01a61){return _0xe01a61;});}return null;};}function removeEntity(_0xb74e1b,_0x109341){return function(_0xa008f2){if(_0xa008f2){return _0xa008f2[_0x8838('0x22')]()[_0x8838('0x21')](function(){var _0x46b603=_0xa008f2['get']({'plain':!![]});var _0x73d719='CustomReports';return db[_0x8838('0x23')][_0x8838('0x22')]({'where':{'type':_0x73d719,'resourceId':_0x46b603['id']}})['then'](function(){return _0xa008f2;});})['then'](function(){_0xb74e1b[_0x8838('0x18')](0xcc)[_0x8838('0x19')]();});}};}function handleEntityNotFound(_0x105887,_0x45e5bb){return function(_0x1c611a){if(!_0x1c611a){_0x105887[_0x8838('0x17')](0x194);}return _0x1c611a;};}function handleError(_0x1b7c30,_0x1fe141){_0x1fe141=_0x1fe141||0x1f4;return function(_0xaca1e7){logger[_0x8838('0x24')](_0xaca1e7['stack']);if(_0xaca1e7['name']){delete _0xaca1e7[_0x8838('0x25')];}_0x1b7c30['status'](_0x1fe141)[_0x8838('0x26')](_0xaca1e7);};}exports[_0x8838('0x27')]=function(_0x5da3b0,_0x537c9d){var _0x2ac2b1={},_0x5113f8={},_0x552bc9={'count':0x0,'rows':[]};var _0x1b605d=_[_0x8838('0x28')](db['AnalyticCustomReport'][_0x8838('0x29')],function(_0x296ba1){return{'name':_0x296ba1['fieldName'],'type':_0x296ba1[_0x8838('0x2a')][_0x8838('0x2b')]};});_0x5113f8[_0x8838('0x2c')]=_[_0x8838('0x28')](_0x1b605d,'name');_0x5113f8[_0x8838('0x2d')]=_[_0x8838('0x2e')](_0x5da3b0['query']);_0x5113f8['filters']=_[_0x8838('0x2f')](_0x5113f8['model'],_0x5113f8[_0x8838('0x2d')]);_0x2ac2b1[_0x8838('0x30')]=_[_0x8838('0x2f')](_0x5113f8['model'],qs[_0x8838('0x31')](_0x5da3b0[_0x8838('0x2d')][_0x8838('0x31')]));_0x2ac2b1['attributes']=_0x2ac2b1[_0x8838('0x30')][_0x8838('0x32')]?_0x2ac2b1[_0x8838('0x30')]:_0x5113f8['model'];if(!_0x5da3b0['query'][_0x8838('0x33')](_0x8838('0x34'))){_0x2ac2b1[_0x8838('0x1c')]=qs[_0x8838('0x1c')](_0x5da3b0['query'][_0x8838('0x1c')]);_0x2ac2b1[_0x8838('0x1b')]=qs[_0x8838('0x1b')](_0x5da3b0[_0x8838('0x2d')][_0x8838('0x1b')]);}_0x2ac2b1[_0x8838('0x35')]=qs[_0x8838('0x36')](_0x5da3b0[_0x8838('0x2d')]['sort']);_0x2ac2b1[_0x8838('0x37')]=qs['filters'](_['pick'](_0x5da3b0['query'],_0x5113f8['filters']),_0x1b605d);if(_0x5da3b0[_0x8838('0x2d')][_0x8838('0x38')]){_0x2ac2b1[_0x8838('0x37')]=_['merge'](_0x2ac2b1[_0x8838('0x37')],{'$or':_[_0x8838('0x28')](_0x1b605d,function(_0x3c9e1e){if(_0x3c9e1e[_0x8838('0x2a')]!==_0x8838('0x39')){var _0x39f5fd={};_0x39f5fd[_0x3c9e1e[_0x8838('0x25')]]={'$like':'%'+_0x5da3b0['query']['filter']+'%'};return _0x39f5fd;}})});}_0x2ac2b1=_['merge']({},_0x2ac2b1,_0x5da3b0['options']);var _0x3bc27c={'where':_0x2ac2b1[_0x8838('0x37')]};return db['AnalyticCustomReport'][_0x8838('0x3a')](_0x3bc27c)[_0x8838('0x21')](function(_0x2ebc6c){_0x552bc9['count']=_0x2ebc6c;if(_0x5da3b0[_0x8838('0x2d')]['includeAll']){_0x2ac2b1[_0x8838('0x3b')]=[{'all':!![]}];}return db[_0x8838('0x3c')][_0x8838('0x3d')](_0x2ac2b1);})[_0x8838('0x21')](function(_0x440585){_0x552bc9[_0x8838('0x3e')]=_0x440585;return _0x552bc9;})['then'](respondWithFilteredResult(_0x537c9d,_0x2ac2b1))[_0x8838('0x3f')](handleError(_0x537c9d,null));};exports[_0x8838('0x40')]=function(_0x5dfa10,_0x52e0e2){var _0x2e694b={'raw':![],'where':{'id':_0x5dfa10[_0x8838('0x41')]['id']}},_0xde98de={};_0xde98de[_0x8838('0x2c')]=_[_0x8838('0x2e')](db['AnalyticCustomReport'][_0x8838('0x29')]);_0xde98de[_0x8838('0x2d')]=_[_0x8838('0x2e')](_0x5dfa10[_0x8838('0x2d')]);_0xde98de[_0x8838('0x42')]=_['intersection'](_0xde98de['model'],_0xde98de[_0x8838('0x2d')]);_0x2e694b['attributes']=_[_0x8838('0x2f')](_0xde98de[_0x8838('0x2c')],qs[_0x8838('0x31')](_0x5dfa10['query']['fields']));_0x2e694b[_0x8838('0x30')]=_0x2e694b[_0x8838('0x30')][_0x8838('0x32')]?_0x2e694b[_0x8838('0x30')]:_0xde98de[_0x8838('0x2c')];if(_0x5dfa10[_0x8838('0x2d')][_0x8838('0x43')]){_0x2e694b[_0x8838('0x3b')]=[{'all':!![]}];}_0x2e694b=_[_0x8838('0x44')]({},_0x2e694b,_0x5dfa10[_0x8838('0x45')]);return db[_0x8838('0x3c')][_0x8838('0x46')](_0x2e694b)['then'](handleEntityNotFound(_0x52e0e2,null))[_0x8838('0x21')](respondWithResult(_0x52e0e2,null))['catch'](handleError(_0x52e0e2,null));};exports[_0x8838('0x47')]=function(_0x5d498b,_0x3afe73){return db[_0x8838('0x3c')][_0x8838('0x47')](_0x5d498b[_0x8838('0x48')],{})[_0x8838('0x21')](function(_0x226f91){var _0x3a1b8a=_0x5d498b['user'][_0x8838('0x49')]({'plain':!![]});if(!_0x3a1b8a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a1b8a[_0x8838('0x4a')]==='user'){var _0x25432f=_0x226f91[_0x8838('0x49')]({'plain':!![]});var _0x4e2a14=_0x8838('0x4b');return db[_0x8838('0x4c')][_0x8838('0x46')]({'where':{'name':_0x4e2a14,'userProfileId':_0x3a1b8a['userProfileId']},'raw':!![]})[_0x8838('0x21')](function(_0x206fef){if(_0x206fef&&_0x206fef[_0x8838('0x4d')]===0x0){return db['UserProfileResource'][_0x8838('0x47')]({'name':_0x25432f[_0x8838('0x25')],'resourceId':_0x25432f['id'],'type':_0x8838('0x4e'),'sectionId':_0x206fef['id']},{})[_0x8838('0x21')](function(){return _0x226f91;});}else{return _0x226f91;}})[_0x8838('0x3f')](function(_0x2bb99f){logger[_0x8838('0x24')](_0x8838('0x4f'),_0x2bb99f);throw _0x2bb99f;});}return _0x226f91;})[_0x8838('0x21')](respondWithResult(_0x3afe73,0xc9))[_0x8838('0x3f')](handleError(_0x3afe73,null));};exports[_0x8838('0x20')]=function(_0x1dc4ae,_0xf3310){if(_0x1dc4ae['body']['id']){delete _0x1dc4ae[_0x8838('0x48')]['id'];}return db['AnalyticCustomReport'][_0x8838('0x46')]({'where':{'id':_0x1dc4ae[_0x8838('0x41')]['id']}})[_0x8838('0x21')](handleEntityNotFound(_0xf3310,null))[_0x8838('0x21')](saveUpdates(_0x1dc4ae[_0x8838('0x48')],null))[_0x8838('0x21')](respondWithResult(_0xf3310,null))[_0x8838('0x3f')](handleError(_0xf3310,null));};exports['destroy']=function(_0x1f1259,_0x13cdfb){return db[_0x8838('0x3c')][_0x8838('0x46')]({'where':{'id':_0x1f1259[_0x8838('0x41')]['id']}})[_0x8838('0x21')](handleEntityNotFound(_0x13cdfb,null))['then'](removeEntity(_0x13cdfb,null))[_0x8838('0x3f')](handleError(_0x13cdfb,null));};exports[_0x8838('0x50')]=function(_0x504534,_0x3db35d){var _0x47d15c=0xa;var _0x8eaf6b=[_0x8838('0x51'),_0x8838('0x52'),_0x8838('0x53'),'cross_join'];var _0x338166={'SUM':_0x8838('0x54'),'COUNT':_0x8838('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x8838('0x56'),'MIN':_0x8838('0x57'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x8838('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3d506a={'SEC_TO_TIME':_0x8838('0x59'),'DATE':_0x8838('0x5a'),'HOUR':_0x8838('0x5b'),'ROUND':_0x8838('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1e6b9d=function(_0x4b3b4e){return!_[_0x8838('0x5d')](['IS\x20NULL',_0x8838('0x5e'),_0x8838('0x5f'),'IS\x20NOT\x20EMPTY'],_0x4b3b4e);};var _0x4ff75b=function(_0x5ba896){if(!_0x5ba896||!_0x5ba896[_0x8838('0x60')]['length']){return'';}for(var _0x287258='(',_0x50e754=0x0;_0x50e754<_0x5ba896['rules'][_0x8838('0x32')];_0x50e754+=0x1){_0x50e754>0x0&&(_0x287258+='\x20'+_0x5ba896[_0x8838('0x61')]+'\x20');_0x287258+=_0x5ba896['rules'][_0x50e754][_0x8838('0x62')]?_0x4ff75b(_0x5ba896[_0x8838('0x60')][_0x50e754][_0x8838('0x62')]):_0x5ba896['rules'][_0x50e754][_0x8838('0x63')]+'\x20'+_0x5ba896[_0x8838('0x60')][_0x50e754][_0x8838('0x64')]+(_0x1e6b9d(_0x5ba896[_0x8838('0x60')][_0x50e754][_0x8838('0x64')])?'\x20'+_0x5ba896[_0x8838('0x60')][_0x50e754][_0x8838('0x65')]:'');}return _0x287258+')';};var _0x5aa054={'where':{'id':_0x504534[_0x8838('0x41')]['id']}},_0x39c289,_0x26029f,_0xf6a1ed,_0xe73cd4,_0xad38a1;_0x5aa054=_[_0x8838('0x44')]({},_0x5aa054,_0x504534['options']);return db['AnalyticCustomReport'][_0x8838('0x46')](_0x5aa054)[_0x8838('0x21')](function(_0x397109){if(_0x397109){_0x39c289=_0x397109;return _0x397109[_0x8838('0x66')]();}return null;})[_0x8838('0x21')](function(_0x21c6f3){if(_0x21c6f3){if(!_0x21c6f3[_0x8838('0x32')]){throw new db[(_0x8838('0x67'))][(_0x8838('0x68'))](_0x8838('0x69'),0x193);}_0x26029f=_0x21c6f3;return db[_0x8838('0x6a')]['findAll']({'raw':!![]});}return null;})[_0x8838('0x21')](function(_0x14fbe4){if(_0x14fbe4){_0xf6a1ed=_[_0x8838('0x6b')](_0x14fbe4,'id');var _0x44b5f7;var _0x376be6=squel['select']();_0x376be6[_0x8838('0x6c')](_0x39c289[_0x8838('0x6d')]);for(var _0x29250d=0x0;_0x29250d<_0x26029f[_0x8838('0x32')];_0x29250d+=0x1){_0x44b5f7=_0x26029f[_0x29250d]['MetricId']?_0xf6a1ed[_0x26029f[_0x29250d][_0x8838('0x6e')]][_0x8838('0x6f')]:_0x26029f[_0x29250d][_0x8838('0x63')];_0x44b5f7=_0x26029f[_0x29250d]['function']?_[_0x8838('0x70')](_0x338166[_0x26029f[_0x29250d][_0x8838('0x71')]],'%s',_0x44b5f7):_0x44b5f7;_0x44b5f7=_0x26029f[_0x29250d]['format']?_[_0x8838('0x70')](_0x3d506a[_0x26029f[_0x29250d][_0x8838('0x72')]],'%s',_0x44b5f7):_0x44b5f7;if(_0x26029f[_0x29250d][_0x8838('0x73')]){_0x376be6[_0x8838('0x62')](_0x44b5f7);}_0x26029f[_0x29250d][_0x8838('0x74')]&&_0x376be6['order'](_0x44b5f7,_0x26029f[_0x29250d]['orderBy']===_0x8838('0x75')?![]:!![]);_0x376be6['field'](_0x44b5f7,_0x26029f[_0x29250d]['alias']||_0x44b5f7);}if(_0x39c289['joins']){_0x39c289['joins']=JSON[_0x8838('0x76')](_0x39c289[_0x8838('0x77')]);for(var _0x5a5f2d=0x0;_0x5a5f2d<_0x39c289[_0x8838('0x77')][_0x8838('0x32')];_0x5a5f2d+=0x1){if(_0x39c289[_0x8838('0x77')][_0x5a5f2d][_0x8838('0x2a')]&&_[_0x8838('0x5d')](_0x8eaf6b,_0x39c289[_0x8838('0x77')][_0x5a5f2d][_0x8838('0x2a')])&&_0x39c289[_0x8838('0x77')][_0x5a5f2d][_0x8838('0x78')]&&_0x39c289['joins'][_0x5a5f2d]['foreignTable']&&_0x39c289[_0x8838('0x77')][_0x5a5f2d][_0x8838('0x79')]){_0x376be6[_0x39c289[_0x8838('0x77')][_0x5a5f2d][_0x8838('0x2a')]](_0x39c289[_0x8838('0x77')][_0x5a5f2d][_0x8838('0x7a')],null,util[_0x8838('0x72')](_0x8838('0x7b'),_0x39c289[_0x8838('0x6d')],_0x39c289[_0x8838('0x77')][_0x5a5f2d]['parentKey'],_0x39c289[_0x8838('0x77')][_0x5a5f2d]['foreignTable'],_0x39c289[_0x8838('0x77')][_0x5a5f2d]['foreignKey']));}}}if(_0x39c289[_0x8838('0x7c')]){_0x39c289['conditions']=JSON[_0x8838('0x76')](_0x39c289[_0x8838('0x7c')]);_0x376be6['where'](_0x4ff75b(_0x39c289['conditions'][_0x8838('0x62')]));}_0xad38a1=_0x376be6[_0x8838('0x7d')]();_0x376be6[_0x8838('0x1c')](_0x47d15c);_0x376be6[_0x8838('0x1b')](0x0);logger['debug'](_0x8838('0x7e'),_0x376be6[_0x8838('0x7f')]());return db[_0x8838('0x80')][_0x8838('0x2d')](_0x376be6[_0x8838('0x7f')](),{'type':db[_0x8838('0x80')][_0x8838('0x81')][_0x8838('0x82')]});}})[_0x8838('0x21')](respondWithResult(_0x3db35d,null))['catch'](handleError(_0x3db35d,null));};function runReport(_0x274e6b,_0x2ff3a2,_0x1ce6f4){var _0x3d516a=_0x2ff3a2['name'];var _0x1ee988=0xa;var _0xe325b7=['join','left_join','right_join',_0x8838('0x83')];var _0x37f564={'SUM':'SUM(%s)','COUNT':_0x8838('0x55'),'COUNT DISTINCT':_0x8838('0x84'),'MAX':_0x8838('0x56'),'MIN':'MIN(%s)','AVG':_0x8838('0x85'),'GROUP_CONCAT':_0x8838('0x58'),'GROUP_CONCAT ASC':_0x8838('0x86'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x61b9ae={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x8838('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x8838('0x5c'),'UNIX_TIMESTAMP':_0x8838('0x87')};var _0x37312a=function(_0x4343e7){return!_[_0x8838('0x5d')]([_0x8838('0x88'),_0x8838('0x5e'),_0x8838('0x5f'),_0x8838('0x89')],_0x4343e7);};var _0xf2b6fb=function(_0x2f8e0e){if(!_0x2f8e0e||!_0x2f8e0e[_0x8838('0x60')][_0x8838('0x32')]){return'';}for(var _0x425745='(',_0x3ea2d6=0x0;_0x3ea2d6<_0x2f8e0e['rules']['length'];_0x3ea2d6+=0x1){_0x3ea2d6>0x0&&(_0x425745+='\x20'+_0x2f8e0e[_0x8838('0x61')]+'\x20');_0x425745+=_0x2f8e0e[_0x8838('0x60')][_0x3ea2d6][_0x8838('0x62')]?_0xf2b6fb(_0x2f8e0e[_0x8838('0x60')][_0x3ea2d6][_0x8838('0x62')]):_0x2f8e0e[_0x8838('0x60')][_0x3ea2d6][_0x8838('0x63')]+'\x20'+_0x2f8e0e[_0x8838('0x60')][_0x3ea2d6][_0x8838('0x64')]+(_0x37312a(_0x2f8e0e[_0x8838('0x60')][_0x3ea2d6][_0x8838('0x64')])?'\x20'+_0x2f8e0e[_0x8838('0x60')][_0x3ea2d6][_0x8838('0x65')]:'');}return _0x425745+')';};var _0x5b2fa0={'where':{'id':_0x274e6b['id']}},_0x38ae40,_0x1c444d,_0x2db792,_0xdc66dc,_0x117974;_0x5b2fa0=_[_0x8838('0x44')]({},_0x5b2fa0,_0x1ce6f4);return db[_0x8838('0x3c')][_0x8838('0x46')](_0x5b2fa0)['then'](function(_0x340c22){if(_0x340c22){_0x38ae40=_0x340c22;return _0x340c22[_0x8838('0x66')]();}return null;})['then'](function(_0x32e2d1){if(_0x32e2d1){if(!_0x32e2d1[_0x8838('0x32')]){throw new db['Sequelize'][(_0x8838('0x68'))](_0x8838('0x69'),0x193);}_0x1c444d=_0x32e2d1;return db[_0x8838('0x6a')][_0x8838('0x3d')]({'raw':!![]});}return null;})['then'](function(_0x335a93){if(_0x335a93){_0x2db792=_[_0x8838('0x6b')](_0x335a93,'id');var _0x829fbb;var _0x32f906=squel[_0x8838('0x8a')]();_0x32f906[_0x8838('0x6c')](_0x38ae40[_0x8838('0x6d')]);for(var _0x44ae02=0x0;_0x44ae02<_0x1c444d[_0x8838('0x32')];_0x44ae02+=0x1){_0x829fbb=_0x1c444d[_0x44ae02]['MetricId']?_0x2db792[_0x1c444d[_0x44ae02]['MetricId']][_0x8838('0x6f')]:_0x1c444d[_0x44ae02][_0x8838('0x63')];_0x829fbb=_0x1c444d[_0x44ae02][_0x8838('0x71')]?_['replace'](_0x37f564[_0x1c444d[_0x44ae02][_0x8838('0x71')]],'%s',_0x829fbb):_0x829fbb;_0x829fbb=_0x1c444d[_0x44ae02][_0x8838('0x72')]?_[_0x8838('0x70')](_0x61b9ae[_0x1c444d[_0x44ae02][_0x8838('0x72')]],'%s',_0x829fbb):_0x829fbb;if(_0x1c444d[_0x44ae02][_0x8838('0x73')]){_0x32f906['group'](_0x829fbb);}_0x1c444d[_0x44ae02][_0x8838('0x74')]&&_0x32f906['order'](_0x829fbb,_0x1c444d[_0x44ae02][_0x8838('0x74')]===_0x8838('0x75')?![]:!![]);_0x32f906[_0x8838('0x63')](_0x829fbb,_0x1c444d[_0x44ae02][_0x8838('0x8b')]||_0x829fbb);}if(_0x38ae40['joins']){_0x38ae40[_0x8838('0x77')]=JSON[_0x8838('0x76')](_0x38ae40['joins']);for(var _0x2aca35=0x0;_0x2aca35<_0x38ae40[_0x8838('0x77')][_0x8838('0x32')];_0x2aca35+=0x1){if(_0x38ae40[_0x8838('0x77')][_0x2aca35]['type']&&_[_0x8838('0x5d')](_0xe325b7,_0x38ae40['joins'][_0x2aca35][_0x8838('0x2a')])&&_0x38ae40[_0x8838('0x77')][_0x2aca35][_0x8838('0x78')]&&_0x38ae40[_0x8838('0x77')][_0x2aca35][_0x8838('0x7a')]&&_0x38ae40[_0x8838('0x77')][_0x2aca35][_0x8838('0x79')]){_0x32f906[_0x38ae40[_0x8838('0x77')][_0x2aca35][_0x8838('0x2a')]](_0x38ae40[_0x8838('0x77')][_0x2aca35][_0x8838('0x7a')],null,util[_0x8838('0x72')]('%s.%s\x20=\x20%s.%s',_0x38ae40['table'],_0x38ae40[_0x8838('0x77')][_0x2aca35][_0x8838('0x78')],_0x38ae40[_0x8838('0x77')][_0x2aca35]['foreignTable'],_0x38ae40[_0x8838('0x77')][_0x2aca35][_0x8838('0x79')]));}}}if(_0x38ae40[_0x8838('0x7c')]){_0x38ae40['conditions']=JSON[_0x8838('0x76')](_0x38ae40[_0x8838('0x7c')]);_0x32f906[_0x8838('0x37')](_0xf2b6fb(_0x38ae40[_0x8838('0x7c')][_0x8838('0x62')]));}_0x117974=_0x32f906['clone']();_0x32f906['limit'](_0x1ee988);_0x32f906[_0x8838('0x1b')](0x0);logger[_0x8838('0x8c')](_0x8838('0x7e'),_0x32f906[_0x8838('0x7f')]());return db[_0x8838('0x80')][_0x8838('0x2d')](_0x32f906[_0x8838('0x7f')](),{'type':db[_0x8838('0x80')][_0x8838('0x81')][_0x8838('0x82')]});}})[_0x8838('0x21')](function(_0x407b32){if(!_0x407b32[_0x8838('0x32')]){throw new db[(_0x8838('0x67'))][(_0x8838('0x68'))](_0x8838('0x8d'),0xcc);}if(_0x2ff3a2[_0x8838('0x8e')]===_0x8838('0x8f')){return null;}var _0x53ba4d=_[_0x8838('0x44')](_0x2ff3a2,{'name':_0x2ff3a2[_0x8838('0x90')]||_0x2ff3a2[_0x8838('0x25')]||_0x38ae40[_0x8838('0x25')],'basename':_0x3d516a,'savename':util[_0x8838('0x72')](_0x8838('0x91'),_0x2ff3a2[_0x8838('0x25')]||_0x38ae40[_0x8838('0x25')],require(_0x8838('0x92'))[_0x8838('0x93')](0x4),_0x2ff3a2[_0x8838('0x8e')]||_0x8838('0x94')),'reportId':_0x38ae40['id'],'reportType':_0x8838('0x95')});return db[_0x8838('0x96')][_0x8838('0x47')](_0x53ba4d,{'raw':!![]});})['then'](function(_0x4bfc90){if(_0x38ae40['table']==='cdr'){_0x117974[_0x8838('0x37')](_0x38ae40['table']+_0x8838('0x97'),_0x2ff3a2[_0x8838('0x98')],_0x2ff3a2[_0x8838('0x99')]);}else{_0x117974[_0x8838('0x37')](_0x38ae40[_0x8838('0x6d')]+_0x8838('0x9a'),_0x2ff3a2[_0x8838('0x98')],_0x2ff3a2[_0x8838('0x99')]);}if(_0x4bfc90){logger[_0x8838('0x9b')](_0x8838('0x9c'),_0x117974[_0x8838('0x7f')]());require(_0x8838('0x9d'))[_0x8838('0x9e')](path['join'](__dirname,'../../components/export/',_0x4bfc90[_0x8838('0x8e')]),[_0x4bfc90['id'],_0x117974[_0x8838('0x7f')](),path['join'](__dirname,_0x8838('0x9f'),_0x4bfc90[_0x8838('0xa0')]),_0x3d516a]);return _0x4bfc90;}else{var _0x5450be=squel[_0x8838('0x8a')]();_0x5450be[_0x8838('0x6c')]('('+_0x117974['toString']()+')',_0x8838('0xa1'));_0x5450be[_0x8838('0x63')](_0x8838('0xa2'),_0x8838('0x3a'));_0x117974[_0x8838('0x1c')](_0x2ff3a2[_0x8838('0x1c')]||_0x1ee988);_0x117974[_0x8838('0x1b')](_0x2ff3a2[_0x8838('0x1b')]||0x0);return dbH[_0x8838('0x80')]['query'](_0x5450be[_0x8838('0x7f')](),{'type':dbH[_0x8838('0x80')][_0x8838('0x81')][_0x8838('0x82')]})['then'](function(_0x102562){if(!_0x102562['length']){_0xdc66dc=0x0;}else{_0xdc66dc=_0x102562[0x0][_0x8838('0x3a')]||0x0;}return dbH[_0x8838('0x80')][_0x8838('0x2d')](_0x117974[_0x8838('0x7f')](),{'type':dbH[_0x8838('0x80')]['QueryTypes'][_0x8838('0x82')]});})[_0x8838('0x21')](function(_0x2a7463){return{'rows':_0x2a7463||[],'count':_0xdc66dc};});}});}exports['run']=function(_0x2fc46f,_0x4ad962){return runReport(_0x2fc46f['params'],_0x2fc46f['query'],_0x2fc46f['options'])[_0x8838('0x21')](respondWithResult(_0x4ad962,null))['catch'](handleError(_0x4ad962,null));};exports[_0x8838('0xa3')]=runReport;exports[_0x8838('0x2d')]=function(_0x455d9e,_0x23b6c7){var _0x3f5fc7=0xa;var _0x226afa=[_0x8838('0x51'),'left_join','right_join',_0x8838('0x83')];var _0x172756={'SUM':_0x8838('0x54'),'COUNT':_0x8838('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x8838('0x56'),'MIN':_0x8838('0x57'),'AVG':_0x8838('0x85'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x8838('0x86'),'GROUP_CONCAT DESC':_0x8838('0xa4')};var _0x29743d={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x8838('0x5b'),'ROUND':_0x8838('0x5c'),'UNIX_TIMESTAMP':_0x8838('0x87')};var _0x54eaab=function(_0x4cdc9e){return!_[_0x8838('0x5d')]([_0x8838('0x88'),'IS\x20NOT\x20NULL',_0x8838('0x5f'),_0x8838('0x89')],_0x4cdc9e);};var _0x4325f6=function(_0x43d632){if(!_0x43d632||!_0x43d632[_0x8838('0x60')][_0x8838('0x32')]){return'';}for(var _0x316008='(',_0x519d51=0x0;_0x519d51<_0x43d632[_0x8838('0x60')][_0x8838('0x32')];_0x519d51+=0x1){_0x519d51>0x0&&(_0x316008+='\x20'+_0x43d632[_0x8838('0x61')]+'\x20');_0x316008+=_0x43d632['rules'][_0x519d51]['group']?_0x4325f6(_0x43d632[_0x8838('0x60')][_0x519d51][_0x8838('0x62')]):_0x43d632[_0x8838('0x60')][_0x519d51]['field']+'\x20'+_0x43d632[_0x8838('0x60')][_0x519d51][_0x8838('0x64')]+(_0x54eaab(_0x43d632[_0x8838('0x60')][_0x519d51][_0x8838('0x64')])?'\x20'+_0x43d632[_0x8838('0x60')][_0x519d51][_0x8838('0x65')]:'');}return _0x316008+')';};var _0x4f5136={'where':{'id':_0x455d9e[_0x8838('0x41')]['id']}},_0x592f1f,_0x745c41,_0x3ebb4d,_0x764701,_0x5227ae;_0x4f5136=_[_0x8838('0x44')]({},_0x4f5136,_0x455d9e[_0x8838('0x45')]);return db[_0x8838('0x3c')][_0x8838('0x46')](_0x4f5136)[_0x8838('0x21')](function(_0x9d7684){if(_0x9d7684){_0x592f1f=_0x9d7684;return _0x9d7684['getFields']();}return null;})[_0x8838('0x21')](function(_0x5827ca){if(_0x5827ca){if(!_0x5827ca['length']){throw new db[(_0x8838('0x67'))][(_0x8838('0x68'))](_0x8838('0x69'),0x193);}_0x745c41=_0x5827ca;return db[_0x8838('0x6a')][_0x8838('0x3d')]({'raw':!![]});}return null;})[_0x8838('0x21')](function(_0x1b5b71){if(_0x1b5b71){_0x3ebb4d=_[_0x8838('0x6b')](_0x1b5b71,'id');var _0x1ae990;var _0x5cf10b=squel[_0x8838('0x8a')]();_0x5cf10b[_0x8838('0x6c')](_0x592f1f[_0x8838('0x6d')]);for(var _0x2bf42d=0x0;_0x2bf42d<_0x745c41[_0x8838('0x32')];_0x2bf42d+=0x1){_0x1ae990=_0x745c41[_0x2bf42d][_0x8838('0x6e')]?_0x3ebb4d[_0x745c41[_0x2bf42d][_0x8838('0x6e')]][_0x8838('0x6f')]:_0x745c41[_0x2bf42d][_0x8838('0x63')];_0x1ae990=_0x745c41[_0x2bf42d][_0x8838('0x71')]?_[_0x8838('0x70')](_0x172756[_0x745c41[_0x2bf42d][_0x8838('0x71')]],'%s',_0x1ae990):_0x1ae990;_0x1ae990=_0x745c41[_0x2bf42d][_0x8838('0x72')]?_['replace'](_0x29743d[_0x745c41[_0x2bf42d][_0x8838('0x72')]],'%s',_0x1ae990):_0x1ae990;if(_0x745c41[_0x2bf42d][_0x8838('0x73')]){_0x5cf10b[_0x8838('0x62')](_0x1ae990);}_0x745c41[_0x2bf42d][_0x8838('0x74')]&&_0x5cf10b[_0x8838('0x35')](_0x1ae990,_0x745c41[_0x2bf42d][_0x8838('0x74')]===_0x8838('0x75')?![]:!![]);_0x5cf10b[_0x8838('0x63')](_0x1ae990,_0x745c41[_0x2bf42d][_0x8838('0x8b')]||_0x1ae990);}if(_0x592f1f['joins']){_0x592f1f[_0x8838('0x77')]=JSON[_0x8838('0x76')](_0x592f1f[_0x8838('0x77')]);for(var _0x50ffb7=0x0;_0x50ffb7<_0x592f1f[_0x8838('0x77')]['length'];_0x50ffb7+=0x1){if(_0x592f1f[_0x8838('0x77')][_0x50ffb7]['type']&&_[_0x8838('0x5d')](_0x226afa,_0x592f1f[_0x8838('0x77')][_0x50ffb7][_0x8838('0x2a')])&&_0x592f1f[_0x8838('0x77')][_0x50ffb7][_0x8838('0x78')]&&_0x592f1f[_0x8838('0x77')][_0x50ffb7]['foreignTable']&&_0x592f1f[_0x8838('0x77')][_0x50ffb7]['foreignKey']){_0x5cf10b[_0x592f1f[_0x8838('0x77')][_0x50ffb7][_0x8838('0x2a')]](_0x592f1f['joins'][_0x50ffb7][_0x8838('0x7a')],null,util[_0x8838('0x72')](_0x8838('0x7b'),_0x592f1f[_0x8838('0x6d')],_0x592f1f[_0x8838('0x77')][_0x50ffb7][_0x8838('0x78')],_0x592f1f[_0x8838('0x77')][_0x50ffb7][_0x8838('0x7a')],_0x592f1f[_0x8838('0x77')][_0x50ffb7][_0x8838('0x79')]));}}}if(_0x592f1f['conditions']){_0x592f1f[_0x8838('0x7c')]=JSON[_0x8838('0x76')](_0x592f1f[_0x8838('0x7c')]);_0x5cf10b[_0x8838('0x37')](_0x4325f6(_0x592f1f[_0x8838('0x7c')]['group']));}_0x5227ae=_0x5cf10b[_0x8838('0x7d')]();_0x5cf10b[_0x8838('0x1c')](_0x3f5fc7);_0x5cf10b[_0x8838('0x1b')](0x0);logger[_0x8838('0x8c')](_0x8838('0x7e'),_0x5cf10b[_0x8838('0x7f')]());return db['sequelize'][_0x8838('0x2d')](_0x5cf10b[_0x8838('0x7f')](),{'type':db[_0x8838('0x80')]['QueryTypes']['SELECT']});}})[_0x8838('0x21')](function(){return{'sql':_0x5227ae[_0x8838('0x7f')]()};})['then'](respondWithResult(_0x23b6c7,null))[_0x8838('0x3f')](handleError(_0x23b6c7,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 2df5e1d..e28ec98 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 _0xc43b=['bluebird','request-promise','path','rimraf','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','moment'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xc43b,0x134));var _0xbc43=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc43b[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xbc43('0x0'));var util=require(_0xbc43('0x1'));var logger=require(_0xbc43('0x2'))('api');var moment=require(_0xbc43('0x3'));var BPromise=require(_0xbc43('0x4'));var rp=require(_0xbc43('0x5'));var fs=require('fs');var path=require(_0xbc43('0x6'));var rimraf=require(_0xbc43('0x7'));var config=require('../../config/environment');var attributes=require(_0xbc43('0x8'));module[_0xbc43('0x9')]=function(_0xef4017,_0x145c05){return _0xef4017[_0xbc43('0xa')](_0xbc43('0xb'),attributes,{'tableName':_0xbc43('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4af0=['exports','define','AnalyticCustomReport','../../config/logger','moment','path','../../config/environment','./analyticCustomReport.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4af0,0x15b));var _0x04af=function(_0x5bd30e,_0x1cf617){_0x5bd30e=_0x5bd30e-0x0;var _0x52f137=_0x4af0[_0x5bd30e];return _0x52f137;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x04af('0x0'))('api');var moment=require(_0x04af('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x04af('0x2'));var rimraf=require('rimraf');var config=require(_0x04af('0x3'));var attributes=require(_0x04af('0x4'));module[_0x04af('0x5')]=function(_0x4ec7d1,_0x3f74c5){return _0x4ec7d1[_0x04af('0x6')](_0x04af('0x7'),attributes,{'tableName':'analytics_custom_reports','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 639a545..3b1a1ea 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 _0xd9cb=['../../config/logger','../../config/environment','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x471103,_0xcaed26){var _0x4e39d0=function(_0x1e221f){while(--_0x1e221f){_0x471103['push'](_0x471103['shift']());}};_0x4e39d0(++_0xcaed26);}(_0xd9cb,0x112));var _0xbd9c=function(_0x5842ed,_0x3d858c){_0x5842ed=_0x5842ed-0x0;var _0x5312c7=_0xd9cb[_0x5842ed];return _0x5312c7;};'use strict';var _=require(_0xbd9c('0x0'));var util=require('util');var moment=require(_0xbd9c('0x1'));var BPromise=require(_0xbd9c('0x2'));var rs=require(_0xbd9c('0x3'));var fs=require('fs');var Redis=require(_0xbd9c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd9c('0x5'));var logger=require(_0xbd9c('0x6'))('rpc');var config=require(_0xbd9c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbd9c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x368979,_0x380310,_0x7c50c7){return new BPromise(function(_0x3a507a,_0x48bc8a){return client[_0xbd9c('0x9')](_0x368979,_0x7c50c7)[_0xbd9c('0xa')](function(_0x1c00d4){logger['info'](_0xbd9c('0xb'),_0x380310,_0xbd9c('0xc'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x380310,_0xbd9c('0xc'),JSON[_0xbd9c('0xd')](_0x1c00d4));if(_0x1c00d4[_0xbd9c('0xe')]){if(_0x1c00d4['error'][_0xbd9c('0xf')]===0x1f4){logger[_0xbd9c('0xe')](_0xbd9c('0xb'),_0x380310,_0x1c00d4[_0xbd9c('0xe')][_0xbd9c('0x10')]);return _0x48bc8a(_0x1c00d4[_0xbd9c('0xe')][_0xbd9c('0x10')]);}logger['error'](_0xbd9c('0xb'),_0x380310,_0x1c00d4[_0xbd9c('0xe')][_0xbd9c('0x10')]);return _0x3a507a(_0x1c00d4[_0xbd9c('0xe')][_0xbd9c('0x10')]);}else{logger[_0xbd9c('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x380310,_0xbd9c('0xc'));_0x3a507a(_0x1c00d4[_0xbd9c('0x12')][_0xbd9c('0x10')]);}})[_0xbd9c('0x13')](function(_0x423636){logger[_0xbd9c('0xe')](_0xbd9c('0xb'),_0x380310,_0x423636);_0x48bc8a(_0x423636);});});} \ No newline at end of file +var _0x237b=['AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x237b,0x1a7));var _0xb237=function(_0x39a918,_0x2030d1){_0x39a918=_0x39a918-0x0;var _0x213933=_0x237b[_0x39a918];return _0x213933;};'use strict';var _=require(_0xb237('0x0'));var util=require(_0xb237('0x1'));var moment=require(_0xb237('0x2'));var BPromise=require(_0xb237('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb237('0x4'));var db=require(_0xb237('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb237('0x6'))(_0xb237('0x7'));var config=require(_0xb237('0x8'));var jayson=require(_0xb237('0x9'));var client=jayson['client'][_0xb237('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28d218,_0x547910,_0x1b1184){return new BPromise(function(_0x4a3065,_0x1b4922){return client[_0xb237('0xb')](_0x28d218,_0x1b1184)[_0xb237('0xc')](function(_0x43dfc6){logger[_0xb237('0xd')](_0xb237('0xe'),_0x547910,_0xb237('0xf'));logger['debug'](_0xb237('0x10'),_0x547910,_0xb237('0xf'),JSON[_0xb237('0x11')](_0x43dfc6));if(_0x43dfc6[_0xb237('0x12')]){if(_0x43dfc6[_0xb237('0x12')][_0xb237('0x13')]===0x1f4){logger[_0xb237('0x12')](_0xb237('0xe'),_0x547910,_0x43dfc6[_0xb237('0x12')][_0xb237('0x14')]);return _0x1b4922(_0x43dfc6[_0xb237('0x12')][_0xb237('0x14')]);}logger['error'](_0xb237('0xe'),_0x547910,_0x43dfc6[_0xb237('0x12')][_0xb237('0x14')]);return _0x4a3065(_0x43dfc6[_0xb237('0x12')]['message']);}else{logger[_0xb237('0xd')](_0xb237('0xe'),_0x547910,_0xb237('0xf'));_0x4a3065(_0x43dfc6[_0xb237('0x15')][_0xb237('0x14')]);}})[_0xb237('0x16')](function(_0xba21ad){logger[_0xb237('0x12')](_0xb237('0xe'),_0x547910,_0xba21ad);_0x1b4922(_0xba21ad);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 4deae20..b75fdf3 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 _0x22a8=['/:id','show','/:id/preview','preview','get','/:id/run','run','query','post','update','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x22a8,0x1d4));var _0x822a=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x22a8[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x822a('0x0'));var util=require('util');var path=require(_0x822a('0x1'));var timeout=require(_0x822a('0x2'));var express=require(_0x822a('0x3'));var router=express['Router']();var auth=require(_0x822a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x822a('0x5'));var controller=require('./analyticCustomReport.controller');router['get']('/',auth[_0x822a('0x6')](),controller['index']);router['get'](_0x822a('0x7'),auth[_0x822a('0x6')](),controller[_0x822a('0x8')]);router['get'](_0x822a('0x9'),auth['isAuthenticated'](),controller[_0x822a('0xa')]);router[_0x822a('0xb')](_0x822a('0xc'),auth[_0x822a('0x6')](),controller[_0x822a('0xd')]);router['get']('/:id/query',auth[_0x822a('0x6')](),controller[_0x822a('0xe')]);router[_0x822a('0xf')]('/',auth[_0x822a('0x6')](),controller['create']);router['put'](_0x822a('0x7'),auth[_0x822a('0x6')](),controller[_0x822a('0x10')]);router['delete']('/:id',auth[_0x822a('0x6')](),controller[_0x822a('0x11')]);module[_0x822a('0x12')]=router; \ No newline at end of file +var _0x2eac=['index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','delete','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x1e4f2f,_0x35edfa){var _0xccea89=function(_0x164386){while(--_0x164386){_0x1e4f2f['push'](_0x1e4f2f['shift']());}};_0xccea89(++_0x35edfa);}(_0x2eac,0xa9));var _0xc2ea=function(_0x40439b,_0x5c8222){_0x40439b=_0x40439b-0x0;var _0x1ffbd0=_0x2eac[_0x40439b];return _0x1ffbd0;};'use strict';var multer=require(_0xc2ea('0x0'));var util=require('util');var path=require(_0xc2ea('0x1'));var timeout=require('connect-timeout');var express=require(_0xc2ea('0x2'));var router=express['Router']();var auth=require(_0xc2ea('0x3'));var interaction=require(_0xc2ea('0x4'));var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router[_0xc2ea('0x5')]('/',auth[_0xc2ea('0x6')](),controller[_0xc2ea('0x7')]);router[_0xc2ea('0x5')](_0xc2ea('0x8'),auth[_0xc2ea('0x6')](),controller[_0xc2ea('0x9')]);router[_0xc2ea('0x5')](_0xc2ea('0xa'),auth[_0xc2ea('0x6')](),controller[_0xc2ea('0xb')]);router[_0xc2ea('0x5')](_0xc2ea('0xc'),auth[_0xc2ea('0x6')](),controller[_0xc2ea('0xd')]);router[_0xc2ea('0x5')](_0xc2ea('0xe'),auth[_0xc2ea('0x6')](),controller[_0xc2ea('0xf')]);router[_0xc2ea('0x10')]('/',auth['isAuthenticated'](),controller[_0xc2ea('0x11')]);router[_0xc2ea('0x12')](_0xc2ea('0x8'),auth[_0xc2ea('0x6')](),controller['update']);router[_0xc2ea('0x13')](_0xc2ea('0x8'),auth['isAuthenticated'](),controller[_0xc2ea('0x14')]);module[_0xc2ea('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 1bb03c2..d37fa7e 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 _0xb401=['STRING','TEXT','sequelize','exports'];(function(_0x5cb139,_0x1a5f77){var _0x816e2b=function(_0x1ad50f){while(--_0x1ad50f){_0x5cb139['push'](_0x5cb139['shift']());}};_0x816e2b(++_0x1a5f77);}(_0xb401,0x136));var _0x1b40=function(_0x3e9d63,_0x375e22){_0x3e9d63=_0x3e9d63-0x0;var _0x4e357e=_0xb401[_0x3e9d63];return _0x4e357e;};'use strict';var Sequelize=require(_0x1b40('0x0'));module[_0x1b40('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x1b40('0x2')]},'parent':{'type':Sequelize[_0x1b40('0x2')]},'table':{'type':Sequelize[_0x1b40('0x2')]},'conditions':{'type':Sequelize[_0x1b40('0x3')]},'joins':{'type':Sequelize[_0x1b40('0x3')]}}; \ No newline at end of file +var _0x084d=['STRING','TEXT','sequelize'];(function(_0xb3862c,_0xa769f3){var _0x491d63=function(_0x275848){while(--_0x275848){_0xb3862c['push'](_0xb3862c['shift']());}};_0x491d63(++_0xa769f3);}(_0x084d,0x1d0));var _0xd084=function(_0x8d543b,_0x278a4f){_0x8d543b=_0x8d543b-0x0;var _0xc6b1a3=_0x084d[_0x8d543b];return _0xc6b1a3;};'use strict';var Sequelize=require(_0xd084('0x0'));module['exports']={'name':{'type':Sequelize[_0xd084('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd084('0x1')]},'parent':{'type':Sequelize[_0xd084('0x1')]},'table':{'type':Sequelize[_0xd084('0x1')]},'conditions':{'type':Sequelize[_0xd084('0x2')]},'joins':{'type':Sequelize[_0xd084('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 66cccf9..ff309dc 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 _0xb0f5=['SELECT','run','runReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','DefaultReports','UserProfileResource','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','COUNT(%s)','MAX(%s)','AVG(%s)','ROUND(%s)','IS\x20EMPTY','ValidationErrorItem','foreignKey','No\x20available\x20data','output','web','fullPath','%s-%s.%s','generate','csv','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','COUNT(*)'];(function(_0x4cba56,_0x5b2c44){var _0x3cc9f3=function(_0x5bb80a){while(--_0x5bb80a){_0x4cba56['push'](_0x4cba56['shift']());}};_0x3cc9f3(++_0x5b2c44);}(_0xb0f5,0xac));var _0x5b0f=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xb0f5[_0x4792c8];return _0x35edb1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5b0f('0x0'));var rimraf=require(_0x5b0f('0x1'));var zipdir=require(_0x5b0f('0x2'));var jsonpatch=require(_0x5b0f('0x3'));var rp=require(_0x5b0f('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5b0f('0x5'));var util=require(_0x5b0f('0x6'));var path=require(_0x5b0f('0x7'));var sox=require('sox');var csv=require(_0x5b0f('0x8'));var ejs=require(_0x5b0f('0x9'));var fs=require('fs');var _=require(_0x5b0f('0xa'));var squel=require('squel');var crypto=require(_0x5b0f('0xb'));var jsforce=require(_0x5b0f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5b0f('0xd'));var Papa=require(_0x5b0f('0xe'));var Redis=require(_0x5b0f('0xf'));var authService=require(_0x5b0f('0x10'));var qs=require(_0x5b0f('0x11'));var as=require(_0x5b0f('0x12'));var hardwareService=require(_0x5b0f('0x13'));var logger=require(_0x5b0f('0x14'))(_0x5b0f('0x15'));var utils=require(_0x5b0f('0x16'));var config=require(_0x5b0f('0x17'));var db=require(_0x5b0f('0x18'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0x1ed105,_0x55d0ac){_0x55d0ac=_0x55d0ac||0xcc;return function(_0x27dabf){if(_0x27dabf){return _0x1ed105[_0x5b0f('0x19')](_0x55d0ac);}return _0x1ed105[_0x5b0f('0x1a')](_0x55d0ac)[_0x5b0f('0x1b')]();};}function respondWithResult(_0x31d725,_0x17f282){_0x17f282=_0x17f282||0xc8;return function(_0xbe5232){if(_0xbe5232){return _0x31d725[_0x5b0f('0x1a')](_0x17f282)[_0x5b0f('0x1c')](_0xbe5232);}};}function respondWithFilteredResult(_0x3a8cff,_0x45bae0){return function(_0x5b3bfc){if(_0x5b3bfc){var _0x1784a1=_0x5b3bfc['count'],_0x279a33=_0x45bae0[_0x5b0f('0x1d')],_0x8e5ee5=_0x45bae0[_0x5b0f('0x1d')]+_0x45bae0[_0x5b0f('0x1e')],_0x165d2c;if(_0x8e5ee5>=_0x1784a1){_0x8e5ee5=_0x1784a1;_0x165d2c=0xc8;}else{_0x165d2c=0xce;}_0x3a8cff[_0x5b0f('0x1a')](_0x165d2c);return _0x3a8cff[_0x5b0f('0x1f')](_0x5b0f('0x20'),_0x279a33+'-'+_0x8e5ee5+'/'+_0x1784a1)[_0x5b0f('0x1c')](_0x5b3bfc);}return null;};}function patchUpdates(_0x683b19){return function(_0x7eda84){try{jsonpatch[_0x5b0f('0x21')](_0x7eda84,_0x683b19,!![]);}catch(_0x582b0e){return BPromise[_0x5b0f('0x22')](_0x582b0e);}return _0x7eda84[_0x5b0f('0x23')]();};}function saveUpdates(_0x2b1817,_0x5cce54){return function(_0x580e82){if(_0x580e82){return _0x580e82[_0x5b0f('0x24')](_0x2b1817)['then'](function(_0x199bd7){return _0x199bd7;});}return null;};}function removeEntity(_0x2c252b,_0x2c1b1f){return function(_0xa0d281){if(_0xa0d281){return _0xa0d281[_0x5b0f('0x25')]()[_0x5b0f('0x26')](function(){var _0x3d029c=_0xa0d281[_0x5b0f('0x27')]({'plain':!![]});var _0x1208ba=_0x5b0f('0x28');return db[_0x5b0f('0x29')][_0x5b0f('0x25')]({'where':{'type':_0x1208ba,'resourceId':_0x3d029c['id']}})['then'](function(){return _0xa0d281;});})[_0x5b0f('0x26')](function(){_0x2c252b[_0x5b0f('0x1a')](0xcc)[_0x5b0f('0x1b')]();});}};}function handleEntityNotFound(_0x1ec9ed,_0x1d67ba){return function(_0x591661){if(!_0x591661){_0x1ec9ed[_0x5b0f('0x19')](0x194);}return _0x591661;};}function handleError(_0x4ab3ae,_0x123dcb){_0x123dcb=_0x123dcb||0x1f4;return function(_0x36f690){logger[_0x5b0f('0x2a')](_0x36f690['stack']);if(_0x36f690[_0x5b0f('0x2b')]){delete _0x36f690[_0x5b0f('0x2b')];}_0x4ab3ae[_0x5b0f('0x1a')](_0x123dcb)[_0x5b0f('0x2c')](_0x36f690);};}exports[_0x5b0f('0x2d')]=function(_0x24d86f,_0x435b9d){var _0x376e77={},_0x295c1d={},_0x10905d={'count':0x0,'rows':[]};var _0xa819e0=_[_0x5b0f('0x2e')](db[_0x5b0f('0x2f')][_0x5b0f('0x30')],function(_0x1f08b7){return{'name':_0x1f08b7[_0x5b0f('0x31')],'type':_0x1f08b7[_0x5b0f('0x32')][_0x5b0f('0x33')]};});_0x295c1d[_0x5b0f('0x34')]=_[_0x5b0f('0x2e')](_0xa819e0,_0x5b0f('0x2b'));_0x295c1d[_0x5b0f('0x35')]=_[_0x5b0f('0x36')](_0x24d86f[_0x5b0f('0x35')]);_0x295c1d[_0x5b0f('0x37')]=_[_0x5b0f('0x38')](_0x295c1d[_0x5b0f('0x34')],_0x295c1d[_0x5b0f('0x35')]);_0x376e77['attributes']=_[_0x5b0f('0x38')](_0x295c1d['model'],qs['fields'](_0x24d86f[_0x5b0f('0x35')][_0x5b0f('0x39')]));_0x376e77[_0x5b0f('0x3a')]=_0x376e77[_0x5b0f('0x3a')][_0x5b0f('0x3b')]?_0x376e77[_0x5b0f('0x3a')]:_0x295c1d['model'];if(!_0x24d86f['query'][_0x5b0f('0x3c')](_0x5b0f('0x3d'))){_0x376e77[_0x5b0f('0x1e')]=qs[_0x5b0f('0x1e')](_0x24d86f['query'][_0x5b0f('0x1e')]);_0x376e77[_0x5b0f('0x1d')]=qs[_0x5b0f('0x1d')](_0x24d86f[_0x5b0f('0x35')][_0x5b0f('0x1d')]);}_0x376e77[_0x5b0f('0x3e')]=qs[_0x5b0f('0x3f')](_0x24d86f[_0x5b0f('0x35')][_0x5b0f('0x3f')]);_0x376e77[_0x5b0f('0x40')]=qs[_0x5b0f('0x37')](_[_0x5b0f('0x41')](_0x24d86f[_0x5b0f('0x35')],_0x295c1d[_0x5b0f('0x37')]),_0xa819e0);if(_0x24d86f['query'][_0x5b0f('0x42')]){_0x376e77['where']=_[_0x5b0f('0x43')](_0x376e77[_0x5b0f('0x40')],{'$or':_[_0x5b0f('0x2e')](_0xa819e0,function(_0x34f2b7){if(_0x34f2b7['type']!==_0x5b0f('0x44')){var _0x515772={};_0x515772[_0x34f2b7[_0x5b0f('0x2b')]]={'$like':'%'+_0x24d86f[_0x5b0f('0x35')][_0x5b0f('0x42')]+'%'};return _0x515772;}})});}_0x376e77=_['merge']({},_0x376e77,_0x24d86f[_0x5b0f('0x45')]);var _0x1e42ee={'where':_0x376e77['where']};return db[_0x5b0f('0x2f')][_0x5b0f('0x46')](_0x1e42ee)[_0x5b0f('0x26')](function(_0xdde2d6){_0x10905d['count']=_0xdde2d6;if(_0x24d86f[_0x5b0f('0x35')][_0x5b0f('0x47')]){_0x376e77[_0x5b0f('0x48')]=[{'all':!![]}];}return db[_0x5b0f('0x2f')][_0x5b0f('0x49')](_0x376e77);})['then'](function(_0x3fd346){_0x10905d[_0x5b0f('0x4a')]=_0x3fd346;return _0x10905d;})[_0x5b0f('0x26')](respondWithFilteredResult(_0x435b9d,_0x376e77))[_0x5b0f('0x4b')](handleError(_0x435b9d,null));};exports[_0x5b0f('0x4c')]=function(_0x23ea73,_0x44059d){var _0x430909={'raw':!![],'where':{'id':_0x23ea73[_0x5b0f('0x4d')]['id']}},_0x18d8b3={};_0x18d8b3['model']=_['keys'](db['AnalyticDefaultReport'][_0x5b0f('0x30')]);_0x18d8b3['query']=_[_0x5b0f('0x36')](_0x23ea73[_0x5b0f('0x35')]);_0x18d8b3['filters']=_['intersection'](_0x18d8b3[_0x5b0f('0x34')],_0x18d8b3['query']);_0x430909[_0x5b0f('0x3a')]=_[_0x5b0f('0x38')](_0x18d8b3[_0x5b0f('0x34')],qs[_0x5b0f('0x39')](_0x23ea73[_0x5b0f('0x35')][_0x5b0f('0x39')]));_0x430909['attributes']=_0x430909[_0x5b0f('0x3a')][_0x5b0f('0x3b')]?_0x430909[_0x5b0f('0x3a')]:_0x18d8b3[_0x5b0f('0x34')];if(_0x23ea73[_0x5b0f('0x35')]['includeAll']){_0x430909['include']=[{'all':!![]}];}_0x430909=_[_0x5b0f('0x43')]({},_0x430909,_0x23ea73[_0x5b0f('0x45')]);return db[_0x5b0f('0x2f')][_0x5b0f('0x4e')](_0x430909)['then'](handleEntityNotFound(_0x44059d,null))[_0x5b0f('0x26')](respondWithResult(_0x44059d,null))[_0x5b0f('0x4b')](handleError(_0x44059d,null));};exports[_0x5b0f('0x4f')]=function(_0x2825f2,_0x3cd066){return db[_0x5b0f('0x2f')][_0x5b0f('0x4f')](_0x2825f2[_0x5b0f('0x50')],{})[_0x5b0f('0x26')](function(_0x3bd8a3){var _0x7b3033=_0x2825f2[_0x5b0f('0x51')]['get']({'plain':!![]});if(!_0x7b3033)throw new Error(_0x5b0f('0x52'));if(_0x7b3033[_0x5b0f('0x53')]===_0x5b0f('0x51')){var _0x211f42=_0x3bd8a3[_0x5b0f('0x27')]({'plain':!![]});var _0xb4fa44=_0x5b0f('0x54');return db[_0x5b0f('0x55')][_0x5b0f('0x4e')]({'where':{'name':_0xb4fa44,'userProfileId':_0x7b3033[_0x5b0f('0x56')]},'raw':!![]})['then'](function(_0x119cfb){if(_0x119cfb&&_0x119cfb['autoAssociation']===0x0){return db[_0x5b0f('0x29')][_0x5b0f('0x4f')]({'name':_0x211f42[_0x5b0f('0x2b')],'resourceId':_0x211f42['id'],'type':_0x5b0f('0x28'),'sectionId':_0x119cfb['id']},{})['then'](function(){return _0x3bd8a3;});}else{return _0x3bd8a3;}})[_0x5b0f('0x4b')](function(_0x36ed81){logger[_0x5b0f('0x2a')](_0x5b0f('0x57'),_0x36ed81);throw _0x36ed81;});}return _0x3bd8a3;})[_0x5b0f('0x26')](respondWithResult(_0x3cd066,0xc9))[_0x5b0f('0x4b')](handleError(_0x3cd066,null));};exports['update']=function(_0x299bf9,_0xcdc89f){if(_0x299bf9[_0x5b0f('0x50')]['id']){delete _0x299bf9['body']['id'];}return db[_0x5b0f('0x2f')][_0x5b0f('0x4e')]({'where':{'id':_0x299bf9[_0x5b0f('0x4d')]['id']}})[_0x5b0f('0x26')](handleEntityNotFound(_0xcdc89f,null))[_0x5b0f('0x26')](saveUpdates(_0x299bf9[_0x5b0f('0x50')],null))[_0x5b0f('0x26')](respondWithResult(_0xcdc89f,null))[_0x5b0f('0x4b')](handleError(_0xcdc89f,null));};exports[_0x5b0f('0x25')]=function(_0x445b71,_0x250b61){return db[_0x5b0f('0x2f')][_0x5b0f('0x4e')]({'where':{'id':_0x445b71[_0x5b0f('0x4d')]['id']}})[_0x5b0f('0x26')](handleEntityNotFound(_0x250b61,null))[_0x5b0f('0x26')](removeEntity(_0x250b61,null))['catch'](handleError(_0x250b61,null));};exports[_0x5b0f('0x58')]=function(_0x103d2f,_0x4f8cd7){var _0x24420f=0xa;var _0x41c375=[_0x5b0f('0x59'),_0x5b0f('0x5a'),'right_join',_0x5b0f('0x5b')];var _0x5c898e={'SUM':_0x5b0f('0x5c'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x5b0f('0x5d'),'MAX':'MAX(%s)','MIN':_0x5b0f('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x5b0f('0x5f'),'GROUP_CONCAT ASC':_0x5b0f('0x60'),'GROUP_CONCAT DESC':_0x5b0f('0x61')};var _0x10e627={'SEC_TO_TIME':_0x5b0f('0x62'),'DATE':_0x5b0f('0x63'),'HOUR':_0x5b0f('0x64'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5b0f('0x65')};var _0x580b3f=function(_0x322695){return!_[_0x5b0f('0x66')]([_0x5b0f('0x67'),_0x5b0f('0x68'),'IS\x20EMPTY',_0x5b0f('0x69')],_0x322695);};var _0x41e01b=function(_0x492972){if(!_0x492972||!_0x492972[_0x5b0f('0x6a')]['length']){return'';}for(var _0x2aae36='(',_0x35e478=0x0;_0x35e478<_0x492972['rules'][_0x5b0f('0x3b')];_0x35e478+=0x1){_0x35e478>0x0&&(_0x2aae36+='\x20'+_0x492972[_0x5b0f('0x6b')]+'\x20');_0x2aae36+=_0x492972[_0x5b0f('0x6a')][_0x35e478]['group']?_0x41e01b(_0x492972[_0x5b0f('0x6a')][_0x35e478][_0x5b0f('0x6c')]):_0x492972['rules'][_0x35e478][_0x5b0f('0x6d')]+'\x20'+_0x492972[_0x5b0f('0x6a')][_0x35e478][_0x5b0f('0x6e')]+(_0x580b3f(_0x492972[_0x5b0f('0x6a')][_0x35e478][_0x5b0f('0x6e')])?'\x20'+_0x492972[_0x5b0f('0x6a')][_0x35e478]['value']:'');}return _0x2aae36+')';};var _0x1edbc7={'where':{'id':_0x103d2f[_0x5b0f('0x4d')]['id']}},_0x52d34d,_0x2cb94c,_0x396ecd,_0x10ad9c,_0x2aac8e;_0x1edbc7=_['merge']({},_0x1edbc7,_0x103d2f[_0x5b0f('0x45')]);return db[_0x5b0f('0x2f')][_0x5b0f('0x4e')](_0x1edbc7)[_0x5b0f('0x26')](function(_0x54766f){if(_0x54766f){_0x52d34d=_0x54766f;return _0x54766f[_0x5b0f('0x6f')]();}return null;})[_0x5b0f('0x26')](function(_0xda28bd){if(_0xda28bd){if(!_0xda28bd[_0x5b0f('0x3b')]){throw new db[(_0x5b0f('0x70'))]['ValidationErrorItem'](_0x5b0f('0x71'),0x193);}_0x2cb94c=_0xda28bd;return db[_0x5b0f('0x72')][_0x5b0f('0x49')]({'raw':!![]});}return null;})['then'](function(_0x487780){if(_0x487780){_0x396ecd=_[_0x5b0f('0x73')](_0x487780,'id');var _0x124b7c;var _0x40cd05=squel[_0x5b0f('0x74')]();_0x40cd05[_0x5b0f('0x75')](_0x52d34d[_0x5b0f('0x76')]);for(var _0x2a2fe9=0x0;_0x2a2fe9<_0x2cb94c[_0x5b0f('0x3b')];_0x2a2fe9+=0x1){_0x124b7c=_0x2cb94c[_0x2a2fe9][_0x5b0f('0x77')]?_0x396ecd[_0x2cb94c[_0x2a2fe9][_0x5b0f('0x77')]][_0x5b0f('0x78')]:_0x2cb94c[_0x2a2fe9][_0x5b0f('0x6d')];_0x124b7c=_0x2cb94c[_0x2a2fe9][_0x5b0f('0x79')]?_[_0x5b0f('0x7a')](_0x5c898e[_0x2cb94c[_0x2a2fe9]['function']],'%s',_0x124b7c):_0x124b7c;_0x124b7c=_0x2cb94c[_0x2a2fe9][_0x5b0f('0x7b')]?_['replace'](_0x10e627[_0x2cb94c[_0x2a2fe9][_0x5b0f('0x7b')]],'%s',_0x124b7c):_0x124b7c;if(_0x2cb94c[_0x2a2fe9][_0x5b0f('0x7c')]){_0x40cd05[_0x5b0f('0x6c')](_0x124b7c);}_0x2cb94c[_0x2a2fe9][_0x5b0f('0x7d')]&&_0x40cd05[_0x5b0f('0x3e')](_0x124b7c,_0x2cb94c[_0x2a2fe9][_0x5b0f('0x7d')]===_0x5b0f('0x7e')?![]:!![]);_0x40cd05['field'](_0x124b7c,_0x2cb94c[_0x2a2fe9][_0x5b0f('0x7f')]||_0x124b7c);}if(_0x52d34d[_0x5b0f('0x80')]){_0x52d34d[_0x5b0f('0x80')]=JSON[_0x5b0f('0x81')](_0x52d34d[_0x5b0f('0x80')]);for(var _0x21ced5=0x0;_0x21ced5<_0x52d34d['joins'][_0x5b0f('0x3b')];_0x21ced5+=0x1){if(_0x52d34d[_0x5b0f('0x80')][_0x21ced5][_0x5b0f('0x32')]&&_['includes'](_0x41c375,_0x52d34d[_0x5b0f('0x80')][_0x21ced5][_0x5b0f('0x32')])&&_0x52d34d[_0x5b0f('0x80')][_0x21ced5][_0x5b0f('0x82')]&&_0x52d34d[_0x5b0f('0x80')][_0x21ced5][_0x5b0f('0x83')]&&_0x52d34d['joins'][_0x21ced5]['foreignKey']){_0x40cd05[_0x52d34d[_0x5b0f('0x80')][_0x21ced5][_0x5b0f('0x32')]](_0x52d34d[_0x5b0f('0x80')][_0x21ced5]['foreignTable'],null,util[_0x5b0f('0x7b')](_0x5b0f('0x84'),_0x52d34d[_0x5b0f('0x76')],_0x52d34d[_0x5b0f('0x80')][_0x21ced5][_0x5b0f('0x82')],_0x52d34d[_0x5b0f('0x80')][_0x21ced5][_0x5b0f('0x83')],_0x52d34d[_0x5b0f('0x80')][_0x21ced5]['foreignKey']));}}}if(_0x52d34d[_0x5b0f('0x85')]){_0x52d34d[_0x5b0f('0x85')]=JSON[_0x5b0f('0x81')](_0x52d34d[_0x5b0f('0x85')]);_0x40cd05['where'](_0x41e01b(_0x52d34d[_0x5b0f('0x85')][_0x5b0f('0x6c')]));}_0x2aac8e=_0x40cd05[_0x5b0f('0x86')]();_0x40cd05['limit'](_0x24420f);_0x40cd05[_0x5b0f('0x1d')](0x0);logger[_0x5b0f('0x87')](_0x5b0f('0x88'),_0x40cd05['toString']());return db[_0x5b0f('0x89')][_0x5b0f('0x35')](_0x40cd05[_0x5b0f('0x8a')](),{'type':db[_0x5b0f('0x89')][_0x5b0f('0x8b')]['SELECT']});}})[_0x5b0f('0x26')](respondWithResult(_0x4f8cd7,null))['catch'](handleError(_0x4f8cd7,null));};function runReport(_0xd61d47,_0x2fd379,_0x155822){var _0x4d9cd1=_0x2fd379['name'];var _0x3f09e1=0xa;var _0x4f4acf=[_0x5b0f('0x59'),_0x5b0f('0x5a'),_0x5b0f('0x8c'),_0x5b0f('0x5b')];var _0x2331c5={'SUM':_0x5b0f('0x5c'),'COUNT':_0x5b0f('0x8d'),'COUNT DISTINCT':_0x5b0f('0x5d'),'MAX':_0x5b0f('0x8e'),'MIN':_0x5b0f('0x5e'),'AVG':_0x5b0f('0x8f'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x5b0f('0x60'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x14bdf2={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5b0f('0x63'),'HOUR':_0x5b0f('0x64'),'ROUND':_0x5b0f('0x90'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x316d06=function(_0x1a54cd){return!_[_0x5b0f('0x66')]([_0x5b0f('0x67'),'IS\x20NOT\x20NULL',_0x5b0f('0x91'),_0x5b0f('0x69')],_0x1a54cd);};var _0x3b5633=function(_0xa43f90){if(!_0xa43f90||!_0xa43f90[_0x5b0f('0x6a')][_0x5b0f('0x3b')]){return'';}for(var _0x355cbb='(',_0xb6425f=0x0;_0xb6425f<_0xa43f90[_0x5b0f('0x6a')]['length'];_0xb6425f+=0x1){_0xb6425f>0x0&&(_0x355cbb+='\x20'+_0xa43f90[_0x5b0f('0x6b')]+'\x20');_0x355cbb+=_0xa43f90[_0x5b0f('0x6a')][_0xb6425f][_0x5b0f('0x6c')]?_0x3b5633(_0xa43f90[_0x5b0f('0x6a')][_0xb6425f][_0x5b0f('0x6c')]):_0xa43f90[_0x5b0f('0x6a')][_0xb6425f][_0x5b0f('0x6d')]+'\x20'+_0xa43f90['rules'][_0xb6425f][_0x5b0f('0x6e')]+(_0x316d06(_0xa43f90['rules'][_0xb6425f][_0x5b0f('0x6e')])?'\x20'+_0xa43f90[_0x5b0f('0x6a')][_0xb6425f]['value']:'');}return _0x355cbb+')';};var _0x5a5b8a={'where':{'id':_0xd61d47['id']}},_0x3cc966,_0x51f94d,_0x2992a9,_0x121e89,_0x36cab6;_0x5a5b8a=_[_0x5b0f('0x43')]({},_0x5a5b8a,_0x155822);return db[_0x5b0f('0x2f')][_0x5b0f('0x4e')](_0x5a5b8a)[_0x5b0f('0x26')](function(_0x53f4f6){if(_0x53f4f6){_0x3cc966=_0x53f4f6;return _0x53f4f6[_0x5b0f('0x6f')]();}return null;})[_0x5b0f('0x26')](function(_0x3a75b7){if(_0x3a75b7){if(!_0x3a75b7[_0x5b0f('0x3b')]){throw new db[(_0x5b0f('0x70'))][(_0x5b0f('0x92'))](_0x5b0f('0x71'),0x193);}_0x51f94d=_0x3a75b7;return db['AnalyticMetric'][_0x5b0f('0x49')]({'raw':!![]});}return null;})['then'](function(_0x268bd0){if(_0x268bd0){_0x2992a9=_[_0x5b0f('0x73')](_0x268bd0,'id');var _0x1bdee4;var _0x4bcb5=squel[_0x5b0f('0x74')]();_0x4bcb5[_0x5b0f('0x75')](_0x3cc966[_0x5b0f('0x76')]);for(var _0x5a5468=0x0;_0x5a5468<_0x51f94d[_0x5b0f('0x3b')];_0x5a5468+=0x1){_0x1bdee4=_0x51f94d[_0x5a5468][_0x5b0f('0x77')]?_0x2992a9[_0x51f94d[_0x5a5468][_0x5b0f('0x77')]]['metric']:_0x51f94d[_0x5a5468]['field'];_0x1bdee4=_0x51f94d[_0x5a5468]['function']?_[_0x5b0f('0x7a')](_0x2331c5[_0x51f94d[_0x5a5468][_0x5b0f('0x79')]],'%s',_0x1bdee4):_0x1bdee4;_0x1bdee4=_0x51f94d[_0x5a5468]['format']?_[_0x5b0f('0x7a')](_0x14bdf2[_0x51f94d[_0x5a5468][_0x5b0f('0x7b')]],'%s',_0x1bdee4):_0x1bdee4;if(_0x51f94d[_0x5a5468][_0x5b0f('0x7c')]){_0x4bcb5[_0x5b0f('0x6c')](_0x1bdee4);}_0x51f94d[_0x5a5468]['orderBy']&&_0x4bcb5[_0x5b0f('0x3e')](_0x1bdee4,_0x51f94d[_0x5a5468][_0x5b0f('0x7d')]===_0x5b0f('0x7e')?![]:!![]);_0x4bcb5[_0x5b0f('0x6d')](_0x1bdee4,_0x51f94d[_0x5a5468][_0x5b0f('0x7f')]||_0x1bdee4);}if(_0x3cc966[_0x5b0f('0x80')]){_0x3cc966[_0x5b0f('0x80')]=JSON[_0x5b0f('0x81')](_0x3cc966[_0x5b0f('0x80')]);for(var _0x49e12b=0x0;_0x49e12b<_0x3cc966[_0x5b0f('0x80')]['length'];_0x49e12b+=0x1){if(_0x3cc966[_0x5b0f('0x80')][_0x49e12b][_0x5b0f('0x32')]&&_[_0x5b0f('0x66')](_0x4f4acf,_0x3cc966[_0x5b0f('0x80')][_0x49e12b][_0x5b0f('0x32')])&&_0x3cc966[_0x5b0f('0x80')][_0x49e12b][_0x5b0f('0x82')]&&_0x3cc966['joins'][_0x49e12b][_0x5b0f('0x83')]&&_0x3cc966['joins'][_0x49e12b][_0x5b0f('0x93')]){_0x4bcb5[_0x3cc966['joins'][_0x49e12b]['type']](_0x3cc966['joins'][_0x49e12b][_0x5b0f('0x83')],null,util['format'](_0x5b0f('0x84'),_0x3cc966[_0x5b0f('0x76')],_0x3cc966[_0x5b0f('0x80')][_0x49e12b][_0x5b0f('0x82')],_0x3cc966[_0x5b0f('0x80')][_0x49e12b][_0x5b0f('0x83')],_0x3cc966[_0x5b0f('0x80')][_0x49e12b][_0x5b0f('0x93')]));}}}if(_0x3cc966[_0x5b0f('0x85')]){_0x3cc966[_0x5b0f('0x85')]=JSON[_0x5b0f('0x81')](_0x3cc966[_0x5b0f('0x85')]);_0x4bcb5[_0x5b0f('0x40')](_0x3b5633(_0x3cc966['conditions'][_0x5b0f('0x6c')]));}_0x36cab6=_0x4bcb5[_0x5b0f('0x86')]();_0x4bcb5['limit'](_0x3f09e1);_0x4bcb5[_0x5b0f('0x1d')](0x0);logger[_0x5b0f('0x87')](_0x5b0f('0x88'),_0x4bcb5[_0x5b0f('0x8a')]());return db['sequelize'][_0x5b0f('0x35')](_0x4bcb5[_0x5b0f('0x8a')](),{'type':db['sequelize']['QueryTypes']['SELECT']});}})[_0x5b0f('0x26')](function(_0x3f78a3){if(!_0x3f78a3['length']){throw new db[(_0x5b0f('0x70'))][(_0x5b0f('0x92'))](_0x5b0f('0x94'),0xcc);}if(_0x2fd379[_0x5b0f('0x95')]===_0x5b0f('0x96')){return null;}var _0x20ca7f=_[_0x5b0f('0x43')](_0x2fd379,{'name':_0x2fd379[_0x5b0f('0x97')]||_0x2fd379[_0x5b0f('0x2b')]||_0x3cc966['name'],'basename':_0x4d9cd1,'savename':util[_0x5b0f('0x7b')](_0x5b0f('0x98'),_0x2fd379[_0x5b0f('0x2b')]||_0x3cc966['name'],require('randomstring')[_0x5b0f('0x99')](0x4),_0x2fd379[_0x5b0f('0x95')]||_0x5b0f('0x9a')),'reportId':_0x3cc966['id'],'reportType':'default'});return db[_0x5b0f('0x9b')]['create'](_0x20ca7f,{'raw':!![]});})[_0x5b0f('0x26')](function(_0x14aa83){if(_0x3cc966[_0x5b0f('0x76')]==='cdr'){_0x36cab6[_0x5b0f('0x40')](_0x3cc966[_0x5b0f('0x76')]+_0x5b0f('0x9c'),_0x2fd379['startDate'],_0x2fd379[_0x5b0f('0x9d')]);}else{_0x36cab6[_0x5b0f('0x40')](_0x3cc966[_0x5b0f('0x76')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2fd379[_0x5b0f('0x9e')],_0x2fd379[_0x5b0f('0x9d')]);}if(_0x14aa83){logger[_0x5b0f('0x9f')](_0x5b0f('0xa0'),_0x36cab6['toString']());require(_0x5b0f('0xa1'))[_0x5b0f('0xa2')](path[_0x5b0f('0x59')](__dirname,_0x5b0f('0xa3'),_0x14aa83['output']),[_0x14aa83['id'],_0x36cab6[_0x5b0f('0x8a')](),path[_0x5b0f('0x59')](__dirname,_0x5b0f('0xa4'),_0x14aa83['savename']),_0x4d9cd1]);return _0x14aa83;}else{var _0x516939=squel[_0x5b0f('0x74')]();_0x516939[_0x5b0f('0x75')]('('+_0x36cab6['toString']()+')','countTable');_0x516939[_0x5b0f('0x6d')](_0x5b0f('0xa5'),_0x5b0f('0x46'));_0x36cab6['limit'](_0x2fd379[_0x5b0f('0x1e')]||_0x3f09e1);_0x36cab6[_0x5b0f('0x1d')](_0x2fd379[_0x5b0f('0x1d')]||0x0);return dbH['sequelize'][_0x5b0f('0x35')](_0x516939[_0x5b0f('0x8a')](),{'type':dbH['sequelize']['QueryTypes'][_0x5b0f('0xa6')]})['then'](function(_0x43dfdf){if(!_0x43dfdf[_0x5b0f('0x3b')]){_0x121e89=0x0;}else{_0x121e89=_0x43dfdf[0x0][_0x5b0f('0x46')]||0x0;}return dbH[_0x5b0f('0x89')][_0x5b0f('0x35')](_0x36cab6[_0x5b0f('0x8a')](),{'type':dbH['sequelize'][_0x5b0f('0x8b')][_0x5b0f('0xa6')]});})[_0x5b0f('0x26')](function(_0x33ceea){return{'rows':_0x33ceea||[],'count':_0x121e89};});}});}exports[_0x5b0f('0xa7')]=function(_0x52effa,_0xe5949b){return runReport(_0x52effa[_0x5b0f('0x4d')],_0x52effa[_0x5b0f('0x35')],_0x52effa[_0x5b0f('0x45')])[_0x5b0f('0x26')](respondWithResult(_0xe5949b,null))[_0x5b0f('0x4b')](handleError(_0xe5949b,null));};exports[_0x5b0f('0xa8')]=runReport;exports[_0x5b0f('0x35')]=function(_0x29bc77,_0x3d4270){var _0x1a1dd6=0xa;var _0x5c8a52=[_0x5b0f('0x59'),_0x5b0f('0x5a'),_0x5b0f('0x8c'),_0x5b0f('0x5b')];var _0x17cd23={'SUM':_0x5b0f('0x5c'),'COUNT':_0x5b0f('0x8d'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x5b0f('0x5e'),'AVG':_0x5b0f('0x8f'),'GROUP_CONCAT':_0x5b0f('0x5f'),'GROUP_CONCAT ASC':_0x5b0f('0x60'),'GROUP_CONCAT DESC':_0x5b0f('0x61')};var _0x591dac={'SEC_TO_TIME':_0x5b0f('0x62'),'DATE':_0x5b0f('0x63'),'HOUR':'HOUR(%s)','ROUND':_0x5b0f('0x90'),'UNIX_TIMESTAMP':_0x5b0f('0x65')};var _0x1a1a2b=function(_0x178dd4){return!_[_0x5b0f('0x66')]([_0x5b0f('0x67'),_0x5b0f('0x68'),_0x5b0f('0x91'),_0x5b0f('0x69')],_0x178dd4);};var _0x105cf8=function(_0x2009f8){if(!_0x2009f8||!_0x2009f8[_0x5b0f('0x6a')][_0x5b0f('0x3b')]){return'';}for(var _0xe684d='(',_0x1fc930=0x0;_0x1fc930<_0x2009f8[_0x5b0f('0x6a')]['length'];_0x1fc930+=0x1){_0x1fc930>0x0&&(_0xe684d+='\x20'+_0x2009f8[_0x5b0f('0x6b')]+'\x20');_0xe684d+=_0x2009f8[_0x5b0f('0x6a')][_0x1fc930]['group']?_0x105cf8(_0x2009f8[_0x5b0f('0x6a')][_0x1fc930][_0x5b0f('0x6c')]):_0x2009f8[_0x5b0f('0x6a')][_0x1fc930][_0x5b0f('0x6d')]+'\x20'+_0x2009f8['rules'][_0x1fc930][_0x5b0f('0x6e')]+(_0x1a1a2b(_0x2009f8[_0x5b0f('0x6a')][_0x1fc930][_0x5b0f('0x6e')])?'\x20'+_0x2009f8[_0x5b0f('0x6a')][_0x1fc930]['value']:'');}return _0xe684d+')';};var _0x3eddf0={'where':{'id':_0x29bc77[_0x5b0f('0x4d')]['id']}},_0x25f6f9,_0x420b45,_0xab80ec,_0x18c7cb,_0x1e6cbc;_0x3eddf0=_[_0x5b0f('0x43')]({},_0x3eddf0,_0x29bc77['options']);return db[_0x5b0f('0x2f')]['find'](_0x3eddf0)[_0x5b0f('0x26')](function(_0xbe76a8){if(_0xbe76a8){_0x25f6f9=_0xbe76a8;return _0xbe76a8[_0x5b0f('0x6f')]();}return null;})[_0x5b0f('0x26')](function(_0x45b227){if(_0x45b227){if(!_0x45b227[_0x5b0f('0x3b')]){throw new db[(_0x5b0f('0x70'))][(_0x5b0f('0x92'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x420b45=_0x45b227;return db[_0x5b0f('0x72')]['findAll']({'raw':!![]});}return null;})[_0x5b0f('0x26')](function(_0x32a1ad){if(_0x32a1ad){_0xab80ec=_[_0x5b0f('0x73')](_0x32a1ad,'id');var _0x4dcda2;var _0x3327c4=squel[_0x5b0f('0x74')]();_0x3327c4[_0x5b0f('0x75')](_0x25f6f9[_0x5b0f('0x76')]);for(var _0x9cd5e9=0x0;_0x9cd5e9<_0x420b45[_0x5b0f('0x3b')];_0x9cd5e9+=0x1){_0x4dcda2=_0x420b45[_0x9cd5e9][_0x5b0f('0x77')]?_0xab80ec[_0x420b45[_0x9cd5e9][_0x5b0f('0x77')]][_0x5b0f('0x78')]:_0x420b45[_0x9cd5e9][_0x5b0f('0x6d')];_0x4dcda2=_0x420b45[_0x9cd5e9]['function']?_[_0x5b0f('0x7a')](_0x17cd23[_0x420b45[_0x9cd5e9][_0x5b0f('0x79')]],'%s',_0x4dcda2):_0x4dcda2;_0x4dcda2=_0x420b45[_0x9cd5e9]['format']?_[_0x5b0f('0x7a')](_0x591dac[_0x420b45[_0x9cd5e9][_0x5b0f('0x7b')]],'%s',_0x4dcda2):_0x4dcda2;if(_0x420b45[_0x9cd5e9][_0x5b0f('0x7c')]){_0x3327c4[_0x5b0f('0x6c')](_0x4dcda2);}_0x420b45[_0x9cd5e9][_0x5b0f('0x7d')]&&_0x3327c4[_0x5b0f('0x3e')](_0x4dcda2,_0x420b45[_0x9cd5e9][_0x5b0f('0x7d')]===_0x5b0f('0x7e')?![]:!![]);_0x3327c4[_0x5b0f('0x6d')](_0x4dcda2,_0x420b45[_0x9cd5e9]['alias']||_0x4dcda2);}if(_0x25f6f9[_0x5b0f('0x80')]){_0x25f6f9[_0x5b0f('0x80')]=JSON['parse'](_0x25f6f9[_0x5b0f('0x80')]);for(var _0x507fae=0x0;_0x507fae<_0x25f6f9['joins']['length'];_0x507fae+=0x1){if(_0x25f6f9[_0x5b0f('0x80')][_0x507fae][_0x5b0f('0x32')]&&_[_0x5b0f('0x66')](_0x5c8a52,_0x25f6f9[_0x5b0f('0x80')][_0x507fae][_0x5b0f('0x32')])&&_0x25f6f9[_0x5b0f('0x80')][_0x507fae]['parentKey']&&_0x25f6f9['joins'][_0x507fae][_0x5b0f('0x83')]&&_0x25f6f9[_0x5b0f('0x80')][_0x507fae][_0x5b0f('0x93')]){_0x3327c4[_0x25f6f9[_0x5b0f('0x80')][_0x507fae][_0x5b0f('0x32')]](_0x25f6f9[_0x5b0f('0x80')][_0x507fae][_0x5b0f('0x83')],null,util[_0x5b0f('0x7b')](_0x5b0f('0x84'),_0x25f6f9[_0x5b0f('0x76')],_0x25f6f9['joins'][_0x507fae][_0x5b0f('0x82')],_0x25f6f9[_0x5b0f('0x80')][_0x507fae][_0x5b0f('0x83')],_0x25f6f9['joins'][_0x507fae][_0x5b0f('0x93')]));}}}if(_0x25f6f9[_0x5b0f('0x85')]){_0x25f6f9[_0x5b0f('0x85')]=JSON[_0x5b0f('0x81')](_0x25f6f9[_0x5b0f('0x85')]);_0x3327c4['where'](_0x105cf8(_0x25f6f9[_0x5b0f('0x85')][_0x5b0f('0x6c')]));}_0x1e6cbc=_0x3327c4['clone']();_0x3327c4[_0x5b0f('0x1e')](_0x1a1dd6);_0x3327c4[_0x5b0f('0x1d')](0x0);logger[_0x5b0f('0x87')](_0x5b0f('0x88'),_0x3327c4[_0x5b0f('0x8a')]());return db[_0x5b0f('0x89')][_0x5b0f('0x35')](_0x3327c4[_0x5b0f('0x8a')](),{'type':db['sequelize']['QueryTypes'][_0x5b0f('0xa6')]});}})[_0x5b0f('0x26')](function(){return{'sql':_0x1e6cbc[_0x5b0f('0x8a')]()};})[_0x5b0f('0x26')](respondWithResult(_0x3d4270,null))['catch'](handleError(_0x3d4270,null));}; \ No newline at end of file +var _0x0405=['web','fullPath','generate','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','countTable','run','options','runReport','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','dbH','status','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','DefaultReports','UserProfileResource','end','sendStatus','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','limit','order','sort','where','pick','filters','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','show','params','AnalyticDefaultReport','find','catch','create','body','user','role','Reports','UserProfileSection','userProfileId','autoAssociation','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','field','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','Sequelize','from','foreignKey','QueryTypes','SELECT','No\x20available\x20data','output'];(function(_0x1cb874,_0x4ffb75){var _0x2a4a01=function(_0x2c9964){while(--_0x2c9964){_0x1cb874['push'](_0x1cb874['shift']());}};_0x2a4a01(++_0x4ffb75);}(_0x0405,0xb1));var _0x5040=function(_0xc39e48,_0x4f9315){_0xc39e48=_0xc39e48-0x0;var _0x4c39af=_0x0405[_0xc39e48];return _0x4c39af;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5040('0x0'));var rimraf=require(_0x5040('0x1'));var zipdir=require(_0x5040('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5040('0x3'));var BPromise=require(_0x5040('0x4'));var Mustache=require(_0x5040('0x5'));var util=require(_0x5040('0x6'));var path=require(_0x5040('0x7'));var sox=require(_0x5040('0x8'));var csv=require(_0x5040('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5040('0xa'));var squel=require(_0x5040('0xb'));var crypto=require(_0x5040('0xc'));var jsforce=require(_0x5040('0xd'));var deskjs=require(_0x5040('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5040('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5040('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x5040('0x11'));var config=require('../../config/environment');var db=require(_0x5040('0x12'))['db'];var dbH=require(_0x5040('0x12'))[_0x5040('0x13')];function respondWithStatusCode(_0x22eada,_0x6e7566){_0x6e7566=_0x6e7566||0xcc;return function(_0xfdbf39){if(_0xfdbf39){return _0x22eada['sendStatus'](_0x6e7566);}return _0x22eada[_0x5040('0x14')](_0x6e7566)['end']();};}function respondWithResult(_0xc92017,_0x160b30){_0x160b30=_0x160b30||0xc8;return function(_0x2ba541){if(_0x2ba541){return _0xc92017[_0x5040('0x14')](_0x160b30)['json'](_0x2ba541);}};}function respondWithFilteredResult(_0x496120,_0x3b6084){return function(_0x54d05c){if(_0x54d05c){var _0x3e6cfd=_0x54d05c['count'],_0x3ccacc=_0x3b6084[_0x5040('0x15')],_0x261f95=_0x3b6084['offset']+_0x3b6084['limit'],_0xa59353;if(_0x261f95>=_0x3e6cfd){_0x261f95=_0x3e6cfd;_0xa59353=0xc8;}else{_0xa59353=0xce;}_0x496120[_0x5040('0x14')](_0xa59353);return _0x496120[_0x5040('0x16')](_0x5040('0x17'),_0x3ccacc+'-'+_0x261f95+'/'+_0x3e6cfd)[_0x5040('0x18')](_0x54d05c);}return null;};}function patchUpdates(_0x2cadc2){return function(_0xfe6f2a){try{jsonpatch[_0x5040('0x19')](_0xfe6f2a,_0x2cadc2,!![]);}catch(_0x441424){return BPromise[_0x5040('0x1a')](_0x441424);}return _0xfe6f2a[_0x5040('0x1b')]();};}function saveUpdates(_0x1ecaa7,_0x39f689){return function(_0x58d13e){if(_0x58d13e){return _0x58d13e[_0x5040('0x1c')](_0x1ecaa7)[_0x5040('0x1d')](function(_0xf41d74){return _0xf41d74;});}return null;};}function removeEntity(_0x5e9b59,_0x55c0ab){return function(_0x57578e){if(_0x57578e){return _0x57578e[_0x5040('0x1e')]()[_0x5040('0x1d')](function(){var _0xe4967f=_0x57578e[_0x5040('0x1f')]({'plain':!![]});var _0xfa21e6=_0x5040('0x20');return db[_0x5040('0x21')]['destroy']({'where':{'type':_0xfa21e6,'resourceId':_0xe4967f['id']}})[_0x5040('0x1d')](function(){return _0x57578e;});})[_0x5040('0x1d')](function(){_0x5e9b59[_0x5040('0x14')](0xcc)[_0x5040('0x22')]();});}};}function handleEntityNotFound(_0x9d8ca0,_0x4e7ef2){return function(_0x2bebbd){if(!_0x2bebbd){_0x9d8ca0[_0x5040('0x23')](0x194);}return _0x2bebbd;};}function handleError(_0x531a2b,_0x31ebe1){_0x31ebe1=_0x31ebe1||0x1f4;return function(_0x3af73d){logger['error'](_0x3af73d['stack']);if(_0x3af73d[_0x5040('0x24')]){delete _0x3af73d[_0x5040('0x24')];}_0x531a2b[_0x5040('0x14')](_0x31ebe1)[_0x5040('0x25')](_0x3af73d);};}exports[_0x5040('0x26')]=function(_0x48115c,_0x42ca57){var _0x1ecb55={},_0x46d459={},_0x5ba4bd={'count':0x0,'rows':[]};var _0x233da9=_['map'](db['AnalyticDefaultReport'][_0x5040('0x27')],function(_0x3dca0f){return{'name':_0x3dca0f[_0x5040('0x28')],'type':_0x3dca0f[_0x5040('0x29')][_0x5040('0x2a')]};});_0x46d459[_0x5040('0x2b')]=_[_0x5040('0x2c')](_0x233da9,_0x5040('0x24'));_0x46d459[_0x5040('0x2d')]=_[_0x5040('0x2e')](_0x48115c['query']);_0x46d459['filters']=_[_0x5040('0x2f')](_0x46d459[_0x5040('0x2b')],_0x46d459[_0x5040('0x2d')]);_0x1ecb55['attributes']=_[_0x5040('0x2f')](_0x46d459[_0x5040('0x2b')],qs[_0x5040('0x30')](_0x48115c[_0x5040('0x2d')][_0x5040('0x30')]));_0x1ecb55[_0x5040('0x31')]=_0x1ecb55['attributes'][_0x5040('0x32')]?_0x1ecb55[_0x5040('0x31')]:_0x46d459['model'];if(!_0x48115c[_0x5040('0x2d')]['hasOwnProperty']('nolimit')){_0x1ecb55[_0x5040('0x33')]=qs[_0x5040('0x33')](_0x48115c[_0x5040('0x2d')]['limit']);_0x1ecb55[_0x5040('0x15')]=qs[_0x5040('0x15')](_0x48115c[_0x5040('0x2d')][_0x5040('0x15')]);}_0x1ecb55[_0x5040('0x34')]=qs[_0x5040('0x35')](_0x48115c['query'][_0x5040('0x35')]);_0x1ecb55[_0x5040('0x36')]=qs['filters'](_[_0x5040('0x37')](_0x48115c['query'],_0x46d459[_0x5040('0x38')]),_0x233da9);if(_0x48115c[_0x5040('0x2d')][_0x5040('0x39')]){_0x1ecb55['where']=_[_0x5040('0x3a')](_0x1ecb55['where'],{'$or':_[_0x5040('0x2c')](_0x233da9,function(_0x11c8ca){if(_0x11c8ca['type']!==_0x5040('0x3b')){var _0x57d1f5={};_0x57d1f5[_0x11c8ca[_0x5040('0x24')]]={'$like':'%'+_0x48115c['query']['filter']+'%'};return _0x57d1f5;}})});}_0x1ecb55=_['merge']({},_0x1ecb55,_0x48115c['options']);var _0x34f13e={'where':_0x1ecb55[_0x5040('0x36')]};return db['AnalyticDefaultReport'][_0x5040('0x3c')](_0x34f13e)[_0x5040('0x1d')](function(_0x2a626b){_0x5ba4bd[_0x5040('0x3c')]=_0x2a626b;if(_0x48115c['query'][_0x5040('0x3d')]){_0x1ecb55[_0x5040('0x3e')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x5040('0x3f')](_0x1ecb55);})[_0x5040('0x1d')](function(_0x3b29d3){_0x5ba4bd[_0x5040('0x40')]=_0x3b29d3;return _0x5ba4bd;})[_0x5040('0x1d')](respondWithFilteredResult(_0x42ca57,_0x1ecb55))['catch'](handleError(_0x42ca57,null));};exports[_0x5040('0x41')]=function(_0x24f34e,_0x418c0b){var _0x3ab462={'raw':!![],'where':{'id':_0x24f34e[_0x5040('0x42')]['id']}},_0x2a746e={};_0x2a746e[_0x5040('0x2b')]=_[_0x5040('0x2e')](db[_0x5040('0x43')][_0x5040('0x27')]);_0x2a746e['query']=_[_0x5040('0x2e')](_0x24f34e[_0x5040('0x2d')]);_0x2a746e[_0x5040('0x38')]=_[_0x5040('0x2f')](_0x2a746e[_0x5040('0x2b')],_0x2a746e[_0x5040('0x2d')]);_0x3ab462['attributes']=_[_0x5040('0x2f')](_0x2a746e[_0x5040('0x2b')],qs[_0x5040('0x30')](_0x24f34e[_0x5040('0x2d')][_0x5040('0x30')]));_0x3ab462[_0x5040('0x31')]=_0x3ab462['attributes'][_0x5040('0x32')]?_0x3ab462[_0x5040('0x31')]:_0x2a746e[_0x5040('0x2b')];if(_0x24f34e[_0x5040('0x2d')][_0x5040('0x3d')]){_0x3ab462[_0x5040('0x3e')]=[{'all':!![]}];}_0x3ab462=_[_0x5040('0x3a')]({},_0x3ab462,_0x24f34e['options']);return db[_0x5040('0x43')][_0x5040('0x44')](_0x3ab462)[_0x5040('0x1d')](handleEntityNotFound(_0x418c0b,null))['then'](respondWithResult(_0x418c0b,null))[_0x5040('0x45')](handleError(_0x418c0b,null));};exports[_0x5040('0x46')]=function(_0x44c6d0,_0x3bfa5e){return db[_0x5040('0x43')][_0x5040('0x46')](_0x44c6d0[_0x5040('0x47')],{})[_0x5040('0x1d')](function(_0x58aa60){var _0x543ced=_0x44c6d0[_0x5040('0x48')][_0x5040('0x1f')]({'plain':!![]});if(!_0x543ced)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x543ced[_0x5040('0x49')]===_0x5040('0x48')){var _0x51b755=_0x58aa60[_0x5040('0x1f')]({'plain':!![]});var _0x3a7f91=_0x5040('0x4a');return db[_0x5040('0x4b')][_0x5040('0x44')]({'where':{'name':_0x3a7f91,'userProfileId':_0x543ced[_0x5040('0x4c')]},'raw':!![]})[_0x5040('0x1d')](function(_0x2801d5){if(_0x2801d5&&_0x2801d5[_0x5040('0x4d')]===0x0){return db[_0x5040('0x21')][_0x5040('0x46')]({'name':_0x51b755[_0x5040('0x24')],'resourceId':_0x51b755['id'],'type':_0x5040('0x20'),'sectionId':_0x2801d5['id']},{})['then'](function(){return _0x58aa60;});}else{return _0x58aa60;}})[_0x5040('0x45')](function(_0x534e8c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x534e8c);throw _0x534e8c;});}return _0x58aa60;})['then'](respondWithResult(_0x3bfa5e,0xc9))[_0x5040('0x45')](handleError(_0x3bfa5e,null));};exports[_0x5040('0x1c')]=function(_0x56ba58,_0x46df04){if(_0x56ba58[_0x5040('0x47')]['id']){delete _0x56ba58[_0x5040('0x47')]['id'];}return db[_0x5040('0x43')]['find']({'where':{'id':_0x56ba58[_0x5040('0x42')]['id']}})[_0x5040('0x1d')](handleEntityNotFound(_0x46df04,null))['then'](saveUpdates(_0x56ba58[_0x5040('0x47')],null))['then'](respondWithResult(_0x46df04,null))['catch'](handleError(_0x46df04,null));};exports['destroy']=function(_0x47aece,_0x103d91){return db[_0x5040('0x43')][_0x5040('0x44')]({'where':{'id':_0x47aece['params']['id']}})[_0x5040('0x1d')](handleEntityNotFound(_0x103d91,null))[_0x5040('0x1d')](removeEntity(_0x103d91,null))[_0x5040('0x45')](handleError(_0x103d91,null));};exports[_0x5040('0x4e')]=function(_0x2db06c,_0x2d7a18){var _0x1e26cf=0xa;var _0x70fee2=[_0x5040('0x4f'),'left_join',_0x5040('0x50'),_0x5040('0x51')];var _0x3602ae={'SUM':_0x5040('0x52'),'COUNT':_0x5040('0x53'),'COUNT DISTINCT':_0x5040('0x54'),'MAX':_0x5040('0x55'),'MIN':_0x5040('0x56'),'AVG':_0x5040('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x5040('0x58'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x528723={'SEC_TO_TIME':_0x5040('0x59'),'DATE':_0x5040('0x5a'),'HOUR':_0x5040('0x5b'),'ROUND':_0x5040('0x5c'),'UNIX_TIMESTAMP':_0x5040('0x5d')};var _0xd2068e=function(_0x4b6a87){return!_[_0x5040('0x5e')]([_0x5040('0x5f'),_0x5040('0x60'),_0x5040('0x61'),_0x5040('0x62')],_0x4b6a87);};var _0x5cd99f=function(_0x123dde){if(!_0x123dde||!_0x123dde[_0x5040('0x63')]['length']){return'';}for(var _0x2e3758='(',_0x13c04d=0x0;_0x13c04d<_0x123dde['rules']['length'];_0x13c04d+=0x1){_0x13c04d>0x0&&(_0x2e3758+='\x20'+_0x123dde[_0x5040('0x64')]+'\x20');_0x2e3758+=_0x123dde['rules'][_0x13c04d][_0x5040('0x65')]?_0x5cd99f(_0x123dde[_0x5040('0x63')][_0x13c04d][_0x5040('0x65')]):_0x123dde['rules'][_0x13c04d]['field']+'\x20'+_0x123dde[_0x5040('0x63')][_0x13c04d][_0x5040('0x66')]+(_0xd2068e(_0x123dde[_0x5040('0x63')][_0x13c04d][_0x5040('0x66')])?'\x20'+_0x123dde[_0x5040('0x63')][_0x13c04d][_0x5040('0x67')]:'');}return _0x2e3758+')';};var _0x2b044d={'where':{'id':_0x2db06c[_0x5040('0x42')]['id']}},_0x5deffa,_0x36363b,_0x3d86e7,_0xf6307f,_0x6af7d8;_0x2b044d=_[_0x5040('0x3a')]({},_0x2b044d,_0x2db06c['options']);return db[_0x5040('0x43')][_0x5040('0x44')](_0x2b044d)['then'](function(_0x2be967){if(_0x2be967){_0x5deffa=_0x2be967;return _0x2be967[_0x5040('0x68')]();}return null;})[_0x5040('0x1d')](function(_0x24ac6e){if(_0x24ac6e){if(!_0x24ac6e[_0x5040('0x32')]){throw new db['Sequelize'][(_0x5040('0x69'))](_0x5040('0x6a'),0x193);}_0x36363b=_0x24ac6e;return db[_0x5040('0x6b')][_0x5040('0x3f')]({'raw':!![]});}return null;})[_0x5040('0x1d')](function(_0x140506){if(_0x140506){_0x3d86e7=_[_0x5040('0x6c')](_0x140506,'id');var _0x3b03e5;var _0x1fe310=squel[_0x5040('0x6d')]();_0x1fe310['from'](_0x5deffa[_0x5040('0x6e')]);for(var _0x58a5a1=0x0;_0x58a5a1<_0x36363b['length'];_0x58a5a1+=0x1){_0x3b03e5=_0x36363b[_0x58a5a1][_0x5040('0x6f')]?_0x3d86e7[_0x36363b[_0x58a5a1][_0x5040('0x6f')]][_0x5040('0x70')]:_0x36363b[_0x58a5a1][_0x5040('0x71')];_0x3b03e5=_0x36363b[_0x58a5a1][_0x5040('0x72')]?_[_0x5040('0x73')](_0x3602ae[_0x36363b[_0x58a5a1][_0x5040('0x72')]],'%s',_0x3b03e5):_0x3b03e5;_0x3b03e5=_0x36363b[_0x58a5a1][_0x5040('0x74')]?_[_0x5040('0x73')](_0x528723[_0x36363b[_0x58a5a1][_0x5040('0x74')]],'%s',_0x3b03e5):_0x3b03e5;if(_0x36363b[_0x58a5a1][_0x5040('0x75')]){_0x1fe310['group'](_0x3b03e5);}_0x36363b[_0x58a5a1][_0x5040('0x76')]&&_0x1fe310['order'](_0x3b03e5,_0x36363b[_0x58a5a1]['orderBy']==='DESC'?![]:!![]);_0x1fe310[_0x5040('0x71')](_0x3b03e5,_0x36363b[_0x58a5a1][_0x5040('0x77')]||_0x3b03e5);}if(_0x5deffa[_0x5040('0x78')]){_0x5deffa[_0x5040('0x78')]=JSON[_0x5040('0x79')](_0x5deffa[_0x5040('0x78')]);for(var _0x4f9ba6=0x0;_0x4f9ba6<_0x5deffa[_0x5040('0x78')][_0x5040('0x32')];_0x4f9ba6+=0x1){if(_0x5deffa[_0x5040('0x78')][_0x4f9ba6][_0x5040('0x29')]&&_[_0x5040('0x5e')](_0x70fee2,_0x5deffa[_0x5040('0x78')][_0x4f9ba6][_0x5040('0x29')])&&_0x5deffa['joins'][_0x4f9ba6][_0x5040('0x7a')]&&_0x5deffa[_0x5040('0x78')][_0x4f9ba6]['foreignTable']&&_0x5deffa[_0x5040('0x78')][_0x4f9ba6]['foreignKey']){_0x1fe310[_0x5deffa['joins'][_0x4f9ba6][_0x5040('0x29')]](_0x5deffa[_0x5040('0x78')][_0x4f9ba6][_0x5040('0x7b')],null,util[_0x5040('0x74')](_0x5040('0x7c'),_0x5deffa[_0x5040('0x6e')],_0x5deffa['joins'][_0x4f9ba6][_0x5040('0x7a')],_0x5deffa[_0x5040('0x78')][_0x4f9ba6][_0x5040('0x7b')],_0x5deffa[_0x5040('0x78')][_0x4f9ba6]['foreignKey']));}}}if(_0x5deffa[_0x5040('0x7d')]){_0x5deffa[_0x5040('0x7d')]=JSON['parse'](_0x5deffa[_0x5040('0x7d')]);_0x1fe310[_0x5040('0x36')](_0x5cd99f(_0x5deffa[_0x5040('0x7d')]['group']));}_0x6af7d8=_0x1fe310[_0x5040('0x7e')]();_0x1fe310[_0x5040('0x33')](_0x1e26cf);_0x1fe310[_0x5040('0x15')](0x0);logger[_0x5040('0x7f')](_0x5040('0x80'),_0x1fe310[_0x5040('0x81')]());return db[_0x5040('0x82')][_0x5040('0x2d')](_0x1fe310[_0x5040('0x81')](),{'type':db[_0x5040('0x82')]['QueryTypes']['SELECT']});}})[_0x5040('0x1d')](respondWithResult(_0x2d7a18,null))['catch'](handleError(_0x2d7a18,null));};function runReport(_0x5b5fc4,_0x5b9ee7,_0x141607){var _0x2464d8=_0x5b9ee7[_0x5040('0x24')];var _0x6bd5f5=0xa;var _0x39b1d4=[_0x5040('0x4f'),'left_join',_0x5040('0x50'),_0x5040('0x51')];var _0x21a214={'SUM':_0x5040('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x5040('0x56'),'AVG':_0x5040('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x5040('0x58'),'GROUP_CONCAT DESC':_0x5040('0x83')};var _0x1bf437={'SEC_TO_TIME':_0x5040('0x59'),'DATE':_0x5040('0x5a'),'HOUR':_0x5040('0x5b'),'ROUND':_0x5040('0x5c'),'UNIX_TIMESTAMP':_0x5040('0x5d')};var _0x4d1135=function(_0x51839b){return!_[_0x5040('0x5e')]([_0x5040('0x5f'),_0x5040('0x60'),_0x5040('0x61'),_0x5040('0x62')],_0x51839b);};var _0x4d53ab=function(_0x32e5c7){if(!_0x32e5c7||!_0x32e5c7[_0x5040('0x63')][_0x5040('0x32')]){return'';}for(var _0x27d038='(',_0x5773c6=0x0;_0x5773c6<_0x32e5c7[_0x5040('0x63')]['length'];_0x5773c6+=0x1){_0x5773c6>0x0&&(_0x27d038+='\x20'+_0x32e5c7[_0x5040('0x64')]+'\x20');_0x27d038+=_0x32e5c7[_0x5040('0x63')][_0x5773c6][_0x5040('0x65')]?_0x4d53ab(_0x32e5c7[_0x5040('0x63')][_0x5773c6][_0x5040('0x65')]):_0x32e5c7['rules'][_0x5773c6][_0x5040('0x71')]+'\x20'+_0x32e5c7[_0x5040('0x63')][_0x5773c6][_0x5040('0x66')]+(_0x4d1135(_0x32e5c7[_0x5040('0x63')][_0x5773c6][_0x5040('0x66')])?'\x20'+_0x32e5c7[_0x5040('0x63')][_0x5773c6]['value']:'');}return _0x27d038+')';};var _0x982617={'where':{'id':_0x5b5fc4['id']}},_0xceae1c,_0xa9e06e,_0x19f4b7,_0x362717,_0x5aee77;_0x982617=_[_0x5040('0x3a')]({},_0x982617,_0x141607);return db[_0x5040('0x43')][_0x5040('0x44')](_0x982617)[_0x5040('0x1d')](function(_0x4dc543){if(_0x4dc543){_0xceae1c=_0x4dc543;return _0x4dc543['getFields']();}return null;})[_0x5040('0x1d')](function(_0x3328cf){if(_0x3328cf){if(!_0x3328cf[_0x5040('0x32')]){throw new db[(_0x5040('0x84'))][(_0x5040('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xa9e06e=_0x3328cf;return db['AnalyticMetric'][_0x5040('0x3f')]({'raw':!![]});}return null;})['then'](function(_0x4e65f0){if(_0x4e65f0){_0x19f4b7=_[_0x5040('0x6c')](_0x4e65f0,'id');var _0x39523d;var _0x43c3ec=squel[_0x5040('0x6d')]();_0x43c3ec[_0x5040('0x85')](_0xceae1c[_0x5040('0x6e')]);for(var _0x58db2b=0x0;_0x58db2b<_0xa9e06e['length'];_0x58db2b+=0x1){_0x39523d=_0xa9e06e[_0x58db2b][_0x5040('0x6f')]?_0x19f4b7[_0xa9e06e[_0x58db2b][_0x5040('0x6f')]][_0x5040('0x70')]:_0xa9e06e[_0x58db2b][_0x5040('0x71')];_0x39523d=_0xa9e06e[_0x58db2b]['function']?_[_0x5040('0x73')](_0x21a214[_0xa9e06e[_0x58db2b][_0x5040('0x72')]],'%s',_0x39523d):_0x39523d;_0x39523d=_0xa9e06e[_0x58db2b][_0x5040('0x74')]?_['replace'](_0x1bf437[_0xa9e06e[_0x58db2b][_0x5040('0x74')]],'%s',_0x39523d):_0x39523d;if(_0xa9e06e[_0x58db2b][_0x5040('0x75')]){_0x43c3ec[_0x5040('0x65')](_0x39523d);}_0xa9e06e[_0x58db2b][_0x5040('0x76')]&&_0x43c3ec[_0x5040('0x34')](_0x39523d,_0xa9e06e[_0x58db2b]['orderBy']==='DESC'?![]:!![]);_0x43c3ec[_0x5040('0x71')](_0x39523d,_0xa9e06e[_0x58db2b][_0x5040('0x77')]||_0x39523d);}if(_0xceae1c[_0x5040('0x78')]){_0xceae1c[_0x5040('0x78')]=JSON[_0x5040('0x79')](_0xceae1c[_0x5040('0x78')]);for(var _0x1df8e9=0x0;_0x1df8e9<_0xceae1c['joins'][_0x5040('0x32')];_0x1df8e9+=0x1){if(_0xceae1c[_0x5040('0x78')][_0x1df8e9][_0x5040('0x29')]&&_[_0x5040('0x5e')](_0x39b1d4,_0xceae1c[_0x5040('0x78')][_0x1df8e9]['type'])&&_0xceae1c['joins'][_0x1df8e9]['parentKey']&&_0xceae1c['joins'][_0x1df8e9][_0x5040('0x7b')]&&_0xceae1c[_0x5040('0x78')][_0x1df8e9]['foreignKey']){_0x43c3ec[_0xceae1c[_0x5040('0x78')][_0x1df8e9]['type']](_0xceae1c[_0x5040('0x78')][_0x1df8e9]['foreignTable'],null,util[_0x5040('0x74')](_0x5040('0x7c'),_0xceae1c[_0x5040('0x6e')],_0xceae1c[_0x5040('0x78')][_0x1df8e9][_0x5040('0x7a')],_0xceae1c[_0x5040('0x78')][_0x1df8e9][_0x5040('0x7b')],_0xceae1c[_0x5040('0x78')][_0x1df8e9][_0x5040('0x86')]));}}}if(_0xceae1c[_0x5040('0x7d')]){_0xceae1c[_0x5040('0x7d')]=JSON['parse'](_0xceae1c[_0x5040('0x7d')]);_0x43c3ec[_0x5040('0x36')](_0x4d53ab(_0xceae1c[_0x5040('0x7d')][_0x5040('0x65')]));}_0x5aee77=_0x43c3ec[_0x5040('0x7e')]();_0x43c3ec[_0x5040('0x33')](_0x6bd5f5);_0x43c3ec[_0x5040('0x15')](0x0);logger[_0x5040('0x7f')](_0x5040('0x80'),_0x43c3ec['toString']());return db[_0x5040('0x82')][_0x5040('0x2d')](_0x43c3ec['toString'](),{'type':db[_0x5040('0x82')][_0x5040('0x87')][_0x5040('0x88')]});}})[_0x5040('0x1d')](function(_0x39be9f){if(!_0x39be9f[_0x5040('0x32')]){throw new db[(_0x5040('0x84'))]['ValidationErrorItem'](_0x5040('0x89'),0xcc);}if(_0x5b9ee7[_0x5040('0x8a')]===_0x5040('0x8b')){return null;}var _0x42f268=_[_0x5040('0x3a')](_0x5b9ee7,{'name':_0x5b9ee7[_0x5040('0x8c')]||_0x5b9ee7['name']||_0xceae1c[_0x5040('0x24')],'basename':_0x2464d8,'savename':util[_0x5040('0x74')]('%s-%s.%s',_0x5b9ee7[_0x5040('0x24')]||_0xceae1c['name'],require('randomstring')[_0x5040('0x8d')](0x4),_0x5b9ee7[_0x5040('0x8a')]||'csv'),'reportId':_0xceae1c['id'],'reportType':_0x5040('0x8e')});return db[_0x5040('0x8f')][_0x5040('0x46')](_0x42f268,{'raw':!![]});})['then'](function(_0x3dbf9a){if(_0xceae1c[_0x5040('0x6e')]===_0x5040('0x90')){_0x5aee77['where'](_0xceae1c[_0x5040('0x6e')]+_0x5040('0x91'),_0x5b9ee7[_0x5040('0x92')],_0x5b9ee7[_0x5040('0x93')]);}else{_0x5aee77['where'](_0xceae1c[_0x5040('0x6e')]+_0x5040('0x94'),_0x5b9ee7[_0x5040('0x92')],_0x5b9ee7[_0x5040('0x93')]);}if(_0x3dbf9a){logger[_0x5040('0x95')](_0x5040('0x96'),_0x5aee77[_0x5040('0x81')]());require(_0x5040('0x97'))[_0x5040('0x98')](path[_0x5040('0x4f')](__dirname,_0x5040('0x99'),_0x3dbf9a[_0x5040('0x8a')]),[_0x3dbf9a['id'],_0x5aee77[_0x5040('0x81')](),path[_0x5040('0x4f')](__dirname,'../../files/reports',_0x3dbf9a['savename']),_0x2464d8]);return _0x3dbf9a;}else{var _0xbf0729=squel[_0x5040('0x6d')]();_0xbf0729[_0x5040('0x85')]('('+_0x5aee77[_0x5040('0x81')]()+')',_0x5040('0x9a'));_0xbf0729[_0x5040('0x71')]('COUNT(*)',_0x5040('0x3c'));_0x5aee77[_0x5040('0x33')](_0x5b9ee7['limit']||_0x6bd5f5);_0x5aee77['offset'](_0x5b9ee7['offset']||0x0);return dbH[_0x5040('0x82')]['query'](_0xbf0729[_0x5040('0x81')](),{'type':dbH[_0x5040('0x82')][_0x5040('0x87')][_0x5040('0x88')]})[_0x5040('0x1d')](function(_0x15a0ec){if(!_0x15a0ec[_0x5040('0x32')]){_0x362717=0x0;}else{_0x362717=_0x15a0ec[0x0][_0x5040('0x3c')]||0x0;}return dbH[_0x5040('0x82')][_0x5040('0x2d')](_0x5aee77['toString'](),{'type':dbH[_0x5040('0x82')][_0x5040('0x87')][_0x5040('0x88')]});})[_0x5040('0x1d')](function(_0x46522f){return{'rows':_0x46522f||[],'count':_0x362717};});}});}exports[_0x5040('0x9b')]=function(_0x52d1f3,_0x52b829){return runReport(_0x52d1f3[_0x5040('0x42')],_0x52d1f3[_0x5040('0x2d')],_0x52d1f3[_0x5040('0x9c')])[_0x5040('0x1d')](respondWithResult(_0x52b829,null))[_0x5040('0x45')](handleError(_0x52b829,null));};exports[_0x5040('0x9d')]=runReport;exports[_0x5040('0x2d')]=function(_0x16fd12,_0x58f3eb){var _0x1bdee1=0xa;var _0x14f637=['join','left_join','right_join',_0x5040('0x51')];var _0x38fc1f={'SUM':_0x5040('0x52'),'COUNT':_0x5040('0x53'),'COUNT DISTINCT':_0x5040('0x54'),'MAX':'MAX(%s)','MIN':_0x5040('0x56'),'AVG':_0x5040('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x5040('0x58'),'GROUP_CONCAT DESC':_0x5040('0x83')};var _0x258751={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5040('0x5d')};var _0x550f8d=function(_0x568f76){return!_['includes'](['IS\x20NULL',_0x5040('0x60'),_0x5040('0x61'),'IS\x20NOT\x20EMPTY'],_0x568f76);};var _0x30ab06=function(_0x40f4fc){if(!_0x40f4fc||!_0x40f4fc[_0x5040('0x63')]['length']){return'';}for(var _0x243ee3='(',_0xe27d22=0x0;_0xe27d22<_0x40f4fc[_0x5040('0x63')][_0x5040('0x32')];_0xe27d22+=0x1){_0xe27d22>0x0&&(_0x243ee3+='\x20'+_0x40f4fc[_0x5040('0x64')]+'\x20');_0x243ee3+=_0x40f4fc[_0x5040('0x63')][_0xe27d22][_0x5040('0x65')]?_0x30ab06(_0x40f4fc[_0x5040('0x63')][_0xe27d22][_0x5040('0x65')]):_0x40f4fc['rules'][_0xe27d22][_0x5040('0x71')]+'\x20'+_0x40f4fc[_0x5040('0x63')][_0xe27d22][_0x5040('0x66')]+(_0x550f8d(_0x40f4fc[_0x5040('0x63')][_0xe27d22]['condition'])?'\x20'+_0x40f4fc[_0x5040('0x63')][_0xe27d22][_0x5040('0x67')]:'');}return _0x243ee3+')';};var _0x3396ad={'where':{'id':_0x16fd12[_0x5040('0x42')]['id']}},_0x439707,_0x172774,_0x4eaf13,_0x26b695,_0x29663f;_0x3396ad=_['merge']({},_0x3396ad,_0x16fd12[_0x5040('0x9c')]);return db[_0x5040('0x43')]['find'](_0x3396ad)[_0x5040('0x1d')](function(_0x1c8e06){if(_0x1c8e06){_0x439707=_0x1c8e06;return _0x1c8e06[_0x5040('0x68')]();}return null;})[_0x5040('0x1d')](function(_0x15a071){if(_0x15a071){if(!_0x15a071[_0x5040('0x32')]){throw new db[(_0x5040('0x84'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x172774=_0x15a071;return db['AnalyticMetric'][_0x5040('0x3f')]({'raw':!![]});}return null;})['then'](function(_0x5ef5da){if(_0x5ef5da){_0x4eaf13=_[_0x5040('0x6c')](_0x5ef5da,'id');var _0x16d7f1;var _0x4eb579=squel[_0x5040('0x6d')]();_0x4eb579[_0x5040('0x85')](_0x439707[_0x5040('0x6e')]);for(var _0x22f81f=0x0;_0x22f81f<_0x172774[_0x5040('0x32')];_0x22f81f+=0x1){_0x16d7f1=_0x172774[_0x22f81f][_0x5040('0x6f')]?_0x4eaf13[_0x172774[_0x22f81f][_0x5040('0x6f')]][_0x5040('0x70')]:_0x172774[_0x22f81f][_0x5040('0x71')];_0x16d7f1=_0x172774[_0x22f81f]['function']?_[_0x5040('0x73')](_0x38fc1f[_0x172774[_0x22f81f][_0x5040('0x72')]],'%s',_0x16d7f1):_0x16d7f1;_0x16d7f1=_0x172774[_0x22f81f]['format']?_['replace'](_0x258751[_0x172774[_0x22f81f][_0x5040('0x74')]],'%s',_0x16d7f1):_0x16d7f1;if(_0x172774[_0x22f81f]['groupBy']){_0x4eb579[_0x5040('0x65')](_0x16d7f1);}_0x172774[_0x22f81f][_0x5040('0x76')]&&_0x4eb579[_0x5040('0x34')](_0x16d7f1,_0x172774[_0x22f81f][_0x5040('0x76')]==='DESC'?![]:!![]);_0x4eb579['field'](_0x16d7f1,_0x172774[_0x22f81f][_0x5040('0x77')]||_0x16d7f1);}if(_0x439707[_0x5040('0x78')]){_0x439707[_0x5040('0x78')]=JSON[_0x5040('0x79')](_0x439707[_0x5040('0x78')]);for(var _0x453b87=0x0;_0x453b87<_0x439707[_0x5040('0x78')][_0x5040('0x32')];_0x453b87+=0x1){if(_0x439707['joins'][_0x453b87][_0x5040('0x29')]&&_[_0x5040('0x5e')](_0x14f637,_0x439707[_0x5040('0x78')][_0x453b87]['type'])&&_0x439707[_0x5040('0x78')][_0x453b87]['parentKey']&&_0x439707[_0x5040('0x78')][_0x453b87]['foreignTable']&&_0x439707[_0x5040('0x78')][_0x453b87]['foreignKey']){_0x4eb579[_0x439707[_0x5040('0x78')][_0x453b87][_0x5040('0x29')]](_0x439707['joins'][_0x453b87]['foreignTable'],null,util[_0x5040('0x74')](_0x5040('0x7c'),_0x439707[_0x5040('0x6e')],_0x439707[_0x5040('0x78')][_0x453b87]['parentKey'],_0x439707['joins'][_0x453b87][_0x5040('0x7b')],_0x439707[_0x5040('0x78')][_0x453b87]['foreignKey']));}}}if(_0x439707['conditions']){_0x439707[_0x5040('0x7d')]=JSON[_0x5040('0x79')](_0x439707['conditions']);_0x4eb579[_0x5040('0x36')](_0x30ab06(_0x439707['conditions']['group']));}_0x29663f=_0x4eb579[_0x5040('0x7e')]();_0x4eb579[_0x5040('0x33')](_0x1bdee1);_0x4eb579[_0x5040('0x15')](0x0);logger[_0x5040('0x7f')](_0x5040('0x80'),_0x4eb579[_0x5040('0x81')]());return db['sequelize'][_0x5040('0x2d')](_0x4eb579[_0x5040('0x81')](),{'type':db[_0x5040('0x82')]['QueryTypes'][_0x5040('0x88')]});}})[_0x5040('0x1d')](function(){return{'sql':_0x29663f['toString']()};})[_0x5040('0x1d')](respondWithResult(_0x58f3eb,null))[_0x5040('0x45')](handleError(_0x58f3eb,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index ae330c4..c4465f6 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 _0x326f=['analytics_default_reports','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport'];(function(_0x266a10,_0x28035d){var _0x10acd8=function(_0x2db22a){while(--_0x2db22a){_0x266a10['push'](_0x266a10['shift']());}};_0x10acd8(++_0x28035d);}(_0x326f,0xd1));var _0xf326=function(_0x314b4f,_0xf30dff){_0x314b4f=_0x314b4f-0x0;var _0x1f2a6c=_0x326f[_0x314b4f];return _0x1f2a6c;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['bluebird','path','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','lodash','util','../../config/logger','api','moment'];(function(_0x4d5083,_0x18161e){var _0xdd4534=function(_0x258afe){while(--_0x258afe){_0x4d5083['push'](_0x4d5083['shift']());}};_0xdd4534(++_0x18161e);}(_0x53ec,0x192));var _0xc53e=function(_0x56bb63,_0x3e165b){_0x56bb63=_0x56bb63-0x0;var _0x56a7ec=_0x53ec[_0x56bb63];return _0x56a7ec;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),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 824499d..fafb667 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 _0x6324=['client','http','then','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise'];(function(_0x2215ff,_0x48a5cf){var _0x3532bb=function(_0x518607){while(--_0x518607){_0x2215ff['push'](_0x2215ff['shift']());}};_0x3532bb(++_0x48a5cf);}(_0x6324,0x142));var _0x4632=function(_0x268c4c,_0x5cce8d){_0x268c4c=_0x268c4c-0x0;var _0x37e96e=_0x6324[_0x268c4c];return _0x37e96e;};'use strict';var _=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var moment=require(_0x4632('0x2'));var BPromise=require(_0x4632('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4632('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4632('0x5'));var logger=require('../../config/logger')(_0x4632('0x6'));var config=require('../../config/environment');var jayson=require(_0x4632('0x7'));var client=jayson[_0x4632('0x8')][_0x4632('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x126e9a,_0x4a15b2,_0x17e860){return new BPromise(function(_0x44dd6d,_0x390a46){return client['request'](_0x126e9a,_0x17e860)[_0x4632('0xa')](function(_0x47824c){logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x4a15b2,_0x4632('0xb'));logger[_0x4632('0xc')](_0x4632('0xd'),_0x4a15b2,_0x4632('0xb'),JSON[_0x4632('0xe')](_0x47824c));if(_0x47824c[_0x4632('0xf')]){if(_0x47824c[_0x4632('0xf')][_0x4632('0x10')]===0x1f4){logger['error'](_0x4632('0x11'),_0x4a15b2,_0x47824c['error'][_0x4632('0x12')]);return _0x390a46(_0x47824c[_0x4632('0xf')][_0x4632('0x12')]);}logger[_0x4632('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4a15b2,_0x47824c[_0x4632('0xf')][_0x4632('0x12')]);return _0x44dd6d(_0x47824c[_0x4632('0xf')][_0x4632('0x12')]);}else{logger[_0x4632('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4a15b2,'request\x20sent');_0x44dd6d(_0x47824c[_0x4632('0x14')][_0x4632('0x12')]);}})[_0x4632('0x15')](function(_0x125eb9){logger['error'](_0x4632('0x11'),_0x4a15b2,_0x125eb9);_0x390a46(_0x125eb9);});});} \ No newline at end of file +var _0x89c4=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x344713,_0x2e06f3){var _0x21edf0=function(_0x1d5665){while(--_0x1d5665){_0x344713['push'](_0x344713['shift']());}};_0x21edf0(++_0x2e06f3);}(_0x89c4,0x82));var _0x489c=function(_0x75bff8,_0x2212d7){_0x75bff8=_0x75bff8-0x0;var _0x6cb0a6=_0x89c4[_0x75bff8];return _0x6cb0a6;};'use strict';var _=require(_0x489c('0x0'));var util=require(_0x489c('0x1'));var moment=require('moment');var BPromise=require(_0x489c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x489c('0x3'))['db'];var utils=require(_0x489c('0x4'));var logger=require(_0x489c('0x5'))(_0x489c('0x6'));var config=require(_0x489c('0x7'));var jayson=require(_0x489c('0x8'));var client=jayson[_0x489c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe5e402,_0x476dfe,_0x122c44){return new BPromise(function(_0xceb82c,_0x5a301e){return client['request'](_0xe5e402,_0x122c44)[_0x489c('0xa')](function(_0x54ea10){logger[_0x489c('0xb')](_0x489c('0xc'),_0x476dfe,_0x489c('0xd'));logger[_0x489c('0xe')](_0x489c('0xf'),_0x476dfe,_0x489c('0xd'),JSON[_0x489c('0x10')](_0x54ea10));if(_0x54ea10[_0x489c('0x11')]){if(_0x54ea10['error'][_0x489c('0x12')]===0x1f4){logger['error'](_0x489c('0xc'),_0x476dfe,_0x54ea10['error']['message']);return _0x5a301e(_0x54ea10[_0x489c('0x11')]['message']);}logger[_0x489c('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x476dfe,_0x54ea10[_0x489c('0x11')][_0x489c('0x13')]);return _0xceb82c(_0x54ea10['error'][_0x489c('0x13')]);}else{logger[_0x489c('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x476dfe,'request\x20sent');_0xceb82c(_0x54ea10[_0x489c('0x14')]['message']);}})[_0x489c('0x15')](function(_0x2e89c4){logger[_0x489c('0x11')](_0x489c('0xc'),_0x476dfe,_0x2e89c4);_0x5a301e(_0x2e89c4);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 399adb5..c48a305 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 _0x6e29=['/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','preview'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x6e29,0x18b));var _0x96e2=function(_0x598bee,_0x4e464f){_0x598bee=_0x598bee-0x0;var _0x53ea99=_0x6e29[_0x598bee];return _0x53ea99;};'use strict';var multer=require('multer');var util=require(_0x96e2('0x0'));var path=require('path');var timeout=require(_0x96e2('0x1'));var express=require(_0x96e2('0x2'));var router=express[_0x96e2('0x3')]();var auth=require(_0x96e2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x96e2('0x5'));var controller=require('./analyticDefaultReport.controller');router[_0x96e2('0x6')]('/',auth[_0x96e2('0x7')](),controller[_0x96e2('0x8')]);router[_0x96e2('0x6')](_0x96e2('0x9'),auth[_0x96e2('0x7')](),controller[_0x96e2('0xa')]);router[_0x96e2('0x6')](_0x96e2('0xb'),auth[_0x96e2('0x7')](),controller[_0x96e2('0xc')]);router[_0x96e2('0x6')](_0x96e2('0xd'),auth[_0x96e2('0x7')](),controller[_0x96e2('0xe')]);router[_0x96e2('0x6')](_0x96e2('0xf'),auth['isAuthenticated'](),controller[_0x96e2('0x10')]);router[_0x96e2('0x11')]('/',auth[_0x96e2('0x7')](),controller[_0x96e2('0x12')]);router[_0x96e2('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x96e2('0x14')]);router[_0x96e2('0x15')](_0x96e2('0x9'),auth[_0x96e2('0x7')](),controller[_0x96e2('0x16')]);module[_0x96e2('0x17')]=router; \ No newline at end of file +var _0xf006=['query','create','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','/:id','isAuthenticated','show','preview','/:id/run','run','/:id/query'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0xf006,0x91));var _0x6f00=function(_0x4f71f7,_0x2e8d1d){_0x4f71f7=_0x4f71f7-0x0;var _0x3f066d=_0xf006[_0x4f71f7];return _0x3f066d;};'use strict';var multer=require(_0x6f00('0x0'));var util=require('util');var path=require(_0x6f00('0x1'));var timeout=require('connect-timeout');var express=require(_0x6f00('0x2'));var router=express[_0x6f00('0x3')]();var auth=require(_0x6f00('0x4'));var interaction=require(_0x6f00('0x5'));var config=require(_0x6f00('0x6'));var controller=require(_0x6f00('0x7'));router[_0x6f00('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6f00('0x8')](_0x6f00('0x9'),auth[_0x6f00('0xa')](),controller[_0x6f00('0xb')]);router[_0x6f00('0x8')]('/:id/preview',auth['isAuthenticated'](),controller[_0x6f00('0xc')]);router['get'](_0x6f00('0xd'),auth[_0x6f00('0xa')](),controller[_0x6f00('0xe')]);router['get'](_0x6f00('0xf'),auth[_0x6f00('0xa')](),controller[_0x6f00('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6f00('0x11')]);router[_0x6f00('0x12')](_0x6f00('0x9'),auth[_0x6f00('0xa')](),controller[_0x6f00('0x13')]);router[_0x6f00('0x14')]('/:id',auth[_0x6f00('0xa')](),controller[_0x6f00('0x15')]);module[_0x6f00('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 44c732a..14bdcdc 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 _0xe785=['pdf','STRING','DATE','Loading','manual','scheduled','INTEGER','ENUM','csv'];(function(_0x4691ca,_0x3cf10c){var _0x197c25=function(_0x380824){while(--_0x380824){_0x4691ca['push'](_0x4691ca['shift']());}};_0x197c25(++_0x3cf10c);}(_0xe785,0x18a));var _0x5e78=function(_0x2e51f9,_0x320019){_0x2e51f9=_0x2e51f9-0x0;var _0xb560e3=_0xe785[_0x2e51f9];return _0xb560e3;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x5e78('0x0')](_0x5e78('0x1'),_0x5e78('0x2'),'xlsx'),'allowNull':![],'defaultValue':_0x5e78('0x1')},'savename':{'type':Sequelize[_0x5e78('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x5e78('0x4')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x5e78('0x3')],'defaultValue':_0x5e78('0x5')},'type':{'type':Sequelize[_0x5e78('0x0')](_0x5e78('0x6'),_0x5e78('0x7')),'allowNull':![],'defaultValue':_0x5e78('0x6')},'reportId':{'type':Sequelize[_0x5e78('0x8')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x998a=['ENUM','csv','pdf','DATE','manual','scheduled','UNSIGNED','sequelize','moment','exports','STRING'];(function(_0x124764,_0x29d225){var _0x469afc=function(_0x3e1a33){while(--_0x3e1a33){_0x124764['push'](_0x124764['shift']());}};_0x469afc(++_0x29d225);}(_0x998a,0x1a9));var _0xa998=function(_0x628791,_0x42bd87){_0x628791=_0x628791-0x0;var _0x3f9f70=_0x998a[_0x628791];return _0x3f9f70;};'use strict';var Sequelize=require(_0xa998('0x0'));var moment=require(_0xa998('0x1'));module[_0xa998('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xa998('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xa998('0x4')](_0xa998('0x5'),_0xa998('0x6'),'xlsx'),'allowNull':![],'defaultValue':_0xa998('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xa998('0x7')]},'endDate':{'type':Sequelize[_0xa998('0x7')]},'status':{'type':Sequelize[_0xa998('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xa998('0x4')](_0xa998('0x8'),_0xa998('0x9')),'allowNull':![],'defaultValue':_0xa998('0x8')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xa998('0xa')]},'reportType':{'type':Sequelize[_0xa998('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 6c7fad7..b95604d 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 _0xfeee=['name','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','catch','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','savename','output','existsSync','join','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','download','format','%s.%s','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','ExtractedReports','error','stack'];(function(_0x5a4979,_0x5f445b){var _0xe92b3a=function(_0x183055){while(--_0x183055){_0x5a4979['push'](_0x5a4979['shift']());}};_0xe92b3a(++_0x5f445b);}(_0xfeee,0x8a));var _0xefee=function(_0x3e2789,_0x6d23c6){_0x3e2789=_0x3e2789-0x0;var _0x4371ba=_0xfeee[_0x3e2789];return _0x4371ba;};'use strict';var pdf=require(_0xefee('0x0'));var emlformat=require(_0xefee('0x1'));var rimraf=require(_0xefee('0x2'));var zipdir=require(_0xefee('0x3'));var jsonpatch=require(_0xefee('0x4'));var rp=require(_0xefee('0x5'));var moment=require('moment');var BPromise=require(_0xefee('0x6'));var Mustache=require(_0xefee('0x7'));var util=require('util');var path=require('path');var sox=require(_0xefee('0x8'));var csv=require(_0xefee('0x9'));var ejs=require(_0xefee('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xefee('0xb'));var crypto=require(_0xefee('0xc'));var jsforce=require(_0xefee('0xd'));var deskjs=require(_0xefee('0xe'));var toCsv=require(_0xefee('0x9'));var querystring=require('querystring');var Papa=require(_0xefee('0xf'));var Redis=require('ioredis');var authService=require(_0xefee('0x10'));var qs=require(_0xefee('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xefee('0x12'));var logger=require(_0xefee('0x13'))(_0xefee('0x14'));var utils=require(_0xefee('0x15'));var config=require(_0xefee('0x16'));var db=require(_0xefee('0x17'))['db'];function respondWithStatusCode(_0x100cb6,_0x439afc){_0x439afc=_0x439afc||0xcc;return function(_0x2ccd11){if(_0x2ccd11){return _0x100cb6[_0xefee('0x18')](_0x439afc);}return _0x100cb6[_0xefee('0x19')](_0x439afc)[_0xefee('0x1a')]();};}function respondWithResult(_0x24934a,_0x49a603){_0x49a603=_0x49a603||0xc8;return function(_0x4f34f5){if(_0x4f34f5){return _0x24934a[_0xefee('0x19')](_0x49a603)[_0xefee('0x1b')](_0x4f34f5);}};}function respondWithFilteredResult(_0x41a3f4,_0x1b9cac){return function(_0x2ab471){if(_0x2ab471){var _0x59ef52=_0x2ab471[_0xefee('0x1c')],_0x3beea0=_0x1b9cac[_0xefee('0x1d')],_0x2b99b6=_0x1b9cac['offset']+_0x1b9cac[_0xefee('0x1e')],_0x3ec7ff;if(_0x2b99b6>=_0x59ef52){_0x2b99b6=_0x59ef52;_0x3ec7ff=0xc8;}else{_0x3ec7ff=0xce;}_0x41a3f4['status'](_0x3ec7ff);return _0x41a3f4[_0xefee('0x1f')](_0xefee('0x20'),_0x3beea0+'-'+_0x2b99b6+'/'+_0x59ef52)[_0xefee('0x1b')](_0x2ab471);}return null;};}function patchUpdates(_0xd55bf9){return function(_0x4ef0d2){try{jsonpatch[_0xefee('0x21')](_0x4ef0d2,_0xd55bf9,!![]);}catch(_0xa1aa80){return BPromise[_0xefee('0x22')](_0xa1aa80);}return _0x4ef0d2[_0xefee('0x23')]();};}function saveUpdates(_0xa9796c,_0x4e3e6e){return function(_0x4136f3){if(_0x4136f3){return _0x4136f3[_0xefee('0x24')](_0xa9796c)[_0xefee('0x25')](function(_0x214a80){return _0x214a80;});}return null;};}function removeEntity(_0x2da554,_0xf6a1dd){return function(_0x3c61dc){if(_0x3c61dc){return _0x3c61dc[_0xefee('0x26')]()[_0xefee('0x25')](function(){var _0x5e4bda=_0x3c61dc['get']({'plain':!![]});var _0x49d177=_0xefee('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x49d177,'resourceId':_0x5e4bda['id']}})[_0xefee('0x25')](function(){return _0x3c61dc;});})[_0xefee('0x25')](function(){_0x2da554['status'](0xcc)[_0xefee('0x1a')]();});}};}function handleEntityNotFound(_0x4bef00,_0x5929d9){return function(_0x1d1e61){if(!_0x1d1e61){_0x4bef00[_0xefee('0x18')](0x194);}return _0x1d1e61;};}function handleError(_0x5b81c8,_0x4b28cf){_0x4b28cf=_0x4b28cf||0x1f4;return function(_0x246709){logger[_0xefee('0x28')](_0x246709[_0xefee('0x29')]);if(_0x246709[_0xefee('0x2a')]){delete _0x246709['name'];}_0x5b81c8[_0xefee('0x19')](_0x4b28cf)['send'](_0x246709);};}exports['index']=function(_0xc96a2f,_0x57b2d4){var _0x19186c={},_0x7a6719={},_0x487492={'count':0x0,'rows':[]};var _0x4d7373=_[_0xefee('0x2b')](db[_0xefee('0x2c')][_0xefee('0x2d')],function(_0x21c047){return{'name':_0x21c047[_0xefee('0x2e')],'type':_0x21c047[_0xefee('0x2f')][_0xefee('0x30')]};});_0x7a6719[_0xefee('0x31')]=_[_0xefee('0x2b')](_0x4d7373,_0xefee('0x2a'));_0x7a6719['query']=_[_0xefee('0x32')](_0xc96a2f['query']);_0x7a6719[_0xefee('0x33')]=_[_0xefee('0x34')](_0x7a6719[_0xefee('0x31')],_0x7a6719[_0xefee('0x35')]);_0x19186c['attributes']=_['intersection'](_0x7a6719['model'],qs[_0xefee('0x36')](_0xc96a2f['query'][_0xefee('0x36')]));_0x19186c[_0xefee('0x37')]=_0x19186c[_0xefee('0x37')][_0xefee('0x38')]?_0x19186c['attributes']:_0x7a6719[_0xefee('0x31')];if(!_0xc96a2f[_0xefee('0x35')]['hasOwnProperty'](_0xefee('0x39'))){_0x19186c[_0xefee('0x1e')]=qs[_0xefee('0x1e')](_0xc96a2f[_0xefee('0x35')][_0xefee('0x1e')]);_0x19186c[_0xefee('0x1d')]=qs[_0xefee('0x1d')](_0xc96a2f[_0xefee('0x35')]['offset']);}_0x19186c[_0xefee('0x3a')]=qs[_0xefee('0x3b')](_0xc96a2f['query'][_0xefee('0x3b')]);_0x19186c[_0xefee('0x3c')]=qs[_0xefee('0x33')](_['pick'](_0xc96a2f[_0xefee('0x35')],_0x7a6719[_0xefee('0x33')]),_0x4d7373);if(_0xc96a2f[_0xefee('0x35')][_0xefee('0x3d')]){_0x19186c[_0xefee('0x3c')]=_[_0xefee('0x3e')](_0x19186c[_0xefee('0x3c')],{'$or':_[_0xefee('0x2b')](_0x4d7373,function(_0x56f14f){if(_0x56f14f['type']!=='VIRTUAL'){var _0x1d774d={};_0x1d774d[_0x56f14f['name']]={'$like':'%'+_0xc96a2f[_0xefee('0x35')][_0xefee('0x3d')]+'%'};return _0x1d774d;}})});}_0x19186c=_[_0xefee('0x3e')]({},_0x19186c,_0xc96a2f[_0xefee('0x3f')]);var _0x39f8f6={'where':_0x19186c[_0xefee('0x3c')]};return db[_0xefee('0x2c')]['count'](_0x39f8f6)[_0xefee('0x25')](function(_0x5bf80a){_0x487492[_0xefee('0x1c')]=_0x5bf80a;if(_0xc96a2f[_0xefee('0x35')][_0xefee('0x40')]){_0x19186c['include']=[{'all':!![]}];}return db[_0xefee('0x2c')][_0xefee('0x41')](_0x19186c);})[_0xefee('0x25')](function(_0x355bb6){_0x487492['rows']=_0x355bb6;return _0x487492;})[_0xefee('0x25')](respondWithFilteredResult(_0x57b2d4,_0x19186c))[_0xefee('0x42')](handleError(_0x57b2d4,null));};exports['show']=function(_0x4bd95c,_0x177075){var _0x44fd1f={'raw':!![],'where':{'id':_0x4bd95c[_0xefee('0x43')]['id']}},_0x51a897={};_0x51a897[_0xefee('0x31')]=_[_0xefee('0x32')](db[_0xefee('0x2c')][_0xefee('0x2d')]);_0x51a897[_0xefee('0x35')]=_[_0xefee('0x32')](_0x4bd95c[_0xefee('0x35')]);_0x51a897['filters']=_[_0xefee('0x34')](_0x51a897['model'],_0x51a897[_0xefee('0x35')]);_0x44fd1f['attributes']=_[_0xefee('0x34')](_0x51a897['model'],qs[_0xefee('0x36')](_0x4bd95c[_0xefee('0x35')]['fields']));_0x44fd1f['attributes']=_0x44fd1f[_0xefee('0x37')][_0xefee('0x38')]?_0x44fd1f['attributes']:_0x51a897[_0xefee('0x31')];if(_0x4bd95c[_0xefee('0x35')]['includeAll']){_0x44fd1f['include']=[{'all':!![]}];}_0x44fd1f=_[_0xefee('0x3e')]({},_0x44fd1f,_0x4bd95c[_0xefee('0x3f')]);return db[_0xefee('0x2c')][_0xefee('0x44')](_0x44fd1f)[_0xefee('0x25')](handleEntityNotFound(_0x177075,null))[_0xefee('0x25')](respondWithResult(_0x177075,null))[_0xefee('0x42')](handleError(_0x177075,null));};exports[_0xefee('0x45')]=function(_0x3efbd8,_0x328e8b){return db['AnalyticExtractedReport'][_0xefee('0x45')](_0x3efbd8[_0xefee('0x46')],{})[_0xefee('0x25')](function(_0x416512){var _0x5a3514=_0x3efbd8[_0xefee('0x47')][_0xefee('0x48')]({'plain':!![]});if(!_0x5a3514)throw new Error(_0xefee('0x49'));if(_0x5a3514['role']===_0xefee('0x47')){var _0x530e21=_0x416512[_0xefee('0x48')]({'plain':!![]});var _0x17e148='ExtractedReports';return db['UserProfileSection'][_0xefee('0x44')]({'where':{'name':_0x17e148,'userProfileId':_0x5a3514['userProfileId']},'raw':!![]})[_0xefee('0x25')](function(_0xfaef9){if(_0xfaef9&&_0xfaef9[_0xefee('0x4a')]===0x0){return db[_0xefee('0x4b')]['create']({'name':_0x530e21[_0xefee('0x2a')],'resourceId':_0x530e21['id'],'type':_0xfaef9[_0xefee('0x2a')],'sectionId':_0xfaef9['id']},{})[_0xefee('0x25')](function(){return _0x416512;});}else{return _0x416512;}})[_0xefee('0x42')](function(_0x5541b6){logger['error'](_0xefee('0x4c'),_0x5541b6);throw _0x5541b6;});}return _0x416512;})[_0xefee('0x25')](respondWithResult(_0x328e8b,0xc9))[_0xefee('0x42')](handleError(_0x328e8b,null));};exports[_0xefee('0x24')]=function(_0x34f9b3,_0x60e954){if(_0x34f9b3[_0xefee('0x46')]['id']){delete _0x34f9b3[_0xefee('0x46')]['id'];}return db[_0xefee('0x2c')]['find']({'where':{'id':_0x34f9b3[_0xefee('0x43')]['id']}})[_0xefee('0x25')](handleEntityNotFound(_0x60e954,null))[_0xefee('0x25')](saveUpdates(_0x34f9b3[_0xefee('0x46')],null))[_0xefee('0x25')](respondWithResult(_0x60e954,null))[_0xefee('0x42')](handleError(_0x60e954,null));};exports[_0xefee('0x26')]=function(_0x43240f,_0x5ecd68){return db[_0xefee('0x2c')]['find']({'where':{'id':_0x43240f['params']['id']}})[_0xefee('0x25')](handleEntityNotFound(_0x5ecd68,null))[_0xefee('0x25')](removeEntity(_0x5ecd68,null))[_0xefee('0x42')](handleError(_0x5ecd68,null));};exports['download']=function(_0xdf8e8c,_0x185a4a,_0x4e329b){return db[_0xefee('0x2c')][_0xefee('0x44')]({'where':{'id':_0xdf8e8c[_0xefee('0x43')]['id']},'attributes':[_0xefee('0x2a'),_0xefee('0x4d'),_0xefee('0x4e'),_0xefee('0x4f')],'raw':!![]})[_0xefee('0x25')](handleEntityNotFound(_0x185a4a,null))['then'](function(_0x139425){if(_0x139425){if(!fs[_0xefee('0x50')](path[_0xefee('0x51')](config[_0xefee('0x52')],_0xefee('0x53'),_0x139425[_0xefee('0x4e')]))){throw new db['Sequelize'][(_0xefee('0x54'))](_0xefee('0x55'));}if(_0xdf8e8c[_0xefee('0x35')]['exists']){return _0x185a4a[_0xefee('0x18')](0xc8);}return _0x185a4a[_0xefee('0x56')](path['join'](config[_0xefee('0x52')],_0xefee('0x53'),_0x139425['savename']),util[_0xefee('0x57')](_0xefee('0x58'),_0x139425[_0xefee('0x4d')]||_0x139425[_0xefee('0x2a')],_0x139425[_0xefee('0x4f')][_0xefee('0x59')]()));}})['catch'](handleError(_0x185a4a,null));}; \ No newline at end of file +var _0x43a1=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','ExtractedReports','name','send','index','map','fieldName','model','keys','query','intersection','fields','attributes','length','nolimit','offset','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','AnalyticExtractedReport','findAll','rows','catch','show','params','includeAll','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','error','download','basename','savename','output','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','html-pdf','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x2f0f80,_0x473360){var _0x549825=function(_0x539b0d){while(--_0x539b0d){_0x2f0f80['push'](_0x2f0f80['shift']());}};_0x549825(++_0x473360);}(_0x43a1,0xb2));var _0x143a=function(_0x344128,_0x9b9e88){_0x344128=_0x344128-0x0;var _0x693fae=_0x43a1[_0x344128];return _0x693fae;};'use strict';var pdf=require(_0x143a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x143a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x143a('0x2'));var moment=require('moment');var BPromise=require(_0x143a('0x3'));var Mustache=require(_0x143a('0x4'));var util=require(_0x143a('0x5'));var path=require(_0x143a('0x6'));var sox=require(_0x143a('0x7'));var csv=require('to-csv');var ejs=require(_0x143a('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x143a('0x9'));var crypto=require(_0x143a('0xa'));var jsforce=require(_0x143a('0xb'));var deskjs=require(_0x143a('0xc'));var toCsv=require(_0x143a('0xd'));var querystring=require(_0x143a('0xe'));var Papa=require(_0x143a('0xf'));var Redis=require(_0x143a('0x10'));var authService=require(_0x143a('0x11'));var qs=require(_0x143a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x143a('0x13'));var logger=require(_0x143a('0x14'))(_0x143a('0x15'));var utils=require(_0x143a('0x16'));var config=require(_0x143a('0x17'));var db=require(_0x143a('0x18'))['db'];function respondWithStatusCode(_0x48a2f7,_0xfb790c){_0xfb790c=_0xfb790c||0xcc;return function(_0x35f665){if(_0x35f665){return _0x48a2f7[_0x143a('0x19')](_0xfb790c);}return _0x48a2f7[_0x143a('0x1a')](_0xfb790c)[_0x143a('0x1b')]();};}function respondWithResult(_0x50ab31,_0x4fb418){_0x4fb418=_0x4fb418||0xc8;return function(_0x4c0f70){if(_0x4c0f70){return _0x50ab31[_0x143a('0x1a')](_0x4fb418)['json'](_0x4c0f70);}};}function respondWithFilteredResult(_0x492645,_0x550f2c){return function(_0x2858e7){if(_0x2858e7){var _0x27ba3d=_0x2858e7[_0x143a('0x1c')],_0x1784b8=_0x550f2c['offset'],_0x591264=_0x550f2c['offset']+_0x550f2c[_0x143a('0x1d')],_0x4a4769;if(_0x591264>=_0x27ba3d){_0x591264=_0x27ba3d;_0x4a4769=0xc8;}else{_0x4a4769=0xce;}_0x492645[_0x143a('0x1a')](_0x4a4769);return _0x492645[_0x143a('0x1e')](_0x143a('0x1f'),_0x1784b8+'-'+_0x591264+'/'+_0x27ba3d)[_0x143a('0x20')](_0x2858e7);}return null;};}function patchUpdates(_0x1c0f9f){return function(_0x335699){try{jsonpatch[_0x143a('0x21')](_0x335699,_0x1c0f9f,!![]);}catch(_0x157bd8){return BPromise[_0x143a('0x22')](_0x157bd8);}return _0x335699['save']();};}function saveUpdates(_0x4c8152,_0xa061c6){return function(_0x3adbff){if(_0x3adbff){return _0x3adbff[_0x143a('0x23')](_0x4c8152)[_0x143a('0x24')](function(_0x5312f6){return _0x5312f6;});}return null;};}function removeEntity(_0x40e368,_0x22d703){return function(_0x815e7e){if(_0x815e7e){return _0x815e7e[_0x143a('0x25')]()[_0x143a('0x24')](function(){var _0x4ea7c6=_0x815e7e['get']({'plain':!![]});var _0x3e4e5b=_0x143a('0x26');return db['UserProfileResource'][_0x143a('0x25')]({'where':{'type':_0x3e4e5b,'resourceId':_0x4ea7c6['id']}})['then'](function(){return _0x815e7e;});})[_0x143a('0x24')](function(){_0x40e368[_0x143a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ce54,_0x1896af){return function(_0x29ac82){if(!_0x29ac82){_0x16ce54['sendStatus'](0x194);}return _0x29ac82;};}function handleError(_0x2a9e57,_0x5dcd70){_0x5dcd70=_0x5dcd70||0x1f4;return function(_0x4592c4){logger['error'](_0x4592c4['stack']);if(_0x4592c4[_0x143a('0x27')]){delete _0x4592c4['name'];}_0x2a9e57['status'](_0x5dcd70)[_0x143a('0x28')](_0x4592c4);};}exports[_0x143a('0x29')]=function(_0x5e4e00,_0xbb351e){var _0x4ca216={},_0x59c20a={},_0x2f0784={'count':0x0,'rows':[]};var _0x135dea=_[_0x143a('0x2a')](db['AnalyticExtractedReport']['rawAttributes'],function(_0x283415){return{'name':_0x283415[_0x143a('0x2b')],'type':_0x283415['type']['key']};});_0x59c20a[_0x143a('0x2c')]=_[_0x143a('0x2a')](_0x135dea,_0x143a('0x27'));_0x59c20a['query']=_[_0x143a('0x2d')](_0x5e4e00[_0x143a('0x2e')]);_0x59c20a['filters']=_['intersection'](_0x59c20a[_0x143a('0x2c')],_0x59c20a[_0x143a('0x2e')]);_0x4ca216['attributes']=_[_0x143a('0x2f')](_0x59c20a[_0x143a('0x2c')],qs[_0x143a('0x30')](_0x5e4e00[_0x143a('0x2e')][_0x143a('0x30')]));_0x4ca216[_0x143a('0x31')]=_0x4ca216[_0x143a('0x31')][_0x143a('0x32')]?_0x4ca216[_0x143a('0x31')]:_0x59c20a[_0x143a('0x2c')];if(!_0x5e4e00[_0x143a('0x2e')]['hasOwnProperty'](_0x143a('0x33'))){_0x4ca216[_0x143a('0x1d')]=qs[_0x143a('0x1d')](_0x5e4e00[_0x143a('0x2e')][_0x143a('0x1d')]);_0x4ca216[_0x143a('0x34')]=qs['offset'](_0x5e4e00[_0x143a('0x2e')][_0x143a('0x34')]);}_0x4ca216[_0x143a('0x35')]=qs['sort'](_0x5e4e00['query'][_0x143a('0x36')]);_0x4ca216['where']=qs[_0x143a('0x37')](_[_0x143a('0x38')](_0x5e4e00[_0x143a('0x2e')],_0x59c20a[_0x143a('0x37')]),_0x135dea);if(_0x5e4e00['query'][_0x143a('0x39')]){_0x4ca216[_0x143a('0x3a')]=_[_0x143a('0x3b')](_0x4ca216[_0x143a('0x3a')],{'$or':_[_0x143a('0x2a')](_0x135dea,function(_0x4d05f8){if(_0x4d05f8[_0x143a('0x3c')]!==_0x143a('0x3d')){var _0x50eaaf={};_0x50eaaf[_0x4d05f8[_0x143a('0x27')]]={'$like':'%'+_0x5e4e00[_0x143a('0x2e')]['filter']+'%'};return _0x50eaaf;}})});}_0x4ca216=_[_0x143a('0x3b')]({},_0x4ca216,_0x5e4e00[_0x143a('0x3e')]);var _0x367447={'where':_0x4ca216[_0x143a('0x3a')]};return db[_0x143a('0x3f')]['count'](_0x367447)[_0x143a('0x24')](function(_0x3c409c){_0x2f0784[_0x143a('0x1c')]=_0x3c409c;if(_0x5e4e00[_0x143a('0x2e')]['includeAll']){_0x4ca216['include']=[{'all':!![]}];}return db[_0x143a('0x3f')][_0x143a('0x40')](_0x4ca216);})[_0x143a('0x24')](function(_0x341ce8){_0x2f0784[_0x143a('0x41')]=_0x341ce8;return _0x2f0784;})[_0x143a('0x24')](respondWithFilteredResult(_0xbb351e,_0x4ca216))[_0x143a('0x42')](handleError(_0xbb351e,null));};exports[_0x143a('0x43')]=function(_0x43dcd7,_0x4b6fcc){var _0x45a77f={'raw':!![],'where':{'id':_0x43dcd7[_0x143a('0x44')]['id']}},_0xd6a153={};_0xd6a153['model']=_[_0x143a('0x2d')](db[_0x143a('0x3f')]['rawAttributes']);_0xd6a153[_0x143a('0x2e')]=_[_0x143a('0x2d')](_0x43dcd7[_0x143a('0x2e')]);_0xd6a153[_0x143a('0x37')]=_[_0x143a('0x2f')](_0xd6a153[_0x143a('0x2c')],_0xd6a153[_0x143a('0x2e')]);_0x45a77f['attributes']=_[_0x143a('0x2f')](_0xd6a153['model'],qs[_0x143a('0x30')](_0x43dcd7[_0x143a('0x2e')][_0x143a('0x30')]));_0x45a77f[_0x143a('0x31')]=_0x45a77f[_0x143a('0x31')][_0x143a('0x32')]?_0x45a77f[_0x143a('0x31')]:_0xd6a153[_0x143a('0x2c')];if(_0x43dcd7['query'][_0x143a('0x45')]){_0x45a77f[_0x143a('0x46')]=[{'all':!![]}];}_0x45a77f=_[_0x143a('0x3b')]({},_0x45a77f,_0x43dcd7[_0x143a('0x3e')]);return db[_0x143a('0x3f')][_0x143a('0x47')](_0x45a77f)['then'](handleEntityNotFound(_0x4b6fcc,null))[_0x143a('0x24')](respondWithResult(_0x4b6fcc,null))[_0x143a('0x42')](handleError(_0x4b6fcc,null));};exports[_0x143a('0x48')]=function(_0x5031c2,_0x509542){return db[_0x143a('0x3f')][_0x143a('0x48')](_0x5031c2[_0x143a('0x49')],{})[_0x143a('0x24')](function(_0x17635f){var _0x23e227=_0x5031c2['user'][_0x143a('0x4a')]({'plain':!![]});if(!_0x23e227)throw new Error(_0x143a('0x4b'));if(_0x23e227[_0x143a('0x4c')]===_0x143a('0x4d')){var _0x276de2=_0x17635f[_0x143a('0x4a')]({'plain':!![]});var _0x351fac=_0x143a('0x26');return db['UserProfileSection'][_0x143a('0x47')]({'where':{'name':_0x351fac,'userProfileId':_0x23e227[_0x143a('0x4e')]},'raw':!![]})[_0x143a('0x24')](function(_0x471787){if(_0x471787&&_0x471787[_0x143a('0x4f')]===0x0){return db[_0x143a('0x50')][_0x143a('0x48')]({'name':_0x276de2[_0x143a('0x27')],'resourceId':_0x276de2['id'],'type':_0x471787[_0x143a('0x27')],'sectionId':_0x471787['id']},{})['then'](function(){return _0x17635f;});}else{return _0x17635f;}})[_0x143a('0x42')](function(_0xf890cb){logger[_0x143a('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf890cb);throw _0xf890cb;});}return _0x17635f;})[_0x143a('0x24')](respondWithResult(_0x509542,0xc9))[_0x143a('0x42')](handleError(_0x509542,null));};exports[_0x143a('0x23')]=function(_0x1ccf36,_0x5aeb71){if(_0x1ccf36['body']['id']){delete _0x1ccf36[_0x143a('0x49')]['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x1ccf36[_0x143a('0x44')]['id']}})[_0x143a('0x24')](handleEntityNotFound(_0x5aeb71,null))[_0x143a('0x24')](saveUpdates(_0x1ccf36['body'],null))[_0x143a('0x24')](respondWithResult(_0x5aeb71,null))[_0x143a('0x42')](handleError(_0x5aeb71,null));};exports['destroy']=function(_0x1d046a,_0x265af8){return db[_0x143a('0x3f')][_0x143a('0x47')]({'where':{'id':_0x1d046a['params']['id']}})['then'](handleEntityNotFound(_0x265af8,null))['then'](removeEntity(_0x265af8,null))['catch'](handleError(_0x265af8,null));};exports[_0x143a('0x52')]=function(_0x2f3635,_0x2bc170,_0x1b4093){return db[_0x143a('0x3f')][_0x143a('0x47')]({'where':{'id':_0x2f3635[_0x143a('0x44')]['id']},'attributes':[_0x143a('0x27'),_0x143a('0x53'),_0x143a('0x54'),_0x143a('0x55')],'raw':!![]})['then'](handleEntityNotFound(_0x2bc170,null))[_0x143a('0x24')](function(_0x4347ef){if(_0x4347ef){if(!fs['existsSync'](path[_0x143a('0x56')](config[_0x143a('0x57')],_0x143a('0x58'),_0x4347ef['savename']))){throw new db[(_0x143a('0x59'))][(_0x143a('0x5a'))](_0x143a('0x5b'));}if(_0x2f3635['query'][_0x143a('0x5c')]){return _0x2bc170[_0x143a('0x19')](0xc8);}return _0x2bc170[_0x143a('0x52')](path['join'](config['root'],_0x143a('0x58'),_0x4347ef['savename']),util[_0x143a('0x5d')](_0x143a('0x5e'),_0x4347ef[_0x143a('0x53')]||_0x4347ef[_0x143a('0x27')],_0x4347ef['output'][_0x143a('0x5f')]()));}})['catch'](handleError(_0x2bc170,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 06bd9b8..3de71bf 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 _0xb0ff=['define','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','moment','bluebird','request-promise','rimraf','./analyticExtractedReport.attributes','exports'];(function(_0x27fa58,_0x33b050){var _0x5bd300=function(_0x1477ef){while(--_0x1477ef){_0x27fa58['push'](_0x27fa58['shift']());}};_0x5bd300(++_0x33b050);}(_0xb0ff,0xb3));var _0xfb0f=function(_0x231b28,_0x310bd1){_0x231b28=_0x231b28-0x0;var _0x110c17=_0xb0ff[_0x231b28];return _0x110c17;};'use strict';var _=require('lodash');var util=require(_0xfb0f('0x0'));var logger=require(_0xfb0f('0x1'))('api');var moment=require(_0xfb0f('0x2'));var BPromise=require(_0xfb0f('0x3'));var rp=require(_0xfb0f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb0f('0x5'));var config=require('../../config/environment');var attributes=require(_0xfb0f('0x6'));module[_0xfb0f('0x7')]=function(_0x334b59,_0x2583f8){return _0x334b59[_0xfb0f('0x8')](_0xfb0f('0x9'),attributes,{'tableName':_0xfb0f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb24c=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash'];(function(_0x4b98cd,_0x1c5b89){var _0x418cc7=function(_0x5f29cd){while(--_0x5f29cd){_0x4b98cd['push'](_0x4b98cd['shift']());}};_0x418cc7(++_0x1c5b89);}(_0xb24c,0x1e0));var _0xcb24=function(_0x2fd5f8,_0x256d55){_0x2fd5f8=_0x2fd5f8-0x0;var _0x40d96c=_0xb24c[_0x2fd5f8];return _0x40d96c;};'use strict';var _=require(_0xcb24('0x0'));var util=require(_0xcb24('0x1'));var logger=require(_0xcb24('0x2'))(_0xcb24('0x3'));var moment=require(_0xcb24('0x4'));var BPromise=require(_0xcb24('0x5'));var rp=require(_0xcb24('0x6'));var fs=require('fs');var path=require(_0xcb24('0x7'));var rimraf=require(_0xcb24('0x8'));var config=require(_0xcb24('0x9'));var attributes=require('./analyticExtractedReport.attributes');module[_0xcb24('0xa')]=function(_0xa6f5ec,_0x3e2a7c){return _0xa6f5ec['define'](_0xcb24('0xb'),attributes,{'tableName':_0xcb24('0xc'),'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 fbbc2db..360641b 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 _0x2e44=['jayson/promise','client','http','request','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','result','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2ed01e,_0x588831){var _0x3108e6=function(_0xabd816){while(--_0xabd816){_0x2ed01e['push'](_0x2ed01e['shift']());}};_0x3108e6(++_0x588831);}(_0x2e44,0xa8));var _0x42e4=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x2e44[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0x42e4('0x0'));var util=require('util');var moment=require(_0x42e4('0x1'));var BPromise=require(_0x42e4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x42e4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x42e4('0x4'));var logger=require(_0x42e4('0x5'))(_0x42e4('0x6'));var config=require(_0x42e4('0x7'));var jayson=require(_0x42e4('0x8'));var client=jayson[_0x42e4('0x9')][_0x42e4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ae979,_0x5681ea,_0x5eca3d){return new BPromise(function(_0x5e6806,_0x18466f){return client[_0x42e4('0xb')](_0x3ae979,_0x5eca3d)['then'](function(_0x323c5b){logger[_0x42e4('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5681ea,_0x42e4('0xd'));logger[_0x42e4('0xe')](_0x42e4('0xf'),_0x5681ea,_0x42e4('0xd'),JSON[_0x42e4('0x10')](_0x323c5b));if(_0x323c5b[_0x42e4('0x11')]){if(_0x323c5b[_0x42e4('0x11')][_0x42e4('0x12')]===0x1f4){logger[_0x42e4('0x11')](_0x42e4('0x13'),_0x5681ea,_0x323c5b[_0x42e4('0x11')]['message']);return _0x18466f(_0x323c5b['error']['message']);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x5681ea,_0x323c5b[_0x42e4('0x11')][_0x42e4('0x14')]);return _0x5e6806(_0x323c5b[_0x42e4('0x11')][_0x42e4('0x14')]);}else{logger[_0x42e4('0xc')](_0x42e4('0x13'),_0x5681ea,_0x42e4('0xd'));_0x5e6806(_0x323c5b[_0x42e4('0x15')][_0x42e4('0x14')]);}})['catch'](function(_0x34d05e){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x5681ea,_0x34d05e);_0x18466f(_0x34d05e);});});} \ No newline at end of file +var _0x731d=['code','message','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x1b1b83,_0x6cb08d){var _0x5a9cb9=function(_0xd639a1){while(--_0xd639a1){_0x1b1b83['push'](_0x1b1b83['shift']());}};_0x5a9cb9(++_0x6cb08d);}(_0x731d,0x107));var _0xd731=function(_0x3bf849,_0x4a2ffd){_0x3bf849=_0x3bf849-0x0;var _0x43ae41=_0x731d[_0x3bf849];return _0x43ae41;};'use strict';var _=require(_0xd731('0x0'));var util=require(_0xd731('0x1'));var moment=require(_0xd731('0x2'));var BPromise=require(_0xd731('0x3'));var rs=require(_0xd731('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd731('0x5'));var logger=require(_0xd731('0x6'))(_0xd731('0x7'));var config=require(_0xd731('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd731('0x9')][_0xd731('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44c9a7,_0x213a59,_0x166ac8){return new BPromise(function(_0x12df65,_0x315e9b){return client['request'](_0x44c9a7,_0x166ac8)[_0xd731('0xb')](function(_0x2689a2){logger['info'](_0xd731('0xc'),_0x213a59,_0xd731('0xd'));logger[_0xd731('0xe')](_0xd731('0xf'),_0x213a59,_0xd731('0xd'),JSON['stringify'](_0x2689a2));if(_0x2689a2[_0xd731('0x10')]){if(_0x2689a2[_0xd731('0x10')][_0xd731('0x11')]===0x1f4){logger[_0xd731('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x213a59,_0x2689a2['error'][_0xd731('0x12')]);return _0x315e9b(_0x2689a2[_0xd731('0x10')]['message']);}logger[_0xd731('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x213a59,_0x2689a2[_0xd731('0x10')][_0xd731('0x12')]);return _0x12df65(_0x2689a2[_0xd731('0x10')][_0xd731('0x12')]);}else{logger['info'](_0xd731('0xc'),_0x213a59,'request\x20sent');_0x12df65(_0x2689a2['result'][_0xd731('0x12')]);}})[_0xd731('0x13')](function(_0x4de920){logger['error'](_0xd731('0xc'),_0x213a59,_0x4de920);_0x315e9b(_0x4de920);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 501f389..94078bf 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 _0x4e60=['index','/:id','show','/:id/download','download','post','create','put','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x4e60,0x1ea));var _0x04e6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4e60[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x04e6('0x0'));var util=require(_0x04e6('0x1'));var path=require(_0x04e6('0x2'));var timeout=require(_0x04e6('0x3'));var express=require(_0x04e6('0x4'));var router=express['Router']();var auth=require(_0x04e6('0x5'));var interaction=require(_0x04e6('0x6'));var config=require('../../config/environment');var controller=require(_0x04e6('0x7'));router[_0x04e6('0x8')]('/',auth[_0x04e6('0x9')](),controller[_0x04e6('0xa')]);router[_0x04e6('0x8')](_0x04e6('0xb'),auth[_0x04e6('0x9')](),controller[_0x04e6('0xc')]);router['get'](_0x04e6('0xd'),auth[_0x04e6('0x9')](),controller[_0x04e6('0xe')]);router[_0x04e6('0xf')]('/',auth[_0x04e6('0x9')](),controller[_0x04e6('0x10')]);router[_0x04e6('0x11')]('/:id',auth[_0x04e6('0x9')](),controller[_0x04e6('0x12')]);router['delete']('/:id',auth[_0x04e6('0x9')](),controller['destroy']);module[_0x04e6('0x13')]=router; \ No newline at end of file +var _0x11ed=['delete','destroy','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/download','download','post','create','put','/:id','update'];(function(_0xefef6f,_0x5f9f66){var _0x454173=function(_0x42e3d1){while(--_0x42e3d1){_0xefef6f['push'](_0xefef6f['shift']());}};_0x454173(++_0x5f9f66);}(_0x11ed,0x9a));var _0xd11e=function(_0x4d29e2,_0x368b24){_0x4d29e2=_0x4d29e2-0x0;var _0x2694b0=_0x11ed[_0x4d29e2];return _0x2694b0;};'use strict';var multer=require('multer');var util=require(_0xd11e('0x0'));var path=require('path');var timeout=require(_0xd11e('0x1'));var express=require('express');var router=express[_0xd11e('0x2')]();var auth=require(_0xd11e('0x3'));var interaction=require(_0xd11e('0x4'));var config=require(_0xd11e('0x5'));var controller=require('./analyticExtractedReport.controller');router[_0xd11e('0x6')]('/',auth[_0xd11e('0x7')](),controller[_0xd11e('0x8')]);router[_0xd11e('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xd11e('0x9')]);router['get'](_0xd11e('0xa'),auth['isAuthenticated'](),controller[_0xd11e('0xb')]);router[_0xd11e('0xc')]('/',auth[_0xd11e('0x7')](),controller[_0xd11e('0xd')]);router[_0xd11e('0xe')](_0xd11e('0xf'),auth['isAuthenticated'](),controller[_0xd11e('0x10')]);router[_0xd11e('0x11')]('/:id',auth[_0xd11e('0x7')](),controller[_0xd11e('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index d6c774d..b6f81d4 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.attributes.js +++ b/server/api/analyticFieldReport/analyticFieldReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['sequelize','exports','STRING'];(function(_0x26f641,_0x1111f1){var _0x27462c=function(_0x35bdeb){while(--_0x35bdeb){_0x26f641['push'](_0x26f641['shift']());}};_0x27462c(++_0x1111f1);}(_0xe14b,0x93));var _0xbe14=function(_0x122fe6,_0x4ac758){_0x122fe6=_0x122fe6-0x0;var _0x36b7d2=_0xe14b[_0x122fe6];return _0x36b7d2;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xbe14('0x2')]},'format':{'type':Sequelize[_0xbe14('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xbe14('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xe14b=['sequelize','exports','STRING'];(function(_0x57d074,_0x444670){var _0x1aa706=function(_0x1005ec){while(--_0x1005ec){_0x57d074['push'](_0x57d074['shift']());}};_0x1aa706(++_0x444670);}(_0xe14b,0x93));var _0xbe14=function(_0x2ca9a9,_0x586119){_0x2ca9a9=_0x2ca9a9-0x0;var _0x587949=_0xe14b[_0x2ca9a9];return _0x587949;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xbe14('0x2')]},'format':{'type':Sequelize[_0xbe14('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xbe14('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 5ead312..b4a436f 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 _0xfb7e=['includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','bulkCreate','update','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','rimraf','zip-dir','request-promise','moment','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','error','stack','send','map','AnalyticFieldReport','rawAttributes','type','model','query','keys','filters','attributes','fields','length','order','sort','where','pick','filter','name','merge','options'];(function(_0x1da46b,_0x109ac4){var _0x3a94ef=function(_0x31a2b4){while(--_0x31a2b4){_0x1da46b['push'](_0x1da46b['shift']());}};_0x3a94ef(++_0x109ac4);}(_0xfb7e,0x145));var _0xefb7=function(_0x5efaa9,_0x1c12aa){_0x5efaa9=_0x5efaa9-0x0;var _0x50f6a3=_0xfb7e[_0x5efaa9];return _0x50f6a3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xefb7('0x0'));var zipdir=require(_0xefb7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xefb7('0x2'));var moment=require(_0xefb7('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xefb7('0x4'));var path=require(_0xefb7('0x5'));var sox=require(_0xefb7('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xefb7('0x7'));var squel=require(_0xefb7('0x8'));var crypto=require(_0xefb7('0x9'));var jsforce=require(_0xefb7('0xa'));var deskjs=require(_0xefb7('0xb'));var toCsv=require(_0xefb7('0xc'));var querystring=require(_0xefb7('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xefb7('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xefb7('0xf'))(_0xefb7('0x10'));var utils=require(_0xefb7('0x11'));var config=require(_0xefb7('0x12'));var db=require(_0xefb7('0x13'))['db'];function respondWithStatusCode(_0x5db428,_0x560f88){_0x560f88=_0x560f88||0xcc;return function(_0x16d481){if(_0x16d481){return _0x5db428[_0xefb7('0x14')](_0x560f88);}return _0x5db428[_0xefb7('0x15')](_0x560f88)[_0xefb7('0x16')]();};}function respondWithResult(_0x5508d8,_0x46d669){_0x46d669=_0x46d669||0xc8;return function(_0x3d3c33){if(_0x3d3c33){return _0x5508d8['status'](_0x46d669)[_0xefb7('0x17')](_0x3d3c33);}};}function respondWithFilteredResult(_0xe4766,_0x47f3ae){return function(_0x3c0a14){if(_0x3c0a14){var _0x11cea7=_0x3c0a14[_0xefb7('0x18')],_0x460d8d=_0x47f3ae[_0xefb7('0x19')],_0x593b89=_0x47f3ae[_0xefb7('0x19')]+_0x47f3ae[_0xefb7('0x1a')],_0x5eadc8;if(_0x593b89>=_0x11cea7){_0x593b89=_0x11cea7;_0x5eadc8=0xc8;}else{_0x5eadc8=0xce;}_0xe4766[_0xefb7('0x15')](_0x5eadc8);return _0xe4766[_0xefb7('0x1b')](_0xefb7('0x1c'),_0x460d8d+'-'+_0x593b89+'/'+_0x11cea7)['json'](_0x3c0a14);}return null;};}function patchUpdates(_0x209b26){return function(_0x3f1abf){try{jsonpatch[_0xefb7('0x1d')](_0x3f1abf,_0x209b26,!![]);}catch(_0x43c211){return BPromise['reject'](_0x43c211);}return _0x3f1abf[_0xefb7('0x1e')]();};}function saveUpdates(_0x92b3fd,_0x4cdaf6){return function(_0x4a960d){if(_0x4a960d){return _0x4a960d['update'](_0x92b3fd)[_0xefb7('0x1f')](function(_0x5b97f9){return _0x5b97f9;});}return null;};}function removeEntity(_0x2093f3,_0x3e93ae){return function(_0x52b020){if(_0x52b020){return _0x52b020[_0xefb7('0x20')]()[_0xefb7('0x1f')](function(){_0x2093f3[_0xefb7('0x15')](0xcc)[_0xefb7('0x16')]();});}};}function handleEntityNotFound(_0xd770ba,_0x31757b){return function(_0x449117){if(!_0x449117){_0xd770ba['sendStatus'](0x194);}return _0x449117;};}function handleError(_0x15837e,_0x5a955f){_0x5a955f=_0x5a955f||0x1f4;return function(_0x568bcb){logger[_0xefb7('0x21')](_0x568bcb[_0xefb7('0x22')]);if(_0x568bcb['name']){delete _0x568bcb['name'];}_0x15837e['status'](_0x5a955f)[_0xefb7('0x23')](_0x568bcb);};}exports['index']=function(_0x255f33,_0x3fda18){var _0x3c1929={},_0x10567c={},_0x253153={'count':0x0,'rows':[]};var _0x10721f=_[_0xefb7('0x24')](db[_0xefb7('0x25')][_0xefb7('0x26')],function(_0x34a42b){return{'name':_0x34a42b['fieldName'],'type':_0x34a42b[_0xefb7('0x27')]['key']};});_0x10567c[_0xefb7('0x28')]=_[_0xefb7('0x24')](_0x10721f,'name');_0x10567c[_0xefb7('0x29')]=_[_0xefb7('0x2a')](_0x255f33[_0xefb7('0x29')]);_0x10567c[_0xefb7('0x2b')]=_['intersection'](_0x10567c[_0xefb7('0x28')],_0x10567c[_0xefb7('0x29')]);_0x3c1929[_0xefb7('0x2c')]=_['intersection'](_0x10567c['model'],qs[_0xefb7('0x2d')](_0x255f33['query']['fields']));_0x3c1929['attributes']=_0x3c1929[_0xefb7('0x2c')][_0xefb7('0x2e')]?_0x3c1929['attributes']:_0x10567c['model'];if(!_0x255f33[_0xefb7('0x29')]['hasOwnProperty']('nolimit')){_0x3c1929[_0xefb7('0x1a')]=qs[_0xefb7('0x1a')](_0x255f33[_0xefb7('0x29')][_0xefb7('0x1a')]);_0x3c1929[_0xefb7('0x19')]=qs[_0xefb7('0x19')](_0x255f33[_0xefb7('0x29')][_0xefb7('0x19')]);}_0x3c1929[_0xefb7('0x2f')]=qs[_0xefb7('0x30')](_0x255f33[_0xefb7('0x29')][_0xefb7('0x30')]);_0x3c1929[_0xefb7('0x31')]=qs[_0xefb7('0x2b')](_[_0xefb7('0x32')](_0x255f33[_0xefb7('0x29')],_0x10567c[_0xefb7('0x2b')]),_0x10721f);if(_0x255f33[_0xefb7('0x29')][_0xefb7('0x33')]){_0x3c1929[_0xefb7('0x31')]=_['merge'](_0x3c1929['where'],{'$or':_[_0xefb7('0x24')](_0x10721f,function(_0x48e895){if(_0x48e895[_0xefb7('0x27')]!=='VIRTUAL'){var _0xe38ee3={};_0xe38ee3[_0x48e895[_0xefb7('0x34')]]={'$like':'%'+_0x255f33[_0xefb7('0x29')][_0xefb7('0x33')]+'%'};return _0xe38ee3;}})});}_0x3c1929=_[_0xefb7('0x35')]({},_0x3c1929,_0x255f33[_0xefb7('0x36')]);var _0x37a3d3={'where':_0x3c1929[_0xefb7('0x31')]};return db[_0xefb7('0x25')]['count'](_0x37a3d3)[_0xefb7('0x1f')](function(_0x129412){_0x253153[_0xefb7('0x18')]=_0x129412;if(_0x255f33[_0xefb7('0x29')][_0xefb7('0x37')]){_0x3c1929[_0xefb7('0x38')]=[{'all':!![]}];}return db[_0xefb7('0x25')][_0xefb7('0x39')](_0x3c1929);})[_0xefb7('0x1f')](function(_0x4fea44){_0x253153[_0xefb7('0x3a')]=_0x4fea44;return _0x253153;})[_0xefb7('0x1f')](respondWithFilteredResult(_0x3fda18,_0x3c1929))[_0xefb7('0x3b')](handleError(_0x3fda18,null));};exports[_0xefb7('0x3c')]=function(_0x1111f7,_0x2a6ef2){var _0xa18ad1={'raw':![],'where':{'id':_0x1111f7[_0xefb7('0x3d')]['id']}},_0x4a7f1a={};_0x4a7f1a[_0xefb7('0x28')]=_[_0xefb7('0x2a')](db[_0xefb7('0x25')][_0xefb7('0x26')]);_0x4a7f1a[_0xefb7('0x29')]=_[_0xefb7('0x2a')](_0x1111f7[_0xefb7('0x29')]);_0x4a7f1a[_0xefb7('0x2b')]=_[_0xefb7('0x3e')](_0x4a7f1a['model'],_0x4a7f1a['query']);_0xa18ad1[_0xefb7('0x2c')]=_[_0xefb7('0x3e')](_0x4a7f1a[_0xefb7('0x28')],qs[_0xefb7('0x2d')](_0x1111f7[_0xefb7('0x29')][_0xefb7('0x2d')]));_0xa18ad1['attributes']=_0xa18ad1[_0xefb7('0x2c')]['length']?_0xa18ad1[_0xefb7('0x2c')]:_0x4a7f1a[_0xefb7('0x28')];if(_0x1111f7[_0xefb7('0x29')][_0xefb7('0x37')]){_0xa18ad1[_0xefb7('0x38')]=[{'all':!![]}];}_0xa18ad1=_[_0xefb7('0x35')]({},_0xa18ad1,_0x1111f7[_0xefb7('0x36')]);return db['AnalyticFieldReport'][_0xefb7('0x3f')](_0xa18ad1)[_0xefb7('0x1f')](handleEntityNotFound(_0x2a6ef2,null))['then'](respondWithResult(_0x2a6ef2,null))[_0xefb7('0x3b')](handleError(_0x2a6ef2,null));};exports['create']=function(_0x1dfc71,_0xf1150e){return db[_0xefb7('0x25')][_0xefb7('0x40')](_0x1dfc71[_0xefb7('0x41')],{})['then'](respondWithResult(_0xf1150e,0xc9))[_0xefb7('0x3b')](handleError(_0xf1150e,null));};exports[_0xefb7('0x42')]=function(_0x15aef0,_0x3aabd1){return db[_0xefb7('0x25')][_0xefb7('0x42')](_0x15aef0[_0xefb7('0x41')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3aabd1,0xc9))[_0xefb7('0x3b')](handleError(_0x3aabd1,null));};exports[_0xefb7('0x43')]=function(_0x5b2dd9,_0x4c2b4f){if(_0x5b2dd9[_0xefb7('0x41')]['id']){delete _0x5b2dd9[_0xefb7('0x41')]['id'];}return db['AnalyticFieldReport'][_0xefb7('0x3f')]({'where':{'id':_0x5b2dd9[_0xefb7('0x3d')]['id']}})[_0xefb7('0x1f')](handleEntityNotFound(_0x4c2b4f,null))[_0xefb7('0x1f')](saveUpdates(_0x5b2dd9[_0xefb7('0x41')],null))[_0xefb7('0x1f')](respondWithResult(_0x4c2b4f,null))[_0xefb7('0x3b')](handleError(_0x4c2b4f,null));};exports[_0xefb7('0x20')]=function(_0x428041,_0x536601){return db['AnalyticFieldReport'][_0xefb7('0x3f')]({'where':{'id':_0x428041[_0xefb7('0x3d')]['id']}})['then'](handleEntityNotFound(_0x536601,null))[_0xefb7('0x1f')](removeEntity(_0x536601,null))[_0xefb7('0x3b')](handleError(_0x536601,null));};exports[_0xefb7('0x44')]=function(_0x90e582,_0x52eaa2){return db['AnalyticFieldReport'][_0xefb7('0x20')]({'where':{'id':_0x90e582[_0xefb7('0x29')][_0xefb7('0x45')]||[]},'raw':![],'individualHooks':!![]})[_0xefb7('0x1f')](respondWithResult(_0x52eaa2,0xcc))[_0xefb7('0x3b')](handleError(_0x52eaa2,null));};exports[_0xefb7('0x46')]=function(_0x221d3b,_0x1387df,_0x579033){return db[_0xefb7('0x47')][_0xefb7('0x48')]({'where':{'id':_0x221d3b['params']['id']}})[_0xefb7('0x1f')](handleEntityNotFound(_0x1387df,null))[_0xefb7('0x1f')](function(_0x52dbe2){if(_0x52dbe2){return db[_0xefb7('0x49')][_0xefb7('0x4a')](function(_0x386018){return db[_0xefb7('0x25')][_0xefb7('0x20')]({'where':{'CustomReportId':_0x221d3b['params']['id']},'transaction':_0x386018})[_0xefb7('0x1f')](function(_0x208cf1){var _0x175deb=_[_0xefb7('0x24')](_0x221d3b['body'],function(_0x3de1ac){delete _0x3de1ac['id'];_0x3de1ac[_0xefb7('0x4b')]=_0x221d3b[_0xefb7('0x3d')]['id'];return _0x3de1ac;});return db['AnalyticFieldReport'][_0xefb7('0x42')](_0x175deb,{'transaction':_0x386018});});})['then'](function(){return db['AnalyticFieldReport'][_0xefb7('0x39')]({'where':{'CustomReportId':_0x221d3b['params']['id']}});});}})['then'](respondWithResult(_0x1387df,null))[_0xefb7('0x3b')](handleError(_0x1387df,null));}; \ No newline at end of file +var _0x64fa=['nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','AnalyticFieldReport','findAll','rows','catch','keys','rawAttributes','intersection','find','create','body','bulkCreate','params','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty'];(function(_0x31c930,_0x5cb0d7){var _0x5760b4=function(_0x2faef7){while(--_0x2faef7){_0x31c930['push'](_0x31c930['shift']());}};_0x5760b4(++_0x5cb0d7);}(_0x64fa,0xbf));var _0xa64f=function(_0x1f4fe4,_0x79e52a){_0x1f4fe4=_0x1f4fe4-0x0;var _0x40b29e=_0x64fa[_0x1f4fe4];return _0x40b29e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa64f('0x0'));var jsonpatch=require(_0xa64f('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa64f('0x2'));var Mustache=require(_0xa64f('0x3'));var util=require(_0xa64f('0x4'));var path=require(_0xa64f('0x5'));var sox=require(_0xa64f('0x6'));var csv=require(_0xa64f('0x7'));var ejs=require(_0xa64f('0x8'));var fs=require('fs');var _=require(_0xa64f('0x9'));var squel=require(_0xa64f('0xa'));var crypto=require(_0xa64f('0xb'));var jsforce=require(_0xa64f('0xc'));var deskjs=require(_0xa64f('0xd'));var toCsv=require(_0xa64f('0x7'));var querystring=require(_0xa64f('0xe'));var Papa=require(_0xa64f('0xf'));var Redis=require(_0xa64f('0x10'));var authService=require(_0xa64f('0x11'));var qs=require(_0xa64f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa64f('0x13'));var logger=require(_0xa64f('0x14'))(_0xa64f('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b5ab8,_0x2172ab){_0x2172ab=_0x2172ab||0xcc;return function(_0xbd040){if(_0xbd040){return _0x5b5ab8['sendStatus'](_0x2172ab);}return _0x5b5ab8[_0xa64f('0x16')](_0x2172ab)[_0xa64f('0x17')]();};}function respondWithResult(_0x3c4f14,_0x434d16){_0x434d16=_0x434d16||0xc8;return function(_0x3c0713){if(_0x3c0713){return _0x3c4f14[_0xa64f('0x16')](_0x434d16)[_0xa64f('0x18')](_0x3c0713);}};}function respondWithFilteredResult(_0x3ba05e,_0x32e63d){return function(_0x1f458f){if(_0x1f458f){var _0x153e97=_0x1f458f[_0xa64f('0x19')],_0x3a8b63=_0x32e63d[_0xa64f('0x1a')],_0x1db9ec=_0x32e63d['offset']+_0x32e63d[_0xa64f('0x1b')],_0x1499bc;if(_0x1db9ec>=_0x153e97){_0x1db9ec=_0x153e97;_0x1499bc=0xc8;}else{_0x1499bc=0xce;}_0x3ba05e[_0xa64f('0x16')](_0x1499bc);return _0x3ba05e[_0xa64f('0x1c')](_0xa64f('0x1d'),_0x3a8b63+'-'+_0x1db9ec+'/'+_0x153e97)[_0xa64f('0x18')](_0x1f458f);}return null;};}function patchUpdates(_0x2a6a9c){return function(_0x556b6d){try{jsonpatch[_0xa64f('0x1e')](_0x556b6d,_0x2a6a9c,!![]);}catch(_0xe6f4ea){return BPromise[_0xa64f('0x1f')](_0xe6f4ea);}return _0x556b6d[_0xa64f('0x20')]();};}function saveUpdates(_0x1b778b,_0x42fb77){return function(_0x3aea0b){if(_0x3aea0b){return _0x3aea0b[_0xa64f('0x21')](_0x1b778b)[_0xa64f('0x22')](function(_0x89c32f){return _0x89c32f;});}return null;};}function removeEntity(_0x2f95c2,_0x34244a){return function(_0xf850d7){if(_0xf850d7){return _0xf850d7[_0xa64f('0x23')]()[_0xa64f('0x22')](function(){_0x2f95c2[_0xa64f('0x16')](0xcc)[_0xa64f('0x17')]();});}};}function handleEntityNotFound(_0x438215,_0x54c003){return function(_0x1c6c16){if(!_0x1c6c16){_0x438215[_0xa64f('0x24')](0x194);}return _0x1c6c16;};}function handleError(_0x3ae0c5,_0x57614f){_0x57614f=_0x57614f||0x1f4;return function(_0x48472f){logger[_0xa64f('0x25')](_0x48472f['stack']);if(_0x48472f['name']){delete _0x48472f[_0xa64f('0x26')];}_0x3ae0c5[_0xa64f('0x16')](_0x57614f)[_0xa64f('0x27')](_0x48472f);};}exports[_0xa64f('0x28')]=function(_0x3adddc,_0xa559af){var _0x58afbf={},_0x191ec9={},_0xcaa0c2={'count':0x0,'rows':[]};var _0x3d681f=_[_0xa64f('0x29')](db['AnalyticFieldReport']['rawAttributes'],function(_0x5899fb){return{'name':_0x5899fb[_0xa64f('0x2a')],'type':_0x5899fb[_0xa64f('0x2b')][_0xa64f('0x2c')]};});_0x191ec9[_0xa64f('0x2d')]=_['map'](_0x3d681f,_0xa64f('0x26'));_0x191ec9[_0xa64f('0x2e')]=_['keys'](_0x3adddc[_0xa64f('0x2e')]);_0x191ec9[_0xa64f('0x2f')]=_['intersection'](_0x191ec9[_0xa64f('0x2d')],_0x191ec9[_0xa64f('0x2e')]);_0x58afbf[_0xa64f('0x30')]=_['intersection'](_0x191ec9[_0xa64f('0x2d')],qs[_0xa64f('0x31')](_0x3adddc[_0xa64f('0x2e')][_0xa64f('0x31')]));_0x58afbf[_0xa64f('0x30')]=_0x58afbf[_0xa64f('0x30')][_0xa64f('0x32')]?_0x58afbf[_0xa64f('0x30')]:_0x191ec9[_0xa64f('0x2d')];if(!_0x3adddc[_0xa64f('0x2e')][_0xa64f('0x33')](_0xa64f('0x34'))){_0x58afbf[_0xa64f('0x1b')]=qs[_0xa64f('0x1b')](_0x3adddc[_0xa64f('0x2e')][_0xa64f('0x1b')]);_0x58afbf[_0xa64f('0x1a')]=qs[_0xa64f('0x1a')](_0x3adddc['query'][_0xa64f('0x1a')]);}_0x58afbf[_0xa64f('0x35')]=qs['sort'](_0x3adddc[_0xa64f('0x2e')][_0xa64f('0x36')]);_0x58afbf[_0xa64f('0x37')]=qs[_0xa64f('0x2f')](_['pick'](_0x3adddc[_0xa64f('0x2e')],_0x191ec9[_0xa64f('0x2f')]),_0x3d681f);if(_0x3adddc[_0xa64f('0x2e')][_0xa64f('0x38')]){_0x58afbf[_0xa64f('0x37')]=_[_0xa64f('0x39')](_0x58afbf[_0xa64f('0x37')],{'$or':_[_0xa64f('0x29')](_0x3d681f,function(_0x3b8e1b){if(_0x3b8e1b[_0xa64f('0x2b')]!==_0xa64f('0x3a')){var _0x4db454={};_0x4db454[_0x3b8e1b['name']]={'$like':'%'+_0x3adddc[_0xa64f('0x2e')][_0xa64f('0x38')]+'%'};return _0x4db454;}})});}_0x58afbf=_[_0xa64f('0x39')]({},_0x58afbf,_0x3adddc[_0xa64f('0x3b')]);var _0xca9feb={'where':_0x58afbf[_0xa64f('0x37')]};return db['AnalyticFieldReport'][_0xa64f('0x19')](_0xca9feb)['then'](function(_0x4e8412){_0xcaa0c2[_0xa64f('0x19')]=_0x4e8412;if(_0x3adddc[_0xa64f('0x2e')][_0xa64f('0x3c')]){_0x58afbf[_0xa64f('0x3d')]=[{'all':!![]}];}return db[_0xa64f('0x3e')][_0xa64f('0x3f')](_0x58afbf);})['then'](function(_0x29dca4){_0xcaa0c2[_0xa64f('0x40')]=_0x29dca4;return _0xcaa0c2;})['then'](respondWithFilteredResult(_0xa559af,_0x58afbf))[_0xa64f('0x41')](handleError(_0xa559af,null));};exports['show']=function(_0x30dd28,_0x2f015a){var _0x3c0b4b={'raw':![],'where':{'id':_0x30dd28['params']['id']}},_0x4f5492={};_0x4f5492[_0xa64f('0x2d')]=_[_0xa64f('0x42')](db[_0xa64f('0x3e')][_0xa64f('0x43')]);_0x4f5492[_0xa64f('0x2e')]=_[_0xa64f('0x42')](_0x30dd28[_0xa64f('0x2e')]);_0x4f5492[_0xa64f('0x2f')]=_[_0xa64f('0x44')](_0x4f5492[_0xa64f('0x2d')],_0x4f5492['query']);_0x3c0b4b[_0xa64f('0x30')]=_['intersection'](_0x4f5492[_0xa64f('0x2d')],qs[_0xa64f('0x31')](_0x30dd28[_0xa64f('0x2e')][_0xa64f('0x31')]));_0x3c0b4b[_0xa64f('0x30')]=_0x3c0b4b['attributes'][_0xa64f('0x32')]?_0x3c0b4b[_0xa64f('0x30')]:_0x4f5492['model'];if(_0x30dd28['query'][_0xa64f('0x3c')]){_0x3c0b4b[_0xa64f('0x3d')]=[{'all':!![]}];}_0x3c0b4b=_[_0xa64f('0x39')]({},_0x3c0b4b,_0x30dd28[_0xa64f('0x3b')]);return db[_0xa64f('0x3e')][_0xa64f('0x45')](_0x3c0b4b)[_0xa64f('0x22')](handleEntityNotFound(_0x2f015a,null))[_0xa64f('0x22')](respondWithResult(_0x2f015a,null))[_0xa64f('0x41')](handleError(_0x2f015a,null));};exports['create']=function(_0xbec2f4,_0x2eba80){return db[_0xa64f('0x3e')][_0xa64f('0x46')](_0xbec2f4[_0xa64f('0x47')],{})[_0xa64f('0x22')](respondWithResult(_0x2eba80,0xc9))[_0xa64f('0x41')](handleError(_0x2eba80,null));};exports[_0xa64f('0x48')]=function(_0xcfacef,_0x4671f3){return db['AnalyticFieldReport'][_0xa64f('0x48')](_0xcfacef[_0xa64f('0x47')],{'raw':![],'individualHooks':!![]})[_0xa64f('0x22')](respondWithResult(_0x4671f3,0xc9))[_0xa64f('0x41')](handleError(_0x4671f3,null));};exports[_0xa64f('0x21')]=function(_0x5d1fb2,_0xd93828){if(_0x5d1fb2[_0xa64f('0x47')]['id']){delete _0x5d1fb2[_0xa64f('0x47')]['id'];}return db[_0xa64f('0x3e')][_0xa64f('0x45')]({'where':{'id':_0x5d1fb2[_0xa64f('0x49')]['id']}})[_0xa64f('0x22')](handleEntityNotFound(_0xd93828,null))[_0xa64f('0x22')](saveUpdates(_0x5d1fb2[_0xa64f('0x47')],null))['then'](respondWithResult(_0xd93828,null))[_0xa64f('0x41')](handleError(_0xd93828,null));};exports['destroy']=function(_0x54b062,_0x3dbb2b){return db[_0xa64f('0x3e')][_0xa64f('0x45')]({'where':{'id':_0x54b062[_0xa64f('0x49')]['id']}})[_0xa64f('0x22')](handleEntityNotFound(_0x3dbb2b,null))['then'](removeEntity(_0x3dbb2b,null))[_0xa64f('0x41')](handleError(_0x3dbb2b,null));};exports[_0xa64f('0x4a')]=function(_0x593a1a,_0x485953){return db[_0xa64f('0x3e')][_0xa64f('0x23')]({'where':{'id':_0x593a1a['query'][_0xa64f('0x4b')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x485953,0xcc))[_0xa64f('0x41')](handleError(_0x485953,null));};exports[_0xa64f('0x4c')]=function(_0x4eab58,_0x27ec92,_0x54842c){return db[_0xa64f('0x4d')]['findOne']({'where':{'id':_0x4eab58[_0xa64f('0x49')]['id']}})['then'](handleEntityNotFound(_0x27ec92,null))[_0xa64f('0x22')](function(_0x1f2428){if(_0x1f2428){return db[_0xa64f('0x4e')][_0xa64f('0x4f')](function(_0xb4f4e4){return db[_0xa64f('0x3e')]['destroy']({'where':{'CustomReportId':_0x4eab58['params']['id']},'transaction':_0xb4f4e4})['then'](function(_0x1b165d){var _0x5b0ac8=_[_0xa64f('0x29')](_0x4eab58[_0xa64f('0x47')],function(_0x1c2813){delete _0x1c2813['id'];_0x1c2813[_0xa64f('0x50')]=_0x4eab58[_0xa64f('0x49')]['id'];return _0x1c2813;});return db[_0xa64f('0x3e')]['bulkCreate'](_0x5b0ac8,{'transaction':_0xb4f4e4});});})[_0xa64f('0x22')](function(){return db[_0xa64f('0x3e')][_0xa64f('0x3f')]({'where':{'CustomReportId':_0x4eab58['params']['id']}});});}})[_0xa64f('0x22')](respondWithResult(_0x27ec92,null))[_0xa64f('0x41')](handleError(_0x27ec92,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index d19aad2..c2c21b4 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 _0x4250=['bluebird','path','exports','AnalyticFieldReport','analytics_report_fields','lodash','util','api','moment'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x4250,0x149));var _0x0425=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x4250[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0x0425('0x0'));var util=require(_0x0425('0x1'));var logger=require('../../config/logger')(_0x0425('0x2'));var moment=require(_0x0425('0x3'));var BPromise=require(_0x0425('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0425('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticFieldReport.attributes');module[_0x0425('0x6')]=function(_0x5651bb,_0x5518f3){return _0x5651bb['define'](_0x0425('0x7'),attributes,{'tableName':_0x0425('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4dbc=['./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','bluebird','path','../../config/environment'];(function(_0x4d3005,_0x18de04){var _0x3953c6=function(_0x3248e1){while(--_0x3248e1){_0x4d3005['push'](_0x4d3005['shift']());}};_0x3953c6(++_0x18de04);}(_0x4dbc,0x1de));var _0xc4db=function(_0x16dfa3,_0x118719){_0x16dfa3=_0x16dfa3-0x0;var _0x1209aa=_0x4dbc[_0x16dfa3];return _0x1209aa;};'use strict';var _=require(_0xc4db('0x0'));var util=require(_0xc4db('0x1'));var logger=require(_0xc4db('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc4db('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc4db('0x4'));var rimraf=require('rimraf');var config=require(_0xc4db('0x5'));var attributes=require(_0xc4db('0x6'));module[_0xc4db('0x7')]=function(_0x265503,_0x45a4ae){return _0x265503[_0xc4db('0x8')](_0xc4db('0x9'),attributes,{'tableName':_0xc4db('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 27567d3..c8820c6 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 _0x83c6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x83c6,0xbe));var _0x683c=function(_0x20efde,_0x46604a){_0x20efde=_0x20efde-0x0;var _0x30e88c=_0x83c6[_0x20efde];return _0x30e88c;};'use strict';var _=require(_0x683c('0x0'));var util=require('util');var moment=require(_0x683c('0x1'));var BPromise=require(_0x683c('0x2'));var rs=require(_0x683c('0x3'));var fs=require('fs');var Redis=require(_0x683c('0x4'));var db=require(_0x683c('0x5'))['db'];var utils=require(_0x683c('0x6'));var logger=require('../../config/logger')(_0x683c('0x7'));var config=require(_0x683c('0x8'));var jayson=require(_0x683c('0x9'));var client=jayson[_0x683c('0xa')][_0x683c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ae3c7,_0x57e2e1,_0x4cd98d){return new BPromise(function(_0x1beb29,_0x3e5691){return client[_0x683c('0xc')](_0x5ae3c7,_0x4cd98d)[_0x683c('0xd')](function(_0x3fe5d5){logger[_0x683c('0xe')](_0x683c('0xf'),_0x57e2e1,_0x683c('0x10'));logger[_0x683c('0x11')](_0x683c('0x12'),_0x57e2e1,_0x683c('0x10'),JSON['stringify'](_0x3fe5d5));if(_0x3fe5d5[_0x683c('0x13')]){if(_0x3fe5d5[_0x683c('0x13')][_0x683c('0x14')]===0x1f4){logger['error'](_0x683c('0xf'),_0x57e2e1,_0x3fe5d5[_0x683c('0x13')][_0x683c('0x15')]);return _0x3e5691(_0x3fe5d5[_0x683c('0x13')][_0x683c('0x15')]);}logger['error'](_0x683c('0xf'),_0x57e2e1,_0x3fe5d5[_0x683c('0x13')][_0x683c('0x15')]);return _0x1beb29(_0x3fe5d5[_0x683c('0x13')]['message']);}else{logger['info'](_0x683c('0xf'),_0x57e2e1,'request\x20sent');_0x1beb29(_0x3fe5d5[_0x683c('0x16')]['message']);}})[_0x683c('0x17')](function(_0x44d041){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x57e2e1,_0x44d041);_0x3e5691(_0x44d041);});});} \ No newline at end of file +var _0x078d=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','randomstring'];(function(_0x59f27d,_0x379815){var _0x3440a2=function(_0x386e41){while(--_0x386e41){_0x59f27d['push'](_0x59f27d['shift']());}};_0x3440a2(++_0x379815);}(_0x078d,0x10c));var _0xd078=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x078d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd078('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd078('0x1'));var fs=require('fs');var Redis=require(_0xd078('0x2'));var db=require(_0xd078('0x3'))['db'];var utils=require(_0xd078('0x4'));var logger=require('../../config/logger')(_0xd078('0x5'));var config=require(_0xd078('0x6'));var jayson=require(_0xd078('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5e5cd2,_0x3abd6b,_0xd357cd){return new BPromise(function(_0x321e42,_0x5aab8e){return client[_0xd078('0x8')](_0x5e5cd2,_0xd357cd)[_0xd078('0x9')](function(_0x2ae3d9){logger[_0xd078('0xa')](_0xd078('0xb'),_0x3abd6b,_0xd078('0xc'));logger[_0xd078('0xd')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x3abd6b,'request\x20sent',JSON[_0xd078('0xe')](_0x2ae3d9));if(_0x2ae3d9[_0xd078('0xf')]){if(_0x2ae3d9[_0xd078('0xf')][_0xd078('0x10')]===0x1f4){logger['error'](_0xd078('0xb'),_0x3abd6b,_0x2ae3d9[_0xd078('0xf')][_0xd078('0x11')]);return _0x5aab8e(_0x2ae3d9['error'][_0xd078('0x11')]);}logger[_0xd078('0xf')](_0xd078('0xb'),_0x3abd6b,_0x2ae3d9[_0xd078('0xf')][_0xd078('0x11')]);return _0x321e42(_0x2ae3d9[_0xd078('0xf')]['message']);}else{logger['info'](_0xd078('0xb'),_0x3abd6b,'request\x20sent');_0x321e42(_0x2ae3d9['result'][_0xd078('0x11')]);}})['catch'](function(_0x10a4c0){logger[_0xd078('0xf')](_0xd078('0xb'),_0x3abd6b,_0x10a4c0);_0x5aab8e(_0x10a4c0);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 7010a95..1051d8b 100644 --- a/server/api/analyticFieldReport/index.js +++ b/server/api/analyticFieldReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['./analyticFieldReport.controller','get','isAuthenticated','index','show','post','create','/create_many','/:id/create_many','addFields','/:id','delete','/destroy_many','bulkDestroy','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service'];(function(_0x38b0bd,_0x4519a2){var _0xa6e47e=function(_0x10a4c3){while(--_0x10a4c3){_0x38b0bd['push'](_0x38b0bd['shift']());}};_0xa6e47e(++_0x4519a2);}(_0x3e74,0x175));var _0x43e7=function(_0x2aec86,_0x529118){_0x2aec86=_0x2aec86-0x0;var _0x35d938=_0x3e74[_0x2aec86];return _0x35d938;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0xa')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0xb')]);router['post'](_0x43e7('0xc'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0x43e7('0xa')](_0x43e7('0xd'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router['put'](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller['update']);router[_0x43e7('0x10')](_0x43e7('0x11'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x12')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x13')]);module[_0x43e7('0x14')]=router; \ No newline at end of file +var _0x7217=['put','update','delete','bulkDestroy','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','show','post','create','/create_many','bulkCreate','/:id/create_many','addFields'];(function(_0x1cb17c,_0x1df764){var _0x262a30=function(_0x420970){while(--_0x420970){_0x1cb17c['push'](_0x1cb17c['shift']());}};_0x262a30(++_0x1df764);}(_0x7217,0x19e));var _0x7721=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x7217[_0x3ce3c];return _0x55a2c9;};'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('0xc')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0xc')](_0x7721('0xe'),auth[_0x7721('0x8')](),controller[_0x7721('0xf')]);router['post'](_0x7721('0x10'),auth[_0x7721('0x8')](),controller[_0x7721('0x11')]);router[_0x7721('0x12')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x13')]);router[_0x7721('0x14')]('/destroy_many',auth[_0x7721('0x8')](),controller[_0x7721('0x15')]);router['delete'](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index cb318ab..7848d8a 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 _0x6e1c=['STRING','TEXT','sequelize','name'];(function(_0x2981f2,_0x419adb){var _0x42c24d=function(_0x36571f){while(--_0x36571f){_0x2981f2['push'](_0x2981f2['shift']());}};_0x42c24d(++_0x419adb);}(_0x6e1c,0xb6));var _0xc6e1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6e1c[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xc6e1('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc6e1('0x1')},'table':{'type':Sequelize[_0xc6e1('0x2')]},'metric':{'type':Sequelize[_0xc6e1('0x3')]},'description':{'type':Sequelize[_0xc6e1('0x2')]}}; \ No newline at end of file +var _0x4a2e=['TEXT','sequelize','exports','STRING'];(function(_0x6b942a,_0x311643){var _0x22129d=function(_0x5a1a52){while(--_0x5a1a52){_0x6b942a['push'](_0x6b942a['shift']());}};_0x22129d(++_0x311643);}(_0x4a2e,0x125));var _0xe4a2=function(_0x1937c8,_0x5a1f28){_0x1937c8=_0x1937c8-0x0;var _0x48bedf=_0x4a2e[_0x1937c8];return _0x48bedf;};'use strict';var Sequelize=require(_0xe4a2('0x0'));module[_0xe4a2('0x1')]={'name':{'type':Sequelize[_0xe4a2('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xe4a2('0x2')]},'metric':{'type':Sequelize[_0xe4a2('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 3624767..9e88f23 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 _0x0833=['json','count','Content-Range','apply','reject','save','update','then','get','Metrics','UserProfileResource','destroy','end','error','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','filter','merge','options','include','findAll','rows','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x278f0a,_0x35bf1d){var _0x8c96de=function(_0x4f8cc4){while(--_0x4f8cc4){_0x278f0a['push'](_0x278f0a['shift']());}};_0x8c96de(++_0x35bf1d);}(_0x0833,0x1bd));var _0x3083=function(_0x267ed0,_0x555d95){_0x267ed0=_0x267ed0-0x0;var _0x3f0eba=_0x0833[_0x267ed0];return _0x3f0eba;};'use strict';var pdf=require(_0x3083('0x0'));var emlformat=require(_0x3083('0x1'));var rimraf=require(_0x3083('0x2'));var zipdir=require(_0x3083('0x3'));var jsonpatch=require(_0x3083('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3083('0x5'));var util=require('util');var path=require(_0x3083('0x6'));var sox=require(_0x3083('0x7'));var csv=require(_0x3083('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3083('0x9'));var squel=require(_0x3083('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3083('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3083('0xb'));var authService=require(_0x3083('0xc'));var qs=require(_0x3083('0xd'));var as=require(_0x3083('0xe'));var hardwareService=require(_0x3083('0xf'));var logger=require(_0x3083('0x10'))(_0x3083('0x11'));var utils=require(_0x3083('0x12'));var config=require(_0x3083('0x13'));var db=require(_0x3083('0x14'))['db'];function respondWithStatusCode(_0x3a2460,_0x4960f9){_0x4960f9=_0x4960f9||0xcc;return function(_0x126765){if(_0x126765){return _0x3a2460[_0x3083('0x15')](_0x4960f9);}return _0x3a2460[_0x3083('0x16')](_0x4960f9)['end']();};}function respondWithResult(_0x2fe399,_0x2a8cd0){_0x2a8cd0=_0x2a8cd0||0xc8;return function(_0x5f39e3){if(_0x5f39e3){return _0x2fe399[_0x3083('0x16')](_0x2a8cd0)[_0x3083('0x17')](_0x5f39e3);}};}function respondWithFilteredResult(_0x507441,_0x293ca0){return function(_0x20cc31){if(_0x20cc31){var _0x1b6955=_0x20cc31[_0x3083('0x18')],_0x143cac=_0x293ca0['offset'],_0x3f1f08=_0x293ca0['offset']+_0x293ca0['limit'],_0x1de928;if(_0x3f1f08>=_0x1b6955){_0x3f1f08=_0x1b6955;_0x1de928=0xc8;}else{_0x1de928=0xce;}_0x507441[_0x3083('0x16')](_0x1de928);return _0x507441['set'](_0x3083('0x19'),_0x143cac+'-'+_0x3f1f08+'/'+_0x1b6955)[_0x3083('0x17')](_0x20cc31);}return null;};}function patchUpdates(_0x419c95){return function(_0x3b61db){try{jsonpatch[_0x3083('0x1a')](_0x3b61db,_0x419c95,!![]);}catch(_0x43d42a){return BPromise[_0x3083('0x1b')](_0x43d42a);}return _0x3b61db[_0x3083('0x1c')]();};}function saveUpdates(_0x3c3da6,_0x164988){return function(_0x3d9d42){if(_0x3d9d42){return _0x3d9d42[_0x3083('0x1d')](_0x3c3da6)[_0x3083('0x1e')](function(_0x1a6035){return _0x1a6035;});}return null;};}function removeEntity(_0x51afc7,_0x4c2a0b){return function(_0x4dc9ad){if(_0x4dc9ad){return _0x4dc9ad['destroy']()[_0x3083('0x1e')](function(){var _0x8225f7=_0x4dc9ad[_0x3083('0x1f')]({'plain':!![]});var _0x3187f3=_0x3083('0x20');return db[_0x3083('0x21')][_0x3083('0x22')]({'where':{'type':_0x3187f3,'resourceId':_0x8225f7['id']}})[_0x3083('0x1e')](function(){return _0x4dc9ad;});})[_0x3083('0x1e')](function(){_0x51afc7['status'](0xcc)[_0x3083('0x23')]();});}};}function handleEntityNotFound(_0x52b77c,_0x5de58e){return function(_0x1bea50){if(!_0x1bea50){_0x52b77c[_0x3083('0x15')](0x194);}return _0x1bea50;};}function handleError(_0x2afe80,_0x2efe93){_0x2efe93=_0x2efe93||0x1f4;return function(_0x484c07){logger[_0x3083('0x24')](_0x484c07['stack']);if(_0x484c07[_0x3083('0x25')]){delete _0x484c07[_0x3083('0x25')];}_0x2afe80[_0x3083('0x16')](_0x2efe93)[_0x3083('0x26')](_0x484c07);};}exports['index']=function(_0x3055d2,_0x55a515){var _0x5d9c98={},_0x1677de={},_0x233a81={'count':0x0,'rows':[]};var _0x2e3158=_['map'](db[_0x3083('0x27')][_0x3083('0x28')],function(_0x153aac){return{'name':_0x153aac[_0x3083('0x29')],'type':_0x153aac[_0x3083('0x2a')][_0x3083('0x2b')]};});_0x1677de[_0x3083('0x2c')]=_[_0x3083('0x2d')](_0x2e3158,_0x3083('0x25'));_0x1677de[_0x3083('0x2e')]=_[_0x3083('0x2f')](_0x3055d2[_0x3083('0x2e')]);_0x1677de[_0x3083('0x30')]=_[_0x3083('0x31')](_0x1677de[_0x3083('0x2c')],_0x1677de[_0x3083('0x2e')]);_0x5d9c98[_0x3083('0x32')]=_[_0x3083('0x31')](_0x1677de[_0x3083('0x2c')],qs[_0x3083('0x33')](_0x3055d2['query'][_0x3083('0x33')]));_0x5d9c98[_0x3083('0x32')]=_0x5d9c98['attributes'][_0x3083('0x34')]?_0x5d9c98[_0x3083('0x32')]:_0x1677de['model'];if(!_0x3055d2['query'][_0x3083('0x35')](_0x3083('0x36'))){_0x5d9c98[_0x3083('0x37')]=qs[_0x3083('0x37')](_0x3055d2['query']['limit']);_0x5d9c98[_0x3083('0x38')]=qs[_0x3083('0x38')](_0x3055d2[_0x3083('0x2e')]['offset']);}_0x5d9c98[_0x3083('0x39')]=qs[_0x3083('0x3a')](_0x3055d2[_0x3083('0x2e')][_0x3083('0x3a')]);_0x5d9c98[_0x3083('0x3b')]=qs['filters'](_['pick'](_0x3055d2[_0x3083('0x2e')],_0x1677de['filters']),_0x2e3158);if(_0x3055d2[_0x3083('0x2e')][_0x3083('0x3c')]){_0x5d9c98[_0x3083('0x3b')]=_[_0x3083('0x3d')](_0x5d9c98['where'],{'$or':_[_0x3083('0x2d')](_0x2e3158,function(_0xfce3a9){if(_0xfce3a9[_0x3083('0x2a')]!=='VIRTUAL'){var _0xc887f6={};_0xc887f6[_0xfce3a9['name']]={'$like':'%'+_0x3055d2[_0x3083('0x2e')][_0x3083('0x3c')]+'%'};return _0xc887f6;}})});}_0x5d9c98=_[_0x3083('0x3d')]({},_0x5d9c98,_0x3055d2[_0x3083('0x3e')]);var _0x489292={'where':_0x5d9c98[_0x3083('0x3b')]};return db['AnalyticMetric'][_0x3083('0x18')](_0x489292)[_0x3083('0x1e')](function(_0x166162){_0x233a81[_0x3083('0x18')]=_0x166162;if(_0x3055d2[_0x3083('0x2e')]['includeAll']){_0x5d9c98[_0x3083('0x3f')]=[{'all':!![]}];}return db[_0x3083('0x27')][_0x3083('0x40')](_0x5d9c98);})[_0x3083('0x1e')](function(_0x180333){_0x233a81[_0x3083('0x41')]=_0x180333;return _0x233a81;})[_0x3083('0x1e')](respondWithFilteredResult(_0x55a515,_0x5d9c98))[_0x3083('0x42')](handleError(_0x55a515,null));};exports[_0x3083('0x43')]=function(_0x2570b7,_0x49b0b8){var _0x406d89={'raw':!![],'where':{'id':_0x2570b7['params']['id']}},_0x505091={};_0x505091[_0x3083('0x2c')]=_[_0x3083('0x2f')](db[_0x3083('0x27')]['rawAttributes']);_0x505091[_0x3083('0x2e')]=_[_0x3083('0x2f')](_0x2570b7[_0x3083('0x2e')]);_0x505091['filters']=_[_0x3083('0x31')](_0x505091['model'],_0x505091[_0x3083('0x2e')]);_0x406d89['attributes']=_[_0x3083('0x31')](_0x505091['model'],qs['fields'](_0x2570b7['query']['fields']));_0x406d89[_0x3083('0x32')]=_0x406d89[_0x3083('0x32')][_0x3083('0x34')]?_0x406d89[_0x3083('0x32')]:_0x505091[_0x3083('0x2c')];if(_0x2570b7[_0x3083('0x2e')][_0x3083('0x44')]){_0x406d89[_0x3083('0x3f')]=[{'all':!![]}];}_0x406d89=_[_0x3083('0x3d')]({},_0x406d89,_0x2570b7[_0x3083('0x3e')]);return db['AnalyticMetric'][_0x3083('0x45')](_0x406d89)[_0x3083('0x1e')](handleEntityNotFound(_0x49b0b8,null))[_0x3083('0x1e')](respondWithResult(_0x49b0b8,null))[_0x3083('0x42')](handleError(_0x49b0b8,null));};exports['create']=function(_0x3dd19c,_0xcd4679){return db[_0x3083('0x27')][_0x3083('0x46')](_0x3dd19c[_0x3083('0x47')],{})[_0x3083('0x1e')](function(_0x437150){var _0x5cf5cd=_0x3dd19c[_0x3083('0x48')][_0x3083('0x1f')]({'plain':!![]});if(!_0x5cf5cd)throw new Error(_0x3083('0x49'));if(_0x5cf5cd[_0x3083('0x4a')]===_0x3083('0x48')){var _0x340a86=_0x437150['get']({'plain':!![]});var _0x5ca6fa=_0x3083('0x20');return db['UserProfileSection'][_0x3083('0x45')]({'where':{'name':_0x5ca6fa,'userProfileId':_0x5cf5cd[_0x3083('0x4b')]},'raw':!![]})[_0x3083('0x1e')](function(_0x301409){if(_0x301409&&_0x301409[_0x3083('0x4c')]===0x0){return db[_0x3083('0x21')][_0x3083('0x46')]({'name':_0x340a86['name'],'resourceId':_0x340a86['id'],'type':_0x301409[_0x3083('0x25')],'sectionId':_0x301409['id']},{})[_0x3083('0x1e')](function(){return _0x437150;});}else{return _0x437150;}})[_0x3083('0x42')](function(_0x488943){logger[_0x3083('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x488943);throw _0x488943;});}return _0x437150;})[_0x3083('0x1e')](respondWithResult(_0xcd4679,0xc9))[_0x3083('0x42')](handleError(_0xcd4679,null));};exports['update']=function(_0x16802d,_0x2182ef){if(_0x16802d[_0x3083('0x47')]['id']){delete _0x16802d[_0x3083('0x47')]['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0x16802d[_0x3083('0x4d')]['id']}})[_0x3083('0x1e')](handleEntityNotFound(_0x2182ef,null))[_0x3083('0x1e')](saveUpdates(_0x16802d[_0x3083('0x47')],null))[_0x3083('0x1e')](respondWithResult(_0x2182ef,null))[_0x3083('0x42')](handleError(_0x2182ef,null));};exports[_0x3083('0x22')]=function(_0x4e21c4,_0x568ac9){return db[_0x3083('0x27')][_0x3083('0x45')]({'where':{'id':_0x4e21c4['params']['id']}})[_0x3083('0x1e')](handleEntityNotFound(_0x568ac9,null))[_0x3083('0x1e')](removeEntity(_0x568ac9,null))[_0x3083('0x42')](handleError(_0x568ac9,null));}; \ No newline at end of file +var _0xe2cf=['index','map','AnalyticMetric','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','filter','where','type','VIRTUAL','merge','options','count','includeAll','include','rows','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','set','Content-Range','apply','save','update','then','get','Metrics','UserProfileResource','sendStatus','error','name','send'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x1b4c44,_0x1149f5){_0x1b4c44=_0x1b4c44-0x0;var _0x28d604=_0xe2cf[_0x1b4c44];return _0x28d604;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfe2c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfe2c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe2c('0x2'));var moment=require(_0xfe2c('0x3'));var BPromise=require(_0xfe2c('0x4'));var Mustache=require(_0xfe2c('0x5'));var util=require('util');var path=require(_0xfe2c('0x6'));var sox=require(_0xfe2c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xfe2c('0x8'));var squel=require(_0xfe2c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfe2c('0xa'));var toCsv=require(_0xfe2c('0xb'));var querystring=require(_0xfe2c('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfe2c('0xd'));var qs=require(_0xfe2c('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe2c('0xf'));var logger=require(_0xfe2c('0x10'))(_0xfe2c('0x11'));var utils=require(_0xfe2c('0x12'));var config=require(_0xfe2c('0x13'));var db=require(_0xfe2c('0x14'))['db'];function respondWithStatusCode(_0x39ce22,_0x4af8b7){_0x4af8b7=_0x4af8b7||0xcc;return function(_0x5e7389){if(_0x5e7389){return _0x39ce22['sendStatus'](_0x4af8b7);}return _0x39ce22['status'](_0x4af8b7)[_0xfe2c('0x15')]();};}function respondWithResult(_0x54d2d4,_0x5a6ad5){_0x5a6ad5=_0x5a6ad5||0xc8;return function(_0x38ba2c){if(_0x38ba2c){return _0x54d2d4[_0xfe2c('0x16')](_0x5a6ad5)[_0xfe2c('0x17')](_0x38ba2c);}};}function respondWithFilteredResult(_0x12e4c4,_0x522692){return function(_0x5039cb){if(_0x5039cb){var _0x1a4684=_0x5039cb['count'],_0x3b3ebd=_0x522692[_0xfe2c('0x18')],_0x1dbed4=_0x522692[_0xfe2c('0x18')]+_0x522692[_0xfe2c('0x19')],_0x56cebc;if(_0x1dbed4>=_0x1a4684){_0x1dbed4=_0x1a4684;_0x56cebc=0xc8;}else{_0x56cebc=0xce;}_0x12e4c4[_0xfe2c('0x16')](_0x56cebc);return _0x12e4c4[_0xfe2c('0x1a')](_0xfe2c('0x1b'),_0x3b3ebd+'-'+_0x1dbed4+'/'+_0x1a4684)['json'](_0x5039cb);}return null;};}function patchUpdates(_0x22481a){return function(_0xa9b1dc){try{jsonpatch[_0xfe2c('0x1c')](_0xa9b1dc,_0x22481a,!![]);}catch(_0x51086d){return BPromise['reject'](_0x51086d);}return _0xa9b1dc[_0xfe2c('0x1d')]();};}function saveUpdates(_0x59bdeb,_0x4e9137){return function(_0x408f31){if(_0x408f31){return _0x408f31[_0xfe2c('0x1e')](_0x59bdeb)['then'](function(_0xc42d82){return _0xc42d82;});}return null;};}function removeEntity(_0x1e2519,_0x5e609f){return function(_0x1bd50e){if(_0x1bd50e){return _0x1bd50e['destroy']()[_0xfe2c('0x1f')](function(){var _0x466bcd=_0x1bd50e[_0xfe2c('0x20')]({'plain':!![]});var _0x298819=_0xfe2c('0x21');return db[_0xfe2c('0x22')]['destroy']({'where':{'type':_0x298819,'resourceId':_0x466bcd['id']}})[_0xfe2c('0x1f')](function(){return _0x1bd50e;});})[_0xfe2c('0x1f')](function(){_0x1e2519[_0xfe2c('0x16')](0xcc)[_0xfe2c('0x15')]();});}};}function handleEntityNotFound(_0x3486b5,_0x10afde){return function(_0x53bab0){if(!_0x53bab0){_0x3486b5[_0xfe2c('0x23')](0x194);}return _0x53bab0;};}function handleError(_0x5e8abf,_0x16daf3){_0x16daf3=_0x16daf3||0x1f4;return function(_0x2fcf5d){logger[_0xfe2c('0x24')](_0x2fcf5d['stack']);if(_0x2fcf5d[_0xfe2c('0x25')]){delete _0x2fcf5d[_0xfe2c('0x25')];}_0x5e8abf['status'](_0x16daf3)[_0xfe2c('0x26')](_0x2fcf5d);};}exports[_0xfe2c('0x27')]=function(_0x3352e8,_0x53a8c1){var _0x170026={},_0x1b7c91={},_0x55aed7={'count':0x0,'rows':[]};var _0x481219=_[_0xfe2c('0x28')](db[_0xfe2c('0x29')][_0xfe2c('0x2a')],function(_0xe940fe){return{'name':_0xe940fe[_0xfe2c('0x2b')],'type':_0xe940fe['type'][_0xfe2c('0x2c')]};});_0x1b7c91[_0xfe2c('0x2d')]=_[_0xfe2c('0x28')](_0x481219,_0xfe2c('0x25'));_0x1b7c91[_0xfe2c('0x2e')]=_[_0xfe2c('0x2f')](_0x3352e8[_0xfe2c('0x2e')]);_0x1b7c91[_0xfe2c('0x30')]=_[_0xfe2c('0x31')](_0x1b7c91[_0xfe2c('0x2d')],_0x1b7c91[_0xfe2c('0x2e')]);_0x170026[_0xfe2c('0x32')]=_['intersection'](_0x1b7c91[_0xfe2c('0x2d')],qs[_0xfe2c('0x33')](_0x3352e8[_0xfe2c('0x2e')]['fields']));_0x170026[_0xfe2c('0x32')]=_0x170026[_0xfe2c('0x32')]['length']?_0x170026[_0xfe2c('0x32')]:_0x1b7c91[_0xfe2c('0x2d')];if(!_0x3352e8[_0xfe2c('0x2e')]['hasOwnProperty'](_0xfe2c('0x34'))){_0x170026[_0xfe2c('0x19')]=qs[_0xfe2c('0x19')](_0x3352e8[_0xfe2c('0x2e')][_0xfe2c('0x19')]);_0x170026[_0xfe2c('0x18')]=qs[_0xfe2c('0x18')](_0x3352e8['query']['offset']);}_0x170026[_0xfe2c('0x35')]=qs[_0xfe2c('0x36')](_0x3352e8[_0xfe2c('0x2e')][_0xfe2c('0x36')]);_0x170026['where']=qs[_0xfe2c('0x30')](_['pick'](_0x3352e8[_0xfe2c('0x2e')],_0x1b7c91[_0xfe2c('0x30')]),_0x481219);if(_0x3352e8['query'][_0xfe2c('0x37')]){_0x170026['where']=_['merge'](_0x170026[_0xfe2c('0x38')],{'$or':_[_0xfe2c('0x28')](_0x481219,function(_0x2c1b43){if(_0x2c1b43[_0xfe2c('0x39')]!==_0xfe2c('0x3a')){var _0x38d2be={};_0x38d2be[_0x2c1b43[_0xfe2c('0x25')]]={'$like':'%'+_0x3352e8[_0xfe2c('0x2e')][_0xfe2c('0x37')]+'%'};return _0x38d2be;}})});}_0x170026=_[_0xfe2c('0x3b')]({},_0x170026,_0x3352e8[_0xfe2c('0x3c')]);var _0x4c86bc={'where':_0x170026[_0xfe2c('0x38')]};return db[_0xfe2c('0x29')][_0xfe2c('0x3d')](_0x4c86bc)['then'](function(_0x4c1e95){_0x55aed7['count']=_0x4c1e95;if(_0x3352e8[_0xfe2c('0x2e')][_0xfe2c('0x3e')]){_0x170026[_0xfe2c('0x3f')]=[{'all':!![]}];}return db[_0xfe2c('0x29')]['findAll'](_0x170026);})[_0xfe2c('0x1f')](function(_0x645585){_0x55aed7[_0xfe2c('0x40')]=_0x645585;return _0x55aed7;})[_0xfe2c('0x1f')](respondWithFilteredResult(_0x53a8c1,_0x170026))[_0xfe2c('0x41')](handleError(_0x53a8c1,null));};exports['show']=function(_0x5a8d4e,_0xeb04b9){var _0x6055dd={'raw':!![],'where':{'id':_0x5a8d4e['params']['id']}},_0x789810={};_0x789810['model']=_[_0xfe2c('0x2f')](db[_0xfe2c('0x29')]['rawAttributes']);_0x789810[_0xfe2c('0x2e')]=_[_0xfe2c('0x2f')](_0x5a8d4e[_0xfe2c('0x2e')]);_0x789810[_0xfe2c('0x30')]=_['intersection'](_0x789810[_0xfe2c('0x2d')],_0x789810[_0xfe2c('0x2e')]);_0x6055dd[_0xfe2c('0x32')]=_[_0xfe2c('0x31')](_0x789810[_0xfe2c('0x2d')],qs[_0xfe2c('0x33')](_0x5a8d4e[_0xfe2c('0x2e')][_0xfe2c('0x33')]));_0x6055dd['attributes']=_0x6055dd[_0xfe2c('0x32')]['length']?_0x6055dd[_0xfe2c('0x32')]:_0x789810[_0xfe2c('0x2d')];if(_0x5a8d4e[_0xfe2c('0x2e')][_0xfe2c('0x3e')]){_0x6055dd['include']=[{'all':!![]}];}_0x6055dd=_['merge']({},_0x6055dd,_0x5a8d4e['options']);return db['AnalyticMetric']['find'](_0x6055dd)[_0xfe2c('0x1f')](handleEntityNotFound(_0xeb04b9,null))['then'](respondWithResult(_0xeb04b9,null))['catch'](handleError(_0xeb04b9,null));};exports[_0xfe2c('0x42')]=function(_0x5d76be,_0x2c02d1){return db['AnalyticMetric'][_0xfe2c('0x42')](_0x5d76be[_0xfe2c('0x43')],{})[_0xfe2c('0x1f')](function(_0x39aed4){var _0x3cfda2=_0x5d76be['user'][_0xfe2c('0x20')]({'plain':!![]});if(!_0x3cfda2)throw new Error(_0xfe2c('0x44'));if(_0x3cfda2[_0xfe2c('0x45')]==='user'){var _0x150762=_0x39aed4[_0xfe2c('0x20')]({'plain':!![]});var _0x579b6b='Metrics';return db['UserProfileSection'][_0xfe2c('0x46')]({'where':{'name':_0x579b6b,'userProfileId':_0x3cfda2[_0xfe2c('0x47')]},'raw':!![]})[_0xfe2c('0x1f')](function(_0x2e0012){if(_0x2e0012&&_0x2e0012[_0xfe2c('0x48')]===0x0){return db['UserProfileResource'][_0xfe2c('0x42')]({'name':_0x150762[_0xfe2c('0x25')],'resourceId':_0x150762['id'],'type':_0x2e0012[_0xfe2c('0x25')],'sectionId':_0x2e0012['id']},{})['then'](function(){return _0x39aed4;});}else{return _0x39aed4;}})['catch'](function(_0x3e7c9f){logger[_0xfe2c('0x24')](_0xfe2c('0x49'),_0x3e7c9f);throw _0x3e7c9f;});}return _0x39aed4;})[_0xfe2c('0x1f')](respondWithResult(_0x2c02d1,0xc9))[_0xfe2c('0x41')](handleError(_0x2c02d1,null));};exports[_0xfe2c('0x1e')]=function(_0x218d64,_0x37e3de){if(_0x218d64[_0xfe2c('0x43')]['id']){delete _0x218d64[_0xfe2c('0x43')]['id'];}return db['AnalyticMetric'][_0xfe2c('0x46')]({'where':{'id':_0x218d64[_0xfe2c('0x4a')]['id']}})[_0xfe2c('0x1f')](handleEntityNotFound(_0x37e3de,null))[_0xfe2c('0x1f')](saveUpdates(_0x218d64[_0xfe2c('0x43')],null))[_0xfe2c('0x1f')](respondWithResult(_0x37e3de,null))[_0xfe2c('0x41')](handleError(_0x37e3de,null));};exports[_0xfe2c('0x4b')]=function(_0x3a4d70,_0xf54c02){return db[_0xfe2c('0x29')]['find']({'where':{'id':_0x3a4d70[_0xfe2c('0x4a')]['id']}})['then'](handleEntityNotFound(_0xf54c02,null))[_0xfe2c('0x1f')](removeEntity(_0xf54c02,null))['catch'](handleError(_0xf54c02,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index fb38766..75e9250 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 _0x44c8=['AnalyticMetric','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5d7227,_0x12aebe){var _0x15ac55=function(_0x58d13e){while(--_0x58d13e){_0x5d7227['push'](_0x5d7227['shift']());}};_0x15ac55(++_0x12aebe);}(_0x44c8,0x1c3));var _0x844c=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x44c8[_0x1b2ff7];return _0x31656a;};'use strict';var _=require(_0x844c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x844c('0x1'));var moment=require('moment');var BPromise=require(_0x844c('0x2'));var rp=require(_0x844c('0x3'));var fs=require('fs');var path=require(_0x844c('0x4'));var rimraf=require(_0x844c('0x5'));var config=require(_0x844c('0x6'));var attributes=require('./analyticMetric.attributes');module[_0x844c('0x7')]=function(_0x4fd1e1,_0x55ce36){return _0x4fd1e1['define'](_0x844c('0x8'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2ed=['./analyticMetric.attributes','exports','AnalyticMetric','analytics_metrics','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x4dfde3,_0x155a0e){var _0x365690=function(_0xff7628){while(--_0xff7628){_0x4dfde3['push'](_0x4dfde3['shift']());}};_0x365690(++_0x155a0e);}(_0xe2ed,0x1bc));var _0xde2e=function(_0x439129,_0x7815ca){_0x439129=_0x439129-0x0;var _0x4c98f8=_0xe2ed[_0x439129];return _0x4c98f8;};'use strict';var _=require(_0xde2e('0x0'));var util=require('util');var logger=require(_0xde2e('0x1'))(_0xde2e('0x2'));var moment=require(_0xde2e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xde2e('0x4'));var rimraf=require(_0xde2e('0x5'));var config=require(_0xde2e('0x6'));var attributes=require(_0xde2e('0x7'));module[_0xde2e('0x8')]=function(_0x56727e,_0x956a04){return _0x56727e['define'](_0xde2e('0x9'),attributes,{'tableName':_0xde2e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index faa13da..fc0a139 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 _0xe8da=['request\x20sent','error','code','message','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticMetric,\x20%s,\x20%s'];(function(_0x1c7d64,_0x113563){var _0x5c840d=function(_0x581e02){while(--_0x581e02){_0x1c7d64['push'](_0x1c7d64['shift']());}};_0x5c840d(++_0x113563);}(_0xe8da,0x1cf));var _0xae8d=function(_0x1cded5,_0xd66c1a){_0x1cded5=_0x1cded5-0x0;var _0xc6c883=_0xe8da[_0x1cded5];return _0xc6c883;};'use strict';var _=require('lodash');var util=require(_0xae8d('0x0'));var moment=require('moment');var BPromise=require(_0xae8d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae8d('0x2'))['db'];var utils=require(_0xae8d('0x3'));var logger=require(_0xae8d('0x4'))(_0xae8d('0x5'));var config=require(_0xae8d('0x6'));var jayson=require(_0xae8d('0x7'));var client=jayson[_0xae8d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c40ba,_0x15e67a,_0x5c5d64){return new BPromise(function(_0xe2f2a4,_0xf392bc){return client[_0xae8d('0x9')](_0x1c40ba,_0x5c5d64)[_0xae8d('0xa')](function(_0x483e4f){logger[_0xae8d('0xb')](_0xae8d('0xc'),_0x15e67a,_0xae8d('0xd'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x15e67a,_0xae8d('0xd'),JSON['stringify'](_0x483e4f));if(_0x483e4f['error']){if(_0x483e4f[_0xae8d('0xe')][_0xae8d('0xf')]===0x1f4){logger[_0xae8d('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x15e67a,_0x483e4f[_0xae8d('0xe')][_0xae8d('0x10')]);return _0xf392bc(_0x483e4f[_0xae8d('0xe')][_0xae8d('0x10')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x15e67a,_0x483e4f[_0xae8d('0xe')][_0xae8d('0x10')]);return _0xe2f2a4(_0x483e4f['error'][_0xae8d('0x10')]);}else{logger[_0xae8d('0xb')](_0xae8d('0xc'),_0x15e67a,'request\x20sent');_0xe2f2a4(_0x483e4f['result'][_0xae8d('0x10')]);}})['catch'](function(_0x501dfc){logger['error'](_0xae8d('0xc'),_0x15e67a,_0x501dfc);_0xf392bc(_0x501dfc);});});} \ No newline at end of file +var _0x61d3=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x61d3,0x78));var _0x361d=function(_0x3de79b,_0x554cc9){_0x3de79b=_0x3de79b-0x0;var _0x2dd0af=_0x61d3[_0x3de79b];return _0x2dd0af;};'use strict';var _=require('lodash');var util=require(_0x361d('0x0'));var moment=require('moment');var BPromise=require(_0x361d('0x1'));var rs=require(_0x361d('0x2'));var fs=require('fs');var Redis=require(_0x361d('0x3'));var db=require(_0x361d('0x4'))['db'];var utils=require(_0x361d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x361d('0x6'));var jayson=require(_0x361d('0x7'));var client=jayson[_0x361d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a4d49,_0x590762,_0x992bb0){return new BPromise(function(_0x495d9b,_0x4bd240){return client[_0x361d('0x9')](_0x3a4d49,_0x992bb0)[_0x361d('0xa')](function(_0x3e5160){logger[_0x361d('0xb')](_0x361d('0xc'),_0x590762,_0x361d('0xd'));logger['debug'](_0x361d('0xe'),_0x590762,_0x361d('0xd'),JSON['stringify'](_0x3e5160));if(_0x3e5160[_0x361d('0xf')]){if(_0x3e5160[_0x361d('0xf')][_0x361d('0x10')]===0x1f4){logger[_0x361d('0xf')](_0x361d('0xc'),_0x590762,_0x3e5160[_0x361d('0xf')]['message']);return _0x4bd240(_0x3e5160[_0x361d('0xf')]['message']);}logger['error'](_0x361d('0xc'),_0x590762,_0x3e5160[_0x361d('0xf')][_0x361d('0x11')]);return _0x495d9b(_0x3e5160['error'][_0x361d('0x11')]);}else{logger[_0x361d('0xb')](_0x361d('0xc'),_0x590762,_0x361d('0xd'));_0x495d9b(_0x3e5160[_0x361d('0x12')][_0x361d('0x11')]);}})[_0x361d('0x13')](function(_0x30e076){logger[_0x361d('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x590762,_0x30e076);_0x4bd240(_0x30e076);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 917e998..668afa9 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 _0x524e=['/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated'];(function(_0x555c0b,_0x2a5cae){var _0x7f508=function(_0x1b511b){while(--_0x1b511b){_0x555c0b['push'](_0x555c0b['shift']());}};_0x7f508(++_0x2a5cae);}(_0x524e,0x15e));var _0xe524=function(_0x266c68,_0x4118cd){_0x266c68=_0x266c68-0x0;var _0x70a491=_0x524e[_0x266c68];return _0x70a491;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var auth=require(_0xe524('0x4'));var interaction=require(_0xe524('0x5'));var config=require(_0xe524('0x6'));var controller=require(_0xe524('0x7'));router[_0xe524('0x8')]('/',auth[_0xe524('0x9')](),controller['index']);router[_0xe524('0x8')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller['show']);router[_0xe524('0xb')]('/',auth[_0xe524('0x9')](),controller[_0xe524('0xc')]);router[_0xe524('0xd')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller[_0xe524('0xe')]);router[_0xe524('0xf')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller[_0xe524('0x10')]);module[_0xe524('0x11')]=router; \ No newline at end of file +var _0x66fa=['index','get','/:id','isAuthenticated','show','put','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x66fa,0x117));var _0xa66f=function(_0x7d048e,_0x108b88){_0x7d048e=_0x7d048e-0x0;var _0xaf3960=_0x66fa[_0x7d048e];return _0xaf3960;};'use strict';var multer=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var path=require('path');var timeout=require(_0xa66f('0x2'));var express=require(_0xa66f('0x3'));var router=express[_0xa66f('0x4')]();var auth=require(_0xa66f('0x5'));var interaction=require(_0xa66f('0x6'));var config=require(_0xa66f('0x7'));var controller=require(_0xa66f('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa66f('0x9')]);router[_0xa66f('0xa')](_0xa66f('0xb'),auth[_0xa66f('0xc')](),controller[_0xa66f('0xd')]);router['post']('/',auth[_0xa66f('0xc')](),controller['create']);router[_0xa66f('0xe')]('/:id',auth[_0xa66f('0xc')](),controller['update']);router['delete']('/:id',auth[_0xa66f('0xc')](),controller[_0xa66f('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 1fdb15a..4fc1835 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 _0xcfc9=['sequelize'];(function(_0x1f507d,_0x2cb2e6){var _0x12c032=function(_0x11dbbe){while(--_0x11dbbe){_0x1f507d['push'](_0x1f507d['shift']());}};_0x12c032(++_0x2cb2e6);}(_0xcfc9,0x150));var _0x9cfc=function(_0x577233,_0x5956e4){_0x577233=_0x577233-0x0;var _0x628a94=_0xcfc9[_0x577233];return _0x628a94;};'use strict';var Sequelize=require(_0x9cfc('0x0'));module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x723b=['TEXT'];(function(_0x285f9b,_0xfcae6c){var _0x32dd58=function(_0x392920){while(--_0x392920){_0x285f9b['push'](_0x285f9b['shift']());}};_0x32dd58(++_0xfcae6c);}(_0x723b,0x124));var _0xb723=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x723b[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize[_0xb723('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index ceeda42..a88ed2a 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 _0x1cf2=['include','findAll','rows','params','keys','create','body','find','catch','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','end','error','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll'];(function(_0x4c548b,_0x14af65){var _0x1827fd=function(_0xfe5ac8){while(--_0xfe5ac8){_0x4c548b['push'](_0x4c548b['shift']());}};_0x1827fd(++_0x14af65);}(_0x1cf2,0x99));var _0x21cf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1cf2[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x21cf('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x21cf('0x1'));var zipdir=require(_0x21cf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x21cf('0x3'));var moment=require(_0x21cf('0x4'));var BPromise=require(_0x21cf('0x5'));var Mustache=require(_0x21cf('0x6'));var util=require(_0x21cf('0x7'));var path=require(_0x21cf('0x8'));var sox=require('sox');var csv=require(_0x21cf('0x9'));var ejs=require(_0x21cf('0xa'));var fs=require('fs');var _=require(_0x21cf('0xb'));var squel=require(_0x21cf('0xc'));var crypto=require('crypto');var jsforce=require(_0x21cf('0xd'));var deskjs=require(_0x21cf('0xe'));var toCsv=require(_0x21cf('0x9'));var querystring=require(_0x21cf('0xf'));var Papa=require(_0x21cf('0x10'));var Redis=require(_0x21cf('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x21cf('0x12'));var as=require(_0x21cf('0x13'));var hardwareService=require(_0x21cf('0x14'));var logger=require('../../config/logger')(_0x21cf('0x15'));var utils=require(_0x21cf('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f1b18,_0x1e2a6c){_0x1e2a6c=_0x1e2a6c||0xcc;return function(_0x37e303){if(_0x37e303){return _0x5f1b18[_0x21cf('0x17')](_0x1e2a6c);}return _0x5f1b18[_0x21cf('0x18')](_0x1e2a6c)['end']();};}function respondWithResult(_0x540db3,_0x3619ba){_0x3619ba=_0x3619ba||0xc8;return function(_0x312a6a){if(_0x312a6a){return _0x540db3[_0x21cf('0x18')](_0x3619ba)[_0x21cf('0x19')](_0x312a6a);}};}function respondWithFilteredResult(_0x4bcca7,_0x3b377f){return function(_0x340099){if(_0x340099){var _0x52cb3e=_0x340099[_0x21cf('0x1a')],_0x47ebf8=_0x3b377f[_0x21cf('0x1b')],_0x4aa833=_0x3b377f[_0x21cf('0x1b')]+_0x3b377f[_0x21cf('0x1c')],_0x977974;if(_0x4aa833>=_0x52cb3e){_0x4aa833=_0x52cb3e;_0x977974=0xc8;}else{_0x977974=0xce;}_0x4bcca7[_0x21cf('0x18')](_0x977974);return _0x4bcca7[_0x21cf('0x1d')](_0x21cf('0x1e'),_0x47ebf8+'-'+_0x4aa833+'/'+_0x52cb3e)[_0x21cf('0x19')](_0x340099);}return null;};}function patchUpdates(_0x2f2eb8){return function(_0x3ae755){try{jsonpatch['apply'](_0x3ae755,_0x2f2eb8,!![]);}catch(_0x4db71c){return BPromise[_0x21cf('0x1f')](_0x4db71c);}return _0x3ae755[_0x21cf('0x20')]();};}function saveUpdates(_0x296109,_0x54e528){return function(_0x5ce715){if(_0x5ce715){return _0x5ce715[_0x21cf('0x21')](_0x296109)['then'](function(_0x301f88){return _0x301f88;});}return null;};}function removeEntity(_0x2d5df9,_0x4d2b5c){return function(_0x13c2ed){if(_0x13c2ed){return _0x13c2ed[_0x21cf('0x22')]()[_0x21cf('0x23')](function(){_0x2d5df9[_0x21cf('0x18')](0xcc)[_0x21cf('0x24')]();});}};}function handleEntityNotFound(_0x5b8e88,_0xd8c55b){return function(_0x2baa37){if(!_0x2baa37){_0x5b8e88['sendStatus'](0x194);}return _0x2baa37;};}function handleError(_0x478395,_0x4caec5){_0x4caec5=_0x4caec5||0x1f4;return function(_0x336dbb){logger[_0x21cf('0x25')](_0x336dbb['stack']);if(_0x336dbb[_0x21cf('0x26')]){delete _0x336dbb['name'];}_0x478395[_0x21cf('0x18')](_0x4caec5)['send'](_0x336dbb);};}exports[_0x21cf('0x27')]=function(_0x1363df,_0xd5d1d1){var _0x207e96={},_0x5edd10={},_0x2c2e8f={'count':0x0,'rows':[]};var _0x4c8b58=_[_0x21cf('0x28')](db[_0x21cf('0x29')][_0x21cf('0x2a')],function(_0x3cf01b){return{'name':_0x3cf01b[_0x21cf('0x2b')],'type':_0x3cf01b['type'][_0x21cf('0x2c')]};});_0x5edd10[_0x21cf('0x2d')]=_[_0x21cf('0x28')](_0x4c8b58,_0x21cf('0x26'));_0x5edd10[_0x21cf('0x2e')]=_['keys'](_0x1363df[_0x21cf('0x2e')]);_0x5edd10['filters']=_[_0x21cf('0x2f')](_0x5edd10[_0x21cf('0x2d')],_0x5edd10[_0x21cf('0x2e')]);_0x207e96['attributes']=_[_0x21cf('0x2f')](_0x5edd10[_0x21cf('0x2d')],qs[_0x21cf('0x30')](_0x1363df[_0x21cf('0x2e')][_0x21cf('0x30')]));_0x207e96[_0x21cf('0x31')]=_0x207e96[_0x21cf('0x31')][_0x21cf('0x32')]?_0x207e96[_0x21cf('0x31')]:_0x5edd10[_0x21cf('0x2d')];if(!_0x1363df[_0x21cf('0x2e')][_0x21cf('0x33')](_0x21cf('0x34'))){_0x207e96[_0x21cf('0x1c')]=qs[_0x21cf('0x1c')](_0x1363df[_0x21cf('0x2e')][_0x21cf('0x1c')]);_0x207e96['offset']=qs[_0x21cf('0x1b')](_0x1363df[_0x21cf('0x2e')][_0x21cf('0x1b')]);}_0x207e96[_0x21cf('0x35')]=qs[_0x21cf('0x36')](_0x1363df[_0x21cf('0x2e')][_0x21cf('0x36')]);_0x207e96[_0x21cf('0x37')]=qs[_0x21cf('0x38')](_[_0x21cf('0x39')](_0x1363df[_0x21cf('0x2e')],_0x5edd10['filters']),_0x4c8b58);if(_0x1363df[_0x21cf('0x2e')][_0x21cf('0x3a')]){_0x207e96[_0x21cf('0x37')]=_[_0x21cf('0x3b')](_0x207e96[_0x21cf('0x37')],{'$or':_['map'](_0x4c8b58,function(_0x178dca){if(_0x178dca[_0x21cf('0x3c')]!=='VIRTUAL'){var _0x3b33bd={};_0x3b33bd[_0x178dca['name']]={'$like':'%'+_0x1363df[_0x21cf('0x2e')]['filter']+'%'};return _0x3b33bd;}})});}_0x207e96=_[_0x21cf('0x3b')]({},_0x207e96,_0x1363df[_0x21cf('0x3d')]);var _0x59c1cf={'where':_0x207e96[_0x21cf('0x37')]};return db[_0x21cf('0x29')][_0x21cf('0x1a')](_0x59c1cf)[_0x21cf('0x23')](function(_0x23f8ca){_0x2c2e8f[_0x21cf('0x1a')]=_0x23f8ca;if(_0x1363df[_0x21cf('0x2e')][_0x21cf('0x3e')]){_0x207e96[_0x21cf('0x3f')]=[{'all':!![]}];}return db[_0x21cf('0x29')][_0x21cf('0x40')](_0x207e96);})[_0x21cf('0x23')](function(_0x2e07d5){_0x2c2e8f[_0x21cf('0x41')]=_0x2e07d5;return _0x2c2e8f;})[_0x21cf('0x23')](respondWithFilteredResult(_0xd5d1d1,_0x207e96))['catch'](handleError(_0xd5d1d1,null));};exports['show']=function(_0x20a524,_0x144664){var _0x52318b={'raw':!![],'where':{'id':_0x20a524[_0x21cf('0x42')]['id']}},_0x2b2f17={};_0x2b2f17[_0x21cf('0x2d')]=_['keys'](db['AnalyticTreeReport'][_0x21cf('0x2a')]);_0x2b2f17['query']=_[_0x21cf('0x43')](_0x20a524[_0x21cf('0x2e')]);_0x2b2f17[_0x21cf('0x38')]=_['intersection'](_0x2b2f17[_0x21cf('0x2d')],_0x2b2f17[_0x21cf('0x2e')]);_0x52318b[_0x21cf('0x31')]=_['intersection'](_0x2b2f17['model'],qs[_0x21cf('0x30')](_0x20a524[_0x21cf('0x2e')][_0x21cf('0x30')]));_0x52318b[_0x21cf('0x31')]=_0x52318b[_0x21cf('0x31')][_0x21cf('0x32')]?_0x52318b['attributes']:_0x2b2f17[_0x21cf('0x2d')];if(_0x20a524[_0x21cf('0x2e')][_0x21cf('0x3e')]){_0x52318b[_0x21cf('0x3f')]=[{'all':!![]}];}_0x52318b=_[_0x21cf('0x3b')]({},_0x52318b,_0x20a524[_0x21cf('0x3d')]);return db[_0x21cf('0x29')]['find'](_0x52318b)[_0x21cf('0x23')](handleEntityNotFound(_0x144664,null))[_0x21cf('0x23')](respondWithResult(_0x144664,null))['catch'](handleError(_0x144664,null));};exports[_0x21cf('0x44')]=function(_0x538294,_0x23f368){return db[_0x21cf('0x29')][_0x21cf('0x44')](_0x538294['body'],{})[_0x21cf('0x23')](respondWithResult(_0x23f368,0xc9))['catch'](handleError(_0x23f368,null));};exports[_0x21cf('0x21')]=function(_0x80b469,_0x2659f3){if(_0x80b469['body']['id']){delete _0x80b469[_0x21cf('0x45')]['id'];}return db[_0x21cf('0x29')]['find']({'where':{'id':_0x80b469[_0x21cf('0x42')]['id']}})[_0x21cf('0x23')](handleEntityNotFound(_0x2659f3,null))[_0x21cf('0x23')](saveUpdates(_0x80b469['body'],null))[_0x21cf('0x23')](respondWithResult(_0x2659f3,null))['catch'](handleError(_0x2659f3,null));};exports[_0x21cf('0x22')]=function(_0x20a82c,_0x12dd68){return db['AnalyticTreeReport'][_0x21cf('0x46')]({'where':{'id':_0x20a82c[_0x21cf('0x42')]['id']}})['then'](handleEntityNotFound(_0x12dd68,null))[_0x21cf('0x23')](removeEntity(_0x12dd68,null))[_0x21cf('0x47')](handleError(_0x12dd68,null));}; \ No newline at end of file +var _0x9295=['fieldName','type','map','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filters','filter','merge','VIRTUAL','options','where','count','include','findAll','rows','catch','show','params','keys','length','includeAll','body','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','offset','set','Content-Range','json','apply','reject','save','then','destroy','end','error','stack','name','index','AnalyticTreeReport','rawAttributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9295,0x144));var _0x5929=function(_0x130883,_0x495666){_0x130883=_0x130883-0x0;var _0x154a3b=_0x9295[_0x130883];return _0x154a3b;};'use strict';var pdf=require(_0x5929('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5929('0x1'));var zipdir=require(_0x5929('0x2'));var jsonpatch=require(_0x5929('0x3'));var rp=require(_0x5929('0x4'));var moment=require(_0x5929('0x5'));var BPromise=require(_0x5929('0x6'));var Mustache=require(_0x5929('0x7'));var util=require(_0x5929('0x8'));var path=require('path');var sox=require(_0x5929('0x9'));var csv=require('to-csv');var ejs=require(_0x5929('0xa'));var fs=require('fs');var _=require(_0x5929('0xb'));var squel=require('squel');var crypto=require(_0x5929('0xc'));var jsforce=require(_0x5929('0xd'));var deskjs=require(_0x5929('0xe'));var toCsv=require(_0x5929('0xf'));var querystring=require('querystring');var Papa=require(_0x5929('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5929('0x11'));var as=require(_0x5929('0x12'));var hardwareService=require(_0x5929('0x13'));var logger=require('../../config/logger')(_0x5929('0x14'));var utils=require(_0x5929('0x15'));var config=require('../../config/environment');var db=require(_0x5929('0x16'))['db'];function respondWithStatusCode(_0x214c0a,_0x190647){_0x190647=_0x190647||0xcc;return function(_0x1ef6b0){if(_0x1ef6b0){return _0x214c0a[_0x5929('0x17')](_0x190647);}return _0x214c0a[_0x5929('0x18')](_0x190647)['end']();};}function respondWithResult(_0x23f236,_0x448fad){_0x448fad=_0x448fad||0xc8;return function(_0x5f3740){if(_0x5f3740){return _0x23f236[_0x5929('0x18')](_0x448fad)['json'](_0x5f3740);}};}function respondWithFilteredResult(_0x2e0808,_0x246c06){return function(_0x2d6c4e){if(_0x2d6c4e){var _0x394f29=_0x2d6c4e['count'],_0x27b868=_0x246c06[_0x5929('0x19')],_0x2627b2=_0x246c06['offset']+_0x246c06['limit'],_0x5bbd91;if(_0x2627b2>=_0x394f29){_0x2627b2=_0x394f29;_0x5bbd91=0xc8;}else{_0x5bbd91=0xce;}_0x2e0808[_0x5929('0x18')](_0x5bbd91);return _0x2e0808[_0x5929('0x1a')](_0x5929('0x1b'),_0x27b868+'-'+_0x2627b2+'/'+_0x394f29)[_0x5929('0x1c')](_0x2d6c4e);}return null;};}function patchUpdates(_0x4e53bc){return function(_0x47922c){try{jsonpatch[_0x5929('0x1d')](_0x47922c,_0x4e53bc,!![]);}catch(_0x772cb0){return BPromise[_0x5929('0x1e')](_0x772cb0);}return _0x47922c[_0x5929('0x1f')]();};}function saveUpdates(_0x11aa49,_0x17e06f){return function(_0x157564){if(_0x157564){return _0x157564['update'](_0x11aa49)[_0x5929('0x20')](function(_0x31249e){return _0x31249e;});}return null;};}function removeEntity(_0x46555e,_0x352a36){return function(_0x4b9261){if(_0x4b9261){return _0x4b9261[_0x5929('0x21')]()[_0x5929('0x20')](function(){_0x46555e[_0x5929('0x18')](0xcc)[_0x5929('0x22')]();});}};}function handleEntityNotFound(_0x184716,_0xa967c6){return function(_0x420056){if(!_0x420056){_0x184716['sendStatus'](0x194);}return _0x420056;};}function handleError(_0x2f2434,_0x48058e){_0x48058e=_0x48058e||0x1f4;return function(_0x9ce993){logger[_0x5929('0x23')](_0x9ce993[_0x5929('0x24')]);if(_0x9ce993[_0x5929('0x25')]){delete _0x9ce993['name'];}_0x2f2434[_0x5929('0x18')](_0x48058e)['send'](_0x9ce993);};}exports[_0x5929('0x26')]=function(_0x522eba,_0x3562a5){var _0xbd593={},_0x38e0a8={},_0x496e0e={'count':0x0,'rows':[]};var _0x2b36f1=_['map'](db[_0x5929('0x27')][_0x5929('0x28')],function(_0x44d9e8){return{'name':_0x44d9e8[_0x5929('0x29')],'type':_0x44d9e8[_0x5929('0x2a')]['key']};});_0x38e0a8['model']=_[_0x5929('0x2b')](_0x2b36f1,_0x5929('0x25'));_0x38e0a8[_0x5929('0x2c')]=_['keys'](_0x522eba[_0x5929('0x2c')]);_0x38e0a8['filters']=_[_0x5929('0x2d')](_0x38e0a8[_0x5929('0x2e')],_0x38e0a8[_0x5929('0x2c')]);_0xbd593['attributes']=_[_0x5929('0x2d')](_0x38e0a8[_0x5929('0x2e')],qs['fields'](_0x522eba[_0x5929('0x2c')][_0x5929('0x2f')]));_0xbd593[_0x5929('0x30')]=_0xbd593[_0x5929('0x30')]['length']?_0xbd593[_0x5929('0x30')]:_0x38e0a8[_0x5929('0x2e')];if(!_0x522eba[_0x5929('0x2c')][_0x5929('0x31')](_0x5929('0x32'))){_0xbd593[_0x5929('0x33')]=qs['limit'](_0x522eba['query'][_0x5929('0x33')]);_0xbd593[_0x5929('0x19')]=qs[_0x5929('0x19')](_0x522eba[_0x5929('0x2c')][_0x5929('0x19')]);}_0xbd593[_0x5929('0x34')]=qs[_0x5929('0x35')](_0x522eba[_0x5929('0x2c')][_0x5929('0x35')]);_0xbd593['where']=qs['filters'](_[_0x5929('0x36')](_0x522eba[_0x5929('0x2c')],_0x38e0a8[_0x5929('0x37')]),_0x2b36f1);if(_0x522eba['query'][_0x5929('0x38')]){_0xbd593['where']=_[_0x5929('0x39')](_0xbd593['where'],{'$or':_[_0x5929('0x2b')](_0x2b36f1,function(_0xd9e81c){if(_0xd9e81c[_0x5929('0x2a')]!==_0x5929('0x3a')){var _0x11306c={};_0x11306c[_0xd9e81c[_0x5929('0x25')]]={'$like':'%'+_0x522eba[_0x5929('0x2c')][_0x5929('0x38')]+'%'};return _0x11306c;}})});}_0xbd593=_[_0x5929('0x39')]({},_0xbd593,_0x522eba[_0x5929('0x3b')]);var _0x2c7dcb={'where':_0xbd593[_0x5929('0x3c')]};return db[_0x5929('0x27')][_0x5929('0x3d')](_0x2c7dcb)[_0x5929('0x20')](function(_0x30be16){_0x496e0e[_0x5929('0x3d')]=_0x30be16;if(_0x522eba['query']['includeAll']){_0xbd593[_0x5929('0x3e')]=[{'all':!![]}];}return db[_0x5929('0x27')][_0x5929('0x3f')](_0xbd593);})[_0x5929('0x20')](function(_0x400efd){_0x496e0e[_0x5929('0x40')]=_0x400efd;return _0x496e0e;})[_0x5929('0x20')](respondWithFilteredResult(_0x3562a5,_0xbd593))[_0x5929('0x41')](handleError(_0x3562a5,null));};exports[_0x5929('0x42')]=function(_0x4fbae7,_0x160c0f){var _0x49c69d={'raw':!![],'where':{'id':_0x4fbae7[_0x5929('0x43')]['id']}},_0x28f7da={};_0x28f7da[_0x5929('0x2e')]=_['keys'](db[_0x5929('0x27')][_0x5929('0x28')]);_0x28f7da[_0x5929('0x2c')]=_[_0x5929('0x44')](_0x4fbae7[_0x5929('0x2c')]);_0x28f7da[_0x5929('0x37')]=_[_0x5929('0x2d')](_0x28f7da[_0x5929('0x2e')],_0x28f7da[_0x5929('0x2c')]);_0x49c69d[_0x5929('0x30')]=_[_0x5929('0x2d')](_0x28f7da['model'],qs[_0x5929('0x2f')](_0x4fbae7[_0x5929('0x2c')][_0x5929('0x2f')]));_0x49c69d[_0x5929('0x30')]=_0x49c69d['attributes'][_0x5929('0x45')]?_0x49c69d[_0x5929('0x30')]:_0x28f7da[_0x5929('0x2e')];if(_0x4fbae7[_0x5929('0x2c')][_0x5929('0x46')]){_0x49c69d[_0x5929('0x3e')]=[{'all':!![]}];}_0x49c69d=_[_0x5929('0x39')]({},_0x49c69d,_0x4fbae7[_0x5929('0x3b')]);return db[_0x5929('0x27')]['find'](_0x49c69d)['then'](handleEntityNotFound(_0x160c0f,null))[_0x5929('0x20')](respondWithResult(_0x160c0f,null))[_0x5929('0x41')](handleError(_0x160c0f,null));};exports['create']=function(_0xffe487,_0xde7705){return db[_0x5929('0x27')]['create'](_0xffe487[_0x5929('0x47')],{})[_0x5929('0x20')](respondWithResult(_0xde7705,0xc9))['catch'](handleError(_0xde7705,null));};exports['update']=function(_0x5c743b,_0xcd1b7e){if(_0x5c743b[_0x5929('0x47')]['id']){delete _0x5c743b[_0x5929('0x47')]['id'];}return db[_0x5929('0x27')][_0x5929('0x48')]({'where':{'id':_0x5c743b[_0x5929('0x43')]['id']}})[_0x5929('0x20')](handleEntityNotFound(_0xcd1b7e,null))[_0x5929('0x20')](saveUpdates(_0x5c743b['body'],null))[_0x5929('0x20')](respondWithResult(_0xcd1b7e,null))[_0x5929('0x41')](handleError(_0xcd1b7e,null));};exports['destroy']=function(_0x4b4894,_0x5caffe){return db[_0x5929('0x27')][_0x5929('0x48')]({'where':{'id':_0x4b4894[_0x5929('0x43')]['id']}})[_0x5929('0x20')](handleEntityNotFound(_0x5caffe,null))[_0x5929('0x20')](removeEntity(_0x5caffe,null))['catch'](handleError(_0x5caffe,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index e844f20..925f7c5 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 _0xc224=['define','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./analyticTreeReport.attributes','exports'];(function(_0x5e1d19,_0x3cb838){var _0x263c5b=function(_0x5b1629){while(--_0x5b1629){_0x5e1d19['push'](_0x5e1d19['shift']());}};_0x263c5b(++_0x3cb838);}(_0xc224,0x17d));var _0x4c22=function(_0x41c826,_0x34bfb9){_0x41c826=_0x41c826-0x0;var _0x6920de=_0xc224[_0x41c826];return _0x6920de;};'use strict';var _=require('lodash');var util=require(_0x4c22('0x0'));var logger=require(_0x4c22('0x1'))(_0x4c22('0x2'));var moment=require(_0x4c22('0x3'));var BPromise=require(_0x4c22('0x4'));var rp=require(_0x4c22('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4c22('0x6'));var attributes=require(_0x4c22('0x7'));module[_0x4c22('0x8')]=function(_0xd734f5,_0x527331){return _0xd734f5[_0x4c22('0x9')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8584=['api','bluebird','request-promise','./analyticTreeReport.attributes','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger'];(function(_0x5effa6,_0x3b5c2e){var _0xd7022f=function(_0xd92fe8){while(--_0xd92fe8){_0x5effa6['push'](_0x5effa6['shift']());}};_0xd7022f(++_0x3b5c2e);}(_0x8584,0x9e));var _0x4858=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x8584[_0x432682];return _0x463d05;};'use strict';var _=require(_0x4858('0x0'));var util=require('util');var logger=require(_0x4858('0x1'))(_0x4858('0x2'));var moment=require('moment');var BPromise=require(_0x4858('0x3'));var rp=require(_0x4858('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4858('0x5'));module['exports']=function(_0x8a586f,_0x2ebeb2){return _0x8a586f['define'](_0x4858('0x6'),attributes,{'tableName':_0x4858('0x7'),'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 a674caf..e14ac86 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 _0xf353=['info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xf353,0x9c));var _0x3f35=function(_0x8732d3,_0x49895f){_0x8732d3=_0x8732d3-0x0;var _0x395cbe=_0xf353[_0x8732d3];return _0x395cbe;};'use strict';var _=require(_0x3f35('0x0'));var util=require(_0x3f35('0x1'));var moment=require('moment');var BPromise=require(_0x3f35('0x2'));var rs=require(_0x3f35('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f35('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3f35('0x5'))(_0x3f35('0x6'));var config=require(_0x3f35('0x7'));var jayson=require(_0x3f35('0x8'));var client=jayson[_0x3f35('0x9')][_0x3f35('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e5661,_0x320ac2,_0x4e3a09){return new BPromise(function(_0x58e89c,_0x118464){return client[_0x3f35('0xb')](_0x5e5661,_0x4e3a09)['then'](function(_0x27c3db){logger[_0x3f35('0xc')](_0x3f35('0xd'),_0x320ac2,_0x3f35('0xe'));logger[_0x3f35('0xf')](_0x3f35('0x10'),_0x320ac2,_0x3f35('0xe'),JSON[_0x3f35('0x11')](_0x27c3db));if(_0x27c3db[_0x3f35('0x12')]){if(_0x27c3db[_0x3f35('0x12')][_0x3f35('0x13')]===0x1f4){logger[_0x3f35('0x12')](_0x3f35('0xd'),_0x320ac2,_0x27c3db[_0x3f35('0x12')]['message']);return _0x118464(_0x27c3db[_0x3f35('0x12')][_0x3f35('0x14')]);}logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x320ac2,_0x27c3db[_0x3f35('0x12')]['message']);return _0x58e89c(_0x27c3db[_0x3f35('0x12')][_0x3f35('0x14')]);}else{logger[_0x3f35('0xc')](_0x3f35('0xd'),_0x320ac2,_0x3f35('0xe'));_0x58e89c(_0x27c3db['result']['message']);}})['catch'](function(_0x48c340){logger[_0x3f35('0x12')](_0x3f35('0xd'),_0x320ac2,_0x48c340);_0x118464(_0x48c340);});});} \ No newline at end of file +var _0x4157=['jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x124269,_0x161b31){var _0x231ac3=function(_0x297925){while(--_0x297925){_0x124269['push'](_0x124269['shift']());}};_0x231ac3(++_0x161b31);}(_0x4157,0xa5));var _0x7415=function(_0x3de49c,_0x1aecec){_0x3de49c=_0x3de49c-0x0;var _0x273d20=_0x4157[_0x3de49c];return _0x273d20;};'use strict';var _=require(_0x7415('0x0'));var util=require(_0x7415('0x1'));var moment=require(_0x7415('0x2'));var BPromise=require(_0x7415('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7415('0x4'));var db=require(_0x7415('0x5'))['db'];var utils=require(_0x7415('0x6'));var logger=require(_0x7415('0x7'))(_0x7415('0x8'));var config=require(_0x7415('0x9'));var jayson=require(_0x7415('0xa'));var client=jayson[_0x7415('0xb')][_0x7415('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3d7f7d,_0x4ea8d0,_0x3b47aa){return new BPromise(function(_0x369785,_0x67faee){return client[_0x7415('0xd')](_0x3d7f7d,_0x3b47aa)[_0x7415('0xe')](function(_0x21aaa6){logger[_0x7415('0xf')](_0x7415('0x10'),_0x4ea8d0,_0x7415('0x11'));logger[_0x7415('0x12')](_0x7415('0x13'),_0x4ea8d0,_0x7415('0x11'),JSON[_0x7415('0x14')](_0x21aaa6));if(_0x21aaa6['error']){if(_0x21aaa6[_0x7415('0x15')][_0x7415('0x16')]===0x1f4){logger['error'](_0x7415('0x10'),_0x4ea8d0,_0x21aaa6[_0x7415('0x15')][_0x7415('0x17')]);return _0x67faee(_0x21aaa6[_0x7415('0x15')][_0x7415('0x17')]);}logger[_0x7415('0x15')](_0x7415('0x10'),_0x4ea8d0,_0x21aaa6[_0x7415('0x15')][_0x7415('0x17')]);return _0x369785(_0x21aaa6[_0x7415('0x15')][_0x7415('0x17')]);}else{logger['info'](_0x7415('0x10'),_0x4ea8d0,_0x7415('0x11'));_0x369785(_0x21aaa6[_0x7415('0x18')][_0x7415('0x17')]);}})['catch'](function(_0x510d1c){logger[_0x7415('0x15')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4ea8d0,_0x510d1c);_0x67faee(_0x510d1c);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 5aa1fca..08510f4 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 _0x4360=['index','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0x4360,0x1ef));var _0x0436=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4360[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0436('0x0'));var util=require(_0x0436('0x1'));var path=require(_0x0436('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0436('0x3')]();var auth=require(_0x0436('0x4'));var interaction=require(_0x0436('0x5'));var config=require(_0x0436('0x6'));var controller=require('./analyticTreeReport.controller');router[_0x0436('0x7')]('/',auth[_0x0436('0x8')](),controller[_0x0436('0x9')]);router[_0x0436('0x7')]('/:id',auth[_0x0436('0x8')](),controller['show']);router[_0x0436('0xa')]('/',auth[_0x0436('0x8')](),controller[_0x0436('0xb')]);router[_0x0436('0xc')](_0x0436('0xd'),auth[_0x0436('0x8')](),controller[_0x0436('0xe')]);router[_0x0436('0xf')](_0x0436('0xd'),auth[_0x0436('0x8')](),controller[_0x0436('0x10')]);module[_0x0436('0x11')]=router; \ No newline at end of file +var _0x1c3d=['post','create','put','/:id','delete','destroy','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','index','isAuthenticated','show'];(function(_0x1dd82f,_0x52acb7){var _0x353ca4=function(_0x5ee4c9){while(--_0x5ee4c9){_0x1dd82f['push'](_0x1dd82f['shift']());}};_0x353ca4(++_0x52acb7);}(_0x1c3d,0x9f));var _0xd1c3=function(_0x45825e,_0x2f44e4){_0x45825e=_0x45825e-0x0;var _0x4d2330=_0x1c3d[_0x45825e];return _0x4d2330;};'use strict';var multer=require(_0xd1c3('0x0'));var util=require('util');var path=require(_0xd1c3('0x1'));var timeout=require(_0xd1c3('0x2'));var express=require(_0xd1c3('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xd1c3('0x4'));var config=require(_0xd1c3('0x5'));var controller=require(_0xd1c3('0x6'));router[_0xd1c3('0x7')]('/',auth['isAuthenticated'](),controller[_0xd1c3('0x8')]);router[_0xd1c3('0x7')]('/:id',auth[_0xd1c3('0x9')](),controller[_0xd1c3('0xa')]);router[_0xd1c3('0xb')]('/',auth[_0xd1c3('0x9')](),controller[_0xd1c3('0xc')]);router[_0xd1c3('0xd')](_0xd1c3('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xd1c3('0xf')](_0xd1c3('0xe'),auth[_0xd1c3('0x9')](),controller[_0xd1c3('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index bd3d8c9..c4386a9 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 _0x504b=['STRING'];(function(_0x36d703,_0x55b354){var _0x12c909=function(_0x5e846a){while(--_0x5e846a){_0x36d703['push'](_0x36d703['shift']());}};_0x12c909(++_0x55b354);}(_0x504b,0x120));var _0xb504=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x504b[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xb504('0x0')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x41ba=['sequelize','STRING'];(function(_0x525308,_0x5898c9){var _0x5a6e40=function(_0x113c37){while(--_0x113c37){_0x525308['push'](_0x525308['shift']());}};_0x5a6e40(++_0x5898c9);}(_0x41ba,0xec));var _0xa41b=function(_0x57e966,_0x58f802){_0x57e966=_0x57e966-0x0;var _0x1c997f=_0x41ba[_0x57e966];return _0x1c997f;};'use strict';var Sequelize=require(_0xa41b('0x0'));module['exports']={'name':{'type':Sequelize[_0xa41b('0x1')]},'basename':{'type':Sequelize[_0xa41b('0x1')]},'type':{'type':Sequelize[_0xa41b('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 265e066..aaa7411 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 _0xf4bc=['sendStatus','end','status','json','count','offset','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','Attachment','rawAttributes','fieldName','key','model','keys','intersection','query','fields','attributes','length','nolimit','limit','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','clone','get','omit','createdAt','updatedAt','body','create','destroy','originalname','file','type','mimetype','download','findOne','join','root','server/files/attachments/','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x15b37c,_0x398a0a){var _0x36a161=function(_0x4f1d05){while(--_0x4f1d05){_0x15b37c['push'](_0x15b37c['shift']());}};_0x36a161(++_0x398a0a);}(_0xf4bc,0x19e));var _0xcf4b=function(_0x3a9e1f,_0x3f7ac7){_0x3a9e1f=_0x3a9e1f-0x0;var _0x419aed=_0xf4bc[_0x3a9e1f];return _0x419aed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcf4b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcf4b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcf4b('0x2'));var moment=require(_0xcf4b('0x3'));var BPromise=require(_0xcf4b('0x4'));var Mustache=require(_0xcf4b('0x5'));var util=require(_0xcf4b('0x6'));var path=require(_0xcf4b('0x7'));var sox=require('sox');var csv=require(_0xcf4b('0x8'));var ejs=require(_0xcf4b('0x9'));var fs=require('fs');var _=require(_0xcf4b('0xa'));var squel=require(_0xcf4b('0xb'));var crypto=require(_0xcf4b('0xc'));var jsforce=require(_0xcf4b('0xd'));var deskjs=require(_0xcf4b('0xe'));var toCsv=require(_0xcf4b('0x8'));var querystring=require(_0xcf4b('0xf'));var Papa=require(_0xcf4b('0x10'));var Redis=require(_0xcf4b('0x11'));var authService=require(_0xcf4b('0x12'));var qs=require(_0xcf4b('0x13'));var as=require(_0xcf4b('0x14'));var hardwareService=require(_0xcf4b('0x15'));var logger=require(_0xcf4b('0x16'))(_0xcf4b('0x17'));var utils=require(_0xcf4b('0x18'));var config=require(_0xcf4b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c5ad4,_0x24f00e){_0x24f00e=_0x24f00e||0xcc;return function(_0x49365f){if(_0x49365f){return _0x2c5ad4[_0xcf4b('0x1a')](_0x24f00e);}return _0x2c5ad4['status'](_0x24f00e)[_0xcf4b('0x1b')]();};}function respondWithResult(_0x3ae21d,_0x484290){_0x484290=_0x484290||0xc8;return function(_0x4895f9){if(_0x4895f9){return _0x3ae21d[_0xcf4b('0x1c')](_0x484290)[_0xcf4b('0x1d')](_0x4895f9);}};}function respondWithFilteredResult(_0x4a3372,_0x5585cc){return function(_0x3c160c){if(_0x3c160c){var _0x2b6d7f=_0x3c160c[_0xcf4b('0x1e')],_0x268f4a=_0x5585cc[_0xcf4b('0x1f')],_0x4de4b3=_0x5585cc[_0xcf4b('0x1f')]+_0x5585cc['limit'],_0x5a7722;if(_0x4de4b3>=_0x2b6d7f){_0x4de4b3=_0x2b6d7f;_0x5a7722=0xc8;}else{_0x5a7722=0xce;}_0x4a3372[_0xcf4b('0x1c')](_0x5a7722);return _0x4a3372['set'](_0xcf4b('0x20'),_0x268f4a+'-'+_0x4de4b3+'/'+_0x2b6d7f)[_0xcf4b('0x1d')](_0x3c160c);}return null;};}function patchUpdates(_0x238a53){return function(_0x284b49){try{jsonpatch[_0xcf4b('0x21')](_0x284b49,_0x238a53,!![]);}catch(_0x342af8){return BPromise[_0xcf4b('0x22')](_0x342af8);}return _0x284b49[_0xcf4b('0x23')]();};}function saveUpdates(_0x3c336a,_0x5e6c15){return function(_0x302f38){if(_0x302f38){return _0x302f38[_0xcf4b('0x24')](_0x3c336a)[_0xcf4b('0x25')](function(_0x57302d){return _0x57302d;});}return null;};}function removeEntity(_0x34cd7b,_0x50ec04){return function(_0x3dd92b){if(_0x3dd92b){return _0x3dd92b['destroy']()[_0xcf4b('0x25')](function(){_0x34cd7b[_0xcf4b('0x1c')](0xcc)[_0xcf4b('0x1b')]();});}};}function handleEntityNotFound(_0x5d8694,_0x32f7ca){return function(_0x33fd4){if(!_0x33fd4){_0x5d8694[_0xcf4b('0x1a')](0x194);}return _0x33fd4;};}function handleError(_0x36e1cd,_0x3cb1da){_0x3cb1da=_0x3cb1da||0x1f4;return function(_0x543718){logger['error'](_0x543718[_0xcf4b('0x26')]);if(_0x543718[_0xcf4b('0x27')]){delete _0x543718[_0xcf4b('0x27')];}_0x36e1cd[_0xcf4b('0x1c')](_0x3cb1da)[_0xcf4b('0x28')](_0x543718);};}exports[_0xcf4b('0x29')]=function(_0x27d4fe,_0x1bde96){var _0x10f080={},_0x12c057={},_0x2d9717={'count':0x0,'rows':[]};var _0x202813=_[_0xcf4b('0x2a')](db[_0xcf4b('0x2b')][_0xcf4b('0x2c')],function(_0x5a69e8){return{'name':_0x5a69e8[_0xcf4b('0x2d')],'type':_0x5a69e8['type'][_0xcf4b('0x2e')]};});_0x12c057[_0xcf4b('0x2f')]=_[_0xcf4b('0x2a')](_0x202813,'name');_0x12c057['query']=_[_0xcf4b('0x30')](_0x27d4fe['query']);_0x12c057['filters']=_[_0xcf4b('0x31')](_0x12c057['model'],_0x12c057[_0xcf4b('0x32')]);_0x10f080['attributes']=_[_0xcf4b('0x31')](_0x12c057[_0xcf4b('0x2f')],qs[_0xcf4b('0x33')](_0x27d4fe[_0xcf4b('0x32')]['fields']));_0x10f080[_0xcf4b('0x34')]=_0x10f080[_0xcf4b('0x34')][_0xcf4b('0x35')]?_0x10f080[_0xcf4b('0x34')]:_0x12c057[_0xcf4b('0x2f')];if(!_0x27d4fe[_0xcf4b('0x32')]['hasOwnProperty'](_0xcf4b('0x36'))){_0x10f080[_0xcf4b('0x37')]=qs[_0xcf4b('0x37')](_0x27d4fe[_0xcf4b('0x32')]['limit']);_0x10f080['offset']=qs[_0xcf4b('0x1f')](_0x27d4fe[_0xcf4b('0x32')][_0xcf4b('0x1f')]);}_0x10f080['order']=qs['sort'](_0x27d4fe[_0xcf4b('0x32')][_0xcf4b('0x38')]);_0x10f080['where']=qs['filters'](_[_0xcf4b('0x39')](_0x27d4fe[_0xcf4b('0x32')],_0x12c057[_0xcf4b('0x3a')]),_0x202813);if(_0x27d4fe[_0xcf4b('0x32')][_0xcf4b('0x3b')]){_0x10f080[_0xcf4b('0x3c')]=_[_0xcf4b('0x3d')](_0x10f080['where'],{'$or':_[_0xcf4b('0x2a')](_0x202813,function(_0x1e6e22){if(_0x1e6e22['type']!==_0xcf4b('0x3e')){var _0x10a896={};_0x10a896[_0x1e6e22[_0xcf4b('0x27')]]={'$like':'%'+_0x27d4fe[_0xcf4b('0x32')][_0xcf4b('0x3b')]+'%'};return _0x10a896;}})});}_0x10f080=_[_0xcf4b('0x3d')]({},_0x10f080,_0x27d4fe[_0xcf4b('0x3f')]);var _0x41f68a={'where':_0x10f080[_0xcf4b('0x3c')]};return db[_0xcf4b('0x2b')][_0xcf4b('0x1e')](_0x41f68a)[_0xcf4b('0x25')](function(_0x5d4aee){_0x2d9717['count']=_0x5d4aee;if(_0x27d4fe[_0xcf4b('0x32')][_0xcf4b('0x40')]){_0x10f080[_0xcf4b('0x41')]=[{'all':!![]}];}return db['Attachment'][_0xcf4b('0x42')](_0x10f080);})[_0xcf4b('0x25')](function(_0x5bdd54){_0x2d9717['rows']=_0x5bdd54;return _0x2d9717;})[_0xcf4b('0x25')](respondWithFilteredResult(_0x1bde96,_0x10f080))['catch'](handleError(_0x1bde96,null));};exports[_0xcf4b('0x43')]=function(_0x1296ae,_0x3b8b7d){var _0x2be92a={'raw':!![],'where':{'id':_0x1296ae[_0xcf4b('0x44')]['id']}},_0x4023e9={};_0x4023e9[_0xcf4b('0x2f')]=_['keys'](db[_0xcf4b('0x2b')][_0xcf4b('0x2c')]);_0x4023e9[_0xcf4b('0x32')]=_[_0xcf4b('0x30')](_0x1296ae[_0xcf4b('0x32')]);_0x4023e9[_0xcf4b('0x3a')]=_[_0xcf4b('0x31')](_0x4023e9[_0xcf4b('0x2f')],_0x4023e9[_0xcf4b('0x32')]);_0x2be92a[_0xcf4b('0x34')]=_[_0xcf4b('0x31')](_0x4023e9[_0xcf4b('0x2f')],qs[_0xcf4b('0x33')](_0x1296ae[_0xcf4b('0x32')][_0xcf4b('0x33')]));_0x2be92a['attributes']=_0x2be92a[_0xcf4b('0x34')][_0xcf4b('0x35')]?_0x2be92a[_0xcf4b('0x34')]:_0x4023e9[_0xcf4b('0x2f')];if(_0x1296ae[_0xcf4b('0x32')]['includeAll']){_0x2be92a[_0xcf4b('0x41')]=[{'all':!![]}];}_0x2be92a=_[_0xcf4b('0x3d')]({},_0x2be92a,_0x1296ae[_0xcf4b('0x3f')]);return db['Attachment'][_0xcf4b('0x45')](_0x2be92a)[_0xcf4b('0x25')](handleEntityNotFound(_0x3b8b7d,null))[_0xcf4b('0x25')](respondWithResult(_0x3b8b7d,null))[_0xcf4b('0x46')](handleError(_0x3b8b7d,null));};exports[_0xcf4b('0x47')]=function(_0x21196b,_0x32525b){var _0x1bd3da={'where':{'id':_0x21196b['params']['id']}},_0xe785d1={};_0xe785d1[_0xcf4b('0x2f')]=_[_0xcf4b('0x30')](db['Attachment'][_0xcf4b('0x2c')]);_0x1bd3da['attributes']=_[_0xcf4b('0x31')](_0xe785d1['model'],qs[_0xcf4b('0x33')](_0x21196b[_0xcf4b('0x32')][_0xcf4b('0x33')]));_0x1bd3da['attributes']=_0x1bd3da['attributes'][_0xcf4b('0x35')]?_0x1bd3da[_0xcf4b('0x34')]:_0xe785d1['model'];if(_0x21196b[_0xcf4b('0x32')][_0xcf4b('0x40')]){_0x1bd3da[_0xcf4b('0x41')]=[{'all':!![]}];}_0x1bd3da=_['merge']({},_0x1bd3da,_0x21196b['options']);return db[_0xcf4b('0x2b')]['find'](_0x1bd3da)[_0xcf4b('0x25')](handleEntityNotFound(_0x32525b,null))[_0xcf4b('0x25')](function(_0xd6a86){if(_0xd6a86){var _0x420918=_0xd6a86[_0xcf4b('0x48')]({'plain':!![]});_0x420918=qs[_0xcf4b('0x49')](_0x420918,['id',_0xcf4b('0x4a'),_0xcf4b('0x4b')]);_0x21196b[_0xcf4b('0x4c')]=_[_0xcf4b('0x49')](_0x21196b[_0xcf4b('0x4c')],['id',_0xcf4b('0x4a'),'updatedAt']);return db['Attachment'][_0xcf4b('0x4d')](_['merge'](_0x420918,_0x21196b['body']),{'include':_0x21196b[_0xcf4b('0x32')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xcf4b('0x25')](respondWithResult(_0x32525b,0xc9))[_0xcf4b('0x46')](handleError(_0x32525b,null));};exports[_0xcf4b('0x24')]=function(_0x2194bd,_0x167ae3){if(_0x2194bd[_0xcf4b('0x4c')]['id']){delete _0x2194bd[_0xcf4b('0x4c')]['id'];}return db[_0xcf4b('0x2b')][_0xcf4b('0x45')]({'where':{'id':_0x2194bd[_0xcf4b('0x44')]['id']}})['then'](handleEntityNotFound(_0x167ae3,null))[_0xcf4b('0x25')](saveUpdates(_0x2194bd[_0xcf4b('0x4c')],null))[_0xcf4b('0x25')](respondWithResult(_0x167ae3,null))[_0xcf4b('0x46')](handleError(_0x167ae3,null));};exports[_0xcf4b('0x4e')]=function(_0x16ec5d,_0x495322){return db[_0xcf4b('0x2b')][_0xcf4b('0x45')]({'where':{'id':_0x16ec5d[_0xcf4b('0x44')]['id']}})[_0xcf4b('0x25')](handleEntityNotFound(_0x495322,null))[_0xcf4b('0x25')](removeEntity(_0x495322,null))[_0xcf4b('0x46')](handleError(_0x495322,null));};exports[_0xcf4b('0x4d')]=function(_0x3d1c19,_0x24c67b,_0x2b3fdc){_0x3d1c19['body'][_0xcf4b('0x27')]=_0x3d1c19['file'][_0xcf4b('0x4f')];_0x3d1c19[_0xcf4b('0x4c')]['basename']=_0x3d1c19[_0xcf4b('0x50')]['filename'];_0x3d1c19[_0xcf4b('0x4c')][_0xcf4b('0x51')]=_0x3d1c19[_0xcf4b('0x50')][_0xcf4b('0x52')];return db[_0xcf4b('0x2b')][_0xcf4b('0x4d')](_0x3d1c19[_0xcf4b('0x4c')])['then'](respondWithResult(_0x24c67b,0xc9))[_0xcf4b('0x46')](handleError(_0x24c67b,null));};exports[_0xcf4b('0x53')]=function(_0x1db5fc,_0x2672b6,_0x3058a0){return db['Attachment'][_0xcf4b('0x54')]({'where':{'id':_0x1db5fc['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2672b6,null))[_0xcf4b('0x25')](function(_0xc2486a){if(_0xc2486a){return _0x2672b6[_0xcf4b('0x53')](path[_0xcf4b('0x55')](config[_0xcf4b('0x56')],_0xcf4b('0x57'),_0xc2486a['basename']));}})['catch'](handleError(_0x2672b6,null));}; \ No newline at end of file +var _0xe91e=['Content-Range','apply','reject','save','update','then','error','stack','name','index','Attachment','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','options','includeAll','include','rows','show','params','keys','rawAttributes','fields','find','catch','clone','merge','omit','createdAt','body','updatedAt','create','file','originalname','basename','download','findOne','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','status','end','json','count','offset','limit','set'];(function(_0x4f2157,_0x2e32af){var _0x7927b6=function(_0x24859b){while(--_0x24859b){_0x4f2157['push'](_0x4f2157['shift']());}};_0x7927b6(++_0x2e32af);}(_0xe91e,0x177));var _0xee91=function(_0x5a93f0,_0x172b1b){_0x5a93f0=_0x5a93f0-0x0;var _0x53844d=_0xe91e[_0x5a93f0];return _0x53844d;};'use strict';var pdf=require(_0xee91('0x0'));var emlformat=require(_0xee91('0x1'));var rimraf=require(_0xee91('0x2'));var zipdir=require(_0xee91('0x3'));var jsonpatch=require(_0xee91('0x4'));var rp=require(_0xee91('0x5'));var moment=require(_0xee91('0x6'));var BPromise=require(_0xee91('0x7'));var Mustache=require(_0xee91('0x8'));var util=require(_0xee91('0x9'));var path=require(_0xee91('0xa'));var sox=require(_0xee91('0xb'));var csv=require(_0xee91('0xc'));var ejs=require(_0xee91('0xd'));var fs=require('fs');var _=require(_0xee91('0xe'));var squel=require(_0xee91('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xee91('0xc'));var querystring=require('querystring');var Papa=require(_0xee91('0x10'));var Redis=require(_0xee91('0x11'));var authService=require(_0xee91('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xee91('0x13'));var hardwareService=require(_0xee91('0x14'));var logger=require(_0xee91('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xee91('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23cfe6,_0x2e425c){_0x2e425c=_0x2e425c||0xcc;return function(_0x356f47){if(_0x356f47){return _0x23cfe6['sendStatus'](_0x2e425c);}return _0x23cfe6[_0xee91('0x17')](_0x2e425c)[_0xee91('0x18')]();};}function respondWithResult(_0x2bd040,_0x925332){_0x925332=_0x925332||0xc8;return function(_0x1944d1){if(_0x1944d1){return _0x2bd040[_0xee91('0x17')](_0x925332)[_0xee91('0x19')](_0x1944d1);}};}function respondWithFilteredResult(_0x345e15,_0x15e88c){return function(_0x27e982){if(_0x27e982){var _0x5eae39=_0x27e982[_0xee91('0x1a')],_0x26460d=_0x15e88c['offset'],_0x41a337=_0x15e88c[_0xee91('0x1b')]+_0x15e88c[_0xee91('0x1c')],_0x56454f;if(_0x41a337>=_0x5eae39){_0x41a337=_0x5eae39;_0x56454f=0xc8;}else{_0x56454f=0xce;}_0x345e15[_0xee91('0x17')](_0x56454f);return _0x345e15[_0xee91('0x1d')](_0xee91('0x1e'),_0x26460d+'-'+_0x41a337+'/'+_0x5eae39)[_0xee91('0x19')](_0x27e982);}return null;};}function patchUpdates(_0x1c4fd5){return function(_0x1d93e6){try{jsonpatch[_0xee91('0x1f')](_0x1d93e6,_0x1c4fd5,!![]);}catch(_0x40d4a2){return BPromise[_0xee91('0x20')](_0x40d4a2);}return _0x1d93e6[_0xee91('0x21')]();};}function saveUpdates(_0x35e7c5,_0xe36d2f){return function(_0xf82e3a){if(_0xf82e3a){return _0xf82e3a[_0xee91('0x22')](_0x35e7c5)['then'](function(_0xe0ca3b){return _0xe0ca3b;});}return null;};}function removeEntity(_0x5e0518,_0x496d35){return function(_0x421396){if(_0x421396){return _0x421396['destroy']()[_0xee91('0x23')](function(){_0x5e0518['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x58e276,_0x476804){return function(_0x56a091){if(!_0x56a091){_0x58e276['sendStatus'](0x194);}return _0x56a091;};}function handleError(_0x134303,_0x212f03){_0x212f03=_0x212f03||0x1f4;return function(_0x34a43e){logger[_0xee91('0x24')](_0x34a43e[_0xee91('0x25')]);if(_0x34a43e[_0xee91('0x26')]){delete _0x34a43e[_0xee91('0x26')];}_0x134303[_0xee91('0x17')](_0x212f03)['send'](_0x34a43e);};}exports[_0xee91('0x27')]=function(_0x314356,_0x18de79){var _0x573ca3={},_0x44472a={},_0x33f49f={'count':0x0,'rows':[]};var _0x586c80=_['map'](db[_0xee91('0x28')]['rawAttributes'],function(_0x1d4b03){return{'name':_0x1d4b03['fieldName'],'type':_0x1d4b03[_0xee91('0x29')][_0xee91('0x2a')]};});_0x44472a[_0xee91('0x2b')]=_[_0xee91('0x2c')](_0x586c80,_0xee91('0x26'));_0x44472a['query']=_['keys'](_0x314356[_0xee91('0x2d')]);_0x44472a[_0xee91('0x2e')]=_[_0xee91('0x2f')](_0x44472a['model'],_0x44472a[_0xee91('0x2d')]);_0x573ca3[_0xee91('0x30')]=_[_0xee91('0x2f')](_0x44472a[_0xee91('0x2b')],qs['fields'](_0x314356[_0xee91('0x2d')]['fields']));_0x573ca3['attributes']=_0x573ca3[_0xee91('0x30')][_0xee91('0x31')]?_0x573ca3[_0xee91('0x30')]:_0x44472a['model'];if(!_0x314356[_0xee91('0x2d')][_0xee91('0x32')](_0xee91('0x33'))){_0x573ca3[_0xee91('0x1c')]=qs[_0xee91('0x1c')](_0x314356[_0xee91('0x2d')][_0xee91('0x1c')]);_0x573ca3[_0xee91('0x1b')]=qs[_0xee91('0x1b')](_0x314356[_0xee91('0x2d')][_0xee91('0x1b')]);}_0x573ca3[_0xee91('0x34')]=qs[_0xee91('0x35')](_0x314356['query'][_0xee91('0x35')]);_0x573ca3['where']=qs[_0xee91('0x2e')](_[_0xee91('0x36')](_0x314356[_0xee91('0x2d')],_0x44472a[_0xee91('0x2e')]),_0x586c80);if(_0x314356['query']['filter']){_0x573ca3[_0xee91('0x37')]=_['merge'](_0x573ca3[_0xee91('0x37')],{'$or':_[_0xee91('0x2c')](_0x586c80,function(_0x5b3636){if(_0x5b3636[_0xee91('0x29')]!==_0xee91('0x38')){var _0x24d955={};_0x24d955[_0x5b3636['name']]={'$like':'%'+_0x314356[_0xee91('0x2d')]['filter']+'%'};return _0x24d955;}})});}_0x573ca3=_['merge']({},_0x573ca3,_0x314356[_0xee91('0x39')]);var _0x3c846a={'where':_0x573ca3[_0xee91('0x37')]};return db[_0xee91('0x28')][_0xee91('0x1a')](_0x3c846a)[_0xee91('0x23')](function(_0x4fd8b0){_0x33f49f['count']=_0x4fd8b0;if(_0x314356[_0xee91('0x2d')][_0xee91('0x3a')]){_0x573ca3[_0xee91('0x3b')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x573ca3);})[_0xee91('0x23')](function(_0x88a167){_0x33f49f[_0xee91('0x3c')]=_0x88a167;return _0x33f49f;})['then'](respondWithFilteredResult(_0x18de79,_0x573ca3))['catch'](handleError(_0x18de79,null));};exports[_0xee91('0x3d')]=function(_0x4c0376,_0x10f004){var _0x2c27d8={'raw':!![],'where':{'id':_0x4c0376[_0xee91('0x3e')]['id']}},_0x2ddf08={};_0x2ddf08['model']=_[_0xee91('0x3f')](db[_0xee91('0x28')][_0xee91('0x40')]);_0x2ddf08[_0xee91('0x2d')]=_[_0xee91('0x3f')](_0x4c0376[_0xee91('0x2d')]);_0x2ddf08[_0xee91('0x2e')]=_['intersection'](_0x2ddf08[_0xee91('0x2b')],_0x2ddf08['query']);_0x2c27d8['attributes']=_[_0xee91('0x2f')](_0x2ddf08['model'],qs[_0xee91('0x41')](_0x4c0376[_0xee91('0x2d')][_0xee91('0x41')]));_0x2c27d8['attributes']=_0x2c27d8[_0xee91('0x30')]['length']?_0x2c27d8['attributes']:_0x2ddf08[_0xee91('0x2b')];if(_0x4c0376[_0xee91('0x2d')]['includeAll']){_0x2c27d8[_0xee91('0x3b')]=[{'all':!![]}];}_0x2c27d8=_['merge']({},_0x2c27d8,_0x4c0376['options']);return db[_0xee91('0x28')][_0xee91('0x42')](_0x2c27d8)[_0xee91('0x23')](handleEntityNotFound(_0x10f004,null))[_0xee91('0x23')](respondWithResult(_0x10f004,null))[_0xee91('0x43')](handleError(_0x10f004,null));};exports[_0xee91('0x44')]=function(_0x4410c6,_0x17c076){var _0x4911c7={'where':{'id':_0x4410c6[_0xee91('0x3e')]['id']}},_0x1fe74f={};_0x1fe74f[_0xee91('0x2b')]=_[_0xee91('0x3f')](db[_0xee91('0x28')]['rawAttributes']);_0x4911c7[_0xee91('0x30')]=_[_0xee91('0x2f')](_0x1fe74f[_0xee91('0x2b')],qs[_0xee91('0x41')](_0x4410c6[_0xee91('0x2d')]['fields']));_0x4911c7[_0xee91('0x30')]=_0x4911c7[_0xee91('0x30')][_0xee91('0x31')]?_0x4911c7[_0xee91('0x30')]:_0x1fe74f[_0xee91('0x2b')];if(_0x4410c6[_0xee91('0x2d')][_0xee91('0x3a')]){_0x4911c7[_0xee91('0x3b')]=[{'all':!![]}];}_0x4911c7=_[_0xee91('0x45')]({},_0x4911c7,_0x4410c6[_0xee91('0x39')]);return db[_0xee91('0x28')][_0xee91('0x42')](_0x4911c7)[_0xee91('0x23')](handleEntityNotFound(_0x17c076,null))['then'](function(_0x5b733c){if(_0x5b733c){var _0x2518c5=_0x5b733c['get']({'plain':!![]});_0x2518c5=qs[_0xee91('0x46')](_0x2518c5,['id',_0xee91('0x47'),'updatedAt']);_0x4410c6['body']=_[_0xee91('0x46')](_0x4410c6[_0xee91('0x48')],['id',_0xee91('0x47'),_0xee91('0x49')]);return db[_0xee91('0x28')][_0xee91('0x4a')](_['merge'](_0x2518c5,_0x4410c6['body']),{'include':_0x4410c6[_0xee91('0x2d')][_0xee91('0x3a')]?[{'all':!![]}]:undefined});}})[_0xee91('0x23')](respondWithResult(_0x17c076,0xc9))[_0xee91('0x43')](handleError(_0x17c076,null));};exports['update']=function(_0x450197,_0x18631e){if(_0x450197[_0xee91('0x48')]['id']){delete _0x450197[_0xee91('0x48')]['id'];}return db[_0xee91('0x28')][_0xee91('0x42')]({'where':{'id':_0x450197[_0xee91('0x3e')]['id']}})[_0xee91('0x23')](handleEntityNotFound(_0x18631e,null))[_0xee91('0x23')](saveUpdates(_0x450197['body'],null))[_0xee91('0x23')](respondWithResult(_0x18631e,null))[_0xee91('0x43')](handleError(_0x18631e,null));};exports['destroy']=function(_0x6a0dea,_0x46dc06){return db[_0xee91('0x28')][_0xee91('0x42')]({'where':{'id':_0x6a0dea['params']['id']}})['then'](handleEntityNotFound(_0x46dc06,null))[_0xee91('0x23')](removeEntity(_0x46dc06,null))[_0xee91('0x43')](handleError(_0x46dc06,null));};exports[_0xee91('0x4a')]=function(_0x3bad84,_0x19fcbd,_0x3fc3e6){_0x3bad84['body'][_0xee91('0x26')]=_0x3bad84[_0xee91('0x4b')][_0xee91('0x4c')];_0x3bad84[_0xee91('0x48')][_0xee91('0x4d')]=_0x3bad84[_0xee91('0x4b')]['filename'];_0x3bad84[_0xee91('0x48')][_0xee91('0x29')]=_0x3bad84[_0xee91('0x4b')]['mimetype'];return db['Attachment']['create'](_0x3bad84[_0xee91('0x48')])[_0xee91('0x23')](respondWithResult(_0x19fcbd,0xc9))[_0xee91('0x43')](handleError(_0x19fcbd,null));};exports[_0xee91('0x4e')]=function(_0x4096eb,_0x32d28f,_0x575d5d){return db[_0xee91('0x28')][_0xee91('0x4f')]({'where':{'id':_0x4096eb[_0xee91('0x3e')]['id']},'raw':!![]})[_0xee91('0x23')](handleEntityNotFound(_0x32d28f,null))['then'](function(_0xf9829){if(_0xf9829){return _0x32d28f['download'](path['join'](config['root'],_0xee91('0x50'),_0xf9829[_0xee91('0x4d')]));}})['catch'](handleError(_0x32d28f,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 6d8142e..0f3eb97 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 _0xbec5=['request-promise','path','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','util','api','moment','bluebird'];(function(_0x8096,_0x475e11){var _0x172516=function(_0x56f2d5){while(--_0x56f2d5){_0x8096['push'](_0x8096['shift']());}};_0x172516(++_0x475e11);}(_0xbec5,0xe5));var _0x5bec=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0xbec5[_0x1d50f2];return _0x3769b8;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var moment=require(_0x5bec('0x3'));var BPromise=require(_0x5bec('0x4'));var rp=require(_0x5bec('0x5'));var fs=require('fs');var path=require(_0x5bec('0x6'));var rimraf=require('rimraf');var config=require(_0x5bec('0x7'));var attributes=require(_0x5bec('0x8'));module[_0x5bec('0x9')]=function(_0x4aaac6,_0x3ed67a){return _0x4aaac6[_0x5bec('0xa')](_0x5bec('0xb'),attributes,{'tableName':_0x5bec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e5=['request-promise','path','../../config/environment','./attachment.attributes','exports','define','Attachment','util','api','moment','bluebird'];(function(_0x519424,_0x5671b2){var _0x4a0402=function(_0x3945be){while(--_0x3945be){_0x519424['push'](_0x519424['shift']());}};_0x4a0402(++_0x5671b2);}(_0x34e5,0x172));var _0x534e=function(_0x168857,_0x1aabff){_0x168857=_0x168857-0x0;var _0x418351=_0x34e5[_0x168857];return _0x418351;};'use strict';var _=require('lodash');var util=require(_0x534e('0x0'));var logger=require('../../config/logger')(_0x534e('0x1'));var moment=require(_0x534e('0x2'));var BPromise=require(_0x534e('0x3'));var rp=require(_0x534e('0x4'));var fs=require('fs');var path=require(_0x534e('0x5'));var rimraf=require('rimraf');var config=require(_0x534e('0x6'));var attributes=require(_0x534e('0x7'));module[_0x534e('0x8')]=function(_0x117f0c,_0x436a92){return _0x117f0c[_0x534e('0x9')](_0x534e('0xa'),attributes,{'tableName':'attachments','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 a6842e7..6d0db86 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 _0xaa7a=['catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','CreateAttachment','body','raw'];(function(_0xa7b727,_0x2df940){var _0x3abf4d=function(_0x5992d3){while(--_0x5992d3){_0xa7b727['push'](_0xa7b727['shift']());}};_0x3abf4d(++_0x2df940);}(_0xaa7a,0x12d));var _0xaaa7=function(_0x3b3f4f,_0x403216){_0x3b3f4f=_0x3b3f4f-0x0;var _0x174dbe=_0xaa7a[_0x3b3f4f];return _0x174dbe;};'use strict';var _=require(_0xaaa7('0x0'));var util=require(_0xaaa7('0x1'));var moment=require('moment');var BPromise=require(_0xaaa7('0x2'));var rs=require(_0xaaa7('0x3'));var fs=require('fs');var Redis=require(_0xaaa7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaaa7('0x5'));var logger=require(_0xaaa7('0x6'))('rpc');var config=require(_0xaaa7('0x7'));var jayson=require(_0xaaa7('0x8'));var client=jayson[_0xaaa7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b229a,_0x38f27e,_0x453ca8){return new BPromise(function(_0xc230bd,_0x506d95){return client[_0xaaa7('0xa')](_0x4b229a,_0x453ca8)[_0xaaa7('0xb')](function(_0x271bf2){logger['info'](_0xaaa7('0xc'),_0x38f27e,_0xaaa7('0xd'));logger[_0xaaa7('0xe')](_0xaaa7('0xf'),_0x38f27e,_0xaaa7('0xd'),JSON[_0xaaa7('0x10')](_0x271bf2));if(_0x271bf2[_0xaaa7('0x11')]){if(_0x271bf2[_0xaaa7('0x11')][_0xaaa7('0x12')]===0x1f4){logger[_0xaaa7('0x11')](_0xaaa7('0xc'),_0x38f27e,_0x271bf2[_0xaaa7('0x11')][_0xaaa7('0x13')]);return _0x506d95(_0x271bf2['error']['message']);}logger['error'](_0xaaa7('0xc'),_0x38f27e,_0x271bf2[_0xaaa7('0x11')][_0xaaa7('0x13')]);return _0xc230bd(_0x271bf2[_0xaaa7('0x11')][_0xaaa7('0x13')]);}else{logger[_0xaaa7('0x14')]('Attachment,\x20%s,\x20%s',_0x38f27e,_0xaaa7('0xd'));_0xc230bd(_0x271bf2['result'][_0xaaa7('0x13')]);}})['catch'](function(_0x30bc79){logger[_0xaaa7('0x11')](_0xaaa7('0xc'),_0x38f27e,_0x30bc79);_0x506d95(_0x30bc79);});});}exports[_0xaaa7('0x15')]=function(_0x437d59){var _0x7e069f=this;return new Promise(function(_0xe9e6b1,_0x41cddc){return db['Attachment']['create'](_0x437d59[_0xaaa7('0x16')],{'raw':_0x437d59['options']?_0x437d59['options'][_0xaaa7('0x17')]===undefined?!![]:![]:!![]})[_0xaaa7('0xb')](function(_0x247083){logger['info']('CreateAttachment',_0x437d59);logger[_0xaaa7('0xe')](_0xaaa7('0x15'),_0x437d59,JSON[_0xaaa7('0x10')](_0x247083));_0xe9e6b1(_0x247083);})[_0xaaa7('0x18')](function(_0x3ea5e6){logger[_0xaaa7('0x11')](_0xaaa7('0x15'),_0x3ea5e6['message'],_0x437d59);_0x41cddc(_0x7e069f[_0xaaa7('0x11')](0x1f4,_0x3ea5e6['message']));});});}; \ No newline at end of file +var _0x2445=['result','catch','Attachment','body','options','raw','CreateAttachment','debug','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2084a2,_0x5c8a0c){var _0x3c87e9=function(_0xd88699){while(--_0xd88699){_0x2084a2['push'](_0x2084a2['shift']());}};_0x3c87e9(++_0x5c8a0c);}(_0x2445,0xaa));var _0x5244=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x2445[_0x2080a3];return _0x8d7d17;};'use strict';var _=require(_0x5244('0x0'));var util=require(_0x5244('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5244('0x2'));var db=require(_0x5244('0x3'))['db'];var utils=require(_0x5244('0x4'));var logger=require('../../config/logger')(_0x5244('0x5'));var config=require(_0x5244('0x6'));var jayson=require(_0x5244('0x7'));var client=jayson[_0x5244('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59aa67,_0x184428,_0x32ce4b){return new BPromise(function(_0x3b238c,_0x3ef9d1){return client[_0x5244('0x9')](_0x59aa67,_0x32ce4b)[_0x5244('0xa')](function(_0x3e78f9){logger[_0x5244('0xb')](_0x5244('0xc'),_0x184428,_0x5244('0xd'));logger['debug'](_0x5244('0xe'),_0x184428,_0x5244('0xd'),JSON[_0x5244('0xf')](_0x3e78f9));if(_0x3e78f9[_0x5244('0x10')]){if(_0x3e78f9[_0x5244('0x10')][_0x5244('0x11')]===0x1f4){logger[_0x5244('0x10')]('Attachment,\x20%s,\x20%s',_0x184428,_0x3e78f9[_0x5244('0x10')][_0x5244('0x12')]);return _0x3ef9d1(_0x3e78f9['error'][_0x5244('0x12')]);}logger[_0x5244('0x10')](_0x5244('0xc'),_0x184428,_0x3e78f9[_0x5244('0x10')][_0x5244('0x12')]);return _0x3b238c(_0x3e78f9[_0x5244('0x10')][_0x5244('0x12')]);}else{logger[_0x5244('0xb')](_0x5244('0xc'),_0x184428,_0x5244('0xd'));_0x3b238c(_0x3e78f9[_0x5244('0x13')][_0x5244('0x12')]);}})[_0x5244('0x14')](function(_0xe66b88){logger[_0x5244('0x10')](_0x5244('0xc'),_0x184428,_0xe66b88);_0x3ef9d1(_0xe66b88);});});}exports['CreateAttachment']=function(_0x7a58da){var _0x5486bb=this;return new Promise(function(_0x3fbc9e,_0x3b5db0){return db[_0x5244('0x15')]['create'](_0x7a58da[_0x5244('0x16')],{'raw':_0x7a58da[_0x5244('0x17')]?_0x7a58da[_0x5244('0x17')][_0x5244('0x18')]===undefined?!![]:![]:!![]})[_0x5244('0xa')](function(_0x57a653){logger[_0x5244('0xb')](_0x5244('0x19'),_0x7a58da);logger[_0x5244('0x1a')](_0x5244('0x19'),_0x7a58da,JSON['stringify'](_0x57a653));_0x3fbc9e(_0x57a653);})[_0x5244('0x14')](function(_0x151380){logger[_0x5244('0x10')](_0x5244('0x19'),_0x151380['message'],_0x7a58da);_0x3b5db0(_0x5486bb[_0x5244('0x10')](0x1f4,_0x151380[_0x5244('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index f9a57c1..cbb2bda 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 _0xdf5d=['single','file','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./attachment.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace'];(function(_0x2de020,_0x252df0){var _0x182b7c=function(_0xcbcdaa){while(--_0xcbcdaa){_0x2de020['push'](_0x2de020['shift']());}};_0x182b7c(++_0x252df0);}(_0xdf5d,0x126));var _0xddf5=function(_0x49954c,_0x54b943){_0x49954c=_0x49954c-0x0;var _0xe3e238=_0xdf5d[_0x49954c];return _0xe3e238;};'use strict';var multer=require(_0xddf5('0x0'));var util=require(_0xddf5('0x1'));var path=require(_0xddf5('0x2'));var timeout=require(_0xddf5('0x3'));var express=require(_0xddf5('0x4'));var router=express[_0xddf5('0x5')]();var auth=require(_0xddf5('0x6'));var interaction=require(_0xddf5('0x7'));var config=require('../../config/environment');var controller=require(_0xddf5('0x8'));router[_0xddf5('0x9')]('/',auth[_0xddf5('0xa')](),controller[_0xddf5('0xb')]);router[_0xddf5('0x9')](_0xddf5('0xc'),auth[_0xddf5('0xa')](),controller[_0xddf5('0xd')]);router[_0xddf5('0x9')](_0xddf5('0xe'),auth[_0xddf5('0xa')](),controller[_0xddf5('0xf')]);router[_0xddf5('0x10')](_0xddf5('0x11'),auth[_0xddf5('0xa')](),controller[_0xddf5('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x161973,_0x3d3fc3,_0x72f146){_0x72f146(null,path[_0xddf5('0x13')](config[_0xddf5('0x14')],_0xddf5('0x15')));},'filename':function(_0x434418,_0x3779e4,_0x5607a2){_0x5607a2(null,util['format'](_0xddf5('0x16'),Date[_0xddf5('0x17')](),_0x3779e4[_0xddf5('0x18')][_0xddf5('0x19')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xddf5('0x10')]('/',upload[_0xddf5('0x1a')](_0xddf5('0x1b')),controller[_0xddf5('0x1c')]);router['put'](_0xddf5('0xc'),auth[_0xddf5('0xa')](),controller[_0xddf5('0x1d')]);router[_0xddf5('0x1e')](_0xddf5('0xc'),auth['isAuthenticated'](),controller[_0xddf5('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x8cda=['../../components/auth/service','../../config/environment','./attachment.controller','get','index','/:id','isAuthenticated','show','/:id/download','diskStorage','join','format','%s-%s','originalname','post','file','put','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_0x8cda,0x1db));var _0xa8cd=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8cda[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0xa8cd('0x0'));var path=require(_0xa8cd('0x1'));var timeout=require(_0xa8cd('0x2'));var express=require(_0xa8cd('0x3'));var router=express[_0xa8cd('0x4')]();var auth=require(_0xa8cd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa8cd('0x6'));var controller=require(_0xa8cd('0x7'));router[_0xa8cd('0x8')]('/',auth['isAuthenticated'](),controller[_0xa8cd('0x9')]);router[_0xa8cd('0x8')](_0xa8cd('0xa'),auth[_0xa8cd('0xb')](),controller[_0xa8cd('0xc')]);router[_0xa8cd('0x8')](_0xa8cd('0xd'),auth[_0xa8cd('0xb')](),controller['download']);router['post']('/:id/clone',auth[_0xa8cd('0xb')](),controller['clone']);var upload=multer({'storage':multer[_0xa8cd('0xe')]({'destination':function(_0x3e6bed,_0x4ae00e,_0x8ee1a5){_0x8ee1a5(null,path[_0xa8cd('0xf')](config['root'],'server/files/attachments/'));},'filename':function(_0xec5e4,_0xa2b804,_0x19ba69){_0x19ba69(null,util[_0xa8cd('0x10')](_0xa8cd('0x11'),Date['now'](),_0xa2b804[_0xa8cd('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa8cd('0x13')]('/',upload['single'](_0xa8cd('0x14')),controller['create']);router[_0xa8cd('0x15')](_0xa8cd('0xa'),auth[_0xa8cd('0xb')](),controller['update']);router['delete'](_0xa8cd('0xa'),auth[_0xa8cd('0xb')](),controller[_0xa8cd('0x16')]);module[_0xa8cd('0x17')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 69984af..98e2df4 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 _0xfe9e=['profile','/login','use','clientSecret','Setting','findOne','allowedLoginAttempts','then','find','map','value','admin','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','add','blockDuration','minutes','getLicense','catch','lodash','passport','moment','../../mysqldb','../../components/auth/service','signToken','../../config/utils','login','authenticate','google'];(function(_0x1db557,_0x445132){var _0x1a8321=function(_0x1f1a81){while(--_0x1f1a81){_0x1db557['push'](_0x1db557['shift']());}};_0x1a8321(++_0x445132);}(_0xfe9e,0xb0));var _0xefe9=function(_0x3b80d6,_0x18a56a){_0x3b80d6=_0x3b80d6-0x0;var _0x4e08f1=_0xfe9e[_0x3b80d6];return _0x4e08f1;};'use strict';var _=require(_0xefe9('0x0'));var passport=require(_0xefe9('0x1'));var GoogleStrategy=require('passport-google-oauth20')['Strategy'];var moment=require(_0xefe9('0x2'));var db=require(_0xefe9('0x3'))['db'];var config=require('../../config/environment');var signToken=require(_0xefe9('0x4'))[_0xefe9('0x5')];var utils=require(_0xefe9('0x6'));exports[_0xefe9('0x7')]=passport[_0xefe9('0x8')](_0xefe9('0x9'),{'failureRedirect':'/login','scope':[_0xefe9('0xa'),'email'],'session':![]});exports['callback']=passport[_0xefe9('0x8')](_0xefe9('0x9'),{'failureRedirect':_0xefe9('0xb'),'session':![]});passport[_0xefe9('0xc')](new GoogleStrategy({'clientID':config[_0xefe9('0x9')]?config[_0xefe9('0x9')]['clientID']:'id','clientSecret':config[_0xefe9('0x9')]?config[_0xefe9('0x9')][_0xefe9('0xd')]:'secret','callbackURL':config[_0xefe9('0x9')]?config[_0xefe9('0x9')]['callbackURL']:''},function(_0xac5d09,_0x904da7,_0x516cc7,_0xb4aba9){var _0x23841d,_0x4cd309;return db[_0xefe9('0xe')][_0xefe9('0xf')]({'where':{'id':0x1},'attributes':[_0xefe9('0x10'),'blockDuration'],'raw':!![]})[_0xefe9('0x11')](function(_0xe249a6){_0x23841d=_0xe249a6;return db['User'][_0xefe9('0x12')]({'where':{'email':_[_0xefe9('0x13')](_0x516cc7['emails'],_0xefe9('0x14')),'role':{'$or':[_0xefe9('0x15'),'user',_0xefe9('0x16')]}}});})[_0xefe9('0x11')](function(_0x244621){_0x4cd309=_0x244621;if(_0x4cd309){if(_0x4cd309[_0xefe9('0x17')]){return _0xb4aba9(_0xefe9('0x18'));}else if(_0x23841d['blockDuration']>0x0){if(_0x4cd309[_0xefe9('0x19')]){if(moment(_0x4cd309['blockedAt'])[_0xefe9('0x1a')](_0x23841d[_0xefe9('0x1b')],_0xefe9('0x1c'))>moment()){return _0xb4aba9(_0xefe9('0x18'));}else{return utils['clearBlockUser'](_0x4cd309,0x0,![],null)['then'](function(){return utils[_0xefe9('0x1d')](_0x4cd309);})['then'](function(){return _0xb4aba9(null,_0x4cd309);});}}else{return utils['getLicense'](_0x4cd309)[_0xefe9('0x11')](function(){return _0xb4aba9(null,_0x4cd309);});}}else{return utils[_0xefe9('0x1d')](_0x4cd309)[_0xefe9('0x11')](function(){return _0xb4aba9(null,_0x4cd309);});}}return _0xb4aba9(_0xefe9('0x18'));})[_0xefe9('0x1e')](function(_0x5433a1){_0xb4aba9(_0x5433a1);});})); \ No newline at end of file +var _0x263b=['emails','value','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','lodash','passport','moment','../../mysqldb','../../components/auth/service','signToken','../../config/utils','profile','email','callback','authenticate','google','/login','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','then','User','find','map'];(function(_0x58cd35,_0x4b5240){var _0x4576c4=function(_0x323ce9){while(--_0x323ce9){_0x58cd35['push'](_0x58cd35['shift']());}};_0x4576c4(++_0x4b5240);}(_0x263b,0x96));var _0xb263=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x263b[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xb263('0x0'));var passport=require(_0xb263('0x1'));var GoogleStrategy=require('passport-google-oauth20')['Strategy'];var moment=require(_0xb263('0x2'));var db=require(_0xb263('0x3'))['db'];var config=require('../../config/environment');var signToken=require(_0xb263('0x4'))[_0xb263('0x5')];var utils=require(_0xb263('0x6'));exports['login']=passport['authenticate']('google',{'failureRedirect':'/login','scope':[_0xb263('0x7'),_0xb263('0x8')],'session':![]});exports[_0xb263('0x9')]=passport[_0xb263('0xa')](_0xb263('0xb'),{'failureRedirect':_0xb263('0xc'),'session':![]});passport[_0xb263('0xd')](new GoogleStrategy({'clientID':config['google']?config[_0xb263('0xb')][_0xb263('0xe')]:'id','clientSecret':config['google']?config[_0xb263('0xb')][_0xb263('0xf')]:_0xb263('0x10'),'callbackURL':config['google']?config[_0xb263('0xb')][_0xb263('0x11')]:''},function(_0x1ffffd,_0x38da95,_0x1ae2a5,_0x5c0e99){var _0x19ca19,_0x47a94c;return db[_0xb263('0x12')][_0xb263('0x13')]({'where':{'id':0x1},'attributes':[_0xb263('0x14'),'blockDuration'],'raw':!![]})[_0xb263('0x15')](function(_0x21b330){_0x19ca19=_0x21b330;return db[_0xb263('0x16')][_0xb263('0x17')]({'where':{'email':_[_0xb263('0x18')](_0x1ae2a5[_0xb263('0x19')],_0xb263('0x1a')),'role':{'$or':['admin',_0xb263('0x1b'),_0xb263('0x1c')]}}});})[_0xb263('0x15')](function(_0x1287e2){_0x47a94c=_0x1287e2;if(_0x47a94c){if(_0x47a94c['disabled']){return _0x5c0e99(_0xb263('0x1d'));}else if(_0x19ca19[_0xb263('0x1e')]>0x0){if(_0x47a94c[_0xb263('0x1f')]){if(moment(_0x47a94c[_0xb263('0x20')])[_0xb263('0x21')](_0x19ca19[_0xb263('0x1e')],'minutes')>moment()){return _0x5c0e99(_0xb263('0x1d'));}else{return utils['clearBlockUser'](_0x47a94c,0x0,![],null)['then'](function(){return utils[_0xb263('0x22')](_0x47a94c);})[_0xb263('0x15')](function(){return _0x5c0e99(null,_0x47a94c);});}}else{return utils[_0xb263('0x22')](_0x47a94c)['then'](function(){return _0x5c0e99(null,_0x47a94c);});}}else{return utils[_0xb263('0x22')](_0x47a94c)[_0xb263('0x15')](function(){return _0x5c0e99(null,_0x47a94c);});}}return _0x5c0e99('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})['catch'](function(_0x3c9a9d){_0x5c0e99(_0x3c9a9d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index f85c2f6..0589b3e 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 _0x39cb=['/callback','callback','isMiddleware','setTokenCookie','exports','passport','Router','../user/user.controller.js','../../components/auth/service','login','get'];(function(_0x2be3be,_0x2c03e1){var _0x619e24=function(_0x95d8fc){while(--_0x95d8fc){_0x2be3be['push'](_0x2be3be['shift']());}};_0x619e24(++_0x2c03e1);}(_0x39cb,0x1bd));var _0xb39c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x39cb[_0x167cc1];return _0x10bc4b;};'use strict';var express=require('express');var passport=require(_0xb39c('0x0'));var router=express[_0xb39c('0x1')]();var controller=require('./authGoogle.controller');var userController=require(_0xb39c('0x2'));var authService=require(_0xb39c('0x3'));router['get']('/',controller[_0xb39c('0x4')]);router[_0xb39c('0x5')](_0xb39c('0x6'),controller[_0xb39c('0x7')],authService[_0xb39c('0x8')],userController['login'],authService[_0xb39c('0x9')]);module[_0xb39c('0xa')]=router; \ No newline at end of file +var _0x6597=['get','callback','isMiddleware','login','setTokenCookie','exports','express','passport','Router','../user/user.controller.js'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x6597,0x16e));var _0x7659=function(_0xe3581a,_0x354854){_0xe3581a=_0xe3581a-0x0;var _0x562cd5=_0x6597[_0xe3581a];return _0x562cd5;};'use strict';var express=require(_0x7659('0x0'));var passport=require(_0x7659('0x1'));var router=express[_0x7659('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0x7659('0x3'));var authService=require('../../components/auth/service');router[_0x7659('0x4')]('/',controller['login']);router['get']('/callback',controller[_0x7659('0x5')],authService[_0x7659('0x6')],userController[_0x7659('0x7')],authService[_0x7659('0x8')]);module[_0x7659('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index e12f83d..f4b2333 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 _0x1f75=['user','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','login','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','body','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','resetPasswordExpires','now','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','host','/reset/','send','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','password','securePassword','resetPasswordToken','status','use','util','passport','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','blockDuration','then','findOne','name','role','disabled','blocked','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','add','minutes','clearBlockUser','allowedLoginAttempts','catch','getLicense','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','port','secure','authentication','merge','format','\x22%s\x22\x20<%s>'];(function(_0x42a80a,_0x55bbe4){var _0x2429f4=function(_0x43bf0f){while(--_0x43bf0f){_0x42a80a['push'](_0x42a80a['shift']());}};_0x2429f4(++_0x55bbe4);}(_0x1f75,0x12c));var _0x51f7=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x1f75[_0x5608a3];return _0x1ed50a;};'use strict';var util=require(_0x51f7('0x0'));var passport=require(_0x51f7('0x1'));var LocalStrategy=require(_0x51f7('0x2'))['Strategy'];var jayson=require(_0x51f7('0x3'));var _=require(_0x51f7('0x4'));var rs=require(_0x51f7('0x5'));var moment=require(_0x51f7('0x6'));var db=require(_0x51f7('0x7'))['db'];var authService=require(_0x51f7('0x8'));var utils=require(_0x51f7('0x9'));var client=jayson[_0x51f7('0xa')][_0x51f7('0xb')]({'port':0x232b});function localAuthenticate(_0x22fc29,_0x3eb36d,_0x471057,_0x5a1f98){var _0x2d944f,_0x7a9c0c;return db[_0x51f7('0xc')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x51f7('0xd')],'raw':!![]})[_0x51f7('0xe')](function(_0x579ee9){_0x2d944f=_0x579ee9;return _0x22fc29[_0x51f7('0xf')]({'attributes':['id',_0x51f7('0x10'),'password','salt',_0x51f7('0x11'),_0x51f7('0x12'),_0x51f7('0x13'),'blockedAt',_0x51f7('0x14')],'where':{'name':_0x3eb36d,'role':{'$or':[_0x51f7('0x15'),'user',_0x51f7('0x16')]}}});})[_0x51f7('0xe')](function(_0x28e8fe){if(!_0x28e8fe||_0x28e8fe&&_0x28e8fe['name']!==_0x3eb36d){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x7a9c0c=_0x28e8fe;return _0x7a9c0c;}})[_0x51f7('0xe')](function(){_0x7a9c0c['authenticate'](_0x471057,function(_0x5b8dba,_0x4e2f85){var _0x199d2e=_0x7a9c0c[_0x51f7('0x14')]+0x1;if(_0x5b8dba){return _0x5a1f98(_0x5b8dba);}else if(!_0x4e2f85){if(_0x7a9c0c[_0x51f7('0x12')]){return _0x5a1f98(null,![],{'message':_0x51f7('0x17')});}else if(_0x2d944f['allowedLoginAttempts']>0x0){if(_0x7a9c0c[_0x51f7('0x13')]){if(_0x2d944f[_0x51f7('0xd')]>0x0){if(moment(_0x7a9c0c[_0x51f7('0x18')])[_0x51f7('0x19')](_0x2d944f[_0x51f7('0xd')],_0x51f7('0x1a'))>moment()){return _0x5a1f98(null,![],{'message':_0x51f7('0x17')});}else{return utils[_0x51f7('0x1b')](_0x7a9c0c,_0x199d2e,![],null)[_0x51f7('0xe')](function(){return _0x5a1f98(null,![],{'message':_0x51f7('0x17')});});}}else{return _0x5a1f98(null,![],{'message':_0x51f7('0x17')});}}else{if(_0x199d2e>=_0x2d944f['allowedLoginAttempts']){return utils['clearBlockUser'](_0x7a9c0c,0x0,!![],moment())[_0x51f7('0xe')](function(){return _0x5a1f98(null,![],{'message':_0x51f7('0x17')});});}else{return utils['clearBlockUser'](_0x7a9c0c,_0x199d2e,![],null)[_0x51f7('0xe')](function(){return _0x5a1f98(null,![],{'message':_0x51f7('0x17')});});}}}else{return _0x5a1f98(null,![],{'message':_0x51f7('0x17')});}}else{if(_0x7a9c0c['disabled']){return _0x5a1f98(null,![],{'message':_0x51f7('0x17')});}else if(_0x2d944f[_0x51f7('0x1c')]>0x0){if(_0x7a9c0c[_0x51f7('0x13')]){if(_0x2d944f['blockDuration']>0x0){if(moment(_0x7a9c0c[_0x51f7('0x18')])[_0x51f7('0x19')](_0x2d944f[_0x51f7('0xd')],'minutes')>moment()){return _0x5a1f98(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x51f7('0x1b')](_0x7a9c0c,0x0,![],null)[_0x51f7('0xe')](function(){return utils['getLicense'](_0x7a9c0c);})[_0x51f7('0xe')](function(){return _0x5a1f98(null,_0x7a9c0c);});}}else{return _0x5a1f98(null,![],{'message':_0x51f7('0x17')});}}else{return utils['clearBlockUser'](_0x7a9c0c,0x0,![],null)['then'](function(){return utils['getLicense'](_0x7a9c0c);})[_0x51f7('0xe')](function(){return _0x5a1f98(null,_0x7a9c0c);})[_0x51f7('0x1d')](function(_0x49970c){return _0x5a1f98(null,![],_0x49970c);});}}else{if(_0x7a9c0c[_0x51f7('0x13')]){return _0x5a1f98(null,![],{'message':_0x51f7('0x17')});}else{return utils[_0x51f7('0x1e')](_0x7a9c0c)[_0x51f7('0xe')](function(){return _0x5a1f98(null,_0x7a9c0c);});}}}});})[_0x51f7('0x1d')](function(_0x5ea14){return _0x5a1f98(null,![],_0x5ea14);});}function sendServiceMail(_0x2dc321){return db[_0x51f7('0x1f')][_0x51f7('0x20')]({'where':{'service':!![]},'attributes':['id',_0x51f7('0x10'),_0x51f7('0x21')],'include':[{'model':db[_0x51f7('0x22')],'as':_0x51f7('0x23')}]})[_0x51f7('0xe')](function(_0x81134){if(!_0x81134){throw new Error(_0x51f7('0x24'));}var _0x2ea8e6={'tls':{'rejectUnauthorized':![]}};if(_0x81134['Smtp'][_0x51f7('0x25')]){_0x2ea8e6['service']=_0x81134[_0x51f7('0x23')][_0x51f7('0x25')];}else{_0x2ea8e6['host']=_0x81134[_0x51f7('0x23')]['host'];_0x2ea8e6['port']=_0x81134[_0x51f7('0x23')][_0x51f7('0x26')];_0x2ea8e6[_0x51f7('0x27')]=_0x81134[_0x51f7('0x23')][_0x51f7('0x27')];}if(_0x81134[_0x51f7('0x23')][_0x51f7('0x28')]){_0x2ea8e6['auth']={'user':_0x81134[_0x51f7('0x23')]['user'],'pass':_0x81134['Smtp']['pass']};}var _0x213e6a={'account':_0x2ea8e6,'message':_[_0x51f7('0x29')]({'from':util[_0x51f7('0x2a')](_0x51f7('0x2b'),_0x81134[_0x51f7('0x10')],_0x81134[_0x51f7('0x21')]||_0x81134[_0x51f7('0x23')][_0x51f7('0x2c')])},_0x2dc321)};return client[_0x51f7('0x2d')]('SendMail',_0x213e6a);})[_0x51f7('0xe')](function(_0x5b2aab){if(_0x5b2aab[_0x51f7('0x2e')]){throw new Error(util[_0x51f7('0x2a')](_0x51f7('0x2f'),_0x5b2aab['error'][_0x51f7('0x30')]||JSON[_0x51f7('0x31')](_0x5b2aab[_0x51f7('0x2e')])));}return!![];});}function handleError(_0x3be22e,_0x233d4f,_0x187987){return _0x3be22e['status'](_0x233d4f||0x1f4)['send']({'message':_0x187987?_0x187987[_0x51f7('0x30')]||_0x187987:''});}function checkPasswordPattern(_0x572d17,_0x29092c,_0x446d79){if(_0x446d79){var _0xfd685c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xfd685c[_0x51f7('0x32')](_0x29092c)){return _0x572d17;}else{throw new Error(_0x51f7('0x33'));}}else{return _0x572d17;}}exports[_0x51f7('0x34')]=function(_0x5e5c0f,_0x520425,_0xfbbbc4){passport[_0x51f7('0x35')](_0x51f7('0x36'),function(_0x4ae533,_0x46aa25,_0x185398){var _0x16bfb3=_0x4ae533||_0x185398;if(_0x16bfb3){return handleError(_0x520425,0x191,_0x16bfb3);}if(!_0x46aa25){return handleError(_0x520425,0x194,{'message':_0x51f7('0x37')});}else{var _0x2f642b={'payload':{'id':_0x46aa25['id'],'role':_0x46aa25[_0x51f7('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0x51f7('0x38')](_0x2f642b)[_0x51f7('0xe')](function(_0x3e79cc){_0x520425[_0x51f7('0x39')]({'id':_0x46aa25['id'],'token':_0x3e79cc,'statusCall':'','isAlreadyLogged':_0x46aa25[_0x51f7('0x3a')]});});}})(_0x5e5c0f,_0x520425,_0xfbbbc4);};exports[_0x51f7('0x3b')]=function(_0x4cdcba,_0x813276,_0x38fdc1){if(!_0x4cdcba['body'][_0x51f7('0x21')]){return handleError(_0x813276,0x1f4,{'message':_0x51f7('0x3c')});}var _0x2f5c38=rs['generate']();_0x4cdcba[_0x51f7('0x3d')][_0x51f7('0x21')]=_0x4cdcba['body'][_0x51f7('0x21')][_0x51f7('0x3e')]()[_0x51f7('0x3f')]();var _0x5b1ae9;return db['Setting'][_0x51f7('0xf')]({'where':{'id':0x1},'attributes':[_0x51f7('0x1c'),_0x51f7('0xd')],'raw':!![]})[_0x51f7('0xe')](function(_0x25e4e7){_0x5b1ae9=_0x25e4e7;return db[_0x51f7('0x40')][_0x51f7('0x20')]({'where':{'email':_0x4cdcba[_0x51f7('0x3d')][_0x51f7('0x21')]}});})[_0x51f7('0xe')](function(_0x3d1a82){if(!_0x3d1a82){throw new Error(_0x51f7('0x41'));}if(_0x3d1a82['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x3d1a82[_0x51f7('0x13')]){if(moment(_0x3d1a82[_0x51f7('0x18')])[_0x51f7('0x19')](_0x5b1ae9[_0x51f7('0xd')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x3d1a82['blocked']=![];_0x3d1a82['blockedAt']=null;}}_0x3d1a82['resetPasswordToken']=_0x2f5c38;_0x3d1a82[_0x51f7('0x42')]=Date[_0x51f7('0x43')]()+0x36ee80;return _0x3d1a82[_0x51f7('0x44')]();})[_0x51f7('0xe')](function(){return sendServiceMail({'to':_0x4cdcba[_0x51f7('0x3d')][_0x51f7('0x21')],'subject':_0x51f7('0x45'),'text':_0x51f7('0x46')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x51f7('0x47')+_0x4cdcba[_0x51f7('0x48')][_0x51f7('0x49')]+_0x51f7('0x4a')+_0x2f5c38+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x51f7('0xe')](function(){_0x813276['status'](0xc8)[_0x51f7('0x4b')]({'message':_0x51f7('0x4c')});})[_0x51f7('0x1d')](function(_0x4d5255){return handleError(_0x813276,0x1f4,_0x4d5255);});};exports[_0x51f7('0x4d')]=function(_0x1103ba,_0x317988,_0x32783f){var _0x1b00dd;return db[_0x51f7('0x40')]['find']({'where':{'resetPasswordToken':_0x1103ba[_0x51f7('0x4e')][_0x51f7('0x4f')],'resetPasswordExpires':{'$gt':Date[_0x51f7('0x43')]()}}})[_0x51f7('0xe')](function(_0xf05f9){_0x1b00dd=_0xf05f9;if(!_0x1b00dd){throw new Error(_0x51f7('0x50'));}return db[_0x51f7('0xc')]['findOne']({'attributes':['id','securePassword']});})[_0x51f7('0xe')](function(_0x2eb955){return checkPasswordPattern(_0x2eb955,_0x1103ba[_0x51f7('0x3d')][_0x51f7('0x51')],_0x2eb955[_0x51f7('0x52')]);})['then'](function(){_0x1b00dd[_0x51f7('0x51')]=_0x1103ba[_0x51f7('0x3d')]['password'];_0x1b00dd[_0x51f7('0x53')]=null;_0x1b00dd[_0x51f7('0x42')]=null;return _0x1b00dd[_0x51f7('0x44')]();})[_0x51f7('0xe')](function(){_0x317988[_0x51f7('0x54')](0xc8)[_0x51f7('0x4b')]({'message':'Password\x20reset!'});})[_0x51f7('0x1d')](function(_0x473068){return handleError(_0x317988,0x1f4,_0x473068);});};passport[_0x51f7('0x55')](new LocalStrategy({'usernameField':_0x51f7('0x10'),'passwordField':_0x51f7('0x51')},function(_0x533280,_0x34f2da,_0x2054d6){return localAuthenticate(db[_0x51f7('0x40')],_0x533280,_0x34f2da,_0x2054d6);})); \ No newline at end of file +var _0x9a95=['You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','Password\x20reset!','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','client','http','Setting','then','findOne','name','password','salt','disabled','blocked','loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','blockDuration','blockedAt','add','clearBlockUser','minutes','getLicense','catch','MailAccount','email','MailServerOut','Smtp','service','host','port','secure','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','error','stringify','send','message','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','login','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x9a95,0xb5));var _0x59a9=function(_0x1d18f3,_0x105f37){_0x1d18f3=_0x1d18f3-0x0;var _0x9eae2c=_0x9a95[_0x1d18f3];return _0x9eae2c;};'use strict';var util=require(_0x59a9('0x0'));var passport=require(_0x59a9('0x1'));var LocalStrategy=require(_0x59a9('0x2'))[_0x59a9('0x3')];var jayson=require(_0x59a9('0x4'));var _=require(_0x59a9('0x5'));var rs=require(_0x59a9('0x6'));var moment=require(_0x59a9('0x7'));var db=require(_0x59a9('0x8'))['db'];var authService=require(_0x59a9('0x9'));var utils=require('../../config/utils');var client=jayson[_0x59a9('0xa')][_0x59a9('0xb')]({'port':0x232b});function localAuthenticate(_0x50daf2,_0x61ad8c,_0x11f566,_0x121c6b){var _0x771d83,_0x4ac4c5;return db[_0x59a9('0xc')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x59a9('0xd')](function(_0x232e58){_0x771d83=_0x232e58;return _0x50daf2[_0x59a9('0xe')]({'attributes':['id',_0x59a9('0xf'),_0x59a9('0x10'),_0x59a9('0x11'),'role',_0x59a9('0x12'),_0x59a9('0x13'),'blockedAt',_0x59a9('0x14')],'where':{'name':_0x61ad8c,'role':{'$or':[_0x59a9('0x15'),_0x59a9('0x16'),'agent']}}});})[_0x59a9('0xd')](function(_0x471141){if(!_0x471141||_0x471141&&_0x471141[_0x59a9('0xf')]!==_0x61ad8c){throw new Error(_0x59a9('0x17'));}else{_0x4ac4c5=_0x471141;return _0x4ac4c5;}})['then'](function(){_0x4ac4c5['authenticate'](_0x11f566,function(_0x9af21a,_0x14dc8a){var _0x167d09=_0x4ac4c5[_0x59a9('0x14')]+0x1;if(_0x9af21a){return _0x121c6b(_0x9af21a);}else if(!_0x14dc8a){if(_0x4ac4c5[_0x59a9('0x12')]){return _0x121c6b(null,![],{'message':_0x59a9('0x17')});}else if(_0x771d83[_0x59a9('0x18')]>0x0){if(_0x4ac4c5[_0x59a9('0x13')]){if(_0x771d83[_0x59a9('0x19')]>0x0){if(moment(_0x4ac4c5[_0x59a9('0x1a')])[_0x59a9('0x1b')](_0x771d83['blockDuration'],'minutes')>moment()){return _0x121c6b(null,![],{'message':_0x59a9('0x17')});}else{return utils[_0x59a9('0x1c')](_0x4ac4c5,_0x167d09,![],null)['then'](function(){return _0x121c6b(null,![],{'message':_0x59a9('0x17')});});}}else{return _0x121c6b(null,![],{'message':_0x59a9('0x17')});}}else{if(_0x167d09>=_0x771d83[_0x59a9('0x18')]){return utils[_0x59a9('0x1c')](_0x4ac4c5,0x0,!![],moment())[_0x59a9('0xd')](function(){return _0x121c6b(null,![],{'message':_0x59a9('0x17')});});}else{return utils['clearBlockUser'](_0x4ac4c5,_0x167d09,![],null)[_0x59a9('0xd')](function(){return _0x121c6b(null,![],{'message':_0x59a9('0x17')});});}}}else{return _0x121c6b(null,![],{'message':_0x59a9('0x17')});}}else{if(_0x4ac4c5[_0x59a9('0x12')]){return _0x121c6b(null,![],{'message':_0x59a9('0x17')});}else if(_0x771d83[_0x59a9('0x18')]>0x0){if(_0x4ac4c5[_0x59a9('0x13')]){if(_0x771d83[_0x59a9('0x19')]>0x0){if(moment(_0x4ac4c5[_0x59a9('0x1a')])['add'](_0x771d83['blockDuration'],_0x59a9('0x1d'))>moment()){return _0x121c6b(null,![],{'message':_0x59a9('0x17')});}else{return utils[_0x59a9('0x1c')](_0x4ac4c5,0x0,![],null)[_0x59a9('0xd')](function(){return utils[_0x59a9('0x1e')](_0x4ac4c5);})[_0x59a9('0xd')](function(){return _0x121c6b(null,_0x4ac4c5);});}}else{return _0x121c6b(null,![],{'message':_0x59a9('0x17')});}}else{return utils[_0x59a9('0x1c')](_0x4ac4c5,0x0,![],null)[_0x59a9('0xd')](function(){return utils[_0x59a9('0x1e')](_0x4ac4c5);})[_0x59a9('0xd')](function(){return _0x121c6b(null,_0x4ac4c5);})[_0x59a9('0x1f')](function(_0x217b45){return _0x121c6b(null,![],_0x217b45);});}}else{if(_0x4ac4c5[_0x59a9('0x13')]){return _0x121c6b(null,![],{'message':_0x59a9('0x17')});}else{return utils['getLicense'](_0x4ac4c5)[_0x59a9('0xd')](function(){return _0x121c6b(null,_0x4ac4c5);});}}}});})[_0x59a9('0x1f')](function(_0x1e1c3b){return _0x121c6b(null,![],_0x1e1c3b);});}function sendServiceMail(_0x4cac34){return db[_0x59a9('0x20')]['find']({'where':{'service':!![]},'attributes':['id','name',_0x59a9('0x21')],'include':[{'model':db[_0x59a9('0x22')],'as':_0x59a9('0x23')}]})['then'](function(_0x4bf998){if(!_0x4bf998){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x2d3e9a={'tls':{'rejectUnauthorized':![]}};if(_0x4bf998[_0x59a9('0x23')][_0x59a9('0x24')]){_0x2d3e9a['service']=_0x4bf998[_0x59a9('0x23')][_0x59a9('0x24')];}else{_0x2d3e9a[_0x59a9('0x25')]=_0x4bf998[_0x59a9('0x23')][_0x59a9('0x25')];_0x2d3e9a['port']=_0x4bf998['Smtp'][_0x59a9('0x26')];_0x2d3e9a['secure']=_0x4bf998[_0x59a9('0x23')][_0x59a9('0x27')];}if(_0x4bf998['Smtp']['authentication']){_0x2d3e9a[_0x59a9('0x28')]={'user':_0x4bf998['Smtp'][_0x59a9('0x16')],'pass':_0x4bf998[_0x59a9('0x23')][_0x59a9('0x29')]};}var _0x5434f4={'account':_0x2d3e9a,'message':_[_0x59a9('0x2a')]({'from':util[_0x59a9('0x2b')](_0x59a9('0x2c'),_0x4bf998['name'],_0x4bf998[_0x59a9('0x21')]||_0x4bf998[_0x59a9('0x23')][_0x59a9('0x16')])},_0x4cac34)};return client[_0x59a9('0x2d')]('SendMail',_0x5434f4);})[_0x59a9('0xd')](function(_0x245140){if(_0x245140['error']){throw new Error(util[_0x59a9('0x2b')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x245140[_0x59a9('0x2e')]['message']||JSON[_0x59a9('0x2f')](_0x245140[_0x59a9('0x2e')])));}return!![];});}function handleError(_0x4212af,_0x1b4ea0,_0x2afb37){return _0x4212af['status'](_0x1b4ea0||0x1f4)[_0x59a9('0x30')]({'message':_0x2afb37?_0x2afb37[_0x59a9('0x31')]||_0x2afb37:''});}function checkPasswordPattern(_0x576255,_0x40a2a8,_0x52d089){if(_0x52d089){var _0x43eff7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x43eff7[_0x59a9('0x32')](_0x40a2a8)){return _0x576255;}else{throw new Error(_0x59a9('0x33'));}}else{return _0x576255;}}exports[_0x59a9('0x34')]=function(_0x4856a0,_0xce728a,_0x3a3932){passport[_0x59a9('0x35')](_0x59a9('0x36'),function(_0x187226,_0x56e166,_0x40e33b){var _0xeda7ad=_0x187226||_0x40e33b;if(_0xeda7ad){return handleError(_0xce728a,0x191,_0xeda7ad);}if(!_0x56e166){return handleError(_0xce728a,0x194,{'message':_0x59a9('0x37')});}else{var _0x12c56c={'payload':{'id':_0x56e166['id'],'role':_0x56e166[_0x59a9('0x38')]},'options':{'expiresIn':0x15180}};return authService[_0x59a9('0x39')](_0x12c56c)[_0x59a9('0xd')](function(_0x4a04ba){_0xce728a[_0x59a9('0x3a')]({'id':_0x56e166['id'],'token':_0x4a04ba,'statusCall':'','isAlreadyLogged':_0x56e166[_0x59a9('0x3b')]});});}})(_0x4856a0,_0xce728a,_0x3a3932);};exports[_0x59a9('0x3c')]=function(_0x56204b,_0x1886c6,_0x32b4c6){if(!_0x56204b[_0x59a9('0x3d')][_0x59a9('0x21')]){return handleError(_0x1886c6,0x1f4,{'message':_0x59a9('0x3e')});}var _0x394909=rs[_0x59a9('0x3f')]();_0x56204b[_0x59a9('0x3d')]['email']=_0x56204b[_0x59a9('0x3d')][_0x59a9('0x21')][_0x59a9('0x40')]()['toLowerCase']();var _0x6d0081;return db[_0x59a9('0xc')][_0x59a9('0xe')]({'where':{'id':0x1},'attributes':[_0x59a9('0x18'),_0x59a9('0x19')],'raw':!![]})[_0x59a9('0xd')](function(_0x2e5b16){_0x6d0081=_0x2e5b16;return db[_0x59a9('0x41')][_0x59a9('0x42')]({'where':{'email':_0x56204b[_0x59a9('0x3d')][_0x59a9('0x21')]}});})[_0x59a9('0xd')](function(_0x4655be){if(!_0x4655be){throw new Error(_0x59a9('0x43'));}if(_0x4655be[_0x59a9('0x12')]){throw new Error(_0x59a9('0x44'));}if(_0x4655be['blocked']){if(moment(_0x4655be[_0x59a9('0x1a')])[_0x59a9('0x1b')](_0x6d0081[_0x59a9('0x19')],_0x59a9('0x1d'))>moment()){throw new Error(_0x59a9('0x45'));}else{_0x4655be[_0x59a9('0x13')]=![];_0x4655be[_0x59a9('0x1a')]=null;}}_0x4655be[_0x59a9('0x46')]=_0x394909;_0x4655be[_0x59a9('0x47')]=Date[_0x59a9('0x48')]()+0x36ee80;return _0x4655be['save']();})[_0x59a9('0xd')](function(){return sendServiceMail({'to':_0x56204b[_0x59a9('0x3d')][_0x59a9('0x21')],'subject':_0x59a9('0x49'),'text':_0x59a9('0x4a')+_0x59a9('0x4b')+_0x59a9('0x4c')+_0x56204b['headers'][_0x59a9('0x25')]+_0x59a9('0x4d')+_0x394909+'\x0a\x0a'+_0x59a9('0x4e')});})[_0x59a9('0xd')](function(){_0x1886c6[_0x59a9('0x4f')](0xc8)[_0x59a9('0x30')]({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x2e2cbd){return handleError(_0x1886c6,0x1f4,_0x2e2cbd);});};exports[_0x59a9('0x50')]=function(_0x310caa,_0x30bada,_0x3c7a1b){var _0x383241;return db[_0x59a9('0x41')][_0x59a9('0x42')]({'where':{'resetPasswordToken':_0x310caa[_0x59a9('0x51')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x59a9('0xd')](function(_0x4af35a){_0x383241=_0x4af35a;if(!_0x383241){throw new Error(_0x59a9('0x52'));}return db['Setting'][_0x59a9('0xe')]({'attributes':['id','securePassword']});})[_0x59a9('0xd')](function(_0x1551f6){return checkPasswordPattern(_0x1551f6,_0x310caa[_0x59a9('0x3d')]['password'],_0x1551f6[_0x59a9('0x53')]);})[_0x59a9('0xd')](function(){_0x383241[_0x59a9('0x10')]=_0x310caa[_0x59a9('0x3d')]['password'];_0x383241[_0x59a9('0x46')]=null;_0x383241[_0x59a9('0x47')]=null;return _0x383241['save']();})['then'](function(){_0x30bada['status'](0xc8)[_0x59a9('0x30')]({'message':_0x59a9('0x54')});})['catch'](function(_0x2f7c6e){return handleError(_0x30bada,0x1f4,_0x2f7c6e);});};passport['use'](new LocalStrategy({'usernameField':_0x59a9('0xf'),'passwordField':_0x59a9('0x10')},function(_0x1523cf,_0x4130fa,_0xf6fd78){return localAuthenticate(db[_0x59a9('0x41')],_0x1523cf,_0x4130fa,_0xf6fd78);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 8786b5c..556b6d6 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 _0xd04b=['login','/forgot','forgot','/reset/:token','exports','./authLocal.controller','post'];(function(_0x5c13e8,_0x4ce31d){var _0x58a53f=function(_0x2d15ee){while(--_0x2d15ee){_0x5c13e8['push'](_0x5c13e8['shift']());}};_0x58a53f(++_0x4ce31d);}(_0xd04b,0x98));var _0xbd04=function(_0x521e10,_0x87e394){_0x521e10=_0x521e10-0x0;var _0x22dd28=_0xd04b[_0x521e10];return _0x22dd28;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0xbd04('0x0'));router[_0xbd04('0x1')]('/',controller[_0xbd04('0x2')]);router[_0xbd04('0x1')](_0xbd04('0x3'),controller[_0xbd04('0x4')]);router[_0xbd04('0x1')](_0xbd04('0x5'),controller['reset']);module[_0xbd04('0x6')]=router; \ No newline at end of file +var _0x2376=['Router','./authLocal.controller','post','/forgot','/reset/:token','reset','exports','express'];(function(_0x3d7365,_0x13ccfb){var _0x3d96ac=function(_0x24135e){while(--_0x24135e){_0x3d7365['push'](_0x3d7365['shift']());}};_0x3d96ac(++_0x13ccfb);}(_0x2376,0xbf));var _0x6237=function(_0x3989c5,_0x136ee7){_0x3989c5=_0x3989c5-0x0;var _0x104056=_0x2376[_0x3989c5];return _0x104056;};'use strict';var express=require(_0x6237('0x0'));var router=express[_0x6237('0x1')]();var controller=require(_0x6237('0x2'));router[_0x6237('0x3')]('/',controller['login']);router[_0x6237('0x3')](_0x6237('0x4'),controller['forgot']);router[_0x6237('0x3')](_0x6237('0x5'),controller[_0x6237('0x6')]);module[_0x6237('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 bcc14ac..93ce4e7 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 _0x0436=['STRING','INTEGER','sequelize','exports'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x0436,0x1d6));var _0x6043=function(_0x5359dc,_0x1d1d33){_0x5359dc=_0x5359dc-0x0;var _0x26cd87=_0x0436[_0x5359dc];return _0x26cd87;};'use strict';var Sequelize=require(_0x6043('0x0'));module[_0x6043('0x1')]={'name':{'type':Sequelize[_0x6043('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x6043('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x6043('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0xb794=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x4f68a8,_0x180ec1){var _0x1ad3e0=function(_0x464c3f){while(--_0x464c3f){_0x4f68a8['push'](_0x4f68a8['shift']());}};_0x1ad3e0(++_0x180ec1);}(_0xb794,0x134));var _0x4b79=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb794[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4b79('0x0'));module[_0x4b79('0x1')]={'name':{'type':Sequelize[_0x4b79('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x4b79('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x4b79('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x4b79('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 39f9ec3..58c28e8 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 _0x0aa0=['ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','status','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','end','sendStatus','error','name','index','map','Automation','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','VIRTUAL','options','where','includeAll','include','catch','show','find','create','body','params','addConditions','Condition','omit','getConditions','findOne','pick','addActions','Action','ids','getActions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv'];(function(_0x4e9a9a,_0x1a5c94){var _0x58bf51=function(_0x16bcb9){while(--_0x16bcb9){_0x4e9a9a['push'](_0x4e9a9a['shift']());}};_0x58bf51(++_0x1a5c94);}(_0x0aa0,0x94));var _0x00aa=function(_0x58a34b,_0x208e23){_0x58a34b=_0x58a34b-0x0;var _0xac80cf=_0x0aa0[_0x58a34b];return _0xac80cf;};'use strict';var pdf=require(_0x00aa('0x0'));var emlformat=require(_0x00aa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x00aa('0x2'));var jsonpatch=require(_0x00aa('0x3'));var rp=require(_0x00aa('0x4'));var moment=require(_0x00aa('0x5'));var BPromise=require(_0x00aa('0x6'));var Mustache=require('mustache');var util=require(_0x00aa('0x7'));var path=require('path');var sox=require(_0x00aa('0x8'));var csv=require(_0x00aa('0x9'));var ejs=require(_0x00aa('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x00aa('0xb'));var jsforce=require(_0x00aa('0xc'));var deskjs=require(_0x00aa('0xd'));var toCsv=require('to-csv');var querystring=require(_0x00aa('0xe'));var Papa=require(_0x00aa('0xf'));var Redis=require(_0x00aa('0x10'));var authService=require(_0x00aa('0x11'));var qs=require(_0x00aa('0x12'));var as=require(_0x00aa('0x13'));var hardwareService=require(_0x00aa('0x14'));var logger=require(_0x00aa('0x15'))('api');var utils=require(_0x00aa('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42a1b8,_0x51d2f9){_0x51d2f9=_0x51d2f9||0xcc;return function(_0x3d25ad){if(_0x3d25ad){return _0x42a1b8['sendStatus'](_0x51d2f9);}return _0x42a1b8['status'](_0x51d2f9)['end']();};}function respondWithResult(_0x4e83ad,_0x5a632c){_0x5a632c=_0x5a632c||0xc8;return function(_0x5a0d5b){if(_0x5a0d5b){return _0x4e83ad[_0x00aa('0x17')](_0x5a632c)['json'](_0x5a0d5b);}};}function respondWithFilteredResult(_0x22689c,_0x204e70){return function(_0x316634){if(_0x316634){var _0x1cccd4=_0x316634[_0x00aa('0x18')],_0x15639e=_0x204e70['offset'],_0x5cfd4d=_0x204e70[_0x00aa('0x19')]+_0x204e70[_0x00aa('0x1a')],_0x5b7c22;if(_0x5cfd4d>=_0x1cccd4){_0x5cfd4d=_0x1cccd4;_0x5b7c22=0xc8;}else{_0x5b7c22=0xce;}_0x22689c['status'](_0x5b7c22);return _0x22689c[_0x00aa('0x1b')](_0x00aa('0x1c'),_0x15639e+'-'+_0x5cfd4d+'/'+_0x1cccd4)['json'](_0x316634);}return null;};}function patchUpdates(_0x5cfb33){return function(_0x49b575){try{jsonpatch[_0x00aa('0x1d')](_0x49b575,_0x5cfb33,!![]);}catch(_0x1da687){return BPromise['reject'](_0x1da687);}return _0x49b575[_0x00aa('0x1e')]();};}function saveUpdates(_0x1aefe1,_0x5d6179){return function(_0x3fda77){if(_0x3fda77){return _0x3fda77[_0x00aa('0x1f')](_0x1aefe1)['then'](function(_0x1f0e03){return _0x1f0e03;});}return null;};}function removeEntity(_0x47ebc4,_0x3291be){return function(_0x1945c3){if(_0x1945c3){return _0x1945c3[_0x00aa('0x20')]()[_0x00aa('0x21')](function(){_0x47ebc4['status'](0xcc)[_0x00aa('0x22')]();});}};}function handleEntityNotFound(_0x3999fa,_0x3dccfd){return function(_0x4da095){if(!_0x4da095){_0x3999fa[_0x00aa('0x23')](0x194);}return _0x4da095;};}function handleError(_0x44031e,_0x2614bf){_0x2614bf=_0x2614bf||0x1f4;return function(_0x4fbe66){logger[_0x00aa('0x24')](_0x4fbe66['stack']);if(_0x4fbe66[_0x00aa('0x25')]){delete _0x4fbe66['name'];}_0x44031e[_0x00aa('0x17')](_0x2614bf)['send'](_0x4fbe66);};}exports[_0x00aa('0x26')]=function(_0x34f0cf,_0x20e13e){var _0xfb2c44={},_0x56c95a={},_0x4c90c5={'count':0x0,'rows':[]};var _0x2139e5=_[_0x00aa('0x27')](db[_0x00aa('0x28')][_0x00aa('0x29')],function(_0x291bc7){return{'name':_0x291bc7['fieldName'],'type':_0x291bc7[_0x00aa('0x2a')][_0x00aa('0x2b')]};});_0x56c95a[_0x00aa('0x2c')]=_[_0x00aa('0x27')](_0x2139e5,'name');_0x56c95a[_0x00aa('0x2d')]=_[_0x00aa('0x2e')](_0x34f0cf[_0x00aa('0x2d')]);_0x56c95a['filters']=_[_0x00aa('0x2f')](_0x56c95a[_0x00aa('0x2c')],_0x56c95a[_0x00aa('0x2d')]);_0xfb2c44[_0x00aa('0x30')]=_[_0x00aa('0x2f')](_0x56c95a['model'],qs['fields'](_0x34f0cf[_0x00aa('0x2d')][_0x00aa('0x31')]));_0xfb2c44[_0x00aa('0x30')]=_0xfb2c44[_0x00aa('0x30')][_0x00aa('0x32')]?_0xfb2c44['attributes']:_0x56c95a[_0x00aa('0x2c')];if(!_0x34f0cf[_0x00aa('0x2d')][_0x00aa('0x33')](_0x00aa('0x34'))){_0xfb2c44[_0x00aa('0x1a')]=qs[_0x00aa('0x1a')](_0x34f0cf[_0x00aa('0x2d')][_0x00aa('0x1a')]);_0xfb2c44[_0x00aa('0x19')]=qs[_0x00aa('0x19')](_0x34f0cf['query']['offset']);}_0xfb2c44[_0x00aa('0x35')]=qs[_0x00aa('0x36')](_0x34f0cf['query'][_0x00aa('0x36')]);_0xfb2c44['where']=qs[_0x00aa('0x37')](_['pick'](_0x34f0cf[_0x00aa('0x2d')],_0x56c95a[_0x00aa('0x37')]),_0x2139e5);if(_0x34f0cf[_0x00aa('0x2d')][_0x00aa('0x38')]){_0xfb2c44['where']=_[_0x00aa('0x39')](_0xfb2c44['where'],{'$or':_[_0x00aa('0x27')](_0x2139e5,function(_0x55c76f){if(_0x55c76f[_0x00aa('0x2a')]!==_0x00aa('0x3a')){var _0x175516={};_0x175516[_0x55c76f[_0x00aa('0x25')]]={'$like':'%'+_0x34f0cf[_0x00aa('0x2d')][_0x00aa('0x38')]+'%'};return _0x175516;}})});}_0xfb2c44=_['merge']({},_0xfb2c44,_0x34f0cf[_0x00aa('0x3b')]);var _0x356973={'where':_0xfb2c44[_0x00aa('0x3c')]};return db[_0x00aa('0x28')][_0x00aa('0x18')](_0x356973)[_0x00aa('0x21')](function(_0xf06ff9){_0x4c90c5[_0x00aa('0x18')]=_0xf06ff9;if(_0x34f0cf[_0x00aa('0x2d')][_0x00aa('0x3d')]){_0xfb2c44[_0x00aa('0x3e')]=[{'all':!![]}];}return db[_0x00aa('0x28')]['findAll'](_0xfb2c44);})['then'](function(_0x49ee69){_0x4c90c5['rows']=_0x49ee69;return _0x4c90c5;})[_0x00aa('0x21')](respondWithFilteredResult(_0x20e13e,_0xfb2c44))[_0x00aa('0x3f')](handleError(_0x20e13e,null));};exports[_0x00aa('0x40')]=function(_0x4e7890,_0x2b6ea9){var _0x73072={'raw':![],'where':{'id':_0x4e7890['params']['id']}},_0x1a0670={};_0x1a0670[_0x00aa('0x2c')]=_['keys'](db[_0x00aa('0x28')][_0x00aa('0x29')]);_0x1a0670['query']=_['keys'](_0x4e7890[_0x00aa('0x2d')]);_0x1a0670[_0x00aa('0x37')]=_[_0x00aa('0x2f')](_0x1a0670[_0x00aa('0x2c')],_0x1a0670[_0x00aa('0x2d')]);_0x73072[_0x00aa('0x30')]=_[_0x00aa('0x2f')](_0x1a0670[_0x00aa('0x2c')],qs[_0x00aa('0x31')](_0x4e7890[_0x00aa('0x2d')]['fields']));_0x73072[_0x00aa('0x30')]=_0x73072[_0x00aa('0x30')][_0x00aa('0x32')]?_0x73072[_0x00aa('0x30')]:_0x1a0670[_0x00aa('0x2c')];if(_0x4e7890[_0x00aa('0x2d')][_0x00aa('0x3d')]){_0x73072[_0x00aa('0x3e')]=[{'all':!![]}];}_0x73072=_[_0x00aa('0x39')]({},_0x73072,_0x4e7890['options']);return db['Automation'][_0x00aa('0x41')](_0x73072)[_0x00aa('0x21')](handleEntityNotFound(_0x2b6ea9,null))[_0x00aa('0x21')](respondWithResult(_0x2b6ea9,null))[_0x00aa('0x3f')](handleError(_0x2b6ea9,null));};exports[_0x00aa('0x42')]=function(_0x1fc0e1,_0x63b2bd){return db[_0x00aa('0x28')][_0x00aa('0x42')](_0x1fc0e1[_0x00aa('0x43')],{})['then'](respondWithResult(_0x63b2bd,0xc9))['catch'](handleError(_0x63b2bd,null));};exports[_0x00aa('0x1f')]=function(_0x5d83ad,_0x2c494d){if(_0x5d83ad[_0x00aa('0x43')]['id']){delete _0x5d83ad['body']['id'];}return db[_0x00aa('0x28')][_0x00aa('0x41')]({'where':{'id':_0x5d83ad['params']['id']}})[_0x00aa('0x21')](handleEntityNotFound(_0x2c494d,null))['then'](saveUpdates(_0x5d83ad['body'],null))['then'](respondWithResult(_0x2c494d,null))['catch'](handleError(_0x2c494d,null));};exports['destroy']=function(_0x1e4b6e,_0xb1104){return db[_0x00aa('0x28')][_0x00aa('0x41')]({'where':{'id':_0x1e4b6e[_0x00aa('0x44')]['id']}})['then'](handleEntityNotFound(_0xb1104,null))[_0x00aa('0x21')](removeEntity(_0xb1104,null))[_0x00aa('0x3f')](handleError(_0xb1104,null));};exports[_0x00aa('0x45')]=function(_0x45dbbe,_0x3aad53,_0xc6c97){return db[_0x00aa('0x46')][_0x00aa('0x41')]({'where':{'id':_0x45dbbe[_0x00aa('0x44')]['id']}})[_0x00aa('0x21')](handleEntityNotFound(_0x3aad53,null))[_0x00aa('0x21')](function(_0x2584f9){if(_0x2584f9){return _0x2584f9[_0x00aa('0x45')](_0x45dbbe[_0x00aa('0x43')]['ids'],_[_0x00aa('0x47')](_0x45dbbe['body'],['ids','id'])||{});}})[_0x00aa('0x21')](respondWithResult(_0x3aad53,null))[_0x00aa('0x3f')](handleError(_0x3aad53,null));};exports[_0x00aa('0x48')]=function(_0x40f1f9,_0x5810b2,_0x1c7171){var _0x59b594={};var _0x20e175={};var _0x27c694;var _0x23b067;return db['Automation'][_0x00aa('0x49')]({'where':{'id':_0x40f1f9[_0x00aa('0x44')]['id']}})['then'](handleEntityNotFound(_0x5810b2,null))[_0x00aa('0x21')](function(_0x16f83c){if(_0x16f83c){_0x27c694=_0x16f83c;_0x20e175[_0x00aa('0x2c')]=_[_0x00aa('0x2e')](db[_0x00aa('0x46')][_0x00aa('0x29')]);_0x20e175[_0x00aa('0x2d')]=_['keys'](_0x40f1f9[_0x00aa('0x2d')]);_0x20e175[_0x00aa('0x37')]=_[_0x00aa('0x2f')](_0x20e175['model'],_0x20e175[_0x00aa('0x2d')]);_0x59b594['attributes']=_[_0x00aa('0x2f')](_0x20e175[_0x00aa('0x2c')],qs[_0x00aa('0x31')](_0x40f1f9[_0x00aa('0x2d')]['fields']));_0x59b594['attributes']=_0x59b594[_0x00aa('0x30')]['length']?_0x59b594[_0x00aa('0x30')]:_0x20e175[_0x00aa('0x2c')];_0x59b594[_0x00aa('0x35')]=qs[_0x00aa('0x36')](_0x40f1f9[_0x00aa('0x2d')][_0x00aa('0x36')]);_0x59b594[_0x00aa('0x3c')]=qs['filters'](_[_0x00aa('0x4a')](_0x40f1f9[_0x00aa('0x2d')],_0x20e175[_0x00aa('0x37')]));if(_0x40f1f9[_0x00aa('0x2d')][_0x00aa('0x38')]){_0x59b594['where']=_['merge'](_0x59b594[_0x00aa('0x3c')],{'$or':_['map'](_0x59b594[_0x00aa('0x30')],function(_0x2cdd76){var _0x3638ee={};_0x3638ee[_0x2cdd76]={'$like':'%'+_0x40f1f9[_0x00aa('0x2d')]['filter']+'%'};return _0x3638ee;})});}_0x59b594=_['merge']({},_0x59b594,_0x40f1f9[_0x00aa('0x3b')]);return _0x27c694['getConditions'](_0x59b594);}})[_0x00aa('0x21')](function(_0x2d1be2){if(_0x2d1be2){_0x23b067=_0x2d1be2[_0x00aa('0x32')];if(!_0x40f1f9[_0x00aa('0x2d')][_0x00aa('0x33')](_0x00aa('0x34'))){_0x59b594[_0x00aa('0x1a')]=qs['limit'](_0x40f1f9[_0x00aa('0x2d')]['limit']);_0x59b594[_0x00aa('0x19')]=qs['offset'](_0x40f1f9['query'][_0x00aa('0x19')]);}return _0x27c694[_0x00aa('0x48')](_0x59b594);}})[_0x00aa('0x21')](function(_0x316d11){if(_0x316d11){return _0x316d11?{'count':_0x23b067,'rows':_0x316d11}:null;}})['then'](respondWithResult(_0x5810b2,null))[_0x00aa('0x3f')](handleError(_0x5810b2,null));};exports[_0x00aa('0x4b')]=function(_0x13d81f,_0xe7b64c,_0x433325){return db[_0x00aa('0x4c')][_0x00aa('0x41')]({'where':{'id':_0x13d81f['params']['id']}})[_0x00aa('0x21')](handleEntityNotFound(_0xe7b64c,null))['then'](function(_0x29c45c){if(_0x29c45c){return _0x29c45c[_0x00aa('0x4b')](_0x13d81f[_0x00aa('0x43')]['ids'],_[_0x00aa('0x47')](_0x13d81f[_0x00aa('0x43')],[_0x00aa('0x4d'),'id'])||{});}})['then'](respondWithResult(_0xe7b64c,null))['catch'](handleError(_0xe7b64c,null));};exports['getActions']=function(_0x1ad6eb,_0x1e26ff,_0x355283){var _0x2e8e50={};var _0x215741={};var _0x537b8e;var _0x40de5a;return db[_0x00aa('0x28')][_0x00aa('0x49')]({'where':{'id':_0x1ad6eb[_0x00aa('0x44')]['id']}})['then'](handleEntityNotFound(_0x1e26ff,null))['then'](function(_0x30bc1e){if(_0x30bc1e){_0x537b8e=_0x30bc1e;_0x215741['model']=_[_0x00aa('0x2e')](db[_0x00aa('0x4c')][_0x00aa('0x29')]);_0x215741[_0x00aa('0x2d')]=_[_0x00aa('0x2e')](_0x1ad6eb[_0x00aa('0x2d')]);_0x215741[_0x00aa('0x37')]=_[_0x00aa('0x2f')](_0x215741[_0x00aa('0x2c')],_0x215741[_0x00aa('0x2d')]);_0x2e8e50[_0x00aa('0x30')]=_[_0x00aa('0x2f')](_0x215741[_0x00aa('0x2c')],qs[_0x00aa('0x31')](_0x1ad6eb[_0x00aa('0x2d')][_0x00aa('0x31')]));_0x2e8e50[_0x00aa('0x30')]=_0x2e8e50['attributes']['length']?_0x2e8e50[_0x00aa('0x30')]:_0x215741[_0x00aa('0x2c')];_0x2e8e50[_0x00aa('0x35')]=qs[_0x00aa('0x36')](_0x1ad6eb[_0x00aa('0x2d')][_0x00aa('0x36')]);_0x2e8e50[_0x00aa('0x3c')]=qs[_0x00aa('0x37')](_['pick'](_0x1ad6eb[_0x00aa('0x2d')],_0x215741[_0x00aa('0x37')]));if(_0x1ad6eb['query'][_0x00aa('0x38')]){_0x2e8e50['where']=_[_0x00aa('0x39')](_0x2e8e50['where'],{'$or':_[_0x00aa('0x27')](_0x2e8e50['attributes'],function(_0x58209d){var _0x320551={};_0x320551[_0x58209d]={'$like':'%'+_0x1ad6eb[_0x00aa('0x2d')]['filter']+'%'};return _0x320551;})});}_0x2e8e50=_[_0x00aa('0x39')]({},_0x2e8e50,_0x1ad6eb[_0x00aa('0x3b')]);return _0x537b8e[_0x00aa('0x4e')](_0x2e8e50);}})[_0x00aa('0x21')](function(_0x3d154d){if(_0x3d154d){_0x40de5a=_0x3d154d[_0x00aa('0x32')];if(!_0x1ad6eb['query']['hasOwnProperty'](_0x00aa('0x34'))){_0x2e8e50['limit']=qs[_0x00aa('0x1a')](_0x1ad6eb['query'][_0x00aa('0x1a')]);_0x2e8e50[_0x00aa('0x19')]=qs[_0x00aa('0x19')](_0x1ad6eb[_0x00aa('0x2d')]['offset']);}return _0x537b8e[_0x00aa('0x4e')](_0x2e8e50);}})['then'](function(_0x3fa8f4){if(_0x3fa8f4){return _0x3fa8f4?{'count':_0x40de5a,'rows':_0x3fa8f4}:null;}})['then'](respondWithResult(_0x1e26ff,null))[_0x00aa('0x3f')](handleError(_0x1e26ff,null));}; \ No newline at end of file +var _0xb3f7=['query','keys','filters','intersection','model','fields','attributes','length','sort','where','pick','filter','merge','VIRTUAL','Automation','includeAll','include','catch','params','options','find','create','body','addConditions','Condition','ids','omit','findOne','order','getConditions','hasOwnProperty','addActions','getActions','Action','nolimit','eml-format','fast-json-patch','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','set','apply','reject','save','update','destroy','then','sendStatus','error','name','send','map','rawAttributes','fieldName','type','key'];(function(_0x3237a8,_0x32ca63){var _0x4516ed=function(_0x2b3917){while(--_0x2b3917){_0x3237a8['push'](_0x3237a8['shift']());}};_0x4516ed(++_0x32ca63);}(_0xb3f7,0x1a4));var _0x7b3f=function(_0x1752f1,_0xb6912c){_0x1752f1=_0x1752f1-0x0;var _0x533438=_0xb3f7[_0x1752f1];return _0x533438;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7b3f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7b3f('0x1'));var rp=require('request-promise');var moment=require(_0x7b3f('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x7b3f('0x3'));var util=require('util');var path=require(_0x7b3f('0x4'));var sox=require(_0x7b3f('0x5'));var csv=require('to-csv');var ejs=require(_0x7b3f('0x6'));var fs=require('fs');var _=require(_0x7b3f('0x7'));var squel=require(_0x7b3f('0x8'));var crypto=require(_0x7b3f('0x9'));var jsforce=require(_0x7b3f('0xa'));var deskjs=require(_0x7b3f('0xb'));var toCsv=require('to-csv');var querystring=require(_0x7b3f('0xc'));var Papa=require('papaparse');var Redis=require(_0x7b3f('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7b3f('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b3f('0xf'))(_0x7b3f('0x10'));var utils=require(_0x7b3f('0x11'));var config=require(_0x7b3f('0x12'));var db=require(_0x7b3f('0x13'))['db'];function respondWithStatusCode(_0x5aafbe,_0x5d7675){_0x5d7675=_0x5d7675||0xcc;return function(_0x3a6d06){if(_0x3a6d06){return _0x5aafbe['sendStatus'](_0x5d7675);}return _0x5aafbe['status'](_0x5d7675)[_0x7b3f('0x14')]();};}function respondWithResult(_0x5f11ea,_0x1ded42){_0x1ded42=_0x1ded42||0xc8;return function(_0x5c05dd){if(_0x5c05dd){return _0x5f11ea[_0x7b3f('0x15')](_0x1ded42)[_0x7b3f('0x16')](_0x5c05dd);}};}function respondWithFilteredResult(_0x46dc7a,_0x4f3490){return function(_0x17368c){if(_0x17368c){var _0xa25d2b=_0x17368c[_0x7b3f('0x17')],_0x21ef74=_0x4f3490[_0x7b3f('0x18')],_0x30964b=_0x4f3490[_0x7b3f('0x18')]+_0x4f3490[_0x7b3f('0x19')],_0xc7dab1;if(_0x30964b>=_0xa25d2b){_0x30964b=_0xa25d2b;_0xc7dab1=0xc8;}else{_0xc7dab1=0xce;}_0x46dc7a[_0x7b3f('0x15')](_0xc7dab1);return _0x46dc7a[_0x7b3f('0x1a')]('Content-Range',_0x21ef74+'-'+_0x30964b+'/'+_0xa25d2b)['json'](_0x17368c);}return null;};}function patchUpdates(_0x5ac0ee){return function(_0x335608){try{jsonpatch[_0x7b3f('0x1b')](_0x335608,_0x5ac0ee,!![]);}catch(_0x229de7){return BPromise[_0x7b3f('0x1c')](_0x229de7);}return _0x335608[_0x7b3f('0x1d')]();};}function saveUpdates(_0xe5fa07,_0x2b7582){return function(_0x46f4c1){if(_0x46f4c1){return _0x46f4c1[_0x7b3f('0x1e')](_0xe5fa07)['then'](function(_0x4b8bc6){return _0x4b8bc6;});}return null;};}function removeEntity(_0x19c759,_0x251816){return function(_0x58c793){if(_0x58c793){return _0x58c793[_0x7b3f('0x1f')]()[_0x7b3f('0x20')](function(){_0x19c759[_0x7b3f('0x15')](0xcc)[_0x7b3f('0x14')]();});}};}function handleEntityNotFound(_0x121133,_0x3b5d47){return function(_0x77df5f){if(!_0x77df5f){_0x121133[_0x7b3f('0x21')](0x194);}return _0x77df5f;};}function handleError(_0x10891c,_0x270d0b){_0x270d0b=_0x270d0b||0x1f4;return function(_0x24fcb6){logger[_0x7b3f('0x22')](_0x24fcb6['stack']);if(_0x24fcb6[_0x7b3f('0x23')]){delete _0x24fcb6[_0x7b3f('0x23')];}_0x10891c[_0x7b3f('0x15')](_0x270d0b)[_0x7b3f('0x24')](_0x24fcb6);};}exports['index']=function(_0x395c34,_0xe9506){var _0x51a826={},_0x434d28={},_0x5a791e={'count':0x0,'rows':[]};var _0x52fd7c=_[_0x7b3f('0x25')](db['Automation'][_0x7b3f('0x26')],function(_0x1429eb){return{'name':_0x1429eb[_0x7b3f('0x27')],'type':_0x1429eb[_0x7b3f('0x28')][_0x7b3f('0x29')]};});_0x434d28['model']=_[_0x7b3f('0x25')](_0x52fd7c,'name');_0x434d28[_0x7b3f('0x2a')]=_[_0x7b3f('0x2b')](_0x395c34[_0x7b3f('0x2a')]);_0x434d28[_0x7b3f('0x2c')]=_[_0x7b3f('0x2d')](_0x434d28[_0x7b3f('0x2e')],_0x434d28['query']);_0x51a826['attributes']=_['intersection'](_0x434d28[_0x7b3f('0x2e')],qs[_0x7b3f('0x2f')](_0x395c34[_0x7b3f('0x2a')][_0x7b3f('0x2f')]));_0x51a826['attributes']=_0x51a826[_0x7b3f('0x30')][_0x7b3f('0x31')]?_0x51a826[_0x7b3f('0x30')]:_0x434d28['model'];if(!_0x395c34[_0x7b3f('0x2a')]['hasOwnProperty']('nolimit')){_0x51a826[_0x7b3f('0x19')]=qs[_0x7b3f('0x19')](_0x395c34['query'][_0x7b3f('0x19')]);_0x51a826[_0x7b3f('0x18')]=qs[_0x7b3f('0x18')](_0x395c34[_0x7b3f('0x2a')][_0x7b3f('0x18')]);}_0x51a826['order']=qs[_0x7b3f('0x32')](_0x395c34['query'][_0x7b3f('0x32')]);_0x51a826[_0x7b3f('0x33')]=qs['filters'](_[_0x7b3f('0x34')](_0x395c34[_0x7b3f('0x2a')],_0x434d28[_0x7b3f('0x2c')]),_0x52fd7c);if(_0x395c34[_0x7b3f('0x2a')][_0x7b3f('0x35')]){_0x51a826['where']=_[_0x7b3f('0x36')](_0x51a826[_0x7b3f('0x33')],{'$or':_['map'](_0x52fd7c,function(_0x1e1a2a){if(_0x1e1a2a[_0x7b3f('0x28')]!==_0x7b3f('0x37')){var _0x17b093={};_0x17b093[_0x1e1a2a[_0x7b3f('0x23')]]={'$like':'%'+_0x395c34[_0x7b3f('0x2a')]['filter']+'%'};return _0x17b093;}})});}_0x51a826=_['merge']({},_0x51a826,_0x395c34['options']);var _0x2cdc04={'where':_0x51a826[_0x7b3f('0x33')]};return db[_0x7b3f('0x38')][_0x7b3f('0x17')](_0x2cdc04)[_0x7b3f('0x20')](function(_0x24d4e0){_0x5a791e[_0x7b3f('0x17')]=_0x24d4e0;if(_0x395c34[_0x7b3f('0x2a')][_0x7b3f('0x39')]){_0x51a826[_0x7b3f('0x3a')]=[{'all':!![]}];}return db['Automation']['findAll'](_0x51a826);})[_0x7b3f('0x20')](function(_0x4930db){_0x5a791e['rows']=_0x4930db;return _0x5a791e;})[_0x7b3f('0x20')](respondWithFilteredResult(_0xe9506,_0x51a826))[_0x7b3f('0x3b')](handleError(_0xe9506,null));};exports['show']=function(_0x43fc51,_0x28166f){var _0xa443a1={'raw':![],'where':{'id':_0x43fc51[_0x7b3f('0x3c')]['id']}},_0x236891={};_0x236891['model']=_[_0x7b3f('0x2b')](db[_0x7b3f('0x38')][_0x7b3f('0x26')]);_0x236891[_0x7b3f('0x2a')]=_['keys'](_0x43fc51[_0x7b3f('0x2a')]);_0x236891['filters']=_['intersection'](_0x236891[_0x7b3f('0x2e')],_0x236891[_0x7b3f('0x2a')]);_0xa443a1[_0x7b3f('0x30')]=_[_0x7b3f('0x2d')](_0x236891[_0x7b3f('0x2e')],qs['fields'](_0x43fc51[_0x7b3f('0x2a')]['fields']));_0xa443a1[_0x7b3f('0x30')]=_0xa443a1[_0x7b3f('0x30')]['length']?_0xa443a1['attributes']:_0x236891[_0x7b3f('0x2e')];if(_0x43fc51[_0x7b3f('0x2a')]['includeAll']){_0xa443a1[_0x7b3f('0x3a')]=[{'all':!![]}];}_0xa443a1=_[_0x7b3f('0x36')]({},_0xa443a1,_0x43fc51[_0x7b3f('0x3d')]);return db[_0x7b3f('0x38')][_0x7b3f('0x3e')](_0xa443a1)['then'](handleEntityNotFound(_0x28166f,null))['then'](respondWithResult(_0x28166f,null))['catch'](handleError(_0x28166f,null));};exports[_0x7b3f('0x3f')]=function(_0x22ecea,_0x398c4c){return db[_0x7b3f('0x38')][_0x7b3f('0x3f')](_0x22ecea['body'],{})[_0x7b3f('0x20')](respondWithResult(_0x398c4c,0xc9))[_0x7b3f('0x3b')](handleError(_0x398c4c,null));};exports[_0x7b3f('0x1e')]=function(_0x4b37ad,_0x5bbe94){if(_0x4b37ad[_0x7b3f('0x40')]['id']){delete _0x4b37ad[_0x7b3f('0x40')]['id'];}return db[_0x7b3f('0x38')][_0x7b3f('0x3e')]({'where':{'id':_0x4b37ad['params']['id']}})[_0x7b3f('0x20')](handleEntityNotFound(_0x5bbe94,null))['then'](saveUpdates(_0x4b37ad[_0x7b3f('0x40')],null))[_0x7b3f('0x20')](respondWithResult(_0x5bbe94,null))[_0x7b3f('0x3b')](handleError(_0x5bbe94,null));};exports[_0x7b3f('0x1f')]=function(_0x36c5d7,_0x4715cb){return db[_0x7b3f('0x38')][_0x7b3f('0x3e')]({'where':{'id':_0x36c5d7['params']['id']}})[_0x7b3f('0x20')](handleEntityNotFound(_0x4715cb,null))[_0x7b3f('0x20')](removeEntity(_0x4715cb,null))['catch'](handleError(_0x4715cb,null));};exports[_0x7b3f('0x41')]=function(_0x1ec7de,_0x5e92fa,_0x1515e6){return db[_0x7b3f('0x42')][_0x7b3f('0x3e')]({'where':{'id':_0x1ec7de[_0x7b3f('0x3c')]['id']}})[_0x7b3f('0x20')](handleEntityNotFound(_0x5e92fa,null))[_0x7b3f('0x20')](function(_0x4d87b4){if(_0x4d87b4){return _0x4d87b4[_0x7b3f('0x41')](_0x1ec7de['body'][_0x7b3f('0x43')],_[_0x7b3f('0x44')](_0x1ec7de[_0x7b3f('0x40')],[_0x7b3f('0x43'),'id'])||{});}})[_0x7b3f('0x20')](respondWithResult(_0x5e92fa,null))[_0x7b3f('0x3b')](handleError(_0x5e92fa,null));};exports['getConditions']=function(_0x4e8e5f,_0x1738f0,_0x389150){var _0xbe15ad={};var _0x318c8c={};var _0xe58197;var _0xd77aab;return db[_0x7b3f('0x38')][_0x7b3f('0x45')]({'where':{'id':_0x4e8e5f[_0x7b3f('0x3c')]['id']}})[_0x7b3f('0x20')](handleEntityNotFound(_0x1738f0,null))[_0x7b3f('0x20')](function(_0x4fb4a7){if(_0x4fb4a7){_0xe58197=_0x4fb4a7;_0x318c8c[_0x7b3f('0x2e')]=_['keys'](db[_0x7b3f('0x42')][_0x7b3f('0x26')]);_0x318c8c[_0x7b3f('0x2a')]=_[_0x7b3f('0x2b')](_0x4e8e5f['query']);_0x318c8c[_0x7b3f('0x2c')]=_[_0x7b3f('0x2d')](_0x318c8c['model'],_0x318c8c[_0x7b3f('0x2a')]);_0xbe15ad[_0x7b3f('0x30')]=_[_0x7b3f('0x2d')](_0x318c8c[_0x7b3f('0x2e')],qs[_0x7b3f('0x2f')](_0x4e8e5f[_0x7b3f('0x2a')][_0x7b3f('0x2f')]));_0xbe15ad['attributes']=_0xbe15ad['attributes'][_0x7b3f('0x31')]?_0xbe15ad[_0x7b3f('0x30')]:_0x318c8c['model'];_0xbe15ad[_0x7b3f('0x46')]=qs[_0x7b3f('0x32')](_0x4e8e5f['query'][_0x7b3f('0x32')]);_0xbe15ad['where']=qs['filters'](_[_0x7b3f('0x34')](_0x4e8e5f[_0x7b3f('0x2a')],_0x318c8c['filters']));if(_0x4e8e5f[_0x7b3f('0x2a')][_0x7b3f('0x35')]){_0xbe15ad[_0x7b3f('0x33')]=_[_0x7b3f('0x36')](_0xbe15ad[_0x7b3f('0x33')],{'$or':_[_0x7b3f('0x25')](_0xbe15ad[_0x7b3f('0x30')],function(_0x1c5c99){var _0x2e6897={};_0x2e6897[_0x1c5c99]={'$like':'%'+_0x4e8e5f['query']['filter']+'%'};return _0x2e6897;})});}_0xbe15ad=_['merge']({},_0xbe15ad,_0x4e8e5f['options']);return _0xe58197[_0x7b3f('0x47')](_0xbe15ad);}})[_0x7b3f('0x20')](function(_0x31beb4){if(_0x31beb4){_0xd77aab=_0x31beb4[_0x7b3f('0x31')];if(!_0x4e8e5f[_0x7b3f('0x2a')][_0x7b3f('0x48')]('nolimit')){_0xbe15ad[_0x7b3f('0x19')]=qs[_0x7b3f('0x19')](_0x4e8e5f['query']['limit']);_0xbe15ad[_0x7b3f('0x18')]=qs[_0x7b3f('0x18')](_0x4e8e5f[_0x7b3f('0x2a')]['offset']);}return _0xe58197['getConditions'](_0xbe15ad);}})[_0x7b3f('0x20')](function(_0xb9a58d){if(_0xb9a58d){return _0xb9a58d?{'count':_0xd77aab,'rows':_0xb9a58d}:null;}})[_0x7b3f('0x20')](respondWithResult(_0x1738f0,null))[_0x7b3f('0x3b')](handleError(_0x1738f0,null));};exports[_0x7b3f('0x49')]=function(_0x269935,_0x575b68,_0x55f960){return db['Action']['find']({'where':{'id':_0x269935['params']['id']}})[_0x7b3f('0x20')](handleEntityNotFound(_0x575b68,null))[_0x7b3f('0x20')](function(_0x48f534){if(_0x48f534){return _0x48f534[_0x7b3f('0x49')](_0x269935[_0x7b3f('0x40')]['ids'],_[_0x7b3f('0x44')](_0x269935[_0x7b3f('0x40')],[_0x7b3f('0x43'),'id'])||{});}})['then'](respondWithResult(_0x575b68,null))[_0x7b3f('0x3b')](handleError(_0x575b68,null));};exports[_0x7b3f('0x4a')]=function(_0x58a922,_0x553544,_0x2d5d2b){var _0x4530e7={};var _0x10e09c={};var _0x41cfab;var _0x8ff1eb;return db['Automation']['findOne']({'where':{'id':_0x58a922[_0x7b3f('0x3c')]['id']}})[_0x7b3f('0x20')](handleEntityNotFound(_0x553544,null))['then'](function(_0x2f3359){if(_0x2f3359){_0x41cfab=_0x2f3359;_0x10e09c[_0x7b3f('0x2e')]=_['keys'](db[_0x7b3f('0x4b')][_0x7b3f('0x26')]);_0x10e09c['query']=_['keys'](_0x58a922[_0x7b3f('0x2a')]);_0x10e09c[_0x7b3f('0x2c')]=_[_0x7b3f('0x2d')](_0x10e09c[_0x7b3f('0x2e')],_0x10e09c[_0x7b3f('0x2a')]);_0x4530e7[_0x7b3f('0x30')]=_[_0x7b3f('0x2d')](_0x10e09c[_0x7b3f('0x2e')],qs[_0x7b3f('0x2f')](_0x58a922[_0x7b3f('0x2a')]['fields']));_0x4530e7[_0x7b3f('0x30')]=_0x4530e7[_0x7b3f('0x30')][_0x7b3f('0x31')]?_0x4530e7[_0x7b3f('0x30')]:_0x10e09c['model'];_0x4530e7[_0x7b3f('0x46')]=qs['sort'](_0x58a922['query'][_0x7b3f('0x32')]);_0x4530e7[_0x7b3f('0x33')]=qs[_0x7b3f('0x2c')](_['pick'](_0x58a922[_0x7b3f('0x2a')],_0x10e09c[_0x7b3f('0x2c')]));if(_0x58a922[_0x7b3f('0x2a')][_0x7b3f('0x35')]){_0x4530e7['where']=_[_0x7b3f('0x36')](_0x4530e7[_0x7b3f('0x33')],{'$or':_[_0x7b3f('0x25')](_0x4530e7[_0x7b3f('0x30')],function(_0x3ac5a2){var _0x3a8969={};_0x3a8969[_0x3ac5a2]={'$like':'%'+_0x58a922[_0x7b3f('0x2a')][_0x7b3f('0x35')]+'%'};return _0x3a8969;})});}_0x4530e7=_[_0x7b3f('0x36')]({},_0x4530e7,_0x58a922['options']);return _0x41cfab[_0x7b3f('0x4a')](_0x4530e7);}})[_0x7b3f('0x20')](function(_0x5c0324){if(_0x5c0324){_0x8ff1eb=_0x5c0324[_0x7b3f('0x31')];if(!_0x58a922[_0x7b3f('0x2a')]['hasOwnProperty'](_0x7b3f('0x4c'))){_0x4530e7['limit']=qs[_0x7b3f('0x19')](_0x58a922['query']['limit']);_0x4530e7['offset']=qs[_0x7b3f('0x18')](_0x58a922['query'][_0x7b3f('0x18')]);}return _0x41cfab['getActions'](_0x4530e7);}})[_0x7b3f('0x20')](function(_0x35e2bf){if(_0x35e2bf){return _0x35e2bf?{'count':_0x8ff1eb,'rows':_0x35e2bf}:null;}})[_0x7b3f('0x20')](respondWithResult(_0x553544,null))[_0x7b3f('0x3b')](handleError(_0x553544,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 14c0909..1455cd3 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 _0x5fd1=['Automation','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define'];(function(_0x99ad77,_0x38599c){var _0x5a8acf=function(_0x28b75f){while(--_0x28b75f){_0x99ad77['push'](_0x99ad77['shift']());}};_0x5a8acf(++_0x38599c);}(_0x5fd1,0x155));var _0x15fd=function(_0x24df02,_0x42f7e4){_0x24df02=_0x24df02-0x0;var _0x4c3432=_0x5fd1[_0x24df02];return _0x4c3432;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var logger=require(_0x15fd('0x1'))(_0x15fd('0x2'));var moment=require(_0x15fd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x15fd('0x4'));var rimraf=require(_0x15fd('0x5'));var config=require(_0x15fd('0x6'));var attributes=require('./automation.attributes');module[_0x15fd('0x7')]=function(_0x386441,_0x18450c){return _0x386441[_0x15fd('0x8')](_0x15fd('0x9'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a19=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x9a19,0x114));var _0x99a1=function(_0x4af01e,_0x543f5c){_0x4af01e=_0x4af01e-0x0;var _0x178c11=_0x9a19[_0x4af01e];return _0x178c11;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var logger=require(_0x99a1('0x2'))('api');var moment=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var rp=require(_0x99a1('0x5'));var fs=require('fs');var path=require(_0x99a1('0x6'));var rimraf=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var attributes=require(_0x99a1('0x9'));module[_0x99a1('0xa')]=function(_0x3eff4a,_0xff0240){return _0x3eff4a[_0x99a1('0xb')]('Automation',attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index c13ab78..6e5a640 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 _0x6f28=['stringify','error','message','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s'];(function(_0x3cdad6,_0x621ce9){var _0xa0c083=function(_0x469ef9){while(--_0x469ef9){_0x3cdad6['push'](_0x3cdad6['shift']());}};_0xa0c083(++_0x621ce9);}(_0x6f28,0x1d3));var _0x86f2=function(_0x23c6f2,_0x4e033c){_0x23c6f2=_0x23c6f2-0x0;var _0x4c270b=_0x6f28[_0x23c6f2];return _0x4c270b;};'use strict';var _=require('lodash');var util=require(_0x86f2('0x0'));var moment=require('moment');var BPromise=require(_0x86f2('0x1'));var rs=require(_0x86f2('0x2'));var fs=require('fs');var Redis=require(_0x86f2('0x3'));var db=require(_0x86f2('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x86f2('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x86f2('0x6')][_0x86f2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x33f1d5,_0x54cbc9,_0x2d1a57){return new BPromise(function(_0x3e87fa,_0x30887a){return client['request'](_0x33f1d5,_0x2d1a57)['then'](function(_0x16a1f6){logger[_0x86f2('0x8')](_0x86f2('0x9'),_0x54cbc9,_0x86f2('0xa'));logger[_0x86f2('0xb')](_0x86f2('0xc'),_0x54cbc9,_0x86f2('0xa'),JSON[_0x86f2('0xd')](_0x16a1f6));if(_0x16a1f6[_0x86f2('0xe')]){if(_0x16a1f6[_0x86f2('0xe')]['code']===0x1f4){logger[_0x86f2('0xe')]('Automation,\x20%s,\x20%s',_0x54cbc9,_0x16a1f6[_0x86f2('0xe')][_0x86f2('0xf')]);return _0x30887a(_0x16a1f6[_0x86f2('0xe')][_0x86f2('0xf')]);}logger['error']('Automation,\x20%s,\x20%s',_0x54cbc9,_0x16a1f6[_0x86f2('0xe')][_0x86f2('0xf')]);return _0x3e87fa(_0x16a1f6[_0x86f2('0xe')]['message']);}else{logger[_0x86f2('0x8')]('Automation,\x20%s,\x20%s',_0x54cbc9,_0x86f2('0xa'));_0x3e87fa(_0x16a1f6['result']['message']);}})['catch'](function(_0xb0e789){logger[_0x86f2('0xe')](_0x86f2('0x9'),_0x54cbc9,_0xb0e789);_0x30887a(_0xb0e789);});});} \ No newline at end of file +var _0x6580=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','bluebird','randomstring'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x6580,0x19a));var _0x0658=function(_0x1f57a3,_0x8061c5){_0x1f57a3=_0x1f57a3-0x0;var _0x4ded1a=_0x6580[_0x1f57a3];return _0x4ded1a;};'use strict';var _=require(_0x0658('0x0'));var util=require(_0x0658('0x1'));var moment=require('moment');var BPromise=require(_0x0658('0x2'));var rs=require(_0x0658('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0658('0x4'));var logger=require(_0x0658('0x5'))(_0x0658('0x6'));var config=require(_0x0658('0x7'));var jayson=require(_0x0658('0x8'));var client=jayson[_0x0658('0x9')][_0x0658('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e769b,_0x1bfba3,_0x4a13cb){return new BPromise(function(_0x71e59b,_0xf80e66){return client[_0x0658('0xb')](_0x1e769b,_0x4a13cb)[_0x0658('0xc')](function(_0x294ffe){logger[_0x0658('0xd')](_0x0658('0xe'),_0x1bfba3,'request\x20sent');logger[_0x0658('0xf')](_0x0658('0x10'),_0x1bfba3,_0x0658('0x11'),JSON[_0x0658('0x12')](_0x294ffe));if(_0x294ffe[_0x0658('0x13')]){if(_0x294ffe[_0x0658('0x13')][_0x0658('0x14')]===0x1f4){logger[_0x0658('0x13')](_0x0658('0xe'),_0x1bfba3,_0x294ffe[_0x0658('0x13')][_0x0658('0x15')]);return _0xf80e66(_0x294ffe[_0x0658('0x13')][_0x0658('0x15')]);}logger[_0x0658('0x13')](_0x0658('0xe'),_0x1bfba3,_0x294ffe[_0x0658('0x13')][_0x0658('0x15')]);return _0x71e59b(_0x294ffe['error'][_0x0658('0x15')]);}else{logger[_0x0658('0xd')](_0x0658('0xe'),_0x1bfba3,'request\x20sent');_0x71e59b(_0x294ffe[_0x0658('0x16')][_0x0658('0x15')]);}})['catch'](function(_0x576fcc){logger['error'](_0x0658('0xe'),_0x1bfba3,_0x576fcc);_0xf80e66(_0x576fcc);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 8faad8a..bd98ec0 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 _0x90ad=['put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','getConditions','getActions','post','create','/:id/conditions','addConditions','/:id/actions','addActions'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x90ad,0x195));var _0xd90a=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x90ad[_0x32d457];return _0x338386;};'use strict';var multer=require(_0xd90a('0x0'));var util=require(_0xd90a('0x1'));var path=require(_0xd90a('0x2'));var timeout=require(_0xd90a('0x3'));var express=require(_0xd90a('0x4'));var router=express['Router']();var auth=require(_0xd90a('0x5'));var interaction=require(_0xd90a('0x6'));var config=require(_0xd90a('0x7'));var controller=require('./automation.controller');router[_0xd90a('0x8')]('/',auth['isAuthenticated'](),controller[_0xd90a('0x9')]);router[_0xd90a('0x8')]('/:id',auth[_0xd90a('0xa')](),controller[_0xd90a('0xb')]);router[_0xd90a('0x8')]('/:id/conditions',auth['isAuthenticated'](),controller[_0xd90a('0xc')]);router['get']('/:id/actions',auth['isAuthenticated'](),controller[_0xd90a('0xd')]);router[_0xd90a('0xe')]('/',auth[_0xd90a('0xa')](),controller[_0xd90a('0xf')]);router['post'](_0xd90a('0x10'),auth[_0xd90a('0xa')](),controller[_0xd90a('0x11')]);router[_0xd90a('0xe')](_0xd90a('0x12'),auth[_0xd90a('0xa')](),controller[_0xd90a('0x13')]);router[_0xd90a('0x14')](_0xd90a('0x15'),auth[_0xd90a('0xa')](),controller['update']);router[_0xd90a('0x16')](_0xd90a('0x15'),auth[_0xd90a('0xa')](),controller[_0xd90a('0x17')]);module[_0xd90a('0x18')]=router; \ No newline at end of file +var _0xb714=['../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','/:id/actions','getActions','create','post','addConditions','addActions','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x1a571d,_0x3e0635){var _0x17504d=function(_0x3f3c8e){while(--_0x3f3c8e){_0x1a571d['push'](_0x1a571d['shift']());}};_0x17504d(++_0x3e0635);}(_0xb714,0xa9));var _0x4b71=function(_0x27616e,_0x322a2c){_0x27616e=_0x27616e-0x0;var _0x8df0c8=_0xb714[_0x27616e];return _0x8df0c8;};'use strict';var multer=require('multer');var util=require(_0x4b71('0x0'));var path=require(_0x4b71('0x1'));var timeout=require(_0x4b71('0x2'));var express=require(_0x4b71('0x3'));var router=express['Router']();var auth=require(_0x4b71('0x4'));var interaction=require(_0x4b71('0x5'));var config=require(_0x4b71('0x6'));var controller=require(_0x4b71('0x7'));router[_0x4b71('0x8')]('/',auth[_0x4b71('0x9')](),controller[_0x4b71('0xa')]);router[_0x4b71('0x8')](_0x4b71('0xb'),auth[_0x4b71('0x9')](),controller[_0x4b71('0xc')]);router['get'](_0x4b71('0xd'),auth[_0x4b71('0x9')](),controller['getConditions']);router[_0x4b71('0x8')](_0x4b71('0xe'),auth['isAuthenticated'](),controller[_0x4b71('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4b71('0x10')]);router[_0x4b71('0x11')]('/:id/conditions',auth[_0x4b71('0x9')](),controller[_0x4b71('0x12')]);router[_0x4b71('0x11')]('/:id/actions',auth['isAuthenticated'](),controller[_0x4b71('0x13')]);router[_0x4b71('0x14')](_0x4b71('0xb'),auth[_0x4b71('0x9')](),controller[_0x4b71('0x15')]);router[_0x4b71('0x16')](_0x4b71('0xb'),auth[_0x4b71('0x9')](),controller[_0x4b71('0x17')]);module[_0x4b71('0x18')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 16d6c90..c9853de 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 _0xf748=['#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence'];(function(_0x1ace78,_0xe10e1d){var _0x287e2d=function(_0x375ba6){while(--_0x375ba6){_0x1ace78['push'](_0x1ace78['shift']());}};_0x287e2d(++_0xe10e1d);}(_0xf748,0x1ad));var _0x8f74=function(_0x1881ac,_0x57ecf4){_0x1881ac=_0x1881ac-0x0;var _0x3b966e=_0xf748[_0x1881ac];return _0x3b966e;};'use strict';var Sequelize=require(_0x8f74('0x0'));module[_0x8f74('0x1')]={'name':{'type':Sequelize[_0x8f74('0x2')],'unique':_0x8f74('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x8f74('0x4')]('ivr'),'allowNull':![],'defaultValue':_0x8f74('0x5')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x8f74('0x6')],'defaultValue':0x0,'comment':_0x8f74('0x7')},'limitCalls':{'type':Sequelize[_0x8f74('0x8')](0x4)[_0x8f74('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x8f74('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0x8f74('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8f74('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x8f74('0x8')](0x3)[_0x8f74('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8f74('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0x8f74('0x8')](0x3)[_0x8f74('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8f74('0x8')](0x5)[_0x8f74('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x8f74('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8f74('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x8f74('0x8')](0x5)[_0x8f74('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8f74('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8f74('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x8f74('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x8f74('0x8')](0x3)[_0x8f74('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8f74('0xf')},'dialTimezone':{'type':Sequelize[_0x8f74('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8f74('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x8f74('0x4')](_0x8f74('0x10'),_0x8f74('0x11'),_0x8f74('0x12')),'defaultValue':_0x8f74('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x8f74('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x8f74('0x8')](0x9)[_0x8f74('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8f74('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x8f74('0x8')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8f74('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8f74('0x8')](0x9)[_0x8f74('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8f74('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8f74('0x8')](0x9)[_0x8f74('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8f74('0x17')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x8f74('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8f74('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x8f74('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8f74('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x8f74('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x8f74('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x8f74('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8f74('0x8')](0x9)[_0x8f74('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8f74('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x8f74('0x4')]('DESC','ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x8f74('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x8f74('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8f74('0x1c')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8f74('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8f74('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8f74('0x8')](0x5)[_0x8f74('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8f74('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0x8f74('0x8')](0x3)[_0x8f74('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8f74('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8f74('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8f74('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8f74('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x8f74('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8f74('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8f74('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x8f74('0x8')](0x5)[_0x8f74('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8f74('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x8f74('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8f74('0x8')](0x5)[_0x8f74('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0xf2d9=['#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ENUM','DESC','ASC','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','BOOLEAN','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time'];(function(_0x3ae0f5,_0x269911){var _0x594ab2=function(_0x3be012){while(--_0x3be012){_0x3ae0f5['push'](_0x3ae0f5['shift']());}};_0x594ab2(++_0x269911);}(_0xf2d9,0x12f));var _0x9f2d=function(_0x2a0c0e,_0x2cbbdc){_0x2a0c0e=_0x2a0c0e-0x0;var _0x10d4f8=_0xf2d9[_0x2a0c0e];return _0x10d4f8;};'use strict';var Sequelize=require(_0x9f2d('0x0'));module[_0x9f2d('0x1')]={'name':{'type':Sequelize[_0x9f2d('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x9f2d('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x9f2d('0x3')},'limitCalls':{'type':Sequelize[_0x9f2d('0x4')](0x4)[_0x9f2d('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x9f2d('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0x9f2d('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9f2d('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x9f2d('0x4')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x9f2d('0x4')](0x3)[_0x9f2d('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9f2d('0x7')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9f2d('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x9f2d('0x4')](0x3)[_0x9f2d('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9f2d('0x8')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9f2d('0x9')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9f2d('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x9f2d('0xa')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9f2d('0x4')](0x5)[_0x9f2d('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9f2d('0xb')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9f2d('0x5')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9f2d('0xc')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9f2d('0x2')],'defaultValue':_0x9f2d('0xd')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x9f2d('0xe'),_0x9f2d('0xf'),'onlyIfOpen'),'defaultValue':_0x9f2d('0xe')},'dialAMDActive':{'type':Sequelize[_0x9f2d('0x10')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x9f2d('0x4')](0x9)[_0x9f2d('0x5')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x9f2d('0x11')},'dialAMDGreeting':{'type':Sequelize[_0x9f2d('0x4')](0x9)[_0x9f2d('0x5')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9f2d('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9f2d('0x4')](0x9)[_0x9f2d('0x5')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9f2d('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x9f2d('0x4')](0x9)[_0x9f2d('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9f2d('0x14')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x9f2d('0x5')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9f2d('0x4')](0x9)[_0x9f2d('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9f2d('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9f2d('0x4')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9f2d('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9f2d('0x4')](0x5)[_0x9f2d('0x5')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9f2d('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x9f2d('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9f2d('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x9f2d('0x19')](_0x9f2d('0x1a'),_0x9f2d('0x1b')),'defaultValue':_0x9f2d('0x1a')},'dialPrefix':{'type':Sequelize[_0x9f2d('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9f2d('0x4')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x9f2d('0x4')](0x3)[_0x9f2d('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9f2d('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9f2d('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9f2d('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9f2d('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9f2d('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0x9f2d('0x4')](0x3)[_0x9f2d('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9f2d('0x1f')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9f2d('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9f2d('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x9f2d('0x4')](0x3)[_0x9f2d('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x9f2d('0x4')](0x5)[_0x9f2d('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9f2d('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0x9f2d('0x4')](0x3)[_0x9f2d('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x9f2d('0x4')](0x5)[_0x9f2d('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9f2d('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9f2d('0x4')](0x5)[_0x9f2d('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9f2d('0x23')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index b126a86..e82b1ac 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 _0xbff2=['select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','ListId\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','get','IvrCampaigns','UserProfileResource','destroy','error','stack','name','send','index','map','Campaign','rawAttributes','fieldName','model','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','catch','show','params','keys','fields','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','hasOwnProperty','CampaignId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId'];(function(_0x37c02a,_0xe831f3){var _0x20c20f=function(_0x2b1aca){while(--_0x2b1aca){_0x37c02a['push'](_0x37c02a['shift']());}};_0x20c20f(++_0xe831f3);}(_0xbff2,0x9c));var _0x2bff=function(_0x187995,_0x46ac9f){_0x187995=_0x187995-0x0;var _0x12736c=_0xbff2[_0x187995];return _0x12736c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2bff('0x0'));var rimraf=require(_0x2bff('0x1'));var zipdir=require(_0x2bff('0x2'));var jsonpatch=require(_0x2bff('0x3'));var rp=require(_0x2bff('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2bff('0x5'));var util=require('util');var path=require(_0x2bff('0x6'));var sox=require(_0x2bff('0x7'));var csv=require('to-csv');var ejs=require(_0x2bff('0x8'));var fs=require('fs');var _=require(_0x2bff('0x9'));var squel=require('squel');var crypto=require(_0x2bff('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2bff('0xb'));var toCsv=require(_0x2bff('0xc'));var querystring=require(_0x2bff('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2bff('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2bff('0xf'));var config=require(_0x2bff('0x10'));var db=require(_0x2bff('0x11'))['db'];function respondWithStatusCode(_0xfeae51,_0x17d630){_0x17d630=_0x17d630||0xcc;return function(_0x524427){if(_0x524427){return _0xfeae51[_0x2bff('0x12')](_0x17d630);}return _0xfeae51[_0x2bff('0x13')](_0x17d630)[_0x2bff('0x14')]();};}function respondWithResult(_0x18ff5f,_0x3ab71e){_0x3ab71e=_0x3ab71e||0xc8;return function(_0x1f06ea){if(_0x1f06ea){return _0x18ff5f[_0x2bff('0x13')](_0x3ab71e)[_0x2bff('0x15')](_0x1f06ea);}};}function respondWithFilteredResult(_0x6521cc,_0x213fc5){return function(_0x38535c){if(_0x38535c){var _0x2aa9a9=_0x38535c['count'],_0x3f9098=_0x213fc5[_0x2bff('0x16')],_0x5723e1=_0x213fc5[_0x2bff('0x16')]+_0x213fc5[_0x2bff('0x17')],_0x3320f0;if(_0x5723e1>=_0x2aa9a9){_0x5723e1=_0x2aa9a9;_0x3320f0=0xc8;}else{_0x3320f0=0xce;}_0x6521cc['status'](_0x3320f0);return _0x6521cc[_0x2bff('0x18')](_0x2bff('0x19'),_0x3f9098+'-'+_0x5723e1+'/'+_0x2aa9a9)[_0x2bff('0x15')](_0x38535c);}return null;};}function patchUpdates(_0x2c73be){return function(_0x376dd2){try{jsonpatch['apply'](_0x376dd2,_0x2c73be,!![]);}catch(_0x2673b3){return BPromise[_0x2bff('0x1a')](_0x2673b3);}return _0x376dd2[_0x2bff('0x1b')]();};}function saveUpdates(_0x5943a2,_0x11575a){return function(_0x2be178){if(_0x2be178){return _0x2be178[_0x2bff('0x1c')](_0x5943a2)[_0x2bff('0x1d')](function(_0x31c512){return _0x31c512;});}return null;};}function removeEntity(_0x1a5ed2,_0x1a0d3f){return function(_0xa45fc3){if(_0xa45fc3){return _0xa45fc3['destroy']()[_0x2bff('0x1d')](function(){var _0x2e5d2b=_0xa45fc3[_0x2bff('0x1e')]({'plain':!![]});var _0x2bfb04=_0x2bff('0x1f');return db[_0x2bff('0x20')][_0x2bff('0x21')]({'where':{'type':_0x2bfb04,'resourceId':_0x2e5d2b['id']}})[_0x2bff('0x1d')](function(){return _0xa45fc3;});})[_0x2bff('0x1d')](function(){_0x1a5ed2[_0x2bff('0x13')](0xcc)[_0x2bff('0x14')]();});}};}function handleEntityNotFound(_0x182aa6,_0xd6ac97){return function(_0x31818d){if(!_0x31818d){_0x182aa6[_0x2bff('0x12')](0x194);}return _0x31818d;};}function handleError(_0x346171,_0x3bec94){_0x3bec94=_0x3bec94||0x1f4;return function(_0x44e0da){logger[_0x2bff('0x22')](_0x44e0da[_0x2bff('0x23')]);if(_0x44e0da[_0x2bff('0x24')]){delete _0x44e0da[_0x2bff('0x24')];}_0x346171[_0x2bff('0x13')](_0x3bec94)[_0x2bff('0x25')](_0x44e0da);};}exports[_0x2bff('0x26')]=function(_0x5060f8,_0x55fdff){var _0x39779c={},_0x445f41={},_0x2a2865={'count':0x0,'rows':[]};var _0x4b8166=_[_0x2bff('0x27')](db[_0x2bff('0x28')][_0x2bff('0x29')],function(_0x41458a){return{'name':_0x41458a[_0x2bff('0x2a')],'type':_0x41458a['type']['key']};});_0x445f41[_0x2bff('0x2b')]=_['map'](_0x4b8166,'name');_0x445f41[_0x2bff('0x2c')]=_['keys'](_0x5060f8[_0x2bff('0x2c')]);_0x445f41[_0x2bff('0x2d')]=_[_0x2bff('0x2e')](_0x445f41['model'],_0x445f41[_0x2bff('0x2c')]);_0x39779c['attributes']=_[_0x2bff('0x2e')](_0x445f41['model'],qs['fields'](_0x5060f8['query']['fields']));_0x39779c[_0x2bff('0x2f')]=_0x39779c['attributes'][_0x2bff('0x30')]?_0x39779c[_0x2bff('0x2f')]:_0x445f41['model'];if(!_0x5060f8[_0x2bff('0x2c')]['hasOwnProperty'](_0x2bff('0x31'))){_0x39779c['limit']=qs['limit'](_0x5060f8['query'][_0x2bff('0x17')]);_0x39779c[_0x2bff('0x16')]=qs[_0x2bff('0x16')](_0x5060f8[_0x2bff('0x2c')][_0x2bff('0x16')]);}_0x39779c[_0x2bff('0x32')]=qs[_0x2bff('0x33')](_0x5060f8[_0x2bff('0x2c')][_0x2bff('0x33')]);_0x39779c[_0x2bff('0x34')]=qs[_0x2bff('0x2d')](_[_0x2bff('0x35')](_0x5060f8[_0x2bff('0x2c')],_0x445f41[_0x2bff('0x2d')]),_0x4b8166);if(_0x5060f8[_0x2bff('0x2c')][_0x2bff('0x36')]){_0x39779c[_0x2bff('0x34')]=_[_0x2bff('0x37')](_0x39779c[_0x2bff('0x34')],{'$or':_[_0x2bff('0x27')](_0x4b8166,function(_0x4dca2d){if(_0x4dca2d['type']!==_0x2bff('0x38')){var _0xbc4851={};_0xbc4851[_0x4dca2d[_0x2bff('0x24')]]={'$like':'%'+_0x5060f8['query'][_0x2bff('0x36')]+'%'};return _0xbc4851;}})});}_0x39779c=_[_0x2bff('0x37')]({},_0x39779c,_0x5060f8[_0x2bff('0x39')]);var _0x5c957d={'where':_0x39779c['where']};return db[_0x2bff('0x28')]['count'](_0x5c957d)[_0x2bff('0x1d')](function(_0x12192d){_0x2a2865[_0x2bff('0x3a')]=_0x12192d;if(_0x5060f8[_0x2bff('0x2c')]['includeAll']){_0x39779c[_0x2bff('0x3b')]=[{'all':!![]}];}return db[_0x2bff('0x28')][_0x2bff('0x3c')](_0x39779c);})['then'](function(_0x5525a0){_0x2a2865['rows']=_0x5525a0;return _0x2a2865;})[_0x2bff('0x1d')](respondWithFilteredResult(_0x55fdff,_0x39779c))[_0x2bff('0x3d')](handleError(_0x55fdff,null));};exports[_0x2bff('0x3e')]=function(_0xc7c574,_0x1293ca){var _0x2ce4de={'raw':![],'where':{'id':_0xc7c574[_0x2bff('0x3f')]['id']}},_0x1d8429={};_0x1d8429[_0x2bff('0x2b')]=_['keys'](db[_0x2bff('0x28')][_0x2bff('0x29')]);_0x1d8429['query']=_[_0x2bff('0x40')](_0xc7c574[_0x2bff('0x2c')]);_0x1d8429[_0x2bff('0x2d')]=_[_0x2bff('0x2e')](_0x1d8429[_0x2bff('0x2b')],_0x1d8429['query']);_0x2ce4de[_0x2bff('0x2f')]=_['intersection'](_0x1d8429[_0x2bff('0x2b')],qs[_0x2bff('0x41')](_0xc7c574['query'][_0x2bff('0x41')]));_0x2ce4de[_0x2bff('0x2f')]=_0x2ce4de[_0x2bff('0x2f')]['length']?_0x2ce4de['attributes']:_0x1d8429[_0x2bff('0x2b')];if(_0xc7c574['query'][_0x2bff('0x42')]){_0x2ce4de[_0x2bff('0x3b')]=[{'all':!![]}];}_0x2ce4de=_[_0x2bff('0x37')]({},_0x2ce4de,_0xc7c574[_0x2bff('0x39')]);return db[_0x2bff('0x28')]['find'](_0x2ce4de)['then'](handleEntityNotFound(_0x1293ca,null))[_0x2bff('0x1d')](respondWithResult(_0x1293ca,null))[_0x2bff('0x3d')](handleError(_0x1293ca,null));};exports[_0x2bff('0x43')]=function(_0x52f6fb,_0x5709a5){return db[_0x2bff('0x28')][_0x2bff('0x43')](_0x52f6fb[_0x2bff('0x44')],{})[_0x2bff('0x1d')](function(_0x537392){var _0x195fec=_0x52f6fb['user'][_0x2bff('0x1e')]({'plain':!![]});if(!_0x195fec)throw new Error(_0x2bff('0x45'));if(_0x195fec[_0x2bff('0x46')]===_0x2bff('0x47')){var _0x848093=_0x537392['get']({'plain':!![]});var _0x2a6a21=_0x2bff('0x1f');return db[_0x2bff('0x48')]['find']({'where':{'name':_0x2a6a21,'userProfileId':_0x195fec[_0x2bff('0x49')]},'raw':!![]})[_0x2bff('0x1d')](function(_0x555eb3){if(_0x555eb3&&_0x555eb3[_0x2bff('0x4a')]===0x0){return db[_0x2bff('0x20')][_0x2bff('0x43')]({'name':_0x848093[_0x2bff('0x24')],'resourceId':_0x848093['id'],'type':_0x555eb3[_0x2bff('0x24')],'sectionId':_0x555eb3['id']},{})[_0x2bff('0x1d')](function(){return _0x537392;});}else{return _0x537392;}})[_0x2bff('0x3d')](function(_0x27c243){logger[_0x2bff('0x22')](_0x2bff('0x4b'),_0x27c243);throw _0x27c243;});}return _0x537392;})['then'](respondWithResult(_0x5709a5,0xc9))[_0x2bff('0x3d')](handleError(_0x5709a5,null));};exports['clone']=function(_0x4dbdf2,_0x5d58f8){var _0xc94b09={'where':{'id':_0x4dbdf2[_0x2bff('0x3f')]['id']}},_0x577dfd={};_0x577dfd[_0x2bff('0x2b')]=_['keys'](db[_0x2bff('0x28')][_0x2bff('0x29')]);_0xc94b09[_0x2bff('0x2f')]=_['intersection'](_0x577dfd[_0x2bff('0x2b')],qs[_0x2bff('0x41')](_0x4dbdf2[_0x2bff('0x2c')]['fields']));_0xc94b09[_0x2bff('0x2f')]=_0xc94b09[_0x2bff('0x2f')][_0x2bff('0x30')]?_0xc94b09[_0x2bff('0x2f')]:_0x577dfd[_0x2bff('0x2b')];if(_0x4dbdf2[_0x2bff('0x2c')][_0x2bff('0x42')]){_0xc94b09[_0x2bff('0x3b')]=[{'all':!![]}];}_0xc94b09=_[_0x2bff('0x37')]({},_0xc94b09,_0x4dbdf2[_0x2bff('0x39')]);return db[_0x2bff('0x28')][_0x2bff('0x4c')](_0xc94b09)[_0x2bff('0x1d')](handleEntityNotFound(_0x5d58f8,null))[_0x2bff('0x1d')](function(_0x5aeda6){if(_0x5aeda6){var _0x174684=_0x5aeda6[_0x2bff('0x1e')]({'plain':!![]});_0x174684=qs[_0x2bff('0x4d')](_0x174684,['id',_0x2bff('0x4e'),_0x2bff('0x4f')]);_0x4dbdf2[_0x2bff('0x44')]=_[_0x2bff('0x4d')](_0x4dbdf2['body'],['id','createdAt',_0x2bff('0x4f')]);return db[_0x2bff('0x28')][_0x2bff('0x43')](_[_0x2bff('0x37')](_0x174684,_0x4dbdf2['body']),{'include':_0x4dbdf2[_0x2bff('0x2c')][_0x2bff('0x42')]?[{'all':!![]}]:undefined})[_0x2bff('0x1d')](function(_0x3b1043){var _0x948463=_0x4dbdf2[_0x2bff('0x47')][_0x2bff('0x1e')]({'plain':!![]});if(!_0x948463)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x948463[_0x2bff('0x46')]===_0x2bff('0x47')){var _0x207b07=_0x3b1043[_0x2bff('0x1e')]({'plain':!![]});var _0x2eb9fe=_0x2bff('0x1f');return db['UserProfileSection']['find']({'where':{'name':_0x2eb9fe,'userProfileId':_0x948463[_0x2bff('0x49')]},'raw':!![]})[_0x2bff('0x1d')](function(_0x5636f3){if(_0x5636f3&&_0x5636f3[_0x2bff('0x4a')]===0x0){return db[_0x2bff('0x20')]['create']({'name':_0x207b07['name'],'resourceId':_0x207b07['id'],'type':_0x5636f3[_0x2bff('0x24')],'sectionId':_0x5636f3['id']},{})['then'](function(){return _0x3b1043;});}else{return _0x3b1043;}})[_0x2bff('0x3d')](function(_0x451510){logger['error'](_0x2bff('0x4b'),_0x451510);throw _0x451510;});}return _0x3b1043;});}})[_0x2bff('0x1d')](respondWithResult(_0x5d58f8,0xc9))[_0x2bff('0x3d')](handleError(_0x5d58f8,null));};exports['update']=function(_0x67c19c,_0x5ba37){if(_0x67c19c[_0x2bff('0x44')]['id']){delete _0x67c19c['body']['id'];}return db[_0x2bff('0x28')]['find']({'where':{'id':_0x67c19c[_0x2bff('0x3f')]['id']}})[_0x2bff('0x1d')](handleEntityNotFound(_0x5ba37,null))[_0x2bff('0x1d')](saveUpdates(_0x67c19c[_0x2bff('0x44')],null))['then'](respondWithResult(_0x5ba37,null))[_0x2bff('0x3d')](handleError(_0x5ba37,null));};exports['destroy']=function(_0x1d0021,_0xcfba77){return db['Campaign'][_0x2bff('0x4c')]({'where':{'id':_0x1d0021[_0x2bff('0x3f')]['id']}})[_0x2bff('0x1d')](handleEntityNotFound(_0xcfba77,null))[_0x2bff('0x1d')](removeEntity(_0xcfba77,null))[_0x2bff('0x3d')](handleError(_0xcfba77,null));};exports[_0x2bff('0x50')]=function(_0x5ea01d,_0x40fd99,_0x3c0562){var _0x55d2ca={'raw':!![],'where':{}};var _0x369830={};var _0x55c900={'count':0x0,'rows':[]};return db['Campaign'][_0x2bff('0x51')]({'where':{'id':_0x5ea01d[_0x2bff('0x3f')]['id']}})[_0x2bff('0x1d')](handleEntityNotFound(_0x40fd99,null))[_0x2bff('0x1d')](function(_0x50481d){if(_0x50481d){_0x369830['model']=_[_0x2bff('0x40')](db[_0x2bff('0x52')][_0x2bff('0x29')]);_0x369830[_0x2bff('0x2c')]=_[_0x2bff('0x40')](_0x5ea01d[_0x2bff('0x2c')]);_0x369830[_0x2bff('0x2d')]=_[_0x2bff('0x2e')](_0x369830['model'],_0x369830[_0x2bff('0x2c')]);_0x55d2ca['attributes']=_[_0x2bff('0x2e')](_0x369830['model'],qs[_0x2bff('0x41')](_0x5ea01d[_0x2bff('0x2c')][_0x2bff('0x41')]));_0x55d2ca[_0x2bff('0x2f')]=_0x55d2ca[_0x2bff('0x2f')][_0x2bff('0x30')]?_0x55d2ca['attributes']:_0x369830[_0x2bff('0x2b')];if(!_0x5ea01d[_0x2bff('0x2c')][_0x2bff('0x53')](_0x2bff('0x31'))){_0x55d2ca[_0x2bff('0x17')]=qs[_0x2bff('0x17')](_0x5ea01d[_0x2bff('0x2c')][_0x2bff('0x17')]);_0x55d2ca[_0x2bff('0x16')]=qs[_0x2bff('0x16')](_0x5ea01d[_0x2bff('0x2c')][_0x2bff('0x16')]);}_0x55d2ca['order']=qs[_0x2bff('0x33')](_0x5ea01d['query'][_0x2bff('0x33')]);_0x55d2ca[_0x2bff('0x34')]=qs[_0x2bff('0x2d')](_[_0x2bff('0x35')](_0x5ea01d['query'],_0x369830['filters']));_0x55d2ca[_0x2bff('0x34')][_0x2bff('0x54')]=_0x50481d['id'];if(_0x5ea01d['query'][_0x2bff('0x36')]){_0x55d2ca[_0x2bff('0x34')]=_['merge'](_0x55d2ca[_0x2bff('0x34')],{'$or':_['map'](_0x55d2ca[_0x2bff('0x2f')],function(_0x50a2b3){var _0x414452={};_0x414452[_0x50a2b3]={'$like':'%'+_0x5ea01d[_0x2bff('0x2c')][_0x2bff('0x36')]+'%'};return _0x414452;})});}_0x55d2ca=_[_0x2bff('0x37')]({},_0x55d2ca,_0x5ea01d[_0x2bff('0x39')]);return db[_0x2bff('0x52')][_0x2bff('0x3a')]({'where':_0x55d2ca[_0x2bff('0x34')]})[_0x2bff('0x1d')](function(_0x12143b){_0x55c900[_0x2bff('0x3a')]=_0x12143b;if(_0x5ea01d[_0x2bff('0x2c')][_0x2bff('0x42')]){_0x55d2ca[_0x2bff('0x3b')]=[{'all':!![]}];}return db[_0x2bff('0x52')]['findAll'](_0x55d2ca);})['then'](function(_0x4b616e){_0x55c900[_0x2bff('0x55')]=_0x4b616e;return _0x55c900;});}})[_0x2bff('0x1d')](respondWithFilteredResult(_0x40fd99,_0x55d2ca))[_0x2bff('0x3d')](handleError(_0x40fd99,null));};exports[_0x2bff('0x56')]=function(_0x2681e8,_0x1d393a,_0x36b55c){var _0x582b5f={'raw':!![],'where':{}};var _0x1976b0={};var _0x56e79b={'count':0x0,'rows':[]};return db[_0x2bff('0x28')][_0x2bff('0x51')]({'where':{'id':_0x2681e8['params']['id']}})['then'](handleEntityNotFound(_0x1d393a,null))['then'](function(_0x1c2d4d){if(_0x1c2d4d){_0x1976b0[_0x2bff('0x2b')]=_[_0x2bff('0x40')](db[_0x2bff('0x57')]['rawAttributes']);_0x1976b0[_0x2bff('0x2c')]=_[_0x2bff('0x40')](_0x2681e8['query']);_0x1976b0['filters']=_[_0x2bff('0x2e')](_0x1976b0['model'],_0x1976b0['query']);_0x582b5f[_0x2bff('0x2f')]=_[_0x2bff('0x2e')](_0x1976b0['model'],qs[_0x2bff('0x41')](_0x2681e8[_0x2bff('0x2c')][_0x2bff('0x41')]));_0x582b5f[_0x2bff('0x2f')]=_0x582b5f['attributes'][_0x2bff('0x30')]?_0x582b5f[_0x2bff('0x2f')]:_0x1976b0[_0x2bff('0x2b')];if(!_0x2681e8[_0x2bff('0x2c')]['hasOwnProperty'](_0x2bff('0x31'))){_0x582b5f[_0x2bff('0x17')]=qs[_0x2bff('0x17')](_0x2681e8['query']['limit']);_0x582b5f[_0x2bff('0x16')]=qs[_0x2bff('0x16')](_0x2681e8['query']['offset']);}_0x582b5f['order']=qs['sort'](_0x2681e8[_0x2bff('0x2c')][_0x2bff('0x33')]);_0x582b5f['where']=qs['filters'](_[_0x2bff('0x35')](_0x2681e8[_0x2bff('0x2c')],_0x1976b0[_0x2bff('0x2d')]));_0x582b5f[_0x2bff('0x34')]['CampaignId']=_0x1c2d4d['id'];if(_0x2681e8[_0x2bff('0x2c')][_0x2bff('0x36')]){_0x582b5f['where']=_[_0x2bff('0x37')](_0x582b5f[_0x2bff('0x34')],{'$or':_[_0x2bff('0x27')](_0x582b5f['attributes'],function(_0xd66106){var _0x2daa36={};_0x2daa36[_0xd66106]={'$like':'%'+_0x2681e8['query'][_0x2bff('0x36')]+'%'};return _0x2daa36;})});}_0x582b5f=_[_0x2bff('0x37')]({},_0x582b5f,_0x2681e8['options']);return db[_0x2bff('0x57')][_0x2bff('0x3a')]({'where':_0x582b5f[_0x2bff('0x34')]})[_0x2bff('0x1d')](function(_0x1d13c5){_0x56e79b[_0x2bff('0x3a')]=_0x1d13c5;if(_0x2681e8['query'][_0x2bff('0x42')]){_0x582b5f[_0x2bff('0x3b')]=[{'all':!![]}];}return db[_0x2bff('0x57')]['findAll'](_0x582b5f);})['then'](function(_0x4606a2){_0x56e79b[_0x2bff('0x55')]=_0x4606a2;return _0x56e79b;});}})[_0x2bff('0x1d')](respondWithFilteredResult(_0x1d393a,_0x582b5f))[_0x2bff('0x3d')](handleError(_0x1d393a,null));};exports[_0x2bff('0x58')]=function(_0x3449cf,_0x361e7d,_0x484517){var _0x67fd8c={'raw':!![],'where':{}};var _0x5edd34={};var _0x4081e0={'count':0x0,'rows':[]};return db[_0x2bff('0x28')][_0x2bff('0x51')]({'where':{'id':_0x3449cf[_0x2bff('0x3f')]['id']}})[_0x2bff('0x1d')](handleEntityNotFound(_0x361e7d,null))[_0x2bff('0x1d')](function(_0x4f6b47){if(_0x4f6b47){_0x5edd34[_0x2bff('0x2b')]=_[_0x2bff('0x40')](db[_0x2bff('0x59')][_0x2bff('0x29')]);_0x5edd34['query']=_['keys'](_0x3449cf['query']);_0x5edd34[_0x2bff('0x2d')]=_[_0x2bff('0x2e')](_0x5edd34[_0x2bff('0x2b')],_0x5edd34['query']);_0x67fd8c[_0x2bff('0x2f')]=_[_0x2bff('0x2e')](_0x5edd34[_0x2bff('0x2b')],qs['fields'](_0x3449cf['query'][_0x2bff('0x41')]));_0x67fd8c[_0x2bff('0x2f')]=_0x67fd8c[_0x2bff('0x2f')][_0x2bff('0x30')]?_0x67fd8c[_0x2bff('0x2f')]:_0x5edd34[_0x2bff('0x2b')];if(!_0x3449cf['query'][_0x2bff('0x53')](_0x2bff('0x31'))){_0x67fd8c[_0x2bff('0x17')]=qs['limit'](_0x3449cf['query'][_0x2bff('0x17')]);_0x67fd8c[_0x2bff('0x16')]=qs[_0x2bff('0x16')](_0x3449cf[_0x2bff('0x2c')][_0x2bff('0x16')]);}_0x67fd8c['order']=qs[_0x2bff('0x33')](_0x3449cf[_0x2bff('0x2c')][_0x2bff('0x33')]);_0x67fd8c['where']=qs[_0x2bff('0x2d')](_[_0x2bff('0x35')](_0x3449cf[_0x2bff('0x2c')],_0x5edd34['filters']));_0x67fd8c[_0x2bff('0x34')][_0x2bff('0x54')]=_0x4f6b47['id'];if(_0x3449cf['query'][_0x2bff('0x36')]){_0x67fd8c[_0x2bff('0x34')]=_[_0x2bff('0x37')](_0x67fd8c['where'],{'$or':_[_0x2bff('0x27')](_0x67fd8c[_0x2bff('0x2f')],function(_0x29d0d8){var _0x53b2d6={};_0x53b2d6[_0x29d0d8]={'$like':'%'+_0x3449cf[_0x2bff('0x2c')][_0x2bff('0x36')]+'%'};return _0x53b2d6;})});}_0x67fd8c=_[_0x2bff('0x37')]({},_0x67fd8c,_0x3449cf[_0x2bff('0x39')]);return db[_0x2bff('0x59')][_0x2bff('0x3a')]({'where':_0x67fd8c[_0x2bff('0x34')]})[_0x2bff('0x1d')](function(_0x134657){_0x4081e0['count']=_0x134657;if(_0x3449cf[_0x2bff('0x2c')][_0x2bff('0x42')]){_0x67fd8c['include']=[{'all':!![]}];}return db[_0x2bff('0x59')][_0x2bff('0x3c')](_0x67fd8c);})[_0x2bff('0x1d')](function(_0x49e97c){_0x4081e0['rows']=_0x49e97c;return _0x4081e0;});}})[_0x2bff('0x1d')](respondWithFilteredResult(_0x361e7d,_0x67fd8c))[_0x2bff('0x3d')](handleError(_0x361e7d,null));};exports[_0x2bff('0x5a')]=function(_0x3bcc0d,_0x1ee6dd,_0x4765d1){var _0x5a72af={'raw':!![],'where':{}};var _0x276733={};var _0x10827a={'count':0x0,'rows':[]};return db['Campaign'][_0x2bff('0x51')]({'where':{'id':_0x3bcc0d[_0x2bff('0x3f')]['id']}})[_0x2bff('0x1d')](handleEntityNotFound(_0x1ee6dd,null))['then'](function(_0x57af68){if(_0x57af68){_0x276733[_0x2bff('0x2b')]=_[_0x2bff('0x40')](db['CmHopperBlack'][_0x2bff('0x29')]);_0x276733[_0x2bff('0x2c')]=_[_0x2bff('0x40')](_0x3bcc0d[_0x2bff('0x2c')]);_0x276733[_0x2bff('0x2d')]=_[_0x2bff('0x2e')](_0x276733[_0x2bff('0x2b')],_0x276733[_0x2bff('0x2c')]);_0x5a72af['attributes']=_[_0x2bff('0x2e')](_0x276733[_0x2bff('0x2b')],qs[_0x2bff('0x41')](_0x3bcc0d['query'][_0x2bff('0x41')]));_0x5a72af[_0x2bff('0x2f')]=_0x5a72af[_0x2bff('0x2f')][_0x2bff('0x30')]?_0x5a72af['attributes']:_0x276733[_0x2bff('0x2b')];if(!_0x3bcc0d[_0x2bff('0x2c')]['hasOwnProperty'](_0x2bff('0x31'))){_0x5a72af[_0x2bff('0x17')]=qs[_0x2bff('0x17')](_0x3bcc0d['query'][_0x2bff('0x17')]);_0x5a72af[_0x2bff('0x16')]=qs['offset'](_0x3bcc0d[_0x2bff('0x2c')][_0x2bff('0x16')]);}_0x5a72af[_0x2bff('0x32')]=qs[_0x2bff('0x33')](_0x3bcc0d[_0x2bff('0x2c')][_0x2bff('0x33')]);_0x5a72af['where']=qs['filters'](_[_0x2bff('0x35')](_0x3bcc0d[_0x2bff('0x2c')],_0x276733[_0x2bff('0x2d')]));_0x5a72af[_0x2bff('0x34')]['CampaignId']=_0x57af68['id'];if(_0x3bcc0d[_0x2bff('0x2c')][_0x2bff('0x36')]){_0x5a72af[_0x2bff('0x34')]=_[_0x2bff('0x37')](_0x5a72af[_0x2bff('0x34')],{'$or':_[_0x2bff('0x27')](_0x5a72af[_0x2bff('0x2f')],function(_0x22e228){var _0xbe0ba={};_0xbe0ba[_0x22e228]={'$like':'%'+_0x3bcc0d['query'][_0x2bff('0x36')]+'%'};return _0xbe0ba;})});}_0x5a72af=_['merge']({},_0x5a72af,_0x3bcc0d['options']);return db[_0x2bff('0x5b')][_0x2bff('0x3a')]({'where':_0x5a72af['where']})[_0x2bff('0x1d')](function(_0xd1f329){_0x10827a[_0x2bff('0x3a')]=_0xd1f329;if(_0x3bcc0d[_0x2bff('0x2c')][_0x2bff('0x42')]){_0x5a72af[_0x2bff('0x3b')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x5a72af);})[_0x2bff('0x1d')](function(_0x243940){_0x10827a[_0x2bff('0x55')]=_0x243940;return _0x10827a;});}})[_0x2bff('0x1d')](respondWithFilteredResult(_0x1ee6dd,_0x5a72af))[_0x2bff('0x3d')](handleError(_0x1ee6dd,null));};exports[_0x2bff('0x5c')]=function(_0x2e133f,_0x185a0a,_0x589505){var _0x562da4={};var _0x5af8e7={};var _0x48308a;var _0x452ba9;return db['Campaign'][_0x2bff('0x51')]({'where':{'id':_0x2e133f[_0x2bff('0x3f')]['id']}})[_0x2bff('0x1d')](handleEntityNotFound(_0x185a0a,null))[_0x2bff('0x1d')](function(_0x3af0a2){if(_0x3af0a2){_0x48308a=_0x3af0a2;_0x5af8e7[_0x2bff('0x2b')]=_['keys'](db[_0x2bff('0x5d')][_0x2bff('0x29')]);_0x5af8e7[_0x2bff('0x2c')]=_[_0x2bff('0x40')](_0x2e133f[_0x2bff('0x2c')]);_0x5af8e7[_0x2bff('0x2d')]=_[_0x2bff('0x2e')](_0x5af8e7[_0x2bff('0x2b')],_0x5af8e7[_0x2bff('0x2c')]);_0x562da4[_0x2bff('0x2f')]=_[_0x2bff('0x2e')](_0x5af8e7[_0x2bff('0x2b')],qs['fields'](_0x2e133f['query']['fields']));_0x562da4[_0x2bff('0x2f')]=_0x562da4['attributes'][_0x2bff('0x30')]?_0x562da4[_0x2bff('0x2f')]:_0x5af8e7[_0x2bff('0x2b')];_0x562da4[_0x2bff('0x32')]=qs['sort'](_0x2e133f[_0x2bff('0x2c')]['sort']);_0x562da4[_0x2bff('0x34')]=qs[_0x2bff('0x2d')](_[_0x2bff('0x35')](_0x2e133f[_0x2bff('0x2c')],_0x5af8e7[_0x2bff('0x2d')]));if(_0x2e133f[_0x2bff('0x2c')][_0x2bff('0x36')]){_0x562da4['where']=_['merge'](_0x562da4[_0x2bff('0x34')],{'$or':_[_0x2bff('0x27')](_0x562da4[_0x2bff('0x2f')],function(_0x474135){var _0x431d11={};_0x431d11[_0x474135]={'$like':'%'+_0x2e133f['query']['filter']+'%'};return _0x431d11;})});}_0x562da4=_[_0x2bff('0x37')]({},_0x562da4,_0x2e133f[_0x2bff('0x39')]);return _0x48308a[_0x2bff('0x5c')](_0x562da4);}})[_0x2bff('0x1d')](function(_0x7050fb){if(_0x7050fb){_0x452ba9=_0x7050fb['length'];if(!_0x2e133f[_0x2bff('0x2c')][_0x2bff('0x53')]('nolimit')){_0x562da4[_0x2bff('0x17')]=qs[_0x2bff('0x17')](_0x2e133f[_0x2bff('0x2c')][_0x2bff('0x17')]);_0x562da4['offset']=qs[_0x2bff('0x16')](_0x2e133f[_0x2bff('0x2c')][_0x2bff('0x16')]);}return _0x48308a[_0x2bff('0x5c')](_0x562da4);}})[_0x2bff('0x1d')](function(_0x21d2f8){if(_0x21d2f8){return _0x21d2f8?{'count':_0x452ba9,'rows':_0x21d2f8}:null;}})['then'](respondWithResult(_0x185a0a,null))[_0x2bff('0x3d')](handleError(_0x185a0a,null));};exports[_0x2bff('0x5e')]=function(_0x26a3fd,_0x450fe8,_0x470555){var _0x25fd76,_0x156096;return db[_0x2bff('0x28')]['find']({'where':{'id':_0x26a3fd[_0x2bff('0x3f')]['id']}})[_0x2bff('0x1d')](handleEntityNotFound(_0x450fe8,null))[_0x2bff('0x1d')](function(_0x3b352a){if(_0x3b352a){_0x156096=_0x3b352a;return _0x3b352a[_0x2bff('0x5e')](_0x26a3fd[_0x2bff('0x44')][_0x2bff('0x5f')],_[_0x2bff('0x4d')](_0x26a3fd[_0x2bff('0x44')],[_0x2bff('0x5f'),'id'])||{});}return null;})[_0x2bff('0x60')](function(_0x30dc43){var _0xca5094;_0x25fd76=_0x30dc43||[];var _0x325630=[];if(_0x30dc43){for(var _0x5f5c94=0x0;_0x5f5c94<_0x30dc43[_0x2bff('0x30')];_0x5f5c94+=0x1){var _0x453795=_0x30dc43[_0x5f5c94][_0x2bff('0x1e')]({'plain':!![]});_0x156096[_0x2bff('0x61')]=_0x26a3fd[_0x2bff('0x44')]['dialCheckDuplicateType']?_0x26a3fd[_0x2bff('0x44')][_0x2bff('0x61')]:_0x156096['dialCheckDuplicateType'];switch(_0x156096[_0x2bff('0x61')]){case _0x2bff('0x62'):_0xca5094=squel[_0x2bff('0x63')]()['into'](_0x2bff('0x64'))[_0x2bff('0x65')]([_0x2bff('0x66'),_0x2bff('0x67'),_0x2bff('0x68'),_0x2bff('0x69'),_0x2bff('0x54'),_0x2bff('0x4e'),_0x2bff('0x4f')],squel[_0x2bff('0x6a')]()['field'](_0x2bff('0x66'),_0x2bff('0x66'))[_0x2bff('0x6b')](_0x2bff('0x6c'),'scheduledAt')['field']('id','ContactId')[_0x2bff('0x6b')](_0x453795[_0x2bff('0x6d')][_0x2bff('0x6e')](),'ListId')['field'](_0x26a3fd[_0x2bff('0x3f')]['id'][_0x2bff('0x6e')](),_0x2bff('0x54'))[_0x2bff('0x6b')]('NOW()',_0x2bff('0x4e'))[_0x2bff('0x6b')]('NOW()','updatedAt')[_0x2bff('0x6f')](_0x2bff('0x70'))['where'](_0x2bff('0x71'))[_0x2bff('0x34')]('ListId\x20=\x20?',_0x453795[_0x2bff('0x6d')][_0x2bff('0x6e')]())[_0x2bff('0x34')](_0x2bff('0x72'))[_0x2bff('0x34')](_0x2bff('0x73'),squel[_0x2bff('0x6a')]()[_0x2bff('0x6b')](_0x2bff('0x74'))['from'](_0x2bff('0x75'))[_0x2bff('0x34')](_0x2bff('0x76'),_0x26a3fd[_0x2bff('0x3f')]['id'][_0x2bff('0x6e')]()))[_0x2bff('0x34')](_0x2bff('0x73'),squel[_0x2bff('0x6a')]()[_0x2bff('0x6b')](_0x2bff('0x77'))[_0x2bff('0x6f')](_0x2bff('0x64'))[_0x2bff('0x34')](_0x2bff('0x76'),_0x26a3fd[_0x2bff('0x3f')]['id'][_0x2bff('0x6e')]())))[_0x2bff('0x6e')]();break;case _0x2bff('0x78'):_0xca5094=squel[_0x2bff('0x63')]()[_0x2bff('0x79')]('cm_hopper')[_0x2bff('0x65')](['phone',_0x2bff('0x67'),_0x2bff('0x68'),_0x2bff('0x69'),_0x2bff('0x54'),_0x2bff('0x4e'),_0x2bff('0x4f')],squel[_0x2bff('0x6a')]()[_0x2bff('0x6b')]('phone',_0x2bff('0x66'))['field'](_0x2bff('0x6c'),_0x2bff('0x67'))[_0x2bff('0x6b')]('id',_0x2bff('0x68'))['field'](_0x453795[_0x2bff('0x6d')][_0x2bff('0x6e')](),_0x2bff('0x69'))['field'](_0x26a3fd[_0x2bff('0x3f')]['id'][_0x2bff('0x6e')](),_0x2bff('0x54'))[_0x2bff('0x6b')](_0x2bff('0x6c'),'createdAt')[_0x2bff('0x6b')](_0x2bff('0x6c'),_0x2bff('0x4f'))[_0x2bff('0x6f')](_0x2bff('0x70'))[_0x2bff('0x34')](_0x2bff('0x71'))[_0x2bff('0x34')](_0x2bff('0x7a'),_0x453795[_0x2bff('0x6d')]['toString']())[_0x2bff('0x34')](_0x2bff('0x72'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x2bff('0x6a')]()[_0x2bff('0x6b')](_0x2bff('0x77'))[_0x2bff('0x6f')](_0x2bff('0x64'))[_0x2bff('0x34')](_0x2bff('0x76'),_0x26a3fd[_0x2bff('0x3f')]['id'][_0x2bff('0x6e')]())))['toString']();break;default:_0xca5094=squel['insert']()[_0x2bff('0x79')]('cm_hopper')[_0x2bff('0x65')](['phone',_0x2bff('0x67'),_0x2bff('0x68'),_0x2bff('0x69'),_0x2bff('0x54'),'createdAt',_0x2bff('0x4f')],squel[_0x2bff('0x6a')]()[_0x2bff('0x6b')](_0x2bff('0x66'),'phone')[_0x2bff('0x6b')](_0x2bff('0x6c'),_0x2bff('0x67'))[_0x2bff('0x6b')]('id','ContactId')['field'](_0x453795[_0x2bff('0x6d')]['toString'](),_0x2bff('0x69'))[_0x2bff('0x6b')](_0x26a3fd[_0x2bff('0x3f')]['id'][_0x2bff('0x6e')](),_0x2bff('0x54'))[_0x2bff('0x6b')]('NOW()','createdAt')[_0x2bff('0x6b')](_0x2bff('0x6c'),'updatedAt')[_0x2bff('0x6f')](_0x2bff('0x70'))['where']('deletedAt\x20IS\x20NULL')[_0x2bff('0x34')]('ListId\x20=\x20?',_0x453795[_0x2bff('0x6d')][_0x2bff('0x6e')]())[_0x2bff('0x34')](_0x2bff('0x72')))['toString']();}_0x325630[_0x2bff('0x7b')](db[_0x2bff('0x7c')][_0x2bff('0x2c')](_0xca5094));}return BPromise[_0x2bff('0x7d')](_0x325630);}})[_0x2bff('0x1d')](function(){return _0x25fd76;})[_0x2bff('0x1d')](respondWithResult(_0x450fe8,null))['catch'](handleError(_0x450fe8,null));};exports[_0x2bff('0x7e')]=function(_0x4c7e4e,_0x3f9969,_0x9ce6){return db[_0x2bff('0x28')][_0x2bff('0x4c')]({'where':{'id':_0x4c7e4e[_0x2bff('0x3f')]['id']}})[_0x2bff('0x1d')](handleEntityNotFound(_0x3f9969,null))['then'](function(_0x3ab962){if(_0x3ab962){return _0x3ab962[_0x2bff('0x7e')](_0x4c7e4e[_0x2bff('0x2c')][_0x2bff('0x5f')]);}})['then'](function(_0x48cb8f){if(_0x48cb8f){return db[_0x2bff('0x52')][_0x2bff('0x21')]({'where':{'ListId':_0x4c7e4e['query'][_0x2bff('0x5f')],'CampaignId':_0x4c7e4e[_0x2bff('0x3f')]['id']}})[_0x2bff('0x1d')](function(){return _0x48cb8f;});}})[_0x2bff('0x1d')](respondWithStatusCode(_0x3f9969,null))['catch'](handleError(_0x3f9969,null));};exports[_0x2bff('0x7f')]=function(_0x3ea51f,_0x37a37f,_0x5cb067){var _0x2a83fc={'raw':!![],'where':{}};var _0x432be7={};var _0x101aa3={'count':0x0,'rows':[]};return db[_0x2bff('0x28')][_0x2bff('0x51')]({'where':{'id':_0x3ea51f[_0x2bff('0x3f')]['id']}})[_0x2bff('0x1d')](handleEntityNotFound(_0x37a37f,null))[_0x2bff('0x1d')](function(_0x39c4ec){if(_0x39c4ec){_0x432be7[_0x2bff('0x2b')]=_[_0x2bff('0x40')](db[_0x2bff('0x5d')]['rawAttributes']);_0x432be7[_0x2bff('0x2c')]=_[_0x2bff('0x40')](_0x3ea51f[_0x2bff('0x2c')]);_0x432be7[_0x2bff('0x2d')]=_[_0x2bff('0x2e')](_0x432be7[_0x2bff('0x2b')],_0x432be7[_0x2bff('0x2c')]);_0x2a83fc[_0x2bff('0x2f')]=_['intersection'](_0x432be7[_0x2bff('0x2b')],qs[_0x2bff('0x41')](_0x3ea51f[_0x2bff('0x2c')][_0x2bff('0x41')]));_0x2a83fc[_0x2bff('0x2f')]=_0x2a83fc[_0x2bff('0x2f')]['length']?_0x2a83fc[_0x2bff('0x2f')]:_0x432be7[_0x2bff('0x2b')];if(!_0x3ea51f['query'][_0x2bff('0x53')](_0x2bff('0x31'))){_0x2a83fc['limit']=qs['limit'](_0x3ea51f[_0x2bff('0x2c')]['limit']);_0x2a83fc['offset']=qs['offset'](_0x3ea51f['query'][_0x2bff('0x16')]);}_0x2a83fc['order']=qs[_0x2bff('0x33')](_0x3ea51f[_0x2bff('0x2c')][_0x2bff('0x33')]);_0x2a83fc[_0x2bff('0x34')]=qs[_0x2bff('0x2d')](_[_0x2bff('0x35')](_0x3ea51f[_0x2bff('0x2c')],_0x432be7[_0x2bff('0x2d')]));_0x2a83fc[_0x2bff('0x34')]['CampaignId']=_0x39c4ec['id'];if(_0x3ea51f[_0x2bff('0x2c')]['filter']){_0x2a83fc['where']=_['merge'](_0x2a83fc[_0x2bff('0x34')],{'$or':_['map'](_0x2a83fc[_0x2bff('0x2f')],function(_0x28971f){var _0x1a86d3={};_0x1a86d3[_0x28971f]={'$like':'%'+_0x3ea51f[_0x2bff('0x2c')][_0x2bff('0x36')]+'%'};return _0x1a86d3;})});}_0x2a83fc=_[_0x2bff('0x37')]({},_0x2a83fc,_0x3ea51f['options']);return db['CmList'][_0x2bff('0x3a')]({'where':_0x2a83fc[_0x2bff('0x34')]})[_0x2bff('0x1d')](function(_0x5f2255){_0x101aa3[_0x2bff('0x3a')]=_0x5f2255;if(_0x3ea51f[_0x2bff('0x2c')][_0x2bff('0x42')]){_0x2a83fc[_0x2bff('0x3b')]=[{'all':!![]}];}return db[_0x2bff('0x5d')][_0x2bff('0x3c')](_0x2a83fc);})[_0x2bff('0x1d')](function(_0x1608a1){_0x101aa3[_0x2bff('0x55')]=_0x1608a1;return _0x101aa3;});}})[_0x2bff('0x1d')](respondWithFilteredResult(_0x37a37f,_0x2a83fc))[_0x2bff('0x3d')](handleError(_0x37a37f,null));};exports[_0x2bff('0x80')]=function(_0x2ab50f,_0x39bc49,_0x336ede){var _0x8be6e1,_0x8fb70c;return db[_0x2bff('0x28')][_0x2bff('0x4c')]({'where':{'id':_0x2ab50f[_0x2bff('0x3f')]['id']}})[_0x2bff('0x1d')](handleEntityNotFound(_0x39bc49,null))[_0x2bff('0x1d')](function(_0x446f56){if(_0x446f56){_0x8fb70c=_0x446f56;return _0x446f56[_0x2bff('0x80')](_0x2ab50f[_0x2bff('0x44')][_0x2bff('0x5f')],_[_0x2bff('0x4d')](_0x2ab50f['body'],[_0x2bff('0x5f'),'id'])||{});}return null;})[_0x2bff('0x60')](function(_0x3a04ba){var _0x29afde;_0x8be6e1=_0x3a04ba||[];var _0x3e8035=[];if(_0x3a04ba){for(var _0x2389a3=0x0;_0x2389a3<_0x3a04ba['length'];_0x2389a3+=0x1){var _0x2e1363=_0x3a04ba[_0x2389a3][_0x2bff('0x1e')]({'plain':!![]});_0x29afde=squel['insert']()[_0x2bff('0x79')](_0x2bff('0x81'))[_0x2bff('0x65')]([_0x2bff('0x66'),_0x2bff('0x68'),_0x2bff('0x69'),'CampaignId','createdAt',_0x2bff('0x4f')],squel[_0x2bff('0x6a')]()[_0x2bff('0x6b')]('phone',_0x2bff('0x66'))[_0x2bff('0x6b')]('id',_0x2bff('0x68'))[_0x2bff('0x6b')](_0x2e1363['CmListId'][_0x2bff('0x6e')](),_0x2bff('0x69'))[_0x2bff('0x6b')](_0x2ab50f[_0x2bff('0x3f')]['id'][_0x2bff('0x6e')](),_0x2bff('0x54'))[_0x2bff('0x6b')](_0x2bff('0x6c'),_0x2bff('0x4e'))[_0x2bff('0x6b')]('NOW()',_0x2bff('0x4f'))[_0x2bff('0x6f')](_0x2bff('0x70'))[_0x2bff('0x34')](_0x2bff('0x71'))[_0x2bff('0x34')]('ListId\x20=\x20?',_0x2e1363[_0x2bff('0x6d')][_0x2bff('0x6e')]())[_0x2bff('0x34')]('phone\x20IS\x20NOT\x20NULL'))[_0x2bff('0x6e')]();_0x3e8035[_0x2bff('0x7b')](db[_0x2bff('0x7c')]['query'](_0x29afde));}return BPromise[_0x2bff('0x7d')](_0x3e8035);}})[_0x2bff('0x1d')](function(){return _0x8be6e1;})['then'](respondWithResult(_0x39bc49,null))['catch'](handleError(_0x39bc49,null));};exports[_0x2bff('0x82')]=function(_0x4e7f94,_0x54c224,_0x202286){return db[_0x2bff('0x28')]['find']({'where':{'id':_0x4e7f94['params']['id']}})[_0x2bff('0x1d')](handleEntityNotFound(_0x54c224,null))[_0x2bff('0x1d')](function(_0x4c3e32){if(_0x4c3e32){return _0x4c3e32[_0x2bff('0x82')](_0x4e7f94[_0x2bff('0x2c')][_0x2bff('0x5f')]);}})[_0x2bff('0x1d')](function(_0x4b8107){if(_0x4b8107){return db['CmHopperBlack'][_0x2bff('0x21')]({'where':{'ListId':_0x4e7f94[_0x2bff('0x2c')][_0x2bff('0x5f')],'CampaignId':_0x4e7f94[_0x2bff('0x3f')]['id']}})[_0x2bff('0x1d')](function(){return _0x4b8107;});}})['then'](respondWithStatusCode(_0x54c224,null))[_0x2bff('0x3d')](handleError(_0x54c224,null));}; \ No newline at end of file +var _0x5734=['CampaignId','rows','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','CampaignId\x20=\x20?','insert','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','apply','reject','then','destroy','get','IvrCampaigns','end','stack','name','send','index','map','Campaign','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rawAttributes','omit','updatedAt','body','createdAt','role','update','getHoppers','findOne','CmHopper','hasOwnProperty'];(function(_0x50d958,_0x7b341b){var _0x440ed9=function(_0x5a49ef){while(--_0x5a49ef){_0x50d958['push'](_0x50d958['shift']());}};_0x440ed9(++_0x7b341b);}(_0x5734,0xb1));var _0x4573=function(_0x149a9b,_0x5bb275){_0x149a9b=_0x149a9b-0x0;var _0x2c2bf6=_0x5734[_0x149a9b];return _0x2c2bf6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4573('0x0'));var rimraf=require(_0x4573('0x1'));var zipdir=require(_0x4573('0x2'));var jsonpatch=require(_0x4573('0x3'));var rp=require('request-promise');var moment=require(_0x4573('0x4'));var BPromise=require(_0x4573('0x5'));var Mustache=require('mustache');var util=require(_0x4573('0x6'));var path=require('path');var sox=require(_0x4573('0x7'));var csv=require(_0x4573('0x8'));var ejs=require(_0x4573('0x9'));var fs=require('fs');var _=require(_0x4573('0xa'));var squel=require('squel');var crypto=require(_0x4573('0xb'));var jsforce=require(_0x4573('0xc'));var deskjs=require(_0x4573('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4573('0xe'));var Papa=require(_0x4573('0xf'));var Redis=require(_0x4573('0x10'));var authService=require(_0x4573('0x11'));var qs=require(_0x4573('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4573('0x13'));var logger=require(_0x4573('0x14'))(_0x4573('0x15'));var utils=require('../../config/utils');var config=require(_0x4573('0x16'));var db=require(_0x4573('0x17'))['db'];function respondWithStatusCode(_0x5adb1d,_0x111794){_0x111794=_0x111794||0xcc;return function(_0x253428){if(_0x253428){return _0x5adb1d[_0x4573('0x18')](_0x111794);}return _0x5adb1d[_0x4573('0x19')](_0x111794)['end']();};}function respondWithResult(_0x166463,_0x200b0d){_0x200b0d=_0x200b0d||0xc8;return function(_0x123b6f){if(_0x123b6f){return _0x166463[_0x4573('0x19')](_0x200b0d)[_0x4573('0x1a')](_0x123b6f);}};}function respondWithFilteredResult(_0x4dcbd1,_0x48eb7a){return function(_0x4fb55c){if(_0x4fb55c){var _0x41fb9e=_0x4fb55c[_0x4573('0x1b')],_0x509982=_0x48eb7a['offset'],_0x3caccb=_0x48eb7a[_0x4573('0x1c')]+_0x48eb7a['limit'],_0x47c8ee;if(_0x3caccb>=_0x41fb9e){_0x3caccb=_0x41fb9e;_0x47c8ee=0xc8;}else{_0x47c8ee=0xce;}_0x4dcbd1[_0x4573('0x19')](_0x47c8ee);return _0x4dcbd1['set'](_0x4573('0x1d'),_0x509982+'-'+_0x3caccb+'/'+_0x41fb9e)[_0x4573('0x1a')](_0x4fb55c);}return null;};}function patchUpdates(_0x57ccb9){return function(_0x12acae){try{jsonpatch[_0x4573('0x1e')](_0x12acae,_0x57ccb9,!![]);}catch(_0x5de2c7){return BPromise[_0x4573('0x1f')](_0x5de2c7);}return _0x12acae['save']();};}function saveUpdates(_0x3622ab,_0x4ca4dc){return function(_0x1bc016){if(_0x1bc016){return _0x1bc016['update'](_0x3622ab)[_0x4573('0x20')](function(_0x2787f5){return _0x2787f5;});}return null;};}function removeEntity(_0x10028d,_0x256f5c){return function(_0x7ad63c){if(_0x7ad63c){return _0x7ad63c[_0x4573('0x21')]()[_0x4573('0x20')](function(){var _0x62527b=_0x7ad63c[_0x4573('0x22')]({'plain':!![]});var _0x569319=_0x4573('0x23');return db['UserProfileResource'][_0x4573('0x21')]({'where':{'type':_0x569319,'resourceId':_0x62527b['id']}})[_0x4573('0x20')](function(){return _0x7ad63c;});})['then'](function(){_0x10028d['status'](0xcc)[_0x4573('0x24')]();});}};}function handleEntityNotFound(_0x3572b9,_0x1d5af4){return function(_0x4a48f6){if(!_0x4a48f6){_0x3572b9[_0x4573('0x18')](0x194);}return _0x4a48f6;};}function handleError(_0x20b0e0,_0x342453){_0x342453=_0x342453||0x1f4;return function(_0x1b799f){logger['error'](_0x1b799f[_0x4573('0x25')]);if(_0x1b799f[_0x4573('0x26')]){delete _0x1b799f['name'];}_0x20b0e0[_0x4573('0x19')](_0x342453)[_0x4573('0x27')](_0x1b799f);};}exports[_0x4573('0x28')]=function(_0x3cf9c8,_0xa87e36){var _0x2794b2={},_0x4d4c8f={},_0x3dd7f4={'count':0x0,'rows':[]};var _0x5d931d=_[_0x4573('0x29')](db[_0x4573('0x2a')]['rawAttributes'],function(_0x5f00af){return{'name':_0x5f00af[_0x4573('0x2b')],'type':_0x5f00af[_0x4573('0x2c')]['key']};});_0x4d4c8f[_0x4573('0x2d')]=_[_0x4573('0x29')](_0x5d931d,'name');_0x4d4c8f[_0x4573('0x2e')]=_[_0x4573('0x2f')](_0x3cf9c8['query']);_0x4d4c8f[_0x4573('0x30')]=_['intersection'](_0x4d4c8f[_0x4573('0x2d')],_0x4d4c8f['query']);_0x2794b2[_0x4573('0x31')]=_[_0x4573('0x32')](_0x4d4c8f['model'],qs[_0x4573('0x33')](_0x3cf9c8[_0x4573('0x2e')][_0x4573('0x33')]));_0x2794b2[_0x4573('0x31')]=_0x2794b2[_0x4573('0x31')][_0x4573('0x34')]?_0x2794b2[_0x4573('0x31')]:_0x4d4c8f[_0x4573('0x2d')];if(!_0x3cf9c8[_0x4573('0x2e')]['hasOwnProperty'](_0x4573('0x35'))){_0x2794b2[_0x4573('0x36')]=qs[_0x4573('0x36')](_0x3cf9c8[_0x4573('0x2e')][_0x4573('0x36')]);_0x2794b2[_0x4573('0x1c')]=qs[_0x4573('0x1c')](_0x3cf9c8['query']['offset']);}_0x2794b2[_0x4573('0x37')]=qs['sort'](_0x3cf9c8['query'][_0x4573('0x38')]);_0x2794b2[_0x4573('0x39')]=qs['filters'](_[_0x4573('0x3a')](_0x3cf9c8[_0x4573('0x2e')],_0x4d4c8f[_0x4573('0x30')]),_0x5d931d);if(_0x3cf9c8[_0x4573('0x2e')]['filter']){_0x2794b2[_0x4573('0x39')]=_[_0x4573('0x3b')](_0x2794b2['where'],{'$or':_[_0x4573('0x29')](_0x5d931d,function(_0x40d2a5){if(_0x40d2a5[_0x4573('0x2c')]!==_0x4573('0x3c')){var _0x2114e4={};_0x2114e4[_0x40d2a5['name']]={'$like':'%'+_0x3cf9c8[_0x4573('0x2e')][_0x4573('0x3d')]+'%'};return _0x2114e4;}})});}_0x2794b2=_[_0x4573('0x3b')]({},_0x2794b2,_0x3cf9c8[_0x4573('0x3e')]);var _0x22446d={'where':_0x2794b2['where']};return db[_0x4573('0x2a')]['count'](_0x22446d)[_0x4573('0x20')](function(_0x479490){_0x3dd7f4[_0x4573('0x1b')]=_0x479490;if(_0x3cf9c8[_0x4573('0x2e')][_0x4573('0x3f')]){_0x2794b2[_0x4573('0x40')]=[{'all':!![]}];}return db[_0x4573('0x2a')][_0x4573('0x41')](_0x2794b2);})[_0x4573('0x20')](function(_0x440e0f){_0x3dd7f4['rows']=_0x440e0f;return _0x3dd7f4;})['then'](respondWithFilteredResult(_0xa87e36,_0x2794b2))[_0x4573('0x42')](handleError(_0xa87e36,null));};exports['show']=function(_0x4c38dc,_0x483315){var _0x2d92a3={'raw':![],'where':{'id':_0x4c38dc[_0x4573('0x43')]['id']}},_0x2fa7e3={};_0x2fa7e3[_0x4573('0x2d')]=_['keys'](db[_0x4573('0x2a')]['rawAttributes']);_0x2fa7e3['query']=_[_0x4573('0x2f')](_0x4c38dc[_0x4573('0x2e')]);_0x2fa7e3[_0x4573('0x30')]=_['intersection'](_0x2fa7e3['model'],_0x2fa7e3[_0x4573('0x2e')]);_0x2d92a3[_0x4573('0x31')]=_[_0x4573('0x32')](_0x2fa7e3['model'],qs['fields'](_0x4c38dc[_0x4573('0x2e')][_0x4573('0x33')]));_0x2d92a3[_0x4573('0x31')]=_0x2d92a3['attributes'][_0x4573('0x34')]?_0x2d92a3[_0x4573('0x31')]:_0x2fa7e3['model'];if(_0x4c38dc[_0x4573('0x2e')][_0x4573('0x3f')]){_0x2d92a3[_0x4573('0x40')]=[{'all':!![]}];}_0x2d92a3=_['merge']({},_0x2d92a3,_0x4c38dc[_0x4573('0x3e')]);return db['Campaign'][_0x4573('0x44')](_0x2d92a3)[_0x4573('0x20')](handleEntityNotFound(_0x483315,null))[_0x4573('0x20')](respondWithResult(_0x483315,null))['catch'](handleError(_0x483315,null));};exports[_0x4573('0x45')]=function(_0x50012f,_0x1762ce){return db[_0x4573('0x2a')]['create'](_0x50012f['body'],{})[_0x4573('0x20')](function(_0x492ea1){var _0x550477=_0x50012f[_0x4573('0x46')][_0x4573('0x22')]({'plain':!![]});if(!_0x550477)throw new Error(_0x4573('0x47'));if(_0x550477['role']==='user'){var _0x46cc29=_0x492ea1[_0x4573('0x22')]({'plain':!![]});var _0x3017ce=_0x4573('0x23');return db[_0x4573('0x48')]['find']({'where':{'name':_0x3017ce,'userProfileId':_0x550477[_0x4573('0x49')]},'raw':!![]})[_0x4573('0x20')](function(_0x6326f5){if(_0x6326f5&&_0x6326f5[_0x4573('0x4a')]===0x0){return db[_0x4573('0x4b')][_0x4573('0x45')]({'name':_0x46cc29[_0x4573('0x26')],'resourceId':_0x46cc29['id'],'type':_0x6326f5[_0x4573('0x26')],'sectionId':_0x6326f5['id']},{})[_0x4573('0x20')](function(){return _0x492ea1;});}else{return _0x492ea1;}})['catch'](function(_0x597710){logger[_0x4573('0x4c')](_0x4573('0x4d'),_0x597710);throw _0x597710;});}return _0x492ea1;})[_0x4573('0x20')](respondWithResult(_0x1762ce,0xc9))[_0x4573('0x42')](handleError(_0x1762ce,null));};exports['clone']=function(_0x30c5ff,_0xd80b1a){var _0x58b613={'where':{'id':_0x30c5ff[_0x4573('0x43')]['id']}},_0x327562={};_0x327562[_0x4573('0x2d')]=_[_0x4573('0x2f')](db['Campaign'][_0x4573('0x4e')]);_0x58b613[_0x4573('0x31')]=_[_0x4573('0x32')](_0x327562[_0x4573('0x2d')],qs[_0x4573('0x33')](_0x30c5ff['query'][_0x4573('0x33')]));_0x58b613[_0x4573('0x31')]=_0x58b613[_0x4573('0x31')][_0x4573('0x34')]?_0x58b613[_0x4573('0x31')]:_0x327562['model'];if(_0x30c5ff[_0x4573('0x2e')]['includeAll']){_0x58b613[_0x4573('0x40')]=[{'all':!![]}];}_0x58b613=_['merge']({},_0x58b613,_0x30c5ff[_0x4573('0x3e')]);return db[_0x4573('0x2a')]['find'](_0x58b613)[_0x4573('0x20')](handleEntityNotFound(_0xd80b1a,null))[_0x4573('0x20')](function(_0x56a749){if(_0x56a749){var _0x5eed19=_0x56a749[_0x4573('0x22')]({'plain':!![]});_0x5eed19=qs[_0x4573('0x4f')](_0x5eed19,['id','createdAt',_0x4573('0x50')]);_0x30c5ff[_0x4573('0x51')]=_[_0x4573('0x4f')](_0x30c5ff['body'],['id',_0x4573('0x52'),_0x4573('0x50')]);return db[_0x4573('0x2a')]['create'](_[_0x4573('0x3b')](_0x5eed19,_0x30c5ff['body']),{'include':_0x30c5ff[_0x4573('0x2e')][_0x4573('0x3f')]?[{'all':!![]}]:undefined})[_0x4573('0x20')](function(_0x2ef687){var _0x5425fe=_0x30c5ff[_0x4573('0x46')]['get']({'plain':!![]});if(!_0x5425fe)throw new Error(_0x4573('0x47'));if(_0x5425fe[_0x4573('0x53')]===_0x4573('0x46')){var _0x902c31=_0x2ef687['get']({'plain':!![]});var _0x124345='IvrCampaigns';return db[_0x4573('0x48')][_0x4573('0x44')]({'where':{'name':_0x124345,'userProfileId':_0x5425fe[_0x4573('0x49')]},'raw':!![]})[_0x4573('0x20')](function(_0x504573){if(_0x504573&&_0x504573['autoAssociation']===0x0){return db[_0x4573('0x4b')][_0x4573('0x45')]({'name':_0x902c31['name'],'resourceId':_0x902c31['id'],'type':_0x504573['name'],'sectionId':_0x504573['id']},{})[_0x4573('0x20')](function(){return _0x2ef687;});}else{return _0x2ef687;}})['catch'](function(_0x4ab5e9){logger['error'](_0x4573('0x4d'),_0x4ab5e9);throw _0x4ab5e9;});}return _0x2ef687;});}})['then'](respondWithResult(_0xd80b1a,0xc9))[_0x4573('0x42')](handleError(_0xd80b1a,null));};exports[_0x4573('0x54')]=function(_0xc6bdf,_0xc56dd4){if(_0xc6bdf[_0x4573('0x51')]['id']){delete _0xc6bdf[_0x4573('0x51')]['id'];}return db[_0x4573('0x2a')][_0x4573('0x44')]({'where':{'id':_0xc6bdf['params']['id']}})[_0x4573('0x20')](handleEntityNotFound(_0xc56dd4,null))['then'](saveUpdates(_0xc6bdf[_0x4573('0x51')],null))['then'](respondWithResult(_0xc56dd4,null))['catch'](handleError(_0xc56dd4,null));};exports[_0x4573('0x21')]=function(_0x654d13,_0x6e8bb6){return db[_0x4573('0x2a')][_0x4573('0x44')]({'where':{'id':_0x654d13['params']['id']}})[_0x4573('0x20')](handleEntityNotFound(_0x6e8bb6,null))[_0x4573('0x20')](removeEntity(_0x6e8bb6,null))['catch'](handleError(_0x6e8bb6,null));};exports[_0x4573('0x55')]=function(_0x14575f,_0x7cf8ad,_0x153428){var _0xb067fc={'raw':!![],'where':{}};var _0x10db91={};var _0xc0efdb={'count':0x0,'rows':[]};return db[_0x4573('0x2a')][_0x4573('0x56')]({'where':{'id':_0x14575f['params']['id']}})[_0x4573('0x20')](handleEntityNotFound(_0x7cf8ad,null))[_0x4573('0x20')](function(_0x1e8e88){if(_0x1e8e88){_0x10db91[_0x4573('0x2d')]=_[_0x4573('0x2f')](db[_0x4573('0x57')]['rawAttributes']);_0x10db91[_0x4573('0x2e')]=_[_0x4573('0x2f')](_0x14575f[_0x4573('0x2e')]);_0x10db91['filters']=_['intersection'](_0x10db91[_0x4573('0x2d')],_0x10db91[_0x4573('0x2e')]);_0xb067fc[_0x4573('0x31')]=_[_0x4573('0x32')](_0x10db91[_0x4573('0x2d')],qs[_0x4573('0x33')](_0x14575f[_0x4573('0x2e')][_0x4573('0x33')]));_0xb067fc['attributes']=_0xb067fc[_0x4573('0x31')]['length']?_0xb067fc['attributes']:_0x10db91[_0x4573('0x2d')];if(!_0x14575f[_0x4573('0x2e')][_0x4573('0x58')]('nolimit')){_0xb067fc[_0x4573('0x36')]=qs[_0x4573('0x36')](_0x14575f['query'][_0x4573('0x36')]);_0xb067fc[_0x4573('0x1c')]=qs[_0x4573('0x1c')](_0x14575f[_0x4573('0x2e')][_0x4573('0x1c')]);}_0xb067fc['order']=qs[_0x4573('0x38')](_0x14575f[_0x4573('0x2e')][_0x4573('0x38')]);_0xb067fc['where']=qs['filters'](_['pick'](_0x14575f[_0x4573('0x2e')],_0x10db91[_0x4573('0x30')]));_0xb067fc['where'][_0x4573('0x59')]=_0x1e8e88['id'];if(_0x14575f[_0x4573('0x2e')][_0x4573('0x3d')]){_0xb067fc[_0x4573('0x39')]=_['merge'](_0xb067fc[_0x4573('0x39')],{'$or':_[_0x4573('0x29')](_0xb067fc[_0x4573('0x31')],function(_0xd465f){var _0xe0b69e={};_0xe0b69e[_0xd465f]={'$like':'%'+_0x14575f[_0x4573('0x2e')][_0x4573('0x3d')]+'%'};return _0xe0b69e;})});}_0xb067fc=_[_0x4573('0x3b')]({},_0xb067fc,_0x14575f[_0x4573('0x3e')]);return db[_0x4573('0x57')][_0x4573('0x1b')]({'where':_0xb067fc['where']})['then'](function(_0x20a045){_0xc0efdb['count']=_0x20a045;if(_0x14575f[_0x4573('0x2e')][_0x4573('0x3f')]){_0xb067fc[_0x4573('0x40')]=[{'all':!![]}];}return db[_0x4573('0x57')][_0x4573('0x41')](_0xb067fc);})[_0x4573('0x20')](function(_0x281c13){_0xc0efdb[_0x4573('0x5a')]=_0x281c13;return _0xc0efdb;});}})[_0x4573('0x20')](respondWithFilteredResult(_0x7cf8ad,_0xb067fc))[_0x4573('0x42')](handleError(_0x7cf8ad,null));};exports['getHopperHistories']=function(_0xccb0ce,_0x1c8d21,_0x15626e){var _0x56d8c8={'raw':!![],'where':{}};var _0x5a1e64={};var _0x1ad3db={'count':0x0,'rows':[]};return db[_0x4573('0x2a')][_0x4573('0x56')]({'where':{'id':_0xccb0ce['params']['id']}})['then'](handleEntityNotFound(_0x1c8d21,null))[_0x4573('0x20')](function(_0x579dcd){if(_0x579dcd){_0x5a1e64[_0x4573('0x2d')]=_['keys'](db[_0x4573('0x5b')][_0x4573('0x4e')]);_0x5a1e64['query']=_[_0x4573('0x2f')](_0xccb0ce['query']);_0x5a1e64['filters']=_[_0x4573('0x32')](_0x5a1e64[_0x4573('0x2d')],_0x5a1e64[_0x4573('0x2e')]);_0x56d8c8[_0x4573('0x31')]=_[_0x4573('0x32')](_0x5a1e64[_0x4573('0x2d')],qs['fields'](_0xccb0ce[_0x4573('0x2e')][_0x4573('0x33')]));_0x56d8c8['attributes']=_0x56d8c8['attributes'][_0x4573('0x34')]?_0x56d8c8['attributes']:_0x5a1e64['model'];if(!_0xccb0ce['query'][_0x4573('0x58')](_0x4573('0x35'))){_0x56d8c8['limit']=qs[_0x4573('0x36')](_0xccb0ce[_0x4573('0x2e')][_0x4573('0x36')]);_0x56d8c8[_0x4573('0x1c')]=qs['offset'](_0xccb0ce[_0x4573('0x2e')][_0x4573('0x1c')]);}_0x56d8c8[_0x4573('0x37')]=qs[_0x4573('0x38')](_0xccb0ce['query'][_0x4573('0x38')]);_0x56d8c8[_0x4573('0x39')]=qs[_0x4573('0x30')](_[_0x4573('0x3a')](_0xccb0ce[_0x4573('0x2e')],_0x5a1e64[_0x4573('0x30')]));_0x56d8c8['where'][_0x4573('0x59')]=_0x579dcd['id'];if(_0xccb0ce[_0x4573('0x2e')][_0x4573('0x3d')]){_0x56d8c8['where']=_[_0x4573('0x3b')](_0x56d8c8[_0x4573('0x39')],{'$or':_[_0x4573('0x29')](_0x56d8c8[_0x4573('0x31')],function(_0xb77ebd){var _0x4150b3={};_0x4150b3[_0xb77ebd]={'$like':'%'+_0xccb0ce['query'][_0x4573('0x3d')]+'%'};return _0x4150b3;})});}_0x56d8c8=_[_0x4573('0x3b')]({},_0x56d8c8,_0xccb0ce[_0x4573('0x3e')]);return db[_0x4573('0x5b')]['count']({'where':_0x56d8c8[_0x4573('0x39')]})['then'](function(_0x2aa973){_0x1ad3db[_0x4573('0x1b')]=_0x2aa973;if(_0xccb0ce[_0x4573('0x2e')][_0x4573('0x3f')]){_0x56d8c8[_0x4573('0x40')]=[{'all':!![]}];}return db[_0x4573('0x5b')][_0x4573('0x41')](_0x56d8c8);})[_0x4573('0x20')](function(_0x25c068){_0x1ad3db['rows']=_0x25c068;return _0x1ad3db;});}})[_0x4573('0x20')](respondWithFilteredResult(_0x1c8d21,_0x56d8c8))[_0x4573('0x42')](handleError(_0x1c8d21,null));};exports[_0x4573('0x5c')]=function(_0x40413d,_0x2b12c4,_0x2d0eff){var _0x26dd5c={'raw':!![],'where':{}};var _0x2e3427={};var _0x40f708={'count':0x0,'rows':[]};return db[_0x4573('0x2a')][_0x4573('0x56')]({'where':{'id':_0x40413d['params']['id']}})[_0x4573('0x20')](handleEntityNotFound(_0x2b12c4,null))[_0x4573('0x20')](function(_0x9916e6){if(_0x9916e6){_0x2e3427['model']=_[_0x4573('0x2f')](db[_0x4573('0x5d')][_0x4573('0x4e')]);_0x2e3427['query']=_['keys'](_0x40413d[_0x4573('0x2e')]);_0x2e3427[_0x4573('0x30')]=_[_0x4573('0x32')](_0x2e3427['model'],_0x2e3427[_0x4573('0x2e')]);_0x26dd5c[_0x4573('0x31')]=_[_0x4573('0x32')](_0x2e3427[_0x4573('0x2d')],qs[_0x4573('0x33')](_0x40413d['query']['fields']));_0x26dd5c[_0x4573('0x31')]=_0x26dd5c[_0x4573('0x31')][_0x4573('0x34')]?_0x26dd5c['attributes']:_0x2e3427[_0x4573('0x2d')];if(!_0x40413d[_0x4573('0x2e')][_0x4573('0x58')](_0x4573('0x35'))){_0x26dd5c[_0x4573('0x36')]=qs['limit'](_0x40413d[_0x4573('0x2e')][_0x4573('0x36')]);_0x26dd5c[_0x4573('0x1c')]=qs['offset'](_0x40413d['query'][_0x4573('0x1c')]);}_0x26dd5c[_0x4573('0x37')]=qs['sort'](_0x40413d[_0x4573('0x2e')][_0x4573('0x38')]);_0x26dd5c[_0x4573('0x39')]=qs['filters'](_['pick'](_0x40413d['query'],_0x2e3427[_0x4573('0x30')]));_0x26dd5c['where']['CampaignId']=_0x9916e6['id'];if(_0x40413d[_0x4573('0x2e')][_0x4573('0x3d')]){_0x26dd5c['where']=_['merge'](_0x26dd5c[_0x4573('0x39')],{'$or':_[_0x4573('0x29')](_0x26dd5c['attributes'],function(_0x32ab57){var _0x30537f={};_0x30537f[_0x32ab57]={'$like':'%'+_0x40413d[_0x4573('0x2e')][_0x4573('0x3d')]+'%'};return _0x30537f;})});}_0x26dd5c=_[_0x4573('0x3b')]({},_0x26dd5c,_0x40413d[_0x4573('0x3e')]);return db[_0x4573('0x5d')][_0x4573('0x1b')]({'where':_0x26dd5c['where']})[_0x4573('0x20')](function(_0x3c3a97){_0x40f708[_0x4573('0x1b')]=_0x3c3a97;if(_0x40413d[_0x4573('0x2e')]['includeAll']){_0x26dd5c[_0x4573('0x40')]=[{'all':!![]}];}return db[_0x4573('0x5d')]['findAll'](_0x26dd5c);})['then'](function(_0x7dd2bf){_0x40f708[_0x4573('0x5a')]=_0x7dd2bf;return _0x40f708;});}})[_0x4573('0x20')](respondWithFilteredResult(_0x2b12c4,_0x26dd5c))[_0x4573('0x42')](handleError(_0x2b12c4,null));};exports['getHopperBlacks']=function(_0x32028a,_0x1385bc,_0x5d85cb){var _0x19b3df={'raw':!![],'where':{}};var _0x10df97={};var _0x36bcff={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x32028a[_0x4573('0x43')]['id']}})['then'](handleEntityNotFound(_0x1385bc,null))['then'](function(_0x6ee651){if(_0x6ee651){_0x10df97[_0x4573('0x2d')]=_[_0x4573('0x2f')](db[_0x4573('0x5e')][_0x4573('0x4e')]);_0x10df97[_0x4573('0x2e')]=_['keys'](_0x32028a[_0x4573('0x2e')]);_0x10df97[_0x4573('0x30')]=_[_0x4573('0x32')](_0x10df97['model'],_0x10df97['query']);_0x19b3df[_0x4573('0x31')]=_[_0x4573('0x32')](_0x10df97[_0x4573('0x2d')],qs[_0x4573('0x33')](_0x32028a[_0x4573('0x2e')]['fields']));_0x19b3df[_0x4573('0x31')]=_0x19b3df[_0x4573('0x31')][_0x4573('0x34')]?_0x19b3df[_0x4573('0x31')]:_0x10df97['model'];if(!_0x32028a[_0x4573('0x2e')][_0x4573('0x58')]('nolimit')){_0x19b3df[_0x4573('0x36')]=qs['limit'](_0x32028a[_0x4573('0x2e')][_0x4573('0x36')]);_0x19b3df[_0x4573('0x1c')]=qs[_0x4573('0x1c')](_0x32028a[_0x4573('0x2e')][_0x4573('0x1c')]);}_0x19b3df[_0x4573('0x37')]=qs[_0x4573('0x38')](_0x32028a[_0x4573('0x2e')][_0x4573('0x38')]);_0x19b3df[_0x4573('0x39')]=qs[_0x4573('0x30')](_[_0x4573('0x3a')](_0x32028a['query'],_0x10df97[_0x4573('0x30')]));_0x19b3df[_0x4573('0x39')][_0x4573('0x59')]=_0x6ee651['id'];if(_0x32028a[_0x4573('0x2e')][_0x4573('0x3d')]){_0x19b3df[_0x4573('0x39')]=_[_0x4573('0x3b')](_0x19b3df[_0x4573('0x39')],{'$or':_[_0x4573('0x29')](_0x19b3df['attributes'],function(_0x226d50){var _0x20a1ce={};_0x20a1ce[_0x226d50]={'$like':'%'+_0x32028a[_0x4573('0x2e')]['filter']+'%'};return _0x20a1ce;})});}_0x19b3df=_[_0x4573('0x3b')]({},_0x19b3df,_0x32028a[_0x4573('0x3e')]);return db['CmHopperBlack'][_0x4573('0x1b')]({'where':_0x19b3df[_0x4573('0x39')]})[_0x4573('0x20')](function(_0x1771d6){_0x36bcff['count']=_0x1771d6;if(_0x32028a[_0x4573('0x2e')][_0x4573('0x3f')]){_0x19b3df['include']=[{'all':!![]}];}return db[_0x4573('0x5e')][_0x4573('0x41')](_0x19b3df);})['then'](function(_0x12cdc4){_0x36bcff[_0x4573('0x5a')]=_0x12cdc4;return _0x36bcff;});}})['then'](respondWithFilteredResult(_0x1385bc,_0x19b3df))[_0x4573('0x42')](handleError(_0x1385bc,null));};exports[_0x4573('0x5f')]=function(_0x1954bc,_0x53e7d6,_0x3536fd){var _0xe8feb={};var _0x2b5656={};var _0x22d978;var _0x318a90;return db['Campaign'][_0x4573('0x56')]({'where':{'id':_0x1954bc[_0x4573('0x43')]['id']}})[_0x4573('0x20')](handleEntityNotFound(_0x53e7d6,null))[_0x4573('0x20')](function(_0xd216ae){if(_0xd216ae){_0x22d978=_0xd216ae;_0x2b5656[_0x4573('0x2d')]=_['keys'](db['CmList']['rawAttributes']);_0x2b5656[_0x4573('0x2e')]=_['keys'](_0x1954bc[_0x4573('0x2e')]);_0x2b5656[_0x4573('0x30')]=_[_0x4573('0x32')](_0x2b5656[_0x4573('0x2d')],_0x2b5656['query']);_0xe8feb[_0x4573('0x31')]=_[_0x4573('0x32')](_0x2b5656[_0x4573('0x2d')],qs[_0x4573('0x33')](_0x1954bc[_0x4573('0x2e')][_0x4573('0x33')]));_0xe8feb[_0x4573('0x31')]=_0xe8feb[_0x4573('0x31')][_0x4573('0x34')]?_0xe8feb[_0x4573('0x31')]:_0x2b5656[_0x4573('0x2d')];_0xe8feb['order']=qs[_0x4573('0x38')](_0x1954bc[_0x4573('0x2e')]['sort']);_0xe8feb[_0x4573('0x39')]=qs['filters'](_[_0x4573('0x3a')](_0x1954bc['query'],_0x2b5656[_0x4573('0x30')]));if(_0x1954bc[_0x4573('0x2e')]['filter']){_0xe8feb['where']=_[_0x4573('0x3b')](_0xe8feb[_0x4573('0x39')],{'$or':_[_0x4573('0x29')](_0xe8feb[_0x4573('0x31')],function(_0x5a2bf2){var _0x3ce019={};_0x3ce019[_0x5a2bf2]={'$like':'%'+_0x1954bc[_0x4573('0x2e')][_0x4573('0x3d')]+'%'};return _0x3ce019;})});}_0xe8feb=_[_0x4573('0x3b')]({},_0xe8feb,_0x1954bc[_0x4573('0x3e')]);return _0x22d978[_0x4573('0x5f')](_0xe8feb);}})['then'](function(_0x1d7436){if(_0x1d7436){_0x318a90=_0x1d7436[_0x4573('0x34')];if(!_0x1954bc[_0x4573('0x2e')]['hasOwnProperty'](_0x4573('0x35'))){_0xe8feb[_0x4573('0x36')]=qs[_0x4573('0x36')](_0x1954bc[_0x4573('0x2e')][_0x4573('0x36')]);_0xe8feb[_0x4573('0x1c')]=qs['offset'](_0x1954bc[_0x4573('0x2e')][_0x4573('0x1c')]);}return _0x22d978['getLists'](_0xe8feb);}})[_0x4573('0x20')](function(_0x12be71){if(_0x12be71){return _0x12be71?{'count':_0x318a90,'rows':_0x12be71}:null;}})[_0x4573('0x20')](respondWithResult(_0x53e7d6,null))['catch'](handleError(_0x53e7d6,null));};exports['addLists']=function(_0xff9d2d,_0x21fc64,_0xef85f9){var _0x3d7a9d,_0x2c8e2e;return db['Campaign'][_0x4573('0x44')]({'where':{'id':_0xff9d2d[_0x4573('0x43')]['id']}})[_0x4573('0x20')](handleEntityNotFound(_0x21fc64,null))[_0x4573('0x20')](function(_0x553596){if(_0x553596){_0x2c8e2e=_0x553596;return _0x553596['addLists'](_0xff9d2d[_0x4573('0x51')][_0x4573('0x60')],_['omit'](_0xff9d2d[_0x4573('0x51')],['ids','id'])||{});}return null;})[_0x4573('0x61')](function(_0x1ca04c){var _0xf55ff0;_0x3d7a9d=_0x1ca04c||[];var _0x692b5c=[];if(_0x1ca04c){for(var _0x2884c4=0x0;_0x2884c4<_0x1ca04c[_0x4573('0x34')];_0x2884c4+=0x1){var _0x15702d=_0x1ca04c[_0x2884c4][_0x4573('0x22')]({'plain':!![]});_0x2c8e2e[_0x4573('0x62')]=_0xff9d2d[_0x4573('0x51')][_0x4573('0x62')]?_0xff9d2d[_0x4573('0x51')]['dialCheckDuplicateType']:_0x2c8e2e[_0x4573('0x62')];switch(_0x2c8e2e['dialCheckDuplicateType']){case _0x4573('0x63'):_0xf55ff0=squel['insert']()[_0x4573('0x64')](_0x4573('0x65'))[_0x4573('0x66')]([_0x4573('0x67'),_0x4573('0x68'),_0x4573('0x69'),_0x4573('0x6a'),_0x4573('0x59'),'createdAt',_0x4573('0x50')],squel[_0x4573('0x6b')]()['field'](_0x4573('0x67'),_0x4573('0x67'))[_0x4573('0x6c')](_0x4573('0x6d'),_0x4573('0x68'))[_0x4573('0x6c')]('id',_0x4573('0x69'))['field'](_0x15702d[_0x4573('0x6e')][_0x4573('0x6f')](),_0x4573('0x6a'))[_0x4573('0x6c')](_0xff9d2d[_0x4573('0x43')]['id'][_0x4573('0x6f')](),'CampaignId')[_0x4573('0x6c')](_0x4573('0x6d'),_0x4573('0x52'))['field'](_0x4573('0x6d'),_0x4573('0x50'))[_0x4573('0x70')](_0x4573('0x71'))[_0x4573('0x39')](_0x4573('0x72'))[_0x4573('0x39')](_0x4573('0x73'),_0x15702d[_0x4573('0x6e')][_0x4573('0x6f')]())[_0x4573('0x39')](_0x4573('0x74'))[_0x4573('0x39')](_0x4573('0x75'),squel[_0x4573('0x6b')]()['field'](_0x4573('0x76'))[_0x4573('0x70')](_0x4573('0x77'))['where']('CampaignId\x20=\x20?',_0xff9d2d['params']['id'][_0x4573('0x6f')]()))[_0x4573('0x39')](_0x4573('0x75'),squel['select']()[_0x4573('0x6c')](_0x4573('0x78'))[_0x4573('0x70')]('cm_hopper')[_0x4573('0x39')]('CampaignId\x20=\x20?',_0xff9d2d[_0x4573('0x43')]['id'][_0x4573('0x6f')]())))[_0x4573('0x6f')]();break;case _0x4573('0x79'):_0xf55ff0=squel['insert']()['into'](_0x4573('0x65'))['fromQuery']([_0x4573('0x67'),_0x4573('0x68'),'ContactId',_0x4573('0x6a'),_0x4573('0x59'),'createdAt',_0x4573('0x50')],squel['select']()[_0x4573('0x6c')]('phone',_0x4573('0x67'))[_0x4573('0x6c')](_0x4573('0x6d'),_0x4573('0x68'))[_0x4573('0x6c')]('id',_0x4573('0x69'))['field'](_0x15702d[_0x4573('0x6e')][_0x4573('0x6f')](),_0x4573('0x6a'))[_0x4573('0x6c')](_0xff9d2d['params']['id']['toString'](),_0x4573('0x59'))[_0x4573('0x6c')]('NOW()',_0x4573('0x52'))[_0x4573('0x6c')](_0x4573('0x6d'),_0x4573('0x50'))[_0x4573('0x70')](_0x4573('0x71'))[_0x4573('0x39')](_0x4573('0x72'))[_0x4573('0x39')](_0x4573('0x73'),_0x15702d['CmListId'][_0x4573('0x6f')]())[_0x4573('0x39')]('phone\x20IS\x20NOT\x20NULL')[_0x4573('0x39')](_0x4573('0x75'),squel['select']()[_0x4573('0x6c')](_0x4573('0x78'))[_0x4573('0x70')](_0x4573('0x65'))[_0x4573('0x39')](_0x4573('0x7a'),_0xff9d2d[_0x4573('0x43')]['id']['toString']())))['toString']();break;default:_0xf55ff0=squel[_0x4573('0x7b')]()[_0x4573('0x64')](_0x4573('0x65'))[_0x4573('0x66')]([_0x4573('0x67'),_0x4573('0x68'),_0x4573('0x69'),_0x4573('0x6a'),_0x4573('0x59'),'createdAt',_0x4573('0x50')],squel['select']()[_0x4573('0x6c')](_0x4573('0x67'),_0x4573('0x67'))['field'](_0x4573('0x6d'),_0x4573('0x68'))[_0x4573('0x6c')]('id',_0x4573('0x69'))[_0x4573('0x6c')](_0x15702d[_0x4573('0x6e')]['toString'](),_0x4573('0x6a'))['field'](_0xff9d2d[_0x4573('0x43')]['id'][_0x4573('0x6f')](),_0x4573('0x59'))[_0x4573('0x6c')](_0x4573('0x6d'),_0x4573('0x52'))[_0x4573('0x6c')]('NOW()',_0x4573('0x50'))[_0x4573('0x70')]('cm_contacts')['where'](_0x4573('0x72'))[_0x4573('0x39')]('ListId\x20=\x20?',_0x15702d['CmListId']['toString']())[_0x4573('0x39')](_0x4573('0x74')))[_0x4573('0x6f')]();}_0x692b5c[_0x4573('0x7c')](db[_0x4573('0x7d')][_0x4573('0x2e')](_0xf55ff0));}return BPromise[_0x4573('0x7e')](_0x692b5c);}})['then'](function(){return _0x3d7a9d;})[_0x4573('0x20')](respondWithResult(_0x21fc64,null))[_0x4573('0x42')](handleError(_0x21fc64,null));};exports['removeLists']=function(_0x318bac,_0x19f363,_0x2af9d9){return db[_0x4573('0x2a')][_0x4573('0x44')]({'where':{'id':_0x318bac['params']['id']}})['then'](handleEntityNotFound(_0x19f363,null))['then'](function(_0x1ab1b7){if(_0x1ab1b7){return _0x1ab1b7[_0x4573('0x7f')](_0x318bac[_0x4573('0x2e')]['ids']);}})['then'](function(_0xcc3dfa){if(_0xcc3dfa){return db[_0x4573('0x57')]['destroy']({'where':{'ListId':_0x318bac[_0x4573('0x2e')][_0x4573('0x60')],'CampaignId':_0x318bac[_0x4573('0x43')]['id']}})[_0x4573('0x20')](function(){return _0xcc3dfa;});}})['then'](respondWithStatusCode(_0x19f363,null))['catch'](handleError(_0x19f363,null));};exports[_0x4573('0x80')]=function(_0x32e2f5,_0x1cd1bf,_0x97d792){var _0x2735c9={'raw':!![],'where':{}};var _0x27d0b1={};var _0x22171f={'count':0x0,'rows':[]};return db[_0x4573('0x2a')][_0x4573('0x56')]({'where':{'id':_0x32e2f5[_0x4573('0x43')]['id']}})[_0x4573('0x20')](handleEntityNotFound(_0x1cd1bf,null))['then'](function(_0x55f9e9){if(_0x55f9e9){_0x27d0b1[_0x4573('0x2d')]=_[_0x4573('0x2f')](db[_0x4573('0x81')][_0x4573('0x4e')]);_0x27d0b1[_0x4573('0x2e')]=_[_0x4573('0x2f')](_0x32e2f5[_0x4573('0x2e')]);_0x27d0b1['filters']=_['intersection'](_0x27d0b1[_0x4573('0x2d')],_0x27d0b1[_0x4573('0x2e')]);_0x2735c9[_0x4573('0x31')]=_[_0x4573('0x32')](_0x27d0b1[_0x4573('0x2d')],qs['fields'](_0x32e2f5['query'][_0x4573('0x33')]));_0x2735c9['attributes']=_0x2735c9['attributes']['length']?_0x2735c9[_0x4573('0x31')]:_0x27d0b1[_0x4573('0x2d')];if(!_0x32e2f5[_0x4573('0x2e')]['hasOwnProperty'](_0x4573('0x35'))){_0x2735c9[_0x4573('0x36')]=qs[_0x4573('0x36')](_0x32e2f5[_0x4573('0x2e')][_0x4573('0x36')]);_0x2735c9[_0x4573('0x1c')]=qs['offset'](_0x32e2f5[_0x4573('0x2e')][_0x4573('0x1c')]);}_0x2735c9[_0x4573('0x37')]=qs[_0x4573('0x38')](_0x32e2f5['query'][_0x4573('0x38')]);_0x2735c9['where']=qs[_0x4573('0x30')](_[_0x4573('0x3a')](_0x32e2f5[_0x4573('0x2e')],_0x27d0b1['filters']));_0x2735c9[_0x4573('0x39')]['CampaignId']=_0x55f9e9['id'];if(_0x32e2f5[_0x4573('0x2e')][_0x4573('0x3d')]){_0x2735c9[_0x4573('0x39')]=_[_0x4573('0x3b')](_0x2735c9[_0x4573('0x39')],{'$or':_['map'](_0x2735c9['attributes'],function(_0x6fe43e){var _0x5469d6={};_0x5469d6[_0x6fe43e]={'$like':'%'+_0x32e2f5[_0x4573('0x2e')][_0x4573('0x3d')]+'%'};return _0x5469d6;})});}_0x2735c9=_[_0x4573('0x3b')]({},_0x2735c9,_0x32e2f5[_0x4573('0x3e')]);return db['CmList'][_0x4573('0x1b')]({'where':_0x2735c9[_0x4573('0x39')]})[_0x4573('0x20')](function(_0x4c7535){_0x22171f['count']=_0x4c7535;if(_0x32e2f5[_0x4573('0x2e')]['includeAll']){_0x2735c9[_0x4573('0x40')]=[{'all':!![]}];}return db[_0x4573('0x81')][_0x4573('0x41')](_0x2735c9);})[_0x4573('0x20')](function(_0x13c351){_0x22171f[_0x4573('0x5a')]=_0x13c351;return _0x22171f;});}})[_0x4573('0x20')](respondWithFilteredResult(_0x1cd1bf,_0x2735c9))[_0x4573('0x42')](handleError(_0x1cd1bf,null));};exports['addBlackLists']=function(_0x48f051,_0x268fb5,_0x3c6306){var _0x337a7e,_0x395415;return db['Campaign'][_0x4573('0x44')]({'where':{'id':_0x48f051[_0x4573('0x43')]['id']}})['then'](handleEntityNotFound(_0x268fb5,null))['then'](function(_0x5a8a86){if(_0x5a8a86){_0x395415=_0x5a8a86;return _0x5a8a86[_0x4573('0x82')](_0x48f051[_0x4573('0x51')][_0x4573('0x60')],_[_0x4573('0x4f')](_0x48f051[_0x4573('0x51')],['ids','id'])||{});}return null;})[_0x4573('0x61')](function(_0x3e5ebd){var _0x94cffd;_0x337a7e=_0x3e5ebd||[];var _0x3f811f=[];if(_0x3e5ebd){for(var _0x43846a=0x0;_0x43846a<_0x3e5ebd[_0x4573('0x34')];_0x43846a+=0x1){var _0x42d2ba=_0x3e5ebd[_0x43846a][_0x4573('0x22')]({'plain':!![]});_0x94cffd=squel['insert']()['into'](_0x4573('0x83'))[_0x4573('0x66')]([_0x4573('0x67'),_0x4573('0x69'),'ListId',_0x4573('0x59'),_0x4573('0x52'),_0x4573('0x50')],squel[_0x4573('0x6b')]()[_0x4573('0x6c')]('phone',_0x4573('0x67'))[_0x4573('0x6c')]('id',_0x4573('0x69'))['field'](_0x42d2ba[_0x4573('0x6e')][_0x4573('0x6f')](),'ListId')[_0x4573('0x6c')](_0x48f051[_0x4573('0x43')]['id'][_0x4573('0x6f')](),'CampaignId')[_0x4573('0x6c')](_0x4573('0x6d'),'createdAt')[_0x4573('0x6c')](_0x4573('0x6d'),_0x4573('0x50'))[_0x4573('0x70')](_0x4573('0x71'))[_0x4573('0x39')](_0x4573('0x72'))[_0x4573('0x39')]('ListId\x20=\x20?',_0x42d2ba[_0x4573('0x6e')][_0x4573('0x6f')]())['where'](_0x4573('0x74')))[_0x4573('0x6f')]();_0x3f811f[_0x4573('0x7c')](db[_0x4573('0x7d')][_0x4573('0x2e')](_0x94cffd));}return BPromise[_0x4573('0x7e')](_0x3f811f);}})[_0x4573('0x20')](function(){return _0x337a7e;})['then'](respondWithResult(_0x268fb5,null))['catch'](handleError(_0x268fb5,null));};exports[_0x4573('0x84')]=function(_0x342638,_0x4b3203,_0x2b6cd5){return db[_0x4573('0x2a')][_0x4573('0x44')]({'where':{'id':_0x342638['params']['id']}})['then'](handleEntityNotFound(_0x4b3203,null))['then'](function(_0x2ab590){if(_0x2ab590){return _0x2ab590[_0x4573('0x84')](_0x342638[_0x4573('0x2e')]['ids']);}})[_0x4573('0x20')](function(_0xca7f9e){if(_0xca7f9e){return db[_0x4573('0x5e')][_0x4573('0x21')]({'where':{'ListId':_0x342638[_0x4573('0x2e')][_0x4573('0x60')],'CampaignId':_0x342638[_0x4573('0x43')]['id']}})['then'](function(){return _0xca7f9e;});}})[_0x4573('0x20')](respondWithStatusCode(_0x4b3203,null))[_0x4573('0x42')](handleError(_0x4b3203,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 3d74aab..491a19b 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./campaign.attributes','exports','define','Campaign','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x9ad29e,_0x7b830b){var _0x4e18c5=function(_0x558174){while(--_0x558174){_0x9ad29e['push'](_0x9ad29e['shift']());}};_0x4e18c5(++_0x7b830b);}(_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':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./campaign.attributes','exports','define','campaigns','lodash','../../config/logger'];(function(_0x459573,_0x35679e){var _0x51ffcd=function(_0x37bb90){while(--_0x37bb90){_0x459573['push'](_0x459573['shift']());}};_0x51ffcd(++_0x35679e);}(_0xb10b,0x12a));var _0xbb10=function(_0x20bedd,_0x39694b){_0x20bedd=_0x20bedd-0x0;var _0x3041f3=_0xb10b[_0x20bedd];return _0x3041f3;};'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 diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 0728ab9..8412d4c 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(_0x6f723e,_0x136bd0){var _0x2afaa1=function(_0x5134be){while(--_0x5134be){_0x6f723e['push'](_0x6f723e['shift']());}};_0x2afaa1(++_0x136bd0);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file +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(_0x19cad9,_0x185d21){var _0x169d40=function(_0x550282){while(--_0x550282){_0x19cad9['push'](_0x19cad9['shift']());}};_0x169d40(++_0x185d21);}(_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 moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 404f35a..86b8461 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 _0xaae7=['removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addLists','put','update','delete','destroy'];(function(_0x5e7825,_0x481405){var _0x45b25e=function(_0x5d2bb5){while(--_0x5d2bb5){_0x5e7825['push'](_0x5e7825['shift']());}};_0x45b25e(++_0x481405);}(_0xaae7,0xa8));var _0x7aae=function(_0x2c1e97,_0x4943ba){_0x2c1e97=_0x2c1e97-0x0;var _0x4d2a21=_0xaae7[_0x2c1e97];return _0x4d2a21;};'use strict';var multer=require(_0x7aae('0x0'));var util=require(_0x7aae('0x1'));var path=require(_0x7aae('0x2'));var timeout=require(_0x7aae('0x3'));var express=require(_0x7aae('0x4'));var router=express[_0x7aae('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7aae('0x6'));var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0x7aae('0x7')]('/',auth[_0x7aae('0x8')](),controller[_0x7aae('0x9')]);router[_0x7aae('0x7')](_0x7aae('0xa'),auth[_0x7aae('0x8')](),controller[_0x7aae('0xb')]);router[_0x7aae('0x7')](_0x7aae('0xc'),auth['isAuthenticated'](),controller[_0x7aae('0xd')]);router['get'](_0x7aae('0xe'),auth['isAuthenticated'](),controller[_0x7aae('0xf')]);router[_0x7aae('0x7')](_0x7aae('0x10'),auth[_0x7aae('0x8')](),controller['getHopperFinals']);router[_0x7aae('0x7')](_0x7aae('0x11'),auth[_0x7aae('0x8')](),controller['getHopperBlacks']);router[_0x7aae('0x7')](_0x7aae('0x12'),auth[_0x7aae('0x8')](),controller[_0x7aae('0x13')]);router[_0x7aae('0x7')](_0x7aae('0x14'),auth[_0x7aae('0x8')](),controller[_0x7aae('0x15')]);router[_0x7aae('0x16')]('/',auth[_0x7aae('0x8')](),controller['create']);router[_0x7aae('0x16')](_0x7aae('0x17'),auth['isAuthenticated'](),controller[_0x7aae('0x18')]);router[_0x7aae('0x16')](_0x7aae('0x12'),auth[_0x7aae('0x8')](),controller[_0x7aae('0x19')]);router[_0x7aae('0x16')](_0x7aae('0x14'),auth['isAuthenticated'](),controller['addBlackLists']);router[_0x7aae('0x1a')](_0x7aae('0xa'),auth[_0x7aae('0x8')](),controller[_0x7aae('0x1b')]);router[_0x7aae('0x1c')](_0x7aae('0xa'),auth[_0x7aae('0x8')](),controller[_0x7aae('0x1d')]);router[_0x7aae('0x1c')](_0x7aae('0x12'),auth[_0x7aae('0x8')](),controller[_0x7aae('0x1e')]);router[_0x7aae('0x1c')](_0x7aae('0x14'),auth[_0x7aae('0x8')](),controller[_0x7aae('0x1f')]);module[_0x7aae('0x20')]=router; \ No newline at end of file +var _0xd5af=['isAuthenticated','index','get','/:id','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller'];(function(_0x50c160,_0x452f5c){var _0x2c11bc=function(_0x1f121a){while(--_0x1f121a){_0x50c160['push'](_0x50c160['shift']());}};_0x2c11bc(++_0x452f5c);}(_0xd5af,0xca));var _0xfd5a=function(_0x2e4ad8,_0x3d7c91){_0x2e4ad8=_0x2e4ad8-0x0;var _0x5ebd55=_0xd5af[_0x2e4ad8];return _0x5ebd55;};'use strict';var multer=require(_0xfd5a('0x0'));var util=require(_0xfd5a('0x1'));var path=require(_0xfd5a('0x2'));var timeout=require('connect-timeout');var express=require(_0xfd5a('0x3'));var router=express['Router']();var auth=require(_0xfd5a('0x4'));var interaction=require(_0xfd5a('0x5'));var config=require(_0xfd5a('0x6'));var controller=require(_0xfd5a('0x7'));router['get']('/',auth[_0xfd5a('0x8')](),controller[_0xfd5a('0x9')]);router[_0xfd5a('0xa')](_0xfd5a('0xb'),auth[_0xfd5a('0x8')](),controller[_0xfd5a('0xc')]);router[_0xfd5a('0xa')](_0xfd5a('0xd'),auth[_0xfd5a('0x8')](),controller['getHoppers']);router[_0xfd5a('0xa')](_0xfd5a('0xe'),auth[_0xfd5a('0x8')](),controller[_0xfd5a('0xf')]);router[_0xfd5a('0xa')]('/:id/hopper_finals',auth[_0xfd5a('0x8')](),controller['getHopperFinals']);router['get'](_0xfd5a('0x10'),auth['isAuthenticated'](),controller[_0xfd5a('0x11')]);router['get'](_0xfd5a('0x12'),auth[_0xfd5a('0x8')](),controller[_0xfd5a('0x13')]);router[_0xfd5a('0xa')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xfd5a('0x14')]);router[_0xfd5a('0x15')]('/',auth[_0xfd5a('0x8')](),controller[_0xfd5a('0x16')]);router[_0xfd5a('0x15')](_0xfd5a('0x17'),auth[_0xfd5a('0x8')](),controller[_0xfd5a('0x18')]);router['post'](_0xfd5a('0x12'),auth['isAuthenticated'](),controller[_0xfd5a('0x19')]);router[_0xfd5a('0x15')](_0xfd5a('0x1a'),auth[_0xfd5a('0x8')](),controller[_0xfd5a('0x1b')]);router[_0xfd5a('0x1c')]('/:id',auth[_0xfd5a('0x8')](),controller[_0xfd5a('0x1d')]);router[_0xfd5a('0x1e')]('/:id',auth[_0xfd5a('0x8')](),controller[_0xfd5a('0x1f')]);router[_0xfd5a('0x1e')](_0xfd5a('0x12'),auth['isAuthenticated'](),controller[_0xfd5a('0x20')]);router[_0xfd5a('0x1e')](_0xfd5a('0x1a'),auth[_0xfd5a('0x8')](),controller[_0xfd5a('0x21')]);module[_0xfd5a('0x22')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index b09514b..4cbf312 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 _0x08ad=['exports','TEXT','STRING','VIRTUAL','getDataValue','sequelize'];(function(_0x4c4a4f,_0x521641){var _0x4a891c=function(_0x26a6d7){while(--_0x26a6d7){_0x4c4a4f['push'](_0x4c4a4f['shift']());}};_0x4a891c(++_0x521641);}(_0x08ad,0xcb));var _0xd08a=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x08ad[_0x1a36a5];return _0x746243;};'use strict';var Sequelize=require(_0xd08a('0x0'));module[_0xd08a('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xd08a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd08a('0x3')]},'name':{'type':Sequelize[_0xd08a('0x4')],'get':function(){return this[_0xd08a('0x5')]('key');}}}; \ No newline at end of file +var _0x43df=['TEXT','STRING','VIRTUAL','getDataValue','key','sequelize','exports'];(function(_0x1afa81,_0x3db119){var _0x28f138=function(_0x5bcdc7){while(--_0x5bcdc7){_0x1afa81['push'](_0x1afa81['shift']());}};_0x28f138(++_0x3db119);}(_0x43df,0x8a));var _0xf43d=function(_0x811ef9,_0x327b2d){_0x811ef9=_0x811ef9-0x0;var _0x5f493d=_0x43df[_0x811ef9];return _0x5f493d;};'use strict';var Sequelize=require(_0xf43d('0x0'));module[_0xf43d('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xf43d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf43d('0x3')]},'name':{'type':Sequelize[_0xf43d('0x4')],'get':function(){return this[_0xf43d('0x5')](_0xf43d('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 51c6c22..6f9c125 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 _0x1838=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','get','CannedAnswers','UserProfileResource','destroy','then','error','stack','name','map','CannedAnswer','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto'];(function(_0x1ff575,_0xdba21f){var _0x48fc9e=function(_0x51cf97){while(--_0x51cf97){_0x1ff575['push'](_0x1ff575['shift']());}};_0x48fc9e(++_0xdba21f);}(_0x1838,0x1ae));var _0x8183=function(_0x510f37,_0x19f24c){_0x510f37=_0x510f37-0x0;var _0x2a09d1=_0x1838[_0x510f37];return _0x2a09d1;};'use strict';var pdf=require(_0x8183('0x0'));var emlformat=require(_0x8183('0x1'));var rimraf=require(_0x8183('0x2'));var zipdir=require(_0x8183('0x3'));var jsonpatch=require(_0x8183('0x4'));var rp=require(_0x8183('0x5'));var moment=require(_0x8183('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x8183('0x7'));var util=require(_0x8183('0x8'));var path=require(_0x8183('0x9'));var sox=require(_0x8183('0xa'));var csv=require('to-csv');var ejs=require(_0x8183('0xb'));var fs=require('fs');var _=require(_0x8183('0xc'));var squel=require(_0x8183('0xd'));var crypto=require(_0x8183('0xe'));var jsforce=require(_0x8183('0xf'));var deskjs=require(_0x8183('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8183('0x11'));var Papa=require(_0x8183('0x12'));var Redis=require(_0x8183('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x8183('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8183('0x15'))(_0x8183('0x16'));var utils=require(_0x8183('0x17'));var config=require(_0x8183('0x18'));var db=require(_0x8183('0x19'))['db'];function respondWithStatusCode(_0x1f68c1,_0x479022){_0x479022=_0x479022||0xcc;return function(_0x4afd3f){if(_0x4afd3f){return _0x1f68c1[_0x8183('0x1a')](_0x479022);}return _0x1f68c1[_0x8183('0x1b')](_0x479022)[_0x8183('0x1c')]();};}function respondWithResult(_0x55b343,_0xe6fa62){_0xe6fa62=_0xe6fa62||0xc8;return function(_0x9fc132){if(_0x9fc132){return _0x55b343[_0x8183('0x1b')](_0xe6fa62)['json'](_0x9fc132);}};}function respondWithFilteredResult(_0x1698f0,_0x5ad104){return function(_0x568778){if(_0x568778){var _0x3b208c=_0x568778[_0x8183('0x1d')],_0x2c875f=_0x5ad104[_0x8183('0x1e')],_0x2a67fe=_0x5ad104[_0x8183('0x1e')]+_0x5ad104[_0x8183('0x1f')],_0x5dfdb3;if(_0x2a67fe>=_0x3b208c){_0x2a67fe=_0x3b208c;_0x5dfdb3=0xc8;}else{_0x5dfdb3=0xce;}_0x1698f0[_0x8183('0x1b')](_0x5dfdb3);return _0x1698f0[_0x8183('0x20')]('Content-Range',_0x2c875f+'-'+_0x2a67fe+'/'+_0x3b208c)[_0x8183('0x21')](_0x568778);}return null;};}function patchUpdates(_0x41ff56){return function(_0x398604){try{jsonpatch[_0x8183('0x22')](_0x398604,_0x41ff56,!![]);}catch(_0x41c814){return BPromise[_0x8183('0x23')](_0x41c814);}return _0x398604[_0x8183('0x24')]();};}function saveUpdates(_0xdd7e38,_0x274c18){return function(_0x20928c){if(_0x20928c){return _0x20928c[_0x8183('0x25')](_0xdd7e38)['then'](function(_0x4e6367){return _0x4e6367;});}return null;};}function removeEntity(_0x85b56d,_0x17c09b){return function(_0x1a8236){if(_0x1a8236){return _0x1a8236['destroy']()['then'](function(){var _0xa4b115=_0x1a8236[_0x8183('0x26')]({'plain':!![]});var _0x3027dd=_0x8183('0x27');return db[_0x8183('0x28')][_0x8183('0x29')]({'where':{'type':_0x3027dd,'resourceId':_0xa4b115['id']}})[_0x8183('0x2a')](function(){return _0x1a8236;});})['then'](function(){_0x85b56d[_0x8183('0x1b')](0xcc)[_0x8183('0x1c')]();});}};}function handleEntityNotFound(_0x491d99,_0x48aa1f){return function(_0xb01f29){if(!_0xb01f29){_0x491d99[_0x8183('0x1a')](0x194);}return _0xb01f29;};}function handleError(_0x3fce15,_0x263d63){_0x263d63=_0x263d63||0x1f4;return function(_0x179338){logger[_0x8183('0x2b')](_0x179338[_0x8183('0x2c')]);if(_0x179338[_0x8183('0x2d')]){delete _0x179338[_0x8183('0x2d')];}_0x3fce15[_0x8183('0x1b')](_0x263d63)['send'](_0x179338);};}exports['index']=function(_0x29bdc5,_0x463d82){var _0x125266={},_0x3ab64f={},_0x5bbfe1={'count':0x0,'rows':[]};var _0x4b977a=_[_0x8183('0x2e')](db[_0x8183('0x2f')][_0x8183('0x30')],function(_0x23de6a){return{'name':_0x23de6a[_0x8183('0x31')],'type':_0x23de6a[_0x8183('0x32')][_0x8183('0x33')]};});_0x3ab64f['model']=_['map'](_0x4b977a,'name');_0x3ab64f[_0x8183('0x34')]=_['keys'](_0x29bdc5[_0x8183('0x34')]);_0x3ab64f[_0x8183('0x35')]=_['intersection'](_0x3ab64f[_0x8183('0x36')],_0x3ab64f[_0x8183('0x34')]);_0x125266['attributes']=_[_0x8183('0x37')](_0x3ab64f[_0x8183('0x36')],qs[_0x8183('0x38')](_0x29bdc5['query']['fields']));_0x125266['attributes']=_0x125266[_0x8183('0x39')]['length']?_0x125266[_0x8183('0x39')]:_0x3ab64f[_0x8183('0x36')];if(!_0x29bdc5[_0x8183('0x34')]['hasOwnProperty'](_0x8183('0x3a'))){_0x125266[_0x8183('0x1f')]=qs[_0x8183('0x1f')](_0x29bdc5[_0x8183('0x34')][_0x8183('0x1f')]);_0x125266[_0x8183('0x1e')]=qs[_0x8183('0x1e')](_0x29bdc5['query'][_0x8183('0x1e')]);}_0x125266['order']=qs[_0x8183('0x3b')](_0x29bdc5[_0x8183('0x34')]['sort']);_0x125266[_0x8183('0x3c')]=qs[_0x8183('0x35')](_[_0x8183('0x3d')](_0x29bdc5[_0x8183('0x34')],_0x3ab64f['filters']),_0x4b977a);if(_0x29bdc5[_0x8183('0x34')][_0x8183('0x3e')]){_0x125266[_0x8183('0x3c')]=_[_0x8183('0x3f')](_0x125266['where'],{'$or':_[_0x8183('0x2e')](_0x4b977a,function(_0x530130){if(_0x530130[_0x8183('0x32')]!==_0x8183('0x40')){var _0x20e33a={};_0x20e33a[_0x530130[_0x8183('0x2d')]]={'$like':'%'+_0x29bdc5[_0x8183('0x34')][_0x8183('0x3e')]+'%'};return _0x20e33a;}})});}_0x125266=_['merge']({},_0x125266,_0x29bdc5[_0x8183('0x41')]);var _0x1e5da7={'where':_0x125266[_0x8183('0x3c')]};return db['CannedAnswer'][_0x8183('0x1d')](_0x1e5da7)[_0x8183('0x2a')](function(_0x3140dd){_0x5bbfe1['count']=_0x3140dd;if(_0x29bdc5[_0x8183('0x34')][_0x8183('0x42')]){_0x125266[_0x8183('0x43')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x125266);})[_0x8183('0x2a')](function(_0x1d42e5){_0x5bbfe1[_0x8183('0x44')]=_0x1d42e5;return _0x5bbfe1;})['then'](respondWithFilteredResult(_0x463d82,_0x125266))[_0x8183('0x45')](handleError(_0x463d82,null));};exports[_0x8183('0x46')]=function(_0x53c63c,_0x1ef7e8){var _0x5d4e48={'raw':!![],'where':{'id':_0x53c63c[_0x8183('0x47')]['id']}},_0x1e0bd5={};_0x1e0bd5[_0x8183('0x36')]=_['keys'](db['CannedAnswer'][_0x8183('0x30')]);_0x1e0bd5[_0x8183('0x34')]=_[_0x8183('0x48')](_0x53c63c[_0x8183('0x34')]);_0x1e0bd5[_0x8183('0x35')]=_[_0x8183('0x37')](_0x1e0bd5[_0x8183('0x36')],_0x1e0bd5[_0x8183('0x34')]);_0x5d4e48[_0x8183('0x39')]=_[_0x8183('0x37')](_0x1e0bd5[_0x8183('0x36')],qs['fields'](_0x53c63c[_0x8183('0x34')][_0x8183('0x38')]));_0x5d4e48[_0x8183('0x39')]=_0x5d4e48[_0x8183('0x39')]['length']?_0x5d4e48['attributes']:_0x1e0bd5['model'];if(_0x53c63c[_0x8183('0x34')][_0x8183('0x42')]){_0x5d4e48[_0x8183('0x43')]=[{'all':!![]}];}_0x5d4e48=_[_0x8183('0x3f')]({},_0x5d4e48,_0x53c63c['options']);return db[_0x8183('0x2f')][_0x8183('0x49')](_0x5d4e48)[_0x8183('0x2a')](handleEntityNotFound(_0x1ef7e8,null))[_0x8183('0x2a')](respondWithResult(_0x1ef7e8,null))['catch'](handleError(_0x1ef7e8,null));};exports[_0x8183('0x25')]=function(_0x27fb66,_0x5f4521){if(_0x27fb66[_0x8183('0x4a')]['id']){delete _0x27fb66[_0x8183('0x4a')]['id'];}return db[_0x8183('0x2f')]['find']({'where':{'id':_0x27fb66[_0x8183('0x47')]['id']}})[_0x8183('0x2a')](handleEntityNotFound(_0x5f4521,null))[_0x8183('0x2a')](saveUpdates(_0x27fb66[_0x8183('0x4a')],null))[_0x8183('0x2a')](respondWithResult(_0x5f4521,null))['catch'](handleError(_0x5f4521,null));};exports['destroy']=function(_0x23f8ac,_0x426c37){return db[_0x8183('0x2f')][_0x8183('0x49')]({'where':{'id':_0x23f8ac[_0x8183('0x47')]['id']}})[_0x8183('0x2a')](handleEntityNotFound(_0x426c37,null))[_0x8183('0x2a')](removeEntity(_0x426c37,null))[_0x8183('0x45')](handleError(_0x426c37,null));};exports[_0x8183('0x4b')]=function(_0x246cf8,_0x1860fa){var _0x388726={'key':_0x246cf8[_0x8183('0x4a')][_0x8183('0x33')]};if(_0x246cf8[_0x8183('0x4a')][_0x8183('0x4c')]){_0x388726['MailAccountId']=_0x246cf8[_0x8183('0x4a')]['MailAccountId'];}else if(_0x246cf8[_0x8183('0x4a')][_0x8183('0x4d')]){_0x388726[_0x8183('0x4d')]=_0x246cf8[_0x8183('0x4a')][_0x8183('0x4d')];}else if(_0x246cf8[_0x8183('0x4a')]['OpenchannelAccountId']){_0x388726[_0x8183('0x4e')]=_0x246cf8['body'][_0x8183('0x4e')];}else if(_0x246cf8[_0x8183('0x4a')][_0x8183('0x4f')]){_0x388726[_0x8183('0x4f')]=_0x246cf8['body'][_0x8183('0x4f')];}return db[_0x8183('0x2f')][_0x8183('0x49')]({'where':_0x388726})['then'](function(_0x71b846){if(_0x71b846){throw new db['Sequelize'][(_0x8183('0x50'))](_0x8183('0x51'));}return db['CannedAnswer'][_0x8183('0x4b')](_0x246cf8[_0x8183('0x4a')]);})[_0x8183('0x2a')](function(_0x2e7ad0){var _0x205477=_0x246cf8['user']['get']({'plain':!![]});if(!_0x205477)throw new Error(_0x8183('0x52'));if(_0x205477[_0x8183('0x53')]===_0x8183('0x54')){var _0x320188=_0x2e7ad0['get']({'plain':!![]});return db[_0x8183('0x55')][_0x8183('0x49')]({'where':{'name':_0x8183('0x27'),'userProfileId':_0x205477[_0x8183('0x56')]},'raw':!![]})['then'](function(_0x5ec078){if(_0x5ec078&&_0x5ec078[_0x8183('0x57')]===0x0){return db[_0x8183('0x28')][_0x8183('0x4b')]({'name':_0x320188[_0x8183('0x2d')],'resourceId':_0x320188['id'],'type':_0x5ec078[_0x8183('0x2d')],'sectionId':_0x5ec078['id']},{})[_0x8183('0x2a')](function(){return _0x2e7ad0;});}else{return _0x2e7ad0;}})['catch'](function(_0x21125c){logger['error'](_0x8183('0x58'),_0x21125c);throw _0x21125c;});}return _0x2e7ad0;})[_0x8183('0x2a')](respondWithResult(_0x1860fa,0xc9))[_0x8183('0x45')](handleError(_0x1860fa,null));}; \ No newline at end of file +var _0x11c0=['length','nolimit','limit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','catch','params','find','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','json','count','offset','status','set','apply','reject','update','then','destroy','get','CannedAnswers','error','stack','name','index','map','CannedAnswer','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields'];(function(_0x27c8ca,_0x436c96){var _0x5212c3=function(_0x31e752){while(--_0x31e752){_0x27c8ca['push'](_0x27c8ca['shift']());}};_0x5212c3(++_0x436c96);}(_0x11c0,0x72));var _0x011c=function(_0x1648a3,_0x1c674b){_0x1648a3=_0x1648a3-0x0;var _0xf571d=_0x11c0[_0x1648a3];return _0xf571d;};'use strict';var pdf=require(_0x011c('0x0'));var emlformat=require(_0x011c('0x1'));var rimraf=require(_0x011c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x011c('0x3'));var rp=require(_0x011c('0x4'));var moment=require(_0x011c('0x5'));var BPromise=require(_0x011c('0x6'));var Mustache=require(_0x011c('0x7'));var util=require(_0x011c('0x8'));var path=require(_0x011c('0x9'));var sox=require('sox');var csv=require(_0x011c('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x011c('0xb'));var squel=require(_0x011c('0xc'));var crypto=require(_0x011c('0xd'));var jsforce=require(_0x011c('0xe'));var deskjs=require(_0x011c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x011c('0x10'));var Papa=require(_0x011c('0x11'));var Redis=require(_0x011c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x011c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x011c('0x14'));var logger=require(_0x011c('0x15'))(_0x011c('0x16'));var utils=require(_0x011c('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c1f50,_0x4b7a1d){_0x4b7a1d=_0x4b7a1d||0xcc;return function(_0x5c49fd){if(_0x5c49fd){return _0x4c1f50[_0x011c('0x18')](_0x4b7a1d);}return _0x4c1f50['status'](_0x4b7a1d)[_0x011c('0x19')]();};}function respondWithResult(_0x4c2bca,_0x353380){_0x353380=_0x353380||0xc8;return function(_0x5a3d4c){if(_0x5a3d4c){return _0x4c2bca['status'](_0x353380)[_0x011c('0x1a')](_0x5a3d4c);}};}function respondWithFilteredResult(_0x503d13,_0x404041){return function(_0x494b8d){if(_0x494b8d){var _0x308570=_0x494b8d[_0x011c('0x1b')],_0x584110=_0x404041[_0x011c('0x1c')],_0x5eb732=_0x404041[_0x011c('0x1c')]+_0x404041['limit'],_0x11deb7;if(_0x5eb732>=_0x308570){_0x5eb732=_0x308570;_0x11deb7=0xc8;}else{_0x11deb7=0xce;}_0x503d13[_0x011c('0x1d')](_0x11deb7);return _0x503d13[_0x011c('0x1e')]('Content-Range',_0x584110+'-'+_0x5eb732+'/'+_0x308570)[_0x011c('0x1a')](_0x494b8d);}return null;};}function patchUpdates(_0x4237be){return function(_0x24608c){try{jsonpatch[_0x011c('0x1f')](_0x24608c,_0x4237be,!![]);}catch(_0x434e78){return BPromise[_0x011c('0x20')](_0x434e78);}return _0x24608c['save']();};}function saveUpdates(_0x26ef44,_0x1e7eb7){return function(_0x2e4b04){if(_0x2e4b04){return _0x2e4b04[_0x011c('0x21')](_0x26ef44)[_0x011c('0x22')](function(_0x1666a1){return _0x1666a1;});}return null;};}function removeEntity(_0x22678d,_0x43666c){return function(_0x10006f){if(_0x10006f){return _0x10006f[_0x011c('0x23')]()[_0x011c('0x22')](function(){var _0x291388=_0x10006f[_0x011c('0x24')]({'plain':!![]});var _0x273f9e=_0x011c('0x25');return db['UserProfileResource'][_0x011c('0x23')]({'where':{'type':_0x273f9e,'resourceId':_0x291388['id']}})[_0x011c('0x22')](function(){return _0x10006f;});})[_0x011c('0x22')](function(){_0x22678d[_0x011c('0x1d')](0xcc)[_0x011c('0x19')]();});}};}function handleEntityNotFound(_0x44f7aa,_0x1636c4){return function(_0x136bf0){if(!_0x136bf0){_0x44f7aa[_0x011c('0x18')](0x194);}return _0x136bf0;};}function handleError(_0x727407,_0x16cd97){_0x16cd97=_0x16cd97||0x1f4;return function(_0x282027){logger[_0x011c('0x26')](_0x282027[_0x011c('0x27')]);if(_0x282027['name']){delete _0x282027[_0x011c('0x28')];}_0x727407[_0x011c('0x1d')](_0x16cd97)['send'](_0x282027);};}exports[_0x011c('0x29')]=function(_0x2ed9af,_0x15a854){var _0xe362ec={},_0x5f577a={},_0x1839ff={'count':0x0,'rows':[]};var _0x14290=_[_0x011c('0x2a')](db[_0x011c('0x2b')][_0x011c('0x2c')],function(_0x256006){return{'name':_0x256006[_0x011c('0x2d')],'type':_0x256006['type']['key']};});_0x5f577a[_0x011c('0x2e')]=_[_0x011c('0x2a')](_0x14290,'name');_0x5f577a[_0x011c('0x2f')]=_[_0x011c('0x30')](_0x2ed9af['query']);_0x5f577a['filters']=_[_0x011c('0x31')](_0x5f577a['model'],_0x5f577a['query']);_0xe362ec[_0x011c('0x32')]=_[_0x011c('0x31')](_0x5f577a['model'],qs[_0x011c('0x33')](_0x2ed9af[_0x011c('0x2f')]['fields']));_0xe362ec[_0x011c('0x32')]=_0xe362ec[_0x011c('0x32')][_0x011c('0x34')]?_0xe362ec[_0x011c('0x32')]:_0x5f577a[_0x011c('0x2e')];if(!_0x2ed9af['query']['hasOwnProperty'](_0x011c('0x35'))){_0xe362ec[_0x011c('0x36')]=qs[_0x011c('0x36')](_0x2ed9af['query'][_0x011c('0x36')]);_0xe362ec[_0x011c('0x1c')]=qs[_0x011c('0x1c')](_0x2ed9af[_0x011c('0x2f')][_0x011c('0x1c')]);}_0xe362ec['order']=qs[_0x011c('0x37')](_0x2ed9af[_0x011c('0x2f')]['sort']);_0xe362ec[_0x011c('0x38')]=qs[_0x011c('0x39')](_['pick'](_0x2ed9af[_0x011c('0x2f')],_0x5f577a['filters']),_0x14290);if(_0x2ed9af[_0x011c('0x2f')][_0x011c('0x3a')]){_0xe362ec[_0x011c('0x38')]=_[_0x011c('0x3b')](_0xe362ec[_0x011c('0x38')],{'$or':_[_0x011c('0x2a')](_0x14290,function(_0x50487f){if(_0x50487f['type']!==_0x011c('0x3c')){var _0x160332={};_0x160332[_0x50487f[_0x011c('0x28')]]={'$like':'%'+_0x2ed9af['query']['filter']+'%'};return _0x160332;}})});}_0xe362ec=_[_0x011c('0x3b')]({},_0xe362ec,_0x2ed9af[_0x011c('0x3d')]);var _0x11ab88={'where':_0xe362ec[_0x011c('0x38')]};return db[_0x011c('0x2b')][_0x011c('0x1b')](_0x11ab88)['then'](function(_0x16e7ef){_0x1839ff['count']=_0x16e7ef;if(_0x2ed9af[_0x011c('0x2f')][_0x011c('0x3e')]){_0xe362ec[_0x011c('0x3f')]=[{'all':!![]}];}return db[_0x011c('0x2b')]['findAll'](_0xe362ec);})[_0x011c('0x22')](function(_0x18be58){_0x1839ff['rows']=_0x18be58;return _0x1839ff;})[_0x011c('0x22')](respondWithFilteredResult(_0x15a854,_0xe362ec))[_0x011c('0x40')](handleError(_0x15a854,null));};exports['show']=function(_0x3e419f,_0x1c39c1){var _0x23f202={'raw':!![],'where':{'id':_0x3e419f[_0x011c('0x41')]['id']}},_0x193f51={};_0x193f51[_0x011c('0x2e')]=_[_0x011c('0x30')](db[_0x011c('0x2b')]['rawAttributes']);_0x193f51[_0x011c('0x2f')]=_[_0x011c('0x30')](_0x3e419f['query']);_0x193f51['filters']=_[_0x011c('0x31')](_0x193f51[_0x011c('0x2e')],_0x193f51['query']);_0x23f202[_0x011c('0x32')]=_[_0x011c('0x31')](_0x193f51[_0x011c('0x2e')],qs[_0x011c('0x33')](_0x3e419f[_0x011c('0x2f')][_0x011c('0x33')]));_0x23f202['attributes']=_0x23f202[_0x011c('0x32')][_0x011c('0x34')]?_0x23f202[_0x011c('0x32')]:_0x193f51['model'];if(_0x3e419f[_0x011c('0x2f')][_0x011c('0x3e')]){_0x23f202['include']=[{'all':!![]}];}_0x23f202=_[_0x011c('0x3b')]({},_0x23f202,_0x3e419f[_0x011c('0x3d')]);return db[_0x011c('0x2b')][_0x011c('0x42')](_0x23f202)[_0x011c('0x22')](handleEntityNotFound(_0x1c39c1,null))['then'](respondWithResult(_0x1c39c1,null))['catch'](handleError(_0x1c39c1,null));};exports[_0x011c('0x21')]=function(_0x186f7c,_0x524495){if(_0x186f7c[_0x011c('0x43')]['id']){delete _0x186f7c[_0x011c('0x43')]['id'];}return db[_0x011c('0x2b')]['find']({'where':{'id':_0x186f7c[_0x011c('0x41')]['id']}})[_0x011c('0x22')](handleEntityNotFound(_0x524495,null))[_0x011c('0x22')](saveUpdates(_0x186f7c['body'],null))[_0x011c('0x22')](respondWithResult(_0x524495,null))['catch'](handleError(_0x524495,null));};exports[_0x011c('0x23')]=function(_0x5c9750,_0x498e87){return db['CannedAnswer'][_0x011c('0x42')]({'where':{'id':_0x5c9750[_0x011c('0x41')]['id']}})[_0x011c('0x22')](handleEntityNotFound(_0x498e87,null))['then'](removeEntity(_0x498e87,null))['catch'](handleError(_0x498e87,null));};exports[_0x011c('0x44')]=function(_0x277647,_0x1f1de1){var _0x546b63={'key':_0x277647[_0x011c('0x43')][_0x011c('0x45')]};if(_0x277647[_0x011c('0x43')][_0x011c('0x46')]){_0x546b63[_0x011c('0x46')]=_0x277647[_0x011c('0x43')][_0x011c('0x46')];}else if(_0x277647[_0x011c('0x43')][_0x011c('0x47')]){_0x546b63['SmsAccountId']=_0x277647[_0x011c('0x43')][_0x011c('0x47')];}else if(_0x277647[_0x011c('0x43')][_0x011c('0x48')]){_0x546b63['OpenchannelAccountId']=_0x277647[_0x011c('0x43')]['OpenchannelAccountId'];}else if(_0x277647['body'][_0x011c('0x49')]){_0x546b63[_0x011c('0x49')]=_0x277647[_0x011c('0x43')][_0x011c('0x49')];}return db[_0x011c('0x2b')][_0x011c('0x42')]({'where':_0x546b63})[_0x011c('0x22')](function(_0x23877e){if(_0x23877e){throw new db[(_0x011c('0x4a'))]['ValidationError'](_0x011c('0x4b'));}return db[_0x011c('0x2b')][_0x011c('0x44')](_0x277647['body']);})[_0x011c('0x22')](function(_0x4a9b57){var _0x2700d0=_0x277647[_0x011c('0x4c')][_0x011c('0x24')]({'plain':!![]});if(!_0x2700d0)throw new Error(_0x011c('0x4d'));if(_0x2700d0[_0x011c('0x4e')]===_0x011c('0x4c')){var _0x2dbf49=_0x4a9b57['get']({'plain':!![]});return db[_0x011c('0x4f')]['find']({'where':{'name':_0x011c('0x25'),'userProfileId':_0x2700d0['userProfileId']},'raw':!![]})['then'](function(_0x52a8aa){if(_0x52a8aa&&_0x52a8aa[_0x011c('0x50')]===0x0){return db[_0x011c('0x51')]['create']({'name':_0x2dbf49[_0x011c('0x28')],'resourceId':_0x2dbf49['id'],'type':_0x52a8aa[_0x011c('0x28')],'sectionId':_0x52a8aa['id']},{})[_0x011c('0x22')](function(){return _0x4a9b57;});}else{return _0x4a9b57;}})[_0x011c('0x40')](function(_0xfa74fd){logger['error'](_0x011c('0x52'),_0xfa74fd);throw _0xfa74fd;});}return _0x4a9b57;})[_0x011c('0x22')](respondWithResult(_0x1f1de1,0xc9))[_0x011c('0x40')](handleError(_0x1f1de1,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 3d4123f..7844d97 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 _0x29b1=['define','tools_canned_answers','utf8mb4','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports'];(function(_0x1006f6,_0x58a4f2){var _0x274c54=function(_0x53a810){while(--_0x53a810){_0x1006f6['push'](_0x1006f6['shift']());}};_0x274c54(++_0x58a4f2);}(_0x29b1,0x13b));var _0x129b=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x29b1[_0xd1d19a];return _0x52a79d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x129b('0x0'))(_0x129b('0x1'));var moment=require(_0x129b('0x2'));var BPromise=require(_0x129b('0x3'));var rp=require(_0x129b('0x4'));var fs=require('fs');var path=require(_0x129b('0x5'));var rimraf=require(_0x129b('0x6'));var config=require(_0x129b('0x7'));var attributes=require(_0x129b('0x8'));module[_0x129b('0x9')]=function(_0x11c23d,_0x5ca1ff){return _0x11c23d[_0x129b('0xa')]('CannedAnswer',attributes,{'tableName':_0x129b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x129b('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4a25=['lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4'];(function(_0x52413f,_0x4d456e){var _0x3f841e=function(_0x37f5d2){while(--_0x37f5d2){_0x52413f['push'](_0x52413f['shift']());}};_0x3f841e(++_0x4d456e);}(_0x4a25,0x1d4));var _0x54a2=function(_0x3a73bc,_0x550aef){_0x3a73bc=_0x3a73bc-0x0;var _0x32891b=_0x4a25[_0x3a73bc];return _0x32891b;};'use strict';var _=require(_0x54a2('0x0'));var util=require('util');var logger=require(_0x54a2('0x1'))('api');var moment=require(_0x54a2('0x2'));var BPromise=require(_0x54a2('0x3'));var rp=require(_0x54a2('0x4'));var fs=require('fs');var path=require(_0x54a2('0x5'));var rimraf=require('rimraf');var config=require(_0x54a2('0x6'));var attributes=require(_0x54a2('0x7'));module[_0x54a2('0x8')]=function(_0x3ecde5,_0x472eed){return _0x3ecde5['define'](_0x54a2('0x9'),attributes,{'tableName':_0x54a2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x54a2('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index a0a53fc..6ab696d 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 _0x9bc8=['randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x9bc8,0x83));var _0x89bc=function(_0x5947e2,_0x1abef5){_0x5947e2=_0x5947e2-0x0;var _0x295a86=_0x9bc8[_0x5947e2];return _0x295a86;};'use strict';var _=require(_0x89bc('0x0'));var util=require(_0x89bc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x89bc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x89bc('0x3'));var logger=require(_0x89bc('0x4'))(_0x89bc('0x5'));var config=require('../../config/environment');var jayson=require(_0x89bc('0x6'));var client=jayson[_0x89bc('0x7')][_0x89bc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x22f6ff,_0x5283cd,_0xd1e279){return new BPromise(function(_0x401e76,_0x201a3d){return client['request'](_0x22f6ff,_0xd1e279)[_0x89bc('0x9')](function(_0x189a07){logger[_0x89bc('0xa')](_0x89bc('0xb'),_0x5283cd,_0x89bc('0xc'));logger['debug'](_0x89bc('0xd'),_0x5283cd,_0x89bc('0xc'),JSON[_0x89bc('0xe')](_0x189a07));if(_0x189a07['error']){if(_0x189a07['error'][_0x89bc('0xf')]===0x1f4){logger[_0x89bc('0x10')](_0x89bc('0xb'),_0x5283cd,_0x189a07[_0x89bc('0x10')][_0x89bc('0x11')]);return _0x201a3d(_0x189a07[_0x89bc('0x10')]['message']);}logger[_0x89bc('0x10')](_0x89bc('0xb'),_0x5283cd,_0x189a07[_0x89bc('0x10')][_0x89bc('0x11')]);return _0x401e76(_0x189a07['error'][_0x89bc('0x11')]);}else{logger[_0x89bc('0xa')]('CannedAnswer,\x20%s,\x20%s',_0x5283cd,_0x89bc('0xc'));_0x401e76(_0x189a07[_0x89bc('0x12')][_0x89bc('0x11')]);}})['catch'](function(_0x2b20eb){logger[_0x89bc('0x10')]('CannedAnswer,\x20%s,\x20%s',_0x5283cd,_0x2b20eb);_0x201a3d(_0x2b20eb);});});} \ No newline at end of file +var _0x0392=['then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','client','http'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x0392,0x12a));var _0x2039=function(_0x23f201,_0x58e734){_0x23f201=_0x23f201-0x0;var _0x25794f=_0x0392[_0x23f201];return _0x25794f;};'use strict';var _=require(_0x2039('0x0'));var util=require(_0x2039('0x1'));var moment=require(_0x2039('0x2'));var BPromise=require(_0x2039('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2039('0x4'))['db'];var utils=require(_0x2039('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2039('0x6')][_0x2039('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x14dcd9,_0x41649f,_0x470b0a){return new BPromise(function(_0x56ab41,_0x193231){return client['request'](_0x14dcd9,_0x470b0a)[_0x2039('0x8')](function(_0x4addd8){logger[_0x2039('0x9')](_0x2039('0xa'),_0x41649f,_0x2039('0xb'));logger[_0x2039('0xc')](_0x2039('0xd'),_0x41649f,_0x2039('0xb'),JSON['stringify'](_0x4addd8));if(_0x4addd8[_0x2039('0xe')]){if(_0x4addd8[_0x2039('0xe')]['code']===0x1f4){logger[_0x2039('0xe')]('CannedAnswer,\x20%s,\x20%s',_0x41649f,_0x4addd8[_0x2039('0xe')][_0x2039('0xf')]);return _0x193231(_0x4addd8[_0x2039('0xe')][_0x2039('0xf')]);}logger[_0x2039('0xe')]('CannedAnswer,\x20%s,\x20%s',_0x41649f,_0x4addd8['error']['message']);return _0x56ab41(_0x4addd8[_0x2039('0xe')]['message']);}else{logger[_0x2039('0x9')](_0x2039('0xa'),_0x41649f,_0x2039('0xb'));_0x56ab41(_0x4addd8[_0x2039('0x10')][_0x2039('0xf')]);}})['catch'](function(_0x4bb1db){logger['error'](_0x2039('0xa'),_0x41649f,_0x4bb1db);_0x193231(_0x4bb1db);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 45360cc..c534112 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 _0xe4b8=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./cannedAnswer.controller','get','isAuthenticated','/:id','update','delete'];(function(_0x350aeb,_0x3d265a){var _0x3c5273=function(_0x32b417){while(--_0x32b417){_0x350aeb['push'](_0x350aeb['shift']());}};_0x3c5273(++_0x3d265a);}(_0xe4b8,0x179));var _0x8e4b=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xe4b8[_0x2be8c2];return _0x97f531;};'use strict';var multer=require(_0x8e4b('0x0'));var util=require(_0x8e4b('0x1'));var path=require(_0x8e4b('0x2'));var timeout=require(_0x8e4b('0x3'));var express=require(_0x8e4b('0x4'));var router=express[_0x8e4b('0x5')]();var auth=require(_0x8e4b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8e4b('0x7'));router[_0x8e4b('0x8')]('/',auth[_0x8e4b('0x9')](),controller['index']);router[_0x8e4b('0x8')]('/:id',auth[_0x8e4b('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x8e4b('0xa'),auth['isAuthenticated'](),controller[_0x8e4b('0xb')]);router[_0x8e4b('0xc')]('/:id',auth[_0x8e4b('0x9')](),controller[_0x8e4b('0xd')]);module[_0x8e4b('0xe')]=router; \ No newline at end of file +var _0x0f3c=['get','isAuthenticated','index','/:id','post','put','update','delete','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller'];(function(_0x42a334,_0x478159){var _0x2f57c2=function(_0x2e62c8){while(--_0x2e62c8){_0x42a334['push'](_0x42a334['shift']());}};_0x2f57c2(++_0x478159);}(_0x0f3c,0x189));var _0xc0f3=function(_0x48ba04,_0x3f0913){_0x48ba04=_0x48ba04-0x0;var _0x3bb908=_0x0f3c[_0x48ba04];return _0x3bb908;};'use strict';var multer=require(_0xc0f3('0x0'));var util=require(_0xc0f3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc0f3('0x2')]();var auth=require(_0xc0f3('0x3'));var interaction=require(_0xc0f3('0x4'));var config=require(_0xc0f3('0x5'));var controller=require(_0xc0f3('0x6'));router[_0xc0f3('0x7')]('/',auth[_0xc0f3('0x8')](),controller[_0xc0f3('0x9')]);router['get'](_0xc0f3('0xa'),auth[_0xc0f3('0x8')](),controller['show']);router[_0xc0f3('0xb')]('/',auth[_0xc0f3('0x8')](),controller['create']);router[_0xc0f3('0xc')](_0xc0f3('0xa'),auth[_0xc0f3('0x8')](),controller[_0xc0f3('0xd')]);router[_0xc0f3('0xe')](_0xc0f3('0xa'),auth[_0xc0f3('0x8')](),controller['destroy']);module[_0xc0f3('0xf')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 154032a..bae6dee 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 _0x0f56=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x5bbaea,_0x183b05){var _0x1339b6=function(_0x27b2e2){while(--_0x27b2e2){_0x5bbaea['push'](_0x5bbaea['shift']());}};_0x1339b6(++_0x183b05);}(_0x0f56,0x12a));var _0x60f5=function(_0x40b1eb,_0x1bbcde){_0x40b1eb=_0x40b1eb-0x0;var _0x51d88b=_0x0f56[_0x40b1eb];return _0x51d88b;};'use strict';var Sequelize=require(_0x60f5('0x0'));module[_0x60f5('0x1')]={'calldate':{'type':Sequelize[_0x60f5('0x2')],'allowNull':![],'defaultValue':_0x60f5('0x3')},'clid':{'type':Sequelize[_0x60f5('0x4')]},'src':{'type':Sequelize[_0x60f5('0x4')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x60f5('0x4')]},'channel':{'type':Sequelize[_0x60f5('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x60f5('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x60f5('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x60f5('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x60f5('0x4')]},'amaflags':{'type':Sequelize[_0x60f5('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x60f5('0x4')]},'userfield':{'type':Sequelize[_0x60f5('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x60f5('0x4')]},'sequence':{'type':Sequelize[_0x60f5('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x60f5('0x4')]},'tag':{'type':Sequelize[_0x60f5('0x4')]}}; \ No newline at end of file +var _0x7d1c=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x16fefc,_0x299d76){var _0x1836f8=function(_0x32d3f1){while(--_0x32d3f1){_0x16fefc['push'](_0x16fefc['shift']());}};_0x1836f8(++_0x299d76);}(_0x7d1c,0xb0));var _0xc7d1=function(_0x16954c,_0x2f3051){_0x16954c=_0x16954c-0x0;var _0x93e220=_0x7d1c[_0x16954c];return _0x93e220;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0xc7d1('0x0')],'allowNull':![],'defaultValue':_0xc7d1('0x1')},'clid':{'type':Sequelize[_0xc7d1('0x2')]},'src':{'type':Sequelize[_0xc7d1('0x2')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xc7d1('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xc7d1('0x2')]},'amaflags':{'type':Sequelize[_0xc7d1('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xc7d1('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xc7d1('0x2')]},'sequence':{'type':Sequelize[_0xc7d1('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc7d1('0x2')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 965638f..f010fe6 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 _0x9da3=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','Content-Range','apply','update','then','destroy','end','sendStatus','stack','name','index','map','Cdr','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x86337d,_0x2b57c3){var _0x22b2c6=function(_0x180d16){while(--_0x180d16){_0x86337d['push'](_0x86337d['shift']());}};_0x22b2c6(++_0x2b57c3);}(_0x9da3,0x167));var _0x39da=function(_0x4eacbb,_0x1bc3d1){_0x4eacbb=_0x4eacbb-0x0;var _0x549393=_0x9da3[_0x4eacbb];return _0x549393;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x39da('0x0'));var zipdir=require(_0x39da('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x39da('0x2'));var moment=require(_0x39da('0x3'));var BPromise=require(_0x39da('0x4'));var Mustache=require(_0x39da('0x5'));var util=require(_0x39da('0x6'));var path=require(_0x39da('0x7'));var sox=require(_0x39da('0x8'));var csv=require(_0x39da('0x9'));var ejs=require(_0x39da('0xa'));var fs=require('fs');var _=require(_0x39da('0xb'));var squel=require(_0x39da('0xc'));var crypto=require(_0x39da('0xd'));var jsforce=require(_0x39da('0xe'));var deskjs=require(_0x39da('0xf'));var toCsv=require(_0x39da('0x9'));var querystring=require(_0x39da('0x10'));var Papa=require(_0x39da('0x11'));var Redis=require(_0x39da('0x12'));var authService=require(_0x39da('0x13'));var qs=require(_0x39da('0x14'));var as=require(_0x39da('0x15'));var hardwareService=require(_0x39da('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x39da('0x17'));var config=require(_0x39da('0x18'));var db=require(_0x39da('0x19'))['db'];function respondWithStatusCode(_0x439854,_0x222244){_0x222244=_0x222244||0xcc;return function(_0x40b8ba){if(_0x40b8ba){return _0x439854['sendStatus'](_0x222244);}return _0x439854[_0x39da('0x1a')](_0x222244)['end']();};}function respondWithResult(_0x542960,_0x577401){_0x577401=_0x577401||0xc8;return function(_0x4d4843){if(_0x4d4843){return _0x542960[_0x39da('0x1a')](_0x577401)[_0x39da('0x1b')](_0x4d4843);}};}function respondWithFilteredResult(_0x230230,_0x43944c){return function(_0x1dd5e1){if(_0x1dd5e1){var _0x186a0b=_0x1dd5e1[_0x39da('0x1c')],_0x5ec93c=_0x43944c[_0x39da('0x1d')],_0x1deb14=_0x43944c[_0x39da('0x1d')]+_0x43944c['limit'],_0xe7688b;if(_0x1deb14>=_0x186a0b){_0x1deb14=_0x186a0b;_0xe7688b=0xc8;}else{_0xe7688b=0xce;}_0x230230[_0x39da('0x1a')](_0xe7688b);return _0x230230['set'](_0x39da('0x1e'),_0x5ec93c+'-'+_0x1deb14+'/'+_0x186a0b)[_0x39da('0x1b')](_0x1dd5e1);}return null;};}function patchUpdates(_0x39b50a){return function(_0x12f07b){try{jsonpatch[_0x39da('0x1f')](_0x12f07b,_0x39b50a,!![]);}catch(_0x10d396){return BPromise['reject'](_0x10d396);}return _0x12f07b['save']();};}function saveUpdates(_0x3b01f9,_0x226dd8){return function(_0x37efe1){if(_0x37efe1){return _0x37efe1[_0x39da('0x20')](_0x3b01f9)[_0x39da('0x21')](function(_0x13dade){return _0x13dade;});}return null;};}function removeEntity(_0x361346,_0x18ea18){return function(_0x15e8c6){if(_0x15e8c6){return _0x15e8c6[_0x39da('0x22')]()[_0x39da('0x21')](function(){_0x361346[_0x39da('0x1a')](0xcc)[_0x39da('0x23')]();});}};}function handleEntityNotFound(_0x52cb05,_0xeb6dac){return function(_0x2f388e){if(!_0x2f388e){_0x52cb05[_0x39da('0x24')](0x194);}return _0x2f388e;};}function handleError(_0x290953,_0x38e6e3){_0x38e6e3=_0x38e6e3||0x1f4;return function(_0x32b38e){logger['error'](_0x32b38e[_0x39da('0x25')]);if(_0x32b38e['name']){delete _0x32b38e[_0x39da('0x26')];}_0x290953[_0x39da('0x1a')](_0x38e6e3)['send'](_0x32b38e);};}exports[_0x39da('0x27')]=function(_0x47dff5,_0xb4c872){var _0x52982f={},_0xb181e8={},_0x168625={'count':0x0,'rows':[]};var _0x4ba999=_[_0x39da('0x28')](db[_0x39da('0x29')]['rawAttributes'],function(_0x2d65f1){return{'name':_0x2d65f1['fieldName'],'type':_0x2d65f1[_0x39da('0x2a')][_0x39da('0x2b')]};});_0xb181e8[_0x39da('0x2c')]=_[_0x39da('0x28')](_0x4ba999,_0x39da('0x26'));_0xb181e8['query']=_[_0x39da('0x2d')](_0x47dff5[_0x39da('0x2e')]);_0xb181e8[_0x39da('0x2f')]=_[_0x39da('0x30')](_0xb181e8[_0x39da('0x2c')],_0xb181e8[_0x39da('0x2e')]);_0x52982f[_0x39da('0x31')]=_[_0x39da('0x30')](_0xb181e8[_0x39da('0x2c')],qs[_0x39da('0x32')](_0x47dff5[_0x39da('0x2e')][_0x39da('0x32')]));_0x52982f[_0x39da('0x31')]=_0x52982f[_0x39da('0x31')][_0x39da('0x33')]?_0x52982f[_0x39da('0x31')]:_0xb181e8[_0x39da('0x2c')];if(!_0x47dff5[_0x39da('0x2e')][_0x39da('0x34')](_0x39da('0x35'))){_0x52982f['limit']=qs[_0x39da('0x36')](_0x47dff5['query'][_0x39da('0x36')]);_0x52982f[_0x39da('0x1d')]=qs[_0x39da('0x1d')](_0x47dff5['query'][_0x39da('0x1d')]);}_0x52982f[_0x39da('0x37')]=qs[_0x39da('0x38')](_0x47dff5[_0x39da('0x2e')][_0x39da('0x38')]);_0x52982f[_0x39da('0x39')]=qs[_0x39da('0x2f')](_['pick'](_0x47dff5[_0x39da('0x2e')],_0xb181e8[_0x39da('0x2f')]),_0x4ba999);if(_0x47dff5['query'][_0x39da('0x3a')]){_0x52982f['where']=_[_0x39da('0x3b')](_0x52982f[_0x39da('0x39')],{'$or':_[_0x39da('0x28')](_0x4ba999,function(_0x454c3e){if(_0x454c3e[_0x39da('0x2a')]!==_0x39da('0x3c')){var _0xb85816={};_0xb85816[_0x454c3e[_0x39da('0x26')]]={'$like':'%'+_0x47dff5[_0x39da('0x2e')][_0x39da('0x3a')]+'%'};return _0xb85816;}})});}_0x52982f=_[_0x39da('0x3b')]({},_0x52982f,_0x47dff5[_0x39da('0x3d')]);var _0x1b2427={'where':_0x52982f[_0x39da('0x39')]};return db[_0x39da('0x29')][_0x39da('0x1c')](_0x1b2427)['then'](function(_0x33601d){_0x168625[_0x39da('0x1c')]=_0x33601d;if(_0x47dff5['query'][_0x39da('0x3e')]){_0x52982f['include']=[{'all':!![]}];}return db[_0x39da('0x29')][_0x39da('0x3f')](_0x52982f);})[_0x39da('0x21')](function(_0x5988ae){_0x168625[_0x39da('0x40')]=_0x5988ae;return _0x168625;})[_0x39da('0x21')](respondWithFilteredResult(_0xb4c872,_0x52982f))[_0x39da('0x41')](handleError(_0xb4c872,null));};exports[_0x39da('0x42')]=function(_0x1b9427,_0x5caa77){var _0xce7260={'raw':!![],'where':{'id':_0x1b9427[_0x39da('0x43')]['id']}},_0x5b4883={};_0x5b4883['model']=_[_0x39da('0x2d')](db['Cdr'][_0x39da('0x44')]);_0x5b4883[_0x39da('0x2e')]=_['keys'](_0x1b9427['query']);_0x5b4883['filters']=_['intersection'](_0x5b4883[_0x39da('0x2c')],_0x5b4883[_0x39da('0x2e')]);_0xce7260[_0x39da('0x31')]=_['intersection'](_0x5b4883[_0x39da('0x2c')],qs['fields'](_0x1b9427['query']['fields']));_0xce7260['attributes']=_0xce7260['attributes'][_0x39da('0x33')]?_0xce7260[_0x39da('0x31')]:_0x5b4883[_0x39da('0x2c')];if(_0x1b9427['query'][_0x39da('0x3e')]){_0xce7260[_0x39da('0x45')]=[{'all':!![]}];}_0xce7260=_[_0x39da('0x3b')]({},_0xce7260,_0x1b9427[_0x39da('0x3d')]);return db['Cdr'][_0x39da('0x46')](_0xce7260)[_0x39da('0x21')](handleEntityNotFound(_0x5caa77,null))['then'](respondWithResult(_0x5caa77,null))[_0x39da('0x41')](handleError(_0x5caa77,null));};exports[_0x39da('0x47')]=function(_0x19eaf7,_0x392059){return db[_0x39da('0x29')]['create'](_0x19eaf7['body'],{})['then'](respondWithResult(_0x392059,0xc9))[_0x39da('0x41')](handleError(_0x392059,null));};exports[_0x39da('0x20')]=function(_0x304c20,_0x4ed110){if(_0x304c20[_0x39da('0x48')]['id']){delete _0x304c20[_0x39da('0x48')]['id'];}return db[_0x39da('0x29')][_0x39da('0x46')]({'where':{'id':_0x304c20[_0x39da('0x43')]['id']}})[_0x39da('0x21')](handleEntityNotFound(_0x4ed110,null))['then'](saveUpdates(_0x304c20[_0x39da('0x48')],null))[_0x39da('0x21')](respondWithResult(_0x4ed110,null))[_0x39da('0x41')](handleError(_0x4ed110,null));};exports[_0x39da('0x22')]=function(_0x5073c2,_0x3d9365){return db['Cdr'][_0x39da('0x46')]({'where':{'id':_0x5073c2[_0x39da('0x43')]['id']}})[_0x39da('0x21')](handleEntityNotFound(_0x3d9365,null))[_0x39da('0x21')](removeEntity(_0x3d9365,null))['catch'](handleError(_0x3d9365,null));};exports['describe']=function(_0x4cde5b,_0x594ee9){return db[_0x39da('0x29')][_0x39da('0x49')]()['then'](respondWithResult(_0x594ee9,null))[_0x39da('0x41')](handleError(_0x594ee9,null));}; \ No newline at end of file +var _0xbc15=['options','create','body','find','params','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','count','offset','set','apply','reject','save','update','then','error','name','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','filter','merge','VIRTUAL','where','catch','show','keys','includeAll','include'];(function(_0x41e990,_0x14264c){var _0xb5519d=function(_0x1dbf23){while(--_0x1dbf23){_0x41e990['push'](_0x41e990['shift']());}};_0xb5519d(++_0x14264c);}(_0xbc15,0x11b));var _0x5bc1=function(_0x4d437e,_0x560a69){_0x4d437e=_0x4d437e-0x0;var _0x492860=_0xbc15[_0x4d437e];return _0x492860;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5bc1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5bc1('0x1'));var jsonpatch=require(_0x5bc1('0x2'));var rp=require(_0x5bc1('0x3'));var moment=require(_0x5bc1('0x4'));var BPromise=require(_0x5bc1('0x5'));var Mustache=require(_0x5bc1('0x6'));var util=require('util');var path=require(_0x5bc1('0x7'));var sox=require(_0x5bc1('0x8'));var csv=require(_0x5bc1('0x9'));var ejs=require(_0x5bc1('0xa'));var fs=require('fs');var _=require(_0x5bc1('0xb'));var squel=require(_0x5bc1('0xc'));var crypto=require('crypto');var jsforce=require(_0x5bc1('0xd'));var deskjs=require(_0x5bc1('0xe'));var toCsv=require(_0x5bc1('0x9'));var querystring=require(_0x5bc1('0xf'));var Papa=require('papaparse');var Redis=require(_0x5bc1('0x10'));var authService=require(_0x5bc1('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bc1('0x12'));var logger=require(_0x5bc1('0x13'))(_0x5bc1('0x14'));var utils=require(_0x5bc1('0x15'));var config=require(_0x5bc1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599669,_0x3a7b44){_0x3a7b44=_0x3a7b44||0xcc;return function(_0x37b2b6){if(_0x37b2b6){return _0x599669[_0x5bc1('0x17')](_0x3a7b44);}return _0x599669[_0x5bc1('0x18')](_0x3a7b44)['end']();};}function respondWithResult(_0x178e5a,_0x4248ed){_0x4248ed=_0x4248ed||0xc8;return function(_0x1f5014){if(_0x1f5014){return _0x178e5a[_0x5bc1('0x18')](_0x4248ed)['json'](_0x1f5014);}};}function respondWithFilteredResult(_0x541167,_0x579b1c){return function(_0xe06754){if(_0xe06754){var _0x3f1469=_0xe06754[_0x5bc1('0x19')],_0x124e6f=_0x579b1c[_0x5bc1('0x1a')],_0x3b567d=_0x579b1c['offset']+_0x579b1c['limit'],_0x2554e3;if(_0x3b567d>=_0x3f1469){_0x3b567d=_0x3f1469;_0x2554e3=0xc8;}else{_0x2554e3=0xce;}_0x541167['status'](_0x2554e3);return _0x541167[_0x5bc1('0x1b')]('Content-Range',_0x124e6f+'-'+_0x3b567d+'/'+_0x3f1469)['json'](_0xe06754);}return null;};}function patchUpdates(_0x27d356){return function(_0x58a1dd){try{jsonpatch[_0x5bc1('0x1c')](_0x58a1dd,_0x27d356,!![]);}catch(_0x1f7afd){return BPromise[_0x5bc1('0x1d')](_0x1f7afd);}return _0x58a1dd[_0x5bc1('0x1e')]();};}function saveUpdates(_0x283aeb,_0x28e690){return function(_0x121952){if(_0x121952){return _0x121952[_0x5bc1('0x1f')](_0x283aeb)[_0x5bc1('0x20')](function(_0x3645de){return _0x3645de;});}return null;};}function removeEntity(_0x55e589,_0x9d825d){return function(_0x165af2){if(_0x165af2){return _0x165af2['destroy']()[_0x5bc1('0x20')](function(){_0x55e589['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4096c6,_0x65c285){return function(_0x106718){if(!_0x106718){_0x4096c6[_0x5bc1('0x17')](0x194);}return _0x106718;};}function handleError(_0x3b7132,_0xa19082){_0xa19082=_0xa19082||0x1f4;return function(_0x391c5e){logger[_0x5bc1('0x21')](_0x391c5e['stack']);if(_0x391c5e[_0x5bc1('0x22')]){delete _0x391c5e[_0x5bc1('0x22')];}_0x3b7132[_0x5bc1('0x18')](_0xa19082)['send'](_0x391c5e);};}exports[_0x5bc1('0x23')]=function(_0x57d8c2,_0x56b86b){var _0x3f7916={},_0x517334={},_0x5915fa={'count':0x0,'rows':[]};var _0x5748f7=_[_0x5bc1('0x24')](db[_0x5bc1('0x25')][_0x5bc1('0x26')],function(_0x239b9e){return{'name':_0x239b9e[_0x5bc1('0x27')],'type':_0x239b9e[_0x5bc1('0x28')][_0x5bc1('0x29')]};});_0x517334[_0x5bc1('0x2a')]=_[_0x5bc1('0x24')](_0x5748f7,_0x5bc1('0x22'));_0x517334[_0x5bc1('0x2b')]=_['keys'](_0x57d8c2[_0x5bc1('0x2b')]);_0x517334[_0x5bc1('0x2c')]=_[_0x5bc1('0x2d')](_0x517334[_0x5bc1('0x2a')],_0x517334[_0x5bc1('0x2b')]);_0x3f7916[_0x5bc1('0x2e')]=_[_0x5bc1('0x2d')](_0x517334[_0x5bc1('0x2a')],qs[_0x5bc1('0x2f')](_0x57d8c2[_0x5bc1('0x2b')][_0x5bc1('0x2f')]));_0x3f7916[_0x5bc1('0x2e')]=_0x3f7916['attributes'][_0x5bc1('0x30')]?_0x3f7916[_0x5bc1('0x2e')]:_0x517334['model'];if(!_0x57d8c2[_0x5bc1('0x2b')][_0x5bc1('0x31')]('nolimit')){_0x3f7916[_0x5bc1('0x32')]=qs['limit'](_0x57d8c2[_0x5bc1('0x2b')][_0x5bc1('0x32')]);_0x3f7916[_0x5bc1('0x1a')]=qs[_0x5bc1('0x1a')](_0x57d8c2['query'][_0x5bc1('0x1a')]);}_0x3f7916[_0x5bc1('0x33')]=qs[_0x5bc1('0x34')](_0x57d8c2[_0x5bc1('0x2b')][_0x5bc1('0x34')]);_0x3f7916['where']=qs[_0x5bc1('0x2c')](_['pick'](_0x57d8c2[_0x5bc1('0x2b')],_0x517334[_0x5bc1('0x2c')]),_0x5748f7);if(_0x57d8c2[_0x5bc1('0x2b')][_0x5bc1('0x35')]){_0x3f7916['where']=_[_0x5bc1('0x36')](_0x3f7916['where'],{'$or':_[_0x5bc1('0x24')](_0x5748f7,function(_0x47b0a0){if(_0x47b0a0[_0x5bc1('0x28')]!==_0x5bc1('0x37')){var _0x2e3810={};_0x2e3810[_0x47b0a0[_0x5bc1('0x22')]]={'$like':'%'+_0x57d8c2[_0x5bc1('0x2b')][_0x5bc1('0x35')]+'%'};return _0x2e3810;}})});}_0x3f7916=_[_0x5bc1('0x36')]({},_0x3f7916,_0x57d8c2['options']);var _0x5a2afa={'where':_0x3f7916[_0x5bc1('0x38')]};return db[_0x5bc1('0x25')][_0x5bc1('0x19')](_0x5a2afa)['then'](function(_0x124244){_0x5915fa[_0x5bc1('0x19')]=_0x124244;if(_0x57d8c2['query']['includeAll']){_0x3f7916['include']=[{'all':!![]}];}return db[_0x5bc1('0x25')]['findAll'](_0x3f7916);})[_0x5bc1('0x20')](function(_0x418cdc){_0x5915fa['rows']=_0x418cdc;return _0x5915fa;})[_0x5bc1('0x20')](respondWithFilteredResult(_0x56b86b,_0x3f7916))[_0x5bc1('0x39')](handleError(_0x56b86b,null));};exports[_0x5bc1('0x3a')]=function(_0x3d3eb8,_0x561cdb){var _0x5b0e19={'raw':!![],'where':{'id':_0x3d3eb8['params']['id']}},_0x5a2d22={};_0x5a2d22[_0x5bc1('0x2a')]=_[_0x5bc1('0x3b')](db['Cdr'][_0x5bc1('0x26')]);_0x5a2d22[_0x5bc1('0x2b')]=_['keys'](_0x3d3eb8[_0x5bc1('0x2b')]);_0x5a2d22[_0x5bc1('0x2c')]=_[_0x5bc1('0x2d')](_0x5a2d22[_0x5bc1('0x2a')],_0x5a2d22['query']);_0x5b0e19['attributes']=_[_0x5bc1('0x2d')](_0x5a2d22['model'],qs[_0x5bc1('0x2f')](_0x3d3eb8['query'][_0x5bc1('0x2f')]));_0x5b0e19[_0x5bc1('0x2e')]=_0x5b0e19[_0x5bc1('0x2e')][_0x5bc1('0x30')]?_0x5b0e19[_0x5bc1('0x2e')]:_0x5a2d22[_0x5bc1('0x2a')];if(_0x3d3eb8[_0x5bc1('0x2b')][_0x5bc1('0x3c')]){_0x5b0e19[_0x5bc1('0x3d')]=[{'all':!![]}];}_0x5b0e19=_[_0x5bc1('0x36')]({},_0x5b0e19,_0x3d3eb8[_0x5bc1('0x3e')]);return db[_0x5bc1('0x25')]['find'](_0x5b0e19)['then'](handleEntityNotFound(_0x561cdb,null))['then'](respondWithResult(_0x561cdb,null))[_0x5bc1('0x39')](handleError(_0x561cdb,null));};exports[_0x5bc1('0x3f')]=function(_0x20fad6,_0x349e7d){return db[_0x5bc1('0x25')][_0x5bc1('0x3f')](_0x20fad6[_0x5bc1('0x40')],{})[_0x5bc1('0x20')](respondWithResult(_0x349e7d,0xc9))['catch'](handleError(_0x349e7d,null));};exports[_0x5bc1('0x1f')]=function(_0x2afdf7,_0x5ccdd8){if(_0x2afdf7[_0x5bc1('0x40')]['id']){delete _0x2afdf7['body']['id'];}return db[_0x5bc1('0x25')][_0x5bc1('0x41')]({'where':{'id':_0x2afdf7[_0x5bc1('0x42')]['id']}})[_0x5bc1('0x20')](handleEntityNotFound(_0x5ccdd8,null))['then'](saveUpdates(_0x2afdf7[_0x5bc1('0x40')],null))[_0x5bc1('0x20')](respondWithResult(_0x5ccdd8,null))['catch'](handleError(_0x5ccdd8,null));};exports[_0x5bc1('0x43')]=function(_0x53b478,_0x636622){return db[_0x5bc1('0x25')][_0x5bc1('0x41')]({'where':{'id':_0x53b478[_0x5bc1('0x42')]['id']}})[_0x5bc1('0x20')](handleEntityNotFound(_0x636622,null))[_0x5bc1('0x20')](removeEntity(_0x636622,null))[_0x5bc1('0x39')](handleError(_0x636622,null));};exports[_0x5bc1('0x44')]=function(_0x1bbb1b,_0x381690){return db['Cdr'][_0x5bc1('0x44')]()['then'](respondWithResult(_0x381690,null))['catch'](handleError(_0x381690,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 1ad2917..1e21209 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 _0xe263=['cdr','accountcode','calldate','disposition','dst','src','lodash','util','../../config/logger','api','moment','path','../../config/environment','exports','define','Cdr'];(function(_0x12fa60,_0x1c6ad7){var _0x4a8270=function(_0x3944a6){while(--_0x3944a6){_0x12fa60['push'](_0x12fa60['shift']());}};_0x4a8270(++_0x1c6ad7);}(_0xe263,0x186));var _0x3e26=function(_0xb88731,_0x269525){_0xb88731=_0xb88731-0x0;var _0x59122d=_0xe263[_0xb88731];return _0x59122d;};'use strict';var _=require(_0x3e26('0x0'));var util=require(_0x3e26('0x1'));var logger=require(_0x3e26('0x2'))(_0x3e26('0x3'));var moment=require(_0x3e26('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e26('0x5'));var rimraf=require('rimraf');var config=require(_0x3e26('0x6'));var attributes=require('./cdr.attributes');module[_0x3e26('0x7')]=function(_0x133509,_0x2a3ae5){return _0x133509[_0x3e26('0x8')](_0x3e26('0x9'),attributes,{'tableName':_0x3e26('0xa'),'paranoid':![],'indexes':[{'name':_0x3e26('0xb'),'fields':[_0x3e26('0xb')]},{'name':_0x3e26('0xc'),'fields':['calldate']},{'name':_0x3e26('0xd'),'fields':[_0x3e26('0xd')]},{'name':'dst','fields':[_0x3e26('0xe')]},{'name':_0x3e26('0xf'),'fields':[_0x3e26('0xf')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':![]});}; \ No newline at end of file +var _0x40ab=['path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition','src','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x25078d,_0x3c8508){var _0x5ca058=function(_0x48c572){while(--_0x48c572){_0x25078d['push'](_0x25078d['shift']());}};_0x5ca058(++_0x3c8508);}(_0x40ab,0xfb));var _0xb40a=function(_0x54f802,_0x22f39b){_0x54f802=_0x54f802-0x0;var _0x30deab=_0x40ab[_0x54f802];return _0x30deab;};'use strict';var _=require(_0xb40a('0x0'));var util=require(_0xb40a('0x1'));var logger=require(_0xb40a('0x2'))(_0xb40a('0x3'));var moment=require('moment');var BPromise=require(_0xb40a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb40a('0x5'));var rimraf=require(_0xb40a('0x6'));var config=require('../../config/environment');var attributes=require(_0xb40a('0x7'));module[_0xb40a('0x8')]=function(_0x5428bd,_0x76fa5f){return _0x5428bd[_0xb40a('0x9')](_0xb40a('0xa'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':'accountcode','fields':[_0xb40a('0xb')]},{'name':_0xb40a('0xc'),'fields':[_0xb40a('0xc')]},{'name':_0xb40a('0xd'),'fields':[_0xb40a('0xd')]},{'name':'dst','fields':['dst']},{'name':_0xb40a('0xe'),'fields':[_0xb40a('0xe')]},{'name':_0xb40a('0xf'),'fields':['uniqueid']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index af592fa..415d93e 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 _0xc235=['code','message','request\x20sent','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc235,0x1bc));var _0x5c23=function(_0x3fe140,_0xfbff91){_0x3fe140=_0x3fe140-0x0;var _0x582c8e=_0xc235[_0x3fe140];return _0x582c8e;};'use strict';var _=require('lodash');var util=require(_0x5c23('0x0'));var moment=require(_0x5c23('0x1'));var BPromise=require('bluebird');var rs=require(_0x5c23('0x2'));var fs=require('fs');var Redis=require(_0x5c23('0x3'));var db=require(_0x5c23('0x4'))['db'];var utils=require(_0x5c23('0x5'));var logger=require(_0x5c23('0x6'))('rpc');var config=require(_0x5c23('0x7'));var jayson=require(_0x5c23('0x8'));var client=jayson[_0x5c23('0x9')][_0x5c23('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c749d,_0x58f6e2,_0x229d26){return new BPromise(function(_0x1ddfef,_0x5c8cbf){return client[_0x5c23('0xb')](_0x4c749d,_0x229d26)[_0x5c23('0xc')](function(_0x128489){logger['info'](_0x5c23('0xd'),_0x58f6e2,'request\x20sent');logger[_0x5c23('0xe')](_0x5c23('0xf'),_0x58f6e2,'request\x20sent',JSON[_0x5c23('0x10')](_0x128489));if(_0x128489[_0x5c23('0x11')]){if(_0x128489[_0x5c23('0x11')][_0x5c23('0x12')]===0x1f4){logger['error'](_0x5c23('0xd'),_0x58f6e2,_0x128489[_0x5c23('0x11')][_0x5c23('0x13')]);return _0x5c8cbf(_0x128489[_0x5c23('0x11')]['message']);}logger['error'](_0x5c23('0xd'),_0x58f6e2,_0x128489[_0x5c23('0x11')]['message']);return _0x1ddfef(_0x128489[_0x5c23('0x11')]['message']);}else{logger['info'](_0x5c23('0xd'),_0x58f6e2,_0x5c23('0x14'));_0x1ddfef(_0x128489['result'][_0x5c23('0x13')]);}})[_0x5c23('0x15')](function(_0x31658c){logger[_0x5c23('0x11')](_0x5c23('0xd'),_0x58f6e2,_0x31658c);_0x5c8cbf(_0x31658c);});});} \ No newline at end of file +var _0xeb8b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x2ebe3f,_0x4e87e6){var _0xd2eece=function(_0x445091){while(--_0x445091){_0x2ebe3f['push'](_0x2ebe3f['shift']());}};_0xd2eece(++_0x4e87e6);}(_0xeb8b,0xc2));var _0xbeb8=function(_0x1a8412,_0x48e8b6){_0x1a8412=_0x1a8412-0x0;var _0x2cd713=_0xeb8b[_0x1a8412];return _0x2cd713;};'use strict';var _=require('lodash');var util=require(_0xbeb8('0x0'));var moment=require(_0xbeb8('0x1'));var BPromise=require(_0xbeb8('0x2'));var rs=require(_0xbeb8('0x3'));var fs=require('fs');var Redis=require(_0xbeb8('0x4'));var db=require(_0xbeb8('0x5'))['db'];var utils=require(_0xbeb8('0x6'));var logger=require(_0xbeb8('0x7'))(_0xbeb8('0x8'));var config=require(_0xbeb8('0x9'));var jayson=require(_0xbeb8('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4214d8,_0x24d43c,_0x262d79){return new BPromise(function(_0x31b7df,_0xb16ef8){return client[_0xbeb8('0xb')](_0x4214d8,_0x262d79)['then'](function(_0x3f2594){logger[_0xbeb8('0xc')](_0xbeb8('0xd'),_0x24d43c,_0xbeb8('0xe'));logger[_0xbeb8('0xf')](_0xbeb8('0x10'),_0x24d43c,_0xbeb8('0xe'),JSON[_0xbeb8('0x11')](_0x3f2594));if(_0x3f2594[_0xbeb8('0x12')]){if(_0x3f2594[_0xbeb8('0x12')]['code']===0x1f4){logger['error'](_0xbeb8('0xd'),_0x24d43c,_0x3f2594[_0xbeb8('0x12')][_0xbeb8('0x13')]);return _0xb16ef8(_0x3f2594[_0xbeb8('0x12')][_0xbeb8('0x13')]);}logger['error'](_0xbeb8('0xd'),_0x24d43c,_0x3f2594[_0xbeb8('0x12')][_0xbeb8('0x13')]);return _0x31b7df(_0x3f2594[_0xbeb8('0x12')][_0xbeb8('0x13')]);}else{logger[_0xbeb8('0xc')](_0xbeb8('0xd'),_0x24d43c,_0xbeb8('0xe'));_0x31b7df(_0x3f2594[_0xbeb8('0x14')][_0xbeb8('0x13')]);}})[_0xbeb8('0x15')](function(_0x4e429f){logger[_0xbeb8('0x12')](_0xbeb8('0xd'),_0x24d43c,_0x4e429f);_0xb16ef8(_0x4e429f);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 8b2ab80..10b5880 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 _0xc34c=['exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete'];(function(_0x4b93ba,_0x498acd){var _0x12999c=function(_0x4f58d5){while(--_0x4f58d5){_0x4b93ba['push'](_0x4b93ba['shift']());}};_0x12999c(++_0x498acd);}(_0xc34c,0xa1));var _0xcc34=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xc34c[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require(_0xcc34('0x0'));var path=require('path');var timeout=require(_0xcc34('0x1'));var express=require(_0xcc34('0x2'));var router=express[_0xcc34('0x3')]();var auth=require(_0xcc34('0x4'));var interaction=require(_0xcc34('0x5'));var config=require(_0xcc34('0x6'));var controller=require(_0xcc34('0x7'));router[_0xcc34('0x8')]('/',auth[_0xcc34('0x9')](),controller[_0xcc34('0xa')]);router[_0xcc34('0x8')](_0xcc34('0xb'),auth[_0xcc34('0x9')](),controller[_0xcc34('0xc')]);router[_0xcc34('0x8')](_0xcc34('0xd'),auth['isAuthenticated'](),controller[_0xcc34('0xe')]);router[_0xcc34('0xf')]('/',auth[_0xcc34('0x9')](),controller[_0xcc34('0x10')]);router['put'](_0xcc34('0xd'),auth['isAuthenticated'](),controller[_0xcc34('0x11')]);router[_0xcc34('0x12')](_0xcc34('0xd'),auth[_0xcc34('0x9')](),controller['destroy']);module[_0xcc34('0x13')]=router; \ No newline at end of file +var _0x181e=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','post','create','put','delete','destroy','util','express'];(function(_0x2dc3d8,_0x1a5760){var _0x5ce6d2=function(_0x3646b5){while(--_0x3646b5){_0x2dc3d8['push'](_0x2dc3d8['shift']());}};_0x5ce6d2(++_0x1a5760);}(_0x181e,0xfd));var _0xe181=function(_0x5be1d6,_0x52ab2a){_0x5be1d6=_0x5be1d6-0x0;var _0x5d9bd4=_0x181e[_0x5be1d6];return _0x5d9bd4;};'use strict';var multer=require('multer');var util=require(_0xe181('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe181('0x1'));var router=express[_0xe181('0x2')]();var auth=require(_0xe181('0x3'));var interaction=require(_0xe181('0x4'));var config=require(_0xe181('0x5'));var controller=require('./cdr.controller');router[_0xe181('0x6')]('/',auth['isAuthenticated'](),controller[_0xe181('0x7')]);router[_0xe181('0x6')](_0xe181('0x8'),auth[_0xe181('0x9')](),controller['describe']);router['get'](_0xe181('0xa'),auth[_0xe181('0x9')](),controller[_0xe181('0xb')]);router[_0xe181('0xc')]('/',auth['isAuthenticated'](),controller[_0xe181('0xd')]);router[_0xe181('0xe')](_0xe181('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xe181('0xf')](_0xe181('0xa'),auth[_0xe181('0x9')](),controller[_0xe181('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 4f6e056..cfdd91e 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 _0xd16a=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x5b9137,_0x3bbf38){var _0x11fd0c=function(_0x5e6e47){while(--_0x5e6e47){_0x5b9137['push'](_0x5b9137['shift']());}};_0x11fd0c(++_0x3bbf38);}(_0xd16a,0x167));var _0xad16=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd16a[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xad16('0x0'));module[_0xad16('0x1')]={'priority':{'type':Sequelize[_0xad16('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xad16('0x3')],'allowNull':![],'defaultValue':_0xad16('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xad16('0x3')]},'interval':{'type':Sequelize[_0xad16('0x3')],'defaultValue':_0xad16('0x5')}}; \ No newline at end of file +var _0xe2c6=['INTEGER','STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x448f2c,_0x422e86){var _0x4f819f=function(_0x4488f8){while(--_0x4488f8){_0x448f2c['push'](_0x448f2c['shift']());}};_0x4f819f(++_0x422e86);}(_0xe2c6,0x15b));var _0x6e2c=function(_0x425481,_0x1d3da8){_0x425481=_0x425481-0x0;var _0x56b2ff=_0xe2c6[_0x425481];return _0x56b2ff;};'use strict';var Sequelize=require('sequelize');module[_0x6e2c('0x0')]={'priority':{'type':Sequelize[_0x6e2c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6e2c('0x2')],'allowNull':![],'defaultValue':_0x6e2c('0x3')},'appdata':{'type':Sequelize[_0x6e2c('0x4')]()},'description':{'type':Sequelize[_0x6e2c('0x2')]},'interval':{'type':Sequelize[_0x6e2c('0x2')],'defaultValue':_0x6e2c('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index f84bc28..64e1772 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 _0x0f66=['options','ChatApplication','find','body','catch','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','params','rawAttributes','keys','filters','intersection','model','query','attributes','fields','includeAll','merge'];(function(_0x117473,_0x485375){var _0x38711a=function(_0x33e119){while(--_0x33e119){_0x117473['push'](_0x117473['shift']());}};_0x38711a(++_0x485375);}(_0x0f66,0xe9));var _0x60f6=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x0f66[_0x4b73a2];return _0x383c66;};'use strict';var pdf=require(_0x60f6('0x0'));var emlformat=require(_0x60f6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x60f6('0x2'));var jsonpatch=require(_0x60f6('0x3'));var rp=require('request-promise');var moment=require(_0x60f6('0x4'));var BPromise=require(_0x60f6('0x5'));var Mustache=require(_0x60f6('0x6'));var util=require(_0x60f6('0x7'));var path=require(_0x60f6('0x8'));var sox=require(_0x60f6('0x9'));var csv=require('to-csv');var ejs=require(_0x60f6('0xa'));var fs=require('fs');var _=require(_0x60f6('0xb'));var squel=require(_0x60f6('0xc'));var crypto=require(_0x60f6('0xd'));var jsforce=require(_0x60f6('0xe'));var deskjs=require(_0x60f6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x60f6('0x10'));var Papa=require('papaparse');var Redis=require(_0x60f6('0x11'));var authService=require(_0x60f6('0x12'));var qs=require(_0x60f6('0x13'));var as=require(_0x60f6('0x14'));var hardwareService=require(_0x60f6('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x60f6('0x16'));var db=require(_0x60f6('0x17'))['db'];function respondWithStatusCode(_0x39bcaa,_0x1b823c){_0x1b823c=_0x1b823c||0xcc;return function(_0x72cf8e){if(_0x72cf8e){return _0x39bcaa['sendStatus'](_0x1b823c);}return _0x39bcaa[_0x60f6('0x18')](_0x1b823c)[_0x60f6('0x19')]();};}function respondWithResult(_0x47f1e8,_0x2b9ae7){_0x2b9ae7=_0x2b9ae7||0xc8;return function(_0x1e3756){if(_0x1e3756){return _0x47f1e8[_0x60f6('0x18')](_0x2b9ae7)[_0x60f6('0x1a')](_0x1e3756);}};}function respondWithFilteredResult(_0x1667e5,_0x56ce79){return function(_0x33af97){if(_0x33af97){var _0xd34f2d=_0x33af97[_0x60f6('0x1b')],_0x579c39=_0x56ce79['offset'],_0x3948f7=_0x56ce79[_0x60f6('0x1c')]+_0x56ce79[_0x60f6('0x1d')],_0x1a20c2;if(_0x3948f7>=_0xd34f2d){_0x3948f7=_0xd34f2d;_0x1a20c2=0xc8;}else{_0x1a20c2=0xce;}_0x1667e5[_0x60f6('0x18')](_0x1a20c2);return _0x1667e5['set'](_0x60f6('0x1e'),_0x579c39+'-'+_0x3948f7+'/'+_0xd34f2d)[_0x60f6('0x1a')](_0x33af97);}return null;};}function patchUpdates(_0x29aed4){return function(_0x1b2d28){try{jsonpatch[_0x60f6('0x1f')](_0x1b2d28,_0x29aed4,!![]);}catch(_0x3e47a9){return BPromise[_0x60f6('0x20')](_0x3e47a9);}return _0x1b2d28[_0x60f6('0x21')]();};}function saveUpdates(_0xe513f4,_0x3a6330){return function(_0x459508){if(_0x459508){return _0x459508[_0x60f6('0x22')](_0xe513f4)[_0x60f6('0x23')](function(_0x546073){return _0x546073;});}return null;};}function removeEntity(_0xdfe436,_0x494319){return function(_0xd57517){if(_0xd57517){return _0xd57517[_0x60f6('0x24')]()['then'](function(){_0xdfe436[_0x60f6('0x18')](0xcc)[_0x60f6('0x19')]();});}};}function handleEntityNotFound(_0x426aa0,_0xf352e1){return function(_0x13cd49){if(!_0x13cd49){_0x426aa0[_0x60f6('0x25')](0x194);}return _0x13cd49;};}function handleError(_0x5423cf,_0x4163b7){_0x4163b7=_0x4163b7||0x1f4;return function(_0x57e2c4){logger[_0x60f6('0x26')](_0x57e2c4[_0x60f6('0x27')]);if(_0x57e2c4[_0x60f6('0x28')]){delete _0x57e2c4[_0x60f6('0x28')];}_0x5423cf[_0x60f6('0x18')](_0x4163b7)['send'](_0x57e2c4);};}exports['show']=function(_0x3f0023,_0x9c6c6){var _0x30ecd2={'raw':!![],'where':{'id':_0x3f0023[_0x60f6('0x29')]['id']}},_0x28b170={};_0x28b170['model']=_['keys'](db['ChatApplication'][_0x60f6('0x2a')]);_0x28b170['query']=_[_0x60f6('0x2b')](_0x3f0023['query']);_0x28b170[_0x60f6('0x2c')]=_[_0x60f6('0x2d')](_0x28b170[_0x60f6('0x2e')],_0x28b170[_0x60f6('0x2f')]);_0x30ecd2[_0x60f6('0x30')]=_[_0x60f6('0x2d')](_0x28b170[_0x60f6('0x2e')],qs[_0x60f6('0x31')](_0x3f0023[_0x60f6('0x2f')]['fields']));_0x30ecd2[_0x60f6('0x30')]=_0x30ecd2[_0x60f6('0x30')]['length']?_0x30ecd2['attributes']:_0x28b170[_0x60f6('0x2e')];if(_0x3f0023['query'][_0x60f6('0x32')]){_0x30ecd2['include']=[{'all':!![]}];}_0x30ecd2=_[_0x60f6('0x33')]({},_0x30ecd2,_0x3f0023[_0x60f6('0x34')]);return db[_0x60f6('0x35')][_0x60f6('0x36')](_0x30ecd2)[_0x60f6('0x23')](handleEntityNotFound(_0x9c6c6,null))[_0x60f6('0x23')](respondWithResult(_0x9c6c6,null))['catch'](handleError(_0x9c6c6,null));};exports[_0x60f6('0x22')]=function(_0x216851,_0x1820fe){if(_0x216851[_0x60f6('0x37')]['id']){delete _0x216851[_0x60f6('0x37')]['id'];}return db[_0x60f6('0x35')][_0x60f6('0x36')]({'where':{'id':_0x216851[_0x60f6('0x29')]['id']}})[_0x60f6('0x23')](handleEntityNotFound(_0x1820fe,null))['then'](saveUpdates(_0x216851[_0x60f6('0x37')],null))[_0x60f6('0x23')](respondWithResult(_0x1820fe,null))[_0x60f6('0x38')](handleError(_0x1820fe,null));};exports[_0x60f6('0x24')]=function(_0x564e8a,_0x3577c5){return db[_0x60f6('0x35')]['find']({'where':{'id':_0x564e8a['params']['id']}})[_0x60f6('0x23')](handleEntityNotFound(_0x3577c5,null))[_0x60f6('0x23')](removeEntity(_0x3577c5,null))[_0x60f6('0x38')](handleError(_0x3577c5,null));}; \ No newline at end of file +var _0xf5aa=['apply','reject','save','then','destroy','error','stack','name','send','show','params','keys','ChatApplication','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xf5aa,0x10d));var _0xaf5a=function(_0x87af3f,_0xf3f46f){_0x87af3f=_0x87af3f-0x0;var _0x2301d5=_0xf5aa[_0x87af3f];return _0x2301d5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaf5a('0x0'));var rimraf=require(_0xaf5a('0x1'));var zipdir=require(_0xaf5a('0x2'));var jsonpatch=require(_0xaf5a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaf5a('0x4'));var util=require(_0xaf5a('0x5'));var path=require(_0xaf5a('0x6'));var sox=require(_0xaf5a('0x7'));var csv=require(_0xaf5a('0x8'));var ejs=require(_0xaf5a('0x9'));var fs=require('fs');var _=require(_0xaf5a('0xa'));var squel=require(_0xaf5a('0xb'));var crypto=require(_0xaf5a('0xc'));var jsforce=require(_0xaf5a('0xd'));var deskjs=require(_0xaf5a('0xe'));var toCsv=require(_0xaf5a('0x8'));var querystring=require(_0xaf5a('0xf'));var Papa=require(_0xaf5a('0x10'));var Redis=require('ioredis');var authService=require(_0xaf5a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xaf5a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf5a('0x13'))(_0xaf5a('0x14'));var utils=require('../../config/utils');var config=require(_0xaf5a('0x15'));var db=require(_0xaf5a('0x16'))['db'];function respondWithStatusCode(_0x58b4ac,_0xab856c){_0xab856c=_0xab856c||0xcc;return function(_0x13514e){if(_0x13514e){return _0x58b4ac[_0xaf5a('0x17')](_0xab856c);}return _0x58b4ac[_0xaf5a('0x18')](_0xab856c)[_0xaf5a('0x19')]();};}function respondWithResult(_0x13e620,_0x18615b){_0x18615b=_0x18615b||0xc8;return function(_0x2cabe4){if(_0x2cabe4){return _0x13e620[_0xaf5a('0x18')](_0x18615b)[_0xaf5a('0x1a')](_0x2cabe4);}};}function respondWithFilteredResult(_0x85aa1e,_0xe249ef){return function(_0x26af4b){if(_0x26af4b){var _0x231f31=_0x26af4b[_0xaf5a('0x1b')],_0x4489e0=_0xe249ef[_0xaf5a('0x1c')],_0x4555c5=_0xe249ef[_0xaf5a('0x1c')]+_0xe249ef[_0xaf5a('0x1d')],_0xb41cf1;if(_0x4555c5>=_0x231f31){_0x4555c5=_0x231f31;_0xb41cf1=0xc8;}else{_0xb41cf1=0xce;}_0x85aa1e['status'](_0xb41cf1);return _0x85aa1e['set'](_0xaf5a('0x1e'),_0x4489e0+'-'+_0x4555c5+'/'+_0x231f31)[_0xaf5a('0x1a')](_0x26af4b);}return null;};}function patchUpdates(_0x4170c1){return function(_0x5128ea){try{jsonpatch[_0xaf5a('0x1f')](_0x5128ea,_0x4170c1,!![]);}catch(_0x1bea3a){return BPromise[_0xaf5a('0x20')](_0x1bea3a);}return _0x5128ea[_0xaf5a('0x21')]();};}function saveUpdates(_0x2160d1,_0x5324d7){return function(_0x1723e9){if(_0x1723e9){return _0x1723e9['update'](_0x2160d1)[_0xaf5a('0x22')](function(_0x312a78){return _0x312a78;});}return null;};}function removeEntity(_0x81ce3d,_0x5d2bf3){return function(_0x19578f){if(_0x19578f){return _0x19578f[_0xaf5a('0x23')]()['then'](function(){_0x81ce3d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xf3ea9d,_0x1d34c7){return function(_0x5d24f8){if(!_0x5d24f8){_0xf3ea9d[_0xaf5a('0x17')](0x194);}return _0x5d24f8;};}function handleError(_0x35ffe8,_0x2c8872){_0x2c8872=_0x2c8872||0x1f4;return function(_0x1c5d85){logger[_0xaf5a('0x24')](_0x1c5d85[_0xaf5a('0x25')]);if(_0x1c5d85[_0xaf5a('0x26')]){delete _0x1c5d85[_0xaf5a('0x26')];}_0x35ffe8[_0xaf5a('0x18')](_0x2c8872)[_0xaf5a('0x27')](_0x1c5d85);};}exports[_0xaf5a('0x28')]=function(_0x196556,_0x405276){var _0x10bbdb={'raw':!![],'where':{'id':_0x196556[_0xaf5a('0x29')]['id']}},_0x5125af={};_0x5125af['model']=_[_0xaf5a('0x2a')](db[_0xaf5a('0x2b')][_0xaf5a('0x2c')]);_0x5125af[_0xaf5a('0x2d')]=_[_0xaf5a('0x2a')](_0x196556[_0xaf5a('0x2d')]);_0x5125af[_0xaf5a('0x2e')]=_[_0xaf5a('0x2f')](_0x5125af[_0xaf5a('0x30')],_0x5125af[_0xaf5a('0x2d')]);_0x10bbdb[_0xaf5a('0x31')]=_[_0xaf5a('0x2f')](_0x5125af[_0xaf5a('0x30')],qs[_0xaf5a('0x32')](_0x196556['query'][_0xaf5a('0x32')]));_0x10bbdb[_0xaf5a('0x31')]=_0x10bbdb['attributes'][_0xaf5a('0x33')]?_0x10bbdb[_0xaf5a('0x31')]:_0x5125af[_0xaf5a('0x30')];if(_0x196556[_0xaf5a('0x2d')][_0xaf5a('0x34')]){_0x10bbdb[_0xaf5a('0x35')]=[{'all':!![]}];}_0x10bbdb=_[_0xaf5a('0x36')]({},_0x10bbdb,_0x196556[_0xaf5a('0x37')]);return db[_0xaf5a('0x2b')][_0xaf5a('0x38')](_0x10bbdb)[_0xaf5a('0x22')](handleEntityNotFound(_0x405276,null))[_0xaf5a('0x22')](respondWithResult(_0x405276,null))[_0xaf5a('0x39')](handleError(_0x405276,null));};exports[_0xaf5a('0x3a')]=function(_0xb416d0,_0x4052a2){if(_0xb416d0[_0xaf5a('0x3b')]['id']){delete _0xb416d0[_0xaf5a('0x3b')]['id'];}return db[_0xaf5a('0x2b')][_0xaf5a('0x38')]({'where':{'id':_0xb416d0[_0xaf5a('0x29')]['id']}})[_0xaf5a('0x22')](handleEntityNotFound(_0x4052a2,null))['then'](saveUpdates(_0xb416d0[_0xaf5a('0x3b')],null))['then'](respondWithResult(_0x4052a2,null))['catch'](handleError(_0x4052a2,null));};exports['destroy']=function(_0x1d3cc2,_0x210254){return db[_0xaf5a('0x2b')]['find']({'where':{'id':_0x1d3cc2[_0xaf5a('0x29')]['id']}})[_0xaf5a('0x22')](handleEntityNotFound(_0x210254,null))['then'](removeEntity(_0x210254,null))[_0xaf5a('0x39')](handleError(_0x210254,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 85a3d2f..0cd24cf 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 _0xc993=['ChatApplication','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define'];(function(_0x4e2d4b,_0x39f9e2){var _0x373448=function(_0x5f2832){while(--_0x5f2832){_0x4e2d4b['push'](_0x4e2d4b['shift']());}};_0x373448(++_0x39f9e2);}(_0xc993,0x10b));var _0x3c99=function(_0x5f4eb4,_0x3ec90e){_0x5f4eb4=_0x5f4eb4-0x0;var _0x39b38d=_0xc993[_0x5f4eb4];return _0x39b38d;};'use strict';var _=require(_0x3c99('0x0'));var util=require(_0x3c99('0x1'));var logger=require(_0x3c99('0x2'))(_0x3c99('0x3'));var moment=require(_0x3c99('0x4'));var BPromise=require(_0x3c99('0x5'));var rp=require(_0x3c99('0x6'));var fs=require('fs');var path=require(_0x3c99('0x7'));var rimraf=require(_0x3c99('0x8'));var config=require(_0x3c99('0x9'));var attributes=require(_0x3c99('0xa'));module[_0x3c99('0xb')]=function(_0x54b4d9,_0x15cf23){return _0x54b4d9[_0x3c99('0xc')](_0x3c99('0xd'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc925=['utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications'];(function(_0x1e3817,_0x1ce3e9){var _0xeab95b=function(_0x317b45){while(--_0x317b45){_0x1e3817['push'](_0x1e3817['shift']());}};_0xeab95b(++_0x1ce3e9);}(_0xc925,0x71));var _0x5c92=function(_0x44c5f5,_0x4d0702){_0x44c5f5=_0x44c5f5-0x0;var _0x46acdb=_0xc925[_0x44c5f5];return _0x46acdb;};'use strict';var _=require('lodash');var util=require(_0x5c92('0x0'));var logger=require(_0x5c92('0x1'))(_0x5c92('0x2'));var moment=require(_0x5c92('0x3'));var BPromise=require(_0x5c92('0x4'));var rp=require(_0x5c92('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5c92('0x6'));var config=require(_0x5c92('0x7'));var attributes=require(_0x5c92('0x8'));module[_0x5c92('0x9')]=function(_0xf9f996,_0x5b68f0){return _0xf9f996[_0x5c92('0xa')](_0x5c92('0xb'),attributes,{'tableName':_0x5c92('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5c92('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 12cd620..b5581fb 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 _0x6692=['stringify','error','code','ChatApplication,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x256420,_0x2b7c8c){var _0x224f67=function(_0x41890a){while(--_0x41890a){_0x256420['push'](_0x256420['shift']());}};_0x224f67(++_0x2b7c8c);}(_0x6692,0x92));var _0x2669=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x6692[_0x397cfb];return _0x15fed9;};'use strict';var _=require(_0x2669('0x0'));var util=require(_0x2669('0x1'));var moment=require(_0x2669('0x2'));var BPromise=require(_0x2669('0x3'));var rs=require(_0x2669('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2669('0x5'))['db'];var utils=require(_0x2669('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x2669('0x7'));var jayson=require(_0x2669('0x8'));var client=jayson['client'][_0x2669('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f6028,_0x337c9b,_0x4a725d){return new BPromise(function(_0x497685,_0x4c118f){return client[_0x2669('0xa')](_0x1f6028,_0x4a725d)[_0x2669('0xb')](function(_0x4b868c){logger['info']('ChatApplication,\x20%s,\x20%s',_0x337c9b,_0x2669('0xc'));logger[_0x2669('0xd')](_0x2669('0xe'),_0x337c9b,_0x2669('0xc'),JSON[_0x2669('0xf')](_0x4b868c));if(_0x4b868c['error']){if(_0x4b868c[_0x2669('0x10')][_0x2669('0x11')]===0x1f4){logger[_0x2669('0x10')](_0x2669('0x12'),_0x337c9b,_0x4b868c[_0x2669('0x10')][_0x2669('0x13')]);return _0x4c118f(_0x4b868c[_0x2669('0x10')][_0x2669('0x13')]);}logger[_0x2669('0x10')](_0x2669('0x12'),_0x337c9b,_0x4b868c[_0x2669('0x10')][_0x2669('0x13')]);return _0x497685(_0x4b868c[_0x2669('0x10')]['message']);}else{logger[_0x2669('0x14')]('ChatApplication,\x20%s,\x20%s',_0x337c9b,_0x2669('0xc'));_0x497685(_0x4b868c[_0x2669('0x15')][_0x2669('0x13')]);}})[_0x2669('0x16')](function(_0x2df7d3){logger['error']('ChatApplication,\x20%s,\x20%s',_0x337c9b,_0x2df7d3);_0x4c118f(_0x2df7d3);});});} \ No newline at end of file +var _0x5a66=['info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a66,0x1ee));var _0x65a6=function(_0x123280,_0x19a19f){_0x123280=_0x123280-0x0;var _0x387b58=_0x5a66[_0x123280];return _0x387b58;};'use strict';var _=require(_0x65a6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x65a6('0x1'));var rs=require(_0x65a6('0x2'));var fs=require('fs');var Redis=require(_0x65a6('0x3'));var db=require(_0x65a6('0x4'))['db'];var utils=require(_0x65a6('0x5'));var logger=require('../../config/logger')(_0x65a6('0x6'));var config=require(_0x65a6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x65a6('0x8')][_0x65a6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x404b4b,_0x236864,_0x33892e){return new BPromise(function(_0x581c1e,_0x59bdef){return client[_0x65a6('0xa')](_0x404b4b,_0x33892e)[_0x65a6('0xb')](function(_0x509f7b){logger[_0x65a6('0xc')](_0x65a6('0xd'),_0x236864,_0x65a6('0xe'));logger[_0x65a6('0xf')](_0x65a6('0x10'),_0x236864,_0x65a6('0xe'),JSON['stringify'](_0x509f7b));if(_0x509f7b[_0x65a6('0x11')]){if(_0x509f7b[_0x65a6('0x11')][_0x65a6('0x12')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x236864,_0x509f7b[_0x65a6('0x11')][_0x65a6('0x13')]);return _0x59bdef(_0x509f7b[_0x65a6('0x11')][_0x65a6('0x13')]);}logger[_0x65a6('0x11')](_0x65a6('0xd'),_0x236864,_0x509f7b['error'][_0x65a6('0x13')]);return _0x581c1e(_0x509f7b[_0x65a6('0x11')][_0x65a6('0x13')]);}else{logger[_0x65a6('0xc')](_0x65a6('0xd'),_0x236864,'request\x20sent');_0x581c1e(_0x509f7b[_0x65a6('0x14')][_0x65a6('0x13')]);}})[_0x65a6('0x15')](function(_0x5daceb){logger['error'](_0x65a6('0xd'),_0x236864,_0x5daceb);_0x59bdef(_0x5daceb);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 23bca30..215e080 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 _0xfc67=['isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','show','/:id'];(function(_0x5107a3,_0x402944){var _0x1ebb36=function(_0x4b0cb9){while(--_0x4b0cb9){_0x5107a3['push'](_0x5107a3['shift']());}};_0x1ebb36(++_0x402944);}(_0xfc67,0x82));var _0x7fc6=function(_0x1460ab,_0x74d06e){_0x1460ab=_0x1460ab-0x0;var _0x1eeb5c=_0xfc67[_0x1460ab];return _0x1eeb5c;};'use strict';var multer=require(_0x7fc6('0x0'));var util=require(_0x7fc6('0x1'));var path=require(_0x7fc6('0x2'));var timeout=require(_0x7fc6('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x7fc6('0x4'));var interaction=require(_0x7fc6('0x5'));var config=require(_0x7fc6('0x6'));var controller=require(_0x7fc6('0x7'));router['get']('/:id',auth['isAuthenticated'](),controller[_0x7fc6('0x8')]);router['put'](_0x7fc6('0x9'),auth[_0x7fc6('0xa')](),controller[_0x7fc6('0xb')]);router[_0x7fc6('0xc')](_0x7fc6('0x9'),auth[_0x7fc6('0xa')](),controller[_0x7fc6('0xd')]);module['exports']=router; \ No newline at end of file +var _0xd493=['show','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated'];(function(_0x862815,_0x1bbe4e){var _0x537350=function(_0x318831){while(--_0x318831){_0x862815['push'](_0x862815['shift']());}};_0x537350(++_0x1bbe4e);}(_0xd493,0x116));var _0x3d49=function(_0x493b42,_0x3161e5){_0x493b42=_0x493b42-0x0;var _0x1ab527=_0xd493[_0x493b42];return _0x1ab527;};'use strict';var multer=require(_0x3d49('0x0'));var util=require(_0x3d49('0x1'));var path=require('path');var timeout=require(_0x3d49('0x2'));var express=require(_0x3d49('0x3'));var router=express[_0x3d49('0x4')]();var auth=require(_0x3d49('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3d49('0x6'));var controller=require(_0x3d49('0x7'));router[_0x3d49('0x8')](_0x3d49('0x9'),auth[_0x3d49('0xa')](),controller[_0x3d49('0xb')]);router[_0x3d49('0xc')](_0x3d49('0x9'),auth[_0x3d49('0xa')](),controller[_0x3d49('0xd')]);router[_0x3d49('0xe')](_0x3d49('0x9'),auth[_0x3d49('0xa')](),controller[_0x3d49('0xf')]);module[_0x3d49('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 97e2e47..6aa7e48 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 _0xd725=['exports','STRING','BOOLEAN'];(function(_0x7d4081,_0x25bd1b){var _0x340514=function(_0x3ad5cb){while(--_0x3ad5cb){_0x7d4081['push'](_0x7d4081['shift']());}};_0x340514(++_0x25bd1b);}(_0xd725,0xe1));var _0x5d72=function(_0x22459e,_0x420756){_0x22459e=_0x22459e-0x0;var _0x2dbe52=_0xd725[_0x22459e];return _0x2dbe52;};'use strict';var Sequelize=require('sequelize');module[_0x5d72('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x5d72('0x1')]},'write':{'type':Sequelize[_0x5d72('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x77c8=['BOOLEAN','sequelize','exports','STRING'];(function(_0x4914e2,_0x48be8f){var _0x2dcd07=function(_0x1a2565){while(--_0x1a2565){_0x4914e2['push'](_0x4914e2['shift']());}};_0x2dcd07(++_0x48be8f);}(_0x77c8,0x13d));var _0x877c=function(_0x421196,_0x1cbd94){_0x421196=_0x421196-0x0;var _0x2738af=_0x77c8[_0x421196];return _0x2738af;};'use strict';var Sequelize=require(_0x877c('0x0'));module[_0x877c('0x1')]={'name':{'type':Sequelize[_0x877c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x877c('0x2')]},'write':{'type':Sequelize[_0x877c('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 9d5ad97..3c769fd 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 _0x3ce1=['find','create','body','describe','getUnread','user','addMembers','ids','findOne','User','order','getMembers','hasOwnProperty','addMessage','ChatInternalMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','register','jayson/promise','http','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','json','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','index','map','ChatGroup','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','count','include','findAll','rows','show','params','length'];(function(_0x592722,_0x3db651){var _0x1eb997=function(_0x457e7d){while(--_0x457e7d){_0x592722['push'](_0x592722['shift']());}};_0x1eb997(++_0x3db651);}(_0x3ce1,0x7d));var _0x13ce=function(_0x2f4ae7,_0x2c0c50){_0x2f4ae7=_0x2f4ae7-0x0;var _0x4dd0d5=_0x3ce1[_0x2f4ae7];return _0x4dd0d5;};'use strict';var pdf=require(_0x13ce('0x0'));var emlformat=require(_0x13ce('0x1'));var rimraf=require(_0x13ce('0x2'));var zipdir=require(_0x13ce('0x3'));var jsonpatch=require(_0x13ce('0x4'));var rp=require(_0x13ce('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x13ce('0x6'));var path=require('path');var sox=require(_0x13ce('0x7'));var csv=require(_0x13ce('0x8'));var ejs=require(_0x13ce('0x9'));var fs=require('fs');var _=require(_0x13ce('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x13ce('0xb'));var deskjs=require(_0x13ce('0xc'));var toCsv=require(_0x13ce('0x8'));var querystring=require(_0x13ce('0xd'));var Papa=require('papaparse');var Redis=require(_0x13ce('0xe'));var authService=require(_0x13ce('0xf'));var qs=require(_0x13ce('0x10'));var as=require(_0x13ce('0x11'));var hardwareService=require(_0x13ce('0x12'));var logger=require(_0x13ce('0x13'))(_0x13ce('0x14'));var utils=require('../../config/utils');var config=require(_0x13ce('0x15'));var db=require(_0x13ce('0x16'))['db'];config[_0x13ce('0x17')]=_[_0x13ce('0x18')](config[_0x13ce('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x13ce('0x19'))(new Redis(config[_0x13ce('0x17')]));require(_0x13ce('0x1a'))[_0x13ce('0x1b')](socket);var jayson=require(_0x13ce('0x1c'));var client=jayson['client'][_0x13ce('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x1c8377,_0x389a7e,_0x1093a2){if(_0x1093a2){var _0x505e26=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x505e26['test'](_0x389a7e)){return _0x1c8377;}else{throw new db[(_0x13ce('0x1e'))]['ValidationError'](_0x13ce('0x1f'));}}else{return _0x1c8377;}}function respondWithRpcPromise(_0x192bee,_0x5272b1,_0x1937d4,_0x2b26f8){return new BPromise(function(_0xfef415,_0xafc890){var _0x402e2c=_0x2b26f8||client;return _0x402e2c[_0x13ce('0x20')](_0x192bee,_0x1937d4)[_0x13ce('0x21')](function(_0x214e1e){logger[_0x13ce('0x22')](_0x13ce('0x23'),_0x5272b1,_0x13ce('0x24'));logger[_0x13ce('0x25')](_0x13ce('0x26'),_0x5272b1,_0x13ce('0x24'),JSON['stringify'](_0x214e1e));if(_0x214e1e[_0x13ce('0x27')]){if(_0x214e1e[_0x13ce('0x27')]['code']===0x1f4){logger[_0x13ce('0x27')](_0x13ce('0x23'),_0x5272b1,_0x214e1e['error'][_0x13ce('0x28')]);return _0xafc890(_0x214e1e[_0x13ce('0x27')]['message']);}logger[_0x13ce('0x27')](_0x13ce('0x23'),_0x5272b1,_0x214e1e[_0x13ce('0x27')][_0x13ce('0x28')]);return _0xfef415(_0x214e1e[_0x13ce('0x27')][_0x13ce('0x28')]);}else{logger[_0x13ce('0x22')]('ChatGroup,\x20%s,\x20%s',_0x5272b1,_0x13ce('0x24'));_0xfef415(_0x214e1e[_0x13ce('0x29')][_0x13ce('0x28')]);}})[_0x13ce('0x2a')](function(_0x41dee7){logger[_0x13ce('0x27')]('ChatGroup,\x20%s,\x20%s',_0x5272b1,_0x41dee7);_0xafc890(_0x41dee7);});});}function respondWithStatusCode(_0x5dfd25,_0x272d30){_0x272d30=_0x272d30||0xcc;return function(_0x4e2ce6){if(_0x4e2ce6){return _0x5dfd25['sendStatus'](_0x272d30);}return _0x5dfd25[_0x13ce('0x2b')](_0x272d30)[_0x13ce('0x2c')]();};}function respondWithResult(_0x246997,_0x360092){_0x360092=_0x360092||0xc8;return function(_0x67472b){if(_0x67472b){return _0x246997[_0x13ce('0x2b')](_0x360092)[_0x13ce('0x2d')](_0x67472b);}};}function respondWithFilteredResult(_0x29cc33,_0x287c49){return function(_0x2b9264){if(_0x2b9264){var _0x17a635=_0x2b9264['count'],_0x3b11d9=_0x287c49['offset'],_0x5903ce=_0x287c49[_0x13ce('0x2e')]+_0x287c49[_0x13ce('0x2f')],_0x182749;if(_0x5903ce>=_0x17a635){_0x5903ce=_0x17a635;_0x182749=0xc8;}else{_0x182749=0xce;}_0x29cc33[_0x13ce('0x2b')](_0x182749);return _0x29cc33[_0x13ce('0x30')](_0x13ce('0x31'),_0x3b11d9+'-'+_0x5903ce+'/'+_0x17a635)[_0x13ce('0x2d')](_0x2b9264);}return null;};}function patchUpdates(_0x2a2c90){return function(_0x5c7c58){try{jsonpatch[_0x13ce('0x32')](_0x5c7c58,_0x2a2c90,!![]);}catch(_0x543421){return BPromise['reject'](_0x543421);}return _0x5c7c58[_0x13ce('0x33')]();};}function saveUpdates(_0x23b1ce,_0x4287a2){return function(_0x2a0c58){if(_0x2a0c58){return _0x2a0c58[_0x13ce('0x34')](_0x23b1ce)[_0x13ce('0x21')](function(_0x1e1d55){return _0x1e1d55;});}return null;};}function removeEntity(_0x3d2b24,_0x49e4d4){return function(_0xe63c6f){if(_0xe63c6f){return _0xe63c6f[_0x13ce('0x35')]()[_0x13ce('0x21')](function(){_0x3d2b24[_0x13ce('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38490a,_0x230597){return function(_0x5b5c0a){if(!_0x5b5c0a){_0x38490a['sendStatus'](0x194);}return _0x5b5c0a;};}function handleError(_0x2beeb9,_0x1420dc){_0x1420dc=_0x1420dc||0x1f4;return function(_0x3b861e){logger[_0x13ce('0x27')](_0x3b861e[_0x13ce('0x36')]);if(_0x3b861e[_0x13ce('0x37')]){delete _0x3b861e['name'];}_0x2beeb9[_0x13ce('0x2b')](_0x1420dc)['send'](_0x3b861e);};}exports[_0x13ce('0x38')]=function(_0xd75b,_0x41fc55){var _0x5c6d14={},_0x451fb4={},_0x1dea41={'count':0x0,'rows':[]};var _0x1b57bc=_[_0x13ce('0x39')](db[_0x13ce('0x3a')][_0x13ce('0x3b')],function(_0x37e10a){return{'name':_0x37e10a[_0x13ce('0x3c')],'type':_0x37e10a[_0x13ce('0x3d')][_0x13ce('0x3e')]};});_0x451fb4['model']=_['map'](_0x1b57bc,'name');_0x451fb4[_0x13ce('0x3f')]=_[_0x13ce('0x40')](_0xd75b[_0x13ce('0x3f')]);_0x451fb4[_0x13ce('0x41')]=_[_0x13ce('0x42')](_0x451fb4['model'],_0x451fb4[_0x13ce('0x3f')]);_0x5c6d14[_0x13ce('0x43')]=_[_0x13ce('0x42')](_0x451fb4[_0x13ce('0x44')],qs[_0x13ce('0x45')](_0xd75b['query']['fields']));_0x5c6d14[_0x13ce('0x43')]=_0x5c6d14[_0x13ce('0x43')]['length']?_0x5c6d14[_0x13ce('0x43')]:_0x451fb4[_0x13ce('0x44')];if(!_0xd75b[_0x13ce('0x3f')]['hasOwnProperty'](_0x13ce('0x46'))){_0x5c6d14[_0x13ce('0x2f')]=qs[_0x13ce('0x2f')](_0xd75b[_0x13ce('0x3f')][_0x13ce('0x2f')]);_0x5c6d14[_0x13ce('0x2e')]=qs[_0x13ce('0x2e')](_0xd75b[_0x13ce('0x3f')][_0x13ce('0x2e')]);}_0x5c6d14['order']=qs[_0x13ce('0x47')](_0xd75b['query'][_0x13ce('0x47')]);_0x5c6d14[_0x13ce('0x48')]=qs[_0x13ce('0x41')](_[_0x13ce('0x49')](_0xd75b[_0x13ce('0x3f')],_0x451fb4[_0x13ce('0x41')]),_0x1b57bc);if(_0xd75b[_0x13ce('0x3f')][_0x13ce('0x4a')]){_0x5c6d14[_0x13ce('0x48')]=_['merge'](_0x5c6d14[_0x13ce('0x48')],{'$or':_['map'](_0x1b57bc,function(_0x5dd43d){if(_0x5dd43d[_0x13ce('0x3d')]!==_0x13ce('0x4b')){var _0x360e54={};_0x360e54[_0x5dd43d[_0x13ce('0x37')]]={'$like':'%'+_0xd75b[_0x13ce('0x3f')]['filter']+'%'};return _0x360e54;}})});}_0x5c6d14=_[_0x13ce('0x4c')]({},_0x5c6d14,_0xd75b[_0x13ce('0x4d')]);var _0x49238d={'where':_0x5c6d14[_0x13ce('0x48')]};return db[_0x13ce('0x3a')]['count'](_0x49238d)[_0x13ce('0x21')](function(_0x23d7cc){_0x1dea41[_0x13ce('0x4e')]=_0x23d7cc;if(_0xd75b[_0x13ce('0x3f')]['includeAll']){_0x5c6d14[_0x13ce('0x4f')]=[{'all':!![]}];}return db[_0x13ce('0x3a')][_0x13ce('0x50')](_0x5c6d14);})[_0x13ce('0x21')](function(_0x9f0db8){_0x1dea41[_0x13ce('0x51')]=_0x9f0db8;return _0x1dea41;})[_0x13ce('0x21')](respondWithFilteredResult(_0x41fc55,_0x5c6d14))[_0x13ce('0x2a')](handleError(_0x41fc55,null));};exports[_0x13ce('0x52')]=function(_0x560ce1,_0x4486f6){var _0x47e654={'raw':!![],'where':{'id':_0x560ce1[_0x13ce('0x53')]['id']}},_0x147441={};_0x147441[_0x13ce('0x44')]=_[_0x13ce('0x40')](db['ChatGroup'][_0x13ce('0x3b')]);_0x147441[_0x13ce('0x3f')]=_[_0x13ce('0x40')](_0x560ce1[_0x13ce('0x3f')]);_0x147441['filters']=_['intersection'](_0x147441['model'],_0x147441[_0x13ce('0x3f')]);_0x47e654[_0x13ce('0x43')]=_['intersection'](_0x147441['model'],qs['fields'](_0x560ce1[_0x13ce('0x3f')][_0x13ce('0x45')]));_0x47e654['attributes']=_0x47e654[_0x13ce('0x43')][_0x13ce('0x54')]?_0x47e654['attributes']:_0x147441['model'];if(_0x560ce1['query']['includeAll']){_0x47e654[_0x13ce('0x4f')]=[{'all':!![]}];}_0x47e654=_[_0x13ce('0x4c')]({},_0x47e654,_0x560ce1[_0x13ce('0x4d')]);return db['ChatGroup'][_0x13ce('0x55')](_0x47e654)[_0x13ce('0x21')](handleEntityNotFound(_0x4486f6,null))[_0x13ce('0x21')](respondWithResult(_0x4486f6,null))['catch'](handleError(_0x4486f6,null));};exports[_0x13ce('0x56')]=function(_0x5d9618,_0x2a31c8){return db[_0x13ce('0x3a')][_0x13ce('0x56')](_0x5d9618[_0x13ce('0x57')],{})[_0x13ce('0x21')](respondWithResult(_0x2a31c8,0xc9))['catch'](handleError(_0x2a31c8,null));};exports[_0x13ce('0x34')]=function(_0x16ef15,_0x2116e4){if(_0x16ef15['body']['id']){delete _0x16ef15[_0x13ce('0x57')]['id'];}return db['ChatGroup'][_0x13ce('0x55')]({'where':{'id':_0x16ef15[_0x13ce('0x53')]['id']}})[_0x13ce('0x21')](handleEntityNotFound(_0x2116e4,null))[_0x13ce('0x21')](saveUpdates(_0x16ef15[_0x13ce('0x57')],null))[_0x13ce('0x21')](respondWithResult(_0x2116e4,null))['catch'](handleError(_0x2116e4,null));};exports[_0x13ce('0x35')]=function(_0x2cfb22,_0x8505eb){return db[_0x13ce('0x3a')][_0x13ce('0x55')]({'where':{'id':_0x2cfb22[_0x13ce('0x53')]['id']}})[_0x13ce('0x21')](handleEntityNotFound(_0x8505eb,null))[_0x13ce('0x21')](removeEntity(_0x8505eb,null))['catch'](handleError(_0x8505eb,null));};exports[_0x13ce('0x58')]=function(_0xbc74b9,_0x2abc89){return db[_0x13ce('0x3a')][_0x13ce('0x58')]()['then'](respondWithResult(_0x2abc89,null))[_0x13ce('0x2a')](handleError(_0x2abc89,null));};exports[_0x13ce('0x59')]=function(_0x3662ab,_0x92811d,_0x540573){return db['ChatInternalMessage'][_0x13ce('0x4e')]({'where':{'ChatGroupId':_0x3662ab[_0x13ce('0x53')]['id'],'ToId':_0x3662ab[_0x13ce('0x5a')]['id'],'read':![]}})['then'](function(_0x106a44){return{'id':_['toInteger'](_0x3662ab[_0x13ce('0x53')]['id']),'count':_0x106a44};})['then'](respondWithResult(_0x92811d,null))['catch'](handleError(_0x92811d,null));};exports[_0x13ce('0x5b')]=function(_0x584ce3,_0x1a794a,_0x3bfac2){return db[_0x13ce('0x3a')][_0x13ce('0x55')]({'where':{'id':_0x584ce3[_0x13ce('0x53')]['id']}})['then'](handleEntityNotFound(_0x1a794a,null))[_0x13ce('0x21')](function(_0x1bdd2e){if(_0x1bdd2e){return _0x1bdd2e[_0x13ce('0x5b')](_0x584ce3[_0x13ce('0x57')][_0x13ce('0x5c')],_['omit'](_0x584ce3[_0x13ce('0x57')],[_0x13ce('0x5c'),'id'])||{});}})[_0x13ce('0x21')](respondWithResult(_0x1a794a,null))[_0x13ce('0x2a')](handleError(_0x1a794a,null));};exports['getMembers']=function(_0x41656a,_0x74de2a,_0x5631f2){var _0x557291={};var _0x4d3809={};var _0x16db7a;var _0x4b1535;return db[_0x13ce('0x3a')][_0x13ce('0x5d')]({'where':{'id':_0x41656a['params']['id']}})[_0x13ce('0x21')](handleEntityNotFound(_0x74de2a,null))['then'](function(_0x162cc5){if(_0x162cc5){_0x16db7a=_0x162cc5;_0x4d3809[_0x13ce('0x44')]=_['keys'](db[_0x13ce('0x5e')][_0x13ce('0x3b')]);_0x4d3809[_0x13ce('0x3f')]=_['keys'](_0x41656a[_0x13ce('0x3f')]);_0x4d3809[_0x13ce('0x41')]=_[_0x13ce('0x42')](_0x4d3809[_0x13ce('0x44')],_0x4d3809[_0x13ce('0x3f')]);_0x557291[_0x13ce('0x43')]=_[_0x13ce('0x42')](_0x4d3809[_0x13ce('0x44')],qs['fields'](_0x41656a['query'][_0x13ce('0x45')]));_0x557291[_0x13ce('0x43')]=_0x557291[_0x13ce('0x43')]['length']?_0x557291['attributes']:_0x4d3809['model'];_0x557291[_0x13ce('0x5f')]=qs[_0x13ce('0x47')](_0x41656a['query'][_0x13ce('0x47')]);_0x557291[_0x13ce('0x48')]=qs['filters'](_[_0x13ce('0x49')](_0x41656a[_0x13ce('0x3f')],_0x4d3809['filters']));if(_0x41656a[_0x13ce('0x3f')][_0x13ce('0x4a')]){_0x557291['where']=_['merge'](_0x557291[_0x13ce('0x48')],{'$or':_[_0x13ce('0x39')](_0x557291[_0x13ce('0x43')],function(_0x1e18e7){var _0x6efb8b={};_0x6efb8b[_0x1e18e7]={'$like':'%'+_0x41656a['query'][_0x13ce('0x4a')]+'%'};return _0x6efb8b;})});}_0x557291=_[_0x13ce('0x4c')]({},_0x557291,_0x41656a[_0x13ce('0x4d')]);return _0x16db7a[_0x13ce('0x60')](_0x557291);}})[_0x13ce('0x21')](function(_0x71272b){if(_0x71272b){_0x4b1535=_0x71272b[_0x13ce('0x54')];if(!_0x41656a['query'][_0x13ce('0x61')]('nolimit')){_0x557291['limit']=qs[_0x13ce('0x2f')](_0x41656a[_0x13ce('0x3f')][_0x13ce('0x2f')]);_0x557291[_0x13ce('0x2e')]=qs[_0x13ce('0x2e')](_0x41656a[_0x13ce('0x3f')]['offset']);}return _0x16db7a['getMembers'](_0x557291);}})['then'](function(_0x384d91){if(_0x384d91){return _0x384d91?{'count':_0x4b1535,'rows':_0x384d91}:null;}})[_0x13ce('0x21')](respondWithResult(_0x74de2a,null))['catch'](handleError(_0x74de2a,null));};exports['removeMembers']=function(_0x3fa7cf,_0x41e300,_0x1528d6){return db[_0x13ce('0x3a')][_0x13ce('0x55')]({'where':{'id':_0x3fa7cf['params']['id']}})[_0x13ce('0x21')](handleEntityNotFound(_0x41e300,null))['then'](function(_0x30571c){if(_0x30571c){return _0x30571c['removeMembers'](_0x3fa7cf[_0x13ce('0x3f')][_0x13ce('0x5c')]);}})['then'](respondWithStatusCode(_0x41e300,null))[_0x13ce('0x2a')](handleError(_0x41e300,null));};exports[_0x13ce('0x62')]=function(_0x2558e2,_0x5639c0,_0x2c5aa9){if(_0x2558e2[_0x13ce('0x57')]['id']){delete _0x2558e2[_0x13ce('0x57')]['id'];}return db[_0x13ce('0x3a')][_0x13ce('0x55')]({'where':{'id':_0x2558e2[_0x13ce('0x53')]['id']}})[_0x13ce('0x21')](handleEntityNotFound(_0x5639c0,null))[_0x13ce('0x21')](function(_0x1b1b1e){if(_0x1b1b1e){_0x2558e2[_0x13ce('0x57')]['ChatGroupId']=_0x1b1b1e['id'];return db[_0x13ce('0x63')]['create'](_0x2558e2[_0x13ce('0x57')]);}})[_0x13ce('0x21')](respondWithResult(_0x5639c0,null))['catch'](handleError(_0x5639c0,null));};exports['getMessages']=function(_0x3e307a,_0x15c5d9,_0x3dbdf1){var _0x2ac996={};var _0x588481={};var _0x401a5e;var _0x10e1e4;return db[_0x13ce('0x3a')][_0x13ce('0x5d')]({'where':{'id':_0x3e307a['params']['id']}})[_0x13ce('0x21')](handleEntityNotFound(_0x15c5d9,null))[_0x13ce('0x21')](function(_0x3dab45){if(_0x3dab45){_0x401a5e=_0x3dab45;_0x588481[_0x13ce('0x44')]=_[_0x13ce('0x40')](db[_0x13ce('0x63')]['rawAttributes']);_0x588481[_0x13ce('0x3f')]=_[_0x13ce('0x40')](_0x3e307a['query']);_0x588481[_0x13ce('0x41')]=_[_0x13ce('0x42')](_0x588481['model'],_0x588481[_0x13ce('0x3f')]);_0x2ac996[_0x13ce('0x43')]=_['intersection'](_0x588481[_0x13ce('0x44')],qs[_0x13ce('0x45')](_0x3e307a[_0x13ce('0x3f')][_0x13ce('0x45')]));_0x2ac996[_0x13ce('0x43')]=_0x2ac996['attributes'][_0x13ce('0x54')]?_0x2ac996[_0x13ce('0x43')]:_0x588481[_0x13ce('0x44')];_0x2ac996[_0x13ce('0x5f')]=qs['sort'](_0x3e307a[_0x13ce('0x3f')][_0x13ce('0x47')]);_0x2ac996[_0x13ce('0x48')]=qs[_0x13ce('0x41')](_['pick'](_0x3e307a['query'],_0x588481[_0x13ce('0x41')]));if(_0x3e307a[_0x13ce('0x3f')][_0x13ce('0x4a')]){_0x2ac996['where']=_[_0x13ce('0x4c')](_0x2ac996[_0x13ce('0x48')],{'$or':_['map'](_0x2ac996['attributes'],function(_0xa656d){var _0x2bd781={};_0x2bd781[_0xa656d]={'$like':'%'+_0x3e307a['query'][_0x13ce('0x4a')]+'%'};return _0x2bd781;})});}if(_0x3e307a[_0x13ce('0x3f')][_0x13ce('0x64')]){var _0x3ce100=_0x3e307a['query'][_0x13ce('0x64')][_0x13ce('0x65')](',');var _0xc8ef62={};_0xc8ef62[_0x3ce100[0x0]]={'$gte':moment(_0x3ce100[0x1])[_0x13ce('0x66')](_0x13ce('0x67'))};_0x2ac996['where']=_[_0x13ce('0x4c')](_0x2ac996['where'],_0xc8ef62);}_0x2ac996=_[_0x13ce('0x4c')]({},_0x2ac996,_0x3e307a[_0x13ce('0x4d')]);return _0x401a5e[_0x13ce('0x68')](_0x2ac996);}})['then'](function(_0xbddecc){if(_0xbddecc){_0x10e1e4=_0xbddecc[_0x13ce('0x54')];if(!_0x3e307a[_0x13ce('0x3f')][_0x13ce('0x61')](_0x13ce('0x46'))){_0x2ac996[_0x13ce('0x2f')]=qs[_0x13ce('0x2f')](_0x3e307a[_0x13ce('0x3f')]['limit']);_0x2ac996['offset']=qs[_0x13ce('0x2e')](_0x3e307a[_0x13ce('0x3f')][_0x13ce('0x2e')]);}return _0x401a5e['getMessages'](_0x2ac996);}})['then'](function(_0x4a4178){if(_0x4a4178){return _0x4a4178?{'count':_0x10e1e4,'rows':_0x4a4178}:null;}})['then'](respondWithResult(_0x15c5d9,null))[_0x13ce('0x2a')](handleError(_0x15c5d9,null));}; \ No newline at end of file +var _0x2b4c=['socket.io-emitter','./chatGroup.socket','register','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','count','offset','limit','set','apply','reject','save','destroy','sendStatus','name','send','index','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','map','VIRTUAL','options','ChatGroup','includeAll','include','findAll','rows','show','rawAttributes','find','create','body','update','describe','getUnread','ChatInternalMessage','params','user','toInteger','addMembers','ids','omit','getMembers','findOne','filter','hasOwnProperty','removeMembers','addMessage','ChatGroupId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2b4c,0xce));var _0xc2b4=function(_0x32fe12,_0x85d84b){_0x32fe12=_0x32fe12-0x0;var _0x310246=_0x2b4c[_0x32fe12];return _0x310246;};'use strict';var pdf=require(_0xc2b4('0x0'));var emlformat=require(_0xc2b4('0x1'));var rimraf=require(_0xc2b4('0x2'));var zipdir=require(_0xc2b4('0x3'));var jsonpatch=require(_0xc2b4('0x4'));var rp=require(_0xc2b4('0x5'));var moment=require(_0xc2b4('0x6'));var BPromise=require(_0xc2b4('0x7'));var Mustache=require(_0xc2b4('0x8'));var util=require(_0xc2b4('0x9'));var path=require(_0xc2b4('0xa'));var sox=require(_0xc2b4('0xb'));var csv=require(_0xc2b4('0xc'));var ejs=require(_0xc2b4('0xd'));var fs=require('fs');var _=require(_0xc2b4('0xe'));var squel=require(_0xc2b4('0xf'));var crypto=require(_0xc2b4('0x10'));var jsforce=require(_0xc2b4('0x11'));var deskjs=require(_0xc2b4('0x12'));var toCsv=require(_0xc2b4('0xc'));var querystring=require(_0xc2b4('0x13'));var Papa=require(_0xc2b4('0x14'));var Redis=require(_0xc2b4('0x15'));var authService=require(_0xc2b4('0x16'));var qs=require(_0xc2b4('0x17'));var as=require(_0xc2b4('0x18'));var hardwareService=require(_0xc2b4('0x19'));var logger=require(_0xc2b4('0x1a'))('api');var utils=require(_0xc2b4('0x1b'));var config=require(_0xc2b4('0x1c'));var db=require(_0xc2b4('0x1d'))['db'];config[_0xc2b4('0x1e')]=_['defaults'](config[_0xc2b4('0x1e')],{'host':_0xc2b4('0x1f'),'port':0x18eb});var socket=require(_0xc2b4('0x20'))(new Redis(config[_0xc2b4('0x1e')]));require(_0xc2b4('0x21'))[_0xc2b4('0x22')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc2b4('0x23')][_0xc2b4('0x24')]({'port':0x232a});function checkPasswordPattern(_0x2530d1,_0x414efa,_0x135864){if(_0x135864){var _0x3513fd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3513fd[_0xc2b4('0x25')](_0x414efa)){return _0x2530d1;}else{throw new db[(_0xc2b4('0x26'))][(_0xc2b4('0x27'))](_0xc2b4('0x28'));}}else{return _0x2530d1;}}function respondWithRpcPromise(_0x1be55e,_0x5850fd,_0x43ed68,_0x28217e){return new BPromise(function(_0x21eb67,_0x2515d4){var _0x1e3891=_0x28217e||client;return _0x1e3891[_0xc2b4('0x29')](_0x1be55e,_0x43ed68)[_0xc2b4('0x2a')](function(_0x5a4f23){logger[_0xc2b4('0x2b')](_0xc2b4('0x2c'),_0x5850fd,_0xc2b4('0x2d'));logger[_0xc2b4('0x2e')](_0xc2b4('0x2f'),_0x5850fd,'request\x20sent',JSON[_0xc2b4('0x30')](_0x5a4f23));if(_0x5a4f23[_0xc2b4('0x31')]){if(_0x5a4f23['error']['code']===0x1f4){logger[_0xc2b4('0x31')](_0xc2b4('0x2c'),_0x5850fd,_0x5a4f23[_0xc2b4('0x31')][_0xc2b4('0x32')]);return _0x2515d4(_0x5a4f23[_0xc2b4('0x31')][_0xc2b4('0x32')]);}logger[_0xc2b4('0x31')](_0xc2b4('0x2c'),_0x5850fd,_0x5a4f23['error'][_0xc2b4('0x32')]);return _0x21eb67(_0x5a4f23[_0xc2b4('0x31')][_0xc2b4('0x32')]);}else{logger[_0xc2b4('0x2b')]('ChatGroup,\x20%s,\x20%s',_0x5850fd,_0xc2b4('0x2d'));_0x21eb67(_0x5a4f23[_0xc2b4('0x33')]['message']);}})[_0xc2b4('0x34')](function(_0x53a6d8){logger[_0xc2b4('0x31')](_0xc2b4('0x2c'),_0x5850fd,_0x53a6d8);_0x2515d4(_0x53a6d8);});});}function respondWithStatusCode(_0x3913d6,_0x328cc8){_0x328cc8=_0x328cc8||0xcc;return function(_0x4d8101){if(_0x4d8101){return _0x3913d6['sendStatus'](_0x328cc8);}return _0x3913d6[_0xc2b4('0x35')](_0x328cc8)[_0xc2b4('0x36')]();};}function respondWithResult(_0xd5e3e2,_0x18891f){_0x18891f=_0x18891f||0xc8;return function(_0x463ed3){if(_0x463ed3){return _0xd5e3e2[_0xc2b4('0x35')](_0x18891f)['json'](_0x463ed3);}};}function respondWithFilteredResult(_0x1889ed,_0x1b67e5){return function(_0x5d049b){if(_0x5d049b){var _0x43a5cf=_0x5d049b[_0xc2b4('0x37')],_0x1787e9=_0x1b67e5[_0xc2b4('0x38')],_0x41ae45=_0x1b67e5[_0xc2b4('0x38')]+_0x1b67e5[_0xc2b4('0x39')],_0x3c223c;if(_0x41ae45>=_0x43a5cf){_0x41ae45=_0x43a5cf;_0x3c223c=0xc8;}else{_0x3c223c=0xce;}_0x1889ed[_0xc2b4('0x35')](_0x3c223c);return _0x1889ed[_0xc2b4('0x3a')]('Content-Range',_0x1787e9+'-'+_0x41ae45+'/'+_0x43a5cf)['json'](_0x5d049b);}return null;};}function patchUpdates(_0x4f13dc){return function(_0x154a9b){try{jsonpatch[_0xc2b4('0x3b')](_0x154a9b,_0x4f13dc,!![]);}catch(_0x4c1736){return BPromise[_0xc2b4('0x3c')](_0x4c1736);}return _0x154a9b[_0xc2b4('0x3d')]();};}function saveUpdates(_0x345a00,_0x609810){return function(_0x1800ff){if(_0x1800ff){return _0x1800ff['update'](_0x345a00)['then'](function(_0x16d292){return _0x16d292;});}return null;};}function removeEntity(_0x3decf2,_0x1c38fa){return function(_0x1002b4){if(_0x1002b4){return _0x1002b4[_0xc2b4('0x3e')]()[_0xc2b4('0x2a')](function(){_0x3decf2[_0xc2b4('0x35')](0xcc)[_0xc2b4('0x36')]();});}};}function handleEntityNotFound(_0xbc69dc,_0x5c4963){return function(_0x264cae){if(!_0x264cae){_0xbc69dc[_0xc2b4('0x3f')](0x194);}return _0x264cae;};}function handleError(_0x1cd6d4,_0x4aab97){_0x4aab97=_0x4aab97||0x1f4;return function(_0x206b3f){logger[_0xc2b4('0x31')](_0x206b3f['stack']);if(_0x206b3f[_0xc2b4('0x40')]){delete _0x206b3f[_0xc2b4('0x40')];}_0x1cd6d4[_0xc2b4('0x35')](_0x4aab97)[_0xc2b4('0x41')](_0x206b3f);};}exports[_0xc2b4('0x42')]=function(_0x2d65bf,_0x4d7c94){var _0x1605a1={},_0x889069={},_0x4a18d5={'count':0x0,'rows':[]};var _0x1c2d02=_['map'](db['ChatGroup']['rawAttributes'],function(_0x15ee77){return{'name':_0x15ee77[_0xc2b4('0x43')],'type':_0x15ee77[_0xc2b4('0x44')][_0xc2b4('0x45')]};});_0x889069[_0xc2b4('0x46')]=_['map'](_0x1c2d02,_0xc2b4('0x40'));_0x889069['query']=_[_0xc2b4('0x47')](_0x2d65bf[_0xc2b4('0x48')]);_0x889069[_0xc2b4('0x49')]=_[_0xc2b4('0x4a')](_0x889069[_0xc2b4('0x46')],_0x889069['query']);_0x1605a1[_0xc2b4('0x4b')]=_[_0xc2b4('0x4a')](_0x889069['model'],qs[_0xc2b4('0x4c')](_0x2d65bf[_0xc2b4('0x48')]['fields']));_0x1605a1[_0xc2b4('0x4b')]=_0x1605a1[_0xc2b4('0x4b')][_0xc2b4('0x4d')]?_0x1605a1[_0xc2b4('0x4b')]:_0x889069[_0xc2b4('0x46')];if(!_0x2d65bf[_0xc2b4('0x48')]['hasOwnProperty'](_0xc2b4('0x4e'))){_0x1605a1[_0xc2b4('0x39')]=qs[_0xc2b4('0x39')](_0x2d65bf[_0xc2b4('0x48')][_0xc2b4('0x39')]);_0x1605a1['offset']=qs[_0xc2b4('0x38')](_0x2d65bf[_0xc2b4('0x48')][_0xc2b4('0x38')]);}_0x1605a1[_0xc2b4('0x4f')]=qs[_0xc2b4('0x50')](_0x2d65bf['query'][_0xc2b4('0x50')]);_0x1605a1[_0xc2b4('0x51')]=qs[_0xc2b4('0x49')](_[_0xc2b4('0x52')](_0x2d65bf['query'],_0x889069['filters']),_0x1c2d02);if(_0x2d65bf[_0xc2b4('0x48')]['filter']){_0x1605a1[_0xc2b4('0x51')]=_[_0xc2b4('0x53')](_0x1605a1['where'],{'$or':_[_0xc2b4('0x54')](_0x1c2d02,function(_0xfa9743){if(_0xfa9743[_0xc2b4('0x44')]!==_0xc2b4('0x55')){var _0xa8a858={};_0xa8a858[_0xfa9743[_0xc2b4('0x40')]]={'$like':'%'+_0x2d65bf[_0xc2b4('0x48')]['filter']+'%'};return _0xa8a858;}})});}_0x1605a1=_[_0xc2b4('0x53')]({},_0x1605a1,_0x2d65bf[_0xc2b4('0x56')]);var _0x16b063={'where':_0x1605a1[_0xc2b4('0x51')]};return db[_0xc2b4('0x57')]['count'](_0x16b063)[_0xc2b4('0x2a')](function(_0x5db81a){_0x4a18d5[_0xc2b4('0x37')]=_0x5db81a;if(_0x2d65bf['query'][_0xc2b4('0x58')]){_0x1605a1[_0xc2b4('0x59')]=[{'all':!![]}];}return db['ChatGroup'][_0xc2b4('0x5a')](_0x1605a1);})[_0xc2b4('0x2a')](function(_0x3e42e0){_0x4a18d5[_0xc2b4('0x5b')]=_0x3e42e0;return _0x4a18d5;})['then'](respondWithFilteredResult(_0x4d7c94,_0x1605a1))[_0xc2b4('0x34')](handleError(_0x4d7c94,null));};exports[_0xc2b4('0x5c')]=function(_0x4ef661,_0x3dead2){var _0xb35dcd={'raw':!![],'where':{'id':_0x4ef661['params']['id']}},_0x4747e6={};_0x4747e6[_0xc2b4('0x46')]=_[_0xc2b4('0x47')](db['ChatGroup'][_0xc2b4('0x5d')]);_0x4747e6[_0xc2b4('0x48')]=_[_0xc2b4('0x47')](_0x4ef661[_0xc2b4('0x48')]);_0x4747e6['filters']=_[_0xc2b4('0x4a')](_0x4747e6['model'],_0x4747e6['query']);_0xb35dcd['attributes']=_[_0xc2b4('0x4a')](_0x4747e6[_0xc2b4('0x46')],qs[_0xc2b4('0x4c')](_0x4ef661[_0xc2b4('0x48')][_0xc2b4('0x4c')]));_0xb35dcd[_0xc2b4('0x4b')]=_0xb35dcd[_0xc2b4('0x4b')][_0xc2b4('0x4d')]?_0xb35dcd[_0xc2b4('0x4b')]:_0x4747e6[_0xc2b4('0x46')];if(_0x4ef661[_0xc2b4('0x48')][_0xc2b4('0x58')]){_0xb35dcd[_0xc2b4('0x59')]=[{'all':!![]}];}_0xb35dcd=_[_0xc2b4('0x53')]({},_0xb35dcd,_0x4ef661[_0xc2b4('0x56')]);return db[_0xc2b4('0x57')][_0xc2b4('0x5e')](_0xb35dcd)[_0xc2b4('0x2a')](handleEntityNotFound(_0x3dead2,null))[_0xc2b4('0x2a')](respondWithResult(_0x3dead2,null))[_0xc2b4('0x34')](handleError(_0x3dead2,null));};exports[_0xc2b4('0x5f')]=function(_0x34d839,_0x5350a8){return db[_0xc2b4('0x57')]['create'](_0x34d839[_0xc2b4('0x60')],{})['then'](respondWithResult(_0x5350a8,0xc9))[_0xc2b4('0x34')](handleError(_0x5350a8,null));};exports[_0xc2b4('0x61')]=function(_0x268b6d,_0x1f817e){if(_0x268b6d[_0xc2b4('0x60')]['id']){delete _0x268b6d[_0xc2b4('0x60')]['id'];}return db[_0xc2b4('0x57')][_0xc2b4('0x5e')]({'where':{'id':_0x268b6d['params']['id']}})[_0xc2b4('0x2a')](handleEntityNotFound(_0x1f817e,null))[_0xc2b4('0x2a')](saveUpdates(_0x268b6d[_0xc2b4('0x60')],null))[_0xc2b4('0x2a')](respondWithResult(_0x1f817e,null))[_0xc2b4('0x34')](handleError(_0x1f817e,null));};exports[_0xc2b4('0x3e')]=function(_0x9e6be4,_0x24c243){return db['ChatGroup'][_0xc2b4('0x5e')]({'where':{'id':_0x9e6be4['params']['id']}})[_0xc2b4('0x2a')](handleEntityNotFound(_0x24c243,null))[_0xc2b4('0x2a')](removeEntity(_0x24c243,null))[_0xc2b4('0x34')](handleError(_0x24c243,null));};exports[_0xc2b4('0x62')]=function(_0x5d3efa,_0xa579e2){return db[_0xc2b4('0x57')]['describe']()['then'](respondWithResult(_0xa579e2,null))[_0xc2b4('0x34')](handleError(_0xa579e2,null));};exports[_0xc2b4('0x63')]=function(_0x1105fd,_0x1cf270,_0x411c65){return db[_0xc2b4('0x64')][_0xc2b4('0x37')]({'where':{'ChatGroupId':_0x1105fd[_0xc2b4('0x65')]['id'],'ToId':_0x1105fd[_0xc2b4('0x66')]['id'],'read':![]}})[_0xc2b4('0x2a')](function(_0x3c0226){return{'id':_[_0xc2b4('0x67')](_0x1105fd[_0xc2b4('0x65')]['id']),'count':_0x3c0226};})[_0xc2b4('0x2a')](respondWithResult(_0x1cf270,null))[_0xc2b4('0x34')](handleError(_0x1cf270,null));};exports[_0xc2b4('0x68')]=function(_0x5ee305,_0x55f074,_0x22d660){return db[_0xc2b4('0x57')][_0xc2b4('0x5e')]({'where':{'id':_0x5ee305[_0xc2b4('0x65')]['id']}})[_0xc2b4('0x2a')](handleEntityNotFound(_0x55f074,null))[_0xc2b4('0x2a')](function(_0x359fa0){if(_0x359fa0){return _0x359fa0[_0xc2b4('0x68')](_0x5ee305[_0xc2b4('0x60')][_0xc2b4('0x69')],_[_0xc2b4('0x6a')](_0x5ee305[_0xc2b4('0x60')],[_0xc2b4('0x69'),'id'])||{});}})[_0xc2b4('0x2a')](respondWithResult(_0x55f074,null))['catch'](handleError(_0x55f074,null));};exports[_0xc2b4('0x6b')]=function(_0x5b0a42,_0x1bfaa1,_0x273a87){var _0x52afca={};var _0x52a00d={};var _0x2444c3;var _0x49fea0;return db['ChatGroup'][_0xc2b4('0x6c')]({'where':{'id':_0x5b0a42[_0xc2b4('0x65')]['id']}})[_0xc2b4('0x2a')](handleEntityNotFound(_0x1bfaa1,null))['then'](function(_0x3c5e73){if(_0x3c5e73){_0x2444c3=_0x3c5e73;_0x52a00d[_0xc2b4('0x46')]=_['keys'](db['User']['rawAttributes']);_0x52a00d[_0xc2b4('0x48')]=_['keys'](_0x5b0a42['query']);_0x52a00d[_0xc2b4('0x49')]=_[_0xc2b4('0x4a')](_0x52a00d[_0xc2b4('0x46')],_0x52a00d[_0xc2b4('0x48')]);_0x52afca[_0xc2b4('0x4b')]=_[_0xc2b4('0x4a')](_0x52a00d[_0xc2b4('0x46')],qs[_0xc2b4('0x4c')](_0x5b0a42[_0xc2b4('0x48')]['fields']));_0x52afca[_0xc2b4('0x4b')]=_0x52afca[_0xc2b4('0x4b')][_0xc2b4('0x4d')]?_0x52afca['attributes']:_0x52a00d[_0xc2b4('0x46')];_0x52afca[_0xc2b4('0x4f')]=qs[_0xc2b4('0x50')](_0x5b0a42[_0xc2b4('0x48')][_0xc2b4('0x50')]);_0x52afca[_0xc2b4('0x51')]=qs[_0xc2b4('0x49')](_[_0xc2b4('0x52')](_0x5b0a42[_0xc2b4('0x48')],_0x52a00d['filters']));if(_0x5b0a42[_0xc2b4('0x48')][_0xc2b4('0x6d')]){_0x52afca[_0xc2b4('0x51')]=_[_0xc2b4('0x53')](_0x52afca[_0xc2b4('0x51')],{'$or':_[_0xc2b4('0x54')](_0x52afca[_0xc2b4('0x4b')],function(_0x2e9132){var _0x412e6f={};_0x412e6f[_0x2e9132]={'$like':'%'+_0x5b0a42[_0xc2b4('0x48')][_0xc2b4('0x6d')]+'%'};return _0x412e6f;})});}_0x52afca=_[_0xc2b4('0x53')]({},_0x52afca,_0x5b0a42['options']);return _0x2444c3[_0xc2b4('0x6b')](_0x52afca);}})[_0xc2b4('0x2a')](function(_0xf72597){if(_0xf72597){_0x49fea0=_0xf72597['length'];if(!_0x5b0a42['query'][_0xc2b4('0x6e')](_0xc2b4('0x4e'))){_0x52afca['limit']=qs[_0xc2b4('0x39')](_0x5b0a42[_0xc2b4('0x48')]['limit']);_0x52afca[_0xc2b4('0x38')]=qs[_0xc2b4('0x38')](_0x5b0a42[_0xc2b4('0x48')][_0xc2b4('0x38')]);}return _0x2444c3[_0xc2b4('0x6b')](_0x52afca);}})[_0xc2b4('0x2a')](function(_0x2c7559){if(_0x2c7559){return _0x2c7559?{'count':_0x49fea0,'rows':_0x2c7559}:null;}})[_0xc2b4('0x2a')](respondWithResult(_0x1bfaa1,null))[_0xc2b4('0x34')](handleError(_0x1bfaa1,null));};exports[_0xc2b4('0x6f')]=function(_0x37c994,_0x17bc24,_0x1a05f8){return db[_0xc2b4('0x57')]['find']({'where':{'id':_0x37c994[_0xc2b4('0x65')]['id']}})[_0xc2b4('0x2a')](handleEntityNotFound(_0x17bc24,null))[_0xc2b4('0x2a')](function(_0x35fd76){if(_0x35fd76){return _0x35fd76[_0xc2b4('0x6f')](_0x37c994[_0xc2b4('0x48')]['ids']);}})[_0xc2b4('0x2a')](respondWithStatusCode(_0x17bc24,null))[_0xc2b4('0x34')](handleError(_0x17bc24,null));};exports[_0xc2b4('0x70')]=function(_0x17a3d1,_0x3da531,_0x37cbdb){if(_0x17a3d1['body']['id']){delete _0x17a3d1[_0xc2b4('0x60')]['id'];}return db[_0xc2b4('0x57')][_0xc2b4('0x5e')]({'where':{'id':_0x17a3d1[_0xc2b4('0x65')]['id']}})[_0xc2b4('0x2a')](handleEntityNotFound(_0x3da531,null))[_0xc2b4('0x2a')](function(_0xfe1856){if(_0xfe1856){_0x17a3d1[_0xc2b4('0x60')][_0xc2b4('0x71')]=_0xfe1856['id'];return db[_0xc2b4('0x64')][_0xc2b4('0x5f')](_0x17a3d1[_0xc2b4('0x60')]);}})[_0xc2b4('0x2a')](respondWithResult(_0x3da531,null))[_0xc2b4('0x34')](handleError(_0x3da531,null));};exports['getMessages']=function(_0x5be274,_0x5839f3,_0xca2f30){var _0xcaa190={};var _0x33d8ec={};var _0x43e7f9;var _0x2672cb;return db['ChatGroup']['findOne']({'where':{'id':_0x5be274['params']['id']}})[_0xc2b4('0x2a')](handleEntityNotFound(_0x5839f3,null))[_0xc2b4('0x2a')](function(_0x43e2b4){if(_0x43e2b4){_0x43e7f9=_0x43e2b4;_0x33d8ec[_0xc2b4('0x46')]=_[_0xc2b4('0x47')](db['ChatInternalMessage']['rawAttributes']);_0x33d8ec['query']=_['keys'](_0x5be274[_0xc2b4('0x48')]);_0x33d8ec['filters']=_[_0xc2b4('0x4a')](_0x33d8ec[_0xc2b4('0x46')],_0x33d8ec[_0xc2b4('0x48')]);_0xcaa190[_0xc2b4('0x4b')]=_[_0xc2b4('0x4a')](_0x33d8ec[_0xc2b4('0x46')],qs['fields'](_0x5be274[_0xc2b4('0x48')][_0xc2b4('0x4c')]));_0xcaa190['attributes']=_0xcaa190[_0xc2b4('0x4b')][_0xc2b4('0x4d')]?_0xcaa190[_0xc2b4('0x4b')]:_0x33d8ec['model'];_0xcaa190['order']=qs[_0xc2b4('0x50')](_0x5be274[_0xc2b4('0x48')][_0xc2b4('0x50')]);_0xcaa190['where']=qs[_0xc2b4('0x49')](_[_0xc2b4('0x52')](_0x5be274[_0xc2b4('0x48')],_0x33d8ec[_0xc2b4('0x49')]));if(_0x5be274[_0xc2b4('0x48')][_0xc2b4('0x6d')]){_0xcaa190[_0xc2b4('0x51')]=_[_0xc2b4('0x53')](_0xcaa190[_0xc2b4('0x51')],{'$or':_[_0xc2b4('0x54')](_0xcaa190['attributes'],function(_0x29173e){var _0x518fe8={};_0x518fe8[_0x29173e]={'$like':'%'+_0x5be274['query']['filter']+'%'};return _0x518fe8;})});}if(_0x5be274['query'][_0xc2b4('0x72')]){var _0x21d4aa=_0x5be274[_0xc2b4('0x48')][_0xc2b4('0x72')][_0xc2b4('0x73')](',');var _0x30309f={};_0x30309f[_0x21d4aa[0x0]]={'$gte':moment(_0x21d4aa[0x1])[_0xc2b4('0x74')](_0xc2b4('0x75'))};_0xcaa190['where']=_[_0xc2b4('0x53')](_0xcaa190[_0xc2b4('0x51')],_0x30309f);}_0xcaa190=_['merge']({},_0xcaa190,_0x5be274['options']);return _0x43e7f9['getMessages'](_0xcaa190);}})[_0xc2b4('0x2a')](function(_0x4f7ccb){if(_0x4f7ccb){_0x2672cb=_0x4f7ccb[_0xc2b4('0x4d')];if(!_0x5be274[_0xc2b4('0x48')][_0xc2b4('0x6e')]('nolimit')){_0xcaa190[_0xc2b4('0x39')]=qs['limit'](_0x5be274[_0xc2b4('0x48')][_0xc2b4('0x39')]);_0xcaa190[_0xc2b4('0x38')]=qs[_0xc2b4('0x38')](_0x5be274[_0xc2b4('0x48')][_0xc2b4('0x38')]);}return _0x43e7f9[_0xc2b4('0x76')](_0xcaa190);}})[_0xc2b4('0x2a')](function(_0x36961a){if(_0x36961a){return _0x36961a?{'count':_0x2672cb,'rows':_0x36961a}:null;}})['then'](respondWithResult(_0x5839f3,null))[_0xc2b4('0x34')](handleError(_0x5839f3,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 12cbf30..547105e 100644 --- a/server/api/chatGroup/chatGroup.events.js +++ b/server/api/chatGroup/chatGroup.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['ChatGroup','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x1eaa2b,_0xc218ed){var _0xefc94=function(_0x3cf20f){while(--_0x3cf20f){_0x1eaa2b['push'](_0x1eaa2b['shift']());}};_0xefc94(++_0xc218ed);}(_0xdb28,0x106));var _0x8db2=function(_0x3a80a0,_0x1beb1d){_0x3a80a0=_0x3a80a0-0x0;var _0x46df43=_0xdb28[_0x3a80a0];return _0x46df43;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var ChatGroup=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8db2('0x4'),'afterDestroy':_0x8db2('0x5')};function emitEvent(_0xfcf49f){return function(_0x4426fe,_0x11109e,_0x52bf99){ChatGroupEvents[_0x8db2('0x6')](_0xfcf49f+':'+_0x4426fe['id'],_0x4426fe);ChatGroupEvents[_0x8db2('0x6')](_0xfcf49f,_0x4426fe);_0x52bf99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x8db2('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x2ef3=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','ChatGroup'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0x2ef3,0xba));var _0x32ef=function(_0x44d87d,_0x563f91){_0x44d87d=_0x44d87d-0x0;var _0x4ac4b5=_0x2ef3[_0x44d87d];return _0x4ac4b5;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var ChatGroup=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x32ef('0x3')](0x0);var events={'afterCreate':_0x32ef('0x4'),'afterUpdate':_0x32ef('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38f865){return function(_0x38b7f3,_0x524ab6,_0x402857){ChatGroupEvents[_0x32ef('0x6')](_0x38f865+':'+_0x38b7f3['id'],_0x38b7f3);ChatGroupEvents['emit'](_0x38f865,_0x38b7f3);_0x402857(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x32ef('0x7')](e,emitEvent(event));}}module[_0x32ef('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index d948c4b..abb9b73 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 _0x1115=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','ChatGroup','chat_groups','util','../../config/logger'];(function(_0x56d8ac,_0x13c20c){var _0x597296=function(_0x1260ad){while(--_0x1260ad){_0x56d8ac['push'](_0x56d8ac['shift']());}};_0x597296(++_0x13c20c);}(_0x1115,0x1b6));var _0x5111=function(_0x1bd107,_0xd10ba5){_0x1bd107=_0x1bd107-0x0;var _0xe7ece0=_0x1115[_0x1bd107];return _0xe7ece0;};'use strict';var _=require('lodash');var util=require(_0x5111('0x0'));var logger=require(_0x5111('0x1'))(_0x5111('0x2'));var moment=require(_0x5111('0x3'));var BPromise=require(_0x5111('0x4'));var rp=require(_0x5111('0x5'));var fs=require('fs');var path=require(_0x5111('0x6'));var rimraf=require(_0x5111('0x7'));var config=require(_0x5111('0x8'));var attributes=require('./chatGroup.attributes');module['exports']=function(_0x467c3a,_0x115ba7){return _0x467c3a['define'](_0x5111('0x9'),attributes,{'tableName':_0x5111('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce68=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatGroup.attributes','chat_groups','lodash','../../config/logger'];(function(_0x4cb27a,_0x5f3b80){var _0xfaf66b=function(_0x9710a4){while(--_0x9710a4){_0x4cb27a['push'](_0x4cb27a['shift']());}};_0xfaf66b(++_0x5f3b80);}(_0xce68,0x10c));var _0x8ce6=function(_0x51a867,_0xfb202){_0x51a867=_0x51a867-0x0;var _0x2f8f60=_0xce68[_0x51a867];return _0x2f8f60;};'use strict';var _=require(_0x8ce6('0x0'));var util=require('util');var logger=require(_0x8ce6('0x1'))(_0x8ce6('0x2'));var moment=require(_0x8ce6('0x3'));var BPromise=require(_0x8ce6('0x4'));var rp=require(_0x8ce6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ce6('0x6'));var config=require(_0x8ce6('0x7'));var attributes=require(_0x8ce6('0x8'));module['exports']=function(_0x116e0a,_0x10b3ca){return _0x116e0a['define']('ChatGroup',attributes,{'tableName':_0x8ce6('0x9'),'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 ef07ae7..d6b011c 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 _0x0fac=['info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then'];(function(_0x5f3de3,_0x40f0f5){var _0x287e0d=function(_0x3189dc){while(--_0x3189dc){_0x5f3de3['push'](_0x5f3de3['shift']());}};_0x287e0d(++_0x40f0f5);}(_0x0fac,0x17f));var _0xc0fa=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x0fac[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xc0fa('0x0'));var util=require(_0xc0fa('0x1'));var moment=require('moment');var BPromise=require(_0xc0fa('0x2'));var rs=require(_0xc0fa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc0fa('0x4'));var logger=require(_0xc0fa('0x5'))('rpc');var config=require(_0xc0fa('0x6'));var jayson=require(_0xc0fa('0x7'));var client=jayson['client'][_0xc0fa('0x8')]({'port':0x232a});config[_0xc0fa('0x9')]=_[_0xc0fa('0xa')](config[_0xc0fa('0x9')],{'host':_0xc0fa('0xb'),'port':0x18eb});var socket=require(_0xc0fa('0xc'))(new Redis(config['redis']));require(_0xc0fa('0xd'))[_0xc0fa('0xe')](socket);function respondWithRpcPromise(_0x3ddce1,_0x58e6cd,_0x3e5282){return new BPromise(function(_0x2645f1,_0x236b6e){return client[_0xc0fa('0xf')](_0x3ddce1,_0x3e5282)[_0xc0fa('0x10')](function(_0x4a81ca){logger[_0xc0fa('0x11')](_0xc0fa('0x12'),_0x58e6cd,_0xc0fa('0x13'));logger[_0xc0fa('0x14')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x58e6cd,_0xc0fa('0x13'),JSON[_0xc0fa('0x15')](_0x4a81ca));if(_0x4a81ca['error']){if(_0x4a81ca[_0xc0fa('0x16')][_0xc0fa('0x17')]===0x1f4){logger[_0xc0fa('0x16')]('ChatGroup,\x20%s,\x20%s',_0x58e6cd,_0x4a81ca['error']['message']);return _0x236b6e(_0x4a81ca[_0xc0fa('0x16')][_0xc0fa('0x18')]);}logger[_0xc0fa('0x16')]('ChatGroup,\x20%s,\x20%s',_0x58e6cd,_0x4a81ca[_0xc0fa('0x16')]['message']);return _0x2645f1(_0x4a81ca[_0xc0fa('0x16')]['message']);}else{logger[_0xc0fa('0x11')](_0xc0fa('0x12'),_0x58e6cd,_0xc0fa('0x13'));_0x2645f1(_0x4a81ca['result'][_0xc0fa('0x18')]);}})['catch'](function(_0x27e695){logger[_0xc0fa('0x16')]('ChatGroup,\x20%s,\x20%s',_0x58e6cd,_0x27e695);_0x236b6e(_0x27e695);});});} \ No newline at end of file +var _0xa179=['randomstring','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','util','moment','bluebird'];(function(_0xc489ad,_0x30be38){var _0xed9270=function(_0x4f981c){while(--_0x4f981c){_0xc489ad['push'](_0xc489ad['shift']());}};_0xed9270(++_0x30be38);}(_0xa179,0xde));var _0x9a17=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa179[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x9a17('0x0'));var moment=require(_0x9a17('0x1'));var BPromise=require(_0x9a17('0x2'));var rs=require(_0x9a17('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a17('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9a17('0x5'));var config=require('../../config/environment');var jayson=require(_0x9a17('0x6'));var client=jayson[_0x9a17('0x7')][_0x9a17('0x8')]({'port':0x232a});config[_0x9a17('0x9')]=_[_0x9a17('0xa')](config['redis'],{'host':_0x9a17('0xb'),'port':0x18eb});var socket=require(_0x9a17('0xc'))(new Redis(config[_0x9a17('0x9')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x4e32ef,_0x4bb7cf,_0x300f00){return new BPromise(function(_0xfc336f,_0x420122){return client[_0x9a17('0xd')](_0x4e32ef,_0x300f00)[_0x9a17('0xe')](function(_0x1a1a7b){logger['info'](_0x9a17('0xf'),_0x4bb7cf,_0x9a17('0x10'));logger[_0x9a17('0x11')](_0x9a17('0x12'),_0x4bb7cf,_0x9a17('0x10'),JSON[_0x9a17('0x13')](_0x1a1a7b));if(_0x1a1a7b['error']){if(_0x1a1a7b['error'][_0x9a17('0x14')]===0x1f4){logger[_0x9a17('0x15')](_0x9a17('0xf'),_0x4bb7cf,_0x1a1a7b[_0x9a17('0x15')][_0x9a17('0x16')]);return _0x420122(_0x1a1a7b[_0x9a17('0x15')][_0x9a17('0x16')]);}logger[_0x9a17('0x15')](_0x9a17('0xf'),_0x4bb7cf,_0x1a1a7b[_0x9a17('0x15')][_0x9a17('0x16')]);return _0xfc336f(_0x1a1a7b['error']['message']);}else{logger[_0x9a17('0x17')]('ChatGroup,\x20%s,\x20%s',_0x4bb7cf,'request\x20sent');_0xfc336f(_0x1a1a7b['result'][_0x9a17('0x16')]);}})[_0x9a17('0x18')](function(_0x1f6c4f){logger['error'](_0x9a17('0xf'),_0x4bb7cf,_0x1f6c4f);_0x420122(_0x1f6c4f);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 772d3ed..3adbbd6 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 _0xcde5=['./chatGroup.events','save','remove','update','emit','removeListener','register','length','chatGroup:'];(function(_0x1050c2,_0x13e015){var _0x49c100=function(_0x5106b4){while(--_0x5106b4){_0x1050c2['push'](_0x1050c2['shift']());}};_0x49c100(++_0x13e015);}(_0xcde5,0x87));var _0x5cde=function(_0x24d7d8,_0x59cba1){_0x24d7d8=_0x24d7d8-0x0;var _0x4945d8=_0xcde5[_0x24d7d8];return _0x4945d8;};'use strict';var ChatGroupEvents=require(_0x5cde('0x0'));var events=[_0x5cde('0x1'),_0x5cde('0x2'),_0x5cde('0x3')];function createListener(_0x40e248,_0x4c3849){return function(_0x30d9ac){_0x4c3849[_0x5cde('0x4')](_0x40e248,_0x30d9ac);};}function removeListener(_0x27b28c,_0x3d2bcc){return function(){ChatGroupEvents[_0x5cde('0x5')](_0x27b28c,_0x3d2bcc);};}exports[_0x5cde('0x6')]=function(_0x3ddbbd){for(var _0x450462=0x0,_0x49a69d=events[_0x5cde('0x7')];_0x450462<_0x49a69d;_0x450462++){var _0x522694=events[_0x450462];var _0xc1a99c=createListener(_0x5cde('0x8')+_0x522694,_0x3ddbbd);ChatGroupEvents['on'](_0x522694,_0xc1a99c);}}; \ No newline at end of file +var _0x8c95=['remove','update','emit','length','chatGroup:','./chatGroup.events','save'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x8c95,0x186));var _0x58c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8c95[_0x3dd15e];return _0x231fd0;};'use strict';var ChatGroupEvents=require(_0x58c9('0x0'));var events=[_0x58c9('0x1'),_0x58c9('0x2'),_0x58c9('0x3')];function createListener(_0x4f9603,_0x5bcd88){return function(_0x4af0d2){_0x5bcd88[_0x58c9('0x4')](_0x4f9603,_0x4af0d2);};}function removeListener(_0x22337d,_0x514aa8){return function(){ChatGroupEvents['removeListener'](_0x22337d,_0x514aa8);};}exports['register']=function(_0x5b2c25){for(var _0xa49cc5=0x0,_0x1e9292=events[_0x58c9('0x5')];_0xa49cc5<_0x1e9292;_0xa49cc5++){var _0x572af8=events[_0xa49cc5];var _0x573db0=createListener(_0x58c9('0x6')+_0x572af8,_0x5b2c25);ChatGroupEvents['on'](_0x572af8,_0x573db0);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 3e880be..e58196b 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 _0xb58e=['getMessages','post','create','addMembers','addMessage','/:id','update','removeMembers','exports','util','path','Router','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','show','getUnread','/:id/members','getMembers','/:id/messages'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb58e,0x1b9));var _0xeb58=function(_0x452c64,_0x298734){_0x452c64=_0x452c64-0x0;var _0x1f40dd=_0xb58e[_0x452c64];return _0x1f40dd;};'use strict';var multer=require('multer');var util=require(_0xeb58('0x0'));var path=require(_0xeb58('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xeb58('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xeb58('0x3'));var controller=require(_0xeb58('0x4'));router[_0xeb58('0x5')]('/',auth[_0xeb58('0x6')](),controller[_0xeb58('0x7')]);router[_0xeb58('0x5')](_0xeb58('0x8'),auth[_0xeb58('0x6')](),controller[_0xeb58('0x9')]);router[_0xeb58('0x5')]('/:id',auth[_0xeb58('0x6')](),controller[_0xeb58('0xa')]);router[_0xeb58('0x5')]('/:id/unread',auth[_0xeb58('0x6')](),controller[_0xeb58('0xb')]);router[_0xeb58('0x5')](_0xeb58('0xc'),auth[_0xeb58('0x6')](),controller[_0xeb58('0xd')]);router[_0xeb58('0x5')](_0xeb58('0xe'),auth[_0xeb58('0x6')](),controller[_0xeb58('0xf')]);router[_0xeb58('0x10')]('/',auth['isAuthenticated'](),controller[_0xeb58('0x11')]);router[_0xeb58('0x10')](_0xeb58('0xc'),auth[_0xeb58('0x6')](),controller[_0xeb58('0x12')]);router['post'](_0xeb58('0xe'),auth[_0xeb58('0x6')](),controller[_0xeb58('0x13')]);router['put'](_0xeb58('0x14'),auth[_0xeb58('0x6')](),controller[_0xeb58('0x15')]);router['delete'](_0xeb58('0x14'),auth[_0xeb58('0x6')](),controller['destroy']);router['delete'](_0xeb58('0xc'),auth[_0xeb58('0x6')](),controller[_0xeb58('0x16')]);module[_0xeb58('0x17')]=router; \ No newline at end of file +var _0xd75f=['removeMembers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/unread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','put','update','delete','destroy'];(function(_0x49e287,_0x2a474f){var _0x30ccab=function(_0x3e1166){while(--_0x3e1166){_0x49e287['push'](_0x49e287['shift']());}};_0x30ccab(++_0x2a474f);}(_0xd75f,0x188));var _0xfd75=function(_0x464cf1,_0x240918){_0x464cf1=_0x464cf1-0x0;var _0x222a65=_0xd75f[_0x464cf1];return _0x222a65;};'use strict';var multer=require(_0xfd75('0x0'));var util=require(_0xfd75('0x1'));var path=require(_0xfd75('0x2'));var timeout=require(_0xfd75('0x3'));var express=require(_0xfd75('0x4'));var router=express[_0xfd75('0x5')]();var auth=require(_0xfd75('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfd75('0x7'));var controller=require(_0xfd75('0x8'));router[_0xfd75('0x9')]('/',auth[_0xfd75('0xa')](),controller[_0xfd75('0xb')]);router[_0xfd75('0x9')](_0xfd75('0xc'),auth[_0xfd75('0xa')](),controller['describe']);router[_0xfd75('0x9')](_0xfd75('0xd'),auth['isAuthenticated'](),controller[_0xfd75('0xe')]);router[_0xfd75('0x9')](_0xfd75('0xf'),auth[_0xfd75('0xa')](),controller['getUnread']);router[_0xfd75('0x9')](_0xfd75('0x10'),auth[_0xfd75('0xa')](),controller[_0xfd75('0x11')]);router[_0xfd75('0x9')](_0xfd75('0x12'),auth[_0xfd75('0xa')](),controller[_0xfd75('0x13')]);router[_0xfd75('0x14')]('/',auth[_0xfd75('0xa')](),controller[_0xfd75('0x15')]);router[_0xfd75('0x14')]('/:id/members',auth[_0xfd75('0xa')](),controller[_0xfd75('0x16')]);router[_0xfd75('0x14')]('/:id/messages',auth[_0xfd75('0xa')](),controller[_0xfd75('0x17')]);router[_0xfd75('0x18')](_0xfd75('0xd'),auth[_0xfd75('0xa')](),controller[_0xfd75('0x19')]);router[_0xfd75('0x1a')](_0xfd75('0xd'),auth[_0xfd75('0xa')](),controller[_0xfd75('0x1b')]);router['delete']('/:id/members',auth[_0xfd75('0xa')](),controller[_0xfd75('0x1c')]);module[_0xfd75('0x1d')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 7bae8eb..78cea69 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 _0xfb78=['STRING','DATE','out','sequelize','ENUM','star','TEXT'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xfb78,0x14c));var _0x8fb7=function(_0x4d7a61,_0x3fb6e6){_0x4d7a61=_0x4d7a61-0x0;var _0x186f73=_0xfb78[_0x4d7a61];return _0x186f73;};'use strict';var Sequelize=require(_0x8fb7('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x8fb7('0x1')](_0x8fb7('0x2'),'thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x8fb7('0x3')]},'pathTranscript':{'type':Sequelize[_0x8fb7('0x3')]},'mailTranscript':{'type':Sequelize[_0x8fb7('0x4')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x8fb7('0x5')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8fb7('0x4')]},'browserName':{'type':Sequelize[_0x8fb7('0x4')]},'browserVersion':{'type':Sequelize[_0x8fb7('0x4')]},'osName':{'type':Sequelize[_0x8fb7('0x4')]},'osVersion':{'type':Sequelize[_0x8fb7('0x4')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x8fb7('0x4')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x8fb7('0x3')]},'customerIp':{'type':Sequelize[_0x8fb7('0x4')]},'formData':{'type':Sequelize['TEXT']('long')},'read1stAt':{'type':Sequelize[_0x8fb7('0x5')]},'lastMsgAt':{'type':Sequelize[_0x8fb7('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x8fb7('0x1')]('in',_0x8fb7('0x6')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x8fb7('0x4')]},'customerPort':{'type':Sequelize[_0x8fb7('0x4')]},'vidaooSessionId':{'type':Sequelize[_0x8fb7('0x3')]}}; \ No newline at end of file +var _0x62ce=['TEXT','DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN','thumb','star'];(function(_0x2ab10e,_0x2f7096){var _0x19b396=function(_0xf5d220){while(--_0xf5d220){_0x2ab10e['push'](_0x2ab10e['shift']());}};_0x19b396(++_0x2f7096);}(_0x62ce,0x11d));var _0xe62c=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x62ce[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xe62c('0x0'));module[_0xe62c('0x1')]={'closed':{'type':Sequelize[_0xe62c('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM']('star',_0xe62c('0x3')),'defaultValue':_0xe62c('0x4')},'ratingMessage':{'type':Sequelize[_0xe62c('0x5')]},'pathTranscript':{'type':Sequelize[_0xe62c('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xe62c('0x6')]},'disposition':{'type':Sequelize[_0xe62c('0x7')]},'note':{'type':Sequelize[_0xe62c('0x7')]},'browserName':{'type':Sequelize[_0xe62c('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xe62c('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xe62c('0x7')]},'formData':{'type':Sequelize['TEXT']('long')},'read1stAt':{'type':Sequelize[_0xe62c('0x6')]},'lastMsgAt':{'type':Sequelize[_0xe62c('0x6')]},'lastMsgDirection':{'type':Sequelize[_0xe62c('0x8')]('in',_0xe62c('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xe62c('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index f4271d8..ba4ce6c 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 _0x77e6=['params','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','AbandonInteraction','attachmentUpload','originalname','basename','file','mimetype','Attachment','attachmentDownload','Unauthorized','download','root','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailServerOut','Smtp','service','port','secure','authentication','auth','user','pass','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','ChatMessage','addMessage','omit','ids','getMessages','sort','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','rows','addTags','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','join','files','tmp','server','attachments','firstName','lastName','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','%s\x20#%d','Chat','YYYY-MM-DD','Account','Owner','N.A.','closedAt','disposition','browserName','referer','customerPort','tail','existsSync','createReadStream','pipe','renderFile','views','downloadInteraction.html','toFile','transcript-','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','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','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','fullname','TagIds','Tags','forEach','push','index','map','ChatInteraction','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','select','field','color','from','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','UserId','body','some','compact','isEmpty','ChatWebsiteId','where','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','keyBy','merge','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','groupBy','ChatInteractionId','all','includeAll','include','options','create'];(function(_0x2dca77,_0x127124){var _0x55e7fb=function(_0x51278b){while(--_0x51278b){_0x2dca77['push'](_0x2dca77['shift']());}};_0x55e7fb(++_0x127124);}(_0x77e6,0x1a6));var _0x677e=function(_0x360f5a,_0x340703){_0x360f5a=_0x360f5a-0x0;var _0x4963e0=_0x77e6[_0x360f5a];return _0x4963e0;};'use strict';var pdf=require(_0x677e('0x0'));var emlformat=require(_0x677e('0x1'));var rimraf=require(_0x677e('0x2'));var zipdir=require(_0x677e('0x3'));var jsonpatch=require(_0x677e('0x4'));var rp=require(_0x677e('0x5'));var moment=require(_0x677e('0x6'));var BPromise=require(_0x677e('0x7'));var Mustache=require('mustache');var util=require(_0x677e('0x8'));var path=require(_0x677e('0x9'));var sox=require('sox');var csv=require(_0x677e('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x677e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x677e('0xc'));var deskjs=require(_0x677e('0xd'));var toCsv=require(_0x677e('0xa'));var querystring=require(_0x677e('0xe'));var Papa=require('papaparse');var Redis=require(_0x677e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x677e('0x10'));var as=require(_0x677e('0x11'));var hardwareService=require(_0x677e('0x12'));var logger=require(_0x677e('0x13'))(_0x677e('0x14'));var utils=require(_0x677e('0x15'));var config=require(_0x677e('0x16'));var db=require(_0x677e('0x17'))['db'];config[_0x677e('0x18')]=_[_0x677e('0x19')](config[_0x677e('0x18')],{'host':_0x677e('0x1a'),'port':0x18eb});var socket=require(_0x677e('0x1b'))(new Redis(config[_0x677e('0x18')]));require('./chatInteraction.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x677e('0x1c')][_0x677e('0x1d')]({'port':0x232b});var client9004=jayson[_0x677e('0x1c')][_0x677e('0x1d')]({'port':0x232c});function checkPasswordPattern(_0x4daa04,_0x42d0c3,_0x24c9eb){if(_0x24c9eb){var _0xe88242=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xe88242[_0x677e('0x1e')](_0x42d0c3)){return _0x4daa04;}else{throw new db[(_0x677e('0x1f'))][(_0x677e('0x20'))](_0x677e('0x21'));}}else{return _0x4daa04;}}function respondWithRpcPromise(_0x49d428,_0x1c5124,_0x2ef2bf,_0x385b06){return new BPromise(function(_0x221b6d,_0xba1c26){var _0x29e853=_0x385b06||client;return _0x29e853['request'](_0x49d428,_0x2ef2bf)[_0x677e('0x22')](function(_0x4bfbb6){logger[_0x677e('0x23')](_0x677e('0x24'),_0x1c5124,_0x677e('0x25'));logger['debug'](_0x677e('0x26'),_0x1c5124,_0x677e('0x25'),JSON[_0x677e('0x27')](_0x4bfbb6));if(_0x4bfbb6[_0x677e('0x28')]){if(_0x4bfbb6[_0x677e('0x28')][_0x677e('0x29')]===0x1f4){logger[_0x677e('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x1c5124,_0x4bfbb6['error']['message']);return _0xba1c26(_0x4bfbb6[_0x677e('0x28')][_0x677e('0x2a')]);}logger[_0x677e('0x28')](_0x677e('0x24'),_0x1c5124,_0x4bfbb6[_0x677e('0x28')][_0x677e('0x2a')]);return _0x221b6d(_0x4bfbb6[_0x677e('0x28')][_0x677e('0x2a')]);}else{logger[_0x677e('0x23')](_0x677e('0x24'),_0x1c5124,'request\x20sent');_0x221b6d(_0x4bfbb6['result'][_0x677e('0x2a')]);}})[_0x677e('0x2b')](function(_0x4d9e0b){logger[_0x677e('0x28')](_0x677e('0x24'),_0x1c5124,_0x4d9e0b);_0xba1c26(_0x4d9e0b);});});}function respondWithStatusCode(_0xf6b3ad,_0x33e946){_0x33e946=_0x33e946||0xcc;return function(_0x21a26b){if(_0x21a26b){return _0xf6b3ad[_0x677e('0x2c')](_0x33e946);}return _0xf6b3ad['status'](_0x33e946)[_0x677e('0x2d')]();};}function respondWithResult(_0x2a6033,_0xeca8e2){_0xeca8e2=_0xeca8e2||0xc8;return function(_0x1e2694){if(_0x1e2694){return _0x2a6033[_0x677e('0x2e')](_0xeca8e2)[_0x677e('0x2f')](_0x1e2694);}};}function respondWithFilteredResult(_0x9179a0,_0x10eb66){return function(_0x9d49b5){if(_0x9d49b5){var _0x4c5113=_0x9d49b5[_0x677e('0x30')],_0x22ccfb=_0x10eb66[_0x677e('0x31')],_0x3cac19=_0x10eb66[_0x677e('0x31')]+_0x10eb66[_0x677e('0x32')],_0x2fb815;if(_0x3cac19>=_0x4c5113){_0x3cac19=_0x4c5113;_0x2fb815=0xc8;}else{_0x2fb815=0xce;}_0x9179a0[_0x677e('0x2e')](_0x2fb815);return _0x9179a0[_0x677e('0x33')](_0x677e('0x34'),_0x22ccfb+'-'+_0x3cac19+'/'+_0x4c5113)['json'](_0x9d49b5);}return null;};}function patchUpdates(_0xcaae21){return function(_0x34cdb3){try{jsonpatch[_0x677e('0x35')](_0x34cdb3,_0xcaae21,!![]);}catch(_0x2570b9){return BPromise[_0x677e('0x36')](_0x2570b9);}return _0x34cdb3[_0x677e('0x37')]();};}function saveUpdates(_0x5d7b29,_0x1a4ca1){return function(_0x3a2071){if(_0x3a2071){return _0x3a2071[_0x677e('0x38')](_0x5d7b29)['then'](function(_0x13a02f){return _0x13a02f;});}return null;};}function removeEntity(_0xd729da,_0x2004bb){return function(_0x4fccc4){if(_0x4fccc4){return _0x4fccc4[_0x677e('0x39')]()['then'](function(){_0xd729da[_0x677e('0x2e')](0xcc)[_0x677e('0x2d')]();});}};}function handleEntityNotFound(_0x3514d6,_0x1fc871){return function(_0x548b22){if(!_0x548b22){_0x3514d6[_0x677e('0x2c')](0x194);}return _0x548b22;};}function handleError(_0x1dfbd3,_0x2e2302){_0x2e2302=_0x2e2302||0x1f4;return function(_0x576443){logger['error'](_0x576443[_0x677e('0x3a')]);if(_0x576443[_0x677e('0x3b')]){delete _0x576443['name'];}_0x1dfbd3[_0x677e('0x2e')](_0x2e2302)[_0x677e('0x3c')](_0x576443);};}function getInteractionUsers(_0x497dca,_0x5a6dcc){return new BPromise(function(_0x463606,_0x4505f5){try{if(_0x5a6dcc[_0x497dca['id']]){_0x497dca['Users']=_['map'](_0x5a6dcc[_0x497dca['id']],function(_0x42ce2c){return{'id':_0x42ce2c['id'],'fullname':_0x42ce2c[_0x677e('0x3d')]};});}}catch(_0x1c70ec){_0x4505f5(_0x1c70ec);}_0x463606(_0x497dca);});}function getInteractionTags(_0x5bb080,_0x3008c5){return new BPromise(function(_0x39f5d6,_0x38db14){try{if(_0x5bb080[_0x677e('0x3e')]){_0x5bb080[_0x677e('0x3f')]=[];_0x5bb080['TagIds']['split'](',')[_0x677e('0x40')](function(_0x40238e){_0x5bb080[_0x677e('0x3f')][_0x677e('0x41')](_0x3008c5[_0x40238e]);});}delete _0x5bb080[_0x677e('0x3e')];}catch(_0x2f8ebb){_0x38db14(_0x2f8ebb);}_0x39f5d6(_0x5bb080);});}function updateChatInteraction(_0x1b9a35,_0x149039,_0x78202e){return new BPromise(function(_0x270867,_0x52a36c){return getInteractionUsers(_0x1b9a35,_0x78202e)['then'](function(_0x2ee698){return getInteractionTags(_0x2ee698,_0x149039);})[_0x677e('0x22')](function(_0x5abab2){_0x270867(_0x5abab2);})[_0x677e('0x2b')](function(_0x511125){_0x52a36c(_0x511125);});});}exports[_0x677e('0x42')]=function(_0x29b9c0,_0x283aaa){var _0xe16ced={},_0x141f80={},_0x1a34d8={'count':0x0,'rows':[]};var _0x4a9824=_[_0x677e('0x43')](db[_0x677e('0x44')][_0x677e('0x45')],function(_0x33fce2){return{'name':_0x33fce2[_0x677e('0x46')],'type':_0x33fce2[_0x677e('0x47')]['key']};});_0x141f80[_0x677e('0x48')]=_['map'](_0x4a9824,_0x677e('0x3b'));_0x141f80[_0x677e('0x49')]=_[_0x677e('0x4a')](_0x29b9c0[_0x677e('0x49')]);_0x141f80[_0x677e('0x4b')]=_[_0x677e('0x4c')](_0x141f80[_0x677e('0x48')],_0x141f80[_0x677e('0x49')]);_0xe16ced[_0x677e('0x4d')]=_[_0x677e('0x4c')](_0x141f80['model'],qs[_0x677e('0x4e')](_0x29b9c0['query']['fields']));_0xe16ced[_0x677e('0x4d')]=_0xe16ced[_0x677e('0x4d')][_0x677e('0x4f')]?_0xe16ced[_0x677e('0x4d')]:_0x141f80[_0x677e('0x48')];if(!_0x29b9c0['query'][_0x677e('0x50')](_0x677e('0x51'))){_0xe16ced[_0x677e('0x32')]=qs[_0x677e('0x32')](_0x29b9c0[_0x677e('0x49')]['limit']);_0xe16ced[_0x677e('0x31')]=qs[_0x677e('0x31')](_0x29b9c0[_0x677e('0x49')]['offset']);}_0xe16ced[_0x677e('0x52')]=qs['sort'](_0x29b9c0[_0x677e('0x49')]['sort']);_0xe16ced['where']=qs[_0x677e('0x4b')](_[_0x677e('0x53')](_0x29b9c0[_0x677e('0x49')],_0x141f80[_0x677e('0x4b')]),_0x4a9824);var _0x5d8c27=[];var _0x210f46=squel[_0x677e('0x54')]()['field']('id')[_0x677e('0x55')](_0x677e('0x3b'))[_0x677e('0x55')](_0x677e('0x56'))[_0x677e('0x57')]('tools_tags');var _0x474cf6=squel['select']()['field'](_0x677e('0x58'))['field'](_0x677e('0x59'))[_0x677e('0x55')](_0x677e('0x5a'))[_0x677e('0x57')](_0x677e('0x5b'),'ui')[_0x677e('0x5c')](_0x677e('0x5d'),'u','u.id\x20=\x20ui.UserId');var _0x50913b=squel['select']()[_0x677e('0x57')](_0x677e('0x5e'),'i')[_0x677e('0x5c')](_0x677e('0x5f'),'c',_0x677e('0x60'))[_0x677e('0x5c')]('users','o',_0x677e('0x61'))[_0x677e('0x5c')]('chat_websites','a',_0x677e('0x62'))['left_join'](_0x677e('0x63'),'me',_0x677e('0x64'))[_0x677e('0x5c')](_0x677e('0x65'),'it','it.ChatInteractionId\x20=\x20i.id')[_0x677e('0x5c')]('tools_tags','t',_0x677e('0x66'));var _0x16caaa=squel[_0x677e('0x67')]();var _0x1c6f18=[];var _0x551523=squel['expr']();var _0x4ed131;if(_0x29b9c0[_0x677e('0x49')][_0x677e('0x68')]){_0x4ed131=as['parseSearch'](_0x29b9c0[_0x677e('0x49')][_0x677e('0x68')]);var _0xaa218d=_0x4ed131[_0x677e('0x69')];for(var _0x35c3b7=0x0;_0x35c3b7<_0x4ed131[_0x677e('0x6a')]['length'];_0x35c3b7++){var _0x10fdf6=_0x4ed131['conditions'][_0x35c3b7];var _0x4c48a4='i';var _0x38b717=_['find'](_0x4a9824,['name',_0x10fdf6[_0x677e('0x55')]]);if(!_0x38b717){switch(_0x10fdf6['field']){case _0x677e('0x6b'):if(_0x10fdf6[_0x677e('0x6c')]==0x1){_0x50913b['having']('`'+_0x10fdf6[_0x677e('0x55')]+_0x677e('0x6d'));}else{_0x50913b[_0x677e('0x6e')]('`'+_0x10fdf6[_0x677e('0x55')]+_0x677e('0x6f'));}break;case _0x677e('0x70'):if(_0x10fdf6['operator']===_0x677e('0x71')){if(_0x10fdf6[_0x677e('0x6c')][_0x677e('0x72')]('\x20')['length']>0x1){_0x16caaa[_0xaa218d](_0x677e('0x73'),qs[_0x677e('0x74')](_0x10fdf6[_0x677e('0x6c')]),null);}else{var _0x223dd6='%'+_0x10fdf6[_0x677e('0x6c')]+'%';_0x16caaa[_0xaa218d](_0x677e('0x75'),_0x223dd6,_0x223dd6,_0x223dd6);}}else{_0x38b717=_[_0x677e('0x76')](_0x4a9824,[_0x677e('0x3b'),'ContactId']);_0x10fdf6[_0x677e('0x55')]=_0x677e('0x77');_0x49c583=as[_0x677e('0x78')](_0x4c48a4,_0x38b717[_0x677e('0x47')],_0x10fdf6);_0x16caaa[_0xaa218d](_0x49c583[_0x677e('0x79')],_0x49c583['value'][_0x677e('0x7a')],_0x49c583[_0x677e('0x6c')][_0x677e('0x2d')]);}break;case _0x677e('0x7b'):var _0x5b5d34=_0x10fdf6[_0x677e('0x6c')][_0x677e('0x72')](',')[_0x677e('0x43')](function(_0x3a37aa){return Number(_0x3a37aa);});_0x5b5d34[_0x677e('0x40')](function(_0x18c92c){_0x551523['or'](_0x677e('0x7c'),'%,'+_0x18c92c+',%');});_0x1c6f18=_[_0x677e('0x7d')](_0x1c6f18,_0x5b5d34);break;case _0x677e('0x7e'):if(_0x10fdf6[_0x677e('0x7f')]===_0x677e('0x71')){_0x16caaa[_0xaa218d]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x10fdf6['value']+'%',null);}else{_0x38b717=_[_0x677e('0x76')](_0x4a9824,[_0x677e('0x3b'),_0x677e('0x80')]);_0x10fdf6[_0x677e('0x55')]=_0x677e('0x80');_0x49c583=as[_0x677e('0x78')](_0x4c48a4,_0x38b717['type'],_0x10fdf6);_0x16caaa[_0xaa218d](_0x49c583[_0x677e('0x79')],_0x49c583[_0x677e('0x6c')][_0x677e('0x7a')],_0x49c583[_0x677e('0x6c')][_0x677e('0x2d')]);}break;case _0x677e('0x81'):_0x49c583=as['buildExpression']('me',null,_0x10fdf6);_0x16caaa[_0xaa218d](_0x49c583[_0x677e('0x79')],_0x49c583['value']['start'],_0x49c583[_0x677e('0x6c')]['end']);break;}}else{var _0x49c583=as['buildExpression'](_0x4c48a4,_0x38b717['type'],_0x10fdf6);_0x16caaa[_0xaa218d](_0x49c583[_0x677e('0x79')],_0x49c583['value'][_0x677e('0x7a')],_0x49c583[_0x677e('0x6c')]['end']);}}}else{var _0x380281=_(_0x29b9c0[_0x677e('0x49')])[_0x677e('0x4a')]()[_0x677e('0x43')](function(_0x121a2c){return _[_0x677e('0x82')](_0x4a9824,['name',_0x121a2c])?_0x121a2c:undefined;})[_0x677e('0x83')]()['value']();if(!_[_0x677e('0x84')](_0x380281)){_0x380281['forEach'](function(_0x18fa9f){if(_0x18fa9f===_0x677e('0x85')){_0x50913b[_0x677e('0x86')]('i.ChatWebsiteId\x20IN\x20?',[]['concat'](_0x29b9c0['query'][_0x18fa9f]));}else if(_0x18fa9f==='createdAt'){var _0x1b4080=JSON[_0x677e('0x87')](_0x29b9c0[_0x677e('0x49')][_0x18fa9f])[_0x677e('0x88')];var _0xff9fdf=JSON[_0x677e('0x87')](_0x29b9c0[_0x677e('0x49')][_0x18fa9f])[_0x677e('0x89')];_0x50913b[_0x677e('0x86')](_0x677e('0x8a'),_0x1b4080,_0xff9fdf);}else{if(_0x29b9c0[_0x677e('0x49')][_0x18fa9f]==='null'){_0x50913b[_0x677e('0x86')]('i.'+_0x18fa9f+_0x677e('0x8b'));}else{_0x50913b['where']('i.'+_0x18fa9f+_0x677e('0x8c'),_0x29b9c0[_0x677e('0x49')][_0x18fa9f]);}}});}if(_0x29b9c0[_0x677e('0x49')][_0x677e('0x8d')]){if(_0x29b9c0[_0x677e('0x49')][_0x677e('0x8d')]==0x1){_0x50913b[_0x677e('0x6e')](_0x677e('0x8e'));}else{_0x50913b[_0x677e('0x6e')]('`unreadMessages`\x20>\x200');}}if(_0x29b9c0['query'][_0x677e('0x8f')]){_0x1c6f18=_[_0x677e('0x90')](_0x29b9c0[_0x677e('0x49')][_0x677e('0x8f')])?_0x29b9c0['query'][_0x677e('0x8f')]:new Array(_0x29b9c0[_0x677e('0x49')][_0x677e('0x8f')]);_0x1c6f18['forEach'](function(_0x53e6f5){_0x551523['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x53e6f5+',%');});}if(_0x29b9c0[_0x677e('0x49')][_0x677e('0x91')]){var _0x4cc89e=_0x29b9c0[_0x677e('0x49')][_0x677e('0x91')][_0x677e('0x92')]('\x5c','\x5c\x5c')[_0x677e('0x92')]('\x27\x27','\x27\x27\x27\x27');if(qs['isNumeric'](_0x4cc89e)){_0x16caaa['or'](_0x677e('0x93'),_0x4cc89e+'%');}else{_0x16caaa['or'](_0x677e('0x94'),qs[_0x677e('0x74')](_0x4cc89e))['or'](_0x677e('0x95'),_0x4cc89e+'%');}}}_0x50913b['where'](_0x16caaa);_0x50913b['group']('i.id');var _0x3c2ba0={'type':db[_0x677e('0x1f')]['QueryTypes']['SELECT'],'raw':!![]};var _0x2598fc=_0x50913b['clone']();_0x2598fc['field'](_0x677e('0x96'));_0x2598fc[_0x677e('0x55')](_0x677e('0x97'),_0x677e('0x6b'));if(_0xe16ced['order']){_0xe16ced['order']['forEach'](function(_0x2affa9){_0x50913b[_0x677e('0x52')]('i.'+_0x2affa9[0x0],_0x2affa9[0x1]===_0x677e('0x98')?![]:!![]);});}if(!_[_0x677e('0x84')](_0x1c6f18)){_0x50913b[_0x677e('0x6e')](_0x551523);_0x2598fc[_0x677e('0x86')]('t.id\x20IN\x20?',_0x1c6f18);}BPromise[_0x677e('0x99')]()['then'](function(){if(!_0x4ed131){if(_0x29b9c0['query'][_0x677e('0x85')]||_0x29b9c0[_0x677e('0x49')]['journey'])return;_0x2598fc[_0x677e('0x86')](_0x677e('0x9a'));_0x50913b[_0x677e('0x86')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}return _0x29b9c0['user'][_0x677e('0x9b')]({'attributes':['id'],'raw':!![]})['then'](function(_0x54d7e3){if(_[_0x677e('0x84')](_0x54d7e3)){_0x2598fc[_0x677e('0x86')](_0x677e('0x9c'));_0x50913b['where']('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x2598fc[_0x677e('0x86')](_0x677e('0x9d'),_[_0x677e('0x43')](_0x54d7e3,'id'));_0x50913b['where'](_0x677e('0x9d'),_[_0x677e('0x43')](_0x54d7e3,'id'));}});})['then'](function(){db[_0x677e('0x9e')]['query'](_0x2598fc[_0x677e('0x9f')](),_0x3c2ba0)[_0x677e('0x22')](function(_0x4cece2){_0x1a34d8[_0x677e('0x30')]=_0x4cece2[_0x677e('0x4f')];if(_0x1a34d8[_0x677e('0x30')]===0x0)return[];return db['sequelize']['query'](_0x210f46['toString'](),_0x3c2ba0)[_0x677e('0x22')](function(_0x46c55a){_0x5d8c27=_[_0x677e('0xa0')](_0x46c55a,'id');_0x3c2ba0=_[_0x677e('0xa1')](_0x3c2ba0,{'model':db[_0x677e('0x44')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x29b9c0[_0x677e('0x49')][_0x677e('0x4e')]){_0xe16ced[_0x677e('0x4d')][_0x677e('0x40')](function(_0x404a68){_0x50913b[_0x677e('0x55')]('i.'+_0x404a68);});}else{_0x50913b[_0x677e('0x55')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x677e('0x6b'));_0x50913b['field']('a.key','Account.key');_0x50913b[_0x677e('0x55')](_0x677e('0xa2'),_0x677e('0xa3'));_0x50913b['field'](_0x677e('0xa4'));_0x50913b[_0x677e('0x55')]('c.firstName','Contact.firstName');_0x50913b[_0x677e('0x55')]('c.lastName',_0x677e('0xa5'));_0x50913b['field'](_0x677e('0xa6'),_0x677e('0xa7'));_0x50913b['field'](_0x677e('0xa8'),_0x677e('0xa9'));_0x50913b[_0x677e('0x55')](_0x677e('0xaa'),_0x677e('0xab'));_0x50913b[_0x677e('0x55')](_0x677e('0xac'),_0x677e('0xad'));_0x50913b[_0x677e('0x55')](_0x677e('0xae'),'Owner.fullname');_0x50913b['field'](_0x677e('0xaf'),_0x677e('0xb0'));_0x50913b[_0x677e('0x55')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x677e('0x3e'));}if(_0xe16ced[_0x677e('0x32')])_0x50913b[_0x677e('0x32')](_0xe16ced[_0x677e('0x32')]);if(_0xe16ced['offset'])_0x50913b[_0x677e('0x31')](_0xe16ced[_0x677e('0x31')]);return db[_0x677e('0x9e')][_0x677e('0x49')](_0x50913b['toString'](),_0x3c2ba0);})['then'](function(_0xe70ab){_0x474cf6[_0x677e('0x86')]('ui.ChatInteractionId\x20IN\x20?',_[_0x677e('0x43')](_0xe70ab,'id'));return db[_0x677e('0x9e')][_0x677e('0x49')](_0x474cf6[_0x677e('0x9f')](),_0x3c2ba0)[_0x677e('0x22')](function(_0x35af8b){var _0x36901a=_[_0x677e('0xb1')](_0x35af8b,_0x677e('0xb2'));var _0x2b9ea3=[];_0xe70ab['forEach'](function(_0x9c194b){_0x2b9ea3[_0x677e('0x41')](updateChatInteraction(_0x9c194b,_0x5d8c27,_0x36901a));});return BPromise[_0x677e('0xb3')](_0x2b9ea3);});});})[_0x677e('0x22')](function(_0x39ab73){_0x1a34d8['rows']=_0x39ab73;return _0x1a34d8;})[_0x677e('0x22')](respondWithFilteredResult(_0x283aaa,_0xe16ced));})[_0x677e('0x2b')](handleError(_0x283aaa,null));};exports['show']=function(_0x14c447,_0x17c944){var _0x26578b={'raw':![],'where':{'id':_0x14c447['params']['id']}},_0x3bfa41={};_0x3bfa41[_0x677e('0x48')]=_[_0x677e('0x4a')](db['ChatInteraction'][_0x677e('0x45')]);_0x3bfa41[_0x677e('0x49')]=_[_0x677e('0x4a')](_0x14c447[_0x677e('0x49')]);_0x3bfa41[_0x677e('0x4b')]=_['intersection'](_0x3bfa41[_0x677e('0x48')],_0x3bfa41[_0x677e('0x49')]);_0x26578b[_0x677e('0x4d')]=_['intersection'](_0x3bfa41[_0x677e('0x48')],qs[_0x677e('0x4e')](_0x14c447['query'][_0x677e('0x4e')]));_0x26578b[_0x677e('0x4d')]=_0x26578b['attributes'][_0x677e('0x4f')]?_0x26578b[_0x677e('0x4d')]:_0x3bfa41[_0x677e('0x48')];if(_0x14c447[_0x677e('0x49')][_0x677e('0xb4')]){_0x26578b[_0x677e('0xb5')]=[{'all':!![]}];}_0x26578b=_['merge']({},_0x26578b,_0x14c447[_0x677e('0xb6')]);return db[_0x677e('0x44')]['find'](_0x26578b)[_0x677e('0x22')](handleEntityNotFound(_0x17c944,null))['then'](respondWithResult(_0x17c944,null))['catch'](handleError(_0x17c944,null));};exports['create']=function(_0x1438f2,_0x2b7e56){return db[_0x677e('0x44')][_0x677e('0xb7')](_0x1438f2['body'],{})['then'](respondWithResult(_0x2b7e56,0xc9))[_0x677e('0x2b')](handleError(_0x2b7e56,null));};exports[_0x677e('0x38')]=function(_0x48c59e,_0x122a82){if(_0x48c59e[_0x677e('0x81')]['id']){delete _0x48c59e[_0x677e('0x81')]['id'];}return db[_0x677e('0x44')]['find']({'where':{'id':_0x48c59e[_0x677e('0xb8')]['id']}})['then'](handleEntityNotFound(_0x122a82,null))[_0x677e('0x22')](saveUpdates(_0x48c59e['body'],null))['then'](respondWithResult(_0x122a82,null))[_0x677e('0x2b')](handleError(_0x122a82,null));};exports[_0x677e('0x39')]=function(_0x23629c,_0x3b3acf){return db[_0x677e('0x44')][_0x677e('0x76')]({'where':{'id':_0x23629c[_0x677e('0xb8')]['id']}})[_0x677e('0x22')](handleEntityNotFound(_0x3b3acf,null))[_0x677e('0x22')](removeEntity(_0x3b3acf,null))['catch'](handleError(_0x3b3acf,null));};exports[_0x677e('0xb9')]=function(_0x36680e,_0x5eff3e){return db[_0x677e('0x44')]['describe']()[_0x677e('0x22')](respondWithResult(_0x5eff3e,null))[_0x677e('0x2b')](handleError(_0x5eff3e,null));};exports[_0x677e('0xba')]=function(_0x4f149a,_0x9d34f1){var _0xb76875=_0x4f149a[_0x677e('0xb8')]['id'];var _0x45fcdb;var _0x335c41;var _0x3cf834;return db[_0x677e('0x44')][_0x677e('0xbb')]({'where':{'id':_0xb76875}})[_0x677e('0x22')](function(_0x12c7f7){_0x45fcdb=_0x12c7f7;return db[_0x677e('0xbc')][_0x677e('0xbb')]({'where':{'id':_0x12c7f7[_0x677e('0x85')]},'attributes':['id',_0x677e('0xbd'),_0x677e('0xbe')],'raw':!![]});})[_0x677e('0x22')](function(_0x1ee713){if(_0x1ee713&&_0x1ee713[_0x677e('0xbd')]&&_0x1ee713['vidaooEscalation']){_0x335c41=_0x1ee713;var _0x1a2c40={'rejectUnauthorized':![],'method':_0x677e('0xbf'),'uri':_0x677e('0xc0'),'headers':{'X-APIKEY':_0x1ee713[_0x677e('0xbd')]},'body':{'name':'MotionCWB:'+_0xb76875},'redirect':'follow','json':!![]};return rp(_0x1a2c40);}else{throw new db[(_0x677e('0x1f'))][(_0x677e('0x20'))](_0x677e('0xc1'));}})[_0x677e('0x22')](function(_0x46997f){_0x3cf834=_0x46997f;if(_0x3cf834['id']){var _0x37cd36={'body':_0x3cf834[_0x677e('0xc2')],'ChatWebsiteId':_0x335c41['id'],'ChatInteractionId':_0x45fcdb['id'],'direction':_0x677e('0xc3'),'UserId':_0x4f149a['user']['id']};return db['ChatMessage'][_0x677e('0xb7')](_0x37cd36,{});}else{throw new db[(_0x677e('0x1f'))][(_0x677e('0x20'))](_0x677e('0xc4'));}})[_0x677e('0x22')](function(){return _0x45fcdb[_0x677e('0xc5')]({'vidaooSessionId':_0x3cf834['id']});})['then'](respondWithResult(_0x9d34f1,null))[_0x677e('0x2b')](handleError(_0x9d34f1,null));};exports[_0x677e('0xc6')]=function(_0x2759c0,_0x2d599a){if(_0x2759c0[_0x677e('0x81')]['id']){delete _0x2759c0[_0x677e('0x81')]['id'];}return db[_0x677e('0x44')]['find']({'where':{'id':_0x2759c0['params']['id']}})[_0x677e('0x22')](handleEntityNotFound(_0x2d599a,null))[_0x677e('0x22')](saveUpdates(_0x2759c0[_0x677e('0x81')],null))[_0x677e('0x22')](respondWithResult(_0x2d599a,null))[_0x677e('0x2b')](handleError(_0x2d599a,null));};exports[_0x677e('0xc7')]=function(_0xb75788,_0x2ecbb4,_0x72a76c){if(_0xb75788[_0x677e('0x81')]['id']){delete _0xb75788[_0x677e('0x81')]['id'];}return db['ChatInteraction'][_0x677e('0x76')]({'where':{'id':_0xb75788[_0x677e('0xb8')]['id']}})['then'](function(_0x255c72){if(!_0x255c72){logger[_0x677e('0x28')](_0x677e('0xc8'),'abandon',0x194,_0x677e('0xc9'));_0x2ecbb4[_0x677e('0x2c')](0x194);}else{if(_0x255c72[_0x677e('0x80')]){throw new db[(_0x677e('0x1f'))]['ValidationError'](_0x677e('0xca'));}}return _0x255c72;})['then'](function(_0x50e4fc){if(_0x50e4fc){return _0x50e4fc[_0x677e('0x38')]({'closed':_0xb75788[_0x677e('0x81')][_0x677e('0xcb')],'disposition':_0xb75788[_0x677e('0x81')]['disposition']})['then'](function(_0x12d83b){return _0x12d83b;});}})[_0x677e('0x22')](function(_0x48d0c8){return respondWithRpcPromise(_0x677e('0xcc'),'abandon',_0xb75788['body'],client9004);})[_0x677e('0x22')](respondWithResult(_0x2ecbb4,null))[_0x677e('0x2b')](handleError(_0x2ecbb4,null));};exports[_0x677e('0xcd')]=function(_0x4dc15b,_0x199a76,_0x1aea20){_0x4dc15b['body']['name']=_0x4dc15b['file'][_0x677e('0xce')];_0x4dc15b[_0x677e('0x81')][_0x677e('0xcf')]=_0x4dc15b['file']['filename'];_0x4dc15b[_0x677e('0x81')][_0x677e('0x47')]=_0x4dc15b[_0x677e('0xd0')][_0x677e('0xd1')];return db[_0x677e('0xd2')][_0x677e('0xb7')](_0x4dc15b[_0x677e('0x81')])[_0x677e('0x22')](respondWithResult(_0x199a76,0xc9))[_0x677e('0x2b')](handleError(_0x199a76,null));};exports[_0x677e('0xd3')]=function(_0x59099f,_0x224112,_0xdd5b02){return db[_0x677e('0x44')]['findOne']({'where':{'id':_0x59099f['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x224112,null))['then'](function(_0x4f6063){if(_0x4f6063){if(_0x4f6063[_0x677e('0xcb')]){return _0x224112[_0x677e('0x2e')](0x193)[_0x677e('0x2f')]({'status':0x193,'message':_0x677e('0xd4')});}return db['Attachment']['findOne']({'where':{'id':_0x59099f[_0x677e('0x49')]['attachId']},'raw':!![]})[_0x677e('0x22')](handleEntityNotFound(_0x224112,null));}})[_0x677e('0x22')](function(_0x450a77){if(_0x450a77){return _0x224112[_0x677e('0xd5')](path['join'](config[_0x677e('0xd6')],_0x677e('0xd7'),_0x450a77[_0x677e('0xcf')]));}})[_0x677e('0x2b')](handleError(_0x224112,null));};exports[_0x677e('0xd8')]=function(_0x2999ce,_0x26ca90){var _0x3b4d82=null;var _0x2fcfe4=null;var _0x283b93=null;var _0x578616=null;if(_0x2999ce['body']['id']){delete _0x2999ce['body']['id'];}if(_0x2999ce[_0x677e('0x81')][_0x677e('0xd9')]){_0x578616=path['join'](config['root'],_0x677e('0xda'),util[_0x677e('0xdb')](_0x677e('0xdc'),Date[_0x677e('0xdd')]()));_0x2999ce['body']['pathTranscript']=_0x578616;}return db[_0x677e('0x44')][_0x677e('0x76')]({'where':{'id':_0x2999ce[_0x677e('0xb8')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0x677e('0x7e')],'as':_0x677e('0x7e')}]}]})[_0x677e('0x22')](handleEntityNotFound(_0x26ca90,null))[_0x677e('0x22')](saveUpdates(_0x2999ce[_0x677e('0x81')],null))[_0x677e('0x22')](function(_0x477754){if(_0x477754){_0x3b4d82=_0x477754;return db[_0x677e('0xbc')]['find']({'where':{'id':_0x3b4d82[_0x677e('0x85')]}});}})[_0x677e('0x22')](function(_0x2dd242){if(_0x2dd242){_0x283b93=_0x2dd242;return db['CmContact'][_0x677e('0x76')]({'where':{'id':_0x3b4d82[_0x677e('0x77')]}});}})[_0x677e('0x22')](function(_0x12cee1){if(_0x12cee1){_0x2fcfe4=_0x12cee1;if(_0x578616){var _0x2284f9=null;for(var _0x2f86f7=0x1;_0x2f86f7<_0x3b4d82[_0x677e('0xde')]['length'];++_0x2f86f7){_0x2284f9=_0x3b4d82[_0x677e('0xde')][_0x2f86f7];var _0x61aa51=_0x2284f9[_0x677e('0x80')]?util[_0x677e('0xdb')](_0x677e('0xdf'),_0x283b93[_0x677e('0xe0')],_0x2284f9[_0x677e('0x80')]):_0x677e('0xe1');var _0x134d58=_0x2999ce[_0x677e('0x81')][_0x677e('0xe2')]||util['format'](_0x677e('0xdf'),_0x677e('0xe3'),_0x2284f9[_0x677e('0x77')]);switch(_0x283b93[_0x677e('0xe4')]){case _0x677e('0xe5'):_0x61aa51=_0x2284f9['UserId']?util[_0x677e('0xdb')](_0x677e('0xdf'),_0x283b93[_0x677e('0xe0')],_0x2284f9[_0x677e('0x80')]):_0x677e('0xe1');break;case'agent_alias':_0x61aa51=_0x2284f9[_0x677e('0x80')]?_0x2284f9[_0x677e('0x7e')][_0x677e('0xe6')]||_0x2284f9[_0x677e('0x7e')][_0x677e('0x3d')]:'System';break;case _0x677e('0xe7'):_0x61aa51=_0x2284f9['UserId']?_0x2284f9['User'][_0x677e('0x3d')]:_0x677e('0xe1');break;default:_0x61aa51=_0x2284f9[_0x677e('0x80')]?util['format'](_0x677e('0xdf'),_0x283b93['agentAlias'],_0x2284f9[_0x677e('0x80')]):_0x677e('0xe1');}var _0x328b00=util[_0x677e('0xdb')](_0x677e('0xe8'),moment(_0x2284f9[_0x677e('0xe9')])[_0x677e('0xdb')](_0x677e('0xea')),_0x2284f9[_0x677e('0xeb')]==='in'?_0x134d58:_0x61aa51,_0x2284f9[_0x677e('0x81')]);if(!_0x2284f9[_0x677e('0xec')]){fs[_0x677e('0xed')](_0x578616,_0x328b00);}}return db['MailAccount'][_0x677e('0xbb')]({'where':{'service':!![]},'include':[{'model':db[_0x677e('0xee')],'as':_0x677e('0xef'),'raw':!![]}]});}}})['then'](function(_0x50690f){if(_0x50690f&&_0x50690f[_0x677e('0xef')]&&_0x2999ce[_0x677e('0x81')]){var _0x24dc91={'tls':{'rejectUnauthorized':![]}};if(_0x50690f[_0x677e('0xef')][_0x677e('0xf0')]){_0x24dc91['service']=_0x50690f['Smtp']['service'];}else{_0x24dc91['host']=_0x50690f['Smtp']['host'];_0x24dc91[_0x677e('0xf1')]=_0x50690f[_0x677e('0xef')]['port'];_0x24dc91[_0x677e('0xf2')]=_0x50690f[_0x677e('0xef')][_0x677e('0xf2')];}if(_0x50690f['Smtp'][_0x677e('0xf3')]){_0x24dc91[_0x677e('0xf4')]={'user':_0x50690f[_0x677e('0xef')][_0x677e('0xf5')],'pass':_0x50690f['Smtp'][_0x677e('0xf6')]};}return respondWithRpcPromise('SendMail',_0x677e('0xf7'),{'account':_0x24dc91,'message':{'from':util[_0x677e('0xdb')](_0x677e('0xf8'),_0x50690f[_0x677e('0x3b')],_0x50690f['email']||_0x50690f[_0x677e('0xef')][_0x677e('0xf5')]),'to':_0x2999ce[_0x677e('0x81')][_0x677e('0xd9')],'subject':_0x677e('0xf9'),'text':util[_0x677e('0xdb')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x2999ce['body'][_0x677e('0xd9')]),'attachments':[{'path':_0x578616}]}})[_0x677e('0x22')](function(){return _0x3b4d82;})[_0x677e('0x2b')](function(_0x1f094d){console[_0x677e('0x28')](_0x1f094d);});}else{return _0x3b4d82;}})[_0x677e('0x22')](respondWithStatusCode(_0x26ca90,0xc8))[_0x677e('0x2b')](handleError(_0x26ca90,null));};exports['addMessage']=function(_0x2bd1d1,_0x53b233,_0x5ee416){return db[_0x677e('0xfa')][_0x677e('0x76')]({'where':{'id':_0x2bd1d1[_0x677e('0xb8')]['id']}})[_0x677e('0x22')](handleEntityNotFound(_0x53b233,null))[_0x677e('0x22')](function(_0x465254){if(_0x465254){return _0x465254[_0x677e('0xfb')](_0x2bd1d1[_0x677e('0x81')]['ids'],_[_0x677e('0xfc')](_0x2bd1d1[_0x677e('0x81')],[_0x677e('0xfd'),'id'])||{});}})[_0x677e('0x22')](respondWithResult(_0x53b233,null))[_0x677e('0x2b')](handleError(_0x53b233,null));};exports[_0x677e('0xfe')]=function(_0x51a898,_0x1623e6,_0x1551a7){var _0x41957b={'raw':![],'where':{}};var _0x55b4cc={};var _0x3a917c={'count':0x0,'rows':[]};return db[_0x677e('0x44')][_0x677e('0xbb')]({'where':{'id':_0x51a898[_0x677e('0xb8')]['id']}})[_0x677e('0x22')](handleEntityNotFound(_0x1623e6,null))[_0x677e('0x22')](function(_0x4ccd54){if(_0x4ccd54){_0x55b4cc[_0x677e('0x48')]=_[_0x677e('0x4a')](db[_0x677e('0xfa')][_0x677e('0x45')]);_0x55b4cc[_0x677e('0x49')]=_[_0x677e('0x4a')](_0x51a898[_0x677e('0x49')]);_0x55b4cc['filters']=_[_0x677e('0x4c')](_0x55b4cc[_0x677e('0x48')],_0x55b4cc['query']);_0x41957b[_0x677e('0x4d')]=_[_0x677e('0x4c')](_0x55b4cc[_0x677e('0x48')],qs[_0x677e('0x4e')](_0x51a898[_0x677e('0x49')]['fields']));_0x41957b[_0x677e('0x4d')]=_0x41957b[_0x677e('0x4d')]['length']?_0x41957b[_0x677e('0x4d')]:_0x55b4cc['model'];if(!_0x51a898[_0x677e('0x49')][_0x677e('0x50')]('nolimit')){_0x41957b[_0x677e('0x32')]=qs[_0x677e('0x32')](_0x51a898[_0x677e('0x49')]['limit']);_0x41957b[_0x677e('0x31')]=qs[_0x677e('0x31')](_0x51a898[_0x677e('0x49')][_0x677e('0x31')]);}_0x41957b['order']=qs[_0x677e('0xff')](_0x51a898[_0x677e('0x49')][_0x677e('0xff')]);_0x41957b[_0x677e('0x86')]=qs[_0x677e('0x4b')](_[_0x677e('0x53')](_0x51a898[_0x677e('0x49')],_0x55b4cc['filters']));_0x41957b[_0x677e('0x86')][_0x677e('0xb2')]=_0x4ccd54['id'];if(_0x51a898[_0x677e('0x49')][_0x677e('0x91')]){_0x41957b[_0x677e('0x86')]=_[_0x677e('0xa1')](_0x41957b['where'],{'$or':_[_0x677e('0x43')](_0x41957b[_0x677e('0x4d')],function(_0x527c25){var _0x4da318={};_0x4da318[_0x527c25]={'$like':'%'+_0x51a898[_0x677e('0x49')][_0x677e('0x91')]+'%'};return _0x4da318;})});}if(_0x51a898['query'][_0x677e('0x88')]){var _0x4796a2=_0x51a898[_0x677e('0x49')][_0x677e('0x88')][_0x677e('0x72')](',');var _0x252319={};_0x252319[_0x4796a2[0x0]]={'$gte':moment(_0x4796a2[0x1])['format'](_0x677e('0x100'))};_0x41957b[_0x677e('0x86')]=_[_0x677e('0xa1')](_0x41957b[_0x677e('0x86')],_0x252319);}_0x41957b=_['merge']({},_0x41957b,_0x51a898['options']);return db['ChatMessage'][_0x677e('0x30')]({'where':_0x41957b[_0x677e('0x86')]})[_0x677e('0x22')](function(_0xe1f650){_0x3a917c[_0x677e('0x30')]=_0xe1f650;if(_0x51a898[_0x677e('0x49')][_0x677e('0xb4')]){_0x41957b[_0x677e('0xb5')]=[{'all':!![]}];}return db[_0x677e('0xfa')][_0x677e('0x101')](_0x41957b);})[_0x677e('0x22')](function(_0x2cd39c){_0x3a917c['rows']=_0x2cd39c;return _0x3a917c;});}})[_0x677e('0x22')](respondWithFilteredResult(_0x1623e6,_0x41957b))[_0x677e('0x2b')](handleError(_0x1623e6,null));};exports[_0x677e('0x102')]=function(_0x2f6bc7,_0x369e68,_0x4564a2){var _0xedfdc0={'where':{}},_0xd185ec={},_0x16f78f={'count':0x0,'rows':[]};return db[_0x677e('0x44')]['findOne']({'where':{'id':_0x2f6bc7['params']['id']}})[_0x677e('0x22')](handleEntityNotFound(_0x369e68,null))[_0x677e('0x22')](function(_0x991bca){if(_0x991bca){_0xd185ec['model']=_[_0x677e('0x4a')](db[_0x677e('0xfa')][_0x677e('0x45')]);_0xd185ec[_0x677e('0x49')]=_[_0x677e('0x4a')](_0x2f6bc7[_0x677e('0x49')]);_0xd185ec[_0x677e('0x4b')]=_[_0x677e('0x4c')](_0xd185ec[_0x677e('0x48')],_0xd185ec[_0x677e('0x49')]);_0xedfdc0[_0x677e('0x4d')]=_['intersection'](_0xd185ec[_0x677e('0x48')],qs[_0x677e('0x4e')](_0x2f6bc7[_0x677e('0x49')][_0x677e('0x4e')]));_0xedfdc0[_0x677e('0x4d')]=_0xedfdc0[_0x677e('0x4d')][_0x677e('0x4f')]?_0xedfdc0[_0x677e('0x4d')]:_0xd185ec[_0x677e('0x48')];if(!_0x2f6bc7['query']['hasOwnProperty'](_0x677e('0x51'))){_0xedfdc0[_0x677e('0x32')]=qs[_0x677e('0x32')](_0x2f6bc7['query']['limit']);_0xedfdc0[_0x677e('0x31')]=qs[_0x677e('0x31')](_0x2f6bc7[_0x677e('0x49')]['offset']);}_0xedfdc0['order']=qs[_0x677e('0xff')](_0x2f6bc7[_0x677e('0x49')][_0x677e('0xff')]);_0xedfdc0['where']=qs[_0x677e('0x4b')](_[_0x677e('0x53')](_0x2f6bc7[_0x677e('0x49')],_0xd185ec['filters']));_0xedfdc0[_0x677e('0x86')][_0x677e('0xb2')]=_0x991bca['id'];if(_0x2f6bc7[_0x677e('0x49')][_0x677e('0x91')]){_0xedfdc0[_0x677e('0x86')]=_[_0x677e('0xa1')](_0xedfdc0[_0x677e('0x86')],{'$or':_['map'](_0xedfdc0[_0x677e('0x4d')],function(_0x283c6e){var _0x26b63a={};_0x26b63a[_0x283c6e]={'$like':'%'+_0x2f6bc7[_0x677e('0x49')][_0x677e('0x91')]+'%'};return _0x26b63a;})});}_0xedfdc0[_0x677e('0x86')]['secret']=![];if(_0x2f6bc7[_0x677e('0x49')]['id']){_0xedfdc0[_0x677e('0x86')]['id']={'$gt':_0x2f6bc7[_0x677e('0x49')]['id']};}_0xedfdc0=_[_0x677e('0xa1')]({},_0xedfdc0,_0x2f6bc7[_0x677e('0xb6')]);return db['ChatMessage']['count']({'where':_0xedfdc0[_0x677e('0x86')]})[_0x677e('0x22')](function(_0x5e4e46){_0x16f78f['count']=_0x5e4e46;_0xedfdc0[_0x677e('0xb5')]=[];if(_0x2f6bc7[_0x677e('0x49')]['includeAgent']){_0xedfdc0[_0x677e('0xb5')][_0x677e('0x41')]({'model':db[_0x677e('0x7e')],'as':_0x677e('0x7e'),'attributes':['id','fullname',_0x677e('0xe6')]});}if(_0x2f6bc7['query'][_0x677e('0xb4')]){_0xedfdc0['include']=[{'all':!![]}];}return db[_0x677e('0xfa')][_0x677e('0x101')](_0xedfdc0);})['then'](function(_0x1e05c2){_0x16f78f[_0x677e('0x103')]=_0x1e05c2;return _0x16f78f;});}})['then'](respondWithFilteredResult(_0x369e68,_0xedfdc0))[_0x677e('0x2b')](handleError(_0x369e68,null));};exports[_0x677e('0x104')]=function(_0x1c8e60,_0x5d92b0,_0x50b2af){return db[_0x677e('0x44')]['find']({'where':{'id':_0x1c8e60[_0x677e('0xb8')]['id']}})[_0x677e('0x22')](handleEntityNotFound(_0x5d92b0,null))[_0x677e('0x22')](function(_0x3965e3){if(_0x3965e3){return _0x3965e3[_0x677e('0x105')](_0x1c8e60[_0x677e('0x81')][_0x677e('0xfd')],_[_0x677e('0xfc')](_0x1c8e60[_0x677e('0x81')],[_0x677e('0xfd'),'id'])||{})[_0x677e('0x106')](function(){return db['Tag'][_0x677e('0x101')]({'attributes':['id',_0x677e('0x3b'),_0x677e('0x56')],'where':{'id':_0x1c8e60[_0x677e('0x81')][_0x677e('0xfd')]}});})[_0x677e('0x22')](function(_0x26f775){socket[_0x677e('0x107')](_0x677e('0x108'),{'id':Number(_0x1c8e60['params']['id']),'tags':_0x26f775||[]});return{'id':Number(_0x1c8e60[_0x677e('0xb8')]['id']),'tags':_0x26f775||[]};});}})[_0x677e('0x22')](respondWithResult(_0x5d92b0,null))[_0x677e('0x2b')](handleError(_0x5d92b0,null));};exports[_0x677e('0x109')]=function(_0x6f7713,_0x1989ad,_0x3dfe46){return db[_0x677e('0x44')][_0x677e('0x76')]({'where':{'id':_0x6f7713[_0x677e('0xb8')]['id']}})[_0x677e('0x22')](handleEntityNotFound(_0x1989ad,null))[_0x677e('0x22')](function(_0x371ce8){if(_0x371ce8){return _0x371ce8[_0x677e('0x109')](_0x6f7713['query'][_0x677e('0xfd')]);}})[_0x677e('0x22')](respondWithStatusCode(_0x1989ad,null))[_0x677e('0x2b')](handleError(_0x1989ad,null));};exports['download']=function(_0x227ba4,_0x17787b){var _0x3abab9=moment()[_0x677e('0x10a')]()[_0x677e('0x9f')]();var _0x939513=path[_0x677e('0x10b')](config[_0x677e('0xd6')],'server',_0x677e('0x10c'),_0x677e('0x10d'));var _0x1d1bbb=path[_0x677e('0x10b')](config[_0x677e('0xd6')],_0x677e('0x10e'),_0x677e('0x10c'),_0x677e('0x10f'));var _0x546035=path['join'](_0x939513,_0x3abab9);var _0x4019f8=util['format']('transcript-%d-%s.zip',_0x227ba4[_0x677e('0xb8')]['id'],_0x3abab9);var _0x4858d4=path['join'](_0x939513,_0x4019f8);var _0x4b138c=[];_0x4b138c[_0x677e('0x41')]({'model':db[_0x677e('0x7e')],'as':_0x677e('0x7e'),'attributes':['id',_0x677e('0x3d')],'raw':!![]});_0x4b138c['push']({'model':db['CmContact'],'as':_0x677e('0x70'),'attributes':['id',_0x677e('0x110'),_0x677e('0x111')],'raw':!![]});if(_0x227ba4['query'][_0x677e('0x10f')]){_0x4b138c['push']({'model':db[_0x677e('0xd2')],'as':'Attachment','raw':!![]});}var _0x1a08a6=[{'model':db[_0x677e('0xfa')],'as':_0x677e('0xde'),'attributes':['id',_0x677e('0x81'),_0x677e('0xe9'),_0x677e('0xeb'),_0x677e('0xec'),'read'],'include':_0x4b138c}];_0x1a08a6[_0x677e('0x41')]({'model':db[_0x677e('0xbc')],'as':'Account','attributes':['id',_0x677e('0x3b')]});_0x1a08a6['push']({'model':db[_0x677e('0x7e')],'as':'Owner','attributes':['id','fullname']});return db['ChatInteraction'][_0x677e('0x76')]({'where':{'id':_0x227ba4[_0x677e('0xb8')]['id']},'include':_0x1a08a6})[_0x677e('0x22')](handleEntityNotFound(_0x17787b,null))[_0x677e('0x22')](function(_0x269698){if(_0x269698){var _0x44ef00=_0x269698[_0x677e('0x112')]({'plain':!![]});fs[_0x677e('0x113')](_0x546035);var _0x1eabab={'format':'A4','border':_0x677e('0x114'),'header':{'height':_0x677e('0x115'),'contents':{'first':_0x677e('0x116')}},'footer':{'height':_0x677e('0x117'),'contents':{'default':util[_0x677e('0xdb')]('\x0a\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['format'](_0x677e('0x118'),_0x677e('0x119'),_0x44ef00['id']),moment()[_0x677e('0xdb')](_0x677e('0x11a'))[_0x677e('0x9f')]())}}};var _0xe50704={'channel':_0x677e('0x119'),'account':_0x44ef00[_0x677e('0x11b')][_0x677e('0x3b')],'agent':_0x44ef00[_0x677e('0x11c')]?_0x44ef00[_0x677e('0x11c')][_0x677e('0x3d')]:_0x677e('0x11d'),'createdAt':moment(_0x44ef00[_0x677e('0xe9')])[_0x677e('0xdb')](_0x677e('0x100'))['toString'](),'closedAt':_0x44ef00[_0x677e('0xcb')]?moment(_0x44ef00[_0x677e('0x11e')])[_0x677e('0xdb')](_0x677e('0x100'))[_0x677e('0x9f')]():'','disposition':_0x44ef00[_0x677e('0x11f')],'chatInfo':{'browser':_0x44ef00[_0x677e('0x120')],'os':_0x44ef00['osName'],'referer':_0x44ef00[_0x677e('0x121')],'customerIp':_0x44ef00['customerIp'],'customerPort':_0x44ef00['customerPort']?_0x44ef00[_0x677e('0x122')]:'N.A.'},'messages':_(_0x44ef00['Messages'])[_0x677e('0x123')]()['filter']({'secret':![]})[_0x677e('0x43')](function(_0x228970){if(_0x228970['Attachment']){var _0x24d853=path[_0x677e('0x10b')](_0x1d1bbb,_0x228970[_0x677e('0xd2')][_0x677e('0xcf')]);if(fs[_0x677e('0x124')](_0x24d853)){fs[_0x677e('0x125')](_0x24d853)[_0x677e('0x126')](fs['createWriteStream'](path[_0x677e('0x10b')](_0x546035,_0x228970[_0x677e('0xd2')][_0x677e('0xcf')])));}}return{'date':moment(_0x228970[_0x677e('0xe9')])[_0x677e('0xdb')](_0x677e('0x100'))[_0x677e('0x9f')](),'sender':_0x228970['direction']===_0x677e('0xc3')?_0x228970['User']?_0x228970[_0x677e('0x7e')][_0x677e('0x3d')]:_0x677e('0xe1'):_0x228970[_0x677e('0x70')][_0x677e('0x110')]+(_0x228970['Contact']['lastName']?'\x20'+_0x228970['Contact']['lastName']:''),'body':_0x228970[_0x677e('0xd2')]?_0x228970[_0x677e('0xd2')][_0x677e('0xcf')]:_0x228970['body'],'direction':_0x228970[_0x677e('0xeb')]===_0x677e('0xc3')?'A':'C','secret':_0x228970['secret'],'read':_0x228970[_0x677e('0x8d')],'attachment':_0x228970[_0x677e('0xd2')]};})[_0x677e('0x6c')]()};return ejs[_0x677e('0x127')](path[_0x677e('0x10b')](config[_0x677e('0xd6')],_0x677e('0x10e'),_0x677e('0x128'),_0x677e('0x129')),{'interaction':_0xe50704})[_0x677e('0x22')](function(_0x53343d){return new BPromise(function(_0x784b4d,_0x1d67ce){pdf['create'](_0x53343d,_0x1eabab)[_0x677e('0x12a')](path[_0x677e('0x10b')](_0x546035,_0x677e('0x12b')+_0x44ef00['id']+'-'+_0x3abab9+'.pdf'),function(_0x48f5fa,_0x435ba5){if(_0x48f5fa)return _0x1d67ce(_0x48f5fa);_0x784b4d(_0x435ba5);});});})[_0x677e('0x22')](function(){return new BPromise(function(_0x3d0619,_0x2421c8){zipdir(_0x546035,{'saveTo':_0x4858d4},function(_0x23553e,_0x45e64c){if(_0x23553e)return _0x2421c8(_0x23553e);return _0x3d0619(_0x45e64c);});})['then'](function(){return new BPromise(function(_0x4780c3,_0x574461){rimraf(_0x546035,function(_0x1f8686){if(_0x1f8686)_0x574461(_0x1f8686);return _0x4780c3();});});})[_0x677e('0x22')](function(){return _0x17787b[_0x677e('0xd5')](_0x4858d4,_0x4019f8,function(_0x3e0b56){if(_0x3e0b56){console[_0x677e('0x12c')](_0x677e('0x12d'),_0x3e0b56);}else{fs[_0x677e('0x12e')](_0x4858d4);}});});});}else{return _0x17787b[_0x677e('0x2c')](0xc8);}})[_0x677e('0x2b')](handleError(_0x17787b,null));}; \ No newline at end of file +var _0xcaf2=['merge','ChatInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','ChatInteractionId','all','rows','show','params','includeAll','include','create','body','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','ValidationError','Error\x20in\x20Vidaoo\x20configuration','user','ChatMessage','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','attachId','download','root','server/files/attachments/','mailTranscript','join','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','%s%d','agentAlias','System','customer','Visitor','agent_alias','alias','fullname','[%s]\x20%s:\x20%s\x0a','secret','appendFileSync','MailAccount','Smtp','service','host','secure','auth','pass','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','addMessage','ids','getMessages','YYYY-MM-DD\x20HH:mm:ss','options','findAll','getMyMessages','includeAgent','addTags','chatInteractionTags:save','removeTags','unix','files','tmp','attachments','CmContact','Contact','firstName','lastName','direction','Account','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Owner','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','out','renderFile','downloadInteraction.html','transcript-','.pdf','log','err','unlinkSync','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','client','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','index','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','chat_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','tools_tags','search','parseSearch','sqlOperator','unreadMessages','value','having','`\x20>\x200','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','buildExpression','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','$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','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xcaf2,0x8a));var _0x2caf=function(_0x4595ac,_0x4a6c83){_0x4595ac=_0x4595ac-0x0;var _0x13c73c=_0xcaf2[_0x4595ac];return _0x13c73c;};'use strict';var pdf=require(_0x2caf('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2caf('0x1'));var zipdir=require(_0x2caf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2caf('0x3'));var moment=require(_0x2caf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2caf('0x5'));var util=require('util');var path=require(_0x2caf('0x6'));var sox=require(_0x2caf('0x7'));var csv=require(_0x2caf('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2caf('0x9'));var squel=require(_0x2caf('0xa'));var crypto=require(_0x2caf('0xb'));var jsforce=require(_0x2caf('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2caf('0x8'));var querystring=require(_0x2caf('0xd'));var Papa=require(_0x2caf('0xe'));var Redis=require(_0x2caf('0xf'));var authService=require(_0x2caf('0x10'));var qs=require(_0x2caf('0x11'));var as=require(_0x2caf('0x12'));var hardwareService=require(_0x2caf('0x13'));var logger=require(_0x2caf('0x14'))('api');var utils=require(_0x2caf('0x15'));var config=require(_0x2caf('0x16'));var db=require(_0x2caf('0x17'))['db'];config[_0x2caf('0x18')]=_[_0x2caf('0x19')](config[_0x2caf('0x18')],{'host':_0x2caf('0x1a'),'port':0x18eb});var socket=require(_0x2caf('0x1b'))(new Redis(config['redis']));require(_0x2caf('0x1c'))[_0x2caf('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});var client9004=jayson[_0x2caf('0x1e')]['http']({'port':0x232c});function checkPasswordPattern(_0x388e05,_0xa75896,_0x3b8b67){if(_0x3b8b67){var _0x32ff41=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x32ff41['test'](_0xa75896)){return _0x388e05;}else{throw new db[(_0x2caf('0x1f'))]['ValidationError'](_0x2caf('0x20'));}}else{return _0x388e05;}}function respondWithRpcPromise(_0x57f3cd,_0x4a33fc,_0x3e975f,_0x58047b){return new BPromise(function(_0xe72440,_0x9c7302){var _0x5c5d98=_0x58047b||client;return _0x5c5d98[_0x2caf('0x21')](_0x57f3cd,_0x3e975f)[_0x2caf('0x22')](function(_0x6b3778){logger[_0x2caf('0x23')](_0x2caf('0x24'),_0x4a33fc,'request\x20sent');logger[_0x2caf('0x25')](_0x2caf('0x26'),_0x4a33fc,_0x2caf('0x27'),JSON[_0x2caf('0x28')](_0x6b3778));if(_0x6b3778[_0x2caf('0x29')]){if(_0x6b3778[_0x2caf('0x29')][_0x2caf('0x2a')]===0x1f4){logger[_0x2caf('0x29')](_0x2caf('0x24'),_0x4a33fc,_0x6b3778[_0x2caf('0x29')][_0x2caf('0x2b')]);return _0x9c7302(_0x6b3778['error'][_0x2caf('0x2b')]);}logger[_0x2caf('0x29')](_0x2caf('0x24'),_0x4a33fc,_0x6b3778[_0x2caf('0x29')][_0x2caf('0x2b')]);return _0xe72440(_0x6b3778[_0x2caf('0x29')][_0x2caf('0x2b')]);}else{logger[_0x2caf('0x23')](_0x2caf('0x24'),_0x4a33fc,_0x2caf('0x27'));_0xe72440(_0x6b3778['result'][_0x2caf('0x2b')]);}})[_0x2caf('0x2c')](function(_0xbefce6){logger[_0x2caf('0x29')](_0x2caf('0x24'),_0x4a33fc,_0xbefce6);_0x9c7302(_0xbefce6);});});}function respondWithStatusCode(_0x17d3c6,_0x13e8d9){_0x13e8d9=_0x13e8d9||0xcc;return function(_0x135977){if(_0x135977){return _0x17d3c6[_0x2caf('0x2d')](_0x13e8d9);}return _0x17d3c6[_0x2caf('0x2e')](_0x13e8d9)[_0x2caf('0x2f')]();};}function respondWithResult(_0x1f477,_0x158d60){_0x158d60=_0x158d60||0xc8;return function(_0x48b5f7){if(_0x48b5f7){return _0x1f477[_0x2caf('0x2e')](_0x158d60)[_0x2caf('0x30')](_0x48b5f7);}};}function respondWithFilteredResult(_0xea9297,_0x25bbfc){return function(_0xa8523b){if(_0xa8523b){var _0x1f52bf=_0xa8523b[_0x2caf('0x31')],_0x3812cd=_0x25bbfc['offset'],_0x524e0c=_0x25bbfc[_0x2caf('0x32')]+_0x25bbfc[_0x2caf('0x33')],_0x21b3c4;if(_0x524e0c>=_0x1f52bf){_0x524e0c=_0x1f52bf;_0x21b3c4=0xc8;}else{_0x21b3c4=0xce;}_0xea9297[_0x2caf('0x2e')](_0x21b3c4);return _0xea9297['set'](_0x2caf('0x34'),_0x3812cd+'-'+_0x524e0c+'/'+_0x1f52bf)['json'](_0xa8523b);}return null;};}function patchUpdates(_0x5424ad){return function(_0x28c86e){try{jsonpatch[_0x2caf('0x35')](_0x28c86e,_0x5424ad,!![]);}catch(_0x258095){return BPromise[_0x2caf('0x36')](_0x258095);}return _0x28c86e[_0x2caf('0x37')]();};}function saveUpdates(_0x44824a,_0x26b08b){return function(_0x34d8fe){if(_0x34d8fe){return _0x34d8fe[_0x2caf('0x38')](_0x44824a)['then'](function(_0x155ad2){return _0x155ad2;});}return null;};}function removeEntity(_0x154bcc,_0x185e77){return function(_0x37a889){if(_0x37a889){return _0x37a889[_0x2caf('0x39')]()[_0x2caf('0x22')](function(){_0x154bcc[_0x2caf('0x2e')](0xcc)[_0x2caf('0x2f')]();});}};}function handleEntityNotFound(_0x398de1,_0x3b942f){return function(_0x105ec7){if(!_0x105ec7){_0x398de1[_0x2caf('0x2d')](0x194);}return _0x105ec7;};}function handleError(_0x4d1dec,_0x5b3a78){_0x5b3a78=_0x5b3a78||0x1f4;return function(_0x410020){logger[_0x2caf('0x29')](_0x410020[_0x2caf('0x3a')]);if(_0x410020[_0x2caf('0x3b')]){delete _0x410020['name'];}_0x4d1dec[_0x2caf('0x2e')](_0x5b3a78)[_0x2caf('0x3c')](_0x410020);};}function getInteractionUsers(_0x4568f9,_0x432d26){return new BPromise(function(_0x373009,_0x3177f9){try{if(_0x432d26[_0x4568f9['id']]){_0x4568f9[_0x2caf('0x3d')]=_[_0x2caf('0x3e')](_0x432d26[_0x4568f9['id']],function(_0x5c133c){return{'id':_0x5c133c['id'],'fullname':_0x5c133c['fullname']};});}}catch(_0x72d80e){_0x3177f9(_0x72d80e);}_0x373009(_0x4568f9);});}function getInteractionTags(_0x863fca,_0x177254){return new BPromise(function(_0x285aba,_0x43c40f){try{if(_0x863fca[_0x2caf('0x3f')]){_0x863fca[_0x2caf('0x40')]=[];_0x863fca[_0x2caf('0x3f')][_0x2caf('0x41')](',')[_0x2caf('0x42')](function(_0x37673d){_0x863fca['Tags'][_0x2caf('0x43')](_0x177254[_0x37673d]);});}delete _0x863fca[_0x2caf('0x3f')];}catch(_0x3dc8f2){_0x43c40f(_0x3dc8f2);}_0x285aba(_0x863fca);});}function updateChatInteraction(_0x53c836,_0x2c7603,_0x9d530c){return new BPromise(function(_0x179597,_0x499e8c){return getInteractionUsers(_0x53c836,_0x9d530c)[_0x2caf('0x22')](function(_0xdb89bb){return getInteractionTags(_0xdb89bb,_0x2c7603);})['then'](function(_0x38ae68){_0x179597(_0x38ae68);})[_0x2caf('0x2c')](function(_0x4e57b0){_0x499e8c(_0x4e57b0);});});}exports[_0x2caf('0x44')]=function(_0x1348d8,_0x2e4126){var _0x2d389c={},_0x3949a6={},_0x2f446a={'count':0x0,'rows':[]};var _0x1ea1a4=_[_0x2caf('0x3e')](db['ChatInteraction'][_0x2caf('0x45')],function(_0x49dd2d){return{'name':_0x49dd2d[_0x2caf('0x46')],'type':_0x49dd2d[_0x2caf('0x47')][_0x2caf('0x48')]};});_0x3949a6['model']=_['map'](_0x1ea1a4,_0x2caf('0x3b'));_0x3949a6['query']=_[_0x2caf('0x49')](_0x1348d8[_0x2caf('0x4a')]);_0x3949a6[_0x2caf('0x4b')]=_[_0x2caf('0x4c')](_0x3949a6[_0x2caf('0x4d')],_0x3949a6[_0x2caf('0x4a')]);_0x2d389c[_0x2caf('0x4e')]=_[_0x2caf('0x4c')](_0x3949a6[_0x2caf('0x4d')],qs[_0x2caf('0x4f')](_0x1348d8[_0x2caf('0x4a')][_0x2caf('0x4f')]));_0x2d389c[_0x2caf('0x4e')]=_0x2d389c[_0x2caf('0x4e')][_0x2caf('0x50')]?_0x2d389c[_0x2caf('0x4e')]:_0x3949a6[_0x2caf('0x4d')];if(!_0x1348d8[_0x2caf('0x4a')][_0x2caf('0x51')](_0x2caf('0x52'))){_0x2d389c[_0x2caf('0x33')]=qs['limit'](_0x1348d8[_0x2caf('0x4a')][_0x2caf('0x33')]);_0x2d389c['offset']=qs['offset'](_0x1348d8[_0x2caf('0x4a')][_0x2caf('0x32')]);}_0x2d389c['order']=qs[_0x2caf('0x53')](_0x1348d8[_0x2caf('0x4a')][_0x2caf('0x53')]);_0x2d389c[_0x2caf('0x54')]=qs[_0x2caf('0x4b')](_[_0x2caf('0x55')](_0x1348d8[_0x2caf('0x4a')],_0x3949a6[_0x2caf('0x4b')]),_0x1ea1a4);var _0x901625=[];var _0x264835=squel[_0x2caf('0x56')]()[_0x2caf('0x57')]('id')[_0x2caf('0x57')]('name')[_0x2caf('0x57')](_0x2caf('0x58'))[_0x2caf('0x59')]('tools_tags');var _0x473188=squel[_0x2caf('0x56')]()[_0x2caf('0x57')](_0x2caf('0x5a'))[_0x2caf('0x57')](_0x2caf('0x5b'))[_0x2caf('0x57')](_0x2caf('0x5c'))[_0x2caf('0x59')](_0x2caf('0x5d'),'ui')['left_join'](_0x2caf('0x5e'),'u',_0x2caf('0x5f'));var _0xa325cd=squel['select']()[_0x2caf('0x59')](_0x2caf('0x60'),'i')[_0x2caf('0x61')]('cm_contacts','c',_0x2caf('0x62'))[_0x2caf('0x61')](_0x2caf('0x5e'),'o',_0x2caf('0x63'))['left_join'](_0x2caf('0x64'),'a',_0x2caf('0x65'))[_0x2caf('0x61')]('chat_messages','me',_0x2caf('0x66'))[_0x2caf('0x61')]('chat_interaction_has_tags','it',_0x2caf('0x67'))[_0x2caf('0x61')](_0x2caf('0x68'),'t','t.id\x20=\x20it.TagId');var _0x2f3b87=squel['expr']();var _0x96960a=[];var _0x1f9899=squel['expr']();var _0x512fdb;if(_0x1348d8[_0x2caf('0x4a')][_0x2caf('0x69')]){_0x512fdb=as[_0x2caf('0x6a')](_0x1348d8[_0x2caf('0x4a')][_0x2caf('0x69')]);var _0x4ea3d5=_0x512fdb[_0x2caf('0x6b')];for(var _0x17451c=0x0;_0x17451c<_0x512fdb['conditions'][_0x2caf('0x50')];_0x17451c++){var _0x3e5e10=_0x512fdb['conditions'][_0x17451c];var _0x5efa97='i';var _0x163bb3=_['find'](_0x1ea1a4,[_0x2caf('0x3b'),_0x3e5e10[_0x2caf('0x57')]]);if(!_0x163bb3){switch(_0x3e5e10[_0x2caf('0x57')]){case _0x2caf('0x6c'):if(_0x3e5e10[_0x2caf('0x6d')]==0x1){_0xa325cd['having']('`'+_0x3e5e10[_0x2caf('0x57')]+'`\x20=\x200');}else{_0xa325cd[_0x2caf('0x6e')]('`'+_0x3e5e10['field']+_0x2caf('0x6f'));}break;case'Contact':if(_0x3e5e10['operator']===_0x2caf('0x70')){if(_0x3e5e10['value'][_0x2caf('0x41')]('\x20')['length']>0x1){_0x2f3b87[_0x4ea3d5]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2caf('0x71')](_0x3e5e10[_0x2caf('0x6d')]),null);}else{var _0x380c2e='%'+_0x3e5e10[_0x2caf('0x6d')]+'%';_0x2f3b87[_0x4ea3d5](_0x2caf('0x72'),_0x380c2e,_0x380c2e,_0x380c2e);}}else{_0x163bb3=_['find'](_0x1ea1a4,[_0x2caf('0x3b'),_0x2caf('0x73')]);_0x3e5e10['field']=_0x2caf('0x73');_0x5e4b99=as['buildExpression'](_0x5efa97,_0x163bb3[_0x2caf('0x47')],_0x3e5e10);_0x2f3b87[_0x4ea3d5](_0x5e4b99[_0x2caf('0x74')],_0x5e4b99[_0x2caf('0x6d')][_0x2caf('0x75')],_0x5e4b99[_0x2caf('0x6d')]['end']);}break;case'Tag':var _0x31150a=_0x3e5e10[_0x2caf('0x6d')][_0x2caf('0x41')](',')[_0x2caf('0x3e')](function(_0x16eb75){return Number(_0x16eb75);});_0x31150a[_0x2caf('0x42')](function(_0xdd0b67){_0x1f9899['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xdd0b67+',%');});_0x96960a=_[_0x2caf('0x76')](_0x96960a,_0x31150a);break;case _0x2caf('0x77'):if(_0x3e5e10[_0x2caf('0x78')]===_0x2caf('0x70')){_0x2f3b87[_0x4ea3d5](_0x2caf('0x79'),'%'+_0x3e5e10['value']+'%',null);}else{_0x163bb3=_[_0x2caf('0x7a')](_0x1ea1a4,['name',_0x2caf('0x7b')]);_0x3e5e10[_0x2caf('0x57')]=_0x2caf('0x7b');_0x5e4b99=as[_0x2caf('0x7c')](_0x5efa97,_0x163bb3[_0x2caf('0x47')],_0x3e5e10);_0x2f3b87[_0x4ea3d5](_0x5e4b99['text'],_0x5e4b99[_0x2caf('0x6d')]['start'],_0x5e4b99[_0x2caf('0x6d')][_0x2caf('0x2f')]);}break;case'body':_0x5e4b99=as[_0x2caf('0x7c')]('me',null,_0x3e5e10);_0x2f3b87[_0x4ea3d5](_0x5e4b99[_0x2caf('0x74')],_0x5e4b99[_0x2caf('0x6d')][_0x2caf('0x75')],_0x5e4b99[_0x2caf('0x6d')][_0x2caf('0x2f')]);break;}}else{var _0x5e4b99=as[_0x2caf('0x7c')](_0x5efa97,_0x163bb3['type'],_0x3e5e10);_0x2f3b87[_0x4ea3d5](_0x5e4b99[_0x2caf('0x74')],_0x5e4b99['value'][_0x2caf('0x75')],_0x5e4b99[_0x2caf('0x6d')][_0x2caf('0x2f')]);}}}else{var _0x4a12ba=_(_0x1348d8[_0x2caf('0x4a')])[_0x2caf('0x49')]()[_0x2caf('0x3e')](function(_0xdd5ae){return _[_0x2caf('0x7d')](_0x1ea1a4,['name',_0xdd5ae])?_0xdd5ae:undefined;})[_0x2caf('0x7e')]()[_0x2caf('0x6d')]();if(!_[_0x2caf('0x7f')](_0x4a12ba)){_0x4a12ba[_0x2caf('0x42')](function(_0x38fca5){if(_0x38fca5===_0x2caf('0x80')){_0xa325cd['where'](_0x2caf('0x81'),[]['concat'](_0x1348d8[_0x2caf('0x4a')][_0x38fca5]));}else if(_0x38fca5===_0x2caf('0x82')){var _0x3c27fa=JSON[_0x2caf('0x83')](_0x1348d8[_0x2caf('0x4a')][_0x38fca5])[_0x2caf('0x84')];var _0x298e5b=JSON[_0x2caf('0x83')](_0x1348d8['query'][_0x38fca5])[_0x2caf('0x85')];_0xa325cd[_0x2caf('0x54')](_0x2caf('0x86'),_0x3c27fa,_0x298e5b);}else{if(_0x1348d8['query'][_0x38fca5]===_0x2caf('0x87')){_0xa325cd[_0x2caf('0x54')]('i.'+_0x38fca5+_0x2caf('0x88'));}else{_0xa325cd['where']('i.'+_0x38fca5+_0x2caf('0x89'),_0x1348d8[_0x2caf('0x4a')][_0x38fca5]);}}});}if(_0x1348d8[_0x2caf('0x4a')][_0x2caf('0x8a')]){if(_0x1348d8['query']['read']==0x1){_0xa325cd[_0x2caf('0x6e')](_0x2caf('0x8b'));}else{_0xa325cd[_0x2caf('0x6e')](_0x2caf('0x8c'));}}if(_0x1348d8[_0x2caf('0x4a')][_0x2caf('0x8d')]){_0x96960a=_[_0x2caf('0x8e')](_0x1348d8[_0x2caf('0x4a')][_0x2caf('0x8d')])?_0x1348d8[_0x2caf('0x4a')][_0x2caf('0x8d')]:new Array(_0x1348d8[_0x2caf('0x4a')][_0x2caf('0x8d')]);_0x96960a[_0x2caf('0x42')](function(_0x53b179){_0x1f9899['or'](_0x2caf('0x8f'),'%,'+_0x53b179+',%');});}if(_0x1348d8[_0x2caf('0x4a')]['filter']){var _0x23e2ce=_0x1348d8[_0x2caf('0x4a')][_0x2caf('0x90')]['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0x2caf('0x91')](_0x23e2ce)){_0x2f3b87['or'](_0x2caf('0x92'),_0x23e2ce+'%');}else{_0x2f3b87['or'](_0x2caf('0x93'),qs['getFullTextValue'](_0x23e2ce))['or'](_0x2caf('0x94'),_0x23e2ce+'%');}}}_0xa325cd[_0x2caf('0x54')](_0x2f3b87);_0xa325cd[_0x2caf('0x95')]('i.id');var _0x33998e={'type':db[_0x2caf('0x1f')]['QueryTypes'][_0x2caf('0x96')],'raw':!![]};var _0x461b71=_0xa325cd[_0x2caf('0x97')]();_0x461b71['field'](_0x2caf('0x98'));_0x461b71[_0x2caf('0x57')](_0x2caf('0x99'),_0x2caf('0x6c'));if(_0x2d389c[_0x2caf('0x9a')]){_0x2d389c[_0x2caf('0x9a')]['forEach'](function(_0x567541){_0xa325cd[_0x2caf('0x9a')]('i.'+_0x567541[0x0],_0x567541[0x1]===_0x2caf('0x9b')?![]:!![]);});}if(!_[_0x2caf('0x7f')](_0x96960a)){_0xa325cd[_0x2caf('0x6e')](_0x1f9899);_0x461b71[_0x2caf('0x54')](_0x2caf('0x9c'),_0x96960a);}BPromise[_0x2caf('0x9d')]()[_0x2caf('0x22')](function(){if(!_0x512fdb){if(_0x1348d8[_0x2caf('0x4a')][_0x2caf('0x80')]||_0x1348d8[_0x2caf('0x4a')][_0x2caf('0x9e')])return;_0x461b71['where'](_0x2caf('0x9f'));_0xa325cd[_0x2caf('0x54')](_0x2caf('0x9f'));return;}return _0x1348d8['user'][_0x2caf('0xa0')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5b7455){if(_['isEmpty'](_0x5b7455)){_0x461b71[_0x2caf('0x54')](_0x2caf('0xa1'));_0xa325cd[_0x2caf('0x54')](_0x2caf('0xa1'));}else{_0x461b71['where'](_0x2caf('0x81'),_[_0x2caf('0x3e')](_0x5b7455,'id'));_0xa325cd['where'](_0x2caf('0x81'),_[_0x2caf('0x3e')](_0x5b7455,'id'));}});})[_0x2caf('0x22')](function(){db[_0x2caf('0xa2')]['query'](_0x461b71['toString'](),_0x33998e)[_0x2caf('0x22')](function(_0x584efc){_0x2f446a[_0x2caf('0x31')]=_0x584efc['length'];if(_0x2f446a[_0x2caf('0x31')]===0x0)return[];return db['sequelize']['query'](_0x264835[_0x2caf('0xa3')](),_0x33998e)['then'](function(_0x485d4a){_0x901625=_[_0x2caf('0xa4')](_0x485d4a,'id');_0x33998e=_[_0x2caf('0xa5')](_0x33998e,{'model':db[_0x2caf('0xa6')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1348d8[_0x2caf('0x4a')][_0x2caf('0x4f')]){_0x2d389c['attributes'][_0x2caf('0x42')](function(_0x4dd873){_0xa325cd['field']('i.'+_0x4dd873);});}else{_0xa325cd[_0x2caf('0x57')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0xa325cd[_0x2caf('0x57')](_0x2caf('0xa7'),_0x2caf('0xa8'));_0xa325cd['field'](_0x2caf('0xa9'),_0x2caf('0xaa'));_0xa325cd['field'](_0x2caf('0xab'));_0xa325cd[_0x2caf('0x57')](_0x2caf('0xac'),_0x2caf('0xad'));_0xa325cd[_0x2caf('0x57')](_0x2caf('0xae'),'Contact.lastName');_0xa325cd['field'](_0x2caf('0xaf'),'Contact.email');_0xa325cd[_0x2caf('0x57')]('c.phone','Contact.phone');_0xa325cd['field']('c.mobile',_0x2caf('0xb0'));_0xa325cd[_0x2caf('0x57')](_0x2caf('0xb1'),_0x2caf('0xb2'));_0xa325cd[_0x2caf('0x57')](_0x2caf('0xb3'),_0x2caf('0xb4'));_0xa325cd[_0x2caf('0x57')](_0x2caf('0xb5'),'Owner.internal');_0xa325cd[_0x2caf('0x57')](_0x2caf('0xb6'),'TagIds');}if(_0x2d389c['limit'])_0xa325cd[_0x2caf('0x33')](_0x2d389c[_0x2caf('0x33')]);if(_0x2d389c[_0x2caf('0x32')])_0xa325cd[_0x2caf('0x32')](_0x2d389c['offset']);return db[_0x2caf('0xa2')][_0x2caf('0x4a')](_0xa325cd[_0x2caf('0xa3')](),_0x33998e);})[_0x2caf('0x22')](function(_0x33c451){_0x473188[_0x2caf('0x54')]('ui.ChatInteractionId\x20IN\x20?',_[_0x2caf('0x3e')](_0x33c451,'id'));return db[_0x2caf('0xa2')][_0x2caf('0x4a')](_0x473188['toString'](),_0x33998e)[_0x2caf('0x22')](function(_0x3bea54){var _0x511202=_[_0x2caf('0xb7')](_0x3bea54,_0x2caf('0xb8'));var _0x5a0501=[];_0x33c451['forEach'](function(_0x26459f){_0x5a0501[_0x2caf('0x43')](updateChatInteraction(_0x26459f,_0x901625,_0x511202));});return BPromise[_0x2caf('0xb9')](_0x5a0501);});});})['then'](function(_0xbdcca){_0x2f446a[_0x2caf('0xba')]=_0xbdcca;return _0x2f446a;})[_0x2caf('0x22')](respondWithFilteredResult(_0x2e4126,_0x2d389c));})[_0x2caf('0x2c')](handleError(_0x2e4126,null));};exports[_0x2caf('0xbb')]=function(_0x27c72d,_0x4cb83b){var _0x1b8ea2={'raw':![],'where':{'id':_0x27c72d[_0x2caf('0xbc')]['id']}},_0x34daff={};_0x34daff['model']=_[_0x2caf('0x49')](db[_0x2caf('0xa6')]['rawAttributes']);_0x34daff['query']=_[_0x2caf('0x49')](_0x27c72d[_0x2caf('0x4a')]);_0x34daff[_0x2caf('0x4b')]=_[_0x2caf('0x4c')](_0x34daff[_0x2caf('0x4d')],_0x34daff[_0x2caf('0x4a')]);_0x1b8ea2[_0x2caf('0x4e')]=_['intersection'](_0x34daff[_0x2caf('0x4d')],qs[_0x2caf('0x4f')](_0x27c72d[_0x2caf('0x4a')][_0x2caf('0x4f')]));_0x1b8ea2['attributes']=_0x1b8ea2[_0x2caf('0x4e')]['length']?_0x1b8ea2['attributes']:_0x34daff['model'];if(_0x27c72d[_0x2caf('0x4a')][_0x2caf('0xbd')]){_0x1b8ea2[_0x2caf('0xbe')]=[{'all':!![]}];}_0x1b8ea2=_[_0x2caf('0xa5')]({},_0x1b8ea2,_0x27c72d['options']);return db[_0x2caf('0xa6')][_0x2caf('0x7a')](_0x1b8ea2)['then'](handleEntityNotFound(_0x4cb83b,null))[_0x2caf('0x22')](respondWithResult(_0x4cb83b,null))[_0x2caf('0x2c')](handleError(_0x4cb83b,null));};exports[_0x2caf('0xbf')]=function(_0x59b1f0,_0x48a6e5){return db[_0x2caf('0xa6')][_0x2caf('0xbf')](_0x59b1f0[_0x2caf('0xc0')],{})[_0x2caf('0x22')](respondWithResult(_0x48a6e5,0xc9))[_0x2caf('0x2c')](handleError(_0x48a6e5,null));};exports[_0x2caf('0x38')]=function(_0x259ac2,_0x37b6da){if(_0x259ac2[_0x2caf('0xc0')]['id']){delete _0x259ac2[_0x2caf('0xc0')]['id'];}return db[_0x2caf('0xa6')][_0x2caf('0x7a')]({'where':{'id':_0x259ac2[_0x2caf('0xbc')]['id']}})[_0x2caf('0x22')](handleEntityNotFound(_0x37b6da,null))[_0x2caf('0x22')](saveUpdates(_0x259ac2['body'],null))[_0x2caf('0x22')](respondWithResult(_0x37b6da,null))['catch'](handleError(_0x37b6da,null));};exports[_0x2caf('0x39')]=function(_0x49801d,_0x4ea233){return db[_0x2caf('0xa6')][_0x2caf('0x7a')]({'where':{'id':_0x49801d[_0x2caf('0xbc')]['id']}})[_0x2caf('0x22')](handleEntityNotFound(_0x4ea233,null))[_0x2caf('0x22')](removeEntity(_0x4ea233,null))[_0x2caf('0x2c')](handleError(_0x4ea233,null));};exports[_0x2caf('0xc1')]=function(_0x3482fd,_0x4821d9){return db[_0x2caf('0xa6')][_0x2caf('0xc1')]()[_0x2caf('0x22')](respondWithResult(_0x4821d9,null))[_0x2caf('0x2c')](handleError(_0x4821d9,null));};exports[_0x2caf('0xc2')]=function(_0x4fbb70,_0x16bf22){var _0x2a3b20=_0x4fbb70[_0x2caf('0xbc')]['id'];var _0x2cad81;var _0xea7498;var _0x5c1ca7;return db[_0x2caf('0xa6')][_0x2caf('0xc3')]({'where':{'id':_0x2a3b20}})[_0x2caf('0x22')](function(_0x57a679){_0x2cad81=_0x57a679;return db[_0x2caf('0xc4')][_0x2caf('0xc3')]({'where':{'id':_0x57a679[_0x2caf('0x80')]},'attributes':['id',_0x2caf('0xc5'),_0x2caf('0xc6')],'raw':!![]});})[_0x2caf('0x22')](function(_0xd06543){if(_0xd06543&&_0xd06543[_0x2caf('0xc5')]&&_0xd06543[_0x2caf('0xc6')]){_0xea7498=_0xd06543;var _0x53211f={'rejectUnauthorized':![],'method':_0x2caf('0xc7'),'uri':_0x2caf('0xc8'),'headers':{'X-APIKEY':_0xd06543[_0x2caf('0xc5')]},'body':{'name':_0x2caf('0xc9')+_0x2a3b20},'redirect':'follow','json':!![]};return rp(_0x53211f);}else{throw new db['Sequelize'][(_0x2caf('0xca'))](_0x2caf('0xcb'));}})[_0x2caf('0x22')](function(_0x585a1f){_0x5c1ca7=_0x585a1f;if(_0x5c1ca7['id']){var _0x347b84={'body':_0x5c1ca7['join_url'],'ChatWebsiteId':_0xea7498['id'],'ChatInteractionId':_0x2cad81['id'],'direction':'out','UserId':_0x4fbb70[_0x2caf('0xcc')]['id']};return db[_0x2caf('0xcd')]['create'](_0x347b84,{});}else{throw new db['Sequelize'][(_0x2caf('0xca'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x2cad81[_0x2caf('0xce')]({'vidaooSessionId':_0x5c1ca7['id']});})[_0x2caf('0x22')](respondWithResult(_0x16bf22,null))[_0x2caf('0x2c')](handleError(_0x16bf22,null));};exports[_0x2caf('0xcf')]=function(_0x3c2a6a,_0x2efd16){if(_0x3c2a6a[_0x2caf('0xc0')]['id']){delete _0x3c2a6a[_0x2caf('0xc0')]['id'];}return db[_0x2caf('0xa6')][_0x2caf('0x7a')]({'where':{'id':_0x3c2a6a[_0x2caf('0xbc')]['id']}})[_0x2caf('0x22')](handleEntityNotFound(_0x2efd16,null))[_0x2caf('0x22')](saveUpdates(_0x3c2a6a[_0x2caf('0xc0')],null))['then'](respondWithResult(_0x2efd16,null))[_0x2caf('0x2c')](handleError(_0x2efd16,null));};exports[_0x2caf('0xd0')]=function(_0x3d65e3,_0x314d44,_0x62ac98){if(_0x3d65e3['body']['id']){delete _0x3d65e3[_0x2caf('0xc0')]['id'];}return db[_0x2caf('0xa6')]['find']({'where':{'id':_0x3d65e3['params']['id']}})[_0x2caf('0x22')](function(_0x782693){if(!_0x782693){logger[_0x2caf('0x29')](_0x2caf('0xd1'),_0x2caf('0xd0'),0x194,_0x2caf('0xd2'));_0x314d44[_0x2caf('0x2d')](0x194);}else{if(_0x782693[_0x2caf('0x7b')]){throw new db[(_0x2caf('0x1f'))][(_0x2caf('0xca'))](_0x2caf('0xd3'));}}return _0x782693;})[_0x2caf('0x22')](function(_0x15a310){if(_0x15a310){return _0x15a310['update']({'closed':_0x3d65e3[_0x2caf('0xc0')][_0x2caf('0xd4')],'disposition':_0x3d65e3[_0x2caf('0xc0')][_0x2caf('0xd5')]})['then'](function(_0x52be30){return _0x52be30;});}})[_0x2caf('0x22')](function(_0x9e7991){return respondWithRpcPromise(_0x2caf('0xd6'),_0x2caf('0xd0'),_0x3d65e3[_0x2caf('0xc0')],client9004);})[_0x2caf('0x22')](respondWithResult(_0x314d44,null))[_0x2caf('0x2c')](handleError(_0x314d44,null));};exports[_0x2caf('0xd7')]=function(_0x538af3,_0x5cea33,_0x10c8eb){_0x538af3[_0x2caf('0xc0')][_0x2caf('0x3b')]=_0x538af3[_0x2caf('0xd8')][_0x2caf('0xd9')];_0x538af3['body'][_0x2caf('0xda')]=_0x538af3[_0x2caf('0xd8')][_0x2caf('0xdb')];_0x538af3[_0x2caf('0xc0')][_0x2caf('0x47')]=_0x538af3['file'][_0x2caf('0xdc')];return db[_0x2caf('0xdd')]['create'](_0x538af3['body'])[_0x2caf('0x22')](respondWithResult(_0x5cea33,0xc9))[_0x2caf('0x2c')](handleError(_0x5cea33,null));};exports[_0x2caf('0xde')]=function(_0x5dfba9,_0x1c6faf,_0x450eb2){return db['ChatInteraction']['findOne']({'where':{'id':_0x5dfba9[_0x2caf('0xbc')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x1c6faf,null))[_0x2caf('0x22')](function(_0x48d12c){if(_0x48d12c){if(_0x48d12c['closed']){return _0x1c6faf['status'](0x193)[_0x2caf('0x30')]({'status':0x193,'message':'Unauthorized'});}return db[_0x2caf('0xdd')][_0x2caf('0xc3')]({'where':{'id':_0x5dfba9[_0x2caf('0x4a')][_0x2caf('0xdf')]},'raw':!![]})['then'](handleEntityNotFound(_0x1c6faf,null));}})[_0x2caf('0x22')](function(_0x5a7b5d){if(_0x5a7b5d){return _0x1c6faf[_0x2caf('0xe0')](path['join'](config[_0x2caf('0xe1')],_0x2caf('0xe2'),_0x5a7b5d['basename']));}})[_0x2caf('0x2c')](handleError(_0x1c6faf,null));};exports['close']=function(_0x2f0333,_0xa8ff0c){var _0x35952e=null;var _0x16ce70=null;var _0x7bde8a=null;var _0x233a16=null;if(_0x2f0333['body']['id']){delete _0x2f0333[_0x2caf('0xc0')]['id'];}if(_0x2f0333[_0x2caf('0xc0')][_0x2caf('0xe3')]){_0x233a16=path[_0x2caf('0xe4')](config[_0x2caf('0xe1')],_0x2caf('0xe5'),util[_0x2caf('0xe6')](_0x2caf('0xe7'),Date['now']()));_0x2f0333['body'][_0x2caf('0xe8')]=_0x233a16;}return db['ChatInteraction'][_0x2caf('0x7a')]({'where':{'id':_0x2f0333[_0x2caf('0xbc')]['id']},'include':[{'model':db[_0x2caf('0xcd')],'as':_0x2caf('0xe9'),'include':[{'model':db[_0x2caf('0x77')],'as':_0x2caf('0x77')}]}]})['then'](handleEntityNotFound(_0xa8ff0c,null))['then'](saveUpdates(_0x2f0333[_0x2caf('0xc0')],null))[_0x2caf('0x22')](function(_0x5e4e6d){if(_0x5e4e6d){_0x35952e=_0x5e4e6d;return db[_0x2caf('0xc4')][_0x2caf('0x7a')]({'where':{'id':_0x35952e[_0x2caf('0x80')]}});}})[_0x2caf('0x22')](function(_0xb24aed){if(_0xb24aed){_0x7bde8a=_0xb24aed;return db['CmContact']['find']({'where':{'id':_0x35952e[_0x2caf('0x73')]}});}})[_0x2caf('0x22')](function(_0x1c2f7b){if(_0x1c2f7b){_0x16ce70=_0x1c2f7b;if(_0x233a16){var _0x372fe3=null;for(var _0xa0a370=0x1;_0xa0a370<_0x35952e['Messages'][_0x2caf('0x50')];++_0xa0a370){_0x372fe3=_0x35952e[_0x2caf('0xe9')][_0xa0a370];var _0x28bb61=_0x372fe3[_0x2caf('0x7b')]?util['format'](_0x2caf('0xea'),_0x7bde8a[_0x2caf('0xeb')],_0x372fe3[_0x2caf('0x7b')]):_0x2caf('0xec');var _0x2417c5=_0x2f0333[_0x2caf('0xc0')][_0x2caf('0xed')]||util[_0x2caf('0xe6')](_0x2caf('0xea'),_0x2caf('0xee'),_0x372fe3[_0x2caf('0x73')]);switch(_0x7bde8a['agentIdentifier']){case'website_alias':_0x28bb61=_0x372fe3[_0x2caf('0x7b')]?util['format']('%s%d',_0x7bde8a['agentAlias'],_0x372fe3['UserId']):'System';break;case _0x2caf('0xef'):_0x28bb61=_0x372fe3[_0x2caf('0x7b')]?_0x372fe3[_0x2caf('0x77')][_0x2caf('0xf0')]||_0x372fe3[_0x2caf('0x77')][_0x2caf('0xf1')]:'System';break;case'agent_fullname':_0x28bb61=_0x372fe3['UserId']?_0x372fe3['User'][_0x2caf('0xf1')]:'System';break;default:_0x28bb61=_0x372fe3[_0x2caf('0x7b')]?util[_0x2caf('0xe6')]('%s%d',_0x7bde8a[_0x2caf('0xeb')],_0x372fe3['UserId']):_0x2caf('0xec');}var _0x1f6c1b=util[_0x2caf('0xe6')](_0x2caf('0xf2'),moment(_0x372fe3[_0x2caf('0x82')])[_0x2caf('0xe6')]('MM/DD/YYYY\x20HH:mm:ss'),_0x372fe3['direction']==='in'?_0x2417c5:_0x28bb61,_0x372fe3['body']);if(!_0x372fe3[_0x2caf('0xf3')]){fs[_0x2caf('0xf4')](_0x233a16,_0x1f6c1b);}}return db[_0x2caf('0xf5')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}}})[_0x2caf('0x22')](function(_0x494d49){if(_0x494d49&&_0x494d49['Smtp']&&_0x2f0333[_0x2caf('0xc0')]){var _0x7d8cb9={'tls':{'rejectUnauthorized':![]}};if(_0x494d49[_0x2caf('0xf6')]['service']){_0x7d8cb9[_0x2caf('0xf7')]=_0x494d49['Smtp'][_0x2caf('0xf7')];}else{_0x7d8cb9[_0x2caf('0xf8')]=_0x494d49[_0x2caf('0xf6')][_0x2caf('0xf8')];_0x7d8cb9['port']=_0x494d49[_0x2caf('0xf6')]['port'];_0x7d8cb9[_0x2caf('0xf9')]=_0x494d49[_0x2caf('0xf6')][_0x2caf('0xf9')];}if(_0x494d49[_0x2caf('0xf6')]['authentication']){_0x7d8cb9[_0x2caf('0xfa')]={'user':_0x494d49[_0x2caf('0xf6')][_0x2caf('0xcc')],'pass':_0x494d49[_0x2caf('0xf6')][_0x2caf('0xfb')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x7d8cb9,'message':{'from':util[_0x2caf('0xe6')](_0x2caf('0xfc'),_0x494d49[_0x2caf('0x3b')],_0x494d49[_0x2caf('0xfd')]||_0x494d49[_0x2caf('0xf6')][_0x2caf('0xcc')]),'to':_0x2f0333[_0x2caf('0xc0')][_0x2caf('0xe3')],'subject':_0x2caf('0xfe'),'text':util[_0x2caf('0xe6')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x2f0333[_0x2caf('0xc0')]['mailTranscript']),'attachments':[{'path':_0x233a16}]}})[_0x2caf('0x22')](function(){return _0x35952e;})['catch'](function(_0x29baa3){console[_0x2caf('0x29')](_0x29baa3);});}else{return _0x35952e;}})[_0x2caf('0x22')](respondWithStatusCode(_0xa8ff0c,0xc8))[_0x2caf('0x2c')](handleError(_0xa8ff0c,null));};exports[_0x2caf('0xff')]=function(_0x59114e,_0x407f62,_0x4d4e5b){return db[_0x2caf('0xcd')][_0x2caf('0x7a')]({'where':{'id':_0x59114e[_0x2caf('0xbc')]['id']}})['then'](handleEntityNotFound(_0x407f62,null))[_0x2caf('0x22')](function(_0x611c9e){if(_0x611c9e){return _0x611c9e[_0x2caf('0xff')](_0x59114e['body']['ids'],_['omit'](_0x59114e[_0x2caf('0xc0')],[_0x2caf('0x100'),'id'])||{});}})[_0x2caf('0x22')](respondWithResult(_0x407f62,null))[_0x2caf('0x2c')](handleError(_0x407f62,null));};exports[_0x2caf('0x101')]=function(_0x541665,_0x16c906,_0x2ba55e){var _0x23d0dc={'raw':![],'where':{}};var _0x5f73d5={};var _0x250377={'count':0x0,'rows':[]};return db[_0x2caf('0xa6')][_0x2caf('0xc3')]({'where':{'id':_0x541665[_0x2caf('0xbc')]['id']}})[_0x2caf('0x22')](handleEntityNotFound(_0x16c906,null))['then'](function(_0x9a2f92){if(_0x9a2f92){_0x5f73d5['model']=_[_0x2caf('0x49')](db['ChatMessage'][_0x2caf('0x45')]);_0x5f73d5[_0x2caf('0x4a')]=_['keys'](_0x541665[_0x2caf('0x4a')]);_0x5f73d5[_0x2caf('0x4b')]=_[_0x2caf('0x4c')](_0x5f73d5[_0x2caf('0x4d')],_0x5f73d5['query']);_0x23d0dc[_0x2caf('0x4e')]=_[_0x2caf('0x4c')](_0x5f73d5[_0x2caf('0x4d')],qs[_0x2caf('0x4f')](_0x541665[_0x2caf('0x4a')][_0x2caf('0x4f')]));_0x23d0dc['attributes']=_0x23d0dc['attributes']['length']?_0x23d0dc[_0x2caf('0x4e')]:_0x5f73d5[_0x2caf('0x4d')];if(!_0x541665[_0x2caf('0x4a')][_0x2caf('0x51')](_0x2caf('0x52'))){_0x23d0dc[_0x2caf('0x33')]=qs[_0x2caf('0x33')](_0x541665[_0x2caf('0x4a')][_0x2caf('0x33')]);_0x23d0dc[_0x2caf('0x32')]=qs['offset'](_0x541665['query'][_0x2caf('0x32')]);}_0x23d0dc[_0x2caf('0x9a')]=qs['sort'](_0x541665[_0x2caf('0x4a')]['sort']);_0x23d0dc[_0x2caf('0x54')]=qs[_0x2caf('0x4b')](_[_0x2caf('0x55')](_0x541665['query'],_0x5f73d5['filters']));_0x23d0dc[_0x2caf('0x54')][_0x2caf('0xb8')]=_0x9a2f92['id'];if(_0x541665[_0x2caf('0x4a')][_0x2caf('0x90')]){_0x23d0dc[_0x2caf('0x54')]=_[_0x2caf('0xa5')](_0x23d0dc[_0x2caf('0x54')],{'$or':_[_0x2caf('0x3e')](_0x23d0dc[_0x2caf('0x4e')],function(_0x39ae95){var _0x566332={};_0x566332[_0x39ae95]={'$like':'%'+_0x541665[_0x2caf('0x4a')][_0x2caf('0x90')]+'%'};return _0x566332;})});}if(_0x541665[_0x2caf('0x4a')][_0x2caf('0x84')]){var _0x47e18c=_0x541665[_0x2caf('0x4a')]['$gte']['split'](',');var _0x444ed6={};_0x444ed6[_0x47e18c[0x0]]={'$gte':moment(_0x47e18c[0x1])['format'](_0x2caf('0x102'))};_0x23d0dc[_0x2caf('0x54')]=_[_0x2caf('0xa5')](_0x23d0dc[_0x2caf('0x54')],_0x444ed6);}_0x23d0dc=_[_0x2caf('0xa5')]({},_0x23d0dc,_0x541665[_0x2caf('0x103')]);return db['ChatMessage'][_0x2caf('0x31')]({'where':_0x23d0dc[_0x2caf('0x54')]})['then'](function(_0x53b33){_0x250377['count']=_0x53b33;if(_0x541665[_0x2caf('0x4a')][_0x2caf('0xbd')]){_0x23d0dc[_0x2caf('0xbe')]=[{'all':!![]}];}return db['ChatMessage'][_0x2caf('0x104')](_0x23d0dc);})[_0x2caf('0x22')](function(_0x58d05a){_0x250377[_0x2caf('0xba')]=_0x58d05a;return _0x250377;});}})[_0x2caf('0x22')](respondWithFilteredResult(_0x16c906,_0x23d0dc))[_0x2caf('0x2c')](handleError(_0x16c906,null));};exports[_0x2caf('0x105')]=function(_0x2aedcf,_0x4a8e4b,_0x5efc49){var _0x34edf4={'where':{}},_0x8d3136={},_0x27e456={'count':0x0,'rows':[]};return db[_0x2caf('0xa6')][_0x2caf('0xc3')]({'where':{'id':_0x2aedcf[_0x2caf('0xbc')]['id']}})[_0x2caf('0x22')](handleEntityNotFound(_0x4a8e4b,null))[_0x2caf('0x22')](function(_0x2bde06){if(_0x2bde06){_0x8d3136[_0x2caf('0x4d')]=_['keys'](db['ChatMessage'][_0x2caf('0x45')]);_0x8d3136['query']=_['keys'](_0x2aedcf[_0x2caf('0x4a')]);_0x8d3136['filters']=_['intersection'](_0x8d3136[_0x2caf('0x4d')],_0x8d3136['query']);_0x34edf4[_0x2caf('0x4e')]=_[_0x2caf('0x4c')](_0x8d3136[_0x2caf('0x4d')],qs[_0x2caf('0x4f')](_0x2aedcf[_0x2caf('0x4a')][_0x2caf('0x4f')]));_0x34edf4[_0x2caf('0x4e')]=_0x34edf4[_0x2caf('0x4e')][_0x2caf('0x50')]?_0x34edf4[_0x2caf('0x4e')]:_0x8d3136[_0x2caf('0x4d')];if(!_0x2aedcf['query'][_0x2caf('0x51')](_0x2caf('0x52'))){_0x34edf4[_0x2caf('0x33')]=qs[_0x2caf('0x33')](_0x2aedcf[_0x2caf('0x4a')][_0x2caf('0x33')]);_0x34edf4[_0x2caf('0x32')]=qs[_0x2caf('0x32')](_0x2aedcf[_0x2caf('0x4a')]['offset']);}_0x34edf4['order']=qs[_0x2caf('0x53')](_0x2aedcf[_0x2caf('0x4a')]['sort']);_0x34edf4[_0x2caf('0x54')]=qs[_0x2caf('0x4b')](_[_0x2caf('0x55')](_0x2aedcf[_0x2caf('0x4a')],_0x8d3136['filters']));_0x34edf4[_0x2caf('0x54')][_0x2caf('0xb8')]=_0x2bde06['id'];if(_0x2aedcf['query']['filter']){_0x34edf4[_0x2caf('0x54')]=_[_0x2caf('0xa5')](_0x34edf4[_0x2caf('0x54')],{'$or':_[_0x2caf('0x3e')](_0x34edf4[_0x2caf('0x4e')],function(_0x3e2ba3){var _0x21a2a0={};_0x21a2a0[_0x3e2ba3]={'$like':'%'+_0x2aedcf[_0x2caf('0x4a')][_0x2caf('0x90')]+'%'};return _0x21a2a0;})});}_0x34edf4[_0x2caf('0x54')][_0x2caf('0xf3')]=![];if(_0x2aedcf[_0x2caf('0x4a')]['id']){_0x34edf4[_0x2caf('0x54')]['id']={'$gt':_0x2aedcf[_0x2caf('0x4a')]['id']};}_0x34edf4=_[_0x2caf('0xa5')]({},_0x34edf4,_0x2aedcf[_0x2caf('0x103')]);return db[_0x2caf('0xcd')][_0x2caf('0x31')]({'where':_0x34edf4[_0x2caf('0x54')]})[_0x2caf('0x22')](function(_0x9e3f6c){_0x27e456['count']=_0x9e3f6c;_0x34edf4['include']=[];if(_0x2aedcf['query'][_0x2caf('0x106')]){_0x34edf4[_0x2caf('0xbe')][_0x2caf('0x43')]({'model':db[_0x2caf('0x77')],'as':_0x2caf('0x77'),'attributes':['id',_0x2caf('0xf1'),_0x2caf('0xf0')]});}if(_0x2aedcf['query'][_0x2caf('0xbd')]){_0x34edf4[_0x2caf('0xbe')]=[{'all':!![]}];}return db[_0x2caf('0xcd')][_0x2caf('0x104')](_0x34edf4);})[_0x2caf('0x22')](function(_0x2e77b7){_0x27e456[_0x2caf('0xba')]=_0x2e77b7;return _0x27e456;});}})[_0x2caf('0x22')](respondWithFilteredResult(_0x4a8e4b,_0x34edf4))[_0x2caf('0x2c')](handleError(_0x4a8e4b,null));};exports[_0x2caf('0x107')]=function(_0x4efcd9,_0x23ae2b,_0x1e2626){return db[_0x2caf('0xa6')][_0x2caf('0x7a')]({'where':{'id':_0x4efcd9['params']['id']}})[_0x2caf('0x22')](handleEntityNotFound(_0x23ae2b,null))[_0x2caf('0x22')](function(_0x14624d){if(_0x14624d){return _0x14624d['setTags'](_0x4efcd9[_0x2caf('0xc0')][_0x2caf('0x100')],_['omit'](_0x4efcd9[_0x2caf('0xc0')],['ids','id'])||{})['spread'](function(){return db['Tag'][_0x2caf('0x104')]({'attributes':['id',_0x2caf('0x3b'),_0x2caf('0x58')],'where':{'id':_0x4efcd9[_0x2caf('0xc0')][_0x2caf('0x100')]}});})['then'](function(_0x2fd993){socket['emit'](_0x2caf('0x108'),{'id':Number(_0x4efcd9['params']['id']),'tags':_0x2fd993||[]});return{'id':Number(_0x4efcd9['params']['id']),'tags':_0x2fd993||[]};});}})[_0x2caf('0x22')](respondWithResult(_0x23ae2b,null))[_0x2caf('0x2c')](handleError(_0x23ae2b,null));};exports['removeTags']=function(_0x5daf64,_0x453b7e,_0x4252a8){return db['ChatInteraction'][_0x2caf('0x7a')]({'where':{'id':_0x5daf64[_0x2caf('0xbc')]['id']}})[_0x2caf('0x22')](handleEntityNotFound(_0x453b7e,null))[_0x2caf('0x22')](function(_0x418983){if(_0x418983){return _0x418983[_0x2caf('0x109')](_0x5daf64[_0x2caf('0x4a')][_0x2caf('0x100')]);}})['then'](respondWithStatusCode(_0x453b7e,null))['catch'](handleError(_0x453b7e,null));};exports[_0x2caf('0xe0')]=function(_0x27e15d,_0x3360a9){var _0x18923a=moment()[_0x2caf('0x10a')]()[_0x2caf('0xa3')]();var _0x4d67e8=path['join'](config[_0x2caf('0xe1')],'server',_0x2caf('0x10b'),_0x2caf('0x10c'));var _0x211acd=path[_0x2caf('0xe4')](config[_0x2caf('0xe1')],'server',_0x2caf('0x10b'),_0x2caf('0x10d'));var _0x599c78=path['join'](_0x4d67e8,_0x18923a);var _0x3302c6=util['format']('transcript-%d-%s.zip',_0x27e15d[_0x2caf('0xbc')]['id'],_0x18923a);var _0x11d855=path[_0x2caf('0xe4')](_0x4d67e8,_0x3302c6);var _0x1d7c3f=[];_0x1d7c3f[_0x2caf('0x43')]({'model':db['User'],'as':_0x2caf('0x77'),'attributes':['id',_0x2caf('0xf1')],'raw':!![]});_0x1d7c3f[_0x2caf('0x43')]({'model':db[_0x2caf('0x10e')],'as':_0x2caf('0x10f'),'attributes':['id',_0x2caf('0x110'),_0x2caf('0x111')],'raw':!![]});if(_0x27e15d[_0x2caf('0x4a')]['attachments']){_0x1d7c3f['push']({'model':db[_0x2caf('0xdd')],'as':'Attachment','raw':!![]});}var _0x49db=[{'model':db[_0x2caf('0xcd')],'as':_0x2caf('0xe9'),'attributes':['id',_0x2caf('0xc0'),_0x2caf('0x82'),_0x2caf('0x112'),_0x2caf('0xf3'),_0x2caf('0x8a')],'include':_0x1d7c3f}];_0x49db[_0x2caf('0x43')]({'model':db[_0x2caf('0xc4')],'as':_0x2caf('0x113'),'attributes':['id',_0x2caf('0x3b')]});_0x49db[_0x2caf('0x43')]({'model':db[_0x2caf('0x77')],'as':'Owner','attributes':['id',_0x2caf('0xf1')]});return db[_0x2caf('0xa6')][_0x2caf('0x7a')]({'where':{'id':_0x27e15d[_0x2caf('0xbc')]['id']},'include':_0x49db})[_0x2caf('0x22')](handleEntityNotFound(_0x3360a9,null))['then'](function(_0x89eeb8){if(_0x89eeb8){var _0x11182a=_0x89eeb8['get']({'plain':!![]});fs[_0x2caf('0x114')](_0x599c78);var _0x717459={'format':'A4','border':_0x2caf('0x115'),'header':{'height':'40px','contents':{'first':_0x2caf('0x116')}},'footer':{'height':_0x2caf('0x117'),'contents':{'default':util[_0x2caf('0xe6')](_0x2caf('0x118'),util['format'](_0x2caf('0x119'),_0x2caf('0x11a'),_0x11182a['id']),moment()[_0x2caf('0xe6')](_0x2caf('0x11b'))['toString']())}}};var _0xed09e2={'channel':_0x2caf('0x11a'),'account':_0x11182a[_0x2caf('0x113')][_0x2caf('0x3b')],'agent':_0x11182a['Owner']?_0x11182a[_0x2caf('0x11c')][_0x2caf('0xf1')]:_0x2caf('0x11d'),'createdAt':moment(_0x11182a['createdAt'])[_0x2caf('0xe6')](_0x2caf('0x102'))[_0x2caf('0xa3')](),'closedAt':_0x11182a['closed']?moment(_0x11182a[_0x2caf('0x11e')])[_0x2caf('0xe6')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2caf('0xa3')]():'','disposition':_0x11182a[_0x2caf('0xd5')],'chatInfo':{'browser':_0x11182a[_0x2caf('0x11f')],'os':_0x11182a[_0x2caf('0x120')],'referer':_0x11182a[_0x2caf('0x121')],'customerIp':_0x11182a[_0x2caf('0x122')],'customerPort':_0x11182a['customerPort']?_0x11182a[_0x2caf('0x123')]:_0x2caf('0x11d')},'messages':_(_0x11182a[_0x2caf('0xe9')])[_0x2caf('0x124')]()['filter']({'secret':![]})[_0x2caf('0x3e')](function(_0x328e4e){if(_0x328e4e[_0x2caf('0xdd')]){var _0x5553d6=path['join'](_0x211acd,_0x328e4e[_0x2caf('0xdd')][_0x2caf('0xda')]);if(fs[_0x2caf('0x125')](_0x5553d6)){fs[_0x2caf('0x126')](_0x5553d6)['pipe'](fs['createWriteStream'](path[_0x2caf('0xe4')](_0x599c78,_0x328e4e[_0x2caf('0xdd')][_0x2caf('0xda')])));}}return{'date':moment(_0x328e4e[_0x2caf('0x82')])[_0x2caf('0xe6')](_0x2caf('0x102'))['toString'](),'sender':_0x328e4e[_0x2caf('0x112')]===_0x2caf('0x127')?_0x328e4e[_0x2caf('0x77')]?_0x328e4e[_0x2caf('0x77')][_0x2caf('0xf1')]:_0x2caf('0xec'):_0x328e4e[_0x2caf('0x10f')][_0x2caf('0x110')]+(_0x328e4e[_0x2caf('0x10f')]['lastName']?'\x20'+_0x328e4e['Contact'][_0x2caf('0x111')]:''),'body':_0x328e4e[_0x2caf('0xdd')]?_0x328e4e['Attachment'][_0x2caf('0xda')]:_0x328e4e[_0x2caf('0xc0')],'direction':_0x328e4e[_0x2caf('0x112')]===_0x2caf('0x127')?'A':'C','secret':_0x328e4e[_0x2caf('0xf3')],'read':_0x328e4e[_0x2caf('0x8a')],'attachment':_0x328e4e['Attachment']};})['value']()};return ejs[_0x2caf('0x128')](path[_0x2caf('0xe4')](config[_0x2caf('0xe1')],'server','views',_0x2caf('0x129')),{'interaction':_0xed09e2})[_0x2caf('0x22')](function(_0x1cba2d){return new BPromise(function(_0xa08204,_0x38b041){pdf[_0x2caf('0xbf')](_0x1cba2d,_0x717459)['toFile'](path[_0x2caf('0xe4')](_0x599c78,_0x2caf('0x12a')+_0x11182a['id']+'-'+_0x18923a+_0x2caf('0x12b')),function(_0x21b8f4,_0x46705a){if(_0x21b8f4)return _0x38b041(_0x21b8f4);_0xa08204(_0x46705a);});});})[_0x2caf('0x22')](function(){return new BPromise(function(_0x1152b6,_0x70e14d){zipdir(_0x599c78,{'saveTo':_0x11d855},function(_0x378046,_0x529611){if(_0x378046)return _0x70e14d(_0x378046);return _0x1152b6(_0x529611);});})[_0x2caf('0x22')](function(){return new BPromise(function(_0x18ddd3,_0x25fb78){rimraf(_0x599c78,function(_0x495ecb){if(_0x495ecb)_0x25fb78(_0x495ecb);return _0x18ddd3();});});})[_0x2caf('0x22')](function(){return _0x3360a9[_0x2caf('0xe0')](_0x11d855,_0x3302c6,function(_0x36a57f){if(_0x36a57f){console[_0x2caf('0x12c')](_0x2caf('0x12d'),_0x36a57f);}else{fs[_0x2caf('0x12e')](_0x11d855);}});});});}else{return _0x3360a9[_0x2caf('0x2d')](0xc8);}})[_0x2caf('0x2c')](handleError(_0x3360a9,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index b9e68c4..4f1d215 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 _0x871e=['remove','getUsers','Users','findAll','then','setDataValue','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','update'];(function(_0x36daf3,_0x2ea0dd){var _0x3e4e26=function(_0x31999a){while(--_0x31999a){_0x36daf3['push'](_0x36daf3['shift']());}};_0x3e4e26(++_0x2ea0dd);}(_0x871e,0x185));var _0xe871=function(_0x4a2798,_0x554df2){_0x4a2798=_0x4a2798-0x0;var _0x2f50dd=_0x871e[_0x4a2798];return _0x2f50dd;};'use strict';var EventEmitter=require(_0xe871('0x0'));var ChatInteraction=require(_0xe871('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0xe871('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe871('0x2'),'afterDestroy':_0xe871('0x3')};function emitEvent(_0x22c1a2){return function(_0x15576e,_0xce51e,_0x226c69){_0x15576e[_0xe871('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0xb6624a){_0x15576e['setDataValue'](_0xe871('0x5'),_0xb6624a['map'](function(_0x564109){return{'id':_0x564109['id']};}));return ChatMessage[_0xe871('0x6')]({'where':{'ChatInteractionId':_0x15576e['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe871('0x7')](function(_0x2754d5){_0x15576e[_0xe871('0x8')]('unreadMessages',_0x2754d5[_0xe871('0x9')]);ChatInteractionEvents[_0xe871('0xa')](_0x22c1a2+':'+_0x15576e['id'],_0x15576e);ChatInteractionEvents[_0xe871('0xa')](_0x22c1a2,_0x15576e);_0x226c69(null);})['catch'](_0x226c69(null));};}for(var e in events){if(events[_0xe871('0xb')](e)){var event=events[e];ChatInteraction[_0xe871('0xc')](e,emitEvent(event));}}module[_0xe871('0xd')]=ChatInteractionEvents; \ No newline at end of file +var _0x600f=['length','emit','hasOwnProperty','exports','events','../../mysqldb','ChatInteraction','ChatMessage','save','update','remove','getUsers','Users','findAll','then','unreadMessages'];(function(_0x313a07,_0x56e834){var _0x3ccd0b=function(_0xbfc0){while(--_0xbfc0){_0x313a07['push'](_0x313a07['shift']());}};_0x3ccd0b(++_0x56e834);}(_0x600f,0xb4));var _0xf600=function(_0x476b5f,_0x1f9952){_0x476b5f=_0x476b5f-0x0;var _0x5a23d8=_0x600f[_0x476b5f];return _0x5a23d8;};'use strict';var EventEmitter=require(_0xf600('0x0'));var ChatInteraction=require(_0xf600('0x1'))['db'][_0xf600('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0xf600('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf600('0x4'),'afterUpdate':_0xf600('0x5'),'afterDestroy':_0xf600('0x6')};function emitEvent(_0x181497){return function(_0x41ad01,_0x182c96,_0x304fdf){_0x41ad01[_0xf600('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1a620c){_0x41ad01['setDataValue'](_0xf600('0x8'),_0x1a620c['map'](function(_0x31b9b1){return{'id':_0x31b9b1['id']};}));return ChatMessage[_0xf600('0x9')]({'where':{'ChatInteractionId':_0x41ad01['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf600('0xa')](function(_0x3583db){_0x41ad01['setDataValue'](_0xf600('0xb'),_0x3583db[_0xf600('0xc')]);ChatInteractionEvents[_0xf600('0xd')](_0x181497+':'+_0x41ad01['id'],_0x41ad01);ChatInteractionEvents[_0xf600('0xd')](_0x181497,_0x41ad01);_0x304fdf(null);})['catch'](_0x304fdf(null));};}for(var e in events){if(events[_0xf600('0xe')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xf600('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 33b0733..71e89db 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 _0x1025=['utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4'];(function(_0x4f3467,_0x3c8ed9){var _0x5a9c8e=function(_0x35fe09){while(--_0x35fe09){_0x4f3467['push'](_0x4f3467['shift']());}};_0x5a9c8e(++_0x3c8ed9);}(_0x1025,0x16a));var _0x5102=function(_0x80eb99,_0xf5b711){_0x80eb99=_0x80eb99-0x0;var _0x398203=_0x1025[_0x80eb99];return _0x398203;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5102('0x0'))(_0x5102('0x1'));var moment=require(_0x5102('0x2'));var BPromise=require(_0x5102('0x3'));var rp=require(_0x5102('0x4'));var fs=require('fs');var path=require(_0x5102('0x5'));var rimraf=require(_0x5102('0x6'));var config=require(_0x5102('0x7'));var attributes=require(_0x5102('0x8'));module[_0x5102('0x9')]=function(_0x4c84b2,_0x525195){return _0x4c84b2[_0x5102('0xa')]('ChatInteraction',attributes,{'tableName':_0x5102('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a4f75,_0x7df201,_0x3f6e37){if(_0x5a4f75[_0x5102('0xc')](_0x5102('0xd'))){_0x5a4f75[_0x5102('0xe')]=moment()[_0x5102('0xf')](_0x5102('0x10'));}_0x3f6e37(null,_0x5a4f75);}},'charset':_0x5102('0x11'),'collate':_0x5102('0x12')});}; \ No newline at end of file +var _0xcd1e=['ChatInteraction','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','api','bluebird','path','./chatInteraction.attributes','exports','define'];(function(_0x356a3e,_0x5c9225){var _0x4c4305=function(_0x1af050){while(--_0x1af050){_0x356a3e['push'](_0x356a3e['shift']());}};_0x4c4305(++_0x5c9225);}(_0xcd1e,0xad));var _0xecd1=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xcd1e[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xecd1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xecd1('0x1'));var moment=require('moment');var BPromise=require(_0xecd1('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xecd1('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xecd1('0x4'));module[_0xecd1('0x5')]=function(_0x1119e7,_0x2ac52b){return _0x1119e7[_0xecd1('0x6')](_0xecd1('0x7'),attributes,{'tableName':_0xecd1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x49871b,_0x39d471,_0x336ca5){if(_0x49871b[_0xecd1('0x9')](_0xecd1('0xa'))){_0x49871b['closedAt']=moment()[_0xecd1('0xb')](_0xecd1('0xc'));}_0x336ca5(null,_0x49871b);}},'charset':_0xecd1('0xd'),'collate':_0xecd1('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index ff3c0bf..1e29de8 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 _0x0ffe=['ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToChatInteraction','find','omit','ids','spread','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInteraction.socket','register','info'];(function(_0x46c9fc,_0x9d7b6e){var _0x46c32b=function(_0x48fe78){while(--_0x48fe78){_0x46c9fc['push'](_0x46c9fc['shift']());}};_0x46c32b(++_0x9d7b6e);}(_0x0ffe,0x68));var _0xe0ff=function(_0x4d063f,_0x32f1fd){_0x4d063f=_0x4d063f-0x0;var _0x597d8a=_0x0ffe[_0x4d063f];return _0x597d8a;};'use strict';var _=require('lodash');var util=require(_0xe0ff('0x0'));var moment=require(_0xe0ff('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0ff('0x2'));var db=require(_0xe0ff('0x3'))['db'];var utils=require(_0xe0ff('0x4'));var logger=require('../../config/logger')(_0xe0ff('0x5'));var config=require(_0xe0ff('0x6'));var jayson=require(_0xe0ff('0x7'));var client=jayson[_0xe0ff('0x8')][_0xe0ff('0x9')]({'port':0x232a});config[_0xe0ff('0xa')]=_[_0xe0ff('0xb')](config[_0xe0ff('0xa')],{'host':_0xe0ff('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe0ff('0xa')]));require(_0xe0ff('0xd'))[_0xe0ff('0xe')](socket);function respondWithRpcPromise(_0x5060d8,_0x1b3023,_0x53a30a){return new BPromise(function(_0x373cec,_0x42805a){return client['request'](_0x5060d8,_0x53a30a)['then'](function(_0x21d95a){logger[_0xe0ff('0xf')](_0xe0ff('0x10'),_0x1b3023,_0xe0ff('0x11'));logger[_0xe0ff('0x12')](_0xe0ff('0x13'),_0x1b3023,_0xe0ff('0x11'),JSON[_0xe0ff('0x14')](_0x21d95a));if(_0x21d95a[_0xe0ff('0x15')]){if(_0x21d95a['error']['code']===0x1f4){logger['error'](_0xe0ff('0x10'),_0x1b3023,_0x21d95a[_0xe0ff('0x15')]['message']);return _0x42805a(_0x21d95a[_0xe0ff('0x15')][_0xe0ff('0x16')]);}logger[_0xe0ff('0x15')](_0xe0ff('0x10'),_0x1b3023,_0x21d95a[_0xe0ff('0x15')][_0xe0ff('0x16')]);return _0x373cec(_0x21d95a[_0xe0ff('0x15')]['message']);}else{logger[_0xe0ff('0xf')](_0xe0ff('0x10'),_0x1b3023,_0xe0ff('0x11'));_0x373cec(_0x21d95a[_0xe0ff('0x17')][_0xe0ff('0x16')]);}})[_0xe0ff('0x18')](function(_0xdd9b4b){logger[_0xe0ff('0x15')](_0xe0ff('0x10'),_0x1b3023,_0xdd9b4b);_0x42805a(_0xdd9b4b);});});}exports[_0xe0ff('0x19')]=function(_0x37da9a){var _0x474650=this;return new Promise(function(_0x312973,_0x4a7831){return db[_0xe0ff('0x1a')][_0xe0ff('0x1b')](_0x37da9a[_0xe0ff('0x1c')],{'raw':_0x37da9a[_0xe0ff('0x1d')]?_0x37da9a[_0xe0ff('0x1d')][_0xe0ff('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37da9a['options']?_0x37da9a[_0xe0ff('0x1d')][_0xe0ff('0x1f')]||null:null,'attributes':_0x37da9a['options']?_0x37da9a['options'][_0xe0ff('0x20')]||null:null,'limit':_0x37da9a[_0xe0ff('0x1d')]?_0x37da9a[_0xe0ff('0x1d')][_0xe0ff('0x21')]||null:null})[_0xe0ff('0x22')](function(_0xeda592){logger['info'](_0xe0ff('0x19'),_0x37da9a);logger['debug'](_0xe0ff('0x19'),_0x37da9a,JSON['stringify'](_0xeda592));_0x312973(_0xeda592);})[_0xe0ff('0x18')](function(_0x23858a){logger[_0xe0ff('0x15')](_0xe0ff('0x19'),_0x23858a[_0xe0ff('0x16')],_0x37da9a);_0x4a7831(_0x474650[_0xe0ff('0x15')](0x1f4,_0x23858a['message']));});});};exports[_0xe0ff('0x23')]=function(_0x2ae522){return new Promise(function(_0x4ed638,_0x5b7d0a){return db[_0xe0ff('0x1a')][_0xe0ff('0x24')]({'where':_0x2ae522['options']?_0x2ae522['options'][_0xe0ff('0x1f')]||null:null})[_0xe0ff('0x22')](function(_0x5e536e){if(_0x5e536e){return _0x5e536e['addTags'](_0x2ae522[_0xe0ff('0x1c')]['ids'],_[_0xe0ff('0x25')](_0x2ae522['body'],[_0xe0ff('0x26'),'id'])||{});}})[_0xe0ff('0x27')](function(_0x3109cb){logger[_0xe0ff('0xf')]('AddTags',_0x2ae522);logger[_0xe0ff('0x12')]('AddTags',_0x2ae522,JSON[_0xe0ff('0x14')](_0x3109cb));_0x4ed638(_0x3109cb);})[_0xe0ff('0x18')](function(_0x17bd14){logger[_0xe0ff('0x15')]('AddTags',_0x17bd14[_0xe0ff('0x16')],_0x2ae522);_0x5b7d0a(_this['error'](0x1f4,_0x17bd14['message']));});});}; \ No newline at end of file +var _0x8755=['request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatInteraction,\x20%s,\x20%s','info','result','catch','update','body','options','raw','limit','UpdateChatInteraction','AddTagsToChatInteraction','ChatInteraction','find','where','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','./chatInteraction.socket','register','request','then'];(function(_0x54dcad,_0x554f46){var _0x537c56=function(_0x48ff85){while(--_0x48ff85){_0x54dcad['push'](_0x54dcad['shift']());}};_0x537c56(++_0x554f46);}(_0x8755,0x176));var _0x5875=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8755[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5875('0x0'));var util=require('util');var moment=require(_0x5875('0x1'));var BPromise=require(_0x5875('0x2'));var rs=require(_0x5875('0x3'));var fs=require('fs');var Redis=require(_0x5875('0x4'));var db=require(_0x5875('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5875('0x6'))(_0x5875('0x7'));var config=require('../../config/environment');var jayson=require(_0x5875('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x5875('0x9')]=_[_0x5875('0xa')](config[_0x5875('0x9')],{'host':_0x5875('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5875('0x9')]));require(_0x5875('0xc'))[_0x5875('0xd')](socket);function respondWithRpcPromise(_0x51cd73,_0x87826,_0x378692){return new BPromise(function(_0x43fb70,_0x3ed078){return client[_0x5875('0xe')](_0x51cd73,_0x378692)[_0x5875('0xf')](function(_0x392c86){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x87826,_0x5875('0x10'));logger[_0x5875('0x11')](_0x5875('0x12'),_0x87826,'request\x20sent',JSON[_0x5875('0x13')](_0x392c86));if(_0x392c86[_0x5875('0x14')]){if(_0x392c86[_0x5875('0x14')]['code']===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x87826,_0x392c86[_0x5875('0x14')][_0x5875('0x15')]);return _0x3ed078(_0x392c86[_0x5875('0x14')][_0x5875('0x15')]);}logger[_0x5875('0x14')](_0x5875('0x16'),_0x87826,_0x392c86[_0x5875('0x14')][_0x5875('0x15')]);return _0x43fb70(_0x392c86[_0x5875('0x14')]['message']);}else{logger[_0x5875('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x87826,_0x5875('0x10'));_0x43fb70(_0x392c86[_0x5875('0x18')][_0x5875('0x15')]);}})[_0x5875('0x19')](function(_0x5c4eea){logger[_0x5875('0x14')](_0x5875('0x16'),_0x87826,_0x5c4eea);_0x3ed078(_0x5c4eea);});});}exports['UpdateChatInteraction']=function(_0x1719ea){var _0x3c3e8a=this;return new Promise(function(_0x1edc9a,_0x2ed81c){return db['ChatInteraction'][_0x5875('0x1a')](_0x1719ea[_0x5875('0x1b')],{'raw':_0x1719ea[_0x5875('0x1c')]?_0x1719ea[_0x5875('0x1c')][_0x5875('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1719ea[_0x5875('0x1c')]?_0x1719ea['options']['where']||null:null,'attributes':_0x1719ea[_0x5875('0x1c')]?_0x1719ea[_0x5875('0x1c')]['attributes']||null:null,'limit':_0x1719ea['options']?_0x1719ea[_0x5875('0x1c')][_0x5875('0x1e')]||null:null})[_0x5875('0xf')](function(_0x43a5bc){logger[_0x5875('0x17')](_0x5875('0x1f'),_0x1719ea);logger[_0x5875('0x11')](_0x5875('0x1f'),_0x1719ea,JSON['stringify'](_0x43a5bc));_0x1edc9a(_0x43a5bc);})[_0x5875('0x19')](function(_0xcad4d5){logger['error'](_0x5875('0x1f'),_0xcad4d5['message'],_0x1719ea);_0x2ed81c(_0x3c3e8a['error'](0x1f4,_0xcad4d5[_0x5875('0x15')]));});});};exports[_0x5875('0x20')]=function(_0x22917f){return new Promise(function(_0x467381,_0x2208fe){return db[_0x5875('0x21')][_0x5875('0x22')]({'where':_0x22917f[_0x5875('0x1c')]?_0x22917f[_0x5875('0x1c')][_0x5875('0x23')]||null:null})[_0x5875('0xf')](function(_0x18b868){if(_0x18b868){return _0x18b868['addTags'](_0x22917f[_0x5875('0x1b')][_0x5875('0x24')],_[_0x5875('0x25')](_0x22917f['body'],['ids','id'])||{});}})['spread'](function(_0x5b6b4b){logger[_0x5875('0x17')](_0x5875('0x26'),_0x22917f);logger[_0x5875('0x11')](_0x5875('0x26'),_0x22917f,JSON[_0x5875('0x13')](_0x5b6b4b));_0x467381(_0x5b6b4b);})['catch'](function(_0x4fd2e5){logger[_0x5875('0x14')](_0x5875('0x26'),_0x4fd2e5[_0x5875('0x15')],_0x22917f);_0x2208fe(_this[_0x5875('0x14')](0x1f4,_0x4fd2e5[_0x5875('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 0003773..f06135b 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 _0xbc91=['./chatInteraction.events','save','remove','update','emit','length','chatInteraction:'];(function(_0x1e0790,_0x4fbb38){var _0x449216=function(_0x2248f3){while(--_0x2248f3){_0x1e0790['push'](_0x1e0790['shift']());}};_0x449216(++_0x4fbb38);}(_0xbc91,0xd2));var _0x1bc9=function(_0x15b35c,_0xac8e16){_0x15b35c=_0x15b35c-0x0;var _0x2f623c=_0xbc91[_0x15b35c];return _0x2f623c;};'use strict';var ChatInteractionEvents=require(_0x1bc9('0x0'));var events=[_0x1bc9('0x1'),_0x1bc9('0x2'),_0x1bc9('0x3')];function createListener(_0xa8624c,_0x499526){return function(_0xbf0350){_0x499526[_0x1bc9('0x4')](_0xa8624c,_0xbf0350);};}function removeListener(_0x1fac26,_0x102540){return function(){ChatInteractionEvents['removeListener'](_0x1fac26,_0x102540);};}exports['register']=function(_0x3369ac){for(var _0x11903f=0x0,_0x4f81e0=events[_0x1bc9('0x5')];_0x11903f<_0x4f81e0;_0x11903f++){var _0x8f41d8=events[_0x11903f];var _0x497132=createListener(_0x1bc9('0x6')+_0x8f41d8,_0x3369ac);ChatInteractionEvents['on'](_0x8f41d8,_0x497132);}}; \ No newline at end of file +var _0x3c90=['update','removeListener','register','save','remove'];(function(_0x5976f8,_0x1265b7){var _0x179715=function(_0x2b2c4b){while(--_0x2b2c4b){_0x5976f8['push'](_0x5976f8['shift']());}};_0x179715(++_0x1265b7);}(_0x3c90,0xfd));var _0x03c9=function(_0x4e97e9,_0x51817a){_0x4e97e9=_0x4e97e9-0x0;var _0x110a71=_0x3c90[_0x4e97e9];return _0x110a71;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x03c9('0x0'),_0x03c9('0x1'),_0x03c9('0x2')];function createListener(_0x220606,_0x3589a6){return function(_0x2c07b1){_0x3589a6['emit'](_0x220606,_0x2c07b1);};}function removeListener(_0x18081f,_0x54dd29){return function(){ChatInteractionEvents[_0x03c9('0x3')](_0x18081f,_0x54dd29);};}exports[_0x03c9('0x4')]=function(_0x280b7c){for(var _0x8b4527=0x0,_0x790dad=events['length'];_0x8b4527<_0x790dad;_0x8b4527++){var _0x4c0087=events[_0x8b4527];var _0x4d0e05=createListener('chatInteraction:'+_0x4c0087,_0x280b7c);ChatInteractionEvents['on'](_0x4c0087,_0x4d0e05);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index db46fc5..2fbafc3 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 _0x30d3=['/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','diskStorage','root','server/files/attachments/','%s-%s','replace','single','file','attachmentUpload','tracked','chat','addTags','put','update','/:id/abandon','abandon','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','isChatInteractionAuthorized'];(function(_0x403282,_0x261d4d){var _0x419547=function(_0x34ffd2){while(--_0x34ffd2){_0x403282['push'](_0x403282['shift']());}};_0x419547(++_0x261d4d);}(_0x30d3,0x9f));var _0x330d=function(_0x5f0ba7,_0x41c2e9){_0x5f0ba7=_0x5f0ba7-0x0;var _0x308397=_0x30d3[_0x5f0ba7];return _0x308397;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x330d('0x0'));var timeout=require(_0x330d('0x1'));var express=require(_0x330d('0x2'));var router=express[_0x330d('0x3')]();var auth=require(_0x330d('0x4'));var interaction=require(_0x330d('0x5'));var config=require(_0x330d('0x6'));var controller=require('./chatInteraction.controller');router[_0x330d('0x7')]('/',auth[_0x330d('0x8')](),controller[_0x330d('0x9')]);router[_0x330d('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x330d('0xa')]);router[_0x330d('0x7')](_0x330d('0xb'),auth[_0x330d('0xc')](),controller['show']);router['get'](_0x330d('0xd'),auth[_0x330d('0xc')](),controller[_0x330d('0xe')]);router[_0x330d('0x7')](_0x330d('0xf'),auth[_0x330d('0x8')](),controller[_0x330d('0x10')]);router['get'](_0x330d('0x11'),auth[_0x330d('0xc')](),controller[_0x330d('0x12')]);router['get'](_0x330d('0x13'),auth[_0x330d('0x8')](),controller[_0x330d('0x14')]);router[_0x330d('0x15')]('/',auth['isAuthenticated'](),controller[_0x330d('0x16')]);router[_0x330d('0x15')]('/:id/vidaoo',auth[_0x330d('0x8')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x330d('0x17')]({'destination':function(_0x40a237,_0x3801f4,_0x5e5baf){_0x5e5baf(null,path['join'](config[_0x330d('0x18')],_0x330d('0x19')));},'filename':function(_0x4431a4,_0x571c7f,_0x582539){_0x582539(null,util['format'](_0x330d('0x1a'),Date['now'](),_0x571c7f['originalname'][_0x330d('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x330d('0x15')]('/:id/attachment_upload',upload[_0x330d('0x1c')](_0x330d('0x1d')),controller[_0x330d('0x1e')]);router[_0x330d('0x15')](_0x330d('0xf'),auth['isChatInteractionAuthorized'](),controller['addMessage']);router[_0x330d('0x15')]('/:id/tags',auth[_0x330d('0x8')](),interaction[_0x330d('0x1f')](_0x330d('0x20'),'chatinteraction:addtags'),controller[_0x330d('0x21')]);router[_0x330d('0x22')]('/:id',auth['isAuthenticated'](),interaction[_0x330d('0x1f')](_0x330d('0x20'),'chatinteraction:update'),controller[_0x330d('0x23')]);router[_0x330d('0x22')]('/:id/custom_update',controller['customUpdate']);router[_0x330d('0x22')](_0x330d('0x24'),auth[_0x330d('0xc')](),controller[_0x330d('0x25')]);router[_0x330d('0x22')]('/:id/close',controller['close']);router[_0x330d('0x26')](_0x330d('0xb'),auth['isAuthenticated'](),interaction[_0x330d('0x1f')](_0x330d('0x20'),_0x330d('0x27')),controller[_0x330d('0x28')]);router[_0x330d('0x26')](_0x330d('0x29'),auth['isAuthenticated'](),controller[_0x330d('0x2a')]);module['exports']=router; \ No newline at end of file +var _0xa5d7=['exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./chatInteraction.controller','isAuthenticated','index','get','describe','/:id','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','isChatInteractionAuthorized','getMyMessages','/:id/download','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','originalname','replace','/:id/attachment_upload','file','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','tracked','chatinteraction:update','put','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','delete','chatinteraction:destroy','destroy','removeTags'];(function(_0x33ec52,_0x4a7c3f){var _0x371715=function(_0x2dd99e){while(--_0x2dd99e){_0x33ec52['push'](_0x33ec52['shift']());}};_0x371715(++_0x4a7c3f);}(_0xa5d7,0x1c3));var _0x7a5d=function(_0x175511,_0x25ecbf){_0x175511=_0x175511-0x0;var _0xd03619=_0xa5d7[_0x175511];return _0xd03619;};'use strict';var multer=require(_0x7a5d('0x0'));var util=require(_0x7a5d('0x1'));var path=require(_0x7a5d('0x2'));var timeout=require(_0x7a5d('0x3'));var express=require('express');var router=express[_0x7a5d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7a5d('0x5'));var config=require('../../config/environment');var controller=require(_0x7a5d('0x6'));router['get']('/',auth[_0x7a5d('0x7')](),controller[_0x7a5d('0x8')]);router[_0x7a5d('0x9')]('/describe',auth[_0x7a5d('0x7')](),controller[_0x7a5d('0xa')]);router['get'](_0x7a5d('0xb'),auth['isChatInteractionAuthorized'](),controller[_0x7a5d('0xc')]);router[_0x7a5d('0x9')](_0x7a5d('0xd'),auth['isChatInteractionAuthorized'](),controller[_0x7a5d('0xe')]);router[_0x7a5d('0x9')](_0x7a5d('0xf'),auth[_0x7a5d('0x7')](),controller[_0x7a5d('0x10')]);router[_0x7a5d('0x9')](_0x7a5d('0x11'),auth[_0x7a5d('0x12')](),controller[_0x7a5d('0x13')]);router[_0x7a5d('0x9')](_0x7a5d('0x14'),auth[_0x7a5d('0x7')](),controller['download']);router['post']('/',auth[_0x7a5d('0x7')](),controller['create']);router[_0x7a5d('0x15')](_0x7a5d('0x16'),auth[_0x7a5d('0x7')](),controller[_0x7a5d('0x17')]);var upload=multer({'storage':multer[_0x7a5d('0x18')]({'destination':function(_0x342f63,_0x50070a,_0x35c72e){_0x35c72e(null,path[_0x7a5d('0x19')](config[_0x7a5d('0x1a')],_0x7a5d('0x1b')));},'filename':function(_0x3861c7,_0x4e1973,_0x2d06db){_0x2d06db(null,util[_0x7a5d('0x1c')]('%s-%s',Date['now'](),_0x4e1973[_0x7a5d('0x1d')][_0x7a5d('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x7a5d('0x1f'),upload['single'](_0x7a5d('0x20')),controller['attachmentUpload']);router[_0x7a5d('0x15')](_0x7a5d('0xf'),auth['isChatInteractionAuthorized'](),controller[_0x7a5d('0x21')]);router['post'](_0x7a5d('0x22'),auth['isAuthenticated'](),interaction['tracked'](_0x7a5d('0x23'),_0x7a5d('0x24')),controller[_0x7a5d('0x25')]);router['put'](_0x7a5d('0xb'),auth[_0x7a5d('0x7')](),interaction[_0x7a5d('0x26')]('chat',_0x7a5d('0x27')),controller['update']);router[_0x7a5d('0x28')](_0x7a5d('0x29'),controller[_0x7a5d('0x2a')]);router[_0x7a5d('0x28')](_0x7a5d('0x2b'),auth[_0x7a5d('0x12')](),controller['abandon']);router[_0x7a5d('0x28')](_0x7a5d('0x2c'),controller['close']);router[_0x7a5d('0x2d')](_0x7a5d('0xb'),auth[_0x7a5d('0x7')](),interaction[_0x7a5d('0x26')]('chat',_0x7a5d('0x2e')),controller[_0x7a5d('0x2f')]);router[_0x7a5d('0x2d')](_0x7a5d('0x22'),auth[_0x7a5d('0x7')](),controller[_0x7a5d('0x30')]);module[_0x7a5d('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index d52b443..6532f8a 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 _0x4975=['TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x4975,0x86));var _0x5497=function(_0x1c6b8e,_0x480aae){_0x1c6b8e=_0x1c6b8e-0x0;var _0x2f9de6=_0x4975[_0x1c6b8e];return _0x2f9de6;};'use strict';var Sequelize=require(_0x5497('0x0'));module['exports']={'body':{'type':Sequelize[_0x5497('0x1')](_0x5497('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5497('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x5497('0x4')]}}; \ No newline at end of file +var _0x0b0e=['TEXT','BOOLEAN','INTEGER','sequelize'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0b0e,0x187));var _0xe0b0=function(_0x32b30c,_0x2d5ec8){_0x32b30c=_0x32b30c-0x0;var _0xcfc212=_0x0b0e[_0x32b30c];return _0xcfc212;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe0b0('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xe0b0('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 4e37a42..8ee3d87 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 _0xc421=['showWebBar','-online','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','all','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','register','sendStatus','status','end','count','offset','set','json','apply','reject','save','then','destroy','error','name','send','index','map','ChatInternalMessage','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','merge','includeAll','include','findAll','rows','show','options','find','create','body','catch','params','describe','get','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','agent','admin','user','role','lastLoginAt','allowmessenger'];(function(_0x552c09,_0x3e0527){var _0xee743f=function(_0x4347c9){while(--_0x4347c9){_0x552c09['push'](_0x552c09['shift']());}};_0xee743f(++_0x3e0527);}(_0xc421,0x153));var _0x1c42=function(_0x55cfb9,_0x317fee){_0x55cfb9=_0x55cfb9-0x0;var _0xee8240=_0xc421[_0x55cfb9];return _0xee8240;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1c42('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1c42('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1c42('0x2'));var moment=require(_0x1c42('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1c42('0x4'));var util=require(_0x1c42('0x5'));var path=require(_0x1c42('0x6'));var sox=require(_0x1c42('0x7'));var csv=require(_0x1c42('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1c42('0x9'));var squel=require(_0x1c42('0xa'));var crypto=require(_0x1c42('0xb'));var jsforce=require(_0x1c42('0xc'));var deskjs=require(_0x1c42('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1c42('0xe'));var Papa=require(_0x1c42('0xf'));var Redis=require(_0x1c42('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1c42('0x11'));var hardwareService=require(_0x1c42('0x12'));var logger=require(_0x1c42('0x13'))('api');var utils=require(_0x1c42('0x14'));var config=require(_0x1c42('0x15'));var db=require(_0x1c42('0x16'))['db'];config[_0x1c42('0x17')]=_[_0x1c42('0x18')](config[_0x1c42('0x17')],{'host':_0x1c42('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1c42('0x17')]));require(_0x1c42('0x1a'))[_0x1c42('0x1b')](socket);function respondWithStatusCode(_0x3f7d47,_0x35da6f){_0x35da6f=_0x35da6f||0xcc;return function(_0x5a1aca){if(_0x5a1aca){return _0x3f7d47[_0x1c42('0x1c')](_0x35da6f);}return _0x3f7d47[_0x1c42('0x1d')](_0x35da6f)[_0x1c42('0x1e')]();};}function respondWithResult(_0x2bdf5b,_0x1a7abd){_0x1a7abd=_0x1a7abd||0xc8;return function(_0x37457f){if(_0x37457f){return _0x2bdf5b['status'](_0x1a7abd)['json'](_0x37457f);}};}function respondWithFilteredResult(_0x4821d3,_0x10b87c){return function(_0x32ba09){if(_0x32ba09){var _0x32f55b=_0x32ba09[_0x1c42('0x1f')],_0x26494a=_0x10b87c[_0x1c42('0x20')],_0x49fb31=_0x10b87c[_0x1c42('0x20')]+_0x10b87c['limit'],_0x484153;if(_0x49fb31>=_0x32f55b){_0x49fb31=_0x32f55b;_0x484153=0xc8;}else{_0x484153=0xce;}_0x4821d3['status'](_0x484153);return _0x4821d3[_0x1c42('0x21')]('Content-Range',_0x26494a+'-'+_0x49fb31+'/'+_0x32f55b)[_0x1c42('0x22')](_0x32ba09);}return null;};}function patchUpdates(_0xbd4ed9){return function(_0xdc25a6){try{jsonpatch[_0x1c42('0x23')](_0xdc25a6,_0xbd4ed9,!![]);}catch(_0x199558){return BPromise[_0x1c42('0x24')](_0x199558);}return _0xdc25a6[_0x1c42('0x25')]();};}function saveUpdates(_0x58de5b,_0x2e3f56){return function(_0x3521e9){if(_0x3521e9){return _0x3521e9['update'](_0x58de5b)[_0x1c42('0x26')](function(_0x2e2054){return _0x2e2054;});}return null;};}function removeEntity(_0x4b2e6c,_0x1f8d11){return function(_0x21b9d8){if(_0x21b9d8){return _0x21b9d8[_0x1c42('0x27')]()['then'](function(){_0x4b2e6c[_0x1c42('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x319ef3,_0x58cba1){return function(_0x8a5108){if(!_0x8a5108){_0x319ef3[_0x1c42('0x1c')](0x194);}return _0x8a5108;};}function handleError(_0x17efb8,_0x55a1be){_0x55a1be=_0x55a1be||0x1f4;return function(_0x1f115c){logger[_0x1c42('0x28')](_0x1f115c['stack']);if(_0x1f115c[_0x1c42('0x29')]){delete _0x1f115c[_0x1c42('0x29')];}_0x17efb8['status'](_0x55a1be)[_0x1c42('0x2a')](_0x1f115c);};}exports[_0x1c42('0x2b')]=function(_0xe6d28b,_0x41b589){var _0x56a662={},_0x505421={},_0x4fa4bd={'count':0x0,'rows':[]};var _0x3442cb=_[_0x1c42('0x2c')](db[_0x1c42('0x2d')]['rawAttributes'],function(_0x2011d6){return{'name':_0x2011d6[_0x1c42('0x2e')],'type':_0x2011d6[_0x1c42('0x2f')][_0x1c42('0x30')]};});_0x505421[_0x1c42('0x31')]=_[_0x1c42('0x2c')](_0x3442cb,'name');_0x505421['query']=_[_0x1c42('0x32')](_0xe6d28b[_0x1c42('0x33')]);_0x505421['filters']=_[_0x1c42('0x34')](_0x505421[_0x1c42('0x31')],_0x505421[_0x1c42('0x33')]);_0x56a662[_0x1c42('0x35')]=_[_0x1c42('0x34')](_0x505421['model'],qs[_0x1c42('0x36')](_0xe6d28b[_0x1c42('0x33')]['fields']));_0x56a662['attributes']=_0x56a662['attributes'][_0x1c42('0x37')]?_0x56a662[_0x1c42('0x35')]:_0x505421[_0x1c42('0x31')];if(!_0xe6d28b['query'][_0x1c42('0x38')](_0x1c42('0x39'))){_0x56a662[_0x1c42('0x3a')]=qs['limit'](_0xe6d28b[_0x1c42('0x33')][_0x1c42('0x3a')]);_0x56a662[_0x1c42('0x20')]=qs[_0x1c42('0x20')](_0xe6d28b[_0x1c42('0x33')][_0x1c42('0x20')]);}_0x56a662[_0x1c42('0x3b')]=qs[_0x1c42('0x3c')](_0xe6d28b[_0x1c42('0x33')]['sort']);_0x56a662[_0x1c42('0x3d')]=qs['filters'](_[_0x1c42('0x3e')](_0xe6d28b[_0x1c42('0x33')],_0x505421[_0x1c42('0x3f')]),_0x3442cb);if(_0xe6d28b[_0x1c42('0x33')][_0x1c42('0x40')]){_0x56a662['where']=_['merge'](_0x56a662[_0x1c42('0x3d')],{'$or':_[_0x1c42('0x2c')](_0x3442cb,function(_0x246d84){if(_0x246d84[_0x1c42('0x2f')]!=='VIRTUAL'){var _0x306a26={};_0x306a26[_0x246d84['name']]={'$like':'%'+_0xe6d28b['query'][_0x1c42('0x40')]+'%'};return _0x306a26;}})});}_0x56a662=_[_0x1c42('0x41')]({},_0x56a662,_0xe6d28b['options']);var _0x355494={'where':_0x56a662['where']};return db['ChatInternalMessage'][_0x1c42('0x1f')](_0x355494)[_0x1c42('0x26')](function(_0x1186a7){_0x4fa4bd[_0x1c42('0x1f')]=_0x1186a7;if(_0xe6d28b[_0x1c42('0x33')][_0x1c42('0x42')]){_0x56a662[_0x1c42('0x43')]=[{'all':!![]}];}return db[_0x1c42('0x2d')][_0x1c42('0x44')](_0x56a662);})['then'](function(_0x4900bb){_0x4fa4bd[_0x1c42('0x45')]=_0x4900bb;return _0x4fa4bd;})[_0x1c42('0x26')](respondWithFilteredResult(_0x41b589,_0x56a662))['catch'](handleError(_0x41b589,null));};exports[_0x1c42('0x46')]=function(_0x59c53e,_0x5468ee){var _0x12116a={'raw':!![],'where':{'id':_0x59c53e['params']['id']}},_0x513000={};_0x513000[_0x1c42('0x31')]=_[_0x1c42('0x32')](db[_0x1c42('0x2d')]['rawAttributes']);_0x513000['query']=_[_0x1c42('0x32')](_0x59c53e[_0x1c42('0x33')]);_0x513000[_0x1c42('0x3f')]=_[_0x1c42('0x34')](_0x513000[_0x1c42('0x31')],_0x513000[_0x1c42('0x33')]);_0x12116a[_0x1c42('0x35')]=_[_0x1c42('0x34')](_0x513000['model'],qs[_0x1c42('0x36')](_0x59c53e[_0x1c42('0x33')][_0x1c42('0x36')]));_0x12116a[_0x1c42('0x35')]=_0x12116a[_0x1c42('0x35')]['length']?_0x12116a[_0x1c42('0x35')]:_0x513000[_0x1c42('0x31')];if(_0x59c53e[_0x1c42('0x33')][_0x1c42('0x42')]){_0x12116a[_0x1c42('0x43')]=[{'all':!![]}];}_0x12116a=_[_0x1c42('0x41')]({},_0x12116a,_0x59c53e[_0x1c42('0x47')]);return db['ChatInternalMessage'][_0x1c42('0x48')](_0x12116a)[_0x1c42('0x26')](handleEntityNotFound(_0x5468ee,null))[_0x1c42('0x26')](respondWithResult(_0x5468ee,null))['catch'](handleError(_0x5468ee,null));};exports[_0x1c42('0x49')]=function(_0x194b97,_0x14ab26){return db[_0x1c42('0x2d')][_0x1c42('0x49')](_0x194b97[_0x1c42('0x4a')],{})[_0x1c42('0x26')](respondWithResult(_0x14ab26,0xc9))[_0x1c42('0x4b')](handleError(_0x14ab26,null));};exports['update']=function(_0x248ff9,_0x1a6d92){if(_0x248ff9[_0x1c42('0x4a')]['id']){delete _0x248ff9[_0x1c42('0x4a')]['id'];}return db[_0x1c42('0x2d')][_0x1c42('0x48')]({'where':{'id':_0x248ff9['params']['id']}})[_0x1c42('0x26')](handleEntityNotFound(_0x1a6d92,null))['then'](saveUpdates(_0x248ff9[_0x1c42('0x4a')],null))[_0x1c42('0x26')](respondWithResult(_0x1a6d92,null))[_0x1c42('0x4b')](handleError(_0x1a6d92,null));};exports[_0x1c42('0x27')]=function(_0x33a0fc,_0x4f5369){return db[_0x1c42('0x2d')][_0x1c42('0x48')]({'where':{'id':_0x33a0fc[_0x1c42('0x4c')]['id']}})[_0x1c42('0x26')](handleEntityNotFound(_0x4f5369,null))[_0x1c42('0x26')](removeEntity(_0x4f5369,null))[_0x1c42('0x4b')](handleError(_0x4f5369,null));};exports['describe']=function(_0x46ec5e,_0x5c1dbe){return db['ChatInternalMessage'][_0x1c42('0x4d')]()[_0x1c42('0x26')](respondWithResult(_0x5c1dbe,null))['catch'](handleError(_0x5c1dbe,null));};function wrapUser(_0xf0333a){return function(_0x141b80){var _0x4722f2=_0xf0333a[_0x1c42('0x4e')]({'plain':!![]});_0x4722f2[_0x1c42('0x4f')]=[];if(_0x141b80){_0x4722f2[_0x1c42('0x50')]=_0x141b80[_0x1c42('0x51')];_0x4722f2['lastMessage']=_0x141b80;}else{_0x4722f2[_0x1c42('0x50')]=moment(0x0)[_0x1c42('0x52')](_0x1c42('0x53'));_0x4722f2[_0x1c42('0x54')]={};}return _0x4722f2;};}exports[_0x1c42('0x55')]=function(_0x993bd,_0x4da909,_0x2a1da6){var _0x368d1c=[];return db[_0x1c42('0x56')]['findAll']({'where':{'role':[_0x1c42('0x57'),_0x1c42('0x58'),_0x1c42('0x59')]},'attributes':['id','fullname',_0x1c42('0x29'),_0x1c42('0x5a'),'userpic','internal','online',_0x1c42('0x5b'),_0x1c42('0x5c'),_0x1c42('0x5d')],'order':qs[_0x1c42('0x3c')](_0x1c42('0x5e')),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0x1c42('0x26')](function(_0x263347){if(_0x263347){var _0x4d1812=_0x993bd[_0x1c42('0x59')][_0x1c42('0x4e')]({'plain':!![]});if(!_0x4d1812)throw new Error(_0x1c42('0x5f'));if(_0x4d1812[_0x1c42('0x5a')]===_0x1c42('0x59')){return db[_0x1c42('0x60')]['find']({'where':{'name':_0x1c42('0x61'),'userProfileId':_0x4d1812[_0x1c42('0x62')]},'raw':!![]})['then'](function(_0xf0e347){if(_0xf0e347){if(_0xf0e347[_0x1c42('0x63')]===0x0){return db[_0x1c42('0x64')][_0x1c42('0x44')]({'where':{'sectionId':_0xf0e347['id']},'raw':!![]})[_0x1c42('0x26')](function(_0x111cad){var _0x566f3f=[];if(_[_0x1c42('0x65')](_0x111cad)){_0x566f3f=_[_0x1c42('0x40')](_0x263347,function(_0x1a572a){if(_0x1a572a[_0x1c42('0x5a')]!==_0x1c42('0x57')){return _0x1a572a;}});return _0x566f3f;}else{for(var _0x49d508=0x0;_0x49d508<_0x263347['length'];_0x49d508++){var _0x459415=_0x263347[_0x49d508];if(_0x459415[_0x1c42('0x5a')]===_0x1c42('0x57')){var _0x15f71b=_[_0x1c42('0x48')](_0x111cad,function(_0x46ebd2){return _0x46ebd2[_0x1c42('0x66')]===_0x459415['id'];});if(_0x15f71b)_0x566f3f[_0x1c42('0x67')](_0x459415);}else{_0x566f3f[_0x1c42('0x67')](_0x459415);}}return _0x566f3f;}});}else{return _0x263347;}}else{var _0x41cef4=_[_0x1c42('0x40')](_0x263347,function(_0x14d965){if(_0x14d965[_0x1c42('0x5a')]!==_0x1c42('0x57')){return _0x14d965;}});return _0x41cef4;}});}else{return _0x263347;}}})[_0x1c42('0x26')](function(_0x53e9b0){var _0x4b45d3=[];if(_0x53e9b0){_0x368d1c=_0x53e9b0;for(var _0xa4151b=0x0;_0xa4151b<_0x53e9b0[_0x1c42('0x37')];_0xa4151b+=0x1){_0x368d1c[_0xa4151b][_0x1c42('0x4f')]=[];_0x4b45d3[_0x1c42('0x67')](db[_0x1c42('0x2d')][_0x1c42('0x48')]({'where':{'FromId':[_0x993bd[_0x1c42('0x59')]['id'],_0x53e9b0[_0xa4151b]['id']],'ToId':[_0x993bd[_0x1c42('0x59')]['id'],_0x53e9b0[_0xa4151b]['id']],'ChatGroupId':null},'attributes':['id',_0x1c42('0x51'),_0x1c42('0x68'),_0x1c42('0x69'),_0x1c42('0x6a'),'body'],'order':qs[_0x1c42('0x3c')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x53e9b0[_0xa4151b])));}return BPromise[_0x1c42('0x6b')](_0x4b45d3);}return[];})[_0x1c42('0x26')](function(_0x3b53bb){return{'rows':_0x3b53bb,'count':_0x3b53bb[_0x1c42('0x37')]};})[_0x1c42('0x26')](respondWithResult(_0x4da909,null))[_0x1c42('0x4b')](handleError(_0x4da909,null));}; \ No newline at end of file +var _0x9928=['update','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','rows','catch','params','create','body','find','describe','get','messages','lastMessage','lastMessageAt','format','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','findAll','isEmpty','resourceId','push','createdAt','FromId','ToId','read','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x9928,0x133));var _0x8992=function(_0x5e11ff,_0x247853){_0x5e11ff=_0x5e11ff-0x0;var _0x38498e=_0x9928[_0x5e11ff];return _0x38498e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8992('0x0'));var rimraf=require(_0x8992('0x1'));var zipdir=require(_0x8992('0x2'));var jsonpatch=require(_0x8992('0x3'));var rp=require(_0x8992('0x4'));var moment=require(_0x8992('0x5'));var BPromise=require(_0x8992('0x6'));var Mustache=require('mustache');var util=require(_0x8992('0x7'));var path=require(_0x8992('0x8'));var sox=require(_0x8992('0x9'));var csv=require(_0x8992('0xa'));var ejs=require(_0x8992('0xb'));var fs=require('fs');var _=require(_0x8992('0xc'));var squel=require(_0x8992('0xd'));var crypto=require(_0x8992('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8992('0xa'));var querystring=require(_0x8992('0xf'));var Papa=require(_0x8992('0x10'));var Redis=require(_0x8992('0x11'));var authService=require(_0x8992('0x12'));var qs=require(_0x8992('0x13'));var as=require(_0x8992('0x14'));var hardwareService=require(_0x8992('0x15'));var logger=require(_0x8992('0x16'))(_0x8992('0x17'));var utils=require(_0x8992('0x18'));var config=require(_0x8992('0x19'));var db=require(_0x8992('0x1a'))['db'];config[_0x8992('0x1b')]=_[_0x8992('0x1c')](config[_0x8992('0x1b')],{'host':_0x8992('0x1d'),'port':0x18eb});var socket=require(_0x8992('0x1e'))(new Redis(config[_0x8992('0x1b')]));require(_0x8992('0x1f'))['register'](socket);function respondWithStatusCode(_0x4fb75a,_0xde4e1){_0xde4e1=_0xde4e1||0xcc;return function(_0x3df824){if(_0x3df824){return _0x4fb75a[_0x8992('0x20')](_0xde4e1);}return _0x4fb75a[_0x8992('0x21')](_0xde4e1)[_0x8992('0x22')]();};}function respondWithResult(_0x1c4aa8,_0x56774b){_0x56774b=_0x56774b||0xc8;return function(_0x3a5900){if(_0x3a5900){return _0x1c4aa8['status'](_0x56774b)[_0x8992('0x23')](_0x3a5900);}};}function respondWithFilteredResult(_0x18bbaa,_0x1164ee){return function(_0xb30eee){if(_0xb30eee){var _0x335aa8=_0xb30eee[_0x8992('0x24')],_0x1748ae=_0x1164ee[_0x8992('0x25')],_0x4bb760=_0x1164ee['offset']+_0x1164ee[_0x8992('0x26')],_0x583803;if(_0x4bb760>=_0x335aa8){_0x4bb760=_0x335aa8;_0x583803=0xc8;}else{_0x583803=0xce;}_0x18bbaa[_0x8992('0x21')](_0x583803);return _0x18bbaa[_0x8992('0x27')](_0x8992('0x28'),_0x1748ae+'-'+_0x4bb760+'/'+_0x335aa8)[_0x8992('0x23')](_0xb30eee);}return null;};}function patchUpdates(_0x3c8f04){return function(_0x14d873){try{jsonpatch[_0x8992('0x29')](_0x14d873,_0x3c8f04,!![]);}catch(_0x1cbe6d){return BPromise[_0x8992('0x2a')](_0x1cbe6d);}return _0x14d873[_0x8992('0x2b')]();};}function saveUpdates(_0x4d56d5,_0x45f9ff){return function(_0x4f127c){if(_0x4f127c){return _0x4f127c[_0x8992('0x2c')](_0x4d56d5)[_0x8992('0x2d')](function(_0x4944db){return _0x4944db;});}return null;};}function removeEntity(_0x34061e,_0x31cfa6){return function(_0x482e9a){if(_0x482e9a){return _0x482e9a[_0x8992('0x2e')]()[_0x8992('0x2d')](function(){_0x34061e[_0x8992('0x21')](0xcc)[_0x8992('0x22')]();});}};}function handleEntityNotFound(_0x3127d4,_0x532bc6){return function(_0x3d70ae){if(!_0x3d70ae){_0x3127d4['sendStatus'](0x194);}return _0x3d70ae;};}function handleError(_0x4bf8e9,_0x401080){_0x401080=_0x401080||0x1f4;return function(_0xe9f29c){logger[_0x8992('0x2f')](_0xe9f29c[_0x8992('0x30')]);if(_0xe9f29c['name']){delete _0xe9f29c[_0x8992('0x31')];}_0x4bf8e9[_0x8992('0x21')](_0x401080)[_0x8992('0x32')](_0xe9f29c);};}exports[_0x8992('0x33')]=function(_0x30cd62,_0x4e7658){var _0x15f34a={},_0x740ee9={},_0x4704cf={'count':0x0,'rows':[]};var _0x59e224=_[_0x8992('0x34')](db[_0x8992('0x35')][_0x8992('0x36')],function(_0x264cee){return{'name':_0x264cee[_0x8992('0x37')],'type':_0x264cee[_0x8992('0x38')][_0x8992('0x39')]};});_0x740ee9['model']=_[_0x8992('0x34')](_0x59e224,_0x8992('0x31'));_0x740ee9[_0x8992('0x3a')]=_[_0x8992('0x3b')](_0x30cd62[_0x8992('0x3a')]);_0x740ee9[_0x8992('0x3c')]=_[_0x8992('0x3d')](_0x740ee9[_0x8992('0x3e')],_0x740ee9[_0x8992('0x3a')]);_0x15f34a[_0x8992('0x3f')]=_[_0x8992('0x3d')](_0x740ee9[_0x8992('0x3e')],qs[_0x8992('0x40')](_0x30cd62[_0x8992('0x3a')][_0x8992('0x40')]));_0x15f34a[_0x8992('0x3f')]=_0x15f34a[_0x8992('0x3f')][_0x8992('0x41')]?_0x15f34a[_0x8992('0x3f')]:_0x740ee9[_0x8992('0x3e')];if(!_0x30cd62[_0x8992('0x3a')][_0x8992('0x42')](_0x8992('0x43'))){_0x15f34a[_0x8992('0x26')]=qs[_0x8992('0x26')](_0x30cd62[_0x8992('0x3a')][_0x8992('0x26')]);_0x15f34a[_0x8992('0x25')]=qs['offset'](_0x30cd62[_0x8992('0x3a')][_0x8992('0x25')]);}_0x15f34a['order']=qs[_0x8992('0x44')](_0x30cd62[_0x8992('0x3a')][_0x8992('0x44')]);_0x15f34a[_0x8992('0x45')]=qs[_0x8992('0x3c')](_['pick'](_0x30cd62['query'],_0x740ee9['filters']),_0x59e224);if(_0x30cd62[_0x8992('0x3a')][_0x8992('0x46')]){_0x15f34a[_0x8992('0x45')]=_['merge'](_0x15f34a[_0x8992('0x45')],{'$or':_[_0x8992('0x34')](_0x59e224,function(_0x1f729b){if(_0x1f729b[_0x8992('0x38')]!==_0x8992('0x47')){var _0x549347={};_0x549347[_0x1f729b[_0x8992('0x31')]]={'$like':'%'+_0x30cd62[_0x8992('0x3a')]['filter']+'%'};return _0x549347;}})});}_0x15f34a=_[_0x8992('0x48')]({},_0x15f34a,_0x30cd62[_0x8992('0x49')]);var _0x1e64ca={'where':_0x15f34a[_0x8992('0x45')]};return db[_0x8992('0x35')][_0x8992('0x24')](_0x1e64ca)[_0x8992('0x2d')](function(_0x1a1d2e){_0x4704cf[_0x8992('0x24')]=_0x1a1d2e;if(_0x30cd62[_0x8992('0x3a')][_0x8992('0x4a')]){_0x15f34a['include']=[{'all':!![]}];}return db[_0x8992('0x35')]['findAll'](_0x15f34a);})['then'](function(_0x5787d8){_0x4704cf[_0x8992('0x4b')]=_0x5787d8;return _0x4704cf;})[_0x8992('0x2d')](respondWithFilteredResult(_0x4e7658,_0x15f34a))[_0x8992('0x4c')](handleError(_0x4e7658,null));};exports['show']=function(_0x5ee4a7,_0x20a38d){var _0xc86739={'raw':!![],'where':{'id':_0x5ee4a7[_0x8992('0x4d')]['id']}},_0x28c366={};_0x28c366[_0x8992('0x3e')]=_[_0x8992('0x3b')](db[_0x8992('0x35')][_0x8992('0x36')]);_0x28c366[_0x8992('0x3a')]=_[_0x8992('0x3b')](_0x5ee4a7[_0x8992('0x3a')]);_0x28c366[_0x8992('0x3c')]=_['intersection'](_0x28c366[_0x8992('0x3e')],_0x28c366['query']);_0xc86739[_0x8992('0x3f')]=_['intersection'](_0x28c366[_0x8992('0x3e')],qs[_0x8992('0x40')](_0x5ee4a7[_0x8992('0x3a')][_0x8992('0x40')]));_0xc86739[_0x8992('0x3f')]=_0xc86739[_0x8992('0x3f')][_0x8992('0x41')]?_0xc86739['attributes']:_0x28c366[_0x8992('0x3e')];if(_0x5ee4a7['query'][_0x8992('0x4a')]){_0xc86739['include']=[{'all':!![]}];}_0xc86739=_['merge']({},_0xc86739,_0x5ee4a7[_0x8992('0x49')]);return db[_0x8992('0x35')]['find'](_0xc86739)[_0x8992('0x2d')](handleEntityNotFound(_0x20a38d,null))['then'](respondWithResult(_0x20a38d,null))['catch'](handleError(_0x20a38d,null));};exports[_0x8992('0x4e')]=function(_0x290c19,_0x20976d){return db[_0x8992('0x35')]['create'](_0x290c19[_0x8992('0x4f')],{})['then'](respondWithResult(_0x20976d,0xc9))[_0x8992('0x4c')](handleError(_0x20976d,null));};exports['update']=function(_0x4209d6,_0x5669e8){if(_0x4209d6[_0x8992('0x4f')]['id']){delete _0x4209d6['body']['id'];}return db[_0x8992('0x35')][_0x8992('0x50')]({'where':{'id':_0x4209d6[_0x8992('0x4d')]['id']}})[_0x8992('0x2d')](handleEntityNotFound(_0x5669e8,null))[_0x8992('0x2d')](saveUpdates(_0x4209d6[_0x8992('0x4f')],null))[_0x8992('0x2d')](respondWithResult(_0x5669e8,null))['catch'](handleError(_0x5669e8,null));};exports[_0x8992('0x2e')]=function(_0x2111ae,_0x3ed891){return db[_0x8992('0x35')][_0x8992('0x50')]({'where':{'id':_0x2111ae[_0x8992('0x4d')]['id']}})[_0x8992('0x2d')](handleEntityNotFound(_0x3ed891,null))['then'](removeEntity(_0x3ed891,null))['catch'](handleError(_0x3ed891,null));};exports[_0x8992('0x51')]=function(_0x2730ef,_0x17cbdc){return db[_0x8992('0x35')][_0x8992('0x51')]()[_0x8992('0x2d')](respondWithResult(_0x17cbdc,null))[_0x8992('0x4c')](handleError(_0x17cbdc,null));};function wrapUser(_0x1aad4e){return function(_0x421e1e){var _0xe3d1a3=_0x1aad4e[_0x8992('0x52')]({'plain':!![]});_0xe3d1a3[_0x8992('0x53')]=[];if(_0x421e1e){_0xe3d1a3['lastMessageAt']=_0x421e1e['createdAt'];_0xe3d1a3[_0x8992('0x54')]=_0x421e1e;}else{_0xe3d1a3[_0x8992('0x55')]=moment(0x0)[_0x8992('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0xe3d1a3[_0x8992('0x54')]={};}return _0xe3d1a3;};}exports[_0x8992('0x57')]=function(_0x31a278,_0x2de351,_0x320380){var _0x4df7c1=[];return db[_0x8992('0x58')]['findAll']({'where':{'role':[_0x8992('0x59'),_0x8992('0x5a'),_0x8992('0x5b')]},'attributes':['id',_0x8992('0x5c'),_0x8992('0x31'),_0x8992('0x5d'),_0x8992('0x5e'),_0x8992('0x5f'),_0x8992('0x60'),_0x8992('0x61'),_0x8992('0x62'),_0x8992('0x63')],'order':qs[_0x8992('0x44')](_0x8992('0x64')),'include':[{'model':db['VoiceQueue'],'as':_0x8992('0x65'),'attributes':['id',_0x8992('0x31'),_0x8992('0x38')],'through':{'attributes':[]}}]})[_0x8992('0x2d')](function(_0x462f48){if(_0x462f48){var _0x486edf=_0x31a278[_0x8992('0x5b')][_0x8992('0x52')]({'plain':!![]});if(!_0x486edf)throw new Error(_0x8992('0x66'));if(_0x486edf[_0x8992('0x5d')]===_0x8992('0x5b')){return db[_0x8992('0x67')][_0x8992('0x50')]({'where':{'name':_0x8992('0x68'),'userProfileId':_0x486edf[_0x8992('0x69')]},'raw':!![]})['then'](function(_0x1b4f61){if(_0x1b4f61){if(_0x1b4f61[_0x8992('0x6a')]===0x0){return db[_0x8992('0x6b')][_0x8992('0x6c')]({'where':{'sectionId':_0x1b4f61['id']},'raw':!![]})['then'](function(_0x27f63f){var _0xf30dd6=[];if(_[_0x8992('0x6d')](_0x27f63f)){_0xf30dd6=_['filter'](_0x462f48,function(_0x33a437){if(_0x33a437['role']!==_0x8992('0x59')){return _0x33a437;}});return _0xf30dd6;}else{for(var _0x42c4ea=0x0;_0x42c4ea<_0x462f48[_0x8992('0x41')];_0x42c4ea++){var _0x2f453f=_0x462f48[_0x42c4ea];if(_0x2f453f[_0x8992('0x5d')]==='agent'){var _0xdd22fc=_[_0x8992('0x50')](_0x27f63f,function(_0x290593){return _0x290593[_0x8992('0x6e')]===_0x2f453f['id'];});if(_0xdd22fc)_0xf30dd6[_0x8992('0x6f')](_0x2f453f);}else{_0xf30dd6[_0x8992('0x6f')](_0x2f453f);}}return _0xf30dd6;}});}else{return _0x462f48;}}else{var _0x46b999=_[_0x8992('0x46')](_0x462f48,function(_0x120ef2){if(_0x120ef2[_0x8992('0x5d')]!==_0x8992('0x59')){return _0x120ef2;}});return _0x46b999;}});}else{return _0x462f48;}}})[_0x8992('0x2d')](function(_0x38d5fa){var _0x3b52f8=[];if(_0x38d5fa){_0x4df7c1=_0x38d5fa;for(var _0x3c1be8=0x0;_0x3c1be8<_0x38d5fa[_0x8992('0x41')];_0x3c1be8+=0x1){_0x4df7c1[_0x3c1be8][_0x8992('0x53')]=[];_0x3b52f8[_0x8992('0x6f')](db[_0x8992('0x35')][_0x8992('0x50')]({'where':{'FromId':[_0x31a278[_0x8992('0x5b')]['id'],_0x38d5fa[_0x3c1be8]['id']],'ToId':[_0x31a278[_0x8992('0x5b')]['id'],_0x38d5fa[_0x3c1be8]['id']],'ChatGroupId':null},'attributes':['id',_0x8992('0x70'),_0x8992('0x71'),_0x8992('0x72'),_0x8992('0x73'),_0x8992('0x4f')],'order':qs[_0x8992('0x44')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x38d5fa[_0x3c1be8])));}return BPromise[_0x8992('0x74')](_0x3b52f8);}return[];})['then'](function(_0x238451){return{'rows':_0x238451,'count':_0x238451[_0x8992('0x41')]};})[_0x8992('0x2d')](respondWithResult(_0x2de351,null))['catch'](handleError(_0x2de351,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index f5a01f3..b17104c 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 _0xd89f=['exports','events','../../mysqldb','ChatInternalMessage','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x22bea9,_0x26d3a8){var _0x432864=function(_0x2aa3c9){while(--_0x2aa3c9){_0x22bea9['push'](_0x22bea9['shift']());}};_0x432864(++_0x26d3a8);}(_0xd89f,0x191));var _0xfd89=function(_0x4a6cb5,_0x826f84){_0x4a6cb5=_0x4a6cb5-0x0;var _0x1a4304=_0xd89f[_0x4a6cb5];return _0x1a4304;};'use strict';var EventEmitter=require(_0xfd89('0x0'));var ChatInternalMessage=require(_0xfd89('0x1'))['db'][_0xfd89('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfd89('0x3'),'afterUpdate':_0xfd89('0x4'),'afterDestroy':_0xfd89('0x5')};function emitEvent(_0x2ff053){return function(_0x3de2e2,_0x15bdb8,_0x4e6429){ChatInternalMessageEvents[_0xfd89('0x6')](_0x2ff053+':'+_0x3de2e2['id'],_0x3de2e2);ChatInternalMessageEvents[_0xfd89('0x6')](_0x2ff053,_0x3de2e2);_0x4e6429(null);};}for(var e in events){if(events[_0xfd89('0x7')](e)){var event=events[e];ChatInternalMessage[_0xfd89('0x8')](e,emitEvent(event));}}module[_0xfd89('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x795a=['exports','../../mysqldb','ChatInternalMessage','save','remove','emit','hasOwnProperty'];(function(_0x5c57ec,_0x446c94){var _0x194a7e=function(_0x37234c){while(--_0x37234c){_0x5c57ec['push'](_0x5c57ec['shift']());}};_0x194a7e(++_0x446c94);}(_0x795a,0xa2));var _0xa795=function(_0x1d3f0f,_0x405fd9){_0x1d3f0f=_0x1d3f0f-0x0;var _0xf59940=_0x795a[_0x1d3f0f];return _0xf59940;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0xa795('0x0'))['db'][_0xa795('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa795('0x2'),'afterUpdate':'update','afterDestroy':_0xa795('0x3')};function emitEvent(_0x1651a6){return function(_0x4ce3a0,_0x4f7e4e,_0x174575){ChatInternalMessageEvents[_0xa795('0x4')](_0x1651a6+':'+_0x4ce3a0['id'],_0x4ce3a0);ChatInternalMessageEvents[_0xa795('0x4')](_0x1651a6,_0x4ce3a0);_0x174575(null);};}for(var e in events){if(events[_0xa795('0x5')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xa795('0x6')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 18360d2..5598f46 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 _0x4f94=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x2d1ca8,_0x4fec84){var _0x281dab=function(_0x34a5c9){while(--_0x34a5c9){_0x2d1ca8['push'](_0x2d1ca8['shift']());}};_0x281dab(++_0x4fec84);}(_0x4f94,0xb4));var _0x44f9=function(_0x13a976,_0x4fdf68){_0x13a976=_0x13a976-0x0;var _0x203b86=_0x4f94[_0x13a976];return _0x203b86;};'use strict';var _=require(_0x44f9('0x0'));var util=require(_0x44f9('0x1'));var logger=require(_0x44f9('0x2'))(_0x44f9('0x3'));var moment=require('moment');var BPromise=require(_0x44f9('0x4'));var rp=require(_0x44f9('0x5'));var fs=require('fs');var path=require(_0x44f9('0x6'));var rimraf=require(_0x44f9('0x7'));var config=require('../../config/environment');var attributes=require(_0x44f9('0x8'));module[_0x44f9('0x9')]=function(_0x292cae,_0x2d2c5e){return _0x292cae[_0x44f9('0xa')](_0x44f9('0xb'),attributes,{'tableName':_0x44f9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x44f9('0xd'),'collate':_0x44f9('0xe')});}; \ No newline at end of file +var _0xaa0a=['utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4'];(function(_0x4c7c34,_0x3dc408){var _0xcdb1f4=function(_0x6f35fc){while(--_0x6f35fc){_0x4c7c34['push'](_0x4c7c34['shift']());}};_0xcdb1f4(++_0x3dc408);}(_0xaa0a,0x1ef));var _0xaaa0=function(_0x363db4,_0x81f87c){_0x363db4=_0x363db4-0x0;var _0x333b81=_0xaa0a[_0x363db4];return _0x333b81;};'use strict';var _=require(_0xaaa0('0x0'));var util=require(_0xaaa0('0x1'));var logger=require('../../config/logger')(_0xaaa0('0x2'));var moment=require(_0xaaa0('0x3'));var BPromise=require('bluebird');var rp=require(_0xaaa0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaaa0('0x5'));var attributes=require(_0xaaa0('0x6'));module[_0xaaa0('0x7')]=function(_0x42ca37,_0x1c7fd1){return _0x42ca37[_0xaaa0('0x8')](_0xaaa0('0x9'),attributes,{'tableName':_0xaaa0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xaaa0('0xb'),'collate':_0xaaa0('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 6a0e299..119535a 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 _0x9217=['randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x9217,0x127));var _0x7921=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9217[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7921('0x0'));var moment=require('moment');var BPromise=require(_0x7921('0x1'));var rs=require(_0x7921('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7921('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7921('0x4'));var config=require(_0x7921('0x5'));var jayson=require(_0x7921('0x6'));var client=jayson[_0x7921('0x7')][_0x7921('0x8')]({'port':0x232a});config[_0x7921('0x9')]=_[_0x7921('0xa')](config['redis'],{'host':_0x7921('0xb'),'port':0x18eb});var socket=require(_0x7921('0xc'))(new Redis(config[_0x7921('0x9')]));require('./chatInternalMessage.socket')[_0x7921('0xd')](socket);function respondWithRpcPromise(_0x2bcedd,_0x102c8a,_0x4d0921){return new BPromise(function(_0x3c230a,_0x200709){return client[_0x7921('0xe')](_0x2bcedd,_0x4d0921)[_0x7921('0xf')](function(_0x54deb8){logger[_0x7921('0x10')](_0x7921('0x11'),_0x102c8a,_0x7921('0x12'));logger[_0x7921('0x13')](_0x7921('0x14'),_0x102c8a,_0x7921('0x12'),JSON[_0x7921('0x15')](_0x54deb8));if(_0x54deb8[_0x7921('0x16')]){if(_0x54deb8['error'][_0x7921('0x17')]===0x1f4){logger[_0x7921('0x16')](_0x7921('0x11'),_0x102c8a,_0x54deb8[_0x7921('0x16')][_0x7921('0x18')]);return _0x200709(_0x54deb8['error']['message']);}logger[_0x7921('0x16')](_0x7921('0x11'),_0x102c8a,_0x54deb8[_0x7921('0x16')]['message']);return _0x3c230a(_0x54deb8[_0x7921('0x16')]['message']);}else{logger[_0x7921('0x10')](_0x7921('0x11'),_0x102c8a,_0x7921('0x12'));_0x3c230a(_0x54deb8[_0x7921('0x19')][_0x7921('0x18')]);}})[_0x7921('0x1a')](function(_0x44db78){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x102c8a,_0x44db78);_0x200709(_0x44db78);});});} \ No newline at end of file +var _0x5813=['request','info','request\x20sent','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x3629d9,_0x1b27a4){var _0x4503f4=function(_0x4fda73){while(--_0x4fda73){_0x3629d9['push'](_0x3629d9['shift']());}};_0x4503f4(++_0x1b27a4);}(_0x5813,0x194));var _0x3581=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5813[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x3581('0x0'));var moment=require(_0x3581('0x1'));var BPromise=require(_0x3581('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3581('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3581('0x4'))(_0x3581('0x5'));var config=require(_0x3581('0x6'));var jayson=require(_0x3581('0x7'));var client=jayson[_0x3581('0x8')][_0x3581('0x9')]({'port':0x232a});config[_0x3581('0xa')]=_[_0x3581('0xb')](config[_0x3581('0xa')],{'host':_0x3581('0xc'),'port':0x18eb});var socket=require(_0x3581('0xd'))(new Redis(config[_0x3581('0xa')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x61d4d3,_0xd69987,_0x2bb7d4){return new BPromise(function(_0x548b61,_0x3e0bb5){return client[_0x3581('0xe')](_0x61d4d3,_0x2bb7d4)['then'](function(_0x6de4c){logger[_0x3581('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0xd69987,_0x3581('0x10'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0xd69987,_0x3581('0x10'),JSON[_0x3581('0x11')](_0x6de4c));if(_0x6de4c[_0x3581('0x12')]){if(_0x6de4c[_0x3581('0x12')][_0x3581('0x13')]===0x1f4){logger[_0x3581('0x12')](_0x3581('0x14'),_0xd69987,_0x6de4c[_0x3581('0x12')][_0x3581('0x15')]);return _0x3e0bb5(_0x6de4c[_0x3581('0x12')][_0x3581('0x15')]);}logger[_0x3581('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0xd69987,_0x6de4c[_0x3581('0x12')]['message']);return _0x548b61(_0x6de4c['error'][_0x3581('0x15')]);}else{logger[_0x3581('0xf')](_0x3581('0x14'),_0xd69987,_0x3581('0x10'));_0x548b61(_0x6de4c['result'][_0x3581('0x15')]);}})['catch'](function(_0x27d6d0){logger[_0x3581('0x12')](_0x3581('0x14'),_0xd69987,_0x27d6d0);_0x3e0bb5(_0x27d6d0);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 7082b96..536f0ee 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 _0x5640=['./chatInternalMessage.events','remove','update','emit','removeListener','register','chatInternalMessage:'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5640,0x111));var _0x0564=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5640[_0x59ee6f];return _0x4c0979;};'use strict';var ChatInternalMessageEvents=require(_0x0564('0x0'));var events=['save',_0x0564('0x1'),_0x0564('0x2')];function createListener(_0x8ebafe,_0xa50680){return function(_0xc558b4){_0xa50680[_0x0564('0x3')](_0x8ebafe,_0xc558b4);};}function removeListener(_0x1cbb9d,_0x1c229d){return function(){ChatInternalMessageEvents[_0x0564('0x4')](_0x1cbb9d,_0x1c229d);};}exports[_0x0564('0x5')]=function(_0x23566f){for(var _0x1260bf=0x0,_0x3deac1=events['length'];_0x1260bf<_0x3deac1;_0x1260bf++){var _0x52b032=events[_0x1260bf];var _0x9e3a60=createListener(_0x0564('0x6')+_0x52b032,_0x23566f);ChatInternalMessageEvents['on'](_0x52b032,_0x9e3a60);}}; \ No newline at end of file +var _0x5bbd=['remove','update','removeListener','register','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x2de170,_0x4055e1){var _0x175829=function(_0x716581){while(--_0x716581){_0x2de170['push'](_0x2de170['shift']());}};_0x175829(++_0x4055e1);}(_0x5bbd,0x12b));var _0xd5bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bbd[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInternalMessageEvents=require(_0xd5bb('0x0'));var events=[_0xd5bb('0x1'),_0xd5bb('0x2'),_0xd5bb('0x3')];function createListener(_0x31b4a1,_0x44487d){return function(_0x179bab){_0x44487d['emit'](_0x31b4a1,_0x179bab);};}function removeListener(_0x5db64a,_0x4a4799){return function(){ChatInternalMessageEvents[_0xd5bb('0x4')](_0x5db64a,_0x4a4799);};}exports[_0xd5bb('0x5')]=function(_0x489e3d){for(var _0x520c77=0x0,_0x292873=events['length'];_0x520c77<_0x292873;_0x520c77++){var _0x3878ba=events[_0x520c77];var _0x17c08f=createListener(_0xd5bb('0x6')+_0x3878ba,_0x489e3d);ChatInternalMessageEvents['on'](_0x3878ba,_0x17c08f);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 88d413a..fbd3938 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 _0x9c44=['express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/users','getUsers','show','post','create','put','delete','/:id','destroy','exports','path','connect-timeout'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'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('./chatInternalMessage.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',auth['isAuthenticated'](),controller[_0x49c4('0xd')]);router[_0x49c4('0xe')]('/',auth['isAuthenticated'](),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',controller['update']);router[_0x49c4('0x11')](_0x49c4('0x12'),auth['isAuthenticated'](),controller[_0x49c4('0x13')]);module[_0x49c4('0x14')]=router; \ No newline at end of file +var _0xe706=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x4627bd,_0x15b3ae){var _0x4d7e38=function(_0x205b88){while(--_0x205b88){_0x4627bd['push'](_0x4627bd['shift']());}};_0x4d7e38(++_0x15b3ae);}(_0xe706,0xa3));var _0x6e70=function(_0x46c6a2,_0x441de6){_0x46c6a2=_0x46c6a2-0x0;var _0x3d6fe8=_0xe706[_0x46c6a2];return _0x3d6fe8;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var auth=require(_0x6e70('0x5'));var interaction=require(_0x6e70('0x6'));var config=require(_0x6e70('0x7'));var controller=require(_0x6e70('0x8'));router[_0x6e70('0x9')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x9')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x9')](_0x6e70('0xe'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xf')]);router[_0x6e70('0x9')](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x12')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0x13')]);router['put']('/:id',controller[_0x6e70('0x14')]);router[_0x6e70('0x15')](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x16')]);module[_0x6e70('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index f834f64..63e2d4f 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 _0xf8b2=['exports','medium','ENUM','out','DATE','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf8b2,0x143));var _0x2f8b=function(_0x5a2d95,_0xb362e5){_0x5a2d95=_0x5a2d95-0x0;var _0x2c3986=_0xf8b2[_0x5a2d95];return _0x2c3986;};'use strict';var Sequelize=require(_0x2f8b('0x0'));module[_0x2f8b('0x1')]={'body':{'type':Sequelize['TEXT'](_0x2f8b('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x2f8b('0x3')]('in',_0x2f8b('0x4')),'defaultValue':_0x2f8b('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x2f8b('0x5')]}}; \ No newline at end of file +var _0x314e=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','DATE'];(function(_0x2ba7e0,_0x323ef0){var _0x3359f8=function(_0x2aedec){while(--_0x2aedec){_0x2ba7e0['push'](_0x2ba7e0['shift']());}};_0x3359f8(++_0x323ef0);}(_0x314e,0xd2));var _0xe314=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x314e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xe314('0x0'));module[_0xe314('0x1')]={'body':{'type':Sequelize[_0xe314('0x2')](_0xe314('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe314('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xe314('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe314('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xe314('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 1e69869..2a6563a 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 _0xa1ec=['defaults','localhost','./chatMessage.socket','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','update','destroy','end','stack','name','index','map','ChatMessage','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','create','body','describe','chat','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','ChatInteractionId','isNil','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','parse','formData','chat-interactions','agent','ChatInteraction','role','null','RejectMessage','rejectMessage','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','redis'];(function(_0x3a4f1d,_0x57cccd){var _0x580f0e=function(_0x380dea){while(--_0x380dea){_0x3a4f1d['push'](_0x3a4f1d['shift']());}};_0x580f0e(++_0x57cccd);}(_0xa1ec,0xdc));var _0xca1e=function(_0x2281a5,_0x2e5c6f){_0x2281a5=_0x2281a5-0x0;var _0x3d934d=_0xa1ec[_0x2281a5];return _0x3d934d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xca1e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xca1e('0x1'));var jsonpatch=require(_0xca1e('0x2'));var rp=require(_0xca1e('0x3'));var moment=require(_0xca1e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xca1e('0x5'));var sox=require(_0xca1e('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xca1e('0x7'));var squel=require(_0xca1e('0x8'));var crypto=require(_0xca1e('0x9'));var jsforce=require(_0xca1e('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xca1e('0xb'));var Papa=require(_0xca1e('0xc'));var Redis=require(_0xca1e('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xca1e('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca1e('0xf'));var logger=require('../../config/logger')(_0xca1e('0x10'));var utils=require(_0xca1e('0x11'));var config=require(_0xca1e('0x12'));var db=require('../../mysqldb')['db'];config[_0xca1e('0x13')]=_[_0xca1e('0x14')](config[_0xca1e('0x13')],{'host':_0xca1e('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xca1e('0x16'))['register'](socket);var jayson=require(_0xca1e('0x17'));var client=jayson[_0xca1e('0x18')][_0xca1e('0x19')]({'port':0x232c});var client9002=jayson[_0xca1e('0x18')][_0xca1e('0x19')]({'port':0x232a});function checkPasswordPattern(_0xa373c6,_0x4411c2,_0x2c5e6c){if(_0x2c5e6c){var _0x57616b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x57616b[_0xca1e('0x1a')](_0x4411c2)){return _0xa373c6;}else{throw new db[(_0xca1e('0x1b'))]['ValidationError'](_0xca1e('0x1c'));}}else{return _0xa373c6;}}function respondWithRpcPromise(_0x3afdc1,_0x41e02c,_0x139c6d,_0x236033){return new BPromise(function(_0x44d4af,_0x49705b){var _0x319706=_0x236033||client;return _0x319706[_0xca1e('0x1d')](_0x3afdc1,_0x139c6d)[_0xca1e('0x1e')](function(_0x305285){logger['info'](_0xca1e('0x1f'),_0x41e02c,'request\x20sent');logger['debug'](_0xca1e('0x20'),_0x41e02c,_0xca1e('0x21'),JSON[_0xca1e('0x22')](_0x305285));if(_0x305285[_0xca1e('0x23')]){if(_0x305285[_0xca1e('0x23')][_0xca1e('0x24')]===0x1f4){logger[_0xca1e('0x23')](_0xca1e('0x1f'),_0x41e02c,_0x305285['error'][_0xca1e('0x25')]);return _0x49705b(_0x305285[_0xca1e('0x23')]['message']);}logger[_0xca1e('0x23')](_0xca1e('0x1f'),_0x41e02c,_0x305285[_0xca1e('0x23')][_0xca1e('0x25')]);return _0x44d4af(_0x305285[_0xca1e('0x23')][_0xca1e('0x25')]);}else{logger[_0xca1e('0x26')](_0xca1e('0x1f'),_0x41e02c,_0xca1e('0x21'));_0x44d4af(_0x305285[_0xca1e('0x27')][_0xca1e('0x25')]);}})[_0xca1e('0x28')](function(_0x84717f){logger[_0xca1e('0x23')](_0xca1e('0x1f'),_0x41e02c,_0x84717f);_0x49705b(_0x84717f);});});}function respondWithStatusCode(_0x23fc37,_0x2bfdbf){_0x2bfdbf=_0x2bfdbf||0xcc;return function(_0x30440a){if(_0x30440a){return _0x23fc37[_0xca1e('0x29')](_0x2bfdbf);}return _0x23fc37[_0xca1e('0x2a')](_0x2bfdbf)['end']();};}function respondWithResult(_0x32b826,_0x1dadb1){_0x1dadb1=_0x1dadb1||0xc8;return function(_0x321b85){if(_0x321b85){return _0x32b826[_0xca1e('0x2a')](_0x1dadb1)[_0xca1e('0x2b')](_0x321b85);}};}function respondWithFilteredResult(_0x13a316,_0x45bfe5){return function(_0x3268fd){if(_0x3268fd){var _0xb9d1db=_0x3268fd['count'],_0x4418ce=_0x45bfe5[_0xca1e('0x2c')],_0x476661=_0x45bfe5[_0xca1e('0x2c')]+_0x45bfe5[_0xca1e('0x2d')],_0x31ae1f;if(_0x476661>=_0xb9d1db){_0x476661=_0xb9d1db;_0x31ae1f=0xc8;}else{_0x31ae1f=0xce;}_0x13a316[_0xca1e('0x2a')](_0x31ae1f);return _0x13a316['set'](_0xca1e('0x2e'),_0x4418ce+'-'+_0x476661+'/'+_0xb9d1db)[_0xca1e('0x2b')](_0x3268fd);}return null;};}function patchUpdates(_0x30a529){return function(_0x13bac4){try{jsonpatch[_0xca1e('0x2f')](_0x13bac4,_0x30a529,!![]);}catch(_0x4aa537){return BPromise[_0xca1e('0x30')](_0x4aa537);}return _0x13bac4[_0xca1e('0x31')]();};}function saveUpdates(_0x23cefd,_0x5efd73){return function(_0x1dc50b){if(_0x1dc50b){return _0x1dc50b[_0xca1e('0x32')](_0x23cefd)[_0xca1e('0x1e')](function(_0x4b8011){return _0x4b8011;});}return null;};}function removeEntity(_0x127a5a,_0x1da49d){return function(_0x5775a7){if(_0x5775a7){return _0x5775a7[_0xca1e('0x33')]()[_0xca1e('0x1e')](function(){_0x127a5a[_0xca1e('0x2a')](0xcc)[_0xca1e('0x34')]();});}};}function handleEntityNotFound(_0x31839a,_0x1c057a){return function(_0x31c962){if(!_0x31c962){_0x31839a[_0xca1e('0x29')](0x194);}return _0x31c962;};}function handleError(_0x45dc77,_0x937c58){_0x937c58=_0x937c58||0x1f4;return function(_0x253860){logger[_0xca1e('0x23')](_0x253860[_0xca1e('0x35')]);if(_0x253860[_0xca1e('0x36')]){delete _0x253860[_0xca1e('0x36')];}_0x45dc77[_0xca1e('0x2a')](_0x937c58)['send'](_0x253860);};}exports[_0xca1e('0x37')]=function(_0x5d7034,_0x14c9e4){var _0x4280b0={},_0x3e8d65={},_0xa4ef54={'count':0x0,'rows':[]};var _0x1e26f6=_[_0xca1e('0x38')](db[_0xca1e('0x39')]['rawAttributes'],function(_0x375969){return{'name':_0x375969[_0xca1e('0x3a')],'type':_0x375969[_0xca1e('0x3b')][_0xca1e('0x3c')]};});_0x3e8d65[_0xca1e('0x3d')]=_[_0xca1e('0x38')](_0x1e26f6,_0xca1e('0x36'));_0x3e8d65['query']=_[_0xca1e('0x3e')](_0x5d7034[_0xca1e('0x3f')]);_0x3e8d65[_0xca1e('0x40')]=_[_0xca1e('0x41')](_0x3e8d65['model'],_0x3e8d65[_0xca1e('0x3f')]);_0x4280b0['attributes']=_[_0xca1e('0x41')](_0x3e8d65[_0xca1e('0x3d')],qs[_0xca1e('0x42')](_0x5d7034['query'][_0xca1e('0x42')]));_0x4280b0[_0xca1e('0x43')]=_0x4280b0[_0xca1e('0x43')]['length']?_0x4280b0[_0xca1e('0x43')]:_0x3e8d65[_0xca1e('0x3d')];if(!_0x5d7034[_0xca1e('0x3f')]['hasOwnProperty'](_0xca1e('0x44'))){_0x4280b0[_0xca1e('0x2d')]=qs[_0xca1e('0x2d')](_0x5d7034[_0xca1e('0x3f')]['limit']);_0x4280b0[_0xca1e('0x2c')]=qs[_0xca1e('0x2c')](_0x5d7034[_0xca1e('0x3f')][_0xca1e('0x2c')]);}_0x4280b0['order']=qs[_0xca1e('0x45')](_0x5d7034[_0xca1e('0x3f')]['sort']);_0x4280b0[_0xca1e('0x46')]=qs[_0xca1e('0x40')](_[_0xca1e('0x47')](_0x5d7034[_0xca1e('0x3f')],_0x3e8d65[_0xca1e('0x40')]),_0x1e26f6);if(_0x5d7034[_0xca1e('0x3f')][_0xca1e('0x48')]){_0x4280b0['where']=_[_0xca1e('0x49')](_0x4280b0[_0xca1e('0x46')],{'$or':_[_0xca1e('0x38')](_0x1e26f6,function(_0x155033){if(_0x155033[_0xca1e('0x3b')]!==_0xca1e('0x4a')){var _0x4a60a8={};_0x4a60a8[_0x155033['name']]={'$like':'%'+_0x5d7034[_0xca1e('0x3f')][_0xca1e('0x48')]+'%'};return _0x4a60a8;}})});}_0x4280b0=_[_0xca1e('0x49')]({},_0x4280b0,_0x5d7034['options']);var _0x42f005={'where':_0x4280b0['where']};return db[_0xca1e('0x39')][_0xca1e('0x4b')](_0x42f005)[_0xca1e('0x1e')](function(_0x1f6d52){_0xa4ef54['count']=_0x1f6d52;if(_0x5d7034[_0xca1e('0x3f')][_0xca1e('0x4c')]){_0x4280b0[_0xca1e('0x4d')]=[{'all':!![]}];}return db['ChatMessage'][_0xca1e('0x4e')](_0x4280b0);})[_0xca1e('0x1e')](function(_0x552cd1){_0xa4ef54[_0xca1e('0x4f')]=_0x552cd1;return _0xa4ef54;})[_0xca1e('0x1e')](respondWithFilteredResult(_0x14c9e4,_0x4280b0))['catch'](handleError(_0x14c9e4,null));};exports[_0xca1e('0x50')]=function(_0x190696,_0x223051){var _0x39cda6={'raw':!![],'where':{'id':_0x190696[_0xca1e('0x51')]['id']}},_0x1e9723={};_0x1e9723[_0xca1e('0x3d')]=_[_0xca1e('0x3e')](db[_0xca1e('0x39')][_0xca1e('0x52')]);_0x1e9723['query']=_[_0xca1e('0x3e')](_0x190696[_0xca1e('0x3f')]);_0x1e9723['filters']=_[_0xca1e('0x41')](_0x1e9723['model'],_0x1e9723[_0xca1e('0x3f')]);_0x39cda6[_0xca1e('0x43')]=_[_0xca1e('0x41')](_0x1e9723[_0xca1e('0x3d')],qs['fields'](_0x190696[_0xca1e('0x3f')][_0xca1e('0x42')]));_0x39cda6['attributes']=_0x39cda6[_0xca1e('0x43')][_0xca1e('0x53')]?_0x39cda6[_0xca1e('0x43')]:_0x1e9723[_0xca1e('0x3d')];if(_0x190696[_0xca1e('0x3f')][_0xca1e('0x4c')]){_0x39cda6[_0xca1e('0x4d')]=[{'all':!![]}];}_0x39cda6=_[_0xca1e('0x49')]({},_0x39cda6,_0x190696['options']);return db[_0xca1e('0x39')][_0xca1e('0x54')](_0x39cda6)['then'](handleEntityNotFound(_0x223051,null))['then'](respondWithResult(_0x223051,null))['catch'](handleError(_0x223051,null));};exports[_0xca1e('0x55')]=function(_0x24cb97,_0x215b53){return db['ChatMessage'][_0xca1e('0x55')](_0x24cb97[_0xca1e('0x56')],{})[_0xca1e('0x1e')](respondWithResult(_0x215b53,0xc9))['catch'](handleError(_0x215b53,null));};exports[_0xca1e('0x32')]=function(_0x256626,_0x3d5fd4){if(_0x256626[_0xca1e('0x56')]['id']){delete _0x256626['body']['id'];}return db[_0xca1e('0x39')][_0xca1e('0x54')]({'where':{'id':_0x256626[_0xca1e('0x51')]['id']}})[_0xca1e('0x1e')](handleEntityNotFound(_0x3d5fd4,null))[_0xca1e('0x1e')](saveUpdates(_0x256626[_0xca1e('0x56')],null))[_0xca1e('0x1e')](respondWithResult(_0x3d5fd4,null))[_0xca1e('0x28')](handleError(_0x3d5fd4,null));};exports[_0xca1e('0x33')]=function(_0x397991,_0x31f97c){return db[_0xca1e('0x39')][_0xca1e('0x54')]({'where':{'id':_0x397991[_0xca1e('0x51')]['id']}})[_0xca1e('0x1e')](handleEntityNotFound(_0x31f97c,null))[_0xca1e('0x1e')](removeEntity(_0x31f97c,null))[_0xca1e('0x28')](handleError(_0x31f97c,null));};exports['describe']=function(_0x1ea8a6,_0x2951fd){return db[_0xca1e('0x39')][_0xca1e('0x57')]()[_0xca1e('0x1e')](respondWithResult(_0x2951fd,null))[_0xca1e('0x28')](handleError(_0x2951fd,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports['accept']=function(_0x39ceb2,_0x391cd8,_0x5336f4){var _0x86a53d={'channel':_0xca1e('0x58')};if(_0x39ceb2['body']['id']){delete _0x39ceb2['body']['id'];}_0x39ceb2[_0xca1e('0x56')][_0xca1e('0x59')]=!![];_0x39ceb2[_0xca1e('0x56')]['readAt']=moment()['format'](_0xca1e('0x5a'));_0x39ceb2[_0xca1e('0x56')][_0xca1e('0x5b')]=_0x39ceb2[_0xca1e('0x56')][_0xca1e('0x5b')]||_0x39ceb2[_0xca1e('0x5c')]['id'];return db['ChatMessage']['find']({'where':{'id':_0x39ceb2[_0xca1e('0x51')]['id'],'UserId':null},'include':[{'model':db[_0xca1e('0x5d')],'as':_0xca1e('0x5e')}]})['then'](handleEntityNotFound(_0x391cd8,null))[_0xca1e('0x1e')](saveUpdates(_0x39ceb2[_0xca1e('0x56')],null))['then'](function(_0x1e5e25){if(_0x1e5e25){_0x86a53d[_0xca1e('0x25')]=_0x1e5e25[_0xca1e('0x5f')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x1e5e25[_0xca1e('0x60')]}});}return null;})[_0xca1e('0x1e')](handleEntityNotFound(_0x391cd8,null))['then'](function(_0x20c87c){if(_0x20c87c){return _0x20c87c[_0xca1e('0x32')]({'UserId':_0x39ceb2['body'][_0xca1e('0x5b')],'read1stAt':_[_0xca1e('0x61')](_0x20c87c['read1stAt'])?moment()[_0xca1e('0x62')](_0xca1e('0x5a')):undefined});}return null;})[_0xca1e('0x1e')](function(_0x488b2a){if(_0x488b2a){_0x86a53d[_0xca1e('0x63')]=_0x488b2a[_0xca1e('0x5f')]({'plain':!![]});interaction_log[_0xca1e('0x26')](_0xca1e('0x64'),_0x39ceb2[_0xca1e('0x5c')]['id'],_0x39ceb2['user'][_0xca1e('0x36')],_0x39ceb2[_0xca1e('0x5c')]['role'],_0x86a53d[_0xca1e('0x63')]['id'],_0x39ceb2[_0xca1e('0x56')]?JSON[_0xca1e('0x22')](_0x39ceb2[_0xca1e('0x56')]):'null');return respondWithRpcPromise(_0xca1e('0x65'),_0xca1e('0x66'),_0x86a53d);}return null;})[_0xca1e('0x1e')](function(_0x1e000b){if(_0x1e000b){if(_0x39ceb2[_0xca1e('0x56')]['manual']){_0x86a53d['message'][_0xca1e('0x67')]=util[_0xca1e('0x62')](_0xca1e('0x68'),_0x39ceb2[_0xca1e('0x5c')]['name']);_0x86a53d[_0xca1e('0x25')][_0xca1e('0x69')]=_0x86a53d[_0xca1e('0x69')];_0x86a53d[_0xca1e('0x25')][_0xca1e('0x6a')]=_0xca1e('0x6b');return respondWithRpcPromise(_0xca1e('0x6c'),'EventManager',{'event':_0xca1e('0x6d'),'message':_[_0xca1e('0x49')](_0x86a53d[_0xca1e('0x25')],JSON[_0xca1e('0x6e')](_0x86a53d[_0xca1e('0x63')][_0xca1e('0x6f')]))},client9002)[_0xca1e('0x1e')](function(){return _0x86a53d;});}return _0x86a53d;}return null;})[_0xca1e('0x1e')](respondWithResult(_0x391cd8,null))[_0xca1e('0x28')](handleError(_0x391cd8,null));};var interaction_log=require('../../config/logger')(_0xca1e('0x70'));exports[_0xca1e('0x30')]=function(_0x160201,_0x203b5d,_0x23864a){var _0x3f1aa0={'agent':{},'channel':_0xca1e('0x58')};if(_0x160201['body']['id']){delete _0x160201['body']['id'];}_0x160201['body'][_0xca1e('0x5b')]=_0x160201['body'][_0xca1e('0x5b')]||_0x160201[_0xca1e('0x5c')]['id'];_0x3f1aa0[_0xca1e('0x71')]['id']=_0x160201[_0xca1e('0x56')][_0xca1e('0x5b')];return db[_0xca1e('0x39')]['find']({'where':{'id':_0x160201[_0xca1e('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x203b5d,null))[_0xca1e('0x1e')](function(_0x24563c){if(_0x24563c){_0x3f1aa0[_0xca1e('0x25')]=_0x24563c[_0xca1e('0x5f')]({'plain':!![]});return db[_0xca1e('0x72')]['find']({'where':{'id':_0x24563c['ChatInteractionId']}});}return null;})[_0xca1e('0x1e')](handleEntityNotFound(_0x203b5d,null))[_0xca1e('0x1e')](function(_0xafebb1){if(_0xafebb1){_0x3f1aa0[_0xca1e('0x63')]=_0xafebb1[_0xca1e('0x5f')]({'plain':!![]});interaction_log[_0xca1e('0x26')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x160201['user']['id'],_0x160201[_0xca1e('0x5c')][_0xca1e('0x36')],_0x160201['user'][_0xca1e('0x73')],_0x3f1aa0[_0xca1e('0x63')]['id'],_0x160201[_0xca1e('0x56')]?JSON[_0xca1e('0x22')](_0x160201[_0xca1e('0x56')]):_0xca1e('0x74'));return respondWithRpcPromise(_0xca1e('0x75'),_0xca1e('0x76'),_0x3f1aa0);}return null;})['then'](function(_0x292bde){if(_0x292bde){_0x292bde[_0xca1e('0x25')][_0xca1e('0x67')]=util[_0xca1e('0x62')](_0xca1e('0x68'),_0x160201[_0xca1e('0x5c')]['name']);_0x292bde[_0xca1e('0x25')]['channel']=_0x3f1aa0[_0xca1e('0x69')];_0x292bde[_0xca1e('0x25')][_0xca1e('0x6a')]=_0xca1e('0x30');respondWithRpcPromise(_0xca1e('0x6c'),_0xca1e('0x6c'),{'event':_0xca1e('0x77'),'message':_0x292bde[_0xca1e('0x25')]},client9002);return _0x3f1aa0;}return null;})[_0xca1e('0x1e')](respondWithResult(_0x203b5d,null))[_0xca1e('0x28')](handleError(_0x203b5d,null));}; \ No newline at end of file +var _0x2c07=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','http','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','set','apply','save','destroy','end','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','type','merge','options','count','includeAll','include','findAll','show','find','create','body','params','accept','chat','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','get','ChatInteraction','ChatInteractionId','update','isNil','read1stAt','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','channel','event','EventManager','acceptmessage','../../config/logger','chat-interactions','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','SIP/%s','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x2c07,0x1f4));var _0x72c0=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2c07[_0x17d9e3];return _0x14192d;};'use strict';var pdf=require(_0x72c0('0x0'));var emlformat=require(_0x72c0('0x1'));var rimraf=require(_0x72c0('0x2'));var zipdir=require(_0x72c0('0x3'));var jsonpatch=require(_0x72c0('0x4'));var rp=require(_0x72c0('0x5'));var moment=require(_0x72c0('0x6'));var BPromise=require(_0x72c0('0x7'));var Mustache=require(_0x72c0('0x8'));var util=require(_0x72c0('0x9'));var path=require(_0x72c0('0xa'));var sox=require(_0x72c0('0xb'));var csv=require(_0x72c0('0xc'));var ejs=require(_0x72c0('0xd'));var fs=require('fs');var _=require(_0x72c0('0xe'));var squel=require(_0x72c0('0xf'));var crypto=require(_0x72c0('0x10'));var jsforce=require(_0x72c0('0x11'));var deskjs=require(_0x72c0('0x12'));var toCsv=require(_0x72c0('0xc'));var querystring=require(_0x72c0('0x13'));var Papa=require(_0x72c0('0x14'));var Redis=require(_0x72c0('0x15'));var authService=require(_0x72c0('0x16'));var qs=require(_0x72c0('0x17'));var as=require(_0x72c0('0x18'));var hardwareService=require(_0x72c0('0x19'));var logger=require('../../config/logger')(_0x72c0('0x1a'));var utils=require(_0x72c0('0x1b'));var config=require('../../config/environment');var db=require(_0x72c0('0x1c'))['db'];config[_0x72c0('0x1d')]=_[_0x72c0('0x1e')](config[_0x72c0('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0x72c0('0x1f'))(new Redis(config[_0x72c0('0x1d')]));require('./chatMessage.socket')['register'](socket);var jayson=require(_0x72c0('0x20'));var client=jayson['client'][_0x72c0('0x21')]({'port':0x232c});var client9002=jayson[_0x72c0('0x22')][_0x72c0('0x21')]({'port':0x232a});function checkPasswordPattern(_0x5eca85,_0x2b983d,_0x154729){if(_0x154729){var _0x4f6131=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4f6131[_0x72c0('0x23')](_0x2b983d)){return _0x5eca85;}else{throw new db[(_0x72c0('0x24'))][(_0x72c0('0x25'))](_0x72c0('0x26'));}}else{return _0x5eca85;}}function respondWithRpcPromise(_0x1b2888,_0x3de81f,_0x59247d,_0x53f0ca){return new BPromise(function(_0x102c45,_0x426d61){var _0x7c1e09=_0x53f0ca||client;return _0x7c1e09[_0x72c0('0x27')](_0x1b2888,_0x59247d)[_0x72c0('0x28')](function(_0x2d0659){logger[_0x72c0('0x29')](_0x72c0('0x2a'),_0x3de81f,_0x72c0('0x2b'));logger[_0x72c0('0x2c')](_0x72c0('0x2d'),_0x3de81f,_0x72c0('0x2b'),JSON[_0x72c0('0x2e')](_0x2d0659));if(_0x2d0659[_0x72c0('0x2f')]){if(_0x2d0659[_0x72c0('0x2f')][_0x72c0('0x30')]===0x1f4){logger['error'](_0x72c0('0x2a'),_0x3de81f,_0x2d0659[_0x72c0('0x2f')][_0x72c0('0x31')]);return _0x426d61(_0x2d0659[_0x72c0('0x2f')][_0x72c0('0x31')]);}logger['error'](_0x72c0('0x2a'),_0x3de81f,_0x2d0659[_0x72c0('0x2f')]['message']);return _0x102c45(_0x2d0659['error'][_0x72c0('0x31')]);}else{logger[_0x72c0('0x29')](_0x72c0('0x2a'),_0x3de81f,_0x72c0('0x2b'));_0x102c45(_0x2d0659[_0x72c0('0x32')][_0x72c0('0x31')]);}})[_0x72c0('0x33')](function(_0x4baca5){logger[_0x72c0('0x2f')]('ChatMessage,\x20%s,\x20%s',_0x3de81f,_0x4baca5);_0x426d61(_0x4baca5);});});}function respondWithStatusCode(_0x5ba6bd,_0xaea62f){_0xaea62f=_0xaea62f||0xcc;return function(_0x5e6385){if(_0x5e6385){return _0x5ba6bd[_0x72c0('0x34')](_0xaea62f);}return _0x5ba6bd['status'](_0xaea62f)['end']();};}function respondWithResult(_0x54cc00,_0x948b71){_0x948b71=_0x948b71||0xc8;return function(_0x3e6cc6){if(_0x3e6cc6){return _0x54cc00[_0x72c0('0x35')](_0x948b71)[_0x72c0('0x36')](_0x3e6cc6);}};}function respondWithFilteredResult(_0x1103b4,_0x3f8262){return function(_0x5a7d46){if(_0x5a7d46){var _0x494689=_0x5a7d46['count'],_0x437809=_0x3f8262[_0x72c0('0x37')],_0x2ce62a=_0x3f8262['offset']+_0x3f8262[_0x72c0('0x38')],_0x2f6b64;if(_0x2ce62a>=_0x494689){_0x2ce62a=_0x494689;_0x2f6b64=0xc8;}else{_0x2f6b64=0xce;}_0x1103b4[_0x72c0('0x35')](_0x2f6b64);return _0x1103b4[_0x72c0('0x39')]('Content-Range',_0x437809+'-'+_0x2ce62a+'/'+_0x494689)[_0x72c0('0x36')](_0x5a7d46);}return null;};}function patchUpdates(_0xce5cad){return function(_0x520fec){try{jsonpatch[_0x72c0('0x3a')](_0x520fec,_0xce5cad,!![]);}catch(_0xe4a956){return BPromise['reject'](_0xe4a956);}return _0x520fec[_0x72c0('0x3b')]();};}function saveUpdates(_0x2c44a8,_0x264b5c){return function(_0x5766a4){if(_0x5766a4){return _0x5766a4['update'](_0x2c44a8)[_0x72c0('0x28')](function(_0x8c6a8b){return _0x8c6a8b;});}return null;};}function removeEntity(_0x1ad05b,_0x43647a){return function(_0x1c1255){if(_0x1c1255){return _0x1c1255[_0x72c0('0x3c')]()[_0x72c0('0x28')](function(){_0x1ad05b['status'](0xcc)[_0x72c0('0x3d')]();});}};}function handleEntityNotFound(_0x4d8176,_0x20c3ff){return function(_0x587c98){if(!_0x587c98){_0x4d8176[_0x72c0('0x34')](0x194);}return _0x587c98;};}function handleError(_0x74c985,_0x259360){_0x259360=_0x259360||0x1f4;return function(_0x543ded){logger[_0x72c0('0x2f')](_0x543ded[_0x72c0('0x3e')]);if(_0x543ded[_0x72c0('0x3f')]){delete _0x543ded[_0x72c0('0x3f')];}_0x74c985[_0x72c0('0x35')](_0x259360)[_0x72c0('0x40')](_0x543ded);};}exports[_0x72c0('0x41')]=function(_0x3b6871,_0x4e8618){var _0x37c34a={},_0x396144={},_0x2eb1ea={'count':0x0,'rows':[]};var _0x4f46e1=_[_0x72c0('0x42')](db[_0x72c0('0x43')][_0x72c0('0x44')],function(_0x13c33c){return{'name':_0x13c33c[_0x72c0('0x45')],'type':_0x13c33c['type']['key']};});_0x396144[_0x72c0('0x46')]=_[_0x72c0('0x42')](_0x4f46e1,_0x72c0('0x3f'));_0x396144[_0x72c0('0x47')]=_[_0x72c0('0x48')](_0x3b6871['query']);_0x396144[_0x72c0('0x49')]=_[_0x72c0('0x4a')](_0x396144[_0x72c0('0x46')],_0x396144['query']);_0x37c34a[_0x72c0('0x4b')]=_[_0x72c0('0x4a')](_0x396144[_0x72c0('0x46')],qs['fields'](_0x3b6871['query'][_0x72c0('0x4c')]));_0x37c34a[_0x72c0('0x4b')]=_0x37c34a['attributes'][_0x72c0('0x4d')]?_0x37c34a[_0x72c0('0x4b')]:_0x396144[_0x72c0('0x46')];if(!_0x3b6871[_0x72c0('0x47')]['hasOwnProperty'](_0x72c0('0x4e'))){_0x37c34a[_0x72c0('0x38')]=qs[_0x72c0('0x38')](_0x3b6871['query']['limit']);_0x37c34a['offset']=qs[_0x72c0('0x37')](_0x3b6871['query'][_0x72c0('0x37')]);}_0x37c34a[_0x72c0('0x4f')]=qs['sort'](_0x3b6871['query'][_0x72c0('0x50')]);_0x37c34a[_0x72c0('0x51')]=qs[_0x72c0('0x49')](_['pick'](_0x3b6871[_0x72c0('0x47')],_0x396144[_0x72c0('0x49')]),_0x4f46e1);if(_0x3b6871[_0x72c0('0x47')][_0x72c0('0x52')]){_0x37c34a[_0x72c0('0x51')]=_['merge'](_0x37c34a[_0x72c0('0x51')],{'$or':_['map'](_0x4f46e1,function(_0x32f17b){if(_0x32f17b[_0x72c0('0x53')]!=='VIRTUAL'){var _0x138ab4={};_0x138ab4[_0x32f17b['name']]={'$like':'%'+_0x3b6871['query'][_0x72c0('0x52')]+'%'};return _0x138ab4;}})});}_0x37c34a=_[_0x72c0('0x54')]({},_0x37c34a,_0x3b6871[_0x72c0('0x55')]);var _0x4ab4a4={'where':_0x37c34a['where']};return db['ChatMessage'][_0x72c0('0x56')](_0x4ab4a4)[_0x72c0('0x28')](function(_0x5b5743){_0x2eb1ea[_0x72c0('0x56')]=_0x5b5743;if(_0x3b6871[_0x72c0('0x47')][_0x72c0('0x57')]){_0x37c34a[_0x72c0('0x58')]=[{'all':!![]}];}return db[_0x72c0('0x43')][_0x72c0('0x59')](_0x37c34a);})[_0x72c0('0x28')](function(_0x1df9ce){_0x2eb1ea['rows']=_0x1df9ce;return _0x2eb1ea;})['then'](respondWithFilteredResult(_0x4e8618,_0x37c34a))[_0x72c0('0x33')](handleError(_0x4e8618,null));};exports[_0x72c0('0x5a')]=function(_0x22a1a1,_0x4b27b7){var _0x1779a7={'raw':!![],'where':{'id':_0x22a1a1['params']['id']}},_0x93e4c6={};_0x93e4c6['model']=_[_0x72c0('0x48')](db[_0x72c0('0x43')][_0x72c0('0x44')]);_0x93e4c6[_0x72c0('0x47')]=_[_0x72c0('0x48')](_0x22a1a1[_0x72c0('0x47')]);_0x93e4c6['filters']=_[_0x72c0('0x4a')](_0x93e4c6['model'],_0x93e4c6[_0x72c0('0x47')]);_0x1779a7[_0x72c0('0x4b')]=_['intersection'](_0x93e4c6[_0x72c0('0x46')],qs[_0x72c0('0x4c')](_0x22a1a1[_0x72c0('0x47')][_0x72c0('0x4c')]));_0x1779a7[_0x72c0('0x4b')]=_0x1779a7[_0x72c0('0x4b')][_0x72c0('0x4d')]?_0x1779a7['attributes']:_0x93e4c6[_0x72c0('0x46')];if(_0x22a1a1[_0x72c0('0x47')][_0x72c0('0x57')]){_0x1779a7[_0x72c0('0x58')]=[{'all':!![]}];}_0x1779a7=_[_0x72c0('0x54')]({},_0x1779a7,_0x22a1a1['options']);return db['ChatMessage'][_0x72c0('0x5b')](_0x1779a7)[_0x72c0('0x28')](handleEntityNotFound(_0x4b27b7,null))[_0x72c0('0x28')](respondWithResult(_0x4b27b7,null))[_0x72c0('0x33')](handleError(_0x4b27b7,null));};exports[_0x72c0('0x5c')]=function(_0x89dcb0,_0x535b58){return db['ChatMessage'][_0x72c0('0x5c')](_0x89dcb0[_0x72c0('0x5d')],{})[_0x72c0('0x28')](respondWithResult(_0x535b58,0xc9))[_0x72c0('0x33')](handleError(_0x535b58,null));};exports['update']=function(_0x5b323c,_0x123951){if(_0x5b323c[_0x72c0('0x5d')]['id']){delete _0x5b323c[_0x72c0('0x5d')]['id'];}return db[_0x72c0('0x43')]['find']({'where':{'id':_0x5b323c[_0x72c0('0x5e')]['id']}})[_0x72c0('0x28')](handleEntityNotFound(_0x123951,null))[_0x72c0('0x28')](saveUpdates(_0x5b323c[_0x72c0('0x5d')],null))['then'](respondWithResult(_0x123951,null))['catch'](handleError(_0x123951,null));};exports[_0x72c0('0x3c')]=function(_0xd3a3eb,_0x5d54d2){return db[_0x72c0('0x43')][_0x72c0('0x5b')]({'where':{'id':_0xd3a3eb['params']['id']}})[_0x72c0('0x28')](handleEntityNotFound(_0x5d54d2,null))[_0x72c0('0x28')](removeEntity(_0x5d54d2,null))[_0x72c0('0x33')](handleError(_0x5d54d2,null));};exports['describe']=function(_0x2da0ec,_0x53495c){return db['ChatMessage']['describe']()[_0x72c0('0x28')](respondWithResult(_0x53495c,null))[_0x72c0('0x33')](handleError(_0x53495c,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x72c0('0x5f')]=function(_0x2999de,_0x3f9f6d,_0x3841fa){var _0x555914={'channel':_0x72c0('0x60')};if(_0x2999de[_0x72c0('0x5d')]['id']){delete _0x2999de[_0x72c0('0x5d')]['id'];}_0x2999de['body'][_0x72c0('0x61')]=!![];_0x2999de['body'][_0x72c0('0x62')]=moment()['format'](_0x72c0('0x63'));_0x2999de[_0x72c0('0x5d')][_0x72c0('0x64')]=_0x2999de[_0x72c0('0x5d')][_0x72c0('0x64')]||_0x2999de['user']['id'];return db[_0x72c0('0x43')][_0x72c0('0x5b')]({'where':{'id':_0x2999de[_0x72c0('0x5e')]['id'],'UserId':null},'include':[{'model':db[_0x72c0('0x65')],'as':'Contact'}]})[_0x72c0('0x28')](handleEntityNotFound(_0x3f9f6d,null))[_0x72c0('0x28')](saveUpdates(_0x2999de[_0x72c0('0x5d')],null))[_0x72c0('0x28')](function(_0x5b7f60){if(_0x5b7f60){_0x555914['message']=_0x5b7f60[_0x72c0('0x66')]({'plain':!![]});return db[_0x72c0('0x67')][_0x72c0('0x5b')]({'where':{'id':_0x5b7f60[_0x72c0('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x3f9f6d,null))[_0x72c0('0x28')](function(_0x41d7c5){if(_0x41d7c5){return _0x41d7c5[_0x72c0('0x69')]({'UserId':_0x2999de[_0x72c0('0x5d')][_0x72c0('0x64')],'read1stAt':_[_0x72c0('0x6a')](_0x41d7c5[_0x72c0('0x6b')])?moment()[_0x72c0('0x6c')](_0x72c0('0x63')):undefined});}return null;})[_0x72c0('0x28')](function(_0x3d8620){if(_0x3d8620){_0x555914[_0x72c0('0x6d')]=_0x3d8620[_0x72c0('0x66')]({'plain':!![]});interaction_log[_0x72c0('0x29')](_0x72c0('0x6e'),_0x2999de[_0x72c0('0x6f')]['id'],_0x2999de[_0x72c0('0x6f')][_0x72c0('0x3f')],_0x2999de[_0x72c0('0x6f')][_0x72c0('0x70')],_0x555914[_0x72c0('0x6d')]['id'],_0x2999de['body']?JSON[_0x72c0('0x2e')](_0x2999de['body']):_0x72c0('0x71'));return respondWithRpcPromise(_0x72c0('0x72'),_0x72c0('0x73'),_0x555914);}return null;})[_0x72c0('0x28')](function(_0x2292da){if(_0x2292da){if(_0x2999de['body']['manual']){_0x555914[_0x72c0('0x31')]['interface']=util[_0x72c0('0x6c')]('SIP/%s',_0x2999de[_0x72c0('0x6f')][_0x72c0('0x3f')]);_0x555914[_0x72c0('0x31')][_0x72c0('0x74')]=_0x555914[_0x72c0('0x74')];_0x555914[_0x72c0('0x31')][_0x72c0('0x75')]='accept';return respondWithRpcPromise(_0x72c0('0x76'),_0x72c0('0x76'),{'event':_0x72c0('0x77'),'message':_[_0x72c0('0x54')](_0x555914[_0x72c0('0x31')],JSON['parse'](_0x555914[_0x72c0('0x6d')]['formData']))},client9002)[_0x72c0('0x28')](function(){return _0x555914;});}return _0x555914;}return null;})[_0x72c0('0x28')](respondWithResult(_0x3f9f6d,null))[_0x72c0('0x33')](handleError(_0x3f9f6d,null));};var interaction_log=require(_0x72c0('0x78'))(_0x72c0('0x79'));exports[_0x72c0('0x7a')]=function(_0xaa2f,_0x4b51bf,_0x4846c4){var _0x46d5ea={'agent':{},'channel':'chat'};if(_0xaa2f[_0x72c0('0x5d')]['id']){delete _0xaa2f[_0x72c0('0x5d')]['id'];}_0xaa2f[_0x72c0('0x5d')][_0x72c0('0x64')]=_0xaa2f[_0x72c0('0x5d')][_0x72c0('0x64')]||_0xaa2f[_0x72c0('0x6f')]['id'];_0x46d5ea['agent']['id']=_0xaa2f[_0x72c0('0x5d')]['UserId'];return db[_0x72c0('0x43')][_0x72c0('0x5b')]({'where':{'id':_0xaa2f[_0x72c0('0x5e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4b51bf,null))['then'](function(_0x5619fc){if(_0x5619fc){_0x46d5ea[_0x72c0('0x31')]=_0x5619fc['get']({'plain':!![]});return db[_0x72c0('0x67')]['find']({'where':{'id':_0x5619fc[_0x72c0('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x4b51bf,null))['then'](function(_0x11ec14){if(_0x11ec14){_0x46d5ea['interaction']=_0x11ec14[_0x72c0('0x66')]({'plain':!![]});interaction_log[_0x72c0('0x29')](_0x72c0('0x7b'),_0xaa2f['user']['id'],_0xaa2f[_0x72c0('0x6f')][_0x72c0('0x3f')],_0xaa2f['user'][_0x72c0('0x70')],_0x46d5ea[_0x72c0('0x6d')]['id'],_0xaa2f['body']?JSON['stringify'](_0xaa2f['body']):'null');return respondWithRpcPromise(_0x72c0('0x7c'),_0x72c0('0x7d'),_0x46d5ea);}return null;})[_0x72c0('0x28')](function(_0x2bec32){if(_0x2bec32){_0x2bec32[_0x72c0('0x31')][_0x72c0('0x7e')]=util[_0x72c0('0x6c')](_0x72c0('0x7f'),_0xaa2f[_0x72c0('0x6f')]['name']);_0x2bec32['message'][_0x72c0('0x74')]=_0x46d5ea[_0x72c0('0x74')];_0x2bec32[_0x72c0('0x31')][_0x72c0('0x75')]='reject';respondWithRpcPromise('EventManager',_0x72c0('0x76'),{'event':_0x72c0('0x80'),'message':_0x2bec32[_0x72c0('0x31')]},client9002);return _0x46d5ea;}return null;})[_0x72c0('0x28')](respondWithResult(_0x4b51bf,null))[_0x72c0('0x33')](handleError(_0x4b51bf,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 71a3cb3..1455b41 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 _0x04c0=['ChatMessage','setMaxListeners','save','update','remove','emit','../../mysqldb'];(function(_0x5912ad,_0x36ff2d){var _0x3430c6=function(_0x17b158){while(--_0x17b158){_0x5912ad['push'](_0x5912ad['shift']());}};_0x3430c6(++_0x36ff2d);}(_0x04c0,0x7d));var _0x004c=function(_0x15f00b,_0x518951){_0x15f00b=_0x15f00b-0x0;var _0x2c92c7=_0x04c0[_0x15f00b];return _0x2c92c7;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x004c('0x0'))['db'][_0x004c('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x004c('0x2')](0x0);var events={'afterCreate':_0x004c('0x3'),'afterUpdate':_0x004c('0x4'),'afterDestroy':_0x004c('0x5')};function emitEvent(_0x61dc25){return function(_0x12b856,_0x33d067,_0x3234b7){ChatMessageEvents[_0x004c('0x6')](_0x61dc25+':'+_0x12b856['id'],_0x12b856);ChatMessageEvents[_0x004c('0x6')](_0x61dc25,_0x12b856);_0x3234b7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x7151=['emit','hasOwnProperty','exports','events','../../mysqldb','remove'];(function(_0x4595ec,_0x2def3d){var _0x463e1a=function(_0x3b3507){while(--_0x3b3507){_0x4595ec['push'](_0x4595ec['shift']());}};_0x463e1a(++_0x2def3d);}(_0x7151,0xdb));var _0x1715=function(_0x3c4d3a,_0x4a29c8){_0x3c4d3a=_0x3c4d3a-0x0;var _0x549944=_0x7151[_0x3c4d3a];return _0x549944;};'use strict';var EventEmitter=require(_0x1715('0x0'));var ChatMessage=require(_0x1715('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1715('0x2')};function emitEvent(_0x139432){return function(_0x38bc36,_0x3279fd,_0x2ac764){ChatMessageEvents[_0x1715('0x3')](_0x139432+':'+_0x38bc36['id'],_0x38bc36);ChatMessageEvents['emit'](_0x139432,_0x38bc36);_0x2ac764(null);};}for(var e in events){if(events[_0x1715('0x4')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x1715('0x5')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 7325157..49fba17 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 _0x0f3a=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x5e515c,_0x3319a7){var _0x4f3109=function(_0xc823f5){while(--_0xc823f5){_0x5e515c['push'](_0x5e515c['shift']());}};_0x4f3109(++_0x3319a7);}(_0x0f3a,0x13e));var _0xa0f3=function(_0x258973,_0x501ee6){_0x258973=_0x258973-0x0;var _0x287688=_0x0f3a[_0x258973];return _0x287688;};'use strict';var _=require(_0xa0f3('0x0'));var util=require(_0xa0f3('0x1'));var logger=require(_0xa0f3('0x2'))('api');var moment=require(_0xa0f3('0x3'));var BPromise=require(_0xa0f3('0x4'));var rp=require(_0xa0f3('0x5'));var fs=require('fs');var path=require(_0xa0f3('0x6'));var rimraf=require(_0xa0f3('0x7'));var config=require(_0xa0f3('0x8'));var attributes=require(_0xa0f3('0x9'));module['exports']=function(_0x1ce510,_0x452116){return _0x1ce510[_0xa0f3('0xa')](_0xa0f3('0xb'),attributes,{'tableName':_0xa0f3('0xc'),'paranoid':![],'indexes':[{'name':_0xa0f3('0xd'),'fields':[_0xa0f3('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x382d60,_0x4372a8,_0x4c8be0){var _0x5deea5=_0x1ce510[_0xa0f3('0xf')];var _0x48635d=_0x382d60[_0xa0f3('0x10')]({'plain':!![]});if(_0x48635d[_0xa0f3('0x11')][_0xa0f3('0x12')]()==='in'||_0x48635d[_0xa0f3('0x11')][_0xa0f3('0x12')]()===_0xa0f3('0x13')&&!_0x48635d[_0xa0f3('0x14')]&&!_[_0xa0f3('0x15')](_0x48635d[_0xa0f3('0x16')])){_0x5deea5[_0xa0f3('0x17')]['findOne']({'where':{'id':_0x48635d['ChatInteractionId']}})['then'](function(_0x16abe6){if(_0x16abe6){_0x16abe6['update']({'lastMsgAt':_0x48635d[_0xa0f3('0x18')],'lastMsgDirection':_0x48635d[_0xa0f3('0x11')]['toLowerCase']()});}})[_0xa0f3('0x19')](function(_0x44b5b5){console[_0xa0f3('0x1a')](_0x44b5b5);});}_0x4c8be0();}},'charset':_0xa0f3('0x1b'),'collate':_0xa0f3('0x1c')});}; \ No newline at end of file +var _0xd2a4=['fti_chat_messages','body','FULLTEXT','get','direction','toLowerCase','secret','UserId','findOne','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages'];(function(_0x4da59c,_0x33d9dd){var _0x129d2f=function(_0x10621a){while(--_0x10621a){_0x4da59c['push'](_0x4da59c['shift']());}};_0x129d2f(++_0x33d9dd);}(_0xd2a4,0x16e));var _0x4d2a=function(_0x210ed3,_0x534410){_0x210ed3=_0x210ed3-0x0;var _0xb5c877=_0xd2a4[_0x210ed3];return _0xb5c877;};'use strict';var _=require('lodash');var util=require(_0x4d2a('0x0'));var logger=require(_0x4d2a('0x1'))(_0x4d2a('0x2'));var moment=require(_0x4d2a('0x3'));var BPromise=require(_0x4d2a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d2a('0x5'));var rimraf=require(_0x4d2a('0x6'));var config=require(_0x4d2a('0x7'));var attributes=require(_0x4d2a('0x8'));module['exports']=function(_0x351f0d,_0x400d9e){return _0x351f0d[_0x4d2a('0x9')](_0x4d2a('0xa'),attributes,{'tableName':_0x4d2a('0xb'),'paranoid':![],'indexes':[{'name':_0x4d2a('0xc'),'fields':[_0x4d2a('0xd')],'type':_0x4d2a('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d50f3,_0x48bb1f,_0x2ae619){var _0x5b1b0f=_0x351f0d['models'];var _0x25d0f4=_0x3d50f3[_0x4d2a('0xf')]({'plain':!![]});if(_0x25d0f4[_0x4d2a('0x10')][_0x4d2a('0x11')]()==='in'||_0x25d0f4['direction'][_0x4d2a('0x11')]()==='out'&&!_0x25d0f4[_0x4d2a('0x12')]&&!_['isNil'](_0x25d0f4[_0x4d2a('0x13')])){_0x5b1b0f['ChatInteraction'][_0x4d2a('0x14')]({'where':{'id':_0x25d0f4['ChatInteractionId']}})['then'](function(_0x3ed62f){if(_0x3ed62f){_0x3ed62f[_0x4d2a('0x15')]({'lastMsgAt':_0x25d0f4[_0x4d2a('0x16')],'lastMsgDirection':_0x25d0f4[_0x4d2a('0x10')]['toLowerCase']()});}})[_0x4d2a('0x17')](function(_0x44dfb5){console[_0x4d2a('0x18')](_0x44dfb5);});}_0x2ae619();}},'charset':_0x4d2a('0x19'),'collate':_0x4d2a('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 5b8c540..3969bf2 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 _0xb18f=['../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatMessage.socket','register','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatMessage','ChatMessage','create','body','options','raw','then','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xb18f,0xee));var _0xfb18=function(_0x49f3bf,_0x4f7e08){_0x49f3bf=_0x49f3bf-0x0;var _0x5bbca6=_0xb18f[_0x49f3bf];return _0x5bbca6;};'use strict';var _=require(_0xfb18('0x0'));var util=require(_0xfb18('0x1'));var moment=require(_0xfb18('0x2'));var BPromise=require(_0xfb18('0x3'));var rs=require(_0xfb18('0x4'));var fs=require('fs');var Redis=require(_0xfb18('0x5'));var db=require(_0xfb18('0x6'))['db'];var utils=require(_0xfb18('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xfb18('0x8'));var jayson=require(_0xfb18('0x9'));var client=jayson['client'][_0xfb18('0xa')]({'port':0x232a});config[_0xfb18('0xb')]=_[_0xfb18('0xc')](config[_0xfb18('0xb')],{'host':_0xfb18('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfb18('0xb')]));require(_0xfb18('0xe'))[_0xfb18('0xf')](socket);function respondWithRpcPromise(_0x4f1478,_0x552fb5,_0x403e4e){return new BPromise(function(_0xc68ea7,_0x524d2a){return client[_0xfb18('0x10')](_0x4f1478,_0x403e4e)['then'](function(_0x33963b){logger[_0xfb18('0x11')](_0xfb18('0x12'),_0x552fb5,_0xfb18('0x13'));logger['debug'](_0xfb18('0x14'),_0x552fb5,_0xfb18('0x13'),JSON[_0xfb18('0x15')](_0x33963b));if(_0x33963b['error']){if(_0x33963b[_0xfb18('0x16')][_0xfb18('0x17')]===0x1f4){logger[_0xfb18('0x16')](_0xfb18('0x12'),_0x552fb5,_0x33963b[_0xfb18('0x16')][_0xfb18('0x18')]);return _0x524d2a(_0x33963b[_0xfb18('0x16')][_0xfb18('0x18')]);}logger[_0xfb18('0x16')](_0xfb18('0x12'),_0x552fb5,_0x33963b[_0xfb18('0x16')]['message']);return _0xc68ea7(_0x33963b[_0xfb18('0x16')][_0xfb18('0x18')]);}else{logger[_0xfb18('0x11')](_0xfb18('0x12'),_0x552fb5,_0xfb18('0x13'));_0xc68ea7(_0x33963b[_0xfb18('0x19')][_0xfb18('0x18')]);}})['catch'](function(_0x31b87d){logger[_0xfb18('0x16')]('ChatMessage,\x20%s,\x20%s',_0x552fb5,_0x31b87d);_0x524d2a(_0x31b87d);});});}exports[_0xfb18('0x1a')]=function(_0x4ccc9f){var _0x19b001=this;return new Promise(function(_0x2c143d,_0x2d13b2){return db[_0xfb18('0x1b')][_0xfb18('0x1c')](_0x4ccc9f[_0xfb18('0x1d')],{'raw':_0x4ccc9f[_0xfb18('0x1e')]?_0x4ccc9f[_0xfb18('0x1e')][_0xfb18('0x1f')]===undefined?!![]:![]:!![]})[_0xfb18('0x20')](function(_0x4e74a2){logger['info']('CreateChatMessage',_0x4ccc9f);logger[_0xfb18('0x21')](_0xfb18('0x1a'),_0x4ccc9f,JSON[_0xfb18('0x15')](_0x4e74a2));_0x2c143d(_0x4e74a2);})[_0xfb18('0x22')](function(_0x4c947e){logger['error'](_0xfb18('0x1a'),_0x4c947e['message'],_0x4ccc9f);_0x2d13b2(_0x19b001[_0xfb18('0x16')](0x1f4,_0x4c947e[_0xfb18('0x18')]));});});}; \ No newline at end of file +var _0x8f54=['../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateChatMessage','ChatMessage','create','raw','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x232c95,_0x5f006a){var _0x58c87b=function(_0x2fe7d8){while(--_0x2fe7d8){_0x232c95['push'](_0x232c95['shift']());}};_0x58c87b(++_0x5f006a);}(_0x8f54,0x13a));var _0x48f5=function(_0x500379,_0xf04b01){_0x500379=_0x500379-0x0;var _0x4df26d=_0x8f54[_0x500379];return _0x4df26d;};'use strict';var _=require(_0x48f5('0x0'));var util=require(_0x48f5('0x1'));var moment=require(_0x48f5('0x2'));var BPromise=require(_0x48f5('0x3'));var rs=require(_0x48f5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x48f5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x48f5('0x6'))(_0x48f5('0x7'));var config=require(_0x48f5('0x8'));var jayson=require(_0x48f5('0x9'));var client=jayson[_0x48f5('0xa')]['http']({'port':0x232a});config['redis']=_[_0x48f5('0xb')](config[_0x48f5('0xc')],{'host':_0x48f5('0xd'),'port':0x18eb});var socket=require(_0x48f5('0xe'))(new Redis(config[_0x48f5('0xc')]));require('./chatMessage.socket')[_0x48f5('0xf')](socket);function respondWithRpcPromise(_0x372d64,_0x55ff1e,_0x28ed9c){return new BPromise(function(_0x312b9d,_0x73473f){return client['request'](_0x372d64,_0x28ed9c)[_0x48f5('0x10')](function(_0x46d728){logger[_0x48f5('0x11')](_0x48f5('0x12'),_0x55ff1e,'request\x20sent');logger[_0x48f5('0x13')](_0x48f5('0x14'),_0x55ff1e,_0x48f5('0x15'),JSON[_0x48f5('0x16')](_0x46d728));if(_0x46d728[_0x48f5('0x17')]){if(_0x46d728['error'][_0x48f5('0x18')]===0x1f4){logger[_0x48f5('0x17')](_0x48f5('0x12'),_0x55ff1e,_0x46d728[_0x48f5('0x17')][_0x48f5('0x19')]);return _0x73473f(_0x46d728[_0x48f5('0x17')][_0x48f5('0x19')]);}logger[_0x48f5('0x17')](_0x48f5('0x12'),_0x55ff1e,_0x46d728['error']['message']);return _0x312b9d(_0x46d728[_0x48f5('0x17')][_0x48f5('0x19')]);}else{logger[_0x48f5('0x11')](_0x48f5('0x12'),_0x55ff1e,_0x48f5('0x15'));_0x312b9d(_0x46d728[_0x48f5('0x1a')][_0x48f5('0x19')]);}})['catch'](function(_0xc11d74){logger[_0x48f5('0x17')](_0x48f5('0x12'),_0x55ff1e,_0xc11d74);_0x73473f(_0xc11d74);});});}exports[_0x48f5('0x1b')]=function(_0x364a75){var _0x3561d5=this;return new Promise(function(_0x152719,_0x1ab68f){return db[_0x48f5('0x1c')][_0x48f5('0x1d')](_0x364a75['body'],{'raw':_0x364a75['options']?_0x364a75['options'][_0x48f5('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x5c84ff){logger[_0x48f5('0x11')](_0x48f5('0x1b'),_0x364a75);logger[_0x48f5('0x13')]('CreateChatMessage',_0x364a75,JSON[_0x48f5('0x16')](_0x5c84ff));_0x152719(_0x5c84ff);})[_0x48f5('0x1f')](function(_0x3592a1){logger['error'](_0x48f5('0x1b'),_0x3592a1[_0x48f5('0x19')],_0x364a75);_0x1ab68f(_0x3561d5[_0x48f5('0x17')](0x1f4,_0x3592a1[_0x48f5('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 1e1ced6..fb96383 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 _0x1623=['removeListener','length','chatMessage:','./chatMessage.events','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1623,0xab));var _0x3162=function(_0x46c08e,_0x534e6c){_0x46c08e=_0x46c08e-0x0;var _0x487358=_0x1623[_0x46c08e];return _0x487358;};'use strict';var ChatMessageEvents=require(_0x3162('0x0'));var events=['save','remove',_0x3162('0x1')];function createListener(_0x27ee21,_0x36ccc3){return function(_0x2cc4d7){_0x36ccc3[_0x3162('0x2')](_0x27ee21,_0x2cc4d7);};}function removeListener(_0x4ce2bd,_0x5d49d0){return function(){ChatMessageEvents[_0x3162('0x3')](_0x4ce2bd,_0x5d49d0);};}exports['register']=function(_0x1b55f2){for(var _0x428de6=0x0,_0x53260d=events[_0x3162('0x4')];_0x428de6<_0x53260d;_0x428de6++){var _0x2dc07e=events[_0x428de6];var _0x26ee32=createListener(_0x3162('0x5')+_0x2dc07e,_0x1b55f2);ChatMessageEvents['on'](_0x2dc07e,_0x26ee32);}}; \ No newline at end of file +var _0x53ec=['length','chatMessage:','./chatMessage.events','save','remove','update','emit','removeListener'];(function(_0x7dbfe,_0x4a4834){var _0xade3aa=function(_0x53deaf){while(--_0x53deaf){_0x7dbfe['push'](_0x7dbfe['shift']());}};_0xade3aa(++_0x4a4834);}(_0x53ec,0x192));var _0xc53e=function(_0x5b2096,_0x213141){_0x5b2096=_0x5b2096-0x0;var _0x198357=_0x53ec[_0x5b2096];return _0x198357;};'use strict';var ChatMessageEvents=require(_0xc53e('0x0'));var events=[_0xc53e('0x1'),_0xc53e('0x2'),_0xc53e('0x3')];function createListener(_0x1b04cc,_0xe45c6d){return function(_0x51c435){_0xe45c6d[_0xc53e('0x4')](_0x1b04cc,_0x51c435);};}function removeListener(_0x4e954a,_0x2b90f6){return function(){ChatMessageEvents[_0xc53e('0x5')](_0x4e954a,_0x2b90f6);};}exports['register']=function(_0x2f1414){for(var _0x4f989b=0x0,_0x41a9e8=events[_0xc53e('0x6')];_0x4f989b<_0x41a9e8;_0x4f989b++){var _0x5d3b28=events[_0x4f989b];var _0x1616ac=createListener(_0xc53e('0x7')+_0x5d3b28,_0x2f1414);ChatMessageEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index f649847..a13a2bf 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 _0x00e7=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','tracked','chatmessage:create','create','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer'];(function(_0x373768,_0x218a5b){var _0x3b6373=function(_0x4cadb1){while(--_0x4cadb1){_0x373768['push'](_0x373768['shift']());}};_0x3b6373(++_0x218a5b);}(_0x00e7,0xf2));var _0x700e=function(_0x35468d,_0x2a7240){_0x35468d=_0x35468d-0x0;var _0x30da52=_0x00e7[_0x35468d];return _0x30da52;};'use strict';var multer=require(_0x700e('0x0'));var util=require(_0x700e('0x1'));var path=require(_0x700e('0x2'));var timeout=require(_0x700e('0x3'));var express=require('express');var router=express[_0x700e('0x4')]();var auth=require(_0x700e('0x5'));var interaction=require(_0x700e('0x6'));var config=require(_0x700e('0x7'));var controller=require('./chatMessage.controller');router[_0x700e('0x8')]('/',auth[_0x700e('0x9')](),controller[_0x700e('0xa')]);router[_0x700e('0x8')](_0x700e('0xb'),auth[_0x700e('0x9')](),controller[_0x700e('0xc')]);router[_0x700e('0x8')]('/:id',auth[_0x700e('0x9')](),controller[_0x700e('0xd')]);router[_0x700e('0xe')]('/',auth[_0x700e('0x9')](),interaction[_0x700e('0xf')]('chat',_0x700e('0x10')),controller[_0x700e('0x11')]);router[_0x700e('0x12')](_0x700e('0x13'),controller[_0x700e('0x14')]);router[_0x700e('0x12')](_0x700e('0x15'),auth[_0x700e('0x9')](),controller[_0x700e('0x16')]);router[_0x700e('0x12')](_0x700e('0x17'),auth[_0x700e('0x9')](),controller[_0x700e('0x18')]);router[_0x700e('0x19')](_0x700e('0x13'),auth[_0x700e('0x9')](),controller[_0x700e('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x737b=['./chatMessage.controller','get','isAuthenticated','index','/:id','show','post','tracked','chat','chatmessage:create','create','put','/:id/accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x737b,0xfb));var _0xb737=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x737b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb737('0x0'));var util=require(_0xb737('0x1'));var path=require(_0xb737('0x2'));var timeout=require(_0xb737('0x3'));var express=require(_0xb737('0x4'));var router=express[_0xb737('0x5')]();var auth=require(_0xb737('0x6'));var interaction=require(_0xb737('0x7'));var config=require(_0xb737('0x8'));var controller=require(_0xb737('0x9'));router[_0xb737('0xa')]('/',auth[_0xb737('0xb')](),controller[_0xb737('0xc')]);router[_0xb737('0xa')]('/describe',auth[_0xb737('0xb')](),controller['describe']);router[_0xb737('0xa')](_0xb737('0xd'),auth[_0xb737('0xb')](),controller[_0xb737('0xe')]);router[_0xb737('0xf')]('/',auth[_0xb737('0xb')](),interaction[_0xb737('0x10')](_0xb737('0x11'),_0xb737('0x12')),controller[_0xb737('0x13')]);router[_0xb737('0x14')](_0xb737('0xd'),controller['update']);router[_0xb737('0x14')](_0xb737('0x15'),auth[_0xb737('0xb')](),controller['accept']);router[_0xb737('0x14')](_0xb737('0x16'),auth['isAuthenticated'](),controller[_0xb737('0x17')]);router['delete'](_0xb737('0xd'),auth[_0xb737('0xb')](),controller[_0xb737('0x18')]);module[_0xb737('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index cab31c0..929f259 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 _0x396e=['exports','TEXT','medium','sequelize'];(function(_0x568548,_0x458494){var _0x104970=function(_0x34a2c3){while(--_0x34a2c3){_0x568548['push'](_0x568548['shift']());}};_0x104970(++_0x458494);}(_0x396e,0x1ef));var _0xe396=function(_0x30187d,_0x4270b5){_0x30187d=_0x30187d-0x0;var _0x4a54ae=_0x396e[_0x30187d];return _0x4a54ae;};'use strict';var Sequelize=require(_0xe396('0x0'));module[_0xe396('0x1')]={'body':{'type':Sequelize[_0xe396('0x2')](_0xe396('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x2d03=['medium','sequelize','exports','TEXT'];(function(_0x33eca6,_0x891651){var _0x1ada39=function(_0x31ab8c){while(--_0x31ab8c){_0x33eca6['push'](_0x33eca6['shift']());}};_0x1ada39(++_0x891651);}(_0x2d03,0x79));var _0x32d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2d03[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x32d0('0x0'));module[_0x32d0('0x1')]={'body':{'type':Sequelize[_0x32d0('0x2')](_0x32d0('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 6d3c38c..e7100a2 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(_0x5448b3,_0x56eac0){var _0x3ea872=function(_0x43e7f9){while(--_0x43e7f9){_0x5448b3['push'](_0x5448b3['shift']());}};_0x3ea872(++_0x56eac0);}(_0x6050,0x196));var _0x0605=function(_0x2449df,_0xd0c723){_0x2449df=_0x2449df-0x0;var _0x581a70=_0x6050[_0x2449df];return _0x581a70;};'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 _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','ChatOfflineMessage','rawAttributes','fieldName','type','name','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where'];(function(_0x3a3b44,_0x576f9d){var _0x25d78b=function(_0x132253){while(--_0x132253){_0x3a3b44['push'](_0x3a3b44['shift']());}};_0x25d78b(++_0x576f9d);}(_0x3baf,0xf7));var _0xf3ba=function(_0x44f353,_0x5b6c2f){_0x44f353=_0x44f353-0x0;var _0x26a635=_0x3baf[_0x44f353];return _0x26a635;};'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['ChatOfflineMessage'][_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 diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 4bd62e7..095ff01 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 _0x782d=['bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x1d1467,_0x41c3d1){var _0x30dd18=function(_0xea20f7){while(--_0xea20f7){_0x1d1467['push'](_0x1d1467['shift']());}};_0x30dd18(++_0x41c3d1);}(_0x782d,0xcf));var _0xd782=function(_0x964ae3,_0x516b25){_0x964ae3=_0x964ae3-0x0;var _0xa3f47b=_0x782d[_0x964ae3];return _0xa3f47b;};'use strict';var _=require(_0xd782('0x0'));var util=require(_0xd782('0x1'));var logger=require('../../config/logger')(_0xd782('0x2'));var moment=require('moment');var BPromise=require(_0xd782('0x3'));var rp=require(_0xd782('0x4'));var fs=require('fs');var path=require(_0xd782('0x5'));var rimraf=require(_0xd782('0x6'));var config=require(_0xd782('0x7'));var attributes=require(_0xd782('0x8'));module[_0xd782('0x9')]=function(_0x1ee578,_0xf96eb){return _0x1ee578[_0xd782('0xa')](_0xd782('0xb'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd782('0xc'),'collate':_0xd782('0xd')});}; \ No newline at end of file +var _0xd28c=['chat_offline_messages','utf8mb4','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','define','ChatOfflineMessage'];(function(_0x2335bd,_0x54e892){var _0x2aac2c=function(_0x3194dc){while(--_0x3194dc){_0x2335bd['push'](_0x2335bd['shift']());}};_0x2aac2c(++_0x54e892);}(_0xd28c,0xfe));var _0xcd28=function(_0x1216c3,_0x1c2b79){_0x1216c3=_0x1216c3-0x0;var _0x48857c=_0xd28c[_0x1216c3];return _0x48857c;};'use strict';var _=require('lodash');var util=require(_0xcd28('0x0'));var logger=require('../../config/logger')(_0xcd28('0x1'));var moment=require('moment');var BPromise=require(_0xcd28('0x2'));var rp=require(_0xcd28('0x3'));var fs=require('fs');var path=require(_0xcd28('0x4'));var rimraf=require(_0xcd28('0x5'));var config=require(_0xcd28('0x6'));var attributes=require(_0xcd28('0x7'));module['exports']=function(_0x2fc10e,_0x4e6019){return _0x2fc10e[_0xcd28('0x8')](_0xcd28('0x9'),attributes,{'tableName':_0xcd28('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcd28('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index c9b072c..fbba999 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 _0x20fb=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x20fb,0xab));var _0xb20f=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x20fb[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb20f('0x0'));var BPromise=require(_0xb20f('0x1'));var rs=require(_0xb20f('0x2'));var fs=require('fs');var Redis=require(_0xb20f('0x3'));var db=require(_0xb20f('0x4'))['db'];var utils=require(_0xb20f('0x5'));var logger=require(_0xb20f('0x6'))(_0xb20f('0x7'));var config=require(_0xb20f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb20f('0x9')][_0xb20f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41c5ed,_0x5aeda9,_0x34eb8c){return new BPromise(function(_0x5aebca,_0x3c9288){return client[_0xb20f('0xb')](_0x41c5ed,_0x34eb8c)[_0xb20f('0xc')](function(_0x2d4931){logger[_0xb20f('0xd')](_0xb20f('0xe'),_0x5aeda9,'request\x20sent');logger[_0xb20f('0xf')](_0xb20f('0x10'),_0x5aeda9,'request\x20sent',JSON[_0xb20f('0x11')](_0x2d4931));if(_0x2d4931['error']){if(_0x2d4931[_0xb20f('0x12')][_0xb20f('0x13')]===0x1f4){logger[_0xb20f('0x12')](_0xb20f('0xe'),_0x5aeda9,_0x2d4931[_0xb20f('0x12')][_0xb20f('0x14')]);return _0x3c9288(_0x2d4931[_0xb20f('0x12')][_0xb20f('0x14')]);}logger[_0xb20f('0x12')](_0xb20f('0xe'),_0x5aeda9,_0x2d4931[_0xb20f('0x12')][_0xb20f('0x14')]);return _0x5aebca(_0x2d4931[_0xb20f('0x12')][_0xb20f('0x14')]);}else{logger['info'](_0xb20f('0xe'),_0x5aeda9,_0xb20f('0x15'));_0x5aebca(_0x2d4931['result'][_0xb20f('0x14')]);}})['catch'](function(_0x34f230){logger['error'](_0xb20f('0xe'),_0x5aeda9,_0x34f230);_0x3c9288(_0x34f230);});});} \ No newline at end of file +var _0xdc40=['info','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0xe1de82,_0x393df7){var _0x56ed73=function(_0x3c2fd5){while(--_0x3c2fd5){_0xe1de82['push'](_0xe1de82['shift']());}};_0x56ed73(++_0x393df7);}(_0xdc40,0x6b));var _0x0dc4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdc40[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x0dc4('0x0'));var moment=require('moment');var BPromise=require(_0x0dc4('0x1'));var rs=require(_0x0dc4('0x2'));var fs=require('fs');var Redis=require(_0x0dc4('0x3'));var db=require(_0x0dc4('0x4'))['db'];var utils=require(_0x0dc4('0x5'));var logger=require('../../config/logger')(_0x0dc4('0x6'));var config=require(_0x0dc4('0x7'));var jayson=require(_0x0dc4('0x8'));var client=jayson[_0x0dc4('0x9')][_0x0dc4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c3143,_0x2be2e8,_0x2bea9d){return new BPromise(function(_0x2759d6,_0x4c7f9d){return client[_0x0dc4('0xb')](_0x2c3143,_0x2bea9d)[_0x0dc4('0xc')](function(_0x4df871){logger[_0x0dc4('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2be2e8,'request\x20sent');logger[_0x0dc4('0xe')](_0x0dc4('0xf'),_0x2be2e8,_0x0dc4('0x10'),JSON[_0x0dc4('0x11')](_0x4df871));if(_0x4df871[_0x0dc4('0x12')]){if(_0x4df871[_0x0dc4('0x12')][_0x0dc4('0x13')]===0x1f4){logger[_0x0dc4('0x12')](_0x0dc4('0x14'),_0x2be2e8,_0x4df871['error'][_0x0dc4('0x15')]);return _0x4c7f9d(_0x4df871[_0x0dc4('0x12')][_0x0dc4('0x15')]);}logger[_0x0dc4('0x12')](_0x0dc4('0x14'),_0x2be2e8,_0x4df871[_0x0dc4('0x12')][_0x0dc4('0x15')]);return _0x2759d6(_0x4df871[_0x0dc4('0x12')][_0x0dc4('0x15')]);}else{logger[_0x0dc4('0xd')](_0x0dc4('0x14'),_0x2be2e8,_0x0dc4('0x10'));_0x2759d6(_0x4df871[_0x0dc4('0x16')][_0x0dc4('0x15')]);}})[_0x0dc4('0x17')](function(_0x331730){logger[_0x0dc4('0x12')](_0x0dc4('0x14'),_0x2be2e8,_0x331730);_0x4c7f9d(_0x331730);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index bb49682..f7988bb 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 _0x1373=['post','create','delete','destroy','exports','multer','util','connect-timeout','express','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','get','/describe','describe','/:id','show'];(function(_0x56d8e7,_0x3cffc1){var _0x2d6a1a=function(_0x2b884b){while(--_0x2b884b){_0x56d8e7['push'](_0x56d8e7['shift']());}};_0x2d6a1a(++_0x3cffc1);}(_0x1373,0xc0));var _0x3137=function(_0x3199af,_0x339560){_0x3199af=_0x3199af-0x0;var _0x5aa4d0=_0x1373[_0x3199af];return _0x5aa4d0;};'use strict';var multer=require(_0x3137('0x0'));var util=require(_0x3137('0x1'));var path=require('path');var timeout=require(_0x3137('0x2'));var express=require(_0x3137('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3137('0x4'));var controller=require(_0x3137('0x5'));router['get']('/',auth[_0x3137('0x6')](),controller['index']);router[_0x3137('0x7')](_0x3137('0x8'),auth[_0x3137('0x6')](),controller[_0x3137('0x9')]);router[_0x3137('0x7')](_0x3137('0xa'),auth['isAuthenticated'](),controller[_0x3137('0xb')]);router[_0x3137('0xc')]('/',auth[_0x3137('0x6')](),controller[_0x3137('0xd')]);router['put'](_0x3137('0xa'),auth[_0x3137('0x6')](),controller['update']);router[_0x3137('0xe')](_0x3137('0xa'),auth[_0x3137('0x6')](),controller[_0x3137('0xf')]);module[_0x3137('0x10')]=router; \ No newline at end of file +var _0x4801=['Router','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','show','create','put','/:id','delete','destroy','multer','util','path','express'];(function(_0x2391c0,_0x1e0bc4){var _0x5bdc66=function(_0x11bd0c){while(--_0x11bd0c){_0x2391c0['push'](_0x2391c0['shift']());}};_0x5bdc66(++_0x1e0bc4);}(_0x4801,0xf8));var _0x1480=function(_0xb72cc8,_0x3b7aa3){_0xb72cc8=_0xb72cc8-0x0;var _0x75cfb3=_0x4801[_0xb72cc8];return _0x75cfb3;};'use strict';var multer=require(_0x1480('0x0'));var util=require(_0x1480('0x1'));var path=require(_0x1480('0x2'));var timeout=require('connect-timeout');var express=require(_0x1480('0x3'));var router=express[_0x1480('0x4')]();var auth=require(_0x1480('0x5'));var interaction=require(_0x1480('0x6'));var config=require('../../config/environment');var controller=require(_0x1480('0x7'));router[_0x1480('0x8')]('/',auth[_0x1480('0x9')](),controller['index']);router[_0x1480('0x8')](_0x1480('0xa'),auth[_0x1480('0x9')](),controller[_0x1480('0xb')]);router['get']('/:id',auth[_0x1480('0x9')](),controller[_0x1480('0xc')]);router['post']('/',auth[_0x1480('0x9')](),controller[_0x1480('0xd')]);router[_0x1480('0xe')](_0x1480('0xf'),auth[_0x1480('0x9')](),controller['update']);router[_0x1480('0x10')](_0x1480('0xf'),auth[_0x1480('0x9')](),controller[_0x1480('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 f26f9ed..a9c1305 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 _0x9088=['sequelize','STRING','mouseOver','INTEGER'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x9088,0x1b4));var _0x8908=function(_0x2d136f,_0x2421be){_0x2d136f=_0x2d136f-0x0;var _0x19615f=_0x9088[_0x2d136f];return _0x19615f;};'use strict';var Sequelize=require(_0x8908('0x0'));module['exports']={'name':{'type':Sequelize[_0x8908('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8908('0x2'),'timeout'),'defaultValue':_0x8908('0x2')},'selector':{'type':Sequelize[_0x8908('0x1')]},'timeout':{'type':Sequelize[_0x8908('0x3')]}}; \ No newline at end of file +var _0xa327=['exports','ENUM','timeout','INTEGER','sequelize'];(function(_0x1b0423,_0x344880){var _0x4be849=function(_0x5e2355){while(--_0x5e2355){_0x1b0423['push'](_0x1b0423['shift']());}};_0x4be849(++_0x344880);}(_0xa327,0x153));var _0x7a32=function(_0x17d17b,_0x10ff27){_0x17d17b=_0x17d17b-0x0;var _0x16ef0a=_0xa327[_0x17d17b];return _0x16ef0a;};'use strict';var Sequelize=require(_0x7a32('0x0'));module[_0x7a32('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x7a32('0x2')]('mouseOver',_0x7a32('0x3')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x7a32('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 34a146a..58fc2be 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 _0x0713=['update','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','attributes','intersection','fields','includeAll','include','merge','options','find','catch','create','body'];(function(_0x223d98,_0x58057c){var _0x4e1d01=function(_0x217cb8){while(--_0x217cb8){_0x223d98['push'](_0x223d98['shift']());}};_0x4e1d01(++_0x58057c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var db=require(_0x3071('0x19'))['db'];function respondWithStatusCode(_0xa0c1,_0x4a8cc7){_0x4a8cc7=_0x4a8cc7||0xcc;return function(_0x5330a8){if(_0x5330a8){return _0xa0c1[_0x3071('0x1a')](_0x4a8cc7);}return _0xa0c1['status'](_0x4a8cc7)[_0x3071('0x1b')]();};}function respondWithResult(_0x44fbae,_0x5d4883){_0x5d4883=_0x5d4883||0xc8;return function(_0x104e73){if(_0x104e73){return _0x44fbae['status'](_0x5d4883)[_0x3071('0x1c')](_0x104e73);}};}function respondWithFilteredResult(_0x45c93b,_0x1271d0){return function(_0x1f14e1){if(_0x1f14e1){var _0x1caa5d=_0x1f14e1[_0x3071('0x1d')],_0x2a6a4b=_0x1271d0[_0x3071('0x1e')],_0x157a47=_0x1271d0['offset']+_0x1271d0[_0x3071('0x1f')],_0x11bdc9;if(_0x157a47>=_0x1caa5d){_0x157a47=_0x1caa5d;_0x11bdc9=0xc8;}else{_0x11bdc9=0xce;}_0x45c93b[_0x3071('0x20')](_0x11bdc9);return _0x45c93b[_0x3071('0x21')](_0x3071('0x22'),_0x2a6a4b+'-'+_0x157a47+'/'+_0x1caa5d)[_0x3071('0x1c')](_0x1f14e1);}return null;};}function patchUpdates(_0x17aee2){return function(_0x105bbb){try{jsonpatch[_0x3071('0x23')](_0x105bbb,_0x17aee2,!![]);}catch(_0x502a16){return BPromise[_0x3071('0x24')](_0x502a16);}return _0x105bbb[_0x3071('0x25')]();};}function saveUpdates(_0xd3e23d,_0x56c267){return function(_0xb8f4e3){if(_0xb8f4e3){return _0xb8f4e3['update'](_0xd3e23d)[_0x3071('0x26')](function(_0x43128c){return _0x43128c;});}return null;};}function removeEntity(_0x3762d8,_0x457b57){return function(_0x33090c){if(_0x33090c){return _0x33090c[_0x3071('0x27')]()[_0x3071('0x26')](function(){_0x3762d8[_0x3071('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(!_0xb05b1d){_0x481a51[_0x3071('0x1a')](0x194);}return _0xb05b1d;};}function handleError(_0x13df9f,_0x2793ef){_0x2793ef=_0x2793ef||0x1f4;return function(_0x44b45f){logger[_0x3071('0x28')](_0x44b45f[_0x3071('0x29')]);if(_0x44b45f[_0x3071('0x2a')]){delete _0x44b45f['name'];}_0x13df9f[_0x3071('0x20')](_0x2793ef)[_0x3071('0x2b')](_0x44b45f);};}exports[_0x3071('0x2c')]=function(_0x4d5c4b,_0x4fb1ca){var _0x28792d={'raw':!![],'where':{'id':_0x4d5c4b[_0x3071('0x2d')]['id']}},_0x163604={};_0x163604[_0x3071('0x2e')]=_[_0x3071('0x2f')](db[_0x3071('0x30')][_0x3071('0x31')]);_0x163604[_0x3071('0x32')]=_[_0x3071('0x2f')](_0x4d5c4b[_0x3071('0x32')]);_0x163604['filters']=_['intersection'](_0x163604[_0x3071('0x2e')],_0x163604[_0x3071('0x32')]);_0x28792d[_0x3071('0x33')]=_[_0x3071('0x34')](_0x163604[_0x3071('0x2e')],qs[_0x3071('0x35')](_0x4d5c4b[_0x3071('0x32')][_0x3071('0x35')]));_0x28792d['attributes']=_0x28792d['attributes']['length']?_0x28792d[_0x3071('0x33')]:_0x163604[_0x3071('0x2e')];if(_0x4d5c4b['query'][_0x3071('0x36')]){_0x28792d[_0x3071('0x37')]=[{'all':!![]}];}_0x28792d=_[_0x3071('0x38')]({},_0x28792d,_0x4d5c4b[_0x3071('0x39')]);return db['ChatProactiveAction'][_0x3071('0x3a')](_0x28792d)[_0x3071('0x26')](handleEntityNotFound(_0x4fb1ca,null))[_0x3071('0x26')](respondWithResult(_0x4fb1ca,null))[_0x3071('0x3b')](handleError(_0x4fb1ca,null));};exports[_0x3071('0x3c')]=function(_0x2068ce,_0x3c55c){return db[_0x3071('0x30')]['create'](_0x2068ce[_0x3071('0x3d')],{})['then'](respondWithResult(_0x3c55c,0xc9))['catch'](handleError(_0x3c55c,null));};exports[_0x3071('0x3e')]=function(_0xa3a7ae,_0x54d9c3){if(_0xa3a7ae[_0x3071('0x3d')]['id']){delete _0xa3a7ae[_0x3071('0x3d')]['id'];}return db[_0x3071('0x30')][_0x3071('0x3a')]({'where':{'id':_0xa3a7ae[_0x3071('0x2d')]['id']}})[_0x3071('0x26')](handleEntityNotFound(_0x54d9c3,null))['then'](saveUpdates(_0xa3a7ae[_0x3071('0x3d')],null))[_0x3071('0x26')](respondWithResult(_0x54d9c3,null))['catch'](handleError(_0x54d9c3,null));};exports[_0x3071('0x27')]=function(_0x5b1392,_0x28f855){return db[_0x3071('0x30')]['find']({'where':{'id':_0x5b1392['params']['id']}})[_0x3071('0x26')](handleEntityNotFound(_0x28f855,null))[_0x3071('0x26')](removeEntity(_0x28f855,null))[_0x3071('0x3b')](handleError(_0x28f855,null));}; \ No newline at end of file +var _0xa9e0=['keys','ChatProactiveAction','rawAttributes','query','filters','attributes','intersection','fields','length','include','options','find','create','body','catch','params','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','show','model'];(function(_0x4b03c9,_0x17ce03){var _0x161ba2=function(_0xb952db){while(--_0xb952db){_0x4b03c9['push'](_0x4b03c9['shift']());}};_0x161ba2(++_0x17ce03);}(_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={'raw':!![],'where':{'id':_0x526cf3['params']['id']}},_0x45a1e7={};_0x45a1e7[_0x0a9e('0x26')]=_[_0x0a9e('0x27')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x45a1e7[_0x0a9e('0x2a')]=_[_0x0a9e('0x27')](_0x526cf3[_0x0a9e('0x2a')]);_0x45a1e7[_0x0a9e('0x2b')]=_['intersection'](_0x45a1e7[_0x0a9e('0x26')],_0x45a1e7[_0x0a9e('0x2a')]);_0x479bc4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x45a1e7['model'],qs[_0x0a9e('0x2e')](_0x526cf3[_0x0a9e('0x2a')][_0x0a9e('0x2e')]));_0x479bc4[_0x0a9e('0x2c')]=_0x479bc4[_0x0a9e('0x2c')][_0x0a9e('0x2f')]?_0x479bc4[_0x0a9e('0x2c')]:_0x45a1e7[_0x0a9e('0x26')];if(_0x526cf3[_0x0a9e('0x2a')]['includeAll']){_0x479bc4[_0x0a9e('0x30')]=[{'all':!![]}];}_0x479bc4=_['merge']({},_0x479bc4,_0x526cf3[_0x0a9e('0x31')]);return db[_0x0a9e('0x28')][_0x0a9e('0x32')](_0x479bc4)[_0x0a9e('0x1f')](handleEntityNotFound(_0x384319,null))[_0x0a9e('0x1f')](respondWithResult(_0x384319,null))['catch'](handleError(_0x384319,null));};exports[_0x0a9e('0x33')]=function(_0x46f0a5,_0x40cb85){return db[_0x0a9e('0x28')][_0x0a9e('0x33')](_0x46f0a5[_0x0a9e('0x34')],{})[_0x0a9e('0x1f')](respondWithResult(_0x40cb85,0xc9))[_0x0a9e('0x35')](handleError(_0x40cb85,null));};exports['update']=function(_0x44295a,_0x5e7238){if(_0x44295a[_0x0a9e('0x34')]['id']){delete _0x44295a[_0x0a9e('0x34')]['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x32')]({'where':{'id':_0x44295a['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x5e7238,null))[_0x0a9e('0x1f')](saveUpdates(_0x44295a[_0x0a9e('0x34')],null))[_0x0a9e('0x1f')](respondWithResult(_0x5e7238,null))['catch'](handleError(_0x5e7238,null));};exports['destroy']=function(_0x1e8694,_0x5640eb){return db[_0x0a9e('0x28')][_0x0a9e('0x32')]({'where':{'id':_0x1e8694[_0x0a9e('0x36')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x5640eb,null))['then'](removeEntity(_0x5640eb,null))[_0x0a9e('0x35')](handleError(_0x5640eb,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 76d360d..b1aec36 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 _0xe912=['moment','rimraf','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','api'];(function(_0x13737a,_0x5390e9){var _0x1cfa79=function(_0x25aece){while(--_0x25aece){_0x13737a['push'](_0x13737a['shift']());}};_0x1cfa79(++_0x5390e9);}(_0xe912,0x138));var _0x2e91=function(_0x16ec32,_0x3ba6c8){_0x16ec32=_0x16ec32-0x0;var _0x513261=_0xe912[_0x16ec32];return _0x513261;};'use strict';var _=require(_0x2e91('0x0'));var util=require(_0x2e91('0x1'));var logger=require('../../config/logger')(_0x2e91('0x2'));var moment=require(_0x2e91('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2e91('0x4'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0x2e91('0x5')]=function(_0x45137d,_0x4d5744){return _0x45137d[_0x2e91('0x6')](_0x2e91('0x7'),attributes,{'tableName':_0x2e91('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0af=['request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe0af,0xcc));var _0xfe0a=function(_0x3feab5,_0x1849cb){_0x3feab5=_0x3feab5-0x0;var _0x4fb9e9=_0xe0af[_0x3feab5];return _0x4fb9e9;};'use strict';var _=require(_0xfe0a('0x0'));var util=require(_0xfe0a('0x1'));var logger=require(_0xfe0a('0x2'))(_0xfe0a('0x3'));var moment=require(_0xfe0a('0x4'));var BPromise=require(_0xfe0a('0x5'));var rp=require(_0xfe0a('0x6'));var fs=require('fs');var path=require(_0xfe0a('0x7'));var rimraf=require(_0xfe0a('0x8'));var config=require(_0xfe0a('0x9'));var attributes=require(_0xfe0a('0xa'));module[_0xfe0a('0xb')]=function(_0x4c84f9,_0xa35a8){return _0x4c84f9[_0xfe0a('0xc')](_0xfe0a('0xd'),attributes,{'tableName':'chat_proactive_actions','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 e1d7965..66432ed 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 _0x1a4a=['message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x337d38,_0x5cb203){var _0x502d8b=function(_0x24247c){while(--_0x24247c){_0x337d38['push'](_0x337d38['shift']());}};_0x502d8b(++_0x5cb203);}(_0x1a4a,0x1a4));var _0xa1a4=function(_0x471a02,_0x43450d){_0x471a02=_0x471a02-0x0;var _0x2b5271=_0x1a4a[_0x471a02];return _0x2b5271;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa1a4('0x0'));var BPromise=require(_0xa1a4('0x1'));var rs=require(_0xa1a4('0x2'));var fs=require('fs');var Redis=require(_0xa1a4('0x3'));var db=require(_0xa1a4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1a4('0x5'))(_0xa1a4('0x6'));var config=require(_0xa1a4('0x7'));var jayson=require(_0xa1a4('0x8'));var client=jayson[_0xa1a4('0x9')][_0xa1a4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x165e64,_0x378edf,_0x2af15d){return new BPromise(function(_0x260ea8,_0x49207b){return client[_0xa1a4('0xb')](_0x165e64,_0x2af15d)['then'](function(_0x5eb36a){logger[_0xa1a4('0xc')](_0xa1a4('0xd'),_0x378edf,_0xa1a4('0xe'));logger[_0xa1a4('0xf')](_0xa1a4('0x10'),_0x378edf,'request\x20sent',JSON[_0xa1a4('0x11')](_0x5eb36a));if(_0x5eb36a[_0xa1a4('0x12')]){if(_0x5eb36a[_0xa1a4('0x12')][_0xa1a4('0x13')]===0x1f4){logger[_0xa1a4('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x378edf,_0x5eb36a[_0xa1a4('0x12')]['message']);return _0x49207b(_0x5eb36a[_0xa1a4('0x12')][_0xa1a4('0x14')]);}logger['error'](_0xa1a4('0xd'),_0x378edf,_0x5eb36a[_0xa1a4('0x12')][_0xa1a4('0x14')]);return _0x260ea8(_0x5eb36a[_0xa1a4('0x12')]['message']);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x378edf,_0xa1a4('0xe'));_0x260ea8(_0x5eb36a['result']['message']);}})[_0xa1a4('0x15')](function(_0x10e041){logger[_0xa1a4('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x378edf,_0x10e041);_0x49207b(_0x10e041);});});} \ No newline at end of file +var _0xb943=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','stringify','error','ChatProactiveAction,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb943,0x90));var _0x3b94=function(_0x5e83ec,_0x5abaaf){_0x5e83ec=_0x5e83ec-0x0;var _0x43c08c=_0xb943[_0x5e83ec];return _0x43c08c;};'use strict';var _=require(_0x3b94('0x0'));var util=require(_0x3b94('0x1'));var moment=require(_0x3b94('0x2'));var BPromise=require('bluebird');var rs=require(_0x3b94('0x3'));var fs=require('fs');var Redis=require(_0x3b94('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3b94('0x5'));var logger=require(_0x3b94('0x6'))(_0x3b94('0x7'));var config=require('../../config/environment');var jayson=require(_0x3b94('0x8'));var client=jayson[_0x3b94('0x9')][_0x3b94('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x168611,_0x193f19,_0x23d2ba){return new BPromise(function(_0x2bfd6a,_0x2937bb){return client[_0x3b94('0xb')](_0x168611,_0x23d2ba)[_0x3b94('0xc')](function(_0x28a89c){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x193f19,_0x3b94('0xd'));logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x193f19,_0x3b94('0xd'),JSON[_0x3b94('0xe')](_0x28a89c));if(_0x28a89c[_0x3b94('0xf')]){if(_0x28a89c['error']['code']===0x1f4){logger[_0x3b94('0xf')](_0x3b94('0x10'),_0x193f19,_0x28a89c[_0x3b94('0xf')][_0x3b94('0x11')]);return _0x2937bb(_0x28a89c[_0x3b94('0xf')]['message']);}logger[_0x3b94('0xf')](_0x3b94('0x10'),_0x193f19,_0x28a89c[_0x3b94('0xf')][_0x3b94('0x11')]);return _0x2bfd6a(_0x28a89c['error'][_0x3b94('0x11')]);}else{logger[_0x3b94('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x193f19,_0x3b94('0xd'));_0x2bfd6a(_0x28a89c[_0x3b94('0x13')]['message']);}})[_0x3b94('0x14')](function(_0x491a4a){logger[_0x3b94('0xf')](_0x3b94('0x10'),_0x193f19,_0x491a4a);_0x2937bb(_0x491a4a);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 989a40b..15f63d9 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 _0x33d8=['create','put','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post'];(function(_0x3a4464,_0x37afa0){var _0x42503f=function(_0x379ce7){while(--_0x379ce7){_0x3a4464['push'](_0x3a4464['shift']());}};_0x42503f(++_0x37afa0);}(_0x33d8,0x1a7));var _0x833d=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x33d8[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require('multer');var util=require(_0x833d('0x0'));var path=require(_0x833d('0x1'));var timeout=require(_0x833d('0x2'));var express=require(_0x833d('0x3'));var router=express[_0x833d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x833d('0x5'));var config=require(_0x833d('0x6'));var controller=require('./chatProactiveAction.controller');router[_0x833d('0x7')](_0x833d('0x8'),auth[_0x833d('0x9')](),controller[_0x833d('0xa')]);router[_0x833d('0xb')]('/',auth[_0x833d('0x9')](),controller[_0x833d('0xc')]);router[_0x833d('0xd')](_0x833d('0x8'),auth[_0x833d('0x9')](),controller['update']);router['delete'](_0x833d('0x8'),auth[_0x833d('0x9')](),controller[_0x833d('0xe')]);module['exports']=router; \ No newline at end of file +var _0x1987=['Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','util','path','connect-timeout'];(function(_0xbb66a,_0x28bf42){var _0x5b69a5=function(_0x19151e){while(--_0x19151e){_0xbb66a['push'](_0xbb66a['shift']());}};_0x5b69a5(++_0x28bf42);}(_0x1987,0x1cd));var _0x7198=function(_0x2cd162,_0x4667ec){_0x2cd162=_0x2cd162-0x0;var _0x48e957=_0x1987[_0x2cd162];return _0x48e957;};'use strict';var multer=require('multer');var util=require(_0x7198('0x0'));var path=require(_0x7198('0x1'));var timeout=require(_0x7198('0x2'));var express=require('express');var router=express[_0x7198('0x3')]();var auth=require(_0x7198('0x4'));var interaction=require(_0x7198('0x5'));var config=require('../../config/environment');var controller=require(_0x7198('0x6'));router['get'](_0x7198('0x7'),auth[_0x7198('0x8')](),controller[_0x7198('0x9')]);router[_0x7198('0xa')]('/',auth[_0x7198('0x8')](),controller[_0x7198('0xb')]);router[_0x7198('0xc')](_0x7198('0x7'),auth[_0x7198('0x8')](),controller[_0x7198('0xd')]);router['delete'](_0x7198('0x7'),auth['isAuthenticated'](),controller[_0x7198('0xe')]);module[_0x7198('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 3f92504..d05ffac 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 _0xab34=['STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x2e6f0b,_0x5de9f0){var _0x5628d2=function(_0x1236e4){while(--_0x1236e4){_0x2e6f0b['push'](_0x2e6f0b['shift']());}};_0x5628d2(++_0x5de9f0);}(_0xab34,0xed));var _0x4ab3=function(_0x1353c6,_0x1ab9b9){_0x1353c6=_0x1353c6-0x0;var _0xabaadb=_0xab34[_0x1353c6];return _0xabaadb;};'use strict';var Sequelize=require(_0x4ab3('0x0'));module['exports']={'name':{'type':Sequelize[_0x4ab3('0x1')],'unique':_0x4ab3('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4ab3('0x1')]},'timeout':{'type':Sequelize[_0x4ab3('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4ab3('0x4')](_0x4ab3('0x5'),'beepall',_0x4ab3('0x6'))}}; \ No newline at end of file +var _0x87d8=['STRING','rrmemory','beepall','sequelize','name'];(function(_0xf28958,_0x53f0ed){var _0x4a4ce4=function(_0x5275fb){while(--_0x5275fb){_0xf28958['push'](_0xf28958['shift']());}};_0x4a4ce4(++_0x53f0ed);}(_0x87d8,0x170));var _0x887d=function(_0x2dee2f,_0x19572f){_0x2dee2f=_0x2dee2f-0x0;var _0x327c18=_0x87d8[_0x2dee2f];return _0x327c18;};'use strict';var Sequelize=require(_0x887d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x887d('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x887d('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x887d('0x3'),_0x887d('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 3f0943f..1c89dbb 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 _0xeff7=['then','get','ChatQueues','stack','send','index','map','ChatQueue','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','ChatQueueId','findAll','UserId','chatPause','createdAt','format','%s/%s','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','User','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','test','Sequelize','ValidationError','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0xeff7,0x1a5));var _0x7eff=function(_0x525255,_0x310fad){_0x525255=_0x525255-0x0;var _0x1de3cb=_0xeff7[_0x525255];return _0x1de3cb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7eff('0x0'));var rimraf=require(_0x7eff('0x1'));var zipdir=require(_0x7eff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7eff('0x3'));var moment=require(_0x7eff('0x4'));var BPromise=require(_0x7eff('0x5'));var Mustache=require(_0x7eff('0x6'));var util=require(_0x7eff('0x7'));var path=require(_0x7eff('0x8'));var sox=require(_0x7eff('0x9'));var csv=require(_0x7eff('0xa'));var ejs=require(_0x7eff('0xb'));var fs=require('fs');var _=require(_0x7eff('0xc'));var squel=require(_0x7eff('0xd'));var crypto=require(_0x7eff('0xe'));var jsforce=require(_0x7eff('0xf'));var deskjs=require(_0x7eff('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7eff('0x11'));var Redis=require(_0x7eff('0x12'));var authService=require(_0x7eff('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7eff('0x14'));var hardwareService=require(_0x7eff('0x15'));var logger=require(_0x7eff('0x16'))('api');var utils=require(_0x7eff('0x17'));var config=require(_0x7eff('0x18'));var db=require(_0x7eff('0x19'))['db'];config[_0x7eff('0x1a')]=_[_0x7eff('0x1b')](config[_0x7eff('0x1a')],{'host':_0x7eff('0x1c'),'port':0x18eb});var socket=require(_0x7eff('0x1d'))(new Redis(config[_0x7eff('0x1a')]));require('./chatQueue.socket')[_0x7eff('0x1e')](socket);var jayson=require(_0x7eff('0x1f'));var client=jayson['client'][_0x7eff('0x20')]({'port':0x232a});function checkPasswordPattern(_0x19885a,_0x827078,_0x10d5a2){if(_0x10d5a2){var _0xf25cc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xf25cc[_0x7eff('0x21')](_0x827078)){return _0x19885a;}else{throw new db[(_0x7eff('0x22'))][(_0x7eff('0x23'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x19885a;}}function respondWithRpcPromise(_0x54d60d,_0x19112d,_0x6061a1,_0xd0de16){return new BPromise(function(_0xbe05c6,_0x44e8e5){var _0x102b71=_0xd0de16||client;return _0x102b71[_0x7eff('0x24')](_0x54d60d,_0x6061a1)['then'](function(_0x20eb1a){logger[_0x7eff('0x25')](_0x7eff('0x26'),_0x19112d,_0x7eff('0x27'));logger['debug'](_0x7eff('0x28'),_0x19112d,_0x7eff('0x27'),JSON[_0x7eff('0x29')](_0x20eb1a));if(_0x20eb1a[_0x7eff('0x2a')]){if(_0x20eb1a['error']['code']===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x19112d,_0x20eb1a[_0x7eff('0x2a')]['message']);return _0x44e8e5(_0x20eb1a[_0x7eff('0x2a')][_0x7eff('0x2b')]);}logger[_0x7eff('0x2a')](_0x7eff('0x26'),_0x19112d,_0x20eb1a[_0x7eff('0x2a')][_0x7eff('0x2b')]);return _0xbe05c6(_0x20eb1a[_0x7eff('0x2a')]['message']);}else{logger[_0x7eff('0x25')](_0x7eff('0x26'),_0x19112d,'request\x20sent');_0xbe05c6(_0x20eb1a[_0x7eff('0x2c')]['message']);}})[_0x7eff('0x2d')](function(_0x2d45ec){logger[_0x7eff('0x2a')]('ChatQueue,\x20%s,\x20%s',_0x19112d,_0x2d45ec);_0x44e8e5(_0x2d45ec);});});}function respondWithStatusCode(_0x240ae2,_0x28c679){_0x28c679=_0x28c679||0xcc;return function(_0x22010b){if(_0x22010b){return _0x240ae2[_0x7eff('0x2e')](_0x28c679);}return _0x240ae2[_0x7eff('0x2f')](_0x28c679)[_0x7eff('0x30')]();};}function respondWithResult(_0x3129f2,_0x5947fe){_0x5947fe=_0x5947fe||0xc8;return function(_0x25d4f8){if(_0x25d4f8){return _0x3129f2[_0x7eff('0x2f')](_0x5947fe)[_0x7eff('0x31')](_0x25d4f8);}};}function respondWithFilteredResult(_0x7e86ed,_0x3465de){return function(_0x3013b8){if(_0x3013b8){var _0x543087=_0x3013b8[_0x7eff('0x32')],_0x422f13=_0x3465de[_0x7eff('0x33')],_0x37aa47=_0x3465de[_0x7eff('0x33')]+_0x3465de[_0x7eff('0x34')],_0x4fd3a8;if(_0x37aa47>=_0x543087){_0x37aa47=_0x543087;_0x4fd3a8=0xc8;}else{_0x4fd3a8=0xce;}_0x7e86ed[_0x7eff('0x2f')](_0x4fd3a8);return _0x7e86ed[_0x7eff('0x35')](_0x7eff('0x36'),_0x422f13+'-'+_0x37aa47+'/'+_0x543087)[_0x7eff('0x31')](_0x3013b8);}return null;};}function patchUpdates(_0x4f5106){return function(_0x55fea7){try{jsonpatch[_0x7eff('0x37')](_0x55fea7,_0x4f5106,!![]);}catch(_0x1475ab){return BPromise[_0x7eff('0x38')](_0x1475ab);}return _0x55fea7[_0x7eff('0x39')]();};}function saveUpdates(_0x24d598,_0x378362){return function(_0x2efe42){if(_0x2efe42){return _0x2efe42['update'](_0x24d598)['then'](function(_0x562d21){return _0x562d21;});}return null;};}function removeEntity(_0x10cc42,_0x289920){return function(_0x15770a){if(_0x15770a){return _0x15770a[_0x7eff('0x3a')]()[_0x7eff('0x3b')](function(){var _0x27cfa4=_0x15770a[_0x7eff('0x3c')]({'plain':!![]});var _0x197f2d=_0x7eff('0x3d');return db['UserProfileResource'][_0x7eff('0x3a')]({'where':{'type':_0x197f2d,'resourceId':_0x27cfa4['id']}})[_0x7eff('0x3b')](function(){return _0x15770a;});})[_0x7eff('0x3b')](function(){_0x10cc42[_0x7eff('0x2f')](0xcc)[_0x7eff('0x30')]();});}};}function handleEntityNotFound(_0x320f86,_0x3451c5){return function(_0x592954){if(!_0x592954){_0x320f86[_0x7eff('0x2e')](0x194);}return _0x592954;};}function handleError(_0x5837cd,_0x20e4b4){_0x20e4b4=_0x20e4b4||0x1f4;return function(_0x48fc4d){logger['error'](_0x48fc4d[_0x7eff('0x3e')]);if(_0x48fc4d['name']){delete _0x48fc4d['name'];}_0x5837cd[_0x7eff('0x2f')](_0x20e4b4)[_0x7eff('0x3f')](_0x48fc4d);};}exports[_0x7eff('0x40')]=function(_0x4566bc,_0x5d6170){var _0x485561={},_0x2b537b={},_0x325ea0={'count':0x0,'rows':[]};var _0x37e303=_[_0x7eff('0x41')](db[_0x7eff('0x42')]['rawAttributes'],function(_0x349f48){return{'name':_0x349f48['fieldName'],'type':_0x349f48[_0x7eff('0x43')][_0x7eff('0x44')]};});_0x2b537b[_0x7eff('0x45')]=_['map'](_0x37e303,_0x7eff('0x46'));_0x2b537b[_0x7eff('0x47')]=_[_0x7eff('0x48')](_0x4566bc[_0x7eff('0x47')]);_0x2b537b[_0x7eff('0x49')]=_[_0x7eff('0x4a')](_0x2b537b[_0x7eff('0x45')],_0x2b537b[_0x7eff('0x47')]);_0x485561[_0x7eff('0x4b')]=_[_0x7eff('0x4a')](_0x2b537b[_0x7eff('0x45')],qs[_0x7eff('0x4c')](_0x4566bc[_0x7eff('0x47')][_0x7eff('0x4c')]));_0x485561[_0x7eff('0x4b')]=_0x485561[_0x7eff('0x4b')][_0x7eff('0x4d')]?_0x485561['attributes']:_0x2b537b['model'];if(!_0x4566bc[_0x7eff('0x47')]['hasOwnProperty'](_0x7eff('0x4e'))){_0x485561['limit']=qs[_0x7eff('0x34')](_0x4566bc[_0x7eff('0x47')][_0x7eff('0x34')]);_0x485561[_0x7eff('0x33')]=qs['offset'](_0x4566bc[_0x7eff('0x47')][_0x7eff('0x33')]);}_0x485561[_0x7eff('0x4f')]=qs[_0x7eff('0x50')](_0x4566bc[_0x7eff('0x47')][_0x7eff('0x50')]);_0x485561[_0x7eff('0x51')]=qs[_0x7eff('0x49')](_[_0x7eff('0x52')](_0x4566bc[_0x7eff('0x47')],_0x2b537b[_0x7eff('0x49')]),_0x37e303);if(_0x4566bc[_0x7eff('0x47')][_0x7eff('0x53')]){_0x485561[_0x7eff('0x51')]=_['merge'](_0x485561['where'],{'$or':_['map'](_0x37e303,function(_0x317949){if(_0x317949['type']!==_0x7eff('0x54')){var _0x26cc3b={};_0x26cc3b[_0x317949[_0x7eff('0x46')]]={'$like':'%'+_0x4566bc['query'][_0x7eff('0x53')]+'%'};return _0x26cc3b;}})});}_0x485561=_[_0x7eff('0x55')]({},_0x485561,_0x4566bc[_0x7eff('0x56')]);var _0x422bc7={'where':_0x485561[_0x7eff('0x51')]};return db[_0x7eff('0x42')][_0x7eff('0x32')](_0x422bc7)[_0x7eff('0x3b')](function(_0x4594dc){_0x325ea0[_0x7eff('0x32')]=_0x4594dc;if(_0x4566bc[_0x7eff('0x47')][_0x7eff('0x57')]){_0x485561['include']=[{'all':!![]}];}return db[_0x7eff('0x42')]['findAll'](_0x485561);})[_0x7eff('0x3b')](function(_0xf0f9b4){_0x325ea0[_0x7eff('0x58')]=_0xf0f9b4;return _0x325ea0;})[_0x7eff('0x3b')](respondWithFilteredResult(_0x5d6170,_0x485561))[_0x7eff('0x2d')](handleError(_0x5d6170,null));};exports['show']=function(_0x38695a,_0x52cc92){var _0x720d87={'raw':!![],'where':{'id':_0x38695a['params']['id']}},_0x5ae5d0={};_0x5ae5d0[_0x7eff('0x45')]=_[_0x7eff('0x48')](db[_0x7eff('0x42')][_0x7eff('0x59')]);_0x5ae5d0[_0x7eff('0x47')]=_[_0x7eff('0x48')](_0x38695a['query']);_0x5ae5d0[_0x7eff('0x49')]=_[_0x7eff('0x4a')](_0x5ae5d0[_0x7eff('0x45')],_0x5ae5d0['query']);_0x720d87[_0x7eff('0x4b')]=_[_0x7eff('0x4a')](_0x5ae5d0[_0x7eff('0x45')],qs['fields'](_0x38695a[_0x7eff('0x47')]['fields']));_0x720d87['attributes']=_0x720d87[_0x7eff('0x4b')][_0x7eff('0x4d')]?_0x720d87[_0x7eff('0x4b')]:_0x5ae5d0[_0x7eff('0x45')];if(_0x38695a['query']['includeAll']){_0x720d87[_0x7eff('0x5a')]=[{'all':!![]}];}_0x720d87=_[_0x7eff('0x55')]({},_0x720d87,_0x38695a[_0x7eff('0x56')]);return db[_0x7eff('0x42')][_0x7eff('0x5b')](_0x720d87)[_0x7eff('0x3b')](handleEntityNotFound(_0x52cc92,null))['then'](respondWithResult(_0x52cc92,null))[_0x7eff('0x2d')](handleError(_0x52cc92,null));};exports[_0x7eff('0x5c')]=function(_0x9acab,_0x96fd95){return db[_0x7eff('0x42')][_0x7eff('0x5c')](_0x9acab[_0x7eff('0x5d')],{})[_0x7eff('0x3b')](function(_0x5aaff9){var _0x2adb52=_0x9acab[_0x7eff('0x5e')]['get']({'plain':!![]});if(!_0x2adb52)throw new Error(_0x7eff('0x5f'));if(_0x2adb52['role']===_0x7eff('0x5e')){var _0x14eb03=_0x5aaff9[_0x7eff('0x3c')]({'plain':!![]});var _0x4901c6=_0x7eff('0x3d');return db[_0x7eff('0x60')][_0x7eff('0x5b')]({'where':{'name':_0x4901c6,'userProfileId':_0x2adb52[_0x7eff('0x61')]},'raw':!![]})[_0x7eff('0x3b')](function(_0x372686){if(_0x372686&&_0x372686[_0x7eff('0x62')]===0x0){return db[_0x7eff('0x63')]['create']({'name':_0x14eb03[_0x7eff('0x46')],'resourceId':_0x14eb03['id'],'type':_0x372686['name'],'sectionId':_0x372686['id']},{})[_0x7eff('0x3b')](function(){return _0x5aaff9;});}else{return _0x5aaff9;}})[_0x7eff('0x2d')](function(_0x1da6cd){logger[_0x7eff('0x2a')](_0x7eff('0x64'),_0x1da6cd);throw _0x1da6cd;});}return _0x5aaff9;})[_0x7eff('0x3b')](respondWithResult(_0x96fd95,0xc9))[_0x7eff('0x2d')](handleError(_0x96fd95,null));};exports[_0x7eff('0x65')]=function(_0x5d7c31,_0x249142){if(_0x5d7c31['body']['id']){delete _0x5d7c31[_0x7eff('0x5d')]['id'];}return db[_0x7eff('0x42')][_0x7eff('0x5b')]({'where':{'id':_0x5d7c31[_0x7eff('0x66')]['id']}})[_0x7eff('0x3b')](handleEntityNotFound(_0x249142,null))[_0x7eff('0x3b')](saveUpdates(_0x5d7c31['body'],null))[_0x7eff('0x3b')](respondWithResult(_0x249142,null))[_0x7eff('0x2d')](handleError(_0x249142,null));};exports[_0x7eff('0x3a')]=function(_0x5a0c06,_0x3cf507){return db[_0x7eff('0x42')][_0x7eff('0x5b')]({'where':{'id':_0x5a0c06[_0x7eff('0x66')]['id']}})[_0x7eff('0x3b')](handleEntityNotFound(_0x3cf507,null))['then'](removeEntity(_0x3cf507,null))[_0x7eff('0x2d')](handleError(_0x3cf507,null));};exports['describe']=function(_0xa674c0,_0x516565){return db[_0x7eff('0x42')][_0x7eff('0x67')]()[_0x7eff('0x3b')](respondWithResult(_0x516565,null))[_0x7eff('0x2d')](handleError(_0x516565,null));};exports[_0x7eff('0x68')]=function(_0x3d33b5,_0x398cf7,_0x76da52){var _0x1e82c6={'raw':!![],'where':{}},_0x1cd1b1={},_0xb05dc1;return db[_0x7eff('0x42')][_0x7eff('0x69')]({'where':{'id':_0x3d33b5['params']['id']}})['then'](handleEntityNotFound(_0x398cf7,null))[_0x7eff('0x3b')](function(_0x5bd546){if(_0x5bd546){_0xb05dc1=_0x5bd546[_0x7eff('0x3c')]({'plain':!![]});_0x1cd1b1[_0x7eff('0x45')]=_[_0x7eff('0x48')](db[_0x7eff('0x6a')]['rawAttributes']);_0x1cd1b1[_0x7eff('0x47')]=_[_0x7eff('0x48')](_0x3d33b5[_0x7eff('0x47')]);_0x1cd1b1[_0x7eff('0x49')]=_[_0x7eff('0x4a')](_0x1cd1b1[_0x7eff('0x45')],_0x1cd1b1[_0x7eff('0x47')]);_0x1e82c6[_0x7eff('0x4b')]=_[_0x7eff('0x4a')](_0x1cd1b1[_0x7eff('0x45')],qs[_0x7eff('0x4c')](_0x3d33b5[_0x7eff('0x47')][_0x7eff('0x4c')]));_0x1e82c6['attributes']=_0x1e82c6[_0x7eff('0x4b')][_0x7eff('0x4d')]?_0x1e82c6[_0x7eff('0x4b')]:_0x1cd1b1[_0x7eff('0x45')];if(!_0x3d33b5[_0x7eff('0x47')][_0x7eff('0x6b')](_0x7eff('0x4e'))){_0x1e82c6[_0x7eff('0x34')]=qs[_0x7eff('0x34')](_0x3d33b5['query'][_0x7eff('0x34')]);_0x1e82c6[_0x7eff('0x33')]=qs[_0x7eff('0x33')](_0x3d33b5[_0x7eff('0x47')][_0x7eff('0x33')]);}_0x1e82c6[_0x7eff('0x4f')]=qs['sort'](_0x3d33b5['query']['sort']);_0x1e82c6[_0x7eff('0x51')]=qs[_0x7eff('0x49')](_['pick'](_0x3d33b5[_0x7eff('0x47')],_0x1cd1b1[_0x7eff('0x49')]));_0x1e82c6[_0x7eff('0x51')][_0x7eff('0x6c')]=_0x5bd546['id'];if(_0x3d33b5[_0x7eff('0x47')][_0x7eff('0x53')]){_0x1e82c6[_0x7eff('0x51')]=_[_0x7eff('0x55')](_0x1e82c6[_0x7eff('0x51')],{'$or':_[_0x7eff('0x41')](_0x1e82c6[_0x7eff('0x4b')],function(_0xc811b1){var _0x5c2420={};_0x5c2420[_0xc811b1]={'$like':'%'+_0x3d33b5['query'][_0x7eff('0x53')]+'%'};return _0x5c2420;})});}_0x1e82c6=_['merge']({},_0x1e82c6,_0x3d33b5[_0x7eff('0x56')]);return db[_0x7eff('0x6a')][_0x7eff('0x6d')](_0x1e82c6);}})[_0x7eff('0x3b')](function(_0x4d65b3){if(_0x4d65b3){return db['User']['findAndCountAll']({'where':{'id':_[_0x7eff('0x41')](_0x4d65b3,_0x7eff('0x6e')),'role':'agent'},'attributes':['id','name',_0x7eff('0x6f'),'updatedAt',_0x7eff('0x70')]});}})[_0x7eff('0x3b')](function(_0x2484c0){if(_0x2484c0){return{'count':_0x2484c0[_0x7eff('0x32')],'rows':_[_0x7eff('0x41')](_0x2484c0[_0x7eff('0x58')],function(_0x536afd){return{'membername':_0x536afd[_0x7eff('0x46')],'UserId':_0x536afd['id'],'queue_name':_0xb05dc1[_0x7eff('0x46')],'ChatQueueId':_0xb05dc1['id'],'interface':util[_0x7eff('0x71')](_0x7eff('0x72'),'SIP',_0x536afd[_0x7eff('0x46')]),'penalty':0x0,'paused':_0x536afd[_0x7eff('0x6f')],'createdAt':_0x536afd['createdAt'],'updatedAt':_0x536afd[_0x7eff('0x73')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7eff('0x3b')](respondWithFilteredResult(_0x398cf7,_0x1e82c6))[_0x7eff('0x2d')](handleError(_0x398cf7,null));};exports[_0x7eff('0x74')]=function(_0x1b7f55,_0x31a8c6,_0x3439e3){var _0x513e18={};var _0x5417e6={};var _0x4de14d;var _0x5c04ef;return db[_0x7eff('0x42')]['findOne']({'where':{'id':_0x1b7f55[_0x7eff('0x66')]['id']}})[_0x7eff('0x3b')](handleEntityNotFound(_0x31a8c6,null))[_0x7eff('0x3b')](function(_0x10fac9){if(_0x10fac9){_0x4de14d=_0x10fac9;_0x5417e6[_0x7eff('0x45')]=_[_0x7eff('0x48')](db[_0x7eff('0x75')][_0x7eff('0x59')]);_0x5417e6[_0x7eff('0x47')]=_[_0x7eff('0x48')](_0x1b7f55[_0x7eff('0x47')]);_0x5417e6[_0x7eff('0x49')]=_[_0x7eff('0x4a')](_0x5417e6[_0x7eff('0x45')],_0x5417e6[_0x7eff('0x47')]);_0x513e18[_0x7eff('0x4b')]=_['intersection'](_0x5417e6['model'],qs[_0x7eff('0x4c')](_0x1b7f55[_0x7eff('0x47')][_0x7eff('0x4c')]));_0x513e18[_0x7eff('0x4b')]=_0x513e18[_0x7eff('0x4b')]['length']?_0x513e18['attributes']:_0x5417e6['model'];_0x513e18['order']=qs[_0x7eff('0x50')](_0x1b7f55['query'][_0x7eff('0x50')]);_0x513e18[_0x7eff('0x51')]=qs[_0x7eff('0x49')](_[_0x7eff('0x52')](_0x1b7f55[_0x7eff('0x47')],_0x5417e6[_0x7eff('0x49')]));if(_0x1b7f55[_0x7eff('0x47')][_0x7eff('0x53')]){_0x513e18[_0x7eff('0x51')]=_[_0x7eff('0x55')](_0x513e18[_0x7eff('0x51')],{'$or':_[_0x7eff('0x41')](_0x513e18[_0x7eff('0x4b')],function(_0x4f2b9e){var _0x121238={};_0x121238[_0x4f2b9e]={'$like':'%'+_0x1b7f55[_0x7eff('0x47')][_0x7eff('0x53')]+'%'};return _0x121238;})});}_0x513e18=_['merge']({},_0x513e18,_0x1b7f55[_0x7eff('0x56')]);return _0x4de14d[_0x7eff('0x74')](_0x513e18);}})[_0x7eff('0x3b')](function(_0x1a4130){if(_0x1a4130){_0x5c04ef=_0x1a4130[_0x7eff('0x4d')];if(!_0x1b7f55[_0x7eff('0x47')][_0x7eff('0x6b')](_0x7eff('0x4e'))){_0x513e18[_0x7eff('0x34')]=qs['limit'](_0x1b7f55[_0x7eff('0x47')]['limit']);_0x513e18[_0x7eff('0x33')]=qs['offset'](_0x1b7f55[_0x7eff('0x47')][_0x7eff('0x33')]);}return _0x4de14d[_0x7eff('0x74')](_0x513e18);}})['then'](function(_0x4d4617){if(_0x4d4617){return _0x4d4617?{'count':_0x5c04ef,'rows':_0x4d4617}:null;}})[_0x7eff('0x3b')](respondWithResult(_0x31a8c6,null))[_0x7eff('0x2d')](handleError(_0x31a8c6,null));};exports[_0x7eff('0x76')]=function(_0x13bdec,_0x5375be,_0x3e2628){var _0x1e4e63=_0x13bdec[_0x7eff('0x5d')][_0x7eff('0x77')];return db[_0x7eff('0x75')][_0x7eff('0x6d')]({'where':{'id':_0x1e4e63},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7eff('0x78'),'attributes':['id',_0x7eff('0x46'),_0x7eff('0x79'),_0x7eff('0x7a'),'interface'],'raw':!![]}]})[_0x7eff('0x3b')](function(_0x18aa98){if(_0x18aa98){var _0x5dd5e2=_['flatMap'](_0x18aa98,function(_0x16e551){var _0xb9545e=_0x16e551[_0x7eff('0x3c')]({'plain':!![]});return _0xb9545e[_0x7eff('0x78')];});return db[_0x7eff('0x42')][_0x7eff('0x5b')]({'where':{'id':_0x13bdec[_0x7eff('0x66')]['id']}})[_0x7eff('0x3b')](function(_0x5d9f1c){return db[_0x7eff('0x7b')][_0x7eff('0x7c')](function(_0x1e1ad3){return _0x5d9f1c['addTeams'](_0x1e4e63,{'transaction':_0x1e1ad3})[_0x7eff('0x3b')](function(){return BPromise[_0x7eff('0x7d')](_0x5dd5e2,function(_0x1f70e3){return db[_0x7eff('0x6a')][_0x7eff('0x7e')]({'where':{'UserId':_0x1f70e3['id'],'ChatQueueId':_0x13bdec[_0x7eff('0x66')]['id']},'transaction':_0x1e1ad3});});})[_0x7eff('0x3b')](function(){_0x5dd5e2[_0x7eff('0x7f')](function(_0x59200e){socket[_0x7eff('0x80')](_0x7eff('0x81'),{'UserId':_0x59200e['id'],'ChatQueueId':_0x5d9f1c['id']});});});});});}})[_0x7eff('0x3b')](respondWithStatusCode(_0x5375be,null))['catch'](handleError(_0x5375be,null));};exports[_0x7eff('0x82')]=function(_0x24dcb9,_0x2c7753,_0x7559df){return db[_0x7eff('0x75')]['findAll']({'where':{'id':_0x24dcb9[_0x7eff('0x47')][_0x7eff('0x77')]},'attributes':['id'],'include':[{'model':db[_0x7eff('0x83')],'as':_0x7eff('0x78'),'attributes':['id'],'raw':!![]}]})[_0x7eff('0x3b')](handleEntityNotFound(_0x2c7753,null))[_0x7eff('0x3b')](function(_0x5ae968){var _0x206b1f=_[_0x7eff('0x41')](_0x5ae968,'id');var _0x1e119b=[];var _0x327c7b=[];var _0x3644b1=squel[_0x7eff('0x84')]();_0x3644b1[_0x7eff('0x85')](_0x7eff('0x86'))[_0x7eff('0x87')](_0x7eff('0x88'),'tq')[_0x7eff('0x89')](_0x7eff('0x8a'),'ut',_0x7eff('0x8b'))['where'](_0x7eff('0x8c'),_0x24dcb9[_0x7eff('0x66')]['id']);for(var _0x2b38ed=0x0;_0x2b38ed<_0x5ae968[_0x7eff('0x4d')];_0x2b38ed+=0x1){let _0x43a054=_0x5ae968[_0x2b38ed];for(var _0x55d489=0x0;_0x55d489<_0x43a054['Agents'][_0x7eff('0x4d')];_0x55d489+=0x1){let _0x5050b5=_0x43a054[_0x7eff('0x78')][_0x55d489];var _0x335ee6=_0x3644b1[_0x7eff('0x8d')]();_0x335ee6[_0x7eff('0x51')](_0x7eff('0x8e'),_0x5050b5['id']);_0x327c7b[_0x7eff('0x8f')](db[_0x7eff('0x7b')][_0x7eff('0x47')](_0x335ee6[_0x7eff('0x90')](),{'type':db[_0x7eff('0x7b')][_0x7eff('0x91')][_0x7eff('0x92')]})[_0x7eff('0x3b')](function(_0x35dc62){if(_0x35dc62['length']===0x1){return _0x5050b5['id'];}else{var _0x5a4c07=_[_0x7eff('0x93')](_['map'](_0x35dc62,'TeamId'),function(_0xef4893){return _[_0x7eff('0x94')](_0x206b1f,_0xef4893);});if(_0x5a4c07){return _0x5050b5['id'];}}}));}}return BPromise[_0x7eff('0x95')](_0x327c7b)[_0x7eff('0x3b')](function(_0x27b242){_0x1e119b=_(_0x1e119b)[_0x7eff('0x96')](_0x27b242)[_0x7eff('0x97')]()[_0x7eff('0x98')]();return db['ChatQueue'][_0x7eff('0x5b')]({'where':{'id':_0x24dcb9[_0x7eff('0x66')]['id']}})[_0x7eff('0x3b')](function(_0x4a04c0){return db['sequelize']['transaction'](function(_0x12c2db){return _0x4a04c0[_0x7eff('0x82')](_0x24dcb9[_0x7eff('0x47')][_0x7eff('0x77')],{'transaction':_0x12c2db})[_0x7eff('0x3b')](function(){if(!_[_0x7eff('0x99')](_0x1e119b)){return _0x4a04c0[_0x7eff('0x9a')](_0x1e119b,{'transaction':_0x12c2db});}})[_0x7eff('0x3b')](function(){_0x1e119b['forEach'](function(_0x7a0bc8){socket['emit'](_0x7eff('0x9b'),{'UserId':_0x7a0bc8,'ChatQueueId':_0x4a04c0['id']});});});});});});})[_0x7eff('0x3b')](respondWithStatusCode(_0x2c7753,null))[_0x7eff('0x2d')](handleError(_0x2c7753,null));};exports['addAgents']=function(_0x51d629,_0x59a7d4,_0x9b6900){return db[_0x7eff('0x42')][_0x7eff('0x5b')]({'where':{'id':_0x51d629['params']['id']}})[_0x7eff('0x3b')](handleEntityNotFound(_0x59a7d4,null))['then'](function(_0x424d0f){if(_0x424d0f){return _0x424d0f[_0x7eff('0x9c')](_0x51d629[_0x7eff('0x5d')]['ids'],_[_0x7eff('0x9d')](_0x51d629['body'],[_0x7eff('0x77'),'id'])||{})[_0x7eff('0x9e')](function(_0xd4d277){for(var _0x457af9=0x0;_0x457af9<_0x51d629[_0x7eff('0x5d')][_0x7eff('0x77')][_0x7eff('0x4d')];_0x457af9+=0x1){socket[_0x7eff('0x80')](_0x7eff('0x81'),{'UserId':_0x51d629['body']['ids'][_0x457af9],'ChatQueueId':_0x51d629[_0x7eff('0x66')]['id']});}return _0xd4d277;});}})['then'](respondWithResult(_0x59a7d4,null))[_0x7eff('0x2d')](handleError(_0x59a7d4,null));};exports[_0x7eff('0x9a')]=function(_0x15b93c,_0xf31cf9,_0x495045){return db['ChatQueue']['find']({'where':{'id':_0x15b93c[_0x7eff('0x66')]['id']}})['then'](handleEntityNotFound(_0xf31cf9,null))[_0x7eff('0x3b')](function(_0xc57b32){if(_0xc57b32){return _0xc57b32[_0x7eff('0x9a')](_0x15b93c[_0x7eff('0x47')][_0x7eff('0x77')])['then'](function(){if(_['isArray'](_0x15b93c[_0x7eff('0x47')]['ids'])){for(var _0x347091=0x0;_0x347091<_0x15b93c['query'][_0x7eff('0x77')][_0x7eff('0x4d')];_0x347091+=0x1){socket[_0x7eff('0x80')]('userChatQueue:remove',{'UserId':Number(_0x15b93c[_0x7eff('0x47')][_0x7eff('0x77')][_0x347091]),'ChatQueueId':Number(_0x15b93c[_0x7eff('0x66')]['id'])});}}else{socket[_0x7eff('0x80')]('userChatQueue:remove',{'UserId':Number(_0x15b93c['query']['ids']),'ChatQueueId':Number(_0x15b93c[_0x7eff('0x66')]['id'])});}});}})[_0x7eff('0x3b')](respondWithStatusCode(_0xf31cf9,null))[_0x7eff('0x2d')](handleError(_0xf31cf9,null));};exports[_0x7eff('0x9f')]=function(_0x3c6624,_0x47e4d2,_0x4dd485){var _0x2593ed={};var _0x5d9023={};var _0x42d705;var _0x32109f;return db[_0x7eff('0x42')][_0x7eff('0x69')]({'where':{'id':_0x3c6624[_0x7eff('0x66')]['id']}})[_0x7eff('0x3b')](handleEntityNotFound(_0x47e4d2,null))['then'](function(_0x4d09a9){if(_0x4d09a9){_0x42d705=_0x4d09a9;_0x5d9023[_0x7eff('0x45')]=_['keys'](db[_0x7eff('0x83')][_0x7eff('0x59')]);_0x5d9023[_0x7eff('0x47')]=_[_0x7eff('0x48')](_0x3c6624['query']);_0x5d9023[_0x7eff('0x49')]=_[_0x7eff('0x4a')](_0x5d9023[_0x7eff('0x45')],_0x5d9023[_0x7eff('0x47')]);_0x2593ed['attributes']=_[_0x7eff('0x4a')](_0x5d9023['model'],qs[_0x7eff('0x4c')](_0x3c6624[_0x7eff('0x47')][_0x7eff('0x4c')]));_0x2593ed[_0x7eff('0x4b')]=_0x2593ed[_0x7eff('0x4b')][_0x7eff('0x4d')]?_0x2593ed[_0x7eff('0x4b')]:_0x5d9023[_0x7eff('0x45')];_0x2593ed[_0x7eff('0x4f')]=qs[_0x7eff('0x50')](_0x3c6624[_0x7eff('0x47')][_0x7eff('0x50')]);_0x2593ed[_0x7eff('0x51')]=qs[_0x7eff('0x49')](_['pick'](_0x3c6624[_0x7eff('0x47')],_0x5d9023['filters']));if(_0x3c6624[_0x7eff('0x47')][_0x7eff('0x53')]){_0x2593ed[_0x7eff('0x51')]=_[_0x7eff('0x55')](_0x2593ed[_0x7eff('0x51')],{'$or':_[_0x7eff('0x41')](_0x2593ed['attributes'],function(_0x180c91){var _0x336112={};_0x336112[_0x180c91]={'$like':'%'+_0x3c6624[_0x7eff('0x47')][_0x7eff('0x53')]+'%'};return _0x336112;})});}_0x2593ed=_[_0x7eff('0x55')]({},_0x2593ed,_0x3c6624[_0x7eff('0x56')]);return _0x42d705[_0x7eff('0x9f')](_0x2593ed);}})[_0x7eff('0x3b')](function(_0x15eb1f){if(_0x15eb1f){_0x32109f=_0x15eb1f['length'];if(!_0x3c6624[_0x7eff('0x47')][_0x7eff('0x6b')](_0x7eff('0x4e'))){_0x2593ed[_0x7eff('0x34')]=qs[_0x7eff('0x34')](_0x3c6624[_0x7eff('0x47')][_0x7eff('0x34')]);_0x2593ed['offset']=qs[_0x7eff('0x33')](_0x3c6624[_0x7eff('0x47')][_0x7eff('0x33')]);}return _0x42d705['getAgents'](_0x2593ed);}})[_0x7eff('0x3b')](function(_0x5ef1ea){if(_0x5ef1ea){return _0x5ef1ea?{'count':_0x32109f,'rows':_0x5ef1ea}:null;}})[_0x7eff('0x3b')](respondWithResult(_0x47e4d2,null))['catch'](handleError(_0x47e4d2,null));}; \ No newline at end of file +var _0x4181=['spread','getAgents','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./chatQueue.socket','jayson/promise','test','Sequelize','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','count','offset','limit','set','Content-Range','apply','save','destroy','then','get','UserProfileResource','sendStatus','name','send','index','map','ChatQueue','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','find','describe','getMembers','findOne','hasOwnProperty','UserChatQueue','findAll','findAndCountAll','UserId','agent','updatedAt','rows','format','%s/%s','chatPause','createdAt','Team','getTeams','addTeams','ids','User','Agents','online','voicePause','sequelize','transaction','findOrCreate','forEach','emit','select','tq.TeamId','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','SELECT','every','TeamId','includes','all','union','removeTeams','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4181,0x92));var _0x1418=function(_0x31a214,_0x48333d){_0x31a214=_0x31a214-0x0;var _0x59bdbb=_0x4181[_0x31a214];return _0x59bdbb;};'use strict';var pdf=require(_0x1418('0x0'));var emlformat=require(_0x1418('0x1'));var rimraf=require(_0x1418('0x2'));var zipdir=require(_0x1418('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1418('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1418('0x5'));var util=require('util');var path=require(_0x1418('0x6'));var sox=require(_0x1418('0x7'));var csv=require(_0x1418('0x8'));var ejs=require(_0x1418('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1418('0xa'));var crypto=require(_0x1418('0xb'));var jsforce=require(_0x1418('0xc'));var deskjs=require(_0x1418('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1418('0xe'));var Redis=require(_0x1418('0xf'));var authService=require(_0x1418('0x10'));var qs=require(_0x1418('0x11'));var as=require(_0x1418('0x12'));var hardwareService=require(_0x1418('0x13'));var logger=require(_0x1418('0x14'))(_0x1418('0x15'));var utils=require(_0x1418('0x16'));var config=require(_0x1418('0x17'));var db=require('../../mysqldb')['db'];config[_0x1418('0x18')]=_[_0x1418('0x19')](config[_0x1418('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x1418('0x1a'))(new Redis(config[_0x1418('0x18')]));require(_0x1418('0x1b'))['register'](socket);var jayson=require(_0x1418('0x1c'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x16bd33,_0x577e2b,_0x40a454){if(_0x40a454){var _0x36c5bc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x36c5bc[_0x1418('0x1d')](_0x577e2b)){return _0x16bd33;}else{throw new db[(_0x1418('0x1e'))]['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 _0x16bd33;}}function respondWithRpcPromise(_0x24b8dd,_0x22991b,_0x12bfb0,_0x4e5c28){return new BPromise(function(_0x257a15,_0x27fec9){var _0x4513c6=_0x4e5c28||client;return _0x4513c6[_0x1418('0x1f')](_0x24b8dd,_0x12bfb0)['then'](function(_0x342790){logger[_0x1418('0x20')](_0x1418('0x21'),_0x22991b,_0x1418('0x22'));logger['debug'](_0x1418('0x23'),_0x22991b,'request\x20sent',JSON['stringify'](_0x342790));if(_0x342790[_0x1418('0x24')]){if(_0x342790[_0x1418('0x24')][_0x1418('0x25')]===0x1f4){logger[_0x1418('0x24')]('ChatQueue,\x20%s,\x20%s',_0x22991b,_0x342790[_0x1418('0x24')][_0x1418('0x26')]);return _0x27fec9(_0x342790[_0x1418('0x24')][_0x1418('0x26')]);}logger[_0x1418('0x24')](_0x1418('0x21'),_0x22991b,_0x342790[_0x1418('0x24')]['message']);return _0x257a15(_0x342790[_0x1418('0x24')][_0x1418('0x26')]);}else{logger[_0x1418('0x20')]('ChatQueue,\x20%s,\x20%s',_0x22991b,'request\x20sent');_0x257a15(_0x342790[_0x1418('0x27')]['message']);}})[_0x1418('0x28')](function(_0x25b94a){logger['error'](_0x1418('0x21'),_0x22991b,_0x25b94a);_0x27fec9(_0x25b94a);});});}function respondWithStatusCode(_0x148270,_0x7d83d5){_0x7d83d5=_0x7d83d5||0xcc;return function(_0x377cf9){if(_0x377cf9){return _0x148270['sendStatus'](_0x7d83d5);}return _0x148270[_0x1418('0x29')](_0x7d83d5)['end']();};}function respondWithResult(_0xdaaafb,_0x39b6a7){_0x39b6a7=_0x39b6a7||0xc8;return function(_0x94bb9a){if(_0x94bb9a){return _0xdaaafb[_0x1418('0x29')](_0x39b6a7)[_0x1418('0x2a')](_0x94bb9a);}};}function respondWithFilteredResult(_0x1c76b0,_0x3e91bc){return function(_0x419ee1){if(_0x419ee1){var _0xfdd79=_0x419ee1[_0x1418('0x2b')],_0x1d23c3=_0x3e91bc[_0x1418('0x2c')],_0x1372ec=_0x3e91bc['offset']+_0x3e91bc[_0x1418('0x2d')],_0x59227a;if(_0x1372ec>=_0xfdd79){_0x1372ec=_0xfdd79;_0x59227a=0xc8;}else{_0x59227a=0xce;}_0x1c76b0[_0x1418('0x29')](_0x59227a);return _0x1c76b0[_0x1418('0x2e')](_0x1418('0x2f'),_0x1d23c3+'-'+_0x1372ec+'/'+_0xfdd79)['json'](_0x419ee1);}return null;};}function patchUpdates(_0x5562a4){return function(_0x560fb7){try{jsonpatch[_0x1418('0x30')](_0x560fb7,_0x5562a4,!![]);}catch(_0x5366b2){return BPromise['reject'](_0x5366b2);}return _0x560fb7[_0x1418('0x31')]();};}function saveUpdates(_0x38adf5,_0x46d196){return function(_0x2e6dc3){if(_0x2e6dc3){return _0x2e6dc3['update'](_0x38adf5)['then'](function(_0x1fbb1b){return _0x1fbb1b;});}return null;};}function removeEntity(_0x4b0fcd,_0x530109){return function(_0x143778){if(_0x143778){return _0x143778[_0x1418('0x32')]()[_0x1418('0x33')](function(){var _0x25e062=_0x143778[_0x1418('0x34')]({'plain':!![]});var _0x3c0a6d='ChatQueues';return db[_0x1418('0x35')][_0x1418('0x32')]({'where':{'type':_0x3c0a6d,'resourceId':_0x25e062['id']}})[_0x1418('0x33')](function(){return _0x143778;});})[_0x1418('0x33')](function(){_0x4b0fcd[_0x1418('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a7ce1,_0x23c7bf){return function(_0x2b3934){if(!_0x2b3934){_0x3a7ce1[_0x1418('0x36')](0x194);}return _0x2b3934;};}function handleError(_0x510252,_0x5b8e0e){_0x5b8e0e=_0x5b8e0e||0x1f4;return function(_0x4f0012){logger['error'](_0x4f0012['stack']);if(_0x4f0012[_0x1418('0x37')]){delete _0x4f0012[_0x1418('0x37')];}_0x510252['status'](_0x5b8e0e)[_0x1418('0x38')](_0x4f0012);};}exports[_0x1418('0x39')]=function(_0x4d620a,_0x161ad8){var _0x573743={},_0xd08ab7={},_0xa5e77d={'count':0x0,'rows':[]};var _0x96204b=_[_0x1418('0x3a')](db[_0x1418('0x3b')][_0x1418('0x3c')],function(_0x353918){return{'name':_0x353918['fieldName'],'type':_0x353918['type']['key']};});_0xd08ab7[_0x1418('0x3d')]=_[_0x1418('0x3a')](_0x96204b,'name');_0xd08ab7['query']=_[_0x1418('0x3e')](_0x4d620a[_0x1418('0x3f')]);_0xd08ab7[_0x1418('0x40')]=_['intersection'](_0xd08ab7[_0x1418('0x3d')],_0xd08ab7[_0x1418('0x3f')]);_0x573743['attributes']=_[_0x1418('0x41')](_0xd08ab7[_0x1418('0x3d')],qs[_0x1418('0x42')](_0x4d620a[_0x1418('0x3f')][_0x1418('0x42')]));_0x573743[_0x1418('0x43')]=_0x573743[_0x1418('0x43')][_0x1418('0x44')]?_0x573743[_0x1418('0x43')]:_0xd08ab7['model'];if(!_0x4d620a[_0x1418('0x3f')]['hasOwnProperty'](_0x1418('0x45'))){_0x573743[_0x1418('0x2d')]=qs['limit'](_0x4d620a[_0x1418('0x3f')][_0x1418('0x2d')]);_0x573743[_0x1418('0x2c')]=qs['offset'](_0x4d620a[_0x1418('0x3f')][_0x1418('0x2c')]);}_0x573743[_0x1418('0x46')]=qs['sort'](_0x4d620a[_0x1418('0x3f')][_0x1418('0x47')]);_0x573743['where']=qs[_0x1418('0x40')](_[_0x1418('0x48')](_0x4d620a[_0x1418('0x3f')],_0xd08ab7['filters']),_0x96204b);if(_0x4d620a[_0x1418('0x3f')]['filter']){_0x573743['where']=_[_0x1418('0x49')](_0x573743[_0x1418('0x4a')],{'$or':_[_0x1418('0x3a')](_0x96204b,function(_0x5bb847){if(_0x5bb847['type']!==_0x1418('0x4b')){var _0x3e13fb={};_0x3e13fb[_0x5bb847['name']]={'$like':'%'+_0x4d620a['query'][_0x1418('0x4c')]+'%'};return _0x3e13fb;}})});}_0x573743=_[_0x1418('0x49')]({},_0x573743,_0x4d620a[_0x1418('0x4d')]);var _0x431c48={'where':_0x573743['where']};return db[_0x1418('0x3b')][_0x1418('0x2b')](_0x431c48)['then'](function(_0xf4c7c5){_0xa5e77d[_0x1418('0x2b')]=_0xf4c7c5;if(_0x4d620a[_0x1418('0x3f')][_0x1418('0x4e')]){_0x573743[_0x1418('0x4f')]=[{'all':!![]}];}return db[_0x1418('0x3b')]['findAll'](_0x573743);})[_0x1418('0x33')](function(_0xa26ac7){_0xa5e77d['rows']=_0xa26ac7;return _0xa5e77d;})[_0x1418('0x33')](respondWithFilteredResult(_0x161ad8,_0x573743))['catch'](handleError(_0x161ad8,null));};exports[_0x1418('0x50')]=function(_0xdd46d5,_0xf6100f){var _0x54af22={'raw':!![],'where':{'id':_0xdd46d5[_0x1418('0x51')]['id']}},_0x176392={};_0x176392[_0x1418('0x3d')]=_['keys'](db[_0x1418('0x3b')][_0x1418('0x3c')]);_0x176392[_0x1418('0x3f')]=_['keys'](_0xdd46d5['query']);_0x176392[_0x1418('0x40')]=_['intersection'](_0x176392['model'],_0x176392['query']);_0x54af22['attributes']=_[_0x1418('0x41')](_0x176392[_0x1418('0x3d')],qs['fields'](_0xdd46d5[_0x1418('0x3f')][_0x1418('0x42')]));_0x54af22['attributes']=_0x54af22[_0x1418('0x43')][_0x1418('0x44')]?_0x54af22[_0x1418('0x43')]:_0x176392[_0x1418('0x3d')];if(_0xdd46d5['query'][_0x1418('0x4e')]){_0x54af22[_0x1418('0x4f')]=[{'all':!![]}];}_0x54af22=_['merge']({},_0x54af22,_0xdd46d5[_0x1418('0x4d')]);return db[_0x1418('0x3b')]['find'](_0x54af22)[_0x1418('0x33')](handleEntityNotFound(_0xf6100f,null))[_0x1418('0x33')](respondWithResult(_0xf6100f,null))[_0x1418('0x28')](handleError(_0xf6100f,null));};exports[_0x1418('0x52')]=function(_0x3546ff,_0x5e7320){return db[_0x1418('0x3b')][_0x1418('0x52')](_0x3546ff['body'],{})[_0x1418('0x33')](function(_0x57aefd){var _0x4f7d47=_0x3546ff[_0x1418('0x53')][_0x1418('0x34')]({'plain':!![]});if(!_0x4f7d47)throw new Error(_0x1418('0x54'));if(_0x4f7d47[_0x1418('0x55')]===_0x1418('0x53')){var _0x503ab8=_0x57aefd[_0x1418('0x34')]({'plain':!![]});var _0xea5441=_0x1418('0x56');return db[_0x1418('0x57')]['find']({'where':{'name':_0xea5441,'userProfileId':_0x4f7d47[_0x1418('0x58')]},'raw':!![]})['then'](function(_0x2a7cba){if(_0x2a7cba&&_0x2a7cba[_0x1418('0x59')]===0x0){return db[_0x1418('0x35')][_0x1418('0x52')]({'name':_0x503ab8[_0x1418('0x37')],'resourceId':_0x503ab8['id'],'type':_0x2a7cba[_0x1418('0x37')],'sectionId':_0x2a7cba['id']},{})[_0x1418('0x33')](function(){return _0x57aefd;});}else{return _0x57aefd;}})['catch'](function(_0x4186f2){logger['error'](_0x1418('0x5a'),_0x4186f2);throw _0x4186f2;});}return _0x57aefd;})[_0x1418('0x33')](respondWithResult(_0x5e7320,0xc9))[_0x1418('0x28')](handleError(_0x5e7320,null));};exports[_0x1418('0x5b')]=function(_0x151255,_0x4f6736){if(_0x151255[_0x1418('0x5c')]['id']){delete _0x151255[_0x1418('0x5c')]['id'];}return db[_0x1418('0x3b')][_0x1418('0x5d')]({'where':{'id':_0x151255[_0x1418('0x51')]['id']}})[_0x1418('0x33')](handleEntityNotFound(_0x4f6736,null))['then'](saveUpdates(_0x151255['body'],null))[_0x1418('0x33')](respondWithResult(_0x4f6736,null))[_0x1418('0x28')](handleError(_0x4f6736,null));};exports['destroy']=function(_0x555aac,_0x21320a){return db[_0x1418('0x3b')]['find']({'where':{'id':_0x555aac[_0x1418('0x51')]['id']}})['then'](handleEntityNotFound(_0x21320a,null))[_0x1418('0x33')](removeEntity(_0x21320a,null))[_0x1418('0x28')](handleError(_0x21320a,null));};exports['describe']=function(_0x38c08a,_0x446154){return db[_0x1418('0x3b')][_0x1418('0x5e')]()[_0x1418('0x33')](respondWithResult(_0x446154,null))['catch'](handleError(_0x446154,null));};exports[_0x1418('0x5f')]=function(_0x2d93dd,_0x181a75,_0x4272a9){var _0x4c16df={'raw':!![],'where':{}},_0x5e1c2c={},_0x3c3096;return db['ChatQueue'][_0x1418('0x60')]({'where':{'id':_0x2d93dd[_0x1418('0x51')]['id']}})[_0x1418('0x33')](handleEntityNotFound(_0x181a75,null))['then'](function(_0x343487){if(_0x343487){_0x3c3096=_0x343487[_0x1418('0x34')]({'plain':!![]});_0x5e1c2c[_0x1418('0x3d')]=_[_0x1418('0x3e')](db['UserChatQueue'][_0x1418('0x3c')]);_0x5e1c2c[_0x1418('0x3f')]=_[_0x1418('0x3e')](_0x2d93dd[_0x1418('0x3f')]);_0x5e1c2c[_0x1418('0x40')]=_[_0x1418('0x41')](_0x5e1c2c[_0x1418('0x3d')],_0x5e1c2c[_0x1418('0x3f')]);_0x4c16df[_0x1418('0x43')]=_[_0x1418('0x41')](_0x5e1c2c['model'],qs[_0x1418('0x42')](_0x2d93dd[_0x1418('0x3f')]['fields']));_0x4c16df['attributes']=_0x4c16df[_0x1418('0x43')][_0x1418('0x44')]?_0x4c16df[_0x1418('0x43')]:_0x5e1c2c['model'];if(!_0x2d93dd[_0x1418('0x3f')][_0x1418('0x61')](_0x1418('0x45'))){_0x4c16df[_0x1418('0x2d')]=qs[_0x1418('0x2d')](_0x2d93dd['query']['limit']);_0x4c16df[_0x1418('0x2c')]=qs[_0x1418('0x2c')](_0x2d93dd['query']['offset']);}_0x4c16df['order']=qs['sort'](_0x2d93dd[_0x1418('0x3f')][_0x1418('0x47')]);_0x4c16df[_0x1418('0x4a')]=qs[_0x1418('0x40')](_[_0x1418('0x48')](_0x2d93dd[_0x1418('0x3f')],_0x5e1c2c[_0x1418('0x40')]));_0x4c16df[_0x1418('0x4a')]['ChatQueueId']=_0x343487['id'];if(_0x2d93dd[_0x1418('0x3f')][_0x1418('0x4c')]){_0x4c16df[_0x1418('0x4a')]=_[_0x1418('0x49')](_0x4c16df[_0x1418('0x4a')],{'$or':_[_0x1418('0x3a')](_0x4c16df[_0x1418('0x43')],function(_0x1b4a17){var _0x5db630={};_0x5db630[_0x1b4a17]={'$like':'%'+_0x2d93dd[_0x1418('0x3f')][_0x1418('0x4c')]+'%'};return _0x5db630;})});}_0x4c16df=_[_0x1418('0x49')]({},_0x4c16df,_0x2d93dd[_0x1418('0x4d')]);return db[_0x1418('0x62')][_0x1418('0x63')](_0x4c16df);}})[_0x1418('0x33')](function(_0x5d1a57){if(_0x5d1a57){return db['User'][_0x1418('0x64')]({'where':{'id':_[_0x1418('0x3a')](_0x5d1a57,_0x1418('0x65')),'role':_0x1418('0x66')},'attributes':['id',_0x1418('0x37'),'chatPause',_0x1418('0x67'),'createdAt']});}})['then'](function(_0x2c7f66){if(_0x2c7f66){return{'count':_0x2c7f66[_0x1418('0x2b')],'rows':_['map'](_0x2c7f66[_0x1418('0x68')],function(_0x149425){return{'membername':_0x149425[_0x1418('0x37')],'UserId':_0x149425['id'],'queue_name':_0x3c3096[_0x1418('0x37')],'ChatQueueId':_0x3c3096['id'],'interface':util[_0x1418('0x69')](_0x1418('0x6a'),'SIP',_0x149425[_0x1418('0x37')]),'penalty':0x0,'paused':_0x149425[_0x1418('0x6b')],'createdAt':_0x149425[_0x1418('0x6c')],'updatedAt':_0x149425[_0x1418('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1418('0x33')](respondWithFilteredResult(_0x181a75,_0x4c16df))[_0x1418('0x28')](handleError(_0x181a75,null));};exports['getTeams']=function(_0x24281c,_0x254fc6,_0x123ab6){var _0x324305={};var _0x53eb47={};var _0xfdcd0;var _0xfcd611;return db['ChatQueue'][_0x1418('0x60')]({'where':{'id':_0x24281c[_0x1418('0x51')]['id']}})['then'](handleEntityNotFound(_0x254fc6,null))['then'](function(_0x51636e){if(_0x51636e){_0xfdcd0=_0x51636e;_0x53eb47[_0x1418('0x3d')]=_[_0x1418('0x3e')](db[_0x1418('0x6d')]['rawAttributes']);_0x53eb47[_0x1418('0x3f')]=_[_0x1418('0x3e')](_0x24281c['query']);_0x53eb47[_0x1418('0x40')]=_[_0x1418('0x41')](_0x53eb47[_0x1418('0x3d')],_0x53eb47[_0x1418('0x3f')]);_0x324305[_0x1418('0x43')]=_['intersection'](_0x53eb47['model'],qs[_0x1418('0x42')](_0x24281c[_0x1418('0x3f')][_0x1418('0x42')]));_0x324305['attributes']=_0x324305[_0x1418('0x43')][_0x1418('0x44')]?_0x324305[_0x1418('0x43')]:_0x53eb47[_0x1418('0x3d')];_0x324305['order']=qs['sort'](_0x24281c['query'][_0x1418('0x47')]);_0x324305['where']=qs[_0x1418('0x40')](_[_0x1418('0x48')](_0x24281c[_0x1418('0x3f')],_0x53eb47[_0x1418('0x40')]));if(_0x24281c['query']['filter']){_0x324305[_0x1418('0x4a')]=_[_0x1418('0x49')](_0x324305[_0x1418('0x4a')],{'$or':_[_0x1418('0x3a')](_0x324305['attributes'],function(_0x289831){var _0x4cc0c4={};_0x4cc0c4[_0x289831]={'$like':'%'+_0x24281c[_0x1418('0x3f')][_0x1418('0x4c')]+'%'};return _0x4cc0c4;})});}_0x324305=_[_0x1418('0x49')]({},_0x324305,_0x24281c['options']);return _0xfdcd0[_0x1418('0x6e')](_0x324305);}})[_0x1418('0x33')](function(_0x635e67){if(_0x635e67){_0xfcd611=_0x635e67['length'];if(!_0x24281c[_0x1418('0x3f')]['hasOwnProperty'](_0x1418('0x45'))){_0x324305[_0x1418('0x2d')]=qs[_0x1418('0x2d')](_0x24281c[_0x1418('0x3f')][_0x1418('0x2d')]);_0x324305['offset']=qs[_0x1418('0x2c')](_0x24281c[_0x1418('0x3f')][_0x1418('0x2c')]);}return _0xfdcd0[_0x1418('0x6e')](_0x324305);}})[_0x1418('0x33')](function(_0x35c29a){if(_0x35c29a){return _0x35c29a?{'count':_0xfcd611,'rows':_0x35c29a}:null;}})[_0x1418('0x33')](respondWithResult(_0x254fc6,null))[_0x1418('0x28')](handleError(_0x254fc6,null));};exports[_0x1418('0x6f')]=function(_0x3d7593,_0x3bc936,_0x1c6509){var _0x47bddd=_0x3d7593[_0x1418('0x5c')][_0x1418('0x70')];return db[_0x1418('0x6d')][_0x1418('0x63')]({'where':{'id':_0x47bddd},'attributes':['id'],'include':[{'model':db[_0x1418('0x71')],'as':_0x1418('0x72'),'attributes':['id',_0x1418('0x37'),_0x1418('0x73'),_0x1418('0x74'),'interface'],'raw':!![]}]})[_0x1418('0x33')](function(_0x11320d){if(_0x11320d){var _0x565c81=_['flatMap'](_0x11320d,function(_0x5b1783){var _0x3a82a6=_0x5b1783['get']({'plain':!![]});return _0x3a82a6[_0x1418('0x72')];});return db[_0x1418('0x3b')][_0x1418('0x5d')]({'where':{'id':_0x3d7593[_0x1418('0x51')]['id']}})[_0x1418('0x33')](function(_0x29c342){return db[_0x1418('0x75')][_0x1418('0x76')](function(_0x5d7416){return _0x29c342[_0x1418('0x6f')](_0x47bddd,{'transaction':_0x5d7416})[_0x1418('0x33')](function(){return BPromise['each'](_0x565c81,function(_0x2a1670){return db[_0x1418('0x62')][_0x1418('0x77')]({'where':{'UserId':_0x2a1670['id'],'ChatQueueId':_0x3d7593[_0x1418('0x51')]['id']},'transaction':_0x5d7416});});})['then'](function(){_0x565c81[_0x1418('0x78')](function(_0x151a43){socket[_0x1418('0x79')]('userChatQueue:save',{'UserId':_0x151a43['id'],'ChatQueueId':_0x29c342['id']});});});});});}})['then'](respondWithStatusCode(_0x3bc936,null))[_0x1418('0x28')](handleError(_0x3bc936,null));};exports['removeTeams']=function(_0x3c5fc0,_0x455ba9,_0x3655d8){return db[_0x1418('0x6d')][_0x1418('0x63')]({'where':{'id':_0x3c5fc0[_0x1418('0x3f')]['ids']},'attributes':['id'],'include':[{'model':db[_0x1418('0x71')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x1418('0x33')](handleEntityNotFound(_0x455ba9,null))[_0x1418('0x33')](function(_0x31c57f){var _0x40847e=_[_0x1418('0x3a')](_0x31c57f,'id');var _0x1bb732=[];var _0x3f07e1=[];var _0x5282b1=squel[_0x1418('0x7a')]();_0x5282b1['field'](_0x1418('0x7b'))[_0x1418('0x7c')](_0x1418('0x7d'),'tq')['join'](_0x1418('0x7e'),'ut',_0x1418('0x7f'))[_0x1418('0x4a')](_0x1418('0x80'),_0x3c5fc0[_0x1418('0x51')]['id']);for(var _0x4f3ad5=0x0;_0x4f3ad5<_0x31c57f['length'];_0x4f3ad5+=0x1){let _0x263707=_0x31c57f[_0x4f3ad5];for(var _0x43ab97=0x0;_0x43ab97<_0x263707[_0x1418('0x72')][_0x1418('0x44')];_0x43ab97+=0x1){let _0x2a1673=_0x263707[_0x1418('0x72')][_0x43ab97];var _0xe35cf9=_0x5282b1[_0x1418('0x81')]();_0xe35cf9[_0x1418('0x4a')]('ut.UserId\x20=\x20?',_0x2a1673['id']);_0x3f07e1['push'](db[_0x1418('0x75')]['query'](_0xe35cf9['toString'](),{'type':db[_0x1418('0x75')]['QueryTypes'][_0x1418('0x82')]})[_0x1418('0x33')](function(_0x3fd6a0){if(_0x3fd6a0[_0x1418('0x44')]===0x1){return _0x2a1673['id'];}else{var _0x3ddd7a=_[_0x1418('0x83')](_['map'](_0x3fd6a0,_0x1418('0x84')),function(_0x5deaf7){return _[_0x1418('0x85')](_0x40847e,_0x5deaf7);});if(_0x3ddd7a){return _0x2a1673['id'];}}}));}}return BPromise[_0x1418('0x86')](_0x3f07e1)[_0x1418('0x33')](function(_0x525bb1){_0x1bb732=_(_0x1bb732)[_0x1418('0x87')](_0x525bb1)['compact']()['value']();return db[_0x1418('0x3b')][_0x1418('0x5d')]({'where':{'id':_0x3c5fc0[_0x1418('0x51')]['id']}})[_0x1418('0x33')](function(_0x28f9f1){return db[_0x1418('0x75')][_0x1418('0x76')](function(_0x55ce8f){return _0x28f9f1[_0x1418('0x88')](_0x3c5fc0[_0x1418('0x3f')][_0x1418('0x70')],{'transaction':_0x55ce8f})[_0x1418('0x33')](function(){if(!_[_0x1418('0x89')](_0x1bb732)){return _0x28f9f1[_0x1418('0x8a')](_0x1bb732,{'transaction':_0x55ce8f});}})[_0x1418('0x33')](function(){_0x1bb732[_0x1418('0x78')](function(_0x4dc1d3){socket[_0x1418('0x79')](_0x1418('0x8b'),{'UserId':_0x4dc1d3,'ChatQueueId':_0x28f9f1['id']});});});});});});})[_0x1418('0x33')](respondWithStatusCode(_0x455ba9,null))[_0x1418('0x28')](handleError(_0x455ba9,null));};exports[_0x1418('0x8c')]=function(_0x4ea36d,_0x3ddef0,_0x2478b4){return db[_0x1418('0x3b')][_0x1418('0x5d')]({'where':{'id':_0x4ea36d['params']['id']}})[_0x1418('0x33')](handleEntityNotFound(_0x3ddef0,null))['then'](function(_0x1bc87d){if(_0x1bc87d){return _0x1bc87d[_0x1418('0x8c')](_0x4ea36d[_0x1418('0x5c')][_0x1418('0x70')],_[_0x1418('0x8d')](_0x4ea36d[_0x1418('0x5c')],['ids','id'])||{})[_0x1418('0x8e')](function(_0x5b06ff){for(var _0x5d5d2f=0x0;_0x5d5d2f<_0x4ea36d[_0x1418('0x5c')][_0x1418('0x70')][_0x1418('0x44')];_0x5d5d2f+=0x1){socket[_0x1418('0x79')]('userChatQueue:save',{'UserId':_0x4ea36d[_0x1418('0x5c')][_0x1418('0x70')][_0x5d5d2f],'ChatQueueId':_0x4ea36d[_0x1418('0x51')]['id']});}return _0x5b06ff;});}})[_0x1418('0x33')](respondWithResult(_0x3ddef0,null))[_0x1418('0x28')](handleError(_0x3ddef0,null));};exports[_0x1418('0x8a')]=function(_0x124069,_0x46f7ef,_0x2da5bc){return db[_0x1418('0x3b')][_0x1418('0x5d')]({'where':{'id':_0x124069[_0x1418('0x51')]['id']}})['then'](handleEntityNotFound(_0x46f7ef,null))[_0x1418('0x33')](function(_0x12d1ae){if(_0x12d1ae){return _0x12d1ae[_0x1418('0x8a')](_0x124069[_0x1418('0x3f')]['ids'])[_0x1418('0x33')](function(){if(_['isArray'](_0x124069['query'][_0x1418('0x70')])){for(var _0x1b8d4b=0x0;_0x1b8d4b<_0x124069[_0x1418('0x3f')][_0x1418('0x70')][_0x1418('0x44')];_0x1b8d4b+=0x1){socket[_0x1418('0x79')](_0x1418('0x8b'),{'UserId':Number(_0x124069[_0x1418('0x3f')][_0x1418('0x70')][_0x1b8d4b]),'ChatQueueId':Number(_0x124069[_0x1418('0x51')]['id'])});}}else{socket[_0x1418('0x79')](_0x1418('0x8b'),{'UserId':Number(_0x124069[_0x1418('0x3f')][_0x1418('0x70')]),'ChatQueueId':Number(_0x124069[_0x1418('0x51')]['id'])});}});}})[_0x1418('0x33')](respondWithStatusCode(_0x46f7ef,null))[_0x1418('0x28')](handleError(_0x46f7ef,null));};exports[_0x1418('0x8f')]=function(_0x438341,_0x291273,_0x56da30){var _0x3dae9a={};var _0x412110={};var _0xdb668;var _0x2e51d4;return db[_0x1418('0x3b')][_0x1418('0x60')]({'where':{'id':_0x438341[_0x1418('0x51')]['id']}})[_0x1418('0x33')](handleEntityNotFound(_0x291273,null))[_0x1418('0x33')](function(_0x4802a1){if(_0x4802a1){_0xdb668=_0x4802a1;_0x412110[_0x1418('0x3d')]=_[_0x1418('0x3e')](db[_0x1418('0x71')][_0x1418('0x3c')]);_0x412110[_0x1418('0x3f')]=_[_0x1418('0x3e')](_0x438341[_0x1418('0x3f')]);_0x412110[_0x1418('0x40')]=_[_0x1418('0x41')](_0x412110[_0x1418('0x3d')],_0x412110['query']);_0x3dae9a[_0x1418('0x43')]=_[_0x1418('0x41')](_0x412110[_0x1418('0x3d')],qs[_0x1418('0x42')](_0x438341[_0x1418('0x3f')][_0x1418('0x42')]));_0x3dae9a['attributes']=_0x3dae9a['attributes'][_0x1418('0x44')]?_0x3dae9a[_0x1418('0x43')]:_0x412110[_0x1418('0x3d')];_0x3dae9a[_0x1418('0x46')]=qs['sort'](_0x438341[_0x1418('0x3f')][_0x1418('0x47')]);_0x3dae9a[_0x1418('0x4a')]=qs[_0x1418('0x40')](_[_0x1418('0x48')](_0x438341['query'],_0x412110[_0x1418('0x40')]));if(_0x438341[_0x1418('0x3f')][_0x1418('0x4c')]){_0x3dae9a[_0x1418('0x4a')]=_[_0x1418('0x49')](_0x3dae9a[_0x1418('0x4a')],{'$or':_['map'](_0x3dae9a[_0x1418('0x43')],function(_0x1a503a){var _0x1b0622={};_0x1b0622[_0x1a503a]={'$like':'%'+_0x438341[_0x1418('0x3f')][_0x1418('0x4c')]+'%'};return _0x1b0622;})});}_0x3dae9a=_[_0x1418('0x49')]({},_0x3dae9a,_0x438341['options']);return _0xdb668[_0x1418('0x8f')](_0x3dae9a);}})['then'](function(_0x1effc0){if(_0x1effc0){_0x2e51d4=_0x1effc0[_0x1418('0x44')];if(!_0x438341[_0x1418('0x3f')]['hasOwnProperty'](_0x1418('0x45'))){_0x3dae9a['limit']=qs['limit'](_0x438341[_0x1418('0x3f')][_0x1418('0x2d')]);_0x3dae9a[_0x1418('0x2c')]=qs[_0x1418('0x2c')](_0x438341['query'][_0x1418('0x2c')]);}return _0xdb668['getAgents'](_0x3dae9a);}})['then'](function(_0x4c826c){if(_0x4c826c){return _0x4c826c?{'count':_0x2e51d4,'rows':_0x4c826c}:null;}})[_0x1418('0x33')](respondWithResult(_0x291273,null))[_0x1418('0x28')](handleError(_0x291273,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 5a94889..3f62c5b 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x5866c6,_0x5ca72d){var _0x4ae976=function(_0x3b950a){while(--_0x3b950a){_0x5866c6['push'](_0x5866c6['shift']());}};_0x4ae976(++_0x5ca72d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x49da7d,_0x5226d5){_0x49da7d=_0x49da7d-0x0;var _0x73c8d3=_0x5f2f[_0x49da7d];return _0x73c8d3;};'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 +var _0x0b0e=['ChatQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0xf43d1a,_0x1c8341){var _0x24bb0b=function(_0xc223b4){while(--_0xc223b4){_0xf43d1a['push'](_0xf43d1a['shift']());}};_0x24bb0b(++_0x1c8341);}(_0x0b0e,0x187));var _0xe0b0=function(_0x34c4e1,_0x310387){_0x34c4e1=_0x34c4e1-0x0;var _0x5a11ef=_0x0b0e[_0x34c4e1];return _0x5a11ef;};'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 diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 2254bf1..47154f0 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 _0xb530=['exports','define','ChatQueue','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueue.attributes'];(function(_0x58c218,_0x4368d1){var _0x3c6eef=function(_0x16cec6){while(--_0x16cec6){_0x58c218['push'](_0x58c218['shift']());}};_0x3c6eef(++_0x4368d1);}(_0xb530,0x117));var _0x0b53=function(_0x55ab6f,_0x4a9833){_0x55ab6f=_0x55ab6f-0x0;var _0x1f5d3b=_0xb530[_0x55ab6f];return _0x1f5d3b;};'use strict';var _=require(_0x0b53('0x0'));var util=require('util');var logger=require(_0x0b53('0x1'))(_0x0b53('0x2'));var moment=require(_0x0b53('0x3'));var BPromise=require(_0x0b53('0x4'));var rp=require(_0x0b53('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0b53('0x6'));var config=require(_0x0b53('0x7'));var attributes=require(_0x0b53('0x8'));module[_0x0b53('0x9')]=function(_0x17db74,_0x2e50f7){return _0x17db74[_0x0b53('0xa')](_0x0b53('0xb'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b2b=['exports','define','ChatQueue','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./chatQueue.attributes'];(function(_0x382ca6,_0x1aaf79){var _0x295a6c=function(_0x294a0b){while(--_0x294a0b){_0x382ca6['push'](_0x382ca6['shift']());}};_0x295a6c(++_0x1aaf79);}(_0x7b2b,0xab));var _0xb7b2=function(_0x6fbb94,_0xc2bdee){_0x6fbb94=_0x6fbb94-0x0;var _0x16f0e8=_0x7b2b[_0x6fbb94];return _0x16f0e8;};'use strict';var _=require(_0xb7b2('0x0'));var util=require(_0xb7b2('0x1'));var logger=require('../../config/logger')(_0xb7b2('0x2'));var moment=require(_0xb7b2('0x3'));var BPromise=require(_0xb7b2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb7b2('0x5'));var rimraf=require(_0xb7b2('0x6'));var config=require(_0xb7b2('0x7'));var attributes=require(_0xb7b2('0x8'));module[_0xb7b2('0x9')]=function(_0x395f8c,_0x367c65){return _0x395f8c[_0xb7b2('0xa')](_0xb7b2('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 2cadf2f..6be2965 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 _0x52c1=['include','model','map','ShowChatQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','redis','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','code','message','catch','GetChatQueue','ChatQueue','findAll','options','raw','attributes','limit'];(function(_0x12553d,_0x160725){var _0x166267=function(_0x49f7ae){while(--_0x49f7ae){_0x12553d['push'](_0x12553d['shift']());}};_0x166267(++_0x160725);}(_0x52c1,0x1ce));var _0x152c=function(_0x26c543,_0x381fd2){_0x26c543=_0x26c543-0x0;var _0x25f6b5=_0x52c1[_0x26c543];return _0x25f6b5;};'use strict';var _=require(_0x152c('0x0'));var util=require(_0x152c('0x1'));var moment=require(_0x152c('0x2'));var BPromise=require(_0x152c('0x3'));var rs=require(_0x152c('0x4'));var fs=require('fs');var Redis=require(_0x152c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x152c('0x6'));var logger=require('../../config/logger')(_0x152c('0x7'));var config=require('../../config/environment');var jayson=require(_0x152c('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x152c('0x9')]=_['defaults'](config[_0x152c('0x9')],{'host':_0x152c('0xa'),'port':0x18eb});var socket=require(_0x152c('0xb'))(new Redis(config[_0x152c('0x9')]));require('./chatQueue.socket')[_0x152c('0xc')](socket);function respondWithRpcPromise(_0xf4eed1,_0x4d326f,_0x35eeb5){return new BPromise(function(_0xc31fc6,_0x1756a1){return client[_0x152c('0xd')](_0xf4eed1,_0x35eeb5)[_0x152c('0xe')](function(_0x116dc1){logger[_0x152c('0xf')](_0x152c('0x10'),_0x4d326f,_0x152c('0x11'));logger[_0x152c('0x12')](_0x152c('0x13'),_0x4d326f,'request\x20sent',JSON[_0x152c('0x14')](_0x116dc1));if(_0x116dc1[_0x152c('0x15')]){if(_0x116dc1[_0x152c('0x15')][_0x152c('0x16')]===0x1f4){logger[_0x152c('0x15')](_0x152c('0x10'),_0x4d326f,_0x116dc1[_0x152c('0x15')][_0x152c('0x17')]);return _0x1756a1(_0x116dc1['error'][_0x152c('0x17')]);}logger[_0x152c('0x15')](_0x152c('0x10'),_0x4d326f,_0x116dc1[_0x152c('0x15')]['message']);return _0xc31fc6(_0x116dc1[_0x152c('0x15')][_0x152c('0x17')]);}else{logger[_0x152c('0xf')](_0x152c('0x10'),_0x4d326f,_0x152c('0x11'));_0xc31fc6(_0x116dc1['result'][_0x152c('0x17')]);}})[_0x152c('0x18')](function(_0x3a0e49){logger[_0x152c('0x15')](_0x152c('0x10'),_0x4d326f,_0x3a0e49);_0x1756a1(_0x3a0e49);});});}exports[_0x152c('0x19')]=function(_0x44f5ce){var _0x31b304=this;return new Promise(function(_0x1ac0c6,_0xacb5f0){return db[_0x152c('0x1a')][_0x152c('0x1b')]({'raw':_0x44f5ce[_0x152c('0x1c')]?_0x44f5ce['options'][_0x152c('0x1d')]===undefined?!![]:![]:!![],'where':_0x44f5ce['options']?_0x44f5ce['options']['where']||null:null,'attributes':_0x44f5ce['options']?_0x44f5ce[_0x152c('0x1c')][_0x152c('0x1e')]||null:null,'limit':_0x44f5ce[_0x152c('0x1c')]?_0x44f5ce[_0x152c('0x1c')][_0x152c('0x1f')]||null:null,'include':_0x44f5ce[_0x152c('0x1c')]?_0x44f5ce[_0x152c('0x1c')][_0x152c('0x20')]?_['map'](_0x44f5ce['options'][_0x152c('0x20')],function(_0x439b3f){return{'model':db[_0x439b3f[_0x152c('0x21')]],'as':_0x439b3f['as'],'attributes':_0x439b3f[_0x152c('0x1e')],'include':_0x439b3f[_0x152c('0x20')]?_[_0x152c('0x22')](_0x439b3f[_0x152c('0x20')],function(_0x177c83){return{'model':db[_0x177c83['model']],'as':_0x177c83['as'],'attributes':_0x177c83[_0x152c('0x1e')],'include':_0x177c83[_0x152c('0x20')]?_[_0x152c('0x22')](_0x177c83['include'],function(_0x1ada12){return{'model':db[_0x1ada12[_0x152c('0x21')]],'as':_0x1ada12['as'],'attributes':_0x1ada12['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x62e97a){logger[_0x152c('0xf')](_0x152c('0x19'),_0x44f5ce);logger[_0x152c('0x12')](_0x152c('0x19'),_0x44f5ce,JSON['stringify'](_0x62e97a));_0x1ac0c6(_0x62e97a);})[_0x152c('0x18')](function(_0x246d4f){logger['error'](_0x152c('0x19'),_0x246d4f[_0x152c('0x17')],_0x44f5ce);_0xacb5f0(_0x31b304[_0x152c('0x15')](0x1f4,_0x246d4f[_0x152c('0x17')]));});});};exports[_0x152c('0x23')]=function(_0x14eab8){var _0x5c0fe0=this;return new Promise(function(_0x52b0f4,_0x488a75){return db[_0x152c('0x1a')][_0x152c('0x24')]({'raw':_0x14eab8[_0x152c('0x1c')]?_0x14eab8[_0x152c('0x1c')][_0x152c('0x1d')]===undefined?!![]:![]:!![],'where':_0x14eab8[_0x152c('0x1c')]?_0x14eab8[_0x152c('0x1c')][_0x152c('0x25')]||null:null,'attributes':_0x14eab8[_0x152c('0x1c')]?_0x14eab8[_0x152c('0x1c')][_0x152c('0x1e')]||null:null,'include':_0x14eab8[_0x152c('0x1c')]?_0x14eab8[_0x152c('0x1c')][_0x152c('0x20')]?_[_0x152c('0x22')](_0x14eab8[_0x152c('0x1c')][_0x152c('0x20')],function(_0x53d676){return{'model':db[_0x53d676[_0x152c('0x21')]],'as':_0x53d676['as'],'attributes':_0x53d676['attributes'],'include':_0x53d676[_0x152c('0x20')]?_[_0x152c('0x22')](_0x53d676['include'],function(_0xfc2c59){return{'model':db[_0xfc2c59['model']],'as':_0xfc2c59['as'],'attributes':_0xfc2c59['attributes'],'include':_0xfc2c59[_0x152c('0x20')]?_[_0x152c('0x22')](_0xfc2c59[_0x152c('0x20')],function(_0x3f7177){return{'model':db[_0x3f7177[_0x152c('0x21')]],'as':_0x3f7177['as'],'attributes':_0x3f7177[_0x152c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x152c('0xe')](function(_0x3bb381){logger[_0x152c('0xf')]('ShowChatQueue',_0x14eab8);logger[_0x152c('0x12')](_0x152c('0x23'),_0x14eab8,JSON[_0x152c('0x14')](_0x3bb381));_0x52b0f4(_0x3bb381);})[_0x152c('0x18')](function(_0x291ebc){logger[_0x152c('0x15')](_0x152c('0x23'),_0x291ebc['message'],_0x14eab8);_0x488a75(_0x5c0fe0[_0x152c('0x15')](0x1f4,_0x291ebc[_0x152c('0x17')]));});});}; \ No newline at end of file +var _0x9a18=['info','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ChatQueue','findAll','options','where','attributes','limit','include','map','model','debug','GetChatQueue','catch','ShowChatQueue','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatQueue.socket','register','request','then'];(function(_0x198cb5,_0x985c0c){var _0x3b6686=function(_0x2c55e0){while(--_0x2c55e0){_0x198cb5['push'](_0x198cb5['shift']());}};_0x3b6686(++_0x985c0c);}(_0x9a18,0x187));var _0x89a1=function(_0x30dd06,_0x4b0ca5){_0x30dd06=_0x30dd06-0x0;var _0x2b827f=_0x9a18[_0x30dd06];return _0x2b827f;};'use strict';var _=require(_0x89a1('0x0'));var util=require('util');var moment=require(_0x89a1('0x1'));var BPromise=require(_0x89a1('0x2'));var rs=require(_0x89a1('0x3'));var fs=require('fs');var Redis=require(_0x89a1('0x4'));var db=require(_0x89a1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x89a1('0x6'))(_0x89a1('0x7'));var config=require(_0x89a1('0x8'));var jayson=require(_0x89a1('0x9'));var client=jayson[_0x89a1('0xa')][_0x89a1('0xb')]({'port':0x232a});config[_0x89a1('0xc')]=_[_0x89a1('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x89a1('0xe'))(new Redis(config['redis']));require(_0x89a1('0xf'))[_0x89a1('0x10')](socket);function respondWithRpcPromise(_0x3c7e38,_0x44ec84,_0x334e8b){return new BPromise(function(_0x40ed47,_0x25fef3){return client[_0x89a1('0x11')](_0x3c7e38,_0x334e8b)[_0x89a1('0x12')](function(_0x19e611){logger[_0x89a1('0x13')](_0x89a1('0x14'),_0x44ec84,_0x89a1('0x15'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x44ec84,_0x89a1('0x15'),JSON[_0x89a1('0x16')](_0x19e611));if(_0x19e611[_0x89a1('0x17')]){if(_0x19e611[_0x89a1('0x17')]['code']===0x1f4){logger[_0x89a1('0x17')](_0x89a1('0x14'),_0x44ec84,_0x19e611['error'][_0x89a1('0x18')]);return _0x25fef3(_0x19e611[_0x89a1('0x17')][_0x89a1('0x18')]);}logger[_0x89a1('0x17')](_0x89a1('0x14'),_0x44ec84,_0x19e611[_0x89a1('0x17')][_0x89a1('0x18')]);return _0x40ed47(_0x19e611[_0x89a1('0x17')]['message']);}else{logger[_0x89a1('0x13')](_0x89a1('0x14'),_0x44ec84,_0x89a1('0x15'));_0x40ed47(_0x19e611[_0x89a1('0x19')][_0x89a1('0x18')]);}})['catch'](function(_0x412a84){logger[_0x89a1('0x17')](_0x89a1('0x14'),_0x44ec84,_0x412a84);_0x25fef3(_0x412a84);});});}exports['GetChatQueue']=function(_0x387465){var _0x39a5d3=this;return new Promise(function(_0x1a3868,_0x224e60){return db[_0x89a1('0x1a')][_0x89a1('0x1b')]({'raw':_0x387465['options']?_0x387465[_0x89a1('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x387465[_0x89a1('0x1c')]?_0x387465[_0x89a1('0x1c')][_0x89a1('0x1d')]||null:null,'attributes':_0x387465['options']?_0x387465[_0x89a1('0x1c')][_0x89a1('0x1e')]||null:null,'limit':_0x387465[_0x89a1('0x1c')]?_0x387465[_0x89a1('0x1c')][_0x89a1('0x1f')]||null:null,'include':_0x387465[_0x89a1('0x1c')]?_0x387465[_0x89a1('0x1c')][_0x89a1('0x20')]?_[_0x89a1('0x21')](_0x387465['options']['include'],function(_0x1d895e){return{'model':db[_0x1d895e[_0x89a1('0x22')]],'as':_0x1d895e['as'],'attributes':_0x1d895e[_0x89a1('0x1e')],'include':_0x1d895e[_0x89a1('0x20')]?_[_0x89a1('0x21')](_0x1d895e['include'],function(_0x1330a6){return{'model':db[_0x1330a6['model']],'as':_0x1330a6['as'],'attributes':_0x1330a6['attributes'],'include':_0x1330a6[_0x89a1('0x20')]?_[_0x89a1('0x21')](_0x1330a6[_0x89a1('0x20')],function(_0x86c90d){return{'model':db[_0x86c90d[_0x89a1('0x22')]],'as':_0x86c90d['as'],'attributes':_0x86c90d[_0x89a1('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x89a1('0x12')](function(_0x3629f9){logger[_0x89a1('0x13')]('GetChatQueue',_0x387465);logger[_0x89a1('0x23')](_0x89a1('0x24'),_0x387465,JSON[_0x89a1('0x16')](_0x3629f9));_0x1a3868(_0x3629f9);})[_0x89a1('0x25')](function(_0x2b1ece){logger[_0x89a1('0x17')](_0x89a1('0x24'),_0x2b1ece['message'],_0x387465);_0x224e60(_0x39a5d3[_0x89a1('0x17')](0x1f4,_0x2b1ece[_0x89a1('0x18')]));});});};exports[_0x89a1('0x26')]=function(_0x533d72){var _0x295a42=this;return new Promise(function(_0x3368c9,_0x2914a0){return db[_0x89a1('0x1a')][_0x89a1('0x27')]({'raw':_0x533d72[_0x89a1('0x1c')]?_0x533d72[_0x89a1('0x1c')][_0x89a1('0x28')]===undefined?!![]:![]:!![],'where':_0x533d72[_0x89a1('0x1c')]?_0x533d72[_0x89a1('0x1c')][_0x89a1('0x1d')]||null:null,'attributes':_0x533d72[_0x89a1('0x1c')]?_0x533d72[_0x89a1('0x1c')][_0x89a1('0x1e')]||null:null,'include':_0x533d72[_0x89a1('0x1c')]?_0x533d72[_0x89a1('0x1c')][_0x89a1('0x20')]?_[_0x89a1('0x21')](_0x533d72['options'][_0x89a1('0x20')],function(_0x3f441d){return{'model':db[_0x3f441d[_0x89a1('0x22')]],'as':_0x3f441d['as'],'attributes':_0x3f441d[_0x89a1('0x1e')],'include':_0x3f441d[_0x89a1('0x20')]?_[_0x89a1('0x21')](_0x3f441d['include'],function(_0x3589ae){return{'model':db[_0x3589ae[_0x89a1('0x22')]],'as':_0x3589ae['as'],'attributes':_0x3589ae['attributes'],'include':_0x3589ae[_0x89a1('0x20')]?_['map'](_0x3589ae[_0x89a1('0x20')],function(_0x397087){return{'model':db[_0x397087[_0x89a1('0x22')]],'as':_0x397087['as'],'attributes':_0x397087[_0x89a1('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x89a1('0x12')](function(_0x4df780){logger[_0x89a1('0x13')](_0x89a1('0x26'),_0x533d72);logger[_0x89a1('0x23')]('ShowChatQueue',_0x533d72,JSON[_0x89a1('0x16')](_0x4df780));_0x3368c9(_0x4df780);})[_0x89a1('0x25')](function(_0xf0148d){logger[_0x89a1('0x17')](_0x89a1('0x26'),_0xf0148d[_0x89a1('0x18')],_0x533d72);_0x2914a0(_0x295a42[_0x89a1('0x17')](0x1f4,_0xf0148d[_0x89a1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index c0f64c7..c99fb9e 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['emit','removeListener','register','chatQueue:','./chatQueue.events','remove','update'];(function(_0x3b5f66,_0x1dbfc5){var _0x4aa1a8=function(_0x57c05c){while(--_0x57c05c){_0x3b5f66['push'](_0x3b5f66['shift']());}};_0x4aa1a8(++_0x1dbfc5);}(_0xb10b,0x12a));var _0xbb10=function(_0x4f025f,_0x274149){_0x4f025f=_0x4f025f-0x0;var _0x143048=_0xb10b[_0x4f025f];return _0x143048;};'use strict';var ChatQueueEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatQueueEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatQueueEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','chatQueue:','./chatQueue.events','remove','update'];(function(_0x23ca2f,_0x271c2b){var _0x4f4b51=function(_0x1cb6c0){while(--_0x1cb6c0){_0x23ca2f['push'](_0x23ca2f['shift']());}};_0x4f4b51(++_0x271c2b);}(_0xb10b,0x12a));var _0xbb10=function(_0x4b0aa3,_0x198647){_0x4b0aa3=_0x4b0aa3-0x0;var _0x126ad5=_0xb10b[_0x4b0aa3];return _0x126ad5;};'use strict';var ChatQueueEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatQueueEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatQueueEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index d87aa04..54f12b1 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 _0x7f8d=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','delete','/:id','destroy','removeTeams','exports','multer','util','path','Router','../../components/interaction/service'];(function(_0x54a24b,_0x423b2b){var _0x3c8bec=function(_0xfc3221){while(--_0xfc3221){_0x54a24b['push'](_0x54a24b['shift']());}};_0x3c8bec(++_0x423b2b);}(_0x7f8d,0x1bd));var _0xd7f8=function(_0x249120,_0x2077cb){_0x249120=_0x249120-0x0;var _0x1b59ce=_0x7f8d[_0x249120];return _0x1b59ce;};'use strict';var multer=require(_0xd7f8('0x0'));var util=require(_0xd7f8('0x1'));var path=require(_0xd7f8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd7f8('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd7f8('0x4'));var config=require(_0xd7f8('0x5'));var controller=require(_0xd7f8('0x6'));router[_0xd7f8('0x7')]('/',auth[_0xd7f8('0x8')](),controller[_0xd7f8('0x9')]);router[_0xd7f8('0x7')](_0xd7f8('0xa'),auth[_0xd7f8('0x8')](),controller['describe']);router['get']('/:id',auth[_0xd7f8('0x8')](),controller[_0xd7f8('0xb')]);router[_0xd7f8('0x7')](_0xd7f8('0xc'),auth[_0xd7f8('0x8')](),controller[_0xd7f8('0xd')]);router['get'](_0xd7f8('0xe'),auth[_0xd7f8('0x8')](),controller[_0xd7f8('0xf')]);router['get'](_0xd7f8('0x10'),auth[_0xd7f8('0x8')](),controller[_0xd7f8('0x11')]);router[_0xd7f8('0x12')]('/',auth[_0xd7f8('0x8')](),controller[_0xd7f8('0x13')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0xd7f8('0x12')](_0xd7f8('0x10'),auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth[_0xd7f8('0x8')](),controller['update']);router[_0xd7f8('0x14')](_0xd7f8('0x15'),auth[_0xd7f8('0x8')](),controller[_0xd7f8('0x16')]);router[_0xd7f8('0x14')](_0xd7f8('0xe'),auth[_0xd7f8('0x8')](),controller[_0xd7f8('0x17')]);router[_0xd7f8('0x14')](_0xd7f8('0x10'),auth[_0xd7f8('0x8')](),controller['removeAgents']);module[_0xd7f8('0x18')]=router; \ No newline at end of file +var _0xa998=['/describe','describe','/:id','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','path','connect-timeout','express','Router','../../config/environment','./chatQueue.controller','get'];(function(_0x5ac2b2,_0x3ccd16){var _0x580278=function(_0x28e511){while(--_0x28e511){_0x5ac2b2['push'](_0x5ac2b2['shift']());}};_0x580278(++_0x3ccd16);}(_0xa998,0xec));var _0x8a99=function(_0x299d40,_0x493e07){_0x299d40=_0x299d40-0x0;var _0x27bfbd=_0xa998[_0x299d40];return _0x27bfbd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8a99('0x0'));var timeout=require(_0x8a99('0x1'));var express=require(_0x8a99('0x2'));var router=express[_0x8a99('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8a99('0x4'));var controller=require(_0x8a99('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8a99('0x6')](_0x8a99('0x7'),auth['isAuthenticated'](),controller[_0x8a99('0x8')]);router[_0x8a99('0x6')](_0x8a99('0x9'),auth[_0x8a99('0xa')](),controller[_0x8a99('0xb')]);router[_0x8a99('0x6')](_0x8a99('0xc'),auth[_0x8a99('0xa')](),controller[_0x8a99('0xd')]);router[_0x8a99('0x6')](_0x8a99('0xe'),auth['isAuthenticated'](),controller['getTeams']);router[_0x8a99('0x6')]('/:id/users',auth[_0x8a99('0xa')](),controller[_0x8a99('0xf')]);router[_0x8a99('0x10')]('/',auth[_0x8a99('0xa')](),controller[_0x8a99('0x11')]);router[_0x8a99('0x10')](_0x8a99('0xe'),auth[_0x8a99('0xa')](),controller[_0x8a99('0x12')]);router[_0x8a99('0x10')](_0x8a99('0x13'),auth[_0x8a99('0xa')](),controller[_0x8a99('0x14')]);router[_0x8a99('0x15')](_0x8a99('0x9'),auth[_0x8a99('0xa')](),controller[_0x8a99('0x16')]);router[_0x8a99('0x17')]('/:id',auth[_0x8a99('0xa')](),controller[_0x8a99('0x18')]);router[_0x8a99('0x17')](_0x8a99('0xe'),auth[_0x8a99('0xa')](),controller[_0x8a99('0x19')]);router[_0x8a99('0x17')](_0x8a99('0x13'),auth[_0x8a99('0xa')](),controller[_0x8a99('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index d85906a..b2be342 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 _0x637e=['DATE','moment','sequelize','exports','STRING'];(function(_0x5d15a7,_0x5ccdb0){var _0x437f63=function(_0x360488){while(--_0x360488){_0x5d15a7['push'](_0x5d15a7['shift']());}};_0x437f63(++_0x5ccdb0);}(_0x637e,0x191));var _0xe637=function(_0x308bd1,_0x29be05){_0x308bd1=_0x308bd1-0x0;var _0x1e8b7b=_0x637e[_0x308bd1];return _0x1e8b7b;};'use strict';var moment=require(_0xe637('0x0'));var Sequelize=require(_0xe637('0x1'));module[_0xe637('0x2')]={'uniqueid':{'type':Sequelize[_0xe637('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xe637('0x3')]},'joinAt':{'type':Sequelize[_0xe637('0x4')]},'leaveAt':{'type':Sequelize[_0xe637('0x4')]},'acceptAt':{'type':Sequelize[_0xe637('0x4')]},'exitAt':{'type':Sequelize[_0xe637('0x4')]},'reason':{'type':Sequelize[_0xe637('0x3')]}}; \ No newline at end of file +var _0x64a5=['sequelize','exports','STRING','DATE'];(function(_0x4bbb49,_0x228c52){var _0x54acb1=function(_0x19e1b8){while(--_0x19e1b8){_0x4bbb49['push'](_0x4bbb49['shift']());}};_0x54acb1(++_0x228c52);}(_0x64a5,0x1b8));var _0x564a=function(_0xc6afa9,_0x3d98ca){_0xc6afa9=_0xc6afa9-0x0;var _0x3085db=_0x64a5[_0xc6afa9];return _0x3085db;};'use strict';var moment=require('moment');var Sequelize=require(_0x564a('0x0'));module[_0x564a('0x1')]={'uniqueid':{'type':Sequelize[_0x564a('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x564a('0x2')]},'joinAt':{'type':Sequelize[_0x564a('0x3')]},'leaveAt':{'type':Sequelize[_0x564a('0x3')]},'acceptAt':{'type':Sequelize[_0x564a('0x3')]},'exitAt':{'type':Sequelize[_0x564a('0x3')]},'reason':{'type':Sequelize[_0x564a('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 5ea73b8..097c0b9 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 _0x757a=['count','findAll','rows','catch','params','keys','includeAll','include','create','body','find','describe','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','end','status','json','offset','limit','Content-Range','apply','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','map','VIRTUAL','options','ChatQueueReport'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x757a,0xde));var _0xa757=function(_0x339f59,_0x551adf){_0x339f59=_0x339f59-0x0;var _0x591e7a=_0x757a[_0x339f59];return _0x591e7a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa757('0x0'));var rimraf=require(_0xa757('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa757('0x2'));var BPromise=require(_0xa757('0x3'));var Mustache=require(_0xa757('0x4'));var util=require(_0xa757('0x5'));var path=require(_0xa757('0x6'));var sox=require(_0xa757('0x7'));var csv=require('to-csv');var ejs=require(_0xa757('0x8'));var fs=require('fs');var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0xd'));var querystring=require(_0xa757('0xe'));var Papa=require('papaparse');var Redis=require(_0xa757('0xf'));var authService=require(_0xa757('0x10'));var qs=require(_0xa757('0x11'));var as=require(_0xa757('0x12'));var hardwareService=require(_0xa757('0x13'));var logger=require(_0xa757('0x14'))(_0xa757('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56acfb,_0x4db68e){_0x4db68e=_0x4db68e||0xcc;return function(_0x421040){if(_0x421040){return _0x56acfb['sendStatus'](_0x4db68e);}return _0x56acfb['status'](_0x4db68e)[_0xa757('0x16')]();};}function respondWithResult(_0x513b1f,_0x481508){_0x481508=_0x481508||0xc8;return function(_0x32112b){if(_0x32112b){return _0x513b1f[_0xa757('0x17')](_0x481508)[_0xa757('0x18')](_0x32112b);}};}function respondWithFilteredResult(_0x4a0c38,_0x86abd){return function(_0x31cfd2){if(_0x31cfd2){var _0xf12b68=_0x31cfd2['count'],_0x2f7947=_0x86abd[_0xa757('0x19')],_0x185011=_0x86abd[_0xa757('0x19')]+_0x86abd[_0xa757('0x1a')],_0x3df1f9;if(_0x185011>=_0xf12b68){_0x185011=_0xf12b68;_0x3df1f9=0xc8;}else{_0x3df1f9=0xce;}_0x4a0c38['status'](_0x3df1f9);return _0x4a0c38['set'](_0xa757('0x1b'),_0x2f7947+'-'+_0x185011+'/'+_0xf12b68)[_0xa757('0x18')](_0x31cfd2);}return null;};}function patchUpdates(_0x1bd14c){return function(_0x340599){try{jsonpatch[_0xa757('0x1c')](_0x340599,_0x1bd14c,!![]);}catch(_0xe2d567){return BPromise['reject'](_0xe2d567);}return _0x340599[_0xa757('0x1d')]();};}function saveUpdates(_0x4fec52,_0x32c2a1){return function(_0x167640){if(_0x167640){return _0x167640[_0xa757('0x1e')](_0x4fec52)[_0xa757('0x1f')](function(_0x4d598c){return _0x4d598c;});}return null;};}function removeEntity(_0x5638c7,_0x40ec48){return function(_0x2159cf){if(_0x2159cf){return _0x2159cf[_0xa757('0x20')]()[_0xa757('0x1f')](function(){_0x5638c7[_0xa757('0x17')](0xcc)[_0xa757('0x16')]();});}};}function handleEntityNotFound(_0x2ca10d,_0x21f1af){return function(_0x2bf276){if(!_0x2bf276){_0x2ca10d['sendStatus'](0x194);}return _0x2bf276;};}function handleError(_0x3707c1,_0x59e9d4){_0x59e9d4=_0x59e9d4||0x1f4;return function(_0x422e9e){logger['error'](_0x422e9e[_0xa757('0x21')]);if(_0x422e9e[_0xa757('0x22')]){delete _0x422e9e[_0xa757('0x22')];}_0x3707c1['status'](_0x59e9d4)[_0xa757('0x23')](_0x422e9e);};}exports[_0xa757('0x24')]=function(_0x471e84,_0x3bf7f3){var _0x5b4779={},_0x449a7d={},_0x54263b={'count':0x0,'rows':[]};var _0x5a5664=_['map'](db['ChatQueueReport'][_0xa757('0x25')],function(_0x596ae2){return{'name':_0x596ae2[_0xa757('0x26')],'type':_0x596ae2[_0xa757('0x27')]['key']};});_0x449a7d[_0xa757('0x28')]=_['map'](_0x5a5664,_0xa757('0x22'));_0x449a7d[_0xa757('0x29')]=_['keys'](_0x471e84[_0xa757('0x29')]);_0x449a7d['filters']=_[_0xa757('0x2a')](_0x449a7d[_0xa757('0x28')],_0x449a7d[_0xa757('0x29')]);_0x5b4779[_0xa757('0x2b')]=_[_0xa757('0x2a')](_0x449a7d[_0xa757('0x28')],qs[_0xa757('0x2c')](_0x471e84[_0xa757('0x29')][_0xa757('0x2c')]));_0x5b4779[_0xa757('0x2b')]=_0x5b4779[_0xa757('0x2b')][_0xa757('0x2d')]?_0x5b4779[_0xa757('0x2b')]:_0x449a7d[_0xa757('0x28')];if(!_0x471e84[_0xa757('0x29')][_0xa757('0x2e')](_0xa757('0x2f'))){_0x5b4779[_0xa757('0x1a')]=qs[_0xa757('0x1a')](_0x471e84[_0xa757('0x29')][_0xa757('0x1a')]);_0x5b4779[_0xa757('0x19')]=qs[_0xa757('0x19')](_0x471e84[_0xa757('0x29')]['offset']);}_0x5b4779[_0xa757('0x30')]=qs[_0xa757('0x31')](_0x471e84[_0xa757('0x29')][_0xa757('0x31')]);_0x5b4779[_0xa757('0x32')]=qs['filters'](_[_0xa757('0x33')](_0x471e84[_0xa757('0x29')],_0x449a7d[_0xa757('0x34')]),_0x5a5664);if(_0x471e84[_0xa757('0x29')][_0xa757('0x35')]){_0x5b4779[_0xa757('0x32')]=_['merge'](_0x5b4779[_0xa757('0x32')],{'$or':_[_0xa757('0x36')](_0x5a5664,function(_0x2cade7){if(_0x2cade7[_0xa757('0x27')]!==_0xa757('0x37')){var _0x111cfe={};_0x111cfe[_0x2cade7[_0xa757('0x22')]]={'$like':'%'+_0x471e84[_0xa757('0x29')][_0xa757('0x35')]+'%'};return _0x111cfe;}})});}_0x5b4779=_['merge']({},_0x5b4779,_0x471e84[_0xa757('0x38')]);var _0x34fba8={'where':_0x5b4779[_0xa757('0x32')]};return db[_0xa757('0x39')][_0xa757('0x3a')](_0x34fba8)[_0xa757('0x1f')](function(_0x501e26){_0x54263b[_0xa757('0x3a')]=_0x501e26;if(_0x471e84[_0xa757('0x29')]['includeAll']){_0x5b4779['include']=[{'all':!![]}];}return db[_0xa757('0x39')][_0xa757('0x3b')](_0x5b4779);})['then'](function(_0x51c3d1){_0x54263b[_0xa757('0x3c')]=_0x51c3d1;return _0x54263b;})[_0xa757('0x1f')](respondWithFilteredResult(_0x3bf7f3,_0x5b4779))[_0xa757('0x3d')](handleError(_0x3bf7f3,null));};exports['show']=function(_0x830dc4,_0x13a8f4){var _0x26802c={'raw':!![],'where':{'id':_0x830dc4[_0xa757('0x3e')]['id']}},_0x1ba399={};_0x1ba399['model']=_[_0xa757('0x3f')](db['ChatQueueReport']['rawAttributes']);_0x1ba399[_0xa757('0x29')]=_[_0xa757('0x3f')](_0x830dc4[_0xa757('0x29')]);_0x1ba399[_0xa757('0x34')]=_[_0xa757('0x2a')](_0x1ba399['model'],_0x1ba399['query']);_0x26802c[_0xa757('0x2b')]=_[_0xa757('0x2a')](_0x1ba399[_0xa757('0x28')],qs[_0xa757('0x2c')](_0x830dc4[_0xa757('0x29')][_0xa757('0x2c')]));_0x26802c['attributes']=_0x26802c[_0xa757('0x2b')][_0xa757('0x2d')]?_0x26802c['attributes']:_0x1ba399[_0xa757('0x28')];if(_0x830dc4['query'][_0xa757('0x40')]){_0x26802c[_0xa757('0x41')]=[{'all':!![]}];}_0x26802c=_['merge']({},_0x26802c,_0x830dc4[_0xa757('0x38')]);return db[_0xa757('0x39')]['find'](_0x26802c)[_0xa757('0x1f')](handleEntityNotFound(_0x13a8f4,null))[_0xa757('0x1f')](respondWithResult(_0x13a8f4,null))[_0xa757('0x3d')](handleError(_0x13a8f4,null));};exports[_0xa757('0x42')]=function(_0x543b5b,_0x199dc9){return db[_0xa757('0x39')][_0xa757('0x42')](_0x543b5b[_0xa757('0x43')],{})['then'](respondWithResult(_0x199dc9,0xc9))[_0xa757('0x3d')](handleError(_0x199dc9,null));};exports['update']=function(_0x50c131,_0x2acf88){if(_0x50c131[_0xa757('0x43')]['id']){delete _0x50c131[_0xa757('0x43')]['id'];}return db['ChatQueueReport'][_0xa757('0x44')]({'where':{'id':_0x50c131['params']['id']}})[_0xa757('0x1f')](handleEntityNotFound(_0x2acf88,null))[_0xa757('0x1f')](saveUpdates(_0x50c131[_0xa757('0x43')],null))[_0xa757('0x1f')](respondWithResult(_0x2acf88,null))[_0xa757('0x3d')](handleError(_0x2acf88,null));};exports[_0xa757('0x20')]=function(_0x57bf73,_0x505cd){return db['ChatQueueReport'][_0xa757('0x44')]({'where':{'id':_0x57bf73[_0xa757('0x3e')]['id']}})[_0xa757('0x1f')](handleEntityNotFound(_0x505cd,null))[_0xa757('0x1f')](removeEntity(_0x505cd,null))[_0xa757('0x3d')](handleError(_0x505cd,null));};exports[_0xa757('0x45')]=function(_0x15bad7,_0x2c5b3c){return db[_0xa757('0x39')][_0xa757('0x45')]()[_0xa757('0x1f')](respondWithResult(_0x2c5b3c,null))[_0xa757('0x3d')](handleError(_0x2c5b3c,null));}; \ No newline at end of file +var _0xb7e7=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','ChatQueueReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','create','body','describe','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path','ejs','lodash','squel','jsforce'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb7e7,0x121));var _0x7b7e=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xb7e7[_0xac151d];return _0x111dba;};'use strict';var pdf=require(_0x7b7e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7b7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b7e('0x2'));var rp=require('request-promise');var moment=require(_0x7b7e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7b7e('0x4'));var util=require(_0x7b7e('0x5'));var path=require(_0x7b7e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7b7e('0x7'));var fs=require('fs');var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var Redis=require(_0x7b7e('0xf'));var authService=require(_0x7b7e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b7e('0x11'));var hardwareService=require(_0x7b7e('0x12'));var logger=require(_0x7b7e('0x13'))(_0x7b7e('0x14'));var utils=require(_0x7b7e('0x15'));var config=require(_0x7b7e('0x16'));var db=require(_0x7b7e('0x17'))['db'];function respondWithStatusCode(_0x55620b,_0xaadda){_0xaadda=_0xaadda||0xcc;return function(_0x54d8ce){if(_0x54d8ce){return _0x55620b[_0x7b7e('0x18')](_0xaadda);}return _0x55620b[_0x7b7e('0x19')](_0xaadda)['end']();};}function respondWithResult(_0x422d3a,_0x5976ac){_0x5976ac=_0x5976ac||0xc8;return function(_0x4c6011){if(_0x4c6011){return _0x422d3a[_0x7b7e('0x19')](_0x5976ac)[_0x7b7e('0x1a')](_0x4c6011);}};}function respondWithFilteredResult(_0xf067da,_0x457ec5){return function(_0x3d2fb2){if(_0x3d2fb2){var _0x5703fd=_0x3d2fb2[_0x7b7e('0x1b')],_0x51baf6=_0x457ec5[_0x7b7e('0x1c')],_0xc7f087=_0x457ec5[_0x7b7e('0x1c')]+_0x457ec5[_0x7b7e('0x1d')],_0x36444d;if(_0xc7f087>=_0x5703fd){_0xc7f087=_0x5703fd;_0x36444d=0xc8;}else{_0x36444d=0xce;}_0xf067da[_0x7b7e('0x19')](_0x36444d);return _0xf067da[_0x7b7e('0x1e')](_0x7b7e('0x1f'),_0x51baf6+'-'+_0xc7f087+'/'+_0x5703fd)[_0x7b7e('0x1a')](_0x3d2fb2);}return null;};}function patchUpdates(_0x12e8e9){return function(_0x14f4fe){try{jsonpatch[_0x7b7e('0x20')](_0x14f4fe,_0x12e8e9,!![]);}catch(_0x3bec7d){return BPromise[_0x7b7e('0x21')](_0x3bec7d);}return _0x14f4fe[_0x7b7e('0x22')]();};}function saveUpdates(_0x3a7b8b,_0x49eddb){return function(_0x69262b){if(_0x69262b){return _0x69262b[_0x7b7e('0x23')](_0x3a7b8b)[_0x7b7e('0x24')](function(_0x4c0647){return _0x4c0647;});}return null;};}function removeEntity(_0x313122,_0xbf0cb3){return function(_0x14243b){if(_0x14243b){return _0x14243b[_0x7b7e('0x25')]()[_0x7b7e('0x24')](function(){_0x313122[_0x7b7e('0x19')](0xcc)[_0x7b7e('0x26')]();});}};}function handleEntityNotFound(_0x10a66a,_0x53bbb3){return function(_0x5d6215){if(!_0x5d6215){_0x10a66a['sendStatus'](0x194);}return _0x5d6215;};}function handleError(_0x26ee14,_0x22598e){_0x22598e=_0x22598e||0x1f4;return function(_0x23bfa3){logger['error'](_0x23bfa3['stack']);if(_0x23bfa3['name']){delete _0x23bfa3[_0x7b7e('0x27')];}_0x26ee14[_0x7b7e('0x19')](_0x22598e)[_0x7b7e('0x28')](_0x23bfa3);};}exports[_0x7b7e('0x29')]=function(_0x3ceaf5,_0x48fad1){var _0x6a1e71={},_0x21a15={},_0x4c46b8={'count':0x0,'rows':[]};var _0x57b9da=_['map'](db[_0x7b7e('0x2a')][_0x7b7e('0x2b')],function(_0x503625){return{'name':_0x503625[_0x7b7e('0x2c')],'type':_0x503625['type'][_0x7b7e('0x2d')]};});_0x21a15[_0x7b7e('0x2e')]=_[_0x7b7e('0x2f')](_0x57b9da,'name');_0x21a15[_0x7b7e('0x30')]=_[_0x7b7e('0x31')](_0x3ceaf5[_0x7b7e('0x30')]);_0x21a15[_0x7b7e('0x32')]=_[_0x7b7e('0x33')](_0x21a15['model'],_0x21a15[_0x7b7e('0x30')]);_0x6a1e71['attributes']=_[_0x7b7e('0x33')](_0x21a15[_0x7b7e('0x2e')],qs[_0x7b7e('0x34')](_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x34')]));_0x6a1e71[_0x7b7e('0x35')]=_0x6a1e71[_0x7b7e('0x35')]['length']?_0x6a1e71['attributes']:_0x21a15[_0x7b7e('0x2e')];if(!_0x3ceaf5[_0x7b7e('0x30')]['hasOwnProperty'](_0x7b7e('0x36'))){_0x6a1e71[_0x7b7e('0x1d')]=qs[_0x7b7e('0x1d')](_0x3ceaf5['query'][_0x7b7e('0x1d')]);_0x6a1e71[_0x7b7e('0x1c')]=qs[_0x7b7e('0x1c')](_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x1c')]);}_0x6a1e71[_0x7b7e('0x37')]=qs[_0x7b7e('0x38')](_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x38')]);_0x6a1e71[_0x7b7e('0x39')]=qs[_0x7b7e('0x32')](_[_0x7b7e('0x3a')](_0x3ceaf5[_0x7b7e('0x30')],_0x21a15[_0x7b7e('0x32')]),_0x57b9da);if(_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x3b')]){_0x6a1e71['where']=_[_0x7b7e('0x3c')](_0x6a1e71[_0x7b7e('0x39')],{'$or':_[_0x7b7e('0x2f')](_0x57b9da,function(_0x242609){if(_0x242609[_0x7b7e('0x3d')]!==_0x7b7e('0x3e')){var _0x7f15={};_0x7f15[_0x242609[_0x7b7e('0x27')]]={'$like':'%'+_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x3b')]+'%'};return _0x7f15;}})});}_0x6a1e71=_['merge']({},_0x6a1e71,_0x3ceaf5[_0x7b7e('0x3f')]);var _0x1fa75b={'where':_0x6a1e71[_0x7b7e('0x39')]};return db[_0x7b7e('0x2a')]['count'](_0x1fa75b)[_0x7b7e('0x24')](function(_0x35b31a){_0x4c46b8[_0x7b7e('0x1b')]=_0x35b31a;if(_0x3ceaf5['query']['includeAll']){_0x6a1e71[_0x7b7e('0x40')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x7b7e('0x41')](_0x6a1e71);})[_0x7b7e('0x24')](function(_0x4de331){_0x4c46b8[_0x7b7e('0x42')]=_0x4de331;return _0x4c46b8;})[_0x7b7e('0x24')](respondWithFilteredResult(_0x48fad1,_0x6a1e71))[_0x7b7e('0x43')](handleError(_0x48fad1,null));};exports[_0x7b7e('0x44')]=function(_0x38d32f,_0x435de5){var _0xc888e4={'raw':!![],'where':{'id':_0x38d32f[_0x7b7e('0x45')]['id']}},_0x1d9bb9={};_0x1d9bb9['model']=_['keys'](db[_0x7b7e('0x2a')]['rawAttributes']);_0x1d9bb9[_0x7b7e('0x30')]=_['keys'](_0x38d32f['query']);_0x1d9bb9[_0x7b7e('0x32')]=_['intersection'](_0x1d9bb9[_0x7b7e('0x2e')],_0x1d9bb9['query']);_0xc888e4[_0x7b7e('0x35')]=_[_0x7b7e('0x33')](_0x1d9bb9[_0x7b7e('0x2e')],qs[_0x7b7e('0x34')](_0x38d32f['query'][_0x7b7e('0x34')]));_0xc888e4[_0x7b7e('0x35')]=_0xc888e4[_0x7b7e('0x35')][_0x7b7e('0x46')]?_0xc888e4[_0x7b7e('0x35')]:_0x1d9bb9[_0x7b7e('0x2e')];if(_0x38d32f['query']['includeAll']){_0xc888e4['include']=[{'all':!![]}];}_0xc888e4=_[_0x7b7e('0x3c')]({},_0xc888e4,_0x38d32f[_0x7b7e('0x3f')]);return db[_0x7b7e('0x2a')][_0x7b7e('0x47')](_0xc888e4)[_0x7b7e('0x24')](handleEntityNotFound(_0x435de5,null))[_0x7b7e('0x24')](respondWithResult(_0x435de5,null))['catch'](handleError(_0x435de5,null));};exports[_0x7b7e('0x48')]=function(_0x42e560,_0x5a0832){return db['ChatQueueReport'][_0x7b7e('0x48')](_0x42e560[_0x7b7e('0x49')],{})[_0x7b7e('0x24')](respondWithResult(_0x5a0832,0xc9))[_0x7b7e('0x43')](handleError(_0x5a0832,null));};exports[_0x7b7e('0x23')]=function(_0xb46776,_0x590154){if(_0xb46776[_0x7b7e('0x49')]['id']){delete _0xb46776['body']['id'];}return db[_0x7b7e('0x2a')][_0x7b7e('0x47')]({'where':{'id':_0xb46776[_0x7b7e('0x45')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x590154,null))['then'](saveUpdates(_0xb46776[_0x7b7e('0x49')],null))[_0x7b7e('0x24')](respondWithResult(_0x590154,null))[_0x7b7e('0x43')](handleError(_0x590154,null));};exports[_0x7b7e('0x25')]=function(_0x1f9d0f,_0x5cce7c){return db[_0x7b7e('0x2a')][_0x7b7e('0x47')]({'where':{'id':_0x1f9d0f[_0x7b7e('0x45')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x5cce7c,null))[_0x7b7e('0x24')](removeEntity(_0x5cce7c,null))['catch'](handleError(_0x5cce7c,null));};exports[_0x7b7e('0x4a')]=function(_0x29024e,_0x46d4ee){return db[_0x7b7e('0x2a')][_0x7b7e('0x4a')]()[_0x7b7e('0x24')](respondWithResult(_0x46d4ee,null))[_0x7b7e('0x43')](handleError(_0x46d4ee,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 5846f6a..452f2de 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 _0x9fdd=['ChatQueueReport','report_chat_queue','uniqueid','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x9fdd,0x15f));var _0xd9fd=function(_0xcdee1f,_0x4fec06){_0xcdee1f=_0xcdee1f-0x0;var _0x16cd17=_0x9fdd[_0xcdee1f];return _0x16cd17;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd9fd('0x0'))(_0xd9fd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd9fd('0x2'));var fs=require('fs');var path=require(_0xd9fd('0x3'));var rimraf=require(_0xd9fd('0x4'));var config=require(_0xd9fd('0x5'));var attributes=require(_0xd9fd('0x6'));module[_0xd9fd('0x7')]=function(_0x3255d2,_0x28558a){return _0x3255d2[_0xd9fd('0x8')](_0xd9fd('0x9'),attributes,{'tableName':_0xd9fd('0xa'),'paranoid':![],'indexes':[{'name':_0xd9fd('0xb'),'fields':[_0xd9fd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9754=['util','request-promise','path','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash'];(function(_0x36c8c3,_0x353bd5){var _0x152e29=function(_0x5c3513){while(--_0x5c3513){_0x36c8c3['push'](_0x36c8c3['shift']());}};_0x152e29(++_0x353bd5);}(_0x9754,0x17b));var _0x4975=function(_0x57e1a1,_0x3918a4){_0x57e1a1=_0x57e1a1-0x0;var _0x1187f7=_0x9754[_0x57e1a1];return _0x1187f7;};'use strict';var _=require(_0x4975('0x0'));var util=require(_0x4975('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4975('0x2'));var fs=require('fs');var path=require(_0x4975('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4975('0x4'));module[_0x4975('0x5')]=function(_0x5a1712,_0x5c42e0){return _0x5a1712[_0x4975('0x6')](_0x4975('0x7'),attributes,{'tableName':_0x4975('0x8'),'paranoid':![],'indexes':[{'name':_0x4975('0x9'),'fields':[_0x4975('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index c998ba9..d735821 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 _0x4676=['then','info','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','ChatQueueReport,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','update','where','attributes','limit','UpdateChatQueueReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x8f7d2b,_0x1bebaf){var _0x13c298=function(_0x54717e){while(--_0x54717e){_0x8f7d2b['push'](_0x8f7d2b['shift']());}};_0x13c298(++_0x1bebaf);}(_0x4676,0x1e3));var _0x6467=function(_0x4123ca,_0x60ee13){_0x4123ca=_0x4123ca-0x0;var _0x25a900=_0x4676[_0x4123ca];return _0x25a900;};'use strict';var _=require(_0x6467('0x0'));var util=require(_0x6467('0x1'));var moment=require('moment');var BPromise=require(_0x6467('0x2'));var rs=require(_0x6467('0x3'));var fs=require('fs');var Redis=require(_0x6467('0x4'));var db=require(_0x6467('0x5'))['db'];var utils=require(_0x6467('0x6'));var logger=require(_0x6467('0x7'))(_0x6467('0x8'));var config=require(_0x6467('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6467('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4edfa0,_0x2cc22d,_0x3cea11){return new BPromise(function(_0x49ecd5,_0x2350cd){return client[_0x6467('0xb')](_0x4edfa0,_0x3cea11)[_0x6467('0xc')](function(_0x415e35){logger[_0x6467('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x2cc22d,'request\x20sent');logger[_0x6467('0xe')](_0x6467('0xf'),_0x2cc22d,'request\x20sent',JSON[_0x6467('0x10')](_0x415e35));if(_0x415e35['error']){if(_0x415e35[_0x6467('0x11')]['code']===0x1f4){logger[_0x6467('0x11')](_0x6467('0x12'),_0x2cc22d,_0x415e35[_0x6467('0x11')][_0x6467('0x13')]);return _0x2350cd(_0x415e35[_0x6467('0x11')][_0x6467('0x13')]);}logger[_0x6467('0x11')](_0x6467('0x12'),_0x2cc22d,_0x415e35[_0x6467('0x11')][_0x6467('0x13')]);return _0x49ecd5(_0x415e35[_0x6467('0x11')][_0x6467('0x13')]);}else{logger[_0x6467('0xd')](_0x6467('0x12'),_0x2cc22d,_0x6467('0x14'));_0x49ecd5(_0x415e35[_0x6467('0x15')][_0x6467('0x13')]);}})[_0x6467('0x16')](function(_0x5ec612){logger[_0x6467('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x2cc22d,_0x5ec612);_0x2350cd(_0x5ec612);});});}exports[_0x6467('0x17')]=function(_0x1cb8ff){var _0x18a3e6=this;return new Promise(function(_0x2a1046,_0x1e682e){return db[_0x6467('0x18')]['create'](_0x1cb8ff[_0x6467('0x19')],{'raw':_0x1cb8ff[_0x6467('0x1a')]?_0x1cb8ff['options'][_0x6467('0x1b')]===undefined?!![]:![]:!![]})[_0x6467('0xc')](function(_0x4ad7f9){logger['info']('CreateChatQueueReport',_0x1cb8ff);logger[_0x6467('0xe')](_0x6467('0x17'),_0x1cb8ff,JSON[_0x6467('0x10')](_0x4ad7f9));_0x2a1046(_0x4ad7f9);})[_0x6467('0x16')](function(_0x2ddd15){logger[_0x6467('0x11')](_0x6467('0x17'),_0x2ddd15[_0x6467('0x13')],_0x1cb8ff);_0x1e682e(_0x18a3e6[_0x6467('0x11')](0x1f4,_0x2ddd15['message']));});});};exports['UpdateChatQueueReport']=function(_0x4e2ffb){var _0x3d1f1a=this;return new Promise(function(_0x1990f8,_0x368b5){return db[_0x6467('0x18')][_0x6467('0x1c')](_0x4e2ffb[_0x6467('0x19')],{'raw':_0x4e2ffb[_0x6467('0x1a')]?_0x4e2ffb[_0x6467('0x1a')][_0x6467('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e2ffb['options']?_0x4e2ffb[_0x6467('0x1a')][_0x6467('0x1d')]||null:null,'attributes':_0x4e2ffb[_0x6467('0x1a')]?_0x4e2ffb[_0x6467('0x1a')][_0x6467('0x1e')]||null:null,'limit':_0x4e2ffb['options']?_0x4e2ffb[_0x6467('0x1a')][_0x6467('0x1f')]||null:null})[_0x6467('0xc')](function(_0x276cc0){logger[_0x6467('0xd')](_0x6467('0x20'),_0x4e2ffb);logger[_0x6467('0xe')](_0x6467('0x20'),_0x4e2ffb,JSON[_0x6467('0x10')](_0x276cc0));_0x1990f8(_0x276cc0);})[_0x6467('0x16')](function(_0x27fdf0){logger[_0x6467('0x11')](_0x6467('0x20'),_0x27fdf0['message'],_0x4e2ffb);_0x368b5(_0x3d1f1a[_0x6467('0x11')](0x1f4,_0x27fdf0[_0x6467('0x13')]));});});}; \ No newline at end of file +var _0x99cc=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','options','raw','debug','UpdateChatQueueReport','body','where','attributes','limit','util','bluebird','randomstring','ioredis'];(function(_0x6d0302,_0xad87e4){var _0x43deed=function(_0x38d02a){while(--_0x38d02a){_0x6d0302['push'](_0x6d0302['shift']());}};_0x43deed(++_0xad87e4);}(_0x99cc,0x132));var _0xc99c=function(_0x42cd73,_0x2bab48){_0x42cd73=_0x42cd73-0x0;var _0x5770a5=_0x99cc[_0x42cd73];return _0x5770a5;};'use strict';var _=require('lodash');var util=require(_0xc99c('0x0'));var moment=require('moment');var BPromise=require(_0xc99c('0x1'));var rs=require(_0xc99c('0x2'));var fs=require('fs');var Redis=require(_0xc99c('0x3'));var db=require(_0xc99c('0x4'))['db'];var utils=require(_0xc99c('0x5'));var logger=require(_0xc99c('0x6'))(_0xc99c('0x7'));var config=require(_0xc99c('0x8'));var jayson=require(_0xc99c('0x9'));var client=jayson['client'][_0xc99c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d201b,_0x4a19b9,_0xec10ca){return new BPromise(function(_0xbbbcb,_0x6f274f){return client['request'](_0x3d201b,_0xec10ca)[_0xc99c('0xb')](function(_0x248ea8){logger[_0xc99c('0xc')](_0xc99c('0xd'),_0x4a19b9,_0xc99c('0xe'));logger['debug']('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x4a19b9,_0xc99c('0xe'),JSON[_0xc99c('0xf')](_0x248ea8));if(_0x248ea8[_0xc99c('0x10')]){if(_0x248ea8[_0xc99c('0x10')][_0xc99c('0x11')]===0x1f4){logger[_0xc99c('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x4a19b9,_0x248ea8[_0xc99c('0x10')][_0xc99c('0x12')]);return _0x6f274f(_0x248ea8[_0xc99c('0x10')][_0xc99c('0x12')]);}logger[_0xc99c('0x10')](_0xc99c('0xd'),_0x4a19b9,_0x248ea8[_0xc99c('0x10')][_0xc99c('0x12')]);return _0xbbbcb(_0x248ea8[_0xc99c('0x10')][_0xc99c('0x12')]);}else{logger[_0xc99c('0xc')](_0xc99c('0xd'),_0x4a19b9,_0xc99c('0xe'));_0xbbbcb(_0x248ea8[_0xc99c('0x13')]['message']);}})[_0xc99c('0x14')](function(_0x25c8b3){logger[_0xc99c('0x10')](_0xc99c('0xd'),_0x4a19b9,_0x25c8b3);_0x6f274f(_0x25c8b3);});});}exports[_0xc99c('0x15')]=function(_0x1d4d6e){var _0x426d50=this;return new Promise(function(_0x133492,_0x5c4d19){return db[_0xc99c('0x16')]['create'](_0x1d4d6e['body'],{'raw':_0x1d4d6e[_0xc99c('0x17')]?_0x1d4d6e[_0xc99c('0x17')][_0xc99c('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0xdaf274){logger[_0xc99c('0xc')](_0xc99c('0x15'),_0x1d4d6e);logger[_0xc99c('0x19')](_0xc99c('0x15'),_0x1d4d6e,JSON[_0xc99c('0xf')](_0xdaf274));_0x133492(_0xdaf274);})[_0xc99c('0x14')](function(_0x4cfe17){logger[_0xc99c('0x10')](_0xc99c('0x15'),_0x4cfe17[_0xc99c('0x12')],_0x1d4d6e);_0x5c4d19(_0x426d50[_0xc99c('0x10')](0x1f4,_0x4cfe17[_0xc99c('0x12')]));});});};exports[_0xc99c('0x1a')]=function(_0x2e52a6){var _0x167e19=this;return new Promise(function(_0x3f0382,_0x38af49){return db[_0xc99c('0x16')]['update'](_0x2e52a6[_0xc99c('0x1b')],{'raw':_0x2e52a6[_0xc99c('0x17')]?_0x2e52a6[_0xc99c('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e52a6[_0xc99c('0x17')]?_0x2e52a6['options'][_0xc99c('0x1c')]||null:null,'attributes':_0x2e52a6[_0xc99c('0x17')]?_0x2e52a6['options'][_0xc99c('0x1d')]||null:null,'limit':_0x2e52a6[_0xc99c('0x17')]?_0x2e52a6[_0xc99c('0x17')][_0xc99c('0x1e')]||null:null})[_0xc99c('0xb')](function(_0xc80939){logger['info'](_0xc99c('0x1a'),_0x2e52a6);logger[_0xc99c('0x19')](_0xc99c('0x1a'),_0x2e52a6,JSON['stringify'](_0xc80939));_0x3f0382(_0xc80939);})[_0xc99c('0x14')](function(_0x28436e){logger[_0xc99c('0x10')](_0xc99c('0x1a'),_0x28436e[_0xc99c('0x12')],_0x2e52a6);_0x38af49(_0x167e19[_0xc99c('0x10')](0x1f4,_0x28436e[_0xc99c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 8edfe02..526bba7 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 _0x466d=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller'];(function(_0x34c32f,_0x231983){var _0x47e67e=function(_0x86eaaf){while(--_0x86eaaf){_0x34c32f['push'](_0x34c32f['shift']());}};_0x47e67e(++_0x231983);}(_0x466d,0x1ec));var _0xd466=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x466d[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0xd466('0x0'));var path=require(_0xd466('0x1'));var timeout=require(_0xd466('0x2'));var express=require(_0xd466('0x3'));var router=express[_0xd466('0x4')]();var auth=require(_0xd466('0x5'));var interaction=require(_0xd466('0x6'));var config=require('../../config/environment');var controller=require(_0xd466('0x7'));router[_0xd466('0x8')]('/',auth[_0xd466('0x9')](),controller[_0xd466('0xa')]);router[_0xd466('0x8')](_0xd466('0xb'),auth['isAuthenticated'](),controller[_0xd466('0xc')]);router[_0xd466('0x8')](_0xd466('0xd'),auth[_0xd466('0x9')](),controller[_0xd466('0xe')]);router[_0xd466('0xf')]('/',auth[_0xd466('0x9')](),controller[_0xd466('0x10')]);router['put'](_0xd466('0xd'),auth[_0xd466('0x9')](),controller['update']);router[_0xd466('0x11')]('/:id',auth[_0xd466('0x9')](),controller[_0xd466('0x12')]);module[_0xd466('0x13')]=router; \ No newline at end of file +var _0x7227=['create','put','update','delete','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','/:id','show','post'];(function(_0x4ea0ab,_0x7ee305){var _0x159836=function(_0x11f55d){while(--_0x11f55d){_0x4ea0ab['push'](_0x4ea0ab['shift']());}};_0x159836(++_0x7ee305);}(_0x7227,0xd6));var _0x7722=function(_0x155eb8,_0x5aca30){_0x155eb8=_0x155eb8-0x0;var _0x159589=_0x7227[_0x155eb8];return _0x159589;};'use strict';var multer=require('multer');var util=require(_0x7722('0x0'));var path=require(_0x7722('0x1'));var timeout=require(_0x7722('0x2'));var express=require(_0x7722('0x3'));var router=express['Router']();var auth=require(_0x7722('0x4'));var interaction=require(_0x7722('0x5'));var config=require(_0x7722('0x6'));var controller=require('./chatQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x7722('0x7')]);router[_0x7722('0x8')](_0x7722('0x9'),auth[_0x7722('0xa')](),controller['describe']);router[_0x7722('0x8')](_0x7722('0xb'),auth['isAuthenticated'](),controller[_0x7722('0xc')]);router[_0x7722('0xd')]('/',auth[_0x7722('0xa')](),controller[_0x7722('0xe')]);router[_0x7722('0xf')](_0x7722('0xb'),auth[_0x7722('0xa')](),controller[_0x7722('0x10')]);router[_0x7722('0x11')](_0x7722('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7722('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index cd9af0f..9ddd763 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 _0x26cc=['ENUM','account','agent','queue','DATE','NOW','sequelize','STRING'];(function(_0xd20309,_0x16add9){var _0x18694c=function(_0x5235d5){while(--_0x5235d5){_0xd20309['push'](_0xd20309['shift']());}};_0x18694c(++_0x16add9);}(_0x26cc,0x166));var _0xc26c=function(_0x226ad1,_0x2858e2){_0x226ad1=_0x226ad1-0x0;var _0x16b625=_0x26cc[_0x226ad1];return _0x16b625;};'use strict';var moment=require('moment');var Sequelize=require(_0xc26c('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xc26c('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xc26c('0x2')](_0xc26c('0x3'),_0xc26c('0x4'),_0xc26c('0x5')),'allowNull':![],'defaultValue':_0xc26c('0x5')},'transferredAt':{'type':Sequelize[_0xc26c('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xc26c('0x7')]}}; \ No newline at end of file +var _0x8013=['DATE','NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x28394f,_0x5ebdd2){var _0x2618d2=function(_0x2ffed6){while(--_0x2ffed6){_0x28394f['push'](_0x28394f['shift']());}};_0x2618d2(++_0x5ebdd2);}(_0x8013,0x17a));var _0x3801=function(_0x4ec58c,_0x3daded){_0x4ec58c=_0x4ec58c-0x0;var _0x398af2=_0x8013[_0x4ec58c];return _0x398af2;};'use strict';var moment=require(_0x3801('0x0'));var Sequelize=require(_0x3801('0x1'));module[_0x3801('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3801('0x3'),_0x3801('0x4'),_0x3801('0x5')),'allowNull':![],'defaultValue':_0x3801('0x5')},'transferredAt':{'type':Sequelize[_0x3801('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x3801('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 04d0540..dcba939 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 _0xa41f=['jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','findAll','rows','catch','show','length','includeAll','include','merge','options','find','create','body','update','params','describe','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa41f,0x1b9));var _0xfa41=function(_0x2da798,_0x42289a){_0x2da798=_0x2da798-0x0;var _0x2b1e8b=_0xa41f[_0x2da798];return _0x2b1e8b;};'use strict';var pdf=require(_0xfa41('0x0'));var emlformat=require(_0xfa41('0x1'));var rimraf=require(_0xfa41('0x2'));var zipdir=require(_0xfa41('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfa41('0x4'));var BPromise=require(_0xfa41('0x5'));var Mustache=require(_0xfa41('0x6'));var util=require(_0xfa41('0x7'));var path=require(_0xfa41('0x8'));var sox=require(_0xfa41('0x9'));var csv=require(_0xfa41('0xa'));var ejs=require(_0xfa41('0xb'));var fs=require('fs');var _=require(_0xfa41('0xc'));var squel=require(_0xfa41('0xd'));var crypto=require(_0xfa41('0xe'));var jsforce=require(_0xfa41('0xf'));var deskjs=require(_0xfa41('0x10'));var toCsv=require('to-csv');var querystring=require(_0xfa41('0x11'));var Papa=require('papaparse');var Redis=require(_0xfa41('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xfa41('0x13'));var as=require(_0xfa41('0x14'));var hardwareService=require(_0xfa41('0x15'));var logger=require('../../config/logger')(_0xfa41('0x16'));var utils=require(_0xfa41('0x17'));var config=require(_0xfa41('0x18'));var db=require(_0xfa41('0x19'))['db'];function respondWithStatusCode(_0x490e41,_0x479bf6){_0x479bf6=_0x479bf6||0xcc;return function(_0x23ebe6){if(_0x23ebe6){return _0x490e41[_0xfa41('0x1a')](_0x479bf6);}return _0x490e41[_0xfa41('0x1b')](_0x479bf6)[_0xfa41('0x1c')]();};}function respondWithResult(_0x331403,_0x2ce7bb){_0x2ce7bb=_0x2ce7bb||0xc8;return function(_0x551cdb){if(_0x551cdb){return _0x331403['status'](_0x2ce7bb)[_0xfa41('0x1d')](_0x551cdb);}};}function respondWithFilteredResult(_0x51b4c8,_0x5bc665){return function(_0x49fe8e){if(_0x49fe8e){var _0x383cb1=_0x49fe8e[_0xfa41('0x1e')],_0x9e6a=_0x5bc665[_0xfa41('0x1f')],_0x5d286f=_0x5bc665[_0xfa41('0x1f')]+_0x5bc665[_0xfa41('0x20')],_0x37ae19;if(_0x5d286f>=_0x383cb1){_0x5d286f=_0x383cb1;_0x37ae19=0xc8;}else{_0x37ae19=0xce;}_0x51b4c8['status'](_0x37ae19);return _0x51b4c8[_0xfa41('0x21')](_0xfa41('0x22'),_0x9e6a+'-'+_0x5d286f+'/'+_0x383cb1)['json'](_0x49fe8e);}return null;};}function patchUpdates(_0x675b8d){return function(_0x5b4a5a){try{jsonpatch[_0xfa41('0x23')](_0x5b4a5a,_0x675b8d,!![]);}catch(_0x12a35c){return BPromise[_0xfa41('0x24')](_0x12a35c);}return _0x5b4a5a[_0xfa41('0x25')]();};}function saveUpdates(_0x59c8e6,_0x3e62a3){return function(_0x5e2f3a){if(_0x5e2f3a){return _0x5e2f3a['update'](_0x59c8e6)[_0xfa41('0x26')](function(_0x33897e){return _0x33897e;});}return null;};}function removeEntity(_0x344240,_0x146a0b){return function(_0x5362fe){if(_0x5362fe){return _0x5362fe[_0xfa41('0x27')]()[_0xfa41('0x26')](function(){_0x344240['status'](0xcc)[_0xfa41('0x1c')]();});}};}function handleEntityNotFound(_0x79fe8b,_0x3cc3c1){return function(_0x18df72){if(!_0x18df72){_0x79fe8b[_0xfa41('0x1a')](0x194);}return _0x18df72;};}function handleError(_0x15e7ba,_0x243307){_0x243307=_0x243307||0x1f4;return function(_0x24298a){logger['error'](_0x24298a[_0xfa41('0x28')]);if(_0x24298a[_0xfa41('0x29')]){delete _0x24298a['name'];}_0x15e7ba['status'](_0x243307)[_0xfa41('0x2a')](_0x24298a);};}exports[_0xfa41('0x2b')]=function(_0x4f099b,_0x483613){var _0x206187={},_0x21c099={},_0x33ec32={'count':0x0,'rows':[]};var _0x3f72e9=_[_0xfa41('0x2c')](db[_0xfa41('0x2d')][_0xfa41('0x2e')],function(_0x4eeb89){return{'name':_0x4eeb89[_0xfa41('0x2f')],'type':_0x4eeb89['type']['key']};});_0x21c099['model']=_['map'](_0x3f72e9,_0xfa41('0x29'));_0x21c099[_0xfa41('0x30')]=_[_0xfa41('0x31')](_0x4f099b['query']);_0x21c099['filters']=_[_0xfa41('0x32')](_0x21c099[_0xfa41('0x33')],_0x21c099[_0xfa41('0x30')]);_0x206187[_0xfa41('0x34')]=_[_0xfa41('0x32')](_0x21c099['model'],qs['fields'](_0x4f099b[_0xfa41('0x30')][_0xfa41('0x35')]));_0x206187[_0xfa41('0x34')]=_0x206187[_0xfa41('0x34')]['length']?_0x206187[_0xfa41('0x34')]:_0x21c099['model'];if(!_0x4f099b[_0xfa41('0x30')][_0xfa41('0x36')](_0xfa41('0x37'))){_0x206187[_0xfa41('0x20')]=qs[_0xfa41('0x20')](_0x4f099b[_0xfa41('0x30')][_0xfa41('0x20')]);_0x206187['offset']=qs[_0xfa41('0x1f')](_0x4f099b[_0xfa41('0x30')][_0xfa41('0x1f')]);}_0x206187['order']=qs[_0xfa41('0x38')](_0x4f099b['query'][_0xfa41('0x38')]);_0x206187[_0xfa41('0x39')]=qs[_0xfa41('0x3a')](_[_0xfa41('0x3b')](_0x4f099b[_0xfa41('0x30')],_0x21c099[_0xfa41('0x3a')]),_0x3f72e9);if(_0x4f099b[_0xfa41('0x30')][_0xfa41('0x3c')]){_0x206187['where']=_['merge'](_0x206187[_0xfa41('0x39')],{'$or':_[_0xfa41('0x2c')](_0x3f72e9,function(_0x4be15f){if(_0x4be15f['type']!=='VIRTUAL'){var _0x4939e5={};_0x4939e5[_0x4be15f[_0xfa41('0x29')]]={'$like':'%'+_0x4f099b[_0xfa41('0x30')][_0xfa41('0x3c')]+'%'};return _0x4939e5;}})});}_0x206187=_['merge']({},_0x206187,_0x4f099b['options']);var _0x1d655c={'where':_0x206187[_0xfa41('0x39')]};return db[_0xfa41('0x2d')]['count'](_0x1d655c)['then'](function(_0x26a713){_0x33ec32[_0xfa41('0x1e')]=_0x26a713;if(_0x4f099b[_0xfa41('0x30')]['includeAll']){_0x206187['include']=[{'all':!![]}];}return db[_0xfa41('0x2d')][_0xfa41('0x3d')](_0x206187);})[_0xfa41('0x26')](function(_0x4cc629){_0x33ec32[_0xfa41('0x3e')]=_0x4cc629;return _0x33ec32;})[_0xfa41('0x26')](respondWithFilteredResult(_0x483613,_0x206187))[_0xfa41('0x3f')](handleError(_0x483613,null));};exports[_0xfa41('0x40')]=function(_0x4e1625,_0x92fdde){var _0x2a7029={'raw':!![],'where':{'id':_0x4e1625['params']['id']}},_0xe927f4={};_0xe927f4['model']=_['keys'](db[_0xfa41('0x2d')][_0xfa41('0x2e')]);_0xe927f4[_0xfa41('0x30')]=_[_0xfa41('0x31')](_0x4e1625[_0xfa41('0x30')]);_0xe927f4['filters']=_['intersection'](_0xe927f4['model'],_0xe927f4[_0xfa41('0x30')]);_0x2a7029[_0xfa41('0x34')]=_['intersection'](_0xe927f4[_0xfa41('0x33')],qs[_0xfa41('0x35')](_0x4e1625[_0xfa41('0x30')][_0xfa41('0x35')]));_0x2a7029[_0xfa41('0x34')]=_0x2a7029[_0xfa41('0x34')][_0xfa41('0x41')]?_0x2a7029[_0xfa41('0x34')]:_0xe927f4[_0xfa41('0x33')];if(_0x4e1625['query'][_0xfa41('0x42')]){_0x2a7029[_0xfa41('0x43')]=[{'all':!![]}];}_0x2a7029=_[_0xfa41('0x44')]({},_0x2a7029,_0x4e1625[_0xfa41('0x45')]);return db['ChatTransferReport'][_0xfa41('0x46')](_0x2a7029)[_0xfa41('0x26')](handleEntityNotFound(_0x92fdde,null))[_0xfa41('0x26')](respondWithResult(_0x92fdde,null))[_0xfa41('0x3f')](handleError(_0x92fdde,null));};exports[_0xfa41('0x47')]=function(_0x5786be,_0x22b92e){return db[_0xfa41('0x2d')][_0xfa41('0x47')](_0x5786be[_0xfa41('0x48')],{})[_0xfa41('0x26')](respondWithResult(_0x22b92e,0xc9))[_0xfa41('0x3f')](handleError(_0x22b92e,null));};exports[_0xfa41('0x49')]=function(_0x3390fa,_0x48b4eb){if(_0x3390fa[_0xfa41('0x48')]['id']){delete _0x3390fa['body']['id'];}return db[_0xfa41('0x2d')]['find']({'where':{'id':_0x3390fa['params']['id']}})[_0xfa41('0x26')](handleEntityNotFound(_0x48b4eb,null))[_0xfa41('0x26')](saveUpdates(_0x3390fa[_0xfa41('0x48')],null))[_0xfa41('0x26')](respondWithResult(_0x48b4eb,null))[_0xfa41('0x3f')](handleError(_0x48b4eb,null));};exports[_0xfa41('0x27')]=function(_0x4d010d,_0x29715e){return db[_0xfa41('0x2d')][_0xfa41('0x46')]({'where':{'id':_0x4d010d[_0xfa41('0x4a')]['id']}})[_0xfa41('0x26')](handleEntityNotFound(_0x29715e,null))[_0xfa41('0x26')](removeEntity(_0x29715e,null))[_0xfa41('0x3f')](handleError(_0x29715e,null));};exports[_0xfa41('0x4b')]=function(_0x14b079,_0x3a6fee){return db['ChatTransferReport'][_0xfa41('0x4b')]()[_0xfa41('0x26')](respondWithResult(_0x3a6fee,null))[_0xfa41('0x3f')](handleError(_0x3a6fee,null));}; \ No newline at end of file +var _0xeee3=['show','params','options','find','create','catch','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','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','Content-Range','apply','update','then','destroy','stack','name','send','index','ChatTransferReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include'];(function(_0x48815b,_0x6d3fd7){var _0x2ebfe6=function(_0x347c24){while(--_0x347c24){_0x48815b['push'](_0x48815b['shift']());}};_0x2ebfe6(++_0x6d3fd7);}(_0xeee3,0x96));var _0x3eee=function(_0x14529e,_0x16e8d0){_0x14529e=_0x14529e-0x0;var _0x45997a=_0xeee3[_0x14529e];return _0x45997a;};'use strict';var pdf=require(_0x3eee('0x0'));var emlformat=require(_0x3eee('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3eee('0x2'));var jsonpatch=require(_0x3eee('0x3'));var rp=require(_0x3eee('0x4'));var moment=require(_0x3eee('0x5'));var BPromise=require(_0x3eee('0x6'));var Mustache=require('mustache');var util=require(_0x3eee('0x7'));var path=require('path');var sox=require(_0x3eee('0x8'));var csv=require('to-csv');var ejs=require(_0x3eee('0x9'));var fs=require('fs');var _=require(_0x3eee('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3eee('0xb'));var deskjs=require(_0x3eee('0xc'));var toCsv=require(_0x3eee('0xd'));var querystring=require(_0x3eee('0xe'));var Papa=require('papaparse');var Redis=require(_0x3eee('0xf'));var authService=require(_0x3eee('0x10'));var qs=require(_0x3eee('0x11'));var as=require(_0x3eee('0x12'));var hardwareService=require(_0x3eee('0x13'));var logger=require('../../config/logger')(_0x3eee('0x14'));var utils=require(_0x3eee('0x15'));var config=require(_0x3eee('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29a75d,_0x145d22){_0x145d22=_0x145d22||0xcc;return function(_0x5830eb){if(_0x5830eb){return _0x29a75d[_0x3eee('0x17')](_0x145d22);}return _0x29a75d[_0x3eee('0x18')](_0x145d22)[_0x3eee('0x19')]();};}function respondWithResult(_0x3d2af8,_0x5d1d91){_0x5d1d91=_0x5d1d91||0xc8;return function(_0x26e699){if(_0x26e699){return _0x3d2af8[_0x3eee('0x18')](_0x5d1d91)[_0x3eee('0x1a')](_0x26e699);}};}function respondWithFilteredResult(_0x139a79,_0x5dda35){return function(_0x208f79){if(_0x208f79){var _0x13f481=_0x208f79[_0x3eee('0x1b')],_0x8e1d4a=_0x5dda35['offset'],_0x3718b7=_0x5dda35[_0x3eee('0x1c')]+_0x5dda35[_0x3eee('0x1d')],_0x151028;if(_0x3718b7>=_0x13f481){_0x3718b7=_0x13f481;_0x151028=0xc8;}else{_0x151028=0xce;}_0x139a79[_0x3eee('0x18')](_0x151028);return _0x139a79[_0x3eee('0x1e')](_0x3eee('0x1f'),_0x8e1d4a+'-'+_0x3718b7+'/'+_0x13f481)[_0x3eee('0x1a')](_0x208f79);}return null;};}function patchUpdates(_0x2f89be){return function(_0x456a3c){try{jsonpatch[_0x3eee('0x20')](_0x456a3c,_0x2f89be,!![]);}catch(_0x4178e2){return BPromise['reject'](_0x4178e2);}return _0x456a3c['save']();};}function saveUpdates(_0x20a361,_0x5dbb79){return function(_0x40afd2){if(_0x40afd2){return _0x40afd2[_0x3eee('0x21')](_0x20a361)[_0x3eee('0x22')](function(_0x2171c5){return _0x2171c5;});}return null;};}function removeEntity(_0x27aa0e,_0x360c7a){return function(_0x2237fb){if(_0x2237fb){return _0x2237fb[_0x3eee('0x23')]()[_0x3eee('0x22')](function(){_0x27aa0e[_0x3eee('0x18')](0xcc)[_0x3eee('0x19')]();});}};}function handleEntityNotFound(_0x5e3dbf,_0x532d34){return function(_0x4f28d9){if(!_0x4f28d9){_0x5e3dbf[_0x3eee('0x17')](0x194);}return _0x4f28d9;};}function handleError(_0x560cd8,_0x3a0e78){_0x3a0e78=_0x3a0e78||0x1f4;return function(_0x1cb512){logger['error'](_0x1cb512[_0x3eee('0x24')]);if(_0x1cb512[_0x3eee('0x25')]){delete _0x1cb512[_0x3eee('0x25')];}_0x560cd8['status'](_0x3a0e78)[_0x3eee('0x26')](_0x1cb512);};}exports[_0x3eee('0x27')]=function(_0x3aeebd,_0x4a2745){var _0x24e26a={},_0x450c07={},_0x3ca6b2={'count':0x0,'rows':[]};var _0x47e496=_['map'](db[_0x3eee('0x28')][_0x3eee('0x29')],function(_0x5c368b){return{'name':_0x5c368b['fieldName'],'type':_0x5c368b[_0x3eee('0x2a')][_0x3eee('0x2b')]};});_0x450c07[_0x3eee('0x2c')]=_[_0x3eee('0x2d')](_0x47e496,_0x3eee('0x25'));_0x450c07[_0x3eee('0x2e')]=_[_0x3eee('0x2f')](_0x3aeebd['query']);_0x450c07[_0x3eee('0x30')]=_[_0x3eee('0x31')](_0x450c07['model'],_0x450c07[_0x3eee('0x2e')]);_0x24e26a[_0x3eee('0x32')]=_['intersection'](_0x450c07[_0x3eee('0x2c')],qs[_0x3eee('0x33')](_0x3aeebd[_0x3eee('0x2e')][_0x3eee('0x33')]));_0x24e26a['attributes']=_0x24e26a[_0x3eee('0x32')][_0x3eee('0x34')]?_0x24e26a[_0x3eee('0x32')]:_0x450c07['model'];if(!_0x3aeebd[_0x3eee('0x2e')][_0x3eee('0x35')]('nolimit')){_0x24e26a['limit']=qs['limit'](_0x3aeebd['query'][_0x3eee('0x1d')]);_0x24e26a[_0x3eee('0x1c')]=qs['offset'](_0x3aeebd[_0x3eee('0x2e')]['offset']);}_0x24e26a[_0x3eee('0x36')]=qs[_0x3eee('0x37')](_0x3aeebd[_0x3eee('0x2e')]['sort']);_0x24e26a[_0x3eee('0x38')]=qs['filters'](_[_0x3eee('0x39')](_0x3aeebd[_0x3eee('0x2e')],_0x450c07['filters']),_0x47e496);if(_0x3aeebd[_0x3eee('0x2e')][_0x3eee('0x3a')]){_0x24e26a[_0x3eee('0x38')]=_[_0x3eee('0x3b')](_0x24e26a[_0x3eee('0x38')],{'$or':_[_0x3eee('0x2d')](_0x47e496,function(_0x28fb34){if(_0x28fb34[_0x3eee('0x2a')]!==_0x3eee('0x3c')){var _0x491bc1={};_0x491bc1[_0x28fb34[_0x3eee('0x25')]]={'$like':'%'+_0x3aeebd[_0x3eee('0x2e')][_0x3eee('0x3a')]+'%'};return _0x491bc1;}})});}_0x24e26a=_[_0x3eee('0x3b')]({},_0x24e26a,_0x3aeebd['options']);var _0x67d242={'where':_0x24e26a[_0x3eee('0x38')]};return db[_0x3eee('0x28')][_0x3eee('0x1b')](_0x67d242)['then'](function(_0x4a9cf7){_0x3ca6b2['count']=_0x4a9cf7;if(_0x3aeebd[_0x3eee('0x2e')][_0x3eee('0x3d')]){_0x24e26a[_0x3eee('0x3e')]=[{'all':!![]}];}return db[_0x3eee('0x28')]['findAll'](_0x24e26a);})[_0x3eee('0x22')](function(_0x133f79){_0x3ca6b2['rows']=_0x133f79;return _0x3ca6b2;})[_0x3eee('0x22')](respondWithFilteredResult(_0x4a2745,_0x24e26a))['catch'](handleError(_0x4a2745,null));};exports[_0x3eee('0x3f')]=function(_0x3efb52,_0x5d9606){var _0x4ca00a={'raw':!![],'where':{'id':_0x3efb52[_0x3eee('0x40')]['id']}},_0x5a3927={};_0x5a3927[_0x3eee('0x2c')]=_[_0x3eee('0x2f')](db['ChatTransferReport'][_0x3eee('0x29')]);_0x5a3927[_0x3eee('0x2e')]=_[_0x3eee('0x2f')](_0x3efb52['query']);_0x5a3927['filters']=_['intersection'](_0x5a3927[_0x3eee('0x2c')],_0x5a3927[_0x3eee('0x2e')]);_0x4ca00a[_0x3eee('0x32')]=_[_0x3eee('0x31')](_0x5a3927[_0x3eee('0x2c')],qs[_0x3eee('0x33')](_0x3efb52['query'][_0x3eee('0x33')]));_0x4ca00a[_0x3eee('0x32')]=_0x4ca00a[_0x3eee('0x32')][_0x3eee('0x34')]?_0x4ca00a[_0x3eee('0x32')]:_0x5a3927['model'];if(_0x3efb52[_0x3eee('0x2e')][_0x3eee('0x3d')]){_0x4ca00a[_0x3eee('0x3e')]=[{'all':!![]}];}_0x4ca00a=_['merge']({},_0x4ca00a,_0x3efb52[_0x3eee('0x41')]);return db['ChatTransferReport'][_0x3eee('0x42')](_0x4ca00a)['then'](handleEntityNotFound(_0x5d9606,null))[_0x3eee('0x22')](respondWithResult(_0x5d9606,null))['catch'](handleError(_0x5d9606,null));};exports[_0x3eee('0x43')]=function(_0x1d51f5,_0x880c6b){return db[_0x3eee('0x28')][_0x3eee('0x43')](_0x1d51f5['body'],{})[_0x3eee('0x22')](respondWithResult(_0x880c6b,0xc9))[_0x3eee('0x44')](handleError(_0x880c6b,null));};exports[_0x3eee('0x21')]=function(_0x265028,_0x355aad){if(_0x265028['body']['id']){delete _0x265028[_0x3eee('0x45')]['id'];}return db[_0x3eee('0x28')]['find']({'where':{'id':_0x265028[_0x3eee('0x40')]['id']}})[_0x3eee('0x22')](handleEntityNotFound(_0x355aad,null))['then'](saveUpdates(_0x265028[_0x3eee('0x45')],null))[_0x3eee('0x22')](respondWithResult(_0x355aad,null))[_0x3eee('0x44')](handleError(_0x355aad,null));};exports['destroy']=function(_0x5e0714,_0x1c45d5){return db['ChatTransferReport'][_0x3eee('0x42')]({'where':{'id':_0x5e0714[_0x3eee('0x40')]['id']}})['then'](handleEntityNotFound(_0x1c45d5,null))[_0x3eee('0x22')](removeEntity(_0x1c45d5,null))[_0x3eee('0x44')](handleError(_0x1c45d5,null));};exports['describe']=function(_0x558256,_0x150c23){return db[_0x3eee('0x28')][_0x3eee('0x46')]()[_0x3eee('0x22')](respondWithResult(_0x150c23,null))[_0x3eee('0x44')](handleError(_0x150c23,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index d2e8d09..d928f4f 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 _0x7217=['api','moment','bluebird','request-promise','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','../../config/logger'];(function(_0x1b54f5,_0x83ee6a){var _0x3b9975=function(_0x20762a){while(--_0x20762a){_0x1b54f5['push'](_0x1b54f5['shift']());}};_0x3b9975(++_0x83ee6a);}(_0x7217,0x19e));var _0x7721=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x7217[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[{'name':_0x7721('0xc'),'fields':[_0x7721('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['../../config/logger','api','moment','path','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x3e74,0x175));var _0x43e7=function(_0x302da3,_0x158a2d){_0x302da3=_0x302da3-0x0;var _0x26a50e=_0x3e74[_0x302da3];return _0x26a50e;};'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':[{'name':_0x43e7('0xa'),'fields':[_0x43e7('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index ccb7074..59b0725 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 _0x166f=['info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x290edb,_0x1f22ac){var _0x3fba62=function(_0x134bb5){while(--_0x134bb5){_0x290edb['push'](_0x290edb['shift']());}};_0x3fba62(++_0x1f22ac);}(_0x166f,0xe6));var _0xf166=function(_0x10c4af,_0x3b1dc6){_0x10c4af=_0x10c4af-0x0;var _0x40e0dd=_0x166f[_0x10c4af];return _0x40e0dd;};'use strict';var _=require(_0xf166('0x0'));var util=require(_0xf166('0x1'));var moment=require(_0xf166('0x2'));var BPromise=require(_0xf166('0x3'));var rs=require(_0xf166('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf166('0x5'))['db'];var utils=require(_0xf166('0x6'));var logger=require('../../config/logger')(_0xf166('0x7'));var config=require(_0xf166('0x8'));var jayson=require(_0xf166('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3eb9f8,_0x199f6a,_0x29d5d5){return new BPromise(function(_0x2bbd14,_0x50fc0d){return client[_0xf166('0xa')](_0x3eb9f8,_0x29d5d5)[_0xf166('0xb')](function(_0xb7ef00){logger[_0xf166('0xc')](_0xf166('0xd'),_0x199f6a,_0xf166('0xe'));logger[_0xf166('0xf')](_0xf166('0x10'),_0x199f6a,_0xf166('0xe'),JSON['stringify'](_0xb7ef00));if(_0xb7ef00[_0xf166('0x11')]){if(_0xb7ef00[_0xf166('0x11')][_0xf166('0x12')]===0x1f4){logger[_0xf166('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x199f6a,_0xb7ef00['error']['message']);return _0x50fc0d(_0xb7ef00[_0xf166('0x11')]['message']);}logger[_0xf166('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x199f6a,_0xb7ef00[_0xf166('0x11')][_0xf166('0x13')]);return _0x2bbd14(_0xb7ef00[_0xf166('0x11')][_0xf166('0x13')]);}else{logger[_0xf166('0xc')](_0xf166('0xd'),_0x199f6a,_0xf166('0xe'));_0x2bbd14(_0xb7ef00[_0xf166('0x14')][_0xf166('0x13')]);}})[_0xf166('0x15')](function(_0x20719e){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x199f6a,_0x20719e);_0x50fc0d(_0x20719e);});});} \ No newline at end of file +var _0x2deb=['ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x2deb,0xdb));var _0xb2de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2deb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb2de('0x0'));var util=require(_0xb2de('0x1'));var moment=require(_0xb2de('0x2'));var BPromise=require(_0xb2de('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2de('0x4'))['db'];var utils=require(_0xb2de('0x5'));var logger=require(_0xb2de('0x6'))(_0xb2de('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb2de('0x8')][_0xb2de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x191004,_0x49307b,_0x253d0b){return new BPromise(function(_0x1a4c44,_0x53ab0e){return client[_0xb2de('0xa')](_0x191004,_0x253d0b)[_0xb2de('0xb')](function(_0x1d40ec){logger['info'](_0xb2de('0xc'),_0x49307b,_0xb2de('0xd'));logger[_0xb2de('0xe')](_0xb2de('0xf'),_0x49307b,'request\x20sent',JSON['stringify'](_0x1d40ec));if(_0x1d40ec[_0xb2de('0x10')]){if(_0x1d40ec[_0xb2de('0x10')][_0xb2de('0x11')]===0x1f4){logger['error'](_0xb2de('0xc'),_0x49307b,_0x1d40ec[_0xb2de('0x10')][_0xb2de('0x12')]);return _0x53ab0e(_0x1d40ec['error'][_0xb2de('0x12')]);}logger['error'](_0xb2de('0xc'),_0x49307b,_0x1d40ec['error'][_0xb2de('0x12')]);return _0x1a4c44(_0x1d40ec[_0xb2de('0x10')][_0xb2de('0x12')]);}else{logger['info'](_0xb2de('0xc'),_0x49307b,_0xb2de('0xd'));_0x1a4c44(_0x1d40ec[_0xb2de('0x13')][_0xb2de('0x12')]);}})[_0xb2de('0x14')](function(_0x2dc15c){logger[_0xb2de('0x10')](_0xb2de('0xc'),_0x49307b,_0x2dc15c);_0x53ab0e(_0x2dc15c);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 818c203..23e71c8 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 _0xbaf0=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','util','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0b0e=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','delete','exports'];(function(_0x51f9da,_0xddda35){var _0x9dc5b0=function(_0x3dd83c){while(--_0x3dd83c){_0x51f9da['push'](_0x51f9da['shift']());}};_0x9dc5b0(++_0xddda35);}(_0x0b0e,0x187));var _0xe0b0=function(_0x126f47,_0x2199e9){_0x126f47=_0x126f47-0x0;var _0x49508a=_0x0b0e[_0x126f47];return _0x49508a;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['post']('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['update']);router[_0xe0b0('0xf')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['destroy']);module[_0xe0b0('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 9c60db4..4a5b470 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 _0x528f=['New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','address','email','Agent','#011F6A','INTEGER','BOOLEAN','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Feedback','ENUM','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','textarea','Comments','offlineForm','setDataValue','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'];(function(_0x4c1e92,_0x493f10){var _0x3083d4=function(_0x4cae37){while(--_0x4cae37){_0x4c1e92['push'](_0x4c1e92['shift']());}};_0x3083d4(++_0x493f10);}(_0x528f,0x140));var _0xf528=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x528f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xf528('0x0'));module[_0xf528('0x1')]={'name':{'type':Sequelize[_0xf528('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xf528('0x2')],'allowNull':![],'unique':_0xf528('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xf528('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xf528('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xf528('0x2')],'defaultValue':_0xf528('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xf528('0x2')],'allowNull':![],'defaultValue':_0xf528('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xf528('0x2')],'allowNull':![],'defaultValue':_0xf528('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xf528('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xf528('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0xf528('0x9')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xf528('0x2')],'defaultValue':_0xf528('0xa')},'start_chat_button':{'type':Sequelize[_0xf528('0x2')],'defaultValue':_0xf528('0xb')},'offline_chat_button':{'type':Sequelize[_0xf528('0x2')],'defaultValue':_0xf528('0xc')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xf528('0xd')},'download_transcript':{'type':Sequelize[_0xf528('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xf528('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xf528('0x2')],'defaultValue':_0xf528('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0xf528('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xf528('0xf')]},'closingQuestion':{'type':Sequelize[_0xf528('0x2')],'defaultValue':_0xf528('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xf528('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xf528('0x2')],'defaultValue':_0xf528('0x11')},'noteTitle':{'type':Sequelize[_0xf528('0x2')],'defaultValue':_0xf528('0x12')},'placeholderMessage':{'type':Sequelize[_0xf528('0x2')],'defaultValue':_0xf528('0x13')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xf528('0x2')],'defaultValue':_0xf528('0xc')},'skipMessageButton':{'type':Sequelize[_0xf528('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xf528('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xf528('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xf528('0x2')],'defaultValue':_0xf528('0x14')},'ratingType':{'type':Sequelize[_0xf528('0x15')](_0xf528('0x16'),_0xf528('0x17')),'defaultValue':_0xf528('0x16')},'ratingStarsNumber':{'type':Sequelize[_0xf528('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xf528('0x18')]({'items':[{'type':_0xf528('0x19'),'variable':null,'config':{'placeholder':_0xf528('0x1a'),'type':_0xf528('0x1b'),'required':!![]},'props':{'title':_0xf528('0x1a'),'helpText':''}},{'type':_0xf528('0x19'),'props':{'title':_0xf528('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xf528('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xf528('0x1c')](_0xf528('0x1d'))?JSON[_0xf528('0x1e')](this[_0xf528('0x1c')](_0xf528('0x1d'))):{};},'set':function(_0x3596ce){return this['setDataValue'](_0xf528('0x1d'),JSON[_0xf528('0x18')](_0x3596ce));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xf528('0x18')]({'items':[{'type':_0xf528('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xf528('0x4'),'type':'email'},'variable':null},{'type':_0xf528('0x1f'),'config':{'placeholder':_0xf528('0x20')},'props':{'title':_0xf528('0x20'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xf528('0x21'))?JSON[_0xf528('0x1e')](this[_0xf528('0x1c')](_0xf528('0x21'))):{};},'set':function(_0xbeaa21){return this[_0xf528('0x22')](_0xf528('0x21'),JSON[_0xf528('0x18')](_0xbeaa21));}},'token':{'type':Sequelize[_0xf528('0x2')],'defaultValue':function(){return rs[_0xf528('0x23')]();}},'autoclose':{'type':Sequelize[_0xf528('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xf528('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xf528('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xf528('0x2')]},'forwardOffline':{'type':Sequelize[_0xf528('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xf528('0x2')]},'waitingTitle':{'type':Sequelize[_0xf528('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xf528('0x2')],'defaultValue':_0xf528('0x24')},'offlineMessageSubject':{'type':Sequelize[_0xf528('0x2')],'defaultValue':_0xf528('0x25')},'offlineMessageBody':{'type':Sequelize[_0xf528('0x2')],'defaultValue':_0xf528('0x26')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xf528('0x27')},'skipUnmanaged':{'type':Sequelize[_0xf528('0x2')],'defaultValue':_0xf528('0x28')},'sendUnmanaged':{'type':Sequelize[_0xf528('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xf528('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xf528('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xf528('0xf')]},'showAgentAvatar':{'type':Sequelize[_0xf528('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xf528('0x2')]},'notificationTemplate':{'type':Sequelize[_0xf528('0xf')],'defaultValue':function(){return _0xf528('0x29');}},'notificationSound':{'type':Sequelize[_0xf528('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xf528('0x2')],'defaultValue':_0xf528('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0xf528('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xf528('0x2')],'defaultValue':_0xf528('0x2b')},'verticalAlignment':{'type':Sequelize[_0xf528('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xf528('0x2')],'defaultValue':_0xf528('0x2c')},'defaultTitle':{'type':Sequelize[_0xf528('0x2')]},'customerAvatar':{'type':Sequelize[_0xf528('0xf')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xf528('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf528('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xf528('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf528('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf528('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xf528('0x2')],'defaultValue':_0xf528('0x2e')},'systemAvatar':{'type':Sequelize[_0xf528('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xf528('0x2f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf528('0x30'),'set':function(_0x104012){if(!_0x104012)this[_0xf528('0x22')](_0xf528('0x31'),null);this['setDataValue'](_0xf528('0x32'),_0x104012);}},'vidaooEscalation':{'type':Sequelize[_0xf528('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xf528('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x9a14=['exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','ENUM','rounded','squared','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','BOOLEAN','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','star','input','name','text','getDataValue','onlineForm','setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring'];(function(_0x2fda4d,_0x1a3f7a){var _0x1b6ce7=function(_0x3f7892){while(--_0x3f7892){_0x2fda4d['push'](_0x2fda4d['shift']());}};_0x1b6ce7(++_0x1a3f7a);}(_0x9a14,0x1d3));var _0x49a1=function(_0xc7ffb6,_0x42b6e5){_0xc7ffb6=_0xc7ffb6-0x0;var _0x51fb3e=_0x9a14[_0xc7ffb6];return _0x51fb3e;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x49a1('0x0'));module[_0x49a1('0x1')]={'name':{'type':Sequelize[_0x49a1('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x49a1('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x49a1('0x2')],'defaultValue':_0x49a1('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x49a1('0x2')],'defaultValue':_0x49a1('0x5')},'customerAlias':{'type':Sequelize[_0x49a1('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x49a1('0x2')],'allowNull':![],'defaultValue':_0x49a1('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x49a1('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x49a1('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x49a1('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x49a1('0x9')](_0x49a1('0xa'),_0x49a1('0xb')),'defaultValue':_0x49a1('0xa')},'header_online':{'type':Sequelize[_0x49a1('0x2')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x49a1('0xc')},'offline_chat_button':{'type':Sequelize[_0x49a1('0x2')],'defaultValue':_0x49a1('0xd')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x49a1('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x49a1('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x49a1('0x2')],'defaultValue':_0x49a1('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x49a1('0x10')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x49a1('0x11')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x49a1('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x49a1('0x2')],'defaultValue':_0x49a1('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0x49a1('0x2')],'defaultValue':_0x49a1('0x14')},'noteTitle':{'type':Sequelize[_0x49a1('0x2')],'defaultValue':_0x49a1('0x15')},'placeholderMessage':{'type':Sequelize[_0x49a1('0x2')],'defaultValue':_0x49a1('0x16')},'closingMessage':{'type':Sequelize[_0x49a1('0x2')],'defaultValue':_0x49a1('0x17')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x49a1('0x2')],'defaultValue':_0x49a1('0x18')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x49a1('0x10')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x49a1('0x10')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x49a1('0x10')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x49a1('0x2')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x49a1('0x9')]('star','thumb'),'defaultValue':_0x49a1('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x49a1('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x49a1('0x1a'),'variable':null,'config':{'placeholder':_0x49a1('0x1b'),'type':_0x49a1('0x1c'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x49a1('0x1a'),'props':{'title':_0x49a1('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x49a1('0x4'),'type':_0x49a1('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x49a1('0x1d')](_0x49a1('0x1e'))?JSON['parse'](this['getDataValue'](_0x49a1('0x1e'))):{};},'set':function(_0x3f325){return this[_0x49a1('0x1f')]('onlineForm',JSON['stringify'](_0x3f325));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x49a1('0x20')]({'items':[{'type':_0x49a1('0x1a'),'props':{'title':_0x49a1('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x49a1('0x4')},'variable':null},{'type':_0x49a1('0x21'),'config':{'placeholder':_0x49a1('0x22')},'props':{'title':_0x49a1('0x22'),'helpText':_0x49a1('0x23')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x49a1('0x24'))?JSON[_0x49a1('0x25')](this[_0x49a1('0x1d')](_0x49a1('0x24'))):{};},'set':function(_0x58f225){return this['setDataValue'](_0x49a1('0x24'),JSON[_0x49a1('0x20')](_0x58f225));}},'token':{'type':Sequelize[_0x49a1('0x2')],'defaultValue':function(){return rs[_0x49a1('0x26')]();}},'autoclose':{'type':Sequelize[_0x49a1('0x10')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x49a1('0x10')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x49a1('0x10')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x49a1('0x2')],'defaultValue':_0x49a1('0x27')},'waitingMessage':{'type':Sequelize[_0x49a1('0x2')],'defaultValue':_0x49a1('0x28')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x49a1('0x2')],'defaultValue':_0x49a1('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0x49a1('0x10')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x49a1('0x2')],'defaultValue':_0x49a1('0x2a')},'skipUnmanaged':{'type':Sequelize[_0x49a1('0x2')],'defaultValue':_0x49a1('0x18')},'sendUnmanaged':{'type':Sequelize[_0x49a1('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x49a1('0x10')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x49a1('0x11')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x49a1('0x11')],'defaultValue':function(){return _0x49a1('0x2b');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x49a1('0x10')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x49a1('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x49a1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x49a1('0x2')],'defaultValue':_0x49a1('0x2c')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x49a1('0x2d')},'defaultTitle':{'type':Sequelize[_0x49a1('0x2')]},'customerAvatar':{'type':Sequelize[_0x49a1('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x49a1('0x10')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x49a1('0x2')],'allowNull':![],'defaultValue':_0x49a1('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x49a1('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x49a1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x49a1('0x2')],'defaultValue':_0x49a1('0x2f')},'systemAvatar':{'type':Sequelize[_0x49a1('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x49a1('0x8')],'comment':_0x49a1('0x30')},'mandatoryDisposition':{'type':Sequelize[_0x49a1('0x10')],'defaultValue':![],'comment':_0x49a1('0x31'),'set':function(_0x233abc){if(!_0x233abc)this['setDataValue'](_0x49a1('0x32'),null);this[_0x49a1('0x1f')](_0x49a1('0x33'),_0x233abc);}},'vidaooEscalation':{'type':Sequelize[_0x49a1('0x10')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 4fbe516..8d8f56b 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 _0xcf58=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','body','describe','Disposition','findOne','hasOwnProperty','pick','removeDispositions','ids','addAnswer','ChatWebsiteId','CannedAnswer','getAnswers','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','sitepic','../../config/license/util','getLicense','custom','isNil','existsSync','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','headers','user-agent','getResult','chat','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','asc','ListId','contact','customerIp','first','x-forwarded-for','lastName','x-real-port','referer','browser','version','unknown','format','%s\x20%s','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','firstName','messageId','created','autoclose','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','CompanyId','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','spread','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','auth','pass','SendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','getInteractions','fullname','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','interval','inspect','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','push','all','some','readFileSync','server/files/chat/iframe.js','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','addApplications','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Contact','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','http','client','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','get','ChatWebsites','UserProfileResource','sendStatus','stack','name','send','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','model','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','Pause','keys','find','create'];(function(_0xc2e46e,_0x3b979c){var _0x1a355d=function(_0x2cd000){while(--_0x2cd000){_0xc2e46e['push'](_0xc2e46e['shift']());}};_0x1a355d(++_0x3b979c);}(_0xcf58,0xc3));var _0x8cf5=function(_0x2e2f10,_0x14948c){_0x2e2f10=_0x2e2f10-0x0;var _0x2727cb=_0xcf58[_0x2e2f10];return _0x2727cb;};'use strict';var pdf=require(_0x8cf5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8cf5('0x1'));var zipdir=require(_0x8cf5('0x2'));var jsonpatch=require(_0x8cf5('0x3'));var rp=require(_0x8cf5('0x4'));var moment=require(_0x8cf5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8cf5('0x6'));var util=require(_0x8cf5('0x7'));var path=require(_0x8cf5('0x8'));var sox=require(_0x8cf5('0x9'));var csv=require('to-csv');var ejs=require(_0x8cf5('0xa'));var fs=require('fs');var _=require(_0x8cf5('0xb'));var squel=require('squel');var crypto=require(_0x8cf5('0xc'));var jsforce=require(_0x8cf5('0xd'));var deskjs=require(_0x8cf5('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8cf5('0xf'));var Papa=require(_0x8cf5('0x10'));var Redis=require(_0x8cf5('0x11'));var authService=require(_0x8cf5('0x12'));var qs=require(_0x8cf5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8cf5('0x14'));var logger=require(_0x8cf5('0x15'))(_0x8cf5('0x16'));var utils=require(_0x8cf5('0x17'));var config=require(_0x8cf5('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8cf5('0x19')](config[_0x8cf5('0x1a')],{'host':_0x8cf5('0x1b'),'port':0x18eb});var socket=require(_0x8cf5('0x1c'))(new Redis(config[_0x8cf5('0x1a')]));require(_0x8cf5('0x1d'))[_0x8cf5('0x1e')](socket);var jayson=require(_0x8cf5('0x1f'));var client=jayson['client'][_0x8cf5('0x20')]({'port':0x232c});var client9002=jayson[_0x8cf5('0x21')][_0x8cf5('0x20')]({'port':0x232a});var client9003=jayson[_0x8cf5('0x21')][_0x8cf5('0x20')]({'port':0x232b});function checkPasswordPattern(_0x593ede,_0x464b4d,_0x25b37b){if(_0x25b37b){var _0x1fc764=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1fc764['test'](_0x464b4d)){return _0x593ede;}else{throw new db[(_0x8cf5('0x22'))]['ValidationError'](_0x8cf5('0x23'));}}else{return _0x593ede;}}function respondWithRpcPromise(_0x3d7b86,_0x5e3fc4,_0x301246,_0x54f18c){return new BPromise(function(_0x3b7d17,_0x57b7c4){var _0x1e5d32=_0x54f18c||client;return _0x1e5d32[_0x8cf5('0x24')](_0x3d7b86,_0x301246)[_0x8cf5('0x25')](function(_0x511e4e){logger[_0x8cf5('0x26')](_0x8cf5('0x27'),_0x5e3fc4,'request\x20sent');logger[_0x8cf5('0x28')](_0x8cf5('0x29'),_0x5e3fc4,'request\x20sent',JSON[_0x8cf5('0x2a')](_0x511e4e));if(_0x511e4e[_0x8cf5('0x2b')]){if(_0x511e4e['error'][_0x8cf5('0x2c')]===0x1f4){logger[_0x8cf5('0x2b')](_0x8cf5('0x27'),_0x5e3fc4,_0x511e4e[_0x8cf5('0x2b')][_0x8cf5('0x2d')]);return _0x57b7c4(_0x511e4e['error']['message']);}logger[_0x8cf5('0x2b')]('ChatWebsite,\x20%s,\x20%s',_0x5e3fc4,_0x511e4e[_0x8cf5('0x2b')][_0x8cf5('0x2d')]);return _0x3b7d17(_0x511e4e[_0x8cf5('0x2b')][_0x8cf5('0x2d')]);}else{logger['info'](_0x8cf5('0x27'),_0x5e3fc4,_0x8cf5('0x2e'));_0x3b7d17(_0x511e4e['result'][_0x8cf5('0x2d')]);}})[_0x8cf5('0x2f')](function(_0x408738){logger['error'](_0x8cf5('0x27'),_0x5e3fc4,_0x408738);_0x57b7c4(_0x408738);});});}function respondWithStatusCode(_0x29afc7,_0x43a982){_0x43a982=_0x43a982||0xcc;return function(_0x9f3b9c){if(_0x9f3b9c){return _0x29afc7['sendStatus'](_0x43a982);}return _0x29afc7[_0x8cf5('0x30')](_0x43a982)[_0x8cf5('0x31')]();};}function respondWithResult(_0x283f80,_0x234fd2){_0x234fd2=_0x234fd2||0xc8;return function(_0x41cc19){if(_0x41cc19){return _0x283f80[_0x8cf5('0x30')](_0x234fd2)[_0x8cf5('0x32')](_0x41cc19);}};}function respondWithFilteredResult(_0x46b2d7,_0x1016eb){return function(_0x8500cc){if(_0x8500cc){var _0x5c23b8=_0x8500cc[_0x8cf5('0x33')],_0x3a79e7=_0x1016eb[_0x8cf5('0x34')],_0x246fe7=_0x1016eb[_0x8cf5('0x34')]+_0x1016eb[_0x8cf5('0x35')],_0x1a66b2;if(_0x246fe7>=_0x5c23b8){_0x246fe7=_0x5c23b8;_0x1a66b2=0xc8;}else{_0x1a66b2=0xce;}_0x46b2d7['status'](_0x1a66b2);return _0x46b2d7[_0x8cf5('0x36')](_0x8cf5('0x37'),_0x3a79e7+'-'+_0x246fe7+'/'+_0x5c23b8)[_0x8cf5('0x32')](_0x8500cc);}return null;};}function patchUpdates(_0x4f3476){return function(_0x21c954){try{jsonpatch[_0x8cf5('0x38')](_0x21c954,_0x4f3476,!![]);}catch(_0x57a002){return BPromise['reject'](_0x57a002);}return _0x21c954[_0x8cf5('0x39')]();};}function saveUpdates(_0x6c5e9f,_0x240f7d){return function(_0x4648bb){if(_0x4648bb){return _0x4648bb[_0x8cf5('0x3a')](_0x6c5e9f)[_0x8cf5('0x25')](function(_0x368e8c){return _0x368e8c;});}return null;};}function removeEntity(_0x3b0213,_0xe99fc0){return function(_0x4d15ac){if(_0x4d15ac){return _0x4d15ac[_0x8cf5('0x3b')]()[_0x8cf5('0x25')](function(){var _0x16211c=_0x4d15ac[_0x8cf5('0x3c')]({'plain':!![]});var _0x3489bf=_0x8cf5('0x3d');return db[_0x8cf5('0x3e')][_0x8cf5('0x3b')]({'where':{'type':_0x3489bf,'resourceId':_0x16211c['id']}})[_0x8cf5('0x25')](function(){return _0x4d15ac;});})['then'](function(){_0x3b0213[_0x8cf5('0x30')](0xcc)[_0x8cf5('0x31')]();});}};}function handleEntityNotFound(_0x233bbc,_0x4367f2){return function(_0x3f6be4){if(!_0x3f6be4){_0x233bbc[_0x8cf5('0x3f')](0x194);}return _0x3f6be4;};}function handleError(_0x3fcce8,_0x590721){_0x590721=_0x590721||0x1f4;return function(_0x2cea08){logger[_0x8cf5('0x2b')](_0x2cea08[_0x8cf5('0x40')]);if(_0x2cea08[_0x8cf5('0x41')]){delete _0x2cea08[_0x8cf5('0x41')];}_0x3fcce8[_0x8cf5('0x30')](_0x590721)[_0x8cf5('0x42')](_0x2cea08);};}exports[_0x8cf5('0x43')]=function(_0x22d911,_0x4c6424){var _0x24f2c8={'include':[{'model':db['Pause'],'as':_0x8cf5('0x44')}]},_0x5b420f={},_0x54ae32={'count':0x0,'rows':[]};var _0x205703=_[_0x8cf5('0x45')](db[_0x8cf5('0x46')][_0x8cf5('0x47')],function(_0x1915af){return{'name':_0x1915af[_0x8cf5('0x48')],'type':_0x1915af[_0x8cf5('0x49')][_0x8cf5('0x4a')]};});_0x5b420f['model']=_[_0x8cf5('0x45')](_0x205703,_0x8cf5('0x41'));_0x5b420f[_0x8cf5('0x4b')]=_['keys'](_0x22d911['query']);_0x5b420f[_0x8cf5('0x4c')]=_['intersection'](_0x5b420f['model'],_0x5b420f[_0x8cf5('0x4b')]);_0x24f2c8[_0x8cf5('0x4d')]=_[_0x8cf5('0x4e')](_0x5b420f[_0x8cf5('0x4f')],qs['fields'](_0x22d911[_0x8cf5('0x4b')][_0x8cf5('0x50')]));_0x24f2c8[_0x8cf5('0x4d')]=_0x24f2c8[_0x8cf5('0x4d')][_0x8cf5('0x51')]?_0x24f2c8[_0x8cf5('0x4d')]:_0x5b420f[_0x8cf5('0x4f')];if(!_0x22d911[_0x8cf5('0x4b')]['hasOwnProperty'](_0x8cf5('0x52'))){_0x24f2c8[_0x8cf5('0x35')]=qs[_0x8cf5('0x35')](_0x22d911['query'][_0x8cf5('0x35')]);_0x24f2c8[_0x8cf5('0x34')]=qs[_0x8cf5('0x34')](_0x22d911[_0x8cf5('0x4b')][_0x8cf5('0x34')]);}_0x24f2c8[_0x8cf5('0x53')]=qs['sort'](_0x22d911[_0x8cf5('0x4b')][_0x8cf5('0x54')]);_0x24f2c8['where']=qs[_0x8cf5('0x4c')](_['pick'](_0x22d911[_0x8cf5('0x4b')],_0x5b420f[_0x8cf5('0x4c')]),_0x205703);if(_0x22d911[_0x8cf5('0x4b')][_0x8cf5('0x55')]){_0x24f2c8[_0x8cf5('0x56')]=_[_0x8cf5('0x57')](_0x24f2c8[_0x8cf5('0x56')],{'$or':_[_0x8cf5('0x45')](_0x205703,function(_0x1a3c4a){if(_0x1a3c4a[_0x8cf5('0x49')]!==_0x8cf5('0x58')){var _0x5063fd={};_0x5063fd[_0x1a3c4a['name']]={'$like':'%'+_0x22d911[_0x8cf5('0x4b')][_0x8cf5('0x55')]+'%'};return _0x5063fd;}})});}_0x24f2c8=_[_0x8cf5('0x57')]({},_0x24f2c8,_0x22d911[_0x8cf5('0x59')]);var _0x1286d0={'where':_0x24f2c8[_0x8cf5('0x56')]};return db[_0x8cf5('0x46')][_0x8cf5('0x33')](_0x1286d0)[_0x8cf5('0x25')](function(_0x10d15b){_0x54ae32['count']=_0x10d15b;if(_0x22d911[_0x8cf5('0x4b')][_0x8cf5('0x5a')]){_0x24f2c8[_0x8cf5('0x5b')]=[{'all':!![]}];}return db[_0x8cf5('0x46')][_0x8cf5('0x5c')](_0x24f2c8);})[_0x8cf5('0x25')](function(_0x5c0082){_0x54ae32[_0x8cf5('0x5d')]=_0x5c0082;return _0x54ae32;})[_0x8cf5('0x25')](respondWithFilteredResult(_0x4c6424,_0x24f2c8))['catch'](handleError(_0x4c6424,null));};exports[_0x8cf5('0x5e')]=function(_0x153c97,_0x478811){var _0x3f2563={'raw':![],'where':{'id':_0x153c97[_0x8cf5('0x5f')]['id']},'include':[{'model':db[_0x8cf5('0x60')],'as':_0x8cf5('0x44')}]},_0x381281={};_0x381281[_0x8cf5('0x4f')]=_[_0x8cf5('0x61')](db['ChatWebsite'][_0x8cf5('0x47')]);_0x381281['query']=_[_0x8cf5('0x61')](_0x153c97['query']);_0x381281[_0x8cf5('0x4c')]=_['intersection'](_0x381281[_0x8cf5('0x4f')],_0x381281[_0x8cf5('0x4b')]);_0x3f2563[_0x8cf5('0x4d')]=_[_0x8cf5('0x4e')](_0x381281['model'],qs[_0x8cf5('0x50')](_0x153c97[_0x8cf5('0x4b')]['fields']));_0x3f2563[_0x8cf5('0x4d')]=_0x3f2563[_0x8cf5('0x4d')][_0x8cf5('0x51')]?_0x3f2563['attributes']:_0x381281[_0x8cf5('0x4f')];if(_0x153c97[_0x8cf5('0x4b')][_0x8cf5('0x5a')]){_0x3f2563[_0x8cf5('0x5b')]=[{'all':!![]}];}_0x3f2563=_['merge']({},_0x3f2563,_0x153c97[_0x8cf5('0x59')]);return db['ChatWebsite'][_0x8cf5('0x62')](_0x3f2563)[_0x8cf5('0x25')](handleEntityNotFound(_0x478811,null))[_0x8cf5('0x25')](respondWithResult(_0x478811,null))[_0x8cf5('0x2f')](handleError(_0x478811,null));};exports[_0x8cf5('0x63')]=function(_0x3f31ee,_0x53ae83){return db[_0x8cf5('0x46')][_0x8cf5('0x63')](_0x3f31ee['body'],{})[_0x8cf5('0x25')](function(_0x42fa61){var _0x5a4a94=_0x3f31ee['user'][_0x8cf5('0x3c')]({'plain':!![]});if(!_0x5a4a94)throw new Error(_0x8cf5('0x64'));if(_0x5a4a94[_0x8cf5('0x65')]===_0x8cf5('0x66')){var _0x25720c=_0x42fa61[_0x8cf5('0x3c')]({'plain':!![]});var _0x1dc814='ChatWebsites';return db[_0x8cf5('0x67')][_0x8cf5('0x62')]({'where':{'name':_0x1dc814,'userProfileId':_0x5a4a94[_0x8cf5('0x68')]},'raw':!![]})[_0x8cf5('0x25')](function(_0x2e5b05){if(_0x2e5b05&&_0x2e5b05[_0x8cf5('0x69')]===0x0){return db[_0x8cf5('0x3e')][_0x8cf5('0x63')]({'name':_0x25720c['name'],'resourceId':_0x25720c['id'],'type':_0x2e5b05[_0x8cf5('0x41')],'sectionId':_0x2e5b05['id']},{})[_0x8cf5('0x25')](function(){return _0x42fa61;});}else{return _0x42fa61;}})[_0x8cf5('0x2f')](function(_0x5a678a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a678a);throw _0x5a678a;});}return _0x42fa61;})[_0x8cf5('0x25')](respondWithResult(_0x53ae83,0xc9))[_0x8cf5('0x2f')](handleError(_0x53ae83,null));};exports[_0x8cf5('0x3a')]=function(_0x30e685,_0x23c896){if(_0x30e685[_0x8cf5('0x6a')]['id']){delete _0x30e685[_0x8cf5('0x6a')]['id'];}return db[_0x8cf5('0x46')]['find']({'where':{'id':_0x30e685[_0x8cf5('0x5f')]['id']},'include':[{'model':db[_0x8cf5('0x60')],'as':_0x8cf5('0x44')}]})['then'](handleEntityNotFound(_0x23c896,null))[_0x8cf5('0x25')](saveUpdates(_0x30e685['body'],null))[_0x8cf5('0x25')](respondWithResult(_0x23c896,null))[_0x8cf5('0x2f')](handleError(_0x23c896,null));};exports[_0x8cf5('0x3b')]=function(_0x1b399f,_0x8f084c){return db[_0x8cf5('0x46')][_0x8cf5('0x62')]({'where':{'id':_0x1b399f[_0x8cf5('0x5f')]['id']}})[_0x8cf5('0x25')](handleEntityNotFound(_0x8f084c,null))[_0x8cf5('0x25')](removeEntity(_0x8f084c,null))[_0x8cf5('0x2f')](handleError(_0x8f084c,null));};exports[_0x8cf5('0x6b')]=function(_0x4b71b8,_0x23a33d){return db[_0x8cf5('0x46')][_0x8cf5('0x6b')]()[_0x8cf5('0x25')](respondWithResult(_0x23a33d,null))[_0x8cf5('0x2f')](handleError(_0x23a33d,null));};exports['addDisposition']=function(_0x171de2,_0x18620e,_0x55fca5){if(_0x171de2[_0x8cf5('0x6a')]['id']){delete _0x171de2['body']['id'];}return db['ChatWebsite'][_0x8cf5('0x62')]({'where':{'id':_0x171de2['params']['id']}})[_0x8cf5('0x25')](handleEntityNotFound(_0x18620e,null))['then'](function(_0x4604a5){if(_0x4604a5){_0x171de2[_0x8cf5('0x6a')]['ChatWebsiteId']=_0x4604a5['id'];return db[_0x8cf5('0x6c')]['create'](_0x171de2['body']);}})[_0x8cf5('0x25')](respondWithResult(_0x18620e,null))[_0x8cf5('0x2f')](handleError(_0x18620e,null));};exports['getDispositions']=function(_0x1c81a1,_0x48b571,_0x2fa555){var _0x11802b={'raw':![],'where':{}};var _0x567285={};var _0x30f38f={'count':0x0,'rows':[]};return db[_0x8cf5('0x46')][_0x8cf5('0x6d')]({'where':{'id':_0x1c81a1[_0x8cf5('0x5f')]['id']}})[_0x8cf5('0x25')](handleEntityNotFound(_0x48b571,null))[_0x8cf5('0x25')](function(_0x3c13d5){if(_0x3c13d5){_0x567285['model']=_[_0x8cf5('0x61')](db[_0x8cf5('0x6c')]['rawAttributes']);_0x567285['query']=_['keys'](_0x1c81a1['query']);_0x567285[_0x8cf5('0x4c')]=_[_0x8cf5('0x4e')](_0x567285[_0x8cf5('0x4f')],_0x567285[_0x8cf5('0x4b')]);_0x11802b[_0x8cf5('0x4d')]=_[_0x8cf5('0x4e')](_0x567285['model'],qs['fields'](_0x1c81a1[_0x8cf5('0x4b')][_0x8cf5('0x50')]));_0x11802b[_0x8cf5('0x4d')]=_0x11802b[_0x8cf5('0x4d')][_0x8cf5('0x51')]?_0x11802b[_0x8cf5('0x4d')]:_0x567285[_0x8cf5('0x4f')];if(!_0x1c81a1[_0x8cf5('0x4b')][_0x8cf5('0x6e')]('nolimit')){_0x11802b['limit']=qs[_0x8cf5('0x35')](_0x1c81a1['query']['limit']);_0x11802b[_0x8cf5('0x34')]=qs[_0x8cf5('0x34')](_0x1c81a1['query']['offset']);}_0x11802b[_0x8cf5('0x53')]=qs['sort'](_0x1c81a1[_0x8cf5('0x4b')][_0x8cf5('0x54')]);_0x11802b[_0x8cf5('0x56')]=qs[_0x8cf5('0x4c')](_[_0x8cf5('0x6f')](_0x1c81a1['query'],_0x567285[_0x8cf5('0x4c')]));_0x11802b[_0x8cf5('0x56')]['ChatWebsiteId']=_0x3c13d5['id'];if(_0x1c81a1[_0x8cf5('0x4b')]['filter']){_0x11802b[_0x8cf5('0x56')]=_[_0x8cf5('0x57')](_0x11802b[_0x8cf5('0x56')],{'$or':_['map'](_0x11802b[_0x8cf5('0x4d')],function(_0x552baf){var _0xdb5f60={};_0xdb5f60[_0x552baf]={'$like':'%'+_0x1c81a1[_0x8cf5('0x4b')][_0x8cf5('0x55')]+'%'};return _0xdb5f60;})});}_0x11802b=_[_0x8cf5('0x57')]({},_0x11802b,_0x1c81a1['options']);return db[_0x8cf5('0x6c')][_0x8cf5('0x33')]({'where':_0x11802b[_0x8cf5('0x56')]})['then'](function(_0x3b4c84){_0x30f38f[_0x8cf5('0x33')]=_0x3b4c84;if(_0x1c81a1['query'][_0x8cf5('0x5a')]){_0x11802b['include']=[{'all':!![]}];}return db[_0x8cf5('0x6c')]['findAll'](_0x11802b);})[_0x8cf5('0x25')](function(_0x1aa110){_0x30f38f[_0x8cf5('0x5d')]=_0x1aa110;return _0x30f38f;});}})[_0x8cf5('0x25')](respondWithFilteredResult(_0x48b571,_0x11802b))[_0x8cf5('0x2f')](handleError(_0x48b571,null));};exports[_0x8cf5('0x70')]=function(_0x3ce5e3,_0x54e35a,_0x4c8f95){return db[_0x8cf5('0x46')][_0x8cf5('0x62')]({'where':{'id':_0x3ce5e3[_0x8cf5('0x5f')]['id']}})[_0x8cf5('0x25')](handleEntityNotFound(_0x54e35a,null))['then'](function(_0x15f0e8){if(_0x15f0e8){return _0x15f0e8[_0x8cf5('0x70')](_0x3ce5e3['query'][_0x8cf5('0x71')]);}})[_0x8cf5('0x25')](respondWithStatusCode(_0x54e35a,null))[_0x8cf5('0x2f')](handleError(_0x54e35a,null));};exports[_0x8cf5('0x72')]=function(_0x2a4f90,_0x25dd75,_0x39af0c){if(_0x2a4f90[_0x8cf5('0x6a')]['id']){delete _0x2a4f90[_0x8cf5('0x6a')]['id'];}return db[_0x8cf5('0x46')]['find']({'where':{'id':_0x2a4f90[_0x8cf5('0x5f')]['id']}})[_0x8cf5('0x25')](handleEntityNotFound(_0x25dd75,null))[_0x8cf5('0x25')](function(_0x4f1159){if(_0x4f1159){_0x2a4f90[_0x8cf5('0x6a')][_0x8cf5('0x73')]=_0x4f1159['id'];return db[_0x8cf5('0x74')][_0x8cf5('0x63')](_0x2a4f90['body']);}})[_0x8cf5('0x25')](respondWithResult(_0x25dd75,null))[_0x8cf5('0x2f')](handleError(_0x25dd75,null));};exports[_0x8cf5('0x75')]=function(_0x50a68e,_0x1185a0,_0x57ffef){var _0x260a3e={'raw':![],'where':{}};var _0x51c611={};var _0x35559f={'count':0x0,'rows':[]};return db[_0x8cf5('0x46')][_0x8cf5('0x6d')]({'where':{'id':_0x50a68e[_0x8cf5('0x5f')]['id']}})[_0x8cf5('0x25')](handleEntityNotFound(_0x1185a0,null))['then'](function(_0x3f9f81){if(_0x3f9f81){_0x51c611[_0x8cf5('0x4f')]=_['keys'](db[_0x8cf5('0x74')]['rawAttributes']);_0x51c611[_0x8cf5('0x4b')]=_['keys'](_0x50a68e[_0x8cf5('0x4b')]);_0x51c611[_0x8cf5('0x4c')]=_['intersection'](_0x51c611[_0x8cf5('0x4f')],_0x51c611['query']);_0x260a3e['attributes']=_[_0x8cf5('0x4e')](_0x51c611[_0x8cf5('0x4f')],qs[_0x8cf5('0x50')](_0x50a68e[_0x8cf5('0x4b')][_0x8cf5('0x50')]));_0x260a3e['attributes']=_0x260a3e['attributes'][_0x8cf5('0x51')]?_0x260a3e[_0x8cf5('0x4d')]:_0x51c611['model'];if(!_0x50a68e[_0x8cf5('0x4b')][_0x8cf5('0x6e')](_0x8cf5('0x52'))){_0x260a3e[_0x8cf5('0x35')]=qs[_0x8cf5('0x35')](_0x50a68e['query'][_0x8cf5('0x35')]);_0x260a3e[_0x8cf5('0x34')]=qs[_0x8cf5('0x34')](_0x50a68e[_0x8cf5('0x4b')]['offset']);}_0x260a3e[_0x8cf5('0x53')]=qs['sort'](_0x50a68e[_0x8cf5('0x4b')][_0x8cf5('0x54')]);_0x260a3e[_0x8cf5('0x56')]=qs['filters'](_[_0x8cf5('0x6f')](_0x50a68e[_0x8cf5('0x4b')],_0x51c611[_0x8cf5('0x4c')]));_0x260a3e[_0x8cf5('0x56')]['ChatWebsiteId']=_0x3f9f81['id'];if(_0x50a68e['query'][_0x8cf5('0x55')]){_0x260a3e['where']=_[_0x8cf5('0x57')](_0x260a3e[_0x8cf5('0x56')],{'$or':_[_0x8cf5('0x45')](_0x260a3e[_0x8cf5('0x4d')],function(_0x3a71c4){var _0xbedd84={};_0xbedd84[_0x3a71c4]={'$like':'%'+_0x50a68e['query']['filter']+'%'};return _0xbedd84;})});}_0x260a3e=_[_0x8cf5('0x57')]({},_0x260a3e,_0x50a68e['options']);return db[_0x8cf5('0x74')][_0x8cf5('0x33')]({'where':_0x260a3e[_0x8cf5('0x56')]})[_0x8cf5('0x25')](function(_0x3e95ee){_0x35559f['count']=_0x3e95ee;if(_0x50a68e[_0x8cf5('0x4b')][_0x8cf5('0x5a')]){_0x260a3e[_0x8cf5('0x5b')]=[{'all':!![]}];}return db[_0x8cf5('0x74')]['findAll'](_0x260a3e);})[_0x8cf5('0x25')](function(_0x5eff59){_0x35559f[_0x8cf5('0x5d')]=_0x5eff59;return _0x35559f;});}})[_0x8cf5('0x25')](respondWithFilteredResult(_0x1185a0,_0x260a3e))[_0x8cf5('0x2f')](handleError(_0x1185a0,null));};exports[_0x8cf5('0x76')]=function(_0x402aa7,_0x469685,_0x4a0449){return db[_0x8cf5('0x46')][_0x8cf5('0x62')]({'where':{'id':_0x402aa7[_0x8cf5('0x5f')]['id']}})[_0x8cf5('0x25')](handleEntityNotFound(_0x469685,null))[_0x8cf5('0x25')](function(_0x24ea3a){if(_0x24ea3a){return _0x24ea3a[_0x8cf5('0x76')](_0x402aa7[_0x8cf5('0x4b')]['ids']);}})[_0x8cf5('0x25')](respondWithStatusCode(_0x469685,null))[_0x8cf5('0x2f')](handleError(_0x469685,null));};exports[_0x8cf5('0x77')]=function(_0x1d0f36,_0x1470a0,_0x339594){_0x1d0f36[_0x8cf5('0x6a')]['sitepic']=_0x1d0f36[_0x8cf5('0x78')][_0x8cf5('0x79')];return db['ChatWebsite'][_0x8cf5('0x62')]({'where':{'id':_0x1d0f36[_0x8cf5('0x5f')]['id']}})[_0x8cf5('0x25')](handleEntityNotFound(_0x1470a0,null))[_0x8cf5('0x25')](saveUpdates(_0x1d0f36['body'],null))[_0x8cf5('0x25')](respondWithResult(_0x1470a0,null))[_0x8cf5('0x2f')](handleError(_0x1470a0,null));};exports[_0x8cf5('0x7a')]=function(_0x427573,_0x59e993,_0x1d1678){_0x427573[_0x8cf5('0x6a')][_0x8cf5('0x7b')]=_0x427573[_0x8cf5('0x78')][_0x8cf5('0x79')];return db[_0x8cf5('0x46')][_0x8cf5('0x62')]({'where':{'id':_0x427573[_0x8cf5('0x5f')]['id']}})[_0x8cf5('0x25')](handleEntityNotFound(_0x59e993,null))[_0x8cf5('0x25')](saveUpdates(_0x427573[_0x8cf5('0x6a')],null))[_0x8cf5('0x25')](respondWithResult(_0x59e993,null))['catch'](handleError(_0x59e993,null));};exports[_0x8cf5('0x7c')]=function(_0x9aeecf,_0x1810c1,_0x3b1054){_0x9aeecf[_0x8cf5('0x6a')]['customerAvatar']=_0x9aeecf[_0x8cf5('0x78')][_0x8cf5('0x79')];return db[_0x8cf5('0x46')][_0x8cf5('0x62')]({'where':{'id':_0x9aeecf['params']['id']}})[_0x8cf5('0x25')](handleEntityNotFound(_0x1810c1,null))[_0x8cf5('0x25')](saveUpdates(_0x9aeecf['body'],null))[_0x8cf5('0x25')](respondWithResult(_0x1810c1,null))['catch'](handleError(_0x1810c1,null));};exports[_0x8cf5('0x7d')]=function(_0x4ac89d,_0x26708f,_0x4ffdb2){_0x4ac89d[_0x8cf5('0x6a')][_0x8cf5('0x7e')]=_0x4ac89d[_0x8cf5('0x78')]['filename'];return db[_0x8cf5('0x46')][_0x8cf5('0x62')]({'where':{'id':_0x4ac89d[_0x8cf5('0x5f')]['id']}})[_0x8cf5('0x25')](handleEntityNotFound(_0x26708f,null))[_0x8cf5('0x25')](saveUpdates(_0x4ac89d['body'],null))[_0x8cf5('0x25')](respondWithResult(_0x26708f,null))['catch'](handleError(_0x26708f,null));};exports[_0x8cf5('0x7f')]=function(_0x3855b6,_0x1dc536,_0x1fbfc9){var _0x43a3c2=path[_0x8cf5('0x80')](config[_0x8cf5('0x81')],'server/files/images/logos/default_logo.svg');var _0x1a7e46={'where':{'id':_0x3855b6[_0x8cf5('0x5f')]['id']},'attributes':['id',_0x8cf5('0x82')],'raw':!![]};var _0x5e38bc=![];return require(_0x8cf5('0x83'))[_0x8cf5('0x84')]()[_0x8cf5('0x25')](function(_0x383a52){if(_0x383a52){_0x5e38bc=_0x383a52[_0x8cf5('0x85')];}})[_0x8cf5('0x25')](function(){return db[_0x8cf5('0x46')][_0x8cf5('0x62')](_0x1a7e46);})[_0x8cf5('0x25')](handleEntityNotFound(_0x1dc536,null))[_0x8cf5('0x25')](function(_0x1d70b3){if(_0x1d70b3){if(!_[_0x8cf5('0x86')](_0x1d70b3['sitepic'])){if(fs[_0x8cf5('0x87')](path['join'](config[_0x8cf5('0x81')],'server/files/images/logos/',_0x1d70b3[_0x8cf5('0x82')]))&&_0x5e38bc){_0x43a3c2=path[_0x8cf5('0x80')](config[_0x8cf5('0x81')],'server/files/images/logos/',_0x1d70b3[_0x8cf5('0x82')]);}}return _0x1dc536[_0x8cf5('0x88')](_0x43a3c2);}})[_0x8cf5('0x2f')](handleError(_0x1dc536,null));};exports[_0x8cf5('0x89')]=function(_0x18111c,_0x1da93d,_0x2f5b5b){var _0x9dae69=path['join'](config[_0x8cf5('0x81')],_0x8cf5('0x8a'));var _0x5d04e3={'where':{'id':_0x18111c[_0x8cf5('0x5f')]['id']},'attributes':['id',_0x8cf5('0x7b')],'raw':!![]};return db[_0x8cf5('0x46')][_0x8cf5('0x62')](_0x5d04e3)['then'](handleEntityNotFound(_0x1da93d,null))[_0x8cf5('0x25')](function(_0x264c63){if(_0x264c63){if(!_[_0x8cf5('0x86')](_0x264c63[_0x8cf5('0x7b')])){if(fs[_0x8cf5('0x87')](path[_0x8cf5('0x80')](config[_0x8cf5('0x81')],'server/files/images/avatars/',_0x264c63[_0x8cf5('0x7b')]))){_0x9dae69=path[_0x8cf5('0x80')](config[_0x8cf5('0x81')],_0x8cf5('0x8b'),_0x264c63[_0x8cf5('0x7b')]);}}return _0x1da93d[_0x8cf5('0x88')](_0x9dae69);}})[_0x8cf5('0x2f')](handleError(_0x1da93d,null));};exports['getCustomerAvatar']=function(_0x25f960,_0x5dcdfe,_0xd845dd){var _0x5bcf0b=path[_0x8cf5('0x80')](config['root'],_0x8cf5('0x8c'));var _0x30bb05={'where':{'id':_0x25f960[_0x8cf5('0x5f')]['id']},'attributes':['id',_0x8cf5('0x8d'),_0x8cf5('0x8e')],'raw':!![]};return db[_0x8cf5('0x46')]['find'](_0x30bb05)[_0x8cf5('0x25')](handleEntityNotFound(_0x5dcdfe,null))[_0x8cf5('0x25')](function(_0xf54c59){if(_0xf54c59){if(!_[_0x8cf5('0x86')](_0xf54c59[_0x8cf5('0x8d')])){if(fs[_0x8cf5('0x87')](path[_0x8cf5('0x80')](config[_0x8cf5('0x81')],_0x8cf5('0x8b'),_0xf54c59[_0x8cf5('0x8d')]))&&_0xf54c59['showCustomerAvatar']){_0x5bcf0b=path[_0x8cf5('0x80')](config[_0x8cf5('0x81')],_0x8cf5('0x8b'),_0xf54c59['customerAvatar']);}}return _0x5dcdfe['download'](_0x5bcf0b);}})[_0x8cf5('0x2f')](handleError(_0x5dcdfe,null));};exports[_0x8cf5('0x8f')]=function(_0x5bc95d,_0xbd3287,_0x8095c8){var _0x521b72=path[_0x8cf5('0x80')](config[_0x8cf5('0x81')],_0x8cf5('0x90'));var _0x49e287={'where':{'id':_0x5bc95d[_0x8cf5('0x5f')]['id']},'attributes':['id',_0x8cf5('0x7e')],'raw':!![]};return db['ChatWebsite'][_0x8cf5('0x62')](_0x49e287)[_0x8cf5('0x25')](handleEntityNotFound(_0xbd3287,null))[_0x8cf5('0x25')](function(_0x369048){if(_0x369048){if(!_['isNil'](_0x369048['systemAvatar'])){if(fs['existsSync'](path[_0x8cf5('0x80')](config[_0x8cf5('0x81')],_0x8cf5('0x8b'),_0x369048[_0x8cf5('0x7e')]))){_0x521b72=path[_0x8cf5('0x80')](config[_0x8cf5('0x81')],'server/files/images/avatars/',_0x369048[_0x8cf5('0x7e')]);}}return _0xbd3287[_0x8cf5('0x88')](_0x521b72);}})[_0x8cf5('0x2f')](handleError(_0xbd3287,null));};exports[_0x8cf5('0x91')]=function(_0x43744f,_0x234b52,_0x60a6fc){var _0x461eb7=require('user-agent-parser');var _0x191ca9=new _0x461eb7();var _0x396d10=_0x191ca9[_0x8cf5('0x92')](_0x43744f[_0x8cf5('0x93')][_0x8cf5('0x94')])[_0x8cf5('0x95')]();var _0x9cf671={'body':_0x43744f[_0x8cf5('0x6a')],'channel':_0x8cf5('0x96')};var _0x1aa7ad=[];var _0x2d68eb=[];var _0x6b6c2d={};var _0x8e7dc9=![];return db[_0x8cf5('0x97')][_0x8cf5('0x6b')]()[_0x8cf5('0x25')](function(_0xad673){if(!_0xad673){throw new db[(_0x8cf5('0x22'))][(_0x8cf5('0x98'))](_0x8cf5('0x99'));}_0x1aa7ad=_[_0x8cf5('0x9a')](_['keys'](_0xad673),[_0x8cf5('0x9b'),_0x8cf5('0x9c')]);_0x2d68eb=_['difference'](_[_0x8cf5('0x61')](_0xad673),[_0x8cf5('0x9b'),_0x8cf5('0x9c'),'CompanyId','ListId']);if(_0x43744f['body']['id']){delete _0x43744f['body']['id'];}if(_[_0x8cf5('0x86')](_0x43744f[_0x8cf5('0x6a')][_0x8cf5('0x9d')])){throw new db[(_0x8cf5('0x22'))]['ValidationError'](_0x8cf5('0x9e'));}if(_[_0x8cf5('0x86')](_0x43744f[_0x8cf5('0x6a')][_0x8cf5('0x6a')])||_0x43744f[_0x8cf5('0x6a')][_0x8cf5('0x6a')]===''){throw new db[(_0x8cf5('0x22'))]['ValidationError'](_0x8cf5('0x9f'));}if(_[_0x8cf5('0x86')](_0x43744f[_0x8cf5('0x6a')][_0x8cf5('0xa0')])){throw new db[(_0x8cf5('0x22'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2d68eb);}if(!_['includes'](_0x2d68eb,_0x43744f[_0x8cf5('0x6a')][_0x8cf5('0xa0')])){throw new db['Sequelize'][(_0x8cf5('0x98'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2d68eb);}_0x6b6c2d[_0x43744f[_0x8cf5('0x6a')]['mapKey']]=_0x43744f[_0x8cf5('0x6a')]['from'];})[_0x8cf5('0x25')](function(){return db[_0x8cf5('0x46')][_0x8cf5('0x62')]({'where':{'id':_0x43744f[_0x8cf5('0x5f')]['id']},'include':[{'model':db[_0x8cf5('0xa1')],'as':_0x8cf5('0xa2'),'include':[{'model':db['CmContact'],'as':_0x8cf5('0xa3'),'where':_0x6b6c2d,'limit':0x1,'order':[[_0x8cf5('0x9c'),_0x8cf5('0xa4')]]}]},{'model':db[_0x8cf5('0xa5')],'as':_0x8cf5('0xa6')}]});})[_0x8cf5('0x25')](handleEntityNotFound(_0x234b52,null))[_0x8cf5('0x25')](function(_0x4481d4){if(_0x4481d4&&_0x4481d4[_0x8cf5('0xa2')]){_0x9cf671[_0x8cf5('0xa7')]=_0x4481d4;_0x9cf671[_0x8cf5('0xa8')]=_0x4481d4[_0x8cf5('0xa6')];_0x9cf671[_0x8cf5('0xa9')]=_0x4481d4['List'];_0x9cf671['applications']=_[_0x8cf5('0xaa')](_0x9cf671[_0x8cf5('0xa8')],[_0x8cf5('0xab')],[_0x8cf5('0xac')]);if(_0x9cf671[_0x8cf5('0xa7')][_0x8cf5('0xa6')]){delete _0x9cf671[_0x8cf5('0xa7')]['Applications'];}if(_0x9cf671[_0x8cf5('0xa7')][_0x8cf5('0xa2')]&&_0x9cf671[_0x8cf5('0xa7')][_0x8cf5('0xa2')][_0x8cf5('0xa3')][_0x8cf5('0x51')]){return _0x9cf671[_0x8cf5('0xa7')][_0x8cf5('0xa2')][_0x8cf5('0xa3')][0x0];}var _0x26622b=_[_0x8cf5('0x19')](_0x43744f[_0x8cf5('0x6a')],{'firstName':_0x43744f['body'][_0x8cf5('0x9d')],'ListId':_0x4481d4[_0x8cf5('0xad')]});_0x26622b[_0x43744f[_0x8cf5('0x6a')]['mapKey']]=_0x43744f[_0x8cf5('0x6a')][_0x8cf5('0x9d')];return db[_0x8cf5('0x97')][_0x8cf5('0x63')](_0x26622b,{'fields':_0x1aa7ad,'raw':!![]});}})['then'](handleEntityNotFound(_0x234b52,null))[_0x8cf5('0x25')](function(_0x435140){_0x9cf671[_0x8cf5('0xae')]=_0x435140;var _0x3d8114=_0x43744f[_0x8cf5('0x6a')][_0x8cf5('0xaf')];if(_0x43744f[_0x8cf5('0x93')]['cf-connecting-ip']){_0x3d8114=_0x43744f[_0x8cf5('0x93')]['cf-connecting-ip'];}else if(_0x43744f[_0x8cf5('0x93')]['x-forwarded-for']){_0x3d8114=_[_0x8cf5('0xb0')](_0x43744f[_0x8cf5('0x93')][_0x8cf5('0xb1')]['split'](','));}if(_0x435140){var _0xab6a80={'ContactId':_0x435140['id'],'ChatWebsiteId':_0x43744f[_0x8cf5('0x5f')]['id'],'from':(_0x435140['firstName']||'')+'\x20'+(_0x435140[_0x8cf5('0xb2')]||''),'customerIp':_0x3d8114,'customerPort':_0x43744f[_0x8cf5('0x93')]['x-real-port']?_0x43744f['headers'][_0x8cf5('0xb3')]:null,'referer':_0x43744f['body'][_0x8cf5('0xb4')],'browserName':_0x396d10[_0x8cf5('0xb5')][_0x8cf5('0x41')]&&_0x396d10['browser'][_0x8cf5('0xb6')]?util['format']('%s\x20%s',_0x396d10['browser'][_0x8cf5('0x41')],_0x396d10[_0x8cf5('0xb5')][_0x8cf5('0xb6')]):'unknown','browserVersion':_0x396d10[_0x8cf5('0xb5')]['version']||_0x8cf5('0xb7'),'osName':util[_0x8cf5('0xb8')](_0x8cf5('0xb9'),_0x396d10['os'][_0x8cf5('0x41')],_0x396d10['os'][_0x8cf5('0xb6')]),'osVersion':_0x396d10['os'][_0x8cf5('0xb6')],'deviceModel':_0x396d10[_0x8cf5('0xba')][_0x8cf5('0x4f')]&&_0x396d10[_0x8cf5('0xba')][_0x8cf5('0xbb')]?util[_0x8cf5('0xb8')]('%s\x20%s\x20%s',_0x396d10[_0x8cf5('0xba')][_0x8cf5('0x4f')],_0x396d10[_0x8cf5('0xba')]['vendor'],_0x396d10[_0x8cf5('0xba')][_0x8cf5('0x49')]):null,'deviceVendor':_0x396d10[_0x8cf5('0xba')]['vendor'],'deviceType':_0x396d10['device'][_0x8cf5('0x49')],'formData':JSON[_0x8cf5('0x2a')](_0x43744f['body'])};var _0x52ed85={'ChatWebsiteId':_0x43744f[_0x8cf5('0x5f')]['id'],'closed':![]};if(_0x43744f['body'][_0x8cf5('0xbc')]){_0x52ed85[_0x8cf5('0xbc')]=_0x43744f[_0x8cf5('0x6a')]['threadId'];return db[_0x8cf5('0xbd')]['find']({'where':_0x52ed85})[_0x8cf5('0x25')](function(_0x2a16f0){if(_0x2a16f0){return[_0x2a16f0,![]];}_0xab6a80[_0x8cf5('0xbc')]=_0x43744f[_0x8cf5('0x6a')]['threadId'];_0xab6a80['externalUrl']=_0x43744f[_0x8cf5('0x6a')][_0x8cf5('0xbe')];return db['ChatInteraction'][_0x8cf5('0x63')](_0xab6a80)[_0x8cf5('0x25')](function(_0x55bf0f){return[_0x55bf0f,!![]];});});}_0x52ed85[_0x8cf5('0xbf')]=_0x435140['id'];if(_0x43744f[_0x8cf5('0x6a')][_0x8cf5('0xc0')]&&_0x43744f['body'][_0x8cf5('0xc0')]['id']){_0x52ed85['id']=_0x43744f['body']['interaction']['id'];return db[_0x8cf5('0xbd')][_0x8cf5('0x62')]({'where':_0x52ed85})['then'](function(_0x33fdf9){if(_0x33fdf9){return[_0x33fdf9,![]];}return db['ChatInteraction'][_0x8cf5('0x63')](_0xab6a80)['then'](function(_0x3ba868){return[_0x3ba868,!![]];});});}return db[_0x8cf5('0xbd')][_0x8cf5('0x63')](_0xab6a80)[_0x8cf5('0x25')](function(_0x65430c){return[_0x65430c,!![]];});}})['spread'](function(_0x953348,_0x39ef15){if(_0x953348){_0x8e7dc9=_0x39ef15;if(!_0x39ef15){var _0x59150e={'from':(_0x9cf671[_0x8cf5('0xae')][_0x8cf5('0xc1')]||'')+'\x20'+(_0x9cf671[_0x8cf5('0xae')][_0x8cf5('0xb2')]||'')};if(_0x43744f[_0x8cf5('0x6a')][_0x8cf5('0xbc')]&&_0x43744f[_0x8cf5('0x6a')][_0x8cf5('0xc2')]&&_0x43744f['body'][_0x8cf5('0xbc')]!=_0x43744f[_0x8cf5('0x6a')][_0x8cf5('0xc2')]){_0x59150e['threadId']=_0x43744f['body']['messageId'];}return _0x953348[_0x8cf5('0x3a')](_0x59150e);}else{return _0x953348;}}})[_0x8cf5('0x25')](function(_0x28daf1){_0x9cf671[_0x8cf5('0xc0')]=_0x28daf1[_0x8cf5('0x3c')]({'plain':!![]});_0x9cf671['interaction'][_0x8cf5('0xc3')]=_0x8e7dc9;if(_0x9cf671['interaction']['created']){if(_0x9cf671[_0x8cf5('0xa7')][_0x8cf5('0xc4')]){_0x9cf671['applications']['push']({'id':0x0,'priority':_0x9cf671[_0x8cf5('0xa8')][_0x8cf5('0x51')]+0x1,'app':'close','appdata':_0x8cf5('0xc5'),'interval':_0x8cf5('0xc6')});}}return db['ChatMessage'][_0x8cf5('0x63')]({'body':_0x43744f['body'][_0x8cf5('0x6a')],'ChatWebsiteId':_0x43744f[_0x8cf5('0x5f')]['id'],'ChatInteractionId':_0x28daf1['id'],'direction':'in','ContactId':_0x9cf671['contact']['id'],'AttachmentId':_0x43744f[_0x8cf5('0x6a')][_0x8cf5('0xc7')]});})[_0x8cf5('0x25')](function(_0x19fb52){_0x9cf671[_0x8cf5('0x2d')]=_0x19fb52;if(_0x9cf671[_0x8cf5('0xc0')][_0x8cf5('0xc8')]){return db['User'][_0x8cf5('0x62')]({'attributes':['id',_0x8cf5('0x41')],'where':{'id':_0x9cf671[_0x8cf5('0xc0')]['UserId']}})[_0x8cf5('0x25')](function(_0x464f49){if(_0x464f49){_0x9cf671[_0x8cf5('0xa8')][_0x8cf5('0xc9')]({'id':0x0,'priority':0x0,'app':_0x8cf5('0xca'),'appdata':_0x464f49[_0x8cf5('0x41')]+','+(_0x9cf671[_0x8cf5('0xa7')][_0x8cf5('0xcb')]||0xa),'interval':_0x8cf5('0xc6')});_0x9cf671[_0x8cf5('0xcc')]=!![];}return respondWithRpcPromise(_0x8cf5('0xcd'),_0x8cf5('0xce'),_0x9cf671);});}return respondWithRpcPromise(_0x8cf5('0xcd'),_0x8cf5('0xce'),_0x9cf671);})['then'](function(_0x4555e8){respondWithRpcPromise(_0x8cf5('0xcf'),_0x8cf5('0xcf'),{'event':_0x8cf5('0x91'),'message':_0x4555e8},client9002);return _0x4555e8;})[_0x8cf5('0x25')](respondWithResult(_0x234b52,null))[_0x8cf5('0x2f')](handleError(_0x234b52,null));};exports[_0x8cf5('0xd0')]=function(_0x12daba,_0x4e7131,_0x29d51a){var _0x42a4d1,_0x38bd79,_0x4868a4;var _0x454d2d=[];var _0x192e9a=[];var _0x1a6ba8={};return db['CmContact']['describe']()[_0x8cf5('0x25')](function(_0x2c2c9e){if(!_0x2c2c9e){throw new db['Sequelize'][(_0x8cf5('0x98'))](_0x8cf5('0x99'));}_0x192e9a=_[_0x8cf5('0x9a')](_[_0x8cf5('0x61')](_0x2c2c9e),[_0x8cf5('0x9b'),'updatedAt']);_0x454d2d=_[_0x8cf5('0x9a')](_[_0x8cf5('0x61')](_0x2c2c9e),[_0x8cf5('0x9b'),'updatedAt',_0x8cf5('0xd1'),_0x8cf5('0xad')]);if(_0x12daba[_0x8cf5('0x6a')]['id']){delete _0x12daba[_0x8cf5('0x6a')]['id'];}if(_[_0x8cf5('0x86')](_0x12daba[_0x8cf5('0x6a')][_0x8cf5('0x9d')])){throw _0x4e7131[_0x8cf5('0x30')](0x1f4)[_0x8cf5('0x42')](new db[(_0x8cf5('0x22'))]['ValidationError'](_0x8cf5('0x9e')));}if(_['isNil'](_0x12daba[_0x8cf5('0x6a')]['body'])||_0x12daba[_0x8cf5('0x6a')][_0x8cf5('0x6a')]===''){throw _0x4e7131[_0x8cf5('0x30')](0x1f4)[_0x8cf5('0x42')](new db['Sequelize'][(_0x8cf5('0x98'))](_0x8cf5('0x9f')));}if(_[_0x8cf5('0x86')](_0x12daba[_0x8cf5('0x6a')][_0x8cf5('0xd2')])){throw _0x4e7131[_0x8cf5('0x30')](0x1f4)[_0x8cf5('0x42')](new db['Sequelize']['ValidationError'](_0x8cf5('0xd3')+_0x454d2d));}if(!_[_0x8cf5('0xd4')](_0x454d2d,_0x12daba[_0x8cf5('0x6a')]['mapKeyOffline'])){throw _0x4e7131['status'](0x1f4)[_0x8cf5('0x42')](new db[(_0x8cf5('0x22'))][(_0x8cf5('0x98'))](_0x8cf5('0xd5')+_0x454d2d));}_0x1a6ba8[_0x12daba['body'][_0x8cf5('0xd2')]]=_0x12daba[_0x8cf5('0x6a')][_0x8cf5('0x9d')];})[_0x8cf5('0x25')](function(){return db[_0x8cf5('0x46')][_0x8cf5('0x62')]({'where':{'id':_0x12daba[_0x8cf5('0x5f')]['id']},'include':[{'model':db['CmList'],'as':_0x8cf5('0xa2')}]});})[_0x8cf5('0x25')](handleEntityNotFound(_0x4e7131,null))['then'](function(_0x50e9a8){if(_0x50e9a8&&_0x50e9a8[_0x8cf5('0xa2')]){_0x38bd79=_0x50e9a8;var _0x4e1d28=_[_0x8cf5('0x19')](_0x12daba[_0x8cf5('0x6a')],{'firstName':_0x12daba[_0x8cf5('0x6a')][_0x8cf5('0x9d')],'phone':_0x12daba[_0x8cf5('0x6a')][_0x8cf5('0x9d')],'ListId':_0x50e9a8[_0x8cf5('0xad')]});_0x4e1d28[_0x12daba[_0x8cf5('0x6a')][_0x8cf5('0xd2')]]=_0x12daba[_0x8cf5('0x6a')]['from'];return db[_0x8cf5('0x97')][_0x8cf5('0xd6')]({'where':_0x1a6ba8,'defaults':_0x4e1d28});}})[_0x8cf5('0xd7')](function(_0x931b32){if(_0x931b32){_0x4868a4=_0x931b32;var _0x43bd19=fs['readFileSync'](path[_0x8cf5('0x80')](config['root'],_0x8cf5('0xd8')),_0x8cf5('0xd9'));var _0x154ee7=ejs[_0x8cf5('0xda')](_0x43bd19,{'body':_[_0x8cf5('0xdb')](_0x12daba[_0x8cf5('0x6a')]['body']),'bodyTitle':_0x38bd79[_0x8cf5('0xdc')]});return db['ChatOfflineMessage'][_0x8cf5('0x63')]({'body':_0x154ee7,'ContactId':_0x931b32['id'],'ChatWebsiteId':_0x38bd79['id']});}})['then'](function(_0x4de23a){if(_0x4de23a){_0x42a4d1=_0x4de23a;return db['MailAccount'][_0x8cf5('0x6d')]({'where':{'service':!![]},'include':[{'model':db[_0x8cf5('0xdd')],'as':'Smtp','raw':!![]}]});}})[_0x8cf5('0x25')](function(_0x4715ae){if(_0x4715ae&&_0x4715ae[_0x8cf5('0xde')]&&_0x38bd79[_0x8cf5('0xdf')]){var _0x2bb73b={'tls':{'rejectUnauthorized':![]}};if(_0x4715ae[_0x8cf5('0xde')]['service']){_0x2bb73b[_0x8cf5('0xe0')]=_0x4715ae[_0x8cf5('0xde')][_0x8cf5('0xe0')];}else{_0x2bb73b[_0x8cf5('0xe1')]=_0x4715ae['Smtp'][_0x8cf5('0xe1')];_0x2bb73b[_0x8cf5('0xe2')]=_0x4715ae[_0x8cf5('0xde')][_0x8cf5('0xe2')];_0x2bb73b[_0x8cf5('0xe3')]=_0x4715ae[_0x8cf5('0xde')][_0x8cf5('0xe3')];}if(_0x4715ae[_0x8cf5('0xde')]['authentication']){_0x2bb73b[_0x8cf5('0xe4')]={'user':_0x4715ae['Smtp'][_0x8cf5('0x66')],'pass':_0x4715ae[_0x8cf5('0xde')][_0x8cf5('0xe5')]};}return respondWithRpcPromise(_0x8cf5('0xe6'),'sendMail',{'account':_0x2bb73b,'message':{'from':util[_0x8cf5('0xb8')](_0x8cf5('0xe7'),_0x4715ae['name'],_0x4715ae[_0x8cf5('0xe8')]||_0x4715ae[_0x8cf5('0xde')][_0x8cf5('0x66')]),'to':_0x38bd79[_0x8cf5('0xdf')],'subject':_0x38bd79[_0x8cf5('0xe9')],'text':_0x42a4d1[_0x8cf5('0x6a')]}},client9003)[_0x8cf5('0x25')](function(){return _0x42a4d1;})[_0x8cf5('0x2f')](function(_0x514a9a){console[_0x8cf5('0x2b')](_0x514a9a);});}})[_0x8cf5('0x25')](function(){if(_0x42a4d1){return _0x42a4d1;}})[_0x8cf5('0x25')](respondWithResult(_0x4e7131,null))[_0x8cf5('0x2f')](handleError(_0x4e7131,null));};exports[_0x8cf5('0xea')]=function(_0x41cc89,_0x10e8f6,_0x5229dc){return db['ChatInteraction']['find']({'where':{'id':_0x41cc89[_0x8cf5('0x5f')]['id']}})[_0x8cf5('0x25')](handleEntityNotFound(_0x10e8f6,null))[_0x8cf5('0x25')](function(_0x32cf05){if(_0x32cf05){return _0x32cf05[_0x8cf5('0xea')](_0x41cc89['body']['ids'],_[_0x8cf5('0xeb')](_0x41cc89[_0x8cf5('0x6a')],[_0x8cf5('0x71'),'id'])||{});}})[_0x8cf5('0x25')](respondWithResult(_0x10e8f6,null))['catch'](handleError(_0x10e8f6,null));};exports[_0x8cf5('0xec')]=function(_0x1ac8fb,_0x559ea8,_0xe90b0c){var _0x1a9e6d={'raw':![],'where':{}};var _0x30814d={};var _0x172066={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x8cf5('0x6d')]({'where':{'id':_0x1ac8fb[_0x8cf5('0x5f')]['id']}})[_0x8cf5('0x25')](handleEntityNotFound(_0x559ea8,null))[_0x8cf5('0x25')](function(_0x4cdcc8){if(_0x4cdcc8){_0x30814d[_0x8cf5('0x4f')]=_[_0x8cf5('0x61')](db['ChatInteraction']['rawAttributes']);_0x30814d[_0x8cf5('0x4b')]=_[_0x8cf5('0x61')](_0x1ac8fb[_0x8cf5('0x4b')]);_0x30814d[_0x8cf5('0x4c')]=_['intersection'](_0x30814d[_0x8cf5('0x4f')],_0x30814d[_0x8cf5('0x4b')]);_0x1a9e6d[_0x8cf5('0x4d')]=_[_0x8cf5('0x4e')](_0x30814d['model'],qs[_0x8cf5('0x50')](_0x1ac8fb[_0x8cf5('0x4b')][_0x8cf5('0x50')]));_0x1a9e6d[_0x8cf5('0x4d')]=_0x1a9e6d[_0x8cf5('0x4d')]['length']?_0x1a9e6d[_0x8cf5('0x4d')]:_0x30814d[_0x8cf5('0x4f')];if(!_0x1ac8fb['query'][_0x8cf5('0x6e')](_0x8cf5('0x52'))){_0x1a9e6d[_0x8cf5('0x35')]=qs[_0x8cf5('0x35')](_0x1ac8fb[_0x8cf5('0x4b')][_0x8cf5('0x35')]);_0x1a9e6d[_0x8cf5('0x34')]=qs['offset'](_0x1ac8fb['query'][_0x8cf5('0x34')]);}_0x1a9e6d[_0x8cf5('0x53')]=qs[_0x8cf5('0x54')](_0x1ac8fb[_0x8cf5('0x4b')][_0x8cf5('0x54')]);_0x1a9e6d[_0x8cf5('0x56')]=qs[_0x8cf5('0x4c')](_[_0x8cf5('0x6f')](_0x1ac8fb[_0x8cf5('0x4b')],_0x30814d['filters']));_0x1a9e6d[_0x8cf5('0x56')][_0x8cf5('0x73')]=_0x4cdcc8['id'];if(_0x1ac8fb['query'][_0x8cf5('0x55')]){_0x1a9e6d[_0x8cf5('0x56')]=_[_0x8cf5('0x57')](_0x1a9e6d[_0x8cf5('0x56')],{'$or':_['map'](_0x1a9e6d[_0x8cf5('0x4d')],function(_0x57307e){var _0x32e3d2={};_0x32e3d2[_0x57307e]={'$like':'%'+_0x1ac8fb['query'][_0x8cf5('0x55')]+'%'};return _0x32e3d2;})});}_0x1a9e6d=_[_0x8cf5('0x57')]({},_0x1a9e6d,_0x1ac8fb[_0x8cf5('0x59')]);return db[_0x8cf5('0xbd')]['count']({'where':_0x1a9e6d['where']})[_0x8cf5('0x25')](function(_0x382285){_0x172066['count']=_0x382285;if(_0x1ac8fb[_0x8cf5('0x4b')][_0x8cf5('0x5a')]){_0x1a9e6d[_0x8cf5('0x5b')]=[{'model':db[_0x8cf5('0x97')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x8cf5('0x41'),_0x8cf5('0xed'),'internal'],'required':![]},{'model':db[_0x8cf5('0xee')],'as':_0x8cf5('0xef'),'attributes':['id',_0x8cf5('0x41'),_0x8cf5('0xf0')],'where':_0x1ac8fb[_0x8cf5('0x4b')][_0x8cf5('0xf1')]?{'id':_0x1ac8fb[_0x8cf5('0x4b')][_0x8cf5('0xf1')]}:undefined,'required':_0x1ac8fb['query'][_0x8cf5('0xf1')]?!![]:![]}];}return db[_0x8cf5('0xbd')][_0x8cf5('0x5c')](_0x1a9e6d);})[_0x8cf5('0x25')](function(_0x51e323){_0x172066[_0x8cf5('0x5d')]=_0x51e323;return _0x172066;});}})[_0x8cf5('0x25')](respondWithFilteredResult(_0x559ea8,_0x1a9e6d))[_0x8cf5('0x2f')](handleError(_0x559ea8,null));};function iftimePromise(_0xea9e5b,_0x489ef0){return respondWithRpcPromise(_0x8cf5('0xf2'),_0x8cf5('0xf3'),{'command':_0x489ef0['timezone']?util[_0x8cf5('0xb8')]('iftime\x20%s,%s',_0xea9e5b['interval'],_0x489ef0[_0x8cf5('0xf4')]):util[_0x8cf5('0xb8')](_0x8cf5('0xf5'),_0xea9e5b['interval'])},client9002)['then'](function(_0x37dec8){var _0x5a0431=_0x37dec8&&_0x37dec8[_0x8cf5('0xf6')](_0x8cf5('0xf7'))>=0x0?!![]:![];logger[_0x8cf5('0x26')](_0x8cf5('0xf8'),_0x489ef0['id'],_0xea9e5b['id'],_0xea9e5b['interval'],_0x5a0431?_0x8cf5('0xf9'):'OFFLINE',_0x489ef0[_0x8cf5('0xf4')]?_0x489ef0[_0x8cf5('0xf4')]:_0x8cf5('0xfa'));return _0x5a0431;})[_0x8cf5('0x2f')](function(_0x1ea496){logger['error'](_0x8cf5('0xf8'),_0x489ef0['id'],_0xea9e5b['id'],_0xea9e5b[_0x8cf5('0xfb')],util[_0x8cf5('0xfc')](_0x1ea496,{'showHidden':![],'depth':null}),_0x489ef0[_0x8cf5('0xf4')]?_0x489ef0[_0x8cf5('0xf4')]:_0x8cf5('0xfa'));return![];});}exports[_0x8cf5('0xf3')]=function(_0xcc814c,_0x398d8d,_0x4ded7f){var _0x53b024=0x0;var _0x114bbc=0x0;var _0x2d2edc=![];var _0x5cc582;var _0xdc69d0;return db[_0x8cf5('0x46')][_0x8cf5('0x62')]({'where':{'id':_0xcc814c['params']['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0x8cf5('0xfd')],'as':_0x8cf5('0xfe'),'attributes':['id',_0x8cf5('0xfb')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x398d8d,null))[_0x8cf5('0x25')](function(_0x5ea248){if(_0x5ea248){_0x5cc582=_0x5ea248;return _0x5ea248[_0x8cf5('0xff')]({'raw':!![]});}})['then'](function(_0x85cf20){if(_0x5cc582){if(_0x85cf20){_0xdc69d0=_0x85cf20;}}return require('../../config/license/util')[_0x8cf5('0x84')]();})['then'](function(_0x572646){if(_0x572646){_0x114bbc=_0x572646[_0x8cf5('0x100')];_0x2d2edc=_0x572646['custom'];}})[_0x8cf5('0x25')](function(){return db[_0x8cf5('0xbd')][_0x8cf5('0x33')]({'where':{'closed':![]}});})[_0x8cf5('0x25')](function(_0xe94b32){_0x53b024=_0xe94b32;if(_0x114bbc&&_0xe94b32>_0x114bbc){return db[_0x8cf5('0x101')][_0x8cf5('0x6d')]({'where':{'id':0x1}})['then'](function(_0x214755){if(_0x214755){_0x214755[_0x8cf5('0x102')](_0x8cf5('0x103'));}});}})[_0x8cf5('0x25')](function(){if(_0x5cc582[_0x8cf5('0xfd')]&&_0x5cc582[_0x8cf5('0xfd')][_0x8cf5('0xfe')]){var _0x1c9f9f=[];for(var _0xb63f98=0x0;_0xb63f98<_0x5cc582[_0x8cf5('0xfd')][_0x8cf5('0xfe')]['length'];_0xb63f98++){var _0x223240=_0x5cc582[_0x8cf5('0xfd')][_0x8cf5('0xfe')][_0xb63f98][_0x8cf5('0x3c')]({'plain':!![]});_0x1c9f9f[_0x8cf5('0x104')](iftimePromise(_0x223240,_0x5cc582));}return BPromise[_0x8cf5('0x105')](_0x1c9f9f)[_0x8cf5('0x25')](function(_0x945161){return _[_0x8cf5('0x106')](_0x945161);});}else{return!![];}})[_0x8cf5('0x25')](function(_0x1a985c){var _0x346b37=fs[_0x8cf5('0x107')](path['join'](config[_0x8cf5('0x81')],_0x8cf5('0x108')),_0x8cf5('0xd9'));var _0x101070={'remote':_0x5cc582[_0x8cf5('0x109')],'query':querystring[_0x8cf5('0x2a')](_['merge'](_0x5cc582[_0x8cf5('0x3c')]({'plain':!![]}),{'customerIp':_0xcc814c[_0x8cf5('0x93')][_0x8cf5('0xb1')]||_0xcc814c[_0x8cf5('0x93')][_0x8cf5('0x10a')]||_0xcc814c[_0x8cf5('0x10b')][_0x8cf5('0x10c')]||_0xcc814c['ip'],'referer':_0xcc814c[_0x8cf5('0x93')][_0x8cf5('0xb4')],'openedInteractions':_0x53b024,'maxInteractions':_0x114bbc,'virtual':_0x2d2edc[_0x8cf5('0x100')],'online':_0x1a985c,'custom':_0x2d2edc}))[_0x8cf5('0x10d')](/'/g,'\x5c\x27')};_0x398d8d[_0x8cf5('0x42')](ejs[_0x8cf5('0xda')](Mustache[_0x8cf5('0xda')](_0x346b37,_0x101070),{'proactiveActions':_0xdc69d0,'alignment':_0x5cc582[_0x8cf5('0x10e')],'verticalAlignment':_0x5cc582[_0x8cf5('0x10f')],'div_color':_0x5cc582[_0x8cf5('0xf0')],'text_color':_0x5cc582['textColor']}));})[_0x8cf5('0x2f')](handleError(_0x398d8d,null));};exports[_0x8cf5('0x110')]=function(_0x9a429,_0x232070,_0x3b3bf1){return db['ChatWebsite']['findOne']({'where':{'id':_0x9a429[_0x8cf5('0x5f')]['id']}})['then'](handleEntityNotFound(_0x232070,null))[_0x8cf5('0x25')](function(_0xf9e21d){if(_0xf9e21d){return db['sequelize']['transaction'](function(_0x8589ef){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x9a429[_0x8cf5('0x5f')]['id']},'transaction':_0x8589ef})[_0x8cf5('0x25')](function(_0x124b1c){var _0x32b349=_[_0x8cf5('0x45')](_0x9a429['body'],function(_0x3fe602){_0x3fe602['ChatWebsiteId']=_0x9a429[_0x8cf5('0x5f')]['id'];return _0x3fe602;});return db['ChatApplication'][_0x8cf5('0x111')](_0x32b349,{'transaction':_0x8589ef});});})[_0x8cf5('0x25')](function(){return db[_0x8cf5('0xa5')][_0x8cf5('0x112')]({'where':{'ChatWebsiteId':_0x9a429[_0x8cf5('0x5f')]['id']},'order':'priority'});});}})[_0x8cf5('0x25')](respondWithResult(_0x232070,null))['catch'](handleError(_0x232070,null));};exports[_0x8cf5('0x113')]=function(_0x2da74e,_0x473573,_0x1a23b0){var _0x3f6838={};var _0x186183={};var _0xe96a2d;var _0x538b9d;return db[_0x8cf5('0x46')][_0x8cf5('0x6d')]({'where':{'id':_0x2da74e[_0x8cf5('0x5f')]['id']}})[_0x8cf5('0x25')](handleEntityNotFound(_0x473573,null))[_0x8cf5('0x25')](function(_0x2e6718){if(_0x2e6718){_0xe96a2d=_0x2e6718;_0x186183[_0x8cf5('0x4f')]=_[_0x8cf5('0x61')](db[_0x8cf5('0xa5')]['rawAttributes']);_0x186183['query']=_[_0x8cf5('0x61')](_0x2da74e[_0x8cf5('0x4b')]);_0x186183[_0x8cf5('0x4c')]=_['intersection'](_0x186183['model'],_0x186183[_0x8cf5('0x4b')]);_0x3f6838[_0x8cf5('0x4d')]=_[_0x8cf5('0x4e')](_0x186183[_0x8cf5('0x4f')],qs[_0x8cf5('0x50')](_0x2da74e['query']['fields']));_0x3f6838[_0x8cf5('0x4d')]=_0x3f6838[_0x8cf5('0x4d')][_0x8cf5('0x51')]?_0x3f6838[_0x8cf5('0x4d')]:_0x186183[_0x8cf5('0x4f')];_0x3f6838[_0x8cf5('0x53')]=qs[_0x8cf5('0x54')](_0x2da74e['query'][_0x8cf5('0x54')]);_0x3f6838['where']=qs[_0x8cf5('0x4c')](_['pick'](_0x2da74e[_0x8cf5('0x4b')],_0x186183[_0x8cf5('0x4c')]));if(_0x2da74e[_0x8cf5('0x4b')]['filter']){_0x3f6838['where']=_[_0x8cf5('0x57')](_0x3f6838[_0x8cf5('0x56')],{'$or':_['map'](_0x3f6838[_0x8cf5('0x4d')],function(_0x49d293){var _0x5cd121={};_0x5cd121[_0x49d293]={'$like':'%'+_0x2da74e[_0x8cf5('0x4b')]['filter']+'%'};return _0x5cd121;})});}_0x3f6838=_['merge']({},_0x3f6838,_0x2da74e[_0x8cf5('0x59')]);return _0xe96a2d[_0x8cf5('0x113')](_0x3f6838);}})['then'](function(_0x3d82e9){if(_0x3d82e9){_0x538b9d=_0x3d82e9[_0x8cf5('0x51')];if(!_0x2da74e[_0x8cf5('0x4b')][_0x8cf5('0x6e')](_0x8cf5('0x52'))){_0x3f6838['limit']=qs[_0x8cf5('0x35')](_0x2da74e[_0x8cf5('0x4b')][_0x8cf5('0x35')]);_0x3f6838[_0x8cf5('0x34')]=qs[_0x8cf5('0x34')](_0x2da74e[_0x8cf5('0x4b')][_0x8cf5('0x34')]);}return _0xe96a2d['getApplications'](_0x3f6838);}})[_0x8cf5('0x25')](function(_0x5a346b){if(_0x5a346b){return _0x5a346b?{'count':_0x538b9d,'rows':_0x5a346b}:null;}})[_0x8cf5('0x25')](respondWithResult(_0x473573,null))[_0x8cf5('0x2f')](handleError(_0x473573,null));};exports[_0x8cf5('0x114')]=function(_0x4f22c8,_0x5a759c,_0x5c4a1e){return db[_0x8cf5('0x115')]['find']({'where':{'id':_0x4f22c8[_0x8cf5('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5a759c,null))['then'](function(_0x13751a){if(_0x13751a){return _0x13751a[_0x8cf5('0x114')](_0x4f22c8[_0x8cf5('0x6a')][_0x8cf5('0x71')],_[_0x8cf5('0xeb')](_0x4f22c8[_0x8cf5('0x6a')],['ids','id'])||{});}})[_0x8cf5('0x25')](respondWithResult(_0x5a759c,null))[_0x8cf5('0x2f')](handleError(_0x5a759c,null));};exports[_0x8cf5('0xff')]=function(_0x437e24,_0x11cbc4,_0x224dca){var _0x21c9a7={};var _0x378ccb={};var _0x15b497;var _0x1aae34;return db[_0x8cf5('0x46')][_0x8cf5('0x6d')]({'where':{'id':_0x437e24[_0x8cf5('0x5f')]['id']}})['then'](handleEntityNotFound(_0x11cbc4,null))['then'](function(_0x289720){if(_0x289720){_0x15b497=_0x289720;_0x378ccb[_0x8cf5('0x4f')]=_['keys'](db[_0x8cf5('0x116')]['rawAttributes']);_0x378ccb[_0x8cf5('0x4b')]=_[_0x8cf5('0x61')](_0x437e24['query']);_0x378ccb[_0x8cf5('0x4c')]=_[_0x8cf5('0x4e')](_0x378ccb[_0x8cf5('0x4f')],_0x378ccb[_0x8cf5('0x4b')]);_0x21c9a7[_0x8cf5('0x4d')]=_['intersection'](_0x378ccb[_0x8cf5('0x4f')],qs['fields'](_0x437e24['query'][_0x8cf5('0x50')]));_0x21c9a7['attributes']=_0x21c9a7[_0x8cf5('0x4d')][_0x8cf5('0x51')]?_0x21c9a7[_0x8cf5('0x4d')]:_0x378ccb['model'];_0x21c9a7[_0x8cf5('0x53')]=qs[_0x8cf5('0x54')](_0x437e24[_0x8cf5('0x4b')][_0x8cf5('0x54')]);_0x21c9a7[_0x8cf5('0x56')]=qs[_0x8cf5('0x4c')](_[_0x8cf5('0x6f')](_0x437e24[_0x8cf5('0x4b')],_0x378ccb[_0x8cf5('0x4c')]));if(_0x437e24[_0x8cf5('0x4b')][_0x8cf5('0x55')]){_0x21c9a7['where']=_[_0x8cf5('0x57')](_0x21c9a7['where'],{'$or':_[_0x8cf5('0x45')](_0x21c9a7[_0x8cf5('0x4d')],function(_0x272404){var _0x29b6b8={};_0x29b6b8[_0x272404]={'$like':'%'+_0x437e24[_0x8cf5('0x4b')][_0x8cf5('0x55')]+'%'};return _0x29b6b8;})});}_0x21c9a7=_[_0x8cf5('0x57')]({},_0x21c9a7,_0x437e24[_0x8cf5('0x59')]);return _0x15b497['getProactiveActions'](_0x21c9a7);}})[_0x8cf5('0x25')](function(_0x4ac4bd){if(_0x4ac4bd){_0x1aae34=_0x4ac4bd[_0x8cf5('0x51')];if(!_0x437e24[_0x8cf5('0x4b')][_0x8cf5('0x6e')](_0x8cf5('0x52'))){_0x21c9a7[_0x8cf5('0x35')]=qs[_0x8cf5('0x35')](_0x437e24[_0x8cf5('0x4b')][_0x8cf5('0x35')]);_0x21c9a7[_0x8cf5('0x34')]=qs[_0x8cf5('0x34')](_0x437e24['query'][_0x8cf5('0x34')]);}return _0x15b497['getProactiveActions'](_0x21c9a7);}})[_0x8cf5('0x25')](function(_0x210b3d){if(_0x210b3d){return _0x210b3d?{'count':_0x1aae34,'rows':_0x210b3d}:null;}})[_0x8cf5('0x25')](respondWithResult(_0x11cbc4,null))[_0x8cf5('0x2f')](handleError(_0x11cbc4,null));};exports[_0x8cf5('0x117')]=function(_0x51bdb1,_0x20fdfb,_0xa72693){var _0x371a25=_0x51bdb1[_0x8cf5('0x4b')][_0x8cf5('0x118')]===_0x8cf5('0x119')?_0x8cf5('0x11a'):_0x8cf5('0x11b');return db['ChatWebsite'][_0x8cf5('0x62')]({'attributes':['id',_0x371a25],'where':{'id':_0x51bdb1[_0x8cf5('0x5f')]['id']}})[_0x8cf5('0x25')](handleEntityNotFound(_0x20fdfb,null))[_0x8cf5('0x25')](function(_0x17140f){if(_0x17140f){var _0x29a9e7=_0x17140f[_0x371a25];var _0x1bf4c2=_0x29a9e7&&_0x29a9e7[_0x8cf5('0x11c')]?_0x29a9e7['items']:[];_0x20fdfb[_0x8cf5('0x42')]({'fromKey':_[_0x8cf5('0x86')](_0x29a9e7[_0x8cf5('0x11d')])?undefined:_0x29a9e7[_0x8cf5('0x11d')],'count':_0x1bf4c2[_0x8cf5('0x51')],'rows':_0x1bf4c2});}})[_0x8cf5('0x2f')](handleError(_0x20fdfb,null));};exports[_0x8cf5('0x11e')]=function(_0x4f738c,_0x360b2a,_0xb07cd6){var _0x3e6eb9={'raw':![],'where':{}};var _0x7ba46d={};var _0x1ded78={'count':0x0,'rows':[]};return db[_0x8cf5('0x46')][_0x8cf5('0x6d')]({'where':{'id':_0x4f738c[_0x8cf5('0x5f')]['id']}})[_0x8cf5('0x25')](handleEntityNotFound(_0x360b2a,null))[_0x8cf5('0x25')](function(_0x1993fd){if(_0x1993fd){_0x7ba46d[_0x8cf5('0x4f')]=_[_0x8cf5('0x61')](db[_0x8cf5('0x11f')]['rawAttributes']);_0x7ba46d['query']=_[_0x8cf5('0x61')](_0x4f738c[_0x8cf5('0x4b')]);_0x7ba46d[_0x8cf5('0x4c')]=_['intersection'](_0x7ba46d[_0x8cf5('0x4f')],_0x7ba46d[_0x8cf5('0x4b')]);_0x3e6eb9[_0x8cf5('0x4d')]=_[_0x8cf5('0x4e')](_0x7ba46d[_0x8cf5('0x4f')],qs[_0x8cf5('0x50')](_0x4f738c[_0x8cf5('0x4b')][_0x8cf5('0x50')]));_0x3e6eb9['attributes']=_0x3e6eb9[_0x8cf5('0x4d')][_0x8cf5('0x51')]?_0x3e6eb9[_0x8cf5('0x4d')]:_0x7ba46d[_0x8cf5('0x4f')];if(!_0x4f738c[_0x8cf5('0x4b')]['hasOwnProperty'](_0x8cf5('0x52'))){_0x3e6eb9[_0x8cf5('0x35')]=qs['limit'](_0x4f738c['query'][_0x8cf5('0x35')]);_0x3e6eb9[_0x8cf5('0x34')]=qs['offset'](_0x4f738c[_0x8cf5('0x4b')][_0x8cf5('0x34')]);}_0x3e6eb9[_0x8cf5('0x53')]=qs[_0x8cf5('0x54')](_0x4f738c[_0x8cf5('0x4b')]['sort']);_0x3e6eb9[_0x8cf5('0x56')]=qs[_0x8cf5('0x4c')](_[_0x8cf5('0x6f')](_0x4f738c['query'],_0x7ba46d[_0x8cf5('0x4c')]));_0x3e6eb9['where']['ChatWebsiteId']=_0x1993fd['id'];if(_0x4f738c['query']['filter']){_0x3e6eb9[_0x8cf5('0x56')]=_[_0x8cf5('0x57')](_0x3e6eb9[_0x8cf5('0x56')],{'$or':_[_0x8cf5('0x45')](_0x3e6eb9[_0x8cf5('0x4d')],function(_0x5ed0e0){var _0x35d892={};_0x35d892[_0x5ed0e0]={'$like':'%'+_0x4f738c[_0x8cf5('0x4b')][_0x8cf5('0x55')]+'%'};return _0x35d892;})});}_0x3e6eb9=_[_0x8cf5('0x57')]({},_0x3e6eb9,_0x4f738c[_0x8cf5('0x59')]);return db[_0x8cf5('0x11f')][_0x8cf5('0x33')]({'where':_0x3e6eb9[_0x8cf5('0x56')]})['then'](function(_0x18dd98){_0x1ded78[_0x8cf5('0x33')]=_0x18dd98;if(_0x4f738c[_0x8cf5('0x4b')][_0x8cf5('0x5a')]){_0x3e6eb9['include']=[{'all':!![]}];}else{_0x3e6eb9[_0x8cf5('0x5b')]=[{'model':db[_0x8cf5('0x97')],'as':_0x8cf5('0x120'),'required':![]}];}return db[_0x8cf5('0x11f')]['findAll'](_0x3e6eb9);})[_0x8cf5('0x25')](function(_0x1d115a){_0x1ded78['rows']=_0x1d115a;return _0x1ded78;});}})['then'](respondWithFilteredResult(_0x360b2a,_0x3e6eb9))['catch'](handleError(_0x360b2a,null));};exports['addAgents']=function(_0x9c4383,_0x32539b,_0x836dd5){return db[_0x8cf5('0x46')]['find']({'where':{'id':_0x9c4383['params']['id']}})[_0x8cf5('0x25')](handleEntityNotFound(_0x32539b,null))['then'](function(_0x4e0f64){if(_0x4e0f64){return _0x4e0f64[_0x8cf5('0x121')](_0x9c4383['body'][_0x8cf5('0x71')],_[_0x8cf5('0xeb')](_0x9c4383['body'],[_0x8cf5('0x71'),'id'])||{})[_0x8cf5('0xd7')](function(_0x3daefc){for(var _0x12362a=0x0;_0x12362a<_0x9c4383['body'][_0x8cf5('0x71')][_0x8cf5('0x51')];_0x12362a+=0x1){socket[_0x8cf5('0x122')](_0x8cf5('0x123'),{'UserId':_0x9c4383[_0x8cf5('0x6a')][_0x8cf5('0x71')][_0x12362a],'ChatWebsiteId':_0x9c4383[_0x8cf5('0x5f')]['id']});}return _0x3daefc;});}})[_0x8cf5('0x25')](respondWithResult(_0x32539b,null))['catch'](handleError(_0x32539b,null));};exports[_0x8cf5('0x124')]=function(_0x314d92,_0x550fce,_0x3e896b){return db['ChatWebsite'][_0x8cf5('0x62')]({'where':{'id':_0x314d92[_0x8cf5('0x5f')]['id']}})[_0x8cf5('0x25')](handleEntityNotFound(_0x550fce,null))[_0x8cf5('0x25')](function(_0x2b27db){if(_0x2b27db){return _0x2b27db[_0x8cf5('0x124')](_0x314d92[_0x8cf5('0x4b')][_0x8cf5('0x71')])[_0x8cf5('0x25')](function(){if(_['isArray'](_0x314d92[_0x8cf5('0x4b')]['ids'])){for(var _0x59b24d=0x0;_0x59b24d<_0x314d92['query'][_0x8cf5('0x71')][_0x8cf5('0x51')];_0x59b24d+=0x1){socket['emit'](_0x8cf5('0x125'),{'UserId':Number(_0x314d92['query'][_0x8cf5('0x71')][_0x59b24d]),'ChatWebsiteId':Number(_0x314d92['params']['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x314d92[_0x8cf5('0x4b')]['ids']),'ChatWebsiteId':Number(_0x314d92[_0x8cf5('0x5f')]['id'])});}});}})[_0x8cf5('0x25')](respondWithStatusCode(_0x550fce,null))[_0x8cf5('0x2f')](handleError(_0x550fce,null));};exports[_0x8cf5('0x126')]=function(_0x48eb2e,_0x129b36,_0x11e9e0){var _0x1b0c7c={};var _0xf2d53={};var _0x21cd85;var _0x1deae6;return db[_0x8cf5('0x46')][_0x8cf5('0x6d')]({'where':{'id':_0x48eb2e[_0x8cf5('0x5f')]['id']}})[_0x8cf5('0x25')](handleEntityNotFound(_0x129b36,null))['then'](function(_0xa613b8){if(_0xa613b8){_0x21cd85=_0xa613b8;_0xf2d53['model']=_[_0x8cf5('0x61')](db['User'][_0x8cf5('0x47')]);_0xf2d53[_0x8cf5('0x4b')]=_['keys'](_0x48eb2e[_0x8cf5('0x4b')]);_0xf2d53['filters']=_[_0x8cf5('0x4e')](_0xf2d53['model'],_0xf2d53['query']);_0x1b0c7c['attributes']=_[_0x8cf5('0x4e')](_0xf2d53[_0x8cf5('0x4f')],qs[_0x8cf5('0x50')](_0x48eb2e[_0x8cf5('0x4b')][_0x8cf5('0x50')]));_0x1b0c7c[_0x8cf5('0x4d')]=_0x1b0c7c[_0x8cf5('0x4d')][_0x8cf5('0x51')]?_0x1b0c7c[_0x8cf5('0x4d')]:_0xf2d53[_0x8cf5('0x4f')];_0x1b0c7c[_0x8cf5('0x53')]=qs[_0x8cf5('0x54')](_0x48eb2e[_0x8cf5('0x4b')][_0x8cf5('0x54')]);_0x1b0c7c[_0x8cf5('0x56')]=qs['filters'](_[_0x8cf5('0x6f')](_0x48eb2e[_0x8cf5('0x4b')],_0xf2d53[_0x8cf5('0x4c')]));if(_0x48eb2e[_0x8cf5('0x4b')][_0x8cf5('0x55')]){_0x1b0c7c[_0x8cf5('0x56')]=_['merge'](_0x1b0c7c[_0x8cf5('0x56')],{'$or':_[_0x8cf5('0x45')](_0x1b0c7c['attributes'],function(_0x322418){var _0x415b81={};_0x415b81[_0x322418]={'$like':'%'+_0x48eb2e['query']['filter']+'%'};return _0x415b81;})});}_0x1b0c7c=_['merge']({},_0x1b0c7c,_0x48eb2e[_0x8cf5('0x59')]);return _0x21cd85[_0x8cf5('0x126')](_0x1b0c7c);}})['then'](function(_0x397ecf){if(_0x397ecf){_0x1deae6=_0x397ecf['length'];if(!_0x48eb2e[_0x8cf5('0x4b')][_0x8cf5('0x6e')](_0x8cf5('0x52'))){_0x1b0c7c[_0x8cf5('0x35')]=qs[_0x8cf5('0x35')](_0x48eb2e[_0x8cf5('0x4b')][_0x8cf5('0x35')]);_0x1b0c7c[_0x8cf5('0x34')]=qs[_0x8cf5('0x34')](_0x48eb2e[_0x8cf5('0x4b')][_0x8cf5('0x34')]);}return _0x21cd85['getAgents'](_0x1b0c7c);}})['then'](function(_0x4dbbf3){if(_0x4dbbf3){return _0x4dbbf3?{'count':_0x1deae6,'rows':_0x4dbbf3}:null;}})[_0x8cf5('0x25')](respondWithResult(_0x129b36,null))['catch'](handleError(_0x129b36,null));}; \ No newline at end of file +var _0x7211=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','keys','rawAttributes','includeAll','create','body','user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions','findOne','ChatWebsiteId','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','sitepic','file','filename','agentAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','headers','user-agent','getResult','chat','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','ChatApplication','Applications','List','account','applications','priority','asc','Contacts','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','vendor','threadId','ChatInteraction','externalUrl','interaction','spread','contact','messageId','created','push','close','unmanaged','*,*,*,*','UserId','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','offline','send','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','defaults','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','Contact','User','Owner','fullname','internal','Tag','Tags','tag','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','ONLINE','OFFLINE','No\x20timezone','getSnippet','Interval','Intervals','getProactiveActions','getLicense','virtual','License','increment','chatLicenseExceeded','some','readFileSync','server/files/chat/iframe.js','remote','x-real-ip','connection','remoteAddress','replace','alignment','color','addApplications','sequelize','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','online','offlineForm','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','get','ChatWebsites','UserProfileResource','end','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','type','key','model'];(function(_0x3ad9b3,_0x5c76e9){var _0x4ef8d1=function(_0x239036){while(--_0x239036){_0x3ad9b3['push'](_0x3ad9b3['shift']());}};_0x4ef8d1(++_0x5c76e9);}(_0x7211,0x1e9));var _0x1721=function(_0x4c7511,_0x439aff){_0x4c7511=_0x4c7511-0x0;var _0x3867b0=_0x7211[_0x4c7511];return _0x3867b0;};'use strict';var pdf=require(_0x1721('0x0'));var emlformat=require(_0x1721('0x1'));var rimraf=require(_0x1721('0x2'));var zipdir=require(_0x1721('0x3'));var jsonpatch=require(_0x1721('0x4'));var rp=require(_0x1721('0x5'));var moment=require(_0x1721('0x6'));var BPromise=require(_0x1721('0x7'));var Mustache=require(_0x1721('0x8'));var util=require('util');var path=require(_0x1721('0x9'));var sox=require(_0x1721('0xa'));var csv=require(_0x1721('0xb'));var ejs=require(_0x1721('0xc'));var fs=require('fs');var _=require(_0x1721('0xd'));var squel=require(_0x1721('0xe'));var crypto=require(_0x1721('0xf'));var jsforce=require(_0x1721('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x1721('0xb'));var querystring=require(_0x1721('0x11'));var Papa=require(_0x1721('0x12'));var Redis=require('ioredis');var authService=require(_0x1721('0x13'));var qs=require(_0x1721('0x14'));var as=require(_0x1721('0x15'));var hardwareService=require(_0x1721('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x1721('0x17'));var config=require(_0x1721('0x18'));var db=require(_0x1721('0x19'))['db'];config[_0x1721('0x1a')]=_['defaults'](config[_0x1721('0x1a')],{'host':_0x1721('0x1b'),'port':0x18eb});var socket=require(_0x1721('0x1c'))(new Redis(config[_0x1721('0x1a')]));require(_0x1721('0x1d'))[_0x1721('0x1e')](socket);var jayson=require(_0x1721('0x1f'));var client=jayson[_0x1721('0x20')][_0x1721('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x1721('0x21')]({'port':0x232a});var client9003=jayson[_0x1721('0x20')][_0x1721('0x21')]({'port':0x232b});function checkPasswordPattern(_0x21400a,_0x410dcf,_0x234259){if(_0x234259){var _0x185106=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x185106[_0x1721('0x22')](_0x410dcf)){return _0x21400a;}else{throw new db['Sequelize'][(_0x1721('0x23'))](_0x1721('0x24'));}}else{return _0x21400a;}}function respondWithRpcPromise(_0x31bfde,_0x29ccea,_0xf19dc0,_0x1a9342){return new BPromise(function(_0x352f83,_0x351616){var _0x422488=_0x1a9342||client;return _0x422488['request'](_0x31bfde,_0xf19dc0)[_0x1721('0x25')](function(_0x2b1857){logger[_0x1721('0x26')](_0x1721('0x27'),_0x29ccea,_0x1721('0x28'));logger[_0x1721('0x29')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x29ccea,_0x1721('0x28'),JSON[_0x1721('0x2a')](_0x2b1857));if(_0x2b1857['error']){if(_0x2b1857[_0x1721('0x2b')][_0x1721('0x2c')]===0x1f4){logger['error'](_0x1721('0x27'),_0x29ccea,_0x2b1857['error'][_0x1721('0x2d')]);return _0x351616(_0x2b1857[_0x1721('0x2b')][_0x1721('0x2d')]);}logger['error'](_0x1721('0x27'),_0x29ccea,_0x2b1857['error'][_0x1721('0x2d')]);return _0x352f83(_0x2b1857[_0x1721('0x2b')][_0x1721('0x2d')]);}else{logger['info'](_0x1721('0x27'),_0x29ccea,'request\x20sent');_0x352f83(_0x2b1857[_0x1721('0x2e')][_0x1721('0x2d')]);}})[_0x1721('0x2f')](function(_0x36c908){logger[_0x1721('0x2b')]('ChatWebsite,\x20%s,\x20%s',_0x29ccea,_0x36c908);_0x351616(_0x36c908);});});}function respondWithStatusCode(_0x4ea030,_0x907bec){_0x907bec=_0x907bec||0xcc;return function(_0x42eb84){if(_0x42eb84){return _0x4ea030[_0x1721('0x30')](_0x907bec);}return _0x4ea030[_0x1721('0x31')](_0x907bec)['end']();};}function respondWithResult(_0x57114b,_0x266f67){_0x266f67=_0x266f67||0xc8;return function(_0x36629){if(_0x36629){return _0x57114b[_0x1721('0x31')](_0x266f67)[_0x1721('0x32')](_0x36629);}};}function respondWithFilteredResult(_0x397b87,_0x22be4c){return function(_0x301c27){if(_0x301c27){var _0x5cee6f=_0x301c27[_0x1721('0x33')],_0x30fc7d=_0x22be4c[_0x1721('0x34')],_0x191b92=_0x22be4c[_0x1721('0x34')]+_0x22be4c[_0x1721('0x35')],_0x2d5936;if(_0x191b92>=_0x5cee6f){_0x191b92=_0x5cee6f;_0x2d5936=0xc8;}else{_0x2d5936=0xce;}_0x397b87[_0x1721('0x31')](_0x2d5936);return _0x397b87[_0x1721('0x36')](_0x1721('0x37'),_0x30fc7d+'-'+_0x191b92+'/'+_0x5cee6f)['json'](_0x301c27);}return null;};}function patchUpdates(_0xa2220b){return function(_0x101f59){try{jsonpatch[_0x1721('0x38')](_0x101f59,_0xa2220b,!![]);}catch(_0x497eb2){return BPromise['reject'](_0x497eb2);}return _0x101f59[_0x1721('0x39')]();};}function saveUpdates(_0x581e41,_0x19187c){return function(_0x371c2d){if(_0x371c2d){return _0x371c2d[_0x1721('0x3a')](_0x581e41)['then'](function(_0x521455){return _0x521455;});}return null;};}function removeEntity(_0x31cbda,_0x5453d8){return function(_0x219b76){if(_0x219b76){return _0x219b76[_0x1721('0x3b')]()['then'](function(){var _0x67d6b0=_0x219b76[_0x1721('0x3c')]({'plain':!![]});var _0x29a053=_0x1721('0x3d');return db[_0x1721('0x3e')]['destroy']({'where':{'type':_0x29a053,'resourceId':_0x67d6b0['id']}})['then'](function(){return _0x219b76;});})[_0x1721('0x25')](function(){_0x31cbda[_0x1721('0x31')](0xcc)[_0x1721('0x3f')]();});}};}function handleEntityNotFound(_0x2d564e,_0x3ea961){return function(_0xa3841a){if(!_0xa3841a){_0x2d564e['sendStatus'](0x194);}return _0xa3841a;};}function handleError(_0x25c4ef,_0x209939){_0x209939=_0x209939||0x1f4;return function(_0x5ccfd6){logger[_0x1721('0x2b')](_0x5ccfd6['stack']);if(_0x5ccfd6[_0x1721('0x40')]){delete _0x5ccfd6[_0x1721('0x40')];}_0x25c4ef[_0x1721('0x31')](_0x209939)['send'](_0x5ccfd6);};}exports[_0x1721('0x41')]=function(_0x26a966,_0x367b65){var _0x5d1cab={'include':[{'model':db[_0x1721('0x42')],'as':_0x1721('0x43')}]},_0x290ca0={},_0x252af9={'count':0x0,'rows':[]};var _0x376726=_[_0x1721('0x44')](db[_0x1721('0x45')]['rawAttributes'],function(_0x1be5e8){return{'name':_0x1be5e8['fieldName'],'type':_0x1be5e8[_0x1721('0x46')][_0x1721('0x47')]};});_0x290ca0[_0x1721('0x48')]=_[_0x1721('0x44')](_0x376726,_0x1721('0x40'));_0x290ca0[_0x1721('0x49')]=_['keys'](_0x26a966['query']);_0x290ca0[_0x1721('0x4a')]=_[_0x1721('0x4b')](_0x290ca0[_0x1721('0x48')],_0x290ca0[_0x1721('0x49')]);_0x5d1cab[_0x1721('0x4c')]=_['intersection'](_0x290ca0[_0x1721('0x48')],qs[_0x1721('0x4d')](_0x26a966[_0x1721('0x49')][_0x1721('0x4d')]));_0x5d1cab[_0x1721('0x4c')]=_0x5d1cab[_0x1721('0x4c')][_0x1721('0x4e')]?_0x5d1cab[_0x1721('0x4c')]:_0x290ca0[_0x1721('0x48')];if(!_0x26a966['query'][_0x1721('0x4f')](_0x1721('0x50'))){_0x5d1cab[_0x1721('0x35')]=qs[_0x1721('0x35')](_0x26a966[_0x1721('0x49')]['limit']);_0x5d1cab[_0x1721('0x34')]=qs[_0x1721('0x34')](_0x26a966[_0x1721('0x49')][_0x1721('0x34')]);}_0x5d1cab[_0x1721('0x51')]=qs[_0x1721('0x52')](_0x26a966['query'][_0x1721('0x52')]);_0x5d1cab[_0x1721('0x53')]=qs[_0x1721('0x4a')](_[_0x1721('0x54')](_0x26a966['query'],_0x290ca0[_0x1721('0x4a')]),_0x376726);if(_0x26a966[_0x1721('0x49')][_0x1721('0x55')]){_0x5d1cab['where']=_[_0x1721('0x56')](_0x5d1cab['where'],{'$or':_['map'](_0x376726,function(_0x371775){if(_0x371775['type']!==_0x1721('0x57')){var _0x18db9e={};_0x18db9e[_0x371775['name']]={'$like':'%'+_0x26a966[_0x1721('0x49')][_0x1721('0x55')]+'%'};return _0x18db9e;}})});}_0x5d1cab=_[_0x1721('0x56')]({},_0x5d1cab,_0x26a966[_0x1721('0x58')]);var _0xa17dd8={'where':_0x5d1cab['where']};return db['ChatWebsite'][_0x1721('0x33')](_0xa17dd8)[_0x1721('0x25')](function(_0x239081){_0x252af9[_0x1721('0x33')]=_0x239081;if(_0x26a966[_0x1721('0x49')]['includeAll']){_0x5d1cab[_0x1721('0x59')]=[{'all':!![]}];}return db[_0x1721('0x45')][_0x1721('0x5a')](_0x5d1cab);})['then'](function(_0x22b897){_0x252af9[_0x1721('0x5b')]=_0x22b897;return _0x252af9;})[_0x1721('0x25')](respondWithFilteredResult(_0x367b65,_0x5d1cab))[_0x1721('0x2f')](handleError(_0x367b65,null));};exports['show']=function(_0x2b0af3,_0x34b35c){var _0x518b14={'raw':![],'where':{'id':_0x2b0af3['params']['id']},'include':[{'model':db[_0x1721('0x42')],'as':_0x1721('0x43')}]},_0x3c6df4={};_0x3c6df4['model']=_[_0x1721('0x5c')](db[_0x1721('0x45')][_0x1721('0x5d')]);_0x3c6df4['query']=_[_0x1721('0x5c')](_0x2b0af3['query']);_0x3c6df4[_0x1721('0x4a')]=_[_0x1721('0x4b')](_0x3c6df4[_0x1721('0x48')],_0x3c6df4[_0x1721('0x49')]);_0x518b14[_0x1721('0x4c')]=_[_0x1721('0x4b')](_0x3c6df4['model'],qs[_0x1721('0x4d')](_0x2b0af3['query'][_0x1721('0x4d')]));_0x518b14[_0x1721('0x4c')]=_0x518b14[_0x1721('0x4c')]['length']?_0x518b14[_0x1721('0x4c')]:_0x3c6df4[_0x1721('0x48')];if(_0x2b0af3[_0x1721('0x49')][_0x1721('0x5e')]){_0x518b14[_0x1721('0x59')]=[{'all':!![]}];}_0x518b14=_[_0x1721('0x56')]({},_0x518b14,_0x2b0af3['options']);return db[_0x1721('0x45')]['find'](_0x518b14)[_0x1721('0x25')](handleEntityNotFound(_0x34b35c,null))[_0x1721('0x25')](respondWithResult(_0x34b35c,null))[_0x1721('0x2f')](handleError(_0x34b35c,null));};exports[_0x1721('0x5f')]=function(_0x9dcf9c,_0x5bff2d){return db[_0x1721('0x45')][_0x1721('0x5f')](_0x9dcf9c[_0x1721('0x60')],{})[_0x1721('0x25')](function(_0x1d6c80){var _0x17af17=_0x9dcf9c[_0x1721('0x61')][_0x1721('0x3c')]({'plain':!![]});if(!_0x17af17)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17af17[_0x1721('0x62')]==='user'){var _0x1cdc92=_0x1d6c80[_0x1721('0x3c')]({'plain':!![]});var _0x1734f4='ChatWebsites';return db[_0x1721('0x63')][_0x1721('0x64')]({'where':{'name':_0x1734f4,'userProfileId':_0x17af17['userProfileId']},'raw':!![]})[_0x1721('0x25')](function(_0x4ef1a5){if(_0x4ef1a5&&_0x4ef1a5[_0x1721('0x65')]===0x0){return db['UserProfileResource'][_0x1721('0x5f')]({'name':_0x1cdc92[_0x1721('0x40')],'resourceId':_0x1cdc92['id'],'type':_0x4ef1a5[_0x1721('0x40')],'sectionId':_0x4ef1a5['id']},{})[_0x1721('0x25')](function(){return _0x1d6c80;});}else{return _0x1d6c80;}})[_0x1721('0x2f')](function(_0x2e1747){logger[_0x1721('0x2b')](_0x1721('0x66'),_0x2e1747);throw _0x2e1747;});}return _0x1d6c80;})[_0x1721('0x25')](respondWithResult(_0x5bff2d,0xc9))['catch'](handleError(_0x5bff2d,null));};exports[_0x1721('0x3a')]=function(_0x2d6392,_0x456808){if(_0x2d6392['body']['id']){delete _0x2d6392[_0x1721('0x60')]['id'];}return db[_0x1721('0x45')][_0x1721('0x64')]({'where':{'id':_0x2d6392['params']['id']},'include':[{'model':db[_0x1721('0x42')],'as':_0x1721('0x43')}]})[_0x1721('0x25')](handleEntityNotFound(_0x456808,null))[_0x1721('0x25')](saveUpdates(_0x2d6392[_0x1721('0x60')],null))[_0x1721('0x25')](respondWithResult(_0x456808,null))[_0x1721('0x2f')](handleError(_0x456808,null));};exports[_0x1721('0x3b')]=function(_0x3f4287,_0x22ab3c){return db[_0x1721('0x45')][_0x1721('0x64')]({'where':{'id':_0x3f4287[_0x1721('0x67')]['id']}})[_0x1721('0x25')](handleEntityNotFound(_0x22ab3c,null))[_0x1721('0x25')](removeEntity(_0x22ab3c,null))[_0x1721('0x2f')](handleError(_0x22ab3c,null));};exports[_0x1721('0x68')]=function(_0x4d96df,_0x3991dc){return db[_0x1721('0x45')][_0x1721('0x68')]()[_0x1721('0x25')](respondWithResult(_0x3991dc,null))[_0x1721('0x2f')](handleError(_0x3991dc,null));};exports[_0x1721('0x69')]=function(_0x3f9882,_0x5e2ae7,_0x2aa310){if(_0x3f9882[_0x1721('0x60')]['id']){delete _0x3f9882[_0x1721('0x60')]['id'];}return db[_0x1721('0x45')][_0x1721('0x64')]({'where':{'id':_0x3f9882[_0x1721('0x67')]['id']}})[_0x1721('0x25')](handleEntityNotFound(_0x5e2ae7,null))[_0x1721('0x25')](function(_0x464d15){if(_0x464d15){_0x3f9882[_0x1721('0x60')]['ChatWebsiteId']=_0x464d15['id'];return db[_0x1721('0x6a')][_0x1721('0x5f')](_0x3f9882['body']);}})[_0x1721('0x25')](respondWithResult(_0x5e2ae7,null))[_0x1721('0x2f')](handleError(_0x5e2ae7,null));};exports[_0x1721('0x6b')]=function(_0x25403a,_0x4ee5f9,_0x23e8ac){var _0x59c1ab={'raw':![],'where':{}};var _0x1eb8fb={};var _0x66b409={'count':0x0,'rows':[]};return db[_0x1721('0x45')][_0x1721('0x6c')]({'where':{'id':_0x25403a[_0x1721('0x67')]['id']}})[_0x1721('0x25')](handleEntityNotFound(_0x4ee5f9,null))['then'](function(_0xaa2113){if(_0xaa2113){_0x1eb8fb[_0x1721('0x48')]=_[_0x1721('0x5c')](db['Disposition']['rawAttributes']);_0x1eb8fb[_0x1721('0x49')]=_['keys'](_0x25403a['query']);_0x1eb8fb[_0x1721('0x4a')]=_['intersection'](_0x1eb8fb[_0x1721('0x48')],_0x1eb8fb[_0x1721('0x49')]);_0x59c1ab[_0x1721('0x4c')]=_[_0x1721('0x4b')](_0x1eb8fb['model'],qs[_0x1721('0x4d')](_0x25403a[_0x1721('0x49')][_0x1721('0x4d')]));_0x59c1ab['attributes']=_0x59c1ab['attributes'][_0x1721('0x4e')]?_0x59c1ab[_0x1721('0x4c')]:_0x1eb8fb[_0x1721('0x48')];if(!_0x25403a[_0x1721('0x49')][_0x1721('0x4f')](_0x1721('0x50'))){_0x59c1ab[_0x1721('0x35')]=qs[_0x1721('0x35')](_0x25403a[_0x1721('0x49')]['limit']);_0x59c1ab[_0x1721('0x34')]=qs[_0x1721('0x34')](_0x25403a[_0x1721('0x49')]['offset']);}_0x59c1ab[_0x1721('0x51')]=qs[_0x1721('0x52')](_0x25403a[_0x1721('0x49')][_0x1721('0x52')]);_0x59c1ab[_0x1721('0x53')]=qs[_0x1721('0x4a')](_[_0x1721('0x54')](_0x25403a[_0x1721('0x49')],_0x1eb8fb['filters']));_0x59c1ab['where'][_0x1721('0x6d')]=_0xaa2113['id'];if(_0x25403a[_0x1721('0x49')]['filter']){_0x59c1ab[_0x1721('0x53')]=_[_0x1721('0x56')](_0x59c1ab[_0x1721('0x53')],{'$or':_[_0x1721('0x44')](_0x59c1ab['attributes'],function(_0x234d65){var _0x4a993c={};_0x4a993c[_0x234d65]={'$like':'%'+_0x25403a['query'][_0x1721('0x55')]+'%'};return _0x4a993c;})});}_0x59c1ab=_[_0x1721('0x56')]({},_0x59c1ab,_0x25403a['options']);return db[_0x1721('0x6a')][_0x1721('0x33')]({'where':_0x59c1ab[_0x1721('0x53')]})[_0x1721('0x25')](function(_0x516467){_0x66b409['count']=_0x516467;if(_0x25403a[_0x1721('0x49')][_0x1721('0x5e')]){_0x59c1ab[_0x1721('0x59')]=[{'all':!![]}];}return db[_0x1721('0x6a')][_0x1721('0x5a')](_0x59c1ab);})['then'](function(_0x1e771c){_0x66b409['rows']=_0x1e771c;return _0x66b409;});}})[_0x1721('0x25')](respondWithFilteredResult(_0x4ee5f9,_0x59c1ab))[_0x1721('0x2f')](handleError(_0x4ee5f9,null));};exports[_0x1721('0x6e')]=function(_0x40ce08,_0x53d864,_0x3cd319){return db[_0x1721('0x45')][_0x1721('0x64')]({'where':{'id':_0x40ce08[_0x1721('0x67')]['id']}})[_0x1721('0x25')](handleEntityNotFound(_0x53d864,null))[_0x1721('0x25')](function(_0x461559){if(_0x461559){return _0x461559['removeDispositions'](_0x40ce08[_0x1721('0x49')][_0x1721('0x6f')]);}})[_0x1721('0x25')](respondWithStatusCode(_0x53d864,null))[_0x1721('0x2f')](handleError(_0x53d864,null));};exports['addAnswer']=function(_0x121304,_0x590da2,_0x3a7e57){if(_0x121304['body']['id']){delete _0x121304[_0x1721('0x60')]['id'];}return db[_0x1721('0x45')][_0x1721('0x64')]({'where':{'id':_0x121304[_0x1721('0x67')]['id']}})[_0x1721('0x25')](handleEntityNotFound(_0x590da2,null))[_0x1721('0x25')](function(_0x3fc4f5){if(_0x3fc4f5){_0x121304[_0x1721('0x60')][_0x1721('0x6d')]=_0x3fc4f5['id'];return db['CannedAnswer'][_0x1721('0x5f')](_0x121304[_0x1721('0x60')]);}})[_0x1721('0x25')](respondWithResult(_0x590da2,null))[_0x1721('0x2f')](handleError(_0x590da2,null));};exports[_0x1721('0x70')]=function(_0x4a1f7f,_0x1a3c1d,_0x33154d){var _0x1ec356={'raw':![],'where':{}};var _0x2596ea={};var _0x235eba={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x4a1f7f[_0x1721('0x67')]['id']}})['then'](handleEntityNotFound(_0x1a3c1d,null))['then'](function(_0x551d73){if(_0x551d73){_0x2596ea[_0x1721('0x48')]=_[_0x1721('0x5c')](db[_0x1721('0x71')][_0x1721('0x5d')]);_0x2596ea[_0x1721('0x49')]=_['keys'](_0x4a1f7f[_0x1721('0x49')]);_0x2596ea['filters']=_[_0x1721('0x4b')](_0x2596ea[_0x1721('0x48')],_0x2596ea['query']);_0x1ec356['attributes']=_['intersection'](_0x2596ea['model'],qs[_0x1721('0x4d')](_0x4a1f7f[_0x1721('0x49')][_0x1721('0x4d')]));_0x1ec356[_0x1721('0x4c')]=_0x1ec356[_0x1721('0x4c')]['length']?_0x1ec356[_0x1721('0x4c')]:_0x2596ea[_0x1721('0x48')];if(!_0x4a1f7f[_0x1721('0x49')][_0x1721('0x4f')](_0x1721('0x50'))){_0x1ec356[_0x1721('0x35')]=qs[_0x1721('0x35')](_0x4a1f7f['query'][_0x1721('0x35')]);_0x1ec356[_0x1721('0x34')]=qs['offset'](_0x4a1f7f[_0x1721('0x49')][_0x1721('0x34')]);}_0x1ec356[_0x1721('0x51')]=qs[_0x1721('0x52')](_0x4a1f7f[_0x1721('0x49')][_0x1721('0x52')]);_0x1ec356[_0x1721('0x53')]=qs[_0x1721('0x4a')](_[_0x1721('0x54')](_0x4a1f7f[_0x1721('0x49')],_0x2596ea[_0x1721('0x4a')]));_0x1ec356['where'][_0x1721('0x6d')]=_0x551d73['id'];if(_0x4a1f7f['query'][_0x1721('0x55')]){_0x1ec356['where']=_[_0x1721('0x56')](_0x1ec356[_0x1721('0x53')],{'$or':_[_0x1721('0x44')](_0x1ec356[_0x1721('0x4c')],function(_0x23fc57){var _0x4549ad={};_0x4549ad[_0x23fc57]={'$like':'%'+_0x4a1f7f['query'][_0x1721('0x55')]+'%'};return _0x4549ad;})});}_0x1ec356=_[_0x1721('0x56')]({},_0x1ec356,_0x4a1f7f['options']);return db['CannedAnswer'][_0x1721('0x33')]({'where':_0x1ec356[_0x1721('0x53')]})[_0x1721('0x25')](function(_0x32be36){_0x235eba[_0x1721('0x33')]=_0x32be36;if(_0x4a1f7f['query'][_0x1721('0x5e')]){_0x1ec356['include']=[{'all':!![]}];}return db[_0x1721('0x71')][_0x1721('0x5a')](_0x1ec356);})[_0x1721('0x25')](function(_0x1560a9){_0x235eba[_0x1721('0x5b')]=_0x1560a9;return _0x235eba;});}})[_0x1721('0x25')](respondWithFilteredResult(_0x1a3c1d,_0x1ec356))['catch'](handleError(_0x1a3c1d,null));};exports[_0x1721('0x72')]=function(_0x57c36d,_0x588c65,_0x3e5fa9){return db[_0x1721('0x45')][_0x1721('0x64')]({'where':{'id':_0x57c36d[_0x1721('0x67')]['id']}})[_0x1721('0x25')](handleEntityNotFound(_0x588c65,null))[_0x1721('0x25')](function(_0x3b5569){if(_0x3b5569){return _0x3b5569[_0x1721('0x72')](_0x57c36d[_0x1721('0x49')][_0x1721('0x6f')]);}})[_0x1721('0x25')](respondWithStatusCode(_0x588c65,null))[_0x1721('0x2f')](handleError(_0x588c65,null));};exports['addLogo']=function(_0x3a422b,_0x1d31ff,_0x1eb18a){_0x3a422b[_0x1721('0x60')][_0x1721('0x73')]=_0x3a422b[_0x1721('0x74')][_0x1721('0x75')];return db[_0x1721('0x45')]['find']({'where':{'id':_0x3a422b[_0x1721('0x67')]['id']}})['then'](handleEntityNotFound(_0x1d31ff,null))[_0x1721('0x25')](saveUpdates(_0x3a422b[_0x1721('0x60')],null))[_0x1721('0x25')](respondWithResult(_0x1d31ff,null))['catch'](handleError(_0x1d31ff,null));};exports['addAvatar']=function(_0x500717,_0x1627bc,_0x465979){_0x500717['body'][_0x1721('0x76')]=_0x500717[_0x1721('0x74')]['filename'];return db['ChatWebsite'][_0x1721('0x64')]({'where':{'id':_0x500717['params']['id']}})[_0x1721('0x25')](handleEntityNotFound(_0x1627bc,null))['then'](saveUpdates(_0x500717['body'],null))[_0x1721('0x25')](respondWithResult(_0x1627bc,null))[_0x1721('0x2f')](handleError(_0x1627bc,null));};exports['addCustomerAvatar']=function(_0x5ee2da,_0x2101a5,_0x153506){_0x5ee2da[_0x1721('0x60')][_0x1721('0x77')]=_0x5ee2da[_0x1721('0x74')]['filename'];return db[_0x1721('0x45')][_0x1721('0x64')]({'where':{'id':_0x5ee2da['params']['id']}})[_0x1721('0x25')](handleEntityNotFound(_0x2101a5,null))[_0x1721('0x25')](saveUpdates(_0x5ee2da[_0x1721('0x60')],null))[_0x1721('0x25')](respondWithResult(_0x2101a5,null))['catch'](handleError(_0x2101a5,null));};exports[_0x1721('0x78')]=function(_0x120d62,_0x40bd70,_0x3ac4d6){_0x120d62[_0x1721('0x60')][_0x1721('0x79')]=_0x120d62[_0x1721('0x74')][_0x1721('0x75')];return db['ChatWebsite']['find']({'where':{'id':_0x120d62[_0x1721('0x67')]['id']}})[_0x1721('0x25')](handleEntityNotFound(_0x40bd70,null))[_0x1721('0x25')](saveUpdates(_0x120d62[_0x1721('0x60')],null))[_0x1721('0x25')](respondWithResult(_0x40bd70,null))[_0x1721('0x2f')](handleError(_0x40bd70,null));};exports['getLogo']=function(_0x4ebd25,_0x4c4712,_0x5b56db){var _0x12ac12=path[_0x1721('0x7a')](config[_0x1721('0x7b')],_0x1721('0x7c'));var _0x59afe2={'where':{'id':_0x4ebd25['params']['id']},'attributes':['id',_0x1721('0x73')],'raw':!![]};var _0x308873=![];return require(_0x1721('0x7d'))['getLicense']()[_0x1721('0x25')](function(_0x9e06f9){if(_0x9e06f9){_0x308873=_0x9e06f9[_0x1721('0x7e')];}})[_0x1721('0x25')](function(){return db[_0x1721('0x45')]['find'](_0x59afe2);})[_0x1721('0x25')](handleEntityNotFound(_0x4c4712,null))[_0x1721('0x25')](function(_0x41a311){if(_0x41a311){if(!_[_0x1721('0x7f')](_0x41a311[_0x1721('0x73')])){if(fs[_0x1721('0x80')](path[_0x1721('0x7a')](config[_0x1721('0x7b')],_0x1721('0x81'),_0x41a311[_0x1721('0x73')]))&&_0x308873){_0x12ac12=path[_0x1721('0x7a')](config[_0x1721('0x7b')],_0x1721('0x81'),_0x41a311[_0x1721('0x73')]);}}return _0x4c4712[_0x1721('0x82')](_0x12ac12);}})[_0x1721('0x2f')](handleError(_0x4c4712,null));};exports[_0x1721('0x83')]=function(_0x7adb89,_0x216e0a,_0x371c8f){var _0x3d92cb=path[_0x1721('0x7a')](config[_0x1721('0x7b')],_0x1721('0x84'));var _0x199f16={'where':{'id':_0x7adb89[_0x1721('0x67')]['id']},'attributes':['id',_0x1721('0x76')],'raw':!![]};return db[_0x1721('0x45')][_0x1721('0x64')](_0x199f16)[_0x1721('0x25')](handleEntityNotFound(_0x216e0a,null))[_0x1721('0x25')](function(_0x49bea6){if(_0x49bea6){if(!_[_0x1721('0x7f')](_0x49bea6[_0x1721('0x76')])){if(fs[_0x1721('0x80')](path[_0x1721('0x7a')](config[_0x1721('0x7b')],_0x1721('0x85'),_0x49bea6[_0x1721('0x76')]))){_0x3d92cb=path[_0x1721('0x7a')](config[_0x1721('0x7b')],_0x1721('0x85'),_0x49bea6[_0x1721('0x76')]);}}return _0x216e0a[_0x1721('0x82')](_0x3d92cb);}})['catch'](handleError(_0x216e0a,null));};exports['getCustomerAvatar']=function(_0x2822de,_0x53d9a3,_0x3ecb09){var _0x167220=path['join'](config[_0x1721('0x7b')],_0x1721('0x86'));var _0x266b88={'where':{'id':_0x2822de[_0x1721('0x67')]['id']},'attributes':['id',_0x1721('0x77'),_0x1721('0x87')],'raw':!![]};return db[_0x1721('0x45')][_0x1721('0x64')](_0x266b88)['then'](handleEntityNotFound(_0x53d9a3,null))['then'](function(_0xeb5a53){if(_0xeb5a53){if(!_[_0x1721('0x7f')](_0xeb5a53[_0x1721('0x77')])){if(fs[_0x1721('0x80')](path['join'](config[_0x1721('0x7b')],'server/files/images/avatars/',_0xeb5a53[_0x1721('0x77')]))&&_0xeb5a53[_0x1721('0x87')]){_0x167220=path[_0x1721('0x7a')](config['root'],_0x1721('0x85'),_0xeb5a53['customerAvatar']);}}return _0x53d9a3['download'](_0x167220);}})[_0x1721('0x2f')](handleError(_0x53d9a3,null));};exports[_0x1721('0x88')]=function(_0x462589,_0x6941c6,_0x1597e1){var _0x399d67=path[_0x1721('0x7a')](config[_0x1721('0x7b')],_0x1721('0x89'));var _0x2f38a2={'where':{'id':_0x462589[_0x1721('0x67')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x1721('0x45')][_0x1721('0x64')](_0x2f38a2)[_0x1721('0x25')](handleEntityNotFound(_0x6941c6,null))['then'](function(_0x303bc7){if(_0x303bc7){if(!_[_0x1721('0x7f')](_0x303bc7[_0x1721('0x79')])){if(fs[_0x1721('0x80')](path[_0x1721('0x7a')](config[_0x1721('0x7b')],'server/files/images/avatars/',_0x303bc7['systemAvatar']))){_0x399d67=path[_0x1721('0x7a')](config[_0x1721('0x7b')],'server/files/images/avatars/',_0x303bc7[_0x1721('0x79')]);}}return _0x6941c6[_0x1721('0x82')](_0x399d67);}})[_0x1721('0x2f')](handleError(_0x6941c6,null));};exports[_0x1721('0x8a')]=function(_0x404ef5,_0xe97192,_0x5b8f22){var _0x5257ae=require(_0x1721('0x8b'));var _0x2a8ff4=new _0x5257ae();var _0x18ed32=_0x2a8ff4['setUA'](_0x404ef5[_0x1721('0x8c')][_0x1721('0x8d')])[_0x1721('0x8e')]();var _0x1540dc={'body':_0x404ef5[_0x1721('0x60')],'channel':_0x1721('0x8f')};var _0x592ae1=[];var _0x42648d=[];var _0x858614={};var _0x59d579=![];return db[_0x1721('0x90')]['describe']()['then'](function(_0x24a95b){if(!_0x24a95b){throw new db[(_0x1721('0x91'))][(_0x1721('0x23'))](_0x1721('0x92'));}_0x592ae1=_[_0x1721('0x93')](_[_0x1721('0x5c')](_0x24a95b),['createdAt',_0x1721('0x94')]);_0x42648d=_['difference'](_[_0x1721('0x5c')](_0x24a95b),[_0x1721('0x95'),_0x1721('0x94'),_0x1721('0x96'),_0x1721('0x97')]);if(_0x404ef5[_0x1721('0x60')]['id']){delete _0x404ef5['body']['id'];}if(_['isNil'](_0x404ef5[_0x1721('0x60')][_0x1721('0x98')])){throw new db[(_0x1721('0x91'))][(_0x1721('0x23'))]('from\x20is\x20mandatory');}if(_[_0x1721('0x7f')](_0x404ef5[_0x1721('0x60')][_0x1721('0x60')])||_0x404ef5[_0x1721('0x60')]['body']===''){throw new db[(_0x1721('0x91'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1721('0x7f')](_0x404ef5['body'][_0x1721('0x99')])){throw new db['Sequelize'][(_0x1721('0x23'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x42648d);}if(!_[_0x1721('0x9a')](_0x42648d,_0x404ef5[_0x1721('0x60')][_0x1721('0x99')])){throw new db[(_0x1721('0x91'))][(_0x1721('0x23'))](_0x1721('0x9b')+_0x42648d);}_0x858614[_0x404ef5['body'][_0x1721('0x99')]]=_0x404ef5[_0x1721('0x60')][_0x1721('0x98')];})[_0x1721('0x25')](function(){return db['ChatWebsite'][_0x1721('0x64')]({'where':{'id':_0x404ef5['params']['id']},'include':[{'model':db[_0x1721('0x9c')],'as':'List','include':[{'model':db[_0x1721('0x90')],'as':'Contacts','where':_0x858614,'limit':0x1,'order':[['updatedAt',_0x1721('0x9d')]]}]},{'model':db[_0x1721('0x9e')],'as':_0x1721('0x9f')}]});})['then'](handleEntityNotFound(_0xe97192,null))[_0x1721('0x25')](function(_0x216226){if(_0x216226&&_0x216226[_0x1721('0xa0')]){_0x1540dc[_0x1721('0xa1')]=_0x216226;_0x1540dc[_0x1721('0xa2')]=_0x216226['Applications'];_0x1540dc['list']=_0x216226[_0x1721('0xa0')];_0x1540dc[_0x1721('0xa2')]=_['orderBy'](_0x1540dc[_0x1721('0xa2')],[_0x1721('0xa3')],[_0x1721('0xa4')]);if(_0x1540dc[_0x1721('0xa1')]['Applications']){delete _0x1540dc['account']['Applications'];}if(_0x1540dc[_0x1721('0xa1')]['List']&&_0x1540dc[_0x1721('0xa1')][_0x1721('0xa0')][_0x1721('0xa5')][_0x1721('0x4e')]){return _0x1540dc[_0x1721('0xa1')][_0x1721('0xa0')][_0x1721('0xa5')][0x0];}var _0x3024d0=_['defaults'](_0x404ef5[_0x1721('0x60')],{'firstName':_0x404ef5[_0x1721('0x60')][_0x1721('0x98')],'ListId':_0x216226[_0x1721('0x97')]});_0x3024d0[_0x404ef5[_0x1721('0x60')]['mapKey']]=_0x404ef5['body']['from'];return db[_0x1721('0x90')]['create'](_0x3024d0,{'fields':_0x592ae1,'raw':!![]});}})['then'](handleEntityNotFound(_0xe97192,null))['then'](function(_0x48112c){_0x1540dc['contact']=_0x48112c;var _0x578b5b=_0x404ef5['body'][_0x1721('0xa6')];if(_0x404ef5[_0x1721('0x8c')]['cf-connecting-ip']){_0x578b5b=_0x404ef5['headers'][_0x1721('0xa7')];}else if(_0x404ef5['headers'][_0x1721('0xa8')]){_0x578b5b=_[_0x1721('0xa9')](_0x404ef5[_0x1721('0x8c')][_0x1721('0xa8')][_0x1721('0xaa')](','));}if(_0x48112c){var _0x2c53a0={'ContactId':_0x48112c['id'],'ChatWebsiteId':_0x404ef5[_0x1721('0x67')]['id'],'from':(_0x48112c[_0x1721('0xab')]||'')+'\x20'+(_0x48112c[_0x1721('0xac')]||''),'customerIp':_0x578b5b,'customerPort':_0x404ef5[_0x1721('0x8c')][_0x1721('0xad')]?_0x404ef5[_0x1721('0x8c')][_0x1721('0xad')]:null,'referer':_0x404ef5['body']['referer'],'browserName':_0x18ed32[_0x1721('0xae')][_0x1721('0x40')]&&_0x18ed32[_0x1721('0xae')][_0x1721('0xaf')]?util[_0x1721('0xb0')](_0x1721('0xb1'),_0x18ed32[_0x1721('0xae')]['name'],_0x18ed32[_0x1721('0xae')][_0x1721('0xaf')]):_0x1721('0xb2'),'browserVersion':_0x18ed32[_0x1721('0xae')]['version']||'unknown','osName':util[_0x1721('0xb0')](_0x1721('0xb1'),_0x18ed32['os'][_0x1721('0x40')],_0x18ed32['os'][_0x1721('0xaf')]),'osVersion':_0x18ed32['os']['version'],'deviceModel':_0x18ed32['device'][_0x1721('0x48')]&&_0x18ed32[_0x1721('0xb3')][_0x1721('0xb4')]?util[_0x1721('0xb0')]('%s\x20%s\x20%s',_0x18ed32[_0x1721('0xb3')][_0x1721('0x48')],_0x18ed32['device'][_0x1721('0xb4')],_0x18ed32[_0x1721('0xb3')][_0x1721('0x46')]):null,'deviceVendor':_0x18ed32['device'][_0x1721('0xb4')],'deviceType':_0x18ed32[_0x1721('0xb3')][_0x1721('0x46')],'formData':JSON[_0x1721('0x2a')](_0x404ef5[_0x1721('0x60')])};var _0x286572={'ChatWebsiteId':_0x404ef5[_0x1721('0x67')]['id'],'closed':![]};if(_0x404ef5[_0x1721('0x60')][_0x1721('0xb5')]){_0x286572[_0x1721('0xb5')]=_0x404ef5['body'][_0x1721('0xb5')];return db[_0x1721('0xb6')][_0x1721('0x64')]({'where':_0x286572})['then'](function(_0x638394){if(_0x638394){return[_0x638394,![]];}_0x2c53a0['threadId']=_0x404ef5[_0x1721('0x60')]['threadId'];_0x2c53a0[_0x1721('0xb7')]=_0x404ef5['body'][_0x1721('0xb7')];return db[_0x1721('0xb6')][_0x1721('0x5f')](_0x2c53a0)[_0x1721('0x25')](function(_0x538d04){return[_0x538d04,!![]];});});}_0x286572['ContactId']=_0x48112c['id'];if(_0x404ef5[_0x1721('0x60')]['interaction']&&_0x404ef5[_0x1721('0x60')]['interaction']['id']){_0x286572['id']=_0x404ef5['body'][_0x1721('0xb8')]['id'];return db[_0x1721('0xb6')][_0x1721('0x64')]({'where':_0x286572})[_0x1721('0x25')](function(_0x45180e){if(_0x45180e){return[_0x45180e,![]];}return db[_0x1721('0xb6')]['create'](_0x2c53a0)[_0x1721('0x25')](function(_0xd722d3){return[_0xd722d3,!![]];});});}return db[_0x1721('0xb6')][_0x1721('0x5f')](_0x2c53a0)['then'](function(_0x5d557a){return[_0x5d557a,!![]];});}})[_0x1721('0xb9')](function(_0x5c2844,_0x57dc36){if(_0x5c2844){_0x59d579=_0x57dc36;if(!_0x57dc36){var _0x3edbca={'from':(_0x1540dc[_0x1721('0xba')][_0x1721('0xab')]||'')+'\x20'+(_0x1540dc[_0x1721('0xba')][_0x1721('0xac')]||'')};if(_0x404ef5[_0x1721('0x60')][_0x1721('0xb5')]&&_0x404ef5[_0x1721('0x60')][_0x1721('0xbb')]&&_0x404ef5['body'][_0x1721('0xb5')]!=_0x404ef5[_0x1721('0x60')][_0x1721('0xbb')]){_0x3edbca[_0x1721('0xb5')]=_0x404ef5[_0x1721('0x60')][_0x1721('0xbb')];}return _0x5c2844['update'](_0x3edbca);}else{return _0x5c2844;}}})[_0x1721('0x25')](function(_0x187925){_0x1540dc[_0x1721('0xb8')]=_0x187925['get']({'plain':!![]});_0x1540dc[_0x1721('0xb8')]['created']=_0x59d579;if(_0x1540dc[_0x1721('0xb8')][_0x1721('0xbc')]){if(_0x1540dc[_0x1721('0xa1')]['autoclose']){_0x1540dc[_0x1721('0xa2')][_0x1721('0xbd')]({'id':0x0,'priority':_0x1540dc[_0x1721('0xa2')]['length']+0x1,'app':_0x1721('0xbe'),'appdata':_0x1721('0xbf'),'interval':_0x1721('0xc0')});}}return db['ChatMessage']['create']({'body':_0x404ef5['body']['body'],'ChatWebsiteId':_0x404ef5[_0x1721('0x67')]['id'],'ChatInteractionId':_0x187925['id'],'direction':'in','ContactId':_0x1540dc[_0x1721('0xba')]['id'],'AttachmentId':_0x404ef5['body']['AttachmentId']});})[_0x1721('0x25')](function(_0x101a79){_0x1540dc[_0x1721('0x2d')]=_0x101a79;if(_0x1540dc[_0x1721('0xb8')][_0x1721('0xc1')]){return db['User'][_0x1721('0x64')]({'attributes':['id',_0x1721('0x40')],'where':{'id':_0x1540dc[_0x1721('0xb8')][_0x1721('0xc1')]}})[_0x1721('0x25')](function(_0x1c0c8c){if(_0x1c0c8c){_0x1540dc['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x1721('0xc2'),'appdata':_0x1c0c8c['name']+','+(_0x1540dc['account'][_0x1721('0xc3')]||0xa),'interval':_0x1721('0xc0')});_0x1540dc[_0x1721('0xc4')]=!![];}return respondWithRpcPromise('Start',_0x1721('0xc5'),_0x1540dc);});}return respondWithRpcPromise(_0x1721('0xc6'),'startRouting',_0x1540dc);})['then'](function(_0x3920d9){respondWithRpcPromise('EventManager','EventManager',{'event':_0x1721('0x8a'),'message':_0x3920d9},client9002);return _0x3920d9;})[_0x1721('0x25')](respondWithResult(_0xe97192,null))[_0x1721('0x2f')](handleError(_0xe97192,null));};exports[_0x1721('0xc7')]=function(_0x1547f7,_0x71827,_0x234702){var _0x154742,_0x22a203,_0x3a2f2d;var _0x2f1eb4=[];var _0x591254=[];var _0x183def={};return db[_0x1721('0x90')][_0x1721('0x68')]()[_0x1721('0x25')](function(_0x259688){if(!_0x259688){throw new db[(_0x1721('0x91'))]['ValidationError'](_0x1721('0x92'));}_0x591254=_[_0x1721('0x93')](_[_0x1721('0x5c')](_0x259688),[_0x1721('0x95'),_0x1721('0x94')]);_0x2f1eb4=_[_0x1721('0x93')](_[_0x1721('0x5c')](_0x259688),[_0x1721('0x95'),_0x1721('0x94'),_0x1721('0x96'),_0x1721('0x97')]);if(_0x1547f7['body']['id']){delete _0x1547f7[_0x1721('0x60')]['id'];}if(_[_0x1721('0x7f')](_0x1547f7[_0x1721('0x60')]['from'])){throw _0x71827[_0x1721('0x31')](0x1f4)[_0x1721('0xc8')](new db[(_0x1721('0x91'))][(_0x1721('0x23'))](_0x1721('0xc9')));}if(_[_0x1721('0x7f')](_0x1547f7['body'][_0x1721('0x60')])||_0x1547f7[_0x1721('0x60')]['body']===''){throw _0x71827['status'](0x1f4)[_0x1721('0xc8')](new db[(_0x1721('0x91'))][(_0x1721('0x23'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x1721('0x7f')](_0x1547f7[_0x1721('0x60')][_0x1721('0xca')])){throw _0x71827[_0x1721('0x31')](0x1f4)[_0x1721('0xc8')](new db[(_0x1721('0x91'))][(_0x1721('0x23'))](_0x1721('0xcb')+_0x2f1eb4));}if(!_['includes'](_0x2f1eb4,_0x1547f7[_0x1721('0x60')][_0x1721('0xca')])){throw _0x71827[_0x1721('0x31')](0x1f4)['send'](new db[(_0x1721('0x91'))]['ValidationError'](_0x1721('0xcc')+_0x2f1eb4));}_0x183def[_0x1547f7[_0x1721('0x60')][_0x1721('0xca')]]=_0x1547f7[_0x1721('0x60')]['from'];})[_0x1721('0x25')](function(){return db[_0x1721('0x45')][_0x1721('0x64')]({'where':{'id':_0x1547f7[_0x1721('0x67')]['id']},'include':[{'model':db[_0x1721('0x9c')],'as':_0x1721('0xa0')}]});})[_0x1721('0x25')](handleEntityNotFound(_0x71827,null))['then'](function(_0x1e7a74){if(_0x1e7a74&&_0x1e7a74[_0x1721('0xa0')]){_0x22a203=_0x1e7a74;var _0x2c14fe=_[_0x1721('0xcd')](_0x1547f7[_0x1721('0x60')],{'firstName':_0x1547f7[_0x1721('0x60')]['from'],'phone':_0x1547f7['body']['from'],'ListId':_0x1e7a74['ListId']});_0x2c14fe[_0x1547f7['body'][_0x1721('0xca')]]=_0x1547f7[_0x1721('0x60')][_0x1721('0x98')];return db[_0x1721('0x90')][_0x1721('0xce')]({'where':_0x183def,'defaults':_0x2c14fe});}})[_0x1721('0xb9')](function(_0x51e363){if(_0x51e363){_0x3a2f2d=_0x51e363;var _0xd4f706=fs['readFileSync'](path['join'](config[_0x1721('0x7b')],_0x1721('0xcf')),_0x1721('0xd0'));var _0x1f4989=ejs[_0x1721('0xd1')](_0xd4f706,{'body':_['toPairs'](_0x1547f7[_0x1721('0x60')][_0x1721('0x60')]),'bodyTitle':_0x22a203[_0x1721('0xd2')]});return db[_0x1721('0xd3')][_0x1721('0x5f')]({'body':_0x1f4989,'ContactId':_0x51e363['id'],'ChatWebsiteId':_0x22a203['id']});}})['then'](function(_0x591535){if(_0x591535){_0x154742=_0x591535;return db[_0x1721('0xd4')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x1721('0xd5')],'as':'Smtp','raw':!![]}]});}})[_0x1721('0x25')](function(_0x420a9e){if(_0x420a9e&&_0x420a9e[_0x1721('0xd6')]&&_0x22a203['forwardOfflineAddress']){var _0x3f49ad={'tls':{'rejectUnauthorized':![]}};if(_0x420a9e[_0x1721('0xd6')][_0x1721('0xd7')]){_0x3f49ad[_0x1721('0xd7')]=_0x420a9e[_0x1721('0xd6')][_0x1721('0xd7')];}else{_0x3f49ad[_0x1721('0xd8')]=_0x420a9e['Smtp'][_0x1721('0xd8')];_0x3f49ad['port']=_0x420a9e[_0x1721('0xd6')][_0x1721('0xd9')];_0x3f49ad[_0x1721('0xda')]=_0x420a9e[_0x1721('0xd6')][_0x1721('0xda')];}if(_0x420a9e['Smtp'][_0x1721('0xdb')]){_0x3f49ad[_0x1721('0xdc')]={'user':_0x420a9e[_0x1721('0xd6')][_0x1721('0x61')],'pass':_0x420a9e[_0x1721('0xd6')][_0x1721('0xdd')]};}return respondWithRpcPromise(_0x1721('0xde'),'sendMail',{'account':_0x3f49ad,'message':{'from':util[_0x1721('0xb0')](_0x1721('0xdf'),_0x420a9e[_0x1721('0x40')],_0x420a9e[_0x1721('0xe0')]||_0x420a9e['Smtp'][_0x1721('0x61')]),'to':_0x22a203['forwardOfflineAddress'],'subject':_0x22a203[_0x1721('0xe1')],'text':_0x154742[_0x1721('0x60')]}},client9003)[_0x1721('0x25')](function(){return _0x154742;})[_0x1721('0x2f')](function(_0x50500a){console[_0x1721('0x2b')](_0x50500a);});}})[_0x1721('0x25')](function(){if(_0x154742){return _0x154742;}})[_0x1721('0x25')](respondWithResult(_0x71827,null))[_0x1721('0x2f')](handleError(_0x71827,null));};exports[_0x1721('0xe2')]=function(_0x3f229c,_0x21a972,_0x349734){return db['ChatInteraction'][_0x1721('0x64')]({'where':{'id':_0x3f229c[_0x1721('0x67')]['id']}})[_0x1721('0x25')](handleEntityNotFound(_0x21a972,null))[_0x1721('0x25')](function(_0x4be65b){if(_0x4be65b){return _0x4be65b[_0x1721('0xe2')](_0x3f229c['body'][_0x1721('0x6f')],_[_0x1721('0xe3')](_0x3f229c['body'],[_0x1721('0x6f'),'id'])||{});}})[_0x1721('0x25')](respondWithResult(_0x21a972,null))[_0x1721('0x2f')](handleError(_0x21a972,null));};exports['getInteractions']=function(_0x1198f7,_0x23acb5,_0x1cd955){var _0x45fc6c={'raw':![],'where':{}};var _0x134c25={};var _0x5634f6={'count':0x0,'rows':[]};return db[_0x1721('0x45')][_0x1721('0x6c')]({'where':{'id':_0x1198f7[_0x1721('0x67')]['id']}})[_0x1721('0x25')](handleEntityNotFound(_0x23acb5,null))[_0x1721('0x25')](function(_0x3cc63d){if(_0x3cc63d){_0x134c25['model']=_[_0x1721('0x5c')](db['ChatInteraction'][_0x1721('0x5d')]);_0x134c25[_0x1721('0x49')]=_[_0x1721('0x5c')](_0x1198f7[_0x1721('0x49')]);_0x134c25['filters']=_['intersection'](_0x134c25[_0x1721('0x48')],_0x134c25['query']);_0x45fc6c[_0x1721('0x4c')]=_['intersection'](_0x134c25[_0x1721('0x48')],qs[_0x1721('0x4d')](_0x1198f7['query']['fields']));_0x45fc6c[_0x1721('0x4c')]=_0x45fc6c['attributes']['length']?_0x45fc6c[_0x1721('0x4c')]:_0x134c25[_0x1721('0x48')];if(!_0x1198f7['query'][_0x1721('0x4f')](_0x1721('0x50'))){_0x45fc6c[_0x1721('0x35')]=qs['limit'](_0x1198f7['query'][_0x1721('0x35')]);_0x45fc6c[_0x1721('0x34')]=qs[_0x1721('0x34')](_0x1198f7[_0x1721('0x49')][_0x1721('0x34')]);}_0x45fc6c['order']=qs[_0x1721('0x52')](_0x1198f7[_0x1721('0x49')][_0x1721('0x52')]);_0x45fc6c[_0x1721('0x53')]=qs[_0x1721('0x4a')](_[_0x1721('0x54')](_0x1198f7[_0x1721('0x49')],_0x134c25['filters']));_0x45fc6c['where'][_0x1721('0x6d')]=_0x3cc63d['id'];if(_0x1198f7[_0x1721('0x49')][_0x1721('0x55')]){_0x45fc6c[_0x1721('0x53')]=_[_0x1721('0x56')](_0x45fc6c['where'],{'$or':_[_0x1721('0x44')](_0x45fc6c['attributes'],function(_0x41f832){var _0x5483fa={};_0x5483fa[_0x41f832]={'$like':'%'+_0x1198f7[_0x1721('0x49')]['filter']+'%'};return _0x5483fa;})});}_0x45fc6c=_[_0x1721('0x56')]({},_0x45fc6c,_0x1198f7[_0x1721('0x58')]);return db[_0x1721('0xb6')][_0x1721('0x33')]({'where':_0x45fc6c[_0x1721('0x53')]})['then'](function(_0xabd50c){_0x5634f6['count']=_0xabd50c;if(_0x1198f7[_0x1721('0x49')][_0x1721('0x5e')]){_0x45fc6c[_0x1721('0x59')]=[{'model':db[_0x1721('0x90')],'as':_0x1721('0xe4'),'required':![]},{'model':db[_0x1721('0xe5')],'as':_0x1721('0xe6'),'attributes':[_0x1721('0x40'),_0x1721('0xe7'),_0x1721('0xe8')],'required':![]},{'model':db[_0x1721('0xe9')],'as':_0x1721('0xea'),'attributes':['id','name','color'],'where':_0x1198f7[_0x1721('0x49')][_0x1721('0xeb')]?{'id':_0x1198f7['query'][_0x1721('0xeb')]}:undefined,'required':_0x1198f7[_0x1721('0x49')][_0x1721('0xeb')]?!![]:![]}];}return db[_0x1721('0xb6')]['findAll'](_0x45fc6c);})[_0x1721('0x25')](function(_0x185325){_0x5634f6[_0x1721('0x5b')]=_0x185325;return _0x5634f6;});}})['then'](respondWithFilteredResult(_0x23acb5,_0x45fc6c))['catch'](handleError(_0x23acb5,null));};function iftimePromise(_0x5516e9,_0x5f4d5e){return respondWithRpcPromise('Command','getSnippet',{'command':_0x5f4d5e[_0x1721('0xec')]?util[_0x1721('0xb0')](_0x1721('0xed'),_0x5516e9[_0x1721('0xee')],_0x5f4d5e[_0x1721('0xec')]):util[_0x1721('0xb0')](_0x1721('0xef'),_0x5516e9[_0x1721('0xee')])},client9002)[_0x1721('0x25')](function(_0x25e825){var _0x1b08e0=_0x25e825&&_0x25e825[_0x1721('0xf0')](_0x1721('0xf1'))>=0x0?!![]:![];logger[_0x1721('0x26')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x5f4d5e['id'],_0x5516e9['id'],_0x5516e9['interval'],_0x1b08e0?_0x1721('0xf2'):_0x1721('0xf3'),_0x5f4d5e[_0x1721('0xec')]?_0x5f4d5e[_0x1721('0xec')]:_0x1721('0xf4'));return _0x1b08e0;})[_0x1721('0x2f')](function(_0x4c299d){logger['error']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x5f4d5e['id'],_0x5516e9['id'],_0x5516e9[_0x1721('0xee')],util['inspect'](_0x4c299d,{'showHidden':![],'depth':null}),_0x5f4d5e[_0x1721('0xec')]?_0x5f4d5e[_0x1721('0xec')]:_0x1721('0xf4'));return![];});}exports[_0x1721('0xf5')]=function(_0x1beb04,_0xa142e3,_0x279cff){var _0x33b26a=0x0;var _0x287912=0x0;var _0x3b717e=![];var _0x2e51e7;var _0x1aeccd;return db[_0x1721('0x45')][_0x1721('0x64')]({'where':{'id':_0x1beb04['params']['id']},'include':[{'model':db[_0x1721('0xf6')],'as':_0x1721('0xf6'),'include':[{'model':db['Interval'],'as':_0x1721('0xf7'),'attributes':['id',_0x1721('0xee')],'raw':!![]}]}]})[_0x1721('0x25')](handleEntityNotFound(_0xa142e3,null))['then'](function(_0x2fd79a){if(_0x2fd79a){_0x2e51e7=_0x2fd79a;return _0x2fd79a[_0x1721('0xf8')]({'raw':!![]});}})[_0x1721('0x25')](function(_0x8d63f9){if(_0x2e51e7){if(_0x8d63f9){_0x1aeccd=_0x8d63f9;}}return require(_0x1721('0x7d'))[_0x1721('0xf9')]();})[_0x1721('0x25')](function(_0x8b23e3){if(_0x8b23e3){_0x287912=_0x8b23e3[_0x1721('0xfa')];_0x3b717e=_0x8b23e3['custom'];}})[_0x1721('0x25')](function(){return db['ChatInteraction'][_0x1721('0x33')]({'where':{'closed':![]}});})[_0x1721('0x25')](function(_0x5db170){_0x33b26a=_0x5db170;if(_0x287912&&_0x5db170>_0x287912){return db[_0x1721('0xfb')][_0x1721('0x6c')]({'where':{'id':0x1}})['then'](function(_0xba773c){if(_0xba773c){_0xba773c[_0x1721('0xfc')](_0x1721('0xfd'));}});}})[_0x1721('0x25')](function(){if(_0x2e51e7['Interval']&&_0x2e51e7[_0x1721('0xf6')][_0x1721('0xf7')]){var _0x487ce1=[];for(var _0x245ec5=0x0;_0x245ec5<_0x2e51e7[_0x1721('0xf6')][_0x1721('0xf7')]['length'];_0x245ec5++){var _0x2e75ae=_0x2e51e7[_0x1721('0xf6')][_0x1721('0xf7')][_0x245ec5]['get']({'plain':!![]});_0x487ce1[_0x1721('0xbd')](iftimePromise(_0x2e75ae,_0x2e51e7));}return BPromise['all'](_0x487ce1)[_0x1721('0x25')](function(_0x3e53fb){return _[_0x1721('0xfe')](_0x3e53fb);});}else{return!![];}})[_0x1721('0x25')](function(_0x27266a){var _0x1cd161=fs[_0x1721('0xff')](path[_0x1721('0x7a')](config[_0x1721('0x7b')],_0x1721('0x100')),_0x1721('0xd0'));var _0x5cdbd1={'remote':_0x2e51e7[_0x1721('0x101')],'query':querystring[_0x1721('0x2a')](_[_0x1721('0x56')](_0x2e51e7[_0x1721('0x3c')]({'plain':!![]}),{'customerIp':_0x1beb04['headers']['x-forwarded-for']||_0x1beb04[_0x1721('0x8c')][_0x1721('0x102')]||_0x1beb04[_0x1721('0x103')][_0x1721('0x104')]||_0x1beb04['ip'],'referer':_0x1beb04[_0x1721('0x8c')]['referer'],'openedInteractions':_0x33b26a,'maxInteractions':_0x287912,'virtual':_0x3b717e[_0x1721('0xfa')],'online':_0x27266a,'custom':_0x3b717e}))[_0x1721('0x105')](/'/g,'\x5c\x27')};_0xa142e3[_0x1721('0xc8')](ejs[_0x1721('0xd1')](Mustache[_0x1721('0xd1')](_0x1cd161,_0x5cdbd1),{'proactiveActions':_0x1aeccd,'alignment':_0x2e51e7[_0x1721('0x106')],'verticalAlignment':_0x2e51e7['verticalAlignment'],'div_color':_0x2e51e7[_0x1721('0x107')],'text_color':_0x2e51e7['textColor']}));})[_0x1721('0x2f')](handleError(_0xa142e3,null));};exports[_0x1721('0x108')]=function(_0x15c038,_0x57cbad,_0x46ec70){return db[_0x1721('0x45')]['findOne']({'where':{'id':_0x15c038[_0x1721('0x67')]['id']}})[_0x1721('0x25')](handleEntityNotFound(_0x57cbad,null))[_0x1721('0x25')](function(_0x2b4be6){if(_0x2b4be6){return db[_0x1721('0x109')]['transaction'](function(_0x1df543){return db[_0x1721('0x9e')][_0x1721('0x3b')]({'where':{'ChatWebsiteId':_0x15c038[_0x1721('0x67')]['id']},'transaction':_0x1df543})[_0x1721('0x25')](function(_0x24d2d3){var _0x5f4b4a=_[_0x1721('0x44')](_0x15c038[_0x1721('0x60')],function(_0x1d2135){_0x1d2135[_0x1721('0x6d')]=_0x15c038['params']['id'];return _0x1d2135;});return db[_0x1721('0x9e')]['bulkCreate'](_0x5f4b4a,{'transaction':_0x1df543});});})[_0x1721('0x25')](function(){return db[_0x1721('0x9e')][_0x1721('0x10a')]({'where':{'ChatWebsiteId':_0x15c038['params']['id']},'order':'priority'});});}})[_0x1721('0x25')](respondWithResult(_0x57cbad,null))[_0x1721('0x2f')](handleError(_0x57cbad,null));};exports['getApplications']=function(_0x3ac454,_0x48d8fb,_0x5b4de4){var _0x3ebebf={};var _0x200403={};var _0x4c3fd7;var _0x41d2a5;return db[_0x1721('0x45')][_0x1721('0x6c')]({'where':{'id':_0x3ac454[_0x1721('0x67')]['id']}})[_0x1721('0x25')](handleEntityNotFound(_0x48d8fb,null))[_0x1721('0x25')](function(_0x450b09){if(_0x450b09){_0x4c3fd7=_0x450b09;_0x200403[_0x1721('0x48')]=_[_0x1721('0x5c')](db[_0x1721('0x9e')][_0x1721('0x5d')]);_0x200403[_0x1721('0x49')]=_['keys'](_0x3ac454['query']);_0x200403[_0x1721('0x4a')]=_[_0x1721('0x4b')](_0x200403[_0x1721('0x48')],_0x200403['query']);_0x3ebebf[_0x1721('0x4c')]=_[_0x1721('0x4b')](_0x200403[_0x1721('0x48')],qs['fields'](_0x3ac454[_0x1721('0x49')][_0x1721('0x4d')]));_0x3ebebf['attributes']=_0x3ebebf[_0x1721('0x4c')][_0x1721('0x4e')]?_0x3ebebf['attributes']:_0x200403['model'];_0x3ebebf['order']=qs[_0x1721('0x52')](_0x3ac454[_0x1721('0x49')]['sort']);_0x3ebebf[_0x1721('0x53')]=qs[_0x1721('0x4a')](_[_0x1721('0x54')](_0x3ac454[_0x1721('0x49')],_0x200403[_0x1721('0x4a')]));if(_0x3ac454[_0x1721('0x49')]['filter']){_0x3ebebf[_0x1721('0x53')]=_['merge'](_0x3ebebf[_0x1721('0x53')],{'$or':_[_0x1721('0x44')](_0x3ebebf[_0x1721('0x4c')],function(_0xfbcefa){var _0x699eb9={};_0x699eb9[_0xfbcefa]={'$like':'%'+_0x3ac454['query']['filter']+'%'};return _0x699eb9;})});}_0x3ebebf=_['merge']({},_0x3ebebf,_0x3ac454[_0x1721('0x58')]);return _0x4c3fd7[_0x1721('0x10b')](_0x3ebebf);}})[_0x1721('0x25')](function(_0x2574fc){if(_0x2574fc){_0x41d2a5=_0x2574fc[_0x1721('0x4e')];if(!_0x3ac454[_0x1721('0x49')][_0x1721('0x4f')](_0x1721('0x50'))){_0x3ebebf[_0x1721('0x35')]=qs[_0x1721('0x35')](_0x3ac454[_0x1721('0x49')][_0x1721('0x35')]);_0x3ebebf[_0x1721('0x34')]=qs[_0x1721('0x34')](_0x3ac454[_0x1721('0x49')][_0x1721('0x34')]);}return _0x4c3fd7[_0x1721('0x10b')](_0x3ebebf);}})[_0x1721('0x25')](function(_0x1db376){if(_0x1db376){return _0x1db376?{'count':_0x41d2a5,'rows':_0x1db376}:null;}})[_0x1721('0x25')](respondWithResult(_0x48d8fb,null))[_0x1721('0x2f')](handleError(_0x48d8fb,null));};exports[_0x1721('0x10c')]=function(_0x50bf14,_0x3cfb00,_0x264f5d){return db[_0x1721('0x10d')]['find']({'where':{'id':_0x50bf14[_0x1721('0x67')]['id']}})[_0x1721('0x25')](handleEntityNotFound(_0x3cfb00,null))[_0x1721('0x25')](function(_0x149d30){if(_0x149d30){return _0x149d30[_0x1721('0x10c')](_0x50bf14['body'][_0x1721('0x6f')],_['omit'](_0x50bf14[_0x1721('0x60')],['ids','id'])||{});}})['then'](respondWithResult(_0x3cfb00,null))[_0x1721('0x2f')](handleError(_0x3cfb00,null));};exports[_0x1721('0xf8')]=function(_0x4027ce,_0x3b73ca,_0x3adf7c){var _0x5789aa={};var _0xcf4059={};var _0x1f094a;var _0x5060c8;return db['ChatWebsite'][_0x1721('0x6c')]({'where':{'id':_0x4027ce[_0x1721('0x67')]['id']}})[_0x1721('0x25')](handleEntityNotFound(_0x3b73ca,null))[_0x1721('0x25')](function(_0x1b4c7d){if(_0x1b4c7d){_0x1f094a=_0x1b4c7d;_0xcf4059[_0x1721('0x48')]=_[_0x1721('0x5c')](db['ChatProactiveAction'][_0x1721('0x5d')]);_0xcf4059[_0x1721('0x49')]=_[_0x1721('0x5c')](_0x4027ce[_0x1721('0x49')]);_0xcf4059[_0x1721('0x4a')]=_[_0x1721('0x4b')](_0xcf4059[_0x1721('0x48')],_0xcf4059['query']);_0x5789aa[_0x1721('0x4c')]=_[_0x1721('0x4b')](_0xcf4059[_0x1721('0x48')],qs[_0x1721('0x4d')](_0x4027ce[_0x1721('0x49')][_0x1721('0x4d')]));_0x5789aa['attributes']=_0x5789aa[_0x1721('0x4c')]['length']?_0x5789aa[_0x1721('0x4c')]:_0xcf4059[_0x1721('0x48')];_0x5789aa[_0x1721('0x51')]=qs['sort'](_0x4027ce[_0x1721('0x49')][_0x1721('0x52')]);_0x5789aa['where']=qs[_0x1721('0x4a')](_['pick'](_0x4027ce['query'],_0xcf4059[_0x1721('0x4a')]));if(_0x4027ce['query'][_0x1721('0x55')]){_0x5789aa[_0x1721('0x53')]=_[_0x1721('0x56')](_0x5789aa['where'],{'$or':_[_0x1721('0x44')](_0x5789aa['attributes'],function(_0x57f25f){var _0x53ca72={};_0x53ca72[_0x57f25f]={'$like':'%'+_0x4027ce[_0x1721('0x49')][_0x1721('0x55')]+'%'};return _0x53ca72;})});}_0x5789aa=_['merge']({},_0x5789aa,_0x4027ce[_0x1721('0x58')]);return _0x1f094a[_0x1721('0xf8')](_0x5789aa);}})[_0x1721('0x25')](function(_0x5a910f){if(_0x5a910f){_0x5060c8=_0x5a910f[_0x1721('0x4e')];if(!_0x4027ce[_0x1721('0x49')]['hasOwnProperty'](_0x1721('0x50'))){_0x5789aa['limit']=qs['limit'](_0x4027ce[_0x1721('0x49')][_0x1721('0x35')]);_0x5789aa[_0x1721('0x34')]=qs[_0x1721('0x34')](_0x4027ce[_0x1721('0x49')]['offset']);}return _0x1f094a[_0x1721('0xf8')](_0x5789aa);}})[_0x1721('0x25')](function(_0x12d82e){if(_0x12d82e){return _0x12d82e?{'count':_0x5060c8,'rows':_0x12d82e}:null;}})[_0x1721('0x25')](respondWithResult(_0x3b73ca,null))[_0x1721('0x2f')](handleError(_0x3b73ca,null));};exports['getFields']=function(_0x4f171b,_0x2e4fdc,_0x39ec7d){var _0x5cf162=_0x4f171b[_0x1721('0x49')][_0x1721('0x10e')]==='false'?_0x1721('0x10f'):'onlineForm';return db[_0x1721('0x45')][_0x1721('0x64')]({'attributes':['id',_0x5cf162],'where':{'id':_0x4f171b[_0x1721('0x67')]['id']}})[_0x1721('0x25')](handleEntityNotFound(_0x2e4fdc,null))[_0x1721('0x25')](function(_0x40fe81){if(_0x40fe81){var _0x2070de=_0x40fe81[_0x5cf162];var _0x3ac704=_0x2070de&&_0x2070de['items']?_0x2070de['items']:[];_0x2e4fdc[_0x1721('0xc8')]({'fromKey':_[_0x1721('0x7f')](_0x2070de[_0x1721('0x110')])?undefined:_0x2070de[_0x1721('0x110')],'count':_0x3ac704['length'],'rows':_0x3ac704});}})[_0x1721('0x2f')](handleError(_0x2e4fdc,null));};exports[_0x1721('0x111')]=function(_0x45cda0,_0x30cc60,_0x38eba4){var _0x217659={'raw':![],'where':{}};var _0xb553e3={};var _0x43c8e8={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x1721('0x6c')]({'where':{'id':_0x45cda0[_0x1721('0x67')]['id']}})[_0x1721('0x25')](handleEntityNotFound(_0x30cc60,null))[_0x1721('0x25')](function(_0x407dab){if(_0x407dab){_0xb553e3[_0x1721('0x48')]=_[_0x1721('0x5c')](db[_0x1721('0xd3')][_0x1721('0x5d')]);_0xb553e3[_0x1721('0x49')]=_['keys'](_0x45cda0[_0x1721('0x49')]);_0xb553e3[_0x1721('0x4a')]=_[_0x1721('0x4b')](_0xb553e3[_0x1721('0x48')],_0xb553e3['query']);_0x217659[_0x1721('0x4c')]=_[_0x1721('0x4b')](_0xb553e3[_0x1721('0x48')],qs[_0x1721('0x4d')](_0x45cda0[_0x1721('0x49')][_0x1721('0x4d')]));_0x217659[_0x1721('0x4c')]=_0x217659[_0x1721('0x4c')][_0x1721('0x4e')]?_0x217659[_0x1721('0x4c')]:_0xb553e3[_0x1721('0x48')];if(!_0x45cda0[_0x1721('0x49')][_0x1721('0x4f')]('nolimit')){_0x217659[_0x1721('0x35')]=qs[_0x1721('0x35')](_0x45cda0[_0x1721('0x49')][_0x1721('0x35')]);_0x217659[_0x1721('0x34')]=qs[_0x1721('0x34')](_0x45cda0[_0x1721('0x49')]['offset']);}_0x217659[_0x1721('0x51')]=qs['sort'](_0x45cda0[_0x1721('0x49')][_0x1721('0x52')]);_0x217659['where']=qs['filters'](_['pick'](_0x45cda0[_0x1721('0x49')],_0xb553e3[_0x1721('0x4a')]));_0x217659[_0x1721('0x53')][_0x1721('0x6d')]=_0x407dab['id'];if(_0x45cda0[_0x1721('0x49')][_0x1721('0x55')]){_0x217659[_0x1721('0x53')]=_[_0x1721('0x56')](_0x217659[_0x1721('0x53')],{'$or':_['map'](_0x217659[_0x1721('0x4c')],function(_0x26118c){var _0x5c4601={};_0x5c4601[_0x26118c]={'$like':'%'+_0x45cda0[_0x1721('0x49')][_0x1721('0x55')]+'%'};return _0x5c4601;})});}_0x217659=_[_0x1721('0x56')]({},_0x217659,_0x45cda0['options']);return db[_0x1721('0xd3')][_0x1721('0x33')]({'where':_0x217659['where']})[_0x1721('0x25')](function(_0x33db65){_0x43c8e8[_0x1721('0x33')]=_0x33db65;if(_0x45cda0['query'][_0x1721('0x5e')]){_0x217659['include']=[{'all':!![]}];}else{_0x217659[_0x1721('0x59')]=[{'model':db[_0x1721('0x90')],'as':_0x1721('0xe4'),'required':![]}];}return db[_0x1721('0xd3')][_0x1721('0x5a')](_0x217659);})[_0x1721('0x25')](function(_0x5ad6e2){_0x43c8e8[_0x1721('0x5b')]=_0x5ad6e2;return _0x43c8e8;});}})[_0x1721('0x25')](respondWithFilteredResult(_0x30cc60,_0x217659))['catch'](handleError(_0x30cc60,null));};exports[_0x1721('0x112')]=function(_0x5de723,_0x1e73e5,_0x2ad945){return db[_0x1721('0x45')][_0x1721('0x64')]({'where':{'id':_0x5de723[_0x1721('0x67')]['id']}})[_0x1721('0x25')](handleEntityNotFound(_0x1e73e5,null))[_0x1721('0x25')](function(_0x1ef503){if(_0x1ef503){return _0x1ef503[_0x1721('0x112')](_0x5de723[_0x1721('0x60')][_0x1721('0x6f')],_['omit'](_0x5de723[_0x1721('0x60')],[_0x1721('0x6f'),'id'])||{})[_0x1721('0xb9')](function(_0x246bb4){for(var _0x5aa6f5=0x0;_0x5aa6f5<_0x5de723[_0x1721('0x60')][_0x1721('0x6f')][_0x1721('0x4e')];_0x5aa6f5+=0x1){socket[_0x1721('0x113')](_0x1721('0x114'),{'UserId':_0x5de723[_0x1721('0x60')][_0x1721('0x6f')][_0x5aa6f5],'ChatWebsiteId':_0x5de723['params']['id']});}return _0x246bb4;});}})['then'](respondWithResult(_0x1e73e5,null))[_0x1721('0x2f')](handleError(_0x1e73e5,null));};exports[_0x1721('0x115')]=function(_0x59f884,_0x328f1f,_0x43c507){return db[_0x1721('0x45')][_0x1721('0x64')]({'where':{'id':_0x59f884[_0x1721('0x67')]['id']}})[_0x1721('0x25')](handleEntityNotFound(_0x328f1f,null))['then'](function(_0x27c1f1){if(_0x27c1f1){return _0x27c1f1[_0x1721('0x115')](_0x59f884[_0x1721('0x49')][_0x1721('0x6f')])['then'](function(){if(_[_0x1721('0x116')](_0x59f884[_0x1721('0x49')]['ids'])){for(var _0x22d723=0x0;_0x22d723<_0x59f884[_0x1721('0x49')][_0x1721('0x6f')][_0x1721('0x4e')];_0x22d723+=0x1){socket[_0x1721('0x113')](_0x1721('0x117'),{'UserId':Number(_0x59f884[_0x1721('0x49')][_0x1721('0x6f')][_0x22d723]),'ChatWebsiteId':Number(_0x59f884[_0x1721('0x67')]['id'])});}}else{socket[_0x1721('0x113')](_0x1721('0x117'),{'UserId':Number(_0x59f884[_0x1721('0x49')][_0x1721('0x6f')]),'ChatWebsiteId':Number(_0x59f884[_0x1721('0x67')]['id'])});}});}})['then'](respondWithStatusCode(_0x328f1f,null))[_0x1721('0x2f')](handleError(_0x328f1f,null));};exports[_0x1721('0x118')]=function(_0x4a8705,_0x31ae8e,_0x58cef8){var _0x30af3d={};var _0x193886={};var _0x3832e7;var _0x1204a4;return db[_0x1721('0x45')][_0x1721('0x6c')]({'where':{'id':_0x4a8705[_0x1721('0x67')]['id']}})[_0x1721('0x25')](handleEntityNotFound(_0x31ae8e,null))[_0x1721('0x25')](function(_0x42919e){if(_0x42919e){_0x3832e7=_0x42919e;_0x193886['model']=_[_0x1721('0x5c')](db[_0x1721('0xe5')]['rawAttributes']);_0x193886[_0x1721('0x49')]=_[_0x1721('0x5c')](_0x4a8705[_0x1721('0x49')]);_0x193886[_0x1721('0x4a')]=_[_0x1721('0x4b')](_0x193886[_0x1721('0x48')],_0x193886[_0x1721('0x49')]);_0x30af3d[_0x1721('0x4c')]=_[_0x1721('0x4b')](_0x193886[_0x1721('0x48')],qs[_0x1721('0x4d')](_0x4a8705['query'][_0x1721('0x4d')]));_0x30af3d['attributes']=_0x30af3d[_0x1721('0x4c')][_0x1721('0x4e')]?_0x30af3d[_0x1721('0x4c')]:_0x193886[_0x1721('0x48')];_0x30af3d['order']=qs[_0x1721('0x52')](_0x4a8705[_0x1721('0x49')][_0x1721('0x52')]);_0x30af3d['where']=qs[_0x1721('0x4a')](_[_0x1721('0x54')](_0x4a8705[_0x1721('0x49')],_0x193886['filters']));if(_0x4a8705[_0x1721('0x49')][_0x1721('0x55')]){_0x30af3d['where']=_[_0x1721('0x56')](_0x30af3d[_0x1721('0x53')],{'$or':_[_0x1721('0x44')](_0x30af3d[_0x1721('0x4c')],function(_0x558688){var _0x29b522={};_0x29b522[_0x558688]={'$like':'%'+_0x4a8705['query'][_0x1721('0x55')]+'%'};return _0x29b522;})});}_0x30af3d=_[_0x1721('0x56')]({},_0x30af3d,_0x4a8705[_0x1721('0x58')]);return _0x3832e7[_0x1721('0x118')](_0x30af3d);}})['then'](function(_0xfc43b9){if(_0xfc43b9){_0x1204a4=_0xfc43b9[_0x1721('0x4e')];if(!_0x4a8705['query']['hasOwnProperty'](_0x1721('0x50'))){_0x30af3d[_0x1721('0x35')]=qs[_0x1721('0x35')](_0x4a8705[_0x1721('0x49')][_0x1721('0x35')]);_0x30af3d['offset']=qs['offset'](_0x4a8705[_0x1721('0x49')][_0x1721('0x34')]);}return _0x3832e7[_0x1721('0x118')](_0x30af3d);}})[_0x1721('0x25')](function(_0x5e80fe){if(_0x5e80fe){return _0x5e80fe?{'count':_0x1204a4,'rows':_0x5e80fe}:null;}})['then'](respondWithResult(_0x31ae8e,null))[_0x1721('0x2f')](handleError(_0x31ae8e,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index ea3f209..5afca6d 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 _0xcb99=['ChatWebsite','update','remove','emit','hook','exports','events'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xcb99,0x8b));var _0x9cb9=function(_0x8c6eee,_0x21f601){_0x8c6eee=_0x8c6eee-0x0;var _0x5a03b5=_0xcb99[_0x8c6eee];return _0x5a03b5;};'use strict';var EventEmitter=require(_0x9cb9('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x9cb9('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9cb9('0x2'),'afterDestroy':_0x9cb9('0x3')};function emitEvent(_0x124c48){return function(_0x51f2ee,_0x167735,_0x41788c){ChatWebsiteEvents['emit'](_0x124c48+':'+_0x51f2ee['id'],_0x51f2ee);ChatWebsiteEvents[_0x9cb9('0x4')](_0x124c48,_0x51f2ee);_0x41788c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x9cb9('0x5')](e,emitEvent(event));}}module[_0x9cb9('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0x7fbe=['update','remove','emit','hasOwnProperty','hook','exports','ChatWebsite','setMaxListeners','save'];(function(_0x5ebcda,_0x5aaa0a){var _0x179c8e=function(_0x253a48){while(--_0x253a48){_0x5ebcda['push'](_0x5ebcda['shift']());}};_0x179c8e(++_0x5aaa0a);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x5fddc0,_0x5e12a6){_0x5fddc0=_0x5fddc0-0x0;var _0x3c61bd=_0x7fbe[_0x5fddc0];return _0x3c61bd;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db'][_0xe7fb('0x0')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xe7fb('0x1')](0x0);var events={'afterCreate':_0xe7fb('0x2'),'afterUpdate':_0xe7fb('0x3'),'afterDestroy':_0xe7fb('0x4')};function emitEvent(_0x47625b){return function(_0x11d2c4,_0x4524ff,_0x36ab90){ChatWebsiteEvents[_0xe7fb('0x5')](_0x47625b+':'+_0x11d2c4['id'],_0x11d2c4);ChatWebsiteEvents[_0xe7fb('0x5')](_0x47625b,_0x11d2c4);_0x36ab90(null);};}for(var e in events){if(events[_0xe7fb('0x6')](e)){var event=events[e];ChatWebsite[_0xe7fb('0x7')](e,emitEvent(event));}}module[_0xe7fb('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 93709ec..32da7fe 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 _0x83f1=['./chatWebsite.attributes','exports','define','ChatWebsite','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x83f1,0x1cc));var _0x183f=function(_0xe82e1d,_0x535835){_0xe82e1d=_0xe82e1d-0x0;var _0x34caf0=_0x83f1[_0xe82e1d];return _0x34caf0;};'use strict';var _=require(_0x183f('0x0'));var util=require(_0x183f('0x1'));var logger=require(_0x183f('0x2'))(_0x183f('0x3'));var moment=require(_0x183f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x183f('0x5'));var rimraf=require(_0x183f('0x6'));var config=require(_0x183f('0x7'));var attributes=require(_0x183f('0x8'));module[_0x183f('0x9')]=function(_0x5381b2,_0x5c1cbd){return _0x5381b2[_0x183f('0xa')](_0x183f('0xb'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9649=['request-promise','rimraf','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','bluebird'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x9649,0x19f));var _0x9964=function(_0x2d051f,_0x1b5890){_0x2d051f=_0x2d051f-0x0;var _0x1ce6bb=_0x9649[_0x2d051f];return _0x1ce6bb;};'use strict';var _=require(_0x9964('0x0'));var util=require(_0x9964('0x1'));var logger=require(_0x9964('0x2'))(_0x9964('0x3'));var moment=require('moment');var BPromise=require(_0x9964('0x4'));var rp=require(_0x9964('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9964('0x6'));var config=require('../../config/environment');var attributes=require(_0x9964('0x7'));module[_0x9964('0x8')]=function(_0x12dd14,_0x74bec9){return _0x12dd14[_0x9964('0x9')](_0x9964('0xa'),attributes,{'tableName':_0x9964('0xb'),'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 a2e6d4c..b2780b6 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 _0xb016=['../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','lodash','util','randomstring','../../mysqldb','../../config/utils'];(function(_0x206d06,_0x4962bc){var _0x21505f=function(_0x20bc21){while(--_0x20bc21){_0x206d06['push'](_0x206d06['shift']());}};_0x21505f(++_0x4962bc);}(_0xb016,0x159));var _0x6b01=function(_0x3256cc,_0x26ccbf){_0x3256cc=_0x3256cc-0x0;var _0x2aa1df=_0xb016[_0x3256cc];return _0x2aa1df;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b01('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b01('0x3'))['db'];var utils=require(_0x6b01('0x4'));var logger=require(_0x6b01('0x5'))(_0x6b01('0x6'));var config=require('../../config/environment');var jayson=require(_0x6b01('0x7'));var client=jayson[_0x6b01('0x8')][_0x6b01('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x6b01('0xa')],{'host':_0x6b01('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6b01('0xc'))[_0x6b01('0xd')](socket);function respondWithRpcPromise(_0x2c4e48,_0x242394,_0xab37c){return new BPromise(function(_0x5bed15,_0x4b4a4d){return client[_0x6b01('0xe')](_0x2c4e48,_0xab37c)[_0x6b01('0xf')](function(_0x2660c7){logger['info'](_0x6b01('0x10'),_0x242394,'request\x20sent');logger['debug'](_0x6b01('0x11'),_0x242394,'request\x20sent',JSON[_0x6b01('0x12')](_0x2660c7));if(_0x2660c7[_0x6b01('0x13')]){if(_0x2660c7['error'][_0x6b01('0x14')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x242394,_0x2660c7['error'][_0x6b01('0x15')]);return _0x4b4a4d(_0x2660c7['error']['message']);}logger[_0x6b01('0x13')](_0x6b01('0x10'),_0x242394,_0x2660c7[_0x6b01('0x13')][_0x6b01('0x15')]);return _0x5bed15(_0x2660c7[_0x6b01('0x13')][_0x6b01('0x15')]);}else{logger[_0x6b01('0x16')](_0x6b01('0x10'),_0x242394,_0x6b01('0x17'));_0x5bed15(_0x2660c7[_0x6b01('0x18')][_0x6b01('0x15')]);}})['catch'](function(_0x2c5f29){logger[_0x6b01('0x13')](_0x6b01('0x10'),_0x242394,_0x2c5f29);_0x4b4a4d(_0x2c5f29);});});} \ No newline at end of file +var _0xafc4=['error','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x280173,_0x326cf3){var _0x49163f=function(_0x5b2f8b){while(--_0x5b2f8b){_0x280173['push'](_0x280173['shift']());}};_0x49163f(++_0x326cf3);}(_0xafc4,0x69));var _0x4afc=function(_0x4fe1e4,_0x3e3bf2){_0x4fe1e4=_0x4fe1e4-0x0;var _0x2edec8=_0xafc4[_0x4fe1e4];return _0x2edec8;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var moment=require(_0x4afc('0x1'));var BPromise=require('bluebird');var rs=require(_0x4afc('0x2'));var fs=require('fs');var Redis=require(_0x4afc('0x3'));var db=require(_0x4afc('0x4'))['db'];var utils=require(_0x4afc('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4afc('0x6'));var client=jayson[_0x4afc('0x7')][_0x4afc('0x8')]({'port':0x232a});config[_0x4afc('0x9')]=_[_0x4afc('0xa')](config[_0x4afc('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4afc('0xb'))(new Redis(config[_0x4afc('0x9')]));require(_0x4afc('0xc'))[_0x4afc('0xd')](socket);function respondWithRpcPromise(_0x1b8981,_0x458fde,_0x5542ec){return new BPromise(function(_0x5c523b,_0x7f127f){return client['request'](_0x1b8981,_0x5542ec)[_0x4afc('0xe')](function(_0x225793){logger['info'](_0x4afc('0xf'),_0x458fde,_0x4afc('0x10'));logger[_0x4afc('0x11')](_0x4afc('0x12'),_0x458fde,_0x4afc('0x10'),JSON[_0x4afc('0x13')](_0x225793));if(_0x225793[_0x4afc('0x14')]){if(_0x225793[_0x4afc('0x14')]['code']===0x1f4){logger[_0x4afc('0x14')](_0x4afc('0xf'),_0x458fde,_0x225793[_0x4afc('0x14')][_0x4afc('0x15')]);return _0x7f127f(_0x225793['error']['message']);}logger[_0x4afc('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x458fde,_0x225793[_0x4afc('0x14')][_0x4afc('0x15')]);return _0x5c523b(_0x225793[_0x4afc('0x14')][_0x4afc('0x15')]);}else{logger[_0x4afc('0x16')](_0x4afc('0xf'),_0x458fde,_0x4afc('0x10'));_0x5c523b(_0x225793[_0x4afc('0x17')][_0x4afc('0x15')]);}})[_0x4afc('0x18')](function(_0x178229){logger['error'](_0x4afc('0xf'),_0x458fde,_0x178229);_0x7f127f(_0x178229);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 5e561f4..1ec7b49 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x414977,_0x574149){var _0x41758e=function(_0x23ced4){while(--_0x23ced4){_0x414977['push'](_0x414977['shift']());}};_0x41758e(++_0x574149);}(_0x7a54,0x106));var _0x47a5=function(_0x59f8a4,_0x22354b){_0x59f8a4=_0x59f8a4-0x0;var _0x398cc0=_0x7a54[_0x59f8a4];return _0x398cc0;};'use strict';var ChatWebsiteEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){ChatWebsiteEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);ChatWebsiteEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x1f83ac,_0x8016fc){var _0x1985de=function(_0x1d5947){while(--_0x1d5947){_0x1f83ac['push'](_0x1f83ac['shift']());}};_0x1985de(++_0x8016fc);}(_0xb10b,0x12a));var _0xbb10=function(_0x1d919b,_0x3188f8){_0x1d919b=_0x1d919b-0x0;var _0x233c28=_0xb10b[_0x1d919b];return _0x233c28;};'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 0d22a69..b02b341 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 _0x43ba=['delete','removeDispositions','removeAnswers','removeAgents','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','post','create','/:id/dispositions','addAnswer','diskStorage','format','%s-%s','now','originalname','single','file','addLogo','join','root','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','/:id/offline','offline','/:id/applications','addApplications','addProactiveActions','addAgents','put','update','destroy'];(function(_0x2b3acf,_0x3fa2f9){var _0x1afc12=function(_0x409ca7){while(--_0x409ca7){_0x2b3acf['push'](_0x2b3acf['shift']());}};_0x1afc12(++_0x3fa2f9);}(_0x43ba,0x89));var _0xa43b=function(_0x41c592,_0x5454b2){_0x41c592=_0x41c592-0x0;var _0x33b1b5=_0x43ba[_0x41c592];return _0x33b1b5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa43b('0x0'));var timeout=require(_0xa43b('0x1'));var express=require(_0xa43b('0x2'));var router=express[_0xa43b('0x3')]();var auth=require(_0xa43b('0x4'));var interaction=require(_0xa43b('0x5'));var config=require(_0xa43b('0x6'));var controller=require(_0xa43b('0x7'));router[_0xa43b('0x8')]('/',auth[_0xa43b('0x9')](),controller[_0xa43b('0xa')]);router['get'](_0xa43b('0xb'),auth['isAuthenticated'](),controller[_0xa43b('0xc')]);router['get'](_0xa43b('0xd'),auth[_0xa43b('0x9')](),controller[_0xa43b('0xe')]);router[_0xa43b('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xa43b('0xf')]);router[_0xa43b('0x8')](_0xa43b('0x10'),auth[_0xa43b('0x9')](),controller['getAnswers']);router['get']('/:id/logo',controller['getLogo']);router[_0xa43b('0x8')](_0xa43b('0x11'),controller[_0xa43b('0x12')]);router[_0xa43b('0x8')](_0xa43b('0x13'),controller[_0xa43b('0x14')]);router['get'](_0xa43b('0x15'),controller[_0xa43b('0x16')]);router['get'](_0xa43b('0x17'),auth[_0xa43b('0x9')](),controller['getInteractions']);router['get']('/:id/snippet',controller[_0xa43b('0x18')]);router['get']('/:id/applications',auth[_0xa43b('0x9')](),controller[_0xa43b('0x19')]);router['get'](_0xa43b('0x1a'),auth[_0xa43b('0x9')](),controller[_0xa43b('0x1b')]);router['get'](_0xa43b('0x1c'),controller[_0xa43b('0x1d')]);router[_0xa43b('0x8')](_0xa43b('0x1e'),auth[_0xa43b('0x9')](),controller[_0xa43b('0x1f')]);router['get'](_0xa43b('0x20'),auth[_0xa43b('0x9')](),controller['getAgents']);router[_0xa43b('0x21')]('/',auth[_0xa43b('0x9')](),controller[_0xa43b('0x22')]);router[_0xa43b('0x21')](_0xa43b('0x23'),auth[_0xa43b('0x9')](),controller['addDisposition']);router[_0xa43b('0x21')](_0xa43b('0x10'),auth[_0xa43b('0x9')](),controller[_0xa43b('0x24')]);var upload=multer({'storage':multer[_0xa43b('0x25')]({'destination':function(_0x4e5c02,_0x3f673b,_0x308288){_0x308288(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x4fcbf4,_0x3989ff,_0x86c2a1){_0x86c2a1(null,util[_0xa43b('0x26')](_0xa43b('0x27'),Date[_0xa43b('0x28')](),_0x3989ff[_0xa43b('0x29')]));}})});router['post']('/:id/logo',upload[_0xa43b('0x2a')](_0xa43b('0x2b')),controller[_0xa43b('0x2c')]);var upload=multer({'storage':multer[_0xa43b('0x25')]({'destination':function(_0x50f654,_0x1cae6e,_0x46ec17){_0x46ec17(null,path[_0xa43b('0x2d')](config[_0xa43b('0x2e')],_0xa43b('0x2f')));},'filename':function(_0x477163,_0x529ba2,_0x2d28e4){_0x2d28e4(null,util[_0xa43b('0x26')](_0xa43b('0x27'),Date[_0xa43b('0x28')](),_0x529ba2[_0xa43b('0x29')]));}})});router[_0xa43b('0x21')](_0xa43b('0x11'),upload[_0xa43b('0x2a')](_0xa43b('0x2b')),controller['addAvatar']);var upload=multer({'storage':multer[_0xa43b('0x25')]({'destination':function(_0x2ccee2,_0xa3296c,_0x273269){_0x273269(null,path['join'](config[_0xa43b('0x2e')],'server/files/images/avatars/'));},'filename':function(_0x3f4933,_0x4cf8ee,_0x56171b){_0x56171b(null,util[_0xa43b('0x26')](_0xa43b('0x27'),Date[_0xa43b('0x28')](),_0x4cf8ee[_0xa43b('0x29')]));}})});router[_0xa43b('0x21')](_0xa43b('0x13'),upload[_0xa43b('0x2a')](_0xa43b('0x2b')),controller[_0xa43b('0x30')]);var upload=multer({'storage':multer[_0xa43b('0x25')]({'destination':function(_0x36fd57,_0x2c7cc9,_0x52926d){_0x52926d(null,path[_0xa43b('0x2d')](config[_0xa43b('0x2e')],_0xa43b('0x2f')));},'filename':function(_0x37ddb0,_0x27a68c,_0x207f9e){_0x207f9e(null,util[_0xa43b('0x26')](_0xa43b('0x27'),Date[_0xa43b('0x28')](),_0x27a68c[_0xa43b('0x29')]));}})});router[_0xa43b('0x21')](_0xa43b('0x15'),upload[_0xa43b('0x2a')](_0xa43b('0x2b')),controller[_0xa43b('0x31')]);router[_0xa43b('0x21')](_0xa43b('0x32'),controller[_0xa43b('0x33')]);router[_0xa43b('0x21')](_0xa43b('0x34'),controller[_0xa43b('0x35')]);router['post'](_0xa43b('0x17'),auth[_0xa43b('0x9')](),controller['addInteraction']);router['post'](_0xa43b('0x36'),auth['isAuthenticated'](),controller[_0xa43b('0x37')]);router[_0xa43b('0x21')]('/:id/proactive_actions',auth[_0xa43b('0x9')](),controller[_0xa43b('0x38')]);router['post'](_0xa43b('0x20'),auth[_0xa43b('0x9')](),controller[_0xa43b('0x39')]);router[_0xa43b('0x3a')](_0xa43b('0xd'),auth[_0xa43b('0x9')](),controller[_0xa43b('0x3b')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa43b('0x3c')]);router[_0xa43b('0x3d')](_0xa43b('0x23'),auth[_0xa43b('0x9')](),controller[_0xa43b('0x3e')]);router[_0xa43b('0x3d')]('/:id/canned_answers',auth[_0xa43b('0x9')](),controller[_0xa43b('0x3f')]);router[_0xa43b('0x3d')](_0xa43b('0x20'),auth[_0xa43b('0x9')](),controller[_0xa43b('0x40')]);module[_0xa43b('0x41')]=router; \ No newline at end of file +var _0x66d6=['getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','getApplications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','post','diskStorage','join','server/files/images/logos/','%s-%s','now','originalname','single','file','addLogo','root','server/files/images/avatars/','/:id/avatar','addAvatar','format','addSystemAvatar','/:id/notify','notify','/:id/offline','addInteraction','/:id/applications','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','put','/:id','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x66d6,0x6c));var _0x666d=function(_0x57a0e2,_0x34d072){_0x57a0e2=_0x57a0e2-0x0;var _0xd9e589=_0x66d6[_0x57a0e2];return _0xd9e589;};'use strict';var multer=require('multer');var util=require(_0x666d('0x0'));var path=require(_0x666d('0x1'));var timeout=require(_0x666d('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x666d('0x3'));var config=require(_0x666d('0x4'));var controller=require('./chatWebsite.controller');router[_0x666d('0x5')]('/',auth['isAuthenticated'](),controller[_0x666d('0x6')]);router[_0x666d('0x5')](_0x666d('0x7'),auth[_0x666d('0x8')](),controller[_0x666d('0x9')]);router[_0x666d('0x5')]('/:id',auth[_0x666d('0x8')](),controller[_0x666d('0xa')]);router[_0x666d('0x5')](_0x666d('0xb'),auth[_0x666d('0x8')](),controller[_0x666d('0xc')]);router[_0x666d('0x5')](_0x666d('0xd'),auth['isAuthenticated'](),controller[_0x666d('0xe')]);router[_0x666d('0x5')](_0x666d('0xf'),controller['getLogo']);router[_0x666d('0x5')]('/:id/avatar',controller[_0x666d('0x10')]);router['get'](_0x666d('0x11'),controller[_0x666d('0x12')]);router[_0x666d('0x5')](_0x666d('0x13'),controller['getSystemAvatar']);router[_0x666d('0x5')](_0x666d('0x14'),auth['isAuthenticated'](),controller[_0x666d('0x15')]);router[_0x666d('0x5')]('/:id/snippet',controller['getSnippet']);router[_0x666d('0x5')]('/:id/applications',auth['isAuthenticated'](),controller[_0x666d('0x16')]);router[_0x666d('0x5')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x666d('0x17')]);router[_0x666d('0x5')](_0x666d('0x18'),controller[_0x666d('0x19')]);router[_0x666d('0x5')](_0x666d('0x1a'),auth[_0x666d('0x8')](),controller['getOfflineMessages']);router[_0x666d('0x5')](_0x666d('0x1b'),auth[_0x666d('0x8')](),controller[_0x666d('0x1c')]);router['post']('/',auth[_0x666d('0x8')](),controller['create']);router[_0x666d('0x1d')](_0x666d('0xb'),auth[_0x666d('0x8')](),controller['addDisposition']);router[_0x666d('0x1d')](_0x666d('0xd'),auth[_0x666d('0x8')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x666d('0x1e')]({'destination':function(_0x6cacf8,_0x95395f,_0x23c6de){_0x23c6de(null,path[_0x666d('0x1f')](config['root'],_0x666d('0x20')));},'filename':function(_0x22b8f8,_0x4a7de4,_0x20e036){_0x20e036(null,util['format'](_0x666d('0x21'),Date[_0x666d('0x22')](),_0x4a7de4[_0x666d('0x23')]));}})});router[_0x666d('0x1d')](_0x666d('0xf'),upload[_0x666d('0x24')](_0x666d('0x25')),controller[_0x666d('0x26')]);var upload=multer({'storage':multer[_0x666d('0x1e')]({'destination':function(_0x48a0ae,_0x576896,_0x11c928){_0x11c928(null,path['join'](config[_0x666d('0x27')],_0x666d('0x28')));},'filename':function(_0x47a231,_0x28481f,_0x50c769){_0x50c769(null,util['format'](_0x666d('0x21'),Date[_0x666d('0x22')](),_0x28481f[_0x666d('0x23')]));}})});router['post'](_0x666d('0x29'),upload[_0x666d('0x24')]('file'),controller[_0x666d('0x2a')]);var upload=multer({'storage':multer[_0x666d('0x1e')]({'destination':function(_0x3c5b50,_0x3a84a0,_0x55afff){_0x55afff(null,path[_0x666d('0x1f')](config[_0x666d('0x27')],'server/files/images/avatars/'));},'filename':function(_0x291cdb,_0x5774f8,_0x1b84f6){_0x1b84f6(null,util[_0x666d('0x2b')](_0x666d('0x21'),Date['now'](),_0x5774f8['originalname']));}})});router[_0x666d('0x1d')]('/:id/customer_avatar',upload['single'](_0x666d('0x25')),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xe0c9f8,_0x57b70e,_0x1beb60){_0x1beb60(null,path[_0x666d('0x1f')](config['root'],_0x666d('0x28')));},'filename':function(_0x3cc458,_0x589816,_0x13485c){_0x13485c(null,util[_0x666d('0x2b')](_0x666d('0x21'),Date[_0x666d('0x22')](),_0x589816[_0x666d('0x23')]));}})});router[_0x666d('0x1d')](_0x666d('0x13'),upload[_0x666d('0x24')](_0x666d('0x25')),controller[_0x666d('0x2c')]);router[_0x666d('0x1d')](_0x666d('0x2d'),controller[_0x666d('0x2e')]);router[_0x666d('0x1d')](_0x666d('0x2f'),controller['offline']);router[_0x666d('0x1d')](_0x666d('0x14'),auth['isAuthenticated'](),controller[_0x666d('0x30')]);router[_0x666d('0x1d')](_0x666d('0x31'),auth[_0x666d('0x8')](),controller[_0x666d('0x32')]);router['post'](_0x666d('0x33'),auth[_0x666d('0x8')](),controller[_0x666d('0x34')]);router[_0x666d('0x1d')](_0x666d('0x1b'),auth[_0x666d('0x8')](),controller[_0x666d('0x35')]);router[_0x666d('0x36')](_0x666d('0x37'),auth[_0x666d('0x8')](),controller['update']);router[_0x666d('0x38')]('/:id',auth[_0x666d('0x8')](),controller[_0x666d('0x39')]);router[_0x666d('0x38')](_0x666d('0xb'),auth['isAuthenticated'](),controller[_0x666d('0x3a')]);router[_0x666d('0x38')](_0x666d('0xd'),auth[_0x666d('0x8')](),controller[_0x666d('0x3b')]);router[_0x666d('0x38')](_0x666d('0x1b'),auth['isAuthenticated'](),controller[_0x666d('0x3c')]);module[_0x666d('0x3d')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 9ed3537..4a10e32 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 _0x9a6b=['exports','STRING','ENUM','AmazonAWS','Google','sequelize'];(function(_0xd71ff9,_0x36cd21){var _0x2834ef=function(_0x532570){while(--_0x532570){_0xd71ff9['push'](_0xd71ff9['shift']());}};_0x2834ef(++_0x36cd21);}(_0x9a6b,0x77));var _0xb9a6=function(_0x40af92,_0x22abf7){_0x40af92=_0x40af92-0x0;var _0x4b92ee=_0x9a6b[_0x40af92];return _0x4b92ee;};'use strict';var Sequelize=require(_0xb9a6('0x0'));module[_0xb9a6('0x1')]={'name':{'type':Sequelize[_0xb9a6('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xb9a6('0x3')](_0xb9a6('0x4'),_0xb9a6('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xb9a6('0x2')]}}; \ No newline at end of file +var _0xab3f=['STRING','ENUM','AmazonAWS','Google','sequelize'];(function(_0x524c9e,_0x10cde9){var _0x1455cc=function(_0x47118e){while(--_0x47118e){_0x524c9e['push'](_0x524c9e['shift']());}};_0x1455cc(++_0x10cde9);}(_0xab3f,0x72));var _0xfab3=function(_0x17deb1,_0xe90494){_0x17deb1=_0x17deb1-0x0;var _0x47a302=_0xab3f[_0x17deb1];return _0x47a302;};'use strict';var Sequelize=require(_0xfab3('0x0'));module['exports']={'name':{'type':Sequelize[_0xfab3('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xfab3('0x2')](_0xfab3('0x3'),_0xfab3('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xfab3('0x1')]},'data2':{'type':Sequelize[_0xfab3('0x1')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 35ca51a..9a55af0 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 _0x2158=['ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','CloudProvider','rawAttributes','key','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','findAll','rows','catch','show','params','keys','includeAll','include','find','create','html-pdf','rimraf','fast-json-patch','request-promise','util','path','to-csv'];(function(_0x328b1c,_0xec0b4f){var _0x4dbeaa=function(_0x432519){while(--_0x432519){_0x328b1c['push'](_0x328b1c['shift']());}};_0x4dbeaa(++_0xec0b4f);}(_0x2158,0x157));var _0x8215=function(_0x222c51,_0x20a82a){_0x222c51=_0x222c51-0x0;var _0x3af2a4=_0x2158[_0x222c51];return _0x3af2a4;};'use strict';var pdf=require(_0x8215('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8215('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8215('0x2'));var rp=require(_0x8215('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8215('0x4'));var path=require(_0x8215('0x5'));var sox=require('sox');var csv=require(_0x8215('0x6'));var ejs=require(_0x8215('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8215('0x8'));var crypto=require(_0x8215('0x9'));var jsforce=require(_0x8215('0xa'));var deskjs=require(_0x8215('0xb'));var toCsv=require(_0x8215('0x6'));var querystring=require('querystring');var Papa=require(_0x8215('0xc'));var Redis=require(_0x8215('0xd'));var authService=require(_0x8215('0xe'));var qs=require(_0x8215('0xf'));var as=require(_0x8215('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8215('0x11'))(_0x8215('0x12'));var utils=require(_0x8215('0x13'));var config=require(_0x8215('0x14'));var db=require(_0x8215('0x15'))['db'];function respondWithStatusCode(_0x2df482,_0x444e99){_0x444e99=_0x444e99||0xcc;return function(_0x4ba018){if(_0x4ba018){return _0x2df482['sendStatus'](_0x444e99);}return _0x2df482[_0x8215('0x16')](_0x444e99)[_0x8215('0x17')]();};}function respondWithResult(_0x17d731,_0x42f059){_0x42f059=_0x42f059||0xc8;return function(_0x5ececb){if(_0x5ececb){return _0x17d731[_0x8215('0x16')](_0x42f059)[_0x8215('0x18')](_0x5ececb);}};}function respondWithFilteredResult(_0x36cc2b,_0x4bd9d1){return function(_0x1b01d3){if(_0x1b01d3){var _0x5ccbca=_0x1b01d3['count'],_0xacfb09=_0x4bd9d1[_0x8215('0x19')],_0x475ae4=_0x4bd9d1['offset']+_0x4bd9d1[_0x8215('0x1a')],_0x4e98d4;if(_0x475ae4>=_0x5ccbca){_0x475ae4=_0x5ccbca;_0x4e98d4=0xc8;}else{_0x4e98d4=0xce;}_0x36cc2b[_0x8215('0x16')](_0x4e98d4);return _0x36cc2b[_0x8215('0x1b')]('Content-Range',_0xacfb09+'-'+_0x475ae4+'/'+_0x5ccbca)[_0x8215('0x18')](_0x1b01d3);}return null;};}function patchUpdates(_0x505d1b){return function(_0x5d968c){try{jsonpatch[_0x8215('0x1c')](_0x5d968c,_0x505d1b,!![]);}catch(_0x4cae40){return BPromise[_0x8215('0x1d')](_0x4cae40);}return _0x5d968c[_0x8215('0x1e')]();};}function saveUpdates(_0x6f16f9,_0x38d246){return function(_0x536ccb){if(_0x536ccb){return _0x536ccb['update'](_0x6f16f9)[_0x8215('0x1f')](function(_0x3933ab){return _0x3933ab;});}return null;};}function removeEntity(_0x5ba0cc,_0x24eda6){return function(_0x231e9a){if(_0x231e9a){return _0x231e9a[_0x8215('0x20')]()[_0x8215('0x1f')](function(){_0x5ba0cc[_0x8215('0x16')](0xcc)[_0x8215('0x17')]();});}};}function handleEntityNotFound(_0x3cb396,_0x241d5b){return function(_0x433ea9){if(!_0x433ea9){_0x3cb396[_0x8215('0x21')](0x194);}return _0x433ea9;};}function handleError(_0x1eb0e9,_0x4e0d26){_0x4e0d26=_0x4e0d26||0x1f4;return function(_0x42ab40){logger[_0x8215('0x22')](_0x42ab40[_0x8215('0x23')]);if(_0x42ab40['name']){delete _0x42ab40[_0x8215('0x24')];}_0x1eb0e9[_0x8215('0x16')](_0x4e0d26)[_0x8215('0x25')](_0x42ab40);};}exports['index']=function(_0x351030,_0x125b50){var _0x31e12d={},_0x1114f5={},_0x3c52ca={'count':0x0,'rows':[]};var _0x325fdc=_[_0x8215('0x26')](db[_0x8215('0x27')][_0x8215('0x28')],function(_0x57d7d4){return{'name':_0x57d7d4['fieldName'],'type':_0x57d7d4['type'][_0x8215('0x29')]};});_0x1114f5[_0x8215('0x2a')]=_[_0x8215('0x26')](_0x325fdc,_0x8215('0x24'));_0x1114f5[_0x8215('0x2b')]=_['keys'](_0x351030['query']);_0x1114f5['filters']=_['intersection'](_0x1114f5[_0x8215('0x2a')],_0x1114f5[_0x8215('0x2b')]);_0x31e12d[_0x8215('0x2c')]=_[_0x8215('0x2d')](_0x1114f5[_0x8215('0x2a')],qs[_0x8215('0x2e')](_0x351030[_0x8215('0x2b')][_0x8215('0x2e')]));_0x31e12d['attributes']=_0x31e12d[_0x8215('0x2c')][_0x8215('0x2f')]?_0x31e12d[_0x8215('0x2c')]:_0x1114f5[_0x8215('0x2a')];if(!_0x351030[_0x8215('0x2b')]['hasOwnProperty'](_0x8215('0x30'))){_0x31e12d[_0x8215('0x1a')]=qs[_0x8215('0x1a')](_0x351030[_0x8215('0x2b')][_0x8215('0x1a')]);_0x31e12d['offset']=qs['offset'](_0x351030[_0x8215('0x2b')]['offset']);}_0x31e12d[_0x8215('0x31')]=qs['sort'](_0x351030[_0x8215('0x2b')][_0x8215('0x32')]);_0x31e12d[_0x8215('0x33')]=qs[_0x8215('0x34')](_[_0x8215('0x35')](_0x351030[_0x8215('0x2b')],_0x1114f5[_0x8215('0x34')]),_0x325fdc);if(_0x351030[_0x8215('0x2b')][_0x8215('0x36')]){_0x31e12d[_0x8215('0x33')]=_[_0x8215('0x37')](_0x31e12d['where'],{'$or':_[_0x8215('0x26')](_0x325fdc,function(_0x534b35){if(_0x534b35[_0x8215('0x38')]!==_0x8215('0x39')){var _0xe0b6a4={};_0xe0b6a4[_0x534b35['name']]={'$like':'%'+_0x351030['query'][_0x8215('0x36')]+'%'};return _0xe0b6a4;}})});}_0x31e12d=_[_0x8215('0x37')]({},_0x31e12d,_0x351030[_0x8215('0x3a')]);var _0x19728a={'where':_0x31e12d[_0x8215('0x33')]};return db['CloudProvider'][_0x8215('0x3b')](_0x19728a)[_0x8215('0x1f')](function(_0x3b7ce7){_0x3c52ca[_0x8215('0x3b')]=_0x3b7ce7;if(_0x351030[_0x8215('0x2b')]['includeAll']){_0x31e12d['include']=[{'all':!![]}];}return db[_0x8215('0x27')][_0x8215('0x3c')](_0x31e12d);})[_0x8215('0x1f')](function(_0x349b62){_0x3c52ca[_0x8215('0x3d')]=_0x349b62;return _0x3c52ca;})[_0x8215('0x1f')](respondWithFilteredResult(_0x125b50,_0x31e12d))[_0x8215('0x3e')](handleError(_0x125b50,null));};exports[_0x8215('0x3f')]=function(_0x1bd242,_0x303a0d){var _0x47a453={'raw':!![],'where':{'id':_0x1bd242[_0x8215('0x40')]['id']}},_0x582479={};_0x582479[_0x8215('0x2a')]=_['keys'](db[_0x8215('0x27')][_0x8215('0x28')]);_0x582479[_0x8215('0x2b')]=_[_0x8215('0x41')](_0x1bd242['query']);_0x582479[_0x8215('0x34')]=_[_0x8215('0x2d')](_0x582479[_0x8215('0x2a')],_0x582479[_0x8215('0x2b')]);_0x47a453[_0x8215('0x2c')]=_[_0x8215('0x2d')](_0x582479[_0x8215('0x2a')],qs['fields'](_0x1bd242[_0x8215('0x2b')][_0x8215('0x2e')]));_0x47a453['attributes']=_0x47a453[_0x8215('0x2c')]['length']?_0x47a453[_0x8215('0x2c')]:_0x582479[_0x8215('0x2a')];if(_0x1bd242['query'][_0x8215('0x42')]){_0x47a453[_0x8215('0x43')]=[{'all':!![]}];}_0x47a453=_['merge']({},_0x47a453,_0x1bd242['options']);return db[_0x8215('0x27')][_0x8215('0x44')](_0x47a453)[_0x8215('0x1f')](handleEntityNotFound(_0x303a0d,null))[_0x8215('0x1f')](respondWithResult(_0x303a0d,null))['catch'](handleError(_0x303a0d,null));};exports[_0x8215('0x45')]=function(_0x4716d8,_0x2e61c5){return db[_0x8215('0x27')]['create'](_0x4716d8['body'],{})[_0x8215('0x1f')](respondWithResult(_0x2e61c5,0xc9))[_0x8215('0x3e')](handleError(_0x2e61c5,null));};exports['update']=function(_0x4b3618,_0x2629b5){if(_0x4b3618['body']['id']){delete _0x4b3618['body']['id'];}return db[_0x8215('0x27')]['find']({'where':{'id':_0x4b3618[_0x8215('0x40')]['id']}})[_0x8215('0x1f')](handleEntityNotFound(_0x2629b5,null))[_0x8215('0x1f')](saveUpdates(_0x4b3618['body'],null))['then'](respondWithResult(_0x2629b5,null))['catch'](handleError(_0x2629b5,null));};exports[_0x8215('0x20')]=function(_0x54b9cd,_0x1155df){return db[_0x8215('0x27')][_0x8215('0x44')]({'where':{'id':_0x54b9cd[_0x8215('0x40')]['id']}})[_0x8215('0x1f')](handleEntityNotFound(_0x1155df,null))[_0x8215('0x1f')](removeEntity(_0x1155df,null))[_0x8215('0x3e')](handleError(_0x1155df,null));}; \ No newline at end of file +var _0xfc08=['error','stack','name','send','map','CloudProvider','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','includeAll','rows','catch','show','params','merge','options','create','update','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','then','destroy'];(function(_0x6ae980,_0x180698){var _0x370d55=function(_0x4b97d){while(--_0x4b97d){_0x6ae980['push'](_0x6ae980['shift']());}};_0x370d55(++_0x180698);}(_0xfc08,0x196));var _0x8fc0=function(_0x5345b5,_0xa684b4){_0x5345b5=_0x5345b5-0x0;var _0x2b6b53=_0xfc08[_0x5345b5];return _0x2b6b53;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8fc0('0x0'));var rimraf=require(_0x8fc0('0x1'));var zipdir=require(_0x8fc0('0x2'));var jsonpatch=require(_0x8fc0('0x3'));var rp=require(_0x8fc0('0x4'));var moment=require(_0x8fc0('0x5'));var BPromise=require(_0x8fc0('0x6'));var Mustache=require(_0x8fc0('0x7'));var util=require(_0x8fc0('0x8'));var path=require(_0x8fc0('0x9'));var sox=require(_0x8fc0('0xa'));var csv=require(_0x8fc0('0xb'));var ejs=require(_0x8fc0('0xc'));var fs=require('fs');var _=require(_0x8fc0('0xd'));var squel=require(_0x8fc0('0xe'));var crypto=require(_0x8fc0('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8fc0('0xb'));var querystring=require(_0x8fc0('0x10'));var Papa=require('papaparse');var Redis=require(_0x8fc0('0x11'));var authService=require(_0x8fc0('0x12'));var qs=require(_0x8fc0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8fc0('0x14'));var logger=require(_0x8fc0('0x15'))(_0x8fc0('0x16'));var utils=require(_0x8fc0('0x17'));var config=require(_0x8fc0('0x18'));var db=require(_0x8fc0('0x19'))['db'];function respondWithStatusCode(_0x132834,_0x395dab){_0x395dab=_0x395dab||0xcc;return function(_0x40705c){if(_0x40705c){return _0x132834[_0x8fc0('0x1a')](_0x395dab);}return _0x132834[_0x8fc0('0x1b')](_0x395dab)[_0x8fc0('0x1c')]();};}function respondWithResult(_0x11bcc3,_0x4e5176){_0x4e5176=_0x4e5176||0xc8;return function(_0x373262){if(_0x373262){return _0x11bcc3['status'](_0x4e5176)[_0x8fc0('0x1d')](_0x373262);}};}function respondWithFilteredResult(_0x4e530c,_0x5b2a20){return function(_0xd720d3){if(_0xd720d3){var _0x18e2ed=_0xd720d3[_0x8fc0('0x1e')],_0x10b855=_0x5b2a20[_0x8fc0('0x1f')],_0x5c61c4=_0x5b2a20['offset']+_0x5b2a20[_0x8fc0('0x20')],_0x373887;if(_0x5c61c4>=_0x18e2ed){_0x5c61c4=_0x18e2ed;_0x373887=0xc8;}else{_0x373887=0xce;}_0x4e530c[_0x8fc0('0x1b')](_0x373887);return _0x4e530c[_0x8fc0('0x21')](_0x8fc0('0x22'),_0x10b855+'-'+_0x5c61c4+'/'+_0x18e2ed)[_0x8fc0('0x1d')](_0xd720d3);}return null;};}function patchUpdates(_0x4157a2){return function(_0x3ab862){try{jsonpatch[_0x8fc0('0x23')](_0x3ab862,_0x4157a2,!![]);}catch(_0x28b935){return BPromise['reject'](_0x28b935);}return _0x3ab862['save']();};}function saveUpdates(_0x46ec2b,_0x76451d){return function(_0x36eb9f){if(_0x36eb9f){return _0x36eb9f['update'](_0x46ec2b)[_0x8fc0('0x24')](function(_0x266eca){return _0x266eca;});}return null;};}function removeEntity(_0x360c67,_0x3e2788){return function(_0x5a7b1a){if(_0x5a7b1a){return _0x5a7b1a[_0x8fc0('0x25')]()['then'](function(){_0x360c67[_0x8fc0('0x1b')](0xcc)[_0x8fc0('0x1c')]();});}};}function handleEntityNotFound(_0x337d56,_0x63e720){return function(_0x5a29c6){if(!_0x5a29c6){_0x337d56[_0x8fc0('0x1a')](0x194);}return _0x5a29c6;};}function handleError(_0x2d7541,_0xa13fee){_0xa13fee=_0xa13fee||0x1f4;return function(_0x43deb6){logger[_0x8fc0('0x26')](_0x43deb6[_0x8fc0('0x27')]);if(_0x43deb6[_0x8fc0('0x28')]){delete _0x43deb6[_0x8fc0('0x28')];}_0x2d7541[_0x8fc0('0x1b')](_0xa13fee)[_0x8fc0('0x29')](_0x43deb6);};}exports['index']=function(_0x22e5a6,_0x5d107b){var _0x3618d7={},_0x13fad0={},_0x267850={'count':0x0,'rows':[]};var _0x318127=_[_0x8fc0('0x2a')](db[_0x8fc0('0x2b')][_0x8fc0('0x2c')],function(_0x301a12){return{'name':_0x301a12[_0x8fc0('0x2d')],'type':_0x301a12[_0x8fc0('0x2e')][_0x8fc0('0x2f')]};});_0x13fad0[_0x8fc0('0x30')]=_[_0x8fc0('0x2a')](_0x318127,_0x8fc0('0x28'));_0x13fad0['query']=_[_0x8fc0('0x31')](_0x22e5a6[_0x8fc0('0x32')]);_0x13fad0[_0x8fc0('0x33')]=_[_0x8fc0('0x34')](_0x13fad0[_0x8fc0('0x30')],_0x13fad0[_0x8fc0('0x32')]);_0x3618d7[_0x8fc0('0x35')]=_[_0x8fc0('0x34')](_0x13fad0[_0x8fc0('0x30')],qs[_0x8fc0('0x36')](_0x22e5a6[_0x8fc0('0x32')][_0x8fc0('0x36')]));_0x3618d7[_0x8fc0('0x35')]=_0x3618d7[_0x8fc0('0x35')][_0x8fc0('0x37')]?_0x3618d7[_0x8fc0('0x35')]:_0x13fad0['model'];if(!_0x22e5a6[_0x8fc0('0x32')][_0x8fc0('0x38')](_0x8fc0('0x39'))){_0x3618d7[_0x8fc0('0x20')]=qs[_0x8fc0('0x20')](_0x22e5a6[_0x8fc0('0x32')]['limit']);_0x3618d7[_0x8fc0('0x1f')]=qs[_0x8fc0('0x1f')](_0x22e5a6[_0x8fc0('0x32')]['offset']);}_0x3618d7[_0x8fc0('0x3a')]=qs[_0x8fc0('0x3b')](_0x22e5a6['query'][_0x8fc0('0x3b')]);_0x3618d7[_0x8fc0('0x3c')]=qs[_0x8fc0('0x33')](_[_0x8fc0('0x3d')](_0x22e5a6[_0x8fc0('0x32')],_0x13fad0[_0x8fc0('0x33')]),_0x318127);if(_0x22e5a6['query'][_0x8fc0('0x3e')]){_0x3618d7[_0x8fc0('0x3c')]=_['merge'](_0x3618d7['where'],{'$or':_['map'](_0x318127,function(_0x3eee88){if(_0x3eee88[_0x8fc0('0x2e')]!=='VIRTUAL'){var _0x59be03={};_0x59be03[_0x3eee88['name']]={'$like':'%'+_0x22e5a6[_0x8fc0('0x32')][_0x8fc0('0x3e')]+'%'};return _0x59be03;}})});}_0x3618d7=_['merge']({},_0x3618d7,_0x22e5a6['options']);var _0x52f54a={'where':_0x3618d7['where']};return db[_0x8fc0('0x2b')][_0x8fc0('0x1e')](_0x52f54a)[_0x8fc0('0x24')](function(_0x4a1be2){_0x267850[_0x8fc0('0x1e')]=_0x4a1be2;if(_0x22e5a6[_0x8fc0('0x32')][_0x8fc0('0x3f')]){_0x3618d7['include']=[{'all':!![]}];}return db[_0x8fc0('0x2b')]['findAll'](_0x3618d7);})['then'](function(_0xbfa403){_0x267850[_0x8fc0('0x40')]=_0xbfa403;return _0x267850;})[_0x8fc0('0x24')](respondWithFilteredResult(_0x5d107b,_0x3618d7))[_0x8fc0('0x41')](handleError(_0x5d107b,null));};exports[_0x8fc0('0x42')]=function(_0x2da4a5,_0x433883){var _0x5ed671={'raw':!![],'where':{'id':_0x2da4a5[_0x8fc0('0x43')]['id']}},_0x3d6ba7={};_0x3d6ba7[_0x8fc0('0x30')]=_[_0x8fc0('0x31')](db['CloudProvider'][_0x8fc0('0x2c')]);_0x3d6ba7[_0x8fc0('0x32')]=_[_0x8fc0('0x31')](_0x2da4a5[_0x8fc0('0x32')]);_0x3d6ba7[_0x8fc0('0x33')]=_[_0x8fc0('0x34')](_0x3d6ba7[_0x8fc0('0x30')],_0x3d6ba7[_0x8fc0('0x32')]);_0x5ed671['attributes']=_['intersection'](_0x3d6ba7[_0x8fc0('0x30')],qs[_0x8fc0('0x36')](_0x2da4a5[_0x8fc0('0x32')]['fields']));_0x5ed671[_0x8fc0('0x35')]=_0x5ed671[_0x8fc0('0x35')][_0x8fc0('0x37')]?_0x5ed671[_0x8fc0('0x35')]:_0x3d6ba7[_0x8fc0('0x30')];if(_0x2da4a5[_0x8fc0('0x32')][_0x8fc0('0x3f')]){_0x5ed671['include']=[{'all':!![]}];}_0x5ed671=_[_0x8fc0('0x44')]({},_0x5ed671,_0x2da4a5[_0x8fc0('0x45')]);return db[_0x8fc0('0x2b')]['find'](_0x5ed671)[_0x8fc0('0x24')](handleEntityNotFound(_0x433883,null))[_0x8fc0('0x24')](respondWithResult(_0x433883,null))[_0x8fc0('0x41')](handleError(_0x433883,null));};exports[_0x8fc0('0x46')]=function(_0x3c8fd4,_0x5e95a5){return db[_0x8fc0('0x2b')][_0x8fc0('0x46')](_0x3c8fd4['body'],{})[_0x8fc0('0x24')](respondWithResult(_0x5e95a5,0xc9))[_0x8fc0('0x41')](handleError(_0x5e95a5,null));};exports[_0x8fc0('0x47')]=function(_0x4c0727,_0x416a3b){if(_0x4c0727[_0x8fc0('0x48')]['id']){delete _0x4c0727[_0x8fc0('0x48')]['id'];}return db['CloudProvider']['find']({'where':{'id':_0x4c0727[_0x8fc0('0x43')]['id']}})[_0x8fc0('0x24')](handleEntityNotFound(_0x416a3b,null))[_0x8fc0('0x24')](saveUpdates(_0x4c0727[_0x8fc0('0x48')],null))[_0x8fc0('0x24')](respondWithResult(_0x416a3b,null))['catch'](handleError(_0x416a3b,null));};exports['destroy']=function(_0x22bde3,_0x49d6c4){return db['CloudProvider'][_0x8fc0('0x49')]({'where':{'id':_0x22bde3['params']['id']}})['then'](handleEntityNotFound(_0x49d6c4,null))['then'](removeEntity(_0x49d6c4,null))[_0x8fc0('0x41')](handleError(_0x49d6c4,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index f63fe24..b27c156 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 _0xa057=['path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','cloud_providers','util','api','moment','bluebird','request-promise'];(function(_0xadd386,_0x1fda2a){var _0xb996dd=function(_0x2c95b8){while(--_0x2c95b8){_0xadd386['push'](_0xadd386['shift']());}};_0xb996dd(++_0x1fda2a);}(_0xa057,0xd3));var _0x7a05=function(_0x5963cf,_0x5a6068){_0x5963cf=_0x5963cf-0x0;var _0x2457ef=_0xa057[_0x5963cf];return _0x2457ef;};'use strict';var _=require('lodash');var util=require(_0x7a05('0x0'));var logger=require('../../config/logger')(_0x7a05('0x1'));var moment=require(_0x7a05('0x2'));var BPromise=require(_0x7a05('0x3'));var rp=require(_0x7a05('0x4'));var fs=require('fs');var path=require(_0x7a05('0x5'));var rimraf=require(_0x7a05('0x6'));var config=require(_0x7a05('0x7'));var attributes=require(_0x7a05('0x8'));module[_0x7a05('0x9')]=function(_0x439abd,_0x3033dc){return _0x439abd[_0x7a05('0xa')]('CloudProvider',attributes,{'tableName':_0x7a05('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa69d=['exports','define','CloudProvider','cloud_providers','util','moment','bluebird','request-promise','path','../../config/environment','./cloudProvider.attributes'];(function(_0x2619a0,_0x4ab479){var _0x94f5f8=function(_0x1866b6){while(--_0x1866b6){_0x2619a0['push'](_0x2619a0['shift']());}};_0x94f5f8(++_0x4ab479);}(_0xa69d,0x67));var _0xda69=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa69d[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require('lodash');var util=require(_0xda69('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xda69('0x1'));var BPromise=require(_0xda69('0x2'));var rp=require(_0xda69('0x3'));var fs=require('fs');var path=require(_0xda69('0x4'));var rimraf=require('rimraf');var config=require(_0xda69('0x5'));var attributes=require(_0xda69('0x6'));module[_0xda69('0x7')]=function(_0x229b17,_0x29ed3c){return _0x229b17[_0xda69('0x8')](_0xda69('0x9'),attributes,{'tableName':_0xda69('0xa'),'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 b232c71..2843926 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 _0xb466=['jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x3f6cdf,_0xe7354e){var _0xf60c51=function(_0x26c4e5){while(--_0x26c4e5){_0x3f6cdf['push'](_0x3f6cdf['shift']());}};_0xf60c51(++_0xe7354e);}(_0xb466,0x65));var _0x6b46=function(_0x1c9357,_0xb5f1d){_0x1c9357=_0x1c9357-0x0;var _0x48e09e=_0xb466[_0x1c9357];return _0x48e09e;};'use strict';var _=require('lodash');var util=require(_0x6b46('0x0'));var moment=require(_0x6b46('0x1'));var BPromise=require(_0x6b46('0x2'));var rs=require(_0x6b46('0x3'));var fs=require('fs');var Redis=require(_0x6b46('0x4'));var db=require(_0x6b46('0x5'))['db'];var utils=require(_0x6b46('0x6'));var logger=require(_0x6b46('0x7'))('rpc');var config=require(_0x6b46('0x8'));var jayson=require(_0x6b46('0x9'));var client=jayson[_0x6b46('0xa')][_0x6b46('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35a34b,_0x56e0ad,_0x1cafc5){return new BPromise(function(_0xb8d14c,_0x2f7350){return client[_0x6b46('0xc')](_0x35a34b,_0x1cafc5)[_0x6b46('0xd')](function(_0x241f76){logger[_0x6b46('0xe')]('CloudProvider,\x20%s,\x20%s',_0x56e0ad,_0x6b46('0xf'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x56e0ad,_0x6b46('0xf'),JSON[_0x6b46('0x10')](_0x241f76));if(_0x241f76['error']){if(_0x241f76[_0x6b46('0x11')][_0x6b46('0x12')]===0x1f4){logger[_0x6b46('0x11')](_0x6b46('0x13'),_0x56e0ad,_0x241f76[_0x6b46('0x11')]['message']);return _0x2f7350(_0x241f76[_0x6b46('0x11')]['message']);}logger['error'](_0x6b46('0x13'),_0x56e0ad,_0x241f76[_0x6b46('0x11')]['message']);return _0xb8d14c(_0x241f76['error'][_0x6b46('0x14')]);}else{logger[_0x6b46('0xe')]('CloudProvider,\x20%s,\x20%s',_0x56e0ad,_0x6b46('0xf'));_0xb8d14c(_0x241f76[_0x6b46('0x15')][_0x6b46('0x14')]);}})['catch'](function(_0x24d930){logger[_0x6b46('0x11')](_0x6b46('0x13'),_0x56e0ad,_0x24d930);_0x2f7350(_0x24d930);});});} \ No newline at end of file +var _0xe385=['info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x3cc05d,_0x4b8f88){var _0x28b736=function(_0x369b0e){while(--_0x369b0e){_0x3cc05d['push'](_0x3cc05d['shift']());}};_0x28b736(++_0x4b8f88);}(_0xe385,0xb1));var _0x5e38=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xe385[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x5e38('0x0'));var util=require(_0x5e38('0x1'));var moment=require(_0x5e38('0x2'));var BPromise=require(_0x5e38('0x3'));var rs=require(_0x5e38('0x4'));var fs=require('fs');var Redis=require(_0x5e38('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5e38('0x6'));var config=require(_0x5e38('0x7'));var jayson=require(_0x5e38('0x8'));var client=jayson['client'][_0x5e38('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x423991,_0x29ea95,_0x45801d){return new BPromise(function(_0x4a3ac,_0x5da843){return client[_0x5e38('0xa')](_0x423991,_0x45801d)[_0x5e38('0xb')](function(_0x611e91){logger[_0x5e38('0xc')](_0x5e38('0xd'),_0x29ea95,_0x5e38('0xe'));logger['debug'](_0x5e38('0xf'),_0x29ea95,_0x5e38('0xe'),JSON[_0x5e38('0x10')](_0x611e91));if(_0x611e91['error']){if(_0x611e91[_0x5e38('0x11')]['code']===0x1f4){logger[_0x5e38('0x11')](_0x5e38('0xd'),_0x29ea95,_0x611e91[_0x5e38('0x11')][_0x5e38('0x12')]);return _0x5da843(_0x611e91['error'][_0x5e38('0x12')]);}logger[_0x5e38('0x11')](_0x5e38('0xd'),_0x29ea95,_0x611e91[_0x5e38('0x11')][_0x5e38('0x12')]);return _0x4a3ac(_0x611e91['error'][_0x5e38('0x12')]);}else{logger[_0x5e38('0xc')](_0x5e38('0xd'),_0x29ea95,_0x5e38('0xe'));_0x4a3ac(_0x611e91[_0x5e38('0x13')][_0x5e38('0x12')]);}})[_0x5e38('0x14')](function(_0x472e21){logger[_0x5e38('0x11')](_0x5e38('0xd'),_0x29ea95,_0x472e21);_0x5da843(_0x472e21);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index cd2a791..2d2ed97 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 _0x6e28=['/:id','show','post','put','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','isAuthenticated','get'];(function(_0x2767c6,_0x2af3d0){var _0x4b1268=function(_0x48361f){while(--_0x48361f){_0x2767c6['push'](_0x2767c6['shift']());}};_0x4b1268(++_0x2af3d0);}(_0x6e28,0xba));var _0x86e2=function(_0x246a15,_0x395579){_0x246a15=_0x246a15-0x0;var _0x5a0b7f=_0x6e28[_0x246a15];return _0x5a0b7f;};'use strict';var multer=require('multer');var util=require(_0x86e2('0x0'));var path=require(_0x86e2('0x1'));var timeout=require(_0x86e2('0x2'));var express=require(_0x86e2('0x3'));var router=express['Router']();var auth=require(_0x86e2('0x4'));var interaction=require(_0x86e2('0x5'));var config=require(_0x86e2('0x6'));var controller=require(_0x86e2('0x7'));router['get']('/',auth[_0x86e2('0x8')](),controller['index']);router[_0x86e2('0x9')](_0x86e2('0xa'),auth[_0x86e2('0x8')](),controller[_0x86e2('0xb')]);router[_0x86e2('0xc')]('/',auth[_0x86e2('0x8')](),controller['create']);router[_0x86e2('0xd')](_0x86e2('0xa'),auth[_0x86e2('0x8')](),controller['update']);router['delete'](_0x86e2('0xa'),auth[_0x86e2('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa100=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x236640,_0x3bfb10){var _0x206cf2=function(_0x5ea27e){while(--_0x5ea27e){_0x236640['push'](_0x236640['shift']());}};_0x206cf2(++_0x3bfb10);}(_0xa100,0x122));var _0x0a10=function(_0x38c5a5,_0x30842e){_0x38c5a5=_0x38c5a5-0x0;var _0x26315f=_0xa100[_0x38c5a5];return _0x26315f;};'use strict';var multer=require(_0x0a10('0x0'));var util=require('util');var path=require(_0x0a10('0x1'));var timeout=require(_0x0a10('0x2'));var express=require(_0x0a10('0x3'));var router=express[_0x0a10('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a10('0x5'));var config=require('../../config/environment');var controller=require('./cloudProvider.controller');router[_0x0a10('0x6')]('/',auth[_0x0a10('0x7')](),controller[_0x0a10('0x8')]);router[_0x0a10('0x6')](_0x0a10('0x9'),auth[_0x0a10('0x7')](),controller[_0x0a10('0xa')]);router[_0x0a10('0xb')]('/',auth[_0x0a10('0x7')](),controller[_0x0a10('0xc')]);router[_0x0a10('0xd')](_0x0a10('0x9'),auth[_0x0a10('0x7')](),controller[_0x0a10('0xe')]);router[_0x0a10('0xf')](_0x0a10('0x9'),auth[_0x0a10('0x7')](),controller[_0x0a10('0x10')]);module[_0x0a10('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 7f4e615..6d47ec2 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 _0x45b3=['STRING','name','sequelize','exports'];(function(_0x41df82,_0x1d1e1a){var _0x4e079f=function(_0x7358db){while(--_0x7358db){_0x41df82['push'](_0x41df82['shift']());}};_0x4e079f(++_0x1d1e1a);}(_0x45b3,0x15a));var _0x345b=function(_0x2ea3a6,_0x473be1){_0x2ea3a6=_0x2ea3a6-0x0;var _0x4fbdcb=_0x45b3[_0x2ea3a6];return _0x4fbdcb;};'use strict';var Sequelize=require(_0x345b('0x0'));module[_0x345b('0x1')]={'name':{'type':Sequelize[_0x345b('0x2')],'unique':_0x345b('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x345b('0x2')]},'website':{'type':Sequelize[_0x345b('0x2')]},'phone':{'type':Sequelize[_0x345b('0x2')]},'fax':{'type':Sequelize[_0x345b('0x2')]},'type':{'type':Sequelize[_0x345b('0x2')]},'street':{'type':Sequelize[_0x345b('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x345b('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x345b('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x345b('0x2')]},'sPostalCode':{'type':Sequelize[_0x345b('0x2')]},'sCity':{'type':Sequelize[_0x345b('0x2')]},'sCountry':{'type':Sequelize[_0x345b('0x2')]},'description':{'type':Sequelize[_0x345b('0x2')]}}; \ No newline at end of file +var _0x7c5b=['STRING','name','sequelize','exports'];(function(_0x2819c7,_0x3bc0bb){var _0x3a859d=function(_0x204b49){while(--_0x204b49){_0x2819c7['push'](_0x2819c7['shift']());}};_0x3a859d(++_0x3bc0bb);}(_0x7c5b,0x122));var _0xb7c5=function(_0x57d518,_0x5f5d23){_0x57d518=_0x57d518-0x0;var _0x218831=_0x7c5b[_0x57d518];return _0x218831;};'use strict';var Sequelize=require(_0xb7c5('0x0'));module[_0xb7c5('0x1')]={'name':{'type':Sequelize[_0xb7c5('0x2')],'unique':_0xb7c5('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xb7c5('0x2')]},'companyId':{'type':Sequelize[_0xb7c5('0x2')]},'website':{'type':Sequelize[_0xb7c5('0x2')]},'phone':{'type':Sequelize[_0xb7c5('0x2')]},'fax':{'type':Sequelize[_0xb7c5('0x2')]},'type':{'type':Sequelize[_0xb7c5('0x2')]},'street':{'type':Sequelize[_0xb7c5('0x2')]},'postalCode':{'type':Sequelize[_0xb7c5('0x2')]},'city':{'type':Sequelize[_0xb7c5('0x2')]},'country':{'type':Sequelize[_0xb7c5('0x2')]},'email':{'type':Sequelize[_0xb7c5('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xb7c5('0x2')]},'sCity':{'type':Sequelize[_0xb7c5('0x2')]},'sCountry':{'type':Sequelize[_0xb7c5('0x2')]},'description':{'type':Sequelize[_0xb7c5('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index fa466da..3f86433 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 _0x4970=['to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','describe','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','filter','merge','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','find','create','CmCompany','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','getContacts','CmContact','sort','pick','map','options','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','jsforce','desk.js'];(function(_0x176d14,_0x3984ea){var _0x89522c=function(_0x3aba48){while(--_0x3aba48){_0x176d14['push'](_0x176d14['shift']());}};_0x89522c(++_0x3984ea);}(_0x4970,0x9e));var _0x0497=function(_0x2801b2,_0x51ba40){_0x2801b2=_0x2801b2-0x0;var _0x2a80cd=_0x4970[_0x2801b2];return _0x2a80cd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0497('0x0'));var rimraf=require(_0x0497('0x1'));var zipdir=require(_0x0497('0x2'));var jsonpatch=require(_0x0497('0x3'));var rp=require(_0x0497('0x4'));var moment=require(_0x0497('0x5'));var BPromise=require(_0x0497('0x6'));var Mustache=require(_0x0497('0x7'));var util=require('util');var path=require(_0x0497('0x8'));var sox=require(_0x0497('0x9'));var csv=require('to-csv');var ejs=require(_0x0497('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0497('0xb'));var crypto=require('crypto');var jsforce=require(_0x0497('0xc'));var deskjs=require(_0x0497('0xd'));var toCsv=require(_0x0497('0xe'));var querystring=require(_0x0497('0xf'));var Papa=require(_0x0497('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0497('0x11'));var hardwareService=require(_0x0497('0x12'));var logger=require(_0x0497('0x13'))(_0x0497('0x14'));var utils=require(_0x0497('0x15'));var config=require('../../config/environment');var db=require(_0x0497('0x16'))['db'];function respondWithStatusCode(_0x2c3b84,_0x1ee44e){_0x1ee44e=_0x1ee44e||0xcc;return function(_0x352489){if(_0x352489){return _0x2c3b84[_0x0497('0x17')](_0x1ee44e);}return _0x2c3b84[_0x0497('0x18')](_0x1ee44e)[_0x0497('0x19')]();};}function respondWithResult(_0x3ad53e,_0x34d136){_0x34d136=_0x34d136||0xc8;return function(_0x5d2079){if(_0x5d2079){return _0x3ad53e[_0x0497('0x18')](_0x34d136)[_0x0497('0x1a')](_0x5d2079);}};}function respondWithFilteredResult(_0xa4ea30,_0x458dfd){return function(_0x43831a){if(_0x43831a){var _0x1c1067=_0x43831a[_0x0497('0x1b')],_0x389009=_0x458dfd[_0x0497('0x1c')],_0x4ab1b5=_0x458dfd['offset']+_0x458dfd['limit'],_0x5a7cc0;if(_0x4ab1b5>=_0x1c1067){_0x4ab1b5=_0x1c1067;_0x5a7cc0=0xc8;}else{_0x5a7cc0=0xce;}_0xa4ea30['status'](_0x5a7cc0);return _0xa4ea30[_0x0497('0x1d')](_0x0497('0x1e'),_0x389009+'-'+_0x4ab1b5+'/'+_0x1c1067)[_0x0497('0x1a')](_0x43831a);}return null;};}function patchUpdates(_0x198793){return function(_0x366526){try{jsonpatch[_0x0497('0x1f')](_0x366526,_0x198793,!![]);}catch(_0xdad44){return BPromise[_0x0497('0x20')](_0xdad44);}return _0x366526[_0x0497('0x21')]();};}function saveUpdates(_0x2042c5,_0x4f2974){return function(_0x26a5e9){if(_0x26a5e9){return _0x26a5e9[_0x0497('0x22')](_0x2042c5)[_0x0497('0x23')](function(_0x1ac48f){return _0x1ac48f;});}return null;};}function removeEntity(_0x5c209e,_0x73c494){return function(_0x5f0863){if(_0x5f0863){return _0x5f0863[_0x0497('0x24')]()['then'](function(){var _0x29740e=_0x5f0863[_0x0497('0x25')]({'plain':!![]});var _0x54dc94=_0x0497('0x26');return db[_0x0497('0x27')][_0x0497('0x24')]({'where':{'type':_0x54dc94,'resourceId':_0x29740e['id']}})[_0x0497('0x23')](function(){return _0x5f0863;});})['then'](function(){_0x5c209e[_0x0497('0x18')](0xcc)[_0x0497('0x19')]();});}};}function handleEntityNotFound(_0x2ab346,_0x2e8c68){return function(_0x4820c6){if(!_0x4820c6){_0x2ab346['sendStatus'](0x194);}return _0x4820c6;};}function handleError(_0x43012a,_0x529070){_0x529070=_0x529070||0x1f4;return function(_0x253ca7){logger[_0x0497('0x28')](_0x253ca7[_0x0497('0x29')]);if(_0x253ca7[_0x0497('0x2a')]){delete _0x253ca7[_0x0497('0x2a')];}_0x43012a[_0x0497('0x18')](_0x529070)[_0x0497('0x2b')](_0x253ca7);};}exports[_0x0497('0x2c')]=function(_0x4d3c8f,_0x27a834){var _0x578c8a={},_0x530333={},_0x2bfc8e={'count':0x0,'rows':[]};return db['CmCompany'][_0x0497('0x2d')]()[_0x0497('0x23')](function(_0x3bee15){_0x530333[_0x0497('0x2e')]=_['keys'](_0x3bee15);_0x530333[_0x0497('0x2f')]=_['keys'](_0x4d3c8f[_0x0497('0x2f')]);_0x530333[_0x0497('0x30')]=_[_0x0497('0x31')](_0x530333[_0x0497('0x2e')],_0x530333['query']);_0x578c8a[_0x0497('0x32')]=_[_0x0497('0x31')](_0x530333[_0x0497('0x2e')],qs[_0x0497('0x33')](_0x4d3c8f[_0x0497('0x2f')][_0x0497('0x33')]));_0x578c8a['attributes']=_0x578c8a[_0x0497('0x32')][_0x0497('0x34')]?_0x578c8a[_0x0497('0x32')]:_0x530333[_0x0497('0x2e')];if(!_0x4d3c8f[_0x0497('0x2f')][_0x0497('0x35')](_0x0497('0x36'))){_0x578c8a[_0x0497('0x37')]=qs[_0x0497('0x37')](_0x4d3c8f['query'][_0x0497('0x37')]);_0x578c8a[_0x0497('0x1c')]=qs[_0x0497('0x1c')](_0x4d3c8f['query']['offset']);}_0x578c8a[_0x0497('0x38')]=qs['sort'](_0x4d3c8f[_0x0497('0x2f')]['sort']);_0x578c8a[_0x0497('0x39')]=qs['filters'](_['pick'](_0x4d3c8f['query'],_0x530333[_0x0497('0x30')]),_0x3bee15);if(_0x4d3c8f[_0x0497('0x2f')][_0x0497('0x3a')]){_0x578c8a[_0x0497('0x39')]=_[_0x0497('0x3b')](_0x578c8a[_0x0497('0x39')],{'$or':_['map'](_0x578c8a[_0x0497('0x32')],function(_0xcc03b){var _0x393a24={};_0x393a24[_0xcc03b]={'$like':'%'+_0x4d3c8f['query'][_0x0497('0x3a')]+'%'};return _0x393a24;})});}_0x578c8a=_[_0x0497('0x3b')]({},_0x578c8a,_0x4d3c8f['options']);var _0x2895b4={'where':_0x578c8a['where']};return db['CmCompany']['count'](_0x2895b4)['then'](function(_0x4ebed3){_0x2bfc8e[_0x0497('0x1b')]=_0x4ebed3;if(_0x4d3c8f[_0x0497('0x2f')][_0x0497('0x3c')]){_0x578c8a[_0x0497('0x3d')]=[{'all':!![]}];}return db['CmCompany'][_0x0497('0x3e')](_0x578c8a);})[_0x0497('0x23')](function(_0x8ea876){_0x2bfc8e[_0x0497('0x3f')]=_0x8ea876;return _0x2bfc8e;})[_0x0497('0x23')](respondWithFilteredResult(_0x27a834,_0x578c8a))[_0x0497('0x40')](handleError(_0x27a834,null));})['catch'](handleError(_0x27a834,null));};exports['show']=function(_0x47cbe7,_0x25ceb5){var _0x14b71d={'raw':![],'where':{'id':_0x47cbe7[_0x0497('0x41')]['id']}},_0x389c1e={};_0x389c1e[_0x0497('0x2e')]=_['keys'](db['CmCompany'][_0x0497('0x42')]);_0x389c1e[_0x0497('0x2f')]=_[_0x0497('0x43')](_0x47cbe7[_0x0497('0x2f')]);_0x389c1e[_0x0497('0x30')]=_[_0x0497('0x31')](_0x389c1e['model'],_0x389c1e[_0x0497('0x2f')]);_0x14b71d[_0x0497('0x32')]=_[_0x0497('0x31')](_0x389c1e[_0x0497('0x2e')],qs[_0x0497('0x33')](_0x47cbe7[_0x0497('0x2f')][_0x0497('0x33')]));_0x14b71d['attributes']=_0x14b71d['attributes'][_0x0497('0x34')]?_0x14b71d[_0x0497('0x32')]:_0x389c1e[_0x0497('0x2e')];if(_0x47cbe7[_0x0497('0x2f')][_0x0497('0x3c')]){_0x14b71d['include']=[{'all':!![]}];}_0x14b71d=_['merge']({},_0x14b71d,_0x47cbe7['options']);return db['CmCompany'][_0x0497('0x44')](_0x14b71d)[_0x0497('0x23')](handleEntityNotFound(_0x25ceb5,null))[_0x0497('0x23')](respondWithResult(_0x25ceb5,null))[_0x0497('0x40')](handleError(_0x25ceb5,null));};exports[_0x0497('0x45')]=function(_0x2f009d,_0x36906f){return db[_0x0497('0x46')][_0x0497('0x45')](_0x2f009d[_0x0497('0x47')],{})[_0x0497('0x23')](function(_0x58baac){var _0x361f52=_0x2f009d['user'][_0x0497('0x25')]({'plain':!![]});if(!_0x361f52)throw new Error(_0x0497('0x48'));if(_0x361f52['role']===_0x0497('0x49')){var _0x4efbfe=_0x58baac['get']({'plain':!![]});var _0x2b5701=_0x0497('0x26');return db[_0x0497('0x4a')]['find']({'where':{'name':_0x2b5701,'userProfileId':_0x361f52[_0x0497('0x4b')]},'raw':!![]})['then'](function(_0x40c9b0){if(_0x40c9b0&&_0x40c9b0[_0x0497('0x4c')]===0x0){return db['UserProfileResource'][_0x0497('0x45')]({'name':_0x4efbfe[_0x0497('0x2a')],'resourceId':_0x4efbfe['id'],'type':_0x40c9b0[_0x0497('0x2a')],'sectionId':_0x40c9b0['id']},{})[_0x0497('0x23')](function(){return _0x58baac;});}else{return _0x58baac;}})['catch'](function(_0x21d57c){logger[_0x0497('0x28')](_0x0497('0x4d'),_0x21d57c);throw _0x21d57c;});}return _0x58baac;})['then'](respondWithResult(_0x36906f,0xc9))[_0x0497('0x40')](handleError(_0x36906f,null));};exports[_0x0497('0x22')]=function(_0x152c78,_0x438111){if(_0x152c78[_0x0497('0x47')]['id']){delete _0x152c78[_0x0497('0x47')]['id'];}return db['CmCompany'][_0x0497('0x44')]({'where':{'id':_0x152c78[_0x0497('0x41')]['id']}})[_0x0497('0x23')](handleEntityNotFound(_0x438111,null))[_0x0497('0x23')](saveUpdates(_0x152c78[_0x0497('0x47')],null))[_0x0497('0x23')](respondWithResult(_0x438111,null))['catch'](handleError(_0x438111,null));};exports[_0x0497('0x24')]=function(_0x21bc53,_0x44fe01){return db[_0x0497('0x46')][_0x0497('0x44')]({'where':{'id':_0x21bc53[_0x0497('0x41')]['id']}})[_0x0497('0x23')](handleEntityNotFound(_0x44fe01,null))[_0x0497('0x23')](removeEntity(_0x44fe01,null))[_0x0497('0x40')](handleError(_0x44fe01,null));};exports[_0x0497('0x2d')]=function(_0x2f5771,_0x22f38a){return db[_0x0497('0x46')][_0x0497('0x2d')]()['then'](respondWithResult(_0x22f38a,null))[_0x0497('0x40')](handleError(_0x22f38a,null));};exports['addContacts']=function(_0x1edcdf,_0x510c2e,_0x32114f){return db['CmContact'][_0x0497('0x44')]({'where':{'id':_0x1edcdf[_0x0497('0x41')]['id']}})[_0x0497('0x23')](handleEntityNotFound(_0x510c2e,null))[_0x0497('0x23')](function(_0x5be96b){if(_0x5be96b){return _0x5be96b[_0x0497('0x4e')](_0x1edcdf[_0x0497('0x47')][_0x0497('0x4f')],_['omit'](_0x1edcdf[_0x0497('0x47')],[_0x0497('0x4f'),'id'])||{});}})[_0x0497('0x23')](respondWithResult(_0x510c2e,null))[_0x0497('0x40')](handleError(_0x510c2e,null));};exports[_0x0497('0x50')]=function(_0x6f1c97,_0x5e22a7,_0x417cf2){var _0xf30dc8={};var _0x55ce85={};var _0x1203a3;var _0x3a59ad;return db['CmCompany']['findOne']({'where':{'id':_0x6f1c97['params']['id']}})['then'](handleEntityNotFound(_0x5e22a7,null))[_0x0497('0x23')](function(_0x47980e){if(_0x47980e){_0x1203a3=_0x47980e;_0x55ce85[_0x0497('0x2e')]=_[_0x0497('0x43')](db[_0x0497('0x51')]['rawAttributes']);_0x55ce85['query']=_[_0x0497('0x43')](_0x6f1c97[_0x0497('0x2f')]);_0x55ce85[_0x0497('0x30')]=_['intersection'](_0x55ce85[_0x0497('0x2e')],_0x55ce85['query']);_0xf30dc8[_0x0497('0x32')]=_[_0x0497('0x31')](_0x55ce85[_0x0497('0x2e')],qs[_0x0497('0x33')](_0x6f1c97['query'][_0x0497('0x33')]));_0xf30dc8['attributes']=_0xf30dc8[_0x0497('0x32')][_0x0497('0x34')]?_0xf30dc8['attributes']:_0x55ce85[_0x0497('0x2e')];_0xf30dc8[_0x0497('0x38')]=qs[_0x0497('0x52')](_0x6f1c97[_0x0497('0x2f')]['sort']);_0xf30dc8[_0x0497('0x39')]=qs['filters'](_[_0x0497('0x53')](_0x6f1c97[_0x0497('0x2f')],_0x55ce85['filters']));if(_0x6f1c97[_0x0497('0x2f')][_0x0497('0x3a')]){_0xf30dc8[_0x0497('0x39')]=_[_0x0497('0x3b')](_0xf30dc8[_0x0497('0x39')],{'$or':_[_0x0497('0x54')](_0xf30dc8[_0x0497('0x32')],function(_0x39a16f){var _0x1a5670={};_0x1a5670[_0x39a16f]={'$like':'%'+_0x6f1c97[_0x0497('0x2f')][_0x0497('0x3a')]+'%'};return _0x1a5670;})});}_0xf30dc8=_[_0x0497('0x3b')]({},_0xf30dc8,_0x6f1c97[_0x0497('0x55')]);return _0x1203a3[_0x0497('0x50')](_0xf30dc8);}})[_0x0497('0x23')](function(_0x4c4029){if(_0x4c4029){_0x3a59ad=_0x4c4029[_0x0497('0x34')];if(!_0x6f1c97[_0x0497('0x2f')][_0x0497('0x35')]('nolimit')){_0xf30dc8['limit']=qs[_0x0497('0x37')](_0x6f1c97['query'][_0x0497('0x37')]);_0xf30dc8[_0x0497('0x1c')]=qs[_0x0497('0x1c')](_0x6f1c97[_0x0497('0x2f')][_0x0497('0x1c')]);}return _0x1203a3['getContacts'](_0xf30dc8);}})['then'](function(_0x53e7dc){if(_0x53e7dc){return _0x53e7dc?{'count':_0x3a59ad,'rows':_0x53e7dc}:null;}})[_0x0497('0x23')](respondWithResult(_0x5e22a7,null))[_0x0497('0x40')](handleError(_0x5e22a7,null));}; \ No newline at end of file +var _0x30d5=['length','attributes','hasOwnProperty','nolimit','sort','where','merge','map','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','addContacts','CmContact','ids','getContacts','order','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','save','update','then','get','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','fields'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0x30d5,0xc3));var _0x530d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x30d5[_0x4a9fb1];return _0x348672;};'use strict';var pdf=require(_0x530d('0x0'));var emlformat=require(_0x530d('0x1'));var rimraf=require(_0x530d('0x2'));var zipdir=require(_0x530d('0x3'));var jsonpatch=require(_0x530d('0x4'));var rp=require('request-promise');var moment=require(_0x530d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x530d('0x6'));var path=require(_0x530d('0x7'));var sox=require('sox');var csv=require(_0x530d('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x530d('0x9'));var squel=require(_0x530d('0xa'));var crypto=require(_0x530d('0xb'));var jsforce=require(_0x530d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x530d('0x8'));var querystring=require('querystring');var Papa=require(_0x530d('0xd'));var Redis=require(_0x530d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x530d('0xf'));var as=require(_0x530d('0x10'));var hardwareService=require(_0x530d('0x11'));var logger=require(_0x530d('0x12'))(_0x530d('0x13'));var utils=require('../../config/utils');var config=require(_0x530d('0x14'));var db=require(_0x530d('0x15'))['db'];function respondWithStatusCode(_0x4b1ab4,_0x4c01b1){_0x4c01b1=_0x4c01b1||0xcc;return function(_0x1d2859){if(_0x1d2859){return _0x4b1ab4[_0x530d('0x16')](_0x4c01b1);}return _0x4b1ab4[_0x530d('0x17')](_0x4c01b1)[_0x530d('0x18')]();};}function respondWithResult(_0x5b392f,_0x449ecd){_0x449ecd=_0x449ecd||0xc8;return function(_0xc5cacf){if(_0xc5cacf){return _0x5b392f[_0x530d('0x17')](_0x449ecd)[_0x530d('0x19')](_0xc5cacf);}};}function respondWithFilteredResult(_0x412009,_0x2a299d){return function(_0x3f9a5a){if(_0x3f9a5a){var _0x2ef734=_0x3f9a5a[_0x530d('0x1a')],_0x1b68bf=_0x2a299d[_0x530d('0x1b')],_0x48adc8=_0x2a299d[_0x530d('0x1b')]+_0x2a299d[_0x530d('0x1c')],_0x2629f2;if(_0x48adc8>=_0x2ef734){_0x48adc8=_0x2ef734;_0x2629f2=0xc8;}else{_0x2629f2=0xce;}_0x412009['status'](_0x2629f2);return _0x412009[_0x530d('0x1d')]('Content-Range',_0x1b68bf+'-'+_0x48adc8+'/'+_0x2ef734)[_0x530d('0x19')](_0x3f9a5a);}return null;};}function patchUpdates(_0x5ecf6c){return function(_0x55e77a){try{jsonpatch['apply'](_0x55e77a,_0x5ecf6c,!![]);}catch(_0x1f3680){return BPromise['reject'](_0x1f3680);}return _0x55e77a[_0x530d('0x1e')]();};}function saveUpdates(_0x56b365,_0x3a0c39){return function(_0xb4555b){if(_0xb4555b){return _0xb4555b[_0x530d('0x1f')](_0x56b365)[_0x530d('0x20')](function(_0xa39e12){return _0xa39e12;});}return null;};}function removeEntity(_0x1f4704,_0x594baa){return function(_0xaffbd9){if(_0xaffbd9){return _0xaffbd9['destroy']()[_0x530d('0x20')](function(){var _0x42fcf5=_0xaffbd9[_0x530d('0x21')]({'plain':!![]});var _0x485385='Companies';return db[_0x530d('0x22')]['destroy']({'where':{'type':_0x485385,'resourceId':_0x42fcf5['id']}})[_0x530d('0x20')](function(){return _0xaffbd9;});})['then'](function(){_0x1f4704['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x490df5,_0x17efd8){return function(_0x2d0b13){if(!_0x2d0b13){_0x490df5[_0x530d('0x16')](0x194);}return _0x2d0b13;};}function handleError(_0x5499b,_0xbb4ea9){_0xbb4ea9=_0xbb4ea9||0x1f4;return function(_0x5af343){logger[_0x530d('0x23')](_0x5af343[_0x530d('0x24')]);if(_0x5af343['name']){delete _0x5af343[_0x530d('0x25')];}_0x5499b['status'](_0xbb4ea9)[_0x530d('0x26')](_0x5af343);};}exports[_0x530d('0x27')]=function(_0x4de628,_0x5c1df){var _0x6cfa63={},_0x52d014={},_0x556e8e={'count':0x0,'rows':[]};return db[_0x530d('0x28')][_0x530d('0x29')]()[_0x530d('0x20')](function(_0x4ffa1e){_0x52d014[_0x530d('0x2a')]=_[_0x530d('0x2b')](_0x4ffa1e);_0x52d014['query']=_['keys'](_0x4de628[_0x530d('0x2c')]);_0x52d014[_0x530d('0x2d')]=_[_0x530d('0x2e')](_0x52d014['model'],_0x52d014[_0x530d('0x2c')]);_0x6cfa63['attributes']=_[_0x530d('0x2e')](_0x52d014['model'],qs[_0x530d('0x2f')](_0x4de628[_0x530d('0x2c')][_0x530d('0x2f')]));_0x6cfa63['attributes']=_0x6cfa63['attributes'][_0x530d('0x30')]?_0x6cfa63[_0x530d('0x31')]:_0x52d014[_0x530d('0x2a')];if(!_0x4de628[_0x530d('0x2c')][_0x530d('0x32')](_0x530d('0x33'))){_0x6cfa63['limit']=qs['limit'](_0x4de628['query'][_0x530d('0x1c')]);_0x6cfa63[_0x530d('0x1b')]=qs['offset'](_0x4de628[_0x530d('0x2c')]['offset']);}_0x6cfa63['order']=qs['sort'](_0x4de628['query'][_0x530d('0x34')]);_0x6cfa63[_0x530d('0x35')]=qs[_0x530d('0x2d')](_['pick'](_0x4de628[_0x530d('0x2c')],_0x52d014['filters']),_0x4ffa1e);if(_0x4de628[_0x530d('0x2c')]['filter']){_0x6cfa63[_0x530d('0x35')]=_[_0x530d('0x36')](_0x6cfa63[_0x530d('0x35')],{'$or':_[_0x530d('0x37')](_0x6cfa63[_0x530d('0x31')],function(_0x44c725){var _0x1ab78c={};_0x1ab78c[_0x44c725]={'$like':'%'+_0x4de628['query'][_0x530d('0x38')]+'%'};return _0x1ab78c;})});}_0x6cfa63=_[_0x530d('0x36')]({},_0x6cfa63,_0x4de628[_0x530d('0x39')]);var _0x537cb9={'where':_0x6cfa63['where']};return db[_0x530d('0x28')][_0x530d('0x1a')](_0x537cb9)[_0x530d('0x20')](function(_0x1831af){_0x556e8e[_0x530d('0x1a')]=_0x1831af;if(_0x4de628[_0x530d('0x2c')][_0x530d('0x3a')]){_0x6cfa63['include']=[{'all':!![]}];}return db[_0x530d('0x28')][_0x530d('0x3b')](_0x6cfa63);})[_0x530d('0x20')](function(_0x1adb61){_0x556e8e[_0x530d('0x3c')]=_0x1adb61;return _0x556e8e;})[_0x530d('0x20')](respondWithFilteredResult(_0x5c1df,_0x6cfa63))[_0x530d('0x3d')](handleError(_0x5c1df,null));})['catch'](handleError(_0x5c1df,null));};exports[_0x530d('0x3e')]=function(_0x1fc6e8,_0x19f08c){var _0x133f64={'raw':![],'where':{'id':_0x1fc6e8[_0x530d('0x3f')]['id']}},_0x2b4964={};_0x2b4964[_0x530d('0x2a')]=_[_0x530d('0x2b')](db[_0x530d('0x28')][_0x530d('0x40')]);_0x2b4964[_0x530d('0x2c')]=_['keys'](_0x1fc6e8[_0x530d('0x2c')]);_0x2b4964['filters']=_[_0x530d('0x2e')](_0x2b4964[_0x530d('0x2a')],_0x2b4964[_0x530d('0x2c')]);_0x133f64[_0x530d('0x31')]=_[_0x530d('0x2e')](_0x2b4964[_0x530d('0x2a')],qs['fields'](_0x1fc6e8[_0x530d('0x2c')][_0x530d('0x2f')]));_0x133f64[_0x530d('0x31')]=_0x133f64[_0x530d('0x31')]['length']?_0x133f64[_0x530d('0x31')]:_0x2b4964[_0x530d('0x2a')];if(_0x1fc6e8[_0x530d('0x2c')][_0x530d('0x3a')]){_0x133f64[_0x530d('0x41')]=[{'all':!![]}];}_0x133f64=_['merge']({},_0x133f64,_0x1fc6e8['options']);return db['CmCompany'][_0x530d('0x42')](_0x133f64)[_0x530d('0x20')](handleEntityNotFound(_0x19f08c,null))[_0x530d('0x20')](respondWithResult(_0x19f08c,null))['catch'](handleError(_0x19f08c,null));};exports['create']=function(_0x24b45d,_0x2a35ed){return db[_0x530d('0x28')][_0x530d('0x43')](_0x24b45d[_0x530d('0x44')],{})[_0x530d('0x20')](function(_0x19e09b){var _0x518712=_0x24b45d['user'][_0x530d('0x21')]({'plain':!![]});if(!_0x518712)throw new Error(_0x530d('0x45'));if(_0x518712[_0x530d('0x46')]==='user'){var _0x22a6fa=_0x19e09b[_0x530d('0x21')]({'plain':!![]});var _0x4faafc=_0x530d('0x47');return db['UserProfileSection']['find']({'where':{'name':_0x4faafc,'userProfileId':_0x518712[_0x530d('0x48')]},'raw':!![]})[_0x530d('0x20')](function(_0x779b56){if(_0x779b56&&_0x779b56[_0x530d('0x49')]===0x0){return db[_0x530d('0x22')]['create']({'name':_0x22a6fa[_0x530d('0x25')],'resourceId':_0x22a6fa['id'],'type':_0x779b56['name'],'sectionId':_0x779b56['id']},{})[_0x530d('0x20')](function(){return _0x19e09b;});}else{return _0x19e09b;}})[_0x530d('0x3d')](function(_0x4ec0cc){logger['error'](_0x530d('0x4a'),_0x4ec0cc);throw _0x4ec0cc;});}return _0x19e09b;})[_0x530d('0x20')](respondWithResult(_0x2a35ed,0xc9))[_0x530d('0x3d')](handleError(_0x2a35ed,null));};exports[_0x530d('0x1f')]=function(_0x33c1b0,_0x2a21db){if(_0x33c1b0[_0x530d('0x44')]['id']){delete _0x33c1b0['body']['id'];}return db[_0x530d('0x28')][_0x530d('0x42')]({'where':{'id':_0x33c1b0[_0x530d('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2a21db,null))[_0x530d('0x20')](saveUpdates(_0x33c1b0[_0x530d('0x44')],null))[_0x530d('0x20')](respondWithResult(_0x2a21db,null))[_0x530d('0x3d')](handleError(_0x2a21db,null));};exports[_0x530d('0x4b')]=function(_0x4a16c9,_0x495552){return db['CmCompany'][_0x530d('0x42')]({'where':{'id':_0x4a16c9[_0x530d('0x3f')]['id']}})[_0x530d('0x20')](handleEntityNotFound(_0x495552,null))['then'](removeEntity(_0x495552,null))[_0x530d('0x3d')](handleError(_0x495552,null));};exports[_0x530d('0x29')]=function(_0x253a7d,_0x221664){return db[_0x530d('0x28')][_0x530d('0x29')]()[_0x530d('0x20')](respondWithResult(_0x221664,null))['catch'](handleError(_0x221664,null));};exports[_0x530d('0x4c')]=function(_0xede6ad,_0x18b002,_0x43342d){return db[_0x530d('0x4d')]['find']({'where':{'id':_0xede6ad[_0x530d('0x3f')]['id']}})[_0x530d('0x20')](handleEntityNotFound(_0x18b002,null))[_0x530d('0x20')](function(_0x3a07fe){if(_0x3a07fe){return _0x3a07fe[_0x530d('0x4c')](_0xede6ad[_0x530d('0x44')][_0x530d('0x4e')],_['omit'](_0xede6ad[_0x530d('0x44')],['ids','id'])||{});}})[_0x530d('0x20')](respondWithResult(_0x18b002,null))[_0x530d('0x3d')](handleError(_0x18b002,null));};exports[_0x530d('0x4f')]=function(_0x4523c7,_0x288d03,_0x4f4840){var _0x205380={};var _0x25c323={};var _0x44ca9e;var _0x164c12;return db[_0x530d('0x28')]['findOne']({'where':{'id':_0x4523c7[_0x530d('0x3f')]['id']}})['then'](handleEntityNotFound(_0x288d03,null))['then'](function(_0x5d411f){if(_0x5d411f){_0x44ca9e=_0x5d411f;_0x25c323[_0x530d('0x2a')]=_[_0x530d('0x2b')](db[_0x530d('0x4d')][_0x530d('0x40')]);_0x25c323[_0x530d('0x2c')]=_['keys'](_0x4523c7[_0x530d('0x2c')]);_0x25c323[_0x530d('0x2d')]=_[_0x530d('0x2e')](_0x25c323[_0x530d('0x2a')],_0x25c323[_0x530d('0x2c')]);_0x205380[_0x530d('0x31')]=_[_0x530d('0x2e')](_0x25c323[_0x530d('0x2a')],qs[_0x530d('0x2f')](_0x4523c7[_0x530d('0x2c')][_0x530d('0x2f')]));_0x205380['attributes']=_0x205380[_0x530d('0x31')][_0x530d('0x30')]?_0x205380[_0x530d('0x31')]:_0x25c323[_0x530d('0x2a')];_0x205380[_0x530d('0x50')]=qs[_0x530d('0x34')](_0x4523c7['query'][_0x530d('0x34')]);_0x205380[_0x530d('0x35')]=qs['filters'](_['pick'](_0x4523c7['query'],_0x25c323['filters']));if(_0x4523c7[_0x530d('0x2c')][_0x530d('0x38')]){_0x205380[_0x530d('0x35')]=_[_0x530d('0x36')](_0x205380[_0x530d('0x35')],{'$or':_[_0x530d('0x37')](_0x205380['attributes'],function(_0xe84f5a){var _0x52b9f6={};_0x52b9f6[_0xe84f5a]={'$like':'%'+_0x4523c7[_0x530d('0x2c')][_0x530d('0x38')]+'%'};return _0x52b9f6;})});}_0x205380=_[_0x530d('0x36')]({},_0x205380,_0x4523c7[_0x530d('0x39')]);return _0x44ca9e[_0x530d('0x4f')](_0x205380);}})[_0x530d('0x20')](function(_0x2ddc3b){if(_0x2ddc3b){_0x164c12=_0x2ddc3b['length'];if(!_0x4523c7[_0x530d('0x2c')][_0x530d('0x32')](_0x530d('0x33'))){_0x205380[_0x530d('0x1c')]=qs['limit'](_0x4523c7['query']['limit']);_0x205380['offset']=qs['offset'](_0x4523c7[_0x530d('0x2c')][_0x530d('0x1b')]);}return _0x44ca9e[_0x530d('0x4f')](_0x205380);}})['then'](function(_0x9ff194){if(_0x9ff194){return _0x9ff194?{'count':_0x164c12,'rows':_0x9ff194}:null;}})[_0x530d('0x20')](respondWithResult(_0x288d03,null))[_0x530d('0x3d')](handleError(_0x288d03,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 15bd8c3..2a73dfe 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 _0x8188=['api','moment','request-promise','path','../../config/environment','./cmCompany.attributes','exports','../../config/logger'];(function(_0xda6385,_0x405eab){var _0x5d1042=function(_0x315751){while(--_0x315751){_0xda6385['push'](_0xda6385['shift']());}};_0x5d1042(++_0x405eab);}(_0x8188,0x1bf));var _0x8818=function(_0x104306,_0x4c00eb){_0x104306=_0x104306-0x0;var _0xdba9c1=_0x8188[_0x104306];return _0xdba9c1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8818('0x0'))(_0x8818('0x1'));var moment=require(_0x8818('0x2'));var BPromise=require('bluebird');var rp=require(_0x8818('0x3'));var fs=require('fs');var path=require(_0x8818('0x4'));var rimraf=require('rimraf');var config=require(_0x8818('0x5'));var attributes=require(_0x8818('0x6'));module[_0x8818('0x7')]=function(_0x11a708,_0x26c77c){return _0x11a708['define']('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57aa=['rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x57aa,0x1e7));var _0xa57a=function(_0x596284,_0x1cd02b){_0x596284=_0x596284-0x0;var _0x5313c6=_0x57aa[_0x596284];return _0x5313c6;};'use strict';var _=require(_0xa57a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa57a('0x1'));var fs=require('fs');var path=require(_0xa57a('0x2'));var rimraf=require(_0xa57a('0x3'));var config=require(_0xa57a('0x4'));var attributes=require(_0xa57a('0x5'));module[_0xa57a('0x6')]=function(_0x2e78f1,_0x3a4161){return _0x2e78f1[_0xa57a('0x7')](_0xa57a('0x8'),attributes,{'tableName':_0xa57a('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 3debc22..0dd2a4f 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 _0x2258=['CmCompany,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x25c262,_0x32d62f){var _0x36e27b=function(_0x4cf1b1){while(--_0x4cf1b1){_0x25c262['push'](_0x25c262['shift']());}};_0x36e27b(++_0x32d62f);}(_0x2258,0x15c));var _0x8225=function(_0x1dcd65,_0x121c96){_0x1dcd65=_0x1dcd65-0x0;var _0x2000ca=_0x2258[_0x1dcd65];return _0x2000ca;};'use strict';var _=require(_0x8225('0x0'));var util=require('util');var moment=require(_0x8225('0x1'));var BPromise=require(_0x8225('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8225('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8225('0x4'));var logger=require(_0x8225('0x5'))(_0x8225('0x6'));var config=require(_0x8225('0x7'));var jayson=require(_0x8225('0x8'));var client=jayson['client'][_0x8225('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4aa307,_0x4777fc,_0x4e5e29){return new BPromise(function(_0x2d84b5,_0x100de4){return client[_0x8225('0xa')](_0x4aa307,_0x4e5e29)[_0x8225('0xb')](function(_0x48cb9d){logger['info'](_0x8225('0xc'),_0x4777fc,_0x8225('0xd'));logger['debug']('CmCompany,\x20%s,\x20%s,\x20%s',_0x4777fc,_0x8225('0xd'),JSON[_0x8225('0xe')](_0x48cb9d));if(_0x48cb9d[_0x8225('0xf')]){if(_0x48cb9d['error'][_0x8225('0x10')]===0x1f4){logger['error'](_0x8225('0xc'),_0x4777fc,_0x48cb9d[_0x8225('0xf')][_0x8225('0x11')]);return _0x100de4(_0x48cb9d['error'][_0x8225('0x11')]);}logger[_0x8225('0xf')]('CmCompany,\x20%s,\x20%s',_0x4777fc,_0x48cb9d['error'][_0x8225('0x11')]);return _0x2d84b5(_0x48cb9d[_0x8225('0xf')][_0x8225('0x11')]);}else{logger['info'](_0x8225('0xc'),_0x4777fc,'request\x20sent');_0x2d84b5(_0x48cb9d['result'][_0x8225('0x11')]);}})['catch'](function(_0x232693){logger['error'](_0x8225('0xc'),_0x4777fc,_0x232693);_0x100de4(_0x232693);});});} \ No newline at end of file +var _0x70d5=['then','info','request\x20sent','debug','stringify','error','code','CmCompany,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x78ad27,_0x48bcf4){var _0xb59b37=function(_0x1bee32){while(--_0x1bee32){_0x78ad27['push'](_0x78ad27['shift']());}};_0xb59b37(++_0x48bcf4);}(_0x70d5,0x1d6));var _0x570d=function(_0x9a4402,_0x170c4e){_0x9a4402=_0x9a4402-0x0;var _0x1b244d=_0x70d5[_0x9a4402];return _0x1b244d;};'use strict';var _=require(_0x570d('0x0'));var util=require('util');var moment=require(_0x570d('0x1'));var BPromise=require(_0x570d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x570d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x570d('0x4'));var logger=require(_0x570d('0x5'))(_0x570d('0x6'));var config=require(_0x570d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x570d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44721d,_0x1ab691,_0x39fee1){return new BPromise(function(_0x413c37,_0x134c91){return client[_0x570d('0x9')](_0x44721d,_0x39fee1)[_0x570d('0xa')](function(_0x16b1fa){logger[_0x570d('0xb')]('CmCompany,\x20%s,\x20%s',_0x1ab691,_0x570d('0xc'));logger[_0x570d('0xd')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x1ab691,_0x570d('0xc'),JSON[_0x570d('0xe')](_0x16b1fa));if(_0x16b1fa[_0x570d('0xf')]){if(_0x16b1fa[_0x570d('0xf')][_0x570d('0x10')]===0x1f4){logger[_0x570d('0xf')](_0x570d('0x11'),_0x1ab691,_0x16b1fa[_0x570d('0xf')]['message']);return _0x134c91(_0x16b1fa[_0x570d('0xf')][_0x570d('0x12')]);}logger[_0x570d('0xf')](_0x570d('0x11'),_0x1ab691,_0x16b1fa['error'][_0x570d('0x12')]);return _0x413c37(_0x16b1fa[_0x570d('0xf')]['message']);}else{logger[_0x570d('0xb')]('CmCompany,\x20%s,\x20%s',_0x1ab691,_0x570d('0xc'));_0x413c37(_0x16b1fa['result'][_0x570d('0x12')]);}})[_0x570d('0x13')](function(_0x3d7ced){logger[_0x570d('0xf')](_0x570d('0x11'),_0x1ab691,_0x3d7ced);_0x134c91(_0x3d7ced);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 7031cc3..f1a73ff 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 _0x9957=['../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/contacts','getContacts','post','addContacts','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./cmCompany.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['describe']);router[_0x7995('0x8')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x8')](_0x7995('0xe'),auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0x10')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0x10')](_0x7995('0xe'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth[_0x7995('0x9')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x15')]=router; \ No newline at end of file +var _0x9957=['../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/contacts','getContacts','post','addContacts','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./cmCompany.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['describe']);router[_0x7995('0x8')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x8')](_0x7995('0xe'),auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0x10')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0x10')](_0x7995('0xe'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth[_0x7995('0x9')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 8099cee..b1324f3 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 _0xc17d=['DATE','NOW','lodash','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x1a619b,_0x350a35){var _0x1876b9=function(_0x2541ab){while(--_0x2541ab){_0x1a619b['push'](_0x1a619b['shift']());}};_0x1876b9(++_0x350a35);}(_0xc17d,0x102));var _0xdc17=function(_0x3474c0,_0x512bce){_0x3474c0=_0x3474c0-0x0;var _0x2eda5f=_0xc17d[_0x3474c0];return _0x2eda5f;};'use strict';var _=require(_0xdc17('0x0'));var Sequelize=require('sequelize');module[_0xdc17('0x1')]={'firstName':{'type':Sequelize[_0xdc17('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xdc17('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xdc17('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xdc17('0x2')]},'dateOfBirth':{'type':Sequelize[_0xdc17('0x2')]},'description':{'type':Sequelize[_0xdc17('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xdc17('0x2')]},'fax':{'type':Sequelize[_0xdc17('0x2')]},'email':{'type':Sequelize[_0xdc17('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xdc17('0x2')]},'viber':{'type':Sequelize[_0xdc17('0x2')]},'line':{'type':Sequelize[_0xdc17('0x2')]},'wechat':{'type':Sequelize[_0xdc17('0x2')]},'telegram':{'type':Sequelize[_0xdc17('0x2')]},'UserId':{'type':Sequelize[_0xdc17('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xdc17('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xdc17('0x6')],'defaultValue':Sequelize[_0xdc17('0x7')]},'dialTimezone':{'type':Sequelize[_0xdc17('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x37ab=['INTEGER','DATE','NOW','lodash','exports','STRING'];(function(_0x73bd30,_0x5c1a13){var _0x389262=function(_0xa87c5){while(--_0xa87c5){_0x73bd30['push'](_0x73bd30['shift']());}};_0x389262(++_0x5c1a13);}(_0x37ab,0xc3));var _0xb37a=function(_0x52850c,_0x249dc8){_0x52850c=_0x52850c-0x0;var _0x113595=_0x37ab[_0x52850c];return _0x113595;};'use strict';var _=require(_0xb37a('0x0'));var Sequelize=require('sequelize');module[_0xb37a('0x1')]={'firstName':{'type':Sequelize[_0xb37a('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xb37a('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xb37a('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xb37a('0x2')]},'dateOfBirth':{'type':Sequelize[_0xb37a('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xb37a('0x2')]},'mobile':{'type':Sequelize[_0xb37a('0x2')]},'fax':{'type':Sequelize[_0xb37a('0x2')]},'email':{'type':Sequelize[_0xb37a('0x2')]},'url':{'type':Sequelize[_0xb37a('0x2')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xb37a('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xb37a('0x2')]},'teams':{'type':Sequelize[_0xb37a('0x2')]},'viber':{'type':Sequelize[_0xb37a('0x2')]},'line':{'type':Sequelize[_0xb37a('0x2')]},'wechat':{'type':Sequelize[_0xb37a('0x2')]},'telegram':{'type':Sequelize[_0xb37a('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0xb37a('0x3')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xb37a('0x4')],'defaultValue':Sequelize[_0xb37a('0x5')]},'dialTimezone':{'type':Sequelize[_0xb37a('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index ad5d1fe..d492605 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 _0x9778=['offset','order','sort','where','pick','select','field','color','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','sqlOperator','conditions','find','Tag','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','value','datetime','castTo','type','text','filter','isNil','Contact','ListId','concat','\x20=\x20?','tag','isArray','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','clone','DESC','isEmpty','having','t.id\x20IN\x20?','resolve','some','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','sequelize','count','toString','keyBy','merge','c.firstName','c.lastName','c.phone','c.mobile','c.deletedAt','TagIds','rows','catch','describe','tags','columnName','displayName','alias','custom','values','body','findAll','get','mergeWith','CmHopper','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','ChatInteraction','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxMessage','OpenchannelInteraction','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','create','join','bulkCreate','duplicates','findOrCreate','spread','error','show','Tags','$and','omit','format','params','cf_%d','table','setFields','toParam','phone','getTags','rawAttributes','setTags','ids','getHoppers','ContactId','options','getHopperHistories','includeAll','include','getHopperFinals','CmHopperFinal','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','filename','chmodSync','0777','child_process','CompanyId','json','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','import','agent','binding','fork','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','sendStatus','status','limit','set','Content-Range','apply','reject','update','then','destroy','end','name','send','CmContact','length','startsWith','cf_','push','CmCustomField','findOne','trimStart','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit'];(function(_0x453d75,_0x2bad3c){var _0x181e99=function(_0x5c98e4){while(--_0x5c98e4){_0x453d75['push'](_0x453d75['shift']());}};_0x181e99(++_0x2bad3c);}(_0x9778,0xb2));var _0x8977=function(_0xd13a88,_0x3c5269){_0xd13a88=_0xd13a88-0x0;var _0x1c993c=_0x9778[_0xd13a88];return _0x1c993c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8977('0x0'));var rimraf=require(_0x8977('0x1'));var zipdir=require(_0x8977('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8977('0x3'));var moment=require(_0x8977('0x4'));var BPromise=require(_0x8977('0x5'));var Mustache=require(_0x8977('0x6'));var util=require('util');var path=require(_0x8977('0x7'));var sox=require(_0x8977('0x8'));var csv=require(_0x8977('0x9'));var ejs=require(_0x8977('0xa'));var fs=require('fs');var _=require(_0x8977('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8977('0xc'));var deskjs=require(_0x8977('0xd'));var toCsv=require(_0x8977('0x9'));var querystring=require('querystring');var Papa=require(_0x8977('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8977('0xf'));var hardwareService=require(_0x8977('0x10'));var logger=require(_0x8977('0x11'))(_0x8977('0x12'));var utils=require(_0x8977('0x13'));var config=require('../../config/environment');var db=require(_0x8977('0x14'))['db'];config[_0x8977('0x15')]=_[_0x8977('0x16')](config['redis'],{'host':_0x8977('0x17'),'port':0x18eb});var socket=require(_0x8977('0x18'))(new Redis(config[_0x8977('0x15')]));require(_0x8977('0x19'))[_0x8977('0x1a')](socket);function respondWithStatusCode(_0x579b65,_0x44fb90){_0x44fb90=_0x44fb90||0xcc;return function(_0x3c3ae7){if(_0x3c3ae7){return _0x579b65[_0x8977('0x1b')](_0x44fb90);}return _0x579b65[_0x8977('0x1c')](_0x44fb90)['end']();};}function respondWithResult(_0x57f05a,_0x107579){_0x107579=_0x107579||0xc8;return function(_0x305834){if(_0x305834){return _0x57f05a['status'](_0x107579)['json'](_0x305834);}};}function respondWithFilteredResult(_0xd2a091,_0x50419a){return function(_0x1ee2f3){if(_0x1ee2f3){var _0x2dfa0f=_0x1ee2f3['count'],_0x2af293=_0x50419a['offset'],_0x263ea1=_0x50419a['offset']+_0x50419a[_0x8977('0x1d')],_0x31d9f8;if(_0x263ea1>=_0x2dfa0f){_0x263ea1=_0x2dfa0f;_0x31d9f8=0xc8;}else{_0x31d9f8=0xce;}_0xd2a091['status'](_0x31d9f8);return _0xd2a091[_0x8977('0x1e')](_0x8977('0x1f'),_0x2af293+'-'+_0x263ea1+'/'+_0x2dfa0f)['json'](_0x1ee2f3);}return null;};}function patchUpdates(_0xeb7fec){return function(_0x452c3a){try{jsonpatch[_0x8977('0x20')](_0x452c3a,_0xeb7fec,!![]);}catch(_0x18a875){return BPromise[_0x8977('0x21')](_0x18a875);}return _0x452c3a['save']();};}function saveUpdates(_0x2cbb10,_0xd7b351){return function(_0x5f0806){if(_0x5f0806){return _0x5f0806[_0x8977('0x22')](_0x2cbb10)[_0x8977('0x23')](function(_0x22eb30){return _0x22eb30;});}return null;};}function removeEntity(_0x5172c7,_0x42f8e9){return function(_0x1c3ac6){if(_0x1c3ac6){return _0x1c3ac6[_0x8977('0x24')]()['then'](function(){_0x5172c7[_0x8977('0x1c')](0xcc)[_0x8977('0x25')]();});}};}function handleEntityNotFound(_0x2998f4,_0x163e46){return function(_0x5b4e3c){if(!_0x5b4e3c){_0x2998f4[_0x8977('0x1b')](0x194);}return _0x5b4e3c;};}function handleError(_0x2b1c6f,_0x59c42c){_0x59c42c=_0x59c42c||0x1f4;return function(_0x2d4599){logger['error'](_0x2d4599['stack']);if(_0x2d4599[_0x8977('0x26')]){delete _0x2d4599[_0x8977('0x26')];}_0x2b1c6f[_0x8977('0x1c')](_0x59c42c)[_0x8977('0x27')](_0x2d4599);};}exports['index']=function(_0x3d3f4c,_0xf5ae90){var _0x93d70={},_0x5d64ff={},_0x4bdb2d={'count':0x0,'rows':[]};return db[_0x8977('0x28')]['describe']()['then'](function(_0x5e9577){var _0xc94dcd=[];for(var _0x5a21ea=0x0;_0x5a21ea0x1){_0x507b3b['or'](_0x8977('0x65'),qs[_0x8977('0x66')](_0x4e76c5),null);}else{if(qs[_0x8977('0x67')](_0x4e76c5)){_0x507b3b['or'](_0x8977('0x68'),_0x4e76c5+'%');_0x507b3b['or'](_0x8977('0x69'),_0x4e76c5+'%');_0x507b3b['or'](_0x8977('0x6a'),_0x4e76c5+'%');_0x507b3b['or'](_0x8977('0x6b'),_0x4e76c5+'%');}else if(qs[_0x8977('0x6c')](_0x4e76c5)){_0x507b3b['or'](_0x8977('0x6d'),_0x4e76c5+'%');}else{_0x507b3b['or'](_0x8977('0x6e'),'%'+_0x4e76c5+'%');_0x507b3b['or'](_0x8977('0x6f'),'%'+_0x4e76c5+'%');_0x507b3b['or'](_0x8977('0x6d'),'%'+_0x4e76c5+'%');}}}}_0x14b845[_0x8977('0x3c')](_0x507b3b);_0x14b845[_0x8977('0x70')](_0x8977('0x71'));var _0x57acee={'type':db[_0x8977('0x72')][_0x8977('0x73')][_0x8977('0x74')],'raw':!![]};var _0x59c91c=_0x14b845[_0x8977('0x75')]()[_0x8977('0x3f')](_0x8977('0x71'));if(_0x93d70[_0x8977('0x3a')]){_0x93d70[_0x8977('0x3a')][_0x8977('0x52')](function(_0x2e32c3){_0x14b845['order']('c.'+_0x2e32c3[0x0],_0x2e32c3[0x1]===_0x8977('0x76')?![]:!![]);});}if(!_[_0x8977('0x77')](_0x176315)){_0x14b845[_0x8977('0x78')](_0x1c599b);_0x59c91c[_0x8977('0x3c')](_0x8977('0x79'),_0x176315);}BPromise[_0x8977('0x7a')]()[_0x8977('0x23')](function(){if(_0x2ebb86&&!_[_0x8977('0x7b')](_0x2ebb86[_0x8977('0x4d')],[_0x8977('0x3f'),_0x8977('0x55')])){return _0x3d3f4c['user'][_0x8977('0x7c')]({'attributes':['id'],'raw':!![]})['then'](function(_0x357d0f){if(_[_0x8977('0x77')](_0x357d0f)){_0x59c91c[_0x8977('0x3c')](_0x8977('0x7d'));_0x14b845[_0x8977('0x3c')](_0x8977('0x7d'));}else{_0x59c91c[_0x8977('0x3c')](_0x8977('0x7e'),_['map'](_0x357d0f,'id'));_0x14b845[_0x8977('0x3c')](_0x8977('0x7e'),_[_0x8977('0x51')](_0x357d0f,'id'));}});}else{return;}})[_0x8977('0x23')](function(){db[_0x8977('0x7f')][_0x8977('0x32')](_0x59c91c['toString'](),_0x57acee)[_0x8977('0x23')](function(_0xa395bc){_0x4bdb2d[_0x8977('0x80')]=_0xa395bc[_0x8977('0x29')];if(_0x4bdb2d[_0x8977('0x80')]===0x0)return[];return db[_0x8977('0x7f')][_0x8977('0x32')](_0x1edffc[_0x8977('0x81')](),_0x57acee);})['then'](function(_0xbfdaa3){_0x38fe33=_[_0x8977('0x82')](_0xbfdaa3,'id');_0x57acee=_[_0x8977('0x83')](_0x57acee,{'model':db[_0x8977('0x28')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d3f4c[_0x8977('0x32')][_0x8977('0x35')]){_0x93d70[_0x8977('0x36')]['forEach'](function(_0x3bcab6){_0x14b845[_0x8977('0x3f')]('c.'+_0x3bcab6);});}else{_0x14b845[_0x8977('0x3f')]('c.id');_0x14b845['field'](_0x8977('0x84'));_0x14b845[_0x8977('0x3f')](_0x8977('0x85'));_0x14b845[_0x8977('0x3f')](_0x8977('0x86'));_0x14b845[_0x8977('0x3f')](_0x8977('0x87'));_0x14b845[_0x8977('0x3f')]('c.fax');_0x14b845[_0x8977('0x3f')]('c.email');_0x14b845[_0x8977('0x3f')]('c.ListId');_0x14b845[_0x8977('0x3f')](_0x8977('0x88'));_0x14b845[_0x8977('0x3f')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x93d70[_0x8977('0x1d')])_0x14b845[_0x8977('0x1d')](_0x93d70['limit']);if(_0x93d70[_0x8977('0x39')])_0x14b845[_0x8977('0x39')](_0x93d70[_0x8977('0x39')]);return db[_0x8977('0x7f')][_0x8977('0x32')](_0x14b845[_0x8977('0x81')](),_0x57acee);})['then'](function(_0x133368){_0x133368[_0x8977('0x52')](function(_0x3edf01){if(_0x3edf01['TagIds']){_0x3edf01['Tags']=[];_0x3edf01[_0x8977('0x89')]['split'](',')[_0x8977('0x52')](function(_0xbfa31d){_0x3edf01['Tags'][_0x8977('0x2c')](_0x38fe33[_0xbfa31d]);});}delete _0x3edf01['TagIds'];});_0x4bdb2d[_0x8977('0x8a')]=_0x133368;return _0x4bdb2d;})[_0x8977('0x23')](respondWithFilteredResult(_0xf5ae90,_0x93d70));});})[_0x8977('0x8b')](handleError(_0xf5ae90,null));};exports[_0x8977('0x24')]=function(_0x296cbd,_0x49682b){return db[_0x8977('0x28')][_0x8977('0x4e')]({'where':{'id':_0x296cbd['params']['id']}})[_0x8977('0x23')](handleEntityNotFound(_0x49682b,null))[_0x8977('0x23')](removeEntity(_0x49682b,null))[_0x8977('0x8b')](handleError(_0x49682b,null));};exports[_0x8977('0x8c')]=function(_0x3bc63d,_0x7c6d9d){return db[_0x8977('0x28')]['describe']()[_0x8977('0x23')](function(_0x2df8d5){delete _0x2df8d5[_0x8977('0x8d')];for(var _0x33b074=0x0;_0x33b074=_0x2f1c52){_0x277cb0=_0x2f1c52;_0x183abb=0xc8;}else{_0x183abb=0xce;}_0x180950[_0x3e24('0x1e')](_0x183abb);return _0x180950[_0x3e24('0x21')](_0x3e24('0x22'),_0x28d6d5+'-'+_0x277cb0+'/'+_0x2f1c52)[_0x3e24('0x23')](_0x235ba1);}return null;};}function patchUpdates(_0x42eacc){return function(_0x53c395){try{jsonpatch['apply'](_0x53c395,_0x42eacc,!![]);}catch(_0x5e6dfb){return BPromise[_0x3e24('0x24')](_0x5e6dfb);}return _0x53c395[_0x3e24('0x25')]();};}function saveUpdates(_0x1bd590,_0x538d87){return function(_0x4ed6f7){if(_0x4ed6f7){return _0x4ed6f7[_0x3e24('0x26')](_0x1bd590)[_0x3e24('0x27')](function(_0x2792aa){return _0x2792aa;});}return null;};}function removeEntity(_0x141cc7,_0x418306){return function(_0x1467b9){if(_0x1467b9){return _0x1467b9[_0x3e24('0x28')]()['then'](function(){_0x141cc7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17f927,_0xdf980e){return function(_0x48e7d1){if(!_0x48e7d1){_0x17f927['sendStatus'](0x194);}return _0x48e7d1;};}function handleError(_0xd07476,_0x372484){_0x372484=_0x372484||0x1f4;return function(_0x26e5bc){logger['error'](_0x26e5bc['stack']);if(_0x26e5bc['name']){delete _0x26e5bc['name'];}_0xd07476[_0x3e24('0x1e')](_0x372484)['send'](_0x26e5bc);};}exports[_0x3e24('0x29')]=function(_0x2d13ff,_0x422547){var _0x177c90={},_0x578785={},_0x135c6f={'count':0x0,'rows':[]};return db[_0x3e24('0x2a')]['describe']()[_0x3e24('0x27')](function(_0x1e1d8f){var _0x119d10=[];for(var _0x51a63e=0x0;_0x51a63e0x1){_0x7746da['or'](_0x3e24('0x65'),qs[_0x3e24('0x66')](_0x214662),null);}else{if(qs[_0x3e24('0x67')](_0x214662)){_0x7746da['or'](_0x3e24('0x68'),_0x214662+'%');_0x7746da['or'](_0x3e24('0x69'),_0x214662+'%');_0x7746da['or'](_0x3e24('0x6a'),_0x214662+'%');_0x7746da['or'](_0x3e24('0x6b'),_0x214662+'%');}else if(qs[_0x3e24('0x6c')](_0x214662)){_0x7746da['or']('c.email\x20LIKE\x20?',_0x214662+'%');}else{_0x7746da['or'](_0x3e24('0x6d'),'%'+_0x214662+'%');_0x7746da['or'](_0x3e24('0x6e'),'%'+_0x214662+'%');_0x7746da['or']('c.email\x20LIKE\x20?','%'+_0x214662+'%');}}}}_0x4f0928['where'](_0x7746da);_0x4f0928[_0x3e24('0x6f')](_0x3e24('0x70'));var _0x5f0a3c={'type':db[_0x3e24('0x71')][_0x3e24('0x72')][_0x3e24('0x73')],'raw':!![]};var _0x5e6a70=_0x4f0928[_0x3e24('0x74')]()[_0x3e24('0x40')]('c.id');if(_0x177c90[_0x3e24('0x75')]){_0x177c90[_0x3e24('0x75')]['forEach'](function(_0x4e1c4a){_0x4f0928[_0x3e24('0x75')]('c.'+_0x4e1c4a[0x0],_0x4e1c4a[0x1]==='DESC'?![]:!![]);});}if(!_[_0x3e24('0x5c')](_0x439b58)){_0x4f0928[_0x3e24('0x76')](_0x58ba5f);_0x5e6a70[_0x3e24('0x3d')](_0x3e24('0x77'),_0x439b58);}BPromise[_0x3e24('0x78')]()[_0x3e24('0x27')](function(){if(_0xd861c&&!_[_0x3e24('0x79')](_0xd861c[_0x3e24('0x7a')],[_0x3e24('0x40'),_0x3e24('0x7b')])){return _0x2d13ff[_0x3e24('0x7c')][_0x3e24('0x7d')]({'attributes':['id'],'raw':!![]})[_0x3e24('0x27')](function(_0x1d3d58){if(_[_0x3e24('0x5c')](_0x1d3d58)){_0x5e6a70[_0x3e24('0x3d')](_0x3e24('0x7e'));_0x4f0928[_0x3e24('0x3d')](_0x3e24('0x7e'));}else{_0x5e6a70[_0x3e24('0x3d')]('c.ListId\x20IN\x20?',_['map'](_0x1d3d58,'id'));_0x4f0928[_0x3e24('0x3d')](_0x3e24('0x5e'),_[_0x3e24('0x7f')](_0x1d3d58,'id'));}});}else{return;}})[_0x3e24('0x27')](function(){db[_0x3e24('0x80')]['query'](_0x5e6a70['toString'](),_0x5f0a3c)[_0x3e24('0x27')](function(_0x53e820){_0x135c6f[_0x3e24('0x1f')]=_0x53e820[_0x3e24('0x30')];if(_0x135c6f[_0x3e24('0x1f')]===0x0)return[];return db['sequelize'][_0x3e24('0x34')](_0x2f06a5[_0x3e24('0x81')](),_0x5f0a3c);})['then'](function(_0x4b1ddb){_0x4c0f1f=_['keyBy'](_0x4b1ddb,'id');_0x5f0a3c=_[_0x3e24('0x82')](_0x5f0a3c,{'model':db[_0x3e24('0x2a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2d13ff[_0x3e24('0x34')][_0x3e24('0x38')]){_0x177c90['attributes'][_0x3e24('0x50')](function(_0xc3fdb3){_0x4f0928[_0x3e24('0x40')]('c.'+_0xc3fdb3);});}else{_0x4f0928[_0x3e24('0x40')](_0x3e24('0x70'));_0x4f0928[_0x3e24('0x40')](_0x3e24('0x83'));_0x4f0928['field'](_0x3e24('0x84'));_0x4f0928['field'](_0x3e24('0x85'));_0x4f0928[_0x3e24('0x40')](_0x3e24('0x86'));_0x4f0928[_0x3e24('0x40')](_0x3e24('0x87'));_0x4f0928['field'](_0x3e24('0x88'));_0x4f0928[_0x3e24('0x40')](_0x3e24('0x89'));_0x4f0928[_0x3e24('0x40')](_0x3e24('0x8a'));_0x4f0928[_0x3e24('0x40')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x3e24('0x8b'));}if(_0x177c90[_0x3e24('0x3b')])_0x4f0928[_0x3e24('0x3b')](_0x177c90[_0x3e24('0x3b')]);if(_0x177c90[_0x3e24('0x20')])_0x4f0928[_0x3e24('0x20')](_0x177c90[_0x3e24('0x20')]);return db[_0x3e24('0x80')][_0x3e24('0x34')](_0x4f0928[_0x3e24('0x81')](),_0x5f0a3c);})['then'](function(_0x17bd03){_0x17bd03[_0x3e24('0x50')](function(_0x2ef4c7){if(_0x2ef4c7[_0x3e24('0x8b')]){_0x2ef4c7[_0x3e24('0x8c')]=[];_0x2ef4c7['TagIds']['split'](',')[_0x3e24('0x50')](function(_0x49f668){_0x2ef4c7[_0x3e24('0x8c')][_0x3e24('0x2e')](_0x4c0f1f[_0x49f668]);});}delete _0x2ef4c7['TagIds'];});_0x135c6f[_0x3e24('0x8d')]=_0x17bd03;return _0x135c6f;})[_0x3e24('0x27')](respondWithFilteredResult(_0x422547,_0x177c90));});})[_0x3e24('0x8e')](handleError(_0x422547,null));};exports[_0x3e24('0x28')]=function(_0x129161,_0x261bf1){return db['CmContact']['find']({'where':{'id':_0x129161[_0x3e24('0x8f')]['id']}})[_0x3e24('0x27')](handleEntityNotFound(_0x261bf1,null))[_0x3e24('0x27')](removeEntity(_0x261bf1,null))[_0x3e24('0x8e')](handleError(_0x261bf1,null));};exports[_0x3e24('0x90')]=function(_0x55354c,_0x143658){return db[_0x3e24('0x2a')]['describe']()['then'](function(_0x17e803){delete _0x17e803['tags'];for(var _0x9f8500=0x0;_0x9f8500{}\s\\|]/g,'-');_0x3229d1(null,util[_0x35fc('0x1f')](_0x35fc('0x20'),path[_0x35fc('0x21')](_0x350a27[_0x35fc('0x1d')],path['extname'](_0x350a27[_0x35fc('0x1d')])),Date[_0x35fc('0x22')](),path[_0x35fc('0x23')](_0x350a27[_0x35fc('0x1d')])));}})});router[_0x35fc('0x16')]('/csv',upload[_0x35fc('0x24')](_0x35fc('0x25')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x35fc('0x1a')]({'destination':function(_0x5a93df,_0x3d4a98,_0x51cfec){_0x51cfec(null,path[_0x35fc('0x1b')](config['root'],_0x35fc('0x26')));},'filename':function(_0xdfab9f,_0x5cb986,_0x519264){_0x5cb986[_0x35fc('0x1d')]=_0x5cb986['originalname'][_0x35fc('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x519264(null,util[_0x35fc('0x1f')]('%s-%s%s',path[_0x35fc('0x21')](_0x5cb986[_0x35fc('0x1d')],path[_0x35fc('0x23')](_0x5cb986[_0x35fc('0x1d')])),Date[_0x35fc('0x22')](),path[_0x35fc('0x23')](_0x5cb986[_0x35fc('0x1d')])));}})});router[_0x35fc('0x16')]('/upload',upload[_0x35fc('0x24')](_0x35fc('0x25')),controller[_0x35fc('0x27')]);router['post'](_0x35fc('0x28'),auth[_0x35fc('0x9')](),controller[_0x35fc('0x29')]);router[_0x35fc('0x2a')](_0x35fc('0xc'),auth[_0x35fc('0x9')](),controller[_0x35fc('0x2b')]);router[_0x35fc('0x2c')](_0x35fc('0xc'),auth[_0x35fc('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xac31=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmContact.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/tags','getTags','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','post','/merge','merge','/create_many','setTags','diskStorage','join','root','server/files/tmp','originalname','replace','format','%s-%s%s','basename','extname','/csv','single','uploadCsv','now','/upload','upload','/upload/:id','put','update','delete','destroy','exports','multer','util'];(function(_0x1394c1,_0x5d5c21){var _0x9560b7=function(_0xc64d27){while(--_0xc64d27){_0x1394c1['push'](_0x1394c1['shift']());}};_0x9560b7(++_0x5d5c21);}(_0xac31,0xca));var _0x1ac3=function(_0x47de9c,_0x2c2a68){_0x47de9c=_0x47de9c-0x0;var _0x9d9906=_0xac31[_0x47de9c];return _0x9d9906;};'use strict';var multer=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var path=require(_0x1ac3('0x2'));var timeout=require(_0x1ac3('0x3'));var express=require(_0x1ac3('0x4'));var router=express[_0x1ac3('0x5')]();var auth=require(_0x1ac3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1ac3('0x7'));var controller=require(_0x1ac3('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1ac3('0x9')]);router[_0x1ac3('0xa')](_0x1ac3('0xb'),auth[_0x1ac3('0xc')](),controller[_0x1ac3('0xd')]);router['get'](_0x1ac3('0xe'),auth['isAuthenticated'](),controller[_0x1ac3('0xf')]);router[_0x1ac3('0xa')](_0x1ac3('0x10'),auth['isAuthenticated'](),controller[_0x1ac3('0x11')]);router[_0x1ac3('0xa')](_0x1ac3('0x12'),auth[_0x1ac3('0xc')](),controller[_0x1ac3('0x13')]);router[_0x1ac3('0xa')]('/:id/hopper_histories',auth[_0x1ac3('0xc')](),controller[_0x1ac3('0x14')]);router[_0x1ac3('0xa')](_0x1ac3('0x15'),auth['isAuthenticated'](),controller[_0x1ac3('0x16')]);router[_0x1ac3('0xa')](_0x1ac3('0x17'),auth[_0x1ac3('0xc')](),controller['getJscriptySessions']);router[_0x1ac3('0x18')](_0x1ac3('0x19'),auth['isAuthenticated'](),controller[_0x1ac3('0x1a')]);router[_0x1ac3('0x18')]('/',auth[_0x1ac3('0xc')](),controller['create']);router[_0x1ac3('0x18')](_0x1ac3('0x1b'),auth[_0x1ac3('0xc')](),controller['bulkCreate']);router[_0x1ac3('0x18')]('/:id/tags',auth[_0x1ac3('0xc')](),controller[_0x1ac3('0x1c')]);var upload=multer({'storage':multer[_0x1ac3('0x1d')]({'destination':function(_0x3b7e51,_0x18b985,_0x557076){_0x557076(null,path[_0x1ac3('0x1e')](config[_0x1ac3('0x1f')],_0x1ac3('0x20')));},'filename':function(_0x257f60,_0x5f1918,_0x48d18a){_0x5f1918[_0x1ac3('0x21')]=_0x5f1918[_0x1ac3('0x21')][_0x1ac3('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x48d18a(null,util[_0x1ac3('0x23')](_0x1ac3('0x24'),path[_0x1ac3('0x25')](_0x5f1918[_0x1ac3('0x21')],path[_0x1ac3('0x26')](_0x5f1918[_0x1ac3('0x21')])),Date['now'](),path[_0x1ac3('0x26')](_0x5f1918[_0x1ac3('0x21')])));}})});router['post'](_0x1ac3('0x27'),upload[_0x1ac3('0x28')]('file'),controller[_0x1ac3('0x29')]);var upload=multer({'storage':multer[_0x1ac3('0x1d')]({'destination':function(_0x145486,_0x2dfdb7,_0x10db3d){_0x10db3d(null,path['join'](config['root'],'server/files/tmp'));},'filename':function(_0x528807,_0x52a1a5,_0x3ea482){_0x52a1a5['originalname']=_0x52a1a5[_0x1ac3('0x21')][_0x1ac3('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3ea482(null,util[_0x1ac3('0x23')](_0x1ac3('0x24'),path['basename'](_0x52a1a5[_0x1ac3('0x21')],path['extname'](_0x52a1a5[_0x1ac3('0x21')])),Date[_0x1ac3('0x2a')](),path[_0x1ac3('0x26')](_0x52a1a5[_0x1ac3('0x21')])));}})});router[_0x1ac3('0x18')](_0x1ac3('0x2b'),upload[_0x1ac3('0x28')]('file'),controller[_0x1ac3('0x2c')]);router[_0x1ac3('0x18')](_0x1ac3('0x2d'),auth[_0x1ac3('0xc')](),controller['import']);router[_0x1ac3('0x2e')](_0x1ac3('0xe'),auth[_0x1ac3('0xc')](),controller[_0x1ac3('0x2f')]);router[_0x1ac3('0x30')]('/:id',auth[_0x1ac3('0xc')](),controller[_0x1ac3('0x31')]);module[_0x1ac3('0x32')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 041fb08..005ecab 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 _0x10dc=['STRING','PHONE','INTEGER','sequelize','exports'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x10dc,0x107));var _0xc10d=function(_0x16ee48,_0x4e660d){_0x16ee48=_0x16ee48-0x0;var _0x23f7bf=_0x10dc[_0x16ee48];return _0x23f7bf;};'use strict';var Sequelize=require(_0xc10d('0x0'));module[_0xc10d('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xc10d('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xc10d('0x2')],'defaultValue':_0xc10d('0x3')},'OrderBy':{'type':Sequelize[_0xc10d('0x4')],'defaultValue':null}}; \ No newline at end of file +var _0xd8a5=['sequelize','INTEGER','STRING','PHONE'];(function(_0x10548e,_0x80eaff){var _0x540aa4=function(_0x277e0e){while(--_0x277e0e){_0x10548e['push'](_0x10548e['shift']());}};_0x540aa4(++_0x80eaff);}(_0xd8a5,0x160));var _0x5d8a=function(_0x499c86,_0x10d4d2){_0x499c86=_0x499c86-0x0;var _0x3f815d=_0xd8a5[_0x499c86];return _0x3f815d;};'use strict';var Sequelize=require(_0x5d8a('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x5d8a('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x5d8a('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x5d8a('0x2')],'defaultValue':_0x5d8a('0x3')},'OrderBy':{'type':Sequelize[_0x5d8a('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 3dd47ba..ec1c304 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 _0x7cb2=['UserProfileResource','destroy','error','stack','name','index','CmContactHasItem','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','filter','options','count','includeAll','include','findAll','rows','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasItems','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','limit','set','reject','save','then'];(function(_0x4719a7,_0x12a8c1){var _0x5cc84e=function(_0x21980a){while(--_0x21980a){_0x4719a7['push'](_0x4719a7['shift']());}};_0x5cc84e(++_0x12a8c1);}(_0x7cb2,0x11b));var _0x27cb=function(_0x757227,_0x408cf0){_0x757227=_0x757227-0x0;var _0x5f1356=_0x7cb2[_0x757227];return _0x5f1356;};'use strict';var pdf=require(_0x27cb('0x0'));var emlformat=require(_0x27cb('0x1'));var rimraf=require(_0x27cb('0x2'));var zipdir=require(_0x27cb('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x27cb('0x4'));var moment=require('moment');var BPromise=require(_0x27cb('0x5'));var Mustache=require(_0x27cb('0x6'));var util=require(_0x27cb('0x7'));var path=require(_0x27cb('0x8'));var sox=require(_0x27cb('0x9'));var csv=require('to-csv');var ejs=require(_0x27cb('0xa'));var fs=require('fs');var _=require(_0x27cb('0xb'));var squel=require(_0x27cb('0xc'));var crypto=require(_0x27cb('0xd'));var jsforce=require(_0x27cb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x27cb('0xf'));var querystring=require('querystring');var Papa=require(_0x27cb('0x10'));var Redis=require('ioredis');var authService=require(_0x27cb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x27cb('0x12'));var hardwareService=require(_0x27cb('0x13'));var logger=require(_0x27cb('0x14'))('api');var utils=require(_0x27cb('0x15'));var config=require('../../config/environment');var db=require(_0x27cb('0x16'))['db'];function respondWithStatusCode(_0x195a2a,_0x15b5a4){_0x15b5a4=_0x15b5a4||0xcc;return function(_0x7d8374){if(_0x7d8374){return _0x195a2a[_0x27cb('0x17')](_0x15b5a4);}return _0x195a2a['status'](_0x15b5a4)[_0x27cb('0x18')]();};}function respondWithResult(_0xf842b3,_0x39ca25){_0x39ca25=_0x39ca25||0xc8;return function(_0x47d59d){if(_0x47d59d){return _0xf842b3[_0x27cb('0x19')](_0x39ca25)[_0x27cb('0x1a')](_0x47d59d);}};}function respondWithFilteredResult(_0x32b9ea,_0x345644){return function(_0x195a97){if(_0x195a97){var _0x4e762e=_0x195a97['count'],_0x15f8bc=_0x345644[_0x27cb('0x1b')],_0x35e269=_0x345644[_0x27cb('0x1b')]+_0x345644[_0x27cb('0x1c')],_0x567fe3;if(_0x35e269>=_0x4e762e){_0x35e269=_0x4e762e;_0x567fe3=0xc8;}else{_0x567fe3=0xce;}_0x32b9ea[_0x27cb('0x19')](_0x567fe3);return _0x32b9ea[_0x27cb('0x1d')]('Content-Range',_0x15f8bc+'-'+_0x35e269+'/'+_0x4e762e)[_0x27cb('0x1a')](_0x195a97);}return null;};}function patchUpdates(_0x42406a){return function(_0x27ca0c){try{jsonpatch['apply'](_0x27ca0c,_0x42406a,!![]);}catch(_0x2d59fc){return BPromise[_0x27cb('0x1e')](_0x2d59fc);}return _0x27ca0c[_0x27cb('0x1f')]();};}function saveUpdates(_0x5dba6e,_0x4af0bc){return function(_0x26f2f7){if(_0x26f2f7){return _0x26f2f7['update'](_0x5dba6e)['then'](function(_0x2a8ff3){return _0x2a8ff3;});}return null;};}function removeEntity(_0x450539,_0x586a9c){return function(_0xd45696){if(_0xd45696){return _0xd45696['destroy']()[_0x27cb('0x20')](function(){var _0x2aec14=_0xd45696['get']({'plain':!![]});var _0x563a86='CmContactHasItems';return db[_0x27cb('0x21')][_0x27cb('0x22')]({'where':{'type':_0x563a86,'resourceId':_0x2aec14['id']}})[_0x27cb('0x20')](function(){return _0xd45696;});})['then'](function(){_0x450539['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23d9b0,_0x1741bd){return function(_0x7bc224){if(!_0x7bc224){_0x23d9b0['sendStatus'](0x194);}return _0x7bc224;};}function handleError(_0x3331c9,_0x393088){_0x393088=_0x393088||0x1f4;return function(_0x177143){logger[_0x27cb('0x23')](_0x177143[_0x27cb('0x24')]);if(_0x177143[_0x27cb('0x25')]){delete _0x177143['name'];}_0x3331c9[_0x27cb('0x19')](_0x393088)['send'](_0x177143);};}exports[_0x27cb('0x26')]=function(_0x3fd479,_0x16af2c){var _0x7630c3={},_0x282e49={},_0x1d46cc={'count':0x0,'rows':[]};var _0x665baf=_['map'](db[_0x27cb('0x27')][_0x27cb('0x28')],function(_0x10bf46){return{'name':_0x10bf46[_0x27cb('0x29')],'type':_0x10bf46[_0x27cb('0x2a')]['key']};});_0x282e49[_0x27cb('0x2b')]=_[_0x27cb('0x2c')](_0x665baf,'name');_0x282e49[_0x27cb('0x2d')]=_[_0x27cb('0x2e')](_0x3fd479[_0x27cb('0x2d')]);_0x282e49[_0x27cb('0x2f')]=_['intersection'](_0x282e49[_0x27cb('0x2b')],_0x282e49[_0x27cb('0x2d')]);_0x7630c3[_0x27cb('0x30')]=_[_0x27cb('0x31')](_0x282e49[_0x27cb('0x2b')],qs[_0x27cb('0x32')](_0x3fd479[_0x27cb('0x2d')][_0x27cb('0x32')]));_0x7630c3[_0x27cb('0x30')]=_0x7630c3['attributes'][_0x27cb('0x33')]?_0x7630c3[_0x27cb('0x30')]:_0x282e49[_0x27cb('0x2b')];if(!_0x3fd479['query'][_0x27cb('0x34')](_0x27cb('0x35'))){_0x7630c3[_0x27cb('0x1c')]=qs['limit'](_0x3fd479['query']['limit']);_0x7630c3[_0x27cb('0x1b')]=qs['offset'](_0x3fd479[_0x27cb('0x2d')][_0x27cb('0x1b')]);}_0x7630c3['order']=qs[_0x27cb('0x36')](_0x3fd479[_0x27cb('0x2d')][_0x27cb('0x36')]);_0x7630c3['where']=qs[_0x27cb('0x2f')](_[_0x27cb('0x37')](_0x3fd479[_0x27cb('0x2d')],_0x282e49[_0x27cb('0x2f')]),_0x665baf);if(_0x3fd479[_0x27cb('0x2d')]['filter']){_0x7630c3[_0x27cb('0x38')]=_[_0x27cb('0x39')](_0x7630c3[_0x27cb('0x38')],{'$or':_['map'](_0x665baf,function(_0x4c114b){if(_0x4c114b['type']!=='VIRTUAL'){var _0x23a8e1={};_0x23a8e1[_0x4c114b[_0x27cb('0x25')]]={'$like':'%'+_0x3fd479['query'][_0x27cb('0x3a')]+'%'};return _0x23a8e1;}})});}_0x7630c3=_[_0x27cb('0x39')]({},_0x7630c3,_0x3fd479[_0x27cb('0x3b')]);var _0x250211={'where':_0x7630c3[_0x27cb('0x38')]};return db[_0x27cb('0x27')][_0x27cb('0x3c')](_0x250211)[_0x27cb('0x20')](function(_0x449fc4){_0x1d46cc['count']=_0x449fc4;if(_0x3fd479[_0x27cb('0x2d')][_0x27cb('0x3d')]){_0x7630c3[_0x27cb('0x3e')]=[{'all':!![]}];}return db[_0x27cb('0x27')][_0x27cb('0x3f')](_0x7630c3);})[_0x27cb('0x20')](function(_0x2dd867){_0x1d46cc[_0x27cb('0x40')]=_0x2dd867;return _0x1d46cc;})[_0x27cb('0x20')](respondWithFilteredResult(_0x16af2c,_0x7630c3))[_0x27cb('0x41')](handleError(_0x16af2c,null));};exports['show']=function(_0x2d723b,_0x41ce16){var _0x153d2d={'raw':!![],'where':{'id':_0x2d723b['params']['id']}},_0x1db556={};_0x1db556[_0x27cb('0x2b')]=_[_0x27cb('0x2e')](db['CmContactHasItem']['rawAttributes']);_0x1db556['query']=_[_0x27cb('0x2e')](_0x2d723b['query']);_0x1db556[_0x27cb('0x2f')]=_['intersection'](_0x1db556[_0x27cb('0x2b')],_0x1db556[_0x27cb('0x2d')]);_0x153d2d[_0x27cb('0x30')]=_[_0x27cb('0x31')](_0x1db556[_0x27cb('0x2b')],qs[_0x27cb('0x32')](_0x2d723b['query'][_0x27cb('0x32')]));_0x153d2d[_0x27cb('0x30')]=_0x153d2d[_0x27cb('0x30')][_0x27cb('0x33')]?_0x153d2d[_0x27cb('0x30')]:_0x1db556['model'];if(_0x2d723b[_0x27cb('0x2d')]['includeAll']){_0x153d2d['include']=[{'all':!![]}];}_0x153d2d=_[_0x27cb('0x39')]({},_0x153d2d,_0x2d723b[_0x27cb('0x3b')]);return db[_0x27cb('0x27')]['find'](_0x153d2d)[_0x27cb('0x20')](handleEntityNotFound(_0x41ce16,null))['then'](respondWithResult(_0x41ce16,null))[_0x27cb('0x41')](handleError(_0x41ce16,null));};exports[_0x27cb('0x42')]=function(_0x1f6f13,_0x505abd){return db[_0x27cb('0x27')]['create'](_0x1f6f13[_0x27cb('0x43')],{})[_0x27cb('0x20')](function(_0x1982a4){var _0x572f22=_0x1f6f13[_0x27cb('0x44')][_0x27cb('0x45')]({'plain':!![]});if(!_0x572f22)throw new Error(_0x27cb('0x46'));if(_0x572f22[_0x27cb('0x47')]===_0x27cb('0x44')){var _0x268242=_0x1982a4[_0x27cb('0x45')]({'plain':!![]});var _0x50c7f0=_0x27cb('0x48');return db[_0x27cb('0x49')][_0x27cb('0x4a')]({'where':{'name':_0x50c7f0,'userProfileId':_0x572f22['userProfileId']},'raw':!![]})['then'](function(_0x1e1ab1){if(_0x1e1ab1&&_0x1e1ab1[_0x27cb('0x4b')]===0x0){return db[_0x27cb('0x21')][_0x27cb('0x42')]({'name':_0x268242[_0x27cb('0x25')],'resourceId':_0x268242['id'],'type':_0x1e1ab1['name'],'sectionId':_0x1e1ab1['id']},{})['then'](function(){return _0x1982a4;});}else{return _0x1982a4;}})[_0x27cb('0x41')](function(_0x443e7c){logger[_0x27cb('0x23')](_0x27cb('0x4c'),_0x443e7c);throw _0x443e7c;});}return _0x1982a4;})[_0x27cb('0x20')](respondWithResult(_0x505abd,0xc9))[_0x27cb('0x41')](handleError(_0x505abd,null));};exports[_0x27cb('0x4d')]=function(_0x7f9e26,_0x2a452b){if(_0x7f9e26['body']['id']){delete _0x7f9e26[_0x27cb('0x43')]['id'];}return db[_0x27cb('0x27')][_0x27cb('0x4a')]({'where':{'id':_0x7f9e26[_0x27cb('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2a452b,null))['then'](saveUpdates(_0x7f9e26['body'],null))[_0x27cb('0x20')](respondWithResult(_0x2a452b,null))[_0x27cb('0x41')](handleError(_0x2a452b,null));};exports[_0x27cb('0x22')]=function(_0x47ee81,_0x10478f){return db[_0x27cb('0x27')][_0x27cb('0x4a')]({'where':{'id':_0x47ee81[_0x27cb('0x4e')]['id']}})[_0x27cb('0x20')](handleEntityNotFound(_0x10478f,null))[_0x27cb('0x20')](removeEntity(_0x10478f,null))[_0x27cb('0x41')](handleError(_0x10478f,null));}; \ No newline at end of file +var _0xe02d=['path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','count','offset','limit','set','reject','save','then','destroy','get','CmContactHasItems','UserProfileResource','end','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','update','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x128ca1,_0x55462c){var _0x573974=function(_0x349a85){while(--_0x349a85){_0x128ca1['push'](_0x128ca1['shift']());}};_0x573974(++_0x55462c);}(_0xe02d,0x146));var _0xde02=function(_0x2c5adc,_0x41df56){_0x2c5adc=_0x2c5adc-0x0;var _0x3ae2cc=_0xe02d[_0x2c5adc];return _0x3ae2cc;};'use strict';var pdf=require(_0xde02('0x0'));var emlformat=require(_0xde02('0x1'));var rimraf=require(_0xde02('0x2'));var zipdir=require(_0xde02('0x3'));var jsonpatch=require(_0xde02('0x4'));var rp=require(_0xde02('0x5'));var moment=require(_0xde02('0x6'));var BPromise=require(_0xde02('0x7'));var Mustache=require(_0xde02('0x8'));var util=require(_0xde02('0x9'));var path=require(_0xde02('0xa'));var sox=require(_0xde02('0xb'));var csv=require(_0xde02('0xc'));var ejs=require(_0xde02('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xde02('0xe'));var crypto=require(_0xde02('0xf'));var jsforce=require(_0xde02('0x10'));var deskjs=require(_0xde02('0x11'));var toCsv=require(_0xde02('0xc'));var querystring=require(_0xde02('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xde02('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xde02('0x14'));var hardwareService=require(_0xde02('0x15'));var logger=require(_0xde02('0x16'))(_0xde02('0x17'));var utils=require(_0xde02('0x18'));var config=require('../../config/environment');var db=require(_0xde02('0x19'))['db'];function respondWithStatusCode(_0x1c2099,_0x78e59f){_0x78e59f=_0x78e59f||0xcc;return function(_0x46ab2c){if(_0x46ab2c){return _0x1c2099['sendStatus'](_0x78e59f);}return _0x1c2099[_0xde02('0x1a')](_0x78e59f)['end']();};}function respondWithResult(_0x2c8422,_0x47ff40){_0x47ff40=_0x47ff40||0xc8;return function(_0x28fc9a){if(_0x28fc9a){return _0x2c8422[_0xde02('0x1a')](_0x47ff40)['json'](_0x28fc9a);}};}function respondWithFilteredResult(_0x22cab6,_0x437bd1){return function(_0x1d6a5f){if(_0x1d6a5f){var _0x157d84=_0x1d6a5f[_0xde02('0x1b')],_0xaec65b=_0x437bd1[_0xde02('0x1c')],_0x46e868=_0x437bd1[_0xde02('0x1c')]+_0x437bd1[_0xde02('0x1d')],_0x1f6ce5;if(_0x46e868>=_0x157d84){_0x46e868=_0x157d84;_0x1f6ce5=0xc8;}else{_0x1f6ce5=0xce;}_0x22cab6['status'](_0x1f6ce5);return _0x22cab6[_0xde02('0x1e')]('Content-Range',_0xaec65b+'-'+_0x46e868+'/'+_0x157d84)['json'](_0x1d6a5f);}return null;};}function patchUpdates(_0x350c82){return function(_0x18e4de){try{jsonpatch['apply'](_0x18e4de,_0x350c82,!![]);}catch(_0x240f0e){return BPromise[_0xde02('0x1f')](_0x240f0e);}return _0x18e4de[_0xde02('0x20')]();};}function saveUpdates(_0x3bc407,_0x52d0cb){return function(_0x5b032c){if(_0x5b032c){return _0x5b032c['update'](_0x3bc407)[_0xde02('0x21')](function(_0x587bd3){return _0x587bd3;});}return null;};}function removeEntity(_0x5d0d3f,_0x2fa263){return function(_0x1c2cc2){if(_0x1c2cc2){return _0x1c2cc2[_0xde02('0x22')]()['then'](function(){var _0x56c208=_0x1c2cc2[_0xde02('0x23')]({'plain':!![]});var _0x17575e=_0xde02('0x24');return db[_0xde02('0x25')][_0xde02('0x22')]({'where':{'type':_0x17575e,'resourceId':_0x56c208['id']}})['then'](function(){return _0x1c2cc2;});})[_0xde02('0x21')](function(){_0x5d0d3f[_0xde02('0x1a')](0xcc)[_0xde02('0x26')]();});}};}function handleEntityNotFound(_0x2335f9,_0x20ae72){return function(_0x2178ac){if(!_0x2178ac){_0x2335f9['sendStatus'](0x194);}return _0x2178ac;};}function handleError(_0x5baceb,_0x7e964c){_0x7e964c=_0x7e964c||0x1f4;return function(_0x58f4d4){logger[_0xde02('0x27')](_0x58f4d4[_0xde02('0x28')]);if(_0x58f4d4['name']){delete _0x58f4d4[_0xde02('0x29')];}_0x5baceb[_0xde02('0x1a')](_0x7e964c)[_0xde02('0x2a')](_0x58f4d4);};}exports[_0xde02('0x2b')]=function(_0x1d49f8,_0x1b92c6){var _0xac810={},_0x3feed3={},_0xa61f92={'count':0x0,'rows':[]};var _0x2db5fb=_[_0xde02('0x2c')](db[_0xde02('0x2d')][_0xde02('0x2e')],function(_0x401d21){return{'name':_0x401d21[_0xde02('0x2f')],'type':_0x401d21[_0xde02('0x30')][_0xde02('0x31')]};});_0x3feed3[_0xde02('0x32')]=_[_0xde02('0x2c')](_0x2db5fb,_0xde02('0x29'));_0x3feed3[_0xde02('0x33')]=_[_0xde02('0x34')](_0x1d49f8[_0xde02('0x33')]);_0x3feed3[_0xde02('0x35')]=_[_0xde02('0x36')](_0x3feed3[_0xde02('0x32')],_0x3feed3['query']);_0xac810['attributes']=_['intersection'](_0x3feed3['model'],qs[_0xde02('0x37')](_0x1d49f8['query'][_0xde02('0x37')]));_0xac810[_0xde02('0x38')]=_0xac810[_0xde02('0x38')][_0xde02('0x39')]?_0xac810[_0xde02('0x38')]:_0x3feed3[_0xde02('0x32')];if(!_0x1d49f8[_0xde02('0x33')][_0xde02('0x3a')](_0xde02('0x3b'))){_0xac810[_0xde02('0x1d')]=qs[_0xde02('0x1d')](_0x1d49f8[_0xde02('0x33')][_0xde02('0x1d')]);_0xac810[_0xde02('0x1c')]=qs[_0xde02('0x1c')](_0x1d49f8[_0xde02('0x33')][_0xde02('0x1c')]);}_0xac810[_0xde02('0x3c')]=qs[_0xde02('0x3d')](_0x1d49f8['query'][_0xde02('0x3d')]);_0xac810[_0xde02('0x3e')]=qs[_0xde02('0x35')](_[_0xde02('0x3f')](_0x1d49f8['query'],_0x3feed3[_0xde02('0x35')]),_0x2db5fb);if(_0x1d49f8[_0xde02('0x33')][_0xde02('0x40')]){_0xac810[_0xde02('0x3e')]=_[_0xde02('0x41')](_0xac810[_0xde02('0x3e')],{'$or':_['map'](_0x2db5fb,function(_0x247152){if(_0x247152['type']!==_0xde02('0x42')){var _0x185a51={};_0x185a51[_0x247152[_0xde02('0x29')]]={'$like':'%'+_0x1d49f8['query'][_0xde02('0x40')]+'%'};return _0x185a51;}})});}_0xac810=_['merge']({},_0xac810,_0x1d49f8[_0xde02('0x43')]);var _0x2acda0={'where':_0xac810[_0xde02('0x3e')]};return db[_0xde02('0x2d')]['count'](_0x2acda0)[_0xde02('0x21')](function(_0x30b865){_0xa61f92['count']=_0x30b865;if(_0x1d49f8[_0xde02('0x33')][_0xde02('0x44')]){_0xac810[_0xde02('0x45')]=[{'all':!![]}];}return db[_0xde02('0x2d')][_0xde02('0x46')](_0xac810);})[_0xde02('0x21')](function(_0x5781bd){_0xa61f92[_0xde02('0x47')]=_0x5781bd;return _0xa61f92;})[_0xde02('0x21')](respondWithFilteredResult(_0x1b92c6,_0xac810))[_0xde02('0x48')](handleError(_0x1b92c6,null));};exports[_0xde02('0x49')]=function(_0x16096d,_0x5c4eb9){var _0x121bcc={'raw':!![],'where':{'id':_0x16096d['params']['id']}},_0x4f8882={};_0x4f8882['model']=_[_0xde02('0x34')](db[_0xde02('0x2d')][_0xde02('0x2e')]);_0x4f8882[_0xde02('0x33')]=_['keys'](_0x16096d[_0xde02('0x33')]);_0x4f8882[_0xde02('0x35')]=_[_0xde02('0x36')](_0x4f8882[_0xde02('0x32')],_0x4f8882[_0xde02('0x33')]);_0x121bcc[_0xde02('0x38')]=_[_0xde02('0x36')](_0x4f8882['model'],qs[_0xde02('0x37')](_0x16096d[_0xde02('0x33')][_0xde02('0x37')]));_0x121bcc[_0xde02('0x38')]=_0x121bcc['attributes'][_0xde02('0x39')]?_0x121bcc[_0xde02('0x38')]:_0x4f8882[_0xde02('0x32')];if(_0x16096d[_0xde02('0x33')]['includeAll']){_0x121bcc[_0xde02('0x45')]=[{'all':!![]}];}_0x121bcc=_[_0xde02('0x41')]({},_0x121bcc,_0x16096d[_0xde02('0x43')]);return db[_0xde02('0x2d')][_0xde02('0x4a')](_0x121bcc)[_0xde02('0x21')](handleEntityNotFound(_0x5c4eb9,null))[_0xde02('0x21')](respondWithResult(_0x5c4eb9,null))[_0xde02('0x48')](handleError(_0x5c4eb9,null));};exports['create']=function(_0x830dce,_0x1a323a){return db['CmContactHasItem']['create'](_0x830dce[_0xde02('0x4b')],{})[_0xde02('0x21')](function(_0x39f75b){var _0x84f5f5=_0x830dce[_0xde02('0x4c')][_0xde02('0x23')]({'plain':!![]});if(!_0x84f5f5)throw new Error(_0xde02('0x4d'));if(_0x84f5f5[_0xde02('0x4e')]===_0xde02('0x4c')){var _0xba813e=_0x39f75b[_0xde02('0x23')]({'plain':!![]});var _0x28a167='CmContactHasItems';return db[_0xde02('0x4f')][_0xde02('0x4a')]({'where':{'name':_0x28a167,'userProfileId':_0x84f5f5[_0xde02('0x50')]},'raw':!![]})[_0xde02('0x21')](function(_0x283aaf){if(_0x283aaf&&_0x283aaf['autoAssociation']===0x0){return db[_0xde02('0x25')][_0xde02('0x51')]({'name':_0xba813e[_0xde02('0x29')],'resourceId':_0xba813e['id'],'type':_0x283aaf[_0xde02('0x29')],'sectionId':_0x283aaf['id']},{})[_0xde02('0x21')](function(){return _0x39f75b;});}else{return _0x39f75b;}})['catch'](function(_0x2c45f9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c45f9);throw _0x2c45f9;});}return _0x39f75b;})[_0xde02('0x21')](respondWithResult(_0x1a323a,0xc9))[_0xde02('0x48')](handleError(_0x1a323a,null));};exports[_0xde02('0x52')]=function(_0x590cdb,_0x19a25f){if(_0x590cdb[_0xde02('0x4b')]['id']){delete _0x590cdb[_0xde02('0x4b')]['id'];}return db[_0xde02('0x2d')][_0xde02('0x4a')]({'where':{'id':_0x590cdb[_0xde02('0x53')]['id']}})[_0xde02('0x21')](handleEntityNotFound(_0x19a25f,null))['then'](saveUpdates(_0x590cdb[_0xde02('0x4b')],null))['then'](respondWithResult(_0x19a25f,null))['catch'](handleError(_0x19a25f,null));};exports['destroy']=function(_0x1fdc61,_0x1245cc){return db['CmContactHasItem'][_0xde02('0x4a')]({'where':{'id':_0x1fdc61[_0xde02('0x53')]['id']}})[_0xde02('0x21')](handleEntityNotFound(_0x1245cc,null))[_0xde02('0x21')](removeEntity(_0x1245cc,null))['catch'](handleError(_0x1245cc,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 127eae6..6e4a12b 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 _0x3baf=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x3baf,0xf7));var _0xf3ba=function(_0x40632e,_0x1f7f8f){_0x40632e=_0x40632e-0x0;var _0x3708c4=_0x3baf[_0x40632e];return _0x3708c4;};'use strict';var _=require(_0xf3ba('0x0'));var util=require(_0xf3ba('0x1'));var logger=require(_0xf3ba('0x2'))(_0xf3ba('0x3'));var moment=require(_0xf3ba('0x4'));var BPromise=require(_0xf3ba('0x5'));var rp=require(_0xf3ba('0x6'));var fs=require('fs');var path=require(_0xf3ba('0x7'));var rimraf=require(_0xf3ba('0x8'));var config=require(_0xf3ba('0x9'));var attributes=require(_0xf3ba('0xa'));module[_0xf3ba('0xb')]=function(_0x475268,_0x2e6df2){return _0x475268[_0xf3ba('0xc')]('CmContactHasItem',attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1c6=['moment','request-promise','path','rimraf','exports','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger'];(function(_0x4cc78c,_0x492857){var _0x51dda2=function(_0x1be19b){while(--_0x1be19b){_0x4cc78c['push'](_0x4cc78c['shift']());}};_0x51dda2(++_0x492857);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x38175e,_0x28c519){_0x38175e=_0x38175e-0x0;var _0x143b4a=_0xc1c6[_0x38175e];return _0x143b4a;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./cmContactHasItem.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 7dd4263..c5291ae 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 _0x34f8=['http','request','info','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x34f8,0x80));var _0x834f=function(_0x5e8b64,_0x3b0ad7){_0x5e8b64=_0x5e8b64-0x0;var _0x57cf34=_0x34f8[_0x5e8b64];return _0x57cf34;};'use strict';var _=require(_0x834f('0x0'));var util=require(_0x834f('0x1'));var moment=require(_0x834f('0x2'));var BPromise=require(_0x834f('0x3'));var rs=require(_0x834f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x834f('0x5'));var logger=require(_0x834f('0x6'))('rpc');var config=require(_0x834f('0x7'));var jayson=require(_0x834f('0x8'));var client=jayson[_0x834f('0x9')][_0x834f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5378c4,_0x4cd107,_0xf778e4){return new BPromise(function(_0x2597c6,_0x20b504){return client[_0x834f('0xb')](_0x5378c4,_0xf778e4)['then'](function(_0x4210cf){logger[_0x834f('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x4cd107,_0x834f('0xd'));logger[_0x834f('0xe')](_0x834f('0xf'),_0x4cd107,_0x834f('0xd'),JSON[_0x834f('0x10')](_0x4210cf));if(_0x4210cf[_0x834f('0x11')]){if(_0x4210cf[_0x834f('0x11')][_0x834f('0x12')]===0x1f4){logger['error'](_0x834f('0x13'),_0x4cd107,_0x4210cf[_0x834f('0x11')][_0x834f('0x14')]);return _0x20b504(_0x4210cf[_0x834f('0x11')][_0x834f('0x14')]);}logger['error'](_0x834f('0x13'),_0x4cd107,_0x4210cf[_0x834f('0x11')]['message']);return _0x2597c6(_0x4210cf[_0x834f('0x11')][_0x834f('0x14')]);}else{logger['info'](_0x834f('0x13'),_0x4cd107,'request\x20sent');_0x2597c6(_0x4210cf[_0x834f('0x15')][_0x834f('0x14')]);}})[_0x834f('0x16')](function(_0x248924){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x4cd107,_0x248924);_0x20b504(_0x248924);});});} \ No newline at end of file +var _0x83b1=['http','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x2cff59,_0x589889){var _0x4a393c=function(_0x1637a2){while(--_0x1637a2){_0x2cff59['push'](_0x2cff59['shift']());}};_0x4a393c(++_0x589889);}(_0x83b1,0x128));var _0x183b=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x83b1[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x183b('0x0'));var util=require(_0x183b('0x1'));var moment=require(_0x183b('0x2'));var BPromise=require(_0x183b('0x3'));var rs=require(_0x183b('0x4'));var fs=require('fs');var Redis=require(_0x183b('0x5'));var db=require(_0x183b('0x6'))['db'];var utils=require(_0x183b('0x7'));var logger=require(_0x183b('0x8'))(_0x183b('0x9'));var config=require('../../config/environment');var jayson=require(_0x183b('0xa'));var client=jayson[_0x183b('0xb')][_0x183b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4bb2fd,_0x48a038,_0x5c189a){return new BPromise(function(_0x2bbc48,_0x3aced2){return client['request'](_0x4bb2fd,_0x5c189a)[_0x183b('0xd')](function(_0x1438a4){logger['info'](_0x183b('0xe'),_0x48a038,_0x183b('0xf'));logger[_0x183b('0x10')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x48a038,_0x183b('0xf'),JSON['stringify'](_0x1438a4));if(_0x1438a4[_0x183b('0x11')]){if(_0x1438a4[_0x183b('0x11')][_0x183b('0x12')]===0x1f4){logger[_0x183b('0x11')](_0x183b('0xe'),_0x48a038,_0x1438a4[_0x183b('0x11')][_0x183b('0x13')]);return _0x3aced2(_0x1438a4[_0x183b('0x11')]['message']);}logger[_0x183b('0x11')](_0x183b('0xe'),_0x48a038,_0x1438a4[_0x183b('0x11')]['message']);return _0x2bbc48(_0x1438a4[_0x183b('0x11')][_0x183b('0x13')]);}else{logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x48a038,_0x183b('0xf'));_0x2bbc48(_0x1438a4[_0x183b('0x14')][_0x183b('0x13')]);}})[_0x183b('0x15')](function(_0x26ac1f){logger['error'](_0x183b('0xe'),_0x48a038,_0x26ac1f);_0x3aced2(_0x26ac1f);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 0dbca3a..a823465 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 _0x46ec=['/:id','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index'];(function(_0x3bcc59,_0x194389){var _0x4f8f7e=function(_0x152ace){while(--_0x152ace){_0x3bcc59['push'](_0x3bcc59['shift']());}};_0x4f8f7e(++_0x194389);}(_0x46ec,0xa7));var _0xc46e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x46ec[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc46e('0x0'));var util=require(_0xc46e('0x1'));var path=require(_0xc46e('0x2'));var timeout=require(_0xc46e('0x3'));var express=require(_0xc46e('0x4'));var router=express[_0xc46e('0x5')]();var auth=require(_0xc46e('0x6'));var interaction=require(_0xc46e('0x7'));var config=require(_0xc46e('0x8'));var controller=require(_0xc46e('0x9'));router[_0xc46e('0xa')]('/',auth[_0xc46e('0xb')](),controller[_0xc46e('0xc')]);router[_0xc46e('0xa')](_0xc46e('0xd'),auth[_0xc46e('0xb')](),controller['show']);router[_0xc46e('0xe')]('/',auth[_0xc46e('0xb')](),controller['create']);router[_0xc46e('0xf')](_0xc46e('0xd'),auth[_0xc46e('0xb')](),controller[_0xc46e('0x10')]);router[_0xc46e('0x11')]('/:id',auth[_0xc46e('0xb')](),controller[_0xc46e('0x12')]);module[_0xc46e('0x13')]=router; \ No newline at end of file +var _0x3c1a=['post','create','update','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x3932eb,_0x43b210){var _0x5316e5=function(_0x1744e8){while(--_0x1744e8){_0x3932eb['push'](_0x3932eb['shift']());}};_0x5316e5(++_0x43b210);}(_0x3c1a,0xf4));var _0xa3c1=function(_0x3df871,_0xda2e11){_0x3df871=_0x3df871-0x0;var _0x570f7b=_0x3c1a[_0x3df871];return _0x570f7b;};'use strict';var multer=require('multer');var util=require(_0xa3c1('0x0'));var path=require('path');var timeout=require(_0xa3c1('0x1'));var express=require(_0xa3c1('0x2'));var router=express[_0xa3c1('0x3')]();var auth=require(_0xa3c1('0x4'));var interaction=require(_0xa3c1('0x5'));var config=require(_0xa3c1('0x6'));var controller=require('./cmContactHasItem.controller');router[_0xa3c1('0x7')]('/',auth[_0xa3c1('0x8')](),controller[_0xa3c1('0x9')]);router[_0xa3c1('0x7')](_0xa3c1('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xa3c1('0xb')]('/',auth[_0xa3c1('0x8')](),controller[_0xa3c1('0xc')]);router['put'](_0xa3c1('0xa'),auth[_0xa3c1('0x8')](),controller[_0xa3c1('0xd')]);router['delete'](_0xa3c1('0xa'),auth[_0xa3c1('0x8')](),controller[_0xa3c1('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index 76afd1b..6d7ed6e 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 _0x414b=['INTEGER','STRING','sequelize'];(function(_0x5171cf,_0x184464){var _0x3948b2=function(_0x80fcea){while(--_0x80fcea){_0x5171cf['push'](_0x5171cf['shift']());}};_0x3948b2(++_0x184464);}(_0x414b,0xb3));var _0xb414=function(_0x2014c9,_0x514a74){_0x2014c9=_0x2014c9-0x0;var _0x12a99a=_0x414b[_0x2014c9];return _0x12a99a;};'use strict';var Sequelize=require(_0xb414('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xb414('0x1')],'primaryKey':!![]},'phone':{'type':Sequelize[_0xb414('0x2')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0xd585=['exports','STRING','sequelize'];(function(_0x3a88d7,_0x7af944){var _0x349a1a=function(_0x3c2282){while(--_0x3c2282){_0x3a88d7['push'](_0x3a88d7['shift']());}};_0x349a1a(++_0x7af944);}(_0xd585,0x146));var _0x5d58=function(_0x504e8a,_0x45141e){_0x504e8a=_0x504e8a-0x0;var _0x5d74b9=_0xd585[_0x504e8a];return _0x5d74b9;};'use strict';var Sequelize=require(_0x5d58('0x0'));module[_0x5d58('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'phone':{'type':Sequelize[_0x5d58('0x2')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js index 481e5c8..0eb9a8e 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 _0x19ff=['send','map','CmContactHasPhone','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','params','catch','create','body','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','CmContactHasPhones','UserProfileResource','stack','name'];(function(_0x52f07c,_0x4edc1b){var _0x247115=function(_0x400d27){while(--_0x400d27){_0x52f07c['push'](_0x52f07c['shift']());}};_0x247115(++_0x4edc1b);}(_0x19ff,0x146));var _0xf19f=function(_0x3981c6,_0x5bb2d2){_0x3981c6=_0x3981c6-0x0;var _0x11baee=_0x19ff[_0x3981c6];return _0x11baee;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xf19f('0x0'));var zipdir=require(_0xf19f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf19f('0x2'));var BPromise=require(_0xf19f('0x3'));var Mustache=require(_0xf19f('0x4'));var util=require(_0xf19f('0x5'));var path=require(_0xf19f('0x6'));var sox=require(_0xf19f('0x7'));var csv=require('to-csv');var ejs=require(_0xf19f('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf19f('0x9'));var crypto=require(_0xf19f('0xa'));var jsforce=require(_0xf19f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf19f('0xc'));var querystring=require(_0xf19f('0xd'));var Papa=require(_0xf19f('0xe'));var Redis=require(_0xf19f('0xf'));var authService=require(_0xf19f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf19f('0x11'));var hardwareService=require(_0xf19f('0x12'));var logger=require('../../config/logger')(_0xf19f('0x13'));var utils=require(_0xf19f('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4616a4,_0x58995b){_0x58995b=_0x58995b||0xcc;return function(_0x178b78){if(_0x178b78){return _0x4616a4[_0xf19f('0x15')](_0x58995b);}return _0x4616a4[_0xf19f('0x16')](_0x58995b)[_0xf19f('0x17')]();};}function respondWithResult(_0x12a9d7,_0x4da182){_0x4da182=_0x4da182||0xc8;return function(_0x4e4cef){if(_0x4e4cef){return _0x12a9d7[_0xf19f('0x16')](_0x4da182)[_0xf19f('0x18')](_0x4e4cef);}};}function respondWithFilteredResult(_0x5c822e,_0x36c4c3){return function(_0x43efc2){if(_0x43efc2){var _0x1a2210=_0x43efc2[_0xf19f('0x19')],_0xbc6ed5=_0x36c4c3[_0xf19f('0x1a')],_0x1b1e97=_0x36c4c3[_0xf19f('0x1a')]+_0x36c4c3['limit'],_0x2ed9da;if(_0x1b1e97>=_0x1a2210){_0x1b1e97=_0x1a2210;_0x2ed9da=0xc8;}else{_0x2ed9da=0xce;}_0x5c822e['status'](_0x2ed9da);return _0x5c822e[_0xf19f('0x1b')](_0xf19f('0x1c'),_0xbc6ed5+'-'+_0x1b1e97+'/'+_0x1a2210)[_0xf19f('0x18')](_0x43efc2);}return null;};}function patchUpdates(_0x5dc5a1){return function(_0x25e6f1){try{jsonpatch[_0xf19f('0x1d')](_0x25e6f1,_0x5dc5a1,!![]);}catch(_0x1c67b4){return BPromise[_0xf19f('0x1e')](_0x1c67b4);}return _0x25e6f1['save']();};}function saveUpdates(_0x4d93ea,_0x5b599d){return function(_0xf45146){if(_0xf45146){return _0xf45146[_0xf19f('0x1f')](_0x4d93ea)[_0xf19f('0x20')](function(_0x1491ca){return _0x1491ca;});}return null;};}function removeEntity(_0xd5183d,_0x2a78dd){return function(_0x37f253){if(_0x37f253){return _0x37f253[_0xf19f('0x21')]()['then'](function(){var _0x4ab406=_0x37f253[_0xf19f('0x22')]({'plain':!![]});var _0x4f4a2c=_0xf19f('0x23');return db[_0xf19f('0x24')]['destroy']({'where':{'type':_0x4f4a2c,'resourceId':_0x4ab406['id']}})[_0xf19f('0x20')](function(){return _0x37f253;});})[_0xf19f('0x20')](function(){_0xd5183d['status'](0xcc)[_0xf19f('0x17')]();});}};}function handleEntityNotFound(_0x74c197,_0x5a8130){return function(_0x3a5d90){if(!_0x3a5d90){_0x74c197[_0xf19f('0x15')](0x194);}return _0x3a5d90;};}function handleError(_0x5be289,_0x22eeb5){_0x22eeb5=_0x22eeb5||0x1f4;return function(_0x4bc843){logger['error'](_0x4bc843[_0xf19f('0x25')]);if(_0x4bc843[_0xf19f('0x26')]){delete _0x4bc843[_0xf19f('0x26')];}_0x5be289[_0xf19f('0x16')](_0x22eeb5)[_0xf19f('0x27')](_0x4bc843);};}exports['index']=function(_0x6879d1,_0x5657aa){var _0x5c5ae9={},_0x4ad0b8={},_0x53fea2={'count':0x0,'rows':[]};var _0x5d206c=_[_0xf19f('0x28')](db[_0xf19f('0x29')][_0xf19f('0x2a')],function(_0x5633c1){return{'name':_0x5633c1[_0xf19f('0x2b')],'type':_0x5633c1[_0xf19f('0x2c')]['key']};});_0x4ad0b8[_0xf19f('0x2d')]=_[_0xf19f('0x28')](_0x5d206c,_0xf19f('0x26'));_0x4ad0b8[_0xf19f('0x2e')]=_[_0xf19f('0x2f')](_0x6879d1[_0xf19f('0x2e')]);_0x4ad0b8[_0xf19f('0x30')]=_[_0xf19f('0x31')](_0x4ad0b8['model'],_0x4ad0b8[_0xf19f('0x2e')]);_0x5c5ae9['attributes']=_[_0xf19f('0x31')](_0x4ad0b8[_0xf19f('0x2d')],qs['fields'](_0x6879d1['query'][_0xf19f('0x32')]));_0x5c5ae9[_0xf19f('0x33')]=_0x5c5ae9[_0xf19f('0x33')]['length']?_0x5c5ae9[_0xf19f('0x33')]:_0x4ad0b8[_0xf19f('0x2d')];if(!_0x6879d1[_0xf19f('0x2e')][_0xf19f('0x34')]('nolimit')){_0x5c5ae9[_0xf19f('0x35')]=qs[_0xf19f('0x35')](_0x6879d1['query']['limit']);_0x5c5ae9[_0xf19f('0x1a')]=qs['offset'](_0x6879d1['query'][_0xf19f('0x1a')]);}_0x5c5ae9[_0xf19f('0x36')]=qs[_0xf19f('0x37')](_0x6879d1[_0xf19f('0x2e')][_0xf19f('0x37')]);_0x5c5ae9[_0xf19f('0x38')]=qs[_0xf19f('0x30')](_[_0xf19f('0x39')](_0x6879d1[_0xf19f('0x2e')],_0x4ad0b8[_0xf19f('0x30')]),_0x5d206c);if(_0x6879d1[_0xf19f('0x2e')][_0xf19f('0x3a')]){_0x5c5ae9[_0xf19f('0x38')]=_[_0xf19f('0x3b')](_0x5c5ae9[_0xf19f('0x38')],{'$or':_[_0xf19f('0x28')](_0x5d206c,function(_0x164097){if(_0x164097[_0xf19f('0x2c')]!==_0xf19f('0x3c')){var _0xeda9c9={};_0xeda9c9[_0x164097['name']]={'$like':'%'+_0x6879d1['query'][_0xf19f('0x3a')]+'%'};return _0xeda9c9;}})});}_0x5c5ae9=_[_0xf19f('0x3b')]({},_0x5c5ae9,_0x6879d1['options']);var _0x53a91e={'where':_0x5c5ae9[_0xf19f('0x38')]};return db[_0xf19f('0x29')][_0xf19f('0x19')](_0x53a91e)[_0xf19f('0x20')](function(_0x19a323){_0x53fea2[_0xf19f('0x19')]=_0x19a323;if(_0x6879d1[_0xf19f('0x2e')][_0xf19f('0x3d')]){_0x5c5ae9[_0xf19f('0x3e')]=[{'all':!![]}];}return db['CmContactHasPhone']['findAll'](_0x5c5ae9);})[_0xf19f('0x20')](function(_0x5155c6){_0x53fea2[_0xf19f('0x3f')]=_0x5155c6;return _0x53fea2;})[_0xf19f('0x20')](respondWithFilteredResult(_0x5657aa,_0x5c5ae9))['catch'](handleError(_0x5657aa,null));};exports['show']=function(_0x373de1,_0x570d4a){var _0x2feaab={'raw':!![],'where':{'id':_0x373de1[_0xf19f('0x40')]['id']}},_0x2da9af={};_0x2da9af['model']=_[_0xf19f('0x2f')](db[_0xf19f('0x29')][_0xf19f('0x2a')]);_0x2da9af[_0xf19f('0x2e')]=_[_0xf19f('0x2f')](_0x373de1[_0xf19f('0x2e')]);_0x2da9af['filters']=_[_0xf19f('0x31')](_0x2da9af['model'],_0x2da9af[_0xf19f('0x2e')]);_0x2feaab[_0xf19f('0x33')]=_['intersection'](_0x2da9af[_0xf19f('0x2d')],qs[_0xf19f('0x32')](_0x373de1['query'][_0xf19f('0x32')]));_0x2feaab[_0xf19f('0x33')]=_0x2feaab[_0xf19f('0x33')]['length']?_0x2feaab[_0xf19f('0x33')]:_0x2da9af[_0xf19f('0x2d')];if(_0x373de1[_0xf19f('0x2e')][_0xf19f('0x3d')]){_0x2feaab[_0xf19f('0x3e')]=[{'all':!![]}];}_0x2feaab=_['merge']({},_0x2feaab,_0x373de1['options']);return db[_0xf19f('0x29')]['find'](_0x2feaab)[_0xf19f('0x20')](handleEntityNotFound(_0x570d4a,null))[_0xf19f('0x20')](respondWithResult(_0x570d4a,null))[_0xf19f('0x41')](handleError(_0x570d4a,null));};exports[_0xf19f('0x42')]=function(_0x2bfc1b,_0x1c09a4){return db[_0xf19f('0x29')][_0xf19f('0x42')](_0x2bfc1b[_0xf19f('0x43')],{})[_0xf19f('0x20')](function(_0xec0740){var _0x513bdd=_0x2bfc1b[_0xf19f('0x44')][_0xf19f('0x22')]({'plain':!![]});if(!_0x513bdd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x513bdd['role']===_0xf19f('0x44')){var _0x32cb26=_0xec0740['get']({'plain':!![]});var _0x2f46c3=_0xf19f('0x23');return db[_0xf19f('0x45')][_0xf19f('0x46')]({'where':{'name':_0x2f46c3,'userProfileId':_0x513bdd['userProfileId']},'raw':!![]})['then'](function(_0x328b5a){if(_0x328b5a&&_0x328b5a[_0xf19f('0x47')]===0x0){return db[_0xf19f('0x24')]['create']({'name':_0x32cb26[_0xf19f('0x26')],'resourceId':_0x32cb26['id'],'type':_0x328b5a[_0xf19f('0x26')],'sectionId':_0x328b5a['id']},{})['then'](function(){return _0xec0740;});}else{return _0xec0740;}})[_0xf19f('0x41')](function(_0x2827f5){logger['error'](_0xf19f('0x48'),_0x2827f5);throw _0x2827f5;});}return _0xec0740;})[_0xf19f('0x20')](respondWithResult(_0x1c09a4,0xc9))[_0xf19f('0x41')](handleError(_0x1c09a4,null));};exports[_0xf19f('0x1f')]=function(_0xd1af9e,_0x2ed0f8){if(_0xd1af9e[_0xf19f('0x43')]['id']){delete _0xd1af9e[_0xf19f('0x43')]['id'];}return db[_0xf19f('0x29')]['find']({'where':{'id':_0xd1af9e[_0xf19f('0x40')]['id']}})[_0xf19f('0x20')](handleEntityNotFound(_0x2ed0f8,null))[_0xf19f('0x20')](saveUpdates(_0xd1af9e[_0xf19f('0x43')],null))[_0xf19f('0x20')](respondWithResult(_0x2ed0f8,null))[_0xf19f('0x41')](handleError(_0x2ed0f8,null));};exports[_0xf19f('0x21')]=function(_0x3bc1f8,_0x373f42){return db[_0xf19f('0x29')][_0xf19f('0x46')]({'where':{'id':_0x3bc1f8[_0xf19f('0x40')]['id']}})[_0xf19f('0x20')](handleEntityNotFound(_0x373f42,null))[_0xf19f('0x20')](removeEntity(_0x373f42,null))[_0xf19f('0x41')](handleError(_0x373f42,null));}; \ No newline at end of file +var _0xec83=['squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','Content-Range','json','reject','save','then','get','CmContactHasPhones','UserProfileResource','destroy','error','stack','send','index','map','CmContactHasPhone','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','count','includeAll','include','rows','catch','length','options','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash'];(function(_0x1674ff,_0x36207b){var _0x21cdd9=function(_0x29e3c1){while(--_0x29e3c1){_0x1674ff['push'](_0x1674ff['shift']());}};_0x21cdd9(++_0x36207b);}(_0xec83,0x138));var _0x3ec8=function(_0x3e7804,_0x121853){_0x3e7804=_0x3e7804-0x0;var _0x56efda=_0xec83[_0x3e7804];return _0x56efda;};'use strict';var pdf=require(_0x3ec8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3ec8('0x1'));var zipdir=require(_0x3ec8('0x2'));var jsonpatch=require(_0x3ec8('0x3'));var rp=require(_0x3ec8('0x4'));var moment=require(_0x3ec8('0x5'));var BPromise=require(_0x3ec8('0x6'));var Mustache=require(_0x3ec8('0x7'));var util=require(_0x3ec8('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x3ec8('0x9'));var ejs=require(_0x3ec8('0xa'));var fs=require('fs');var _=require(_0x3ec8('0xb'));var squel=require(_0x3ec8('0xc'));var crypto=require('crypto');var jsforce=require(_0x3ec8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3ec8('0x9'));var querystring=require(_0x3ec8('0xe'));var Papa=require(_0x3ec8('0xf'));var Redis=require(_0x3ec8('0x10'));var authService=require(_0x3ec8('0x11'));var qs=require(_0x3ec8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ec8('0x13'));var logger=require(_0x3ec8('0x14'))(_0x3ec8('0x15'));var utils=require(_0x3ec8('0x16'));var config=require(_0x3ec8('0x17'));var db=require(_0x3ec8('0x18'))['db'];function respondWithStatusCode(_0x1cb77b,_0x36fd43){_0x36fd43=_0x36fd43||0xcc;return function(_0x554d9a){if(_0x554d9a){return _0x1cb77b[_0x3ec8('0x19')](_0x36fd43);}return _0x1cb77b['status'](_0x36fd43)[_0x3ec8('0x1a')]();};}function respondWithResult(_0x2bf548,_0x637868){_0x637868=_0x637868||0xc8;return function(_0x20bdd){if(_0x20bdd){return _0x2bf548[_0x3ec8('0x1b')](_0x637868)['json'](_0x20bdd);}};}function respondWithFilteredResult(_0x35fbbc,_0x4dd9b7){return function(_0x22e67e){if(_0x22e67e){var _0x290ef5=_0x22e67e['count'],_0x13d873=_0x4dd9b7[_0x3ec8('0x1c')],_0x4d621e=_0x4dd9b7[_0x3ec8('0x1c')]+_0x4dd9b7[_0x3ec8('0x1d')],_0xb89bdf;if(_0x4d621e>=_0x290ef5){_0x4d621e=_0x290ef5;_0xb89bdf=0xc8;}else{_0xb89bdf=0xce;}_0x35fbbc[_0x3ec8('0x1b')](_0xb89bdf);return _0x35fbbc['set'](_0x3ec8('0x1e'),_0x13d873+'-'+_0x4d621e+'/'+_0x290ef5)[_0x3ec8('0x1f')](_0x22e67e);}return null;};}function patchUpdates(_0x8c9bf0){return function(_0x106fae){try{jsonpatch['apply'](_0x106fae,_0x8c9bf0,!![]);}catch(_0x1b0237){return BPromise[_0x3ec8('0x20')](_0x1b0237);}return _0x106fae[_0x3ec8('0x21')]();};}function saveUpdates(_0x5e83aa,_0x471df4){return function(_0x3aeeaf){if(_0x3aeeaf){return _0x3aeeaf['update'](_0x5e83aa)[_0x3ec8('0x22')](function(_0x3f1c5b){return _0x3f1c5b;});}return null;};}function removeEntity(_0x407819,_0x3acd82){return function(_0x27188d){if(_0x27188d){return _0x27188d['destroy']()['then'](function(){var _0x1daf11=_0x27188d[_0x3ec8('0x23')]({'plain':!![]});var _0x388501=_0x3ec8('0x24');return db[_0x3ec8('0x25')][_0x3ec8('0x26')]({'where':{'type':_0x388501,'resourceId':_0x1daf11['id']}})[_0x3ec8('0x22')](function(){return _0x27188d;});})[_0x3ec8('0x22')](function(){_0x407819[_0x3ec8('0x1b')](0xcc)[_0x3ec8('0x1a')]();});}};}function handleEntityNotFound(_0x5114f0,_0x2f584d){return function(_0x4ec9bb){if(!_0x4ec9bb){_0x5114f0[_0x3ec8('0x19')](0x194);}return _0x4ec9bb;};}function handleError(_0x2fa1d6,_0x2b8a28){_0x2b8a28=_0x2b8a28||0x1f4;return function(_0x5201b9){logger[_0x3ec8('0x27')](_0x5201b9[_0x3ec8('0x28')]);if(_0x5201b9['name']){delete _0x5201b9['name'];}_0x2fa1d6[_0x3ec8('0x1b')](_0x2b8a28)[_0x3ec8('0x29')](_0x5201b9);};}exports[_0x3ec8('0x2a')]=function(_0x2488a8,_0xb17144){var _0x3ecea6={},_0x46be3d={},_0x18b438={'count':0x0,'rows':[]};var _0x33d653=_[_0x3ec8('0x2b')](db[_0x3ec8('0x2c')][_0x3ec8('0x2d')],function(_0x4a5b30){return{'name':_0x4a5b30[_0x3ec8('0x2e')],'type':_0x4a5b30[_0x3ec8('0x2f')][_0x3ec8('0x30')]};});_0x46be3d[_0x3ec8('0x31')]=_['map'](_0x33d653,_0x3ec8('0x32'));_0x46be3d[_0x3ec8('0x33')]=_[_0x3ec8('0x34')](_0x2488a8[_0x3ec8('0x33')]);_0x46be3d[_0x3ec8('0x35')]=_[_0x3ec8('0x36')](_0x46be3d['model'],_0x46be3d[_0x3ec8('0x33')]);_0x3ecea6[_0x3ec8('0x37')]=_[_0x3ec8('0x36')](_0x46be3d[_0x3ec8('0x31')],qs[_0x3ec8('0x38')](_0x2488a8[_0x3ec8('0x33')][_0x3ec8('0x38')]));_0x3ecea6[_0x3ec8('0x37')]=_0x3ecea6[_0x3ec8('0x37')]['length']?_0x3ecea6[_0x3ec8('0x37')]:_0x46be3d[_0x3ec8('0x31')];if(!_0x2488a8[_0x3ec8('0x33')][_0x3ec8('0x39')](_0x3ec8('0x3a'))){_0x3ecea6[_0x3ec8('0x1d')]=qs[_0x3ec8('0x1d')](_0x2488a8['query'][_0x3ec8('0x1d')]);_0x3ecea6[_0x3ec8('0x1c')]=qs[_0x3ec8('0x1c')](_0x2488a8[_0x3ec8('0x33')]['offset']);}_0x3ecea6['order']=qs[_0x3ec8('0x3b')](_0x2488a8[_0x3ec8('0x33')]['sort']);_0x3ecea6[_0x3ec8('0x3c')]=qs[_0x3ec8('0x35')](_[_0x3ec8('0x3d')](_0x2488a8[_0x3ec8('0x33')],_0x46be3d[_0x3ec8('0x35')]),_0x33d653);if(_0x2488a8[_0x3ec8('0x33')][_0x3ec8('0x3e')]){_0x3ecea6['where']=_['merge'](_0x3ecea6[_0x3ec8('0x3c')],{'$or':_[_0x3ec8('0x2b')](_0x33d653,function(_0x240221){if(_0x240221[_0x3ec8('0x2f')]!=='VIRTUAL'){var _0x1a2527={};_0x1a2527[_0x240221['name']]={'$like':'%'+_0x2488a8[_0x3ec8('0x33')]['filter']+'%'};return _0x1a2527;}})});}_0x3ecea6=_['merge']({},_0x3ecea6,_0x2488a8['options']);var _0x28fe8a={'where':_0x3ecea6[_0x3ec8('0x3c')]};return db[_0x3ec8('0x2c')][_0x3ec8('0x3f')](_0x28fe8a)[_0x3ec8('0x22')](function(_0x4d9fc0){_0x18b438['count']=_0x4d9fc0;if(_0x2488a8[_0x3ec8('0x33')][_0x3ec8('0x40')]){_0x3ecea6[_0x3ec8('0x41')]=[{'all':!![]}];}return db[_0x3ec8('0x2c')]['findAll'](_0x3ecea6);})['then'](function(_0x9436ab){_0x18b438[_0x3ec8('0x42')]=_0x9436ab;return _0x18b438;})[_0x3ec8('0x22')](respondWithFilteredResult(_0xb17144,_0x3ecea6))[_0x3ec8('0x43')](handleError(_0xb17144,null));};exports['show']=function(_0x4169dd,_0x9f5a6c){var _0x24be4b={'raw':!![],'where':{'id':_0x4169dd['params']['id']}},_0x3155a0={};_0x3155a0[_0x3ec8('0x31')]=_['keys'](db[_0x3ec8('0x2c')]['rawAttributes']);_0x3155a0[_0x3ec8('0x33')]=_[_0x3ec8('0x34')](_0x4169dd[_0x3ec8('0x33')]);_0x3155a0[_0x3ec8('0x35')]=_[_0x3ec8('0x36')](_0x3155a0[_0x3ec8('0x31')],_0x3155a0['query']);_0x24be4b[_0x3ec8('0x37')]=_[_0x3ec8('0x36')](_0x3155a0['model'],qs['fields'](_0x4169dd[_0x3ec8('0x33')]['fields']));_0x24be4b[_0x3ec8('0x37')]=_0x24be4b[_0x3ec8('0x37')][_0x3ec8('0x44')]?_0x24be4b[_0x3ec8('0x37')]:_0x3155a0[_0x3ec8('0x31')];if(_0x4169dd[_0x3ec8('0x33')][_0x3ec8('0x40')]){_0x24be4b[_0x3ec8('0x41')]=[{'all':!![]}];}_0x24be4b=_['merge']({},_0x24be4b,_0x4169dd[_0x3ec8('0x45')]);return db[_0x3ec8('0x2c')]['find'](_0x24be4b)['then'](handleEntityNotFound(_0x9f5a6c,null))['then'](respondWithResult(_0x9f5a6c,null))[_0x3ec8('0x43')](handleError(_0x9f5a6c,null));};exports[_0x3ec8('0x46')]=function(_0x478940,_0x2f03f9){return db[_0x3ec8('0x2c')][_0x3ec8('0x46')](_0x478940[_0x3ec8('0x47')],{})[_0x3ec8('0x22')](function(_0x327433){var _0x43fa5f=_0x478940[_0x3ec8('0x48')][_0x3ec8('0x23')]({'plain':!![]});if(!_0x43fa5f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43fa5f[_0x3ec8('0x49')]===_0x3ec8('0x48')){var _0x5bbadc=_0x327433[_0x3ec8('0x23')]({'plain':!![]});var _0x575950='CmContactHasPhones';return db[_0x3ec8('0x4a')][_0x3ec8('0x4b')]({'where':{'name':_0x575950,'userProfileId':_0x43fa5f[_0x3ec8('0x4c')]},'raw':!![]})['then'](function(_0x21fde9){if(_0x21fde9&&_0x21fde9[_0x3ec8('0x4d')]===0x0){return db[_0x3ec8('0x25')][_0x3ec8('0x46')]({'name':_0x5bbadc[_0x3ec8('0x32')],'resourceId':_0x5bbadc['id'],'type':_0x21fde9[_0x3ec8('0x32')],'sectionId':_0x21fde9['id']},{})[_0x3ec8('0x22')](function(){return _0x327433;});}else{return _0x327433;}})[_0x3ec8('0x43')](function(_0x583e58){logger[_0x3ec8('0x27')](_0x3ec8('0x4e'),_0x583e58);throw _0x583e58;});}return _0x327433;})[_0x3ec8('0x22')](respondWithResult(_0x2f03f9,0xc9))[_0x3ec8('0x43')](handleError(_0x2f03f9,null));};exports[_0x3ec8('0x4f')]=function(_0x1074ba,_0x521cc2){if(_0x1074ba['body']['id']){delete _0x1074ba[_0x3ec8('0x47')]['id'];}return db[_0x3ec8('0x2c')][_0x3ec8('0x4b')]({'where':{'id':_0x1074ba[_0x3ec8('0x50')]['id']}})[_0x3ec8('0x22')](handleEntityNotFound(_0x521cc2,null))['then'](saveUpdates(_0x1074ba[_0x3ec8('0x47')],null))[_0x3ec8('0x22')](respondWithResult(_0x521cc2,null))['catch'](handleError(_0x521cc2,null));};exports[_0x3ec8('0x26')]=function(_0x599804,_0x4fc221){return db[_0x3ec8('0x2c')][_0x3ec8('0x4b')]({'where':{'id':_0x599804[_0x3ec8('0x50')]['id']}})[_0x3ec8('0x22')](handleEntityNotFound(_0x4fc221,null))[_0x3ec8('0x22')](removeEntity(_0x4fc221,null))[_0x3ec8('0x43')](handleError(_0x4fc221,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index 8d83fce..7865428 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 _0xb19f=['bluebird','request-promise','rimraf','./cmContactHasPhone.attributes','CmContactHasPhone','lodash','util','moment'];(function(_0x5deb8b,_0x1f4125){var _0x208e3a=function(_0x515691){while(--_0x515691){_0x5deb8b['push'](_0x5deb8b['shift']());}};_0x208e3a(++_0x1f4125);}(_0xb19f,0x7d));var _0xfb19=function(_0x4c03ae,_0x5856b0){_0x4c03ae=_0x4c03ae-0x0;var _0x1acaab=_0xb19f[_0x4c03ae];return _0x1acaab;};'use strict';var _=require(_0xfb19('0x0'));var util=require(_0xfb19('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfb19('0x2'));var BPromise=require(_0xfb19('0x3'));var rp=require(_0xfb19('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb19('0x5'));var config=require('../../config/environment');var attributes=require(_0xfb19('0x6'));module['exports']=function(_0x364587,_0x3de38c){return _0x364587['define'](_0xfb19('0x7'),attributes,{'tableName':'cm_contact_has_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe65d=['moment','bluebird','request-promise','path','rimraf','./cmContactHasPhone.attributes','exports','define','CmContactHasPhone','lodash','util','../../config/logger'];(function(_0x4814c4,_0x2bc364){var _0x3579ef=function(_0x358b97){while(--_0x358b97){_0x4814c4['push'](_0x4814c4['shift']());}};_0x3579ef(++_0x2bc364);}(_0xe65d,0x1dd));var _0xde65=function(_0x28f51c,_0x43800c){_0x28f51c=_0x28f51c-0x0;var _0x19172e=_0xe65d[_0x28f51c];return _0x19172e;};'use strict';var _=require(_0xde65('0x0'));var util=require(_0xde65('0x1'));var logger=require(_0xde65('0x2'))('api');var moment=require(_0xde65('0x3'));var BPromise=require(_0xde65('0x4'));var rp=require(_0xde65('0x5'));var fs=require('fs');var path=require(_0xde65('0x6'));var rimraf=require(_0xde65('0x7'));var config=require('../../config/environment');var attributes=require(_0xde65('0x8'));module[_0xde65('0x9')]=function(_0x178138,_0x22e32b){return _0x178138[_0xde65('0xa')](_0xde65('0xb'),attributes,{'tableName':'cm_contact_has_phones','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 66e6897..b7679dc 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 _0xf0ea=['util','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2f85dd,_0x4a4fa4){var _0x1520f6=function(_0x1c214d){while(--_0x1c214d){_0x2f85dd['push'](_0x2f85dd['shift']());}};_0x1520f6(++_0x4a4fa4);}(_0xf0ea,0x10e));var _0xaf0e=function(_0x194b25,_0x4bedc4){_0x194b25=_0x194b25-0x0;var _0x107ac5=_0xf0ea[_0x194b25];return _0x107ac5;};'use strict';var _=require('lodash');var util=require(_0xaf0e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaf0e('0x1'));var db=require(_0xaf0e('0x2'))['db'];var utils=require(_0xaf0e('0x3'));var logger=require(_0xaf0e('0x4'))('rpc');var config=require(_0xaf0e('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xaf0e('0x6')][_0xaf0e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3ba80b,_0x586fb0,_0x1b53d2){return new BPromise(function(_0x54ec87,_0x5d1235){return client['request'](_0x3ba80b,_0x1b53d2)[_0xaf0e('0x8')](function(_0x122fd5){logger[_0xaf0e('0x9')](_0xaf0e('0xa'),_0x586fb0,_0xaf0e('0xb'));logger[_0xaf0e('0xc')](_0xaf0e('0xd'),_0x586fb0,_0xaf0e('0xb'),JSON[_0xaf0e('0xe')](_0x122fd5));if(_0x122fd5[_0xaf0e('0xf')]){if(_0x122fd5['error'][_0xaf0e('0x10')]===0x1f4){logger[_0xaf0e('0xf')](_0xaf0e('0xa'),_0x586fb0,_0x122fd5[_0xaf0e('0xf')]['message']);return _0x5d1235(_0x122fd5[_0xaf0e('0xf')][_0xaf0e('0x11')]);}logger['error']('CmContactHasPhone,\x20%s,\x20%s',_0x586fb0,_0x122fd5[_0xaf0e('0xf')][_0xaf0e('0x11')]);return _0x54ec87(_0x122fd5['error'][_0xaf0e('0x11')]);}else{logger[_0xaf0e('0x9')](_0xaf0e('0xa'),_0x586fb0,_0xaf0e('0xb'));_0x54ec87(_0x122fd5['result']['message']);}})['catch'](function(_0xc43c35){logger[_0xaf0e('0xf')](_0xaf0e('0xa'),_0x586fb0,_0xc43c35);_0x5d1235(_0xc43c35);});});} \ No newline at end of file +var _0xf44c=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','CmContactHasPhone,\x20%s,\x20%s','message','result'];(function(_0x18a941,_0x4cea02){var _0x1e3c2b=function(_0x388800){while(--_0x388800){_0x18a941['push'](_0x18a941['shift']());}};_0x1e3c2b(++_0x4cea02);}(_0xf44c,0x188));var _0xcf44=function(_0x393416,_0x5ba67e){_0x393416=_0x393416-0x0;var _0x19388c=_0xf44c[_0x393416];return _0x19388c;};'use strict';var _=require(_0xcf44('0x0'));var util=require(_0xcf44('0x1'));var moment=require(_0xcf44('0x2'));var BPromise=require(_0xcf44('0x3'));var rs=require(_0xcf44('0x4'));var fs=require('fs');var Redis=require(_0xcf44('0x5'));var db=require(_0xcf44('0x6'))['db'];var utils=require(_0xcf44('0x7'));var logger=require(_0xcf44('0x8'))(_0xcf44('0x9'));var config=require(_0xcf44('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xcf44('0xb')][_0xcf44('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x38f3a7,_0x9fda29,_0x5a110e){return new BPromise(function(_0x8daa3,_0x204d50){return client['request'](_0x38f3a7,_0x5a110e)[_0xcf44('0xd')](function(_0x5109c2){logger[_0xcf44('0xe')]('CmContactHasPhone,\x20%s,\x20%s',_0x9fda29,'request\x20sent');logger['debug'](_0xcf44('0xf'),_0x9fda29,'request\x20sent',JSON[_0xcf44('0x10')](_0x5109c2));if(_0x5109c2['error']){if(_0x5109c2[_0xcf44('0x11')][_0xcf44('0x12')]===0x1f4){logger[_0xcf44('0x11')](_0xcf44('0x13'),_0x9fda29,_0x5109c2[_0xcf44('0x11')][_0xcf44('0x14')]);return _0x204d50(_0x5109c2[_0xcf44('0x11')][_0xcf44('0x14')]);}logger['error'](_0xcf44('0x13'),_0x9fda29,_0x5109c2[_0xcf44('0x11')][_0xcf44('0x14')]);return _0x8daa3(_0x5109c2[_0xcf44('0x11')][_0xcf44('0x14')]);}else{logger[_0xcf44('0xe')](_0xcf44('0x13'),_0x9fda29,'request\x20sent');_0x8daa3(_0x5109c2[_0xcf44('0x15')][_0xcf44('0x14')]);}})[_0xcf44('0x16')](function(_0x3100eb){logger[_0xcf44('0x11')](_0xcf44('0x13'),_0x9fda29,_0x3100eb);_0x204d50(_0x3100eb);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index 8798956..a0ab126 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 _0xda0d=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','index','isAuthenticated','post','create','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x4d4dee,_0x524074){var _0xae3525=function(_0x332e3f){while(--_0x332e3f){_0x4d4dee['push'](_0x4d4dee['shift']());}};_0xae3525(++_0x524074);}(_0xda0d,0x6e));var _0xdda0=function(_0x15125d,_0x23c475){_0x15125d=_0x15125d-0x0;var _0x223d94=_0xda0d[_0x15125d];return _0x223d94;};'use strict';var multer=require(_0xdda0('0x0'));var util=require('util');var path=require(_0xdda0('0x1'));var timeout=require(_0xdda0('0x2'));var express=require(_0xdda0('0x3'));var router=express[_0xdda0('0x4')]();var auth=require(_0xdda0('0x5'));var interaction=require(_0xdda0('0x6'));var config=require(_0xdda0('0x7'));var controller=require(_0xdda0('0x8'));router[_0xdda0('0x9')]('/',auth['isAuthenticated'](),controller[_0xdda0('0xa')]);router[_0xdda0('0x9')]('/:id',auth[_0xdda0('0xb')](),controller['show']);router[_0xdda0('0xc')]('/',auth[_0xdda0('0xb')](),controller[_0xdda0('0xd')]);router[_0xdda0('0xe')](_0xdda0('0xf'),auth[_0xdda0('0xb')](),controller['update']);router[_0xdda0('0x10')](_0xdda0('0xf'),auth[_0xdda0('0xb')](),controller[_0xdda0('0x11')]);module[_0xdda0('0x12')]=router; \ No newline at end of file +var _0x94e1=['../../config/environment','./cmContactHasPhone.controller','show','post','isAuthenticated','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x56f767,_0x16dea5){var _0x46038f=function(_0x150fb9){while(--_0x150fb9){_0x56f767['push'](_0x56f767['shift']());}};_0x46038f(++_0x16dea5);}(_0x94e1,0xe3));var _0x194e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x94e1[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x194e('0x0'));var util=require(_0x194e('0x1'));var path=require(_0x194e('0x2'));var timeout=require(_0x194e('0x3'));var express=require(_0x194e('0x4'));var router=express['Router']();var auth=require(_0x194e('0x5'));var interaction=require(_0x194e('0x6'));var config=require(_0x194e('0x7'));var controller=require(_0x194e('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x194e('0x9')]);router[_0x194e('0xa')]('/',auth[_0x194e('0xb')](),controller[_0x194e('0xc')]);router[_0x194e('0xd')](_0x194e('0xe'),auth['isAuthenticated'](),controller[_0x194e('0xf')]);router['delete'](_0x194e('0xe'),auth[_0x194e('0xb')](),controller[_0x194e('0x10')]);module[_0x194e('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 e928391..bc721ab 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 _0xa6ab=['sequelize','lodash','exports','VIRTUAL','alias','STRING','setDataValue','name','TEXT','select','parse','getDataValue','values','stringify','BOOLEAN'];(function(_0x2fb20d,_0x3af40c){var _0x500c23=function(_0x1ae1b1){while(--_0x1ae1b1){_0x2fb20d['push'](_0x2fb20d['shift']());}};_0x500c23(++_0x3af40c);}(_0xa6ab,0xb4));var _0xba6a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa6ab[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xba6a('0x0'));var _=require(_0xba6a('0x1'));module[_0xba6a('0x2')]={'name':{'type':Sequelize[_0xba6a('0x3')],'get':function(_0x47000d){return this['getDataValue'](_0xba6a('0x4'));}},'alias':{'type':Sequelize[_0xba6a('0x5')],'allowNull':![],'set':function(_0x434c2e){this[_0xba6a('0x6')](_0xba6a('0x4'),_0x434c2e?_0x434c2e:this['getDataValue'](_0xba6a('0x7')));}},'type':{'type':Sequelize[_0xba6a('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xba6a('0x8')]('long'),'get':function(){if(this['getDataValue']('type')===_0xba6a('0x9')){return JSON[_0xba6a('0xa')](this[_0xba6a('0xb')](_0xba6a('0xc')));}else{return this[_0xba6a('0xb')](_0xba6a('0xc'));}},'set':function(_0x3102f9){if(Array['isArray'](_0x3102f9)){this[_0xba6a('0x6')](_0xba6a('0xc'),JSON[_0xba6a('0xd')](_0x3102f9));}else{this[_0xba6a('0x6')](_0xba6a('0xc'),_0x3102f9);}}},'required':{'type':Sequelize[_0xba6a('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0x7916=['sequelize','lodash','exports','VIRTUAL','getDataValue','alias','setDataValue','name','STRING','TEXT','type','parse','values','BOOLEAN'];(function(_0x3ebed8,_0x43249b){var _0x3d4988=function(_0x3837f8){while(--_0x3837f8){_0x3ebed8['push'](_0x3ebed8['shift']());}};_0x3d4988(++_0x43249b);}(_0x7916,0x70));var _0x6791=function(_0x102469,_0x2f7dc5){_0x102469=_0x102469-0x0;var _0x5d1b75=_0x7916[_0x102469];return _0x5d1b75;};'use strict';var Sequelize=require(_0x6791('0x0'));var _=require(_0x6791('0x1'));module[_0x6791('0x2')]={'name':{'type':Sequelize[_0x6791('0x3')],'get':function(_0x36c12c){return this[_0x6791('0x4')](_0x6791('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x10c04f){this[_0x6791('0x6')](_0x6791('0x5'),_0x10c04f?_0x10c04f:this[_0x6791('0x4')](_0x6791('0x7')));}},'type':{'type':Sequelize[_0x6791('0x8')],'allowNull':![]},'values':{'type':Sequelize[_0x6791('0x9')]('long'),'get':function(){if(this['getDataValue'](_0x6791('0xa'))==='select'){return JSON[_0x6791('0xb')](this[_0x6791('0x4')](_0x6791('0xc')));}else{return this[_0x6791('0x4')](_0x6791('0xc'));}},'set':function(_0x216208){if(Array['isArray'](_0x216208)){this['setDataValue'](_0x6791('0xc'),JSON['stringify'](_0x216208));}else{this[_0x6791('0x6')](_0x6791('0xc'),_0x216208);}}},'required':{'type':Sequelize[_0x6791('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index c5aafcb..c07fd17 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 _0x20d6=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','then','destroy','sendStatus','send','index','CmCustomField','rawAttributes','fieldName','type','model','map','name','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','update','body','create','sequelize','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5dbb6d,_0x52d762){var _0x109686=function(_0x536542){while(--_0x536542){_0x5dbb6d['push'](_0x5dbb6d['shift']());}};_0x109686(++_0x52d762);}(_0x20d6,0x181));var _0x620d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x20d6[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x620d('0x0'));var rimraf=require(_0x620d('0x1'));var zipdir=require(_0x620d('0x2'));var jsonpatch=require(_0x620d('0x3'));var rp=require(_0x620d('0x4'));var moment=require('moment');var BPromise=require(_0x620d('0x5'));var Mustache=require('mustache');var util=require(_0x620d('0x6'));var path=require('path');var sox=require(_0x620d('0x7'));var csv=require(_0x620d('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x620d('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x620d('0x8'));var querystring=require(_0x620d('0xa'));var Papa=require('papaparse');var Redis=require(_0x620d('0xb'));var authService=require(_0x620d('0xc'));var qs=require(_0x620d('0xd'));var as=require(_0x620d('0xe'));var hardwareService=require(_0x620d('0xf'));var logger=require(_0x620d('0x10'))(_0x620d('0x11'));var utils=require(_0x620d('0x12'));var config=require(_0x620d('0x13'));var db=require(_0x620d('0x14'))['db'];function respondWithStatusCode(_0x40cd5d,_0x55741d){_0x55741d=_0x55741d||0xcc;return function(_0x4210ab){if(_0x4210ab){return _0x40cd5d['sendStatus'](_0x55741d);}return _0x40cd5d[_0x620d('0x15')](_0x55741d)[_0x620d('0x16')]();};}function respondWithResult(_0x3a0e7e,_0x3e5558){_0x3e5558=_0x3e5558||0xc8;return function(_0x362714){if(_0x362714){return _0x3a0e7e[_0x620d('0x15')](_0x3e5558)[_0x620d('0x17')](_0x362714);}};}function respondWithFilteredResult(_0x2215ff,_0x41fa0d){return function(_0x1c17c5){if(_0x1c17c5){var _0x35ef43=_0x1c17c5[_0x620d('0x18')],_0x5e8cd6=_0x41fa0d[_0x620d('0x19')],_0x340f6c=_0x41fa0d['offset']+_0x41fa0d[_0x620d('0x1a')],_0x3e9f13;if(_0x340f6c>=_0x35ef43){_0x340f6c=_0x35ef43;_0x3e9f13=0xc8;}else{_0x3e9f13=0xce;}_0x2215ff[_0x620d('0x15')](_0x3e9f13);return _0x2215ff[_0x620d('0x1b')](_0x620d('0x1c'),_0x5e8cd6+'-'+_0x340f6c+'/'+_0x35ef43)['json'](_0x1c17c5);}return null;};}function patchUpdates(_0x229060){return function(_0x2eb380){try{jsonpatch[_0x620d('0x1d')](_0x2eb380,_0x229060,!![]);}catch(_0x3ed334){return BPromise['reject'](_0x3ed334);}return _0x2eb380['save']();};}function saveUpdates(_0x4b4842,_0x1cb707){return function(_0x2b96c7){if(_0x2b96c7){return _0x2b96c7['update'](_0x4b4842)[_0x620d('0x1e')](function(_0x584978){return _0x584978;});}return null;};}function removeEntity(_0x103aff,_0x549177){return function(_0x246212){if(_0x246212){return _0x246212[_0x620d('0x1f')]()[_0x620d('0x1e')](function(){_0x103aff[_0x620d('0x15')](0xcc)[_0x620d('0x16')]();});}};}function handleEntityNotFound(_0x5ddf83,_0x185b90){return function(_0x138a35){if(!_0x138a35){_0x5ddf83[_0x620d('0x20')](0x194);}return _0x138a35;};}function handleError(_0x17f41b,_0x57f4c5){_0x57f4c5=_0x57f4c5||0x1f4;return function(_0x3998ea){logger['error'](_0x3998ea['stack']);if(_0x3998ea['name']){delete _0x3998ea['name'];}_0x17f41b[_0x620d('0x15')](_0x57f4c5)[_0x620d('0x21')](_0x3998ea);};}exports[_0x620d('0x22')]=function(_0x3355f7,_0x415150){var _0x245af6={},_0x4b7745={},_0x5d71f5={'count':0x0,'rows':[]};var _0x760544=_['map'](db[_0x620d('0x23')][_0x620d('0x24')],function(_0xa4f4e8){return{'name':_0xa4f4e8[_0x620d('0x25')],'type':_0xa4f4e8[_0x620d('0x26')]['key']};});_0x4b7745[_0x620d('0x27')]=_['differenceBy'](_[_0x620d('0x28')](_0x760544,_0x620d('0x29')),[_0x620d('0x29')]);_0x4b7745[_0x620d('0x2a')]=_[_0x620d('0x2b')](_0x3355f7[_0x620d('0x2a')]);_0x4b7745['filters']=_[_0x620d('0x2c')](_0x4b7745[_0x620d('0x27')],_0x4b7745['query']);_0x245af6[_0x620d('0x2d')]=_[_0x620d('0x2c')](_0x4b7745[_0x620d('0x27')],qs[_0x620d('0x2e')](_0x3355f7[_0x620d('0x2a')]['fields']));_0x245af6[_0x620d('0x2d')]=_0x245af6[_0x620d('0x2d')][_0x620d('0x2f')]?_0x245af6[_0x620d('0x2d')]:_0x4b7745['model'];if(!_0x3355f7[_0x620d('0x2a')]['hasOwnProperty']('nolimit')){_0x245af6[_0x620d('0x1a')]=qs[_0x620d('0x1a')](_0x3355f7[_0x620d('0x2a')][_0x620d('0x1a')]);_0x245af6[_0x620d('0x19')]=qs['offset'](_0x3355f7[_0x620d('0x2a')][_0x620d('0x19')]);}_0x245af6[_0x620d('0x30')]=qs[_0x620d('0x31')](_0x3355f7['query'][_0x620d('0x31')]);_0x245af6[_0x620d('0x32')]=qs[_0x620d('0x33')](_[_0x620d('0x34')](_0x3355f7['query'],_0x4b7745[_0x620d('0x33')]),_0x760544);if(_0x3355f7[_0x620d('0x2a')][_0x620d('0x35')]){_0x245af6[_0x620d('0x32')]=_['merge'](_0x245af6[_0x620d('0x32')],{'$or':_['map'](_0x760544,function(_0x3956bc){if(_0x3956bc['type']!==_0x620d('0x36')){var _0x649c2a={};_0x649c2a[_0x3956bc[_0x620d('0x29')]]={'$like':'%'+_0x3355f7[_0x620d('0x2a')][_0x620d('0x35')]+'%'};return _0x649c2a;}})});}_0x245af6=_[_0x620d('0x37')]({},_0x245af6,_0x3355f7[_0x620d('0x38')]);var _0x3b6d27={'where':_0x245af6[_0x620d('0x32')]};return db[_0x620d('0x23')][_0x620d('0x18')](_0x3b6d27)['then'](function(_0x3508ea){_0x5d71f5[_0x620d('0x18')]=_0x3508ea;if(_0x3355f7[_0x620d('0x2a')][_0x620d('0x39')]){_0x245af6[_0x620d('0x3a')]=[{'all':!![]}];}return db['CmCustomField'][_0x620d('0x3b')](_0x245af6);})[_0x620d('0x1e')](function(_0x2dd33c){_0x5d71f5['rows']=_0x2dd33c;return _0x5d71f5;})[_0x620d('0x1e')](respondWithFilteredResult(_0x415150,_0x245af6))[_0x620d('0x3c')](handleError(_0x415150,null));};exports[_0x620d('0x3d')]=function(_0x19cd82,_0x183403){var _0x1e4a4e={'raw':!![],'where':{'id':_0x19cd82[_0x620d('0x3e')]['id']}},_0x1d5443={};_0x1d5443[_0x620d('0x27')]=_[_0x620d('0x2b')](db[_0x620d('0x23')][_0x620d('0x24')]);_0x1d5443[_0x620d('0x2a')]=_[_0x620d('0x2b')](_0x19cd82['query']);_0x1d5443['filters']=_['intersection'](_0x1d5443[_0x620d('0x27')],_0x1d5443[_0x620d('0x2a')]);_0x1e4a4e[_0x620d('0x2d')]=_['intersection'](_0x1d5443[_0x620d('0x27')],qs[_0x620d('0x2e')](_0x19cd82[_0x620d('0x2a')][_0x620d('0x2e')]));_0x1e4a4e[_0x620d('0x2d')]=_0x1e4a4e[_0x620d('0x2d')][_0x620d('0x2f')]?_0x1e4a4e['attributes']:_0x1d5443['model'];if(_0x19cd82[_0x620d('0x2a')][_0x620d('0x39')]){_0x1e4a4e[_0x620d('0x3a')]=[{'all':!![]}];}_0x1e4a4e=_[_0x620d('0x37')]({},_0x1e4a4e,_0x19cd82[_0x620d('0x38')]);return db[_0x620d('0x23')][_0x620d('0x3f')](_0x1e4a4e)[_0x620d('0x1e')](handleEntityNotFound(_0x183403,null))[_0x620d('0x1e')](respondWithResult(_0x183403,null))[_0x620d('0x3c')](handleError(_0x183403,null));};exports[_0x620d('0x40')]=function(_0x33aa44,_0xe11787){if(_0x33aa44[_0x620d('0x41')]['id']){delete _0x33aa44[_0x620d('0x41')]['id'];}return db[_0x620d('0x23')]['find']({'where':{'id':_0x33aa44['params']['id']}})[_0x620d('0x1e')](handleEntityNotFound(_0xe11787,null))[_0x620d('0x1e')](saveUpdates(_0x33aa44['body'],null))[_0x620d('0x1e')](respondWithResult(_0xe11787,null))[_0x620d('0x3c')](handleError(_0xe11787,null));};exports[_0x620d('0x1f')]=function(_0x413a25,_0x2e586a){return db[_0x620d('0x23')][_0x620d('0x3f')]({'where':{'id':_0x413a25[_0x620d('0x3e')]['id']}})[_0x620d('0x1e')](handleEntityNotFound(_0x2e586a,null))['then'](removeEntity(_0x2e586a,null))[_0x620d('0x3c')](handleError(_0x2e586a,null));};exports[_0x620d('0x42')]=function(_0x1e14d4,_0x4b66bb){var _0x556fd9;return db[_0x620d('0x43')][_0x620d('0x44')](function(_0x1aa0f9){return db[_0x620d('0x23')][_0x620d('0x42')](_0x1e14d4[_0x620d('0x41')],{'transaction':_0x1aa0f9})[_0x620d('0x1e')](function(_0x1eaea6){_0x556fd9=_0x1eaea6;var _0x35b700={'type':db[_0x620d('0x45')][_0x620d('0x46')],'transaction':_0x1aa0f9};switch(_0x1e14d4[_0x620d('0x41')][_0x620d('0x26')]){case'text':_0x35b700[_0x620d('0x26')]=db[_0x620d('0x45')]['TEXT'];break;case _0x620d('0x47'):_0x35b700[_0x620d('0x26')]=db[_0x620d('0x45')][_0x620d('0x48')];break;case _0x620d('0x49'):_0x35b700[_0x620d('0x26')]=db['Sequelize'][_0x620d('0x4a')];_0x35b700[_0x620d('0x4b')]=![];break;default:}return db[_0x620d('0x43')][_0x620d('0x4c')][_0x620d('0x4d')]('cm_contacts',util[_0x620d('0x4e')](_0x620d('0x4f'),_0x556fd9['id']),_0x35b700);})[_0x620d('0x1e')](function(){return _0x556fd9;});})['then'](respondWithResult(_0x4b66bb,0xc9))['catch'](handleError(_0x4b66bb,null));}; \ No newline at end of file +var _0x761d=['model','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','where','VIRTUAL','options','count','include','findAll','rows','show','params','rawAttributes','length','includeAll','find','catch','create','sequelize','transaction','body','Sequelize','TEXT','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%d','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','then','end','error','stack','name','send','index','map','CmCustomField','fieldName','type','query','keys','intersection'];(function(_0x507ac5,_0x33aaee){var _0x12c1bc=function(_0x5c953c){while(--_0x5c953c){_0x507ac5['push'](_0x507ac5['shift']());}};_0x12c1bc(++_0x33aaee);}(_0x761d,0xca));var _0xd761=function(_0xa1bea4,_0x2896ad){_0xa1bea4=_0xa1bea4-0x0;var _0x2fefa0=_0x761d[_0xa1bea4];return _0x2fefa0;};'use strict';var pdf=require(_0xd761('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd761('0x1'));var jsonpatch=require(_0xd761('0x2'));var rp=require(_0xd761('0x3'));var moment=require(_0xd761('0x4'));var BPromise=require(_0xd761('0x5'));var Mustache=require(_0xd761('0x6'));var util=require('util');var path=require(_0xd761('0x7'));var sox=require(_0xd761('0x8'));var csv=require('to-csv');var ejs=require(_0xd761('0x9'));var fs=require('fs');var _=require(_0xd761('0xa'));var squel=require(_0xd761('0xb'));var crypto=require('crypto');var jsforce=require(_0xd761('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd761('0xd'));var querystring=require(_0xd761('0xe'));var Papa=require(_0xd761('0xf'));var Redis=require(_0xd761('0x10'));var authService=require(_0xd761('0x11'));var qs=require(_0xd761('0x12'));var as=require(_0xd761('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd761('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41005f,_0xcbae50){_0xcbae50=_0xcbae50||0xcc;return function(_0x207f63){if(_0x207f63){return _0x41005f[_0xd761('0x15')](_0xcbae50);}return _0x41005f[_0xd761('0x16')](_0xcbae50)['end']();};}function respondWithResult(_0x34fafe,_0x2d7ce1){_0x2d7ce1=_0x2d7ce1||0xc8;return function(_0x55945e){if(_0x55945e){return _0x34fafe['status'](_0x2d7ce1)['json'](_0x55945e);}};}function respondWithFilteredResult(_0x25ca73,_0x294475){return function(_0x38249c){if(_0x38249c){var _0x5594af=_0x38249c['count'],_0x57eb44=_0x294475[_0xd761('0x17')],_0x1b149c=_0x294475[_0xd761('0x17')]+_0x294475[_0xd761('0x18')],_0x1d096c;if(_0x1b149c>=_0x5594af){_0x1b149c=_0x5594af;_0x1d096c=0xc8;}else{_0x1d096c=0xce;}_0x25ca73[_0xd761('0x16')](_0x1d096c);return _0x25ca73[_0xd761('0x19')](_0xd761('0x1a'),_0x57eb44+'-'+_0x1b149c+'/'+_0x5594af)[_0xd761('0x1b')](_0x38249c);}return null;};}function patchUpdates(_0x1a3c4d){return function(_0x4ab860){try{jsonpatch[_0xd761('0x1c')](_0x4ab860,_0x1a3c4d,!![]);}catch(_0x381473){return BPromise[_0xd761('0x1d')](_0x381473);}return _0x4ab860['save']();};}function saveUpdates(_0x5206c7,_0x1ee174){return function(_0x3b3fb4){if(_0x3b3fb4){return _0x3b3fb4['update'](_0x5206c7)[_0xd761('0x1e')](function(_0x118ec8){return _0x118ec8;});}return null;};}function removeEntity(_0x358b76,_0x525dcc){return function(_0xe9acf4){if(_0xe9acf4){return _0xe9acf4['destroy']()['then'](function(){_0x358b76[_0xd761('0x16')](0xcc)[_0xd761('0x1f')]();});}};}function handleEntityNotFound(_0x5f2fce,_0x580e92){return function(_0x5d43e7){if(!_0x5d43e7){_0x5f2fce[_0xd761('0x15')](0x194);}return _0x5d43e7;};}function handleError(_0x5df780,_0x276b05){_0x276b05=_0x276b05||0x1f4;return function(_0x1ff3ec){logger[_0xd761('0x20')](_0x1ff3ec[_0xd761('0x21')]);if(_0x1ff3ec[_0xd761('0x22')]){delete _0x1ff3ec['name'];}_0x5df780['status'](_0x276b05)[_0xd761('0x23')](_0x1ff3ec);};}exports[_0xd761('0x24')]=function(_0xd45da,_0x14b3db){var _0x2bf4db={},_0x4e4e0f={},_0x17d04a={'count':0x0,'rows':[]};var _0x295ea2=_[_0xd761('0x25')](db[_0xd761('0x26')]['rawAttributes'],function(_0x5cc09d){return{'name':_0x5cc09d[_0xd761('0x27')],'type':_0x5cc09d[_0xd761('0x28')]['key']};});_0x4e4e0f['model']=_['differenceBy'](_[_0xd761('0x25')](_0x295ea2,_0xd761('0x22')),[_0xd761('0x22')]);_0x4e4e0f[_0xd761('0x29')]=_[_0xd761('0x2a')](_0xd45da['query']);_0x4e4e0f['filters']=_[_0xd761('0x2b')](_0x4e4e0f[_0xd761('0x2c')],_0x4e4e0f['query']);_0x2bf4db[_0xd761('0x2d')]=_[_0xd761('0x2b')](_0x4e4e0f[_0xd761('0x2c')],qs[_0xd761('0x2e')](_0xd45da[_0xd761('0x29')]['fields']));_0x2bf4db[_0xd761('0x2d')]=_0x2bf4db['attributes']['length']?_0x2bf4db[_0xd761('0x2d')]:_0x4e4e0f[_0xd761('0x2c')];if(!_0xd45da[_0xd761('0x29')][_0xd761('0x2f')](_0xd761('0x30'))){_0x2bf4db['limit']=qs['limit'](_0xd45da['query'][_0xd761('0x18')]);_0x2bf4db[_0xd761('0x17')]=qs[_0xd761('0x17')](_0xd45da[_0xd761('0x29')][_0xd761('0x17')]);}_0x2bf4db['order']=qs[_0xd761('0x31')](_0xd45da[_0xd761('0x29')][_0xd761('0x31')]);_0x2bf4db['where']=qs[_0xd761('0x32')](_[_0xd761('0x33')](_0xd45da[_0xd761('0x29')],_0x4e4e0f['filters']),_0x295ea2);if(_0xd45da[_0xd761('0x29')][_0xd761('0x34')]){_0x2bf4db['where']=_[_0xd761('0x35')](_0x2bf4db[_0xd761('0x36')],{'$or':_[_0xd761('0x25')](_0x295ea2,function(_0x37b6f4){if(_0x37b6f4[_0xd761('0x28')]!==_0xd761('0x37')){var _0x264c4c={};_0x264c4c[_0x37b6f4[_0xd761('0x22')]]={'$like':'%'+_0xd45da['query'][_0xd761('0x34')]+'%'};return _0x264c4c;}})});}_0x2bf4db=_[_0xd761('0x35')]({},_0x2bf4db,_0xd45da[_0xd761('0x38')]);var _0x5181bb={'where':_0x2bf4db[_0xd761('0x36')]};return db[_0xd761('0x26')][_0xd761('0x39')](_0x5181bb)[_0xd761('0x1e')](function(_0x11844e){_0x17d04a[_0xd761('0x39')]=_0x11844e;if(_0xd45da[_0xd761('0x29')]['includeAll']){_0x2bf4db[_0xd761('0x3a')]=[{'all':!![]}];}return db[_0xd761('0x26')][_0xd761('0x3b')](_0x2bf4db);})[_0xd761('0x1e')](function(_0x125f02){_0x17d04a[_0xd761('0x3c')]=_0x125f02;return _0x17d04a;})[_0xd761('0x1e')](respondWithFilteredResult(_0x14b3db,_0x2bf4db))['catch'](handleError(_0x14b3db,null));};exports[_0xd761('0x3d')]=function(_0x8ab4a1,_0x3fa8a7){var _0x107fff={'raw':!![],'where':{'id':_0x8ab4a1[_0xd761('0x3e')]['id']}},_0x2e841a={};_0x2e841a[_0xd761('0x2c')]=_[_0xd761('0x2a')](db[_0xd761('0x26')][_0xd761('0x3f')]);_0x2e841a[_0xd761('0x29')]=_['keys'](_0x8ab4a1[_0xd761('0x29')]);_0x2e841a[_0xd761('0x32')]=_[_0xd761('0x2b')](_0x2e841a[_0xd761('0x2c')],_0x2e841a[_0xd761('0x29')]);_0x107fff[_0xd761('0x2d')]=_[_0xd761('0x2b')](_0x2e841a[_0xd761('0x2c')],qs[_0xd761('0x2e')](_0x8ab4a1[_0xd761('0x29')][_0xd761('0x2e')]));_0x107fff[_0xd761('0x2d')]=_0x107fff['attributes'][_0xd761('0x40')]?_0x107fff[_0xd761('0x2d')]:_0x2e841a[_0xd761('0x2c')];if(_0x8ab4a1[_0xd761('0x29')][_0xd761('0x41')]){_0x107fff[_0xd761('0x3a')]=[{'all':!![]}];}_0x107fff=_['merge']({},_0x107fff,_0x8ab4a1['options']);return db[_0xd761('0x26')][_0xd761('0x42')](_0x107fff)[_0xd761('0x1e')](handleEntityNotFound(_0x3fa8a7,null))[_0xd761('0x1e')](respondWithResult(_0x3fa8a7,null))[_0xd761('0x43')](handleError(_0x3fa8a7,null));};exports['update']=function(_0x1f1dbf,_0x5d50e6){if(_0x1f1dbf['body']['id']){delete _0x1f1dbf['body']['id'];}return db['CmCustomField'][_0xd761('0x42')]({'where':{'id':_0x1f1dbf[_0xd761('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5d50e6,null))[_0xd761('0x1e')](saveUpdates(_0x1f1dbf['body'],null))[_0xd761('0x1e')](respondWithResult(_0x5d50e6,null))['catch'](handleError(_0x5d50e6,null));};exports['destroy']=function(_0x112710,_0x4f3d77){return db[_0xd761('0x26')][_0xd761('0x42')]({'where':{'id':_0x112710[_0xd761('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4f3d77,null))[_0xd761('0x1e')](removeEntity(_0x4f3d77,null))['catch'](handleError(_0x4f3d77,null));};exports[_0xd761('0x44')]=function(_0x5bb4ff,_0x32612b){var _0x617ed1;return db[_0xd761('0x45')][_0xd761('0x46')](function(_0x1094aa){return db[_0xd761('0x26')][_0xd761('0x44')](_0x5bb4ff[_0xd761('0x47')],{'transaction':_0x1094aa})[_0xd761('0x1e')](function(_0x36aa2c){_0x617ed1=_0x36aa2c;var _0x2e311e={'type':db[_0xd761('0x48')][_0xd761('0x49')],'transaction':_0x1094aa};switch(_0x5bb4ff['body']['type']){case'text':_0x2e311e[_0xd761('0x28')]=db[_0xd761('0x48')]['TEXT'];break;case _0xd761('0x4a'):_0x2e311e['type']=db[_0xd761('0x48')][_0xd761('0x4b')];break;case'switch':_0x2e311e['type']=db['Sequelize'][_0xd761('0x4c')];_0x2e311e[_0xd761('0x4d')]=![];break;default:}return db[_0xd761('0x45')][_0xd761('0x4e')][_0xd761('0x4f')](_0xd761('0x50'),util['format'](_0xd761('0x51'),_0x617ed1['id']),_0x2e311e);})[_0xd761('0x1e')](function(){return _0x617ed1;});})[_0xd761('0x1e')](respondWithResult(_0x32612b,0xc9))[_0xd761('0x43')](handleError(_0x32612b,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 2928090..01e48f6 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 _0x3c32=['./cmCustomField.attributes','exports','define','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x3c32,0x161));var _0x23c3=function(_0x292a5c,_0x347069){_0x292a5c=_0x292a5c-0x0;var _0x622795=_0x3c32[_0x292a5c];return _0x622795;};'use strict';var _=require(_0x23c3('0x0'));var util=require(_0x23c3('0x1'));var logger=require(_0x23c3('0x2'))('api');var moment=require(_0x23c3('0x3'));var BPromise=require(_0x23c3('0x4'));var rp=require(_0x23c3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x23c3('0x6'));var config=require('../../config/environment');var attributes=require(_0x23c3('0x7'));module[_0x23c3('0x8')]=function(_0x1ec17b,_0x190132){return _0x1ec17b[_0x23c3('0x9')]('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9db7=['define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','bluebird','path','rimraf','./cmCustomField.attributes','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9db7,0x1bf));var _0x79db=function(_0x5b30bf,_0x10b56a){_0x5b30bf=_0x5b30bf-0x0;var _0x260df4=_0x9db7[_0x5b30bf];return _0x260df4;};'use strict';var _=require(_0x79db('0x0'));var util=require(_0x79db('0x1'));var logger=require(_0x79db('0x2'))(_0x79db('0x3'));var moment=require('moment');var BPromise=require(_0x79db('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x79db('0x5'));var rimraf=require(_0x79db('0x6'));var config=require('../../config/environment');var attributes=require(_0x79db('0x7'));module[_0x79db('0x8')]=function(_0xfb8328,_0x45c9d1){return _0xfb8328[_0x79db('0x9')](_0x79db('0xa'),attributes,{'tableName':_0x79db('0xb'),'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 fa9b1e0..a36cf57 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 _0xb458=['CmCustomField,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','CmCustomField,\x20%s,\x20%s','debug'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xb458,0x103));var _0x8b45=function(_0xfb4365,_0xd18f10){_0xfb4365=_0xfb4365-0x0;var _0x109516=_0xb458[_0xfb4365];return _0x109516;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x3'));var db=require(_0x8b45('0x4'))['db'];var utils=require(_0x8b45('0x5'));var logger=require(_0x8b45('0x6'))('rpc');var config=require(_0x8b45('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8b45('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12bd05,_0x2daa9a,_0x3a8ccb){return new BPromise(function(_0x32342f,_0x4d1718){return client[_0x8b45('0x9')](_0x12bd05,_0x3a8ccb)[_0x8b45('0xa')](function(_0x33f30e){logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,'request\x20sent');logger[_0x8b45('0xd')](_0x8b45('0xe'),_0x2daa9a,'request\x20sent',JSON['stringify'](_0x33f30e));if(_0x33f30e['error']){if(_0x33f30e['error'][_0x8b45('0xf')]===0x1f4){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e['error'][_0x8b45('0x11')]);return _0x4d1718(_0x33f30e[_0x8b45('0x10')][_0x8b45('0x11')]);}logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e[_0x8b45('0x10')]['message']);return _0x32342f(_0x33f30e['error'][_0x8b45('0x11')]);}else{logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,_0x8b45('0x12'));_0x32342f(_0x33f30e[_0x8b45('0x13')][_0x8b45('0x11')]);}})[_0x8b45('0x14')](function(_0x147d6b){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x147d6b);_0x4d1718(_0x147d6b);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','CmCustomField,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x52ab92,_0x5d2fa9){var _0x1cd495=function(_0x5278ee){while(--_0x5278ee){_0x52ab92['push'](_0x52ab92['shift']());}};_0x1cd495(++_0x5d2fa9);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('CmCustomField,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('CmCustomField,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('CmCustomField,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 46b8a9e..3e4f171 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 _0x4c6a=['create','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','show','post'];(function(_0x201a14,_0x4f405f){var _0x257368=function(_0x283d13){while(--_0x283d13){_0x201a14['push'](_0x201a14['shift']());}};_0x257368(++_0x4f405f);}(_0x4c6a,0x173));var _0xa4c6=function(_0x3a79e8,_0xa1ddc9){_0x3a79e8=_0x3a79e8-0x0;var _0x4c71ee=_0x4c6a[_0x3a79e8];return _0x4c71ee;};'use strict';var multer=require(_0xa4c6('0x0'));var util=require(_0xa4c6('0x1'));var path=require(_0xa4c6('0x2'));var timeout=require(_0xa4c6('0x3'));var express=require(_0xa4c6('0x4'));var router=express[_0xa4c6('0x5')]();var auth=require(_0xa4c6('0x6'));var interaction=require(_0xa4c6('0x7'));var config=require('../../config/environment');var controller=require('./cmCustomField.controller');router['get']('/',auth[_0xa4c6('0x8')](),controller[_0xa4c6('0x9')]);router['get'](_0xa4c6('0xa'),auth[_0xa4c6('0x8')](),controller[_0xa4c6('0xb')]);router[_0xa4c6('0xc')]('/',auth[_0xa4c6('0x8')](),controller[_0xa4c6('0xd')]);router['put'](_0xa4c6('0xa'),auth[_0xa4c6('0x8')](),controller['update']);router['delete'](_0xa4c6('0xa'),auth[_0xa4c6('0x8')](),controller[_0xa4c6('0xe')]);module[_0xa4c6('0xf')]=router; \ No newline at end of file +var _0xf6d8=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','show','/:id'];(function(_0x568d9c,_0x27ec98){var _0x325480=function(_0x522596){while(--_0x522596){_0x568d9c['push'](_0x568d9c['shift']());}};_0x325480(++_0x27ec98);}(_0xf6d8,0x1ad));var _0x8f6d=function(_0x2bd85e,_0x58aaba){_0x2bd85e=_0x2bd85e-0x0;var _0x5829b0=_0xf6d8[_0x2bd85e];return _0x5829b0;};'use strict';var multer=require(_0x8f6d('0x0'));var util=require(_0x8f6d('0x1'));var path=require(_0x8f6d('0x2'));var timeout=require(_0x8f6d('0x3'));var express=require(_0x8f6d('0x4'));var router=express['Router']();var auth=require(_0x8f6d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8f6d('0x6'));var controller=require(_0x8f6d('0x7'));router[_0x8f6d('0x8')]('/',auth[_0x8f6d('0x9')](),controller[_0x8f6d('0xa')]);router[_0x8f6d('0x8')]('/:id',auth[_0x8f6d('0x9')](),controller[_0x8f6d('0xb')]);router['post']('/',auth[_0x8f6d('0x9')](),controller['create']);router['put'](_0x8f6d('0xc'),auth[_0x8f6d('0x9')](),controller[_0x8f6d('0xd')]);router[_0x8f6d('0xe')]('/:id',auth[_0x8f6d('0x9')](),controller[_0x8f6d('0xf')]);module[_0x8f6d('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 81bfa98..31fa118 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 _0x1261=['sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue'];(function(_0x4c6792,_0x247d32){var _0xb57e50=function(_0xeb6d84){while(--_0xeb6d84){_0x4c6792['push'](_0x4c6792['shift']());}};_0xb57e50(++_0x247d32);}(_0x1261,0x144));var _0x1126=function(_0x466af7,_0x2f7551){_0x466af7=_0x466af7-0x0;var _0x348c96=_0x1261[_0x466af7];return _0x348c96;};'use strict';var moment=require('moment');var Sequelize=require(_0x1126('0x0'));module[_0x1126('0x1')]={'phone':{'type':Sequelize[_0x1126('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x1126('0x4')],'defaultValue':moment()[_0x1126('0x5')](_0x1126('0x6'))},'countbusyretry':{'type':Sequelize[_0x1126('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1126('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1126('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1126('0x4')]},'priority':{'type':Sequelize[_0x1126('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x1126('0x7')],'unique':_0x1126('0x8')},'ListId':{'type':Sequelize[_0x1126('0x7')],'unique':_0x1126('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x1126('0x7')],'unique':_0x1126('0x8')},'CampaignId':{'type':Sequelize[_0x1126('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1126('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1126('0x7')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe2fe=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','UNSIGNED','contactListQueue','moment'];(function(_0xe7281f,_0x2d77c3){var _0x90dc99=function(_0x1e335b){while(--_0x1e335b){_0xe7281f['push'](_0xe7281f['shift']());}};_0x90dc99(++_0x2d77c3);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xee2f('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0xee2f('0x1')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xee2f('0x2')],'defaultValue':moment()[_0xee2f('0x3')](_0xee2f('0x4'))},'countbusyretry':{'type':Sequelize[_0xee2f('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xee2f('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xee2f('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xee2f('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xee2f('0x5')](0x2)[_0xee2f('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xee2f('0x5')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xee2f('0x5')],'unique':_0xee2f('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xee2f('0x5')],'unique':_0xee2f('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xee2f('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 0088ab8..17b15a5 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 _0xc7e4=['length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','params','rawAttributes','include','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','createdAt','updatedAt','state','statedesc','deleted','campaign','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','calleridname','firstName','CmHopperFinal','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','transaction','hopperIds','priority','ASC','scheduledAt','DESC','sequelize','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','Queue','dialActive','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','utcOffset','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','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','status','end','json','count','offset','limit','reject','update','then','destroy','stack','name','send','index','CmHopper','fieldName','type','key','model','map','keys','filters','query','concat','$or','$gt','$gte','$lt','$ne','$eq','$not','$between','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','attributes','intersection','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc7e4,0xde));var _0x4c7e=function(_0x41f7a1,_0x150c5c){_0x41f7a1=_0x41f7a1-0x0;var _0xc654bc=_0xc7e4[_0x41f7a1];return _0xc654bc;};'use strict';var pdf=require(_0x4c7e('0x0'));var emlformat=require(_0x4c7e('0x1'));var rimraf=require(_0x4c7e('0x2'));var zipdir=require(_0x4c7e('0x3'));var jsonpatch=require(_0x4c7e('0x4'));var rp=require(_0x4c7e('0x5'));var moment=require(_0x4c7e('0x6'));var BPromise=require(_0x4c7e('0x7'));var Mustache=require(_0x4c7e('0x8'));var util=require(_0x4c7e('0x9'));var path=require('path');var sox=require(_0x4c7e('0xa'));var csv=require(_0x4c7e('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4c7e('0xc'));var squel=require('squel');var crypto=require(_0x4c7e('0xd'));var jsforce=require(_0x4c7e('0xe'));var deskjs=require(_0x4c7e('0xf'));var toCsv=require(_0x4c7e('0xb'));var querystring=require(_0x4c7e('0x10'));var Papa=require(_0x4c7e('0x11'));var Redis=require(_0x4c7e('0x12'));var shared=require(_0x4c7e('0x13'));var authService=require(_0x4c7e('0x14'));var qs=require(_0x4c7e('0x15'));var as=require(_0x4c7e('0x16'));var hardwareService=require(_0x4c7e('0x17'));var logger=require(_0x4c7e('0x18'))(_0x4c7e('0x19'));var utils=require(_0x4c7e('0x1a'));var config=require(_0x4c7e('0x13'));var db=require(_0x4c7e('0x1b'))['db'];function respondWithStatusCode(_0x378614,_0x58aacc){_0x58aacc=_0x58aacc||0xcc;return function(_0x3fb67f){if(_0x3fb67f){return _0x378614['sendStatus'](_0x58aacc);}return _0x378614[_0x4c7e('0x1c')](_0x58aacc)[_0x4c7e('0x1d')]();};}function respondWithResult(_0x3ba066,_0x299cae){_0x299cae=_0x299cae||0xc8;return function(_0x2409f7){if(_0x2409f7){return _0x3ba066['status'](_0x299cae)[_0x4c7e('0x1e')](_0x2409f7);}};}function respondWithFilteredResult(_0x354d11,_0x1f6a3b){return function(_0x5734e2){if(_0x5734e2){var _0x19c8ef=_0x5734e2[_0x4c7e('0x1f')],_0x1db22b=_0x1f6a3b[_0x4c7e('0x20')],_0x4c55ac=_0x1f6a3b[_0x4c7e('0x20')]+_0x1f6a3b[_0x4c7e('0x21')],_0x102d81;if(_0x4c55ac>=_0x19c8ef){_0x4c55ac=_0x19c8ef;_0x102d81=0xc8;}else{_0x102d81=0xce;}_0x354d11[_0x4c7e('0x1c')](_0x102d81);return _0x354d11['set']('Content-Range',_0x1db22b+'-'+_0x4c55ac+'/'+_0x19c8ef)[_0x4c7e('0x1e')](_0x5734e2);}return null;};}function patchUpdates(_0x5817b3){return function(_0x431661){try{jsonpatch['apply'](_0x431661,_0x5817b3,!![]);}catch(_0x4e2f47){return BPromise[_0x4c7e('0x22')](_0x4e2f47);}return _0x431661['save']();};}function saveUpdates(_0x1b52c0,_0x2abe12){return function(_0x1d74d3){if(_0x1d74d3){return _0x1d74d3[_0x4c7e('0x23')](_0x1b52c0)[_0x4c7e('0x24')](function(_0xd5b28d){return _0xd5b28d;});}return null;};}function removeEntity(_0x305f78,_0x2b50d4){return function(_0x438060){if(_0x438060){return _0x438060[_0x4c7e('0x25')]()[_0x4c7e('0x24')](function(){_0x305f78[_0x4c7e('0x1c')](0xcc)[_0x4c7e('0x1d')]();});}};}function handleEntityNotFound(_0x35ff45,_0x32d9c3){return function(_0x3b7809){if(!_0x3b7809){_0x35ff45['sendStatus'](0x194);}return _0x3b7809;};}function handleError(_0x440606,_0x1fb4ad){_0x1fb4ad=_0x1fb4ad||0x1f4;return function(_0x1acb38){logger['error'](_0x1acb38[_0x4c7e('0x26')]);if(_0x1acb38[_0x4c7e('0x27')]){delete _0x1acb38[_0x4c7e('0x27')];}_0x440606[_0x4c7e('0x1c')](_0x1fb4ad)[_0x4c7e('0x28')](_0x1acb38);};}exports[_0x4c7e('0x29')]=function(_0x5779f8,_0x43aa0b){var _0x30245f={},_0x5dbdd7={},_0x24ea14={'count':0x0,'rows':[]};var _0x597b5a=_['map'](db[_0x4c7e('0x2a')]['rawAttributes'],function(_0x41853e){return{'name':_0x41853e[_0x4c7e('0x2b')],'type':_0x41853e[_0x4c7e('0x2c')][_0x4c7e('0x2d')]};});_0x5dbdd7[_0x4c7e('0x2e')]=_[_0x4c7e('0x2f')](_0x597b5a,_0x4c7e('0x27'));_0x5dbdd7['query']=_[_0x4c7e('0x30')](_0x5779f8['query']);_0x5dbdd7[_0x4c7e('0x31')]=_['intersection'](_0x5dbdd7[_0x4c7e('0x2e')],_0x5dbdd7[_0x4c7e('0x32')]);_0x5dbdd7['filters']=_[_0x4c7e('0x33')](_0x5dbdd7[_0x4c7e('0x31')],['$and',_0x4c7e('0x34'),_0x4c7e('0x35'),_0x4c7e('0x36'),_0x4c7e('0x37'),'$lte',_0x4c7e('0x38'),_0x4c7e('0x39'),_0x4c7e('0x3a'),_0x4c7e('0x3b'),_0x4c7e('0x3c'),_0x4c7e('0x3d'),'$notIn',_0x4c7e('0x3e'),_0x4c7e('0x3f'),_0x4c7e('0x40'),_0x4c7e('0x41'),_0x4c7e('0x3e'),_0x4c7e('0x42'),'$contains',_0x4c7e('0x43'),_0x4c7e('0x44')]);_0x30245f[_0x4c7e('0x45')]=_[_0x4c7e('0x46')](_0x5dbdd7[_0x4c7e('0x2e')],qs[_0x4c7e('0x47')](_0x5779f8['query'][_0x4c7e('0x47')]));_0x30245f['attributes']=_0x30245f['attributes'][_0x4c7e('0x48')]?_0x30245f[_0x4c7e('0x45')]:_0x5dbdd7[_0x4c7e('0x2e')];if(!_0x5779f8['query']['hasOwnProperty'](_0x4c7e('0x49'))){_0x30245f['limit']=qs[_0x4c7e('0x21')](_0x5779f8[_0x4c7e('0x32')][_0x4c7e('0x21')]);_0x30245f[_0x4c7e('0x20')]=qs[_0x4c7e('0x20')](_0x5779f8[_0x4c7e('0x32')][_0x4c7e('0x20')]);}_0x30245f['order']=qs[_0x4c7e('0x4a')](_0x5779f8[_0x4c7e('0x32')][_0x4c7e('0x4a')]);_0x30245f[_0x4c7e('0x4b')]=qs['filters'](_[_0x4c7e('0x4c')](_0x5779f8[_0x4c7e('0x32')],_0x5dbdd7[_0x4c7e('0x31')]),_0x597b5a);if(_0x5779f8[_0x4c7e('0x32')]['filter']){_0x30245f[_0x4c7e('0x4b')]=_[_0x4c7e('0x4d')](_0x30245f[_0x4c7e('0x4b')],{'$or':_[_0x4c7e('0x2f')](_0x597b5a,function(_0x53ad88){if(_0x53ad88[_0x4c7e('0x2c')]!==_0x4c7e('0x4e')){var _0x17a3ef={};_0x17a3ef[_0x53ad88[_0x4c7e('0x27')]]={'$like':'%'+_0x5779f8[_0x4c7e('0x32')][_0x4c7e('0x4f')]+'%'};return _0x17a3ef;}})});}_0x30245f=_[_0x4c7e('0x4d')]({},_0x30245f,_0x5779f8[_0x4c7e('0x50')]);var _0x848eb6={'where':_0x30245f[_0x4c7e('0x4b')]};return db['CmHopper']['count'](_0x848eb6)[_0x4c7e('0x24')](function(_0x4e136b){_0x24ea14[_0x4c7e('0x1f')]=_0x4e136b;if(_0x5779f8[_0x4c7e('0x32')][_0x4c7e('0x51')]){_0x30245f['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x30245f);})['then'](function(_0x4b42b6){_0x24ea14[_0x4c7e('0x52')]=_0x4b42b6;return _0x24ea14;})['then'](respondWithFilteredResult(_0x43aa0b,_0x30245f))[_0x4c7e('0x53')](handleError(_0x43aa0b,null));};exports['show']=function(_0x50b237,_0x4c35a9){var _0x46caec={'raw':!![],'where':{'id':_0x50b237[_0x4c7e('0x54')]['id']}},_0x4cbfa2={};_0x4cbfa2['model']=_['keys'](db['CmHopper'][_0x4c7e('0x55')]);_0x4cbfa2[_0x4c7e('0x32')]=_[_0x4c7e('0x30')](_0x50b237['query']);_0x4cbfa2[_0x4c7e('0x31')]=_['intersection'](_0x4cbfa2['model'],_0x4cbfa2[_0x4c7e('0x32')]);_0x46caec[_0x4c7e('0x45')]=_[_0x4c7e('0x46')](_0x4cbfa2[_0x4c7e('0x2e')],qs['fields'](_0x50b237[_0x4c7e('0x32')][_0x4c7e('0x47')]));_0x46caec[_0x4c7e('0x45')]=_0x46caec[_0x4c7e('0x45')][_0x4c7e('0x48')]?_0x46caec[_0x4c7e('0x45')]:_0x4cbfa2['model'];if(_0x50b237[_0x4c7e('0x32')][_0x4c7e('0x51')]){_0x46caec[_0x4c7e('0x56')]=[{'all':!![]}];}_0x46caec=_[_0x4c7e('0x4d')]({},_0x46caec,_0x50b237[_0x4c7e('0x50')]);return db['CmHopper'][_0x4c7e('0x57')](_0x46caec)[_0x4c7e('0x24')](handleEntityNotFound(_0x4c35a9,null))['then'](respondWithResult(_0x4c35a9,null))[_0x4c7e('0x53')](handleError(_0x4c35a9,null));};exports['create']=function(_0x30186c,_0x2b7edb){return db[_0x4c7e('0x2a')][_0x4c7e('0x58')](_0x30186c[_0x4c7e('0x59')],{})[_0x4c7e('0x24')](respondWithResult(_0x2b7edb,0xc9))[_0x4c7e('0x53')](handleError(_0x2b7edb,null));};exports[_0x4c7e('0x23')]=function(_0x4ac611,_0x161ee4){if(_0x4ac611[_0x4c7e('0x59')]['id']){delete _0x4ac611[_0x4c7e('0x59')]['id'];}return db[_0x4c7e('0x2a')][_0x4c7e('0x57')]({'where':{'id':_0x4ac611[_0x4c7e('0x54')]['id']}})['then'](handleEntityNotFound(_0x161ee4,null))[_0x4c7e('0x24')](saveUpdates(_0x4ac611[_0x4c7e('0x59')],null))[_0x4c7e('0x24')](respondWithResult(_0x161ee4,null))[_0x4c7e('0x53')](handleError(_0x161ee4,null));};exports[_0x4c7e('0x5a')]=function(_0x2f2a38,_0x1bec5a){return db[_0x4c7e('0x2a')]['describe']()['then'](respondWithResult(_0x1bec5a,null))[_0x4c7e('0x53')](handleError(_0x1bec5a,null));};exports['destroy']=function(_0x436afa,_0x23b71f){var _0x37fb74;return db[_0x4c7e('0x2a')][_0x4c7e('0x57')]({'where':{'id':_0x436afa[_0x4c7e('0x54')]['id']}})[_0x4c7e('0x24')](handleEntityNotFound(_0x23b71f,null))[_0x4c7e('0x24')](function(_0x576dbf){if(_0x576dbf){return _0x576dbf[_0x4c7e('0x25')]()['then'](function(_0x5a7868){return _0x5a7868;});}})[_0x4c7e('0x24')](function(_0x21da24){_0x37fb74=_0x21da24;if(_0x21da24){if(_0x21da24[_0x4c7e('0x5b')]||_0x21da24[_0x4c7e('0x5c')]){return db[_0x21da24[_0x4c7e('0x5b')]?_0x4c7e('0x5d'):_0x4c7e('0x5e')]['find']({'where':{'id':_0x21da24[_0x4c7e('0x5b')]?_0x21da24[_0x4c7e('0x5b')]:_0x21da24[_0x4c7e('0x5c')]},'attributes':['id',_0x4c7e('0x27')],'raw':!![]});}}})[_0x4c7e('0x24')](function(_0x2d61a6){var _0x574d75={};if(_0x2d61a6){_[_0x4c7e('0x4d')](_0x574d75,_['omit'](_0x37fb74['dataValues'],[_0x4c7e('0x5f'),_0x4c7e('0x60'),'id']));_0x574d75[_0x4c7e('0x61')]=0x15;_0x574d75[_0x4c7e('0x62')]=_0x4c7e('0x63');_0x574d75[_0x4c7e('0x64')]=_0x2d61a6[_0x4c7e('0x27')];_0x574d75['membername']=_0x436afa[_0x4c7e('0x65')][_0x4c7e('0x27')];_0x574d75[_0x4c7e('0x66')]=_0x436afa[_0x4c7e('0x65')]['id'];_0x574d75[_0x4c7e('0x63')]=!![];_0x574d75[_0x4c7e('0x67')]=moment()[_0x4c7e('0x68')](_0x4c7e('0x69'));_0x574d75['calleridnum']=_0x37fb74[_0x4c7e('0x6a')];_0x574d75[_0x4c7e('0x6b')]=_0x37fb74[_0x4c7e('0x5b')]?_0x4c7e('0x6c'):_0x4c7e('0x6d');return db[_0x4c7e('0x6e')][_0x4c7e('0x57')]({'where':{'id':_0x574d75[_0x4c7e('0x6f')]},'attributes':['firstName',_0x4c7e('0x70')]})[_0x4c7e('0x24')](function(_0x7b3c81){if(!_[_0x4c7e('0x71')](_0x23b71f)&&!_[_0x4c7e('0x71')](_0x7b3c81['firstName'])){_0x574d75[_0x4c7e('0x72')]=_0x7b3c81[_0x4c7e('0x73')];if(!_[_0x4c7e('0x71')](_0x7b3c81[_0x4c7e('0x70')])){_0x574d75[_0x4c7e('0x72')]+='\x20'+_0x7b3c81['lastName'];}}})['finally'](function(){return db[_0x4c7e('0x74')]['create'](_0x574d75);});}})['then'](function(){return _0x23b71f[_0x4c7e('0x1c')](0xcc)['end']();})[_0x4c7e('0x53')](handleError(_0x23b71f,null));};exports['getPreview']=function(_0x1365c8,_0x431368,_0x269539){var _0x4ac280=[];return db[_0x4c7e('0x6e')]['describe']()[_0x4c7e('0x24')](function(_0x160381){_0x4ac280=_[_0x4c7e('0x30')](_0x160381);return _0x1365c8['user'][_0x4c7e('0x75')]({'where':{'type':_0x4c7e('0x76'),'dialActive':!![],'dialMethod':_0x4c7e('0x77')},'attributes':['id',_0x4c7e('0x78')],'raw':!![]});})[_0x4c7e('0x24')](function(_0x2324e5){if(_0x2324e5&&_0x2324e5['length']){return db['sequelize'][_0x4c7e('0x79')](function(_0x19437e){var _0x3eae6b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x4c7e('0x69'))},'VoiceQueueId':{'$in':_['map'](_0x2324e5,'id')},'$or':[{'UserId':null},{'UserId':_0x1365c8['user']['id']}]};var _0x4c4079=[];if(_0x1365c8[_0x4c7e('0x59')]['direction']&&_0x1365c8[_0x4c7e('0x59')]['direction']==='prev'){if(!_['isEmpty'](_0x1365c8['body'][_0x4c7e('0x7a')])){_0x3eae6b['id']={'$in':_0x1365c8['body']['hopperIds']};}_0x4c4079=[[_0x4c7e('0x7b'),_0x4c7e('0x7c')],[_0x4c7e('0x7d'),_0x2324e5[0x0][_0x4c7e('0x78')]==='ASC'?_0x4c7e('0x7e'):_0x4c7e('0x7c')],db[_0x4c7e('0x7f')]['literal'](_0x4c7e('0x80')),['id',_0x4c7e('0x7e')]];}else{if(!_['isEmpty'](_0x1365c8['body']['hopperIds'])){_0x3eae6b['id']={'$notIn':_0x1365c8['body'][_0x4c7e('0x7a')]};}_0x4c4079=[[_0x4c7e('0x7b'),_0x4c7e('0x7e')],[_0x4c7e('0x7d'),_0x2324e5[0x0][_0x4c7e('0x78')]],db[_0x4c7e('0x7f')]['literal'](_0x4c7e('0x81')),['id','ASC']];}return db[_0x4c7e('0x2a')][_0x4c7e('0x82')]({'attributes':['id',_0x4c7e('0x83')],'where':_0x3eae6b,'order':_0x4c4079,'transaction':_0x19437e,'lock':_0x19437e[_0x4c7e('0x84')][_0x4c7e('0x85')],'include':[{'model':db[_0x4c7e('0x6e')],'as':_0x4c7e('0x86'),'attributes':_0x4ac280,'include':[{'model':db[_0x4c7e('0x87')],'as':_0x4c7e('0x88'),'attributes':['id',_0x4c7e('0x27')]}]},{'model':db[_0x4c7e('0x89')],'as':'List','attributes':['id',_0x4c7e('0x27')]},{'model':db['VoiceQueue'],'as':_0x4c7e('0x8a'),'attributes':['id',_0x4c7e('0x27'),_0x4c7e('0x8b')]}]})['then'](function(_0x302ee9){if(_0x302ee9){return _0x302ee9[_0x4c7e('0x23')]({'UserId':_0x1365c8[_0x4c7e('0x65')]['id']},{'transaction':_0x19437e});}});});}})[_0x4c7e('0x24')](handleEntityNotFound(_0x431368,null))[_0x4c7e('0x24')](respondWithResult(_0x431368,null))[_0x4c7e('0x53')](handleError(_0x431368,null));};exports['getOpenContacts']=function(_0x171ed1,_0x3e14d4,_0x5be984){return _0x171ed1['user'][_0x4c7e('0x75')]({'where':{'type':_0x4c7e('0x76'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x4c7e('0x24')](function(_0x3dbb62){if(_0x3dbb62&&_0x3dbb62['length']){return db[_0x4c7e('0x2a')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x4c7e('0x68')](_0x4c7e('0x69'))},'VoiceQueueId':{'$in':_[_0x4c7e('0x2f')](_0x3dbb62,'id')},'$or':[{'UserId':null},{'UserId':_0x171ed1[_0x4c7e('0x65')]['id']}]}});}return 0x0;})[_0x4c7e('0x24')](function(_0x1ab7d8){if(!_[_0x4c7e('0x71')](_0x1ab7d8)&&_[_0x4c7e('0x8c')](_0x1ab7d8)){return _0x3e14d4[_0x4c7e('0x1c')](0xc8)['json']({'contacts':_0x1ab7d8});}else{logger[_0x4c7e('0x8d')](_0x4c7e('0x8e'),_0x4c7e('0x8f'),0x194,_0x4c7e('0x90'));_0x3e14d4['sendStatus'](0x194);}})[_0x4c7e('0x53')](handleError(_0x3e14d4,null));};exports[_0x4c7e('0x91')]=function(_0x785795,_0x58a0d9,_0x4f3e87){var _0x20c856=shared['timezones'];var _0x21e4e6=[];_[_0x4c7e('0x2f')](_0x20c856,function(_0xbb2a92){_0x21e4e6['push']({'id':_0xbb2a92['name'],'name':_0xbb2a92['name'],'utcOffset':_0xbb2a92[_0x4c7e('0x92')]});});return _0x58a0d9[_0x4c7e('0x1c')](0xc8)[_0x4c7e('0x1e')]({'tz':_0x21e4e6});};exports['getTimezone']=function(_0x3b1c5e,_0x11dc51,_0x3b47bd){var _0x593967=shared['timezones'];var _0x1b0b5f={};if(!_[_0x4c7e('0x71')](_0x593967[_0x3b1c5e[_0x4c7e('0x59')]['id']]))_0x1b0b5f=_0x593967[_0x3b1c5e[_0x4c7e('0x59')]['id']];return _0x11dc51[_0x4c7e('0x1c')](0xc8)['json'](_0x1b0b5f);}; \ No newline at end of file +var _0x22ea=['Queue','dialActive','getOpenContacts','outbound','preview','CmHopper,\x20%s,\x20%s,\x20%s','getTimezones','timezones','push','utcOffset','getTimezone','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/environment','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','reject','save','update','destroy','then','error','name','map','rawAttributes','type','key','query','filters','model','concat','$and','$or','$gt','$gte','$lt','$lte','$eq','$not','$between','$notBetween','$notIn','$like','$iLike','$notILike','$contains','$contained','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','CmHopper','includeAll','include','findAll','rows','catch','show','params','keys','fields','options','create','body','describe','find','VoiceQueueId','CampaignId','Campaign','omit','dataValues','updatedAt','statedesc','campaign','membername','user','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','firstName','isNil','calleridname','finally','getPreview','getVoiceQueues','dialOrderByScheduledAt','sequelize','direction','isEmpty','hopperIds','priority','scheduledAt','ASC','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','Contact','CmCompany','CmList','List'];(function(_0x264ec6,_0xe93945){var _0x425cde=function(_0x25450c){while(--_0x25450c){_0x264ec6['push'](_0x264ec6['shift']());}};_0x425cde(++_0xe93945);}(_0x22ea,0xa1));var _0xa22e=function(_0x9be508,_0x10c8ba){_0x9be508=_0x9be508-0x0;var _0x16f3c3=_0x22ea[_0x9be508];return _0x16f3c3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa22e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa22e('0x1'));var jsonpatch=require(_0xa22e('0x2'));var rp=require(_0xa22e('0x3'));var moment=require(_0xa22e('0x4'));var BPromise=require(_0xa22e('0x5'));var Mustache=require(_0xa22e('0x6'));var util=require(_0xa22e('0x7'));var path=require(_0xa22e('0x8'));var sox=require(_0xa22e('0x9'));var csv=require('to-csv');var ejs=require(_0xa22e('0xa'));var fs=require('fs');var _=require(_0xa22e('0xb'));var squel=require(_0xa22e('0xc'));var crypto=require('crypto');var jsforce=require(_0xa22e('0xd'));var deskjs=require(_0xa22e('0xe'));var toCsv=require(_0xa22e('0xf'));var querystring=require(_0xa22e('0x10'));var Papa=require(_0xa22e('0x11'));var Redis=require(_0xa22e('0x12'));var shared=require(_0xa22e('0x13'));var authService=require(_0xa22e('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xa22e('0x15'));var hardwareService=require(_0xa22e('0x16'));var logger=require(_0xa22e('0x17'))(_0xa22e('0x18'));var utils=require('../../config/utils');var config=require(_0xa22e('0x13'));var db=require(_0xa22e('0x19'))['db'];function respondWithStatusCode(_0x2e06a6,_0x5e9dab){_0x5e9dab=_0x5e9dab||0xcc;return function(_0x4dcd03){if(_0x4dcd03){return _0x2e06a6[_0xa22e('0x1a')](_0x5e9dab);}return _0x2e06a6[_0xa22e('0x1b')](_0x5e9dab)[_0xa22e('0x1c')]();};}function respondWithResult(_0x2b8b84,_0x13a8b9){_0x13a8b9=_0x13a8b9||0xc8;return function(_0x6747d1){if(_0x6747d1){return _0x2b8b84[_0xa22e('0x1b')](_0x13a8b9)['json'](_0x6747d1);}};}function respondWithFilteredResult(_0x197fc2,_0x594c1e){return function(_0x524dd7){if(_0x524dd7){var _0x10dd4a=_0x524dd7[_0xa22e('0x1d')],_0xe08a09=_0x594c1e['offset'],_0x10539b=_0x594c1e[_0xa22e('0x1e')]+_0x594c1e[_0xa22e('0x1f')],_0x3127f0;if(_0x10539b>=_0x10dd4a){_0x10539b=_0x10dd4a;_0x3127f0=0xc8;}else{_0x3127f0=0xce;}_0x197fc2[_0xa22e('0x1b')](_0x3127f0);return _0x197fc2[_0xa22e('0x20')]('Content-Range',_0xe08a09+'-'+_0x10539b+'/'+_0x10dd4a)[_0xa22e('0x21')](_0x524dd7);}return null;};}function patchUpdates(_0x48af2d){return function(_0x29b8a8){try{jsonpatch['apply'](_0x29b8a8,_0x48af2d,!![]);}catch(_0x1ea3dc){return BPromise[_0xa22e('0x22')](_0x1ea3dc);}return _0x29b8a8[_0xa22e('0x23')]();};}function saveUpdates(_0x13ceb1,_0x531ba2){return function(_0x53c630){if(_0x53c630){return _0x53c630[_0xa22e('0x24')](_0x13ceb1)['then'](function(_0x4b3a95){return _0x4b3a95;});}return null;};}function removeEntity(_0x5e7c3e,_0x20b1bc){return function(_0x34b937){if(_0x34b937){return _0x34b937[_0xa22e('0x25')]()[_0xa22e('0x26')](function(){_0x5e7c3e['status'](0xcc)[_0xa22e('0x1c')]();});}};}function handleEntityNotFound(_0x59ad00,_0xf71006){return function(_0x305ce1){if(!_0x305ce1){_0x59ad00[_0xa22e('0x1a')](0x194);}return _0x305ce1;};}function handleError(_0x4fceea,_0x3f1a6a){_0x3f1a6a=_0x3f1a6a||0x1f4;return function(_0x23046a){logger[_0xa22e('0x27')](_0x23046a['stack']);if(_0x23046a[_0xa22e('0x28')]){delete _0x23046a[_0xa22e('0x28')];}_0x4fceea[_0xa22e('0x1b')](_0x3f1a6a)['send'](_0x23046a);};}exports['index']=function(_0x24809a,_0x2be853){var _0x3940b0={},_0x2c854a={},_0xce2a26={'count':0x0,'rows':[]};var _0x2ff235=_[_0xa22e('0x29')](db['CmHopper'][_0xa22e('0x2a')],function(_0x29d75b){return{'name':_0x29d75b['fieldName'],'type':_0x29d75b[_0xa22e('0x2b')][_0xa22e('0x2c')]};});_0x2c854a['model']=_[_0xa22e('0x29')](_0x2ff235,_0xa22e('0x28'));_0x2c854a[_0xa22e('0x2d')]=_['keys'](_0x24809a[_0xa22e('0x2d')]);_0x2c854a[_0xa22e('0x2e')]=_['intersection'](_0x2c854a[_0xa22e('0x2f')],_0x2c854a[_0xa22e('0x2d')]);_0x2c854a[_0xa22e('0x2e')]=_[_0xa22e('0x30')](_0x2c854a[_0xa22e('0x2e')],[_0xa22e('0x31'),_0xa22e('0x32'),_0xa22e('0x33'),_0xa22e('0x34'),_0xa22e('0x35'),_0xa22e('0x36'),'$ne',_0xa22e('0x37'),_0xa22e('0x38'),_0xa22e('0x39'),_0xa22e('0x3a'),'$in',_0xa22e('0x3b'),_0xa22e('0x3c'),'$notLike',_0xa22e('0x3d'),_0xa22e('0x3e'),'$like','$overlap',_0xa22e('0x3f'),_0xa22e('0x40'),'$any']);_0x3940b0[_0xa22e('0x41')]=_[_0xa22e('0x42')](_0x2c854a['model'],qs['fields'](_0x24809a['query']['fields']));_0x3940b0[_0xa22e('0x41')]=_0x3940b0[_0xa22e('0x41')][_0xa22e('0x43')]?_0x3940b0['attributes']:_0x2c854a['model'];if(!_0x24809a['query'][_0xa22e('0x44')](_0xa22e('0x45'))){_0x3940b0[_0xa22e('0x1f')]=qs['limit'](_0x24809a[_0xa22e('0x2d')][_0xa22e('0x1f')]);_0x3940b0[_0xa22e('0x1e')]=qs[_0xa22e('0x1e')](_0x24809a[_0xa22e('0x2d')][_0xa22e('0x1e')]);}_0x3940b0[_0xa22e('0x46')]=qs[_0xa22e('0x47')](_0x24809a[_0xa22e('0x2d')]['sort']);_0x3940b0['where']=qs[_0xa22e('0x2e')](_[_0xa22e('0x48')](_0x24809a[_0xa22e('0x2d')],_0x2c854a[_0xa22e('0x2e')]),_0x2ff235);if(_0x24809a['query'][_0xa22e('0x49')]){_0x3940b0['where']=_[_0xa22e('0x4a')](_0x3940b0[_0xa22e('0x4b')],{'$or':_['map'](_0x2ff235,function(_0x40ee8f){if(_0x40ee8f['type']!==_0xa22e('0x4c')){var _0x1e17fc={};_0x1e17fc[_0x40ee8f[_0xa22e('0x28')]]={'$like':'%'+_0x24809a[_0xa22e('0x2d')][_0xa22e('0x49')]+'%'};return _0x1e17fc;}})});}_0x3940b0=_[_0xa22e('0x4a')]({},_0x3940b0,_0x24809a['options']);var _0x24521f={'where':_0x3940b0[_0xa22e('0x4b')]};return db[_0xa22e('0x4d')][_0xa22e('0x1d')](_0x24521f)[_0xa22e('0x26')](function(_0x5f529a){_0xce2a26[_0xa22e('0x1d')]=_0x5f529a;if(_0x24809a[_0xa22e('0x2d')][_0xa22e('0x4e')]){_0x3940b0[_0xa22e('0x4f')]=[{'all':!![]}];}return db[_0xa22e('0x4d')][_0xa22e('0x50')](_0x3940b0);})['then'](function(_0x53402d){_0xce2a26[_0xa22e('0x51')]=_0x53402d;return _0xce2a26;})[_0xa22e('0x26')](respondWithFilteredResult(_0x2be853,_0x3940b0))[_0xa22e('0x52')](handleError(_0x2be853,null));};exports[_0xa22e('0x53')]=function(_0x35eca9,_0x5c4eee){var _0x5c7190={'raw':!![],'where':{'id':_0x35eca9[_0xa22e('0x54')]['id']}},_0x311ae2={};_0x311ae2[_0xa22e('0x2f')]=_[_0xa22e('0x55')](db[_0xa22e('0x4d')]['rawAttributes']);_0x311ae2['query']=_[_0xa22e('0x55')](_0x35eca9[_0xa22e('0x2d')]);_0x311ae2[_0xa22e('0x2e')]=_['intersection'](_0x311ae2[_0xa22e('0x2f')],_0x311ae2[_0xa22e('0x2d')]);_0x5c7190[_0xa22e('0x41')]=_[_0xa22e('0x42')](_0x311ae2[_0xa22e('0x2f')],qs[_0xa22e('0x56')](_0x35eca9[_0xa22e('0x2d')][_0xa22e('0x56')]));_0x5c7190['attributes']=_0x5c7190[_0xa22e('0x41')][_0xa22e('0x43')]?_0x5c7190['attributes']:_0x311ae2[_0xa22e('0x2f')];if(_0x35eca9[_0xa22e('0x2d')][_0xa22e('0x4e')]){_0x5c7190[_0xa22e('0x4f')]=[{'all':!![]}];}_0x5c7190=_[_0xa22e('0x4a')]({},_0x5c7190,_0x35eca9[_0xa22e('0x57')]);return db[_0xa22e('0x4d')]['find'](_0x5c7190)[_0xa22e('0x26')](handleEntityNotFound(_0x5c4eee,null))[_0xa22e('0x26')](respondWithResult(_0x5c4eee,null))['catch'](handleError(_0x5c4eee,null));};exports['create']=function(_0x249c4f,_0x4a0151){return db[_0xa22e('0x4d')][_0xa22e('0x58')](_0x249c4f[_0xa22e('0x59')],{})[_0xa22e('0x26')](respondWithResult(_0x4a0151,0xc9))[_0xa22e('0x52')](handleError(_0x4a0151,null));};exports[_0xa22e('0x24')]=function(_0x1a8021,_0x11b42b){if(_0x1a8021[_0xa22e('0x59')]['id']){delete _0x1a8021[_0xa22e('0x59')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x1a8021[_0xa22e('0x54')]['id']}})['then'](handleEntityNotFound(_0x11b42b,null))['then'](saveUpdates(_0x1a8021[_0xa22e('0x59')],null))['then'](respondWithResult(_0x11b42b,null))[_0xa22e('0x52')](handleError(_0x11b42b,null));};exports[_0xa22e('0x5a')]=function(_0x3613e2,_0x3f3b3e){return db[_0xa22e('0x4d')]['describe']()['then'](respondWithResult(_0x3f3b3e,null))[_0xa22e('0x52')](handleError(_0x3f3b3e,null));};exports[_0xa22e('0x25')]=function(_0x3a25ff,_0x269840){var _0x22b6a7;return db['CmHopper'][_0xa22e('0x5b')]({'where':{'id':_0x3a25ff[_0xa22e('0x54')]['id']}})[_0xa22e('0x26')](handleEntityNotFound(_0x269840,null))[_0xa22e('0x26')](function(_0xa8a269){if(_0xa8a269){return _0xa8a269['destroy']()[_0xa22e('0x26')](function(_0x4c9e5b){return _0x4c9e5b;});}})[_0xa22e('0x26')](function(_0x15578e){_0x22b6a7=_0x15578e;if(_0x15578e){if(_0x15578e[_0xa22e('0x5c')]||_0x15578e[_0xa22e('0x5d')]){return db[_0x15578e[_0xa22e('0x5c')]?'VoiceQueue':_0xa22e('0x5e')]['find']({'where':{'id':_0x15578e[_0xa22e('0x5c')]?_0x15578e[_0xa22e('0x5c')]:_0x15578e[_0xa22e('0x5d')]},'attributes':['id',_0xa22e('0x28')],'raw':!![]});}}})[_0xa22e('0x26')](function(_0x3b20d1){var _0x4b999a={};if(_0x3b20d1){_[_0xa22e('0x4a')](_0x4b999a,_[_0xa22e('0x5f')](_0x22b6a7[_0xa22e('0x60')],['createdAt',_0xa22e('0x61'),'id']));_0x4b999a['state']=0x15;_0x4b999a[_0xa22e('0x62')]='deleted';_0x4b999a[_0xa22e('0x63')]=_0x3b20d1['name'];_0x4b999a[_0xa22e('0x64')]=_0x3a25ff[_0xa22e('0x65')][_0xa22e('0x28')];_0x4b999a['UserId']=_0x3a25ff['user']['id'];_0x4b999a[_0xa22e('0x66')]=!![];_0x4b999a[_0xa22e('0x67')]=moment()[_0xa22e('0x68')](_0xa22e('0x69'));_0x4b999a[_0xa22e('0x6a')]=_0x22b6a7[_0xa22e('0x6b')];_0x4b999a[_0xa22e('0x6c')]=_0x22b6a7[_0xa22e('0x5c')]?_0xa22e('0x6d'):_0xa22e('0x6e');return db[_0xa22e('0x6f')]['find']({'where':{'id':_0x4b999a[_0xa22e('0x70')]},'attributes':['firstName',_0xa22e('0x71')]})[_0xa22e('0x26')](function(_0x3c514c){if(!_['isNil'](_0x269840)&&!_['isNil'](_0x3c514c[_0xa22e('0x72')])){_0x4b999a['calleridname']=_0x3c514c['firstName'];if(!_[_0xa22e('0x73')](_0x3c514c[_0xa22e('0x71')])){_0x4b999a[_0xa22e('0x74')]+='\x20'+_0x3c514c[_0xa22e('0x71')];}}})[_0xa22e('0x75')](function(){return db['CmHopperFinal']['create'](_0x4b999a);});}})[_0xa22e('0x26')](function(){return _0x269840[_0xa22e('0x1b')](0xcc)[_0xa22e('0x1c')]();})[_0xa22e('0x52')](handleError(_0x269840,null));};exports[_0xa22e('0x76')]=function(_0x3f7b54,_0x320666,_0x4459fb){var _0x28297b=[];return db[_0xa22e('0x6f')][_0xa22e('0x5a')]()['then'](function(_0xa85878){_0x28297b=_[_0xa22e('0x55')](_0xa85878);return _0x3f7b54[_0xa22e('0x65')][_0xa22e('0x77')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xa22e('0x78')],'raw':!![]});})[_0xa22e('0x26')](function(_0x4b4e26){if(_0x4b4e26&&_0x4b4e26[_0xa22e('0x43')]){return db[_0xa22e('0x79')]['transaction'](function(_0x54f63c){var _0x25c21d={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xa22e('0x69'))},'VoiceQueueId':{'$in':_[_0xa22e('0x29')](_0x4b4e26,'id')},'$or':[{'UserId':null},{'UserId':_0x3f7b54[_0xa22e('0x65')]['id']}]};var _0xbc3550=[];if(_0x3f7b54[_0xa22e('0x59')][_0xa22e('0x7a')]&&_0x3f7b54[_0xa22e('0x59')][_0xa22e('0x7a')]==='prev'){if(!_[_0xa22e('0x7b')](_0x3f7b54[_0xa22e('0x59')][_0xa22e('0x7c')])){_0x25c21d['id']={'$in':_0x3f7b54['body'][_0xa22e('0x7c')]};}_0xbc3550=[[_0xa22e('0x7d'),'ASC'],[_0xa22e('0x7e'),_0x4b4e26[0x0][_0xa22e('0x78')]===_0xa22e('0x7f')?'DESC':_0xa22e('0x7f')],db[_0xa22e('0x79')]['literal'](_0xa22e('0x80')),['id','DESC']];}else{if(!_['isEmpty'](_0x3f7b54[_0xa22e('0x59')][_0xa22e('0x7c')])){_0x25c21d['id']={'$notIn':_0x3f7b54['body']['hopperIds']};}_0xbc3550=[['priority',_0xa22e('0x81')],[_0xa22e('0x7e'),_0x4b4e26[0x0][_0xa22e('0x78')]],db[_0xa22e('0x79')][_0xa22e('0x82')](_0xa22e('0x83')),['id','ASC']];}return db[_0xa22e('0x4d')]['findOne']({'attributes':['id',_0xa22e('0x84')],'where':_0x25c21d,'order':_0xbc3550,'transaction':_0x54f63c,'lock':_0x54f63c[_0xa22e('0x85')][_0xa22e('0x86')],'include':[{'model':db[_0xa22e('0x6f')],'as':_0xa22e('0x87'),'attributes':_0x28297b,'include':[{'model':db[_0xa22e('0x88')],'as':'Company','attributes':['id','name']}]},{'model':db[_0xa22e('0x89')],'as':_0xa22e('0x8a'),'attributes':['id',_0xa22e('0x28')]},{'model':db['VoiceQueue'],'as':_0xa22e('0x8b'),'attributes':['id',_0xa22e('0x28'),_0xa22e('0x8c')]}]})[_0xa22e('0x26')](function(_0xd49919){if(_0xd49919){return _0xd49919[_0xa22e('0x24')]({'UserId':_0x3f7b54[_0xa22e('0x65')]['id']},{'transaction':_0x54f63c});}});});}})[_0xa22e('0x26')](handleEntityNotFound(_0x320666,null))['then'](respondWithResult(_0x320666,null))[_0xa22e('0x52')](handleError(_0x320666,null));};exports[_0xa22e('0x8d')]=function(_0x340430,_0xe8c25f,_0x465d4b){return _0x340430[_0xa22e('0x65')][_0xa22e('0x77')]({'where':{'type':_0xa22e('0x8e'),'dialActive':!![],'dialMethod':_0xa22e('0x8f')},'attributes':['id'],'raw':!![]})[_0xa22e('0x26')](function(_0x18eb9f){if(_0x18eb9f&&_0x18eb9f[_0xa22e('0x43')]){return db[_0xa22e('0x4d')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa22e('0x68')](_0xa22e('0x69'))},'VoiceQueueId':{'$in':_[_0xa22e('0x29')](_0x18eb9f,'id')},'$or':[{'UserId':null},{'UserId':_0x340430[_0xa22e('0x65')]['id']}]}});}return 0x0;})['then'](function(_0x5666c3){if(!_[_0xa22e('0x73')](_0x5666c3)&&_['isNumber'](_0x5666c3)){return _0xe8c25f[_0xa22e('0x1b')](0xc8)['json']({'contacts':_0x5666c3});}else{logger[_0xa22e('0x27')](_0xa22e('0x90'),_0xa22e('0x8d'),0x194,'entity\x20not\x20found');_0xe8c25f[_0xa22e('0x1a')](0x194);}})[_0xa22e('0x52')](handleError(_0xe8c25f,null));};exports[_0xa22e('0x91')]=function(_0xcc958f,_0x1424ba,_0x5db60a){var _0x1de411=shared[_0xa22e('0x92')];var _0x17b9d7=[];_[_0xa22e('0x29')](_0x1de411,function(_0x986830){_0x17b9d7[_0xa22e('0x93')]({'id':_0x986830[_0xa22e('0x28')],'name':_0x986830['name'],'utcOffset':_0x986830[_0xa22e('0x94')]});});return _0x1424ba[_0xa22e('0x1b')](0xc8)[_0xa22e('0x21')]({'tz':_0x17b9d7});};exports[_0xa22e('0x95')]=function(_0x1f3c54,_0x5daa77,_0xb57436){var _0x5667ba=shared[_0xa22e('0x92')];var _0x2484c7={};if(!_['isNil'](_0x5667ba[_0x1f3c54[_0xa22e('0x59')]['id']]))_0x2484c7=_0x5667ba[_0x1f3c54['body']['id']];return _0x5daa77[_0xa22e('0x1b')](0xc8)[_0xa22e('0x21')](_0x2484c7);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index ad8d458..64ce3a2 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 _0x0d93=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util'];(function(_0x3ffbbc,_0x4e8ac7){var _0x433c0d=function(_0x16d6b9){while(--_0x16d6b9){_0x3ffbbc['push'](_0x3ffbbc['shift']());}};_0x433c0d(++_0x4e8ac7);}(_0x0d93,0x1ed));var _0x30d9=function(_0x421263,_0x18187d){_0x421263=_0x421263-0x0;var _0x34e4b5=_0x0d93[_0x421263];return _0x34e4b5;};'use strict';var _=require(_0x30d9('0x0'));var util=require(_0x30d9('0x1'));var logger=require(_0x30d9('0x2'))('api');var moment=require(_0x30d9('0x3'));var BPromise=require(_0x30d9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x30d9('0x5'));var rimraf=require(_0x30d9('0x6'));var config=require(_0x30d9('0x7'));var attributes=require(_0x30d9('0x8'));module['exports']=function(_0x35d2cc,_0x3cf205){return _0x35d2cc[_0x30d9('0x9')](_0x30d9('0xa'),attributes,{'tableName':_0x30d9('0xb'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x30d9('0xc')]},{'name':_0x30d9('0xd'),'fields':['phone']},{'name':_0x30d9('0xe'),'fields':[_0x30d9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf729=['CmHopper','cm_hopper','scheduledat','phone','priority','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x223734,_0x15c460){var _0x2705e4=function(_0x623605){while(--_0x623605){_0x223734['push'](_0x223734['shift']());}};_0x2705e4(++_0x15c460);}(_0xf729,0x91));var _0x9f72=function(_0x1ab5ab,_0x1b1079){_0x1ab5ab=_0x1ab5ab-0x0;var _0x409c0d=_0xf729[_0x1ab5ab];return _0x409c0d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9f72('0x0'))('api');var moment=require(_0x9f72('0x1'));var BPromise=require(_0x9f72('0x2'));var rp=require(_0x9f72('0x3'));var fs=require('fs');var path=require(_0x9f72('0x4'));var rimraf=require(_0x9f72('0x5'));var config=require(_0x9f72('0x6'));var attributes=require('./cmHopper.attributes');module[_0x9f72('0x7')]=function(_0x56eab3,_0x5d5e12){return _0x56eab3[_0x9f72('0x8')](_0x9f72('0x9'),attributes,{'tableName':_0x9f72('0xa'),'paranoid':![],'indexes':[{'name':_0x9f72('0xb'),'fields':[_0x9f72('0xb')]},{'name':_0x9f72('0xc'),'fields':['phone']},{'name':_0x9f72('0xd'),'fields':[_0x9f72('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 41e2462..e9dcc4f 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 _0xbc8a=['includes','push','UserId','all','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','COUNT','literal','format','\x20,\x201,\x20null','contactsRescheduled','LOCK','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','getContactByPhone','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopper,\x20%s,\x20%s','info','result','catch','GetCmHopper','CmHopper','findAll','raw','options','where','attributes','limit','map','model','include','debug','ShowCmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','transaction','order','UPDATE','CmContact','Contact','keys','User','name','voicePause','length'];(function(_0x33539a,_0xab9aa5){var _0x1a99a7=function(_0x3e95db){while(--_0x3e95db){_0x33539a['push'](_0x33539a['shift']());}};_0x1a99a7(++_0xab9aa5);}(_0xbc8a,0x190));var _0xabc8=function(_0x42e4e0,_0x57ab9c){_0x42e4e0=_0x42e4e0-0x0;var _0x5ea33c=_0xbc8a[_0x42e4e0];return _0x5ea33c;};'use strict';var _=require('lodash');var util=require(_0xabc8('0x0'));var moment=require('moment');var BPromise=require(_0xabc8('0x1'));var rs=require(_0xabc8('0x2'));var fs=require('fs');var Redis=require(_0xabc8('0x3'));var db=require(_0xabc8('0x4'))['db'];var utils=require(_0xabc8('0x5'));var logger=require(_0xabc8('0x6'))(_0xabc8('0x7'));var config=require(_0xabc8('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xabc8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3edb5d,_0x277121,_0x14d9a2){return new BPromise(function(_0x418d32,_0x4ec0b0){return client[_0xabc8('0xa')](_0x3edb5d,_0x14d9a2)[_0xabc8('0xb')](function(_0x3c3c3f){logger['info']('CmHopper,\x20%s,\x20%s',_0x277121,_0xabc8('0xc'));logger['debug'](_0xabc8('0xd'),_0x277121,'request\x20sent',JSON[_0xabc8('0xe')](_0x3c3c3f));if(_0x3c3c3f['error']){if(_0x3c3c3f[_0xabc8('0xf')][_0xabc8('0x10')]===0x1f4){logger['error']('CmHopper,\x20%s,\x20%s',_0x277121,_0x3c3c3f[_0xabc8('0xf')][_0xabc8('0x11')]);return _0x4ec0b0(_0x3c3c3f['error']['message']);}logger['error'](_0xabc8('0x12'),_0x277121,_0x3c3c3f[_0xabc8('0xf')][_0xabc8('0x11')]);return _0x418d32(_0x3c3c3f[_0xabc8('0xf')][_0xabc8('0x11')]);}else{logger[_0xabc8('0x13')](_0xabc8('0x12'),_0x277121,_0xabc8('0xc'));_0x418d32(_0x3c3c3f[_0xabc8('0x14')][_0xabc8('0x11')]);}})[_0xabc8('0x15')](function(_0x497e80){logger['error'](_0xabc8('0x12'),_0x277121,_0x497e80);_0x4ec0b0(_0x497e80);});});}exports[_0xabc8('0x16')]=function(_0x1d6911){var _0x40a78f=this;return new Promise(function(_0x161c5c,_0x44c252){return db[_0xabc8('0x17')][_0xabc8('0x18')]({'raw':_0x1d6911['options']?_0x1d6911['options'][_0xabc8('0x19')]===undefined?!![]:![]:!![],'where':_0x1d6911[_0xabc8('0x1a')]?_0x1d6911['options'][_0xabc8('0x1b')]||null:null,'attributes':_0x1d6911['options']?_0x1d6911['options'][_0xabc8('0x1c')]||null:null,'limit':_0x1d6911[_0xabc8('0x1a')]?_0x1d6911['options'][_0xabc8('0x1d')]||null:null,'include':_0x1d6911['options']?_0x1d6911[_0xabc8('0x1a')]['include']?_[_0xabc8('0x1e')](_0x1d6911['options']['include'],function(_0x461d10){return{'model':db[_0x461d10[_0xabc8('0x1f')]],'as':_0x461d10['as'],'attributes':_0x461d10['attributes'],'include':_0x461d10[_0xabc8('0x20')]?_[_0xabc8('0x1e')](_0x461d10[_0xabc8('0x20')],function(_0x58b5b4){return{'model':db[_0x58b5b4[_0xabc8('0x1f')]],'as':_0x58b5b4['as'],'attributes':_0x58b5b4[_0xabc8('0x1c')],'include':_0x58b5b4[_0xabc8('0x20')]?_['map'](_0x58b5b4[_0xabc8('0x20')],function(_0x3a57a0){return{'model':db[_0x3a57a0[_0xabc8('0x1f')]],'as':_0x3a57a0['as'],'attributes':_0x3a57a0[_0xabc8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xabc8('0xb')](function(_0x13fb3d){logger[_0xabc8('0x13')](_0xabc8('0x16'),_0x1d6911);logger[_0xabc8('0x21')](_0xabc8('0x16'),_0x1d6911,JSON['stringify'](_0x13fb3d));_0x161c5c(_0x13fb3d);})[_0xabc8('0x15')](function(_0x6d3886){logger[_0xabc8('0xf')](_0xabc8('0x16'),_0x6d3886[_0xabc8('0x11')],_0x1d6911);_0x44c252(_0x40a78f[_0xabc8('0xf')](0x1f4,_0x6d3886[_0xabc8('0x11')]));});});};exports[_0xabc8('0x22')]=function(_0x51b7ce){var _0x50cecd=this;return new Promise(function(_0x121d72,_0x22cedf){return db[_0xabc8('0x17')][_0xabc8('0x23')]({'raw':_0x51b7ce[_0xabc8('0x1a')]?_0x51b7ce[_0xabc8('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x51b7ce[_0xabc8('0x1a')]?_0x51b7ce[_0xabc8('0x1a')][_0xabc8('0x1b')]||null:null,'attributes':_0x51b7ce['options']?_0x51b7ce[_0xabc8('0x1a')][_0xabc8('0x1c')]||null:null,'include':_0x51b7ce[_0xabc8('0x1a')]?_0x51b7ce[_0xabc8('0x1a')][_0xabc8('0x20')]?_[_0xabc8('0x1e')](_0x51b7ce[_0xabc8('0x1a')]['include'],function(_0x23f95d){return{'model':db[_0x23f95d[_0xabc8('0x1f')]],'as':_0x23f95d['as'],'attributes':_0x23f95d[_0xabc8('0x1c')],'include':_0x23f95d[_0xabc8('0x20')]?_[_0xabc8('0x1e')](_0x23f95d['include'],function(_0x431fa5){return{'model':db[_0x431fa5['model']],'as':_0x431fa5['as'],'attributes':_0x431fa5[_0xabc8('0x1c')],'include':_0x431fa5[_0xabc8('0x20')]?_[_0xabc8('0x1e')](_0x431fa5[_0xabc8('0x20')],function(_0x3d3a60){return{'model':db[_0x3d3a60[_0xabc8('0x1f')]],'as':_0x3d3a60['as'],'attributes':_0x3d3a60['attributes']};}):[]};}):[]};}):[]:[]})[_0xabc8('0xb')](function(_0x40ea93){logger[_0xabc8('0x13')](_0xabc8('0x22'),_0x51b7ce);logger[_0xabc8('0x21')](_0xabc8('0x22'),_0x51b7ce,JSON['stringify'](_0x40ea93));_0x121d72(_0x40ea93);})[_0xabc8('0x15')](function(_0x52c48a){logger[_0xabc8('0xf')](_0xabc8('0x22'),_0x52c48a[_0xabc8('0x11')],_0x51b7ce);_0x22cedf(_0x50cecd['error'](0x1f4,_0x52c48a[_0xabc8('0x11')]));});});};exports[_0xabc8('0x24')]=function(_0x4fc2c6){var _0x2cba7e=this;return new Promise(function(_0x38c32f,_0x500d07){return db[_0xabc8('0x17')][_0xabc8('0x25')](_0x4fc2c6[_0xabc8('0x26')],{'raw':_0x4fc2c6[_0xabc8('0x1a')]?_0x4fc2c6['options']['raw']===undefined?!![]:![]:!![]})[_0xabc8('0xb')](function(_0x4b4f02){logger['info']('CreateCmHopper',_0x4fc2c6);logger[_0xabc8('0x21')]('CreateCmHopper',_0x4fc2c6,JSON['stringify'](_0x4b4f02));_0x38c32f(_0x4b4f02);})[_0xabc8('0x15')](function(_0x3aa78b){logger[_0xabc8('0xf')](_0xabc8('0x24'),_0x3aa78b['message'],_0x4fc2c6);_0x500d07(_0x2cba7e[_0xabc8('0xf')](0x1f4,_0x3aa78b['message']));});});};exports[_0xabc8('0x27')]=function(_0xad7932){var _0x3dfc5a=this;return new Promise(function(_0x1ed936,_0x207e70){return db[_0xabc8('0x17')][_0xabc8('0x28')](_0xad7932[_0xabc8('0x26')],{'raw':_0xad7932[_0xabc8('0x1a')]?_0xad7932[_0xabc8('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xad7932[_0xabc8('0x1a')]?_0xad7932[_0xabc8('0x1a')]['where']||null:null,'attributes':_0xad7932[_0xabc8('0x1a')]?_0xad7932[_0xabc8('0x1a')][_0xabc8('0x1c')]||null:null,'limit':_0xad7932[_0xabc8('0x1a')]?_0xad7932[_0xabc8('0x1a')]['limit']||null:null})[_0xabc8('0xb')](function(_0x5ddbe4){logger[_0xabc8('0x13')](_0xabc8('0x27'),_0xad7932);logger['debug'](_0xabc8('0x27'),_0xad7932,JSON['stringify'](_0x5ddbe4));_0x1ed936(_0x5ddbe4);})[_0xabc8('0x15')](function(_0x2ab27d){logger[_0xabc8('0xf')](_0xabc8('0x27'),_0x2ab27d[_0xabc8('0x11')],_0xad7932);_0x207e70(_0x3dfc5a[_0xabc8('0xf')](0x1f4,_0x2ab27d['message']));});});};exports[_0xabc8('0x29')]=function(_0x103b6f){var _0xaa4f4e=this;return new Promise(function(_0x122785,_0x2a2f83){return db[_0xabc8('0x17')][_0xabc8('0x2a')]({'where':_0x103b6f[_0xabc8('0x1a')]?_0x103b6f[_0xabc8('0x1a')]['where']||null:null})[_0xabc8('0xb')](function(_0x452c2f){logger['info']('DestroyCmHopper',_0x103b6f);logger[_0xabc8('0x21')](_0xabc8('0x29'),_0x103b6f,JSON[_0xabc8('0xe')](_0x452c2f));_0x122785(_0x452c2f);})['catch'](function(_0x46de6){logger['error'](_0xabc8('0x29'),_0x46de6[_0xabc8('0x11')],_0x103b6f);_0x2a2f83(_0xaa4f4e[_0xabc8('0xf')](0x1f4,_0x46de6[_0xabc8('0x11')]));});});};exports[_0xabc8('0x2b')]=function(_0x5cd96e){var _0x29d74d=this;return new Promise(function(_0x145756,_0x2a3edb){return db['CmContact'][_0xabc8('0x2c')]()[_0xabc8('0xb')](function(_0xf90552){return db[_0xabc8('0x2d')][_0xabc8('0x2e')](function(_0x1d096e){return db[_0xabc8('0x17')][_0xabc8('0x18')]({'where':_0x5cd96e['options']?_0x5cd96e[_0xabc8('0x1a')][_0xabc8('0x1b')]||null:null,'attributes':_0x5cd96e[_0xabc8('0x1a')]?_0x5cd96e[_0xabc8('0x1a')][_0xabc8('0x1c')]||null:null,'limit':_0x5cd96e[_0xabc8('0x1a')]?_0x5cd96e[_0xabc8('0x1a')][_0xabc8('0x1d')]||null:null,'order':_0x5cd96e['options']?_0x5cd96e[_0xabc8('0x1a')][_0xabc8('0x2f')]||null:null,'transaction':_0x1d096e,'lock':_0x1d096e['LOCK'][_0xabc8('0x30')],'include':[{'model':db[_0xabc8('0x31')],'as':_0xabc8('0x32'),'attributes':_[_0xabc8('0x33')](_0xf90552)},{'model':db[_0xabc8('0x34')],'as':'Agent','attributes':['id',_0xabc8('0x35'),_0xabc8('0x36')]}]})['then'](function(_0x4c0752){var _0x3ae64a=[];var _0x5e722a=[];for(var _0x342d71=0x0;_0x342d71<_0x4c0752[_0xabc8('0x37')];_0x342d71+=0x1){if(!_0x5e722a[_0xabc8('0x38')](_0x4c0752[_0x342d71]['UserId'])){_0x5e722a[_0xabc8('0x39')](_0x4c0752[_0x342d71][_0xabc8('0x3a')]);_0x3ae64a['push'](_0x4c0752[_0x342d71]['update'](_0x5cd96e[_0xabc8('0x26')],{'transaction':_0x1d096e}));}}return BPromise[_0xabc8('0x3b')](_0x3ae64a);});})[_0xabc8('0xb')](function(_0x4660c6){logger['info'](_0xabc8('0x2b'),_0x5cd96e);logger[_0xabc8('0x21')]('GetContactDialer',_0x5cd96e,JSON[_0xabc8('0xe')](_0x4660c6));_0x145756(_0x4660c6);})[_0xabc8('0x15')](function(_0x1a6cc9){logger[_0xabc8('0xf')](_0xabc8('0x2b'),_0x1a6cc9[_0xabc8('0x11')],_0x5cd96e);_0x2a3edb(_0x29d74d[_0xabc8('0xf')](0x1f4,_0x1a6cc9[_0xabc8('0x11')]));});});});};exports['MoveContactManagedDialer']=function(_0x18a9dc){var _0x3321e9=this;return new Promise(function(_0x3f9283,_0x5e92a4){return db['sequelize'][_0xabc8('0x2e')](function(_0x188f87){return db[_0xabc8('0x3c')]['create'](_0x18a9dc[_0xabc8('0x26')],{'raw':_0x18a9dc['options']?_0x18a9dc[_0xabc8('0x1a')][_0xabc8('0x19')]===undefined?!![]:![]:!![],'transaction':_0x188f87})['then'](function(){return db[_0xabc8('0x17')]['destroy']({'where':_0x18a9dc[_0xabc8('0x1a')]?_0x18a9dc[_0xabc8('0x1a')][_0xabc8('0x1b')]||null:null,'transaction':_0x188f87});});})[_0xabc8('0xb')](function(_0x1c2c5e){logger[_0xabc8('0x13')](_0xabc8('0x3d'),_0x18a9dc);logger[_0xabc8('0x21')]('MoveContactManagedDialer',_0x18a9dc,JSON[_0xabc8('0xe')](_0x1c2c5e));_0x3f9283(_0x1c2c5e);})[_0xabc8('0x15')](function(_0xfdfc75){logger[_0xabc8('0xf')](_0xabc8('0x3d'),_0xfdfc75[_0xabc8('0x11')],_0x18a9dc);_0x5e92a4(_0x3321e9['error'](0x1f4,_0xfdfc75[_0xabc8('0x11')]));});});};exports[_0xabc8('0x3e')]=function(_0x144c28){var _0x56e22f=this;return new Promise(function(_0x382ecb,_0x34169c){return db[_0xabc8('0x17')][_0xabc8('0x18')]({'raw':_0x144c28[_0xabc8('0x1a')]?_0x144c28[_0xabc8('0x1a')][_0xabc8('0x19')]===undefined?!![]:![]:!![],'where':_0x144c28[_0xabc8('0x1a')]?_0x144c28['options'][_0xabc8('0x1b')]||null:null,'attributes':[[db[_0xabc8('0x2d')]['fn'](_0xabc8('0x3f'),db[_0xabc8('0x2d')]['fn']('IF',db[_0xabc8('0x2d')][_0xabc8('0x40')]('`scheduledat`\x20>=\x20'+util[_0xabc8('0x41')]('\x22%s\x22',moment()[_0xabc8('0x41')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xabc8('0x42')))),_0xabc8('0x43')]]})[_0xabc8('0xb')](function(_0x19b149){logger[_0xabc8('0x13')](_0xabc8('0x3e'),_0x144c28);logger[_0xabc8('0x21')](_0xabc8('0x3e'),_0x144c28,JSON['stringify'](_0x19b149));_0x382ecb(_0x19b149);})[_0xabc8('0x15')](function(_0x2b8ba0){logger[_0xabc8('0xf')](_0xabc8('0x3e'),_0x2b8ba0['message'],_0x144c28);_0x34169c(_0x56e22f[_0xabc8('0xf')](0x1f4,_0x2b8ba0[_0xabc8('0x11')]));});});};exports['GetContactRecallMe']=function(_0x3ad31b){var _0x28dfdd=this;return new Promise(function(_0x1f691d,_0x289b9e){return db[_0xabc8('0x31')][_0xabc8('0x2c')]()['then'](function(_0x59c10c){return db['sequelize']['transaction'](function(_0x1bd5ef){return db[_0xabc8('0x17')]['findAll']({'where':_0x3ad31b[_0xabc8('0x1a')]?_0x3ad31b['options']['where']||null:null,'attributes':_0x3ad31b['options']?_0x3ad31b[_0xabc8('0x1a')][_0xabc8('0x1c')]||null:null,'limit':0x1,'order':_0x3ad31b[_0xabc8('0x1a')]?_0x3ad31b[_0xabc8('0x1a')][_0xabc8('0x2f')]||null:null,'group':db[_0xabc8('0x17')]['UserId'],'transaction':_0x1bd5ef,'lock':_0x1bd5ef[_0xabc8('0x44')][_0xabc8('0x30')],'include':_0x3ad31b[_0xabc8('0x1a')]?_0x3ad31b[_0xabc8('0x1a')][_0xabc8('0x20')]?_[_0xabc8('0x1e')](_0x3ad31b[_0xabc8('0x1a')][_0xabc8('0x20')],function(_0x4d4cc0){return{'model':db[_0x4d4cc0[_0xabc8('0x1f')]],'as':_0x4d4cc0['as'],'attributes':_0x4d4cc0['attributes'],'include':_0x4d4cc0[_0xabc8('0x20')]?_[_0xabc8('0x1e')](_0x4d4cc0['include'],function(_0x3ef93c){return{'model':db[_0x3ef93c['model']],'as':_0x3ef93c['as'],'attributes':_0x3ef93c[_0xabc8('0x1c')],'include':_0x3ef93c[_0xabc8('0x20')]?_['map'](_0x3ef93c[_0xabc8('0x20')],function(_0x5ba1ea){return{'model':db[_0x5ba1ea[_0xabc8('0x1f')]],'as':_0x5ba1ea['as'],'attributes':_0x5ba1ea[_0xabc8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xabc8('0xb')](function(_0x4d0714){var _0x221dbb=[];for(var _0xf92c2b=0x0;_0xf92c2b<_0x4d0714[_0xabc8('0x37')];_0xf92c2b+=0x1){_0x221dbb[_0xabc8('0x39')](_0x4d0714[_0xf92c2b][_0xabc8('0x28')](_0x3ad31b[_0xabc8('0x26')],{'transaction':_0x1bd5ef}));}return BPromise[_0xabc8('0x3b')](_0x221dbb);});})[_0xabc8('0xb')](function(_0x3d6eb8){logger[_0xabc8('0x13')](_0xabc8('0x45'),_0x3ad31b);logger[_0xabc8('0x21')](_0xabc8('0x45'),_0x3ad31b,JSON[_0xabc8('0xe')](_0x3d6eb8));_0x1f691d(_0x3d6eb8);})['catch'](function(_0x49587c){logger[_0xabc8('0xf')](_0xabc8('0x45'),_0x49587c[_0xabc8('0x11')],_0x3ad31b);_0x289b9e(_0x28dfdd[_0xabc8('0xf')](0x1f4,_0x49587c[_0xabc8('0x11')]));});});});};exports[_0xabc8('0x46')]=function(_0x12d818){var _0x52e1c1=this;return new Promise(function(_0x12bb20,_0x55b928){db[_0xabc8('0x31')][_0xabc8('0x2c')]()[_0xabc8('0xb')](function(_0x349b7a){return db[_0xabc8('0x17')][_0xabc8('0x18')]({'raw':_0x12d818[_0xabc8('0x1a')]?_0x12d818[_0xabc8('0x1a')][_0xabc8('0x19')]===undefined?!![]:![]:!![],'where':_0x12d818['options']?_0x12d818['options'][_0xabc8('0x1b')]||null:null,'attributes':_0x12d818['options']?_0x12d818['options'][_0xabc8('0x1c')]||null:null,'limit':_0x12d818['options']?_0x12d818[_0xabc8('0x1a')][_0xabc8('0x1d')]||null:null,'include':_0x12d818[_0xabc8('0x1a')]?_0x12d818[_0xabc8('0x1a')]['include']?_[_0xabc8('0x1e')](_0x12d818[_0xabc8('0x1a')][_0xabc8('0x20')],function(_0x4c3c94){return{'model':db[_0x4c3c94['model']],'as':_0x4c3c94['as'],'attributes':_0x4c3c94['as']==='Contact'?_['keys'](_0x349b7a):_0x4c3c94[_0xabc8('0x1c')],'include':_0x4c3c94[_0xabc8('0x20')]?_[_0xabc8('0x1e')](_0x4c3c94[_0xabc8('0x20')],function(_0xf8149d){return{'model':db[_0xf8149d['model']],'as':_0xf8149d['as'],'attributes':_0xf8149d[_0xabc8('0x1c')],'include':_0xf8149d[_0xabc8('0x20')]?_[_0xabc8('0x1e')](_0xf8149d['include'],function(_0x1c7daf){return{'model':db[_0x1c7daf[_0xabc8('0x1f')]],'as':_0x1c7daf['as'],'attributes':_0x1c7daf['attributes']};}):[]};}):[]};}):[]:[]})[_0xabc8('0xb')](function(_0x2d2937){logger['info']('GetCmHopper',_0x12d818);logger[_0xabc8('0x21')](_0xabc8('0x16'),_0x12d818,JSON['stringify'](_0x2d2937));_0x12bb20(_0x2d2937);})['catch'](function(_0x28c1d5){logger[_0xabc8('0xf')](_0xabc8('0x16'),_0x28c1d5[_0xabc8('0x11')],_0x12d818);_0x55b928(_0x52e1c1[_0xabc8('0xf')](0x1f4,_0x28c1d5['message']));});});});};exports[_0xabc8('0x47')]=function(_0x475a13){_this=this;return new Promise(function(_0x49e9bc,_0x35a9f4){return db[_0xabc8('0x31')][_0xabc8('0x48')]({'raw':!![],'where':{'phone':_0x475a13['options'][_0xabc8('0x1b')][_0xabc8('0x49')]},'attributes':['id',_0xabc8('0x4a')],'order':[['id','DESC']]})[_0xabc8('0xb')](function(_0x3166ce){logger[_0xabc8('0x13')](_0xabc8('0x4b'),_0x475a13);logger[_0xabc8('0x21')](_0xabc8('0x4b'),_0x475a13,JSON[_0xabc8('0xe')](_0x3166ce));_0x49e9bc(_0x3166ce);})[_0xabc8('0x15')](function(_0x5f4a81){logger['error'](_0xabc8('0x4b'),_0x5f4a81[_0xabc8('0x11')],_0x475a13);_0x35a9f4(_this[_0xabc8('0xf')](0x1f4,_0x5f4a81[_0xabc8('0x11')]));});});}; \ No newline at end of file +var _0x7631=['model','ShowCmHopper','CmHopper','find','create','body','CreateCmHopper','UpdateCmHopper','limit','DestroyCmHopper','destroy','CmContact','describe','sequelize','transaction','LOCK','UPDATE','Contact','keys','Agent','name','includes','UserId','push','update','all','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','literal','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','length','GetCmHopperPreview','GetContactByPhone','phone','dialTimezone','DESC','getContactByPhone','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetCmHopper','findAll','options','raw','where','attributes','include','map'];(function(_0x1fd70f,_0x2d0932){var _0x30d478=function(_0x4baf67){while(--_0x4baf67){_0x1fd70f['push'](_0x1fd70f['shift']());}};_0x30d478(++_0x2d0932);}(_0x7631,0x108));var _0x1763=function(_0x2b9bd6,_0x1472c5){_0x2b9bd6=_0x2b9bd6-0x0;var _0x5f3a5e=_0x7631[_0x2b9bd6];return _0x5f3a5e;};'use strict';var _=require(_0x1763('0x0'));var util=require('util');var moment=require(_0x1763('0x1'));var BPromise=require('bluebird');var rs=require(_0x1763('0x2'));var fs=require('fs');var Redis=require(_0x1763('0x3'));var db=require(_0x1763('0x4'))['db'];var utils=require(_0x1763('0x5'));var logger=require(_0x1763('0x6'))(_0x1763('0x7'));var config=require(_0x1763('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1763('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x419496,_0x54881d,_0x56a7bf){return new BPromise(function(_0x3acf0a,_0x281ace){return client['request'](_0x419496,_0x56a7bf)[_0x1763('0xa')](function(_0x1e8b3f){logger[_0x1763('0xb')](_0x1763('0xc'),_0x54881d,_0x1763('0xd'));logger[_0x1763('0xe')](_0x1763('0xf'),_0x54881d,_0x1763('0xd'),JSON[_0x1763('0x10')](_0x1e8b3f));if(_0x1e8b3f[_0x1763('0x11')]){if(_0x1e8b3f[_0x1763('0x11')]['code']===0x1f4){logger['error'](_0x1763('0xc'),_0x54881d,_0x1e8b3f['error'][_0x1763('0x12')]);return _0x281ace(_0x1e8b3f[_0x1763('0x11')][_0x1763('0x12')]);}logger[_0x1763('0x11')]('CmHopper,\x20%s,\x20%s',_0x54881d,_0x1e8b3f['error'][_0x1763('0x12')]);return _0x3acf0a(_0x1e8b3f['error'][_0x1763('0x12')]);}else{logger['info'](_0x1763('0xc'),_0x54881d,_0x1763('0xd'));_0x3acf0a(_0x1e8b3f['result'][_0x1763('0x12')]);}})[_0x1763('0x13')](function(_0x40058e){logger[_0x1763('0x11')](_0x1763('0xc'),_0x54881d,_0x40058e);_0x281ace(_0x40058e);});});}exports[_0x1763('0x14')]=function(_0x294d71){var _0x62360b=this;return new Promise(function(_0x357dae,_0xa6d906){return db['CmHopper'][_0x1763('0x15')]({'raw':_0x294d71[_0x1763('0x16')]?_0x294d71[_0x1763('0x16')][_0x1763('0x17')]===undefined?!![]:![]:!![],'where':_0x294d71[_0x1763('0x16')]?_0x294d71['options'][_0x1763('0x18')]||null:null,'attributes':_0x294d71['options']?_0x294d71[_0x1763('0x16')][_0x1763('0x19')]||null:null,'limit':_0x294d71['options']?_0x294d71[_0x1763('0x16')]['limit']||null:null,'include':_0x294d71[_0x1763('0x16')]?_0x294d71['options'][_0x1763('0x1a')]?_[_0x1763('0x1b')](_0x294d71[_0x1763('0x16')]['include'],function(_0xb7c1a4){return{'model':db[_0xb7c1a4[_0x1763('0x1c')]],'as':_0xb7c1a4['as'],'attributes':_0xb7c1a4[_0x1763('0x19')],'include':_0xb7c1a4[_0x1763('0x1a')]?_[_0x1763('0x1b')](_0xb7c1a4[_0x1763('0x1a')],function(_0x5c6d8a){return{'model':db[_0x5c6d8a[_0x1763('0x1c')]],'as':_0x5c6d8a['as'],'attributes':_0x5c6d8a['attributes'],'include':_0x5c6d8a[_0x1763('0x1a')]?_['map'](_0x5c6d8a['include'],function(_0x3d1d71){return{'model':db[_0x3d1d71[_0x1763('0x1c')]],'as':_0x3d1d71['as'],'attributes':_0x3d1d71[_0x1763('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1763('0xa')](function(_0x11db2e){logger[_0x1763('0xb')](_0x1763('0x14'),_0x294d71);logger[_0x1763('0xe')](_0x1763('0x14'),_0x294d71,JSON[_0x1763('0x10')](_0x11db2e));_0x357dae(_0x11db2e);})[_0x1763('0x13')](function(_0x2f970e){logger[_0x1763('0x11')](_0x1763('0x14'),_0x2f970e[_0x1763('0x12')],_0x294d71);_0xa6d906(_0x62360b['error'](0x1f4,_0x2f970e['message']));});});};exports[_0x1763('0x1d')]=function(_0x5c6f4b){var _0x3bf20d=this;return new Promise(function(_0x241294,_0x5e6584){return db[_0x1763('0x1e')][_0x1763('0x1f')]({'raw':_0x5c6f4b['options']?_0x5c6f4b[_0x1763('0x16')][_0x1763('0x17')]===undefined?!![]:![]:!![],'where':_0x5c6f4b['options']?_0x5c6f4b[_0x1763('0x16')][_0x1763('0x18')]||null:null,'attributes':_0x5c6f4b[_0x1763('0x16')]?_0x5c6f4b[_0x1763('0x16')][_0x1763('0x19')]||null:null,'include':_0x5c6f4b[_0x1763('0x16')]?_0x5c6f4b[_0x1763('0x16')][_0x1763('0x1a')]?_['map'](_0x5c6f4b[_0x1763('0x16')][_0x1763('0x1a')],function(_0x4abdd8){return{'model':db[_0x4abdd8[_0x1763('0x1c')]],'as':_0x4abdd8['as'],'attributes':_0x4abdd8[_0x1763('0x19')],'include':_0x4abdd8[_0x1763('0x1a')]?_['map'](_0x4abdd8[_0x1763('0x1a')],function(_0x418035){return{'model':db[_0x418035['model']],'as':_0x418035['as'],'attributes':_0x418035['attributes'],'include':_0x418035['include']?_[_0x1763('0x1b')](_0x418035['include'],function(_0x145fc6){return{'model':db[_0x145fc6['model']],'as':_0x145fc6['as'],'attributes':_0x145fc6[_0x1763('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1763('0xa')](function(_0x1fdba7){logger[_0x1763('0xb')](_0x1763('0x1d'),_0x5c6f4b);logger[_0x1763('0xe')](_0x1763('0x1d'),_0x5c6f4b,JSON[_0x1763('0x10')](_0x1fdba7));_0x241294(_0x1fdba7);})['catch'](function(_0x22a90d){logger[_0x1763('0x11')]('ShowCmHopper',_0x22a90d[_0x1763('0x12')],_0x5c6f4b);_0x5e6584(_0x3bf20d[_0x1763('0x11')](0x1f4,_0x22a90d[_0x1763('0x12')]));});});};exports['CreateCmHopper']=function(_0x1ae36c){var _0x19c40d=this;return new Promise(function(_0x1bcf03,_0x33c609){return db[_0x1763('0x1e')][_0x1763('0x20')](_0x1ae36c[_0x1763('0x21')],{'raw':_0x1ae36c[_0x1763('0x16')]?_0x1ae36c[_0x1763('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x1763('0xa')](function(_0x469e17){logger[_0x1763('0xb')](_0x1763('0x22'),_0x1ae36c);logger[_0x1763('0xe')](_0x1763('0x22'),_0x1ae36c,JSON[_0x1763('0x10')](_0x469e17));_0x1bcf03(_0x469e17);})[_0x1763('0x13')](function(_0x424792){logger[_0x1763('0x11')](_0x1763('0x22'),_0x424792['message'],_0x1ae36c);_0x33c609(_0x19c40d['error'](0x1f4,_0x424792[_0x1763('0x12')]));});});};exports[_0x1763('0x23')]=function(_0x38bba4){var _0x5c4596=this;return new Promise(function(_0x1de8d5,_0x2586bd){return db[_0x1763('0x1e')]['update'](_0x38bba4[_0x1763('0x21')],{'raw':_0x38bba4['options']?_0x38bba4['options'][_0x1763('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38bba4[_0x1763('0x16')]?_0x38bba4['options'][_0x1763('0x18')]||null:null,'attributes':_0x38bba4[_0x1763('0x16')]?_0x38bba4[_0x1763('0x16')][_0x1763('0x19')]||null:null,'limit':_0x38bba4['options']?_0x38bba4[_0x1763('0x16')][_0x1763('0x24')]||null:null})[_0x1763('0xa')](function(_0x7e3b97){logger[_0x1763('0xb')]('UpdateCmHopper',_0x38bba4);logger[_0x1763('0xe')](_0x1763('0x23'),_0x38bba4,JSON[_0x1763('0x10')](_0x7e3b97));_0x1de8d5(_0x7e3b97);})[_0x1763('0x13')](function(_0x46643b){logger[_0x1763('0x11')](_0x1763('0x23'),_0x46643b[_0x1763('0x12')],_0x38bba4);_0x2586bd(_0x5c4596['error'](0x1f4,_0x46643b[_0x1763('0x12')]));});});};exports[_0x1763('0x25')]=function(_0x15628a){var _0x40b6e3=this;return new Promise(function(_0x3c6ef0,_0x5767c6){return db[_0x1763('0x1e')][_0x1763('0x26')]({'where':_0x15628a[_0x1763('0x16')]?_0x15628a[_0x1763('0x16')][_0x1763('0x18')]||null:null})[_0x1763('0xa')](function(_0x5dc5da){logger[_0x1763('0xb')](_0x1763('0x25'),_0x15628a);logger[_0x1763('0xe')](_0x1763('0x25'),_0x15628a,JSON[_0x1763('0x10')](_0x5dc5da));_0x3c6ef0(_0x5dc5da);})[_0x1763('0x13')](function(_0x3d64b2){logger['error'](_0x1763('0x25'),_0x3d64b2[_0x1763('0x12')],_0x15628a);_0x5767c6(_0x40b6e3[_0x1763('0x11')](0x1f4,_0x3d64b2[_0x1763('0x12')]));});});};exports['GetContactDialer']=function(_0xe33789){var _0xb700e7=this;return new Promise(function(_0x4dadbf,_0x564aa8){return db[_0x1763('0x27')][_0x1763('0x28')]()[_0x1763('0xa')](function(_0x258b61){return db[_0x1763('0x29')][_0x1763('0x2a')](function(_0x3ba0ca){return db[_0x1763('0x1e')]['findAll']({'where':_0xe33789[_0x1763('0x16')]?_0xe33789[_0x1763('0x16')][_0x1763('0x18')]||null:null,'attributes':_0xe33789[_0x1763('0x16')]?_0xe33789[_0x1763('0x16')][_0x1763('0x19')]||null:null,'limit':_0xe33789['options']?_0xe33789[_0x1763('0x16')]['limit']||null:null,'order':_0xe33789[_0x1763('0x16')]?_0xe33789[_0x1763('0x16')]['order']||null:null,'transaction':_0x3ba0ca,'lock':_0x3ba0ca[_0x1763('0x2b')][_0x1763('0x2c')],'include':[{'model':db['CmContact'],'as':_0x1763('0x2d'),'attributes':_[_0x1763('0x2e')](_0x258b61)},{'model':db['User'],'as':_0x1763('0x2f'),'attributes':['id',_0x1763('0x30'),'voicePause']}]})[_0x1763('0xa')](function(_0x57401c){var _0x3d90c9=[];var _0x1a14ee=[];for(var _0xce0f33=0x0;_0xce0f33<_0x57401c['length'];_0xce0f33+=0x1){if(!_0x1a14ee[_0x1763('0x31')](_0x57401c[_0xce0f33][_0x1763('0x32')])){_0x1a14ee[_0x1763('0x33')](_0x57401c[_0xce0f33][_0x1763('0x32')]);_0x3d90c9[_0x1763('0x33')](_0x57401c[_0xce0f33][_0x1763('0x34')](_0xe33789[_0x1763('0x21')],{'transaction':_0x3ba0ca}));}}return BPromise[_0x1763('0x35')](_0x3d90c9);});})[_0x1763('0xa')](function(_0x20d116){logger[_0x1763('0xb')](_0x1763('0x36'),_0xe33789);logger[_0x1763('0xe')](_0x1763('0x36'),_0xe33789,JSON['stringify'](_0x20d116));_0x4dadbf(_0x20d116);})[_0x1763('0x13')](function(_0x4bdf96){logger['error'](_0x1763('0x36'),_0x4bdf96[_0x1763('0x12')],_0xe33789);_0x564aa8(_0xb700e7['error'](0x1f4,_0x4bdf96[_0x1763('0x12')]));});});});};exports[_0x1763('0x37')]=function(_0xbc37aa){var _0xe4fcc4=this;return new Promise(function(_0x298656,_0x552b42){return db[_0x1763('0x29')][_0x1763('0x2a')](function(_0x71716c){return db[_0x1763('0x38')]['create'](_0xbc37aa[_0x1763('0x21')],{'raw':_0xbc37aa[_0x1763('0x16')]?_0xbc37aa[_0x1763('0x16')][_0x1763('0x17')]===undefined?!![]:![]:!![],'transaction':_0x71716c})['then'](function(){return db[_0x1763('0x1e')][_0x1763('0x26')]({'where':_0xbc37aa['options']?_0xbc37aa[_0x1763('0x16')][_0x1763('0x18')]||null:null,'transaction':_0x71716c});});})[_0x1763('0xa')](function(_0x3abdb1){logger[_0x1763('0xb')]('MoveContactManagedDialer',_0xbc37aa);logger[_0x1763('0xe')]('MoveContactManagedDialer',_0xbc37aa,JSON[_0x1763('0x10')](_0x3abdb1));_0x298656(_0x3abdb1);})[_0x1763('0x13')](function(_0x4d2d0a){logger[_0x1763('0x11')](_0x1763('0x37'),_0x4d2d0a[_0x1763('0x12')],_0xbc37aa);_0x552b42(_0xe4fcc4['error'](0x1f4,_0x4d2d0a[_0x1763('0x12')]));});});};exports[_0x1763('0x39')]=function(_0x10e9c3){var _0x56436c=this;return new Promise(function(_0x474922,_0x2c4184){return db[_0x1763('0x1e')][_0x1763('0x15')]({'raw':_0x10e9c3['options']?_0x10e9c3[_0x1763('0x16')][_0x1763('0x17')]===undefined?!![]:![]:!![],'where':_0x10e9c3[_0x1763('0x16')]?_0x10e9c3[_0x1763('0x16')][_0x1763('0x18')]||null:null,'attributes':[[db['sequelize']['fn'](_0x1763('0x3a'),db[_0x1763('0x29')]['fn']('IF',db['sequelize'][_0x1763('0x3b')]('`scheduledat`\x20>=\x20'+util[_0x1763('0x3c')]('\x22%s\x22',moment()[_0x1763('0x3c')](_0x1763('0x3d')))+_0x1763('0x3e')))),_0x1763('0x3f')]]})[_0x1763('0xa')](function(_0x4f1ef5){logger['info'](_0x1763('0x39'),_0x10e9c3);logger[_0x1763('0xe')]('CountReScheduled',_0x10e9c3,JSON[_0x1763('0x10')](_0x4f1ef5));_0x474922(_0x4f1ef5);})[_0x1763('0x13')](function(_0x2ee0b6){logger[_0x1763('0x11')](_0x1763('0x39'),_0x2ee0b6[_0x1763('0x12')],_0x10e9c3);_0x2c4184(_0x56436c[_0x1763('0x11')](0x1f4,_0x2ee0b6[_0x1763('0x12')]));});});};exports[_0x1763('0x40')]=function(_0x5f12c0){var _0x37cf1b=this;return new Promise(function(_0x5739e8,_0x31cea6){return db[_0x1763('0x27')][_0x1763('0x28')]()[_0x1763('0xa')](function(_0x8aac93){return db[_0x1763('0x29')][_0x1763('0x2a')](function(_0x419399){return db['CmHopper'][_0x1763('0x15')]({'where':_0x5f12c0['options']?_0x5f12c0[_0x1763('0x16')]['where']||null:null,'attributes':_0x5f12c0[_0x1763('0x16')]?_0x5f12c0[_0x1763('0x16')][_0x1763('0x19')]||null:null,'limit':0x1,'order':_0x5f12c0[_0x1763('0x16')]?_0x5f12c0[_0x1763('0x16')][_0x1763('0x41')]||null:null,'group':db[_0x1763('0x1e')][_0x1763('0x32')],'transaction':_0x419399,'lock':_0x419399['LOCK'][_0x1763('0x2c')],'include':_0x5f12c0[_0x1763('0x16')]?_0x5f12c0[_0x1763('0x16')][_0x1763('0x1a')]?_[_0x1763('0x1b')](_0x5f12c0[_0x1763('0x16')][_0x1763('0x1a')],function(_0x23f9b5){return{'model':db[_0x23f9b5[_0x1763('0x1c')]],'as':_0x23f9b5['as'],'attributes':_0x23f9b5['attributes'],'include':_0x23f9b5[_0x1763('0x1a')]?_[_0x1763('0x1b')](_0x23f9b5[_0x1763('0x1a')],function(_0x53c900){return{'model':db[_0x53c900[_0x1763('0x1c')]],'as':_0x53c900['as'],'attributes':_0x53c900[_0x1763('0x19')],'include':_0x53c900[_0x1763('0x1a')]?_[_0x1763('0x1b')](_0x53c900[_0x1763('0x1a')],function(_0x362d18){return{'model':db[_0x362d18[_0x1763('0x1c')]],'as':_0x362d18['as'],'attributes':_0x362d18[_0x1763('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1763('0xa')](function(_0x1a79d3){var _0x37cd01=[];for(var _0xa708b2=0x0;_0xa708b2<_0x1a79d3[_0x1763('0x42')];_0xa708b2+=0x1){_0x37cd01[_0x1763('0x33')](_0x1a79d3[_0xa708b2][_0x1763('0x34')](_0x5f12c0['body'],{'transaction':_0x419399}));}return BPromise[_0x1763('0x35')](_0x37cd01);});})[_0x1763('0xa')](function(_0x3cc1a2){logger[_0x1763('0xb')](_0x1763('0x40'),_0x5f12c0);logger[_0x1763('0xe')]('GetContactRecallMe',_0x5f12c0,JSON[_0x1763('0x10')](_0x3cc1a2));_0x5739e8(_0x3cc1a2);})[_0x1763('0x13')](function(_0x452df2){logger[_0x1763('0x11')](_0x1763('0x40'),_0x452df2[_0x1763('0x12')],_0x5f12c0);_0x31cea6(_0x37cf1b[_0x1763('0x11')](0x1f4,_0x452df2['message']));});});});};exports[_0x1763('0x43')]=function(_0x15bafe){var _0x411b64=this;return new Promise(function(_0x515cb1,_0x512074){db[_0x1763('0x27')][_0x1763('0x28')]()[_0x1763('0xa')](function(_0x30ce01){return db[_0x1763('0x1e')][_0x1763('0x15')]({'raw':_0x15bafe['options']?_0x15bafe[_0x1763('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x15bafe[_0x1763('0x16')]?_0x15bafe[_0x1763('0x16')][_0x1763('0x18')]||null:null,'attributes':_0x15bafe[_0x1763('0x16')]?_0x15bafe[_0x1763('0x16')][_0x1763('0x19')]||null:null,'limit':_0x15bafe[_0x1763('0x16')]?_0x15bafe[_0x1763('0x16')][_0x1763('0x24')]||null:null,'include':_0x15bafe[_0x1763('0x16')]?_0x15bafe[_0x1763('0x16')][_0x1763('0x1a')]?_[_0x1763('0x1b')](_0x15bafe[_0x1763('0x16')][_0x1763('0x1a')],function(_0x2c61fe){return{'model':db[_0x2c61fe['model']],'as':_0x2c61fe['as'],'attributes':_0x2c61fe['as']===_0x1763('0x2d')?_[_0x1763('0x2e')](_0x30ce01):_0x2c61fe[_0x1763('0x19')],'include':_0x2c61fe[_0x1763('0x1a')]?_[_0x1763('0x1b')](_0x2c61fe[_0x1763('0x1a')],function(_0x41fa63){return{'model':db[_0x41fa63[_0x1763('0x1c')]],'as':_0x41fa63['as'],'attributes':_0x41fa63[_0x1763('0x19')],'include':_0x41fa63[_0x1763('0x1a')]?_[_0x1763('0x1b')](_0x41fa63[_0x1763('0x1a')],function(_0x47feb3){return{'model':db[_0x47feb3[_0x1763('0x1c')]],'as':_0x47feb3['as'],'attributes':_0x47feb3[_0x1763('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54b93f){logger[_0x1763('0xb')](_0x1763('0x14'),_0x15bafe);logger[_0x1763('0xe')](_0x1763('0x14'),_0x15bafe,JSON[_0x1763('0x10')](_0x54b93f));_0x515cb1(_0x54b93f);})[_0x1763('0x13')](function(_0x1d7559){logger[_0x1763('0x11')](_0x1763('0x14'),_0x1d7559['message'],_0x15bafe);_0x512074(_0x411b64['error'](0x1f4,_0x1d7559[_0x1763('0x12')]));});});});};exports[_0x1763('0x44')]=function(_0x1a42ff){_this=this;return new Promise(function(_0x496de2,_0x3e5d92){return db[_0x1763('0x27')]['findOne']({'raw':!![],'where':{'phone':_0x1a42ff[_0x1763('0x16')][_0x1763('0x18')][_0x1763('0x45')]},'attributes':['id',_0x1763('0x46')],'order':[['id',_0x1763('0x47')]]})[_0x1763('0xa')](function(_0x2198d1){logger[_0x1763('0xb')](_0x1763('0x48'),_0x1a42ff);logger[_0x1763('0xe')](_0x1763('0x48'),_0x1a42ff,JSON[_0x1763('0x10')](_0x2198d1));_0x496de2(_0x2198d1);})['catch'](function(_0xbaa1c8){logger[_0x1763('0x11')](_0x1763('0x48'),_0xbaa1c8[_0x1763('0x12')],_0x1a42ff);_0x3e5d92(_this[_0x1763('0x11')](0x1f4,_0xbaa1c8['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 2403e3b..7af03e9 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 _0x33c5=['getOpenContacts','/timezones','getTimezones','show','post','create','getPreview','/timezone','getTimezone','put','/:id','update','delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/opencontacts'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x33c5,0xe6));var _0x533c=function(_0x83609a,_0x4623de){_0x83609a=_0x83609a-0x0;var _0x3de3aa=_0x33c5[_0x83609a];return _0x3de3aa;};'use strict';var multer=require('multer');var util=require(_0x533c('0x0'));var path=require(_0x533c('0x1'));var timeout=require('connect-timeout');var express=require(_0x533c('0x2'));var router=express[_0x533c('0x3')]();var auth=require(_0x533c('0x4'));var interaction=require(_0x533c('0x5'));var config=require(_0x533c('0x6'));var controller=require('./cmHopper.controller');router[_0x533c('0x7')]('/',auth[_0x533c('0x8')](),controller[_0x533c('0x9')]);router[_0x533c('0x7')](_0x533c('0xa'),auth[_0x533c('0x8')](),controller[_0x533c('0xb')]);router[_0x533c('0x7')](_0x533c('0xc'),auth[_0x533c('0x8')](),controller[_0x533c('0xd')]);router[_0x533c('0x7')](_0x533c('0xe'),auth[_0x533c('0x8')](),controller[_0x533c('0xf')]);router[_0x533c('0x7')]('/:id',auth[_0x533c('0x8')](),controller[_0x533c('0x10')]);router[_0x533c('0x11')]('/',auth[_0x533c('0x8')](),controller[_0x533c('0x12')]);router[_0x533c('0x11')]('/preview',auth[_0x533c('0x8')](),controller[_0x533c('0x13')]);router[_0x533c('0x11')](_0x533c('0x14'),auth[_0x533c('0x8')](),controller[_0x533c('0x15')]);router[_0x533c('0x16')](_0x533c('0x17'),auth['isAuthenticated'](),controller[_0x533c('0x18')]);router[_0x533c('0x19')](_0x533c('0x17'),auth[_0x533c('0x8')](),controller['destroy']);module[_0x533c('0x1a')]=router; \ No newline at end of file +var _0x8958=['util','../../components/auth/service','../../config/environment','./cmHopper.controller','get','index','/describe','isAuthenticated','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','post','create','/preview','/timezone','update','delete','destroy'];(function(_0x128cc9,_0x24bbb3){var _0xc89705=function(_0x3d7817){while(--_0x3d7817){_0x128cc9['push'](_0x128cc9['shift']());}};_0xc89705(++_0x24bbb3);}(_0x8958,0x93));var _0x8895=function(_0x1af6b9,_0xb293ec){_0x1af6b9=_0x1af6b9-0x0;var _0x53aec1=_0x8958[_0x1af6b9];return _0x53aec1;};'use strict';var multer=require('multer');var util=require(_0x8895('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x8895('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0x8895('0x2'));var controller=require(_0x8895('0x3'));router[_0x8895('0x4')]('/',auth['isAuthenticated'](),controller[_0x8895('0x5')]);router[_0x8895('0x4')](_0x8895('0x6'),auth[_0x8895('0x7')](),controller[_0x8895('0x8')]);router['get'](_0x8895('0x9'),auth[_0x8895('0x7')](),controller[_0x8895('0xa')]);router[_0x8895('0x4')](_0x8895('0xb'),auth[_0x8895('0x7')](),controller[_0x8895('0xc')]);router[_0x8895('0x4')](_0x8895('0xd'),auth[_0x8895('0x7')](),controller['show']);router[_0x8895('0xe')]('/',auth[_0x8895('0x7')](),controller[_0x8895('0xf')]);router[_0x8895('0xe')](_0x8895('0x10'),auth[_0x8895('0x7')](),controller['getPreview']);router[_0x8895('0xe')](_0x8895('0x11'),auth[_0x8895('0x7')](),controller['getTimezone']);router['put'](_0x8895('0xd'),auth['isAuthenticated'](),controller[_0x8895('0x12')]);router[_0x8895('0x13')](_0x8895('0xd'),auth[_0x8895('0x7')](),controller[_0x8895('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 6f28740..8c7293a 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 _0xad77=['INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x5b3b9b,_0x1c71b0){var _0x47c1d7=function(_0x34c20b){while(--_0x34c20b){_0x5b3b9b['push'](_0x5b3b9b['shift']());}};_0x47c1d7(++_0x1c71b0);}(_0xad77,0x199));var _0x7ad7=function(_0x19e7e8,_0x2c265c){_0x19e7e8=_0x19e7e8-0x0;var _0x3103dd=_0xad77[_0x19e7e8];return _0x3103dd;};'use strict';var moment=require(_0x7ad7('0x0'));var Sequelize=require('sequelize');module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x7ad7('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x7ad7('0x2')],'defaultValue':moment()[_0x7ad7('0x3')](_0x7ad7('0x4'))},'countbusyretry':{'type':Sequelize[_0x7ad7('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7ad7('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7ad7('0x1')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x7ad7('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7ad7('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7ad7('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xfac1=['INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize'];(function(_0x42d939,_0x25c2eb){var _0x4bb66a=function(_0x497e09){while(--_0x497e09){_0x42d939['push'](_0x42d939['shift']());}};_0x4bb66a(++_0x25c2eb);}(_0xfac1,0x70));var _0x1fac=function(_0x2fb5fb,_0x2bfb1d){_0x2fb5fb=_0x2fb5fb-0x0;var _0x1dba0a=_0xfac1[_0x2fb5fb];return _0x1dba0a;};'use strict';var moment=require(_0x1fac('0x0'));var Sequelize=require(_0x1fac('0x1'));module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x1fac('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x1fac('0x3')],'defaultValue':moment()[_0x1fac('0x4')](_0x1fac('0x5'))},'countbusyretry':{'type':Sequelize[_0x1fac('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1fac('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1fac('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x1fac('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1fac('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1fac('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1fac('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1fac('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 32fb967..2d80b92 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 _0xffbe=['stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','CmHopperAdditionalPhones','UserProfileResource','destroy','end','error'];(function(_0x362100,_0x48ea74){var _0x12283b=function(_0x3ea0bb){while(--_0x3ea0bb){_0x362100['push'](_0x362100['shift']());}};_0x12283b(++_0x48ea74);}(_0xffbe,0x171));var _0xeffb=function(_0x5f1266,_0x506d62){_0x5f1266=_0x5f1266-0x0;var _0x50f3cb=_0xffbe[_0x5f1266];return _0x50f3cb;};'use strict';var pdf=require(_0xeffb('0x0'));var emlformat=require(_0xeffb('0x1'));var rimraf=require(_0xeffb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeffb('0x3'));var rp=require(_0xeffb('0x4'));var moment=require(_0xeffb('0x5'));var BPromise=require(_0xeffb('0x6'));var Mustache=require(_0xeffb('0x7'));var util=require(_0xeffb('0x8'));var path=require(_0xeffb('0x9'));var sox=require(_0xeffb('0xa'));var csv=require(_0xeffb('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeffb('0xc'));var squel=require(_0xeffb('0xd'));var crypto=require(_0xeffb('0xe'));var jsforce=require(_0xeffb('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xeffb('0x10'));var Papa=require(_0xeffb('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xeffb('0x12'));var as=require(_0xeffb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeffb('0x14'))('api');var utils=require(_0xeffb('0x15'));var config=require(_0xeffb('0x16'));var db=require(_0xeffb('0x17'))['db'];function respondWithStatusCode(_0x3a7849,_0x5d3e94){_0x5d3e94=_0x5d3e94||0xcc;return function(_0x4e7cb8){if(_0x4e7cb8){return _0x3a7849[_0xeffb('0x18')](_0x5d3e94);}return _0x3a7849[_0xeffb('0x19')](_0x5d3e94)['end']();};}function respondWithResult(_0x5bb4d9,_0x44921c){_0x44921c=_0x44921c||0xc8;return function(_0x327fe6){if(_0x327fe6){return _0x5bb4d9[_0xeffb('0x19')](_0x44921c)[_0xeffb('0x1a')](_0x327fe6);}};}function respondWithFilteredResult(_0x4915ee,_0x2ea75f){return function(_0x295ff4){if(_0x295ff4){var _0x1976bb=_0x295ff4[_0xeffb('0x1b')],_0x18e925=_0x2ea75f[_0xeffb('0x1c')],_0x469087=_0x2ea75f['offset']+_0x2ea75f[_0xeffb('0x1d')],_0x37d2d7;if(_0x469087>=_0x1976bb){_0x469087=_0x1976bb;_0x37d2d7=0xc8;}else{_0x37d2d7=0xce;}_0x4915ee[_0xeffb('0x19')](_0x37d2d7);return _0x4915ee['set'](_0xeffb('0x1e'),_0x18e925+'-'+_0x469087+'/'+_0x1976bb)['json'](_0x295ff4);}return null;};}function patchUpdates(_0x14882e){return function(_0x585169){try{jsonpatch[_0xeffb('0x1f')](_0x585169,_0x14882e,!![]);}catch(_0x2e1f28){return BPromise[_0xeffb('0x20')](_0x2e1f28);}return _0x585169[_0xeffb('0x21')]();};}function saveUpdates(_0x1fdb29,_0x40cce9){return function(_0xd8e066){if(_0xd8e066){return _0xd8e066[_0xeffb('0x22')](_0x1fdb29)[_0xeffb('0x23')](function(_0x405be3){return _0x405be3;});}return null;};}function removeEntity(_0x5dc03e,_0x303ea7){return function(_0xac41b8){if(_0xac41b8){return _0xac41b8['destroy']()[_0xeffb('0x23')](function(){var _0x6d0208=_0xac41b8['get']({'plain':!![]});var _0x2b30f8=_0xeffb('0x24');return db[_0xeffb('0x25')][_0xeffb('0x26')]({'where':{'type':_0x2b30f8,'resourceId':_0x6d0208['id']}})[_0xeffb('0x23')](function(){return _0xac41b8;});})[_0xeffb('0x23')](function(){_0x5dc03e['status'](0xcc)[_0xeffb('0x27')]();});}};}function handleEntityNotFound(_0x2a148e,_0x7bf828){return function(_0x4752f6){if(!_0x4752f6){_0x2a148e[_0xeffb('0x18')](0x194);}return _0x4752f6;};}function handleError(_0x11f485,_0x59d617){_0x59d617=_0x59d617||0x1f4;return function(_0xb55a6c){logger[_0xeffb('0x28')](_0xb55a6c[_0xeffb('0x29')]);if(_0xb55a6c[_0xeffb('0x2a')]){delete _0xb55a6c[_0xeffb('0x2a')];}_0x11f485[_0xeffb('0x19')](_0x59d617)[_0xeffb('0x2b')](_0xb55a6c);};}exports[_0xeffb('0x2c')]=function(_0x3a096b,_0x56c4d6){var _0x49246b={},_0x1d03fd={},_0x553887={'count':0x0,'rows':[]};var _0x1af74c=_[_0xeffb('0x2d')](db[_0xeffb('0x2e')][_0xeffb('0x2f')],function(_0xfc0cef){return{'name':_0xfc0cef[_0xeffb('0x30')],'type':_0xfc0cef[_0xeffb('0x31')][_0xeffb('0x32')]};});_0x1d03fd[_0xeffb('0x33')]=_[_0xeffb('0x2d')](_0x1af74c,_0xeffb('0x2a'));_0x1d03fd['query']=_[_0xeffb('0x34')](_0x3a096b['query']);_0x1d03fd[_0xeffb('0x35')]=_[_0xeffb('0x36')](_0x1d03fd['model'],_0x1d03fd[_0xeffb('0x37')]);_0x49246b[_0xeffb('0x38')]=_[_0xeffb('0x36')](_0x1d03fd['model'],qs[_0xeffb('0x39')](_0x3a096b[_0xeffb('0x37')][_0xeffb('0x39')]));_0x49246b[_0xeffb('0x38')]=_0x49246b[_0xeffb('0x38')][_0xeffb('0x3a')]?_0x49246b[_0xeffb('0x38')]:_0x1d03fd['model'];if(!_0x3a096b[_0xeffb('0x37')]['hasOwnProperty'](_0xeffb('0x3b'))){_0x49246b['limit']=qs[_0xeffb('0x1d')](_0x3a096b[_0xeffb('0x37')]['limit']);_0x49246b['offset']=qs[_0xeffb('0x1c')](_0x3a096b[_0xeffb('0x37')][_0xeffb('0x1c')]);}_0x49246b[_0xeffb('0x3c')]=qs['sort'](_0x3a096b[_0xeffb('0x37')][_0xeffb('0x3d')]);_0x49246b[_0xeffb('0x3e')]=qs[_0xeffb('0x35')](_[_0xeffb('0x3f')](_0x3a096b[_0xeffb('0x37')],_0x1d03fd[_0xeffb('0x35')]),_0x1af74c);if(_0x3a096b[_0xeffb('0x37')][_0xeffb('0x40')]){_0x49246b[_0xeffb('0x3e')]=_[_0xeffb('0x41')](_0x49246b[_0xeffb('0x3e')],{'$or':_['map'](_0x1af74c,function(_0x219992){if(_0x219992[_0xeffb('0x31')]!==_0xeffb('0x42')){var _0x2891eb={};_0x2891eb[_0x219992['name']]={'$like':'%'+_0x3a096b[_0xeffb('0x37')][_0xeffb('0x40')]+'%'};return _0x2891eb;}})});}_0x49246b=_[_0xeffb('0x41')]({},_0x49246b,_0x3a096b[_0xeffb('0x43')]);var _0x464e28={'where':_0x49246b[_0xeffb('0x3e')]};return db[_0xeffb('0x2e')]['count'](_0x464e28)[_0xeffb('0x23')](function(_0x3c9e02){_0x553887[_0xeffb('0x1b')]=_0x3c9e02;if(_0x3a096b['query']['includeAll']){_0x49246b[_0xeffb('0x44')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0xeffb('0x45')](_0x49246b);})[_0xeffb('0x23')](function(_0x498a88){_0x553887[_0xeffb('0x46')]=_0x498a88;return _0x553887;})[_0xeffb('0x23')](respondWithFilteredResult(_0x56c4d6,_0x49246b))[_0xeffb('0x47')](handleError(_0x56c4d6,null));};exports[_0xeffb('0x48')]=function(_0x57a9dc,_0x40140a){var _0x5afe99={'raw':!![],'where':{'id':_0x57a9dc['params']['id']}},_0x37d17b={};_0x37d17b[_0xeffb('0x33')]=_['keys'](db[_0xeffb('0x2e')]['rawAttributes']);_0x37d17b[_0xeffb('0x37')]=_[_0xeffb('0x34')](_0x57a9dc[_0xeffb('0x37')]);_0x37d17b[_0xeffb('0x35')]=_['intersection'](_0x37d17b['model'],_0x37d17b[_0xeffb('0x37')]);_0x5afe99['attributes']=_[_0xeffb('0x36')](_0x37d17b[_0xeffb('0x33')],qs[_0xeffb('0x39')](_0x57a9dc[_0xeffb('0x37')][_0xeffb('0x39')]));_0x5afe99['attributes']=_0x5afe99['attributes'][_0xeffb('0x3a')]?_0x5afe99[_0xeffb('0x38')]:_0x37d17b[_0xeffb('0x33')];if(_0x57a9dc[_0xeffb('0x37')][_0xeffb('0x49')]){_0x5afe99[_0xeffb('0x44')]=[{'all':!![]}];}_0x5afe99=_[_0xeffb('0x41')]({},_0x5afe99,_0x57a9dc[_0xeffb('0x43')]);return db[_0xeffb('0x2e')][_0xeffb('0x4a')](_0x5afe99)[_0xeffb('0x23')](handleEntityNotFound(_0x40140a,null))[_0xeffb('0x23')](respondWithResult(_0x40140a,null))['catch'](handleError(_0x40140a,null));};exports[_0xeffb('0x4b')]=function(_0x2ec105,_0x154bca){return db['CmHopperAdditionalPhone'][_0xeffb('0x4b')](_0x2ec105[_0xeffb('0x4c')],{})['then'](function(_0xf3e9fd){var _0x2cb5b8=_0x2ec105['user'][_0xeffb('0x4d')]({'plain':!![]});if(!_0x2cb5b8)throw new Error(_0xeffb('0x4e'));if(_0x2cb5b8['role']==='user'){var _0x14a87b=_0xf3e9fd[_0xeffb('0x4d')]({'plain':!![]});var _0x2ad3ae='CmHopperAdditionalPhones';return db[_0xeffb('0x4f')][_0xeffb('0x4a')]({'where':{'name':_0x2ad3ae,'userProfileId':_0x2cb5b8['userProfileId']},'raw':!![]})[_0xeffb('0x23')](function(_0x52f668){if(_0x52f668&&_0x52f668['autoAssociation']===0x0){return db[_0xeffb('0x25')][_0xeffb('0x4b')]({'name':_0x14a87b['name'],'resourceId':_0x14a87b['id'],'type':_0x52f668[_0xeffb('0x2a')],'sectionId':_0x52f668['id']},{})[_0xeffb('0x23')](function(){return _0xf3e9fd;});}else{return _0xf3e9fd;}})[_0xeffb('0x47')](function(_0x68f48d){logger['error'](_0xeffb('0x50'),_0x68f48d);throw _0x68f48d;});}return _0xf3e9fd;})['then'](respondWithResult(_0x154bca,0xc9))['catch'](handleError(_0x154bca,null));};exports[_0xeffb('0x22')]=function(_0x490cf,_0x35afc5){if(_0x490cf['body']['id']){delete _0x490cf[_0xeffb('0x4c')]['id'];}return db[_0xeffb('0x2e')][_0xeffb('0x4a')]({'where':{'id':_0x490cf[_0xeffb('0x51')]['id']}})['then'](handleEntityNotFound(_0x35afc5,null))['then'](saveUpdates(_0x490cf[_0xeffb('0x4c')],null))[_0xeffb('0x23')](respondWithResult(_0x35afc5,null))[_0xeffb('0x47')](handleError(_0x35afc5,null));};exports['destroy']=function(_0x82961f,_0x5a7ec3){return db['CmHopperAdditionalPhone'][_0xeffb('0x4a')]({'where':{'id':_0x82961f[_0xeffb('0x51')]['id']}})[_0xeffb('0x23')](handleEntityNotFound(_0x5a7ec3,null))[_0xeffb('0x23')](removeEntity(_0x5a7ec3,null))['catch'](handleError(_0x5a7ec3,null));}; \ No newline at end of file +var _0x2577=['sendStatus','status','json','offset','set','apply','reject','save','update','then','get','CmHopperAdditionalPhones','UserProfileResource','end','error','stack','name','send','map','CmHopperAdditionalPhone','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','merge','filter','options','count','includeAll','include','findAll','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x2577,0xcd));var _0x7257=function(_0x3c0964,_0x48416f){_0x3c0964=_0x3c0964-0x0;var _0x44bb35=_0x2577[_0x3c0964];return _0x44bb35;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7257('0x0'));var rimraf=require(_0x7257('0x1'));var zipdir=require(_0x7257('0x2'));var jsonpatch=require(_0x7257('0x3'));var rp=require(_0x7257('0x4'));var moment=require(_0x7257('0x5'));var BPromise=require(_0x7257('0x6'));var Mustache=require('mustache');var util=require(_0x7257('0x7'));var path=require(_0x7257('0x8'));var sox=require(_0x7257('0x9'));var csv=require(_0x7257('0xa'));var ejs=require(_0x7257('0xb'));var fs=require('fs');var _=require(_0x7257('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7257('0xd'));var deskjs=require(_0x7257('0xe'));var toCsv=require(_0x7257('0xa'));var querystring=require(_0x7257('0xf'));var Papa=require(_0x7257('0x10'));var Redis=require('ioredis');var authService=require(_0x7257('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7257('0x12'));var hardwareService=require(_0x7257('0x13'));var logger=require(_0x7257('0x14'))('api');var utils=require(_0x7257('0x15'));var config=require(_0x7257('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4dba32,_0x5bb6a5){_0x5bb6a5=_0x5bb6a5||0xcc;return function(_0xb4eca8){if(_0xb4eca8){return _0x4dba32[_0x7257('0x17')](_0x5bb6a5);}return _0x4dba32[_0x7257('0x18')](_0x5bb6a5)['end']();};}function respondWithResult(_0x487787,_0x5db8b7){_0x5db8b7=_0x5db8b7||0xc8;return function(_0x3aea26){if(_0x3aea26){return _0x487787[_0x7257('0x18')](_0x5db8b7)[_0x7257('0x19')](_0x3aea26);}};}function respondWithFilteredResult(_0x409cd9,_0x6188a2){return function(_0x4ea229){if(_0x4ea229){var _0x5bb377=_0x4ea229['count'],_0x14cbc5=_0x6188a2[_0x7257('0x1a')],_0x56d9e1=_0x6188a2['offset']+_0x6188a2['limit'],_0x348dd0;if(_0x56d9e1>=_0x5bb377){_0x56d9e1=_0x5bb377;_0x348dd0=0xc8;}else{_0x348dd0=0xce;}_0x409cd9['status'](_0x348dd0);return _0x409cd9[_0x7257('0x1b')]('Content-Range',_0x14cbc5+'-'+_0x56d9e1+'/'+_0x5bb377)[_0x7257('0x19')](_0x4ea229);}return null;};}function patchUpdates(_0x3d5e0c){return function(_0xccd357){try{jsonpatch[_0x7257('0x1c')](_0xccd357,_0x3d5e0c,!![]);}catch(_0x30a193){return BPromise[_0x7257('0x1d')](_0x30a193);}return _0xccd357[_0x7257('0x1e')]();};}function saveUpdates(_0x3af686,_0x5b9610){return function(_0x661b1e){if(_0x661b1e){return _0x661b1e[_0x7257('0x1f')](_0x3af686)[_0x7257('0x20')](function(_0x211c4a){return _0x211c4a;});}return null;};}function removeEntity(_0x3512e9,_0x564f6b){return function(_0x8a4ee7){if(_0x8a4ee7){return _0x8a4ee7['destroy']()[_0x7257('0x20')](function(){var _0x53abcc=_0x8a4ee7[_0x7257('0x21')]({'plain':!![]});var _0x5255d8=_0x7257('0x22');return db[_0x7257('0x23')]['destroy']({'where':{'type':_0x5255d8,'resourceId':_0x53abcc['id']}})[_0x7257('0x20')](function(){return _0x8a4ee7;});})[_0x7257('0x20')](function(){_0x3512e9[_0x7257('0x18')](0xcc)[_0x7257('0x24')]();});}};}function handleEntityNotFound(_0x33a83b,_0x4d8c17){return function(_0x1fa668){if(!_0x1fa668){_0x33a83b[_0x7257('0x17')](0x194);}return _0x1fa668;};}function handleError(_0x1d174d,_0x36fe54){_0x36fe54=_0x36fe54||0x1f4;return function(_0x2c7e8e){logger[_0x7257('0x25')](_0x2c7e8e[_0x7257('0x26')]);if(_0x2c7e8e[_0x7257('0x27')]){delete _0x2c7e8e[_0x7257('0x27')];}_0x1d174d[_0x7257('0x18')](_0x36fe54)[_0x7257('0x28')](_0x2c7e8e);};}exports['index']=function(_0x5cecc8,_0x2c69a2){var _0x43a0cf={},_0x38244f={},_0xc919bf={'count':0x0,'rows':[]};var _0x23acc=_[_0x7257('0x29')](db[_0x7257('0x2a')]['rawAttributes'],function(_0x110b49){return{'name':_0x110b49[_0x7257('0x2b')],'type':_0x110b49[_0x7257('0x2c')]['key']};});_0x38244f[_0x7257('0x2d')]=_['map'](_0x23acc,_0x7257('0x27'));_0x38244f[_0x7257('0x2e')]=_[_0x7257('0x2f')](_0x5cecc8[_0x7257('0x2e')]);_0x38244f[_0x7257('0x30')]=_[_0x7257('0x31')](_0x38244f[_0x7257('0x2d')],_0x38244f[_0x7257('0x2e')]);_0x43a0cf[_0x7257('0x32')]=_[_0x7257('0x31')](_0x38244f[_0x7257('0x2d')],qs[_0x7257('0x33')](_0x5cecc8[_0x7257('0x2e')][_0x7257('0x33')]));_0x43a0cf[_0x7257('0x32')]=_0x43a0cf[_0x7257('0x32')][_0x7257('0x34')]?_0x43a0cf['attributes']:_0x38244f[_0x7257('0x2d')];if(!_0x5cecc8[_0x7257('0x2e')][_0x7257('0x35')](_0x7257('0x36'))){_0x43a0cf['limit']=qs[_0x7257('0x37')](_0x5cecc8[_0x7257('0x2e')][_0x7257('0x37')]);_0x43a0cf[_0x7257('0x1a')]=qs['offset'](_0x5cecc8[_0x7257('0x2e')][_0x7257('0x1a')]);}_0x43a0cf['order']=qs[_0x7257('0x38')](_0x5cecc8[_0x7257('0x2e')]['sort']);_0x43a0cf[_0x7257('0x39')]=qs['filters'](_['pick'](_0x5cecc8[_0x7257('0x2e')],_0x38244f[_0x7257('0x30')]),_0x23acc);if(_0x5cecc8[_0x7257('0x2e')]['filter']){_0x43a0cf[_0x7257('0x39')]=_[_0x7257('0x3a')](_0x43a0cf[_0x7257('0x39')],{'$or':_['map'](_0x23acc,function(_0x42dba8){if(_0x42dba8[_0x7257('0x2c')]!=='VIRTUAL'){var _0xfc561a={};_0xfc561a[_0x42dba8[_0x7257('0x27')]]={'$like':'%'+_0x5cecc8[_0x7257('0x2e')][_0x7257('0x3b')]+'%'};return _0xfc561a;}})});}_0x43a0cf=_[_0x7257('0x3a')]({},_0x43a0cf,_0x5cecc8[_0x7257('0x3c')]);var _0x2b878e={'where':_0x43a0cf[_0x7257('0x39')]};return db['CmHopperAdditionalPhone'][_0x7257('0x3d')](_0x2b878e)[_0x7257('0x20')](function(_0x4a1062){_0xc919bf[_0x7257('0x3d')]=_0x4a1062;if(_0x5cecc8[_0x7257('0x2e')][_0x7257('0x3e')]){_0x43a0cf[_0x7257('0x3f')]=[{'all':!![]}];}return db[_0x7257('0x2a')][_0x7257('0x40')](_0x43a0cf);})['then'](function(_0x59fa3b){_0xc919bf['rows']=_0x59fa3b;return _0xc919bf;})[_0x7257('0x20')](respondWithFilteredResult(_0x2c69a2,_0x43a0cf))[_0x7257('0x41')](handleError(_0x2c69a2,null));};exports['show']=function(_0x4f983f,_0x157f0a){var _0x27afaf={'raw':!![],'where':{'id':_0x4f983f[_0x7257('0x42')]['id']}},_0x3682d7={};_0x3682d7[_0x7257('0x2d')]=_[_0x7257('0x2f')](db['CmHopperAdditionalPhone']['rawAttributes']);_0x3682d7[_0x7257('0x2e')]=_[_0x7257('0x2f')](_0x4f983f[_0x7257('0x2e')]);_0x3682d7[_0x7257('0x30')]=_[_0x7257('0x31')](_0x3682d7[_0x7257('0x2d')],_0x3682d7['query']);_0x27afaf['attributes']=_['intersection'](_0x3682d7[_0x7257('0x2d')],qs[_0x7257('0x33')](_0x4f983f[_0x7257('0x2e')][_0x7257('0x33')]));_0x27afaf[_0x7257('0x32')]=_0x27afaf[_0x7257('0x32')][_0x7257('0x34')]?_0x27afaf['attributes']:_0x3682d7['model'];if(_0x4f983f[_0x7257('0x2e')][_0x7257('0x3e')]){_0x27afaf[_0x7257('0x3f')]=[{'all':!![]}];}_0x27afaf=_[_0x7257('0x3a')]({},_0x27afaf,_0x4f983f[_0x7257('0x3c')]);return db[_0x7257('0x2a')]['find'](_0x27afaf)[_0x7257('0x20')](handleEntityNotFound(_0x157f0a,null))[_0x7257('0x20')](respondWithResult(_0x157f0a,null))[_0x7257('0x41')](handleError(_0x157f0a,null));};exports[_0x7257('0x43')]=function(_0x4d7f86,_0x5e027d){return db[_0x7257('0x2a')][_0x7257('0x43')](_0x4d7f86[_0x7257('0x44')],{})[_0x7257('0x20')](function(_0x5011f3){var _0x3e8108=_0x4d7f86[_0x7257('0x45')]['get']({'plain':!![]});if(!_0x3e8108)throw new Error(_0x7257('0x46'));if(_0x3e8108[_0x7257('0x47')]===_0x7257('0x45')){var _0x3b4645=_0x5011f3[_0x7257('0x21')]({'plain':!![]});var _0x1cb2f1=_0x7257('0x22');return db[_0x7257('0x48')][_0x7257('0x49')]({'where':{'name':_0x1cb2f1,'userProfileId':_0x3e8108['userProfileId']},'raw':!![]})[_0x7257('0x20')](function(_0x5a3c38){if(_0x5a3c38&&_0x5a3c38[_0x7257('0x4a')]===0x0){return db[_0x7257('0x23')][_0x7257('0x43')]({'name':_0x3b4645[_0x7257('0x27')],'resourceId':_0x3b4645['id'],'type':_0x5a3c38[_0x7257('0x27')],'sectionId':_0x5a3c38['id']},{})[_0x7257('0x20')](function(){return _0x5011f3;});}else{return _0x5011f3;}})['catch'](function(_0x53e3ef){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53e3ef);throw _0x53e3ef;});}return _0x5011f3;})[_0x7257('0x20')](respondWithResult(_0x5e027d,0xc9))[_0x7257('0x41')](handleError(_0x5e027d,null));};exports[_0x7257('0x1f')]=function(_0x8deb0c,_0x5edb48){if(_0x8deb0c[_0x7257('0x44')]['id']){delete _0x8deb0c[_0x7257('0x44')]['id'];}return db[_0x7257('0x2a')]['find']({'where':{'id':_0x8deb0c['params']['id']}})[_0x7257('0x20')](handleEntityNotFound(_0x5edb48,null))[_0x7257('0x20')](saveUpdates(_0x8deb0c['body'],null))['then'](respondWithResult(_0x5edb48,null))[_0x7257('0x41')](handleError(_0x5edb48,null));};exports[_0x7257('0x4b')]=function(_0x527db6,_0x17b9fb){return db['CmHopperAdditionalPhone'][_0x7257('0x49')]({'where':{'id':_0x527db6['params']['id']}})['then'](handleEntityNotFound(_0x17b9fb,null))[_0x7257('0x20')](removeEntity(_0x17b9fb,null))['catch'](handleError(_0x17b9fb,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index f5a79bd..4063bf4 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 _0x0903=['../../config/environment','exports','define','CmHopperAdditionalPhone','lodash','util','request-promise','rimraf'];(function(_0x3a94df,_0x299f0d){var _0x13b1b2=function(_0x57cfa5){while(--_0x57cfa5){_0x3a94df['push'](_0x3a94df['shift']());}};_0x13b1b2(++_0x299f0d);}(_0x0903,0x1cc));var _0x3090=function(_0x3220bb,_0x342a03){_0x3220bb=_0x3220bb-0x0;var _0x23415c=_0x0903[_0x3220bb];return _0x23415c;};'use strict';var _=require(_0x3090('0x0'));var util=require(_0x3090('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3090('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3090('0x3'));var config=require(_0x3090('0x4'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x3090('0x5')]=function(_0x431fbf,_0x5b880a){return _0x431fbf[_0x3090('0x6')](_0x3090('0x7'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4192=['moment','request-promise','path','rimraf','../../config/environment','exports','define','cm_hopper_additional_phones','util','../../config/logger','api'];(function(_0x39758d,_0x346423){var _0x44ac11=function(_0x175008){while(--_0x175008){_0x39758d['push'](_0x39758d['shift']());}};_0x44ac11(++_0x346423);}(_0x4192,0x17e));var _0x2419=function(_0x4fdb2e,_0x1f0ad9){_0x4fdb2e=_0x4fdb2e-0x0;var _0x2f415a=_0x4192[_0x4fdb2e];return _0x2f415a;};'use strict';var _=require('lodash');var util=require(_0x2419('0x0'));var logger=require(_0x2419('0x1'))(_0x2419('0x2'));var moment=require(_0x2419('0x3'));var BPromise=require('bluebird');var rp=require(_0x2419('0x4'));var fs=require('fs');var path=require(_0x2419('0x5'));var rimraf=require(_0x2419('0x6'));var config=require(_0x2419('0x7'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x2419('0x8')]=function(_0x164910,_0x4e33f0){return _0x164910[_0x2419('0x9')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x2419('0xa'),'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 df36aa8..5313293 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 _0x3b15=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperAdditionalPhone,\x20%s,\x20%s','message','info','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','CampaignId','then','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','countnosuchnumberretry','countdropretry','ListId','waitTime','scheduledat','add','minutes','phone','isNil','updatedAt','countabandonedretry','hopperToAdd','additionalToHop','transaction','update','IncrementPreviewCounters','field','lodash','util','bluebird','randomstring','ioredis'];(function(_0x3ae96c,_0x5f1e7e){var _0x1b0c90=function(_0x1ecc83){while(--_0x1ecc83){_0x3ae96c['push'](_0x3ae96c['shift']());}};_0x1b0c90(++_0x5f1e7e);}(_0x3b15,0x1e1));var _0x53b1=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x3b15[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x53b1('0x0'));var util=require(_0x53b1('0x1'));var moment=require('moment');var BPromise=require(_0x53b1('0x2'));var rs=require(_0x53b1('0x3'));var fs=require('fs');var Redis=require(_0x53b1('0x4'));var db=require(_0x53b1('0x5'))['db'];var utils=require(_0x53b1('0x6'));var logger=require('../../config/logger')(_0x53b1('0x7'));var config=require(_0x53b1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x53b1('0x9')][_0x53b1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1dbc23,_0x107f3e,_0x19d552){return new BPromise(function(_0x25fb33,_0xc1d060){return client[_0x53b1('0xb')](_0x1dbc23,_0x19d552)['then'](function(_0x1c19b6){logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x107f3e,'request\x20sent');logger[_0x53b1('0xc')](_0x53b1('0xd'),_0x107f3e,'request\x20sent',JSON[_0x53b1('0xe')](_0x1c19b6));if(_0x1c19b6['error']){if(_0x1c19b6[_0x53b1('0xf')]['code']===0x1f4){logger[_0x53b1('0xf')](_0x53b1('0x10'),_0x107f3e,_0x1c19b6['error']['message']);return _0xc1d060(_0x1c19b6['error'][_0x53b1('0x11')]);}logger[_0x53b1('0xf')](_0x53b1('0x10'),_0x107f3e,_0x1c19b6[_0x53b1('0xf')][_0x53b1('0x11')]);return _0x25fb33(_0x1c19b6[_0x53b1('0xf')][_0x53b1('0x11')]);}else{logger[_0x53b1('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x107f3e,'request\x20sent');_0x25fb33(_0x1c19b6['result']['message']);}})[_0x53b1('0x13')](function(_0x5d4f62){logger[_0x53b1('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x107f3e,_0x5d4f62);_0xc1d060(_0x5d4f62);});});}exports[_0x53b1('0x14')]=function(_0x18840d){var _0x570185=this;return new Promise(function(_0x10e651,_0x59ccc7){return db[_0x53b1('0x15')][_0x53b1('0x16')]({'raw':!![],'where':{'ContactId':_0x18840d[_0x53b1('0x17')][_0x53b1('0x18')],'ListId':_0x18840d['body']['ListId'],'VoiceQueueId':_0x18840d['body']['VoiceQueueId']===undefined?null:_0x18840d['body']['VoiceQueueId'],'CampaignId':_0x18840d['body'][_0x53b1('0x19')]===undefined?null:_0x18840d[_0x53b1('0x17')]['CampaignId']}})[_0x53b1('0x1a')](function(_0x99c309){if(_0x99c309!=null){return db['CmHopperAdditionalPhone'][_0x53b1('0x16')]({'raw':!![],'where':{'CmHopperId':_0x99c309['id'],'OrderBy':{'$gt':_0x99c309[_0x53b1('0x1b')]}},'order':[[_0x53b1('0x1b'),_0x53b1('0x1c')]]})[_0x53b1('0x1a')](function(_0x198de6){var _0x1ab960=0x0;if(_0x198de6){if(_0x198de6[_0x53b1('0x1d')]+_0x198de6[_0x53b1('0x1e')]+_0x198de6[_0x53b1('0x1f')]+_0x198de6['countnosuchnumberretry']+_0x198de6['countdropretry']+_0x198de6['countabandonedretry']+_0x198de6[_0x53b1('0x20')]+_0x198de6[_0x53b1('0x21')]<_0x18840d[_0x53b1('0x22')][_0x53b1('0x23')])_0x1ab960=0x1;_0x10e651({'additional':_0x1ab960});}else{return db[_0x53b1('0x24')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x99c309['id']},'order':[[_0x53b1('0x1b'),_0x53b1('0x1c')]]})[_0x53b1('0x1a')](function(_0x4d455f){var _0x26a8d0=0x0;if(_0x4d455f){if(_0x4d455f[_0x53b1('0x1d')]+_0x4d455f[_0x53b1('0x1e')]+_0x4d455f[_0x53b1('0x1f')]+_0x4d455f[_0x53b1('0x25')]+_0x4d455f[_0x53b1('0x26')]+_0x4d455f['countabandonedretry']+_0x4d455f[_0x53b1('0x20')]+_0x4d455f['countagentrejectretry']<_0x18840d['entity'][_0x53b1('0x23')])_0x26a8d0=0x1;_0x10e651({'additional':_0x26a8d0});}else{_0x10e651({'additional':0x0});}})[_0x53b1('0x13')](function(_0x3331c5){logger[_0x53b1('0xf')](_0x53b1('0x14'),_0x3331c5['message'],_0x18840d);_0x59ccc7(_0x570185[_0x53b1('0xf')](0x1f4,_0x3331c5[_0x53b1('0x11')]));});}})[_0x53b1('0x13')](function(_0x403adb){logger['error'](_0x53b1('0x14'),_0x403adb[_0x53b1('0x11')],_0x18840d);_0x59ccc7(_0x570185['error'](0x1f4,_0x403adb['message']));});}else _0x10e651({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x1d7fea){var _0x1d80ce=this;return new Promise(function(_0xa30cea,_0xbc2f40){return db[_0x53b1('0x15')][_0x53b1('0x16')]({'raw':!![],'where':{'ContactId':_0x1d7fea[_0x53b1('0x17')]['ContactId'],'ListId':_0x1d7fea['body'][_0x53b1('0x27')],'VoiceQueueId':_0x1d7fea['body']['VoiceQueueId']===undefined?null:_0x1d7fea['body']['VoiceQueueId'],'CampaignId':_0x1d7fea[_0x53b1('0x17')][_0x53b1('0x19')]===undefined?null:_0x1d7fea[_0x53b1('0x17')][_0x53b1('0x19')]}})['then'](function(_0x1f1e09){if(_0x1f1e09!=null){return db['CmHopperAdditionalPhone'][_0x53b1('0x16')]({'raw':!![],'where':{'CmHopperId':_0x1f1e09['id'],'OrderBy':{'$gt':_0x1f1e09['OrderBy']}},'order':[[_0x53b1('0x1b'),_0x53b1('0x1c')]]})['then'](function(_0x308db0){if(_0x308db0)return activateAdditionalPhone(_0x1f1e09,_0x1d7fea[_0x53b1('0x17')],_0x308db0,_0x1d7fea['duration'],_0x1d7fea[_0x53b1('0x28')])[_0x53b1('0x1a')](function(_0x1545fb){_0xa30cea(_0x1545fb);});else{return db[_0x53b1('0x24')][_0x53b1('0x16')]({'raw':!![],'where':{'CmHopperId':_0x1f1e09['id']},'order':[[_0x53b1('0x1b'),_0x53b1('0x1c')]]})[_0x53b1('0x1a')](function(_0x402a1a){if(_0x402a1a)return activateAdditionalPhone(_0x1f1e09,_0x1d7fea[_0x53b1('0x17')],_0x402a1a,_0x1d7fea['duration'],_0x1d7fea[_0x53b1('0x28')])[_0x53b1('0x1a')](function(_0x3e21be){_0xa30cea(_0x3e21be);});else{_0xa30cea({'id':_0x1f1e09['id'],'phone':''});}})[_0x53b1('0x13')](function(_0x52bba6){logger[_0x53b1('0xf')](_0x53b1('0x14'),_0x52bba6[_0x53b1('0x11')],_0x1d7fea);_0xbc2f40(_0x1d80ce[_0x53b1('0xf')](0x1f4,_0x52bba6[_0x53b1('0x11')]));});}})[_0x53b1('0x13')](function(_0x222dac){logger[_0x53b1('0xf')]('VerifyAdditionalPhones',_0x222dac['message'],_0x1d7fea);_0xbc2f40(_0x1d80ce['error'](0x1f4,_0x222dac[_0x53b1('0x11')]));});}else _0xa30cea(0x1);});});};function activateAdditionalPhone(_0x132936,_0x4183d9,_0x1215f6,_0x261c38,_0x3f1e40){return new Promise(function(_0x4d8ce6,_0x4d8697){logger[_0x53b1('0x12')](_0x53b1('0x14'),_0x1215f6);var _0x6e3067;if(moment()>moment(_0x1215f6[_0x53b1('0x29')])){_0x6e3067=moment()[_0x53b1('0x2a')](_0x3f1e40||0x3,_0x53b1('0x2b'));}else{if(_0x1215f6[_0x53b1('0x1b')]==0x0){_0x6e3067=moment(_0x1215f6[_0x53b1('0x29')]);}else{_0x6e3067=moment()[_0x53b1('0x2a')](_0x3f1e40||0x3,_0x53b1('0x2b'));}}var _0x29ddd3={'phone':_0x132936[_0x53b1('0x2c')],'active':0x0,'OrderBy':_[_0x53b1('0x2d')](_0x132936[_0x53b1('0x1b')])?0x0:_0x132936['OrderBy'],'scheduledat':moment()['add'](_0x261c38||0x1,_0x53b1('0x2b')),'countbusyretry':_0x4183d9['countbusyretry'],'countcongestionretry':_0x4183d9[_0x53b1('0x1e')],'countnoanswerretry':_0x4183d9['countnoanswerretry'],'countnosuchnumberretry':_0x4183d9[_0x53b1('0x25')],'countdropretry':_0x4183d9['countdropretry'],'countabandonedretry':_0x4183d9['countabandonedretry'],'countmachineretry':_0x4183d9['countmachineretry'],'countagentrejectretry':_0x4183d9['countagentrejectretry'],'createdAt':_0x4183d9['createdAt'],'updatedAt':_0x4183d9[_0x53b1('0x2e')]};var _0x3c5d5f={'CmHopperId':_0x132936['id'],'phone':_0x1215f6['phone'],'active':0x0,'OrderBy':_[_0x53b1('0x2d')](_0x1215f6[_0x53b1('0x1b')])?0x0:_0x1215f6[_0x53b1('0x1b')],'scheduledat':_0x6e3067,'countbusyretry':_0x1215f6[_0x53b1('0x1d')],'countcongestionretry':_0x1215f6['countcongestionretry'],'countnoanswerretry':_0x1215f6[_0x53b1('0x1f')],'countnosuchnumberretry':_0x4183d9[_0x53b1('0x25')],'countdropretry':_0x4183d9[_0x53b1('0x26')],'countabandonedretry':_0x4183d9[_0x53b1('0x2f')],'countmachineretry':_0x4183d9[_0x53b1('0x20')],'countagentrejectretry':_0x4183d9[_0x53b1('0x21')],'createdAt':_0x1215f6['createdAt'],'updatedAt':_0x1215f6['updatedAt']};logger[_0x53b1('0x12')](_0x53b1('0x30'),_0x29ddd3);logger[_0x53b1('0x12')](_0x53b1('0x31'),_0x3c5d5f);return db['sequelize'][_0x53b1('0x32')](function(_0x117203){return db[_0x53b1('0x24')][_0x53b1('0x33')](_0x29ddd3,{'where':{'id':_0x1215f6['id']}},{'transaction':_0x117203})['then'](function(){return db[_0x53b1('0x15')][_0x53b1('0x33')](_0x3c5d5f,{'where':{'id':_0x132936['id']}},{'transaction':_0x117203});});})[_0x53b1('0x1a')](function(_0x123ad3){_0x4d8ce6({'id':_0x132936['id'],'phone':_0x1215f6[_0x53b1('0x2c')]});})['catch'](function(_0x56e677){logger['error'](_0x53b1('0x14'),_0x56e677[_0x53b1('0x11')],req);_0x4d8697(_this[_0x53b1('0xf')](0x1f4,_0x56e677[_0x53b1('0x11')]));});});}exports[_0x53b1('0x34')]=function(_0x357711){var _0x9c1649=this;return new Promise(function(_0x2b03cd,_0x27ce61){return db[_0x53b1('0x15')][_0x53b1('0x33')](_0x357711[_0x53b1('0x17')][_0x53b1('0x35')],{'where':{'id':_0x357711[_0x53b1('0x17')]['id']}})['then'](function(_0x792ebf){_0x2b03cd(_0x792ebf);})[_0x53b1('0x13')](function(_0x442bf2){logger[_0x53b1('0xf')](_0x53b1('0x34'),_0x442bf2['message'],_0x357711);_0x27ce61(_0x9c1649[_0x53b1('0xf')](0x1f4,_0x442bf2[_0x53b1('0x11')]));});});}; \ No newline at end of file +var _0xd660=['countnosuchnumberretry','countagentrejectretry','CmHopperAdditionalPhone','countbusyretry','countdropretry','countmachineretry','dialGlobalMaxRetry','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','phone','isNil','countabandonedretry','createdAt','updatedAt','hopperToAdd','transaction','update','field','IncrementPreviewCounters','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','OrderBy','ASC','countcongestionretry','countnoanswerretry'];(function(_0x1e8396,_0x5be510){var _0x4539c6=function(_0x1b459f){while(--_0x1b459f){_0x1e8396['push'](_0x1e8396['shift']());}};_0x4539c6(++_0x5be510);}(_0xd660,0xf3));var _0x0d66=function(_0x219a75,_0x4096eb){_0x219a75=_0x219a75-0x0;var _0x338782=_0xd660[_0x219a75];return _0x338782;};'use strict';var _=require(_0x0d66('0x0'));var util=require(_0x0d66('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d66('0x2'));var db=require(_0x0d66('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d66('0x4'))(_0x0d66('0x5'));var config=require('../../config/environment');var jayson=require(_0x0d66('0x6'));var client=jayson[_0x0d66('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x205a65,_0x31886b,_0x12452a){return new BPromise(function(_0x2ea4b0,_0x3811a8){return client[_0x0d66('0x8')](_0x205a65,_0x12452a)[_0x0d66('0x9')](function(_0x3d0c68){logger[_0x0d66('0xa')](_0x0d66('0xb'),_0x31886b,_0x0d66('0xc'));logger[_0x0d66('0xd')](_0x0d66('0xe'),_0x31886b,_0x0d66('0xc'),JSON[_0x0d66('0xf')](_0x3d0c68));if(_0x3d0c68['error']){if(_0x3d0c68[_0x0d66('0x10')][_0x0d66('0x11')]===0x1f4){logger['error'](_0x0d66('0xb'),_0x31886b,_0x3d0c68['error'][_0x0d66('0x12')]);return _0x3811a8(_0x3d0c68[_0x0d66('0x10')]['message']);}logger[_0x0d66('0x10')](_0x0d66('0xb'),_0x31886b,_0x3d0c68[_0x0d66('0x10')][_0x0d66('0x12')]);return _0x2ea4b0(_0x3d0c68['error'][_0x0d66('0x12')]);}else{logger['info'](_0x0d66('0xb'),_0x31886b,_0x0d66('0xc'));_0x2ea4b0(_0x3d0c68[_0x0d66('0x13')]['message']);}})[_0x0d66('0x14')](function(_0x5c1158){logger[_0x0d66('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x31886b,_0x5c1158);_0x3811a8(_0x5c1158);});});}exports[_0x0d66('0x15')]=function(_0x36247b){var _0xab7107=this;return new Promise(function(_0x4095d1,_0x6dd11e){return db[_0x0d66('0x16')][_0x0d66('0x17')]({'raw':!![],'where':{'ContactId':_0x36247b[_0x0d66('0x18')]['ContactId'],'ListId':_0x36247b[_0x0d66('0x18')][_0x0d66('0x19')],'VoiceQueueId':_0x36247b[_0x0d66('0x18')][_0x0d66('0x1a')]===undefined?null:_0x36247b[_0x0d66('0x18')][_0x0d66('0x1a')],'CampaignId':_0x36247b[_0x0d66('0x18')][_0x0d66('0x1b')]===undefined?null:_0x36247b['body'][_0x0d66('0x1b')]}})[_0x0d66('0x9')](function(_0x38255f){if(_0x38255f!=null){return db['CmHopperAdditionalPhone'][_0x0d66('0x17')]({'raw':!![],'where':{'CmHopperId':_0x38255f['id'],'OrderBy':{'$gt':_0x38255f[_0x0d66('0x1c')]}},'order':[[_0x0d66('0x1c'),_0x0d66('0x1d')]]})[_0x0d66('0x9')](function(_0x209f9d){var _0x2c1e26=0x0;if(_0x209f9d){if(_0x209f9d['countbusyretry']+_0x209f9d[_0x0d66('0x1e')]+_0x209f9d[_0x0d66('0x1f')]+_0x209f9d[_0x0d66('0x20')]+_0x209f9d['countdropretry']+_0x209f9d['countabandonedretry']+_0x209f9d['countmachineretry']+_0x209f9d[_0x0d66('0x21')]<_0x36247b['entity']['dialGlobalMaxRetry'])_0x2c1e26=0x1;_0x4095d1({'additional':_0x2c1e26});}else{return db[_0x0d66('0x22')][_0x0d66('0x17')]({'raw':!![],'where':{'CmHopperId':_0x38255f['id']},'order':[['OrderBy','ASC']]})['then'](function(_0x1363ad){var _0x54f293=0x0;if(_0x1363ad){if(_0x1363ad[_0x0d66('0x23')]+_0x1363ad[_0x0d66('0x1e')]+_0x1363ad[_0x0d66('0x1f')]+_0x1363ad[_0x0d66('0x20')]+_0x1363ad[_0x0d66('0x24')]+_0x1363ad['countabandonedretry']+_0x1363ad[_0x0d66('0x25')]+_0x1363ad[_0x0d66('0x21')]<_0x36247b['entity'][_0x0d66('0x26')])_0x54f293=0x1;_0x4095d1({'additional':_0x54f293});}else{_0x4095d1({'additional':0x0});}})[_0x0d66('0x14')](function(_0x5ed127){logger[_0x0d66('0x10')]('VerifyAdditionalPhones',_0x5ed127['message'],_0x36247b);_0x6dd11e(_0xab7107[_0x0d66('0x10')](0x1f4,_0x5ed127['message']));});}})[_0x0d66('0x14')](function(_0x425886){logger[_0x0d66('0x10')](_0x0d66('0x15'),_0x425886['message'],_0x36247b);_0x6dd11e(_0xab7107[_0x0d66('0x10')](0x1f4,_0x425886['message']));});}else _0x4095d1({'additional':0x0});});});};exports[_0x0d66('0x27')]=function(_0x2c98f7){var _0x507073=this;return new Promise(function(_0x1c3c7e,_0xfd8298){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x2c98f7[_0x0d66('0x18')]['ContactId'],'ListId':_0x2c98f7[_0x0d66('0x18')]['ListId'],'VoiceQueueId':_0x2c98f7['body'][_0x0d66('0x1a')]===undefined?null:_0x2c98f7['body'][_0x0d66('0x1a')],'CampaignId':_0x2c98f7[_0x0d66('0x18')][_0x0d66('0x1b')]===undefined?null:_0x2c98f7[_0x0d66('0x18')][_0x0d66('0x1b')]}})[_0x0d66('0x9')](function(_0x46cb72){if(_0x46cb72!=null){return db[_0x0d66('0x22')][_0x0d66('0x17')]({'raw':!![],'where':{'CmHopperId':_0x46cb72['id'],'OrderBy':{'$gt':_0x46cb72[_0x0d66('0x1c')]}},'order':[[_0x0d66('0x1c'),_0x0d66('0x1d')]]})[_0x0d66('0x9')](function(_0x37bc16){if(_0x37bc16)return activateAdditionalPhone(_0x46cb72,_0x2c98f7[_0x0d66('0x18')],_0x37bc16,_0x2c98f7[_0x0d66('0x28')],_0x2c98f7[_0x0d66('0x29')])['then'](function(_0x2832e6){_0x1c3c7e(_0x2832e6);});else{return db[_0x0d66('0x22')][_0x0d66('0x17')]({'raw':!![],'where':{'CmHopperId':_0x46cb72['id']},'order':[[_0x0d66('0x1c'),'ASC']]})[_0x0d66('0x9')](function(_0x2ee1c2){if(_0x2ee1c2)return activateAdditionalPhone(_0x46cb72,_0x2c98f7[_0x0d66('0x18')],_0x2ee1c2,_0x2c98f7[_0x0d66('0x28')],_0x2c98f7[_0x0d66('0x29')])[_0x0d66('0x9')](function(_0x174ef9){_0x1c3c7e(_0x174ef9);});else{_0x1c3c7e({'id':_0x46cb72['id'],'phone':''});}})['catch'](function(_0x219ee6){logger[_0x0d66('0x10')](_0x0d66('0x15'),_0x219ee6[_0x0d66('0x12')],_0x2c98f7);_0xfd8298(_0x507073['error'](0x1f4,_0x219ee6[_0x0d66('0x12')]));});}})['catch'](function(_0x60c608){logger[_0x0d66('0x10')]('VerifyAdditionalPhones',_0x60c608[_0x0d66('0x12')],_0x2c98f7);_0xfd8298(_0x507073[_0x0d66('0x10')](0x1f4,_0x60c608[_0x0d66('0x12')]));});}else _0x1c3c7e(0x1);});});};function activateAdditionalPhone(_0x4ef30d,_0x1baa47,_0x1626d9,_0x5a93e7,_0xa80f26){return new Promise(function(_0x26024d,_0x1f2b18){logger[_0x0d66('0xa')](_0x0d66('0x15'),_0x1626d9);var _0x314c51;if(moment()>moment(_0x1626d9[_0x0d66('0x2a')])){_0x314c51=moment()[_0x0d66('0x2b')](_0xa80f26||0x3,'minutes');}else{if(_0x1626d9['OrderBy']==0x0){_0x314c51=moment(_0x1626d9[_0x0d66('0x2a')]);}else{_0x314c51=moment()['add'](_0xa80f26||0x3,_0x0d66('0x2c'));}}var _0x58602f={'phone':_0x4ef30d[_0x0d66('0x2d')],'active':0x0,'OrderBy':_[_0x0d66('0x2e')](_0x4ef30d['OrderBy'])?0x0:_0x4ef30d[_0x0d66('0x1c')],'scheduledat':moment()[_0x0d66('0x2b')](_0x5a93e7||0x1,_0x0d66('0x2c')),'countbusyretry':_0x1baa47[_0x0d66('0x23')],'countcongestionretry':_0x1baa47['countcongestionretry'],'countnoanswerretry':_0x1baa47[_0x0d66('0x1f')],'countnosuchnumberretry':_0x1baa47[_0x0d66('0x20')],'countdropretry':_0x1baa47[_0x0d66('0x24')],'countabandonedretry':_0x1baa47[_0x0d66('0x2f')],'countmachineretry':_0x1baa47[_0x0d66('0x25')],'countagentrejectretry':_0x1baa47['countagentrejectretry'],'createdAt':_0x1baa47[_0x0d66('0x30')],'updatedAt':_0x1baa47['updatedAt']};var _0x153330={'CmHopperId':_0x4ef30d['id'],'phone':_0x1626d9[_0x0d66('0x2d')],'active':0x0,'OrderBy':_[_0x0d66('0x2e')](_0x1626d9['OrderBy'])?0x0:_0x1626d9[_0x0d66('0x1c')],'scheduledat':_0x314c51,'countbusyretry':_0x1626d9['countbusyretry'],'countcongestionretry':_0x1626d9[_0x0d66('0x1e')],'countnoanswerretry':_0x1626d9[_0x0d66('0x1f')],'countnosuchnumberretry':_0x1baa47[_0x0d66('0x20')],'countdropretry':_0x1baa47[_0x0d66('0x24')],'countabandonedretry':_0x1baa47[_0x0d66('0x2f')],'countmachineretry':_0x1baa47[_0x0d66('0x25')],'countagentrejectretry':_0x1baa47['countagentrejectretry'],'createdAt':_0x1626d9[_0x0d66('0x30')],'updatedAt':_0x1626d9[_0x0d66('0x31')]};logger[_0x0d66('0xa')](_0x0d66('0x32'),_0x58602f);logger['info']('additionalToHop',_0x153330);return db['sequelize'][_0x0d66('0x33')](function(_0x3b9827){return db[_0x0d66('0x22')][_0x0d66('0x34')](_0x58602f,{'where':{'id':_0x1626d9['id']}},{'transaction':_0x3b9827})['then'](function(){return db[_0x0d66('0x16')][_0x0d66('0x34')](_0x153330,{'where':{'id':_0x4ef30d['id']}},{'transaction':_0x3b9827});});})[_0x0d66('0x9')](function(_0x129852){_0x26024d({'id':_0x4ef30d['id'],'phone':_0x1626d9[_0x0d66('0x2d')]});})[_0x0d66('0x14')](function(_0x4df654){logger[_0x0d66('0x10')]('VerifyAdditionalPhones',_0x4df654[_0x0d66('0x12')],req);_0x1f2b18(_this[_0x0d66('0x10')](0x1f4,_0x4df654[_0x0d66('0x12')]));});});}exports['IncrementPreviewCounters']=function(_0x23600a){var _0x2302c1=this;return new Promise(function(_0x2dd3d8,_0x8901d8){return db[_0x0d66('0x16')][_0x0d66('0x34')](_0x23600a[_0x0d66('0x18')][_0x0d66('0x35')],{'where':{'id':_0x23600a[_0x0d66('0x18')]['id']}})['then'](function(_0x5575d6){_0x2dd3d8(_0x5575d6);})['catch'](function(_0x1256b9){logger[_0x0d66('0x10')](_0x0d66('0x36'),_0x1256b9[_0x0d66('0x12')],_0x23600a);_0x8901d8(_0x2302c1[_0x0d66('0x10')](0x1f4,_0x1256b9['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 90667bd..c82f266 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 _0xe516=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','create','put','destroy','exports'];(function(_0x41f171,_0x191ca6){var _0x52c91e=function(_0xe4e879){while(--_0xe4e879){_0x41f171['push'](_0x41f171['shift']());}};_0x52c91e(++_0x191ca6);}(_0xe516,0x17a));var _0x6e51=function(_0x53b199,_0x38ff21){_0x53b199=_0x53b199-0x0;var _0x1ba42d=_0xe516[_0x53b199];return _0x1ba42d;};'use strict';var multer=require(_0x6e51('0x0'));var util=require(_0x6e51('0x1'));var path=require(_0x6e51('0x2'));var timeout=require(_0x6e51('0x3'));var express=require('express');var router=express[_0x6e51('0x4')]();var auth=require(_0x6e51('0x5'));var interaction=require(_0x6e51('0x6'));var config=require(_0x6e51('0x7'));var controller=require(_0x6e51('0x8'));router[_0x6e51('0x9')]('/',auth[_0x6e51('0xa')](),controller[_0x6e51('0xb')]);router[_0x6e51('0x9')](_0x6e51('0xc'),auth[_0x6e51('0xa')](),controller[_0x6e51('0xd')]);router['post']('/',auth[_0x6e51('0xa')](),controller[_0x6e51('0xe')]);router[_0x6e51('0xf')](_0x6e51('0xc'),auth[_0x6e51('0xa')](),controller['update']);router['delete'](_0x6e51('0xc'),auth[_0x6e51('0xa')](),controller[_0x6e51('0x10')]);module[_0x6e51('0x11')]=router; \ No newline at end of file +var _0xa5fd=['./cmHopperAdditionalPhone.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','exports','path','connect-timeout','express','../../config/environment'];(function(_0x4cd4e4,_0x1857a2){var _0x18cf3b=function(_0x27ea45){while(--_0x27ea45){_0x4cd4e4['push'](_0x4cd4e4['shift']());}};_0x18cf3b(++_0x1857a2);}(_0xa5fd,0x173));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xda5f('0x0'));var timeout=require(_0xda5f('0x1'));var express=require(_0xda5f('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xda5f('0x3'));var controller=require(_0xda5f('0x4'));router[_0xda5f('0x5')]('/',auth[_0xda5f('0x6')](),controller['index']);router[_0xda5f('0x5')]('/:id',auth[_0xda5f('0x6')](),controller[_0xda5f('0x7')]);router[_0xda5f('0x8')]('/',auth['isAuthenticated'](),controller[_0xda5f('0x9')]);router[_0xda5f('0xa')](_0xda5f('0xb'),auth[_0xda5f('0x6')](),controller[_0xda5f('0xc')]);router[_0xda5f('0xd')](_0xda5f('0xb'),auth[_0xda5f('0x6')](),controller['destroy']);module[_0xda5f('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index fe1904b..1214802 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 _0x944d=['contactListQueue','sequelize','exports','STRING','INTEGER'];(function(_0x3ee685,_0x1fa765){var _0x134805=function(_0x5131fe){while(--_0x5131fe){_0x3ee685['push'](_0x3ee685['shift']());}};_0x134805(++_0x1fa765);}(_0x944d,0x1b4));var _0xd944=function(_0x32c8f6,_0xf3f53f){_0x32c8f6=_0x32c8f6-0x0;var _0x19d374=_0x944d[_0x32c8f6];return _0x19d374;};'use strict';var moment=require('moment');var Sequelize=require(_0xd944('0x0'));module[_0xd944('0x1')]={'phone':{'type':Sequelize[_0xd944('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xd944('0x3')],'unique':_0xd944('0x4')},'ListId':{'type':Sequelize[_0xd944('0x3')],'unique':_0xd944('0x4')},'VoiceQueueId':{'type':Sequelize[_0xd944('0x3')],'unique':_0xd944('0x4')}}; \ No newline at end of file +var _0x77ab=['contactListQueue','moment','sequelize','STRING','INTEGER'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x77ab,0x1aa));var _0xb77a=function(_0x219976,_0x4ab177){_0x219976=_0x219976-0x0;var _0x409947=_0x77ab[_0x219976];return _0x409947;};'use strict';var moment=require(_0xb77a('0x0'));var Sequelize=require(_0xb77a('0x1'));module['exports']={'phone':{'type':Sequelize[_0xb77a('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xb77a('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xb77a('0x3')],'unique':_0xb77a('0x4')},'VoiceQueueId':{'type':Sequelize[_0xb77a('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 93ae310..666ff96 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(_0x52fe4c,_0x11f4cc){var _0x10a76c=function(_0x130ab2){while(--_0x130ab2){_0x52fe4c['push'](_0x52fe4c['shift']());}};_0x10a76c(++_0x11f4cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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(_0x58f39f,_0x4d7829){var _0x46ae7e=function(_0x20ef7d){while(--_0x20ef7d){_0x58f39f['push'](_0x58f39f['shift']());}};_0x46ae7e(++_0x4d7829);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 8943bde..362ed5d 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 _0xe706=['request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','moment','bluebird'];(function(_0xa5856f,_0x58103f){var _0x240c61=function(_0x3498db){while(--_0x3498db){_0xa5856f['push'](_0xa5856f['shift']());}};_0x240c61(++_0x58103f);}(_0xe706,0xa3));var _0x6e70=function(_0x4f9c46,_0x361afe){_0x4f9c46=_0x4f9c46-0x0;var _0x155365=_0xe706[_0x4f9c46];return _0x155365;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['cm_hopper_black','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes'];(function(_0x56a7bc,_0x41d6f6){var _0x4f5883=function(_0x23e4a4){while(--_0x23e4a4){_0x56a7bc['push'](_0x56a7bc['shift']());}};_0x4f5883(++_0x41d6f6);}(_0x70e0,0x17b));var _0x070e=function(_0x314810,_0x5d0e31){_0x314810=_0x314810-0x0;var _0xec232d=_0x70e0[_0x314810];return _0xec232d;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('CmHopperBlack',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index ef05f4a..f7655e3 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 _0x96c2=['rpc','jayson/promise','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCmHopperBlack','findAll','options','where','limit','map','model','attributes','include','catch','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x53f5e9,_0x253cb0){var _0x445c06=function(_0x27f787){while(--_0x27f787){_0x53f5e9['push'](_0x53f5e9['shift']());}};_0x445c06(++_0x253cb0);}(_0x96c2,0x171));var _0x296c=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0x96c2[_0x238671];return _0x474844;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x296c('0x0'));var rs=require(_0x296c('0x1'));var fs=require('fs');var Redis=require(_0x296c('0x2'));var db=require(_0x296c('0x3'))['db'];var utils=require(_0x296c('0x4'));var logger=require('../../config/logger')(_0x296c('0x5'));var config=require('../../config/environment');var jayson=require(_0x296c('0x6'));var client=jayson['client'][_0x296c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xc39d10,_0x2c3838,_0x17fb59){return new BPromise(function(_0x3cacb9,_0x2c4dc9){return client[_0x296c('0x8')](_0xc39d10,_0x17fb59)[_0x296c('0x9')](function(_0x104d90){logger[_0x296c('0xa')](_0x296c('0xb'),_0x2c3838,_0x296c('0xc'));logger[_0x296c('0xd')](_0x296c('0xe'),_0x2c3838,_0x296c('0xc'),JSON[_0x296c('0xf')](_0x104d90));if(_0x104d90[_0x296c('0x10')]){if(_0x104d90['error'][_0x296c('0x11')]===0x1f4){logger['error'](_0x296c('0xb'),_0x2c3838,_0x104d90['error'][_0x296c('0x12')]);return _0x2c4dc9(_0x104d90['error'][_0x296c('0x12')]);}logger[_0x296c('0x10')](_0x296c('0xb'),_0x2c3838,_0x104d90[_0x296c('0x10')][_0x296c('0x12')]);return _0x3cacb9(_0x104d90['error']['message']);}else{logger[_0x296c('0xa')](_0x296c('0xb'),_0x2c3838,_0x296c('0xc'));_0x3cacb9(_0x104d90[_0x296c('0x13')][_0x296c('0x12')]);}})['catch'](function(_0x56d50d){logger[_0x296c('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x2c3838,_0x56d50d);_0x2c4dc9(_0x56d50d);});});}exports[_0x296c('0x14')]=function(_0xa0c592){var _0x394c41=this;return new Promise(function(_0xb113ca,_0x406c4d){return db['CmHopperBlack'][_0x296c('0x15')]({'raw':_0xa0c592[_0x296c('0x16')]?_0xa0c592['options']['raw']===undefined?!![]:![]:!![],'where':_0xa0c592['options']?_0xa0c592['options'][_0x296c('0x17')]||null:null,'attributes':_0xa0c592[_0x296c('0x16')]?_0xa0c592[_0x296c('0x16')]['attributes']||null:null,'limit':_0xa0c592[_0x296c('0x16')]?_0xa0c592['options'][_0x296c('0x18')]||null:null,'include':_0xa0c592[_0x296c('0x16')]?_0xa0c592['options']['include']?_[_0x296c('0x19')](_0xa0c592[_0x296c('0x16')]['include'],function(_0x2780d0){return{'model':db[_0x2780d0[_0x296c('0x1a')]],'as':_0x2780d0['as'],'attributes':_0x2780d0[_0x296c('0x1b')],'include':_0x2780d0[_0x296c('0x1c')]?_[_0x296c('0x19')](_0x2780d0[_0x296c('0x1c')],function(_0x6f859a){return{'model':db[_0x6f859a[_0x296c('0x1a')]],'as':_0x6f859a['as'],'attributes':_0x6f859a['attributes'],'include':_0x6f859a[_0x296c('0x1c')]?_[_0x296c('0x19')](_0x6f859a['include'],function(_0x51d4d3){return{'model':db[_0x51d4d3[_0x296c('0x1a')]],'as':_0x51d4d3['as'],'attributes':_0x51d4d3[_0x296c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x296c('0x9')](function(_0x508d8d){logger[_0x296c('0xa')](_0x296c('0x14'),_0xa0c592);logger['debug'](_0x296c('0x14'),_0xa0c592,JSON['stringify'](_0x508d8d));_0xb113ca(_0x508d8d);})[_0x296c('0x1d')](function(_0x1c2414){logger['error'](_0x296c('0x14'),_0x1c2414[_0x296c('0x12')],_0xa0c592);_0x406c4d(_0x394c41[_0x296c('0x10')](0x1f4,_0x1c2414[_0x296c('0x12')]));});});};exports[_0x296c('0x1e')]=function(_0x1ce75d){var _0x4c48e1=this;return new Promise(function(_0x27fa16,_0x5cad1d){return db['CmHopperBlack'][_0x296c('0x1f')](_0x1ce75d[_0x296c('0x20')],{'raw':_0x1ce75d[_0x296c('0x16')]?_0x1ce75d[_0x296c('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ce75d[_0x296c('0x16')]?_0x1ce75d[_0x296c('0x16')][_0x296c('0x17')]||null:null,'attributes':_0x1ce75d[_0x296c('0x16')]?_0x1ce75d['options'][_0x296c('0x1b')]||null:null,'limit':_0x1ce75d[_0x296c('0x16')]?_0x1ce75d[_0x296c('0x16')][_0x296c('0x18')]||null:null})[_0x296c('0x9')](function(_0x2d3f95){logger[_0x296c('0xa')](_0x296c('0x1e'),_0x1ce75d);logger[_0x296c('0xd')](_0x296c('0x1e'),_0x1ce75d,JSON[_0x296c('0xf')](_0x2d3f95));_0x27fa16(_0x2d3f95);})['catch'](function(_0x62ca9d){logger[_0x296c('0x10')]('UpdateCmHopperBlack',_0x62ca9d[_0x296c('0x12')],_0x1ce75d);_0x5cad1d(_0x4c48e1['error'](0x1f4,_0x62ca9d[_0x296c('0x12')]));});});};exports['DestroyCmHopperBlack']=function(_0x392868){var _0x757bf6=this;return new Promise(function(_0x4d6fef,_0x1b98e9){return db['CmHopperBlack']['destroy']({'where':_0x392868[_0x296c('0x16')]?_0x392868[_0x296c('0x16')]['where']||null:null})[_0x296c('0x9')](function(_0x1f0953){logger[_0x296c('0xa')](_0x296c('0x21'),_0x392868);logger['debug'](_0x296c('0x21'),_0x392868,JSON[_0x296c('0xf')](_0x1f0953));_0x4d6fef(_0x1f0953);})[_0x296c('0x1d')](function(_0x17ee2a){logger[_0x296c('0x10')](_0x296c('0x21'),_0x17ee2a[_0x296c('0x12')],_0x392868);_0x1b98e9(_0x757bf6[_0x296c('0x10')](0x1f4,_0x17ee2a['message']));});});}; \ No newline at end of file +var _0xda41=['options','where','limit','include','map','attributes','model','GetCmHopperBlack','UpdateCmHopperBlack','update','body','catch','DestroyCmHopperBlack','destroy','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CmHopperBlack','findAll','raw'];(function(_0x2b5b44,_0x17189c){var _0x32cb66=function(_0x4ce183){while(--_0x4ce183){_0x2b5b44['push'](_0x2b5b44['shift']());}};_0x32cb66(++_0x17189c);}(_0xda41,0x1ef));var _0x1da4=function(_0x310a54,_0x212d9a){_0x310a54=_0x310a54-0x0;var _0x4e4caa=_0xda41[_0x310a54];return _0x4e4caa;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1da4('0x0'));var BPromise=require('bluebird');var rs=require(_0x1da4('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1da4('0x2'))['db'];var utils=require(_0x1da4('0x3'));var logger=require(_0x1da4('0x4'))(_0x1da4('0x5'));var config=require(_0x1da4('0x6'));var jayson=require(_0x1da4('0x7'));var client=jayson['client'][_0x1da4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x164996,_0x48412f,_0x292d56){return new BPromise(function(_0xd8ed09,_0x5a8581){return client[_0x1da4('0x9')](_0x164996,_0x292d56)[_0x1da4('0xa')](function(_0x28141a){logger[_0x1da4('0xb')](_0x1da4('0xc'),_0x48412f,'request\x20sent');logger[_0x1da4('0xd')](_0x1da4('0xe'),_0x48412f,_0x1da4('0xf'),JSON[_0x1da4('0x10')](_0x28141a));if(_0x28141a['error']){if(_0x28141a[_0x1da4('0x11')]['code']===0x1f4){logger[_0x1da4('0x11')](_0x1da4('0xc'),_0x48412f,_0x28141a['error'][_0x1da4('0x12')]);return _0x5a8581(_0x28141a[_0x1da4('0x11')]['message']);}logger[_0x1da4('0x11')](_0x1da4('0xc'),_0x48412f,_0x28141a['error'][_0x1da4('0x12')]);return _0xd8ed09(_0x28141a['error'][_0x1da4('0x12')]);}else{logger[_0x1da4('0xb')](_0x1da4('0xc'),_0x48412f,'request\x20sent');_0xd8ed09(_0x28141a[_0x1da4('0x13')][_0x1da4('0x12')]);}})['catch'](function(_0x216e44){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x48412f,_0x216e44);_0x5a8581(_0x216e44);});});}exports['GetCmHopperBlack']=function(_0x55325d){var _0xc3df51=this;return new Promise(function(_0x540b7d,_0x31a196){return db[_0x1da4('0x14')][_0x1da4('0x15')]({'raw':_0x55325d['options']?_0x55325d['options'][_0x1da4('0x16')]===undefined?!![]:![]:!![],'where':_0x55325d[_0x1da4('0x17')]?_0x55325d['options'][_0x1da4('0x18')]||null:null,'attributes':_0x55325d[_0x1da4('0x17')]?_0x55325d['options']['attributes']||null:null,'limit':_0x55325d[_0x1da4('0x17')]?_0x55325d['options'][_0x1da4('0x19')]||null:null,'include':_0x55325d[_0x1da4('0x17')]?_0x55325d[_0x1da4('0x17')][_0x1da4('0x1a')]?_[_0x1da4('0x1b')](_0x55325d['options'][_0x1da4('0x1a')],function(_0x5ac6a0){return{'model':db[_0x5ac6a0['model']],'as':_0x5ac6a0['as'],'attributes':_0x5ac6a0[_0x1da4('0x1c')],'include':_0x5ac6a0['include']?_[_0x1da4('0x1b')](_0x5ac6a0['include'],function(_0x5c018a){return{'model':db[_0x5c018a[_0x1da4('0x1d')]],'as':_0x5c018a['as'],'attributes':_0x5c018a['attributes'],'include':_0x5c018a[_0x1da4('0x1a')]?_[_0x1da4('0x1b')](_0x5c018a[_0x1da4('0x1a')],function(_0x2aff3e){return{'model':db[_0x2aff3e['model']],'as':_0x2aff3e['as'],'attributes':_0x2aff3e['attributes']};}):[]};}):[]};}):[]:[]})[_0x1da4('0xa')](function(_0x4c8083){logger[_0x1da4('0xb')](_0x1da4('0x1e'),_0x55325d);logger[_0x1da4('0xd')](_0x1da4('0x1e'),_0x55325d,JSON[_0x1da4('0x10')](_0x4c8083));_0x540b7d(_0x4c8083);})['catch'](function(_0x45fca1){logger[_0x1da4('0x11')](_0x1da4('0x1e'),_0x45fca1[_0x1da4('0x12')],_0x55325d);_0x31a196(_0xc3df51[_0x1da4('0x11')](0x1f4,_0x45fca1['message']));});});};exports[_0x1da4('0x1f')]=function(_0x2af4cf){var _0x2c7d8e=this;return new Promise(function(_0xeaf9d7,_0x396fcb){return db[_0x1da4('0x14')][_0x1da4('0x20')](_0x2af4cf[_0x1da4('0x21')],{'raw':_0x2af4cf[_0x1da4('0x17')]?_0x2af4cf[_0x1da4('0x17')][_0x1da4('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2af4cf[_0x1da4('0x17')]?_0x2af4cf['options']['where']||null:null,'attributes':_0x2af4cf['options']?_0x2af4cf[_0x1da4('0x17')]['attributes']||null:null,'limit':_0x2af4cf[_0x1da4('0x17')]?_0x2af4cf[_0x1da4('0x17')][_0x1da4('0x19')]||null:null})[_0x1da4('0xa')](function(_0x19accf){logger[_0x1da4('0xb')](_0x1da4('0x1f'),_0x2af4cf);logger[_0x1da4('0xd')](_0x1da4('0x1f'),_0x2af4cf,JSON[_0x1da4('0x10')](_0x19accf));_0xeaf9d7(_0x19accf);})[_0x1da4('0x22')](function(_0x1db907){logger[_0x1da4('0x11')](_0x1da4('0x1f'),_0x1db907['message'],_0x2af4cf);_0x396fcb(_0x2c7d8e[_0x1da4('0x11')](0x1f4,_0x1db907[_0x1da4('0x12')]));});});};exports[_0x1da4('0x23')]=function(_0x3e1e61){var _0x524e14=this;return new Promise(function(_0x291cab,_0x5ed44a){return db['CmHopperBlack'][_0x1da4('0x24')]({'where':_0x3e1e61[_0x1da4('0x17')]?_0x3e1e61['options'][_0x1da4('0x18')]||null:null})[_0x1da4('0xa')](function(_0x976e81){logger['info'](_0x1da4('0x23'),_0x3e1e61);logger[_0x1da4('0xd')](_0x1da4('0x23'),_0x3e1e61,JSON[_0x1da4('0x10')](_0x976e81));_0x291cab(_0x976e81);})[_0x1da4('0x22')](function(_0x42d55d){logger[_0x1da4('0x11')](_0x1da4('0x23'),_0x42d55d[_0x1da4('0x12')],_0x3e1e61);_0x5ed44a(_0x524e14[_0x1da4('0x11')](0x1f4,_0x42d55d[_0x1da4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 3331b6d..79ab744 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 _0xbec5=['../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','/:id','show','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x562058,_0x365a8e){var _0x57507c=function(_0x30d28d){while(--_0x30d28d){_0x562058['push'](_0x562058['shift']());}};_0x57507c(++_0x365a8e);}(_0xbec5,0xe5));var _0x5bec=function(_0xe1b5f6,_0x210c09){_0xe1b5f6=_0xe1b5f6-0x0;var _0x44636e=_0xbec5[_0xe1b5f6];return _0x44636e;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var auth=require(_0x5bec('0x5'));var interaction=require(_0x5bec('0x6'));var config=require('../../config/environment');var controller=require(_0x5bec('0x7'));router[_0x5bec('0x8')]('/',auth[_0x5bec('0x9')](),controller['index']);router[_0x5bec('0x8')](_0x5bec('0xa'),auth[_0x5bec('0x9')](),controller[_0x5bec('0xb')]);router[_0x5bec('0x8')](_0x5bec('0xc'),auth[_0x5bec('0x9')](),controller[_0x5bec('0xd')]);router['put'](_0x5bec('0xc'),auth['isAuthenticated'](),controller[_0x5bec('0xe')]);router[_0x5bec('0xf')](_0x5bec('0xc'),auth['isAuthenticated'](),controller[_0x5bec('0x10')]);module[_0x5bec('0x11')]=router; \ No newline at end of file +var _0x81bd=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','index','/describe','isAuthenticated','show','put','/:id'];(function(_0x33b880,_0xa71851){var _0x2390b0=function(_0x2cad49){while(--_0x2cad49){_0x33b880['push'](_0x33b880['shift']());}};_0x2390b0(++_0xa71851);}(_0x81bd,0x7c));var _0xd81b=function(_0x910b22,_0x57e873){_0x910b22=_0x910b22-0x0;var _0x1f594d=_0x81bd[_0x910b22];return _0x1f594d;};'use strict';var multer=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var path=require(_0xd81b('0x2'));var timeout=require(_0xd81b('0x3'));var express=require(_0xd81b('0x4'));var router=express[_0xd81b('0x5')]();var auth=require(_0xd81b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd81b('0x7'));var controller=require(_0xd81b('0x8'));router[_0xd81b('0x9')]('/',auth['isAuthenticated'](),controller[_0xd81b('0xa')]);router[_0xd81b('0x9')](_0xd81b('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xd81b('0x9')]('/:id',auth[_0xd81b('0xc')](),controller[_0xd81b('0xd')]);router[_0xd81b('0xe')](_0xd81b('0xf'),auth[_0xd81b('0xc')](),controller[_0xd81b('0x10')]);router[_0xd81b('0x11')](_0xd81b('0xf'),auth[_0xd81b('0xc')](),controller[_0xd81b('0x12')]);module[_0xd81b('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index d7ec0dc..941059d 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 _0x63cb=['endtime','setDataValue','followuptime','seconds','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue'];(function(_0x3686f4,_0xd4a373){var _0x168f2b=function(_0x352038){while(--_0x352038){_0x3686f4['push'](_0x3686f4['shift']());}};_0x168f2b(++_0xd4a373);}(_0x63cb,0xfd));var _0xb63c=function(_0x1d558c,_0x1e497c){_0x1d558c=_0x1d558c-0x0;var _0x15767d=_0x63cb[_0x1d558c];return _0x15767d;};'use strict';var Sequelize=require(_0xb63c('0x0'));var moment=require(_0xb63c('0x1'));module[_0xb63c('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xb63c('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb63c('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb63c('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb63c('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xb63c('0x4')]},'originatecalleridname':{'type':Sequelize[_0xb63c('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb63c('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xb63c('0x5')]},'answertime':{'type':Sequelize[_0xb63c('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xb63c('0x5')]},'ringtime':{'type':Sequelize[_0xb63c('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb63c('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb63c('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb63c('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xb63c('0x4')]},'membername':{'type':Sequelize[_0xb63c('0x4')]},'reason':{'type':Sequelize[_0xb63c('0x4')]},'disposition':{'type':Sequelize[_0xb63c('0x4')]},'dispositionat':{'type':Sequelize[_0xb63c('0x5')],'set':function(_0x2f0ee0){var _0x306349=this[_0xb63c('0x6')](_0xb63c('0x7'));if(_0x306349&&_0x2f0ee0){this[_0xb63c('0x8')](_0xb63c('0x9'),moment(_0x2f0ee0)['diff'](moment(_0x306349),_0xb63c('0xa')));}return this[_0xb63c('0x8')](_0xb63c('0xb'),_0x2f0ee0);}},'amd':{'type':Sequelize[_0xb63c('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb63c('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xb63c('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xb63c('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb63c('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb63c('0x5')]},'deleted':{'type':Sequelize[_0xb63c('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xb63c('0x5')]},'recallme':{'type':Sequelize[_0xb63c('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xb63c('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xb63c('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb63c('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb63c('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6548=['STRING','INTEGER','DATE','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','sequelize','exports'];(function(_0x180353,_0x31ab0b){var _0x4929dc=function(_0x11710f){while(--_0x11710f){_0x180353['push'](_0x180353['shift']());}};_0x4929dc(++_0x31ab0b);}(_0x6548,0x169));var _0x8654=function(_0x2238fa,_0x46243c){_0x2238fa=_0x2238fa-0x0;var _0x8e1006=_0x6548[_0x2238fa];return _0x8e1006;};'use strict';var Sequelize=require(_0x8654('0x0'));var moment=require('moment');module[_0x8654('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x8654('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x8654('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8654('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8654('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8654('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x8654('0x2')]},'originatecalleridname':{'type':Sequelize[_0x8654('0x2')]},'calleridnum':{'type':Sequelize[_0x8654('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x8654('0x4')]},'answertime':{'type':Sequelize[_0x8654('0x4')]},'droptime':{'type':Sequelize[_0x8654('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x8654('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8654('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8654('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8654('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8654('0x2')]},'campaign':{'type':Sequelize[_0x8654('0x2')]},'campaigntype':{'type':Sequelize[_0x8654('0x2')]},'membername':{'type':Sequelize[_0x8654('0x2')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x8654('0x2')]},'dispositionat':{'type':Sequelize[_0x8654('0x4')],'set':function(_0x5f45a9){var _0x469734=this['getDataValue']('endtime');if(_0x469734&&_0x5f45a9){this[_0x8654('0x5')](_0x8654('0x6'),moment(_0x5f45a9)[_0x8654('0x7')](moment(_0x469734),_0x8654('0x8')));}return this['setDataValue'](_0x8654('0x9'),_0x5f45a9);}},'amd':{'type':Sequelize[_0x8654('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8654('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x8654('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x8654('0x4')]},'callback':{'type':Sequelize[_0x8654('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8654('0x4')]},'deleted':{'type':Sequelize[_0x8654('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x8654('0x4')]},'recallme':{'type':Sequelize[_0x8654('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x8654('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x8654('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8654('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8654('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8654('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 af385db..b238fe1 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 _0xb96d=['VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','field','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','NOW()','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','state\x20=\x204','Campaign','scheduledAt','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','group','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','CmHopperFinal','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','params','rawAttributes','find','uniqueid','body','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x203,\x201,\x20null','busyContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId'];(function(_0x53f04f,_0x419aa8){var _0x16a824=function(_0x5712c9){while(--_0x5712c9){_0x53f04f['push'](_0x53f04f['shift']());}};_0x16a824(++_0x419aa8);}(_0xb96d,0x9e));var _0xdb96=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0xb96d[_0x397cfb];return _0x15fed9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdb96('0x0'));var rimraf=require(_0xdb96('0x1'));var zipdir=require(_0xdb96('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdb96('0x3'));var moment=require(_0xdb96('0x4'));var BPromise=require(_0xdb96('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdb96('0x6'));var sox=require(_0xdb96('0x7'));var csv=require(_0xdb96('0x8'));var ejs=require(_0xdb96('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdb96('0xa'));var crypto=require(_0xdb96('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xdb96('0xc'));var toCsv=require('to-csv');var querystring=require(_0xdb96('0xd'));var Papa=require(_0xdb96('0xe'));var Redis=require('ioredis');var authService=require(_0xdb96('0xf'));var qs=require(_0xdb96('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb96('0x11'));var logger=require(_0xdb96('0x12'))(_0xdb96('0x13'));var utils=require(_0xdb96('0x14'));var config=require('../../config/environment');var db=require(_0xdb96('0x15'))['db'];function respondWithStatusCode(_0x1ed816,_0x33e478){_0x33e478=_0x33e478||0xcc;return function(_0x5a004c){if(_0x5a004c){return _0x1ed816[_0xdb96('0x16')](_0x33e478);}return _0x1ed816[_0xdb96('0x17')](_0x33e478)[_0xdb96('0x18')]();};}function respondWithResult(_0x18a8c0,_0x359970){_0x359970=_0x359970||0xc8;return function(_0xf88086){if(_0xf88086){return _0x18a8c0[_0xdb96('0x17')](_0x359970)[_0xdb96('0x19')](_0xf88086);}};}function respondWithFilteredResult(_0x12630d,_0x745780){return function(_0xb95f96){if(_0xb95f96){var _0x94bbc3=_0xb95f96[_0xdb96('0x1a')],_0x190b52=_0x745780[_0xdb96('0x1b')],_0x596673=_0x745780[_0xdb96('0x1b')]+_0x745780['limit'],_0x3a94da;if(_0x596673>=_0x94bbc3){_0x596673=_0x94bbc3;_0x3a94da=0xc8;}else{_0x3a94da=0xce;}_0x12630d[_0xdb96('0x17')](_0x3a94da);return _0x12630d[_0xdb96('0x1c')](_0xdb96('0x1d'),_0x190b52+'-'+_0x596673+'/'+_0x94bbc3)['json'](_0xb95f96);}return null;};}function patchUpdates(_0x4a6747){return function(_0x16f863){try{jsonpatch['apply'](_0x16f863,_0x4a6747,!![]);}catch(_0x51a885){return BPromise[_0xdb96('0x1e')](_0x51a885);}return _0x16f863[_0xdb96('0x1f')]();};}function saveUpdates(_0x1f8ea2,_0x11b7bd){return function(_0x518a91){if(_0x518a91){return _0x518a91[_0xdb96('0x20')](_0x1f8ea2)['then'](function(_0x22b3aa){return _0x22b3aa;});}return null;};}function removeEntity(_0x467a5d,_0x4ddf48){return function(_0x111673){if(_0x111673){return _0x111673[_0xdb96('0x21')]()[_0xdb96('0x22')](function(){_0x467a5d[_0xdb96('0x17')](0xcc)[_0xdb96('0x18')]();});}};}function handleEntityNotFound(_0xca6ca0,_0x25834a){return function(_0x5a1d1c){if(!_0x5a1d1c){_0xca6ca0[_0xdb96('0x16')](0x194);}return _0x5a1d1c;};}function handleError(_0x18d5a3,_0x350115){_0x350115=_0x350115||0x1f4;return function(_0x47a99a){logger[_0xdb96('0x23')](_0x47a99a[_0xdb96('0x24')]);if(_0x47a99a[_0xdb96('0x25')]){delete _0x47a99a[_0xdb96('0x25')];}_0x18d5a3[_0xdb96('0x17')](_0x350115)[_0xdb96('0x26')](_0x47a99a);};}exports[_0xdb96('0x27')]=function(_0x42365,_0xfa9833){var _0x5efe23={},_0x3e9c4e={},_0x3f2a43={'count':0x0,'rows':[]};var _0x4787e9=_[_0xdb96('0x28')](db[_0xdb96('0x29')]['rawAttributes'],function(_0x32eabc){return{'name':_0x32eabc[_0xdb96('0x2a')],'type':_0x32eabc[_0xdb96('0x2b')][_0xdb96('0x2c')]};});_0x3e9c4e[_0xdb96('0x2d')]=_[_0xdb96('0x28')](_0x4787e9,_0xdb96('0x25'));_0x3e9c4e['query']=_[_0xdb96('0x2e')](_0x42365[_0xdb96('0x2f')]);_0x3e9c4e[_0xdb96('0x30')]=_[_0xdb96('0x31')](_0x3e9c4e['model'],_0x3e9c4e['query']);_0x5efe23[_0xdb96('0x32')]=_[_0xdb96('0x31')](_0x3e9c4e['model'],qs[_0xdb96('0x33')](_0x42365['query']['fields']));_0x5efe23['attributes']=_0x5efe23['attributes'][_0xdb96('0x34')]?_0x5efe23['attributes']:_0x3e9c4e['model'];if(!_0x42365[_0xdb96('0x2f')][_0xdb96('0x35')](_0xdb96('0x36'))){_0x5efe23[_0xdb96('0x37')]=qs['limit'](_0x42365[_0xdb96('0x2f')][_0xdb96('0x37')]);_0x5efe23[_0xdb96('0x1b')]=qs[_0xdb96('0x1b')](_0x42365[_0xdb96('0x2f')]['offset']);}_0x5efe23[_0xdb96('0x38')]=qs[_0xdb96('0x39')](_0x42365[_0xdb96('0x2f')][_0xdb96('0x39')]);_0x5efe23[_0xdb96('0x3a')]=qs[_0xdb96('0x30')](_[_0xdb96('0x3b')](_0x42365['query'],_0x3e9c4e['filters']),_0x4787e9);if(_0x42365['query'][_0xdb96('0x3c')]){_0x5efe23[_0xdb96('0x3a')]=_[_0xdb96('0x3d')](_0x5efe23[_0xdb96('0x3a')],{'$or':_['map'](_0x4787e9,function(_0x23ac66){if(_0x23ac66['type']!=='VIRTUAL'){var _0x3e75e5={};_0x3e75e5[_0x23ac66[_0xdb96('0x25')]]={'$like':'%'+_0x42365[_0xdb96('0x2f')][_0xdb96('0x3c')]+'%'};return _0x3e75e5;}})});}_0x5efe23=_['merge']({},_0x5efe23,_0x42365[_0xdb96('0x3e')]);var _0xa69018={'where':_0x5efe23[_0xdb96('0x3a')]};return db[_0xdb96('0x29')][_0xdb96('0x1a')](_0xa69018)['then'](function(_0x1ff93a){_0x3f2a43['count']=_0x1ff93a;if(_0x42365[_0xdb96('0x2f')][_0xdb96('0x3f')]){_0x5efe23[_0xdb96('0x40')]=[{'all':!![]}];}return db[_0xdb96('0x29')][_0xdb96('0x41')](_0x5efe23);})['then'](function(_0xb2ed0b){_0x3f2a43['rows']=_0xb2ed0b;return _0x3f2a43;})[_0xdb96('0x22')](respondWithFilteredResult(_0xfa9833,_0x5efe23))[_0xdb96('0x42')](handleError(_0xfa9833,null));};exports['show']=function(_0x5f339c,_0xb38a5f){var _0x1d3682={'raw':!![],'where':{'id':_0x5f339c[_0xdb96('0x43')]['id']}},_0x19c7e5={};_0x19c7e5[_0xdb96('0x2d')]=_[_0xdb96('0x2e')](db['CmHopperFinal'][_0xdb96('0x44')]);_0x19c7e5['query']=_[_0xdb96('0x2e')](_0x5f339c['query']);_0x19c7e5['filters']=_[_0xdb96('0x31')](_0x19c7e5['model'],_0x19c7e5['query']);_0x1d3682['attributes']=_['intersection'](_0x19c7e5[_0xdb96('0x2d')],qs[_0xdb96('0x33')](_0x5f339c['query'][_0xdb96('0x33')]));_0x1d3682[_0xdb96('0x32')]=_0x1d3682[_0xdb96('0x32')]['length']?_0x1d3682[_0xdb96('0x32')]:_0x19c7e5[_0xdb96('0x2d')];if(_0x5f339c['query'][_0xdb96('0x3f')]){_0x1d3682[_0xdb96('0x40')]=[{'all':!![]}];}_0x1d3682=_[_0xdb96('0x3d')]({},_0x1d3682,_0x5f339c['options']);return db[_0xdb96('0x29')][_0xdb96('0x45')](_0x1d3682)[_0xdb96('0x22')](handleEntityNotFound(_0xb38a5f,null))['then'](respondWithResult(_0xb38a5f,null))[_0xdb96('0x42')](handleError(_0xb38a5f,null));};exports['describe']=function(_0xd07002,_0x112fbf){return db[_0xdb96('0x29')]['describe']()[_0xdb96('0x22')](respondWithResult(_0x112fbf,null))['catch'](handleError(_0x112fbf,null));};exports[_0xdb96('0x20')]=function(_0x4f1ec6,_0x5cd616){if(_0x4f1ec6['body'][_0xdb96('0x46')]){delete _0x4f1ec6[_0xdb96('0x47')][_0xdb96('0x46')];}return db[_0xdb96('0x29')][_0xdb96('0x45')]({'where':{'uniqueid':_0x4f1ec6[_0xdb96('0x43')]['id']}})[_0xdb96('0x22')](handleEntityNotFound(_0x5cd616,null))[_0xdb96('0x22')](saveUpdates(_0x4f1ec6[_0xdb96('0x47')],null))[_0xdb96('0x22')](respondWithResult(_0x5cd616,null))[_0xdb96('0x42')](handleError(_0x5cd616,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x3be97e,_0x223dd1,_0x175688){return db[_0xdb96('0x29')][_0xdb96('0x41')]({'raw':![],'where':{'VoiceQueueId':_0x3be97e[_0xdb96('0x43')]['id']},'attributes':[[db[_0xdb96('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xdb96('0x48')][_0xdb96('0x49')](_0xdb96('0x4a')))),_0xdb96('0x4b')],[db[_0xdb96('0x48')]['fn'](_0xdb96('0x4c'),db['sequelize']['fn']('IF',db[_0xdb96('0x48')][_0xdb96('0x49')]('`state`\x20=\x203,\x201,\x20null'))),_0xdb96('0x4d')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xdb96('0x48')]['literal'](_0xdb96('0x4e')))),'busyContacts'],[db[_0xdb96('0x48')]['fn'](_0xdb96('0x4c'),db[_0xdb96('0x48')]['fn']('IF',db[_0xdb96('0x48')][_0xdb96('0x49')](_0xdb96('0x4f')))),_0xdb96('0x50')],[db[_0xdb96('0x48')]['fn'](_0xdb96('0x4c'),db['sequelize']['fn']('IF',db[_0xdb96('0x48')][_0xdb96('0x49')](_0xdb96('0x51')))),_0xdb96('0x52')],[db[_0xdb96('0x48')]['fn'](_0xdb96('0x4c'),db[_0xdb96('0x48')]['fn']('IF',db[_0xdb96('0x48')][_0xdb96('0x49')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xdb96('0x53')],[db[_0xdb96('0x48')]['fn'](_0xdb96('0x4c'),db[_0xdb96('0x48')]['fn']('IF',db['sequelize'][_0xdb96('0x49')](_0xdb96('0x54')))),_0xdb96('0x55')],[db[_0xdb96('0x48')]['fn'](_0xdb96('0x4c'),db[_0xdb96('0x48')]['fn']('IF',db['sequelize'][_0xdb96('0x49')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0xdb96('0x22')](handleEntityNotFound(_0x223dd1,null))[_0xdb96('0x22')](respondWithResult(_0x223dd1,null))['catch'](handleError(_0x223dd1,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x111843,_0x1e0055,_0x383341){return db[_0xdb96('0x29')][_0xdb96('0x41')]({'raw':![],'where':{'CampaignId':_0x111843['params']['id']},'attributes':[[db[_0xdb96('0x48')]['fn'](_0xdb96('0x4c'),db['sequelize']['fn']('IF',db[_0xdb96('0x48')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0xdb96('0x4b')],[db[_0xdb96('0x48')]['fn'](_0xdb96('0x4c'),db[_0xdb96('0x48')]['fn']('IF',db['sequelize'][_0xdb96('0x49')](_0xdb96('0x56')))),_0xdb96('0x4d')],[db[_0xdb96('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xdb96('0x48')][_0xdb96('0x49')](_0xdb96('0x4e')))),_0xdb96('0x57')],[db['sequelize']['fn'](_0xdb96('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0xdb96('0x49')](_0xdb96('0x4f')))),_0xdb96('0x50')],[db['sequelize']['fn'](_0xdb96('0x4c'),db['sequelize']['fn']('IF',db[_0xdb96('0x48')][_0xdb96('0x49')](_0xdb96('0x51')))),_0xdb96('0x52')],[db[_0xdb96('0x48')]['fn'](_0xdb96('0x4c'),db[_0xdb96('0x48')]['fn']('IF',db[_0xdb96('0x48')][_0xdb96('0x49')](_0xdb96('0x58')))),_0xdb96('0x53')],[db[_0xdb96('0x48')]['fn'](_0xdb96('0x4c'),db[_0xdb96('0x48')]['fn']('IF',db[_0xdb96('0x48')][_0xdb96('0x49')](_0xdb96('0x54')))),_0xdb96('0x55')],[db['sequelize']['fn'](_0xdb96('0x4c'),db[_0xdb96('0x48')]['fn']('IF',db[_0xdb96('0x48')][_0xdb96('0x49')](_0xdb96('0x59')))),_0xdb96('0x5a')]]})[_0xdb96('0x22')](handleEntityNotFound(_0x1e0055,null))[_0xdb96('0x22')](respondWithResult(_0x1e0055,null))['catch'](handleError(_0x1e0055,null));};exports[_0xdb96('0x5b')]=function(_0x409b5a,_0x5cb56b,_0x850a4e){return db[_0xdb96('0x5c')][_0xdb96('0x45')]({'where':{'id':_0x409b5a['params']['id']}})[_0xdb96('0x22')](handleEntityNotFound(_0x5cb56b,null))['then'](function(_0x462dde){var _0x2e004c;if(_0x462dde){_0x2e004c=squel[_0xdb96('0x5d')]()[_0xdb96('0x5e')](_0xdb96('0x5f'))[_0xdb96('0x60')]([_0xdb96('0x61'),'scheduledAt',_0xdb96('0x62'),_0xdb96('0x63'),_0xdb96('0x64'),_0xdb96('0x65'),_0xdb96('0x66')],squel[_0xdb96('0x67')]()['field'](_0xdb96('0x68'),_0xdb96('0x61'))[_0xdb96('0x69')]('NOW()','scheduledAt')[_0xdb96('0x69')](_0xdb96('0x6a'),_0xdb96('0x62'))[_0xdb96('0x69')](_0xdb96('0x6b'),'ListId')[_0xdb96('0x69')](_0xdb96('0x6c'),'VoiceQueueId')[_0xdb96('0x69')](_0xdb96('0x6d'),_0xdb96('0x65'))[_0xdb96('0x69')](_0xdb96('0x6d'),_0xdb96('0x66'))['from'](_0xdb96('0x6e'))['where'](_0xdb96('0x6f'),_0x409b5a['params']['id'][_0xdb96('0x70')]())[_0xdb96('0x3a')](_0xdb96('0x71'),_0x409b5a[_0xdb96('0x47')][_0xdb96('0x72')][_0xdb96('0x70')]())[_0xdb96('0x3a')](_0xdb96('0x73'))[_0xdb96('0x3a')](_0xdb96('0x74'),squel[_0xdb96('0x67')]()['field'](_0xdb96('0x61'))['from'](_0xdb96('0x5f'))['where'](_0xdb96('0x6f'),_0x409b5a[_0xdb96('0x43')]['id'][_0xdb96('0x70')]()))[_0xdb96('0x3a')](_0xdb96('0x74'),squel[_0xdb96('0x67')]()[_0xdb96('0x69')]('calleridnum')[_0xdb96('0x75')]('cm_hopper_final')[_0xdb96('0x3a')](_0xdb96('0x6f'),_0x409b5a['params']['id'][_0xdb96('0x70')]())['where'](_0xdb96('0x76')))['group'](_0xdb96('0x62')))[_0xdb96('0x70')]();return db[_0xdb96('0x48')][_0xdb96('0x2f')](_0x2e004c);}return[];})[_0xdb96('0x22')](respondWithResult(_0x5cb56b,null))['catch'](handleError(_0x5cb56b,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x36ec33,_0xa35fb2,_0x195070){return db[_0xdb96('0x77')][_0xdb96('0x45')]({'where':{'id':_0x36ec33[_0xdb96('0x43')]['id']}})[_0xdb96('0x22')](handleEntityNotFound(_0xa35fb2,null))[_0xdb96('0x22')](function(_0x48060f){var _0xe92641;if(_0x48060f){_0xe92641=squel[_0xdb96('0x5d')]()['into']('cm_hopper')['fromQuery']([_0xdb96('0x61'),_0xdb96('0x78'),_0xdb96('0x62'),_0xdb96('0x63'),_0xdb96('0x79'),_0xdb96('0x65'),_0xdb96('0x66')],squel[_0xdb96('0x67')]()['field'](_0xdb96('0x68'),_0xdb96('0x61'))[_0xdb96('0x69')](_0xdb96('0x6d'),'scheduledAt')[_0xdb96('0x69')](_0xdb96('0x6a'),'ContactId')[_0xdb96('0x69')](_0xdb96('0x6b'),_0xdb96('0x63'))[_0xdb96('0x69')](_0xdb96('0x7a'),_0xdb96('0x79'))['field'](_0xdb96('0x6d'),_0xdb96('0x65'))['field'](_0xdb96('0x6d'),_0xdb96('0x66'))[_0xdb96('0x75')](_0xdb96('0x6e'))['where'](_0xdb96('0x7b'),_0x36ec33[_0xdb96('0x43')]['id'][_0xdb96('0x70')]())[_0xdb96('0x3a')](_0xdb96('0x71'),_0x36ec33['body']['state'][_0xdb96('0x70')]())[_0xdb96('0x3a')](_0xdb96('0x73'))[_0xdb96('0x3a')](_0xdb96('0x74'),squel[_0xdb96('0x67')]()['field'](_0xdb96('0x61'))['from']('cm_hopper')[_0xdb96('0x3a')](_0xdb96('0x7b'),_0x36ec33[_0xdb96('0x43')]['id']['toString']()))[_0xdb96('0x3a')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0xdb96('0x69')](_0xdb96('0x7c'))[_0xdb96('0x75')](_0xdb96('0x6e'))[_0xdb96('0x3a')]('CampaignId\x20=\x20?',_0x36ec33[_0xdb96('0x43')]['id'][_0xdb96('0x70')]())[_0xdb96('0x3a')](_0xdb96('0x76')))[_0xdb96('0x7d')](_0xdb96('0x62')))[_0xdb96('0x70')]();return db[_0xdb96('0x48')]['query'](_0xe92641);}return[];})[_0xdb96('0x22')](respondWithResult(_0xa35fb2,null))[_0xdb96('0x42')](handleError(_0xa35fb2,null));};exports[_0xdb96('0x7e')]=function(_0x3af79f,_0x29ce25,_0x46aace){return db[_0xdb96('0x7f')][_0xdb96('0x80')]({'where':{'VoiceQueueId':_0x3af79f[_0xdb96('0x47')][_0xdb96('0x64')],'CampaignId':_0x3af79f[_0xdb96('0x47')]['CampaignId'],'ContactId':_0x3af79f[_0xdb96('0x47')][_0xdb96('0x62')]}})['then'](handleEntityNotFound(_0x29ce25,null))[_0xdb96('0x22')](function(_0x311f0f){if(_0x311f0f){return _0x311f0f;}return null;})['then'](respondWithResult(_0x29ce25,null))[_0xdb96('0x42')](handleError(_0x29ce25,null));}; \ No newline at end of file +var _0x8374=['end','json','count','offset','limit','set','Content-Range','apply','update','then','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','intersection','find','describe','catch','body','uniqueid','params','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','`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','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','noAnswerContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','insert','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','select','field','phone','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','into','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','group','checkContactHopper','CmHopper','findOne','VoiceQueueId','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','status'];(function(_0x262b27,_0x4cb0cf){var _0x2e07b8=function(_0x5ea291){while(--_0x5ea291){_0x262b27['push'](_0x262b27['shift']());}};_0x2e07b8(++_0x4cb0cf);}(_0x8374,0x174));var _0x4837=function(_0x419c30,_0x1446f7){_0x419c30=_0x419c30-0x0;var _0x381ca7=_0x8374[_0x419c30];return _0x381ca7;};'use strict';var pdf=require(_0x4837('0x0'));var emlformat=require(_0x4837('0x1'));var rimraf=require(_0x4837('0x2'));var zipdir=require(_0x4837('0x3'));var jsonpatch=require(_0x4837('0x4'));var rp=require(_0x4837('0x5'));var moment=require(_0x4837('0x6'));var BPromise=require(_0x4837('0x7'));var Mustache=require(_0x4837('0x8'));var util=require(_0x4837('0x9'));var path=require(_0x4837('0xa'));var sox=require(_0x4837('0xb'));var csv=require(_0x4837('0xc'));var ejs=require(_0x4837('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4837('0xe'));var crypto=require('crypto');var jsforce=require(_0x4837('0xf'));var deskjs=require(_0x4837('0x10'));var toCsv=require(_0x4837('0xc'));var querystring=require(_0x4837('0x11'));var Papa=require(_0x4837('0x12'));var Redis=require(_0x4837('0x13'));var authService=require(_0x4837('0x14'));var qs=require(_0x4837('0x15'));var as=require(_0x4837('0x16'));var hardwareService=require(_0x4837('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x4837('0x18'));var config=require('../../config/environment');var db=require(_0x4837('0x19'))['db'];function respondWithStatusCode(_0x1a33ab,_0x5338cf){_0x5338cf=_0x5338cf||0xcc;return function(_0x55c6da){if(_0x55c6da){return _0x1a33ab['sendStatus'](_0x5338cf);}return _0x1a33ab[_0x4837('0x1a')](_0x5338cf)[_0x4837('0x1b')]();};}function respondWithResult(_0x1c01a9,_0x1a31d8){_0x1a31d8=_0x1a31d8||0xc8;return function(_0x4b18c5){if(_0x4b18c5){return _0x1c01a9[_0x4837('0x1a')](_0x1a31d8)[_0x4837('0x1c')](_0x4b18c5);}};}function respondWithFilteredResult(_0x39e5f6,_0x52a82c){return function(_0x1685ee){if(_0x1685ee){var _0xae4f01=_0x1685ee[_0x4837('0x1d')],_0x5d49b6=_0x52a82c[_0x4837('0x1e')],_0x216899=_0x52a82c[_0x4837('0x1e')]+_0x52a82c[_0x4837('0x1f')],_0x3a6cd1;if(_0x216899>=_0xae4f01){_0x216899=_0xae4f01;_0x3a6cd1=0xc8;}else{_0x3a6cd1=0xce;}_0x39e5f6['status'](_0x3a6cd1);return _0x39e5f6[_0x4837('0x20')](_0x4837('0x21'),_0x5d49b6+'-'+_0x216899+'/'+_0xae4f01)[_0x4837('0x1c')](_0x1685ee);}return null;};}function patchUpdates(_0x3c4d53){return function(_0x41f86c){try{jsonpatch[_0x4837('0x22')](_0x41f86c,_0x3c4d53,!![]);}catch(_0x3af7e0){return BPromise['reject'](_0x3af7e0);}return _0x41f86c['save']();};}function saveUpdates(_0xdb5a0d,_0x133e9d){return function(_0x36603e){if(_0x36603e){return _0x36603e[_0x4837('0x23')](_0xdb5a0d)['then'](function(_0x2c123c){return _0x2c123c;});}return null;};}function removeEntity(_0x595c3d,_0x208943){return function(_0x5f5631){if(_0x5f5631){return _0x5f5631['destroy']()[_0x4837('0x24')](function(){_0x595c3d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x57d48a,_0x40bebd){return function(_0x2d820a){if(!_0x2d820a){_0x57d48a['sendStatus'](0x194);}return _0x2d820a;};}function handleError(_0x36b841,_0xa10b75){_0xa10b75=_0xa10b75||0x1f4;return function(_0x4c73a4){logger[_0x4837('0x25')](_0x4c73a4[_0x4837('0x26')]);if(_0x4c73a4['name']){delete _0x4c73a4[_0x4837('0x27')];}_0x36b841[_0x4837('0x1a')](_0xa10b75)[_0x4837('0x28')](_0x4c73a4);};}exports[_0x4837('0x29')]=function(_0x2b2e48,_0x5c07db){var _0x2a7dfd={},_0x153bc7={},_0x39b61b={'count':0x0,'rows':[]};var _0x314bee=_[_0x4837('0x2a')](db[_0x4837('0x2b')][_0x4837('0x2c')],function(_0x107a5f){return{'name':_0x107a5f['fieldName'],'type':_0x107a5f[_0x4837('0x2d')][_0x4837('0x2e')]};});_0x153bc7[_0x4837('0x2f')]=_[_0x4837('0x2a')](_0x314bee,_0x4837('0x27'));_0x153bc7[_0x4837('0x30')]=_[_0x4837('0x31')](_0x2b2e48[_0x4837('0x30')]);_0x153bc7[_0x4837('0x32')]=_['intersection'](_0x153bc7[_0x4837('0x2f')],_0x153bc7['query']);_0x2a7dfd[_0x4837('0x33')]=_['intersection'](_0x153bc7[_0x4837('0x2f')],qs[_0x4837('0x34')](_0x2b2e48[_0x4837('0x30')]['fields']));_0x2a7dfd['attributes']=_0x2a7dfd[_0x4837('0x33')][_0x4837('0x35')]?_0x2a7dfd[_0x4837('0x33')]:_0x153bc7[_0x4837('0x2f')];if(!_0x2b2e48[_0x4837('0x30')]['hasOwnProperty'](_0x4837('0x36'))){_0x2a7dfd[_0x4837('0x1f')]=qs['limit'](_0x2b2e48[_0x4837('0x30')]['limit']);_0x2a7dfd[_0x4837('0x1e')]=qs['offset'](_0x2b2e48['query'][_0x4837('0x1e')]);}_0x2a7dfd[_0x4837('0x37')]=qs[_0x4837('0x38')](_0x2b2e48['query'][_0x4837('0x38')]);_0x2a7dfd[_0x4837('0x39')]=qs['filters'](_[_0x4837('0x3a')](_0x2b2e48['query'],_0x153bc7[_0x4837('0x32')]),_0x314bee);if(_0x2b2e48[_0x4837('0x30')][_0x4837('0x3b')]){_0x2a7dfd[_0x4837('0x39')]=_['merge'](_0x2a7dfd[_0x4837('0x39')],{'$or':_[_0x4837('0x2a')](_0x314bee,function(_0x33a455){if(_0x33a455[_0x4837('0x2d')]!==_0x4837('0x3c')){var _0x12af2a={};_0x12af2a[_0x33a455['name']]={'$like':'%'+_0x2b2e48[_0x4837('0x30')]['filter']+'%'};return _0x12af2a;}})});}_0x2a7dfd=_[_0x4837('0x3d')]({},_0x2a7dfd,_0x2b2e48[_0x4837('0x3e')]);var _0x5dcc13={'where':_0x2a7dfd['where']};return db[_0x4837('0x2b')][_0x4837('0x1d')](_0x5dcc13)[_0x4837('0x24')](function(_0x24c14a){_0x39b61b[_0x4837('0x1d')]=_0x24c14a;if(_0x2b2e48[_0x4837('0x30')][_0x4837('0x3f')]){_0x2a7dfd[_0x4837('0x40')]=[{'all':!![]}];}return db[_0x4837('0x2b')][_0x4837('0x41')](_0x2a7dfd);})[_0x4837('0x24')](function(_0x1f7cf3){_0x39b61b[_0x4837('0x42')]=_0x1f7cf3;return _0x39b61b;})[_0x4837('0x24')](respondWithFilteredResult(_0x5c07db,_0x2a7dfd))['catch'](handleError(_0x5c07db,null));};exports['show']=function(_0x346fe8,_0x10d3d0){var _0x4d2b7e={'raw':!![],'where':{'id':_0x346fe8['params']['id']}},_0x5eeb09={};_0x5eeb09['model']=_[_0x4837('0x31')](db['CmHopperFinal']['rawAttributes']);_0x5eeb09[_0x4837('0x30')]=_[_0x4837('0x31')](_0x346fe8[_0x4837('0x30')]);_0x5eeb09['filters']=_[_0x4837('0x43')](_0x5eeb09[_0x4837('0x2f')],_0x5eeb09['query']);_0x4d2b7e[_0x4837('0x33')]=_[_0x4837('0x43')](_0x5eeb09[_0x4837('0x2f')],qs[_0x4837('0x34')](_0x346fe8[_0x4837('0x30')][_0x4837('0x34')]));_0x4d2b7e[_0x4837('0x33')]=_0x4d2b7e[_0x4837('0x33')][_0x4837('0x35')]?_0x4d2b7e[_0x4837('0x33')]:_0x5eeb09[_0x4837('0x2f')];if(_0x346fe8[_0x4837('0x30')][_0x4837('0x3f')]){_0x4d2b7e[_0x4837('0x40')]=[{'all':!![]}];}_0x4d2b7e=_[_0x4837('0x3d')]({},_0x4d2b7e,_0x346fe8['options']);return db[_0x4837('0x2b')][_0x4837('0x44')](_0x4d2b7e)[_0x4837('0x24')](handleEntityNotFound(_0x10d3d0,null))[_0x4837('0x24')](respondWithResult(_0x10d3d0,null))['catch'](handleError(_0x10d3d0,null));};exports[_0x4837('0x45')]=function(_0x3f2995,_0x5b59d0){return db['CmHopperFinal'][_0x4837('0x45')]()[_0x4837('0x24')](respondWithResult(_0x5b59d0,null))[_0x4837('0x46')](handleError(_0x5b59d0,null));};exports['update']=function(_0x37df13,_0x130441){if(_0x37df13[_0x4837('0x47')][_0x4837('0x48')]){delete _0x37df13[_0x4837('0x47')][_0x4837('0x48')];}return db[_0x4837('0x2b')][_0x4837('0x44')]({'where':{'uniqueid':_0x37df13[_0x4837('0x49')]['id']}})['then'](handleEntityNotFound(_0x130441,null))['then'](saveUpdates(_0x37df13[_0x4837('0x47')],null))['then'](respondWithResult(_0x130441,null))[_0x4837('0x46')](handleError(_0x130441,null));};exports[_0x4837('0x4a')]=function(_0x3072fb,_0x2ff7de,_0x32384d){return db[_0x4837('0x2b')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x3072fb[_0x4837('0x49')]['id']},'attributes':[[db[_0x4837('0x4b')]['fn'](_0x4837('0x4c'),db[_0x4837('0x4b')]['fn']('IF',db['sequelize'][_0x4837('0x4d')](_0x4837('0x4e')))),_0x4837('0x4f')],[db[_0x4837('0x4b')]['fn'](_0x4837('0x4c'),db[_0x4837('0x4b')]['fn']('IF',db['sequelize'][_0x4837('0x4d')](_0x4837('0x50')))),'noAnswerContacts'],[db[_0x4837('0x4b')]['fn'](_0x4837('0x4c'),db[_0x4837('0x4b')]['fn']('IF',db[_0x4837('0x4b')]['literal'](_0x4837('0x51')))),_0x4837('0x52')],[db[_0x4837('0x4b')]['fn'](_0x4837('0x4c'),db[_0x4837('0x4b')]['fn']('IF',db[_0x4837('0x4b')][_0x4837('0x4d')]('`state`\x20=\x208,\x201,\x20null'))),_0x4837('0x53')],[db[_0x4837('0x4b')]['fn'](_0x4837('0x4c'),db[_0x4837('0x4b')]['fn']('IF',db[_0x4837('0x4b')][_0x4837('0x4d')](_0x4837('0x54')))),'dropContacts'],[db[_0x4837('0x4b')]['fn'](_0x4837('0x4c'),db[_0x4837('0x4b')]['fn']('IF',db[_0x4837('0x4b')][_0x4837('0x4d')](_0x4837('0x55')))),_0x4837('0x56')],[db[_0x4837('0x4b')]['fn'](_0x4837('0x4c'),db[_0x4837('0x4b')]['fn']('IF',db[_0x4837('0x4b')][_0x4837('0x4d')](_0x4837('0x57')))),_0x4837('0x58')],[db[_0x4837('0x4b')]['fn'](_0x4837('0x4c'),db['sequelize']['fn']('IF',db[_0x4837('0x4b')][_0x4837('0x4d')](_0x4837('0x59')))),'answeringMachine']]})[_0x4837('0x24')](handleEntityNotFound(_0x2ff7de,null))[_0x4837('0x24')](respondWithResult(_0x2ff7de,null))['catch'](handleError(_0x2ff7de,null));};exports[_0x4837('0x5a')]=function(_0x254174,_0x4d132f,_0x25371f){return db[_0x4837('0x2b')]['findAll']({'raw':![],'where':{'CampaignId':_0x254174[_0x4837('0x49')]['id']},'attributes':[[db[_0x4837('0x4b')]['fn'](_0x4837('0x4c'),db[_0x4837('0x4b')]['fn']('IF',db[_0x4837('0x4b')]['literal'](_0x4837('0x4e')))),_0x4837('0x4f')],[db[_0x4837('0x4b')]['fn'](_0x4837('0x4c'),db[_0x4837('0x4b')]['fn']('IF',db[_0x4837('0x4b')][_0x4837('0x4d')](_0x4837('0x50')))),_0x4837('0x5b')],[db[_0x4837('0x4b')]['fn'](_0x4837('0x4c'),db[_0x4837('0x4b')]['fn']('IF',db[_0x4837('0x4b')][_0x4837('0x4d')]('`state`\x20=\x205,\x201,\x20null'))),_0x4837('0x52')],[db[_0x4837('0x4b')]['fn'](_0x4837('0x4c'),db[_0x4837('0x4b')]['fn']('IF',db[_0x4837('0x4b')]['literal'](_0x4837('0x5c')))),_0x4837('0x53')],[db[_0x4837('0x4b')]['fn'](_0x4837('0x4c'),db['sequelize']['fn']('IF',db[_0x4837('0x4b')]['literal'](_0x4837('0x54')))),_0x4837('0x5d')],[db[_0x4837('0x4b')]['fn'](_0x4837('0x4c'),db[_0x4837('0x4b')]['fn']('IF',db[_0x4837('0x4b')][_0x4837('0x4d')](_0x4837('0x55')))),_0x4837('0x56')],[db[_0x4837('0x4b')]['fn'](_0x4837('0x4c'),db[_0x4837('0x4b')]['fn']('IF',db[_0x4837('0x4b')][_0x4837('0x4d')](_0x4837('0x57')))),_0x4837('0x58')],[db[_0x4837('0x4b')]['fn'](_0x4837('0x4c'),db[_0x4837('0x4b')]['fn']('IF',db['sequelize'][_0x4837('0x4d')](_0x4837('0x59')))),_0x4837('0x5e')]]})[_0x4837('0x24')](handleEntityNotFound(_0x4d132f,null))[_0x4837('0x24')](respondWithResult(_0x4d132f,null))['catch'](handleError(_0x4d132f,null));};exports[_0x4837('0x5f')]=function(_0x39da8b,_0x5f0708,_0x570298){return db['VoiceQueue'][_0x4837('0x44')]({'where':{'id':_0x39da8b[_0x4837('0x49')]['id']}})['then'](handleEntityNotFound(_0x5f0708,null))[_0x4837('0x24')](function(_0x1d7a86){var _0x56e957;if(_0x1d7a86){_0x56e957=squel[_0x4837('0x60')]()['into'](_0x4837('0x61'))[_0x4837('0x62')](['phone','scheduledAt',_0x4837('0x63'),_0x4837('0x64'),'VoiceQueueId',_0x4837('0x65'),_0x4837('0x66')],squel[_0x4837('0x67')]()[_0x4837('0x68')]('ANY_VALUE(calleridnum)',_0x4837('0x69'))[_0x4837('0x68')](_0x4837('0x6a'),_0x4837('0x6b'))[_0x4837('0x68')](_0x4837('0x6c'),_0x4837('0x63'))[_0x4837('0x68')](_0x4837('0x6d'),_0x4837('0x64'))[_0x4837('0x68')](_0x4837('0x6e'),'VoiceQueueId')[_0x4837('0x68')](_0x4837('0x6a'),_0x4837('0x65'))[_0x4837('0x68')](_0x4837('0x6a'),_0x4837('0x66'))[_0x4837('0x6f')](_0x4837('0x70'))[_0x4837('0x39')](_0x4837('0x71'),_0x39da8b['params']['id'][_0x4837('0x72')]())[_0x4837('0x39')](_0x4837('0x73'),_0x39da8b['body'][_0x4837('0x74')][_0x4837('0x72')]())[_0x4837('0x39')](_0x4837('0x75'))[_0x4837('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x4837('0x67')]()[_0x4837('0x68')]('phone')['from'](_0x4837('0x61'))[_0x4837('0x39')](_0x4837('0x71'),_0x39da8b['params']['id'][_0x4837('0x72')]()))[_0x4837('0x39')](_0x4837('0x76'),squel['select']()['field']('calleridnum')[_0x4837('0x6f')](_0x4837('0x70'))[_0x4837('0x39')]('VoiceQueueId\x20=\x20?',_0x39da8b[_0x4837('0x49')]['id'][_0x4837('0x72')]())[_0x4837('0x39')](_0x4837('0x77')))['group'](_0x4837('0x63')))[_0x4837('0x72')]();return db[_0x4837('0x4b')][_0x4837('0x30')](_0x56e957);}return[];})[_0x4837('0x24')](respondWithResult(_0x5f0708,null))[_0x4837('0x46')](handleError(_0x5f0708,null));};exports[_0x4837('0x78')]=function(_0x1acc80,_0x501b9b,_0x66543b){return db[_0x4837('0x79')][_0x4837('0x44')]({'where':{'id':_0x1acc80[_0x4837('0x49')]['id']}})['then'](handleEntityNotFound(_0x501b9b,null))[_0x4837('0x24')](function(_0x526bee){var _0x28a33f;if(_0x526bee){_0x28a33f=squel[_0x4837('0x60')]()[_0x4837('0x7a')](_0x4837('0x61'))['fromQuery']([_0x4837('0x69'),_0x4837('0x6b'),_0x4837('0x63'),_0x4837('0x64'),_0x4837('0x7b'),_0x4837('0x65'),_0x4837('0x66')],squel[_0x4837('0x67')]()[_0x4837('0x68')](_0x4837('0x7c'),'phone')['field']('NOW()',_0x4837('0x6b'))[_0x4837('0x68')](_0x4837('0x6c'),_0x4837('0x63'))['field']('ANY_VALUE(ListId)',_0x4837('0x64'))[_0x4837('0x68')](_0x4837('0x7d'),_0x4837('0x7b'))['field'](_0x4837('0x6a'),_0x4837('0x65'))[_0x4837('0x68')]('NOW()',_0x4837('0x66'))[_0x4837('0x6f')](_0x4837('0x70'))[_0x4837('0x39')](_0x4837('0x7e'),_0x1acc80[_0x4837('0x49')]['id'][_0x4837('0x72')]())[_0x4837('0x39')](_0x4837('0x73'),_0x1acc80['body'][_0x4837('0x74')][_0x4837('0x72')]())[_0x4837('0x39')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x4837('0x39')](_0x4837('0x76'),squel[_0x4837('0x67')]()[_0x4837('0x68')](_0x4837('0x69'))[_0x4837('0x6f')](_0x4837('0x61'))[_0x4837('0x39')](_0x4837('0x7e'),_0x1acc80[_0x4837('0x49')]['id'][_0x4837('0x72')]()))[_0x4837('0x39')](_0x4837('0x76'),squel[_0x4837('0x67')]()['field'](_0x4837('0x7f'))[_0x4837('0x6f')](_0x4837('0x70'))[_0x4837('0x39')](_0x4837('0x7e'),_0x1acc80[_0x4837('0x49')]['id'][_0x4837('0x72')]())[_0x4837('0x39')](_0x4837('0x77')))[_0x4837('0x80')](_0x4837('0x63')))[_0x4837('0x72')]();return db[_0x4837('0x4b')]['query'](_0x28a33f);}return[];})[_0x4837('0x24')](respondWithResult(_0x501b9b,null))[_0x4837('0x46')](handleError(_0x501b9b,null));};exports[_0x4837('0x81')]=function(_0x20ee47,_0x51ebe6,_0x4a8598){return db[_0x4837('0x82')][_0x4837('0x83')]({'where':{'VoiceQueueId':_0x20ee47[_0x4837('0x47')][_0x4837('0x84')],'CampaignId':_0x20ee47[_0x4837('0x47')]['CampaignId'],'ContactId':_0x20ee47['body'][_0x4837('0x63')]}})['then'](handleEntityNotFound(_0x51ebe6,null))[_0x4837('0x24')](function(_0x3c78f9){if(_0x3c78f9){return _0x3c78f9;}return null;})[_0x4837('0x24')](respondWithResult(_0x51ebe6,null))[_0x4837('0x46')](handleError(_0x51ebe6,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index b2a59bc..1d7230e 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 _0x3eec=['path','rimraf','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1ffe9c,_0x3fb215){var _0x4ed526=function(_0x656750){while(--_0x656750){_0x1ffe9c['push'](_0x1ffe9c['shift']());}};_0x4ed526(++_0x3fb215);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x1d1f8f,_0x50778c){_0x1d1f8f=_0x1d1f8f-0x0;var _0x20d217=_0x3eec[_0x1d1f8f];return _0x20d217;};'use strict';var _=require(_0xc3ee('0x0'));var util=require(_0xc3ee('0x1'));var logger=require(_0xc3ee('0x2'))(_0xc3ee('0x3'));var moment=require('moment');var BPromise=require(_0xc3ee('0x4'));var rp=require(_0xc3ee('0x5'));var fs=require('fs');var path=require(_0xc3ee('0x6'));var rimraf=require(_0xc3ee('0x7'));var config=require(_0xc3ee('0x8'));var attributes=require(_0xc3ee('0x9'));module['exports']=function(_0x471de7,_0xbd5b6){return _0x471de7[_0xc3ee('0xa')](_0xc3ee('0xb'),attributes,{'tableName':_0xc3ee('0xc'),'paranoid':![],'indexes':[{'name':_0xc3ee('0xd'),'fields':[_0xc3ee('0xd')]},{'name':_0xc3ee('0xe'),'fields':[_0xc3ee('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x534d=['calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final'];(function(_0x82a121,_0x5e9769){var _0x433473=function(_0x3adf03){while(--_0x3adf03){_0x82a121['push'](_0x82a121['shift']());}};_0x433473(++_0x5e9769);}(_0x534d,0x79));var _0xd534=function(_0xba302c,_0x53825f){_0xba302c=_0xba302c-0x0;var _0x5212c5=_0x534d[_0xba302c];return _0x5212c5;};'use strict';var _=require(_0xd534('0x0'));var util=require(_0xd534('0x1'));var logger=require(_0xd534('0x2'))(_0xd534('0x3'));var moment=require(_0xd534('0x4'));var BPromise=require(_0xd534('0x5'));var rp=require(_0xd534('0x6'));var fs=require('fs');var path=require(_0xd534('0x7'));var rimraf=require(_0xd534('0x8'));var config=require(_0xd534('0x9'));var attributes=require(_0xd534('0xa'));module[_0xd534('0xb')]=function(_0x2e9c44,_0x2ebe36){return _0x2e9c44[_0xd534('0xc')](_0xd534('0xd'),attributes,{'tableName':_0xd534('0xe'),'paranoid':![],'indexes':[{'name':_0xd534('0xf'),'fields':[_0xd534('0xf')]},{'name':'uniqueid','fields':[_0xd534('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 24d9f5b..3ee1fed 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 _0xe233=['message','catch','CmHopperFinal','create','body','options','raw','debug','CreateCmHopperFinal','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x533132,_0xf5b6fa){var _0x1a7447=function(_0x44d580){while(--_0x44d580){_0x533132['push'](_0x533132['shift']());}};_0x1a7447(++_0xf5b6fa);}(_0xe233,0x15b));var _0x3e23=function(_0x2ddd13,_0x4dd0bd){_0x2ddd13=_0x2ddd13-0x0;var _0x8b928b=_0xe233[_0x2ddd13];return _0x8b928b;};'use strict';var _=require(_0x3e23('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3e23('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e23('0x2'))['db'];var utils=require(_0x3e23('0x3'));var logger=require(_0x3e23('0x4'))(_0x3e23('0x5'));var config=require(_0x3e23('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3e23('0x7')][_0x3e23('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x391d80,_0x1fb864,_0x3d0631){return new BPromise(function(_0xec43a3,_0x35cd2c){return client[_0x3e23('0x9')](_0x391d80,_0x3d0631)[_0x3e23('0xa')](function(_0x3f524e){logger[_0x3e23('0xb')](_0x3e23('0xc'),_0x1fb864,_0x3e23('0xd'));logger['debug']('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x1fb864,_0x3e23('0xd'),JSON[_0x3e23('0xe')](_0x3f524e));if(_0x3f524e[_0x3e23('0xf')]){if(_0x3f524e[_0x3e23('0xf')][_0x3e23('0x10')]===0x1f4){logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x1fb864,_0x3f524e['error'][_0x3e23('0x11')]);return _0x35cd2c(_0x3f524e[_0x3e23('0xf')][_0x3e23('0x11')]);}logger[_0x3e23('0xf')](_0x3e23('0xc'),_0x1fb864,_0x3f524e[_0x3e23('0xf')]['message']);return _0xec43a3(_0x3f524e['error']['message']);}else{logger['info'](_0x3e23('0xc'),_0x1fb864,'request\x20sent');_0xec43a3(_0x3f524e['result'][_0x3e23('0x11')]);}})[_0x3e23('0x12')](function(_0x420516){logger['error'](_0x3e23('0xc'),_0x1fb864,_0x420516);_0x35cd2c(_0x420516);});});}exports['CreateCmHopperFinal']=function(_0x492f88){var _0x55790a=this;return new Promise(function(_0x13fe4f,_0x100924){return db[_0x3e23('0x13')][_0x3e23('0x14')](_0x492f88[_0x3e23('0x15')],{'raw':_0x492f88['options']?_0x492f88[_0x3e23('0x16')][_0x3e23('0x17')]===undefined?!![]:![]:!![]})[_0x3e23('0xa')](function(_0x30faeb){logger[_0x3e23('0xb')]('CreateCmHopperFinal',_0x492f88);logger[_0x3e23('0x18')](_0x3e23('0x19'),_0x492f88,JSON['stringify'](_0x30faeb));_0x13fe4f(_0x30faeb);})[_0x3e23('0x12')](function(_0x453f02){logger[_0x3e23('0xf')](_0x3e23('0x19'),_0x453f02[_0x3e23('0x11')],_0x492f88);_0x100924(_0x55790a['error'](0x1f4,_0x453f02['message']));});});}; \ No newline at end of file +var _0x086d=['error','code','message','CmHopperFinal,\x20%s,\x20%s','request\x20sent','result','catch','CreateCmHopperFinal','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x174b9c,_0x5692a4){var _0x1dfc20=function(_0x18561f){while(--_0x18561f){_0x174b9c['push'](_0x174b9c['shift']());}};_0x1dfc20(++_0x5692a4);}(_0x086d,0xb4));var _0xd086=function(_0x595e7d,_0x10af97){_0x595e7d=_0x595e7d-0x0;var _0x3a2b8a=_0x086d[_0x595e7d];return _0x3a2b8a;};'use strict';var _=require(_0xd086('0x0'));var util=require(_0xd086('0x1'));var moment=require(_0xd086('0x2'));var BPromise=require(_0xd086('0x3'));var rs=require(_0xd086('0x4'));var fs=require('fs');var Redis=require(_0xd086('0x5'));var db=require(_0xd086('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd086('0x7'));var jayson=require(_0xd086('0x8'));var client=jayson[_0xd086('0x9')][_0xd086('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12304d,_0x194c17,_0x28e406){return new BPromise(function(_0xeb86b8,_0x20d406){return client[_0xd086('0xb')](_0x12304d,_0x28e406)[_0xd086('0xc')](function(_0x1e4791){logger[_0xd086('0xd')]('CmHopperFinal,\x20%s,\x20%s',_0x194c17,'request\x20sent');logger['debug'](_0xd086('0xe'),_0x194c17,'request\x20sent',JSON[_0xd086('0xf')](_0x1e4791));if(_0x1e4791[_0xd086('0x10')]){if(_0x1e4791[_0xd086('0x10')][_0xd086('0x11')]===0x1f4){logger[_0xd086('0x10')]('CmHopperFinal,\x20%s,\x20%s',_0x194c17,_0x1e4791[_0xd086('0x10')][_0xd086('0x12')]);return _0x20d406(_0x1e4791[_0xd086('0x10')][_0xd086('0x12')]);}logger[_0xd086('0x10')]('CmHopperFinal,\x20%s,\x20%s',_0x194c17,_0x1e4791[_0xd086('0x10')][_0xd086('0x12')]);return _0xeb86b8(_0x1e4791[_0xd086('0x10')][_0xd086('0x12')]);}else{logger[_0xd086('0xd')](_0xd086('0x13'),_0x194c17,_0xd086('0x14'));_0xeb86b8(_0x1e4791[_0xd086('0x15')][_0xd086('0x12')]);}})[_0xd086('0x16')](function(_0x4cdf33){logger[_0xd086('0x10')]('CmHopperFinal,\x20%s,\x20%s',_0x194c17,_0x4cdf33);_0x20d406(_0x4cdf33);});});}exports[_0xd086('0x17')]=function(_0xd20196){var _0x59724f=this;return new Promise(function(_0x3e5d7a,_0x3d368c){return db['CmHopperFinal']['create'](_0xd20196[_0xd086('0x18')],{'raw':_0xd20196['options']?_0xd20196[_0xd086('0x19')][_0xd086('0x1a')]===undefined?!![]:![]:!![]})[_0xd086('0xc')](function(_0x409fef){logger[_0xd086('0xd')]('CreateCmHopperFinal',_0xd20196);logger[_0xd086('0x1b')]('CreateCmHopperFinal',_0xd20196,JSON['stringify'](_0x409fef));_0x3e5d7a(_0x409fef);})[_0xd086('0x16')](function(_0x1b1218){logger[_0xd086('0x10')](_0xd086('0x17'),_0x1b1218[_0xd086('0x12')],_0xd20196);_0x3d368c(_0x59724f[_0xd086('0x10')](0x1f4,_0x1b1218[_0xd086('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 55fafb8..5786a23 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 _0xcdd4=['/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','/:id','update','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post'];(function(_0x3ae7b5,_0x181515){var _0x57ed7f=function(_0x37cab5){while(--_0x37cab5){_0x3ae7b5['push'](_0x3ae7b5['shift']());}};_0x57ed7f(++_0x181515);}(_0xcdd4,0x179));var _0x4cdd=function(_0x3d3287,_0x8139e8){_0x3d3287=_0x3d3287-0x0;var _0x153b75=_0xcdd4[_0x3d3287];return _0x153b75;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4cdd('0x0'));var timeout=require(_0x4cdd('0x1'));var express=require(_0x4cdd('0x2'));var router=express[_0x4cdd('0x3')]();var auth=require(_0x4cdd('0x4'));var interaction=require(_0x4cdd('0x5'));var config=require(_0x4cdd('0x6'));var controller=require('./cmHopperFinal.controller');router[_0x4cdd('0x7')]('/',auth[_0x4cdd('0x8')](),controller[_0x4cdd('0x9')]);router[_0x4cdd('0x7')]('/describe',auth[_0x4cdd('0x8')](),controller['describe']);router['get']('/:id',auth[_0x4cdd('0x8')](),controller['show']);router['get'](_0x4cdd('0xa'),auth['isAuthenticated'](),controller[_0x4cdd('0xb')]);router['get']('/campaign/countAttributes/:id',auth[_0x4cdd('0x8')](),controller[_0x4cdd('0xc')]);router[_0x4cdd('0xd')](_0x4cdd('0xe'),auth[_0x4cdd('0x8')](),controller[_0x4cdd('0xf')]);router[_0x4cdd('0xd')](_0x4cdd('0x10'),auth[_0x4cdd('0x8')](),controller[_0x4cdd('0x11')]);router['post'](_0x4cdd('0x12'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0x4cdd('0x13')](_0x4cdd('0x14'),auth[_0x4cdd('0x8')](),controller[_0x4cdd('0x15')]);module[_0x4cdd('0x16')]=router; \ No newline at end of file +var _0x7f8f=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index','/describe','isAuthenticated','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','update'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x7f8f,0xe9));var _0xf7f8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7f8f[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xf7f8('0x0'));var util=require(_0xf7f8('0x1'));var path=require(_0xf7f8('0x2'));var timeout=require(_0xf7f8('0x3'));var express=require(_0xf7f8('0x4'));var router=express[_0xf7f8('0x5')]();var auth=require(_0xf7f8('0x6'));var interaction=require(_0xf7f8('0x7'));var config=require(_0xf7f8('0x8'));var controller=require(_0xf7f8('0x9'));router[_0xf7f8('0xa')]('/',auth['isAuthenticated'](),controller[_0xf7f8('0xb')]);router['get'](_0xf7f8('0xc'),auth[_0xf7f8('0xd')](),controller['describe']);router[_0xf7f8('0xa')](_0xf7f8('0xe'),auth[_0xf7f8('0xd')](),controller[_0xf7f8('0xf')]);router[_0xf7f8('0xa')](_0xf7f8('0x10'),auth[_0xf7f8('0xd')](),controller[_0xf7f8('0x11')]);router['get'](_0xf7f8('0x12'),auth['isAuthenticated'](),controller[_0xf7f8('0x13')]);router[_0xf7f8('0x14')](_0xf7f8('0x15'),auth[_0xf7f8('0xd')](),controller[_0xf7f8('0x16')]);router[_0xf7f8('0x14')](_0xf7f8('0x17'),auth[_0xf7f8('0xd')](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0xf7f8('0x18'),auth[_0xf7f8('0xd')](),controller[_0xf7f8('0x19')]);router[_0xf7f8('0x1a')]('/:id',auth[_0xf7f8('0xd')](),controller[_0xf7f8('0x1b')]);module[_0xf7f8('0x1c')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 7fbafc3..af21538 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 _0xbdfe=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x102b0c,_0x55ccdf){var _0x505937=function(_0x1dad22){while(--_0x1dad22){_0x102b0c['push'](_0x102b0c['shift']());}};_0x505937(++_0x55ccdf);}(_0xbdfe,0xdf));var _0xebdf=function(_0x26c112,_0x41e2fd){_0x26c112=_0x26c112-0x0;var _0x4933d8=_0xbdfe[_0x26c112];return _0x4933d8;};'use strict';var Sequelize=require(_0xebdf('0x0'));module[_0xebdf('0x1')]={'state':{'type':Sequelize[_0xebdf('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xebdf('0x3')]},'scheduledat':{'type':Sequelize[_0xebdf('0x4')]},'countbusyretry':{'type':Sequelize[_0xebdf('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xebdf('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xebdf('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xebdf('0x3')]},'originatecalleridname':{'type':Sequelize[_0xebdf('0x3')]},'calleridnum':{'type':Sequelize[_0xebdf('0x3')]},'calleridname':{'type':Sequelize[_0xebdf('0x3')]},'starttime':{'type':Sequelize[_0xebdf('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xebdf('0x4')]},'droptime':{'type':Sequelize[_0xebdf('0x4')]},'endtime':{'type':Sequelize[_0xebdf('0x4')]},'ringtime':{'type':Sequelize[_0xebdf('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xebdf('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xebdf('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xebdf('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xebdf('0x3')]},'campaign':{'type':Sequelize[_0xebdf('0x3')]},'campaigntype':{'type':Sequelize[_0xebdf('0x3')]},'membername':{'type':Sequelize[_0xebdf('0x3')]},'reason':{'type':Sequelize[_0xebdf('0x3')]},'amd':{'type':Sequelize[_0xebdf('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xebdf('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xebdf('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xebdf('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xebdf('0x4')]},'recallme':{'type':Sequelize[_0xebdf('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xebdf('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xebdf('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xebdf('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xebdf('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xebdf('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xebdf('0x3')]}}; \ No newline at end of file +var _0x2d72=['STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x79df52,_0x25c230){var _0x446b33=function(_0x268785){while(--_0x268785){_0x79df52['push'](_0x79df52['shift']());}};_0x446b33(++_0x25c230);}(_0x2d72,0x8b));var _0x22d7=function(_0xb706a1,_0x2a0725){_0xb706a1=_0xb706a1-0x0;var _0x4c92ac=_0x2d72[_0xb706a1];return _0x4c92ac;};'use strict';var Sequelize=require(_0x22d7('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x22d7('0x1')]},'scheduledat':{'type':Sequelize[_0x22d7('0x2')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x22d7('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x22d7('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x22d7('0x1')]},'originatecalleridnum':{'type':Sequelize[_0x22d7('0x1')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x22d7('0x1')]},'calleridname':{'type':Sequelize[_0x22d7('0x1')]},'starttime':{'type':Sequelize[_0x22d7('0x2')]},'responsetime':{'type':Sequelize[_0x22d7('0x2')]},'answertime':{'type':Sequelize[_0x22d7('0x2')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x22d7('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x22d7('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x22d7('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x22d7('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x22d7('0x1')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x22d7('0x1')]},'membername':{'type':Sequelize[_0x22d7('0x1')]},'reason':{'type':Sequelize[_0x22d7('0x1')]},'amd':{'type':Sequelize[_0x22d7('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x22d7('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x22d7('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x22d7('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x22d7('0x2')]},'recallme':{'type':Sequelize[_0x22d7('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x22d7('0x2')]},'edited':{'type':Sequelize[_0x22d7('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x22d7('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x22d7('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x22d7('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x22d7('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x22d7('0x3')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x22d7('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 62bd2e1..3cdd64d 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 _0x04d0=['to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','count','offset','status','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','CmHopperHistory','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','create','describe','body','uniqueid','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','sox'];(function(_0x323670,_0x3ab327){var _0x91343=function(_0x38cf98){while(--_0x38cf98){_0x323670['push'](_0x323670['shift']());}};_0x91343(++_0x3ab327);}(_0x04d0,0x125));var _0x004d=function(_0x560f19,_0x3cc2d5){_0x560f19=_0x560f19-0x0;var _0x46036e=_0x04d0[_0x560f19];return _0x46036e;};'use strict';var pdf=require(_0x004d('0x0'));var emlformat=require(_0x004d('0x1'));var rimraf=require(_0x004d('0x2'));var zipdir=require(_0x004d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x004d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x004d('0x5'));var util=require('util');var path=require('path');var sox=require(_0x004d('0x6'));var csv=require(_0x004d('0x7'));var ejs=require(_0x004d('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x004d('0x9'));var crypto=require(_0x004d('0xa'));var jsforce=require(_0x004d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x004d('0x7'));var querystring=require(_0x004d('0xc'));var Papa=require(_0x004d('0xd'));var Redis=require(_0x004d('0xe'));var authService=require(_0x004d('0xf'));var qs=require(_0x004d('0x10'));var as=require(_0x004d('0x11'));var hardwareService=require(_0x004d('0x12'));var logger=require(_0x004d('0x13'))('api');var utils=require(_0x004d('0x14'));var config=require(_0x004d('0x15'));var db=require(_0x004d('0x16'))['db'];function respondWithStatusCode(_0xdc1fc4,_0x4ffef2){_0x4ffef2=_0x4ffef2||0xcc;return function(_0x1040e9){if(_0x1040e9){return _0xdc1fc4[_0x004d('0x17')](_0x4ffef2);}return _0xdc1fc4['status'](_0x4ffef2)['end']();};}function respondWithResult(_0x58223e,_0x266a29){_0x266a29=_0x266a29||0xc8;return function(_0x355bcf){if(_0x355bcf){return _0x58223e['status'](_0x266a29)[_0x004d('0x18')](_0x355bcf);}};}function respondWithFilteredResult(_0x238dca,_0x4885fe){return function(_0x4f5c50){if(_0x4f5c50){var _0x5021c0=_0x4f5c50[_0x004d('0x19')],_0x300ed8=_0x4885fe[_0x004d('0x1a')],_0x5ea39b=_0x4885fe[_0x004d('0x1a')]+_0x4885fe['limit'],_0x10b7d0;if(_0x5ea39b>=_0x5021c0){_0x5ea39b=_0x5021c0;_0x10b7d0=0xc8;}else{_0x10b7d0=0xce;}_0x238dca[_0x004d('0x1b')](_0x10b7d0);return _0x238dca[_0x004d('0x1c')](_0x004d('0x1d'),_0x300ed8+'-'+_0x5ea39b+'/'+_0x5021c0)[_0x004d('0x18')](_0x4f5c50);}return null;};}function patchUpdates(_0x2582e2){return function(_0x304b10){try{jsonpatch['apply'](_0x304b10,_0x2582e2,!![]);}catch(_0x56646a){return BPromise['reject'](_0x56646a);}return _0x304b10[_0x004d('0x1e')]();};}function saveUpdates(_0x1696a5,_0x383440){return function(_0x33ea50){if(_0x33ea50){return _0x33ea50[_0x004d('0x1f')](_0x1696a5)[_0x004d('0x20')](function(_0x50f437){return _0x50f437;});}return null;};}function removeEntity(_0xe9b600,_0x560230){return function(_0x527790){if(_0x527790){return _0x527790[_0x004d('0x21')]()[_0x004d('0x20')](function(){_0xe9b600['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b85c2,_0x2e8153){return function(_0x57d8e7){if(!_0x57d8e7){_0x5b85c2[_0x004d('0x17')](0x194);}return _0x57d8e7;};}function handleError(_0x4869da,_0x3ebae5){_0x3ebae5=_0x3ebae5||0x1f4;return function(_0x575c40){logger[_0x004d('0x22')](_0x575c40[_0x004d('0x23')]);if(_0x575c40[_0x004d('0x24')]){delete _0x575c40[_0x004d('0x24')];}_0x4869da[_0x004d('0x1b')](_0x3ebae5)[_0x004d('0x25')](_0x575c40);};}exports[_0x004d('0x26')]=function(_0x3e96b4,_0x160acd){var _0x2bdb9={},_0x3afd5c={},_0x12cf69={'count':0x0,'rows':[]};var _0x3d136e=_[_0x004d('0x27')](db[_0x004d('0x28')]['rawAttributes'],function(_0x31e0cc){return{'name':_0x31e0cc[_0x004d('0x29')],'type':_0x31e0cc['type'][_0x004d('0x2a')]};});_0x3afd5c[_0x004d('0x2b')]=_[_0x004d('0x27')](_0x3d136e,_0x004d('0x24'));_0x3afd5c[_0x004d('0x2c')]=_[_0x004d('0x2d')](_0x3e96b4[_0x004d('0x2c')]);_0x3afd5c[_0x004d('0x2e')]=_[_0x004d('0x2f')](_0x3afd5c['model'],_0x3afd5c[_0x004d('0x2c')]);_0x2bdb9['attributes']=_[_0x004d('0x2f')](_0x3afd5c[_0x004d('0x2b')],qs[_0x004d('0x30')](_0x3e96b4[_0x004d('0x2c')]['fields']));_0x2bdb9[_0x004d('0x31')]=_0x2bdb9['attributes']['length']?_0x2bdb9[_0x004d('0x31')]:_0x3afd5c[_0x004d('0x2b')];if(!_0x3e96b4[_0x004d('0x2c')][_0x004d('0x32')](_0x004d('0x33'))){_0x2bdb9[_0x004d('0x34')]=qs[_0x004d('0x34')](_0x3e96b4[_0x004d('0x2c')][_0x004d('0x34')]);_0x2bdb9[_0x004d('0x1a')]=qs[_0x004d('0x1a')](_0x3e96b4[_0x004d('0x2c')]['offset']);}_0x2bdb9['order']=qs['sort'](_0x3e96b4[_0x004d('0x2c')][_0x004d('0x35')]);_0x2bdb9[_0x004d('0x36')]=qs[_0x004d('0x2e')](_[_0x004d('0x37')](_0x3e96b4['query'],_0x3afd5c[_0x004d('0x2e')]),_0x3d136e);if(_0x3e96b4['query'][_0x004d('0x38')]){_0x2bdb9[_0x004d('0x36')]=_[_0x004d('0x39')](_0x2bdb9[_0x004d('0x36')],{'$or':_[_0x004d('0x27')](_0x3d136e,function(_0x3328f6){if(_0x3328f6[_0x004d('0x3a')]!==_0x004d('0x3b')){var _0x4d6d72={};_0x4d6d72[_0x3328f6[_0x004d('0x24')]]={'$like':'%'+_0x3e96b4[_0x004d('0x2c')]['filter']+'%'};return _0x4d6d72;}})});}_0x2bdb9=_['merge']({},_0x2bdb9,_0x3e96b4[_0x004d('0x3c')]);var _0x367465={'where':_0x2bdb9['where']};return db[_0x004d('0x28')][_0x004d('0x19')](_0x367465)[_0x004d('0x20')](function(_0x12c6c2){_0x12cf69[_0x004d('0x19')]=_0x12c6c2;if(_0x3e96b4['query']['includeAll']){_0x2bdb9[_0x004d('0x3d')]=[{'all':!![]}];}return db[_0x004d('0x28')][_0x004d('0x3e')](_0x2bdb9);})['then'](function(_0xc81178){_0x12cf69[_0x004d('0x3f')]=_0xc81178;return _0x12cf69;})[_0x004d('0x20')](respondWithFilteredResult(_0x160acd,_0x2bdb9))[_0x004d('0x40')](handleError(_0x160acd,null));};exports[_0x004d('0x41')]=function(_0x434069,_0x483a90){var _0x376809={'raw':!![],'where':{'id':_0x434069[_0x004d('0x42')]['id']}},_0x19713f={};_0x19713f[_0x004d('0x2b')]=_[_0x004d('0x2d')](db['CmHopperHistory'][_0x004d('0x43')]);_0x19713f[_0x004d('0x2c')]=_[_0x004d('0x2d')](_0x434069[_0x004d('0x2c')]);_0x19713f[_0x004d('0x2e')]=_[_0x004d('0x2f')](_0x19713f[_0x004d('0x2b')],_0x19713f[_0x004d('0x2c')]);_0x376809['attributes']=_[_0x004d('0x2f')](_0x19713f[_0x004d('0x2b')],qs['fields'](_0x434069['query'][_0x004d('0x30')]));_0x376809[_0x004d('0x31')]=_0x376809[_0x004d('0x31')][_0x004d('0x44')]?_0x376809[_0x004d('0x31')]:_0x19713f[_0x004d('0x2b')];if(_0x434069[_0x004d('0x2c')][_0x004d('0x45')]){_0x376809['include']=[{'all':!![]}];}_0x376809=_[_0x004d('0x39')]({},_0x376809,_0x434069[_0x004d('0x3c')]);return db['CmHopperHistory']['find'](_0x376809)['then'](handleEntityNotFound(_0x483a90,null))['then'](respondWithResult(_0x483a90,null))['catch'](handleError(_0x483a90,null));};exports[_0x004d('0x46')]=function(_0x564fc6,_0x39d1b2){return db['CmHopperHistory']['create'](_0x564fc6['body'],{})[_0x004d('0x20')](respondWithResult(_0x39d1b2,0xc9))['catch'](handleError(_0x39d1b2,null));};exports[_0x004d('0x47')]=function(_0x3031c0,_0x426044){return db[_0x004d('0x28')][_0x004d('0x47')]()['then'](respondWithResult(_0x426044,null))['catch'](handleError(_0x426044,null));};exports['update']=function(_0x3a935c,_0x542b58){if(_0x3a935c[_0x004d('0x48')][_0x004d('0x49')]){delete _0x3a935c[_0x004d('0x48')][_0x004d('0x49')];}return db[_0x004d('0x28')][_0x004d('0x4a')]({'where':{'uniqueid':_0x3a935c[_0x004d('0x42')]['id']}})['then'](handleEntityNotFound(_0x542b58,null))['then'](saveUpdates(_0x3a935c[_0x004d('0x48')],null))[_0x004d('0x20')](respondWithResult(_0x542b58,null))[_0x004d('0x40')](handleError(_0x542b58,null));}; \ No newline at end of file +var _0x896d=['offset','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','show','find','catch','create','body','describe','uniqueid','html-pdf','eml-format','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','sendStatus','status','count'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x896d,0xb9));var _0xd896=function(_0x5aa23e,_0x4f05a7){_0x5aa23e=_0x5aa23e-0x0;var _0x48dccf=_0x896d[_0x5aa23e];return _0x48dccf;};'use strict';var pdf=require(_0xd896('0x0'));var emlformat=require(_0xd896('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd896('0x2'));var rp=require(_0xd896('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd896('0x4'));var util=require('util');var path=require(_0xd896('0x5'));var sox=require(_0xd896('0x6'));var csv=require(_0xd896('0x7'));var ejs=require(_0xd896('0x8'));var fs=require('fs');var _=require(_0xd896('0x9'));var squel=require(_0xd896('0xa'));var crypto=require(_0xd896('0xb'));var jsforce=require(_0xd896('0xc'));var deskjs=require(_0xd896('0xd'));var toCsv=require(_0xd896('0x7'));var querystring=require(_0xd896('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd896('0xf'));var qs=require(_0xd896('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd896('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd896('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e1f46,_0x350bbd){_0x350bbd=_0x350bbd||0xcc;return function(_0x3d3304){if(_0x3d3304){return _0x5e1f46[_0xd896('0x13')](_0x350bbd);}return _0x5e1f46[_0xd896('0x14')](_0x350bbd)['end']();};}function respondWithResult(_0x1bb86f,_0x2386d1){_0x2386d1=_0x2386d1||0xc8;return function(_0x4fa155){if(_0x4fa155){return _0x1bb86f[_0xd896('0x14')](_0x2386d1)['json'](_0x4fa155);}};}function respondWithFilteredResult(_0x5be88b,_0x3e9c9f){return function(_0x1a3ca3){if(_0x1a3ca3){var _0x466432=_0x1a3ca3[_0xd896('0x15')],_0x152aa6=_0x3e9c9f[_0xd896('0x16')],_0x2c30b5=_0x3e9c9f[_0xd896('0x16')]+_0x3e9c9f['limit'],_0x27a740;if(_0x2c30b5>=_0x466432){_0x2c30b5=_0x466432;_0x27a740=0xc8;}else{_0x27a740=0xce;}_0x5be88b[_0xd896('0x14')](_0x27a740);return _0x5be88b['set'](_0xd896('0x17'),_0x152aa6+'-'+_0x2c30b5+'/'+_0x466432)[_0xd896('0x18')](_0x1a3ca3);}return null;};}function patchUpdates(_0x19e239){return function(_0x20b276){try{jsonpatch[_0xd896('0x19')](_0x20b276,_0x19e239,!![]);}catch(_0x4e634e){return BPromise[_0xd896('0x1a')](_0x4e634e);}return _0x20b276[_0xd896('0x1b')]();};}function saveUpdates(_0x1ce66f,_0x45d4d3){return function(_0x4cd405){if(_0x4cd405){return _0x4cd405[_0xd896('0x1c')](_0x1ce66f)[_0xd896('0x1d')](function(_0x58c66a){return _0x58c66a;});}return null;};}function removeEntity(_0x3f4bc9,_0x4e9cf3){return function(_0x1e0314){if(_0x1e0314){return _0x1e0314[_0xd896('0x1e')]()[_0xd896('0x1d')](function(){_0x3f4bc9['status'](0xcc)[_0xd896('0x1f')]();});}};}function handleEntityNotFound(_0x5f1801,_0x2e6535){return function(_0x187c5c){if(!_0x187c5c){_0x5f1801[_0xd896('0x13')](0x194);}return _0x187c5c;};}function handleError(_0x3c14a3,_0x4394b8){_0x4394b8=_0x4394b8||0x1f4;return function(_0x166cd5){logger[_0xd896('0x20')](_0x166cd5[_0xd896('0x21')]);if(_0x166cd5['name']){delete _0x166cd5[_0xd896('0x22')];}_0x3c14a3[_0xd896('0x14')](_0x4394b8)['send'](_0x166cd5);};}exports['index']=function(_0xa1a8e8,_0x3b3348){var _0x53e166={},_0xc8ed21={},_0x473eb5={'count':0x0,'rows':[]};var _0x2e7c0c=_[_0xd896('0x23')](db[_0xd896('0x24')][_0xd896('0x25')],function(_0x2555cc){return{'name':_0x2555cc[_0xd896('0x26')],'type':_0x2555cc[_0xd896('0x27')][_0xd896('0x28')]};});_0xc8ed21[_0xd896('0x29')]=_[_0xd896('0x23')](_0x2e7c0c,_0xd896('0x22'));_0xc8ed21[_0xd896('0x2a')]=_[_0xd896('0x2b')](_0xa1a8e8[_0xd896('0x2a')]);_0xc8ed21[_0xd896('0x2c')]=_[_0xd896('0x2d')](_0xc8ed21[_0xd896('0x29')],_0xc8ed21[_0xd896('0x2a')]);_0x53e166[_0xd896('0x2e')]=_['intersection'](_0xc8ed21[_0xd896('0x29')],qs[_0xd896('0x2f')](_0xa1a8e8['query'][_0xd896('0x2f')]));_0x53e166[_0xd896('0x2e')]=_0x53e166[_0xd896('0x2e')][_0xd896('0x30')]?_0x53e166[_0xd896('0x2e')]:_0xc8ed21[_0xd896('0x29')];if(!_0xa1a8e8[_0xd896('0x2a')]['hasOwnProperty'](_0xd896('0x31'))){_0x53e166[_0xd896('0x32')]=qs[_0xd896('0x32')](_0xa1a8e8[_0xd896('0x2a')]['limit']);_0x53e166['offset']=qs[_0xd896('0x16')](_0xa1a8e8[_0xd896('0x2a')][_0xd896('0x16')]);}_0x53e166[_0xd896('0x33')]=qs[_0xd896('0x34')](_0xa1a8e8[_0xd896('0x2a')][_0xd896('0x34')]);_0x53e166['where']=qs[_0xd896('0x2c')](_[_0xd896('0x35')](_0xa1a8e8[_0xd896('0x2a')],_0xc8ed21[_0xd896('0x2c')]),_0x2e7c0c);if(_0xa1a8e8['query'][_0xd896('0x36')]){_0x53e166['where']=_[_0xd896('0x37')](_0x53e166[_0xd896('0x38')],{'$or':_[_0xd896('0x23')](_0x2e7c0c,function(_0x1d4c2f){if(_0x1d4c2f[_0xd896('0x27')]!==_0xd896('0x39')){var _0x3f9bae={};_0x3f9bae[_0x1d4c2f['name']]={'$like':'%'+_0xa1a8e8[_0xd896('0x2a')][_0xd896('0x36')]+'%'};return _0x3f9bae;}})});}_0x53e166=_[_0xd896('0x37')]({},_0x53e166,_0xa1a8e8[_0xd896('0x3a')]);var _0x1ca04f={'where':_0x53e166[_0xd896('0x38')]};return db[_0xd896('0x24')]['count'](_0x1ca04f)[_0xd896('0x1d')](function(_0x32f4eb){_0x473eb5[_0xd896('0x15')]=_0x32f4eb;if(_0xa1a8e8['query'][_0xd896('0x3b')]){_0x53e166[_0xd896('0x3c')]=[{'all':!![]}];}return db[_0xd896('0x24')]['findAll'](_0x53e166);})['then'](function(_0x1cc46c){_0x473eb5[_0xd896('0x3d')]=_0x1cc46c;return _0x473eb5;})[_0xd896('0x1d')](respondWithFilteredResult(_0x3b3348,_0x53e166))['catch'](handleError(_0x3b3348,null));};exports[_0xd896('0x3e')]=function(_0x4e6a7e,_0x3419d6){var _0x57a206={'raw':!![],'where':{'id':_0x4e6a7e['params']['id']}},_0x33e6a1={};_0x33e6a1['model']=_[_0xd896('0x2b')](db['CmHopperHistory']['rawAttributes']);_0x33e6a1[_0xd896('0x2a')]=_['keys'](_0x4e6a7e[_0xd896('0x2a')]);_0x33e6a1[_0xd896('0x2c')]=_[_0xd896('0x2d')](_0x33e6a1['model'],_0x33e6a1[_0xd896('0x2a')]);_0x57a206[_0xd896('0x2e')]=_['intersection'](_0x33e6a1['model'],qs[_0xd896('0x2f')](_0x4e6a7e[_0xd896('0x2a')][_0xd896('0x2f')]));_0x57a206[_0xd896('0x2e')]=_0x57a206[_0xd896('0x2e')][_0xd896('0x30')]?_0x57a206['attributes']:_0x33e6a1['model'];if(_0x4e6a7e[_0xd896('0x2a')]['includeAll']){_0x57a206['include']=[{'all':!![]}];}_0x57a206=_['merge']({},_0x57a206,_0x4e6a7e[_0xd896('0x3a')]);return db['CmHopperHistory'][_0xd896('0x3f')](_0x57a206)[_0xd896('0x1d')](handleEntityNotFound(_0x3419d6,null))['then'](respondWithResult(_0x3419d6,null))[_0xd896('0x40')](handleError(_0x3419d6,null));};exports[_0xd896('0x41')]=function(_0x36c498,_0x4ccc7b){return db[_0xd896('0x24')][_0xd896('0x41')](_0x36c498[_0xd896('0x42')],{})[_0xd896('0x1d')](respondWithResult(_0x4ccc7b,0xc9))[_0xd896('0x40')](handleError(_0x4ccc7b,null));};exports[_0xd896('0x43')]=function(_0x2aef11,_0x5c9a5f){return db[_0xd896('0x24')]['describe']()[_0xd896('0x1d')](respondWithResult(_0x5c9a5f,null))[_0xd896('0x40')](handleError(_0x5c9a5f,null));};exports[_0xd896('0x1c')]=function(_0x57ea21,_0x5398c8){if(_0x57ea21[_0xd896('0x42')][_0xd896('0x44')]){delete _0x57ea21[_0xd896('0x42')]['uniqueid'];}return db[_0xd896('0x24')][_0xd896('0x3f')]({'where':{'uniqueid':_0x57ea21['params']['id']}})[_0xd896('0x1d')](handleEntityNotFound(_0x5398c8,null))[_0xd896('0x1d')](saveUpdates(_0x57ea21['body'],null))[_0xd896('0x1d')](respondWithResult(_0x5398c8,null))['catch'](handleError(_0x5398c8,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index fc69ac6..677e214 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 _0xbec8=['moment','request-promise','path','rimraf','exports','CmHopperHistory','uniqueid','lodash','util','../../config/logger','api'];(function(_0x3e6fc7,_0x170141){var _0x295068=function(_0x435148){while(--_0x435148){_0x3e6fc7['push'](_0x3e6fc7['shift']());}};_0x295068(++_0x170141);}(_0xbec8,0x125));var _0x8bec=function(_0x5b7696,_0x3ebd92){_0x5b7696=_0x5b7696-0x0;var _0x42d7b9=_0xbec8[_0x5b7696];return _0x42d7b9;};'use strict';var _=require(_0x8bec('0x0'));var util=require(_0x8bec('0x1'));var logger=require(_0x8bec('0x2'))(_0x8bec('0x3'));var moment=require(_0x8bec('0x4'));var BPromise=require('bluebird');var rp=require(_0x8bec('0x5'));var fs=require('fs');var path=require(_0x8bec('0x6'));var rimraf=require(_0x8bec('0x7'));var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module[_0x8bec('0x8')]=function(_0x2fe6fd,_0x67cf05){return _0x2fe6fd['define'](_0x8bec('0x9'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':'uniqueid','fields':[_0x8bec('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x988a=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./cmHopperHistory.attributes','exports','CmHopperHistory','cm_hopper_history'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0x988a,0x153));var _0xa988=function(_0x4e528c,_0x7d0b00){_0x4e528c=_0x4e528c-0x0;var _0x42a01e=_0x988a[_0x4e528c];return _0x42a01e;};'use strict';var _=require(_0xa988('0x0'));var util=require(_0xa988('0x1'));var logger=require(_0xa988('0x2'))(_0xa988('0x3'));var moment=require(_0xa988('0x4'));var BPromise=require(_0xa988('0x5'));var rp=require(_0xa988('0x6'));var fs=require('fs');var path=require(_0xa988('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa988('0x8'));module[_0xa988('0x9')]=function(_0x574aab,_0x37aa45){return _0x574aab['define'](_0xa988('0xa'),attributes,{'tableName':_0xa988('0xb'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0xa988('0xc'),'fields':[_0xa988('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 3125418..b1bcd09 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(_0x3f4cd0,_0x303070){var _0x3f9f01=function(_0x6ced93){while(--_0x6ced93){_0x3f4cd0['push'](_0x3f4cd0['shift']());}};_0x3f9f01(++_0x303070);}(_0x5eb8,0xb0));var _0x85eb=function(_0x3a1ea5,_0x349f01){_0x3a1ea5=_0x3a1ea5-0x0;var _0xfac9b2=_0x5eb8[_0x3a1ea5];return _0xfac9b2;};'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 _0x8603=['create','options','raw','debug','stringify','AvgHandleTime','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','findAll','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','`state`\x20=\x204,\x201,\x20null','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory'];(function(_0x358868,_0x228470){var _0x53511b=function(_0x1b6f31){while(--_0x1b6f31){_0x358868['push'](_0x358868['shift']());}};_0x53511b(++_0x228470);}(_0x8603,0x190));var _0x3860=function(_0x12edf3,_0x2dc683){_0x12edf3=_0x12edf3-0x0;var _0x3e8216=_0x8603[_0x12edf3];return _0x3e8216;};'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);});});}exports[_0x3860('0x12')]=function(_0x45b799){var _0x4b6b15=this;return new Promise(function(_0x4863bd,_0x373b06){return db[_0x3860('0x13')][_0x3860('0x14')](_0x45b799['body'],{'raw':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x16')]===undefined?!![]:![]:!![]})[_0x3860('0x9')](function(_0x20a5b0){logger[_0x3860('0xf')](_0x3860('0x12'),_0x45b799);logger[_0x3860('0x17')](_0x3860('0x12'),_0x45b799,JSON[_0x3860('0x18')](_0x20a5b0));_0x4863bd(_0x20a5b0);})[_0x3860('0x11')](function(_0x2e0b6e){logger[_0x3860('0xd')](_0x3860('0x12'),_0x2e0b6e[_0x3860('0xe')],_0x45b799);_0x373b06(_0x4b6b15['error'](0x1f4,_0x2e0b6e[_0x3860('0xe')]));});});};exports[_0x3860('0x19')]=function(_0x2b91f2){var _0x301e03=this;return new Promise(function(_0x20bb1e,_0x56a6d1){return db[_0x3860('0x13')]['findAll']({'raw':_0x2b91f2['options']?_0x2b91f2[_0x3860('0x15')][_0x3860('0x16')]===undefined?!![]:![]:!![],'where':_0x2b91f2['options']?_0x2b91f2['options']['where']||null:null,'attributes':[[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')][_0x3860('0x1c')]('id')),_0x3860('0x1d')],[db[_0x3860('0x1a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3860('0x1a')][_0x3860('0x1e')]('`state`\x20=\x204,\x201,\x20null'))),_0x3860('0x1f')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db[_0x3860('0x1a')]['literal'](_0x3860('0x20')))),_0x3860('0x21')],[db[_0x3860('0x1a')]['fn']('COUNT',db[_0x3860('0x1a')]['fn']('IF',db['sequelize'][_0x3860('0x1e')]('`state`\x20=\x2011,\x201,\x20null'))),_0x3860('0x22')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x23'),db['sequelize']['fn']('IF',db[_0x3860('0x1a')][_0x3860('0x1e')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x3860('0x24')],[db['sequelize']['fn'](_0x3860('0x23'),db[_0x3860('0x1a')]['fn']('IF',db[_0x3860('0x1a')][_0x3860('0x1e')](_0x3860('0x25')))),_0x3860('0x26')]]})[_0x3860('0x9')](function(_0x4d30bc){logger[_0x3860('0xf')](_0x3860('0x19'),_0x2b91f2);logger['debug'](_0x3860('0x19'),_0x2b91f2,JSON[_0x3860('0x18')](_0x4d30bc));_0x20bb1e(_0x4d30bc);})[_0x3860('0x11')](function(_0x5af661){logger['error'](_0x3860('0x19'),_0x5af661[_0x3860('0xe')],_0x2b91f2);_0x56a6d1(_0x301e03[_0x3860('0xd')](0x1f4,_0x5af661[_0x3860('0xe')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x4d6b1c){var _0x3ad0aa=this;return new Promise(function(_0x40dae8,_0xc715a0){return db[_0x3860('0x13')][_0x3860('0x27')]({'raw':_0x4d6b1c['options']?_0x4d6b1c[_0x3860('0x15')][_0x3860('0x16')]===undefined?!![]:![]:!![],'where':_0x4d6b1c['options']?_0x4d6b1c['options'][_0x3860('0x28')]||null:null,'attributes':[[_0x3860('0x29'),_0x3860('0x2a')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db['sequelize']['fn']('IF',db[_0x3860('0x1a')]['literal'](_0x3860('0x2b')))),_0x3860('0x2c')],[db['sequelize']['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db['sequelize'][_0x3860('0x1e')](_0x3860('0x2d')))),_0x3860('0x2e')],[db[_0x3860('0x1a')]['fn']('COUNT',db[_0x3860('0x1a')]['fn']('IF',db[_0x3860('0x1a')][_0x3860('0x1e')]('`state`\x20=\x204,\x201,\x20null'))),_0x3860('0x2f')],[db['sequelize']['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db[_0x3860('0x1a')][_0x3860('0x1e')](_0x3860('0x30')))),_0x3860('0x31')],[db['sequelize']['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db['sequelize']['literal'](_0x3860('0x32')))),_0x3860('0x33')],[db['sequelize']['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db['sequelize'][_0x3860('0x1e')](_0x3860('0x34')))),_0x3860('0x35')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db[_0x3860('0x1a')][_0x3860('0x1e')](_0x3860('0x36')))),_0x3860('0x37')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db['sequelize'][_0x3860('0x1e')]('`state`\x20=\x2012,\x201,\x20null'))),_0x3860('0x38')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db[_0x3860('0x1a')][_0x3860('0x1e')](_0x3860('0x39')))),_0x3860('0x3a')],[db['sequelize']['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db[_0x3860('0x1a')]['literal'](_0x3860('0x3b')))),_0x3860('0x3c')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db['sequelize']['fn']('IF',db['sequelize'][_0x3860('0x1e')]('`state`\x20=\x2018,\x201,\x20null'))),_0x3860('0x3d')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db['sequelize']['fn']('IF',db[_0x3860('0x1a')]['literal'](_0x3860('0x3e')))),'outboundAnswerAgiCallsDay'],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db['sequelize']['literal'](_0x3860('0x3f')))),_0x3860('0x3d')],[db['sequelize']['fn'](_0x3860('0x1b'),db['sequelize']['fn']('IF',db[_0x3860('0x1a')][_0x3860('0x1e')](_0x3860('0x40')))),_0x3860('0x41')]],'group':[_0x3860('0x29')]})[_0x3860('0x9')](function(_0x3fad85){logger['info'](_0x3860('0x42'),_0x4d6b1c);logger[_0x3860('0x17')](_0x3860('0x42'),_0x4d6b1c,JSON[_0x3860('0x18')](_0x3fad85));_0x40dae8(_0x3fad85);})[_0x3860('0x11')](function(_0x447163){logger['error'](_0x3860('0x42'),_0x447163[_0x3860('0xe')],_0x4d6b1c);_0xc715a0(_0x3ad0aa[_0x3860('0xd')](0x1f4,_0x447163[_0x3860('0xe')]));});});};exports[_0x3860('0x43')]=function(_0x1e2b5d){var _0xe2b761=this;return new Promise(function(_0x1874f2,_0x48b603){return db[_0x3860('0x13')][_0x3860('0x27')]({'raw':_0x1e2b5d['options']?_0x1e2b5d[_0x3860('0x15')][_0x3860('0x16')]===undefined?!![]:![]:!![],'where':_0x1e2b5d[_0x3860('0x15')]?_0x1e2b5d['options'][_0x3860('0x28')]||null:null,'attributes':[['campaign',_0x3860('0x2a')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')][_0x3860('0x1c')]('id')),_0x3860('0x44')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db[_0x3860('0x1a')][_0x3860('0x1e')](_0x3860('0x45')))),'ivrAnswerCallsDay']],'group':['campaign']})['then'](function(_0x5fbea0){logger['info']('GetCampaignHopperHistory',_0x1e2b5d);logger[_0x3860('0x17')](_0x3860('0x43'),_0x1e2b5d,JSON[_0x3860('0x18')](_0x5fbea0));_0x1874f2(_0x5fbea0);})[_0x3860('0x11')](function(_0x3d6c17){logger[_0x3860('0xd')]('GetCampaignHopperHistory',_0x3d6c17['message'],_0x1e2b5d);_0x48b603(_0xe2b761['error'](0x1f4,_0x3d6c17[_0x3860('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index f917380..05d3101 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 _0x6e1c=['Router','../../components/interaction/service','isAuthenticated','get','/describe','/:id','post','create','put','exports','multer','util','connect-timeout','express'];(function(_0xf74372,_0x51fe82){var _0x36bb65=function(_0x499b7a){while(--_0x499b7a){_0xf74372['push'](_0xf74372['shift']());}};_0x36bb65(++_0x51fe82);}(_0x6e1c,0x1ca));var _0xc6e1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e1c[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xc6e1('0x0'));var util=require(_0xc6e1('0x1'));var path=require('path');var timeout=require(_0xc6e1('0x2'));var express=require(_0xc6e1('0x3'));var router=express[_0xc6e1('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc6e1('0x5'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router['get']('/',auth[_0xc6e1('0x6')](),controller['index']);router[_0xc6e1('0x7')](_0xc6e1('0x8'),auth[_0xc6e1('0x6')](),controller['describe']);router['get'](_0xc6e1('0x9'),auth[_0xc6e1('0x6')](),controller['show']);router[_0xc6e1('0xa')]('/',auth[_0xc6e1('0x6')](),controller[_0xc6e1('0xb')]);router[_0xc6e1('0xc')]('/:id',auth[_0xc6e1('0x6')](),controller['update']);module[_0xc6e1('0xd')]=router; \ No newline at end of file +var _0xfdb8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','get','/:id','show','create','multer','util','path','connect-timeout','express','Router'];(function(_0x53cfbb,_0x5c7dd7){var _0x106153=function(_0x41a38d){while(--_0x41a38d){_0x53cfbb['push'](_0x53cfbb['shift']());}};_0x106153(++_0x5c7dd7);}(_0xfdb8,0x13a));var _0x8fdb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfdb8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8fdb('0x0'));var util=require(_0x8fdb('0x1'));var path=require(_0x8fdb('0x2'));var timeout=require(_0x8fdb('0x3'));var express=require(_0x8fdb('0x4'));var router=express[_0x8fdb('0x5')]();var auth=require(_0x8fdb('0x6'));var interaction=require(_0x8fdb('0x7'));var config=require(_0x8fdb('0x8'));var controller=require(_0x8fdb('0x9'));router['get']('/',auth[_0x8fdb('0xa')](),controller[_0x8fdb('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x8fdb('0xc')](_0x8fdb('0xd'),auth[_0x8fdb('0xa')](),controller[_0x8fdb('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8fdb('0xf')]);router['put']('/:id',auth[_0x8fdb('0xa')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index ee15cf6..37d2432 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 _0xb3a5=['sequelize','exports','name','STRING'];(function(_0x50dd2d,_0x2ed7d5){var _0x7b56fc=function(_0x48ce66){while(--_0x48ce66){_0x50dd2d['push'](_0x50dd2d['shift']());}};_0x7b56fc(++_0x2ed7d5);}(_0xb3a5,0x154));var _0x5b3a=function(_0x546cf9,_0x1749bb){_0x546cf9=_0x546cf9-0x0;var _0x3ec60c=_0xb3a5[_0x546cf9];return _0x3ec60c;};'use strict';var Sequelize=require(_0x5b3a('0x0'));module[_0x5b3a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5b3a('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5b3a('0x3')]},'dialPrefix':{'type':Sequelize[_0x5b3a('0x3')]}}; \ No newline at end of file +var _0xb363=['sequelize','exports','STRING','name'];(function(_0x4dfa91,_0x30be73){var _0x511504=function(_0x2ab728){while(--_0x2ab728){_0x4dfa91['push'](_0x4dfa91['shift']());}};_0x511504(++_0x30be73);}(_0xb363,0x1c0));var _0x3b36=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xb363[_0x1cfa0d];return _0xe33279;};'use strict';var Sequelize=require(_0x3b36('0x0'));module[_0x3b36('0x1')]={'name':{'type':Sequelize[_0x3b36('0x2')],'unique':_0x3b36('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3b36('0x2')]},'dialPrefix':{'type':Sequelize[_0x3b36('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index f1be16d..43bccff 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 _0x3096=['lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','model','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','user','get','role','Lists','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','Disposition','findOne','ListId','removeDispositions','addContacts','CmContact','isArray','tags','join','push','each','omit','ids','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','cf_%d','nolimit','raw','getContactsCsv','CmCustomField','format','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','text/csv','download','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','getCustomFields','findAndCountAll','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x4bd606,_0x48f4dc){var _0x439478=function(_0x398ae9){while(--_0x398ae9){_0x4bd606['push'](_0x4bd606['shift']());}};_0x439478(++_0x48f4dc);}(_0x3096,0x116));var _0x6309=function(_0x283167,_0x39632){_0x283167=_0x283167-0x0;var _0x221c2c=_0x3096[_0x283167];return _0x221c2c;};'use strict';var pdf=require(_0x6309('0x0'));var emlformat=require(_0x6309('0x1'));var rimraf=require(_0x6309('0x2'));var zipdir=require(_0x6309('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6309('0x4'));var moment=require('moment');var BPromise=require(_0x6309('0x5'));var Mustache=require(_0x6309('0x6'));var util=require(_0x6309('0x7'));var path=require(_0x6309('0x8'));var sox=require(_0x6309('0x9'));var csv=require(_0x6309('0xa'));var ejs=require(_0x6309('0xb'));var fs=require('fs');var _=require(_0x6309('0xc'));var squel=require('squel');var crypto=require(_0x6309('0xd'));var jsforce=require(_0x6309('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6309('0xa'));var querystring=require(_0x6309('0xf'));var Papa=require(_0x6309('0x10'));var Redis=require(_0x6309('0x11'));var authService=require(_0x6309('0x12'));var qs=require(_0x6309('0x13'));var as=require(_0x6309('0x14'));var hardwareService=require(_0x6309('0x15'));var logger=require(_0x6309('0x16'))(_0x6309('0x17'));var utils=require(_0x6309('0x18'));var config=require(_0x6309('0x19'));var db=require('../../mysqldb')['db'];config[_0x6309('0x1a')]=_[_0x6309('0x1b')](config[_0x6309('0x1a')],{'host':_0x6309('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6309('0x1a')]));require('./cmList.socket')['register'](socket);function respondWithStatusCode(_0x1659ca,_0x4dd122){_0x4dd122=_0x4dd122||0xcc;return function(_0x5a974e){if(_0x5a974e){return _0x1659ca[_0x6309('0x1d')](_0x4dd122);}return _0x1659ca[_0x6309('0x1e')](_0x4dd122)[_0x6309('0x1f')]();};}function respondWithResult(_0x1100e7,_0x5b387b){_0x5b387b=_0x5b387b||0xc8;return function(_0x154b69){if(_0x154b69){return _0x1100e7[_0x6309('0x1e')](_0x5b387b)[_0x6309('0x20')](_0x154b69);}};}function respondWithFilteredResult(_0xab1f05,_0x1c757a){return function(_0x1206c1){if(_0x1206c1){var _0x4ddd35=_0x1206c1[_0x6309('0x21')],_0x260e84=_0x1c757a[_0x6309('0x22')],_0x1fe46a=_0x1c757a[_0x6309('0x22')]+_0x1c757a[_0x6309('0x23')],_0x565db9;if(_0x1fe46a>=_0x4ddd35){_0x1fe46a=_0x4ddd35;_0x565db9=0xc8;}else{_0x565db9=0xce;}_0xab1f05['status'](_0x565db9);return _0xab1f05['set'](_0x6309('0x24'),_0x260e84+'-'+_0x1fe46a+'/'+_0x4ddd35)['json'](_0x1206c1);}return null;};}function patchUpdates(_0x1f8815){return function(_0x30f3d3){try{jsonpatch[_0x6309('0x25')](_0x30f3d3,_0x1f8815,!![]);}catch(_0x3ef082){return BPromise[_0x6309('0x26')](_0x3ef082);}return _0x30f3d3[_0x6309('0x27')]();};}function saveUpdates(_0x3a7727,_0x11e11d){return function(_0x19f514){if(_0x19f514){return _0x19f514[_0x6309('0x28')](_0x3a7727)[_0x6309('0x29')](function(_0x5e7895){return _0x5e7895;});}return null;};}function removeEntity(_0x154862,_0x18c35a){return function(_0x16608c){if(_0x16608c){return _0x16608c[_0x6309('0x2a')]()[_0x6309('0x29')](function(){var _0x8537d6=_0x16608c['get']({'plain':!![]});var _0x110c6c='Lists';return db['UserProfileResource']['destroy']({'where':{'type':_0x110c6c,'resourceId':_0x8537d6['id']}})['then'](function(){return _0x16608c;});})[_0x6309('0x29')](function(){_0x154862[_0x6309('0x1e')](0xcc)[_0x6309('0x1f')]();});}};}function handleEntityNotFound(_0x916755,_0x350bdb){return function(_0x25cfea){if(!_0x25cfea){_0x916755['sendStatus'](0x194);}return _0x25cfea;};}function handleError(_0x4c0977,_0x2214c4){_0x2214c4=_0x2214c4||0x1f4;return function(_0x501594){logger[_0x6309('0x2b')](_0x501594[_0x6309('0x2c')]);if(_0x501594[_0x6309('0x2d')]){delete _0x501594['name'];}_0x4c0977['status'](_0x2214c4)[_0x6309('0x2e')](_0x501594);};}exports[_0x6309('0x2f')]=function(_0x1117bc,_0x591409){var _0x3e99c6={},_0x1fe4a6={},_0x4eea5e={'count':0x0,'rows':[]};var _0x1f2e25=_[_0x6309('0x30')](db[_0x6309('0x31')][_0x6309('0x32')],function(_0x315a0b){return{'name':_0x315a0b[_0x6309('0x33')],'type':_0x315a0b[_0x6309('0x34')]['key']};});_0x1fe4a6[_0x6309('0x35')]=_[_0x6309('0x30')](_0x1f2e25,'name');_0x1fe4a6['query']=_['keys'](_0x1117bc['query']);_0x1fe4a6[_0x6309('0x36')]=_[_0x6309('0x37')](_0x1fe4a6[_0x6309('0x35')],_0x1fe4a6[_0x6309('0x38')]);_0x3e99c6[_0x6309('0x39')]=_[_0x6309('0x37')](_0x1fe4a6[_0x6309('0x35')],qs[_0x6309('0x3a')](_0x1117bc[_0x6309('0x38')][_0x6309('0x3a')]));_0x3e99c6['attributes']=_0x3e99c6[_0x6309('0x39')]['length']?_0x3e99c6['attributes']:_0x1fe4a6['model'];if(!_0x1117bc['query'][_0x6309('0x3b')]('nolimit')){_0x3e99c6[_0x6309('0x23')]=qs[_0x6309('0x23')](_0x1117bc['query']['limit']);_0x3e99c6[_0x6309('0x22')]=qs[_0x6309('0x22')](_0x1117bc[_0x6309('0x38')][_0x6309('0x22')]);}_0x3e99c6[_0x6309('0x3c')]=qs['sort'](_0x1117bc[_0x6309('0x38')][_0x6309('0x3d')]);_0x3e99c6[_0x6309('0x3e')]=qs[_0x6309('0x36')](_[_0x6309('0x3f')](_0x1117bc[_0x6309('0x38')],_0x1fe4a6[_0x6309('0x36')]),_0x1f2e25);if(_0x1117bc[_0x6309('0x38')][_0x6309('0x40')]){_0x3e99c6['where']=_[_0x6309('0x41')](_0x3e99c6[_0x6309('0x3e')],{'$or':_['map'](_0x1f2e25,function(_0x118467){if(_0x118467['type']!==_0x6309('0x42')){var _0x4ee591={};_0x4ee591[_0x118467[_0x6309('0x2d')]]={'$like':'%'+_0x1117bc['query'][_0x6309('0x40')]+'%'};return _0x4ee591;}})});}_0x3e99c6=_[_0x6309('0x41')]({},_0x3e99c6,_0x1117bc[_0x6309('0x43')]);var _0x231859={'where':_0x3e99c6[_0x6309('0x3e')]};return db[_0x6309('0x31')][_0x6309('0x21')](_0x231859)[_0x6309('0x29')](function(_0x22a188){_0x4eea5e[_0x6309('0x21')]=_0x22a188;if(_0x1117bc[_0x6309('0x38')][_0x6309('0x44')]){_0x3e99c6[_0x6309('0x45')]=[{'all':!![]}];}return db[_0x6309('0x31')][_0x6309('0x46')](_0x3e99c6);})[_0x6309('0x29')](function(_0x192f5c){_0x4eea5e[_0x6309('0x47')]=_0x192f5c;return _0x4eea5e;})[_0x6309('0x29')](respondWithFilteredResult(_0x591409,_0x3e99c6))[_0x6309('0x48')](handleError(_0x591409,null));};exports[_0x6309('0x49')]=function(_0x4f144e,_0x124629){var _0x33a740={'raw':![],'where':{'id':_0x4f144e[_0x6309('0x4a')]['id']}},_0x535497={};_0x535497['model']=_[_0x6309('0x4b')](db[_0x6309('0x31')]['rawAttributes']);_0x535497[_0x6309('0x38')]=_['keys'](_0x4f144e[_0x6309('0x38')]);_0x535497[_0x6309('0x36')]=_[_0x6309('0x37')](_0x535497[_0x6309('0x35')],_0x535497[_0x6309('0x38')]);_0x33a740[_0x6309('0x39')]=_[_0x6309('0x37')](_0x535497[_0x6309('0x35')],qs[_0x6309('0x3a')](_0x4f144e[_0x6309('0x38')][_0x6309('0x3a')]));_0x33a740['attributes']=_0x33a740[_0x6309('0x39')][_0x6309('0x4c')]?_0x33a740['attributes']:_0x535497[_0x6309('0x35')];if(_0x4f144e['query'][_0x6309('0x44')]){_0x33a740[_0x6309('0x45')]=[{'all':!![]}];}_0x33a740=_[_0x6309('0x41')]({},_0x33a740,_0x4f144e[_0x6309('0x43')]);return db[_0x6309('0x31')][_0x6309('0x4d')](_0x33a740)[_0x6309('0x29')](handleEntityNotFound(_0x124629,null))['then'](respondWithResult(_0x124629,null))[_0x6309('0x48')](handleError(_0x124629,null));};exports[_0x6309('0x4e')]=function(_0x12acd1,_0x40587e){return db[_0x6309('0x31')][_0x6309('0x4e')](_0x12acd1['body'],{})[_0x6309('0x29')](function(_0x10be0f){var _0x1825cc=_0x12acd1[_0x6309('0x4f')][_0x6309('0x50')]({'plain':!![]});if(!_0x1825cc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1825cc[_0x6309('0x51')]===_0x6309('0x4f')){var _0x162117=_0x10be0f[_0x6309('0x50')]({'plain':!![]});var _0x1b112a=_0x6309('0x52');return db['UserProfileSection'][_0x6309('0x4d')]({'where':{'name':_0x1b112a,'userProfileId':_0x1825cc['userProfileId']},'raw':!![]})[_0x6309('0x29')](function(_0x53b619){if(_0x53b619&&_0x53b619[_0x6309('0x53')]===0x0){return db[_0x6309('0x54')][_0x6309('0x4e')]({'name':_0x162117[_0x6309('0x2d')],'resourceId':_0x162117['id'],'type':_0x53b619[_0x6309('0x2d')],'sectionId':_0x53b619['id']},{})[_0x6309('0x29')](function(){return _0x10be0f;});}else{return _0x10be0f;}})[_0x6309('0x48')](function(_0x375b4f){logger['error'](_0x6309('0x55'),_0x375b4f);throw _0x375b4f;});}return _0x10be0f;})['then'](respondWithResult(_0x40587e,0xc9))[_0x6309('0x48')](handleError(_0x40587e,null));};exports[_0x6309('0x28')]=function(_0x451ffe,_0x39adfd){if(_0x451ffe[_0x6309('0x56')]['id']){delete _0x451ffe[_0x6309('0x56')]['id'];}return db['CmList'][_0x6309('0x4d')]({'where':{'id':_0x451ffe[_0x6309('0x4a')]['id']}})[_0x6309('0x29')](handleEntityNotFound(_0x39adfd,null))[_0x6309('0x29')](saveUpdates(_0x451ffe['body'],null))[_0x6309('0x29')](respondWithResult(_0x39adfd,null))[_0x6309('0x48')](handleError(_0x39adfd,null));};exports['destroy']=function(_0x28ac1b,_0x291c67){return db[_0x6309('0x31')]['find']({'where':{'id':_0x28ac1b[_0x6309('0x4a')]['id']}})[_0x6309('0x29')](handleEntityNotFound(_0x291c67,null))[_0x6309('0x29')](removeEntity(_0x291c67,null))['catch'](handleError(_0x291c67,null));};exports[_0x6309('0x57')]=function(_0x240d73,_0x5bb40c){return db[_0x6309('0x31')][_0x6309('0x57')]()[_0x6309('0x29')](respondWithResult(_0x5bb40c,null))[_0x6309('0x48')](handleError(_0x5bb40c,null));};exports['addDisposition']=function(_0xdd91e2,_0x1e4ebe,_0x2af607){if(_0xdd91e2[_0x6309('0x56')]['id']){delete _0xdd91e2['body']['id'];}return db[_0x6309('0x31')][_0x6309('0x4d')]({'where':{'id':_0xdd91e2[_0x6309('0x4a')]['id']}})[_0x6309('0x29')](handleEntityNotFound(_0x1e4ebe,null))[_0x6309('0x29')](function(_0x108e13){if(_0x108e13){_0xdd91e2['body']['ListId']=_0x108e13['id'];return db[_0x6309('0x58')][_0x6309('0x4e')](_0xdd91e2[_0x6309('0x56')]);}})['then'](respondWithResult(_0x1e4ebe,null))[_0x6309('0x48')](handleError(_0x1e4ebe,null));};exports['getDispositions']=function(_0x34a73d,_0x158086,_0x2664ae){var _0x4fa144={'raw':![],'where':{}};var _0x151f92={};var _0x148b42={'count':0x0,'rows':[]};return db[_0x6309('0x31')][_0x6309('0x59')]({'where':{'id':_0x34a73d['params']['id']}})[_0x6309('0x29')](handleEntityNotFound(_0x158086,null))[_0x6309('0x29')](function(_0x1e4a07){if(_0x1e4a07){_0x151f92[_0x6309('0x35')]=_[_0x6309('0x4b')](db[_0x6309('0x58')][_0x6309('0x32')]);_0x151f92[_0x6309('0x38')]=_[_0x6309('0x4b')](_0x34a73d[_0x6309('0x38')]);_0x151f92['filters']=_[_0x6309('0x37')](_0x151f92[_0x6309('0x35')],_0x151f92[_0x6309('0x38')]);_0x4fa144[_0x6309('0x39')]=_[_0x6309('0x37')](_0x151f92[_0x6309('0x35')],qs[_0x6309('0x3a')](_0x34a73d['query'][_0x6309('0x3a')]));_0x4fa144[_0x6309('0x39')]=_0x4fa144[_0x6309('0x39')][_0x6309('0x4c')]?_0x4fa144[_0x6309('0x39')]:_0x151f92[_0x6309('0x35')];if(!_0x34a73d['query']['hasOwnProperty']('nolimit')){_0x4fa144['limit']=qs[_0x6309('0x23')](_0x34a73d[_0x6309('0x38')]['limit']);_0x4fa144[_0x6309('0x22')]=qs['offset'](_0x34a73d['query']['offset']);}_0x4fa144['order']=qs[_0x6309('0x3d')](_0x34a73d[_0x6309('0x38')][_0x6309('0x3d')]);_0x4fa144['where']=qs[_0x6309('0x36')](_[_0x6309('0x3f')](_0x34a73d[_0x6309('0x38')],_0x151f92[_0x6309('0x36')]));_0x4fa144[_0x6309('0x3e')][_0x6309('0x5a')]=_0x1e4a07['id'];if(_0x34a73d[_0x6309('0x38')]['filter']){_0x4fa144[_0x6309('0x3e')]=_[_0x6309('0x41')](_0x4fa144['where'],{'$or':_[_0x6309('0x30')](_0x4fa144[_0x6309('0x39')],function(_0x291635){var _0x531ff2={};_0x531ff2[_0x291635]={'$like':'%'+_0x34a73d[_0x6309('0x38')]['filter']+'%'};return _0x531ff2;})});}_0x4fa144=_[_0x6309('0x41')]({},_0x4fa144,_0x34a73d[_0x6309('0x43')]);return db[_0x6309('0x58')][_0x6309('0x21')]({'where':_0x4fa144[_0x6309('0x3e')]})[_0x6309('0x29')](function(_0x5a9d19){_0x148b42[_0x6309('0x21')]=_0x5a9d19;if(_0x34a73d['query']['includeAll']){_0x4fa144['include']=[{'all':!![]}];}return db[_0x6309('0x58')][_0x6309('0x46')](_0x4fa144);})[_0x6309('0x29')](function(_0x18025f){_0x148b42[_0x6309('0x47')]=_0x18025f;return _0x148b42;});}})[_0x6309('0x29')](respondWithFilteredResult(_0x158086,_0x4fa144))[_0x6309('0x48')](handleError(_0x158086,null));};exports[_0x6309('0x5b')]=function(_0x20cdd4,_0x439a5b,_0x198aca){return db[_0x6309('0x31')][_0x6309('0x4d')]({'where':{'id':_0x20cdd4['params']['id']}})[_0x6309('0x29')](handleEntityNotFound(_0x439a5b,null))['then'](function(_0xe5baad){if(_0xe5baad){return _0xe5baad['removeDispositions'](_0x20cdd4[_0x6309('0x38')]['ids']);}})['then'](respondWithStatusCode(_0x439a5b,null))[_0x6309('0x48')](handleError(_0x439a5b,null));};exports[_0x6309('0x5c')]=function(_0x433b19,_0x3a2519,_0x3365bc){return db[_0x6309('0x31')][_0x6309('0x4d')]({'where':{'id':_0x433b19[_0x6309('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3a2519,null))[_0x6309('0x29')](function(_0x230ae6){if(_0x230ae6){var _0x44f5fd=[];var _0x576082={'success':[],'errors':[]};return db[_0x6309('0x5d')][_0x6309('0x57')]()[_0x6309('0x29')](function(_0x34816e){if(_0x433b19['body']['tags']&&_[_0x6309('0x5e')](_0x433b19['body'][_0x6309('0x5f')])){if(_0x433b19[_0x6309('0x56')][_0x6309('0x5f')][_0x6309('0x4c')]){_0x433b19[_0x6309('0x56')][_0x6309('0x5f')]=_0x433b19[_0x6309('0x56')][_0x6309('0x5f')][_0x6309('0x60')](';')+';';}else{_0x433b19[_0x6309('0x56')][_0x6309('0x5f')]=null;}}else{_0x433b19[_0x6309('0x56')][_0x6309('0x5f')]=null;}if(_0x433b19[_0x6309('0x56')]&&_[_0x6309('0x5e')](_0x433b19[_0x6309('0x56')])){for(var _0x133c9c=0x0;_0x133c9c<_0x433b19['body'][_0x6309('0x4c')];_0x133c9c+=0x1){_0x433b19[_0x6309('0x56')][_0x133c9c][_0x6309('0x5a')]=_0x433b19[_0x6309('0x4a')]['id'];_0x44f5fd[_0x6309('0x61')](_0x433b19[_0x6309('0x56')][_0x133c9c]);}return BPromise[_0x6309('0x62')](_0x44f5fd,function(_0x108983){return db[_0x6309('0x5d')]['create'](_[_0x6309('0x63')](_0x108983,[_0x6309('0x64'),'id'])||{},{'fields':_['keys'](_0x34816e),'raw':!![]})[_0x6309('0x29')](function(_0x34a6c1){_0x576082[_0x6309('0x65')][_0x6309('0x61')](_0x34a6c1[_0x6309('0x66')]);})['catch'](function(_0xd7055f){_0x576082[_0x6309('0x67')][_0x6309('0x61')]({'data':_0x108983,'error':_0xd7055f[_0x6309('0x68')]});});})[_0x6309('0x29')](function(_0x2d107d){return _0x576082;})[_0x6309('0x48')](function(_0x4471dd){return _0x4471dd;});}else{_0x3a2519[_0x6309('0x1e')](0x190)[_0x6309('0x20')]({'message':_0x6309('0x69')});}});}})['then'](respondWithResult(_0x3a2519,null))['catch'](handleError(_0x3a2519,null));};exports[_0x6309('0x6a')]=function(_0x5b322d,_0x5a0902,_0x54a253){var _0x14fbc1;return db['CmList']['find']({'where':{'id':_0x5b322d[_0x6309('0x4a')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x6309('0x6b')}]})[_0x6309('0x29')](handleEntityNotFound(_0x5a0902,null))['then'](function(_0x54aeb1){if(_0x54aeb1){_0x14fbc1=_0x54aeb1;return db[_0x6309('0x5d')]['rawAttributes'];}})['then'](function(_0x3da1ca){if(_0x3da1ca){var _0x15094e={};var _0x128d02={};_0x128d02[_0x6309('0x35')]=_[_0x6309('0x6c')](_[_0x6309('0x4b')](_0x3da1ca),_[_0x6309('0x30')](_0x14fbc1[_0x6309('0x6b')],function(_0x55697e){return util['format'](_0x6309('0x6d'),_0x55697e['id']);}));_0x128d02['query']=_[_0x6309('0x4b')](_0x5b322d[_0x6309('0x38')]);_0x128d02[_0x6309('0x36')]=_[_0x6309('0x37')](_0x128d02[_0x6309('0x35')],_0x128d02['query']);_0x15094e['attributes']=_[_0x6309('0x37')](_0x128d02[_0x6309('0x35')],qs['fields'](_0x5b322d[_0x6309('0x38')][_0x6309('0x3a')]));_0x15094e[_0x6309('0x39')]=_0x15094e[_0x6309('0x39')][_0x6309('0x4c')]?_0x15094e[_0x6309('0x39')]:_0x128d02[_0x6309('0x35')];if(!_0x5b322d[_0x6309('0x38')][_0x6309('0x3b')](_0x6309('0x6e'))){_0x15094e[_0x6309('0x23')]=qs[_0x6309('0x23')](_0x5b322d[_0x6309('0x38')][_0x6309('0x23')]);_0x15094e[_0x6309('0x22')]=qs[_0x6309('0x22')](_0x5b322d[_0x6309('0x38')]['offset']);}_0x15094e[_0x6309('0x3c')]=qs[_0x6309('0x3d')](_0x5b322d['query']['sort']);_0x15094e[_0x6309('0x3e')]=qs[_0x6309('0x36')](_[_0x6309('0x3f')](_0x5b322d['query'],_0x128d02[_0x6309('0x36')]));_0x15094e[_0x6309('0x6f')]=!![];if(_0x5b322d[_0x6309('0x38')]['filter']){_0x15094e[_0x6309('0x3e')]=_[_0x6309('0x41')](_0x15094e[_0x6309('0x3e')],{'$or':_['map'](_0x15094e['attributes'],function(_0x486548){var _0x250fa1={};_0x250fa1[_0x486548]={'$like':'%'+_0x5b322d[_0x6309('0x38')][_0x6309('0x40')]+'%'};return _0x250fa1;})});}_0x15094e=_['merge']({},_0x15094e,_0x5b322d[_0x6309('0x43')]);return _0x14fbc1[_0x6309('0x6a')](_0x15094e);}})[_0x6309('0x29')](respondWithResult(_0x5a0902,null))['catch'](handleError(_0x5a0902,null));};exports[_0x6309('0x70')]=function(_0x4a3f7c,_0x2623cd,_0x437124){var _0x4f343a;return db[_0x6309('0x31')][_0x6309('0x4d')]({'where':{'id':_0x4a3f7c[_0x6309('0x4a')]['id']},'include':[{'model':db[_0x6309('0x71')],'as':'CustomFields'}]})[_0x6309('0x29')](handleEntityNotFound(_0x2623cd,null))['then'](function(_0x52e7e0){if(_0x52e7e0){_0x4f343a=_0x52e7e0;return db['CmContact'][_0x6309('0x32')];}})[_0x6309('0x29')](function(_0x4a85b4){if(_0x4a85b4){var _0xe097fe={};var _0x34be9f={};_0x34be9f[_0x6309('0x35')]=_[_0x6309('0x6c')](_[_0x6309('0x4b')](_0x4a85b4),_[_0x6309('0x30')](_0x4f343a[_0x6309('0x6b')],function(_0x1f0fb3){return util[_0x6309('0x72')](_0x6309('0x6d'),_0x1f0fb3['id']);}));_0x34be9f['query']=_['keys'](_0x4a3f7c['query']);_0x34be9f[_0x6309('0x36')]=_['intersection'](_0x34be9f[_0x6309('0x35')],_0x34be9f[_0x6309('0x38')]);_0xe097fe[_0x6309('0x39')]=_[_0x6309('0x37')](_0x34be9f[_0x6309('0x35')],qs[_0x6309('0x3a')](_0x4a3f7c['query'][_0x6309('0x3a')]));_0xe097fe[_0x6309('0x39')]=_0xe097fe['attributes'][_0x6309('0x4c')]?_0xe097fe[_0x6309('0x39')]:_0x34be9f[_0x6309('0x35')];if(!_0x4a3f7c['query']['hasOwnProperty'](_0x6309('0x6e'))){_0xe097fe[_0x6309('0x23')]=qs['limit'](_0x4a3f7c[_0x6309('0x38')][_0x6309('0x23')]);_0xe097fe[_0x6309('0x22')]=qs[_0x6309('0x22')](_0x4a3f7c[_0x6309('0x38')][_0x6309('0x22')]);}_0xe097fe[_0x6309('0x3c')]=qs['sort'](_0x4a3f7c['query']['sort']);_0xe097fe[_0x6309('0x3e')]=qs[_0x6309('0x36')](_['pick'](_0x4a3f7c[_0x6309('0x38')],_0x34be9f[_0x6309('0x36')]));_0xe097fe[_0x6309('0x6f')]=!![];if(_0x4a3f7c[_0x6309('0x38')][_0x6309('0x40')]){_0xe097fe['where']=_['merge'](_0xe097fe['where'],{'$or':_['map'](_0xe097fe[_0x6309('0x39')],function(_0x351070){var _0xbf291f={};_0xbf291f[_0x351070]={'$like':'%'+_0x4a3f7c[_0x6309('0x38')][_0x6309('0x40')]+'%'};return _0xbf291f;})});}_0xe097fe=_[_0x6309('0x41')]({},_0xe097fe,_0x4a3f7c[_0x6309('0x43')]);return _0x4f343a[_0x6309('0x6a')](_0xe097fe);}})[_0x6309('0x29')](function(_0x2389b0){if(!_[_0x6309('0x73')](_0x2389b0)){var _0x2664ce=toCsv(_0x2389b0);var _0x359173=Date[_0x6309('0x74')]();fs[_0x6309('0x75')](util[_0x6309('0x72')](_0x6309('0x76'),_0x4f343a['id'],_0x359173),_0x2664ce);_0x2623cd[_0x6309('0x77')](_0x6309('0x78'),'attachment;\x20filename='+util[_0x6309('0x72')]('list_%d_%s.csv',_0x4f343a['id'],_0x359173));_0x2623cd[_0x6309('0x77')]('Content-type',_0x6309('0x79'));return _0x2623cd[_0x6309('0x7a')](util[_0x6309('0x72')](_0x6309('0x76'),_0x4f343a['id'],_0x359173));}else{return _0x2623cd[_0x6309('0x1d')](0xcc);}})[_0x6309('0x48')](handleError(_0x2623cd,null));};exports[_0x6309('0x7b')]=function(_0x2e9247,_0x1ddd88,_0x3c5acf){var _0x38ecdc;delete _0x2e9247[_0x6309('0x56')]['id'];return db[_0x6309('0x31')][_0x6309('0x59')]({'where':{'id':_0x2e9247[_0x6309('0x4a')]['id']}})[_0x6309('0x29')](handleEntityNotFound(_0x1ddd88,null))[_0x6309('0x29')](function(_0xe03585){if(_0xe03585){return db[_0x6309('0x7c')]['transaction'](function(_0x203c0f){return db[_0x6309('0x71')][_0x6309('0x4e')](_0x2e9247['body'],{'transaction':_0x203c0f})['then'](function(_0x5edc89){_0x38ecdc=_0x5edc89;return _0xe03585[_0x6309('0x7d')](_0x5edc89,{'transaction':_0x203c0f});})[_0x6309('0x29')](function(){var _0xe58c1f={'type':db[_0x6309('0x7e')][_0x6309('0x7f')],'transaction':_0x203c0f};switch(_0x2e9247['body'][_0x6309('0x34')]){case _0x6309('0x80'):_0xe58c1f[_0x6309('0x34')]=db['Sequelize']['TEXT'];break;case _0x6309('0x81'):_0xe58c1f[_0x6309('0x34')]=db['Sequelize'][_0x6309('0x82')];break;case _0x6309('0x83'):_0xe58c1f['type']=db[_0x6309('0x7e')]['BOOLEAN'];_0xe58c1f[_0x6309('0x84')]=![];break;default:}return db['sequelize'][_0x6309('0x85')][_0x6309('0x86')](_0x6309('0x87'),util[_0x6309('0x72')]('cf_%s',_0x38ecdc['id']),_0xe58c1f);})[_0x6309('0x29')](function(){return _0x38ecdc;});});}})[_0x6309('0x29')](respondWithResult(_0x1ddd88,null))[_0x6309('0x48')](handleError(_0x1ddd88,null));};exports[_0x6309('0x88')]=function(_0x4c6a26,_0x32b494,_0x5aafec){var _0x1daa43={};var _0x5da715={};var _0x3f1718;var _0x43b8d0;return db[_0x6309('0x31')][_0x6309('0x59')]({'where':{'id':_0x4c6a26[_0x6309('0x4a')]['id']}})['then'](handleEntityNotFound(_0x32b494,null))[_0x6309('0x29')](function(_0x64bf4e){if(_0x64bf4e){_0x3f1718=_0x64bf4e;_0x5da715[_0x6309('0x35')]=_[_0x6309('0x4b')](db['CmCustomField'][_0x6309('0x32')]);_0x5da715[_0x6309('0x38')]=_[_0x6309('0x4b')](_0x4c6a26['query']);_0x5da715[_0x6309('0x36')]=_[_0x6309('0x37')](_0x5da715[_0x6309('0x35')],_0x5da715[_0x6309('0x38')]);_0x1daa43[_0x6309('0x39')]=_[_0x6309('0x37')](_0x5da715['model'],qs[_0x6309('0x3a')](_0x4c6a26[_0x6309('0x38')][_0x6309('0x3a')]));_0x1daa43[_0x6309('0x39')]=_0x1daa43[_0x6309('0x39')][_0x6309('0x4c')]?_0x1daa43[_0x6309('0x39')]:_0x5da715[_0x6309('0x35')];_0x1daa43[_0x6309('0x3c')]=qs[_0x6309('0x3d')](_0x4c6a26[_0x6309('0x38')]['sort']);_0x1daa43[_0x6309('0x3e')]=qs[_0x6309('0x36')](_['pick'](_0x4c6a26[_0x6309('0x38')],_0x5da715['filters']));_0x1daa43['where']=_[_0x6309('0x41')](_0x1daa43['where'],{'$or':[{'ListId':_0x64bf4e['id']},{'ListId':null}]});if(_0x4c6a26[_0x6309('0x38')]['filter']){_0x1daa43[_0x6309('0x3e')]=_[_0x6309('0x41')](_0x1daa43[_0x6309('0x3e')],{'$or':_[_0x6309('0x30')](_0x1daa43[_0x6309('0x39')],function(_0xb6dcfb){var _0x389570={};_0x389570[_0xb6dcfb]={'$like':'%'+_0x4c6a26[_0x6309('0x38')][_0x6309('0x40')]+'%'};return _0x389570;})});}_0x1daa43=_[_0x6309('0x41')]({},_0x1daa43,_0x4c6a26[_0x6309('0x43')]);return db[_0x6309('0x71')][_0x6309('0x89')](_0x1daa43);}})[_0x6309('0x29')](respondWithResult(_0x32b494,null))[_0x6309('0x48')](handleError(_0x32b494,null));};exports[_0x6309('0x8a')]=function(_0x1fa76a,_0x4f5a77,_0x19b05a){return db[_0x6309('0x31')]['find']({'where':{'id':_0x1fa76a[_0x6309('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f5a77,null))[_0x6309('0x29')](function(_0x60a99b){if(_0x60a99b){return _0x60a99b[_0x6309('0x8a')](_0x1fa76a[_0x6309('0x56')][_0x6309('0x64')],_[_0x6309('0x63')](_0x1fa76a[_0x6309('0x56')],['ids','id'])||{})[_0x6309('0x8b')](function(_0x47626c){for(var _0x3ea01b=0x0;_0x3ea01b<_0x1fa76a[_0x6309('0x56')][_0x6309('0x64')][_0x6309('0x4c')];_0x3ea01b+=0x1){socket[_0x6309('0x8c')]('userCmList:save',{'UserId':_0x1fa76a[_0x6309('0x56')][_0x6309('0x64')][_0x3ea01b],'CmListId':_0x1fa76a['params']['id']});}return _0x47626c;});}})[_0x6309('0x29')](respondWithResult(_0x4f5a77,null))[_0x6309('0x48')](handleError(_0x4f5a77,null));};exports[_0x6309('0x8d')]=function(_0x509b1f,_0x54a3f2,_0x1575e8){return db['CmList'][_0x6309('0x4d')]({'where':{'id':_0x509b1f['params']['id']}})[_0x6309('0x29')](handleEntityNotFound(_0x54a3f2,null))[_0x6309('0x29')](function(_0x57f2d3){if(_0x57f2d3){return _0x57f2d3[_0x6309('0x8d')](_0x509b1f[_0x6309('0x38')]['ids'])[_0x6309('0x29')](function(){if(_['isArray'](_0x509b1f[_0x6309('0x38')][_0x6309('0x64')])){for(var _0x163ddb=0x0;_0x163ddb<_0x509b1f[_0x6309('0x38')]['ids'][_0x6309('0x4c')];_0x163ddb+=0x1){socket['emit'](_0x6309('0x8e'),{'UserId':Number(_0x509b1f[_0x6309('0x38')]['ids'][_0x163ddb]),'CmListId':Number(_0x509b1f[_0x6309('0x4a')]['id'])});}}else{socket[_0x6309('0x8c')](_0x6309('0x8e'),{'UserId':Number(_0x509b1f[_0x6309('0x38')][_0x6309('0x64')]),'CmListId':Number(_0x509b1f[_0x6309('0x4a')]['id'])});}});}})[_0x6309('0x29')](respondWithStatusCode(_0x54a3f2,null))[_0x6309('0x48')](handleError(_0x54a3f2,null));};exports[_0x6309('0x8f')]=function(_0x51fe06,_0x3cf179,_0x100878){var _0x1d1164={};var _0x229460={};var _0x2c359a;var _0x5f42dc;return db[_0x6309('0x31')][_0x6309('0x59')]({'where':{'id':_0x51fe06[_0x6309('0x4a')]['id']}})[_0x6309('0x29')](handleEntityNotFound(_0x3cf179,null))[_0x6309('0x29')](function(_0x170bb5){if(_0x170bb5){_0x2c359a=_0x170bb5;_0x229460[_0x6309('0x35')]=_['keys'](db[_0x6309('0x90')][_0x6309('0x32')]);_0x229460[_0x6309('0x38')]=_['keys'](_0x51fe06[_0x6309('0x38')]);_0x229460[_0x6309('0x36')]=_[_0x6309('0x37')](_0x229460[_0x6309('0x35')],_0x229460[_0x6309('0x38')]);_0x1d1164[_0x6309('0x39')]=_[_0x6309('0x37')](_0x229460['model'],qs[_0x6309('0x3a')](_0x51fe06[_0x6309('0x38')][_0x6309('0x3a')]));_0x1d1164[_0x6309('0x39')]=_0x1d1164['attributes'][_0x6309('0x4c')]?_0x1d1164[_0x6309('0x39')]:_0x229460[_0x6309('0x35')];_0x1d1164[_0x6309('0x3c')]=qs[_0x6309('0x3d')](_0x51fe06[_0x6309('0x38')]['sort']);_0x1d1164['where']=qs[_0x6309('0x36')](_[_0x6309('0x3f')](_0x51fe06[_0x6309('0x38')],_0x229460[_0x6309('0x36')]));if(_0x51fe06[_0x6309('0x38')][_0x6309('0x40')]){_0x1d1164[_0x6309('0x3e')]=_[_0x6309('0x41')](_0x1d1164[_0x6309('0x3e')],{'$or':_[_0x6309('0x30')](_0x1d1164[_0x6309('0x39')],function(_0x5c787d){var _0x2fd1a6={};_0x2fd1a6[_0x5c787d]={'$like':'%'+_0x51fe06[_0x6309('0x38')][_0x6309('0x40')]+'%'};return _0x2fd1a6;})});}_0x1d1164=_[_0x6309('0x41')]({},_0x1d1164,_0x51fe06[_0x6309('0x43')]);return _0x2c359a['getAgents'](_0x1d1164);}})['then'](function(_0x37545d){if(_0x37545d){_0x5f42dc=_0x37545d['length'];if(!_0x51fe06['query'][_0x6309('0x3b')]('nolimit')){_0x1d1164[_0x6309('0x23')]=qs['limit'](_0x51fe06[_0x6309('0x38')][_0x6309('0x23')]);_0x1d1164['offset']=qs[_0x6309('0x22')](_0x51fe06[_0x6309('0x38')][_0x6309('0x22')]);}return _0x2c359a[_0x6309('0x8f')](_0x1d1164);}})[_0x6309('0x29')](function(_0xc0d616){if(_0xc0d616){return _0xc0d616?{'count':_0x5f42dc,'rows':_0xc0d616}:null;}})[_0x6309('0x29')](respondWithResult(_0x3cf179,null))[_0x6309('0x48')](handleError(_0x3cf179,null));}; \ No newline at end of file +var _0x5bf6=['isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','addCustomField','findOne','sequelize','transaction','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','Lists','UserProfileResource','error','name','send','index','map','CmList','rawAttributes','fieldName','type','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','length','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ListId','Disposition','getDispositions','nolimit','removeDispositions','ids','addContacts','CmContact','tags','isArray','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','cf_%d','raw','getContactsCsv','CmCustomField','format'];(function(_0x4b9515,_0xbb8e5){var _0xc74673=function(_0x4150d4){while(--_0x4150d4){_0x4b9515['push'](_0x4b9515['shift']());}};_0xc74673(++_0xbb8e5);}(_0x5bf6,0x143));var _0x65bf=function(_0x7a112,_0x2eb4a0){_0x7a112=_0x7a112-0x0;var _0x136dc5=_0x5bf6[_0x7a112];return _0x136dc5;};'use strict';var pdf=require(_0x65bf('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x65bf('0x1'));var jsonpatch=require(_0x65bf('0x2'));var rp=require(_0x65bf('0x3'));var moment=require(_0x65bf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x65bf('0x5'));var util=require(_0x65bf('0x6'));var path=require(_0x65bf('0x7'));var sox=require(_0x65bf('0x8'));var csv=require(_0x65bf('0x9'));var ejs=require(_0x65bf('0xa'));var fs=require('fs');var _=require(_0x65bf('0xb'));var squel=require(_0x65bf('0xc'));var crypto=require(_0x65bf('0xd'));var jsforce=require(_0x65bf('0xe'));var deskjs=require(_0x65bf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x65bf('0x10'));var Papa=require(_0x65bf('0x11'));var Redis=require(_0x65bf('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x65bf('0x13'));var as=require(_0x65bf('0x14'));var hardwareService=require(_0x65bf('0x15'));var logger=require(_0x65bf('0x16'))(_0x65bf('0x17'));var utils=require(_0x65bf('0x18'));var config=require('../../config/environment');var db=require(_0x65bf('0x19'))['db'];config['redis']=_[_0x65bf('0x1a')](config['redis'],{'host':_0x65bf('0x1b'),'port':0x18eb});var socket=require(_0x65bf('0x1c'))(new Redis(config['redis']));require(_0x65bf('0x1d'))['register'](socket);function respondWithStatusCode(_0xdc9377,_0x1313d8){_0x1313d8=_0x1313d8||0xcc;return function(_0x15a15e){if(_0x15a15e){return _0xdc9377[_0x65bf('0x1e')](_0x1313d8);}return _0xdc9377[_0x65bf('0x1f')](_0x1313d8)[_0x65bf('0x20')]();};}function respondWithResult(_0x377610,_0xe5b90f){_0xe5b90f=_0xe5b90f||0xc8;return function(_0x2c7647){if(_0x2c7647){return _0x377610[_0x65bf('0x1f')](_0xe5b90f)[_0x65bf('0x21')](_0x2c7647);}};}function respondWithFilteredResult(_0x13f299,_0x560d31){return function(_0x4219cb){if(_0x4219cb){var _0x13981f=_0x4219cb[_0x65bf('0x22')],_0x1375ba=_0x560d31[_0x65bf('0x23')],_0x20d9fe=_0x560d31['offset']+_0x560d31[_0x65bf('0x24')],_0x2b2d5e;if(_0x20d9fe>=_0x13981f){_0x20d9fe=_0x13981f;_0x2b2d5e=0xc8;}else{_0x2b2d5e=0xce;}_0x13f299[_0x65bf('0x1f')](_0x2b2d5e);return _0x13f299[_0x65bf('0x25')](_0x65bf('0x26'),_0x1375ba+'-'+_0x20d9fe+'/'+_0x13981f)[_0x65bf('0x21')](_0x4219cb);}return null;};}function patchUpdates(_0x206e25){return function(_0x268c90){try{jsonpatch[_0x65bf('0x27')](_0x268c90,_0x206e25,!![]);}catch(_0x3f6984){return BPromise['reject'](_0x3f6984);}return _0x268c90[_0x65bf('0x28')]();};}function saveUpdates(_0x36afff,_0x4f7946){return function(_0x5f172f){if(_0x5f172f){return _0x5f172f[_0x65bf('0x29')](_0x36afff)[_0x65bf('0x2a')](function(_0x538e87){return _0x538e87;});}return null;};}function removeEntity(_0x52ab59,_0x26bc1a){return function(_0x1b9281){if(_0x1b9281){return _0x1b9281[_0x65bf('0x2b')]()['then'](function(){var _0x5857fe=_0x1b9281['get']({'plain':!![]});var _0x311ef6=_0x65bf('0x2c');return db[_0x65bf('0x2d')][_0x65bf('0x2b')]({'where':{'type':_0x311ef6,'resourceId':_0x5857fe['id']}})[_0x65bf('0x2a')](function(){return _0x1b9281;});})[_0x65bf('0x2a')](function(){_0x52ab59['status'](0xcc)[_0x65bf('0x20')]();});}};}function handleEntityNotFound(_0x1a6719,_0x37e685){return function(_0x3b5c6d){if(!_0x3b5c6d){_0x1a6719[_0x65bf('0x1e')](0x194);}return _0x3b5c6d;};}function handleError(_0xe8690a,_0x15e84d){_0x15e84d=_0x15e84d||0x1f4;return function(_0x58bb1c){logger[_0x65bf('0x2e')](_0x58bb1c['stack']);if(_0x58bb1c[_0x65bf('0x2f')]){delete _0x58bb1c['name'];}_0xe8690a[_0x65bf('0x1f')](_0x15e84d)[_0x65bf('0x30')](_0x58bb1c);};}exports[_0x65bf('0x31')]=function(_0x164119,_0xa6eb24){var _0x162d97={},_0x1596b8={},_0x5c28b4={'count':0x0,'rows':[]};var _0x127cbd=_[_0x65bf('0x32')](db[_0x65bf('0x33')][_0x65bf('0x34')],function(_0x3f18cb){return{'name':_0x3f18cb[_0x65bf('0x35')],'type':_0x3f18cb[_0x65bf('0x36')]['key']};});_0x1596b8['model']=_[_0x65bf('0x32')](_0x127cbd,'name');_0x1596b8[_0x65bf('0x37')]=_[_0x65bf('0x38')](_0x164119['query']);_0x1596b8[_0x65bf('0x39')]=_['intersection'](_0x1596b8[_0x65bf('0x3a')],_0x1596b8[_0x65bf('0x37')]);_0x162d97['attributes']=_[_0x65bf('0x3b')](_0x1596b8[_0x65bf('0x3a')],qs[_0x65bf('0x3c')](_0x164119[_0x65bf('0x37')][_0x65bf('0x3c')]));_0x162d97[_0x65bf('0x3d')]=_0x162d97['attributes']['length']?_0x162d97[_0x65bf('0x3d')]:_0x1596b8[_0x65bf('0x3a')];if(!_0x164119[_0x65bf('0x37')][_0x65bf('0x3e')]('nolimit')){_0x162d97[_0x65bf('0x24')]=qs[_0x65bf('0x24')](_0x164119[_0x65bf('0x37')]['limit']);_0x162d97[_0x65bf('0x23')]=qs['offset'](_0x164119[_0x65bf('0x37')][_0x65bf('0x23')]);}_0x162d97[_0x65bf('0x3f')]=qs[_0x65bf('0x40')](_0x164119[_0x65bf('0x37')][_0x65bf('0x40')]);_0x162d97[_0x65bf('0x41')]=qs[_0x65bf('0x39')](_[_0x65bf('0x42')](_0x164119[_0x65bf('0x37')],_0x1596b8[_0x65bf('0x39')]),_0x127cbd);if(_0x164119[_0x65bf('0x37')][_0x65bf('0x43')]){_0x162d97['where']=_[_0x65bf('0x44')](_0x162d97[_0x65bf('0x41')],{'$or':_[_0x65bf('0x32')](_0x127cbd,function(_0x593d53){if(_0x593d53[_0x65bf('0x36')]!==_0x65bf('0x45')){var _0x12693c={};_0x12693c[_0x593d53['name']]={'$like':'%'+_0x164119[_0x65bf('0x37')][_0x65bf('0x43')]+'%'};return _0x12693c;}})});}_0x162d97=_[_0x65bf('0x44')]({},_0x162d97,_0x164119[_0x65bf('0x46')]);var _0x43a6cc={'where':_0x162d97[_0x65bf('0x41')]};return db['CmList']['count'](_0x43a6cc)['then'](function(_0x307f99){_0x5c28b4[_0x65bf('0x22')]=_0x307f99;if(_0x164119[_0x65bf('0x37')][_0x65bf('0x47')]){_0x162d97[_0x65bf('0x48')]=[{'all':!![]}];}return db['CmList'][_0x65bf('0x49')](_0x162d97);})['then'](function(_0x334ea2){_0x5c28b4[_0x65bf('0x4a')]=_0x334ea2;return _0x5c28b4;})[_0x65bf('0x2a')](respondWithFilteredResult(_0xa6eb24,_0x162d97))['catch'](handleError(_0xa6eb24,null));};exports[_0x65bf('0x4b')]=function(_0x400aca,_0x48cd2c){var _0x1a4a97={'raw':![],'where':{'id':_0x400aca['params']['id']}},_0x590d66={};_0x590d66[_0x65bf('0x3a')]=_[_0x65bf('0x38')](db[_0x65bf('0x33')]['rawAttributes']);_0x590d66[_0x65bf('0x37')]=_[_0x65bf('0x38')](_0x400aca[_0x65bf('0x37')]);_0x590d66['filters']=_['intersection'](_0x590d66['model'],_0x590d66[_0x65bf('0x37')]);_0x1a4a97[_0x65bf('0x3d')]=_[_0x65bf('0x3b')](_0x590d66[_0x65bf('0x3a')],qs[_0x65bf('0x3c')](_0x400aca['query'][_0x65bf('0x3c')]));_0x1a4a97[_0x65bf('0x3d')]=_0x1a4a97[_0x65bf('0x3d')][_0x65bf('0x4c')]?_0x1a4a97['attributes']:_0x590d66[_0x65bf('0x3a')];if(_0x400aca[_0x65bf('0x37')][_0x65bf('0x47')]){_0x1a4a97[_0x65bf('0x48')]=[{'all':!![]}];}_0x1a4a97=_[_0x65bf('0x44')]({},_0x1a4a97,_0x400aca[_0x65bf('0x46')]);return db[_0x65bf('0x33')][_0x65bf('0x4d')](_0x1a4a97)[_0x65bf('0x2a')](handleEntityNotFound(_0x48cd2c,null))[_0x65bf('0x2a')](respondWithResult(_0x48cd2c,null))['catch'](handleError(_0x48cd2c,null));};exports[_0x65bf('0x4e')]=function(_0x25b1ba,_0x4b5c04){return db[_0x65bf('0x33')][_0x65bf('0x4e')](_0x25b1ba[_0x65bf('0x4f')],{})[_0x65bf('0x2a')](function(_0x2f4925){var _0xf66479=_0x25b1ba[_0x65bf('0x50')][_0x65bf('0x51')]({'plain':!![]});if(!_0xf66479)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf66479[_0x65bf('0x52')]===_0x65bf('0x50')){var _0x34bf9e=_0x2f4925[_0x65bf('0x51')]({'plain':!![]});var _0x3ba355=_0x65bf('0x2c');return db[_0x65bf('0x53')][_0x65bf('0x4d')]({'where':{'name':_0x3ba355,'userProfileId':_0xf66479[_0x65bf('0x54')]},'raw':!![]})[_0x65bf('0x2a')](function(_0x1d8b3a){if(_0x1d8b3a&&_0x1d8b3a[_0x65bf('0x55')]===0x0){return db[_0x65bf('0x2d')][_0x65bf('0x4e')]({'name':_0x34bf9e[_0x65bf('0x2f')],'resourceId':_0x34bf9e['id'],'type':_0x1d8b3a['name'],'sectionId':_0x1d8b3a['id']},{})[_0x65bf('0x2a')](function(){return _0x2f4925;});}else{return _0x2f4925;}})[_0x65bf('0x56')](function(_0x4f52c7){logger[_0x65bf('0x2e')](_0x65bf('0x57'),_0x4f52c7);throw _0x4f52c7;});}return _0x2f4925;})[_0x65bf('0x2a')](respondWithResult(_0x4b5c04,0xc9))['catch'](handleError(_0x4b5c04,null));};exports[_0x65bf('0x29')]=function(_0x1112a1,_0xc7b2f6){if(_0x1112a1[_0x65bf('0x4f')]['id']){delete _0x1112a1[_0x65bf('0x4f')]['id'];}return db[_0x65bf('0x33')][_0x65bf('0x4d')]({'where':{'id':_0x1112a1[_0x65bf('0x58')]['id']}})[_0x65bf('0x2a')](handleEntityNotFound(_0xc7b2f6,null))[_0x65bf('0x2a')](saveUpdates(_0x1112a1[_0x65bf('0x4f')],null))[_0x65bf('0x2a')](respondWithResult(_0xc7b2f6,null))[_0x65bf('0x56')](handleError(_0xc7b2f6,null));};exports[_0x65bf('0x2b')]=function(_0x582975,_0x543c5d){return db['CmList'][_0x65bf('0x4d')]({'where':{'id':_0x582975[_0x65bf('0x58')]['id']}})[_0x65bf('0x2a')](handleEntityNotFound(_0x543c5d,null))[_0x65bf('0x2a')](removeEntity(_0x543c5d,null))[_0x65bf('0x56')](handleError(_0x543c5d,null));};exports[_0x65bf('0x59')]=function(_0x17836d,_0x52b683){return db['CmList']['describe']()['then'](respondWithResult(_0x52b683,null))[_0x65bf('0x56')](handleError(_0x52b683,null));};exports[_0x65bf('0x5a')]=function(_0x2c79e6,_0xf94c66,_0x16340a){if(_0x2c79e6['body']['id']){delete _0x2c79e6[_0x65bf('0x4f')]['id'];}return db[_0x65bf('0x33')][_0x65bf('0x4d')]({'where':{'id':_0x2c79e6[_0x65bf('0x58')]['id']}})[_0x65bf('0x2a')](handleEntityNotFound(_0xf94c66,null))[_0x65bf('0x2a')](function(_0x50cc13){if(_0x50cc13){_0x2c79e6[_0x65bf('0x4f')][_0x65bf('0x5b')]=_0x50cc13['id'];return db[_0x65bf('0x5c')]['create'](_0x2c79e6['body']);}})[_0x65bf('0x2a')](respondWithResult(_0xf94c66,null))[_0x65bf('0x56')](handleError(_0xf94c66,null));};exports[_0x65bf('0x5d')]=function(_0x4792e6,_0x3e7a8a,_0x4d6259){var _0x261043={'raw':![],'where':{}};var _0x4aded2={};var _0x134b7={'count':0x0,'rows':[]};return db[_0x65bf('0x33')]['findOne']({'where':{'id':_0x4792e6[_0x65bf('0x58')]['id']}})[_0x65bf('0x2a')](handleEntityNotFound(_0x3e7a8a,null))['then'](function(_0x2378e6){if(_0x2378e6){_0x4aded2[_0x65bf('0x3a')]=_[_0x65bf('0x38')](db[_0x65bf('0x5c')][_0x65bf('0x34')]);_0x4aded2[_0x65bf('0x37')]=_[_0x65bf('0x38')](_0x4792e6['query']);_0x4aded2[_0x65bf('0x39')]=_[_0x65bf('0x3b')](_0x4aded2['model'],_0x4aded2[_0x65bf('0x37')]);_0x261043[_0x65bf('0x3d')]=_['intersection'](_0x4aded2[_0x65bf('0x3a')],qs['fields'](_0x4792e6['query']['fields']));_0x261043[_0x65bf('0x3d')]=_0x261043[_0x65bf('0x3d')][_0x65bf('0x4c')]?_0x261043[_0x65bf('0x3d')]:_0x4aded2[_0x65bf('0x3a')];if(!_0x4792e6['query'][_0x65bf('0x3e')](_0x65bf('0x5e'))){_0x261043['limit']=qs['limit'](_0x4792e6[_0x65bf('0x37')]['limit']);_0x261043[_0x65bf('0x23')]=qs['offset'](_0x4792e6[_0x65bf('0x37')][_0x65bf('0x23')]);}_0x261043[_0x65bf('0x3f')]=qs[_0x65bf('0x40')](_0x4792e6[_0x65bf('0x37')][_0x65bf('0x40')]);_0x261043[_0x65bf('0x41')]=qs[_0x65bf('0x39')](_[_0x65bf('0x42')](_0x4792e6[_0x65bf('0x37')],_0x4aded2['filters']));_0x261043['where'][_0x65bf('0x5b')]=_0x2378e6['id'];if(_0x4792e6['query']['filter']){_0x261043['where']=_[_0x65bf('0x44')](_0x261043[_0x65bf('0x41')],{'$or':_['map'](_0x261043['attributes'],function(_0x229933){var _0x1142df={};_0x1142df[_0x229933]={'$like':'%'+_0x4792e6[_0x65bf('0x37')][_0x65bf('0x43')]+'%'};return _0x1142df;})});}_0x261043=_[_0x65bf('0x44')]({},_0x261043,_0x4792e6['options']);return db[_0x65bf('0x5c')][_0x65bf('0x22')]({'where':_0x261043['where']})[_0x65bf('0x2a')](function(_0x2317ce){_0x134b7[_0x65bf('0x22')]=_0x2317ce;if(_0x4792e6[_0x65bf('0x37')][_0x65bf('0x47')]){_0x261043['include']=[{'all':!![]}];}return db[_0x65bf('0x5c')][_0x65bf('0x49')](_0x261043);})[_0x65bf('0x2a')](function(_0x388e3c){_0x134b7['rows']=_0x388e3c;return _0x134b7;});}})['then'](respondWithFilteredResult(_0x3e7a8a,_0x261043))[_0x65bf('0x56')](handleError(_0x3e7a8a,null));};exports[_0x65bf('0x5f')]=function(_0x350510,_0x488e6b,_0x488665){return db[_0x65bf('0x33')][_0x65bf('0x4d')]({'where':{'id':_0x350510[_0x65bf('0x58')]['id']}})[_0x65bf('0x2a')](handleEntityNotFound(_0x488e6b,null))[_0x65bf('0x2a')](function(_0x2fdf45){if(_0x2fdf45){return _0x2fdf45[_0x65bf('0x5f')](_0x350510[_0x65bf('0x37')][_0x65bf('0x60')]);}})['then'](respondWithStatusCode(_0x488e6b,null))[_0x65bf('0x56')](handleError(_0x488e6b,null));};exports[_0x65bf('0x61')]=function(_0x177326,_0x5b9ed6,_0x866c04){return db[_0x65bf('0x33')][_0x65bf('0x4d')]({'where':{'id':_0x177326[_0x65bf('0x58')]['id']}})[_0x65bf('0x2a')](handleEntityNotFound(_0x5b9ed6,null))[_0x65bf('0x2a')](function(_0x262d18){if(_0x262d18){var _0x52aabe=[];var _0x23fe13={'success':[],'errors':[]};return db[_0x65bf('0x62')][_0x65bf('0x59')]()[_0x65bf('0x2a')](function(_0x3b61e7){if(_0x177326[_0x65bf('0x4f')][_0x65bf('0x63')]&&_[_0x65bf('0x64')](_0x177326[_0x65bf('0x4f')][_0x65bf('0x63')])){if(_0x177326[_0x65bf('0x4f')][_0x65bf('0x63')][_0x65bf('0x4c')]){_0x177326[_0x65bf('0x4f')]['tags']=_0x177326[_0x65bf('0x4f')][_0x65bf('0x63')]['join'](';')+';';}else{_0x177326[_0x65bf('0x4f')][_0x65bf('0x63')]=null;}}else{_0x177326[_0x65bf('0x4f')][_0x65bf('0x63')]=null;}if(_0x177326[_0x65bf('0x4f')]&&_[_0x65bf('0x64')](_0x177326[_0x65bf('0x4f')])){for(var _0x2ecce8=0x0;_0x2ecce8<_0x177326[_0x65bf('0x4f')][_0x65bf('0x4c')];_0x2ecce8+=0x1){_0x177326[_0x65bf('0x4f')][_0x2ecce8][_0x65bf('0x5b')]=_0x177326[_0x65bf('0x58')]['id'];_0x52aabe['push'](_0x177326[_0x65bf('0x4f')][_0x2ecce8]);}return BPromise['each'](_0x52aabe,function(_0x56bb68){return db[_0x65bf('0x62')]['create'](_[_0x65bf('0x65')](_0x56bb68,[_0x65bf('0x60'),'id'])||{},{'fields':_[_0x65bf('0x38')](_0x3b61e7),'raw':!![]})['then'](function(_0x489c1d){_0x23fe13[_0x65bf('0x66')]['push'](_0x489c1d[_0x65bf('0x67')]);})[_0x65bf('0x56')](function(_0x2417b8){_0x23fe13[_0x65bf('0x68')]['push']({'data':_0x56bb68,'error':_0x2417b8[_0x65bf('0x69')]});});})[_0x65bf('0x2a')](function(_0x47c4a1){return _0x23fe13;})[_0x65bf('0x56')](function(_0x21e85e){return _0x21e85e;});}else{_0x5b9ed6['status'](0x190)[_0x65bf('0x21')]({'message':_0x65bf('0x6a')});}});}})[_0x65bf('0x2a')](respondWithResult(_0x5b9ed6,null))[_0x65bf('0x56')](handleError(_0x5b9ed6,null));};exports[_0x65bf('0x6b')]=function(_0x35a6b9,_0x57e002,_0x404506){var _0x2c8934;return db[_0x65bf('0x33')]['find']({'where':{'id':_0x35a6b9['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x65bf('0x6c')}]})[_0x65bf('0x2a')](handleEntityNotFound(_0x57e002,null))[_0x65bf('0x2a')](function(_0x3018da){if(_0x3018da){_0x2c8934=_0x3018da;return db['CmContact']['rawAttributes'];}})[_0x65bf('0x2a')](function(_0x351f22){if(_0x351f22){var _0x17f309={};var _0x1c5f65={};_0x1c5f65['model']=_[_0x65bf('0x6d')](_['keys'](_0x351f22),_[_0x65bf('0x32')](_0x2c8934[_0x65bf('0x6c')],function(_0x4fc03f){return util['format'](_0x65bf('0x6e'),_0x4fc03f['id']);}));_0x1c5f65[_0x65bf('0x37')]=_[_0x65bf('0x38')](_0x35a6b9[_0x65bf('0x37')]);_0x1c5f65['filters']=_['intersection'](_0x1c5f65['model'],_0x1c5f65[_0x65bf('0x37')]);_0x17f309[_0x65bf('0x3d')]=_['intersection'](_0x1c5f65[_0x65bf('0x3a')],qs[_0x65bf('0x3c')](_0x35a6b9[_0x65bf('0x37')][_0x65bf('0x3c')]));_0x17f309[_0x65bf('0x3d')]=_0x17f309[_0x65bf('0x3d')][_0x65bf('0x4c')]?_0x17f309[_0x65bf('0x3d')]:_0x1c5f65[_0x65bf('0x3a')];if(!_0x35a6b9[_0x65bf('0x37')][_0x65bf('0x3e')](_0x65bf('0x5e'))){_0x17f309[_0x65bf('0x24')]=qs['limit'](_0x35a6b9['query'][_0x65bf('0x24')]);_0x17f309['offset']=qs['offset'](_0x35a6b9[_0x65bf('0x37')]['offset']);}_0x17f309[_0x65bf('0x3f')]=qs[_0x65bf('0x40')](_0x35a6b9[_0x65bf('0x37')][_0x65bf('0x40')]);_0x17f309[_0x65bf('0x41')]=qs['filters'](_[_0x65bf('0x42')](_0x35a6b9['query'],_0x1c5f65[_0x65bf('0x39')]));_0x17f309[_0x65bf('0x6f')]=!![];if(_0x35a6b9['query'][_0x65bf('0x43')]){_0x17f309['where']=_[_0x65bf('0x44')](_0x17f309[_0x65bf('0x41')],{'$or':_[_0x65bf('0x32')](_0x17f309['attributes'],function(_0x4b83b4){var _0x4bbb74={};_0x4bbb74[_0x4b83b4]={'$like':'%'+_0x35a6b9[_0x65bf('0x37')][_0x65bf('0x43')]+'%'};return _0x4bbb74;})});}_0x17f309=_[_0x65bf('0x44')]({},_0x17f309,_0x35a6b9[_0x65bf('0x46')]);return _0x2c8934['getContacts'](_0x17f309);}})[_0x65bf('0x2a')](respondWithResult(_0x57e002,null))['catch'](handleError(_0x57e002,null));};exports[_0x65bf('0x70')]=function(_0x16a16e,_0x3b331c,_0x3bee12){var _0x28f0d0;return db[_0x65bf('0x33')]['find']({'where':{'id':_0x16a16e[_0x65bf('0x58')]['id']},'include':[{'model':db[_0x65bf('0x71')],'as':_0x65bf('0x6c')}]})['then'](handleEntityNotFound(_0x3b331c,null))['then'](function(_0x29f476){if(_0x29f476){_0x28f0d0=_0x29f476;return db[_0x65bf('0x62')][_0x65bf('0x34')];}})[_0x65bf('0x2a')](function(_0x2cb10a){if(_0x2cb10a){var _0x4ceda6={};var _0x1f4e04={};_0x1f4e04['model']=_[_0x65bf('0x6d')](_[_0x65bf('0x38')](_0x2cb10a),_[_0x65bf('0x32')](_0x28f0d0[_0x65bf('0x6c')],function(_0x3015e1){return util[_0x65bf('0x72')](_0x65bf('0x6e'),_0x3015e1['id']);}));_0x1f4e04[_0x65bf('0x37')]=_[_0x65bf('0x38')](_0x16a16e[_0x65bf('0x37')]);_0x1f4e04[_0x65bf('0x39')]=_[_0x65bf('0x3b')](_0x1f4e04[_0x65bf('0x3a')],_0x1f4e04[_0x65bf('0x37')]);_0x4ceda6[_0x65bf('0x3d')]=_[_0x65bf('0x3b')](_0x1f4e04[_0x65bf('0x3a')],qs[_0x65bf('0x3c')](_0x16a16e[_0x65bf('0x37')][_0x65bf('0x3c')]));_0x4ceda6[_0x65bf('0x3d')]=_0x4ceda6['attributes']['length']?_0x4ceda6[_0x65bf('0x3d')]:_0x1f4e04[_0x65bf('0x3a')];if(!_0x16a16e[_0x65bf('0x37')][_0x65bf('0x3e')](_0x65bf('0x5e'))){_0x4ceda6[_0x65bf('0x24')]=qs[_0x65bf('0x24')](_0x16a16e['query']['limit']);_0x4ceda6[_0x65bf('0x23')]=qs[_0x65bf('0x23')](_0x16a16e[_0x65bf('0x37')][_0x65bf('0x23')]);}_0x4ceda6[_0x65bf('0x3f')]=qs[_0x65bf('0x40')](_0x16a16e[_0x65bf('0x37')][_0x65bf('0x40')]);_0x4ceda6[_0x65bf('0x41')]=qs['filters'](_[_0x65bf('0x42')](_0x16a16e['query'],_0x1f4e04[_0x65bf('0x39')]));_0x4ceda6[_0x65bf('0x6f')]=!![];if(_0x16a16e['query']['filter']){_0x4ceda6[_0x65bf('0x41')]=_[_0x65bf('0x44')](_0x4ceda6[_0x65bf('0x41')],{'$or':_[_0x65bf('0x32')](_0x4ceda6[_0x65bf('0x3d')],function(_0xd1453){var _0x3f5839={};_0x3f5839[_0xd1453]={'$like':'%'+_0x16a16e[_0x65bf('0x37')][_0x65bf('0x43')]+'%'};return _0x3f5839;})});}_0x4ceda6=_['merge']({},_0x4ceda6,_0x16a16e[_0x65bf('0x46')]);return _0x28f0d0[_0x65bf('0x6b')](_0x4ceda6);}})[_0x65bf('0x2a')](function(_0x578437){if(!_[_0x65bf('0x73')](_0x578437)){var _0x237961=toCsv(_0x578437);var _0x489b9c=Date[_0x65bf('0x74')]();fs[_0x65bf('0x75')](util['format'](_0x65bf('0x76'),_0x28f0d0['id'],_0x489b9c),_0x237961);_0x3b331c[_0x65bf('0x77')]('Content-disposition',_0x65bf('0x78')+util['format'](_0x65bf('0x79'),_0x28f0d0['id'],_0x489b9c));_0x3b331c['setHeader'](_0x65bf('0x7a'),_0x65bf('0x7b'));return _0x3b331c['download'](util[_0x65bf('0x72')](_0x65bf('0x76'),_0x28f0d0['id'],_0x489b9c));}else{return _0x3b331c[_0x65bf('0x1e')](0xcc);}})['catch'](handleError(_0x3b331c,null));};exports[_0x65bf('0x7c')]=function(_0xa2fcbe,_0x33a548,_0x25e1c7){var _0x15f7b2;delete _0xa2fcbe[_0x65bf('0x4f')]['id'];return db['CmList'][_0x65bf('0x7d')]({'where':{'id':_0xa2fcbe[_0x65bf('0x58')]['id']}})['then'](handleEntityNotFound(_0x33a548,null))[_0x65bf('0x2a')](function(_0x2f3fa9){if(_0x2f3fa9){return db[_0x65bf('0x7e')][_0x65bf('0x7f')](function(_0x1cb507){return db[_0x65bf('0x71')]['create'](_0xa2fcbe[_0x65bf('0x4f')],{'transaction':_0x1cb507})[_0x65bf('0x2a')](function(_0x13afc9){_0x15f7b2=_0x13afc9;return _0x2f3fa9['addCustomFields'](_0x13afc9,{'transaction':_0x1cb507});})['then'](function(){var _0x513a3b={'type':db[_0x65bf('0x80')][_0x65bf('0x81')],'transaction':_0x1cb507};switch(_0xa2fcbe[_0x65bf('0x4f')][_0x65bf('0x36')]){case _0x65bf('0x82'):_0x513a3b[_0x65bf('0x36')]=db[_0x65bf('0x80')][_0x65bf('0x81')];break;case'number':_0x513a3b[_0x65bf('0x36')]=db[_0x65bf('0x80')][_0x65bf('0x83')];break;case _0x65bf('0x84'):_0x513a3b[_0x65bf('0x36')]=db[_0x65bf('0x80')][_0x65bf('0x85')];_0x513a3b[_0x65bf('0x86')]=![];break;default:}return db[_0x65bf('0x7e')][_0x65bf('0x87')]['addColumn'](_0x65bf('0x88'),util[_0x65bf('0x72')](_0x65bf('0x89'),_0x15f7b2['id']),_0x513a3b);})[_0x65bf('0x2a')](function(){return _0x15f7b2;});});}})[_0x65bf('0x2a')](respondWithResult(_0x33a548,null))[_0x65bf('0x56')](handleError(_0x33a548,null));};exports[_0x65bf('0x8a')]=function(_0x45c41f,_0x48c9eb,_0x277adb){var _0x252e63={};var _0x41f8c8={};var _0x3b4bba;var _0x4b91ec;return db[_0x65bf('0x33')]['findOne']({'where':{'id':_0x45c41f['params']['id']}})[_0x65bf('0x2a')](handleEntityNotFound(_0x48c9eb,null))[_0x65bf('0x2a')](function(_0x38c44a){if(_0x38c44a){_0x3b4bba=_0x38c44a;_0x41f8c8[_0x65bf('0x3a')]=_['keys'](db[_0x65bf('0x71')][_0x65bf('0x34')]);_0x41f8c8['query']=_[_0x65bf('0x38')](_0x45c41f[_0x65bf('0x37')]);_0x41f8c8[_0x65bf('0x39')]=_[_0x65bf('0x3b')](_0x41f8c8[_0x65bf('0x3a')],_0x41f8c8[_0x65bf('0x37')]);_0x252e63[_0x65bf('0x3d')]=_[_0x65bf('0x3b')](_0x41f8c8['model'],qs['fields'](_0x45c41f[_0x65bf('0x37')][_0x65bf('0x3c')]));_0x252e63['attributes']=_0x252e63[_0x65bf('0x3d')][_0x65bf('0x4c')]?_0x252e63['attributes']:_0x41f8c8[_0x65bf('0x3a')];_0x252e63[_0x65bf('0x3f')]=qs[_0x65bf('0x40')](_0x45c41f[_0x65bf('0x37')][_0x65bf('0x40')]);_0x252e63['where']=qs['filters'](_[_0x65bf('0x42')](_0x45c41f[_0x65bf('0x37')],_0x41f8c8[_0x65bf('0x39')]));_0x252e63[_0x65bf('0x41')]=_['merge'](_0x252e63['where'],{'$or':[{'ListId':_0x38c44a['id']},{'ListId':null}]});if(_0x45c41f[_0x65bf('0x37')]['filter']){_0x252e63[_0x65bf('0x41')]=_[_0x65bf('0x44')](_0x252e63[_0x65bf('0x41')],{'$or':_[_0x65bf('0x32')](_0x252e63[_0x65bf('0x3d')],function(_0x2ed637){var _0x26e29b={};_0x26e29b[_0x2ed637]={'$like':'%'+_0x45c41f[_0x65bf('0x37')][_0x65bf('0x43')]+'%'};return _0x26e29b;})});}_0x252e63=_[_0x65bf('0x44')]({},_0x252e63,_0x45c41f[_0x65bf('0x46')]);return db['CmCustomField'][_0x65bf('0x8b')](_0x252e63);}})[_0x65bf('0x2a')](respondWithResult(_0x48c9eb,null))[_0x65bf('0x56')](handleError(_0x48c9eb,null));};exports['addAgents']=function(_0x54ee41,_0x37ced2,_0x1b2072){return db[_0x65bf('0x33')][_0x65bf('0x4d')]({'where':{'id':_0x54ee41[_0x65bf('0x58')]['id']}})[_0x65bf('0x2a')](handleEntityNotFound(_0x37ced2,null))[_0x65bf('0x2a')](function(_0x316954){if(_0x316954){return _0x316954[_0x65bf('0x8c')](_0x54ee41[_0x65bf('0x4f')][_0x65bf('0x60')],_[_0x65bf('0x65')](_0x54ee41[_0x65bf('0x4f')],[_0x65bf('0x60'),'id'])||{})['spread'](function(_0xa8fdec){for(var _0x56e8a9=0x0;_0x56e8a9<_0x54ee41['body']['ids'][_0x65bf('0x4c')];_0x56e8a9+=0x1){socket[_0x65bf('0x8d')](_0x65bf('0x8e'),{'UserId':_0x54ee41[_0x65bf('0x4f')][_0x65bf('0x60')][_0x56e8a9],'CmListId':_0x54ee41[_0x65bf('0x58')]['id']});}return _0xa8fdec;});}})['then'](respondWithResult(_0x37ced2,null))[_0x65bf('0x56')](handleError(_0x37ced2,null));};exports[_0x65bf('0x8f')]=function(_0x539cc5,_0x1663a9,_0x1dbf21){return db[_0x65bf('0x33')][_0x65bf('0x4d')]({'where':{'id':_0x539cc5[_0x65bf('0x58')]['id']}})[_0x65bf('0x2a')](handleEntityNotFound(_0x1663a9,null))['then'](function(_0x4a2984){if(_0x4a2984){return _0x4a2984['removeAgents'](_0x539cc5[_0x65bf('0x37')]['ids'])['then'](function(){if(_[_0x65bf('0x64')](_0x539cc5[_0x65bf('0x37')][_0x65bf('0x60')])){for(var _0x57efe1=0x0;_0x57efe1<_0x539cc5[_0x65bf('0x37')]['ids']['length'];_0x57efe1+=0x1){socket[_0x65bf('0x8d')](_0x65bf('0x90'),{'UserId':Number(_0x539cc5[_0x65bf('0x37')][_0x65bf('0x60')][_0x57efe1]),'CmListId':Number(_0x539cc5['params']['id'])});}}else{socket[_0x65bf('0x8d')](_0x65bf('0x90'),{'UserId':Number(_0x539cc5[_0x65bf('0x37')]['ids']),'CmListId':Number(_0x539cc5[_0x65bf('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x1663a9,null))[_0x65bf('0x56')](handleError(_0x1663a9,null));};exports[_0x65bf('0x91')]=function(_0x529a61,_0x5d0106,_0xa97aac){var _0x3066df={};var _0x1f0916={};var _0x39329e;var _0x160b63;return db[_0x65bf('0x33')][_0x65bf('0x7d')]({'where':{'id':_0x529a61[_0x65bf('0x58')]['id']}})['then'](handleEntityNotFound(_0x5d0106,null))[_0x65bf('0x2a')](function(_0x25f7e3){if(_0x25f7e3){_0x39329e=_0x25f7e3;_0x1f0916[_0x65bf('0x3a')]=_[_0x65bf('0x38')](db['User'][_0x65bf('0x34')]);_0x1f0916[_0x65bf('0x37')]=_[_0x65bf('0x38')](_0x529a61[_0x65bf('0x37')]);_0x1f0916[_0x65bf('0x39')]=_['intersection'](_0x1f0916[_0x65bf('0x3a')],_0x1f0916[_0x65bf('0x37')]);_0x3066df[_0x65bf('0x3d')]=_['intersection'](_0x1f0916[_0x65bf('0x3a')],qs[_0x65bf('0x3c')](_0x529a61[_0x65bf('0x37')]['fields']));_0x3066df[_0x65bf('0x3d')]=_0x3066df['attributes'][_0x65bf('0x4c')]?_0x3066df[_0x65bf('0x3d')]:_0x1f0916[_0x65bf('0x3a')];_0x3066df[_0x65bf('0x3f')]=qs[_0x65bf('0x40')](_0x529a61['query']['sort']);_0x3066df['where']=qs['filters'](_[_0x65bf('0x42')](_0x529a61[_0x65bf('0x37')],_0x1f0916[_0x65bf('0x39')]));if(_0x529a61['query'][_0x65bf('0x43')]){_0x3066df[_0x65bf('0x41')]=_[_0x65bf('0x44')](_0x3066df[_0x65bf('0x41')],{'$or':_[_0x65bf('0x32')](_0x3066df['attributes'],function(_0x2900f5){var _0x247b7a={};_0x247b7a[_0x2900f5]={'$like':'%'+_0x529a61[_0x65bf('0x37')][_0x65bf('0x43')]+'%'};return _0x247b7a;})});}_0x3066df=_[_0x65bf('0x44')]({},_0x3066df,_0x529a61[_0x65bf('0x46')]);return _0x39329e[_0x65bf('0x91')](_0x3066df);}})['then'](function(_0x5c9a7d){if(_0x5c9a7d){_0x160b63=_0x5c9a7d[_0x65bf('0x4c')];if(!_0x529a61[_0x65bf('0x37')]['hasOwnProperty']('nolimit')){_0x3066df[_0x65bf('0x24')]=qs[_0x65bf('0x24')](_0x529a61[_0x65bf('0x37')][_0x65bf('0x24')]);_0x3066df[_0x65bf('0x23')]=qs[_0x65bf('0x23')](_0x529a61[_0x65bf('0x37')][_0x65bf('0x23')]);}return _0x39329e[_0x65bf('0x91')](_0x3066df);}})[_0x65bf('0x2a')](function(_0x3dca4e){if(_0x3dca4e){return _0x3dca4e?{'count':_0x160b63,'rows':_0x3dca4e}:null;}})['then'](respondWithResult(_0x5d0106,null))['catch'](handleError(_0x5d0106,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index fd3b5c1..80cf7da 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 _0xc1ac=['events','CmList','setMaxListeners','update','remove','emit','hook','exports'];(function(_0xee3051,_0xbe4f18){var _0x139e81=function(_0xac81c3){while(--_0xac81c3){_0xee3051['push'](_0xee3051['shift']());}};_0x139e81(++_0xbe4f18);}(_0xc1ac,0x68));var _0xcc1a=function(_0x31d49d,_0x42fc78){_0x31d49d=_0x31d49d-0x0;var _0x3d2f7d=_0xc1ac[_0x31d49d];return _0x3d2f7d;};'use strict';var EventEmitter=require(_0xcc1a('0x0'));var CmList=require('../../mysqldb')['db'][_0xcc1a('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0xcc1a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcc1a('0x3'),'afterDestroy':_0xcc1a('0x4')};function emitEvent(_0x56ad27){return function(_0x23d58b,_0x21910c,_0xebf8db){CmListEvents[_0xcc1a('0x5')](_0x56ad27+':'+_0x23d58b['id'],_0x23d58b);CmListEvents[_0xcc1a('0x5')](_0x56ad27,_0x23d58b);_0xebf8db(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xcc1a('0x6')](e,emitEvent(event));}}module[_0xcc1a('0x7')]=CmListEvents; \ No newline at end of file +var _0x30fd=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x30fd,0x126));var _0xd30f=function(_0x3eaccb,_0x13ac18){_0x3eaccb=_0x3eaccb-0x0;var _0x4db9ed=_0x30fd[_0x3eaccb];return _0x4db9ed;};'use strict';var EventEmitter=require(_0xd30f('0x0'));var CmList=require(_0xd30f('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd30f('0x2'),'afterDestroy':_0xd30f('0x3')};function emitEvent(_0x129c53){return function(_0x26dc02,_0x237ab5,_0x5f38ee){CmListEvents['emit'](_0x129c53+':'+_0x26dc02['id'],_0x26dc02);CmListEvents[_0xd30f('0x4')](_0x129c53,_0x26dc02);_0x5f38ee(null);};}for(var e in events){if(events[_0xd30f('0x5')](e)){var event=events[e];CmList[_0xd30f('0x6')](e,emitEvent(event));}}module[_0xd30f('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 0545653..0f675a7 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 _0x3756=['util','../../config/logger','api','bluebird','rimraf','define','CmList','cm_lists','lodash'];(function(_0x3785bd,_0x253151){var _0x17c7f=function(_0x1a0a3d){while(--_0x1a0a3d){_0x3785bd['push'](_0x3785bd['shift']());}};_0x17c7f(++_0x253151);}(_0x3756,0x170));var _0x6375=function(_0x111d50,_0x3fe61e){_0x111d50=_0x111d50-0x0;var _0x2bc6d5=_0x3756[_0x111d50];return _0x2bc6d5;};'use strict';var _=require(_0x6375('0x0'));var util=require(_0x6375('0x1'));var logger=require(_0x6375('0x2'))(_0x6375('0x3'));var moment=require('moment');var BPromise=require(_0x6375('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6375('0x5'));var config=require('../../config/environment');var attributes=require('./cmList.attributes');module['exports']=function(_0x124343,_0xad3764){return _0x124343[_0x6375('0x6')](_0x6375('0x7'),attributes,{'tableName':_0x6375('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d5d=['path','rimraf','../../config/environment','./cmList.attributes','exports','CmList','util','api','moment','bluebird','request-promise'];(function(_0x7629e,_0x40c972){var _0x19569b=function(_0xa62841){while(--_0xa62841){_0x7629e['push'](_0x7629e['shift']());}};_0x19569b(++_0x40c972);}(_0x3d5d,0x7f));var _0xd3d5=function(_0x28407a,_0x2a7269){_0x28407a=_0x28407a-0x0;var _0x8bd6ef=_0x3d5d[_0x28407a];return _0x8bd6ef;};'use strict';var _=require('lodash');var util=require(_0xd3d5('0x0'));var logger=require('../../config/logger')(_0xd3d5('0x1'));var moment=require(_0xd3d5('0x2'));var BPromise=require(_0xd3d5('0x3'));var rp=require(_0xd3d5('0x4'));var fs=require('fs');var path=require(_0xd3d5('0x5'));var rimraf=require(_0xd3d5('0x6'));var config=require(_0xd3d5('0x7'));var attributes=require(_0xd3d5('0x8'));module[_0xd3d5('0x9')]=function(_0x274f90,_0x1e1933){return _0x274f90['define'](_0xd3d5('0xa'),attributes,{'tableName':'cm_lists','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 fda3b22..74f63f5 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 _0x015f=['request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','request','CmList,\x20%s,\x20%s'];(function(_0x494c7d,_0x47940b){var _0x2d0195=function(_0x52c233){while(--_0x52c233){_0x494c7d['push'](_0x494c7d['shift']());}};_0x2d0195(++_0x47940b);}(_0x015f,0x14d));var _0xf015=function(_0x5b3946,_0x23053c){_0x5b3946=_0x5b3946-0x0;var _0x2bd577=_0x015f[_0x5b3946];return _0x2bd577;};'use strict';var _=require('lodash');var util=require(_0xf015('0x0'));var moment=require('moment');var BPromise=require(_0xf015('0x1'));var rs=require(_0xf015('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf015('0x3'));var logger=require(_0xf015('0x4'))(_0xf015('0x5'));var config=require(_0xf015('0x6'));var jayson=require(_0xf015('0x7'));var client=jayson[_0xf015('0x8')][_0xf015('0x9')]({'port':0x232a});config[_0xf015('0xa')]=_[_0xf015('0xb')](config[_0xf015('0xa')],{'host':_0xf015('0xc'),'port':0x18eb});var socket=require(_0xf015('0xd'))(new Redis(config[_0xf015('0xa')]));require(_0xf015('0xe'))['register'](socket);function respondWithRpcPromise(_0x3c0f16,_0x52a53a,_0x383122){return new BPromise(function(_0x66ff52,_0x8bd5b9){return client[_0xf015('0xf')](_0x3c0f16,_0x383122)['then'](function(_0x5748e6){logger['info'](_0xf015('0x10'),_0x52a53a,_0xf015('0x11'));logger[_0xf015('0x12')](_0xf015('0x13'),_0x52a53a,_0xf015('0x11'),JSON[_0xf015('0x14')](_0x5748e6));if(_0x5748e6['error']){if(_0x5748e6[_0xf015('0x15')]['code']===0x1f4){logger['error'](_0xf015('0x10'),_0x52a53a,_0x5748e6[_0xf015('0x15')]['message']);return _0x8bd5b9(_0x5748e6[_0xf015('0x15')][_0xf015('0x16')]);}logger[_0xf015('0x15')](_0xf015('0x10'),_0x52a53a,_0x5748e6[_0xf015('0x15')][_0xf015('0x16')]);return _0x66ff52(_0x5748e6['error'][_0xf015('0x16')]);}else{logger[_0xf015('0x17')](_0xf015('0x10'),_0x52a53a,'request\x20sent');_0x66ff52(_0x5748e6['result'][_0xf015('0x16')]);}})[_0xf015('0x18')](function(_0x652764){logger[_0xf015('0x15')](_0xf015('0x10'),_0x52a53a,_0x652764);_0x8bd5b9(_0x652764);});});} \ No newline at end of file +var _0x2d72=['stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s'];(function(_0x2f162d,_0x38672d){var _0x7557d3=function(_0x5dccc6){while(--_0x5dccc6){_0x2f162d['push'](_0x2f162d['shift']());}};_0x7557d3(++_0x38672d);}(_0x2d72,0xa8));var _0x22d7=function(_0x19b34d,_0x306ff6){_0x19b34d=_0x19b34d-0x0;var _0x3826b8=_0x2d72[_0x19b34d];return _0x3826b8;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var moment=require(_0x22d7('0x2'));var BPromise=require(_0x22d7('0x3'));var rs=require(_0x22d7('0x4'));var fs=require('fs');var Redis=require(_0x22d7('0x5'));var db=require(_0x22d7('0x6'))['db'];var utils=require(_0x22d7('0x7'));var logger=require(_0x22d7('0x8'))(_0x22d7('0x9'));var config=require(_0x22d7('0xa'));var jayson=require(_0x22d7('0xb'));var client=jayson[_0x22d7('0xc')][_0x22d7('0xd')]({'port':0x232a});config['redis']=_[_0x22d7('0xe')](config[_0x22d7('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0x22d7('0x10'))(new Redis(config[_0x22d7('0xf')]));require(_0x22d7('0x11'))[_0x22d7('0x12')](socket);function respondWithRpcPromise(_0x49f7e1,_0x5f56eb,_0x1810b8){return new BPromise(function(_0x257c85,_0x233c0b){return client[_0x22d7('0x13')](_0x49f7e1,_0x1810b8)[_0x22d7('0x14')](function(_0x4db5dd){logger['info'](_0x22d7('0x15'),_0x5f56eb,'request\x20sent');logger[_0x22d7('0x16')](_0x22d7('0x17'),_0x5f56eb,'request\x20sent',JSON[_0x22d7('0x18')](_0x4db5dd));if(_0x4db5dd[_0x22d7('0x19')]){if(_0x4db5dd[_0x22d7('0x19')][_0x22d7('0x1a')]===0x1f4){logger[_0x22d7('0x19')](_0x22d7('0x15'),_0x5f56eb,_0x4db5dd[_0x22d7('0x19')][_0x22d7('0x1b')]);return _0x233c0b(_0x4db5dd['error'][_0x22d7('0x1b')]);}logger[_0x22d7('0x19')](_0x22d7('0x15'),_0x5f56eb,_0x4db5dd['error']['message']);return _0x257c85(_0x4db5dd['error'][_0x22d7('0x1b')]);}else{logger[_0x22d7('0x1c')](_0x22d7('0x15'),_0x5f56eb,_0x22d7('0x1d'));_0x257c85(_0x4db5dd[_0x22d7('0x1e')]['message']);}})[_0x22d7('0x1f')](function(_0x75affd){logger[_0x22d7('0x19')]('CmList,\x20%s,\x20%s',_0x5f56eb,_0x75affd);_0x233c0b(_0x75affd);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index e1d4bbd..85fb6c3 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 _0x6a83=['register','length','cmList:','./cmList.events','save','remove','update','emit','removeListener'];(function(_0x5641ac,_0x4efbcb){var _0x5301da=function(_0x5ec540){while(--_0x5ec540){_0x5641ac['push'](_0x5641ac['shift']());}};_0x5301da(++_0x4efbcb);}(_0x6a83,0xd2));var _0x36a8=function(_0x10082b,_0x4fae40){_0x10082b=_0x10082b-0x0;var _0x1098b0=_0x6a83[_0x10082b];return _0x1098b0;};'use strict';var CmListEvents=require(_0x36a8('0x0'));var events=[_0x36a8('0x1'),_0x36a8('0x2'),_0x36a8('0x3')];function createListener(_0x125ca1,_0x367db7){return function(_0x1f59f3){_0x367db7[_0x36a8('0x4')](_0x125ca1,_0x1f59f3);};}function removeListener(_0x11a47c,_0x35767b){return function(){CmListEvents[_0x36a8('0x5')](_0x11a47c,_0x35767b);};}exports[_0x36a8('0x6')]=function(_0x360b47){for(var _0x60d79a=0x0,_0x2a0ba3=events[_0x36a8('0x7')];_0x60d79a<_0x2a0ba3;_0x60d79a++){var _0x31b8d3=events[_0x60d79a];var _0xf312a6=createListener(_0x36a8('0x8')+_0x31b8d3,_0x360b47);CmListEvents['on'](_0x31b8d3,_0xf312a6);}}; \ No newline at end of file +var _0x423b=['update','removeListener','length','cmList:','save'];(function(_0x26a2a2,_0x15c648){var _0xf80291=function(_0x4e2277){while(--_0x4e2277){_0x26a2a2['push'](_0x26a2a2['shift']());}};_0xf80291(++_0x15c648);}(_0x423b,0x12b));var _0xb423=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x423b[_0x119d5a];return _0x15bff4;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xb423('0x0'),'remove',_0xb423('0x1')];function createListener(_0x54e396,_0x3dbb0c){return function(_0x4b4acf){_0x3dbb0c['emit'](_0x54e396,_0x4b4acf);};}function removeListener(_0x50f31a,_0x2fa5da){return function(){CmListEvents[_0xb423('0x2')](_0x50f31a,_0x2fa5da);};}exports['register']=function(_0x1be92e){for(var _0x3e6b18=0x0,_0x49eabb=events[_0xb423('0x3')];_0x3e6b18<_0x49eabb;_0x3e6b18++){var _0x573e95=events[_0x3e6b18];var _0x4119d7=createListener(_0xb423('0x4')+_0x573e95,_0x1be92e);CmListEvents['on'](_0x573e95,_0x4119d7);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index f0ee1d2..7fa111a 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 _0xb24b=['addCustomField','addAgents','update','destroy','delete','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','addDisposition','post','addContacts'];(function(_0x5d050c,_0x4aa769){var _0x123257=function(_0x158178){while(--_0x158178){_0x5d050c['push'](_0x5d050c['shift']());}};_0x123257(++_0x4aa769);}(_0xb24b,0x17e));var _0xbb24=function(_0x33fc98,_0x3e42cb){_0x33fc98=_0x33fc98-0x0;var _0x21a47b=_0xb24b[_0x33fc98];return _0x21a47b;};'use strict';var multer=require(_0xbb24('0x0'));var util=require('util');var path=require(_0xbb24('0x1'));var timeout=require(_0xbb24('0x2'));var express=require(_0xbb24('0x3'));var router=express[_0xbb24('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xbb24('0x5'));var config=require(_0xbb24('0x6'));var controller=require(_0xbb24('0x7'));router[_0xbb24('0x8')]('/',auth['isAuthenticated'](),controller[_0xbb24('0x9')]);router[_0xbb24('0x8')](_0xbb24('0xa'),auth[_0xbb24('0xb')](),controller[_0xbb24('0xc')]);router[_0xbb24('0x8')](_0xbb24('0xd'),auth[_0xbb24('0xb')](),controller[_0xbb24('0xe')]);router[_0xbb24('0x8')](_0xbb24('0xf'),auth[_0xbb24('0xb')](),controller[_0xbb24('0x10')]);router['get'](_0xbb24('0x11'),auth[_0xbb24('0xb')](),controller['getContacts']);router[_0xbb24('0x8')]('/:id/contacts/csv',auth['isAuthenticated'](),controller[_0xbb24('0x12')]);router[_0xbb24('0x8')](_0xbb24('0x13'),auth[_0xbb24('0xb')](),controller[_0xbb24('0x14')]);router[_0xbb24('0x8')](_0xbb24('0x15'),auth['isAuthenticated'](),controller[_0xbb24('0x16')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/dispositions',auth[_0xbb24('0xb')](),controller[_0xbb24('0x17')]);router[_0xbb24('0x18')](_0xbb24('0x11'),auth[_0xbb24('0xb')](),controller[_0xbb24('0x19')]);router['post'](_0xbb24('0x13'),auth['isAuthenticated'](),controller[_0xbb24('0x1a')]);router[_0xbb24('0x18')](_0xbb24('0x15'),auth[_0xbb24('0xb')](),controller[_0xbb24('0x1b')]);router['put']('/:id',auth[_0xbb24('0xb')](),controller[_0xbb24('0x1c')]);router['delete'](_0xbb24('0xd'),auth[_0xbb24('0xb')](),controller[_0xbb24('0x1d')]);router[_0xbb24('0x1e')]('/:id/dispositions',auth[_0xbb24('0xb')](),controller[_0xbb24('0x1f')]);router[_0xbb24('0x1e')](_0xbb24('0x15'),auth[_0xbb24('0xb')](),controller[_0xbb24('0x20')]);module[_0xbb24('0x21')]=router; \ No newline at end of file +var _0x5d10=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','post','create','addContacts','/:id/fields','addAgents','put','update','destroy','delete','removeDispositions'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5d10,0x85));var _0x05d1=function(_0x30b0fe,_0x542156){_0x30b0fe=_0x30b0fe-0x0;var _0x412d11=_0x5d10[_0x30b0fe];return _0x412d11;};'use strict';var multer=require(_0x05d1('0x0'));var util=require(_0x05d1('0x1'));var path=require(_0x05d1('0x2'));var timeout=require(_0x05d1('0x3'));var express=require(_0x05d1('0x4'));var router=express['Router']();var auth=require(_0x05d1('0x5'));var interaction=require(_0x05d1('0x6'));var config=require('../../config/environment');var controller=require(_0x05d1('0x7'));router[_0x05d1('0x8')]('/',auth[_0x05d1('0x9')](),controller[_0x05d1('0xa')]);router[_0x05d1('0x8')](_0x05d1('0xb'),auth[_0x05d1('0x9')](),controller[_0x05d1('0xc')]);router['get'](_0x05d1('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x05d1('0xe'),auth[_0x05d1('0x9')](),controller[_0x05d1('0xf')]);router[_0x05d1('0x8')](_0x05d1('0x10'),auth[_0x05d1('0x9')](),controller[_0x05d1('0x11')]);router[_0x05d1('0x8')](_0x05d1('0x12'),auth['isAuthenticated'](),controller[_0x05d1('0x13')]);router[_0x05d1('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x05d1('0x14')]);router[_0x05d1('0x8')](_0x05d1('0x15'),auth[_0x05d1('0x9')](),controller['getAgents']);router[_0x05d1('0x16')]('/',auth[_0x05d1('0x9')](),controller[_0x05d1('0x17')]);router[_0x05d1('0x16')]('/:id/dispositions',auth[_0x05d1('0x9')](),controller['addDisposition']);router[_0x05d1('0x16')](_0x05d1('0x10'),auth[_0x05d1('0x9')](),controller[_0x05d1('0x18')]);router[_0x05d1('0x16')](_0x05d1('0x19'),auth[_0x05d1('0x9')](),controller['addCustomField']);router[_0x05d1('0x16')]('/:id/users',auth[_0x05d1('0x9')](),controller[_0x05d1('0x1a')]);router[_0x05d1('0x1b')](_0x05d1('0xd'),auth['isAuthenticated'](),controller[_0x05d1('0x1c')]);router['delete'](_0x05d1('0xd'),auth[_0x05d1('0x9')](),controller[_0x05d1('0x1d')]);router[_0x05d1('0x1e')]('/:id/dispositions',auth[_0x05d1('0x9')](),controller[_0x05d1('0x1f')]);router[_0x05d1('0x1e')](_0x05d1('0x15'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x05d1('0x20')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index a239f24..9752793 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x250c4a,_0x28e177){var _0x15bfd6=function(_0x424482){while(--_0x424482){_0x250c4a['push'](_0x250c4a['shift']());}};_0x15bfd6(++_0x28e177);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x1d3cc7,_0xd8c0c9){var _0x287373=function(_0x56fc26){while(--_0x56fc26){_0x1d3cc7['push'](_0x1d3cc7['shift']());}};_0x287373(++_0xd8c0c9);}(_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 5ec8d89..9f96db9 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 _0x261b=['zip-dir','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','body','Condition','find','params','catch','html-pdf','eml-format','rimraf'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x261b,0x93));var _0xb261=function(_0x5b6797,_0x181c97){_0x5b6797=_0x5b6797-0x0;var _0x4623e2=_0x261b[_0x5b6797];return _0x4623e2;};'use strict';var pdf=require(_0xb261('0x0'));var emlformat=require(_0xb261('0x1'));var rimraf=require(_0xb261('0x2'));var zipdir=require(_0xb261('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb261('0x4'));var BPromise=require(_0xb261('0x5'));var Mustache=require(_0xb261('0x6'));var util=require(_0xb261('0x7'));var path=require(_0xb261('0x8'));var sox=require(_0xb261('0x9'));var csv=require(_0xb261('0xa'));var ejs=require(_0xb261('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb261('0xc'));var crypto=require(_0xb261('0xd'));var jsforce=require(_0xb261('0xe'));var deskjs=require(_0xb261('0xf'));var toCsv=require(_0xb261('0xa'));var querystring=require(_0xb261('0x10'));var Papa=require(_0xb261('0x11'));var Redis=require(_0xb261('0x12'));var authService=require(_0xb261('0x13'));var qs=require(_0xb261('0x14'));var as=require(_0xb261('0x15'));var hardwareService=require(_0xb261('0x16'));var logger=require(_0xb261('0x17'))(_0xb261('0x18'));var utils=require(_0xb261('0x19'));var config=require(_0xb261('0x1a'));var db=require(_0xb261('0x1b'))['db'];function respondWithStatusCode(_0x371480,_0x4d1188){_0x4d1188=_0x4d1188||0xcc;return function(_0xdac5cb){if(_0xdac5cb){return _0x371480[_0xb261('0x1c')](_0x4d1188);}return _0x371480[_0xb261('0x1d')](_0x4d1188)['end']();};}function respondWithResult(_0x5ce7de,_0x14201c){_0x14201c=_0x14201c||0xc8;return function(_0x5b4ad6){if(_0x5b4ad6){return _0x5ce7de[_0xb261('0x1d')](_0x14201c)[_0xb261('0x1e')](_0x5b4ad6);}};}function respondWithFilteredResult(_0x3ca2ba,_0x424cbb){return function(_0x25e22c){if(_0x25e22c){var _0x625a62=_0x25e22c[_0xb261('0x1f')],_0x3f2982=_0x424cbb[_0xb261('0x20')],_0x178171=_0x424cbb[_0xb261('0x20')]+_0x424cbb[_0xb261('0x21')],_0x41f1bd;if(_0x178171>=_0x625a62){_0x178171=_0x625a62;_0x41f1bd=0xc8;}else{_0x41f1bd=0xce;}_0x3ca2ba[_0xb261('0x1d')](_0x41f1bd);return _0x3ca2ba[_0xb261('0x22')](_0xb261('0x23'),_0x3f2982+'-'+_0x178171+'/'+_0x625a62)[_0xb261('0x1e')](_0x25e22c);}return null;};}function patchUpdates(_0x56662f){return function(_0x480edc){try{jsonpatch[_0xb261('0x24')](_0x480edc,_0x56662f,!![]);}catch(_0x461c4c){return BPromise[_0xb261('0x25')](_0x461c4c);}return _0x480edc['save']();};}function saveUpdates(_0x55187a,_0x132004){return function(_0x23c796){if(_0x23c796){return _0x23c796[_0xb261('0x26')](_0x55187a)[_0xb261('0x27')](function(_0x1bcb48){return _0x1bcb48;});}return null;};}function removeEntity(_0x211c53,_0x123c30){return function(_0x345d26){if(_0x345d26){return _0x345d26[_0xb261('0x28')]()[_0xb261('0x27')](function(){_0x211c53[_0xb261('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ef6c7,_0x26209c){return function(_0x4571cd){if(!_0x4571cd){_0x4ef6c7['sendStatus'](0x194);}return _0x4571cd;};}function handleError(_0x3b6f96,_0x6db997){_0x6db997=_0x6db997||0x1f4;return function(_0x1b0763){logger[_0xb261('0x29')](_0x1b0763[_0xb261('0x2a')]);if(_0x1b0763[_0xb261('0x2b')]){delete _0x1b0763['name'];}_0x3b6f96[_0xb261('0x1d')](_0x6db997)[_0xb261('0x2c')](_0x1b0763);};}exports[_0xb261('0x26')]=function(_0x59db90,_0x3cb91f){if(_0x59db90['body']['id']){delete _0x59db90[_0xb261('0x2d')]['id'];}return db[_0xb261('0x2e')][_0xb261('0x2f')]({'where':{'id':_0x59db90[_0xb261('0x30')]['id']}})[_0xb261('0x27')](handleEntityNotFound(_0x3cb91f,null))[_0xb261('0x27')](saveUpdates(_0x59db90['body'],null))[_0xb261('0x27')](respondWithResult(_0x3cb91f,null))[_0xb261('0x31')](handleError(_0x3cb91f,null));};exports['destroy']=function(_0x1fa05e,_0x4830a1){return db[_0xb261('0x2e')]['find']({'where':{'id':_0x1fa05e[_0xb261('0x30')]['id']}})['then'](handleEntityNotFound(_0x4830a1,null))['then'](removeEntity(_0x4830a1,null))[_0xb261('0x31')](handleError(_0x4830a1,null));}; \ No newline at end of file +var _0x6fae=['then','catch','params','eml-format','fast-json-patch','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','set','reject','save','update','destroy','error','stack','name','send','body','Condition','find'];(function(_0x166436,_0x522fe3){var _0x27b22f=function(_0x31cd37){while(--_0x31cd37){_0x166436['push'](_0x166436['shift']());}};_0x27b22f(++_0x522fe3);}(_0x6fae,0x15b));var _0xe6fa=function(_0x36c3a2,_0x2a698a){_0x36c3a2=_0x36c3a2-0x0;var _0x35e931=_0x6fae[_0x36c3a2];return _0x35e931;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe6fa('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe6fa('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe6fa('0x2'));var Mustache=require(_0xe6fa('0x3'));var util=require(_0xe6fa('0x4'));var path=require('path');var sox=require(_0xe6fa('0x5'));var csv=require(_0xe6fa('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe6fa('0x7'));var squel=require(_0xe6fa('0x8'));var crypto=require(_0xe6fa('0x9'));var jsforce=require(_0xe6fa('0xa'));var deskjs=require(_0xe6fa('0xb'));var toCsv=require(_0xe6fa('0x6'));var querystring=require(_0xe6fa('0xc'));var Papa=require(_0xe6fa('0xd'));var Redis=require(_0xe6fa('0xe'));var authService=require(_0xe6fa('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe6fa('0x10'));var hardwareService=require(_0xe6fa('0x11'));var logger=require(_0xe6fa('0x12'))(_0xe6fa('0x13'));var utils=require(_0xe6fa('0x14'));var config=require(_0xe6fa('0x15'));var db=require(_0xe6fa('0x16'))['db'];function respondWithStatusCode(_0x2384da,_0x5eb127){_0x5eb127=_0x5eb127||0xcc;return function(_0x52ede3){if(_0x52ede3){return _0x2384da[_0xe6fa('0x17')](_0x5eb127);}return _0x2384da['status'](_0x5eb127)[_0xe6fa('0x18')]();};}function respondWithResult(_0x5f1dc8,_0x2f2c72){_0x2f2c72=_0x2f2c72||0xc8;return function(_0x443299){if(_0x443299){return _0x5f1dc8['status'](_0x2f2c72)[_0xe6fa('0x19')](_0x443299);}};}function respondWithFilteredResult(_0x2cb686,_0x2b6626){return function(_0x33ff27){if(_0x33ff27){var _0x1d6eb0=_0x33ff27[_0xe6fa('0x1a')],_0x55b749=_0x2b6626[_0xe6fa('0x1b')],_0x3670ce=_0x2b6626[_0xe6fa('0x1b')]+_0x2b6626['limit'],_0x3c88b5;if(_0x3670ce>=_0x1d6eb0){_0x3670ce=_0x1d6eb0;_0x3c88b5=0xc8;}else{_0x3c88b5=0xce;}_0x2cb686['status'](_0x3c88b5);return _0x2cb686[_0xe6fa('0x1c')]('Content-Range',_0x55b749+'-'+_0x3670ce+'/'+_0x1d6eb0)[_0xe6fa('0x19')](_0x33ff27);}return null;};}function patchUpdates(_0x5b95d4){return function(_0x4f5383){try{jsonpatch['apply'](_0x4f5383,_0x5b95d4,!![]);}catch(_0x6edfdb){return BPromise[_0xe6fa('0x1d')](_0x6edfdb);}return _0x4f5383[_0xe6fa('0x1e')]();};}function saveUpdates(_0x114406,_0x18f3c9){return function(_0x503462){if(_0x503462){return _0x503462[_0xe6fa('0x1f')](_0x114406)['then'](function(_0x3b19ad){return _0x3b19ad;});}return null;};}function removeEntity(_0x1f05b0,_0xdf40e3){return function(_0x444ebf){if(_0x444ebf){return _0x444ebf[_0xe6fa('0x20')]()['then'](function(){_0x1f05b0['status'](0xcc)[_0xe6fa('0x18')]();});}};}function handleEntityNotFound(_0x5b290c,_0x1dbbb5){return function(_0x354a46){if(!_0x354a46){_0x5b290c['sendStatus'](0x194);}return _0x354a46;};}function handleError(_0x251617,_0x4e9f12){_0x4e9f12=_0x4e9f12||0x1f4;return function(_0x5634d6){logger[_0xe6fa('0x21')](_0x5634d6[_0xe6fa('0x22')]);if(_0x5634d6[_0xe6fa('0x23')]){delete _0x5634d6[_0xe6fa('0x23')];}_0x251617['status'](_0x4e9f12)[_0xe6fa('0x24')](_0x5634d6);};}exports[_0xe6fa('0x1f')]=function(_0xc3ab2b,_0x41bb99){if(_0xc3ab2b[_0xe6fa('0x25')]['id']){delete _0xc3ab2b[_0xe6fa('0x25')]['id'];}return db[_0xe6fa('0x26')][_0xe6fa('0x27')]({'where':{'id':_0xc3ab2b['params']['id']}})[_0xe6fa('0x28')](handleEntityNotFound(_0x41bb99,null))[_0xe6fa('0x28')](saveUpdates(_0xc3ab2b['body'],null))[_0xe6fa('0x28')](respondWithResult(_0x41bb99,null))[_0xe6fa('0x29')](handleError(_0x41bb99,null));};exports[_0xe6fa('0x20')]=function(_0x24d6d9,_0xf3179a){return db[_0xe6fa('0x26')][_0xe6fa('0x27')]({'where':{'id':_0x24d6d9[_0xe6fa('0x2a')]['id']}})[_0xe6fa('0x28')](handleEntityNotFound(_0xf3179a,null))[_0xe6fa('0x28')](removeEntity(_0xf3179a,null))[_0xe6fa('0x29')](handleError(_0xf3179a,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 9cb56fc..e143075 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 _0x0b16=['tools_conditions','lodash','api','moment','path','rimraf','../../config/environment','./condition.attributes','define','Condition'];(function(_0x3ec9c3,_0x19d270){var _0x287f3d=function(_0x158bc4){while(--_0x158bc4){_0x3ec9c3['push'](_0x3ec9c3['shift']());}};_0x287f3d(++_0x19d270);}(_0x0b16,0x1eb));var _0x60b1=function(_0xed715a,_0x2eb934){_0xed715a=_0xed715a-0x0;var _0x55ce9b=_0x0b16[_0xed715a];return _0x55ce9b;};'use strict';var _=require(_0x60b1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x60b1('0x1'));var moment=require(_0x60b1('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x60b1('0x3'));var rimraf=require(_0x60b1('0x4'));var config=require(_0x60b1('0x5'));var attributes=require(_0x60b1('0x6'));module['exports']=function(_0x2568e2,_0x9431ec){return _0x2568e2[_0x60b1('0x7')](_0x60b1('0x8'),attributes,{'tableName':_0x60b1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc4c=['bluebird','request-promise','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','../../config/logger','api','moment'];(function(_0x12d951,_0x249808){var _0x44de17=function(_0x182fd9){while(--_0x182fd9){_0x12d951['push'](_0x12d951['shift']());}};_0x44de17(++_0x249808);}(_0xfc4c,0xef));var _0xcfc4=function(_0x47ee1c,_0x1fdc5f){_0x47ee1c=_0x47ee1c-0x0;var _0x5876f3=_0xfc4c[_0x47ee1c];return _0x5876f3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcfc4('0x0'))(_0xcfc4('0x1'));var moment=require(_0xcfc4('0x2'));var BPromise=require(_0xcfc4('0x3'));var rp=require(_0xcfc4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcfc4('0x5'));var config=require(_0xcfc4('0x6'));var attributes=require(_0xcfc4('0x7'));module[_0xcfc4('0x8')]=function(_0x34fe07,_0x17c1bb){return _0x34fe07[_0xcfc4('0x9')](_0xcfc4('0xa'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index cec478a..9958dff 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 _0xbc14=['../../config/environment','request','then','info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Condition,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x26d12b,_0x40030c){var _0x8cc416=function(_0x10325f){while(--_0x10325f){_0x26d12b['push'](_0x26d12b['shift']());}};_0x8cc416(++_0x40030c);}(_0xbc14,0xaf));var _0x4bc1=function(_0x4b1032,_0x36952e){_0x4b1032=_0x4b1032-0x0;var _0x5a1d55=_0xbc14[_0x4b1032];return _0x5a1d55;};'use strict';var _=require(_0x4bc1('0x0'));var util=require('util');var moment=require(_0x4bc1('0x1'));var BPromise=require(_0x4bc1('0x2'));var rs=require(_0x4bc1('0x3'));var fs=require('fs');var Redis=require(_0x4bc1('0x4'));var db=require(_0x4bc1('0x5'))['db'];var utils=require(_0x4bc1('0x6'));var logger=require(_0x4bc1('0x7'))(_0x4bc1('0x8'));var config=require(_0x4bc1('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x89a31e,_0x3f2d50,_0x15b961){return new BPromise(function(_0x5e257e,_0x32abad){return client[_0x4bc1('0xa')](_0x89a31e,_0x15b961)[_0x4bc1('0xb')](function(_0x50fb4d){logger[_0x4bc1('0xc')]('Condition,\x20%s,\x20%s',_0x3f2d50,_0x4bc1('0xd'));logger[_0x4bc1('0xe')](_0x4bc1('0xf'),_0x3f2d50,_0x4bc1('0xd'),JSON[_0x4bc1('0x10')](_0x50fb4d));if(_0x50fb4d[_0x4bc1('0x11')]){if(_0x50fb4d[_0x4bc1('0x11')][_0x4bc1('0x12')]===0x1f4){logger[_0x4bc1('0x11')]('Condition,\x20%s,\x20%s',_0x3f2d50,_0x50fb4d[_0x4bc1('0x11')]['message']);return _0x32abad(_0x50fb4d[_0x4bc1('0x11')][_0x4bc1('0x13')]);}logger['error'](_0x4bc1('0x14'),_0x3f2d50,_0x50fb4d[_0x4bc1('0x11')]['message']);return _0x5e257e(_0x50fb4d[_0x4bc1('0x11')][_0x4bc1('0x13')]);}else{logger[_0x4bc1('0xc')]('Condition,\x20%s,\x20%s',_0x3f2d50,_0x4bc1('0xd'));_0x5e257e(_0x50fb4d[_0x4bc1('0x15')]['message']);}})[_0x4bc1('0x16')](function(_0x41f122){logger[_0x4bc1('0x11')](_0x4bc1('0x14'),_0x3f2d50,_0x41f122);_0x32abad(_0x41f122);});});} \ No newline at end of file +var _0x09c9=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x41188f,_0x43488c){var _0x356950=function(_0x5c9350){while(--_0x5c9350){_0x41188f['push'](_0x41188f['shift']());}};_0x356950(++_0x43488c);}(_0x09c9,0x1a9));var _0x909c=function(_0x3e4485,_0x1e22c4){_0x3e4485=_0x3e4485-0x0;var _0x16af58=_0x09c9[_0x3e4485];return _0x16af58;};'use strict';var _=require(_0x909c('0x0'));var util=require(_0x909c('0x1'));var moment=require(_0x909c('0x2'));var BPromise=require(_0x909c('0x3'));var rs=require(_0x909c('0x4'));var fs=require('fs');var Redis=require(_0x909c('0x5'));var db=require(_0x909c('0x6'))['db'];var utils=require(_0x909c('0x7'));var logger=require(_0x909c('0x8'))(_0x909c('0x9'));var config=require('../../config/environment');var jayson=require(_0x909c('0xa'));var client=jayson[_0x909c('0xb')][_0x909c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c1bda,_0x421671,_0x4eca43){return new BPromise(function(_0x23e453,_0x279129){return client['request'](_0x2c1bda,_0x4eca43)[_0x909c('0xd')](function(_0x603df2){logger['info'](_0x909c('0xe'),_0x421671,_0x909c('0xf'));logger[_0x909c('0x10')]('Condition,\x20%s,\x20%s,\x20%s',_0x421671,'request\x20sent',JSON[_0x909c('0x11')](_0x603df2));if(_0x603df2['error']){if(_0x603df2[_0x909c('0x12')][_0x909c('0x13')]===0x1f4){logger[_0x909c('0x12')]('Condition,\x20%s,\x20%s',_0x421671,_0x603df2['error'][_0x909c('0x14')]);return _0x279129(_0x603df2['error']['message']);}logger[_0x909c('0x12')](_0x909c('0xe'),_0x421671,_0x603df2['error'][_0x909c('0x14')]);return _0x23e453(_0x603df2[_0x909c('0x12')][_0x909c('0x14')]);}else{logger[_0x909c('0x15')]('Condition,\x20%s,\x20%s',_0x421671,_0x909c('0xf'));_0x23e453(_0x603df2[_0x909c('0x16')]['message']);}})[_0x909c('0x17')](function(_0x30376d){logger['error'](_0x909c('0xe'),_0x421671,_0x30376d);_0x279129(_0x30376d);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index e9b9b9b..79ba2a2 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 _0xc7b0=['util','path','connect-timeout','Router','../../components/auth/service','./condition.controller','put','/:id','isAuthenticated','delete','destroy','exports','multer'];(function(_0x413993,_0xa1575b){var _0x4c698d=function(_0x2d1ef7){while(--_0x2d1ef7){_0x413993['push'](_0x413993['shift']());}};_0x4c698d(++_0xa1575b);}(_0xc7b0,0x103));var _0x0c7b=function(_0x3273ca,_0x1127fc){_0x3273ca=_0x3273ca-0x0;var _0x27c06b=_0xc7b0[_0x3273ca];return _0x27c06b;};'use strict';var multer=require(_0x0c7b('0x0'));var util=require(_0x0c7b('0x1'));var path=require(_0x0c7b('0x2'));var timeout=require(_0x0c7b('0x3'));var express=require('express');var router=express[_0x0c7b('0x4')]();var auth=require(_0x0c7b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0c7b('0x6'));router[_0x0c7b('0x7')](_0x0c7b('0x8'),auth[_0x0c7b('0x9')](),controller['update']);router[_0x0c7b('0xa')](_0x0c7b('0x8'),auth[_0x0c7b('0x9')](),controller[_0x0c7b('0xb')]);module[_0x0c7b('0xc')]=router; \ No newline at end of file +var _0x2e10=['util','connect-timeout','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update','destroy','exports','multer'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x2e10,0x1af));var _0x02e1=function(_0x5eeae2,_0x320c70){_0x5eeae2=_0x5eeae2-0x0;var _0x5b43c3=_0x2e10[_0x5eeae2];return _0x5b43c3;};'use strict';var multer=require(_0x02e1('0x0'));var util=require(_0x02e1('0x1'));var path=require('path');var timeout=require(_0x02e1('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x02e1('0x3'));var interaction=require(_0x02e1('0x4'));var config=require('../../config/environment');var controller=require(_0x02e1('0x5'));router[_0x02e1('0x6')](_0x02e1('0x7'),auth[_0x02e1('0x8')](),controller[_0x02e1('0x9')]);router['delete'](_0x02e1('0x7'),auth['isAuthenticated'](),controller[_0x02e1('0xa')]);module[_0x02e1('0xb')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index beb800a..238d8c0 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 _0x207d=['name','sequelize','exports','STRING'];(function(_0xab6620,_0x5625ce){var _0x550039=function(_0x2b2d7c){while(--_0x2b2d7c){_0xab6620['push'](_0xab6620['shift']());}};_0x550039(++_0x5625ce);}(_0x207d,0x10d));var _0xd207=function(_0x249e59,_0x4679d8){_0x249e59=_0x249e59-0x0;var _0x5ad3c7=_0x207d[_0x249e59];return _0x5ad3c7;};'use strict';var Sequelize=require(_0xd207('0x0'));module[_0xd207('0x1')]={'name':{'type':Sequelize[_0xd207('0x2')],'allowNull':![],'unique':_0xd207('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xd207('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xdeb3=['sequelize','exports','STRING','name','INTEGER'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0xdeb3,0xeb));var _0x3deb=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdeb3[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x3deb('0x0'));module[_0x3deb('0x1')]={'name':{'type':Sequelize[_0x3deb('0x2')],'allowNull':![],'unique':_0x3deb('0x3')},'OrderBy':{'type':Sequelize[_0x3deb('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x3deb('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 323581b..20d1475 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['include','rows','show','params','intersection','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','name','send','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll'];(function(_0x3c711d,_0x219174){var _0x448b20=function(_0x29c136){while(--_0x29c136){_0x3c711d['push'](_0x3c711d['shift']());}};_0x448b20(++_0x219174);}(_0xedd9,0xfc));var _0x9edd=function(_0x49c1e9,_0x1ea9d5){_0x49c1e9=_0x49c1e9-0x0;var _0x23a335=_0xedd9[_0x49c1e9];return _0x23a335;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9edd('0x0'));var rimraf=require(_0x9edd('0x1'));var zipdir=require(_0x9edd('0x2'));var jsonpatch=require(_0x9edd('0x3'));var rp=require(_0x9edd('0x4'));var moment=require(_0x9edd('0x5'));var BPromise=require(_0x9edd('0x6'));var Mustache=require(_0x9edd('0x7'));var util=require('util');var path=require(_0x9edd('0x8'));var sox=require(_0x9edd('0x9'));var csv=require(_0x9edd('0xa'));var ejs=require(_0x9edd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0xa'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var db=require(_0x9edd('0x16'))['db'];function respondWithStatusCode(_0x25e64c,_0xfd544a){_0xfd544a=_0xfd544a||0xcc;return function(_0x287ddd){if(_0x287ddd){return _0x25e64c[_0x9edd('0x17')](_0xfd544a);}return _0x25e64c[_0x9edd('0x18')](_0xfd544a)[_0x9edd('0x19')]();};}function respondWithResult(_0x47eb64,_0x176bfa){_0x176bfa=_0x176bfa||0xc8;return function(_0x44fc7c){if(_0x44fc7c){return _0x47eb64[_0x9edd('0x18')](_0x176bfa)[_0x9edd('0x1a')](_0x44fc7c);}};}function respondWithFilteredResult(_0x13b6b6,_0x338f3c){return function(_0x1042aa){if(_0x1042aa){var _0x75a4ab=_0x1042aa[_0x9edd('0x1b')],_0x4ea60f=_0x338f3c['offset'],_0x5f5bf4=_0x338f3c[_0x9edd('0x1c')]+_0x338f3c[_0x9edd('0x1d')],_0x448996;if(_0x5f5bf4>=_0x75a4ab){_0x5f5bf4=_0x75a4ab;_0x448996=0xc8;}else{_0x448996=0xce;}_0x13b6b6[_0x9edd('0x18')](_0x448996);return _0x13b6b6['set'](_0x9edd('0x1e'),_0x4ea60f+'-'+_0x5f5bf4+'/'+_0x75a4ab)['json'](_0x1042aa);}return null;};}function patchUpdates(_0x2cdcef){return function(_0x1083e4){try{jsonpatch['apply'](_0x1083e4,_0x2cdcef,!![]);}catch(_0x498977){return BPromise[_0x9edd('0x1f')](_0x498977);}return _0x1083e4['save']();};}function saveUpdates(_0x27a95a,_0x54a03f){return function(_0x535f37){if(_0x535f37){return _0x535f37[_0x9edd('0x20')](_0x27a95a)[_0x9edd('0x21')](function(_0x4fb7bf){return _0x4fb7bf;});}return null;};}function removeEntity(_0x5823bc,_0x341d67){return function(_0x186186){if(_0x186186){return _0x186186[_0x9edd('0x22')]()['then'](function(){var _0x3741c8=_0x186186[_0x9edd('0x23')]({'plain':!![]});var _0x44a6c1=_0x9edd('0x24');return db[_0x9edd('0x25')]['destroy']({'where':{'type':_0x44a6c1,'resourceId':_0x3741c8['id']}})[_0x9edd('0x21')](function(){return _0x186186;});})[_0x9edd('0x21')](function(){_0x5823bc[_0x9edd('0x18')](0xcc)[_0x9edd('0x19')]();});}};}function handleEntityNotFound(_0x310a4d,_0x4d507f){return function(_0x4b3d1b){if(!_0x4b3d1b){_0x310a4d[_0x9edd('0x17')](0x194);}return _0x4b3d1b;};}function handleError(_0xfeca7b,_0x8d67aa){_0x8d67aa=_0x8d67aa||0x1f4;return function(_0x25e135){logger[_0x9edd('0x26')](_0x25e135['stack']);if(_0x25e135['name']){delete _0x25e135[_0x9edd('0x27')];}_0xfeca7b[_0x9edd('0x18')](_0x8d67aa)[_0x9edd('0x28')](_0x25e135);};}exports['index']=function(_0x238b22,_0x28cfae){var _0x2ae8dd={},_0x41af53={},_0x5eccfb={'count':0x0,'rows':[]};var _0x2155a1=_[_0x9edd('0x29')](db[_0x9edd('0x2a')][_0x9edd('0x2b')],function(_0xbbf08f){return{'name':_0xbbf08f[_0x9edd('0x2c')],'type':_0xbbf08f[_0x9edd('0x2d')][_0x9edd('0x2e')]};});_0x41af53[_0x9edd('0x2f')]=_[_0x9edd('0x29')](_0x2155a1,_0x9edd('0x27'));_0x41af53[_0x9edd('0x30')]=_[_0x9edd('0x31')](_0x238b22[_0x9edd('0x30')]);_0x41af53[_0x9edd('0x32')]=_['intersection'](_0x41af53[_0x9edd('0x2f')],_0x41af53[_0x9edd('0x30')]);_0x2ae8dd[_0x9edd('0x33')]=_['intersection'](_0x41af53[_0x9edd('0x2f')],qs[_0x9edd('0x34')](_0x238b22[_0x9edd('0x30')][_0x9edd('0x34')]));_0x2ae8dd[_0x9edd('0x33')]=_0x2ae8dd[_0x9edd('0x33')][_0x9edd('0x35')]?_0x2ae8dd[_0x9edd('0x33')]:_0x41af53[_0x9edd('0x2f')];if(!_0x238b22[_0x9edd('0x30')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x2ae8dd[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x238b22['query'][_0x9edd('0x1d')]);_0x2ae8dd['offset']=qs[_0x9edd('0x1c')](_0x238b22[_0x9edd('0x30')][_0x9edd('0x1c')]);}_0x2ae8dd[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x238b22['query'][_0x9edd('0x39')]);_0x2ae8dd[_0x9edd('0x3a')]=qs[_0x9edd('0x32')](_[_0x9edd('0x3b')](_0x238b22[_0x9edd('0x30')],_0x41af53[_0x9edd('0x32')]),_0x2155a1);if(_0x238b22[_0x9edd('0x30')][_0x9edd('0x3c')]){_0x2ae8dd[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x2ae8dd['where'],{'$or':_[_0x9edd('0x29')](_0x2155a1,function(_0x56a228){if(_0x56a228[_0x9edd('0x2d')]!=='VIRTUAL'){var _0x30883e={};_0x30883e[_0x56a228[_0x9edd('0x27')]]={'$like':'%'+_0x238b22[_0x9edd('0x30')]['filter']+'%'};return _0x30883e;}})});}_0x2ae8dd=_[_0x9edd('0x3d')]({},_0x2ae8dd,_0x238b22[_0x9edd('0x3e')]);var _0x2f8f61={'where':_0x2ae8dd['where']};return db[_0x9edd('0x2a')]['count'](_0x2f8f61)[_0x9edd('0x21')](function(_0xfbc492){_0x5eccfb['count']=_0xfbc492;if(_0x238b22[_0x9edd('0x30')][_0x9edd('0x3f')]){_0x2ae8dd[_0x9edd('0x40')]=[{'all':!![]}];}return db[_0x9edd('0x2a')]['findAll'](_0x2ae8dd);})[_0x9edd('0x21')](function(_0x5bbdf8){_0x5eccfb[_0x9edd('0x41')]=_0x5bbdf8;return _0x5eccfb;})[_0x9edd('0x21')](respondWithFilteredResult(_0x28cfae,_0x2ae8dd))['catch'](handleError(_0x28cfae,null));};exports[_0x9edd('0x42')]=function(_0x49a128,_0x548299){var _0x369b69={'raw':!![],'where':{'id':_0x49a128[_0x9edd('0x43')]['id']}},_0x9cab86={};_0x9cab86[_0x9edd('0x2f')]=_[_0x9edd('0x31')](db[_0x9edd('0x2a')][_0x9edd('0x2b')]);_0x9cab86[_0x9edd('0x30')]=_[_0x9edd('0x31')](_0x49a128[_0x9edd('0x30')]);_0x9cab86[_0x9edd('0x32')]=_[_0x9edd('0x44')](_0x9cab86[_0x9edd('0x2f')],_0x9cab86[_0x9edd('0x30')]);_0x369b69[_0x9edd('0x33')]=_['intersection'](_0x9cab86[_0x9edd('0x2f')],qs[_0x9edd('0x34')](_0x49a128[_0x9edd('0x30')][_0x9edd('0x34')]));_0x369b69[_0x9edd('0x33')]=_0x369b69[_0x9edd('0x33')][_0x9edd('0x35')]?_0x369b69['attributes']:_0x9cab86['model'];if(_0x49a128['query'][_0x9edd('0x3f')]){_0x369b69['include']=[{'all':!![]}];}_0x369b69=_[_0x9edd('0x3d')]({},_0x369b69,_0x49a128[_0x9edd('0x3e')]);return db[_0x9edd('0x2a')][_0x9edd('0x45')](_0x369b69)[_0x9edd('0x21')](handleEntityNotFound(_0x548299,null))['then'](respondWithResult(_0x548299,null))[_0x9edd('0x46')](handleError(_0x548299,null));};exports[_0x9edd('0x47')]=function(_0x40e33d,_0x4a89ae){return db[_0x9edd('0x2a')][_0x9edd('0x47')](_0x40e33d[_0x9edd('0x48')],{})[_0x9edd('0x21')](function(_0x1d78c4){var _0x35bdec=_0x40e33d['user'][_0x9edd('0x23')]({'plain':!![]});if(!_0x35bdec)throw new Error(_0x9edd('0x49'));if(_0x35bdec['role']===_0x9edd('0x4a')){var _0x8d8701=_0x1d78c4['get']({'plain':!![]});var _0x2bd089=_0x9edd('0x24');return db[_0x9edd('0x4b')]['find']({'where':{'name':_0x2bd089,'userProfileId':_0x35bdec[_0x9edd('0x4c')]},'raw':!![]})[_0x9edd('0x21')](function(_0x317a60){if(_0x317a60&&_0x317a60[_0x9edd('0x4d')]===0x0){return db['UserProfileResource'][_0x9edd('0x47')]({'name':_0x8d8701[_0x9edd('0x27')],'resourceId':_0x8d8701['id'],'type':_0x317a60[_0x9edd('0x27')],'sectionId':_0x317a60['id']},{})['then'](function(){return _0x1d78c4;});}else{return _0x1d78c4;}})[_0x9edd('0x46')](function(_0x21f6ce){logger['error'](_0x9edd('0x4e'),_0x21f6ce);throw _0x21f6ce;});}return _0x1d78c4;})['then'](respondWithResult(_0x4a89ae,0xc9))[_0x9edd('0x46')](handleError(_0x4a89ae,null));};exports[_0x9edd('0x20')]=function(_0x24245f,_0x3fcdf5){if(_0x24245f[_0x9edd('0x48')]['id']){delete _0x24245f[_0x9edd('0x48')]['id'];}return db[_0x9edd('0x2a')][_0x9edd('0x45')]({'where':{'id':_0x24245f[_0x9edd('0x43')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x3fcdf5,null))[_0x9edd('0x21')](saveUpdates(_0x24245f['body'],null))[_0x9edd('0x21')](respondWithResult(_0x3fcdf5,null))[_0x9edd('0x46')](handleError(_0x3fcdf5,null));};exports[_0x9edd('0x22')]=function(_0x58fe29,_0xe96d6a){return db['ContactItemType']['find']({'where':{'id':_0x58fe29['params']['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0xe96d6a,null))[_0x9edd('0x21')](removeEntity(_0xe96d6a,null))[_0x9edd('0x46')](handleError(_0xe96d6a,null));}; \ No newline at end of file +var _0x00bb=['limit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','ContactItemTypes','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','status','end','json','count','offset','Content-Range','apply','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','ContactItemType','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x55c09c,_0x406cfe){var _0x35c8ed=function(_0x2d3612){while(--_0x2d3612){_0x55c09c['push'](_0x55c09c['shift']());}};_0x35c8ed(++_0x406cfe);}(_0x00bb,0x1d8));var _0xb00b=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x00bb[_0x3ff085];return _0x2b68c3;};'use strict';var pdf=require(_0xb00b('0x0'));var emlformat=require(_0xb00b('0x1'));var rimraf=require(_0xb00b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb00b('0x3'));var rp=require('request-promise');var moment=require(_0xb00b('0x4'));var BPromise=require(_0xb00b('0x5'));var Mustache=require('mustache');var util=require(_0xb00b('0x6'));var path=require(_0xb00b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ff792,_0x2d8ddf){_0x2d8ddf=_0x2d8ddf||0xcc;return function(_0x1be8aa){if(_0x1be8aa){return _0x4ff792[_0xb00b('0x14')](_0x2d8ddf);}return _0x4ff792[_0xb00b('0x15')](_0x2d8ddf)[_0xb00b('0x16')]();};}function respondWithResult(_0x4ada81,_0x218de2){_0x218de2=_0x218de2||0xc8;return function(_0xb0d42e){if(_0xb0d42e){return _0x4ada81['status'](_0x218de2)[_0xb00b('0x17')](_0xb0d42e);}};}function respondWithFilteredResult(_0x1084a6,_0x540b79){return function(_0x5da36b){if(_0x5da36b){var _0x9b471e=_0x5da36b[_0xb00b('0x18')],_0x4dcd45=_0x540b79[_0xb00b('0x19')],_0x51d136=_0x540b79[_0xb00b('0x19')]+_0x540b79['limit'],_0x1f9c78;if(_0x51d136>=_0x9b471e){_0x51d136=_0x9b471e;_0x1f9c78=0xc8;}else{_0x1f9c78=0xce;}_0x1084a6[_0xb00b('0x15')](_0x1f9c78);return _0x1084a6['set'](_0xb00b('0x1a'),_0x4dcd45+'-'+_0x51d136+'/'+_0x9b471e)['json'](_0x5da36b);}return null;};}function patchUpdates(_0x25d7a0){return function(_0x5e8d7b){try{jsonpatch[_0xb00b('0x1b')](_0x5e8d7b,_0x25d7a0,!![]);}catch(_0x3355a3){return BPromise['reject'](_0x3355a3);}return _0x5e8d7b['save']();};}function saveUpdates(_0x2b0da1,_0x4a334b){return function(_0x1344c4){if(_0x1344c4){return _0x1344c4[_0xb00b('0x1c')](_0x2b0da1)[_0xb00b('0x1d')](function(_0x3501af){return _0x3501af;});}return null;};}function removeEntity(_0x56c189,_0x362ee0){return function(_0x4df284){if(_0x4df284){return _0x4df284[_0xb00b('0x1e')]()[_0xb00b('0x1d')](function(){var _0x51b841=_0x4df284[_0xb00b('0x1f')]({'plain':!![]});var _0x2896d1='ContactItemTypes';return db[_0xb00b('0x20')][_0xb00b('0x1e')]({'where':{'type':_0x2896d1,'resourceId':_0x51b841['id']}})['then'](function(){return _0x4df284;});})[_0xb00b('0x1d')](function(){_0x56c189[_0xb00b('0x15')](0xcc)[_0xb00b('0x16')]();});}};}function handleEntityNotFound(_0x8caadf,_0x520e55){return function(_0x50be6c){if(!_0x50be6c){_0x8caadf[_0xb00b('0x14')](0x194);}return _0x50be6c;};}function handleError(_0x490380,_0x550587){_0x550587=_0x550587||0x1f4;return function(_0x4a635e){logger[_0xb00b('0x21')](_0x4a635e[_0xb00b('0x22')]);if(_0x4a635e[_0xb00b('0x23')]){delete _0x4a635e[_0xb00b('0x23')];}_0x490380[_0xb00b('0x15')](_0x550587)[_0xb00b('0x24')](_0x4a635e);};}exports[_0xb00b('0x25')]=function(_0x4a8d2b,_0x22c22d){var _0x503c9c={},_0x450129={},_0x348165={'count':0x0,'rows':[]};var _0x5424ca=_['map'](db[_0xb00b('0x26')][_0xb00b('0x27')],function(_0x16fbd5){return{'name':_0x16fbd5[_0xb00b('0x28')],'type':_0x16fbd5[_0xb00b('0x29')][_0xb00b('0x2a')]};});_0x450129[_0xb00b('0x2b')]=_[_0xb00b('0x2c')](_0x5424ca,_0xb00b('0x23'));_0x450129['query']=_[_0xb00b('0x2d')](_0x4a8d2b[_0xb00b('0x2e')]);_0x450129['filters']=_[_0xb00b('0x2f')](_0x450129[_0xb00b('0x2b')],_0x450129['query']);_0x503c9c[_0xb00b('0x30')]=_['intersection'](_0x450129[_0xb00b('0x2b')],qs[_0xb00b('0x31')](_0x4a8d2b[_0xb00b('0x2e')][_0xb00b('0x31')]));_0x503c9c[_0xb00b('0x30')]=_0x503c9c[_0xb00b('0x30')][_0xb00b('0x32')]?_0x503c9c['attributes']:_0x450129['model'];if(!_0x4a8d2b['query'][_0xb00b('0x33')](_0xb00b('0x34'))){_0x503c9c[_0xb00b('0x35')]=qs[_0xb00b('0x35')](_0x4a8d2b['query'][_0xb00b('0x35')]);_0x503c9c[_0xb00b('0x19')]=qs[_0xb00b('0x19')](_0x4a8d2b[_0xb00b('0x2e')][_0xb00b('0x19')]);}_0x503c9c[_0xb00b('0x36')]=qs[_0xb00b('0x37')](_0x4a8d2b[_0xb00b('0x2e')]['sort']);_0x503c9c['where']=qs[_0xb00b('0x38')](_['pick'](_0x4a8d2b[_0xb00b('0x2e')],_0x450129[_0xb00b('0x38')]),_0x5424ca);if(_0x4a8d2b[_0xb00b('0x2e')][_0xb00b('0x39')]){_0x503c9c[_0xb00b('0x3a')]=_[_0xb00b('0x3b')](_0x503c9c[_0xb00b('0x3a')],{'$or':_['map'](_0x5424ca,function(_0x35f1ca){if(_0x35f1ca[_0xb00b('0x29')]!==_0xb00b('0x3c')){var _0xd9c03f={};_0xd9c03f[_0x35f1ca[_0xb00b('0x23')]]={'$like':'%'+_0x4a8d2b[_0xb00b('0x2e')]['filter']+'%'};return _0xd9c03f;}})});}_0x503c9c=_[_0xb00b('0x3b')]({},_0x503c9c,_0x4a8d2b[_0xb00b('0x3d')]);var _0x4801e7={'where':_0x503c9c[_0xb00b('0x3a')]};return db[_0xb00b('0x26')][_0xb00b('0x18')](_0x4801e7)[_0xb00b('0x1d')](function(_0x2954e8){_0x348165['count']=_0x2954e8;if(_0x4a8d2b[_0xb00b('0x2e')][_0xb00b('0x3e')]){_0x503c9c[_0xb00b('0x3f')]=[{'all':!![]}];}return db[_0xb00b('0x26')]['findAll'](_0x503c9c);})['then'](function(_0x43f834){_0x348165[_0xb00b('0x40')]=_0x43f834;return _0x348165;})[_0xb00b('0x1d')](respondWithFilteredResult(_0x22c22d,_0x503c9c))[_0xb00b('0x41')](handleError(_0x22c22d,null));};exports[_0xb00b('0x42')]=function(_0x26f17b,_0x275664){var _0x493841={'raw':!![],'where':{'id':_0x26f17b[_0xb00b('0x43')]['id']}},_0x36200d={};_0x36200d[_0xb00b('0x2b')]=_[_0xb00b('0x2d')](db[_0xb00b('0x26')][_0xb00b('0x27')]);_0x36200d[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x26f17b[_0xb00b('0x2e')]);_0x36200d[_0xb00b('0x38')]=_[_0xb00b('0x2f')](_0x36200d[_0xb00b('0x2b')],_0x36200d['query']);_0x493841[_0xb00b('0x30')]=_[_0xb00b('0x2f')](_0x36200d[_0xb00b('0x2b')],qs[_0xb00b('0x31')](_0x26f17b[_0xb00b('0x2e')][_0xb00b('0x31')]));_0x493841[_0xb00b('0x30')]=_0x493841[_0xb00b('0x30')][_0xb00b('0x32')]?_0x493841[_0xb00b('0x30')]:_0x36200d[_0xb00b('0x2b')];if(_0x26f17b[_0xb00b('0x2e')]['includeAll']){_0x493841['include']=[{'all':!![]}];}_0x493841=_['merge']({},_0x493841,_0x26f17b[_0xb00b('0x3d')]);return db[_0xb00b('0x26')]['find'](_0x493841)[_0xb00b('0x1d')](handleEntityNotFound(_0x275664,null))[_0xb00b('0x1d')](respondWithResult(_0x275664,null))[_0xb00b('0x41')](handleError(_0x275664,null));};exports[_0xb00b('0x44')]=function(_0x4b62b3,_0x58e9cb){return db[_0xb00b('0x26')][_0xb00b('0x44')](_0x4b62b3['body'],{})['then'](function(_0x154759){var _0x3a205d=_0x4b62b3['user'][_0xb00b('0x1f')]({'plain':!![]});if(!_0x3a205d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a205d['role']==='user'){var _0x465d90=_0x154759['get']({'plain':!![]});var _0x1f7b86=_0xb00b('0x45');return db[_0xb00b('0x46')][_0xb00b('0x47')]({'where':{'name':_0x1f7b86,'userProfileId':_0x3a205d[_0xb00b('0x48')]},'raw':!![]})[_0xb00b('0x1d')](function(_0x4846c9){if(_0x4846c9&&_0x4846c9['autoAssociation']===0x0){return db[_0xb00b('0x20')][_0xb00b('0x44')]({'name':_0x465d90['name'],'resourceId':_0x465d90['id'],'type':_0x4846c9[_0xb00b('0x23')],'sectionId':_0x4846c9['id']},{})[_0xb00b('0x1d')](function(){return _0x154759;});}else{return _0x154759;}})['catch'](function(_0x15dcbf){logger[_0xb00b('0x21')](_0xb00b('0x49'),_0x15dcbf);throw _0x15dcbf;});}return _0x154759;})['then'](respondWithResult(_0x58e9cb,0xc9))['catch'](handleError(_0x58e9cb,null));};exports[_0xb00b('0x1c')]=function(_0x398deb,_0x12737d){if(_0x398deb[_0xb00b('0x4a')]['id']){delete _0x398deb['body']['id'];}return db[_0xb00b('0x26')][_0xb00b('0x47')]({'where':{'id':_0x398deb['params']['id']}})['then'](handleEntityNotFound(_0x12737d,null))[_0xb00b('0x1d')](saveUpdates(_0x398deb['body'],null))[_0xb00b('0x1d')](respondWithResult(_0x12737d,null))[_0xb00b('0x41')](handleError(_0x12737d,null));};exports[_0xb00b('0x1e')]=function(_0x222459,_0x450ce7){return db[_0xb00b('0x26')]['find']({'where':{'id':_0x222459[_0xb00b('0x43')]['id']}})['then'](handleEntityNotFound(_0x450ce7,null))[_0xb00b('0x1d')](removeEntity(_0x450ce7,null))[_0xb00b('0x41')](handleError(_0x450ce7,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 88db98f..00a9abd 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 _0x6132=['ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./contactItemType.attributes','define'];(function(_0x351b46,_0x26b265){var _0x1515df=function(_0x22896a){while(--_0x22896a){_0x351b46['push'](_0x351b46['shift']());}};_0x1515df(++_0x26b265);}(_0x6132,0x13a));var _0x2613=function(_0x5a2e04,_0x572a30){_0x5a2e04=_0x5a2e04-0x0;var _0x29887c=_0x6132[_0x5a2e04];return _0x29887c;};'use strict';var _=require(_0x2613('0x0'));var util=require(_0x2613('0x1'));var logger=require(_0x2613('0x2'))(_0x2613('0x3'));var moment=require('moment');var BPromise=require(_0x2613('0x4'));var rp=require(_0x2613('0x5'));var fs=require('fs');var path=require(_0x2613('0x6'));var rimraf=require(_0x2613('0x7'));var config=require('../../config/environment');var attributes=require(_0x2613('0x8'));module['exports']=function(_0x59240d,_0x30cac4){return _0x59240d[_0x2613('0x9')](_0x2613('0xa'),attributes,{'tableName':_0x2613('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56a6=['path','rimraf','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','request-promise'];(function(_0xb02766,_0xa37d90){var _0x560e6c=function(_0x1ea675){while(--_0x1ea675){_0xb02766['push'](_0xb02766['shift']());}};_0x560e6c(++_0xa37d90);}(_0x56a6,0x17b));var _0x656a=function(_0x52a57b,_0x2a9822){_0x52a57b=_0x52a57b-0x0;var _0x34292d=_0x56a6[_0x52a57b];return _0x34292d;};'use strict';var _=require(_0x656a('0x0'));var util=require(_0x656a('0x1'));var logger=require(_0x656a('0x2'))(_0x656a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x656a('0x4'));var fs=require('fs');var path=require(_0x656a('0x5'));var rimraf=require(_0x656a('0x6'));var config=require('../../config/environment');var attributes=require(_0x656a('0x7'));module[_0x656a('0x8')]=function(_0x1ce536,_0x529aac){return _0x1ce536[_0x656a('0x9')](_0x656a('0xa'),attributes,{'tableName':_0x656a('0xb'),'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 e8e18b5..5e9b407 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 _0x9d02=['rpc','../../config/environment','jayson/promise','request','info','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','code','ContactItemType,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x9d02,0x118));var _0x29d0=function(_0x2cffdc,_0x8e98c2){_0x2cffdc=_0x2cffdc-0x0;var _0xecee38=_0x9d02[_0x2cffdc];return _0xecee38;};'use strict';var _=require(_0x29d0('0x0'));var util=require('util');var moment=require(_0x29d0('0x1'));var BPromise=require('bluebird');var rs=require(_0x29d0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x29d0('0x3'))['db'];var utils=require(_0x29d0('0x4'));var logger=require('../../config/logger')(_0x29d0('0x5'));var config=require(_0x29d0('0x6'));var jayson=require(_0x29d0('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5e35b3,_0x351d26,_0x18a02c){return new BPromise(function(_0x4a4019,_0x402fa6){return client[_0x29d0('0x8')](_0x5e35b3,_0x18a02c)['then'](function(_0x4bc0f9){logger[_0x29d0('0x9')]('ContactItemType,\x20%s,\x20%s',_0x351d26,_0x29d0('0xa'));logger[_0x29d0('0xb')](_0x29d0('0xc'),_0x351d26,_0x29d0('0xa'),JSON['stringify'](_0x4bc0f9));if(_0x4bc0f9['error']){if(_0x4bc0f9[_0x29d0('0xd')][_0x29d0('0xe')]===0x1f4){logger[_0x29d0('0xd')](_0x29d0('0xf'),_0x351d26,_0x4bc0f9[_0x29d0('0xd')][_0x29d0('0x10')]);return _0x402fa6(_0x4bc0f9[_0x29d0('0xd')][_0x29d0('0x10')]);}logger[_0x29d0('0xd')]('ContactItemType,\x20%s,\x20%s',_0x351d26,_0x4bc0f9[_0x29d0('0xd')][_0x29d0('0x10')]);return _0x4a4019(_0x4bc0f9[_0x29d0('0xd')][_0x29d0('0x10')]);}else{logger[_0x29d0('0x9')](_0x29d0('0xf'),_0x351d26,'request\x20sent');_0x4a4019(_0x4bc0f9[_0x29d0('0x11')][_0x29d0('0x10')]);}})[_0x29d0('0x12')](function(_0x49e919){logger[_0x29d0('0xd')](_0x29d0('0xf'),_0x351d26,_0x49e919);_0x402fa6(_0x49e919);});});} \ No newline at end of file +var _0xe3ee=['ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','../../mysqldb','rpc','jayson/promise','client','http','then','ContactItemType,\x20%s,\x20%s','request\x20sent'];(function(_0x602ca8,_0x568e82){var _0x26e8ab=function(_0x3fb700){while(--_0x3fb700){_0x602ca8['push'](_0x602ca8['shift']());}};_0x26e8ab(++_0x568e82);}(_0xe3ee,0x116));var _0xee3e=function(_0x1c4a4c,_0x3535cc){_0x1c4a4c=_0x1c4a4c-0x0;var _0x33a78a=_0xe3ee[_0x1c4a4c];return _0x33a78a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xee3e('0x0'));var BPromise=require(_0xee3e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee3e('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xee3e('0x3'));var config=require('../../config/environment');var jayson=require(_0xee3e('0x4'));var client=jayson[_0xee3e('0x5')][_0xee3e('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xd893ca,_0x42d135,_0x39a770){return new BPromise(function(_0x43ab67,_0x17fba1){return client['request'](_0xd893ca,_0x39a770)[_0xee3e('0x7')](function(_0x2f6153){logger['info'](_0xee3e('0x8'),_0x42d135,_0xee3e('0x9'));logger['debug'](_0xee3e('0xa'),_0x42d135,_0xee3e('0x9'),JSON[_0xee3e('0xb')](_0x2f6153));if(_0x2f6153[_0xee3e('0xc')]){if(_0x2f6153[_0xee3e('0xc')][_0xee3e('0xd')]===0x1f4){logger[_0xee3e('0xc')](_0xee3e('0x8'),_0x42d135,_0x2f6153['error']['message']);return _0x17fba1(_0x2f6153[_0xee3e('0xc')][_0xee3e('0xe')]);}logger['error'](_0xee3e('0x8'),_0x42d135,_0x2f6153[_0xee3e('0xc')][_0xee3e('0xe')]);return _0x43ab67(_0x2f6153['error'][_0xee3e('0xe')]);}else{logger[_0xee3e('0xf')]('ContactItemType,\x20%s,\x20%s',_0x42d135,'request\x20sent');_0x43ab67(_0x2f6153[_0xee3e('0x10')][_0xee3e('0xe')]);}})[_0xee3e('0x11')](function(_0x512609){logger['error']('ContactItemType,\x20%s,\x20%s',_0x42d135,_0x512609);_0x17fba1(_0x512609);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 44b80d4..1d2ed00 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 _0xffba=['delete','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','index','post','create','/:id','isAuthenticated'];(function(_0x11c5b9,_0x52a714){var _0x4c6fd4=function(_0x5d3cef){while(--_0x5d3cef){_0x11c5b9['push'](_0x11c5b9['shift']());}};_0x4c6fd4(++_0x52a714);}(_0xffba,0x182));var _0xaffb=function(_0xbda38b,_0x316f0c){_0xbda38b=_0xbda38b-0x0;var _0xb0a244=_0xffba[_0xbda38b];return _0xb0a244;};'use strict';var multer=require(_0xaffb('0x0'));var util=require('util');var path=require(_0xaffb('0x1'));var timeout=require(_0xaffb('0x2'));var express=require(_0xaffb('0x3'));var router=express['Router']();var auth=require(_0xaffb('0x4'));var interaction=require(_0xaffb('0x5'));var config=require(_0xaffb('0x6'));var controller=require(_0xaffb('0x7'));router[_0xaffb('0x8')]('/',auth['isAuthenticated'](),controller[_0xaffb('0x9')]);router[_0xaffb('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xaffb('0xa')]('/',auth['isAuthenticated'](),controller[_0xaffb('0xb')]);router['put'](_0xaffb('0xc'),auth[_0xaffb('0xd')](),controller['update']);router[_0xaffb('0xe')](_0xaffb('0xc'),auth[_0xaffb('0xd')](),controller[_0xaffb('0xf')]);module['exports']=router; \ No newline at end of file +var _0xeb4f=['put','update','delete','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','/:id','isAuthenticated','show','post','create'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0xeb4f,0xe0));var _0xfeb4=function(_0x5be019,_0x30a956){_0x5be019=_0x5be019-0x0;var _0xe8ecd8=_0xeb4f[_0x5be019];return _0xe8ecd8;};'use strict';var multer=require(_0xfeb4('0x0'));var util=require(_0xfeb4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfeb4('0x2'));var router=express[_0xfeb4('0x3')]();var auth=require(_0xfeb4('0x4'));var interaction=require(_0xfeb4('0x5'));var config=require(_0xfeb4('0x6'));var controller=require(_0xfeb4('0x7'));router[_0xfeb4('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfeb4('0x8')](_0xfeb4('0x9'),auth[_0xfeb4('0xa')](),controller[_0xfeb4('0xb')]);router[_0xfeb4('0xc')]('/',auth['isAuthenticated'](),controller[_0xfeb4('0xd')]);router[_0xfeb4('0xe')](_0xfeb4('0x9'),auth[_0xfeb4('0xa')](),controller[_0xfeb4('0xf')]);router[_0xfeb4('0x10')](_0xfeb4('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 58cd27e..2d32471 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 _0x20fe=['exports','name','sequelize'];(function(_0x3d7194,_0x9a532e){var _0x2d0081=function(_0x2d7ffb){while(--_0x2d7ffb){_0x3d7194['push'](_0x3d7194['shift']());}};_0x2d0081(++_0x9a532e);}(_0x20fe,0xb3));var _0xe20f=function(_0x5b0fd7,_0x5de27a){_0x5b0fd7=_0x5b0fd7-0x0;var _0x395b2e=_0x20fe[_0x5b0fd7];return _0x395b2e;};'use strict';var Sequelize=require(_0xe20f('0x0'));module[_0xe20f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe20f('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x29eb=['sequelize','exports','STRING'];(function(_0x4f35ec,_0x840f6e){var _0x111757=function(_0x107271){while(--_0x107271){_0x4f35ec['push'](_0x4f35ec['shift']());}};_0x111757(++_0x840f6e);}(_0x29eb,0x1c5));var _0xb29e=function(_0x352b95,_0x446776){_0x352b95=_0x352b95-0x0;var _0x3efbf5=_0x29eb[_0x352b95];return _0x3efbf5;};'use strict';var Sequelize=require(_0xb29e('0x0'));module[_0xb29e('0x1')]={'name':{'type':Sequelize[_0xb29e('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0xb29e('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 2b44f1b..612f21e 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 _0x9d44=['userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','body','updatedAt','iframe','attrUrl','attrs','https://','custom','attrPath','value','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','addItem','DashboardId','DashboardItem','getItems','pick','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','limit','set','reject','save','update','destroy','then','get','CustomDashboards','error','stack','name','send','index','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x1867e3,_0x30e5ce){var _0x494e32=function(_0x2a9446){while(--_0x2a9446){_0x1867e3['push'](_0x1867e3['shift']());}};_0x494e32(++_0x30e5ce);}(_0x9d44,0xa2));var _0x49d4=function(_0x20ae2f,_0x455457){_0x20ae2f=_0x20ae2f-0x0;var _0x47adce=_0x9d44[_0x20ae2f];return _0x47adce;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x49d4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x49d4('0x1'));var jsonpatch=require(_0x49d4('0x2'));var rp=require(_0x49d4('0x3'));var moment=require(_0x49d4('0x4'));var BPromise=require(_0x49d4('0x5'));var Mustache=require(_0x49d4('0x6'));var util=require(_0x49d4('0x7'));var path=require(_0x49d4('0x8'));var sox=require(_0x49d4('0x9'));var csv=require(_0x49d4('0xa'));var ejs=require(_0x49d4('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x49d4('0xc'));var crypto=require(_0x49d4('0xd'));var jsforce=require(_0x49d4('0xe'));var deskjs=require(_0x49d4('0xf'));var toCsv=require(_0x49d4('0xa'));var querystring=require('querystring');var Papa=require(_0x49d4('0x10'));var Redis=require(_0x49d4('0x11'));var authService=require(_0x49d4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x49d4('0x13'));var hardwareService=require(_0x49d4('0x14'));var logger=require(_0x49d4('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x49d4('0x16'));var db=require(_0x49d4('0x17'))['db'];config['redis']=_['defaults'](config[_0x49d4('0x18')],{'host':_0x49d4('0x19'),'port':0x18eb});var socket=require(_0x49d4('0x1a'))(new Redis(config['redis']));require(_0x49d4('0x1b'))[_0x49d4('0x1c')](socket);function respondWithStatusCode(_0x456de7,_0x102f29){_0x102f29=_0x102f29||0xcc;return function(_0x253393){if(_0x253393){return _0x456de7[_0x49d4('0x1d')](_0x102f29);}return _0x456de7[_0x49d4('0x1e')](_0x102f29)[_0x49d4('0x1f')]();};}function respondWithResult(_0x20a08c,_0x571b98){_0x571b98=_0x571b98||0xc8;return function(_0x268410){if(_0x268410){return _0x20a08c['status'](_0x571b98)[_0x49d4('0x20')](_0x268410);}};}function respondWithFilteredResult(_0xa322e6,_0x6bc12c){return function(_0x4d396c){if(_0x4d396c){var _0xe3ee1d=_0x4d396c['count'],_0x11611d=_0x6bc12c[_0x49d4('0x21')],_0x49bb48=_0x6bc12c[_0x49d4('0x21')]+_0x6bc12c[_0x49d4('0x22')],_0x23a3c2;if(_0x49bb48>=_0xe3ee1d){_0x49bb48=_0xe3ee1d;_0x23a3c2=0xc8;}else{_0x23a3c2=0xce;}_0xa322e6[_0x49d4('0x1e')](_0x23a3c2);return _0xa322e6[_0x49d4('0x23')]('Content-Range',_0x11611d+'-'+_0x49bb48+'/'+_0xe3ee1d)['json'](_0x4d396c);}return null;};}function patchUpdates(_0x34e52){return function(_0x2e4cfd){try{jsonpatch['apply'](_0x2e4cfd,_0x34e52,!![]);}catch(_0x25d6b3){return BPromise[_0x49d4('0x24')](_0x25d6b3);}return _0x2e4cfd[_0x49d4('0x25')]();};}function saveUpdates(_0x3a1ace,_0x3408c5){return function(_0x26b430){if(_0x26b430){return _0x26b430[_0x49d4('0x26')](_0x3a1ace)['then'](function(_0x38d8a0){return _0x38d8a0;});}return null;};}function removeEntity(_0x3c5a29,_0x5beea4){return function(_0x53b971){if(_0x53b971){return _0x53b971[_0x49d4('0x27')]()[_0x49d4('0x28')](function(){var _0x3a7cf3=_0x53b971[_0x49d4('0x29')]({'plain':!![]});var _0x444b84=_0x49d4('0x2a');return db['UserProfileResource'][_0x49d4('0x27')]({'where':{'type':_0x444b84,'resourceId':_0x3a7cf3['id']}})['then'](function(){return _0x53b971;});})['then'](function(){_0x3c5a29[_0x49d4('0x1e')](0xcc)[_0x49d4('0x1f')]();});}};}function handleEntityNotFound(_0x2ef3e4,_0x5846ea){return function(_0x46ee5e){if(!_0x46ee5e){_0x2ef3e4['sendStatus'](0x194);}return _0x46ee5e;};}function handleError(_0x1a7843,_0x12b370){_0x12b370=_0x12b370||0x1f4;return function(_0x356053){logger[_0x49d4('0x2b')](_0x356053[_0x49d4('0x2c')]);if(_0x356053[_0x49d4('0x2d')]){delete _0x356053[_0x49d4('0x2d')];}_0x1a7843[_0x49d4('0x1e')](_0x12b370)[_0x49d4('0x2e')](_0x356053);};}exports[_0x49d4('0x2f')]=function(_0x62a582,_0xaffba){var _0x159031={},_0x5c303f={},_0x140559={'count':0x0,'rows':[]};var _0x470836=_['map'](db[_0x49d4('0x30')][_0x49d4('0x31')],function(_0x4bafd9){return{'name':_0x4bafd9[_0x49d4('0x32')],'type':_0x4bafd9[_0x49d4('0x33')][_0x49d4('0x34')]};});_0x5c303f[_0x49d4('0x35')]=_['map'](_0x470836,_0x49d4('0x2d'));_0x5c303f[_0x49d4('0x36')]=_[_0x49d4('0x37')](_0x62a582[_0x49d4('0x36')]);_0x5c303f[_0x49d4('0x38')]=_[_0x49d4('0x39')](_0x5c303f['model'],_0x5c303f[_0x49d4('0x36')]);_0x159031['attributes']=_[_0x49d4('0x39')](_0x5c303f[_0x49d4('0x35')],qs['fields'](_0x62a582[_0x49d4('0x36')][_0x49d4('0x3a')]));_0x159031['attributes']=_0x159031[_0x49d4('0x3b')][_0x49d4('0x3c')]?_0x159031[_0x49d4('0x3b')]:_0x5c303f[_0x49d4('0x35')];if(!_0x62a582[_0x49d4('0x36')][_0x49d4('0x3d')](_0x49d4('0x3e'))){_0x159031[_0x49d4('0x22')]=qs[_0x49d4('0x22')](_0x62a582['query'][_0x49d4('0x22')]);_0x159031[_0x49d4('0x21')]=qs[_0x49d4('0x21')](_0x62a582[_0x49d4('0x36')]['offset']);}_0x159031[_0x49d4('0x3f')]=qs[_0x49d4('0x40')](_0x62a582[_0x49d4('0x36')][_0x49d4('0x40')]);_0x159031[_0x49d4('0x41')]=qs[_0x49d4('0x38')](_['pick'](_0x62a582[_0x49d4('0x36')],_0x5c303f[_0x49d4('0x38')]),_0x470836);if(_0x62a582['query'][_0x49d4('0x42')]){_0x159031[_0x49d4('0x41')]=_['merge'](_0x159031['where'],{'$or':_['map'](_0x470836,function(_0x247d74){if(_0x247d74['type']!==_0x49d4('0x43')){var _0x79c382={};_0x79c382[_0x247d74['name']]={'$like':'%'+_0x62a582[_0x49d4('0x36')][_0x49d4('0x42')]+'%'};return _0x79c382;}})});}_0x159031=_[_0x49d4('0x44')]({},_0x159031,_0x62a582[_0x49d4('0x45')]);var _0x4d05a3={'where':_0x159031[_0x49d4('0x41')]};return db['Dashboard'][_0x49d4('0x46')](_0x4d05a3)[_0x49d4('0x28')](function(_0x467c9f){_0x140559['count']=_0x467c9f;if(_0x62a582[_0x49d4('0x36')][_0x49d4('0x47')]){_0x159031[_0x49d4('0x48')]=[{'all':!![]}];}return db['Dashboard'][_0x49d4('0x49')](_0x159031);})[_0x49d4('0x28')](function(_0x4f6cef){_0x140559[_0x49d4('0x4a')]=_0x4f6cef;return _0x140559;})[_0x49d4('0x28')](respondWithFilteredResult(_0xaffba,_0x159031))['catch'](handleError(_0xaffba,null));};exports[_0x49d4('0x4b')]=function(_0xffd3ea,_0x1c9854){var _0x275cff={'raw':![],'where':{'id':_0xffd3ea[_0x49d4('0x4c')]['id']}},_0x42b846={};_0x42b846[_0x49d4('0x35')]=_[_0x49d4('0x37')](db[_0x49d4('0x30')]['rawAttributes']);_0x42b846[_0x49d4('0x36')]=_[_0x49d4('0x37')](_0xffd3ea[_0x49d4('0x36')]);_0x42b846[_0x49d4('0x38')]=_[_0x49d4('0x39')](_0x42b846['model'],_0x42b846[_0x49d4('0x36')]);_0x275cff[_0x49d4('0x3b')]=_[_0x49d4('0x39')](_0x42b846[_0x49d4('0x35')],qs[_0x49d4('0x3a')](_0xffd3ea['query'][_0x49d4('0x3a')]));_0x275cff['attributes']=_0x275cff[_0x49d4('0x3b')][_0x49d4('0x3c')]?_0x275cff['attributes']:_0x42b846['model'];if(_0xffd3ea[_0x49d4('0x36')]['includeAll']){_0x275cff[_0x49d4('0x48')]=[{'all':!![]}];}_0x275cff=_[_0x49d4('0x44')]({},_0x275cff,_0xffd3ea[_0x49d4('0x45')]);return db[_0x49d4('0x30')][_0x49d4('0x4d')](_0x275cff)['then'](handleEntityNotFound(_0x1c9854,null))[_0x49d4('0x28')](respondWithResult(_0x1c9854,null))[_0x49d4('0x4e')](handleError(_0x1c9854,null));};exports['create']=function(_0xe65f24,_0x4889a9){return db['Dashboard'][_0x49d4('0x4f')](_0xe65f24['body'],{})['then'](function(_0x23efea){var _0x439460=_0xe65f24[_0x49d4('0x50')][_0x49d4('0x29')]({'plain':!![]});if(!_0x439460)throw new Error(_0x49d4('0x51'));if(_0x439460[_0x49d4('0x52')]===_0x49d4('0x50')){var _0x47ddea=_0x23efea[_0x49d4('0x29')]({'plain':!![]});var _0x586e96=_0x49d4('0x2a');return db[_0x49d4('0x53')][_0x49d4('0x4d')]({'where':{'name':_0x586e96,'userProfileId':_0x439460[_0x49d4('0x54')]},'raw':!![]})[_0x49d4('0x28')](function(_0x3da6a7){if(_0x3da6a7&&_0x3da6a7[_0x49d4('0x55')]===0x0){return db[_0x49d4('0x56')][_0x49d4('0x4f')]({'name':_0x47ddea[_0x49d4('0x2d')],'resourceId':_0x47ddea['id'],'type':_0x3da6a7[_0x49d4('0x2d')],'sectionId':_0x3da6a7['id']},{})[_0x49d4('0x28')](function(){return _0x23efea;});}else{return _0x23efea;}})[_0x49d4('0x4e')](function(_0x146c7d){logger[_0x49d4('0x2b')](_0x49d4('0x57'),_0x146c7d);throw _0x146c7d;});}return _0x23efea;})['then'](respondWithResult(_0x4889a9,0xc9))[_0x49d4('0x4e')](handleError(_0x4889a9,null));};exports[_0x49d4('0x58')]=function(_0x2cadd6,_0xd241bb){var _0x757658={'where':{'id':_0x2cadd6[_0x49d4('0x4c')]['id']}},_0x3d5e29={};_0x3d5e29[_0x49d4('0x35')]=_[_0x49d4('0x37')](db['Dashboard'][_0x49d4('0x31')]);_0x757658[_0x49d4('0x3b')]=_['intersection'](_0x3d5e29[_0x49d4('0x35')],qs[_0x49d4('0x3a')](_0x2cadd6[_0x49d4('0x36')]['fields']));_0x757658['attributes']=_0x757658[_0x49d4('0x3b')][_0x49d4('0x3c')]?_0x757658[_0x49d4('0x3b')]:_0x3d5e29[_0x49d4('0x35')];if(_0x2cadd6[_0x49d4('0x36')][_0x49d4('0x47')]){_0x757658[_0x49d4('0x48')]=[{'all':!![]}];}_0x757658=_[_0x49d4('0x44')]({},_0x757658,_0x2cadd6[_0x49d4('0x45')]);return db[_0x49d4('0x30')][_0x49d4('0x4d')](_0x757658)[_0x49d4('0x28')](handleEntityNotFound(_0xd241bb,null))[_0x49d4('0x28')](function(_0x21db3f){if(_0x21db3f){var _0x33c16d=_0x21db3f['get']({'plain':!![]});_0x33c16d=qs[_0x49d4('0x59')](_0x33c16d,['id',_0x49d4('0x5a'),'updatedAt']);_0x2cadd6[_0x49d4('0x5b')]=_[_0x49d4('0x59')](_0x2cadd6['body'],['id',_0x49d4('0x5a'),_0x49d4('0x5c')]);return db[_0x49d4('0x30')][_0x49d4('0x4f')](_[_0x49d4('0x44')](_0x33c16d,_0x2cadd6[_0x49d4('0x5b')]),{'include':_0x2cadd6[_0x49d4('0x36')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x3a4f7b){var _0x53bd64=_0x2cadd6[_0x49d4('0x50')]['get']({'plain':!![]});if(!_0x53bd64)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x53bd64[_0x49d4('0x52')]===_0x49d4('0x50')){var _0x584d97=_0x3a4f7b['get']({'plain':!![]});var _0x5e9ccd=_0x49d4('0x2a');return db[_0x49d4('0x53')][_0x49d4('0x4d')]({'where':{'name':_0x5e9ccd,'userProfileId':_0x53bd64['userProfileId']},'raw':!![]})['then'](function(_0x22df25){if(_0x22df25&&_0x22df25[_0x49d4('0x55')]===0x0){return db[_0x49d4('0x56')][_0x49d4('0x4f')]({'name':_0x584d97['name'],'resourceId':_0x584d97['id'],'type':_0x22df25['name'],'sectionId':_0x22df25['id']},{})[_0x49d4('0x28')](function(){return _0x3a4f7b;});}else{return _0x3a4f7b;}})['catch'](function(_0x1a3afe){logger[_0x49d4('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a3afe);throw _0x1a3afe;});}return _0x3a4f7b;});}})[_0x49d4('0x28')](respondWithResult(_0xd241bb,0xc9))[_0x49d4('0x4e')](handleError(_0xd241bb,null));};exports[_0x49d4('0x26')]=function(_0x464bf5,_0x4f7b12){if(_0x464bf5['body']['id']){delete _0x464bf5[_0x49d4('0x5b')]['id'];}return db[_0x49d4('0x30')][_0x49d4('0x4d')]({'where':{'id':_0x464bf5[_0x49d4('0x4c')]['id']}})[_0x49d4('0x28')](handleEntityNotFound(_0x4f7b12,null))[_0x49d4('0x28')](saveUpdates(_0x464bf5[_0x49d4('0x5b')],null))['then'](respondWithResult(_0x4f7b12,null))[_0x49d4('0x4e')](handleError(_0x4f7b12,null));};exports[_0x49d4('0x27')]=function(_0x113511,_0xaf2309){return db[_0x49d4('0x30')][_0x49d4('0x4d')]({'where':{'id':_0x113511['params']['id']}})[_0x49d4('0x28')](handleEntityNotFound(_0xaf2309,null))[_0x49d4('0x28')](removeEntity(_0xaf2309,null))[_0x49d4('0x4e')](handleError(_0xaf2309,null));};function widgetAttributes(_0x48c18a){try{switch(_0x48c18a[_0x49d4('0x33')]){case _0x49d4('0x5d'):return[{'name':'attrUrl','value':_0x48c18a[_0x49d4('0x5e')]||(_0x48c18a[_0x49d4('0x5f')]&&_0x48c18a[_0x49d4('0x5f')][0x0]?_0x48c18a[_0x49d4('0x5f')][0x0]['value']:undefined)||_0x49d4('0x60')}];case _0x49d4('0x61'):return[{'name':'attrPath','value':_0x48c18a[_0x49d4('0x62')]||(_0x48c18a[_0x49d4('0x5f')]&&_0x48c18a[_0x49d4('0x5f')][0x0]?_0x48c18a[_0x49d4('0x5f')][0x0][_0x49d4('0x63')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x48c18a[_0x49d4('0x64')]||(_0x48c18a['attrs']&&_0x48c18a['attrs'][0x0]?_0x48c18a['attrs'][0x0]['value']:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x48c18a[_0x49d4('0x65')]||(_0x48c18a[_0x49d4('0x5f')]&&_0x48c18a[_0x49d4('0x5f')][0x1]?_0x48c18a[_0x49d4('0x5f')][0x1][_0x49d4('0x63')]:undefined)||_0x49d4('0x66')},{'name':_0x49d4('0x67'),'value':_0x48c18a[_0x49d4('0x67')]||(_0x48c18a[_0x49d4('0x5f')]&&_0x48c18a[_0x49d4('0x5f')][0x2]?_0x48c18a[_0x49d4('0x5f')][0x2]['value']:undefined)||0xc}];case _0x49d4('0x68'):return[{'name':'attrMetric','value':_0x48c18a[_0x49d4('0x69')]||(_0x48c18a[_0x49d4('0x5f')]&&_0x48c18a[_0x49d4('0x5f')][0x0]?_0x48c18a[_0x49d4('0x5f')][0x0][_0x49d4('0x63')]:undefined)||'total'},{'name':_0x49d4('0x6a'),'value':_0x48c18a[_0x49d4('0x6a')]||(_0x48c18a[_0x49d4('0x5f')]&&_0x48c18a[_0x49d4('0x5f')][0x1]?_0x48c18a['attrs'][0x1][_0x49d4('0x63')]:undefined)||[]},{'name':'attrFontSize','value':_0x48c18a[_0x49d4('0x67')]||(_0x48c18a[_0x49d4('0x5f')]&&_0x48c18a[_0x49d4('0x5f')][0x2]?_0x48c18a[_0x49d4('0x5f')][0x2]['value']:undefined)||0x14}];case _0x49d4('0x6b'):case _0x49d4('0x6c'):return[{'name':_0x49d4('0x6d'),'value':_0x48c18a['attrSerie1']||(_0x48c18a[_0x49d4('0x5f')]&&_0x48c18a[_0x49d4('0x5f')][0x0]?_0x48c18a[_0x49d4('0x5f')][0x0]['value']:undefined)||_0x49d4('0x6e')},{'name':_0x49d4('0x6f'),'value':_0x48c18a[_0x49d4('0x6f')]||(_0x48c18a[_0x49d4('0x5f')]&&_0x48c18a[_0x49d4('0x5f')][0x1]?_0x48c18a[_0x49d4('0x5f')][0x1][_0x49d4('0x63')]:undefined)||null},{'name':_0x49d4('0x70'),'value':_0x48c18a[_0x49d4('0x70')]||(_0x48c18a['attrs']&&_0x48c18a['attrs'][0x2]?_0x48c18a[_0x49d4('0x5f')][0x2][_0x49d4('0x63')]:undefined)||null},{'name':_0x49d4('0x6a'),'value':_0x48c18a[_0x49d4('0x6a')]||(_0x48c18a[_0x49d4('0x5f')]&&_0x48c18a[_0x49d4('0x5f')][0x3]?_0x48c18a['attrs'][0x3][_0x49d4('0x63')]:undefined)||[]}];case _0x49d4('0x71'):return[{'name':_0x49d4('0x72'),'type':_0x48c18a[_0x49d4('0x73')]||(_0x48c18a[_0x49d4('0x5f')]&&_0x48c18a['attrs'][0x0]?_0x48c18a['attrs'][0x0][_0x49d4('0x33')]:undefined)||null,'value':_0x48c18a[_0x49d4('0x72')]||(_0x48c18a[_0x49d4('0x5f')]&&_0x48c18a['attrs'][0x0]?_0x48c18a['attrs'][0x0][_0x49d4('0x63')]:undefined)||null},{'name':'attrRefresh','value':_0x48c18a[_0x49d4('0x74')]||(_0x48c18a[_0x49d4('0x5f')]&&_0x48c18a[_0x49d4('0x5f')][0x1]?_0x48c18a[_0x49d4('0x5f')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x582e12){logger[_0x49d4('0x2b')]('widgetAttributes:\x20%s',JSON[_0x49d4('0x75')](_0x582e12));return[];}}exports[_0x49d4('0x76')]=function(_0x505102,_0x337802,_0x5ad500){if(_0x505102['body']['id']){delete _0x505102['body']['id'];}return db[_0x49d4('0x30')]['find']({'where':{'id':_0x505102[_0x49d4('0x4c')]['id']}})[_0x49d4('0x28')](handleEntityNotFound(_0x337802,null))[_0x49d4('0x28')](function(_0x57ed89){if(_0x57ed89){_0x505102[_0x49d4('0x5b')][_0x49d4('0x77')]=_0x57ed89['id'];_0x505102[_0x49d4('0x5b')]['attrs']=widgetAttributes(_0x505102[_0x49d4('0x5b')]);return db[_0x49d4('0x78')]['create'](_0x505102[_0x49d4('0x5b')]);}})['then'](respondWithResult(_0x337802,null))['catch'](handleError(_0x337802,null));};exports[_0x49d4('0x79')]=function(_0x3b94ac,_0x162e37,_0x2c9d36){var _0x5c7a6d={};var _0x7f2e3a={};var _0x1957c2;var _0x3b7b87;return db[_0x49d4('0x30')]['findOne']({'where':{'id':_0x3b94ac[_0x49d4('0x4c')]['id']}})[_0x49d4('0x28')](handleEntityNotFound(_0x162e37,null))['then'](function(_0x2d8dea){if(_0x2d8dea){_0x1957c2=_0x2d8dea;_0x7f2e3a[_0x49d4('0x35')]=_['keys'](db[_0x49d4('0x78')][_0x49d4('0x31')]);_0x7f2e3a['query']=_[_0x49d4('0x37')](_0x3b94ac[_0x49d4('0x36')]);_0x7f2e3a['filters']=_[_0x49d4('0x39')](_0x7f2e3a['model'],_0x7f2e3a['query']);_0x5c7a6d['attributes']=_[_0x49d4('0x39')](_0x7f2e3a[_0x49d4('0x35')],qs[_0x49d4('0x3a')](_0x3b94ac['query'][_0x49d4('0x3a')]));_0x5c7a6d[_0x49d4('0x3b')]=_0x5c7a6d[_0x49d4('0x3b')]['length']?_0x5c7a6d[_0x49d4('0x3b')]:_0x7f2e3a[_0x49d4('0x35')];_0x5c7a6d[_0x49d4('0x3f')]=qs[_0x49d4('0x40')](_0x3b94ac[_0x49d4('0x36')][_0x49d4('0x40')]);_0x5c7a6d['where']=qs[_0x49d4('0x38')](_[_0x49d4('0x7a')](_0x3b94ac[_0x49d4('0x36')],_0x7f2e3a[_0x49d4('0x38')]));if(_0x3b94ac[_0x49d4('0x36')][_0x49d4('0x42')]){_0x5c7a6d[_0x49d4('0x41')]=_[_0x49d4('0x44')](_0x5c7a6d[_0x49d4('0x41')],{'$or':_['map'](_0x5c7a6d[_0x49d4('0x3b')],function(_0x465ec2){var _0x4d9372={};_0x4d9372[_0x465ec2]={'$like':'%'+_0x3b94ac[_0x49d4('0x36')][_0x49d4('0x42')]+'%'};return _0x4d9372;})});}_0x5c7a6d=_['merge']({},_0x5c7a6d,_0x3b94ac[_0x49d4('0x45')]);return _0x1957c2[_0x49d4('0x79')](_0x5c7a6d);}})['then'](function(_0x54b787){if(_0x54b787){_0x3b7b87=_0x54b787['length'];if(!_0x3b94ac[_0x49d4('0x36')][_0x49d4('0x3d')](_0x49d4('0x3e'))){_0x5c7a6d[_0x49d4('0x22')]=qs[_0x49d4('0x22')](_0x3b94ac[_0x49d4('0x36')][_0x49d4('0x22')]);_0x5c7a6d[_0x49d4('0x21')]=qs['offset'](_0x3b94ac['query'][_0x49d4('0x21')]);}return _0x1957c2[_0x49d4('0x79')](_0x5c7a6d);}})[_0x49d4('0x28')](function(_0x413eb9){if(_0x413eb9){return _0x413eb9?{'count':_0x3b7b87,'rows':_0x413eb9}:null;}})[_0x49d4('0x28')](respondWithResult(_0x162e37,null))['catch'](handleError(_0x162e37,null));}; \ No newline at end of file +var _0x8f90=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','stack','name','send','map','Dashboard','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','role','error','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','DashboardId','DashboardItem','findOne','order','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x310239,_0x3ac670){var _0x31e0ae=function(_0x4d6055){while(--_0x4d6055){_0x310239['push'](_0x310239['shift']());}};_0x31e0ae(++_0x3ac670);}(_0x8f90,0x1d5));var _0x08f9=function(_0x189c9e,_0x1c3b55){_0x189c9e=_0x189c9e-0x0;var _0x3f38ca=_0x8f90[_0x189c9e];return _0x3f38ca;};'use strict';var pdf=require(_0x08f9('0x0'));var emlformat=require(_0x08f9('0x1'));var rimraf=require(_0x08f9('0x2'));var zipdir=require(_0x08f9('0x3'));var jsonpatch=require(_0x08f9('0x4'));var rp=require('request-promise');var moment=require(_0x08f9('0x5'));var BPromise=require(_0x08f9('0x6'));var Mustache=require(_0x08f9('0x7'));var util=require(_0x08f9('0x8'));var path=require(_0x08f9('0x9'));var sox=require(_0x08f9('0xa'));var csv=require(_0x08f9('0xb'));var ejs=require(_0x08f9('0xc'));var fs=require('fs');var _=require(_0x08f9('0xd'));var squel=require(_0x08f9('0xe'));var crypto=require(_0x08f9('0xf'));var jsforce=require(_0x08f9('0x10'));var deskjs=require(_0x08f9('0x11'));var toCsv=require(_0x08f9('0xb'));var querystring=require(_0x08f9('0x12'));var Papa=require(_0x08f9('0x13'));var Redis=require(_0x08f9('0x14'));var authService=require(_0x08f9('0x15'));var qs=require(_0x08f9('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x08f9('0x17'));var logger=require(_0x08f9('0x18'))(_0x08f9('0x19'));var utils=require(_0x08f9('0x1a'));var config=require(_0x08f9('0x1b'));var db=require(_0x08f9('0x1c'))['db'];config['redis']=_['defaults'](config[_0x08f9('0x1d')],{'host':_0x08f9('0x1e'),'port':0x18eb});var socket=require(_0x08f9('0x1f'))(new Redis(config[_0x08f9('0x1d')]));require(_0x08f9('0x20'))[_0x08f9('0x21')](socket);function respondWithStatusCode(_0x3053bd,_0x4b8fb9){_0x4b8fb9=_0x4b8fb9||0xcc;return function(_0x9c5f72){if(_0x9c5f72){return _0x3053bd[_0x08f9('0x22')](_0x4b8fb9);}return _0x3053bd[_0x08f9('0x23')](_0x4b8fb9)[_0x08f9('0x24')]();};}function respondWithResult(_0xc48899,_0x1fb408){_0x1fb408=_0x1fb408||0xc8;return function(_0x11f45b){if(_0x11f45b){return _0xc48899['status'](_0x1fb408)[_0x08f9('0x25')](_0x11f45b);}};}function respondWithFilteredResult(_0x22f61b,_0x77d645){return function(_0x2e4ff3){if(_0x2e4ff3){var _0x235c64=_0x2e4ff3[_0x08f9('0x26')],_0x37144e=_0x77d645[_0x08f9('0x27')],_0x1bcda4=_0x77d645[_0x08f9('0x27')]+_0x77d645[_0x08f9('0x28')],_0x447c6c;if(_0x1bcda4>=_0x235c64){_0x1bcda4=_0x235c64;_0x447c6c=0xc8;}else{_0x447c6c=0xce;}_0x22f61b[_0x08f9('0x23')](_0x447c6c);return _0x22f61b['set'](_0x08f9('0x29'),_0x37144e+'-'+_0x1bcda4+'/'+_0x235c64)[_0x08f9('0x25')](_0x2e4ff3);}return null;};}function patchUpdates(_0x55f3df){return function(_0x4dfcd6){try{jsonpatch['apply'](_0x4dfcd6,_0x55f3df,!![]);}catch(_0x228946){return BPromise[_0x08f9('0x2a')](_0x228946);}return _0x4dfcd6[_0x08f9('0x2b')]();};}function saveUpdates(_0x2c9280,_0x43a1f1){return function(_0x5d55ca){if(_0x5d55ca){return _0x5d55ca[_0x08f9('0x2c')](_0x2c9280)[_0x08f9('0x2d')](function(_0x3800fc){return _0x3800fc;});}return null;};}function removeEntity(_0x5331fe,_0x13dcd0){return function(_0x5535cf){if(_0x5535cf){return _0x5535cf[_0x08f9('0x2e')]()[_0x08f9('0x2d')](function(){var _0x44e351=_0x5535cf[_0x08f9('0x2f')]({'plain':!![]});var _0x3d6248=_0x08f9('0x30');return db[_0x08f9('0x31')][_0x08f9('0x2e')]({'where':{'type':_0x3d6248,'resourceId':_0x44e351['id']}})[_0x08f9('0x2d')](function(){return _0x5535cf;});})[_0x08f9('0x2d')](function(){_0x5331fe[_0x08f9('0x23')](0xcc)[_0x08f9('0x24')]();});}};}function handleEntityNotFound(_0x35e538,_0x527330){return function(_0x460fac){if(!_0x460fac){_0x35e538[_0x08f9('0x22')](0x194);}return _0x460fac;};}function handleError(_0x285540,_0x7d95f9){_0x7d95f9=_0x7d95f9||0x1f4;return function(_0x1645c0){logger['error'](_0x1645c0[_0x08f9('0x32')]);if(_0x1645c0[_0x08f9('0x33')]){delete _0x1645c0[_0x08f9('0x33')];}_0x285540[_0x08f9('0x23')](_0x7d95f9)[_0x08f9('0x34')](_0x1645c0);};}exports['index']=function(_0x14517d,_0x79978a){var _0x2dec36={},_0x2bceb1={},_0x5e8336={'count':0x0,'rows':[]};var _0x5c3f18=_[_0x08f9('0x35')](db[_0x08f9('0x36')]['rawAttributes'],function(_0x58bc96){return{'name':_0x58bc96['fieldName'],'type':_0x58bc96['type'][_0x08f9('0x37')]};});_0x2bceb1['model']=_['map'](_0x5c3f18,'name');_0x2bceb1[_0x08f9('0x38')]=_[_0x08f9('0x39')](_0x14517d['query']);_0x2bceb1[_0x08f9('0x3a')]=_[_0x08f9('0x3b')](_0x2bceb1[_0x08f9('0x3c')],_0x2bceb1[_0x08f9('0x38')]);_0x2dec36[_0x08f9('0x3d')]=_[_0x08f9('0x3b')](_0x2bceb1[_0x08f9('0x3c')],qs[_0x08f9('0x3e')](_0x14517d[_0x08f9('0x38')][_0x08f9('0x3e')]));_0x2dec36[_0x08f9('0x3d')]=_0x2dec36[_0x08f9('0x3d')][_0x08f9('0x3f')]?_0x2dec36[_0x08f9('0x3d')]:_0x2bceb1[_0x08f9('0x3c')];if(!_0x14517d[_0x08f9('0x38')][_0x08f9('0x40')](_0x08f9('0x41'))){_0x2dec36[_0x08f9('0x28')]=qs[_0x08f9('0x28')](_0x14517d[_0x08f9('0x38')][_0x08f9('0x28')]);_0x2dec36[_0x08f9('0x27')]=qs['offset'](_0x14517d[_0x08f9('0x38')][_0x08f9('0x27')]);}_0x2dec36['order']=qs['sort'](_0x14517d[_0x08f9('0x38')][_0x08f9('0x42')]);_0x2dec36[_0x08f9('0x43')]=qs[_0x08f9('0x3a')](_[_0x08f9('0x44')](_0x14517d[_0x08f9('0x38')],_0x2bceb1[_0x08f9('0x3a')]),_0x5c3f18);if(_0x14517d['query'][_0x08f9('0x45')]){_0x2dec36[_0x08f9('0x43')]=_[_0x08f9('0x46')](_0x2dec36[_0x08f9('0x43')],{'$or':_['map'](_0x5c3f18,function(_0x54cab5){if(_0x54cab5[_0x08f9('0x47')]!==_0x08f9('0x48')){var _0x46eda4={};_0x46eda4[_0x54cab5[_0x08f9('0x33')]]={'$like':'%'+_0x14517d[_0x08f9('0x38')][_0x08f9('0x45')]+'%'};return _0x46eda4;}})});}_0x2dec36=_['merge']({},_0x2dec36,_0x14517d['options']);var _0x2b3e03={'where':_0x2dec36[_0x08f9('0x43')]};return db[_0x08f9('0x36')][_0x08f9('0x26')](_0x2b3e03)[_0x08f9('0x2d')](function(_0x31cb0e){_0x5e8336[_0x08f9('0x26')]=_0x31cb0e;if(_0x14517d[_0x08f9('0x38')]['includeAll']){_0x2dec36[_0x08f9('0x49')]=[{'all':!![]}];}return db[_0x08f9('0x36')][_0x08f9('0x4a')](_0x2dec36);})[_0x08f9('0x2d')](function(_0x1f1cfa){_0x5e8336[_0x08f9('0x4b')]=_0x1f1cfa;return _0x5e8336;})[_0x08f9('0x2d')](respondWithFilteredResult(_0x79978a,_0x2dec36))[_0x08f9('0x4c')](handleError(_0x79978a,null));};exports[_0x08f9('0x4d')]=function(_0x1443eb,_0xf3ef0a){var _0x1a8328={'raw':![],'where':{'id':_0x1443eb[_0x08f9('0x4e')]['id']}},_0x1ed7f5={};_0x1ed7f5['model']=_[_0x08f9('0x39')](db[_0x08f9('0x36')][_0x08f9('0x4f')]);_0x1ed7f5[_0x08f9('0x38')]=_[_0x08f9('0x39')](_0x1443eb[_0x08f9('0x38')]);_0x1ed7f5[_0x08f9('0x3a')]=_[_0x08f9('0x3b')](_0x1ed7f5['model'],_0x1ed7f5[_0x08f9('0x38')]);_0x1a8328[_0x08f9('0x3d')]=_[_0x08f9('0x3b')](_0x1ed7f5['model'],qs[_0x08f9('0x3e')](_0x1443eb[_0x08f9('0x38')]['fields']));_0x1a8328['attributes']=_0x1a8328[_0x08f9('0x3d')][_0x08f9('0x3f')]?_0x1a8328[_0x08f9('0x3d')]:_0x1ed7f5[_0x08f9('0x3c')];if(_0x1443eb['query'][_0x08f9('0x50')]){_0x1a8328[_0x08f9('0x49')]=[{'all':!![]}];}_0x1a8328=_[_0x08f9('0x46')]({},_0x1a8328,_0x1443eb[_0x08f9('0x51')]);return db[_0x08f9('0x36')][_0x08f9('0x52')](_0x1a8328)['then'](handleEntityNotFound(_0xf3ef0a,null))[_0x08f9('0x2d')](respondWithResult(_0xf3ef0a,null))[_0x08f9('0x4c')](handleError(_0xf3ef0a,null));};exports[_0x08f9('0x53')]=function(_0xf89439,_0x134395){return db[_0x08f9('0x36')]['create'](_0xf89439['body'],{})[_0x08f9('0x2d')](function(_0x1646dc){var _0x47f276=_0xf89439[_0x08f9('0x54')]['get']({'plain':!![]});if(!_0x47f276)throw new Error(_0x08f9('0x55'));if(_0x47f276['role']===_0x08f9('0x54')){var _0x23b9e8=_0x1646dc['get']({'plain':!![]});var _0xad9294=_0x08f9('0x30');return db[_0x08f9('0x56')]['find']({'where':{'name':_0xad9294,'userProfileId':_0x47f276[_0x08f9('0x57')]},'raw':!![]})[_0x08f9('0x2d')](function(_0x51ab19){if(_0x51ab19&&_0x51ab19[_0x08f9('0x58')]===0x0){return db[_0x08f9('0x31')][_0x08f9('0x53')]({'name':_0x23b9e8[_0x08f9('0x33')],'resourceId':_0x23b9e8['id'],'type':_0x51ab19[_0x08f9('0x33')],'sectionId':_0x51ab19['id']},{})[_0x08f9('0x2d')](function(){return _0x1646dc;});}else{return _0x1646dc;}})[_0x08f9('0x4c')](function(_0x6bf2b6){logger['error'](_0x08f9('0x59'),_0x6bf2b6);throw _0x6bf2b6;});}return _0x1646dc;})[_0x08f9('0x2d')](respondWithResult(_0x134395,0xc9))['catch'](handleError(_0x134395,null));};exports[_0x08f9('0x5a')]=function(_0x433526,_0x89f93d){var _0x1047c6={'where':{'id':_0x433526[_0x08f9('0x4e')]['id']}},_0x4c114f={};_0x4c114f['model']=_[_0x08f9('0x39')](db[_0x08f9('0x36')]['rawAttributes']);_0x1047c6[_0x08f9('0x3d')]=_['intersection'](_0x4c114f[_0x08f9('0x3c')],qs[_0x08f9('0x3e')](_0x433526['query'][_0x08f9('0x3e')]));_0x1047c6[_0x08f9('0x3d')]=_0x1047c6['attributes'][_0x08f9('0x3f')]?_0x1047c6['attributes']:_0x4c114f[_0x08f9('0x3c')];if(_0x433526[_0x08f9('0x38')][_0x08f9('0x50')]){_0x1047c6[_0x08f9('0x49')]=[{'all':!![]}];}_0x1047c6=_[_0x08f9('0x46')]({},_0x1047c6,_0x433526[_0x08f9('0x51')]);return db[_0x08f9('0x36')][_0x08f9('0x52')](_0x1047c6)[_0x08f9('0x2d')](handleEntityNotFound(_0x89f93d,null))['then'](function(_0x4aabc6){if(_0x4aabc6){var _0x46fb8e=_0x4aabc6[_0x08f9('0x2f')]({'plain':!![]});_0x46fb8e=qs[_0x08f9('0x5b')](_0x46fb8e,['id',_0x08f9('0x5c'),_0x08f9('0x5d')]);_0x433526[_0x08f9('0x5e')]=_[_0x08f9('0x5b')](_0x433526['body'],['id','createdAt','updatedAt']);return db['Dashboard'][_0x08f9('0x53')](_[_0x08f9('0x46')](_0x46fb8e,_0x433526[_0x08f9('0x5e')]),{'include':_0x433526[_0x08f9('0x38')][_0x08f9('0x50')]?[{'all':!![]}]:undefined})[_0x08f9('0x2d')](function(_0x10710f){var _0x4e8257=_0x433526[_0x08f9('0x54')]['get']({'plain':!![]});if(!_0x4e8257)throw new Error(_0x08f9('0x55'));if(_0x4e8257[_0x08f9('0x5f')]==='user'){var _0x2ae98c=_0x10710f[_0x08f9('0x2f')]({'plain':!![]});var _0x21e701=_0x08f9('0x30');return db[_0x08f9('0x56')][_0x08f9('0x52')]({'where':{'name':_0x21e701,'userProfileId':_0x4e8257[_0x08f9('0x57')]},'raw':!![]})[_0x08f9('0x2d')](function(_0x56e23a){if(_0x56e23a&&_0x56e23a[_0x08f9('0x58')]===0x0){return db[_0x08f9('0x31')][_0x08f9('0x53')]({'name':_0x2ae98c[_0x08f9('0x33')],'resourceId':_0x2ae98c['id'],'type':_0x56e23a['name'],'sectionId':_0x56e23a['id']},{})['then'](function(){return _0x10710f;});}else{return _0x10710f;}})[_0x08f9('0x4c')](function(_0x1cdbb6){logger[_0x08f9('0x60')](_0x08f9('0x59'),_0x1cdbb6);throw _0x1cdbb6;});}return _0x10710f;});}})[_0x08f9('0x2d')](respondWithResult(_0x89f93d,0xc9))['catch'](handleError(_0x89f93d,null));};exports[_0x08f9('0x2c')]=function(_0x5746ea,_0x317dce){if(_0x5746ea['body']['id']){delete _0x5746ea[_0x08f9('0x5e')]['id'];}return db[_0x08f9('0x36')]['find']({'where':{'id':_0x5746ea[_0x08f9('0x4e')]['id']}})[_0x08f9('0x2d')](handleEntityNotFound(_0x317dce,null))[_0x08f9('0x2d')](saveUpdates(_0x5746ea[_0x08f9('0x5e')],null))[_0x08f9('0x2d')](respondWithResult(_0x317dce,null))[_0x08f9('0x4c')](handleError(_0x317dce,null));};exports[_0x08f9('0x2e')]=function(_0x57b5d4,_0xdb5f5){return db[_0x08f9('0x36')]['find']({'where':{'id':_0x57b5d4['params']['id']}})[_0x08f9('0x2d')](handleEntityNotFound(_0xdb5f5,null))[_0x08f9('0x2d')](removeEntity(_0xdb5f5,null))[_0x08f9('0x4c')](handleError(_0xdb5f5,null));};function widgetAttributes(_0x473ce0){try{switch(_0x473ce0[_0x08f9('0x47')]){case _0x08f9('0x61'):return[{'name':_0x08f9('0x62'),'value':_0x473ce0['attrUrl']||(_0x473ce0[_0x08f9('0x63')]&&_0x473ce0[_0x08f9('0x63')][0x0]?_0x473ce0[_0x08f9('0x63')][0x0][_0x08f9('0x64')]:undefined)||_0x08f9('0x65')}];case'custom':return[{'name':_0x08f9('0x66'),'value':_0x473ce0['attrPath']||(_0x473ce0['attrs']&&_0x473ce0[_0x08f9('0x63')][0x0]?_0x473ce0[_0x08f9('0x63')][0x0]['value']:undefined)||''}];case _0x08f9('0x67'):return[{'name':_0x08f9('0x68'),'value':_0x473ce0[_0x08f9('0x68')]||(_0x473ce0[_0x08f9('0x63')]&&_0x473ce0[_0x08f9('0x63')][0x0]?_0x473ce0[_0x08f9('0x63')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x08f9('0x69'),'value':_0x473ce0[_0x08f9('0x69')]||(_0x473ce0[_0x08f9('0x63')]&&_0x473ce0[_0x08f9('0x63')][0x1]?_0x473ce0[_0x08f9('0x63')][0x1][_0x08f9('0x64')]:undefined)||_0x08f9('0x6a')},{'name':_0x08f9('0x6b'),'value':_0x473ce0[_0x08f9('0x6b')]||(_0x473ce0[_0x08f9('0x63')]&&_0x473ce0[_0x08f9('0x63')][0x2]?_0x473ce0[_0x08f9('0x63')][0x2][_0x08f9('0x64')]:undefined)||0xc}];case _0x08f9('0x6c'):return[{'name':_0x08f9('0x6d'),'value':_0x473ce0[_0x08f9('0x6d')]||(_0x473ce0[_0x08f9('0x63')]&&_0x473ce0[_0x08f9('0x63')][0x0]?_0x473ce0[_0x08f9('0x63')][0x0][_0x08f9('0x64')]:undefined)||_0x08f9('0x6e')},{'name':_0x08f9('0x6f'),'value':_0x473ce0['attrVoiceQueues']||(_0x473ce0[_0x08f9('0x63')]&&_0x473ce0[_0x08f9('0x63')][0x1]?_0x473ce0[_0x08f9('0x63')][0x1][_0x08f9('0x64')]:undefined)||[]},{'name':_0x08f9('0x6b'),'value':_0x473ce0[_0x08f9('0x6b')]||(_0x473ce0[_0x08f9('0x63')]&&_0x473ce0[_0x08f9('0x63')][0x2]?_0x473ce0[_0x08f9('0x63')][0x2]['value']:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':_0x08f9('0x70'),'value':_0x473ce0[_0x08f9('0x70')]||(_0x473ce0[_0x08f9('0x63')]&&_0x473ce0['attrs'][0x0]?_0x473ce0[_0x08f9('0x63')][0x0][_0x08f9('0x64')]:undefined)||_0x08f9('0x6e')},{'name':_0x08f9('0x71'),'value':_0x473ce0[_0x08f9('0x71')]||(_0x473ce0[_0x08f9('0x63')]&&_0x473ce0['attrs'][0x1]?_0x473ce0['attrs'][0x1]['value']:undefined)||null},{'name':_0x08f9('0x72'),'value':_0x473ce0[_0x08f9('0x72')]||(_0x473ce0[_0x08f9('0x63')]&&_0x473ce0[_0x08f9('0x63')][0x2]?_0x473ce0['attrs'][0x2][_0x08f9('0x64')]:undefined)||null},{'name':_0x08f9('0x6f'),'value':_0x473ce0[_0x08f9('0x6f')]||(_0x473ce0[_0x08f9('0x63')]&&_0x473ce0[_0x08f9('0x63')][0x3]?_0x473ce0[_0x08f9('0x63')][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':_0x08f9('0x73'),'type':_0x473ce0[_0x08f9('0x74')]||(_0x473ce0[_0x08f9('0x63')]&&_0x473ce0[_0x08f9('0x63')][0x0]?_0x473ce0['attrs'][0x0][_0x08f9('0x47')]:undefined)||null,'value':_0x473ce0['attrReport']||(_0x473ce0['attrs']&&_0x473ce0[_0x08f9('0x63')][0x0]?_0x473ce0[_0x08f9('0x63')][0x0][_0x08f9('0x64')]:undefined)||null},{'name':_0x08f9('0x75'),'value':_0x473ce0[_0x08f9('0x75')]||(_0x473ce0[_0x08f9('0x63')]&&_0x473ce0[_0x08f9('0x63')][0x1]?_0x473ce0[_0x08f9('0x63')][0x1][_0x08f9('0x64')]:undefined)||0x0}];default:return[];}}catch(_0x1240d7){logger['error'](_0x08f9('0x76'),JSON['stringify'](_0x1240d7));return[];}}exports['addItem']=function(_0x547d40,_0x142538,_0x434ce8){if(_0x547d40[_0x08f9('0x5e')]['id']){delete _0x547d40[_0x08f9('0x5e')]['id'];}return db[_0x08f9('0x36')]['find']({'where':{'id':_0x547d40[_0x08f9('0x4e')]['id']}})[_0x08f9('0x2d')](handleEntityNotFound(_0x142538,null))['then'](function(_0x5184e7){if(_0x5184e7){_0x547d40[_0x08f9('0x5e')][_0x08f9('0x77')]=_0x5184e7['id'];_0x547d40['body'][_0x08f9('0x63')]=widgetAttributes(_0x547d40[_0x08f9('0x5e')]);return db[_0x08f9('0x78')][_0x08f9('0x53')](_0x547d40[_0x08f9('0x5e')]);}})[_0x08f9('0x2d')](respondWithResult(_0x142538,null))[_0x08f9('0x4c')](handleError(_0x142538,null));};exports['getItems']=function(_0x4bcfa7,_0x23e27b,_0x4cb9a3){var _0x3e3402={};var _0x1a1d64={};var _0x566aaf;var _0x37370f;return db[_0x08f9('0x36')][_0x08f9('0x79')]({'where':{'id':_0x4bcfa7['params']['id']}})[_0x08f9('0x2d')](handleEntityNotFound(_0x23e27b,null))[_0x08f9('0x2d')](function(_0x58cb4f){if(_0x58cb4f){_0x566aaf=_0x58cb4f;_0x1a1d64['model']=_[_0x08f9('0x39')](db[_0x08f9('0x78')][_0x08f9('0x4f')]);_0x1a1d64[_0x08f9('0x38')]=_[_0x08f9('0x39')](_0x4bcfa7[_0x08f9('0x38')]);_0x1a1d64[_0x08f9('0x3a')]=_[_0x08f9('0x3b')](_0x1a1d64[_0x08f9('0x3c')],_0x1a1d64['query']);_0x3e3402[_0x08f9('0x3d')]=_[_0x08f9('0x3b')](_0x1a1d64[_0x08f9('0x3c')],qs['fields'](_0x4bcfa7[_0x08f9('0x38')]['fields']));_0x3e3402['attributes']=_0x3e3402[_0x08f9('0x3d')]['length']?_0x3e3402[_0x08f9('0x3d')]:_0x1a1d64['model'];_0x3e3402[_0x08f9('0x7a')]=qs[_0x08f9('0x42')](_0x4bcfa7[_0x08f9('0x38')][_0x08f9('0x42')]);_0x3e3402[_0x08f9('0x43')]=qs[_0x08f9('0x3a')](_[_0x08f9('0x44')](_0x4bcfa7[_0x08f9('0x38')],_0x1a1d64[_0x08f9('0x3a')]));if(_0x4bcfa7[_0x08f9('0x38')][_0x08f9('0x45')]){_0x3e3402['where']=_[_0x08f9('0x46')](_0x3e3402[_0x08f9('0x43')],{'$or':_['map'](_0x3e3402[_0x08f9('0x3d')],function(_0x59a8c9){var _0x4166f1={};_0x4166f1[_0x59a8c9]={'$like':'%'+_0x4bcfa7[_0x08f9('0x38')][_0x08f9('0x45')]+'%'};return _0x4166f1;})});}_0x3e3402=_[_0x08f9('0x46')]({},_0x3e3402,_0x4bcfa7[_0x08f9('0x51')]);return _0x566aaf['getItems'](_0x3e3402);}})[_0x08f9('0x2d')](function(_0x5f2c32){if(_0x5f2c32){_0x37370f=_0x5f2c32[_0x08f9('0x3f')];if(!_0x4bcfa7[_0x08f9('0x38')]['hasOwnProperty'](_0x08f9('0x41'))){_0x3e3402[_0x08f9('0x28')]=qs['limit'](_0x4bcfa7[_0x08f9('0x38')][_0x08f9('0x28')]);_0x3e3402[_0x08f9('0x27')]=qs[_0x08f9('0x27')](_0x4bcfa7['query']['offset']);}return _0x566aaf['getItems'](_0x3e3402);}})['then'](function(_0x1c55a5){if(_0x1c55a5){return _0x1c55a5?{'count':_0x37370f,'rows':_0x1c55a5}:null;}})['then'](respondWithResult(_0x23e27b,null))['catch'](handleError(_0x23e27b,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index d811bf0..1f39b83 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 _0x9e88=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1d5759,_0x417e09){var _0x51ddcd=function(_0x4e3f43){while(--_0x4e3f43){_0x1d5759['push'](_0x1d5759['shift']());}};_0x51ddcd(++_0x417e09);}(_0x9e88,0x1af));var _0x89e8=function(_0x3224b6,_0x1f20da){_0x3224b6=_0x3224b6-0x0;var _0x1f4ed7=_0x9e88[_0x3224b6];return _0x1f4ed7;};'use strict';var EventEmitter=require(_0x89e8('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x89e8('0x1')](0x0);var events={'afterCreate':_0x89e8('0x2'),'afterUpdate':_0x89e8('0x3'),'afterDestroy':_0x89e8('0x4')};function emitEvent(_0x39f3fb){return function(_0x2d2501,_0x5662bf,_0x5033e1){DashboardEvents[_0x89e8('0x5')](_0x39f3fb+':'+_0x2d2501['id'],_0x2d2501);DashboardEvents['emit'](_0x39f3fb,_0x2d2501);_0x5033e1(null);};}for(var e in events){if(events[_0x89e8('0x6')](e)){var event=events[e];Dashboard[_0x89e8('0x7')](e,emitEvent(event));}}module[_0x89e8('0x8')]=DashboardEvents; \ No newline at end of file +var _0x131b=['exports','events','Dashboard','setMaxListeners','save','update','remove','emit'];(function(_0x5e0ec3,_0x503d2e){var _0x48b147=function(_0xd833e1){while(--_0xd833e1){_0x5e0ec3['push'](_0x5e0ec3['shift']());}};_0x48b147(++_0x503d2e);}(_0x131b,0xf1));var _0xb131=function(_0x46b3c2,_0x141c53){_0x46b3c2=_0x46b3c2-0x0;var _0x3f4d7c=_0x131b[_0x46b3c2];return _0x3f4d7c;};'use strict';var EventEmitter=require(_0xb131('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xb131('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xb131('0x2')](0x0);var events={'afterCreate':_0xb131('0x3'),'afterUpdate':_0xb131('0x4'),'afterDestroy':_0xb131('0x5')};function emitEvent(_0x2d7edc){return function(_0x45cebc,_0x398c44,_0x278808){DashboardEvents[_0xb131('0x6')](_0x2d7edc+':'+_0x45cebc['id'],_0x45cebc);DashboardEvents[_0xb131('0x6')](_0x2d7edc,_0x45cebc);_0x278808(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xb131('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index f98c3f3..a52763f 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 _0x87fa=['../../config/environment','./dashboard.attributes','exports','define','dashboards','lodash','api','request-promise','path'];(function(_0x72a33d,_0x5691da){var _0x2621d5=function(_0x95b7c6){while(--_0x95b7c6){_0x72a33d['push'](_0x72a33d['shift']());}};_0x2621d5(++_0x5691da);}(_0x87fa,0xe6));var _0xa87f=function(_0x30415c,_0x301785){_0x30415c=_0x30415c-0x0;var _0x57b497=_0x87fa[_0x30415c];return _0x57b497;};'use strict';var _=require(_0xa87f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa87f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa87f('0x2'));var fs=require('fs');var path=require(_0xa87f('0x3'));var rimraf=require('rimraf');var config=require(_0xa87f('0x4'));var attributes=require(_0xa87f('0x5'));module[_0xa87f('0x6')]=function(_0x36bd33,_0x1385df){return _0x36bd33[_0xa87f('0x7')]('Dashboard',attributes,{'tableName':_0xa87f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe182=['../../config/environment','./dashboard.attributes','define','Dashboard','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x28359d,_0x18de19){var _0x4a1853=function(_0x25955f){while(--_0x25955f){_0x28359d['push'](_0x28359d['shift']());}};_0x4a1853(++_0x18de19);}(_0xe182,0x1dd));var _0x2e18=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe182[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x2e18('0x0'));var util=require(_0x2e18('0x1'));var logger=require(_0x2e18('0x2'))(_0x2e18('0x3'));var moment=require('moment');var BPromise=require(_0x2e18('0x4'));var rp=require(_0x2e18('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e18('0x6'));var config=require(_0x2e18('0x7'));var attributes=require(_0x2e18('0x8'));module['exports']=function(_0x174010,_0x4cb602){return _0x174010[_0x2e18('0x9')](_0x2e18('0xa'),attributes,{'tableName':'dashboards','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 3d990a3..467d265 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 _0x4549=['message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x583b88,_0x7731f0){var _0x1471fe=function(_0x2f63a4){while(--_0x2f63a4){_0x583b88['push'](_0x583b88['shift']());}};_0x1471fe(++_0x7731f0);}(_0x4549,0x1cb));var _0x9454=function(_0x275ab8,_0x312b5c){_0x275ab8=_0x275ab8-0x0;var _0x238abf=_0x4549[_0x275ab8];return _0x238abf;};'use strict';var _=require('lodash');var util=require(_0x9454('0x0'));var moment=require(_0x9454('0x1'));var BPromise=require('bluebird');var rs=require(_0x9454('0x2'));var fs=require('fs');var Redis=require(_0x9454('0x3'));var db=require(_0x9454('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9454('0x5'));var config=require(_0x9454('0x6'));var jayson=require(_0x9454('0x7'));var client=jayson[_0x9454('0x8')]['http']({'port':0x232a});config[_0x9454('0x9')]=_[_0x9454('0xa')](config[_0x9454('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9454('0x9')]));require('./dashboard.socket')[_0x9454('0xb')](socket);function respondWithRpcPromise(_0x1e37ef,_0x2f50da,_0x101a85){return new BPromise(function(_0x5e8458,_0x52f21f){return client[_0x9454('0xc')](_0x1e37ef,_0x101a85)[_0x9454('0xd')](function(_0x52437a){logger[_0x9454('0xe')](_0x9454('0xf'),_0x2f50da,_0x9454('0x10'));logger[_0x9454('0x11')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x2f50da,_0x9454('0x10'),JSON[_0x9454('0x12')](_0x52437a));if(_0x52437a[_0x9454('0x13')]){if(_0x52437a[_0x9454('0x13')][_0x9454('0x14')]===0x1f4){logger[_0x9454('0x13')](_0x9454('0xf'),_0x2f50da,_0x52437a[_0x9454('0x13')]['message']);return _0x52f21f(_0x52437a[_0x9454('0x13')][_0x9454('0x15')]);}logger[_0x9454('0x13')](_0x9454('0xf'),_0x2f50da,_0x52437a[_0x9454('0x13')][_0x9454('0x15')]);return _0x5e8458(_0x52437a['error'][_0x9454('0x15')]);}else{logger[_0x9454('0xe')](_0x9454('0xf'),_0x2f50da,'request\x20sent');_0x5e8458(_0x52437a[_0x9454('0x16')]['message']);}})[_0x9454('0x17')](function(_0xf55cf7){logger[_0x9454('0x13')](_0x9454('0xf'),_0x2f50da,_0xf55cf7);_0x52f21f(_0xf55cf7);});});} \ No newline at end of file +var _0xc848=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','info','catch'];(function(_0x1c2cfd,_0x2485b2){var _0x13778f=function(_0x23351b){while(--_0x23351b){_0x1c2cfd['push'](_0x1c2cfd['shift']());}};_0x13778f(++_0x2485b2);}(_0xc848,0x1a9));var _0x8c84=function(_0x257d14,_0x22d2ef){_0x257d14=_0x257d14-0x0;var _0x2c8026=_0xc848[_0x257d14];return _0x2c8026;};'use strict';var _=require(_0x8c84('0x0'));var util=require('util');var moment=require(_0x8c84('0x1'));var BPromise=require(_0x8c84('0x2'));var rs=require(_0x8c84('0x3'));var fs=require('fs');var Redis=require(_0x8c84('0x4'));var db=require(_0x8c84('0x5'))['db'];var utils=require(_0x8c84('0x6'));var logger=require(_0x8c84('0x7'))('rpc');var config=require(_0x8c84('0x8'));var jayson=require(_0x8c84('0x9'));var client=jayson[_0x8c84('0xa')][_0x8c84('0xb')]({'port':0x232a});config[_0x8c84('0xc')]=_['defaults'](config[_0x8c84('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x8c84('0xd'))(new Redis(config[_0x8c84('0xc')]));require('./dashboard.socket')[_0x8c84('0xe')](socket);function respondWithRpcPromise(_0x47c947,_0x4d50a1,_0x153f62){return new BPromise(function(_0x595406,_0x5925cf){return client['request'](_0x47c947,_0x153f62)[_0x8c84('0xf')](function(_0x3493e6){logger['info'](_0x8c84('0x10'),_0x4d50a1,_0x8c84('0x11'));logger[_0x8c84('0x12')](_0x8c84('0x13'),_0x4d50a1,_0x8c84('0x11'),JSON['stringify'](_0x3493e6));if(_0x3493e6['error']){if(_0x3493e6[_0x8c84('0x14')][_0x8c84('0x15')]===0x1f4){logger[_0x8c84('0x14')]('Dashboard,\x20%s,\x20%s',_0x4d50a1,_0x3493e6[_0x8c84('0x14')][_0x8c84('0x16')]);return _0x5925cf(_0x3493e6[_0x8c84('0x14')][_0x8c84('0x16')]);}logger[_0x8c84('0x14')](_0x8c84('0x10'),_0x4d50a1,_0x3493e6[_0x8c84('0x14')][_0x8c84('0x16')]);return _0x595406(_0x3493e6[_0x8c84('0x14')][_0x8c84('0x16')]);}else{logger[_0x8c84('0x17')](_0x8c84('0x10'),_0x4d50a1,_0x8c84('0x11'));_0x595406(_0x3493e6['result']['message']);}})[_0x8c84('0x18')](function(_0x1dd651){logger['error'](_0x8c84('0x10'),_0x4d50a1,_0x1dd651);_0x5925cf(_0x1dd651);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 3ed6576..3234ade 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 _0xe9ea=['emit','removeListener','register','./dashboard.events','remove'];(function(_0x1c3f44,_0x3b9db4){var _0x1bc285=function(_0x4f1781){while(--_0x4f1781){_0x1c3f44['push'](_0x1c3f44['shift']());}};_0x1bc285(++_0x3b9db4);}(_0xe9ea,0x94));var _0xae9e=function(_0x4af903,_0x3a7a8a){_0x4af903=_0x4af903-0x0;var _0x570bad=_0xe9ea[_0x4af903];return _0x570bad;};'use strict';var DashboardEvents=require(_0xae9e('0x0'));var events=['save',_0xae9e('0x1'),'update'];function createListener(_0xc8dfc0,_0x2868ca){return function(_0x5bfe50){_0x2868ca[_0xae9e('0x2')](_0xc8dfc0,_0x5bfe50);};}function removeListener(_0xcd3205,_0x5f3288){return function(){DashboardEvents[_0xae9e('0x3')](_0xcd3205,_0x5f3288);};}exports[_0xae9e('0x4')]=function(_0xa1ae5c){for(var _0xc84e86=0x0,_0x6768e1=events['length'];_0xc84e86<_0x6768e1;_0xc84e86++){var _0x2a44c9=events[_0xc84e86];var _0x18967a=createListener('dashboard:'+_0x2a44c9,_0xa1ae5c);DashboardEvents['on'](_0x2a44c9,_0x18967a);}}; \ No newline at end of file +var _0xb4ed=['update','removeListener','register','save'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb4ed,0xf3));var _0xdb4e=function(_0x497b1e,_0x586379){_0x497b1e=_0x497b1e-0x0;var _0x3f72e1=_0xb4ed[_0x497b1e];return _0x3f72e1;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xdb4e('0x0'),'remove',_0xdb4e('0x1')];function createListener(_0x2e8ec7,_0x4cf453){return function(_0x37ad57){_0x4cf453['emit'](_0x2e8ec7,_0x37ad57);};}function removeListener(_0x24459f,_0x1968a5){return function(){DashboardEvents[_0xdb4e('0x2')](_0x24459f,_0x1968a5);};}exports[_0xdb4e('0x3')]=function(_0x362b46){for(var _0x4a552a=0x0,_0x5da24e=events['length'];_0x4a552a<_0x5da24e;_0x4a552a++){var _0x2e89cc=events[_0x4a552a];var _0x44242c=createListener('dashboard:'+_0x2e89cc,_0x362b46);DashboardEvents['on'](_0x2e89cc,_0x44242c);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index b7b551d..65ae5d3 100644 --- a/server/api/dashboard/index.js +++ b/server/api/dashboard/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['addItem','put','update','delete','multer','path','express','../../components/auth/service','../../config/environment','./dashboard.controller','get','/:id','isAuthenticated','/:id/items','getItems','post','create','/:id/clone','clone'];(function(_0x4884a7,_0x18e38a){var _0x56b60e=function(_0x2ba8a3){while(--_0x2ba8a3){_0x4884a7['push'](_0x4884a7['shift']());}};_0x56b60e(++_0x18e38a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xb7e7[_0x5c9307];return _0x373e29;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['show']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['post'](_0x7b7e('0xd'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xe')]);router[_0x7b7e('0xb')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x10')](_0x7b7e('0x7'),auth['isAuthenticated'](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x12')]('/:id',auth[_0x7b7e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x70e0=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','/:id/items','isAuthenticated','getItems','post','/:id/clone','clone','addItem','put','/:id','update','multer'];(function(_0x2de42e,_0x92fb30){var _0x1c957c=function(_0x13c481){while(--_0x13c481){_0x2de42e['push'](_0x2de42e['shift']());}};_0x1c957c(++_0x92fb30);}(_0x70e0,0x17b));var _0x070e=function(_0x432001,_0x1056b0){_0x432001=_0x432001-0x0;var _0xc15f16=_0x70e0[_0x432001];return _0xc15f16;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./dashboard.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0x7')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth[_0x070e('0xb')](),controller['create']);router['post'](_0x070e('0xe'),auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);router[_0x070e('0xd')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0x12'),auth[_0x070e('0xb')](),controller[_0x070e('0x13')]);router['delete']('/:id',auth[_0x070e('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 3adb1f7..9068988 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 _0x7b9a=['INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','attrs','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7b9a,0x16f));var _0xa7b9=function(_0x4ef30b,_0x2daf2f){_0x4ef30b=_0x4ef30b-0x0;var _0x4e9c95=_0x7b9a[_0x4ef30b];return _0x4e9c95;};'use strict';var Sequelize=require(_0xa7b9('0x0'));var squel=require(_0xa7b9('0x1'));var _=require(_0xa7b9('0x2'));module[_0xa7b9('0x3')]={'title':{'type':Sequelize[_0xa7b9('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xa7b9('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xa7b9('0x5')](_0xa7b9('0x6')),'get':function(){try{return JSON[_0xa7b9('0x7')](this['getDataValue'](_0xa7b9('0x8')));}catch(_0x593603){return[];}},'set':function(_0x21f6e3){try{this['setDataValue'](_0xa7b9('0x8'),JSON[_0xa7b9('0x9')](_0x21f6e3));}catch(_0x4bf621){this['setDataValue'](_0xa7b9('0x8'),JSON[_0xa7b9('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xa7b9('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0xa7b9('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa7b9('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa7b9('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x25cd=['exports','STRING','TEXT','long','parse','getDataValue','setDataValue','attrs','stringify','INTEGER','#ffffff','#2196f3','squel'];(function(_0x18c405,_0x81c552){var _0x50389c=function(_0x37d0c7){while(--_0x37d0c7){_0x18c405['push'](_0x18c405['shift']());}};_0x50389c(++_0x81c552);}(_0x25cd,0xcf));var _0xd25c=function(_0x1730dd,_0x3cacb2){_0x1730dd=_0x1730dd-0x0;var _0x15a53c=_0x25cd[_0x1730dd];return _0x15a53c;};'use strict';var Sequelize=require('sequelize');var squel=require(_0xd25c('0x0'));var _=require('lodash');module[_0xd25c('0x1')]={'title':{'type':Sequelize[_0xd25c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd25c('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xd25c('0x3')](_0xd25c('0x4')),'get':function(){try{return JSON[_0xd25c('0x5')](this[_0xd25c('0x6')]('attrs'));}catch(_0x545dd2){return[];}},'set':function(_0x3cd9c4){try{this[_0xd25c('0x7')](_0xd25c('0x8'),JSON[_0xd25c('0x9')](_0x3cd9c4));}catch(_0x5eadcd){this[_0xd25c('0x7')](_0xd25c('0x8'),JSON[_0xd25c('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xd25c('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xd25c('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xd25c('0xa')]},'col':{'type':Sequelize[_0xd25c('0xa')]},'background':{'type':Sequelize[_0xd25c('0x2')],'allowNull':![],'defaultValue':_0xd25c('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xd25c('0x2')],'allowNull':![],'defaultValue':_0xd25c('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xd25c('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 2f2b46f..18169fb 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 _0xca98=['register','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','DashboardItem','query','intersection','attributes','fields','length','merge','find','catch','type','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./dashboardItem.socket'];(function(_0xa6a120,_0x18840b){var _0x429341=function(_0x12ff50){while(--_0x12ff50){_0xa6a120['push'](_0xa6a120['shift']());}};_0x429341(++_0x18840b);}(_0xca98,0xe3));var _0x8ca9=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xca98[_0x17928f];return _0x500b63;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8ca9('0x0'));var rimraf=require(_0x8ca9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8ca9('0x2'));var rp=require(_0x8ca9('0x3'));var moment=require('moment');var BPromise=require(_0x8ca9('0x4'));var Mustache=require(_0x8ca9('0x5'));var util=require(_0x8ca9('0x6'));var path=require('path');var sox=require(_0x8ca9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8ca9('0x8'));var squel=require(_0x8ca9('0x9'));var crypto=require(_0x8ca9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8ca9('0xb'));var toCsv=require(_0x8ca9('0xc'));var querystring=require('querystring');var Papa=require(_0x8ca9('0xd'));var Redis=require(_0x8ca9('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8ca9('0xf'));var as=require(_0x8ca9('0x10'));var hardwareService=require(_0x8ca9('0x11'));var logger=require(_0x8ca9('0x12'))(_0x8ca9('0x13'));var utils=require('../../config/utils');var config=require(_0x8ca9('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x8ca9('0x15')],{'host':_0x8ca9('0x16'),'port':0x18eb});var socket=require(_0x8ca9('0x17'))(new Redis(config['redis']));require(_0x8ca9('0x18'))[_0x8ca9('0x19')](socket);function respondWithStatusCode(_0x578c84,_0x2eb729){_0x2eb729=_0x2eb729||0xcc;return function(_0x110aa0){if(_0x110aa0){return _0x578c84[_0x8ca9('0x1a')](_0x2eb729);}return _0x578c84[_0x8ca9('0x1b')](_0x2eb729)[_0x8ca9('0x1c')]();};}function respondWithResult(_0x12c4f3,_0x5ccc23){_0x5ccc23=_0x5ccc23||0xc8;return function(_0x4df736){if(_0x4df736){return _0x12c4f3[_0x8ca9('0x1b')](_0x5ccc23)['json'](_0x4df736);}};}function respondWithFilteredResult(_0x5e55cb,_0x585591){return function(_0x153aac){if(_0x153aac){var _0x24f2c9=_0x153aac[_0x8ca9('0x1d')],_0xd782=_0x585591[_0x8ca9('0x1e')],_0x5a9445=_0x585591[_0x8ca9('0x1e')]+_0x585591['limit'],_0xfa1611;if(_0x5a9445>=_0x24f2c9){_0x5a9445=_0x24f2c9;_0xfa1611=0xc8;}else{_0xfa1611=0xce;}_0x5e55cb['status'](_0xfa1611);return _0x5e55cb[_0x8ca9('0x1f')](_0x8ca9('0x20'),_0xd782+'-'+_0x5a9445+'/'+_0x24f2c9)['json'](_0x153aac);}return null;};}function patchUpdates(_0x4a6565){return function(_0x240c6c){try{jsonpatch[_0x8ca9('0x21')](_0x240c6c,_0x4a6565,!![]);}catch(_0x3565d1){return BPromise[_0x8ca9('0x22')](_0x3565d1);}return _0x240c6c[_0x8ca9('0x23')]();};}function saveUpdates(_0x214b4,_0x123aba){return function(_0x34eed2){if(_0x34eed2){return _0x34eed2[_0x8ca9('0x24')](_0x214b4)[_0x8ca9('0x25')](function(_0x5bdd47){return _0x5bdd47;});}return null;};}function removeEntity(_0x2245f5,_0x3377a3){return function(_0x7153ea){if(_0x7153ea){return _0x7153ea[_0x8ca9('0x26')]()[_0x8ca9('0x25')](function(){_0x2245f5[_0x8ca9('0x1b')](0xcc)[_0x8ca9('0x1c')]();});}};}function handleEntityNotFound(_0x5abd46,_0x2ffb08){return function(_0x4bd061){if(!_0x4bd061){_0x5abd46[_0x8ca9('0x1a')](0x194);}return _0x4bd061;};}function handleError(_0x10c2ab,_0x5112e2){_0x5112e2=_0x5112e2||0x1f4;return function(_0x4f3c6b){logger[_0x8ca9('0x27')](_0x4f3c6b[_0x8ca9('0x28')]);if(_0x4f3c6b['name']){delete _0x4f3c6b[_0x8ca9('0x29')];}_0x10c2ab[_0x8ca9('0x1b')](_0x5112e2)[_0x8ca9('0x2a')](_0x4f3c6b);};}exports[_0x8ca9('0x2b')]=function(_0xf2ab47,_0x1c9a1a){var _0x560a08={'raw':![],'where':{'id':_0xf2ab47[_0x8ca9('0x2c')]['id']}},_0x184348={};_0x184348[_0x8ca9('0x2d')]=_[_0x8ca9('0x2e')](db[_0x8ca9('0x2f')]['rawAttributes']);_0x184348[_0x8ca9('0x30')]=_['keys'](_0xf2ab47['query']);_0x184348['filters']=_[_0x8ca9('0x31')](_0x184348[_0x8ca9('0x2d')],_0x184348[_0x8ca9('0x30')]);_0x560a08[_0x8ca9('0x32')]=_[_0x8ca9('0x31')](_0x184348[_0x8ca9('0x2d')],qs[_0x8ca9('0x33')](_0xf2ab47[_0x8ca9('0x30')][_0x8ca9('0x33')]));_0x560a08[_0x8ca9('0x32')]=_0x560a08[_0x8ca9('0x32')][_0x8ca9('0x34')]?_0x560a08[_0x8ca9('0x32')]:_0x184348[_0x8ca9('0x2d')];if(_0xf2ab47[_0x8ca9('0x30')]['includeAll']){_0x560a08['include']=[{'all':!![]}];}_0x560a08=_[_0x8ca9('0x35')]({},_0x560a08,_0xf2ab47['options']);return db[_0x8ca9('0x2f')][_0x8ca9('0x36')](_0x560a08)['then'](handleEntityNotFound(_0x1c9a1a,null))[_0x8ca9('0x25')](respondWithResult(_0x1c9a1a,null))['catch'](handleError(_0x1c9a1a,null));};exports['destroy']=function(_0x19201d,_0x285ab1){return db[_0x8ca9('0x2f')][_0x8ca9('0x36')]({'where':{'id':_0x19201d['params']['id']}})[_0x8ca9('0x25')](handleEntityNotFound(_0x285ab1,null))[_0x8ca9('0x25')](removeEntity(_0x285ab1,null))[_0x8ca9('0x37')](handleError(_0x285ab1,null));};function widgetAttributes(_0x501281){try{switch(_0x501281[_0x8ca9('0x38')]){case'iframe':return[{'name':_0x8ca9('0x39'),'value':_0x501281['attrUrl']||(_0x501281[_0x8ca9('0x3a')]&&_0x501281[_0x8ca9('0x3a')][0x0]?_0x501281[_0x8ca9('0x3a')][0x0][_0x8ca9('0x3b')]:undefined)||_0x8ca9('0x3c')}];case'custom':return[{'name':_0x8ca9('0x3d'),'value':_0x501281[_0x8ca9('0x3d')]||(_0x501281[_0x8ca9('0x3a')]&&_0x501281[_0x8ca9('0x3a')][0x0]?_0x501281[_0x8ca9('0x3a')][0x0]['value']:undefined)||''}];case _0x8ca9('0x3e'):return[{'name':_0x8ca9('0x3f'),'value':_0x501281['attrHourFormat']||(_0x501281[_0x8ca9('0x3a')]&&_0x501281[_0x8ca9('0x3a')][0x0]?_0x501281[_0x8ca9('0x3a')][0x0][_0x8ca9('0x3b')]:undefined)||_0x8ca9('0x40')},{'name':_0x8ca9('0x41'),'value':_0x501281['attrTimezone']||(_0x501281[_0x8ca9('0x3a')]&&_0x501281[_0x8ca9('0x3a')][0x1]?_0x501281[_0x8ca9('0x3a')][0x1][_0x8ca9('0x3b')]:undefined)||_0x8ca9('0x42')},{'name':'attrFontSize','value':_0x501281[_0x8ca9('0x43')]||(_0x501281[_0x8ca9('0x3a')]&&_0x501281[_0x8ca9('0x3a')][0x2]?_0x501281[_0x8ca9('0x3a')][0x2][_0x8ca9('0x3b')]:undefined)||0xc}];case _0x8ca9('0x44'):return[{'name':'attrMetric','value':_0x501281[_0x8ca9('0x45')]||(_0x501281[_0x8ca9('0x3a')]&&_0x501281[_0x8ca9('0x3a')][0x0]?_0x501281['attrs'][0x0][_0x8ca9('0x3b')]:undefined)||_0x8ca9('0x46')},{'name':_0x8ca9('0x47'),'value':_0x501281[_0x8ca9('0x47')]||(_0x501281['attrs']&&_0x501281[_0x8ca9('0x3a')][0x1]?_0x501281[_0x8ca9('0x3a')][0x1]['value']:undefined)||[]},{'name':_0x8ca9('0x43'),'value':_0x501281[_0x8ca9('0x43')]||(_0x501281[_0x8ca9('0x3a')]&&_0x501281['attrs'][0x2]?_0x501281[_0x8ca9('0x3a')][0x2][_0x8ca9('0x3b')]:undefined)||0x14}];case _0x8ca9('0x48'):case'pie-chart':return[{'name':_0x8ca9('0x49'),'value':_0x501281[_0x8ca9('0x49')]||(_0x501281[_0x8ca9('0x3a')]&&_0x501281[_0x8ca9('0x3a')][0x0]?_0x501281[_0x8ca9('0x3a')][0x0][_0x8ca9('0x3b')]:undefined)||_0x8ca9('0x46')},{'name':_0x8ca9('0x4a'),'value':_0x501281[_0x8ca9('0x4a')]||(_0x501281[_0x8ca9('0x3a')]&&_0x501281[_0x8ca9('0x3a')][0x1]?_0x501281[_0x8ca9('0x3a')][0x1][_0x8ca9('0x3b')]:undefined)||null},{'name':_0x8ca9('0x4b'),'value':_0x501281[_0x8ca9('0x4b')]||(_0x501281[_0x8ca9('0x3a')]&&_0x501281[_0x8ca9('0x3a')][0x2]?_0x501281[_0x8ca9('0x3a')][0x2][_0x8ca9('0x3b')]:undefined)||null},{'name':_0x8ca9('0x47'),'value':_0x501281[_0x8ca9('0x47')]||(_0x501281['attrs']&&_0x501281[_0x8ca9('0x3a')][0x3]?_0x501281['attrs'][0x3][_0x8ca9('0x3b')]:undefined)||[]}];case _0x8ca9('0x4c'):return[{'name':'attrReport','type':_0x501281[_0x8ca9('0x4d')]||(_0x501281[_0x8ca9('0x3a')]&&_0x501281['attrs'][0x0]?_0x501281['attrs'][0x0]['type']:undefined)||null,'value':_0x501281[_0x8ca9('0x4e')]||(_0x501281[_0x8ca9('0x3a')]&&_0x501281['attrs'][0x0]?_0x501281[_0x8ca9('0x3a')][0x0][_0x8ca9('0x3b')]:undefined)||null},{'name':_0x8ca9('0x4f'),'value':_0x501281[_0x8ca9('0x4f')]||(_0x501281[_0x8ca9('0x3a')]&&_0x501281[_0x8ca9('0x3a')][0x1]?_0x501281['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x493f30){logger[_0x8ca9('0x27')](_0x8ca9('0x50'),JSON[_0x8ca9('0x51')](_0x493f30));return[];}}exports['create']=function(_0x11abfa,_0x2ad27f){if(_0x11abfa[_0x8ca9('0x52')]){_0x11abfa[_0x8ca9('0x52')][_0x8ca9('0x3a')]=widgetAttributes(_0x11abfa[_0x8ca9('0x52')]);}return db['DashboardItem'][_0x8ca9('0x53')](_0x11abfa['body'],{})['then'](respondWithResult(_0x2ad27f,0xc9))[_0x8ca9('0x37')](handleError(_0x2ad27f,null));};exports[_0x8ca9('0x24')]=function(_0x39975a,_0x2871a8){if(_0x39975a[_0x8ca9('0x52')]['id']){delete _0x39975a[_0x8ca9('0x52')]['id'];}_0x39975a[_0x8ca9('0x52')][_0x8ca9('0x3a')]=widgetAttributes(_0x39975a[_0x8ca9('0x52')]);return db[_0x8ca9('0x2f')][_0x8ca9('0x36')]({'where':{'id':_0x39975a[_0x8ca9('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2871a8,null))[_0x8ca9('0x25')](saveUpdates(_0x39975a[_0x8ca9('0x52')],null))['then'](respondWithResult(_0x2871a8,null))['catch'](handleError(_0x2871a8,null));}; \ No newline at end of file +var _0xb278=['fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','redis','./dashboardItem.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','show','model','keys','DashboardItem','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','merge','catch','find','params','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','type','attrReport','attrRefresh','body','create','update','html-pdf','eml-format','zip-dir'];(function(_0x199fb0,_0x50b4c2){var _0x1b4a0a=function(_0x412142){while(--_0x412142){_0x199fb0['push'](_0x199fb0['shift']());}};_0x1b4a0a(++_0x50b4c2);}(_0xb278,0x1b5));var _0x8b27=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xb278[_0x5f1391];return _0x50ebe3;};'use strict';var pdf=require(_0x8b27('0x0'));var emlformat=require(_0x8b27('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8b27('0x2'));var jsonpatch=require(_0x8b27('0x3'));var rp=require(_0x8b27('0x4'));var moment=require(_0x8b27('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8b27('0x6'));var util=require('util');var path=require(_0x8b27('0x7'));var sox=require(_0x8b27('0x8'));var csv=require('to-csv');var ejs=require(_0x8b27('0x9'));var fs=require('fs');var _=require(_0x8b27('0xa'));var squel=require('squel');var crypto=require(_0x8b27('0xb'));var jsforce=require(_0x8b27('0xc'));var deskjs=require(_0x8b27('0xd'));var toCsv=require(_0x8b27('0xe'));var querystring=require('querystring');var Papa=require(_0x8b27('0xf'));var Redis=require(_0x8b27('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8b27('0x11'));var as=require(_0x8b27('0x12'));var hardwareService=require(_0x8b27('0x13'));var logger=require(_0x8b27('0x14'))('api');var utils=require(_0x8b27('0x15'));var config=require(_0x8b27('0x16'));var db=require(_0x8b27('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8b27('0x18'))(new Redis(config[_0x8b27('0x19')]));require(_0x8b27('0x1a'))[_0x8b27('0x1b')](socket);function respondWithStatusCode(_0x2d369b,_0x70bb9b){_0x70bb9b=_0x70bb9b||0xcc;return function(_0x24501b){if(_0x24501b){return _0x2d369b[_0x8b27('0x1c')](_0x70bb9b);}return _0x2d369b[_0x8b27('0x1d')](_0x70bb9b)[_0x8b27('0x1e')]();};}function respondWithResult(_0x55fc2a,_0x1a1f0b){_0x1a1f0b=_0x1a1f0b||0xc8;return function(_0x1b6c4d){if(_0x1b6c4d){return _0x55fc2a['status'](_0x1a1f0b)[_0x8b27('0x1f')](_0x1b6c4d);}};}function respondWithFilteredResult(_0xa14fae,_0x2b7180){return function(_0x2004fe){if(_0x2004fe){var _0x22784b=_0x2004fe[_0x8b27('0x20')],_0x4eb27a=_0x2b7180['offset'],_0x27453d=_0x2b7180[_0x8b27('0x21')]+_0x2b7180[_0x8b27('0x22')],_0x5b8cd2;if(_0x27453d>=_0x22784b){_0x27453d=_0x22784b;_0x5b8cd2=0xc8;}else{_0x5b8cd2=0xce;}_0xa14fae[_0x8b27('0x1d')](_0x5b8cd2);return _0xa14fae['set'](_0x8b27('0x23'),_0x4eb27a+'-'+_0x27453d+'/'+_0x22784b)['json'](_0x2004fe);}return null;};}function patchUpdates(_0x518153){return function(_0x5f5509){try{jsonpatch[_0x8b27('0x24')](_0x5f5509,_0x518153,!![]);}catch(_0x13042a){return BPromise[_0x8b27('0x25')](_0x13042a);}return _0x5f5509[_0x8b27('0x26')]();};}function saveUpdates(_0x52f847,_0x18b588){return function(_0x2fee53){if(_0x2fee53){return _0x2fee53['update'](_0x52f847)[_0x8b27('0x27')](function(_0x7be1af){return _0x7be1af;});}return null;};}function removeEntity(_0x3ece42,_0x5b21e8){return function(_0x245243){if(_0x245243){return _0x245243[_0x8b27('0x28')]()[_0x8b27('0x27')](function(){_0x3ece42[_0x8b27('0x1d')](0xcc)[_0x8b27('0x1e')]();});}};}function handleEntityNotFound(_0x2a2796,_0x48268a){return function(_0x3b2cc5){if(!_0x3b2cc5){_0x2a2796[_0x8b27('0x1c')](0x194);}return _0x3b2cc5;};}function handleError(_0xa735ef,_0x508257){_0x508257=_0x508257||0x1f4;return function(_0x47d585){logger[_0x8b27('0x29')](_0x47d585[_0x8b27('0x2a')]);if(_0x47d585[_0x8b27('0x2b')]){delete _0x47d585[_0x8b27('0x2b')];}_0xa735ef[_0x8b27('0x1d')](_0x508257)[_0x8b27('0x2c')](_0x47d585);};}exports[_0x8b27('0x2d')]=function(_0x181ab7,_0x1ea8f7){var _0x3f6f7c={'raw':![],'where':{'id':_0x181ab7['params']['id']}},_0x119b01={};_0x119b01[_0x8b27('0x2e')]=_[_0x8b27('0x2f')](db[_0x8b27('0x30')][_0x8b27('0x31')]);_0x119b01['query']=_[_0x8b27('0x2f')](_0x181ab7[_0x8b27('0x32')]);_0x119b01['filters']=_[_0x8b27('0x33')](_0x119b01[_0x8b27('0x2e')],_0x119b01[_0x8b27('0x32')]);_0x3f6f7c[_0x8b27('0x34')]=_[_0x8b27('0x33')](_0x119b01[_0x8b27('0x2e')],qs[_0x8b27('0x35')](_0x181ab7[_0x8b27('0x32')][_0x8b27('0x35')]));_0x3f6f7c[_0x8b27('0x34')]=_0x3f6f7c[_0x8b27('0x34')][_0x8b27('0x36')]?_0x3f6f7c[_0x8b27('0x34')]:_0x119b01['model'];if(_0x181ab7[_0x8b27('0x32')][_0x8b27('0x37')]){_0x3f6f7c[_0x8b27('0x38')]=[{'all':!![]}];}_0x3f6f7c=_[_0x8b27('0x39')]({},_0x3f6f7c,_0x181ab7['options']);return db[_0x8b27('0x30')]['find'](_0x3f6f7c)[_0x8b27('0x27')](handleEntityNotFound(_0x1ea8f7,null))[_0x8b27('0x27')](respondWithResult(_0x1ea8f7,null))[_0x8b27('0x3a')](handleError(_0x1ea8f7,null));};exports['destroy']=function(_0x4f0dec,_0x4649c3){return db[_0x8b27('0x30')][_0x8b27('0x3b')]({'where':{'id':_0x4f0dec[_0x8b27('0x3c')]['id']}})[_0x8b27('0x27')](handleEntityNotFound(_0x4649c3,null))[_0x8b27('0x27')](removeEntity(_0x4649c3,null))[_0x8b27('0x3a')](handleError(_0x4649c3,null));};function widgetAttributes(_0x498e0d){try{switch(_0x498e0d['type']){case'iframe':return[{'name':_0x8b27('0x3d'),'value':_0x498e0d[_0x8b27('0x3d')]||(_0x498e0d[_0x8b27('0x3e')]&&_0x498e0d['attrs'][0x0]?_0x498e0d[_0x8b27('0x3e')][0x0]['value']:undefined)||_0x8b27('0x3f')}];case _0x8b27('0x40'):return[{'name':_0x8b27('0x41'),'value':_0x498e0d[_0x8b27('0x41')]||(_0x498e0d[_0x8b27('0x3e')]&&_0x498e0d['attrs'][0x0]?_0x498e0d[_0x8b27('0x3e')][0x0][_0x8b27('0x42')]:undefined)||''}];case _0x8b27('0x43'):return[{'name':_0x8b27('0x44'),'value':_0x498e0d[_0x8b27('0x44')]||(_0x498e0d[_0x8b27('0x3e')]&&_0x498e0d[_0x8b27('0x3e')][0x0]?_0x498e0d[_0x8b27('0x3e')][0x0][_0x8b27('0x42')]:undefined)||'HH:mm:ss'},{'name':_0x8b27('0x45'),'value':_0x498e0d[_0x8b27('0x45')]||(_0x498e0d[_0x8b27('0x3e')]&&_0x498e0d['attrs'][0x1]?_0x498e0d[_0x8b27('0x3e')][0x1]['value']:undefined)||_0x8b27('0x46')},{'name':_0x8b27('0x47'),'value':_0x498e0d[_0x8b27('0x47')]||(_0x498e0d[_0x8b27('0x3e')]&&_0x498e0d[_0x8b27('0x3e')][0x2]?_0x498e0d[_0x8b27('0x3e')][0x2][_0x8b27('0x42')]:undefined)||0xc}];case _0x8b27('0x48'):return[{'name':_0x8b27('0x49'),'value':_0x498e0d[_0x8b27('0x49')]||(_0x498e0d[_0x8b27('0x3e')]&&_0x498e0d[_0x8b27('0x3e')][0x0]?_0x498e0d[_0x8b27('0x3e')][0x0][_0x8b27('0x42')]:undefined)||_0x8b27('0x4a')},{'name':_0x8b27('0x4b'),'value':_0x498e0d[_0x8b27('0x4b')]||(_0x498e0d[_0x8b27('0x3e')]&&_0x498e0d[_0x8b27('0x3e')][0x1]?_0x498e0d[_0x8b27('0x3e')][0x1]['value']:undefined)||[]},{'name':_0x8b27('0x47'),'value':_0x498e0d[_0x8b27('0x47')]||(_0x498e0d[_0x8b27('0x3e')]&&_0x498e0d[_0x8b27('0x3e')][0x2]?_0x498e0d[_0x8b27('0x3e')][0x2][_0x8b27('0x42')]:undefined)||0x14}];case _0x8b27('0x4c'):case'pie-chart':return[{'name':_0x8b27('0x4d'),'value':_0x498e0d[_0x8b27('0x4d')]||(_0x498e0d[_0x8b27('0x3e')]&&_0x498e0d['attrs'][0x0]?_0x498e0d[_0x8b27('0x3e')][0x0]['value']:undefined)||_0x8b27('0x4a')},{'name':'attrSerie2','value':_0x498e0d[_0x8b27('0x4e')]||(_0x498e0d[_0x8b27('0x3e')]&&_0x498e0d['attrs'][0x1]?_0x498e0d['attrs'][0x1][_0x8b27('0x42')]:undefined)||null},{'name':_0x8b27('0x4f'),'value':_0x498e0d[_0x8b27('0x4f')]||(_0x498e0d[_0x8b27('0x3e')]&&_0x498e0d[_0x8b27('0x3e')][0x2]?_0x498e0d[_0x8b27('0x3e')][0x2]['value']:undefined)||null},{'name':_0x8b27('0x4b'),'value':_0x498e0d['attrVoiceQueues']||(_0x498e0d[_0x8b27('0x3e')]&&_0x498e0d['attrs'][0x3]?_0x498e0d[_0x8b27('0x3e')][0x3][_0x8b27('0x42')]:undefined)||[]}];case _0x8b27('0x50'):return[{'name':'attrReport','type':_0x498e0d[_0x8b27('0x51')]||(_0x498e0d[_0x8b27('0x3e')]&&_0x498e0d['attrs'][0x0]?_0x498e0d['attrs'][0x0][_0x8b27('0x52')]:undefined)||null,'value':_0x498e0d[_0x8b27('0x53')]||(_0x498e0d[_0x8b27('0x3e')]&&_0x498e0d[_0x8b27('0x3e')][0x0]?_0x498e0d[_0x8b27('0x3e')][0x0]['value']:undefined)||null},{'name':_0x8b27('0x54'),'value':_0x498e0d['attrRefresh']||(_0x498e0d[_0x8b27('0x3e')]&&_0x498e0d[_0x8b27('0x3e')][0x1]?_0x498e0d[_0x8b27('0x3e')][0x1][_0x8b27('0x42')]:undefined)||0x0}];default:return[];}}catch(_0xb3c8fb){logger[_0x8b27('0x29')]('widgetAttributes:\x20%s',JSON['stringify'](_0xb3c8fb));return[];}}exports['create']=function(_0x3f26cf,_0x240d8c){if(_0x3f26cf['body']){_0x3f26cf['body'][_0x8b27('0x3e')]=widgetAttributes(_0x3f26cf[_0x8b27('0x55')]);}return db[_0x8b27('0x30')][_0x8b27('0x56')](_0x3f26cf[_0x8b27('0x55')],{})[_0x8b27('0x27')](respondWithResult(_0x240d8c,0xc9))[_0x8b27('0x3a')](handleError(_0x240d8c,null));};exports[_0x8b27('0x57')]=function(_0x43632f,_0x346487){if(_0x43632f[_0x8b27('0x55')]['id']){delete _0x43632f[_0x8b27('0x55')]['id'];}_0x43632f[_0x8b27('0x55')][_0x8b27('0x3e')]=widgetAttributes(_0x43632f[_0x8b27('0x55')]);return db[_0x8b27('0x30')][_0x8b27('0x3b')]({'where':{'id':_0x43632f[_0x8b27('0x3c')]['id']}})[_0x8b27('0x27')](handleEntityNotFound(_0x346487,null))['then'](saveUpdates(_0x43632f[_0x8b27('0x55')],null))[_0x8b27('0x27')](respondWithResult(_0x346487,null))[_0x8b27('0x3a')](handleError(_0x346487,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 7312192..c0ded58 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 _0x2308=['update','emit','hasOwnProperty','hook','events','../../mysqldb','save'];(function(_0x25e4b6,_0xe37877){var _0x41f733=function(_0x22d29b){while(--_0x22d29b){_0x25e4b6['push'](_0x25e4b6['shift']());}};_0x41f733(++_0xe37877);}(_0x2308,0x193));var _0x8230=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x2308[_0x465a0c];return _0x1e202e;};'use strict';var EventEmitter=require(_0x8230('0x0'));var DashboardItem=require(_0x8230('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8230('0x2'),'afterUpdate':_0x8230('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5732f5){return function(_0x2789a3,_0x2c4ecd,_0x3354c4){DashboardItemEvents[_0x8230('0x4')](_0x5732f5+':'+_0x2789a3['id'],_0x2789a3);DashboardItemEvents['emit'](_0x5732f5,_0x2789a3);_0x3354c4(null);};}for(var e in events){if(events[_0x8230('0x5')](e)){var event=events[e];DashboardItem[_0x8230('0x6')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x62b8=['emit','hasOwnProperty','hook','events','DashboardItem','setMaxListeners','update','remove'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x62b8,0xd3));var _0x862b=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0x62b8[_0x57d13b];return _0x467696;};'use strict';var EventEmitter=require(_0x862b('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x862b('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x862b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x862b('0x3'),'afterDestroy':_0x862b('0x4')};function emitEvent(_0x355467){return function(_0x22166a,_0x2085ce,_0xcc92f7){DashboardItemEvents[_0x862b('0x5')](_0x355467+':'+_0x22166a['id'],_0x22166a);DashboardItemEvents[_0x862b('0x5')](_0x355467,_0x22166a);_0xcc92f7(null);};}for(var e in events){if(events[_0x862b('0x6')](e)){var event=events[e];DashboardItem[_0x862b('0x7')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 2b9e407..f1c7d75 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 _0x4355=['bluebird','request-promise','path','./dashboardItem.attributes','exports','dashboard_items','lodash','util','../../config/logger','api','moment'];(function(_0xa452c4,_0x1ee154){var _0x5b9bbc=function(_0x4b679e){while(--_0x4b679e){_0xa452c4['push'](_0xa452c4['shift']());}};_0x5b9bbc(++_0x1ee154);}(_0x4355,0x19d));var _0x5435=function(_0x4ed546,_0x244bd0){_0x4ed546=_0x4ed546-0x0;var _0x10bfcc=_0x4355[_0x4ed546];return _0x10bfcc;};'use strict';var _=require(_0x5435('0x0'));var util=require(_0x5435('0x1'));var logger=require(_0x5435('0x2'))(_0x5435('0x3'));var moment=require(_0x5435('0x4'));var BPromise=require(_0x5435('0x5'));var rp=require(_0x5435('0x6'));var fs=require('fs');var path=require(_0x5435('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5435('0x8'));module[_0x5435('0x9')]=function(_0x4c83b5,_0x30ae1b){return _0x4c83b5['define']('DashboardItem',attributes,{'tableName':_0x5435('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabc3=['rimraf','../../config/environment','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x43576f,_0x1356ed){var _0x4d2466=function(_0x865deb){while(--_0x865deb){_0x43576f['push'](_0x43576f['shift']());}};_0x4d2466(++_0x1356ed);}(_0xabc3,0xc5));var _0x3abc=function(_0x42f7f3,_0x23c174){_0x42f7f3=_0x42f7f3-0x0;var _0x537c63=_0xabc3[_0x42f7f3];return _0x537c63;};'use strict';var _=require(_0x3abc('0x0'));var util=require(_0x3abc('0x1'));var logger=require(_0x3abc('0x2'))(_0x3abc('0x3'));var moment=require('moment');var BPromise=require(_0x3abc('0x4'));var rp=require(_0x3abc('0x5'));var fs=require('fs');var path=require(_0x3abc('0x6'));var rimraf=require(_0x3abc('0x7'));var config=require(_0x3abc('0x8'));var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x178135,_0x310872){return _0x178135[_0x3abc('0x9')](_0x3abc('0xa'),attributes,{'tableName':_0x3abc('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 e2ff68e..8b9bb2d 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 _0x4f31=['DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','info'];(function(_0x26ee83,_0x587e8d){var _0x3159a3=function(_0x38f13b){while(--_0x38f13b){_0x26ee83['push'](_0x26ee83['shift']());}};_0x3159a3(++_0x587e8d);}(_0x4f31,0x10d));var _0x14f3=function(_0x265f57,_0x5b0007){_0x265f57=_0x265f57-0x0;var _0x4fd8ce=_0x4f31[_0x265f57];return _0x4fd8ce;};'use strict';var _=require(_0x14f3('0x0'));var util=require(_0x14f3('0x1'));var moment=require(_0x14f3('0x2'));var BPromise=require(_0x14f3('0x3'));var rs=require(_0x14f3('0x4'));var fs=require('fs');var Redis=require(_0x14f3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x14f3('0x6'));var logger=require(_0x14f3('0x7'))('rpc');var config=require(_0x14f3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x14f3('0x9')][_0x14f3('0xa')]({'port':0x232a});config[_0x14f3('0xb')]=_['defaults'](config[_0x14f3('0xb')],{'host':_0x14f3('0xc'),'port':0x18eb});var socket=require(_0x14f3('0xd'))(new Redis(config[_0x14f3('0xb')]));require('./dashboardItem.socket')[_0x14f3('0xe')](socket);function respondWithRpcPromise(_0x1063df,_0x101314,_0x3abd1e){return new BPromise(function(_0x50db2d,_0x2fd49c){return client[_0x14f3('0xf')](_0x1063df,_0x3abd1e)['then'](function(_0x51bda2){logger[_0x14f3('0x10')](_0x14f3('0x11'),_0x101314,_0x14f3('0x12'));logger['debug'](_0x14f3('0x13'),_0x101314,_0x14f3('0x12'),JSON[_0x14f3('0x14')](_0x51bda2));if(_0x51bda2['error']){if(_0x51bda2['error'][_0x14f3('0x15')]===0x1f4){logger[_0x14f3('0x16')](_0x14f3('0x11'),_0x101314,_0x51bda2['error']['message']);return _0x2fd49c(_0x51bda2[_0x14f3('0x16')]['message']);}logger[_0x14f3('0x16')](_0x14f3('0x11'),_0x101314,_0x51bda2[_0x14f3('0x16')][_0x14f3('0x17')]);return _0x50db2d(_0x51bda2[_0x14f3('0x16')][_0x14f3('0x17')]);}else{logger['info'](_0x14f3('0x11'),_0x101314,'request\x20sent');_0x50db2d(_0x51bda2[_0x14f3('0x18')][_0x14f3('0x17')]);}})[_0x14f3('0x19')](function(_0x45d9ae){logger[_0x14f3('0x16')](_0x14f3('0x11'),_0x101314,_0x45d9ae);_0x2fd49c(_0x45d9ae);});});} \ No newline at end of file +var _0x7b72=['../../config/utils','rpc','../../config/environment','client','http','redis','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','util','moment','randomstring','../../mysqldb'];(function(_0x460140,_0x1f2aa9){var _0x13e713=function(_0x3252da){while(--_0x3252da){_0x460140['push'](_0x460140['shift']());}};_0x13e713(++_0x1f2aa9);}(_0x7b72,0xf9));var _0x27b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7b72[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x27b7('0x0'));var moment=require(_0x27b7('0x1'));var BPromise=require('bluebird');var rs=require(_0x27b7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x27b7('0x3'))['db'];var utils=require(_0x27b7('0x4'));var logger=require('../../config/logger')(_0x27b7('0x5'));var config=require(_0x27b7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x27b7('0x7')][_0x27b7('0x8')]({'port':0x232a});config[_0x27b7('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x27b7('0xa'))(new Redis(config['redis']));require(_0x27b7('0xb'))[_0x27b7('0xc')](socket);function respondWithRpcPromise(_0x407405,_0x230a9d,_0x310a0a){return new BPromise(function(_0xda7be7,_0x58f86c){return client[_0x27b7('0xd')](_0x407405,_0x310a0a)[_0x27b7('0xe')](function(_0x20ef91){logger[_0x27b7('0xf')](_0x27b7('0x10'),_0x230a9d,'request\x20sent');logger[_0x27b7('0x11')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x230a9d,_0x27b7('0x12'),JSON[_0x27b7('0x13')](_0x20ef91));if(_0x20ef91[_0x27b7('0x14')]){if(_0x20ef91['error'][_0x27b7('0x15')]===0x1f4){logger[_0x27b7('0x14')](_0x27b7('0x10'),_0x230a9d,_0x20ef91[_0x27b7('0x14')]['message']);return _0x58f86c(_0x20ef91[_0x27b7('0x14')]['message']);}logger['error'](_0x27b7('0x10'),_0x230a9d,_0x20ef91[_0x27b7('0x14')][_0x27b7('0x16')]);return _0xda7be7(_0x20ef91[_0x27b7('0x14')][_0x27b7('0x16')]);}else{logger[_0x27b7('0xf')](_0x27b7('0x10'),_0x230a9d,_0x27b7('0x12'));_0xda7be7(_0x20ef91['result'][_0x27b7('0x16')]);}})['catch'](function(_0x1c2c3f){logger['error'](_0x27b7('0x10'),_0x230a9d,_0x1c2c3f);_0x58f86c(_0x1c2c3f);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 55d7c04..61e2e38 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 _0xa518=['length','dashboardItem:','save','remove','emit','register'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xa518,0x1be));var _0x8a51=function(_0x95942,_0x85da80){_0x95942=_0x95942-0x0;var _0x6d7f81=_0xa518[_0x95942];return _0x6d7f81;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x8a51('0x0'),_0x8a51('0x1'),'update'];function createListener(_0x1267f7,_0xa42468){return function(_0x2bf17e){_0xa42468[_0x8a51('0x2')](_0x1267f7,_0x2bf17e);};}function removeListener(_0x277a40,_0x1fe306){return function(){DashboardItemEvents['removeListener'](_0x277a40,_0x1fe306);};}exports[_0x8a51('0x3')]=function(_0x58585d){for(var _0x405bd6=0x0,_0x7f7e71=events[_0x8a51('0x4')];_0x405bd6<_0x7f7e71;_0x405bd6++){var _0x248c74=events[_0x405bd6];var _0xc343cf=createListener(_0x8a51('0x5')+_0x248c74,_0x58585d);DashboardItemEvents['on'](_0x248c74,_0xc343cf);}}; \ No newline at end of file +var _0x6923=['dashboardItem:','./dashboardItem.events','save','removeListener','register','length'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x6923,0x109));var _0x3692=function(_0x31ab59,_0x4db472){_0x31ab59=_0x31ab59-0x0;var _0xa162ef=_0x6923[_0x31ab59];return _0xa162ef;};'use strict';var DashboardItemEvents=require(_0x3692('0x0'));var events=[_0x3692('0x1'),'remove','update'];function createListener(_0x406617,_0x3c4938){return function(_0x3bcd22){_0x3c4938['emit'](_0x406617,_0x3bcd22);};}function removeListener(_0x42f3a9,_0xcb021){return function(){DashboardItemEvents[_0x3692('0x2')](_0x42f3a9,_0xcb021);};}exports[_0x3692('0x3')]=function(_0x190afd){for(var _0x5e8ac8=0x0,_0x58b91d=events[_0x3692('0x4')];_0x5e8ac8<_0x58b91d;_0x5e8ac8++){var _0x127522=events[_0x5e8ac8];var _0x2b4345=createListener(_0x3692('0x5')+_0x127522,_0x190afd);DashboardItemEvents['on'](_0x127522,_0x2b4345);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 9718bae..2870de1 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 _0xdbf5=['../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','update','delete','exports','util','express','Router','../../components/auth/service'];(function(_0xa5ec7,_0x5f06b8){var _0x8f8100=function(_0x5a5864){while(--_0x5a5864){_0xa5ec7['push'](_0xa5ec7['shift']());}};_0x8f8100(++_0x5f06b8);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x8d2c13,_0x2fab71){_0x8d2c13=_0x8d2c13-0x0;var _0x2c5530=_0xdbf5[_0x8d2c13];return _0x2c5530;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var auth=require(_0x5dbf('0x3'));var interaction=require(_0x5dbf('0x4'));var config=require(_0x5dbf('0x5'));var controller=require(_0x5dbf('0x6'));router[_0x5dbf('0x7')](_0x5dbf('0x8'),auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xa')]);router[_0x5dbf('0xb')]('/',auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xc')]);router['put'](_0x5dbf('0x8'),auth['isAuthenticated'](),controller[_0x5dbf('0xd')]);router[_0x5dbf('0xe')](_0x5dbf('0x8'),auth[_0x5dbf('0x9')](),controller['destroy']);module[_0x5dbf('0xf')]=router; \ No newline at end of file +var _0x5fc3=['put','isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','/:id','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fc3,0xa8));var _0x35fc=function(_0x240261,_0x4fe66c){_0x240261=_0x240261-0x0;var _0x45c332=_0x5fc3[_0x240261];return _0x45c332;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var auth=require(_0x35fc('0x5'));var interaction=require(_0x35fc('0x6'));var config=require('../../config/environment');var controller=require(_0x35fc('0x7'));router[_0x35fc('0x8')](_0x35fc('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x35fc('0xa')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xb')]);router[_0x35fc('0xc')](_0x35fc('0x9'),auth[_0x35fc('0xd')](),controller[_0x35fc('0xe')]);router[_0x35fc('0xf')](_0x35fc('0x9'),auth['isAuthenticated'](),controller[_0x35fc('0x10')]);module[_0x35fc('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 39be9b4..473164e 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 _0xd74f=['exports','STRING','sequelize'];(function(_0x357fea,_0x4b7932){var _0x2e52ee=function(_0x5c9862){while(--_0x5c9862){_0x357fea['push'](_0x357fea['shift']());}};_0x2e52ee(++_0x4b7932);}(_0xd74f,0x149));var _0xfd74=function(_0x2799b1,_0x14aa80){_0x2799b1=_0x2799b1-0x0;var _0x30d759=_0xd74f[_0x2799b1];return _0x30d759;};'use strict';var Sequelize=require(_0xfd74('0x0'));module[_0xfd74('0x1')]={'name':{'type':Sequelize[_0xfd74('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x273e=['STRING','sequelize','exports'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x273e,0x12a));var _0xe273=function(_0x33aaaa,_0x4c9dbe){_0x33aaaa=_0x33aaaa-0x0;var _0x5f4864=_0x273e[_0x33aaaa];return _0x5f4864;};'use strict';var Sequelize=require(_0xe273('0x0'));module[_0xe273('0x1')]={'name':{'type':Sequelize[_0xe273('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 8e767fe..93ed6f9 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 _0xa9de=['catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','html-pdf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','set','Content-Range','apply','reject','save','update','then','Dispositions','UserProfileResource','destroy','sendStatus','error','stack','name','index','map','Disposition','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','show','params','find'];(function(_0x335396,_0xe997b2){var _0x2312f6=function(_0x2fc693){while(--_0x2fc693){_0x335396['push'](_0x335396['shift']());}};_0x2312f6(++_0xe997b2);}(_0xa9de,0xf2));var _0xea9d=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xa9de[_0x167cc1];return _0x10bc4b;};'use strict';var pdf=require(_0xea9d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xea9d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xea9d('0x2'));var BPromise=require(_0xea9d('0x3'));var Mustache=require(_0xea9d('0x4'));var util=require(_0xea9d('0x5'));var path=require(_0xea9d('0x6'));var sox=require(_0xea9d('0x7'));var csv=require(_0xea9d('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xea9d('0x9'));var squel=require(_0xea9d('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xea9d('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xea9d('0xc'));var Redis=require(_0xea9d('0xd'));var authService=require(_0xea9d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xea9d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea9d('0x10'))(_0xea9d('0x11'));var utils=require(_0xea9d('0x12'));var config=require(_0xea9d('0x13'));var db=require(_0xea9d('0x14'))['db'];function respondWithStatusCode(_0x395389,_0xf50a0){_0xf50a0=_0xf50a0||0xcc;return function(_0x3385d9){if(_0x3385d9){return _0x395389['sendStatus'](_0xf50a0);}return _0x395389[_0xea9d('0x15')](_0xf50a0)['end']();};}function respondWithResult(_0x1dd625,_0x4f925a){_0x4f925a=_0x4f925a||0xc8;return function(_0x53fd51){if(_0x53fd51){return _0x1dd625[_0xea9d('0x15')](_0x4f925a)[_0xea9d('0x16')](_0x53fd51);}};}function respondWithFilteredResult(_0x444e0e,_0x5858cb){return function(_0x3d1d7f){if(_0x3d1d7f){var _0x5de774=_0x3d1d7f['count'],_0x2a227e=_0x5858cb[_0xea9d('0x17')],_0x1e576b=_0x5858cb[_0xea9d('0x17')]+_0x5858cb['limit'],_0x3f063b;if(_0x1e576b>=_0x5de774){_0x1e576b=_0x5de774;_0x3f063b=0xc8;}else{_0x3f063b=0xce;}_0x444e0e[_0xea9d('0x15')](_0x3f063b);return _0x444e0e[_0xea9d('0x18')](_0xea9d('0x19'),_0x2a227e+'-'+_0x1e576b+'/'+_0x5de774)[_0xea9d('0x16')](_0x3d1d7f);}return null;};}function patchUpdates(_0x5d8f07){return function(_0x34e062){try{jsonpatch[_0xea9d('0x1a')](_0x34e062,_0x5d8f07,!![]);}catch(_0x28ea3e){return BPromise[_0xea9d('0x1b')](_0x28ea3e);}return _0x34e062[_0xea9d('0x1c')]();};}function saveUpdates(_0x5e1aba,_0x57dbf4){return function(_0x272c99){if(_0x272c99){return _0x272c99[_0xea9d('0x1d')](_0x5e1aba)['then'](function(_0x54da5f){return _0x54da5f;});}return null;};}function removeEntity(_0x282d95,_0x1e84fd){return function(_0xd8fce7){if(_0xd8fce7){return _0xd8fce7['destroy']()[_0xea9d('0x1e')](function(){var _0x40e2e6=_0xd8fce7['get']({'plain':!![]});var _0xb277d=_0xea9d('0x1f');return db[_0xea9d('0x20')][_0xea9d('0x21')]({'where':{'type':_0xb277d,'resourceId':_0x40e2e6['id']}})[_0xea9d('0x1e')](function(){return _0xd8fce7;});})[_0xea9d('0x1e')](function(){_0x282d95[_0xea9d('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50301e,_0x589566){return function(_0x4576d4){if(!_0x4576d4){_0x50301e[_0xea9d('0x22')](0x194);}return _0x4576d4;};}function handleError(_0x21582a,_0x6f6138){_0x6f6138=_0x6f6138||0x1f4;return function(_0xfe665b){logger[_0xea9d('0x23')](_0xfe665b[_0xea9d('0x24')]);if(_0xfe665b[_0xea9d('0x25')]){delete _0xfe665b[_0xea9d('0x25')];}_0x21582a[_0xea9d('0x15')](_0x6f6138)['send'](_0xfe665b);};}exports[_0xea9d('0x26')]=function(_0x287132,_0x115640){var _0xb969c4={},_0x201c61={},_0x1dacef={'count':0x0,'rows':[]};var _0x2d2178=_[_0xea9d('0x27')](db[_0xea9d('0x28')][_0xea9d('0x29')],function(_0x263f88){return{'name':_0x263f88[_0xea9d('0x2a')],'type':_0x263f88[_0xea9d('0x2b')]['key']};});_0x201c61[_0xea9d('0x2c')]=_[_0xea9d('0x27')](_0x2d2178,_0xea9d('0x25'));_0x201c61['query']=_[_0xea9d('0x2d')](_0x287132[_0xea9d('0x2e')]);_0x201c61[_0xea9d('0x2f')]=_[_0xea9d('0x30')](_0x201c61[_0xea9d('0x2c')],_0x201c61[_0xea9d('0x2e')]);_0xb969c4[_0xea9d('0x31')]=_[_0xea9d('0x30')](_0x201c61[_0xea9d('0x2c')],qs['fields'](_0x287132[_0xea9d('0x2e')][_0xea9d('0x32')]));_0xb969c4[_0xea9d('0x31')]=_0xb969c4[_0xea9d('0x31')][_0xea9d('0x33')]?_0xb969c4[_0xea9d('0x31')]:_0x201c61['model'];if(!_0x287132['query'][_0xea9d('0x34')]('nolimit')){_0xb969c4[_0xea9d('0x35')]=qs[_0xea9d('0x35')](_0x287132[_0xea9d('0x2e')]['limit']);_0xb969c4[_0xea9d('0x17')]=qs[_0xea9d('0x17')](_0x287132['query']['offset']);}_0xb969c4[_0xea9d('0x36')]=qs[_0xea9d('0x37')](_0x287132[_0xea9d('0x2e')][_0xea9d('0x37')]);_0xb969c4[_0xea9d('0x38')]=qs[_0xea9d('0x2f')](_[_0xea9d('0x39')](_0x287132[_0xea9d('0x2e')],_0x201c61[_0xea9d('0x2f')]),_0x2d2178);if(_0x287132[_0xea9d('0x2e')]['filter']){_0xb969c4[_0xea9d('0x38')]=_[_0xea9d('0x3a')](_0xb969c4[_0xea9d('0x38')],{'$or':_[_0xea9d('0x27')](_0x2d2178,function(_0x381278){if(_0x381278[_0xea9d('0x2b')]!==_0xea9d('0x3b')){var _0x3bde6e={};_0x3bde6e[_0x381278[_0xea9d('0x25')]]={'$like':'%'+_0x287132[_0xea9d('0x2e')][_0xea9d('0x3c')]+'%'};return _0x3bde6e;}})});}_0xb969c4=_[_0xea9d('0x3a')]({},_0xb969c4,_0x287132[_0xea9d('0x3d')]);var _0x254e91={'where':_0xb969c4[_0xea9d('0x38')]};return db[_0xea9d('0x28')][_0xea9d('0x3e')](_0x254e91)[_0xea9d('0x1e')](function(_0xa8af50){_0x1dacef[_0xea9d('0x3e')]=_0xa8af50;if(_0x287132['query'][_0xea9d('0x3f')]){_0xb969c4[_0xea9d('0x40')]=[{'all':!![]}];}return db[_0xea9d('0x28')][_0xea9d('0x41')](_0xb969c4);})[_0xea9d('0x1e')](function(_0x4c9951){_0x1dacef[_0xea9d('0x42')]=_0x4c9951;return _0x1dacef;})[_0xea9d('0x1e')](respondWithFilteredResult(_0x115640,_0xb969c4))['catch'](handleError(_0x115640,null));};exports[_0xea9d('0x43')]=function(_0x53e581,_0x36d2ac){var _0x24e677={'raw':!![],'where':{'id':_0x53e581[_0xea9d('0x44')]['id']}},_0x134978={};_0x134978[_0xea9d('0x2c')]=_[_0xea9d('0x2d')](db[_0xea9d('0x28')][_0xea9d('0x29')]);_0x134978[_0xea9d('0x2e')]=_[_0xea9d('0x2d')](_0x53e581['query']);_0x134978[_0xea9d('0x2f')]=_[_0xea9d('0x30')](_0x134978[_0xea9d('0x2c')],_0x134978[_0xea9d('0x2e')]);_0x24e677[_0xea9d('0x31')]=_[_0xea9d('0x30')](_0x134978[_0xea9d('0x2c')],qs[_0xea9d('0x32')](_0x53e581[_0xea9d('0x2e')][_0xea9d('0x32')]));_0x24e677['attributes']=_0x24e677[_0xea9d('0x31')][_0xea9d('0x33')]?_0x24e677['attributes']:_0x134978[_0xea9d('0x2c')];if(_0x53e581[_0xea9d('0x2e')]['includeAll']){_0x24e677[_0xea9d('0x40')]=[{'all':!![]}];}_0x24e677=_[_0xea9d('0x3a')]({},_0x24e677,_0x53e581[_0xea9d('0x3d')]);return db[_0xea9d('0x28')][_0xea9d('0x45')](_0x24e677)[_0xea9d('0x1e')](handleEntityNotFound(_0x36d2ac,null))[_0xea9d('0x1e')](respondWithResult(_0x36d2ac,null))[_0xea9d('0x46')](handleError(_0x36d2ac,null));};exports[_0xea9d('0x47')]=function(_0x56c608,_0x159765){return db[_0xea9d('0x28')][_0xea9d('0x47')](_0x56c608[_0xea9d('0x48')],{})[_0xea9d('0x1e')](function(_0x273b5a){var _0x346688=_0x56c608[_0xea9d('0x49')]['get']({'plain':!![]});if(!_0x346688)throw new Error(_0xea9d('0x4a'));if(_0x346688[_0xea9d('0x4b')]==='user'){var _0x5e416f=_0x273b5a['get']({'plain':!![]});var _0xa20c89=_0xea9d('0x1f');return db[_0xea9d('0x4c')][_0xea9d('0x45')]({'where':{'name':_0xa20c89,'userProfileId':_0x346688[_0xea9d('0x4d')]},'raw':!![]})['then'](function(_0x1a3961){if(_0x1a3961&&_0x1a3961['autoAssociation']===0x0){return db[_0xea9d('0x20')][_0xea9d('0x47')]({'name':_0x5e416f['name'],'resourceId':_0x5e416f['id'],'type':_0x1a3961[_0xea9d('0x25')],'sectionId':_0x1a3961['id']},{})['then'](function(){return _0x273b5a;});}else{return _0x273b5a;}})[_0xea9d('0x46')](function(_0x1526d9){logger[_0xea9d('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1526d9);throw _0x1526d9;});}return _0x273b5a;})[_0xea9d('0x1e')](respondWithResult(_0x159765,0xc9))[_0xea9d('0x46')](handleError(_0x159765,null));};exports[_0xea9d('0x1d')]=function(_0x5e1b84,_0x20d421){if(_0x5e1b84[_0xea9d('0x48')]['id']){delete _0x5e1b84[_0xea9d('0x48')]['id'];}return db[_0xea9d('0x28')]['find']({'where':{'id':_0x5e1b84['params']['id']}})[_0xea9d('0x1e')](handleEntityNotFound(_0x20d421,null))[_0xea9d('0x1e')](saveUpdates(_0x5e1b84[_0xea9d('0x48')],null))[_0xea9d('0x1e')](respondWithResult(_0x20d421,null))[_0xea9d('0x46')](handleError(_0x20d421,null));};exports[_0xea9d('0x21')]=function(_0x155d99,_0x38dc5c){return db[_0xea9d('0x28')][_0xea9d('0x45')]({'where':{'id':_0x155d99['params']['id']}})[_0xea9d('0x1e')](handleEntityNotFound(_0x38dc5c,null))['then'](removeEntity(_0x38dc5c,null))['catch'](handleError(_0x38dc5c,null));}; \ No newline at end of file +var _0xbe34=['../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','sendStatus','error','stack','name','send','index','map','Disposition','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x740a4,_0x3b91e8){var _0x4c8525=function(_0x3df316){while(--_0x3df316){_0x740a4['push'](_0x740a4['shift']());}};_0x4c8525(++_0x3b91e8);}(_0xbe34,0x1e2));var _0x4be3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbe34[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0x4be3('0x0'));var emlformat=require(_0x4be3('0x1'));var rimraf=require(_0x4be3('0x2'));var zipdir=require(_0x4be3('0x3'));var jsonpatch=require(_0x4be3('0x4'));var rp=require(_0x4be3('0x5'));var moment=require('moment');var BPromise=require(_0x4be3('0x6'));var Mustache=require(_0x4be3('0x7'));var util=require(_0x4be3('0x8'));var path=require(_0x4be3('0x9'));var sox=require(_0x4be3('0xa'));var csv=require(_0x4be3('0xb'));var ejs=require(_0x4be3('0xc'));var fs=require('fs');var _=require(_0x4be3('0xd'));var squel=require('squel');var crypto=require(_0x4be3('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4be3('0xf'));var toCsv=require(_0x4be3('0xb'));var querystring=require('querystring');var Papa=require(_0x4be3('0x10'));var Redis=require(_0x4be3('0x11'));var authService=require(_0x4be3('0x12'));var qs=require(_0x4be3('0x13'));var as=require(_0x4be3('0x14'));var hardwareService=require(_0x4be3('0x15'));var logger=require(_0x4be3('0x16'))(_0x4be3('0x17'));var utils=require('../../config/utils');var config=require(_0x4be3('0x18'));var db=require(_0x4be3('0x19'))['db'];function respondWithStatusCode(_0x447cb3,_0x7077b3){_0x7077b3=_0x7077b3||0xcc;return function(_0x1d986a){if(_0x1d986a){return _0x447cb3['sendStatus'](_0x7077b3);}return _0x447cb3[_0x4be3('0x1a')](_0x7077b3)[_0x4be3('0x1b')]();};}function respondWithResult(_0x3015e4,_0x2439d2){_0x2439d2=_0x2439d2||0xc8;return function(_0x21abdb){if(_0x21abdb){return _0x3015e4[_0x4be3('0x1a')](_0x2439d2)['json'](_0x21abdb);}};}function respondWithFilteredResult(_0xccbafd,_0x5b71ed){return function(_0x11001d){if(_0x11001d){var _0x4bc00e=_0x11001d['count'],_0x1c9dd5=_0x5b71ed[_0x4be3('0x1c')],_0x25a37a=_0x5b71ed[_0x4be3('0x1c')]+_0x5b71ed[_0x4be3('0x1d')],_0x2994e1;if(_0x25a37a>=_0x4bc00e){_0x25a37a=_0x4bc00e;_0x2994e1=0xc8;}else{_0x2994e1=0xce;}_0xccbafd[_0x4be3('0x1a')](_0x2994e1);return _0xccbafd[_0x4be3('0x1e')](_0x4be3('0x1f'),_0x1c9dd5+'-'+_0x25a37a+'/'+_0x4bc00e)[_0x4be3('0x20')](_0x11001d);}return null;};}function patchUpdates(_0x1dad3c){return function(_0x559c1c){try{jsonpatch[_0x4be3('0x21')](_0x559c1c,_0x1dad3c,!![]);}catch(_0x1d50cd){return BPromise[_0x4be3('0x22')](_0x1d50cd);}return _0x559c1c[_0x4be3('0x23')]();};}function saveUpdates(_0x20fd79,_0x1a0073){return function(_0x17429f){if(_0x17429f){return _0x17429f[_0x4be3('0x24')](_0x20fd79)[_0x4be3('0x25')](function(_0x3a00a6){return _0x3a00a6;});}return null;};}function removeEntity(_0x382477,_0x288caf){return function(_0x27dee2){if(_0x27dee2){return _0x27dee2[_0x4be3('0x26')]()[_0x4be3('0x25')](function(){var _0x1a01ee=_0x27dee2[_0x4be3('0x27')]({'plain':!![]});var _0x538eec=_0x4be3('0x28');return db[_0x4be3('0x29')][_0x4be3('0x26')]({'where':{'type':_0x538eec,'resourceId':_0x1a01ee['id']}})[_0x4be3('0x25')](function(){return _0x27dee2;});})[_0x4be3('0x25')](function(){_0x382477[_0x4be3('0x1a')](0xcc)[_0x4be3('0x1b')]();});}};}function handleEntityNotFound(_0x4b39f8,_0x28e68d){return function(_0x2bfeed){if(!_0x2bfeed){_0x4b39f8[_0x4be3('0x2a')](0x194);}return _0x2bfeed;};}function handleError(_0x4d5235,_0x561210){_0x561210=_0x561210||0x1f4;return function(_0x4501f4){logger[_0x4be3('0x2b')](_0x4501f4[_0x4be3('0x2c')]);if(_0x4501f4[_0x4be3('0x2d')]){delete _0x4501f4[_0x4be3('0x2d')];}_0x4d5235[_0x4be3('0x1a')](_0x561210)[_0x4be3('0x2e')](_0x4501f4);};}exports[_0x4be3('0x2f')]=function(_0x45c63c,_0xfdb68d){var _0x2ab06b={},_0x57cdda={},_0x5b15ff={'count':0x0,'rows':[]};var _0x220022=_[_0x4be3('0x30')](db[_0x4be3('0x31')][_0x4be3('0x32')],function(_0x17c71a){return{'name':_0x17c71a['fieldName'],'type':_0x17c71a[_0x4be3('0x33')]['key']};});_0x57cdda['model']=_[_0x4be3('0x30')](_0x220022,_0x4be3('0x2d'));_0x57cdda[_0x4be3('0x34')]=_[_0x4be3('0x35')](_0x45c63c['query']);_0x57cdda[_0x4be3('0x36')]=_[_0x4be3('0x37')](_0x57cdda[_0x4be3('0x38')],_0x57cdda[_0x4be3('0x34')]);_0x2ab06b[_0x4be3('0x39')]=_[_0x4be3('0x37')](_0x57cdda[_0x4be3('0x38')],qs[_0x4be3('0x3a')](_0x45c63c[_0x4be3('0x34')][_0x4be3('0x3a')]));_0x2ab06b[_0x4be3('0x39')]=_0x2ab06b[_0x4be3('0x39')][_0x4be3('0x3b')]?_0x2ab06b[_0x4be3('0x39')]:_0x57cdda['model'];if(!_0x45c63c[_0x4be3('0x34')][_0x4be3('0x3c')](_0x4be3('0x3d'))){_0x2ab06b[_0x4be3('0x1d')]=qs[_0x4be3('0x1d')](_0x45c63c[_0x4be3('0x34')][_0x4be3('0x1d')]);_0x2ab06b['offset']=qs[_0x4be3('0x1c')](_0x45c63c[_0x4be3('0x34')][_0x4be3('0x1c')]);}_0x2ab06b[_0x4be3('0x3e')]=qs[_0x4be3('0x3f')](_0x45c63c[_0x4be3('0x34')][_0x4be3('0x3f')]);_0x2ab06b[_0x4be3('0x40')]=qs[_0x4be3('0x36')](_[_0x4be3('0x41')](_0x45c63c['query'],_0x57cdda[_0x4be3('0x36')]),_0x220022);if(_0x45c63c[_0x4be3('0x34')]['filter']){_0x2ab06b[_0x4be3('0x40')]=_[_0x4be3('0x42')](_0x2ab06b[_0x4be3('0x40')],{'$or':_['map'](_0x220022,function(_0x4419ba){if(_0x4419ba[_0x4be3('0x33')]!==_0x4be3('0x43')){var _0x1004d2={};_0x1004d2[_0x4419ba['name']]={'$like':'%'+_0x45c63c[_0x4be3('0x34')][_0x4be3('0x44')]+'%'};return _0x1004d2;}})});}_0x2ab06b=_[_0x4be3('0x42')]({},_0x2ab06b,_0x45c63c[_0x4be3('0x45')]);var _0x371f29={'where':_0x2ab06b[_0x4be3('0x40')]};return db[_0x4be3('0x31')]['count'](_0x371f29)[_0x4be3('0x25')](function(_0x16d6aa){_0x5b15ff['count']=_0x16d6aa;if(_0x45c63c[_0x4be3('0x34')][_0x4be3('0x46')]){_0x2ab06b['include']=[{'all':!![]}];}return db[_0x4be3('0x31')]['findAll'](_0x2ab06b);})['then'](function(_0x44c50d){_0x5b15ff[_0x4be3('0x47')]=_0x44c50d;return _0x5b15ff;})['then'](respondWithFilteredResult(_0xfdb68d,_0x2ab06b))[_0x4be3('0x48')](handleError(_0xfdb68d,null));};exports[_0x4be3('0x49')]=function(_0x57450c,_0x2a3913){var _0x19e49c={'raw':!![],'where':{'id':_0x57450c[_0x4be3('0x4a')]['id']}},_0x305ff4={};_0x305ff4[_0x4be3('0x38')]=_[_0x4be3('0x35')](db[_0x4be3('0x31')][_0x4be3('0x32')]);_0x305ff4[_0x4be3('0x34')]=_[_0x4be3('0x35')](_0x57450c[_0x4be3('0x34')]);_0x305ff4[_0x4be3('0x36')]=_[_0x4be3('0x37')](_0x305ff4[_0x4be3('0x38')],_0x305ff4[_0x4be3('0x34')]);_0x19e49c[_0x4be3('0x39')]=_['intersection'](_0x305ff4[_0x4be3('0x38')],qs[_0x4be3('0x3a')](_0x57450c[_0x4be3('0x34')][_0x4be3('0x3a')]));_0x19e49c['attributes']=_0x19e49c[_0x4be3('0x39')][_0x4be3('0x3b')]?_0x19e49c[_0x4be3('0x39')]:_0x305ff4['model'];if(_0x57450c[_0x4be3('0x34')][_0x4be3('0x46')]){_0x19e49c[_0x4be3('0x4b')]=[{'all':!![]}];}_0x19e49c=_['merge']({},_0x19e49c,_0x57450c[_0x4be3('0x45')]);return db[_0x4be3('0x31')][_0x4be3('0x4c')](_0x19e49c)[_0x4be3('0x25')](handleEntityNotFound(_0x2a3913,null))['then'](respondWithResult(_0x2a3913,null))[_0x4be3('0x48')](handleError(_0x2a3913,null));};exports[_0x4be3('0x4d')]=function(_0x15683c,_0x920e6f){return db['Disposition']['create'](_0x15683c['body'],{})[_0x4be3('0x25')](function(_0x4f7b8f){var _0x4560e1=_0x15683c[_0x4be3('0x4e')][_0x4be3('0x27')]({'plain':!![]});if(!_0x4560e1)throw new Error(_0x4be3('0x4f'));if(_0x4560e1[_0x4be3('0x50')]==='user'){var _0x228f7e=_0x4f7b8f['get']({'plain':!![]});var _0x557704=_0x4be3('0x28');return db[_0x4be3('0x51')][_0x4be3('0x4c')]({'where':{'name':_0x557704,'userProfileId':_0x4560e1[_0x4be3('0x52')]},'raw':!![]})[_0x4be3('0x25')](function(_0x516c66){if(_0x516c66&&_0x516c66['autoAssociation']===0x0){return db['UserProfileResource'][_0x4be3('0x4d')]({'name':_0x228f7e[_0x4be3('0x2d')],'resourceId':_0x228f7e['id'],'type':_0x516c66['name'],'sectionId':_0x516c66['id']},{})['then'](function(){return _0x4f7b8f;});}else{return _0x4f7b8f;}})[_0x4be3('0x48')](function(_0x56d094){logger[_0x4be3('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56d094);throw _0x56d094;});}return _0x4f7b8f;})[_0x4be3('0x25')](respondWithResult(_0x920e6f,0xc9))[_0x4be3('0x48')](handleError(_0x920e6f,null));};exports[_0x4be3('0x24')]=function(_0x4d10bb,_0x17862c){if(_0x4d10bb[_0x4be3('0x53')]['id']){delete _0x4d10bb['body']['id'];}return db[_0x4be3('0x31')][_0x4be3('0x4c')]({'where':{'id':_0x4d10bb[_0x4be3('0x4a')]['id']}})[_0x4be3('0x25')](handleEntityNotFound(_0x17862c,null))[_0x4be3('0x25')](saveUpdates(_0x4d10bb[_0x4be3('0x53')],null))[_0x4be3('0x25')](respondWithResult(_0x17862c,null))['catch'](handleError(_0x17862c,null));};exports['destroy']=function(_0x4664bb,_0x6f836f){return db[_0x4be3('0x31')][_0x4be3('0x4c')]({'where':{'id':_0x4664bb['params']['id']}})['then'](handleEntityNotFound(_0x6f836f,null))[_0x4be3('0x25')](removeEntity(_0x6f836f,null))[_0x4be3('0x48')](handleError(_0x6f836f,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 3e22452..6fe49aa 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 _0x6b48=['rimraf','../../config/environment','./disposition.attributes','exports','Disposition','tools_dispositions','name','ListId','name_chat','ChatWebsiteId','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','../../config/logger','request-promise','path'];(function(_0x5eb65f,_0x2bae80){var _0x8ce18c=function(_0x2e3542){while(--_0x2e3542){_0x5eb65f['push'](_0x5eb65f['shift']());}};_0x8ce18c(++_0x2bae80);}(_0x6b48,0x115));var _0x86b4=function(_0x21dd37,_0x2f1ff9){_0x21dd37=_0x21dd37-0x0;var _0x4d4884=_0x6b48[_0x21dd37];return _0x4d4884;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x86b4('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x86b4('0x1'));var fs=require('fs');var path=require(_0x86b4('0x2'));var rimraf=require(_0x86b4('0x3'));var config=require(_0x86b4('0x4'));var attributes=require(_0x86b4('0x5'));module[_0x86b4('0x6')]=function(_0x504f39,_0x3ca2fb){return _0x504f39['define'](_0x86b4('0x7'),attributes,{'tableName':_0x86b4('0x8'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x86b4('0x9'),_0x86b4('0xa')]},{'unique':!![],'name':_0x86b4('0xb'),'fields':[_0x86b4('0x9'),_0x86b4('0xc')]},{'unique':!![],'name':'name_mail','fields':[_0x86b4('0x9'),'MailAccountId']},{'unique':!![],'name':_0x86b4('0xd'),'fields':['name',_0x86b4('0xe')]},{'unique':!![],'name':_0x86b4('0xf'),'fields':[_0x86b4('0x9'),'FaxAccountId']},{'unique':!![],'name':_0x86b4('0x10'),'fields':[_0x86b4('0x9'),_0x86b4('0x11')]},{'unique':!![],'name':_0x86b4('0x12'),'fields':[_0x86b4('0x9'),_0x86b4('0x13')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ef9=['bluebird','request-promise','path','../../config/environment','./disposition.attributes','exports','define','Disposition','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','api'];(function(_0x2f6b9a,_0x392b83){var _0x385942=function(_0x1cdcb4){while(--_0x1cdcb4){_0x2f6b9a['push'](_0x2f6b9a['shift']());}};_0x385942(++_0x392b83);}(_0x0ef9,0x82));var _0x90ef=function(_0x3b7b42,_0x31badd){_0x3b7b42=_0x3b7b42-0x0;var _0x1ebaad=_0x0ef9[_0x3b7b42];return _0x1ebaad;};'use strict';var _=require(_0x90ef('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x90ef('0x1'));var moment=require('moment');var BPromise=require(_0x90ef('0x2'));var rp=require(_0x90ef('0x3'));var fs=require('fs');var path=require(_0x90ef('0x4'));var rimraf=require('rimraf');var config=require(_0x90ef('0x5'));var attributes=require(_0x90ef('0x6'));module[_0x90ef('0x7')]=function(_0x4331d9,_0x4a9226){return _0x4331d9[_0x90ef('0x8')](_0x90ef('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x90ef('0xa'),'fields':[_0x90ef('0xb'),_0x90ef('0xc')]},{'unique':!![],'name':_0x90ef('0xd'),'fields':[_0x90ef('0xb'),_0x90ef('0xe')]},{'unique':!![],'name':_0x90ef('0xf'),'fields':[_0x90ef('0xb'),'MailAccountId']},{'unique':!![],'name':_0x90ef('0x10'),'fields':[_0x90ef('0xb'),_0x90ef('0x11')]},{'unique':!![],'name':'name_fax','fields':[_0x90ef('0xb'),_0x90ef('0x12')]},{'unique':!![],'name':_0x90ef('0x13'),'fields':[_0x90ef('0xb'),_0x90ef('0x14')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x90ef('0xb'),_0x90ef('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index b163b3f..181f289 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 _0x5426=['../../config/logger','rpc','../../config/environment','http','request','info','Disposition,\x20%s,\x20%s','debug','Disposition,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','../../mysqldb','../../config/utils'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x5426,0xb9));var _0x6542=function(_0x47ea14,_0x507869){_0x47ea14=_0x47ea14-0x0;var _0x1add3e=_0x5426[_0x47ea14];return _0x1add3e;};'use strict';var _=require(_0x6542('0x0'));var util=require(_0x6542('0x1'));var moment=require(_0x6542('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6542('0x3'))['db'];var utils=require(_0x6542('0x4'));var logger=require(_0x6542('0x5'))(_0x6542('0x6'));var config=require(_0x6542('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6542('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1208a7,_0x539955,_0x337530){return new BPromise(function(_0x5c676b,_0x39e9d4){return client[_0x6542('0x9')](_0x1208a7,_0x337530)['then'](function(_0x556033){logger[_0x6542('0xa')](_0x6542('0xb'),_0x539955,'request\x20sent');logger[_0x6542('0xc')](_0x6542('0xd'),_0x539955,_0x6542('0xe'),JSON['stringify'](_0x556033));if(_0x556033[_0x6542('0xf')]){if(_0x556033[_0x6542('0xf')][_0x6542('0x10')]===0x1f4){logger[_0x6542('0xf')]('Disposition,\x20%s,\x20%s',_0x539955,_0x556033[_0x6542('0xf')][_0x6542('0x11')]);return _0x39e9d4(_0x556033[_0x6542('0xf')][_0x6542('0x11')]);}logger[_0x6542('0xf')](_0x6542('0xb'),_0x539955,_0x556033[_0x6542('0xf')]['message']);return _0x5c676b(_0x556033[_0x6542('0xf')][_0x6542('0x11')]);}else{logger[_0x6542('0xa')](_0x6542('0xb'),_0x539955,'request\x20sent');_0x5c676b(_0x556033['result'][_0x6542('0x11')]);}})[_0x6542('0x12')](function(_0x5dc2ad){logger[_0x6542('0xf')](_0x6542('0xb'),_0x539955,_0x5dc2ad);_0x39e9d4(_0x5dc2ad);});});} \ No newline at end of file +var _0x222c=['Disposition,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent'];(function(_0x324012,_0x23f45f){var _0x435cf2=function(_0x378a82){while(--_0x378a82){_0x324012['push'](_0x324012['shift']());}};_0x435cf2(++_0x23f45f);}(_0x222c,0x17e));var _0xc222=function(_0x134d21,_0x233e21){_0x134d21=_0x134d21-0x0;var _0x548ea1=_0x222c[_0x134d21];return _0x548ea1;};'use strict';var _=require(_0xc222('0x0'));var util=require(_0xc222('0x1'));var moment=require('moment');var BPromise=require(_0xc222('0x2'));var rs=require(_0xc222('0x3'));var fs=require('fs');var Redis=require(_0xc222('0x4'));var db=require(_0xc222('0x5'))['db'];var utils=require(_0xc222('0x6'));var logger=require('../../config/logger')(_0xc222('0x7'));var config=require(_0xc222('0x8'));var jayson=require(_0xc222('0x9'));var client=jayson[_0xc222('0xa')][_0xc222('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46471e,_0x4e5009,_0x598c40){return new BPromise(function(_0x1845a1,_0x9935e6){return client[_0xc222('0xc')](_0x46471e,_0x598c40)[_0xc222('0xd')](function(_0x4c0f32){logger[_0xc222('0xe')](_0xc222('0xf'),_0x4e5009,_0xc222('0x10'));logger['debug'](_0xc222('0x11'),_0x4e5009,_0xc222('0x10'),JSON['stringify'](_0x4c0f32));if(_0x4c0f32['error']){if(_0x4c0f32[_0xc222('0x12')]['code']===0x1f4){logger[_0xc222('0x12')]('Disposition,\x20%s,\x20%s',_0x4e5009,_0x4c0f32[_0xc222('0x12')][_0xc222('0x13')]);return _0x9935e6(_0x4c0f32[_0xc222('0x12')][_0xc222('0x13')]);}logger[_0xc222('0x12')](_0xc222('0xf'),_0x4e5009,_0x4c0f32['error'][_0xc222('0x13')]);return _0x1845a1(_0x4c0f32[_0xc222('0x12')][_0xc222('0x13')]);}else{logger[_0xc222('0xe')]('Disposition,\x20%s,\x20%s',_0x4e5009,_0xc222('0x10'));_0x1845a1(_0x4c0f32[_0xc222('0x14')]['message']);}})['catch'](function(_0x4816d5){logger[_0xc222('0x12')](_0xc222('0xf'),_0x4e5009,_0x4816d5);_0x9935e6(_0x4816d5);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 53bd277..320789f 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 _0x79a3=['connect-timeout','Router','./disposition.controller','get','isAuthenticated','index','post','create','put','/:id','update','multer','path'];(function(_0x37bc6c,_0xd66a56){var _0x40dc8e=function(_0x280aab){while(--_0x280aab){_0x37bc6c['push'](_0x37bc6c['shift']());}};_0x40dc8e(++_0xd66a56);}(_0x79a3,0x80));var _0x379a=function(_0x207ade,_0x1f7561){_0x207ade=_0x207ade-0x0;var _0x52e3d0=_0x79a3[_0x207ade];return _0x52e3d0;};'use strict';var multer=require(_0x379a('0x0'));var util=require('util');var path=require(_0x379a('0x1'));var timeout=require(_0x379a('0x2'));var express=require('express');var router=express[_0x379a('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x379a('0x4'));router[_0x379a('0x5')]('/',auth[_0x379a('0x6')](),controller[_0x379a('0x7')]);router[_0x379a('0x5')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x379a('0x8')]('/',auth[_0x379a('0x6')](),controller[_0x379a('0x9')]);router[_0x379a('0xa')](_0x379a('0xb'),auth[_0x379a('0x6')](),controller[_0x379a('0xc')]);router['delete']('/:id',auth[_0x379a('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4a03=['index','isAuthenticated','show','create','put','/:id','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./disposition.controller','get'];(function(_0x362a7b,_0x3ccd6a){var _0x272ac2=function(_0x4643d2){while(--_0x4643d2){_0x362a7b['push'](_0x362a7b['shift']());}};_0x272ac2(++_0x3ccd6a);}(_0x4a03,0x16e));var _0x34a0=function(_0x448d1c,_0x88dd67){_0x448d1c=_0x448d1c-0x0;var _0x43982e=_0x4a03[_0x448d1c];return _0x43982e;};'use strict';var multer=require('multer');var util=require(_0x34a0('0x0'));var path=require(_0x34a0('0x1'));var timeout=require(_0x34a0('0x2'));var express=require('express');var router=express[_0x34a0('0x3')]();var auth=require(_0x34a0('0x4'));var interaction=require(_0x34a0('0x5'));var config=require('../../config/environment');var controller=require(_0x34a0('0x6'));router[_0x34a0('0x7')]('/',auth['isAuthenticated'](),controller[_0x34a0('0x8')]);router[_0x34a0('0x7')]('/:id',auth[_0x34a0('0x9')](),controller[_0x34a0('0xa')]);router['post']('/',auth[_0x34a0('0x9')](),controller[_0x34a0('0xb')]);router[_0x34a0('0xc')](_0x34a0('0xd'),auth[_0x34a0('0x9')](),controller['update']);router[_0x34a0('0xe')](_0x34a0('0xd'),auth[_0x34a0('0x9')](),controller[_0x34a0('0xf')]);module[_0x34a0('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index dae2718..329e9d0 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 _0x0c2c=['4800','7200','9600','12000','14400','ENUM','v17,v27,v29','INTEGER','SIP','IAX','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','2400'];(function(_0x1b6b99,_0x638d06){var _0x5485bd=function(_0x4f00c2){while(--_0x4f00c2){_0x1b6b99['push'](_0x1b6b99['shift']());}};_0x5485bd(++_0x638d06);}(_0x0c2c,0x1af));var _0xc0c2=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x0c2c[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require(_0xc0c2('0x0'));module[_0xc0c2('0x1')]={'name':{'type':Sequelize[_0xc0c2('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM'](_0xc0c2('0x3'),'no'),'defaultValue':_0xc0c2('0x3')},'headerinfo':{'type':Sequelize[_0xc0c2('0x2')],'defaultValue':_0xc0c2('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM'](_0xc0c2('0x5'),_0xc0c2('0x6'),_0xc0c2('0x7'),_0xc0c2('0x8'),_0xc0c2('0x9'),_0xc0c2('0xa')),'defaultValue':_0xc0c2('0x6')},'maxrate':{'type':Sequelize[_0xc0c2('0xb')](_0xc0c2('0x5'),_0xc0c2('0x6'),_0xc0c2('0x7'),_0xc0c2('0x8'),_0xc0c2('0x9'),_0xc0c2('0xa')),'defaultValue':_0xc0c2('0xa')},'modem':{'type':Sequelize[_0xc0c2('0x2')],'defaultValue':_0xc0c2('0xc')},'gateway':{'type':Sequelize[_0xc0c2('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xc0c2('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xc0c2('0xe'),_0xc0c2('0xf'),'DADHI',_0xc0c2('0x10')),'defaultValue':_0xc0c2('0xe')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc0c2('0x11')],'defaultValue':function(){return _0xc0c2('0x12');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc0c2('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc0c2('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc0c2('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc0c2('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc0c2('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc0c2('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc0c2('0x13')],'defaultValue':![],'comment':_0xc0c2('0x14'),'set':function(_0x11d6fc){if(!_0x11d6fc)this['setDataValue'](_0xc0c2('0x15'),null);this[_0xc0c2('0x16')]('mandatoryDisposition',_0x11d6fc);}}}; \ No newline at end of file +var _0xf899=['IAX','DADHI','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','12000','14400','2400','9600','v17,v27,v29','INTEGER','SIP'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf899,0x1c4));var _0x9f89=function(_0x358ed6,_0x57190d){_0x358ed6=_0x358ed6-0x0;var _0x46a725=_0xf899[_0x358ed6];return _0x46a725;};'use strict';var Sequelize=require(_0x9f89('0x0'));module[_0x9f89('0x1')]={'name':{'type':Sequelize[_0x9f89('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9f89('0x2')]},'ecm':{'type':Sequelize[_0x9f89('0x3')](_0x9f89('0x4'),'no'),'defaultValue':_0x9f89('0x4')},'headerinfo':{'type':Sequelize[_0x9f89('0x2')],'defaultValue':_0x9f89('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x9f89('0x6')},'minrate':{'type':Sequelize[_0x9f89('0x3')]('2400',_0x9f89('0x7'),_0x9f89('0x8'),'9600',_0x9f89('0x9'),_0x9f89('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x9f89('0x3')](_0x9f89('0xb'),_0x9f89('0x7'),'7200',_0x9f89('0xc'),'12000','14400'),'defaultValue':_0x9f89('0xa')},'modem':{'type':Sequelize[_0x9f89('0x2')],'defaultValue':_0x9f89('0xd')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x9f89('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x9f89('0x3')](_0x9f89('0xf'),_0x9f89('0x10'),_0x9f89('0x11'),_0x9f89('0x12')),'defaultValue':_0x9f89('0xf')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9f89('0x13')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x9f89('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9f89('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9f89('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9f89('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9f89('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9f89('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0x9f89('0x15')},'mandatoryDisposition':{'type':Sequelize[_0x9f89('0x14')],'defaultValue':![],'comment':_0x9f89('0x16'),'set':function(_0x28c4c4){if(!_0x28c4c4)this[_0x9f89('0x17')](_0x9f89('0x18'),null);this['setDataValue'](_0x9f89('0x19'),_0x28c4c4);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 5ee3974..1ec9ff6 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 _0x586e=['request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','get','FaxAccounts','status','end','sendStatus','stack','name','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','FaxAccount','includeAll','include','findAll','rows','show','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','order','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','transaction','bulkCreate','FaxApplication','findAndCountAll','priority','getApplications','context','exten','localstationid','system','description','appdata','Answer','push','CDR(type)=inbound-fax','Set','ecm','gateway','headerinfo','maxrate','minrate','modem','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','send','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','ContactId','Messages','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxAccount.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~!@#$%^&-_=+[{]}.'];(function(_0x2c89f6,_0x42a355){var _0xbc8344=function(_0x44a178){while(--_0x44a178){_0x2c89f6['push'](_0x2c89f6['shift']());}};_0xbc8344(++_0x42a355);}(_0x586e,0x174));var _0xe586=function(_0x469ac7,_0x38e416){_0x469ac7=_0x469ac7-0x0;var _0x22f3b0=_0x586e[_0x469ac7];return _0x22f3b0;};'use strict';var pdf=require(_0xe586('0x0'));var emlformat=require(_0xe586('0x1'));var rimraf=require(_0xe586('0x2'));var zipdir=require(_0xe586('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe586('0x4'));var moment=require(_0xe586('0x5'));var BPromise=require(_0xe586('0x6'));var Mustache=require(_0xe586('0x7'));var util=require(_0xe586('0x8'));var path=require(_0xe586('0x9'));var sox=require(_0xe586('0xa'));var csv=require(_0xe586('0xb'));var ejs=require(_0xe586('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe586('0xd'));var crypto=require(_0xe586('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe586('0xf'));var toCsv=require(_0xe586('0xb'));var querystring=require('querystring');var Papa=require(_0xe586('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe586('0x11'));var as=require(_0xe586('0x12'));var hardwareService=require(_0xe586('0x13'));var logger=require(_0xe586('0x14'))(_0xe586('0x15'));var utils=require(_0xe586('0x16'));var config=require(_0xe586('0x17'));var db=require(_0xe586('0x18'))['db'];config['redis']=_[_0xe586('0x19')](config[_0xe586('0x1a')],{'host':_0xe586('0x1b'),'port':0x18eb});var socket=require(_0xe586('0x1c'))(new Redis(config['redis']));require(_0xe586('0x1d'))['register'](socket);var jayson=require(_0xe586('0x1e'));var client=jayson[_0xe586('0x1f')][_0xe586('0x20')]({'port':0x232c});var client9002=jayson[_0xe586('0x1f')][_0xe586('0x20')]({'port':0x232a});function checkPasswordPattern(_0x276d71,_0x319352,_0x19be7b){if(_0x19be7b){var _0x1ae794=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1ae794[_0xe586('0x21')](_0x319352)){return _0x276d71;}else{throw new db['Sequelize'][(_0xe586('0x22'))](_0xe586('0x23'));}}else{return _0x276d71;}}function respondWithRpcPromise(_0x3e4a5e,_0x508d9b,_0x951c3c,_0x51a980){return new BPromise(function(_0x5db9ed,_0x5d2553){var _0x5add5b=_0x51a980||client;return _0x5add5b[_0xe586('0x24')](_0x3e4a5e,_0x951c3c)[_0xe586('0x25')](function(_0xc8423){logger[_0xe586('0x26')](_0xe586('0x27'),_0x508d9b,_0xe586('0x28'));logger[_0xe586('0x29')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x508d9b,_0xe586('0x28'),JSON['stringify'](_0xc8423));if(_0xc8423[_0xe586('0x2a')]){if(_0xc8423[_0xe586('0x2a')][_0xe586('0x2b')]===0x1f4){logger[_0xe586('0x2a')](_0xe586('0x27'),_0x508d9b,_0xc8423[_0xe586('0x2a')][_0xe586('0x2c')]);return _0x5d2553(_0xc8423['error'][_0xe586('0x2c')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x508d9b,_0xc8423[_0xe586('0x2a')][_0xe586('0x2c')]);return _0x5db9ed(_0xc8423[_0xe586('0x2a')][_0xe586('0x2c')]);}else{logger[_0xe586('0x26')](_0xe586('0x27'),_0x508d9b,_0xe586('0x28'));_0x5db9ed(_0xc8423[_0xe586('0x2d')][_0xe586('0x2c')]);}})[_0xe586('0x2e')](function(_0x541402){logger['error'](_0xe586('0x27'),_0x508d9b,_0x541402);_0x5d2553(_0x541402);});});}function respondWithStatusCode(_0x46259f,_0x1c0e79){_0x1c0e79=_0x1c0e79||0xcc;return function(_0x2a2b67){if(_0x2a2b67){return _0x46259f['sendStatus'](_0x1c0e79);}return _0x46259f['status'](_0x1c0e79)['end']();};}function respondWithResult(_0x1f32ab,_0x325c17){_0x325c17=_0x325c17||0xc8;return function(_0x52c4d6){if(_0x52c4d6){return _0x1f32ab['status'](_0x325c17)['json'](_0x52c4d6);}};}function respondWithFilteredResult(_0x4ede41,_0x2e283d){return function(_0x50fb5c){if(_0x50fb5c){var _0x370b5d=_0x50fb5c[_0xe586('0x2f')],_0x17cce2=_0x2e283d['offset'],_0x1d2152=_0x2e283d[_0xe586('0x30')]+_0x2e283d[_0xe586('0x31')],_0x3ee0af;if(_0x1d2152>=_0x370b5d){_0x1d2152=_0x370b5d;_0x3ee0af=0xc8;}else{_0x3ee0af=0xce;}_0x4ede41['status'](_0x3ee0af);return _0x4ede41[_0xe586('0x32')](_0xe586('0x33'),_0x17cce2+'-'+_0x1d2152+'/'+_0x370b5d)[_0xe586('0x34')](_0x50fb5c);}return null;};}function patchUpdates(_0x577961){return function(_0x98b7b7){try{jsonpatch[_0xe586('0x35')](_0x98b7b7,_0x577961,!![]);}catch(_0x45af08){return BPromise[_0xe586('0x36')](_0x45af08);}return _0x98b7b7[_0xe586('0x37')]();};}function saveUpdates(_0x19b322,_0xd43518){return function(_0x3426c0){if(_0x3426c0){return _0x3426c0[_0xe586('0x38')](_0x19b322)[_0xe586('0x25')](function(_0x1cd6c9){return _0x1cd6c9;});}return null;};}function removeEntity(_0x3ce30c,_0x47b42a){return function(_0x415f24){if(_0x415f24){return _0x415f24[_0xe586('0x39')]()['then'](function(){var _0x5d1547=_0x415f24[_0xe586('0x3a')]({'plain':!![]});var _0x2dec5b=_0xe586('0x3b');return db['UserProfileResource']['destroy']({'where':{'type':_0x2dec5b,'resourceId':_0x5d1547['id']}})[_0xe586('0x25')](function(){return _0x415f24;});})['then'](function(){_0x3ce30c[_0xe586('0x3c')](0xcc)[_0xe586('0x3d')]();});}};}function handleEntityNotFound(_0x4c29ca,_0x5b9645){return function(_0x2f808d){if(!_0x2f808d){_0x4c29ca[_0xe586('0x3e')](0x194);}return _0x2f808d;};}function handleError(_0x8878cf,_0x218e7c){_0x218e7c=_0x218e7c||0x1f4;return function(_0x3e5810){logger[_0xe586('0x2a')](_0x3e5810[_0xe586('0x3f')]);if(_0x3e5810[_0xe586('0x40')]){delete _0x3e5810[_0xe586('0x40')];}_0x8878cf[_0xe586('0x3c')](_0x218e7c)['send'](_0x3e5810);};}exports['index']=function(_0x2e7bd7,_0x2e319b){var _0x58db6f={'include':[{'model':db[_0xe586('0x41')],'as':_0xe586('0x42')}]},_0x4b2ef3={},_0x268ef4={'count':0x0,'rows':[]};var _0x29ca6f=_[_0xe586('0x43')](db['FaxAccount'][_0xe586('0x44')],function(_0x21453b){return{'name':_0x21453b['fieldName'],'type':_0x21453b[_0xe586('0x45')][_0xe586('0x46')]};});_0x4b2ef3[_0xe586('0x47')]=_[_0xe586('0x43')](_0x29ca6f,_0xe586('0x40'));_0x4b2ef3[_0xe586('0x48')]=_[_0xe586('0x49')](_0x2e7bd7['query']);_0x4b2ef3[_0xe586('0x4a')]=_[_0xe586('0x4b')](_0x4b2ef3['model'],_0x4b2ef3[_0xe586('0x48')]);_0x58db6f[_0xe586('0x4c')]=_[_0xe586('0x4b')](_0x4b2ef3[_0xe586('0x47')],qs[_0xe586('0x4d')](_0x2e7bd7[_0xe586('0x48')][_0xe586('0x4d')]));_0x58db6f[_0xe586('0x4c')]=_0x58db6f[_0xe586('0x4c')][_0xe586('0x4e')]?_0x58db6f[_0xe586('0x4c')]:_0x4b2ef3[_0xe586('0x47')];if(!_0x2e7bd7['query'][_0xe586('0x4f')](_0xe586('0x50'))){_0x58db6f[_0xe586('0x31')]=qs[_0xe586('0x31')](_0x2e7bd7[_0xe586('0x48')][_0xe586('0x31')]);_0x58db6f[_0xe586('0x30')]=qs[_0xe586('0x30')](_0x2e7bd7[_0xe586('0x48')]['offset']);}_0x58db6f['order']=qs[_0xe586('0x51')](_0x2e7bd7['query'][_0xe586('0x51')]);_0x58db6f['where']=qs['filters'](_[_0xe586('0x52')](_0x2e7bd7['query'],_0x4b2ef3[_0xe586('0x4a')]),_0x29ca6f);if(_0x2e7bd7['query'][_0xe586('0x53')]){_0x58db6f[_0xe586('0x54')]=_['merge'](_0x58db6f['where'],{'$or':_['map'](_0x29ca6f,function(_0x4126e0){if(_0x4126e0[_0xe586('0x45')]!==_0xe586('0x55')){var _0x566f1a={};_0x566f1a[_0x4126e0['name']]={'$like':'%'+_0x2e7bd7[_0xe586('0x48')][_0xe586('0x53')]+'%'};return _0x566f1a;}})});}_0x58db6f=_[_0xe586('0x56')]({},_0x58db6f,_0x2e7bd7[_0xe586('0x57')]);var _0x5f2d5c={'where':_0x58db6f['where']};return db[_0xe586('0x58')][_0xe586('0x2f')](_0x5f2d5c)['then'](function(_0x4d57dd){_0x268ef4['count']=_0x4d57dd;if(_0x2e7bd7[_0xe586('0x48')][_0xe586('0x59')]){_0x58db6f[_0xe586('0x5a')]=[{'all':!![]}];}return db[_0xe586('0x58')][_0xe586('0x5b')](_0x58db6f);})[_0xe586('0x25')](function(_0xe93c68){_0x268ef4[_0xe586('0x5c')]=_0xe93c68;return _0x268ef4;})[_0xe586('0x25')](respondWithFilteredResult(_0x2e319b,_0x58db6f))[_0xe586('0x2e')](handleError(_0x2e319b,null));};exports[_0xe586('0x5d')]=function(_0x100f25,_0x3bda5e){var _0x300b75={'raw':![],'where':{'id':_0x100f25['params']['id']},'include':[{'model':db[_0xe586('0x41')],'as':_0xe586('0x42')}]},_0x2e0267={};_0x2e0267[_0xe586('0x47')]=_[_0xe586('0x49')](db['FaxAccount'][_0xe586('0x44')]);_0x2e0267[_0xe586('0x48')]=_[_0xe586('0x49')](_0x100f25[_0xe586('0x48')]);_0x2e0267[_0xe586('0x4a')]=_[_0xe586('0x4b')](_0x2e0267['model'],_0x2e0267[_0xe586('0x48')]);_0x300b75[_0xe586('0x4c')]=_[_0xe586('0x4b')](_0x2e0267['model'],qs['fields'](_0x100f25[_0xe586('0x48')][_0xe586('0x4d')]));_0x300b75[_0xe586('0x4c')]=_0x300b75[_0xe586('0x4c')]['length']?_0x300b75['attributes']:_0x2e0267[_0xe586('0x47')];if(_0x100f25['query'][_0xe586('0x59')]){_0x300b75['include']=[{'all':!![]}];}_0x300b75=_[_0xe586('0x56')]({},_0x300b75,_0x100f25[_0xe586('0x57')]);return db[_0xe586('0x58')][_0xe586('0x5e')](_0x300b75)['then'](handleEntityNotFound(_0x3bda5e,null))['then'](respondWithResult(_0x3bda5e,null))[_0xe586('0x2e')](handleError(_0x3bda5e,null));};exports['create']=function(_0x3b367c,_0x2cb4eb){return db[_0xe586('0x58')][_0xe586('0x5f')](_0x3b367c['body'],{})['then'](function(_0xb8d71){var _0x1dbf8b=_0x3b367c['user'][_0xe586('0x3a')]({'plain':!![]});if(!_0x1dbf8b)throw new Error(_0xe586('0x60'));if(_0x1dbf8b[_0xe586('0x61')]===_0xe586('0x62')){var _0xcb79c5=_0xb8d71['get']({'plain':!![]});var _0x2ae9fe=_0xe586('0x3b');return db[_0xe586('0x63')][_0xe586('0x5e')]({'where':{'name':_0x2ae9fe,'userProfileId':_0x1dbf8b[_0xe586('0x64')]},'raw':!![]})[_0xe586('0x25')](function(_0x167663){if(_0x167663&&_0x167663[_0xe586('0x65')]===0x0){return db[_0xe586('0x66')][_0xe586('0x5f')]({'name':_0xcb79c5['name'],'resourceId':_0xcb79c5['id'],'type':_0x167663['name'],'sectionId':_0x167663['id']},{})['then'](function(){return _0xb8d71;});}else{return _0xb8d71;}})[_0xe586('0x2e')](function(_0x376e8a){logger[_0xe586('0x2a')](_0xe586('0x67'),_0x376e8a);throw _0x376e8a;});}return _0xb8d71;})[_0xe586('0x25')](respondWithResult(_0x2cb4eb,0xc9))[_0xe586('0x2e')](handleError(_0x2cb4eb,null));};exports[_0xe586('0x38')]=function(_0x39dcc6,_0x5b0521){if(_0x39dcc6[_0xe586('0x68')]['id']){delete _0x39dcc6[_0xe586('0x68')]['id'];}return db['FaxAccount'][_0xe586('0x5e')]({'where':{'id':_0x39dcc6[_0xe586('0x69')]['id']},'include':[{'model':db[_0xe586('0x41')],'as':_0xe586('0x42')}]})[_0xe586('0x25')](handleEntityNotFound(_0x5b0521,null))[_0xe586('0x25')](saveUpdates(_0x39dcc6[_0xe586('0x68')],null))[_0xe586('0x25')](respondWithResult(_0x5b0521,null))[_0xe586('0x2e')](handleError(_0x5b0521,null));};exports[_0xe586('0x39')]=function(_0x1896be,_0x198be5){return db[_0xe586('0x58')][_0xe586('0x5e')]({'where':{'id':_0x1896be['params']['id']}})['then'](handleEntityNotFound(_0x198be5,null))['then'](removeEntity(_0x198be5,null))[_0xe586('0x2e')](handleError(_0x198be5,null));};exports[_0xe586('0x6a')]=function(_0x7f9226,_0x346390){return db['FaxAccount']['describe']()[_0xe586('0x25')](respondWithResult(_0x346390,null))[_0xe586('0x2e')](handleError(_0x346390,null));};exports[_0xe586('0x6b')]=function(_0x4d5feb,_0x478dee,_0xb68010){if(_0x4d5feb[_0xe586('0x68')]['id']){delete _0x4d5feb[_0xe586('0x68')]['id'];}return db[_0xe586('0x58')][_0xe586('0x5e')]({'where':{'id':_0x4d5feb[_0xe586('0x69')]['id']}})[_0xe586('0x25')](handleEntityNotFound(_0x478dee,null))[_0xe586('0x25')](function(_0x495c47){if(_0x495c47){_0x4d5feb[_0xe586('0x68')][_0xe586('0x6c')]=_0x495c47['id'];return db[_0xe586('0x6d')]['create'](_0x4d5feb['body']);}})['then'](respondWithResult(_0x478dee,null))['catch'](handleError(_0x478dee,null));};exports[_0xe586('0x6e')]=function(_0xddfcfb,_0x5e8076,_0x488033){var _0x105471={'raw':![],'where':{}};var _0x16bf76={};var _0x4fa856={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0xddfcfb[_0xe586('0x69')]['id']}})[_0xe586('0x25')](handleEntityNotFound(_0x5e8076,null))['then'](function(_0x1f030a){if(_0x1f030a){_0x16bf76['model']=_[_0xe586('0x49')](db[_0xe586('0x6d')]['rawAttributes']);_0x16bf76[_0xe586('0x48')]=_[_0xe586('0x49')](_0xddfcfb[_0xe586('0x48')]);_0x16bf76[_0xe586('0x4a')]=_['intersection'](_0x16bf76['model'],_0x16bf76[_0xe586('0x48')]);_0x105471[_0xe586('0x4c')]=_[_0xe586('0x4b')](_0x16bf76['model'],qs['fields'](_0xddfcfb[_0xe586('0x48')][_0xe586('0x4d')]));_0x105471[_0xe586('0x4c')]=_0x105471['attributes'][_0xe586('0x4e')]?_0x105471[_0xe586('0x4c')]:_0x16bf76[_0xe586('0x47')];if(!_0xddfcfb['query'][_0xe586('0x4f')](_0xe586('0x50'))){_0x105471[_0xe586('0x31')]=qs['limit'](_0xddfcfb[_0xe586('0x48')][_0xe586('0x31')]);_0x105471[_0xe586('0x30')]=qs[_0xe586('0x30')](_0xddfcfb['query'][_0xe586('0x30')]);}_0x105471[_0xe586('0x6f')]=qs[_0xe586('0x51')](_0xddfcfb[_0xe586('0x48')]['sort']);_0x105471[_0xe586('0x54')]=qs[_0xe586('0x4a')](_[_0xe586('0x52')](_0xddfcfb[_0xe586('0x48')],_0x16bf76[_0xe586('0x4a')]));_0x105471[_0xe586('0x54')][_0xe586('0x6c')]=_0x1f030a['id'];if(_0xddfcfb['query']['filter']){_0x105471[_0xe586('0x54')]=_['merge'](_0x105471[_0xe586('0x54')],{'$or':_[_0xe586('0x43')](_0x105471['attributes'],function(_0x4e6fe1){var _0x34c851={};_0x34c851[_0x4e6fe1]={'$like':'%'+_0xddfcfb[_0xe586('0x48')][_0xe586('0x53')]+'%'};return _0x34c851;})});}_0x105471=_[_0xe586('0x56')]({},_0x105471,_0xddfcfb[_0xe586('0x57')]);return db[_0xe586('0x6d')][_0xe586('0x2f')]({'where':_0x105471[_0xe586('0x54')]})[_0xe586('0x25')](function(_0xf447c3){_0x4fa856[_0xe586('0x2f')]=_0xf447c3;if(_0xddfcfb[_0xe586('0x48')][_0xe586('0x59')]){_0x105471[_0xe586('0x5a')]=[{'all':!![]}];}return db[_0xe586('0x6d')]['findAll'](_0x105471);})[_0xe586('0x25')](function(_0x3b4d48){_0x4fa856[_0xe586('0x5c')]=_0x3b4d48;return _0x4fa856;});}})[_0xe586('0x25')](respondWithFilteredResult(_0x5e8076,_0x105471))[_0xe586('0x2e')](handleError(_0x5e8076,null));};exports[_0xe586('0x70')]=function(_0x1d972a,_0x3df67a,_0xa21f66){return db[_0xe586('0x58')][_0xe586('0x5e')]({'where':{'id':_0x1d972a[_0xe586('0x69')]['id']}})[_0xe586('0x25')](handleEntityNotFound(_0x3df67a,null))['then'](function(_0x8aaf4b){if(_0x8aaf4b){return _0x8aaf4b[_0xe586('0x70')](_0x1d972a[_0xe586('0x48')][_0xe586('0x71')]);}})['then'](respondWithStatusCode(_0x3df67a,null))[_0xe586('0x2e')](handleError(_0x3df67a,null));};exports[_0xe586('0x72')]=function(_0x277d12,_0x2d5eec,_0x137288){if(_0x277d12[_0xe586('0x68')]['id']){delete _0x277d12[_0xe586('0x68')]['id'];}return db['FaxAccount'][_0xe586('0x5e')]({'where':{'id':_0x277d12[_0xe586('0x69')]['id']}})['then'](handleEntityNotFound(_0x2d5eec,null))['then'](function(_0x51cdc4){if(_0x51cdc4){_0x277d12[_0xe586('0x68')][_0xe586('0x6c')]=_0x51cdc4['id'];return db[_0xe586('0x73')][_0xe586('0x5f')](_0x277d12[_0xe586('0x68')]);}})[_0xe586('0x25')](respondWithResult(_0x2d5eec,null))['catch'](handleError(_0x2d5eec,null));};exports['getAnswers']=function(_0xa9962b,_0x573d5c,_0x393327){var _0x5ce9ed={'raw':![],'where':{}};var _0x446de6={};var _0x5d5fb6={'count':0x0,'rows':[]};return db['FaxAccount'][_0xe586('0x74')]({'where':{'id':_0xa9962b[_0xe586('0x69')]['id']}})[_0xe586('0x25')](handleEntityNotFound(_0x573d5c,null))[_0xe586('0x25')](function(_0x284772){if(_0x284772){_0x446de6[_0xe586('0x47')]=_[_0xe586('0x49')](db['CannedAnswer'][_0xe586('0x44')]);_0x446de6['query']=_[_0xe586('0x49')](_0xa9962b[_0xe586('0x48')]);_0x446de6[_0xe586('0x4a')]=_['intersection'](_0x446de6['model'],_0x446de6[_0xe586('0x48')]);_0x5ce9ed['attributes']=_[_0xe586('0x4b')](_0x446de6[_0xe586('0x47')],qs[_0xe586('0x4d')](_0xa9962b[_0xe586('0x48')][_0xe586('0x4d')]));_0x5ce9ed['attributes']=_0x5ce9ed[_0xe586('0x4c')][_0xe586('0x4e')]?_0x5ce9ed['attributes']:_0x446de6['model'];if(!_0xa9962b['query']['hasOwnProperty']('nolimit')){_0x5ce9ed[_0xe586('0x31')]=qs[_0xe586('0x31')](_0xa9962b[_0xe586('0x48')]['limit']);_0x5ce9ed[_0xe586('0x30')]=qs[_0xe586('0x30')](_0xa9962b[_0xe586('0x48')][_0xe586('0x30')]);}_0x5ce9ed[_0xe586('0x6f')]=qs[_0xe586('0x51')](_0xa9962b[_0xe586('0x48')][_0xe586('0x51')]);_0x5ce9ed['where']=qs[_0xe586('0x4a')](_[_0xe586('0x52')](_0xa9962b['query'],_0x446de6[_0xe586('0x4a')]));_0x5ce9ed[_0xe586('0x54')][_0xe586('0x6c')]=_0x284772['id'];if(_0xa9962b['query']['filter']){_0x5ce9ed[_0xe586('0x54')]=_[_0xe586('0x56')](_0x5ce9ed['where'],{'$or':_[_0xe586('0x43')](_0x5ce9ed[_0xe586('0x4c')],function(_0x399e66){var _0x149015={};_0x149015[_0x399e66]={'$like':'%'+_0xa9962b[_0xe586('0x48')][_0xe586('0x53')]+'%'};return _0x149015;})});}_0x5ce9ed=_['merge']({},_0x5ce9ed,_0xa9962b['options']);return db[_0xe586('0x73')][_0xe586('0x2f')]({'where':_0x5ce9ed['where']})['then'](function(_0x5c2248){_0x5d5fb6[_0xe586('0x2f')]=_0x5c2248;if(_0xa9962b[_0xe586('0x48')]['includeAll']){_0x5ce9ed[_0xe586('0x5a')]=[{'all':!![]}];}return db[_0xe586('0x73')][_0xe586('0x5b')](_0x5ce9ed);})[_0xe586('0x25')](function(_0x50735b){_0x5d5fb6['rows']=_0x50735b;return _0x5d5fb6;});}})[_0xe586('0x25')](respondWithFilteredResult(_0x573d5c,_0x5ce9ed))[_0xe586('0x2e')](handleError(_0x573d5c,null));};exports[_0xe586('0x75')]=function(_0x14cdfc,_0x21d361,_0x418866){return db[_0xe586('0x58')][_0xe586('0x5e')]({'where':{'id':_0x14cdfc[_0xe586('0x69')]['id']}})[_0xe586('0x25')](handleEntityNotFound(_0x21d361,null))[_0xe586('0x25')](function(_0x1245a9){if(_0x1245a9){return _0x1245a9[_0xe586('0x75')](_0x14cdfc[_0xe586('0x48')][_0xe586('0x71')]);}})[_0xe586('0x25')](respondWithStatusCode(_0x21d361,null))[_0xe586('0x2e')](handleError(_0x21d361,null));};exports[_0xe586('0x76')]=function(_0x309fb2,_0x55adc9,_0x49b7a7){return db['FaxInteraction'][_0xe586('0x5e')]({'where':{'id':_0x309fb2[_0xe586('0x69')]['id']}})[_0xe586('0x25')](handleEntityNotFound(_0x55adc9,null))['then'](function(_0x5883cf){if(_0x5883cf){return _0x5883cf[_0xe586('0x76')](_0x309fb2[_0xe586('0x68')]['ids'],_[_0xe586('0x77')](_0x309fb2[_0xe586('0x68')],[_0xe586('0x71'),'id'])||{});}})[_0xe586('0x25')](respondWithResult(_0x55adc9,null))[_0xe586('0x2e')](handleError(_0x55adc9,null));};exports[_0xe586('0x78')]=function(_0x2e0feb,_0x272c19,_0x1c1699){var _0x3de296={'raw':![],'where':{}};var _0x1c0be0={};var _0x57a97d={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x2e0feb[_0xe586('0x69')]['id']}})['then'](handleEntityNotFound(_0x272c19,null))['then'](function(_0x2df933){if(_0x2df933){_0x1c0be0['model']=_[_0xe586('0x49')](db[_0xe586('0x79')][_0xe586('0x44')]);_0x1c0be0[_0xe586('0x48')]=_['keys'](_0x2e0feb[_0xe586('0x48')]);_0x1c0be0[_0xe586('0x4a')]=_['intersection'](_0x1c0be0[_0xe586('0x47')],_0x1c0be0[_0xe586('0x48')]);_0x3de296['attributes']=_[_0xe586('0x4b')](_0x1c0be0[_0xe586('0x47')],qs['fields'](_0x2e0feb[_0xe586('0x48')][_0xe586('0x4d')]));_0x3de296['attributes']=_0x3de296[_0xe586('0x4c')]['length']?_0x3de296[_0xe586('0x4c')]:_0x1c0be0[_0xe586('0x47')];if(!_0x2e0feb[_0xe586('0x48')]['hasOwnProperty']('nolimit')){_0x3de296[_0xe586('0x31')]=qs[_0xe586('0x31')](_0x2e0feb[_0xe586('0x48')][_0xe586('0x31')]);_0x3de296[_0xe586('0x30')]=qs[_0xe586('0x30')](_0x2e0feb[_0xe586('0x48')][_0xe586('0x30')]);}_0x3de296[_0xe586('0x6f')]=qs['sort'](_0x2e0feb[_0xe586('0x48')][_0xe586('0x51')]);_0x3de296['where']=qs[_0xe586('0x4a')](_['pick'](_0x2e0feb['query'],_0x1c0be0[_0xe586('0x4a')]));_0x3de296[_0xe586('0x54')][_0xe586('0x6c')]=_0x2df933['id'];if(_0x2e0feb[_0xe586('0x48')]['filter']){_0x3de296[_0xe586('0x54')]=_[_0xe586('0x56')](_0x3de296[_0xe586('0x54')],{'$or':_[_0xe586('0x43')](_0x3de296[_0xe586('0x4c')],function(_0x519da3){var _0x135d4d={};_0x135d4d[_0x519da3]={'$like':'%'+_0x2e0feb[_0xe586('0x48')]['filter']+'%'};return _0x135d4d;})});}_0x3de296=_[_0xe586('0x56')]({},_0x3de296,_0x2e0feb[_0xe586('0x57')]);return db[_0xe586('0x79')][_0xe586('0x2f')]({'where':_0x3de296['where']})[_0xe586('0x25')](function(_0xf8fd6c){_0x57a97d['count']=_0xf8fd6c;if(_0x2e0feb[_0xe586('0x48')][_0xe586('0x59')]){_0x3de296[_0xe586('0x5a')]=[{'model':db[_0xe586('0x7a')],'as':_0xe586('0x7b'),'required':![]},{'model':db[_0xe586('0x7c')],'as':_0xe586('0x7d'),'attributes':[_0xe586('0x40'),_0xe586('0x7e'),_0xe586('0x7f')],'required':![]},{'model':db[_0xe586('0x80')],'as':_0xe586('0x81'),'attributes':['id',_0xe586('0x40'),'color'],'where':_0x2e0feb[_0xe586('0x48')][_0xe586('0x82')]?{'id':_0x2e0feb[_0xe586('0x48')][_0xe586('0x82')]}:undefined,'required':_0x2e0feb[_0xe586('0x48')]['tag']?!![]:![]}];}return db[_0xe586('0x79')][_0xe586('0x5b')](_0x3de296);})['then'](function(_0x5c8902){_0x57a97d['rows']=_0x5c8902;return _0x57a97d;});}})[_0xe586('0x25')](respondWithFilteredResult(_0x272c19,_0x3de296))['catch'](handleError(_0x272c19,null));};exports[_0xe586('0x83')]=function(_0x2765a9,_0x261ec8,_0x497877){return db[_0xe586('0x58')][_0xe586('0x74')]({'where':{'id':_0x2765a9[_0xe586('0x69')]['id']}})[_0xe586('0x25')](handleEntityNotFound(_0x261ec8,null))[_0xe586('0x25')](function(_0x152185){if(_0x152185){return db['sequelize'][_0xe586('0x84')](function(_0x3cd873){return db['FaxApplication'][_0xe586('0x39')]({'where':{'FaxAccountId':_0x2765a9[_0xe586('0x69')]['id']},'transaction':_0x3cd873})[_0xe586('0x25')](function(_0x45494b){var _0x3a4a8f=_['map'](_0x2765a9[_0xe586('0x68')],function(_0x487c06){_0x487c06[_0xe586('0x6c')]=_0x2765a9['params']['id'];return _0x487c06;});return db['FaxApplication'][_0xe586('0x85')](_0x3a4a8f,{'transaction':_0x3cd873});});})[_0xe586('0x25')](function(){return db[_0xe586('0x86')][_0xe586('0x87')]({'where':{'FaxAccountId':_0x2765a9[_0xe586('0x69')]['id']},'order':_0xe586('0x88')});});}})[_0xe586('0x25')](respondWithResult(_0x261ec8,null))[_0xe586('0x2e')](handleError(_0x261ec8,null));};exports[_0xe586('0x89')]=function(_0x52e383,_0xc857f0,_0x1ca7c4){var _0x491f58={};var _0x1d8570={};var _0x32f40b;var _0x4b7ecb;return db[_0xe586('0x58')][_0xe586('0x74')]({'where':{'id':_0x52e383[_0xe586('0x69')]['id']}})[_0xe586('0x25')](handleEntityNotFound(_0xc857f0,null))[_0xe586('0x25')](function(_0x45d08d){if(_0x45d08d){_0x32f40b=_0x45d08d;_0x1d8570['model']=_['keys'](db[_0xe586('0x86')]['rawAttributes']);_0x1d8570[_0xe586('0x48')]=_[_0xe586('0x49')](_0x52e383[_0xe586('0x48')]);_0x1d8570[_0xe586('0x4a')]=_[_0xe586('0x4b')](_0x1d8570[_0xe586('0x47')],_0x1d8570[_0xe586('0x48')]);_0x491f58[_0xe586('0x4c')]=_['intersection'](_0x1d8570['model'],qs[_0xe586('0x4d')](_0x52e383[_0xe586('0x48')][_0xe586('0x4d')]));_0x491f58[_0xe586('0x4c')]=_0x491f58[_0xe586('0x4c')][_0xe586('0x4e')]?_0x491f58['attributes']:_0x1d8570[_0xe586('0x47')];_0x491f58[_0xe586('0x6f')]=qs[_0xe586('0x51')](_0x52e383[_0xe586('0x48')][_0xe586('0x51')]);_0x491f58['where']=qs['filters'](_[_0xe586('0x52')](_0x52e383[_0xe586('0x48')],_0x1d8570[_0xe586('0x4a')]));if(_0x52e383[_0xe586('0x48')]['filter']){_0x491f58[_0xe586('0x54')]=_[_0xe586('0x56')](_0x491f58['where'],{'$or':_[_0xe586('0x43')](_0x491f58[_0xe586('0x4c')],function(_0x121856){var _0x3b11f5={};_0x3b11f5[_0x121856]={'$like':'%'+_0x52e383[_0xe586('0x48')]['filter']+'%'};return _0x3b11f5;})});}_0x491f58=_[_0xe586('0x56')]({},_0x491f58,_0x52e383[_0xe586('0x57')]);return _0x32f40b[_0xe586('0x89')](_0x491f58);}})[_0xe586('0x25')](function(_0x2ea9fd){if(_0x2ea9fd){_0x4b7ecb=_0x2ea9fd[_0xe586('0x4e')];if(!_0x52e383[_0xe586('0x48')][_0xe586('0x4f')](_0xe586('0x50'))){_0x491f58[_0xe586('0x31')]=qs['limit'](_0x52e383[_0xe586('0x48')][_0xe586('0x31')]);_0x491f58['offset']=qs[_0xe586('0x30')](_0x52e383[_0xe586('0x48')][_0xe586('0x30')]);}return _0x32f40b[_0xe586('0x89')](_0x491f58);}})[_0xe586('0x25')](function(_0x46ac5b){if(_0x46ac5b){return _0x46ac5b?{'count':_0x4b7ecb,'rows':_0x46ac5b}:null;}})[_0xe586('0x25')](respondWithResult(_0xc857f0,null))[_0xe586('0x2e')](handleError(_0xc857f0,null));};function Extension(_0x34a4de,_0x10dd0b,_0x38a4f2,_0x1cd18a){this[_0xe586('0x8a')]='from-voip-provider';this[_0xe586('0x8b')]=_0x34a4de[_0xe586('0x8c')];this['app']=_0x1cd18a;this[_0xe586('0x45')]=_0xe586('0x8d');this[_0xe586('0x8e')]='Fax\x20Extension';this[_0xe586('0x6c')]=_0x34a4de['id'];this[_0xe586('0x88')]=_0x10dd0b;this[_0xe586('0x8f')]=_0x38a4f2;}function createExtensionsReciveFax(_0x52f199){var _0x4c3032=0x1;var _0x2e137d=[];_0x2e137d['push'](new Extension(_0x52f199,_0x4c3032,'',_0xe586('0x90')));_0x4c3032+=0x1;_0x2e137d[_0xe586('0x91')](new Extension(_0x52f199,_0x4c3032,_0xe586('0x92'),_0xe586('0x93')));_0x4c3032+=0x1;for(var _0x266238 in _0x52f199){if(_0x52f199[_0xe586('0x4f')](_0x266238)&&(_0x266238===_0xe586('0x94')||_0x266238===_0xe586('0x8c')||_0x266238===_0xe586('0x95')||_0x266238==='faxdetect'||_0x266238===_0xe586('0x96')||_0x266238===_0xe586('0x97')||_0x266238===_0xe586('0x98')||_0x266238===_0xe586('0x99')||_0x266238==='t38timeout')){_0x2e137d['push'](new Extension(_0x52f199,_0x4c3032,_0xe586('0x9a')+_0x266238+')='+_0x52f199[_0x266238],_0xe586('0x93')));_0x4c3032+=0x1;}}_0x2e137d[_0xe586('0x91')](new Extension(_0x52f199,_0x4c3032,'6',_0xe586('0x9b')));_0x4c3032+=0x1;_0x2e137d[_0xe586('0x91')](new Extension(_0x52f199,_0x4c3032,_0xe586('0x9c'),'ReceiveFax'));_0x4c3032=0x0;return _0x2e137d;}exports[_0xe586('0x9d')]=function(_0x487707,_0x470156,_0x35289f){var _0x2d9dd3;return db['sequelize'][_0xe586('0x84')](function(_0x61c644){return db[_0xe586('0x58')][_0xe586('0x5f')](_0x487707[_0xe586('0x68')],{'transaction':_0x61c644})['then'](function(_0x144315){_0x2d9dd3=_0x144315['get']({'plain':!![]});return db[_0xe586('0x9e')][_0xe586('0x85')](createExtensionsReciveFax(_0x2d9dd3),{'transaction':_0x61c644});});})[_0xe586('0x25')](function(){return _0x2d9dd3;})['then'](respondWithResult(_0x470156,null))[_0xe586('0x2e')](handleError(_0x470156,null));};exports['updateAccountApplications']=function(_0x486a59,_0x3fc627,_0x3003f0){var _0x3ec5c8;return db['sequelize'][_0xe586('0x84')](function(_0x4a8dac){return db[_0xe586('0x58')][_0xe586('0x38')](_0x486a59[_0xe586('0x68')],{'where':{'id':_0x486a59[_0xe586('0x68')]['id']},'transaction':_0x4a8dac})[_0xe586('0x25')](function(_0x1dd5ef){return db['VoiceExtension'][_0xe586('0x39')]({'where':{'FaxAccountId':_0x486a59[_0xe586('0x68')]['id']},'transaction':_0x4a8dac})[_0xe586('0x25')](function(_0x59aa6f){return db[_0xe586('0x9e')][_0xe586('0x85')](createExtensionsReciveFax(_[_0xe586('0x77')](_0x486a59[_0xe586('0x68')],[_0xe586('0x9f'),'key',_0xe586('0xa0'),_0xe586('0xa1'),_0xe586('0xa2'),_0xe586('0xa3')])),{'transaction':_0x4a8dac});});});})[_0xe586('0x25')](function(){return db[_0xe586('0x58')][_0xe586('0xa4')](_0x486a59[_0xe586('0x68')]['id']);})[_0xe586('0x25')](respondWithResult(_0x3fc627,null))[_0xe586('0x2e')](handleError(_0x3fc627,null));};exports[_0xe586('0xa5')]=function(_0x29b401,_0x5aca20,_0x1e05ec){var _0x26acc5={'raw':!![],'where':{}};var _0x1aa97f={};var _0x5043d4={'count':0x0,'rows':[]};return db[_0xe586('0x58')][_0xe586('0x74')]({'where':{'id':_0x29b401[_0xe586('0x69')]['id']}})[_0xe586('0x25')](handleEntityNotFound(_0x5aca20,null))['then'](function(_0x254701){if(_0x254701){_0x1aa97f[_0xe586('0x47')]=_[_0xe586('0x49')](db[_0xe586('0xa6')][_0xe586('0x44')]);_0x1aa97f[_0xe586('0x48')]=_[_0xe586('0x49')](_0x29b401['query']);_0x1aa97f['filters']=_[_0xe586('0x4b')](_0x1aa97f[_0xe586('0x47')],_0x1aa97f['query']);_0x26acc5['attributes']=_['intersection'](_0x1aa97f[_0xe586('0x47')],qs[_0xe586('0x4d')](_0x29b401['query']['fields']));_0x26acc5[_0xe586('0x4c')]=_0x26acc5[_0xe586('0x4c')][_0xe586('0x4e')]?_0x26acc5['attributes']:_0x1aa97f[_0xe586('0x47')];if(!_0x29b401[_0xe586('0x48')][_0xe586('0x4f')](_0xe586('0x50'))){_0x26acc5[_0xe586('0x31')]=qs[_0xe586('0x31')](_0x29b401[_0xe586('0x48')]['limit']);_0x26acc5[_0xe586('0x30')]=qs[_0xe586('0x30')](_0x29b401[_0xe586('0x48')]['offset']);}_0x26acc5['order']=qs[_0xe586('0x51')](_0x29b401[_0xe586('0x48')]['sort']);_0x26acc5[_0xe586('0x54')]=qs['filters'](_[_0xe586('0x52')](_0x29b401[_0xe586('0x48')],_0x1aa97f[_0xe586('0x4a')]));_0x26acc5['where'][_0xe586('0x6c')]=_0x254701['id'];if(_0x29b401[_0xe586('0x48')][_0xe586('0x53')]){_0x26acc5[_0xe586('0x54')]=_[_0xe586('0x56')](_0x26acc5[_0xe586('0x54')],{'$or':_[_0xe586('0x43')](_0x26acc5[_0xe586('0x4c')],function(_0x24623d){var _0x19ad92={};_0x19ad92[_0x24623d]={'$like':'%'+_0x29b401[_0xe586('0x48')][_0xe586('0x53')]+'%'};return _0x19ad92;})});}if(_0x29b401[_0xe586('0x48')][_0xe586('0xa7')]){var _0x2d5c11=_0x29b401[_0xe586('0x48')][_0xe586('0xa7')][_0xe586('0xa8')](',');var _0x40e932={};_0x40e932[_0x2d5c11[0x0]]={'$gte':moment(_0x2d5c11[0x1])['format'](_0xe586('0xa9'))};_0x26acc5[_0xe586('0x54')]=_[_0xe586('0x56')](_0x26acc5[_0xe586('0x54')],_0x40e932);}_0x26acc5=_[_0xe586('0x56')]({},_0x26acc5,_0x29b401['options']);return db[_0xe586('0xa6')][_0xe586('0x2f')]({'where':_0x26acc5[_0xe586('0x54')]})['then'](function(_0x53bb2c){_0x5043d4[_0xe586('0x2f')]=_0x53bb2c;if(_0x29b401[_0xe586('0x48')]['includeAll']){_0x26acc5[_0xe586('0x5a')]=[{'all':!![]}];}return db['FaxMessage'][_0xe586('0x5b')](_0x26acc5);})[_0xe586('0x25')](function(_0x3b361b){_0x5043d4[_0xe586('0x5c')]=_0x3b361b;return _0x5043d4;});}})[_0xe586('0x25')](respondWithFilteredResult(_0x5aca20,_0x26acc5))[_0xe586('0x2e')](handleError(_0x5aca20,null));};exports[_0xe586('0xaa')]=function(_0x1ab225,_0x13db53,_0x4098b7){var _0x10e284,_0x2a3eb8={},_0x15bd28;if(_0x1ab225['body']['to']){_0x15bd28=_0x1ab225['body']['to'][0x0];}return db['FaxAccount'][_0xe586('0x5e')]({'where':{'id':_0x1ab225[_0xe586('0x69')]['id']},'include':[{'model':db[_0xe586('0xab')],'as':_0xe586('0xac'),'include':[{'model':db[_0xe586('0x7a')],'as':_0xe586('0xad'),'where':{'fax':_0x15bd28},'limit':0x1,'order':[['updatedAt',_0xe586('0xae')]]}]}]})[_0xe586('0x25')](handleEntityNotFound(_0x13db53,null))[_0xe586('0x25')](function(_0x200e1c){_0x10e284=_0x200e1c;if(_0x1ab225['body']['attachments']&&_0x1ab225[_0xe586('0x68')]['attachments'][_0xe586('0x4e')]){for(var _0x13fb7c=0x0;_0x13fb7c<_0x1ab225['body']['attachments'][_0xe586('0x4e')];_0x13fb7c+=0x1){_0x1ab225[_0xe586('0x68')][_0xe586('0xaf')][_0x13fb7c]={'filename':_0x1ab225['body'][_0xe586('0xaf')][_0x13fb7c][_0xe586('0x40')],'id':_0x1ab225[_0xe586('0x68')][_0xe586('0xaf')][_0x13fb7c]['id'],'path':path[_0xe586('0xb0')](config[_0xe586('0xb1')],_0xe586('0xb2'),_0x1ab225[_0xe586('0x68')][_0xe586('0xaf')][_0x13fb7c][_0xe586('0xb3')])};}}return respondWithRpcPromise(_0xe586('0xb4'),'CheckAfterSend',{'FaxAccountId':_[_0xe586('0xb5')](_0x1ab225[_0xe586('0x69')]['id'])?undefined:_0x1ab225[_0xe586('0x69')]['id'],'path':_['isNil'](_0x1ab225[_0xe586('0x68')][_0xe586('0xaf')][0x0][_0xe586('0x9')])?undefined:_0x1ab225[_0xe586('0x68')][_0xe586('0xaf')][0x0][_0xe586('0x9')],'fax':_[_0xe586('0xb5')](_0x1ab225['body']['to'][0x0])?undefined:_0x1ab225[_0xe586('0x68')]['to'][0x0]},client9002);})[_0xe586('0x25')](function(){if(_0x10e284){if(_[_0xe586('0xb5')](_0x1ab225[_0xe586('0x68')]['from'])){_0x1ab225[_0xe586('0x68')][_0xe586('0xb6')]=util[_0xe586('0xb7')](_0xe586('0xb8'),_0x10e284[_0xe586('0x40')],_0x10e284[_0xe586('0xb9')]);}if(_0x10e284[_0xe586('0xac')]){if(_0x10e284[_0xe586('0xac')][_0xe586('0xad')][_0xe586('0x4e')]){return _0x10e284[_0xe586('0xac')][_0xe586('0xad')][0x0];}else{return db[_0xe586('0x7a')][_0xe586('0x5f')](_[_0xe586('0x19')](_0x1ab225['body'],{'firstName':_0x1ab225['body']['to'][0x0],'phone':_0x1ab225[_0xe586('0x68')]['to'][0x0],'fax':_0x1ab225[_0xe586('0x68')]['to'][0x0],'ListId':_0x10e284['ListId']}));}}else{throw new Error(_0xe586('0xba'));}}else{throw new Error(_0xe586('0xbb'));}})[_0xe586('0x25')](function(_0x429666){if(_0x429666){return db['FaxInteraction']['find']({'where':{'ContactId':_0x429666['id'],'closed':![],'FaxAccountId':_0x10e284['id']}})[_0xe586('0x25')](function(_0x208379){if(_0x208379){return[_0x208379,![]];}return db[_0xe586('0x79')][_0xe586('0x5f')]({'UserId':_0x1ab225[_0xe586('0x62')]['id'],'ContactId':_0x429666['id'],'FaxAccountId':_0x10e284['id'],'fax':_0x1ab225['body']['to'][0x0],'firstMsgDirection':_0xe586('0xbc'),'Messages':[_[_0xe586('0x56')](_0x1ab225['body'],{'read':![],'body':_0x1ab225[_0xe586('0x68')][_0xe586('0xaf')][0x0][_0xe586('0xbd')],'FaxAccountId':_0x10e284['id'],'UserId':_0x1ab225['user']['id'],'ContactId':_0x429666['id'],'AttachmentId':_0x1ab225[_0xe586('0x68')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xe586('0xa6')],'as':'Messages'}]})[_0xe586('0x25')](function(_0x3e936b){return[_0x3e936b,!![]];});});}else{throw new Error(_0xe586('0xbe'));}})[_0xe586('0xbf')](function(_0x2ad9ba,_0x57741b){if(_0x57741b){return _0x2ad9ba;}return db[_0xe586('0xa6')][_0xe586('0x5f')]({'direction':_0xe586('0xbc'),'read':![],'body':_0x1ab225['body']['attachments'][0x0][_0xe586('0xbd')],'FaxAccountId':_0x10e284['id'],'FaxInteractionId':_0x2ad9ba['id'],'UserId':_0x1ab225['user']['id'],'ContactId':_0x2ad9ba[_0xe586('0xc0')],'AttachmentId':_0x1ab225['body'][_0xe586('0xaf')][0x0]['id']})[_0xe586('0x25')](function(_0x16b2e3){_0x2ad9ba['dataValues'][_0xe586('0xc1')]=[];_0x2ad9ba[_0xe586('0xc2')][_0xe586('0xc1')][_0xe586('0x91')](_0x16b2e3[_0xe586('0xc2')]);return _0x2ad9ba;});})['then'](function(_0x226fd3){respondWithRpcPromise('SendFax',_0xe586('0xc3'),{'FaxAccountId':_[_0xe586('0xb5')](_0x1ab225[_0xe586('0x69')]['id'])?undefined:_0x1ab225['params']['id'],'path':_[_0xe586('0xb5')](_0x1ab225[_0xe586('0x68')]['attachments'][0x0][_0xe586('0x9')])?undefined:_0x1ab225[_0xe586('0x68')][_0xe586('0xaf')][0x0][_0xe586('0x9')],'fax':_['isNil'](_0x1ab225[_0xe586('0x68')]['to'][0x0])?undefined:_0x1ab225[_0xe586('0x68')]['to'][0x0],'AttachmentId':_0x1ab225[_0xe586('0x68')][_0xe586('0xaf')][0x0]['id']},client9002)[_0xe586('0x25')](function(_0x34259d){logger[_0xe586('0x26')](_0xe586('0xc4'),_0x34259d);})['catch'](function(_0x475d93){logger[_0xe586('0x26')](_0xe586('0xc4'),_0x475d93);});return _0x226fd3;})[_0xe586('0x25')](respondWithResult(_0x13db53,null))['catch'](handleError(_0x13db53,null));};exports[_0xe586('0xc5')]=function(_0x260c90,_0x6fd58b,_0x427f36){return db['FaxAccount']['find']({'where':{'id':_0x260c90['params']['id']}})[_0xe586('0x25')](handleEntityNotFound(_0x6fd58b,null))[_0xe586('0x25')](function(_0xe9ece2){if(_0xe9ece2){return _0xe9ece2[_0xe586('0xc5')](_0x260c90['body'][_0xe586('0x71')],_[_0xe586('0x77')](_0x260c90[_0xe586('0x68')],[_0xe586('0x71'),'id'])||{})[_0xe586('0xbf')](function(_0x53e842){for(var _0x21ff28=0x0;_0x21ff28<_0x260c90[_0xe586('0x68')]['ids'][_0xe586('0x4e')];_0x21ff28+=0x1){socket['emit'](_0xe586('0xc6'),{'UserId':_0x260c90[_0xe586('0x68')]['ids'][_0x21ff28],'FaxAccountId':_0x260c90[_0xe586('0x69')]['id']});}return _0x53e842;});}})[_0xe586('0x25')](respondWithResult(_0x6fd58b,null))[_0xe586('0x2e')](handleError(_0x6fd58b,null));};exports[_0xe586('0xc7')]=function(_0x191a8c,_0x11170d,_0x505fac){return db[_0xe586('0x58')][_0xe586('0x5e')]({'where':{'id':_0x191a8c[_0xe586('0x69')]['id']}})[_0xe586('0x25')](handleEntityNotFound(_0x11170d,null))['then'](function(_0x1778d0){if(_0x1778d0){return _0x1778d0[_0xe586('0xc7')](_0x191a8c[_0xe586('0x48')][_0xe586('0x71')])[_0xe586('0x25')](function(){if(_[_0xe586('0xc8')](_0x191a8c[_0xe586('0x48')]['ids'])){for(var _0x5a4a0e=0x0;_0x5a4a0e<_0x191a8c[_0xe586('0x48')]['ids'][_0xe586('0x4e')];_0x5a4a0e+=0x1){socket[_0xe586('0xc9')](_0xe586('0xca'),{'UserId':Number(_0x191a8c[_0xe586('0x48')][_0xe586('0x71')][_0x5a4a0e]),'FaxAccountId':Number(_0x191a8c[_0xe586('0x69')]['id'])});}}else{socket[_0xe586('0xc9')](_0xe586('0xca'),{'UserId':Number(_0x191a8c[_0xe586('0x48')][_0xe586('0x71')]),'FaxAccountId':Number(_0x191a8c[_0xe586('0x69')]['id'])});}});}})[_0xe586('0x25')](respondWithStatusCode(_0x11170d,null))[_0xe586('0x2e')](handleError(_0x11170d,null));};exports[_0xe586('0xcb')]=function(_0xa4e50b,_0x15158b,_0x442720){var _0x41dbe1={};var _0x2effb1={};var _0x5700d7;var _0x4c5942;return db[_0xe586('0x58')]['findOne']({'where':{'id':_0xa4e50b[_0xe586('0x69')]['id']}})['then'](handleEntityNotFound(_0x15158b,null))[_0xe586('0x25')](function(_0x345fe2){if(_0x345fe2){_0x5700d7=_0x345fe2;_0x2effb1[_0xe586('0x47')]=_['keys'](db[_0xe586('0x7c')][_0xe586('0x44')]);_0x2effb1[_0xe586('0x48')]=_[_0xe586('0x49')](_0xa4e50b[_0xe586('0x48')]);_0x2effb1[_0xe586('0x4a')]=_[_0xe586('0x4b')](_0x2effb1[_0xe586('0x47')],_0x2effb1[_0xe586('0x48')]);_0x41dbe1[_0xe586('0x4c')]=_[_0xe586('0x4b')](_0x2effb1[_0xe586('0x47')],qs[_0xe586('0x4d')](_0xa4e50b[_0xe586('0x48')]['fields']));_0x41dbe1[_0xe586('0x4c')]=_0x41dbe1['attributes']['length']?_0x41dbe1[_0xe586('0x4c')]:_0x2effb1[_0xe586('0x47')];_0x41dbe1[_0xe586('0x6f')]=qs['sort'](_0xa4e50b['query'][_0xe586('0x51')]);_0x41dbe1['where']=qs[_0xe586('0x4a')](_['pick'](_0xa4e50b[_0xe586('0x48')],_0x2effb1[_0xe586('0x4a')]));if(_0xa4e50b[_0xe586('0x48')][_0xe586('0x53')]){_0x41dbe1['where']=_[_0xe586('0x56')](_0x41dbe1[_0xe586('0x54')],{'$or':_[_0xe586('0x43')](_0x41dbe1[_0xe586('0x4c')],function(_0x36adaa){var _0x531b5e={};_0x531b5e[_0x36adaa]={'$like':'%'+_0xa4e50b['query'][_0xe586('0x53')]+'%'};return _0x531b5e;})});}_0x41dbe1=_[_0xe586('0x56')]({},_0x41dbe1,_0xa4e50b[_0xe586('0x57')]);return _0x5700d7['getAgents'](_0x41dbe1);}})[_0xe586('0x25')](function(_0x4217e5){if(_0x4217e5){_0x4c5942=_0x4217e5['length'];if(!_0xa4e50b['query'][_0xe586('0x4f')](_0xe586('0x50'))){_0x41dbe1[_0xe586('0x31')]=qs[_0xe586('0x31')](_0xa4e50b[_0xe586('0x48')][_0xe586('0x31')]);_0x41dbe1[_0xe586('0x30')]=qs[_0xe586('0x30')](_0xa4e50b[_0xe586('0x48')][_0xe586('0x30')]);}return _0x5700d7[_0xe586('0xcb')](_0x41dbe1);}})[_0xe586('0x25')](function(_0x3ce271){if(_0x3ce271){return _0x3ce271?{'count':_0x4c5942,'rows':_0x3ce271}:null;}})[_0xe586('0x25')](respondWithResult(_0x15158b,null))[_0xe586('0x2e')](handleError(_0x15158b,null));}; \ No newline at end of file +var _0x9be3=['attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','dataValues','SendFax','SendFaxRpc,\x20%s','spread','userFaxAccount:save','isArray','emit','userFaxAccount:remove','getAgents','User','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','end','offset','limit','set','json','reject','save','update','FaxAccounts','UserProfileResource','destroy','sendStatus','name','send','index','mandatoryDispositionPause','map','FaxAccount','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','options','count','includeAll','include','findAll','rows','show','Pause','rawAttributes','find','catch','create','body','user','role','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Owner','internal','Tag','Tags','color','tag','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','exten','localstationid','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','VoiceExtension','updateAccountApplications','createdAt','TrunkId','getMessages','$gte','split','format','FaxMessage','CmList','List','Contacts','updatedAt','DESC'];(function(_0x59b709,_0x458bc3){var _0x1240e3=function(_0x836696){while(--_0x836696){_0x59b709['push'](_0x59b709['shift']());}};_0x1240e3(++_0x458bc3);}(_0x9be3,0xd4));var _0x39be=function(_0x51b80a,_0x355fe3){_0x51b80a=_0x51b80a-0x0;var _0x22fdf0=_0x9be3[_0x51b80a];return _0x22fdf0;};'use strict';var pdf=require(_0x39be('0x0'));var emlformat=require(_0x39be('0x1'));var rimraf=require(_0x39be('0x2'));var zipdir=require(_0x39be('0x3'));var jsonpatch=require(_0x39be('0x4'));var rp=require(_0x39be('0x5'));var moment=require('moment');var BPromise=require(_0x39be('0x6'));var Mustache=require(_0x39be('0x7'));var util=require(_0x39be('0x8'));var path=require(_0x39be('0x9'));var sox=require(_0x39be('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x39be('0xb'));var squel=require(_0x39be('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x39be('0xd'));var toCsv=require(_0x39be('0xe'));var querystring=require('querystring');var Papa=require(_0x39be('0xf'));var Redis=require(_0x39be('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x39be('0x11'));var as=require(_0x39be('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x39be('0x13'))('api');var utils=require(_0x39be('0x14'));var config=require(_0x39be('0x15'));var db=require(_0x39be('0x16'))['db'];config[_0x39be('0x17')]=_[_0x39be('0x18')](config['redis'],{'host':_0x39be('0x19'),'port':0x18eb});var socket=require(_0x39be('0x1a'))(new Redis(config[_0x39be('0x17')]));require(_0x39be('0x1b'))[_0x39be('0x1c')](socket);var jayson=require(_0x39be('0x1d'));var client=jayson[_0x39be('0x1e')][_0x39be('0x1f')]({'port':0x232c});var client9002=jayson[_0x39be('0x1e')][_0x39be('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x50c77b,_0x24ff43,_0x4430a4){if(_0x4430a4){var _0x516ec7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x516ec7[_0x39be('0x20')](_0x24ff43)){return _0x50c77b;}else{throw new db['Sequelize'][(_0x39be('0x21'))](_0x39be('0x22'));}}else{return _0x50c77b;}}function respondWithRpcPromise(_0x1440fe,_0x43f90b,_0x1d35b4,_0x21ac7a){return new BPromise(function(_0x3d8c19,_0x29dbc4){var _0x346a24=_0x21ac7a||client;return _0x346a24['request'](_0x1440fe,_0x1d35b4)[_0x39be('0x23')](function(_0x53396e){logger[_0x39be('0x24')](_0x39be('0x25'),_0x43f90b,_0x39be('0x26'));logger[_0x39be('0x27')](_0x39be('0x28'),_0x43f90b,_0x39be('0x26'),JSON[_0x39be('0x29')](_0x53396e));if(_0x53396e[_0x39be('0x2a')]){if(_0x53396e[_0x39be('0x2a')][_0x39be('0x2b')]===0x1f4){logger[_0x39be('0x2a')](_0x39be('0x25'),_0x43f90b,_0x53396e[_0x39be('0x2a')]['message']);return _0x29dbc4(_0x53396e['error']['message']);}logger['error'](_0x39be('0x25'),_0x43f90b,_0x53396e[_0x39be('0x2a')]['message']);return _0x3d8c19(_0x53396e[_0x39be('0x2a')]['message']);}else{logger[_0x39be('0x24')](_0x39be('0x25'),_0x43f90b,_0x39be('0x26'));_0x3d8c19(_0x53396e['result'][_0x39be('0x2c')]);}})['catch'](function(_0x4526ea){logger['error'](_0x39be('0x25'),_0x43f90b,_0x4526ea);_0x29dbc4(_0x4526ea);});});}function respondWithStatusCode(_0x7c424,_0x5e74d1){_0x5e74d1=_0x5e74d1||0xcc;return function(_0x3c98ca){if(_0x3c98ca){return _0x7c424['sendStatus'](_0x5e74d1);}return _0x7c424[_0x39be('0x2d')](_0x5e74d1)[_0x39be('0x2e')]();};}function respondWithResult(_0x316062,_0x30320b){_0x30320b=_0x30320b||0xc8;return function(_0x48551){if(_0x48551){return _0x316062[_0x39be('0x2d')](_0x30320b)['json'](_0x48551);}};}function respondWithFilteredResult(_0x255323,_0x4c6f60){return function(_0x4c05d0){if(_0x4c05d0){var _0x5bd967=_0x4c05d0['count'],_0x3b9c0a=_0x4c6f60[_0x39be('0x2f')],_0x2fa5f8=_0x4c6f60[_0x39be('0x2f')]+_0x4c6f60[_0x39be('0x30')],_0x3f5790;if(_0x2fa5f8>=_0x5bd967){_0x2fa5f8=_0x5bd967;_0x3f5790=0xc8;}else{_0x3f5790=0xce;}_0x255323[_0x39be('0x2d')](_0x3f5790);return _0x255323[_0x39be('0x31')]('Content-Range',_0x3b9c0a+'-'+_0x2fa5f8+'/'+_0x5bd967)[_0x39be('0x32')](_0x4c05d0);}return null;};}function patchUpdates(_0x4ae10d){return function(_0x3bda92){try{jsonpatch['apply'](_0x3bda92,_0x4ae10d,!![]);}catch(_0x1d4c88){return BPromise[_0x39be('0x33')](_0x1d4c88);}return _0x3bda92[_0x39be('0x34')]();};}function saveUpdates(_0x2d1dd0,_0x8f880f){return function(_0x57746a){if(_0x57746a){return _0x57746a[_0x39be('0x35')](_0x2d1dd0)[_0x39be('0x23')](function(_0x4e97b0){return _0x4e97b0;});}return null;};}function removeEntity(_0x27cc42,_0x14f3ad){return function(_0x27122f){if(_0x27122f){return _0x27122f['destroy']()[_0x39be('0x23')](function(){var _0x2c27a8=_0x27122f['get']({'plain':!![]});var _0x3ca32b=_0x39be('0x36');return db[_0x39be('0x37')][_0x39be('0x38')]({'where':{'type':_0x3ca32b,'resourceId':_0x2c27a8['id']}})['then'](function(){return _0x27122f;});})['then'](function(){_0x27cc42[_0x39be('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5893f4,_0x47694c){return function(_0x258feb){if(!_0x258feb){_0x5893f4[_0x39be('0x39')](0x194);}return _0x258feb;};}function handleError(_0x1eb6cd,_0x2aeb44){_0x2aeb44=_0x2aeb44||0x1f4;return function(_0x33325d){logger[_0x39be('0x2a')](_0x33325d['stack']);if(_0x33325d[_0x39be('0x3a')]){delete _0x33325d[_0x39be('0x3a')];}_0x1eb6cd[_0x39be('0x2d')](_0x2aeb44)[_0x39be('0x3b')](_0x33325d);};}exports[_0x39be('0x3c')]=function(_0x2f0647,_0x10bfe3){var _0x38f3ce={'include':[{'model':db['Pause'],'as':_0x39be('0x3d')}]},_0x1606e8={},_0xf63eba={'count':0x0,'rows':[]};var _0x42acd0=_[_0x39be('0x3e')](db[_0x39be('0x3f')]['rawAttributes'],function(_0x4f0958){return{'name':_0x4f0958[_0x39be('0x40')],'type':_0x4f0958[_0x39be('0x41')][_0x39be('0x42')]};});_0x1606e8[_0x39be('0x43')]=_[_0x39be('0x3e')](_0x42acd0,_0x39be('0x3a'));_0x1606e8[_0x39be('0x44')]=_[_0x39be('0x45')](_0x2f0647[_0x39be('0x44')]);_0x1606e8['filters']=_['intersection'](_0x1606e8[_0x39be('0x43')],_0x1606e8[_0x39be('0x44')]);_0x38f3ce[_0x39be('0x46')]=_[_0x39be('0x47')](_0x1606e8['model'],qs[_0x39be('0x48')](_0x2f0647['query'][_0x39be('0x48')]));_0x38f3ce[_0x39be('0x46')]=_0x38f3ce[_0x39be('0x46')][_0x39be('0x49')]?_0x38f3ce[_0x39be('0x46')]:_0x1606e8['model'];if(!_0x2f0647[_0x39be('0x44')][_0x39be('0x4a')]('nolimit')){_0x38f3ce[_0x39be('0x30')]=qs[_0x39be('0x30')](_0x2f0647[_0x39be('0x44')]['limit']);_0x38f3ce[_0x39be('0x2f')]=qs[_0x39be('0x2f')](_0x2f0647[_0x39be('0x44')]['offset']);}_0x38f3ce[_0x39be('0x4b')]=qs[_0x39be('0x4c')](_0x2f0647['query'][_0x39be('0x4c')]);_0x38f3ce[_0x39be('0x4d')]=qs['filters'](_[_0x39be('0x4e')](_0x2f0647[_0x39be('0x44')],_0x1606e8[_0x39be('0x4f')]),_0x42acd0);if(_0x2f0647[_0x39be('0x44')][_0x39be('0x50')]){_0x38f3ce['where']=_['merge'](_0x38f3ce['where'],{'$or':_[_0x39be('0x3e')](_0x42acd0,function(_0x3c23c2){if(_0x3c23c2[_0x39be('0x41')]!=='VIRTUAL'){var _0x2170df={};_0x2170df[_0x3c23c2[_0x39be('0x3a')]]={'$like':'%'+_0x2f0647[_0x39be('0x44')][_0x39be('0x50')]+'%'};return _0x2170df;}})});}_0x38f3ce=_[_0x39be('0x51')]({},_0x38f3ce,_0x2f0647[_0x39be('0x52')]);var _0x44cbc8={'where':_0x38f3ce[_0x39be('0x4d')]};return db[_0x39be('0x3f')]['count'](_0x44cbc8)[_0x39be('0x23')](function(_0x46619f){_0xf63eba[_0x39be('0x53')]=_0x46619f;if(_0x2f0647[_0x39be('0x44')][_0x39be('0x54')]){_0x38f3ce[_0x39be('0x55')]=[{'all':!![]}];}return db['FaxAccount'][_0x39be('0x56')](_0x38f3ce);})['then'](function(_0x186d55){_0xf63eba[_0x39be('0x57')]=_0x186d55;return _0xf63eba;})[_0x39be('0x23')](respondWithFilteredResult(_0x10bfe3,_0x38f3ce))['catch'](handleError(_0x10bfe3,null));};exports[_0x39be('0x58')]=function(_0xf2b75e,_0x797a62){var _0x501193={'raw':![],'where':{'id':_0xf2b75e['params']['id']},'include':[{'model':db[_0x39be('0x59')],'as':_0x39be('0x3d')}]},_0x5c34c0={};_0x5c34c0['model']=_[_0x39be('0x45')](db[_0x39be('0x3f')][_0x39be('0x5a')]);_0x5c34c0[_0x39be('0x44')]=_[_0x39be('0x45')](_0xf2b75e[_0x39be('0x44')]);_0x5c34c0['filters']=_[_0x39be('0x47')](_0x5c34c0[_0x39be('0x43')],_0x5c34c0[_0x39be('0x44')]);_0x501193[_0x39be('0x46')]=_['intersection'](_0x5c34c0[_0x39be('0x43')],qs[_0x39be('0x48')](_0xf2b75e[_0x39be('0x44')][_0x39be('0x48')]));_0x501193[_0x39be('0x46')]=_0x501193[_0x39be('0x46')][_0x39be('0x49')]?_0x501193[_0x39be('0x46')]:_0x5c34c0[_0x39be('0x43')];if(_0xf2b75e['query'][_0x39be('0x54')]){_0x501193[_0x39be('0x55')]=[{'all':!![]}];}_0x501193=_[_0x39be('0x51')]({},_0x501193,_0xf2b75e[_0x39be('0x52')]);return db[_0x39be('0x3f')][_0x39be('0x5b')](_0x501193)['then'](handleEntityNotFound(_0x797a62,null))[_0x39be('0x23')](respondWithResult(_0x797a62,null))[_0x39be('0x5c')](handleError(_0x797a62,null));};exports[_0x39be('0x5d')]=function(_0x5a9dd8,_0x4d63ac){return db[_0x39be('0x3f')]['create'](_0x5a9dd8[_0x39be('0x5e')],{})[_0x39be('0x23')](function(_0x18bc69){var _0x387a1c=_0x5a9dd8[_0x39be('0x5f')]['get']({'plain':!![]});if(!_0x387a1c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x387a1c[_0x39be('0x60')]===_0x39be('0x5f')){var _0x245e59=_0x18bc69[_0x39be('0x61')]({'plain':!![]});var _0x1b4429=_0x39be('0x36');return db[_0x39be('0x62')]['find']({'where':{'name':_0x1b4429,'userProfileId':_0x387a1c['userProfileId']},'raw':!![]})[_0x39be('0x23')](function(_0x4708de){if(_0x4708de&&_0x4708de[_0x39be('0x63')]===0x0){return db[_0x39be('0x37')][_0x39be('0x5d')]({'name':_0x245e59[_0x39be('0x3a')],'resourceId':_0x245e59['id'],'type':_0x4708de[_0x39be('0x3a')],'sectionId':_0x4708de['id']},{})['then'](function(){return _0x18bc69;});}else{return _0x18bc69;}})[_0x39be('0x5c')](function(_0x12c957){logger['error'](_0x39be('0x64'),_0x12c957);throw _0x12c957;});}return _0x18bc69;})[_0x39be('0x23')](respondWithResult(_0x4d63ac,0xc9))['catch'](handleError(_0x4d63ac,null));};exports['update']=function(_0x57234b,_0x4712c4){if(_0x57234b['body']['id']){delete _0x57234b['body']['id'];}return db[_0x39be('0x3f')]['find']({'where':{'id':_0x57234b[_0x39be('0x65')]['id']},'include':[{'model':db['Pause'],'as':_0x39be('0x3d')}]})[_0x39be('0x23')](handleEntityNotFound(_0x4712c4,null))[_0x39be('0x23')](saveUpdates(_0x57234b['body'],null))[_0x39be('0x23')](respondWithResult(_0x4712c4,null))['catch'](handleError(_0x4712c4,null));};exports['destroy']=function(_0x1f0ec8,_0x35d8ab){return db[_0x39be('0x3f')][_0x39be('0x5b')]({'where':{'id':_0x1f0ec8['params']['id']}})[_0x39be('0x23')](handleEntityNotFound(_0x35d8ab,null))[_0x39be('0x23')](removeEntity(_0x35d8ab,null))[_0x39be('0x5c')](handleError(_0x35d8ab,null));};exports[_0x39be('0x66')]=function(_0x4d6db4,_0x37048d){return db['FaxAccount'][_0x39be('0x66')]()['then'](respondWithResult(_0x37048d,null))[_0x39be('0x5c')](handleError(_0x37048d,null));};exports[_0x39be('0x67')]=function(_0x1e878c,_0x2a2e21,_0x2d37ba){if(_0x1e878c[_0x39be('0x5e')]['id']){delete _0x1e878c[_0x39be('0x5e')]['id'];}return db[_0x39be('0x3f')][_0x39be('0x5b')]({'where':{'id':_0x1e878c[_0x39be('0x65')]['id']}})[_0x39be('0x23')](handleEntityNotFound(_0x2a2e21,null))[_0x39be('0x23')](function(_0x20507f){if(_0x20507f){_0x1e878c['body'][_0x39be('0x68')]=_0x20507f['id'];return db['Disposition']['create'](_0x1e878c[_0x39be('0x5e')]);}})[_0x39be('0x23')](respondWithResult(_0x2a2e21,null))[_0x39be('0x5c')](handleError(_0x2a2e21,null));};exports[_0x39be('0x69')]=function(_0x4f21c9,_0xfeccba,_0x45ea07){var _0x757d3a={'raw':![],'where':{}};var _0x47aa4f={};var _0xca663c={'count':0x0,'rows':[]};return db[_0x39be('0x3f')][_0x39be('0x6a')]({'where':{'id':_0x4f21c9[_0x39be('0x65')]['id']}})[_0x39be('0x23')](handleEntityNotFound(_0xfeccba,null))['then'](function(_0x476a9e){if(_0x476a9e){_0x47aa4f[_0x39be('0x43')]=_['keys'](db[_0x39be('0x6b')]['rawAttributes']);_0x47aa4f[_0x39be('0x44')]=_[_0x39be('0x45')](_0x4f21c9['query']);_0x47aa4f[_0x39be('0x4f')]=_[_0x39be('0x47')](_0x47aa4f[_0x39be('0x43')],_0x47aa4f['query']);_0x757d3a[_0x39be('0x46')]=_[_0x39be('0x47')](_0x47aa4f[_0x39be('0x43')],qs[_0x39be('0x48')](_0x4f21c9['query']['fields']));_0x757d3a[_0x39be('0x46')]=_0x757d3a[_0x39be('0x46')][_0x39be('0x49')]?_0x757d3a[_0x39be('0x46')]:_0x47aa4f[_0x39be('0x43')];if(!_0x4f21c9['query'][_0x39be('0x4a')](_0x39be('0x6c'))){_0x757d3a[_0x39be('0x30')]=qs[_0x39be('0x30')](_0x4f21c9['query'][_0x39be('0x30')]);_0x757d3a['offset']=qs['offset'](_0x4f21c9[_0x39be('0x44')][_0x39be('0x2f')]);}_0x757d3a[_0x39be('0x4b')]=qs[_0x39be('0x4c')](_0x4f21c9[_0x39be('0x44')]['sort']);_0x757d3a[_0x39be('0x4d')]=qs[_0x39be('0x4f')](_[_0x39be('0x4e')](_0x4f21c9['query'],_0x47aa4f[_0x39be('0x4f')]));_0x757d3a[_0x39be('0x4d')][_0x39be('0x68')]=_0x476a9e['id'];if(_0x4f21c9[_0x39be('0x44')][_0x39be('0x50')]){_0x757d3a[_0x39be('0x4d')]=_[_0x39be('0x51')](_0x757d3a['where'],{'$or':_['map'](_0x757d3a[_0x39be('0x46')],function(_0x3a557a){var _0x396839={};_0x396839[_0x3a557a]={'$like':'%'+_0x4f21c9[_0x39be('0x44')][_0x39be('0x50')]+'%'};return _0x396839;})});}_0x757d3a=_[_0x39be('0x51')]({},_0x757d3a,_0x4f21c9[_0x39be('0x52')]);return db[_0x39be('0x6b')]['count']({'where':_0x757d3a['where']})[_0x39be('0x23')](function(_0x55e7e8){_0xca663c['count']=_0x55e7e8;if(_0x4f21c9[_0x39be('0x44')][_0x39be('0x54')]){_0x757d3a[_0x39be('0x55')]=[{'all':!![]}];}return db[_0x39be('0x6b')][_0x39be('0x56')](_0x757d3a);})[_0x39be('0x23')](function(_0x3023b8){_0xca663c[_0x39be('0x57')]=_0x3023b8;return _0xca663c;});}})[_0x39be('0x23')](respondWithFilteredResult(_0xfeccba,_0x757d3a))['catch'](handleError(_0xfeccba,null));};exports[_0x39be('0x6d')]=function(_0x37857b,_0x1a6fc7,_0x1524c5){return db[_0x39be('0x3f')][_0x39be('0x5b')]({'where':{'id':_0x37857b[_0x39be('0x65')]['id']}})[_0x39be('0x23')](handleEntityNotFound(_0x1a6fc7,null))[_0x39be('0x23')](function(_0xb4d509){if(_0xb4d509){return _0xb4d509['removeDispositions'](_0x37857b[_0x39be('0x44')][_0x39be('0x6e')]);}})[_0x39be('0x23')](respondWithStatusCode(_0x1a6fc7,null))[_0x39be('0x5c')](handleError(_0x1a6fc7,null));};exports[_0x39be('0x6f')]=function(_0x355c00,_0x264096,_0x205057){if(_0x355c00[_0x39be('0x5e')]['id']){delete _0x355c00[_0x39be('0x5e')]['id'];}return db[_0x39be('0x3f')]['find']({'where':{'id':_0x355c00['params']['id']}})['then'](handleEntityNotFound(_0x264096,null))[_0x39be('0x23')](function(_0x2bc7d1){if(_0x2bc7d1){_0x355c00['body'][_0x39be('0x68')]=_0x2bc7d1['id'];return db[_0x39be('0x70')]['create'](_0x355c00[_0x39be('0x5e')]);}})[_0x39be('0x23')](respondWithResult(_0x264096,null))['catch'](handleError(_0x264096,null));};exports[_0x39be('0x71')]=function(_0x2dc2b6,_0xba7571,_0xc2e1b7){var _0x49681c={'raw':![],'where':{}};var _0x3dea5e={};var _0x3049dd={'count':0x0,'rows':[]};return db[_0x39be('0x3f')][_0x39be('0x6a')]({'where':{'id':_0x2dc2b6[_0x39be('0x65')]['id']}})['then'](handleEntityNotFound(_0xba7571,null))[_0x39be('0x23')](function(_0xb54826){if(_0xb54826){_0x3dea5e[_0x39be('0x43')]=_[_0x39be('0x45')](db['CannedAnswer']['rawAttributes']);_0x3dea5e[_0x39be('0x44')]=_[_0x39be('0x45')](_0x2dc2b6[_0x39be('0x44')]);_0x3dea5e['filters']=_['intersection'](_0x3dea5e[_0x39be('0x43')],_0x3dea5e['query']);_0x49681c[_0x39be('0x46')]=_['intersection'](_0x3dea5e['model'],qs[_0x39be('0x48')](_0x2dc2b6['query'][_0x39be('0x48')]));_0x49681c[_0x39be('0x46')]=_0x49681c[_0x39be('0x46')][_0x39be('0x49')]?_0x49681c[_0x39be('0x46')]:_0x3dea5e[_0x39be('0x43')];if(!_0x2dc2b6[_0x39be('0x44')][_0x39be('0x4a')]('nolimit')){_0x49681c['limit']=qs[_0x39be('0x30')](_0x2dc2b6[_0x39be('0x44')][_0x39be('0x30')]);_0x49681c[_0x39be('0x2f')]=qs[_0x39be('0x2f')](_0x2dc2b6[_0x39be('0x44')][_0x39be('0x2f')]);}_0x49681c['order']=qs[_0x39be('0x4c')](_0x2dc2b6['query']['sort']);_0x49681c[_0x39be('0x4d')]=qs[_0x39be('0x4f')](_[_0x39be('0x4e')](_0x2dc2b6[_0x39be('0x44')],_0x3dea5e[_0x39be('0x4f')]));_0x49681c['where'][_0x39be('0x68')]=_0xb54826['id'];if(_0x2dc2b6['query'][_0x39be('0x50')]){_0x49681c[_0x39be('0x4d')]=_['merge'](_0x49681c[_0x39be('0x4d')],{'$or':_[_0x39be('0x3e')](_0x49681c[_0x39be('0x46')],function(_0x400239){var _0x5e5f08={};_0x5e5f08[_0x400239]={'$like':'%'+_0x2dc2b6[_0x39be('0x44')][_0x39be('0x50')]+'%'};return _0x5e5f08;})});}_0x49681c=_[_0x39be('0x51')]({},_0x49681c,_0x2dc2b6[_0x39be('0x52')]);return db[_0x39be('0x70')][_0x39be('0x53')]({'where':_0x49681c[_0x39be('0x4d')]})[_0x39be('0x23')](function(_0x33ed8e){_0x3049dd['count']=_0x33ed8e;if(_0x2dc2b6['query'][_0x39be('0x54')]){_0x49681c['include']=[{'all':!![]}];}return db[_0x39be('0x70')][_0x39be('0x56')](_0x49681c);})[_0x39be('0x23')](function(_0x2058df){_0x3049dd[_0x39be('0x57')]=_0x2058df;return _0x3049dd;});}})[_0x39be('0x23')](respondWithFilteredResult(_0xba7571,_0x49681c))[_0x39be('0x5c')](handleError(_0xba7571,null));};exports['removeAnswers']=function(_0x5e4a6b,_0x29ea90,_0x3e9b41){return db[_0x39be('0x3f')][_0x39be('0x5b')]({'where':{'id':_0x5e4a6b[_0x39be('0x65')]['id']}})[_0x39be('0x23')](handleEntityNotFound(_0x29ea90,null))[_0x39be('0x23')](function(_0x1b73be){if(_0x1b73be){return _0x1b73be['removeAnswers'](_0x5e4a6b[_0x39be('0x44')][_0x39be('0x6e')]);}})['then'](respondWithStatusCode(_0x29ea90,null))['catch'](handleError(_0x29ea90,null));};exports[_0x39be('0x72')]=function(_0x10dcf9,_0x24eb9a,_0x379699){return db['FaxInteraction'][_0x39be('0x5b')]({'where':{'id':_0x10dcf9['params']['id']}})['then'](handleEntityNotFound(_0x24eb9a,null))[_0x39be('0x23')](function(_0xeeb1e7){if(_0xeeb1e7){return _0xeeb1e7['addInteraction'](_0x10dcf9[_0x39be('0x5e')][_0x39be('0x6e')],_[_0x39be('0x73')](_0x10dcf9['body'],[_0x39be('0x6e'),'id'])||{});}})[_0x39be('0x23')](respondWithResult(_0x24eb9a,null))['catch'](handleError(_0x24eb9a,null));};exports[_0x39be('0x74')]=function(_0x5c5cda,_0xfb0074,_0x28a5e1){var _0x3b1ca7={'raw':![],'where':{}};var _0x5354d5={};var _0x43ba1a={'count':0x0,'rows':[]};return db[_0x39be('0x3f')][_0x39be('0x6a')]({'where':{'id':_0x5c5cda[_0x39be('0x65')]['id']}})[_0x39be('0x23')](handleEntityNotFound(_0xfb0074,null))[_0x39be('0x23')](function(_0x37db5e){if(_0x37db5e){_0x5354d5[_0x39be('0x43')]=_[_0x39be('0x45')](db[_0x39be('0x75')][_0x39be('0x5a')]);_0x5354d5[_0x39be('0x44')]=_[_0x39be('0x45')](_0x5c5cda[_0x39be('0x44')]);_0x5354d5['filters']=_[_0x39be('0x47')](_0x5354d5['model'],_0x5354d5[_0x39be('0x44')]);_0x3b1ca7[_0x39be('0x46')]=_[_0x39be('0x47')](_0x5354d5[_0x39be('0x43')],qs['fields'](_0x5c5cda[_0x39be('0x44')][_0x39be('0x48')]));_0x3b1ca7[_0x39be('0x46')]=_0x3b1ca7['attributes']['length']?_0x3b1ca7[_0x39be('0x46')]:_0x5354d5[_0x39be('0x43')];if(!_0x5c5cda[_0x39be('0x44')][_0x39be('0x4a')](_0x39be('0x6c'))){_0x3b1ca7['limit']=qs['limit'](_0x5c5cda[_0x39be('0x44')][_0x39be('0x30')]);_0x3b1ca7[_0x39be('0x2f')]=qs[_0x39be('0x2f')](_0x5c5cda[_0x39be('0x44')]['offset']);}_0x3b1ca7[_0x39be('0x4b')]=qs[_0x39be('0x4c')](_0x5c5cda['query'][_0x39be('0x4c')]);_0x3b1ca7['where']=qs['filters'](_[_0x39be('0x4e')](_0x5c5cda[_0x39be('0x44')],_0x5354d5[_0x39be('0x4f')]));_0x3b1ca7[_0x39be('0x4d')]['FaxAccountId']=_0x37db5e['id'];if(_0x5c5cda[_0x39be('0x44')][_0x39be('0x50')]){_0x3b1ca7['where']=_['merge'](_0x3b1ca7['where'],{'$or':_['map'](_0x3b1ca7[_0x39be('0x46')],function(_0x1aa6c1){var _0x6d5e1b={};_0x6d5e1b[_0x1aa6c1]={'$like':'%'+_0x5c5cda['query'][_0x39be('0x50')]+'%'};return _0x6d5e1b;})});}_0x3b1ca7=_[_0x39be('0x51')]({},_0x3b1ca7,_0x5c5cda[_0x39be('0x52')]);return db[_0x39be('0x75')][_0x39be('0x53')]({'where':_0x3b1ca7[_0x39be('0x4d')]})[_0x39be('0x23')](function(_0x3a8796){_0x43ba1a[_0x39be('0x53')]=_0x3a8796;if(_0x5c5cda[_0x39be('0x44')][_0x39be('0x54')]){_0x3b1ca7[_0x39be('0x55')]=[{'model':db[_0x39be('0x76')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x39be('0x77'),'attributes':[_0x39be('0x3a'),'fullname',_0x39be('0x78')],'required':![]},{'model':db[_0x39be('0x79')],'as':_0x39be('0x7a'),'attributes':['id',_0x39be('0x3a'),_0x39be('0x7b')],'where':_0x5c5cda[_0x39be('0x44')][_0x39be('0x7c')]?{'id':_0x5c5cda[_0x39be('0x44')][_0x39be('0x7c')]}:undefined,'required':_0x5c5cda['query'][_0x39be('0x7c')]?!![]:![]}];}return db[_0x39be('0x75')][_0x39be('0x56')](_0x3b1ca7);})[_0x39be('0x23')](function(_0x15aeaa){_0x43ba1a[_0x39be('0x57')]=_0x15aeaa;return _0x43ba1a;});}})[_0x39be('0x23')](respondWithFilteredResult(_0xfb0074,_0x3b1ca7))['catch'](handleError(_0xfb0074,null));};exports['addApplications']=function(_0x4e16be,_0x2b6425,_0x5ec79d){return db[_0x39be('0x3f')][_0x39be('0x6a')]({'where':{'id':_0x4e16be[_0x39be('0x65')]['id']}})[_0x39be('0x23')](handleEntityNotFound(_0x2b6425,null))[_0x39be('0x23')](function(_0x18fd86){if(_0x18fd86){return db[_0x39be('0x7d')][_0x39be('0x7e')](function(_0x91f48c){return db[_0x39be('0x7f')][_0x39be('0x38')]({'where':{'FaxAccountId':_0x4e16be[_0x39be('0x65')]['id']},'transaction':_0x91f48c})['then'](function(_0x110d74){var _0x4a77c8=_[_0x39be('0x3e')](_0x4e16be[_0x39be('0x5e')],function(_0x569a15){_0x569a15[_0x39be('0x68')]=_0x4e16be[_0x39be('0x65')]['id'];return _0x569a15;});return db[_0x39be('0x7f')][_0x39be('0x80')](_0x4a77c8,{'transaction':_0x91f48c});});})[_0x39be('0x23')](function(){return db[_0x39be('0x7f')][_0x39be('0x81')]({'where':{'FaxAccountId':_0x4e16be[_0x39be('0x65')]['id']},'order':_0x39be('0x82')});});}})[_0x39be('0x23')](respondWithResult(_0x2b6425,null))[_0x39be('0x5c')](handleError(_0x2b6425,null));};exports[_0x39be('0x83')]=function(_0x106df3,_0x5ae747,_0x1616c4){var _0x2577b3={};var _0xfb28f7={};var _0x557b66;var _0x2dbb5a;return db['FaxAccount']['findOne']({'where':{'id':_0x106df3[_0x39be('0x65')]['id']}})[_0x39be('0x23')](handleEntityNotFound(_0x5ae747,null))[_0x39be('0x23')](function(_0x8a51da){if(_0x8a51da){_0x557b66=_0x8a51da;_0xfb28f7[_0x39be('0x43')]=_[_0x39be('0x45')](db['FaxApplication']['rawAttributes']);_0xfb28f7[_0x39be('0x44')]=_[_0x39be('0x45')](_0x106df3[_0x39be('0x44')]);_0xfb28f7[_0x39be('0x4f')]=_[_0x39be('0x47')](_0xfb28f7['model'],_0xfb28f7[_0x39be('0x44')]);_0x2577b3[_0x39be('0x46')]=_[_0x39be('0x47')](_0xfb28f7[_0x39be('0x43')],qs['fields'](_0x106df3[_0x39be('0x44')][_0x39be('0x48')]));_0x2577b3['attributes']=_0x2577b3[_0x39be('0x46')]['length']?_0x2577b3[_0x39be('0x46')]:_0xfb28f7[_0x39be('0x43')];_0x2577b3[_0x39be('0x4b')]=qs[_0x39be('0x4c')](_0x106df3['query']['sort']);_0x2577b3['where']=qs[_0x39be('0x4f')](_['pick'](_0x106df3[_0x39be('0x44')],_0xfb28f7[_0x39be('0x4f')]));if(_0x106df3[_0x39be('0x44')]['filter']){_0x2577b3[_0x39be('0x4d')]=_[_0x39be('0x51')](_0x2577b3[_0x39be('0x4d')],{'$or':_[_0x39be('0x3e')](_0x2577b3[_0x39be('0x46')],function(_0x16f8c3){var _0x5d25e5={};_0x5d25e5[_0x16f8c3]={'$like':'%'+_0x106df3[_0x39be('0x44')]['filter']+'%'};return _0x5d25e5;})});}_0x2577b3=_[_0x39be('0x51')]({},_0x2577b3,_0x106df3[_0x39be('0x52')]);return _0x557b66[_0x39be('0x83')](_0x2577b3);}})[_0x39be('0x23')](function(_0x4643d4){if(_0x4643d4){_0x2dbb5a=_0x4643d4[_0x39be('0x49')];if(!_0x106df3['query'][_0x39be('0x4a')](_0x39be('0x6c'))){_0x2577b3[_0x39be('0x30')]=qs[_0x39be('0x30')](_0x106df3[_0x39be('0x44')][_0x39be('0x30')]);_0x2577b3[_0x39be('0x2f')]=qs[_0x39be('0x2f')](_0x106df3[_0x39be('0x44')][_0x39be('0x2f')]);}return _0x557b66[_0x39be('0x83')](_0x2577b3);}})[_0x39be('0x23')](function(_0x1df8d4){if(_0x1df8d4){return _0x1df8d4?{'count':_0x2dbb5a,'rows':_0x1df8d4}:null;}})['then'](respondWithResult(_0x5ae747,null))[_0x39be('0x5c')](handleError(_0x5ae747,null));};function Extension(_0x2cc5bb,_0x488eb7,_0x335cf5,_0x5e6557){this['context']=_0x39be('0x84');this[_0x39be('0x85')]=_0x2cc5bb[_0x39be('0x86')];this['app']=_0x5e6557;this[_0x39be('0x41')]='system';this['description']=_0x39be('0x87');this['FaxAccountId']=_0x2cc5bb['id'];this[_0x39be('0x82')]=_0x488eb7;this['appdata']=_0x335cf5;}function createExtensionsReciveFax(_0x504ae0){var _0x4ea43f=0x1;var _0xe58ac8=[];_0xe58ac8[_0x39be('0x88')](new Extension(_0x504ae0,_0x4ea43f,'',_0x39be('0x89')));_0x4ea43f+=0x1;_0xe58ac8[_0x39be('0x88')](new Extension(_0x504ae0,_0x4ea43f,_0x39be('0x8a'),'Set'));_0x4ea43f+=0x1;for(var _0x3b96cd in _0x504ae0){if(_0x504ae0[_0x39be('0x4a')](_0x3b96cd)&&(_0x3b96cd==='ecm'||_0x3b96cd===_0x39be('0x86')||_0x3b96cd==='gateway'||_0x3b96cd==='faxdetect'||_0x3b96cd===_0x39be('0x8b')||_0x3b96cd===_0x39be('0x8c')||_0x3b96cd===_0x39be('0x8d')||_0x3b96cd===_0x39be('0x8e')||_0x3b96cd===_0x39be('0x8f'))){_0xe58ac8[_0x39be('0x88')](new Extension(_0x504ae0,_0x4ea43f,_0x39be('0x90')+_0x3b96cd+')='+_0x504ae0[_0x3b96cd],_0x39be('0x91')));_0x4ea43f+=0x1;}}_0xe58ac8['push'](new Extension(_0x504ae0,_0x4ea43f,'6',_0x39be('0x92')));_0x4ea43f+=0x1;_0xe58ac8['push'](new Extension(_0x504ae0,_0x4ea43f,_0x39be('0x93'),'ReceiveFax'));_0x4ea43f=0x0;return _0xe58ac8;}exports['addAccountApplications']=function(_0xb0300d,_0x3516f5,_0x55c3e6){var _0x37a5be;return db[_0x39be('0x7d')][_0x39be('0x7e')](function(_0x93272d){return db[_0x39be('0x3f')]['create'](_0xb0300d[_0x39be('0x5e')],{'transaction':_0x93272d})[_0x39be('0x23')](function(_0x8d25e4){_0x37a5be=_0x8d25e4[_0x39be('0x61')]({'plain':!![]});return db[_0x39be('0x94')][_0x39be('0x80')](createExtensionsReciveFax(_0x37a5be),{'transaction':_0x93272d});});})['then'](function(){return _0x37a5be;})[_0x39be('0x23')](respondWithResult(_0x3516f5,null))[_0x39be('0x5c')](handleError(_0x3516f5,null));};exports[_0x39be('0x95')]=function(_0x3d36f6,_0x96d429,_0x2de42c){var _0x448eef;return db[_0x39be('0x7d')][_0x39be('0x7e')](function(_0x5d9f50){return db[_0x39be('0x3f')][_0x39be('0x35')](_0x3d36f6[_0x39be('0x5e')],{'where':{'id':_0x3d36f6[_0x39be('0x5e')]['id']},'transaction':_0x5d9f50})[_0x39be('0x23')](function(_0x2b215c){return db[_0x39be('0x94')]['destroy']({'where':{'FaxAccountId':_0x3d36f6[_0x39be('0x5e')]['id']},'transaction':_0x5d9f50})[_0x39be('0x23')](function(_0x1a9290){return db[_0x39be('0x94')][_0x39be('0x80')](createExtensionsReciveFax(_[_0x39be('0x73')](_0x3d36f6['body'],['tech','key',_0x39be('0x96'),'updatedAt',_0x39be('0x97'),'ListId'])),{'transaction':_0x5d9f50});});});})[_0x39be('0x23')](function(){return db[_0x39be('0x3f')]['findById'](_0x3d36f6['body']['id']);})['then'](respondWithResult(_0x96d429,null))['catch'](handleError(_0x96d429,null));};exports[_0x39be('0x98')]=function(_0x61bbbe,_0x3e8c77,_0x282ffc){var _0xbd0ef7={'raw':!![],'where':{}};var _0xcd98d1={};var _0x43fe4f={'count':0x0,'rows':[]};return db[_0x39be('0x3f')][_0x39be('0x6a')]({'where':{'id':_0x61bbbe[_0x39be('0x65')]['id']}})[_0x39be('0x23')](handleEntityNotFound(_0x3e8c77,null))[_0x39be('0x23')](function(_0x32ba3e){if(_0x32ba3e){_0xcd98d1[_0x39be('0x43')]=_['keys'](db['FaxMessage']['rawAttributes']);_0xcd98d1[_0x39be('0x44')]=_['keys'](_0x61bbbe[_0x39be('0x44')]);_0xcd98d1[_0x39be('0x4f')]=_[_0x39be('0x47')](_0xcd98d1['model'],_0xcd98d1[_0x39be('0x44')]);_0xbd0ef7[_0x39be('0x46')]=_[_0x39be('0x47')](_0xcd98d1[_0x39be('0x43')],qs[_0x39be('0x48')](_0x61bbbe[_0x39be('0x44')][_0x39be('0x48')]));_0xbd0ef7[_0x39be('0x46')]=_0xbd0ef7[_0x39be('0x46')]['length']?_0xbd0ef7[_0x39be('0x46')]:_0xcd98d1[_0x39be('0x43')];if(!_0x61bbbe[_0x39be('0x44')][_0x39be('0x4a')]('nolimit')){_0xbd0ef7[_0x39be('0x30')]=qs[_0x39be('0x30')](_0x61bbbe[_0x39be('0x44')][_0x39be('0x30')]);_0xbd0ef7['offset']=qs[_0x39be('0x2f')](_0x61bbbe['query'][_0x39be('0x2f')]);}_0xbd0ef7[_0x39be('0x4b')]=qs[_0x39be('0x4c')](_0x61bbbe[_0x39be('0x44')][_0x39be('0x4c')]);_0xbd0ef7[_0x39be('0x4d')]=qs[_0x39be('0x4f')](_['pick'](_0x61bbbe[_0x39be('0x44')],_0xcd98d1[_0x39be('0x4f')]));_0xbd0ef7['where'][_0x39be('0x68')]=_0x32ba3e['id'];if(_0x61bbbe[_0x39be('0x44')][_0x39be('0x50')]){_0xbd0ef7[_0x39be('0x4d')]=_[_0x39be('0x51')](_0xbd0ef7[_0x39be('0x4d')],{'$or':_['map'](_0xbd0ef7[_0x39be('0x46')],function(_0x50a357){var _0x2823a3={};_0x2823a3[_0x50a357]={'$like':'%'+_0x61bbbe['query']['filter']+'%'};return _0x2823a3;})});}if(_0x61bbbe[_0x39be('0x44')][_0x39be('0x99')]){var _0x5482df=_0x61bbbe['query'][_0x39be('0x99')][_0x39be('0x9a')](',');var _0x1e8122={};_0x1e8122[_0x5482df[0x0]]={'$gte':moment(_0x5482df[0x1])[_0x39be('0x9b')]('YYYY-MM-DD\x20HH:mm:ss')};_0xbd0ef7[_0x39be('0x4d')]=_['merge'](_0xbd0ef7[_0x39be('0x4d')],_0x1e8122);}_0xbd0ef7=_[_0x39be('0x51')]({},_0xbd0ef7,_0x61bbbe[_0x39be('0x52')]);return db[_0x39be('0x9c')][_0x39be('0x53')]({'where':_0xbd0ef7['where']})[_0x39be('0x23')](function(_0x1486f1){_0x43fe4f[_0x39be('0x53')]=_0x1486f1;if(_0x61bbbe['query']['includeAll']){_0xbd0ef7[_0x39be('0x55')]=[{'all':!![]}];}return db['FaxMessage'][_0x39be('0x56')](_0xbd0ef7);})['then'](function(_0x28e64c){_0x43fe4f[_0x39be('0x57')]=_0x28e64c;return _0x43fe4f;});}})[_0x39be('0x23')](respondWithFilteredResult(_0x3e8c77,_0xbd0ef7))['catch'](handleError(_0x3e8c77,null));};exports[_0x39be('0x3b')]=function(_0x19be26,_0x3afb49,_0xcceae9){var _0x4dd888,_0x27e53f={},_0x185a02;if(_0x19be26['body']['to']){_0x185a02=_0x19be26[_0x39be('0x5e')]['to'][0x0];}return db[_0x39be('0x3f')][_0x39be('0x5b')]({'where':{'id':_0x19be26[_0x39be('0x65')]['id']},'include':[{'model':db[_0x39be('0x9d')],'as':_0x39be('0x9e'),'include':[{'model':db[_0x39be('0x76')],'as':_0x39be('0x9f'),'where':{'fax':_0x185a02},'limit':0x1,'order':[[_0x39be('0xa0'),_0x39be('0xa1')]]}]}]})['then'](handleEntityNotFound(_0x3afb49,null))[_0x39be('0x23')](function(_0x403d32){_0x4dd888=_0x403d32;if(_0x19be26['body']['attachments']&&_0x19be26[_0x39be('0x5e')][_0x39be('0xa2')][_0x39be('0x49')]){for(var _0x188ac0=0x0;_0x188ac0<_0x19be26[_0x39be('0x5e')][_0x39be('0xa2')][_0x39be('0x49')];_0x188ac0+=0x1){_0x19be26[_0x39be('0x5e')][_0x39be('0xa2')][_0x188ac0]={'filename':_0x19be26['body']['attachments'][_0x188ac0]['name'],'id':_0x19be26[_0x39be('0x5e')]['attachments'][_0x188ac0]['id'],'path':path[_0x39be('0xa3')](config['root'],_0x39be('0xa4'),_0x19be26[_0x39be('0x5e')][_0x39be('0xa2')][_0x188ac0][_0x39be('0xa5')])};}}return respondWithRpcPromise('CheckAfterSend',_0x39be('0xa6'),{'FaxAccountId':_[_0x39be('0xa7')](_0x19be26[_0x39be('0x65')]['id'])?undefined:_0x19be26['params']['id'],'path':_['isNil'](_0x19be26[_0x39be('0x5e')][_0x39be('0xa2')][0x0][_0x39be('0x9')])?undefined:_0x19be26[_0x39be('0x5e')][_0x39be('0xa2')][0x0][_0x39be('0x9')],'fax':_['isNil'](_0x19be26[_0x39be('0x5e')]['to'][0x0])?undefined:_0x19be26['body']['to'][0x0]},client9002);})['then'](function(){if(_0x4dd888){if(_[_0x39be('0xa7')](_0x19be26[_0x39be('0x5e')]['from'])){_0x19be26[_0x39be('0x5e')][_0x39be('0xa8')]=util['format'](_0x39be('0xa9'),_0x4dd888[_0x39be('0x3a')],_0x4dd888['fax']);}if(_0x4dd888['List']){if(_0x4dd888[_0x39be('0x9e')][_0x39be('0x9f')][_0x39be('0x49')]){return _0x4dd888[_0x39be('0x9e')][_0x39be('0x9f')][0x0];}else{return db['CmContact'][_0x39be('0x5d')](_[_0x39be('0x18')](_0x19be26[_0x39be('0x5e')],{'firstName':_0x19be26[_0x39be('0x5e')]['to'][0x0],'phone':_0x19be26['body']['to'][0x0],'fax':_0x19be26[_0x39be('0x5e')]['to'][0x0],'ListId':_0x4dd888[_0x39be('0xaa')]}));}}else{throw new Error(_0x39be('0xab'));}}else{throw new Error(_0x39be('0xac'));}})[_0x39be('0x23')](function(_0x336d4b){if(_0x336d4b){return db['FaxInteraction'][_0x39be('0x5b')]({'where':{'ContactId':_0x336d4b['id'],'closed':![],'FaxAccountId':_0x4dd888['id']}})['then'](function(_0x467e6d){if(_0x467e6d){return[_0x467e6d,![]];}return db[_0x39be('0x75')][_0x39be('0x5d')]({'UserId':_0x19be26[_0x39be('0x5f')]['id'],'ContactId':_0x336d4b['id'],'FaxAccountId':_0x4dd888['id'],'fax':_0x19be26['body']['to'][0x0],'firstMsgDirection':_0x39be('0xad'),'Messages':[_[_0x39be('0x51')](_0x19be26[_0x39be('0x5e')],{'read':![],'body':_0x19be26[_0x39be('0x5e')]['attachments'][0x0][_0x39be('0xae')],'FaxAccountId':_0x4dd888['id'],'UserId':_0x19be26['user']['id'],'ContactId':_0x336d4b['id'],'AttachmentId':_0x19be26['body'][_0x39be('0xa2')][0x0]['id']})]},{'include':[{'model':db[_0x39be('0x9c')],'as':_0x39be('0xaf')}]})['then'](function(_0x48e1a4){return[_0x48e1a4,!![]];});});}else{throw new Error(_0x39be('0xb0'));}})['spread'](function(_0x1f96a2,_0x13a54e){if(_0x13a54e){return _0x1f96a2;}return db[_0x39be('0x9c')]['create']({'direction':_0x39be('0xad'),'read':![],'body':_0x19be26[_0x39be('0x5e')][_0x39be('0xa2')][0x0][_0x39be('0xae')],'FaxAccountId':_0x4dd888['id'],'FaxInteractionId':_0x1f96a2['id'],'UserId':_0x19be26[_0x39be('0x5f')]['id'],'ContactId':_0x1f96a2['ContactId'],'AttachmentId':_0x19be26['body'][_0x39be('0xa2')][0x0]['id']})[_0x39be('0x23')](function(_0x33d9fb){_0x1f96a2[_0x39be('0xb1')]['Messages']=[];_0x1f96a2[_0x39be('0xb1')][_0x39be('0xaf')][_0x39be('0x88')](_0x33d9fb[_0x39be('0xb1')]);return _0x1f96a2;});})[_0x39be('0x23')](function(_0x338296){respondWithRpcPromise(_0x39be('0xb2'),_0x39be('0xb2'),{'FaxAccountId':_[_0x39be('0xa7')](_0x19be26[_0x39be('0x65')]['id'])?undefined:_0x19be26[_0x39be('0x65')]['id'],'path':_[_0x39be('0xa7')](_0x19be26[_0x39be('0x5e')]['attachments'][0x0][_0x39be('0x9')])?undefined:_0x19be26[_0x39be('0x5e')][_0x39be('0xa2')][0x0]['path'],'fax':_[_0x39be('0xa7')](_0x19be26[_0x39be('0x5e')]['to'][0x0])?undefined:_0x19be26[_0x39be('0x5e')]['to'][0x0],'AttachmentId':_0x19be26[_0x39be('0x5e')]['attachments'][0x0]['id']},client9002)[_0x39be('0x23')](function(_0x14a5e4){logger[_0x39be('0x24')](_0x39be('0xb3'),_0x14a5e4);})[_0x39be('0x5c')](function(_0x2cbee0){logger['info'](_0x39be('0xb3'),_0x2cbee0);});return _0x338296;})[_0x39be('0x23')](respondWithResult(_0x3afb49,null))[_0x39be('0x5c')](handleError(_0x3afb49,null));};exports['addAgents']=function(_0x4415c0,_0x213a9b,_0x58396a){return db['FaxAccount'][_0x39be('0x5b')]({'where':{'id':_0x4415c0['params']['id']}})['then'](handleEntityNotFound(_0x213a9b,null))[_0x39be('0x23')](function(_0x3f1e07){if(_0x3f1e07){return _0x3f1e07['addAgents'](_0x4415c0[_0x39be('0x5e')][_0x39be('0x6e')],_[_0x39be('0x73')](_0x4415c0[_0x39be('0x5e')],['ids','id'])||{})[_0x39be('0xb4')](function(_0x2a86ab){for(var _0xceacf1=0x0;_0xceacf1<_0x4415c0[_0x39be('0x5e')][_0x39be('0x6e')][_0x39be('0x49')];_0xceacf1+=0x1){socket['emit'](_0x39be('0xb5'),{'UserId':_0x4415c0[_0x39be('0x5e')]['ids'][_0xceacf1],'FaxAccountId':_0x4415c0[_0x39be('0x65')]['id']});}return _0x2a86ab;});}})[_0x39be('0x23')](respondWithResult(_0x213a9b,null))['catch'](handleError(_0x213a9b,null));};exports['removeAgents']=function(_0x4a09a0,_0x5cdbfa,_0x3cc082){return db[_0x39be('0x3f')][_0x39be('0x5b')]({'where':{'id':_0x4a09a0[_0x39be('0x65')]['id']}})[_0x39be('0x23')](handleEntityNotFound(_0x5cdbfa,null))[_0x39be('0x23')](function(_0x4d8df7){if(_0x4d8df7){return _0x4d8df7['removeAgents'](_0x4a09a0[_0x39be('0x44')]['ids'])[_0x39be('0x23')](function(){if(_[_0x39be('0xb6')](_0x4a09a0['query'][_0x39be('0x6e')])){for(var _0x3ba8c1=0x0;_0x3ba8c1<_0x4a09a0[_0x39be('0x44')][_0x39be('0x6e')]['length'];_0x3ba8c1+=0x1){socket[_0x39be('0xb7')](_0x39be('0xb8'),{'UserId':Number(_0x4a09a0[_0x39be('0x44')][_0x39be('0x6e')][_0x3ba8c1]),'FaxAccountId':Number(_0x4a09a0[_0x39be('0x65')]['id'])});}}else{socket[_0x39be('0xb7')](_0x39be('0xb8'),{'UserId':Number(_0x4a09a0[_0x39be('0x44')][_0x39be('0x6e')]),'FaxAccountId':Number(_0x4a09a0[_0x39be('0x65')]['id'])});}});}})[_0x39be('0x23')](respondWithStatusCode(_0x5cdbfa,null))[_0x39be('0x5c')](handleError(_0x5cdbfa,null));};exports[_0x39be('0xb9')]=function(_0x4c5c6b,_0x277344,_0xbe329c){var _0x233776={};var _0x64e997={};var _0x4194d4;var _0x3f2743;return db[_0x39be('0x3f')][_0x39be('0x6a')]({'where':{'id':_0x4c5c6b[_0x39be('0x65')]['id']}})[_0x39be('0x23')](handleEntityNotFound(_0x277344,null))['then'](function(_0x356f12){if(_0x356f12){_0x4194d4=_0x356f12;_0x64e997[_0x39be('0x43')]=_[_0x39be('0x45')](db[_0x39be('0xba')]['rawAttributes']);_0x64e997['query']=_[_0x39be('0x45')](_0x4c5c6b[_0x39be('0x44')]);_0x64e997[_0x39be('0x4f')]=_['intersection'](_0x64e997[_0x39be('0x43')],_0x64e997[_0x39be('0x44')]);_0x233776[_0x39be('0x46')]=_['intersection'](_0x64e997[_0x39be('0x43')],qs[_0x39be('0x48')](_0x4c5c6b['query'][_0x39be('0x48')]));_0x233776['attributes']=_0x233776[_0x39be('0x46')][_0x39be('0x49')]?_0x233776[_0x39be('0x46')]:_0x64e997['model'];_0x233776['order']=qs[_0x39be('0x4c')](_0x4c5c6b[_0x39be('0x44')][_0x39be('0x4c')]);_0x233776[_0x39be('0x4d')]=qs['filters'](_['pick'](_0x4c5c6b['query'],_0x64e997['filters']));if(_0x4c5c6b['query'][_0x39be('0x50')]){_0x233776['where']=_[_0x39be('0x51')](_0x233776[_0x39be('0x4d')],{'$or':_[_0x39be('0x3e')](_0x233776[_0x39be('0x46')],function(_0x2c2551){var _0x5a87be={};_0x5a87be[_0x2c2551]={'$like':'%'+_0x4c5c6b[_0x39be('0x44')][_0x39be('0x50')]+'%'};return _0x5a87be;})});}_0x233776=_['merge']({},_0x233776,_0x4c5c6b[_0x39be('0x52')]);return _0x4194d4[_0x39be('0xb9')](_0x233776);}})[_0x39be('0x23')](function(_0x48aa39){if(_0x48aa39){_0x3f2743=_0x48aa39[_0x39be('0x49')];if(!_0x4c5c6b['query'][_0x39be('0x4a')]('nolimit')){_0x233776[_0x39be('0x30')]=qs[_0x39be('0x30')](_0x4c5c6b[_0x39be('0x44')][_0x39be('0x30')]);_0x233776[_0x39be('0x2f')]=qs[_0x39be('0x2f')](_0x4c5c6b['query']['offset']);}return _0x4194d4['getAgents'](_0x233776);}})[_0x39be('0x23')](function(_0x534b86){if(_0x534b86){return _0x534b86?{'count':_0x3f2743,'rows':_0x534b86}:null;}})[_0x39be('0x23')](respondWithResult(_0x277344,null))[_0x39be('0x5c')](handleError(_0x277344,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 0dfb68a..0a3df8d 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 _0x4830=['exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','emit','hook'];(function(_0x12c676,_0x4e075b){var _0x1d2c8d=function(_0x5e3a41){while(--_0x5e3a41){_0x12c676['push'](_0x12c676['shift']());}};_0x1d2c8d(++_0x4e075b);}(_0x4830,0xa9));var _0x0483=function(_0x1e4f30,_0x5c20ee){_0x1e4f30=_0x1e4f30-0x0;var _0x39fcd9=_0x4830[_0x1e4f30];return _0x39fcd9;};'use strict';var EventEmitter=require(_0x0483('0x0'));var FaxAccount=require(_0x0483('0x1'))['db'][_0x0483('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x0483('0x3')](0x0);var events={'afterCreate':_0x0483('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5b16d5){return function(_0x70f41c,_0x3d4c1b,_0x51222f){FaxAccountEvents[_0x0483('0x5')](_0x5b16d5+':'+_0x70f41c['id'],_0x70f41c);FaxAccountEvents[_0x0483('0x5')](_0x5b16d5,_0x70f41c);_0x51222f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x0483('0x6')](e,emitEvent(event));}}module[_0x0483('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x80e6=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit'];(function(_0x50b874,_0x1880ea){var _0x5bec4e=function(_0x54a5f9){while(--_0x54a5f9){_0x50b874['push'](_0x50b874['shift']());}};_0x5bec4e(++_0x1880ea);}(_0x80e6,0xdf));var _0x680e=function(_0x53fe69,_0x437509){_0x53fe69=_0x53fe69-0x0;var _0x43e681=_0x80e6[_0x53fe69];return _0x43e681;};'use strict';var EventEmitter=require(_0x680e('0x0'));var FaxAccount=require(_0x680e('0x1'))['db'][_0x680e('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x680e('0x3')](0x0);var events={'afterCreate':_0x680e('0x4'),'afterUpdate':_0x680e('0x5'),'afterDestroy':_0x680e('0x6')};function emitEvent(_0x18d76b){return function(_0x5cb2d3,_0x27f777,_0x2437e7){FaxAccountEvents[_0x680e('0x7')](_0x18d76b+':'+_0x5cb2d3['id'],_0x5cb2d3);FaxAccountEvents['emit'](_0x18d76b,_0x5cb2d3);_0x2437e7(null);};}for(var e in events){if(events[_0x680e('0x8')](e)){var event=events[e];FaxAccount[_0x680e('0x9')](e,emitEvent(event));}}module[_0x680e('0xa')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index e19729c..137e691 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 _0xb61b=['bluebird','request-promise','rimraf','../../config/environment','exports','define','FaxAccount','fax_accounts','util','../../config/logger','moment'];(function(_0x5f2f69,_0x9cf99){var _0x1c4072=function(_0x56b8a8){while(--_0x56b8a8){_0x5f2f69['push'](_0x5f2f69['shift']());}};_0x1c4072(++_0x9cf99);}(_0xb61b,0x147));var _0xbb61=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb61b[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xbb61('0x0'));var logger=require(_0xbb61('0x1'))('api');var moment=require(_0xbb61('0x2'));var BPromise=require(_0xbb61('0x3'));var rp=require(_0xbb61('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb61('0x5'));var config=require(_0xbb61('0x6'));var attributes=require('./faxAccount.attributes');module[_0xbb61('0x7')]=function(_0x5c9f56,_0xbcc41e){return _0x5c9f56[_0xbb61('0x8')](_0xbb61('0x9'),attributes,{'tableName':_0xbb61('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d7c=['../../config/environment','./faxAccount.attributes','define','fax_accounts','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x8d7c,0xca));var _0xc8d7=function(_0x5d07db,_0x24d820){_0x5d07db=_0x5d07db-0x0;var _0x489e0f=_0x8d7c[_0x5d07db];return _0x489e0f;};'use strict';var _=require(_0xc8d7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc8d7('0x1'));var moment=require(_0xc8d7('0x2'));var BPromise=require(_0xc8d7('0x3'));var rp=require(_0xc8d7('0x4'));var fs=require('fs');var path=require(_0xc8d7('0x5'));var rimraf=require(_0xc8d7('0x6'));var config=require(_0xc8d7('0x7'));var attributes=require(_0xc8d7('0x8'));module['exports']=function(_0x1a21ae,_0xb8603a){return _0x1a21ae[_0xc8d7('0x9')]('FaxAccount',attributes,{'tableName':_0xc8d7('0xa'),'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 e6ad2e1..33f1a74 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 _0xfdc4=['http','defaults','localhost','./faxAccount.socket','register','request','then','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','info','catch','GetFaxAccount','FaxAccount','findAll','options','where','attributes','include','model','map','NotifyFaxAccount','body','ValidationError','no\x20available\x20attributes','difference','updatedAt','keys','createdAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','CmContact','DESC','FaxApplication','List','get','applications','orderBy','priority','Applications','length','Contacts','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','push','unmanaged','*,*,*,*','created','FaxMessage','interaction','User','name','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfdc4,0x1a4));var _0x4fdc=function(_0x3a4410,_0x17a9f2){_0x3a4410=_0x3a4410-0x0;var _0x183049=_0xfdc4[_0x3a4410];return _0x183049;};'use strict';var _=require(_0x4fdc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4fdc('0x1'));var rs=require(_0x4fdc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4fdc('0x3'))['db'];var utils=require(_0x4fdc('0x4'));var logger=require(_0x4fdc('0x5'))(_0x4fdc('0x6'));var config=require(_0x4fdc('0x7'));var jayson=require(_0x4fdc('0x8'));var client=jayson[_0x4fdc('0x9')][_0x4fdc('0xa')]({'port':0x232c});config['redis']=_[_0x4fdc('0xb')](config['redis'],{'host':_0x4fdc('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4fdc('0xd'))[_0x4fdc('0xe')](socket);function respondWithRpcPromise(_0x3bfb8f,_0x129394,_0x14100d){return new BPromise(function(_0x26de85,_0x548e21){return client[_0x4fdc('0xf')](_0x3bfb8f,_0x14100d)[_0x4fdc('0x10')](function(_0x228864){logger['info']('FaxAccount,\x20%s,\x20%s',_0x129394,'request\x20sent');logger[_0x4fdc('0x11')](_0x4fdc('0x12'),_0x129394,_0x4fdc('0x13'),JSON[_0x4fdc('0x14')](_0x228864));if(_0x228864['error']){if(_0x228864[_0x4fdc('0x15')][_0x4fdc('0x16')]===0x1f4){logger[_0x4fdc('0x15')](_0x4fdc('0x17'),_0x129394,_0x228864[_0x4fdc('0x15')]['message']);return _0x548e21(_0x228864['error'][_0x4fdc('0x18')]);}logger[_0x4fdc('0x15')](_0x4fdc('0x17'),_0x129394,_0x228864['error'][_0x4fdc('0x18')]);return _0x26de85(_0x228864[_0x4fdc('0x15')]['message']);}else{logger[_0x4fdc('0x19')]('FaxAccount,\x20%s,\x20%s',_0x129394,_0x4fdc('0x13'));_0x26de85(_0x228864['result'][_0x4fdc('0x18')]);}})[_0x4fdc('0x1a')](function(_0x35bcd3){logger[_0x4fdc('0x15')](_0x4fdc('0x17'),_0x129394,_0x35bcd3);_0x548e21(_0x35bcd3);});});}exports[_0x4fdc('0x1b')]=function(_0x3c556d){var _0xfec81=this;return new Promise(function(_0x53ed20,_0x4eaad1){return db[_0x4fdc('0x1c')][_0x4fdc('0x1d')]({'raw':_0x3c556d[_0x4fdc('0x1e')]?_0x3c556d[_0x4fdc('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3c556d[_0x4fdc('0x1e')]?_0x3c556d[_0x4fdc('0x1e')][_0x4fdc('0x1f')]||null:null,'attributes':_0x3c556d[_0x4fdc('0x1e')]?_0x3c556d[_0x4fdc('0x1e')][_0x4fdc('0x20')]||null:null,'limit':_0x3c556d[_0x4fdc('0x1e')]?_0x3c556d['options']['limit']||null:null,'include':_0x3c556d[_0x4fdc('0x1e')]?_0x3c556d['options'][_0x4fdc('0x21')]?_['map'](_0x3c556d['options'][_0x4fdc('0x21')],function(_0x3decf3){return{'model':db[_0x3decf3[_0x4fdc('0x22')]],'as':_0x3decf3['as'],'attributes':_0x3decf3[_0x4fdc('0x20')],'include':_0x3decf3[_0x4fdc('0x21')]?_['map'](_0x3decf3[_0x4fdc('0x21')],function(_0x247a98){return{'model':db[_0x247a98[_0x4fdc('0x22')]],'as':_0x247a98['as'],'attributes':_0x247a98[_0x4fdc('0x20')],'include':_0x247a98['include']?_[_0x4fdc('0x23')](_0x247a98['include'],function(_0x3dee1f){return{'model':db[_0x3dee1f['model']],'as':_0x3dee1f['as'],'attributes':_0x3dee1f[_0x4fdc('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4fdc('0x10')](function(_0x28d7e3){logger[_0x4fdc('0x19')]('GetFaxAccount',_0x3c556d);logger[_0x4fdc('0x11')](_0x4fdc('0x1b'),_0x3c556d,JSON[_0x4fdc('0x14')](_0x28d7e3));_0x53ed20(_0x28d7e3);})[_0x4fdc('0x1a')](function(_0x4af537){logger[_0x4fdc('0x15')](_0x4fdc('0x1b'),_0x4af537['message'],_0x3c556d);_0x4eaad1(_0xfec81[_0x4fdc('0x15')](0x1f4,_0x4af537['message']));});});};exports[_0x4fdc('0x24')]=function(_0x566e8f,_0x5a26b1,_0x3c91fb){var _0x21588b=this;return new Promise(function(_0x2749ae,_0x38d9fb){var _0x4a529f={'body':_0x566e8f[_0x4fdc('0x25')],'channel':'fax'};var _0x9276c7=[];var _0x4025d7=[];var _0x110892={};return db['CmContact']['describe']()['then'](function(_0x28a025){if(!_0x28a025){throw new db['Sequelize'][(_0x4fdc('0x26'))](_0x4fdc('0x27'));}_0x9276c7=_[_0x4fdc('0x28')](_['keys'](_0x28a025),['createdAt',_0x4fdc('0x29')]);_0x4025d7=_[_0x4fdc('0x28')](_[_0x4fdc('0x2a')](_0x28a025),[_0x4fdc('0x2b'),_0x4fdc('0x29'),_0x4fdc('0x2c'),_0x4fdc('0x2d')]);if(_0x566e8f[_0x4fdc('0x25')]['id']){delete _0x566e8f['body']['id'];}if(_['isNil'](_0x566e8f[_0x4fdc('0x25')][_0x4fdc('0x2e')])){throw new db[(_0x4fdc('0x2f'))][(_0x4fdc('0x26'))](_0x4fdc('0x30'));}if(_['isNil'](_0x566e8f['body'][_0x4fdc('0x25')])||_0x566e8f[_0x4fdc('0x25')][_0x4fdc('0x25')]===''){throw new db[(_0x4fdc('0x2f'))][(_0x4fdc('0x26'))](_0x4fdc('0x31'));}if(_[_0x4fdc('0x32')](_0x566e8f['body'][_0x4fdc('0x33')])){throw new db[(_0x4fdc('0x2f'))][(_0x4fdc('0x26'))](_0x4fdc('0x34')+_0x4025d7);}if(!_['includes'](_0x4025d7,_0x566e8f[_0x4fdc('0x25')][_0x4fdc('0x33')])){throw new db[(_0x4fdc('0x2f'))][(_0x4fdc('0x26'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4025d7);}_0x110892[_0x566e8f[_0x4fdc('0x25')][_0x4fdc('0x33')]]=_0x566e8f[_0x4fdc('0x25')][_0x4fdc('0x2e')];})[_0x4fdc('0x10')](function(){return db[_0x4fdc('0x1c')][_0x4fdc('0x35')]({'where':{'id':_0x566e8f[_0x4fdc('0x36')]['id']},'include':[{'model':db[_0x4fdc('0x37')],'as':'List','include':[{'model':db[_0x4fdc('0x38')],'as':'Contacts','where':_0x110892,'limit':0x1,'order':[['updatedAt',_0x4fdc('0x39')]]}]},{'model':db[_0x4fdc('0x3a')],'as':'Applications'}]});})['then'](function(_0x42ef05){if(_0x42ef05&&_0x42ef05[_0x4fdc('0x3b')]){var _0x46207e=_0x42ef05[_0x4fdc('0x3c')]({'plain':!![]});_0x4a529f[_0x4fdc('0x36')]=_0x46207e;_0x4a529f[_0x4fdc('0x3d')]=_0x46207e['Applications'];_0x4a529f['list']=_0x46207e[_0x4fdc('0x3b')];_0x4a529f['applications']=_[_0x4fdc('0x3e')](_0x4a529f[_0x4fdc('0x3d')],[_0x4fdc('0x3f')],['asc']);if(_0x4a529f[_0x4fdc('0x36')][_0x4fdc('0x40')]){delete _0x4a529f[_0x4fdc('0x36')][_0x4fdc('0x40')];}if(_0x4a529f[_0x4fdc('0x36')]['List']&&_0x4a529f[_0x4fdc('0x36')][_0x4fdc('0x3b')]['Contacts'][_0x4fdc('0x41')]){return _0x4a529f[_0x4fdc('0x36')][_0x4fdc('0x3b')][_0x4fdc('0x42')][0x0];}var _0x5435bc=_['defaults'](_0x566e8f['body'],{'firstName':_0x566e8f[_0x4fdc('0x25')][_0x4fdc('0x2e')],'ListId':_0x46207e[_0x4fdc('0x2d')]});_0x5435bc[_0x566e8f[_0x4fdc('0x25')]['mapKey']]=_0x566e8f[_0x4fdc('0x25')][_0x4fdc('0x2e')];return db[_0x4fdc('0x38')][_0x4fdc('0x43')](_0x5435bc,{'fields':_0x9276c7,'raw':!![]});}})[_0x4fdc('0x10')](function(_0x378c31){_0x4a529f[_0x4fdc('0x44')]=_0x378c31;if(_0x378c31){var _0x3da924={'ContactId':_0x378c31['id'],'FaxAccountId':_0x566e8f['account']['id'],'fax':_0x378c31['fax']};return db[_0x4fdc('0x45')][_0x4fdc('0x35')]({'where':{'ContactId':_0x378c31['id'],'closed':![],'FaxAccountId':_0x566e8f[_0x4fdc('0x36')]['id']}})[_0x4fdc('0x10')](function(_0x38424d){if(_0x38424d){return[_0x38424d,![]];}return db[_0x4fdc('0x45')]['create'](_0x3da924)['then'](function(_0x466e2c){return[_0x466e2c,!![]];});});}else{throw new Error(_0x4fdc('0x46'));}})['spread'](function(_0x2a2104,_0xcbee70){var _0x7e7831=_0x2a2104[_0x4fdc('0x3c')]({'plain':!![]});if(_0xcbee70){if(_0x4a529f[_0x4fdc('0x36')][_0x4fdc('0x47')]){_0x4a529f[_0x4fdc('0x3d')][_0x4fdc('0x48')]({'id':0x0,'priority':_0x4a529f[_0x4fdc('0x3d')][_0x4fdc('0x41')]+0x1,'app':'close','appdata':_0x4fdc('0x49'),'interval':_0x4fdc('0x4a')});}_0x7e7831[_0x4fdc('0x4b')]=!![];}else{_0x7e7831[_0x4fdc('0x4b')]=![];}_0x4a529f['interaction']=_0x7e7831;return db[_0x4fdc('0x4c')][_0x4fdc('0x43')]({'body':_0x566e8f['body'][_0x4fdc('0x25')],'FaxAccountId':_0x566e8f[_0x4fdc('0x36')]['id'],'FaxInteractionId':_0x2a2104['id'],'direction':'in','ContactId':_0x2a2104['ContactId'],'AttachmentId':_0x566e8f['body']['AttachmentId']});})[_0x4fdc('0x10')](function(_0x4cdaaf){_0x4a529f[_0x4fdc('0x18')]=_0x4cdaaf;if(_0x4a529f[_0x4fdc('0x4d')]['UserId']){return db[_0x4fdc('0x4e')][_0x4fdc('0x35')]({'attributes':['id',_0x4fdc('0x4f')],'where':{'id':_0x4a529f['interaction'][_0x4fdc('0x50')]}})['then'](function(_0x5e9eff){if(_0x5e9eff){_0x4a529f[_0x4fdc('0x3d')][_0x4fdc('0x51')]({'id':0x0,'priority':0x0,'app':_0x4fdc('0x52'),'appdata':_0x5e9eff[_0x4fdc('0x4f')]+','+(_0x4a529f[_0x4fdc('0x36')][_0x4fdc('0x53')]||0xa),'interval':_0x4fdc('0x4a')});}return respondWithRpcPromise(_0x4fdc('0x54'),_0x4fdc('0x55'),_0x4a529f);});}return respondWithRpcPromise(_0x4fdc('0x54'),'startRouting',_0x4a529f);})['then'](function(_0x4e2e7c){_0x2749ae(_0x4e2e7c);})[_0x4fdc('0x1a')](function(_0x1fc970){_0x38d9fb(_0x21588b['error'](0x1f4,_0x1fc970[_0x4fdc('0x18')]));});});}; \ No newline at end of file +var _0x6089=['GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','updatedAt','difference','createdAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','DESC','FaxApplication','Applications','get','applications','list','orderBy','asc','length','create','contact','FaxInteraction','find','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','ContactId','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x6089,0x100));var _0x9608=function(_0x16280e,_0x3b9529){_0x16280e=_0x16280e-0x0;var _0xd2396a=_0x6089[_0x16280e];return _0xd2396a;};'use strict';var _=require(_0x9608('0x0'));var util=require(_0x9608('0x1'));var moment=require(_0x9608('0x2'));var BPromise=require(_0x9608('0x3'));var rs=require(_0x9608('0x4'));var fs=require('fs');var Redis=require(_0x9608('0x5'));var db=require(_0x9608('0x6'))['db'];var utils=require(_0x9608('0x7'));var logger=require('../../config/logger')(_0x9608('0x8'));var config=require(_0x9608('0x9'));var jayson=require(_0x9608('0xa'));var client=jayson['client'][_0x9608('0xb')]({'port':0x232c});config['redis']=_[_0x9608('0xc')](config[_0x9608('0xd')],{'host':_0x9608('0xe'),'port':0x18eb});var socket=require(_0x9608('0xf'))(new Redis(config[_0x9608('0xd')]));require(_0x9608('0x10'))[_0x9608('0x11')](socket);function respondWithRpcPromise(_0x19a9c0,_0x3b86fc,_0x1db251){return new BPromise(function(_0x1d6237,_0x57d657){return client[_0x9608('0x12')](_0x19a9c0,_0x1db251)[_0x9608('0x13')](function(_0x5bd75e){logger['info'](_0x9608('0x14'),_0x3b86fc,_0x9608('0x15'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x3b86fc,_0x9608('0x15'),JSON[_0x9608('0x16')](_0x5bd75e));if(_0x5bd75e[_0x9608('0x17')]){if(_0x5bd75e['error'][_0x9608('0x18')]===0x1f4){logger[_0x9608('0x17')](_0x9608('0x14'),_0x3b86fc,_0x5bd75e[_0x9608('0x17')][_0x9608('0x19')]);return _0x57d657(_0x5bd75e[_0x9608('0x17')][_0x9608('0x19')]);}logger[_0x9608('0x17')](_0x9608('0x14'),_0x3b86fc,_0x5bd75e[_0x9608('0x17')][_0x9608('0x19')]);return _0x1d6237(_0x5bd75e[_0x9608('0x17')][_0x9608('0x19')]);}else{logger[_0x9608('0x1a')](_0x9608('0x14'),_0x3b86fc,'request\x20sent');_0x1d6237(_0x5bd75e[_0x9608('0x1b')][_0x9608('0x19')]);}})[_0x9608('0x1c')](function(_0x3c440b){logger[_0x9608('0x17')](_0x9608('0x14'),_0x3b86fc,_0x3c440b);_0x57d657(_0x3c440b);});});}exports[_0x9608('0x1d')]=function(_0x4c3969){var _0x3c04ce=this;return new Promise(function(_0x4edf43,_0x19b716){return db[_0x9608('0x1e')][_0x9608('0x1f')]({'raw':_0x4c3969[_0x9608('0x20')]?_0x4c3969[_0x9608('0x20')][_0x9608('0x21')]===undefined?!![]:![]:!![],'where':_0x4c3969[_0x9608('0x20')]?_0x4c3969[_0x9608('0x20')][_0x9608('0x22')]||null:null,'attributes':_0x4c3969[_0x9608('0x20')]?_0x4c3969[_0x9608('0x20')][_0x9608('0x23')]||null:null,'limit':_0x4c3969[_0x9608('0x20')]?_0x4c3969[_0x9608('0x20')][_0x9608('0x24')]||null:null,'include':_0x4c3969[_0x9608('0x20')]?_0x4c3969[_0x9608('0x20')][_0x9608('0x25')]?_[_0x9608('0x26')](_0x4c3969['options'][_0x9608('0x25')],function(_0x6a8a8){return{'model':db[_0x6a8a8[_0x9608('0x27')]],'as':_0x6a8a8['as'],'attributes':_0x6a8a8[_0x9608('0x23')],'include':_0x6a8a8['include']?_['map'](_0x6a8a8[_0x9608('0x25')],function(_0xce3d42){return{'model':db[_0xce3d42[_0x9608('0x27')]],'as':_0xce3d42['as'],'attributes':_0xce3d42[_0x9608('0x23')],'include':_0xce3d42[_0x9608('0x25')]?_[_0x9608('0x26')](_0xce3d42[_0x9608('0x25')],function(_0x582fed){return{'model':db[_0x582fed['model']],'as':_0x582fed['as'],'attributes':_0x582fed[_0x9608('0x23')]};}):[]};}):[]};}):[]:[]})[_0x9608('0x13')](function(_0x5e9ed9){logger[_0x9608('0x1a')](_0x9608('0x1d'),_0x4c3969);logger['debug'](_0x9608('0x1d'),_0x4c3969,JSON[_0x9608('0x16')](_0x5e9ed9));_0x4edf43(_0x5e9ed9);})[_0x9608('0x1c')](function(_0x4110a5){logger[_0x9608('0x17')]('GetFaxAccount',_0x4110a5[_0x9608('0x19')],_0x4c3969);_0x19b716(_0x3c04ce[_0x9608('0x17')](0x1f4,_0x4110a5[_0x9608('0x19')]));});});};exports[_0x9608('0x28')]=function(_0x2905fe,_0x49ce5a,_0x515b1f){var _0x1c68e4=this;return new Promise(function(_0x143746,_0x3b8d74){var _0x7ce7da={'body':_0x2905fe['body'],'channel':_0x9608('0x29')};var _0x32d3b7=[];var _0x395bee=[];var _0xb59e11={};return db[_0x9608('0x2a')][_0x9608('0x2b')]()['then'](function(_0x5ef857){if(!_0x5ef857){throw new db[(_0x9608('0x2c'))][(_0x9608('0x2d'))](_0x9608('0x2e'));}_0x32d3b7=_['difference'](_[_0x9608('0x2f')](_0x5ef857),['createdAt',_0x9608('0x30')]);_0x395bee=_[_0x9608('0x31')](_[_0x9608('0x2f')](_0x5ef857),[_0x9608('0x32'),_0x9608('0x30'),_0x9608('0x33'),_0x9608('0x34')]);if(_0x2905fe[_0x9608('0x35')]['id']){delete _0x2905fe[_0x9608('0x35')]['id'];}if(_[_0x9608('0x36')](_0x2905fe[_0x9608('0x35')][_0x9608('0x37')])){throw new db['Sequelize'][(_0x9608('0x2d'))](_0x9608('0x38'));}if(_[_0x9608('0x36')](_0x2905fe[_0x9608('0x35')][_0x9608('0x35')])||_0x2905fe['body'][_0x9608('0x35')]===''){throw new db['Sequelize'][(_0x9608('0x2d'))](_0x9608('0x39'));}if(_[_0x9608('0x36')](_0x2905fe[_0x9608('0x35')][_0x9608('0x3a')])){throw new db[(_0x9608('0x2c'))][(_0x9608('0x2d'))](_0x9608('0x3b')+_0x395bee);}if(!_[_0x9608('0x3c')](_0x395bee,_0x2905fe[_0x9608('0x35')][_0x9608('0x3a')])){throw new db[(_0x9608('0x2c'))][(_0x9608('0x2d'))](_0x9608('0x3d')+_0x395bee);}_0xb59e11[_0x2905fe[_0x9608('0x35')][_0x9608('0x3a')]]=_0x2905fe[_0x9608('0x35')][_0x9608('0x37')];})[_0x9608('0x13')](function(){return db['FaxAccount']['find']({'where':{'id':_0x2905fe[_0x9608('0x3e')]['id']},'include':[{'model':db['CmList'],'as':_0x9608('0x3f'),'include':[{'model':db[_0x9608('0x2a')],'as':_0x9608('0x40'),'where':_0xb59e11,'limit':0x1,'order':[[_0x9608('0x30'),_0x9608('0x41')]]}]},{'model':db[_0x9608('0x42')],'as':_0x9608('0x43')}]});})[_0x9608('0x13')](function(_0x1424b8){if(_0x1424b8&&_0x1424b8[_0x9608('0x3f')]){var _0x1546ec=_0x1424b8[_0x9608('0x44')]({'plain':!![]});_0x7ce7da[_0x9608('0x3e')]=_0x1546ec;_0x7ce7da[_0x9608('0x45')]=_0x1546ec['Applications'];_0x7ce7da[_0x9608('0x46')]=_0x1546ec['List'];_0x7ce7da[_0x9608('0x45')]=_[_0x9608('0x47')](_0x7ce7da['applications'],['priority'],[_0x9608('0x48')]);if(_0x7ce7da[_0x9608('0x3e')][_0x9608('0x43')]){delete _0x7ce7da['account']['Applications'];}if(_0x7ce7da[_0x9608('0x3e')]['List']&&_0x7ce7da[_0x9608('0x3e')][_0x9608('0x3f')][_0x9608('0x40')][_0x9608('0x49')]){return _0x7ce7da['account'][_0x9608('0x3f')][_0x9608('0x40')][0x0];}var _0x1b9a18=_[_0x9608('0xc')](_0x2905fe[_0x9608('0x35')],{'firstName':_0x2905fe['body'][_0x9608('0x37')],'ListId':_0x1546ec[_0x9608('0x34')]});_0x1b9a18[_0x2905fe[_0x9608('0x35')][_0x9608('0x3a')]]=_0x2905fe[_0x9608('0x35')][_0x9608('0x37')];return db[_0x9608('0x2a')][_0x9608('0x4a')](_0x1b9a18,{'fields':_0x32d3b7,'raw':!![]});}})[_0x9608('0x13')](function(_0xc4ef69){_0x7ce7da[_0x9608('0x4b')]=_0xc4ef69;if(_0xc4ef69){var _0xb50b1d={'ContactId':_0xc4ef69['id'],'FaxAccountId':_0x2905fe['account']['id'],'fax':_0xc4ef69[_0x9608('0x29')]};return db[_0x9608('0x4c')][_0x9608('0x4d')]({'where':{'ContactId':_0xc4ef69['id'],'closed':![],'FaxAccountId':_0x2905fe['account']['id']}})[_0x9608('0x13')](function(_0x518cf0){if(_0x518cf0){return[_0x518cf0,![]];}return db['FaxInteraction']['create'](_0xb50b1d)[_0x9608('0x13')](function(_0x3a45f9){return[_0x3a45f9,!![]];});});}else{throw new Error(_0x9608('0x4e'));}})[_0x9608('0x4f')](function(_0x591645,_0x5f06fe){var _0x59b4c0=_0x591645[_0x9608('0x44')]({'plain':!![]});if(_0x5f06fe){if(_0x7ce7da['account'][_0x9608('0x50')]){_0x7ce7da[_0x9608('0x45')][_0x9608('0x51')]({'id':0x0,'priority':_0x7ce7da[_0x9608('0x45')][_0x9608('0x49')]+0x1,'app':_0x9608('0x52'),'appdata':_0x9608('0x53'),'interval':_0x9608('0x54')});}_0x59b4c0['created']=!![];}else{_0x59b4c0[_0x9608('0x55')]=![];}_0x7ce7da[_0x9608('0x56')]=_0x59b4c0;return db['FaxMessage'][_0x9608('0x4a')]({'body':_0x2905fe[_0x9608('0x35')][_0x9608('0x35')],'FaxAccountId':_0x2905fe[_0x9608('0x3e')]['id'],'FaxInteractionId':_0x591645['id'],'direction':'in','ContactId':_0x591645[_0x9608('0x57')],'AttachmentId':_0x2905fe[_0x9608('0x35')]['AttachmentId']});})[_0x9608('0x13')](function(_0x1e4b73){_0x7ce7da[_0x9608('0x19')]=_0x1e4b73;if(_0x7ce7da[_0x9608('0x56')][_0x9608('0x58')]){return db[_0x9608('0x59')][_0x9608('0x4d')]({'attributes':['id',_0x9608('0x5a')],'where':{'id':_0x7ce7da[_0x9608('0x56')][_0x9608('0x58')]}})[_0x9608('0x13')](function(_0x18b894){if(_0x18b894){_0x7ce7da[_0x9608('0x45')]['unshift']({'id':0x0,'priority':0x0,'app':_0x9608('0x5b'),'appdata':_0x18b894[_0x9608('0x5a')]+','+(_0x7ce7da[_0x9608('0x3e')][_0x9608('0x5c')]||0xa),'interval':_0x9608('0x54')});}return respondWithRpcPromise(_0x9608('0x5d'),_0x9608('0x5e'),_0x7ce7da);});}return respondWithRpcPromise('Start',_0x9608('0x5e'),_0x7ce7da);})[_0x9608('0x13')](function(_0x1cb788){_0x143746(_0x1cb788);})['catch'](function(_0x2e39cb){_0x3b8d74(_0x1c68e4['error'](0x1f4,_0x2e39cb[_0x9608('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index d8a2dd7..3bd5134 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 _0x7046=['./faxAccount.events','save','remove','update','emit','removeListener','register','length','faxAccount:'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x7046,0x144));var _0x6704=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7046[_0x321bb2];return _0x9c12ed;};'use strict';var FaxAccountEvents=require(_0x6704('0x0'));var events=[_0x6704('0x1'),_0x6704('0x2'),_0x6704('0x3')];function createListener(_0x54a895,_0x1fd895){return function(_0x4399c6){_0x1fd895[_0x6704('0x4')](_0x54a895,_0x4399c6);};}function removeListener(_0x5258e7,_0x1e9b2a){return function(){FaxAccountEvents[_0x6704('0x5')](_0x5258e7,_0x1e9b2a);};}exports[_0x6704('0x6')]=function(_0x626a14){for(var _0x2917be=0x0,_0x4badf8=events[_0x6704('0x7')];_0x2917be<_0x4badf8;_0x2917be++){var _0x49b8b6=events[_0x2917be];var _0x56b1ff=createListener(_0x6704('0x8')+_0x49b8b6,_0x626a14);FaxAccountEvents['on'](_0x49b8b6,_0x56b1ff);}}; \ No newline at end of file +var _0x81c6=['faxAccount:','save','emit','removeListener','register','length'];(function(_0x18f015,_0x44f92c){var _0x53199b=function(_0x3bc47e){while(--_0x3bc47e){_0x18f015['push'](_0x18f015['shift']());}};_0x53199b(++_0x44f92c);}(_0x81c6,0x1d5));var _0x681c=function(_0x3cb9bc,_0x1c95f5){_0x3cb9bc=_0x3cb9bc-0x0;var _0x5d13ec=_0x81c6[_0x3cb9bc];return _0x5d13ec;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x681c('0x0'),'remove','update'];function createListener(_0x57f8d2,_0x62d9fc){return function(_0x2d0fc0){_0x62d9fc[_0x681c('0x1')](_0x57f8d2,_0x2d0fc0);};}function removeListener(_0x5566e5,_0x44c18e){return function(){FaxAccountEvents[_0x681c('0x2')](_0x5566e5,_0x44c18e);};}exports[_0x681c('0x3')]=function(_0x1d31c8){for(var _0x4ea522=0x0,_0x45331=events[_0x681c('0x4')];_0x4ea522<_0x45331;_0x4ea522++){var _0x5624d7=events[_0x4ea522];var _0x5b5f22=createListener(_0x681c('0x5')+_0x5624d7,_0x1d31c8);FaxAccountEvents['on'](_0x5624d7,_0x5b5f22);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index c027e88..b433512 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 _0x300a=['addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAnswers','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','create','post'];(function(_0x157103,_0xf091a1){var _0xf7522c=function(_0xde2875){while(--_0xde2875){_0x157103['push'](_0x157103['shift']());}};_0xf7522c(++_0xf091a1);}(_0x300a,0x170));var _0xa300=function(_0x287a47,_0x2f731c){_0x287a47=_0x287a47-0x0;var _0x3fb726=_0x300a[_0x287a47];return _0x3fb726;};'use strict';var multer=require(_0xa300('0x0'));var util=require(_0xa300('0x1'));var path=require(_0xa300('0x2'));var timeout=require('connect-timeout');var express=require(_0xa300('0x3'));var router=express[_0xa300('0x4')]();var auth=require(_0xa300('0x5'));var interaction=require(_0xa300('0x6'));var config=require(_0xa300('0x7'));var controller=require(_0xa300('0x8'));router[_0xa300('0x9')]('/',auth['isAuthenticated'](),controller[_0xa300('0xa')]);router['get'](_0xa300('0xb'),auth[_0xa300('0xc')](),controller[_0xa300('0xd')]);router[_0xa300('0x9')](_0xa300('0xe'),auth['isAuthenticated'](),controller[_0xa300('0xf')]);router[_0xa300('0x9')](_0xa300('0x10'),auth[_0xa300('0xc')](),controller['getDispositions']);router['get'](_0xa300('0x11'),auth[_0xa300('0xc')](),controller['getAnswers']);router[_0xa300('0x9')](_0xa300('0x12'),auth[_0xa300('0xc')](),controller[_0xa300('0x13')]);router[_0xa300('0x9')](_0xa300('0x14'),auth[_0xa300('0xc')](),controller[_0xa300('0x15')]);router[_0xa300('0x9')](_0xa300('0x16'),auth[_0xa300('0xc')](),controller[_0xa300('0x17')]);router[_0xa300('0x9')](_0xa300('0x18'),auth[_0xa300('0xc')](),controller[_0xa300('0x19')]);router['post']('/',auth[_0xa300('0xc')](),controller[_0xa300('0x1a')]);router[_0xa300('0x1b')]('/:id/dispositions',auth[_0xa300('0xc')](),controller[_0xa300('0x1c')]);router[_0xa300('0x1b')](_0xa300('0x11'),auth[_0xa300('0xc')](),controller[_0xa300('0x1d')]);router[_0xa300('0x1b')](_0xa300('0x12'),auth[_0xa300('0xc')](),controller[_0xa300('0x1e')]);router[_0xa300('0x1b')](_0xa300('0x14'),auth[_0xa300('0xc')](),controller[_0xa300('0x1f')]);router[_0xa300('0x1b')](_0xa300('0x20'),auth[_0xa300('0xc')](),controller[_0xa300('0x21')]);router[_0xa300('0x1b')](_0xa300('0x22'),auth['isAuthenticated'](),controller['updateAccountApplications']);router['post'](_0xa300('0x23'),auth[_0xa300('0xc')](),controller[_0xa300('0x24')]);router[_0xa300('0x1b')](_0xa300('0x18'),auth[_0xa300('0xc')](),controller[_0xa300('0x25')]);router[_0xa300('0x26')](_0xa300('0xe'),auth['isAuthenticated'](),controller[_0xa300('0x27')]);router[_0xa300('0x28')](_0xa300('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0xa300('0x28')]('/:id/dispositions',auth[_0xa300('0xc')](),controller[_0xa300('0x29')]);router['delete'](_0xa300('0x11'),auth[_0xa300('0xc')](),controller[_0xa300('0x2a')]);router[_0xa300('0x28')]('/:id/users',auth[_0xa300('0xc')](),controller['removeAgents']);module[_0xa300('0x2b')]=router; \ No newline at end of file +var _0x1ed4=['exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','getMessages','/:id/users','getAgents','create','addDisposition','addAnswer','post','addInteraction','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','addAgents','update','delete','removeDispositions','removeAgents'];(function(_0x9415fe,_0x5c8e93){var _0x1af5bc=function(_0x354e01){while(--_0x354e01){_0x9415fe['push'](_0x9415fe['shift']());}};_0x1af5bc(++_0x5c8e93);}(_0x1ed4,0xba));var _0x41ed=function(_0x2ec4d1,_0x50edd8){_0x2ec4d1=_0x2ec4d1-0x0;var _0xbc0806=_0x1ed4[_0x2ec4d1];return _0xbc0806;};'use strict';var multer=require('multer');var util=require(_0x41ed('0x0'));var path=require(_0x41ed('0x1'));var timeout=require(_0x41ed('0x2'));var express=require('express');var router=express[_0x41ed('0x3')]();var auth=require(_0x41ed('0x4'));var interaction=require(_0x41ed('0x5'));var config=require('../../config/environment');var controller=require('./faxAccount.controller');router[_0x41ed('0x6')]('/',auth[_0x41ed('0x7')](),controller[_0x41ed('0x8')]);router[_0x41ed('0x6')](_0x41ed('0x9'),auth['isAuthenticated'](),controller[_0x41ed('0xa')]);router['get'](_0x41ed('0xb'),auth[_0x41ed('0x7')](),controller['show']);router['get'](_0x41ed('0xc'),auth['isAuthenticated'](),controller[_0x41ed('0xd')]);router[_0x41ed('0x6')](_0x41ed('0xe'),auth[_0x41ed('0x7')](),controller[_0x41ed('0xf')]);router[_0x41ed('0x6')](_0x41ed('0x10'),auth[_0x41ed('0x7')](),controller['getInteractions']);router[_0x41ed('0x6')](_0x41ed('0x11'),auth[_0x41ed('0x7')](),controller['getApplications']);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x41ed('0x12')]);router[_0x41ed('0x6')](_0x41ed('0x13'),auth[_0x41ed('0x7')](),controller[_0x41ed('0x14')]);router['post']('/',auth[_0x41ed('0x7')](),controller[_0x41ed('0x15')]);router['post']('/:id/dispositions',auth[_0x41ed('0x7')](),controller[_0x41ed('0x16')]);router['post'](_0x41ed('0xe'),auth['isAuthenticated'](),controller[_0x41ed('0x17')]);router[_0x41ed('0x18')](_0x41ed('0x10'),auth['isAuthenticated'](),controller[_0x41ed('0x19')]);router[_0x41ed('0x18')](_0x41ed('0x11'),auth[_0x41ed('0x7')](),controller['addApplications']);router['post'](_0x41ed('0x1a'),auth['isAuthenticated'](),controller[_0x41ed('0x1b')]);router[_0x41ed('0x18')](_0x41ed('0x1c'),auth[_0x41ed('0x7')](),controller[_0x41ed('0x1d')]);router[_0x41ed('0x18')](_0x41ed('0x1e'),auth[_0x41ed('0x7')](),controller['send']);router[_0x41ed('0x18')](_0x41ed('0x13'),auth[_0x41ed('0x7')](),controller[_0x41ed('0x1f')]);router['put'](_0x41ed('0xb'),auth[_0x41ed('0x7')](),controller[_0x41ed('0x20')]);router[_0x41ed('0x21')](_0x41ed('0xb'),auth[_0x41ed('0x7')](),controller['destroy']);router['delete'](_0x41ed('0xc'),auth[_0x41ed('0x7')](),controller[_0x41ed('0x22')]);router[_0x41ed('0x21')](_0x41ed('0xe'),auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0x41ed('0x13'),auth[_0x41ed('0x7')](),controller[_0x41ed('0x23')]);module[_0x41ed('0x24')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 625d294..e8c04eb 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 _0xd663=['STRING','noop','TEXT','sequelize','exports'];(function(_0x6c37ed,_0x162d1c){var _0x47eae9=function(_0x42e08b){while(--_0x42e08b){_0x6c37ed['push'](_0x6c37ed['shift']());}};_0x47eae9(++_0x162d1c);}(_0xd663,0x1ed));var _0x3d66=function(_0x2f4e6f,_0x334d53){_0x2f4e6f=_0x2f4e6f-0x0;var _0x23b2f7=_0xd663[_0x2f4e6f];return _0x23b2f7;};'use strict';var Sequelize=require(_0x3d66('0x0'));module[_0x3d66('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x3d66('0x2')],'allowNull':![],'defaultValue':_0x3d66('0x3')},'appdata':{'type':Sequelize[_0x3d66('0x4')]()},'description':{'type':Sequelize[_0x3d66('0x2')]},'interval':{'type':Sequelize[_0x3d66('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xf9b7=['TEXT','sequelize','exports','INTEGER','STRING','noop'];(function(_0x3313a7,_0x1f019a){var _0x545cab=function(_0x373368){while(--_0x373368){_0x3313a7['push'](_0x3313a7['shift']());}};_0x545cab(++_0x1f019a);}(_0xf9b7,0x91));var _0x7f9b=function(_0x5ce43a,_0x3819bd){_0x5ce43a=_0x5ce43a-0x0;var _0x1852bb=_0xf9b7[_0x5ce43a];return _0x1852bb;};'use strict';var Sequelize=require(_0x7f9b('0x0'));module[_0x7f9b('0x1')]={'priority':{'type':Sequelize[_0x7f9b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7f9b('0x3')],'allowNull':![],'defaultValue':_0x7f9b('0x4')},'appdata':{'type':Sequelize[_0x7f9b('0x5')]()},'description':{'type':Sequelize[_0x7f9b('0x3')]},'interval':{'type':Sequelize[_0x7f9b('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index ec72bcd..de9a6cc 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 _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(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xabce,0x103));var _0xeabc=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xabce[_0x481bf7];return _0x461787;};'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 +var _0x5fab=['sort','where','merge','filter','options','count','includeAll','rows','catch','show','params','include','find','create','body','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','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order'];(function(_0x2889ec,_0x22fe0d){var _0x31cb27=function(_0x3c1692){while(--_0x3c1692){_0x2889ec['push'](_0x2889ec['shift']());}};_0x31cb27(++_0x22fe0d);}(_0x5fab,0x177));var _0xb5fa=function(_0x22cea4,_0x54f16a){_0x22cea4=_0x22cea4-0x0;var _0x59d75b=_0x5fab[_0x22cea4];return _0x59d75b;};'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'];function respondWithStatusCode(_0x309740,_0x4d3576){_0x4d3576=_0x4d3576||0xcc;return function(_0x2ad830){if(_0x2ad830){return _0x309740[_0xb5fa('0x19')](_0x4d3576);}return _0x309740['status'](_0x4d3576)[_0xb5fa('0x1a')]();};}function respondWithResult(_0x577af0,_0x265992){_0x265992=_0x265992||0xc8;return function(_0x3fc372){if(_0x3fc372){return _0x577af0[_0xb5fa('0x1b')](_0x265992)[_0xb5fa('0x1c')](_0x3fc372);}};}function respondWithFilteredResult(_0x8e9d1c,_0x5371cf){return function(_0x567f31){if(_0x567f31){var _0x38e964=_0x567f31['count'],_0x587043=_0x5371cf['offset'],_0x31f252=_0x5371cf[_0xb5fa('0x1d')]+_0x5371cf[_0xb5fa('0x1e')],_0x27c8f7;if(_0x31f252>=_0x38e964){_0x31f252=_0x38e964;_0x27c8f7=0xc8;}else{_0x27c8f7=0xce;}_0x8e9d1c[_0xb5fa('0x1b')](_0x27c8f7);return _0x8e9d1c[_0xb5fa('0x1f')](_0xb5fa('0x20'),_0x587043+'-'+_0x31f252+'/'+_0x38e964)[_0xb5fa('0x1c')](_0x567f31);}return null;};}function patchUpdates(_0x3b0f69){return function(_0x21f4f4){try{jsonpatch[_0xb5fa('0x21')](_0x21f4f4,_0x3b0f69,!![]);}catch(_0x368cb1){return BPromise[_0xb5fa('0x22')](_0x368cb1);}return _0x21f4f4[_0xb5fa('0x23')]();};}function saveUpdates(_0x5cd822,_0x432bfa){return function(_0x519e20){if(_0x519e20){return _0x519e20[_0xb5fa('0x24')](_0x5cd822)['then'](function(_0xd0fe2b){return _0xd0fe2b;});}return null;};}function removeEntity(_0x43c09f,_0x4e05c0){return function(_0x40dfdf){if(_0x40dfdf){return _0x40dfdf[_0xb5fa('0x25')]()[_0xb5fa('0x26')](function(){_0x43c09f['status'](0xcc)[_0xb5fa('0x1a')]();});}};}function handleEntityNotFound(_0xec108f,_0x444237){return function(_0x542348){if(!_0x542348){_0xec108f[_0xb5fa('0x19')](0x194);}return _0x542348;};}function handleError(_0x5d55f7,_0x106c4b){_0x106c4b=_0x106c4b||0x1f4;return function(_0x264591){logger[_0xb5fa('0x27')](_0x264591[_0xb5fa('0x28')]);if(_0x264591[_0xb5fa('0x29')]){delete _0x264591[_0xb5fa('0x29')];}_0x5d55f7[_0xb5fa('0x1b')](_0x106c4b)[_0xb5fa('0x2a')](_0x264591);};}exports['index']=function(_0x4ec294,_0x5bdf11){var _0x5a1c39={},_0x28a350={},_0x460b54={'count':0x0,'rows':[]};var _0x12c0d4=_[_0xb5fa('0x2b')](db[_0xb5fa('0x2c')][_0xb5fa('0x2d')],function(_0x358549){return{'name':_0x358549[_0xb5fa('0x2e')],'type':_0x358549[_0xb5fa('0x2f')][_0xb5fa('0x30')]};});_0x28a350[_0xb5fa('0x31')]=_[_0xb5fa('0x2b')](_0x12c0d4,_0xb5fa('0x29'));_0x28a350[_0xb5fa('0x32')]=_[_0xb5fa('0x33')](_0x4ec294[_0xb5fa('0x32')]);_0x28a350[_0xb5fa('0x34')]=_[_0xb5fa('0x35')](_0x28a350[_0xb5fa('0x31')],_0x28a350[_0xb5fa('0x32')]);_0x5a1c39[_0xb5fa('0x36')]=_[_0xb5fa('0x35')](_0x28a350[_0xb5fa('0x31')],qs[_0xb5fa('0x37')](_0x4ec294['query'][_0xb5fa('0x37')]));_0x5a1c39['attributes']=_0x5a1c39['attributes']['length']?_0x5a1c39[_0xb5fa('0x36')]:_0x28a350['model'];if(!_0x4ec294[_0xb5fa('0x32')]['hasOwnProperty']('nolimit')){_0x5a1c39[_0xb5fa('0x1e')]=qs[_0xb5fa('0x1e')](_0x4ec294['query']['limit']);_0x5a1c39[_0xb5fa('0x1d')]=qs[_0xb5fa('0x1d')](_0x4ec294[_0xb5fa('0x32')]['offset']);}_0x5a1c39[_0xb5fa('0x38')]=qs[_0xb5fa('0x39')](_0x4ec294['query'][_0xb5fa('0x39')]);_0x5a1c39[_0xb5fa('0x3a')]=qs[_0xb5fa('0x34')](_['pick'](_0x4ec294[_0xb5fa('0x32')],_0x28a350[_0xb5fa('0x34')]),_0x12c0d4);if(_0x4ec294[_0xb5fa('0x32')]['filter']){_0x5a1c39[_0xb5fa('0x3a')]=_[_0xb5fa('0x3b')](_0x5a1c39[_0xb5fa('0x3a')],{'$or':_[_0xb5fa('0x2b')](_0x12c0d4,function(_0x5e7770){if(_0x5e7770['type']!=='VIRTUAL'){var _0x49e786={};_0x49e786[_0x5e7770['name']]={'$like':'%'+_0x4ec294['query'][_0xb5fa('0x3c')]+'%'};return _0x49e786;}})});}_0x5a1c39=_['merge']({},_0x5a1c39,_0x4ec294[_0xb5fa('0x3d')]);var _0x3ae696={'where':_0x5a1c39[_0xb5fa('0x3a')]};return db[_0xb5fa('0x2c')][_0xb5fa('0x3e')](_0x3ae696)[_0xb5fa('0x26')](function(_0x4b4c4c){_0x460b54['count']=_0x4b4c4c;if(_0x4ec294['query'][_0xb5fa('0x3f')]){_0x5a1c39['include']=[{'all':!![]}];}return db[_0xb5fa('0x2c')]['findAll'](_0x5a1c39);})['then'](function(_0x3cdf63){_0x460b54[_0xb5fa('0x40')]=_0x3cdf63;return _0x460b54;})[_0xb5fa('0x26')](respondWithFilteredResult(_0x5bdf11,_0x5a1c39))[_0xb5fa('0x41')](handleError(_0x5bdf11,null));};exports[_0xb5fa('0x42')]=function(_0x26ef1b,_0x337c53){var _0x83df0b={'raw':!![],'where':{'id':_0x26ef1b[_0xb5fa('0x43')]['id']}},_0x19e370={};_0x19e370['model']=_[_0xb5fa('0x33')](db['FaxApplication'][_0xb5fa('0x2d')]);_0x19e370[_0xb5fa('0x32')]=_[_0xb5fa('0x33')](_0x26ef1b[_0xb5fa('0x32')]);_0x19e370[_0xb5fa('0x34')]=_[_0xb5fa('0x35')](_0x19e370[_0xb5fa('0x31')],_0x19e370[_0xb5fa('0x32')]);_0x83df0b['attributes']=_[_0xb5fa('0x35')](_0x19e370[_0xb5fa('0x31')],qs['fields'](_0x26ef1b[_0xb5fa('0x32')]['fields']));_0x83df0b[_0xb5fa('0x36')]=_0x83df0b[_0xb5fa('0x36')]['length']?_0x83df0b['attributes']:_0x19e370[_0xb5fa('0x31')];if(_0x26ef1b[_0xb5fa('0x32')][_0xb5fa('0x3f')]){_0x83df0b[_0xb5fa('0x44')]=[{'all':!![]}];}_0x83df0b=_[_0xb5fa('0x3b')]({},_0x83df0b,_0x26ef1b[_0xb5fa('0x3d')]);return db[_0xb5fa('0x2c')][_0xb5fa('0x45')](_0x83df0b)['then'](handleEntityNotFound(_0x337c53,null))[_0xb5fa('0x26')](respondWithResult(_0x337c53,null))[_0xb5fa('0x41')](handleError(_0x337c53,null));};exports['create']=function(_0xee6baa,_0x2c378a){return db[_0xb5fa('0x2c')][_0xb5fa('0x46')](_0xee6baa[_0xb5fa('0x47')],{})[_0xb5fa('0x26')](respondWithResult(_0x2c378a,0xc9))[_0xb5fa('0x41')](handleError(_0x2c378a,null));};exports[_0xb5fa('0x24')]=function(_0x20f5f5,_0x464e36){if(_0x20f5f5[_0xb5fa('0x47')]['id']){delete _0x20f5f5[_0xb5fa('0x47')]['id'];}return db[_0xb5fa('0x2c')][_0xb5fa('0x45')]({'where':{'id':_0x20f5f5[_0xb5fa('0x43')]['id']}})[_0xb5fa('0x26')](handleEntityNotFound(_0x464e36,null))['then'](saveUpdates(_0x20f5f5['body'],null))[_0xb5fa('0x26')](respondWithResult(_0x464e36,null))['catch'](handleError(_0x464e36,null));};exports[_0xb5fa('0x25')]=function(_0x1049d9,_0x5404f6){return db[_0xb5fa('0x2c')][_0xb5fa('0x45')]({'where':{'id':_0x1049d9[_0xb5fa('0x43')]['id']}})[_0xb5fa('0x26')](handleEntityNotFound(_0x5404f6,null))[_0xb5fa('0x26')](removeEntity(_0x5404f6,null))[_0xb5fa('0x41')](handleError(_0x5404f6,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 21ddb45..f6a2f52 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 _0xa0cc=['request-promise','rimraf','../../config/environment','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x1bfcfc,_0x140f5b){var _0x1041ff=function(_0x2d48fc){while(--_0x2d48fc){_0x1bfcfc['push'](_0x1bfcfc['shift']());}};_0x1041ff(++_0x140f5b);}(_0xa0cc,0x175));var _0xca0c=function(_0x5b6d95,_0x83bf55){_0x5b6d95=_0x5b6d95-0x0;var _0x3f746a=_0xa0cc[_0x5b6d95];return _0x3f746a;};'use strict';var _=require(_0xca0c('0x0'));var util=require(_0xca0c('0x1'));var logger=require(_0xca0c('0x2'))(_0xca0c('0x3'));var moment=require('moment');var BPromise=require(_0xca0c('0x4'));var rp=require(_0xca0c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca0c('0x6'));var config=require(_0xca0c('0x7'));var attributes=require('./faxApplication.attributes');module[_0xca0c('0x8')]=function(_0x559027,_0x58ee3f){return _0x559027[_0xca0c('0x9')](_0xca0c('0xa'),attributes,{'tableName':_0xca0c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xca0c('0xc'),'collate':_0xca0c('0xd')});}; \ No newline at end of file +var _0xde01=['request-promise','path','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xde01,0x1d0));var _0x1de0=function(_0x342609,_0x254654){_0x342609=_0x342609-0x0;var _0x3c4021=_0xde01[_0x342609];return _0x3c4021;};'use strict';var _=require(_0x1de0('0x0'));var util=require(_0x1de0('0x1'));var logger=require(_0x1de0('0x2'))(_0x1de0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1de0('0x4'));var fs=require('fs');var path=require(_0x1de0('0x5'));var rimraf=require('rimraf');var config=require(_0x1de0('0x6'));var attributes=require(_0x1de0('0x7'));module[_0x1de0('0x8')]=function(_0x216009,_0x229a81){return _0x216009[_0x1de0('0x9')](_0x1de0('0xa'),attributes,{'tableName':_0x1de0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1de0('0xc'),'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 8877fd8..aa828f9 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 _0x407e=['catch','UpdateFaxApplication','FaxApplication','body','options','where','attributes','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x407e,0x1b7));var _0xe407=function(_0x616fb8,_0x177e11){_0x616fb8=_0x616fb8-0x0;var _0x739e20=_0x407e[_0x616fb8];return _0x739e20;};'use strict';var _=require(_0xe407('0x0'));var util=require(_0xe407('0x1'));var moment=require(_0xe407('0x2'));var BPromise=require('bluebird');var rs=require(_0xe407('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe407('0x4'))['db'];var utils=require(_0xe407('0x5'));var logger=require(_0xe407('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe407('0x7'));var client=jayson[_0xe407('0x8')][_0xe407('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x881b22,_0x55e60a,_0x4e3b37){return new BPromise(function(_0x48c095,_0x2ff2a3){return client[_0xe407('0xa')](_0x881b22,_0x4e3b37)[_0xe407('0xb')](function(_0x1fd2a3){logger[_0xe407('0xc')](_0xe407('0xd'),_0x55e60a,'request\x20sent');logger[_0xe407('0xe')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x55e60a,'request\x20sent',JSON[_0xe407('0xf')](_0x1fd2a3));if(_0x1fd2a3[_0xe407('0x10')]){if(_0x1fd2a3[_0xe407('0x10')]['code']===0x1f4){logger[_0xe407('0x10')]('FaxApplication,\x20%s,\x20%s',_0x55e60a,_0x1fd2a3[_0xe407('0x10')][_0xe407('0x11')]);return _0x2ff2a3(_0x1fd2a3['error'][_0xe407('0x11')]);}logger[_0xe407('0x10')](_0xe407('0xd'),_0x55e60a,_0x1fd2a3[_0xe407('0x10')][_0xe407('0x11')]);return _0x48c095(_0x1fd2a3[_0xe407('0x10')][_0xe407('0x11')]);}else{logger[_0xe407('0xc')](_0xe407('0xd'),_0x55e60a,_0xe407('0x12'));_0x48c095(_0x1fd2a3[_0xe407('0x13')][_0xe407('0x11')]);}})[_0xe407('0x14')](function(_0x45d2f9){logger[_0xe407('0x10')]('FaxApplication,\x20%s,\x20%s',_0x55e60a,_0x45d2f9);_0x2ff2a3(_0x45d2f9);});});}exports[_0xe407('0x15')]=function(_0x254ca7){var _0x1f031e=this;return new Promise(function(_0x22d899,_0x3399d3){return db[_0xe407('0x16')]['update'](_0x254ca7[_0xe407('0x17')],{'raw':_0x254ca7[_0xe407('0x18')]?_0x254ca7[_0xe407('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x254ca7['options']?_0x254ca7[_0xe407('0x18')][_0xe407('0x19')]||null:null,'attributes':_0x254ca7[_0xe407('0x18')]?_0x254ca7[_0xe407('0x18')][_0xe407('0x1a')]||null:null,'limit':_0x254ca7[_0xe407('0x18')]?_0x254ca7[_0xe407('0x18')]['limit']||null:null})[_0xe407('0xb')](function(_0x535461){logger['info'](_0xe407('0x15'),_0x254ca7);logger[_0xe407('0xe')](_0xe407('0x15'),_0x254ca7,JSON[_0xe407('0xf')](_0x535461));_0x22d899(_0x535461);})[_0xe407('0x14')](function(_0x580764){logger[_0xe407('0x10')](_0xe407('0x15'),_0x580764[_0xe407('0x11')],_0x254ca7);_0x3399d3(_0x1f031e[_0xe407('0x10')](0x1f4,_0x580764[_0xe407('0x11')]));});});}; \ No newline at end of file +var _0x9942=['error','code','FaxApplication,\x20%s,\x20%s','message','info','UpdateFaxApplication','FaxApplication','body','options','raw','attributes','limit','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x53c6ca,_0x454a72){var _0x125566=function(_0x3bdb35){while(--_0x3bdb35){_0x53c6ca['push'](_0x53c6ca['shift']());}};_0x125566(++_0x454a72);}(_0x9942,0x169));var _0x2994=function(_0x3e3c8f,_0x4b97ac){_0x3e3c8f=_0x3e3c8f-0x0;var _0x1d976a=_0x9942[_0x3e3c8f];return _0x1d976a;};'use strict';var _=require(_0x2994('0x0'));var util=require('util');var moment=require(_0x2994('0x1'));var BPromise=require('bluebird');var rs=require(_0x2994('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2994('0x3'))['db'];var utils=require(_0x2994('0x4'));var logger=require('../../config/logger')(_0x2994('0x5'));var config=require(_0x2994('0x6'));var jayson=require(_0x2994('0x7'));var client=jayson[_0x2994('0x8')][_0x2994('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d345b,_0x165499,_0x33d063){return new BPromise(function(_0x12db81,_0x4b3601){return client[_0x2994('0xa')](_0x5d345b,_0x33d063)[_0x2994('0xb')](function(_0x2efc8d){logger['info']('FaxApplication,\x20%s,\x20%s',_0x165499,'request\x20sent');logger[_0x2994('0xc')](_0x2994('0xd'),_0x165499,_0x2994('0xe'),JSON[_0x2994('0xf')](_0x2efc8d));if(_0x2efc8d['error']){if(_0x2efc8d[_0x2994('0x10')][_0x2994('0x11')]===0x1f4){logger[_0x2994('0x10')](_0x2994('0x12'),_0x165499,_0x2efc8d[_0x2994('0x10')][_0x2994('0x13')]);return _0x4b3601(_0x2efc8d[_0x2994('0x10')][_0x2994('0x13')]);}logger['error'](_0x2994('0x12'),_0x165499,_0x2efc8d[_0x2994('0x10')][_0x2994('0x13')]);return _0x12db81(_0x2efc8d[_0x2994('0x10')][_0x2994('0x13')]);}else{logger[_0x2994('0x14')](_0x2994('0x12'),_0x165499,_0x2994('0xe'));_0x12db81(_0x2efc8d['result'][_0x2994('0x13')]);}})['catch'](function(_0x390ddd){logger['error'](_0x2994('0x12'),_0x165499,_0x390ddd);_0x4b3601(_0x390ddd);});});}exports[_0x2994('0x15')]=function(_0x386db7){var _0x58e36b=this;return new Promise(function(_0x470c2f,_0x546d67){return db[_0x2994('0x16')]['update'](_0x386db7[_0x2994('0x17')],{'raw':_0x386db7[_0x2994('0x18')]?_0x386db7[_0x2994('0x18')][_0x2994('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x386db7[_0x2994('0x18')]?_0x386db7[_0x2994('0x18')]['where']||null:null,'attributes':_0x386db7['options']?_0x386db7['options'][_0x2994('0x1a')]||null:null,'limit':_0x386db7[_0x2994('0x18')]?_0x386db7[_0x2994('0x18')][_0x2994('0x1b')]||null:null})[_0x2994('0xb')](function(_0x5c6881){logger['info']('UpdateFaxApplication',_0x386db7);logger[_0x2994('0xc')](_0x2994('0x15'),_0x386db7,JSON[_0x2994('0xf')](_0x5c6881));_0x470c2f(_0x5c6881);})[_0x2994('0x1c')](function(_0x178c6a){logger[_0x2994('0x10')](_0x2994('0x15'),_0x178c6a[_0x2994('0x13')],_0x386db7);_0x546d67(_0x58e36b['error'](0x1f4,_0x178c6a[_0x2994('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 992036e..2ab6906 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 _0xafc4=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','create','put','update','exports'];(function(_0x5f240c,_0x3db73e){var _0x4a0775=function(_0x1ce108){while(--_0x1ce108){_0x5f240c['push'](_0x5f240c['shift']());}};_0x4a0775(++_0x3db73e);}(_0xafc4,0x69));var _0x4afc=function(_0x79702,_0x34931c){_0x79702=_0x79702-0x0;var _0x417e6b=_0xafc4[_0x79702];return _0x417e6b;};'use strict';var multer=require(_0x4afc('0x0'));var util=require('util');var path=require(_0x4afc('0x1'));var timeout=require('connect-timeout');var express=require(_0x4afc('0x2'));var router=express[_0x4afc('0x3')]();var auth=require(_0x4afc('0x4'));var interaction=require(_0x4afc('0x5'));var config=require('../../config/environment');var controller=require('./faxApplication.controller');router['get']('/',auth[_0x4afc('0x6')](),controller[_0x4afc('0x7')]);router[_0x4afc('0x8')](_0x4afc('0x9'),auth[_0x4afc('0x6')](),controller[_0x4afc('0xa')]);router['post']('/',auth[_0x4afc('0x6')](),controller[_0x4afc('0xb')]);router[_0x4afc('0xc')](_0x4afc('0x9'),auth[_0x4afc('0x6')](),controller[_0x4afc('0xd')]);router['delete']('/:id',auth[_0x4afc('0x6')](),controller['destroy']);module[_0x4afc('0xe')]=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(_0x547eb5,_0x544ff1){var _0x3598fd=function(_0x26147d){while(--_0x26147d){_0x547eb5['push'](_0x547eb5['shift']());}};_0x3598fd(++_0x544ff1);}(_0xf494,0x1c6));var _0x4f49=function(_0xd3ec57,_0x38a7bb){_0xd3ec57=_0xd3ec57-0x0;var _0x53185e=_0xf494[_0xd3ec57];return _0x53185e;};'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 bb51a8a..233fc2b 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 _0x7765=['sequelize','exports','BOOLEAN','STRING','DATE','ENUM','out'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7765,0x103));var _0x5776=function(_0x348781,_0x1d0517){_0x348781=_0x348781-0x0;var _0x5bcf65=_0x7765[_0x348781];return _0x5bcf65;};'use strict';var Sequelize=require(_0x5776('0x0'));module[_0x5776('0x1')]={'closed':{'type':Sequelize[_0x5776('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5776('0x3')]},'read1stAt':{'type':Sequelize[_0x5776('0x4')]},'fax':{'type':Sequelize[_0x5776('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x5776('0x5')]('in',_0x5776('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5776('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x5776('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x1e16=['BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x221dad,_0x2173a0){var _0x4635c4=function(_0x3039e3){while(--_0x3039e3){_0x221dad['push'](_0x221dad['shift']());}};_0x4635c4(++_0x2173a0);}(_0x1e16,0xaf));var _0x61e1=function(_0x56756b,_0x3e8cc7){_0x56756b=_0x56756b-0x0;var _0xa3002=_0x1e16[_0x56756b];return _0xa3002;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x61e1('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x61e1('0x1')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x61e1('0x1')]},'fax':{'type':Sequelize[_0x61e1('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x61e1('0x3')]('in',_0x61e1('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x61e1('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x61e1('0x3')]('in',_0x61e1('0x4')),'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 5fd8101..7c11392 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 _0x315f=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','users','u.id\x20=\x20ui.UserId','left_join','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','length','unreadMessages','value','`\x20=\x200','having','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?','find','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','isArray','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?','i.id','Sequelize','QueryTypes','SELECT','clone','DESC','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','FaxInteraction','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.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','catch','show','params','include','options','create','body','update','describe','FaxMessage','omit','ids','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','color','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','push','Attachment','Messages','get','mkdirSync','basename','existsSync','pipe','createWriteStream','log','err','unlinkSync','html-pdf','rimraf','request-promise','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','redis','localhost','socket.io-emitter','register','status','end','json','offset','limit','set','Content-Range','apply','reject','save','destroy','error','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','then','index','rawAttributes','type','model','query','keys','intersection'];(function(_0x4e69f7,_0x2031af){var _0x67b5e2=function(_0x50b8b1){while(--_0x50b8b1){_0x4e69f7['push'](_0x4e69f7['shift']());}};_0x67b5e2(++_0x2031af);}(_0x315f,0x174));var _0xf315=function(_0x59e862,_0x477bf2){_0x59e862=_0x59e862-0x0;var _0x1a25ee=_0x315f[_0x59e862];return _0x1a25ee;};'use strict';var pdf=require(_0xf315('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf315('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf315('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf315('0x3'));var sox=require('sox');var csv=require(_0xf315('0x4'));var ejs=require(_0xf315('0x5'));var fs=require('fs');var _=require(_0xf315('0x6'));var squel=require(_0xf315('0x7'));var crypto=require(_0xf315('0x8'));var jsforce=require(_0xf315('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf315('0xa'));var Papa=require('papaparse');var Redis=require(_0xf315('0xb'));var authService=require(_0xf315('0xc'));var qs=require(_0xf315('0xd'));var as=require(_0xf315('0xe'));var hardwareService=require(_0xf315('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xf315('0x10'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf315('0x11')]=_['defaults'](config[_0xf315('0x11')],{'host':_0xf315('0x12'),'port':0x18eb});var socket=require(_0xf315('0x13'))(new Redis(config[_0xf315('0x11')]));require('./faxInteraction.socket')[_0xf315('0x14')](socket);function respondWithStatusCode(_0x1ee2ef,_0x56deea){_0x56deea=_0x56deea||0xcc;return function(_0x19bb1a){if(_0x19bb1a){return _0x1ee2ef['sendStatus'](_0x56deea);}return _0x1ee2ef[_0xf315('0x15')](_0x56deea)[_0xf315('0x16')]();};}function respondWithResult(_0x20a72c,_0x22c049){_0x22c049=_0x22c049||0xc8;return function(_0x45fc6d){if(_0x45fc6d){return _0x20a72c[_0xf315('0x15')](_0x22c049)[_0xf315('0x17')](_0x45fc6d);}};}function respondWithFilteredResult(_0x44e8ab,_0x3d0630){return function(_0x294933){if(_0x294933){var _0x3cc17b=_0x294933['count'],_0x252d9c=_0x3d0630[_0xf315('0x18')],_0x24ae41=_0x3d0630[_0xf315('0x18')]+_0x3d0630[_0xf315('0x19')],_0xb5fcb6;if(_0x24ae41>=_0x3cc17b){_0x24ae41=_0x3cc17b;_0xb5fcb6=0xc8;}else{_0xb5fcb6=0xce;}_0x44e8ab[_0xf315('0x15')](_0xb5fcb6);return _0x44e8ab[_0xf315('0x1a')](_0xf315('0x1b'),_0x252d9c+'-'+_0x24ae41+'/'+_0x3cc17b)[_0xf315('0x17')](_0x294933);}return null;};}function patchUpdates(_0x42e89f){return function(_0x558377){try{jsonpatch[_0xf315('0x1c')](_0x558377,_0x42e89f,!![]);}catch(_0x2ba642){return BPromise[_0xf315('0x1d')](_0x2ba642);}return _0x558377[_0xf315('0x1e')]();};}function saveUpdates(_0x21dfad,_0x56f6e3){return function(_0x120158){if(_0x120158){return _0x120158['update'](_0x21dfad)['then'](function(_0x4b218b){return _0x4b218b;});}return null;};}function removeEntity(_0x25d707,_0x219bf2){return function(_0x14021d){if(_0x14021d){return _0x14021d[_0xf315('0x1f')]()['then'](function(){_0x25d707['status'](0xcc)[_0xf315('0x16')]();});}};}function handleEntityNotFound(_0x10354c,_0x4b730d){return function(_0x325a29){if(!_0x325a29){_0x10354c['sendStatus'](0x194);}return _0x325a29;};}function handleError(_0x52b51,_0x4d16e2){_0x4d16e2=_0x4d16e2||0x1f4;return function(_0x41dac4){logger[_0xf315('0x20')](_0x41dac4[_0xf315('0x21')]);if(_0x41dac4[_0xf315('0x22')]){delete _0x41dac4[_0xf315('0x22')];}_0x52b51['status'](_0x4d16e2)['send'](_0x41dac4);};}function getInteractionUsers(_0x456325,_0x2072db){return new BPromise(function(_0x8866ef,_0x46ceb3){try{if(_0x2072db[_0x456325['id']]){_0x456325[_0xf315('0x23')]=_[_0xf315('0x24')](_0x2072db[_0x456325['id']],function(_0x2915c3){return{'id':_0x2915c3['id'],'fullname':_0x2915c3[_0xf315('0x25')]};});}}catch(_0x11993e){_0x46ceb3(_0x11993e);}_0x8866ef(_0x456325);});}function getInteractionTags(_0x514d38,_0x373c9e){return new BPromise(function(_0x42ffd3,_0x41bfdc){try{if(_0x514d38[_0xf315('0x26')]){_0x514d38[_0xf315('0x27')]=[];_0x514d38[_0xf315('0x26')][_0xf315('0x28')](',')[_0xf315('0x29')](function(_0x49e619){_0x514d38[_0xf315('0x27')]['push'](_0x373c9e[_0x49e619]);});}delete _0x514d38[_0xf315('0x26')];}catch(_0x3ebe6c){_0x41bfdc(_0x3ebe6c);}_0x42ffd3(_0x514d38);});}function updateFaxInteraction(_0x132354,_0x1df5ad,_0xe5550f){return new BPromise(function(_0x1430f0,_0x1c2195){return getInteractionUsers(_0x132354,_0xe5550f)['then'](function(_0x150786){return getInteractionTags(_0x150786,_0x1df5ad);})[_0xf315('0x2a')](function(_0x10ac94){_0x1430f0(_0x10ac94);})['catch'](function(_0x26b142){_0x1c2195(_0x26b142);});});}exports[_0xf315('0x2b')]=function(_0x32329d,_0x357915){var _0x172968={},_0x34d592={},_0x4d1e17={'count':0x0,'rows':[]};var _0x5d29ca=_[_0xf315('0x24')](db['FaxInteraction'][_0xf315('0x2c')],function(_0x48b993){return{'name':_0x48b993['fieldName'],'type':_0x48b993[_0xf315('0x2d')]['key']};});_0x34d592[_0xf315('0x2e')]=_[_0xf315('0x24')](_0x5d29ca,_0xf315('0x22'));_0x34d592[_0xf315('0x2f')]=_[_0xf315('0x30')](_0x32329d[_0xf315('0x2f')]);_0x34d592['filters']=_[_0xf315('0x31')](_0x34d592[_0xf315('0x2e')],_0x34d592[_0xf315('0x2f')]);_0x172968[_0xf315('0x32')]=_[_0xf315('0x31')](_0x34d592[_0xf315('0x2e')],qs[_0xf315('0x33')](_0x32329d[_0xf315('0x2f')]['fields']));_0x172968[_0xf315('0x32')]=_0x172968[_0xf315('0x32')]['length']?_0x172968[_0xf315('0x32')]:_0x34d592[_0xf315('0x2e')];if(!_0x32329d[_0xf315('0x2f')][_0xf315('0x34')](_0xf315('0x35'))){_0x172968['limit']=qs['limit'](_0x32329d[_0xf315('0x2f')][_0xf315('0x19')]);_0x172968[_0xf315('0x18')]=qs[_0xf315('0x18')](_0x32329d[_0xf315('0x2f')]['offset']);}_0x172968[_0xf315('0x36')]=qs[_0xf315('0x37')](_0x32329d[_0xf315('0x2f')]['sort']);_0x172968[_0xf315('0x38')]=qs[_0xf315('0x39')](_[_0xf315('0x3a')](_0x32329d[_0xf315('0x2f')],_0x34d592[_0xf315('0x39')]),_0x5d29ca);var _0x4d8e86=[];var _0x12dbdf=squel[_0xf315('0x3b')]()['field']('id')['field'](_0xf315('0x22'))[_0xf315('0x3c')]('color')[_0xf315('0x3d')](_0xf315('0x3e'));var _0x370382=squel['select']()[_0xf315('0x3c')](_0xf315('0x3f'))[_0xf315('0x3c')](_0xf315('0x40'))['field'](_0xf315('0x41'))[_0xf315('0x3d')]('user_has_fax_interactions','ui')['left_join'](_0xf315('0x42'),'u',_0xf315('0x43'));var _0x4a6574=squel[_0xf315('0x3b')]()[_0xf315('0x3d')]('fax_interactions','i')[_0xf315('0x44')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xf315('0x44')]('users','o',_0xf315('0x45'))[_0xf315('0x44')](_0xf315('0x46'),'a',_0xf315('0x47'))['left_join'](_0xf315('0x48'),'me',_0xf315('0x49'))[_0xf315('0x44')](_0xf315('0x4a'),'it',_0xf315('0x4b'))['left_join'](_0xf315('0x3e'),'t','t.id\x20=\x20it.TagId');var _0xbdc954=squel[_0xf315('0x4c')]();var _0x59f371=[];var _0x130696=squel['expr']();var _0x42b5e0;if(_0x32329d[_0xf315('0x2f')][_0xf315('0x4d')]){_0x42b5e0=as[_0xf315('0x4e')](_0x32329d[_0xf315('0x2f')][_0xf315('0x4d')]);var _0x28d929=_0x42b5e0[_0xf315('0x4f')];for(var _0x3d7c21=0x0;_0x3d7c21<_0x42b5e0[_0xf315('0x50')][_0xf315('0x51')];_0x3d7c21++){var _0x153fea=_0x42b5e0[_0xf315('0x50')][_0x3d7c21];var _0x404aa6='i';var _0x1163d2=_['find'](_0x5d29ca,['name',_0x153fea[_0xf315('0x3c')]]);if(!_0x1163d2){switch(_0x153fea[_0xf315('0x3c')]){case _0xf315('0x52'):if(_0x153fea[_0xf315('0x53')]==0x1){_0x4a6574['having']('`'+_0x153fea[_0xf315('0x3c')]+_0xf315('0x54'));}else{_0x4a6574[_0xf315('0x55')]('`'+_0x153fea[_0xf315('0x3c')]+'`\x20>\x200');}break;case _0xf315('0x56'):if(_0x153fea[_0xf315('0x57')]===_0xf315('0x58')){if(_0x153fea[_0xf315('0x53')]['split']('\x20')[_0xf315('0x51')]>0x1){_0xbdc954[_0x28d929](_0xf315('0x59'),qs[_0xf315('0x5a')](_0x153fea[_0xf315('0x53')]),null);}else{var _0x124d1c='%'+_0x153fea[_0xf315('0x53')]+'%';_0xbdc954[_0x28d929](_0xf315('0x5b'),_0x124d1c,_0x124d1c,_0x124d1c);}}else{_0x1163d2=_[_0xf315('0x5c')](_0x5d29ca,[_0xf315('0x22'),_0xf315('0x5d')]);_0x153fea[_0xf315('0x3c')]=_0xf315('0x5d');_0x72bc4c=as['buildExpression'](_0x404aa6,_0x1163d2[_0xf315('0x2d')],_0x153fea);_0xbdc954[_0x28d929](_0x72bc4c[_0xf315('0x5e')],_0x72bc4c[_0xf315('0x53')][_0xf315('0x5f')],_0x72bc4c[_0xf315('0x53')][_0xf315('0x16')]);}break;case _0xf315('0x60'):var _0x3c943b=_0x153fea[_0xf315('0x53')][_0xf315('0x28')](',')[_0xf315('0x24')](function(_0x35e069){return Number(_0x35e069);});_0x3c943b['forEach'](function(_0x5dab81){_0x130696['or'](_0xf315('0x61'),'%,'+_0x5dab81+',%');});_0x59f371=_[_0xf315('0x62')](_0x59f371,_0x3c943b);break;case _0xf315('0x63'):if(_0x153fea[_0xf315('0x57')]==='$substring'){_0xbdc954[_0x28d929](_0xf315('0x64'),'%'+_0x153fea[_0xf315('0x53')]+'%',null);}else{_0x1163d2=_['find'](_0x5d29ca,[_0xf315('0x22'),_0xf315('0x65')]);_0x153fea['field']=_0xf315('0x65');_0x72bc4c=as[_0xf315('0x66')](_0x404aa6,_0x1163d2[_0xf315('0x2d')],_0x153fea);_0xbdc954[_0x28d929](_0x72bc4c[_0xf315('0x5e')],_0x72bc4c[_0xf315('0x53')][_0xf315('0x5f')],_0x72bc4c[_0xf315('0x53')][_0xf315('0x16')]);}break;case'body':_0x72bc4c=as[_0xf315('0x66')]('me',null,_0x153fea);_0xbdc954[_0x28d929](_0x72bc4c[_0xf315('0x5e')],_0x72bc4c[_0xf315('0x53')][_0xf315('0x5f')],_0x72bc4c['value'][_0xf315('0x16')]);break;}}else{var _0x72bc4c=as[_0xf315('0x66')](_0x404aa6,_0x1163d2[_0xf315('0x2d')],_0x153fea);_0xbdc954[_0x28d929](_0x72bc4c[_0xf315('0x5e')],_0x72bc4c[_0xf315('0x53')][_0xf315('0x5f')],_0x72bc4c[_0xf315('0x53')]['end']);}}}else{var _0x365502=_(_0x32329d[_0xf315('0x2f')])[_0xf315('0x30')]()['map'](function(_0x2aaa32){return _[_0xf315('0x67')](_0x5d29ca,[_0xf315('0x22'),_0x2aaa32])?_0x2aaa32:undefined;})[_0xf315('0x68')]()['value']();if(!_[_0xf315('0x69')](_0x365502)){_0x365502[_0xf315('0x29')](function(_0x36d401){if(_0x36d401===_0xf315('0x6a')){_0x4a6574[_0xf315('0x38')](_0xf315('0x6b'),[][_0xf315('0x6c')](_0x32329d[_0xf315('0x2f')][_0x36d401]));}else if(_0x36d401===_0xf315('0x6d')){var _0x5e811a=JSON['parse'](_0x32329d[_0xf315('0x2f')][_0x36d401])[_0xf315('0x6e')];var _0x4d85ce=JSON[_0xf315('0x6f')](_0x32329d[_0xf315('0x2f')][_0x36d401])[_0xf315('0x70')];_0x4a6574[_0xf315('0x38')](_0xf315('0x71'),_0x5e811a,_0x4d85ce);}else{if(_0x32329d['query'][_0x36d401]===_0xf315('0x72')){_0x4a6574[_0xf315('0x38')]('i.'+_0x36d401+'\x20IS\x20NULL');}else{_0x4a6574[_0xf315('0x38')]('i.'+_0x36d401+_0xf315('0x73'),_0x32329d['query'][_0x36d401]);}}});}if(_0x32329d[_0xf315('0x2f')][_0xf315('0x74')]){if(_0x32329d[_0xf315('0x2f')]['read']==0x1){_0x4a6574[_0xf315('0x55')](_0xf315('0x75'));}else{_0x4a6574[_0xf315('0x55')]('`unreadMessages`\x20>\x200');}}if(_0x32329d[_0xf315('0x2f')]['tag']){_0x59f371=_[_0xf315('0x76')](_0x32329d[_0xf315('0x2f')][_0xf315('0x77')])?_0x32329d['query']['tag']:new Array(_0x32329d['query'][_0xf315('0x77')]);_0x59f371[_0xf315('0x29')](function(_0x5cc49a){_0x130696['or'](_0xf315('0x61'),'%,'+_0x5cc49a+',%');});}if(_0x32329d[_0xf315('0x2f')]['filter']){var _0x392d57=_0x32329d[_0xf315('0x2f')][_0xf315('0x78')][_0xf315('0x79')]('\x5c','\x5c\x5c')[_0xf315('0x79')]('\x27\x27',_0xf315('0x7a'));if(qs[_0xf315('0x7b')](_0x392d57)){_0xbdc954['or'](_0xf315('0x7c'),_0x392d57+'%')['or'](_0xf315('0x7d'),_0x392d57+'%');}_0xbdc954['or'](_0xf315('0x7e'),_0x392d57+'%');}}_0x4a6574[_0xf315('0x38')](_0xbdc954);_0x4a6574['group'](_0xf315('0x7f'));var _0x598651={'type':db[_0xf315('0x80')][_0xf315('0x81')][_0xf315('0x82')],'raw':!![]};var _0x108295=_0x4a6574[_0xf315('0x83')]();_0x108295[_0xf315('0x3c')](_0xf315('0x7f'));_0x108295['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf315('0x52'));if(_0x172968[_0xf315('0x36')]){_0x172968[_0xf315('0x36')][_0xf315('0x29')](function(_0x42cc06){_0x4a6574['order']('i.'+_0x42cc06[0x0],_0x42cc06[0x1]===_0xf315('0x84')?![]:!![]);});}if(!_[_0xf315('0x69')](_0x59f371)){_0x4a6574[_0xf315('0x55')](_0x130696);_0x108295['where'](_0xf315('0x85'),_0x59f371);}BPromise[_0xf315('0x86')]()[_0xf315('0x2a')](function(){if(!_0x42b5e0){if(_0x32329d['query']['FaxAccountId']||_0x32329d[_0xf315('0x2f')][_0xf315('0x87')])return;_0x108295[_0xf315('0x38')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x4a6574['where'](_0xf315('0x88'));return;}return _0x32329d['user'][_0xf315('0x89')]({'attributes':['id'],'raw':!![]})[_0xf315('0x2a')](function(_0x4ba848){if(_[_0xf315('0x69')](_0x4ba848)){_0x108295['where'](_0xf315('0x8a'));_0x4a6574[_0xf315('0x38')](_0xf315('0x8a'));}else{_0x108295[_0xf315('0x38')](_0xf315('0x6b'),_['map'](_0x4ba848,'id'));_0x4a6574[_0xf315('0x38')](_0xf315('0x6b'),_['map'](_0x4ba848,'id'));}});})[_0xf315('0x2a')](function(){db[_0xf315('0x8b')][_0xf315('0x2f')](_0x108295[_0xf315('0x8c')](),_0x598651)[_0xf315('0x2a')](function(_0x78d273){_0x4d1e17[_0xf315('0x8d')]=_0x78d273[_0xf315('0x51')];if(_0x4d1e17['count']===0x0)return[];return db[_0xf315('0x8b')]['query'](_0x12dbdf['toString'](),_0x598651)[_0xf315('0x2a')](function(_0x40c905){_0x4d8e86=_[_0xf315('0x8e')](_0x40c905,'id');_0x598651=_[_0xf315('0x8f')](_0x598651,{'model':db[_0xf315('0x90')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x32329d[_0xf315('0x2f')]['fields']){_0x172968[_0xf315('0x32')][_0xf315('0x29')](function(_0x5802d3){_0x4a6574[_0xf315('0x3c')]('i.'+_0x5802d3);});}else{_0x4a6574['field'](_0xf315('0x91'),_0xf315('0x52'));_0x4a6574[_0xf315('0x3c')](_0xf315('0x92'),_0xf315('0x93'));_0x4a6574['field'](_0xf315('0x94'),_0xf315('0x95'));_0x4a6574[_0xf315('0x3c')](_0xf315('0x96'));_0x4a6574['field'](_0xf315('0x97'),_0xf315('0x98'));_0x4a6574[_0xf315('0x3c')](_0xf315('0x99'),_0xf315('0x9a'));_0x4a6574['field'](_0xf315('0x9b'),_0xf315('0x9c'));_0x4a6574['field']('c.phone','Contact.phone');_0x4a6574[_0xf315('0x3c')](_0xf315('0x9d'),_0xf315('0x9e'));_0x4a6574[_0xf315('0x3c')](_0xf315('0x9f'),'Contact.fax');_0x4a6574['field'](_0xf315('0xa0'),_0xf315('0xa1'));_0x4a6574[_0xf315('0x3c')](_0xf315('0xa2'),_0xf315('0xa3'));_0x4a6574[_0xf315('0x3c')](_0xf315('0xa4'),'TagIds');}if(_0x172968[_0xf315('0x19')])_0x4a6574[_0xf315('0x19')](_0x172968['limit']);if(_0x172968[_0xf315('0x18')])_0x4a6574[_0xf315('0x18')](_0x172968[_0xf315('0x18')]);return db['sequelize']['query'](_0x4a6574[_0xf315('0x8c')](),_0x598651);})[_0xf315('0x2a')](function(_0x2c43f3){_0x370382['where'](_0xf315('0xa5'),_['map'](_0x2c43f3,'id'));return db['sequelize']['query'](_0x370382[_0xf315('0x8c')](),_0x598651)[_0xf315('0x2a')](function(_0x286345){var _0x4ad2fb=_[_0xf315('0xa6')](_0x286345,_0xf315('0xa7'));var _0x4cae73=[];_0x2c43f3['forEach'](function(_0x293da6){_0x4cae73['push'](updateFaxInteraction(_0x293da6,_0x4d8e86,_0x4ad2fb));});return BPromise['all'](_0x4cae73);});});})[_0xf315('0x2a')](function(_0x2c7550){_0x4d1e17['rows']=_0x2c7550;return _0x4d1e17;})[_0xf315('0x2a')](respondWithFilteredResult(_0x357915,_0x172968));})[_0xf315('0xa8')](handleError(_0x357915,null));};exports[_0xf315('0xa9')]=function(_0x25d927,_0x31a1c0){var _0x2f512e={'raw':![],'where':{'id':_0x25d927[_0xf315('0xaa')]['id']}},_0x1afbff={};_0x1afbff[_0xf315('0x2e')]=_[_0xf315('0x30')](db[_0xf315('0x90')][_0xf315('0x2c')]);_0x1afbff[_0xf315('0x2f')]=_[_0xf315('0x30')](_0x25d927[_0xf315('0x2f')]);_0x1afbff['filters']=_['intersection'](_0x1afbff[_0xf315('0x2e')],_0x1afbff['query']);_0x2f512e[_0xf315('0x32')]=_[_0xf315('0x31')](_0x1afbff[_0xf315('0x2e')],qs[_0xf315('0x33')](_0x25d927[_0xf315('0x2f')][_0xf315('0x33')]));_0x2f512e[_0xf315('0x32')]=_0x2f512e[_0xf315('0x32')][_0xf315('0x51')]?_0x2f512e[_0xf315('0x32')]:_0x1afbff[_0xf315('0x2e')];if(_0x25d927[_0xf315('0x2f')]['includeAll']){_0x2f512e[_0xf315('0xab')]=[{'all':!![]}];}_0x2f512e=_['merge']({},_0x2f512e,_0x25d927[_0xf315('0xac')]);return db[_0xf315('0x90')][_0xf315('0x5c')](_0x2f512e)[_0xf315('0x2a')](handleEntityNotFound(_0x31a1c0,null))[_0xf315('0x2a')](respondWithResult(_0x31a1c0,null))[_0xf315('0xa8')](handleError(_0x31a1c0,null));};exports['create']=function(_0x27544a,_0x4afe86){return db['FaxInteraction'][_0xf315('0xad')](_0x27544a[_0xf315('0xae')],{})[_0xf315('0x2a')](respondWithResult(_0x4afe86,0xc9))[_0xf315('0xa8')](handleError(_0x4afe86,null));};exports[_0xf315('0xaf')]=function(_0x346851,_0x2ec3b5){if(_0x346851[_0xf315('0xae')]['id']){delete _0x346851['body']['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x346851[_0xf315('0xaa')]['id']}})['then'](handleEntityNotFound(_0x2ec3b5,null))[_0xf315('0x2a')](saveUpdates(_0x346851[_0xf315('0xae')],null))[_0xf315('0x2a')](respondWithResult(_0x2ec3b5,null))[_0xf315('0xa8')](handleError(_0x2ec3b5,null));};exports[_0xf315('0x1f')]=function(_0x4158b0,_0x1bd8dd){return db[_0xf315('0x90')][_0xf315('0x5c')]({'where':{'id':_0x4158b0[_0xf315('0xaa')]['id']}})[_0xf315('0x2a')](handleEntityNotFound(_0x1bd8dd,null))[_0xf315('0x2a')](removeEntity(_0x1bd8dd,null))[_0xf315('0xa8')](handleError(_0x1bd8dd,null));};exports[_0xf315('0xb0')]=function(_0x30c6c9,_0x20b92f){return db[_0xf315('0x90')][_0xf315('0xb0')]()[_0xf315('0x2a')](respondWithResult(_0x20b92f,null))['catch'](handleError(_0x20b92f,null));};exports['addMessage']=function(_0x45abdf,_0x3877e0,_0x3b146a){return db[_0xf315('0xb1')][_0xf315('0x5c')]({'where':{'id':_0x45abdf['params']['id']}})['then'](handleEntityNotFound(_0x3877e0,null))[_0xf315('0x2a')](function(_0x182241){if(_0x182241){return _0x182241['addMessage'](_0x45abdf['body']['ids'],_[_0xf315('0xb2')](_0x45abdf[_0xf315('0xae')],[_0xf315('0xb3'),'id'])||{});}})[_0xf315('0x2a')](respondWithResult(_0x3877e0,null))[_0xf315('0xa8')](handleError(_0x3877e0,null));};exports[_0xf315('0xb4')]=function(_0x2b6127,_0x466451,_0x463f2d){var _0x20440b={'raw':![],'where':{}};var _0x136d78={};var _0x10a906={'count':0x0,'rows':[]};return db[_0xf315('0x90')][_0xf315('0xb5')]({'where':{'id':_0x2b6127[_0xf315('0xaa')]['id']}})[_0xf315('0x2a')](handleEntityNotFound(_0x466451,null))[_0xf315('0x2a')](function(_0x573779){if(_0x573779){_0x136d78[_0xf315('0x2e')]=_[_0xf315('0x30')](db[_0xf315('0xb1')][_0xf315('0x2c')]);_0x136d78[_0xf315('0x2f')]=_[_0xf315('0x30')](_0x2b6127[_0xf315('0x2f')]);_0x136d78[_0xf315('0x39')]=_[_0xf315('0x31')](_0x136d78['model'],_0x136d78['query']);_0x20440b['attributes']=_['intersection'](_0x136d78['model'],qs[_0xf315('0x33')](_0x2b6127['query'][_0xf315('0x33')]));_0x20440b[_0xf315('0x32')]=_0x20440b[_0xf315('0x32')][_0xf315('0x51')]?_0x20440b['attributes']:_0x136d78['model'];if(!_0x2b6127[_0xf315('0x2f')][_0xf315('0x34')](_0xf315('0x35'))){_0x20440b[_0xf315('0x19')]=qs['limit'](_0x2b6127['query'][_0xf315('0x19')]);_0x20440b[_0xf315('0x18')]=qs[_0xf315('0x18')](_0x2b6127[_0xf315('0x2f')]['offset']);}_0x20440b['order']=qs[_0xf315('0x37')](_0x2b6127[_0xf315('0x2f')][_0xf315('0x37')]);_0x20440b[_0xf315('0x38')]=qs['filters'](_['pick'](_0x2b6127[_0xf315('0x2f')],_0x136d78['filters']));_0x20440b[_0xf315('0x38')][_0xf315('0xa7')]=_0x573779['id'];if(_0x2b6127['query'][_0xf315('0x78')]){_0x20440b[_0xf315('0x38')]=_[_0xf315('0x8f')](_0x20440b[_0xf315('0x38')],{'$or':_[_0xf315('0x24')](_0x20440b[_0xf315('0x32')],function(_0x325aaf){var _0x46d90f={};_0x46d90f[_0x325aaf]={'$like':'%'+_0x2b6127[_0xf315('0x2f')][_0xf315('0x78')]+'%'};return _0x46d90f;})});}if(_0x2b6127[_0xf315('0x2f')]['$gte']){var _0x479e66=_0x2b6127[_0xf315('0x2f')][_0xf315('0x6e')][_0xf315('0x28')](',');var _0x1df26a={};_0x1df26a[_0x479e66[0x0]]={'$gte':moment(_0x479e66[0x1])[_0xf315('0xb6')](_0xf315('0xb7'))};_0x20440b[_0xf315('0x38')]=_[_0xf315('0x8f')](_0x20440b[_0xf315('0x38')],_0x1df26a);}_0x20440b=_[_0xf315('0x8f')]({},_0x20440b,_0x2b6127[_0xf315('0xac')]);return db[_0xf315('0xb1')][_0xf315('0x8d')]({'where':_0x20440b[_0xf315('0x38')]})[_0xf315('0x2a')](function(_0x1f65d2){_0x10a906[_0xf315('0x8d')]=_0x1f65d2;if(_0x2b6127[_0xf315('0x2f')]['includeAll']){_0x20440b[_0xf315('0xab')]=[{'all':!![]}];}return db[_0xf315('0xb1')][_0xf315('0xb8')](_0x20440b);})[_0xf315('0x2a')](function(_0x2db115){_0x10a906[_0xf315('0xb9')]=_0x2db115;return _0x10a906;});}})[_0xf315('0x2a')](respondWithFilteredResult(_0x466451,_0x20440b))['catch'](handleError(_0x466451,null));};exports[_0xf315('0xba')]=function(_0x113761,_0x1008de,_0x34e6f8){return db[_0xf315('0x90')][_0xf315('0x5c')]({'where':{'id':_0x113761['params']['id']}})[_0xf315('0x2a')](handleEntityNotFound(_0x1008de,null))['then'](function(_0x3b4482){if(_0x3b4482){return _0x3b4482[_0xf315('0xbb')](_0x113761[_0xf315('0xae')][_0xf315('0xb3')],_['omit'](_0x113761[_0xf315('0xae')],[_0xf315('0xb3'),'id'])||{})['spread'](function(){return db[_0xf315('0x60')][_0xf315('0xb8')]({'attributes':['id',_0xf315('0x22'),_0xf315('0xbc')],'where':{'id':_0x113761[_0xf315('0xae')][_0xf315('0xb3')]}});})[_0xf315('0x2a')](function(_0x1a669b){socket[_0xf315('0xbd')](_0xf315('0xbe'),{'id':Number(_0x113761['params']['id']),'tags':_0x1a669b||[]});return{'id':Number(_0x113761[_0xf315('0xaa')]['id']),'tags':_0x1a669b||[]};});}})['then'](respondWithResult(_0x1008de,null))[_0xf315('0xa8')](handleError(_0x1008de,null));};exports[_0xf315('0xbf')]=function(_0x32cc8e,_0x2cd0d0,_0x44f1ed){return db[_0xf315('0x90')][_0xf315('0x5c')]({'where':{'id':_0x32cc8e[_0xf315('0xaa')]['id']}})[_0xf315('0x2a')](handleEntityNotFound(_0x2cd0d0,null))[_0xf315('0x2a')](function(_0x44894c){if(_0x44894c){return _0x44894c[_0xf315('0xbf')](_0x32cc8e[_0xf315('0x2f')][_0xf315('0xb3')]);}})[_0xf315('0x2a')](respondWithStatusCode(_0x2cd0d0,null))[_0xf315('0xa8')](handleError(_0x2cd0d0,null));};exports[_0xf315('0xc0')]=function(_0x55ccb8,_0x299b6d){var _0x243590=moment()[_0xf315('0xc1')]()[_0xf315('0x8c')]();var _0x3b2b62=path[_0xf315('0xc2')](config[_0xf315('0xc3')],_0xf315('0xc4'),_0xf315('0xc5'),_0xf315('0xc6'));var _0x4dd91e=path[_0xf315('0xc2')](config[_0xf315('0xc3')],_0xf315('0xc4'),'files','attachments');var _0x5a646=path[_0xf315('0xc2')](_0x3b2b62,_0x243590);var _0x5c0318=util[_0xf315('0xb6')]('transcript-%d-%s.zip',_0x55ccb8['params']['id'],_0x243590);var _0x4d2a1f=path['join'](_0x3b2b62,_0x5c0318);var _0x5b234f=[];_0x5b234f[_0xf315('0xc7')]({'model':db[_0xf315('0xc8')],'as':_0xf315('0xc8'),'raw':!![]});var _0x45b170=[{'model':db[_0xf315('0xb1')],'as':'Messages','attributes':['id',_0xf315('0xae'),_0xf315('0x6d')],'include':_0x5b234f}];return db[_0xf315('0x90')]['find']({'where':{'id':_0x55ccb8['params']['id']},'include':_0x45b170})[_0xf315('0x2a')](handleEntityNotFound(_0x299b6d,null))['then'](function(_0x385db3){if(_0x385db3&&_0x385db3[_0xf315('0xc9')]){var _0x372d82=_0x385db3[_0xf315('0xca')]({'plain':!![]});fs[_0xf315('0xcb')](_0x5a646);for(var _0x4935b3=0x0;_0x4935b3<_0x372d82[_0xf315('0xc9')][_0xf315('0x51')];_0x4935b3++){var _0x14eb92=_0x372d82[_0xf315('0xc9')][_0x4935b3][_0xf315('0xc8')];if(_0x14eb92){var _0x4c5dd5=path[_0xf315('0xc2')](_0x4dd91e,_0x14eb92[_0xf315('0xcc')]);if(fs[_0xf315('0xcd')](_0x4c5dd5)){fs['createReadStream'](_0x4c5dd5)[_0xf315('0xce')](fs[_0xf315('0xcf')](path[_0xf315('0xc2')](_0x5a646,_0x14eb92['basename'])));}}}return BPromise[_0xf315('0x86')]()[_0xf315('0x2a')](function(){return new BPromise(function(_0x53623d,_0x89385c){zipdir(_0x5a646,{'saveTo':_0x4d2a1f},function(_0x4f7c0d,_0x54cca8){if(_0x4f7c0d)return _0x89385c(_0x4f7c0d);return _0x53623d(_0x54cca8);});})[_0xf315('0x2a')](function(){return new BPromise(function(_0x5e20f5,_0x1ab930){rimraf(_0x5a646,function(_0x367068){if(_0x367068)_0x1ab930(_0x367068);return _0x5e20f5();});});})[_0xf315('0x2a')](function(){return _0x299b6d[_0xf315('0xc0')](_0x4d2a1f,_0x5c0318,function(_0x1f688b){if(_0x1f688b){console[_0xf315('0xd0')](_0xf315('0xd1'),_0x1f688b);}else{fs[_0xf315('0xd2')](_0x4d2a1f);}});});});}else{return _0x299b6d['sendStatus'](0xc8);}})[_0xf315('0xa8')](handleError(_0x299b6d,null));}; \ No newline at end of file +var _0x9c00=['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','./faxInteraction.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','then','error','stack','name','send','Users','fullname','TagIds','Tags','split','push','catch','index','FaxInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','select','field','from','tools_tags','u.fullname','ui.FaxInteractionId','left_join','fax_interactions','cm_contacts','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','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','map','forEach','union','User','UserId','body','compact','isEmpty','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','toString','count','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','FaxInteractionId','all','rows','show','params','includeAll','options','create','update','destroy','describe','FaxMessage','ids','omit','getMessages','findOne','nolimit','format','include','addTags','setTags','findAll','color','emit','faxInteractionTags:save','removeTags','download','unix','join','root','files','server','attachments','Attachment','Messages','get','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x9c00,0x1a0));var _0x09c0=function(_0x518b99,_0x4333e4){_0x518b99=_0x518b99-0x0;var _0x45faed=_0x9c00[_0x518b99];return _0x45faed;};'use strict';var pdf=require(_0x09c0('0x0'));var emlformat=require(_0x09c0('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x09c0('0x2'));var rp=require(_0x09c0('0x3'));var moment=require('moment');var BPromise=require(_0x09c0('0x4'));var Mustache=require(_0x09c0('0x5'));var util=require(_0x09c0('0x6'));var path=require(_0x09c0('0x7'));var sox=require(_0x09c0('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x09c0('0x9'));var squel=require(_0x09c0('0xa'));var crypto=require(_0x09c0('0xb'));var jsforce=require(_0x09c0('0xc'));var deskjs=require(_0x09c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x09c0('0xe'));var Papa=require(_0x09c0('0xf'));var Redis=require(_0x09c0('0x10'));var authService=require(_0x09c0('0x11'));var qs=require(_0x09c0('0x12'));var as=require(_0x09c0('0x13'));var hardwareService=require(_0x09c0('0x14'));var logger=require(_0x09c0('0x15'))(_0x09c0('0x16'));var utils=require(_0x09c0('0x17'));var config=require(_0x09c0('0x18'));var db=require(_0x09c0('0x19'))['db'];config[_0x09c0('0x1a')]=_[_0x09c0('0x1b')](config[_0x09c0('0x1a')],{'host':_0x09c0('0x1c'),'port':0x18eb});var socket=require(_0x09c0('0x1d'))(new Redis(config[_0x09c0('0x1a')]));require(_0x09c0('0x1e'))[_0x09c0('0x1f')](socket);function respondWithStatusCode(_0x16e490,_0x254598){_0x254598=_0x254598||0xcc;return function(_0x152140){if(_0x152140){return _0x16e490[_0x09c0('0x20')](_0x254598);}return _0x16e490[_0x09c0('0x21')](_0x254598)[_0x09c0('0x22')]();};}function respondWithResult(_0x4ff6b7,_0x590129){_0x590129=_0x590129||0xc8;return function(_0x558b4f){if(_0x558b4f){return _0x4ff6b7[_0x09c0('0x21')](_0x590129)[_0x09c0('0x23')](_0x558b4f);}};}function respondWithFilteredResult(_0x3991c6,_0x628272){return function(_0x5dcab7){if(_0x5dcab7){var _0x2c4440=_0x5dcab7['count'],_0x4aa8a5=_0x628272[_0x09c0('0x24')],_0x4c29a7=_0x628272[_0x09c0('0x24')]+_0x628272[_0x09c0('0x25')],_0x2c12da;if(_0x4c29a7>=_0x2c4440){_0x4c29a7=_0x2c4440;_0x2c12da=0xc8;}else{_0x2c12da=0xce;}_0x3991c6['status'](_0x2c12da);return _0x3991c6[_0x09c0('0x26')](_0x09c0('0x27'),_0x4aa8a5+'-'+_0x4c29a7+'/'+_0x2c4440)[_0x09c0('0x23')](_0x5dcab7);}return null;};}function patchUpdates(_0x3447c5){return function(_0x12bba7){try{jsonpatch[_0x09c0('0x28')](_0x12bba7,_0x3447c5,!![]);}catch(_0x8c6b9a){return BPromise['reject'](_0x8c6b9a);}return _0x12bba7[_0x09c0('0x29')]();};}function saveUpdates(_0x46f171,_0x473fbd){return function(_0x1d18e9){if(_0x1d18e9){return _0x1d18e9['update'](_0x46f171)['then'](function(_0x321bcc){return _0x321bcc;});}return null;};}function removeEntity(_0x25fdb5,_0x1e8a1c){return function(_0x3a5370){if(_0x3a5370){return _0x3a5370['destroy']()[_0x09c0('0x2a')](function(){_0x25fdb5[_0x09c0('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c7202,_0x163a59){return function(_0x2e3d4d){if(!_0x2e3d4d){_0x2c7202[_0x09c0('0x20')](0x194);}return _0x2e3d4d;};}function handleError(_0x1f8131,_0x1d2d9d){_0x1d2d9d=_0x1d2d9d||0x1f4;return function(_0x45cc64){logger[_0x09c0('0x2b')](_0x45cc64[_0x09c0('0x2c')]);if(_0x45cc64[_0x09c0('0x2d')]){delete _0x45cc64[_0x09c0('0x2d')];}_0x1f8131['status'](_0x1d2d9d)[_0x09c0('0x2e')](_0x45cc64);};}function getInteractionUsers(_0x1bdde9,_0x53a7b8){return new BPromise(function(_0x1d09e0,_0x5aa0b9){try{if(_0x53a7b8[_0x1bdde9['id']]){_0x1bdde9[_0x09c0('0x2f')]=_['map'](_0x53a7b8[_0x1bdde9['id']],function(_0x3ac8e4){return{'id':_0x3ac8e4['id'],'fullname':_0x3ac8e4[_0x09c0('0x30')]};});}}catch(_0x108409){_0x5aa0b9(_0x108409);}_0x1d09e0(_0x1bdde9);});}function getInteractionTags(_0x4159bc,_0x4e999a){return new BPromise(function(_0x5478b7,_0x17c374){try{if(_0x4159bc[_0x09c0('0x31')]){_0x4159bc[_0x09c0('0x32')]=[];_0x4159bc['TagIds'][_0x09c0('0x33')](',')['forEach'](function(_0x350cd3){_0x4159bc[_0x09c0('0x32')][_0x09c0('0x34')](_0x4e999a[_0x350cd3]);});}delete _0x4159bc['TagIds'];}catch(_0x1b170d){_0x17c374(_0x1b170d);}_0x5478b7(_0x4159bc);});}function updateFaxInteraction(_0x4574f7,_0xbb7685,_0x184c0b){return new BPromise(function(_0x234f07,_0xaabbb6){return getInteractionUsers(_0x4574f7,_0x184c0b)[_0x09c0('0x2a')](function(_0x4b740f){return getInteractionTags(_0x4b740f,_0xbb7685);})[_0x09c0('0x2a')](function(_0x2c19be){_0x234f07(_0x2c19be);})[_0x09c0('0x35')](function(_0x132f6c){_0xaabbb6(_0x132f6c);});});}exports[_0x09c0('0x36')]=function(_0x50a37e,_0x920e2c){var _0x20349e={},_0xca8ae9={},_0x12358f={'count':0x0,'rows':[]};var _0x353454=_['map'](db[_0x09c0('0x37')][_0x09c0('0x38')],function(_0x310e06){return{'name':_0x310e06[_0x09c0('0x39')],'type':_0x310e06[_0x09c0('0x3a')][_0x09c0('0x3b')]};});_0xca8ae9[_0x09c0('0x3c')]=_['map'](_0x353454,_0x09c0('0x2d'));_0xca8ae9[_0x09c0('0x3d')]=_[_0x09c0('0x3e')](_0x50a37e[_0x09c0('0x3d')]);_0xca8ae9[_0x09c0('0x3f')]=_['intersection'](_0xca8ae9['model'],_0xca8ae9['query']);_0x20349e['attributes']=_[_0x09c0('0x40')](_0xca8ae9[_0x09c0('0x3c')],qs[_0x09c0('0x41')](_0x50a37e[_0x09c0('0x3d')][_0x09c0('0x41')]));_0x20349e['attributes']=_0x20349e[_0x09c0('0x42')][_0x09c0('0x43')]?_0x20349e['attributes']:_0xca8ae9[_0x09c0('0x3c')];if(!_0x50a37e['query'][_0x09c0('0x44')]('nolimit')){_0x20349e[_0x09c0('0x25')]=qs[_0x09c0('0x25')](_0x50a37e['query'][_0x09c0('0x25')]);_0x20349e[_0x09c0('0x24')]=qs['offset'](_0x50a37e[_0x09c0('0x3d')][_0x09c0('0x24')]);}_0x20349e[_0x09c0('0x45')]=qs[_0x09c0('0x46')](_0x50a37e[_0x09c0('0x3d')][_0x09c0('0x46')]);_0x20349e['where']=qs[_0x09c0('0x3f')](_[_0x09c0('0x47')](_0x50a37e[_0x09c0('0x3d')],_0xca8ae9['filters']),_0x353454);var _0x193ed2=[];var _0x30c0c5=squel[_0x09c0('0x48')]()['field']('id')[_0x09c0('0x49')](_0x09c0('0x2d'))['field']('color')[_0x09c0('0x4a')](_0x09c0('0x4b'));var _0x576f10=squel[_0x09c0('0x48')]()[_0x09c0('0x49')]('u.id')[_0x09c0('0x49')](_0x09c0('0x4c'))[_0x09c0('0x49')](_0x09c0('0x4d'))[_0x09c0('0x4a')]('user_has_fax_interactions','ui')[_0x09c0('0x4e')]('users','u','u.id\x20=\x20ui.UserId');var _0x3f1530=squel[_0x09c0('0x48')]()[_0x09c0('0x4a')](_0x09c0('0x4f'),'i')[_0x09c0('0x4e')](_0x09c0('0x50'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0x09c0('0x51'))[_0x09c0('0x4e')](_0x09c0('0x52'),'a','a.id\x20=\x20i.FaxAccountId')[_0x09c0('0x4e')](_0x09c0('0x53'),'me',_0x09c0('0x54'))[_0x09c0('0x4e')](_0x09c0('0x55'),'it',_0x09c0('0x56'))[_0x09c0('0x4e')](_0x09c0('0x4b'),'t',_0x09c0('0x57'));var _0x38085c=squel[_0x09c0('0x58')]();var _0x3f20b6=[];var _0x28bd8a=squel[_0x09c0('0x58')]();var _0x332b69;if(_0x50a37e[_0x09c0('0x3d')][_0x09c0('0x59')]){_0x332b69=as[_0x09c0('0x5a')](_0x50a37e[_0x09c0('0x3d')][_0x09c0('0x59')]);var _0x5b27a4=_0x332b69[_0x09c0('0x5b')];for(var _0x44befb=0x0;_0x44befb<_0x332b69[_0x09c0('0x5c')][_0x09c0('0x43')];_0x44befb++){var _0x22f8b7=_0x332b69['conditions'][_0x44befb];var _0x3f72b6='i';var _0x866d31=_[_0x09c0('0x5d')](_0x353454,['name',_0x22f8b7[_0x09c0('0x49')]]);if(!_0x866d31){switch(_0x22f8b7[_0x09c0('0x49')]){case _0x09c0('0x5e'):if(_0x22f8b7[_0x09c0('0x5f')]==0x1){_0x3f1530[_0x09c0('0x60')]('`'+_0x22f8b7[_0x09c0('0x49')]+_0x09c0('0x61'));}else{_0x3f1530['having']('`'+_0x22f8b7[_0x09c0('0x49')]+_0x09c0('0x62'));}break;case _0x09c0('0x63'):if(_0x22f8b7[_0x09c0('0x64')]===_0x09c0('0x65')){if(_0x22f8b7[_0x09c0('0x5f')][_0x09c0('0x33')]('\x20')['length']>0x1){_0x38085c[_0x5b27a4]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x09c0('0x66')](_0x22f8b7[_0x09c0('0x5f')]),null);}else{var _0x1ab662='%'+_0x22f8b7['value']+'%';_0x38085c[_0x5b27a4](_0x09c0('0x67'),_0x1ab662,_0x1ab662,_0x1ab662);}}else{_0x866d31=_['find'](_0x353454,[_0x09c0('0x2d'),_0x09c0('0x68')]);_0x22f8b7[_0x09c0('0x49')]=_0x09c0('0x68');_0x8d27a5=as[_0x09c0('0x69')](_0x3f72b6,_0x866d31[_0x09c0('0x3a')],_0x22f8b7);_0x38085c[_0x5b27a4](_0x8d27a5[_0x09c0('0x6a')],_0x8d27a5['value'][_0x09c0('0x6b')],_0x8d27a5[_0x09c0('0x5f')][_0x09c0('0x22')]);}break;case _0x09c0('0x6c'):var _0x3a6845=_0x22f8b7[_0x09c0('0x5f')][_0x09c0('0x33')](',')[_0x09c0('0x6d')](function(_0x1b29a3){return Number(_0x1b29a3);});_0x3a6845[_0x09c0('0x6e')](function(_0x327056){_0x28bd8a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x327056+',%');});_0x3f20b6=_[_0x09c0('0x6f')](_0x3f20b6,_0x3a6845);break;case _0x09c0('0x70'):if(_0x22f8b7[_0x09c0('0x64')]===_0x09c0('0x65')){_0x38085c[_0x5b27a4]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x22f8b7[_0x09c0('0x5f')]+'%',null);}else{_0x866d31=_['find'](_0x353454,[_0x09c0('0x2d'),_0x09c0('0x71')]);_0x22f8b7[_0x09c0('0x49')]='UserId';_0x8d27a5=as['buildExpression'](_0x3f72b6,_0x866d31[_0x09c0('0x3a')],_0x22f8b7);_0x38085c[_0x5b27a4](_0x8d27a5[_0x09c0('0x6a')],_0x8d27a5[_0x09c0('0x5f')][_0x09c0('0x6b')],_0x8d27a5['value'][_0x09c0('0x22')]);}break;case _0x09c0('0x72'):_0x8d27a5=as['buildExpression']('me',null,_0x22f8b7);_0x38085c[_0x5b27a4](_0x8d27a5[_0x09c0('0x6a')],_0x8d27a5[_0x09c0('0x5f')][_0x09c0('0x6b')],_0x8d27a5[_0x09c0('0x5f')]['end']);break;}}else{var _0x8d27a5=as[_0x09c0('0x69')](_0x3f72b6,_0x866d31[_0x09c0('0x3a')],_0x22f8b7);_0x38085c[_0x5b27a4](_0x8d27a5[_0x09c0('0x6a')],_0x8d27a5[_0x09c0('0x5f')][_0x09c0('0x6b')],_0x8d27a5[_0x09c0('0x5f')][_0x09c0('0x22')]);}}}else{var _0x17931c=_(_0x50a37e[_0x09c0('0x3d')])[_0x09c0('0x3e')]()[_0x09c0('0x6d')](function(_0x2d67e8){return _['some'](_0x353454,[_0x09c0('0x2d'),_0x2d67e8])?_0x2d67e8:undefined;})[_0x09c0('0x73')]()[_0x09c0('0x5f')]();if(!_[_0x09c0('0x74')](_0x17931c)){_0x17931c[_0x09c0('0x6e')](function(_0x54295a){if(_0x54295a===_0x09c0('0x75')){_0x3f1530[_0x09c0('0x76')](_0x09c0('0x77'),[][_0x09c0('0x78')](_0x50a37e['query'][_0x54295a]));}else if(_0x54295a===_0x09c0('0x79')){var _0x28ef54=JSON['parse'](_0x50a37e[_0x09c0('0x3d')][_0x54295a])[_0x09c0('0x7a')];var _0x20dd29=JSON[_0x09c0('0x7b')](_0x50a37e[_0x09c0('0x3d')][_0x54295a])['$lte'];_0x3f1530[_0x09c0('0x76')](_0x09c0('0x7c'),_0x28ef54,_0x20dd29);}else{if(_0x50a37e[_0x09c0('0x3d')][_0x54295a]===_0x09c0('0x7d')){_0x3f1530[_0x09c0('0x76')]('i.'+_0x54295a+'\x20IS\x20NULL');}else{_0x3f1530[_0x09c0('0x76')]('i.'+_0x54295a+_0x09c0('0x7e'),_0x50a37e[_0x09c0('0x3d')][_0x54295a]);}}});}if(_0x50a37e[_0x09c0('0x3d')][_0x09c0('0x7f')]){if(_0x50a37e[_0x09c0('0x3d')]['read']==0x1){_0x3f1530['having']('`unreadMessages`\x20=\x200');}else{_0x3f1530['having'](_0x09c0('0x80'));}}if(_0x50a37e[_0x09c0('0x3d')][_0x09c0('0x81')]){_0x3f20b6=_['isArray'](_0x50a37e[_0x09c0('0x3d')]['tag'])?_0x50a37e[_0x09c0('0x3d')][_0x09c0('0x81')]:new Array(_0x50a37e['query'][_0x09c0('0x81')]);_0x3f20b6['forEach'](function(_0x4a42c4){_0x28bd8a['or'](_0x09c0('0x82'),'%,'+_0x4a42c4+',%');});}if(_0x50a37e[_0x09c0('0x3d')][_0x09c0('0x83')]){var _0x133594=_0x50a37e[_0x09c0('0x3d')][_0x09c0('0x83')][_0x09c0('0x84')]('\x5c','\x5c\x5c')[_0x09c0('0x84')]('\x27\x27',_0x09c0('0x85'));if(qs[_0x09c0('0x86')](_0x133594)){_0x38085c['or']('i.id\x20LIKE\x20?',_0x133594+'%')['or'](_0x09c0('0x87'),_0x133594+'%');}_0x38085c['or'](_0x09c0('0x88'),_0x133594+'%');}}_0x3f1530['where'](_0x38085c);_0x3f1530['group'](_0x09c0('0x89'));var _0x164bac={'type':db[_0x09c0('0x8a')][_0x09c0('0x8b')][_0x09c0('0x8c')],'raw':!![]};var _0x3083ad=_0x3f1530[_0x09c0('0x8d')]();_0x3083ad['field'](_0x09c0('0x89'));_0x3083ad['field'](_0x09c0('0x8e'),_0x09c0('0x5e'));if(_0x20349e[_0x09c0('0x45')]){_0x20349e[_0x09c0('0x45')][_0x09c0('0x6e')](function(_0x4f35d1){_0x3f1530[_0x09c0('0x45')]('i.'+_0x4f35d1[0x0],_0x4f35d1[0x1]==='DESC'?![]:!![]);});}if(!_[_0x09c0('0x74')](_0x3f20b6)){_0x3f1530['having'](_0x28bd8a);_0x3083ad[_0x09c0('0x76')](_0x09c0('0x8f'),_0x3f20b6);}BPromise[_0x09c0('0x90')]()[_0x09c0('0x2a')](function(){if(!_0x332b69){if(_0x50a37e[_0x09c0('0x3d')][_0x09c0('0x75')]||_0x50a37e[_0x09c0('0x3d')]['journey'])return;_0x3083ad['where'](_0x09c0('0x91'));_0x3f1530[_0x09c0('0x76')](_0x09c0('0x91'));return;}return _0x50a37e[_0x09c0('0x92')][_0x09c0('0x93')]({'attributes':['id'],'raw':!![]})[_0x09c0('0x2a')](function(_0x4060bb){if(_[_0x09c0('0x74')](_0x4060bb)){_0x3083ad[_0x09c0('0x76')](_0x09c0('0x94'));_0x3f1530['where']('i.FaxAccountId\x20IS\x20NULL');}else{_0x3083ad['where'](_0x09c0('0x77'),_[_0x09c0('0x6d')](_0x4060bb,'id'));_0x3f1530[_0x09c0('0x76')]('i.FaxAccountId\x20IN\x20?',_['map'](_0x4060bb,'id'));}});})[_0x09c0('0x2a')](function(){db['sequelize'][_0x09c0('0x3d')](_0x3083ad[_0x09c0('0x95')](),_0x164bac)['then'](function(_0x2893b8){_0x12358f['count']=_0x2893b8[_0x09c0('0x43')];if(_0x12358f[_0x09c0('0x96')]===0x0)return[];return db[_0x09c0('0x97')]['query'](_0x30c0c5[_0x09c0('0x95')](),_0x164bac)[_0x09c0('0x2a')](function(_0x2a637e){_0x193ed2=_[_0x09c0('0x98')](_0x2a637e,'id');_0x164bac=_[_0x09c0('0x99')](_0x164bac,{'model':db[_0x09c0('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x50a37e[_0x09c0('0x3d')][_0x09c0('0x41')]){_0x20349e[_0x09c0('0x42')][_0x09c0('0x6e')](function(_0x22efe8){_0x3f1530[_0x09c0('0x49')]('i.'+_0x22efe8);});}else{_0x3f1530['field'](_0x09c0('0x8e'),_0x09c0('0x5e'));_0x3f1530[_0x09c0('0x49')](_0x09c0('0x9a'),_0x09c0('0x9b'));_0x3f1530['field'](_0x09c0('0x9c'),'Account.mandatoryDisposition');_0x3f1530['field'](_0x09c0('0x9d'));_0x3f1530[_0x09c0('0x49')](_0x09c0('0x9e'),'Contact.firstName');_0x3f1530[_0x09c0('0x49')](_0x09c0('0x9f'),_0x09c0('0xa0'));_0x3f1530[_0x09c0('0x49')](_0x09c0('0xa1'),_0x09c0('0xa2'));_0x3f1530['field'](_0x09c0('0xa3'),_0x09c0('0xa4'));_0x3f1530['field'](_0x09c0('0xa5'),_0x09c0('0xa6'));_0x3f1530['field'](_0x09c0('0xa7'),_0x09c0('0xa8'));_0x3f1530[_0x09c0('0x49')]('o.fullname',_0x09c0('0xa9'));_0x3f1530[_0x09c0('0x49')]('o.internal',_0x09c0('0xaa'));_0x3f1530[_0x09c0('0x49')](_0x09c0('0xab'),_0x09c0('0x31'));}if(_0x20349e[_0x09c0('0x25')])_0x3f1530[_0x09c0('0x25')](_0x20349e[_0x09c0('0x25')]);if(_0x20349e[_0x09c0('0x24')])_0x3f1530['offset'](_0x20349e[_0x09c0('0x24')]);return db[_0x09c0('0x97')][_0x09c0('0x3d')](_0x3f1530['toString'](),_0x164bac);})[_0x09c0('0x2a')](function(_0x232b15){_0x576f10[_0x09c0('0x76')]('ui.FaxInteractionId\x20IN\x20?',_[_0x09c0('0x6d')](_0x232b15,'id'));return db[_0x09c0('0x97')][_0x09c0('0x3d')](_0x576f10[_0x09c0('0x95')](),_0x164bac)[_0x09c0('0x2a')](function(_0x1d861c){var _0x331a33=_['groupBy'](_0x1d861c,_0x09c0('0xac'));var _0x104762=[];_0x232b15[_0x09c0('0x6e')](function(_0x26bc31){_0x104762[_0x09c0('0x34')](updateFaxInteraction(_0x26bc31,_0x193ed2,_0x331a33));});return BPromise[_0x09c0('0xad')](_0x104762);});});})[_0x09c0('0x2a')](function(_0x5023c3){_0x12358f[_0x09c0('0xae')]=_0x5023c3;return _0x12358f;})[_0x09c0('0x2a')](respondWithFilteredResult(_0x920e2c,_0x20349e));})[_0x09c0('0x35')](handleError(_0x920e2c,null));};exports[_0x09c0('0xaf')]=function(_0x4c1d8f,_0x516a79){var _0x23c98f={'raw':![],'where':{'id':_0x4c1d8f[_0x09c0('0xb0')]['id']}},_0x823371={};_0x823371['model']=_[_0x09c0('0x3e')](db[_0x09c0('0x37')][_0x09c0('0x38')]);_0x823371[_0x09c0('0x3d')]=_['keys'](_0x4c1d8f[_0x09c0('0x3d')]);_0x823371[_0x09c0('0x3f')]=_['intersection'](_0x823371[_0x09c0('0x3c')],_0x823371[_0x09c0('0x3d')]);_0x23c98f[_0x09c0('0x42')]=_[_0x09c0('0x40')](_0x823371[_0x09c0('0x3c')],qs['fields'](_0x4c1d8f[_0x09c0('0x3d')][_0x09c0('0x41')]));_0x23c98f['attributes']=_0x23c98f[_0x09c0('0x42')][_0x09c0('0x43')]?_0x23c98f[_0x09c0('0x42')]:_0x823371[_0x09c0('0x3c')];if(_0x4c1d8f[_0x09c0('0x3d')][_0x09c0('0xb1')]){_0x23c98f['include']=[{'all':!![]}];}_0x23c98f=_['merge']({},_0x23c98f,_0x4c1d8f[_0x09c0('0xb2')]);return db[_0x09c0('0x37')][_0x09c0('0x5d')](_0x23c98f)[_0x09c0('0x2a')](handleEntityNotFound(_0x516a79,null))[_0x09c0('0x2a')](respondWithResult(_0x516a79,null))[_0x09c0('0x35')](handleError(_0x516a79,null));};exports[_0x09c0('0xb3')]=function(_0x24cbdf,_0x1b9f57){return db[_0x09c0('0x37')][_0x09c0('0xb3')](_0x24cbdf[_0x09c0('0x72')],{})[_0x09c0('0x2a')](respondWithResult(_0x1b9f57,0xc9))['catch'](handleError(_0x1b9f57,null));};exports[_0x09c0('0xb4')]=function(_0x4d3747,_0x3a83e4){if(_0x4d3747['body']['id']){delete _0x4d3747['body']['id'];}return db[_0x09c0('0x37')][_0x09c0('0x5d')]({'where':{'id':_0x4d3747[_0x09c0('0xb0')]['id']}})[_0x09c0('0x2a')](handleEntityNotFound(_0x3a83e4,null))[_0x09c0('0x2a')](saveUpdates(_0x4d3747['body'],null))['then'](respondWithResult(_0x3a83e4,null))[_0x09c0('0x35')](handleError(_0x3a83e4,null));};exports[_0x09c0('0xb5')]=function(_0x4f68e8,_0xac36d7){return db[_0x09c0('0x37')][_0x09c0('0x5d')]({'where':{'id':_0x4f68e8[_0x09c0('0xb0')]['id']}})[_0x09c0('0x2a')](handleEntityNotFound(_0xac36d7,null))['then'](removeEntity(_0xac36d7,null))[_0x09c0('0x35')](handleError(_0xac36d7,null));};exports[_0x09c0('0xb6')]=function(_0x2fbbab,_0x30a745){return db['FaxInteraction'][_0x09c0('0xb6')]()[_0x09c0('0x2a')](respondWithResult(_0x30a745,null))['catch'](handleError(_0x30a745,null));};exports['addMessage']=function(_0x5bdfbf,_0xee3240,_0xcf19a1){return db[_0x09c0('0xb7')][_0x09c0('0x5d')]({'where':{'id':_0x5bdfbf[_0x09c0('0xb0')]['id']}})['then'](handleEntityNotFound(_0xee3240,null))['then'](function(_0x4a4d7a){if(_0x4a4d7a){return _0x4a4d7a['addMessage'](_0x5bdfbf[_0x09c0('0x72')][_0x09c0('0xb8')],_[_0x09c0('0xb9')](_0x5bdfbf[_0x09c0('0x72')],[_0x09c0('0xb8'),'id'])||{});}})[_0x09c0('0x2a')](respondWithResult(_0xee3240,null))['catch'](handleError(_0xee3240,null));};exports[_0x09c0('0xba')]=function(_0xa2e162,_0x4f835a,_0x23dac2){var _0x2cfc4d={'raw':![],'where':{}};var _0x4a5935={};var _0x3e00c6={'count':0x0,'rows':[]};return db[_0x09c0('0x37')][_0x09c0('0xbb')]({'where':{'id':_0xa2e162[_0x09c0('0xb0')]['id']}})['then'](handleEntityNotFound(_0x4f835a,null))[_0x09c0('0x2a')](function(_0x43c6d){if(_0x43c6d){_0x4a5935[_0x09c0('0x3c')]=_[_0x09c0('0x3e')](db[_0x09c0('0xb7')][_0x09c0('0x38')]);_0x4a5935['query']=_['keys'](_0xa2e162[_0x09c0('0x3d')]);_0x4a5935[_0x09c0('0x3f')]=_[_0x09c0('0x40')](_0x4a5935[_0x09c0('0x3c')],_0x4a5935[_0x09c0('0x3d')]);_0x2cfc4d[_0x09c0('0x42')]=_[_0x09c0('0x40')](_0x4a5935[_0x09c0('0x3c')],qs['fields'](_0xa2e162['query'][_0x09c0('0x41')]));_0x2cfc4d['attributes']=_0x2cfc4d[_0x09c0('0x42')][_0x09c0('0x43')]?_0x2cfc4d['attributes']:_0x4a5935[_0x09c0('0x3c')];if(!_0xa2e162['query']['hasOwnProperty'](_0x09c0('0xbc'))){_0x2cfc4d[_0x09c0('0x25')]=qs['limit'](_0xa2e162[_0x09c0('0x3d')][_0x09c0('0x25')]);_0x2cfc4d['offset']=qs[_0x09c0('0x24')](_0xa2e162[_0x09c0('0x3d')][_0x09c0('0x24')]);}_0x2cfc4d[_0x09c0('0x45')]=qs[_0x09c0('0x46')](_0xa2e162['query'][_0x09c0('0x46')]);_0x2cfc4d['where']=qs[_0x09c0('0x3f')](_[_0x09c0('0x47')](_0xa2e162[_0x09c0('0x3d')],_0x4a5935['filters']));_0x2cfc4d['where'][_0x09c0('0xac')]=_0x43c6d['id'];if(_0xa2e162['query'][_0x09c0('0x83')]){_0x2cfc4d[_0x09c0('0x76')]=_[_0x09c0('0x99')](_0x2cfc4d[_0x09c0('0x76')],{'$or':_[_0x09c0('0x6d')](_0x2cfc4d[_0x09c0('0x42')],function(_0x915ef1){var _0x52cbdd={};_0x52cbdd[_0x915ef1]={'$like':'%'+_0xa2e162[_0x09c0('0x3d')][_0x09c0('0x83')]+'%'};return _0x52cbdd;})});}if(_0xa2e162['query']['$gte']){var _0x443042=_0xa2e162['query'][_0x09c0('0x7a')][_0x09c0('0x33')](',');var _0x5cbd8b={};_0x5cbd8b[_0x443042[0x0]]={'$gte':moment(_0x443042[0x1])[_0x09c0('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2cfc4d[_0x09c0('0x76')]=_[_0x09c0('0x99')](_0x2cfc4d[_0x09c0('0x76')],_0x5cbd8b);}_0x2cfc4d=_['merge']({},_0x2cfc4d,_0xa2e162[_0x09c0('0xb2')]);return db['FaxMessage'][_0x09c0('0x96')]({'where':_0x2cfc4d[_0x09c0('0x76')]})[_0x09c0('0x2a')](function(_0x6cc6d8){_0x3e00c6[_0x09c0('0x96')]=_0x6cc6d8;if(_0xa2e162[_0x09c0('0x3d')]['includeAll']){_0x2cfc4d[_0x09c0('0xbe')]=[{'all':!![]}];}return db[_0x09c0('0xb7')]['findAll'](_0x2cfc4d);})[_0x09c0('0x2a')](function(_0x4b6d18){_0x3e00c6[_0x09c0('0xae')]=_0x4b6d18;return _0x3e00c6;});}})[_0x09c0('0x2a')](respondWithFilteredResult(_0x4f835a,_0x2cfc4d))[_0x09c0('0x35')](handleError(_0x4f835a,null));};exports[_0x09c0('0xbf')]=function(_0x31fb89,_0x97ed15,_0x557ca9){return db[_0x09c0('0x37')][_0x09c0('0x5d')]({'where':{'id':_0x31fb89[_0x09c0('0xb0')]['id']}})[_0x09c0('0x2a')](handleEntityNotFound(_0x97ed15,null))['then'](function(_0x140085){if(_0x140085){return _0x140085[_0x09c0('0xc0')](_0x31fb89[_0x09c0('0x72')][_0x09c0('0xb8')],_['omit'](_0x31fb89[_0x09c0('0x72')],[_0x09c0('0xb8'),'id'])||{})['spread'](function(){return db[_0x09c0('0x6c')][_0x09c0('0xc1')]({'attributes':['id','name',_0x09c0('0xc2')],'where':{'id':_0x31fb89[_0x09c0('0x72')][_0x09c0('0xb8')]}});})[_0x09c0('0x2a')](function(_0x1f08c9){socket[_0x09c0('0xc3')](_0x09c0('0xc4'),{'id':Number(_0x31fb89['params']['id']),'tags':_0x1f08c9||[]});return{'id':Number(_0x31fb89[_0x09c0('0xb0')]['id']),'tags':_0x1f08c9||[]};});}})['then'](respondWithResult(_0x97ed15,null))['catch'](handleError(_0x97ed15,null));};exports[_0x09c0('0xc5')]=function(_0xc2f36a,_0x51f17c,_0x1e78f){return db[_0x09c0('0x37')]['find']({'where':{'id':_0xc2f36a[_0x09c0('0xb0')]['id']}})['then'](handleEntityNotFound(_0x51f17c,null))[_0x09c0('0x2a')](function(_0x306a54){if(_0x306a54){return _0x306a54[_0x09c0('0xc5')](_0xc2f36a[_0x09c0('0x3d')][_0x09c0('0xb8')]);}})[_0x09c0('0x2a')](respondWithStatusCode(_0x51f17c,null))[_0x09c0('0x35')](handleError(_0x51f17c,null));};exports[_0x09c0('0xc6')]=function(_0x195c29,_0x1df1ea){var _0x3f0853=moment()[_0x09c0('0xc7')]()['toString']();var _0x18acaf=path[_0x09c0('0xc8')](config[_0x09c0('0xc9')],'server',_0x09c0('0xca'),'tmp');var _0x54728b=path[_0x09c0('0xc8')](config['root'],_0x09c0('0xcb'),_0x09c0('0xca'),_0x09c0('0xcc'));var _0x3c1ed3=path[_0x09c0('0xc8')](_0x18acaf,_0x3f0853);var _0x39a238=util[_0x09c0('0xbd')]('transcript-%d-%s.zip',_0x195c29[_0x09c0('0xb0')]['id'],_0x3f0853);var _0x587ea=path[_0x09c0('0xc8')](_0x18acaf,_0x39a238);var _0x11faa8=[];_0x11faa8[_0x09c0('0x34')]({'model':db[_0x09c0('0xcd')],'as':_0x09c0('0xcd'),'raw':!![]});var _0x23ef27=[{'model':db[_0x09c0('0xb7')],'as':_0x09c0('0xce'),'attributes':['id',_0x09c0('0x72'),_0x09c0('0x79')],'include':_0x11faa8}];return db[_0x09c0('0x37')][_0x09c0('0x5d')]({'where':{'id':_0x195c29[_0x09c0('0xb0')]['id']},'include':_0x23ef27})[_0x09c0('0x2a')](handleEntityNotFound(_0x1df1ea,null))[_0x09c0('0x2a')](function(_0x4d503a){if(_0x4d503a&&_0x4d503a[_0x09c0('0xce')]){var _0x348300=_0x4d503a[_0x09c0('0xcf')]({'plain':!![]});fs['mkdirSync'](_0x3c1ed3);for(var _0x3dc096=0x0;_0x3dc096<_0x348300[_0x09c0('0xce')][_0x09c0('0x43')];_0x3dc096++){var _0x4cb137=_0x348300[_0x09c0('0xce')][_0x3dc096][_0x09c0('0xcd')];if(_0x4cb137){var _0x137f1a=path[_0x09c0('0xc8')](_0x54728b,_0x4cb137[_0x09c0('0xd0')]);if(fs[_0x09c0('0xd1')](_0x137f1a)){fs[_0x09c0('0xd2')](_0x137f1a)[_0x09c0('0xd3')](fs[_0x09c0('0xd4')](path[_0x09c0('0xc8')](_0x3c1ed3,_0x4cb137['basename'])));}}}return BPromise[_0x09c0('0x90')]()['then'](function(){return new BPromise(function(_0xb6adcc,_0xda3189){zipdir(_0x3c1ed3,{'saveTo':_0x587ea},function(_0x544448,_0x2601f2){if(_0x544448)return _0xda3189(_0x544448);return _0xb6adcc(_0x2601f2);});})[_0x09c0('0x2a')](function(){return new BPromise(function(_0x450414,_0x57653e){rimraf(_0x3c1ed3,function(_0x1ba8eb){if(_0x1ba8eb)_0x57653e(_0x1ba8eb);return _0x450414();});});})[_0x09c0('0x2a')](function(){return _0x1df1ea[_0x09c0('0xc6')](_0x587ea,_0x39a238,function(_0x2eb784){if(_0x2eb784){console[_0x09c0('0xd5')](_0x09c0('0xd6'),_0x2eb784);}else{fs[_0x09c0('0xd7')](_0x587ea);}});});});}else{return _0x1df1ea[_0x09c0('0x20')](0xc8);}})[_0x09c0('0x35')](handleError(_0x1df1ea,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 6b3a58d..126a244 100644 --- a/server/api/faxInteraction/faxInteraction.events.js +++ b/server/api/faxInteraction/faxInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0x3086f8,_0x3f1487){var _0x22df49=function(_0x275a71){while(--_0x275a71){_0x3086f8['push'](_0x3086f8['shift']());}};_0x22df49(++_0x3f1487);}(_0x1261,0x144));var _0x1126=function(_0x37862a,_0x2bc98e){_0x37862a=_0x37862a-0x0;var _0x5b0104=_0x1261[_0x37862a];return _0x5b0104;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x1126('0x0'))['db'][_0x1126('0x1')];var FaxMessage=require(_0x1126('0x0'))['db'][_0x1126('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1126('0x3')](0x0);var events={'afterCreate':_0x1126('0x4'),'afterUpdate':_0x1126('0x5'),'afterDestroy':_0x1126('0x6')};function emitEvent(_0x21a480){return function(_0x75a851,_0x5a2189,_0x5c68c8){_0x75a851[_0x1126('0x7')]({'attributes':['id'],'raw':!![]})[_0x1126('0x8')](function(_0x4f239c){_0x75a851[_0x1126('0x9')](_0x1126('0xa'),_0x4f239c[_0x1126('0xb')](function(_0x3abb0b){return{'id':_0x3abb0b['id']};}));return FaxMessage[_0x1126('0xc')]({'where':{'FaxInteractionId':_0x75a851['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3f09ac){_0x75a851[_0x1126('0x9')](_0x1126('0xd'),_0x3f09ac['length']);FaxInteractionEvents[_0x1126('0xe')](_0x21a480+':'+_0x75a851['id'],_0x75a851);FaxInteractionEvents['emit'](_0x21a480,_0x75a851);_0x5c68c8(null);})['catch'](_0x5c68c8(null));};}for(var e in events){if(events[_0x1126('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x1126('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x326f=['../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','unreadMessages','length','emit','hasOwnProperty','exports','events'];(function(_0x5c7fc3,_0x2171f8){var _0x225703=function(_0x393389){while(--_0x393389){_0x5c7fc3['push'](_0x5c7fc3['shift']());}};_0x225703(++_0x2171f8);}(_0x326f,0xd1));var _0xf326=function(_0x5c2aba,_0x2a01f9){_0x5c2aba=_0x5c2aba-0x0;var _0x5ee899=_0x326f[_0x5c2aba];return _0x5ee899;};'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 diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 0e8213f..e9edee1 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 _0xf109=['../../config/logger','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x5f58cf,_0x57cdf5){var _0x404e9f=function(_0x5af703){while(--_0x5af703){_0x5f58cf['push'](_0x5f58cf['shift']());}};_0x404e9f(++_0x57cdf5);}(_0xf109,0xce));var _0x9f10=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf109[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var logger=require(_0x9f10('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f10('0x3'));var fs=require('fs');var path=require(_0x9f10('0x4'));var rimraf=require(_0x9f10('0x5'));var config=require(_0x9f10('0x6'));var attributes=require(_0x9f10('0x7'));module[_0x9f10('0x8')]=function(_0x408fe8,_0xd3137b){return _0x408fe8[_0x9f10('0x9')](_0x9f10('0xa'),attributes,{'tableName':_0x9f10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5c8719,_0x42a8cd,_0x3019eb){if(_0x5c8719[_0x9f10('0xc')](_0x9f10('0xd'))){_0x5c8719[_0x9f10('0xe')]=moment()['format'](_0x9f10('0xf'));}_0x3019eb(null,_0x5c8719);}}});}; \ No newline at end of file +var _0xe14d=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports','fax_interactions','changed','closed','closedAt','format','lodash'];(function(_0x5d35f3,_0x192b2e){var _0x350b51=function(_0x3cdd81){while(--_0x3cdd81){_0x5d35f3['push'](_0x5d35f3['shift']());}};_0x350b51(++_0x192b2e);}(_0xe14d,0x1ee));var _0xde14=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xe14d[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var logger=require(_0xde14('0x2'))(_0xde14('0x3'));var moment=require('moment');var BPromise=require(_0xde14('0x4'));var rp=require(_0xde14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var attributes=require(_0xde14('0x8'));module[_0xde14('0x9')]=function(_0x461af3,_0xba1514){return _0x461af3['define']('FaxInteraction',attributes,{'tableName':_0xde14('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x115b7d,_0x2b0e7c,_0x9f13dc){if(_0x115b7d[_0xde14('0xb')](_0xde14('0xc'))){_0x115b7d[_0xde14('0xd')]=moment()[_0xde14('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x9f13dc(null,_0x115b7d);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 780c61e..206f54b 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 _0xee69=['where','attributes','limit','debug','AddTagsToFaxInteraction','find','ids','omit','spread','AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xee69,0x1cd));var _0x9ee6=function(_0x402367,_0x332482){_0x402367=_0x402367-0x0;var _0x51fa97=_0xee69[_0x402367];return _0x51fa97;};'use strict';var _=require('lodash');var util=require(_0x9ee6('0x0'));var moment=require(_0x9ee6('0x1'));var BPromise=require('bluebird');var rs=require(_0x9ee6('0x2'));var fs=require('fs');var Redis=require(_0x9ee6('0x3'));var db=require(_0x9ee6('0x4'))['db'];var utils=require(_0x9ee6('0x5'));var logger=require(_0x9ee6('0x6'))(_0x9ee6('0x7'));var config=require('../../config/environment');var jayson=require(_0x9ee6('0x8'));var client=jayson['client'][_0x9ee6('0x9')]({'port':0x232a});config[_0x9ee6('0xa')]=_[_0x9ee6('0xb')](config['redis'],{'host':_0x9ee6('0xc'),'port':0x18eb});var socket=require(_0x9ee6('0xd'))(new Redis(config[_0x9ee6('0xa')]));require('./faxInteraction.socket')[_0x9ee6('0xe')](socket);function respondWithRpcPromise(_0xc9fe94,_0xa57f1,_0xf0020a){return new BPromise(function(_0x11ed29,_0x5a39f2){return client[_0x9ee6('0xf')](_0xc9fe94,_0xf0020a)[_0x9ee6('0x10')](function(_0x1b489a){logger[_0x9ee6('0x11')](_0x9ee6('0x12'),_0xa57f1,_0x9ee6('0x13'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0xa57f1,_0x9ee6('0x13'),JSON[_0x9ee6('0x14')](_0x1b489a));if(_0x1b489a['error']){if(_0x1b489a[_0x9ee6('0x15')][_0x9ee6('0x16')]===0x1f4){logger[_0x9ee6('0x15')]('FaxInteraction,\x20%s,\x20%s',_0xa57f1,_0x1b489a['error'][_0x9ee6('0x17')]);return _0x5a39f2(_0x1b489a[_0x9ee6('0x15')]['message']);}logger[_0x9ee6('0x15')]('FaxInteraction,\x20%s,\x20%s',_0xa57f1,_0x1b489a[_0x9ee6('0x15')][_0x9ee6('0x17')]);return _0x11ed29(_0x1b489a[_0x9ee6('0x15')][_0x9ee6('0x17')]);}else{logger[_0x9ee6('0x11')](_0x9ee6('0x12'),_0xa57f1,_0x9ee6('0x13'));_0x11ed29(_0x1b489a['result'][_0x9ee6('0x17')]);}})[_0x9ee6('0x18')](function(_0x1860ec){logger[_0x9ee6('0x15')](_0x9ee6('0x12'),_0xa57f1,_0x1860ec);_0x5a39f2(_0x1860ec);});});}exports[_0x9ee6('0x19')]=function(_0x505cfe){var _0x3ca441=this;return new Promise(function(_0x2f0d5c,_0x5d1b23){return db[_0x9ee6('0x1a')][_0x9ee6('0x1b')](_0x505cfe[_0x9ee6('0x1c')],{'raw':_0x505cfe[_0x9ee6('0x1d')]?_0x505cfe[_0x9ee6('0x1d')][_0x9ee6('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x505cfe[_0x9ee6('0x1d')]?_0x505cfe[_0x9ee6('0x1d')][_0x9ee6('0x1f')]||null:null,'attributes':_0x505cfe[_0x9ee6('0x1d')]?_0x505cfe[_0x9ee6('0x1d')][_0x9ee6('0x20')]||null:null,'limit':_0x505cfe[_0x9ee6('0x1d')]?_0x505cfe[_0x9ee6('0x1d')][_0x9ee6('0x21')]||null:null})[_0x9ee6('0x10')](function(_0x1368aa){logger[_0x9ee6('0x11')](_0x9ee6('0x19'),_0x505cfe);logger[_0x9ee6('0x22')]('UpdateFaxInteraction',_0x505cfe,JSON[_0x9ee6('0x14')](_0x1368aa));_0x2f0d5c(_0x1368aa);})[_0x9ee6('0x18')](function(_0x14929a){logger[_0x9ee6('0x15')]('UpdateFaxInteraction',_0x14929a['message'],_0x505cfe);_0x5d1b23(_0x3ca441[_0x9ee6('0x15')](0x1f4,_0x14929a[_0x9ee6('0x17')]));});});};exports[_0x9ee6('0x23')]=function(_0x193290){return new Promise(function(_0xf6da45,_0x1663aa){return db[_0x9ee6('0x1a')][_0x9ee6('0x24')]({'where':_0x193290['options']?_0x193290[_0x9ee6('0x1d')][_0x9ee6('0x1f')]||null:null})[_0x9ee6('0x10')](function(_0x1f5fd4){if(_0x1f5fd4){return _0x1f5fd4['addTags'](_0x193290[_0x9ee6('0x1c')][_0x9ee6('0x25')],_[_0x9ee6('0x26')](_0x193290['body'],[_0x9ee6('0x25'),'id'])||{});}})[_0x9ee6('0x27')](function(_0x3f7a72){logger[_0x9ee6('0x11')](_0x9ee6('0x28'),_0x193290);logger['debug'](_0x9ee6('0x28'),_0x193290,JSON[_0x9ee6('0x14')](_0x3f7a72));_0xf6da45(_0x3f7a72);})['catch'](function(_0x1c99c1){logger[_0x9ee6('0x15')](_0x9ee6('0x28'),_0x1c99c1['message'],_0x193290);_0x1663aa(_this[_0x9ee6('0x15')](0x1f4,_0x1c99c1['message']));});});}; \ No newline at end of file +var _0xf8d9=['AddTags','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','./faxInteraction.socket','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','FaxInteraction','update','body','options','raw','where','attributes','info','UpdateFaxInteraction','catch','find','ids','omit','spread'];(function(_0x107f10,_0x5529f2){var _0x811cab=function(_0xc160ea){while(--_0xc160ea){_0x107f10['push'](_0x107f10['shift']());}};_0x811cab(++_0x5529f2);}(_0xf8d9,0x70));var _0x9f8d=function(_0x134557,_0x19ea33){_0x134557=_0x134557-0x0;var _0x1ab4eb=_0xf8d9[_0x134557];return _0x1ab4eb;};'use strict';var _=require('lodash');var util=require(_0x9f8d('0x0'));var moment=require(_0x9f8d('0x1'));var BPromise=require(_0x9f8d('0x2'));var rs=require(_0x9f8d('0x3'));var fs=require('fs');var Redis=require(_0x9f8d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9f8d('0x5'));var logger=require(_0x9f8d('0x6'))(_0x9f8d('0x7'));var config=require('../../config/environment');var jayson=require(_0x9f8d('0x8'));var client=jayson[_0x9f8d('0x9')]['http']({'port':0x232a});config['redis']=_[_0x9f8d('0xa')](config[_0x9f8d('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9f8d('0xc'))['register'](socket);function respondWithRpcPromise(_0x10ed8d,_0x5562e9,_0x34397d){return new BPromise(function(_0x2108fd,_0x40181f){return client[_0x9f8d('0xd')](_0x10ed8d,_0x34397d)[_0x9f8d('0xe')](function(_0x3a317e){logger['info'](_0x9f8d('0xf'),_0x5562e9,_0x9f8d('0x10'));logger[_0x9f8d('0x11')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x5562e9,'request\x20sent',JSON[_0x9f8d('0x12')](_0x3a317e));if(_0x3a317e[_0x9f8d('0x13')]){if(_0x3a317e[_0x9f8d('0x13')]['code']===0x1f4){logger[_0x9f8d('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x5562e9,_0x3a317e['error'][_0x9f8d('0x14')]);return _0x40181f(_0x3a317e[_0x9f8d('0x13')][_0x9f8d('0x14')]);}logger[_0x9f8d('0x13')](_0x9f8d('0xf'),_0x5562e9,_0x3a317e[_0x9f8d('0x13')][_0x9f8d('0x14')]);return _0x2108fd(_0x3a317e[_0x9f8d('0x13')][_0x9f8d('0x14')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x5562e9,_0x9f8d('0x10'));_0x2108fd(_0x3a317e[_0x9f8d('0x15')][_0x9f8d('0x14')]);}})['catch'](function(_0xed881b){logger[_0x9f8d('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x5562e9,_0xed881b);_0x40181f(_0xed881b);});});}exports['UpdateFaxInteraction']=function(_0x5e1e37){var _0xac9475=this;return new Promise(function(_0x182c54,_0x525227){return db[_0x9f8d('0x16')][_0x9f8d('0x17')](_0x5e1e37[_0x9f8d('0x18')],{'raw':_0x5e1e37[_0x9f8d('0x19')]?_0x5e1e37[_0x9f8d('0x19')][_0x9f8d('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e1e37['options']?_0x5e1e37[_0x9f8d('0x19')][_0x9f8d('0x1b')]||null:null,'attributes':_0x5e1e37[_0x9f8d('0x19')]?_0x5e1e37[_0x9f8d('0x19')][_0x9f8d('0x1c')]||null:null,'limit':_0x5e1e37[_0x9f8d('0x19')]?_0x5e1e37[_0x9f8d('0x19')]['limit']||null:null})['then'](function(_0x3e03b3){logger[_0x9f8d('0x1d')](_0x9f8d('0x1e'),_0x5e1e37);logger[_0x9f8d('0x11')](_0x9f8d('0x1e'),_0x5e1e37,JSON[_0x9f8d('0x12')](_0x3e03b3));_0x182c54(_0x3e03b3);})[_0x9f8d('0x1f')](function(_0x1801d8){logger[_0x9f8d('0x13')](_0x9f8d('0x1e'),_0x1801d8[_0x9f8d('0x14')],_0x5e1e37);_0x525227(_0xac9475[_0x9f8d('0x13')](0x1f4,_0x1801d8[_0x9f8d('0x14')]));});});};exports['AddTagsToFaxInteraction']=function(_0x37415d){return new Promise(function(_0x2eec42,_0x5f3fb6){return db[_0x9f8d('0x16')][_0x9f8d('0x20')]({'where':_0x37415d[_0x9f8d('0x19')]?_0x37415d['options'][_0x9f8d('0x1b')]||null:null})['then'](function(_0x1ead0b){if(_0x1ead0b){return _0x1ead0b['addTags'](_0x37415d[_0x9f8d('0x18')][_0x9f8d('0x21')],_[_0x9f8d('0x22')](_0x37415d[_0x9f8d('0x18')],['ids','id'])||{});}})[_0x9f8d('0x23')](function(_0x5875a4){logger[_0x9f8d('0x1d')]('AddTags',_0x37415d);logger['debug'](_0x9f8d('0x24'),_0x37415d,JSON[_0x9f8d('0x12')](_0x5875a4));_0x2eec42(_0x5875a4);})[_0x9f8d('0x1f')](function(_0xfc724e){logger[_0x9f8d('0x13')]('AddTags',_0xfc724e['message'],_0x37415d);_0x5f3fb6(_this[_0x9f8d('0x13')](0x1f4,_0xfc724e['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 50b746d..3c34931 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 _0xe682=['emit','removeListener','register','faxInteraction:','remove','update'];(function(_0x2a1064,_0x5f2095){var _0x562487=function(_0x1a7656){while(--_0x1a7656){_0x2a1064['push'](_0x2a1064['shift']());}};_0x562487(++_0x5f2095);}(_0xe682,0x178));var _0x2e68=function(_0x4cd8e1,_0x3fb58a){_0x4cd8e1=_0x4cd8e1-0x0;var _0x5e7ec4=_0xe682[_0x4cd8e1];return _0x5e7ec4;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0x2e68('0x0'),_0x2e68('0x1')];function createListener(_0x4b4ce6,_0x43f83a){return function(_0x27189a){_0x43f83a[_0x2e68('0x2')](_0x4b4ce6,_0x27189a);};}function removeListener(_0x283f01,_0x16cda8){return function(){FaxInteractionEvents[_0x2e68('0x3')](_0x283f01,_0x16cda8);};}exports[_0x2e68('0x4')]=function(_0x18743a){for(var _0x34a969=0x0,_0x24a342=events['length'];_0x34a969<_0x24a342;_0x34a969++){var _0x3175ad=events[_0x34a969];var _0x423714=createListener(_0x2e68('0x5')+_0x3175ad,_0x18743a);FaxInteractionEvents['on'](_0x3175ad,_0x423714);}}; \ No newline at end of file +var _0x8cec=['update','emit','removeListener','register','length','faxInteraction:','./faxInteraction.events','save'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x8cec,0x1de));var _0xc8ce=function(_0x55bfef,_0x4c9af2){_0x55bfef=_0x55bfef-0x0;var _0x5d0de7=_0x8cec[_0x55bfef];return _0x5d0de7;};'use strict';var FaxInteractionEvents=require(_0xc8ce('0x0'));var events=[_0xc8ce('0x1'),'remove',_0xc8ce('0x2')];function createListener(_0xf4e548,_0x43721b){return function(_0x277a13){_0x43721b[_0xc8ce('0x3')](_0xf4e548,_0x277a13);};}function removeListener(_0xda66ef,_0x4ec7fd){return function(){FaxInteractionEvents[_0xc8ce('0x4')](_0xda66ef,_0x4ec7fd);};}exports[_0xc8ce('0x5')]=function(_0x3e7161){for(var _0x4aec82=0x0,_0x4cdd55=events[_0xc8ce('0x6')];_0x4aec82<_0x4cdd55;_0x4aec82++){var _0xd772ec=events[_0x4aec82];var _0x26d994=createListener(_0xc8ce('0x7')+_0xd772ec,_0x3e7161);FaxInteractionEvents['on'](_0xd772ec,_0x26d994);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index ae2a146..bd38b79 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 _0xc3fe=['destroy','/:id/tags','removeTags','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','/describe','isAuthenticated','show','/:id/messages','getMessages','/:id/download','download','post','create','tracked','fax','faxinteraction:addtags','/:id','update','delete','faxinteraction:destroy'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0xc3fe,0xff));var _0xec3f=function(_0x2b8464,_0x3d2cd7){_0x2b8464=_0x2b8464-0x0;var _0x12d4d8=_0xc3fe[_0x2b8464];return _0x12d4d8;};'use strict';var multer=require(_0xec3f('0x0'));var util=require(_0xec3f('0x1'));var path=require(_0xec3f('0x2'));var timeout=require('connect-timeout');var express=require(_0xec3f('0x3'));var router=express[_0xec3f('0x4')]();var auth=require(_0xec3f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xec3f('0x6'));var controller=require(_0xec3f('0x7'));router[_0xec3f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xec3f('0x8')](_0xec3f('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xec3f('0x8')]('/:id',auth[_0xec3f('0xa')](),controller[_0xec3f('0xb')]);router[_0xec3f('0x8')](_0xec3f('0xc'),auth['isAuthenticated'](),controller[_0xec3f('0xd')]);router[_0xec3f('0x8')](_0xec3f('0xe'),auth[_0xec3f('0xa')](),controller[_0xec3f('0xf')]);router[_0xec3f('0x10')]('/',auth['isAuthenticated'](),controller[_0xec3f('0x11')]);router[_0xec3f('0x10')](_0xec3f('0xc'),auth['isAuthenticated'](),controller['addMessage']);router[_0xec3f('0x10')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xec3f('0x12')](_0xec3f('0x13'),_0xec3f('0x14')),controller['addTags']);router['put'](_0xec3f('0x15'),auth['isAuthenticated'](),interaction[_0xec3f('0x12')](_0xec3f('0x13'),'faxinteraction:update'),controller[_0xec3f('0x16')]);router[_0xec3f('0x17')](_0xec3f('0x15'),auth[_0xec3f('0xa')](),interaction['tracked'](_0xec3f('0x13'),_0xec3f('0x18')),controller[_0xec3f('0x19')]);router[_0xec3f('0x17')](_0xec3f('0x1a'),auth['isAuthenticated'](),controller[_0xec3f('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x2e35=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','index','describe','show','/:id/messages','download','post','create','fax','faxinteraction:addtags','addTags','put','/:id','tracked','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0x2e35,0x1d0));var _0x52e3=function(_0x2743ca,_0x209c33){_0x2743ca=_0x2743ca-0x0;var _0x3f041f=_0x2e35[_0x2743ca];return _0x3f041f;};'use strict';var multer=require(_0x52e3('0x0'));var util=require(_0x52e3('0x1'));var path=require(_0x52e3('0x2'));var timeout=require('connect-timeout');var express=require(_0x52e3('0x3'));var router=express[_0x52e3('0x4')]();var auth=require(_0x52e3('0x5'));var interaction=require(_0x52e3('0x6'));var config=require('../../config/environment');var controller=require(_0x52e3('0x7'));router[_0x52e3('0x8')]('/',auth[_0x52e3('0x9')](),controller[_0x52e3('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x52e3('0xb')]);router['get']('/:id',auth[_0x52e3('0x9')](),controller[_0x52e3('0xc')]);router['get'](_0x52e3('0xd'),auth[_0x52e3('0x9')](),controller['getMessages']);router[_0x52e3('0x8')]('/:id/download',auth[_0x52e3('0x9')](),controller[_0x52e3('0xe')]);router[_0x52e3('0xf')]('/',auth['isAuthenticated'](),controller[_0x52e3('0x10')]);router[_0x52e3('0xf')]('/:id/messages',auth[_0x52e3('0x9')](),controller['addMessage']);router['post']('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0x52e3('0x11'),_0x52e3('0x12')),controller[_0x52e3('0x13')]);router[_0x52e3('0x14')](_0x52e3('0x15'),auth[_0x52e3('0x9')](),interaction[_0x52e3('0x16')](_0x52e3('0x11'),_0x52e3('0x17')),controller[_0x52e3('0x18')]);router[_0x52e3('0x19')]('/:id',auth[_0x52e3('0x9')](),interaction[_0x52e3('0x16')]('fax',_0x52e3('0x1a')),controller[_0x52e3('0x1b')]);router[_0x52e3('0x19')](_0x52e3('0x1c'),auth[_0x52e3('0x9')](),controller[_0x52e3('0x1d')]);module[_0x52e3('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 53b7b65..116e32a 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 _0x95b1=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT','medium'];(function(_0x191abd,_0x5a59a6){var _0x216fc9=function(_0x69fc9){while(--_0x69fc9){_0x191abd['push'](_0x191abd['shift']());}};_0x216fc9(++_0x5a59a6);}(_0x95b1,0x94));var _0x195b=function(_0x11a700,_0x43b8bf){_0x11a700=_0x11a700-0x0;var _0x30971a=_0x95b1[_0x11a700];return _0x30971a;};'use strict';var Sequelize=require(_0x195b('0x0'));module[_0x195b('0x1')]={'body':{'type':Sequelize[_0x195b('0x2')](_0x195b('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x195b('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x195b('0x5')]('in',_0x195b('0x6')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x195b('0x7')]}}; \ No newline at end of file +var _0xab70=['medium','BOOLEAN','ENUM','out','DATE','exports','TEXT'];(function(_0x44ed74,_0x5e92ea){var _0x2d3ae1=function(_0x122c75){while(--_0x122c75){_0x44ed74['push'](_0x44ed74['shift']());}};_0x2d3ae1(++_0x5e92ea);}(_0xab70,0x19b));var _0x0ab7=function(_0x1fea28,_0x105d82){_0x1fea28=_0x1fea28-0x0;var _0x15fb79=_0xab70[_0x1fea28];return _0x15fb79;};'use strict';var Sequelize=require('sequelize');module[_0x0ab7('0x0')]={'body':{'type':Sequelize[_0x0ab7('0x1')](_0x0ab7('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0ab7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0ab7('0x4')]('in','out'),'defaultValue':_0x0ab7('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x0ab7('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x0ab7('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index a2308b2..879f843 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 _0xdd23=['zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','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~!@#$%^&-_=+[{]}.','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','index','map','FaxMessage','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','FaxInteraction','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','interaction','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','FaxInteractionId','null','rejectMessage','create','findOne','ContactId','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','html-pdf'];(function(_0x4e80a7,_0x11d1d3){var _0x1edb13=function(_0x45a30c){while(--_0x45a30c){_0x4e80a7['push'](_0x4e80a7['shift']());}};_0x1edb13(++_0x11d1d3);}(_0xdd23,0x109));var _0x3dd2=function(_0x9efd02,_0x48b78f){_0x9efd02=_0x9efd02-0x0;var _0x1526a1=_0xdd23[_0x9efd02];return _0x1526a1;};'use strict';var pdf=require(_0x3dd2('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3dd2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3dd2('0x2'));var moment=require(_0x3dd2('0x3'));var BPromise=require(_0x3dd2('0x4'));var Mustache=require('mustache');var util=require(_0x3dd2('0x5'));var path=require(_0x3dd2('0x6'));var sox=require(_0x3dd2('0x7'));var csv=require(_0x3dd2('0x8'));var ejs=require(_0x3dd2('0x9'));var fs=require('fs');var _=require(_0x3dd2('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3dd2('0xb'));var deskjs=require(_0x3dd2('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3dd2('0xd'));var Redis=require(_0x3dd2('0xe'));var authService=require(_0x3dd2('0xf'));var qs=require(_0x3dd2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3dd2('0x11'));var logger=require(_0x3dd2('0x12'))(_0x3dd2('0x13'));var utils=require('../../config/utils');var config=require(_0x3dd2('0x14'));var db=require(_0x3dd2('0x15'))['db'];config[_0x3dd2('0x16')]=_[_0x3dd2('0x17')](config[_0x3dd2('0x16')],{'host':_0x3dd2('0x18'),'port':0x18eb});var socket=require(_0x3dd2('0x19'))(new Redis(config[_0x3dd2('0x16')]));require(_0x3dd2('0x1a'))['register'](socket);var jayson=require(_0x3dd2('0x1b'));var client=jayson[_0x3dd2('0x1c')][_0x3dd2('0x1d')]({'port':0x232c});var client9002=jayson[_0x3dd2('0x1c')][_0x3dd2('0x1d')]({'port':0x232a});function checkPasswordPattern(_0xe46a6e,_0x1ecceb,_0x375d21){if(_0x375d21){var _0x4322ab=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4322ab['test'](_0x1ecceb)){return _0xe46a6e;}else{throw new db[(_0x3dd2('0x1e'))]['ValidationError'](_0x3dd2('0x1f'));}}else{return _0xe46a6e;}}function respondWithRpcPromise(_0x117a89,_0x454093,_0x21f880,_0xbf7f8c){return new BPromise(function(_0x571c00,_0x3ad4d7){var _0x35af3a=_0xbf7f8c||client;return _0x35af3a['request'](_0x117a89,_0x21f880)['then'](function(_0xe51082){logger[_0x3dd2('0x20')](_0x3dd2('0x21'),_0x454093,_0x3dd2('0x22'));logger[_0x3dd2('0x23')](_0x3dd2('0x24'),_0x454093,_0x3dd2('0x22'),JSON[_0x3dd2('0x25')](_0xe51082));if(_0xe51082[_0x3dd2('0x26')]){if(_0xe51082['error'][_0x3dd2('0x27')]===0x1f4){logger[_0x3dd2('0x26')](_0x3dd2('0x21'),_0x454093,_0xe51082[_0x3dd2('0x26')][_0x3dd2('0x28')]);return _0x3ad4d7(_0xe51082[_0x3dd2('0x26')][_0x3dd2('0x28')]);}logger['error'](_0x3dd2('0x21'),_0x454093,_0xe51082['error'][_0x3dd2('0x28')]);return _0x571c00(_0xe51082[_0x3dd2('0x26')][_0x3dd2('0x28')]);}else{logger[_0x3dd2('0x20')](_0x3dd2('0x21'),_0x454093,_0x3dd2('0x22'));_0x571c00(_0xe51082[_0x3dd2('0x29')][_0x3dd2('0x28')]);}})[_0x3dd2('0x2a')](function(_0xa43216){logger[_0x3dd2('0x26')](_0x3dd2('0x21'),_0x454093,_0xa43216);_0x3ad4d7(_0xa43216);});});}function respondWithStatusCode(_0x245e26,_0x570e3d){_0x570e3d=_0x570e3d||0xcc;return function(_0x40b56f){if(_0x40b56f){return _0x245e26[_0x3dd2('0x2b')](_0x570e3d);}return _0x245e26['status'](_0x570e3d)[_0x3dd2('0x2c')]();};}function respondWithResult(_0x4084d2,_0x5d7a35){_0x5d7a35=_0x5d7a35||0xc8;return function(_0x2bb38a){if(_0x2bb38a){return _0x4084d2[_0x3dd2('0x2d')](_0x5d7a35)[_0x3dd2('0x2e')](_0x2bb38a);}};}function respondWithFilteredResult(_0x2a2e00,_0x4c9cc5){return function(_0xd28558){if(_0xd28558){var _0x3286b2=_0xd28558[_0x3dd2('0x2f')],_0x2a4045=_0x4c9cc5[_0x3dd2('0x30')],_0x11f495=_0x4c9cc5['offset']+_0x4c9cc5[_0x3dd2('0x31')],_0x4dedee;if(_0x11f495>=_0x3286b2){_0x11f495=_0x3286b2;_0x4dedee=0xc8;}else{_0x4dedee=0xce;}_0x2a2e00['status'](_0x4dedee);return _0x2a2e00[_0x3dd2('0x32')](_0x3dd2('0x33'),_0x2a4045+'-'+_0x11f495+'/'+_0x3286b2)[_0x3dd2('0x2e')](_0xd28558);}return null;};}function patchUpdates(_0x3f00e2){return function(_0x49d798){try{jsonpatch[_0x3dd2('0x34')](_0x49d798,_0x3f00e2,!![]);}catch(_0x357232){return BPromise[_0x3dd2('0x35')](_0x357232);}return _0x49d798['save']();};}function saveUpdates(_0x425187,_0x442c06){return function(_0x1f5a0e){if(_0x1f5a0e){return _0x1f5a0e[_0x3dd2('0x36')](_0x425187)[_0x3dd2('0x37')](function(_0x26bfce){return _0x26bfce;});}return null;};}function removeEntity(_0x44e3a1,_0x1b4372){return function(_0x264382){if(_0x264382){return _0x264382[_0x3dd2('0x38')]()[_0x3dd2('0x37')](function(){_0x44e3a1['status'](0xcc)[_0x3dd2('0x2c')]();});}};}function handleEntityNotFound(_0xa99e72,_0x2571c8){return function(_0x2879df){if(!_0x2879df){_0xa99e72[_0x3dd2('0x2b')](0x194);}return _0x2879df;};}function handleError(_0x516588,_0x58a557){_0x58a557=_0x58a557||0x1f4;return function(_0x4cab97){logger['error'](_0x4cab97[_0x3dd2('0x39')]);if(_0x4cab97['name']){delete _0x4cab97[_0x3dd2('0x3a')];}_0x516588['status'](_0x58a557)['send'](_0x4cab97);};}exports[_0x3dd2('0x3b')]=function(_0x3e3c96,_0x46ede5){var _0x2eca53={},_0x2564c9={},_0x2c6ba1={'count':0x0,'rows':[]};var _0x307597=_[_0x3dd2('0x3c')](db[_0x3dd2('0x3d')][_0x3dd2('0x3e')],function(_0x144289){return{'name':_0x144289['fieldName'],'type':_0x144289[_0x3dd2('0x3f')][_0x3dd2('0x40')]};});_0x2564c9[_0x3dd2('0x41')]=_[_0x3dd2('0x3c')](_0x307597,_0x3dd2('0x3a'));_0x2564c9[_0x3dd2('0x42')]=_[_0x3dd2('0x43')](_0x3e3c96['query']);_0x2564c9[_0x3dd2('0x44')]=_[_0x3dd2('0x45')](_0x2564c9[_0x3dd2('0x41')],_0x2564c9[_0x3dd2('0x42')]);_0x2eca53['attributes']=_[_0x3dd2('0x45')](_0x2564c9[_0x3dd2('0x41')],qs[_0x3dd2('0x46')](_0x3e3c96[_0x3dd2('0x42')][_0x3dd2('0x46')]));_0x2eca53[_0x3dd2('0x47')]=_0x2eca53[_0x3dd2('0x47')][_0x3dd2('0x48')]?_0x2eca53[_0x3dd2('0x47')]:_0x2564c9[_0x3dd2('0x41')];if(!_0x3e3c96[_0x3dd2('0x42')][_0x3dd2('0x49')](_0x3dd2('0x4a'))){_0x2eca53[_0x3dd2('0x31')]=qs[_0x3dd2('0x31')](_0x3e3c96['query'][_0x3dd2('0x31')]);_0x2eca53[_0x3dd2('0x30')]=qs[_0x3dd2('0x30')](_0x3e3c96[_0x3dd2('0x42')]['offset']);}_0x2eca53['order']=qs[_0x3dd2('0x4b')](_0x3e3c96[_0x3dd2('0x42')][_0x3dd2('0x4b')]);_0x2eca53['where']=qs[_0x3dd2('0x44')](_[_0x3dd2('0x4c')](_0x3e3c96['query'],_0x2564c9['filters']),_0x307597);if(_0x3e3c96['query'][_0x3dd2('0x4d')]){_0x2eca53['where']=_['merge'](_0x2eca53[_0x3dd2('0x4e')],{'$or':_['map'](_0x307597,function(_0x7fe081){if(_0x7fe081[_0x3dd2('0x3f')]!==_0x3dd2('0x4f')){var _0x8d8861={};_0x8d8861[_0x7fe081[_0x3dd2('0x3a')]]={'$like':'%'+_0x3e3c96[_0x3dd2('0x42')][_0x3dd2('0x4d')]+'%'};return _0x8d8861;}})});}_0x2eca53=_[_0x3dd2('0x50')]({},_0x2eca53,_0x3e3c96[_0x3dd2('0x51')]);var _0x2702be={'where':_0x2eca53[_0x3dd2('0x4e')]};return db['FaxMessage']['count'](_0x2702be)['then'](function(_0x1d4a42){_0x2c6ba1[_0x3dd2('0x2f')]=_0x1d4a42;if(_0x3e3c96['query'][_0x3dd2('0x52')]){_0x2eca53[_0x3dd2('0x53')]=[{'all':!![]}];}return db[_0x3dd2('0x3d')][_0x3dd2('0x54')](_0x2eca53);})[_0x3dd2('0x37')](function(_0x438e57){_0x2c6ba1[_0x3dd2('0x55')]=_0x438e57;return _0x2c6ba1;})[_0x3dd2('0x37')](respondWithFilteredResult(_0x46ede5,_0x2eca53))['catch'](handleError(_0x46ede5,null));};exports[_0x3dd2('0x56')]=function(_0x1cf897,_0x491483){var _0x4aa57a={'raw':!![],'where':{'id':_0x1cf897[_0x3dd2('0x57')]['id']}},_0x2bd783={};_0x2bd783[_0x3dd2('0x41')]=_['keys'](db[_0x3dd2('0x3d')][_0x3dd2('0x3e')]);_0x2bd783[_0x3dd2('0x42')]=_[_0x3dd2('0x43')](_0x1cf897[_0x3dd2('0x42')]);_0x2bd783[_0x3dd2('0x44')]=_[_0x3dd2('0x45')](_0x2bd783[_0x3dd2('0x41')],_0x2bd783['query']);_0x4aa57a[_0x3dd2('0x47')]=_[_0x3dd2('0x45')](_0x2bd783['model'],qs['fields'](_0x1cf897[_0x3dd2('0x42')][_0x3dd2('0x46')]));_0x4aa57a[_0x3dd2('0x47')]=_0x4aa57a['attributes'][_0x3dd2('0x48')]?_0x4aa57a[_0x3dd2('0x47')]:_0x2bd783[_0x3dd2('0x41')];if(_0x1cf897[_0x3dd2('0x42')]['includeAll']){_0x4aa57a[_0x3dd2('0x53')]=[{'all':!![]}];}_0x4aa57a=_['merge']({},_0x4aa57a,_0x1cf897[_0x3dd2('0x51')]);return db['FaxMessage'][_0x3dd2('0x58')](_0x4aa57a)['then'](handleEntityNotFound(_0x491483,null))['then'](respondWithResult(_0x491483,null))['catch'](handleError(_0x491483,null));};exports[_0x3dd2('0x36')]=function(_0x222b20,_0x5d7845){if(_0x222b20[_0x3dd2('0x59')]['id']){delete _0x222b20[_0x3dd2('0x59')]['id'];}return db[_0x3dd2('0x3d')][_0x3dd2('0x58')]({'where':{'id':_0x222b20[_0x3dd2('0x57')]['id']}})['then'](handleEntityNotFound(_0x5d7845,null))['then'](saveUpdates(_0x222b20['body'],null))['then'](respondWithResult(_0x5d7845,null))[_0x3dd2('0x2a')](handleError(_0x5d7845,null));};exports[_0x3dd2('0x38')]=function(_0x5a0e38,_0x3a2bbc){return db[_0x3dd2('0x3d')][_0x3dd2('0x58')]({'where':{'id':_0x5a0e38['params']['id']}})[_0x3dd2('0x37')](handleEntityNotFound(_0x3a2bbc,null))[_0x3dd2('0x37')](removeEntity(_0x3a2bbc,null))[_0x3dd2('0x2a')](handleError(_0x3a2bbc,null));};exports[_0x3dd2('0x5a')]=function(_0x5dec83,_0x1f1687){return db[_0x3dd2('0x3d')][_0x3dd2('0x5a')]()[_0x3dd2('0x37')](respondWithResult(_0x1f1687,null))[_0x3dd2('0x2a')](handleError(_0x1f1687,null));};var interaction_log=require(_0x3dd2('0x12'))(_0x3dd2('0x5b'));exports[_0x3dd2('0x5c')]=function(_0x4d92bb,_0xe56398,_0x42e0c7){var _0x109323={'channel':_0x3dd2('0x5d')};if(_0x4d92bb[_0x3dd2('0x59')]['id']){delete _0x4d92bb[_0x3dd2('0x59')]['id'];}_0x4d92bb[_0x3dd2('0x59')][_0x3dd2('0x5e')]=!![];_0x4d92bb['body'][_0x3dd2('0x5f')]=moment()[_0x3dd2('0x60')](_0x3dd2('0x61'));_0x4d92bb[_0x3dd2('0x59')]['UserId']=_0x4d92bb[_0x3dd2('0x59')][_0x3dd2('0x62')]||_0x4d92bb['user']['id'];return db['FaxMessage']['find']({'where':{'id':_0x4d92bb[_0x3dd2('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x3dd2('0x63')],'as':_0x3dd2('0x64')}]})['then'](handleEntityNotFound(_0xe56398,null))[_0x3dd2('0x37')](saveUpdates(_0x4d92bb[_0x3dd2('0x59')],null))['then'](function(_0x24f409){if(_0x24f409){_0x109323['message']=_0x24f409[_0x3dd2('0x65')]({'plain':!![]});return db[_0x3dd2('0x66')][_0x3dd2('0x58')]({'where':{'id':_0x24f409['FaxInteractionId']}});}return null;})[_0x3dd2('0x37')](handleEntityNotFound(_0xe56398,null))[_0x3dd2('0x37')](function(_0xbbf397){if(_0xbbf397){return _0xbbf397[_0x3dd2('0x36')]({'UserId':_0x4d92bb[_0x3dd2('0x59')][_0x3dd2('0x62')],'read1stAt':_[_0x3dd2('0x67')](_0xbbf397[_0x3dd2('0x68')])?moment()[_0x3dd2('0x60')](_0x3dd2('0x61')):undefined});}return null;})[_0x3dd2('0x37')](function(_0x3f7871){if(_0x3f7871){_0x109323['interaction']=_0x3f7871[_0x3dd2('0x65')]({'plain':!![]});interaction_log[_0x3dd2('0x20')](_0x3dd2('0x69'),_0x4d92bb[_0x3dd2('0x6a')]['id'],_0x4d92bb[_0x3dd2('0x6a')][_0x3dd2('0x3a')],_0x4d92bb['user']['role'],_0x109323[_0x3dd2('0x6b')]['id'],_0x4d92bb[_0x3dd2('0x59')]?JSON[_0x3dd2('0x25')](_0x4d92bb[_0x3dd2('0x59')]):'null');return respondWithRpcPromise('AcceptMessage',_0x3dd2('0x6c'),_0x109323);}return null;})[_0x3dd2('0x37')](function(_0x4f7231){if(_0x4f7231){if(_0x4d92bb['body'][_0x3dd2('0x6d')]){_0x109323[_0x3dd2('0x28')][_0x3dd2('0x6e')]=util[_0x3dd2('0x60')]('SIP/%s',_0x4d92bb['user'][_0x3dd2('0x3a')]);_0x109323[_0x3dd2('0x28')][_0x3dd2('0x6f')]=_0x109323[_0x3dd2('0x6f')];_0x109323['message'][_0x3dd2('0x70')]=_0x3dd2('0x5c');return respondWithRpcPromise(_0x3dd2('0x71'),'EventManager',{'event':_0x3dd2('0x72'),'message':_0x109323[_0x3dd2('0x28')]},client9002)['then'](function(){return _0x109323;});}return _0x109323;}return null;})[_0x3dd2('0x37')](respondWithResult(_0xe56398,null))[_0x3dd2('0x2a')](handleError(_0xe56398,null));};var interaction_log=require(_0x3dd2('0x12'))(_0x3dd2('0x5b'));exports['reject']=function(_0x207d73,_0x4a227f,_0x51e849){var _0x5d2bfc={'agent':{},'channel':_0x3dd2('0x5d')};if(_0x207d73[_0x3dd2('0x59')]['id']){delete _0x207d73[_0x3dd2('0x59')]['id'];}_0x207d73[_0x3dd2('0x59')][_0x3dd2('0x62')]=_0x207d73['body'][_0x3dd2('0x62')]||_0x207d73[_0x3dd2('0x6a')]['id'];_0x5d2bfc['agent']['id']=_0x207d73[_0x3dd2('0x59')][_0x3dd2('0x62')];return db[_0x3dd2('0x3d')][_0x3dd2('0x58')]({'where':{'id':_0x207d73[_0x3dd2('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4a227f,null))[_0x3dd2('0x37')](function(_0x552522){if(_0x552522){_0x5d2bfc[_0x3dd2('0x28')]=_0x552522[_0x3dd2('0x65')]({'plain':!![]});return db['FaxInteraction'][_0x3dd2('0x58')]({'where':{'id':_0x552522[_0x3dd2('0x73')]}});}return null;})[_0x3dd2('0x37')](handleEntityNotFound(_0x4a227f,null))[_0x3dd2('0x37')](function(_0x7739d8){if(_0x7739d8){_0x5d2bfc[_0x3dd2('0x6b')]=_0x7739d8[_0x3dd2('0x65')]({'plain':!![]});interaction_log[_0x3dd2('0x20')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x207d73[_0x3dd2('0x6a')]['id'],_0x207d73['user'][_0x3dd2('0x3a')],_0x207d73[_0x3dd2('0x6a')]['role'],_0x5d2bfc[_0x3dd2('0x6b')]['id'],_0x207d73['body']?JSON[_0x3dd2('0x25')](_0x207d73['body']):_0x3dd2('0x74'));return respondWithRpcPromise('RejectMessage',_0x3dd2('0x75'),_0x5d2bfc);}return null;})[_0x3dd2('0x37')](function(_0x2301ce){if(_0x2301ce){_0x2301ce[_0x3dd2('0x28')][_0x3dd2('0x6e')]=util[_0x3dd2('0x60')]('SIP/%s',_0x207d73[_0x3dd2('0x6a')][_0x3dd2('0x3a')]);_0x2301ce[_0x3dd2('0x28')][_0x3dd2('0x6f')]=_0x5d2bfc[_0x3dd2('0x6f')];_0x2301ce['message']['event']=_0x3dd2('0x35');respondWithRpcPromise('EventManager',_0x3dd2('0x71'),{'event':'rejectmessage','message':_0x2301ce[_0x3dd2('0x28')]},client9002);return _0x5d2bfc;}return null;})['then'](respondWithResult(_0x4a227f,null))[_0x3dd2('0x2a')](handleError(_0x4a227f,null));};exports[_0x3dd2('0x76')]=function(_0x24eb8b,_0xf121a8){var _0x360343;return db[_0x3dd2('0x3d')][_0x3dd2('0x76')](_0x24eb8b[_0x3dd2('0x59')],{})[_0x3dd2('0x37')](function(_0x36da10){_0x360343=_0x36da10;return db[_0x3dd2('0x63')][_0x3dd2('0x77')]({'where':{'id':_0x360343[_0x3dd2('0x78')]}});})[_0x3dd2('0x37')](function(_0x4efbac){if(_[_0x3dd2('0x67')](_0x4efbac)){return;}else{_0x360343['fax']=_0x4efbac[_0x3dd2('0x5d')];return db[_0x3dd2('0x79')]['findOne']({'where':{'id':_0x360343[_0x3dd2('0x7a')]}});}})['then'](function(_0xb08656){return respondWithRpcPromise(_0x3dd2('0x7b'),_0x3dd2('0x7b'),{'FaxAccountId':_[_0x3dd2('0x67')](_0x24eb8b['body'])?undefined:_0x24eb8b[_0x3dd2('0x59')][_0x3dd2('0x7c')],'path':_[_0x3dd2('0x67')](_0xb08656)?undefined:util[_0x3dd2('0x60')](_0x3dd2('0x7d'),_0xb08656[_0x3dd2('0x7e')]),'fax':_['isNil'](_0x360343[_0x3dd2('0x5d')])?undefined:_0x360343[_0x3dd2('0x5d')],'AttachmentId':_0x360343[_0x3dd2('0x7a')]},client9002);})[_0x3dd2('0x37')](respondWithResult(_0xf121a8,0xc9))[_0x3dd2('0x2a')](handleError(_0xf121a8,null));};exports[_0x3dd2('0x7f')]=function(_0x7acfc6,_0x20bc74){var _0x4c6683=path[_0x3dd2('0x80')](config[_0x3dd2('0x81')],_0x3dd2('0x82'),_0x3dd2('0x83'),_0x3dd2('0x84'));return db[_0x3dd2('0x3d')][_0x3dd2('0x58')]({'where':{'id':_0x7acfc6[_0x3dd2('0x57')]['id']},'include':[{'model':db[_0x3dd2('0x79')],'as':_0x3dd2('0x79')}]})[_0x3dd2('0x37')](handleEntityNotFound(_0x20bc74,null))[_0x3dd2('0x37')](function(_0x5dc55d){if(_0x5dc55d){return _0x20bc74[_0x3dd2('0x7f')](path['join'](_0x4c6683,_0x5dc55d[_0x3dd2('0x79')][_0x3dd2('0x7e')]));}})['catch'](handleError(_0x20bc74,null));}; \ No newline at end of file +var _0xf73f=['../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','FaxMessage','includeAll','include','findAll','rows','show','params','keys','body','find','describe','fax-interactions','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','FaxInteractionId','isNil','format','get','role','interaction','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','accept','EventManager','acceptmessage','agent','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','rejectmessage','create','CmContact','Attachment','findOne','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','root','server','attachments','download','join','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xc8a11,_0x347a33){var _0x55a500=function(_0x288d05){while(--_0x288d05){_0xc8a11['push'](_0xc8a11['shift']());}};_0x55a500(++_0x347a33);}(_0xf73f,0x101));var _0xff73=function(_0x580281,_0x50aec7){_0x580281=_0x580281-0x0;var _0x385393=_0xf73f[_0x580281];return _0x385393;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xff73('0x0'));var rimraf=require(_0xff73('0x1'));var zipdir=require(_0xff73('0x2'));var jsonpatch=require(_0xff73('0x3'));var rp=require('request-promise');var moment=require(_0xff73('0x4'));var BPromise=require(_0xff73('0x5'));var Mustache=require(_0xff73('0x6'));var util=require('util');var path=require('path');var sox=require(_0xff73('0x7'));var csv=require('to-csv');var ejs=require(_0xff73('0x8'));var fs=require('fs');var _=require(_0xff73('0x9'));var squel=require(_0xff73('0xa'));var crypto=require(_0xff73('0xb'));var jsforce=require(_0xff73('0xc'));var deskjs=require(_0xff73('0xd'));var toCsv=require(_0xff73('0xe'));var querystring=require(_0xff73('0xf'));var Papa=require(_0xff73('0x10'));var Redis=require('ioredis');var authService=require(_0xff73('0x11'));var qs=require(_0xff73('0x12'));var as=require(_0xff73('0x13'));var hardwareService=require(_0xff73('0x14'));var logger=require(_0xff73('0x15'))(_0xff73('0x16'));var utils=require(_0xff73('0x17'));var config=require(_0xff73('0x18'));var db=require('../../mysqldb')['db'];config[_0xff73('0x19')]=_[_0xff73('0x1a')](config[_0xff73('0x19')],{'host':_0xff73('0x1b'),'port':0x18eb});var socket=require(_0xff73('0x1c'))(new Redis(config[_0xff73('0x19')]));require(_0xff73('0x1d'))[_0xff73('0x1e')](socket);var jayson=require(_0xff73('0x1f'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xff73('0x20')][_0xff73('0x21')]({'port':0x232a});function checkPasswordPattern(_0x318091,_0xfb133d,_0x3d7219){if(_0x3d7219){var _0x16d5b4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16d5b4[_0xff73('0x22')](_0xfb133d)){return _0x318091;}else{throw new db[(_0xff73('0x23'))][(_0xff73('0x24'))](_0xff73('0x25'));}}else{return _0x318091;}}function respondWithRpcPromise(_0x407167,_0x356eee,_0xe17404,_0xc16afe){return new BPromise(function(_0x8d5124,_0x248ab7){var _0x4d0bb9=_0xc16afe||client;return _0x4d0bb9['request'](_0x407167,_0xe17404)['then'](function(_0x435a67){logger[_0xff73('0x26')](_0xff73('0x27'),_0x356eee,'request\x20sent');logger[_0xff73('0x28')](_0xff73('0x29'),_0x356eee,'request\x20sent',JSON[_0xff73('0x2a')](_0x435a67));if(_0x435a67['error']){if(_0x435a67[_0xff73('0x2b')][_0xff73('0x2c')]===0x1f4){logger['error'](_0xff73('0x27'),_0x356eee,_0x435a67[_0xff73('0x2b')][_0xff73('0x2d')]);return _0x248ab7(_0x435a67[_0xff73('0x2b')]['message']);}logger['error'](_0xff73('0x27'),_0x356eee,_0x435a67[_0xff73('0x2b')][_0xff73('0x2d')]);return _0x8d5124(_0x435a67[_0xff73('0x2b')][_0xff73('0x2d')]);}else{logger[_0xff73('0x26')]('FaxMessage,\x20%s,\x20%s',_0x356eee,_0xff73('0x2e'));_0x8d5124(_0x435a67[_0xff73('0x2f')][_0xff73('0x2d')]);}})[_0xff73('0x30')](function(_0x3decdc){logger[_0xff73('0x2b')](_0xff73('0x27'),_0x356eee,_0x3decdc);_0x248ab7(_0x3decdc);});});}function respondWithStatusCode(_0x34a537,_0x22a028){_0x22a028=_0x22a028||0xcc;return function(_0x2a3535){if(_0x2a3535){return _0x34a537[_0xff73('0x31')](_0x22a028);}return _0x34a537[_0xff73('0x32')](_0x22a028)['end']();};}function respondWithResult(_0x2fe60c,_0x1b188b){_0x1b188b=_0x1b188b||0xc8;return function(_0x34719e){if(_0x34719e){return _0x2fe60c[_0xff73('0x32')](_0x1b188b)['json'](_0x34719e);}};}function respondWithFilteredResult(_0x4036f2,_0x2fdb11){return function(_0x1397fa){if(_0x1397fa){var _0x5edd21=_0x1397fa[_0xff73('0x33')],_0x3d469f=_0x2fdb11[_0xff73('0x34')],_0x208e40=_0x2fdb11['offset']+_0x2fdb11[_0xff73('0x35')],_0x1e7d7a;if(_0x208e40>=_0x5edd21){_0x208e40=_0x5edd21;_0x1e7d7a=0xc8;}else{_0x1e7d7a=0xce;}_0x4036f2[_0xff73('0x32')](_0x1e7d7a);return _0x4036f2['set'](_0xff73('0x36'),_0x3d469f+'-'+_0x208e40+'/'+_0x5edd21)['json'](_0x1397fa);}return null;};}function patchUpdates(_0x3291fe){return function(_0x37496f){try{jsonpatch[_0xff73('0x37')](_0x37496f,_0x3291fe,!![]);}catch(_0x3ebc93){return BPromise[_0xff73('0x38')](_0x3ebc93);}return _0x37496f[_0xff73('0x39')]();};}function saveUpdates(_0xffde57,_0x335e4a){return function(_0x2c096b){if(_0x2c096b){return _0x2c096b[_0xff73('0x3a')](_0xffde57)[_0xff73('0x3b')](function(_0x5088e6){return _0x5088e6;});}return null;};}function removeEntity(_0x16123f,_0xb36472){return function(_0x4fb909){if(_0x4fb909){return _0x4fb909[_0xff73('0x3c')]()['then'](function(){_0x16123f[_0xff73('0x32')](0xcc)[_0xff73('0x3d')]();});}};}function handleEntityNotFound(_0x521abf,_0x2edb61){return function(_0x24658e){if(!_0x24658e){_0x521abf[_0xff73('0x31')](0x194);}return _0x24658e;};}function handleError(_0x53c3d9,_0x282011){_0x282011=_0x282011||0x1f4;return function(_0x25ca72){logger[_0xff73('0x2b')](_0x25ca72[_0xff73('0x3e')]);if(_0x25ca72[_0xff73('0x3f')]){delete _0x25ca72[_0xff73('0x3f')];}_0x53c3d9[_0xff73('0x32')](_0x282011)['send'](_0x25ca72);};}exports[_0xff73('0x40')]=function(_0x53dc65,_0x722eaf){var _0x5edf08={},_0x58100b={},_0x4462b5={'count':0x0,'rows':[]};var _0x2bd606=_[_0xff73('0x41')](db['FaxMessage'][_0xff73('0x42')],function(_0x43f968){return{'name':_0x43f968['fieldName'],'type':_0x43f968[_0xff73('0x43')][_0xff73('0x44')]};});_0x58100b[_0xff73('0x45')]=_[_0xff73('0x41')](_0x2bd606,'name');_0x58100b[_0xff73('0x46')]=_['keys'](_0x53dc65['query']);_0x58100b[_0xff73('0x47')]=_[_0xff73('0x48')](_0x58100b['model'],_0x58100b[_0xff73('0x46')]);_0x5edf08[_0xff73('0x49')]=_[_0xff73('0x48')](_0x58100b['model'],qs[_0xff73('0x4a')](_0x53dc65[_0xff73('0x46')]['fields']));_0x5edf08['attributes']=_0x5edf08[_0xff73('0x49')][_0xff73('0x4b')]?_0x5edf08[_0xff73('0x49')]:_0x58100b['model'];if(!_0x53dc65[_0xff73('0x46')][_0xff73('0x4c')](_0xff73('0x4d'))){_0x5edf08[_0xff73('0x35')]=qs[_0xff73('0x35')](_0x53dc65[_0xff73('0x46')][_0xff73('0x35')]);_0x5edf08[_0xff73('0x34')]=qs[_0xff73('0x34')](_0x53dc65[_0xff73('0x46')][_0xff73('0x34')]);}_0x5edf08[_0xff73('0x4e')]=qs[_0xff73('0x4f')](_0x53dc65[_0xff73('0x46')]['sort']);_0x5edf08[_0xff73('0x50')]=qs['filters'](_['pick'](_0x53dc65[_0xff73('0x46')],_0x58100b['filters']),_0x2bd606);if(_0x53dc65[_0xff73('0x46')][_0xff73('0x51')]){_0x5edf08[_0xff73('0x50')]=_[_0xff73('0x52')](_0x5edf08[_0xff73('0x50')],{'$or':_[_0xff73('0x41')](_0x2bd606,function(_0xe9641b){if(_0xe9641b[_0xff73('0x43')]!==_0xff73('0x53')){var _0xebbabc={};_0xebbabc[_0xe9641b[_0xff73('0x3f')]]={'$like':'%'+_0x53dc65[_0xff73('0x46')][_0xff73('0x51')]+'%'};return _0xebbabc;}})});}_0x5edf08=_[_0xff73('0x52')]({},_0x5edf08,_0x53dc65[_0xff73('0x54')]);var _0x23c162={'where':_0x5edf08[_0xff73('0x50')]};return db[_0xff73('0x55')][_0xff73('0x33')](_0x23c162)['then'](function(_0x3bdb9f){_0x4462b5[_0xff73('0x33')]=_0x3bdb9f;if(_0x53dc65[_0xff73('0x46')][_0xff73('0x56')]){_0x5edf08[_0xff73('0x57')]=[{'all':!![]}];}return db[_0xff73('0x55')][_0xff73('0x58')](_0x5edf08);})[_0xff73('0x3b')](function(_0x216376){_0x4462b5[_0xff73('0x59')]=_0x216376;return _0x4462b5;})[_0xff73('0x3b')](respondWithFilteredResult(_0x722eaf,_0x5edf08))[_0xff73('0x30')](handleError(_0x722eaf,null));};exports[_0xff73('0x5a')]=function(_0x29b60a,_0x72a448){var _0x55af38={'raw':!![],'where':{'id':_0x29b60a[_0xff73('0x5b')]['id']}},_0x16752d={};_0x16752d['model']=_[_0xff73('0x5c')](db[_0xff73('0x55')][_0xff73('0x42')]);_0x16752d[_0xff73('0x46')]=_[_0xff73('0x5c')](_0x29b60a[_0xff73('0x46')]);_0x16752d[_0xff73('0x47')]=_[_0xff73('0x48')](_0x16752d['model'],_0x16752d['query']);_0x55af38[_0xff73('0x49')]=_[_0xff73('0x48')](_0x16752d[_0xff73('0x45')],qs['fields'](_0x29b60a[_0xff73('0x46')]['fields']));_0x55af38[_0xff73('0x49')]=_0x55af38['attributes'][_0xff73('0x4b')]?_0x55af38['attributes']:_0x16752d['model'];if(_0x29b60a['query'][_0xff73('0x56')]){_0x55af38[_0xff73('0x57')]=[{'all':!![]}];}_0x55af38=_[_0xff73('0x52')]({},_0x55af38,_0x29b60a['options']);return db['FaxMessage']['find'](_0x55af38)[_0xff73('0x3b')](handleEntityNotFound(_0x72a448,null))[_0xff73('0x3b')](respondWithResult(_0x72a448,null))[_0xff73('0x30')](handleError(_0x72a448,null));};exports['update']=function(_0x1badeb,_0x364c97){if(_0x1badeb[_0xff73('0x5d')]['id']){delete _0x1badeb[_0xff73('0x5d')]['id'];}return db[_0xff73('0x55')][_0xff73('0x5e')]({'where':{'id':_0x1badeb[_0xff73('0x5b')]['id']}})[_0xff73('0x3b')](handleEntityNotFound(_0x364c97,null))[_0xff73('0x3b')](saveUpdates(_0x1badeb['body'],null))[_0xff73('0x3b')](respondWithResult(_0x364c97,null))['catch'](handleError(_0x364c97,null));};exports[_0xff73('0x3c')]=function(_0x213d75,_0x55a0e4){return db['FaxMessage'][_0xff73('0x5e')]({'where':{'id':_0x213d75[_0xff73('0x5b')]['id']}})[_0xff73('0x3b')](handleEntityNotFound(_0x55a0e4,null))[_0xff73('0x3b')](removeEntity(_0x55a0e4,null))['catch'](handleError(_0x55a0e4,null));};exports[_0xff73('0x5f')]=function(_0x4c0081,_0x4ada12){return db[_0xff73('0x55')][_0xff73('0x5f')]()[_0xff73('0x3b')](respondWithResult(_0x4ada12,null))['catch'](handleError(_0x4ada12,null));};var interaction_log=require(_0xff73('0x15'))(_0xff73('0x60'));exports['accept']=function(_0x579242,_0x16d65c,_0x3b5f2d){var _0x58d339={'channel':_0xff73('0x61')};if(_0x579242[_0xff73('0x5d')]['id']){delete _0x579242['body']['id'];}_0x579242[_0xff73('0x5d')][_0xff73('0x62')]=!![];_0x579242[_0xff73('0x5d')][_0xff73('0x63')]=moment()['format'](_0xff73('0x64'));_0x579242[_0xff73('0x5d')][_0xff73('0x65')]=_0x579242[_0xff73('0x5d')][_0xff73('0x65')]||_0x579242[_0xff73('0x66')]['id'];return db['FaxMessage'][_0xff73('0x5e')]({'where':{'id':_0x579242[_0xff73('0x5b')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xff73('0x67')}]})[_0xff73('0x3b')](handleEntityNotFound(_0x16d65c,null))['then'](saveUpdates(_0x579242[_0xff73('0x5d')],null))[_0xff73('0x3b')](function(_0x2acdda){if(_0x2acdda){_0x58d339[_0xff73('0x2d')]=_0x2acdda['get']({'plain':!![]});return db['FaxInteraction'][_0xff73('0x5e')]({'where':{'id':_0x2acdda[_0xff73('0x68')]}});}return null;})[_0xff73('0x3b')](handleEntityNotFound(_0x16d65c,null))[_0xff73('0x3b')](function(_0x2b10ba){if(_0x2b10ba){return _0x2b10ba[_0xff73('0x3a')]({'UserId':_0x579242[_0xff73('0x5d')][_0xff73('0x65')],'read1stAt':_[_0xff73('0x69')](_0x2b10ba['read1stAt'])?moment()[_0xff73('0x6a')](_0xff73('0x64')):undefined});}return null;})[_0xff73('0x3b')](function(_0x3bfded){if(_0x3bfded){_0x58d339['interaction']=_0x3bfded[_0xff73('0x6b')]({'plain':!![]});interaction_log[_0xff73('0x26')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x579242[_0xff73('0x66')]['id'],_0x579242[_0xff73('0x66')][_0xff73('0x3f')],_0x579242[_0xff73('0x66')][_0xff73('0x6c')],_0x58d339[_0xff73('0x6d')]['id'],_0x579242[_0xff73('0x5d')]?JSON[_0xff73('0x2a')](_0x579242['body']):_0xff73('0x6e'));return respondWithRpcPromise(_0xff73('0x6f'),_0xff73('0x70'),_0x58d339);}return null;})[_0xff73('0x3b')](function(_0x59c372){if(_0x59c372){if(_0x579242[_0xff73('0x5d')][_0xff73('0x71')]){_0x58d339[_0xff73('0x2d')]['interface']=util[_0xff73('0x6a')](_0xff73('0x72'),_0x579242[_0xff73('0x66')][_0xff73('0x3f')]);_0x58d339['message'][_0xff73('0x73')]=_0x58d339[_0xff73('0x73')];_0x58d339[_0xff73('0x2d')]['event']=_0xff73('0x74');return respondWithRpcPromise(_0xff73('0x75'),_0xff73('0x75'),{'event':_0xff73('0x76'),'message':_0x58d339[_0xff73('0x2d')]},client9002)[_0xff73('0x3b')](function(){return _0x58d339;});}return _0x58d339;}return null;})['then'](respondWithResult(_0x16d65c,null))[_0xff73('0x30')](handleError(_0x16d65c,null));};var interaction_log=require(_0xff73('0x15'))('fax-interactions');exports[_0xff73('0x38')]=function(_0x3e3152,_0x33feda,_0x30912b){var _0x4884f1={'agent':{},'channel':_0xff73('0x61')};if(_0x3e3152[_0xff73('0x5d')]['id']){delete _0x3e3152['body']['id'];}_0x3e3152[_0xff73('0x5d')]['UserId']=_0x3e3152[_0xff73('0x5d')][_0xff73('0x65')]||_0x3e3152[_0xff73('0x66')]['id'];_0x4884f1[_0xff73('0x77')]['id']=_0x3e3152[_0xff73('0x5d')][_0xff73('0x65')];return db[_0xff73('0x55')][_0xff73('0x5e')]({'where':{'id':_0x3e3152['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x33feda,null))[_0xff73('0x3b')](function(_0x31b3cd){if(_0x31b3cd){_0x4884f1['message']=_0x31b3cd[_0xff73('0x6b')]({'plain':!![]});return db[_0xff73('0x78')][_0xff73('0x5e')]({'where':{'id':_0x31b3cd[_0xff73('0x68')]}});}return null;})[_0xff73('0x3b')](handleEntityNotFound(_0x33feda,null))[_0xff73('0x3b')](function(_0x18711e){if(_0x18711e){_0x4884f1[_0xff73('0x6d')]=_0x18711e[_0xff73('0x6b')]({'plain':!![]});interaction_log['info'](_0xff73('0x79'),_0x3e3152[_0xff73('0x66')]['id'],_0x3e3152[_0xff73('0x66')][_0xff73('0x3f')],_0x3e3152[_0xff73('0x66')][_0xff73('0x6c')],_0x4884f1[_0xff73('0x6d')]['id'],_0x3e3152[_0xff73('0x5d')]?JSON[_0xff73('0x2a')](_0x3e3152['body']):_0xff73('0x6e'));return respondWithRpcPromise(_0xff73('0x7a'),_0xff73('0x7b'),_0x4884f1);}return null;})[_0xff73('0x3b')](function(_0x16d6ed){if(_0x16d6ed){_0x16d6ed[_0xff73('0x2d')][_0xff73('0x7c')]=util['format'](_0xff73('0x72'),_0x3e3152[_0xff73('0x66')]['name']);_0x16d6ed[_0xff73('0x2d')]['channel']=_0x4884f1[_0xff73('0x73')];_0x16d6ed[_0xff73('0x2d')]['event']=_0xff73('0x38');respondWithRpcPromise('EventManager',_0xff73('0x75'),{'event':_0xff73('0x7d'),'message':_0x16d6ed[_0xff73('0x2d')]},client9002);return _0x4884f1;}return null;})[_0xff73('0x3b')](respondWithResult(_0x33feda,null))[_0xff73('0x30')](handleError(_0x33feda,null));};exports[_0xff73('0x7e')]=function(_0x2ea36a,_0x1b52c4){var _0x21240a;return db[_0xff73('0x55')]['create'](_0x2ea36a[_0xff73('0x5d')],{})[_0xff73('0x3b')](function(_0x133fe9){_0x21240a=_0x133fe9;return db[_0xff73('0x7f')]['findOne']({'where':{'id':_0x21240a['ContactId']}});})[_0xff73('0x3b')](function(_0x4075d3){if(_[_0xff73('0x69')](_0x4075d3)){return;}else{_0x21240a[_0xff73('0x61')]=_0x4075d3['fax'];return db[_0xff73('0x80')][_0xff73('0x81')]({'where':{'id':_0x21240a[_0xff73('0x82')]}});}})['then'](function(_0x4149cd){return respondWithRpcPromise(_0xff73('0x83'),'SendFax',{'FaxAccountId':_[_0xff73('0x69')](_0x2ea36a['body'])?undefined:_0x2ea36a['body']['FaxAccountId'],'path':_[_0xff73('0x69')](_0x4149cd)?undefined:util['format'](_0xff73('0x84'),_0x4149cd[_0xff73('0x85')]),'fax':_[_0xff73('0x69')](_0x21240a[_0xff73('0x61')])?undefined:_0x21240a[_0xff73('0x61')],'AttachmentId':_0x21240a[_0xff73('0x82')]},client9002);})[_0xff73('0x3b')](respondWithResult(_0x1b52c4,0xc9))[_0xff73('0x30')](handleError(_0x1b52c4,null));};exports['download']=function(_0x438b6b,_0x2f6f3d){var _0x19cfd9=path['join'](config[_0xff73('0x86')],_0xff73('0x87'),'files',_0xff73('0x88'));return db['FaxMessage'][_0xff73('0x5e')]({'where':{'id':_0x438b6b[_0xff73('0x5b')]['id']},'include':[{'model':db[_0xff73('0x80')],'as':'Attachment'}]})[_0xff73('0x3b')](handleEntityNotFound(_0x2f6f3d,null))[_0xff73('0x3b')](function(_0x1e2dac){if(_0x1e2dac){return _0x2f6f3d[_0xff73('0x89')](path[_0xff73('0x8a')](_0x19cfd9,_0x1e2dac[_0xff73('0x80')]['basename']));}})['catch'](handleError(_0x2f6f3d,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 71676a6..ba151ec 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 _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x54ff10,_0x5e3da5){var _0x1cd2ae=function(_0x9e67e9){while(--_0x9e67e9){_0x54ff10['push'](_0x54ff10['shift']());}};_0x1cd2ae(++_0x5e3da5);}(_0x008c,0x188));var _0xc008=function(_0x1d4449,_0x495153){_0x1d4449=_0x1d4449-0x0;var _0x4dcde3=_0x008c[_0x1d4449];return _0x4dcde3;};'use strict';var EventEmitter=require(_0xc008('0x0'));var FaxMessage=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){FaxMessageEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);FaxMessageEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];FaxMessage[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x555971,_0x530821){var _0x250df5=function(_0x3f571e){while(--_0x3f571e){_0x555971['push'](_0x555971['shift']());}};_0x250df5(++_0x530821);}(_0x008c,0x188));var _0xc008=function(_0x946e1b,_0x4f9f57){_0x946e1b=_0x946e1b-0x0;var _0x4db99b=_0x008c[_0x946e1b];return _0x4db99b;};'use strict';var EventEmitter=require(_0xc008('0x0'));var FaxMessage=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){FaxMessageEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);FaxMessageEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];FaxMessage[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 711efd8..7c04ce4 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 _0xf2c3=['body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','update','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages'];(function(_0x573afd,_0x238cac){var _0x245c4b=function(_0x4bd91d){while(--_0x4bd91d){_0x573afd['push'](_0x573afd['shift']());}};_0x245c4b(++_0x238cac);}(_0xf2c3,0x6e));var _0x3f2c=function(_0x4ddbfe,_0x52bb08){_0x4ddbfe=_0x4ddbfe-0x0;var _0xb42d46=_0xf2c3[_0x4ddbfe];return _0xb42d46;};'use strict';var _=require(_0x3f2c('0x0'));var util=require(_0x3f2c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3f2c('0x2'));var BPromise=require(_0x3f2c('0x3'));var rp=require(_0x3f2c('0x4'));var fs=require('fs');var path=require(_0x3f2c('0x5'));var rimraf=require(_0x3f2c('0x6'));var config=require(_0x3f2c('0x7'));var attributes=require(_0x3f2c('0x8'));module[_0x3f2c('0x9')]=function(_0xd28b2b,_0x488326){return _0xd28b2b[_0x3f2c('0xa')](_0x3f2c('0xb'),attributes,{'tableName':_0x3f2c('0xc'),'paranoid':![],'indexes':[{'name':_0x3f2c('0xd'),'fields':[_0x3f2c('0xe')],'type':_0x3f2c('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4c771d,_0x5c9009,_0x15c597){var _0x3ae0d4=_0xd28b2b[_0x3f2c('0x10')];var _0x301e11=_0x4c771d[_0x3f2c('0x11')]({'plain':!![]});if(_0x301e11['direction'][_0x3f2c('0x12')]()==='in'||_0x301e11[_0x3f2c('0x13')][_0x3f2c('0x12')]()===_0x3f2c('0x14')&&!_0x301e11[_0x3f2c('0x15')]&&!_[_0x3f2c('0x16')](_0x301e11[_0x3f2c('0x17')])){_0x3ae0d4[_0x3f2c('0x18')]['findOne']({'where':{'id':_0x301e11[_0x3f2c('0x19')]}})[_0x3f2c('0x1a')](function(_0x2cad67){if(_0x2cad67){_0x2cad67[_0x3f2c('0x1b')]({'lastMsgAt':_0x301e11['createdAt'],'lastMsgDirection':_0x301e11[_0x3f2c('0x13')][_0x3f2c('0x12')]()});}})['catch'](function(_0x49901f){console[_0x3f2c('0x1c')](_0x49901f);});}_0x15c597();}},'charset':_0x3f2c('0x1d'),'collate':_0x3f2c('0x1e')});}; \ No newline at end of file +var _0x8bff=['path','rimraf','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','get','toLowerCase','direction','out','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','bluebird'];(function(_0x3bd4a9,_0x4ee0d1){var _0x5bdcec=function(_0x34d6cf){while(--_0x34d6cf){_0x3bd4a9['push'](_0x3bd4a9['shift']());}};_0x5bdcec(++_0x4ee0d1);}(_0x8bff,0x19f));var _0xf8bf=function(_0x32fe94,_0x57cca0){_0x32fe94=_0x32fe94-0x0;var _0x4fdf81=_0x8bff[_0x32fe94];return _0x4fdf81;};'use strict';var _=require(_0xf8bf('0x0'));var util=require(_0xf8bf('0x1'));var logger=require(_0xf8bf('0x2'))(_0xf8bf('0x3'));var moment=require('moment');var BPromise=require(_0xf8bf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf8bf('0x5'));var rimraf=require(_0xf8bf('0x6'));var config=require('../../config/environment');var attributes=require(_0xf8bf('0x7'));module['exports']=function(_0x430d7e,_0x2a6b16){return _0x430d7e[_0xf8bf('0x8')](_0xf8bf('0x9'),attributes,{'tableName':_0xf8bf('0xa'),'paranoid':![],'indexes':[{'name':_0xf8bf('0xb'),'fields':[_0xf8bf('0xc')],'type':_0xf8bf('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x359842,_0x659322,_0xc9bb4a){var _0x5f0246=_0x430d7e['models'];var _0x3473c7=_0x359842[_0xf8bf('0xe')]({'plain':!![]});if(_0x3473c7['direction'][_0xf8bf('0xf')]()==='in'||_0x3473c7[_0xf8bf('0x10')][_0xf8bf('0xf')]()===_0xf8bf('0x11')&&!_0x3473c7['secret']&&!_[_0xf8bf('0x12')](_0x3473c7[_0xf8bf('0x13')])){_0x5f0246[_0xf8bf('0x14')][_0xf8bf('0x15')]({'where':{'id':_0x3473c7[_0xf8bf('0x16')]}})['then'](function(_0x21a3e6){if(_0x21a3e6){_0x21a3e6[_0xf8bf('0x17')]({'lastMsgAt':_0x3473c7[_0xf8bf('0x18')],'lastMsgDirection':_0x3473c7[_0xf8bf('0x10')][_0xf8bf('0xf')]()});}})[_0xf8bf('0x19')](function(_0x25898f){console[_0xf8bf('0x1a')](_0x25898f);});}_0xc9bb4a();}},'charset':_0xf8bf('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 8cf7537..ff6c851 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 _0xde71=['request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','options','UpdateFaxMessage','update','raw','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s'];(function(_0x2ac42c,_0x400eff){var _0x29b7f3=function(_0x2f9606){while(--_0x2f9606){_0x2ac42c['push'](_0x2ac42c['shift']());}};_0x29b7f3(++_0x400eff);}(_0xde71,0x1c1));var _0x1de7=function(_0x4f83ca,_0x46f67a){_0x4f83ca=_0x4f83ca-0x0;var _0x1fbac3=_0xde71[_0x4f83ca];return _0x1fbac3;};'use strict';var _=require(_0x1de7('0x0'));var util=require(_0x1de7('0x1'));var moment=require(_0x1de7('0x2'));var BPromise=require(_0x1de7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1de7('0x4'));var db=require(_0x1de7('0x5'))['db'];var utils=require(_0x1de7('0x6'));var logger=require(_0x1de7('0x7'))(_0x1de7('0x8'));var config=require(_0x1de7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1de7('0xa')][_0x1de7('0xb')]({'port':0x232a});config[_0x1de7('0xc')]=_[_0x1de7('0xd')](config[_0x1de7('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1de7('0xc')]));require(_0x1de7('0xe'))[_0x1de7('0xf')](socket);function respondWithRpcPromise(_0x833d72,_0x549a34,_0x4913fb){return new BPromise(function(_0x23f154,_0x502d2b){return client[_0x1de7('0x10')](_0x833d72,_0x4913fb)[_0x1de7('0x11')](function(_0x5e2008){logger['info'](_0x1de7('0x12'),_0x549a34,_0x1de7('0x13'));logger[_0x1de7('0x14')](_0x1de7('0x15'),_0x549a34,_0x1de7('0x13'),JSON[_0x1de7('0x16')](_0x5e2008));if(_0x5e2008[_0x1de7('0x17')]){if(_0x5e2008[_0x1de7('0x17')][_0x1de7('0x18')]===0x1f4){logger['error'](_0x1de7('0x12'),_0x549a34,_0x5e2008['error']['message']);return _0x502d2b(_0x5e2008['error'][_0x1de7('0x19')]);}logger[_0x1de7('0x17')]('FaxMessage,\x20%s,\x20%s',_0x549a34,_0x5e2008['error'][_0x1de7('0x19')]);return _0x23f154(_0x5e2008[_0x1de7('0x17')][_0x1de7('0x19')]);}else{logger[_0x1de7('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x549a34,_0x1de7('0x13'));_0x23f154(_0x5e2008[_0x1de7('0x1b')][_0x1de7('0x19')]);}})[_0x1de7('0x1c')](function(_0x562ebf){logger[_0x1de7('0x17')]('FaxMessage,\x20%s,\x20%s',_0x549a34,_0x562ebf);_0x502d2b(_0x562ebf);});});}exports[_0x1de7('0x1d')]=function(_0x673ffc){var _0x5eafa9=this;return new Promise(function(_0x4b2e40,_0x24d123){return db[_0x1de7('0x1e')][_0x1de7('0x1f')](_0x673ffc['body'],{'raw':_0x673ffc[_0x1de7('0x20')]?_0x673ffc[_0x1de7('0x20')]['raw']===undefined?!![]:![]:!![]})[_0x1de7('0x11')](function(_0x2fad04){logger[_0x1de7('0x1a')](_0x1de7('0x1d'),_0x673ffc);logger[_0x1de7('0x14')]('CreateFaxMessage',_0x673ffc,JSON['stringify'](_0x2fad04));_0x4b2e40(_0x2fad04);})['catch'](function(_0x32c80b){logger['error'](_0x1de7('0x1d'),_0x32c80b['message'],_0x673ffc);_0x24d123(_0x5eafa9[_0x1de7('0x17')](0x1f4,_0x32c80b[_0x1de7('0x19')]));});});};exports[_0x1de7('0x21')]=function(_0x65c4ac){var _0x1b941b=this;return new Promise(function(_0x5f419b,_0xd97ebb){return db[_0x1de7('0x1e')][_0x1de7('0x22')](_0x65c4ac['body'],{'raw':_0x65c4ac[_0x1de7('0x20')]?_0x65c4ac['options'][_0x1de7('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x65c4ac[_0x1de7('0x20')]?_0x65c4ac[_0x1de7('0x20')][_0x1de7('0x24')]||null:null,'attributes':_0x65c4ac[_0x1de7('0x20')]?_0x65c4ac['options'][_0x1de7('0x25')]||null:null,'limit':_0x65c4ac[_0x1de7('0x20')]?_0x65c4ac['options'][_0x1de7('0x26')]||null:null})['then'](function(_0xa10efa){logger[_0x1de7('0x1a')]('UpdateFaxMessage',_0x65c4ac);logger[_0x1de7('0x14')]('UpdateFaxMessage',_0x65c4ac,JSON[_0x1de7('0x16')](_0xa10efa));_0x5f419b(_0xa10efa);})[_0x1de7('0x1c')](function(_0x1417a1){logger[_0x1de7('0x17')](_0x1de7('0x21'),_0x1417a1['message'],_0x65c4ac);_0xd97ebb(_0x1b941b[_0x1de7('0x17')](0x1f4,_0x1417a1['message']));});});}; \ No newline at end of file +var _0x5568=['options','raw','UpdateFaxMessage','attributes','limit','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','request\x20sent','debug','stringify','error','FaxMessage,\x20%s,\x20%s','message','result','CreateFaxMessage','FaxMessage','create','body'];(function(_0x23d42c,_0x274123){var _0x4054d9=function(_0x25ac18){while(--_0x25ac18){_0x23d42c['push'](_0x23d42c['shift']());}};_0x4054d9(++_0x274123);}(_0x5568,0x6f));var _0x8556=function(_0xab62ef,_0x348a8b){_0xab62ef=_0xab62ef-0x0;var _0x3ee106=_0x5568[_0xab62ef];return _0x3ee106;};'use strict';var _=require('lodash');var util=require(_0x8556('0x0'));var moment=require('moment');var BPromise=require(_0x8556('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8556('0x2'));var db=require(_0x8556('0x3'))['db'];var utils=require(_0x8556('0x4'));var logger=require('../../config/logger')(_0x8556('0x5'));var config=require(_0x8556('0x6'));var jayson=require(_0x8556('0x7'));var client=jayson[_0x8556('0x8')]['http']({'port':0x232a});config[_0x8556('0x9')]=_[_0x8556('0xa')](config['redis'],{'host':_0x8556('0xb'),'port':0x18eb});var socket=require(_0x8556('0xc'))(new Redis(config['redis']));require(_0x8556('0xd'))[_0x8556('0xe')](socket);function respondWithRpcPromise(_0x385cce,_0xe9563b,_0x30a327){return new BPromise(function(_0x48a348,_0x3d48aa){return client[_0x8556('0xf')](_0x385cce,_0x30a327)[_0x8556('0x10')](function(_0x4a64af){logger[_0x8556('0x11')]('FaxMessage,\x20%s,\x20%s',_0xe9563b,_0x8556('0x12'));logger[_0x8556('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0xe9563b,_0x8556('0x12'),JSON[_0x8556('0x14')](_0x4a64af));if(_0x4a64af['error']){if(_0x4a64af[_0x8556('0x15')]['code']===0x1f4){logger[_0x8556('0x15')](_0x8556('0x16'),_0xe9563b,_0x4a64af[_0x8556('0x15')][_0x8556('0x17')]);return _0x3d48aa(_0x4a64af[_0x8556('0x15')][_0x8556('0x17')]);}logger[_0x8556('0x15')]('FaxMessage,\x20%s,\x20%s',_0xe9563b,_0x4a64af['error'][_0x8556('0x17')]);return _0x48a348(_0x4a64af[_0x8556('0x15')][_0x8556('0x17')]);}else{logger['info'](_0x8556('0x16'),_0xe9563b,'request\x20sent');_0x48a348(_0x4a64af[_0x8556('0x18')][_0x8556('0x17')]);}})['catch'](function(_0x4630dd){logger[_0x8556('0x15')](_0x8556('0x16'),_0xe9563b,_0x4630dd);_0x3d48aa(_0x4630dd);});});}exports[_0x8556('0x19')]=function(_0x1f75a0){var _0xc60c5a=this;return new Promise(function(_0x1e72c8,_0x22abbe){return db[_0x8556('0x1a')][_0x8556('0x1b')](_0x1f75a0[_0x8556('0x1c')],{'raw':_0x1f75a0['options']?_0x1f75a0[_0x8556('0x1d')][_0x8556('0x1e')]===undefined?!![]:![]:!![]})[_0x8556('0x10')](function(_0x51de8d){logger[_0x8556('0x11')]('CreateFaxMessage',_0x1f75a0);logger[_0x8556('0x13')]('CreateFaxMessage',_0x1f75a0,JSON['stringify'](_0x51de8d));_0x1e72c8(_0x51de8d);})['catch'](function(_0x27a7d3){logger[_0x8556('0x15')](_0x8556('0x19'),_0x27a7d3[_0x8556('0x17')],_0x1f75a0);_0x22abbe(_0xc60c5a[_0x8556('0x15')](0x1f4,_0x27a7d3['message']));});});};exports[_0x8556('0x1f')]=function(_0x1d7777){var _0x3aef80=this;return new Promise(function(_0x4438fd,_0x380b52){return db[_0x8556('0x1a')]['update'](_0x1d7777[_0x8556('0x1c')],{'raw':_0x1d7777[_0x8556('0x1d')]?_0x1d7777[_0x8556('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d7777['options']?_0x1d7777[_0x8556('0x1d')]['where']||null:null,'attributes':_0x1d7777['options']?_0x1d7777[_0x8556('0x1d')][_0x8556('0x20')]||null:null,'limit':_0x1d7777[_0x8556('0x1d')]?_0x1d7777[_0x8556('0x1d')][_0x8556('0x21')]||null:null})[_0x8556('0x10')](function(_0x1b426e){logger[_0x8556('0x11')](_0x8556('0x1f'),_0x1d7777);logger['debug']('UpdateFaxMessage',_0x1d7777,JSON[_0x8556('0x14')](_0x1b426e));_0x4438fd(_0x1b426e);})[_0x8556('0x22')](function(_0x56517f){logger['error']('UpdateFaxMessage',_0x56517f[_0x8556('0x17')],_0x1d7777);_0x380b52(_0x3aef80[_0x8556('0x15')](0x1f4,_0x56517f[_0x8556('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index b513448..30cfbbc 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 _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 8e79821..72e2131 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 _0x361a=['accept','/:id/reject','delete','destroy','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','show','download','post','fax','faxmessage:create','create','/:id','update','put','/:id/accept'];(function(_0x5aa27f,_0xd98d9a){var _0x36e286=function(_0x6af949){while(--_0x6af949){_0x5aa27f['push'](_0x5aa27f['shift']());}};_0x36e286(++_0xd98d9a);}(_0x361a,0x8e));var _0xa361=function(_0x54c793,_0x2b91b7){_0x54c793=_0x54c793-0x0;var _0x2e9819=_0x361a[_0x54c793];return _0x2e9819;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa361('0x0'));var express=require(_0xa361('0x1'));var router=express[_0xa361('0x2')]();var auth=require(_0xa361('0x3'));var interaction=require(_0xa361('0x4'));var config=require(_0xa361('0x5'));var controller=require(_0xa361('0x6'));router[_0xa361('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa361('0x7')]('/describe',auth[_0xa361('0x8')](),controller['describe']);router[_0xa361('0x7')]('/:id',auth[_0xa361('0x8')](),controller[_0xa361('0x9')]);router[_0xa361('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0xa361('0xa')]);router[_0xa361('0xb')]('/',auth[_0xa361('0x8')](),interaction['tracked'](_0xa361('0xc'),_0xa361('0xd')),controller[_0xa361('0xe')]);router['put'](_0xa361('0xf'),auth[_0xa361('0x8')](),controller[_0xa361('0x10')]);router[_0xa361('0x11')](_0xa361('0x12'),auth[_0xa361('0x8')](),controller[_0xa361('0x13')]);router['put'](_0xa361('0x14'),auth[_0xa361('0x8')](),controller['reject']);router[_0xa361('0x15')](_0xa361('0xf'),auth[_0xa361('0x8')](),controller[_0xa361('0x16')]);module['exports']=router; \ No newline at end of file +var _0xe347=['get','isAuthenticated','index','describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller'];(function(_0x2b660f,_0x3511ef){var _0x596363=function(_0x3cbb0a){while(--_0x3cbb0a){_0x2b660f['push'](_0x2b660f['shift']());}};_0x596363(++_0x3511ef);}(_0xe347,0xac));var _0x7e34=function(_0x526786,_0x105cbf){_0x526786=_0x526786-0x0;var _0x3a512d=_0xe347[_0x526786];return _0x3a512d;};'use strict';var multer=require(_0x7e34('0x0'));var util=require('util');var path=require(_0x7e34('0x1'));var timeout=require('connect-timeout');var express=require(_0x7e34('0x2'));var router=express[_0x7e34('0x3')]();var auth=require(_0x7e34('0x4'));var interaction=require(_0x7e34('0x5'));var config=require(_0x7e34('0x6'));var controller=require(_0x7e34('0x7'));router[_0x7e34('0x8')]('/',auth[_0x7e34('0x9')](),controller[_0x7e34('0xa')]);router[_0x7e34('0x8')]('/describe',auth[_0x7e34('0x9')](),controller[_0x7e34('0xb')]);router['get'](_0x7e34('0xc'),auth[_0x7e34('0x9')](),controller[_0x7e34('0xd')]);router[_0x7e34('0x8')](_0x7e34('0xe'),auth['isAuthenticated'](),controller[_0x7e34('0xf')]);router[_0x7e34('0x10')]('/',auth[_0x7e34('0x9')](),interaction[_0x7e34('0x11')](_0x7e34('0x12'),_0x7e34('0x13')),controller[_0x7e34('0x14')]);router[_0x7e34('0x15')](_0x7e34('0xc'),auth[_0x7e34('0x9')](),controller[_0x7e34('0x16')]);router[_0x7e34('0x15')](_0x7e34('0x17'),auth['isAuthenticated'](),controller[_0x7e34('0x18')]);router[_0x7e34('0x15')](_0x7e34('0x19'),auth[_0x7e34('0x9')](),controller[_0x7e34('0x1a')]);router[_0x7e34('0x1b')](_0x7e34('0xc'),auth['isAuthenticated'](),controller[_0x7e34('0x1c')]);module[_0x7e34('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 605b970..1a20955 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 _0x26ef=['exports','STRING','name','ENUM','rrmemory','beepall'];(function(_0x2491a3,_0x590c04){var _0x4bff05=function(_0xb21220){while(--_0xb21220){_0x2491a3['push'](_0x2491a3['shift']());}};_0x4bff05(++_0x590c04);}(_0x26ef,0x13e));var _0xf26e=function(_0x546bff,_0x299a95){_0x546bff=_0x546bff-0x0;var _0x42e3af=_0x26ef[_0x546bff];return _0x42e3af;};'use strict';var Sequelize=require('sequelize');module[_0xf26e('0x0')]={'name':{'type':Sequelize[_0xf26e('0x1')],'unique':_0xf26e('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf26e('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf26e('0x3')](_0xf26e('0x4'),_0xf26e('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd957=['STRING','ENUM','rrmemory','beepall','roundrobin','INTEGER','sequelize','exports','name'];(function(_0x1a89ca,_0x27394b){var _0x29cbb2=function(_0x31e1f4){while(--_0x31e1f4){_0x1a89ca['push'](_0x1a89ca['shift']());}};_0x29cbb2(++_0x27394b);}(_0xd957,0x153));var _0x7d95=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd957[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x7d95('0x0'));module[_0x7d95('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7d95('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7d95('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7d95('0x4')](_0x7d95('0x5'),_0x7d95('0x6'),_0x7d95('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x7d95('0x8')],'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 b701c22..65fac13 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 _0x5324=['describe','getMembers','findOne','nolimit','pick','FaxQueueId','UserFaxQueue','User','findAndCountAll','UserId','updatedAt','createdAt','%s/%s','SIP','faxPause','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','removeTeams','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','every','TeamId','all','union','value','isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','redis','defaults','localhost','./faxQueue.socket','register','end','status','json','offset','set','Content-Range','apply','save','update','then','destroy','get','FaxQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','FaxQueue','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filter','merge','type','VIRTUAL','count','findAll','rows','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x4d8e53,_0x2951f0){var _0x4013dc=function(_0x4f4110){while(--_0x4f4110){_0x4d8e53['push'](_0x4d8e53['shift']());}};_0x4013dc(++_0x2951f0);}(_0x5324,0x154));var _0x4532=function(_0x32ac61,_0x55bb4a){_0x32ac61=_0x32ac61-0x0;var _0x32fe89=_0x5324[_0x32ac61];return _0x32fe89;};'use strict';var pdf=require(_0x4532('0x0'));var emlformat=require(_0x4532('0x1'));var rimraf=require(_0x4532('0x2'));var zipdir=require(_0x4532('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4532('0x4'));var moment=require('moment');var BPromise=require(_0x4532('0x5'));var Mustache=require(_0x4532('0x6'));var util=require(_0x4532('0x7'));var path=require(_0x4532('0x8'));var sox=require(_0x4532('0x9'));var csv=require(_0x4532('0xa'));var ejs=require(_0x4532('0xb'));var fs=require('fs');var _=require(_0x4532('0xc'));var squel=require('squel');var crypto=require(_0x4532('0xd'));var jsforce=require(_0x4532('0xe'));var deskjs=require(_0x4532('0xf'));var toCsv=require(_0x4532('0xa'));var querystring=require(_0x4532('0x10'));var Papa=require(_0x4532('0x11'));var Redis=require(_0x4532('0x12'));var authService=require(_0x4532('0x13'));var qs=require(_0x4532('0x14'));var as=require(_0x4532('0x15'));var hardwareService=require(_0x4532('0x16'));var logger=require(_0x4532('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4532('0x18'));var db=require('../../mysqldb')['db'];config[_0x4532('0x19')]=_[_0x4532('0x1a')](config[_0x4532('0x19')],{'host':_0x4532('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4532('0x19')]));require(_0x4532('0x1c'))[_0x4532('0x1d')](socket);function respondWithStatusCode(_0x2e0b21,_0x19eaf3){_0x19eaf3=_0x19eaf3||0xcc;return function(_0x525f96){if(_0x525f96){return _0x2e0b21['sendStatus'](_0x19eaf3);}return _0x2e0b21['status'](_0x19eaf3)[_0x4532('0x1e')]();};}function respondWithResult(_0x19ea01,_0x2dedca){_0x2dedca=_0x2dedca||0xc8;return function(_0x3b97ee){if(_0x3b97ee){return _0x19ea01[_0x4532('0x1f')](_0x2dedca)[_0x4532('0x20')](_0x3b97ee);}};}function respondWithFilteredResult(_0x2a79ec,_0x4036b6){return function(_0xd479a9){if(_0xd479a9){var _0x4db2a1=_0xd479a9['count'],_0x281ab6=_0x4036b6[_0x4532('0x21')],_0x469c5a=_0x4036b6[_0x4532('0x21')]+_0x4036b6['limit'],_0x250ba4;if(_0x469c5a>=_0x4db2a1){_0x469c5a=_0x4db2a1;_0x250ba4=0xc8;}else{_0x250ba4=0xce;}_0x2a79ec[_0x4532('0x1f')](_0x250ba4);return _0x2a79ec[_0x4532('0x22')](_0x4532('0x23'),_0x281ab6+'-'+_0x469c5a+'/'+_0x4db2a1)[_0x4532('0x20')](_0xd479a9);}return null;};}function patchUpdates(_0x3f677b){return function(_0x30a1e1){try{jsonpatch[_0x4532('0x24')](_0x30a1e1,_0x3f677b,!![]);}catch(_0x53127c){return BPromise['reject'](_0x53127c);}return _0x30a1e1[_0x4532('0x25')]();};}function saveUpdates(_0x46dc73,_0x481c26){return function(_0x1c383c){if(_0x1c383c){return _0x1c383c[_0x4532('0x26')](_0x46dc73)[_0x4532('0x27')](function(_0xed85b1){return _0xed85b1;});}return null;};}function removeEntity(_0x4fd4bd,_0xbf825a){return function(_0x571e56){if(_0x571e56){return _0x571e56[_0x4532('0x28')]()[_0x4532('0x27')](function(){var _0x16e2c4=_0x571e56[_0x4532('0x29')]({'plain':!![]});var _0x40e42f=_0x4532('0x2a');return db[_0x4532('0x2b')][_0x4532('0x28')]({'where':{'type':_0x40e42f,'resourceId':_0x16e2c4['id']}})['then'](function(){return _0x571e56;});})['then'](function(){_0x4fd4bd[_0x4532('0x1f')](0xcc)[_0x4532('0x1e')]();});}};}function handleEntityNotFound(_0x60203f,_0x19f85c){return function(_0x19fdea){if(!_0x19fdea){_0x60203f[_0x4532('0x2c')](0x194);}return _0x19fdea;};}function handleError(_0x4a810d,_0x3de0ee){_0x3de0ee=_0x3de0ee||0x1f4;return function(_0x239e85){logger[_0x4532('0x2d')](_0x239e85[_0x4532('0x2e')]);if(_0x239e85[_0x4532('0x2f')]){delete _0x239e85['name'];}_0x4a810d[_0x4532('0x1f')](_0x3de0ee)[_0x4532('0x30')](_0x239e85);};}exports[_0x4532('0x31')]=function(_0x523f96,_0x58602d){var _0x5b1bab={},_0x3e4c89={},_0x24ab08={'count':0x0,'rows':[]};var _0x3468bb=_[_0x4532('0x32')](db[_0x4532('0x33')][_0x4532('0x34')],function(_0x20dfd0){return{'name':_0x20dfd0['fieldName'],'type':_0x20dfd0['type'][_0x4532('0x35')]};});_0x3e4c89[_0x4532('0x36')]=_['map'](_0x3468bb,_0x4532('0x2f'));_0x3e4c89[_0x4532('0x37')]=_[_0x4532('0x38')](_0x523f96[_0x4532('0x37')]);_0x3e4c89[_0x4532('0x39')]=_[_0x4532('0x3a')](_0x3e4c89[_0x4532('0x36')],_0x3e4c89[_0x4532('0x37')]);_0x5b1bab['attributes']=_['intersection'](_0x3e4c89[_0x4532('0x36')],qs[_0x4532('0x3b')](_0x523f96['query'][_0x4532('0x3b')]));_0x5b1bab[_0x4532('0x3c')]=_0x5b1bab[_0x4532('0x3c')][_0x4532('0x3d')]?_0x5b1bab['attributes']:_0x3e4c89[_0x4532('0x36')];if(!_0x523f96['query'][_0x4532('0x3e')]('nolimit')){_0x5b1bab[_0x4532('0x3f')]=qs[_0x4532('0x3f')](_0x523f96[_0x4532('0x37')][_0x4532('0x3f')]);_0x5b1bab[_0x4532('0x21')]=qs[_0x4532('0x21')](_0x523f96[_0x4532('0x37')][_0x4532('0x21')]);}_0x5b1bab[_0x4532('0x40')]=qs[_0x4532('0x41')](_0x523f96[_0x4532('0x37')]['sort']);_0x5b1bab[_0x4532('0x42')]=qs['filters'](_['pick'](_0x523f96[_0x4532('0x37')],_0x3e4c89['filters']),_0x3468bb);if(_0x523f96[_0x4532('0x37')][_0x4532('0x43')]){_0x5b1bab[_0x4532('0x42')]=_[_0x4532('0x44')](_0x5b1bab[_0x4532('0x42')],{'$or':_['map'](_0x3468bb,function(_0x51e813){if(_0x51e813[_0x4532('0x45')]!==_0x4532('0x46')){var _0x589199={};_0x589199[_0x51e813[_0x4532('0x2f')]]={'$like':'%'+_0x523f96['query'][_0x4532('0x43')]+'%'};return _0x589199;}})});}_0x5b1bab=_[_0x4532('0x44')]({},_0x5b1bab,_0x523f96['options']);var _0x527019={'where':_0x5b1bab[_0x4532('0x42')]};return db[_0x4532('0x33')][_0x4532('0x47')](_0x527019)['then'](function(_0x22fffe){_0x24ab08[_0x4532('0x47')]=_0x22fffe;if(_0x523f96[_0x4532('0x37')]['includeAll']){_0x5b1bab['include']=[{'all':!![]}];}return db[_0x4532('0x33')][_0x4532('0x48')](_0x5b1bab);})[_0x4532('0x27')](function(_0x59b4bb){_0x24ab08[_0x4532('0x49')]=_0x59b4bb;return _0x24ab08;})[_0x4532('0x27')](respondWithFilteredResult(_0x58602d,_0x5b1bab))[_0x4532('0x4a')](handleError(_0x58602d,null));};exports[_0x4532('0x4b')]=function(_0x5c75ff,_0x4ced14){var _0x3326cf={'raw':!![],'where':{'id':_0x5c75ff[_0x4532('0x4c')]['id']}},_0x1be411={};_0x1be411[_0x4532('0x36')]=_['keys'](db[_0x4532('0x33')][_0x4532('0x34')]);_0x1be411[_0x4532('0x37')]=_[_0x4532('0x38')](_0x5c75ff[_0x4532('0x37')]);_0x1be411['filters']=_[_0x4532('0x3a')](_0x1be411[_0x4532('0x36')],_0x1be411[_0x4532('0x37')]);_0x3326cf[_0x4532('0x3c')]=_[_0x4532('0x3a')](_0x1be411[_0x4532('0x36')],qs[_0x4532('0x3b')](_0x5c75ff['query'][_0x4532('0x3b')]));_0x3326cf['attributes']=_0x3326cf['attributes'][_0x4532('0x3d')]?_0x3326cf[_0x4532('0x3c')]:_0x1be411['model'];if(_0x5c75ff['query'][_0x4532('0x4d')]){_0x3326cf['include']=[{'all':!![]}];}_0x3326cf=_[_0x4532('0x44')]({},_0x3326cf,_0x5c75ff[_0x4532('0x4e')]);return db[_0x4532('0x33')][_0x4532('0x4f')](_0x3326cf)[_0x4532('0x27')](handleEntityNotFound(_0x4ced14,null))['then'](respondWithResult(_0x4ced14,null))[_0x4532('0x4a')](handleError(_0x4ced14,null));};exports[_0x4532('0x50')]=function(_0x31501d,_0x53fd01){return db[_0x4532('0x33')]['create'](_0x31501d[_0x4532('0x51')],{})['then'](function(_0x2a4a61){var _0x1cfb76=_0x31501d[_0x4532('0x52')][_0x4532('0x29')]({'plain':!![]});if(!_0x1cfb76)throw new Error(_0x4532('0x53'));if(_0x1cfb76[_0x4532('0x54')]===_0x4532('0x52')){var _0x4ac4d4=_0x2a4a61[_0x4532('0x29')]({'plain':!![]});var _0x2529c3=_0x4532('0x2a');return db[_0x4532('0x55')][_0x4532('0x4f')]({'where':{'name':_0x2529c3,'userProfileId':_0x1cfb76[_0x4532('0x56')]},'raw':!![]})['then'](function(_0x2bf4fa){if(_0x2bf4fa&&_0x2bf4fa[_0x4532('0x57')]===0x0){return db[_0x4532('0x2b')][_0x4532('0x50')]({'name':_0x4ac4d4[_0x4532('0x2f')],'resourceId':_0x4ac4d4['id'],'type':_0x2bf4fa[_0x4532('0x2f')],'sectionId':_0x2bf4fa['id']},{})['then'](function(){return _0x2a4a61;});}else{return _0x2a4a61;}})['catch'](function(_0x4e7679){logger[_0x4532('0x2d')](_0x4532('0x58'),_0x4e7679);throw _0x4e7679;});}return _0x2a4a61;})[_0x4532('0x27')](respondWithResult(_0x53fd01,0xc9))[_0x4532('0x4a')](handleError(_0x53fd01,null));};exports['update']=function(_0x3810f3,_0x463ed6){if(_0x3810f3[_0x4532('0x51')]['id']){delete _0x3810f3[_0x4532('0x51')]['id'];}return db[_0x4532('0x33')][_0x4532('0x4f')]({'where':{'id':_0x3810f3[_0x4532('0x4c')]['id']}})[_0x4532('0x27')](handleEntityNotFound(_0x463ed6,null))[_0x4532('0x27')](saveUpdates(_0x3810f3[_0x4532('0x51')],null))[_0x4532('0x27')](respondWithResult(_0x463ed6,null))[_0x4532('0x4a')](handleError(_0x463ed6,null));};exports[_0x4532('0x28')]=function(_0xeb5e89,_0x3daa47){return db[_0x4532('0x33')][_0x4532('0x4f')]({'where':{'id':_0xeb5e89['params']['id']}})[_0x4532('0x27')](handleEntityNotFound(_0x3daa47,null))[_0x4532('0x27')](removeEntity(_0x3daa47,null))['catch'](handleError(_0x3daa47,null));};exports[_0x4532('0x59')]=function(_0x15a6f7,_0x585437){return db[_0x4532('0x33')][_0x4532('0x59')]()[_0x4532('0x27')](respondWithResult(_0x585437,null))['catch'](handleError(_0x585437,null));};exports[_0x4532('0x5a')]=function(_0x4ca59f,_0x1913cd,_0xa75fd6){var _0x4fb50f={'raw':!![],'where':{}},_0x428e46={},_0x466c32;return db[_0x4532('0x33')][_0x4532('0x5b')]({'where':{'id':_0x4ca59f[_0x4532('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1913cd,null))[_0x4532('0x27')](function(_0x39da10){if(_0x39da10){_0x466c32=_0x39da10[_0x4532('0x29')]({'plain':!![]});_0x428e46['model']=_['keys'](db['UserFaxQueue'][_0x4532('0x34')]);_0x428e46['query']=_[_0x4532('0x38')](_0x4ca59f[_0x4532('0x37')]);_0x428e46['filters']=_[_0x4532('0x3a')](_0x428e46[_0x4532('0x36')],_0x428e46[_0x4532('0x37')]);_0x4fb50f[_0x4532('0x3c')]=_[_0x4532('0x3a')](_0x428e46[_0x4532('0x36')],qs[_0x4532('0x3b')](_0x4ca59f[_0x4532('0x37')][_0x4532('0x3b')]));_0x4fb50f[_0x4532('0x3c')]=_0x4fb50f['attributes'][_0x4532('0x3d')]?_0x4fb50f['attributes']:_0x428e46['model'];if(!_0x4ca59f['query'][_0x4532('0x3e')](_0x4532('0x5c'))){_0x4fb50f[_0x4532('0x3f')]=qs[_0x4532('0x3f')](_0x4ca59f['query'][_0x4532('0x3f')]);_0x4fb50f['offset']=qs[_0x4532('0x21')](_0x4ca59f[_0x4532('0x37')][_0x4532('0x21')]);}_0x4fb50f[_0x4532('0x40')]=qs[_0x4532('0x41')](_0x4ca59f[_0x4532('0x37')][_0x4532('0x41')]);_0x4fb50f['where']=qs[_0x4532('0x39')](_[_0x4532('0x5d')](_0x4ca59f[_0x4532('0x37')],_0x428e46[_0x4532('0x39')]));_0x4fb50f['where'][_0x4532('0x5e')]=_0x39da10['id'];if(_0x4ca59f[_0x4532('0x37')]['filter']){_0x4fb50f[_0x4532('0x42')]=_['merge'](_0x4fb50f[_0x4532('0x42')],{'$or':_[_0x4532('0x32')](_0x4fb50f[_0x4532('0x3c')],function(_0x204b62){var _0x2eb38e={};_0x2eb38e[_0x204b62]={'$like':'%'+_0x4ca59f[_0x4532('0x37')][_0x4532('0x43')]+'%'};return _0x2eb38e;})});}_0x4fb50f=_['merge']({},_0x4fb50f,_0x4ca59f['options']);return db[_0x4532('0x5f')][_0x4532('0x48')](_0x4fb50f);}})[_0x4532('0x27')](function(_0x4e4b16){if(_0x4e4b16){return db[_0x4532('0x60')][_0x4532('0x61')]({'where':{'id':_[_0x4532('0x32')](_0x4e4b16,_0x4532('0x62')),'role':'agent'},'attributes':['id',_0x4532('0x2f'),'faxPause',_0x4532('0x63'),_0x4532('0x64')]});}})['then'](function(_0x430b45){if(_0x430b45){return{'count':_0x430b45[_0x4532('0x47')],'rows':_['map'](_0x430b45[_0x4532('0x49')],function(_0x242e03){return{'membername':_0x242e03['name'],'UserId':_0x242e03['id'],'queue_name':_0x466c32[_0x4532('0x2f')],'FaxQueueId':_0x466c32['id'],'interface':util['format'](_0x4532('0x65'),_0x4532('0x66'),_0x242e03[_0x4532('0x2f')]),'penalty':0x0,'paused':_0x242e03[_0x4532('0x67')],'createdAt':_0x242e03['createdAt'],'updatedAt':_0x242e03['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x4532('0x27')](respondWithFilteredResult(_0x1913cd,_0x4fb50f))['catch'](handleError(_0x1913cd,null));};exports['getTeams']=function(_0x3013c8,_0x27c5ef,_0x149101){var _0x14e583={};var _0x2f62a0={};var _0x3be620;var _0x46524d;return db[_0x4532('0x33')][_0x4532('0x5b')]({'where':{'id':_0x3013c8[_0x4532('0x4c')]['id']}})[_0x4532('0x27')](handleEntityNotFound(_0x27c5ef,null))[_0x4532('0x27')](function(_0x2a34b6){if(_0x2a34b6){_0x3be620=_0x2a34b6;_0x2f62a0['model']=_[_0x4532('0x38')](db[_0x4532('0x68')]['rawAttributes']);_0x2f62a0[_0x4532('0x37')]=_[_0x4532('0x38')](_0x3013c8[_0x4532('0x37')]);_0x2f62a0['filters']=_[_0x4532('0x3a')](_0x2f62a0['model'],_0x2f62a0['query']);_0x14e583['attributes']=_['intersection'](_0x2f62a0[_0x4532('0x36')],qs[_0x4532('0x3b')](_0x3013c8[_0x4532('0x37')]['fields']));_0x14e583[_0x4532('0x3c')]=_0x14e583[_0x4532('0x3c')][_0x4532('0x3d')]?_0x14e583[_0x4532('0x3c')]:_0x2f62a0[_0x4532('0x36')];_0x14e583[_0x4532('0x40')]=qs['sort'](_0x3013c8['query'][_0x4532('0x41')]);_0x14e583[_0x4532('0x42')]=qs[_0x4532('0x39')](_[_0x4532('0x5d')](_0x3013c8[_0x4532('0x37')],_0x2f62a0[_0x4532('0x39')]));if(_0x3013c8[_0x4532('0x37')][_0x4532('0x43')]){_0x14e583['where']=_['merge'](_0x14e583[_0x4532('0x42')],{'$or':_[_0x4532('0x32')](_0x14e583[_0x4532('0x3c')],function(_0x11b4f6){var _0x3d76e6={};_0x3d76e6[_0x11b4f6]={'$like':'%'+_0x3013c8[_0x4532('0x37')][_0x4532('0x43')]+'%'};return _0x3d76e6;})});}_0x14e583=_['merge']({},_0x14e583,_0x3013c8[_0x4532('0x4e')]);return _0x3be620[_0x4532('0x69')](_0x14e583);}})['then'](function(_0x4208ba){if(_0x4208ba){_0x46524d=_0x4208ba[_0x4532('0x3d')];if(!_0x3013c8[_0x4532('0x37')][_0x4532('0x3e')]('nolimit')){_0x14e583[_0x4532('0x3f')]=qs[_0x4532('0x3f')](_0x3013c8[_0x4532('0x37')][_0x4532('0x3f')]);_0x14e583[_0x4532('0x21')]=qs[_0x4532('0x21')](_0x3013c8['query'][_0x4532('0x21')]);}return _0x3be620['getTeams'](_0x14e583);}})[_0x4532('0x27')](function(_0x1cd202){if(_0x1cd202){return _0x1cd202?{'count':_0x46524d,'rows':_0x1cd202}:null;}})[_0x4532('0x27')](respondWithResult(_0x27c5ef,null))[_0x4532('0x4a')](handleError(_0x27c5ef,null));};exports[_0x4532('0x6a')]=function(_0x59c92b,_0x35541e,_0x8194e1){var _0x2637e1=_0x59c92b[_0x4532('0x51')][_0x4532('0x6b')];return db[_0x4532('0x68')]['findAll']({'where':{'id':_0x2637e1},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4532('0x6c'),'attributes':['id','name',_0x4532('0x6d'),_0x4532('0x6e'),_0x4532('0x6f')],'raw':!![]}]})[_0x4532('0x27')](function(_0xc8c74d){if(_0xc8c74d){var _0x29d8ae=_[_0x4532('0x70')](_0xc8c74d,function(_0x4b828f){var _0x2dbd0a=_0x4b828f[_0x4532('0x29')]({'plain':!![]});return _0x2dbd0a[_0x4532('0x6c')];});return db['FaxQueue']['find']({'where':{'id':_0x59c92b[_0x4532('0x4c')]['id']}})[_0x4532('0x27')](function(_0x26b03c){return db[_0x4532('0x71')][_0x4532('0x72')](function(_0xecfd81){return _0x26b03c[_0x4532('0x6a')](_0x2637e1,{'transaction':_0xecfd81})['then'](function(){return BPromise[_0x4532('0x73')](_0x29d8ae,function(_0xfee512){return db[_0x4532('0x5f')][_0x4532('0x74')]({'where':{'UserId':_0xfee512['id'],'FaxQueueId':_0x59c92b[_0x4532('0x4c')]['id']},'transaction':_0xecfd81});});})[_0x4532('0x27')](function(){_0x29d8ae['forEach'](function(_0x315b46){socket[_0x4532('0x75')]('userFaxQueue:save',{'UserId':_0x315b46['id'],'FaxQueueId':_0x26b03c['id']});});});});});}})[_0x4532('0x27')](respondWithStatusCode(_0x35541e,null))['catch'](handleError(_0x35541e,null));};exports[_0x4532('0x76')]=function(_0x1d4064,_0x4f079d,_0x3a5cb3){return db['Team'][_0x4532('0x48')]({'where':{'id':_0x1d4064['query'][_0x4532('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x4532('0x60')],'as':_0x4532('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x4532('0x27')](handleEntityNotFound(_0x4f079d,null))[_0x4532('0x27')](function(_0x415e0a){var _0xb92ad=_['map'](_0x415e0a,'id');var _0x13de2a=[];var _0x56f035=[];var _0x160a22=squel['select']();_0x160a22[_0x4532('0x77')](_0x4532('0x78'))[_0x4532('0x79')](_0x4532('0x7a'),'tq')[_0x4532('0x7b')](_0x4532('0x7c'),'ut',_0x4532('0x7d'))[_0x4532('0x42')]('FaxQueueId\x20=\x20?',_0x1d4064[_0x4532('0x4c')]['id']);for(var _0x32fe92=0x0;_0x32fe92<_0x415e0a[_0x4532('0x3d')];_0x32fe92+=0x1){let _0x15e45f=_0x415e0a[_0x32fe92];for(var _0x38c1a1=0x0;_0x38c1a1<_0x15e45f[_0x4532('0x6c')][_0x4532('0x3d')];_0x38c1a1+=0x1){let _0x3e9b6d=_0x15e45f['Agents'][_0x38c1a1];var _0x12a2c1=_0x160a22[_0x4532('0x7e')]();_0x12a2c1[_0x4532('0x42')]('ut.UserId\x20=\x20?',_0x3e9b6d['id']);_0x56f035[_0x4532('0x7f')](db[_0x4532('0x71')][_0x4532('0x37')](_0x12a2c1[_0x4532('0x80')](),{'type':db[_0x4532('0x71')][_0x4532('0x81')]['SELECT']})[_0x4532('0x27')](function(_0x22c17c){if(_0x22c17c[_0x4532('0x3d')]===0x1){return _0x3e9b6d['id'];}else{var _0xbf5eea=_[_0x4532('0x82')](_[_0x4532('0x32')](_0x22c17c,_0x4532('0x83')),function(_0x3c64ac){return _['includes'](_0xb92ad,_0x3c64ac);});if(_0xbf5eea){return _0x3e9b6d['id'];}}}));}}return BPromise[_0x4532('0x84')](_0x56f035)[_0x4532('0x27')](function(_0x47abe7){_0x13de2a=_(_0x13de2a)[_0x4532('0x85')](_0x47abe7)['compact']()[_0x4532('0x86')]();return db['FaxQueue'][_0x4532('0x4f')]({'where':{'id':_0x1d4064[_0x4532('0x4c')]['id']}})[_0x4532('0x27')](function(_0x16081f){return db[_0x4532('0x71')][_0x4532('0x72')](function(_0x29a4fc){return _0x16081f[_0x4532('0x76')](_0x1d4064[_0x4532('0x37')]['ids'],{'transaction':_0x29a4fc})[_0x4532('0x27')](function(){if(!_[_0x4532('0x87')](_0x13de2a)){return _0x16081f[_0x4532('0x88')](_0x13de2a,{'transaction':_0x29a4fc});}})[_0x4532('0x27')](function(){_0x13de2a[_0x4532('0x89')](function(_0x45ff24){socket['emit'](_0x4532('0x8a'),{'UserId':_0x45ff24,'FaxQueueId':_0x16081f['id']});});});});});});})[_0x4532('0x27')](respondWithStatusCode(_0x4f079d,null))[_0x4532('0x4a')](handleError(_0x4f079d,null));};exports[_0x4532('0x8b')]=function(_0x1c81ba,_0x121c7e,_0x5770a5){return db[_0x4532('0x33')]['find']({'where':{'id':_0x1c81ba[_0x4532('0x4c')]['id']}})[_0x4532('0x27')](handleEntityNotFound(_0x121c7e,null))[_0x4532('0x27')](function(_0x23d6d0){if(_0x23d6d0){return _0x23d6d0[_0x4532('0x8b')](_0x1c81ba[_0x4532('0x51')][_0x4532('0x6b')],_['omit'](_0x1c81ba['body'],[_0x4532('0x6b'),'id'])||{})[_0x4532('0x8c')](function(_0x445954){for(var _0x4b299d=0x0;_0x4b299d<_0x1c81ba[_0x4532('0x51')][_0x4532('0x6b')][_0x4532('0x3d')];_0x4b299d+=0x1){socket[_0x4532('0x75')]('userFaxQueue:save',{'UserId':_0x1c81ba['body'][_0x4532('0x6b')][_0x4b299d],'FaxQueueId':_0x1c81ba[_0x4532('0x4c')]['id']});}return _0x445954;});}})[_0x4532('0x27')](respondWithResult(_0x121c7e,null))[_0x4532('0x4a')](handleError(_0x121c7e,null));};exports[_0x4532('0x88')]=function(_0x2b5932,_0x4e0433,_0x35f1b0){return db[_0x4532('0x33')][_0x4532('0x4f')]({'where':{'id':_0x2b5932[_0x4532('0x4c')]['id']}})[_0x4532('0x27')](handleEntityNotFound(_0x4e0433,null))[_0x4532('0x27')](function(_0x4d38e0){if(_0x4d38e0){return _0x4d38e0[_0x4532('0x88')](_0x2b5932['query']['ids'])[_0x4532('0x27')](function(){if(_[_0x4532('0x8d')](_0x2b5932['query'][_0x4532('0x6b')])){for(var _0xdea853=0x0;_0xdea853<_0x2b5932[_0x4532('0x37')][_0x4532('0x6b')][_0x4532('0x3d')];_0xdea853+=0x1){socket[_0x4532('0x75')](_0x4532('0x8a'),{'UserId':Number(_0x2b5932[_0x4532('0x37')][_0x4532('0x6b')][_0xdea853]),'FaxQueueId':Number(_0x2b5932[_0x4532('0x4c')]['id'])});}}else{socket['emit'](_0x4532('0x8a'),{'UserId':Number(_0x2b5932[_0x4532('0x37')][_0x4532('0x6b')]),'FaxQueueId':Number(_0x2b5932[_0x4532('0x4c')]['id'])});}});}})[_0x4532('0x27')](respondWithStatusCode(_0x4e0433,null))[_0x4532('0x4a')](handleError(_0x4e0433,null));};exports[_0x4532('0x8e')]=function(_0x292a82,_0x64f9ea,_0x42db0a){var _0x491f9a={};var _0x1f25da={};var _0x22cae2;var _0x1f314d;return db[_0x4532('0x33')]['findOne']({'where':{'id':_0x292a82[_0x4532('0x4c')]['id']}})['then'](handleEntityNotFound(_0x64f9ea,null))[_0x4532('0x27')](function(_0x37fdf4){if(_0x37fdf4){_0x22cae2=_0x37fdf4;_0x1f25da[_0x4532('0x36')]=_['keys'](db[_0x4532('0x60')][_0x4532('0x34')]);_0x1f25da[_0x4532('0x37')]=_[_0x4532('0x38')](_0x292a82[_0x4532('0x37')]);_0x1f25da[_0x4532('0x39')]=_[_0x4532('0x3a')](_0x1f25da['model'],_0x1f25da['query']);_0x491f9a['attributes']=_[_0x4532('0x3a')](_0x1f25da[_0x4532('0x36')],qs[_0x4532('0x3b')](_0x292a82['query'][_0x4532('0x3b')]));_0x491f9a[_0x4532('0x3c')]=_0x491f9a[_0x4532('0x3c')]['length']?_0x491f9a[_0x4532('0x3c')]:_0x1f25da[_0x4532('0x36')];_0x491f9a[_0x4532('0x40')]=qs[_0x4532('0x41')](_0x292a82[_0x4532('0x37')][_0x4532('0x41')]);_0x491f9a[_0x4532('0x42')]=qs[_0x4532('0x39')](_['pick'](_0x292a82[_0x4532('0x37')],_0x1f25da[_0x4532('0x39')]));if(_0x292a82[_0x4532('0x37')][_0x4532('0x43')]){_0x491f9a[_0x4532('0x42')]=_[_0x4532('0x44')](_0x491f9a[_0x4532('0x42')],{'$or':_[_0x4532('0x32')](_0x491f9a[_0x4532('0x3c')],function(_0x152a14){var _0x87dc1={};_0x87dc1[_0x152a14]={'$like':'%'+_0x292a82[_0x4532('0x37')][_0x4532('0x43')]+'%'};return _0x87dc1;})});}_0x491f9a=_[_0x4532('0x44')]({},_0x491f9a,_0x292a82[_0x4532('0x4e')]);return _0x22cae2[_0x4532('0x8e')](_0x491f9a);}})[_0x4532('0x27')](function(_0x455a06){if(_0x455a06){_0x1f314d=_0x455a06[_0x4532('0x3d')];if(!_0x292a82[_0x4532('0x37')][_0x4532('0x3e')]('nolimit')){_0x491f9a[_0x4532('0x3f')]=qs['limit'](_0x292a82['query'][_0x4532('0x3f')]);_0x491f9a[_0x4532('0x21')]=qs[_0x4532('0x21')](_0x292a82[_0x4532('0x37')][_0x4532('0x21')]);}return _0x22cae2[_0x4532('0x8e')](_0x491f9a);}})[_0x4532('0x27')](function(_0x2d0b6a){if(_0x2d0b6a){return _0x2d0b6a?{'count':_0x1f314d,'rows':_0x2d0b6a}:null;}})['then'](respondWithResult(_0x64f9ea,null))[_0x4532('0x4a')](handleError(_0x64f9ea,null));}; \ No newline at end of file +var _0xcd4d=['then','FaxQueues','UserProfileResource','destroy','name','index','map','FaxQueue','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','user','get','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserFaxQueue','order','User','findAndCountAll','updatedAt','createdAt','%s/%s','SIP','faxPause','getTeams','findOne','Team','addTeams','ids','voicePause','flatMap','transaction','each','emit','Agents','select','field','from','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','removeTeams','isEmpty','removeAgents','forEach','addAgents','omit','isArray','userFaxQueue:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xcd4d,0xe4));var _0xdcd4=function(_0x2f0f3d,_0x5e1c58){_0x2f0f3d=_0x2f0f3d-0x0;var _0x3009ae=_0xcd4d[_0x2f0f3d];return _0x3009ae;};'use strict';var pdf=require(_0xdcd4('0x0'));var emlformat=require(_0xdcd4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdcd4('0x2'));var jsonpatch=require(_0xdcd4('0x3'));var rp=require(_0xdcd4('0x4'));var moment=require(_0xdcd4('0x5'));var BPromise=require(_0xdcd4('0x6'));var Mustache=require(_0xdcd4('0x7'));var util=require(_0xdcd4('0x8'));var path=require(_0xdcd4('0x9'));var sox=require(_0xdcd4('0xa'));var csv=require(_0xdcd4('0xb'));var ejs=require(_0xdcd4('0xc'));var fs=require('fs');var _=require(_0xdcd4('0xd'));var squel=require(_0xdcd4('0xe'));var crypto=require(_0xdcd4('0xf'));var jsforce=require(_0xdcd4('0x10'));var deskjs=require(_0xdcd4('0x11'));var toCsv=require('to-csv');var querystring=require(_0xdcd4('0x12'));var Papa=require(_0xdcd4('0x13'));var Redis=require('ioredis');var authService=require(_0xdcd4('0x14'));var qs=require(_0xdcd4('0x15'));var as=require(_0xdcd4('0x16'));var hardwareService=require(_0xdcd4('0x17'));var logger=require(_0xdcd4('0x18'))('api');var utils=require(_0xdcd4('0x19'));var config=require(_0xdcd4('0x1a'));var db=require(_0xdcd4('0x1b'))['db'];config[_0xdcd4('0x1c')]=_[_0xdcd4('0x1d')](config['redis'],{'host':_0xdcd4('0x1e'),'port':0x18eb});var socket=require(_0xdcd4('0x1f'))(new Redis(config['redis']));require(_0xdcd4('0x20'))[_0xdcd4('0x21')](socket);function respondWithStatusCode(_0x4aa877,_0x49f85e){_0x49f85e=_0x49f85e||0xcc;return function(_0x40f4e6){if(_0x40f4e6){return _0x4aa877[_0xdcd4('0x22')](_0x49f85e);}return _0x4aa877[_0xdcd4('0x23')](_0x49f85e)[_0xdcd4('0x24')]();};}function respondWithResult(_0x280598,_0x3a1d3a){_0x3a1d3a=_0x3a1d3a||0xc8;return function(_0x171dc4){if(_0x171dc4){return _0x280598[_0xdcd4('0x23')](_0x3a1d3a)[_0xdcd4('0x25')](_0x171dc4);}};}function respondWithFilteredResult(_0x4100c1,_0xdb8b41){return function(_0x4a7187){if(_0x4a7187){var _0x579125=_0x4a7187[_0xdcd4('0x26')],_0x33608f=_0xdb8b41[_0xdcd4('0x27')],_0x7682f8=_0xdb8b41[_0xdcd4('0x27')]+_0xdb8b41[_0xdcd4('0x28')],_0x13331d;if(_0x7682f8>=_0x579125){_0x7682f8=_0x579125;_0x13331d=0xc8;}else{_0x13331d=0xce;}_0x4100c1[_0xdcd4('0x23')](_0x13331d);return _0x4100c1[_0xdcd4('0x29')](_0xdcd4('0x2a'),_0x33608f+'-'+_0x7682f8+'/'+_0x579125)[_0xdcd4('0x25')](_0x4a7187);}return null;};}function patchUpdates(_0x2864c9){return function(_0x2a97e4){try{jsonpatch[_0xdcd4('0x2b')](_0x2a97e4,_0x2864c9,!![]);}catch(_0x7eb5c6){return BPromise['reject'](_0x7eb5c6);}return _0x2a97e4[_0xdcd4('0x2c')]();};}function saveUpdates(_0xb4414e,_0x520bb7){return function(_0x2338e9){if(_0x2338e9){return _0x2338e9[_0xdcd4('0x2d')](_0xb4414e)[_0xdcd4('0x2e')](function(_0x4d1e32){return _0x4d1e32;});}return null;};}function removeEntity(_0x46768f,_0x427c92){return function(_0x66052d){if(_0x66052d){return _0x66052d['destroy']()[_0xdcd4('0x2e')](function(){var _0x36208b=_0x66052d['get']({'plain':!![]});var _0x2bb8d0=_0xdcd4('0x2f');return db[_0xdcd4('0x30')][_0xdcd4('0x31')]({'where':{'type':_0x2bb8d0,'resourceId':_0x36208b['id']}})[_0xdcd4('0x2e')](function(){return _0x66052d;});})[_0xdcd4('0x2e')](function(){_0x46768f[_0xdcd4('0x23')](0xcc)[_0xdcd4('0x24')]();});}};}function handleEntityNotFound(_0x48dec1,_0x134c00){return function(_0x54599c){if(!_0x54599c){_0x48dec1[_0xdcd4('0x22')](0x194);}return _0x54599c;};}function handleError(_0x3d29d7,_0x5b9f9d){_0x5b9f9d=_0x5b9f9d||0x1f4;return function(_0x583fef){logger['error'](_0x583fef['stack']);if(_0x583fef[_0xdcd4('0x32')]){delete _0x583fef[_0xdcd4('0x32')];}_0x3d29d7[_0xdcd4('0x23')](_0x5b9f9d)['send'](_0x583fef);};}exports[_0xdcd4('0x33')]=function(_0x1d0937,_0x565e9e){var _0x35d1e3={},_0x2e11d6={},_0x21aaaf={'count':0x0,'rows':[]};var _0x2e8fa0=_[_0xdcd4('0x34')](db[_0xdcd4('0x35')]['rawAttributes'],function(_0x43f28b){return{'name':_0x43f28b['fieldName'],'type':_0x43f28b[_0xdcd4('0x36')][_0xdcd4('0x37')]};});_0x2e11d6[_0xdcd4('0x38')]=_[_0xdcd4('0x34')](_0x2e8fa0,_0xdcd4('0x32'));_0x2e11d6['query']=_['keys'](_0x1d0937[_0xdcd4('0x39')]);_0x2e11d6[_0xdcd4('0x3a')]=_[_0xdcd4('0x3b')](_0x2e11d6['model'],_0x2e11d6[_0xdcd4('0x39')]);_0x35d1e3[_0xdcd4('0x3c')]=_['intersection'](_0x2e11d6['model'],qs[_0xdcd4('0x3d')](_0x1d0937[_0xdcd4('0x39')][_0xdcd4('0x3d')]));_0x35d1e3[_0xdcd4('0x3c')]=_0x35d1e3[_0xdcd4('0x3c')][_0xdcd4('0x3e')]?_0x35d1e3['attributes']:_0x2e11d6[_0xdcd4('0x38')];if(!_0x1d0937['query'][_0xdcd4('0x3f')](_0xdcd4('0x40'))){_0x35d1e3[_0xdcd4('0x28')]=qs['limit'](_0x1d0937[_0xdcd4('0x39')][_0xdcd4('0x28')]);_0x35d1e3[_0xdcd4('0x27')]=qs[_0xdcd4('0x27')](_0x1d0937['query']['offset']);}_0x35d1e3['order']=qs[_0xdcd4('0x41')](_0x1d0937['query'][_0xdcd4('0x41')]);_0x35d1e3[_0xdcd4('0x42')]=qs[_0xdcd4('0x3a')](_[_0xdcd4('0x43')](_0x1d0937[_0xdcd4('0x39')],_0x2e11d6[_0xdcd4('0x3a')]),_0x2e8fa0);if(_0x1d0937[_0xdcd4('0x39')][_0xdcd4('0x44')]){_0x35d1e3['where']=_[_0xdcd4('0x45')](_0x35d1e3['where'],{'$or':_[_0xdcd4('0x34')](_0x2e8fa0,function(_0x933d07){if(_0x933d07[_0xdcd4('0x36')]!=='VIRTUAL'){var _0x767156={};_0x767156[_0x933d07[_0xdcd4('0x32')]]={'$like':'%'+_0x1d0937[_0xdcd4('0x39')][_0xdcd4('0x44')]+'%'};return _0x767156;}})});}_0x35d1e3=_[_0xdcd4('0x45')]({},_0x35d1e3,_0x1d0937[_0xdcd4('0x46')]);var _0x4a041c={'where':_0x35d1e3[_0xdcd4('0x42')]};return db[_0xdcd4('0x35')]['count'](_0x4a041c)[_0xdcd4('0x2e')](function(_0x5cb2b2){_0x21aaaf[_0xdcd4('0x26')]=_0x5cb2b2;if(_0x1d0937[_0xdcd4('0x39')][_0xdcd4('0x47')]){_0x35d1e3[_0xdcd4('0x48')]=[{'all':!![]}];}return db['FaxQueue'][_0xdcd4('0x49')](_0x35d1e3);})[_0xdcd4('0x2e')](function(_0x5c726b){_0x21aaaf[_0xdcd4('0x4a')]=_0x5c726b;return _0x21aaaf;})[_0xdcd4('0x2e')](respondWithFilteredResult(_0x565e9e,_0x35d1e3))[_0xdcd4('0x4b')](handleError(_0x565e9e,null));};exports[_0xdcd4('0x4c')]=function(_0x1e53ec,_0x35a808){var _0x193501={'raw':!![],'where':{'id':_0x1e53ec[_0xdcd4('0x4d')]['id']}},_0x147490={};_0x147490[_0xdcd4('0x38')]=_[_0xdcd4('0x4e')](db['FaxQueue'][_0xdcd4('0x4f')]);_0x147490[_0xdcd4('0x39')]=_[_0xdcd4('0x4e')](_0x1e53ec[_0xdcd4('0x39')]);_0x147490[_0xdcd4('0x3a')]=_[_0xdcd4('0x3b')](_0x147490[_0xdcd4('0x38')],_0x147490['query']);_0x193501['attributes']=_[_0xdcd4('0x3b')](_0x147490['model'],qs['fields'](_0x1e53ec['query']['fields']));_0x193501[_0xdcd4('0x3c')]=_0x193501[_0xdcd4('0x3c')]['length']?_0x193501[_0xdcd4('0x3c')]:_0x147490[_0xdcd4('0x38')];if(_0x1e53ec[_0xdcd4('0x39')]['includeAll']){_0x193501[_0xdcd4('0x48')]=[{'all':!![]}];}_0x193501=_[_0xdcd4('0x45')]({},_0x193501,_0x1e53ec[_0xdcd4('0x46')]);return db[_0xdcd4('0x35')][_0xdcd4('0x50')](_0x193501)[_0xdcd4('0x2e')](handleEntityNotFound(_0x35a808,null))[_0xdcd4('0x2e')](respondWithResult(_0x35a808,null))[_0xdcd4('0x4b')](handleError(_0x35a808,null));};exports[_0xdcd4('0x51')]=function(_0xa91417,_0x59aaf9){return db[_0xdcd4('0x35')][_0xdcd4('0x51')](_0xa91417[_0xdcd4('0x52')],{})[_0xdcd4('0x2e')](function(_0x535de8){var _0x4f4522=_0xa91417[_0xdcd4('0x53')][_0xdcd4('0x54')]({'plain':!![]});if(!_0x4f4522)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f4522['role']===_0xdcd4('0x53')){var _0xb325d1=_0x535de8['get']({'plain':!![]});var _0x25154b=_0xdcd4('0x2f');return db[_0xdcd4('0x55')][_0xdcd4('0x50')]({'where':{'name':_0x25154b,'userProfileId':_0x4f4522['userProfileId']},'raw':!![]})[_0xdcd4('0x2e')](function(_0x175bca){if(_0x175bca&&_0x175bca['autoAssociation']===0x0){return db[_0xdcd4('0x30')][_0xdcd4('0x51')]({'name':_0xb325d1[_0xdcd4('0x32')],'resourceId':_0xb325d1['id'],'type':_0x175bca[_0xdcd4('0x32')],'sectionId':_0x175bca['id']},{})['then'](function(){return _0x535de8;});}else{return _0x535de8;}})['catch'](function(_0xaa22a0){logger[_0xdcd4('0x56')](_0xdcd4('0x57'),_0xaa22a0);throw _0xaa22a0;});}return _0x535de8;})[_0xdcd4('0x2e')](respondWithResult(_0x59aaf9,0xc9))[_0xdcd4('0x4b')](handleError(_0x59aaf9,null));};exports['update']=function(_0xa1e423,_0x4a8f5b){if(_0xa1e423[_0xdcd4('0x52')]['id']){delete _0xa1e423[_0xdcd4('0x52')]['id'];}return db[_0xdcd4('0x35')][_0xdcd4('0x50')]({'where':{'id':_0xa1e423[_0xdcd4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4a8f5b,null))['then'](saveUpdates(_0xa1e423['body'],null))[_0xdcd4('0x2e')](respondWithResult(_0x4a8f5b,null))[_0xdcd4('0x4b')](handleError(_0x4a8f5b,null));};exports[_0xdcd4('0x31')]=function(_0xcea129,_0x39d0a6){return db[_0xdcd4('0x35')]['find']({'where':{'id':_0xcea129[_0xdcd4('0x4d')]['id']}})[_0xdcd4('0x2e')](handleEntityNotFound(_0x39d0a6,null))[_0xdcd4('0x2e')](removeEntity(_0x39d0a6,null))[_0xdcd4('0x4b')](handleError(_0x39d0a6,null));};exports[_0xdcd4('0x58')]=function(_0xdbfbdc,_0x3afb1b){return db[_0xdcd4('0x35')][_0xdcd4('0x58')]()[_0xdcd4('0x2e')](respondWithResult(_0x3afb1b,null))[_0xdcd4('0x4b')](handleError(_0x3afb1b,null));};exports[_0xdcd4('0x59')]=function(_0x40ad2a,_0x509c76,_0x2a3494){var _0x397afc={'raw':!![],'where':{}},_0x5ccd92={},_0x391f08;return db[_0xdcd4('0x35')]['findOne']({'where':{'id':_0x40ad2a[_0xdcd4('0x4d')]['id']}})[_0xdcd4('0x2e')](handleEntityNotFound(_0x509c76,null))[_0xdcd4('0x2e')](function(_0x2bfb4e){if(_0x2bfb4e){_0x391f08=_0x2bfb4e[_0xdcd4('0x54')]({'plain':!![]});_0x5ccd92[_0xdcd4('0x38')]=_['keys'](db[_0xdcd4('0x5a')]['rawAttributes']);_0x5ccd92[_0xdcd4('0x39')]=_[_0xdcd4('0x4e')](_0x40ad2a[_0xdcd4('0x39')]);_0x5ccd92['filters']=_[_0xdcd4('0x3b')](_0x5ccd92['model'],_0x5ccd92['query']);_0x397afc[_0xdcd4('0x3c')]=_['intersection'](_0x5ccd92['model'],qs[_0xdcd4('0x3d')](_0x40ad2a[_0xdcd4('0x39')][_0xdcd4('0x3d')]));_0x397afc[_0xdcd4('0x3c')]=_0x397afc[_0xdcd4('0x3c')][_0xdcd4('0x3e')]?_0x397afc[_0xdcd4('0x3c')]:_0x5ccd92[_0xdcd4('0x38')];if(!_0x40ad2a[_0xdcd4('0x39')][_0xdcd4('0x3f')](_0xdcd4('0x40'))){_0x397afc['limit']=qs['limit'](_0x40ad2a[_0xdcd4('0x39')][_0xdcd4('0x28')]);_0x397afc[_0xdcd4('0x27')]=qs[_0xdcd4('0x27')](_0x40ad2a[_0xdcd4('0x39')]['offset']);}_0x397afc[_0xdcd4('0x5b')]=qs[_0xdcd4('0x41')](_0x40ad2a[_0xdcd4('0x39')]['sort']);_0x397afc[_0xdcd4('0x42')]=qs['filters'](_[_0xdcd4('0x43')](_0x40ad2a[_0xdcd4('0x39')],_0x5ccd92[_0xdcd4('0x3a')]));_0x397afc[_0xdcd4('0x42')]['FaxQueueId']=_0x2bfb4e['id'];if(_0x40ad2a[_0xdcd4('0x39')][_0xdcd4('0x44')]){_0x397afc[_0xdcd4('0x42')]=_['merge'](_0x397afc['where'],{'$or':_[_0xdcd4('0x34')](_0x397afc[_0xdcd4('0x3c')],function(_0x3643ab){var _0x3404e9={};_0x3404e9[_0x3643ab]={'$like':'%'+_0x40ad2a['query'][_0xdcd4('0x44')]+'%'};return _0x3404e9;})});}_0x397afc=_[_0xdcd4('0x45')]({},_0x397afc,_0x40ad2a[_0xdcd4('0x46')]);return db[_0xdcd4('0x5a')][_0xdcd4('0x49')](_0x397afc);}})[_0xdcd4('0x2e')](function(_0x107b2f){if(_0x107b2f){return db[_0xdcd4('0x5c')][_0xdcd4('0x5d')]({'where':{'id':_['map'](_0x107b2f,'UserId'),'role':'agent'},'attributes':['id',_0xdcd4('0x32'),'faxPause',_0xdcd4('0x5e'),_0xdcd4('0x5f')]});}})[_0xdcd4('0x2e')](function(_0xec0217){if(_0xec0217){return{'count':_0xec0217[_0xdcd4('0x26')],'rows':_['map'](_0xec0217[_0xdcd4('0x4a')],function(_0x25a6e4){return{'membername':_0x25a6e4['name'],'UserId':_0x25a6e4['id'],'queue_name':_0x391f08[_0xdcd4('0x32')],'FaxQueueId':_0x391f08['id'],'interface':util['format'](_0xdcd4('0x60'),_0xdcd4('0x61'),_0x25a6e4['name']),'penalty':0x0,'paused':_0x25a6e4[_0xdcd4('0x62')],'createdAt':_0x25a6e4[_0xdcd4('0x5f')],'updatedAt':_0x25a6e4[_0xdcd4('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x509c76,_0x397afc))['catch'](handleError(_0x509c76,null));};exports[_0xdcd4('0x63')]=function(_0x21b568,_0x53cd4f,_0x2f4895){var _0x4905d1={};var _0x46acd6={};var _0x3f94f2;var _0x4de53a;return db['FaxQueue'][_0xdcd4('0x64')]({'where':{'id':_0x21b568[_0xdcd4('0x4d')]['id']}})[_0xdcd4('0x2e')](handleEntityNotFound(_0x53cd4f,null))[_0xdcd4('0x2e')](function(_0x2427fe){if(_0x2427fe){_0x3f94f2=_0x2427fe;_0x46acd6[_0xdcd4('0x38')]=_[_0xdcd4('0x4e')](db[_0xdcd4('0x65')]['rawAttributes']);_0x46acd6[_0xdcd4('0x39')]=_[_0xdcd4('0x4e')](_0x21b568['query']);_0x46acd6['filters']=_['intersection'](_0x46acd6['model'],_0x46acd6[_0xdcd4('0x39')]);_0x4905d1[_0xdcd4('0x3c')]=_['intersection'](_0x46acd6['model'],qs[_0xdcd4('0x3d')](_0x21b568[_0xdcd4('0x39')][_0xdcd4('0x3d')]));_0x4905d1[_0xdcd4('0x3c')]=_0x4905d1[_0xdcd4('0x3c')]['length']?_0x4905d1['attributes']:_0x46acd6[_0xdcd4('0x38')];_0x4905d1[_0xdcd4('0x5b')]=qs[_0xdcd4('0x41')](_0x21b568[_0xdcd4('0x39')][_0xdcd4('0x41')]);_0x4905d1[_0xdcd4('0x42')]=qs[_0xdcd4('0x3a')](_[_0xdcd4('0x43')](_0x21b568[_0xdcd4('0x39')],_0x46acd6[_0xdcd4('0x3a')]));if(_0x21b568['query'][_0xdcd4('0x44')]){_0x4905d1[_0xdcd4('0x42')]=_['merge'](_0x4905d1['where'],{'$or':_[_0xdcd4('0x34')](_0x4905d1[_0xdcd4('0x3c')],function(_0x12d103){var _0x41b50e={};_0x41b50e[_0x12d103]={'$like':'%'+_0x21b568['query'][_0xdcd4('0x44')]+'%'};return _0x41b50e;})});}_0x4905d1=_['merge']({},_0x4905d1,_0x21b568[_0xdcd4('0x46')]);return _0x3f94f2[_0xdcd4('0x63')](_0x4905d1);}})[_0xdcd4('0x2e')](function(_0x3dbc8c){if(_0x3dbc8c){_0x4de53a=_0x3dbc8c['length'];if(!_0x21b568[_0xdcd4('0x39')]['hasOwnProperty'](_0xdcd4('0x40'))){_0x4905d1[_0xdcd4('0x28')]=qs[_0xdcd4('0x28')](_0x21b568['query']['limit']);_0x4905d1[_0xdcd4('0x27')]=qs[_0xdcd4('0x27')](_0x21b568[_0xdcd4('0x39')]['offset']);}return _0x3f94f2[_0xdcd4('0x63')](_0x4905d1);}})[_0xdcd4('0x2e')](function(_0x590d19){if(_0x590d19){return _0x590d19?{'count':_0x4de53a,'rows':_0x590d19}:null;}})[_0xdcd4('0x2e')](respondWithResult(_0x53cd4f,null))[_0xdcd4('0x4b')](handleError(_0x53cd4f,null));};exports[_0xdcd4('0x66')]=function(_0x109258,_0x231163,_0x205570){var _0x4e3dc6=_0x109258[_0xdcd4('0x52')][_0xdcd4('0x67')];return db[_0xdcd4('0x65')][_0xdcd4('0x49')]({'where':{'id':_0x4e3dc6},'attributes':['id'],'include':[{'model':db[_0xdcd4('0x5c')],'as':'Agents','attributes':['id',_0xdcd4('0x32'),'online',_0xdcd4('0x68'),'interface'],'raw':!![]}]})[_0xdcd4('0x2e')](function(_0x25484e){if(_0x25484e){var _0x23dfd6=_[_0xdcd4('0x69')](_0x25484e,function(_0x40cfcf){var _0x4fd000=_0x40cfcf[_0xdcd4('0x54')]({'plain':!![]});return _0x4fd000['Agents'];});return db[_0xdcd4('0x35')][_0xdcd4('0x50')]({'where':{'id':_0x109258[_0xdcd4('0x4d')]['id']}})[_0xdcd4('0x2e')](function(_0x1dc131){return db['sequelize'][_0xdcd4('0x6a')](function(_0x176dae){return _0x1dc131[_0xdcd4('0x66')](_0x4e3dc6,{'transaction':_0x176dae})['then'](function(){return BPromise[_0xdcd4('0x6b')](_0x23dfd6,function(_0x35c346){return db['UserFaxQueue']['findOrCreate']({'where':{'UserId':_0x35c346['id'],'FaxQueueId':_0x109258['params']['id']},'transaction':_0x176dae});});})[_0xdcd4('0x2e')](function(){_0x23dfd6['forEach'](function(_0x5dc68d){socket[_0xdcd4('0x6c')]('userFaxQueue:save',{'UserId':_0x5dc68d['id'],'FaxQueueId':_0x1dc131['id']});});});});});}})[_0xdcd4('0x2e')](respondWithStatusCode(_0x231163,null))['catch'](handleError(_0x231163,null));};exports['removeTeams']=function(_0x15fc2c,_0x363ac3,_0x3b9e83){return db['Team']['findAll']({'where':{'id':_0x15fc2c[_0xdcd4('0x39')][_0xdcd4('0x67')]},'attributes':['id'],'include':[{'model':db[_0xdcd4('0x5c')],'as':_0xdcd4('0x6d'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x363ac3,null))[_0xdcd4('0x2e')](function(_0x4ddc72){var _0xd40cb7=_['map'](_0x4ddc72,'id');var _0x178bff=[];var _0x256c6a=[];var _0x3060cf=squel[_0xdcd4('0x6e')]();_0x3060cf[_0xdcd4('0x6f')]('tq.TeamId')[_0xdcd4('0x70')]('team_has_fax_queues','tq')[_0xdcd4('0x71')]('user_has_teams','ut',_0xdcd4('0x72'))[_0xdcd4('0x42')]('FaxQueueId\x20=\x20?',_0x15fc2c[_0xdcd4('0x4d')]['id']);for(var _0x34b90b=0x0;_0x34b90b<_0x4ddc72['length'];_0x34b90b+=0x1){let _0x143cdc=_0x4ddc72[_0x34b90b];for(var _0x2d0f2a=0x0;_0x2d0f2a<_0x143cdc[_0xdcd4('0x6d')]['length'];_0x2d0f2a+=0x1){let _0x3da8ec=_0x143cdc['Agents'][_0x2d0f2a];var _0x4776ff=_0x3060cf[_0xdcd4('0x73')]();_0x4776ff['where'](_0xdcd4('0x74'),_0x3da8ec['id']);_0x256c6a[_0xdcd4('0x75')](db[_0xdcd4('0x76')][_0xdcd4('0x39')](_0x4776ff[_0xdcd4('0x77')](),{'type':db[_0xdcd4('0x76')][_0xdcd4('0x78')][_0xdcd4('0x79')]})[_0xdcd4('0x2e')](function(_0x26f3c9){if(_0x26f3c9[_0xdcd4('0x3e')]===0x1){return _0x3da8ec['id'];}else{var _0x2efcc8=_[_0xdcd4('0x7a')](_['map'](_0x26f3c9,_0xdcd4('0x7b')),function(_0x5f5474){return _[_0xdcd4('0x7c')](_0xd40cb7,_0x5f5474);});if(_0x2efcc8){return _0x3da8ec['id'];}}}));}}return BPromise[_0xdcd4('0x7d')](_0x256c6a)[_0xdcd4('0x2e')](function(_0x284e07){_0x178bff=_(_0x178bff)['union'](_0x284e07)[_0xdcd4('0x7e')]()[_0xdcd4('0x7f')]();return db[_0xdcd4('0x35')][_0xdcd4('0x50')]({'where':{'id':_0x15fc2c[_0xdcd4('0x4d')]['id']}})[_0xdcd4('0x2e')](function(_0x3d36e1){return db[_0xdcd4('0x76')][_0xdcd4('0x6a')](function(_0x5a1e0e){return _0x3d36e1[_0xdcd4('0x80')](_0x15fc2c[_0xdcd4('0x39')][_0xdcd4('0x67')],{'transaction':_0x5a1e0e})[_0xdcd4('0x2e')](function(){if(!_[_0xdcd4('0x81')](_0x178bff)){return _0x3d36e1[_0xdcd4('0x82')](_0x178bff,{'transaction':_0x5a1e0e});}})['then'](function(){_0x178bff[_0xdcd4('0x83')](function(_0x157ee6){socket['emit']('userFaxQueue:remove',{'UserId':_0x157ee6,'FaxQueueId':_0x3d36e1['id']});});});});});});})['then'](respondWithStatusCode(_0x363ac3,null))['catch'](handleError(_0x363ac3,null));};exports[_0xdcd4('0x84')]=function(_0xe97b11,_0x5506c4,_0x19a2f5){return db['FaxQueue'][_0xdcd4('0x50')]({'where':{'id':_0xe97b11[_0xdcd4('0x4d')]['id']}})[_0xdcd4('0x2e')](handleEntityNotFound(_0x5506c4,null))[_0xdcd4('0x2e')](function(_0x405970){if(_0x405970){return _0x405970[_0xdcd4('0x84')](_0xe97b11[_0xdcd4('0x52')][_0xdcd4('0x67')],_[_0xdcd4('0x85')](_0xe97b11[_0xdcd4('0x52')],[_0xdcd4('0x67'),'id'])||{})['spread'](function(_0x230d1d){for(var _0x3be0f5=0x0;_0x3be0f5<_0xe97b11[_0xdcd4('0x52')][_0xdcd4('0x67')][_0xdcd4('0x3e')];_0x3be0f5+=0x1){socket[_0xdcd4('0x6c')]('userFaxQueue:save',{'UserId':_0xe97b11[_0xdcd4('0x52')][_0xdcd4('0x67')][_0x3be0f5],'FaxQueueId':_0xe97b11[_0xdcd4('0x4d')]['id']});}return _0x230d1d;});}})[_0xdcd4('0x2e')](respondWithResult(_0x5506c4,null))['catch'](handleError(_0x5506c4,null));};exports[_0xdcd4('0x82')]=function(_0x50fc66,_0x5f2f08,_0x5e3642){return db[_0xdcd4('0x35')][_0xdcd4('0x50')]({'where':{'id':_0x50fc66[_0xdcd4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5f2f08,null))['then'](function(_0x13c57d){if(_0x13c57d){return _0x13c57d['removeAgents'](_0x50fc66[_0xdcd4('0x39')][_0xdcd4('0x67')])[_0xdcd4('0x2e')](function(){if(_[_0xdcd4('0x86')](_0x50fc66[_0xdcd4('0x39')][_0xdcd4('0x67')])){for(var _0x4e5d70=0x0;_0x4e5d70<_0x50fc66['query'][_0xdcd4('0x67')][_0xdcd4('0x3e')];_0x4e5d70+=0x1){socket[_0xdcd4('0x6c')](_0xdcd4('0x87'),{'UserId':Number(_0x50fc66[_0xdcd4('0x39')]['ids'][_0x4e5d70]),'FaxQueueId':Number(_0x50fc66[_0xdcd4('0x4d')]['id'])});}}else{socket[_0xdcd4('0x6c')](_0xdcd4('0x87'),{'UserId':Number(_0x50fc66[_0xdcd4('0x39')]['ids']),'FaxQueueId':Number(_0x50fc66[_0xdcd4('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x5f2f08,null))[_0xdcd4('0x4b')](handleError(_0x5f2f08,null));};exports['getAgents']=function(_0x6fdad8,_0x355900,_0x242e24){var _0x29e7e7={};var _0x447ca0={};var _0x202b39;var _0x50a3b0;return db[_0xdcd4('0x35')][_0xdcd4('0x64')]({'where':{'id':_0x6fdad8[_0xdcd4('0x4d')]['id']}})[_0xdcd4('0x2e')](handleEntityNotFound(_0x355900,null))[_0xdcd4('0x2e')](function(_0x5add26){if(_0x5add26){_0x202b39=_0x5add26;_0x447ca0[_0xdcd4('0x38')]=_['keys'](db['User']['rawAttributes']);_0x447ca0[_0xdcd4('0x39')]=_['keys'](_0x6fdad8['query']);_0x447ca0[_0xdcd4('0x3a')]=_['intersection'](_0x447ca0[_0xdcd4('0x38')],_0x447ca0['query']);_0x29e7e7[_0xdcd4('0x3c')]=_['intersection'](_0x447ca0[_0xdcd4('0x38')],qs[_0xdcd4('0x3d')](_0x6fdad8['query']['fields']));_0x29e7e7[_0xdcd4('0x3c')]=_0x29e7e7[_0xdcd4('0x3c')]['length']?_0x29e7e7[_0xdcd4('0x3c')]:_0x447ca0[_0xdcd4('0x38')];_0x29e7e7[_0xdcd4('0x5b')]=qs[_0xdcd4('0x41')](_0x6fdad8[_0xdcd4('0x39')][_0xdcd4('0x41')]);_0x29e7e7[_0xdcd4('0x42')]=qs[_0xdcd4('0x3a')](_[_0xdcd4('0x43')](_0x6fdad8[_0xdcd4('0x39')],_0x447ca0[_0xdcd4('0x3a')]));if(_0x6fdad8[_0xdcd4('0x39')][_0xdcd4('0x44')]){_0x29e7e7[_0xdcd4('0x42')]=_[_0xdcd4('0x45')](_0x29e7e7['where'],{'$or':_['map'](_0x29e7e7[_0xdcd4('0x3c')],function(_0x57929d){var _0x371e91={};_0x371e91[_0x57929d]={'$like':'%'+_0x6fdad8[_0xdcd4('0x39')][_0xdcd4('0x44')]+'%'};return _0x371e91;})});}_0x29e7e7=_[_0xdcd4('0x45')]({},_0x29e7e7,_0x6fdad8['options']);return _0x202b39[_0xdcd4('0x88')](_0x29e7e7);}})['then'](function(_0xd6b5ab){if(_0xd6b5ab){_0x50a3b0=_0xd6b5ab['length'];if(!_0x6fdad8[_0xdcd4('0x39')][_0xdcd4('0x3f')]('nolimit')){_0x29e7e7[_0xdcd4('0x28')]=qs[_0xdcd4('0x28')](_0x6fdad8['query'][_0xdcd4('0x28')]);_0x29e7e7['offset']=qs[_0xdcd4('0x27')](_0x6fdad8[_0xdcd4('0x39')][_0xdcd4('0x27')]);}return _0x202b39[_0xdcd4('0x88')](_0x29e7e7);}})[_0xdcd4('0x2e')](function(_0x46e757){if(_0x46e757){return _0x46e757?{'count':_0x50a3b0,'rows':_0x46e757}:null;}})[_0xdcd4('0x2e')](respondWithResult(_0x355900,null))[_0xdcd4('0x4b')](handleError(_0x355900,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 82d3bb1..9c1c172 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 _0xfce9=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x2e740d,_0x531abe){var _0x2295e4=function(_0x57a5ad){while(--_0x57a5ad){_0x2e740d['push'](_0x2e740d['shift']());}};_0x2295e4(++_0x531abe);}(_0xfce9,0x1b2));var _0x9fce=function(_0x25267a,_0xce50b){_0x25267a=_0x25267a-0x0;var _0x12e9d7=_0xfce9[_0x25267a];return _0x12e9d7;};'use strict';var EventEmitter=require(_0x9fce('0x0'));var FaxQueue=require(_0x9fce('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x9fce('0x2')](0x0);var events={'afterCreate':_0x9fce('0x3'),'afterUpdate':_0x9fce('0x4'),'afterDestroy':_0x9fce('0x5')};function emitEvent(_0x16ba00){return function(_0xe52de7,_0x1abeed,_0x5e9a88){FaxQueueEvents['emit'](_0x16ba00+':'+_0xe52de7['id'],_0xe52de7);FaxQueueEvents[_0x9fce('0x6')](_0x16ba00,_0xe52de7);_0x5e9a88(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x9fce('0x7')](e,emitEvent(event));}}module[_0x9fce('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x362e=['emit','hook','exports','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x362e,0x135));var _0xe362=function(_0x96f74c,_0xfc30a4){_0x96f74c=_0x96f74c-0x0;var _0x379222=_0x362e[_0x96f74c];return _0x379222;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xe362('0x0'))['db'][_0xe362('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xe362('0x2')](0x0);var events={'afterCreate':_0xe362('0x3'),'afterUpdate':_0xe362('0x4'),'afterDestroy':_0xe362('0x5')};function emitEvent(_0x5755f4){return function(_0x280dfa,_0x4ed3a9,_0x3d8356){FaxQueueEvents[_0xe362('0x6')](_0x5755f4+':'+_0x280dfa['id'],_0x280dfa);FaxQueueEvents[_0xe362('0x6')](_0x5755f4,_0x280dfa);_0x3d8356(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xe362('0x7')](e,emitEvent(event));}}module[_0xe362('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 3bcccca..24f7936 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 _0x1f82=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxQueue.attributes','define','FaxQueue','fax_queues','lodash','util','../../config/logger'];(function(_0x36436d,_0x20292c){var _0x34615d=function(_0x5447af){while(--_0x5447af){_0x36436d['push'](_0x36436d['shift']());}};_0x34615d(++_0x20292c);}(_0x1f82,0xc0));var _0x21f8=function(_0x5ec61d,_0x36c73c){_0x5ec61d=_0x5ec61d-0x0;var _0x2e0e5c=_0x1f82[_0x5ec61d];return _0x2e0e5c;};'use strict';var _=require(_0x21f8('0x0'));var util=require(_0x21f8('0x1'));var logger=require(_0x21f8('0x2'))(_0x21f8('0x3'));var moment=require(_0x21f8('0x4'));var BPromise=require(_0x21f8('0x5'));var rp=require(_0x21f8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x21f8('0x7'));var config=require(_0x21f8('0x8'));var attributes=require(_0x21f8('0x9'));module['exports']=function(_0x1c7c16,_0x5e64ea){return _0x1c7c16[_0x21f8('0xa')](_0x21f8('0xb'),attributes,{'tableName':_0x21f8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c82=['define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueue.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c82,0xc7));var _0x22c8=function(_0x20a822,_0x5dc295){_0x20a822=_0x20a822-0x0;var _0x3775d1=_0x2c82[_0x20a822];return _0x3775d1;};'use strict';var _=require(_0x22c8('0x0'));var util=require(_0x22c8('0x1'));var logger=require(_0x22c8('0x2'))(_0x22c8('0x3'));var moment=require(_0x22c8('0x4'));var BPromise=require(_0x22c8('0x5'));var rp=require(_0x22c8('0x6'));var fs=require('fs');var path=require(_0x22c8('0x7'));var rimraf=require('rimraf');var config=require(_0x22c8('0x8'));var attributes=require(_0x22c8('0x9'));module['exports']=function(_0x220db8,_0x1f495b){return _0x220db8[_0x22c8('0xa')]('FaxQueue',attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 01c7746..901e344 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 _0xd70c=['FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit','include','map','model','debug','ShowFaxQueue','find','then','util','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','FaxQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd70c,0xc5));var _0xcd70=function(_0x51ae36,_0x2738d8){_0x51ae36=_0x51ae36-0x0;var _0x14fa26=_0xd70c[_0x51ae36];return _0x14fa26;};'use strict';var _=require('lodash');var util=require(_0xcd70('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcd70('0x1'));var config=require(_0xcd70('0x2'));var jayson=require('jayson/promise');var client=jayson[_0xcd70('0x3')][_0xcd70('0x4')]({'port':0x232a});config['redis']=_['defaults'](config[_0xcd70('0x5')],{'host':_0xcd70('0x6'),'port':0x18eb});var socket=require(_0xcd70('0x7'))(new Redis(config['redis']));require(_0xcd70('0x8'))[_0xcd70('0x9')](socket);function respondWithRpcPromise(_0x5a3687,_0x51b7a4,_0x4582d2){return new BPromise(function(_0x52d4d0,_0x1d2be9){return client[_0xcd70('0xa')](_0x5a3687,_0x4582d2)['then'](function(_0x17d8dd){logger['info'](_0xcd70('0xb'),_0x51b7a4,_0xcd70('0xc'));logger['debug'](_0xcd70('0xd'),_0x51b7a4,_0xcd70('0xc'),JSON[_0xcd70('0xe')](_0x17d8dd));if(_0x17d8dd[_0xcd70('0xf')]){if(_0x17d8dd[_0xcd70('0xf')][_0xcd70('0x10')]===0x1f4){logger['error'](_0xcd70('0xb'),_0x51b7a4,_0x17d8dd[_0xcd70('0xf')][_0xcd70('0x11')]);return _0x1d2be9(_0x17d8dd[_0xcd70('0xf')][_0xcd70('0x11')]);}logger[_0xcd70('0xf')](_0xcd70('0xb'),_0x51b7a4,_0x17d8dd['error'][_0xcd70('0x11')]);return _0x52d4d0(_0x17d8dd[_0xcd70('0xf')][_0xcd70('0x11')]);}else{logger[_0xcd70('0x12')](_0xcd70('0xb'),_0x51b7a4,_0xcd70('0xc'));_0x52d4d0(_0x17d8dd[_0xcd70('0x13')][_0xcd70('0x11')]);}})[_0xcd70('0x14')](function(_0x23708d){logger['error'](_0xcd70('0xb'),_0x51b7a4,_0x23708d);_0x1d2be9(_0x23708d);});});}exports[_0xcd70('0x15')]=function(_0x133038){var _0x431731=this;return new Promise(function(_0x15422b,_0x58861a){return db[_0xcd70('0x16')]['findAll']({'raw':_0x133038[_0xcd70('0x17')]?_0x133038[_0xcd70('0x17')][_0xcd70('0x18')]===undefined?!![]:![]:!![],'where':_0x133038[_0xcd70('0x17')]?_0x133038[_0xcd70('0x17')][_0xcd70('0x19')]||null:null,'attributes':_0x133038['options']?_0x133038[_0xcd70('0x17')][_0xcd70('0x1a')]||null:null,'limit':_0x133038[_0xcd70('0x17')]?_0x133038['options'][_0xcd70('0x1b')]||null:null,'include':_0x133038[_0xcd70('0x17')]?_0x133038[_0xcd70('0x17')][_0xcd70('0x1c')]?_[_0xcd70('0x1d')](_0x133038[_0xcd70('0x17')][_0xcd70('0x1c')],function(_0x5054ef){return{'model':db[_0x5054ef[_0xcd70('0x1e')]],'as':_0x5054ef['as'],'attributes':_0x5054ef[_0xcd70('0x1a')],'include':_0x5054ef[_0xcd70('0x1c')]?_[_0xcd70('0x1d')](_0x5054ef[_0xcd70('0x1c')],function(_0x2a67d9){return{'model':db[_0x2a67d9[_0xcd70('0x1e')]],'as':_0x2a67d9['as'],'attributes':_0x2a67d9[_0xcd70('0x1a')],'include':_0x2a67d9[_0xcd70('0x1c')]?_[_0xcd70('0x1d')](_0x2a67d9['include'],function(_0x179bb3){return{'model':db[_0x179bb3[_0xcd70('0x1e')]],'as':_0x179bb3['as'],'attributes':_0x179bb3[_0xcd70('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf347b2){logger['info'](_0xcd70('0x15'),_0x133038);logger[_0xcd70('0x1f')](_0xcd70('0x15'),_0x133038,JSON[_0xcd70('0xe')](_0xf347b2));_0x15422b(_0xf347b2);})[_0xcd70('0x14')](function(_0x40f4a9){logger['error']('GetFaxQueue',_0x40f4a9[_0xcd70('0x11')],_0x133038);_0x58861a(_0x431731[_0xcd70('0xf')](0x1f4,_0x40f4a9['message']));});});};exports[_0xcd70('0x20')]=function(_0x4d9b71){var _0x5f265b=this;return new Promise(function(_0x4ed8e4,_0x49e8c4){return db[_0xcd70('0x16')][_0xcd70('0x21')]({'raw':_0x4d9b71[_0xcd70('0x17')]?_0x4d9b71['options'][_0xcd70('0x18')]===undefined?!![]:![]:!![],'where':_0x4d9b71['options']?_0x4d9b71[_0xcd70('0x17')]['where']||null:null,'attributes':_0x4d9b71['options']?_0x4d9b71['options'][_0xcd70('0x1a')]||null:null,'include':_0x4d9b71[_0xcd70('0x17')]?_0x4d9b71['options'][_0xcd70('0x1c')]?_[_0xcd70('0x1d')](_0x4d9b71['options']['include'],function(_0x3349a4){return{'model':db[_0x3349a4[_0xcd70('0x1e')]],'as':_0x3349a4['as'],'attributes':_0x3349a4['attributes'],'include':_0x3349a4[_0xcd70('0x1c')]?_[_0xcd70('0x1d')](_0x3349a4[_0xcd70('0x1c')],function(_0x238e0b){return{'model':db[_0x238e0b[_0xcd70('0x1e')]],'as':_0x238e0b['as'],'attributes':_0x238e0b[_0xcd70('0x1a')],'include':_0x238e0b['include']?_[_0xcd70('0x1d')](_0x238e0b[_0xcd70('0x1c')],function(_0x1b40d3){return{'model':db[_0x1b40d3[_0xcd70('0x1e')]],'as':_0x1b40d3['as'],'attributes':_0x1b40d3['attributes']};}):[]};}):[]};}):[]:[]})[_0xcd70('0x22')](function(_0x31da2c){logger[_0xcd70('0x12')](_0xcd70('0x20'),_0x4d9b71);logger[_0xcd70('0x1f')](_0xcd70('0x20'),_0x4d9b71,JSON['stringify'](_0x31da2c));_0x4ed8e4(_0x31da2c);})[_0xcd70('0x14')](function(_0x549193){logger[_0xcd70('0xf')](_0xcd70('0x20'),_0x549193['message'],_0x4d9b71);_0x49e8c4(_0x5f265b[_0xcd70('0xf')](0x1f4,_0x549193['message']));});});}; \ No newline at end of file +var _0x29bf=['debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','FaxQueue','findAll','options','raw','attributes','limit','include','map','model','GetFaxQueue','stringify','catch','ShowFaxQueue','find','where','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./faxQueue.socket','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x51c02e,_0x224bd5){var _0x61a529=function(_0x56c21f){while(--_0x56c21f){_0x51c02e['push'](_0x51c02e['shift']());}};_0x61a529(++_0x224bd5);}(_0x29bf,0x1ce));var _0xf29b=function(_0x14d157,_0x49433c){_0x14d157=_0x14d157-0x0;var _0x5d3849=_0x29bf[_0x14d157];return _0x5d3849;};'use strict';var _=require(_0xf29b('0x0'));var util=require('util');var moment=require(_0xf29b('0x1'));var BPromise=require(_0xf29b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf29b('0x3'));var db=require(_0xf29b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf29b('0x5'))(_0xf29b('0x6'));var config=require(_0xf29b('0x7'));var jayson=require(_0xf29b('0x8'));var client=jayson[_0xf29b('0x9')]['http']({'port':0x232a});config[_0xf29b('0xa')]=_['defaults'](config[_0xf29b('0xa')],{'host':_0xf29b('0xb'),'port':0x18eb});var socket=require(_0xf29b('0xc'))(new Redis(config[_0xf29b('0xa')]));require(_0xf29b('0xd'))['register'](socket);function respondWithRpcPromise(_0x5d7963,_0x3af102,_0x43a785){return new BPromise(function(_0x253051,_0x1bcff2){return client[_0xf29b('0xe')](_0x5d7963,_0x43a785)[_0xf29b('0xf')](function(_0x32c39d){logger['info'](_0xf29b('0x10'),_0x3af102,_0xf29b('0x11'));logger[_0xf29b('0x12')](_0xf29b('0x13'),_0x3af102,_0xf29b('0x11'),JSON['stringify'](_0x32c39d));if(_0x32c39d[_0xf29b('0x14')]){if(_0x32c39d[_0xf29b('0x14')][_0xf29b('0x15')]===0x1f4){logger[_0xf29b('0x14')](_0xf29b('0x10'),_0x3af102,_0x32c39d[_0xf29b('0x14')][_0xf29b('0x16')]);return _0x1bcff2(_0x32c39d[_0xf29b('0x14')][_0xf29b('0x16')]);}logger[_0xf29b('0x14')](_0xf29b('0x10'),_0x3af102,_0x32c39d[_0xf29b('0x14')][_0xf29b('0x16')]);return _0x253051(_0x32c39d[_0xf29b('0x14')][_0xf29b('0x16')]);}else{logger[_0xf29b('0x17')](_0xf29b('0x10'),_0x3af102,'request\x20sent');_0x253051(_0x32c39d[_0xf29b('0x18')][_0xf29b('0x16')]);}})['catch'](function(_0x346b5b){logger['error'](_0xf29b('0x10'),_0x3af102,_0x346b5b);_0x1bcff2(_0x346b5b);});});}exports['GetFaxQueue']=function(_0x19ca8b){var _0xae858a=this;return new Promise(function(_0x2b5a03,_0x5153e5){return db[_0xf29b('0x19')][_0xf29b('0x1a')]({'raw':_0x19ca8b[_0xf29b('0x1b')]?_0x19ca8b[_0xf29b('0x1b')][_0xf29b('0x1c')]===undefined?!![]:![]:!![],'where':_0x19ca8b[_0xf29b('0x1b')]?_0x19ca8b[_0xf29b('0x1b')]['where']||null:null,'attributes':_0x19ca8b[_0xf29b('0x1b')]?_0x19ca8b['options'][_0xf29b('0x1d')]||null:null,'limit':_0x19ca8b['options']?_0x19ca8b['options'][_0xf29b('0x1e')]||null:null,'include':_0x19ca8b[_0xf29b('0x1b')]?_0x19ca8b[_0xf29b('0x1b')][_0xf29b('0x1f')]?_[_0xf29b('0x20')](_0x19ca8b['options'][_0xf29b('0x1f')],function(_0x4ba99d){return{'model':db[_0x4ba99d['model']],'as':_0x4ba99d['as'],'attributes':_0x4ba99d[_0xf29b('0x1d')],'include':_0x4ba99d[_0xf29b('0x1f')]?_[_0xf29b('0x20')](_0x4ba99d[_0xf29b('0x1f')],function(_0x1c25a4){return{'model':db[_0x1c25a4[_0xf29b('0x21')]],'as':_0x1c25a4['as'],'attributes':_0x1c25a4[_0xf29b('0x1d')],'include':_0x1c25a4[_0xf29b('0x1f')]?_[_0xf29b('0x20')](_0x1c25a4['include'],function(_0x32b7a6){return{'model':db[_0x32b7a6['model']],'as':_0x32b7a6['as'],'attributes':_0x32b7a6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x292157){logger[_0xf29b('0x17')](_0xf29b('0x22'),_0x19ca8b);logger['debug']('GetFaxQueue',_0x19ca8b,JSON[_0xf29b('0x23')](_0x292157));_0x2b5a03(_0x292157);})[_0xf29b('0x24')](function(_0x3333b7){logger[_0xf29b('0x14')]('GetFaxQueue',_0x3333b7[_0xf29b('0x16')],_0x19ca8b);_0x5153e5(_0xae858a[_0xf29b('0x14')](0x1f4,_0x3333b7[_0xf29b('0x16')]));});});};exports[_0xf29b('0x25')]=function(_0x3db509){var _0x352327=this;return new Promise(function(_0x271bf5,_0x5b2382){return db[_0xf29b('0x19')][_0xf29b('0x26')]({'raw':_0x3db509[_0xf29b('0x1b')]?_0x3db509['options']['raw']===undefined?!![]:![]:!![],'where':_0x3db509[_0xf29b('0x1b')]?_0x3db509[_0xf29b('0x1b')][_0xf29b('0x27')]||null:null,'attributes':_0x3db509[_0xf29b('0x1b')]?_0x3db509[_0xf29b('0x1b')][_0xf29b('0x1d')]||null:null,'include':_0x3db509[_0xf29b('0x1b')]?_0x3db509[_0xf29b('0x1b')][_0xf29b('0x1f')]?_[_0xf29b('0x20')](_0x3db509[_0xf29b('0x1b')][_0xf29b('0x1f')],function(_0x330a22){return{'model':db[_0x330a22['model']],'as':_0x330a22['as'],'attributes':_0x330a22[_0xf29b('0x1d')],'include':_0x330a22[_0xf29b('0x1f')]?_[_0xf29b('0x20')](_0x330a22[_0xf29b('0x1f')],function(_0x62fce6){return{'model':db[_0x62fce6[_0xf29b('0x21')]],'as':_0x62fce6['as'],'attributes':_0x62fce6[_0xf29b('0x1d')],'include':_0x62fce6[_0xf29b('0x1f')]?_[_0xf29b('0x20')](_0x62fce6['include'],function(_0x5ce508){return{'model':db[_0x5ce508[_0xf29b('0x21')]],'as':_0x5ce508['as'],'attributes':_0x5ce508[_0xf29b('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ece6e){logger[_0xf29b('0x17')]('ShowFaxQueue',_0x3db509);logger[_0xf29b('0x12')](_0xf29b('0x25'),_0x3db509,JSON[_0xf29b('0x23')](_0x4ece6e));_0x271bf5(_0x4ece6e);})[_0xf29b('0x24')](function(_0x2784ff){logger['error'](_0xf29b('0x25'),_0x2784ff[_0xf29b('0x16')],_0x3db509);_0x5b2382(_0x352327[_0xf29b('0x14')](0x1f4,_0x2784ff[_0xf29b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 3b04fe2..c404fd8 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 _0x4291=['removeListener','length','faxQueue:','save','remove','emit'];(function(_0x282af7,_0x5511b1){var _0xf1513c=function(_0x5c54cc){while(--_0x5c54cc){_0x282af7['push'](_0x282af7['shift']());}};_0xf1513c(++_0x5511b1);}(_0x4291,0x1dd));var _0x1429=function(_0x7d3de7,_0x286519){_0x7d3de7=_0x7d3de7-0x0;var _0x3b74a2=_0x4291[_0x7d3de7];return _0x3b74a2;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x1429('0x0'),_0x1429('0x1'),'update'];function createListener(_0x5f5064,_0x4ca8da){return function(_0x33eb2c){_0x4ca8da[_0x1429('0x2')](_0x5f5064,_0x33eb2c);};}function removeListener(_0x4d0234,_0x107fcf){return function(){FaxQueueEvents[_0x1429('0x3')](_0x4d0234,_0x107fcf);};}exports['register']=function(_0x221c54){for(var _0x3ad789=0x0,_0x131f5d=events[_0x1429('0x4')];_0x3ad789<_0x131f5d;_0x3ad789++){var _0x28529c=events[_0x3ad789];var _0x41bf46=createListener(_0x1429('0x5')+_0x28529c,_0x221c54);FaxQueueEvents['on'](_0x28529c,_0x41bf46);}}; \ No newline at end of file +var _0x4f40=['emit','removeListener','register','length','./faxQueue.events','remove','update'];(function(_0x2cd947,_0x3caa2a){var _0x2195e0=function(_0x108168){while(--_0x108168){_0x2cd947['push'](_0x2cd947['shift']());}};_0x2195e0(++_0x3caa2a);}(_0x4f40,0x146));var _0x04f4=function(_0xc07ffa,_0x32217b){_0xc07ffa=_0xc07ffa-0x0;var _0x1ff71c=_0x4f40[_0xc07ffa];return _0x1ff71c;};'use strict';var FaxQueueEvents=require(_0x04f4('0x0'));var events=['save',_0x04f4('0x1'),_0x04f4('0x2')];function createListener(_0x47deba,_0x5d9dd8){return function(_0x36f4da){_0x5d9dd8[_0x04f4('0x3')](_0x47deba,_0x36f4da);};}function removeListener(_0x368d01,_0xc4cd4e){return function(){FaxQueueEvents[_0x04f4('0x4')](_0x368d01,_0xc4cd4e);};}exports[_0x04f4('0x5')]=function(_0x20b1be){for(var _0x59d1dd=0x0,_0x16eacd=events[_0x04f4('0x6')];_0x59d1dd<_0x16eacd;_0x59d1dd++){var _0x143ecc=events[_0x59d1dd];var _0x3abb40=createListener('faxQueue:'+_0x143ecc,_0x20b1be);FaxQueueEvents['on'](_0x143ecc,_0x3abb40);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 8acff4a..2317d44 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0x7dda42,_0x31357d){var _0x3d413c=function(_0x407267){while(--_0x407267){_0x7dda42['push'](_0x7dda42['shift']());}};_0x3d413c(++_0x31357d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('0x1c')]=router; \ No newline at end of file +var _0x0b0e=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','multer'];(function(_0x4bc4c8,_0x3139d3){var _0x3bb121=function(_0x95ad12){while(--_0x95ad12){_0x4bc4c8['push'](_0x4bc4c8['shift']());}};_0x3bb121(++_0x3139d3);}(_0x0b0e,0x187));var _0xe0b0=function(_0x429370,_0x46ff4c){_0x429370=_0x429370-0x0;var _0x41a3ad=_0x0b0e[_0x429370];return _0x41a3ad;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['get'](_0xe0b0('0xe'),auth[_0xe0b0('0x9')](),controller['getMembers']);router[_0xe0b0('0x8')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x8')](_0xe0b0('0x11'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x14')]);router[_0xe0b0('0x13')]('/:id/teams',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x15')]);router[_0xe0b0('0x13')](_0xe0b0('0x11'),auth[_0xe0b0('0x9')](),controller['addAgents']);router[_0xe0b0('0x16')]('/:id',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x17')]);router['delete'](_0xe0b0('0xc'),auth['isAuthenticated'](),controller[_0xe0b0('0x18')]);router[_0xe0b0('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe0b0('0x1a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xe0b0('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 5f5f44a..fccbc3f 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 _0xce2c=['DATE','moment','sequelize','exports','STRING'];(function(_0x331f1d,_0x4f43c6){var _0x1f6cdf=function(_0x591fab){while(--_0x591fab){_0x331f1d['push'](_0x331f1d['shift']());}};_0x1f6cdf(++_0x4f43c6);}(_0xce2c,0xd8));var _0xcce2=function(_0x2901ae,_0x5bab63){_0x2901ae=_0x2901ae-0x0;var _0x3924b9=_0xce2c[_0x2901ae];return _0x3924b9;};'use strict';var moment=require(_0xcce2('0x0'));var Sequelize=require(_0xcce2('0x1'));module[_0xcce2('0x2')]={'uniqueid':{'type':Sequelize[_0xcce2('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xcce2('0x3')]},'joinAt':{'type':Sequelize[_0xcce2('0x4')]},'leaveAt':{'type':Sequelize[_0xcce2('0x4')]},'acceptAt':{'type':Sequelize[_0xcce2('0x4')]},'exitAt':{'type':Sequelize[_0xcce2('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x894c=['STRING','DATE'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x894c,0x1f2));var _0xc894=function(_0x3ab401,_0x3b65e8){_0x3ab401=_0x3ab401-0x0;var _0x199daf=_0x894c[_0x3ab401];return _0x199daf;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xc894('0x0')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc894('0x1')]},'leaveAt':{'type':Sequelize[_0xc894('0x1')]},'acceptAt':{'type':Sequelize[_0xc894('0x1')]},'exitAt':{'type':Sequelize[_0xc894('0x1')]},'reason':{'type':Sequelize[_0xc894('0x0')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index fa2692c..6b70f97 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 _0x916b=['intersection','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','fields','length','find','create','update','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','squel','jsforce','to-csv','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','then','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x555780,_0x39f9cc){var _0x1a5322=function(_0x5dcf21){while(--_0x5dcf21){_0x555780['push'](_0x555780['shift']());}};_0x1a5322(++_0x39f9cc);}(_0x916b,0x1db));var _0xb916=function(_0x3caecd,_0x35ea88){_0x3caecd=_0x3caecd-0x0;var _0x54697a=_0x916b[_0x3caecd];return _0x54697a;};'use strict';var pdf=require(_0xb916('0x0'));var emlformat=require(_0xb916('0x1'));var rimraf=require(_0xb916('0x2'));var zipdir=require(_0xb916('0x3'));var jsonpatch=require(_0xb916('0x4'));var rp=require('request-promise');var moment=require(_0xb916('0x5'));var BPromise=require(_0xb916('0x6'));var Mustache=require('mustache');var util=require(_0xb916('0x7'));var path=require(_0xb916('0x8'));var sox=require(_0xb916('0x9'));var csv=require('to-csv');var ejs=require(_0xb916('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb916('0xb'));var crypto=require('crypto');var jsforce=require(_0xb916('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb916('0xd'));var querystring=require(_0xb916('0xe'));var Papa=require(_0xb916('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb916('0x10'));var logger=require(_0xb916('0x11'))(_0xb916('0x12'));var utils=require('../../config/utils');var config=require(_0xb916('0x13'));var db=require(_0xb916('0x14'))['db'];function respondWithStatusCode(_0xc18dad,_0x3837e5){_0x3837e5=_0x3837e5||0xcc;return function(_0x5dc791){if(_0x5dc791){return _0xc18dad[_0xb916('0x15')](_0x3837e5);}return _0xc18dad[_0xb916('0x16')](_0x3837e5)[_0xb916('0x17')]();};}function respondWithResult(_0x4f1912,_0x15f67a){_0x15f67a=_0x15f67a||0xc8;return function(_0x46cb2d){if(_0x46cb2d){return _0x4f1912['status'](_0x15f67a)['json'](_0x46cb2d);}};}function respondWithFilteredResult(_0x4feac0,_0x474f96){return function(_0x33c063){if(_0x33c063){var _0x4fdd0f=_0x33c063[_0xb916('0x18')],_0x2369db=_0x474f96[_0xb916('0x19')],_0x5e2bab=_0x474f96[_0xb916('0x19')]+_0x474f96[_0xb916('0x1a')],_0x5550d6;if(_0x5e2bab>=_0x4fdd0f){_0x5e2bab=_0x4fdd0f;_0x5550d6=0xc8;}else{_0x5550d6=0xce;}_0x4feac0[_0xb916('0x16')](_0x5550d6);return _0x4feac0[_0xb916('0x1b')](_0xb916('0x1c'),_0x2369db+'-'+_0x5e2bab+'/'+_0x4fdd0f)[_0xb916('0x1d')](_0x33c063);}return null;};}function patchUpdates(_0xeb05b){return function(_0x17e76d){try{jsonpatch[_0xb916('0x1e')](_0x17e76d,_0xeb05b,!![]);}catch(_0x189d8c){return BPromise[_0xb916('0x1f')](_0x189d8c);}return _0x17e76d[_0xb916('0x20')]();};}function saveUpdates(_0x2c13d2,_0x85ab80){return function(_0x40c4ca){if(_0x40c4ca){return _0x40c4ca['update'](_0x2c13d2)['then'](function(_0x4189e6){return _0x4189e6;});}return null;};}function removeEntity(_0x1eb723,_0x155bee){return function(_0x3ebbf0){if(_0x3ebbf0){return _0x3ebbf0[_0xb916('0x21')]()[_0xb916('0x22')](function(){_0x1eb723[_0xb916('0x16')](0xcc)[_0xb916('0x17')]();});}};}function handleEntityNotFound(_0x298e91,_0x2fb65b){return function(_0x99302e){if(!_0x99302e){_0x298e91[_0xb916('0x15')](0x194);}return _0x99302e;};}function handleError(_0x301316,_0x2b2066){_0x2b2066=_0x2b2066||0x1f4;return function(_0x33be7f){logger[_0xb916('0x23')](_0x33be7f[_0xb916('0x24')]);if(_0x33be7f['name']){delete _0x33be7f[_0xb916('0x25')];}_0x301316[_0xb916('0x16')](_0x2b2066)[_0xb916('0x26')](_0x33be7f);};}exports[_0xb916('0x27')]=function(_0x341105,_0x5b020f){var _0x82b65={},_0x535aa3={},_0xddff88={'count':0x0,'rows':[]};var _0x1b8861=_[_0xb916('0x28')](db[_0xb916('0x29')][_0xb916('0x2a')],function(_0x102d97){return{'name':_0x102d97[_0xb916('0x2b')],'type':_0x102d97[_0xb916('0x2c')][_0xb916('0x2d')]};});_0x535aa3[_0xb916('0x2e')]=_[_0xb916('0x28')](_0x1b8861,'name');_0x535aa3[_0xb916('0x2f')]=_[_0xb916('0x30')](_0x341105['query']);_0x535aa3[_0xb916('0x31')]=_[_0xb916('0x32')](_0x535aa3['model'],_0x535aa3[_0xb916('0x2f')]);_0x82b65[_0xb916('0x33')]=_[_0xb916('0x32')](_0x535aa3['model'],qs['fields'](_0x341105[_0xb916('0x2f')]['fields']));_0x82b65[_0xb916('0x33')]=_0x82b65[_0xb916('0x33')]['length']?_0x82b65['attributes']:_0x535aa3[_0xb916('0x2e')];if(!_0x341105[_0xb916('0x2f')][_0xb916('0x34')](_0xb916('0x35'))){_0x82b65['limit']=qs['limit'](_0x341105[_0xb916('0x2f')][_0xb916('0x1a')]);_0x82b65[_0xb916('0x19')]=qs['offset'](_0x341105[_0xb916('0x2f')][_0xb916('0x19')]);}_0x82b65[_0xb916('0x36')]=qs['sort'](_0x341105[_0xb916('0x2f')][_0xb916('0x37')]);_0x82b65['where']=qs[_0xb916('0x31')](_['pick'](_0x341105[_0xb916('0x2f')],_0x535aa3[_0xb916('0x31')]),_0x1b8861);if(_0x341105[_0xb916('0x2f')][_0xb916('0x38')]){_0x82b65[_0xb916('0x39')]=_[_0xb916('0x3a')](_0x82b65[_0xb916('0x39')],{'$or':_[_0xb916('0x28')](_0x1b8861,function(_0x53fd1a){if(_0x53fd1a[_0xb916('0x2c')]!==_0xb916('0x3b')){var _0x43cd70={};_0x43cd70[_0x53fd1a[_0xb916('0x25')]]={'$like':'%'+_0x341105[_0xb916('0x2f')][_0xb916('0x38')]+'%'};return _0x43cd70;}})});}_0x82b65=_[_0xb916('0x3a')]({},_0x82b65,_0x341105[_0xb916('0x3c')]);var _0x243311={'where':_0x82b65[_0xb916('0x39')]};return db[_0xb916('0x29')][_0xb916('0x18')](_0x243311)[_0xb916('0x22')](function(_0x1d667f){_0xddff88['count']=_0x1d667f;if(_0x341105[_0xb916('0x2f')][_0xb916('0x3d')]){_0x82b65[_0xb916('0x3e')]=[{'all':!![]}];}return db[_0xb916('0x29')][_0xb916('0x3f')](_0x82b65);})[_0xb916('0x22')](function(_0x1a75a3){_0xddff88[_0xb916('0x40')]=_0x1a75a3;return _0xddff88;})[_0xb916('0x22')](respondWithFilteredResult(_0x5b020f,_0x82b65))[_0xb916('0x41')](handleError(_0x5b020f,null));};exports[_0xb916('0x42')]=function(_0x3849d0,_0x14b271){var _0x3f269b={'raw':!![],'where':{'id':_0x3849d0['params']['id']}},_0x4f958f={};_0x4f958f[_0xb916('0x2e')]=_[_0xb916('0x30')](db[_0xb916('0x29')][_0xb916('0x2a')]);_0x4f958f[_0xb916('0x2f')]=_[_0xb916('0x30')](_0x3849d0[_0xb916('0x2f')]);_0x4f958f[_0xb916('0x31')]=_[_0xb916('0x32')](_0x4f958f['model'],_0x4f958f[_0xb916('0x2f')]);_0x3f269b[_0xb916('0x33')]=_[_0xb916('0x32')](_0x4f958f['model'],qs['fields'](_0x3849d0[_0xb916('0x2f')][_0xb916('0x43')]));_0x3f269b[_0xb916('0x33')]=_0x3f269b[_0xb916('0x33')][_0xb916('0x44')]?_0x3f269b[_0xb916('0x33')]:_0x4f958f[_0xb916('0x2e')];if(_0x3849d0['query']['includeAll']){_0x3f269b[_0xb916('0x3e')]=[{'all':!![]}];}_0x3f269b=_['merge']({},_0x3f269b,_0x3849d0[_0xb916('0x3c')]);return db[_0xb916('0x29')][_0xb916('0x45')](_0x3f269b)[_0xb916('0x22')](handleEntityNotFound(_0x14b271,null))['then'](respondWithResult(_0x14b271,null))[_0xb916('0x41')](handleError(_0x14b271,null));};exports['create']=function(_0x8f4ae9,_0x52f610){return db['FaxQueueReport'][_0xb916('0x46')](_0x8f4ae9['body'],{})[_0xb916('0x22')](respondWithResult(_0x52f610,0xc9))['catch'](handleError(_0x52f610,null));};exports[_0xb916('0x47')]=function(_0x10a911,_0x1b8793){if(_0x10a911[_0xb916('0x48')]['id']){delete _0x10a911[_0xb916('0x48')]['id'];}return db[_0xb916('0x29')][_0xb916('0x45')]({'where':{'id':_0x10a911['params']['id']}})['then'](handleEntityNotFound(_0x1b8793,null))[_0xb916('0x22')](saveUpdates(_0x10a911[_0xb916('0x48')],null))[_0xb916('0x22')](respondWithResult(_0x1b8793,null))[_0xb916('0x41')](handleError(_0x1b8793,null));};exports[_0xb916('0x21')]=function(_0x4ca748,_0x1c7ab1){return db['FaxQueueReport'][_0xb916('0x45')]({'where':{'id':_0x4ca748[_0xb916('0x49')]['id']}})['then'](handleEntityNotFound(_0x1c7ab1,null))[_0xb916('0x22')](removeEntity(_0x1c7ab1,null))[_0xb916('0x41')](handleError(_0x1c7ab1,null));};exports[_0xb916('0x4a')]=function(_0x459a2d,_0x2d7a80){return db[_0xb916('0x29')][_0xb916('0x4a')]()[_0xb916('0x22')](respondWithResult(_0x2d7a80,null))['catch'](handleError(_0x2d7a80,null));}; \ No newline at end of file +var _0xfe11=['fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','then','includeAll','findAll','catch','show','params','include','find','create','body','destroy','describe','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','sendStatus','error','stack','name','send','index','map','FaxQueueReport'];(function(_0x3d9f7d,_0x3fc2d1){var _0x3f5c83=function(_0x1f33b4){while(--_0x1f33b4){_0x3d9f7d['push'](_0x3d9f7d['shift']());}};_0x3f5c83(++_0x3fc2d1);}(_0xfe11,0x1dc));var _0x1fe1=function(_0x2e364c,_0x3a9865){_0x2e364c=_0x2e364c-0x0;var _0x13f7b4=_0xfe11[_0x2e364c];return _0x13f7b4;};'use strict';var pdf=require(_0x1fe1('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1fe1('0x1'));var jsonpatch=require(_0x1fe1('0x2'));var rp=require(_0x1fe1('0x3'));var moment=require('moment');var BPromise=require(_0x1fe1('0x4'));var Mustache=require(_0x1fe1('0x5'));var util=require('util');var path=require(_0x1fe1('0x6'));var sox=require(_0x1fe1('0x7'));var csv=require(_0x1fe1('0x8'));var ejs=require(_0x1fe1('0x9'));var fs=require('fs');var _=require(_0x1fe1('0xa'));var squel=require(_0x1fe1('0xb'));var crypto=require(_0x1fe1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1fe1('0xd'));var toCsv=require(_0x1fe1('0x8'));var querystring=require(_0x1fe1('0xe'));var Papa=require(_0x1fe1('0xf'));var Redis=require(_0x1fe1('0x10'));var authService=require(_0x1fe1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1fe1('0x12'));var hardwareService=require(_0x1fe1('0x13'));var logger=require(_0x1fe1('0x14'))(_0x1fe1('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x1fe1('0x16'))['db'];function respondWithStatusCode(_0xde7ee3,_0x50fca2){_0x50fca2=_0x50fca2||0xcc;return function(_0x3413ec){if(_0x3413ec){return _0xde7ee3['sendStatus'](_0x50fca2);}return _0xde7ee3[_0x1fe1('0x17')](_0x50fca2)[_0x1fe1('0x18')]();};}function respondWithResult(_0x37b096,_0x8be730){_0x8be730=_0x8be730||0xc8;return function(_0x2e2737){if(_0x2e2737){return _0x37b096[_0x1fe1('0x17')](_0x8be730)[_0x1fe1('0x19')](_0x2e2737);}};}function respondWithFilteredResult(_0x535ef9,_0x5769fb){return function(_0x3e68db){if(_0x3e68db){var _0x22297e=_0x3e68db[_0x1fe1('0x1a')],_0xc258cf=_0x5769fb[_0x1fe1('0x1b')],_0xdd1ed4=_0x5769fb['offset']+_0x5769fb[_0x1fe1('0x1c')],_0x392534;if(_0xdd1ed4>=_0x22297e){_0xdd1ed4=_0x22297e;_0x392534=0xc8;}else{_0x392534=0xce;}_0x535ef9[_0x1fe1('0x17')](_0x392534);return _0x535ef9[_0x1fe1('0x1d')](_0x1fe1('0x1e'),_0xc258cf+'-'+_0xdd1ed4+'/'+_0x22297e)[_0x1fe1('0x19')](_0x3e68db);}return null;};}function patchUpdates(_0x28f965){return function(_0x48b020){try{jsonpatch[_0x1fe1('0x1f')](_0x48b020,_0x28f965,!![]);}catch(_0x235526){return BPromise[_0x1fe1('0x20')](_0x235526);}return _0x48b020['save']();};}function saveUpdates(_0x225451,_0x35bef7){return function(_0x3965f8){if(_0x3965f8){return _0x3965f8[_0x1fe1('0x21')](_0x225451)['then'](function(_0x213633){return _0x213633;});}return null;};}function removeEntity(_0x6492,_0x2c463b){return function(_0x47c9eb){if(_0x47c9eb){return _0x47c9eb['destroy']()['then'](function(){_0x6492[_0x1fe1('0x17')](0xcc)[_0x1fe1('0x18')]();});}};}function handleEntityNotFound(_0x5b3da3,_0x1aade7){return function(_0x900309){if(!_0x900309){_0x5b3da3[_0x1fe1('0x22')](0x194);}return _0x900309;};}function handleError(_0x483fc0,_0x43b079){_0x43b079=_0x43b079||0x1f4;return function(_0x47357b){logger[_0x1fe1('0x23')](_0x47357b[_0x1fe1('0x24')]);if(_0x47357b[_0x1fe1('0x25')]){delete _0x47357b[_0x1fe1('0x25')];}_0x483fc0['status'](_0x43b079)[_0x1fe1('0x26')](_0x47357b);};}exports[_0x1fe1('0x27')]=function(_0x3bbc7c,_0x20281b){var _0x5450fa={},_0x4ca5d7={},_0x2d73ad={'count':0x0,'rows':[]};var _0x20f51d=_[_0x1fe1('0x28')](db[_0x1fe1('0x29')]['rawAttributes'],function(_0x5bfec9){return{'name':_0x5bfec9[_0x1fe1('0x2a')],'type':_0x5bfec9[_0x1fe1('0x2b')][_0x1fe1('0x2c')]};});_0x4ca5d7[_0x1fe1('0x2d')]=_[_0x1fe1('0x28')](_0x20f51d,_0x1fe1('0x25'));_0x4ca5d7[_0x1fe1('0x2e')]=_[_0x1fe1('0x2f')](_0x3bbc7c['query']);_0x4ca5d7[_0x1fe1('0x30')]=_['intersection'](_0x4ca5d7[_0x1fe1('0x2d')],_0x4ca5d7[_0x1fe1('0x2e')]);_0x5450fa['attributes']=_[_0x1fe1('0x31')](_0x4ca5d7['model'],qs[_0x1fe1('0x32')](_0x3bbc7c[_0x1fe1('0x2e')][_0x1fe1('0x32')]));_0x5450fa['attributes']=_0x5450fa[_0x1fe1('0x33')][_0x1fe1('0x34')]?_0x5450fa['attributes']:_0x4ca5d7['model'];if(!_0x3bbc7c['query'][_0x1fe1('0x35')](_0x1fe1('0x36'))){_0x5450fa['limit']=qs[_0x1fe1('0x1c')](_0x3bbc7c[_0x1fe1('0x2e')][_0x1fe1('0x1c')]);_0x5450fa[_0x1fe1('0x1b')]=qs[_0x1fe1('0x1b')](_0x3bbc7c[_0x1fe1('0x2e')][_0x1fe1('0x1b')]);}_0x5450fa[_0x1fe1('0x37')]=qs['sort'](_0x3bbc7c[_0x1fe1('0x2e')][_0x1fe1('0x38')]);_0x5450fa[_0x1fe1('0x39')]=qs[_0x1fe1('0x30')](_[_0x1fe1('0x3a')](_0x3bbc7c[_0x1fe1('0x2e')],_0x4ca5d7[_0x1fe1('0x30')]),_0x20f51d);if(_0x3bbc7c[_0x1fe1('0x2e')][_0x1fe1('0x3b')]){_0x5450fa[_0x1fe1('0x39')]=_[_0x1fe1('0x3c')](_0x5450fa[_0x1fe1('0x39')],{'$or':_[_0x1fe1('0x28')](_0x20f51d,function(_0x5991bb){if(_0x5991bb[_0x1fe1('0x2b')]!=='VIRTUAL'){var _0x41a7f7={};_0x41a7f7[_0x5991bb[_0x1fe1('0x25')]]={'$like':'%'+_0x3bbc7c[_0x1fe1('0x2e')][_0x1fe1('0x3b')]+'%'};return _0x41a7f7;}})});}_0x5450fa=_[_0x1fe1('0x3c')]({},_0x5450fa,_0x3bbc7c[_0x1fe1('0x3d')]);var _0x4959e7={'where':_0x5450fa[_0x1fe1('0x39')]};return db[_0x1fe1('0x29')][_0x1fe1('0x1a')](_0x4959e7)[_0x1fe1('0x3e')](function(_0x131c8a){_0x2d73ad[_0x1fe1('0x1a')]=_0x131c8a;if(_0x3bbc7c[_0x1fe1('0x2e')][_0x1fe1('0x3f')]){_0x5450fa['include']=[{'all':!![]}];}return db[_0x1fe1('0x29')][_0x1fe1('0x40')](_0x5450fa);})[_0x1fe1('0x3e')](function(_0x56f41d){_0x2d73ad['rows']=_0x56f41d;return _0x2d73ad;})[_0x1fe1('0x3e')](respondWithFilteredResult(_0x20281b,_0x5450fa))[_0x1fe1('0x41')](handleError(_0x20281b,null));};exports[_0x1fe1('0x42')]=function(_0x126b79,_0x5dfdfc){var _0x402338={'raw':!![],'where':{'id':_0x126b79[_0x1fe1('0x43')]['id']}},_0x3b6bb8={};_0x3b6bb8[_0x1fe1('0x2d')]=_[_0x1fe1('0x2f')](db['FaxQueueReport']['rawAttributes']);_0x3b6bb8[_0x1fe1('0x2e')]=_[_0x1fe1('0x2f')](_0x126b79[_0x1fe1('0x2e')]);_0x3b6bb8[_0x1fe1('0x30')]=_[_0x1fe1('0x31')](_0x3b6bb8[_0x1fe1('0x2d')],_0x3b6bb8[_0x1fe1('0x2e')]);_0x402338[_0x1fe1('0x33')]=_['intersection'](_0x3b6bb8[_0x1fe1('0x2d')],qs[_0x1fe1('0x32')](_0x126b79['query'][_0x1fe1('0x32')]));_0x402338[_0x1fe1('0x33')]=_0x402338[_0x1fe1('0x33')]['length']?_0x402338['attributes']:_0x3b6bb8['model'];if(_0x126b79[_0x1fe1('0x2e')][_0x1fe1('0x3f')]){_0x402338[_0x1fe1('0x44')]=[{'all':!![]}];}_0x402338=_[_0x1fe1('0x3c')]({},_0x402338,_0x126b79[_0x1fe1('0x3d')]);return db[_0x1fe1('0x29')][_0x1fe1('0x45')](_0x402338)[_0x1fe1('0x3e')](handleEntityNotFound(_0x5dfdfc,null))[_0x1fe1('0x3e')](respondWithResult(_0x5dfdfc,null))['catch'](handleError(_0x5dfdfc,null));};exports[_0x1fe1('0x46')]=function(_0x3e6b17,_0x239100){return db['FaxQueueReport'][_0x1fe1('0x46')](_0x3e6b17[_0x1fe1('0x47')],{})[_0x1fe1('0x3e')](respondWithResult(_0x239100,0xc9))[_0x1fe1('0x41')](handleError(_0x239100,null));};exports[_0x1fe1('0x21')]=function(_0x4162b0,_0x262618){if(_0x4162b0[_0x1fe1('0x47')]['id']){delete _0x4162b0['body']['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x4162b0[_0x1fe1('0x43')]['id']}})['then'](handleEntityNotFound(_0x262618,null))[_0x1fe1('0x3e')](saveUpdates(_0x4162b0[_0x1fe1('0x47')],null))[_0x1fe1('0x3e')](respondWithResult(_0x262618,null))['catch'](handleError(_0x262618,null));};exports[_0x1fe1('0x48')]=function(_0x31f9a1,_0x26e1fd){return db[_0x1fe1('0x29')][_0x1fe1('0x45')]({'where':{'id':_0x31f9a1['params']['id']}})[_0x1fe1('0x3e')](handleEntityNotFound(_0x26e1fd,null))['then'](removeEntity(_0x26e1fd,null))[_0x1fe1('0x41')](handleError(_0x26e1fd,null));};exports[_0x1fe1('0x49')]=function(_0x150bcf,_0x4fbbd4){return db[_0x1fe1('0x29')][_0x1fe1('0x49')]()[_0x1fe1('0x3e')](respondWithResult(_0x4fbbd4,null))[_0x1fe1('0x41')](handleError(_0x4fbbd4,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index b1e6d99..a1f7504 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 _0x68b3=['moment','request-promise','path','rimraf','../../config/environment','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x2f7629,_0x507a3a){var _0x6d8451=function(_0x5beeff){while(--_0x5beeff){_0x2f7629['push'](_0x2f7629['shift']());}};_0x6d8451(++_0x507a3a);}(_0x68b3,0x1d8));var _0x368b=function(_0x1fe2bd,_0x42d527){_0x1fe2bd=_0x1fe2bd-0x0;var _0x4d42e0=_0x68b3[_0x1fe2bd];return _0x4d42e0;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var logger=require(_0x368b('0x2'))(_0x368b('0x3'));var moment=require(_0x368b('0x4'));var BPromise=require('bluebird');var rp=require(_0x368b('0x5'));var fs=require('fs');var path=require(_0x368b('0x6'));var rimraf=require(_0x368b('0x7'));var config=require(_0x368b('0x8'));var attributes=require('./faxQueueReport.attributes');module[_0x368b('0x9')]=function(_0x41b15b,_0x104dad){return _0x41b15b[_0x368b('0xa')](_0x368b('0xb'),attributes,{'tableName':_0x368b('0xc'),'paranoid':![],'indexes':[{'name':_0x368b('0xd'),'fields':[_0x368b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fdc=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define'];(function(_0x4a6fac,_0x398714){var _0x109bfa=function(_0x38cabd){while(--_0x38cabd){_0x4a6fac['push'](_0x4a6fac['shift']());}};_0x109bfa(++_0x398714);}(_0x5fdc,0x127));var _0xc5fd=function(_0x32c166,_0x551dcc){_0x32c166=_0x32c166-0x0;var _0x13920a=_0x5fdc[_0x32c166];return _0x13920a;};'use strict';var _=require(_0xc5fd('0x0'));var util=require(_0xc5fd('0x1'));var logger=require(_0xc5fd('0x2'))(_0xc5fd('0x3'));var moment=require(_0xc5fd('0x4'));var BPromise=require(_0xc5fd('0x5'));var rp=require(_0xc5fd('0x6'));var fs=require('fs');var path=require(_0xc5fd('0x7'));var rimraf=require(_0xc5fd('0x8'));var config=require(_0xc5fd('0x9'));var attributes=require(_0xc5fd('0xa'));module[_0xc5fd('0xb')]=function(_0x44722b,_0x216902){return _0x44722b[_0xc5fd('0xc')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc5fd('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 47c9907..b45b82c 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 _0xd6d8=['raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateFaxQueueReport','FaxQueueReport','create','options','UpdateFaxQueueReport','update','body'];(function(_0x3f7da9,_0x4db255){var _0x13d49e=function(_0x552424){while(--_0x552424){_0x3f7da9['push'](_0x3f7da9['shift']());}};_0x13d49e(++_0x4db255);}(_0xd6d8,0x158));var _0x8d6d=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xd6d8[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0x8d6d('0x0'));var util=require(_0x8d6d('0x1'));var moment=require(_0x8d6d('0x2'));var BPromise=require(_0x8d6d('0x3'));var rs=require(_0x8d6d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8d6d('0x5'))['db'];var utils=require(_0x8d6d('0x6'));var logger=require(_0x8d6d('0x7'))(_0x8d6d('0x8'));var config=require(_0x8d6d('0x9'));var jayson=require(_0x8d6d('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x329888,_0x38706a,_0x24e9e3){return new BPromise(function(_0x3ebcfd,_0x322f9a){return client[_0x8d6d('0xb')](_0x329888,_0x24e9e3)[_0x8d6d('0xc')](function(_0x52c867){logger[_0x8d6d('0xd')](_0x8d6d('0xe'),_0x38706a,'request\x20sent');logger[_0x8d6d('0xf')](_0x8d6d('0x10'),_0x38706a,_0x8d6d('0x11'),JSON[_0x8d6d('0x12')](_0x52c867));if(_0x52c867[_0x8d6d('0x13')]){if(_0x52c867['error'][_0x8d6d('0x14')]===0x1f4){logger[_0x8d6d('0x13')](_0x8d6d('0xe'),_0x38706a,_0x52c867[_0x8d6d('0x13')][_0x8d6d('0x15')]);return _0x322f9a(_0x52c867[_0x8d6d('0x13')][_0x8d6d('0x15')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x38706a,_0x52c867[_0x8d6d('0x13')][_0x8d6d('0x15')]);return _0x3ebcfd(_0x52c867['error']['message']);}else{logger[_0x8d6d('0xd')](_0x8d6d('0xe'),_0x38706a,_0x8d6d('0x11'));_0x3ebcfd(_0x52c867[_0x8d6d('0x16')]['message']);}})['catch'](function(_0x1127b2){logger[_0x8d6d('0x13')](_0x8d6d('0xe'),_0x38706a,_0x1127b2);_0x322f9a(_0x1127b2);});});}exports[_0x8d6d('0x17')]=function(_0x3a078d){var _0x5c2c32=this;return new Promise(function(_0x21aeed,_0x31dd56){return db[_0x8d6d('0x18')][_0x8d6d('0x19')](_0x3a078d['body'],{'raw':_0x3a078d[_0x8d6d('0x1a')]?_0x3a078d[_0x8d6d('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x8d6d('0xc')](function(_0x3352b8){logger['info'](_0x8d6d('0x17'),_0x3a078d);logger[_0x8d6d('0xf')](_0x8d6d('0x17'),_0x3a078d,JSON[_0x8d6d('0x12')](_0x3352b8));_0x21aeed(_0x3352b8);})['catch'](function(_0x51ec02){logger[_0x8d6d('0x13')](_0x8d6d('0x17'),_0x51ec02[_0x8d6d('0x15')],_0x3a078d);_0x31dd56(_0x5c2c32[_0x8d6d('0x13')](0x1f4,_0x51ec02[_0x8d6d('0x15')]));});});};exports[_0x8d6d('0x1b')]=function(_0x586e79){var _0x55c0bd=this;return new Promise(function(_0x721c87,_0x58833a){return db[_0x8d6d('0x18')][_0x8d6d('0x1c')](_0x586e79[_0x8d6d('0x1d')],{'raw':_0x586e79[_0x8d6d('0x1a')]?_0x586e79['options'][_0x8d6d('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x586e79[_0x8d6d('0x1a')]?_0x586e79['options'][_0x8d6d('0x1f')]||null:null,'attributes':_0x586e79[_0x8d6d('0x1a')]?_0x586e79[_0x8d6d('0x1a')][_0x8d6d('0x20')]||null:null,'limit':_0x586e79[_0x8d6d('0x1a')]?_0x586e79['options'][_0x8d6d('0x21')]||null:null})[_0x8d6d('0xc')](function(_0x52883d){logger['info']('UpdateFaxQueueReport',_0x586e79);logger[_0x8d6d('0xf')](_0x8d6d('0x1b'),_0x586e79,JSON[_0x8d6d('0x12')](_0x52883d));_0x721c87(_0x52883d);})['catch'](function(_0x4b79ed){logger[_0x8d6d('0x13')](_0x8d6d('0x1b'),_0x4b79ed['message'],_0x586e79);_0x58833a(_0x55c0bd[_0x8d6d('0x13')](0x1f4,_0x4b79ed[_0x8d6d('0x15')]));});});}; \ No newline at end of file +var _0x691a=['limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body','raw','CreateFaxQueueReport','debug','UpdateFaxQueueReport','FaxQueueReport','update','options','where','attributes'];(function(_0x47a5c0,_0x5be9e4){var _0x3d1986=function(_0x2f54d7){while(--_0x2f54d7){_0x47a5c0['push'](_0x47a5c0['shift']());}};_0x3d1986(++_0x5be9e4);}(_0x691a,0x1a5));var _0xa691=function(_0x59077c,_0x3ad0be){_0x59077c=_0x59077c-0x0;var _0x353f97=_0x691a[_0x59077c];return _0x353f97;};'use strict';var _=require(_0xa691('0x0'));var util=require(_0xa691('0x1'));var moment=require(_0xa691('0x2'));var BPromise=require(_0xa691('0x3'));var rs=require(_0xa691('0x4'));var fs=require('fs');var Redis=require(_0xa691('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa691('0x6'));var logger=require('../../config/logger')(_0xa691('0x7'));var config=require(_0xa691('0x8'));var jayson=require(_0xa691('0x9'));var client=jayson[_0xa691('0xa')][_0xa691('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d8b22,_0x11e631,_0x54d8a3){return new BPromise(function(_0x22079c,_0x1b1131){return client[_0xa691('0xc')](_0x4d8b22,_0x54d8a3)[_0xa691('0xd')](function(_0x35795e){logger[_0xa691('0xe')](_0xa691('0xf'),_0x11e631,_0xa691('0x10'));logger['debug'](_0xa691('0x11'),_0x11e631,_0xa691('0x10'),JSON[_0xa691('0x12')](_0x35795e));if(_0x35795e[_0xa691('0x13')]){if(_0x35795e[_0xa691('0x13')][_0xa691('0x14')]===0x1f4){logger[_0xa691('0x13')](_0xa691('0xf'),_0x11e631,_0x35795e['error'][_0xa691('0x15')]);return _0x1b1131(_0x35795e['error'][_0xa691('0x15')]);}logger['error'](_0xa691('0xf'),_0x11e631,_0x35795e['error'][_0xa691('0x15')]);return _0x22079c(_0x35795e['error'][_0xa691('0x15')]);}else{logger[_0xa691('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x11e631,_0xa691('0x10'));_0x22079c(_0x35795e['result'][_0xa691('0x15')]);}})[_0xa691('0x16')](function(_0x51acaa){logger[_0xa691('0x13')](_0xa691('0xf'),_0x11e631,_0x51acaa);_0x1b1131(_0x51acaa);});});}exports['CreateFaxQueueReport']=function(_0x9a663e){var _0x4fcdfa=this;return new Promise(function(_0x2d5a40,_0xdc2a3f){return db['FaxQueueReport'][_0xa691('0x17')](_0x9a663e[_0xa691('0x18')],{'raw':_0x9a663e['options']?_0x9a663e['options'][_0xa691('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x2c0ab1){logger[_0xa691('0xe')](_0xa691('0x1a'),_0x9a663e);logger[_0xa691('0x1b')]('CreateFaxQueueReport',_0x9a663e,JSON['stringify'](_0x2c0ab1));_0x2d5a40(_0x2c0ab1);})['catch'](function(_0x59bcbc){logger[_0xa691('0x13')](_0xa691('0x1a'),_0x59bcbc[_0xa691('0x15')],_0x9a663e);_0xdc2a3f(_0x4fcdfa[_0xa691('0x13')](0x1f4,_0x59bcbc[_0xa691('0x15')]));});});};exports[_0xa691('0x1c')]=function(_0x259241){var _0x2acfc6=this;return new Promise(function(_0x3d7312,_0x608116){return db[_0xa691('0x1d')][_0xa691('0x1e')](_0x259241[_0xa691('0x18')],{'raw':_0x259241['options']?_0x259241[_0xa691('0x1f')][_0xa691('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x259241['options']?_0x259241[_0xa691('0x1f')][_0xa691('0x20')]||null:null,'attributes':_0x259241[_0xa691('0x1f')]?_0x259241[_0xa691('0x1f')][_0xa691('0x21')]||null:null,'limit':_0x259241[_0xa691('0x1f')]?_0x259241['options'][_0xa691('0x22')]||null:null})[_0xa691('0xd')](function(_0x44a5d2){logger[_0xa691('0xe')]('UpdateFaxQueueReport',_0x259241);logger[_0xa691('0x1b')](_0xa691('0x1c'),_0x259241,JSON[_0xa691('0x12')](_0x44a5d2));_0x3d7312(_0x44a5d2);})[_0xa691('0x16')](function(_0x33ebb5){logger[_0xa691('0x13')](_0xa691('0x1c'),_0x33ebb5[_0xa691('0x15')],_0x259241);_0x608116(_0x2acfc6[_0xa691('0x13')](0x1f4,_0x33ebb5[_0xa691('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index c1c22b7..c983872 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 _0x79ad=['../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x79ad,0x9a));var _0xd79a=function(_0x8c1fcf,_0x4c5f1d){_0x8c1fcf=_0x8c1fcf-0x0;var _0x552198=_0x79ad[_0x8c1fcf];return _0x552198;};'use strict';var multer=require('multer');var util=require(_0xd79a('0x0'));var path=require(_0xd79a('0x1'));var timeout=require(_0xd79a('0x2'));var express=require(_0xd79a('0x3'));var router=express[_0xd79a('0x4')]();var auth=require(_0xd79a('0x5'));var interaction=require(_0xd79a('0x6'));var config=require(_0xd79a('0x7'));var controller=require(_0xd79a('0x8'));router[_0xd79a('0x9')]('/',auth['isAuthenticated'](),controller[_0xd79a('0xa')]);router[_0xd79a('0x9')](_0xd79a('0xb'),auth[_0xd79a('0xc')](),controller['describe']);router[_0xd79a('0x9')](_0xd79a('0xd'),auth['isAuthenticated'](),controller[_0xd79a('0xe')]);router[_0xd79a('0xf')]('/',auth['isAuthenticated'](),controller[_0xd79a('0x10')]);router[_0xd79a('0x11')]('/:id',auth[_0xd79a('0xc')](),controller[_0xd79a('0x12')]);router[_0xd79a('0x13')](_0xd79a('0xd'),auth[_0xd79a('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2db4=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','multer'];(function(_0x595bff,_0x391f03){var _0x2bf138=function(_0x54ffe3){while(--_0x54ffe3){_0x595bff['push'](_0x595bff['shift']());}};_0x2bf138(++_0x391f03);}(_0x2db4,0x68));var _0x42db=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2db4[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x42db('0x0'));var util=require('util');var path=require(_0x42db('0x1'));var timeout=require(_0x42db('0x2'));var express=require(_0x42db('0x3'));var router=express[_0x42db('0x4')]();var auth=require(_0x42db('0x5'));var interaction=require(_0x42db('0x6'));var config=require(_0x42db('0x7'));var controller=require(_0x42db('0x8'));router[_0x42db('0x9')]('/',auth['isAuthenticated'](),controller[_0x42db('0xa')]);router['get'](_0x42db('0xb'),auth[_0x42db('0xc')](),controller[_0x42db('0xd')]);router[_0x42db('0x9')](_0x42db('0xe'),auth[_0x42db('0xc')](),controller[_0x42db('0xf')]);router[_0x42db('0x10')]('/',auth[_0x42db('0xc')](),controller['create']);router[_0x42db('0x11')]('/:id',auth[_0x42db('0xc')](),controller[_0x42db('0x12')]);router[_0x42db('0x13')](_0x42db('0xe'),auth[_0x42db('0xc')](),controller[_0x42db('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 931ac25..8c718ac 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 _0xca0d=['ENUM','agent','queue','NOW','moment','sequelize','STRING'];(function(_0x479e21,_0x385fd9){var _0x422e9c=function(_0x1dc4ca){while(--_0x1dc4ca){_0x479e21['push'](_0x479e21['shift']());}};_0x422e9c(++_0x385fd9);}(_0xca0d,0x13f));var _0xdca0=function(_0x3d6eed,_0x3acc13){_0x3d6eed=_0x3d6eed-0x0;var _0x410794=_0xca0d[_0x3d6eed];return _0x410794;};'use strict';var moment=require(_0xdca0('0x0'));var Sequelize=require(_0xdca0('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xdca0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xdca0('0x3')]('account',_0xdca0('0x4'),_0xdca0('0x5')),'allowNull':![],'defaultValue':_0xdca0('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xdca0('0x6')]}}; \ No newline at end of file +var _0x6c16=['exports','STRING','ENUM','account','queue','DATE','NOW','moment','sequelize'];(function(_0x46f464,_0x18d3f9){var _0xe07a48=function(_0x419ade){while(--_0x419ade){_0x46f464['push'](_0x46f464['shift']());}};_0xe07a48(++_0x18d3f9);}(_0x6c16,0x8e));var _0x66c1=function(_0x1b2e3f,_0x4845f2){_0x1b2e3f=_0x1b2e3f-0x0;var _0x5528e6=_0x6c16[_0x1b2e3f];return _0x5528e6;};'use strict';var moment=require(_0x66c1('0x0'));var Sequelize=require(_0x66c1('0x1'));module[_0x66c1('0x2')]={'uniqueid':{'type':Sequelize[_0x66c1('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x66c1('0x4')](_0x66c1('0x5'),'agent','queue'),'allowNull':![],'defaultValue':_0x66c1('0x6')},'transferredAt':{'type':Sequelize[_0x66c1('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x66c1('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 39874a1..aa9aa97 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(_0x5983ae,_0x2f7ac0){var _0x42deed=function(_0x19aad8){while(--_0x19aad8){_0x5983ae['push'](_0x5983ae['shift']());}};_0x42deed(++_0x2f7ac0);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'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 _0x5f2f=['set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','fieldName','type','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','FaxTransferReport','then','include','rows','catch','show','params','intersection','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x5f2f,0x73));var _0xf5f2=function(_0x57e5c3,_0x5c6f2a){_0x57e5c3=_0x57e5c3-0x0;var _0x2bff26=_0x5f2f[_0x57e5c3];return _0x2bff26;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var db=require(_0xf5f2('0x16'))['db'];function respondWithStatusCode(_0x14b51f,_0x331482){_0x331482=_0x331482||0xcc;return function(_0x3f2997){if(_0x3f2997){return _0x14b51f[_0xf5f2('0x17')](_0x331482);}return _0x14b51f[_0xf5f2('0x18')](_0x331482)['end']();};}function respondWithResult(_0x5850f4,_0xea612c){_0xea612c=_0xea612c||0xc8;return function(_0x269909){if(_0x269909){return _0x5850f4[_0xf5f2('0x18')](_0xea612c)[_0xf5f2('0x19')](_0x269909);}};}function respondWithFilteredResult(_0x4d97fc,_0xafe430){return function(_0x286197){if(_0x286197){var _0x17d656=_0x286197[_0xf5f2('0x1a')],_0x1b6dd2=_0xafe430[_0xf5f2('0x1b')],_0x23e23a=_0xafe430[_0xf5f2('0x1b')]+_0xafe430[_0xf5f2('0x1c')],_0x3a9dbb;if(_0x23e23a>=_0x17d656){_0x23e23a=_0x17d656;_0x3a9dbb=0xc8;}else{_0x3a9dbb=0xce;}_0x4d97fc[_0xf5f2('0x18')](_0x3a9dbb);return _0x4d97fc[_0xf5f2('0x1d')](_0xf5f2('0x1e'),_0x1b6dd2+'-'+_0x23e23a+'/'+_0x17d656)[_0xf5f2('0x19')](_0x286197);}return null;};}function patchUpdates(_0x3cf5ea){return function(_0x626999){try{jsonpatch[_0xf5f2('0x1f')](_0x626999,_0x3cf5ea,!![]);}catch(_0x56acc5){return BPromise[_0xf5f2('0x20')](_0x56acc5);}return _0x626999[_0xf5f2('0x21')]();};}function saveUpdates(_0x49dac2,_0x47acfc){return function(_0x2d2805){if(_0x2d2805){return _0x2d2805[_0xf5f2('0x22')](_0x49dac2)['then'](function(_0x45b74f){return _0x45b74f;});}return null;};}function removeEntity(_0x170042,_0x39e44a){return function(_0x39c024){if(_0x39c024){return _0x39c024[_0xf5f2('0x23')]()['then'](function(){_0x170042[_0xf5f2('0x18')](0xcc)[_0xf5f2('0x24')]();});}};}function handleEntityNotFound(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(!_0x287ad5){_0x4e8bda['sendStatus'](0x194);}return _0x287ad5;};}function handleError(_0x529f07,_0x5f1124){_0x5f1124=_0x5f1124||0x1f4;return function(_0x3f79d5){logger[_0xf5f2('0x25')](_0x3f79d5[_0xf5f2('0x26')]);if(_0x3f79d5[_0xf5f2('0x27')]){delete _0x3f79d5[_0xf5f2('0x27')];}_0x529f07[_0xf5f2('0x18')](_0x5f1124)[_0xf5f2('0x28')](_0x3f79d5);};}exports[_0xf5f2('0x29')]=function(_0x4ab014,_0xaa2602){var _0x102449={},_0x375ca8={},_0x31bfcb={'count':0x0,'rows':[]};var _0x198c73=_[_0xf5f2('0x2a')](db['FaxTransferReport']['rawAttributes'],function(_0x22c826){return{'name':_0x22c826[_0xf5f2('0x2b')],'type':_0x22c826[_0xf5f2('0x2c')]['key']};});_0x375ca8['model']=_[_0xf5f2('0x2a')](_0x198c73,_0xf5f2('0x27'));_0x375ca8[_0xf5f2('0x2d')]=_[_0xf5f2('0x2e')](_0x4ab014[_0xf5f2('0x2d')]);_0x375ca8['filters']=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],_0x375ca8['query']);_0x102449[_0xf5f2('0x30')]=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],qs[_0xf5f2('0x31')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x31')]));_0x102449[_0xf5f2('0x30')]=_0x102449[_0xf5f2('0x30')][_0xf5f2('0x32')]?_0x102449[_0xf5f2('0x30')]:_0x375ca8['model'];if(!_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x33')](_0xf5f2('0x34'))){_0x102449[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x1c')]);_0x102449['offset']=qs[_0xf5f2('0x1b')](_0x4ab014[_0xf5f2('0x2d')]['offset']);}_0x102449[_0xf5f2('0x35')]=qs['sort'](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x36')]);_0x102449[_0xf5f2('0x37')]=qs[_0xf5f2('0x38')](_['pick'](_0x4ab014['query'],_0x375ca8[_0xf5f2('0x38')]),_0x198c73);if(_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]){_0x102449['where']=_[_0xf5f2('0x3a')](_0x102449['where'],{'$or':_[_0xf5f2('0x2a')](_0x198c73,function(_0x566c47){if(_0x566c47[_0xf5f2('0x2c')]!==_0xf5f2('0x3b')){var _0x5337a6={};_0x5337a6[_0x566c47[_0xf5f2('0x27')]]={'$like':'%'+_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]+'%'};return _0x5337a6;}})});}_0x102449=_[_0xf5f2('0x3a')]({},_0x102449,_0x4ab014['options']);var _0x5d2d82={'where':_0x102449[_0xf5f2('0x37')]};return db[_0xf5f2('0x3c')][_0xf5f2('0x1a')](_0x5d2d82)[_0xf5f2('0x3d')](function(_0x2c7f65){_0x31bfcb[_0xf5f2('0x1a')]=_0x2c7f65;if(_0x4ab014[_0xf5f2('0x2d')]['includeAll']){_0x102449[_0xf5f2('0x3e')]=[{'all':!![]}];}return db[_0xf5f2('0x3c')]['findAll'](_0x102449);})[_0xf5f2('0x3d')](function(_0x3f3895){_0x31bfcb[_0xf5f2('0x3f')]=_0x3f3895;return _0x31bfcb;})[_0xf5f2('0x3d')](respondWithFilteredResult(_0xaa2602,_0x102449))[_0xf5f2('0x40')](handleError(_0xaa2602,null));};exports[_0xf5f2('0x41')]=function(_0x462ea3,_0x2083b3){var _0x574f24={'raw':!![],'where':{'id':_0x462ea3[_0xf5f2('0x42')]['id']}},_0x31c3c={};_0x31c3c[_0xf5f2('0x2f')]=_['keys'](db['FaxTransferReport']['rawAttributes']);_0x31c3c[_0xf5f2('0x2d')]=_[_0xf5f2('0x2e')](_0x462ea3['query']);_0x31c3c[_0xf5f2('0x38')]=_[_0xf5f2('0x43')](_0x31c3c[_0xf5f2('0x2f')],_0x31c3c[_0xf5f2('0x2d')]);_0x574f24[_0xf5f2('0x30')]=_[_0xf5f2('0x43')](_0x31c3c[_0xf5f2('0x2f')],qs[_0xf5f2('0x31')](_0x462ea3[_0xf5f2('0x2d')][_0xf5f2('0x31')]));_0x574f24[_0xf5f2('0x30')]=_0x574f24[_0xf5f2('0x30')][_0xf5f2('0x32')]?_0x574f24[_0xf5f2('0x30')]:_0x31c3c['model'];if(_0x462ea3[_0xf5f2('0x2d')]['includeAll']){_0x574f24[_0xf5f2('0x3e')]=[{'all':!![]}];}_0x574f24=_[_0xf5f2('0x3a')]({},_0x574f24,_0x462ea3[_0xf5f2('0x44')]);return db[_0xf5f2('0x3c')][_0xf5f2('0x45')](_0x574f24)[_0xf5f2('0x3d')](handleEntityNotFound(_0x2083b3,null))['then'](respondWithResult(_0x2083b3,null))[_0xf5f2('0x40')](handleError(_0x2083b3,null));};exports[_0xf5f2('0x46')]=function(_0x1c1497,_0x29b108){return db[_0xf5f2('0x3c')][_0xf5f2('0x46')](_0x1c1497[_0xf5f2('0x47')],{})[_0xf5f2('0x3d')](respondWithResult(_0x29b108,0xc9))['catch'](handleError(_0x29b108,null));};exports[_0xf5f2('0x22')]=function(_0x33ec29,_0x45db9a){if(_0x33ec29['body']['id']){delete _0x33ec29[_0xf5f2('0x47')]['id'];}return db[_0xf5f2('0x3c')][_0xf5f2('0x45')]({'where':{'id':_0x33ec29['params']['id']}})['then'](handleEntityNotFound(_0x45db9a,null))[_0xf5f2('0x3d')](saveUpdates(_0x33ec29[_0xf5f2('0x47')],null))['then'](respondWithResult(_0x45db9a,null))[_0xf5f2('0x40')](handleError(_0x45db9a,null));};exports['destroy']=function(_0x740321,_0x497eb8){return db[_0xf5f2('0x3c')]['find']({'where':{'id':_0x740321[_0xf5f2('0x42')]['id']}})[_0xf5f2('0x3d')](handleEntityNotFound(_0x497eb8,null))[_0xf5f2('0x3d')](removeEntity(_0x497eb8,null))[_0xf5f2('0x40')](handleError(_0x497eb8,null));};exports['describe']=function(_0x3154c1,_0x2b782f){return db['FaxTransferReport']['describe']()[_0xf5f2('0x3d')](respondWithResult(_0x2b782f,null))[_0xf5f2('0x40')](handleError(_0x2b782f,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index e6374d4..8863fdb 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 _0x0b94=['./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4d9808,_0x52afc2){var _0x17fd82=function(_0x4bbc1b){while(--_0x4bbc1b){_0x4d9808['push'](_0x4d9808['shift']());}};_0x17fd82(++_0x52afc2);}(_0x0b94,0xaf));var _0x40b9=function(_0x47c070,_0xc77ebc){_0x47c070=_0x47c070-0x0;var _0x1e9b39=_0x0b94[_0x47c070];return _0x1e9b39;};'use strict';var _=require(_0x40b9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x40b9('0x1'));var moment=require(_0x40b9('0x2'));var BPromise=require(_0x40b9('0x3'));var rp=require(_0x40b9('0x4'));var fs=require('fs');var path=require(_0x40b9('0x5'));var rimraf=require(_0x40b9('0x6'));var config=require('../../config/environment');var attributes=require(_0x40b9('0x7'));module[_0x40b9('0x8')]=function(_0x155e57,_0x5aa72c){return _0x155e57[_0x40b9('0x9')](_0x40b9('0xa'),attributes,{'tableName':_0x40b9('0xb'),'paranoid':![],'indexes':[{'name':_0x40b9('0xc'),'fields':[_0x40b9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5884=['lodash','util','moment','request-promise','path','rimraf','../../config/environment','exports','define','FaxTransferReport','report_fax_transfer','uniqueid'];(function(_0x54e775,_0x134dd3){var _0x541ed7=function(_0x36733a){while(--_0x36733a){_0x54e775['push'](_0x54e775['shift']());}};_0x541ed7(++_0x134dd3);}(_0x5884,0x144));var _0x4588=function(_0x9a4655,_0x3e9275){_0x9a4655=_0x9a4655-0x0;var _0x2ec10f=_0x5884[_0x9a4655];return _0x2ec10f;};'use strict';var _=require(_0x4588('0x0'));var util=require(_0x4588('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4588('0x2'));var BPromise=require('bluebird');var rp=require(_0x4588('0x3'));var fs=require('fs');var path=require(_0x4588('0x4'));var rimraf=require(_0x4588('0x5'));var config=require(_0x4588('0x6'));var attributes=require('./faxTransferReport.attributes');module[_0x4588('0x7')]=function(_0x4d0829,_0x50b183){return _0x4d0829[_0x4588('0x8')](_0x4588('0x9'),attributes,{'tableName':_0x4588('0xa'),'paranoid':![],'indexes':[{'name':_0x4588('0xb'),'fields':[_0x4588('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 0ef3a1f..1bb590e 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 _0xf924=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x411475,_0xcecb1f){var _0x5a8130=function(_0x4bbbc8){while(--_0x4bbbc8){_0x411475['push'](_0x411475['shift']());}};_0x5a8130(++_0xcecb1f);}(_0xf924,0x9d));var _0x4f92=function(_0x2170e3,_0x39d8c4){_0x2170e3=_0x2170e3-0x0;var _0x4b1363=_0xf924[_0x2170e3];return _0x4b1363;};'use strict';var _=require(_0x4f92('0x0'));var util=require(_0x4f92('0x1'));var moment=require(_0x4f92('0x2'));var BPromise=require(_0x4f92('0x3'));var rs=require(_0x4f92('0x4'));var fs=require('fs');var Redis=require(_0x4f92('0x5'));var db=require(_0x4f92('0x6'))['db'];var utils=require(_0x4f92('0x7'));var logger=require(_0x4f92('0x8'))(_0x4f92('0x9'));var config=require('../../config/environment');var jayson=require(_0x4f92('0xa'));var client=jayson[_0x4f92('0xb')][_0x4f92('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x30a976,_0x1ef1b6,_0xadda01){return new BPromise(function(_0x4efe1c,_0x539a22){return client[_0x4f92('0xd')](_0x30a976,_0xadda01)['then'](function(_0x499f35){logger[_0x4f92('0xe')](_0x4f92('0xf'),_0x1ef1b6,_0x4f92('0x10'));logger['debug']('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x1ef1b6,_0x4f92('0x10'),JSON[_0x4f92('0x11')](_0x499f35));if(_0x499f35['error']){if(_0x499f35[_0x4f92('0x12')][_0x4f92('0x13')]===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x1ef1b6,_0x499f35[_0x4f92('0x12')][_0x4f92('0x14')]);return _0x539a22(_0x499f35[_0x4f92('0x12')][_0x4f92('0x14')]);}logger[_0x4f92('0x12')](_0x4f92('0xf'),_0x1ef1b6,_0x499f35['error']['message']);return _0x4efe1c(_0x499f35[_0x4f92('0x12')][_0x4f92('0x14')]);}else{logger[_0x4f92('0xe')](_0x4f92('0xf'),_0x1ef1b6,'request\x20sent');_0x4efe1c(_0x499f35[_0x4f92('0x15')][_0x4f92('0x14')]);}})[_0x4f92('0x16')](function(_0x4cb252){logger[_0x4f92('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x1ef1b6,_0x4cb252);_0x539a22(_0x4cb252);});});} \ No newline at end of file +var _0xa1f5=['../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x251fa8,_0x438d42){var _0x3d89e9=function(_0x5f91dc){while(--_0x5f91dc){_0x251fa8['push'](_0x251fa8['shift']());}};_0x3d89e9(++_0x438d42);}(_0xa1f5,0x1c9));var _0x5a1f=function(_0x211123,_0x1f32ef){_0x211123=_0x211123-0x0;var _0x170477=_0xa1f5[_0x211123];return _0x170477;};'use strict';var _=require(_0x5a1f('0x0'));var util=require(_0x5a1f('0x1'));var moment=require(_0x5a1f('0x2'));var BPromise=require(_0x5a1f('0x3'));var rs=require(_0x5a1f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5a1f('0x5'));var jayson=require(_0x5a1f('0x6'));var client=jayson[_0x5a1f('0x7')][_0x5a1f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23b83a,_0x2c9a6c,_0x39a046){return new BPromise(function(_0x54e997,_0x55caf1){return client[_0x5a1f('0x9')](_0x23b83a,_0x39a046)[_0x5a1f('0xa')](function(_0x4d6dc1){logger[_0x5a1f('0xb')](_0x5a1f('0xc'),_0x2c9a6c,_0x5a1f('0xd'));logger[_0x5a1f('0xe')](_0x5a1f('0xf'),_0x2c9a6c,'request\x20sent',JSON[_0x5a1f('0x10')](_0x4d6dc1));if(_0x4d6dc1[_0x5a1f('0x11')]){if(_0x4d6dc1[_0x5a1f('0x11')][_0x5a1f('0x12')]===0x1f4){logger['error'](_0x5a1f('0xc'),_0x2c9a6c,_0x4d6dc1[_0x5a1f('0x11')][_0x5a1f('0x13')]);return _0x55caf1(_0x4d6dc1['error'][_0x5a1f('0x13')]);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x2c9a6c,_0x4d6dc1[_0x5a1f('0x11')][_0x5a1f('0x13')]);return _0x54e997(_0x4d6dc1[_0x5a1f('0x11')][_0x5a1f('0x13')]);}else{logger[_0x5a1f('0xb')](_0x5a1f('0xc'),_0x2c9a6c,_0x5a1f('0xd'));_0x54e997(_0x4d6dc1['result'][_0x5a1f('0x13')]);}})[_0x5a1f('0x14')](function(_0x413295){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x2c9a6c,_0x413295);_0x55caf1(_0x413295);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 955768c..88fa108 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 _0x92e4=['/describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','isAuthenticated','get'];(function(_0x3a0f88,_0x1533b0){var _0x5e2ed0=function(_0x3b0edb){while(--_0x3b0edb){_0x3a0f88['push'](_0x3a0f88['shift']());}};_0x5e2ed0(++_0x1533b0);}(_0x92e4,0x172));var _0x492e=function(_0x35dfa7,_0x380025){_0x35dfa7=_0x35dfa7-0x0;var _0x3c2519=_0x92e4[_0x35dfa7];return _0x3c2519;};'use strict';var multer=require(_0x492e('0x0'));var util=require(_0x492e('0x1'));var path=require('path');var timeout=require(_0x492e('0x2'));var express=require(_0x492e('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x492e('0x4'));var config=require(_0x492e('0x5'));var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0x492e('0x6')](),controller['index']);router[_0x492e('0x7')](_0x492e('0x8'),auth[_0x492e('0x6')](),controller['describe']);router['get']('/:id',auth[_0x492e('0x6')](),controller[_0x492e('0x9')]);router[_0x492e('0xa')]('/',auth[_0x492e('0x6')](),controller[_0x492e('0xb')]);router[_0x492e('0xc')](_0x492e('0xd'),auth[_0x492e('0x6')](),controller[_0x492e('0xe')]);router[_0x492e('0xf')](_0x492e('0xd'),auth[_0x492e('0x6')](),controller[_0x492e('0x10')]);module[_0x492e('0x11')]=router; \ No newline at end of file +var _0xfe40=['exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe40,0x1ba));var _0x0fe4=function(_0x770605,_0x55ef0a){_0x770605=_0x770605-0x0;var _0x52dd64=_0xfe40[_0x770605];return _0x52dd64;};'use strict';var multer=require(_0x0fe4('0x0'));var util=require(_0x0fe4('0x1'));var path=require(_0x0fe4('0x2'));var timeout=require(_0x0fe4('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x0fe4('0x4'));var interaction=require(_0x0fe4('0x5'));var config=require(_0x0fe4('0x6'));var controller=require(_0x0fe4('0x7'));router[_0x0fe4('0x8')]('/',auth[_0x0fe4('0x9')](),controller[_0x0fe4('0xa')]);router['get'](_0x0fe4('0xb'),auth[_0x0fe4('0x9')](),controller[_0x0fe4('0xc')]);router[_0x0fe4('0x8')](_0x0fe4('0xd'),auth[_0x0fe4('0x9')](),controller[_0x0fe4('0xe')]);router[_0x0fe4('0xf')]('/',auth[_0x0fe4('0x9')](),controller[_0x0fe4('0x10')]);router[_0x0fe4('0x11')]('/:id',auth[_0x0fe4('0x9')](),controller['update']);router[_0x0fe4('0x12')](_0x0fe4('0xd'),auth[_0x0fe4('0x9')](),controller[_0x0fe4('0x13')]);module[_0x0fe4('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index cd630e4..54fdf2a 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 _0xf2ca=['/:id','show','getFields','post','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get'];(function(_0x478a25,_0x1f896b){var _0x4cdefa=function(_0x9d8d96){while(--_0x9d8d96){_0x478a25['push'](_0x478a25['shift']());}};_0x4cdefa(++_0x1f896b);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x4e8401,_0x51b328){_0x4e8401=_0x4e8401-0x0;var _0x17269f=_0xf2ca[_0x4e8401];return _0x17269f;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var auth=require(_0xaf2c('0x5'));var interaction=require(_0xaf2c('0x6'));var config=require(_0xaf2c('0x7'));var controller=require(_0xaf2c('0x8'));router['get']('/',auth[_0xaf2c('0x9')](),controller[_0xaf2c('0xa')]);router[_0xaf2c('0xb')](_0xaf2c('0xc'),auth['isAuthenticated'](),controller[_0xaf2c('0xd')]);router[_0xaf2c('0xb')]('/:id/configurations',auth[_0xaf2c('0x9')](),controller['getConfigurations']);router[_0xaf2c('0xb')]('/:id/fields',auth[_0xaf2c('0x9')](),controller[_0xaf2c('0xe')]);router[_0xaf2c('0xf')]('/',auth[_0xaf2c('0x9')](),controller['create']);router['post'](_0xaf2c('0x10'),auth[_0xaf2c('0x9')](),controller[_0xaf2c('0x11')]);router[_0xaf2c('0x12')](_0xaf2c('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xaf2c('0x13')](_0xaf2c('0xc'),auth[_0xaf2c('0x9')](),controller[_0xaf2c('0x14')]);module[_0xaf2c('0x15')]=router; \ No newline at end of file +var _0xcca7=['getFields','post','create','addConfiguration','/:id','update','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x18a10c,_0x49e3f2){var _0x5011fa=function(_0x564a2c){while(--_0x564a2c){_0x18a10c['push'](_0x18a10c['shift']());}};_0x5011fa(++_0x49e3f2);}(_0xcca7,0x1aa));var _0x7cca=function(_0x131709,_0x4f60e6){_0x131709=_0x131709-0x0;var _0x18670c=_0xcca7[_0x131709];return _0x18670c;};'use strict';var multer=require(_0x7cca('0x0'));var util=require(_0x7cca('0x1'));var path=require(_0x7cca('0x2'));var timeout=require(_0x7cca('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x7cca('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7cca('0x5'));var controller=require(_0x7cca('0x6'));router[_0x7cca('0x7')]('/',auth[_0x7cca('0x8')](),controller[_0x7cca('0x9')]);router[_0x7cca('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x7cca('0xa')]);router[_0x7cca('0x7')](_0x7cca('0xb'),auth[_0x7cca('0x8')](),controller[_0x7cca('0xc')]);router[_0x7cca('0x7')](_0x7cca('0xd'),auth[_0x7cca('0x8')](),controller[_0x7cca('0xe')]);router[_0x7cca('0xf')]('/',auth['isAuthenticated'](),controller[_0x7cca('0x10')]);router[_0x7cca('0xf')](_0x7cca('0xb'),auth[_0x7cca('0x8')](),controller[_0x7cca('0x11')]);router['put'](_0x7cca('0x12'),auth[_0x7cca('0x8')](),controller[_0x7cca('0x13')]);router['delete']('/:id',auth[_0x7cca('0x8')](),controller[_0x7cca('0x14')]);module[_0x7cca('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index cabff5c..7f125ef 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 _0x0504=['sequelize','STRING','basic','ENUM','integrationTab','newTab'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0504,0x186));var _0x4050=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x0504[_0x543084];return _0x306a57;};'use strict';var Sequelize=require(_0x4050('0x0'));module['exports']={'name':{'type':Sequelize[_0x4050('0x1')]},'description':{'type':Sequelize[_0x4050('0x1')]},'username':{'type':Sequelize[_0x4050('0x1')]},'remoteUri':{'type':Sequelize[_0x4050('0x1')]},'authType':{'type':Sequelize['ENUM'](_0x4050('0x2')),'defaultValue':_0x4050('0x2')},'password':{'type':Sequelize[_0x4050('0x1')]},'consumerKey':{'type':Sequelize[_0x4050('0x1')]},'consumerSecret':{'type':Sequelize[_0x4050('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4050('0x3')](_0x4050('0x4'),_0x4050('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x3dca=['STRING','ENUM','basic','newTab','sequelize','exports'];(function(_0x180ac2,_0x219d65){var _0xfcaede=function(_0x728ebe){while(--_0x728ebe){_0x180ac2['push'](_0x180ac2['shift']());}};_0xfcaede(++_0x219d65);}(_0x3dca,0xe2));var _0xa3dc=function(_0x59b15f,_0xfe446f){_0x59b15f=_0x59b15f-0x0;var _0x141b0a=_0x3dca[_0x59b15f];return _0x141b0a;};'use strict';var Sequelize=require(_0xa3dc('0x0'));module[_0xa3dc('0x1')]={'name':{'type':Sequelize[_0xa3dc('0x2')]},'description':{'type':Sequelize[_0xa3dc('0x2')]},'username':{'type':Sequelize[_0xa3dc('0x2')]},'remoteUri':{'type':Sequelize[_0xa3dc('0x2')]},'authType':{'type':Sequelize[_0xa3dc('0x3')](_0xa3dc('0x4')),'defaultValue':_0xa3dc('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xa3dc('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xa3dc('0x2')]},'type':{'type':Sequelize[_0xa3dc('0x3')]('integrationTab',_0xa3dc('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 93e0e38..d4cbe3c 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 _0x0e02=['then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','offset','limit','set','apply','reject','update','destroy','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','include','show','includeAll','find','create','body','params','findOne','DeskConfiguration','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','consumerKey','consumerSecret','token','tokenSecret','slice','substring','GET','%s/custom_fields','basic','Authorization','format','Basic\x20%s','%s:%s','username','password','toString','concat','entries','active','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','../../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','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'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0e02,0x1cf));var _0x20e0=function(_0x1b5ff7,_0xdc5f6d){_0x1b5ff7=_0x1b5ff7-0x0;var _0x11b3ef=_0x0e02[_0x1b5ff7];return _0x11b3ef;};'use strict';var pdf=require(_0x20e0('0x0'));var emlformat=require(_0x20e0('0x1'));var rimraf=require(_0x20e0('0x2'));var zipdir=require(_0x20e0('0x3'));var jsonpatch=require(_0x20e0('0x4'));var rp=require(_0x20e0('0x5'));var moment=require(_0x20e0('0x6'));var BPromise=require(_0x20e0('0x7'));var Mustache=require(_0x20e0('0x8'));var util=require('util');var path=require(_0x20e0('0x9'));var sox=require(_0x20e0('0xa'));var csv=require(_0x20e0('0xb'));var ejs=require(_0x20e0('0xc'));var fs=require('fs');var _=require(_0x20e0('0xd'));var squel=require(_0x20e0('0xe'));var crypto=require(_0x20e0('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x20e0('0xb'));var querystring=require(_0x20e0('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x20e0('0x11'));var qs=require(_0x20e0('0x12'));var as=require(_0x20e0('0x13'));var hardwareService=require(_0x20e0('0x14'));var logger=require(_0x20e0('0x15'))(_0x20e0('0x16'));var utils=require(_0x20e0('0x17'));var config=require(_0x20e0('0x18'));var db=require(_0x20e0('0x19'))['db'];var integrations=require(_0x20e0('0x1a'));var jayson=require(_0x20e0('0x1b'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x4bb3f5,_0x37d504,_0x4e6a60){if(_0x4e6a60){var _0x490e92=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x490e92[_0x20e0('0x1c')](_0x37d504)){return _0x4bb3f5;}else{throw new db[(_0x20e0('0x1d'))][(_0x20e0('0x1e'))](_0x20e0('0x1f'));}}else{return _0x4bb3f5;}}function respondWithRpcPromise(_0x23554e,_0x5964e6,_0x1943cf,_0x25556f){return new BPromise(function(_0x1f9938,_0x3fa6ec){var _0x44b5c7=_0x25556f||client;return _0x44b5c7[_0x20e0('0x20')](_0x23554e,_0x1943cf)[_0x20e0('0x21')](function(_0x8afc6a){logger[_0x20e0('0x22')](_0x20e0('0x23'),_0x5964e6,_0x20e0('0x24'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x5964e6,_0x20e0('0x24'),JSON[_0x20e0('0x25')](_0x8afc6a));if(_0x8afc6a[_0x20e0('0x26')]){if(_0x8afc6a[_0x20e0('0x26')]['code']===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x5964e6,_0x8afc6a[_0x20e0('0x26')][_0x20e0('0x27')]);return _0x3fa6ec(_0x8afc6a[_0x20e0('0x26')]['message']);}logger['error'](_0x20e0('0x23'),_0x5964e6,_0x8afc6a[_0x20e0('0x26')][_0x20e0('0x27')]);return _0x1f9938(_0x8afc6a['error'][_0x20e0('0x27')]);}else{logger[_0x20e0('0x22')](_0x20e0('0x23'),_0x5964e6,_0x20e0('0x24'));_0x1f9938(_0x8afc6a[_0x20e0('0x28')][_0x20e0('0x27')]);}})[_0x20e0('0x29')](function(_0x1c25d5){logger[_0x20e0('0x26')](_0x20e0('0x23'),_0x5964e6,_0x1c25d5);_0x3fa6ec(_0x1c25d5);});});}function respondWithStatusCode(_0xd20c83,_0xc0a3a5){_0xc0a3a5=_0xc0a3a5||0xcc;return function(_0x8a230b){if(_0x8a230b){return _0xd20c83[_0x20e0('0x2a')](_0xc0a3a5);}return _0xd20c83[_0x20e0('0x2b')](_0xc0a3a5)[_0x20e0('0x2c')]();};}function respondWithResult(_0x1bc5c6,_0x4b2f3b){_0x4b2f3b=_0x4b2f3b||0xc8;return function(_0x73d8b3){if(_0x73d8b3){return _0x1bc5c6['status'](_0x4b2f3b)[_0x20e0('0x2d')](_0x73d8b3);}};}function respondWithFilteredResult(_0x31c79f,_0x39404b){return function(_0x5534ac){if(_0x5534ac){var _0x1e5d6d=_0x5534ac['count'],_0x280f33=_0x39404b[_0x20e0('0x2e')],_0x2e286a=_0x39404b[_0x20e0('0x2e')]+_0x39404b[_0x20e0('0x2f')],_0x583fad;if(_0x2e286a>=_0x1e5d6d){_0x2e286a=_0x1e5d6d;_0x583fad=0xc8;}else{_0x583fad=0xce;}_0x31c79f[_0x20e0('0x2b')](_0x583fad);return _0x31c79f[_0x20e0('0x30')]('Content-Range',_0x280f33+'-'+_0x2e286a+'/'+_0x1e5d6d)[_0x20e0('0x2d')](_0x5534ac);}return null;};}function patchUpdates(_0x177686){return function(_0x239123){try{jsonpatch[_0x20e0('0x31')](_0x239123,_0x177686,!![]);}catch(_0x1af8c1){return BPromise[_0x20e0('0x32')](_0x1af8c1);}return _0x239123['save']();};}function saveUpdates(_0x212781,_0x4a0a06){return function(_0x133e8b){if(_0x133e8b){return _0x133e8b[_0x20e0('0x33')](_0x212781)[_0x20e0('0x21')](function(_0x5d350b){return _0x5d350b;});}return null;};}function removeEntity(_0x3dc33d,_0x1833d3){return function(_0x98da8b){if(_0x98da8b){return _0x98da8b[_0x20e0('0x34')]()['then'](function(){_0x3dc33d[_0x20e0('0x2b')](0xcc)[_0x20e0('0x2c')]();});}};}function handleEntityNotFound(_0x3d851b,_0x5ac385){return function(_0x22f2eb){if(!_0x22f2eb){_0x3d851b['sendStatus'](0x194);}return _0x22f2eb;};}function handleError(_0x4072af,_0x16b7da){_0x16b7da=_0x16b7da||0x1f4;return function(_0x59bfb4){logger['error'](_0x59bfb4[_0x20e0('0x35')]);if(_0x59bfb4[_0x20e0('0x36')]){delete _0x59bfb4[_0x20e0('0x36')];}_0x4072af[_0x20e0('0x2b')](_0x16b7da)[_0x20e0('0x37')](_0x59bfb4);};}exports[_0x20e0('0x38')]=function(_0x366b17,_0x57aad5){var _0x4434de={},_0x5f4756={},_0x12e19c={'count':0x0,'rows':[]};var _0x117023=_[_0x20e0('0x39')](db[_0x20e0('0x3a')][_0x20e0('0x3b')],function(_0x381bf1){return{'name':_0x381bf1[_0x20e0('0x3c')],'type':_0x381bf1[_0x20e0('0x3d')]['key']};});_0x5f4756[_0x20e0('0x3e')]=_[_0x20e0('0x39')](_0x117023,_0x20e0('0x36'));_0x5f4756[_0x20e0('0x3f')]=_[_0x20e0('0x40')](_0x366b17[_0x20e0('0x3f')]);_0x5f4756['filters']=_[_0x20e0('0x41')](_0x5f4756['model'],_0x5f4756['query']);_0x4434de[_0x20e0('0x42')]=_[_0x20e0('0x41')](_0x5f4756[_0x20e0('0x3e')],qs[_0x20e0('0x43')](_0x366b17[_0x20e0('0x3f')][_0x20e0('0x43')]));_0x4434de[_0x20e0('0x42')]=_0x4434de[_0x20e0('0x42')][_0x20e0('0x44')]?_0x4434de[_0x20e0('0x42')]:_0x5f4756[_0x20e0('0x3e')];if(!_0x366b17[_0x20e0('0x3f')][_0x20e0('0x45')](_0x20e0('0x46'))){_0x4434de[_0x20e0('0x2f')]=qs['limit'](_0x366b17[_0x20e0('0x3f')][_0x20e0('0x2f')]);_0x4434de[_0x20e0('0x2e')]=qs['offset'](_0x366b17[_0x20e0('0x3f')]['offset']);}_0x4434de[_0x20e0('0x47')]=qs[_0x20e0('0x48')](_0x366b17['query']['sort']);_0x4434de[_0x20e0('0x49')]=qs[_0x20e0('0x4a')](_[_0x20e0('0x4b')](_0x366b17[_0x20e0('0x3f')],_0x5f4756[_0x20e0('0x4a')]),_0x117023);if(_0x366b17[_0x20e0('0x3f')][_0x20e0('0x4c')]){_0x4434de[_0x20e0('0x49')]=_[_0x20e0('0x4d')](_0x4434de[_0x20e0('0x49')],{'$or':_['map'](_0x117023,function(_0x4eb08f){if(_0x4eb08f[_0x20e0('0x3d')]!==_0x20e0('0x4e')){var _0x38aa58={};_0x38aa58[_0x4eb08f[_0x20e0('0x36')]]={'$like':'%'+_0x366b17['query'][_0x20e0('0x4c')]+'%'};return _0x38aa58;}})});}_0x4434de=_[_0x20e0('0x4d')]({},_0x4434de,_0x366b17[_0x20e0('0x4f')]);var _0x4e5474={'where':_0x4434de[_0x20e0('0x49')]};return db['DeskAccount'][_0x20e0('0x50')](_0x4e5474)[_0x20e0('0x21')](function(_0x2c281f){_0x12e19c['count']=_0x2c281f;if(_0x366b17[_0x20e0('0x3f')]['includeAll']){_0x4434de[_0x20e0('0x51')]=[{'all':!![]}];}return db[_0x20e0('0x3a')]['findAll'](_0x4434de);})[_0x20e0('0x21')](function(_0x33414e){_0x12e19c['rows']=_0x33414e;return _0x12e19c;})[_0x20e0('0x21')](respondWithFilteredResult(_0x57aad5,_0x4434de))['catch'](handleError(_0x57aad5,null));};exports[_0x20e0('0x52')]=function(_0x59effe,_0x557835){var _0x4afac1={'raw':![],'where':{'id':_0x59effe['params']['id']}},_0xc5a380={};_0xc5a380[_0x20e0('0x3e')]=_[_0x20e0('0x40')](db['DeskAccount']['rawAttributes']);_0xc5a380[_0x20e0('0x3f')]=_[_0x20e0('0x40')](_0x59effe[_0x20e0('0x3f')]);_0xc5a380['filters']=_[_0x20e0('0x41')](_0xc5a380[_0x20e0('0x3e')],_0xc5a380['query']);_0x4afac1[_0x20e0('0x42')]=_[_0x20e0('0x41')](_0xc5a380['model'],qs[_0x20e0('0x43')](_0x59effe[_0x20e0('0x3f')][_0x20e0('0x43')]));_0x4afac1[_0x20e0('0x42')]=_0x4afac1[_0x20e0('0x42')]['length']?_0x4afac1[_0x20e0('0x42')]:_0xc5a380['model'];if(_0x59effe[_0x20e0('0x3f')][_0x20e0('0x53')]){_0x4afac1['include']=[{'all':!![]}];}_0x4afac1=_[_0x20e0('0x4d')]({},_0x4afac1,_0x59effe[_0x20e0('0x4f')]);return db[_0x20e0('0x3a')][_0x20e0('0x54')](_0x4afac1)['then'](handleEntityNotFound(_0x557835,null))[_0x20e0('0x21')](respondWithResult(_0x557835,null))['catch'](handleError(_0x557835,null));};exports[_0x20e0('0x55')]=function(_0x363c30,_0x1b22bf){return db[_0x20e0('0x3a')][_0x20e0('0x55')](_0x363c30[_0x20e0('0x56')],{})[_0x20e0('0x21')](respondWithResult(_0x1b22bf,0xc9))[_0x20e0('0x29')](handleError(_0x1b22bf,null));};exports[_0x20e0('0x33')]=function(_0x5eba05,_0x585e9f){if(_0x5eba05[_0x20e0('0x56')]['id']){delete _0x5eba05[_0x20e0('0x56')]['id'];}return db[_0x20e0('0x3a')][_0x20e0('0x54')]({'where':{'id':_0x5eba05[_0x20e0('0x57')]['id']}})['then'](handleEntityNotFound(_0x585e9f,null))[_0x20e0('0x21')](saveUpdates(_0x5eba05[_0x20e0('0x56')],null))[_0x20e0('0x21')](respondWithResult(_0x585e9f,null))[_0x20e0('0x29')](handleError(_0x585e9f,null));};exports['destroy']=function(_0x5baf6d,_0xbc5c61){return db[_0x20e0('0x3a')][_0x20e0('0x54')]({'where':{'id':_0x5baf6d[_0x20e0('0x57')]['id']}})[_0x20e0('0x21')](handleEntityNotFound(_0xbc5c61,null))['then'](removeEntity(_0xbc5c61,null))[_0x20e0('0x29')](handleError(_0xbc5c61,null));};exports['getConfigurations']=function(_0x3b525d,_0x29a33d,_0x279470){var _0x1ab428={};var _0x4e419d={};var _0x5b014f;var _0x177096;return db[_0x20e0('0x3a')][_0x20e0('0x58')]({'where':{'id':_0x3b525d['params']['id']}})['then'](handleEntityNotFound(_0x29a33d,null))[_0x20e0('0x21')](function(_0x3dcd3b){if(_0x3dcd3b){_0x5b014f=_0x3dcd3b;_0x4e419d[_0x20e0('0x3e')]=_[_0x20e0('0x40')](db[_0x20e0('0x59')][_0x20e0('0x3b')]);_0x4e419d['query']=_['keys'](_0x3b525d[_0x20e0('0x3f')]);_0x4e419d[_0x20e0('0x4a')]=_[_0x20e0('0x41')](_0x4e419d[_0x20e0('0x3e')],_0x4e419d[_0x20e0('0x3f')]);_0x1ab428[_0x20e0('0x42')]=_[_0x20e0('0x41')](_0x4e419d[_0x20e0('0x3e')],qs['fields'](_0x3b525d[_0x20e0('0x3f')]['fields']));_0x1ab428['attributes']=_0x1ab428[_0x20e0('0x42')]['length']?_0x1ab428[_0x20e0('0x42')]:_0x4e419d['model'];_0x1ab428[_0x20e0('0x47')]=qs[_0x20e0('0x48')](_0x3b525d[_0x20e0('0x3f')][_0x20e0('0x48')]);_0x1ab428[_0x20e0('0x49')]=qs[_0x20e0('0x4a')](_[_0x20e0('0x4b')](_0x3b525d[_0x20e0('0x3f')],_0x4e419d[_0x20e0('0x4a')]));if(_0x3b525d[_0x20e0('0x3f')]['filter']){_0x1ab428['where']=_[_0x20e0('0x4d')](_0x1ab428['where'],{'$or':_[_0x20e0('0x39')](_0x1ab428[_0x20e0('0x42')],function(_0x83e141){var _0x6e701={};_0x6e701[_0x83e141]={'$like':'%'+_0x3b525d[_0x20e0('0x3f')][_0x20e0('0x4c')]+'%'};return _0x6e701;})});}_0x1ab428=_['merge']({},_0x1ab428,_0x3b525d[_0x20e0('0x4f')]);return _0x5b014f[_0x20e0('0x5a')](_0x1ab428);}})[_0x20e0('0x21')](function(_0x1aaaff){if(_0x1aaaff){_0x177096=_0x1aaaff['length'];if(!_0x3b525d['query'][_0x20e0('0x45')]('nolimit')){_0x1ab428[_0x20e0('0x2f')]=qs[_0x20e0('0x2f')](_0x3b525d[_0x20e0('0x3f')]['limit']);_0x1ab428[_0x20e0('0x2e')]=qs[_0x20e0('0x2e')](_0x3b525d[_0x20e0('0x3f')][_0x20e0('0x2e')]);}return _0x5b014f[_0x20e0('0x5a')](_0x1ab428);}})[_0x20e0('0x21')](function(_0x31d90f){if(_0x31d90f){return _0x31d90f?{'count':_0x177096,'rows':_0x31d90f}:null;}})[_0x20e0('0x21')](respondWithResult(_0x29a33d,null))['catch'](handleError(_0x29a33d,null));};exports[_0x20e0('0x5b')]=function(_0x2b836f,_0xd65203,_0x35f866){if(_0x2b836f[_0x20e0('0x56')]['id']){delete _0x2b836f[_0x20e0('0x56')]['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x2b836f[_0x20e0('0x57')]['id']}})[_0x20e0('0x21')](handleEntityNotFound(_0xd65203,null))[_0x20e0('0x21')](function(_0x1d7c92){if(_0x1d7c92){_0x2b836f[_0x20e0('0x56')]['AccountId']=_0x1d7c92['id'];_0x2b836f[_0x20e0('0x56')][_0x20e0('0x5c')]=integrations[_0x20e0('0x5d')](_0x2b836f[_0x20e0('0x56')][_0x20e0('0x5e')],_0x2b836f[_0x20e0('0x56')]['type']);_0x2b836f['body'][_0x20e0('0x5f')]=integrations[_0x20e0('0x60')](_0x2b836f[_0x20e0('0x56')][_0x20e0('0x5e')],_0x2b836f['body'][_0x20e0('0x3d')]);return db[_0x20e0('0x59')][_0x20e0('0x55')](_0x2b836f['body'],{'include':[{'model':db[_0x20e0('0x61')],'as':_0x20e0('0x5c')},{'model':db[_0x20e0('0x61')],'as':_0x20e0('0x5f')}]});}return null;})[_0x20e0('0x21')](respondWithResult(_0xd65203,null))['catch'](handleError(_0xd65203,null));};exports[_0x20e0('0x62')]=function(_0x128c31,_0x5adbef,_0xf1a38c){var _0x1d151c=[{'name':_0x20e0('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 _0x467e23='';return db['DeskAccount'][_0x20e0('0x58')]({'where':{'id':_0x128c31[_0x20e0('0x57')]['id']},'attributes':['id',_0x20e0('0x64'),_0x20e0('0x65'),'username','password',_0x20e0('0x66'),_0x20e0('0x67'),_0x20e0('0x68'),_0x20e0('0x69')]})[_0x20e0('0x21')](handleEntityNotFound(_0x5adbef,null))['then'](function(_0x2a5074){if(_0x2a5074){_0x467e23=_0x2a5074[_0x20e0('0x64')];var _0x885c25=_0x467e23[_0x20e0('0x6a')](-0x1);if(_0x885c25==='/'){_0x467e23=_0x467e23[_0x20e0('0x6b')](0x0,_0x467e23['lastIndexOf'](_0x885c25));}var _0x3dba54={'method':_0x20e0('0x6c'),'uri':util['format'](_0x20e0('0x6d'),_0x467e23),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x2a5074[_0x20e0('0x65')]===_0x20e0('0x6e')){_0x3dba54['headers'][_0x20e0('0x6f')]=util[_0x20e0('0x70')](_0x20e0('0x71'),new Buffer(util[_0x20e0('0x70')](_0x20e0('0x72'),_0x2a5074[_0x20e0('0x73')],_0x2a5074[_0x20e0('0x74')]))[_0x20e0('0x75')]('base64'));}return rp(_0x3dba54)[_0x20e0('0x21')](function(_0x317447){return _0x1d151c[_0x20e0('0x76')](_[_0x20e0('0x39')](_0x317447['_embedded'][_0x20e0('0x77')],function(_0x5880bc){return{'id':_0x5880bc[_0x20e0('0x36')],'name':_0x5880bc['name'],'type':_0x5880bc[_0x20e0('0x3d')],'active':_0x5880bc[_0x20e0('0x78')],'label':_0x5880bc['label'],'custom':!![]};}));});}})[_0x20e0('0x21')](function(_0x524e9d){return{'count':_0x524e9d['length'],'rows':_0x524e9d};})[_0x20e0('0x21')](respondWithResult(_0x5adbef,null))['catch'](function(_0x264dbc){var _0x20db79=_0x128c31[_0x20e0('0x3f')][_0x20e0('0x1c')]?0x1f4:_0x264dbc[_0x20e0('0x79')]||0x1f4;logger[_0x20e0('0x26')](_0x20e0('0x7a'),'getFields',_0x20db79,JSON['stringify'](_0x264dbc));delete _0x264dbc[_0x20e0('0x36')];if(_0x20db79===0x191){_0x20db79=0x190;}_0x5adbef[_0x20e0('0x2b')](_0x20db79)[_0x20e0('0x37')](_0x128c31[_0x20e0('0x3f')][_0x20e0('0x1c')]?{'message':_0x20e0('0x7b'),'statusCode':_0x264dbc[_0x20e0('0x79')]}:_0x264dbc);});}; \ No newline at end of file +var _0xd976=['key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','count','includeAll','findAll','show','params','rawAttributes','include','find','create','body','getConfigurations','DeskConfiguration','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','DeskField','getFields','priority','authType','username','password','consumerKey','consumerSecret','token','slice','substring','lastIndexOf','GET','basic','headers','Authorization','format','Basic\x20%s','%s:%s','toString','base64','concat','active','label','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../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','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','json','offset','limit','Content-Range','reject','save','update','destroy','stack','name','send','index','DeskAccount','fieldName'];(function(_0x209fcd,_0x1ecccc){var _0x501d5e=function(_0x8d74fe){while(--_0x8d74fe){_0x209fcd['push'](_0x209fcd['shift']());}};_0x501d5e(++_0x1ecccc);}(_0xd976,0x1be));var _0x6d97=function(_0x1ca3bf,_0xee7851){_0x1ca3bf=_0x1ca3bf-0x0;var _0x2c7193=_0xd976[_0x1ca3bf];return _0x2c7193;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6d97('0x0'));var rimraf=require(_0x6d97('0x1'));var zipdir=require(_0x6d97('0x2'));var jsonpatch=require(_0x6d97('0x3'));var rp=require(_0x6d97('0x4'));var moment=require(_0x6d97('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6d97('0x6'));var util=require(_0x6d97('0x7'));var path=require(_0x6d97('0x8'));var sox=require(_0x6d97('0x9'));var csv=require(_0x6d97('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6d97('0xb'));var squel=require(_0x6d97('0xc'));var crypto=require(_0x6d97('0xd'));var jsforce=require(_0x6d97('0xe'));var deskjs=require(_0x6d97('0xf'));var toCsv=require(_0x6d97('0xa'));var querystring=require(_0x6d97('0x10'));var Papa=require('papaparse');var Redis=require(_0x6d97('0x11'));var authService=require(_0x6d97('0x12'));var qs=require(_0x6d97('0x13'));var as=require(_0x6d97('0x14'));var hardwareService=require(_0x6d97('0x15'));var logger=require('../../config/logger')(_0x6d97('0x16'));var utils=require(_0x6d97('0x17'));var config=require(_0x6d97('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6d97('0x19'));var jayson=require(_0x6d97('0x1a'));var client=jayson[_0x6d97('0x1b')][_0x6d97('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x21ae25,_0x114ea2,_0x1e8df2){if(_0x1e8df2){var _0x292953=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x292953[_0x6d97('0x1d')](_0x114ea2)){return _0x21ae25;}else{throw new db['Sequelize'][(_0x6d97('0x1e'))](_0x6d97('0x1f'));}}else{return _0x21ae25;}}function respondWithRpcPromise(_0x16506c,_0x2add9b,_0x2dc904,_0xffe27b){return new BPromise(function(_0x52b19d,_0x2f58aa){var _0x40ec73=_0xffe27b||client;return _0x40ec73[_0x6d97('0x20')](_0x16506c,_0x2dc904)[_0x6d97('0x21')](function(_0x149729){logger[_0x6d97('0x22')](_0x6d97('0x23'),_0x2add9b,_0x6d97('0x24'));logger[_0x6d97('0x25')](_0x6d97('0x26'),_0x2add9b,_0x6d97('0x24'),JSON[_0x6d97('0x27')](_0x149729));if(_0x149729['error']){if(_0x149729['error'][_0x6d97('0x28')]===0x1f4){logger[_0x6d97('0x29')]('DeskAccount,\x20%s,\x20%s',_0x2add9b,_0x149729[_0x6d97('0x29')][_0x6d97('0x2a')]);return _0x2f58aa(_0x149729[_0x6d97('0x29')]['message']);}logger[_0x6d97('0x29')](_0x6d97('0x23'),_0x2add9b,_0x149729['error'][_0x6d97('0x2a')]);return _0x52b19d(_0x149729[_0x6d97('0x29')][_0x6d97('0x2a')]);}else{logger[_0x6d97('0x22')](_0x6d97('0x23'),_0x2add9b,'request\x20sent');_0x52b19d(_0x149729[_0x6d97('0x2b')][_0x6d97('0x2a')]);}})[_0x6d97('0x2c')](function(_0x170d1b){logger[_0x6d97('0x29')](_0x6d97('0x23'),_0x2add9b,_0x170d1b);_0x2f58aa(_0x170d1b);});});}function respondWithStatusCode(_0x400b91,_0x5456e7){_0x5456e7=_0x5456e7||0xcc;return function(_0x305b85){if(_0x305b85){return _0x400b91[_0x6d97('0x2d')](_0x5456e7);}return _0x400b91[_0x6d97('0x2e')](_0x5456e7)[_0x6d97('0x2f')]();};}function respondWithResult(_0x5e75c8,_0x3a4919){_0x3a4919=_0x3a4919||0xc8;return function(_0x12ef84){if(_0x12ef84){return _0x5e75c8[_0x6d97('0x2e')](_0x3a4919)[_0x6d97('0x30')](_0x12ef84);}};}function respondWithFilteredResult(_0x21dcf6,_0x52634b){return function(_0xcf1b67){if(_0xcf1b67){var _0x515319=_0xcf1b67['count'],_0x54d4c2=_0x52634b['offset'],_0x113ae4=_0x52634b[_0x6d97('0x31')]+_0x52634b[_0x6d97('0x32')],_0x5ce818;if(_0x113ae4>=_0x515319){_0x113ae4=_0x515319;_0x5ce818=0xc8;}else{_0x5ce818=0xce;}_0x21dcf6['status'](_0x5ce818);return _0x21dcf6['set'](_0x6d97('0x33'),_0x54d4c2+'-'+_0x113ae4+'/'+_0x515319)['json'](_0xcf1b67);}return null;};}function patchUpdates(_0x42fc8e){return function(_0x18b782){try{jsonpatch['apply'](_0x18b782,_0x42fc8e,!![]);}catch(_0x369b83){return BPromise[_0x6d97('0x34')](_0x369b83);}return _0x18b782[_0x6d97('0x35')]();};}function saveUpdates(_0x1f6019,_0x32a409){return function(_0x432c9c){if(_0x432c9c){return _0x432c9c[_0x6d97('0x36')](_0x1f6019)[_0x6d97('0x21')](function(_0x31d5a1){return _0x31d5a1;});}return null;};}function removeEntity(_0x22728b,_0x44362f){return function(_0x35b399){if(_0x35b399){return _0x35b399[_0x6d97('0x37')]()['then'](function(){_0x22728b['status'](0xcc)[_0x6d97('0x2f')]();});}};}function handleEntityNotFound(_0x1d538e,_0x4705cf){return function(_0xc53f3c){if(!_0xc53f3c){_0x1d538e[_0x6d97('0x2d')](0x194);}return _0xc53f3c;};}function handleError(_0x1932b5,_0x130f99){_0x130f99=_0x130f99||0x1f4;return function(_0x4af999){logger[_0x6d97('0x29')](_0x4af999[_0x6d97('0x38')]);if(_0x4af999[_0x6d97('0x39')]){delete _0x4af999[_0x6d97('0x39')];}_0x1932b5['status'](_0x130f99)[_0x6d97('0x3a')](_0x4af999);};}exports[_0x6d97('0x3b')]=function(_0x50d83f,_0x2ef4f2){var _0x108b6e={},_0x57a308={},_0x1b0893={'count':0x0,'rows':[]};var _0x2b89ca=_['map'](db[_0x6d97('0x3c')]['rawAttributes'],function(_0xcb2e19){return{'name':_0xcb2e19[_0x6d97('0x3d')],'type':_0xcb2e19['type'][_0x6d97('0x3e')]};});_0x57a308[_0x6d97('0x3f')]=_[_0x6d97('0x40')](_0x2b89ca,'name');_0x57a308['query']=_[_0x6d97('0x41')](_0x50d83f[_0x6d97('0x42')]);_0x57a308[_0x6d97('0x43')]=_[_0x6d97('0x44')](_0x57a308[_0x6d97('0x3f')],_0x57a308[_0x6d97('0x42')]);_0x108b6e[_0x6d97('0x45')]=_['intersection'](_0x57a308[_0x6d97('0x3f')],qs[_0x6d97('0x46')](_0x50d83f[_0x6d97('0x42')][_0x6d97('0x46')]));_0x108b6e['attributes']=_0x108b6e[_0x6d97('0x45')][_0x6d97('0x47')]?_0x108b6e[_0x6d97('0x45')]:_0x57a308[_0x6d97('0x3f')];if(!_0x50d83f[_0x6d97('0x42')][_0x6d97('0x48')](_0x6d97('0x49'))){_0x108b6e[_0x6d97('0x32')]=qs[_0x6d97('0x32')](_0x50d83f[_0x6d97('0x42')][_0x6d97('0x32')]);_0x108b6e[_0x6d97('0x31')]=qs['offset'](_0x50d83f['query']['offset']);}_0x108b6e[_0x6d97('0x4a')]=qs['sort'](_0x50d83f[_0x6d97('0x42')][_0x6d97('0x4b')]);_0x108b6e[_0x6d97('0x4c')]=qs[_0x6d97('0x43')](_[_0x6d97('0x4d')](_0x50d83f[_0x6d97('0x42')],_0x57a308[_0x6d97('0x43')]),_0x2b89ca);if(_0x50d83f[_0x6d97('0x42')][_0x6d97('0x4e')]){_0x108b6e[_0x6d97('0x4c')]=_['merge'](_0x108b6e[_0x6d97('0x4c')],{'$or':_[_0x6d97('0x40')](_0x2b89ca,function(_0x315682){if(_0x315682[_0x6d97('0x4f')]!==_0x6d97('0x50')){var _0x3623d2={};_0x3623d2[_0x315682[_0x6d97('0x39')]]={'$like':'%'+_0x50d83f[_0x6d97('0x42')][_0x6d97('0x4e')]+'%'};return _0x3623d2;}})});}_0x108b6e=_[_0x6d97('0x51')]({},_0x108b6e,_0x50d83f[_0x6d97('0x52')]);var _0x36b21f={'where':_0x108b6e[_0x6d97('0x4c')]};return db[_0x6d97('0x3c')][_0x6d97('0x53')](_0x36b21f)[_0x6d97('0x21')](function(_0x6a6d0c){_0x1b0893[_0x6d97('0x53')]=_0x6a6d0c;if(_0x50d83f[_0x6d97('0x42')][_0x6d97('0x54')]){_0x108b6e['include']=[{'all':!![]}];}return db['DeskAccount'][_0x6d97('0x55')](_0x108b6e);})[_0x6d97('0x21')](function(_0x4475f7){_0x1b0893['rows']=_0x4475f7;return _0x1b0893;})['then'](respondWithFilteredResult(_0x2ef4f2,_0x108b6e))[_0x6d97('0x2c')](handleError(_0x2ef4f2,null));};exports[_0x6d97('0x56')]=function(_0x5a28d7,_0x1508fe){var _0x19e5b7={'raw':![],'where':{'id':_0x5a28d7[_0x6d97('0x57')]['id']}},_0x131c7c={};_0x131c7c[_0x6d97('0x3f')]=_[_0x6d97('0x41')](db[_0x6d97('0x3c')][_0x6d97('0x58')]);_0x131c7c['query']=_[_0x6d97('0x41')](_0x5a28d7['query']);_0x131c7c[_0x6d97('0x43')]=_[_0x6d97('0x44')](_0x131c7c[_0x6d97('0x3f')],_0x131c7c[_0x6d97('0x42')]);_0x19e5b7[_0x6d97('0x45')]=_[_0x6d97('0x44')](_0x131c7c[_0x6d97('0x3f')],qs['fields'](_0x5a28d7[_0x6d97('0x42')][_0x6d97('0x46')]));_0x19e5b7[_0x6d97('0x45')]=_0x19e5b7['attributes'][_0x6d97('0x47')]?_0x19e5b7['attributes']:_0x131c7c[_0x6d97('0x3f')];if(_0x5a28d7['query'][_0x6d97('0x54')]){_0x19e5b7[_0x6d97('0x59')]=[{'all':!![]}];}_0x19e5b7=_[_0x6d97('0x51')]({},_0x19e5b7,_0x5a28d7[_0x6d97('0x52')]);return db[_0x6d97('0x3c')][_0x6d97('0x5a')](_0x19e5b7)['then'](handleEntityNotFound(_0x1508fe,null))[_0x6d97('0x21')](respondWithResult(_0x1508fe,null))[_0x6d97('0x2c')](handleError(_0x1508fe,null));};exports[_0x6d97('0x5b')]=function(_0x377b6e,_0x3ea87f){return db[_0x6d97('0x3c')][_0x6d97('0x5b')](_0x377b6e[_0x6d97('0x5c')],{})['then'](respondWithResult(_0x3ea87f,0xc9))['catch'](handleError(_0x3ea87f,null));};exports[_0x6d97('0x36')]=function(_0x402f71,_0x342b5f){if(_0x402f71[_0x6d97('0x5c')]['id']){delete _0x402f71[_0x6d97('0x5c')]['id'];}return db[_0x6d97('0x3c')][_0x6d97('0x5a')]({'where':{'id':_0x402f71['params']['id']}})[_0x6d97('0x21')](handleEntityNotFound(_0x342b5f,null))[_0x6d97('0x21')](saveUpdates(_0x402f71[_0x6d97('0x5c')],null))[_0x6d97('0x21')](respondWithResult(_0x342b5f,null))[_0x6d97('0x2c')](handleError(_0x342b5f,null));};exports[_0x6d97('0x37')]=function(_0x3d8365,_0x1937d5){return db['DeskAccount']['find']({'where':{'id':_0x3d8365[_0x6d97('0x57')]['id']}})[_0x6d97('0x21')](handleEntityNotFound(_0x1937d5,null))[_0x6d97('0x21')](removeEntity(_0x1937d5,null))[_0x6d97('0x2c')](handleError(_0x1937d5,null));};exports[_0x6d97('0x5d')]=function(_0x250148,_0x481664,_0x4cc898){var _0x4bf91d={};var _0x23ccf7={};var _0x1b09a0;var _0x1d2795;return db[_0x6d97('0x3c')]['findOne']({'where':{'id':_0x250148['params']['id']}})[_0x6d97('0x21')](handleEntityNotFound(_0x481664,null))[_0x6d97('0x21')](function(_0x31610f){if(_0x31610f){_0x1b09a0=_0x31610f;_0x23ccf7[_0x6d97('0x3f')]=_[_0x6d97('0x41')](db[_0x6d97('0x5e')][_0x6d97('0x58')]);_0x23ccf7[_0x6d97('0x42')]=_['keys'](_0x250148[_0x6d97('0x42')]);_0x23ccf7[_0x6d97('0x43')]=_[_0x6d97('0x44')](_0x23ccf7[_0x6d97('0x3f')],_0x23ccf7[_0x6d97('0x42')]);_0x4bf91d[_0x6d97('0x45')]=_[_0x6d97('0x44')](_0x23ccf7[_0x6d97('0x3f')],qs[_0x6d97('0x46')](_0x250148[_0x6d97('0x42')]['fields']));_0x4bf91d[_0x6d97('0x45')]=_0x4bf91d[_0x6d97('0x45')][_0x6d97('0x47')]?_0x4bf91d[_0x6d97('0x45')]:_0x23ccf7[_0x6d97('0x3f')];_0x4bf91d[_0x6d97('0x4a')]=qs[_0x6d97('0x4b')](_0x250148[_0x6d97('0x42')]['sort']);_0x4bf91d[_0x6d97('0x4c')]=qs[_0x6d97('0x43')](_[_0x6d97('0x4d')](_0x250148[_0x6d97('0x42')],_0x23ccf7['filters']));if(_0x250148[_0x6d97('0x42')][_0x6d97('0x4e')]){_0x4bf91d[_0x6d97('0x4c')]=_['merge'](_0x4bf91d[_0x6d97('0x4c')],{'$or':_[_0x6d97('0x40')](_0x4bf91d[_0x6d97('0x45')],function(_0x1fb5aa){var _0x3ecd86={};_0x3ecd86[_0x1fb5aa]={'$like':'%'+_0x250148[_0x6d97('0x42')][_0x6d97('0x4e')]+'%'};return _0x3ecd86;})});}_0x4bf91d=_[_0x6d97('0x51')]({},_0x4bf91d,_0x250148[_0x6d97('0x52')]);return _0x1b09a0[_0x6d97('0x5d')](_0x4bf91d);}})[_0x6d97('0x21')](function(_0x22ee92){if(_0x22ee92){_0x1d2795=_0x22ee92['length'];if(!_0x250148[_0x6d97('0x42')][_0x6d97('0x48')](_0x6d97('0x49'))){_0x4bf91d[_0x6d97('0x32')]=qs[_0x6d97('0x32')](_0x250148['query'][_0x6d97('0x32')]);_0x4bf91d[_0x6d97('0x31')]=qs[_0x6d97('0x31')](_0x250148[_0x6d97('0x42')][_0x6d97('0x31')]);}return _0x1b09a0[_0x6d97('0x5d')](_0x4bf91d);}})[_0x6d97('0x21')](function(_0x54a16e){if(_0x54a16e){return _0x54a16e?{'count':_0x1d2795,'rows':_0x54a16e}:null;}})[_0x6d97('0x21')](respondWithResult(_0x481664,null))[_0x6d97('0x2c')](handleError(_0x481664,null));};exports[_0x6d97('0x5f')]=function(_0x4425f3,_0x2d0137,_0x36b2a7){if(_0x4425f3[_0x6d97('0x5c')]['id']){delete _0x4425f3[_0x6d97('0x5c')]['id'];}return db[_0x6d97('0x3c')][_0x6d97('0x60')]({'where':{'id':_0x4425f3['params']['id']}})[_0x6d97('0x21')](handleEntityNotFound(_0x2d0137,null))[_0x6d97('0x21')](function(_0xb9eec9){if(_0xb9eec9){_0x4425f3[_0x6d97('0x5c')][_0x6d97('0x61')]=_0xb9eec9['id'];_0x4425f3['body'][_0x6d97('0x62')]=integrations['getSubjects'](_0x4425f3[_0x6d97('0x5c')][_0x6d97('0x63')],_0x4425f3[_0x6d97('0x5c')][_0x6d97('0x4f')]);_0x4425f3[_0x6d97('0x5c')][_0x6d97('0x64')]=integrations['getDescriptions'](_0x4425f3[_0x6d97('0x5c')][_0x6d97('0x63')],_0x4425f3['body'][_0x6d97('0x4f')]);return db[_0x6d97('0x5e')][_0x6d97('0x5b')](_0x4425f3[_0x6d97('0x5c')],{'include':[{'model':db[_0x6d97('0x65')],'as':_0x6d97('0x62')},{'model':db['DeskField'],'as':_0x6d97('0x64')}]});}return null;})['then'](respondWithResult(_0x2d0137,null))[_0x6d97('0x2c')](handleError(_0x2d0137,null));};exports[_0x6d97('0x66')]=function(_0x55e58d,_0x41642e,_0x40c51a){var _0xecc25e=[{'name':_0x6d97('0x67'),'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 _0x579245='';return db[_0x6d97('0x3c')]['findOne']({'where':{'id':_0x55e58d[_0x6d97('0x57')]['id']},'attributes':['id','remoteUri',_0x6d97('0x68'),_0x6d97('0x69'),_0x6d97('0x6a'),_0x6d97('0x6b'),_0x6d97('0x6c'),_0x6d97('0x6d'),'tokenSecret']})[_0x6d97('0x21')](handleEntityNotFound(_0x41642e,null))[_0x6d97('0x21')](function(_0x886a72){if(_0x886a72){_0x579245=_0x886a72['remoteUri'];var _0x18d204=_0x579245[_0x6d97('0x6e')](-0x1);if(_0x18d204==='/'){_0x579245=_0x579245[_0x6d97('0x6f')](0x0,_0x579245[_0x6d97('0x70')](_0x18d204));}var _0x29a0a4={'method':_0x6d97('0x71'),'uri':util['format']('%s/custom_fields',_0x579245),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x886a72[_0x6d97('0x68')]===_0x6d97('0x72')){_0x29a0a4[_0x6d97('0x73')][_0x6d97('0x74')]=util[_0x6d97('0x75')](_0x6d97('0x76'),new Buffer(util[_0x6d97('0x75')](_0x6d97('0x77'),_0x886a72['username'],_0x886a72[_0x6d97('0x6a')]))[_0x6d97('0x78')](_0x6d97('0x79')));}return rp(_0x29a0a4)[_0x6d97('0x21')](function(_0x4ffa35){return _0xecc25e[_0x6d97('0x7a')](_[_0x6d97('0x40')](_0x4ffa35['_embedded']['entries'],function(_0x5ccdef){return{'id':_0x5ccdef['name'],'name':_0x5ccdef[_0x6d97('0x39')],'type':_0x5ccdef[_0x6d97('0x4f')],'active':_0x5ccdef[_0x6d97('0x7b')],'label':_0x5ccdef[_0x6d97('0x7c')],'custom':!![]};}));});}})[_0x6d97('0x21')](function(_0x42b30e){return{'count':_0x42b30e['length'],'rows':_0x42b30e};})['then'](respondWithResult(_0x41642e,null))['catch'](function(_0x1aaf22){var _0x184c40=_0x55e58d[_0x6d97('0x42')][_0x6d97('0x1d')]?0x1f4:_0x1aaf22[_0x6d97('0x7d')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x6d97('0x66'),_0x184c40,JSON['stringify'](_0x1aaf22));delete _0x1aaf22[_0x6d97('0x39')];if(_0x184c40===0x191){_0x184c40=0x190;}_0x41642e['status'](_0x184c40)[_0x6d97('0x3a')](_0x55e58d[_0x6d97('0x42')][_0x6d97('0x1d')]?{'message':_0x6d97('0x7e'),'statusCode':_0x1aaf22[_0x6d97('0x7d')]}:_0x1aaf22);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 731d673..e09aae9 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 _0x94df=['rimraf','../../config/environment','./intDeskAccount.attributes','exports','define','int_desk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x52e26f,_0x26af54){var _0x3dd4cd=function(_0x9914ce){while(--_0x9914ce){_0x52e26f['push'](_0x52e26f['shift']());}};_0x3dd4cd(++_0x26af54);}(_0x94df,0xe3));var _0xf94d=function(_0x504322,_0xf52076){_0x504322=_0x504322-0x0;var _0x4340fa=_0x94df[_0x504322];return _0x4340fa;};'use strict';var _=require(_0xf94d('0x0'));var util=require(_0xf94d('0x1'));var logger=require(_0xf94d('0x2'))('api');var moment=require(_0xf94d('0x3'));var BPromise=require(_0xf94d('0x4'));var rp=require(_0xf94d('0x5'));var fs=require('fs');var path=require(_0xf94d('0x6'));var rimraf=require(_0xf94d('0x7'));var config=require(_0xf94d('0x8'));var attributes=require(_0xf94d('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xf94d('0xa')]=function(_0x1fdf1d,_0x3c464a){return _0x1fdf1d[_0xf94d('0xb')]('DeskAccount',attributes,{'tableName':_0xf94d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd27=['int_desk_accounts','lodash','../../config/logger','bluebird','request-promise','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount'];(function(_0x48dd11,_0x29ed05){var _0x26d688=function(_0x1f979f){while(--_0x1f979f){_0x48dd11['push'](_0x48dd11['shift']());}};_0x26d688(++_0x29ed05);}(_0xfd27,0x1cf));var _0x7fd2=function(_0x18a25e,_0x1e57a1){_0x18a25e=_0x18a25e-0x0;var _0x295336=_0xfd27[_0x18a25e];return _0x295336;};'use strict';var _=require(_0x7fd2('0x0'));var util=require('util');var logger=require(_0x7fd2('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7fd2('0x2'));var rp=require(_0x7fd2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7fd2('0x4'));var config=require('../../config/environment');var attributes=require(_0x7fd2('0x5'));var integrations=require(_0x7fd2('0x6'));module[_0x7fd2('0x7')]=function(_0x4315a9,_0x4ef3b1){return _0x4315a9[_0x7fd2('0x8')](_0x7fd2('0x9'),attributes,{'tableName':_0x7fd2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 8567caa..6a08759 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 _0xf8f5=['findAll','options','raw','attributes','limit','include','map','model','debug','ShowDeskAccount','find','where','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetDeskAccount','DeskAccount'];(function(_0x22bf37,_0x153433){var _0x405a9a=function(_0x448480){while(--_0x448480){_0x22bf37['push'](_0x22bf37['shift']());}};_0x405a9a(++_0x153433);}(_0xf8f5,0x182));var _0x5f8f=function(_0x733321,_0x116c3c){_0x733321=_0x733321-0x0;var _0x251bde=_0xf8f5[_0x733321];return _0x251bde;};'use strict';var _=require(_0x5f8f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5f8f('0x1'));var rs=require(_0x5f8f('0x2'));var fs=require('fs');var Redis=require(_0x5f8f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f8f('0x4'));var logger=require('../../config/logger')(_0x5f8f('0x5'));var config=require(_0x5f8f('0x6'));var jayson=require(_0x5f8f('0x7'));var client=jayson[_0x5f8f('0x8')][_0x5f8f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31c0a4,_0x49a004,_0x536118){return new BPromise(function(_0x520e9c,_0x103d47){return client[_0x5f8f('0xa')](_0x31c0a4,_0x536118)[_0x5f8f('0xb')](function(_0xc000d){logger[_0x5f8f('0xc')](_0x5f8f('0xd'),_0x49a004,'request\x20sent');logger['debug'](_0x5f8f('0xe'),_0x49a004,'request\x20sent',JSON[_0x5f8f('0xf')](_0xc000d));if(_0xc000d[_0x5f8f('0x10')]){if(_0xc000d[_0x5f8f('0x10')]['code']===0x1f4){logger[_0x5f8f('0x10')](_0x5f8f('0xd'),_0x49a004,_0xc000d[_0x5f8f('0x10')][_0x5f8f('0x11')]);return _0x103d47(_0xc000d[_0x5f8f('0x10')]['message']);}logger[_0x5f8f('0x10')]('DeskAccount,\x20%s,\x20%s',_0x49a004,_0xc000d['error']['message']);return _0x520e9c(_0xc000d[_0x5f8f('0x10')][_0x5f8f('0x11')]);}else{logger['info'](_0x5f8f('0xd'),_0x49a004,'request\x20sent');_0x520e9c(_0xc000d[_0x5f8f('0x12')][_0x5f8f('0x11')]);}})[_0x5f8f('0x13')](function(_0x209261){logger[_0x5f8f('0x10')](_0x5f8f('0xd'),_0x49a004,_0x209261);_0x103d47(_0x209261);});});}exports[_0x5f8f('0x14')]=function(_0xeb50e9){var _0x48ed34=this;return new Promise(function(_0x2d29b0,_0x33722f){return db[_0x5f8f('0x15')][_0x5f8f('0x16')]({'raw':_0xeb50e9['options']?_0xeb50e9[_0x5f8f('0x17')][_0x5f8f('0x18')]===undefined?!![]:![]:!![],'where':_0xeb50e9['options']?_0xeb50e9[_0x5f8f('0x17')]['where']||null:null,'attributes':_0xeb50e9[_0x5f8f('0x17')]?_0xeb50e9['options'][_0x5f8f('0x19')]||null:null,'limit':_0xeb50e9[_0x5f8f('0x17')]?_0xeb50e9[_0x5f8f('0x17')][_0x5f8f('0x1a')]||null:null,'include':_0xeb50e9[_0x5f8f('0x17')]?_0xeb50e9[_0x5f8f('0x17')][_0x5f8f('0x1b')]?_[_0x5f8f('0x1c')](_0xeb50e9[_0x5f8f('0x17')]['include'],function(_0x1ebc45){return{'model':db[_0x1ebc45[_0x5f8f('0x1d')]],'as':_0x1ebc45['as'],'attributes':_0x1ebc45['attributes'],'include':_0x1ebc45[_0x5f8f('0x1b')]?_['map'](_0x1ebc45[_0x5f8f('0x1b')],function(_0x4ee4e1){return{'model':db[_0x4ee4e1['model']],'as':_0x4ee4e1['as'],'attributes':_0x4ee4e1['attributes'],'include':_0x4ee4e1['include']?_['map'](_0x4ee4e1['include'],function(_0x1beeed){return{'model':db[_0x1beeed[_0x5f8f('0x1d')]],'as':_0x1beeed['as'],'attributes':_0x1beeed[_0x5f8f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5f8f('0xb')](function(_0x367ae5){logger[_0x5f8f('0xc')](_0x5f8f('0x14'),_0xeb50e9);logger[_0x5f8f('0x1e')](_0x5f8f('0x14'),_0xeb50e9,JSON['stringify'](_0x367ae5));_0x2d29b0(_0x367ae5);})[_0x5f8f('0x13')](function(_0x4f1ba5){logger[_0x5f8f('0x10')]('GetDeskAccount',_0x4f1ba5['message'],_0xeb50e9);_0x33722f(_0x48ed34[_0x5f8f('0x10')](0x1f4,_0x4f1ba5[_0x5f8f('0x11')]));});});};exports[_0x5f8f('0x1f')]=function(_0x411309){var _0x7f6857=this;return new Promise(function(_0xca271b,_0x130c67){return db[_0x5f8f('0x15')][_0x5f8f('0x20')]({'raw':_0x411309[_0x5f8f('0x17')]?_0x411309[_0x5f8f('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x411309['options']?_0x411309['options'][_0x5f8f('0x21')]||null:null,'attributes':_0x411309['options']?_0x411309['options'][_0x5f8f('0x19')]||null:null,'include':_0x411309['options']?_0x411309[_0x5f8f('0x17')][_0x5f8f('0x1b')]?_[_0x5f8f('0x1c')](_0x411309[_0x5f8f('0x17')][_0x5f8f('0x1b')],function(_0x98be36){return{'model':db[_0x98be36['model']],'as':_0x98be36['as'],'attributes':_0x98be36[_0x5f8f('0x19')],'include':_0x98be36['include']?_[_0x5f8f('0x1c')](_0x98be36[_0x5f8f('0x1b')],function(_0x2c4217){return{'model':db[_0x2c4217[_0x5f8f('0x1d')]],'as':_0x2c4217['as'],'attributes':_0x2c4217[_0x5f8f('0x19')],'include':_0x2c4217['include']?_[_0x5f8f('0x1c')](_0x2c4217['include'],function(_0x3c2318){return{'model':db[_0x3c2318[_0x5f8f('0x1d')]],'as':_0x3c2318['as'],'attributes':_0x3c2318[_0x5f8f('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30aac3){logger[_0x5f8f('0xc')](_0x5f8f('0x1f'),_0x411309);logger['debug'](_0x5f8f('0x1f'),_0x411309,JSON[_0x5f8f('0xf')](_0x30aac3));_0xca271b(_0x30aac3);})['catch'](function(_0x5cdb41){logger[_0x5f8f('0x10')](_0x5f8f('0x1f'),_0x5cdb41[_0x5f8f('0x11')],_0x411309);_0x130c67(_0x7f6857[_0x5f8f('0x10')](0x1f4,_0x5cdb41[_0x5f8f('0x11')]));});});}; \ No newline at end of file +var _0x42ea=['model','debug','ShowDeskAccount','DeskAccount','find','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetDeskAccount','findAll','options','raw','where','limit','map','attributes','include'];(function(_0x4d3643,_0x237edd){var _0xad041=function(_0x444399){while(--_0x444399){_0x4d3643['push'](_0x4d3643['shift']());}};_0xad041(++_0x237edd);}(_0x42ea,0xd7));var _0xa42e=function(_0x418d43,_0x40f819){_0x418d43=_0x418d43-0x0;var _0x1aecad=_0x42ea[_0x418d43];return _0x1aecad;};'use strict';var _=require(_0xa42e('0x0'));var util=require(_0xa42e('0x1'));var moment=require(_0xa42e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa42e('0x3'));var db=require(_0xa42e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa42e('0x5'))(_0xa42e('0x6'));var config=require('../../config/environment');var jayson=require(_0xa42e('0x7'));var client=jayson['client'][_0xa42e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12299b,_0x407d52,_0x40884f){return new BPromise(function(_0x46fc71,_0x357f6c){return client[_0xa42e('0x9')](_0x12299b,_0x40884f)[_0xa42e('0xa')](function(_0x13fa2b){logger['info'](_0xa42e('0xb'),_0x407d52,_0xa42e('0xc'));logger['debug'](_0xa42e('0xd'),_0x407d52,_0xa42e('0xc'),JSON[_0xa42e('0xe')](_0x13fa2b));if(_0x13fa2b[_0xa42e('0xf')]){if(_0x13fa2b['error'][_0xa42e('0x10')]===0x1f4){logger[_0xa42e('0xf')](_0xa42e('0xb'),_0x407d52,_0x13fa2b[_0xa42e('0xf')][_0xa42e('0x11')]);return _0x357f6c(_0x13fa2b['error']['message']);}logger['error'](_0xa42e('0xb'),_0x407d52,_0x13fa2b['error'][_0xa42e('0x11')]);return _0x46fc71(_0x13fa2b[_0xa42e('0xf')][_0xa42e('0x11')]);}else{logger[_0xa42e('0x12')]('DeskAccount,\x20%s,\x20%s',_0x407d52,_0xa42e('0xc'));_0x46fc71(_0x13fa2b[_0xa42e('0x13')][_0xa42e('0x11')]);}})[_0xa42e('0x14')](function(_0x5a58e6){logger['error'](_0xa42e('0xb'),_0x407d52,_0x5a58e6);_0x357f6c(_0x5a58e6);});});}exports[_0xa42e('0x15')]=function(_0xee9e20){var _0x2b60b8=this;return new Promise(function(_0x260939,_0xb835e4){return db['DeskAccount'][_0xa42e('0x16')]({'raw':_0xee9e20['options']?_0xee9e20[_0xa42e('0x17')][_0xa42e('0x18')]===undefined?!![]:![]:!![],'where':_0xee9e20[_0xa42e('0x17')]?_0xee9e20['options'][_0xa42e('0x19')]||null:null,'attributes':_0xee9e20[_0xa42e('0x17')]?_0xee9e20[_0xa42e('0x17')]['attributes']||null:null,'limit':_0xee9e20['options']?_0xee9e20[_0xa42e('0x17')][_0xa42e('0x1a')]||null:null,'include':_0xee9e20[_0xa42e('0x17')]?_0xee9e20['options']['include']?_[_0xa42e('0x1b')](_0xee9e20[_0xa42e('0x17')]['include'],function(_0x546392){return{'model':db[_0x546392['model']],'as':_0x546392['as'],'attributes':_0x546392[_0xa42e('0x1c')],'include':_0x546392[_0xa42e('0x1d')]?_[_0xa42e('0x1b')](_0x546392[_0xa42e('0x1d')],function(_0x26ec3a){return{'model':db[_0x26ec3a[_0xa42e('0x1e')]],'as':_0x26ec3a['as'],'attributes':_0x26ec3a[_0xa42e('0x1c')],'include':_0x26ec3a[_0xa42e('0x1d')]?_[_0xa42e('0x1b')](_0x26ec3a[_0xa42e('0x1d')],function(_0x645765){return{'model':db[_0x645765[_0xa42e('0x1e')]],'as':_0x645765['as'],'attributes':_0x645765[_0xa42e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa42e('0xa')](function(_0x48c1af){logger['info'](_0xa42e('0x15'),_0xee9e20);logger[_0xa42e('0x1f')](_0xa42e('0x15'),_0xee9e20,JSON['stringify'](_0x48c1af));_0x260939(_0x48c1af);})[_0xa42e('0x14')](function(_0x47239f){logger[_0xa42e('0xf')]('GetDeskAccount',_0x47239f[_0xa42e('0x11')],_0xee9e20);_0xb835e4(_0x2b60b8[_0xa42e('0xf')](0x1f4,_0x47239f[_0xa42e('0x11')]));});});};exports[_0xa42e('0x20')]=function(_0x45a190){var _0x4ec299=this;return new Promise(function(_0x24a044,_0x18f577){return db[_0xa42e('0x21')][_0xa42e('0x22')]({'raw':_0x45a190[_0xa42e('0x17')]?_0x45a190[_0xa42e('0x17')][_0xa42e('0x18')]===undefined?!![]:![]:!![],'where':_0x45a190[_0xa42e('0x17')]?_0x45a190[_0xa42e('0x17')][_0xa42e('0x19')]||null:null,'attributes':_0x45a190['options']?_0x45a190[_0xa42e('0x17')][_0xa42e('0x1c')]||null:null,'include':_0x45a190[_0xa42e('0x17')]?_0x45a190['options'][_0xa42e('0x1d')]?_[_0xa42e('0x1b')](_0x45a190['options']['include'],function(_0xefe038){return{'model':db[_0xefe038[_0xa42e('0x1e')]],'as':_0xefe038['as'],'attributes':_0xefe038[_0xa42e('0x1c')],'include':_0xefe038[_0xa42e('0x1d')]?_['map'](_0xefe038[_0xa42e('0x1d')],function(_0x2ff11e){return{'model':db[_0x2ff11e['model']],'as':_0x2ff11e['as'],'attributes':_0x2ff11e[_0xa42e('0x1c')],'include':_0x2ff11e[_0xa42e('0x1d')]?_[_0xa42e('0x1b')](_0x2ff11e[_0xa42e('0x1d')],function(_0x55c210){return{'model':db[_0x55c210['model']],'as':_0x55c210['as'],'attributes':_0x55c210['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x97f8c2){logger['info'](_0xa42e('0x20'),_0x45a190);logger[_0xa42e('0x1f')](_0xa42e('0x20'),_0x45a190,JSON[_0xa42e('0xe')](_0x97f8c2));_0x24a044(_0x97f8c2);})['catch'](function(_0x456098){logger[_0xa42e('0xf')](_0xa42e('0x20'),_0x456098['message'],_0x45a190);_0x18f577(_0x4ec299[_0xa42e('0xf')](0x1f4,_0x456098[_0xa42e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 74abc44..e2c63c3 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 _0x0650=['post','put','update','/:id','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','isAuthenticated','show','get','/:id/fields','getFields','/:id/subjects','/:id/descriptions','/:id/tags'];(function(_0x3d94ea,_0x455173){var _0x3aa0e5=function(_0x409554){while(--_0x409554){_0x3d94ea['push'](_0x3d94ea['shift']());}};_0x3aa0e5(++_0x455173);}(_0x0650,0xed));var _0x0065=function(_0x8d65d2,_0x17511d){_0x8d65d2=_0x8d65d2-0x0;var _0x109850=_0x0650[_0x8d65d2];return _0x109850;};'use strict';var multer=require(_0x0065('0x0'));var util=require('util');var path=require(_0x0065('0x1'));var timeout=require(_0x0065('0x2'));var express=require('express');var router=express[_0x0065('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0065('0x4'));var config=require(_0x0065('0x5'));var controller=require(_0x0065('0x6'));router['get']('/',auth[_0x0065('0x7')](),controller['index']);router['get']('/:id',auth[_0x0065('0x7')](),controller[_0x0065('0x8')]);router[_0x0065('0x9')](_0x0065('0xa'),auth[_0x0065('0x7')](),controller[_0x0065('0xb')]);router[_0x0065('0x9')](_0x0065('0xc'),auth[_0x0065('0x7')](),controller['getSubjects']);router[_0x0065('0x9')](_0x0065('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router['get'](_0x0065('0xe'),auth[_0x0065('0x7')](),controller['getTags']);router[_0x0065('0xf')]('/',auth[_0x0065('0x7')](),controller['create']);router[_0x0065('0xf')](_0x0065('0xe'),auth['isAuthenticated'](),controller['setTags']);router[_0x0065('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x0065('0x11')]);router['delete'](_0x0065('0x12'),auth['isAuthenticated'](),controller[_0x0065('0x13')]);module[_0x0065('0x14')]=router; \ No newline at end of file +var _0xee8f=['getDescriptions','/:id/tags','create','post','setTags','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xee8f,0x1ed));var _0xfee8=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xee8f[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0xfee8('0x0'));var path=require('path');var timeout=require(_0xfee8('0x1'));var express=require(_0xfee8('0x2'));var router=express[_0xfee8('0x3')]();var auth=require(_0xfee8('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDeskConfiguration.controller');router[_0xfee8('0x5')]('/',auth[_0xfee8('0x6')](),controller[_0xfee8('0x7')]);router['get'](_0xfee8('0x8'),auth[_0xfee8('0x6')](),controller['show']);router['get'](_0xfee8('0x9'),auth[_0xfee8('0x6')](),controller[_0xfee8('0xa')]);router['get']('/:id/subjects',auth[_0xfee8('0x6')](),controller[_0xfee8('0xb')]);router[_0xfee8('0x5')](_0xfee8('0xc'),auth[_0xfee8('0x6')](),controller[_0xfee8('0xd')]);router[_0xfee8('0x5')](_0xfee8('0xe'),auth['isAuthenticated'](),controller['getTags']);router['post']('/',auth[_0xfee8('0x6')](),controller[_0xfee8('0xf')]);router[_0xfee8('0x10')]('/:id/tags',auth['isAuthenticated'](),controller[_0xfee8('0x11')]);router[_0xfee8('0x12')](_0xfee8('0x8'),auth[_0xfee8('0x6')](),controller[_0xfee8('0x13')]);router[_0xfee8('0x14')](_0xfee8('0x8'),auth[_0xfee8('0x6')](),controller[_0xfee8('0x15')]);module[_0xfee8('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 34aedad..494d13e 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 _0x2823=['sequelize','exports','STRING'];(function(_0x7880d2,_0x32e7d6){var _0x35ebbe=function(_0x5c27fa){while(--_0x5c27fa){_0x7880d2['push'](_0x7880d2['shift']());}};_0x35ebbe(++_0x32e7d6);}(_0x2823,0x13b));var _0x3282=function(_0x585f77,_0x4df7ce){_0x585f77=_0x585f77-0x0;var _0x19aff3=_0x2823[_0x585f77];return _0x19aff3;};'use strict';var Sequelize=require(_0x3282('0x0'));module[_0x3282('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3282('0x2')]}}; \ No newline at end of file +var _0x607c=['exports','STRING','sequelize'];(function(_0x18ad43,_0x499a7d){var _0x2ee5e0=function(_0x27f9e9){while(--_0x27f9e9){_0x18ad43['push'](_0x18ad43['shift']());}};_0x2ee5e0(++_0x499a7d);}(_0x607c,0xe9));var _0xc607=function(_0x2d4611,_0x41ef45){_0x2d4611=_0x2d4611-0x0;var _0x89d16c=_0x607c[_0x2d4611];return _0x89d16c;};'use strict';var Sequelize=require(_0xc607('0x0'));module[_0xc607('0x1')]={'name':{'type':Sequelize[_0xc607('0x2')]},'description':{'type':Sequelize[_0xc607('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 8eae7e8..70e62db 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 _0x26bc=['limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','show','params','includeAll','find','create','body','getFields','findOne','DeskField','order','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','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','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset'];(function(_0x3e5cd3,_0x17c4b2){var _0x1e8bd0=function(_0x3e2290){while(--_0x3e2290){_0x3e5cd3['push'](_0x3e5cd3['shift']());}};_0x1e8bd0(++_0x17c4b2);}(_0x26bc,0x162));var _0xc26b=function(_0x5d2ad3,_0x1de02d){_0x5d2ad3=_0x5d2ad3-0x0;var _0x61694d=_0x26bc[_0x5d2ad3];return _0x61694d;};'use strict';var pdf=require(_0xc26b('0x0'));var emlformat=require(_0xc26b('0x1'));var rimraf=require(_0xc26b('0x2'));var zipdir=require(_0xc26b('0x3'));var jsonpatch=require(_0xc26b('0x4'));var rp=require('request-promise');var moment=require(_0xc26b('0x5'));var BPromise=require(_0xc26b('0x6'));var Mustache=require(_0xc26b('0x7'));var util=require('util');var path=require(_0xc26b('0x8'));var sox=require('sox');var csv=require(_0xc26b('0x9'));var ejs=require(_0xc26b('0xa'));var fs=require('fs');var _=require(_0xc26b('0xb'));var squel=require('squel');var crypto=require(_0xc26b('0xc'));var jsforce=require(_0xc26b('0xd'));var deskjs=require(_0xc26b('0xe'));var toCsv=require(_0xc26b('0x9'));var querystring=require(_0xc26b('0xf'));var Papa=require(_0xc26b('0x10'));var Redis=require(_0xc26b('0x11'));var authService=require(_0xc26b('0x12'));var qs=require(_0xc26b('0x13'));var as=require(_0xc26b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc26b('0x15'))(_0xc26b('0x16'));var utils=require(_0xc26b('0x17'));var config=require(_0xc26b('0x18'));var db=require(_0xc26b('0x19'))['db'];var jayson=require(_0xc26b('0x1a'));var client=jayson['client'][_0xc26b('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x5a95fc,_0x56da8b,_0x6e808f){if(_0x6e808f){var _0x438621=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x438621[_0xc26b('0x1c')](_0x56da8b)){return _0x5a95fc;}else{throw new db[(_0xc26b('0x1d'))]['ValidationError'](_0xc26b('0x1e'));}}else{return _0x5a95fc;}}function respondWithRpcPromise(_0x2ee630,_0x19be02,_0x5bd8c4,_0x20f796){return new BPromise(function(_0x34e006,_0x4dc407){var _0x248645=_0x20f796||client;return _0x248645[_0xc26b('0x1f')](_0x2ee630,_0x5bd8c4)['then'](function(_0x1dba27){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x19be02,_0xc26b('0x20'));logger['debug'](_0xc26b('0x21'),_0x19be02,_0xc26b('0x20'),JSON[_0xc26b('0x22')](_0x1dba27));if(_0x1dba27[_0xc26b('0x23')]){if(_0x1dba27['error'][_0xc26b('0x24')]===0x1f4){logger[_0xc26b('0x23')](_0xc26b('0x25'),_0x19be02,_0x1dba27[_0xc26b('0x23')][_0xc26b('0x26')]);return _0x4dc407(_0x1dba27[_0xc26b('0x23')]['message']);}logger[_0xc26b('0x23')]('DeskConfiguration,\x20%s,\x20%s',_0x19be02,_0x1dba27[_0xc26b('0x23')][_0xc26b('0x26')]);return _0x34e006(_0x1dba27[_0xc26b('0x23')][_0xc26b('0x26')]);}else{logger['info'](_0xc26b('0x25'),_0x19be02,_0xc26b('0x20'));_0x34e006(_0x1dba27[_0xc26b('0x27')][_0xc26b('0x26')]);}})['catch'](function(_0x379cdb){logger[_0xc26b('0x23')]('DeskConfiguration,\x20%s,\x20%s',_0x19be02,_0x379cdb);_0x4dc407(_0x379cdb);});});}function respondWithStatusCode(_0x4c0095,_0x203374){_0x203374=_0x203374||0xcc;return function(_0x1bb8e5){if(_0x1bb8e5){return _0x4c0095[_0xc26b('0x28')](_0x203374);}return _0x4c0095[_0xc26b('0x29')](_0x203374)[_0xc26b('0x2a')]();};}function respondWithResult(_0x20a84f,_0x4e6cc6){_0x4e6cc6=_0x4e6cc6||0xc8;return function(_0x3eea3b){if(_0x3eea3b){return _0x20a84f['status'](_0x4e6cc6)[_0xc26b('0x2b')](_0x3eea3b);}};}function respondWithFilteredResult(_0x6ec732,_0x302485){return function(_0x5422df){if(_0x5422df){var _0x1f7d2e=_0x5422df[_0xc26b('0x2c')],_0x3459d3=_0x302485[_0xc26b('0x2d')],_0x17c93e=_0x302485['offset']+_0x302485[_0xc26b('0x2e')],_0x1dd5d4;if(_0x17c93e>=_0x1f7d2e){_0x17c93e=_0x1f7d2e;_0x1dd5d4=0xc8;}else{_0x1dd5d4=0xce;}_0x6ec732['status'](_0x1dd5d4);return _0x6ec732[_0xc26b('0x2f')]('Content-Range',_0x3459d3+'-'+_0x17c93e+'/'+_0x1f7d2e)['json'](_0x5422df);}return null;};}function patchUpdates(_0x4681ac){return function(_0x405e37){try{jsonpatch[_0xc26b('0x30')](_0x405e37,_0x4681ac,!![]);}catch(_0x49c679){return BPromise[_0xc26b('0x31')](_0x49c679);}return _0x405e37[_0xc26b('0x32')]();};}function saveUpdates(_0x555907,_0x16479a){return function(_0x764fef){if(_0x764fef){return _0x764fef[_0xc26b('0x33')](_0x555907)[_0xc26b('0x34')](function(_0x299bb7){return _0x299bb7;});}return null;};}function removeEntity(_0x1a17bd,_0x110ad6){return function(_0x128c11){if(_0x128c11){return _0x128c11[_0xc26b('0x35')]()[_0xc26b('0x34')](function(){_0x1a17bd['status'](0xcc)[_0xc26b('0x2a')]();});}};}function handleEntityNotFound(_0x574aae,_0x2458f7){return function(_0x27e0d8){if(!_0x27e0d8){_0x574aae['sendStatus'](0x194);}return _0x27e0d8;};}function handleError(_0x69e8ca,_0x150fab){_0x150fab=_0x150fab||0x1f4;return function(_0x3c3fa7){logger[_0xc26b('0x23')](_0x3c3fa7[_0xc26b('0x36')]);if(_0x3c3fa7[_0xc26b('0x37')]){delete _0x3c3fa7[_0xc26b('0x37')];}_0x69e8ca[_0xc26b('0x29')](_0x150fab)[_0xc26b('0x38')](_0x3c3fa7);};}exports[_0xc26b('0x39')]=function(_0x4c969f,_0x2f218f){var _0x2615ac={},_0x412a19={},_0x2fa216={'count':0x0,'rows':[]};var _0x2634b9=_[_0xc26b('0x3a')](db[_0xc26b('0x3b')][_0xc26b('0x3c')],function(_0x3f1c24){return{'name':_0x3f1c24[_0xc26b('0x3d')],'type':_0x3f1c24[_0xc26b('0x3e')][_0xc26b('0x3f')]};});_0x412a19[_0xc26b('0x40')]=_[_0xc26b('0x3a')](_0x2634b9,_0xc26b('0x37'));_0x412a19['query']=_[_0xc26b('0x41')](_0x4c969f['query']);_0x412a19[_0xc26b('0x42')]=_[_0xc26b('0x43')](_0x412a19['model'],_0x412a19['query']);_0x2615ac[_0xc26b('0x44')]=_[_0xc26b('0x43')](_0x412a19[_0xc26b('0x40')],qs['fields'](_0x4c969f['query'][_0xc26b('0x45')]));_0x2615ac[_0xc26b('0x44')]=_0x2615ac[_0xc26b('0x44')][_0xc26b('0x46')]?_0x2615ac[_0xc26b('0x44')]:_0x412a19[_0xc26b('0x40')];if(!_0x4c969f[_0xc26b('0x47')][_0xc26b('0x48')](_0xc26b('0x49'))){_0x2615ac[_0xc26b('0x2e')]=qs[_0xc26b('0x2e')](_0x4c969f['query'][_0xc26b('0x2e')]);_0x2615ac[_0xc26b('0x2d')]=qs[_0xc26b('0x2d')](_0x4c969f[_0xc26b('0x47')]['offset']);}_0x2615ac['order']=qs[_0xc26b('0x4a')](_0x4c969f['query'][_0xc26b('0x4a')]);_0x2615ac[_0xc26b('0x4b')]=qs[_0xc26b('0x42')](_[_0xc26b('0x4c')](_0x4c969f[_0xc26b('0x47')],_0x412a19[_0xc26b('0x42')]),_0x2634b9);if(_0x4c969f[_0xc26b('0x47')]['filter']){_0x2615ac['where']=_[_0xc26b('0x4d')](_0x2615ac[_0xc26b('0x4b')],{'$or':_[_0xc26b('0x3a')](_0x2634b9,function(_0x3d9bb7){if(_0x3d9bb7['type']!==_0xc26b('0x4e')){var _0x4a1b11={};_0x4a1b11[_0x3d9bb7[_0xc26b('0x37')]]={'$like':'%'+_0x4c969f[_0xc26b('0x47')][_0xc26b('0x4f')]+'%'};return _0x4a1b11;}})});}_0x2615ac=_[_0xc26b('0x4d')]({},_0x2615ac,_0x4c969f[_0xc26b('0x50')]);var _0x4909fa={'where':_0x2615ac[_0xc26b('0x4b')]};return db['DeskConfiguration'][_0xc26b('0x2c')](_0x4909fa)[_0xc26b('0x34')](function(_0x3fa59a){_0x2fa216[_0xc26b('0x2c')]=_0x3fa59a;if(_0x4c969f['query']['includeAll']){_0x2615ac[_0xc26b('0x51')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x2615ac);})[_0xc26b('0x34')](function(_0xe9b2fb){_0x2fa216[_0xc26b('0x52')]=_0xe9b2fb;return _0x2fa216;})[_0xc26b('0x34')](respondWithFilteredResult(_0x2f218f,_0x2615ac))[_0xc26b('0x53')](handleError(_0x2f218f,null));};exports[_0xc26b('0x54')]=function(_0xae0d85,_0x16933f){var _0x3bef7f={'raw':![],'where':{'id':_0xae0d85[_0xc26b('0x55')]['id']}},_0x16dff3={};_0x16dff3[_0xc26b('0x40')]=_[_0xc26b('0x41')](db[_0xc26b('0x3b')]['rawAttributes']);_0x16dff3['query']=_[_0xc26b('0x41')](_0xae0d85[_0xc26b('0x47')]);_0x16dff3[_0xc26b('0x42')]=_[_0xc26b('0x43')](_0x16dff3['model'],_0x16dff3[_0xc26b('0x47')]);_0x3bef7f['attributes']=_[_0xc26b('0x43')](_0x16dff3[_0xc26b('0x40')],qs['fields'](_0xae0d85[_0xc26b('0x47')]['fields']));_0x3bef7f['attributes']=_0x3bef7f['attributes']['length']?_0x3bef7f[_0xc26b('0x44')]:_0x16dff3[_0xc26b('0x40')];if(_0xae0d85[_0xc26b('0x47')][_0xc26b('0x56')]){_0x3bef7f['include']=[{'all':!![]}];}_0x3bef7f=_['merge']({},_0x3bef7f,_0xae0d85[_0xc26b('0x50')]);return db['DeskConfiguration'][_0xc26b('0x57')](_0x3bef7f)[_0xc26b('0x34')](handleEntityNotFound(_0x16933f,null))['then'](respondWithResult(_0x16933f,null))[_0xc26b('0x53')](handleError(_0x16933f,null));};exports[_0xc26b('0x58')]=function(_0x479fe8,_0x13354f){return db[_0xc26b('0x3b')][_0xc26b('0x58')](_0x479fe8[_0xc26b('0x59')],{})[_0xc26b('0x34')](respondWithResult(_0x13354f,0xc9))[_0xc26b('0x53')](handleError(_0x13354f,null));};exports[_0xc26b('0x33')]=function(_0x4e0519,_0x30f079){if(_0x4e0519[_0xc26b('0x59')]['id']){delete _0x4e0519[_0xc26b('0x59')]['id'];}return db[_0xc26b('0x3b')][_0xc26b('0x57')]({'where':{'id':_0x4e0519[_0xc26b('0x55')]['id']}})[_0xc26b('0x34')](handleEntityNotFound(_0x30f079,null))[_0xc26b('0x34')](saveUpdates(_0x4e0519[_0xc26b('0x59')],null))[_0xc26b('0x34')](respondWithResult(_0x30f079,null))['catch'](handleError(_0x30f079,null));};exports[_0xc26b('0x35')]=function(_0xfd7e42,_0x14ec36){return db[_0xc26b('0x3b')][_0xc26b('0x57')]({'where':{'id':_0xfd7e42[_0xc26b('0x55')]['id']}})[_0xc26b('0x34')](handleEntityNotFound(_0x14ec36,null))[_0xc26b('0x34')](removeEntity(_0x14ec36,null))[_0xc26b('0x53')](handleError(_0x14ec36,null));};exports[_0xc26b('0x5a')]=function(_0x1a3506,_0x544853,_0x572280){var _0xee9365={};var _0x5c651f={};var _0x3a1907;var _0xcc268;return db[_0xc26b('0x3b')][_0xc26b('0x5b')]({'where':{'id':_0x1a3506['params']['id']}})[_0xc26b('0x34')](handleEntityNotFound(_0x544853,null))[_0xc26b('0x34')](function(_0x106b07){if(_0x106b07){_0x3a1907=_0x106b07;_0x5c651f[_0xc26b('0x40')]=_[_0xc26b('0x41')](db[_0xc26b('0x5c')]['rawAttributes']);_0x5c651f[_0xc26b('0x47')]=_[_0xc26b('0x41')](_0x1a3506['query']);_0x5c651f[_0xc26b('0x42')]=_[_0xc26b('0x43')](_0x5c651f[_0xc26b('0x40')],_0x5c651f[_0xc26b('0x47')]);_0xee9365[_0xc26b('0x44')]=_[_0xc26b('0x43')](_0x5c651f[_0xc26b('0x40')],qs[_0xc26b('0x45')](_0x1a3506[_0xc26b('0x47')][_0xc26b('0x45')]));_0xee9365['attributes']=_0xee9365[_0xc26b('0x44')]['length']?_0xee9365['attributes']:_0x5c651f[_0xc26b('0x40')];_0xee9365[_0xc26b('0x5d')]=qs[_0xc26b('0x4a')](_0x1a3506[_0xc26b('0x47')][_0xc26b('0x4a')]);_0xee9365['where']=qs['filters'](_[_0xc26b('0x4c')](_0x1a3506[_0xc26b('0x47')],_0x5c651f['filters']));if(_0x1a3506['query'][_0xc26b('0x4f')]){_0xee9365['where']=_['merge'](_0xee9365['where'],{'$or':_[_0xc26b('0x3a')](_0xee9365[_0xc26b('0x44')],function(_0x365dd9){var _0xd5f27d={};_0xd5f27d[_0x365dd9]={'$like':'%'+_0x1a3506['query'][_0xc26b('0x4f')]+'%'};return _0xd5f27d;})});}_0xee9365=_['merge']({},_0xee9365,_0x1a3506[_0xc26b('0x50')]);return _0x3a1907[_0xc26b('0x5a')](_0xee9365);}})[_0xc26b('0x34')](function(_0xd5ab2d){if(_0xd5ab2d){_0xcc268=_0xd5ab2d['length'];if(!_0x1a3506[_0xc26b('0x47')]['hasOwnProperty'](_0xc26b('0x49'))){_0xee9365[_0xc26b('0x2e')]=qs[_0xc26b('0x2e')](_0x1a3506[_0xc26b('0x47')][_0xc26b('0x2e')]);_0xee9365[_0xc26b('0x2d')]=qs[_0xc26b('0x2d')](_0x1a3506[_0xc26b('0x47')][_0xc26b('0x2d')]);}return _0x3a1907[_0xc26b('0x5a')](_0xee9365);}})['then'](function(_0x3dbf8e){if(_0x3dbf8e){return _0x3dbf8e?{'count':_0xcc268,'rows':_0x3dbf8e}:null;}})[_0xc26b('0x34')](respondWithResult(_0x544853,null))[_0xc26b('0x53')](handleError(_0x544853,null));};exports[_0xc26b('0x5e')]=function(_0x418cd7,_0x34ef71,_0x1c00db){var _0x2bb2c4={};var _0x29b4c9={};var _0x23118c;var _0x288c2c;return db[_0xc26b('0x3b')][_0xc26b('0x5b')]({'where':{'id':_0x418cd7['params']['id']}})[_0xc26b('0x34')](handleEntityNotFound(_0x34ef71,null))[_0xc26b('0x34')](function(_0x320eae){if(_0x320eae){_0x23118c=_0x320eae;_0x29b4c9[_0xc26b('0x40')]=_[_0xc26b('0x41')](db['DeskField'][_0xc26b('0x3c')]);_0x29b4c9['query']=_[_0xc26b('0x41')](_0x418cd7[_0xc26b('0x47')]);_0x29b4c9['filters']=_[_0xc26b('0x43')](_0x29b4c9[_0xc26b('0x40')],_0x29b4c9[_0xc26b('0x47')]);_0x2bb2c4[_0xc26b('0x44')]=_[_0xc26b('0x43')](_0x29b4c9[_0xc26b('0x40')],qs[_0xc26b('0x45')](_0x418cd7[_0xc26b('0x47')][_0xc26b('0x45')]));_0x2bb2c4[_0xc26b('0x44')]=_0x2bb2c4[_0xc26b('0x44')][_0xc26b('0x46')]?_0x2bb2c4['attributes']:_0x29b4c9[_0xc26b('0x40')];_0x2bb2c4[_0xc26b('0x5d')]=qs['sort'](_0x418cd7['query'][_0xc26b('0x4a')]);_0x2bb2c4[_0xc26b('0x4b')]=qs[_0xc26b('0x42')](_[_0xc26b('0x4c')](_0x418cd7['query'],_0x29b4c9[_0xc26b('0x42')]));if(_0x418cd7[_0xc26b('0x47')]['filter']){_0x2bb2c4[_0xc26b('0x4b')]=_['merge'](_0x2bb2c4[_0xc26b('0x4b')],{'$or':_[_0xc26b('0x3a')](_0x2bb2c4['attributes'],function(_0x4cb1d4){var _0x32f9d0={};_0x32f9d0[_0x4cb1d4]={'$like':'%'+_0x418cd7[_0xc26b('0x47')][_0xc26b('0x4f')]+'%'};return _0x32f9d0;})});}_0x2bb2c4=_['merge']({},_0x2bb2c4,_0x418cd7[_0xc26b('0x50')]);return _0x23118c[_0xc26b('0x5e')](_0x2bb2c4);}})[_0xc26b('0x34')](function(_0x3b3b89){if(_0x3b3b89){_0x288c2c=_0x3b3b89['length'];if(!_0x418cd7[_0xc26b('0x47')]['hasOwnProperty'](_0xc26b('0x49'))){_0x2bb2c4[_0xc26b('0x2e')]=qs[_0xc26b('0x2e')](_0x418cd7[_0xc26b('0x47')]['limit']);_0x2bb2c4[_0xc26b('0x2d')]=qs[_0xc26b('0x2d')](_0x418cd7[_0xc26b('0x47')]['offset']);}return _0x23118c[_0xc26b('0x5e')](_0x2bb2c4);}})['then'](function(_0x1ff2da){if(_0x1ff2da){return _0x1ff2da?{'count':_0x288c2c,'rows':_0x1ff2da}:null;}})[_0xc26b('0x34')](respondWithResult(_0x34ef71,null))[_0xc26b('0x53')](handleError(_0x34ef71,null));};exports['getDescriptions']=function(_0x21de4f,_0x8de9cc,_0x518f4a){var _0x37dc40={};var _0x8c257f={};var _0x428e68;var _0x314745;return db[_0xc26b('0x3b')][_0xc26b('0x5b')]({'where':{'id':_0x21de4f[_0xc26b('0x55')]['id']}})[_0xc26b('0x34')](handleEntityNotFound(_0x8de9cc,null))[_0xc26b('0x34')](function(_0x29aa3a){if(_0x29aa3a){_0x428e68=_0x29aa3a;_0x8c257f[_0xc26b('0x40')]=_[_0xc26b('0x41')](db[_0xc26b('0x5c')][_0xc26b('0x3c')]);_0x8c257f[_0xc26b('0x47')]=_[_0xc26b('0x41')](_0x21de4f[_0xc26b('0x47')]);_0x8c257f[_0xc26b('0x42')]=_['intersection'](_0x8c257f['model'],_0x8c257f[_0xc26b('0x47')]);_0x37dc40['attributes']=_[_0xc26b('0x43')](_0x8c257f[_0xc26b('0x40')],qs[_0xc26b('0x45')](_0x21de4f[_0xc26b('0x47')][_0xc26b('0x45')]));_0x37dc40[_0xc26b('0x44')]=_0x37dc40['attributes'][_0xc26b('0x46')]?_0x37dc40[_0xc26b('0x44')]:_0x8c257f[_0xc26b('0x40')];_0x37dc40[_0xc26b('0x5d')]=qs[_0xc26b('0x4a')](_0x21de4f[_0xc26b('0x47')][_0xc26b('0x4a')]);_0x37dc40[_0xc26b('0x4b')]=qs[_0xc26b('0x42')](_[_0xc26b('0x4c')](_0x21de4f[_0xc26b('0x47')],_0x8c257f[_0xc26b('0x42')]));if(_0x21de4f['query'][_0xc26b('0x4f')]){_0x37dc40['where']=_['merge'](_0x37dc40[_0xc26b('0x4b')],{'$or':_[_0xc26b('0x3a')](_0x37dc40['attributes'],function(_0x322fcb){var _0x2a499b={};_0x2a499b[_0x322fcb]={'$like':'%'+_0x21de4f[_0xc26b('0x47')]['filter']+'%'};return _0x2a499b;})});}_0x37dc40=_[_0xc26b('0x4d')]({},_0x37dc40,_0x21de4f[_0xc26b('0x50')]);return _0x428e68[_0xc26b('0x5f')](_0x37dc40);}})[_0xc26b('0x34')](function(_0x32c85a){if(_0x32c85a){_0x314745=_0x32c85a[_0xc26b('0x46')];if(!_0x21de4f[_0xc26b('0x47')][_0xc26b('0x48')](_0xc26b('0x49'))){_0x37dc40[_0xc26b('0x2e')]=qs[_0xc26b('0x2e')](_0x21de4f['query']['limit']);_0x37dc40[_0xc26b('0x2d')]=qs['offset'](_0x21de4f[_0xc26b('0x47')][_0xc26b('0x2d')]);}return _0x428e68[_0xc26b('0x5f')](_0x37dc40);}})[_0xc26b('0x34')](function(_0x4e04ea){if(_0x4e04ea){return _0x4e04ea?{'count':_0x314745,'rows':_0x4e04ea}:null;}})[_0xc26b('0x34')](respondWithResult(_0x8de9cc,null))[_0xc26b('0x53')](handleError(_0x8de9cc,null));};exports[_0xc26b('0x60')]=function(_0x5e8e76,_0x9855b8,_0x34a5a3){var _0x1805da={};var _0x2b0efd={};var _0x5f173b;var _0x2fa794;return db[_0xc26b('0x3b')][_0xc26b('0x5b')]({'where':{'id':_0x5e8e76[_0xc26b('0x55')]['id']}})[_0xc26b('0x34')](handleEntityNotFound(_0x9855b8,null))[_0xc26b('0x34')](function(_0x41e3b3){if(_0x41e3b3){_0x5f173b=_0x41e3b3;_0x2b0efd[_0xc26b('0x40')]=_[_0xc26b('0x41')](db[_0xc26b('0x61')][_0xc26b('0x3c')]);_0x2b0efd[_0xc26b('0x47')]=_[_0xc26b('0x41')](_0x5e8e76[_0xc26b('0x47')]);_0x2b0efd[_0xc26b('0x42')]=_[_0xc26b('0x43')](_0x2b0efd[_0xc26b('0x40')],_0x2b0efd[_0xc26b('0x47')]);_0x1805da[_0xc26b('0x44')]=_[_0xc26b('0x43')](_0x2b0efd[_0xc26b('0x40')],qs[_0xc26b('0x45')](_0x5e8e76[_0xc26b('0x47')][_0xc26b('0x45')]));_0x1805da[_0xc26b('0x44')]=_0x1805da['attributes'][_0xc26b('0x46')]?_0x1805da[_0xc26b('0x44')]:_0x2b0efd[_0xc26b('0x40')];_0x1805da[_0xc26b('0x5d')]=qs[_0xc26b('0x4a')](_0x5e8e76[_0xc26b('0x47')][_0xc26b('0x4a')]);_0x1805da[_0xc26b('0x4b')]=qs['filters'](_[_0xc26b('0x4c')](_0x5e8e76[_0xc26b('0x47')],_0x2b0efd[_0xc26b('0x42')]));if(_0x5e8e76[_0xc26b('0x47')][_0xc26b('0x4f')]){_0x1805da[_0xc26b('0x4b')]=_[_0xc26b('0x4d')](_0x1805da['where'],{'$or':_[_0xc26b('0x3a')](_0x1805da[_0xc26b('0x44')],function(_0x2572c7){var _0x65928e={};_0x65928e[_0x2572c7]={'$like':'%'+_0x5e8e76['query'][_0xc26b('0x4f')]+'%'};return _0x65928e;})});}_0x1805da=_[_0xc26b('0x4d')]({},_0x1805da,_0x5e8e76[_0xc26b('0x50')]);return _0x5f173b[_0xc26b('0x60')](_0x1805da);}})[_0xc26b('0x34')](function(_0x30a9ea){if(_0x30a9ea){_0x2fa794=_0x30a9ea[_0xc26b('0x46')];if(!_0x5e8e76['query'][_0xc26b('0x48')](_0xc26b('0x49'))){_0x1805da['limit']=qs[_0xc26b('0x2e')](_0x5e8e76['query'][_0xc26b('0x2e')]);_0x1805da['offset']=qs[_0xc26b('0x2d')](_0x5e8e76[_0xc26b('0x47')]['offset']);}return _0x5f173b[_0xc26b('0x60')](_0x1805da);}})['then'](function(_0x55382c){if(_0x55382c){return _0x55382c?{'count':_0x2fa794,'rows':_0x55382c}:null;}})['then'](respondWithResult(_0x9855b8,null))[_0xc26b('0x53')](handleError(_0x9855b8,null));};exports[_0xc26b('0x62')]=function(_0x20175a,_0x3e7657,_0x49eec1){if(_0x20175a['body']['id']){delete _0x20175a[_0xc26b('0x59')]['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x20175a[_0xc26b('0x55')]['id']}})[_0xc26b('0x34')](handleEntityNotFound(_0x3e7657,null))[_0xc26b('0x34')](function(_0x32cb9c){if(_0x32cb9c){return _0x32cb9c['setTags'](_0x20175a[_0xc26b('0x59')][_0xc26b('0x63')]||[]);}return null;})[_0xc26b('0x34')](respondWithResult(_0x3e7657,null))['catch'](handleError(_0x3e7657,null));}; \ No newline at end of file +var _0xb2b3=['destroy','getFields','findOne','pick','getSubjects','DeskField','getDescriptions','Tag','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','status','end','json','count','offset','limit','set','apply','reject','save','update','sendStatus','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','merge','create','body','find'];(function(_0x53f28c,_0x2476e8){var _0x31a8d3=function(_0x46d2e3){while(--_0x46d2e3){_0x53f28c['push'](_0x53f28c['shift']());}};_0x31a8d3(++_0x2476e8);}(_0xb2b3,0x71));var _0x3b2b=function(_0xb9e3f,_0x154746){_0xb9e3f=_0xb9e3f-0x0;var _0x565ecb=_0xb2b3[_0xb9e3f];return _0x565ecb;};'use strict';var pdf=require(_0x3b2b('0x0'));var emlformat=require(_0x3b2b('0x1'));var rimraf=require(_0x3b2b('0x2'));var zipdir=require(_0x3b2b('0x3'));var jsonpatch=require(_0x3b2b('0x4'));var rp=require(_0x3b2b('0x5'));var moment=require(_0x3b2b('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x3b2b('0x7'));var util=require(_0x3b2b('0x8'));var path=require(_0x3b2b('0x9'));var sox=require(_0x3b2b('0xa'));var csv=require(_0x3b2b('0xb'));var ejs=require(_0x3b2b('0xc'));var fs=require('fs');var _=require(_0x3b2b('0xd'));var squel=require(_0x3b2b('0xe'));var crypto=require(_0x3b2b('0xf'));var jsforce=require(_0x3b2b('0x10'));var deskjs=require(_0x3b2b('0x11'));var toCsv=require(_0x3b2b('0xb'));var querystring=require('querystring');var Papa=require(_0x3b2b('0x12'));var Redis=require(_0x3b2b('0x13'));var authService=require(_0x3b2b('0x14'));var qs=require(_0x3b2b('0x15'));var as=require(_0x3b2b('0x16'));var hardwareService=require(_0x3b2b('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x3b2b('0x18'));var config=require(_0x3b2b('0x19'));var db=require(_0x3b2b('0x1a'))['db'];var jayson=require(_0x3b2b('0x1b'));var client=jayson['client'][_0x3b2b('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x20d753,_0x23b81b,_0x438717){if(_0x438717){var _0x37abde=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x37abde[_0x3b2b('0x1d')](_0x23b81b)){return _0x20d753;}else{throw new db['Sequelize'][(_0x3b2b('0x1e'))](_0x3b2b('0x1f'));}}else{return _0x20d753;}}function respondWithRpcPromise(_0x5130fd,_0x3224ec,_0x2c186a,_0x9f0aa){return new BPromise(function(_0x5593e4,_0x2ab175){var _0x4d17c5=_0x9f0aa||client;return _0x4d17c5[_0x3b2b('0x20')](_0x5130fd,_0x2c186a)[_0x3b2b('0x21')](function(_0x57a2b4){logger['info'](_0x3b2b('0x22'),_0x3224ec,'request\x20sent');logger[_0x3b2b('0x23')](_0x3b2b('0x24'),_0x3224ec,'request\x20sent',JSON[_0x3b2b('0x25')](_0x57a2b4));if(_0x57a2b4['error']){if(_0x57a2b4[_0x3b2b('0x26')][_0x3b2b('0x27')]===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x3224ec,_0x57a2b4[_0x3b2b('0x26')][_0x3b2b('0x28')]);return _0x2ab175(_0x57a2b4[_0x3b2b('0x26')][_0x3b2b('0x28')]);}logger[_0x3b2b('0x26')](_0x3b2b('0x22'),_0x3224ec,_0x57a2b4[_0x3b2b('0x26')][_0x3b2b('0x28')]);return _0x5593e4(_0x57a2b4[_0x3b2b('0x26')][_0x3b2b('0x28')]);}else{logger[_0x3b2b('0x29')]('DeskConfiguration,\x20%s,\x20%s',_0x3224ec,_0x3b2b('0x2a'));_0x5593e4(_0x57a2b4[_0x3b2b('0x2b')][_0x3b2b('0x28')]);}})['catch'](function(_0x306739){logger['error'](_0x3b2b('0x22'),_0x3224ec,_0x306739);_0x2ab175(_0x306739);});});}function respondWithStatusCode(_0x50d2e5,_0x3ec4f0){_0x3ec4f0=_0x3ec4f0||0xcc;return function(_0x5df93e){if(_0x5df93e){return _0x50d2e5['sendStatus'](_0x3ec4f0);}return _0x50d2e5[_0x3b2b('0x2c')](_0x3ec4f0)[_0x3b2b('0x2d')]();};}function respondWithResult(_0x11313d,_0x268da7){_0x268da7=_0x268da7||0xc8;return function(_0x73967){if(_0x73967){return _0x11313d[_0x3b2b('0x2c')](_0x268da7)[_0x3b2b('0x2e')](_0x73967);}};}function respondWithFilteredResult(_0x185830,_0x3c603a){return function(_0x4f79ac){if(_0x4f79ac){var _0x4ed952=_0x4f79ac[_0x3b2b('0x2f')],_0x4fc420=_0x3c603a[_0x3b2b('0x30')],_0x5ca78b=_0x3c603a[_0x3b2b('0x30')]+_0x3c603a[_0x3b2b('0x31')],_0x3e2177;if(_0x5ca78b>=_0x4ed952){_0x5ca78b=_0x4ed952;_0x3e2177=0xc8;}else{_0x3e2177=0xce;}_0x185830[_0x3b2b('0x2c')](_0x3e2177);return _0x185830[_0x3b2b('0x32')]('Content-Range',_0x4fc420+'-'+_0x5ca78b+'/'+_0x4ed952)[_0x3b2b('0x2e')](_0x4f79ac);}return null;};}function patchUpdates(_0x54f942){return function(_0x48a62a){try{jsonpatch[_0x3b2b('0x33')](_0x48a62a,_0x54f942,!![]);}catch(_0x893ae6){return BPromise[_0x3b2b('0x34')](_0x893ae6);}return _0x48a62a[_0x3b2b('0x35')]();};}function saveUpdates(_0x5040e2,_0x5f32d0){return function(_0x2e63c1){if(_0x2e63c1){return _0x2e63c1[_0x3b2b('0x36')](_0x5040e2)[_0x3b2b('0x21')](function(_0x11717a){return _0x11717a;});}return null;};}function removeEntity(_0x2b745e,_0x4b4d9c){return function(_0x208b9f){if(_0x208b9f){return _0x208b9f['destroy']()[_0x3b2b('0x21')](function(){_0x2b745e[_0x3b2b('0x2c')](0xcc)[_0x3b2b('0x2d')]();});}};}function handleEntityNotFound(_0x36d69a,_0xca0678){return function(_0x3fd26f){if(!_0x3fd26f){_0x36d69a[_0x3b2b('0x37')](0x194);}return _0x3fd26f;};}function handleError(_0x2a9db0,_0x5aa5e6){_0x5aa5e6=_0x5aa5e6||0x1f4;return function(_0x5598af){logger[_0x3b2b('0x26')](_0x5598af['stack']);if(_0x5598af[_0x3b2b('0x38')]){delete _0x5598af[_0x3b2b('0x38')];}_0x2a9db0[_0x3b2b('0x2c')](_0x5aa5e6)[_0x3b2b('0x39')](_0x5598af);};}exports[_0x3b2b('0x3a')]=function(_0xfd7335,_0xcc9441){var _0x431777={},_0x41b2af={},_0x43ae3a={'count':0x0,'rows':[]};var _0x517eb3=_[_0x3b2b('0x3b')](db[_0x3b2b('0x3c')][_0x3b2b('0x3d')],function(_0x41a6f1){return{'name':_0x41a6f1[_0x3b2b('0x3e')],'type':_0x41a6f1[_0x3b2b('0x3f')][_0x3b2b('0x40')]};});_0x41b2af[_0x3b2b('0x41')]=_[_0x3b2b('0x3b')](_0x517eb3,_0x3b2b('0x38'));_0x41b2af[_0x3b2b('0x42')]=_[_0x3b2b('0x43')](_0xfd7335[_0x3b2b('0x42')]);_0x41b2af[_0x3b2b('0x44')]=_['intersection'](_0x41b2af[_0x3b2b('0x41')],_0x41b2af[_0x3b2b('0x42')]);_0x431777[_0x3b2b('0x45')]=_[_0x3b2b('0x46')](_0x41b2af[_0x3b2b('0x41')],qs[_0x3b2b('0x47')](_0xfd7335[_0x3b2b('0x42')]['fields']));_0x431777['attributes']=_0x431777[_0x3b2b('0x45')]['length']?_0x431777[_0x3b2b('0x45')]:_0x41b2af[_0x3b2b('0x41')];if(!_0xfd7335[_0x3b2b('0x42')][_0x3b2b('0x48')](_0x3b2b('0x49'))){_0x431777[_0x3b2b('0x31')]=qs[_0x3b2b('0x31')](_0xfd7335[_0x3b2b('0x42')]['limit']);_0x431777['offset']=qs['offset'](_0xfd7335[_0x3b2b('0x42')][_0x3b2b('0x30')]);}_0x431777[_0x3b2b('0x4a')]=qs[_0x3b2b('0x4b')](_0xfd7335[_0x3b2b('0x42')][_0x3b2b('0x4b')]);_0x431777['where']=qs[_0x3b2b('0x44')](_['pick'](_0xfd7335[_0x3b2b('0x42')],_0x41b2af[_0x3b2b('0x44')]),_0x517eb3);if(_0xfd7335[_0x3b2b('0x42')][_0x3b2b('0x4c')]){_0x431777[_0x3b2b('0x4d')]=_['merge'](_0x431777[_0x3b2b('0x4d')],{'$or':_['map'](_0x517eb3,function(_0x1b214e){if(_0x1b214e['type']!==_0x3b2b('0x4e')){var _0xc36416={};_0xc36416[_0x1b214e[_0x3b2b('0x38')]]={'$like':'%'+_0xfd7335[_0x3b2b('0x42')]['filter']+'%'};return _0xc36416;}})});}_0x431777=_['merge']({},_0x431777,_0xfd7335[_0x3b2b('0x4f')]);var _0x4e90a7={'where':_0x431777[_0x3b2b('0x4d')]};return db[_0x3b2b('0x3c')]['count'](_0x4e90a7)[_0x3b2b('0x21')](function(_0x578b11){_0x43ae3a[_0x3b2b('0x2f')]=_0x578b11;if(_0xfd7335[_0x3b2b('0x42')][_0x3b2b('0x50')]){_0x431777[_0x3b2b('0x51')]=[{'all':!![]}];}return db[_0x3b2b('0x3c')]['findAll'](_0x431777);})['then'](function(_0x3b020a){_0x43ae3a[_0x3b2b('0x52')]=_0x3b020a;return _0x43ae3a;})['then'](respondWithFilteredResult(_0xcc9441,_0x431777))[_0x3b2b('0x53')](handleError(_0xcc9441,null));};exports[_0x3b2b('0x54')]=function(_0x1f3115,_0x25a6d1){var _0x468253={'raw':![],'where':{'id':_0x1f3115[_0x3b2b('0x55')]['id']}},_0x411ba4={};_0x411ba4[_0x3b2b('0x41')]=_[_0x3b2b('0x43')](db[_0x3b2b('0x3c')][_0x3b2b('0x3d')]);_0x411ba4[_0x3b2b('0x42')]=_[_0x3b2b('0x43')](_0x1f3115['query']);_0x411ba4[_0x3b2b('0x44')]=_[_0x3b2b('0x46')](_0x411ba4[_0x3b2b('0x41')],_0x411ba4[_0x3b2b('0x42')]);_0x468253[_0x3b2b('0x45')]=_[_0x3b2b('0x46')](_0x411ba4[_0x3b2b('0x41')],qs['fields'](_0x1f3115[_0x3b2b('0x42')][_0x3b2b('0x47')]));_0x468253[_0x3b2b('0x45')]=_0x468253[_0x3b2b('0x45')][_0x3b2b('0x56')]?_0x468253[_0x3b2b('0x45')]:_0x411ba4[_0x3b2b('0x41')];if(_0x1f3115[_0x3b2b('0x42')][_0x3b2b('0x50')]){_0x468253[_0x3b2b('0x51')]=[{'all':!![]}];}_0x468253=_[_0x3b2b('0x57')]({},_0x468253,_0x1f3115[_0x3b2b('0x4f')]);return db[_0x3b2b('0x3c')]['find'](_0x468253)[_0x3b2b('0x21')](handleEntityNotFound(_0x25a6d1,null))[_0x3b2b('0x21')](respondWithResult(_0x25a6d1,null))['catch'](handleError(_0x25a6d1,null));};exports[_0x3b2b('0x58')]=function(_0xde259a,_0x2bf681){return db[_0x3b2b('0x3c')][_0x3b2b('0x58')](_0xde259a[_0x3b2b('0x59')],{})['then'](respondWithResult(_0x2bf681,0xc9))['catch'](handleError(_0x2bf681,null));};exports[_0x3b2b('0x36')]=function(_0x3582db,_0x2eec87){if(_0x3582db['body']['id']){delete _0x3582db[_0x3b2b('0x59')]['id'];}return db[_0x3b2b('0x3c')][_0x3b2b('0x5a')]({'where':{'id':_0x3582db[_0x3b2b('0x55')]['id']}})['then'](handleEntityNotFound(_0x2eec87,null))[_0x3b2b('0x21')](saveUpdates(_0x3582db[_0x3b2b('0x59')],null))[_0x3b2b('0x21')](respondWithResult(_0x2eec87,null))[_0x3b2b('0x53')](handleError(_0x2eec87,null));};exports[_0x3b2b('0x5b')]=function(_0x3de4ad,_0x484f95){return db[_0x3b2b('0x3c')][_0x3b2b('0x5a')]({'where':{'id':_0x3de4ad['params']['id']}})['then'](handleEntityNotFound(_0x484f95,null))[_0x3b2b('0x21')](removeEntity(_0x484f95,null))[_0x3b2b('0x53')](handleError(_0x484f95,null));};exports[_0x3b2b('0x5c')]=function(_0x8c765e,_0x1cd9c7,_0x426593){var _0x457df8={};var _0x71c544={};var _0xe98449;var _0x1ca7c2;return db['DeskConfiguration'][_0x3b2b('0x5d')]({'where':{'id':_0x8c765e['params']['id']}})[_0x3b2b('0x21')](handleEntityNotFound(_0x1cd9c7,null))[_0x3b2b('0x21')](function(_0x4c6dd2){if(_0x4c6dd2){_0xe98449=_0x4c6dd2;_0x71c544['model']=_[_0x3b2b('0x43')](db['DeskField']['rawAttributes']);_0x71c544[_0x3b2b('0x42')]=_['keys'](_0x8c765e[_0x3b2b('0x42')]);_0x71c544['filters']=_[_0x3b2b('0x46')](_0x71c544[_0x3b2b('0x41')],_0x71c544[_0x3b2b('0x42')]);_0x457df8[_0x3b2b('0x45')]=_['intersection'](_0x71c544['model'],qs[_0x3b2b('0x47')](_0x8c765e[_0x3b2b('0x42')]['fields']));_0x457df8[_0x3b2b('0x45')]=_0x457df8[_0x3b2b('0x45')]['length']?_0x457df8[_0x3b2b('0x45')]:_0x71c544[_0x3b2b('0x41')];_0x457df8['order']=qs[_0x3b2b('0x4b')](_0x8c765e[_0x3b2b('0x42')][_0x3b2b('0x4b')]);_0x457df8[_0x3b2b('0x4d')]=qs[_0x3b2b('0x44')](_[_0x3b2b('0x5e')](_0x8c765e[_0x3b2b('0x42')],_0x71c544['filters']));if(_0x8c765e[_0x3b2b('0x42')][_0x3b2b('0x4c')]){_0x457df8['where']=_['merge'](_0x457df8[_0x3b2b('0x4d')],{'$or':_['map'](_0x457df8[_0x3b2b('0x45')],function(_0x191c6c){var _0x34d45d={};_0x34d45d[_0x191c6c]={'$like':'%'+_0x8c765e[_0x3b2b('0x42')][_0x3b2b('0x4c')]+'%'};return _0x34d45d;})});}_0x457df8=_[_0x3b2b('0x57')]({},_0x457df8,_0x8c765e[_0x3b2b('0x4f')]);return _0xe98449[_0x3b2b('0x5c')](_0x457df8);}})[_0x3b2b('0x21')](function(_0x1b05bf){if(_0x1b05bf){_0x1ca7c2=_0x1b05bf[_0x3b2b('0x56')];if(!_0x8c765e['query'][_0x3b2b('0x48')](_0x3b2b('0x49'))){_0x457df8[_0x3b2b('0x31')]=qs[_0x3b2b('0x31')](_0x8c765e[_0x3b2b('0x42')][_0x3b2b('0x31')]);_0x457df8[_0x3b2b('0x30')]=qs['offset'](_0x8c765e[_0x3b2b('0x42')][_0x3b2b('0x30')]);}return _0xe98449['getFields'](_0x457df8);}})[_0x3b2b('0x21')](function(_0x280bd9){if(_0x280bd9){return _0x280bd9?{'count':_0x1ca7c2,'rows':_0x280bd9}:null;}})['then'](respondWithResult(_0x1cd9c7,null))[_0x3b2b('0x53')](handleError(_0x1cd9c7,null));};exports[_0x3b2b('0x5f')]=function(_0xa2659b,_0x4ee068,_0x2e87a4){var _0x5c6f4b={};var _0x1c06af={};var _0x1f6047;var _0xe484f3;return db[_0x3b2b('0x3c')]['findOne']({'where':{'id':_0xa2659b[_0x3b2b('0x55')]['id']}})[_0x3b2b('0x21')](handleEntityNotFound(_0x4ee068,null))['then'](function(_0x417a31){if(_0x417a31){_0x1f6047=_0x417a31;_0x1c06af[_0x3b2b('0x41')]=_[_0x3b2b('0x43')](db[_0x3b2b('0x60')][_0x3b2b('0x3d')]);_0x1c06af[_0x3b2b('0x42')]=_[_0x3b2b('0x43')](_0xa2659b[_0x3b2b('0x42')]);_0x1c06af[_0x3b2b('0x44')]=_['intersection'](_0x1c06af[_0x3b2b('0x41')],_0x1c06af[_0x3b2b('0x42')]);_0x5c6f4b['attributes']=_['intersection'](_0x1c06af[_0x3b2b('0x41')],qs['fields'](_0xa2659b[_0x3b2b('0x42')][_0x3b2b('0x47')]));_0x5c6f4b['attributes']=_0x5c6f4b[_0x3b2b('0x45')][_0x3b2b('0x56')]?_0x5c6f4b['attributes']:_0x1c06af[_0x3b2b('0x41')];_0x5c6f4b[_0x3b2b('0x4a')]=qs[_0x3b2b('0x4b')](_0xa2659b['query']['sort']);_0x5c6f4b[_0x3b2b('0x4d')]=qs[_0x3b2b('0x44')](_[_0x3b2b('0x5e')](_0xa2659b[_0x3b2b('0x42')],_0x1c06af[_0x3b2b('0x44')]));if(_0xa2659b['query'][_0x3b2b('0x4c')]){_0x5c6f4b['where']=_[_0x3b2b('0x57')](_0x5c6f4b[_0x3b2b('0x4d')],{'$or':_['map'](_0x5c6f4b[_0x3b2b('0x45')],function(_0x514e2b){var _0x42e2af={};_0x42e2af[_0x514e2b]={'$like':'%'+_0xa2659b[_0x3b2b('0x42')][_0x3b2b('0x4c')]+'%'};return _0x42e2af;})});}_0x5c6f4b=_[_0x3b2b('0x57')]({},_0x5c6f4b,_0xa2659b[_0x3b2b('0x4f')]);return _0x1f6047[_0x3b2b('0x5f')](_0x5c6f4b);}})[_0x3b2b('0x21')](function(_0x1d3fb3){if(_0x1d3fb3){_0xe484f3=_0x1d3fb3[_0x3b2b('0x56')];if(!_0xa2659b[_0x3b2b('0x42')][_0x3b2b('0x48')](_0x3b2b('0x49'))){_0x5c6f4b['limit']=qs[_0x3b2b('0x31')](_0xa2659b['query'][_0x3b2b('0x31')]);_0x5c6f4b[_0x3b2b('0x30')]=qs[_0x3b2b('0x30')](_0xa2659b[_0x3b2b('0x42')][_0x3b2b('0x30')]);}return _0x1f6047[_0x3b2b('0x5f')](_0x5c6f4b);}})[_0x3b2b('0x21')](function(_0x4578eb){if(_0x4578eb){return _0x4578eb?{'count':_0xe484f3,'rows':_0x4578eb}:null;}})[_0x3b2b('0x21')](respondWithResult(_0x4ee068,null))[_0x3b2b('0x53')](handleError(_0x4ee068,null));};exports[_0x3b2b('0x61')]=function(_0x2fde96,_0x57e161,_0x47485c){var _0x1b31e3={};var _0x11f452={};var _0x799ca1;var _0x4d54d4;return db[_0x3b2b('0x3c')][_0x3b2b('0x5d')]({'where':{'id':_0x2fde96[_0x3b2b('0x55')]['id']}})[_0x3b2b('0x21')](handleEntityNotFound(_0x57e161,null))[_0x3b2b('0x21')](function(_0x2b31ff){if(_0x2b31ff){_0x799ca1=_0x2b31ff;_0x11f452['model']=_[_0x3b2b('0x43')](db['DeskField'][_0x3b2b('0x3d')]);_0x11f452[_0x3b2b('0x42')]=_[_0x3b2b('0x43')](_0x2fde96[_0x3b2b('0x42')]);_0x11f452[_0x3b2b('0x44')]=_[_0x3b2b('0x46')](_0x11f452[_0x3b2b('0x41')],_0x11f452[_0x3b2b('0x42')]);_0x1b31e3[_0x3b2b('0x45')]=_[_0x3b2b('0x46')](_0x11f452[_0x3b2b('0x41')],qs[_0x3b2b('0x47')](_0x2fde96['query'][_0x3b2b('0x47')]));_0x1b31e3[_0x3b2b('0x45')]=_0x1b31e3[_0x3b2b('0x45')][_0x3b2b('0x56')]?_0x1b31e3[_0x3b2b('0x45')]:_0x11f452[_0x3b2b('0x41')];_0x1b31e3[_0x3b2b('0x4a')]=qs[_0x3b2b('0x4b')](_0x2fde96['query'][_0x3b2b('0x4b')]);_0x1b31e3[_0x3b2b('0x4d')]=qs[_0x3b2b('0x44')](_[_0x3b2b('0x5e')](_0x2fde96['query'],_0x11f452['filters']));if(_0x2fde96[_0x3b2b('0x42')][_0x3b2b('0x4c')]){_0x1b31e3[_0x3b2b('0x4d')]=_[_0x3b2b('0x57')](_0x1b31e3['where'],{'$or':_[_0x3b2b('0x3b')](_0x1b31e3[_0x3b2b('0x45')],function(_0x2e00ee){var _0x552343={};_0x552343[_0x2e00ee]={'$like':'%'+_0x2fde96[_0x3b2b('0x42')][_0x3b2b('0x4c')]+'%'};return _0x552343;})});}_0x1b31e3=_[_0x3b2b('0x57')]({},_0x1b31e3,_0x2fde96[_0x3b2b('0x4f')]);return _0x799ca1[_0x3b2b('0x61')](_0x1b31e3);}})[_0x3b2b('0x21')](function(_0x51348f){if(_0x51348f){_0x4d54d4=_0x51348f[_0x3b2b('0x56')];if(!_0x2fde96[_0x3b2b('0x42')][_0x3b2b('0x48')](_0x3b2b('0x49'))){_0x1b31e3['limit']=qs['limit'](_0x2fde96[_0x3b2b('0x42')][_0x3b2b('0x31')]);_0x1b31e3[_0x3b2b('0x30')]=qs[_0x3b2b('0x30')](_0x2fde96['query'][_0x3b2b('0x30')]);}return _0x799ca1['getDescriptions'](_0x1b31e3);}})['then'](function(_0x2d649a){if(_0x2d649a){return _0x2d649a?{'count':_0x4d54d4,'rows':_0x2d649a}:null;}})[_0x3b2b('0x21')](respondWithResult(_0x57e161,null))[_0x3b2b('0x53')](handleError(_0x57e161,null));};exports['getTags']=function(_0x5302af,_0x12c360,_0x572c85){var _0x5e86b6={};var _0x593d3f={};var _0x16681f;var _0x550dd5;return db[_0x3b2b('0x3c')]['findOne']({'where':{'id':_0x5302af[_0x3b2b('0x55')]['id']}})[_0x3b2b('0x21')](handleEntityNotFound(_0x12c360,null))[_0x3b2b('0x21')](function(_0x438fc1){if(_0x438fc1){_0x16681f=_0x438fc1;_0x593d3f['model']=_[_0x3b2b('0x43')](db[_0x3b2b('0x62')][_0x3b2b('0x3d')]);_0x593d3f[_0x3b2b('0x42')]=_[_0x3b2b('0x43')](_0x5302af['query']);_0x593d3f['filters']=_[_0x3b2b('0x46')](_0x593d3f['model'],_0x593d3f[_0x3b2b('0x42')]);_0x5e86b6[_0x3b2b('0x45')]=_[_0x3b2b('0x46')](_0x593d3f[_0x3b2b('0x41')],qs[_0x3b2b('0x47')](_0x5302af[_0x3b2b('0x42')][_0x3b2b('0x47')]));_0x5e86b6['attributes']=_0x5e86b6[_0x3b2b('0x45')][_0x3b2b('0x56')]?_0x5e86b6['attributes']:_0x593d3f['model'];_0x5e86b6[_0x3b2b('0x4a')]=qs[_0x3b2b('0x4b')](_0x5302af[_0x3b2b('0x42')]['sort']);_0x5e86b6[_0x3b2b('0x4d')]=qs[_0x3b2b('0x44')](_[_0x3b2b('0x5e')](_0x5302af[_0x3b2b('0x42')],_0x593d3f[_0x3b2b('0x44')]));if(_0x5302af[_0x3b2b('0x42')][_0x3b2b('0x4c')]){_0x5e86b6[_0x3b2b('0x4d')]=_['merge'](_0x5e86b6['where'],{'$or':_['map'](_0x5e86b6[_0x3b2b('0x45')],function(_0x5e8e4a){var _0x4a53f6={};_0x4a53f6[_0x5e8e4a]={'$like':'%'+_0x5302af['query'][_0x3b2b('0x4c')]+'%'};return _0x4a53f6;})});}_0x5e86b6=_[_0x3b2b('0x57')]({},_0x5e86b6,_0x5302af[_0x3b2b('0x4f')]);return _0x16681f[_0x3b2b('0x63')](_0x5e86b6);}})[_0x3b2b('0x21')](function(_0x4ae3c4){if(_0x4ae3c4){_0x550dd5=_0x4ae3c4['length'];if(!_0x5302af['query'][_0x3b2b('0x48')](_0x3b2b('0x49'))){_0x5e86b6[_0x3b2b('0x31')]=qs[_0x3b2b('0x31')](_0x5302af['query']['limit']);_0x5e86b6[_0x3b2b('0x30')]=qs[_0x3b2b('0x30')](_0x5302af[_0x3b2b('0x42')][_0x3b2b('0x30')]);}return _0x16681f[_0x3b2b('0x63')](_0x5e86b6);}})[_0x3b2b('0x21')](function(_0x5d6cc3){if(_0x5d6cc3){return _0x5d6cc3?{'count':_0x550dd5,'rows':_0x5d6cc3}:null;}})[_0x3b2b('0x21')](respondWithResult(_0x12c360,null))['catch'](handleError(_0x12c360,null));};exports[_0x3b2b('0x64')]=function(_0x445d1f,_0x3bd580,_0x4ef3d3){if(_0x445d1f['body']['id']){delete _0x445d1f['body']['id'];}return db[_0x3b2b('0x3c')][_0x3b2b('0x5d')]({'where':{'id':_0x445d1f['params']['id']}})[_0x3b2b('0x21')](handleEntityNotFound(_0x3bd580,null))[_0x3b2b('0x21')](function(_0x16ce93){if(_0x16ce93){return _0x16ce93[_0x3b2b('0x64')](_0x445d1f['body'][_0x3b2b('0x65')]||[]);}return null;})[_0x3b2b('0x21')](respondWithResult(_0x3bd580,null))[_0x3b2b('0x53')](handleError(_0x3bd580,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index cd3d81b..3e84ee1 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 _0x1646=['define','DeskConfiguration','int_desk_configurations','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports'];(function(_0xfdedab,_0x7e0a3d){var _0x29d28d=function(_0x202cdf){while(--_0x202cdf){_0xfdedab['push'](_0xfdedab['shift']());}};_0x29d28d(++_0x7e0a3d);}(_0x1646,0x19b));var _0x6164=function(_0xf168d3,_0x43dcfc){_0xf168d3=_0xf168d3-0x0;var _0x17fb54=_0x1646[_0xf168d3];return _0x17fb54;};'use strict';var _=require(_0x6164('0x0'));var util=require(_0x6164('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6164('0x2'));var rp=require(_0x6164('0x3'));var fs=require('fs');var path=require(_0x6164('0x4'));var rimraf=require(_0x6164('0x5'));var config=require(_0x6164('0x6'));var attributes=require(_0x6164('0x7'));module[_0x6164('0x8')]=function(_0x73c2db,_0x54cd44){return _0x73c2db[_0x6164('0x9')](_0x6164('0xa'),attributes,{'tableName':_0x6164('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bcc=['rimraf','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x566f0d,_0x373b43){var _0x84ae7f=function(_0x2b1243){while(--_0x2b1243){_0x566f0d['push'](_0x566f0d['shift']());}};_0x84ae7f(++_0x373b43);}(_0x4bcc,0x18c));var _0xc4bc=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x4bcc[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0xc4bc('0x0'));var util=require(_0xc4bc('0x1'));var logger=require(_0xc4bc('0x2'))(_0xc4bc('0x3'));var moment=require('moment');var BPromise=require(_0xc4bc('0x4'));var rp=require(_0xc4bc('0x5'));var fs=require('fs');var path=require(_0xc4bc('0x6'));var rimraf=require(_0xc4bc('0x7'));var config=require('../../config/environment');var attributes=require(_0xc4bc('0x8'));module[_0xc4bc('0x9')]=function(_0x1ba90f,_0xb351c2){return _0x1ba90f[_0xc4bc('0xa')](_0xc4bc('0xb'),attributes,{'tableName':_0xc4bc('0xc'),'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 066a680..d583776 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 _0x5a8c=['client','http','request','then','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x34451f,_0x416a8e){var _0x5c3f7e=function(_0x14bf43){while(--_0x14bf43){_0x34451f['push'](_0x34451f['shift']());}};_0x5c3f7e(++_0x416a8e);}(_0x5a8c,0x1da));var _0xc5a8=function(_0x2f27c3,_0x2df29d){_0x2f27c3=_0x2f27c3-0x0;var _0x517c34=_0x5a8c[_0x2f27c3];return _0x517c34;};'use strict';var _=require(_0xc5a8('0x0'));var util=require(_0xc5a8('0x1'));var moment=require('moment');var BPromise=require(_0xc5a8('0x2'));var rs=require(_0xc5a8('0x3'));var fs=require('fs');var Redis=require(_0xc5a8('0x4'));var db=require(_0xc5a8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc5a8('0x6'))(_0xc5a8('0x7'));var config=require('../../config/environment');var jayson=require(_0xc5a8('0x8'));var client=jayson[_0xc5a8('0x9')][_0xc5a8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20e700,_0x1be8e7,_0x2eb2a5){return new BPromise(function(_0x414555,_0xe7ce8f){return client[_0xc5a8('0xb')](_0x20e700,_0x2eb2a5)[_0xc5a8('0xc')](function(_0x46e3b7){logger['info'](_0xc5a8('0xd'),_0x1be8e7,'request\x20sent');logger[_0xc5a8('0xe')](_0xc5a8('0xf'),_0x1be8e7,_0xc5a8('0x10'),JSON['stringify'](_0x46e3b7));if(_0x46e3b7['error']){if(_0x46e3b7[_0xc5a8('0x11')][_0xc5a8('0x12')]===0x1f4){logger[_0xc5a8('0x11')](_0xc5a8('0xd'),_0x1be8e7,_0x46e3b7[_0xc5a8('0x11')]['message']);return _0xe7ce8f(_0x46e3b7[_0xc5a8('0x11')][_0xc5a8('0x13')]);}logger[_0xc5a8('0x11')](_0xc5a8('0xd'),_0x1be8e7,_0x46e3b7[_0xc5a8('0x11')][_0xc5a8('0x13')]);return _0x414555(_0x46e3b7[_0xc5a8('0x11')][_0xc5a8('0x13')]);}else{logger[_0xc5a8('0x14')](_0xc5a8('0xd'),_0x1be8e7,_0xc5a8('0x10'));_0x414555(_0x46e3b7[_0xc5a8('0x15')][_0xc5a8('0x13')]);}})[_0xc5a8('0x16')](function(_0x1ac555){logger[_0xc5a8('0x11')](_0xc5a8('0xd'),_0x1be8e7,_0x1ac555);_0xe7ce8f(_0x1ac555);});});} \ No newline at end of file +var _0x477a=['DeskConfiguration,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info'];(function(_0x5e8dac,_0x35d81b){var _0x2eab1d=function(_0x2d723a){while(--_0x2d723a){_0x5e8dac['push'](_0x5e8dac['shift']());}};_0x2eab1d(++_0x35d81b);}(_0x477a,0x1e2));var _0xa477=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x477a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa477('0x0'));var util=require('util');var moment=require(_0xa477('0x1'));var BPromise=require(_0xa477('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa477('0x3'));var db=require(_0xa477('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa477('0x5'));var config=require(_0xa477('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa477('0x7')][_0xa477('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x203871,_0x3463cd,_0x422a5d){return new BPromise(function(_0x788380,_0x2e9476){return client[_0xa477('0x9')](_0x203871,_0x422a5d)[_0xa477('0xa')](function(_0x512d8b){logger[_0xa477('0xb')](_0xa477('0xc'),_0x3463cd,'request\x20sent');logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3463cd,'request\x20sent',JSON['stringify'](_0x512d8b));if(_0x512d8b[_0xa477('0xd')]){if(_0x512d8b[_0xa477('0xd')][_0xa477('0xe')]===0x1f4){logger['error'](_0xa477('0xc'),_0x3463cd,_0x512d8b[_0xa477('0xd')][_0xa477('0xf')]);return _0x2e9476(_0x512d8b['error'][_0xa477('0xf')]);}logger[_0xa477('0xd')](_0xa477('0xc'),_0x3463cd,_0x512d8b[_0xa477('0xd')][_0xa477('0xf')]);return _0x788380(_0x512d8b['error'][_0xa477('0xf')]);}else{logger[_0xa477('0xb')](_0xa477('0xc'),_0x3463cd,_0xa477('0x10'));_0x788380(_0x512d8b[_0xa477('0x11')][_0xa477('0xf')]);}})[_0xa477('0x12')](function(_0x90c085){logger[_0xa477('0xd')](_0xa477('0xc'),_0x3463cd,_0x90c085);_0x2e9476(_0x90c085);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index cd7763d..ad29b28 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 _0xd2dd=['get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','connect-timeout','../../components/auth/service','../../config/environment'];(function(_0x3811d4,_0x2abdfb){var _0x3f1fae=function(_0x5b8908){while(--_0x5b8908){_0x3811d4['push'](_0x3811d4['shift']());}};_0x3f1fae(++_0x2abdfb);}(_0xd2dd,0x13f));var _0xdd2d=function(_0x36e1c3,_0x13bb35){_0x36e1c3=_0x36e1c3-0x0;var _0x3a2636=_0xd2dd[_0x36e1c3];return _0x3a2636;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xdd2d('0x0'));var express=require('express');var router=express['Router']();var auth=require(_0xdd2d('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0xdd2d('0x2'));var controller=require('./intDeskField.controller');router[_0xdd2d('0x3')]('/',auth[_0xdd2d('0x4')](),controller[_0xdd2d('0x5')]);router[_0xdd2d('0x3')](_0xdd2d('0x6'),auth['isAuthenticated'](),controller[_0xdd2d('0x7')]);router['post']('/',auth[_0xdd2d('0x4')](),controller[_0xdd2d('0x8')]);router[_0xdd2d('0x9')](_0xdd2d('0x6'),auth['isAuthenticated'](),controller[_0xdd2d('0xa')]);router[_0xdd2d('0xb')]('/:id',auth[_0xdd2d('0x4')](),controller[_0xdd2d('0xc')]);module[_0xdd2d('0xd')]=router; \ No newline at end of file +var _0xdf4a=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','put'];(function(_0x59f860,_0x24716c){var _0x2d558a=function(_0x474b8a){while(--_0x474b8a){_0x59f860['push'](_0x59f860['shift']());}};_0x2d558a(++_0x24716c);}(_0xdf4a,0xd5));var _0xadf4=function(_0x200681,_0x20a390){_0x200681=_0x200681-0x0;var _0xf4abf2=_0xdf4a[_0x200681];return _0xf4abf2;};'use strict';var multer=require('multer');var util=require(_0xadf4('0x0'));var path=require(_0xadf4('0x1'));var timeout=require(_0xadf4('0x2'));var express=require(_0xadf4('0x3'));var router=express[_0xadf4('0x4')]();var auth=require(_0xadf4('0x5'));var interaction=require(_0xadf4('0x6'));var config=require(_0xadf4('0x7'));var controller=require(_0xadf4('0x8'));router[_0xadf4('0x9')]('/',auth[_0xadf4('0xa')](),controller[_0xadf4('0xb')]);router[_0xadf4('0x9')](_0xadf4('0xc'),auth['isAuthenticated'](),controller[_0xadf4('0xd')]);router['post']('/',auth[_0xadf4('0xa')](),controller['create']);router[_0xadf4('0xe')](_0xadf4('0xc'),auth[_0xadf4('0xa')](),controller[_0xadf4('0xf')]);router[_0xadf4('0x10')](_0xadf4('0xc'),auth[_0xadf4('0xa')](),controller[_0xadf4('0x11')]);module[_0xadf4('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 82be0b5..a780bf3 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 _0xdd1d=['sequelize','exports','string','variable','customVariable','STRING','ENUM','BOOLEAN'];(function(_0x31dde9,_0x12e816){var _0x1fbf2d=function(_0x1d1bf6){while(--_0x1d1bf6){_0x31dde9['push'](_0x31dde9['shift']());}};_0x1fbf2d(++_0x12e816);}(_0xdd1d,0x1e8));var _0xddd1=function(_0x5be8cc,_0x4a6037){_0x5be8cc=_0x5be8cc-0x0;var _0x5f1b7e=_0xdd1d[_0x5be8cc];return _0x5f1b7e;};'use strict';var Sequelize=require(_0xddd1('0x0'));module[_0xddd1('0x1')]={'type':{'type':Sequelize['ENUM'](_0xddd1('0x2'),_0xddd1('0x3'),_0xddd1('0x4'),'keyValue'),'defaultValue':_0xddd1('0x2')},'content':{'type':Sequelize[_0xddd1('0x5')]},'key':{'type':Sequelize[_0xddd1('0x5')]},'keyType':{'type':Sequelize[_0xddd1('0x6')](_0xddd1('0x2'),'variable',_0xddd1('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xddd1('0x5')]},'nameField':{'type':Sequelize[_0xddd1('0x5')]},'customField':{'type':Sequelize[_0xddd1('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xddd1('0x5')]}}; \ No newline at end of file +var _0x5ec4=['customVariable','string','STRING','BOOLEAN','exports','ENUM','variable'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5ec4,0x1bd));var _0x45ec=function(_0x531ed8,_0x3853c3){_0x531ed8=_0x531ed8-0x0;var _0x74ebb7=_0x5ec4[_0x531ed8];return _0x74ebb7;};'use strict';var Sequelize=require('sequelize');module[_0x45ec('0x0')]={'type':{'type':Sequelize[_0x45ec('0x1')]('string',_0x45ec('0x2'),_0x45ec('0x3'),'keyValue'),'defaultValue':_0x45ec('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x45ec('0x5')]},'keyType':{'type':Sequelize[_0x45ec('0x1')](_0x45ec('0x4'),_0x45ec('0x2'),_0x45ec('0x3'))},'keyContent':{'type':Sequelize[_0x45ec('0x5')]},'idField':{'type':Sequelize[_0x45ec('0x5')]},'nameField':{'type':Sequelize[_0x45ec('0x5')]},'customField':{'type':Sequelize[_0x45ec('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x45ec('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 2b00388..2f5be44 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 _0xcc2d=['keys','filters','attributes','intersection','fields','length','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','count','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','map','DeskField','rawAttributes','type','key','model','query'];(function(_0x20fea3,_0x382e0e){var _0x142d35=function(_0x312952){while(--_0x312952){_0x20fea3['push'](_0x20fea3['shift']());}};_0x142d35(++_0x382e0e);}(_0xcc2d,0x16c));var _0xdcc2=function(_0x3feabe,_0x362133){_0x3feabe=_0x3feabe-0x0;var _0x6dd63e=_0xcc2d[_0x3feabe];return _0x6dd63e;};'use strict';var pdf=require(_0xdcc2('0x0'));var emlformat=require(_0xdcc2('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdcc2('0x2'));var rp=require(_0xdcc2('0x3'));var moment=require(_0xdcc2('0x4'));var BPromise=require(_0xdcc2('0x5'));var Mustache=require(_0xdcc2('0x6'));var util=require(_0xdcc2('0x7'));var path=require(_0xdcc2('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xdcc2('0x9'));var squel=require('squel');var crypto=require(_0xdcc2('0xa'));var jsforce=require(_0xdcc2('0xb'));var deskjs=require(_0xdcc2('0xc'));var toCsv=require(_0xdcc2('0xd'));var querystring=require('querystring');var Papa=require(_0xdcc2('0xe'));var Redis=require(_0xdcc2('0xf'));var authService=require(_0xdcc2('0x10'));var qs=require(_0xdcc2('0x11'));var as=require(_0xdcc2('0x12'));var hardwareService=require(_0xdcc2('0x13'));var logger=require(_0xdcc2('0x14'))('api');var utils=require(_0xdcc2('0x15'));var config=require(_0xdcc2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ecd0e,_0x25d634){_0x25d634=_0x25d634||0xcc;return function(_0x468d6a){if(_0x468d6a){return _0x1ecd0e[_0xdcc2('0x17')](_0x25d634);}return _0x1ecd0e[_0xdcc2('0x18')](_0x25d634)['end']();};}function respondWithResult(_0x2c3792,_0x50cdaa){_0x50cdaa=_0x50cdaa||0xc8;return function(_0x2c6c1d){if(_0x2c6c1d){return _0x2c3792['status'](_0x50cdaa)['json'](_0x2c6c1d);}};}function respondWithFilteredResult(_0x306ce9,_0x211408){return function(_0x36e19b){if(_0x36e19b){var _0x2c7831=_0x36e19b[_0xdcc2('0x19')],_0x4edd01=_0x211408['offset'],_0x42f99c=_0x211408['offset']+_0x211408[_0xdcc2('0x1a')],_0x5d873b;if(_0x42f99c>=_0x2c7831){_0x42f99c=_0x2c7831;_0x5d873b=0xc8;}else{_0x5d873b=0xce;}_0x306ce9[_0xdcc2('0x18')](_0x5d873b);return _0x306ce9[_0xdcc2('0x1b')](_0xdcc2('0x1c'),_0x4edd01+'-'+_0x42f99c+'/'+_0x2c7831)['json'](_0x36e19b);}return null;};}function patchUpdates(_0x205d84){return function(_0x38fca7){try{jsonpatch['apply'](_0x38fca7,_0x205d84,!![]);}catch(_0x5e72e5){return BPromise[_0xdcc2('0x1d')](_0x5e72e5);}return _0x38fca7[_0xdcc2('0x1e')]();};}function saveUpdates(_0x3bd120,_0x570fe6){return function(_0x504d3){if(_0x504d3){return _0x504d3[_0xdcc2('0x1f')](_0x3bd120)[_0xdcc2('0x20')](function(_0x308bed){return _0x308bed;});}return null;};}function removeEntity(_0x29c1d3,_0xe80d7f){return function(_0xba4a0d){if(_0xba4a0d){return _0xba4a0d[_0xdcc2('0x21')]()['then'](function(){_0x29c1d3[_0xdcc2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53d3e4,_0x3f3ff2){return function(_0x1bf201){if(!_0x1bf201){_0x53d3e4[_0xdcc2('0x17')](0x194);}return _0x1bf201;};}function handleError(_0x1a43fc,_0x384399){_0x384399=_0x384399||0x1f4;return function(_0x31823f){logger[_0xdcc2('0x22')](_0x31823f['stack']);if(_0x31823f[_0xdcc2('0x23')]){delete _0x31823f[_0xdcc2('0x23')];}_0x1a43fc[_0xdcc2('0x18')](_0x384399)[_0xdcc2('0x24')](_0x31823f);};}exports['index']=function(_0x212236,_0x148bae){var _0x246ddc={},_0x1c00f1={},_0x314e40={'count':0x0,'rows':[]};var _0x4bc9b7=_[_0xdcc2('0x25')](db[_0xdcc2('0x26')][_0xdcc2('0x27')],function(_0x1c59d0){return{'name':_0x1c59d0['fieldName'],'type':_0x1c59d0[_0xdcc2('0x28')][_0xdcc2('0x29')]};});_0x1c00f1[_0xdcc2('0x2a')]=_[_0xdcc2('0x25')](_0x4bc9b7,'name');_0x1c00f1[_0xdcc2('0x2b')]=_[_0xdcc2('0x2c')](_0x212236[_0xdcc2('0x2b')]);_0x1c00f1[_0xdcc2('0x2d')]=_['intersection'](_0x1c00f1['model'],_0x1c00f1[_0xdcc2('0x2b')]);_0x246ddc[_0xdcc2('0x2e')]=_[_0xdcc2('0x2f')](_0x1c00f1[_0xdcc2('0x2a')],qs[_0xdcc2('0x30')](_0x212236[_0xdcc2('0x2b')][_0xdcc2('0x30')]));_0x246ddc[_0xdcc2('0x2e')]=_0x246ddc[_0xdcc2('0x2e')][_0xdcc2('0x31')]?_0x246ddc[_0xdcc2('0x2e')]:_0x1c00f1[_0xdcc2('0x2a')];if(!_0x212236[_0xdcc2('0x2b')]['hasOwnProperty'](_0xdcc2('0x32'))){_0x246ddc['limit']=qs[_0xdcc2('0x1a')](_0x212236[_0xdcc2('0x2b')]['limit']);_0x246ddc[_0xdcc2('0x33')]=qs[_0xdcc2('0x33')](_0x212236[_0xdcc2('0x2b')][_0xdcc2('0x33')]);}_0x246ddc['order']=qs[_0xdcc2('0x34')](_0x212236[_0xdcc2('0x2b')][_0xdcc2('0x34')]);_0x246ddc[_0xdcc2('0x35')]=qs[_0xdcc2('0x2d')](_[_0xdcc2('0x36')](_0x212236[_0xdcc2('0x2b')],_0x1c00f1[_0xdcc2('0x2d')]),_0x4bc9b7);if(_0x212236[_0xdcc2('0x2b')][_0xdcc2('0x37')]){_0x246ddc[_0xdcc2('0x35')]=_[_0xdcc2('0x38')](_0x246ddc[_0xdcc2('0x35')],{'$or':_['map'](_0x4bc9b7,function(_0x4ab024){if(_0x4ab024['type']!==_0xdcc2('0x39')){var _0x4ebefd={};_0x4ebefd[_0x4ab024[_0xdcc2('0x23')]]={'$like':'%'+_0x212236[_0xdcc2('0x2b')][_0xdcc2('0x37')]+'%'};return _0x4ebefd;}})});}_0x246ddc=_[_0xdcc2('0x38')]({},_0x246ddc,_0x212236[_0xdcc2('0x3a')]);var _0x251302={'where':_0x246ddc[_0xdcc2('0x35')]};return db['DeskField'][_0xdcc2('0x19')](_0x251302)[_0xdcc2('0x20')](function(_0x19cb30){_0x314e40['count']=_0x19cb30;if(_0x212236['query'][_0xdcc2('0x3b')]){_0x246ddc[_0xdcc2('0x3c')]=[{'all':!![]}];}return db['DeskField'][_0xdcc2('0x3d')](_0x246ddc);})[_0xdcc2('0x20')](function(_0x2f3ea9){_0x314e40['rows']=_0x2f3ea9;return _0x314e40;})[_0xdcc2('0x20')](respondWithFilteredResult(_0x148bae,_0x246ddc))[_0xdcc2('0x3e')](handleError(_0x148bae,null));};exports[_0xdcc2('0x3f')]=function(_0x248c14,_0x3f993f){var _0x4e2ce9={'raw':!![],'where':{'id':_0x248c14[_0xdcc2('0x40')]['id']}},_0x429461={};_0x429461[_0xdcc2('0x2a')]=_[_0xdcc2('0x2c')](db[_0xdcc2('0x26')]['rawAttributes']);_0x429461[_0xdcc2('0x2b')]=_['keys'](_0x248c14[_0xdcc2('0x2b')]);_0x429461['filters']=_[_0xdcc2('0x2f')](_0x429461[_0xdcc2('0x2a')],_0x429461['query']);_0x4e2ce9['attributes']=_[_0xdcc2('0x2f')](_0x429461[_0xdcc2('0x2a')],qs[_0xdcc2('0x30')](_0x248c14[_0xdcc2('0x2b')]['fields']));_0x4e2ce9['attributes']=_0x4e2ce9[_0xdcc2('0x2e')][_0xdcc2('0x31')]?_0x4e2ce9[_0xdcc2('0x2e')]:_0x429461[_0xdcc2('0x2a')];if(_0x248c14[_0xdcc2('0x2b')][_0xdcc2('0x3b')]){_0x4e2ce9['include']=[{'all':!![]}];}_0x4e2ce9=_[_0xdcc2('0x38')]({},_0x4e2ce9,_0x248c14['options']);return db[_0xdcc2('0x26')][_0xdcc2('0x41')](_0x4e2ce9)[_0xdcc2('0x20')](handleEntityNotFound(_0x3f993f,null))['then'](respondWithResult(_0x3f993f,null))[_0xdcc2('0x3e')](handleError(_0x3f993f,null));};exports['create']=function(_0x2b6758,_0x972e07){return db[_0xdcc2('0x26')][_0xdcc2('0x42')](_0x2b6758[_0xdcc2('0x43')],{})[_0xdcc2('0x20')](respondWithResult(_0x972e07,0xc9))[_0xdcc2('0x3e')](handleError(_0x972e07,null));};exports[_0xdcc2('0x1f')]=function(_0x314087,_0x1732d7){if(_0x314087['body']['id']){delete _0x314087[_0xdcc2('0x43')]['id'];}return db[_0xdcc2('0x26')][_0xdcc2('0x41')]({'where':{'id':_0x314087[_0xdcc2('0x40')]['id']}})[_0xdcc2('0x20')](handleEntityNotFound(_0x1732d7,null))['then'](saveUpdates(_0x314087[_0xdcc2('0x43')],null))[_0xdcc2('0x20')](respondWithResult(_0x1732d7,null))['catch'](handleError(_0x1732d7,null));};exports['destroy']=function(_0x2fa828,_0x244f36){return db['DeskField'][_0xdcc2('0x41')]({'where':{'id':_0x2fa828[_0xdcc2('0x40')]['id']}})[_0xdcc2('0x20')](handleEntityNotFound(_0x244f36,null))[_0xdcc2('0x20')](removeEntity(_0x244f36,null))[_0xdcc2('0x3e')](handleError(_0x244f36,null));}; \ No newline at end of file +var _0xb87d=['eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','catch','params','includeAll','find','create','body','html-pdf'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xb87d,0x93));var _0xdb87=function(_0x2886f4,_0x518615){_0x2886f4=_0x2886f4-0x0;var _0x373d22=_0xb87d[_0x2886f4];return _0x373d22;};'use strict';var pdf=require(_0xdb87('0x0'));var emlformat=require(_0xdb87('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdb87('0x2'));var jsonpatch=require(_0xdb87('0x3'));var rp=require('request-promise');var moment=require(_0xdb87('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdb87('0x5'));var util=require('util');var path=require(_0xdb87('0x6'));var sox=require(_0xdb87('0x7'));var csv=require(_0xdb87('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdb87('0x9'));var squel=require(_0xdb87('0xa'));var crypto=require(_0xdb87('0xb'));var jsforce=require(_0xdb87('0xc'));var deskjs=require(_0xdb87('0xd'));var toCsv=require(_0xdb87('0x8'));var querystring=require(_0xdb87('0xe'));var Papa=require('papaparse');var Redis=require(_0xdb87('0xf'));var authService=require(_0xdb87('0x10'));var qs=require(_0xdb87('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb87('0x12'));var logger=require(_0xdb87('0x13'))(_0xdb87('0x14'));var utils=require('../../config/utils');var config=require(_0xdb87('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ca2ad,_0x207885){_0x207885=_0x207885||0xcc;return function(_0x51b917){if(_0x51b917){return _0x5ca2ad[_0xdb87('0x16')](_0x207885);}return _0x5ca2ad[_0xdb87('0x17')](_0x207885)[_0xdb87('0x18')]();};}function respondWithResult(_0x756766,_0x451c48){_0x451c48=_0x451c48||0xc8;return function(_0x3611fb){if(_0x3611fb){return _0x756766['status'](_0x451c48)[_0xdb87('0x19')](_0x3611fb);}};}function respondWithFilteredResult(_0xb90d4c,_0x28611b){return function(_0x5f02e5){if(_0x5f02e5){var _0x22bd58=_0x5f02e5[_0xdb87('0x1a')],_0x54549a=_0x28611b[_0xdb87('0x1b')],_0x30718b=_0x28611b[_0xdb87('0x1b')]+_0x28611b['limit'],_0x25f7db;if(_0x30718b>=_0x22bd58){_0x30718b=_0x22bd58;_0x25f7db=0xc8;}else{_0x25f7db=0xce;}_0xb90d4c[_0xdb87('0x17')](_0x25f7db);return _0xb90d4c[_0xdb87('0x1c')](_0xdb87('0x1d'),_0x54549a+'-'+_0x30718b+'/'+_0x22bd58)[_0xdb87('0x19')](_0x5f02e5);}return null;};}function patchUpdates(_0x2d035d){return function(_0x260ad9){try{jsonpatch[_0xdb87('0x1e')](_0x260ad9,_0x2d035d,!![]);}catch(_0x105771){return BPromise[_0xdb87('0x1f')](_0x105771);}return _0x260ad9[_0xdb87('0x20')]();};}function saveUpdates(_0x427ccb,_0x4ca440){return function(_0x34fb10){if(_0x34fb10){return _0x34fb10[_0xdb87('0x21')](_0x427ccb)[_0xdb87('0x22')](function(_0x4031d7){return _0x4031d7;});}return null;};}function removeEntity(_0x3c8422,_0x339eb0){return function(_0x4b4ec0){if(_0x4b4ec0){return _0x4b4ec0[_0xdb87('0x23')]()['then'](function(){_0x3c8422[_0xdb87('0x17')](0xcc)[_0xdb87('0x18')]();});}};}function handleEntityNotFound(_0x3af84a,_0x399d95){return function(_0x1684fa){if(!_0x1684fa){_0x3af84a[_0xdb87('0x16')](0x194);}return _0x1684fa;};}function handleError(_0x1f3ed6,_0x50817c){_0x50817c=_0x50817c||0x1f4;return function(_0x42b376){logger[_0xdb87('0x24')](_0x42b376[_0xdb87('0x25')]);if(_0x42b376[_0xdb87('0x26')]){delete _0x42b376[_0xdb87('0x26')];}_0x1f3ed6['status'](_0x50817c)[_0xdb87('0x27')](_0x42b376);};}exports[_0xdb87('0x28')]=function(_0x2a060d,_0x2f1f64){var _0x39b5d6={},_0x2354aa={},_0x66f9dc={'count':0x0,'rows':[]};var _0x16b0d7=_[_0xdb87('0x29')](db[_0xdb87('0x2a')][_0xdb87('0x2b')],function(_0x49bf25){return{'name':_0x49bf25[_0xdb87('0x2c')],'type':_0x49bf25[_0xdb87('0x2d')][_0xdb87('0x2e')]};});_0x2354aa[_0xdb87('0x2f')]=_[_0xdb87('0x29')](_0x16b0d7,_0xdb87('0x26'));_0x2354aa[_0xdb87('0x30')]=_[_0xdb87('0x31')](_0x2a060d[_0xdb87('0x30')]);_0x2354aa[_0xdb87('0x32')]=_[_0xdb87('0x33')](_0x2354aa[_0xdb87('0x2f')],_0x2354aa['query']);_0x39b5d6[_0xdb87('0x34')]=_[_0xdb87('0x33')](_0x2354aa['model'],qs['fields'](_0x2a060d[_0xdb87('0x30')][_0xdb87('0x35')]));_0x39b5d6['attributes']=_0x39b5d6[_0xdb87('0x34')][_0xdb87('0x36')]?_0x39b5d6[_0xdb87('0x34')]:_0x2354aa[_0xdb87('0x2f')];if(!_0x2a060d[_0xdb87('0x30')][_0xdb87('0x37')]('nolimit')){_0x39b5d6['limit']=qs[_0xdb87('0x38')](_0x2a060d[_0xdb87('0x30')][_0xdb87('0x38')]);_0x39b5d6[_0xdb87('0x1b')]=qs[_0xdb87('0x1b')](_0x2a060d[_0xdb87('0x30')][_0xdb87('0x1b')]);}_0x39b5d6[_0xdb87('0x39')]=qs[_0xdb87('0x3a')](_0x2a060d[_0xdb87('0x30')][_0xdb87('0x3a')]);_0x39b5d6[_0xdb87('0x3b')]=qs[_0xdb87('0x32')](_[_0xdb87('0x3c')](_0x2a060d['query'],_0x2354aa[_0xdb87('0x32')]),_0x16b0d7);if(_0x2a060d[_0xdb87('0x30')]['filter']){_0x39b5d6[_0xdb87('0x3b')]=_['merge'](_0x39b5d6['where'],{'$or':_['map'](_0x16b0d7,function(_0x29ad14){if(_0x29ad14['type']!==_0xdb87('0x3d')){var _0x282144={};_0x282144[_0x29ad14[_0xdb87('0x26')]]={'$like':'%'+_0x2a060d[_0xdb87('0x30')][_0xdb87('0x3e')]+'%'};return _0x282144;}})});}_0x39b5d6=_[_0xdb87('0x3f')]({},_0x39b5d6,_0x2a060d[_0xdb87('0x40')]);var _0x23d794={'where':_0x39b5d6['where']};return db[_0xdb87('0x2a')][_0xdb87('0x1a')](_0x23d794)[_0xdb87('0x22')](function(_0x47785b){_0x66f9dc[_0xdb87('0x1a')]=_0x47785b;if(_0x2a060d['query']['includeAll']){_0x39b5d6[_0xdb87('0x41')]=[{'all':!![]}];}return db[_0xdb87('0x2a')][_0xdb87('0x42')](_0x39b5d6);})[_0xdb87('0x22')](function(_0x586fc5){_0x66f9dc[_0xdb87('0x43')]=_0x586fc5;return _0x66f9dc;})[_0xdb87('0x22')](respondWithFilteredResult(_0x2f1f64,_0x39b5d6))[_0xdb87('0x44')](handleError(_0x2f1f64,null));};exports['show']=function(_0x52ee85,_0x302da9){var _0x227b58={'raw':!![],'where':{'id':_0x52ee85[_0xdb87('0x45')]['id']}},_0x554ccc={};_0x554ccc[_0xdb87('0x2f')]=_[_0xdb87('0x31')](db['DeskField'][_0xdb87('0x2b')]);_0x554ccc['query']=_[_0xdb87('0x31')](_0x52ee85['query']);_0x554ccc[_0xdb87('0x32')]=_[_0xdb87('0x33')](_0x554ccc[_0xdb87('0x2f')],_0x554ccc[_0xdb87('0x30')]);_0x227b58[_0xdb87('0x34')]=_[_0xdb87('0x33')](_0x554ccc[_0xdb87('0x2f')],qs[_0xdb87('0x35')](_0x52ee85[_0xdb87('0x30')][_0xdb87('0x35')]));_0x227b58['attributes']=_0x227b58[_0xdb87('0x34')][_0xdb87('0x36')]?_0x227b58[_0xdb87('0x34')]:_0x554ccc[_0xdb87('0x2f')];if(_0x52ee85[_0xdb87('0x30')][_0xdb87('0x46')]){_0x227b58[_0xdb87('0x41')]=[{'all':!![]}];}_0x227b58=_[_0xdb87('0x3f')]({},_0x227b58,_0x52ee85[_0xdb87('0x40')]);return db[_0xdb87('0x2a')][_0xdb87('0x47')](_0x227b58)['then'](handleEntityNotFound(_0x302da9,null))[_0xdb87('0x22')](respondWithResult(_0x302da9,null))[_0xdb87('0x44')](handleError(_0x302da9,null));};exports[_0xdb87('0x48')]=function(_0x3e5bfb,_0x2f34fc){return db[_0xdb87('0x2a')][_0xdb87('0x48')](_0x3e5bfb[_0xdb87('0x49')],{})[_0xdb87('0x22')](respondWithResult(_0x2f34fc,0xc9))[_0xdb87('0x44')](handleError(_0x2f34fc,null));};exports[_0xdb87('0x21')]=function(_0x15cfd2,_0x101e69){if(_0x15cfd2['body']['id']){delete _0x15cfd2['body']['id'];}return db['DeskField'][_0xdb87('0x47')]({'where':{'id':_0x15cfd2['params']['id']}})[_0xdb87('0x22')](handleEntityNotFound(_0x101e69,null))[_0xdb87('0x22')](saveUpdates(_0x15cfd2[_0xdb87('0x49')],null))['then'](respondWithResult(_0x101e69,null))[_0xdb87('0x44')](handleError(_0x101e69,null));};exports[_0xdb87('0x23')]=function(_0x59b065,_0x5098e2){return db[_0xdb87('0x2a')]['find']({'where':{'id':_0x59b065[_0xdb87('0x45')]['id']}})[_0xdb87('0x22')](handleEntityNotFound(_0x5098e2,null))['then'](removeEntity(_0x5098e2,null))[_0xdb87('0x44')](handleError(_0x5098e2,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 87c5b3a..462a2a2 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 _0x219e=['rimraf','../../config/environment','./intDeskField.attributes','exports','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x219e,0xd9));var _0xe219=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x219e[_0x2dadb9];return _0x2f0097;};'use strict';var _=require('lodash');var util=require(_0xe219('0x0'));var logger=require(_0xe219('0x1'))(_0xe219('0x2'));var moment=require(_0xe219('0x3'));var BPromise=require(_0xe219('0x4'));var rp=require(_0xe219('0x5'));var fs=require('fs');var path=require(_0xe219('0x6'));var rimraf=require(_0xe219('0x7'));var config=require(_0xe219('0x8'));var attributes=require(_0xe219('0x9'));module[_0xe219('0xa')]=function(_0x18928c,_0x45b258){return _0x18928c['define'](_0xe219('0xb'),attributes,{'tableName':_0xe219('0xc'),'paranoid':![],'indexes':[{'name':_0xe219('0xd'),'fields':[_0xe219('0xe'),_0xe219('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfc3e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','DeskField','int_desk_fields','desk_unique_index','FieldId','lodash','api'];(function(_0x49fe2d,_0x2f2563){var _0x4fbae1=function(_0x548b03){while(--_0x548b03){_0x49fe2d['push'](_0x49fe2d['shift']());}};_0x4fbae1(++_0x2f2563);}(_0xfc3e,0x15c));var _0xefc3=function(_0x41c6c5,_0x375fbe){_0x41c6c5=_0x41c6c5-0x0;var _0x291b97=_0xfc3e[_0x41c6c5];return _0x291b97;};'use strict';var _=require(_0xefc3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xefc3('0x1'));var moment=require(_0xefc3('0x2'));var BPromise=require(_0xefc3('0x3'));var rp=require(_0xefc3('0x4'));var fs=require('fs');var path=require(_0xefc3('0x5'));var rimraf=require(_0xefc3('0x6'));var config=require(_0xefc3('0x7'));var attributes=require(_0xefc3('0x8'));module[_0xefc3('0x9')]=function(_0x2f699b,_0x5be060){return _0x2f699b['define'](_0xefc3('0xa'),attributes,{'tableName':_0xefc3('0xb'),'paranoid':![],'indexes':[{'name':_0xefc3('0xc'),'fields':['idField',_0xefc3('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 4bcbf62..5e14032 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 _0x1a1b=['../../config/environment','jayson/promise','request','then','info','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x412158,_0xce52f1){var _0x1c496b=function(_0x5162ac){while(--_0x5162ac){_0x412158['push'](_0x412158['shift']());}};_0x1c496b(++_0xce52f1);}(_0x1a1b,0x6e));var _0xb1a1=function(_0x510d97,_0x53e972){_0x510d97=_0x510d97-0x0;var _0x231724=_0x1a1b[_0x510d97];return _0x231724;};'use strict';var _=require(_0xb1a1('0x0'));var util=require(_0xb1a1('0x1'));var moment=require(_0xb1a1('0x2'));var BPromise=require(_0xb1a1('0x3'));var rs=require(_0xb1a1('0x4'));var fs=require('fs');var Redis=require(_0xb1a1('0x5'));var db=require(_0xb1a1('0x6'))['db'];var utils=require(_0xb1a1('0x7'));var logger=require(_0xb1a1('0x8'))(_0xb1a1('0x9'));var config=require(_0xb1a1('0xa'));var jayson=require(_0xb1a1('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3243ac,_0x4ba5e8,_0x443160){return new BPromise(function(_0x11f7e9,_0x2189cb){return client[_0xb1a1('0xc')](_0x3243ac,_0x443160)[_0xb1a1('0xd')](function(_0x29324a){logger[_0xb1a1('0xe')]('DeskField,\x20%s,\x20%s',_0x4ba5e8,_0xb1a1('0xf'));logger['debug'](_0xb1a1('0x10'),_0x4ba5e8,_0xb1a1('0xf'),JSON[_0xb1a1('0x11')](_0x29324a));if(_0x29324a[_0xb1a1('0x12')]){if(_0x29324a['error'][_0xb1a1('0x13')]===0x1f4){logger[_0xb1a1('0x12')]('DeskField,\x20%s,\x20%s',_0x4ba5e8,_0x29324a[_0xb1a1('0x12')]['message']);return _0x2189cb(_0x29324a[_0xb1a1('0x12')][_0xb1a1('0x14')]);}logger[_0xb1a1('0x12')]('DeskField,\x20%s,\x20%s',_0x4ba5e8,_0x29324a[_0xb1a1('0x12')]['message']);return _0x11f7e9(_0x29324a[_0xb1a1('0x12')][_0xb1a1('0x14')]);}else{logger['info'](_0xb1a1('0x15'),_0x4ba5e8,_0xb1a1('0xf'));_0x11f7e9(_0x29324a[_0xb1a1('0x16')]['message']);}})[_0xb1a1('0x17')](function(_0x4ec55f){logger[_0xb1a1('0x12')](_0xb1a1('0x15'),_0x4ba5e8,_0x4ec55f);_0x2189cb(_0x4ec55f);});});} \ No newline at end of file +var _0x3e1c=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch'];(function(_0x2222c8,_0x57b556){var _0x411d03=function(_0x1c7193){while(--_0x1c7193){_0x2222c8['push'](_0x2222c8['shift']());}};_0x411d03(++_0x57b556);}(_0x3e1c,0x78));var _0xc3e1=function(_0x350e9b,_0x42df13){_0x350e9b=_0x350e9b-0x0;var _0x4131d1=_0x3e1c[_0x350e9b];return _0x4131d1;};'use strict';var _=require(_0xc3e1('0x0'));var util=require('util');var moment=require(_0xc3e1('0x1'));var BPromise=require(_0xc3e1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc3e1('0x3'));var db=require(_0xc3e1('0x4'))['db'];var utils=require(_0xc3e1('0x5'));var logger=require(_0xc3e1('0x6'))(_0xc3e1('0x7'));var config=require('../../config/environment');var jayson=require(_0xc3e1('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4359e5,_0x7741d2,_0x59fbd1){return new BPromise(function(_0x4014f6,_0x71cdc3){return client[_0xc3e1('0x9')](_0x4359e5,_0x59fbd1)[_0xc3e1('0xa')](function(_0x49b85f){logger[_0xc3e1('0xb')](_0xc3e1('0xc'),_0x7741d2,'request\x20sent');logger[_0xc3e1('0xd')](_0xc3e1('0xe'),_0x7741d2,_0xc3e1('0xf'),JSON['stringify'](_0x49b85f));if(_0x49b85f['error']){if(_0x49b85f[_0xc3e1('0x10')]['code']===0x1f4){logger[_0xc3e1('0x10')](_0xc3e1('0xc'),_0x7741d2,_0x49b85f[_0xc3e1('0x10')][_0xc3e1('0x11')]);return _0x71cdc3(_0x49b85f['error'][_0xc3e1('0x11')]);}logger['error'](_0xc3e1('0xc'),_0x7741d2,_0x49b85f[_0xc3e1('0x10')][_0xc3e1('0x11')]);return _0x4014f6(_0x49b85f[_0xc3e1('0x10')][_0xc3e1('0x11')]);}else{logger['info'](_0xc3e1('0xc'),_0x7741d2,_0xc3e1('0xf'));_0x4014f6(_0x49b85f[_0xc3e1('0x12')]['message']);}})[_0xc3e1('0x13')](function(_0x24307a){logger[_0xc3e1('0x10')]('DeskField,\x20%s,\x20%s',_0x7741d2,_0x24307a);_0x71cdc3(_0x24307a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index d278fd5..db937a8 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 _0xe2dd=['put','/:id','update','delete','destroy','util','path','express','Router','../../components/auth/service','./intDynamics365Account.controller','get','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','post','create','addConfiguration'];(function(_0x44a718,_0x235e2a){var _0xffe19=function(_0x2b8195){while(--_0x2b8195){_0x44a718['push'](_0x44a718['shift']());}};_0xffe19(++_0x235e2a);}(_0xe2dd,0xb9));var _0xde2d=function(_0x32b122,_0x1ad490){_0x32b122=_0x32b122-0x0;var _0x4ad25a=_0xe2dd[_0x32b122];return _0x4ad25a;};'use strict';var multer=require('multer');var util=require(_0xde2d('0x0'));var path=require(_0xde2d('0x1'));var timeout=require('connect-timeout');var express=require(_0xde2d('0x2'));var router=express[_0xde2d('0x3')]();var auth=require(_0xde2d('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xde2d('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xde2d('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xde2d('0x7')]);router[_0xde2d('0x6')](_0xde2d('0x8'),auth[_0xde2d('0x9')](),controller[_0xde2d('0xa')]);router[_0xde2d('0x6')](_0xde2d('0xb'),auth[_0xde2d('0x9')](),controller['getFields']);router[_0xde2d('0xc')]('/',auth[_0xde2d('0x9')](),controller[_0xde2d('0xd')]);router[_0xde2d('0xc')](_0xde2d('0x8'),auth['isAuthenticated'](),controller[_0xde2d('0xe')]);router[_0xde2d('0xf')](_0xde2d('0x10'),auth[_0xde2d('0x9')](),controller[_0xde2d('0x11')]);router[_0xde2d('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xde2d('0x13')]);module['exports']=router; \ No newline at end of file +var _0xdb4c=['delete','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','update'];(function(_0x46bbd4,_0x2407c2){var _0x65f167=function(_0x2aca6c){while(--_0x2aca6c){_0x46bbd4['push'](_0x46bbd4['shift']());}};_0x65f167(++_0x2407c2);}(_0xdb4c,0x6d));var _0xcdb4=function(_0x18fb5b,_0x4d10f1){_0x18fb5b=_0x18fb5b-0x0;var _0x59fb03=_0xdb4c[_0x18fb5b];return _0x59fb03;};'use strict';var multer=require(_0xcdb4('0x0'));var util=require(_0xcdb4('0x1'));var path=require(_0xcdb4('0x2'));var timeout=require(_0xcdb4('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xcdb4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcdb4('0x5'));var controller=require(_0xcdb4('0x6'));router[_0xcdb4('0x7')]('/',auth[_0xcdb4('0x8')](),controller['index']);router['get'](_0xcdb4('0x9'),auth[_0xcdb4('0x8')](),controller['show']);router[_0xcdb4('0x7')](_0xcdb4('0xa'),auth[_0xcdb4('0x8')](),controller[_0xcdb4('0xb')]);router['get'](_0xcdb4('0xc'),auth[_0xcdb4('0x8')](),controller[_0xcdb4('0xd')]);router[_0xcdb4('0xe')]('/',auth[_0xcdb4('0x8')](),controller[_0xcdb4('0xf')]);router['post']('/:id/configurations',auth[_0xcdb4('0x8')](),controller['addConfiguration']);router['put'](_0xcdb4('0x9'),auth[_0xcdb4('0x8')](),controller[_0xcdb4('0x10')]);router[_0xcdb4('0x11')](_0xcdb4('0x9'),auth[_0xcdb4('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index f805b98..0448163 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 _0x8683=['STRING'];(function(_0x20006a,_0x30e3a9){var _0x5e26ac=function(_0x16ca0a){while(--_0x16ca0a){_0x20006a['push'](_0x20006a['shift']());}};_0x5e26ac(++_0x30e3a9);}(_0x8683,0x17a));var _0x3868=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x8683[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3868('0x0')]},'username':{'type':Sequelize[_0x3868('0x0')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x3868('0x0')]},'tenantId':{'type':Sequelize[_0x3868('0x0')]},'clientId':{'type':Sequelize[_0x3868('0x0')]},'clientSecret':{'type':Sequelize[_0x3868('0x0')]},'serverUrl':{'type':Sequelize[_0x3868('0x0')]},'description':{'type':Sequelize[_0x3868('0x0')]}}; \ No newline at end of file +var _0xa626=['STRING','exports'];(function(_0x3f8825,_0x168f14){var _0x236b3e=function(_0x1760d5){while(--_0x1760d5){_0x3f8825['push'](_0x3f8825['shift']());}};_0x236b3e(++_0x168f14);}(_0xa626,0x1ed));var _0x6a62=function(_0x23d6cf,_0x500c58){_0x23d6cf=_0x23d6cf-0x0;var _0x305e44=_0xa626[_0x23d6cf];return _0x305e44;};'use strict';var Sequelize=require('sequelize');module[_0x6a62('0x0')]={'name':{'type':Sequelize[_0x6a62('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x6a62('0x1')]},'remoteUri':{'type':Sequelize[_0x6a62('0x1')]},'tenantId':{'type':Sequelize[_0x6a62('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x6a62('0x1')]},'serverUrl':{'type':Sequelize[_0x6a62('0x1')]},'description':{'type':Sequelize[_0x6a62('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 16e7763..92f2220 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 _0x50ce=['api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','Dynamics365Account','findAll','rows','show','params','keys','find','create','body','update','destroy','findOne','Dynamics365Configuration','nolimit','getConfigurations','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','sentimentvalue','slaname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','concat','username','password','clientId','clientSecret','slice','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','LogicalName','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','all','forEach','isNil','substring','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','Value','DisplayName','UserLocalizedLabel','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x312940,_0x27d5aa){var _0x4c2cc5=function(_0x330287){while(--_0x330287){_0x312940['push'](_0x312940['shift']());}};_0x4c2cc5(++_0x27d5aa);}(_0x50ce,0xc9));var _0xe50c=function(_0x571dbc,_0x400df9){_0x571dbc=_0x571dbc-0x0;var _0x55043c=_0x50ce[_0x571dbc];return _0x55043c;};'use strict';var pdf=require(_0xe50c('0x0'));var emlformat=require(_0xe50c('0x1'));var rimraf=require(_0xe50c('0x2'));var zipdir=require(_0xe50c('0x3'));var jsonpatch=require(_0xe50c('0x4'));var rp=require(_0xe50c('0x5'));var moment=require(_0xe50c('0x6'));var BPromise=require(_0xe50c('0x7'));var Mustache=require(_0xe50c('0x8'));var util=require('util');var path=require(_0xe50c('0x9'));var sox=require('sox');var csv=require(_0xe50c('0xa'));var ejs=require(_0xe50c('0xb'));var fs=require('fs');var _=require(_0xe50c('0xc'));var squel=require(_0xe50c('0xd'));var crypto=require(_0xe50c('0xe'));var jsforce=require(_0xe50c('0xf'));var deskjs=require(_0xe50c('0x10'));var toCsv=require(_0xe50c('0xa'));var querystring=require(_0xe50c('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe50c('0x12'));var qs=require(_0xe50c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe50c('0x14'));var logger=require(_0xe50c('0x15'))(_0xe50c('0x16'));var utils=require(_0xe50c('0x17'));var config=require(_0xe50c('0x18'));var db=require(_0xe50c('0x19'))['db'];var integrations=require(_0xe50c('0x1a'));var jayson=require(_0xe50c('0x1b'));var client=jayson[_0xe50c('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x25ff2a,_0x39e9f5,_0x5231c2){if(_0x5231c2){var _0x125348=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x125348['test'](_0x39e9f5)){return _0x25ff2a;}else{throw new db[(_0xe50c('0x1d'))]['ValidationError'](_0xe50c('0x1e'));}}else{return _0x25ff2a;}}function respondWithRpcPromise(_0x286e04,_0x20644b,_0x201c53,_0x204073){return new BPromise(function(_0x59172e,_0x3eac33){var _0x1df1af=_0x204073||client;return _0x1df1af[_0xe50c('0x1f')](_0x286e04,_0x201c53)[_0xe50c('0x20')](function(_0x19e077){logger[_0xe50c('0x21')]('Dynamics365Account,\x20%s,\x20%s',_0x20644b,'request\x20sent');logger[_0xe50c('0x22')](_0xe50c('0x23'),_0x20644b,_0xe50c('0x24'),JSON['stringify'](_0x19e077));if(_0x19e077['error']){if(_0x19e077[_0xe50c('0x25')][_0xe50c('0x26')]===0x1f4){logger[_0xe50c('0x25')](_0xe50c('0x27'),_0x20644b,_0x19e077[_0xe50c('0x25')]['message']);return _0x3eac33(_0x19e077[_0xe50c('0x25')][_0xe50c('0x28')]);}logger[_0xe50c('0x25')]('Dynamics365Account,\x20%s,\x20%s',_0x20644b,_0x19e077[_0xe50c('0x25')][_0xe50c('0x28')]);return _0x59172e(_0x19e077[_0xe50c('0x25')][_0xe50c('0x28')]);}else{logger[_0xe50c('0x21')]('Dynamics365Account,\x20%s,\x20%s',_0x20644b,'request\x20sent');_0x59172e(_0x19e077[_0xe50c('0x29')]['message']);}})[_0xe50c('0x2a')](function(_0x291df6){logger['error'](_0xe50c('0x27'),_0x20644b,_0x291df6);_0x3eac33(_0x291df6);});});}function respondWithStatusCode(_0x172da5,_0x3a56a2){_0x3a56a2=_0x3a56a2||0xcc;return function(_0x232c3a){if(_0x232c3a){return _0x172da5[_0xe50c('0x2b')](_0x3a56a2);}return _0x172da5[_0xe50c('0x2c')](_0x3a56a2)[_0xe50c('0x2d')]();};}function respondWithResult(_0x1f79fb,_0x4f1a4d){_0x4f1a4d=_0x4f1a4d||0xc8;return function(_0x1a6d91){if(_0x1a6d91){return _0x1f79fb['status'](_0x4f1a4d)[_0xe50c('0x2e')](_0x1a6d91);}};}function respondWithFilteredResult(_0x404b8a,_0x4f372e){return function(_0x48f5f5){if(_0x48f5f5){var _0x7368d9=_0x48f5f5[_0xe50c('0x2f')],_0x2f58bc=_0x4f372e[_0xe50c('0x30')],_0x2ab5a9=_0x4f372e['offset']+_0x4f372e[_0xe50c('0x31')],_0x35796c;if(_0x2ab5a9>=_0x7368d9){_0x2ab5a9=_0x7368d9;_0x35796c=0xc8;}else{_0x35796c=0xce;}_0x404b8a[_0xe50c('0x2c')](_0x35796c);return _0x404b8a[_0xe50c('0x32')]('Content-Range',_0x2f58bc+'-'+_0x2ab5a9+'/'+_0x7368d9)[_0xe50c('0x2e')](_0x48f5f5);}return null;};}function patchUpdates(_0x5a6cd3){return function(_0x66af6b){try{jsonpatch[_0xe50c('0x33')](_0x66af6b,_0x5a6cd3,!![]);}catch(_0x5b1d05){return BPromise[_0xe50c('0x34')](_0x5b1d05);}return _0x66af6b[_0xe50c('0x35')]();};}function saveUpdates(_0x5a999d,_0xd3d335){return function(_0x38705b){if(_0x38705b){return _0x38705b['update'](_0x5a999d)[_0xe50c('0x20')](function(_0x54fa7c){return _0x54fa7c;});}return null;};}function removeEntity(_0x5e99d7,_0x1b009b){return function(_0x2b2ae5){if(_0x2b2ae5){return _0x2b2ae5['destroy']()[_0xe50c('0x20')](function(){_0x5e99d7[_0xe50c('0x2c')](0xcc)[_0xe50c('0x2d')]();});}};}function handleEntityNotFound(_0x28d508,_0x49c2fd){return function(_0x1dd5ec){if(!_0x1dd5ec){_0x28d508[_0xe50c('0x2b')](0x194);}return _0x1dd5ec;};}function handleError(_0x5531a5,_0x529807){_0x529807=_0x529807||0x1f4;return function(_0x4d00e6){logger['error'](_0x4d00e6[_0xe50c('0x36')]);if(_0x4d00e6['name']){delete _0x4d00e6[_0xe50c('0x37')];}_0x5531a5['status'](_0x529807)[_0xe50c('0x38')](_0x4d00e6);};}exports[_0xe50c('0x39')]=function(_0x31ff05,_0x284b9e){var _0x28115a={},_0xf2c28f={},_0x130d78={'count':0x0,'rows':[]};var _0x9b741c=_['map'](db['Dynamics365Account'][_0xe50c('0x3a')],function(_0x32ce3d){return{'name':_0x32ce3d[_0xe50c('0x3b')],'type':_0x32ce3d[_0xe50c('0x3c')][_0xe50c('0x3d')]};});_0xf2c28f[_0xe50c('0x3e')]=_[_0xe50c('0x3f')](_0x9b741c,'name');_0xf2c28f[_0xe50c('0x40')]=_['keys'](_0x31ff05[_0xe50c('0x40')]);_0xf2c28f[_0xe50c('0x41')]=_[_0xe50c('0x42')](_0xf2c28f[_0xe50c('0x3e')],_0xf2c28f['query']);_0x28115a[_0xe50c('0x43')]=_[_0xe50c('0x42')](_0xf2c28f[_0xe50c('0x3e')],qs['fields'](_0x31ff05[_0xe50c('0x40')][_0xe50c('0x44')]));_0x28115a[_0xe50c('0x43')]=_0x28115a[_0xe50c('0x43')][_0xe50c('0x45')]?_0x28115a[_0xe50c('0x43')]:_0xf2c28f[_0xe50c('0x3e')];if(!_0x31ff05[_0xe50c('0x40')][_0xe50c('0x46')]('nolimit')){_0x28115a['limit']=qs[_0xe50c('0x31')](_0x31ff05[_0xe50c('0x40')][_0xe50c('0x31')]);_0x28115a['offset']=qs['offset'](_0x31ff05[_0xe50c('0x40')][_0xe50c('0x30')]);}_0x28115a[_0xe50c('0x47')]=qs[_0xe50c('0x48')](_0x31ff05[_0xe50c('0x40')][_0xe50c('0x48')]);_0x28115a[_0xe50c('0x49')]=qs[_0xe50c('0x41')](_[_0xe50c('0x4a')](_0x31ff05[_0xe50c('0x40')],_0xf2c28f[_0xe50c('0x41')]),_0x9b741c);if(_0x31ff05[_0xe50c('0x40')]['filter']){_0x28115a[_0xe50c('0x49')]=_[_0xe50c('0x4b')](_0x28115a[_0xe50c('0x49')],{'$or':_['map'](_0x9b741c,function(_0x2c5a73){if(_0x2c5a73[_0xe50c('0x3c')]!==_0xe50c('0x4c')){var _0x3eb4f0={};_0x3eb4f0[_0x2c5a73[_0xe50c('0x37')]]={'$like':'%'+_0x31ff05['query'][_0xe50c('0x4d')]+'%'};return _0x3eb4f0;}})});}_0x28115a=_[_0xe50c('0x4b')]({},_0x28115a,_0x31ff05[_0xe50c('0x4e')]);var _0x3b06bc={'where':_0x28115a[_0xe50c('0x49')]};return db['Dynamics365Account'][_0xe50c('0x2f')](_0x3b06bc)[_0xe50c('0x20')](function(_0x57d7be){_0x130d78[_0xe50c('0x2f')]=_0x57d7be;if(_0x31ff05[_0xe50c('0x40')][_0xe50c('0x4f')]){_0x28115a[_0xe50c('0x50')]=[{'all':!![]}];}return db[_0xe50c('0x51')][_0xe50c('0x52')](_0x28115a);})[_0xe50c('0x20')](function(_0x36cf8b){_0x130d78[_0xe50c('0x53')]=_0x36cf8b;return _0x130d78;})[_0xe50c('0x20')](respondWithFilteredResult(_0x284b9e,_0x28115a))['catch'](handleError(_0x284b9e,null));};exports[_0xe50c('0x54')]=function(_0x1a8b10,_0x4ce265){var _0x4bada3={'raw':![],'where':{'id':_0x1a8b10[_0xe50c('0x55')]['id']}},_0x35c6ed={};_0x35c6ed[_0xe50c('0x3e')]=_[_0xe50c('0x56')](db['Dynamics365Account'][_0xe50c('0x3a')]);_0x35c6ed[_0xe50c('0x40')]=_[_0xe50c('0x56')](_0x1a8b10['query']);_0x35c6ed['filters']=_['intersection'](_0x35c6ed[_0xe50c('0x3e')],_0x35c6ed[_0xe50c('0x40')]);_0x4bada3[_0xe50c('0x43')]=_[_0xe50c('0x42')](_0x35c6ed[_0xe50c('0x3e')],qs[_0xe50c('0x44')](_0x1a8b10[_0xe50c('0x40')][_0xe50c('0x44')]));_0x4bada3[_0xe50c('0x43')]=_0x4bada3[_0xe50c('0x43')][_0xe50c('0x45')]?_0x4bada3[_0xe50c('0x43')]:_0x35c6ed[_0xe50c('0x3e')];if(_0x1a8b10[_0xe50c('0x40')]['includeAll']){_0x4bada3[_0xe50c('0x50')]=[{'all':!![]}];}_0x4bada3=_['merge']({},_0x4bada3,_0x1a8b10[_0xe50c('0x4e')]);return db[_0xe50c('0x51')][_0xe50c('0x57')](_0x4bada3)['then'](handleEntityNotFound(_0x4ce265,null))[_0xe50c('0x20')](respondWithResult(_0x4ce265,null))[_0xe50c('0x2a')](handleError(_0x4ce265,null));};exports[_0xe50c('0x58')]=function(_0x381e30,_0x2143fc){return db['Dynamics365Account']['create'](_0x381e30[_0xe50c('0x59')],{})[_0xe50c('0x20')](respondWithResult(_0x2143fc,0xc9))[_0xe50c('0x2a')](handleError(_0x2143fc,null));};exports[_0xe50c('0x5a')]=function(_0x16e927,_0x3f2569){if(_0x16e927[_0xe50c('0x59')]['id']){delete _0x16e927[_0xe50c('0x59')]['id'];}return db[_0xe50c('0x51')][_0xe50c('0x57')]({'where':{'id':_0x16e927['params']['id']}})['then'](handleEntityNotFound(_0x3f2569,null))[_0xe50c('0x20')](saveUpdates(_0x16e927[_0xe50c('0x59')],null))[_0xe50c('0x20')](respondWithResult(_0x3f2569,null))['catch'](handleError(_0x3f2569,null));};exports[_0xe50c('0x5b')]=function(_0x584c27,_0x2f0b69){return db[_0xe50c('0x51')]['find']({'where':{'id':_0x584c27[_0xe50c('0x55')]['id']}})['then'](handleEntityNotFound(_0x2f0b69,null))[_0xe50c('0x20')](removeEntity(_0x2f0b69,null))[_0xe50c('0x2a')](handleError(_0x2f0b69,null));};exports['getConfigurations']=function(_0x34ea7f,_0x2d084b,_0x34c2e9){var _0x40f0c6={};var _0x3fe6ef={};var _0x3b7b58;var _0x2de79b;return db[_0xe50c('0x51')][_0xe50c('0x5c')]({'where':{'id':_0x34ea7f['params']['id']}})[_0xe50c('0x20')](handleEntityNotFound(_0x2d084b,null))[_0xe50c('0x20')](function(_0xdc0c9f){if(_0xdc0c9f){_0x3b7b58=_0xdc0c9f;_0x3fe6ef[_0xe50c('0x3e')]=_[_0xe50c('0x56')](db[_0xe50c('0x5d')][_0xe50c('0x3a')]);_0x3fe6ef['query']=_['keys'](_0x34ea7f[_0xe50c('0x40')]);_0x3fe6ef[_0xe50c('0x41')]=_[_0xe50c('0x42')](_0x3fe6ef[_0xe50c('0x3e')],_0x3fe6ef[_0xe50c('0x40')]);_0x40f0c6[_0xe50c('0x43')]=_[_0xe50c('0x42')](_0x3fe6ef['model'],qs[_0xe50c('0x44')](_0x34ea7f[_0xe50c('0x40')][_0xe50c('0x44')]));_0x40f0c6[_0xe50c('0x43')]=_0x40f0c6[_0xe50c('0x43')][_0xe50c('0x45')]?_0x40f0c6['attributes']:_0x3fe6ef[_0xe50c('0x3e')];_0x40f0c6[_0xe50c('0x47')]=qs['sort'](_0x34ea7f[_0xe50c('0x40')][_0xe50c('0x48')]);_0x40f0c6['where']=qs[_0xe50c('0x41')](_[_0xe50c('0x4a')](_0x34ea7f[_0xe50c('0x40')],_0x3fe6ef['filters']));if(_0x34ea7f[_0xe50c('0x40')][_0xe50c('0x4d')]){_0x40f0c6[_0xe50c('0x49')]=_[_0xe50c('0x4b')](_0x40f0c6[_0xe50c('0x49')],{'$or':_[_0xe50c('0x3f')](_0x40f0c6[_0xe50c('0x43')],function(_0x2c3c4d){var _0x2d3488={};_0x2d3488[_0x2c3c4d]={'$like':'%'+_0x34ea7f[_0xe50c('0x40')][_0xe50c('0x4d')]+'%'};return _0x2d3488;})});}_0x40f0c6=_['merge']({},_0x40f0c6,_0x34ea7f[_0xe50c('0x4e')]);return _0x3b7b58['getConfigurations'](_0x40f0c6);}})[_0xe50c('0x20')](function(_0x5ad26a){if(_0x5ad26a){_0x2de79b=_0x5ad26a['length'];if(!_0x34ea7f[_0xe50c('0x40')][_0xe50c('0x46')](_0xe50c('0x5e'))){_0x40f0c6['limit']=qs['limit'](_0x34ea7f[_0xe50c('0x40')][_0xe50c('0x31')]);_0x40f0c6[_0xe50c('0x30')]=qs[_0xe50c('0x30')](_0x34ea7f[_0xe50c('0x40')][_0xe50c('0x30')]);}return _0x3b7b58[_0xe50c('0x5f')](_0x40f0c6);}})['then'](function(_0x46cd12){if(_0x46cd12){return _0x46cd12?{'count':_0x2de79b,'rows':_0x46cd12}:null;}})[_0xe50c('0x20')](respondWithResult(_0x2d084b,null))[_0xe50c('0x2a')](handleError(_0x2d084b,null));};exports['addConfiguration']=function(_0x57c709,_0xb70e7b,_0xf7e997){if(_0x57c709[_0xe50c('0x59')]['id']){delete _0x57c709[_0xe50c('0x59')]['id'];}return db[_0xe50c('0x51')][_0xe50c('0x5c')]({'where':{'id':_0x57c709[_0xe50c('0x55')]['id']}})[_0xe50c('0x20')](handleEntityNotFound(_0xb70e7b,null))[_0xe50c('0x20')](function(_0x99a0e9){if(_0x99a0e9){_0x57c709['body'][_0xe50c('0x60')]=_0x99a0e9['id'];_0x57c709['body'][_0xe50c('0x61')]=integrations['getSubjects'](_0x57c709[_0xe50c('0x59')][_0xe50c('0x62')],_0x57c709[_0xe50c('0x59')]['type']);_0x57c709[_0xe50c('0x59')][_0xe50c('0x63')]=integrations[_0xe50c('0x64')](_0x57c709[_0xe50c('0x59')][_0xe50c('0x62')],_0x57c709['body']['type']);return db[_0xe50c('0x5d')][_0xe50c('0x58')](_0x57c709[_0xe50c('0x59')],{'include':[{'model':db['Dynamics365Field'],'as':_0xe50c('0x61')},{'model':db[_0xe50c('0x65')],'as':_0xe50c('0x63')}]});}return null;})['then'](respondWithResult(_0xb70e7b,null))[_0xe50c('0x2a')](handleError(_0xb70e7b,null));};exports['getFields']=function(_0x2b9671,_0x31035b,_0x4dc13c){var _0x37a90f=_0x2b9671[_0xe50c('0x40')][_0xe50c('0x66')];var _0x448c7b=_0x37a90f===_0xe50c('0x67')?_0xe50c('0x68'):_0xe50c('0x69');var _0x3e8849='';var _0x49d572='';var _0x34cf93='';var _0x546254='';var _0x34e3a6='';var _0x34cd86='';var _0x617b01='';var _0x192339='';var _0x11c889=[_0xe50c('0x6a'),_0xe50c('0x6b'),_0xe50c('0x6c'),_0xe50c('0x6d'),_0xe50c('0x6e'),_0xe50c('0x6f'),_0xe50c('0x70'),'regardingobjectid',_0xe50c('0x71'),_0xe50c('0x72')];var _0x459dd5=[_0xe50c('0x73'),_0xe50c('0x74'),_0xe50c('0x75'),_0xe50c('0x76'),_0xe50c('0x77'),_0xe50c('0x78'),_0xe50c('0x79'),'contractidname',_0xe50c('0x7a'),_0xe50c('0x7b'),_0xe50c('0x7c'),'createdbyyominame',_0xe50c('0x7d'),_0xe50c('0x7e'),_0xe50c('0x7f'),_0xe50c('0x80'),'customeridtype',_0xe50c('0x81'),'emailaddress','entitlementidname',_0xe50c('0x82'),_0xe50c('0x83'),_0xe50c('0x84'),'exchangerate',_0xe50c('0x85'),_0xe50c('0x86'),'importsequencenumber',_0xe50c('0x87'),_0xe50c('0x88'),_0xe50c('0x89'),_0xe50c('0x8a'),_0xe50c('0x8b'),_0xe50c('0x8c'),_0xe50c('0x8d'),'modifiedbyyominame',_0xe50c('0x8e'),_0xe50c('0x8f'),_0xe50c('0x90'),_0xe50c('0x91'),_0xe50c('0x92'),'numberofchildincidents',_0xe50c('0x93'),_0xe50c('0x94'),_0xe50c('0x95'),_0xe50c('0x96'),'owneridyominame',_0xe50c('0x97'),_0xe50c('0x98'),_0xe50c('0x99'),_0xe50c('0x9a'),_0xe50c('0x9b'),_0xe50c('0x9c'),_0xe50c('0x9d'),'resolvebykpiidname',_0xe50c('0x9e'),_0xe50c('0x9f'),'responsiblecontactidyominame',_0xe50c('0xa0'),'slainvokedidname',_0xe50c('0xa1'),'socialprofileidname',_0xe50c('0xa2'),_0xe50c('0xa3'),_0xe50c('0xa4'),_0xe50c('0xa5'),_0xe50c('0xa6'),_0xe50c('0xa7'),_0xe50c('0xa8'),'utcconversiontimezonecode','versionnumber'];var _0x55cd20=_0x11c889[_0xe50c('0xa9')](_0x459dd5);return db[_0xe50c('0x51')]['findOne']({'where':{'id':_0x2b9671[_0xe50c('0x55')]['id']},'attributes':['id',_0xe50c('0xaa'),_0xe50c('0xab'),'remoteUri','tenantId',_0xe50c('0xac'),_0xe50c('0xad')]})[_0xe50c('0x20')](handleEntityNotFound(_0x31035b,null))['then'](function(_0x491710){if(_0x491710){_0x192339=_0x491710['remoteUri'];var _0x2c2504=_0x192339[_0xe50c('0xae')](-0x1);if(_0x2c2504==='/'){_0x192339=_0x192339['substring'](0x0,_0x192339['lastIndexOf'](_0x2c2504));}_0x617b01=util[_0xe50c('0xaf')](_0xe50c('0xb0'),_0x192339);var _0x7dae0={'method':'POST','uri':_0xe50c('0xb1')+_0x491710['tenantId']+_0xe50c('0xb2'),'form':{'client_id':_0x491710[_0xe50c('0xac')],'resource':_0x192339,'username':_0x491710['username'],'password':_0x491710[_0xe50c('0xab')],'grant_type':_0xe50c('0xab'),'client_secret':_0x491710[_0xe50c('0xad')]},'json':!![]};return rp(_0x7dae0);}})['then'](function(_0x2c2558){_0x34cd86=_0x2c2558[_0xe50c('0xb3')];var _0x144767={'method':_0xe50c('0xb4'),'uri':encodeURI(_0x617b01+_0xe50c('0xb5')+_0x448c7b+'\x27'),'headers':{'Authorization':_0xe50c('0xb6')+_0x34cd86,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x144767);})[_0xe50c('0x20')](function(_0x335796){var _0x49726d=_0x335796['value'][0x0];var _0x2fb935=_0x49726d[_0xe50c('0xb7')];var _0x4af720={'method':'GET','uri':_0x617b01+_0xe50c('0xb8')+_0x2fb935+_0xe50c('0xb9'),'headers':{'Authorization':_0xe50c('0xb6')+_0x34cd86,'If-None-Match':null,'OData-Version':_0xe50c('0xba')},'json':!![]};return rp(_0x4af720);})['then'](function(_0x2eb9f6){_0x3e8849=_0x2eb9f6;_0x49d572=_0x3e8849[_0xe50c('0xbb')];_0x49d572=_[_0xe50c('0xbc')](_0x49d572,function(_0x9861f2){return!_0x55cd20['includes'](_0x9861f2[_0xe50c('0xbd')]);});var _0x5b8683=[];var _0x9a90e6=[];_0x49d572['forEach'](function(_0xd3f271){if(_0xd3f271[_0xe50c('0xbe')]){var _0x45d0c6=_0xd3f271['@odata.type']['substring'](_0xd3f271[_0xe50c('0xbe')][_0xe50c('0xbf')]('.')+0x1);if(_0x45d0c6===_0xe50c('0xc0')){_0x5b8683[_0xe50c('0xc1')](getSelectList(_0x617b01,_0x37a90f,_0x9a90e6,_0x3e8849['MetadataId'],_0xd3f271[_0xe50c('0xb7')],_0x34cd86));}}});return Promise[_0xe50c('0xc2')](_0x5b8683);})[_0xe50c('0x20')](function(_0x51c1f8){_0x34cf93=_0x51c1f8[0x0];var _0x1b35c0=[];var _0x51e9c5=[];_0x49d572[_0xe50c('0xc3')](function(_0x4c1714){if(!_[_0xe50c('0xc4')](_0x4c1714[_0xe50c('0xbe')])){var _0x3fd18f=_0x4c1714[_0xe50c('0xbe')][_0xe50c('0xc5')](_0x4c1714[_0xe50c('0xbe')][_0xe50c('0xbf')]('.')+0x1);if(_0x3fd18f===_0xe50c('0xc6')){_0x1b35c0['push'](getBooleanList(_0x617b01,_0x37a90f,_0x51e9c5,_0x3e8849[_0xe50c('0xb7')],_0x4c1714['MetadataId'],_0x34cd86));}}});return Promise[_0xe50c('0xc2')](_0x1b35c0);})[_0xe50c('0x20')](function(_0x27f80c){_0x546254=_0x27f80c[0x0];var _0x121326=[];var _0x390243=[];_0x49d572['forEach'](function(_0x2dfa3d){if(_0x2dfa3d[_0xe50c('0xbe')]){var _0xe0474=_0x2dfa3d[_0xe50c('0xbe')]['substring'](_0x2dfa3d['@odata.type'][_0xe50c('0xbf')]('.')+0x1);if(_0xe0474===_0xe50c('0xc7')||_0xe0474==='DoubleAttributeMetadata'||_0xe0474===_0xe50c('0xc8')||_0xe0474==='IntegerAttributeMetadata'||_0xe0474===_0xe50c('0xc9')||_0xe0474===_0xe50c('0xca')||_0xe0474===_0xe50c('0xcb')||_0xe0474===_0xe50c('0xcc')||_0xe0474===_0xe50c('0xcd')||_0xe0474===_0xe50c('0xce')){_0x121326[_0xe50c('0xc1')](getInputList(_0x617b01,_0x37a90f,_0xe0474,_0x390243,_0x3e8849[_0xe50c('0xb7')],_0x2dfa3d[_0xe50c('0xb7')],_0x34cd86));}}});return Promise[_0xe50c('0xc2')](_0x121326);})[_0xe50c('0x20')](function(_0x2de22d){_0x34e3a6=_0x2de22d[0x0];var _0x165778=_0x34cf93[_0xe50c('0xa9')](_0x546254)[_0xe50c('0xa9')](_0x34e3a6);var _0x202a64={'count':_0x165778['length'],'rows':_0x165778};return _0x202a64;})['then'](respondWithResult(_0x31035b,null))['catch'](function(_0x435790){var _0x2b5157=_0x2b9671[_0xe50c('0x40')][_0xe50c('0xcf')]?0x1f4:_0x435790[_0xe50c('0xd0')]||0x1f4;logger[_0xe50c('0x25')](_0x435790[_0xe50c('0x36')]);delete _0x435790[_0xe50c('0x37')];if(_0x2b5157===0x191){_0x2b5157=0x190;}_0x31035b['status'](_0x2b5157)[_0xe50c('0x38')](_0x2b9671[_0xe50c('0x40')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x435790[_0xe50c('0xd0')]}:_0x435790);});};function getSelectList(_0x46118,_0x12b43a,_0x22290d,_0x211685,_0x2c9917,_0x43d46d){var _0x566732={'method':'GET','uri':_0x46118+_0xe50c('0xb8')+_0x211685+_0xe50c('0xd1')+_0x2c9917+_0xe50c('0xd2')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xe50c('0xb6')+_0x43d46d,'If-None-Match':null,'OData-Version':_0xe50c('0xba')},'json':!![]};return rp(_0x566732)[_0xe50c('0x20')](function(_0x47576e){var _0x399c76=[];var _0x2b6aa0=_0x47576e[_0xe50c('0xd3')][_0xe50c('0xd4')];_0x2b6aa0['forEach'](function(_0x1a71df){_0x399c76[_0xe50c('0xc1')]({'name':_0x1a71df[_0xe50c('0xd5')]['UserLocalizedLabel'][_0xe50c('0xd5')],'value':String(_0x1a71df[_0xe50c('0xd6')])});});var _0x5d6824={'id':_0x12b43a+'_'+_0x47576e['LogicalName'],'name':_0x47576e[_0xe50c('0xd7')][_0xe50c('0xd8')][_0xe50c('0xd5')],'custom':![],'options':_0x399c76};_0x22290d[_0xe50c('0xc1')](_0x5d6824);return _0x22290d;});}function getBooleanList(_0xbeb415,_0x293878,_0x53e8f3,_0x2c5f32,_0x586876,_0x528781){var _0x282dfd={'method':_0xe50c('0xb4'),'uri':_0xbeb415+_0xe50c('0xb8')+_0x2c5f32+_0xe50c('0xd1')+_0x586876+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x528781,'If-None-Match':null,'OData-Version':_0xe50c('0xba')},'json':!![]};return rp(_0x282dfd)[_0xe50c('0x20')](function(_0x7c4aad){var _0xbad63f=[];_0xbad63f['push']({'name':_0x7c4aad[_0xe50c('0xd3')][_0xe50c('0xd9')][_0xe50c('0xd5')][_0xe50c('0xd8')][_0xe50c('0xd5')],'value':_0xe50c('0xda')},{'name':_0x7c4aad[_0xe50c('0xd3')][_0xe50c('0xdb')][_0xe50c('0xd5')][_0xe50c('0xd8')]['Label'],'value':_0xe50c('0xdc')});var _0x14f9e7={'id':_0x293878+'_'+_0x7c4aad['LogicalName'],'name':_0x7c4aad[_0xe50c('0xd7')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0xbad63f};_0x53e8f3['push'](_0x14f9e7);return _0x53e8f3;});}function getInputList(_0x52e634,_0x14aa8c,_0x34a4b9,_0x1990c0,_0x526444,_0x4ddca1,_0x23f548){var _0x3d9c95={'method':_0xe50c('0xb4'),'uri':_0x52e634+_0xe50c('0xb8')+_0x526444+_0xe50c('0xd1')+_0x4ddca1+_0xe50c('0xdd')+_0x34a4b9+_0xe50c('0xde'),'headers':{'Authorization':_0xe50c('0xb6')+_0x23f548,'If-None-Match':null,'OData-Version':_0xe50c('0xba')},'json':!![]};return rp(_0x3d9c95)[_0xe50c('0x20')](function(_0x21ca1f){var _0x4ff2b9={'id':_0x14aa8c+'_'+_0x21ca1f[_0xe50c('0xbd')],'name':_0x21ca1f[_0xe50c('0xd7')][_0xe50c('0xd8')]?_0x21ca1f[_0xe50c('0xd7')]['UserLocalizedLabel'][_0xe50c('0xd5')]:_0x21ca1f[_0xe50c('0xbd')],'custom':![],'options':[]};_0x1990c0['push'](_0x4ff2b9);return _0x1990c0;});} \ No newline at end of file +var _0xff1c=['clientSecret','slice','substring','lastIndexOf','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','password','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','remove','includes','@odata.type','push','all','forEach','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','Value','LogicalName','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','false','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','offset','limit','status','set','Content-Range','json','apply','update','destroy','stack','name','send','map','Dynamics365Account','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','find','create','body','params','findOne','Dynamics365Configuration','getConfigurations','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','ticketType','incident','PhoneCall','title','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entityimage_timestamp','escalatedon','exchangerate','importsequencenumber','influencescore','lastonholdtime','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','concat','username','remoteUri','clientId'];(function(_0x2edb08,_0x5bcfd2){var _0x175554=function(_0x250b0b){while(--_0x250b0b){_0x2edb08['push'](_0x2edb08['shift']());}};_0x175554(++_0x5bcfd2);}(_0xff1c,0x1f2));var _0xcff1=function(_0x492b6d,_0x33df50){_0x492b6d=_0x492b6d-0x0;var _0x409f3c=_0xff1c[_0x492b6d];return _0x409f3c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcff1('0x0'));var rimraf=require(_0xcff1('0x1'));var zipdir=require(_0xcff1('0x2'));var jsonpatch=require(_0xcff1('0x3'));var rp=require(_0xcff1('0x4'));var moment=require(_0xcff1('0x5'));var BPromise=require(_0xcff1('0x6'));var Mustache=require(_0xcff1('0x7'));var util=require(_0xcff1('0x8'));var path=require(_0xcff1('0x9'));var sox=require(_0xcff1('0xa'));var csv=require('to-csv');var ejs=require(_0xcff1('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcff1('0xc'));var crypto=require(_0xcff1('0xd'));var jsforce=require(_0xcff1('0xe'));var deskjs=require(_0xcff1('0xf'));var toCsv=require(_0xcff1('0x10'));var querystring=require(_0xcff1('0x11'));var Papa=require(_0xcff1('0x12'));var Redis=require(_0xcff1('0x13'));var authService=require(_0xcff1('0x14'));var qs=require(_0xcff1('0x15'));var as=require(_0xcff1('0x16'));var hardwareService=require(_0xcff1('0x17'));var logger=require(_0xcff1('0x18'))(_0xcff1('0x19'));var utils=require('../../config/utils');var config=require(_0xcff1('0x1a'));var db=require(_0xcff1('0x1b'))['db'];var integrations=require(_0xcff1('0x1c'));var jayson=require(_0xcff1('0x1d'));var client=jayson[_0xcff1('0x1e')][_0xcff1('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x69cd35,_0x3c7d65,_0x5ac63c){if(_0x5ac63c){var _0x16cefd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16cefd[_0xcff1('0x20')](_0x3c7d65)){return _0x69cd35;}else{throw new db['Sequelize'][(_0xcff1('0x21'))](_0xcff1('0x22'));}}else{return _0x69cd35;}}function respondWithRpcPromise(_0x2350fa,_0x2e04db,_0x277aaa,_0x58814f){return new BPromise(function(_0x565361,_0x5943a2){var _0x327539=_0x58814f||client;return _0x327539[_0xcff1('0x23')](_0x2350fa,_0x277aaa)[_0xcff1('0x24')](function(_0x1563ba){logger[_0xcff1('0x25')](_0xcff1('0x26'),_0x2e04db,_0xcff1('0x27'));logger[_0xcff1('0x28')](_0xcff1('0x29'),_0x2e04db,_0xcff1('0x27'),JSON[_0xcff1('0x2a')](_0x1563ba));if(_0x1563ba['error']){if(_0x1563ba[_0xcff1('0x2b')][_0xcff1('0x2c')]===0x1f4){logger['error'](_0xcff1('0x26'),_0x2e04db,_0x1563ba[_0xcff1('0x2b')]['message']);return _0x5943a2(_0x1563ba[_0xcff1('0x2b')][_0xcff1('0x2d')]);}logger[_0xcff1('0x2b')](_0xcff1('0x26'),_0x2e04db,_0x1563ba[_0xcff1('0x2b')][_0xcff1('0x2d')]);return _0x565361(_0x1563ba[_0xcff1('0x2b')][_0xcff1('0x2d')]);}else{logger[_0xcff1('0x25')](_0xcff1('0x26'),_0x2e04db,_0xcff1('0x27'));_0x565361(_0x1563ba[_0xcff1('0x2e')][_0xcff1('0x2d')]);}})[_0xcff1('0x2f')](function(_0x2cb2b2){logger[_0xcff1('0x2b')](_0xcff1('0x26'),_0x2e04db,_0x2cb2b2);_0x5943a2(_0x2cb2b2);});});}function respondWithStatusCode(_0x303a52,_0xbcd0df){_0xbcd0df=_0xbcd0df||0xcc;return function(_0xce9e64){if(_0xce9e64){return _0x303a52[_0xcff1('0x30')](_0xbcd0df);}return _0x303a52['status'](_0xbcd0df)[_0xcff1('0x31')]();};}function respondWithResult(_0x2c435e,_0x4b65e4){_0x4b65e4=_0x4b65e4||0xc8;return function(_0x3e204a){if(_0x3e204a){return _0x2c435e['status'](_0x4b65e4)['json'](_0x3e204a);}};}function respondWithFilteredResult(_0x2ea46b,_0x5a63b8){return function(_0x1d3803){if(_0x1d3803){var _0x5910eb=_0x1d3803['count'],_0x13b969=_0x5a63b8[_0xcff1('0x32')],_0x5ce2ca=_0x5a63b8[_0xcff1('0x32')]+_0x5a63b8[_0xcff1('0x33')],_0x1e593c;if(_0x5ce2ca>=_0x5910eb){_0x5ce2ca=_0x5910eb;_0x1e593c=0xc8;}else{_0x1e593c=0xce;}_0x2ea46b[_0xcff1('0x34')](_0x1e593c);return _0x2ea46b[_0xcff1('0x35')](_0xcff1('0x36'),_0x13b969+'-'+_0x5ce2ca+'/'+_0x5910eb)[_0xcff1('0x37')](_0x1d3803);}return null;};}function patchUpdates(_0x1e5f78){return function(_0x24885b){try{jsonpatch[_0xcff1('0x38')](_0x24885b,_0x1e5f78,!![]);}catch(_0x34bcff){return BPromise['reject'](_0x34bcff);}return _0x24885b['save']();};}function saveUpdates(_0x4d48fe,_0x15dc9e){return function(_0xb8ef6b){if(_0xb8ef6b){return _0xb8ef6b[_0xcff1('0x39')](_0x4d48fe)[_0xcff1('0x24')](function(_0x45db6c){return _0x45db6c;});}return null;};}function removeEntity(_0x4e33ff,_0x4f95dc){return function(_0x37e022){if(_0x37e022){return _0x37e022[_0xcff1('0x3a')]()[_0xcff1('0x24')](function(){_0x4e33ff[_0xcff1('0x34')](0xcc)[_0xcff1('0x31')]();});}};}function handleEntityNotFound(_0x416c60,_0x28b012){return function(_0x5b034a){if(!_0x5b034a){_0x416c60['sendStatus'](0x194);}return _0x5b034a;};}function handleError(_0x4dedc9,_0x990437){_0x990437=_0x990437||0x1f4;return function(_0x519f06){logger[_0xcff1('0x2b')](_0x519f06[_0xcff1('0x3b')]);if(_0x519f06[_0xcff1('0x3c')]){delete _0x519f06[_0xcff1('0x3c')];}_0x4dedc9[_0xcff1('0x34')](_0x990437)[_0xcff1('0x3d')](_0x519f06);};}exports['index']=function(_0x4248bb,_0x9eb1c0){var _0x2b0baf={},_0x43cb10={},_0x4718f6={'count':0x0,'rows':[]};var _0x1c45e0=_[_0xcff1('0x3e')](db[_0xcff1('0x3f')][_0xcff1('0x40')],function(_0x2e4424){return{'name':_0x2e4424['fieldName'],'type':_0x2e4424[_0xcff1('0x41')][_0xcff1('0x42')]};});_0x43cb10[_0xcff1('0x43')]=_[_0xcff1('0x3e')](_0x1c45e0,'name');_0x43cb10[_0xcff1('0x44')]=_[_0xcff1('0x45')](_0x4248bb[_0xcff1('0x44')]);_0x43cb10[_0xcff1('0x46')]=_['intersection'](_0x43cb10['model'],_0x43cb10[_0xcff1('0x44')]);_0x2b0baf[_0xcff1('0x47')]=_[_0xcff1('0x48')](_0x43cb10[_0xcff1('0x43')],qs[_0xcff1('0x49')](_0x4248bb['query'][_0xcff1('0x49')]));_0x2b0baf[_0xcff1('0x47')]=_0x2b0baf['attributes'][_0xcff1('0x4a')]?_0x2b0baf[_0xcff1('0x47')]:_0x43cb10[_0xcff1('0x43')];if(!_0x4248bb[_0xcff1('0x44')][_0xcff1('0x4b')](_0xcff1('0x4c'))){_0x2b0baf[_0xcff1('0x33')]=qs[_0xcff1('0x33')](_0x4248bb[_0xcff1('0x44')][_0xcff1('0x33')]);_0x2b0baf[_0xcff1('0x32')]=qs[_0xcff1('0x32')](_0x4248bb[_0xcff1('0x44')][_0xcff1('0x32')]);}_0x2b0baf[_0xcff1('0x4d')]=qs[_0xcff1('0x4e')](_0x4248bb['query'][_0xcff1('0x4e')]);_0x2b0baf[_0xcff1('0x4f')]=qs[_0xcff1('0x46')](_[_0xcff1('0x50')](_0x4248bb[_0xcff1('0x44')],_0x43cb10[_0xcff1('0x46')]),_0x1c45e0);if(_0x4248bb[_0xcff1('0x44')]['filter']){_0x2b0baf[_0xcff1('0x4f')]=_[_0xcff1('0x51')](_0x2b0baf[_0xcff1('0x4f')],{'$or':_[_0xcff1('0x3e')](_0x1c45e0,function(_0x170094){if(_0x170094[_0xcff1('0x41')]!==_0xcff1('0x52')){var _0x533661={};_0x533661[_0x170094[_0xcff1('0x3c')]]={'$like':'%'+_0x4248bb[_0xcff1('0x44')][_0xcff1('0x53')]+'%'};return _0x533661;}})});}_0x2b0baf=_[_0xcff1('0x51')]({},_0x2b0baf,_0x4248bb[_0xcff1('0x54')]);var _0x447fd3={'where':_0x2b0baf[_0xcff1('0x4f')]};return db[_0xcff1('0x3f')][_0xcff1('0x55')](_0x447fd3)['then'](function(_0x1ce56c){_0x4718f6[_0xcff1('0x55')]=_0x1ce56c;if(_0x4248bb[_0xcff1('0x44')][_0xcff1('0x56')]){_0x2b0baf[_0xcff1('0x57')]=[{'all':!![]}];}return db[_0xcff1('0x3f')][_0xcff1('0x58')](_0x2b0baf);})[_0xcff1('0x24')](function(_0x3ea715){_0x4718f6[_0xcff1('0x59')]=_0x3ea715;return _0x4718f6;})['then'](respondWithFilteredResult(_0x9eb1c0,_0x2b0baf))[_0xcff1('0x2f')](handleError(_0x9eb1c0,null));};exports['show']=function(_0x5d0b3b,_0xf3d5af){var _0x4acdf3={'raw':![],'where':{'id':_0x5d0b3b['params']['id']}},_0x44f30e={};_0x44f30e[_0xcff1('0x43')]=_[_0xcff1('0x45')](db[_0xcff1('0x3f')][_0xcff1('0x40')]);_0x44f30e['query']=_['keys'](_0x5d0b3b[_0xcff1('0x44')]);_0x44f30e[_0xcff1('0x46')]=_[_0xcff1('0x48')](_0x44f30e[_0xcff1('0x43')],_0x44f30e[_0xcff1('0x44')]);_0x4acdf3[_0xcff1('0x47')]=_[_0xcff1('0x48')](_0x44f30e[_0xcff1('0x43')],qs[_0xcff1('0x49')](_0x5d0b3b[_0xcff1('0x44')][_0xcff1('0x49')]));_0x4acdf3[_0xcff1('0x47')]=_0x4acdf3[_0xcff1('0x47')][_0xcff1('0x4a')]?_0x4acdf3[_0xcff1('0x47')]:_0x44f30e['model'];if(_0x5d0b3b['query']['includeAll']){_0x4acdf3[_0xcff1('0x57')]=[{'all':!![]}];}_0x4acdf3=_[_0xcff1('0x51')]({},_0x4acdf3,_0x5d0b3b[_0xcff1('0x54')]);return db[_0xcff1('0x3f')][_0xcff1('0x5a')](_0x4acdf3)[_0xcff1('0x24')](handleEntityNotFound(_0xf3d5af,null))['then'](respondWithResult(_0xf3d5af,null))[_0xcff1('0x2f')](handleError(_0xf3d5af,null));};exports[_0xcff1('0x5b')]=function(_0x1f97c2,_0x3a0ba5){return db[_0xcff1('0x3f')][_0xcff1('0x5b')](_0x1f97c2[_0xcff1('0x5c')],{})['then'](respondWithResult(_0x3a0ba5,0xc9))[_0xcff1('0x2f')](handleError(_0x3a0ba5,null));};exports[_0xcff1('0x39')]=function(_0xcef496,_0x121dc8){if(_0xcef496[_0xcff1('0x5c')]['id']){delete _0xcef496[_0xcff1('0x5c')]['id'];}return db[_0xcff1('0x3f')]['find']({'where':{'id':_0xcef496[_0xcff1('0x5d')]['id']}})[_0xcff1('0x24')](handleEntityNotFound(_0x121dc8,null))[_0xcff1('0x24')](saveUpdates(_0xcef496[_0xcff1('0x5c')],null))[_0xcff1('0x24')](respondWithResult(_0x121dc8,null))[_0xcff1('0x2f')](handleError(_0x121dc8,null));};exports[_0xcff1('0x3a')]=function(_0x5ed168,_0x51e3c0){return db['Dynamics365Account']['find']({'where':{'id':_0x5ed168[_0xcff1('0x5d')]['id']}})[_0xcff1('0x24')](handleEntityNotFound(_0x51e3c0,null))[_0xcff1('0x24')](removeEntity(_0x51e3c0,null))[_0xcff1('0x2f')](handleError(_0x51e3c0,null));};exports['getConfigurations']=function(_0x33c439,_0x1599ee,_0x193a60){var _0x1bcccd={};var _0x17bb12={};var _0x5f05af;var _0x60bca5;return db[_0xcff1('0x3f')][_0xcff1('0x5e')]({'where':{'id':_0x33c439[_0xcff1('0x5d')]['id']}})[_0xcff1('0x24')](handleEntityNotFound(_0x1599ee,null))[_0xcff1('0x24')](function(_0x13212f){if(_0x13212f){_0x5f05af=_0x13212f;_0x17bb12[_0xcff1('0x43')]=_[_0xcff1('0x45')](db[_0xcff1('0x5f')]['rawAttributes']);_0x17bb12[_0xcff1('0x44')]=_[_0xcff1('0x45')](_0x33c439[_0xcff1('0x44')]);_0x17bb12['filters']=_['intersection'](_0x17bb12['model'],_0x17bb12[_0xcff1('0x44')]);_0x1bcccd[_0xcff1('0x47')]=_['intersection'](_0x17bb12[_0xcff1('0x43')],qs[_0xcff1('0x49')](_0x33c439['query']['fields']));_0x1bcccd[_0xcff1('0x47')]=_0x1bcccd[_0xcff1('0x47')]['length']?_0x1bcccd[_0xcff1('0x47')]:_0x17bb12[_0xcff1('0x43')];_0x1bcccd[_0xcff1('0x4d')]=qs[_0xcff1('0x4e')](_0x33c439[_0xcff1('0x44')]['sort']);_0x1bcccd[_0xcff1('0x4f')]=qs[_0xcff1('0x46')](_[_0xcff1('0x50')](_0x33c439[_0xcff1('0x44')],_0x17bb12[_0xcff1('0x46')]));if(_0x33c439[_0xcff1('0x44')]['filter']){_0x1bcccd['where']=_[_0xcff1('0x51')](_0x1bcccd[_0xcff1('0x4f')],{'$or':_[_0xcff1('0x3e')](_0x1bcccd[_0xcff1('0x47')],function(_0x1d6121){var _0x7027d2={};_0x7027d2[_0x1d6121]={'$like':'%'+_0x33c439[_0xcff1('0x44')]['filter']+'%'};return _0x7027d2;})});}_0x1bcccd=_['merge']({},_0x1bcccd,_0x33c439[_0xcff1('0x54')]);return _0x5f05af[_0xcff1('0x60')](_0x1bcccd);}})[_0xcff1('0x24')](function(_0x47057b){if(_0x47057b){_0x60bca5=_0x47057b['length'];if(!_0x33c439[_0xcff1('0x44')][_0xcff1('0x4b')](_0xcff1('0x4c'))){_0x1bcccd[_0xcff1('0x33')]=qs[_0xcff1('0x33')](_0x33c439[_0xcff1('0x44')][_0xcff1('0x33')]);_0x1bcccd[_0xcff1('0x32')]=qs['offset'](_0x33c439[_0xcff1('0x44')][_0xcff1('0x32')]);}return _0x5f05af['getConfigurations'](_0x1bcccd);}})[_0xcff1('0x24')](function(_0x34623d){if(_0x34623d){return _0x34623d?{'count':_0x60bca5,'rows':_0x34623d}:null;}})[_0xcff1('0x24')](respondWithResult(_0x1599ee,null))['catch'](handleError(_0x1599ee,null));};exports[_0xcff1('0x61')]=function(_0x41413d,_0x2c5f00,_0x216267){if(_0x41413d[_0xcff1('0x5c')]['id']){delete _0x41413d['body']['id'];}return db[_0xcff1('0x3f')]['findOne']({'where':{'id':_0x41413d['params']['id']}})['then'](handleEntityNotFound(_0x2c5f00,null))['then'](function(_0x37a3f9){if(_0x37a3f9){_0x41413d[_0xcff1('0x5c')][_0xcff1('0x62')]=_0x37a3f9['id'];_0x41413d[_0xcff1('0x5c')][_0xcff1('0x63')]=integrations['getSubjects'](_0x41413d['body']['channel'],_0x41413d[_0xcff1('0x5c')][_0xcff1('0x41')]);_0x41413d['body'][_0xcff1('0x64')]=integrations[_0xcff1('0x65')](_0x41413d['body'][_0xcff1('0x66')],_0x41413d['body']['type']);return db[_0xcff1('0x5f')][_0xcff1('0x5b')](_0x41413d[_0xcff1('0x5c')],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0xcff1('0x24')](respondWithResult(_0x2c5f00,null))[_0xcff1('0x2f')](handleError(_0x2c5f00,null));};exports['getFields']=function(_0x4d21eb,_0x3e4b55,_0x4cf6da){var _0x22d31f=_0x4d21eb[_0xcff1('0x44')][_0xcff1('0x67')];var _0xa56eb8=_0x22d31f===_0xcff1('0x68')?'Incident':_0xcff1('0x69');var _0x210236='';var _0x12e42d='';var _0x3859ef='';var _0x53e62c='';var _0xc33195='';var _0x218530='';var _0x4ffbaa='';var _0x59ff33='';var _0x279cee=[_0xcff1('0x6a'),'description','customerid',_0xcff1('0x6b'),_0xcff1('0x6c'),'subject',_0xcff1('0x6d'),_0xcff1('0x6e'),_0xcff1('0x6f'),'phonecall_activity_parties'];var _0x53a58b=[_0xcff1('0x70'),_0xcff1('0x71'),_0xcff1('0x72'),_0xcff1('0x73'),_0xcff1('0x74'),_0xcff1('0x75'),_0xcff1('0x76'),_0xcff1('0x77'),_0xcff1('0x78'),_0xcff1('0x79'),_0xcff1('0x7a'),_0xcff1('0x7b'),_0xcff1('0x7c'),_0xcff1('0x7d'),_0xcff1('0x7e'),_0xcff1('0x7f'),_0xcff1('0x80'),'customeridyominame',_0xcff1('0x81'),'entitlementidname',_0xcff1('0x82'),'entityimage_url',_0xcff1('0x83'),_0xcff1('0x84'),'firstresponsebykpiidname','followupby',_0xcff1('0x85'),_0xcff1('0x86'),'kbarticleidname',_0xcff1('0x87'),'masteridname','modifiedbyexternalpartyname',_0xcff1('0x88'),'modifiedbyname',_0xcff1('0x89'),_0xcff1('0x8a'),_0xcff1('0x8b'),_0xcff1('0x8c'),_0xcff1('0x8d'),_0xcff1('0x8e'),'numberofchildincidents',_0xcff1('0x8f'),_0xcff1('0x90'),_0xcff1('0x91'),'owneridtype',_0xcff1('0x92'),_0xcff1('0x93'),_0xcff1('0x94'),_0xcff1('0x95'),_0xcff1('0x96'),'productidname',_0xcff1('0x97'),_0xcff1('0x98'),_0xcff1('0x99'),_0xcff1('0x9a'),_0xcff1('0x9b'),_0xcff1('0x9c'),_0xcff1('0x9d'),_0xcff1('0x9e'),_0xcff1('0x9f'),_0xcff1('0xa0'),'statecode',_0xcff1('0xa1'),_0xcff1('0xa2'),_0xcff1('0xa3'),_0xcff1('0xa4'),'transactioncurrencyidname',_0xcff1('0xa5'),_0xcff1('0xa6'),'versionnumber'];var _0x48a6ae=_0x279cee[_0xcff1('0xa7')](_0x53a58b);return db['Dynamics365Account'][_0xcff1('0x5e')]({'where':{'id':_0x4d21eb[_0xcff1('0x5d')]['id']},'attributes':['id',_0xcff1('0xa8'),'password',_0xcff1('0xa9'),'tenantId',_0xcff1('0xaa'),_0xcff1('0xab')]})[_0xcff1('0x24')](handleEntityNotFound(_0x3e4b55,null))[_0xcff1('0x24')](function(_0x14583c){if(_0x14583c){_0x59ff33=_0x14583c[_0xcff1('0xa9')];var _0x40d1ea=_0x59ff33[_0xcff1('0xac')](-0x1);if(_0x40d1ea==='/'){_0x59ff33=_0x59ff33[_0xcff1('0xad')](0x0,_0x59ff33[_0xcff1('0xae')](_0x40d1ea));}_0x4ffbaa=util['format'](_0xcff1('0xaf'),_0x59ff33);var _0x127287={'method':_0xcff1('0xb0'),'uri':_0xcff1('0xb1')+_0x14583c[_0xcff1('0xb2')]+_0xcff1('0xb3'),'form':{'client_id':_0x14583c[_0xcff1('0xaa')],'resource':_0x59ff33,'username':_0x14583c['username'],'password':_0x14583c[_0xcff1('0xb4')],'grant_type':'password','client_secret':_0x14583c[_0xcff1('0xab')]},'json':!![]};return rp(_0x127287);}})['then'](function(_0x1a6bc4){_0x218530=_0x1a6bc4[_0xcff1('0xb5')];var _0x12f5e2={'method':_0xcff1('0xb6'),'uri':encodeURI(_0x4ffbaa+_0xcff1('0xb7')+_0xa56eb8+'\x27'),'headers':{'Authorization':_0xcff1('0xb8')+_0x218530,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x12f5e2);})[_0xcff1('0x24')](function(_0x32e696){var _0x303c43=_0x32e696['value'][0x0];var _0x48ae34=_0x303c43[_0xcff1('0xb9')];var _0x4d9432={'method':_0xcff1('0xb6'),'uri':_0x4ffbaa+_0xcff1('0xba')+_0x48ae34+_0xcff1('0xbb'),'headers':{'Authorization':'Bearer\x20'+_0x218530,'If-None-Match':null,'OData-Version':_0xcff1('0xbc')},'json':!![]};return rp(_0x4d9432);})[_0xcff1('0x24')](function(_0x5e6b40){_0x210236=_0x5e6b40;_0x12e42d=_0x210236['Attributes'];_0x12e42d=_[_0xcff1('0xbd')](_0x12e42d,function(_0x1721c5){return!_0x48a6ae[_0xcff1('0xbe')](_0x1721c5['LogicalName']);});var _0xa00aa8=[];var _0x432868=[];_0x12e42d['forEach'](function(_0x216e5a){if(_0x216e5a[_0xcff1('0xbf')]){var _0x51fe09=_0x216e5a[_0xcff1('0xbf')]['substring'](_0x216e5a[_0xcff1('0xbf')][_0xcff1('0xae')]('.')+0x1);if(_0x51fe09==='PicklistAttributeMetadata'){_0xa00aa8[_0xcff1('0xc0')](getSelectList(_0x4ffbaa,_0x22d31f,_0x432868,_0x210236['MetadataId'],_0x216e5a[_0xcff1('0xb9')],_0x218530));}}});return Promise[_0xcff1('0xc1')](_0xa00aa8);})[_0xcff1('0x24')](function(_0x5e8a27){_0x3859ef=_0x5e8a27[0x0];var _0x1b8ca0=[];var _0xf015f7=[];_0x12e42d[_0xcff1('0xc2')](function(_0x218c5e){if(!_[_0xcff1('0xc3')](_0x218c5e[_0xcff1('0xbf')])){var _0x5a8bb2=_0x218c5e[_0xcff1('0xbf')]['substring'](_0x218c5e[_0xcff1('0xbf')][_0xcff1('0xae')]('.')+0x1);if(_0x5a8bb2===_0xcff1('0xc4')){_0x1b8ca0['push'](getBooleanList(_0x4ffbaa,_0x22d31f,_0xf015f7,_0x210236[_0xcff1('0xb9')],_0x218c5e[_0xcff1('0xb9')],_0x218530));}}});return Promise[_0xcff1('0xc1')](_0x1b8ca0);})[_0xcff1('0x24')](function(_0x1bfd38){_0x53e62c=_0x1bfd38[0x0];var _0x4d60dc=[];var _0x51dcf5=[];_0x12e42d[_0xcff1('0xc2')](function(_0x458485){if(_0x458485[_0xcff1('0xbf')]){var _0x1b76ef=_0x458485['@odata.type'][_0xcff1('0xad')](_0x458485[_0xcff1('0xbf')][_0xcff1('0xae')]('.')+0x1);if(_0x1b76ef===_0xcff1('0xc5')||_0x1b76ef===_0xcff1('0xc6')||_0x1b76ef===_0xcff1('0xc7')||_0x1b76ef===_0xcff1('0xc8')||_0x1b76ef===_0xcff1('0xc9')||_0x1b76ef===_0xcff1('0xca')||_0x1b76ef==='StatusAttributeMetadata'||_0x1b76ef===_0xcff1('0xcb')||_0x1b76ef===_0xcff1('0xcc')||_0x1b76ef===_0xcff1('0xcd')){_0x4d60dc[_0xcff1('0xc0')](getInputList(_0x4ffbaa,_0x22d31f,_0x1b76ef,_0x51dcf5,_0x210236['MetadataId'],_0x458485['MetadataId'],_0x218530));}}});return Promise[_0xcff1('0xc1')](_0x4d60dc);})[_0xcff1('0x24')](function(_0x3a3c96){_0xc33195=_0x3a3c96[0x0];var _0x40bcee=_0x3859ef['concat'](_0x53e62c)[_0xcff1('0xa7')](_0xc33195);var _0x160be0={'count':_0x40bcee[_0xcff1('0x4a')],'rows':_0x40bcee};return _0x160be0;})[_0xcff1('0x24')](respondWithResult(_0x3e4b55,null))['catch'](function(_0x57605d){var _0x1efe68=_0x4d21eb[_0xcff1('0x44')][_0xcff1('0x20')]?0x1f4:_0x57605d[_0xcff1('0xce')]||0x1f4;logger['error'](_0x57605d['stack']);delete _0x57605d['name'];if(_0x1efe68===0x191){_0x1efe68=0x190;}_0x3e4b55[_0xcff1('0x34')](_0x1efe68)['send'](_0x4d21eb[_0xcff1('0x44')][_0xcff1('0x20')]?{'message':_0xcff1('0xcf'),'statusCode':_0x57605d[_0xcff1('0xce')]}:_0x57605d);});};function getSelectList(_0x53e09e,_0x1b2be6,_0x3c022c,_0x3758f9,_0x4e2284,_0x4a4507){var _0x2f8751={'method':_0xcff1('0xb6'),'uri':_0x53e09e+_0xcff1('0xba')+_0x3758f9+_0xcff1('0xd0')+_0x4e2284+_0xcff1('0xd1')+_0xcff1('0xd2'),'headers':{'Authorization':_0xcff1('0xb8')+_0x4a4507,'If-None-Match':null,'OData-Version':_0xcff1('0xbc')},'json':!![]};return rp(_0x2f8751)['then'](function(_0x42bfae){var _0x5a39f1=[];var _0x245097=_0x42bfae[_0xcff1('0xd3')][_0xcff1('0xd4')];_0x245097[_0xcff1('0xc2')](function(_0x404c0c){_0x5a39f1[_0xcff1('0xc0')]({'name':_0x404c0c['Label']['UserLocalizedLabel'][_0xcff1('0xd5')],'value':String(_0x404c0c[_0xcff1('0xd6')])});});var _0x5b70c4={'id':_0x1b2be6+'_'+_0x42bfae[_0xcff1('0xd7')],'name':_0x42bfae[_0xcff1('0xd8')][_0xcff1('0xd9')][_0xcff1('0xd5')],'custom':![],'options':_0x5a39f1};_0x3c022c['push'](_0x5b70c4);return _0x3c022c;});}function getBooleanList(_0x2962a7,_0x501dbf,_0x5c02ab,_0x155b6c,_0x41e128,_0x5561c5){var _0x19b58e={'method':_0xcff1('0xb6'),'uri':_0x2962a7+_0xcff1('0xba')+_0x155b6c+')/Attributes('+_0x41e128+_0xcff1('0xda'),'headers':{'Authorization':_0xcff1('0xb8')+_0x5561c5,'If-None-Match':null,'OData-Version':_0xcff1('0xbc')},'json':!![]};return rp(_0x19b58e)['then'](function(_0x4f5f3e){var _0x3def47=[];_0x3def47[_0xcff1('0xc0')]({'name':_0x4f5f3e[_0xcff1('0xd3')][_0xcff1('0xdb')]['Label'][_0xcff1('0xd9')][_0xcff1('0xd5')],'value':_0xcff1('0xdc')},{'name':_0x4f5f3e[_0xcff1('0xd3')]['FalseOption'][_0xcff1('0xd5')][_0xcff1('0xd9')][_0xcff1('0xd5')],'value':_0xcff1('0xdd')});var _0x42c46d={'id':_0x501dbf+'_'+_0x4f5f3e[_0xcff1('0xd7')],'name':_0x4f5f3e['DisplayName'][_0xcff1('0xd9')][_0xcff1('0xd5')],'custom':![],'options':_0x3def47};_0x5c02ab[_0xcff1('0xc0')](_0x42c46d);return _0x5c02ab;});}function getInputList(_0x306500,_0x54d724,_0x1bfd62,_0x7798b6,_0x2cc520,_0x39c811,_0x3d0ae5){var _0xbc5a3d={'method':_0xcff1('0xb6'),'uri':_0x306500+_0xcff1('0xba')+_0x2cc520+')/Attributes('+_0x39c811+')/Microsoft.Dynamics.CRM.'+_0x1bfd62+_0xcff1('0xde'),'headers':{'Authorization':_0xcff1('0xb8')+_0x3d0ae5,'If-None-Match':null,'OData-Version':_0xcff1('0xbc')},'json':!![]};return rp(_0xbc5a3d)['then'](function(_0x1ada24){var _0x340588={'id':_0x54d724+'_'+_0x1ada24[_0xcff1('0xd7')],'name':_0x1ada24[_0xcff1('0xd8')][_0xcff1('0xd9')]?_0x1ada24[_0xcff1('0xd8')][_0xcff1('0xd9')][_0xcff1('0xd5')]:_0x1ada24[_0xcff1('0xd7')],'custom':![],'options':[]};_0x7798b6[_0xcff1('0xc0')](_0x340588);return _0x7798b6;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 4b2fada..e2d780e 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 _0x9149=['../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9149,0x1d7));var _0x9914=function(_0xb975ad,_0x4ffa34){_0xb975ad=_0xb975ad-0x0;var _0x17aa41=_0x9149[_0xb975ad];return _0x17aa41;};'use strict';var _=require(_0x9914('0x0'));var util=require(_0x9914('0x1'));var logger=require(_0x9914('0x2'))(_0x9914('0x3'));var moment=require(_0x9914('0x4'));var BPromise=require(_0x9914('0x5'));var rp=require(_0x9914('0x6'));var fs=require('fs');var path=require(_0x9914('0x7'));var rimraf=require(_0x9914('0x8'));var config=require(_0x9914('0x9'));var attributes=require(_0x9914('0xa'));var integrations=require(_0x9914('0xb'));module[_0x9914('0xc')]=function(_0x1a7b55,_0x3fd926){return _0x1a7b55[_0x9914('0xd')](_0x9914('0xe'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5cad=['../../config/environment','./intDynamics365Account.attributes','exports','define','int_dynamics365_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x2f2ce8,_0x254bea){var _0x1198a0=function(_0x47f38b){while(--_0x47f38b){_0x2f2ce8['push'](_0x2f2ce8['shift']());}};_0x1198a0(++_0x254bea);}(_0x5cad,0x116));var _0xd5ca=function(_0x334524,_0x1fca82){_0x334524=_0x334524-0x0;var _0x870ae9=_0x5cad[_0x334524];return _0x870ae9;};'use strict';var _=require(_0xd5ca('0x0'));var util=require(_0xd5ca('0x1'));var logger=require(_0xd5ca('0x2'))(_0xd5ca('0x3'));var moment=require(_0xd5ca('0x4'));var BPromise=require(_0xd5ca('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd5ca('0x6'));var rimraf=require(_0xd5ca('0x7'));var config=require(_0xd5ca('0x8'));var attributes=require(_0xd5ca('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xd5ca('0xa')]=function(_0x2a0d2f,_0x309bbe){return _0x2a0d2f[_0xd5ca('0xb')]('Dynamics365Account',attributes,{'tableName':_0xd5ca('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index b8a4ded..f7335da 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 _0x46e1=['error','code','message','result','catch','GetDynamics365Account','findAll','options','raw','where','include','model','attributes','map','ShowDynamics365Account','Dynamics365Account','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s'];(function(_0x128c56,_0x40560b){var _0x64456b=function(_0x289187){while(--_0x289187){_0x128c56['push'](_0x128c56['shift']());}};_0x64456b(++_0x40560b);}(_0x46e1,0x155));var _0x146e=function(_0x5ea944,_0x55f4fa){_0x5ea944=_0x5ea944-0x0;var _0x3093bb=_0x46e1[_0x5ea944];return _0x3093bb;};'use strict';var _=require(_0x146e('0x0'));var util=require(_0x146e('0x1'));var moment=require(_0x146e('0x2'));var BPromise=require(_0x146e('0x3'));var rs=require(_0x146e('0x4'));var fs=require('fs');var Redis=require(_0x146e('0x5'));var db=require(_0x146e('0x6'))['db'];var utils=require(_0x146e('0x7'));var logger=require(_0x146e('0x8'))(_0x146e('0x9'));var config=require('../../config/environment');var jayson=require(_0x146e('0xa'));var client=jayson[_0x146e('0xb')][_0x146e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x228fe7,_0x70ce4,_0x35e40e){return new BPromise(function(_0x1c1398,_0x5f33c0){return client[_0x146e('0xd')](_0x228fe7,_0x35e40e)['then'](function(_0x36f843){logger[_0x146e('0xe')](_0x146e('0xf'),_0x70ce4,_0x146e('0x10'));logger[_0x146e('0x11')](_0x146e('0x12'),_0x70ce4,'request\x20sent',JSON['stringify'](_0x36f843));if(_0x36f843[_0x146e('0x13')]){if(_0x36f843[_0x146e('0x13')][_0x146e('0x14')]===0x1f4){logger[_0x146e('0x13')](_0x146e('0xf'),_0x70ce4,_0x36f843[_0x146e('0x13')][_0x146e('0x15')]);return _0x5f33c0(_0x36f843[_0x146e('0x13')]['message']);}logger['error'](_0x146e('0xf'),_0x70ce4,_0x36f843[_0x146e('0x13')][_0x146e('0x15')]);return _0x1c1398(_0x36f843[_0x146e('0x13')][_0x146e('0x15')]);}else{logger[_0x146e('0xe')](_0x146e('0xf'),_0x70ce4,_0x146e('0x10'));_0x1c1398(_0x36f843[_0x146e('0x16')][_0x146e('0x15')]);}})[_0x146e('0x17')](function(_0x55fddc){logger[_0x146e('0x13')](_0x146e('0xf'),_0x70ce4,_0x55fddc);_0x5f33c0(_0x55fddc);});});}exports[_0x146e('0x18')]=function(_0x88e062){var _0x2286f6=this;return new Promise(function(_0x431a60,_0x256db5){return db['Dynamics365Account'][_0x146e('0x19')]({'raw':_0x88e062['options']?_0x88e062[_0x146e('0x1a')][_0x146e('0x1b')]===undefined?!![]:![]:!![],'where':_0x88e062[_0x146e('0x1a')]?_0x88e062['options'][_0x146e('0x1c')]||null:null,'attributes':_0x88e062['options']?_0x88e062[_0x146e('0x1a')]['attributes']||null:null,'limit':_0x88e062[_0x146e('0x1a')]?_0x88e062[_0x146e('0x1a')]['limit']||null:null,'include':_0x88e062['options']?_0x88e062['options']['include']?_['map'](_0x88e062['options'][_0x146e('0x1d')],function(_0x504016){return{'model':db[_0x504016[_0x146e('0x1e')]],'as':_0x504016['as'],'attributes':_0x504016[_0x146e('0x1f')],'include':_0x504016[_0x146e('0x1d')]?_[_0x146e('0x20')](_0x504016[_0x146e('0x1d')],function(_0xed7b99){return{'model':db[_0xed7b99[_0x146e('0x1e')]],'as':_0xed7b99['as'],'attributes':_0xed7b99['attributes'],'include':_0xed7b99[_0x146e('0x1d')]?_['map'](_0xed7b99[_0x146e('0x1d')],function(_0x4afb82){return{'model':db[_0x4afb82['model']],'as':_0x4afb82['as'],'attributes':_0x4afb82[_0x146e('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x402faf){logger[_0x146e('0xe')](_0x146e('0x18'),_0x88e062);logger[_0x146e('0x11')](_0x146e('0x18'),_0x88e062,JSON['stringify'](_0x402faf));_0x431a60(_0x402faf);})[_0x146e('0x17')](function(_0x46cf9a){logger[_0x146e('0x13')](_0x146e('0x18'),_0x46cf9a[_0x146e('0x15')],_0x88e062);_0x256db5(_0x2286f6[_0x146e('0x13')](0x1f4,_0x46cf9a[_0x146e('0x15')]));});});};exports[_0x146e('0x21')]=function(_0x502324){var _0x500120=this;return new Promise(function(_0x37c5d8,_0x5f0c5c){return db[_0x146e('0x22')]['find']({'raw':_0x502324['options']?_0x502324[_0x146e('0x1a')][_0x146e('0x1b')]===undefined?!![]:![]:!![],'where':_0x502324[_0x146e('0x1a')]?_0x502324[_0x146e('0x1a')][_0x146e('0x1c')]||null:null,'attributes':_0x502324[_0x146e('0x1a')]?_0x502324['options'][_0x146e('0x1f')]||null:null,'include':_0x502324['options']?_0x502324[_0x146e('0x1a')]['include']?_[_0x146e('0x20')](_0x502324[_0x146e('0x1a')][_0x146e('0x1d')],function(_0x56c6d6){return{'model':db[_0x56c6d6[_0x146e('0x1e')]],'as':_0x56c6d6['as'],'attributes':_0x56c6d6[_0x146e('0x1f')],'include':_0x56c6d6['include']?_[_0x146e('0x20')](_0x56c6d6[_0x146e('0x1d')],function(_0x2f438d){return{'model':db[_0x2f438d[_0x146e('0x1e')]],'as':_0x2f438d['as'],'attributes':_0x2f438d[_0x146e('0x1f')],'include':_0x2f438d[_0x146e('0x1d')]?_[_0x146e('0x20')](_0x2f438d['include'],function(_0x500a7c){return{'model':db[_0x500a7c[_0x146e('0x1e')]],'as':_0x500a7c['as'],'attributes':_0x500a7c[_0x146e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x146e('0x23')](function(_0x36bb15){logger[_0x146e('0xe')](_0x146e('0x21'),_0x502324);logger['debug'](_0x146e('0x21'),_0x502324,JSON['stringify'](_0x36bb15));_0x37c5d8(_0x36bb15);})[_0x146e('0x17')](function(_0xbdb2aa){logger[_0x146e('0x13')](_0x146e('0x21'),_0xbdb2aa[_0x146e('0x15')],_0x502324);_0x5f0c5c(_0x500120[_0x146e('0x13')](0x1f4,_0xbdb2aa['message']));});});}; \ No newline at end of file +var _0x6869=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','code','error','message','info','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','include','map','model','stringify','ShowDynamics365Account','lodash','util','moment','randomstring','../../config/utils'];(function(_0x37ae2e,_0x35be3a){var _0x19c50f=function(_0x49732a){while(--_0x49732a){_0x37ae2e['push'](_0x37ae2e['shift']());}};_0x19c50f(++_0x35be3a);}(_0x6869,0xe2));var _0x9686=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6869[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x9686('0x0'));var util=require(_0x9686('0x1'));var moment=require(_0x9686('0x2'));var BPromise=require('bluebird');var rs=require(_0x9686('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9686('0x4'));var logger=require(_0x9686('0x5'))(_0x9686('0x6'));var config=require(_0x9686('0x7'));var jayson=require(_0x9686('0x8'));var client=jayson['client'][_0x9686('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e4b89,_0x55ec19,_0x561279){return new BPromise(function(_0x4ef16f,_0x1eb65b){return client[_0x9686('0xa')](_0x1e4b89,_0x561279)[_0x9686('0xb')](function(_0x316f3e){logger['info'](_0x9686('0xc'),_0x55ec19,_0x9686('0xd'));logger[_0x9686('0xe')](_0x9686('0xf'),_0x55ec19,_0x9686('0xd'),JSON['stringify'](_0x316f3e));if(_0x316f3e['error']){if(_0x316f3e['error'][_0x9686('0x10')]===0x1f4){logger[_0x9686('0x11')](_0x9686('0xc'),_0x55ec19,_0x316f3e[_0x9686('0x11')][_0x9686('0x12')]);return _0x1eb65b(_0x316f3e[_0x9686('0x11')]['message']);}logger[_0x9686('0x11')](_0x9686('0xc'),_0x55ec19,_0x316f3e['error'][_0x9686('0x12')]);return _0x4ef16f(_0x316f3e[_0x9686('0x11')][_0x9686('0x12')]);}else{logger[_0x9686('0x13')](_0x9686('0xc'),_0x55ec19,_0x9686('0xd'));_0x4ef16f(_0x316f3e['result'][_0x9686('0x12')]);}})[_0x9686('0x14')](function(_0x33026f){logger[_0x9686('0x11')](_0x9686('0xc'),_0x55ec19,_0x33026f);_0x1eb65b(_0x33026f);});});}exports[_0x9686('0x15')]=function(_0x3ed0d2){var _0x2c3919=this;return new Promise(function(_0x33213a,_0x4ff6e7){return db[_0x9686('0x16')][_0x9686('0x17')]({'raw':_0x3ed0d2[_0x9686('0x18')]?_0x3ed0d2[_0x9686('0x18')][_0x9686('0x19')]===undefined?!![]:![]:!![],'where':_0x3ed0d2[_0x9686('0x18')]?_0x3ed0d2[_0x9686('0x18')][_0x9686('0x1a')]||null:null,'attributes':_0x3ed0d2[_0x9686('0x18')]?_0x3ed0d2[_0x9686('0x18')][_0x9686('0x1b')]||null:null,'limit':_0x3ed0d2['options']?_0x3ed0d2[_0x9686('0x18')]['limit']||null:null,'include':_0x3ed0d2[_0x9686('0x18')]?_0x3ed0d2[_0x9686('0x18')][_0x9686('0x1c')]?_[_0x9686('0x1d')](_0x3ed0d2[_0x9686('0x18')]['include'],function(_0x26011e){return{'model':db[_0x26011e[_0x9686('0x1e')]],'as':_0x26011e['as'],'attributes':_0x26011e[_0x9686('0x1b')],'include':_0x26011e[_0x9686('0x1c')]?_[_0x9686('0x1d')](_0x26011e[_0x9686('0x1c')],function(_0x2f6d0e){return{'model':db[_0x2f6d0e[_0x9686('0x1e')]],'as':_0x2f6d0e['as'],'attributes':_0x2f6d0e['attributes'],'include':_0x2f6d0e['include']?_['map'](_0x2f6d0e[_0x9686('0x1c')],function(_0x6d8b87){return{'model':db[_0x6d8b87[_0x9686('0x1e')]],'as':_0x6d8b87['as'],'attributes':_0x6d8b87[_0x9686('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9686('0xb')](function(_0x33c88d){logger[_0x9686('0x13')](_0x9686('0x15'),_0x3ed0d2);logger[_0x9686('0xe')](_0x9686('0x15'),_0x3ed0d2,JSON[_0x9686('0x1f')](_0x33c88d));_0x33213a(_0x33c88d);})[_0x9686('0x14')](function(_0x4b9160){logger['error'](_0x9686('0x15'),_0x4b9160['message'],_0x3ed0d2);_0x4ff6e7(_0x2c3919['error'](0x1f4,_0x4b9160[_0x9686('0x12')]));});});};exports['ShowDynamics365Account']=function(_0x369a46){var _0x4d6495=this;return new Promise(function(_0x25d228,_0x188def){return db[_0x9686('0x16')]['find']({'raw':_0x369a46[_0x9686('0x18')]?_0x369a46[_0x9686('0x18')][_0x9686('0x19')]===undefined?!![]:![]:!![],'where':_0x369a46['options']?_0x369a46[_0x9686('0x18')][_0x9686('0x1a')]||null:null,'attributes':_0x369a46[_0x9686('0x18')]?_0x369a46[_0x9686('0x18')][_0x9686('0x1b')]||null:null,'include':_0x369a46['options']?_0x369a46[_0x9686('0x18')][_0x9686('0x1c')]?_['map'](_0x369a46[_0x9686('0x18')][_0x9686('0x1c')],function(_0x2133fb){return{'model':db[_0x2133fb[_0x9686('0x1e')]],'as':_0x2133fb['as'],'attributes':_0x2133fb[_0x9686('0x1b')],'include':_0x2133fb['include']?_[_0x9686('0x1d')](_0x2133fb['include'],function(_0x186216){return{'model':db[_0x186216[_0x9686('0x1e')]],'as':_0x186216['as'],'attributes':_0x186216[_0x9686('0x1b')],'include':_0x186216[_0x9686('0x1c')]?_[_0x9686('0x1d')](_0x186216[_0x9686('0x1c')],function(_0x4c82fc){return{'model':db[_0x4c82fc[_0x9686('0x1e')]],'as':_0x4c82fc['as'],'attributes':_0x4c82fc[_0x9686('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9686('0xb')](function(_0xde8faf){logger['info'](_0x9686('0x20'),_0x369a46);logger[_0x9686('0xe')](_0x9686('0x20'),_0x369a46,JSON[_0x9686('0x1f')](_0xde8faf));_0x25d228(_0xde8faf);})['catch'](function(_0x12ea62){logger['error']('ShowDynamics365Account',_0x12ea62['message'],_0x369a46);_0x188def(_0x4d6495[_0x9686('0x11')](0x1f4,_0x12ea62['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index e916fa3..6e0abb4 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 _0x529c=['multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','index','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id','update','delete','destroy'];(function(_0x2e73de,_0x1ad32e){var _0x27bed3=function(_0x2c1c67){while(--_0x2c1c67){_0x2e73de['push'](_0x2e73de['shift']());}};_0x27bed3(++_0x1ad32e);}(_0x529c,0x1a2));var _0xc529=function(_0x41278f,_0x2fe0cb){_0x41278f=_0x41278f-0x0;var _0x47f791=_0x529c[_0x41278f];return _0x47f791;};'use strict';var multer=require(_0xc529('0x0'));var util=require(_0xc529('0x1'));var path=require('path');var timeout=require(_0xc529('0x2'));var express=require('express');var router=express[_0xc529('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc529('0x4'));var config=require(_0xc529('0x5'));var controller=require(_0xc529('0x6'));router[_0xc529('0x7')]('/',auth['isAuthenticated'](),controller[_0xc529('0x8')]);router['get']('/:id',auth[_0xc529('0x9')](),controller['show']);router[_0xc529('0x7')](_0xc529('0xa'),auth[_0xc529('0x9')](),controller[_0xc529('0xb')]);router[_0xc529('0x7')](_0xc529('0xc'),auth['isAuthenticated'](),controller[_0xc529('0xd')]);router['get'](_0xc529('0xe'),auth['isAuthenticated'](),controller[_0xc529('0xf')]);router[_0xc529('0x10')]('/',auth[_0xc529('0x9')](),controller[_0xc529('0x11')]);router['put'](_0xc529('0x12'),auth[_0xc529('0x9')](),controller[_0xc529('0x13')]);router[_0xc529('0x14')](_0xc529('0x12'),auth[_0xc529('0x9')](),controller[_0xc529('0x15')]);module['exports']=router; \ No newline at end of file +var _0xb12f=['/:id/subjects','getSubjects','/:id/descriptions','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x13b3ed,_0x5099fa){var _0x4d91c6=function(_0x4d34b1){while(--_0x4d34b1){_0x13b3ed['push'](_0x13b3ed['shift']());}};_0x4d91c6(++_0x5099fa);}(_0xb12f,0x1e9));var _0xfb12=function(_0x2c5932,_0x30e9bc){_0x2c5932=_0x2c5932-0x0;var _0x2b58c1=_0xb12f[_0x2c5932];return _0x2b58c1;};'use strict';var multer=require(_0xfb12('0x0'));var util=require(_0xfb12('0x1'));var path=require(_0xfb12('0x2'));var timeout=require(_0xfb12('0x3'));var express=require(_0xfb12('0x4'));var router=express[_0xfb12('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xfb12('0x6'));var config=require('../../config/environment');var controller=require(_0xfb12('0x7'));router[_0xfb12('0x8')]('/',auth[_0xfb12('0x9')](),controller[_0xfb12('0xa')]);router[_0xfb12('0x8')](_0xfb12('0xb'),auth['isAuthenticated'](),controller[_0xfb12('0xc')]);router[_0xfb12('0x8')](_0xfb12('0xd'),auth[_0xfb12('0x9')](),controller[_0xfb12('0xe')]);router[_0xfb12('0x8')](_0xfb12('0xf'),auth[_0xfb12('0x9')](),controller[_0xfb12('0x10')]);router[_0xfb12('0x8')](_0xfb12('0x11'),auth[_0xfb12('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0xfb12('0x9')](),controller[_0xfb12('0x12')]);router[_0xfb12('0x13')](_0xfb12('0xb'),auth[_0xfb12('0x9')](),controller[_0xfb12('0x14')]);router[_0xfb12('0x15')]('/:id',auth[_0xfb12('0x9')](),controller[_0xfb12('0x16')]);module[_0xfb12('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 3d8e52d..b484004 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 _0x0aa8=['exports','STRING','incident','phonecall','sequelize'];(function(_0x110d88,_0x503a58){var _0x527ae2=function(_0x3f1220){while(--_0x3f1220){_0x110d88['push'](_0x110d88['shift']());}};_0x527ae2(++_0x503a58);}(_0x0aa8,0x1ee));var _0x80aa=function(_0x240261,_0x4fe66c){_0x240261=_0x240261-0x0;var _0x45c332=_0x0aa8[_0x240261];return _0x45c332;};'use strict';var Sequelize=require(_0x80aa('0x0'));module[_0x80aa('0x1')]={'name':{'type':Sequelize[_0x80aa('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x80aa('0x3'),_0x80aa('0x4')),'defaultValue':_0x80aa('0x3')}}; \ No newline at end of file +var _0x324c=['incident','phonecall','exports','STRING','ENUM'];(function(_0x21e556,_0x36bd7f){var _0x466738=function(_0x4bbb99){while(--_0x4bbb99){_0x21e556['push'](_0x21e556['shift']());}};_0x466738(++_0x36bd7f);}(_0x324c,0x1ec));var _0xc324=function(_0x14c99a,_0x20730f){_0x14c99a=_0x14c99a-0x0;var _0x46e391=_0x324c[_0x14c99a];return _0x46e391;};'use strict';var Sequelize=require('sequelize');module[_0xc324('0x0')]={'name':{'type':Sequelize[_0xc324('0x1')]},'description':{'type':Sequelize[_0xc324('0x1')]},'ticketType':{'type':Sequelize[_0xc324('0x2')](_0xc324('0x3'),_0xc324('0x4')),'defaultValue':_0xc324('0x3')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 3534852..8d8f261 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 _0x131d=['count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','filter','where','VIRTUAL','merge','options','Dynamics365Configuration','includeAll','include','findAll','rows','rawAttributes','create','body','find','params','getFields','findOne','order','pick','hasOwnProperty','getSubjects','Dynamics365Field','length','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','test','ValidationError','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','end','status','json'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x131d,0x1ae));var _0xd131=function(_0x27db84,_0x553123){_0x27db84=_0x27db84-0x0;var _0x265129=_0x131d[_0x27db84];return _0x265129;};'use strict';var pdf=require(_0xd131('0x0'));var emlformat=require(_0xd131('0x1'));var rimraf=require(_0xd131('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd131('0x3'));var rp=require(_0xd131('0x4'));var moment=require(_0xd131('0x5'));var BPromise=require(_0xd131('0x6'));var Mustache=require(_0xd131('0x7'));var util=require(_0xd131('0x8'));var path=require('path');var sox=require(_0xd131('0x9'));var csv=require(_0xd131('0xa'));var ejs=require(_0xd131('0xb'));var fs=require('fs');var _=require(_0xd131('0xc'));var squel=require('squel');var crypto=require(_0xd131('0xd'));var jsforce=require(_0xd131('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd131('0xf'));var Papa=require('papaparse');var Redis=require(_0xd131('0x10'));var authService=require(_0xd131('0x11'));var qs=require(_0xd131('0x12'));var as=require(_0xd131('0x13'));var hardwareService=require(_0xd131('0x14'));var logger=require(_0xd131('0x15'))(_0xd131('0x16'));var utils=require(_0xd131('0x17'));var config=require('../../config/environment');var db=require(_0xd131('0x18'))['db'];var jayson=require(_0xd131('0x19'));var client=jayson[_0xd131('0x1a')][_0xd131('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x137ad5,_0x1d70ad,_0x509ca8){if(_0x509ca8){var _0x4af256=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4af256[_0xd131('0x1c')](_0x1d70ad)){return _0x137ad5;}else{throw new db['Sequelize'][(_0xd131('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 _0x137ad5;}}function respondWithRpcPromise(_0x1724e1,_0x265905,_0x5739e5,_0x37dcaf){return new BPromise(function(_0xb11a40,_0x486c35){var _0xa7e726=_0x37dcaf||client;return _0xa7e726[_0xd131('0x1e')](_0x1724e1,_0x5739e5)[_0xd131('0x1f')](function(_0x22203d){logger[_0xd131('0x20')](_0xd131('0x21'),_0x265905,_0xd131('0x22'));logger[_0xd131('0x23')](_0xd131('0x24'),_0x265905,_0xd131('0x22'),JSON['stringify'](_0x22203d));if(_0x22203d[_0xd131('0x25')]){if(_0x22203d[_0xd131('0x25')][_0xd131('0x26')]===0x1f4){logger[_0xd131('0x25')]('Dynamics365Configuration,\x20%s,\x20%s',_0x265905,_0x22203d[_0xd131('0x25')][_0xd131('0x27')]);return _0x486c35(_0x22203d[_0xd131('0x25')][_0xd131('0x27')]);}logger[_0xd131('0x25')](_0xd131('0x21'),_0x265905,_0x22203d[_0xd131('0x25')]['message']);return _0xb11a40(_0x22203d['error'][_0xd131('0x27')]);}else{logger['info'](_0xd131('0x21'),_0x265905,_0xd131('0x22'));_0xb11a40(_0x22203d['result'][_0xd131('0x27')]);}})[_0xd131('0x28')](function(_0x12c6e9){logger[_0xd131('0x25')](_0xd131('0x21'),_0x265905,_0x12c6e9);_0x486c35(_0x12c6e9);});});}function respondWithStatusCode(_0x49fdd7,_0xd4b1a5){_0xd4b1a5=_0xd4b1a5||0xcc;return function(_0x319470){if(_0x319470){return _0x49fdd7[_0xd131('0x29')](_0xd4b1a5);}return _0x49fdd7['status'](_0xd4b1a5)[_0xd131('0x2a')]();};}function respondWithResult(_0x27d5b9,_0x243002){_0x243002=_0x243002||0xc8;return function(_0x19d826){if(_0x19d826){return _0x27d5b9[_0xd131('0x2b')](_0x243002)[_0xd131('0x2c')](_0x19d826);}};}function respondWithFilteredResult(_0x183f78,_0x5dce96){return function(_0x3724f4){if(_0x3724f4){var _0x27a41b=_0x3724f4[_0xd131('0x2d')],_0x18fe52=_0x5dce96['offset'],_0x2de389=_0x5dce96[_0xd131('0x2e')]+_0x5dce96[_0xd131('0x2f')],_0x15255f;if(_0x2de389>=_0x27a41b){_0x2de389=_0x27a41b;_0x15255f=0xc8;}else{_0x15255f=0xce;}_0x183f78[_0xd131('0x2b')](_0x15255f);return _0x183f78[_0xd131('0x30')](_0xd131('0x31'),_0x18fe52+'-'+_0x2de389+'/'+_0x27a41b)[_0xd131('0x2c')](_0x3724f4);}return null;};}function patchUpdates(_0x281445){return function(_0x4282f1){try{jsonpatch['apply'](_0x4282f1,_0x281445,!![]);}catch(_0x5239b1){return BPromise[_0xd131('0x32')](_0x5239b1);}return _0x4282f1[_0xd131('0x33')]();};}function saveUpdates(_0x3c2bd9,_0x3fdaae){return function(_0xb7933e){if(_0xb7933e){return _0xb7933e[_0xd131('0x34')](_0x3c2bd9)[_0xd131('0x1f')](function(_0x330043){return _0x330043;});}return null;};}function removeEntity(_0x1ef35c,_0x15d1cb){return function(_0x406f79){if(_0x406f79){return _0x406f79[_0xd131('0x35')]()['then'](function(){_0x1ef35c[_0xd131('0x2b')](0xcc)[_0xd131('0x2a')]();});}};}function handleEntityNotFound(_0x1025b2,_0x1253b1){return function(_0x248640){if(!_0x248640){_0x1025b2[_0xd131('0x29')](0x194);}return _0x248640;};}function handleError(_0x10170a,_0x7c3af1){_0x7c3af1=_0x7c3af1||0x1f4;return function(_0x48422c){logger['error'](_0x48422c[_0xd131('0x36')]);if(_0x48422c[_0xd131('0x37')]){delete _0x48422c[_0xd131('0x37')];}_0x10170a[_0xd131('0x2b')](_0x7c3af1)[_0xd131('0x38')](_0x48422c);};}exports[_0xd131('0x39')]=function(_0x339cd4,_0x48b779){var _0x15167d={},_0x4b7772={},_0x67d71d={'count':0x0,'rows':[]};var _0x4e12f0=_[_0xd131('0x3a')](db['Dynamics365Configuration']['rawAttributes'],function(_0x280e54){return{'name':_0x280e54[_0xd131('0x3b')],'type':_0x280e54[_0xd131('0x3c')][_0xd131('0x3d')]};});_0x4b7772[_0xd131('0x3e')]=_[_0xd131('0x3a')](_0x4e12f0,_0xd131('0x37'));_0x4b7772[_0xd131('0x3f')]=_[_0xd131('0x40')](_0x339cd4[_0xd131('0x3f')]);_0x4b7772[_0xd131('0x41')]=_[_0xd131('0x42')](_0x4b7772[_0xd131('0x3e')],_0x4b7772[_0xd131('0x3f')]);_0x15167d['attributes']=_[_0xd131('0x42')](_0x4b7772[_0xd131('0x3e')],qs['fields'](_0x339cd4['query'][_0xd131('0x43')]));_0x15167d[_0xd131('0x44')]=_0x15167d[_0xd131('0x44')]['length']?_0x15167d['attributes']:_0x4b7772['model'];if(!_0x339cd4['query']['hasOwnProperty'](_0xd131('0x45'))){_0x15167d['limit']=qs['limit'](_0x339cd4[_0xd131('0x3f')][_0xd131('0x2f')]);_0x15167d['offset']=qs[_0xd131('0x2e')](_0x339cd4[_0xd131('0x3f')][_0xd131('0x2e')]);}_0x15167d['order']=qs['sort'](_0x339cd4['query'][_0xd131('0x46')]);_0x15167d['where']=qs['filters'](_['pick'](_0x339cd4[_0xd131('0x3f')],_0x4b7772[_0xd131('0x41')]),_0x4e12f0);if(_0x339cd4[_0xd131('0x3f')][_0xd131('0x47')]){_0x15167d[_0xd131('0x48')]=_['merge'](_0x15167d[_0xd131('0x48')],{'$or':_[_0xd131('0x3a')](_0x4e12f0,function(_0xe2a0e4){if(_0xe2a0e4[_0xd131('0x3c')]!==_0xd131('0x49')){var _0x48b5cf={};_0x48b5cf[_0xe2a0e4[_0xd131('0x37')]]={'$like':'%'+_0x339cd4[_0xd131('0x3f')]['filter']+'%'};return _0x48b5cf;}})});}_0x15167d=_[_0xd131('0x4a')]({},_0x15167d,_0x339cd4[_0xd131('0x4b')]);var _0x55d6cc={'where':_0x15167d[_0xd131('0x48')]};return db[_0xd131('0x4c')]['count'](_0x55d6cc)['then'](function(_0x347741){_0x67d71d[_0xd131('0x2d')]=_0x347741;if(_0x339cd4[_0xd131('0x3f')][_0xd131('0x4d')]){_0x15167d[_0xd131('0x4e')]=[{'all':!![]}];}return db[_0xd131('0x4c')][_0xd131('0x4f')](_0x15167d);})[_0xd131('0x1f')](function(_0x1d68f3){_0x67d71d[_0xd131('0x50')]=_0x1d68f3;return _0x67d71d;})['then'](respondWithFilteredResult(_0x48b779,_0x15167d))[_0xd131('0x28')](handleError(_0x48b779,null));};exports['show']=function(_0x22da98,_0x4950a5){var _0x1ee641={'raw':![],'where':{'id':_0x22da98['params']['id']}},_0x543943={};_0x543943[_0xd131('0x3e')]=_[_0xd131('0x40')](db[_0xd131('0x4c')][_0xd131('0x51')]);_0x543943[_0xd131('0x3f')]=_[_0xd131('0x40')](_0x22da98['query']);_0x543943['filters']=_[_0xd131('0x42')](_0x543943[_0xd131('0x3e')],_0x543943['query']);_0x1ee641['attributes']=_[_0xd131('0x42')](_0x543943[_0xd131('0x3e')],qs[_0xd131('0x43')](_0x22da98[_0xd131('0x3f')][_0xd131('0x43')]));_0x1ee641['attributes']=_0x1ee641[_0xd131('0x44')]['length']?_0x1ee641[_0xd131('0x44')]:_0x543943[_0xd131('0x3e')];if(_0x22da98['query'][_0xd131('0x4d')]){_0x1ee641['include']=[{'all':!![]}];}_0x1ee641=_[_0xd131('0x4a')]({},_0x1ee641,_0x22da98[_0xd131('0x4b')]);return db['Dynamics365Configuration']['find'](_0x1ee641)[_0xd131('0x1f')](handleEntityNotFound(_0x4950a5,null))['then'](respondWithResult(_0x4950a5,null))[_0xd131('0x28')](handleError(_0x4950a5,null));};exports[_0xd131('0x52')]=function(_0xa1f97,_0x4763f5){return db[_0xd131('0x4c')][_0xd131('0x52')](_0xa1f97[_0xd131('0x53')],{})[_0xd131('0x1f')](respondWithResult(_0x4763f5,0xc9))['catch'](handleError(_0x4763f5,null));};exports['update']=function(_0xb63528,_0x3662f2){if(_0xb63528[_0xd131('0x53')]['id']){delete _0xb63528[_0xd131('0x53')]['id'];}return db[_0xd131('0x4c')][_0xd131('0x54')]({'where':{'id':_0xb63528[_0xd131('0x55')]['id']}})[_0xd131('0x1f')](handleEntityNotFound(_0x3662f2,null))[_0xd131('0x1f')](saveUpdates(_0xb63528[_0xd131('0x53')],null))[_0xd131('0x1f')](respondWithResult(_0x3662f2,null))[_0xd131('0x28')](handleError(_0x3662f2,null));};exports[_0xd131('0x35')]=function(_0x4089a3,_0x3d27f1){return db[_0xd131('0x4c')]['find']({'where':{'id':_0x4089a3[_0xd131('0x55')]['id']}})[_0xd131('0x1f')](handleEntityNotFound(_0x3d27f1,null))[_0xd131('0x1f')](removeEntity(_0x3d27f1,null))['catch'](handleError(_0x3d27f1,null));};exports[_0xd131('0x56')]=function(_0x21da39,_0x1cede9,_0x59d6fc){var _0x12a49a={};var _0x5e0183={};var _0x1e34d6;var _0x479ece;return db['Dynamics365Configuration'][_0xd131('0x57')]({'where':{'id':_0x21da39[_0xd131('0x55')]['id']}})[_0xd131('0x1f')](handleEntityNotFound(_0x1cede9,null))['then'](function(_0x4fdff7){if(_0x4fdff7){_0x1e34d6=_0x4fdff7;_0x5e0183['model']=_[_0xd131('0x40')](db['Dynamics365Field'][_0xd131('0x51')]);_0x5e0183[_0xd131('0x3f')]=_[_0xd131('0x40')](_0x21da39[_0xd131('0x3f')]);_0x5e0183['filters']=_[_0xd131('0x42')](_0x5e0183[_0xd131('0x3e')],_0x5e0183[_0xd131('0x3f')]);_0x12a49a[_0xd131('0x44')]=_[_0xd131('0x42')](_0x5e0183[_0xd131('0x3e')],qs[_0xd131('0x43')](_0x21da39[_0xd131('0x3f')]['fields']));_0x12a49a[_0xd131('0x44')]=_0x12a49a['attributes']['length']?_0x12a49a['attributes']:_0x5e0183['model'];_0x12a49a[_0xd131('0x58')]=qs['sort'](_0x21da39[_0xd131('0x3f')]['sort']);_0x12a49a[_0xd131('0x48')]=qs[_0xd131('0x41')](_[_0xd131('0x59')](_0x21da39[_0xd131('0x3f')],_0x5e0183[_0xd131('0x41')]));if(_0x21da39[_0xd131('0x3f')][_0xd131('0x47')]){_0x12a49a[_0xd131('0x48')]=_[_0xd131('0x4a')](_0x12a49a[_0xd131('0x48')],{'$or':_[_0xd131('0x3a')](_0x12a49a[_0xd131('0x44')],function(_0x353024){var _0x4cfc84={};_0x4cfc84[_0x353024]={'$like':'%'+_0x21da39[_0xd131('0x3f')][_0xd131('0x47')]+'%'};return _0x4cfc84;})});}_0x12a49a=_[_0xd131('0x4a')]({},_0x12a49a,_0x21da39[_0xd131('0x4b')]);return _0x1e34d6['getFields'](_0x12a49a);}})[_0xd131('0x1f')](function(_0xa336db){if(_0xa336db){_0x479ece=_0xa336db['length'];if(!_0x21da39[_0xd131('0x3f')][_0xd131('0x5a')](_0xd131('0x45'))){_0x12a49a[_0xd131('0x2f')]=qs['limit'](_0x21da39[_0xd131('0x3f')][_0xd131('0x2f')]);_0x12a49a[_0xd131('0x2e')]=qs[_0xd131('0x2e')](_0x21da39[_0xd131('0x3f')][_0xd131('0x2e')]);}return _0x1e34d6[_0xd131('0x56')](_0x12a49a);}})[_0xd131('0x1f')](function(_0x3d8866){if(_0x3d8866){return _0x3d8866?{'count':_0x479ece,'rows':_0x3d8866}:null;}})['then'](respondWithResult(_0x1cede9,null))[_0xd131('0x28')](handleError(_0x1cede9,null));};exports[_0xd131('0x5b')]=function(_0x1e4ab9,_0x421616,_0x2f5336){var _0x2163da={};var _0x2715f0={};var _0x45e997;var _0x21ad13;return db[_0xd131('0x4c')][_0xd131('0x57')]({'where':{'id':_0x1e4ab9[_0xd131('0x55')]['id']}})['then'](handleEntityNotFound(_0x421616,null))[_0xd131('0x1f')](function(_0x302cc5){if(_0x302cc5){_0x45e997=_0x302cc5;_0x2715f0[_0xd131('0x3e')]=_[_0xd131('0x40')](db[_0xd131('0x5c')]['rawAttributes']);_0x2715f0[_0xd131('0x3f')]=_[_0xd131('0x40')](_0x1e4ab9[_0xd131('0x3f')]);_0x2715f0[_0xd131('0x41')]=_[_0xd131('0x42')](_0x2715f0[_0xd131('0x3e')],_0x2715f0['query']);_0x2163da[_0xd131('0x44')]=_[_0xd131('0x42')](_0x2715f0[_0xd131('0x3e')],qs[_0xd131('0x43')](_0x1e4ab9[_0xd131('0x3f')][_0xd131('0x43')]));_0x2163da['attributes']=_0x2163da['attributes'][_0xd131('0x5d')]?_0x2163da[_0xd131('0x44')]:_0x2715f0[_0xd131('0x3e')];_0x2163da[_0xd131('0x58')]=qs[_0xd131('0x46')](_0x1e4ab9[_0xd131('0x3f')][_0xd131('0x46')]);_0x2163da[_0xd131('0x48')]=qs[_0xd131('0x41')](_[_0xd131('0x59')](_0x1e4ab9['query'],_0x2715f0['filters']));if(_0x1e4ab9['query'][_0xd131('0x47')]){_0x2163da[_0xd131('0x48')]=_[_0xd131('0x4a')](_0x2163da[_0xd131('0x48')],{'$or':_[_0xd131('0x3a')](_0x2163da[_0xd131('0x44')],function(_0x4bf1f8){var _0x4c9260={};_0x4c9260[_0x4bf1f8]={'$like':'%'+_0x1e4ab9['query']['filter']+'%'};return _0x4c9260;})});}_0x2163da=_[_0xd131('0x4a')]({},_0x2163da,_0x1e4ab9['options']);return _0x45e997[_0xd131('0x5b')](_0x2163da);}})[_0xd131('0x1f')](function(_0x4e2c02){if(_0x4e2c02){_0x21ad13=_0x4e2c02[_0xd131('0x5d')];if(!_0x1e4ab9[_0xd131('0x3f')]['hasOwnProperty']('nolimit')){_0x2163da['limit']=qs[_0xd131('0x2f')](_0x1e4ab9[_0xd131('0x3f')][_0xd131('0x2f')]);_0x2163da[_0xd131('0x2e')]=qs['offset'](_0x1e4ab9[_0xd131('0x3f')][_0xd131('0x2e')]);}return _0x45e997[_0xd131('0x5b')](_0x2163da);}})[_0xd131('0x1f')](function(_0x4d5e62){if(_0x4d5e62){return _0x4d5e62?{'count':_0x21ad13,'rows':_0x4d5e62}:null;}})[_0xd131('0x1f')](respondWithResult(_0x421616,null))['catch'](handleError(_0x421616,null));};exports[_0xd131('0x5e')]=function(_0x2018c1,_0x234178,_0xd6a146){var _0x397cc3={};var _0x2d4c99={};var _0x3a3116;var _0x5529c5;return db['Dynamics365Configuration'][_0xd131('0x57')]({'where':{'id':_0x2018c1[_0xd131('0x55')]['id']}})[_0xd131('0x1f')](handleEntityNotFound(_0x234178,null))[_0xd131('0x1f')](function(_0x1df2e6){if(_0x1df2e6){_0x3a3116=_0x1df2e6;_0x2d4c99[_0xd131('0x3e')]=_[_0xd131('0x40')](db[_0xd131('0x5c')][_0xd131('0x51')]);_0x2d4c99[_0xd131('0x3f')]=_[_0xd131('0x40')](_0x2018c1[_0xd131('0x3f')]);_0x2d4c99['filters']=_[_0xd131('0x42')](_0x2d4c99[_0xd131('0x3e')],_0x2d4c99[_0xd131('0x3f')]);_0x397cc3[_0xd131('0x44')]=_['intersection'](_0x2d4c99[_0xd131('0x3e')],qs[_0xd131('0x43')](_0x2018c1[_0xd131('0x3f')][_0xd131('0x43')]));_0x397cc3[_0xd131('0x44')]=_0x397cc3[_0xd131('0x44')]['length']?_0x397cc3[_0xd131('0x44')]:_0x2d4c99['model'];_0x397cc3[_0xd131('0x58')]=qs[_0xd131('0x46')](_0x2018c1[_0xd131('0x3f')][_0xd131('0x46')]);_0x397cc3[_0xd131('0x48')]=qs[_0xd131('0x41')](_[_0xd131('0x59')](_0x2018c1[_0xd131('0x3f')],_0x2d4c99['filters']));if(_0x2018c1[_0xd131('0x3f')]['filter']){_0x397cc3[_0xd131('0x48')]=_['merge'](_0x397cc3[_0xd131('0x48')],{'$or':_['map'](_0x397cc3['attributes'],function(_0xc07f21){var _0x4fc2a3={};_0x4fc2a3[_0xc07f21]={'$like':'%'+_0x2018c1[_0xd131('0x3f')][_0xd131('0x47')]+'%'};return _0x4fc2a3;})});}_0x397cc3=_['merge']({},_0x397cc3,_0x2018c1[_0xd131('0x4b')]);return _0x3a3116[_0xd131('0x5e')](_0x397cc3);}})['then'](function(_0xc71fea){if(_0xc71fea){_0x5529c5=_0xc71fea[_0xd131('0x5d')];if(!_0x2018c1[_0xd131('0x3f')][_0xd131('0x5a')]('nolimit')){_0x397cc3[_0xd131('0x2f')]=qs[_0xd131('0x2f')](_0x2018c1[_0xd131('0x3f')][_0xd131('0x2f')]);_0x397cc3[_0xd131('0x2e')]=qs[_0xd131('0x2e')](_0x2018c1[_0xd131('0x3f')][_0xd131('0x2e')]);}return _0x3a3116[_0xd131('0x5e')](_0x397cc3);}})[_0xd131('0x1f')](function(_0xbe7eb5){if(_0xbe7eb5){return _0xbe7eb5?{'count':_0x5529c5,'rows':_0xbe7eb5}:null;}})[_0xd131('0x1f')](respondWithResult(_0x234178,null))['catch'](handleError(_0x234178,null));}; \ No newline at end of file +var _0xe098=['find','params','findOne','Dynamics365Field','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','end','count','offset','limit','status','set','apply','reject','save','update','destroy','stack','name','send','Dynamics365Configuration','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','map','VIRTUAL','filter','merge','options','includeAll','include','rows','show','create','body'];(function(_0x970068,_0x3e4142){var _0x51063d=function(_0x32b30e){while(--_0x32b30e){_0x970068['push'](_0x970068['shift']());}};_0x51063d(++_0x3e4142);}(_0xe098,0x173));var _0x8e09=function(_0x59ab9f,_0x4a11c2){_0x59ab9f=_0x59ab9f-0x0;var _0x395042=_0xe098[_0x59ab9f];return _0x395042;};'use strict';var pdf=require(_0x8e09('0x0'));var emlformat=require(_0x8e09('0x1'));var rimraf=require(_0x8e09('0x2'));var zipdir=require(_0x8e09('0x3'));var jsonpatch=require(_0x8e09('0x4'));var rp=require('request-promise');var moment=require(_0x8e09('0x5'));var BPromise=require(_0x8e09('0x6'));var Mustache=require(_0x8e09('0x7'));var util=require(_0x8e09('0x8'));var path=require('path');var sox=require(_0x8e09('0x9'));var csv=require('to-csv');var ejs=require(_0x8e09('0xa'));var fs=require('fs');var _=require(_0x8e09('0xb'));var squel=require(_0x8e09('0xc'));var crypto=require(_0x8e09('0xd'));var jsforce=require(_0x8e09('0xe'));var deskjs=require(_0x8e09('0xf'));var toCsv=require(_0x8e09('0x10'));var querystring=require('querystring');var Papa=require(_0x8e09('0x11'));var Redis=require(_0x8e09('0x12'));var authService=require(_0x8e09('0x13'));var qs=require(_0x8e09('0x14'));var as=require(_0x8e09('0x15'));var hardwareService=require(_0x8e09('0x16'));var logger=require(_0x8e09('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x8e09('0x18'));var db=require(_0x8e09('0x19'))['db'];var jayson=require(_0x8e09('0x1a'));var client=jayson['client'][_0x8e09('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x1b32fe,_0x40269f,_0x522b7d){if(_0x522b7d){var _0x267e2b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x267e2b['test'](_0x40269f)){return _0x1b32fe;}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 _0x1b32fe;}}function respondWithRpcPromise(_0x2d68b8,_0x154a67,_0x5b230b,_0x519417){return new BPromise(function(_0x2fbece,_0x1cb5e0){var _0x4b4a3c=_0x519417||client;return _0x4b4a3c[_0x8e09('0x1c')](_0x2d68b8,_0x5b230b)[_0x8e09('0x1d')](function(_0x5dffc4){logger['info'](_0x8e09('0x1e'),_0x154a67,'request\x20sent');logger[_0x8e09('0x1f')](_0x8e09('0x20'),_0x154a67,_0x8e09('0x21'),JSON['stringify'](_0x5dffc4));if(_0x5dffc4[_0x8e09('0x22')]){if(_0x5dffc4[_0x8e09('0x22')][_0x8e09('0x23')]===0x1f4){logger['error'](_0x8e09('0x1e'),_0x154a67,_0x5dffc4[_0x8e09('0x22')]['message']);return _0x1cb5e0(_0x5dffc4[_0x8e09('0x22')][_0x8e09('0x24')]);}logger[_0x8e09('0x22')](_0x8e09('0x1e'),_0x154a67,_0x5dffc4[_0x8e09('0x22')]['message']);return _0x2fbece(_0x5dffc4[_0x8e09('0x22')][_0x8e09('0x24')]);}else{logger['info'](_0x8e09('0x1e'),_0x154a67,_0x8e09('0x21'));_0x2fbece(_0x5dffc4[_0x8e09('0x25')][_0x8e09('0x24')]);}})[_0x8e09('0x26')](function(_0x3fd340){logger[_0x8e09('0x22')](_0x8e09('0x1e'),_0x154a67,_0x3fd340);_0x1cb5e0(_0x3fd340);});});}function respondWithStatusCode(_0x4be7af,_0x3055d6){_0x3055d6=_0x3055d6||0xcc;return function(_0x35c127){if(_0x35c127){return _0x4be7af[_0x8e09('0x27')](_0x3055d6);}return _0x4be7af['status'](_0x3055d6)[_0x8e09('0x28')]();};}function respondWithResult(_0x48d4d5,_0x5899d2){_0x5899d2=_0x5899d2||0xc8;return function(_0x3626c1){if(_0x3626c1){return _0x48d4d5['status'](_0x5899d2)['json'](_0x3626c1);}};}function respondWithFilteredResult(_0x1edac7,_0x162e6d){return function(_0x3730cb){if(_0x3730cb){var _0x31f5c4=_0x3730cb[_0x8e09('0x29')],_0xaadf12=_0x162e6d[_0x8e09('0x2a')],_0x13d083=_0x162e6d['offset']+_0x162e6d[_0x8e09('0x2b')],_0x57a950;if(_0x13d083>=_0x31f5c4){_0x13d083=_0x31f5c4;_0x57a950=0xc8;}else{_0x57a950=0xce;}_0x1edac7[_0x8e09('0x2c')](_0x57a950);return _0x1edac7[_0x8e09('0x2d')]('Content-Range',_0xaadf12+'-'+_0x13d083+'/'+_0x31f5c4)['json'](_0x3730cb);}return null;};}function patchUpdates(_0x302434){return function(_0x4d5626){try{jsonpatch[_0x8e09('0x2e')](_0x4d5626,_0x302434,!![]);}catch(_0x36c2af){return BPromise[_0x8e09('0x2f')](_0x36c2af);}return _0x4d5626[_0x8e09('0x30')]();};}function saveUpdates(_0x599682,_0x46e6fd){return function(_0x119e77){if(_0x119e77){return _0x119e77[_0x8e09('0x31')](_0x599682)[_0x8e09('0x1d')](function(_0x11166b){return _0x11166b;});}return null;};}function removeEntity(_0x1b3ced,_0x2a41e2){return function(_0x56d828){if(_0x56d828){return _0x56d828[_0x8e09('0x32')]()[_0x8e09('0x1d')](function(){_0x1b3ced[_0x8e09('0x2c')](0xcc)[_0x8e09('0x28')]();});}};}function handleEntityNotFound(_0x1c1a32,_0x37957){return function(_0xe73fec){if(!_0xe73fec){_0x1c1a32[_0x8e09('0x27')](0x194);}return _0xe73fec;};}function handleError(_0x54ebbc,_0x5db73e){_0x5db73e=_0x5db73e||0x1f4;return function(_0x453c34){logger[_0x8e09('0x22')](_0x453c34[_0x8e09('0x33')]);if(_0x453c34[_0x8e09('0x34')]){delete _0x453c34[_0x8e09('0x34')];}_0x54ebbc[_0x8e09('0x2c')](_0x5db73e)[_0x8e09('0x35')](_0x453c34);};}exports['index']=function(_0x5b2f3b,_0xd0263b){var _0x2a55c2={},_0x52ad90={},_0x2ca12a={'count':0x0,'rows':[]};var _0x31c68a=_['map'](db[_0x8e09('0x36')][_0x8e09('0x37')],function(_0x43e7f4){return{'name':_0x43e7f4[_0x8e09('0x38')],'type':_0x43e7f4[_0x8e09('0x39')][_0x8e09('0x3a')]};});_0x52ad90['model']=_['map'](_0x31c68a,_0x8e09('0x34'));_0x52ad90[_0x8e09('0x3b')]=_[_0x8e09('0x3c')](_0x5b2f3b['query']);_0x52ad90['filters']=_[_0x8e09('0x3d')](_0x52ad90['model'],_0x52ad90[_0x8e09('0x3b')]);_0x2a55c2[_0x8e09('0x3e')]=_[_0x8e09('0x3d')](_0x52ad90[_0x8e09('0x3f')],qs[_0x8e09('0x40')](_0x5b2f3b[_0x8e09('0x3b')][_0x8e09('0x40')]));_0x2a55c2[_0x8e09('0x3e')]=_0x2a55c2[_0x8e09('0x3e')][_0x8e09('0x41')]?_0x2a55c2[_0x8e09('0x3e')]:_0x52ad90[_0x8e09('0x3f')];if(!_0x5b2f3b['query'][_0x8e09('0x42')](_0x8e09('0x43'))){_0x2a55c2[_0x8e09('0x2b')]=qs[_0x8e09('0x2b')](_0x5b2f3b[_0x8e09('0x3b')][_0x8e09('0x2b')]);_0x2a55c2['offset']=qs[_0x8e09('0x2a')](_0x5b2f3b[_0x8e09('0x3b')][_0x8e09('0x2a')]);}_0x2a55c2[_0x8e09('0x44')]=qs['sort'](_0x5b2f3b[_0x8e09('0x3b')][_0x8e09('0x45')]);_0x2a55c2[_0x8e09('0x46')]=qs[_0x8e09('0x47')](_[_0x8e09('0x48')](_0x5b2f3b[_0x8e09('0x3b')],_0x52ad90[_0x8e09('0x47')]),_0x31c68a);if(_0x5b2f3b[_0x8e09('0x3b')]['filter']){_0x2a55c2[_0x8e09('0x46')]=_['merge'](_0x2a55c2[_0x8e09('0x46')],{'$or':_[_0x8e09('0x49')](_0x31c68a,function(_0xa4a3cb){if(_0xa4a3cb[_0x8e09('0x39')]!==_0x8e09('0x4a')){var _0x562992={};_0x562992[_0xa4a3cb[_0x8e09('0x34')]]={'$like':'%'+_0x5b2f3b[_0x8e09('0x3b')][_0x8e09('0x4b')]+'%'};return _0x562992;}})});}_0x2a55c2=_[_0x8e09('0x4c')]({},_0x2a55c2,_0x5b2f3b[_0x8e09('0x4d')]);var _0x232fce={'where':_0x2a55c2[_0x8e09('0x46')]};return db[_0x8e09('0x36')][_0x8e09('0x29')](_0x232fce)[_0x8e09('0x1d')](function(_0x29c20b){_0x2ca12a[_0x8e09('0x29')]=_0x29c20b;if(_0x5b2f3b[_0x8e09('0x3b')][_0x8e09('0x4e')]){_0x2a55c2[_0x8e09('0x4f')]=[{'all':!![]}];}return db[_0x8e09('0x36')]['findAll'](_0x2a55c2);})[_0x8e09('0x1d')](function(_0x2e3765){_0x2ca12a[_0x8e09('0x50')]=_0x2e3765;return _0x2ca12a;})[_0x8e09('0x1d')](respondWithFilteredResult(_0xd0263b,_0x2a55c2))['catch'](handleError(_0xd0263b,null));};exports[_0x8e09('0x51')]=function(_0x1c5a16,_0xcd6714){var _0x56871a={'raw':![],'where':{'id':_0x1c5a16['params']['id']}},_0x276ae7={};_0x276ae7[_0x8e09('0x3f')]=_[_0x8e09('0x3c')](db['Dynamics365Configuration'][_0x8e09('0x37')]);_0x276ae7[_0x8e09('0x3b')]=_[_0x8e09('0x3c')](_0x1c5a16[_0x8e09('0x3b')]);_0x276ae7['filters']=_[_0x8e09('0x3d')](_0x276ae7[_0x8e09('0x3f')],_0x276ae7[_0x8e09('0x3b')]);_0x56871a[_0x8e09('0x3e')]=_[_0x8e09('0x3d')](_0x276ae7[_0x8e09('0x3f')],qs[_0x8e09('0x40')](_0x1c5a16['query'][_0x8e09('0x40')]));_0x56871a[_0x8e09('0x3e')]=_0x56871a[_0x8e09('0x3e')][_0x8e09('0x41')]?_0x56871a[_0x8e09('0x3e')]:_0x276ae7[_0x8e09('0x3f')];if(_0x1c5a16[_0x8e09('0x3b')][_0x8e09('0x4e')]){_0x56871a['include']=[{'all':!![]}];}_0x56871a=_[_0x8e09('0x4c')]({},_0x56871a,_0x1c5a16['options']);return db[_0x8e09('0x36')]['find'](_0x56871a)[_0x8e09('0x1d')](handleEntityNotFound(_0xcd6714,null))[_0x8e09('0x1d')](respondWithResult(_0xcd6714,null))['catch'](handleError(_0xcd6714,null));};exports[_0x8e09('0x52')]=function(_0x4e1d4b,_0x356ea8){return db[_0x8e09('0x36')][_0x8e09('0x52')](_0x4e1d4b[_0x8e09('0x53')],{})[_0x8e09('0x1d')](respondWithResult(_0x356ea8,0xc9))[_0x8e09('0x26')](handleError(_0x356ea8,null));};exports[_0x8e09('0x31')]=function(_0x488ddd,_0x4f7840){if(_0x488ddd['body']['id']){delete _0x488ddd[_0x8e09('0x53')]['id'];}return db[_0x8e09('0x36')][_0x8e09('0x54')]({'where':{'id':_0x488ddd[_0x8e09('0x55')]['id']}})[_0x8e09('0x1d')](handleEntityNotFound(_0x4f7840,null))[_0x8e09('0x1d')](saveUpdates(_0x488ddd[_0x8e09('0x53')],null))[_0x8e09('0x1d')](respondWithResult(_0x4f7840,null))['catch'](handleError(_0x4f7840,null));};exports['destroy']=function(_0x413b37,_0x3109ce){return db[_0x8e09('0x36')][_0x8e09('0x54')]({'where':{'id':_0x413b37[_0x8e09('0x55')]['id']}})[_0x8e09('0x1d')](handleEntityNotFound(_0x3109ce,null))[_0x8e09('0x1d')](removeEntity(_0x3109ce,null))[_0x8e09('0x26')](handleError(_0x3109ce,null));};exports['getFields']=function(_0x10abd0,_0x23d4ff,_0x113d97){var _0x1a6add={};var _0x9b8b07={};var _0x4255eb;var _0x51cc4b;return db[_0x8e09('0x36')][_0x8e09('0x56')]({'where':{'id':_0x10abd0[_0x8e09('0x55')]['id']}})[_0x8e09('0x1d')](handleEntityNotFound(_0x23d4ff,null))[_0x8e09('0x1d')](function(_0xaca12){if(_0xaca12){_0x4255eb=_0xaca12;_0x9b8b07[_0x8e09('0x3f')]=_['keys'](db[_0x8e09('0x57')]['rawAttributes']);_0x9b8b07[_0x8e09('0x3b')]=_['keys'](_0x10abd0[_0x8e09('0x3b')]);_0x9b8b07['filters']=_['intersection'](_0x9b8b07[_0x8e09('0x3f')],_0x9b8b07[_0x8e09('0x3b')]);_0x1a6add[_0x8e09('0x3e')]=_[_0x8e09('0x3d')](_0x9b8b07[_0x8e09('0x3f')],qs['fields'](_0x10abd0['query'][_0x8e09('0x40')]));_0x1a6add['attributes']=_0x1a6add[_0x8e09('0x3e')][_0x8e09('0x41')]?_0x1a6add['attributes']:_0x9b8b07[_0x8e09('0x3f')];_0x1a6add['order']=qs['sort'](_0x10abd0[_0x8e09('0x3b')][_0x8e09('0x45')]);_0x1a6add[_0x8e09('0x46')]=qs[_0x8e09('0x47')](_[_0x8e09('0x48')](_0x10abd0[_0x8e09('0x3b')],_0x9b8b07['filters']));if(_0x10abd0[_0x8e09('0x3b')][_0x8e09('0x4b')]){_0x1a6add[_0x8e09('0x46')]=_[_0x8e09('0x4c')](_0x1a6add[_0x8e09('0x46')],{'$or':_[_0x8e09('0x49')](_0x1a6add['attributes'],function(_0x3e9d93){var _0x3599b9={};_0x3599b9[_0x3e9d93]={'$like':'%'+_0x10abd0[_0x8e09('0x3b')][_0x8e09('0x4b')]+'%'};return _0x3599b9;})});}_0x1a6add=_[_0x8e09('0x4c')]({},_0x1a6add,_0x10abd0['options']);return _0x4255eb[_0x8e09('0x58')](_0x1a6add);}})[_0x8e09('0x1d')](function(_0xa7b5a){if(_0xa7b5a){_0x51cc4b=_0xa7b5a[_0x8e09('0x41')];if(!_0x10abd0[_0x8e09('0x3b')][_0x8e09('0x42')]('nolimit')){_0x1a6add[_0x8e09('0x2b')]=qs[_0x8e09('0x2b')](_0x10abd0['query'][_0x8e09('0x2b')]);_0x1a6add[_0x8e09('0x2a')]=qs['offset'](_0x10abd0[_0x8e09('0x3b')]['offset']);}return _0x4255eb['getFields'](_0x1a6add);}})[_0x8e09('0x1d')](function(_0x2fda76){if(_0x2fda76){return _0x2fda76?{'count':_0x51cc4b,'rows':_0x2fda76}:null;}})['then'](respondWithResult(_0x23d4ff,null))[_0x8e09('0x26')](handleError(_0x23d4ff,null));};exports['getSubjects']=function(_0x40dad1,_0x22e963,_0x4adf06){var _0x59433c={};var _0x15f8c5={};var _0x455d4c;var _0x5b3cb3;return db[_0x8e09('0x36')][_0x8e09('0x56')]({'where':{'id':_0x40dad1[_0x8e09('0x55')]['id']}})[_0x8e09('0x1d')](handleEntityNotFound(_0x22e963,null))[_0x8e09('0x1d')](function(_0x20a942){if(_0x20a942){_0x455d4c=_0x20a942;_0x15f8c5[_0x8e09('0x3f')]=_[_0x8e09('0x3c')](db[_0x8e09('0x57')]['rawAttributes']);_0x15f8c5['query']=_['keys'](_0x40dad1[_0x8e09('0x3b')]);_0x15f8c5[_0x8e09('0x47')]=_['intersection'](_0x15f8c5[_0x8e09('0x3f')],_0x15f8c5[_0x8e09('0x3b')]);_0x59433c[_0x8e09('0x3e')]=_[_0x8e09('0x3d')](_0x15f8c5[_0x8e09('0x3f')],qs[_0x8e09('0x40')](_0x40dad1[_0x8e09('0x3b')][_0x8e09('0x40')]));_0x59433c[_0x8e09('0x3e')]=_0x59433c['attributes'][_0x8e09('0x41')]?_0x59433c[_0x8e09('0x3e')]:_0x15f8c5[_0x8e09('0x3f')];_0x59433c[_0x8e09('0x44')]=qs[_0x8e09('0x45')](_0x40dad1[_0x8e09('0x3b')]['sort']);_0x59433c[_0x8e09('0x46')]=qs[_0x8e09('0x47')](_['pick'](_0x40dad1[_0x8e09('0x3b')],_0x15f8c5[_0x8e09('0x47')]));if(_0x40dad1[_0x8e09('0x3b')][_0x8e09('0x4b')]){_0x59433c[_0x8e09('0x46')]=_[_0x8e09('0x4c')](_0x59433c[_0x8e09('0x46')],{'$or':_[_0x8e09('0x49')](_0x59433c[_0x8e09('0x3e')],function(_0x55c787){var _0x104485={};_0x104485[_0x55c787]={'$like':'%'+_0x40dad1[_0x8e09('0x3b')][_0x8e09('0x4b')]+'%'};return _0x104485;})});}_0x59433c=_['merge']({},_0x59433c,_0x40dad1[_0x8e09('0x4d')]);return _0x455d4c['getSubjects'](_0x59433c);}})['then'](function(_0x203478){if(_0x203478){_0x5b3cb3=_0x203478[_0x8e09('0x41')];if(!_0x40dad1[_0x8e09('0x3b')][_0x8e09('0x42')](_0x8e09('0x43'))){_0x59433c[_0x8e09('0x2b')]=qs['limit'](_0x40dad1[_0x8e09('0x3b')]['limit']);_0x59433c[_0x8e09('0x2a')]=qs[_0x8e09('0x2a')](_0x40dad1[_0x8e09('0x3b')][_0x8e09('0x2a')]);}return _0x455d4c[_0x8e09('0x59')](_0x59433c);}})[_0x8e09('0x1d')](function(_0x1d6296){if(_0x1d6296){return _0x1d6296?{'count':_0x5b3cb3,'rows':_0x1d6296}:null;}})[_0x8e09('0x1d')](respondWithResult(_0x22e963,null))['catch'](handleError(_0x22e963,null));};exports[_0x8e09('0x5a')]=function(_0x45a43d,_0x5aea59,_0x282809){var _0xa3b8ec={};var _0x45119d={};var _0x177da2;var _0x1a2922;return db[_0x8e09('0x36')]['findOne']({'where':{'id':_0x45a43d[_0x8e09('0x55')]['id']}})['then'](handleEntityNotFound(_0x5aea59,null))[_0x8e09('0x1d')](function(_0x1f3032){if(_0x1f3032){_0x177da2=_0x1f3032;_0x45119d[_0x8e09('0x3f')]=_[_0x8e09('0x3c')](db[_0x8e09('0x57')][_0x8e09('0x37')]);_0x45119d['query']=_['keys'](_0x45a43d[_0x8e09('0x3b')]);_0x45119d[_0x8e09('0x47')]=_[_0x8e09('0x3d')](_0x45119d['model'],_0x45119d['query']);_0xa3b8ec[_0x8e09('0x3e')]=_[_0x8e09('0x3d')](_0x45119d['model'],qs['fields'](_0x45a43d[_0x8e09('0x3b')][_0x8e09('0x40')]));_0xa3b8ec['attributes']=_0xa3b8ec[_0x8e09('0x3e')][_0x8e09('0x41')]?_0xa3b8ec['attributes']:_0x45119d[_0x8e09('0x3f')];_0xa3b8ec[_0x8e09('0x44')]=qs[_0x8e09('0x45')](_0x45a43d['query'][_0x8e09('0x45')]);_0xa3b8ec[_0x8e09('0x46')]=qs[_0x8e09('0x47')](_['pick'](_0x45a43d[_0x8e09('0x3b')],_0x45119d[_0x8e09('0x47')]));if(_0x45a43d[_0x8e09('0x3b')]['filter']){_0xa3b8ec[_0x8e09('0x46')]=_[_0x8e09('0x4c')](_0xa3b8ec[_0x8e09('0x46')],{'$or':_[_0x8e09('0x49')](_0xa3b8ec[_0x8e09('0x3e')],function(_0x5ca905){var _0x194de9={};_0x194de9[_0x5ca905]={'$like':'%'+_0x45a43d[_0x8e09('0x3b')][_0x8e09('0x4b')]+'%'};return _0x194de9;})});}_0xa3b8ec=_[_0x8e09('0x4c')]({},_0xa3b8ec,_0x45a43d['options']);return _0x177da2[_0x8e09('0x5a')](_0xa3b8ec);}})[_0x8e09('0x1d')](function(_0xc17eb0){if(_0xc17eb0){_0x1a2922=_0xc17eb0[_0x8e09('0x41')];if(!_0x45a43d[_0x8e09('0x3b')]['hasOwnProperty'](_0x8e09('0x43'))){_0xa3b8ec[_0x8e09('0x2b')]=qs[_0x8e09('0x2b')](_0x45a43d[_0x8e09('0x3b')][_0x8e09('0x2b')]);_0xa3b8ec[_0x8e09('0x2a')]=qs['offset'](_0x45a43d[_0x8e09('0x3b')]['offset']);}return _0x177da2['getDescriptions'](_0xa3b8ec);}})['then'](function(_0x5c523f){if(_0x5c523f){return _0x5c523f?{'count':_0x1a2922,'rows':_0x5c523f}:null;}})[_0x8e09('0x1d')](respondWithResult(_0x5aea59,null))[_0x8e09('0x26')](handleError(_0x5aea59,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 81e89e4..a2e49f3 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 _0xd16c=['./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xd16c,0x1b7));var _0xcd16=function(_0x11bb0d,_0x3a85fc){_0x11bb0d=_0x11bb0d-0x0;var _0x18dd81=_0xd16c[_0x11bb0d];return _0x18dd81;};'use strict';var _=require(_0xcd16('0x0'));var util=require(_0xcd16('0x1'));var logger=require(_0xcd16('0x2'))(_0xcd16('0x3'));var moment=require(_0xcd16('0x4'));var BPromise=require(_0xcd16('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd16('0x6'));var rimraf=require(_0xcd16('0x7'));var config=require(_0xcd16('0x8'));var attributes=require(_0xcd16('0x9'));module[_0xcd16('0xa')]=function(_0x40c55d,_0x38b763){return _0x40c55d[_0xcd16('0xb')](_0xcd16('0xc'),attributes,{'tableName':_0xcd16('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa12e=['int_dynamics365_configurations','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','Dynamics365Configuration'];(function(_0x5f32d8,_0x26ad34){var _0x3751fc=function(_0x160ba5){while(--_0x160ba5){_0x5f32d8['push'](_0x5f32d8['shift']());}};_0x3751fc(++_0x26ad34);}(_0xa12e,0xfe));var _0xea12=function(_0x171987,_0x682845){_0x171987=_0x171987-0x0;var _0x321d9f=_0xa12e[_0x171987];return _0x321d9f;};'use strict';var _=require('lodash');var util=require(_0xea12('0x0'));var logger=require(_0xea12('0x1'))(_0xea12('0x2'));var moment=require(_0xea12('0x3'));var BPromise=require('bluebird');var rp=require(_0xea12('0x4'));var fs=require('fs');var path=require(_0xea12('0x5'));var rimraf=require(_0xea12('0x6'));var config=require(_0xea12('0x7'));var attributes=require('./intDynamics365Configuration.attributes');module['exports']=function(_0x10292a,_0x309734){return _0x10292a[_0xea12('0x8')](_0xea12('0x9'),attributes,{'tableName':_0xea12('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 e561748..de6e682 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 _0x8454=['then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8454,0x1ef));var _0x4845=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8454[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x4845('0x0'));var util=require(_0x4845('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4845('0x2'));var fs=require('fs');var Redis=require(_0x4845('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4845('0x4'));var logger=require(_0x4845('0x5'))(_0x4845('0x6'));var config=require(_0x4845('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4845('0x8')][_0x4845('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25bda5,_0x5deb70,_0xfb54cd){return new BPromise(function(_0x23084f,_0x209ee0){return client[_0x4845('0xa')](_0x25bda5,_0xfb54cd)[_0x4845('0xb')](function(_0x5baa59){logger[_0x4845('0xc')](_0x4845('0xd'),_0x5deb70,_0x4845('0xe'));logger[_0x4845('0xf')](_0x4845('0x10'),_0x5deb70,_0x4845('0xe'),JSON[_0x4845('0x11')](_0x5baa59));if(_0x5baa59[_0x4845('0x12')]){if(_0x5baa59[_0x4845('0x12')][_0x4845('0x13')]===0x1f4){logger['error'](_0x4845('0xd'),_0x5deb70,_0x5baa59[_0x4845('0x12')]['message']);return _0x209ee0(_0x5baa59[_0x4845('0x12')][_0x4845('0x14')]);}logger[_0x4845('0x12')](_0x4845('0xd'),_0x5deb70,_0x5baa59['error'][_0x4845('0x14')]);return _0x23084f(_0x5baa59['error'][_0x4845('0x14')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x5deb70,_0x4845('0xe'));_0x23084f(_0x5baa59[_0x4845('0x15')]['message']);}})[_0x4845('0x16')](function(_0x365f4c){logger[_0x4845('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5deb70,_0x365f4c);_0x209ee0(_0x365f4c);});});} \ No newline at end of file +var _0x14b8=['http','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x47fec6,_0x5ba966){var _0xd623a5=function(_0x2e588f){while(--_0x2e588f){_0x47fec6['push'](_0x47fec6['shift']());}};_0xd623a5(++_0x5ba966);}(_0x14b8,0x83));var _0x814b=function(_0x307bc0,_0x378ca4){_0x307bc0=_0x307bc0-0x0;var _0x5ad9e1=_0x14b8[_0x307bc0];return _0x5ad9e1;};'use strict';var _=require(_0x814b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x814b('0x1'));var rs=require(_0x814b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x814b('0x3'))['db'];var utils=require(_0x814b('0x4'));var logger=require(_0x814b('0x5'))(_0x814b('0x6'));var config=require(_0x814b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x814b('0x8')][_0x814b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x338bf2,_0x482ffc,_0x181949){return new BPromise(function(_0x5edba6,_0x319133){return client['request'](_0x338bf2,_0x181949)['then'](function(_0x302228){logger['info'](_0x814b('0xa'),_0x482ffc,_0x814b('0xb'));logger[_0x814b('0xc')](_0x814b('0xd'),_0x482ffc,_0x814b('0xb'),JSON[_0x814b('0xe')](_0x302228));if(_0x302228[_0x814b('0xf')]){if(_0x302228['error'][_0x814b('0x10')]===0x1f4){logger['error'](_0x814b('0xa'),_0x482ffc,_0x302228[_0x814b('0xf')][_0x814b('0x11')]);return _0x319133(_0x302228['error']['message']);}logger[_0x814b('0xf')](_0x814b('0xa'),_0x482ffc,_0x302228['error']['message']);return _0x5edba6(_0x302228[_0x814b('0xf')][_0x814b('0x11')]);}else{logger[_0x814b('0x12')](_0x814b('0xa'),_0x482ffc,_0x814b('0xb'));_0x5edba6(_0x302228['result'][_0x814b('0x11')]);}})[_0x814b('0x13')](function(_0x897198){logger['error'](_0x814b('0xa'),_0x482ffc,_0x897198);_0x319133(_0x897198);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index f7a6413..e334b61 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 _0xac4a=['express','Router','../../config/environment','./intDynamics365Field.controller','get','index','/:id','show','post','put','isAuthenticated','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5f2874,_0x35813a){var _0x21fd08=function(_0x48336e){while(--_0x48336e){_0x5f2874['push'](_0x5f2874['shift']());}};_0x21fd08(++_0x35813a);}(_0xac4a,0x13f));var _0xaac4=function(_0x194dcd,_0x8e529d){_0x194dcd=_0x194dcd-0x0;var _0x3717ca=_0xac4a[_0x194dcd];return _0x3717ca;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaac4('0x6'));var controller=require(_0xaac4('0x7'));router[_0xaac4('0x8')]('/',auth['isAuthenticated'](),controller[_0xaac4('0x9')]);router['get'](_0xaac4('0xa'),auth['isAuthenticated'](),controller[_0xaac4('0xb')]);router[_0xaac4('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xaac4('0xd')]('/:id',auth[_0xaac4('0xe')](),controller['update']);router['delete'](_0xaac4('0xa'),auth[_0xaac4('0xe')](),controller[_0xaac4('0xf')]);module[_0xaac4('0x10')]=router; \ No newline at end of file +var _0x9f62=['update','destroy','util','connect-timeout','express','Router','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','show','post'];(function(_0x2d7e2d,_0x3ab06e){var _0x2c6252=function(_0x35559a){while(--_0x35559a){_0x2d7e2d['push'](_0x2d7e2d['shift']());}};_0x2c6252(++_0x3ab06e);}(_0x9f62,0x154));var _0x29f6=function(_0x258d97,_0x17474e){_0x258d97=_0x258d97-0x0;var _0x7f277c=_0x9f62[_0x258d97];return _0x7f277c;};'use strict';var multer=require('multer');var util=require(_0x29f6('0x0'));var path=require('path');var timeout=require(_0x29f6('0x1'));var express=require(_0x29f6('0x2'));var router=express[_0x29f6('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x29f6('0x4'));var controller=require(_0x29f6('0x5'));router[_0x29f6('0x6')]('/',auth[_0x29f6('0x7')](),controller['index']);router[_0x29f6('0x6')](_0x29f6('0x8'),auth[_0x29f6('0x7')](),controller[_0x29f6('0x9')]);router[_0x29f6('0xa')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x29f6('0x7')](),controller[_0x29f6('0xb')]);router['delete']('/:id',auth[_0x29f6('0x7')](),controller[_0x29f6('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index eab06c5..4277485 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 _0xf440=['variable','customVariable','keyValue','STRING','exports','ENUM','string'];(function(_0x1e8176,_0x250d28){var _0x34a4fc=function(_0x11bbec){while(--_0x11bbec){_0x1e8176['push'](_0x1e8176['shift']());}};_0x34a4fc(++_0x250d28);}(_0xf440,0x1ee));var _0x0f44=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xf440[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require('sequelize');module[_0x0f44('0x0')]={'type':{'type':Sequelize[_0x0f44('0x1')](_0x0f44('0x2'),_0x0f44('0x3'),_0x0f44('0x4'),_0x0f44('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0f44('0x6')]},'keyType':{'type':Sequelize[_0x0f44('0x1')]('string',_0x0f44('0x3'),_0x0f44('0x4'))},'keyContent':{'type':Sequelize[_0x0f44('0x6')]},'idField':{'type':Sequelize[_0x0f44('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0f44('0x6')]}}; \ No newline at end of file +var _0x190b=['keyValue','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable'];(function(_0x5598c5,_0x111698){var _0x3020a9=function(_0x1d78d8){while(--_0x1d78d8){_0x5598c5['push'](_0x5598c5['shift']());}};_0x3020a9(++_0x111698);}(_0x190b,0x1ab));var _0xb190=function(_0x22eacc,_0x3218c9){_0x22eacc=_0x22eacc-0x0;var _0x3d41db=_0x190b[_0x22eacc];return _0x3d41db;};'use strict';var Sequelize=require(_0xb190('0x0'));module[_0xb190('0x1')]={'type':{'type':Sequelize[_0xb190('0x2')]('string',_0xb190('0x3'),_0xb190('0x4'),_0xb190('0x5')),'defaultValue':_0xb190('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb190('0x7')]},'keyType':{'type':Sequelize[_0xb190('0x2')](_0xb190('0x6'),_0xb190('0x3'),_0xb190('0x4'))},'keyContent':{'type':Sequelize[_0xb190('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb190('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb190('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 37e8574..fb48b9e 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 _0xd517=['limit','set','json','save','update','then','destroy','end','error','name','send','index','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','type','VIRTUAL','merge','options','Dynamics365Field','include','rows','show','params','includeAll','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','count'];(function(_0x560442,_0x5db8fb){var _0xeb9e2f=function(_0x1eb287){while(--_0x1eb287){_0x560442['push'](_0x560442['shift']());}};_0xeb9e2f(++_0x5db8fb);}(_0xd517,0x1dd));var _0x7d51=function(_0x41cfd4,_0x1ed2cc){_0x41cfd4=_0x41cfd4-0x0;var _0x190f48=_0xd517[_0x41cfd4];return _0x190f48;};'use strict';var pdf=require(_0x7d51('0x0'));var emlformat=require(_0x7d51('0x1'));var rimraf=require(_0x7d51('0x2'));var zipdir=require(_0x7d51('0x3'));var jsonpatch=require(_0x7d51('0x4'));var rp=require('request-promise');var moment=require(_0x7d51('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7d51('0x6'));var path=require(_0x7d51('0x7'));var sox=require(_0x7d51('0x8'));var csv=require(_0x7d51('0x9'));var ejs=require(_0x7d51('0xa'));var fs=require('fs');var _=require(_0x7d51('0xb'));var squel=require(_0x7d51('0xc'));var crypto=require(_0x7d51('0xd'));var jsforce=require(_0x7d51('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7d51('0xf'));var Papa=require(_0x7d51('0x10'));var Redis=require(_0x7d51('0x11'));var authService=require(_0x7d51('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d51('0x13'));var logger=require(_0x7d51('0x14'))(_0x7d51('0x15'));var utils=require('../../config/utils');var config=require(_0x7d51('0x16'));var db=require(_0x7d51('0x17'))['db'];function respondWithStatusCode(_0x5635b3,_0x862d23){_0x862d23=_0x862d23||0xcc;return function(_0x4d2446){if(_0x4d2446){return _0x5635b3[_0x7d51('0x18')](_0x862d23);}return _0x5635b3[_0x7d51('0x19')](_0x862d23)['end']();};}function respondWithResult(_0x5c8f6d,_0xdffda4){_0xdffda4=_0xdffda4||0xc8;return function(_0xe77939){if(_0xe77939){return _0x5c8f6d[_0x7d51('0x19')](_0xdffda4)['json'](_0xe77939);}};}function respondWithFilteredResult(_0x516468,_0x305c26){return function(_0x1ea497){if(_0x1ea497){var _0x31c95c=_0x1ea497[_0x7d51('0x1a')],_0x102eb7=_0x305c26['offset'],_0x5c7122=_0x305c26['offset']+_0x305c26[_0x7d51('0x1b')],_0x5c5bda;if(_0x5c7122>=_0x31c95c){_0x5c7122=_0x31c95c;_0x5c5bda=0xc8;}else{_0x5c5bda=0xce;}_0x516468[_0x7d51('0x19')](_0x5c5bda);return _0x516468[_0x7d51('0x1c')]('Content-Range',_0x102eb7+'-'+_0x5c7122+'/'+_0x31c95c)[_0x7d51('0x1d')](_0x1ea497);}return null;};}function patchUpdates(_0x1f0300){return function(_0x71995c){try{jsonpatch['apply'](_0x71995c,_0x1f0300,!![]);}catch(_0x2f3f44){return BPromise['reject'](_0x2f3f44);}return _0x71995c[_0x7d51('0x1e')]();};}function saveUpdates(_0x5523c1,_0x3401f8){return function(_0x401c96){if(_0x401c96){return _0x401c96[_0x7d51('0x1f')](_0x5523c1)[_0x7d51('0x20')](function(_0x3d889e){return _0x3d889e;});}return null;};}function removeEntity(_0xac560,_0x2ebce3){return function(_0x17463e){if(_0x17463e){return _0x17463e[_0x7d51('0x21')]()[_0x7d51('0x20')](function(){_0xac560[_0x7d51('0x19')](0xcc)[_0x7d51('0x22')]();});}};}function handleEntityNotFound(_0x44f118,_0x1e1f8c){return function(_0x24bf87){if(!_0x24bf87){_0x44f118[_0x7d51('0x18')](0x194);}return _0x24bf87;};}function handleError(_0x1e0201,_0x4efca7){_0x4efca7=_0x4efca7||0x1f4;return function(_0x1e739b){logger[_0x7d51('0x23')](_0x1e739b['stack']);if(_0x1e739b[_0x7d51('0x24')]){delete _0x1e739b[_0x7d51('0x24')];}_0x1e0201[_0x7d51('0x19')](_0x4efca7)[_0x7d51('0x25')](_0x1e739b);};}exports[_0x7d51('0x26')]=function(_0x422c64,_0x3da100){var _0x46942b={},_0x3761cc={},_0x356109={'count':0x0,'rows':[]};var _0x51adf6=_['map'](db['Dynamics365Field'][_0x7d51('0x27')],function(_0x3e4b64){return{'name':_0x3e4b64[_0x7d51('0x28')],'type':_0x3e4b64['type'][_0x7d51('0x29')]};});_0x3761cc['model']=_[_0x7d51('0x2a')](_0x51adf6,_0x7d51('0x24'));_0x3761cc[_0x7d51('0x2b')]=_[_0x7d51('0x2c')](_0x422c64[_0x7d51('0x2b')]);_0x3761cc[_0x7d51('0x2d')]=_[_0x7d51('0x2e')](_0x3761cc[_0x7d51('0x2f')],_0x3761cc[_0x7d51('0x2b')]);_0x46942b[_0x7d51('0x30')]=_[_0x7d51('0x2e')](_0x3761cc[_0x7d51('0x2f')],qs[_0x7d51('0x31')](_0x422c64[_0x7d51('0x2b')][_0x7d51('0x31')]));_0x46942b['attributes']=_0x46942b['attributes'][_0x7d51('0x32')]?_0x46942b['attributes']:_0x3761cc[_0x7d51('0x2f')];if(!_0x422c64[_0x7d51('0x2b')][_0x7d51('0x33')]('nolimit')){_0x46942b[_0x7d51('0x1b')]=qs[_0x7d51('0x1b')](_0x422c64[_0x7d51('0x2b')][_0x7d51('0x1b')]);_0x46942b[_0x7d51('0x34')]=qs[_0x7d51('0x34')](_0x422c64['query'][_0x7d51('0x34')]);}_0x46942b[_0x7d51('0x35')]=qs[_0x7d51('0x36')](_0x422c64[_0x7d51('0x2b')]['sort']);_0x46942b[_0x7d51('0x37')]=qs[_0x7d51('0x2d')](_[_0x7d51('0x38')](_0x422c64[_0x7d51('0x2b')],_0x3761cc['filters']),_0x51adf6);if(_0x422c64[_0x7d51('0x2b')][_0x7d51('0x39')]){_0x46942b['where']=_['merge'](_0x46942b[_0x7d51('0x37')],{'$or':_[_0x7d51('0x2a')](_0x51adf6,function(_0x2c4a65){if(_0x2c4a65[_0x7d51('0x3a')]!==_0x7d51('0x3b')){var _0x53198d={};_0x53198d[_0x2c4a65[_0x7d51('0x24')]]={'$like':'%'+_0x422c64[_0x7d51('0x2b')]['filter']+'%'};return _0x53198d;}})});}_0x46942b=_[_0x7d51('0x3c')]({},_0x46942b,_0x422c64[_0x7d51('0x3d')]);var _0x999a48={'where':_0x46942b[_0x7d51('0x37')]};return db[_0x7d51('0x3e')][_0x7d51('0x1a')](_0x999a48)[_0x7d51('0x20')](function(_0x5a2064){_0x356109[_0x7d51('0x1a')]=_0x5a2064;if(_0x422c64[_0x7d51('0x2b')]['includeAll']){_0x46942b[_0x7d51('0x3f')]=[{'all':!![]}];}return db[_0x7d51('0x3e')]['findAll'](_0x46942b);})[_0x7d51('0x20')](function(_0x529df5){_0x356109[_0x7d51('0x40')]=_0x529df5;return _0x356109;})['then'](respondWithFilteredResult(_0x3da100,_0x46942b))['catch'](handleError(_0x3da100,null));};exports[_0x7d51('0x41')]=function(_0x553149,_0x2ad7d7){var _0x3ba4a3={'raw':!![],'where':{'id':_0x553149[_0x7d51('0x42')]['id']}},_0x4cbf89={};_0x4cbf89[_0x7d51('0x2f')]=_['keys'](db['Dynamics365Field'][_0x7d51('0x27')]);_0x4cbf89[_0x7d51('0x2b')]=_['keys'](_0x553149['query']);_0x4cbf89[_0x7d51('0x2d')]=_[_0x7d51('0x2e')](_0x4cbf89[_0x7d51('0x2f')],_0x4cbf89['query']);_0x3ba4a3[_0x7d51('0x30')]=_[_0x7d51('0x2e')](_0x4cbf89[_0x7d51('0x2f')],qs['fields'](_0x553149[_0x7d51('0x2b')][_0x7d51('0x31')]));_0x3ba4a3[_0x7d51('0x30')]=_0x3ba4a3['attributes'][_0x7d51('0x32')]?_0x3ba4a3[_0x7d51('0x30')]:_0x4cbf89[_0x7d51('0x2f')];if(_0x553149[_0x7d51('0x2b')][_0x7d51('0x43')]){_0x3ba4a3[_0x7d51('0x3f')]=[{'all':!![]}];}_0x3ba4a3=_[_0x7d51('0x3c')]({},_0x3ba4a3,_0x553149[_0x7d51('0x3d')]);return db[_0x7d51('0x3e')][_0x7d51('0x44')](_0x3ba4a3)[_0x7d51('0x20')](handleEntityNotFound(_0x2ad7d7,null))[_0x7d51('0x20')](respondWithResult(_0x2ad7d7,null))[_0x7d51('0x45')](handleError(_0x2ad7d7,null));};exports[_0x7d51('0x46')]=function(_0x3b652e,_0x311c23){return db[_0x7d51('0x3e')][_0x7d51('0x46')](_0x3b652e[_0x7d51('0x47')],{})[_0x7d51('0x20')](respondWithResult(_0x311c23,0xc9))[_0x7d51('0x45')](handleError(_0x311c23,null));};exports[_0x7d51('0x1f')]=function(_0x52969d,_0x13acf0){if(_0x52969d[_0x7d51('0x47')]['id']){delete _0x52969d[_0x7d51('0x47')]['id'];}return db[_0x7d51('0x3e')][_0x7d51('0x44')]({'where':{'id':_0x52969d[_0x7d51('0x42')]['id']}})['then'](handleEntityNotFound(_0x13acf0,null))[_0x7d51('0x20')](saveUpdates(_0x52969d['body'],null))['then'](respondWithResult(_0x13acf0,null))[_0x7d51('0x45')](handleError(_0x13acf0,null));};exports[_0x7d51('0x21')]=function(_0x56df8e,_0x4db475){return db[_0x7d51('0x3e')][_0x7d51('0x44')]({'where':{'id':_0x56df8e[_0x7d51('0x42')]['id']}})[_0x7d51('0x20')](handleEntityNotFound(_0x4db475,null))[_0x7d51('0x20')](removeEntity(_0x4db475,null))['catch'](handleError(_0x4db475,null));}; \ No newline at end of file +var _0xbab0=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','Content-Range','apply','save','update','then','destroy','name','send','Dynamics365Field','type','map','query','filters','attributes','intersection','model','fields','length','limit','offset','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','rows','show','params','keys','options','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0xcc4fb8,_0x57d9e7){var _0x1acfb8=function(_0x29df88){while(--_0x29df88){_0xcc4fb8['push'](_0xcc4fb8['shift']());}};_0x1acfb8(++_0x57d9e7);}(_0xbab0,0x183));var _0x0bab=function(_0x1a847c,_0x5675be){_0x1a847c=_0x1a847c-0x0;var _0x1e45bf=_0xbab0[_0x1a847c];return _0x1e45bf;};'use strict';var pdf=require(_0x0bab('0x0'));var emlformat=require(_0x0bab('0x1'));var rimraf=require(_0x0bab('0x2'));var zipdir=require(_0x0bab('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0bab('0x4'));var moment=require(_0x0bab('0x5'));var BPromise=require(_0x0bab('0x6'));var Mustache=require(_0x0bab('0x7'));var util=require(_0x0bab('0x8'));var path=require(_0x0bab('0x9'));var sox=require(_0x0bab('0xa'));var csv=require(_0x0bab('0xb'));var ejs=require(_0x0bab('0xc'));var fs=require('fs');var _=require(_0x0bab('0xd'));var squel=require('squel');var crypto=require(_0x0bab('0xe'));var jsforce=require(_0x0bab('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0bab('0xb'));var querystring=require(_0x0bab('0x10'));var Papa=require(_0x0bab('0x11'));var Redis=require(_0x0bab('0x12'));var authService=require(_0x0bab('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0bab('0x14'));var hardwareService=require(_0x0bab('0x15'));var logger=require(_0x0bab('0x16'))(_0x0bab('0x17'));var utils=require('../../config/utils');var config=require(_0x0bab('0x18'));var db=require(_0x0bab('0x19'))['db'];function respondWithStatusCode(_0x496df8,_0x3c3b51){_0x3c3b51=_0x3c3b51||0xcc;return function(_0x3d61a2){if(_0x3d61a2){return _0x496df8[_0x0bab('0x1a')](_0x3c3b51);}return _0x496df8[_0x0bab('0x1b')](_0x3c3b51)['end']();};}function respondWithResult(_0x3257f9,_0x13a8ec){_0x13a8ec=_0x13a8ec||0xc8;return function(_0x1c9b3b){if(_0x1c9b3b){return _0x3257f9[_0x0bab('0x1b')](_0x13a8ec)[_0x0bab('0x1c')](_0x1c9b3b);}};}function respondWithFilteredResult(_0x198aaf,_0x334985){return function(_0x3beedc){if(_0x3beedc){var _0x660b2a=_0x3beedc[_0x0bab('0x1d')],_0x55d938=_0x334985['offset'],_0x31be45=_0x334985['offset']+_0x334985['limit'],_0x179152;if(_0x31be45>=_0x660b2a){_0x31be45=_0x660b2a;_0x179152=0xc8;}else{_0x179152=0xce;}_0x198aaf[_0x0bab('0x1b')](_0x179152);return _0x198aaf['set'](_0x0bab('0x1e'),_0x55d938+'-'+_0x31be45+'/'+_0x660b2a)['json'](_0x3beedc);}return null;};}function patchUpdates(_0x1dde54){return function(_0x5f53b9){try{jsonpatch[_0x0bab('0x1f')](_0x5f53b9,_0x1dde54,!![]);}catch(_0x11aa94){return BPromise['reject'](_0x11aa94);}return _0x5f53b9[_0x0bab('0x20')]();};}function saveUpdates(_0x30b7f0,_0x380347){return function(_0x17466c){if(_0x17466c){return _0x17466c[_0x0bab('0x21')](_0x30b7f0)[_0x0bab('0x22')](function(_0x26f96c){return _0x26f96c;});}return null;};}function removeEntity(_0x5472ef,_0x463eb1){return function(_0x59f782){if(_0x59f782){return _0x59f782[_0x0bab('0x23')]()[_0x0bab('0x22')](function(){_0x5472ef[_0x0bab('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38bf68,_0x4ac434){return function(_0x4ddaee){if(!_0x4ddaee){_0x38bf68['sendStatus'](0x194);}return _0x4ddaee;};}function handleError(_0xa079cd,_0x21c44e){_0x21c44e=_0x21c44e||0x1f4;return function(_0x148188){logger['error'](_0x148188['stack']);if(_0x148188[_0x0bab('0x24')]){delete _0x148188[_0x0bab('0x24')];}_0xa079cd[_0x0bab('0x1b')](_0x21c44e)[_0x0bab('0x25')](_0x148188);};}exports['index']=function(_0x5b3f56,_0x5bea71){var _0x38d1cf={},_0x215a9c={},_0x2c07c1={'count':0x0,'rows':[]};var _0x83f2e7=_['map'](db[_0x0bab('0x26')]['rawAttributes'],function(_0x250bf6){return{'name':_0x250bf6['fieldName'],'type':_0x250bf6[_0x0bab('0x27')]['key']};});_0x215a9c['model']=_[_0x0bab('0x28')](_0x83f2e7,_0x0bab('0x24'));_0x215a9c[_0x0bab('0x29')]=_['keys'](_0x5b3f56[_0x0bab('0x29')]);_0x215a9c[_0x0bab('0x2a')]=_['intersection'](_0x215a9c['model'],_0x215a9c[_0x0bab('0x29')]);_0x38d1cf[_0x0bab('0x2b')]=_[_0x0bab('0x2c')](_0x215a9c[_0x0bab('0x2d')],qs[_0x0bab('0x2e')](_0x5b3f56[_0x0bab('0x29')][_0x0bab('0x2e')]));_0x38d1cf['attributes']=_0x38d1cf[_0x0bab('0x2b')][_0x0bab('0x2f')]?_0x38d1cf[_0x0bab('0x2b')]:_0x215a9c['model'];if(!_0x5b3f56[_0x0bab('0x29')]['hasOwnProperty']('nolimit')){_0x38d1cf['limit']=qs[_0x0bab('0x30')](_0x5b3f56[_0x0bab('0x29')][_0x0bab('0x30')]);_0x38d1cf[_0x0bab('0x31')]=qs['offset'](_0x5b3f56[_0x0bab('0x29')][_0x0bab('0x31')]);}_0x38d1cf[_0x0bab('0x32')]=qs[_0x0bab('0x33')](_0x5b3f56[_0x0bab('0x29')][_0x0bab('0x33')]);_0x38d1cf['where']=qs[_0x0bab('0x2a')](_[_0x0bab('0x34')](_0x5b3f56[_0x0bab('0x29')],_0x215a9c[_0x0bab('0x2a')]),_0x83f2e7);if(_0x5b3f56[_0x0bab('0x29')]['filter']){_0x38d1cf[_0x0bab('0x35')]=_[_0x0bab('0x36')](_0x38d1cf[_0x0bab('0x35')],{'$or':_['map'](_0x83f2e7,function(_0x288367){if(_0x288367[_0x0bab('0x27')]!==_0x0bab('0x37')){var _0x56e588={};_0x56e588[_0x288367[_0x0bab('0x24')]]={'$like':'%'+_0x5b3f56[_0x0bab('0x29')][_0x0bab('0x38')]+'%'};return _0x56e588;}})});}_0x38d1cf=_[_0x0bab('0x36')]({},_0x38d1cf,_0x5b3f56['options']);var _0x37787c={'where':_0x38d1cf['where']};return db[_0x0bab('0x26')][_0x0bab('0x1d')](_0x37787c)[_0x0bab('0x22')](function(_0x15f2c3){_0x2c07c1['count']=_0x15f2c3;if(_0x5b3f56[_0x0bab('0x29')][_0x0bab('0x39')]){_0x38d1cf[_0x0bab('0x3a')]=[{'all':!![]}];}return db[_0x0bab('0x26')]['findAll'](_0x38d1cf);})[_0x0bab('0x22')](function(_0x387c30){_0x2c07c1[_0x0bab('0x3b')]=_0x387c30;return _0x2c07c1;})[_0x0bab('0x22')](respondWithFilteredResult(_0x5bea71,_0x38d1cf))['catch'](handleError(_0x5bea71,null));};exports[_0x0bab('0x3c')]=function(_0x4edd72,_0x4b0453){var _0x2ff53b={'raw':!![],'where':{'id':_0x4edd72[_0x0bab('0x3d')]['id']}},_0x52896c={};_0x52896c[_0x0bab('0x2d')]=_[_0x0bab('0x3e')](db[_0x0bab('0x26')]['rawAttributes']);_0x52896c['query']=_[_0x0bab('0x3e')](_0x4edd72[_0x0bab('0x29')]);_0x52896c['filters']=_[_0x0bab('0x2c')](_0x52896c['model'],_0x52896c[_0x0bab('0x29')]);_0x2ff53b[_0x0bab('0x2b')]=_[_0x0bab('0x2c')](_0x52896c[_0x0bab('0x2d')],qs[_0x0bab('0x2e')](_0x4edd72['query'][_0x0bab('0x2e')]));_0x2ff53b['attributes']=_0x2ff53b[_0x0bab('0x2b')][_0x0bab('0x2f')]?_0x2ff53b[_0x0bab('0x2b')]:_0x52896c[_0x0bab('0x2d')];if(_0x4edd72[_0x0bab('0x29')][_0x0bab('0x39')]){_0x2ff53b[_0x0bab('0x3a')]=[{'all':!![]}];}_0x2ff53b=_[_0x0bab('0x36')]({},_0x2ff53b,_0x4edd72[_0x0bab('0x3f')]);return db[_0x0bab('0x26')][_0x0bab('0x40')](_0x2ff53b)[_0x0bab('0x22')](handleEntityNotFound(_0x4b0453,null))[_0x0bab('0x22')](respondWithResult(_0x4b0453,null))[_0x0bab('0x41')](handleError(_0x4b0453,null));};exports['create']=function(_0x2e5db0,_0x5e628d){return db['Dynamics365Field'][_0x0bab('0x42')](_0x2e5db0['body'],{})[_0x0bab('0x22')](respondWithResult(_0x5e628d,0xc9))[_0x0bab('0x41')](handleError(_0x5e628d,null));};exports['update']=function(_0x427904,_0x504b7e){if(_0x427904[_0x0bab('0x43')]['id']){delete _0x427904[_0x0bab('0x43')]['id'];}return db['Dynamics365Field'][_0x0bab('0x40')]({'where':{'id':_0x427904[_0x0bab('0x3d')]['id']}})[_0x0bab('0x22')](handleEntityNotFound(_0x504b7e,null))[_0x0bab('0x22')](saveUpdates(_0x427904[_0x0bab('0x43')],null))[_0x0bab('0x22')](respondWithResult(_0x504b7e,null))[_0x0bab('0x41')](handleError(_0x504b7e,null));};exports['destroy']=function(_0x34aa71,_0x6d32c2){return db[_0x0bab('0x26')]['find']({'where':{'id':_0x34aa71[_0x0bab('0x3d')]['id']}})[_0x0bab('0x22')](handleEntityNotFound(_0x6d32c2,null))[_0x0bab('0x22')](removeEntity(_0x6d32c2,null))[_0x0bab('0x41')](handleError(_0x6d32c2,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index b5e2737..6f7d685 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 _0x2f1f=['moment','bluebird','path','rimraf','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x5b0468,_0x4a06c8){var _0x429a3d=function(_0x153330){while(--_0x153330){_0x5b0468['push'](_0x5b0468['shift']());}};_0x429a3d(++_0x4a06c8);}(_0x2f1f,0x1e7));var _0xf2f1=function(_0x542d27,_0x4f34af){_0x542d27=_0x542d27-0x0;var _0x24b03c=_0x2f1f[_0x542d27];return _0x24b03c;};'use strict';var _=require(_0xf2f1('0x0'));var util=require(_0xf2f1('0x1'));var logger=require(_0xf2f1('0x2'))('api');var moment=require(_0xf2f1('0x3'));var BPromise=require(_0xf2f1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2f1('0x5'));var rimraf=require(_0xf2f1('0x6'));var config=require('../../config/environment');var attributes=require(_0xf2f1('0x7'));module[_0xf2f1('0x8')]=function(_0x18671f,_0x4a045b){return _0x18671f[_0xf2f1('0x9')](_0xf2f1('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xf2f1('0xb'),'fields':[_0xf2f1('0xc'),_0xf2f1('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4265=['request-promise','path','int_dynamics365_fields','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2e9826,_0x5ecce5){var _0x24f0f9=function(_0x5e5415){while(--_0x5e5415){_0x2e9826['push'](_0x2e9826['shift']());}};_0x24f0f9(++_0x5ecce5);}(_0x4265,0x14e));var _0x5426=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4265[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x5426('0x0'));var util=require(_0x5426('0x1'));var logger=require(_0x5426('0x2'))(_0x5426('0x3'));var moment=require(_0x5426('0x4'));var BPromise=require(_0x5426('0x5'));var rp=require(_0x5426('0x6'));var fs=require('fs');var path=require(_0x5426('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x466903,_0x16309d){return _0x466903['define']('Dynamics365Field',attributes,{'tableName':_0x5426('0x8'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0x5426('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 17b3f97..5275b2f 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 _0x9fe7=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x4b18ac,_0x96746b){var _0x28d4ec=function(_0x59f19b){while(--_0x59f19b){_0x4b18ac['push'](_0x4b18ac['shift']());}};_0x28d4ec(++_0x96746b);}(_0x9fe7,0x1df));var _0x79fe=function(_0x5facd7,_0x2bad7a){_0x5facd7=_0x5facd7-0x0;var _0x3d36eb=_0x9fe7[_0x5facd7];return _0x3d36eb;};'use strict';var _=require(_0x79fe('0x0'));var util=require(_0x79fe('0x1'));var moment=require('moment');var BPromise=require(_0x79fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x79fe('0x3'));var db=require(_0x79fe('0x4'))['db'];var utils=require(_0x79fe('0x5'));var logger=require('../../config/logger')(_0x79fe('0x6'));var config=require(_0x79fe('0x7'));var jayson=require(_0x79fe('0x8'));var client=jayson['client'][_0x79fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a5aef,_0x2ba246,_0x4c8314){return new BPromise(function(_0x24faa0,_0x264323){return client[_0x79fe('0xa')](_0x2a5aef,_0x4c8314)[_0x79fe('0xb')](function(_0xafc7cd){logger['info'](_0x79fe('0xc'),_0x2ba246,_0x79fe('0xd'));logger['debug'](_0x79fe('0xe'),_0x2ba246,_0x79fe('0xd'),JSON[_0x79fe('0xf')](_0xafc7cd));if(_0xafc7cd[_0x79fe('0x10')]){if(_0xafc7cd['error'][_0x79fe('0x11')]===0x1f4){logger[_0x79fe('0x10')](_0x79fe('0xc'),_0x2ba246,_0xafc7cd[_0x79fe('0x10')][_0x79fe('0x12')]);return _0x264323(_0xafc7cd[_0x79fe('0x10')][_0x79fe('0x12')]);}logger[_0x79fe('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x2ba246,_0xafc7cd[_0x79fe('0x10')][_0x79fe('0x12')]);return _0x24faa0(_0xafc7cd[_0x79fe('0x10')][_0x79fe('0x12')]);}else{logger[_0x79fe('0x13')](_0x79fe('0xc'),_0x2ba246,'request\x20sent');_0x24faa0(_0xafc7cd[_0x79fe('0x14')][_0x79fe('0x12')]);}})[_0x79fe('0x15')](function(_0x5f0af3){logger['error'](_0x79fe('0xc'),_0x2ba246,_0x5f0af3);_0x264323(_0x5f0af3);});});} \ No newline at end of file +var _0xdf55=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Field,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x26ebe3,_0x4ee6b7){var _0x337695=function(_0x377cf1){while(--_0x377cf1){_0x26ebe3['push'](_0x26ebe3['shift']());}};_0x337695(++_0x4ee6b7);}(_0xdf55,0x83));var _0x5df5=function(_0x43b852,_0x591eba){_0x43b852=_0x43b852-0x0;var _0x10d838=_0xdf55[_0x43b852];return _0x10d838;};'use strict';var _=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var moment=require('moment');var BPromise=require(_0x5df5('0x2'));var rs=require(_0x5df5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5df5('0x4'))['db'];var utils=require(_0x5df5('0x5'));var logger=require(_0x5df5('0x6'))('rpc');var config=require(_0x5df5('0x7'));var jayson=require(_0x5df5('0x8'));var client=jayson[_0x5df5('0x9')][_0x5df5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9b8756,_0x2b7ed9,_0x4722a2){return new BPromise(function(_0x3743f3,_0x4d43a3){return client[_0x5df5('0xb')](_0x9b8756,_0x4722a2)[_0x5df5('0xc')](function(_0x41941e){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x2b7ed9,_0x5df5('0xd'));logger['debug'](_0x5df5('0xe'),_0x2b7ed9,_0x5df5('0xd'),JSON['stringify'](_0x41941e));if(_0x41941e['error']){if(_0x41941e[_0x5df5('0xf')][_0x5df5('0x10')]===0x1f4){logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);return _0x4d43a3(_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);}logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e['error'][_0x5df5('0x12')]);return _0x3743f3(_0x41941e['error'][_0x5df5('0x12')]);}else{logger[_0x5df5('0x13')](_0x5df5('0x11'),_0x2b7ed9,_0x5df5('0xd'));_0x3743f3(_0x41941e[_0x5df5('0x14')]['message']);}})[_0x5df5('0x15')](function(_0x457205){logger['error'](_0x5df5('0x11'),_0x2b7ed9,_0x457205);_0x4d43a3(_0x457205);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 54bebc2..ebcc027 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 _0xbd84=['getConfigurations','/:id/fields','post','put','delete','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id','show'];(function(_0x50e1fd,_0x58ef4a){var _0x238221=function(_0x1967f5){while(--_0x1967f5){_0x50e1fd['push'](_0x50e1fd['shift']());}};_0x238221(++_0x58ef4a);}(_0xbd84,0x9f));var _0x4bd8=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xbd84[_0x9df060];return _0x338dfe;};'use strict';var multer=require(_0x4bd8('0x0'));var util=require('util');var path=require(_0x4bd8('0x1'));var timeout=require('connect-timeout');var express=require(_0x4bd8('0x2'));var router=express['Router']();var auth=require(_0x4bd8('0x3'));var interaction=require(_0x4bd8('0x4'));var config=require(_0x4bd8('0x5'));var controller=require(_0x4bd8('0x6'));router['get']('/',auth[_0x4bd8('0x7')](),controller[_0x4bd8('0x8')]);router[_0x4bd8('0x9')](_0x4bd8('0xa'),auth[_0x4bd8('0x7')](),controller[_0x4bd8('0xb')]);router['get']('/:id/configurations',auth[_0x4bd8('0x7')](),controller[_0x4bd8('0xc')]);router['get'](_0x4bd8('0xd'),auth[_0x4bd8('0x7')](),controller['getFields']);router[_0x4bd8('0xe')]('/',auth[_0x4bd8('0x7')](),controller['create']);router['post']('/:id/configurations',auth[_0x4bd8('0x7')](),controller['addConfiguration']);router[_0x4bd8('0xf')]('/:id',auth[_0x4bd8('0x7')](),controller['update']);router[_0x4bd8('0x10')]('/:id',auth[_0x4bd8('0x7')](),controller[_0x4bd8('0x11')]);module[_0x4bd8('0x12')]=router; \ No newline at end of file +var _0xffb9=['index','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xffb9,0x1dd));var _0x9ffb=function(_0x5e5b7e,_0x2ea953){_0x5e5b7e=_0x5e5b7e-0x0;var _0x18efa5=_0xffb9[_0x5e5b7e];return _0x18efa5;};'use strict';var multer=require('multer');var util=require(_0x9ffb('0x0'));var path=require(_0x9ffb('0x1'));var timeout=require('connect-timeout');var express=require(_0x9ffb('0x2'));var router=express['Router']();var auth=require(_0x9ffb('0x3'));var interaction=require(_0x9ffb('0x4'));var config=require('../../config/environment');var controller=require(_0x9ffb('0x5'));router[_0x9ffb('0x6')]('/',auth['isAuthenticated'](),controller[_0x9ffb('0x7')]);router[_0x9ffb('0x6')]('/:id',auth[_0x9ffb('0x8')](),controller[_0x9ffb('0x9')]);router[_0x9ffb('0x6')](_0x9ffb('0xa'),auth[_0x9ffb('0x8')](),controller['getConfigurations']);router['get'](_0x9ffb('0xb'),auth[_0x9ffb('0x8')](),controller[_0x9ffb('0xc')]);router[_0x9ffb('0xd')]('/',auth[_0x9ffb('0x8')](),controller[_0x9ffb('0xe')]);router['post']('/:id/configurations',auth[_0x9ffb('0x8')](),controller[_0x9ffb('0xf')]);router[_0x9ffb('0x10')](_0x9ffb('0x11'),auth['isAuthenticated'](),controller[_0x9ffb('0x12')]);router[_0x9ffb('0x13')]('/:id',auth[_0x9ffb('0x8')](),controller[_0x9ffb('0x14')]);module[_0x9ffb('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 2fd2571..eef7d77 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 _0xb96d=['STRING','username','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb96d,0x9e));var _0xdb96=function(_0x24fa1a,_0x16d9c2){_0x24fa1a=_0x24fa1a-0x0;var _0xc5621f=_0xb96d[_0x24fa1a];return _0xc5621f;};'use strict';var Sequelize=require('sequelize');module[_0xdb96('0x0')]={'name':{'type':Sequelize[_0xdb96('0x1')]},'description':{'type':Sequelize[_0xdb96('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xdb96('0x2')},'apiKey':{'type':Sequelize[_0xdb96('0x1')]},'remoteUri':{'type':Sequelize[_0xdb96('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x72fa=['sequelize','exports','STRING','username','remoteUri'];(function(_0x2f77b4,_0x416b59){var _0x308951=function(_0x421c9e){while(--_0x421c9e){_0x2f77b4['push'](_0x2f77b4['shift']());}};_0x308951(++_0x416b59);}(_0x72fa,0x78));var _0xa72f=function(_0x12fb36,_0x2285e9){_0x12fb36=_0x12fb36-0x0;var _0x37952d=_0x72fa[_0x12fb36];return _0x37952d;};'use strict';var Sequelize=require(_0xa72f('0x0'));module[_0xa72f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa72f('0x2')]},'username':{'type':Sequelize[_0xa72f('0x2')],'unique':_0xa72f('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xa72f('0x4')},'serverUrl':{'type':Sequelize[_0xa72f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index b9b8266..ce9ab1f 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(_0x544106,_0x449f0e){var _0x51ea19=function(_0x519a8e){while(--_0x519a8e){_0x544106['push'](_0x544106['shift']());}};_0x51ea19(++_0x449f0e);}(_0xe14b,0x93));var _0xbe14=function(_0x1c0d8c,_0x255ee){_0x1c0d8c=_0x1c0d8c-0x0;var _0x15c9af=_0xe14b[_0x1c0d8c];return _0x15c9af;};'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 _0x1cb9=['reject','save','update','destroy','name','send','index','FreshdeskAccount','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','keys','include','find','create','body','params','getConfigurations','findOne','order','pick','addConfiguration','AccountId','Descriptions','channel','FreshdeskConfiguration','Subjects','FreshdeskField','getFields','remoteUri','slice','substring','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','base64','requester','subject','agent','description','priority','group','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','http','Sequelize','ValidationError','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','sendStatus','end','status','offset','limit','set','Content-Range','json','apply'];(function(_0x4bdd56,_0x219c46){var _0x5c1151=function(_0x34a036){while(--_0x34a036){_0x4bdd56['push'](_0x4bdd56['shift']());}};_0x5c1151(++_0x219c46);}(_0x1cb9,0x14e));var _0x91cb=function(_0x14ddc1,_0x62fdc2){_0x14ddc1=_0x14ddc1-0x0;var _0x4bf296=_0x1cb9[_0x14ddc1];return _0x4bf296;};'use strict';var pdf=require(_0x91cb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x91cb('0x1'));var zipdir=require(_0x91cb('0x2'));var jsonpatch=require(_0x91cb('0x3'));var rp=require(_0x91cb('0x4'));var moment=require('moment');var BPromise=require(_0x91cb('0x5'));var Mustache=require(_0x91cb('0x6'));var util=require('util');var path=require(_0x91cb('0x7'));var sox=require(_0x91cb('0x8'));var csv=require(_0x91cb('0x9'));var ejs=require(_0x91cb('0xa'));var fs=require('fs');var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x9'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x91cb('0x18'));var jayson=require(_0x91cb('0x19'));var client=jayson['client'][_0x91cb('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3ea707,_0x44f2e9,_0x2c7d40){if(_0x2c7d40){var _0x4a7d45=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4a7d45['test'](_0x44f2e9)){return _0x3ea707;}else{throw new db[(_0x91cb('0x1b'))][(_0x91cb('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3ea707;}}function respondWithRpcPromise(_0x528f73,_0x576369,_0xc3629e,_0x347980){return new BPromise(function(_0x5ea796,_0x238f11){var _0x135890=_0x347980||client;return _0x135890['request'](_0x528f73,_0xc3629e)[_0x91cb('0x1d')](function(_0x139f4b){logger[_0x91cb('0x1e')](_0x91cb('0x1f'),_0x576369,'request\x20sent');logger[_0x91cb('0x20')](_0x91cb('0x21'),_0x576369,'request\x20sent',JSON[_0x91cb('0x22')](_0x139f4b));if(_0x139f4b['error']){if(_0x139f4b['error'][_0x91cb('0x23')]===0x1f4){logger[_0x91cb('0x24')]('FreshdeskAccount,\x20%s,\x20%s',_0x576369,_0x139f4b['error']['message']);return _0x238f11(_0x139f4b[_0x91cb('0x24')][_0x91cb('0x25')]);}logger[_0x91cb('0x24')](_0x91cb('0x1f'),_0x576369,_0x139f4b['error'][_0x91cb('0x25')]);return _0x5ea796(_0x139f4b[_0x91cb('0x24')][_0x91cb('0x25')]);}else{logger['info'](_0x91cb('0x1f'),_0x576369,_0x91cb('0x26'));_0x5ea796(_0x139f4b[_0x91cb('0x27')][_0x91cb('0x25')]);}})[_0x91cb('0x28')](function(_0x7ad361){logger[_0x91cb('0x24')](_0x91cb('0x1f'),_0x576369,_0x7ad361);_0x238f11(_0x7ad361);});});}function respondWithStatusCode(_0x264e9b,_0x4c8438){_0x4c8438=_0x4c8438||0xcc;return function(_0x59bf3a){if(_0x59bf3a){return _0x264e9b[_0x91cb('0x29')](_0x4c8438);}return _0x264e9b['status'](_0x4c8438)[_0x91cb('0x2a')]();};}function respondWithResult(_0x34d372,_0x318031){_0x318031=_0x318031||0xc8;return function(_0x5595c5){if(_0x5595c5){return _0x34d372[_0x91cb('0x2b')](_0x318031)['json'](_0x5595c5);}};}function respondWithFilteredResult(_0x4572f6,_0x308e8c){return function(_0x3b3ee6){if(_0x3b3ee6){var _0x2fb473=_0x3b3ee6['count'],_0x468908=_0x308e8c[_0x91cb('0x2c')],_0x504275=_0x308e8c[_0x91cb('0x2c')]+_0x308e8c[_0x91cb('0x2d')],_0x2f04a3;if(_0x504275>=_0x2fb473){_0x504275=_0x2fb473;_0x2f04a3=0xc8;}else{_0x2f04a3=0xce;}_0x4572f6['status'](_0x2f04a3);return _0x4572f6[_0x91cb('0x2e')](_0x91cb('0x2f'),_0x468908+'-'+_0x504275+'/'+_0x2fb473)[_0x91cb('0x30')](_0x3b3ee6);}return null;};}function patchUpdates(_0x361e4c){return function(_0xf296bc){try{jsonpatch[_0x91cb('0x31')](_0xf296bc,_0x361e4c,!![]);}catch(_0x1e5bf1){return BPromise[_0x91cb('0x32')](_0x1e5bf1);}return _0xf296bc[_0x91cb('0x33')]();};}function saveUpdates(_0x5e6ed3,_0x2ccf6e){return function(_0x474a15){if(_0x474a15){return _0x474a15[_0x91cb('0x34')](_0x5e6ed3)[_0x91cb('0x1d')](function(_0x440060){return _0x440060;});}return null;};}function removeEntity(_0x4e70cd,_0x2409d3){return function(_0x74b443){if(_0x74b443){return _0x74b443[_0x91cb('0x35')]()[_0x91cb('0x1d')](function(){_0x4e70cd[_0x91cb('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x121c37,_0x5927cb){return function(_0x47fc17){if(!_0x47fc17){_0x121c37['sendStatus'](0x194);}return _0x47fc17;};}function handleError(_0x2011fc,_0x4bba88){_0x4bba88=_0x4bba88||0x1f4;return function(_0x341ebe){logger['error'](_0x341ebe['stack']);if(_0x341ebe[_0x91cb('0x36')]){delete _0x341ebe[_0x91cb('0x36')];}_0x2011fc[_0x91cb('0x2b')](_0x4bba88)[_0x91cb('0x37')](_0x341ebe);};}exports[_0x91cb('0x38')]=function(_0x4b0ca6,_0x8beb3a){var _0x3ddc0b={},_0x13a5ea={},_0x8496a3={'count':0x0,'rows':[]};var _0x486a89=_['map'](db[_0x91cb('0x39')][_0x91cb('0x3a')],function(_0x56d614){return{'name':_0x56d614[_0x91cb('0x3b')],'type':_0x56d614[_0x91cb('0x3c')]['key']};});_0x13a5ea[_0x91cb('0x3d')]=_[_0x91cb('0x3e')](_0x486a89,'name');_0x13a5ea[_0x91cb('0x3f')]=_['keys'](_0x4b0ca6[_0x91cb('0x3f')]);_0x13a5ea[_0x91cb('0x40')]=_[_0x91cb('0x41')](_0x13a5ea[_0x91cb('0x3d')],_0x13a5ea[_0x91cb('0x3f')]);_0x3ddc0b[_0x91cb('0x42')]=_['intersection'](_0x13a5ea[_0x91cb('0x3d')],qs[_0x91cb('0x43')](_0x4b0ca6['query'][_0x91cb('0x43')]));_0x3ddc0b['attributes']=_0x3ddc0b[_0x91cb('0x42')][_0x91cb('0x44')]?_0x3ddc0b[_0x91cb('0x42')]:_0x13a5ea[_0x91cb('0x3d')];if(!_0x4b0ca6['query'][_0x91cb('0x45')](_0x91cb('0x46'))){_0x3ddc0b[_0x91cb('0x2d')]=qs[_0x91cb('0x2d')](_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x2d')]);_0x3ddc0b[_0x91cb('0x2c')]=qs[_0x91cb('0x2c')](_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x2c')]);}_0x3ddc0b['order']=qs[_0x91cb('0x47')](_0x4b0ca6['query'][_0x91cb('0x47')]);_0x3ddc0b['where']=qs[_0x91cb('0x40')](_['pick'](_0x4b0ca6[_0x91cb('0x3f')],_0x13a5ea[_0x91cb('0x40')]),_0x486a89);if(_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x48')]){_0x3ddc0b['where']=_[_0x91cb('0x49')](_0x3ddc0b[_0x91cb('0x4a')],{'$or':_['map'](_0x486a89,function(_0x461e1e){if(_0x461e1e[_0x91cb('0x3c')]!==_0x91cb('0x4b')){var _0x32517d={};_0x32517d[_0x461e1e[_0x91cb('0x36')]]={'$like':'%'+_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x48')]+'%'};return _0x32517d;}})});}_0x3ddc0b=_[_0x91cb('0x49')]({},_0x3ddc0b,_0x4b0ca6[_0x91cb('0x4c')]);var _0x4b26f6={'where':_0x3ddc0b[_0x91cb('0x4a')]};return db[_0x91cb('0x39')][_0x91cb('0x4d')](_0x4b26f6)[_0x91cb('0x1d')](function(_0x3314cc){_0x8496a3[_0x91cb('0x4d')]=_0x3314cc;if(_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x4e')]){_0x3ddc0b['include']=[{'all':!![]}];}return db[_0x91cb('0x39')][_0x91cb('0x4f')](_0x3ddc0b);})[_0x91cb('0x1d')](function(_0x3b8cfd){_0x8496a3['rows']=_0x3b8cfd;return _0x8496a3;})[_0x91cb('0x1d')](respondWithFilteredResult(_0x8beb3a,_0x3ddc0b))[_0x91cb('0x28')](handleError(_0x8beb3a,null));};exports['show']=function(_0x212473,_0x47cdb7){var _0x2c419b={'raw':![],'where':{'id':_0x212473['params']['id']}},_0x4c0acd={};_0x4c0acd['model']=_[_0x91cb('0x50')](db[_0x91cb('0x39')][_0x91cb('0x3a')]);_0x4c0acd[_0x91cb('0x3f')]=_[_0x91cb('0x50')](_0x212473['query']);_0x4c0acd['filters']=_[_0x91cb('0x41')](_0x4c0acd[_0x91cb('0x3d')],_0x4c0acd[_0x91cb('0x3f')]);_0x2c419b[_0x91cb('0x42')]=_['intersection'](_0x4c0acd['model'],qs['fields'](_0x212473[_0x91cb('0x3f')]['fields']));_0x2c419b[_0x91cb('0x42')]=_0x2c419b['attributes'][_0x91cb('0x44')]?_0x2c419b[_0x91cb('0x42')]:_0x4c0acd[_0x91cb('0x3d')];if(_0x212473[_0x91cb('0x3f')][_0x91cb('0x4e')]){_0x2c419b[_0x91cb('0x51')]=[{'all':!![]}];}_0x2c419b=_[_0x91cb('0x49')]({},_0x2c419b,_0x212473[_0x91cb('0x4c')]);return db[_0x91cb('0x39')][_0x91cb('0x52')](_0x2c419b)[_0x91cb('0x1d')](handleEntityNotFound(_0x47cdb7,null))['then'](respondWithResult(_0x47cdb7,null))[_0x91cb('0x28')](handleError(_0x47cdb7,null));};exports[_0x91cb('0x53')]=function(_0x4d7a34,_0x3f719b){return db[_0x91cb('0x39')]['create'](_0x4d7a34[_0x91cb('0x54')],{})[_0x91cb('0x1d')](respondWithResult(_0x3f719b,0xc9))[_0x91cb('0x28')](handleError(_0x3f719b,null));};exports[_0x91cb('0x34')]=function(_0x43ddee,_0x42a9ef){if(_0x43ddee[_0x91cb('0x54')]['id']){delete _0x43ddee[_0x91cb('0x54')]['id'];}return db[_0x91cb('0x39')][_0x91cb('0x52')]({'where':{'id':_0x43ddee[_0x91cb('0x55')]['id']}})['then'](handleEntityNotFound(_0x42a9ef,null))[_0x91cb('0x1d')](saveUpdates(_0x43ddee['body'],null))[_0x91cb('0x1d')](respondWithResult(_0x42a9ef,null))['catch'](handleError(_0x42a9ef,null));};exports[_0x91cb('0x35')]=function(_0x1b2fec,_0x1986d7){return db['FreshdeskAccount'][_0x91cb('0x52')]({'where':{'id':_0x1b2fec[_0x91cb('0x55')]['id']}})['then'](handleEntityNotFound(_0x1986d7,null))[_0x91cb('0x1d')](removeEntity(_0x1986d7,null))[_0x91cb('0x28')](handleError(_0x1986d7,null));};exports[_0x91cb('0x56')]=function(_0x25548b,_0x48e825,_0x2f5658){var _0x3854e9={};var _0x4250c2={};var _0x373076;var _0x55a0e3;return db[_0x91cb('0x39')][_0x91cb('0x57')]({'where':{'id':_0x25548b['params']['id']}})['then'](handleEntityNotFound(_0x48e825,null))[_0x91cb('0x1d')](function(_0x525021){if(_0x525021){_0x373076=_0x525021;_0x4250c2[_0x91cb('0x3d')]=_[_0x91cb('0x50')](db['FreshdeskConfiguration']['rawAttributes']);_0x4250c2[_0x91cb('0x3f')]=_['keys'](_0x25548b[_0x91cb('0x3f')]);_0x4250c2[_0x91cb('0x40')]=_[_0x91cb('0x41')](_0x4250c2['model'],_0x4250c2[_0x91cb('0x3f')]);_0x3854e9['attributes']=_[_0x91cb('0x41')](_0x4250c2[_0x91cb('0x3d')],qs[_0x91cb('0x43')](_0x25548b[_0x91cb('0x3f')]['fields']));_0x3854e9[_0x91cb('0x42')]=_0x3854e9[_0x91cb('0x42')][_0x91cb('0x44')]?_0x3854e9[_0x91cb('0x42')]:_0x4250c2[_0x91cb('0x3d')];_0x3854e9[_0x91cb('0x58')]=qs[_0x91cb('0x47')](_0x25548b[_0x91cb('0x3f')][_0x91cb('0x47')]);_0x3854e9[_0x91cb('0x4a')]=qs[_0x91cb('0x40')](_[_0x91cb('0x59')](_0x25548b['query'],_0x4250c2[_0x91cb('0x40')]));if(_0x25548b[_0x91cb('0x3f')][_0x91cb('0x48')]){_0x3854e9[_0x91cb('0x4a')]=_[_0x91cb('0x49')](_0x3854e9[_0x91cb('0x4a')],{'$or':_[_0x91cb('0x3e')](_0x3854e9['attributes'],function(_0x325b2d){var _0x5a3c7d={};_0x5a3c7d[_0x325b2d]={'$like':'%'+_0x25548b[_0x91cb('0x3f')][_0x91cb('0x48')]+'%'};return _0x5a3c7d;})});}_0x3854e9=_[_0x91cb('0x49')]({},_0x3854e9,_0x25548b[_0x91cb('0x4c')]);return _0x373076['getConfigurations'](_0x3854e9);}})[_0x91cb('0x1d')](function(_0x22ab40){if(_0x22ab40){_0x55a0e3=_0x22ab40[_0x91cb('0x44')];if(!_0x25548b[_0x91cb('0x3f')][_0x91cb('0x45')](_0x91cb('0x46'))){_0x3854e9['limit']=qs[_0x91cb('0x2d')](_0x25548b[_0x91cb('0x3f')][_0x91cb('0x2d')]);_0x3854e9[_0x91cb('0x2c')]=qs[_0x91cb('0x2c')](_0x25548b[_0x91cb('0x3f')][_0x91cb('0x2c')]);}return _0x373076[_0x91cb('0x56')](_0x3854e9);}})[_0x91cb('0x1d')](function(_0x457f81){if(_0x457f81){return _0x457f81?{'count':_0x55a0e3,'rows':_0x457f81}:null;}})[_0x91cb('0x1d')](respondWithResult(_0x48e825,null))[_0x91cb('0x28')](handleError(_0x48e825,null));};exports[_0x91cb('0x5a')]=function(_0x3eead5,_0x2d2613,_0x2605c3){if(_0x3eead5[_0x91cb('0x54')]['id']){delete _0x3eead5['body']['id'];}return db[_0x91cb('0x39')][_0x91cb('0x57')]({'where':{'id':_0x3eead5['params']['id']}})[_0x91cb('0x1d')](handleEntityNotFound(_0x2d2613,null))[_0x91cb('0x1d')](function(_0x1c3e0a){if(_0x1c3e0a){_0x3eead5['body'][_0x91cb('0x5b')]=_0x1c3e0a['id'];_0x3eead5[_0x91cb('0x54')]['Subjects']=integrations['getSubjects'](_0x3eead5[_0x91cb('0x54')]['channel'],_0x3eead5[_0x91cb('0x54')][_0x91cb('0x3c')]);_0x3eead5['body'][_0x91cb('0x5c')]=integrations['getDescriptions'](_0x3eead5[_0x91cb('0x54')][_0x91cb('0x5d')],_0x3eead5['body']['type']);return db[_0x91cb('0x5e')][_0x91cb('0x53')](_0x3eead5[_0x91cb('0x54')],{'include':[{'model':db['FreshdeskField'],'as':_0x91cb('0x5f')},{'model':db[_0x91cb('0x60')],'as':_0x91cb('0x5c')}]});}return null;})[_0x91cb('0x1d')](respondWithResult(_0x2d2613,null))['catch'](handleError(_0x2d2613,null));};exports[_0x91cb('0x61')]=function(_0x4ee1e3,_0x342587,_0x4118eb){var _0x30c607='';return db[_0x91cb('0x39')]['findOne']({'where':{'id':_0x4ee1e3['params']['id']},'attributes':['id',_0x91cb('0x62'),'apiKey']})[_0x91cb('0x1d')](handleEntityNotFound(_0x342587,null))[_0x91cb('0x1d')](function(_0x2ede77){if(_0x2ede77){_0x30c607=_0x2ede77[_0x91cb('0x62')];var _0x33d4ab=_0x30c607[_0x91cb('0x63')](-0x1);if(_0x33d4ab==='/'){_0x30c607=_0x30c607[_0x91cb('0x64')](0x0,_0x30c607['lastIndexOf'](_0x33d4ab));}return rp({'method':_0x91cb('0x65'),'uri':util[_0x91cb('0x66')]('%s/%s',_0x30c607,_0x91cb('0x67')),'headers':{'Authorization':util['format'](_0x91cb('0x68'),new Buffer(util[_0x91cb('0x66')](_0x91cb('0x69'),_0x2ede77[_0x91cb('0x6a')]))[_0x91cb('0x6b')](_0x91cb('0x6c')))},'json':!![]});}})[_0x91cb('0x1d')](function(_0x30259d){if(_0x30259d){var _0x23380a=[_0x91cb('0x6d'),_0x91cb('0x6e'),_0x91cb('0x6f'),_0x91cb('0x70'),_0x91cb('0x2b'),_0x91cb('0x71'),_0x91cb('0x72'),'source',_0x91cb('0x73'),'group',_0x91cb('0x74')];_[_0x91cb('0x75')](_0x30259d,function(_0x13f358){return _0x23380a[_0x91cb('0x76')](_0x13f358[_0x91cb('0x36')])||!_0x13f358[_0x91cb('0x77')]&&_0x13f358[_0x91cb('0x3c')]!==_0x91cb('0x78')&&_0x13f358['type']!==_0x91cb('0x79');});return{'count':_0x30259d[_0x91cb('0x44')],'rows':_['map'](_0x30259d,function(_0x4fb3c0){return{'id':_0x4fb3c0[_0x91cb('0x36')],'name':_0x4fb3c0['label'],'custom':!_0x4fb3c0['default'],'options':_0x4fb3c0[_0x91cb('0x7a')]?_['map'](_0x4fb3c0[_0x91cb('0x7a')],function(_0x498382){return{'name':_[_0x91cb('0x7b')](_0x498382),'value':_0x498382};}):[]};})};}})[_0x91cb('0x1d')](respondWithResult(_0x342587,null))[_0x91cb('0x28')](function(_0x443c01){var _0x4e899c=_0x4ee1e3[_0x91cb('0x3f')][_0x91cb('0x7c')]?0x1f4:_0x443c01[_0x91cb('0x7d')]||0x1f4;logger[_0x91cb('0x24')](_0x91cb('0x7e'),_0x91cb('0x61'),_0x4e899c,JSON[_0x91cb('0x22')](_0x443c01));delete _0x443c01[_0x91cb('0x36')];if(_0x4e899c===0x191){_0x4e899c=0x190;}_0x342587[_0x91cb('0x2b')](_0x4e899c)[_0x91cb('0x37')](_0x4ee1e3[_0x91cb('0x3f')][_0x91cb('0x7c')]?{'message':_0x91cb('0x7f'),'statusCode':_0x443c01[_0x91cb('0x7d')]}:_0x443c01);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 7b41df0..e3ea41b 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 _0x2c55=['request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','api','moment','bluebird'];(function(_0x5d851d,_0x53c51c){var _0xbaaa92=function(_0x216b72){while(--_0x216b72){_0x5d851d['push'](_0x5d851d['shift']());}};_0xbaaa92(++_0x53c51c);}(_0x2c55,0x19d));var _0x52c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c55[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x52c5('0x0'));var moment=require(_0x52c5('0x1'));var BPromise=require(_0x52c5('0x2'));var rp=require(_0x52c5('0x3'));var fs=require('fs');var path=require(_0x52c5('0x4'));var rimraf=require(_0x52c5('0x5'));var config=require(_0x52c5('0x6'));var attributes=require(_0x52c5('0x7'));var integrations=require(_0x52c5('0x8'));module[_0x52c5('0x9')]=function(_0x3077e8,_0x4fbf7a){return _0x3077e8[_0x52c5('0xa')](_0x52c5('0xb'),attributes,{'tableName':_0x52c5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbe5=['../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','int_freshdesk_accounts','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x3c9cd7,_0x1a5590){var _0x5c82fe=function(_0x1b2b85){while(--_0x1b2b85){_0x3c9cd7['push'](_0x3c9cd7['shift']());}};_0x5c82fe(++_0x1a5590);}(_0xcbe5,0xc5));var _0x5cbe=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xcbe5[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x5cbe('0x0'));var util=require(_0x5cbe('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5cbe('0x2'));var BPromise=require(_0x5cbe('0x3'));var rp=require(_0x5cbe('0x4'));var fs=require('fs');var path=require(_0x5cbe('0x5'));var rimraf=require(_0x5cbe('0x6'));var config=require(_0x5cbe('0x7'));var attributes=require(_0x5cbe('0x8'));var integrations=require(_0x5cbe('0x9'));module['exports']=function(_0x367375,_0x2fef1f){return _0x367375[_0x5cbe('0xa')]('FreshdeskAccount',attributes,{'tableName':_0x5cbe('0xb'),'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 2cc0928..903d800 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 _0xbefe=['options','where','attributes','limit','map','include','model','catch','FreshdeskAccount','find','raw','ShowFreshdeskAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFreshdeskAccount','findAll'];(function(_0x3e1226,_0x4199d6){var _0x1ff634=function(_0x4dbed0){while(--_0x4dbed0){_0x3e1226['push'](_0x3e1226['shift']());}};_0x1ff634(++_0x4199d6);}(_0xbefe,0x98));var _0xebef=function(_0x5106c1,_0x13233a){_0x5106c1=_0x5106c1-0x0;var _0x5bcaac=_0xbefe[_0x5106c1];return _0x5bcaac;};'use strict';var _=require(_0xebef('0x0'));var util=require('util');var moment=require(_0xebef('0x1'));var BPromise=require(_0xebef('0x2'));var rs=require(_0xebef('0x3'));var fs=require('fs');var Redis=require(_0xebef('0x4'));var db=require(_0xebef('0x5'))['db'];var utils=require(_0xebef('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xebef('0x7'));var client=jayson[_0xebef('0x8')][_0xebef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40de06,_0x3c8e89,_0x51a734){return new BPromise(function(_0x5e53fd,_0x5e49ed){return client[_0xebef('0xa')](_0x40de06,_0x51a734)[_0xebef('0xb')](function(_0x407ce0){logger[_0xebef('0xc')](_0xebef('0xd'),_0x3c8e89,'request\x20sent');logger[_0xebef('0xe')](_0xebef('0xf'),_0x3c8e89,'request\x20sent',JSON[_0xebef('0x10')](_0x407ce0));if(_0x407ce0[_0xebef('0x11')]){if(_0x407ce0[_0xebef('0x11')][_0xebef('0x12')]===0x1f4){logger[_0xebef('0x11')](_0xebef('0xd'),_0x3c8e89,_0x407ce0[_0xebef('0x11')][_0xebef('0x13')]);return _0x5e49ed(_0x407ce0[_0xebef('0x11')][_0xebef('0x13')]);}logger['error'](_0xebef('0xd'),_0x3c8e89,_0x407ce0[_0xebef('0x11')][_0xebef('0x13')]);return _0x5e53fd(_0x407ce0[_0xebef('0x11')]['message']);}else{logger[_0xebef('0xc')](_0xebef('0xd'),_0x3c8e89,'request\x20sent');_0x5e53fd(_0x407ce0[_0xebef('0x14')][_0xebef('0x13')]);}})['catch'](function(_0x10a84d){logger[_0xebef('0x11')](_0xebef('0xd'),_0x3c8e89,_0x10a84d);_0x5e49ed(_0x10a84d);});});}exports[_0xebef('0x15')]=function(_0xe9bd77){var _0x354654=this;return new Promise(function(_0x143082,_0x1cc3f6){return db['FreshdeskAccount'][_0xebef('0x16')]({'raw':_0xe9bd77[_0xebef('0x17')]?_0xe9bd77[_0xebef('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xe9bd77['options']?_0xe9bd77[_0xebef('0x17')][_0xebef('0x18')]||null:null,'attributes':_0xe9bd77[_0xebef('0x17')]?_0xe9bd77[_0xebef('0x17')][_0xebef('0x19')]||null:null,'limit':_0xe9bd77[_0xebef('0x17')]?_0xe9bd77[_0xebef('0x17')][_0xebef('0x1a')]||null:null,'include':_0xe9bd77[_0xebef('0x17')]?_0xe9bd77[_0xebef('0x17')]['include']?_[_0xebef('0x1b')](_0xe9bd77[_0xebef('0x17')][_0xebef('0x1c')],function(_0x2e3f3f){return{'model':db[_0x2e3f3f[_0xebef('0x1d')]],'as':_0x2e3f3f['as'],'attributes':_0x2e3f3f[_0xebef('0x19')],'include':_0x2e3f3f[_0xebef('0x1c')]?_['map'](_0x2e3f3f[_0xebef('0x1c')],function(_0x249088){return{'model':db[_0x249088[_0xebef('0x1d')]],'as':_0x249088['as'],'attributes':_0x249088[_0xebef('0x19')],'include':_0x249088[_0xebef('0x1c')]?_[_0xebef('0x1b')](_0x249088[_0xebef('0x1c')],function(_0x361f5d){return{'model':db[_0x361f5d[_0xebef('0x1d')]],'as':_0x361f5d['as'],'attributes':_0x361f5d[_0xebef('0x19')]};}):[]};}):[]};}):[]:[]})[_0xebef('0xb')](function(_0x15bf4b){logger[_0xebef('0xc')]('GetFreshdeskAccount',_0xe9bd77);logger['debug'](_0xebef('0x15'),_0xe9bd77,JSON[_0xebef('0x10')](_0x15bf4b));_0x143082(_0x15bf4b);})[_0xebef('0x1e')](function(_0x1d4930){logger[_0xebef('0x11')](_0xebef('0x15'),_0x1d4930[_0xebef('0x13')],_0xe9bd77);_0x1cc3f6(_0x354654[_0xebef('0x11')](0x1f4,_0x1d4930['message']));});});};exports['ShowFreshdeskAccount']=function(_0xee3c81){var _0x240020=this;return new Promise(function(_0x13f245,_0x5c1bc6){return db[_0xebef('0x1f')][_0xebef('0x20')]({'raw':_0xee3c81[_0xebef('0x17')]?_0xee3c81['options'][_0xebef('0x21')]===undefined?!![]:![]:!![],'where':_0xee3c81['options']?_0xee3c81['options'][_0xebef('0x18')]||null:null,'attributes':_0xee3c81[_0xebef('0x17')]?_0xee3c81[_0xebef('0x17')][_0xebef('0x19')]||null:null,'include':_0xee3c81[_0xebef('0x17')]?_0xee3c81[_0xebef('0x17')][_0xebef('0x1c')]?_[_0xebef('0x1b')](_0xee3c81[_0xebef('0x17')][_0xebef('0x1c')],function(_0xbff276){return{'model':db[_0xbff276['model']],'as':_0xbff276['as'],'attributes':_0xbff276[_0xebef('0x19')],'include':_0xbff276[_0xebef('0x1c')]?_[_0xebef('0x1b')](_0xbff276[_0xebef('0x1c')],function(_0x55f41c){return{'model':db[_0x55f41c[_0xebef('0x1d')]],'as':_0x55f41c['as'],'attributes':_0x55f41c['attributes'],'include':_0x55f41c[_0xebef('0x1c')]?_[_0xebef('0x1b')](_0x55f41c['include'],function(_0x12c4a6){return{'model':db[_0x12c4a6[_0xebef('0x1d')]],'as':_0x12c4a6['as'],'attributes':_0x12c4a6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x53c9be){logger[_0xebef('0xc')]('ShowFreshdeskAccount',_0xee3c81);logger['debug'](_0xebef('0x22'),_0xee3c81,JSON[_0xebef('0x10')](_0x53c9be));_0x13f245(_0x53c9be);})['catch'](function(_0x3e1fb3){logger['error'](_0xebef('0x22'),_0x3e1fb3['message'],_0xee3c81);_0x5c1bc6(_0x240020['error'](0x1f4,_0x3e1fb3['message']));});});}; \ No newline at end of file +var _0x0271=['message','result','GetFreshdeskAccount','findAll','options','raw','attributes','limit','include','map','model','catch','ShowFreshdeskAccount','FreshdeskAccount','find','where','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s'];(function(_0x857fa2,_0x121322){var _0x48aba2=function(_0x52ed46){while(--_0x52ed46){_0x857fa2['push'](_0x857fa2['shift']());}};_0x48aba2(++_0x121322);}(_0x0271,0x1d7));var _0x1027=function(_0x58f319,_0x1c9ce0){_0x58f319=_0x58f319-0x0;var _0x438d21=_0x0271[_0x58f319];return _0x438d21;};'use strict';var _=require(_0x1027('0x0'));var util=require(_0x1027('0x1'));var moment=require(_0x1027('0x2'));var BPromise=require('bluebird');var rs=require(_0x1027('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1027('0x4'));var logger=require(_0x1027('0x5'))(_0x1027('0x6'));var config=require(_0x1027('0x7'));var jayson=require(_0x1027('0x8'));var client=jayson['client'][_0x1027('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27aa6d,_0x5e986f,_0x464f7a){return new BPromise(function(_0x4a2166,_0x41ba12){return client[_0x1027('0xa')](_0x27aa6d,_0x464f7a)[_0x1027('0xb')](function(_0x15f785){logger[_0x1027('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x5e986f,_0x1027('0xd'));logger[_0x1027('0xe')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x5e986f,'request\x20sent',JSON[_0x1027('0xf')](_0x15f785));if(_0x15f785['error']){if(_0x15f785[_0x1027('0x10')][_0x1027('0x11')]===0x1f4){logger[_0x1027('0x10')](_0x1027('0x12'),_0x5e986f,_0x15f785[_0x1027('0x10')]['message']);return _0x41ba12(_0x15f785[_0x1027('0x10')][_0x1027('0x13')]);}logger[_0x1027('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x5e986f,_0x15f785[_0x1027('0x10')][_0x1027('0x13')]);return _0x4a2166(_0x15f785[_0x1027('0x10')][_0x1027('0x13')]);}else{logger[_0x1027('0xc')](_0x1027('0x12'),_0x5e986f,_0x1027('0xd'));_0x4a2166(_0x15f785[_0x1027('0x14')][_0x1027('0x13')]);}})['catch'](function(_0x6d54c6){logger[_0x1027('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x5e986f,_0x6d54c6);_0x41ba12(_0x6d54c6);});});}exports[_0x1027('0x15')]=function(_0x54e361){var _0x326ae6=this;return new Promise(function(_0x15ae6c,_0x43fa4f){return db['FreshdeskAccount'][_0x1027('0x16')]({'raw':_0x54e361[_0x1027('0x17')]?_0x54e361['options'][_0x1027('0x18')]===undefined?!![]:![]:!![],'where':_0x54e361[_0x1027('0x17')]?_0x54e361['options']['where']||null:null,'attributes':_0x54e361[_0x1027('0x17')]?_0x54e361[_0x1027('0x17')][_0x1027('0x19')]||null:null,'limit':_0x54e361[_0x1027('0x17')]?_0x54e361[_0x1027('0x17')][_0x1027('0x1a')]||null:null,'include':_0x54e361[_0x1027('0x17')]?_0x54e361[_0x1027('0x17')][_0x1027('0x1b')]?_[_0x1027('0x1c')](_0x54e361[_0x1027('0x17')][_0x1027('0x1b')],function(_0x139b9b){return{'model':db[_0x139b9b[_0x1027('0x1d')]],'as':_0x139b9b['as'],'attributes':_0x139b9b[_0x1027('0x19')],'include':_0x139b9b[_0x1027('0x1b')]?_[_0x1027('0x1c')](_0x139b9b['include'],function(_0x5bb983){return{'model':db[_0x5bb983['model']],'as':_0x5bb983['as'],'attributes':_0x5bb983[_0x1027('0x19')],'include':_0x5bb983[_0x1027('0x1b')]?_['map'](_0x5bb983[_0x1027('0x1b')],function(_0x2799c6){return{'model':db[_0x2799c6[_0x1027('0x1d')]],'as':_0x2799c6['as'],'attributes':_0x2799c6[_0x1027('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x255e88){logger[_0x1027('0xc')](_0x1027('0x15'),_0x54e361);logger[_0x1027('0xe')](_0x1027('0x15'),_0x54e361,JSON[_0x1027('0xf')](_0x255e88));_0x15ae6c(_0x255e88);})[_0x1027('0x1e')](function(_0x15a2fd){logger[_0x1027('0x10')](_0x1027('0x15'),_0x15a2fd['message'],_0x54e361);_0x43fa4f(_0x326ae6[_0x1027('0x10')](0x1f4,_0x15a2fd[_0x1027('0x13')]));});});};exports[_0x1027('0x1f')]=function(_0x3b998d){var _0x4f489c=this;return new Promise(function(_0x1d520e,_0x48d67f){return db[_0x1027('0x20')][_0x1027('0x21')]({'raw':_0x3b998d['options']?_0x3b998d[_0x1027('0x17')][_0x1027('0x18')]===undefined?!![]:![]:!![],'where':_0x3b998d[_0x1027('0x17')]?_0x3b998d[_0x1027('0x17')][_0x1027('0x22')]||null:null,'attributes':_0x3b998d['options']?_0x3b998d['options'][_0x1027('0x19')]||null:null,'include':_0x3b998d[_0x1027('0x17')]?_0x3b998d[_0x1027('0x17')]['include']?_[_0x1027('0x1c')](_0x3b998d['options'][_0x1027('0x1b')],function(_0x2eee80){return{'model':db[_0x2eee80[_0x1027('0x1d')]],'as':_0x2eee80['as'],'attributes':_0x2eee80[_0x1027('0x19')],'include':_0x2eee80[_0x1027('0x1b')]?_[_0x1027('0x1c')](_0x2eee80['include'],function(_0x5e8e76){return{'model':db[_0x5e8e76[_0x1027('0x1d')]],'as':_0x5e8e76['as'],'attributes':_0x5e8e76['attributes'],'include':_0x5e8e76[_0x1027('0x1b')]?_['map'](_0x5e8e76['include'],function(_0x148b0e){return{'model':db[_0x148b0e['model']],'as':_0x148b0e['as'],'attributes':_0x148b0e[_0x1027('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1027('0xb')](function(_0x59e9bf){logger[_0x1027('0xc')](_0x1027('0x1f'),_0x3b998d);logger[_0x1027('0xe')](_0x1027('0x1f'),_0x3b998d,JSON['stringify'](_0x59e9bf));_0x1d520e(_0x59e9bf);})[_0x1027('0x1e')](function(_0x195459){logger[_0x1027('0x10')](_0x1027('0x1f'),_0x195459[_0x1027('0x13')],_0x3b998d);_0x48d67f(_0x4f489c[_0x1027('0x10')](0x1f4,_0x195459[_0x1027('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index a5a1252..ca2910f 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 _0x8aac=['getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','/:id/fields','getFields','/:id/subjects'];(function(_0x11213b,_0x29ae71){var _0x438c75=function(_0x4a6094){while(--_0x4a6094){_0x11213b['push'](_0x11213b['shift']());}};_0x438c75(++_0x29ae71);}(_0x8aac,0xfb));var _0xc8aa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8aac[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc8aa('0x0'));var util=require(_0xc8aa('0x1'));var path=require(_0xc8aa('0x2'));var timeout=require(_0xc8aa('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xc8aa('0x4'));var interaction=require(_0xc8aa('0x5'));var config=require(_0xc8aa('0x6'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0xc8aa('0x7')](),controller['index']);router[_0xc8aa('0x8')]('/:id',auth[_0xc8aa('0x7')](),controller[_0xc8aa('0x9')]);router[_0xc8aa('0x8')](_0xc8aa('0xa'),auth['isAuthenticated'](),controller[_0xc8aa('0xb')]);router[_0xc8aa('0x8')](_0xc8aa('0xc'),auth[_0xc8aa('0x7')](),controller[_0xc8aa('0xd')]);router[_0xc8aa('0x8')](_0xc8aa('0xe'),auth[_0xc8aa('0x7')](),controller[_0xc8aa('0xf')]);router[_0xc8aa('0x8')](_0xc8aa('0x10'),auth[_0xc8aa('0x7')](),controller['getTags']);router[_0xc8aa('0x11')]('/',auth[_0xc8aa('0x7')](),controller[_0xc8aa('0x12')]);router[_0xc8aa('0x11')](_0xc8aa('0x10'),auth[_0xc8aa('0x7')](),controller['setTags']);router[_0xc8aa('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xc8aa('0x14')]);router[_0xc8aa('0x15')]('/:id',auth[_0xc8aa('0x7')](),controller[_0xc8aa('0x16')]);module[_0xc8aa('0x17')]=router; \ No newline at end of file +var _0x777d=['getSubjects','/:id/descriptions','getDescriptions','getTags','create','post','/:id/tags','setTags','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects'];(function(_0x4450b1,_0x214ace){var _0x399b0b=function(_0x2197df){while(--_0x2197df){_0x4450b1['push'](_0x4450b1['shift']());}};_0x399b0b(++_0x214ace);}(_0x777d,0x78));var _0xd777=function(_0x4a325a,_0x2c154c){_0x4a325a=_0x4a325a-0x0;var _0x2597a1=_0x777d[_0x4a325a];return _0x2597a1;};'use strict';var multer=require(_0xd777('0x0'));var util=require(_0xd777('0x1'));var path=require(_0xd777('0x2'));var timeout=require(_0xd777('0x3'));var express=require(_0xd777('0x4'));var router=express[_0xd777('0x5')]();var auth=require(_0xd777('0x6'));var interaction=require(_0xd777('0x7'));var config=require('../../config/environment');var controller=require(_0xd777('0x8'));router[_0xd777('0x9')]('/',auth[_0xd777('0xa')](),controller['index']);router[_0xd777('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xd777('0xb')]);router[_0xd777('0x9')](_0xd777('0xc'),auth[_0xd777('0xa')](),controller[_0xd777('0xd')]);router[_0xd777('0x9')](_0xd777('0xe'),auth[_0xd777('0xa')](),controller[_0xd777('0xf')]);router['get'](_0xd777('0x10'),auth['isAuthenticated'](),controller[_0xd777('0x11')]);router[_0xd777('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0xd777('0x12')]);router['post']('/',auth[_0xd777('0xa')](),controller[_0xd777('0x13')]);router[_0xd777('0x14')](_0xd777('0x15'),auth[_0xd777('0xa')](),controller[_0xd777('0x16')]);router['put'](_0xd777('0x17'),auth[_0xd777('0xa')](),controller[_0xd777('0x18')]);router[_0xd777('0x19')](_0xd777('0x17'),auth[_0xd777('0xa')](),controller['destroy']);module[_0xd777('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 8613411..71859c4 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 _0x6ce3=['exports','STRING','sequelize'];(function(_0x3f4683,_0x4062f9){var _0x1a80aa=function(_0x5dea92){while(--_0x5dea92){_0x3f4683['push'](_0x3f4683['shift']());}};_0x1a80aa(++_0x4062f9);}(_0x6ce3,0x7d));var _0x36ce=function(_0x3acd25,_0x10c48a){_0x3acd25=_0x3acd25-0x0;var _0x5b5bbf=_0x6ce3[_0x3acd25];return _0x5b5bbf;};'use strict';var Sequelize=require(_0x36ce('0x0'));module[_0x36ce('0x1')]={'name':{'type':Sequelize[_0x36ce('0x2')]},'description':{'type':Sequelize[_0x36ce('0x2')]}}; \ No newline at end of file +var _0x7022=['exports','STRING','sequelize'];(function(_0x1833eb,_0x486dcf){var _0x46585b=function(_0x5d408c){while(--_0x5d408c){_0x1833eb['push'](_0x1833eb['shift']());}};_0x46585b(++_0x486dcf);}(_0x7022,0x11f));var _0x2702=function(_0x5ec64d,_0x245e6d){_0x5ec64d=_0x5ec64d-0x0;var _0x36619e=_0x7022[_0x5ec64d];return _0x36619e;};'use strict';var Sequelize=require(_0x2702('0x0'));module[_0x2702('0x1')]={'name':{'type':Sequelize[_0x2702('0x2')]},'description':{'type':Sequelize[_0x2702('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 1e5e55f..f0744b9 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 _0x8eac=['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','api','../../config/environment','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','destroy','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','show','options','create','body','params','find','getFields','getSubjects','findOne','FreshdeskField','getDescriptions','Tag','getTags','setTags','ids','html-pdf'];(function(_0x40552e,_0x37fa1c){var _0x1a71ca=function(_0x370d43){while(--_0x370d43){_0x40552e['push'](_0x40552e['shift']());}};_0x1a71ca(++_0x37fa1c);}(_0x8eac,0x11c));var _0xc8ea=function(_0x1344d6,_0x2181e6){_0x1344d6=_0x1344d6-0x0;var _0xf45b24=_0x8eac[_0x1344d6];return _0xf45b24;};'use strict';var pdf=require(_0xc8ea('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc8ea('0x1'));var zipdir=require(_0xc8ea('0x2'));var jsonpatch=require(_0xc8ea('0x3'));var rp=require(_0xc8ea('0x4'));var moment=require(_0xc8ea('0x5'));var BPromise=require(_0xc8ea('0x6'));var Mustache=require(_0xc8ea('0x7'));var util=require(_0xc8ea('0x8'));var path=require(_0xc8ea('0x9'));var sox=require(_0xc8ea('0xa'));var csv=require(_0xc8ea('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc8ea('0xc'));var squel=require(_0xc8ea('0xd'));var crypto=require(_0xc8ea('0xe'));var jsforce=require(_0xc8ea('0xf'));var deskjs=require(_0xc8ea('0x10'));var toCsv=require(_0xc8ea('0xb'));var querystring=require(_0xc8ea('0x11'));var Papa=require(_0xc8ea('0x12'));var Redis=require(_0xc8ea('0x13'));var authService=require(_0xc8ea('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc8ea('0x15'));var utils=require('../../config/utils');var config=require(_0xc8ea('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xc8ea('0x17'));var client=jayson[_0xc8ea('0x18')][_0xc8ea('0x19')]({'port':0x232a});function checkPasswordPattern(_0x241e77,_0x4e52dd,_0x3e7ebc){if(_0x3e7ebc){var _0x574b59=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x574b59['test'](_0x4e52dd)){return _0x241e77;}else{throw new db[(_0xc8ea('0x1a'))][(_0xc8ea('0x1b'))](_0xc8ea('0x1c'));}}else{return _0x241e77;}}function respondWithRpcPromise(_0x44a280,_0x5bcafc,_0x2f0c14,_0x6e8671){return new BPromise(function(_0x489807,_0x225e91){var _0x276522=_0x6e8671||client;return _0x276522[_0xc8ea('0x1d')](_0x44a280,_0x2f0c14)[_0xc8ea('0x1e')](function(_0x65f14d){logger[_0xc8ea('0x1f')](_0xc8ea('0x20'),_0x5bcafc,_0xc8ea('0x21'));logger['debug'](_0xc8ea('0x22'),_0x5bcafc,'request\x20sent',JSON[_0xc8ea('0x23')](_0x65f14d));if(_0x65f14d[_0xc8ea('0x24')]){if(_0x65f14d[_0xc8ea('0x24')]['code']===0x1f4){logger[_0xc8ea('0x24')](_0xc8ea('0x20'),_0x5bcafc,_0x65f14d[_0xc8ea('0x24')][_0xc8ea('0x25')]);return _0x225e91(_0x65f14d['error'][_0xc8ea('0x25')]);}logger[_0xc8ea('0x24')](_0xc8ea('0x20'),_0x5bcafc,_0x65f14d['error']['message']);return _0x489807(_0x65f14d['error']['message']);}else{logger['info'](_0xc8ea('0x20'),_0x5bcafc,_0xc8ea('0x21'));_0x489807(_0x65f14d['result'][_0xc8ea('0x25')]);}})[_0xc8ea('0x26')](function(_0xdd3bcd){logger[_0xc8ea('0x24')](_0xc8ea('0x20'),_0x5bcafc,_0xdd3bcd);_0x225e91(_0xdd3bcd);});});}function respondWithStatusCode(_0x21db35,_0x588933){_0x588933=_0x588933||0xcc;return function(_0x5abdbc){if(_0x5abdbc){return _0x21db35[_0xc8ea('0x27')](_0x588933);}return _0x21db35['status'](_0x588933)['end']();};}function respondWithResult(_0x33f9c9,_0x336223){_0x336223=_0x336223||0xc8;return function(_0x2c8007){if(_0x2c8007){return _0x33f9c9[_0xc8ea('0x28')](_0x336223)[_0xc8ea('0x29')](_0x2c8007);}};}function respondWithFilteredResult(_0x57a8d8,_0xffd732){return function(_0x5c29a8){if(_0x5c29a8){var _0x87abfb=_0x5c29a8['count'],_0x325c65=_0xffd732['offset'],_0x1286fc=_0xffd732[_0xc8ea('0x2a')]+_0xffd732[_0xc8ea('0x2b')],_0x1bc8ee;if(_0x1286fc>=_0x87abfb){_0x1286fc=_0x87abfb;_0x1bc8ee=0xc8;}else{_0x1bc8ee=0xce;}_0x57a8d8['status'](_0x1bc8ee);return _0x57a8d8[_0xc8ea('0x2c')](_0xc8ea('0x2d'),_0x325c65+'-'+_0x1286fc+'/'+_0x87abfb)[_0xc8ea('0x29')](_0x5c29a8);}return null;};}function patchUpdates(_0x5d07df){return function(_0xd6e1c9){try{jsonpatch['apply'](_0xd6e1c9,_0x5d07df,!![]);}catch(_0x37e207){return BPromise[_0xc8ea('0x2e')](_0x37e207);}return _0xd6e1c9[_0xc8ea('0x2f')]();};}function saveUpdates(_0x2ec119,_0x13ddea){return function(_0x85ac){if(_0x85ac){return _0x85ac['update'](_0x2ec119)[_0xc8ea('0x1e')](function(_0x3ff0e7){return _0x3ff0e7;});}return null;};}function removeEntity(_0x4d478c,_0x5de8a9){return function(_0x4f3786){if(_0x4f3786){return _0x4f3786[_0xc8ea('0x30')]()[_0xc8ea('0x1e')](function(){_0x4d478c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x20dbd3,_0x5d1fa5){return function(_0x53277c){if(!_0x53277c){_0x20dbd3[_0xc8ea('0x27')](0x194);}return _0x53277c;};}function handleError(_0x3a9be8,_0x2ad5ee){_0x2ad5ee=_0x2ad5ee||0x1f4;return function(_0x5e8b8b){logger['error'](_0x5e8b8b[_0xc8ea('0x31')]);if(_0x5e8b8b['name']){delete _0x5e8b8b[_0xc8ea('0x32')];}_0x3a9be8['status'](_0x2ad5ee)[_0xc8ea('0x33')](_0x5e8b8b);};}exports[_0xc8ea('0x34')]=function(_0x8e2a4e,_0x364e05){var _0x1ec332={},_0x5cb232={},_0x5cf332={'count':0x0,'rows':[]};var _0x1ddd36=_[_0xc8ea('0x35')](db[_0xc8ea('0x36')][_0xc8ea('0x37')],function(_0x3338e4){return{'name':_0x3338e4[_0xc8ea('0x38')],'type':_0x3338e4[_0xc8ea('0x39')][_0xc8ea('0x3a')]};});_0x5cb232['model']=_[_0xc8ea('0x35')](_0x1ddd36,_0xc8ea('0x32'));_0x5cb232[_0xc8ea('0x3b')]=_[_0xc8ea('0x3c')](_0x8e2a4e['query']);_0x5cb232['filters']=_[_0xc8ea('0x3d')](_0x5cb232[_0xc8ea('0x3e')],_0x5cb232[_0xc8ea('0x3b')]);_0x1ec332['attributes']=_['intersection'](_0x5cb232[_0xc8ea('0x3e')],qs[_0xc8ea('0x3f')](_0x8e2a4e[_0xc8ea('0x3b')][_0xc8ea('0x3f')]));_0x1ec332[_0xc8ea('0x40')]=_0x1ec332[_0xc8ea('0x40')][_0xc8ea('0x41')]?_0x1ec332[_0xc8ea('0x40')]:_0x5cb232['model'];if(!_0x8e2a4e[_0xc8ea('0x3b')][_0xc8ea('0x42')](_0xc8ea('0x43'))){_0x1ec332[_0xc8ea('0x2b')]=qs[_0xc8ea('0x2b')](_0x8e2a4e[_0xc8ea('0x3b')][_0xc8ea('0x2b')]);_0x1ec332[_0xc8ea('0x2a')]=qs[_0xc8ea('0x2a')](_0x8e2a4e[_0xc8ea('0x3b')][_0xc8ea('0x2a')]);}_0x1ec332[_0xc8ea('0x44')]=qs['sort'](_0x8e2a4e[_0xc8ea('0x3b')][_0xc8ea('0x45')]);_0x1ec332[_0xc8ea('0x46')]=qs[_0xc8ea('0x47')](_[_0xc8ea('0x48')](_0x8e2a4e[_0xc8ea('0x3b')],_0x5cb232[_0xc8ea('0x47')]),_0x1ddd36);if(_0x8e2a4e[_0xc8ea('0x3b')][_0xc8ea('0x49')]){_0x1ec332['where']=_[_0xc8ea('0x4a')](_0x1ec332[_0xc8ea('0x46')],{'$or':_['map'](_0x1ddd36,function(_0x179ee9){if(_0x179ee9[_0xc8ea('0x39')]!==_0xc8ea('0x4b')){var _0x444b23={};_0x444b23[_0x179ee9['name']]={'$like':'%'+_0x8e2a4e[_0xc8ea('0x3b')][_0xc8ea('0x49')]+'%'};return _0x444b23;}})});}_0x1ec332=_[_0xc8ea('0x4a')]({},_0x1ec332,_0x8e2a4e['options']);var _0x5986f9={'where':_0x1ec332[_0xc8ea('0x46')]};return db[_0xc8ea('0x36')][_0xc8ea('0x4c')](_0x5986f9)[_0xc8ea('0x1e')](function(_0x541d69){_0x5cf332[_0xc8ea('0x4c')]=_0x541d69;if(_0x8e2a4e[_0xc8ea('0x3b')][_0xc8ea('0x4d')]){_0x1ec332[_0xc8ea('0x4e')]=[{'all':!![]}];}return db[_0xc8ea('0x36')][_0xc8ea('0x4f')](_0x1ec332);})['then'](function(_0x372ded){_0x5cf332['rows']=_0x372ded;return _0x5cf332;})[_0xc8ea('0x1e')](respondWithFilteredResult(_0x364e05,_0x1ec332))[_0xc8ea('0x26')](handleError(_0x364e05,null));};exports[_0xc8ea('0x50')]=function(_0x516c18,_0x4aeaad){var _0x3d90c9={'raw':![],'where':{'id':_0x516c18['params']['id']}},_0x53f2d0={};_0x53f2d0['model']=_[_0xc8ea('0x3c')](db[_0xc8ea('0x36')]['rawAttributes']);_0x53f2d0[_0xc8ea('0x3b')]=_['keys'](_0x516c18['query']);_0x53f2d0[_0xc8ea('0x47')]=_['intersection'](_0x53f2d0[_0xc8ea('0x3e')],_0x53f2d0[_0xc8ea('0x3b')]);_0x3d90c9[_0xc8ea('0x40')]=_[_0xc8ea('0x3d')](_0x53f2d0[_0xc8ea('0x3e')],qs['fields'](_0x516c18['query'][_0xc8ea('0x3f')]));_0x3d90c9[_0xc8ea('0x40')]=_0x3d90c9[_0xc8ea('0x40')][_0xc8ea('0x41')]?_0x3d90c9[_0xc8ea('0x40')]:_0x53f2d0[_0xc8ea('0x3e')];if(_0x516c18[_0xc8ea('0x3b')][_0xc8ea('0x4d')]){_0x3d90c9['include']=[{'all':!![]}];}_0x3d90c9=_[_0xc8ea('0x4a')]({},_0x3d90c9,_0x516c18[_0xc8ea('0x51')]);return db[_0xc8ea('0x36')]['find'](_0x3d90c9)[_0xc8ea('0x1e')](handleEntityNotFound(_0x4aeaad,null))[_0xc8ea('0x1e')](respondWithResult(_0x4aeaad,null))[_0xc8ea('0x26')](handleError(_0x4aeaad,null));};exports['create']=function(_0x21470b,_0x4d046b){return db['FreshdeskConfiguration'][_0xc8ea('0x52')](_0x21470b[_0xc8ea('0x53')],{})[_0xc8ea('0x1e')](respondWithResult(_0x4d046b,0xc9))[_0xc8ea('0x26')](handleError(_0x4d046b,null));};exports['update']=function(_0x190312,_0x3688ce){if(_0x190312[_0xc8ea('0x53')]['id']){delete _0x190312['body']['id'];}return db[_0xc8ea('0x36')]['find']({'where':{'id':_0x190312[_0xc8ea('0x54')]['id']}})[_0xc8ea('0x1e')](handleEntityNotFound(_0x3688ce,null))[_0xc8ea('0x1e')](saveUpdates(_0x190312[_0xc8ea('0x53')],null))['then'](respondWithResult(_0x3688ce,null))['catch'](handleError(_0x3688ce,null));};exports[_0xc8ea('0x30')]=function(_0x169705,_0x39177f){return db[_0xc8ea('0x36')][_0xc8ea('0x55')]({'where':{'id':_0x169705[_0xc8ea('0x54')]['id']}})[_0xc8ea('0x1e')](handleEntityNotFound(_0x39177f,null))[_0xc8ea('0x1e')](removeEntity(_0x39177f,null))['catch'](handleError(_0x39177f,null));};exports[_0xc8ea('0x56')]=function(_0xc82804,_0x3fc393,_0x4c2cd3){var _0x4962ba={};var _0x242396={};var _0x13a9d8;var _0x2eba1d;return db[_0xc8ea('0x36')]['findOne']({'where':{'id':_0xc82804[_0xc8ea('0x54')]['id']}})['then'](handleEntityNotFound(_0x3fc393,null))[_0xc8ea('0x1e')](function(_0x45625c){if(_0x45625c){_0x13a9d8=_0x45625c;_0x242396[_0xc8ea('0x3e')]=_[_0xc8ea('0x3c')](db['FreshdeskField'][_0xc8ea('0x37')]);_0x242396[_0xc8ea('0x3b')]=_['keys'](_0xc82804['query']);_0x242396[_0xc8ea('0x47')]=_[_0xc8ea('0x3d')](_0x242396['model'],_0x242396['query']);_0x4962ba['attributes']=_['intersection'](_0x242396[_0xc8ea('0x3e')],qs[_0xc8ea('0x3f')](_0xc82804[_0xc8ea('0x3b')][_0xc8ea('0x3f')]));_0x4962ba[_0xc8ea('0x40')]=_0x4962ba[_0xc8ea('0x40')][_0xc8ea('0x41')]?_0x4962ba[_0xc8ea('0x40')]:_0x242396['model'];_0x4962ba['order']=qs[_0xc8ea('0x45')](_0xc82804[_0xc8ea('0x3b')][_0xc8ea('0x45')]);_0x4962ba['where']=qs[_0xc8ea('0x47')](_[_0xc8ea('0x48')](_0xc82804['query'],_0x242396[_0xc8ea('0x47')]));if(_0xc82804[_0xc8ea('0x3b')][_0xc8ea('0x49')]){_0x4962ba['where']=_['merge'](_0x4962ba[_0xc8ea('0x46')],{'$or':_['map'](_0x4962ba['attributes'],function(_0x2ea392){var _0x2c04ac={};_0x2c04ac[_0x2ea392]={'$like':'%'+_0xc82804['query'][_0xc8ea('0x49')]+'%'};return _0x2c04ac;})});}_0x4962ba=_[_0xc8ea('0x4a')]({},_0x4962ba,_0xc82804[_0xc8ea('0x51')]);return _0x13a9d8[_0xc8ea('0x56')](_0x4962ba);}})['then'](function(_0x5aea5c){if(_0x5aea5c){_0x2eba1d=_0x5aea5c[_0xc8ea('0x41')];if(!_0xc82804['query'][_0xc8ea('0x42')](_0xc8ea('0x43'))){_0x4962ba['limit']=qs[_0xc8ea('0x2b')](_0xc82804[_0xc8ea('0x3b')][_0xc8ea('0x2b')]);_0x4962ba[_0xc8ea('0x2a')]=qs[_0xc8ea('0x2a')](_0xc82804[_0xc8ea('0x3b')][_0xc8ea('0x2a')]);}return _0x13a9d8[_0xc8ea('0x56')](_0x4962ba);}})[_0xc8ea('0x1e')](function(_0x13cf54){if(_0x13cf54){return _0x13cf54?{'count':_0x2eba1d,'rows':_0x13cf54}:null;}})[_0xc8ea('0x1e')](respondWithResult(_0x3fc393,null))[_0xc8ea('0x26')](handleError(_0x3fc393,null));};exports[_0xc8ea('0x57')]=function(_0x499e5a,_0x33cef2,_0x1aeb4f){var _0x5c054e={};var _0x42f287={};var _0x2cd6f2;var _0x6fe49d;return db[_0xc8ea('0x36')][_0xc8ea('0x58')]({'where':{'id':_0x499e5a[_0xc8ea('0x54')]['id']}})[_0xc8ea('0x1e')](handleEntityNotFound(_0x33cef2,null))[_0xc8ea('0x1e')](function(_0xfe0e91){if(_0xfe0e91){_0x2cd6f2=_0xfe0e91;_0x42f287[_0xc8ea('0x3e')]=_[_0xc8ea('0x3c')](db[_0xc8ea('0x59')][_0xc8ea('0x37')]);_0x42f287[_0xc8ea('0x3b')]=_[_0xc8ea('0x3c')](_0x499e5a[_0xc8ea('0x3b')]);_0x42f287[_0xc8ea('0x47')]=_[_0xc8ea('0x3d')](_0x42f287['model'],_0x42f287[_0xc8ea('0x3b')]);_0x5c054e['attributes']=_[_0xc8ea('0x3d')](_0x42f287['model'],qs['fields'](_0x499e5a['query'][_0xc8ea('0x3f')]));_0x5c054e[_0xc8ea('0x40')]=_0x5c054e['attributes'][_0xc8ea('0x41')]?_0x5c054e[_0xc8ea('0x40')]:_0x42f287[_0xc8ea('0x3e')];_0x5c054e[_0xc8ea('0x44')]=qs[_0xc8ea('0x45')](_0x499e5a[_0xc8ea('0x3b')][_0xc8ea('0x45')]);_0x5c054e['where']=qs[_0xc8ea('0x47')](_[_0xc8ea('0x48')](_0x499e5a[_0xc8ea('0x3b')],_0x42f287[_0xc8ea('0x47')]));if(_0x499e5a[_0xc8ea('0x3b')][_0xc8ea('0x49')]){_0x5c054e[_0xc8ea('0x46')]=_[_0xc8ea('0x4a')](_0x5c054e[_0xc8ea('0x46')],{'$or':_[_0xc8ea('0x35')](_0x5c054e[_0xc8ea('0x40')],function(_0x422b08){var _0x11cff9={};_0x11cff9[_0x422b08]={'$like':'%'+_0x499e5a[_0xc8ea('0x3b')]['filter']+'%'};return _0x11cff9;})});}_0x5c054e=_['merge']({},_0x5c054e,_0x499e5a[_0xc8ea('0x51')]);return _0x2cd6f2[_0xc8ea('0x57')](_0x5c054e);}})[_0xc8ea('0x1e')](function(_0x2b01ea){if(_0x2b01ea){_0x6fe49d=_0x2b01ea[_0xc8ea('0x41')];if(!_0x499e5a[_0xc8ea('0x3b')][_0xc8ea('0x42')]('nolimit')){_0x5c054e['limit']=qs['limit'](_0x499e5a['query'][_0xc8ea('0x2b')]);_0x5c054e[_0xc8ea('0x2a')]=qs[_0xc8ea('0x2a')](_0x499e5a[_0xc8ea('0x3b')][_0xc8ea('0x2a')]);}return _0x2cd6f2[_0xc8ea('0x57')](_0x5c054e);}})[_0xc8ea('0x1e')](function(_0x45c71b){if(_0x45c71b){return _0x45c71b?{'count':_0x6fe49d,'rows':_0x45c71b}:null;}})['then'](respondWithResult(_0x33cef2,null))['catch'](handleError(_0x33cef2,null));};exports[_0xc8ea('0x5a')]=function(_0xabe424,_0x34b4f7,_0x5583e5){var _0x340596={};var _0xd4dce9={};var _0x46f4fb;var _0x78d119;return db[_0xc8ea('0x36')][_0xc8ea('0x58')]({'where':{'id':_0xabe424[_0xc8ea('0x54')]['id']}})[_0xc8ea('0x1e')](handleEntityNotFound(_0x34b4f7,null))[_0xc8ea('0x1e')](function(_0x2bbed8){if(_0x2bbed8){_0x46f4fb=_0x2bbed8;_0xd4dce9[_0xc8ea('0x3e')]=_['keys'](db['FreshdeskField'][_0xc8ea('0x37')]);_0xd4dce9['query']=_['keys'](_0xabe424[_0xc8ea('0x3b')]);_0xd4dce9[_0xc8ea('0x47')]=_[_0xc8ea('0x3d')](_0xd4dce9[_0xc8ea('0x3e')],_0xd4dce9[_0xc8ea('0x3b')]);_0x340596[_0xc8ea('0x40')]=_[_0xc8ea('0x3d')](_0xd4dce9[_0xc8ea('0x3e')],qs[_0xc8ea('0x3f')](_0xabe424[_0xc8ea('0x3b')][_0xc8ea('0x3f')]));_0x340596[_0xc8ea('0x40')]=_0x340596[_0xc8ea('0x40')][_0xc8ea('0x41')]?_0x340596['attributes']:_0xd4dce9[_0xc8ea('0x3e')];_0x340596['order']=qs[_0xc8ea('0x45')](_0xabe424[_0xc8ea('0x3b')]['sort']);_0x340596['where']=qs[_0xc8ea('0x47')](_['pick'](_0xabe424[_0xc8ea('0x3b')],_0xd4dce9['filters']));if(_0xabe424[_0xc8ea('0x3b')][_0xc8ea('0x49')]){_0x340596[_0xc8ea('0x46')]=_[_0xc8ea('0x4a')](_0x340596[_0xc8ea('0x46')],{'$or':_[_0xc8ea('0x35')](_0x340596[_0xc8ea('0x40')],function(_0x5841a5){var _0x282878={};_0x282878[_0x5841a5]={'$like':'%'+_0xabe424[_0xc8ea('0x3b')][_0xc8ea('0x49')]+'%'};return _0x282878;})});}_0x340596=_['merge']({},_0x340596,_0xabe424[_0xc8ea('0x51')]);return _0x46f4fb[_0xc8ea('0x5a')](_0x340596);}})[_0xc8ea('0x1e')](function(_0x1f69d4){if(_0x1f69d4){_0x78d119=_0x1f69d4[_0xc8ea('0x41')];if(!_0xabe424[_0xc8ea('0x3b')][_0xc8ea('0x42')](_0xc8ea('0x43'))){_0x340596[_0xc8ea('0x2b')]=qs[_0xc8ea('0x2b')](_0xabe424[_0xc8ea('0x3b')][_0xc8ea('0x2b')]);_0x340596['offset']=qs['offset'](_0xabe424[_0xc8ea('0x3b')][_0xc8ea('0x2a')]);}return _0x46f4fb[_0xc8ea('0x5a')](_0x340596);}})['then'](function(_0x4ef462){if(_0x4ef462){return _0x4ef462?{'count':_0x78d119,'rows':_0x4ef462}:null;}})['then'](respondWithResult(_0x34b4f7,null))['catch'](handleError(_0x34b4f7,null));};exports['getTags']=function(_0x4771f2,_0x2d5673,_0x3e06eb){var _0x2510dc={};var _0x3b6e18={};var _0x15c0f9;var _0x61771e;return db['FreshdeskConfiguration'][_0xc8ea('0x58')]({'where':{'id':_0x4771f2[_0xc8ea('0x54')]['id']}})[_0xc8ea('0x1e')](handleEntityNotFound(_0x2d5673,null))['then'](function(_0x5c80f0){if(_0x5c80f0){_0x15c0f9=_0x5c80f0;_0x3b6e18[_0xc8ea('0x3e')]=_[_0xc8ea('0x3c')](db[_0xc8ea('0x5b')][_0xc8ea('0x37')]);_0x3b6e18[_0xc8ea('0x3b')]=_[_0xc8ea('0x3c')](_0x4771f2[_0xc8ea('0x3b')]);_0x3b6e18[_0xc8ea('0x47')]=_['intersection'](_0x3b6e18[_0xc8ea('0x3e')],_0x3b6e18[_0xc8ea('0x3b')]);_0x2510dc['attributes']=_[_0xc8ea('0x3d')](_0x3b6e18['model'],qs['fields'](_0x4771f2[_0xc8ea('0x3b')][_0xc8ea('0x3f')]));_0x2510dc[_0xc8ea('0x40')]=_0x2510dc['attributes']['length']?_0x2510dc['attributes']:_0x3b6e18[_0xc8ea('0x3e')];_0x2510dc[_0xc8ea('0x44')]=qs[_0xc8ea('0x45')](_0x4771f2[_0xc8ea('0x3b')][_0xc8ea('0x45')]);_0x2510dc[_0xc8ea('0x46')]=qs[_0xc8ea('0x47')](_[_0xc8ea('0x48')](_0x4771f2[_0xc8ea('0x3b')],_0x3b6e18['filters']));if(_0x4771f2['query'][_0xc8ea('0x49')]){_0x2510dc[_0xc8ea('0x46')]=_[_0xc8ea('0x4a')](_0x2510dc[_0xc8ea('0x46')],{'$or':_[_0xc8ea('0x35')](_0x2510dc[_0xc8ea('0x40')],function(_0x1a267c){var _0x52543e={};_0x52543e[_0x1a267c]={'$like':'%'+_0x4771f2[_0xc8ea('0x3b')][_0xc8ea('0x49')]+'%'};return _0x52543e;})});}_0x2510dc=_[_0xc8ea('0x4a')]({},_0x2510dc,_0x4771f2[_0xc8ea('0x51')]);return _0x15c0f9[_0xc8ea('0x5c')](_0x2510dc);}})[_0xc8ea('0x1e')](function(_0x256b78){if(_0x256b78){_0x61771e=_0x256b78[_0xc8ea('0x41')];if(!_0x4771f2[_0xc8ea('0x3b')][_0xc8ea('0x42')]('nolimit')){_0x2510dc['limit']=qs['limit'](_0x4771f2['query'][_0xc8ea('0x2b')]);_0x2510dc[_0xc8ea('0x2a')]=qs[_0xc8ea('0x2a')](_0x4771f2[_0xc8ea('0x3b')][_0xc8ea('0x2a')]);}return _0x15c0f9['getTags'](_0x2510dc);}})[_0xc8ea('0x1e')](function(_0x15de6a){if(_0x15de6a){return _0x15de6a?{'count':_0x61771e,'rows':_0x15de6a}:null;}})[_0xc8ea('0x1e')](respondWithResult(_0x2d5673,null))['catch'](handleError(_0x2d5673,null));};exports['setTags']=function(_0x26c520,_0x5c0d88,_0x9b1d33){if(_0x26c520['body']['id']){delete _0x26c520[_0xc8ea('0x53')]['id'];}return db[_0xc8ea('0x36')]['findOne']({'where':{'id':_0x26c520['params']['id']}})['then'](handleEntityNotFound(_0x5c0d88,null))[_0xc8ea('0x1e')](function(_0x463051){if(_0x463051){return _0x463051[_0xc8ea('0x5d')](_0x26c520[_0xc8ea('0x53')][_0xc8ea('0x5e')]||[]);}return null;})[_0xc8ea('0x1e')](respondWithResult(_0x5c0d88,null))[_0xc8ea('0x26')](handleError(_0x5c0d88,null));}; \ No newline at end of file +var _0x38df=['reject','save','destroy','name','send','map','FreshdeskConfiguration','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','params','find','create','body','getFields','findOne','FreshdeskField','hasOwnProperty','getSubjects','pick','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','jayson/promise','client','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x38df,0x144));var _0xf38d=function(_0x4e441e,_0x48f13e){_0x4e441e=_0x4e441e-0x0;var _0x2add8e=_0x38df[_0x4e441e];return _0x2add8e;};'use strict';var pdf=require(_0xf38d('0x0'));var emlformat=require(_0xf38d('0x1'));var rimraf=require(_0xf38d('0x2'));var zipdir=require(_0xf38d('0x3'));var jsonpatch=require(_0xf38d('0x4'));var rp=require(_0xf38d('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf38d('0x6'));var util=require(_0xf38d('0x7'));var path=require(_0xf38d('0x8'));var sox=require('sox');var csv=require(_0xf38d('0x9'));var ejs=require(_0xf38d('0xa'));var fs=require('fs');var _=require(_0xf38d('0xb'));var squel=require(_0xf38d('0xc'));var crypto=require(_0xf38d('0xd'));var jsforce=require(_0xf38d('0xe'));var deskjs=require(_0xf38d('0xf'));var toCsv=require(_0xf38d('0x9'));var querystring=require(_0xf38d('0x10'));var Papa=require(_0xf38d('0x11'));var Redis=require(_0xf38d('0x12'));var authService=require(_0xf38d('0x13'));var qs=require(_0xf38d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf38d('0x15'));var logger=require(_0xf38d('0x16'))(_0xf38d('0x17'));var utils=require(_0xf38d('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0xf38d('0x19'));var client=jayson[_0xf38d('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x1676e4,_0x433e6e,_0x361bf6){if(_0x361bf6){var _0x524a3e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x524a3e[_0xf38d('0x1b')](_0x433e6e)){return _0x1676e4;}else{throw new db['Sequelize']['ValidationError'](_0xf38d('0x1c'));}}else{return _0x1676e4;}}function respondWithRpcPromise(_0x210367,_0x2768fa,_0x25fc1a,_0x22385b){return new BPromise(function(_0xb42d76,_0x52dffb){var _0xef11a2=_0x22385b||client;return _0xef11a2[_0xf38d('0x1d')](_0x210367,_0x25fc1a)[_0xf38d('0x1e')](function(_0x43da45){logger[_0xf38d('0x1f')](_0xf38d('0x20'),_0x2768fa,_0xf38d('0x21'));logger[_0xf38d('0x22')](_0xf38d('0x23'),_0x2768fa,_0xf38d('0x21'),JSON[_0xf38d('0x24')](_0x43da45));if(_0x43da45[_0xf38d('0x25')]){if(_0x43da45[_0xf38d('0x25')][_0xf38d('0x26')]===0x1f4){logger['error'](_0xf38d('0x20'),_0x2768fa,_0x43da45[_0xf38d('0x25')][_0xf38d('0x27')]);return _0x52dffb(_0x43da45[_0xf38d('0x25')][_0xf38d('0x27')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x2768fa,_0x43da45[_0xf38d('0x25')]['message']);return _0xb42d76(_0x43da45[_0xf38d('0x25')][_0xf38d('0x27')]);}else{logger[_0xf38d('0x1f')](_0xf38d('0x20'),_0x2768fa,_0xf38d('0x21'));_0xb42d76(_0x43da45[_0xf38d('0x28')][_0xf38d('0x27')]);}})[_0xf38d('0x29')](function(_0x23c4f5){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x2768fa,_0x23c4f5);_0x52dffb(_0x23c4f5);});});}function respondWithStatusCode(_0x352d69,_0x427d11){_0x427d11=_0x427d11||0xcc;return function(_0x872ee7){if(_0x872ee7){return _0x352d69[_0xf38d('0x2a')](_0x427d11);}return _0x352d69[_0xf38d('0x2b')](_0x427d11)[_0xf38d('0x2c')]();};}function respondWithResult(_0x4620a4,_0x312ce0){_0x312ce0=_0x312ce0||0xc8;return function(_0x220cbf){if(_0x220cbf){return _0x4620a4['status'](_0x312ce0)[_0xf38d('0x2d')](_0x220cbf);}};}function respondWithFilteredResult(_0x2eb126,_0xab53ae){return function(_0x52e9f5){if(_0x52e9f5){var _0x32c032=_0x52e9f5[_0xf38d('0x2e')],_0x5732bb=_0xab53ae[_0xf38d('0x2f')],_0x2bd260=_0xab53ae['offset']+_0xab53ae[_0xf38d('0x30')],_0x3972a1;if(_0x2bd260>=_0x32c032){_0x2bd260=_0x32c032;_0x3972a1=0xc8;}else{_0x3972a1=0xce;}_0x2eb126[_0xf38d('0x2b')](_0x3972a1);return _0x2eb126[_0xf38d('0x31')](_0xf38d('0x32'),_0x5732bb+'-'+_0x2bd260+'/'+_0x32c032)[_0xf38d('0x2d')](_0x52e9f5);}return null;};}function patchUpdates(_0x42167d){return function(_0xe14e68){try{jsonpatch[_0xf38d('0x33')](_0xe14e68,_0x42167d,!![]);}catch(_0x339af5){return BPromise[_0xf38d('0x34')](_0x339af5);}return _0xe14e68[_0xf38d('0x35')]();};}function saveUpdates(_0x34fa07,_0x38349c){return function(_0x25dd45){if(_0x25dd45){return _0x25dd45['update'](_0x34fa07)[_0xf38d('0x1e')](function(_0x4ecb99){return _0x4ecb99;});}return null;};}function removeEntity(_0x348448,_0x1d95d){return function(_0x47613c){if(_0x47613c){return _0x47613c[_0xf38d('0x36')]()[_0xf38d('0x1e')](function(){_0x348448[_0xf38d('0x2b')](0xcc)[_0xf38d('0x2c')]();});}};}function handleEntityNotFound(_0x2e07e4,_0x9cbc12){return function(_0x5497fc){if(!_0x5497fc){_0x2e07e4[_0xf38d('0x2a')](0x194);}return _0x5497fc;};}function handleError(_0x18dc83,_0x44e5ac){_0x44e5ac=_0x44e5ac||0x1f4;return function(_0x39eed5){logger[_0xf38d('0x25')](_0x39eed5['stack']);if(_0x39eed5[_0xf38d('0x37')]){delete _0x39eed5[_0xf38d('0x37')];}_0x18dc83[_0xf38d('0x2b')](_0x44e5ac)[_0xf38d('0x38')](_0x39eed5);};}exports['index']=function(_0x11ffeb,_0x205c03){var _0x1849b7={},_0x5d6358={},_0x8cf7e1={'count':0x0,'rows':[]};var _0x9cfed9=_[_0xf38d('0x39')](db[_0xf38d('0x3a')][_0xf38d('0x3b')],function(_0x32e3c3){return{'name':_0x32e3c3['fieldName'],'type':_0x32e3c3[_0xf38d('0x3c')]['key']};});_0x5d6358[_0xf38d('0x3d')]=_[_0xf38d('0x39')](_0x9cfed9,_0xf38d('0x37'));_0x5d6358[_0xf38d('0x3e')]=_[_0xf38d('0x3f')](_0x11ffeb[_0xf38d('0x3e')]);_0x5d6358[_0xf38d('0x40')]=_['intersection'](_0x5d6358[_0xf38d('0x3d')],_0x5d6358[_0xf38d('0x3e')]);_0x1849b7['attributes']=_[_0xf38d('0x41')](_0x5d6358[_0xf38d('0x3d')],qs[_0xf38d('0x42')](_0x11ffeb[_0xf38d('0x3e')]['fields']));_0x1849b7[_0xf38d('0x43')]=_0x1849b7[_0xf38d('0x43')][_0xf38d('0x44')]?_0x1849b7['attributes']:_0x5d6358[_0xf38d('0x3d')];if(!_0x11ffeb['query']['hasOwnProperty'](_0xf38d('0x45'))){_0x1849b7[_0xf38d('0x30')]=qs[_0xf38d('0x30')](_0x11ffeb[_0xf38d('0x3e')][_0xf38d('0x30')]);_0x1849b7[_0xf38d('0x2f')]=qs[_0xf38d('0x2f')](_0x11ffeb[_0xf38d('0x3e')][_0xf38d('0x2f')]);}_0x1849b7[_0xf38d('0x46')]=qs[_0xf38d('0x47')](_0x11ffeb[_0xf38d('0x3e')][_0xf38d('0x47')]);_0x1849b7[_0xf38d('0x48')]=qs[_0xf38d('0x40')](_['pick'](_0x11ffeb['query'],_0x5d6358[_0xf38d('0x40')]),_0x9cfed9);if(_0x11ffeb[_0xf38d('0x3e')]['filter']){_0x1849b7[_0xf38d('0x48')]=_[_0xf38d('0x49')](_0x1849b7[_0xf38d('0x48')],{'$or':_['map'](_0x9cfed9,function(_0x41b6ef){if(_0x41b6ef[_0xf38d('0x3c')]!==_0xf38d('0x4a')){var _0x7d5d1b={};_0x7d5d1b[_0x41b6ef['name']]={'$like':'%'+_0x11ffeb[_0xf38d('0x3e')][_0xf38d('0x4b')]+'%'};return _0x7d5d1b;}})});}_0x1849b7=_[_0xf38d('0x49')]({},_0x1849b7,_0x11ffeb[_0xf38d('0x4c')]);var _0x58413f={'where':_0x1849b7[_0xf38d('0x48')]};return db[_0xf38d('0x3a')][_0xf38d('0x2e')](_0x58413f)[_0xf38d('0x1e')](function(_0x310e6f){_0x8cf7e1[_0xf38d('0x2e')]=_0x310e6f;if(_0x11ffeb[_0xf38d('0x3e')][_0xf38d('0x4d')]){_0x1849b7['include']=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xf38d('0x4e')](_0x1849b7);})[_0xf38d('0x1e')](function(_0x23c815){_0x8cf7e1[_0xf38d('0x4f')]=_0x23c815;return _0x8cf7e1;})[_0xf38d('0x1e')](respondWithFilteredResult(_0x205c03,_0x1849b7))[_0xf38d('0x29')](handleError(_0x205c03,null));};exports['show']=function(_0x5cb951,_0x2672e4){var _0x5a4325={'raw':![],'where':{'id':_0x5cb951[_0xf38d('0x50')]['id']}},_0x58b4ad={};_0x58b4ad[_0xf38d('0x3d')]=_[_0xf38d('0x3f')](db['FreshdeskConfiguration'][_0xf38d('0x3b')]);_0x58b4ad[_0xf38d('0x3e')]=_[_0xf38d('0x3f')](_0x5cb951[_0xf38d('0x3e')]);_0x58b4ad[_0xf38d('0x40')]=_[_0xf38d('0x41')](_0x58b4ad[_0xf38d('0x3d')],_0x58b4ad[_0xf38d('0x3e')]);_0x5a4325['attributes']=_['intersection'](_0x58b4ad['model'],qs['fields'](_0x5cb951[_0xf38d('0x3e')][_0xf38d('0x42')]));_0x5a4325[_0xf38d('0x43')]=_0x5a4325[_0xf38d('0x43')][_0xf38d('0x44')]?_0x5a4325['attributes']:_0x58b4ad[_0xf38d('0x3d')];if(_0x5cb951[_0xf38d('0x3e')][_0xf38d('0x4d')]){_0x5a4325['include']=[{'all':!![]}];}_0x5a4325=_[_0xf38d('0x49')]({},_0x5a4325,_0x5cb951['options']);return db[_0xf38d('0x3a')][_0xf38d('0x51')](_0x5a4325)[_0xf38d('0x1e')](handleEntityNotFound(_0x2672e4,null))[_0xf38d('0x1e')](respondWithResult(_0x2672e4,null))[_0xf38d('0x29')](handleError(_0x2672e4,null));};exports[_0xf38d('0x52')]=function(_0x1033b6,_0x14209b){return db[_0xf38d('0x3a')][_0xf38d('0x52')](_0x1033b6[_0xf38d('0x53')],{})['then'](respondWithResult(_0x14209b,0xc9))[_0xf38d('0x29')](handleError(_0x14209b,null));};exports['update']=function(_0x23bc78,_0x56b028){if(_0x23bc78[_0xf38d('0x53')]['id']){delete _0x23bc78[_0xf38d('0x53')]['id'];}return db[_0xf38d('0x3a')][_0xf38d('0x51')]({'where':{'id':_0x23bc78[_0xf38d('0x50')]['id']}})[_0xf38d('0x1e')](handleEntityNotFound(_0x56b028,null))[_0xf38d('0x1e')](saveUpdates(_0x23bc78[_0xf38d('0x53')],null))[_0xf38d('0x1e')](respondWithResult(_0x56b028,null))['catch'](handleError(_0x56b028,null));};exports[_0xf38d('0x36')]=function(_0x6257a,_0x5a85fd){return db[_0xf38d('0x3a')][_0xf38d('0x51')]({'where':{'id':_0x6257a['params']['id']}})[_0xf38d('0x1e')](handleEntityNotFound(_0x5a85fd,null))[_0xf38d('0x1e')](removeEntity(_0x5a85fd,null))[_0xf38d('0x29')](handleError(_0x5a85fd,null));};exports[_0xf38d('0x54')]=function(_0x411992,_0x3e56db,_0x3b9195){var _0x1abef2={};var _0x435881={};var _0x2950de;var _0x627c44;return db[_0xf38d('0x3a')][_0xf38d('0x55')]({'where':{'id':_0x411992['params']['id']}})['then'](handleEntityNotFound(_0x3e56db,null))[_0xf38d('0x1e')](function(_0x2813f7){if(_0x2813f7){_0x2950de=_0x2813f7;_0x435881['model']=_['keys'](db[_0xf38d('0x56')][_0xf38d('0x3b')]);_0x435881[_0xf38d('0x3e')]=_[_0xf38d('0x3f')](_0x411992['query']);_0x435881[_0xf38d('0x40')]=_[_0xf38d('0x41')](_0x435881[_0xf38d('0x3d')],_0x435881[_0xf38d('0x3e')]);_0x1abef2[_0xf38d('0x43')]=_[_0xf38d('0x41')](_0x435881['model'],qs[_0xf38d('0x42')](_0x411992['query'][_0xf38d('0x42')]));_0x1abef2[_0xf38d('0x43')]=_0x1abef2[_0xf38d('0x43')][_0xf38d('0x44')]?_0x1abef2[_0xf38d('0x43')]:_0x435881[_0xf38d('0x3d')];_0x1abef2[_0xf38d('0x46')]=qs['sort'](_0x411992[_0xf38d('0x3e')][_0xf38d('0x47')]);_0x1abef2[_0xf38d('0x48')]=qs[_0xf38d('0x40')](_['pick'](_0x411992['query'],_0x435881[_0xf38d('0x40')]));if(_0x411992[_0xf38d('0x3e')][_0xf38d('0x4b')]){_0x1abef2[_0xf38d('0x48')]=_['merge'](_0x1abef2[_0xf38d('0x48')],{'$or':_[_0xf38d('0x39')](_0x1abef2[_0xf38d('0x43')],function(_0x2936da){var _0x6e4c9b={};_0x6e4c9b[_0x2936da]={'$like':'%'+_0x411992['query'][_0xf38d('0x4b')]+'%'};return _0x6e4c9b;})});}_0x1abef2=_[_0xf38d('0x49')]({},_0x1abef2,_0x411992[_0xf38d('0x4c')]);return _0x2950de[_0xf38d('0x54')](_0x1abef2);}})[_0xf38d('0x1e')](function(_0x5e1008){if(_0x5e1008){_0x627c44=_0x5e1008[_0xf38d('0x44')];if(!_0x411992[_0xf38d('0x3e')][_0xf38d('0x57')](_0xf38d('0x45'))){_0x1abef2['limit']=qs['limit'](_0x411992['query']['limit']);_0x1abef2['offset']=qs[_0xf38d('0x2f')](_0x411992[_0xf38d('0x3e')][_0xf38d('0x2f')]);}return _0x2950de[_0xf38d('0x54')](_0x1abef2);}})[_0xf38d('0x1e')](function(_0x34e557){if(_0x34e557){return _0x34e557?{'count':_0x627c44,'rows':_0x34e557}:null;}})[_0xf38d('0x1e')](respondWithResult(_0x3e56db,null))[_0xf38d('0x29')](handleError(_0x3e56db,null));};exports[_0xf38d('0x58')]=function(_0x550af8,_0x3d1571,_0x452c79){var _0x3152ba={};var _0x3263b9={};var _0x14f268;var _0x24688c;return db[_0xf38d('0x3a')][_0xf38d('0x55')]({'where':{'id':_0x550af8[_0xf38d('0x50')]['id']}})[_0xf38d('0x1e')](handleEntityNotFound(_0x3d1571,null))[_0xf38d('0x1e')](function(_0x5afef6){if(_0x5afef6){_0x14f268=_0x5afef6;_0x3263b9[_0xf38d('0x3d')]=_[_0xf38d('0x3f')](db[_0xf38d('0x56')][_0xf38d('0x3b')]);_0x3263b9[_0xf38d('0x3e')]=_['keys'](_0x550af8['query']);_0x3263b9['filters']=_[_0xf38d('0x41')](_0x3263b9[_0xf38d('0x3d')],_0x3263b9[_0xf38d('0x3e')]);_0x3152ba[_0xf38d('0x43')]=_[_0xf38d('0x41')](_0x3263b9[_0xf38d('0x3d')],qs[_0xf38d('0x42')](_0x550af8['query']['fields']));_0x3152ba[_0xf38d('0x43')]=_0x3152ba['attributes'][_0xf38d('0x44')]?_0x3152ba[_0xf38d('0x43')]:_0x3263b9['model'];_0x3152ba[_0xf38d('0x46')]=qs[_0xf38d('0x47')](_0x550af8[_0xf38d('0x3e')][_0xf38d('0x47')]);_0x3152ba[_0xf38d('0x48')]=qs[_0xf38d('0x40')](_[_0xf38d('0x59')](_0x550af8['query'],_0x3263b9[_0xf38d('0x40')]));if(_0x550af8[_0xf38d('0x3e')][_0xf38d('0x4b')]){_0x3152ba[_0xf38d('0x48')]=_[_0xf38d('0x49')](_0x3152ba[_0xf38d('0x48')],{'$or':_[_0xf38d('0x39')](_0x3152ba[_0xf38d('0x43')],function(_0x77a1d4){var _0x326458={};_0x326458[_0x77a1d4]={'$like':'%'+_0x550af8[_0xf38d('0x3e')][_0xf38d('0x4b')]+'%'};return _0x326458;})});}_0x3152ba=_[_0xf38d('0x49')]({},_0x3152ba,_0x550af8[_0xf38d('0x4c')]);return _0x14f268['getSubjects'](_0x3152ba);}})[_0xf38d('0x1e')](function(_0x2ec0c4){if(_0x2ec0c4){_0x24688c=_0x2ec0c4['length'];if(!_0x550af8[_0xf38d('0x3e')][_0xf38d('0x57')]('nolimit')){_0x3152ba['limit']=qs[_0xf38d('0x30')](_0x550af8[_0xf38d('0x3e')][_0xf38d('0x30')]);_0x3152ba[_0xf38d('0x2f')]=qs['offset'](_0x550af8['query']['offset']);}return _0x14f268[_0xf38d('0x58')](_0x3152ba);}})[_0xf38d('0x1e')](function(_0x2fda55){if(_0x2fda55){return _0x2fda55?{'count':_0x24688c,'rows':_0x2fda55}:null;}})['then'](respondWithResult(_0x3d1571,null))[_0xf38d('0x29')](handleError(_0x3d1571,null));};exports[_0xf38d('0x5a')]=function(_0x286925,_0x23e26c,_0x37de2e){var _0x171db4={};var _0x3b2d8b={};var _0x5290b8;var _0x1e36d4;return db[_0xf38d('0x3a')][_0xf38d('0x55')]({'where':{'id':_0x286925[_0xf38d('0x50')]['id']}})[_0xf38d('0x1e')](handleEntityNotFound(_0x23e26c,null))[_0xf38d('0x1e')](function(_0x7ebc7e){if(_0x7ebc7e){_0x5290b8=_0x7ebc7e;_0x3b2d8b[_0xf38d('0x3d')]=_[_0xf38d('0x3f')](db[_0xf38d('0x56')][_0xf38d('0x3b')]);_0x3b2d8b[_0xf38d('0x3e')]=_[_0xf38d('0x3f')](_0x286925[_0xf38d('0x3e')]);_0x3b2d8b[_0xf38d('0x40')]=_[_0xf38d('0x41')](_0x3b2d8b[_0xf38d('0x3d')],_0x3b2d8b['query']);_0x171db4[_0xf38d('0x43')]=_[_0xf38d('0x41')](_0x3b2d8b[_0xf38d('0x3d')],qs[_0xf38d('0x42')](_0x286925['query'][_0xf38d('0x42')]));_0x171db4['attributes']=_0x171db4[_0xf38d('0x43')]['length']?_0x171db4[_0xf38d('0x43')]:_0x3b2d8b[_0xf38d('0x3d')];_0x171db4[_0xf38d('0x46')]=qs[_0xf38d('0x47')](_0x286925['query'][_0xf38d('0x47')]);_0x171db4[_0xf38d('0x48')]=qs[_0xf38d('0x40')](_[_0xf38d('0x59')](_0x286925['query'],_0x3b2d8b[_0xf38d('0x40')]));if(_0x286925[_0xf38d('0x3e')][_0xf38d('0x4b')]){_0x171db4[_0xf38d('0x48')]=_[_0xf38d('0x49')](_0x171db4['where'],{'$or':_['map'](_0x171db4[_0xf38d('0x43')],function(_0x4cb261){var _0x560cf6={};_0x560cf6[_0x4cb261]={'$like':'%'+_0x286925[_0xf38d('0x3e')][_0xf38d('0x4b')]+'%'};return _0x560cf6;})});}_0x171db4=_[_0xf38d('0x49')]({},_0x171db4,_0x286925[_0xf38d('0x4c')]);return _0x5290b8[_0xf38d('0x5a')](_0x171db4);}})[_0xf38d('0x1e')](function(_0x83200){if(_0x83200){_0x1e36d4=_0x83200[_0xf38d('0x44')];if(!_0x286925[_0xf38d('0x3e')][_0xf38d('0x57')](_0xf38d('0x45'))){_0x171db4[_0xf38d('0x30')]=qs[_0xf38d('0x30')](_0x286925['query'][_0xf38d('0x30')]);_0x171db4['offset']=qs[_0xf38d('0x2f')](_0x286925[_0xf38d('0x3e')][_0xf38d('0x2f')]);}return _0x5290b8[_0xf38d('0x5a')](_0x171db4);}})[_0xf38d('0x1e')](function(_0xd53c6a){if(_0xd53c6a){return _0xd53c6a?{'count':_0x1e36d4,'rows':_0xd53c6a}:null;}})[_0xf38d('0x1e')](respondWithResult(_0x23e26c,null))[_0xf38d('0x29')](handleError(_0x23e26c,null));};exports[_0xf38d('0x5b')]=function(_0x4419b7,_0x53d522,_0x4c0b6a){var _0x3211f5={};var _0x82794a={};var _0x3ea506;var _0x3afc7d;return db[_0xf38d('0x3a')][_0xf38d('0x55')]({'where':{'id':_0x4419b7[_0xf38d('0x50')]['id']}})['then'](handleEntityNotFound(_0x53d522,null))[_0xf38d('0x1e')](function(_0xdcf6c9){if(_0xdcf6c9){_0x3ea506=_0xdcf6c9;_0x82794a['model']=_[_0xf38d('0x3f')](db['Tag']['rawAttributes']);_0x82794a['query']=_[_0xf38d('0x3f')](_0x4419b7['query']);_0x82794a[_0xf38d('0x40')]=_['intersection'](_0x82794a[_0xf38d('0x3d')],_0x82794a['query']);_0x3211f5[_0xf38d('0x43')]=_[_0xf38d('0x41')](_0x82794a[_0xf38d('0x3d')],qs['fields'](_0x4419b7['query'][_0xf38d('0x42')]));_0x3211f5[_0xf38d('0x43')]=_0x3211f5['attributes'][_0xf38d('0x44')]?_0x3211f5[_0xf38d('0x43')]:_0x82794a[_0xf38d('0x3d')];_0x3211f5[_0xf38d('0x46')]=qs[_0xf38d('0x47')](_0x4419b7['query']['sort']);_0x3211f5[_0xf38d('0x48')]=qs['filters'](_[_0xf38d('0x59')](_0x4419b7[_0xf38d('0x3e')],_0x82794a[_0xf38d('0x40')]));if(_0x4419b7['query'][_0xf38d('0x4b')]){_0x3211f5[_0xf38d('0x48')]=_[_0xf38d('0x49')](_0x3211f5[_0xf38d('0x48')],{'$or':_['map'](_0x3211f5[_0xf38d('0x43')],function(_0x5e75e7){var _0x28ddaf={};_0x28ddaf[_0x5e75e7]={'$like':'%'+_0x4419b7[_0xf38d('0x3e')][_0xf38d('0x4b')]+'%'};return _0x28ddaf;})});}_0x3211f5=_[_0xf38d('0x49')]({},_0x3211f5,_0x4419b7[_0xf38d('0x4c')]);return _0x3ea506[_0xf38d('0x5b')](_0x3211f5);}})[_0xf38d('0x1e')](function(_0xb368af){if(_0xb368af){_0x3afc7d=_0xb368af[_0xf38d('0x44')];if(!_0x4419b7['query'][_0xf38d('0x57')]('nolimit')){_0x3211f5[_0xf38d('0x30')]=qs['limit'](_0x4419b7[_0xf38d('0x3e')][_0xf38d('0x30')]);_0x3211f5['offset']=qs[_0xf38d('0x2f')](_0x4419b7[_0xf38d('0x3e')][_0xf38d('0x2f')]);}return _0x3ea506['getTags'](_0x3211f5);}})[_0xf38d('0x1e')](function(_0x1c2efb){if(_0x1c2efb){return _0x1c2efb?{'count':_0x3afc7d,'rows':_0x1c2efb}:null;}})[_0xf38d('0x1e')](respondWithResult(_0x53d522,null))[_0xf38d('0x29')](handleError(_0x53d522,null));};exports['setTags']=function(_0x363551,_0x1fcdbc,_0xea7869){if(_0x363551[_0xf38d('0x53')]['id']){delete _0x363551[_0xf38d('0x53')]['id'];}return db[_0xf38d('0x3a')][_0xf38d('0x55')]({'where':{'id':_0x363551[_0xf38d('0x50')]['id']}})[_0xf38d('0x1e')](handleEntityNotFound(_0x1fcdbc,null))[_0xf38d('0x1e')](function(_0x53e4db){if(_0x53e4db){return _0x53e4db[_0xf38d('0x5c')](_0x363551[_0xf38d('0x53')][_0xf38d('0x5d')]||[]);}return null;})['then'](respondWithResult(_0x1fcdbc,null))['catch'](handleError(_0x1fcdbc,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index e834ecc..21dcbae 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 _0x814b=['define','FreshdeskConfiguration','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports'];(function(_0x3cd619,_0x157f2d){var _0x3844da=function(_0x59bfe5){while(--_0x59bfe5){_0x3cd619['push'](_0x3cd619['shift']());}};_0x3844da(++_0x157f2d);}(_0x814b,0x1a2));var _0xb814=function(_0xb02766,_0xa37d90){_0xb02766=_0xb02766-0x0;var _0x560e6c=_0x814b[_0xb02766];return _0x560e6c;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x24679e,_0x22d9d7){var _0x291f21=function(_0x329529){while(--_0x329529){_0x24679e['push'](_0x24679e['shift']());}};_0x291f21(++_0x22d9d7);}(_0x7217,0x19e));var _0x7721=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7217[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('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 619f2a8..6daf984 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 _0xb773=['bluebird','../../config/utils','../../config/logger','rpc','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x503325,_0x24a407){var _0x452fff=function(_0x42bf26){while(--_0x42bf26){_0x503325['push'](_0x503325['shift']());}};_0x452fff(++_0x24a407);}(_0xb773,0xcf));var _0x3b77=function(_0x3074f3,_0x4f2c03){_0x3074f3=_0x3074f3-0x0;var _0x53f112=_0xb773[_0x3074f3];return _0x53f112;};'use strict';var _=require(_0x3b77('0x0'));var util=require(_0x3b77('0x1'));var moment=require(_0x3b77('0x2'));var BPromise=require(_0x3b77('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3b77('0x4'));var logger=require(_0x3b77('0x5'))(_0x3b77('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3b77('0x7')][_0x3b77('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b6ef0,_0x51ac42,_0x24c324){return new BPromise(function(_0x9003ee,_0x3c94be){return client[_0x3b77('0x9')](_0x5b6ef0,_0x24c324)[_0x3b77('0xa')](function(_0x2ea3fc){logger[_0x3b77('0xb')](_0x3b77('0xc'),_0x51ac42,_0x3b77('0xd'));logger[_0x3b77('0xe')](_0x3b77('0xf'),_0x51ac42,_0x3b77('0xd'),JSON[_0x3b77('0x10')](_0x2ea3fc));if(_0x2ea3fc[_0x3b77('0x11')]){if(_0x2ea3fc[_0x3b77('0x11')]['code']===0x1f4){logger[_0x3b77('0x11')](_0x3b77('0xc'),_0x51ac42,_0x2ea3fc[_0x3b77('0x11')]['message']);return _0x3c94be(_0x2ea3fc[_0x3b77('0x11')][_0x3b77('0x12')]);}logger[_0x3b77('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x51ac42,_0x2ea3fc[_0x3b77('0x11')]['message']);return _0x9003ee(_0x2ea3fc['error']['message']);}else{logger[_0x3b77('0xb')](_0x3b77('0xc'),_0x51ac42,_0x3b77('0xd'));_0x9003ee(_0x2ea3fc[_0x3b77('0x13')]['message']);}})[_0x3b77('0x14')](function(_0x5cab58){logger[_0x3b77('0x11')](_0x3b77('0xc'),_0x51ac42,_0x5cab58);_0x3c94be(_0x5cab58);});});} \ No newline at end of file +var _0x90fd=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x90fd,0x177));var _0xd90f=function(_0x14e880,_0x256879){_0x14e880=_0x14e880-0x0;var _0x3f9f31=_0x90fd[_0x14e880];return _0x3f9f31;};'use strict';var _=require(_0xd90f('0x0'));var util=require(_0xd90f('0x1'));var moment=require(_0xd90f('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(_0xd90f('0x3'));var logger=require(_0xd90f('0x4'))(_0xd90f('0x5'));var config=require(_0xd90f('0x6'));var jayson=require(_0xd90f('0x7'));var client=jayson[_0xd90f('0x8')][_0xd90f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2eba5b,_0x283f7f,_0x1886c2){return new BPromise(function(_0x20b556,_0x1d6ae4){return client[_0xd90f('0xa')](_0x2eba5b,_0x1886c2)[_0xd90f('0xb')](function(_0x40f90d){logger[_0xd90f('0xc')](_0xd90f('0xd'),_0x283f7f,'request\x20sent');logger[_0xd90f('0xe')](_0xd90f('0xf'),_0x283f7f,_0xd90f('0x10'),JSON[_0xd90f('0x11')](_0x40f90d));if(_0x40f90d[_0xd90f('0x12')]){if(_0x40f90d[_0xd90f('0x12')][_0xd90f('0x13')]===0x1f4){logger[_0xd90f('0x12')](_0xd90f('0xd'),_0x283f7f,_0x40f90d[_0xd90f('0x12')][_0xd90f('0x14')]);return _0x1d6ae4(_0x40f90d[_0xd90f('0x12')]['message']);}logger[_0xd90f('0x12')](_0xd90f('0xd'),_0x283f7f,_0x40f90d[_0xd90f('0x12')][_0xd90f('0x14')]);return _0x20b556(_0x40f90d[_0xd90f('0x12')][_0xd90f('0x14')]);}else{logger[_0xd90f('0xc')](_0xd90f('0xd'),_0x283f7f,_0xd90f('0x10'));_0x20b556(_0x40f90d[_0xd90f('0x15')][_0xd90f('0x14')]);}})[_0xd90f('0x16')](function(_0x17dcb4){logger[_0xd90f('0x12')](_0xd90f('0xd'),_0x283f7f,_0x17dcb4);_0x1d6ae4(_0x17dcb4);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 9f6a1b9..a5f8c7b 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 _0x70e0=['create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','post','isAuthenticated'];(function(_0x2c3f37,_0x5a46b6){var _0x12a453=function(_0x506351){while(--_0x506351){_0x2c3f37['push'](_0x2c3f37['shift']());}};_0x12a453(++_0x5a46b6);}(_0x70e0,0x17b));var _0x070e=function(_0x135d99,_0x1405ff){_0x135d99=_0x135d99-0x0;var _0x3922d3=_0x70e0[_0x135d99];return _0x3922d3;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./intFreshdeskField.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0xa')]('/',auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')](_0x070e('0xe'),auth[_0x070e('0xb')](),controller['update']);router['delete'](_0x070e('0xe'),auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);module[_0x070e('0x10')]=router; \ No newline at end of file +var _0x9c44=['/:id','isAuthenticated','show','create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x39c65b,_0x4b5a02){var _0x487fee=function(_0x5d3a6b){while(--_0x5d3a6b){_0x39c65b['push'](_0x39c65b['shift']());}};_0x487fee(++_0x4b5a02);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['post']('/',auth[_0x49c4('0x9')](),controller[_0x49c4('0xb')]);router[_0x49c4('0xc')](_0x49c4('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x49c4('0xd')](_0x49c4('0x8'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index e6183db..620cb90 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 _0x383a=['string','STRING','variable','exports','ENUM','customVariable'];(function(_0x3648ae,_0x5e4ab7){var _0x1f14d9=function(_0x2181fe){while(--_0x2181fe){_0x3648ae['push'](_0x3648ae['shift']());}};_0x1f14d9(++_0x5e4ab7);}(_0x383a,0x1ad));var _0xa383=function(_0x55d893,_0x325ebe){_0x55d893=_0x55d893-0x0;var _0x52d152=_0x383a[_0x55d893];return _0x52d152;};'use strict';var Sequelize=require('sequelize');module[_0xa383('0x0')]={'type':{'type':Sequelize[_0xa383('0x1')]('string','variable',_0xa383('0x2'),'keyValue'),'defaultValue':_0xa383('0x3')},'content':{'type':Sequelize[_0xa383('0x4')]},'key':{'type':Sequelize[_0xa383('0x4')]},'keyType':{'type':Sequelize['ENUM']('string',_0xa383('0x5'),_0xa383('0x2'))},'keyContent':{'type':Sequelize[_0xa383('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcf75=['string','keyValue','STRING','customVariable','BOOLEAN','exports','ENUM'];(function(_0x443316,_0x286c90){var _0x187fed=function(_0x235740){while(--_0x235740){_0x443316['push'](_0x443316['shift']());}};_0x187fed(++_0x286c90);}(_0xcf75,0x83));var _0x5cf7=function(_0x3a6112,_0x563ffa){_0x3a6112=_0x3a6112-0x0;var _0x19784a=_0xcf75[_0x3a6112];return _0x19784a;};'use strict';var Sequelize=require('sequelize');module[_0x5cf7('0x0')]={'type':{'type':Sequelize[_0x5cf7('0x1')](_0x5cf7('0x2'),'variable','customVariable',_0x5cf7('0x3')),'defaultValue':_0x5cf7('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5cf7('0x4')]},'keyType':{'type':Sequelize[_0x5cf7('0x1')](_0x5cf7('0x2'),'variable',_0x5cf7('0x5'))},'keyContent':{'type':Sequelize[_0x5cf7('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5cf7('0x4')]},'customField':{'type':Sequelize[_0x5cf7('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5cf7('0x4')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 95a4c7a..718ae27 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 _0x798f=['../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','apply','reject','save','update','then','error','stack','name','send','index','FreshdeskField','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','fields','attributes','length','model','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','catch','params','includeAll','find','create','body','destroy','html-pdf','rimraf','zip-dir','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','api'];(function(_0x241811,_0x35ca5f){var _0x1d1e76=function(_0x5c024e){while(--_0x5c024e){_0x241811['push'](_0x241811['shift']());}};_0x1d1e76(++_0x35ca5f);}(_0x798f,0x1cb));var _0xf798=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x798f[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xf798('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf798('0x1'));var zipdir=require(_0xf798('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf798('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf798('0x4'));var util=require('util');var path=require(_0xf798('0x5'));var sox=require(_0xf798('0x6'));var csv=require(_0xf798('0x7'));var ejs=require(_0xf798('0x8'));var fs=require('fs');var _=require(_0xf798('0x9'));var squel=require(_0xf798('0xa'));var crypto=require(_0xf798('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf798('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf798('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xf798('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf798('0xf'));var logger=require('../../config/logger')(_0xf798('0x10'));var utils=require('../../config/utils');var config=require(_0xf798('0x11'));var db=require(_0xf798('0x12'))['db'];function respondWithStatusCode(_0x37be79,_0x476fe1){_0x476fe1=_0x476fe1||0xcc;return function(_0x58f67d){if(_0x58f67d){return _0x37be79[_0xf798('0x13')](_0x476fe1);}return _0x37be79['status'](_0x476fe1)[_0xf798('0x14')]();};}function respondWithResult(_0x570b14,_0x3e82a1){_0x3e82a1=_0x3e82a1||0xc8;return function(_0x267c8d){if(_0x267c8d){return _0x570b14[_0xf798('0x15')](_0x3e82a1)[_0xf798('0x16')](_0x267c8d);}};}function respondWithFilteredResult(_0x18985d,_0x16a2a0){return function(_0x510a13){if(_0x510a13){var _0x789309=_0x510a13[_0xf798('0x17')],_0x1f9a9d=_0x16a2a0[_0xf798('0x18')],_0x13c4de=_0x16a2a0['offset']+_0x16a2a0['limit'],_0x415561;if(_0x13c4de>=_0x789309){_0x13c4de=_0x789309;_0x415561=0xc8;}else{_0x415561=0xce;}_0x18985d[_0xf798('0x15')](_0x415561);return _0x18985d['set']('Content-Range',_0x1f9a9d+'-'+_0x13c4de+'/'+_0x789309)[_0xf798('0x16')](_0x510a13);}return null;};}function patchUpdates(_0x53fb13){return function(_0x194f6b){try{jsonpatch[_0xf798('0x19')](_0x194f6b,_0x53fb13,!![]);}catch(_0x189e5b){return BPromise[_0xf798('0x1a')](_0x189e5b);}return _0x194f6b[_0xf798('0x1b')]();};}function saveUpdates(_0x3780f4,_0x178f2b){return function(_0x5aef94){if(_0x5aef94){return _0x5aef94[_0xf798('0x1c')](_0x3780f4)[_0xf798('0x1d')](function(_0x577a70){return _0x577a70;});}return null;};}function removeEntity(_0x23dcc7,_0x533bbc){return function(_0x46fa1c){if(_0x46fa1c){return _0x46fa1c['destroy']()['then'](function(){_0x23dcc7['status'](0xcc)[_0xf798('0x14')]();});}};}function handleEntityNotFound(_0x3fe350,_0x139e1e){return function(_0x2879c8){if(!_0x2879c8){_0x3fe350[_0xf798('0x13')](0x194);}return _0x2879c8;};}function handleError(_0x476e97,_0x122565){_0x122565=_0x122565||0x1f4;return function(_0xd609e){logger[_0xf798('0x1e')](_0xd609e[_0xf798('0x1f')]);if(_0xd609e['name']){delete _0xd609e[_0xf798('0x20')];}_0x476e97[_0xf798('0x15')](_0x122565)[_0xf798('0x21')](_0xd609e);};}exports[_0xf798('0x22')]=function(_0x2afa22,_0x23f561){var _0x4ba8fb={},_0x232bdd={},_0x4f8248={'count':0x0,'rows':[]};var _0x3cd61a=_['map'](db[_0xf798('0x23')][_0xf798('0x24')],function(_0x453edd){return{'name':_0x453edd[_0xf798('0x25')],'type':_0x453edd[_0xf798('0x26')][_0xf798('0x27')]};});_0x232bdd['model']=_[_0xf798('0x28')](_0x3cd61a,_0xf798('0x20'));_0x232bdd[_0xf798('0x29')]=_[_0xf798('0x2a')](_0x2afa22['query']);_0x232bdd[_0xf798('0x2b')]=_[_0xf798('0x2c')](_0x232bdd['model'],_0x232bdd['query']);_0x4ba8fb['attributes']=_[_0xf798('0x2c')](_0x232bdd['model'],qs[_0xf798('0x2d')](_0x2afa22[_0xf798('0x29')][_0xf798('0x2d')]));_0x4ba8fb['attributes']=_0x4ba8fb[_0xf798('0x2e')][_0xf798('0x2f')]?_0x4ba8fb['attributes']:_0x232bdd[_0xf798('0x30')];if(!_0x2afa22[_0xf798('0x29')]['hasOwnProperty'](_0xf798('0x31'))){_0x4ba8fb['limit']=qs[_0xf798('0x32')](_0x2afa22[_0xf798('0x29')]['limit']);_0x4ba8fb[_0xf798('0x18')]=qs[_0xf798('0x18')](_0x2afa22[_0xf798('0x29')][_0xf798('0x18')]);}_0x4ba8fb[_0xf798('0x33')]=qs[_0xf798('0x34')](_0x2afa22[_0xf798('0x29')][_0xf798('0x34')]);_0x4ba8fb[_0xf798('0x35')]=qs[_0xf798('0x2b')](_['pick'](_0x2afa22['query'],_0x232bdd[_0xf798('0x2b')]),_0x3cd61a);if(_0x2afa22['query'][_0xf798('0x36')]){_0x4ba8fb['where']=_['merge'](_0x4ba8fb[_0xf798('0x35')],{'$or':_[_0xf798('0x28')](_0x3cd61a,function(_0x1011c1){if(_0x1011c1[_0xf798('0x26')]!==_0xf798('0x37')){var _0x3a2fc8={};_0x3a2fc8[_0x1011c1[_0xf798('0x20')]]={'$like':'%'+_0x2afa22[_0xf798('0x29')][_0xf798('0x36')]+'%'};return _0x3a2fc8;}})});}_0x4ba8fb=_[_0xf798('0x38')]({},_0x4ba8fb,_0x2afa22[_0xf798('0x39')]);var _0x352f3f={'where':_0x4ba8fb[_0xf798('0x35')]};return db[_0xf798('0x23')]['count'](_0x352f3f)[_0xf798('0x1d')](function(_0x86e835){_0x4f8248[_0xf798('0x17')]=_0x86e835;if(_0x2afa22[_0xf798('0x29')]['includeAll']){_0x4ba8fb[_0xf798('0x3a')]=[{'all':!![]}];}return db[_0xf798('0x23')][_0xf798('0x3b')](_0x4ba8fb);})['then'](function(_0x367b95){_0x4f8248[_0xf798('0x3c')]=_0x367b95;return _0x4f8248;})[_0xf798('0x1d')](respondWithFilteredResult(_0x23f561,_0x4ba8fb))[_0xf798('0x3d')](handleError(_0x23f561,null));};exports['show']=function(_0xe96bbd,_0x17cf12){var _0x32196a={'raw':!![],'where':{'id':_0xe96bbd[_0xf798('0x3e')]['id']}},_0xdb642={};_0xdb642[_0xf798('0x30')]=_[_0xf798('0x2a')](db[_0xf798('0x23')]['rawAttributes']);_0xdb642[_0xf798('0x29')]=_['keys'](_0xe96bbd[_0xf798('0x29')]);_0xdb642[_0xf798('0x2b')]=_[_0xf798('0x2c')](_0xdb642[_0xf798('0x30')],_0xdb642[_0xf798('0x29')]);_0x32196a[_0xf798('0x2e')]=_[_0xf798('0x2c')](_0xdb642[_0xf798('0x30')],qs[_0xf798('0x2d')](_0xe96bbd[_0xf798('0x29')][_0xf798('0x2d')]));_0x32196a[_0xf798('0x2e')]=_0x32196a['attributes'][_0xf798('0x2f')]?_0x32196a['attributes']:_0xdb642[_0xf798('0x30')];if(_0xe96bbd['query'][_0xf798('0x3f')]){_0x32196a[_0xf798('0x3a')]=[{'all':!![]}];}_0x32196a=_[_0xf798('0x38')]({},_0x32196a,_0xe96bbd[_0xf798('0x39')]);return db[_0xf798('0x23')][_0xf798('0x40')](_0x32196a)[_0xf798('0x1d')](handleEntityNotFound(_0x17cf12,null))[_0xf798('0x1d')](respondWithResult(_0x17cf12,null))['catch'](handleError(_0x17cf12,null));};exports['create']=function(_0x5e6de1,_0x3ae0ef){return db['FreshdeskField'][_0xf798('0x41')](_0x5e6de1[_0xf798('0x42')],{})[_0xf798('0x1d')](respondWithResult(_0x3ae0ef,0xc9))['catch'](handleError(_0x3ae0ef,null));};exports[_0xf798('0x1c')]=function(_0x3a5b97,_0x31c38b){if(_0x3a5b97[_0xf798('0x42')]['id']){delete _0x3a5b97['body']['id'];}return db[_0xf798('0x23')]['find']({'where':{'id':_0x3a5b97[_0xf798('0x3e')]['id']}})[_0xf798('0x1d')](handleEntityNotFound(_0x31c38b,null))[_0xf798('0x1d')](saveUpdates(_0x3a5b97[_0xf798('0x42')],null))['then'](respondWithResult(_0x31c38b,null))[_0xf798('0x3d')](handleError(_0x31c38b,null));};exports[_0xf798('0x43')]=function(_0x3c1df5,_0x565d39){return db[_0xf798('0x23')][_0xf798('0x40')]({'where':{'id':_0x3c1df5['params']['id']}})[_0xf798('0x1d')](handleEntityNotFound(_0x565d39,null))[_0xf798('0x1d')](removeEntity(_0x565d39,null))[_0xf798('0x3d')](handleError(_0x565d39,null));}; \ No newline at end of file +var _0x1c15=['moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','apply','reject','update','then','destroy','end','sendStatus','error','stack','send','FreshdeskField','rawAttributes','type','model','map','name','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x103132,_0x51ff08){var _0x4cb681=function(_0x54be8a){while(--_0x54be8a){_0x103132['push'](_0x103132['shift']());}};_0x4cb681(++_0x51ff08);}(_0x1c15,0xde));var _0x51c1=function(_0x319373,_0x4540ce){_0x319373=_0x319373-0x0;var _0x58555f=_0x1c15[_0x319373];return _0x58555f;};'use strict';var pdf=require(_0x51c1('0x0'));var emlformat=require(_0x51c1('0x1'));var rimraf=require(_0x51c1('0x2'));var zipdir=require(_0x51c1('0x3'));var jsonpatch=require(_0x51c1('0x4'));var rp=require(_0x51c1('0x5'));var moment=require(_0x51c1('0x6'));var BPromise=require(_0x51c1('0x7'));var Mustache=require(_0x51c1('0x8'));var util=require(_0x51c1('0x9'));var path=require(_0x51c1('0xa'));var sox=require(_0x51c1('0xb'));var csv=require('to-csv');var ejs=require(_0x51c1('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x51c1('0xd'));var crypto=require(_0x51c1('0xe'));var jsforce=require(_0x51c1('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x51c1('0x10'));var querystring=require(_0x51c1('0x11'));var Papa=require(_0x51c1('0x12'));var Redis=require(_0x51c1('0x13'));var authService=require(_0x51c1('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x51c1('0x15'));var hardwareService=require(_0x51c1('0x16'));var logger=require(_0x51c1('0x17'))(_0x51c1('0x18'));var utils=require(_0x51c1('0x19'));var config=require(_0x51c1('0x1a'));var db=require(_0x51c1('0x1b'))['db'];function respondWithStatusCode(_0x2a2359,_0xef68de){_0xef68de=_0xef68de||0xcc;return function(_0x4ab4fa){if(_0x4ab4fa){return _0x2a2359['sendStatus'](_0xef68de);}return _0x2a2359['status'](_0xef68de)['end']();};}function respondWithResult(_0x37f3d4,_0x363e3e){_0x363e3e=_0x363e3e||0xc8;return function(_0xb59ebf){if(_0xb59ebf){return _0x37f3d4[_0x51c1('0x1c')](_0x363e3e)[_0x51c1('0x1d')](_0xb59ebf);}};}function respondWithFilteredResult(_0x339179,_0x4a63f6){return function(_0x59760b){if(_0x59760b){var _0x2c7141=_0x59760b[_0x51c1('0x1e')],_0xb4ec1d=_0x4a63f6[_0x51c1('0x1f')],_0x5b52eb=_0x4a63f6[_0x51c1('0x1f')]+_0x4a63f6[_0x51c1('0x20')],_0x54aa7;if(_0x5b52eb>=_0x2c7141){_0x5b52eb=_0x2c7141;_0x54aa7=0xc8;}else{_0x54aa7=0xce;}_0x339179[_0x51c1('0x1c')](_0x54aa7);return _0x339179[_0x51c1('0x21')]('Content-Range',_0xb4ec1d+'-'+_0x5b52eb+'/'+_0x2c7141)[_0x51c1('0x1d')](_0x59760b);}return null;};}function patchUpdates(_0x46fb38){return function(_0x1fdbfc){try{jsonpatch[_0x51c1('0x22')](_0x1fdbfc,_0x46fb38,!![]);}catch(_0x294dc1){return BPromise[_0x51c1('0x23')](_0x294dc1);}return _0x1fdbfc['save']();};}function saveUpdates(_0x575bf8,_0x374f28){return function(_0x5a6f23){if(_0x5a6f23){return _0x5a6f23[_0x51c1('0x24')](_0x575bf8)[_0x51c1('0x25')](function(_0x105a06){return _0x105a06;});}return null;};}function removeEntity(_0x4f31cc,_0x2e41b3){return function(_0x57a9a3){if(_0x57a9a3){return _0x57a9a3[_0x51c1('0x26')]()[_0x51c1('0x25')](function(){_0x4f31cc[_0x51c1('0x1c')](0xcc)[_0x51c1('0x27')]();});}};}function handleEntityNotFound(_0x2ca794,_0x216993){return function(_0x3e97ee){if(!_0x3e97ee){_0x2ca794[_0x51c1('0x28')](0x194);}return _0x3e97ee;};}function handleError(_0x3e5e04,_0xb3ccad){_0xb3ccad=_0xb3ccad||0x1f4;return function(_0x15c6a6){logger[_0x51c1('0x29')](_0x15c6a6[_0x51c1('0x2a')]);if(_0x15c6a6['name']){delete _0x15c6a6['name'];}_0x3e5e04['status'](_0xb3ccad)[_0x51c1('0x2b')](_0x15c6a6);};}exports['index']=function(_0x495897,_0x33f49d){var _0x2a9faf={},_0xadc20a={},_0x256976={'count':0x0,'rows':[]};var _0x250e18=_['map'](db[_0x51c1('0x2c')][_0x51c1('0x2d')],function(_0x9e192){return{'name':_0x9e192['fieldName'],'type':_0x9e192[_0x51c1('0x2e')]['key']};});_0xadc20a[_0x51c1('0x2f')]=_[_0x51c1('0x30')](_0x250e18,_0x51c1('0x31'));_0xadc20a[_0x51c1('0x32')]=_[_0x51c1('0x33')](_0x495897['query']);_0xadc20a['filters']=_['intersection'](_0xadc20a[_0x51c1('0x2f')],_0xadc20a[_0x51c1('0x32')]);_0x2a9faf['attributes']=_[_0x51c1('0x34')](_0xadc20a['model'],qs['fields'](_0x495897[_0x51c1('0x32')][_0x51c1('0x35')]));_0x2a9faf[_0x51c1('0x36')]=_0x2a9faf[_0x51c1('0x36')]['length']?_0x2a9faf['attributes']:_0xadc20a[_0x51c1('0x2f')];if(!_0x495897[_0x51c1('0x32')][_0x51c1('0x37')](_0x51c1('0x38'))){_0x2a9faf['limit']=qs[_0x51c1('0x20')](_0x495897[_0x51c1('0x32')]['limit']);_0x2a9faf[_0x51c1('0x1f')]=qs[_0x51c1('0x1f')](_0x495897['query'][_0x51c1('0x1f')]);}_0x2a9faf[_0x51c1('0x39')]=qs[_0x51c1('0x3a')](_0x495897[_0x51c1('0x32')][_0x51c1('0x3a')]);_0x2a9faf[_0x51c1('0x3b')]=qs['filters'](_[_0x51c1('0x3c')](_0x495897[_0x51c1('0x32')],_0xadc20a[_0x51c1('0x3d')]),_0x250e18);if(_0x495897[_0x51c1('0x32')][_0x51c1('0x3e')]){_0x2a9faf[_0x51c1('0x3b')]=_[_0x51c1('0x3f')](_0x2a9faf['where'],{'$or':_[_0x51c1('0x30')](_0x250e18,function(_0x270c49){if(_0x270c49['type']!==_0x51c1('0x40')){var _0x952ce6={};_0x952ce6[_0x270c49[_0x51c1('0x31')]]={'$like':'%'+_0x495897['query']['filter']+'%'};return _0x952ce6;}})});}_0x2a9faf=_[_0x51c1('0x3f')]({},_0x2a9faf,_0x495897[_0x51c1('0x41')]);var _0x49bda6={'where':_0x2a9faf[_0x51c1('0x3b')]};return db[_0x51c1('0x2c')][_0x51c1('0x1e')](_0x49bda6)[_0x51c1('0x25')](function(_0x9b981d){_0x256976[_0x51c1('0x1e')]=_0x9b981d;if(_0x495897[_0x51c1('0x32')]['includeAll']){_0x2a9faf[_0x51c1('0x42')]=[{'all':!![]}];}return db[_0x51c1('0x2c')][_0x51c1('0x43')](_0x2a9faf);})[_0x51c1('0x25')](function(_0x2fcb25){_0x256976[_0x51c1('0x44')]=_0x2fcb25;return _0x256976;})[_0x51c1('0x25')](respondWithFilteredResult(_0x33f49d,_0x2a9faf))[_0x51c1('0x45')](handleError(_0x33f49d,null));};exports[_0x51c1('0x46')]=function(_0x365d72,_0x235ad1){var _0x1abbfb={'raw':!![],'where':{'id':_0x365d72[_0x51c1('0x47')]['id']}},_0x50a4fd={};_0x50a4fd[_0x51c1('0x2f')]=_['keys'](db[_0x51c1('0x2c')][_0x51c1('0x2d')]);_0x50a4fd[_0x51c1('0x32')]=_[_0x51c1('0x33')](_0x365d72[_0x51c1('0x32')]);_0x50a4fd['filters']=_[_0x51c1('0x34')](_0x50a4fd[_0x51c1('0x2f')],_0x50a4fd[_0x51c1('0x32')]);_0x1abbfb[_0x51c1('0x36')]=_[_0x51c1('0x34')](_0x50a4fd[_0x51c1('0x2f')],qs[_0x51c1('0x35')](_0x365d72[_0x51c1('0x32')][_0x51c1('0x35')]));_0x1abbfb[_0x51c1('0x36')]=_0x1abbfb[_0x51c1('0x36')][_0x51c1('0x48')]?_0x1abbfb[_0x51c1('0x36')]:_0x50a4fd[_0x51c1('0x2f')];if(_0x365d72[_0x51c1('0x32')]['includeAll']){_0x1abbfb['include']=[{'all':!![]}];}_0x1abbfb=_[_0x51c1('0x3f')]({},_0x1abbfb,_0x365d72[_0x51c1('0x41')]);return db[_0x51c1('0x2c')]['find'](_0x1abbfb)[_0x51c1('0x25')](handleEntityNotFound(_0x235ad1,null))[_0x51c1('0x25')](respondWithResult(_0x235ad1,null))[_0x51c1('0x45')](handleError(_0x235ad1,null));};exports[_0x51c1('0x49')]=function(_0x1e0552,_0x3e604c){return db[_0x51c1('0x2c')][_0x51c1('0x49')](_0x1e0552[_0x51c1('0x4a')],{})[_0x51c1('0x25')](respondWithResult(_0x3e604c,0xc9))[_0x51c1('0x45')](handleError(_0x3e604c,null));};exports[_0x51c1('0x24')]=function(_0x737d7d,_0x2db784){if(_0x737d7d['body']['id']){delete _0x737d7d[_0x51c1('0x4a')]['id'];}return db[_0x51c1('0x2c')]['find']({'where':{'id':_0x737d7d[_0x51c1('0x47')]['id']}})[_0x51c1('0x25')](handleEntityNotFound(_0x2db784,null))[_0x51c1('0x25')](saveUpdates(_0x737d7d['body'],null))[_0x51c1('0x25')](respondWithResult(_0x2db784,null))[_0x51c1('0x45')](handleError(_0x2db784,null));};exports[_0x51c1('0x26')]=function(_0x3b641b,_0x37b31d){return db['FreshdeskField'][_0x51c1('0x4b')]({'where':{'id':_0x3b641b[_0x51c1('0x47')]['id']}})['then'](handleEntityNotFound(_0x37b31d,null))[_0x51c1('0x25')](removeEntity(_0x37b31d,null))[_0x51c1('0x45')](handleError(_0x37b31d,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 96e8933..9b870a3 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 _0x77ad=['FieldId','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x14ec75,_0x56a3d4){var _0x40b9e9=function(_0x4d2f39){while(--_0x4d2f39){_0x14ec75['push'](_0x14ec75['shift']());}};_0x40b9e9(++_0x56a3d4);}(_0x77ad,0x16d));var _0xd77a=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x77ad[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0xd77a('0x0'));var util=require('util');var logger=require(_0xd77a('0x1'))(_0xd77a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd77a('0x3'));var fs=require('fs');var path=require(_0xd77a('0x4'));var rimraf=require(_0xd77a('0x5'));var config=require(_0xd77a('0x6'));var attributes=require(_0xd77a('0x7'));module[_0xd77a('0x8')]=function(_0x500587,_0x21bb05){return _0x500587[_0xd77a('0x9')](_0xd77a('0xa'),attributes,{'tableName':_0xd77a('0xb'),'paranoid':![],'indexes':[{'name':_0xd77a('0xc'),'fields':['idField',_0xd77a('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x18da=['int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define'];(function(_0x12a903,_0x367196){var _0x5776ed=function(_0x3a6744){while(--_0x3a6744){_0x12a903['push'](_0x12a903['shift']());}};_0x5776ed(++_0x367196);}(_0x18da,0xe4));var _0xa18d=function(_0x34ccc9,_0x2c3b78){_0x34ccc9=_0x34ccc9-0x0;var _0x578733=_0x18da[_0x34ccc9];return _0x578733;};'use strict';var _=require(_0xa18d('0x0'));var util=require(_0xa18d('0x1'));var logger=require(_0xa18d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa18d('0x3'));var fs=require('fs');var path=require(_0xa18d('0x4'));var rimraf=require(_0xa18d('0x5'));var config=require(_0xa18d('0x6'));var attributes=require(_0xa18d('0x7'));module[_0xa18d('0x8')]=function(_0x41b6df,_0x2a39f3){return _0x41b6df[_0xa18d('0x9')]('FreshdeskField',attributes,{'tableName':_0xa18d('0xa'),'paranoid':![],'indexes':[{'name':_0xa18d('0xb'),'fields':[_0xa18d('0xc'),_0xa18d('0xd')],'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 1a1d99a..4437b1a 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(_0x554b15,_0x3d4645){var _0x54641a=function(_0x554260){while(--_0x554260){_0x554b15['push'](_0x554b15['shift']());}};_0x54641a(++_0x3d4645);}(_0xb10b,0x12a));var _0xbb10=function(_0x3d7fb5,_0x16eb5c){_0x3d7fb5=_0x3d7fb5-0x0;var _0x3a9642=_0xb10b[_0x3d7fb5];return _0x3a9642;};'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 _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x105c9f,_0x4de958){_0x105c9f=_0x105c9f-0x0;var _0x4cc851=_0x7a54[_0x105c9f];return _0x4cc851;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index a2b453a..4e9413f 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 _0x5e54=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x591781,_0x8e0ed2){var _0x315bd9=function(_0x39166c){while(--_0x39166c){_0x591781['push'](_0x591781['shift']());}};_0x315bd9(++_0x8e0ed2);}(_0x5e54,0x196));var _0x45e5=function(_0x2edb9d,_0x675dee){_0x2edb9d=_0x2edb9d-0x0;var _0x4ad20c=_0x5e54[_0x2edb9d];return _0x4ad20c;};'use strict';var multer=require(_0x45e5('0x0'));var util=require(_0x45e5('0x1'));var path=require(_0x45e5('0x2'));var timeout=require(_0x45e5('0x3'));var express=require('express');var router=express[_0x45e5('0x4')]();var auth=require(_0x45e5('0x5'));var interaction=require(_0x45e5('0x6'));var config=require(_0x45e5('0x7'));var controller=require(_0x45e5('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x45e5('0x9')]('/:id',auth[_0x45e5('0xa')](),controller[_0x45e5('0xb')]);router[_0x45e5('0x9')](_0x45e5('0xc'),auth[_0x45e5('0xa')](),controller['getConfigurations']);router[_0x45e5('0x9')](_0x45e5('0xd'),auth[_0x45e5('0xa')](),controller[_0x45e5('0xe')]);router[_0x45e5('0xf')]('/',auth[_0x45e5('0xa')](),controller[_0x45e5('0x10')]);router['post'](_0x45e5('0xc'),auth[_0x45e5('0xa')](),controller[_0x45e5('0x11')]);router[_0x45e5('0x12')](_0x45e5('0x13'),auth[_0x45e5('0xa')](),controller[_0x45e5('0x14')]);router[_0x45e5('0x15')]('/:id',auth[_0x45e5('0xa')](),controller[_0x45e5('0x16')]);module[_0x45e5('0x17')]=router; \ No newline at end of file +var _0xf71b=['./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x48dfc7,_0x28410f){var _0x553cbf=function(_0x56f3f7){while(--_0x56f3f7){_0x48dfc7['push'](_0x48dfc7['shift']());}};_0x553cbf(++_0x28410f);}(_0xf71b,0x75));var _0xbf71=function(_0x3e9fde,_0x5a69b5){_0x3e9fde=_0x3e9fde-0x0;var _0x5d5007=_0xf71b[_0x3e9fde];return _0x5d5007;};'use strict';var multer=require(_0xbf71('0x0'));var util=require('util');var path=require(_0xbf71('0x1'));var timeout=require(_0xbf71('0x2'));var express=require(_0xbf71('0x3'));var router=express[_0xbf71('0x4')]();var auth=require(_0xbf71('0x5'));var interaction=require(_0xbf71('0x6'));var config=require(_0xbf71('0x7'));var controller=require(_0xbf71('0x8'));router[_0xbf71('0x9')]('/',auth[_0xbf71('0xa')](),controller[_0xbf71('0xb')]);router[_0xbf71('0x9')]('/:id',auth[_0xbf71('0xa')](),controller['show']);router[_0xbf71('0x9')](_0xbf71('0xc'),auth[_0xbf71('0xa')](),controller[_0xbf71('0xd')]);router[_0xbf71('0x9')](_0xbf71('0xe'),auth[_0xbf71('0xa')](),controller[_0xbf71('0xf')]);router[_0xbf71('0x10')]('/',auth[_0xbf71('0xa')](),controller[_0xbf71('0x11')]);router[_0xbf71('0x10')](_0xbf71('0xc'),auth[_0xbf71('0xa')](),controller[_0xbf71('0x12')]);router[_0xbf71('0x13')](_0xbf71('0x14'),auth[_0xbf71('0xa')](),controller[_0xbf71('0x15')]);router[_0xbf71('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xbf71('0x17')]);module[_0xbf71('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 38fcf14..9943426 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 _0xa809=['remoteUri','exports','STRING'];(function(_0x284e96,_0x4c2f3f){var _0x5bd863=function(_0x39d7bf){while(--_0x39d7bf){_0x284e96['push'](_0x284e96['shift']());}};_0x5bd863(++_0x4c2f3f);}(_0xa809,0x1f3));var _0x9a80=function(_0x2e05ed,_0x570f52){_0x2e05ed=_0x2e05ed-0x0;var _0x2e40a0=_0xa809[_0x2e05ed];return _0x2e40a0;};'use strict';var Sequelize=require('sequelize');module[_0x9a80('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9a80('0x1')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x9a80('0x2')},'serverUrl':{'type':Sequelize[_0x9a80('0x1')]}}; \ No newline at end of file +var _0xbc48=['STRING','username','remoteUri','sequelize','exports'];(function(_0x492ef3,_0x15808c){var _0x4910ce=function(_0x456c6e){while(--_0x456c6e){_0x492ef3['push'](_0x492ef3['shift']());}};_0x4910ce(++_0x15808c);}(_0xbc48,0x111));var _0x8bc4=function(_0x3b9400,_0x1261de){_0x3b9400=_0x3b9400-0x0;var _0x26ed18=_0xbc48[_0x3b9400];return _0x26ed18;};'use strict';var Sequelize=require(_0x8bc4('0x0'));module[_0x8bc4('0x1')]={'name':{'type':Sequelize[_0x8bc4('0x2')]},'description':{'type':Sequelize[_0x8bc4('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x8bc4('0x3')},'apiKey':{'type':Sequelize[_0x8bc4('0x2')]},'remoteUri':{'type':Sequelize[_0x8bc4('0x2')],'unique':_0x8bc4('0x4')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index e5b373b..ab9a1d2 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 _0xdfdf=['crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','name','send','index','map','FreshsalesAccount','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','pick','filter','merge','where','VIRTUAL','includeAll','show','params','keys','include','options','find','create','body','destroy','findOne','FreshsalesConfiguration','rawAttributes','order','getConfigurations','nolimit','addConfiguration','AccountId','channel','Descriptions','getDescriptions','Subjects','FreshsalesField','username','remoteUri','slice','substring','lastIndexOf','GET','format','/api/selector/owners','apiKey','users','Requested\x20Resource\x20not\x20Found','statusCode','getFields','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel'];(function(_0x3042d5,_0x349534){var _0x1acfef=function(_0x5a920f){while(--_0x5a920f){_0x3042d5['push'](_0x3042d5['shift']());}};_0x1acfef(++_0x349534);}(_0xdfdf,0xd4));var _0xfdfd=function(_0x1635d2,_0x51e33a){_0x1635d2=_0x1635d2-0x0;var _0x61d2a5=_0xdfdf[_0x1635d2];return _0x61d2a5;};'use strict';var pdf=require(_0xfdfd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfdfd('0x1'));var zipdir=require(_0xfdfd('0x2'));var jsonpatch=require(_0xfdfd('0x3'));var rp=require(_0xfdfd('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfdfd('0x5'));var util=require(_0xfdfd('0x6'));var path=require(_0xfdfd('0x7'));var sox=require(_0xfdfd('0x8'));var csv=require(_0xfdfd('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfdfd('0xa'));var squel=require(_0xfdfd('0xb'));var crypto=require(_0xfdfd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfdfd('0xd'));var toCsv=require(_0xfdfd('0x9'));var querystring=require(_0xfdfd('0xe'));var Papa=require(_0xfdfd('0xf'));var Redis=require('ioredis');var authService=require(_0xfdfd('0x10'));var qs=require(_0xfdfd('0x11'));var as=require(_0xfdfd('0x12'));var hardwareService=require(_0xfdfd('0x13'));var logger=require(_0xfdfd('0x14'))(_0xfdfd('0x15'));var utils=require(_0xfdfd('0x16'));var config=require('../../config/environment');var db=require(_0xfdfd('0x17'))['db'];var integrations=require(_0xfdfd('0x18'));var jayson=require(_0xfdfd('0x19'));var client=jayson[_0xfdfd('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x3f9f8e,_0x205315,_0x3ff767){if(_0x3ff767){var _0xd40d80=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xd40d80[_0xfdfd('0x1b')](_0x205315)){return _0x3f9f8e;}else{throw new db[(_0xfdfd('0x1c'))][(_0xfdfd('0x1d'))](_0xfdfd('0x1e'));}}else{return _0x3f9f8e;}}function respondWithRpcPromise(_0x2082fd,_0x8db1af,_0x56519c,_0x2d91f8){return new BPromise(function(_0x2c4a2d,_0x5d9a21){var _0x40aecf=_0x2d91f8||client;return _0x40aecf[_0xfdfd('0x1f')](_0x2082fd,_0x56519c)[_0xfdfd('0x20')](function(_0x30fb9b){logger[_0xfdfd('0x21')](_0xfdfd('0x22'),_0x8db1af,_0xfdfd('0x23'));logger[_0xfdfd('0x24')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x8db1af,'request\x20sent',JSON[_0xfdfd('0x25')](_0x30fb9b));if(_0x30fb9b[_0xfdfd('0x26')]){if(_0x30fb9b[_0xfdfd('0x26')][_0xfdfd('0x27')]===0x1f4){logger[_0xfdfd('0x26')]('FreshsalesAccount,\x20%s,\x20%s',_0x8db1af,_0x30fb9b['error'][_0xfdfd('0x28')]);return _0x5d9a21(_0x30fb9b[_0xfdfd('0x26')]['message']);}logger[_0xfdfd('0x26')]('FreshsalesAccount,\x20%s,\x20%s',_0x8db1af,_0x30fb9b[_0xfdfd('0x26')]['message']);return _0x2c4a2d(_0x30fb9b[_0xfdfd('0x26')]['message']);}else{logger[_0xfdfd('0x21')](_0xfdfd('0x22'),_0x8db1af,_0xfdfd('0x23'));_0x2c4a2d(_0x30fb9b[_0xfdfd('0x29')][_0xfdfd('0x28')]);}})[_0xfdfd('0x2a')](function(_0x342c59){logger['error'](_0xfdfd('0x22'),_0x8db1af,_0x342c59);_0x5d9a21(_0x342c59);});});}function respondWithStatusCode(_0x4282f1,_0x34970b){_0x34970b=_0x34970b||0xcc;return function(_0x2b4d51){if(_0x2b4d51){return _0x4282f1[_0xfdfd('0x2b')](_0x34970b);}return _0x4282f1[_0xfdfd('0x2c')](_0x34970b)[_0xfdfd('0x2d')]();};}function respondWithResult(_0x2ec8d8,_0x4629e0){_0x4629e0=_0x4629e0||0xc8;return function(_0x5417a1){if(_0x5417a1){return _0x2ec8d8['status'](_0x4629e0)[_0xfdfd('0x2e')](_0x5417a1);}};}function respondWithFilteredResult(_0x41ec8a,_0x29851c){return function(_0x2c350f){if(_0x2c350f){var _0x3312d1=_0x2c350f[_0xfdfd('0x2f')],_0x5ea0af=_0x29851c[_0xfdfd('0x30')],_0x58a5d6=_0x29851c[_0xfdfd('0x30')]+_0x29851c[_0xfdfd('0x31')],_0x401b27;if(_0x58a5d6>=_0x3312d1){_0x58a5d6=_0x3312d1;_0x401b27=0xc8;}else{_0x401b27=0xce;}_0x41ec8a[_0xfdfd('0x2c')](_0x401b27);return _0x41ec8a['set']('Content-Range',_0x5ea0af+'-'+_0x58a5d6+'/'+_0x3312d1)[_0xfdfd('0x2e')](_0x2c350f);}return null;};}function patchUpdates(_0x57e5e2){return function(_0x5fc2f4){try{jsonpatch[_0xfdfd('0x32')](_0x5fc2f4,_0x57e5e2,!![]);}catch(_0x1a7228){return BPromise[_0xfdfd('0x33')](_0x1a7228);}return _0x5fc2f4[_0xfdfd('0x34')]();};}function saveUpdates(_0x51db04,_0x298e4e){return function(_0x21ff05){if(_0x21ff05){return _0x21ff05[_0xfdfd('0x35')](_0x51db04)[_0xfdfd('0x20')](function(_0x426f8e){return _0x426f8e;});}return null;};}function removeEntity(_0x433b26,_0x132fb5){return function(_0x51c030){if(_0x51c030){return _0x51c030['destroy']()[_0xfdfd('0x20')](function(){_0x433b26[_0xfdfd('0x2c')](0xcc)[_0xfdfd('0x2d')]();});}};}function handleEntityNotFound(_0xc1c5d6,_0x88fd9e){return function(_0x17a91d){if(!_0x17a91d){_0xc1c5d6[_0xfdfd('0x2b')](0x194);}return _0x17a91d;};}function handleError(_0x1b658c,_0xec8a76){_0xec8a76=_0xec8a76||0x1f4;return function(_0x4fa458){logger[_0xfdfd('0x26')](_0x4fa458['stack']);if(_0x4fa458[_0xfdfd('0x36')]){delete _0x4fa458['name'];}_0x1b658c['status'](_0xec8a76)[_0xfdfd('0x37')](_0x4fa458);};}exports[_0xfdfd('0x38')]=function(_0x377a25,_0x493abc){var _0x567187={},_0x151dce={},_0x585d9f={'count':0x0,'rows':[]};var _0x1a4dbb=_[_0xfdfd('0x39')](db[_0xfdfd('0x3a')]['rawAttributes'],function(_0xf89366){return{'name':_0xf89366['fieldName'],'type':_0xf89366[_0xfdfd('0x3b')][_0xfdfd('0x3c')]};});_0x151dce['model']=_[_0xfdfd('0x39')](_0x1a4dbb,_0xfdfd('0x36'));_0x151dce[_0xfdfd('0x3d')]=_['keys'](_0x377a25[_0xfdfd('0x3d')]);_0x151dce[_0xfdfd('0x3e')]=_[_0xfdfd('0x3f')](_0x151dce[_0xfdfd('0x40')],_0x151dce['query']);_0x567187[_0xfdfd('0x41')]=_[_0xfdfd('0x3f')](_0x151dce[_0xfdfd('0x40')],qs[_0xfdfd('0x42')](_0x377a25[_0xfdfd('0x3d')]['fields']));_0x567187[_0xfdfd('0x41')]=_0x567187[_0xfdfd('0x41')][_0xfdfd('0x43')]?_0x567187['attributes']:_0x151dce[_0xfdfd('0x40')];if(!_0x377a25['query'][_0xfdfd('0x44')]('nolimit')){_0x567187[_0xfdfd('0x31')]=qs['limit'](_0x377a25[_0xfdfd('0x3d')][_0xfdfd('0x31')]);_0x567187[_0xfdfd('0x30')]=qs['offset'](_0x377a25['query'][_0xfdfd('0x30')]);}_0x567187['order']=qs['sort'](_0x377a25[_0xfdfd('0x3d')][_0xfdfd('0x45')]);_0x567187['where']=qs[_0xfdfd('0x3e')](_[_0xfdfd('0x46')](_0x377a25[_0xfdfd('0x3d')],_0x151dce[_0xfdfd('0x3e')]),_0x1a4dbb);if(_0x377a25[_0xfdfd('0x3d')][_0xfdfd('0x47')]){_0x567187['where']=_[_0xfdfd('0x48')](_0x567187[_0xfdfd('0x49')],{'$or':_[_0xfdfd('0x39')](_0x1a4dbb,function(_0x36cc7d){if(_0x36cc7d['type']!==_0xfdfd('0x4a')){var _0x8b386d={};_0x8b386d[_0x36cc7d[_0xfdfd('0x36')]]={'$like':'%'+_0x377a25['query'][_0xfdfd('0x47')]+'%'};return _0x8b386d;}})});}_0x567187=_[_0xfdfd('0x48')]({},_0x567187,_0x377a25['options']);var _0xef6490={'where':_0x567187['where']};return db[_0xfdfd('0x3a')]['count'](_0xef6490)[_0xfdfd('0x20')](function(_0x2cf303){_0x585d9f[_0xfdfd('0x2f')]=_0x2cf303;if(_0x377a25[_0xfdfd('0x3d')][_0xfdfd('0x4b')]){_0x567187['include']=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x567187);})['then'](function(_0xecb889){_0x585d9f['rows']=_0xecb889;return _0x585d9f;})[_0xfdfd('0x20')](respondWithFilteredResult(_0x493abc,_0x567187))[_0xfdfd('0x2a')](handleError(_0x493abc,null));};exports[_0xfdfd('0x4c')]=function(_0xa88e90,_0x353608){var _0x5778c9={'raw':![],'where':{'id':_0xa88e90[_0xfdfd('0x4d')]['id']}},_0x433245={};_0x433245[_0xfdfd('0x40')]=_[_0xfdfd('0x4e')](db[_0xfdfd('0x3a')]['rawAttributes']);_0x433245['query']=_[_0xfdfd('0x4e')](_0xa88e90[_0xfdfd('0x3d')]);_0x433245[_0xfdfd('0x3e')]=_[_0xfdfd('0x3f')](_0x433245[_0xfdfd('0x40')],_0x433245[_0xfdfd('0x3d')]);_0x5778c9['attributes']=_[_0xfdfd('0x3f')](_0x433245['model'],qs[_0xfdfd('0x42')](_0xa88e90[_0xfdfd('0x3d')][_0xfdfd('0x42')]));_0x5778c9[_0xfdfd('0x41')]=_0x5778c9[_0xfdfd('0x41')][_0xfdfd('0x43')]?_0x5778c9[_0xfdfd('0x41')]:_0x433245[_0xfdfd('0x40')];if(_0xa88e90['query'][_0xfdfd('0x4b')]){_0x5778c9[_0xfdfd('0x4f')]=[{'all':!![]}];}_0x5778c9=_[_0xfdfd('0x48')]({},_0x5778c9,_0xa88e90[_0xfdfd('0x50')]);return db[_0xfdfd('0x3a')][_0xfdfd('0x51')](_0x5778c9)['then'](handleEntityNotFound(_0x353608,null))['then'](respondWithResult(_0x353608,null))[_0xfdfd('0x2a')](handleError(_0x353608,null));};exports['create']=function(_0x329601,_0x6ebe24){return db[_0xfdfd('0x3a')][_0xfdfd('0x52')](_0x329601[_0xfdfd('0x53')],{})[_0xfdfd('0x20')](respondWithResult(_0x6ebe24,0xc9))[_0xfdfd('0x2a')](handleError(_0x6ebe24,null));};exports[_0xfdfd('0x35')]=function(_0x2a349d,_0xe79c89){if(_0x2a349d[_0xfdfd('0x53')]['id']){delete _0x2a349d[_0xfdfd('0x53')]['id'];}return db[_0xfdfd('0x3a')]['find']({'where':{'id':_0x2a349d['params']['id']}})[_0xfdfd('0x20')](handleEntityNotFound(_0xe79c89,null))['then'](saveUpdates(_0x2a349d[_0xfdfd('0x53')],null))[_0xfdfd('0x20')](respondWithResult(_0xe79c89,null))[_0xfdfd('0x2a')](handleError(_0xe79c89,null));};exports[_0xfdfd('0x54')]=function(_0x59c5a5,_0x16d80f){return db['FreshsalesAccount']['find']({'where':{'id':_0x59c5a5[_0xfdfd('0x4d')]['id']}})[_0xfdfd('0x20')](handleEntityNotFound(_0x16d80f,null))['then'](removeEntity(_0x16d80f,null))[_0xfdfd('0x2a')](handleError(_0x16d80f,null));};exports['getConfigurations']=function(_0xe231b7,_0x512bc3,_0x1563ce){var _0x31e2f6={};var _0x534386={};var _0x5974d3;var _0x298276;return db[_0xfdfd('0x3a')][_0xfdfd('0x55')]({'where':{'id':_0xe231b7[_0xfdfd('0x4d')]['id']}})['then'](handleEntityNotFound(_0x512bc3,null))['then'](function(_0xd27a90){if(_0xd27a90){_0x5974d3=_0xd27a90;_0x534386[_0xfdfd('0x40')]=_['keys'](db[_0xfdfd('0x56')][_0xfdfd('0x57')]);_0x534386[_0xfdfd('0x3d')]=_[_0xfdfd('0x4e')](_0xe231b7['query']);_0x534386[_0xfdfd('0x3e')]=_['intersection'](_0x534386[_0xfdfd('0x40')],_0x534386['query']);_0x31e2f6['attributes']=_['intersection'](_0x534386[_0xfdfd('0x40')],qs[_0xfdfd('0x42')](_0xe231b7[_0xfdfd('0x3d')][_0xfdfd('0x42')]));_0x31e2f6[_0xfdfd('0x41')]=_0x31e2f6[_0xfdfd('0x41')]['length']?_0x31e2f6['attributes']:_0x534386[_0xfdfd('0x40')];_0x31e2f6[_0xfdfd('0x58')]=qs[_0xfdfd('0x45')](_0xe231b7[_0xfdfd('0x3d')][_0xfdfd('0x45')]);_0x31e2f6['where']=qs[_0xfdfd('0x3e')](_[_0xfdfd('0x46')](_0xe231b7[_0xfdfd('0x3d')],_0x534386[_0xfdfd('0x3e')]));if(_0xe231b7['query'][_0xfdfd('0x47')]){_0x31e2f6['where']=_[_0xfdfd('0x48')](_0x31e2f6[_0xfdfd('0x49')],{'$or':_[_0xfdfd('0x39')](_0x31e2f6[_0xfdfd('0x41')],function(_0x5e4dda){var _0x5205a7={};_0x5205a7[_0x5e4dda]={'$like':'%'+_0xe231b7['query'][_0xfdfd('0x47')]+'%'};return _0x5205a7;})});}_0x31e2f6=_[_0xfdfd('0x48')]({},_0x31e2f6,_0xe231b7['options']);return _0x5974d3[_0xfdfd('0x59')](_0x31e2f6);}})[_0xfdfd('0x20')](function(_0x3f597f){if(_0x3f597f){_0x298276=_0x3f597f[_0xfdfd('0x43')];if(!_0xe231b7[_0xfdfd('0x3d')][_0xfdfd('0x44')](_0xfdfd('0x5a'))){_0x31e2f6[_0xfdfd('0x31')]=qs[_0xfdfd('0x31')](_0xe231b7['query'][_0xfdfd('0x31')]);_0x31e2f6[_0xfdfd('0x30')]=qs[_0xfdfd('0x30')](_0xe231b7[_0xfdfd('0x3d')][_0xfdfd('0x30')]);}return _0x5974d3[_0xfdfd('0x59')](_0x31e2f6);}})['then'](function(_0x2db972){if(_0x2db972){return _0x2db972?{'count':_0x298276,'rows':_0x2db972}:null;}})[_0xfdfd('0x20')](respondWithResult(_0x512bc3,null))['catch'](handleError(_0x512bc3,null));};exports[_0xfdfd('0x5b')]=function(_0x1bd24a,_0x4130f0,_0x53837f){if(_0x1bd24a[_0xfdfd('0x53')]['id']){delete _0x1bd24a[_0xfdfd('0x53')]['id'];}return db[_0xfdfd('0x3a')][_0xfdfd('0x55')]({'where':{'id':_0x1bd24a[_0xfdfd('0x4d')]['id']}})[_0xfdfd('0x20')](handleEntityNotFound(_0x4130f0,null))['then'](function(_0x3620e3){if(_0x3620e3){_0x1bd24a[_0xfdfd('0x53')][_0xfdfd('0x5c')]=_0x3620e3['id'];_0x1bd24a['body']['Subjects']=integrations['getSubjects'](_0x1bd24a[_0xfdfd('0x53')][_0xfdfd('0x5d')],_0x1bd24a[_0xfdfd('0x53')][_0xfdfd('0x3b')]);_0x1bd24a['body'][_0xfdfd('0x5e')]=integrations[_0xfdfd('0x5f')](_0x1bd24a[_0xfdfd('0x53')]['channel'],_0x1bd24a[_0xfdfd('0x53')][_0xfdfd('0x3b')]);return db[_0xfdfd('0x56')][_0xfdfd('0x52')](_0x1bd24a['body'],{'include':[{'model':db['FreshsalesField'],'as':_0xfdfd('0x60')},{'model':db[_0xfdfd('0x61')],'as':_0xfdfd('0x5e')}]});}return null;})[_0xfdfd('0x20')](respondWithResult(_0x4130f0,null))[_0xfdfd('0x2a')](handleError(_0x4130f0,null));};exports['getFields']=function(_0x473add,_0x7ca934,_0x4ed369){var _0x495d67='';var _0x11d09f='';return db[_0xfdfd('0x3a')][_0xfdfd('0x55')]({'where':{'id':_0x473add['params']['id']},'attributes':['id',_0xfdfd('0x62'),_0xfdfd('0x63'),'apiKey']})[_0xfdfd('0x20')](handleEntityNotFound(_0x7ca934,null))[_0xfdfd('0x20')](function(_0x3c3a5c){if(_0x3c3a5c){_0x11d09f=_0x3c3a5c[_0xfdfd('0x62')];_0x495d67=_0x3c3a5c['remoteUri'];var _0x402135=_0x3c3a5c[_0xfdfd('0x63')][_0xfdfd('0x64')](-0x1);if(_0x402135==='/'){_0x495d67=_0x495d67[_0xfdfd('0x65')](0x0,_0x495d67[_0xfdfd('0x66')](_0x402135));}return rp({'method':_0xfdfd('0x67'),'uri':util[_0xfdfd('0x68')]('%s%s',_0x495d67,_0xfdfd('0x69')),'headers':{'Authorization':'Token\x20token='+_0x3c3a5c[_0xfdfd('0x6a')]},'json':!![]});}})['then'](function(_0x5d0970){if(_0x5d0970){var _0xae320b=_0x5d0970[_0xfdfd('0x6b')];var _0x37332e=![];var _0x33737a=null;for(_0x33737a=0x0;_0x33737a<_0xae320b[_0xfdfd('0x43')];_0x33737a++){if(_0xae320b[_0x33737a]['email']===_0x11d09f){_0x37332e=!![];}}if(_0x37332e){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xfdfd('0x6c')});}}})[_0xfdfd('0x20')](respondWithResult(_0x7ca934,null))[_0xfdfd('0x2a')](function(_0x144c48){var _0x1c0c12=_0x473add['query'][_0xfdfd('0x1b')]?0x1f4:_0x144c48[_0xfdfd('0x6d')]||0x1f4;logger[_0xfdfd('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0xfdfd('0x6e'),_0x1c0c12,JSON[_0xfdfd('0x25')](_0x144c48));delete _0x144c48['name'];if(_0x1c0c12===0x191){_0x1c0c12=0x190;}_0x7ca934[_0xfdfd('0x2c')](_0x1c0c12)['send'](_0x473add['query'][_0xfdfd('0x1b')]?{'message':_0xfdfd('0x6f'),'statusCode':_0x144c48[_0xfdfd('0x6d')]}:_0x144c48);});}; \ No newline at end of file +var _0x2136=['username','slice','substring','lastIndexOf','GET','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','stack','name','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshsalesField','getFields','remoteUri','apiKey'];(function(_0xa514f8,_0x8aed66){var _0x343faa=function(_0x4d480f){while(--_0x4d480f){_0xa514f8['push'](_0xa514f8['shift']());}};_0x343faa(++_0x8aed66);}(_0x2136,0xf0));var _0x6213=function(_0x3bceea,_0x58af75){_0x3bceea=_0x3bceea-0x0;var _0x30a8d3=_0x2136[_0x3bceea];return _0x30a8d3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6213('0x0'));var rimraf=require(_0x6213('0x1'));var zipdir=require(_0x6213('0x2'));var jsonpatch=require(_0x6213('0x3'));var rp=require('request-promise');var moment=require(_0x6213('0x4'));var BPromise=require(_0x6213('0x5'));var Mustache=require(_0x6213('0x6'));var util=require(_0x6213('0x7'));var path=require('path');var sox=require(_0x6213('0x8'));var csv=require(_0x6213('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6213('0xa'));var squel=require(_0x6213('0xb'));var crypto=require(_0x6213('0xc'));var jsforce=require(_0x6213('0xd'));var deskjs=require(_0x6213('0xe'));var toCsv=require(_0x6213('0x9'));var querystring=require('querystring');var Papa=require(_0x6213('0xf'));var Redis=require(_0x6213('0x10'));var authService=require(_0x6213('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6213('0x12'));var logger=require(_0x6213('0x13'))(_0x6213('0x14'));var utils=require(_0x6213('0x15'));var config=require(_0x6213('0x16'));var db=require(_0x6213('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x6213('0x18'));var client=jayson['client'][_0x6213('0x19')]({'port':0x232a});function checkPasswordPattern(_0x5db562,_0x410622,_0x20231b){if(_0x20231b){var _0x8c76fd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x8c76fd[_0x6213('0x1a')](_0x410622)){return _0x5db562;}else{throw new db[(_0x6213('0x1b'))][(_0x6213('0x1c'))](_0x6213('0x1d'));}}else{return _0x5db562;}}function respondWithRpcPromise(_0x2e5978,_0x1a0678,_0x87687d,_0x4473b4){return new BPromise(function(_0x4d227a,_0x5ce9d4){var _0x16d1b7=_0x4473b4||client;return _0x16d1b7[_0x6213('0x1e')](_0x2e5978,_0x87687d)[_0x6213('0x1f')](function(_0x36fc1b){logger[_0x6213('0x20')](_0x6213('0x21'),_0x1a0678,_0x6213('0x22'));logger['debug'](_0x6213('0x23'),_0x1a0678,_0x6213('0x22'),JSON[_0x6213('0x24')](_0x36fc1b));if(_0x36fc1b[_0x6213('0x25')]){if(_0x36fc1b[_0x6213('0x25')]['code']===0x1f4){logger[_0x6213('0x25')](_0x6213('0x21'),_0x1a0678,_0x36fc1b[_0x6213('0x25')][_0x6213('0x26')]);return _0x5ce9d4(_0x36fc1b['error'][_0x6213('0x26')]);}logger[_0x6213('0x25')](_0x6213('0x21'),_0x1a0678,_0x36fc1b[_0x6213('0x25')]['message']);return _0x4d227a(_0x36fc1b['error'][_0x6213('0x26')]);}else{logger['info'](_0x6213('0x21'),_0x1a0678,_0x6213('0x22'));_0x4d227a(_0x36fc1b[_0x6213('0x27')][_0x6213('0x26')]);}})[_0x6213('0x28')](function(_0x3af862){logger['error'](_0x6213('0x21'),_0x1a0678,_0x3af862);_0x5ce9d4(_0x3af862);});});}function respondWithStatusCode(_0x4e19e6,_0x1d3f9b){_0x1d3f9b=_0x1d3f9b||0xcc;return function(_0x424c7f){if(_0x424c7f){return _0x4e19e6[_0x6213('0x29')](_0x1d3f9b);}return _0x4e19e6[_0x6213('0x2a')](_0x1d3f9b)[_0x6213('0x2b')]();};}function respondWithResult(_0x59f0c3,_0x33d3bc){_0x33d3bc=_0x33d3bc||0xc8;return function(_0x15363b){if(_0x15363b){return _0x59f0c3[_0x6213('0x2a')](_0x33d3bc)['json'](_0x15363b);}};}function respondWithFilteredResult(_0x1469a5,_0xf4eef2){return function(_0x5c953a){if(_0x5c953a){var _0x1f9ae1=_0x5c953a[_0x6213('0x2c')],_0x224ad3=_0xf4eef2[_0x6213('0x2d')],_0x3f90d4=_0xf4eef2[_0x6213('0x2d')]+_0xf4eef2[_0x6213('0x2e')],_0x49921e;if(_0x3f90d4>=_0x1f9ae1){_0x3f90d4=_0x1f9ae1;_0x49921e=0xc8;}else{_0x49921e=0xce;}_0x1469a5[_0x6213('0x2a')](_0x49921e);return _0x1469a5[_0x6213('0x2f')](_0x6213('0x30'),_0x224ad3+'-'+_0x3f90d4+'/'+_0x1f9ae1)[_0x6213('0x31')](_0x5c953a);}return null;};}function patchUpdates(_0x29fa48){return function(_0x1df55d){try{jsonpatch[_0x6213('0x32')](_0x1df55d,_0x29fa48,!![]);}catch(_0x5431c4){return BPromise[_0x6213('0x33')](_0x5431c4);}return _0x1df55d[_0x6213('0x34')]();};}function saveUpdates(_0x24210d,_0x378cdb){return function(_0x19c644){if(_0x19c644){return _0x19c644[_0x6213('0x35')](_0x24210d)[_0x6213('0x1f')](function(_0x1d1f83){return _0x1d1f83;});}return null;};}function removeEntity(_0x1c4562,_0x43e4f4){return function(_0x2e3b81){if(_0x2e3b81){return _0x2e3b81['destroy']()[_0x6213('0x1f')](function(){_0x1c4562[_0x6213('0x2a')](0xcc)[_0x6213('0x2b')]();});}};}function handleEntityNotFound(_0x4ed959,_0x1f1cf0){return function(_0x56cd9a){if(!_0x56cd9a){_0x4ed959[_0x6213('0x29')](0x194);}return _0x56cd9a;};}function handleError(_0xc02770,_0x2870a3){_0x2870a3=_0x2870a3||0x1f4;return function(_0x288433){logger['error'](_0x288433[_0x6213('0x36')]);if(_0x288433[_0x6213('0x37')]){delete _0x288433['name'];}_0xc02770[_0x6213('0x2a')](_0x2870a3)['send'](_0x288433);};}exports[_0x6213('0x38')]=function(_0x3e444f,_0x46a474){var _0xb92646={},_0x59d1ed={},_0x2a6dad={'count':0x0,'rows':[]};var _0x510703=_[_0x6213('0x39')](db[_0x6213('0x3a')][_0x6213('0x3b')],function(_0x47502a){return{'name':_0x47502a[_0x6213('0x3c')],'type':_0x47502a[_0x6213('0x3d')][_0x6213('0x3e')]};});_0x59d1ed[_0x6213('0x3f')]=_[_0x6213('0x39')](_0x510703,_0x6213('0x37'));_0x59d1ed[_0x6213('0x40')]=_[_0x6213('0x41')](_0x3e444f[_0x6213('0x40')]);_0x59d1ed[_0x6213('0x42')]=_[_0x6213('0x43')](_0x59d1ed[_0x6213('0x3f')],_0x59d1ed[_0x6213('0x40')]);_0xb92646[_0x6213('0x44')]=_[_0x6213('0x43')](_0x59d1ed[_0x6213('0x3f')],qs[_0x6213('0x45')](_0x3e444f['query']['fields']));_0xb92646[_0x6213('0x44')]=_0xb92646[_0x6213('0x44')][_0x6213('0x46')]?_0xb92646[_0x6213('0x44')]:_0x59d1ed[_0x6213('0x3f')];if(!_0x3e444f[_0x6213('0x40')]['hasOwnProperty']('nolimit')){_0xb92646[_0x6213('0x2e')]=qs['limit'](_0x3e444f[_0x6213('0x40')][_0x6213('0x2e')]);_0xb92646[_0x6213('0x2d')]=qs[_0x6213('0x2d')](_0x3e444f['query'][_0x6213('0x2d')]);}_0xb92646[_0x6213('0x47')]=qs[_0x6213('0x48')](_0x3e444f[_0x6213('0x40')][_0x6213('0x48')]);_0xb92646[_0x6213('0x49')]=qs['filters'](_[_0x6213('0x4a')](_0x3e444f[_0x6213('0x40')],_0x59d1ed[_0x6213('0x42')]),_0x510703);if(_0x3e444f[_0x6213('0x40')][_0x6213('0x4b')]){_0xb92646[_0x6213('0x49')]=_[_0x6213('0x4c')](_0xb92646['where'],{'$or':_[_0x6213('0x39')](_0x510703,function(_0xd17b4a){if(_0xd17b4a[_0x6213('0x3d')]!==_0x6213('0x4d')){var _0x58c63b={};_0x58c63b[_0xd17b4a[_0x6213('0x37')]]={'$like':'%'+_0x3e444f[_0x6213('0x40')][_0x6213('0x4b')]+'%'};return _0x58c63b;}})});}_0xb92646=_[_0x6213('0x4c')]({},_0xb92646,_0x3e444f['options']);var _0x3689dd={'where':_0xb92646[_0x6213('0x49')]};return db[_0x6213('0x3a')][_0x6213('0x2c')](_0x3689dd)[_0x6213('0x1f')](function(_0x41389d){_0x2a6dad[_0x6213('0x2c')]=_0x41389d;if(_0x3e444f[_0x6213('0x40')][_0x6213('0x4e')]){_0xb92646[_0x6213('0x4f')]=[{'all':!![]}];}return db[_0x6213('0x3a')][_0x6213('0x50')](_0xb92646);})[_0x6213('0x1f')](function(_0x3c6336){_0x2a6dad[_0x6213('0x51')]=_0x3c6336;return _0x2a6dad;})['then'](respondWithFilteredResult(_0x46a474,_0xb92646))[_0x6213('0x28')](handleError(_0x46a474,null));};exports[_0x6213('0x52')]=function(_0x3091b7,_0x405745){var _0x289b42={'raw':![],'where':{'id':_0x3091b7[_0x6213('0x53')]['id']}},_0x4c5d1a={};_0x4c5d1a['model']=_[_0x6213('0x41')](db[_0x6213('0x3a')][_0x6213('0x3b')]);_0x4c5d1a[_0x6213('0x40')]=_[_0x6213('0x41')](_0x3091b7[_0x6213('0x40')]);_0x4c5d1a['filters']=_[_0x6213('0x43')](_0x4c5d1a[_0x6213('0x3f')],_0x4c5d1a[_0x6213('0x40')]);_0x289b42[_0x6213('0x44')]=_[_0x6213('0x43')](_0x4c5d1a[_0x6213('0x3f')],qs[_0x6213('0x45')](_0x3091b7['query']['fields']));_0x289b42[_0x6213('0x44')]=_0x289b42[_0x6213('0x44')][_0x6213('0x46')]?_0x289b42[_0x6213('0x44')]:_0x4c5d1a[_0x6213('0x3f')];if(_0x3091b7[_0x6213('0x40')][_0x6213('0x4e')]){_0x289b42[_0x6213('0x4f')]=[{'all':!![]}];}_0x289b42=_[_0x6213('0x4c')]({},_0x289b42,_0x3091b7[_0x6213('0x54')]);return db['FreshsalesAccount'][_0x6213('0x55')](_0x289b42)[_0x6213('0x1f')](handleEntityNotFound(_0x405745,null))[_0x6213('0x1f')](respondWithResult(_0x405745,null))[_0x6213('0x28')](handleError(_0x405745,null));};exports[_0x6213('0x56')]=function(_0x307032,_0x25183c){return db[_0x6213('0x3a')]['create'](_0x307032[_0x6213('0x57')],{})[_0x6213('0x1f')](respondWithResult(_0x25183c,0xc9))['catch'](handleError(_0x25183c,null));};exports[_0x6213('0x35')]=function(_0x1e7f68,_0x2a11ce){if(_0x1e7f68[_0x6213('0x57')]['id']){delete _0x1e7f68[_0x6213('0x57')]['id'];}return db[_0x6213('0x3a')][_0x6213('0x55')]({'where':{'id':_0x1e7f68[_0x6213('0x53')]['id']}})['then'](handleEntityNotFound(_0x2a11ce,null))[_0x6213('0x1f')](saveUpdates(_0x1e7f68[_0x6213('0x57')],null))[_0x6213('0x1f')](respondWithResult(_0x2a11ce,null))[_0x6213('0x28')](handleError(_0x2a11ce,null));};exports['destroy']=function(_0x1d1a8f,_0x4482a7){return db[_0x6213('0x3a')][_0x6213('0x55')]({'where':{'id':_0x1d1a8f[_0x6213('0x53')]['id']}})['then'](handleEntityNotFound(_0x4482a7,null))[_0x6213('0x1f')](removeEntity(_0x4482a7,null))['catch'](handleError(_0x4482a7,null));};exports[_0x6213('0x58')]=function(_0x56f920,_0xa05500,_0x6f34f2){var _0x4fe16c={};var _0x5439f1={};var _0x213f23;var _0x15456c;return db[_0x6213('0x3a')][_0x6213('0x59')]({'where':{'id':_0x56f920[_0x6213('0x53')]['id']}})[_0x6213('0x1f')](handleEntityNotFound(_0xa05500,null))[_0x6213('0x1f')](function(_0x2246f6){if(_0x2246f6){_0x213f23=_0x2246f6;_0x5439f1[_0x6213('0x3f')]=_[_0x6213('0x41')](db[_0x6213('0x5a')]['rawAttributes']);_0x5439f1[_0x6213('0x40')]=_[_0x6213('0x41')](_0x56f920['query']);_0x5439f1[_0x6213('0x42')]=_[_0x6213('0x43')](_0x5439f1['model'],_0x5439f1[_0x6213('0x40')]);_0x4fe16c['attributes']=_[_0x6213('0x43')](_0x5439f1[_0x6213('0x3f')],qs[_0x6213('0x45')](_0x56f920[_0x6213('0x40')][_0x6213('0x45')]));_0x4fe16c['attributes']=_0x4fe16c[_0x6213('0x44')][_0x6213('0x46')]?_0x4fe16c[_0x6213('0x44')]:_0x5439f1[_0x6213('0x3f')];_0x4fe16c['order']=qs[_0x6213('0x48')](_0x56f920['query']['sort']);_0x4fe16c[_0x6213('0x49')]=qs[_0x6213('0x42')](_['pick'](_0x56f920[_0x6213('0x40')],_0x5439f1['filters']));if(_0x56f920['query']['filter']){_0x4fe16c[_0x6213('0x49')]=_['merge'](_0x4fe16c[_0x6213('0x49')],{'$or':_[_0x6213('0x39')](_0x4fe16c[_0x6213('0x44')],function(_0x402978){var _0x179643={};_0x179643[_0x402978]={'$like':'%'+_0x56f920[_0x6213('0x40')]['filter']+'%'};return _0x179643;})});}_0x4fe16c=_[_0x6213('0x4c')]({},_0x4fe16c,_0x56f920[_0x6213('0x54')]);return _0x213f23[_0x6213('0x58')](_0x4fe16c);}})[_0x6213('0x1f')](function(_0x9d3445){if(_0x9d3445){_0x15456c=_0x9d3445['length'];if(!_0x56f920[_0x6213('0x40')]['hasOwnProperty'](_0x6213('0x5b'))){_0x4fe16c['limit']=qs[_0x6213('0x2e')](_0x56f920[_0x6213('0x40')]['limit']);_0x4fe16c['offset']=qs[_0x6213('0x2d')](_0x56f920['query'][_0x6213('0x2d')]);}return _0x213f23['getConfigurations'](_0x4fe16c);}})[_0x6213('0x1f')](function(_0xea825a){if(_0xea825a){return _0xea825a?{'count':_0x15456c,'rows':_0xea825a}:null;}})[_0x6213('0x1f')](respondWithResult(_0xa05500,null))['catch'](handleError(_0xa05500,null));};exports[_0x6213('0x5c')]=function(_0x2d3c75,_0x5bfe63,_0x123cc5){if(_0x2d3c75[_0x6213('0x57')]['id']){delete _0x2d3c75[_0x6213('0x57')]['id'];}return db[_0x6213('0x3a')][_0x6213('0x59')]({'where':{'id':_0x2d3c75[_0x6213('0x53')]['id']}})[_0x6213('0x1f')](handleEntityNotFound(_0x5bfe63,null))[_0x6213('0x1f')](function(_0x4bdc6b){if(_0x4bdc6b){_0x2d3c75[_0x6213('0x57')][_0x6213('0x5d')]=_0x4bdc6b['id'];_0x2d3c75[_0x6213('0x57')][_0x6213('0x5e')]=integrations[_0x6213('0x5f')](_0x2d3c75['body'][_0x6213('0x60')],_0x2d3c75[_0x6213('0x57')][_0x6213('0x3d')]);_0x2d3c75[_0x6213('0x57')][_0x6213('0x61')]=integrations['getDescriptions'](_0x2d3c75[_0x6213('0x57')][_0x6213('0x60')],_0x2d3c75['body'][_0x6213('0x3d')]);return db['FreshsalesConfiguration'][_0x6213('0x56')](_0x2d3c75[_0x6213('0x57')],{'include':[{'model':db[_0x6213('0x62')],'as':_0x6213('0x5e')},{'model':db[_0x6213('0x62')],'as':_0x6213('0x61')}]});}return null;})['then'](respondWithResult(_0x5bfe63,null))[_0x6213('0x28')](handleError(_0x5bfe63,null));};exports[_0x6213('0x63')]=function(_0x5c47eb,_0x166839,_0x512b24){var _0x32d185='';var _0x56186c='';return db[_0x6213('0x3a')]['findOne']({'where':{'id':_0x5c47eb[_0x6213('0x53')]['id']},'attributes':['id','username',_0x6213('0x64'),_0x6213('0x65')]})[_0x6213('0x1f')](handleEntityNotFound(_0x166839,null))[_0x6213('0x1f')](function(_0x2cc324){if(_0x2cc324){_0x56186c=_0x2cc324[_0x6213('0x66')];_0x32d185=_0x2cc324[_0x6213('0x64')];var _0x31238e=_0x2cc324[_0x6213('0x64')][_0x6213('0x67')](-0x1);if(_0x31238e==='/'){_0x32d185=_0x32d185[_0x6213('0x68')](0x0,_0x32d185[_0x6213('0x69')](_0x31238e));}return rp({'method':_0x6213('0x6a'),'uri':util['format'](_0x6213('0x6b'),_0x32d185,_0x6213('0x6c')),'headers':{'Authorization':_0x6213('0x6d')+_0x2cc324[_0x6213('0x65')]},'json':!![]});}})[_0x6213('0x1f')](function(_0x2a5deb){if(_0x2a5deb){var _0x482528=_0x2a5deb[_0x6213('0x6e')];var _0x21d121=![];var _0x400f84=null;for(_0x400f84=0x0;_0x400f84<_0x482528[_0x6213('0x46')];_0x400f84++){if(_0x482528[_0x400f84][_0x6213('0x6f')]===_0x56186c){_0x21d121=!![];}}if(_0x21d121){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x6213('0x70')});}}})[_0x6213('0x1f')](respondWithResult(_0x166839,null))[_0x6213('0x28')](function(_0x2a15f0){var _0x5c066b=_0x5c47eb[_0x6213('0x40')][_0x6213('0x1a')]?0x1f4:_0x2a15f0['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x6213('0x63'),_0x5c066b,JSON[_0x6213('0x24')](_0x2a15f0));delete _0x2a15f0['name'];if(_0x5c066b===0x191){_0x5c066b=0x190;}_0x166839[_0x6213('0x2a')](_0x5c066b)['send'](_0x5c47eb[_0x6213('0x40')][_0x6213('0x1a')]?{'message':_0x6213('0x71'),'statusCode':_0x2a15f0['statusCode']}:_0x2a15f0);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 429e659..397131f 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 _0xb66c=['int_freshsales_accounts','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount'];(function(_0x3868af,_0x1569d4){var _0x48a360=function(_0x46bd3e){while(--_0x46bd3e){_0x3868af['push'](_0x3868af['shift']());}};_0x48a360(++_0x1569d4);}(_0xb66c,0x175));var _0xcb66=function(_0x49b307,_0x455061){_0x49b307=_0x49b307-0x0;var _0x3d036f=_0xb66c[_0x49b307];return _0x3d036f;};'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'));var integrations=require(_0xcb66('0x8'));module['exports']=function(_0x518163,_0x19adf5){return _0x518163[_0xcb66('0x9')](_0xcb66('0xa'),attributes,{'tableName':_0xcb66('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadb8=['path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','exports','define','FreshsalesAccount','int_freshsales_accounts','../../config/logger','moment','bluebird','request-promise'];(function(_0x151ab5,_0x2d7459){var _0x46acfa=function(_0x5b331a){while(--_0x5b331a){_0x151ab5['push'](_0x151ab5['shift']());}};_0x46acfa(++_0x2d7459);}(_0xadb8,0x1d0));var _0x8adb=function(_0x4be8ba,_0x5d10ba){_0x4be8ba=_0x4be8ba-0x0;var _0x1af822=_0xadb8[_0x4be8ba];return _0x1af822;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8adb('0x0'))('api');var moment=require(_0x8adb('0x1'));var BPromise=require(_0x8adb('0x2'));var rp=require(_0x8adb('0x3'));var fs=require('fs');var path=require(_0x8adb('0x4'));var rimraf=require(_0x8adb('0x5'));var config=require(_0x8adb('0x6'));var attributes=require(_0x8adb('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x8adb('0x8')]=function(_0x1a5f36,_0x9f435){return _0x1a5f36[_0x8adb('0x9')](_0x8adb('0xa'),attributes,{'tableName':_0x8adb('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 850890d..d71b616 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 _0xc6c0=['map','ShowFreshsalesAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','include','model'];(function(_0x1086cc,_0x2783f2){var _0xd9c201=function(_0x17a29e){while(--_0x17a29e){_0x1086cc['push'](_0x1086cc['shift']());}};_0xd9c201(++_0x2783f2);}(_0xc6c0,0x13e));var _0x0c6c=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0xc6c0[_0x562f3b];return _0x1edd55;};'use strict';var _=require(_0x0c6c('0x0'));var util=require('util');var moment=require(_0x0c6c('0x1'));var BPromise=require(_0x0c6c('0x2'));var rs=require(_0x0c6c('0x3'));var fs=require('fs');var Redis=require(_0x0c6c('0x4'));var db=require(_0x0c6c('0x5'))['db'];var utils=require(_0x0c6c('0x6'));var logger=require(_0x0c6c('0x7'))(_0x0c6c('0x8'));var config=require(_0x0c6c('0x9'));var jayson=require(_0x0c6c('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1791cb,_0x223b4f,_0x51208d){return new BPromise(function(_0x2e0cd9,_0x15c862){return client[_0x0c6c('0xb')](_0x1791cb,_0x51208d)[_0x0c6c('0xc')](function(_0x317bcf){logger[_0x0c6c('0xd')](_0x0c6c('0xe'),_0x223b4f,_0x0c6c('0xf'));logger[_0x0c6c('0x10')](_0x0c6c('0x11'),_0x223b4f,_0x0c6c('0xf'),JSON[_0x0c6c('0x12')](_0x317bcf));if(_0x317bcf['error']){if(_0x317bcf[_0x0c6c('0x13')]['code']===0x1f4){logger[_0x0c6c('0x13')](_0x0c6c('0xe'),_0x223b4f,_0x317bcf['error'][_0x0c6c('0x14')]);return _0x15c862(_0x317bcf[_0x0c6c('0x13')][_0x0c6c('0x14')]);}logger[_0x0c6c('0x13')](_0x0c6c('0xe'),_0x223b4f,_0x317bcf['error'][_0x0c6c('0x14')]);return _0x2e0cd9(_0x317bcf[_0x0c6c('0x13')][_0x0c6c('0x14')]);}else{logger[_0x0c6c('0xd')](_0x0c6c('0xe'),_0x223b4f,_0x0c6c('0xf'));_0x2e0cd9(_0x317bcf[_0x0c6c('0x15')]['message']);}})[_0x0c6c('0x16')](function(_0x527ade){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x223b4f,_0x527ade);_0x15c862(_0x527ade);});});}exports[_0x0c6c('0x17')]=function(_0x530333){var _0x9463e8=this;return new Promise(function(_0x50be43,_0x316dbe){return db[_0x0c6c('0x18')][_0x0c6c('0x19')]({'raw':_0x530333[_0x0c6c('0x1a')]?_0x530333['options'][_0x0c6c('0x1b')]===undefined?!![]:![]:!![],'where':_0x530333[_0x0c6c('0x1a')]?_0x530333[_0x0c6c('0x1a')][_0x0c6c('0x1c')]||null:null,'attributes':_0x530333[_0x0c6c('0x1a')]?_0x530333[_0x0c6c('0x1a')][_0x0c6c('0x1d')]||null:null,'limit':_0x530333[_0x0c6c('0x1a')]?_0x530333[_0x0c6c('0x1a')]['limit']||null:null,'include':_0x530333[_0x0c6c('0x1a')]?_0x530333[_0x0c6c('0x1a')][_0x0c6c('0x1e')]?_['map'](_0x530333[_0x0c6c('0x1a')]['include'],function(_0x76992){return{'model':db[_0x76992[_0x0c6c('0x1f')]],'as':_0x76992['as'],'attributes':_0x76992[_0x0c6c('0x1d')],'include':_0x76992['include']?_[_0x0c6c('0x20')](_0x76992[_0x0c6c('0x1e')],function(_0x200a47){return{'model':db[_0x200a47[_0x0c6c('0x1f')]],'as':_0x200a47['as'],'attributes':_0x200a47[_0x0c6c('0x1d')],'include':_0x200a47[_0x0c6c('0x1e')]?_[_0x0c6c('0x20')](_0x200a47[_0x0c6c('0x1e')],function(_0x194637){return{'model':db[_0x194637[_0x0c6c('0x1f')]],'as':_0x194637['as'],'attributes':_0x194637['attributes']};}):[]};}):[]};}):[]:[]})[_0x0c6c('0xc')](function(_0x557046){logger[_0x0c6c('0xd')]('GetFreshsalesAccount',_0x530333);logger[_0x0c6c('0x10')](_0x0c6c('0x17'),_0x530333,JSON[_0x0c6c('0x12')](_0x557046));_0x50be43(_0x557046);})[_0x0c6c('0x16')](function(_0x2cbfc7){logger[_0x0c6c('0x13')](_0x0c6c('0x17'),_0x2cbfc7[_0x0c6c('0x14')],_0x530333);_0x316dbe(_0x9463e8['error'](0x1f4,_0x2cbfc7[_0x0c6c('0x14')]));});});};exports[_0x0c6c('0x21')]=function(_0x5ec5bc){var _0x40d708=this;return new Promise(function(_0x556dad,_0x37357b){return db[_0x0c6c('0x18')][_0x0c6c('0x22')]({'raw':_0x5ec5bc[_0x0c6c('0x1a')]?_0x5ec5bc[_0x0c6c('0x1a')][_0x0c6c('0x1b')]===undefined?!![]:![]:!![],'where':_0x5ec5bc[_0x0c6c('0x1a')]?_0x5ec5bc[_0x0c6c('0x1a')][_0x0c6c('0x1c')]||null:null,'attributes':_0x5ec5bc['options']?_0x5ec5bc['options'][_0x0c6c('0x1d')]||null:null,'include':_0x5ec5bc[_0x0c6c('0x1a')]?_0x5ec5bc[_0x0c6c('0x1a')][_0x0c6c('0x1e')]?_[_0x0c6c('0x20')](_0x5ec5bc[_0x0c6c('0x1a')]['include'],function(_0x3c97d1){return{'model':db[_0x3c97d1['model']],'as':_0x3c97d1['as'],'attributes':_0x3c97d1[_0x0c6c('0x1d')],'include':_0x3c97d1['include']?_[_0x0c6c('0x20')](_0x3c97d1[_0x0c6c('0x1e')],function(_0x5951f2){return{'model':db[_0x5951f2['model']],'as':_0x5951f2['as'],'attributes':_0x5951f2[_0x0c6c('0x1d')],'include':_0x5951f2[_0x0c6c('0x1e')]?_[_0x0c6c('0x20')](_0x5951f2[_0x0c6c('0x1e')],function(_0x4ed556){return{'model':db[_0x4ed556[_0x0c6c('0x1f')]],'as':_0x4ed556['as'],'attributes':_0x4ed556[_0x0c6c('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9d6ee8){logger[_0x0c6c('0xd')](_0x0c6c('0x21'),_0x5ec5bc);logger['debug'](_0x0c6c('0x21'),_0x5ec5bc,JSON[_0x0c6c('0x12')](_0x9d6ee8));_0x556dad(_0x9d6ee8);})[_0x0c6c('0x16')](function(_0x93e98a){logger[_0x0c6c('0x13')](_0x0c6c('0x21'),_0x93e98a[_0x0c6c('0x14')],_0x5ec5bc);_0x37357b(_0x40d708[_0x0c6c('0x13')](0x1f4,_0x93e98a[_0x0c6c('0x14')]));});});}; \ No newline at end of file +var _0x69d4=['client','http','request','then','request\x20sent','debug','stringify','error','FreshsalesAccount,\x20%s,\x20%s','message','info','result','FreshsalesAccount','findAll','options','raw','where','attributes','limit','map','include','model','GetFreshsalesAccount','ShowFreshsalesAccount','find','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x24fdce,_0x18736b){var _0x578b05=function(_0x183e4c){while(--_0x183e4c){_0x24fdce['push'](_0x24fdce['shift']());}};_0x578b05(++_0x18736b);}(_0x69d4,0x83));var _0x469d=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x69d4[_0x47fd36];return _0x21a0fc;};'use strict';var _=require(_0x469d('0x0'));var util=require(_0x469d('0x1'));var moment=require('moment');var BPromise=require(_0x469d('0x2'));var rs=require(_0x469d('0x3'));var fs=require('fs');var Redis=require(_0x469d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x469d('0x5'));var logger=require('../../config/logger')(_0x469d('0x6'));var config=require(_0x469d('0x7'));var jayson=require(_0x469d('0x8'));var client=jayson[_0x469d('0x9')][_0x469d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb15ca9,_0x5129a8,_0x1e9300){return new BPromise(function(_0x486595,_0x37ee05){return client[_0x469d('0xb')](_0xb15ca9,_0x1e9300)[_0x469d('0xc')](function(_0x5f05c9){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x5129a8,_0x469d('0xd'));logger[_0x469d('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x5129a8,_0x469d('0xd'),JSON[_0x469d('0xf')](_0x5f05c9));if(_0x5f05c9[_0x469d('0x10')]){if(_0x5f05c9['error']['code']===0x1f4){logger['error'](_0x469d('0x11'),_0x5129a8,_0x5f05c9[_0x469d('0x10')][_0x469d('0x12')]);return _0x37ee05(_0x5f05c9[_0x469d('0x10')][_0x469d('0x12')]);}logger[_0x469d('0x10')](_0x469d('0x11'),_0x5129a8,_0x5f05c9['error'][_0x469d('0x12')]);return _0x486595(_0x5f05c9[_0x469d('0x10')][_0x469d('0x12')]);}else{logger[_0x469d('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x5129a8,_0x469d('0xd'));_0x486595(_0x5f05c9[_0x469d('0x14')][_0x469d('0x12')]);}})['catch'](function(_0x16d3b5){logger[_0x469d('0x10')](_0x469d('0x11'),_0x5129a8,_0x16d3b5);_0x37ee05(_0x16d3b5);});});}exports['GetFreshsalesAccount']=function(_0x1393e3){var _0x47f944=this;return new Promise(function(_0x5a2a44,_0x59376f){return db[_0x469d('0x15')][_0x469d('0x16')]({'raw':_0x1393e3[_0x469d('0x17')]?_0x1393e3['options'][_0x469d('0x18')]===undefined?!![]:![]:!![],'where':_0x1393e3[_0x469d('0x17')]?_0x1393e3[_0x469d('0x17')][_0x469d('0x19')]||null:null,'attributes':_0x1393e3['options']?_0x1393e3[_0x469d('0x17')][_0x469d('0x1a')]||null:null,'limit':_0x1393e3[_0x469d('0x17')]?_0x1393e3['options'][_0x469d('0x1b')]||null:null,'include':_0x1393e3[_0x469d('0x17')]?_0x1393e3[_0x469d('0x17')]['include']?_[_0x469d('0x1c')](_0x1393e3['options'][_0x469d('0x1d')],function(_0x2206c4){return{'model':db[_0x2206c4['model']],'as':_0x2206c4['as'],'attributes':_0x2206c4[_0x469d('0x1a')],'include':_0x2206c4[_0x469d('0x1d')]?_[_0x469d('0x1c')](_0x2206c4[_0x469d('0x1d')],function(_0xaf343c){return{'model':db[_0xaf343c[_0x469d('0x1e')]],'as':_0xaf343c['as'],'attributes':_0xaf343c[_0x469d('0x1a')],'include':_0xaf343c[_0x469d('0x1d')]?_[_0x469d('0x1c')](_0xaf343c[_0x469d('0x1d')],function(_0x4b79f7){return{'model':db[_0x4b79f7[_0x469d('0x1e')]],'as':_0x4b79f7['as'],'attributes':_0x4b79f7[_0x469d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x469d('0xc')](function(_0x5c28fb){logger[_0x469d('0x13')](_0x469d('0x1f'),_0x1393e3);logger[_0x469d('0xe')](_0x469d('0x1f'),_0x1393e3,JSON['stringify'](_0x5c28fb));_0x5a2a44(_0x5c28fb);})['catch'](function(_0x3565f2){logger[_0x469d('0x10')](_0x469d('0x1f'),_0x3565f2[_0x469d('0x12')],_0x1393e3);_0x59376f(_0x47f944[_0x469d('0x10')](0x1f4,_0x3565f2['message']));});});};exports[_0x469d('0x20')]=function(_0x3978f0){var _0x24af19=this;return new Promise(function(_0x5d33f5,_0x1eceef){return db[_0x469d('0x15')][_0x469d('0x21')]({'raw':_0x3978f0[_0x469d('0x17')]?_0x3978f0[_0x469d('0x17')][_0x469d('0x18')]===undefined?!![]:![]:!![],'where':_0x3978f0[_0x469d('0x17')]?_0x3978f0['options']['where']||null:null,'attributes':_0x3978f0['options']?_0x3978f0['options'][_0x469d('0x1a')]||null:null,'include':_0x3978f0[_0x469d('0x17')]?_0x3978f0[_0x469d('0x17')][_0x469d('0x1d')]?_['map'](_0x3978f0[_0x469d('0x17')]['include'],function(_0x4dbea6){return{'model':db[_0x4dbea6[_0x469d('0x1e')]],'as':_0x4dbea6['as'],'attributes':_0x4dbea6[_0x469d('0x1a')],'include':_0x4dbea6[_0x469d('0x1d')]?_[_0x469d('0x1c')](_0x4dbea6[_0x469d('0x1d')],function(_0x3f9c12){return{'model':db[_0x3f9c12[_0x469d('0x1e')]],'as':_0x3f9c12['as'],'attributes':_0x3f9c12['attributes'],'include':_0x3f9c12['include']?_[_0x469d('0x1c')](_0x3f9c12['include'],function(_0x9d4a73){return{'model':db[_0x9d4a73[_0x469d('0x1e')]],'as':_0x9d4a73['as'],'attributes':_0x9d4a73[_0x469d('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57e60d){logger[_0x469d('0x13')]('ShowFreshsalesAccount',_0x3978f0);logger[_0x469d('0xe')](_0x469d('0x20'),_0x3978f0,JSON[_0x469d('0xf')](_0x57e60d));_0x5d33f5(_0x57e60d);})[_0x469d('0x22')](function(_0x1ae6a0){logger[_0x469d('0x10')](_0x469d('0x20'),_0x1ae6a0[_0x469d('0x12')],_0x3978f0);_0x1eceef(_0x24af19[_0x469d('0x10')](0x1f4,_0x1ae6a0['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index f893795..9c60a10 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 _0xb6af=['./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/subjects','getSubjects','getDescriptions','/:id/fields','getFields','post','create','put','update','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x4489e8,_0x53b114){var _0x48d98e=function(_0x2a8bac){while(--_0x2a8bac){_0x4489e8['push'](_0x4489e8['shift']());}};_0x48d98e(++_0x53b114);}(_0xb6af,0x197));var _0xfb6a=function(_0x4a82ac,_0x1fb931){_0x4a82ac=_0x4a82ac-0x0;var _0x58ee97=_0xb6af[_0x4a82ac];return _0x58ee97;};'use strict';var multer=require('multer');var util=require(_0xfb6a('0x0'));var path=require(_0xfb6a('0x1'));var timeout=require(_0xfb6a('0x2'));var express=require(_0xfb6a('0x3'));var router=express[_0xfb6a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xfb6a('0x5'));var config=require(_0xfb6a('0x6'));var controller=require(_0xfb6a('0x7'));router[_0xfb6a('0x8')]('/',auth['isAuthenticated'](),controller[_0xfb6a('0x9')]);router[_0xfb6a('0x8')](_0xfb6a('0xa'),auth[_0xfb6a('0xb')](),controller[_0xfb6a('0xc')]);router[_0xfb6a('0x8')](_0xfb6a('0xd'),auth[_0xfb6a('0xb')](),controller[_0xfb6a('0xe')]);router[_0xfb6a('0x8')]('/:id/descriptions',auth[_0xfb6a('0xb')](),controller[_0xfb6a('0xf')]);router[_0xfb6a('0x8')](_0xfb6a('0x10'),auth[_0xfb6a('0xb')](),controller[_0xfb6a('0x11')]);router[_0xfb6a('0x12')]('/',auth['isAuthenticated'](),controller[_0xfb6a('0x13')]);router[_0xfb6a('0x14')](_0xfb6a('0xa'),auth[_0xfb6a('0xb')](),controller[_0xfb6a('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xfb6a('0x16')]);module['exports']=router; \ No newline at end of file +var _0x38c6=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields'];(function(_0x21f88f,_0x48cfba){var _0x3b9ff5=function(_0x292aee){while(--_0x292aee){_0x21f88f['push'](_0x21f88f['shift']());}};_0x3b9ff5(++_0x48cfba);}(_0x38c6,0x18d));var _0x638c=function(_0x5ab238,_0x4ddda9){_0x5ab238=_0x5ab238-0x0;var _0x236db6=_0x38c6[_0x5ab238];return _0x236db6;};'use strict';var multer=require(_0x638c('0x0'));var util=require('util');var path=require(_0x638c('0x1'));var timeout=require(_0x638c('0x2'));var express=require(_0x638c('0x3'));var router=express[_0x638c('0x4')]();var auth=require(_0x638c('0x5'));var interaction=require(_0x638c('0x6'));var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router[_0x638c('0x7')]('/',auth[_0x638c('0x8')](),controller[_0x638c('0x9')]);router[_0x638c('0x7')](_0x638c('0xa'),auth['isAuthenticated'](),controller[_0x638c('0xb')]);router['get']('/:id/subjects',auth[_0x638c('0x8')](),controller[_0x638c('0xc')]);router[_0x638c('0x7')](_0x638c('0xd'),auth[_0x638c('0x8')](),controller[_0x638c('0xe')]);router[_0x638c('0x7')](_0x638c('0xf'),auth[_0x638c('0x8')](),controller[_0x638c('0x10')]);router['post']('/',auth[_0x638c('0x8')](),controller[_0x638c('0x11')]);router[_0x638c('0x12')](_0x638c('0xa'),auth[_0x638c('0x8')](),controller[_0x638c('0x13')]);router[_0x638c('0x14')](_0x638c('0xa'),auth[_0x638c('0x8')](),controller[_0x638c('0x15')]);module[_0x638c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 16167b7..f2aed6a 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 _0x69eb=['sequelize'];(function(_0x91f712,_0x43e20e){var _0xcc7a42=function(_0x314f71){while(--_0x314f71){_0x91f712['push'](_0x91f712['shift']());}};_0xcc7a42(++_0x43e20e);}(_0x69eb,0x179));var _0xb69e=function(_0x1c8ed3,_0x4d64b1){_0x1c8ed3=_0x1c8ed3-0x0;var _0xd802=_0x69eb[_0x1c8ed3];return _0xd802;};'use strict';var Sequelize=require(_0xb69e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaf27=['exports','STRING','sequelize'];(function(_0x5f23d9,_0x431d9a){var _0x68fb9e=function(_0x1b9717){while(--_0x1b9717){_0x5f23d9['push'](_0x5f23d9['shift']());}};_0x68fb9e(++_0x431d9a);}(_0xaf27,0x1a9));var _0x7af2=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xaf27[_0x9aada2];return _0x196dff;};'use strict';var Sequelize=require(_0x7af2('0x0'));module[_0x7af2('0x1')]={'name':{'type':Sequelize[_0x7af2('0x2')]},'description':{'type':Sequelize[_0x7af2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index e957f0b..be47438 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 _0x8541=['merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','intersection','options','find','create','body','getSubjects','findOne','getDescriptions','FreshsalesField','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','name','send','index','map','FreshsalesConfiguration','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter'];(function(_0x33b526,_0x154c90){var _0x2ac44a=function(_0x465b29){while(--_0x465b29){_0x33b526['push'](_0x33b526['shift']());}};_0x2ac44a(++_0x154c90);}(_0x8541,0x18b));var _0x1854=function(_0x1bc836,_0x7dd56){_0x1bc836=_0x1bc836-0x0;var _0x59aa1c=_0x8541[_0x1bc836];return _0x59aa1c;};'use strict';var pdf=require(_0x1854('0x0'));var emlformat=require(_0x1854('0x1'));var rimraf=require(_0x1854('0x2'));var zipdir=require(_0x1854('0x3'));var jsonpatch=require(_0x1854('0x4'));var rp=require(_0x1854('0x5'));var moment=require('moment');var BPromise=require(_0x1854('0x6'));var Mustache=require(_0x1854('0x7'));var util=require(_0x1854('0x8'));var path=require('path');var sox=require(_0x1854('0x9'));var csv=require(_0x1854('0xa'));var ejs=require(_0x1854('0xb'));var fs=require('fs');var _=require(_0x1854('0xc'));var squel=require(_0x1854('0xd'));var crypto=require('crypto');var jsforce=require(_0x1854('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1854('0xa'));var querystring=require(_0x1854('0xf'));var Papa=require(_0x1854('0x10'));var Redis=require(_0x1854('0x11'));var authService=require(_0x1854('0x12'));var qs=require(_0x1854('0x13'));var as=require(_0x1854('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1854('0x15'));var utils=require('../../config/utils');var config=require(_0x1854('0x16'));var db=require(_0x1854('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x1854('0x18')][_0x1854('0x19')]({'port':0x232a});function checkPasswordPattern(_0x15132d,_0x516a95,_0x46b2e0){if(_0x46b2e0){var _0x5a7179=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5a7179[_0x1854('0x1a')](_0x516a95)){return _0x15132d;}else{throw new db[(_0x1854('0x1b'))][(_0x1854('0x1c'))](_0x1854('0x1d'));}}else{return _0x15132d;}}function respondWithRpcPromise(_0x13a5b2,_0x504e80,_0x5cf0fa,_0x5a7303){return new BPromise(function(_0x2f9f49,_0x55955e){var _0x45752d=_0x5a7303||client;return _0x45752d[_0x1854('0x1e')](_0x13a5b2,_0x5cf0fa)[_0x1854('0x1f')](function(_0x5344f0){logger['info'](_0x1854('0x20'),_0x504e80,'request\x20sent');logger[_0x1854('0x21')](_0x1854('0x22'),_0x504e80,_0x1854('0x23'),JSON['stringify'](_0x5344f0));if(_0x5344f0[_0x1854('0x24')]){if(_0x5344f0['error'][_0x1854('0x25')]===0x1f4){logger[_0x1854('0x24')](_0x1854('0x20'),_0x504e80,_0x5344f0[_0x1854('0x24')]['message']);return _0x55955e(_0x5344f0['error']['message']);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x504e80,_0x5344f0[_0x1854('0x24')]['message']);return _0x2f9f49(_0x5344f0[_0x1854('0x24')][_0x1854('0x26')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x504e80,_0x1854('0x23'));_0x2f9f49(_0x5344f0[_0x1854('0x27')]['message']);}})[_0x1854('0x28')](function(_0x50636c){logger[_0x1854('0x24')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x504e80,_0x50636c);_0x55955e(_0x50636c);});});}function respondWithStatusCode(_0x540142,_0x129979){_0x129979=_0x129979||0xcc;return function(_0x400844){if(_0x400844){return _0x540142[_0x1854('0x29')](_0x129979);}return _0x540142[_0x1854('0x2a')](_0x129979)[_0x1854('0x2b')]();};}function respondWithResult(_0x4eb164,_0x20195e){_0x20195e=_0x20195e||0xc8;return function(_0x250e12){if(_0x250e12){return _0x4eb164[_0x1854('0x2a')](_0x20195e)[_0x1854('0x2c')](_0x250e12);}};}function respondWithFilteredResult(_0x3ebb06,_0x3ff7cc){return function(_0x2b9682){if(_0x2b9682){var _0x4de758=_0x2b9682[_0x1854('0x2d')],_0x4c0a22=_0x3ff7cc['offset'],_0x241b1b=_0x3ff7cc[_0x1854('0x2e')]+_0x3ff7cc[_0x1854('0x2f')],_0x3222ca;if(_0x241b1b>=_0x4de758){_0x241b1b=_0x4de758;_0x3222ca=0xc8;}else{_0x3222ca=0xce;}_0x3ebb06[_0x1854('0x2a')](_0x3222ca);return _0x3ebb06[_0x1854('0x30')](_0x1854('0x31'),_0x4c0a22+'-'+_0x241b1b+'/'+_0x4de758)[_0x1854('0x2c')](_0x2b9682);}return null;};}function patchUpdates(_0x208e66){return function(_0x3f7e6e){try{jsonpatch[_0x1854('0x32')](_0x3f7e6e,_0x208e66,!![]);}catch(_0x3b79b0){return BPromise['reject'](_0x3b79b0);}return _0x3f7e6e[_0x1854('0x33')]();};}function saveUpdates(_0x1410b4,_0x249505){return function(_0xff0a2a){if(_0xff0a2a){return _0xff0a2a[_0x1854('0x34')](_0x1410b4)['then'](function(_0x250010){return _0x250010;});}return null;};}function removeEntity(_0x3af52a,_0x441d5){return function(_0x553cc0){if(_0x553cc0){return _0x553cc0[_0x1854('0x35')]()[_0x1854('0x1f')](function(){_0x3af52a[_0x1854('0x2a')](0xcc)[_0x1854('0x2b')]();});}};}function handleEntityNotFound(_0x3dd570,_0x8cc933){return function(_0x3b5eec){if(!_0x3b5eec){_0x3dd570[_0x1854('0x29')](0x194);}return _0x3b5eec;};}function handleError(_0x2c3d18,_0x1c3408){_0x1c3408=_0x1c3408||0x1f4;return function(_0x5a2d60){logger['error'](_0x5a2d60['stack']);if(_0x5a2d60[_0x1854('0x36')]){delete _0x5a2d60[_0x1854('0x36')];}_0x2c3d18[_0x1854('0x2a')](_0x1c3408)[_0x1854('0x37')](_0x5a2d60);};}exports[_0x1854('0x38')]=function(_0xf8b9f5,_0x4c92ad){var _0x515b36={},_0x26faf3={},_0x32ba8d={'count':0x0,'rows':[]};var _0x14d85a=_[_0x1854('0x39')](db[_0x1854('0x3a')]['rawAttributes'],function(_0x2a4000){return{'name':_0x2a4000['fieldName'],'type':_0x2a4000[_0x1854('0x3b')][_0x1854('0x3c')]};});_0x26faf3[_0x1854('0x3d')]=_['map'](_0x14d85a,_0x1854('0x36'));_0x26faf3[_0x1854('0x3e')]=_[_0x1854('0x3f')](_0xf8b9f5[_0x1854('0x3e')]);_0x26faf3['filters']=_['intersection'](_0x26faf3[_0x1854('0x3d')],_0x26faf3[_0x1854('0x3e')]);_0x515b36[_0x1854('0x40')]=_['intersection'](_0x26faf3[_0x1854('0x3d')],qs[_0x1854('0x41')](_0xf8b9f5['query'][_0x1854('0x41')]));_0x515b36[_0x1854('0x40')]=_0x515b36[_0x1854('0x40')][_0x1854('0x42')]?_0x515b36[_0x1854('0x40')]:_0x26faf3[_0x1854('0x3d')];if(!_0xf8b9f5[_0x1854('0x3e')][_0x1854('0x43')](_0x1854('0x44'))){_0x515b36[_0x1854('0x2f')]=qs[_0x1854('0x2f')](_0xf8b9f5['query'][_0x1854('0x2f')]);_0x515b36[_0x1854('0x2e')]=qs[_0x1854('0x2e')](_0xf8b9f5[_0x1854('0x3e')][_0x1854('0x2e')]);}_0x515b36[_0x1854('0x45')]=qs[_0x1854('0x46')](_0xf8b9f5[_0x1854('0x3e')][_0x1854('0x46')]);_0x515b36[_0x1854('0x47')]=qs[_0x1854('0x48')](_[_0x1854('0x49')](_0xf8b9f5['query'],_0x26faf3[_0x1854('0x48')]),_0x14d85a);if(_0xf8b9f5['query'][_0x1854('0x4a')]){_0x515b36[_0x1854('0x47')]=_[_0x1854('0x4b')](_0x515b36['where'],{'$or':_['map'](_0x14d85a,function(_0x176118){if(_0x176118['type']!==_0x1854('0x4c')){var _0x2312ef={};_0x2312ef[_0x176118[_0x1854('0x36')]]={'$like':'%'+_0xf8b9f5[_0x1854('0x3e')][_0x1854('0x4a')]+'%'};return _0x2312ef;}})});}_0x515b36=_[_0x1854('0x4b')]({},_0x515b36,_0xf8b9f5['options']);var _0x1b0126={'where':_0x515b36[_0x1854('0x47')]};return db[_0x1854('0x3a')][_0x1854('0x2d')](_0x1b0126)['then'](function(_0x9c070d){_0x32ba8d[_0x1854('0x2d')]=_0x9c070d;if(_0xf8b9f5[_0x1854('0x3e')][_0x1854('0x4d')]){_0x515b36[_0x1854('0x4e')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x1854('0x4f')](_0x515b36);})['then'](function(_0x51f423){_0x32ba8d[_0x1854('0x50')]=_0x51f423;return _0x32ba8d;})[_0x1854('0x1f')](respondWithFilteredResult(_0x4c92ad,_0x515b36))[_0x1854('0x28')](handleError(_0x4c92ad,null));};exports[_0x1854('0x51')]=function(_0x48f638,_0x99989e){var _0x310512={'raw':![],'where':{'id':_0x48f638[_0x1854('0x52')]['id']}},_0x4e3ed9={};_0x4e3ed9[_0x1854('0x3d')]=_[_0x1854('0x3f')](db[_0x1854('0x3a')][_0x1854('0x53')]);_0x4e3ed9['query']=_[_0x1854('0x3f')](_0x48f638['query']);_0x4e3ed9['filters']=_[_0x1854('0x54')](_0x4e3ed9[_0x1854('0x3d')],_0x4e3ed9['query']);_0x310512[_0x1854('0x40')]=_[_0x1854('0x54')](_0x4e3ed9[_0x1854('0x3d')],qs['fields'](_0x48f638[_0x1854('0x3e')][_0x1854('0x41')]));_0x310512[_0x1854('0x40')]=_0x310512[_0x1854('0x40')][_0x1854('0x42')]?_0x310512['attributes']:_0x4e3ed9[_0x1854('0x3d')];if(_0x48f638['query'][_0x1854('0x4d')]){_0x310512['include']=[{'all':!![]}];}_0x310512=_['merge']({},_0x310512,_0x48f638[_0x1854('0x55')]);return db[_0x1854('0x3a')][_0x1854('0x56')](_0x310512)[_0x1854('0x1f')](handleEntityNotFound(_0x99989e,null))[_0x1854('0x1f')](respondWithResult(_0x99989e,null))['catch'](handleError(_0x99989e,null));};exports[_0x1854('0x57')]=function(_0x30ce73,_0x19148c){return db[_0x1854('0x3a')][_0x1854('0x57')](_0x30ce73[_0x1854('0x58')],{})['then'](respondWithResult(_0x19148c,0xc9))[_0x1854('0x28')](handleError(_0x19148c,null));};exports[_0x1854('0x34')]=function(_0x1a3e05,_0x41375f){if(_0x1a3e05['body']['id']){delete _0x1a3e05[_0x1854('0x58')]['id'];}return db['FreshsalesConfiguration'][_0x1854('0x56')]({'where':{'id':_0x1a3e05[_0x1854('0x52')]['id']}})[_0x1854('0x1f')](handleEntityNotFound(_0x41375f,null))[_0x1854('0x1f')](saveUpdates(_0x1a3e05['body'],null))['then'](respondWithResult(_0x41375f,null))['catch'](handleError(_0x41375f,null));};exports[_0x1854('0x35')]=function(_0x5705cf,_0x3644dc){return db[_0x1854('0x3a')][_0x1854('0x56')]({'where':{'id':_0x5705cf['params']['id']}})['then'](handleEntityNotFound(_0x3644dc,null))[_0x1854('0x1f')](removeEntity(_0x3644dc,null))['catch'](handleError(_0x3644dc,null));};exports[_0x1854('0x59')]=function(_0x5596b3,_0xaa7dd3,_0x7b2d97){var _0x22f767={};var _0x1b8782={};var _0x2c262d;var _0x5e1d9d;return db[_0x1854('0x3a')][_0x1854('0x5a')]({'where':{'id':_0x5596b3[_0x1854('0x52')]['id']}})[_0x1854('0x1f')](handleEntityNotFound(_0xaa7dd3,null))[_0x1854('0x1f')](function(_0x1f9ac6){if(_0x1f9ac6){_0x2c262d=_0x1f9ac6;_0x1b8782[_0x1854('0x3d')]=_[_0x1854('0x3f')](db['FreshsalesField']['rawAttributes']);_0x1b8782[_0x1854('0x3e')]=_[_0x1854('0x3f')](_0x5596b3[_0x1854('0x3e')]);_0x1b8782[_0x1854('0x48')]=_[_0x1854('0x54')](_0x1b8782[_0x1854('0x3d')],_0x1b8782['query']);_0x22f767[_0x1854('0x40')]=_[_0x1854('0x54')](_0x1b8782['model'],qs[_0x1854('0x41')](_0x5596b3[_0x1854('0x3e')][_0x1854('0x41')]));_0x22f767[_0x1854('0x40')]=_0x22f767['attributes']['length']?_0x22f767[_0x1854('0x40')]:_0x1b8782[_0x1854('0x3d')];_0x22f767['order']=qs['sort'](_0x5596b3[_0x1854('0x3e')]['sort']);_0x22f767[_0x1854('0x47')]=qs[_0x1854('0x48')](_[_0x1854('0x49')](_0x5596b3[_0x1854('0x3e')],_0x1b8782['filters']));if(_0x5596b3[_0x1854('0x3e')][_0x1854('0x4a')]){_0x22f767[_0x1854('0x47')]=_[_0x1854('0x4b')](_0x22f767[_0x1854('0x47')],{'$or':_[_0x1854('0x39')](_0x22f767['attributes'],function(_0x314e9f){var _0x4224c7={};_0x4224c7[_0x314e9f]={'$like':'%'+_0x5596b3[_0x1854('0x3e')][_0x1854('0x4a')]+'%'};return _0x4224c7;})});}_0x22f767=_[_0x1854('0x4b')]({},_0x22f767,_0x5596b3[_0x1854('0x55')]);return _0x2c262d[_0x1854('0x59')](_0x22f767);}})['then'](function(_0x4f7e81){if(_0x4f7e81){_0x5e1d9d=_0x4f7e81[_0x1854('0x42')];if(!_0x5596b3[_0x1854('0x3e')][_0x1854('0x43')]('nolimit')){_0x22f767['limit']=qs[_0x1854('0x2f')](_0x5596b3[_0x1854('0x3e')][_0x1854('0x2f')]);_0x22f767[_0x1854('0x2e')]=qs['offset'](_0x5596b3[_0x1854('0x3e')][_0x1854('0x2e')]);}return _0x2c262d['getSubjects'](_0x22f767);}})['then'](function(_0x2b4c0b){if(_0x2b4c0b){return _0x2b4c0b?{'count':_0x5e1d9d,'rows':_0x2b4c0b}:null;}})['then'](respondWithResult(_0xaa7dd3,null))[_0x1854('0x28')](handleError(_0xaa7dd3,null));};exports[_0x1854('0x5b')]=function(_0x3fe210,_0x42fdbf,_0x433d17){var _0x5380b2={};var _0x220809={};var _0x2cb6ca;var _0x39ad15;return db[_0x1854('0x3a')][_0x1854('0x5a')]({'where':{'id':_0x3fe210[_0x1854('0x52')]['id']}})['then'](handleEntityNotFound(_0x42fdbf,null))['then'](function(_0x36b6e1){if(_0x36b6e1){_0x2cb6ca=_0x36b6e1;_0x220809['model']=_[_0x1854('0x3f')](db[_0x1854('0x5c')][_0x1854('0x53')]);_0x220809[_0x1854('0x3e')]=_[_0x1854('0x3f')](_0x3fe210['query']);_0x220809[_0x1854('0x48')]=_[_0x1854('0x54')](_0x220809[_0x1854('0x3d')],_0x220809['query']);_0x5380b2[_0x1854('0x40')]=_[_0x1854('0x54')](_0x220809[_0x1854('0x3d')],qs['fields'](_0x3fe210['query']['fields']));_0x5380b2[_0x1854('0x40')]=_0x5380b2[_0x1854('0x40')]['length']?_0x5380b2[_0x1854('0x40')]:_0x220809[_0x1854('0x3d')];_0x5380b2[_0x1854('0x45')]=qs[_0x1854('0x46')](_0x3fe210[_0x1854('0x3e')][_0x1854('0x46')]);_0x5380b2['where']=qs[_0x1854('0x48')](_[_0x1854('0x49')](_0x3fe210[_0x1854('0x3e')],_0x220809[_0x1854('0x48')]));if(_0x3fe210[_0x1854('0x3e')][_0x1854('0x4a')]){_0x5380b2[_0x1854('0x47')]=_[_0x1854('0x4b')](_0x5380b2[_0x1854('0x47')],{'$or':_[_0x1854('0x39')](_0x5380b2[_0x1854('0x40')],function(_0xdccb3f){var _0x27aa0e={};_0x27aa0e[_0xdccb3f]={'$like':'%'+_0x3fe210[_0x1854('0x3e')][_0x1854('0x4a')]+'%'};return _0x27aa0e;})});}_0x5380b2=_[_0x1854('0x4b')]({},_0x5380b2,_0x3fe210[_0x1854('0x55')]);return _0x2cb6ca[_0x1854('0x5b')](_0x5380b2);}})[_0x1854('0x1f')](function(_0x183b28){if(_0x183b28){_0x39ad15=_0x183b28[_0x1854('0x42')];if(!_0x3fe210[_0x1854('0x3e')][_0x1854('0x43')]('nolimit')){_0x5380b2[_0x1854('0x2f')]=qs[_0x1854('0x2f')](_0x3fe210[_0x1854('0x3e')][_0x1854('0x2f')]);_0x5380b2[_0x1854('0x2e')]=qs[_0x1854('0x2e')](_0x3fe210[_0x1854('0x3e')][_0x1854('0x2e')]);}return _0x2cb6ca[_0x1854('0x5b')](_0x5380b2);}})[_0x1854('0x1f')](function(_0x5392c9){if(_0x5392c9){return _0x5392c9?{'count':_0x39ad15,'rows':_0x5392c9}:null;}})[_0x1854('0x1f')](respondWithResult(_0x42fdbf,null))[_0x1854('0x28')](handleError(_0x42fdbf,null));};exports[_0x1854('0x5d')]=function(_0x374388,_0x283a14,_0x4fc6b6){var _0x4cc48c={};var _0x50fd59={};var _0xdbe397;var _0x454f08;return db[_0x1854('0x3a')][_0x1854('0x5a')]({'where':{'id':_0x374388[_0x1854('0x52')]['id']}})[_0x1854('0x1f')](handleEntityNotFound(_0x283a14,null))['then'](function(_0xf59b53){if(_0xf59b53){_0xdbe397=_0xf59b53;_0x50fd59['model']=_[_0x1854('0x3f')](db['FreshsalesField'][_0x1854('0x53')]);_0x50fd59['query']=_['keys'](_0x374388[_0x1854('0x3e')]);_0x50fd59[_0x1854('0x48')]=_[_0x1854('0x54')](_0x50fd59[_0x1854('0x3d')],_0x50fd59['query']);_0x4cc48c[_0x1854('0x40')]=_[_0x1854('0x54')](_0x50fd59['model'],qs[_0x1854('0x41')](_0x374388['query'][_0x1854('0x41')]));_0x4cc48c[_0x1854('0x40')]=_0x4cc48c[_0x1854('0x40')][_0x1854('0x42')]?_0x4cc48c[_0x1854('0x40')]:_0x50fd59[_0x1854('0x3d')];_0x4cc48c['order']=qs['sort'](_0x374388['query'][_0x1854('0x46')]);_0x4cc48c[_0x1854('0x47')]=qs[_0x1854('0x48')](_[_0x1854('0x49')](_0x374388['query'],_0x50fd59[_0x1854('0x48')]));if(_0x374388[_0x1854('0x3e')]['filter']){_0x4cc48c[_0x1854('0x47')]=_[_0x1854('0x4b')](_0x4cc48c['where'],{'$or':_[_0x1854('0x39')](_0x4cc48c['attributes'],function(_0x2cbdc8){var _0x2c2eb2={};_0x2c2eb2[_0x2cbdc8]={'$like':'%'+_0x374388['query'][_0x1854('0x4a')]+'%'};return _0x2c2eb2;})});}_0x4cc48c=_[_0x1854('0x4b')]({},_0x4cc48c,_0x374388[_0x1854('0x55')]);return _0xdbe397['getFields'](_0x4cc48c);}})[_0x1854('0x1f')](function(_0x5b31f6){if(_0x5b31f6){_0x454f08=_0x5b31f6[_0x1854('0x42')];if(!_0x374388[_0x1854('0x3e')][_0x1854('0x43')](_0x1854('0x44'))){_0x4cc48c['limit']=qs[_0x1854('0x2f')](_0x374388[_0x1854('0x3e')]['limit']);_0x4cc48c['offset']=qs[_0x1854('0x2e')](_0x374388[_0x1854('0x3e')][_0x1854('0x2e')]);}return _0xdbe397[_0x1854('0x5d')](_0x4cc48c);}})[_0x1854('0x1f')](function(_0x4bf7ec){if(_0x4bf7ec){return _0x4bf7ec?{'count':_0x454f08,'rows':_0x4bf7ec}:null;}})['then'](respondWithResult(_0x283a14,null))[_0x1854('0x28')](handleError(_0x283a14,null));}; \ No newline at end of file +var _0x3435=['VIRTUAL','filter','options','include','rows','catch','show','keys','includeAll','find','create','body','params','findOne','FreshsalesField','getSubjects','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','then','destroy','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge'];(function(_0x53ba8d,_0x57e612){var _0x34b711=function(_0x211dc2){while(--_0x211dc2){_0x53ba8d['push'](_0x53ba8d['shift']());}};_0x34b711(++_0x57e612);}(_0x3435,0x70));var _0x5343=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0x3435[_0x33554b];return _0x256954;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5343('0x0'));var rimraf=require(_0x5343('0x1'));var zipdir=require(_0x5343('0x2'));var jsonpatch=require(_0x5343('0x3'));var rp=require(_0x5343('0x4'));var moment=require(_0x5343('0x5'));var BPromise=require(_0x5343('0x6'));var Mustache=require(_0x5343('0x7'));var util=require(_0x5343('0x8'));var path=require(_0x5343('0x9'));var sox=require('sox');var csv=require(_0x5343('0xa'));var ejs=require(_0x5343('0xb'));var fs=require('fs');var _=require(_0x5343('0xc'));var squel=require(_0x5343('0xd'));var crypto=require(_0x5343('0xe'));var jsforce=require(_0x5343('0xf'));var deskjs=require(_0x5343('0x10'));var toCsv=require(_0x5343('0xa'));var querystring=require(_0x5343('0x11'));var Papa=require(_0x5343('0x12'));var Redis=require(_0x5343('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5343('0x14'));var as=require(_0x5343('0x15'));var hardwareService=require(_0x5343('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x5343('0x17'));var db=require(_0x5343('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x5343('0x19')][_0x5343('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x1a77f9,_0x4a7fd0,_0x1528a1){if(_0x1528a1){var _0x5acaf4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5acaf4[_0x5343('0x1b')](_0x4a7fd0)){return _0x1a77f9;}else{throw new db[(_0x5343('0x1c'))][(_0x5343('0x1d'))](_0x5343('0x1e'));}}else{return _0x1a77f9;}}function respondWithRpcPromise(_0x5e0c96,_0x5625cb,_0x4c497d,_0x42d6b9){return new BPromise(function(_0x1a0be4,_0x18c82b){var _0x1ff761=_0x42d6b9||client;return _0x1ff761['request'](_0x5e0c96,_0x4c497d)['then'](function(_0x5162a7){logger[_0x5343('0x1f')](_0x5343('0x20'),_0x5625cb,_0x5343('0x21'));logger[_0x5343('0x22')](_0x5343('0x23'),_0x5625cb,'request\x20sent',JSON[_0x5343('0x24')](_0x5162a7));if(_0x5162a7[_0x5343('0x25')]){if(_0x5162a7[_0x5343('0x25')][_0x5343('0x26')]===0x1f4){logger[_0x5343('0x25')](_0x5343('0x20'),_0x5625cb,_0x5162a7['error']['message']);return _0x18c82b(_0x5162a7[_0x5343('0x25')]['message']);}logger[_0x5343('0x25')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5625cb,_0x5162a7[_0x5343('0x25')][_0x5343('0x27')]);return _0x1a0be4(_0x5162a7[_0x5343('0x25')][_0x5343('0x27')]);}else{logger['info'](_0x5343('0x20'),_0x5625cb,'request\x20sent');_0x1a0be4(_0x5162a7[_0x5343('0x28')][_0x5343('0x27')]);}})['catch'](function(_0xbca74c){logger[_0x5343('0x25')](_0x5343('0x20'),_0x5625cb,_0xbca74c);_0x18c82b(_0xbca74c);});});}function respondWithStatusCode(_0x28598e,_0x456ddc){_0x456ddc=_0x456ddc||0xcc;return function(_0x1c0c6c){if(_0x1c0c6c){return _0x28598e[_0x5343('0x29')](_0x456ddc);}return _0x28598e[_0x5343('0x2a')](_0x456ddc)[_0x5343('0x2b')]();};}function respondWithResult(_0x33f58a,_0x19e780){_0x19e780=_0x19e780||0xc8;return function(_0x4e9280){if(_0x4e9280){return _0x33f58a[_0x5343('0x2a')](_0x19e780)[_0x5343('0x2c')](_0x4e9280);}};}function respondWithFilteredResult(_0x3c0531,_0x5b4095){return function(_0x59f42a){if(_0x59f42a){var _0x182d68=_0x59f42a[_0x5343('0x2d')],_0x48bedd=_0x5b4095[_0x5343('0x2e')],_0x14c1ca=_0x5b4095[_0x5343('0x2e')]+_0x5b4095[_0x5343('0x2f')],_0x5f3df9;if(_0x14c1ca>=_0x182d68){_0x14c1ca=_0x182d68;_0x5f3df9=0xc8;}else{_0x5f3df9=0xce;}_0x3c0531['status'](_0x5f3df9);return _0x3c0531['set'](_0x5343('0x30'),_0x48bedd+'-'+_0x14c1ca+'/'+_0x182d68)[_0x5343('0x2c')](_0x59f42a);}return null;};}function patchUpdates(_0x2bafd2){return function(_0x46e414){try{jsonpatch['apply'](_0x46e414,_0x2bafd2,!![]);}catch(_0xba81d8){return BPromise[_0x5343('0x31')](_0xba81d8);}return _0x46e414['save']();};}function saveUpdates(_0x72e414,_0x1a5171){return function(_0x118795){if(_0x118795){return _0x118795['update'](_0x72e414)[_0x5343('0x32')](function(_0x1229d7){return _0x1229d7;});}return null;};}function removeEntity(_0x3f3843,_0x4f43bd){return function(_0x4dee7b){if(_0x4dee7b){return _0x4dee7b[_0x5343('0x33')]()[_0x5343('0x32')](function(){_0x3f3843[_0x5343('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x454dc7,_0x2b9af1){return function(_0x1ef1bb){if(!_0x1ef1bb){_0x454dc7[_0x5343('0x29')](0x194);}return _0x1ef1bb;};}function handleError(_0xb09e31,_0x5d23f8){_0x5d23f8=_0x5d23f8||0x1f4;return function(_0x57f115){logger[_0x5343('0x25')](_0x57f115[_0x5343('0x34')]);if(_0x57f115['name']){delete _0x57f115[_0x5343('0x35')];}_0xb09e31['status'](_0x5d23f8)[_0x5343('0x36')](_0x57f115);};}exports[_0x5343('0x37')]=function(_0x3b4341,_0x224c9f){var _0xed4d95={},_0x1977f7={},_0x53737b={'count':0x0,'rows':[]};var _0x11c0bf=_[_0x5343('0x38')](db[_0x5343('0x39')][_0x5343('0x3a')],function(_0x20b1f9){return{'name':_0x20b1f9[_0x5343('0x3b')],'type':_0x20b1f9[_0x5343('0x3c')][_0x5343('0x3d')]};});_0x1977f7[_0x5343('0x3e')]=_[_0x5343('0x38')](_0x11c0bf,'name');_0x1977f7[_0x5343('0x3f')]=_['keys'](_0x3b4341[_0x5343('0x3f')]);_0x1977f7[_0x5343('0x40')]=_[_0x5343('0x41')](_0x1977f7[_0x5343('0x3e')],_0x1977f7['query']);_0xed4d95[_0x5343('0x42')]=_['intersection'](_0x1977f7[_0x5343('0x3e')],qs['fields'](_0x3b4341[_0x5343('0x3f')][_0x5343('0x43')]));_0xed4d95[_0x5343('0x42')]=_0xed4d95['attributes'][_0x5343('0x44')]?_0xed4d95['attributes']:_0x1977f7[_0x5343('0x3e')];if(!_0x3b4341[_0x5343('0x3f')][_0x5343('0x45')](_0x5343('0x46'))){_0xed4d95['limit']=qs[_0x5343('0x2f')](_0x3b4341['query'][_0x5343('0x2f')]);_0xed4d95[_0x5343('0x2e')]=qs['offset'](_0x3b4341[_0x5343('0x3f')][_0x5343('0x2e')]);}_0xed4d95[_0x5343('0x47')]=qs[_0x5343('0x48')](_0x3b4341['query']['sort']);_0xed4d95[_0x5343('0x49')]=qs[_0x5343('0x40')](_[_0x5343('0x4a')](_0x3b4341[_0x5343('0x3f')],_0x1977f7['filters']),_0x11c0bf);if(_0x3b4341[_0x5343('0x3f')]['filter']){_0xed4d95[_0x5343('0x49')]=_[_0x5343('0x4b')](_0xed4d95[_0x5343('0x49')],{'$or':_[_0x5343('0x38')](_0x11c0bf,function(_0x4db77c){if(_0x4db77c[_0x5343('0x3c')]!==_0x5343('0x4c')){var _0x3b02cc={};_0x3b02cc[_0x4db77c[_0x5343('0x35')]]={'$like':'%'+_0x3b4341[_0x5343('0x3f')][_0x5343('0x4d')]+'%'};return _0x3b02cc;}})});}_0xed4d95=_[_0x5343('0x4b')]({},_0xed4d95,_0x3b4341[_0x5343('0x4e')]);var _0x27ce27={'where':_0xed4d95[_0x5343('0x49')]};return db[_0x5343('0x39')][_0x5343('0x2d')](_0x27ce27)['then'](function(_0x3b93cc){_0x53737b[_0x5343('0x2d')]=_0x3b93cc;if(_0x3b4341[_0x5343('0x3f')]['includeAll']){_0xed4d95[_0x5343('0x4f')]=[{'all':!![]}];}return db[_0x5343('0x39')]['findAll'](_0xed4d95);})[_0x5343('0x32')](function(_0x5a86a3){_0x53737b[_0x5343('0x50')]=_0x5a86a3;return _0x53737b;})[_0x5343('0x32')](respondWithFilteredResult(_0x224c9f,_0xed4d95))[_0x5343('0x51')](handleError(_0x224c9f,null));};exports[_0x5343('0x52')]=function(_0x4bf4b5,_0x1a670c){var _0x3342c4={'raw':![],'where':{'id':_0x4bf4b5['params']['id']}},_0x4ca6c0={};_0x4ca6c0['model']=_[_0x5343('0x53')](db['FreshsalesConfiguration']['rawAttributes']);_0x4ca6c0[_0x5343('0x3f')]=_['keys'](_0x4bf4b5[_0x5343('0x3f')]);_0x4ca6c0['filters']=_[_0x5343('0x41')](_0x4ca6c0[_0x5343('0x3e')],_0x4ca6c0[_0x5343('0x3f')]);_0x3342c4[_0x5343('0x42')]=_[_0x5343('0x41')](_0x4ca6c0[_0x5343('0x3e')],qs[_0x5343('0x43')](_0x4bf4b5[_0x5343('0x3f')][_0x5343('0x43')]));_0x3342c4[_0x5343('0x42')]=_0x3342c4[_0x5343('0x42')][_0x5343('0x44')]?_0x3342c4[_0x5343('0x42')]:_0x4ca6c0[_0x5343('0x3e')];if(_0x4bf4b5[_0x5343('0x3f')][_0x5343('0x54')]){_0x3342c4['include']=[{'all':!![]}];}_0x3342c4=_[_0x5343('0x4b')]({},_0x3342c4,_0x4bf4b5[_0x5343('0x4e')]);return db[_0x5343('0x39')][_0x5343('0x55')](_0x3342c4)['then'](handleEntityNotFound(_0x1a670c,null))[_0x5343('0x32')](respondWithResult(_0x1a670c,null))[_0x5343('0x51')](handleError(_0x1a670c,null));};exports[_0x5343('0x56')]=function(_0x9cba09,_0x30b0db){return db[_0x5343('0x39')][_0x5343('0x56')](_0x9cba09[_0x5343('0x57')],{})[_0x5343('0x32')](respondWithResult(_0x30b0db,0xc9))[_0x5343('0x51')](handleError(_0x30b0db,null));};exports['update']=function(_0x4d421c,_0x2ba295){if(_0x4d421c[_0x5343('0x57')]['id']){delete _0x4d421c[_0x5343('0x57')]['id'];}return db['FreshsalesConfiguration']['find']({'where':{'id':_0x4d421c[_0x5343('0x58')]['id']}})[_0x5343('0x32')](handleEntityNotFound(_0x2ba295,null))[_0x5343('0x32')](saveUpdates(_0x4d421c[_0x5343('0x57')],null))[_0x5343('0x32')](respondWithResult(_0x2ba295,null))[_0x5343('0x51')](handleError(_0x2ba295,null));};exports[_0x5343('0x33')]=function(_0x105c23,_0x367944){return db[_0x5343('0x39')][_0x5343('0x55')]({'where':{'id':_0x105c23['params']['id']}})['then'](handleEntityNotFound(_0x367944,null))['then'](removeEntity(_0x367944,null))[_0x5343('0x51')](handleError(_0x367944,null));};exports['getSubjects']=function(_0x8cad52,_0x1db4bb,_0x386026){var _0x3a53d3={};var _0x4ee3bf={};var _0x3e8c81;var _0x3b2c83;return db[_0x5343('0x39')][_0x5343('0x59')]({'where':{'id':_0x8cad52[_0x5343('0x58')]['id']}})[_0x5343('0x32')](handleEntityNotFound(_0x1db4bb,null))[_0x5343('0x32')](function(_0x11f758){if(_0x11f758){_0x3e8c81=_0x11f758;_0x4ee3bf[_0x5343('0x3e')]=_[_0x5343('0x53')](db[_0x5343('0x5a')][_0x5343('0x3a')]);_0x4ee3bf[_0x5343('0x3f')]=_[_0x5343('0x53')](_0x8cad52[_0x5343('0x3f')]);_0x4ee3bf[_0x5343('0x40')]=_[_0x5343('0x41')](_0x4ee3bf[_0x5343('0x3e')],_0x4ee3bf[_0x5343('0x3f')]);_0x3a53d3[_0x5343('0x42')]=_[_0x5343('0x41')](_0x4ee3bf[_0x5343('0x3e')],qs['fields'](_0x8cad52['query'][_0x5343('0x43')]));_0x3a53d3[_0x5343('0x42')]=_0x3a53d3[_0x5343('0x42')][_0x5343('0x44')]?_0x3a53d3[_0x5343('0x42')]:_0x4ee3bf['model'];_0x3a53d3[_0x5343('0x47')]=qs[_0x5343('0x48')](_0x8cad52[_0x5343('0x3f')][_0x5343('0x48')]);_0x3a53d3[_0x5343('0x49')]=qs[_0x5343('0x40')](_['pick'](_0x8cad52[_0x5343('0x3f')],_0x4ee3bf[_0x5343('0x40')]));if(_0x8cad52['query']['filter']){_0x3a53d3[_0x5343('0x49')]=_[_0x5343('0x4b')](_0x3a53d3[_0x5343('0x49')],{'$or':_[_0x5343('0x38')](_0x3a53d3[_0x5343('0x42')],function(_0x24cc6d){var _0x2eb061={};_0x2eb061[_0x24cc6d]={'$like':'%'+_0x8cad52[_0x5343('0x3f')][_0x5343('0x4d')]+'%'};return _0x2eb061;})});}_0x3a53d3=_['merge']({},_0x3a53d3,_0x8cad52['options']);return _0x3e8c81[_0x5343('0x5b')](_0x3a53d3);}})[_0x5343('0x32')](function(_0x5432cb){if(_0x5432cb){_0x3b2c83=_0x5432cb[_0x5343('0x44')];if(!_0x8cad52[_0x5343('0x3f')][_0x5343('0x45')]('nolimit')){_0x3a53d3[_0x5343('0x2f')]=qs[_0x5343('0x2f')](_0x8cad52[_0x5343('0x3f')][_0x5343('0x2f')]);_0x3a53d3[_0x5343('0x2e')]=qs[_0x5343('0x2e')](_0x8cad52['query']['offset']);}return _0x3e8c81['getSubjects'](_0x3a53d3);}})['then'](function(_0x2a90ee){if(_0x2a90ee){return _0x2a90ee?{'count':_0x3b2c83,'rows':_0x2a90ee}:null;}})['then'](respondWithResult(_0x1db4bb,null))[_0x5343('0x51')](handleError(_0x1db4bb,null));};exports['getDescriptions']=function(_0x3bd161,_0xab6ff6,_0x5e4bcf){var _0x2862d4={};var _0x1f2f78={};var _0x9be73;var _0x3c15f8;return db[_0x5343('0x39')][_0x5343('0x59')]({'where':{'id':_0x3bd161[_0x5343('0x58')]['id']}})[_0x5343('0x32')](handleEntityNotFound(_0xab6ff6,null))['then'](function(_0x22e208){if(_0x22e208){_0x9be73=_0x22e208;_0x1f2f78['model']=_[_0x5343('0x53')](db[_0x5343('0x5a')][_0x5343('0x3a')]);_0x1f2f78[_0x5343('0x3f')]=_['keys'](_0x3bd161[_0x5343('0x3f')]);_0x1f2f78['filters']=_['intersection'](_0x1f2f78['model'],_0x1f2f78[_0x5343('0x3f')]);_0x2862d4['attributes']=_[_0x5343('0x41')](_0x1f2f78['model'],qs[_0x5343('0x43')](_0x3bd161['query'][_0x5343('0x43')]));_0x2862d4[_0x5343('0x42')]=_0x2862d4['attributes'][_0x5343('0x44')]?_0x2862d4['attributes']:_0x1f2f78['model'];_0x2862d4[_0x5343('0x47')]=qs[_0x5343('0x48')](_0x3bd161['query'][_0x5343('0x48')]);_0x2862d4[_0x5343('0x49')]=qs['filters'](_[_0x5343('0x4a')](_0x3bd161[_0x5343('0x3f')],_0x1f2f78['filters']));if(_0x3bd161['query'][_0x5343('0x4d')]){_0x2862d4[_0x5343('0x49')]=_[_0x5343('0x4b')](_0x2862d4[_0x5343('0x49')],{'$or':_[_0x5343('0x38')](_0x2862d4['attributes'],function(_0xa5b4d0){var _0x4686a5={};_0x4686a5[_0xa5b4d0]={'$like':'%'+_0x3bd161['query'][_0x5343('0x4d')]+'%'};return _0x4686a5;})});}_0x2862d4=_['merge']({},_0x2862d4,_0x3bd161[_0x5343('0x4e')]);return _0x9be73[_0x5343('0x5c')](_0x2862d4);}})[_0x5343('0x32')](function(_0x3f0d5d){if(_0x3f0d5d){_0x3c15f8=_0x3f0d5d[_0x5343('0x44')];if(!_0x3bd161[_0x5343('0x3f')][_0x5343('0x45')](_0x5343('0x46'))){_0x2862d4[_0x5343('0x2f')]=qs[_0x5343('0x2f')](_0x3bd161['query']['limit']);_0x2862d4[_0x5343('0x2e')]=qs[_0x5343('0x2e')](_0x3bd161[_0x5343('0x3f')][_0x5343('0x2e')]);}return _0x9be73[_0x5343('0x5c')](_0x2862d4);}})[_0x5343('0x32')](function(_0x38e372){if(_0x38e372){return _0x38e372?{'count':_0x3c15f8,'rows':_0x38e372}:null;}})[_0x5343('0x32')](respondWithResult(_0xab6ff6,null))[_0x5343('0x51')](handleError(_0xab6ff6,null));};exports[_0x5343('0x5d')]=function(_0x6559a2,_0x5d3679,_0xdc2a5c){var _0x3548a4={};var _0x2a949a={};var _0x25c6a7;var _0x4a207c;return db['FreshsalesConfiguration'][_0x5343('0x59')]({'where':{'id':_0x6559a2[_0x5343('0x58')]['id']}})['then'](handleEntityNotFound(_0x5d3679,null))[_0x5343('0x32')](function(_0x5f1a06){if(_0x5f1a06){_0x25c6a7=_0x5f1a06;_0x2a949a['model']=_[_0x5343('0x53')](db[_0x5343('0x5a')]['rawAttributes']);_0x2a949a[_0x5343('0x3f')]=_[_0x5343('0x53')](_0x6559a2[_0x5343('0x3f')]);_0x2a949a[_0x5343('0x40')]=_[_0x5343('0x41')](_0x2a949a[_0x5343('0x3e')],_0x2a949a[_0x5343('0x3f')]);_0x3548a4[_0x5343('0x42')]=_[_0x5343('0x41')](_0x2a949a[_0x5343('0x3e')],qs[_0x5343('0x43')](_0x6559a2['query'][_0x5343('0x43')]));_0x3548a4['attributes']=_0x3548a4[_0x5343('0x42')][_0x5343('0x44')]?_0x3548a4[_0x5343('0x42')]:_0x2a949a['model'];_0x3548a4[_0x5343('0x47')]=qs[_0x5343('0x48')](_0x6559a2['query'][_0x5343('0x48')]);_0x3548a4[_0x5343('0x49')]=qs[_0x5343('0x40')](_[_0x5343('0x4a')](_0x6559a2['query'],_0x2a949a[_0x5343('0x40')]));if(_0x6559a2[_0x5343('0x3f')]['filter']){_0x3548a4['where']=_[_0x5343('0x4b')](_0x3548a4[_0x5343('0x49')],{'$or':_[_0x5343('0x38')](_0x3548a4[_0x5343('0x42')],function(_0x3a8ee1){var _0x52fe91={};_0x52fe91[_0x3a8ee1]={'$like':'%'+_0x6559a2[_0x5343('0x3f')][_0x5343('0x4d')]+'%'};return _0x52fe91;})});}_0x3548a4=_[_0x5343('0x4b')]({},_0x3548a4,_0x6559a2[_0x5343('0x4e')]);return _0x25c6a7[_0x5343('0x5d')](_0x3548a4);}})[_0x5343('0x32')](function(_0x1ea786){if(_0x1ea786){_0x4a207c=_0x1ea786['length'];if(!_0x6559a2[_0x5343('0x3f')][_0x5343('0x45')](_0x5343('0x46'))){_0x3548a4[_0x5343('0x2f')]=qs[_0x5343('0x2f')](_0x6559a2['query'][_0x5343('0x2f')]);_0x3548a4['offset']=qs[_0x5343('0x2e')](_0x6559a2[_0x5343('0x3f')]['offset']);}return _0x25c6a7[_0x5343('0x5d')](_0x3548a4);}})[_0x5343('0x32')](function(_0x36001b){if(_0x36001b){return _0x36001b?{'count':_0x4a207c,'rows':_0x36001b}:null;}})['then'](respondWithResult(_0x5d3679,null))[_0x5343('0x51')](handleError(_0x5d3679,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 36c3233..98a9205 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 _0x6499=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','FreshsalesConfiguration'];(function(_0x2eb253,_0x23c4c6){var _0x2aec19=function(_0x3a1b8e){while(--_0x3a1b8e){_0x2eb253['push'](_0x2eb253['shift']());}};_0x2aec19(++_0x23c4c6);}(_0x6499,0xe6));var _0x9649=function(_0x398c20,_0x32debb){_0x398c20=_0x398c20-0x0;var _0x1bb27a=_0x6499[_0x398c20];return _0x1bb27a;};'use strict';var _=require('lodash');var util=require(_0x9649('0x0'));var logger=require(_0x9649('0x1'))(_0x9649('0x2'));var moment=require(_0x9649('0x3'));var BPromise=require(_0x9649('0x4'));var rp=require(_0x9649('0x5'));var fs=require('fs');var path=require(_0x9649('0x6'));var rimraf=require('rimraf');var config=require(_0x9649('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x9649('0x8')]=function(_0x2719e2,_0x53fea9){return _0x2719e2['define'](_0x9649('0x9'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6318=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','int_freshsales_configurations','lodash','util','../../config/logger','api'];(function(_0x47e93d,_0x26bbdd){var _0xe86c46=function(_0x10e072){while(--_0x10e072){_0x47e93d['push'](_0x47e93d['shift']());}};_0xe86c46(++_0x26bbdd);}(_0x6318,0xa5));var _0x8631=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x6318[_0x4e9d3c];return _0x2d0825;};'use strict';var _=require(_0x8631('0x0'));var util=require(_0x8631('0x1'));var logger=require(_0x8631('0x2'))(_0x8631('0x3'));var moment=require(_0x8631('0x4'));var BPromise=require(_0x8631('0x5'));var rp=require(_0x8631('0x6'));var fs=require('fs');var path=require(_0x8631('0x7'));var rimraf=require(_0x8631('0x8'));var config=require(_0x8631('0x9'));var attributes=require(_0x8631('0xa'));module[_0x8631('0xb')]=function(_0x784c2b,_0x281a46){return _0x784c2b['define']('FreshsalesConfiguration',attributes,{'tableName':_0x8631('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 1e97770..f61bb52 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xda3f,0xec));var _0xfda3=function(_0x501a54,_0x1adb6d){_0x501a54=_0x501a54-0x0;var _0xb652dd=_0xda3f[_0x501a54];return _0xb652dd;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0x21f8=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x21f8,0x71));var _0x821f=function(_0x5cbace,_0x33943c){_0x5cbace=_0x5cbace-0x0;var _0x6de5b8=_0x21f8[_0x5cbace];return _0x6de5b8;};'use strict';var _=require(_0x821f('0x0'));var util=require(_0x821f('0x1'));var moment=require(_0x821f('0x2'));var BPromise=require(_0x821f('0x3'));var rs=require(_0x821f('0x4'));var fs=require('fs');var Redis=require(_0x821f('0x5'));var db=require(_0x821f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x821f('0x7'));var jayson=require(_0x821f('0x8'));var client=jayson[_0x821f('0x9')][_0x821f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cd13a,_0x3a42fe,_0x1b9945){return new BPromise(function(_0xfcb0a,_0x4e260d){return client['request'](_0x3cd13a,_0x1b9945)[_0x821f('0xb')](function(_0x15b547){logger[_0x821f('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3a42fe,_0x821f('0xd'));logger[_0x821f('0xe')](_0x821f('0xf'),_0x3a42fe,_0x821f('0xd'),JSON[_0x821f('0x10')](_0x15b547));if(_0x15b547[_0x821f('0x11')]){if(_0x15b547[_0x821f('0x11')][_0x821f('0x12')]===0x1f4){logger[_0x821f('0x11')](_0x821f('0x13'),_0x3a42fe,_0x15b547['error']['message']);return _0x4e260d(_0x15b547[_0x821f('0x11')][_0x821f('0x14')]);}logger[_0x821f('0x11')](_0x821f('0x13'),_0x3a42fe,_0x15b547[_0x821f('0x11')][_0x821f('0x14')]);return _0xfcb0a(_0x15b547[_0x821f('0x11')][_0x821f('0x14')]);}else{logger[_0x821f('0xc')](_0x821f('0x13'),_0x3a42fe,'request\x20sent');_0xfcb0a(_0x15b547[_0x821f('0x15')]['message']);}})[_0x821f('0x16')](function(_0x497c37){logger[_0x821f('0x11')](_0x821f('0x13'),_0x3a42fe,_0x497c37);_0x4e260d(_0x497c37);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 7005c79..a212b8a 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 _0x1160=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','exports','multer','util'];(function(_0x550d83,_0xa3aea4){var _0x5b5710=function(_0x166ca0){while(--_0x166ca0){_0x550d83['push'](_0x550d83['shift']());}};_0x5b5710(++_0xa3aea4);}(_0x1160,0x116));var _0x0116=function(_0x438fe1,_0x3308d5){_0x438fe1=_0x438fe1-0x0;var _0x3c8e1b=_0x1160[_0x438fe1];return _0x3c8e1b;};'use strict';var multer=require(_0x0116('0x0'));var util=require(_0x0116('0x1'));var path=require('path');var timeout=require(_0x0116('0x2'));var express=require(_0x0116('0x3'));var router=express[_0x0116('0x4')]();var auth=require(_0x0116('0x5'));var interaction=require(_0x0116('0x6'));var config=require(_0x0116('0x7'));var controller=require(_0x0116('0x8'));router[_0x0116('0x9')]('/',auth[_0x0116('0xa')](),controller['index']);router[_0x0116('0x9')]('/:id',auth[_0x0116('0xa')](),controller[_0x0116('0xb')]);router[_0x0116('0xc')]('/',auth['isAuthenticated'](),controller[_0x0116('0xd')]);router[_0x0116('0xe')]('/:id',auth[_0x0116('0xa')](),controller[_0x0116('0xf')]);router[_0x0116('0x10')](_0x0116('0x11'),auth[_0x0116('0xa')](),controller[_0x0116('0x12')]);module[_0x0116('0x13')]=router; \ No newline at end of file +var _0xb84e=['get','index','/:id','show','isAuthenticated','put','update','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0xb84e,0x79));var _0xeb84=function(_0x492535,_0x46524a){_0x492535=_0x492535-0x0;var _0x256620=_0xb84e[_0x492535];return _0x256620;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xeb84('0x0'));var timeout=require(_0xeb84('0x1'));var express=require(_0xeb84('0x2'));var router=express[_0xeb84('0x3')]();var auth=require(_0xeb84('0x4'));var interaction=require(_0xeb84('0x5'));var config=require('../../config/environment');var controller=require(_0xeb84('0x6'));router[_0xeb84('0x7')]('/',auth['isAuthenticated'](),controller[_0xeb84('0x8')]);router[_0xeb84('0x7')](_0xeb84('0x9'),auth['isAuthenticated'](),controller[_0xeb84('0xa')]);router['post']('/',auth[_0xeb84('0xb')](),controller['create']);router[_0xeb84('0xc')]('/:id',auth[_0xeb84('0xb')](),controller[_0xeb84('0xd')]);router[_0xeb84('0xe')](_0xeb84('0x9'),auth[_0xeb84('0xb')](),controller['destroy']);module[_0xeb84('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 640eede..53b99ee 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 _0x0140=['exports','ENUM','string','customVariable','STRING','variable','sequelize'];(function(_0x56fbaa,_0x3bc5a6){var _0x49fbc1=function(_0x19b08b){while(--_0x19b08b){_0x56fbaa['push'](_0x56fbaa['shift']());}};_0x49fbc1(++_0x3bc5a6);}(_0x0140,0x148));var _0x0014=function(_0x4164f2,_0x38669f){_0x4164f2=_0x4164f2-0x0;var _0x2575c7=_0x0140[_0x4164f2];return _0x2575c7;};'use strict';var Sequelize=require(_0x0014('0x0'));module[_0x0014('0x1')]={'type':{'type':Sequelize[_0x0014('0x2')](_0x0014('0x3'),'variable',_0x0014('0x4'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0x0014('0x5')]},'key':{'type':Sequelize[_0x0014('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x0014('0x3'),_0x0014('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x0014('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0014('0x5')]}}; \ No newline at end of file +var _0x2875=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x1878e7,_0x3b8551){var _0x4bd036=function(_0x1e164e){while(--_0x1e164e){_0x1878e7['push'](_0x1878e7['shift']());}};_0x4bd036(++_0x3b8551);}(_0x2875,0x14b));var _0x5287=function(_0x371f33,_0x278a69){_0x371f33=_0x371f33-0x0;var _0x246c96=_0x2875[_0x371f33];return _0x246c96;};'use strict';var Sequelize=require(_0x5287('0x0'));module[_0x5287('0x1')]={'type':{'type':Sequelize[_0x5287('0x2')](_0x5287('0x3'),_0x5287('0x4'),_0x5287('0x5'),_0x5287('0x6')),'defaultValue':_0x5287('0x3')},'content':{'type':Sequelize[_0x5287('0x7')]},'key':{'type':Sequelize[_0x5287('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x5287('0x3'),_0x5287('0x4'),_0x5287('0x5'))},'keyContent':{'type':Sequelize[_0x5287('0x7')]},'idField':{'type':Sequelize[_0x5287('0x7')]},'nameField':{'type':Sequelize[_0x5287('0x7')]},'customField':{'type':Sequelize[_0x5287('0x8')],'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 f4271b6..3a2c74d 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 _0x6b76=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','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','sendStatus','status','end','json','count','offset','limit','set','update','destroy','then','stack','name','send','index','FreshsalesField','rawAttributes','type','model','query'];(function(_0x21fcd0,_0xd6015f){var _0x475573=function(_0x5ae8b4){while(--_0x5ae8b4){_0x21fcd0['push'](_0x21fcd0['shift']());}};_0x475573(++_0xd6015f);}(_0x6b76,0x13f));var _0x66b7=function(_0x49aa9b,_0x2e3bcb){_0x49aa9b=_0x49aa9b-0x0;var _0x48cdf7=_0x6b76[_0x49aa9b];return _0x48cdf7;};'use strict';var pdf=require(_0x66b7('0x0'));var emlformat=require(_0x66b7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x66b7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x66b7('0x3'));var BPromise=require(_0x66b7('0x4'));var Mustache=require(_0x66b7('0x5'));var util=require(_0x66b7('0x6'));var path=require(_0x66b7('0x7'));var sox=require(_0x66b7('0x8'));var csv=require(_0x66b7('0x9'));var ejs=require(_0x66b7('0xa'));var fs=require('fs');var _=require(_0x66b7('0xb'));var squel=require(_0x66b7('0xc'));var crypto=require(_0x66b7('0xd'));var jsforce=require(_0x66b7('0xe'));var deskjs=require(_0x66b7('0xf'));var toCsv=require(_0x66b7('0x9'));var querystring=require(_0x66b7('0x10'));var Papa=require('papaparse');var Redis=require(_0x66b7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x66b7('0x12'));var as=require(_0x66b7('0x13'));var hardwareService=require(_0x66b7('0x14'));var logger=require(_0x66b7('0x15'))(_0x66b7('0x16'));var utils=require(_0x66b7('0x17'));var config=require(_0x66b7('0x18'));var db=require(_0x66b7('0x19'))['db'];function respondWithStatusCode(_0x4a3b24,_0x4c262a){_0x4c262a=_0x4c262a||0xcc;return function(_0x402432){if(_0x402432){return _0x4a3b24[_0x66b7('0x1a')](_0x4c262a);}return _0x4a3b24[_0x66b7('0x1b')](_0x4c262a)[_0x66b7('0x1c')]();};}function respondWithResult(_0x32226e,_0x8e0f50){_0x8e0f50=_0x8e0f50||0xc8;return function(_0x50af29){if(_0x50af29){return _0x32226e[_0x66b7('0x1b')](_0x8e0f50)[_0x66b7('0x1d')](_0x50af29);}};}function respondWithFilteredResult(_0x3465e0,_0x26ed0d){return function(_0x3fbf76){if(_0x3fbf76){var _0x44696c=_0x3fbf76[_0x66b7('0x1e')],_0x5afcc3=_0x26ed0d[_0x66b7('0x1f')],_0x29115=_0x26ed0d[_0x66b7('0x1f')]+_0x26ed0d[_0x66b7('0x20')],_0x2dc424;if(_0x29115>=_0x44696c){_0x29115=_0x44696c;_0x2dc424=0xc8;}else{_0x2dc424=0xce;}_0x3465e0['status'](_0x2dc424);return _0x3465e0[_0x66b7('0x21')]('Content-Range',_0x5afcc3+'-'+_0x29115+'/'+_0x44696c)['json'](_0x3fbf76);}return null;};}function patchUpdates(_0x224c16){return function(_0x57a0d5){try{jsonpatch['apply'](_0x57a0d5,_0x224c16,!![]);}catch(_0x1e5c62){return BPromise['reject'](_0x1e5c62);}return _0x57a0d5['save']();};}function saveUpdates(_0x49bc9c,_0x29919a){return function(_0x399ffe){if(_0x399ffe){return _0x399ffe[_0x66b7('0x22')](_0x49bc9c)['then'](function(_0x4c5e86){return _0x4c5e86;});}return null;};}function removeEntity(_0x4057c0,_0x217368){return function(_0x80d491){if(_0x80d491){return _0x80d491[_0x66b7('0x23')]()[_0x66b7('0x24')](function(){_0x4057c0[_0x66b7('0x1b')](0xcc)[_0x66b7('0x1c')]();});}};}function handleEntityNotFound(_0x5195ee,_0x1c9984){return function(_0x5a0c7b){if(!_0x5a0c7b){_0x5195ee[_0x66b7('0x1a')](0x194);}return _0x5a0c7b;};}function handleError(_0x1f5765,_0x2b4bec){_0x2b4bec=_0x2b4bec||0x1f4;return function(_0x16f018){logger['error'](_0x16f018[_0x66b7('0x25')]);if(_0x16f018['name']){delete _0x16f018[_0x66b7('0x26')];}_0x1f5765[_0x66b7('0x1b')](_0x2b4bec)[_0x66b7('0x27')](_0x16f018);};}exports[_0x66b7('0x28')]=function(_0x1f474f,_0x518f0e){var _0x1afb09={},_0x57f50c={},_0x2c7ad2={'count':0x0,'rows':[]};var _0x55f709=_['map'](db[_0x66b7('0x29')][_0x66b7('0x2a')],function(_0x305619){return{'name':_0x305619['fieldName'],'type':_0x305619[_0x66b7('0x2b')]['key']};});_0x57f50c[_0x66b7('0x2c')]=_['map'](_0x55f709,_0x66b7('0x26'));_0x57f50c[_0x66b7('0x2d')]=_[_0x66b7('0x2e')](_0x1f474f[_0x66b7('0x2d')]);_0x57f50c[_0x66b7('0x2f')]=_[_0x66b7('0x30')](_0x57f50c[_0x66b7('0x2c')],_0x57f50c[_0x66b7('0x2d')]);_0x1afb09[_0x66b7('0x31')]=_[_0x66b7('0x30')](_0x57f50c[_0x66b7('0x2c')],qs['fields'](_0x1f474f[_0x66b7('0x2d')][_0x66b7('0x32')]));_0x1afb09[_0x66b7('0x31')]=_0x1afb09['attributes'][_0x66b7('0x33')]?_0x1afb09['attributes']:_0x57f50c[_0x66b7('0x2c')];if(!_0x1f474f[_0x66b7('0x2d')][_0x66b7('0x34')](_0x66b7('0x35'))){_0x1afb09[_0x66b7('0x20')]=qs['limit'](_0x1f474f[_0x66b7('0x2d')]['limit']);_0x1afb09[_0x66b7('0x1f')]=qs[_0x66b7('0x1f')](_0x1f474f[_0x66b7('0x2d')][_0x66b7('0x1f')]);}_0x1afb09[_0x66b7('0x36')]=qs[_0x66b7('0x37')](_0x1f474f[_0x66b7('0x2d')][_0x66b7('0x37')]);_0x1afb09[_0x66b7('0x38')]=qs[_0x66b7('0x2f')](_[_0x66b7('0x39')](_0x1f474f['query'],_0x57f50c['filters']),_0x55f709);if(_0x1f474f['query'][_0x66b7('0x3a')]){_0x1afb09['where']=_[_0x66b7('0x3b')](_0x1afb09[_0x66b7('0x38')],{'$or':_[_0x66b7('0x3c')](_0x55f709,function(_0x337ad6){if(_0x337ad6[_0x66b7('0x2b')]!==_0x66b7('0x3d')){var _0x1f5c70={};_0x1f5c70[_0x337ad6[_0x66b7('0x26')]]={'$like':'%'+_0x1f474f[_0x66b7('0x2d')][_0x66b7('0x3a')]+'%'};return _0x1f5c70;}})});}_0x1afb09=_[_0x66b7('0x3b')]({},_0x1afb09,_0x1f474f[_0x66b7('0x3e')]);var _0x11c9b9={'where':_0x1afb09[_0x66b7('0x38')]};return db[_0x66b7('0x29')][_0x66b7('0x1e')](_0x11c9b9)[_0x66b7('0x24')](function(_0x10ad93){_0x2c7ad2[_0x66b7('0x1e')]=_0x10ad93;if(_0x1f474f[_0x66b7('0x2d')][_0x66b7('0x3f')]){_0x1afb09[_0x66b7('0x40')]=[{'all':!![]}];}return db['FreshsalesField'][_0x66b7('0x41')](_0x1afb09);})[_0x66b7('0x24')](function(_0xec4252){_0x2c7ad2[_0x66b7('0x42')]=_0xec4252;return _0x2c7ad2;})[_0x66b7('0x24')](respondWithFilteredResult(_0x518f0e,_0x1afb09))[_0x66b7('0x43')](handleError(_0x518f0e,null));};exports[_0x66b7('0x44')]=function(_0x1066eb,_0xe80625){var _0x340c02={'raw':!![],'where':{'id':_0x1066eb['params']['id']}},_0x2b6197={};_0x2b6197['model']=_[_0x66b7('0x2e')](db[_0x66b7('0x29')][_0x66b7('0x2a')]);_0x2b6197[_0x66b7('0x2d')]=_[_0x66b7('0x2e')](_0x1066eb[_0x66b7('0x2d')]);_0x2b6197[_0x66b7('0x2f')]=_['intersection'](_0x2b6197[_0x66b7('0x2c')],_0x2b6197[_0x66b7('0x2d')]);_0x340c02[_0x66b7('0x31')]=_[_0x66b7('0x30')](_0x2b6197[_0x66b7('0x2c')],qs[_0x66b7('0x32')](_0x1066eb[_0x66b7('0x2d')][_0x66b7('0x32')]));_0x340c02['attributes']=_0x340c02['attributes']['length']?_0x340c02[_0x66b7('0x31')]:_0x2b6197[_0x66b7('0x2c')];if(_0x1066eb[_0x66b7('0x2d')][_0x66b7('0x3f')]){_0x340c02['include']=[{'all':!![]}];}_0x340c02=_[_0x66b7('0x3b')]({},_0x340c02,_0x1066eb[_0x66b7('0x3e')]);return db[_0x66b7('0x29')][_0x66b7('0x45')](_0x340c02)['then'](handleEntityNotFound(_0xe80625,null))[_0x66b7('0x24')](respondWithResult(_0xe80625,null))[_0x66b7('0x43')](handleError(_0xe80625,null));};exports[_0x66b7('0x46')]=function(_0x3e65be,_0x3f645f){return db[_0x66b7('0x29')][_0x66b7('0x46')](_0x3e65be[_0x66b7('0x47')],{})[_0x66b7('0x24')](respondWithResult(_0x3f645f,0xc9))[_0x66b7('0x43')](handleError(_0x3f645f,null));};exports[_0x66b7('0x22')]=function(_0x3faa15,_0x401c30){if(_0x3faa15[_0x66b7('0x47')]['id']){delete _0x3faa15[_0x66b7('0x47')]['id'];}return db[_0x66b7('0x29')][_0x66b7('0x45')]({'where':{'id':_0x3faa15['params']['id']}})[_0x66b7('0x24')](handleEntityNotFound(_0x401c30,null))[_0x66b7('0x24')](saveUpdates(_0x3faa15[_0x66b7('0x47')],null))['then'](respondWithResult(_0x401c30,null))[_0x66b7('0x43')](handleError(_0x401c30,null));};exports[_0x66b7('0x23')]=function(_0x46605e,_0x1021ed){return db[_0x66b7('0x29')]['find']({'where':{'id':_0x46605e[_0x66b7('0x48')]['id']}})[_0x66b7('0x24')](handleEntityNotFound(_0x1021ed,null))[_0x66b7('0x24')](removeEntity(_0x1021ed,null))[_0x66b7('0x43')](handleError(_0x1021ed,null));}; \ No newline at end of file +var _0x8da7=['length','attributes','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','FreshsalesField','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields'];(function(_0x2cf994,_0x3c5597){var _0x5c8de0=function(_0x2e59c2){while(--_0x2e59c2){_0x2cf994['push'](_0x2cf994['shift']());}};_0x5c8de0(++_0x3c5597);}(_0x8da7,0x136));var _0x78da=function(_0x930249,_0x2dda12){_0x930249=_0x930249-0x0;var _0x3e6ed7=_0x8da7[_0x930249];return _0x3e6ed7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x78da('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x78da('0x1'));var jsonpatch=require(_0x78da('0x2'));var rp=require(_0x78da('0x3'));var moment=require(_0x78da('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x78da('0x5'));var util=require(_0x78da('0x6'));var path=require(_0x78da('0x7'));var sox=require('sox');var csv=require(_0x78da('0x8'));var ejs=require(_0x78da('0x9'));var fs=require('fs');var _=require(_0x78da('0xa'));var squel=require(_0x78da('0xb'));var crypto=require('crypto');var jsforce=require(_0x78da('0xc'));var deskjs=require(_0x78da('0xd'));var toCsv=require(_0x78da('0x8'));var querystring=require(_0x78da('0xe'));var Papa=require('papaparse');var Redis=require(_0x78da('0xf'));var authService=require(_0x78da('0x10'));var qs=require(_0x78da('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x78da('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x78da('0x13'));var config=require(_0x78da('0x14'));var db=require(_0x78da('0x15'))['db'];function respondWithStatusCode(_0xcc33b0,_0x4668c9){_0x4668c9=_0x4668c9||0xcc;return function(_0x1288e8){if(_0x1288e8){return _0xcc33b0[_0x78da('0x16')](_0x4668c9);}return _0xcc33b0[_0x78da('0x17')](_0x4668c9)[_0x78da('0x18')]();};}function respondWithResult(_0x22f157,_0x492b3d){_0x492b3d=_0x492b3d||0xc8;return function(_0x182b5c){if(_0x182b5c){return _0x22f157['status'](_0x492b3d)[_0x78da('0x19')](_0x182b5c);}};}function respondWithFilteredResult(_0x5172cb,_0x536073){return function(_0x12e5c0){if(_0x12e5c0){var _0x2ca2e6=_0x12e5c0['count'],_0x25ffe7=_0x536073[_0x78da('0x1a')],_0xc437b7=_0x536073['offset']+_0x536073['limit'],_0x1adec5;if(_0xc437b7>=_0x2ca2e6){_0xc437b7=_0x2ca2e6;_0x1adec5=0xc8;}else{_0x1adec5=0xce;}_0x5172cb[_0x78da('0x17')](_0x1adec5);return _0x5172cb[_0x78da('0x1b')](_0x78da('0x1c'),_0x25ffe7+'-'+_0xc437b7+'/'+_0x2ca2e6)[_0x78da('0x19')](_0x12e5c0);}return null;};}function patchUpdates(_0x24b1da){return function(_0x1a3527){try{jsonpatch[_0x78da('0x1d')](_0x1a3527,_0x24b1da,!![]);}catch(_0x4f180e){return BPromise[_0x78da('0x1e')](_0x4f180e);}return _0x1a3527[_0x78da('0x1f')]();};}function saveUpdates(_0x58fe4f,_0x351d46){return function(_0x18548a){if(_0x18548a){return _0x18548a[_0x78da('0x20')](_0x58fe4f)[_0x78da('0x21')](function(_0x48ae29){return _0x48ae29;});}return null;};}function removeEntity(_0x2ffa5f,_0x4eae49){return function(_0x598537){if(_0x598537){return _0x598537[_0x78da('0x22')]()[_0x78da('0x21')](function(){_0x2ffa5f['status'](0xcc)[_0x78da('0x18')]();});}};}function handleEntityNotFound(_0x2a05fa,_0x544ffa){return function(_0x18dc21){if(!_0x18dc21){_0x2a05fa['sendStatus'](0x194);}return _0x18dc21;};}function handleError(_0x42a8a6,_0x40b62a){_0x40b62a=_0x40b62a||0x1f4;return function(_0x209cb0){logger[_0x78da('0x23')](_0x209cb0[_0x78da('0x24')]);if(_0x209cb0[_0x78da('0x25')]){delete _0x209cb0[_0x78da('0x25')];}_0x42a8a6['status'](_0x40b62a)[_0x78da('0x26')](_0x209cb0);};}exports[_0x78da('0x27')]=function(_0x3de164,_0x2567e1){var _0x27cf7f={},_0x1a8885={},_0x2f6a0e={'count':0x0,'rows':[]};var _0x12b6a4=_['map'](db[_0x78da('0x28')][_0x78da('0x29')],function(_0x28b644){return{'name':_0x28b644[_0x78da('0x2a')],'type':_0x28b644[_0x78da('0x2b')]['key']};});_0x1a8885[_0x78da('0x2c')]=_[_0x78da('0x2d')](_0x12b6a4,_0x78da('0x25'));_0x1a8885[_0x78da('0x2e')]=_['keys'](_0x3de164[_0x78da('0x2e')]);_0x1a8885[_0x78da('0x2f')]=_[_0x78da('0x30')](_0x1a8885[_0x78da('0x2c')],_0x1a8885[_0x78da('0x2e')]);_0x27cf7f['attributes']=_[_0x78da('0x30')](_0x1a8885[_0x78da('0x2c')],qs['fields'](_0x3de164[_0x78da('0x2e')][_0x78da('0x31')]));_0x27cf7f['attributes']=_0x27cf7f['attributes'][_0x78da('0x32')]?_0x27cf7f[_0x78da('0x33')]:_0x1a8885[_0x78da('0x2c')];if(!_0x3de164['query'][_0x78da('0x34')](_0x78da('0x35'))){_0x27cf7f[_0x78da('0x36')]=qs['limit'](_0x3de164[_0x78da('0x2e')][_0x78da('0x36')]);_0x27cf7f[_0x78da('0x1a')]=qs[_0x78da('0x1a')](_0x3de164[_0x78da('0x2e')]['offset']);}_0x27cf7f['order']=qs[_0x78da('0x37')](_0x3de164['query'][_0x78da('0x37')]);_0x27cf7f[_0x78da('0x38')]=qs[_0x78da('0x2f')](_['pick'](_0x3de164['query'],_0x1a8885[_0x78da('0x2f')]),_0x12b6a4);if(_0x3de164[_0x78da('0x2e')][_0x78da('0x39')]){_0x27cf7f[_0x78da('0x38')]=_[_0x78da('0x3a')](_0x27cf7f[_0x78da('0x38')],{'$or':_[_0x78da('0x2d')](_0x12b6a4,function(_0x573185){if(_0x573185[_0x78da('0x2b')]!==_0x78da('0x3b')){var _0x1188d0={};_0x1188d0[_0x573185[_0x78da('0x25')]]={'$like':'%'+_0x3de164['query'][_0x78da('0x39')]+'%'};return _0x1188d0;}})});}_0x27cf7f=_[_0x78da('0x3a')]({},_0x27cf7f,_0x3de164['options']);var _0x1b527b={'where':_0x27cf7f[_0x78da('0x38')]};return db[_0x78da('0x28')][_0x78da('0x3c')](_0x1b527b)[_0x78da('0x21')](function(_0xea4356){_0x2f6a0e['count']=_0xea4356;if(_0x3de164['query'][_0x78da('0x3d')]){_0x27cf7f['include']=[{'all':!![]}];}return db[_0x78da('0x28')][_0x78da('0x3e')](_0x27cf7f);})[_0x78da('0x21')](function(_0x279e9e){_0x2f6a0e[_0x78da('0x3f')]=_0x279e9e;return _0x2f6a0e;})[_0x78da('0x21')](respondWithFilteredResult(_0x2567e1,_0x27cf7f))[_0x78da('0x40')](handleError(_0x2567e1,null));};exports[_0x78da('0x41')]=function(_0x22c2c7,_0x25b143){var _0x4be47b={'raw':!![],'where':{'id':_0x22c2c7[_0x78da('0x42')]['id']}},_0x51fbdc={};_0x51fbdc[_0x78da('0x2c')]=_[_0x78da('0x43')](db[_0x78da('0x28')][_0x78da('0x29')]);_0x51fbdc[_0x78da('0x2e')]=_[_0x78da('0x43')](_0x22c2c7['query']);_0x51fbdc[_0x78da('0x2f')]=_[_0x78da('0x30')](_0x51fbdc['model'],_0x51fbdc[_0x78da('0x2e')]);_0x4be47b[_0x78da('0x33')]=_[_0x78da('0x30')](_0x51fbdc[_0x78da('0x2c')],qs[_0x78da('0x31')](_0x22c2c7[_0x78da('0x2e')][_0x78da('0x31')]));_0x4be47b[_0x78da('0x33')]=_0x4be47b['attributes'][_0x78da('0x32')]?_0x4be47b[_0x78da('0x33')]:_0x51fbdc[_0x78da('0x2c')];if(_0x22c2c7['query'][_0x78da('0x3d')]){_0x4be47b[_0x78da('0x44')]=[{'all':!![]}];}_0x4be47b=_[_0x78da('0x3a')]({},_0x4be47b,_0x22c2c7['options']);return db[_0x78da('0x28')][_0x78da('0x45')](_0x4be47b)[_0x78da('0x21')](handleEntityNotFound(_0x25b143,null))[_0x78da('0x21')](respondWithResult(_0x25b143,null))[_0x78da('0x40')](handleError(_0x25b143,null));};exports[_0x78da('0x46')]=function(_0x24eedc,_0x4683e7){return db[_0x78da('0x28')][_0x78da('0x46')](_0x24eedc['body'],{})[_0x78da('0x21')](respondWithResult(_0x4683e7,0xc9))['catch'](handleError(_0x4683e7,null));};exports['update']=function(_0x2f85b9,_0x4c4030){if(_0x2f85b9[_0x78da('0x47')]['id']){delete _0x2f85b9['body']['id'];}return db[_0x78da('0x28')][_0x78da('0x45')]({'where':{'id':_0x2f85b9[_0x78da('0x42')]['id']}})['then'](handleEntityNotFound(_0x4c4030,null))[_0x78da('0x21')](saveUpdates(_0x2f85b9[_0x78da('0x47')],null))[_0x78da('0x21')](respondWithResult(_0x4c4030,null))[_0x78da('0x40')](handleError(_0x4c4030,null));};exports[_0x78da('0x22')]=function(_0x295ef4,_0x279764){return db[_0x78da('0x28')][_0x78da('0x45')]({'where':{'id':_0x295ef4[_0x78da('0x42')]['id']}})['then'](handleEntityNotFound(_0x279764,null))[_0x78da('0x21')](removeEntity(_0x279764,null))['catch'](handleError(_0x279764,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 50c4033..80cd31c 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 _0x1d97=['bluebird','request-promise','path','../../config/environment','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','util','../../config/logger','moment'];(function(_0x1060ea,_0x4c7322){var _0x49ec59=function(_0x5a8716){while(--_0x5a8716){_0x1060ea['push'](_0x1060ea['shift']());}};_0x49ec59(++_0x4c7322);}(_0x1d97,0x110));var _0x71d9=function(_0x2b0441,_0x5b7e96){_0x2b0441=_0x2b0441-0x0;var _0x1222ba=_0x1d97[_0x2b0441];return _0x1222ba;};'use strict';var _=require(_0x71d9('0x0'));var util=require(_0x71d9('0x1'));var logger=require(_0x71d9('0x2'))('api');var moment=require(_0x71d9('0x3'));var BPromise=require(_0x71d9('0x4'));var rp=require(_0x71d9('0x5'));var fs=require('fs');var path=require(_0x71d9('0x6'));var rimraf=require('rimraf');var config=require(_0x71d9('0x7'));var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x472e27,_0x3b273f){return _0x472e27['define'](_0x71d9('0x8'),attributes,{'tableName':_0x71d9('0x9'),'paranoid':![],'indexes':[{'name':_0x71d9('0xa'),'fields':[_0x71d9('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x734e=['FreshsalesField','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesField.attributes'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0x734e,0x11c));var _0xe734=function(_0x4c3afd,_0x3e7a45){_0x4c3afd=_0x4c3afd-0x0;var _0x4e2ef3=_0x734e[_0x4c3afd];return _0x4e2ef3;};'use strict';var _=require(_0xe734('0x0'));var util=require(_0xe734('0x1'));var logger=require(_0xe734('0x2'))(_0xe734('0x3'));var moment=require(_0xe734('0x4'));var BPromise=require(_0xe734('0x5'));var rp=require(_0xe734('0x6'));var fs=require('fs');var path=require(_0xe734('0x7'));var rimraf=require('rimraf');var config=require(_0xe734('0x8'));var attributes=require(_0xe734('0x9'));module['exports']=function(_0x27817e,_0xfc34cd){return _0x27817e['define'](_0xe734('0xa'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xe734('0xb'),'fields':[_0xe734('0xc'),_0xe734('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 9f456b8..e4a1037 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 _0x29e2=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3f697e,_0xd15bf7){var _0x3deb76=function(_0x4b16ac){while(--_0x4b16ac){_0x3f697e['push'](_0x3f697e['shift']());}};_0x3deb76(++_0xd15bf7);}(_0x29e2,0xc0));var _0x229e=function(_0x3604f5,_0x5ab25d){_0x3604f5=_0x3604f5-0x0;var _0x4b38e7=_0x29e2[_0x3604f5];return _0x4b38e7;};'use strict';var _=require(_0x229e('0x0'));var util=require(_0x229e('0x1'));var moment=require('moment');var BPromise=require(_0x229e('0x2'));var rs=require(_0x229e('0x3'));var fs=require('fs');var Redis=require(_0x229e('0x4'));var db=require(_0x229e('0x5'))['db'];var utils=require(_0x229e('0x6'));var logger=require(_0x229e('0x7'))(_0x229e('0x8'));var config=require(_0x229e('0x9'));var jayson=require(_0x229e('0xa'));var client=jayson['client'][_0x229e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8ea3a5,_0x59d36d,_0x5f0595){return new BPromise(function(_0x3c5101,_0x439695){return client[_0x229e('0xc')](_0x8ea3a5,_0x5f0595)['then'](function(_0x3cdcec){logger['info'](_0x229e('0xd'),_0x59d36d,'request\x20sent');logger['debug'](_0x229e('0xe'),_0x59d36d,_0x229e('0xf'),JSON[_0x229e('0x10')](_0x3cdcec));if(_0x3cdcec[_0x229e('0x11')]){if(_0x3cdcec['error'][_0x229e('0x12')]===0x1f4){logger[_0x229e('0x11')](_0x229e('0xd'),_0x59d36d,_0x3cdcec['error'][_0x229e('0x13')]);return _0x439695(_0x3cdcec[_0x229e('0x11')][_0x229e('0x13')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x59d36d,_0x3cdcec[_0x229e('0x11')]['message']);return _0x3c5101(_0x3cdcec[_0x229e('0x11')][_0x229e('0x13')]);}else{logger['info'](_0x229e('0xd'),_0x59d36d,_0x229e('0xf'));_0x3c5101(_0x3cdcec[_0x229e('0x14')][_0x229e('0x13')]);}})[_0x229e('0x15')](function(_0x107109){logger[_0x229e('0x11')](_0x229e('0xd'),_0x59d36d,_0x107109);_0x439695(_0x107109);});});} \ No newline at end of file +var _0x2390=['../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x3292d4,_0xdad90d){var _0x2a8755=function(_0x2499bd){while(--_0x2499bd){_0x3292d4['push'](_0x3292d4['shift']());}};_0x2a8755(++_0xdad90d);}(_0x2390,0x161));var _0x0239=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x2390[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x0239('0x0'));var util=require('util');var moment=require(_0x0239('0x1'));var BPromise=require(_0x0239('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0239('0x3'));var db=require(_0x0239('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0239('0x5'))(_0x0239('0x6'));var config=require(_0x0239('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4ffaf7,_0xd60e55,_0x57dcb6){return new BPromise(function(_0x5538cd,_0x327635){return client[_0x0239('0x8')](_0x4ffaf7,_0x57dcb6)[_0x0239('0x9')](function(_0x189418){logger[_0x0239('0xa')](_0x0239('0xb'),_0xd60e55,'request\x20sent');logger[_0x0239('0xc')](_0x0239('0xd'),_0xd60e55,_0x0239('0xe'),JSON[_0x0239('0xf')](_0x189418));if(_0x189418[_0x0239('0x10')]){if(_0x189418[_0x0239('0x10')][_0x0239('0x11')]===0x1f4){logger[_0x0239('0x10')](_0x0239('0xb'),_0xd60e55,_0x189418[_0x0239('0x10')][_0x0239('0x12')]);return _0x327635(_0x189418['error'][_0x0239('0x12')]);}logger[_0x0239('0x10')]('FreshsalesField,\x20%s,\x20%s',_0xd60e55,_0x189418['error']['message']);return _0x5538cd(_0x189418[_0x0239('0x10')][_0x0239('0x12')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0xd60e55,_0x0239('0xe'));_0x5538cd(_0x189418[_0x0239('0x13')][_0x0239('0x12')]);}})[_0x0239('0x14')](function(_0x421270){logger[_0x0239('0x10')](_0x0239('0xb'),_0xd60e55,_0x421270);_0x327635(_0x421270);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index f829dee..76e956e 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 _0xef39=['/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x1c6bed,_0x3cd7f9){var _0x5ad4ce=function(_0x433dd4){while(--_0x433dd4){_0x1c6bed['push'](_0x1c6bed['shift']());}};_0x5ad4ce(++_0x3cd7f9);}(_0xef39,0xa9));var _0x9ef3=function(_0x3d9a90,_0x2739ff){_0x3d9a90=_0x3d9a90-0x0;var _0x47a569=_0xef39[_0x3d9a90];return _0x47a569;};'use strict';var multer=require(_0x9ef3('0x0'));var util=require(_0x9ef3('0x1'));var path=require(_0x9ef3('0x2'));var timeout=require(_0x9ef3('0x3'));var express=require('express');var router=express[_0x9ef3('0x4')]();var auth=require(_0x9ef3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9ef3('0x6'));var controller=require('./intSalesforceAccount.controller');router[_0x9ef3('0x7')]('/',auth[_0x9ef3('0x8')](),controller['index']);router[_0x9ef3('0x7')](_0x9ef3('0x9'),auth[_0x9ef3('0x8')](),controller[_0x9ef3('0xa')]);router['get'](_0x9ef3('0xb'),auth[_0x9ef3('0x8')](),controller[_0x9ef3('0xc')]);router[_0x9ef3('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x9ef3('0xd')]);router[_0x9ef3('0xe')]('/',auth[_0x9ef3('0x8')](),controller[_0x9ef3('0xf')]);router['post'](_0x9ef3('0xb'),auth[_0x9ef3('0x8')](),controller[_0x9ef3('0x10')]);router[_0x9ef3('0x11')](_0x9ef3('0x9'),auth[_0x9ef3('0x8')](),controller['update']);router[_0x9ef3('0x12')](_0x9ef3('0x9'),auth['isAuthenticated'](),controller[_0x9ef3('0x13')]);module['exports']=router; \ No newline at end of file +var _0xb55a=['exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','post','create','addConfiguration','put'];(function(_0x19ebfd,_0x5ae121){var _0x11017a=function(_0x24db17){while(--_0x24db17){_0x19ebfd['push'](_0x19ebfd['shift']());}};_0x11017a(++_0x5ae121);}(_0xb55a,0x1c3));var _0xab55=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xb55a[_0x16b9ed];return _0x66b1f8;};'use strict';var multer=require('multer');var util=require(_0xab55('0x0'));var path=require(_0xab55('0x1'));var timeout=require(_0xab55('0x2'));var express=require(_0xab55('0x3'));var router=express['Router']();var auth=require(_0xab55('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xab55('0x5'));var controller=require('./intSalesforceAccount.controller');router[_0xab55('0x6')]('/',auth[_0xab55('0x7')](),controller[_0xab55('0x8')]);router[_0xab55('0x6')](_0xab55('0x9'),auth[_0xab55('0x7')](),controller[_0xab55('0xa')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0xab55('0xb')]);router['get'](_0xab55('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0xab55('0xd')]('/',auth[_0xab55('0x7')](),controller[_0xab55('0xe')]);router[_0xab55('0xd')]('/:id/configurations',auth[_0xab55('0x7')](),controller[_0xab55('0xf')]);router[_0xab55('0x10')](_0xab55('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xab55('0x9'),auth[_0xab55('0x7')](),controller['destroy']);module[_0xab55('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index ecaf9ee..0fb54c6 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 _0x5fc3=['STRING','username','newTab','sequelize','exports'];(function(_0x4e6eb2,_0x16a451){var _0x4e0c1c=function(_0x59f144){while(--_0x59f144){_0x4e6eb2['push'](_0x4e6eb2['shift']());}};_0x4e0c1c(++_0x16a451);}(_0x5fc3,0xa8));var _0x35fc=function(_0x11f249,_0x4ca4a8){_0x11f249=_0x11f249-0x0;var _0x5c3656=_0x5fc3[_0x11f249];return _0x5c3656;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x35fc('0x2')]},'username':{'type':Sequelize[_0x35fc('0x2')],'unique':_0x35fc('0x3')},'remoteUri':{'type':Sequelize[_0x35fc('0x2')]},'password':{'type':Sequelize[_0x35fc('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x35fc('0x2')]},'securityToken':{'type':Sequelize[_0x35fc('0x2')]},'serverUrl':{'type':Sequelize[_0x35fc('0x2')]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x35fc('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x5fab=['username','ENUM','integrationTab','sequelize','exports','STRING'];(function(_0x2810bc,_0x22264a){var _0x2cddf8=function(_0x129337){while(--_0x129337){_0x2810bc['push'](_0x2810bc['shift']());}};_0x2cddf8(++_0x22264a);}(_0x5fab,0x177));var _0xb5fa=function(_0x518392,_0x25ac70){_0x518392=_0x518392-0x0;var _0x344e59=_0x5fab[_0x518392];return _0x344e59;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb5fa('0x2')]},'username':{'type':Sequelize[_0xb5fa('0x2')],'unique':_0xb5fa('0x3')},'remoteUri':{'type':Sequelize[_0xb5fa('0x2')]},'password':{'type':Sequelize[_0xb5fa('0x2')]},'clientId':{'type':Sequelize[_0xb5fa('0x2')]},'clientSecret':{'type':Sequelize[_0xb5fa('0x2')]},'securityToken':{'type':Sequelize[_0xb5fa('0x2')]},'serverUrl':{'type':Sequelize[_0xb5fa('0x2')]},'type':{'type':Sequelize[_0xb5fa('0x4')]('integrationTab','newTab'),'defaultValue':_0xb5fa('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 6c3f414..8a1545a 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 _0x4329=['rows','show','params','include','options','create','body','find','destroy','getConfigurations','findOne','keys','SalesforceConfiguration','addConfiguration','AccountId','channel','getDescriptions','SalesforceField','Subjects','Descriptions','getFields','Task','remoteUri','clientSecret','username','password','securityToken','slice','substring','Connection','clientId','concat','ticketType','sobject','CallDisposition','CallObject','Priority','Type','isNil','Origin','Reason','Status','IsEscalated','SuppliedName','SuppliedCompany','custom','includes','label','value','true','False','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','update','then','stack','name','index','map','SalesforceAccount','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','includeAll','findAll'];(function(_0x2459fd,_0x575d9b){var _0x364cd2=function(_0x4b22f6){while(--_0x4b22f6){_0x2459fd['push'](_0x2459fd['shift']());}};_0x364cd2(++_0x575d9b);}(_0x4329,0xbb));var _0x9432=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4329[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require(_0x9432('0x0'));var emlformat=require(_0x9432('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9432('0x2'));var rp=require(_0x9432('0x3'));var moment=require(_0x9432('0x4'));var BPromise=require(_0x9432('0x5'));var Mustache=require(_0x9432('0x6'));var util=require(_0x9432('0x7'));var path=require(_0x9432('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9432('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9432('0xa'));var crypto=require(_0x9432('0xb'));var jsforce=require(_0x9432('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9432('0xd'));var querystring=require('querystring');var Papa=require(_0x9432('0xe'));var Redis=require(_0x9432('0xf'));var authService=require(_0x9432('0x10'));var qs=require(_0x9432('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9432('0x12'))(_0x9432('0x13'));var utils=require(_0x9432('0x14'));var config=require(_0x9432('0x15'));var db=require(_0x9432('0x16'))['db'];var integrations=require(_0x9432('0x17'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x2f9b09,_0x2131c3,_0x5720d7){if(_0x5720d7){var _0x2fd85a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2fd85a[_0x9432('0x18')](_0x2131c3)){return _0x2f9b09;}else{throw new db[(_0x9432('0x19'))]['ValidationError'](_0x9432('0x1a'));}}else{return _0x2f9b09;}}function respondWithRpcPromise(_0xca6f1d,_0xea697d,_0x38db44,_0xe7ad10){return new BPromise(function(_0x7bf721,_0xbf643){var _0x2179bd=_0xe7ad10||client;return _0x2179bd[_0x9432('0x1b')](_0xca6f1d,_0x38db44)['then'](function(_0x4c8718){logger[_0x9432('0x1c')]('SalesforceAccount,\x20%s,\x20%s',_0xea697d,'request\x20sent');logger[_0x9432('0x1d')](_0x9432('0x1e'),_0xea697d,_0x9432('0x1f'),JSON[_0x9432('0x20')](_0x4c8718));if(_0x4c8718['error']){if(_0x4c8718[_0x9432('0x21')][_0x9432('0x22')]===0x1f4){logger['error'](_0x9432('0x23'),_0xea697d,_0x4c8718['error'][_0x9432('0x24')]);return _0xbf643(_0x4c8718[_0x9432('0x21')][_0x9432('0x24')]);}logger['error'](_0x9432('0x23'),_0xea697d,_0x4c8718[_0x9432('0x21')][_0x9432('0x24')]);return _0x7bf721(_0x4c8718[_0x9432('0x21')]['message']);}else{logger['info'](_0x9432('0x23'),_0xea697d,_0x9432('0x1f'));_0x7bf721(_0x4c8718[_0x9432('0x25')][_0x9432('0x24')]);}})[_0x9432('0x26')](function(_0x183d5f){logger[_0x9432('0x21')](_0x9432('0x23'),_0xea697d,_0x183d5f);_0xbf643(_0x183d5f);});});}function respondWithStatusCode(_0x81a990,_0x1946db){_0x1946db=_0x1946db||0xcc;return function(_0x39400c){if(_0x39400c){return _0x81a990[_0x9432('0x27')](_0x1946db);}return _0x81a990[_0x9432('0x28')](_0x1946db)[_0x9432('0x29')]();};}function respondWithResult(_0x42e93a,_0x5e6211){_0x5e6211=_0x5e6211||0xc8;return function(_0x5089ec){if(_0x5089ec){return _0x42e93a['status'](_0x5e6211)[_0x9432('0x2a')](_0x5089ec);}};}function respondWithFilteredResult(_0xefd8c0,_0x4bfdb6){return function(_0x595ca3){if(_0x595ca3){var _0x54b127=_0x595ca3[_0x9432('0x2b')],_0x558adc=_0x4bfdb6[_0x9432('0x2c')],_0x40ea4a=_0x4bfdb6[_0x9432('0x2c')]+_0x4bfdb6[_0x9432('0x2d')],_0x2c64d4;if(_0x40ea4a>=_0x54b127){_0x40ea4a=_0x54b127;_0x2c64d4=0xc8;}else{_0x2c64d4=0xce;}_0xefd8c0[_0x9432('0x28')](_0x2c64d4);return _0xefd8c0[_0x9432('0x2e')](_0x9432('0x2f'),_0x558adc+'-'+_0x40ea4a+'/'+_0x54b127)[_0x9432('0x2a')](_0x595ca3);}return null;};}function patchUpdates(_0x1aa6b2){return function(_0x4ed3bc){try{jsonpatch['apply'](_0x4ed3bc,_0x1aa6b2,!![]);}catch(_0x1877b3){return BPromise['reject'](_0x1877b3);}return _0x4ed3bc['save']();};}function saveUpdates(_0x5da5ad,_0x42d34d){return function(_0x4a341){if(_0x4a341){return _0x4a341[_0x9432('0x30')](_0x5da5ad)['then'](function(_0x5df3a3){return _0x5df3a3;});}return null;};}function removeEntity(_0x4dfd8a,_0x2673f8){return function(_0x1041a5){if(_0x1041a5){return _0x1041a5['destroy']()[_0x9432('0x31')](function(){_0x4dfd8a['status'](0xcc)[_0x9432('0x29')]();});}};}function handleEntityNotFound(_0x1ad36a,_0x3e809f){return function(_0x52a4f3){if(!_0x52a4f3){_0x1ad36a['sendStatus'](0x194);}return _0x52a4f3;};}function handleError(_0x2bacf8,_0x5326ab){_0x5326ab=_0x5326ab||0x1f4;return function(_0x2a9e25){logger['error'](_0x2a9e25[_0x9432('0x32')]);if(_0x2a9e25[_0x9432('0x33')]){delete _0x2a9e25[_0x9432('0x33')];}_0x2bacf8[_0x9432('0x28')](_0x5326ab)['send'](_0x2a9e25);};}exports[_0x9432('0x34')]=function(_0x20907d,_0xe69a81){var _0x54118a={},_0x173bb3={},_0x1f31e2={'count':0x0,'rows':[]};var _0x4a4edf=_[_0x9432('0x35')](db[_0x9432('0x36')][_0x9432('0x37')],function(_0x173fb2){return{'name':_0x173fb2[_0x9432('0x38')],'type':_0x173fb2['type'][_0x9432('0x39')]};});_0x173bb3['model']=_[_0x9432('0x35')](_0x4a4edf,_0x9432('0x33'));_0x173bb3['query']=_['keys'](_0x20907d[_0x9432('0x3a')]);_0x173bb3[_0x9432('0x3b')]=_[_0x9432('0x3c')](_0x173bb3[_0x9432('0x3d')],_0x173bb3[_0x9432('0x3a')]);_0x54118a[_0x9432('0x3e')]=_['intersection'](_0x173bb3[_0x9432('0x3d')],qs[_0x9432('0x3f')](_0x20907d[_0x9432('0x3a')][_0x9432('0x3f')]));_0x54118a[_0x9432('0x3e')]=_0x54118a[_0x9432('0x3e')][_0x9432('0x40')]?_0x54118a['attributes']:_0x173bb3[_0x9432('0x3d')];if(!_0x20907d[_0x9432('0x3a')][_0x9432('0x41')](_0x9432('0x42'))){_0x54118a[_0x9432('0x2d')]=qs[_0x9432('0x2d')](_0x20907d['query']['limit']);_0x54118a[_0x9432('0x2c')]=qs[_0x9432('0x2c')](_0x20907d[_0x9432('0x3a')]['offset']);}_0x54118a[_0x9432('0x43')]=qs['sort'](_0x20907d['query'][_0x9432('0x44')]);_0x54118a['where']=qs[_0x9432('0x3b')](_[_0x9432('0x45')](_0x20907d[_0x9432('0x3a')],_0x173bb3[_0x9432('0x3b')]),_0x4a4edf);if(_0x20907d['query'][_0x9432('0x46')]){_0x54118a[_0x9432('0x47')]=_['merge'](_0x54118a[_0x9432('0x47')],{'$or':_[_0x9432('0x35')](_0x4a4edf,function(_0x40d4e7){if(_0x40d4e7[_0x9432('0x48')]!==_0x9432('0x49')){var _0x4153ba={};_0x4153ba[_0x40d4e7[_0x9432('0x33')]]={'$like':'%'+_0x20907d[_0x9432('0x3a')]['filter']+'%'};return _0x4153ba;}})});}_0x54118a=_[_0x9432('0x4a')]({},_0x54118a,_0x20907d['options']);var _0x1b0aef={'where':_0x54118a[_0x9432('0x47')]};return db[_0x9432('0x36')]['count'](_0x1b0aef)['then'](function(_0x45c683){_0x1f31e2['count']=_0x45c683;if(_0x20907d['query'][_0x9432('0x4b')]){_0x54118a['include']=[{'all':!![]}];}return db[_0x9432('0x36')][_0x9432('0x4c')](_0x54118a);})[_0x9432('0x31')](function(_0x5f417c){_0x1f31e2[_0x9432('0x4d')]=_0x5f417c;return _0x1f31e2;})[_0x9432('0x31')](respondWithFilteredResult(_0xe69a81,_0x54118a))[_0x9432('0x26')](handleError(_0xe69a81,null));};exports[_0x9432('0x4e')]=function(_0x3c62f0,_0x1517ed){var _0x356563={'raw':![],'where':{'id':_0x3c62f0[_0x9432('0x4f')]['id']}},_0x1cd3c0={};_0x1cd3c0[_0x9432('0x3d')]=_['keys'](db[_0x9432('0x36')]['rawAttributes']);_0x1cd3c0[_0x9432('0x3a')]=_['keys'](_0x3c62f0[_0x9432('0x3a')]);_0x1cd3c0[_0x9432('0x3b')]=_[_0x9432('0x3c')](_0x1cd3c0[_0x9432('0x3d')],_0x1cd3c0[_0x9432('0x3a')]);_0x356563['attributes']=_[_0x9432('0x3c')](_0x1cd3c0['model'],qs['fields'](_0x3c62f0['query']['fields']));_0x356563['attributes']=_0x356563[_0x9432('0x3e')][_0x9432('0x40')]?_0x356563['attributes']:_0x1cd3c0[_0x9432('0x3d')];if(_0x3c62f0['query'][_0x9432('0x4b')]){_0x356563[_0x9432('0x50')]=[{'all':!![]}];}_0x356563=_[_0x9432('0x4a')]({},_0x356563,_0x3c62f0[_0x9432('0x51')]);return db[_0x9432('0x36')]['find'](_0x356563)[_0x9432('0x31')](handleEntityNotFound(_0x1517ed,null))[_0x9432('0x31')](respondWithResult(_0x1517ed,null))[_0x9432('0x26')](handleError(_0x1517ed,null));};exports[_0x9432('0x52')]=function(_0x214fe1,_0x1f8e9d){return db[_0x9432('0x36')]['create'](_0x214fe1[_0x9432('0x53')],{})[_0x9432('0x31')](respondWithResult(_0x1f8e9d,0xc9))[_0x9432('0x26')](handleError(_0x1f8e9d,null));};exports[_0x9432('0x30')]=function(_0xd61c42,_0x4417e5){if(_0xd61c42[_0x9432('0x53')]['id']){delete _0xd61c42[_0x9432('0x53')]['id'];}return db[_0x9432('0x36')][_0x9432('0x54')]({'where':{'id':_0xd61c42[_0x9432('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4417e5,null))['then'](saveUpdates(_0xd61c42[_0x9432('0x53')],null))['then'](respondWithResult(_0x4417e5,null))[_0x9432('0x26')](handleError(_0x4417e5,null));};exports[_0x9432('0x55')]=function(_0x361426,_0x3d11a5){return db[_0x9432('0x36')][_0x9432('0x54')]({'where':{'id':_0x361426[_0x9432('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3d11a5,null))[_0x9432('0x31')](removeEntity(_0x3d11a5,null))[_0x9432('0x26')](handleError(_0x3d11a5,null));};exports[_0x9432('0x56')]=function(_0x3449f6,_0x38ee55,_0xd533d2){var _0x54e752={};var _0x1507fb={};var _0x2f9b24;var _0x24e3a7;return db[_0x9432('0x36')][_0x9432('0x57')]({'where':{'id':_0x3449f6['params']['id']}})[_0x9432('0x31')](handleEntityNotFound(_0x38ee55,null))[_0x9432('0x31')](function(_0x599df8){if(_0x599df8){_0x2f9b24=_0x599df8;_0x1507fb['model']=_[_0x9432('0x58')](db[_0x9432('0x59')][_0x9432('0x37')]);_0x1507fb[_0x9432('0x3a')]=_['keys'](_0x3449f6[_0x9432('0x3a')]);_0x1507fb[_0x9432('0x3b')]=_[_0x9432('0x3c')](_0x1507fb['model'],_0x1507fb[_0x9432('0x3a')]);_0x54e752['attributes']=_[_0x9432('0x3c')](_0x1507fb[_0x9432('0x3d')],qs[_0x9432('0x3f')](_0x3449f6[_0x9432('0x3a')][_0x9432('0x3f')]));_0x54e752[_0x9432('0x3e')]=_0x54e752[_0x9432('0x3e')][_0x9432('0x40')]?_0x54e752[_0x9432('0x3e')]:_0x1507fb[_0x9432('0x3d')];_0x54e752[_0x9432('0x43')]=qs['sort'](_0x3449f6[_0x9432('0x3a')][_0x9432('0x44')]);_0x54e752[_0x9432('0x47')]=qs['filters'](_['pick'](_0x3449f6['query'],_0x1507fb[_0x9432('0x3b')]));if(_0x3449f6[_0x9432('0x3a')]['filter']){_0x54e752[_0x9432('0x47')]=_['merge'](_0x54e752[_0x9432('0x47')],{'$or':_[_0x9432('0x35')](_0x54e752['attributes'],function(_0x1cbd33){var _0x2955e3={};_0x2955e3[_0x1cbd33]={'$like':'%'+_0x3449f6['query'][_0x9432('0x46')]+'%'};return _0x2955e3;})});}_0x54e752=_[_0x9432('0x4a')]({},_0x54e752,_0x3449f6[_0x9432('0x51')]);return _0x2f9b24[_0x9432('0x56')](_0x54e752);}})[_0x9432('0x31')](function(_0xe30a4){if(_0xe30a4){_0x24e3a7=_0xe30a4['length'];if(!_0x3449f6[_0x9432('0x3a')][_0x9432('0x41')](_0x9432('0x42'))){_0x54e752[_0x9432('0x2d')]=qs[_0x9432('0x2d')](_0x3449f6[_0x9432('0x3a')][_0x9432('0x2d')]);_0x54e752['offset']=qs[_0x9432('0x2c')](_0x3449f6[_0x9432('0x3a')][_0x9432('0x2c')]);}return _0x2f9b24['getConfigurations'](_0x54e752);}})['then'](function(_0x86edc6){if(_0x86edc6){return _0x86edc6?{'count':_0x24e3a7,'rows':_0x86edc6}:null;}})[_0x9432('0x31')](respondWithResult(_0x38ee55,null))[_0x9432('0x26')](handleError(_0x38ee55,null));};exports[_0x9432('0x5a')]=function(_0x39c0db,_0x30c626,_0x2e3c97){if(_0x39c0db[_0x9432('0x53')]['id']){delete _0x39c0db[_0x9432('0x53')]['id'];}return db[_0x9432('0x36')]['findOne']({'where':{'id':_0x39c0db[_0x9432('0x4f')]['id']}})['then'](handleEntityNotFound(_0x30c626,null))['then'](function(_0x3b0b02){if(_0x3b0b02){_0x39c0db['body'][_0x9432('0x5b')]=_0x3b0b02['id'];_0x39c0db[_0x9432('0x53')]['Subjects']=integrations['getSubjects'](_0x39c0db['body'][_0x9432('0x5c')],_0x39c0db[_0x9432('0x53')]['type']);_0x39c0db['body']['Descriptions']=integrations[_0x9432('0x5d')](_0x39c0db[_0x9432('0x53')]['channel'],_0x39c0db[_0x9432('0x53')][_0x9432('0x48')]);return db[_0x9432('0x59')][_0x9432('0x52')](_0x39c0db['body'],{'include':[{'model':db[_0x9432('0x5e')],'as':_0x9432('0x5f')},{'model':db[_0x9432('0x5e')],'as':_0x9432('0x60')}]});}return null;})[_0x9432('0x31')](respondWithResult(_0x30c626,null))['catch'](handleError(_0x30c626,null));};exports[_0x9432('0x61')]=function(_0xe42806,_0x1bd62e,_0x511dda){var _0x514c29;var _0x27154a='';var _0x1a7f9f=_0x9432('0x62');return db[_0x9432('0x36')][_0x9432('0x57')]({'where':{'id':_0xe42806[_0x9432('0x4f')]['id']},'attributes':['id',_0x9432('0x63'),'clientId',_0x9432('0x64'),_0x9432('0x65'),_0x9432('0x66'),_0x9432('0x67')]})[_0x9432('0x31')](handleEntityNotFound(_0x1bd62e,null))['then'](function(_0x1a4bfa){if(_0x1a4bfa){_0x27154a=_0x1a4bfa[_0x9432('0x63')];var _0x225de1=_0x27154a[_0x9432('0x68')](-0x1);if(_0x225de1==='/'){_0x27154a=_0x27154a[_0x9432('0x69')](0x0,_0x27154a['lastIndexOf'](_0x225de1));}_0x514c29=new jsforce[(_0x9432('0x6a'))]({'oauth2':{'loginUrl':_0x27154a,'clientId':_0x1a4bfa[_0x9432('0x6b')],'clientSecret':_0x1a4bfa[_0x9432('0x64')]}});return _0x514c29['login'](_0x1a4bfa[_0x9432('0x65')],_0x1a4bfa[_0x9432('0x66')][_0x9432('0x6c')](_0x1a4bfa[_0x9432('0x67')]));}})[_0x9432('0x31')](function(_0x3452f0){if(_0x3452f0){if(!_['isNil'](_0xe42806[_0x9432('0x3a')][_0x9432('0x6d')])){_0x1a7f9f=_0xe42806[_0x9432('0x3a')][_0x9432('0x6d')];}return _0x514c29[_0x9432('0x6e')](_0x1a7f9f)['describe']();}})['then'](function(_0x36f0aa){var _0x3aad03=[_0x9432('0x6f'),'CallDurationInSeconds',_0x9432('0x70'),'CallType','IsArchived',_0x9432('0x71'),'Status',_0x9432('0x72')];if(!_[_0x9432('0x73')](_0xe42806[_0x9432('0x3a')][_0x9432('0x6d')])&&_0xe42806['query'][_0x9432('0x6d')]==='Case'){_0x3aad03=[_0x9432('0x72'),_0x9432('0x74'),_0x9432('0x75'),_0x9432('0x76'),_0x9432('0x71'),_0x9432('0x77'),_0x9432('0x78'),_0x9432('0x79')];}if(_0x36f0aa){_['remove'](_0x36f0aa['fields'],function(_0x25f525){return _0x25f525[_0x9432('0x7a')]===![]&&!_0x3aad03[_0x9432('0x7b')](_0x25f525['name']);});return{'count':_0x36f0aa['fields']['length'],'rows':_[_0x9432('0x35')](_0x36f0aa[_0x9432('0x3f')],function(_0x5bfa1b){return{'id':_0x5bfa1b[_0x9432('0x33')],'name':_0x5bfa1b['label'],'custom':_0x5bfa1b[_0x9432('0x7a')],'options':_0x5bfa1b['picklistValues']['length']>0x0?_[_0x9432('0x35')](_0x5bfa1b['picklistValues'],function(_0x29d7a3){return{'name':_0x29d7a3[_0x9432('0x7c')],'value':_0x29d7a3[_0x9432('0x7d')]};}):_0x5bfa1b['type']=='boolean'?[{'name':'True','value':_0x9432('0x7e')},{'name':_0x9432('0x7f'),'value':'false'}]:[]};})};}})[_0x9432('0x31')](respondWithResult(_0x1bd62e,null))['catch'](function(_0x4073de){var _0x402dde=_0xe42806['query'][_0x9432('0x18')]?0x1f4:_0x4073de[_0x9432('0x80')]||0x1f4;logger[_0x9432('0x21')](_0x9432('0x81'),_0x9432('0x61'),_0x402dde,JSON[_0x9432('0x20')](_0x4073de));delete _0x4073de[_0x9432('0x33')];if(_0x402dde===0x191){_0x402dde=0x190;}_0x1bd62e['status'](_0x402dde)[_0x9432('0x82')](_0xe42806[_0x9432('0x3a')][_0x9432('0x18')]?{'message':_0x9432('0x83'),'statusCode':_0x4073de[_0x9432('0x80')]}:_0x4073de);});}; \ No newline at end of file +var _0x853c=['IsArchived','Status','Type','Case','Reason','Priority','SuppliedCompany','remove','includes','label','custom','picklistValues','value','boolean','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','update','destroy','name','send','index','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','SalesforceAccount','rawAttributes','length','find','create','body','getConfigurations','findOne','SalesforceConfiguration','keys','order','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Subjects','Task','remoteUri','clientId','clientSecret','securityToken','slice','substring','lastIndexOf','login','concat','isNil','ticketType','sobject','describe','CallDisposition','CallDurationInSeconds','CallObject','CallType'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x853c,0x1a5));var _0xc853=function(_0x3e282b,_0xca0f92){_0x3e282b=_0x3e282b-0x0;var _0x36058c=_0x853c[_0x3e282b];return _0x36058c;};'use strict';var pdf=require(_0xc853('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc853('0x1'));var zipdir=require(_0xc853('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc853('0x3'));var moment=require(_0xc853('0x4'));var BPromise=require(_0xc853('0x5'));var Mustache=require(_0xc853('0x6'));var util=require(_0xc853('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc853('0x8'));var fs=require('fs');var _=require(_0xc853('0x9'));var squel=require(_0xc853('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc853('0xb'));var querystring=require('querystring');var Papa=require(_0xc853('0xc'));var Redis=require(_0xc853('0xd'));var authService=require(_0xc853('0xe'));var qs=require(_0xc853('0xf'));var as=require(_0xc853('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc853('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xc853('0x12'));var db=require(_0xc853('0x13'))['db'];var integrations=require(_0xc853('0x14'));var jayson=require(_0xc853('0x15'));var client=jayson[_0xc853('0x16')][_0xc853('0x17')]({'port':0x232a});function checkPasswordPattern(_0x5c28e1,_0x428086,_0x46dd5e){if(_0x46dd5e){var _0x1150b0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1150b0[_0xc853('0x18')](_0x428086)){return _0x5c28e1;}else{throw new db[(_0xc853('0x19'))]['ValidationError'](_0xc853('0x1a'));}}else{return _0x5c28e1;}}function respondWithRpcPromise(_0x4160cc,_0x1b50a2,_0x5ef6c4,_0x2ba059){return new BPromise(function(_0x4e5227,_0x27a5f5){var _0x54eade=_0x2ba059||client;return _0x54eade[_0xc853('0x1b')](_0x4160cc,_0x5ef6c4)[_0xc853('0x1c')](function(_0x542c68){logger[_0xc853('0x1d')](_0xc853('0x1e'),_0x1b50a2,'request\x20sent');logger[_0xc853('0x1f')](_0xc853('0x20'),_0x1b50a2,_0xc853('0x21'),JSON[_0xc853('0x22')](_0x542c68));if(_0x542c68['error']){if(_0x542c68[_0xc853('0x23')][_0xc853('0x24')]===0x1f4){logger[_0xc853('0x23')](_0xc853('0x1e'),_0x1b50a2,_0x542c68[_0xc853('0x23')][_0xc853('0x25')]);return _0x27a5f5(_0x542c68[_0xc853('0x23')][_0xc853('0x25')]);}logger['error'](_0xc853('0x1e'),_0x1b50a2,_0x542c68['error'][_0xc853('0x25')]);return _0x4e5227(_0x542c68[_0xc853('0x23')][_0xc853('0x25')]);}else{logger[_0xc853('0x1d')](_0xc853('0x1e'),_0x1b50a2,_0xc853('0x21'));_0x4e5227(_0x542c68['result']['message']);}})['catch'](function(_0x30b6e4){logger[_0xc853('0x23')](_0xc853('0x1e'),_0x1b50a2,_0x30b6e4);_0x27a5f5(_0x30b6e4);});});}function respondWithStatusCode(_0x3f476f,_0x3dea6e){_0x3dea6e=_0x3dea6e||0xcc;return function(_0x19be3c){if(_0x19be3c){return _0x3f476f[_0xc853('0x26')](_0x3dea6e);}return _0x3f476f[_0xc853('0x27')](_0x3dea6e)[_0xc853('0x28')]();};}function respondWithResult(_0x4fd56c,_0x59c03a){_0x59c03a=_0x59c03a||0xc8;return function(_0xf68d52){if(_0xf68d52){return _0x4fd56c[_0xc853('0x27')](_0x59c03a)[_0xc853('0x29')](_0xf68d52);}};}function respondWithFilteredResult(_0x537e97,_0x2e548d){return function(_0x5a562a){if(_0x5a562a){var _0x36f5c4=_0x5a562a[_0xc853('0x2a')],_0x23a8d4=_0x2e548d[_0xc853('0x2b')],_0x39f247=_0x2e548d[_0xc853('0x2b')]+_0x2e548d[_0xc853('0x2c')],_0x43db74;if(_0x39f247>=_0x36f5c4){_0x39f247=_0x36f5c4;_0x43db74=0xc8;}else{_0x43db74=0xce;}_0x537e97[_0xc853('0x27')](_0x43db74);return _0x537e97['set'](_0xc853('0x2d'),_0x23a8d4+'-'+_0x39f247+'/'+_0x36f5c4)[_0xc853('0x29')](_0x5a562a);}return null;};}function patchUpdates(_0x569f00){return function(_0x14fc25){try{jsonpatch['apply'](_0x14fc25,_0x569f00,!![]);}catch(_0x40a971){return BPromise[_0xc853('0x2e')](_0x40a971);}return _0x14fc25['save']();};}function saveUpdates(_0x3b2998,_0x1b49b3){return function(_0x3edb57){if(_0x3edb57){return _0x3edb57[_0xc853('0x2f')](_0x3b2998)['then'](function(_0xad7536){return _0xad7536;});}return null;};}function removeEntity(_0x25fe69,_0x5e7cf9){return function(_0x348ebb){if(_0x348ebb){return _0x348ebb[_0xc853('0x30')]()['then'](function(){_0x25fe69[_0xc853('0x27')](0xcc)[_0xc853('0x28')]();});}};}function handleEntityNotFound(_0x3d42ac,_0x4a3500){return function(_0x53a8b2){if(!_0x53a8b2){_0x3d42ac['sendStatus'](0x194);}return _0x53a8b2;};}function handleError(_0x127cb6,_0x3558a2){_0x3558a2=_0x3558a2||0x1f4;return function(_0x1202a7){logger['error'](_0x1202a7['stack']);if(_0x1202a7[_0xc853('0x31')]){delete _0x1202a7[_0xc853('0x31')];}_0x127cb6[_0xc853('0x27')](_0x3558a2)[_0xc853('0x32')](_0x1202a7);};}exports[_0xc853('0x33')]=function(_0x20803d,_0x7c498b){var _0x2d1416={},_0x530c16={},_0x1ac54f={'count':0x0,'rows':[]};var _0x574ead=_['map'](db['SalesforceAccount']['rawAttributes'],function(_0x56524f){return{'name':_0x56524f['fieldName'],'type':_0x56524f[_0xc853('0x34')][_0xc853('0x35')]};});_0x530c16[_0xc853('0x36')]=_[_0xc853('0x37')](_0x574ead,_0xc853('0x31'));_0x530c16['query']=_['keys'](_0x20803d[_0xc853('0x38')]);_0x530c16[_0xc853('0x39')]=_[_0xc853('0x3a')](_0x530c16[_0xc853('0x36')],_0x530c16[_0xc853('0x38')]);_0x2d1416[_0xc853('0x3b')]=_[_0xc853('0x3a')](_0x530c16[_0xc853('0x36')],qs[_0xc853('0x3c')](_0x20803d[_0xc853('0x38')][_0xc853('0x3c')]));_0x2d1416[_0xc853('0x3b')]=_0x2d1416[_0xc853('0x3b')]['length']?_0x2d1416[_0xc853('0x3b')]:_0x530c16[_0xc853('0x36')];if(!_0x20803d[_0xc853('0x38')][_0xc853('0x3d')](_0xc853('0x3e'))){_0x2d1416[_0xc853('0x2c')]=qs[_0xc853('0x2c')](_0x20803d[_0xc853('0x38')][_0xc853('0x2c')]);_0x2d1416[_0xc853('0x2b')]=qs[_0xc853('0x2b')](_0x20803d['query'][_0xc853('0x2b')]);}_0x2d1416['order']=qs[_0xc853('0x3f')](_0x20803d[_0xc853('0x38')]['sort']);_0x2d1416[_0xc853('0x40')]=qs[_0xc853('0x39')](_[_0xc853('0x41')](_0x20803d[_0xc853('0x38')],_0x530c16[_0xc853('0x39')]),_0x574ead);if(_0x20803d['query']['filter']){_0x2d1416[_0xc853('0x40')]=_[_0xc853('0x42')](_0x2d1416['where'],{'$or':_['map'](_0x574ead,function(_0x38d12c){if(_0x38d12c[_0xc853('0x34')]!==_0xc853('0x43')){var _0x53bb7f={};_0x53bb7f[_0x38d12c['name']]={'$like':'%'+_0x20803d[_0xc853('0x38')][_0xc853('0x44')]+'%'};return _0x53bb7f;}})});}_0x2d1416=_[_0xc853('0x42')]({},_0x2d1416,_0x20803d[_0xc853('0x45')]);var _0x8c064b={'where':_0x2d1416[_0xc853('0x40')]};return db['SalesforceAccount'][_0xc853('0x2a')](_0x8c064b)[_0xc853('0x1c')](function(_0x7bd246){_0x1ac54f[_0xc853('0x2a')]=_0x7bd246;if(_0x20803d['query'][_0xc853('0x46')]){_0x2d1416['include']=[{'all':!![]}];}return db['SalesforceAccount'][_0xc853('0x47')](_0x2d1416);})['then'](function(_0x54d83e){_0x1ac54f['rows']=_0x54d83e;return _0x1ac54f;})[_0xc853('0x1c')](respondWithFilteredResult(_0x7c498b,_0x2d1416))[_0xc853('0x48')](handleError(_0x7c498b,null));};exports[_0xc853('0x49')]=function(_0x250673,_0x20c85a){var _0x160758={'raw':![],'where':{'id':_0x250673[_0xc853('0x4a')]['id']}},_0x5ce2d5={};_0x5ce2d5[_0xc853('0x36')]=_['keys'](db[_0xc853('0x4b')][_0xc853('0x4c')]);_0x5ce2d5[_0xc853('0x38')]=_['keys'](_0x250673['query']);_0x5ce2d5[_0xc853('0x39')]=_['intersection'](_0x5ce2d5[_0xc853('0x36')],_0x5ce2d5[_0xc853('0x38')]);_0x160758['attributes']=_[_0xc853('0x3a')](_0x5ce2d5[_0xc853('0x36')],qs['fields'](_0x250673[_0xc853('0x38')][_0xc853('0x3c')]));_0x160758[_0xc853('0x3b')]=_0x160758[_0xc853('0x3b')][_0xc853('0x4d')]?_0x160758[_0xc853('0x3b')]:_0x5ce2d5[_0xc853('0x36')];if(_0x250673['query'][_0xc853('0x46')]){_0x160758['include']=[{'all':!![]}];}_0x160758=_[_0xc853('0x42')]({},_0x160758,_0x250673[_0xc853('0x45')]);return db['SalesforceAccount'][_0xc853('0x4e')](_0x160758)['then'](handleEntityNotFound(_0x20c85a,null))[_0xc853('0x1c')](respondWithResult(_0x20c85a,null))[_0xc853('0x48')](handleError(_0x20c85a,null));};exports[_0xc853('0x4f')]=function(_0x1dc8da,_0x106ff1){return db['SalesforceAccount'][_0xc853('0x4f')](_0x1dc8da[_0xc853('0x50')],{})[_0xc853('0x1c')](respondWithResult(_0x106ff1,0xc9))[_0xc853('0x48')](handleError(_0x106ff1,null));};exports[_0xc853('0x2f')]=function(_0x2b0996,_0x3f2c60){if(_0x2b0996[_0xc853('0x50')]['id']){delete _0x2b0996[_0xc853('0x50')]['id'];}return db[_0xc853('0x4b')][_0xc853('0x4e')]({'where':{'id':_0x2b0996['params']['id']}})[_0xc853('0x1c')](handleEntityNotFound(_0x3f2c60,null))[_0xc853('0x1c')](saveUpdates(_0x2b0996[_0xc853('0x50')],null))[_0xc853('0x1c')](respondWithResult(_0x3f2c60,null))[_0xc853('0x48')](handleError(_0x3f2c60,null));};exports[_0xc853('0x30')]=function(_0x34d6d1,_0x3cfb85){return db[_0xc853('0x4b')][_0xc853('0x4e')]({'where':{'id':_0x34d6d1[_0xc853('0x4a')]['id']}})[_0xc853('0x1c')](handleEntityNotFound(_0x3cfb85,null))['then'](removeEntity(_0x3cfb85,null))[_0xc853('0x48')](handleError(_0x3cfb85,null));};exports[_0xc853('0x51')]=function(_0x274ed5,_0x27596b,_0x558221){var _0x1076c4={};var _0x1cdc44={};var _0x5c5436;var _0x2dfe3b;return db[_0xc853('0x4b')][_0xc853('0x52')]({'where':{'id':_0x274ed5[_0xc853('0x4a')]['id']}})[_0xc853('0x1c')](handleEntityNotFound(_0x27596b,null))['then'](function(_0x507129){if(_0x507129){_0x5c5436=_0x507129;_0x1cdc44['model']=_['keys'](db[_0xc853('0x53')]['rawAttributes']);_0x1cdc44['query']=_[_0xc853('0x54')](_0x274ed5[_0xc853('0x38')]);_0x1cdc44['filters']=_[_0xc853('0x3a')](_0x1cdc44[_0xc853('0x36')],_0x1cdc44[_0xc853('0x38')]);_0x1076c4[_0xc853('0x3b')]=_[_0xc853('0x3a')](_0x1cdc44[_0xc853('0x36')],qs[_0xc853('0x3c')](_0x274ed5[_0xc853('0x38')][_0xc853('0x3c')]));_0x1076c4[_0xc853('0x3b')]=_0x1076c4[_0xc853('0x3b')]['length']?_0x1076c4[_0xc853('0x3b')]:_0x1cdc44[_0xc853('0x36')];_0x1076c4[_0xc853('0x55')]=qs[_0xc853('0x3f')](_0x274ed5[_0xc853('0x38')]['sort']);_0x1076c4[_0xc853('0x40')]=qs[_0xc853('0x39')](_[_0xc853('0x41')](_0x274ed5['query'],_0x1cdc44[_0xc853('0x39')]));if(_0x274ed5[_0xc853('0x38')]['filter']){_0x1076c4[_0xc853('0x40')]=_[_0xc853('0x42')](_0x1076c4[_0xc853('0x40')],{'$or':_['map'](_0x1076c4['attributes'],function(_0x453c8c){var _0x52f88e={};_0x52f88e[_0x453c8c]={'$like':'%'+_0x274ed5[_0xc853('0x38')][_0xc853('0x44')]+'%'};return _0x52f88e;})});}_0x1076c4=_[_0xc853('0x42')]({},_0x1076c4,_0x274ed5[_0xc853('0x45')]);return _0x5c5436['getConfigurations'](_0x1076c4);}})[_0xc853('0x1c')](function(_0x359e28){if(_0x359e28){_0x2dfe3b=_0x359e28[_0xc853('0x4d')];if(!_0x274ed5[_0xc853('0x38')][_0xc853('0x3d')](_0xc853('0x3e'))){_0x1076c4[_0xc853('0x2c')]=qs[_0xc853('0x2c')](_0x274ed5[_0xc853('0x38')]['limit']);_0x1076c4[_0xc853('0x2b')]=qs[_0xc853('0x2b')](_0x274ed5[_0xc853('0x38')][_0xc853('0x2b')]);}return _0x5c5436[_0xc853('0x51')](_0x1076c4);}})[_0xc853('0x1c')](function(_0x523a5e){if(_0x523a5e){return _0x523a5e?{'count':_0x2dfe3b,'rows':_0x523a5e}:null;}})['then'](respondWithResult(_0x27596b,null))[_0xc853('0x48')](handleError(_0x27596b,null));};exports[_0xc853('0x56')]=function(_0x2125a0,_0x4839c5,_0x5727fa){if(_0x2125a0['body']['id']){delete _0x2125a0['body']['id'];}return db[_0xc853('0x4b')][_0xc853('0x52')]({'where':{'id':_0x2125a0[_0xc853('0x4a')]['id']}})[_0xc853('0x1c')](handleEntityNotFound(_0x4839c5,null))[_0xc853('0x1c')](function(_0x1753f1){if(_0x1753f1){_0x2125a0[_0xc853('0x50')]['AccountId']=_0x1753f1['id'];_0x2125a0['body']['Subjects']=integrations[_0xc853('0x57')](_0x2125a0[_0xc853('0x50')][_0xc853('0x58')],_0x2125a0[_0xc853('0x50')][_0xc853('0x34')]);_0x2125a0[_0xc853('0x50')][_0xc853('0x59')]=integrations[_0xc853('0x5a')](_0x2125a0[_0xc853('0x50')][_0xc853('0x58')],_0x2125a0['body']['type']);return db[_0xc853('0x53')][_0xc853('0x4f')](_0x2125a0[_0xc853('0x50')],{'include':[{'model':db[_0xc853('0x5b')],'as':_0xc853('0x5c')},{'model':db[_0xc853('0x5b')],'as':'Descriptions'}]});}return null;})[_0xc853('0x1c')](respondWithResult(_0x4839c5,null))[_0xc853('0x48')](handleError(_0x4839c5,null));};exports['getFields']=function(_0x520703,_0x416af0,_0x3eb9e1){var _0x3ebebb;var _0x3b6afb='';var _0x2d402a=_0xc853('0x5d');return db[_0xc853('0x4b')]['findOne']({'where':{'id':_0x520703[_0xc853('0x4a')]['id']},'attributes':['id',_0xc853('0x5e'),_0xc853('0x5f'),_0xc853('0x60'),'username','password',_0xc853('0x61')]})[_0xc853('0x1c')](handleEntityNotFound(_0x416af0,null))[_0xc853('0x1c')](function(_0x2d8b47){if(_0x2d8b47){_0x3b6afb=_0x2d8b47[_0xc853('0x5e')];var _0x5d1eb2=_0x3b6afb[_0xc853('0x62')](-0x1);if(_0x5d1eb2==='/'){_0x3b6afb=_0x3b6afb[_0xc853('0x63')](0x0,_0x3b6afb[_0xc853('0x64')](_0x5d1eb2));}_0x3ebebb=new jsforce['Connection']({'oauth2':{'loginUrl':_0x3b6afb,'clientId':_0x2d8b47[_0xc853('0x5f')],'clientSecret':_0x2d8b47['clientSecret']}});return _0x3ebebb[_0xc853('0x65')](_0x2d8b47['username'],_0x2d8b47['password'][_0xc853('0x66')](_0x2d8b47[_0xc853('0x61')]));}})[_0xc853('0x1c')](function(_0x164dc9){if(_0x164dc9){if(!_[_0xc853('0x67')](_0x520703[_0xc853('0x38')][_0xc853('0x68')])){_0x2d402a=_0x520703['query'][_0xc853('0x68')];}return _0x3ebebb[_0xc853('0x69')](_0x2d402a)[_0xc853('0x6a')]();}})[_0xc853('0x1c')](function(_0x1e3e1f){var _0x7a2ef1=[_0xc853('0x6b'),_0xc853('0x6c'),_0xc853('0x6d'),_0xc853('0x6e'),_0xc853('0x6f'),'Priority',_0xc853('0x70'),_0xc853('0x71')];if(!_['isNil'](_0x520703[_0xc853('0x38')][_0xc853('0x68')])&&_0x520703[_0xc853('0x38')][_0xc853('0x68')]===_0xc853('0x72')){_0x7a2ef1=[_0xc853('0x71'),'Origin',_0xc853('0x73'),'Status',_0xc853('0x74'),'IsEscalated','SuppliedName',_0xc853('0x75')];}if(_0x1e3e1f){_[_0xc853('0x76')](_0x1e3e1f['fields'],function(_0x4b6384){return _0x4b6384['custom']===![]&&!_0x7a2ef1[_0xc853('0x77')](_0x4b6384[_0xc853('0x31')]);});return{'count':_0x1e3e1f[_0xc853('0x3c')][_0xc853('0x4d')],'rows':_[_0xc853('0x37')](_0x1e3e1f[_0xc853('0x3c')],function(_0x237490){return{'id':_0x237490[_0xc853('0x31')],'name':_0x237490[_0xc853('0x78')],'custom':_0x237490[_0xc853('0x79')],'options':_0x237490[_0xc853('0x7a')]['length']>0x0?_['map'](_0x237490[_0xc853('0x7a')],function(_0x1c38a8){return{'name':_0x1c38a8['label'],'value':_0x1c38a8[_0xc853('0x7b')]};}):_0x237490[_0xc853('0x34')]==_0xc853('0x7c')?[{'name':_0xc853('0x7d'),'value':_0xc853('0x7e')},{'name':_0xc853('0x7f'),'value':_0xc853('0x80')}]:[]};})};}})['then'](respondWithResult(_0x416af0,null))[_0xc853('0x48')](function(_0xb30656){var _0x1fd11f=_0x520703[_0xc853('0x38')]['test']?0x1f4:_0xb30656[_0xc853('0x81')]||0x1f4;logger[_0xc853('0x23')](_0xc853('0x82'),_0xc853('0x83'),_0x1fd11f,JSON[_0xc853('0x22')](_0xb30656));delete _0xb30656['name'];if(_0x1fd11f===0x191){_0x1fd11f=0x190;}_0x416af0[_0xc853('0x27')](_0x1fd11f)[_0xc853('0x32')](_0x520703['query'][_0xc853('0x18')]?{'message':_0xc853('0x84'),'statusCode':_0xb30656[_0xc853('0x81')]}:_0xb30656);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index e27ca33..c3c630c 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 _0xc8a7=['moment','bluebird','path','rimraf','./intSalesforceAccount.attributes','exports','util','api'];(function(_0x44ff66,_0x27f548){var _0x136331=function(_0x4c14b5){while(--_0x4c14b5){_0x44ff66['push'](_0x44ff66['shift']());}};_0x136331(++_0x27f548);}(_0xc8a7,0x7e));var _0x7c8a=function(_0x2eb123,_0x197b53){_0x2eb123=_0x2eb123-0x0;var _0x1f616d=_0xc8a7[_0x2eb123];return _0x1f616d;};'use strict';var _=require('lodash');var util=require(_0x7c8a('0x0'));var logger=require('../../config/logger')(_0x7c8a('0x1'));var moment=require(_0x7c8a('0x2'));var BPromise=require(_0x7c8a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c8a('0x4'));var rimraf=require(_0x7c8a('0x5'));var config=require('../../config/environment');var attributes=require(_0x7c8a('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x7c8a('0x7')]=function(_0x18dcc4,_0x2f861d){return _0x18dcc4['define']('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x638e=['../../config/environment','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x38abc8,_0x1f8dc5){var _0x849710=function(_0x4b409a){while(--_0x4b409a){_0x38abc8['push'](_0x38abc8['shift']());}};_0x849710(++_0x1f8dc5);}(_0x638e,0x89));var _0xe638=function(_0x330bb0,_0x4f695f){_0x330bb0=_0x330bb0-0x0;var _0x442278=_0x638e[_0x330bb0];return _0x442278;};'use strict';var _=require(_0xe638('0x0'));var util=require(_0xe638('0x1'));var logger=require(_0xe638('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe638('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe638('0x4'));var rimraf=require(_0xe638('0x5'));var config=require(_0xe638('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xe638('0x7'));module['exports']=function(_0x3906f2,_0x151c49){return _0x3906f2[_0xe638('0x8')](_0xe638('0x9'),attributes,{'tableName':_0xe638('0xa'),'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 52423d0..0688f76 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 _0xf3cd=['find','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x311e77,_0x49a459){_0x311e77=_0x311e77-0x0;var _0x559c54=_0xf3cd[_0x311e77];return _0x559c54;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0601,_0x106021,_0x28edae){return new BPromise(function(_0x52c073,_0x15705d){return client['request'](_0x1f0601,_0x28edae)['then'](function(_0x22d8ae){logger[_0xdf3c('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x106021,_0xdf3c('0xd'));logger[_0xdf3c('0xe')](_0xdf3c('0xf'),_0x106021,_0xdf3c('0xd'),JSON[_0xdf3c('0x10')](_0x22d8ae));if(_0x22d8ae[_0xdf3c('0x11')]){if(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x12')]===0x1f4){logger['error'](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);return _0x15705d(_0x22d8ae[_0xdf3c('0x11')]['message']);}logger[_0xdf3c('0x11')](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')]['message']);return _0x52c073(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);}else{logger[_0xdf3c('0xc')](_0xdf3c('0x13'),_0x106021,_0xdf3c('0xd'));_0x52c073(_0x22d8ae[_0xdf3c('0x15')][_0xdf3c('0x14')]);}})[_0xdf3c('0x16')](function(_0x2986d0){logger[_0xdf3c('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});}exports[_0xdf3c('0x17')]=function(_0x465e7d){var _0xf1da1f=this;return new Promise(function(_0x18d4ec,_0x1e2690){return db[_0xdf3c('0x18')][_0xdf3c('0x19')]({'raw':_0x465e7d[_0xdf3c('0x1a')]?_0x465e7d[_0xdf3c('0x1a')][_0xdf3c('0x1b')]===undefined?!![]:![]:!![],'where':_0x465e7d[_0xdf3c('0x1a')]?_0x465e7d[_0xdf3c('0x1a')][_0xdf3c('0x1c')]||null:null,'attributes':_0x465e7d['options']?_0x465e7d['options'][_0xdf3c('0x1d')]||null:null,'limit':_0x465e7d['options']?_0x465e7d[_0xdf3c('0x1a')][_0xdf3c('0x1e')]||null:null,'include':_0x465e7d[_0xdf3c('0x1a')]?_0x465e7d[_0xdf3c('0x1a')][_0xdf3c('0x1f')]?_[_0xdf3c('0x20')](_0x465e7d['options'][_0xdf3c('0x1f')],function(_0x213d75){return{'model':db[_0x213d75[_0xdf3c('0x21')]],'as':_0x213d75['as'],'attributes':_0x213d75[_0xdf3c('0x1d')],'include':_0x213d75[_0xdf3c('0x1f')]?_[_0xdf3c('0x20')](_0x213d75[_0xdf3c('0x1f')],function(_0x155f54){return{'model':db[_0x155f54[_0xdf3c('0x21')]],'as':_0x155f54['as'],'attributes':_0x155f54[_0xdf3c('0x1d')],'include':_0x155f54['include']?_[_0xdf3c('0x20')](_0x155f54[_0xdf3c('0x1f')],function(_0x4b57a4){return{'model':db[_0x4b57a4[_0xdf3c('0x21')]],'as':_0x4b57a4['as'],'attributes':_0x4b57a4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x508be9){logger[_0xdf3c('0xc')](_0xdf3c('0x17'),_0x465e7d);logger['debug']('GetSalesforceAccount',_0x465e7d,JSON[_0xdf3c('0x10')](_0x508be9));_0x18d4ec(_0x508be9);})[_0xdf3c('0x16')](function(_0xd3cfcb){logger[_0xdf3c('0x11')]('GetSalesforceAccount',_0xd3cfcb[_0xdf3c('0x14')],_0x465e7d);_0x1e2690(_0xf1da1f[_0xdf3c('0x11')](0x1f4,_0xd3cfcb['message']));});});};exports['ShowSalesforceAccount']=function(_0x1f1d8a){var _0x46f0e3=this;return new Promise(function(_0x36937e,_0x540f3a){return db[_0xdf3c('0x18')][_0xdf3c('0x22')]({'raw':_0x1f1d8a[_0xdf3c('0x1a')]?_0x1f1d8a[_0xdf3c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1f1d8a[_0xdf3c('0x1a')]?_0x1f1d8a[_0xdf3c('0x1a')]['where']||null:null,'attributes':_0x1f1d8a[_0xdf3c('0x1a')]?_0x1f1d8a[_0xdf3c('0x1a')][_0xdf3c('0x1d')]||null:null,'include':_0x1f1d8a[_0xdf3c('0x1a')]?_0x1f1d8a['options'][_0xdf3c('0x1f')]?_[_0xdf3c('0x20')](_0x1f1d8a[_0xdf3c('0x1a')][_0xdf3c('0x1f')],function(_0x4c1f49){return{'model':db[_0x4c1f49[_0xdf3c('0x21')]],'as':_0x4c1f49['as'],'attributes':_0x4c1f49[_0xdf3c('0x1d')],'include':_0x4c1f49['include']?_['map'](_0x4c1f49[_0xdf3c('0x1f')],function(_0x588d02){return{'model':db[_0x588d02[_0xdf3c('0x21')]],'as':_0x588d02['as'],'attributes':_0x588d02['attributes'],'include':_0x588d02['include']?_['map'](_0x588d02[_0xdf3c('0x1f')],function(_0x2ee9ad){return{'model':db[_0x2ee9ad[_0xdf3c('0x21')]],'as':_0x2ee9ad['as'],'attributes':_0x2ee9ad[_0xdf3c('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49f147){logger[_0xdf3c('0xc')]('ShowSalesforceAccount',_0x1f1d8a);logger[_0xdf3c('0xe')](_0xdf3c('0x23'),_0x1f1d8a,JSON[_0xdf3c('0x10')](_0x49f147));_0x36937e(_0x49f147);})[_0xdf3c('0x16')](function(_0x1004e9){logger[_0xdf3c('0x11')](_0xdf3c('0x23'),_0x1004e9[_0xdf3c('0x14')],_0x1f1d8a);_0x540f3a(_0x46f0e3[_0xdf3c('0x11')](0x1f4,_0x1004e9['message']));});});}; \ No newline at end of file +var _0x2e54=['error','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','where','attributes','map','include','model','ShowSalesforceAccount','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s'];(function(_0x262254,_0x2271ee){var _0x73f784=function(_0x211dd9){while(--_0x211dd9){_0x262254['push'](_0x262254['shift']());}};_0x73f784(++_0x2271ee);}(_0x2e54,0x1dd));var _0x42e5=function(_0x25fe81,_0x540962){_0x25fe81=_0x25fe81-0x0;var _0x5e6d21=_0x2e54[_0x25fe81];return _0x5e6d21;};'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);});});}exports[_0x42e5('0x16')]=function(_0x38282d){var _0x11550e=this;return new Promise(function(_0x23fe09,_0x54fcfc){return db[_0x42e5('0x17')]['findAll']({'raw':_0x38282d['options']?_0x38282d[_0x42e5('0x18')][_0x42e5('0x19')]===undefined?!![]:![]:!![],'where':_0x38282d['options']?_0x38282d[_0x42e5('0x18')][_0x42e5('0x1a')]||null:null,'attributes':_0x38282d[_0x42e5('0x18')]?_0x38282d[_0x42e5('0x18')][_0x42e5('0x1b')]||null:null,'limit':_0x38282d[_0x42e5('0x18')]?_0x38282d[_0x42e5('0x18')]['limit']||null:null,'include':_0x38282d['options']?_0x38282d[_0x42e5('0x18')]['include']?_[_0x42e5('0x1c')](_0x38282d[_0x42e5('0x18')][_0x42e5('0x1d')],function(_0x49490f){return{'model':db[_0x49490f[_0x42e5('0x1e')]],'as':_0x49490f['as'],'attributes':_0x49490f['attributes'],'include':_0x49490f[_0x42e5('0x1d')]?_[_0x42e5('0x1c')](_0x49490f[_0x42e5('0x1d')],function(_0x275c80){return{'model':db[_0x275c80[_0x42e5('0x1e')]],'as':_0x275c80['as'],'attributes':_0x275c80['attributes'],'include':_0x275c80['include']?_[_0x42e5('0x1c')](_0x275c80['include'],function(_0x56f812){return{'model':db[_0x56f812[_0x42e5('0x1e')]],'as':_0x56f812['as'],'attributes':_0x56f812['attributes']};}):[]};}):[]};}):[]:[]})[_0x42e5('0xc')](function(_0x2d9e65){logger[_0x42e5('0xd')](_0x42e5('0x16'),_0x38282d);logger[_0x42e5('0x10')](_0x42e5('0x16'),_0x38282d,JSON['stringify'](_0x2d9e65));_0x23fe09(_0x2d9e65);})[_0x42e5('0x15')](function(_0x201d9e){logger[_0x42e5('0x12')](_0x42e5('0x16'),_0x201d9e[_0x42e5('0x13')],_0x38282d);_0x54fcfc(_0x11550e[_0x42e5('0x12')](0x1f4,_0x201d9e[_0x42e5('0x13')]));});});};exports[_0x42e5('0x1f')]=function(_0x5a4930){var _0x2ba9ef=this;return new Promise(function(_0x2c7542,_0x3d9e8b){return db[_0x42e5('0x17')]['find']({'raw':_0x5a4930[_0x42e5('0x18')]?_0x5a4930[_0x42e5('0x18')][_0x42e5('0x19')]===undefined?!![]:![]:!![],'where':_0x5a4930[_0x42e5('0x18')]?_0x5a4930['options']['where']||null:null,'attributes':_0x5a4930[_0x42e5('0x18')]?_0x5a4930['options'][_0x42e5('0x1b')]||null:null,'include':_0x5a4930['options']?_0x5a4930[_0x42e5('0x18')][_0x42e5('0x1d')]?_[_0x42e5('0x1c')](_0x5a4930['options'][_0x42e5('0x1d')],function(_0x3a8d1c){return{'model':db[_0x3a8d1c['model']],'as':_0x3a8d1c['as'],'attributes':_0x3a8d1c[_0x42e5('0x1b')],'include':_0x3a8d1c['include']?_[_0x42e5('0x1c')](_0x3a8d1c[_0x42e5('0x1d')],function(_0x25a040){return{'model':db[_0x25a040[_0x42e5('0x1e')]],'as':_0x25a040['as'],'attributes':_0x25a040[_0x42e5('0x1b')],'include':_0x25a040[_0x42e5('0x1d')]?_[_0x42e5('0x1c')](_0x25a040['include'],function(_0x5a18cc){return{'model':db[_0x5a18cc[_0x42e5('0x1e')]],'as':_0x5a18cc['as'],'attributes':_0x5a18cc[_0x42e5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x42e5('0xc')](function(_0x4a1a8a){logger['info']('ShowSalesforceAccount',_0x5a4930);logger['debug'](_0x42e5('0x1f'),_0x5a4930,JSON[_0x42e5('0x20')](_0x4a1a8a));_0x2c7542(_0x4a1a8a);})[_0x42e5('0x15')](function(_0xedb7bc){logger[_0x42e5('0x12')](_0x42e5('0x1f'),_0xedb7bc[_0x42e5('0x13')],_0x5a4930);_0x3d9e8b(_0x2ba9ef[_0x42e5('0x12')](0x1f4,_0xedb7bc['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index e8523ae..b8ab605 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 _0xdd35=['/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x4983bc,_0x847e02){var _0x3328ee=function(_0x7cc24b){while(--_0x7cc24b){_0x4983bc['push'](_0x4983bc['shift']());}};_0x3328ee(++_0x847e02);}(_0xdd35,0x103));var _0x5dd3=function(_0x1b083e,_0x236bf0){_0x1b083e=_0x1b083e-0x0;var _0x31fde6=_0xdd35[_0x1b083e];return _0x31fde6;};'use strict';var multer=require(_0x5dd3('0x0'));var util=require(_0x5dd3('0x1'));var path=require(_0x5dd3('0x2'));var timeout=require(_0x5dd3('0x3'));var express=require('express');var router=express[_0x5dd3('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5dd3('0x5'));var config=require(_0x5dd3('0x6'));var controller=require('./intSalesforceConfiguration.controller');router['get']('/',auth[_0x5dd3('0x7')](),controller[_0x5dd3('0x8')]);router[_0x5dd3('0x9')](_0x5dd3('0xa'),auth[_0x5dd3('0x7')](),controller[_0x5dd3('0xb')]);router[_0x5dd3('0x9')](_0x5dd3('0xc'),auth[_0x5dd3('0x7')](),controller[_0x5dd3('0xd')]);router[_0x5dd3('0x9')](_0x5dd3('0xe'),auth[_0x5dd3('0x7')](),controller[_0x5dd3('0xf')]);router['get'](_0x5dd3('0x10'),auth[_0x5dd3('0x7')](),controller[_0x5dd3('0x11')]);router[_0x5dd3('0x12')]('/',auth[_0x5dd3('0x7')](),controller[_0x5dd3('0x13')]);router[_0x5dd3('0x14')](_0x5dd3('0xa'),auth[_0x5dd3('0x7')](),controller[_0x5dd3('0x15')]);router[_0x5dd3('0x16')](_0x5dd3('0xa'),auth[_0x5dd3('0x7')](),controller[_0x5dd3('0x17')]);module[_0x5dd3('0x18')]=router; \ No newline at end of file +var _0xb6ec=['../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','isAuthenticated','index','/:id','show','get','/:id/subjects','getDescriptions','create','put','update','destroy','exports','util','express','Router'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb6ec,0xe7));var _0xcb6e=function(_0x4be03e,_0x3e585f){_0x4be03e=_0x4be03e-0x0;var _0xac5ed8=_0xb6ec[_0x4be03e];return _0xac5ed8;};'use strict';var multer=require('multer');var util=require(_0xcb6e('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcb6e('0x1'));var router=express[_0xcb6e('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xcb6e('0x3'));var config=require(_0xcb6e('0x4'));var controller=require(_0xcb6e('0x5'));router['get']('/',auth[_0xcb6e('0x6')](),controller[_0xcb6e('0x7')]);router['get'](_0xcb6e('0x8'),auth[_0xcb6e('0x6')](),controller[_0xcb6e('0x9')]);router[_0xcb6e('0xa')]('/:id/fields',auth[_0xcb6e('0x6')](),controller['getFields']);router[_0xcb6e('0xa')](_0xcb6e('0xb'),auth[_0xcb6e('0x6')](),controller['getSubjects']);router[_0xcb6e('0xa')]('/:id/descriptions',auth[_0xcb6e('0x6')](),controller[_0xcb6e('0xc')]);router['post']('/',auth[_0xcb6e('0x6')](),controller[_0xcb6e('0xd')]);router[_0xcb6e('0xe')](_0xcb6e('0x8'),auth[_0xcb6e('0x6')](),controller[_0xcb6e('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xcb6e('0x10')]);module[_0xcb6e('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 31d25c1..82a81b9 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 _0x9110=['Task','contact_lead','contact','lead','nothing','exports','STRING','Case'];(function(_0x36258f,_0x4ae350){var _0x259dd3=function(_0x3d7c65){while(--_0x3d7c65){_0x36258f['push'](_0x36258f['shift']());}};_0x259dd3(++_0x4ae350);}(_0x9110,0xa5));var _0x0911=function(_0x14b2d0,_0x303cc0){_0x14b2d0=_0x14b2d0-0x0;var _0x345d35=_0x9110[_0x14b2d0];return _0x345d35;};'use strict';var Sequelize=require('sequelize');module[_0x0911('0x0')]={'name':{'type':Sequelize[_0x0911('0x1')]},'description':{'type':Sequelize[_0x0911('0x1')]},'ticketType':{'type':Sequelize['ENUM']('Task',_0x0911('0x2')),'defaultValue':_0x0911('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0x0911('0x4'),_0x0911('0x5'),_0x0911('0x6')),'defaultValue':_0x0911('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0x0911('0x7'),'contact',_0x0911('0x6')),'defaultValue':_0x0911('0x6')}}; \ No newline at end of file +var _0xfc1e=['exports','STRING','ENUM','Task','contact_lead','contact','nothing','lead','sequelize'];(function(_0x6f1a87,_0x5d5bcf){var _0x2495c7=function(_0x1c6733){while(--_0x1c6733){_0x6f1a87['push'](_0x6f1a87['shift']());}};_0x2495c7(++_0x5d5bcf);}(_0xfc1e,0xce));var _0xefc1=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xfc1e[_0x3d42d8];return _0x27fc41;};'use strict';var Sequelize=require(_0xefc1('0x0'));module[_0xefc1('0x1')]={'name':{'type':Sequelize[_0xefc1('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xefc1('0x3')](_0xefc1('0x4'),'Case'),'defaultValue':_0xefc1('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0xefc1('0x5'),_0xefc1('0x6'),'lead'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xefc1('0x3')](_0xefc1('0x7'),'contact',_0xefc1('0x8')),'defaultValue':_0xefc1('0x8')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index b0661d9..38e7c91 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 _0x49c0=['getFields','getSubjects','nolimit','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','where','type','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','show','length','find','create','body','params','findOne','SalesforceField'];(function(_0x353777,_0x155c1d){var _0x20fc78=function(_0x388436){while(--_0x388436){_0x353777['push'](_0x353777['shift']());}};_0x20fc78(++_0x155c1d);}(_0x49c0,0x188));var _0x049c=function(_0x23f98d,_0x380bec){_0x23f98d=_0x23f98d-0x0;var _0x15146b=_0x49c0[_0x23f98d];return _0x15146b;};'use strict';var pdf=require(_0x049c('0x0'));var emlformat=require(_0x049c('0x1'));var rimraf=require(_0x049c('0x2'));var zipdir=require(_0x049c('0x3'));var jsonpatch=require(_0x049c('0x4'));var rp=require(_0x049c('0x5'));var moment=require(_0x049c('0x6'));var BPromise=require(_0x049c('0x7'));var Mustache=require(_0x049c('0x8'));var util=require(_0x049c('0x9'));var path=require('path');var sox=require(_0x049c('0xa'));var csv=require(_0x049c('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x049c('0xc'));var squel=require(_0x049c('0xd'));var crypto=require('crypto');var jsforce=require(_0x049c('0xe'));var deskjs=require(_0x049c('0xf'));var toCsv=require(_0x049c('0xb'));var querystring=require(_0x049c('0x10'));var Papa=require(_0x049c('0x11'));var Redis=require(_0x049c('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x049c('0x13'));var hardwareService=require(_0x049c('0x14'));var logger=require(_0x049c('0x15'))('api');var utils=require(_0x049c('0x16'));var config=require(_0x049c('0x17'));var db=require(_0x049c('0x18'))['db'];var jayson=require(_0x049c('0x19'));var client=jayson['client'][_0x049c('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x1d1746,_0x37abb7,_0x3081d1){if(_0x3081d1){var _0x1c15e5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1c15e5[_0x049c('0x1b')](_0x37abb7)){return _0x1d1746;}else{throw new db[(_0x049c('0x1c'))]['ValidationError'](_0x049c('0x1d'));}}else{return _0x1d1746;}}function respondWithRpcPromise(_0x2bec8b,_0x35c162,_0x290fa5,_0x159dea){return new BPromise(function(_0x246439,_0x44f736){var _0x6379e4=_0x159dea||client;return _0x6379e4[_0x049c('0x1e')](_0x2bec8b,_0x290fa5)['then'](function(_0x4dfa9b){logger[_0x049c('0x1f')](_0x049c('0x20'),_0x35c162,_0x049c('0x21'));logger[_0x049c('0x22')](_0x049c('0x23'),_0x35c162,_0x049c('0x21'),JSON['stringify'](_0x4dfa9b));if(_0x4dfa9b[_0x049c('0x24')]){if(_0x4dfa9b[_0x049c('0x24')][_0x049c('0x25')]===0x1f4){logger[_0x049c('0x24')](_0x049c('0x20'),_0x35c162,_0x4dfa9b['error'][_0x049c('0x26')]);return _0x44f736(_0x4dfa9b[_0x049c('0x24')][_0x049c('0x26')]);}logger['error'](_0x049c('0x20'),_0x35c162,_0x4dfa9b[_0x049c('0x24')][_0x049c('0x26')]);return _0x246439(_0x4dfa9b[_0x049c('0x24')][_0x049c('0x26')]);}else{logger[_0x049c('0x1f')](_0x049c('0x20'),_0x35c162,_0x049c('0x21'));_0x246439(_0x4dfa9b[_0x049c('0x27')][_0x049c('0x26')]);}})[_0x049c('0x28')](function(_0x56789e){logger['error'](_0x049c('0x20'),_0x35c162,_0x56789e);_0x44f736(_0x56789e);});});}function respondWithStatusCode(_0x32142d,_0x1c20b2){_0x1c20b2=_0x1c20b2||0xcc;return function(_0x1353d7){if(_0x1353d7){return _0x32142d[_0x049c('0x29')](_0x1c20b2);}return _0x32142d[_0x049c('0x2a')](_0x1c20b2)[_0x049c('0x2b')]();};}function respondWithResult(_0x214264,_0x43dfc5){_0x43dfc5=_0x43dfc5||0xc8;return function(_0x46c3b2){if(_0x46c3b2){return _0x214264[_0x049c('0x2a')](_0x43dfc5)[_0x049c('0x2c')](_0x46c3b2);}};}function respondWithFilteredResult(_0x1edeee,_0x1cf397){return function(_0x3516cf){if(_0x3516cf){var _0x38271f=_0x3516cf['count'],_0x5c46fa=_0x1cf397[_0x049c('0x2d')],_0x15afa8=_0x1cf397[_0x049c('0x2d')]+_0x1cf397[_0x049c('0x2e')],_0x3d1bd5;if(_0x15afa8>=_0x38271f){_0x15afa8=_0x38271f;_0x3d1bd5=0xc8;}else{_0x3d1bd5=0xce;}_0x1edeee['status'](_0x3d1bd5);return _0x1edeee[_0x049c('0x2f')](_0x049c('0x30'),_0x5c46fa+'-'+_0x15afa8+'/'+_0x38271f)[_0x049c('0x2c')](_0x3516cf);}return null;};}function patchUpdates(_0x58b3a3){return function(_0x2eed0a){try{jsonpatch[_0x049c('0x31')](_0x2eed0a,_0x58b3a3,!![]);}catch(_0xe19905){return BPromise['reject'](_0xe19905);}return _0x2eed0a[_0x049c('0x32')]();};}function saveUpdates(_0x314af5,_0x1f1144){return function(_0xc74609){if(_0xc74609){return _0xc74609[_0x049c('0x33')](_0x314af5)[_0x049c('0x34')](function(_0x3e09fd){return _0x3e09fd;});}return null;};}function removeEntity(_0x20379a,_0x2c9b58){return function(_0xd46d04){if(_0xd46d04){return _0xd46d04[_0x049c('0x35')]()[_0x049c('0x34')](function(){_0x20379a[_0x049c('0x2a')](0xcc)[_0x049c('0x2b')]();});}};}function handleEntityNotFound(_0x29e601,_0x21b0a3){return function(_0x2f3284){if(!_0x2f3284){_0x29e601[_0x049c('0x29')](0x194);}return _0x2f3284;};}function handleError(_0x2444e4,_0x25d5fa){_0x25d5fa=_0x25d5fa||0x1f4;return function(_0x42eea5){logger['error'](_0x42eea5[_0x049c('0x36')]);if(_0x42eea5['name']){delete _0x42eea5[_0x049c('0x37')];}_0x2444e4[_0x049c('0x2a')](_0x25d5fa)[_0x049c('0x38')](_0x42eea5);};}exports[_0x049c('0x39')]=function(_0x4327df,_0x47d4a8){var _0xca9e5b={},_0x298f2d={},_0x28ebca={'count':0x0,'rows':[]};var _0x20a3fd=_[_0x049c('0x3a')](db[_0x049c('0x3b')][_0x049c('0x3c')],function(_0x44eb3f){return{'name':_0x44eb3f[_0x049c('0x3d')],'type':_0x44eb3f['type'][_0x049c('0x3e')]};});_0x298f2d[_0x049c('0x3f')]=_[_0x049c('0x3a')](_0x20a3fd,_0x049c('0x37'));_0x298f2d['query']=_[_0x049c('0x40')](_0x4327df[_0x049c('0x41')]);_0x298f2d[_0x049c('0x42')]=_[_0x049c('0x43')](_0x298f2d[_0x049c('0x3f')],_0x298f2d[_0x049c('0x41')]);_0xca9e5b[_0x049c('0x44')]=_[_0x049c('0x43')](_0x298f2d[_0x049c('0x3f')],qs[_0x049c('0x45')](_0x4327df[_0x049c('0x41')][_0x049c('0x45')]));_0xca9e5b['attributes']=_0xca9e5b[_0x049c('0x44')]['length']?_0xca9e5b[_0x049c('0x44')]:_0x298f2d[_0x049c('0x3f')];if(!_0x4327df[_0x049c('0x41')][_0x049c('0x46')]('nolimit')){_0xca9e5b[_0x049c('0x2e')]=qs[_0x049c('0x2e')](_0x4327df[_0x049c('0x41')][_0x049c('0x2e')]);_0xca9e5b[_0x049c('0x2d')]=qs[_0x049c('0x2d')](_0x4327df[_0x049c('0x41')][_0x049c('0x2d')]);}_0xca9e5b[_0x049c('0x47')]=qs['sort'](_0x4327df[_0x049c('0x41')][_0x049c('0x48')]);_0xca9e5b['where']=qs[_0x049c('0x42')](_[_0x049c('0x49')](_0x4327df[_0x049c('0x41')],_0x298f2d[_0x049c('0x42')]),_0x20a3fd);if(_0x4327df[_0x049c('0x41')]['filter']){_0xca9e5b[_0x049c('0x4a')]=_['merge'](_0xca9e5b['where'],{'$or':_[_0x049c('0x3a')](_0x20a3fd,function(_0x313071){if(_0x313071[_0x049c('0x4b')]!==_0x049c('0x4c')){var _0x44d1c6={};_0x44d1c6[_0x313071[_0x049c('0x37')]]={'$like':'%'+_0x4327df[_0x049c('0x41')][_0x049c('0x4d')]+'%'};return _0x44d1c6;}})});}_0xca9e5b=_[_0x049c('0x4e')]({},_0xca9e5b,_0x4327df[_0x049c('0x4f')]);var _0x27827d={'where':_0xca9e5b[_0x049c('0x4a')]};return db[_0x049c('0x3b')][_0x049c('0x50')](_0x27827d)[_0x049c('0x34')](function(_0x24d2d1){_0x28ebca['count']=_0x24d2d1;if(_0x4327df['query'][_0x049c('0x51')]){_0xca9e5b[_0x049c('0x52')]=[{'all':!![]}];}return db[_0x049c('0x3b')][_0x049c('0x53')](_0xca9e5b);})[_0x049c('0x34')](function(_0x1bf4c0){_0x28ebca[_0x049c('0x54')]=_0x1bf4c0;return _0x28ebca;})[_0x049c('0x34')](respondWithFilteredResult(_0x47d4a8,_0xca9e5b))[_0x049c('0x28')](handleError(_0x47d4a8,null));};exports[_0x049c('0x55')]=function(_0x325b72,_0x1643a7){var _0x18ef9d={'raw':![],'where':{'id':_0x325b72['params']['id']}},_0x5c5802={};_0x5c5802['model']=_[_0x049c('0x40')](db[_0x049c('0x3b')][_0x049c('0x3c')]);_0x5c5802[_0x049c('0x41')]=_[_0x049c('0x40')](_0x325b72[_0x049c('0x41')]);_0x5c5802[_0x049c('0x42')]=_[_0x049c('0x43')](_0x5c5802[_0x049c('0x3f')],_0x5c5802[_0x049c('0x41')]);_0x18ef9d[_0x049c('0x44')]=_[_0x049c('0x43')](_0x5c5802[_0x049c('0x3f')],qs[_0x049c('0x45')](_0x325b72[_0x049c('0x41')]['fields']));_0x18ef9d[_0x049c('0x44')]=_0x18ef9d[_0x049c('0x44')][_0x049c('0x56')]?_0x18ef9d[_0x049c('0x44')]:_0x5c5802['model'];if(_0x325b72[_0x049c('0x41')][_0x049c('0x51')]){_0x18ef9d[_0x049c('0x52')]=[{'all':!![]}];}_0x18ef9d=_[_0x049c('0x4e')]({},_0x18ef9d,_0x325b72['options']);return db[_0x049c('0x3b')][_0x049c('0x57')](_0x18ef9d)[_0x049c('0x34')](handleEntityNotFound(_0x1643a7,null))[_0x049c('0x34')](respondWithResult(_0x1643a7,null))['catch'](handleError(_0x1643a7,null));};exports[_0x049c('0x58')]=function(_0x3c479e,_0x439f3e){return db[_0x049c('0x3b')][_0x049c('0x58')](_0x3c479e[_0x049c('0x59')],{})[_0x049c('0x34')](respondWithResult(_0x439f3e,0xc9))[_0x049c('0x28')](handleError(_0x439f3e,null));};exports[_0x049c('0x33')]=function(_0x596771,_0x182ed2){if(_0x596771['body']['id']){delete _0x596771[_0x049c('0x59')]['id'];}return db[_0x049c('0x3b')][_0x049c('0x57')]({'where':{'id':_0x596771[_0x049c('0x5a')]['id']}})[_0x049c('0x34')](handleEntityNotFound(_0x182ed2,null))[_0x049c('0x34')](saveUpdates(_0x596771[_0x049c('0x59')],null))['then'](respondWithResult(_0x182ed2,null))[_0x049c('0x28')](handleError(_0x182ed2,null));};exports[_0x049c('0x35')]=function(_0x42cc16,_0x761007){return db[_0x049c('0x3b')][_0x049c('0x57')]({'where':{'id':_0x42cc16[_0x049c('0x5a')]['id']}})[_0x049c('0x34')](handleEntityNotFound(_0x761007,null))[_0x049c('0x34')](removeEntity(_0x761007,null))['catch'](handleError(_0x761007,null));};exports['getFields']=function(_0x4dd67d,_0x5da1a8,_0x53d6d3){var _0x63a6cd={};var _0x1e07d9={};var _0x185d75;var _0x17b87e;return db[_0x049c('0x3b')][_0x049c('0x5b')]({'where':{'id':_0x4dd67d[_0x049c('0x5a')]['id']}})[_0x049c('0x34')](handleEntityNotFound(_0x5da1a8,null))['then'](function(_0x47b456){if(_0x47b456){_0x185d75=_0x47b456;_0x1e07d9['model']=_['keys'](db[_0x049c('0x5c')][_0x049c('0x3c')]);_0x1e07d9[_0x049c('0x41')]=_[_0x049c('0x40')](_0x4dd67d[_0x049c('0x41')]);_0x1e07d9[_0x049c('0x42')]=_[_0x049c('0x43')](_0x1e07d9['model'],_0x1e07d9['query']);_0x63a6cd[_0x049c('0x44')]=_[_0x049c('0x43')](_0x1e07d9['model'],qs['fields'](_0x4dd67d[_0x049c('0x41')][_0x049c('0x45')]));_0x63a6cd[_0x049c('0x44')]=_0x63a6cd[_0x049c('0x44')][_0x049c('0x56')]?_0x63a6cd[_0x049c('0x44')]:_0x1e07d9['model'];_0x63a6cd['order']=qs[_0x049c('0x48')](_0x4dd67d['query']['sort']);_0x63a6cd[_0x049c('0x4a')]=qs[_0x049c('0x42')](_[_0x049c('0x49')](_0x4dd67d[_0x049c('0x41')],_0x1e07d9[_0x049c('0x42')]));if(_0x4dd67d[_0x049c('0x41')][_0x049c('0x4d')]){_0x63a6cd[_0x049c('0x4a')]=_[_0x049c('0x4e')](_0x63a6cd[_0x049c('0x4a')],{'$or':_[_0x049c('0x3a')](_0x63a6cd[_0x049c('0x44')],function(_0x118777){var _0x2b0f89={};_0x2b0f89[_0x118777]={'$like':'%'+_0x4dd67d[_0x049c('0x41')][_0x049c('0x4d')]+'%'};return _0x2b0f89;})});}_0x63a6cd=_[_0x049c('0x4e')]({},_0x63a6cd,_0x4dd67d[_0x049c('0x4f')]);return _0x185d75['getFields'](_0x63a6cd);}})['then'](function(_0x4e3f07){if(_0x4e3f07){_0x17b87e=_0x4e3f07[_0x049c('0x56')];if(!_0x4dd67d['query'][_0x049c('0x46')]('nolimit')){_0x63a6cd[_0x049c('0x2e')]=qs['limit'](_0x4dd67d['query'][_0x049c('0x2e')]);_0x63a6cd['offset']=qs['offset'](_0x4dd67d[_0x049c('0x41')][_0x049c('0x2d')]);}return _0x185d75[_0x049c('0x5d')](_0x63a6cd);}})[_0x049c('0x34')](function(_0x4a95b6){if(_0x4a95b6){return _0x4a95b6?{'count':_0x17b87e,'rows':_0x4a95b6}:null;}})[_0x049c('0x34')](respondWithResult(_0x5da1a8,null))[_0x049c('0x28')](handleError(_0x5da1a8,null));};exports[_0x049c('0x5e')]=function(_0x121c7d,_0x1cd456,_0x5104e5){var _0x347e70={};var _0x36ab12={};var _0x53f4e7;var _0x2d49b5;return db[_0x049c('0x3b')][_0x049c('0x5b')]({'where':{'id':_0x121c7d[_0x049c('0x5a')]['id']}})[_0x049c('0x34')](handleEntityNotFound(_0x1cd456,null))[_0x049c('0x34')](function(_0x294c31){if(_0x294c31){_0x53f4e7=_0x294c31;_0x36ab12['model']=_[_0x049c('0x40')](db['SalesforceField']['rawAttributes']);_0x36ab12['query']=_[_0x049c('0x40')](_0x121c7d[_0x049c('0x41')]);_0x36ab12[_0x049c('0x42')]=_[_0x049c('0x43')](_0x36ab12['model'],_0x36ab12[_0x049c('0x41')]);_0x347e70[_0x049c('0x44')]=_[_0x049c('0x43')](_0x36ab12['model'],qs[_0x049c('0x45')](_0x121c7d[_0x049c('0x41')][_0x049c('0x45')]));_0x347e70[_0x049c('0x44')]=_0x347e70[_0x049c('0x44')][_0x049c('0x56')]?_0x347e70[_0x049c('0x44')]:_0x36ab12[_0x049c('0x3f')];_0x347e70[_0x049c('0x47')]=qs[_0x049c('0x48')](_0x121c7d[_0x049c('0x41')][_0x049c('0x48')]);_0x347e70[_0x049c('0x4a')]=qs[_0x049c('0x42')](_[_0x049c('0x49')](_0x121c7d[_0x049c('0x41')],_0x36ab12[_0x049c('0x42')]));if(_0x121c7d['query'][_0x049c('0x4d')]){_0x347e70['where']=_[_0x049c('0x4e')](_0x347e70['where'],{'$or':_[_0x049c('0x3a')](_0x347e70[_0x049c('0x44')],function(_0x369f03){var _0xd45356={};_0xd45356[_0x369f03]={'$like':'%'+_0x121c7d[_0x049c('0x41')][_0x049c('0x4d')]+'%'};return _0xd45356;})});}_0x347e70=_['merge']({},_0x347e70,_0x121c7d['options']);return _0x53f4e7[_0x049c('0x5e')](_0x347e70);}})['then'](function(_0x9751b0){if(_0x9751b0){_0x2d49b5=_0x9751b0[_0x049c('0x56')];if(!_0x121c7d[_0x049c('0x41')][_0x049c('0x46')](_0x049c('0x5f'))){_0x347e70[_0x049c('0x2e')]=qs[_0x049c('0x2e')](_0x121c7d['query'][_0x049c('0x2e')]);_0x347e70[_0x049c('0x2d')]=qs[_0x049c('0x2d')](_0x121c7d['query']['offset']);}return _0x53f4e7[_0x049c('0x5e')](_0x347e70);}})[_0x049c('0x34')](function(_0x506dac){if(_0x506dac){return _0x506dac?{'count':_0x2d49b5,'rows':_0x506dac}:null;}})[_0x049c('0x34')](respondWithResult(_0x1cd456,null))[_0x049c('0x28')](handleError(_0x1cd456,null));};exports[_0x049c('0x60')]=function(_0x368e4,_0x124f69,_0x2a7916){var _0x28e3bc={};var _0x313ac4={};var _0x48eed2;var _0xa9623;return db[_0x049c('0x3b')][_0x049c('0x5b')]({'where':{'id':_0x368e4[_0x049c('0x5a')]['id']}})[_0x049c('0x34')](handleEntityNotFound(_0x124f69,null))[_0x049c('0x34')](function(_0x3ba619){if(_0x3ba619){_0x48eed2=_0x3ba619;_0x313ac4[_0x049c('0x3f')]=_['keys'](db[_0x049c('0x5c')][_0x049c('0x3c')]);_0x313ac4[_0x049c('0x41')]=_[_0x049c('0x40')](_0x368e4[_0x049c('0x41')]);_0x313ac4[_0x049c('0x42')]=_[_0x049c('0x43')](_0x313ac4[_0x049c('0x3f')],_0x313ac4['query']);_0x28e3bc[_0x049c('0x44')]=_['intersection'](_0x313ac4[_0x049c('0x3f')],qs[_0x049c('0x45')](_0x368e4['query'][_0x049c('0x45')]));_0x28e3bc[_0x049c('0x44')]=_0x28e3bc[_0x049c('0x44')][_0x049c('0x56')]?_0x28e3bc[_0x049c('0x44')]:_0x313ac4['model'];_0x28e3bc['order']=qs[_0x049c('0x48')](_0x368e4[_0x049c('0x41')][_0x049c('0x48')]);_0x28e3bc[_0x049c('0x4a')]=qs['filters'](_[_0x049c('0x49')](_0x368e4['query'],_0x313ac4['filters']));if(_0x368e4[_0x049c('0x41')][_0x049c('0x4d')]){_0x28e3bc[_0x049c('0x4a')]=_['merge'](_0x28e3bc[_0x049c('0x4a')],{'$or':_[_0x049c('0x3a')](_0x28e3bc[_0x049c('0x44')],function(_0x935f8b){var _0x567928={};_0x567928[_0x935f8b]={'$like':'%'+_0x368e4['query']['filter']+'%'};return _0x567928;})});}_0x28e3bc=_[_0x049c('0x4e')]({},_0x28e3bc,_0x368e4[_0x049c('0x4f')]);return _0x48eed2['getDescriptions'](_0x28e3bc);}})[_0x049c('0x34')](function(_0x2a5bf0){if(_0x2a5bf0){_0xa9623=_0x2a5bf0[_0x049c('0x56')];if(!_0x368e4[_0x049c('0x41')][_0x049c('0x46')](_0x049c('0x5f'))){_0x28e3bc[_0x049c('0x2e')]=qs[_0x049c('0x2e')](_0x368e4['query'][_0x049c('0x2e')]);_0x28e3bc[_0x049c('0x2d')]=qs[_0x049c('0x2d')](_0x368e4[_0x049c('0x41')][_0x049c('0x2d')]);}return _0x48eed2[_0x049c('0x60')](_0x28e3bc);}})[_0x049c('0x34')](function(_0x3b0403){if(_0x3b0403){return _0x3b0403?{'count':_0xa9623,'rows':_0x3b0403}:null;}})[_0x049c('0x34')](respondWithResult(_0x124f69,null))[_0x049c('0x28')](handleError(_0x124f69,null));}; \ No newline at end of file +var _0x5511=['zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','json','limit','set','Content-Range','reject','save','update','destroy','end','stack','name','index','SalesforceConfiguration','fieldName','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','offset','order','sort','where','pick','merge','type','VIRTUAL','filter','count','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','find','body','findOne','SalesforceField','getFields','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x5511,0x10b));var _0x1551=function(_0x124612,_0xd25f9a){_0x124612=_0x124612-0x0;var _0x10f4b9=_0x5511[_0x124612];return _0x10f4b9;};'use strict';var pdf=require(_0x1551('0x0'));var emlformat=require(_0x1551('0x1'));var rimraf=require(_0x1551('0x2'));var zipdir=require(_0x1551('0x3'));var jsonpatch=require(_0x1551('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1551('0x5'));var Mustache=require(_0x1551('0x6'));var util=require('util');var path=require(_0x1551('0x7'));var sox=require(_0x1551('0x8'));var csv=require(_0x1551('0x9'));var ejs=require(_0x1551('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1551('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1551('0x9'));var querystring=require(_0x1551('0xc'));var Papa=require('papaparse');var Redis=require(_0x1551('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x1551('0xe'));var as=require(_0x1551('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1551('0x10'))(_0x1551('0x11'));var utils=require(_0x1551('0x12'));var config=require(_0x1551('0x13'));var db=require('../../mysqldb')['db'];var jayson=require(_0x1551('0x14'));var client=jayson[_0x1551('0x15')][_0x1551('0x16')]({'port':0x232a});function checkPasswordPattern(_0x4b580f,_0x3bc48e,_0x26ff90){if(_0x26ff90){var _0x2d6c79=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2d6c79['test'](_0x3bc48e)){return _0x4b580f;}else{throw new db['Sequelize'][(_0x1551('0x17'))](_0x1551('0x18'));}}else{return _0x4b580f;}}function respondWithRpcPromise(_0x5d20c1,_0x4f9ae4,_0x5ad4b3,_0x30b5a3){return new BPromise(function(_0x154bc3,_0x3b4d88){var _0x5e9697=_0x30b5a3||client;return _0x5e9697[_0x1551('0x19')](_0x5d20c1,_0x5ad4b3)[_0x1551('0x1a')](function(_0x1866d8){logger[_0x1551('0x1b')](_0x1551('0x1c'),_0x4f9ae4,_0x1551('0x1d'));logger[_0x1551('0x1e')](_0x1551('0x1f'),_0x4f9ae4,_0x1551('0x1d'),JSON['stringify'](_0x1866d8));if(_0x1866d8[_0x1551('0x20')]){if(_0x1866d8['error'][_0x1551('0x21')]===0x1f4){logger[_0x1551('0x20')](_0x1551('0x1c'),_0x4f9ae4,_0x1866d8[_0x1551('0x20')][_0x1551('0x22')]);return _0x3b4d88(_0x1866d8['error'][_0x1551('0x22')]);}logger['error'](_0x1551('0x1c'),_0x4f9ae4,_0x1866d8['error'][_0x1551('0x22')]);return _0x154bc3(_0x1866d8[_0x1551('0x20')][_0x1551('0x22')]);}else{logger[_0x1551('0x1b')](_0x1551('0x1c'),_0x4f9ae4,_0x1551('0x1d'));_0x154bc3(_0x1866d8[_0x1551('0x23')]['message']);}})['catch'](function(_0x7d4ba4){logger[_0x1551('0x20')](_0x1551('0x1c'),_0x4f9ae4,_0x7d4ba4);_0x3b4d88(_0x7d4ba4);});});}function respondWithStatusCode(_0xc369b7,_0x16673b){_0x16673b=_0x16673b||0xcc;return function(_0x492c71){if(_0x492c71){return _0xc369b7[_0x1551('0x24')](_0x16673b);}return _0xc369b7[_0x1551('0x25')](_0x16673b)['end']();};}function respondWithResult(_0x4ff0d7,_0x4bca2a){_0x4bca2a=_0x4bca2a||0xc8;return function(_0x44a241){if(_0x44a241){return _0x4ff0d7[_0x1551('0x25')](_0x4bca2a)[_0x1551('0x26')](_0x44a241);}};}function respondWithFilteredResult(_0x486338,_0x30d34a){return function(_0x28c427){if(_0x28c427){var _0x1caec1=_0x28c427['count'],_0x2b3895=_0x30d34a['offset'],_0x478293=_0x30d34a['offset']+_0x30d34a[_0x1551('0x27')],_0x2a7312;if(_0x478293>=_0x1caec1){_0x478293=_0x1caec1;_0x2a7312=0xc8;}else{_0x2a7312=0xce;}_0x486338[_0x1551('0x25')](_0x2a7312);return _0x486338[_0x1551('0x28')](_0x1551('0x29'),_0x2b3895+'-'+_0x478293+'/'+_0x1caec1)[_0x1551('0x26')](_0x28c427);}return null;};}function patchUpdates(_0x15eded){return function(_0x12e812){try{jsonpatch['apply'](_0x12e812,_0x15eded,!![]);}catch(_0x15d177){return BPromise[_0x1551('0x2a')](_0x15d177);}return _0x12e812[_0x1551('0x2b')]();};}function saveUpdates(_0x471846,_0x1be873){return function(_0x2cc82d){if(_0x2cc82d){return _0x2cc82d[_0x1551('0x2c')](_0x471846)[_0x1551('0x1a')](function(_0x549992){return _0x549992;});}return null;};}function removeEntity(_0x3540dd,_0x38cc46){return function(_0x17b6b5){if(_0x17b6b5){return _0x17b6b5[_0x1551('0x2d')]()[_0x1551('0x1a')](function(){_0x3540dd[_0x1551('0x25')](0xcc)[_0x1551('0x2e')]();});}};}function handleEntityNotFound(_0x48926d,_0x3fff07){return function(_0x6ab6cd){if(!_0x6ab6cd){_0x48926d[_0x1551('0x24')](0x194);}return _0x6ab6cd;};}function handleError(_0x7497bb,_0x95c5c3){_0x95c5c3=_0x95c5c3||0x1f4;return function(_0x31446e){logger['error'](_0x31446e[_0x1551('0x2f')]);if(_0x31446e[_0x1551('0x30')]){delete _0x31446e['name'];}_0x7497bb[_0x1551('0x25')](_0x95c5c3)['send'](_0x31446e);};}exports[_0x1551('0x31')]=function(_0x5411eb,_0x14d51b){var _0x3d1d70={},_0x51d2df={},_0x1091df={'count':0x0,'rows':[]};var _0x271ae4=_['map'](db[_0x1551('0x32')]['rawAttributes'],function(_0x4a624c){return{'name':_0x4a624c[_0x1551('0x33')],'type':_0x4a624c['type'][_0x1551('0x34')]};});_0x51d2df[_0x1551('0x35')]=_[_0x1551('0x36')](_0x271ae4,_0x1551('0x30'));_0x51d2df[_0x1551('0x37')]=_['keys'](_0x5411eb['query']);_0x51d2df[_0x1551('0x38')]=_['intersection'](_0x51d2df[_0x1551('0x35')],_0x51d2df['query']);_0x3d1d70[_0x1551('0x39')]=_[_0x1551('0x3a')](_0x51d2df[_0x1551('0x35')],qs[_0x1551('0x3b')](_0x5411eb[_0x1551('0x37')][_0x1551('0x3b')]));_0x3d1d70[_0x1551('0x39')]=_0x3d1d70[_0x1551('0x39')][_0x1551('0x3c')]?_0x3d1d70[_0x1551('0x39')]:_0x51d2df['model'];if(!_0x5411eb[_0x1551('0x37')][_0x1551('0x3d')]('nolimit')){_0x3d1d70['limit']=qs[_0x1551('0x27')](_0x5411eb[_0x1551('0x37')][_0x1551('0x27')]);_0x3d1d70[_0x1551('0x3e')]=qs[_0x1551('0x3e')](_0x5411eb['query'][_0x1551('0x3e')]);}_0x3d1d70[_0x1551('0x3f')]=qs[_0x1551('0x40')](_0x5411eb['query']['sort']);_0x3d1d70[_0x1551('0x41')]=qs['filters'](_[_0x1551('0x42')](_0x5411eb[_0x1551('0x37')],_0x51d2df[_0x1551('0x38')]),_0x271ae4);if(_0x5411eb['query']['filter']){_0x3d1d70[_0x1551('0x41')]=_[_0x1551('0x43')](_0x3d1d70[_0x1551('0x41')],{'$or':_[_0x1551('0x36')](_0x271ae4,function(_0x4f2bcf){if(_0x4f2bcf[_0x1551('0x44')]!==_0x1551('0x45')){var _0x14f041={};_0x14f041[_0x4f2bcf[_0x1551('0x30')]]={'$like':'%'+_0x5411eb[_0x1551('0x37')][_0x1551('0x46')]+'%'};return _0x14f041;}})});}_0x3d1d70=_[_0x1551('0x43')]({},_0x3d1d70,_0x5411eb['options']);var _0x398789={'where':_0x3d1d70[_0x1551('0x41')]};return db[_0x1551('0x32')][_0x1551('0x47')](_0x398789)[_0x1551('0x1a')](function(_0x13da3f){_0x1091df['count']=_0x13da3f;if(_0x5411eb[_0x1551('0x37')][_0x1551('0x48')]){_0x3d1d70[_0x1551('0x49')]=[{'all':!![]}];}return db[_0x1551('0x32')][_0x1551('0x4a')](_0x3d1d70);})['then'](function(_0x45c367){_0x1091df[_0x1551('0x4b')]=_0x45c367;return _0x1091df;})[_0x1551('0x1a')](respondWithFilteredResult(_0x14d51b,_0x3d1d70))[_0x1551('0x4c')](handleError(_0x14d51b,null));};exports[_0x1551('0x4d')]=function(_0x4a508a,_0x5a5f40){var _0x2dcff3={'raw':![],'where':{'id':_0x4a508a[_0x1551('0x4e')]['id']}},_0x277fab={};_0x277fab[_0x1551('0x35')]=_[_0x1551('0x4f')](db[_0x1551('0x32')][_0x1551('0x50')]);_0x277fab[_0x1551('0x37')]=_[_0x1551('0x4f')](_0x4a508a[_0x1551('0x37')]);_0x277fab['filters']=_[_0x1551('0x3a')](_0x277fab[_0x1551('0x35')],_0x277fab[_0x1551('0x37')]);_0x2dcff3[_0x1551('0x39')]=_[_0x1551('0x3a')](_0x277fab[_0x1551('0x35')],qs[_0x1551('0x3b')](_0x4a508a['query']['fields']));_0x2dcff3[_0x1551('0x39')]=_0x2dcff3[_0x1551('0x39')][_0x1551('0x3c')]?_0x2dcff3[_0x1551('0x39')]:_0x277fab['model'];if(_0x4a508a[_0x1551('0x37')]['includeAll']){_0x2dcff3[_0x1551('0x49')]=[{'all':!![]}];}_0x2dcff3=_[_0x1551('0x43')]({},_0x2dcff3,_0x4a508a[_0x1551('0x51')]);return db['SalesforceConfiguration'][_0x1551('0x52')](_0x2dcff3)[_0x1551('0x1a')](handleEntityNotFound(_0x5a5f40,null))['then'](respondWithResult(_0x5a5f40,null))['catch'](handleError(_0x5a5f40,null));};exports['create']=function(_0x2052da,_0x4df20e){return db['SalesforceConfiguration']['create'](_0x2052da[_0x1551('0x53')],{})[_0x1551('0x1a')](respondWithResult(_0x4df20e,0xc9))['catch'](handleError(_0x4df20e,null));};exports[_0x1551('0x2c')]=function(_0x19a3b8,_0x291312){if(_0x19a3b8['body']['id']){delete _0x19a3b8[_0x1551('0x53')]['id'];}return db[_0x1551('0x32')][_0x1551('0x52')]({'where':{'id':_0x19a3b8[_0x1551('0x4e')]['id']}})[_0x1551('0x1a')](handleEntityNotFound(_0x291312,null))[_0x1551('0x1a')](saveUpdates(_0x19a3b8[_0x1551('0x53')],null))['then'](respondWithResult(_0x291312,null))[_0x1551('0x4c')](handleError(_0x291312,null));};exports['destroy']=function(_0x4c99dc,_0xf1bc6a){return db[_0x1551('0x32')][_0x1551('0x52')]({'where':{'id':_0x4c99dc[_0x1551('0x4e')]['id']}})[_0x1551('0x1a')](handleEntityNotFound(_0xf1bc6a,null))[_0x1551('0x1a')](removeEntity(_0xf1bc6a,null))[_0x1551('0x4c')](handleError(_0xf1bc6a,null));};exports['getFields']=function(_0x36ed54,_0x59fd22,_0x198ea9){var _0x134946={};var _0x2dc424={};var _0x42bdc6;var _0x2cac5b;return db['SalesforceConfiguration'][_0x1551('0x54')]({'where':{'id':_0x36ed54[_0x1551('0x4e')]['id']}})[_0x1551('0x1a')](handleEntityNotFound(_0x59fd22,null))['then'](function(_0x3b197a){if(_0x3b197a){_0x42bdc6=_0x3b197a;_0x2dc424[_0x1551('0x35')]=_['keys'](db[_0x1551('0x55')][_0x1551('0x50')]);_0x2dc424[_0x1551('0x37')]=_[_0x1551('0x4f')](_0x36ed54[_0x1551('0x37')]);_0x2dc424[_0x1551('0x38')]=_[_0x1551('0x3a')](_0x2dc424[_0x1551('0x35')],_0x2dc424[_0x1551('0x37')]);_0x134946['attributes']=_[_0x1551('0x3a')](_0x2dc424[_0x1551('0x35')],qs[_0x1551('0x3b')](_0x36ed54[_0x1551('0x37')]['fields']));_0x134946[_0x1551('0x39')]=_0x134946[_0x1551('0x39')][_0x1551('0x3c')]?_0x134946[_0x1551('0x39')]:_0x2dc424[_0x1551('0x35')];_0x134946['order']=qs[_0x1551('0x40')](_0x36ed54[_0x1551('0x37')][_0x1551('0x40')]);_0x134946['where']=qs[_0x1551('0x38')](_[_0x1551('0x42')](_0x36ed54[_0x1551('0x37')],_0x2dc424['filters']));if(_0x36ed54['query'][_0x1551('0x46')]){_0x134946['where']=_['merge'](_0x134946[_0x1551('0x41')],{'$or':_[_0x1551('0x36')](_0x134946['attributes'],function(_0x7709fa){var _0x33fed4={};_0x33fed4[_0x7709fa]={'$like':'%'+_0x36ed54['query'][_0x1551('0x46')]+'%'};return _0x33fed4;})});}_0x134946=_[_0x1551('0x43')]({},_0x134946,_0x36ed54[_0x1551('0x51')]);return _0x42bdc6[_0x1551('0x56')](_0x134946);}})[_0x1551('0x1a')](function(_0x58313e){if(_0x58313e){_0x2cac5b=_0x58313e[_0x1551('0x3c')];if(!_0x36ed54[_0x1551('0x37')]['hasOwnProperty'](_0x1551('0x57'))){_0x134946[_0x1551('0x27')]=qs[_0x1551('0x27')](_0x36ed54[_0x1551('0x37')]['limit']);_0x134946[_0x1551('0x3e')]=qs[_0x1551('0x3e')](_0x36ed54[_0x1551('0x37')]['offset']);}return _0x42bdc6['getFields'](_0x134946);}})[_0x1551('0x1a')](function(_0x1b820b){if(_0x1b820b){return _0x1b820b?{'count':_0x2cac5b,'rows':_0x1b820b}:null;}})[_0x1551('0x1a')](respondWithResult(_0x59fd22,null))[_0x1551('0x4c')](handleError(_0x59fd22,null));};exports[_0x1551('0x58')]=function(_0x1934f9,_0xd8e0c1,_0x395af1){var _0x2cf53b={};var _0x62841b={};var _0x2f2270;var _0x4932bd;return db[_0x1551('0x32')][_0x1551('0x54')]({'where':{'id':_0x1934f9[_0x1551('0x4e')]['id']}})[_0x1551('0x1a')](handleEntityNotFound(_0xd8e0c1,null))[_0x1551('0x1a')](function(_0x535cd7){if(_0x535cd7){_0x2f2270=_0x535cd7;_0x62841b['model']=_['keys'](db[_0x1551('0x55')][_0x1551('0x50')]);_0x62841b[_0x1551('0x37')]=_[_0x1551('0x4f')](_0x1934f9[_0x1551('0x37')]);_0x62841b[_0x1551('0x38')]=_[_0x1551('0x3a')](_0x62841b[_0x1551('0x35')],_0x62841b[_0x1551('0x37')]);_0x2cf53b[_0x1551('0x39')]=_[_0x1551('0x3a')](_0x62841b[_0x1551('0x35')],qs[_0x1551('0x3b')](_0x1934f9[_0x1551('0x37')]['fields']));_0x2cf53b[_0x1551('0x39')]=_0x2cf53b[_0x1551('0x39')][_0x1551('0x3c')]?_0x2cf53b[_0x1551('0x39')]:_0x62841b[_0x1551('0x35')];_0x2cf53b[_0x1551('0x3f')]=qs[_0x1551('0x40')](_0x1934f9[_0x1551('0x37')]['sort']);_0x2cf53b[_0x1551('0x41')]=qs[_0x1551('0x38')](_['pick'](_0x1934f9[_0x1551('0x37')],_0x62841b[_0x1551('0x38')]));if(_0x1934f9[_0x1551('0x37')][_0x1551('0x46')]){_0x2cf53b[_0x1551('0x41')]=_[_0x1551('0x43')](_0x2cf53b[_0x1551('0x41')],{'$or':_['map'](_0x2cf53b[_0x1551('0x39')],function(_0x2539d7){var _0x4c5e11={};_0x4c5e11[_0x2539d7]={'$like':'%'+_0x1934f9['query'][_0x1551('0x46')]+'%'};return _0x4c5e11;})});}_0x2cf53b=_[_0x1551('0x43')]({},_0x2cf53b,_0x1934f9[_0x1551('0x51')]);return _0x2f2270[_0x1551('0x58')](_0x2cf53b);}})[_0x1551('0x1a')](function(_0x26e10b){if(_0x26e10b){_0x4932bd=_0x26e10b['length'];if(!_0x1934f9[_0x1551('0x37')][_0x1551('0x3d')](_0x1551('0x57'))){_0x2cf53b[_0x1551('0x27')]=qs[_0x1551('0x27')](_0x1934f9[_0x1551('0x37')][_0x1551('0x27')]);_0x2cf53b[_0x1551('0x3e')]=qs[_0x1551('0x3e')](_0x1934f9['query'][_0x1551('0x3e')]);}return _0x2f2270['getSubjects'](_0x2cf53b);}})[_0x1551('0x1a')](function(_0x2e072d){if(_0x2e072d){return _0x2e072d?{'count':_0x4932bd,'rows':_0x2e072d}:null;}})['then'](respondWithResult(_0xd8e0c1,null))['catch'](handleError(_0xd8e0c1,null));};exports[_0x1551('0x59')]=function(_0x5d6ca3,_0x18fe34,_0x28efa5){var _0x584b72={};var _0x1d93f1={};var _0x1dedd6;var _0x3470e9;return db[_0x1551('0x32')][_0x1551('0x54')]({'where':{'id':_0x5d6ca3['params']['id']}})[_0x1551('0x1a')](handleEntityNotFound(_0x18fe34,null))[_0x1551('0x1a')](function(_0x84bc76){if(_0x84bc76){_0x1dedd6=_0x84bc76;_0x1d93f1[_0x1551('0x35')]=_[_0x1551('0x4f')](db[_0x1551('0x55')][_0x1551('0x50')]);_0x1d93f1['query']=_[_0x1551('0x4f')](_0x5d6ca3[_0x1551('0x37')]);_0x1d93f1[_0x1551('0x38')]=_[_0x1551('0x3a')](_0x1d93f1[_0x1551('0x35')],_0x1d93f1['query']);_0x584b72['attributes']=_['intersection'](_0x1d93f1[_0x1551('0x35')],qs[_0x1551('0x3b')](_0x5d6ca3[_0x1551('0x37')][_0x1551('0x3b')]));_0x584b72[_0x1551('0x39')]=_0x584b72['attributes']['length']?_0x584b72[_0x1551('0x39')]:_0x1d93f1[_0x1551('0x35')];_0x584b72[_0x1551('0x3f')]=qs[_0x1551('0x40')](_0x5d6ca3[_0x1551('0x37')][_0x1551('0x40')]);_0x584b72['where']=qs[_0x1551('0x38')](_['pick'](_0x5d6ca3[_0x1551('0x37')],_0x1d93f1[_0x1551('0x38')]));if(_0x5d6ca3[_0x1551('0x37')][_0x1551('0x46')]){_0x584b72[_0x1551('0x41')]=_[_0x1551('0x43')](_0x584b72[_0x1551('0x41')],{'$or':_[_0x1551('0x36')](_0x584b72[_0x1551('0x39')],function(_0xc03c67){var _0x315640={};_0x315640[_0xc03c67]={'$like':'%'+_0x5d6ca3[_0x1551('0x37')]['filter']+'%'};return _0x315640;})});}_0x584b72=_[_0x1551('0x43')]({},_0x584b72,_0x5d6ca3[_0x1551('0x51')]);return _0x1dedd6[_0x1551('0x59')](_0x584b72);}})['then'](function(_0x5bb59c){if(_0x5bb59c){_0x3470e9=_0x5bb59c['length'];if(!_0x5d6ca3[_0x1551('0x37')][_0x1551('0x3d')](_0x1551('0x57'))){_0x584b72[_0x1551('0x27')]=qs['limit'](_0x5d6ca3[_0x1551('0x37')][_0x1551('0x27')]);_0x584b72['offset']=qs[_0x1551('0x3e')](_0x5d6ca3['query']['offset']);}return _0x1dedd6[_0x1551('0x59')](_0x584b72);}})[_0x1551('0x1a')](function(_0x2b035a){if(_0x2b035a){return _0x2b035a?{'count':_0x3470e9,'rows':_0x2b035a}:null;}})[_0x1551('0x1a')](respondWithResult(_0x18fe34,null))['catch'](handleError(_0x18fe34,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index f642cc7..acc379f 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 _0xae6b=['rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','../../config/logger','api','moment','bluebird','path'];(function(_0x1e7385,_0x4cb207){var _0x58c81c=function(_0x4801c7){while(--_0x4801c7){_0x1e7385['push'](_0x1e7385['shift']());}};_0x58c81c(++_0x4cb207);}(_0xae6b,0xf8));var _0xbae6=function(_0x544072,_0xc41ee1){_0x544072=_0x544072-0x0;var _0x590bf6=_0xae6b[_0x544072];return _0x590bf6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbae6('0x0'))(_0xbae6('0x1'));var moment=require(_0xbae6('0x2'));var BPromise=require(_0xbae6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbae6('0x4'));var rimraf=require(_0xbae6('0x5'));var config=require('../../config/environment');var attributes=require(_0xbae6('0x6'));module[_0xbae6('0x7')]=function(_0x121ccc,_0x1e8ac0){return _0x121ccc[_0xbae6('0x8')](_0xbae6('0x9'),attributes,{'tableName':_0xbae6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e45=['rimraf','exports','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','moment','request-promise'];(function(_0x223023,_0x2b6e58){var _0x3f8e5b=function(_0x4b0505){while(--_0x4b0505){_0x223023['push'](_0x223023['shift']());}};_0x3f8e5b(++_0x2b6e58);}(_0x3e45,0x9d));var _0x53e4=function(_0x3ec3cc,_0x1d9b50){_0x3ec3cc=_0x3ec3cc-0x0;var _0x3aeebe=_0x3e45[_0x3ec3cc];return _0x3aeebe;};'use strict';var _=require(_0x53e4('0x0'));var util=require(_0x53e4('0x1'));var logger=require(_0x53e4('0x2'))('api');var moment=require(_0x53e4('0x3'));var BPromise=require('bluebird');var rp=require(_0x53e4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x53e4('0x5'));var config=require('../../config/environment');var attributes=require('./intSalesforceConfiguration.attributes');module[_0x53e4('0x6')]=function(_0x5b6dbe,_0x41deb4){return _0x5b6dbe['define'](_0x53e4('0x7'),attributes,{'tableName':_0x53e4('0x8'),'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 749fd32..d675ecc 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 _0x2d04=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird'];(function(_0x55ef8b,_0x5deb5e){var _0x359c84=function(_0x437673){while(--_0x437673){_0x55ef8b['push'](_0x55ef8b['shift']());}};_0x359c84(++_0x5deb5e);}(_0x2d04,0x1ac));var _0x42d0=function(_0x2993c1,_0x37681f){_0x2993c1=_0x2993c1-0x0;var _0x41c9cf=_0x2d04[_0x2993c1];return _0x41c9cf;};'use strict';var _=require(_0x42d0('0x0'));var util=require(_0x42d0('0x1'));var moment=require(_0x42d0('0x2'));var BPromise=require(_0x42d0('0x3'));var rs=require(_0x42d0('0x4'));var fs=require('fs');var Redis=require(_0x42d0('0x5'));var db=require(_0x42d0('0x6'))['db'];var utils=require(_0x42d0('0x7'));var logger=require(_0x42d0('0x8'))('rpc');var config=require(_0x42d0('0x9'));var jayson=require(_0x42d0('0xa'));var client=jayson[_0x42d0('0xb')][_0x42d0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5b2c61,_0x48ee1d,_0x1fd5a4){return new BPromise(function(_0x28e142,_0x4a5771){return client['request'](_0x5b2c61,_0x1fd5a4)[_0x42d0('0xd')](function(_0x484138){logger['info'](_0x42d0('0xe'),_0x48ee1d,_0x42d0('0xf'));logger[_0x42d0('0x10')](_0x42d0('0x11'),_0x48ee1d,_0x42d0('0xf'),JSON[_0x42d0('0x12')](_0x484138));if(_0x484138[_0x42d0('0x13')]){if(_0x484138[_0x42d0('0x13')][_0x42d0('0x14')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x48ee1d,_0x484138[_0x42d0('0x13')][_0x42d0('0x15')]);return _0x4a5771(_0x484138[_0x42d0('0x13')][_0x42d0('0x15')]);}logger['error'](_0x42d0('0xe'),_0x48ee1d,_0x484138[_0x42d0('0x13')][_0x42d0('0x15')]);return _0x28e142(_0x484138['error'][_0x42d0('0x15')]);}else{logger[_0x42d0('0x16')]('SalesforceConfiguration,\x20%s,\x20%s',_0x48ee1d,_0x42d0('0xf'));_0x28e142(_0x484138['result'][_0x42d0('0x15')]);}})[_0x42d0('0x17')](function(_0x583dba){logger['error'](_0x42d0('0xe'),_0x48ee1d,_0x583dba);_0x4a5771(_0x583dba);});});} \ No newline at end of file +var _0x9480=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','util','moment','bluebird','randomstring'];(function(_0x2f63fd,_0x414696){var _0x5c26ed=function(_0x370831){while(--_0x370831){_0x2f63fd['push'](_0x2f63fd['shift']());}};_0x5c26ed(++_0x414696);}(_0x9480,0x183));var _0x0948=function(_0x4ffa16,_0x420a60){_0x4ffa16=_0x4ffa16-0x0;var _0x3160a5=_0x9480[_0x4ffa16];return _0x3160a5;};'use strict';var _=require('lodash');var util=require(_0x0948('0x0'));var moment=require(_0x0948('0x1'));var BPromise=require(_0x0948('0x2'));var rs=require(_0x0948('0x3'));var fs=require('fs');var Redis=require(_0x0948('0x4'));var db=require(_0x0948('0x5'))['db'];var utils=require(_0x0948('0x6'));var logger=require(_0x0948('0x7'))(_0x0948('0x8'));var config=require(_0x0948('0x9'));var jayson=require(_0x0948('0xa'));var client=jayson[_0x0948('0xb')][_0x0948('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39ca4f,_0xeb73f,_0x558566){return new BPromise(function(_0x1daa22,_0x804155){return client[_0x0948('0xd')](_0x39ca4f,_0x558566)[_0x0948('0xe')](function(_0x208ed8){logger[_0x0948('0xf')](_0x0948('0x10'),_0xeb73f,_0x0948('0x11'));logger[_0x0948('0x12')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0xeb73f,_0x0948('0x11'),JSON['stringify'](_0x208ed8));if(_0x208ed8[_0x0948('0x13')]){if(_0x208ed8[_0x0948('0x13')][_0x0948('0x14')]===0x1f4){logger[_0x0948('0x13')](_0x0948('0x10'),_0xeb73f,_0x208ed8[_0x0948('0x13')][_0x0948('0x15')]);return _0x804155(_0x208ed8['error'][_0x0948('0x15')]);}logger[_0x0948('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0xeb73f,_0x208ed8[_0x0948('0x13')]['message']);return _0x1daa22(_0x208ed8[_0x0948('0x13')][_0x0948('0x15')]);}else{logger[_0x0948('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0xeb73f,'request\x20sent');_0x1daa22(_0x208ed8[_0x0948('0x16')][_0x0948('0x15')]);}})['catch'](function(_0x1f1460){logger[_0x0948('0x13')](_0x0948('0x10'),_0xeb73f,_0x1f1460);_0x804155(_0x1f1460);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 6c138b5..5daeead 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 _0xfb65=['./intSalesforceField.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x582b89,_0x241411){var _0x1468b0=function(_0x25c798){while(--_0x25c798){_0x582b89['push'](_0x582b89['shift']());}};_0x1468b0(++_0x241411);}(_0xfb65,0x82));var _0x5fb6=function(_0x410d6b,_0x16e343){_0x410d6b=_0x410d6b-0x0;var _0x48ee53=_0xfb65[_0x410d6b];return _0x48ee53;};'use strict';var multer=require('multer');var util=require(_0x5fb6('0x0'));var path=require(_0x5fb6('0x1'));var timeout=require('connect-timeout');var express=require(_0x5fb6('0x2'));var router=express['Router']();var auth=require(_0x5fb6('0x3'));var interaction=require(_0x5fb6('0x4'));var config=require(_0x5fb6('0x5'));var controller=require(_0x5fb6('0x6'));router[_0x5fb6('0x7')]('/',auth[_0x5fb6('0x8')](),controller['index']);router['get'](_0x5fb6('0x9'),auth[_0x5fb6('0x8')](),controller[_0x5fb6('0xa')]);router[_0x5fb6('0xb')]('/',auth['isAuthenticated'](),controller[_0x5fb6('0xc')]);router[_0x5fb6('0xd')](_0x5fb6('0x9'),auth[_0x5fb6('0x8')](),controller['update']);router[_0x5fb6('0xe')](_0x5fb6('0x9'),auth['isAuthenticated'](),controller[_0x5fb6('0xf')]);module[_0x5fb6('0x10')]=router; \ No newline at end of file +var _0x0f4d=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','post','put','update','delete','exports'];(function(_0x2f83e8,_0x5f1cb1){var _0x44e99b=function(_0x21ff5d){while(--_0x21ff5d){_0x2f83e8['push'](_0x2f83e8['shift']());}};_0x44e99b(++_0x5f1cb1);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x7f660b,_0x52083d){_0x7f660b=_0x7f660b-0x0;var _0xae801=_0x0f4d[_0x7f660b];return _0xae801;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd0f4('0x0'));var express=require('express');var router=express[_0xd0f4('0x1')]();var auth=require(_0xd0f4('0x2'));var interaction=require(_0xd0f4('0x3'));var config=require(_0xd0f4('0x4'));var controller=require(_0xd0f4('0x5'));router[_0xd0f4('0x6')]('/',auth[_0xd0f4('0x7')](),controller[_0xd0f4('0x8')]);router['get'](_0xd0f4('0x9'),auth[_0xd0f4('0x7')](),controller['show']);router[_0xd0f4('0xa')]('/',auth[_0xd0f4('0x7')](),controller['create']);router[_0xd0f4('0xb')](_0xd0f4('0x9'),auth['isAuthenticated'](),controller[_0xd0f4('0xc')]);router[_0xd0f4('0xd')](_0xd0f4('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xd0f4('0xe')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 6361a5d..8d560e6 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 _0xc30f=['STRING','sequelize','ENUM','string','variable','customVariable','keyValue'];(function(_0x1a8384,_0x3bc720){var _0x4e71ff=function(_0x59004c){while(--_0x59004c){_0x1a8384['push'](_0x1a8384['shift']());}};_0x4e71ff(++_0x3bc720);}(_0xc30f,0xbe));var _0xfc30=function(_0x5eafab,_0x16f0be){_0x5eafab=_0x5eafab-0x0;var _0x171c24=_0xc30f[_0x5eafab];return _0x171c24;};'use strict';var Sequelize=require(_0xfc30('0x0'));module['exports']={'type':{'type':Sequelize[_0xfc30('0x1')](_0xfc30('0x2'),_0xfc30('0x3'),_0xfc30('0x4'),_0xfc30('0x5')),'defaultValue':_0xfc30('0x2')},'content':{'type':Sequelize[_0xfc30('0x6')]},'key':{'type':Sequelize[_0xfc30('0x6')]},'keyType':{'type':Sequelize[_0xfc30('0x1')]('string',_0xfc30('0x3'),_0xfc30('0x4'))},'keyContent':{'type':Sequelize[_0xfc30('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xfc30('0x6')]}}; \ No newline at end of file +var _0x347c=['sequelize','exports','string','variable','customVariable','keyValue','STRING','ENUM'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x347c,0x88));var _0xc347=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x347c[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0xc347('0x0'));module[_0xc347('0x1')]={'type':{'type':Sequelize['ENUM'](_0xc347('0x2'),_0xc347('0x3'),_0xc347('0x4'),_0xc347('0x5')),'defaultValue':_0xc347('0x2')},'content':{'type':Sequelize[_0xc347('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc347('0x7')](_0xc347('0x2'),_0xc347('0x3'),_0xc347('0x4'))},'keyContent':{'type':Sequelize[_0xc347('0x6')]},'idField':{'type':Sequelize[_0xc347('0x6')]},'variableName':{'type':Sequelize[_0xc347('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index d778281..c852747 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 _0x41d8=['ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','save','then','destroy','error','stack','index','SalesforceField','fieldName','type','key','map','name','keys','query','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','VIRTUAL','merge','options','catch','show','params','fields','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x4b9726,_0x31171c){var _0x2b273a=function(_0x2dabd6){while(--_0x2dabd6){_0x4b9726['push'](_0x4b9726['shift']());}};_0x2b273a(++_0x31171c);}(_0x41d8,0xc1));var _0x841d=function(_0x5f0c76,_0x44b266){_0x5f0c76=_0x5f0c76-0x0;var _0x308606=_0x41d8[_0x5f0c76];return _0x308606;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x841d('0x0'));var rimraf=require(_0x841d('0x1'));var zipdir=require(_0x841d('0x2'));var jsonpatch=require(_0x841d('0x3'));var rp=require(_0x841d('0x4'));var moment=require(_0x841d('0x5'));var BPromise=require(_0x841d('0x6'));var Mustache=require(_0x841d('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x841d('0x8'));var fs=require('fs');var _=require(_0x841d('0x9'));var squel=require('squel');var crypto=require(_0x841d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x841d('0xb'));var toCsv=require(_0x841d('0xc'));var querystring=require(_0x841d('0xd'));var Papa=require(_0x841d('0xe'));var Redis=require(_0x841d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x841d('0x10'));var as=require(_0x841d('0x11'));var hardwareService=require(_0x841d('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x841d('0x13'));var config=require('../../config/environment');var db=require(_0x841d('0x14'))['db'];function respondWithStatusCode(_0x5ed81b,_0x2f414){_0x2f414=_0x2f414||0xcc;return function(_0x494cef){if(_0x494cef){return _0x5ed81b[_0x841d('0x15')](_0x2f414);}return _0x5ed81b[_0x841d('0x16')](_0x2f414)[_0x841d('0x17')]();};}function respondWithResult(_0x271e13,_0x17004b){_0x17004b=_0x17004b||0xc8;return function(_0x478449){if(_0x478449){return _0x271e13[_0x841d('0x16')](_0x17004b)[_0x841d('0x18')](_0x478449);}};}function respondWithFilteredResult(_0x34516d,_0x3b6941){return function(_0x5a3049){if(_0x5a3049){var _0x3b1802=_0x5a3049[_0x841d('0x19')],_0x4320da=_0x3b6941['offset'],_0x4116ba=_0x3b6941['offset']+_0x3b6941[_0x841d('0x1a')],_0x3029ff;if(_0x4116ba>=_0x3b1802){_0x4116ba=_0x3b1802;_0x3029ff=0xc8;}else{_0x3029ff=0xce;}_0x34516d[_0x841d('0x16')](_0x3029ff);return _0x34516d[_0x841d('0x1b')](_0x841d('0x1c'),_0x4320da+'-'+_0x4116ba+'/'+_0x3b1802)[_0x841d('0x18')](_0x5a3049);}return null;};}function patchUpdates(_0x2e58ef){return function(_0x16aa70){try{jsonpatch['apply'](_0x16aa70,_0x2e58ef,!![]);}catch(_0x33093a){return BPromise['reject'](_0x33093a);}return _0x16aa70[_0x841d('0x1d')]();};}function saveUpdates(_0x8d12df,_0x30986f){return function(_0x5765cb){if(_0x5765cb){return _0x5765cb['update'](_0x8d12df)[_0x841d('0x1e')](function(_0x40d0f0){return _0x40d0f0;});}return null;};}function removeEntity(_0x1a88e7,_0x25dbe6){return function(_0x5b7158){if(_0x5b7158){return _0x5b7158[_0x841d('0x1f')]()[_0x841d('0x1e')](function(){_0x1a88e7[_0x841d('0x16')](0xcc)[_0x841d('0x17')]();});}};}function handleEntityNotFound(_0x47426a,_0x5c40df){return function(_0x5b13ef){if(!_0x5b13ef){_0x47426a[_0x841d('0x15')](0x194);}return _0x5b13ef;};}function handleError(_0x150f1a,_0x19e0cc){_0x19e0cc=_0x19e0cc||0x1f4;return function(_0x117541){logger[_0x841d('0x20')](_0x117541[_0x841d('0x21')]);if(_0x117541['name']){delete _0x117541['name'];}_0x150f1a[_0x841d('0x16')](_0x19e0cc)['send'](_0x117541);};}exports[_0x841d('0x22')]=function(_0x3117e6,_0x25cd18){var _0x119247={},_0xabc8b0={},_0xe8b880={'count':0x0,'rows':[]};var _0x10a530=_['map'](db[_0x841d('0x23')]['rawAttributes'],function(_0x48e882){return{'name':_0x48e882[_0x841d('0x24')],'type':_0x48e882[_0x841d('0x25')][_0x841d('0x26')]};});_0xabc8b0['model']=_[_0x841d('0x27')](_0x10a530,_0x841d('0x28'));_0xabc8b0['query']=_[_0x841d('0x29')](_0x3117e6[_0x841d('0x2a')]);_0xabc8b0[_0x841d('0x2b')]=_['intersection'](_0xabc8b0[_0x841d('0x2c')],_0xabc8b0['query']);_0x119247[_0x841d('0x2d')]=_[_0x841d('0x2e')](_0xabc8b0[_0x841d('0x2c')],qs['fields'](_0x3117e6[_0x841d('0x2a')]['fields']));_0x119247['attributes']=_0x119247['attributes'][_0x841d('0x2f')]?_0x119247[_0x841d('0x2d')]:_0xabc8b0['model'];if(!_0x3117e6[_0x841d('0x2a')][_0x841d('0x30')](_0x841d('0x31'))){_0x119247[_0x841d('0x1a')]=qs[_0x841d('0x1a')](_0x3117e6[_0x841d('0x2a')][_0x841d('0x1a')]);_0x119247[_0x841d('0x32')]=qs[_0x841d('0x32')](_0x3117e6[_0x841d('0x2a')]['offset']);}_0x119247[_0x841d('0x33')]=qs['sort'](_0x3117e6[_0x841d('0x2a')][_0x841d('0x34')]);_0x119247['where']=qs[_0x841d('0x2b')](_[_0x841d('0x35')](_0x3117e6[_0x841d('0x2a')],_0xabc8b0[_0x841d('0x2b')]),_0x10a530);if(_0x3117e6[_0x841d('0x2a')][_0x841d('0x36')]){_0x119247[_0x841d('0x37')]=_['merge'](_0x119247[_0x841d('0x37')],{'$or':_[_0x841d('0x27')](_0x10a530,function(_0x1aaad0){if(_0x1aaad0['type']!==_0x841d('0x38')){var _0x58545f={};_0x58545f[_0x1aaad0[_0x841d('0x28')]]={'$like':'%'+_0x3117e6[_0x841d('0x2a')]['filter']+'%'};return _0x58545f;}})});}_0x119247=_[_0x841d('0x39')]({},_0x119247,_0x3117e6[_0x841d('0x3a')]);var _0x2360b={'where':_0x119247[_0x841d('0x37')]};return db[_0x841d('0x23')][_0x841d('0x19')](_0x2360b)[_0x841d('0x1e')](function(_0x5700a7){_0xe8b880[_0x841d('0x19')]=_0x5700a7;if(_0x3117e6[_0x841d('0x2a')]['includeAll']){_0x119247['include']=[{'all':!![]}];}return db[_0x841d('0x23')]['findAll'](_0x119247);})[_0x841d('0x1e')](function(_0x1ea80a){_0xe8b880['rows']=_0x1ea80a;return _0xe8b880;})[_0x841d('0x1e')](respondWithFilteredResult(_0x25cd18,_0x119247))[_0x841d('0x3b')](handleError(_0x25cd18,null));};exports[_0x841d('0x3c')]=function(_0x41c329,_0x369ef1){var _0x4481eb={'raw':!![],'where':{'id':_0x41c329[_0x841d('0x3d')]['id']}},_0x5ab0ca={};_0x5ab0ca[_0x841d('0x2c')]=_[_0x841d('0x29')](db['SalesforceField']['rawAttributes']);_0x5ab0ca['query']=_[_0x841d('0x29')](_0x41c329[_0x841d('0x2a')]);_0x5ab0ca['filters']=_[_0x841d('0x2e')](_0x5ab0ca[_0x841d('0x2c')],_0x5ab0ca[_0x841d('0x2a')]);_0x4481eb[_0x841d('0x2d')]=_[_0x841d('0x2e')](_0x5ab0ca[_0x841d('0x2c')],qs[_0x841d('0x3e')](_0x41c329[_0x841d('0x2a')][_0x841d('0x3e')]));_0x4481eb[_0x841d('0x2d')]=_0x4481eb[_0x841d('0x2d')]['length']?_0x4481eb[_0x841d('0x2d')]:_0x5ab0ca['model'];if(_0x41c329[_0x841d('0x2a')]['includeAll']){_0x4481eb['include']=[{'all':!![]}];}_0x4481eb=_[_0x841d('0x39')]({},_0x4481eb,_0x41c329['options']);return db['SalesforceField'][_0x841d('0x3f')](_0x4481eb)[_0x841d('0x1e')](handleEntityNotFound(_0x369ef1,null))[_0x841d('0x1e')](respondWithResult(_0x369ef1,null))[_0x841d('0x3b')](handleError(_0x369ef1,null));};exports[_0x841d('0x40')]=function(_0x586074,_0x5cefd5){return db['SalesforceField']['create'](_0x586074['body'],{})[_0x841d('0x1e')](respondWithResult(_0x5cefd5,0xc9))['catch'](handleError(_0x5cefd5,null));};exports[_0x841d('0x41')]=function(_0x2c9d2c,_0x74bd5f){if(_0x2c9d2c[_0x841d('0x42')]['id']){delete _0x2c9d2c[_0x841d('0x42')]['id'];}return db[_0x841d('0x23')][_0x841d('0x3f')]({'where':{'id':_0x2c9d2c[_0x841d('0x3d')]['id']}})[_0x841d('0x1e')](handleEntityNotFound(_0x74bd5f,null))[_0x841d('0x1e')](saveUpdates(_0x2c9d2c[_0x841d('0x42')],null))[_0x841d('0x1e')](respondWithResult(_0x74bd5f,null))[_0x841d('0x3b')](handleError(_0x74bd5f,null));};exports[_0x841d('0x1f')]=function(_0x3d83a0,_0x305dba){return db[_0x841d('0x23')][_0x841d('0x3f')]({'where':{'id':_0x3d83a0['params']['id']}})[_0x841d('0x1e')](handleEntityNotFound(_0x305dba,null))['then'](removeEntity(_0x305dba,null))[_0x841d('0x3b')](handleError(_0x305dba,null));}; \ No newline at end of file +var _0x56c0=['sendStatus','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','keys','query','filters','attributes','intersection','model','fields','length','nolimit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','create','body','update','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','then','destroy'];(function(_0x7a42d9,_0x5a0c72){var _0x278b78=function(_0x1fa030){while(--_0x1fa030){_0x7a42d9['push'](_0x7a42d9['shift']());}};_0x278b78(++_0x5a0c72);}(_0x56c0,0x138));var _0x056c=function(_0x229e90,_0x3b05ef){_0x229e90=_0x229e90-0x0;var _0x3b405f=_0x56c0[_0x229e90];return _0x3b405f;};'use strict';var pdf=require(_0x056c('0x0'));var emlformat=require(_0x056c('0x1'));var rimraf=require(_0x056c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x056c('0x3'));var rp=require(_0x056c('0x4'));var moment=require(_0x056c('0x5'));var BPromise=require(_0x056c('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x056c('0x7'));var csv=require(_0x056c('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x056c('0x9'));var crypto=require(_0x056c('0xa'));var jsforce=require(_0x056c('0xb'));var deskjs=require(_0x056c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x056c('0xd'));var Papa=require(_0x056c('0xe'));var Redis=require(_0x056c('0xf'));var authService=require(_0x056c('0x10'));var qs=require(_0x056c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x056c('0x12'));var utils=require('../../config/utils');var config=require(_0x056c('0x13'));var db=require(_0x056c('0x14'))['db'];function respondWithStatusCode(_0x41409e,_0x265756){_0x265756=_0x265756||0xcc;return function(_0x46442f){if(_0x46442f){return _0x41409e['sendStatus'](_0x265756);}return _0x41409e[_0x056c('0x15')](_0x265756)[_0x056c('0x16')]();};}function respondWithResult(_0x54c409,_0x2bd014){_0x2bd014=_0x2bd014||0xc8;return function(_0x4a1ec4){if(_0x4a1ec4){return _0x54c409['status'](_0x2bd014)['json'](_0x4a1ec4);}};}function respondWithFilteredResult(_0xa2239e,_0x5af6d6){return function(_0x437c4e){if(_0x437c4e){var _0x1e069a=_0x437c4e[_0x056c('0x17')],_0x19f6f1=_0x5af6d6['offset'],_0x4cea6d=_0x5af6d6[_0x056c('0x18')]+_0x5af6d6[_0x056c('0x19')],_0x4666fb;if(_0x4cea6d>=_0x1e069a){_0x4cea6d=_0x1e069a;_0x4666fb=0xc8;}else{_0x4666fb=0xce;}_0xa2239e[_0x056c('0x15')](_0x4666fb);return _0xa2239e[_0x056c('0x1a')](_0x056c('0x1b'),_0x19f6f1+'-'+_0x4cea6d+'/'+_0x1e069a)[_0x056c('0x1c')](_0x437c4e);}return null;};}function patchUpdates(_0x3febac){return function(_0x1056ff){try{jsonpatch[_0x056c('0x1d')](_0x1056ff,_0x3febac,!![]);}catch(_0x9c2b70){return BPromise[_0x056c('0x1e')](_0x9c2b70);}return _0x1056ff['save']();};}function saveUpdates(_0x1f05a8,_0x1ef3da){return function(_0x250cb7){if(_0x250cb7){return _0x250cb7['update'](_0x1f05a8)[_0x056c('0x1f')](function(_0x17453e){return _0x17453e;});}return null;};}function removeEntity(_0x37ef0a,_0x595161){return function(_0x258053){if(_0x258053){return _0x258053[_0x056c('0x20')]()[_0x056c('0x1f')](function(){_0x37ef0a[_0x056c('0x15')](0xcc)[_0x056c('0x16')]();});}};}function handleEntityNotFound(_0x47bac6,_0x1f173a){return function(_0x1e7232){if(!_0x1e7232){_0x47bac6[_0x056c('0x21')](0x194);}return _0x1e7232;};}function handleError(_0x30c18f,_0x5d2fa3){_0x5d2fa3=_0x5d2fa3||0x1f4;return function(_0x3d4e20){logger[_0x056c('0x22')](_0x3d4e20[_0x056c('0x23')]);if(_0x3d4e20['name']){delete _0x3d4e20[_0x056c('0x24')];}_0x30c18f['status'](_0x5d2fa3)[_0x056c('0x25')](_0x3d4e20);};}exports[_0x056c('0x26')]=function(_0x2579fe,_0x16b41e){var _0x235c11={},_0x2cd9aa={},_0x8278a3={'count':0x0,'rows':[]};var _0x303526=_[_0x056c('0x27')](db[_0x056c('0x28')][_0x056c('0x29')],function(_0x284cb1){return{'name':_0x284cb1[_0x056c('0x2a')],'type':_0x284cb1[_0x056c('0x2b')]['key']};});_0x2cd9aa['model']=_[_0x056c('0x27')](_0x303526,_0x056c('0x24'));_0x2cd9aa['query']=_[_0x056c('0x2c')](_0x2579fe[_0x056c('0x2d')]);_0x2cd9aa[_0x056c('0x2e')]=_['intersection'](_0x2cd9aa['model'],_0x2cd9aa['query']);_0x235c11[_0x056c('0x2f')]=_[_0x056c('0x30')](_0x2cd9aa[_0x056c('0x31')],qs[_0x056c('0x32')](_0x2579fe['query'][_0x056c('0x32')]));_0x235c11[_0x056c('0x2f')]=_0x235c11[_0x056c('0x2f')][_0x056c('0x33')]?_0x235c11[_0x056c('0x2f')]:_0x2cd9aa[_0x056c('0x31')];if(!_0x2579fe[_0x056c('0x2d')]['hasOwnProperty'](_0x056c('0x34'))){_0x235c11['limit']=qs[_0x056c('0x19')](_0x2579fe[_0x056c('0x2d')][_0x056c('0x19')]);_0x235c11['offset']=qs[_0x056c('0x18')](_0x2579fe['query'][_0x056c('0x18')]);}_0x235c11[_0x056c('0x35')]=qs['sort'](_0x2579fe[_0x056c('0x2d')]['sort']);_0x235c11['where']=qs['filters'](_[_0x056c('0x36')](_0x2579fe['query'],_0x2cd9aa[_0x056c('0x2e')]),_0x303526);if(_0x2579fe['query'][_0x056c('0x37')]){_0x235c11[_0x056c('0x38')]=_[_0x056c('0x39')](_0x235c11[_0x056c('0x38')],{'$or':_[_0x056c('0x27')](_0x303526,function(_0x22b53f){if(_0x22b53f[_0x056c('0x2b')]!==_0x056c('0x3a')){var _0x2f5c75={};_0x2f5c75[_0x22b53f[_0x056c('0x24')]]={'$like':'%'+_0x2579fe[_0x056c('0x2d')][_0x056c('0x37')]+'%'};return _0x2f5c75;}})});}_0x235c11=_[_0x056c('0x39')]({},_0x235c11,_0x2579fe[_0x056c('0x3b')]);var _0x27b8c0={'where':_0x235c11[_0x056c('0x38')]};return db[_0x056c('0x28')][_0x056c('0x17')](_0x27b8c0)[_0x056c('0x1f')](function(_0x5869e0){_0x8278a3[_0x056c('0x17')]=_0x5869e0;if(_0x2579fe['query'][_0x056c('0x3c')]){_0x235c11['include']=[{'all':!![]}];}return db[_0x056c('0x28')][_0x056c('0x3d')](_0x235c11);})['then'](function(_0x35d61b){_0x8278a3['rows']=_0x35d61b;return _0x8278a3;})[_0x056c('0x1f')](respondWithFilteredResult(_0x16b41e,_0x235c11))[_0x056c('0x3e')](handleError(_0x16b41e,null));};exports[_0x056c('0x3f')]=function(_0x4a3f65,_0x3a1bf0){var _0x4eddc3={'raw':!![],'where':{'id':_0x4a3f65[_0x056c('0x40')]['id']}},_0x4209e0={};_0x4209e0[_0x056c('0x31')]=_[_0x056c('0x2c')](db[_0x056c('0x28')]['rawAttributes']);_0x4209e0['query']=_[_0x056c('0x2c')](_0x4a3f65[_0x056c('0x2d')]);_0x4209e0[_0x056c('0x2e')]=_[_0x056c('0x30')](_0x4209e0[_0x056c('0x31')],_0x4209e0['query']);_0x4eddc3['attributes']=_[_0x056c('0x30')](_0x4209e0[_0x056c('0x31')],qs['fields'](_0x4a3f65[_0x056c('0x2d')][_0x056c('0x32')]));_0x4eddc3[_0x056c('0x2f')]=_0x4eddc3[_0x056c('0x2f')]['length']?_0x4eddc3[_0x056c('0x2f')]:_0x4209e0[_0x056c('0x31')];if(_0x4a3f65['query'][_0x056c('0x3c')]){_0x4eddc3['include']=[{'all':!![]}];}_0x4eddc3=_[_0x056c('0x39')]({},_0x4eddc3,_0x4a3f65[_0x056c('0x3b')]);return db[_0x056c('0x28')]['find'](_0x4eddc3)[_0x056c('0x1f')](handleEntityNotFound(_0x3a1bf0,null))[_0x056c('0x1f')](respondWithResult(_0x3a1bf0,null))[_0x056c('0x3e')](handleError(_0x3a1bf0,null));};exports[_0x056c('0x41')]=function(_0xce756c,_0x3d9c6c){return db[_0x056c('0x28')][_0x056c('0x41')](_0xce756c[_0x056c('0x42')],{})[_0x056c('0x1f')](respondWithResult(_0x3d9c6c,0xc9))[_0x056c('0x3e')](handleError(_0x3d9c6c,null));};exports[_0x056c('0x43')]=function(_0x9c5c3b,_0x1f488b){if(_0x9c5c3b[_0x056c('0x42')]['id']){delete _0x9c5c3b['body']['id'];}return db['SalesforceField'][_0x056c('0x44')]({'where':{'id':_0x9c5c3b[_0x056c('0x40')]['id']}})['then'](handleEntityNotFound(_0x1f488b,null))[_0x056c('0x1f')](saveUpdates(_0x9c5c3b[_0x056c('0x42')],null))[_0x056c('0x1f')](respondWithResult(_0x1f488b,null))[_0x056c('0x3e')](handleError(_0x1f488b,null));};exports[_0x056c('0x20')]=function(_0x497125,_0x584ce4){return db[_0x056c('0x28')][_0x056c('0x44')]({'where':{'id':_0x497125[_0x056c('0x40')]['id']}})[_0x056c('0x1f')](handleEntityNotFound(_0x584ce4,null))[_0x056c('0x1f')](removeEntity(_0x584ce4,null))[_0x056c('0x3e')](handleError(_0x584ce4,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 7630d58..3b3d801 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 _0x7615=['request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x2e200c,_0x48ecf0){var _0x5a1e2e=function(_0x1e39a9){while(--_0x1e39a9){_0x2e200c['push'](_0x2e200c['shift']());}};_0x5a1e2e(++_0x48ecf0);}(_0x7615,0xfa));var _0x5761=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x7615[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x5761('0x0'));var util=require(_0x5761('0x1'));var logger=require(_0x5761('0x2'))(_0x5761('0x3'));var moment=require(_0x5761('0x4'));var BPromise=require('bluebird');var rp=require(_0x5761('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5761('0x6'));var config=require(_0x5761('0x7'));var attributes=require(_0x5761('0x8'));module[_0x5761('0x9')]=function(_0x223a67,_0x2e8618){return _0x223a67[_0x5761('0xa')]('SalesforceField',attributes,{'tableName':_0x5761('0xb'),'paranoid':![],'indexes':[{'name':_0x5761('0xc'),'fields':[_0x5761('0xd'),_0x5761('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1ed7=['request-promise','path','rimraf','../../config/environment','exports','define','SalesforceField','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3197e4,_0x146290){var _0x2f4eb3=function(_0x3f75ae){while(--_0x3f75ae){_0x3197e4['push'](_0x3197e4['shift']());}};_0x2f4eb3(++_0x146290);}(_0x1ed7,0x162));var _0x71ed=function(_0x1fe2b4,_0xf8eb6d){_0x1fe2b4=_0x1fe2b4-0x0;var _0x6f860c=_0x1ed7[_0x1fe2b4];return _0x6f860c;};'use strict';var _=require(_0x71ed('0x0'));var util=require(_0x71ed('0x1'));var logger=require(_0x71ed('0x2'))(_0x71ed('0x3'));var moment=require(_0x71ed('0x4'));var BPromise=require(_0x71ed('0x5'));var rp=require(_0x71ed('0x6'));var fs=require('fs');var path=require(_0x71ed('0x7'));var rimraf=require(_0x71ed('0x8'));var config=require(_0x71ed('0x9'));var attributes=require('./intSalesforceField.attributes');module[_0x71ed('0xa')]=function(_0x2c5747,_0x2d5780){return _0x2c5747[_0x71ed('0xb')](_0x71ed('0xc'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x71ed('0xd'),_0x71ed('0xe')],'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 36c4be4..3ee8a42 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 _0xf4eb=['SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2b23ab,_0x5ed076){var _0x36414c=function(_0x2a77d7){while(--_0x2a77d7){_0x2b23ab['push'](_0x2b23ab['shift']());}};_0x36414c(++_0x5ed076);}(_0xf4eb,0xec));var _0xbf4e=function(_0x43c8ee,_0x38355b){_0x43c8ee=_0x43c8ee-0x0;var _0x2d5f67=_0xf4eb[_0x43c8ee];return _0x2d5f67;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('SalesforceField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','SalesforceField,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x382445,_0x5727ac){_0x382445=_0x382445-0x0;var _0x4219cb=_0xbdb7[_0x382445];return _0x4219cb;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index cc712e0..1b70728 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 _0x234f=['isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','./intServicenowAccount.controller','get'];(function(_0x3d3431,_0x5af465){var _0x18307a=function(_0xe5efa0){while(--_0xe5efa0){_0x3d3431['push'](_0x3d3431['shift']());}};_0x18307a(++_0x5af465);}(_0x234f,0xb6));var _0xf234=function(_0x4ebaaf,_0x1e12fe){_0x4ebaaf=_0x4ebaaf-0x0;var _0x2b94e1=_0x234f[_0x4ebaaf];return _0x2b94e1;};'use strict';var multer=require(_0xf234('0x0'));var util=require(_0xf234('0x1'));var path=require(_0xf234('0x2'));var timeout=require(_0xf234('0x3'));var express=require(_0xf234('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf234('0x5'));router[_0xf234('0x6')]('/',auth[_0xf234('0x7')](),controller[_0xf234('0x8')]);router[_0xf234('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xf234('0x6')](_0xf234('0x9'),auth[_0xf234('0x7')](),controller[_0xf234('0xa')]);router[_0xf234('0x6')](_0xf234('0xb'),auth[_0xf234('0x7')](),controller[_0xf234('0xc')]);router[_0xf234('0xd')]('/',auth[_0xf234('0x7')](),controller[_0xf234('0xe')]);router[_0xf234('0xd')]('/:id/configurations',auth[_0xf234('0x7')](),controller[_0xf234('0xf')]);router[_0xf234('0x10')](_0xf234('0x11'),auth['isAuthenticated'](),controller[_0xf234('0x12')]);router['delete'](_0xf234('0x11'),auth['isAuthenticated'](),controller[_0xf234('0x13')]);module[_0xf234('0x14')]=router; \ No newline at end of file +var _0xfde9=['addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','create','post'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xfde9,0x66));var _0x9fde=function(_0x48a96f,_0x530059){_0x48a96f=_0x48a96f-0x0;var _0x3ff3ef=_0xfde9[_0x48a96f];return _0x3ff3ef;};'use strict';var multer=require(_0x9fde('0x0'));var util=require(_0x9fde('0x1'));var path=require(_0x9fde('0x2'));var timeout=require(_0x9fde('0x3'));var express=require(_0x9fde('0x4'));var router=express['Router']();var auth=require(_0x9fde('0x5'));var interaction=require(_0x9fde('0x6'));var config=require('../../config/environment');var controller=require(_0x9fde('0x7'));router[_0x9fde('0x8')]('/',auth[_0x9fde('0x9')](),controller[_0x9fde('0xa')]);router[_0x9fde('0x8')](_0x9fde('0xb'),auth[_0x9fde('0x9')](),controller[_0x9fde('0xc')]);router[_0x9fde('0x8')](_0x9fde('0xd'),auth[_0x9fde('0x9')](),controller[_0x9fde('0xe')]);router[_0x9fde('0x8')](_0x9fde('0xf'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0x9fde('0x9')](),controller[_0x9fde('0x10')]);router[_0x9fde('0x11')]('/:id/configurations',auth[_0x9fde('0x9')](),controller[_0x9fde('0x12')]);router[_0x9fde('0x13')](_0x9fde('0xb'),auth[_0x9fde('0x9')](),controller[_0x9fde('0x14')]);router[_0x9fde('0x15')](_0x9fde('0xb'),auth[_0x9fde('0x9')](),controller[_0x9fde('0x16')]);module[_0x9fde('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 52f41c5..a3652b0 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 _0x44ce=['STRING','username'];(function(_0x2219bd,_0x9cfd12){var _0xb72639=function(_0x2113f3){while(--_0x2113f3){_0x2219bd['push'](_0x2219bd['shift']());}};_0xb72639(++_0x9cfd12);}(_0x44ce,0x1b4));var _0xe44c=function(_0x4d58ce,_0x47fb4f){_0x4d58ce=_0x4d58ce-0x0;var _0x504769=_0x44ce[_0x4d58ce];return _0x504769;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe44c('0x0')]},'username':{'type':Sequelize[_0xe44c('0x0')],'unique':_0xe44c('0x1')},'password':{'type':Sequelize[_0xe44c('0x0')]},'email':{'type':Sequelize[_0xe44c('0x0')]},'remoteUri':{'type':Sequelize[_0xe44c('0x0')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xe44c('0x0')]}}; \ No newline at end of file +var _0xfbdf=['sequelize','exports','STRING','username','remoteUri'];(function(_0x4c27aa,_0x3b1a58){var _0x175360=function(_0x5f0e70){while(--_0x5f0e70){_0x4c27aa['push'](_0x4c27aa['shift']());}};_0x175360(++_0x3b1a58);}(_0xfbdf,0x181));var _0xffbd=function(_0x403947,_0x3877d9){_0x403947=_0x403947-0x0;var _0x2b8e1a=_0xfbdf[_0x403947];return _0x2b8e1a;};'use strict';var Sequelize=require(_0xffbd('0x0'));module[_0xffbd('0x1')]={'name':{'type':Sequelize[_0xffbd('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xffbd('0x2')],'unique':_0xffbd('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xffbd('0x2')],'unique':_0xffbd('0x4')},'serverUrl':{'type':Sequelize[_0xffbd('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 32e5180..bad9fdd 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 _0xb9bc=['closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','caller_id','approval_set','short_description','delivery_task','assignment_group','business_stc','description','calendar_duration','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','activity_due','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','findOne','username','password','remoteUri','serverUrl','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','remove','includes','forEach','internalType','label','push','all','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../components/integrations/configuration','jayson/promise','client','http','Sequelize','ValidationError','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','count','offset','set','Content-Range','reject','save','update','then','end','sendStatus','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','keys','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','include','findAll','params','includeAll','options','find','body','destroy','getConfigurations','pick','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','create','Subjects','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','parent','caused_by','watch_list','sys_updated_on','approval_history','number','sys_updated_by','user_input','sys_created_on','state','sys_created_by','calendar_stc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb9bc,0x1c2));var _0xcb9b=function(_0x1e500e,_0x2c9d74){_0x1e500e=_0x1e500e-0x0;var _0x10dc5e=_0xb9bc[_0x1e500e];return _0x10dc5e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcb9b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcb9b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcb9b('0x2'));var moment=require(_0xcb9b('0x3'));var BPromise=require(_0xcb9b('0x4'));var Mustache=require(_0xcb9b('0x5'));var util=require(_0xcb9b('0x6'));var path=require(_0xcb9b('0x7'));var sox=require('sox');var csv=require(_0xcb9b('0x8'));var ejs=require(_0xcb9b('0x9'));var fs=require('fs');var _=require(_0xcb9b('0xa'));var squel=require(_0xcb9b('0xb'));var crypto=require(_0xcb9b('0xc'));var jsforce=require(_0xcb9b('0xd'));var deskjs=require(_0xcb9b('0xe'));var toCsv=require(_0xcb9b('0x8'));var querystring=require(_0xcb9b('0xf'));var Papa=require('papaparse');var Redis=require(_0xcb9b('0x10'));var authService=require(_0xcb9b('0x11'));var qs=require(_0xcb9b('0x12'));var as=require(_0xcb9b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcb9b('0x14'))(_0xcb9b('0x15'));var utils=require(_0xcb9b('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0xcb9b('0x17'));var jayson=require(_0xcb9b('0x18'));var client=jayson[_0xcb9b('0x19')][_0xcb9b('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x228097,_0x1bcb42,_0x48e245){if(_0x48e245){var _0x495eee=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x495eee['test'](_0x1bcb42)){return _0x228097;}else{throw new db[(_0xcb9b('0x1b'))][(_0xcb9b('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x228097;}}function respondWithRpcPromise(_0x141f20,_0x33fb6e,_0x47ca10,_0x42abb4){return new BPromise(function(_0x273309,_0x2ac346){var _0x485173=_0x42abb4||client;return _0x485173[_0xcb9b('0x1d')](_0x141f20,_0x47ca10)['then'](function(_0x48f863){logger[_0xcb9b('0x1e')](_0xcb9b('0x1f'),_0x33fb6e,_0xcb9b('0x20'));logger[_0xcb9b('0x21')](_0xcb9b('0x22'),_0x33fb6e,'request\x20sent',JSON[_0xcb9b('0x23')](_0x48f863));if(_0x48f863['error']){if(_0x48f863[_0xcb9b('0x24')][_0xcb9b('0x25')]===0x1f4){logger['error'](_0xcb9b('0x1f'),_0x33fb6e,_0x48f863[_0xcb9b('0x24')][_0xcb9b('0x26')]);return _0x2ac346(_0x48f863[_0xcb9b('0x24')][_0xcb9b('0x26')]);}logger[_0xcb9b('0x24')](_0xcb9b('0x1f'),_0x33fb6e,_0x48f863[_0xcb9b('0x24')][_0xcb9b('0x26')]);return _0x273309(_0x48f863[_0xcb9b('0x24')]['message']);}else{logger[_0xcb9b('0x1e')](_0xcb9b('0x1f'),_0x33fb6e,_0xcb9b('0x20'));_0x273309(_0x48f863[_0xcb9b('0x27')][_0xcb9b('0x26')]);}})[_0xcb9b('0x28')](function(_0x3bab79){logger[_0xcb9b('0x24')](_0xcb9b('0x1f'),_0x33fb6e,_0x3bab79);_0x2ac346(_0x3bab79);});});}function respondWithStatusCode(_0x27ded9,_0x282eea){_0x282eea=_0x282eea||0xcc;return function(_0x21cdf6){if(_0x21cdf6){return _0x27ded9['sendStatus'](_0x282eea);}return _0x27ded9[_0xcb9b('0x29')](_0x282eea)['end']();};}function respondWithResult(_0x47d43b,_0x3f74b8){_0x3f74b8=_0x3f74b8||0xc8;return function(_0x40a110){if(_0x40a110){return _0x47d43b[_0xcb9b('0x29')](_0x3f74b8)[_0xcb9b('0x2a')](_0x40a110);}};}function respondWithFilteredResult(_0x40e057,_0x55c8af){return function(_0x517283){if(_0x517283){var _0x4bb20a=_0x517283[_0xcb9b('0x2b')],_0x36648c=_0x55c8af[_0xcb9b('0x2c')],_0x331b3e=_0x55c8af[_0xcb9b('0x2c')]+_0x55c8af['limit'],_0xcc1c07;if(_0x331b3e>=_0x4bb20a){_0x331b3e=_0x4bb20a;_0xcc1c07=0xc8;}else{_0xcc1c07=0xce;}_0x40e057[_0xcb9b('0x29')](_0xcc1c07);return _0x40e057[_0xcb9b('0x2d')](_0xcb9b('0x2e'),_0x36648c+'-'+_0x331b3e+'/'+_0x4bb20a)[_0xcb9b('0x2a')](_0x517283);}return null;};}function patchUpdates(_0x381e35){return function(_0x43ca15){try{jsonpatch['apply'](_0x43ca15,_0x381e35,!![]);}catch(_0x13d140){return BPromise[_0xcb9b('0x2f')](_0x13d140);}return _0x43ca15[_0xcb9b('0x30')]();};}function saveUpdates(_0x45f366,_0x3704ec){return function(_0x284431){if(_0x284431){return _0x284431[_0xcb9b('0x31')](_0x45f366)['then'](function(_0x3ec1fd){return _0x3ec1fd;});}return null;};}function removeEntity(_0x5a62f4,_0x314ba8){return function(_0x321cd9){if(_0x321cd9){return _0x321cd9['destroy']()[_0xcb9b('0x32')](function(){_0x5a62f4[_0xcb9b('0x29')](0xcc)[_0xcb9b('0x33')]();});}};}function handleEntityNotFound(_0x1c52b7,_0x2d807e){return function(_0x567f88){if(!_0x567f88){_0x1c52b7[_0xcb9b('0x34')](0x194);}return _0x567f88;};}function handleError(_0x30d28d,_0x5c265c){_0x5c265c=_0x5c265c||0x1f4;return function(_0x27a45d){logger[_0xcb9b('0x24')](_0x27a45d[_0xcb9b('0x35')]);if(_0x27a45d[_0xcb9b('0x36')]){delete _0x27a45d[_0xcb9b('0x36')];}_0x30d28d[_0xcb9b('0x29')](_0x5c265c)[_0xcb9b('0x37')](_0x27a45d);};}exports[_0xcb9b('0x38')]=function(_0x3d4a7a,_0x3c1334){var _0x5499c2={},_0x34df09={},_0x44f1c5={'count':0x0,'rows':[]};var _0x44e0c5=_[_0xcb9b('0x39')](db[_0xcb9b('0x3a')][_0xcb9b('0x3b')],function(_0x1290f9){return{'name':_0x1290f9[_0xcb9b('0x3c')],'type':_0x1290f9[_0xcb9b('0x3d')][_0xcb9b('0x3e')]};});_0x34df09[_0xcb9b('0x3f')]=_[_0xcb9b('0x39')](_0x44e0c5,'name');_0x34df09['query']=_[_0xcb9b('0x40')](_0x3d4a7a['query']);_0x34df09['filters']=_['intersection'](_0x34df09['model'],_0x34df09['query']);_0x5499c2['attributes']=_[_0xcb9b('0x41')](_0x34df09[_0xcb9b('0x3f')],qs[_0xcb9b('0x42')](_0x3d4a7a[_0xcb9b('0x43')]['fields']));_0x5499c2[_0xcb9b('0x44')]=_0x5499c2[_0xcb9b('0x44')][_0xcb9b('0x45')]?_0x5499c2[_0xcb9b('0x44')]:_0x34df09[_0xcb9b('0x3f')];if(!_0x3d4a7a['query'][_0xcb9b('0x46')](_0xcb9b('0x47'))){_0x5499c2[_0xcb9b('0x48')]=qs['limit'](_0x3d4a7a[_0xcb9b('0x43')][_0xcb9b('0x48')]);_0x5499c2['offset']=qs['offset'](_0x3d4a7a[_0xcb9b('0x43')][_0xcb9b('0x2c')]);}_0x5499c2[_0xcb9b('0x49')]=qs[_0xcb9b('0x4a')](_0x3d4a7a['query'][_0xcb9b('0x4a')]);_0x5499c2[_0xcb9b('0x4b')]=qs[_0xcb9b('0x4c')](_['pick'](_0x3d4a7a[_0xcb9b('0x43')],_0x34df09[_0xcb9b('0x4c')]),_0x44e0c5);if(_0x3d4a7a['query'][_0xcb9b('0x4d')]){_0x5499c2[_0xcb9b('0x4b')]=_[_0xcb9b('0x4e')](_0x5499c2[_0xcb9b('0x4b')],{'$or':_[_0xcb9b('0x39')](_0x44e0c5,function(_0x46eb46){if(_0x46eb46[_0xcb9b('0x3d')]!=='VIRTUAL'){var _0x42e413={};_0x42e413[_0x46eb46[_0xcb9b('0x36')]]={'$like':'%'+_0x3d4a7a[_0xcb9b('0x43')][_0xcb9b('0x4d')]+'%'};return _0x42e413;}})});}_0x5499c2=_[_0xcb9b('0x4e')]({},_0x5499c2,_0x3d4a7a['options']);var _0x339492={'where':_0x5499c2[_0xcb9b('0x4b')]};return db[_0xcb9b('0x3a')][_0xcb9b('0x2b')](_0x339492)[_0xcb9b('0x32')](function(_0x273297){_0x44f1c5[_0xcb9b('0x2b')]=_0x273297;if(_0x3d4a7a[_0xcb9b('0x43')]['includeAll']){_0x5499c2[_0xcb9b('0x4f')]=[{'all':!![]}];}return db[_0xcb9b('0x3a')][_0xcb9b('0x50')](_0x5499c2);})[_0xcb9b('0x32')](function(_0x2b7fdd){_0x44f1c5['rows']=_0x2b7fdd;return _0x44f1c5;})[_0xcb9b('0x32')](respondWithFilteredResult(_0x3c1334,_0x5499c2))['catch'](handleError(_0x3c1334,null));};exports['show']=function(_0x56e701,_0x2302b8){var _0x5debf6={'raw':![],'where':{'id':_0x56e701[_0xcb9b('0x51')]['id']}},_0x5df0d3={};_0x5df0d3['model']=_[_0xcb9b('0x40')](db[_0xcb9b('0x3a')][_0xcb9b('0x3b')]);_0x5df0d3[_0xcb9b('0x43')]=_['keys'](_0x56e701[_0xcb9b('0x43')]);_0x5df0d3['filters']=_[_0xcb9b('0x41')](_0x5df0d3['model'],_0x5df0d3[_0xcb9b('0x43')]);_0x5debf6[_0xcb9b('0x44')]=_[_0xcb9b('0x41')](_0x5df0d3[_0xcb9b('0x3f')],qs[_0xcb9b('0x42')](_0x56e701[_0xcb9b('0x43')][_0xcb9b('0x42')]));_0x5debf6[_0xcb9b('0x44')]=_0x5debf6[_0xcb9b('0x44')][_0xcb9b('0x45')]?_0x5debf6['attributes']:_0x5df0d3[_0xcb9b('0x3f')];if(_0x56e701[_0xcb9b('0x43')][_0xcb9b('0x52')]){_0x5debf6[_0xcb9b('0x4f')]=[{'all':!![]}];}_0x5debf6=_[_0xcb9b('0x4e')]({},_0x5debf6,_0x56e701[_0xcb9b('0x53')]);return db[_0xcb9b('0x3a')][_0xcb9b('0x54')](_0x5debf6)[_0xcb9b('0x32')](handleEntityNotFound(_0x2302b8,null))['then'](respondWithResult(_0x2302b8,null))['catch'](handleError(_0x2302b8,null));};exports['create']=function(_0x5e448c,_0x14c472){return db[_0xcb9b('0x3a')]['create'](_0x5e448c['body'],{})['then'](respondWithResult(_0x14c472,0xc9))[_0xcb9b('0x28')](handleError(_0x14c472,null));};exports[_0xcb9b('0x31')]=function(_0x8ec8aa,_0x4f759c){if(_0x8ec8aa[_0xcb9b('0x55')]['id']){delete _0x8ec8aa[_0xcb9b('0x55')]['id'];}return db[_0xcb9b('0x3a')]['find']({'where':{'id':_0x8ec8aa['params']['id']}})[_0xcb9b('0x32')](handleEntityNotFound(_0x4f759c,null))[_0xcb9b('0x32')](saveUpdates(_0x8ec8aa[_0xcb9b('0x55')],null))[_0xcb9b('0x32')](respondWithResult(_0x4f759c,null))['catch'](handleError(_0x4f759c,null));};exports[_0xcb9b('0x56')]=function(_0x3e9984,_0x2cbfab){return db[_0xcb9b('0x3a')][_0xcb9b('0x54')]({'where':{'id':_0x3e9984[_0xcb9b('0x51')]['id']}})[_0xcb9b('0x32')](handleEntityNotFound(_0x2cbfab,null))[_0xcb9b('0x32')](removeEntity(_0x2cbfab,null))['catch'](handleError(_0x2cbfab,null));};exports[_0xcb9b('0x57')]=function(_0x2f383f,_0x4871a7,_0x2ca58b){var _0x3ab434={};var _0x4f52b6={};var _0x4b4bea;var _0x41d081;return db[_0xcb9b('0x3a')]['findOne']({'where':{'id':_0x2f383f['params']['id']}})[_0xcb9b('0x32')](handleEntityNotFound(_0x4871a7,null))[_0xcb9b('0x32')](function(_0x4850b4){if(_0x4850b4){_0x4b4bea=_0x4850b4;_0x4f52b6[_0xcb9b('0x3f')]=_['keys'](db['ServicenowConfiguration'][_0xcb9b('0x3b')]);_0x4f52b6['query']=_[_0xcb9b('0x40')](_0x2f383f[_0xcb9b('0x43')]);_0x4f52b6['filters']=_[_0xcb9b('0x41')](_0x4f52b6[_0xcb9b('0x3f')],_0x4f52b6[_0xcb9b('0x43')]);_0x3ab434['attributes']=_[_0xcb9b('0x41')](_0x4f52b6[_0xcb9b('0x3f')],qs[_0xcb9b('0x42')](_0x2f383f[_0xcb9b('0x43')][_0xcb9b('0x42')]));_0x3ab434[_0xcb9b('0x44')]=_0x3ab434['attributes'][_0xcb9b('0x45')]?_0x3ab434[_0xcb9b('0x44')]:_0x4f52b6[_0xcb9b('0x3f')];_0x3ab434[_0xcb9b('0x49')]=qs[_0xcb9b('0x4a')](_0x2f383f[_0xcb9b('0x43')][_0xcb9b('0x4a')]);_0x3ab434[_0xcb9b('0x4b')]=qs[_0xcb9b('0x4c')](_[_0xcb9b('0x58')](_0x2f383f[_0xcb9b('0x43')],_0x4f52b6[_0xcb9b('0x4c')]));if(_0x2f383f[_0xcb9b('0x43')][_0xcb9b('0x4d')]){_0x3ab434[_0xcb9b('0x4b')]=_[_0xcb9b('0x4e')](_0x3ab434[_0xcb9b('0x4b')],{'$or':_[_0xcb9b('0x39')](_0x3ab434['attributes'],function(_0x227661){var _0x54ad8a={};_0x54ad8a[_0x227661]={'$like':'%'+_0x2f383f[_0xcb9b('0x43')][_0xcb9b('0x4d')]+'%'};return _0x54ad8a;})});}_0x3ab434=_[_0xcb9b('0x4e')]({},_0x3ab434,_0x2f383f[_0xcb9b('0x53')]);return _0x4b4bea[_0xcb9b('0x57')](_0x3ab434);}})[_0xcb9b('0x32')](function(_0x52512d){if(_0x52512d){_0x41d081=_0x52512d[_0xcb9b('0x45')];if(!_0x2f383f['query'][_0xcb9b('0x46')](_0xcb9b('0x47'))){_0x3ab434['limit']=qs['limit'](_0x2f383f[_0xcb9b('0x43')][_0xcb9b('0x48')]);_0x3ab434['offset']=qs[_0xcb9b('0x2c')](_0x2f383f[_0xcb9b('0x43')][_0xcb9b('0x2c')]);}return _0x4b4bea[_0xcb9b('0x57')](_0x3ab434);}})['then'](function(_0x154f30){if(_0x154f30){return _0x154f30?{'count':_0x41d081,'rows':_0x154f30}:null;}})[_0xcb9b('0x32')](respondWithResult(_0x4871a7,null))['catch'](handleError(_0x4871a7,null));};exports[_0xcb9b('0x59')]=function(_0x879651,_0x73ffeb,_0xd9d179){if(_0x879651[_0xcb9b('0x55')]['id']){delete _0x879651[_0xcb9b('0x55')]['id'];}return db[_0xcb9b('0x3a')]['findOne']({'where':{'id':_0x879651[_0xcb9b('0x51')]['id']}})[_0xcb9b('0x32')](handleEntityNotFound(_0x73ffeb,null))[_0xcb9b('0x32')](function(_0x13da35){if(_0x13da35){_0x879651[_0xcb9b('0x55')]['AccountId']=_0x13da35['id'];_0x879651[_0xcb9b('0x55')]['Subjects']=integrations[_0xcb9b('0x5a')](_0x879651['body'][_0xcb9b('0x5b')],_0x879651['body'][_0xcb9b('0x3d')]);_0x879651[_0xcb9b('0x55')][_0xcb9b('0x5c')]=integrations[_0xcb9b('0x5d')](_0x879651[_0xcb9b('0x55')][_0xcb9b('0x5b')],_0x879651[_0xcb9b('0x55')]['type']);return db[_0xcb9b('0x5e')][_0xcb9b('0x5f')](_0x879651[_0xcb9b('0x55')],{'include':[{'model':db['ServicenowField'],'as':_0xcb9b('0x60')},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x73ffeb,null))[_0xcb9b('0x28')](handleError(_0x73ffeb,null));};exports['getFields']=function(_0x452613,_0x362792,_0x23d79f){var _0x2850b9=[_0xcb9b('0x61'),_0xcb9b('0x62'),_0xcb9b('0x63'),_0xcb9b('0x64'),_0xcb9b('0x65'),_0xcb9b('0x66'),_0xcb9b('0x67'),_0xcb9b('0x68'),'category'];var _0x5c82c6=[_0xcb9b('0x69'),_0xcb9b('0x61'),_0xcb9b('0x6a'),_0xcb9b('0x6b'),'upon_reject',_0xcb9b('0x6c'),'child_incidents',_0xcb9b('0x62'),_0xcb9b('0x6d'),_0xcb9b('0x6e'),'resolved_by',_0xcb9b('0x6f'),'opened_by',_0xcb9b('0x70'),_0xcb9b('0x71'),'sys_domain',_0xcb9b('0x72'),_0xcb9b('0x73'),_0xcb9b('0x63'),'order',_0xcb9b('0x74'),_0xcb9b('0x75'),_0xcb9b('0x76'),_0xcb9b('0x77'),_0xcb9b('0x78'),_0xcb9b('0x79'),_0xcb9b('0x7a'),_0xcb9b('0x7b'),_0xcb9b('0x7c'),_0xcb9b('0x7d'),_0xcb9b('0x7e'),_0xcb9b('0x7f'),_0xcb9b('0x80'),_0xcb9b('0x81'),_0xcb9b('0x82'),'group_list',_0xcb9b('0x83'),'reopened_time','resolved_at',_0xcb9b('0x84'),_0xcb9b('0x85'),_0xcb9b('0x64'),'work_notes',_0xcb9b('0x86'),'close_code','correlation_display',_0xcb9b('0x87'),'work_start',_0xcb9b('0x88'),_0xcb9b('0x89'),'additional_assignee_list',_0xcb9b('0x8a'),_0xcb9b('0x8b'),_0xcb9b('0x66'),'sys_class_name',_0xcb9b('0x8c'),'closed_by',_0xcb9b('0x8d'),_0xcb9b('0x8e'),_0xcb9b('0x8f'),_0xcb9b('0x90'),_0xcb9b('0x91'),'incident_state','urgency',_0xcb9b('0x92'),_0xcb9b('0x93'),_0xcb9b('0x94'),_0xcb9b('0x95'),'assigned_to','severity','comments',_0xcb9b('0x96'),'approval',_0xcb9b('0x97'),_0xcb9b('0x98'),_0xcb9b('0x99'),_0xcb9b('0x9a'),_0xcb9b('0x9b'),'escalation',_0xcb9b('0x9c'),'correlation_id','location','category'];var _0x51c67a='';var _0x2b76cb='';var _0x431968=[];var _0x478190='';var _0x250ec2='';var _0x4395c9=[];var _0x325ba4='';var _0x281022='';var _0x2cb4a9={};var _0xcd6ec3='';return db[_0xcb9b('0x3a')][_0xcb9b('0x9d')]({'where':{'id':_0x452613['params']['id']},'attributes':['id',_0xcb9b('0x9e'),_0xcb9b('0x9f'),'email',_0xcb9b('0xa0'),_0xcb9b('0xa1')]})['then'](handleEntityNotFound(_0x362792,null))['then'](function(_0x344081){if(_0x344081){_0xcd6ec3=_0x344081[_0xcb9b('0xa0')];var _0x2d90aa=_0xcd6ec3['slice'](-0x1);if(_0x2d90aa==='/'){_0xcd6ec3=_0xcd6ec3['substring'](0x0,_0xcd6ec3[_0xcb9b('0xa2')](_0x2d90aa));}_0x281022=util[_0xcb9b('0xa3')](_0xcb9b('0xa4'),_0xcd6ec3);_0x325ba4=util[_0xcb9b('0xa3')](_0xcb9b('0xa5'),_0xcd6ec3);_0x2cb4a9={'user':_0x344081[_0xcb9b('0x9e')],'pass':_0x344081[_0xcb9b('0x9f')]};var _0x3d6875={'method':_0xcb9b('0xa6'),'uri':_0x281022+_0xcb9b('0xa7'),'auth':_0x2cb4a9,'json':!![]};return rp(_0x3d6875);}})[_0xcb9b('0x32')](function(_0x4291e3){if(_0x4291e3['result'][_0xcb9b('0x45')]>0x0){_0x51c67a=_0x4291e3[_0xcb9b('0x27')];}console[_0xcb9b('0xa8')]('incident\x20table\x20objects',_0x51c67a);_0x4395c9=[];_0x2b76cb=Object['assign']([],_0x51c67a);_[_0xcb9b('0xa9')](_0x2b76cb,function(_0x34b373){return!_0x2850b9[_0xcb9b('0xaa')](_0x34b373[_0xcb9b('0x36')]);});_0x2b76cb[_0xcb9b('0xab')](function(_0x24c35c){var _0x2dc9c5=createFieldObject(_0x325ba4,_0x2cb4a9,_0x24c35c[_0xcb9b('0xac')],_0x24c35c[_0xcb9b('0x36')],_0x24c35c[_0xcb9b('0xad')],![]);_0x4395c9[_0xcb9b('0xae')](_0x2dc9c5);});return Promise[_0xcb9b('0xaf')](_0x4395c9);})[_0xcb9b('0x32')](function(_0x18c9aa){_0x431968=_0x18c9aa;_0x478190=Object[_0xcb9b('0xb0')]([],_0x51c67a);console[_0xcb9b('0xa8')](_0xcb9b('0xb1'),_0x51c67a);_[_0xcb9b('0xa9')](_0x478190,function(_0x1d0df8){return _0x5c82c6[_0xcb9b('0xaa')](_0x1d0df8[_0xcb9b('0x36')]);});console[_0xcb9b('0xa8')](_0xcb9b('0xb2'),_0x478190);_0x4395c9=[];_0x478190['forEach'](function(_0x53a3b5){var _0x130dc9=createFieldObject(_0x325ba4,_0x2cb4a9,_0x53a3b5['internalType'],_0x53a3b5[_0xcb9b('0x36')],_0x53a3b5[_0xcb9b('0xad')],!![]);_0x4395c9[_0xcb9b('0xae')](_0x130dc9);});return Promise[_0xcb9b('0xaf')](_0x4395c9);})[_0xcb9b('0x32')](function(_0x3eb7d2){_0x250ec2=_0x3eb7d2;var _0x4f4ef5=_0x431968[_0xcb9b('0xb3')](_0x250ec2);return{'count':_0x4f4ef5['length'],'rows':_0x4f4ef5};})[_0xcb9b('0x32')](respondWithResult(_0x362792,null))['catch'](function(_0x7c7778){console[_0xcb9b('0xa8')](_0xcb9b('0xb4')+_0x7c7778);var _0x5cf663=_0x452613[_0xcb9b('0x43')][_0xcb9b('0xb5')]?0x1f4:_0x7c7778['statusCode']||0x1f4;logger[_0xcb9b('0x24')](_0x7c7778[_0xcb9b('0x35')]);delete _0x7c7778[_0xcb9b('0x36')];if(_0x5cf663===0x191){_0x5cf663=0x190;}_0x362792[_0xcb9b('0x29')](_0x5cf663)[_0xcb9b('0x37')](_0x452613[_0xcb9b('0x43')]['test']?{'message':_0xcb9b('0xb6'),'statusCode':_0x7c7778[_0xcb9b('0xb7')]}:_0x7c7778);});};function createFieldObject(_0x11c72e,_0x48a5fc,_0x4039dc,_0x44552a,_0x2c6a97,_0x3d55f1){return new Promise(function(_0x2b25d9,_0xa5e995){var _0x274f65={'id':_0x44552a,'name':_0x2c6a97,'custom':_0x3d55f1};if(_0x4039dc===_0xcb9b('0xb8')){_0x274f65['options']=[{'name':_0xcb9b('0xb9'),'value':'true'},{'name':_0xcb9b('0xba'),'value':_0xcb9b('0xbb')}];_0x2b25d9(_0x274f65);}else{var _0x2cc881={'method':_0xcb9b('0xa6'),'uri':_0x11c72e+_0xcb9b('0xbc')+_0x44552a,'auth':_0x48a5fc,'json':!![]};return rp(_0x2cc881)['then'](function(_0x3909c8){var _0x236eab=[];if(_0x3909c8['result'][_0xcb9b('0x45')]>0x0){_0x3909c8[_0xcb9b('0x27')]['forEach'](function(_0x38c55c){if(_0x38c55c['inactive']===_0xcb9b('0xbb')){var _0x26e9b9={'name':_0x38c55c[_0xcb9b('0xad')],'value':_0x38c55c['value']};_0x236eab[_0xcb9b('0xae')](_0x26e9b9);}});}_0x274f65[_0xcb9b('0x53')]=_0x236eab;if(_0x274f65[_0xcb9b('0x53')]['length']>0x0){_0x2b25d9(_0x274f65);}else{if(_0x3d55f1==![]){_0x2b25d9();}else{_0x2b25d9(_0x274f65);}}});}});} \ No newline at end of file +var _0x3960=['getDescriptions','ServicenowConfiguration','ServicenowField','hold_reason','knowledge','subcategory','notify','incident_state','severity','category','parent','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','number','sys_updated_by','opened_by','sys_domain','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','active','business_service','priority','rfc','time_worked','expected_start','opened_at','business_duration','group_list','reopened_time','resolved_at','caller_id','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','close_notes','closed_by','follow_up','sys_id','contact_type','reopened_by','problem_id','reassignment_count','activity_due','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','escalation','correlation_id','location','username','password','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','assign','remove','includes','forEach','internalType','label','push','TCL:\x20_object','all','concat','ServiceNow\x20error:\x20','statusCode','send','test','Wrong\x20credentials','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','json','offset','set','Content-Range','apply','save','update','stack','index','map','ServicenowAccount','type','query','keys','filters','intersection','model','attributes','fields','nolimit','limit','order','where','pick','merge','VIRTUAL','name','filter','options','count','includeAll','include','params','length','create','body','find','destroy','getConfigurations','findOne','sort','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions'];(function(_0x276357,_0x4a4691){var _0x4395b2=function(_0x1c5dc9){while(--_0x1c5dc9){_0x276357['push'](_0x276357['shift']());}};_0x4395b2(++_0x4a4691);}(_0x3960,0x125));var _0x0396=function(_0x2fa70a,_0x2d513c){_0x2fa70a=_0x2fa70a-0x0;var _0x3e1f76=_0x3960[_0x2fa70a];return _0x3e1f76;};'use strict';var pdf=require(_0x0396('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0396('0x1'));var zipdir=require(_0x0396('0x2'));var jsonpatch=require(_0x0396('0x3'));var rp=require(_0x0396('0x4'));var moment=require(_0x0396('0x5'));var BPromise=require(_0x0396('0x6'));var Mustache=require(_0x0396('0x7'));var util=require(_0x0396('0x8'));var path=require(_0x0396('0x9'));var sox=require(_0x0396('0xa'));var csv=require(_0x0396('0xb'));var ejs=require(_0x0396('0xc'));var fs=require('fs');var _=require(_0x0396('0xd'));var squel=require(_0x0396('0xe'));var crypto=require('crypto');var jsforce=require(_0x0396('0xf'));var deskjs=require(_0x0396('0x10'));var toCsv=require(_0x0396('0xb'));var querystring=require(_0x0396('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0396('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0396('0x13'))(_0x0396('0x14'));var utils=require(_0x0396('0x15'));var config=require(_0x0396('0x16'));var db=require(_0x0396('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x0396('0x18'));var client=jayson[_0x0396('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x57cbf6,_0xf8c66e,_0x50b8a0){if(_0x50b8a0){var _0x540b0d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x540b0d['test'](_0xf8c66e)){return _0x57cbf6;}else{throw new db[(_0x0396('0x1a'))][(_0x0396('0x1b'))](_0x0396('0x1c'));}}else{return _0x57cbf6;}}function respondWithRpcPromise(_0x51cf7d,_0x8b11b,_0x2fea0f,_0x5b45c0){return new BPromise(function(_0x17943a,_0x264204){var _0x56cbba=_0x5b45c0||client;return _0x56cbba[_0x0396('0x1d')](_0x51cf7d,_0x2fea0f)[_0x0396('0x1e')](function(_0x3d63f9){logger['info'](_0x0396('0x1f'),_0x8b11b,_0x0396('0x20'));logger[_0x0396('0x21')](_0x0396('0x22'),_0x8b11b,_0x0396('0x20'),JSON[_0x0396('0x23')](_0x3d63f9));if(_0x3d63f9[_0x0396('0x24')]){if(_0x3d63f9[_0x0396('0x24')]['code']===0x1f4){logger[_0x0396('0x24')](_0x0396('0x1f'),_0x8b11b,_0x3d63f9[_0x0396('0x24')]['message']);return _0x264204(_0x3d63f9[_0x0396('0x24')][_0x0396('0x25')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x8b11b,_0x3d63f9['error'][_0x0396('0x25')]);return _0x17943a(_0x3d63f9[_0x0396('0x24')][_0x0396('0x25')]);}else{logger[_0x0396('0x26')](_0x0396('0x1f'),_0x8b11b,_0x0396('0x20'));_0x17943a(_0x3d63f9[_0x0396('0x27')][_0x0396('0x25')]);}})[_0x0396('0x28')](function(_0x34bf99){logger[_0x0396('0x24')]('ServicenowAccount,\x20%s,\x20%s',_0x8b11b,_0x34bf99);_0x264204(_0x34bf99);});});}function respondWithStatusCode(_0xa2cf02,_0x59afb0){_0x59afb0=_0x59afb0||0xcc;return function(_0x276e35){if(_0x276e35){return _0xa2cf02[_0x0396('0x29')](_0x59afb0);}return _0xa2cf02[_0x0396('0x2a')](_0x59afb0)[_0x0396('0x2b')]();};}function respondWithResult(_0x8372d0,_0x417da7){_0x417da7=_0x417da7||0xc8;return function(_0x3783c6){if(_0x3783c6){return _0x8372d0[_0x0396('0x2a')](_0x417da7)[_0x0396('0x2c')](_0x3783c6);}};}function respondWithFilteredResult(_0x30a79b,_0x449979){return function(_0x354d7d){if(_0x354d7d){var _0x5996ab=_0x354d7d['count'],_0x4f8069=_0x449979[_0x0396('0x2d')],_0xe91104=_0x449979[_0x0396('0x2d')]+_0x449979['limit'],_0x54b9c7;if(_0xe91104>=_0x5996ab){_0xe91104=_0x5996ab;_0x54b9c7=0xc8;}else{_0x54b9c7=0xce;}_0x30a79b[_0x0396('0x2a')](_0x54b9c7);return _0x30a79b[_0x0396('0x2e')](_0x0396('0x2f'),_0x4f8069+'-'+_0xe91104+'/'+_0x5996ab)[_0x0396('0x2c')](_0x354d7d);}return null;};}function patchUpdates(_0x43d7ba){return function(_0x90668e){try{jsonpatch[_0x0396('0x30')](_0x90668e,_0x43d7ba,!![]);}catch(_0x10a9f2){return BPromise['reject'](_0x10a9f2);}return _0x90668e[_0x0396('0x31')]();};}function saveUpdates(_0x4be30b,_0x4a85b6){return function(_0x1e93fd){if(_0x1e93fd){return _0x1e93fd[_0x0396('0x32')](_0x4be30b)[_0x0396('0x1e')](function(_0x2737bf){return _0x2737bf;});}return null;};}function removeEntity(_0x232e7d,_0x5326f5){return function(_0x316e34){if(_0x316e34){return _0x316e34['destroy']()['then'](function(){_0x232e7d[_0x0396('0x2a')](0xcc)[_0x0396('0x2b')]();});}};}function handleEntityNotFound(_0xa0a58a,_0x137e42){return function(_0x5ce346){if(!_0x5ce346){_0xa0a58a['sendStatus'](0x194);}return _0x5ce346;};}function handleError(_0x2c37d9,_0xa55022){_0xa55022=_0xa55022||0x1f4;return function(_0x851607){logger[_0x0396('0x24')](_0x851607[_0x0396('0x33')]);if(_0x851607['name']){delete _0x851607['name'];}_0x2c37d9['status'](_0xa55022)['send'](_0x851607);};}exports[_0x0396('0x34')]=function(_0x227c66,_0x2edf42){var _0x2aa7ae={},_0x5e0fe7={},_0x5d83d2={'count':0x0,'rows':[]};var _0x8ef986=_[_0x0396('0x35')](db[_0x0396('0x36')]['rawAttributes'],function(_0x5185c1){return{'name':_0x5185c1['fieldName'],'type':_0x5185c1[_0x0396('0x37')]['key']};});_0x5e0fe7['model']=_[_0x0396('0x35')](_0x8ef986,'name');_0x5e0fe7[_0x0396('0x38')]=_[_0x0396('0x39')](_0x227c66['query']);_0x5e0fe7[_0x0396('0x3a')]=_[_0x0396('0x3b')](_0x5e0fe7[_0x0396('0x3c')],_0x5e0fe7[_0x0396('0x38')]);_0x2aa7ae[_0x0396('0x3d')]=_['intersection'](_0x5e0fe7[_0x0396('0x3c')],qs['fields'](_0x227c66[_0x0396('0x38')][_0x0396('0x3e')]));_0x2aa7ae['attributes']=_0x2aa7ae[_0x0396('0x3d')]['length']?_0x2aa7ae[_0x0396('0x3d')]:_0x5e0fe7[_0x0396('0x3c')];if(!_0x227c66[_0x0396('0x38')]['hasOwnProperty'](_0x0396('0x3f'))){_0x2aa7ae['limit']=qs[_0x0396('0x40')](_0x227c66[_0x0396('0x38')]['limit']);_0x2aa7ae[_0x0396('0x2d')]=qs[_0x0396('0x2d')](_0x227c66[_0x0396('0x38')]['offset']);}_0x2aa7ae[_0x0396('0x41')]=qs['sort'](_0x227c66[_0x0396('0x38')]['sort']);_0x2aa7ae[_0x0396('0x42')]=qs['filters'](_[_0x0396('0x43')](_0x227c66[_0x0396('0x38')],_0x5e0fe7[_0x0396('0x3a')]),_0x8ef986);if(_0x227c66['query']['filter']){_0x2aa7ae[_0x0396('0x42')]=_[_0x0396('0x44')](_0x2aa7ae['where'],{'$or':_[_0x0396('0x35')](_0x8ef986,function(_0x4f2d42){if(_0x4f2d42['type']!==_0x0396('0x45')){var _0x583cd5={};_0x583cd5[_0x4f2d42[_0x0396('0x46')]]={'$like':'%'+_0x227c66[_0x0396('0x38')][_0x0396('0x47')]+'%'};return _0x583cd5;}})});}_0x2aa7ae=_[_0x0396('0x44')]({},_0x2aa7ae,_0x227c66[_0x0396('0x48')]);var _0x24e1a4={'where':_0x2aa7ae['where']};return db['ServicenowAccount'][_0x0396('0x49')](_0x24e1a4)[_0x0396('0x1e')](function(_0xfb5260){_0x5d83d2['count']=_0xfb5260;if(_0x227c66[_0x0396('0x38')][_0x0396('0x4a')]){_0x2aa7ae[_0x0396('0x4b')]=[{'all':!![]}];}return db[_0x0396('0x36')]['findAll'](_0x2aa7ae);})['then'](function(_0x50dd2e){_0x5d83d2['rows']=_0x50dd2e;return _0x5d83d2;})[_0x0396('0x1e')](respondWithFilteredResult(_0x2edf42,_0x2aa7ae))[_0x0396('0x28')](handleError(_0x2edf42,null));};exports['show']=function(_0x4b876c,_0x40dd55){var _0x25f1f8={'raw':![],'where':{'id':_0x4b876c[_0x0396('0x4c')]['id']}},_0x510b47={};_0x510b47[_0x0396('0x3c')]=_[_0x0396('0x39')](db[_0x0396('0x36')]['rawAttributes']);_0x510b47[_0x0396('0x38')]=_[_0x0396('0x39')](_0x4b876c[_0x0396('0x38')]);_0x510b47[_0x0396('0x3a')]=_[_0x0396('0x3b')](_0x510b47[_0x0396('0x3c')],_0x510b47[_0x0396('0x38')]);_0x25f1f8[_0x0396('0x3d')]=_['intersection'](_0x510b47[_0x0396('0x3c')],qs[_0x0396('0x3e')](_0x4b876c[_0x0396('0x38')][_0x0396('0x3e')]));_0x25f1f8[_0x0396('0x3d')]=_0x25f1f8[_0x0396('0x3d')][_0x0396('0x4d')]?_0x25f1f8[_0x0396('0x3d')]:_0x510b47[_0x0396('0x3c')];if(_0x4b876c[_0x0396('0x38')][_0x0396('0x4a')]){_0x25f1f8[_0x0396('0x4b')]=[{'all':!![]}];}_0x25f1f8=_[_0x0396('0x44')]({},_0x25f1f8,_0x4b876c[_0x0396('0x48')]);return db['ServicenowAccount']['find'](_0x25f1f8)['then'](handleEntityNotFound(_0x40dd55,null))['then'](respondWithResult(_0x40dd55,null))[_0x0396('0x28')](handleError(_0x40dd55,null));};exports[_0x0396('0x4e')]=function(_0xc1e39c,_0x1b89eb){return db[_0x0396('0x36')][_0x0396('0x4e')](_0xc1e39c['body'],{})[_0x0396('0x1e')](respondWithResult(_0x1b89eb,0xc9))[_0x0396('0x28')](handleError(_0x1b89eb,null));};exports[_0x0396('0x32')]=function(_0x559a7c,_0x54906a){if(_0x559a7c[_0x0396('0x4f')]['id']){delete _0x559a7c[_0x0396('0x4f')]['id'];}return db[_0x0396('0x36')][_0x0396('0x50')]({'where':{'id':_0x559a7c[_0x0396('0x4c')]['id']}})['then'](handleEntityNotFound(_0x54906a,null))['then'](saveUpdates(_0x559a7c['body'],null))[_0x0396('0x1e')](respondWithResult(_0x54906a,null))[_0x0396('0x28')](handleError(_0x54906a,null));};exports[_0x0396('0x51')]=function(_0x3262b6,_0x4e4aaf){return db[_0x0396('0x36')][_0x0396('0x50')]({'where':{'id':_0x3262b6[_0x0396('0x4c')]['id']}})[_0x0396('0x1e')](handleEntityNotFound(_0x4e4aaf,null))['then'](removeEntity(_0x4e4aaf,null))['catch'](handleError(_0x4e4aaf,null));};exports[_0x0396('0x52')]=function(_0x5291c4,_0x103168,_0x45e8ec){var _0x637cb3={};var _0x9eb806={};var _0x3ca938;var _0x2b4bac;return db[_0x0396('0x36')][_0x0396('0x53')]({'where':{'id':_0x5291c4[_0x0396('0x4c')]['id']}})[_0x0396('0x1e')](handleEntityNotFound(_0x103168,null))['then'](function(_0x1b9622){if(_0x1b9622){_0x3ca938=_0x1b9622;_0x9eb806['model']=_['keys'](db['ServicenowConfiguration']['rawAttributes']);_0x9eb806[_0x0396('0x38')]=_[_0x0396('0x39')](_0x5291c4['query']);_0x9eb806[_0x0396('0x3a')]=_[_0x0396('0x3b')](_0x9eb806[_0x0396('0x3c')],_0x9eb806['query']);_0x637cb3[_0x0396('0x3d')]=_[_0x0396('0x3b')](_0x9eb806['model'],qs[_0x0396('0x3e')](_0x5291c4['query'][_0x0396('0x3e')]));_0x637cb3[_0x0396('0x3d')]=_0x637cb3[_0x0396('0x3d')][_0x0396('0x4d')]?_0x637cb3['attributes']:_0x9eb806['model'];_0x637cb3['order']=qs[_0x0396('0x54')](_0x5291c4[_0x0396('0x38')][_0x0396('0x54')]);_0x637cb3['where']=qs['filters'](_[_0x0396('0x43')](_0x5291c4['query'],_0x9eb806[_0x0396('0x3a')]));if(_0x5291c4[_0x0396('0x38')][_0x0396('0x47')]){_0x637cb3['where']=_[_0x0396('0x44')](_0x637cb3[_0x0396('0x42')],{'$or':_[_0x0396('0x35')](_0x637cb3[_0x0396('0x3d')],function(_0x575ec2){var _0xf9905e={};_0xf9905e[_0x575ec2]={'$like':'%'+_0x5291c4['query'][_0x0396('0x47')]+'%'};return _0xf9905e;})});}_0x637cb3=_['merge']({},_0x637cb3,_0x5291c4[_0x0396('0x48')]);return _0x3ca938[_0x0396('0x52')](_0x637cb3);}})['then'](function(_0x5439f9){if(_0x5439f9){_0x2b4bac=_0x5439f9[_0x0396('0x4d')];if(!_0x5291c4[_0x0396('0x38')][_0x0396('0x55')](_0x0396('0x3f'))){_0x637cb3[_0x0396('0x40')]=qs[_0x0396('0x40')](_0x5291c4['query'][_0x0396('0x40')]);_0x637cb3[_0x0396('0x2d')]=qs[_0x0396('0x2d')](_0x5291c4['query']['offset']);}return _0x3ca938[_0x0396('0x52')](_0x637cb3);}})[_0x0396('0x1e')](function(_0x53589e){if(_0x53589e){return _0x53589e?{'count':_0x2b4bac,'rows':_0x53589e}:null;}})[_0x0396('0x1e')](respondWithResult(_0x103168,null))[_0x0396('0x28')](handleError(_0x103168,null));};exports[_0x0396('0x56')]=function(_0x2ad3f2,_0x4a33d2,_0x2323fa){if(_0x2ad3f2[_0x0396('0x4f')]['id']){delete _0x2ad3f2['body']['id'];}return db['ServicenowAccount'][_0x0396('0x53')]({'where':{'id':_0x2ad3f2['params']['id']}})[_0x0396('0x1e')](handleEntityNotFound(_0x4a33d2,null))[_0x0396('0x1e')](function(_0x54360a){if(_0x54360a){_0x2ad3f2[_0x0396('0x4f')]['AccountId']=_0x54360a['id'];_0x2ad3f2[_0x0396('0x4f')][_0x0396('0x57')]=integrations[_0x0396('0x58')](_0x2ad3f2[_0x0396('0x4f')][_0x0396('0x59')],_0x2ad3f2[_0x0396('0x4f')]['type']);_0x2ad3f2['body'][_0x0396('0x5a')]=integrations[_0x0396('0x5b')](_0x2ad3f2['body'][_0x0396('0x59')],_0x2ad3f2['body'][_0x0396('0x37')]);return db[_0x0396('0x5c')][_0x0396('0x4e')](_0x2ad3f2[_0x0396('0x4f')],{'include':[{'model':db[_0x0396('0x5d')],'as':_0x0396('0x57')},{'model':db[_0x0396('0x5d')],'as':_0x0396('0x5a')}]});}return null;})['then'](respondWithResult(_0x4a33d2,null))['catch'](handleError(_0x4a33d2,null));};exports['getFields']=function(_0x35052c,_0x502bb9,_0xbd537e){var _0x195d91=['made_sla',_0x0396('0x5e'),_0x0396('0x5f'),_0x0396('0x60'),'close_code',_0x0396('0x61'),_0x0396('0x62'),_0x0396('0x63'),_0x0396('0x64')];var _0xd93b64=[_0x0396('0x65'),'made_sla',_0x0396('0x66'),_0x0396('0x67'),'upon_reject',_0x0396('0x68'),_0x0396('0x69'),'hold_reason',_0x0396('0x6a'),_0x0396('0x6b'),'resolved_by',_0x0396('0x6c'),_0x0396('0x6d'),'user_input','sys_created_on',_0x0396('0x6e'),_0x0396('0x6f'),_0x0396('0x70'),'knowledge',_0x0396('0x41'),'calendar_stc',_0x0396('0x71'),_0x0396('0x72'),_0x0396('0x73'),_0x0396('0x74'),_0x0396('0x75'),'work_notes_list',_0x0396('0x76'),_0x0396('0x77'),'sys_domain_path',_0x0396('0x78'),_0x0396('0x79'),_0x0396('0x7a'),_0x0396('0x7b'),_0x0396('0x7c'),_0x0396('0x7d'),'work_end',_0x0396('0x7e'),_0x0396('0x7f'),_0x0396('0x80'),'approval_set','subcategory','work_notes',_0x0396('0x81'),'close_code',_0x0396('0x82'),_0x0396('0x83'),_0x0396('0x84'),_0x0396('0x85'),_0x0396('0x86'),_0x0396('0x87'),_0x0396('0x88'),_0x0396('0x89'),_0x0396('0x61'),'sys_class_name',_0x0396('0x8a'),_0x0396('0x8b'),_0x0396('0x8c'),'parent_incident',_0x0396('0x8d'),_0x0396('0x8e'),_0x0396('0x8f'),_0x0396('0x62'),'urgency',_0x0396('0x90'),'company',_0x0396('0x91'),_0x0396('0x92'),'assigned_to',_0x0396('0x63'),_0x0396('0x93'),_0x0396('0x94'),_0x0396('0x95'),_0x0396('0x96'),_0x0396('0x97'),_0x0396('0x98'),'reopen_count',_0x0396('0x99'),_0x0396('0x9a'),'upon_approval',_0x0396('0x9b'),_0x0396('0x9c'),_0x0396('0x64')];var _0x5c6e2e='';var _0x1d3b43='';var _0x2e0903=[];var _0x4ddaa4='';var _0x28b6d1='';var _0x22fb47=[];var _0x3b3717='';var _0x2afb52='';var _0x5b3574={};var _0x412e9c='';return db[_0x0396('0x36')][_0x0396('0x53')]({'where':{'id':_0x35052c[_0x0396('0x4c')]['id']},'attributes':['id',_0x0396('0x9d'),_0x0396('0x9e'),_0x0396('0x9f'),_0x0396('0xa0'),'serverUrl']})['then'](handleEntityNotFound(_0x502bb9,null))[_0x0396('0x1e')](function(_0x288264){if(_0x288264){_0x412e9c=_0x288264['remoteUri'];var _0x44e4b4=_0x412e9c[_0x0396('0xa1')](-0x1);if(_0x44e4b4==='/'){_0x412e9c=_0x412e9c[_0x0396('0xa2')](0x0,_0x412e9c[_0x0396('0xa3')](_0x44e4b4));}_0x2afb52=util[_0x0396('0xa4')](_0x0396('0xa5'),_0x412e9c);_0x3b3717=util[_0x0396('0xa4')](_0x0396('0xa6'),_0x412e9c);_0x5b3574={'user':_0x288264[_0x0396('0x9d')],'pass':_0x288264[_0x0396('0x9e')]};var _0x5c78b5={'method':_0x0396('0xa7'),'uri':_0x2afb52+_0x0396('0xa8'),'auth':_0x5b3574,'json':!![]};return rp(_0x5c78b5);}})[_0x0396('0x1e')](function(_0x35dce6){if(_0x35dce6[_0x0396('0x27')][_0x0396('0x4d')]>0x0){_0x5c6e2e=_0x35dce6[_0x0396('0x27')];}console[_0x0396('0xa9')]('incident\x20table\x20objects',_0x5c6e2e);_0x22fb47=[];_0x1d3b43=Object[_0x0396('0xaa')]([],_0x5c6e2e);_[_0x0396('0xab')](_0x1d3b43,function(_0x14d410){return!_0x195d91[_0x0396('0xac')](_0x14d410[_0x0396('0x46')]);});_0x1d3b43[_0x0396('0xad')](function(_0x1f70c7){var _0x1f836e=createFieldObject(_0x3b3717,_0x5b3574,_0x1f70c7[_0x0396('0xae')],_0x1f70c7['name'],_0x1f70c7[_0x0396('0xaf')],![]);_0x22fb47[_0x0396('0xb0')](_0x1f836e);});return Promise['all'](_0x22fb47);})[_0x0396('0x1e')](function(_0x30fe61){_0x2e0903=_0x30fe61;_0x4ddaa4=Object[_0x0396('0xaa')]([],_0x5c6e2e);console[_0x0396('0xa9')](_0x0396('0xb1'),_0x5c6e2e);_[_0x0396('0xab')](_0x4ddaa4,function(_0x1b138c){return _0xd93b64['includes'](_0x1b138c[_0x0396('0x46')]);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x4ddaa4);_0x22fb47=[];_0x4ddaa4[_0x0396('0xad')](function(_0x3cb9a1){var _0x345a68=createFieldObject(_0x3b3717,_0x5b3574,_0x3cb9a1[_0x0396('0xae')],_0x3cb9a1['name'],_0x3cb9a1['label'],!![]);_0x22fb47[_0x0396('0xb0')](_0x345a68);});return Promise[_0x0396('0xb2')](_0x22fb47);})[_0x0396('0x1e')](function(_0x360af6){_0x28b6d1=_0x360af6;var _0x3f44f4=_0x2e0903[_0x0396('0xb3')](_0x28b6d1);return{'count':_0x3f44f4[_0x0396('0x4d')],'rows':_0x3f44f4};})[_0x0396('0x1e')](respondWithResult(_0x502bb9,null))['catch'](function(_0x5f0faa){console[_0x0396('0xa9')](_0x0396('0xb4')+_0x5f0faa);var _0x473ada=_0x35052c[_0x0396('0x38')]['test']?0x1f4:_0x5f0faa[_0x0396('0xb5')]||0x1f4;logger['error'](_0x5f0faa[_0x0396('0x33')]);delete _0x5f0faa['name'];if(_0x473ada===0x191){_0x473ada=0x190;}_0x502bb9[_0x0396('0x2a')](_0x473ada)[_0x0396('0xb6')](_0x35052c[_0x0396('0x38')][_0x0396('0xb7')]?{'message':_0x0396('0xb8'),'statusCode':_0x5f0faa[_0x0396('0xb5')]}:_0x5f0faa);});};function createFieldObject(_0x3bc6f3,_0x403488,_0x59d898,_0x2f4971,_0x3959b1,_0x222c5e){return new Promise(function(_0x11d79d,_0x4126fe){var _0x5c9c98={'id':_0x2f4971,'name':_0x3959b1,'custom':_0x222c5e};if(_0x59d898===_0x0396('0xb9')){_0x5c9c98[_0x0396('0x48')]=[{'name':_0x0396('0xba'),'value':'true'},{'name':_0x0396('0xbb'),'value':_0x0396('0xbc')}];_0x11d79d(_0x5c9c98);}else{var _0x2eb27c={'method':_0x0396('0xa7'),'uri':_0x3bc6f3+_0x0396('0xbd')+_0x2f4971,'auth':_0x403488,'json':!![]};return rp(_0x2eb27c)[_0x0396('0x1e')](function(_0x375590){var _0x5d855f=[];if(_0x375590[_0x0396('0x27')]['length']>0x0){_0x375590['result'][_0x0396('0xad')](function(_0x2b8278){if(_0x2b8278[_0x0396('0xbe')]===_0x0396('0xbc')){var _0x2155ed={'name':_0x2b8278[_0x0396('0xaf')],'value':_0x2b8278[_0x0396('0xbf')]};_0x5d855f[_0x0396('0xb0')](_0x2155ed);}});}_0x5c9c98[_0x0396('0x48')]=_0x5d855f;if(_0x5c9c98[_0x0396('0x48')]['length']>0x0){_0x11d79d(_0x5c9c98);}else{if(_0x222c5e==![]){_0x11d79d();}else{_0x11d79d(_0x5c9c98);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 0a45817..4de5af9 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 _0x2542=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','ServicenowAccount','util','../../config/logger','api'];(function(_0x2f8abf,_0x19757c){var _0x63b80a=function(_0x4620dc){while(--_0x4620dc){_0x2f8abf['push'](_0x2f8abf['shift']());}};_0x63b80a(++_0x19757c);}(_0x2542,0xcd));var _0x2254=function(_0x2233de,_0x3f709e){_0x2233de=_0x2233de-0x0;var _0x9279a7=_0x2542[_0x2233de];return _0x9279a7;};'use strict';var _=require('lodash');var util=require(_0x2254('0x0'));var logger=require(_0x2254('0x1'))(_0x2254('0x2'));var moment=require(_0x2254('0x3'));var BPromise=require(_0x2254('0x4'));var rp=require(_0x2254('0x5'));var fs=require('fs');var path=require(_0x2254('0x6'));var rimraf=require(_0x2254('0x7'));var config=require(_0x2254('0x8'));var attributes=require(_0x2254('0x9'));var integrations=require(_0x2254('0xa'));module[_0x2254('0xb')]=function(_0x41cb31,_0x26cc3){return _0x41cb31['define'](_0x2254('0xc'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b35=['util','../../config/logger','api','path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','int_servicenow_accounts','lodash'];(function(_0xa3400,_0x3a980a){var _0x33dba2=function(_0x5e988b){while(--_0x5e988b){_0xa3400['push'](_0xa3400['shift']());}};_0x33dba2(++_0x3a980a);}(_0x0b35,0x83));var _0x50b3=function(_0x3df946,_0x272382){_0x3df946=_0x3df946-0x0;var _0x11123a=_0x0b35[_0x3df946];return _0x11123a;};'use strict';var _=require(_0x50b3('0x0'));var util=require(_0x50b3('0x1'));var logger=require(_0x50b3('0x2'))(_0x50b3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x50b3('0x4'));var rimraf=require(_0x50b3('0x5'));var config=require('../../config/environment');var attributes=require(_0x50b3('0x6'));var integrations=require(_0x50b3('0x7'));module['exports']=function(_0x2c0704,_0x1782c3){return _0x2c0704[_0x50b3('0x8')](_0x50b3('0x9'),attributes,{'tableName':_0x50b3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 351aafd..d3b28f1 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 _0x93e0=['include','map','model','GetServicenowAccount','ShowServicenowAccount','find','raw','lodash','util','moment','randomstring','ioredis','../../config/logger','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','options','where','attributes','limit'];(function(_0x143368,_0x5d0b64){var _0x44c10a=function(_0x30c90c){while(--_0x30c90c){_0x143368['push'](_0x143368['shift']());}};_0x44c10a(++_0x5d0b64);}(_0x93e0,0xa2));var _0x093e=function(_0x28c054,_0xade95c){_0x28c054=_0x28c054-0x0;var _0x14866c=_0x93e0[_0x28c054];return _0x14866c;};'use strict';var _=require(_0x093e('0x0'));var util=require(_0x093e('0x1'));var moment=require(_0x093e('0x2'));var BPromise=require('bluebird');var rs=require(_0x093e('0x3'));var fs=require('fs');var Redis=require(_0x093e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x093e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x093e('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xc0c8e1,_0x14a137,_0x2e1b98){return new BPromise(function(_0x8ae70b,_0x2e1168){return client[_0x093e('0x7')](_0xc0c8e1,_0x2e1b98)[_0x093e('0x8')](function(_0x23d537){logger[_0x093e('0x9')](_0x093e('0xa'),_0x14a137,_0x093e('0xb'));logger[_0x093e('0xc')](_0x093e('0xd'),_0x14a137,_0x093e('0xb'),JSON[_0x093e('0xe')](_0x23d537));if(_0x23d537[_0x093e('0xf')]){if(_0x23d537[_0x093e('0xf')][_0x093e('0x10')]===0x1f4){logger[_0x093e('0xf')](_0x093e('0xa'),_0x14a137,_0x23d537[_0x093e('0xf')]['message']);return _0x2e1168(_0x23d537['error']['message']);}logger[_0x093e('0xf')](_0x093e('0xa'),_0x14a137,_0x23d537[_0x093e('0xf')][_0x093e('0x11')]);return _0x8ae70b(_0x23d537['error'][_0x093e('0x11')]);}else{logger[_0x093e('0x9')](_0x093e('0xa'),_0x14a137,_0x093e('0xb'));_0x8ae70b(_0x23d537['result']['message']);}})[_0x093e('0x12')](function(_0x4caa10){logger[_0x093e('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x14a137,_0x4caa10);_0x2e1168(_0x4caa10);});});}exports['GetServicenowAccount']=function(_0x2b2a35){var _0x3b41fb=this;return new Promise(function(_0x4b5e6a,_0x22a5a9){return db['ServicenowAccount'][_0x093e('0x13')]({'raw':_0x2b2a35[_0x093e('0x14')]?_0x2b2a35[_0x093e('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x2b2a35['options']?_0x2b2a35[_0x093e('0x14')][_0x093e('0x15')]||null:null,'attributes':_0x2b2a35[_0x093e('0x14')]?_0x2b2a35[_0x093e('0x14')][_0x093e('0x16')]||null:null,'limit':_0x2b2a35['options']?_0x2b2a35[_0x093e('0x14')][_0x093e('0x17')]||null:null,'include':_0x2b2a35[_0x093e('0x14')]?_0x2b2a35[_0x093e('0x14')][_0x093e('0x18')]?_[_0x093e('0x19')](_0x2b2a35[_0x093e('0x14')]['include'],function(_0x8b97f7){return{'model':db[_0x8b97f7[_0x093e('0x1a')]],'as':_0x8b97f7['as'],'attributes':_0x8b97f7[_0x093e('0x16')],'include':_0x8b97f7[_0x093e('0x18')]?_[_0x093e('0x19')](_0x8b97f7[_0x093e('0x18')],function(_0x17237c){return{'model':db[_0x17237c[_0x093e('0x1a')]],'as':_0x17237c['as'],'attributes':_0x17237c[_0x093e('0x16')],'include':_0x17237c['include']?_[_0x093e('0x19')](_0x17237c[_0x093e('0x18')],function(_0x149ca2){return{'model':db[_0x149ca2['model']],'as':_0x149ca2['as'],'attributes':_0x149ca2['attributes']};}):[]};}):[]};}):[]:[]})[_0x093e('0x8')](function(_0x2cb182){logger[_0x093e('0x9')](_0x093e('0x1b'),_0x2b2a35);logger[_0x093e('0xc')](_0x093e('0x1b'),_0x2b2a35,JSON[_0x093e('0xe')](_0x2cb182));_0x4b5e6a(_0x2cb182);})[_0x093e('0x12')](function(_0x569db7){logger['error']('GetServicenowAccount',_0x569db7[_0x093e('0x11')],_0x2b2a35);_0x22a5a9(_0x3b41fb[_0x093e('0xf')](0x1f4,_0x569db7[_0x093e('0x11')]));});});};exports[_0x093e('0x1c')]=function(_0x1491d9){var _0x3163c4=this;return new Promise(function(_0x344a84,_0xc288ec){return db['ServicenowAccount'][_0x093e('0x1d')]({'raw':_0x1491d9[_0x093e('0x14')]?_0x1491d9[_0x093e('0x14')][_0x093e('0x1e')]===undefined?!![]:![]:!![],'where':_0x1491d9['options']?_0x1491d9[_0x093e('0x14')][_0x093e('0x15')]||null:null,'attributes':_0x1491d9['options']?_0x1491d9[_0x093e('0x14')]['attributes']||null:null,'include':_0x1491d9[_0x093e('0x14')]?_0x1491d9[_0x093e('0x14')][_0x093e('0x18')]?_[_0x093e('0x19')](_0x1491d9[_0x093e('0x14')][_0x093e('0x18')],function(_0x31b2fc){return{'model':db[_0x31b2fc[_0x093e('0x1a')]],'as':_0x31b2fc['as'],'attributes':_0x31b2fc['attributes'],'include':_0x31b2fc['include']?_[_0x093e('0x19')](_0x31b2fc[_0x093e('0x18')],function(_0x463ed){return{'model':db[_0x463ed[_0x093e('0x1a')]],'as':_0x463ed['as'],'attributes':_0x463ed[_0x093e('0x16')],'include':_0x463ed[_0x093e('0x18')]?_[_0x093e('0x19')](_0x463ed['include'],function(_0x111407){return{'model':db[_0x111407[_0x093e('0x1a')]],'as':_0x111407['as'],'attributes':_0x111407[_0x093e('0x16')]};}):[]};}):[]};}):[]:[]})[_0x093e('0x8')](function(_0x421474){logger[_0x093e('0x9')]('ShowServicenowAccount',_0x1491d9);logger[_0x093e('0xc')](_0x093e('0x1c'),_0x1491d9,JSON[_0x093e('0xe')](_0x421474));_0x344a84(_0x421474);})['catch'](function(_0x13633c){logger[_0x093e('0xf')](_0x093e('0x1c'),_0x13633c['message'],_0x1491d9);_0xc288ec(_0x3163c4[_0x093e('0xf')](0x1f4,_0x13633c[_0x093e('0x11')]));});});}; \ No newline at end of file +var _0x3dfe=['options','raw','where','attributes','include','map','model','ShowServicenowAccount','then','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetServicenowAccount','ServicenowAccount','findAll'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3dfe,0xcf));var _0xe3df=function(_0x589ef2,_0x29d561){_0x589ef2=_0x589ef2-0x0;var _0x6d737e=_0x3dfe[_0x589ef2];return _0x6d737e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe3df('0x0'));var rs=require(_0xe3df('0x1'));var fs=require('fs');var Redis=require(_0xe3df('0x2'));var db=require(_0xe3df('0x3'))['db'];var utils=require(_0xe3df('0x4'));var logger=require(_0xe3df('0x5'))(_0xe3df('0x6'));var config=require(_0xe3df('0x7'));var jayson=require(_0xe3df('0x8'));var client=jayson[_0xe3df('0x9')][_0xe3df('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x216880,_0xffcf20,_0x451068){return new BPromise(function(_0x386dcd,_0x4c1da1){return client[_0xe3df('0xb')](_0x216880,_0x451068)['then'](function(_0x2ac2b7){logger['info'](_0xe3df('0xc'),_0xffcf20,_0xe3df('0xd'));logger[_0xe3df('0xe')](_0xe3df('0xf'),_0xffcf20,_0xe3df('0xd'),JSON[_0xe3df('0x10')](_0x2ac2b7));if(_0x2ac2b7[_0xe3df('0x11')]){if(_0x2ac2b7[_0xe3df('0x11')]['code']===0x1f4){logger['error'](_0xe3df('0xc'),_0xffcf20,_0x2ac2b7[_0xe3df('0x11')][_0xe3df('0x12')]);return _0x4c1da1(_0x2ac2b7[_0xe3df('0x11')][_0xe3df('0x12')]);}logger[_0xe3df('0x11')](_0xe3df('0xc'),_0xffcf20,_0x2ac2b7[_0xe3df('0x11')][_0xe3df('0x12')]);return _0x386dcd(_0x2ac2b7[_0xe3df('0x11')]['message']);}else{logger[_0xe3df('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0xffcf20,_0xe3df('0xd'));_0x386dcd(_0x2ac2b7['result'][_0xe3df('0x12')]);}})[_0xe3df('0x14')](function(_0x279ccc){logger[_0xe3df('0x11')](_0xe3df('0xc'),_0xffcf20,_0x279ccc);_0x4c1da1(_0x279ccc);});});}exports[_0xe3df('0x15')]=function(_0x1421bd){var _0x44b7c2=this;return new Promise(function(_0x22caf1,_0x327d1b){return db[_0xe3df('0x16')][_0xe3df('0x17')]({'raw':_0x1421bd['options']?_0x1421bd[_0xe3df('0x18')][_0xe3df('0x19')]===undefined?!![]:![]:!![],'where':_0x1421bd[_0xe3df('0x18')]?_0x1421bd[_0xe3df('0x18')][_0xe3df('0x1a')]||null:null,'attributes':_0x1421bd[_0xe3df('0x18')]?_0x1421bd[_0xe3df('0x18')][_0xe3df('0x1b')]||null:null,'limit':_0x1421bd[_0xe3df('0x18')]?_0x1421bd[_0xe3df('0x18')]['limit']||null:null,'include':_0x1421bd['options']?_0x1421bd[_0xe3df('0x18')][_0xe3df('0x1c')]?_[_0xe3df('0x1d')](_0x1421bd[_0xe3df('0x18')][_0xe3df('0x1c')],function(_0x440eec){return{'model':db[_0x440eec[_0xe3df('0x1e')]],'as':_0x440eec['as'],'attributes':_0x440eec[_0xe3df('0x1b')],'include':_0x440eec[_0xe3df('0x1c')]?_[_0xe3df('0x1d')](_0x440eec['include'],function(_0x28286d){return{'model':db[_0x28286d[_0xe3df('0x1e')]],'as':_0x28286d['as'],'attributes':_0x28286d[_0xe3df('0x1b')],'include':_0x28286d[_0xe3df('0x1c')]?_['map'](_0x28286d[_0xe3df('0x1c')],function(_0x242482){return{'model':db[_0x242482['model']],'as':_0x242482['as'],'attributes':_0x242482[_0xe3df('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2380f0){logger[_0xe3df('0x13')](_0xe3df('0x15'),_0x1421bd);logger[_0xe3df('0xe')](_0xe3df('0x15'),_0x1421bd,JSON[_0xe3df('0x10')](_0x2380f0));_0x22caf1(_0x2380f0);})['catch'](function(_0x1d545f){logger[_0xe3df('0x11')](_0xe3df('0x15'),_0x1d545f[_0xe3df('0x12')],_0x1421bd);_0x327d1b(_0x44b7c2['error'](0x1f4,_0x1d545f[_0xe3df('0x12')]));});});};exports[_0xe3df('0x1f')]=function(_0x23d2b4){var _0x4eb658=this;return new Promise(function(_0x1c6c2e,_0x3fe2da){return db[_0xe3df('0x16')]['find']({'raw':_0x23d2b4[_0xe3df('0x18')]?_0x23d2b4[_0xe3df('0x18')][_0xe3df('0x19')]===undefined?!![]:![]:!![],'where':_0x23d2b4[_0xe3df('0x18')]?_0x23d2b4[_0xe3df('0x18')][_0xe3df('0x1a')]||null:null,'attributes':_0x23d2b4[_0xe3df('0x18')]?_0x23d2b4['options'][_0xe3df('0x1b')]||null:null,'include':_0x23d2b4[_0xe3df('0x18')]?_0x23d2b4['options']['include']?_[_0xe3df('0x1d')](_0x23d2b4[_0xe3df('0x18')][_0xe3df('0x1c')],function(_0x1c19a1){return{'model':db[_0x1c19a1['model']],'as':_0x1c19a1['as'],'attributes':_0x1c19a1['attributes'],'include':_0x1c19a1[_0xe3df('0x1c')]?_['map'](_0x1c19a1[_0xe3df('0x1c')],function(_0x1763c0){return{'model':db[_0x1763c0[_0xe3df('0x1e')]],'as':_0x1763c0['as'],'attributes':_0x1763c0[_0xe3df('0x1b')],'include':_0x1763c0['include']?_[_0xe3df('0x1d')](_0x1763c0[_0xe3df('0x1c')],function(_0x30e206){return{'model':db[_0x30e206[_0xe3df('0x1e')]],'as':_0x30e206['as'],'attributes':_0x30e206[_0xe3df('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe3df('0x20')](function(_0x40bff2){logger[_0xe3df('0x13')]('ShowServicenowAccount',_0x23d2b4);logger['debug'](_0xe3df('0x1f'),_0x23d2b4,JSON[_0xe3df('0x10')](_0x40bff2));_0x1c6c2e(_0x40bff2);})[_0xe3df('0x14')](function(_0x5a2416){logger['error']('ShowServicenowAccount',_0x5a2416['message'],_0x23d2b4);_0x3fe2da(_0x4eb658[_0xe3df('0x11')](0x1f4,_0x5a2416[_0xe3df('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 203df55..69a783f 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 _0xc578=['getDescriptions','post','create','put','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','getFields','/:id/subjects','getSubjects'];(function(_0x39790f,_0x4009ec){var _0x10c304=function(_0x334c49){while(--_0x334c49){_0x39790f['push'](_0x39790f['shift']());}};_0x10c304(++_0x4009ec);}(_0xc578,0xfc));var _0x8c57=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xc578[_0x525c7b];return _0x27b33e;};'use strict';var multer=require(_0x8c57('0x0'));var util=require(_0x8c57('0x1'));var path=require(_0x8c57('0x2'));var timeout=require(_0x8c57('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x8c57('0x4'));var interaction=require(_0x8c57('0x5'));var config=require('../../config/environment');var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth[_0x8c57('0x6')](),controller[_0x8c57('0x7')]);router[_0x8c57('0x8')](_0x8c57('0x9'),auth[_0x8c57('0x6')](),controller[_0x8c57('0xa')]);router[_0x8c57('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x8c57('0xb')]);router['get'](_0x8c57('0xc'),auth[_0x8c57('0x6')](),controller[_0x8c57('0xd')]);router[_0x8c57('0x8')]('/:id/descriptions',auth[_0x8c57('0x6')](),controller[_0x8c57('0xe')]);router[_0x8c57('0xf')]('/',auth['isAuthenticated'](),controller[_0x8c57('0x10')]);router[_0x8c57('0x11')](_0x8c57('0x9'),auth[_0x8c57('0x6')](),controller['update']);router['delete'](_0x8c57('0x9'),auth[_0x8c57('0x6')](),controller[_0x8c57('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf533=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x196c58,_0x20c900){var _0x3cdd76=function(_0x11f52f){while(--_0x11f52f){_0x196c58['push'](_0x196c58['shift']());}};_0x3cdd76(++_0x20c900);}(_0xf533,0x199));var _0x3f53=function(_0x2e2681,_0x4089c1){_0x2e2681=_0x2e2681-0x0;var _0x368a64=_0xf533[_0x2e2681];return _0x368a64;};'use strict';var multer=require('multer');var util=require(_0x3f53('0x0'));var path=require(_0x3f53('0x1'));var timeout=require(_0x3f53('0x2'));var express=require(_0x3f53('0x3'));var router=express[_0x3f53('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3f53('0x5'));var config=require('../../config/environment');var controller=require(_0x3f53('0x6'));router[_0x3f53('0x7')]('/',auth[_0x3f53('0x8')](),controller[_0x3f53('0x9')]);router[_0x3f53('0x7')](_0x3f53('0xa'),auth[_0x3f53('0x8')](),controller[_0x3f53('0xb')]);router[_0x3f53('0x7')](_0x3f53('0xc'),auth[_0x3f53('0x8')](),controller[_0x3f53('0xd')]);router[_0x3f53('0x7')](_0x3f53('0xe'),auth['isAuthenticated'](),controller[_0x3f53('0xf')]);router[_0x3f53('0x7')](_0x3f53('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x3f53('0x11')]('/',auth[_0x3f53('0x8')](),controller['create']);router[_0x3f53('0x12')](_0x3f53('0xa'),auth['isAuthenticated'](),controller[_0x3f53('0x13')]);router['delete'](_0x3f53('0xa'),auth[_0x3f53('0x8')](),controller['destroy']);module[_0x3f53('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index fd473a8..d14d089 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 _0xfcf0=['STRING','exports'];(function(_0x5dcf7d,_0x57faa1){var _0xfc7f6e=function(_0x550622){while(--_0x550622){_0x5dcf7d['push'](_0x5dcf7d['shift']());}};_0xfc7f6e(++_0x57faa1);}(_0xfcf0,0x18d));var _0x0fcf=function(_0x458363,_0x1675db){_0x458363=_0x458363-0x0;var _0x4d0290=_0xfcf0[_0x458363];return _0x4d0290;};'use strict';var Sequelize=require('sequelize');module[_0x0fcf('0x0')]={'name':{'type':Sequelize[_0x0fcf('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x65db=['sequelize','exports','STRING'];(function(_0x1ebf61,_0x34c145){var _0x49c44e=function(_0x958300){while(--_0x958300){_0x1ebf61['push'](_0x1ebf61['shift']());}};_0x49c44e(++_0x34c145);}(_0x65db,0x141));var _0xb65d=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x65db[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require(_0xb65d('0x0'));module[_0xb65d('0x1')]={'name':{'type':Sequelize[_0xb65d('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 9499e39..0e69cea 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 _0x9348=['to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','debug','request\x20sent','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','count','offset','set','json','apply','reject','save','destroy','end','name','index','map','ServicenowConfiguration','rawAttributes','type','key','query','keys','attributes','intersection','fields','model','hasOwnProperty','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','length','options','find','create','body','update','getFields','findOne','nolimit','getSubjects','getDescriptions','ServicenowField','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox'];(function(_0x5bf3c8,_0x5c268b){var _0xf2a998=function(_0x24243d){while(--_0x24243d){_0x5bf3c8['push'](_0x5bf3c8['shift']());}};_0xf2a998(++_0x5c268b);}(_0x9348,0x10d));var _0x8934=function(_0x375492,_0x4ed149){_0x375492=_0x375492-0x0;var _0x18ba5b=_0x9348[_0x375492];return _0x18ba5b;};'use strict';var pdf=require(_0x8934('0x0'));var emlformat=require(_0x8934('0x1'));var rimraf=require(_0x8934('0x2'));var zipdir=require(_0x8934('0x3'));var jsonpatch=require(_0x8934('0x4'));var rp=require('request-promise');var moment=require(_0x8934('0x5'));var BPromise=require(_0x8934('0x6'));var Mustache=require('mustache');var util=require(_0x8934('0x7'));var path=require(_0x8934('0x8'));var sox=require(_0x8934('0x9'));var csv=require(_0x8934('0xa'));var ejs=require(_0x8934('0xb'));var fs=require('fs');var _=require(_0x8934('0xc'));var squel=require('squel');var crypto=require(_0x8934('0xd'));var jsforce=require(_0x8934('0xe'));var deskjs=require(_0x8934('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8934('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8934('0x11'));var hardwareService=require(_0x8934('0x12'));var logger=require(_0x8934('0x13'))(_0x8934('0x14'));var utils=require(_0x8934('0x15'));var config=require(_0x8934('0x16'));var db=require(_0x8934('0x17'))['db'];var jayson=require(_0x8934('0x18'));var client=jayson['client'][_0x8934('0x19')]({'port':0x232a});function checkPasswordPattern(_0x108eab,_0x46bca5,_0x1906d0){if(_0x1906d0){var _0xbc487e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xbc487e[_0x8934('0x1a')](_0x46bca5)){return _0x108eab;}else{throw new db['Sequelize'][(_0x8934('0x1b'))](_0x8934('0x1c'));}}else{return _0x108eab;}}function respondWithRpcPromise(_0xdfc97c,_0x94b948,_0x34d4dc,_0x41e6a9){return new BPromise(function(_0x2a5b04,_0x357cf8){var _0x52de6a=_0x41e6a9||client;return _0x52de6a[_0x8934('0x1d')](_0xdfc97c,_0x34d4dc)[_0x8934('0x1e')](function(_0x261c78){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x94b948,'request\x20sent');logger[_0x8934('0x1f')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x94b948,_0x8934('0x20'),JSON[_0x8934('0x21')](_0x261c78));if(_0x261c78[_0x8934('0x22')]){if(_0x261c78[_0x8934('0x22')][_0x8934('0x23')]===0x1f4){logger['error'](_0x8934('0x24'),_0x94b948,_0x261c78['error'][_0x8934('0x25')]);return _0x357cf8(_0x261c78[_0x8934('0x22')][_0x8934('0x25')]);}logger[_0x8934('0x22')](_0x8934('0x24'),_0x94b948,_0x261c78[_0x8934('0x22')][_0x8934('0x25')]);return _0x2a5b04(_0x261c78['error'][_0x8934('0x25')]);}else{logger[_0x8934('0x26')](_0x8934('0x24'),_0x94b948,_0x8934('0x20'));_0x2a5b04(_0x261c78[_0x8934('0x27')]['message']);}})[_0x8934('0x28')](function(_0x1c15c5){logger[_0x8934('0x22')]('ServicenowConfiguration,\x20%s,\x20%s',_0x94b948,_0x1c15c5);_0x357cf8(_0x1c15c5);});});}function respondWithStatusCode(_0x16cfc2,_0x561df2){_0x561df2=_0x561df2||0xcc;return function(_0x14c5f0){if(_0x14c5f0){return _0x16cfc2[_0x8934('0x29')](_0x561df2);}return _0x16cfc2[_0x8934('0x2a')](_0x561df2)['end']();};}function respondWithResult(_0x1fd5eb,_0x15910b){_0x15910b=_0x15910b||0xc8;return function(_0x310454){if(_0x310454){return _0x1fd5eb[_0x8934('0x2a')](_0x15910b)['json'](_0x310454);}};}function respondWithFilteredResult(_0x3db790,_0x249031){return function(_0x358445){if(_0x358445){var _0x3d93c7=_0x358445[_0x8934('0x2b')],_0x44972b=_0x249031[_0x8934('0x2c')],_0x20d448=_0x249031[_0x8934('0x2c')]+_0x249031['limit'],_0x3f328a;if(_0x20d448>=_0x3d93c7){_0x20d448=_0x3d93c7;_0x3f328a=0xc8;}else{_0x3f328a=0xce;}_0x3db790[_0x8934('0x2a')](_0x3f328a);return _0x3db790[_0x8934('0x2d')]('Content-Range',_0x44972b+'-'+_0x20d448+'/'+_0x3d93c7)[_0x8934('0x2e')](_0x358445);}return null;};}function patchUpdates(_0x3d60f9){return function(_0x1a17b5){try{jsonpatch[_0x8934('0x2f')](_0x1a17b5,_0x3d60f9,!![]);}catch(_0x4b3cb9){return BPromise[_0x8934('0x30')](_0x4b3cb9);}return _0x1a17b5[_0x8934('0x31')]();};}function saveUpdates(_0x11844a,_0x1af54b){return function(_0x382d81){if(_0x382d81){return _0x382d81['update'](_0x11844a)[_0x8934('0x1e')](function(_0x59a6bf){return _0x59a6bf;});}return null;};}function removeEntity(_0x5559f1,_0xff95be){return function(_0x2447e6){if(_0x2447e6){return _0x2447e6[_0x8934('0x32')]()[_0x8934('0x1e')](function(){_0x5559f1['status'](0xcc)[_0x8934('0x33')]();});}};}function handleEntityNotFound(_0x22aebe,_0x380d47){return function(_0x1439ef){if(!_0x1439ef){_0x22aebe[_0x8934('0x29')](0x194);}return _0x1439ef;};}function handleError(_0x4cd282,_0x6764f8){_0x6764f8=_0x6764f8||0x1f4;return function(_0x1ea0cd){logger['error'](_0x1ea0cd['stack']);if(_0x1ea0cd[_0x8934('0x34')]){delete _0x1ea0cd[_0x8934('0x34')];}_0x4cd282['status'](_0x6764f8)['send'](_0x1ea0cd);};}exports[_0x8934('0x35')]=function(_0x177a57,_0x2f710a){var _0x207ad4={},_0x834d54={},_0x1c624f={'count':0x0,'rows':[]};var _0x30f8c6=_[_0x8934('0x36')](db[_0x8934('0x37')][_0x8934('0x38')],function(_0x46611c){return{'name':_0x46611c['fieldName'],'type':_0x46611c[_0x8934('0x39')][_0x8934('0x3a')]};});_0x834d54['model']=_[_0x8934('0x36')](_0x30f8c6,_0x8934('0x34'));_0x834d54[_0x8934('0x3b')]=_[_0x8934('0x3c')](_0x177a57[_0x8934('0x3b')]);_0x834d54['filters']=_['intersection'](_0x834d54['model'],_0x834d54[_0x8934('0x3b')]);_0x207ad4[_0x8934('0x3d')]=_[_0x8934('0x3e')](_0x834d54['model'],qs[_0x8934('0x3f')](_0x177a57['query']['fields']));_0x207ad4[_0x8934('0x3d')]=_0x207ad4[_0x8934('0x3d')]['length']?_0x207ad4['attributes']:_0x834d54[_0x8934('0x40')];if(!_0x177a57[_0x8934('0x3b')][_0x8934('0x41')]('nolimit')){_0x207ad4[_0x8934('0x42')]=qs['limit'](_0x177a57[_0x8934('0x3b')]['limit']);_0x207ad4[_0x8934('0x2c')]=qs[_0x8934('0x2c')](_0x177a57[_0x8934('0x3b')]['offset']);}_0x207ad4[_0x8934('0x43')]=qs[_0x8934('0x44')](_0x177a57[_0x8934('0x3b')][_0x8934('0x44')]);_0x207ad4['where']=qs[_0x8934('0x45')](_[_0x8934('0x46')](_0x177a57[_0x8934('0x3b')],_0x834d54[_0x8934('0x45')]),_0x30f8c6);if(_0x177a57[_0x8934('0x3b')][_0x8934('0x47')]){_0x207ad4[_0x8934('0x48')]=_[_0x8934('0x49')](_0x207ad4['where'],{'$or':_['map'](_0x30f8c6,function(_0x510152){if(_0x510152[_0x8934('0x39')]!==_0x8934('0x4a')){var _0x58206c={};_0x58206c[_0x510152[_0x8934('0x34')]]={'$like':'%'+_0x177a57['query'][_0x8934('0x47')]+'%'};return _0x58206c;}})});}_0x207ad4=_[_0x8934('0x49')]({},_0x207ad4,_0x177a57['options']);var _0x3561da={'where':_0x207ad4[_0x8934('0x48')]};return db[_0x8934('0x37')][_0x8934('0x2b')](_0x3561da)['then'](function(_0x2adb63){_0x1c624f[_0x8934('0x2b')]=_0x2adb63;if(_0x177a57['query'][_0x8934('0x4b')]){_0x207ad4[_0x8934('0x4c')]=[{'all':!![]}];}return db[_0x8934('0x37')][_0x8934('0x4d')](_0x207ad4);})[_0x8934('0x1e')](function(_0x419e30){_0x1c624f[_0x8934('0x4e')]=_0x419e30;return _0x1c624f;})[_0x8934('0x1e')](respondWithFilteredResult(_0x2f710a,_0x207ad4))[_0x8934('0x28')](handleError(_0x2f710a,null));};exports[_0x8934('0x4f')]=function(_0x1e2175,_0xe212bc){var _0x2c322d={'raw':![],'where':{'id':_0x1e2175[_0x8934('0x50')]['id']}},_0x2febf5={};_0x2febf5[_0x8934('0x40')]=_[_0x8934('0x3c')](db[_0x8934('0x37')]['rawAttributes']);_0x2febf5[_0x8934('0x3b')]=_[_0x8934('0x3c')](_0x1e2175['query']);_0x2febf5['filters']=_['intersection'](_0x2febf5['model'],_0x2febf5[_0x8934('0x3b')]);_0x2c322d[_0x8934('0x3d')]=_[_0x8934('0x3e')](_0x2febf5['model'],qs['fields'](_0x1e2175[_0x8934('0x3b')]['fields']));_0x2c322d['attributes']=_0x2c322d[_0x8934('0x3d')][_0x8934('0x51')]?_0x2c322d[_0x8934('0x3d')]:_0x2febf5[_0x8934('0x40')];if(_0x1e2175[_0x8934('0x3b')][_0x8934('0x4b')]){_0x2c322d[_0x8934('0x4c')]=[{'all':!![]}];}_0x2c322d=_['merge']({},_0x2c322d,_0x1e2175[_0x8934('0x52')]);return db['ServicenowConfiguration'][_0x8934('0x53')](_0x2c322d)[_0x8934('0x1e')](handleEntityNotFound(_0xe212bc,null))[_0x8934('0x1e')](respondWithResult(_0xe212bc,null))[_0x8934('0x28')](handleError(_0xe212bc,null));};exports[_0x8934('0x54')]=function(_0x265b0a,_0x1f6c5f){return db[_0x8934('0x37')]['create'](_0x265b0a[_0x8934('0x55')],{})[_0x8934('0x1e')](respondWithResult(_0x1f6c5f,0xc9))[_0x8934('0x28')](handleError(_0x1f6c5f,null));};exports[_0x8934('0x56')]=function(_0x2ab06d,_0x5a791a){if(_0x2ab06d[_0x8934('0x55')]['id']){delete _0x2ab06d[_0x8934('0x55')]['id'];}return db[_0x8934('0x37')]['find']({'where':{'id':_0x2ab06d[_0x8934('0x50')]['id']}})[_0x8934('0x1e')](handleEntityNotFound(_0x5a791a,null))[_0x8934('0x1e')](saveUpdates(_0x2ab06d['body'],null))['then'](respondWithResult(_0x5a791a,null))['catch'](handleError(_0x5a791a,null));};exports[_0x8934('0x32')]=function(_0x8e3e85,_0x3aab00){return db['ServicenowConfiguration'][_0x8934('0x53')]({'where':{'id':_0x8e3e85[_0x8934('0x50')]['id']}})['then'](handleEntityNotFound(_0x3aab00,null))['then'](removeEntity(_0x3aab00,null))[_0x8934('0x28')](handleError(_0x3aab00,null));};exports[_0x8934('0x57')]=function(_0x44d892,_0xb9e4ac,_0x4bcf77){var _0x4d2e41={};var _0x4ea19e={};var _0x4a9089;var _0x43933f;return db[_0x8934('0x37')][_0x8934('0x58')]({'where':{'id':_0x44d892[_0x8934('0x50')]['id']}})[_0x8934('0x1e')](handleEntityNotFound(_0xb9e4ac,null))[_0x8934('0x1e')](function(_0x5a487e){if(_0x5a487e){_0x4a9089=_0x5a487e;_0x4ea19e[_0x8934('0x40')]=_[_0x8934('0x3c')](db['ServicenowField'][_0x8934('0x38')]);_0x4ea19e['query']=_[_0x8934('0x3c')](_0x44d892['query']);_0x4ea19e[_0x8934('0x45')]=_[_0x8934('0x3e')](_0x4ea19e[_0x8934('0x40')],_0x4ea19e[_0x8934('0x3b')]);_0x4d2e41[_0x8934('0x3d')]=_[_0x8934('0x3e')](_0x4ea19e[_0x8934('0x40')],qs['fields'](_0x44d892['query'][_0x8934('0x3f')]));_0x4d2e41[_0x8934('0x3d')]=_0x4d2e41[_0x8934('0x3d')][_0x8934('0x51')]?_0x4d2e41[_0x8934('0x3d')]:_0x4ea19e[_0x8934('0x40')];_0x4d2e41[_0x8934('0x43')]=qs[_0x8934('0x44')](_0x44d892[_0x8934('0x3b')][_0x8934('0x44')]);_0x4d2e41[_0x8934('0x48')]=qs[_0x8934('0x45')](_[_0x8934('0x46')](_0x44d892[_0x8934('0x3b')],_0x4ea19e['filters']));if(_0x44d892['query'][_0x8934('0x47')]){_0x4d2e41[_0x8934('0x48')]=_[_0x8934('0x49')](_0x4d2e41[_0x8934('0x48')],{'$or':_[_0x8934('0x36')](_0x4d2e41[_0x8934('0x3d')],function(_0x2f8318){var _0x5ed8ff={};_0x5ed8ff[_0x2f8318]={'$like':'%'+_0x44d892[_0x8934('0x3b')][_0x8934('0x47')]+'%'};return _0x5ed8ff;})});}_0x4d2e41=_['merge']({},_0x4d2e41,_0x44d892[_0x8934('0x52')]);return _0x4a9089['getFields'](_0x4d2e41);}})[_0x8934('0x1e')](function(_0x301967){if(_0x301967){_0x43933f=_0x301967[_0x8934('0x51')];if(!_0x44d892['query'][_0x8934('0x41')](_0x8934('0x59'))){_0x4d2e41['limit']=qs[_0x8934('0x42')](_0x44d892['query'][_0x8934('0x42')]);_0x4d2e41['offset']=qs[_0x8934('0x2c')](_0x44d892[_0x8934('0x3b')][_0x8934('0x2c')]);}return _0x4a9089['getFields'](_0x4d2e41);}})[_0x8934('0x1e')](function(_0xfbad9){if(_0xfbad9){return _0xfbad9?{'count':_0x43933f,'rows':_0xfbad9}:null;}})[_0x8934('0x1e')](respondWithResult(_0xb9e4ac,null))[_0x8934('0x28')](handleError(_0xb9e4ac,null));};exports['getSubjects']=function(_0x378e28,_0x4af42b,_0x10f552){var _0x2571ea={};var _0x14992b={};var _0x18afaa;var _0x5880d0;return db[_0x8934('0x37')][_0x8934('0x58')]({'where':{'id':_0x378e28[_0x8934('0x50')]['id']}})['then'](handleEntityNotFound(_0x4af42b,null))[_0x8934('0x1e')](function(_0xa869e8){if(_0xa869e8){_0x18afaa=_0xa869e8;_0x14992b[_0x8934('0x40')]=_['keys'](db['ServicenowField'][_0x8934('0x38')]);_0x14992b[_0x8934('0x3b')]=_[_0x8934('0x3c')](_0x378e28[_0x8934('0x3b')]);_0x14992b[_0x8934('0x45')]=_[_0x8934('0x3e')](_0x14992b[_0x8934('0x40')],_0x14992b[_0x8934('0x3b')]);_0x2571ea[_0x8934('0x3d')]=_['intersection'](_0x14992b[_0x8934('0x40')],qs[_0x8934('0x3f')](_0x378e28[_0x8934('0x3b')][_0x8934('0x3f')]));_0x2571ea[_0x8934('0x3d')]=_0x2571ea['attributes'][_0x8934('0x51')]?_0x2571ea[_0x8934('0x3d')]:_0x14992b['model'];_0x2571ea[_0x8934('0x43')]=qs['sort'](_0x378e28['query']['sort']);_0x2571ea[_0x8934('0x48')]=qs[_0x8934('0x45')](_[_0x8934('0x46')](_0x378e28['query'],_0x14992b[_0x8934('0x45')]));if(_0x378e28[_0x8934('0x3b')]['filter']){_0x2571ea[_0x8934('0x48')]=_[_0x8934('0x49')](_0x2571ea[_0x8934('0x48')],{'$or':_[_0x8934('0x36')](_0x2571ea[_0x8934('0x3d')],function(_0x324722){var _0x293bb8={};_0x293bb8[_0x324722]={'$like':'%'+_0x378e28[_0x8934('0x3b')][_0x8934('0x47')]+'%'};return _0x293bb8;})});}_0x2571ea=_[_0x8934('0x49')]({},_0x2571ea,_0x378e28['options']);return _0x18afaa[_0x8934('0x5a')](_0x2571ea);}})[_0x8934('0x1e')](function(_0xe9991f){if(_0xe9991f){_0x5880d0=_0xe9991f[_0x8934('0x51')];if(!_0x378e28[_0x8934('0x3b')][_0x8934('0x41')](_0x8934('0x59'))){_0x2571ea['limit']=qs[_0x8934('0x42')](_0x378e28[_0x8934('0x3b')][_0x8934('0x42')]);_0x2571ea[_0x8934('0x2c')]=qs[_0x8934('0x2c')](_0x378e28[_0x8934('0x3b')][_0x8934('0x2c')]);}return _0x18afaa[_0x8934('0x5a')](_0x2571ea);}})[_0x8934('0x1e')](function(_0x52b25e){if(_0x52b25e){return _0x52b25e?{'count':_0x5880d0,'rows':_0x52b25e}:null;}})['then'](respondWithResult(_0x4af42b,null))[_0x8934('0x28')](handleError(_0x4af42b,null));};exports[_0x8934('0x5b')]=function(_0x4faab2,_0x2becdf,_0x258bac){var _0x1ff259={};var _0xba3619={};var _0x25c4ac;var _0x1894ff;return db[_0x8934('0x37')][_0x8934('0x58')]({'where':{'id':_0x4faab2[_0x8934('0x50')]['id']}})[_0x8934('0x1e')](handleEntityNotFound(_0x2becdf,null))[_0x8934('0x1e')](function(_0x556b70){if(_0x556b70){_0x25c4ac=_0x556b70;_0xba3619[_0x8934('0x40')]=_[_0x8934('0x3c')](db[_0x8934('0x5c')]['rawAttributes']);_0xba3619[_0x8934('0x3b')]=_['keys'](_0x4faab2[_0x8934('0x3b')]);_0xba3619[_0x8934('0x45')]=_[_0x8934('0x3e')](_0xba3619[_0x8934('0x40')],_0xba3619['query']);_0x1ff259['attributes']=_[_0x8934('0x3e')](_0xba3619['model'],qs[_0x8934('0x3f')](_0x4faab2[_0x8934('0x3b')][_0x8934('0x3f')]));_0x1ff259[_0x8934('0x3d')]=_0x1ff259['attributes'][_0x8934('0x51')]?_0x1ff259['attributes']:_0xba3619['model'];_0x1ff259['order']=qs['sort'](_0x4faab2[_0x8934('0x3b')][_0x8934('0x44')]);_0x1ff259[_0x8934('0x48')]=qs[_0x8934('0x45')](_[_0x8934('0x46')](_0x4faab2['query'],_0xba3619['filters']));if(_0x4faab2[_0x8934('0x3b')][_0x8934('0x47')]){_0x1ff259[_0x8934('0x48')]=_[_0x8934('0x49')](_0x1ff259[_0x8934('0x48')],{'$or':_[_0x8934('0x36')](_0x1ff259[_0x8934('0x3d')],function(_0x2839dd){var _0x261887={};_0x261887[_0x2839dd]={'$like':'%'+_0x4faab2[_0x8934('0x3b')][_0x8934('0x47')]+'%'};return _0x261887;})});}_0x1ff259=_[_0x8934('0x49')]({},_0x1ff259,_0x4faab2[_0x8934('0x52')]);return _0x25c4ac[_0x8934('0x5b')](_0x1ff259);}})[_0x8934('0x1e')](function(_0x40a47a){if(_0x40a47a){_0x1894ff=_0x40a47a['length'];if(!_0x4faab2['query'][_0x8934('0x41')](_0x8934('0x59'))){_0x1ff259['limit']=qs[_0x8934('0x42')](_0x4faab2[_0x8934('0x3b')][_0x8934('0x42')]);_0x1ff259[_0x8934('0x2c')]=qs[_0x8934('0x2c')](_0x4faab2[_0x8934('0x3b')][_0x8934('0x2c')]);}return _0x25c4ac['getDescriptions'](_0x1ff259);}})[_0x8934('0x1e')](function(_0x5aab65){if(_0x5aab65){return _0x5aab65?{'count':_0x1894ff,'rows':_0x5aab65}:null;}})[_0x8934('0x1e')](respondWithResult(_0x2becdf,null))[_0x8934('0x28')](handleError(_0x2becdf,null));}; \ No newline at end of file +var _0xbdb7=['offset','limit','set','Content-Range','reject','save','then','destroy','stack','name','send','map','ServicenowConfiguration','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','keys','ServicenowField','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','jayson/promise','client','test','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','status','end','json','count'];(function(_0x342193,_0x5711e0){var _0xae94f4=function(_0x23d8ac){while(--_0x23d8ac){_0x342193['push'](_0x342193['shift']());}};_0xae94f4(++_0x5711e0);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x2f8530,_0x5cbd67){_0x2f8530=_0x2f8530-0x0;var _0x5e814e=_0xbdb7[_0x2f8530];return _0x5e814e;};'use strict';var pdf=require(_0x7bdb('0x0'));var emlformat=require(_0x7bdb('0x1'));var rimraf=require(_0x7bdb('0x2'));var zipdir=require(_0x7bdb('0x3'));var jsonpatch=require(_0x7bdb('0x4'));var rp=require(_0x7bdb('0x5'));var moment=require(_0x7bdb('0x6'));var BPromise=require(_0x7bdb('0x7'));var Mustache=require(_0x7bdb('0x8'));var util=require('util');var path=require(_0x7bdb('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7bdb('0xa'));var fs=require('fs');var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x7bdb('0x16'));var client=jayson[_0x7bdb('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x8d74ff,_0x53021d,_0x5898c1){if(_0x5898c1){var _0x2abca6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2abca6[_0x7bdb('0x18')](_0x53021d)){return _0x8d74ff;}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 _0x8d74ff;}}function respondWithRpcPromise(_0x4476ff,_0x195b2e,_0xe9919f,_0x25d417){return new BPromise(function(_0x31c909,_0xbde12a){var _0x3e96ac=_0x25d417||client;return _0x3e96ac[_0x7bdb('0x19')](_0x4476ff,_0xe9919f)['then'](function(_0x1c5750){logger[_0x7bdb('0x1a')](_0x7bdb('0x1b'),_0x195b2e,_0x7bdb('0x1c'));logger['debug'](_0x7bdb('0x1d'),_0x195b2e,_0x7bdb('0x1c'),JSON['stringify'](_0x1c5750));if(_0x1c5750[_0x7bdb('0x1e')]){if(_0x1c5750[_0x7bdb('0x1e')][_0x7bdb('0x1f')]===0x1f4){logger[_0x7bdb('0x1e')](_0x7bdb('0x1b'),_0x195b2e,_0x1c5750['error']['message']);return _0xbde12a(_0x1c5750[_0x7bdb('0x1e')][_0x7bdb('0x20')]);}logger['error'](_0x7bdb('0x1b'),_0x195b2e,_0x1c5750[_0x7bdb('0x1e')][_0x7bdb('0x20')]);return _0x31c909(_0x1c5750[_0x7bdb('0x1e')][_0x7bdb('0x20')]);}else{logger['info'](_0x7bdb('0x1b'),_0x195b2e,_0x7bdb('0x1c'));_0x31c909(_0x1c5750[_0x7bdb('0x21')][_0x7bdb('0x20')]);}})['catch'](function(_0x4d6e44){logger[_0x7bdb('0x1e')]('ServicenowConfiguration,\x20%s,\x20%s',_0x195b2e,_0x4d6e44);_0xbde12a(_0x4d6e44);});});}function respondWithStatusCode(_0x47abaf,_0x4a9e02){_0x4a9e02=_0x4a9e02||0xcc;return function(_0x2abef6){if(_0x2abef6){return _0x47abaf['sendStatus'](_0x4a9e02);}return _0x47abaf[_0x7bdb('0x22')](_0x4a9e02)[_0x7bdb('0x23')]();};}function respondWithResult(_0x3ec129,_0x7c09cf){_0x7c09cf=_0x7c09cf||0xc8;return function(_0x2a494e){if(_0x2a494e){return _0x3ec129['status'](_0x7c09cf)[_0x7bdb('0x24')](_0x2a494e);}};}function respondWithFilteredResult(_0x32242d,_0x399b62){return function(_0xe1141d){if(_0xe1141d){var _0x371e8a=_0xe1141d[_0x7bdb('0x25')],_0x2e8e65=_0x399b62[_0x7bdb('0x26')],_0x1e9996=_0x399b62[_0x7bdb('0x26')]+_0x399b62[_0x7bdb('0x27')],_0xd2d7be;if(_0x1e9996>=_0x371e8a){_0x1e9996=_0x371e8a;_0xd2d7be=0xc8;}else{_0xd2d7be=0xce;}_0x32242d['status'](_0xd2d7be);return _0x32242d[_0x7bdb('0x28')](_0x7bdb('0x29'),_0x2e8e65+'-'+_0x1e9996+'/'+_0x371e8a)[_0x7bdb('0x24')](_0xe1141d);}return null;};}function patchUpdates(_0x9f5c1){return function(_0x29eac5){try{jsonpatch['apply'](_0x29eac5,_0x9f5c1,!![]);}catch(_0x28aa2f){return BPromise[_0x7bdb('0x2a')](_0x28aa2f);}return _0x29eac5[_0x7bdb('0x2b')]();};}function saveUpdates(_0x103585,_0x58c6b7){return function(_0x4f43b9){if(_0x4f43b9){return _0x4f43b9['update'](_0x103585)[_0x7bdb('0x2c')](function(_0x56def2){return _0x56def2;});}return null;};}function removeEntity(_0x2058e1,_0x4cfb77){return function(_0x23e5b2){if(_0x23e5b2){return _0x23e5b2[_0x7bdb('0x2d')]()[_0x7bdb('0x2c')](function(){_0x2058e1['status'](0xcc)[_0x7bdb('0x23')]();});}};}function handleEntityNotFound(_0x514713,_0x532206){return function(_0x136a02){if(!_0x136a02){_0x514713['sendStatus'](0x194);}return _0x136a02;};}function handleError(_0x208cc9,_0x4e36a5){_0x4e36a5=_0x4e36a5||0x1f4;return function(_0x5ee47d){logger[_0x7bdb('0x1e')](_0x5ee47d[_0x7bdb('0x2e')]);if(_0x5ee47d[_0x7bdb('0x2f')]){delete _0x5ee47d[_0x7bdb('0x2f')];}_0x208cc9[_0x7bdb('0x22')](_0x4e36a5)[_0x7bdb('0x30')](_0x5ee47d);};}exports['index']=function(_0x46aa93,_0x464fde){var _0x329ecf={},_0x3d1537={},_0x26de16={'count':0x0,'rows':[]};var _0x14c522=_[_0x7bdb('0x31')](db[_0x7bdb('0x32')][_0x7bdb('0x33')],function(_0x4e1c97){return{'name':_0x4e1c97['fieldName'],'type':_0x4e1c97[_0x7bdb('0x34')][_0x7bdb('0x35')]};});_0x3d1537[_0x7bdb('0x36')]=_[_0x7bdb('0x31')](_0x14c522,_0x7bdb('0x2f'));_0x3d1537['query']=_['keys'](_0x46aa93[_0x7bdb('0x37')]);_0x3d1537['filters']=_[_0x7bdb('0x38')](_0x3d1537['model'],_0x3d1537[_0x7bdb('0x37')]);_0x329ecf['attributes']=_['intersection'](_0x3d1537[_0x7bdb('0x36')],qs[_0x7bdb('0x39')](_0x46aa93[_0x7bdb('0x37')][_0x7bdb('0x39')]));_0x329ecf[_0x7bdb('0x3a')]=_0x329ecf[_0x7bdb('0x3a')][_0x7bdb('0x3b')]?_0x329ecf['attributes']:_0x3d1537['model'];if(!_0x46aa93[_0x7bdb('0x37')][_0x7bdb('0x3c')](_0x7bdb('0x3d'))){_0x329ecf[_0x7bdb('0x27')]=qs[_0x7bdb('0x27')](_0x46aa93[_0x7bdb('0x37')][_0x7bdb('0x27')]);_0x329ecf['offset']=qs['offset'](_0x46aa93[_0x7bdb('0x37')][_0x7bdb('0x26')]);}_0x329ecf[_0x7bdb('0x3e')]=qs[_0x7bdb('0x3f')](_0x46aa93['query'][_0x7bdb('0x3f')]);_0x329ecf['where']=qs[_0x7bdb('0x40')](_[_0x7bdb('0x41')](_0x46aa93[_0x7bdb('0x37')],_0x3d1537[_0x7bdb('0x40')]),_0x14c522);if(_0x46aa93[_0x7bdb('0x37')][_0x7bdb('0x42')]){_0x329ecf[_0x7bdb('0x43')]=_[_0x7bdb('0x44')](_0x329ecf[_0x7bdb('0x43')],{'$or':_['map'](_0x14c522,function(_0x2c1707){if(_0x2c1707[_0x7bdb('0x34')]!=='VIRTUAL'){var _0x7c784={};_0x7c784[_0x2c1707['name']]={'$like':'%'+_0x46aa93[_0x7bdb('0x37')][_0x7bdb('0x42')]+'%'};return _0x7c784;}})});}_0x329ecf=_[_0x7bdb('0x44')]({},_0x329ecf,_0x46aa93[_0x7bdb('0x45')]);var _0x2d979f={'where':_0x329ecf['where']};return db[_0x7bdb('0x32')][_0x7bdb('0x25')](_0x2d979f)[_0x7bdb('0x2c')](function(_0x3eda2e){_0x26de16[_0x7bdb('0x25')]=_0x3eda2e;if(_0x46aa93['query'][_0x7bdb('0x46')]){_0x329ecf[_0x7bdb('0x47')]=[{'all':!![]}];}return db[_0x7bdb('0x32')][_0x7bdb('0x48')](_0x329ecf);})[_0x7bdb('0x2c')](function(_0x25c534){_0x26de16[_0x7bdb('0x49')]=_0x25c534;return _0x26de16;})[_0x7bdb('0x2c')](respondWithFilteredResult(_0x464fde,_0x329ecf))[_0x7bdb('0x4a')](handleError(_0x464fde,null));};exports[_0x7bdb('0x4b')]=function(_0x58e21d,_0x189cf8){var _0x58c4bc={'raw':![],'where':{'id':_0x58e21d[_0x7bdb('0x4c')]['id']}},_0x47cccd={};_0x47cccd[_0x7bdb('0x36')]=_['keys'](db[_0x7bdb('0x32')][_0x7bdb('0x33')]);_0x47cccd['query']=_['keys'](_0x58e21d['query']);_0x47cccd[_0x7bdb('0x40')]=_[_0x7bdb('0x38')](_0x47cccd[_0x7bdb('0x36')],_0x47cccd[_0x7bdb('0x37')]);_0x58c4bc[_0x7bdb('0x3a')]=_[_0x7bdb('0x38')](_0x47cccd[_0x7bdb('0x36')],qs[_0x7bdb('0x39')](_0x58e21d[_0x7bdb('0x37')][_0x7bdb('0x39')]));_0x58c4bc['attributes']=_0x58c4bc[_0x7bdb('0x3a')]['length']?_0x58c4bc[_0x7bdb('0x3a')]:_0x47cccd[_0x7bdb('0x36')];if(_0x58e21d[_0x7bdb('0x37')][_0x7bdb('0x46')]){_0x58c4bc['include']=[{'all':!![]}];}_0x58c4bc=_[_0x7bdb('0x44')]({},_0x58c4bc,_0x58e21d['options']);return db['ServicenowConfiguration'][_0x7bdb('0x4d')](_0x58c4bc)[_0x7bdb('0x2c')](handleEntityNotFound(_0x189cf8,null))['then'](respondWithResult(_0x189cf8,null))['catch'](handleError(_0x189cf8,null));};exports['create']=function(_0x3e574e,_0x53eb38){return db['ServicenowConfiguration'][_0x7bdb('0x4e')](_0x3e574e[_0x7bdb('0x4f')],{})[_0x7bdb('0x2c')](respondWithResult(_0x53eb38,0xc9))[_0x7bdb('0x4a')](handleError(_0x53eb38,null));};exports['update']=function(_0x1d444c,_0x4c5c8c){if(_0x1d444c[_0x7bdb('0x4f')]['id']){delete _0x1d444c[_0x7bdb('0x4f')]['id'];}return db[_0x7bdb('0x32')][_0x7bdb('0x4d')]({'where':{'id':_0x1d444c[_0x7bdb('0x4c')]['id']}})[_0x7bdb('0x2c')](handleEntityNotFound(_0x4c5c8c,null))['then'](saveUpdates(_0x1d444c[_0x7bdb('0x4f')],null))[_0x7bdb('0x2c')](respondWithResult(_0x4c5c8c,null))[_0x7bdb('0x4a')](handleError(_0x4c5c8c,null));};exports['destroy']=function(_0x2b5493,_0x1d9927){return db['ServicenowConfiguration'][_0x7bdb('0x4d')]({'where':{'id':_0x2b5493['params']['id']}})[_0x7bdb('0x2c')](handleEntityNotFound(_0x1d9927,null))[_0x7bdb('0x2c')](removeEntity(_0x1d9927,null))['catch'](handleError(_0x1d9927,null));};exports['getFields']=function(_0x21a54f,_0x2a6c5b,_0x560f54){var _0x2fa6bb={};var _0x567993={};var _0x28eefe;var _0x48f043;return db['ServicenowConfiguration'][_0x7bdb('0x50')]({'where':{'id':_0x21a54f[_0x7bdb('0x4c')]['id']}})[_0x7bdb('0x2c')](handleEntityNotFound(_0x2a6c5b,null))[_0x7bdb('0x2c')](function(_0xac859d){if(_0xac859d){_0x28eefe=_0xac859d;_0x567993[_0x7bdb('0x36')]=_[_0x7bdb('0x51')](db[_0x7bdb('0x52')][_0x7bdb('0x33')]);_0x567993[_0x7bdb('0x37')]=_[_0x7bdb('0x51')](_0x21a54f[_0x7bdb('0x37')]);_0x567993['filters']=_[_0x7bdb('0x38')](_0x567993[_0x7bdb('0x36')],_0x567993['query']);_0x2fa6bb[_0x7bdb('0x3a')]=_[_0x7bdb('0x38')](_0x567993[_0x7bdb('0x36')],qs[_0x7bdb('0x39')](_0x21a54f[_0x7bdb('0x37')]['fields']));_0x2fa6bb[_0x7bdb('0x3a')]=_0x2fa6bb[_0x7bdb('0x3a')][_0x7bdb('0x3b')]?_0x2fa6bb['attributes']:_0x567993[_0x7bdb('0x36')];_0x2fa6bb[_0x7bdb('0x3e')]=qs[_0x7bdb('0x3f')](_0x21a54f[_0x7bdb('0x37')][_0x7bdb('0x3f')]);_0x2fa6bb[_0x7bdb('0x43')]=qs[_0x7bdb('0x40')](_[_0x7bdb('0x41')](_0x21a54f[_0x7bdb('0x37')],_0x567993['filters']));if(_0x21a54f[_0x7bdb('0x37')][_0x7bdb('0x42')]){_0x2fa6bb[_0x7bdb('0x43')]=_[_0x7bdb('0x44')](_0x2fa6bb[_0x7bdb('0x43')],{'$or':_[_0x7bdb('0x31')](_0x2fa6bb[_0x7bdb('0x3a')],function(_0x86c6ed){var _0x4565c2={};_0x4565c2[_0x86c6ed]={'$like':'%'+_0x21a54f[_0x7bdb('0x37')][_0x7bdb('0x42')]+'%'};return _0x4565c2;})});}_0x2fa6bb=_[_0x7bdb('0x44')]({},_0x2fa6bb,_0x21a54f[_0x7bdb('0x45')]);return _0x28eefe['getFields'](_0x2fa6bb);}})[_0x7bdb('0x2c')](function(_0x4d878f){if(_0x4d878f){_0x48f043=_0x4d878f[_0x7bdb('0x3b')];if(!_0x21a54f[_0x7bdb('0x37')][_0x7bdb('0x3c')]('nolimit')){_0x2fa6bb[_0x7bdb('0x27')]=qs[_0x7bdb('0x27')](_0x21a54f['query'][_0x7bdb('0x27')]);_0x2fa6bb[_0x7bdb('0x26')]=qs['offset'](_0x21a54f[_0x7bdb('0x37')][_0x7bdb('0x26')]);}return _0x28eefe['getFields'](_0x2fa6bb);}})[_0x7bdb('0x2c')](function(_0x237688){if(_0x237688){return _0x237688?{'count':_0x48f043,'rows':_0x237688}:null;}})['then'](respondWithResult(_0x2a6c5b,null))[_0x7bdb('0x4a')](handleError(_0x2a6c5b,null));};exports[_0x7bdb('0x53')]=function(_0x5cfbfb,_0x197682,_0x5e8b59){var _0x2935d6={};var _0x25136b={};var _0x2ff95c;var _0x21dd9a;return db[_0x7bdb('0x32')]['findOne']({'where':{'id':_0x5cfbfb['params']['id']}})['then'](handleEntityNotFound(_0x197682,null))[_0x7bdb('0x2c')](function(_0x484de6){if(_0x484de6){_0x2ff95c=_0x484de6;_0x25136b[_0x7bdb('0x36')]=_[_0x7bdb('0x51')](db[_0x7bdb('0x52')]['rawAttributes']);_0x25136b['query']=_[_0x7bdb('0x51')](_0x5cfbfb[_0x7bdb('0x37')]);_0x25136b[_0x7bdb('0x40')]=_[_0x7bdb('0x38')](_0x25136b['model'],_0x25136b[_0x7bdb('0x37')]);_0x2935d6[_0x7bdb('0x3a')]=_[_0x7bdb('0x38')](_0x25136b[_0x7bdb('0x36')],qs[_0x7bdb('0x39')](_0x5cfbfb[_0x7bdb('0x37')]['fields']));_0x2935d6[_0x7bdb('0x3a')]=_0x2935d6['attributes'][_0x7bdb('0x3b')]?_0x2935d6['attributes']:_0x25136b[_0x7bdb('0x36')];_0x2935d6[_0x7bdb('0x3e')]=qs[_0x7bdb('0x3f')](_0x5cfbfb[_0x7bdb('0x37')][_0x7bdb('0x3f')]);_0x2935d6['where']=qs['filters'](_[_0x7bdb('0x41')](_0x5cfbfb[_0x7bdb('0x37')],_0x25136b['filters']));if(_0x5cfbfb[_0x7bdb('0x37')][_0x7bdb('0x42')]){_0x2935d6['where']=_[_0x7bdb('0x44')](_0x2935d6[_0x7bdb('0x43')],{'$or':_['map'](_0x2935d6[_0x7bdb('0x3a')],function(_0x493c69){var _0x4d1a90={};_0x4d1a90[_0x493c69]={'$like':'%'+_0x5cfbfb[_0x7bdb('0x37')][_0x7bdb('0x42')]+'%'};return _0x4d1a90;})});}_0x2935d6=_['merge']({},_0x2935d6,_0x5cfbfb['options']);return _0x2ff95c[_0x7bdb('0x53')](_0x2935d6);}})['then'](function(_0x979dde){if(_0x979dde){_0x21dd9a=_0x979dde['length'];if(!_0x5cfbfb[_0x7bdb('0x37')][_0x7bdb('0x3c')](_0x7bdb('0x3d'))){_0x2935d6[_0x7bdb('0x27')]=qs['limit'](_0x5cfbfb[_0x7bdb('0x37')][_0x7bdb('0x27')]);_0x2935d6['offset']=qs[_0x7bdb('0x26')](_0x5cfbfb[_0x7bdb('0x37')]['offset']);}return _0x2ff95c[_0x7bdb('0x53')](_0x2935d6);}})[_0x7bdb('0x2c')](function(_0x400915){if(_0x400915){return _0x400915?{'count':_0x21dd9a,'rows':_0x400915}:null;}})[_0x7bdb('0x2c')](respondWithResult(_0x197682,null))['catch'](handleError(_0x197682,null));};exports[_0x7bdb('0x54')]=function(_0x5af736,_0x13f48d,_0x3b4583){var _0x3dd0b0={};var _0x4fc2d0={};var _0xdd73f5;var _0x4c1b4b;return db[_0x7bdb('0x32')][_0x7bdb('0x50')]({'where':{'id':_0x5af736[_0x7bdb('0x4c')]['id']}})[_0x7bdb('0x2c')](handleEntityNotFound(_0x13f48d,null))[_0x7bdb('0x2c')](function(_0x45ce62){if(_0x45ce62){_0xdd73f5=_0x45ce62;_0x4fc2d0[_0x7bdb('0x36')]=_[_0x7bdb('0x51')](db[_0x7bdb('0x52')][_0x7bdb('0x33')]);_0x4fc2d0[_0x7bdb('0x37')]=_[_0x7bdb('0x51')](_0x5af736[_0x7bdb('0x37')]);_0x4fc2d0[_0x7bdb('0x40')]=_[_0x7bdb('0x38')](_0x4fc2d0[_0x7bdb('0x36')],_0x4fc2d0['query']);_0x3dd0b0[_0x7bdb('0x3a')]=_[_0x7bdb('0x38')](_0x4fc2d0[_0x7bdb('0x36')],qs[_0x7bdb('0x39')](_0x5af736[_0x7bdb('0x37')][_0x7bdb('0x39')]));_0x3dd0b0[_0x7bdb('0x3a')]=_0x3dd0b0[_0x7bdb('0x3a')][_0x7bdb('0x3b')]?_0x3dd0b0[_0x7bdb('0x3a')]:_0x4fc2d0[_0x7bdb('0x36')];_0x3dd0b0['order']=qs['sort'](_0x5af736['query'][_0x7bdb('0x3f')]);_0x3dd0b0[_0x7bdb('0x43')]=qs['filters'](_[_0x7bdb('0x41')](_0x5af736[_0x7bdb('0x37')],_0x4fc2d0['filters']));if(_0x5af736['query']['filter']){_0x3dd0b0[_0x7bdb('0x43')]=_['merge'](_0x3dd0b0['where'],{'$or':_['map'](_0x3dd0b0[_0x7bdb('0x3a')],function(_0x32419c){var _0x32ef5e={};_0x32ef5e[_0x32419c]={'$like':'%'+_0x5af736['query'][_0x7bdb('0x42')]+'%'};return _0x32ef5e;})});}_0x3dd0b0=_[_0x7bdb('0x44')]({},_0x3dd0b0,_0x5af736[_0x7bdb('0x45')]);return _0xdd73f5[_0x7bdb('0x54')](_0x3dd0b0);}})['then'](function(_0x11f759){if(_0x11f759){_0x4c1b4b=_0x11f759['length'];if(!_0x5af736[_0x7bdb('0x37')][_0x7bdb('0x3c')](_0x7bdb('0x3d'))){_0x3dd0b0['limit']=qs[_0x7bdb('0x27')](_0x5af736[_0x7bdb('0x37')][_0x7bdb('0x27')]);_0x3dd0b0['offset']=qs[_0x7bdb('0x26')](_0x5af736[_0x7bdb('0x37')]['offset']);}return _0xdd73f5[_0x7bdb('0x54')](_0x3dd0b0);}})[_0x7bdb('0x2c')](function(_0x4e2aae){if(_0x4e2aae){return _0x4e2aae?{'count':_0x4c1b4b,'rows':_0x4e2aae}:null;}})[_0x7bdb('0x2c')](respondWithResult(_0x13f48d,null))[_0x7bdb('0x4a')](handleError(_0x13f48d,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index ff8dd83..c50573f 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 _0x3713=['rimraf','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0xce3463,_0x1c0388){var _0x46e755=function(_0x43e036){while(--_0x43e036){_0xce3463['push'](_0xce3463['shift']());}};_0x46e755(++_0x1c0388);}(_0x3713,0xa2));var _0x3371=function(_0xe55ab6,_0x1c3099){_0xe55ab6=_0xe55ab6-0x0;var _0x25265b=_0x3713[_0xe55ab6];return _0x25265b;};'use strict';var _=require(_0x3371('0x0'));var util=require(_0x3371('0x1'));var logger=require(_0x3371('0x2'))(_0x3371('0x3'));var moment=require(_0x3371('0x4'));var BPromise=require(_0x3371('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3371('0x6'));var rimraf=require(_0x3371('0x7'));var config=require(_0x3371('0x8'));var attributes=require(_0x3371('0x9'));module['exports']=function(_0xa8c99c,_0x3e28b2){return _0xa8c99c[_0x3371('0xa')](_0x3371('0xb'),attributes,{'tableName':_0x3371('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcac2=['ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','./intServicenowConfiguration.attributes'];(function(_0x21205e,_0x7eb8e7){var _0x136ebb=function(_0x54aac2){while(--_0x54aac2){_0x21205e['push'](_0x21205e['shift']());}};_0x136ebb(++_0x7eb8e7);}(_0xcac2,0x8e));var _0x2cac=function(_0x30ca90,_0x2c031f){_0x30ca90=_0x30ca90-0x0;var _0x3a376e=_0xcac2[_0x30ca90];return _0x3a376e;};'use strict';var _=require(_0x2cac('0x0'));var util=require(_0x2cac('0x1'));var logger=require(_0x2cac('0x2'))(_0x2cac('0x3'));var moment=require(_0x2cac('0x4'));var BPromise=require('bluebird');var rp=require(_0x2cac('0x5'));var fs=require('fs');var path=require(_0x2cac('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2cac('0x7'));module['exports']=function(_0x306ecd,_0x35808c){return _0x306ecd['define'](_0x2cac('0x8'),attributes,{'tableName':_0x2cac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 3d98c2d..0f2f074 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 _0x968e=['error','code','message','request\x20sent','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','ServicenowConfiguration,\x20%s,\x20%s'];(function(_0x5b2e3d,_0x2d7f7b){var _0x35a13c=function(_0x831acc){while(--_0x831acc){_0x5b2e3d['push'](_0x5b2e3d['shift']());}};_0x35a13c(++_0x2d7f7b);}(_0x968e,0x64));var _0xe968=function(_0x432286,_0xc7f906){_0x432286=_0x432286-0x0;var _0x475b6e=_0x968e[_0x432286];return _0x475b6e;};'use strict';var _=require(_0xe968('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe968('0x1'));var rs=require(_0xe968('0x2'));var fs=require('fs');var Redis=require(_0xe968('0x3'));var db=require(_0xe968('0x4'))['db'];var utils=require(_0xe968('0x5'));var logger=require(_0xe968('0x6'))(_0xe968('0x7'));var config=require('../../config/environment');var jayson=require(_0xe968('0x8'));var client=jayson[_0xe968('0x9')][_0xe968('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b4e8a,_0x529d5e,_0x4db7db){return new BPromise(function(_0x5ded3b,_0x3deedb){return client[_0xe968('0xb')](_0x4b4e8a,_0x4db7db)[_0xe968('0xc')](function(_0x4c9d06){logger['info'](_0xe968('0xd'),_0x529d5e,'request\x20sent');logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x529d5e,'request\x20sent',JSON['stringify'](_0x4c9d06));if(_0x4c9d06[_0xe968('0xe')]){if(_0x4c9d06[_0xe968('0xe')][_0xe968('0xf')]===0x1f4){logger[_0xe968('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x529d5e,_0x4c9d06[_0xe968('0xe')][_0xe968('0x10')]);return _0x3deedb(_0x4c9d06['error'][_0xe968('0x10')]);}logger['error'](_0xe968('0xd'),_0x529d5e,_0x4c9d06[_0xe968('0xe')][_0xe968('0x10')]);return _0x5ded3b(_0x4c9d06[_0xe968('0xe')]['message']);}else{logger['info'](_0xe968('0xd'),_0x529d5e,_0xe968('0x11'));_0x5ded3b(_0x4c9d06['result'][_0xe968('0x10')]);}})[_0xe968('0x12')](function(_0x8d0c36){logger[_0xe968('0xe')](_0xe968('0xd'),_0x529d5e,_0x8d0c36);_0x3deedb(_0x8d0c36);});});} \ No newline at end of file +var _0x6b5d=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x6b5d,0xdc));var _0xd6b5=function(_0x21da44,_0x13e367){_0x21da44=_0x21da44-0x0;var _0x1d800b=_0x6b5d[_0x21da44];return _0x1d800b;};'use strict';var _=require(_0xd6b5('0x0'));var util=require(_0xd6b5('0x1'));var moment=require(_0xd6b5('0x2'));var BPromise=require(_0xd6b5('0x3'));var rs=require(_0xd6b5('0x4'));var fs=require('fs');var Redis=require(_0xd6b5('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd6b5('0x6'))(_0xd6b5('0x7'));var config=require(_0xd6b5('0x8'));var jayson=require(_0xd6b5('0x9'));var client=jayson[_0xd6b5('0xa')][_0xd6b5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x243af2,_0x234feb,_0x35a028){return new BPromise(function(_0x2c7884,_0x1dde59){return client[_0xd6b5('0xc')](_0x243af2,_0x35a028)[_0xd6b5('0xd')](function(_0x13e0c2){logger[_0xd6b5('0xe')](_0xd6b5('0xf'),_0x234feb,'request\x20sent');logger['debug'](_0xd6b5('0x10'),_0x234feb,'request\x20sent',JSON['stringify'](_0x13e0c2));if(_0x13e0c2[_0xd6b5('0x11')]){if(_0x13e0c2[_0xd6b5('0x11')][_0xd6b5('0x12')]===0x1f4){logger[_0xd6b5('0x11')](_0xd6b5('0xf'),_0x234feb,_0x13e0c2[_0xd6b5('0x11')]['message']);return _0x1dde59(_0x13e0c2['error']['message']);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x234feb,_0x13e0c2[_0xd6b5('0x11')][_0xd6b5('0x13')]);return _0x2c7884(_0x13e0c2[_0xd6b5('0x11')][_0xd6b5('0x13')]);}else{logger['info'](_0xd6b5('0xf'),_0x234feb,_0xd6b5('0x14'));_0x2c7884(_0x13e0c2[_0xd6b5('0x15')]['message']);}})['catch'](function(_0x424671){logger[_0xd6b5('0x11')](_0xd6b5('0xf'),_0x234feb,_0x424671);_0x1dde59(_0x424671);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 357c009..5d2a94c 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 _0x5fa8=['post','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x21399e,_0xbc6101){var _0x3b7be4=function(_0x2b5747){while(--_0x2b5747){_0x21399e['push'](_0x21399e['shift']());}};_0x3b7be4(++_0xbc6101);}(_0x5fa8,0x1ec));var _0x85fa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5fa8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x85fa('0x0'));var util=require(_0x85fa('0x1'));var path=require(_0x85fa('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85fa('0x3')]();var auth=require(_0x85fa('0x4'));var interaction=require(_0x85fa('0x5'));var config=require(_0x85fa('0x6'));var controller=require('./intServicenowField.controller');router[_0x85fa('0x7')]('/',auth[_0x85fa('0x8')](),controller[_0x85fa('0x9')]);router[_0x85fa('0x7')](_0x85fa('0xa'),auth[_0x85fa('0x8')](),controller[_0x85fa('0xb')]);router[_0x85fa('0xc')]('/',auth[_0x85fa('0x8')](),controller['create']);router[_0x85fa('0xd')](_0x85fa('0xa'),auth['isAuthenticated'](),controller[_0x85fa('0xe')]);router[_0x85fa('0xf')](_0x85fa('0xa'),auth[_0x85fa('0x8')](),controller[_0x85fa('0x10')]);module[_0x85fa('0x11')]=router; \ No newline at end of file +var _0x45e1=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','show','post','put','delete','destroy'];(function(_0x513dfa,_0x2bff05){var _0x38cb7a=function(_0x1a48c1){while(--_0x1a48c1){_0x513dfa['push'](_0x513dfa['shift']());}};_0x38cb7a(++_0x2bff05);}(_0x45e1,0x9a));var _0x145e=function(_0x35bdcf,_0x21421c){_0x35bdcf=_0x35bdcf-0x0;var _0x5a4fc7=_0x45e1[_0x35bdcf];return _0x5a4fc7;};'use strict';var multer=require(_0x145e('0x0'));var util=require(_0x145e('0x1'));var path=require(_0x145e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x145e('0x3')]();var auth=require(_0x145e('0x4'));var interaction=require(_0x145e('0x5'));var config=require(_0x145e('0x6'));var controller=require(_0x145e('0x7'));router[_0x145e('0x8')]('/',auth[_0x145e('0x9')](),controller[_0x145e('0xa')]);router[_0x145e('0x8')]('/:id',auth[_0x145e('0x9')](),controller[_0x145e('0xb')]);router[_0x145e('0xc')]('/',auth[_0x145e('0x9')](),controller['create']);router[_0x145e('0xd')]('/:id',auth[_0x145e('0x9')](),controller['update']);router[_0x145e('0xe')]('/:id',auth[_0x145e('0x9')](),controller[_0x145e('0xf')]);module[_0x145e('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 3e8056c..8103661 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 _0xec08=['variable','customVariable','keyValue','STRING','ENUM','exports','string'];(function(_0x199bfe,_0x40754b){var _0x3be5c2=function(_0x5d2581){while(--_0x5d2581){_0x199bfe['push'](_0x199bfe['shift']());}};_0x3be5c2(++_0x40754b);}(_0xec08,0xad));var _0x8ec0=function(_0x3e826d,_0x59e2d4){_0x3e826d=_0x3e826d-0x0;var _0x24a906=_0xec08[_0x3e826d];return _0x24a906;};'use strict';var Sequelize=require('sequelize');module[_0x8ec0('0x0')]={'type':{'type':Sequelize['ENUM'](_0x8ec0('0x1'),_0x8ec0('0x2'),_0x8ec0('0x3'),_0x8ec0('0x4')),'defaultValue':_0x8ec0('0x1')},'content':{'type':Sequelize[_0x8ec0('0x5')]},'key':{'type':Sequelize[_0x8ec0('0x5')]},'keyType':{'type':Sequelize[_0x8ec0('0x6')](_0x8ec0('0x1'),_0x8ec0('0x2'),_0x8ec0('0x3'))},'keyContent':{'type':Sequelize[_0x8ec0('0x5')]},'idField':{'type':Sequelize[_0x8ec0('0x5')]},'nameField':{'type':Sequelize[_0x8ec0('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8ec0('0x5')]}}; \ No newline at end of file +var _0x63bf=['keyValue','STRING','variable','sequelize','ENUM','string','customVariable'];(function(_0x88a248,_0x1bfdbf){var _0x48ccb0=function(_0x178307){while(--_0x178307){_0x88a248['push'](_0x88a248['shift']());}};_0x48ccb0(++_0x1bfdbf);}(_0x63bf,0x199));var _0xf63b=function(_0x5cc7af,_0x10ae09){_0x5cc7af=_0x5cc7af-0x0;var _0x1d48e9=_0x63bf[_0x5cc7af];return _0x1d48e9;};'use strict';var Sequelize=require(_0xf63b('0x0'));module['exports']={'type':{'type':Sequelize[_0xf63b('0x1')](_0xf63b('0x2'),'variable',_0xf63b('0x3'),_0xf63b('0x4')),'defaultValue':_0xf63b('0x2')},'content':{'type':Sequelize[_0xf63b('0x5')]},'key':{'type':Sequelize[_0xf63b('0x5')]},'keyType':{'type':Sequelize[_0xf63b('0x1')](_0xf63b('0x2'),_0xf63b('0x6'),_0xf63b('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf63b('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf63b('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 9e61749..fdcf582 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(_0x3e954d,_0x4cc3a0){var _0x59649b=function(_0x9c6eac){while(--_0x9c6eac){_0x3e954d['push'](_0x3e954d['shift']());}};_0x59649b(++_0x4cc3a0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x1d7037,_0xb6cea9){var _0xd410a2=function(_0x480d39){while(--_0x480d39){_0x1d7037['push'](_0x1d7037['shift']());}};_0xd410a2(++_0xb6cea9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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 bbf7d72..0fc6c62 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 _0x4302=['moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','servicenow_unique_index','FieldId','lodash','api'];(function(_0x33e363,_0x4cf709){var _0x6e4b0d=function(_0x406c25){while(--_0x406c25){_0x33e363['push'](_0x33e363['shift']());}};_0x6e4b0d(++_0x4cf709);}(_0x4302,0xbe));var _0x2430=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x4302[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x2430('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2430('0x1'));var moment=require(_0x2430('0x2'));var BPromise=require(_0x2430('0x3'));var rp=require(_0x2430('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2430('0x5'));var config=require(_0x2430('0x6'));var attributes=require(_0x2430('0x7'));module[_0x2430('0x8')]=function(_0x594fb4,_0x57c72e){return _0x594fb4[_0x2430('0x9')]('ServicenowField',attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x2430('0xa'),'fields':['idField',_0x2430('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa6b7=['../../config/environment','./intServicenowField.attributes','exports','int_servicenow_fields','servicenow_unique_index','idField','util','../../config/logger','api','moment','request-promise'];(function(_0x37e4c1,_0x38ec3e){var _0x1a3002=function(_0xa50db7){while(--_0xa50db7){_0x37e4c1['push'](_0x37e4c1['shift']());}};_0x1a3002(++_0x38ec3e);}(_0xa6b7,0x124));var _0x7a6b=function(_0x8b8564,_0x162976){_0x8b8564=_0x8b8564-0x0;var _0x360c61=_0xa6b7[_0x8b8564];return _0x360c61;};'use strict';var _=require('lodash');var util=require(_0x7a6b('0x0'));var logger=require(_0x7a6b('0x1'))(_0x7a6b('0x2'));var moment=require(_0x7a6b('0x3'));var BPromise=require('bluebird');var rp=require(_0x7a6b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7a6b('0x5'));var attributes=require(_0x7a6b('0x6'));module[_0x7a6b('0x7')]=function(_0x52e611,_0x266f75){return _0x52e611['define']('ServicenowField',attributes,{'tableName':_0x7a6b('0x8'),'paranoid':![],'indexes':[{'name':_0x7a6b('0x9'),'fields':[_0x7a6b('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index a2a34fb..aa40a25 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 _0xd1f7=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash'];(function(_0x3bc971,_0x16882d){var _0x42bb0a=function(_0x284e81){while(--_0x284e81){_0x3bc971['push'](_0x3bc971['shift']());}};_0x42bb0a(++_0x16882d);}(_0xd1f7,0x14f));var _0x7d1f=function(_0x5311d7,_0x305d4a){_0x5311d7=_0x5311d7-0x0;var _0x4b4318=_0xd1f7[_0x5311d7];return _0x4b4318;};'use strict';var _=require(_0x7d1f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7d1f('0x1'));var rs=require(_0x7d1f('0x2'));var fs=require('fs');var Redis=require(_0x7d1f('0x3'));var db=require(_0x7d1f('0x4'))['db'];var utils=require(_0x7d1f('0x5'));var logger=require(_0x7d1f('0x6'))(_0x7d1f('0x7'));var config=require('../../config/environment');var jayson=require(_0x7d1f('0x8'));var client=jayson[_0x7d1f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b79d5,_0x8f01e8,_0x55ed32){return new BPromise(function(_0x992582,_0x37dcfc){return client['request'](_0x1b79d5,_0x55ed32)[_0x7d1f('0xa')](function(_0x1bbdf0){logger['info'](_0x7d1f('0xb'),_0x8f01e8,_0x7d1f('0xc'));logger[_0x7d1f('0xd')](_0x7d1f('0xe'),_0x8f01e8,_0x7d1f('0xc'),JSON[_0x7d1f('0xf')](_0x1bbdf0));if(_0x1bbdf0[_0x7d1f('0x10')]){if(_0x1bbdf0['error'][_0x7d1f('0x11')]===0x1f4){logger['error'](_0x7d1f('0xb'),_0x8f01e8,_0x1bbdf0['error'][_0x7d1f('0x12')]);return _0x37dcfc(_0x1bbdf0[_0x7d1f('0x10')][_0x7d1f('0x12')]);}logger[_0x7d1f('0x10')]('ServicenowField,\x20%s,\x20%s',_0x8f01e8,_0x1bbdf0[_0x7d1f('0x10')][_0x7d1f('0x12')]);return _0x992582(_0x1bbdf0[_0x7d1f('0x10')]['message']);}else{logger[_0x7d1f('0x13')]('ServicenowField,\x20%s,\x20%s',_0x8f01e8,_0x7d1f('0xc'));_0x992582(_0x1bbdf0['result']['message']);}})[_0x7d1f('0x14')](function(_0x479040){logger[_0x7d1f('0x10')](_0x7d1f('0xb'),_0x8f01e8,_0x479040);_0x37dcfc(_0x479040);});});} \ No newline at end of file +var _0xf89a=['stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0x4385ba,_0x21bb05){var _0xf089b1=function(_0x1cbad3){while(--_0x1cbad3){_0x4385ba['push'](_0x4385ba['shift']());}};_0xf089b1(++_0x21bb05);}(_0xf89a,0x119));var _0xaf89=function(_0x146427,_0x161f7f){_0x146427=_0x146427-0x0;var _0x5d8497=_0xf89a[_0x146427];return _0x5d8497;};'use strict';var _=require(_0xaf89('0x0'));var util=require(_0xaf89('0x1'));var moment=require(_0xaf89('0x2'));var BPromise=require(_0xaf89('0x3'));var rs=require(_0xaf89('0x4'));var fs=require('fs');var Redis=require(_0xaf89('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xaf89('0x6'));var logger=require(_0xaf89('0x7'))(_0xaf89('0x8'));var config=require(_0xaf89('0x9'));var jayson=require(_0xaf89('0xa'));var client=jayson[_0xaf89('0xb')][_0xaf89('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa8b723,_0x2520e9,_0x1af12c){return new BPromise(function(_0x3d1682,_0x59bd88){return client[_0xaf89('0xd')](_0xa8b723,_0x1af12c)[_0xaf89('0xe')](function(_0x58f278){logger[_0xaf89('0xf')](_0xaf89('0x10'),_0x2520e9,_0xaf89('0x11'));logger['debug'](_0xaf89('0x12'),_0x2520e9,'request\x20sent',JSON[_0xaf89('0x13')](_0x58f278));if(_0x58f278['error']){if(_0x58f278['error'][_0xaf89('0x14')]===0x1f4){logger[_0xaf89('0x15')](_0xaf89('0x10'),_0x2520e9,_0x58f278[_0xaf89('0x15')][_0xaf89('0x16')]);return _0x59bd88(_0x58f278['error'][_0xaf89('0x16')]);}logger[_0xaf89('0x15')](_0xaf89('0x10'),_0x2520e9,_0x58f278[_0xaf89('0x15')][_0xaf89('0x16')]);return _0x3d1682(_0x58f278['error'][_0xaf89('0x16')]);}else{logger[_0xaf89('0xf')](_0xaf89('0x10'),_0x2520e9,_0xaf89('0x11'));_0x3d1682(_0x58f278[_0xaf89('0x17')][_0xaf89('0x16')]);}})[_0xaf89('0x18')](function(_0xe8b2d4){logger['error'](_0xaf89('0x10'),_0x2520e9,_0xe8b2d4);_0x59bd88(_0xe8b2d4);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index ffe7009..e58d0fe 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 _0xb4d0=['getConfigurations','getFields','post','create','addConfiguration','put','update','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x414970,_0x4f502b){var _0xc11455=function(_0x34c261){while(--_0x34c261){_0x414970['push'](_0x414970['shift']());}};_0xc11455(++_0x4f502b);}(_0xb4d0,0xb8));var _0x0b4d=function(_0xf7f62c,_0x34e3e9){_0xf7f62c=_0xf7f62c-0x0;var _0x1fa89e=_0xb4d0[_0xf7f62c];return _0x1fa89e;};'use strict';var multer=require(_0x0b4d('0x0'));var util=require(_0x0b4d('0x1'));var path=require(_0x0b4d('0x2'));var timeout=require(_0x0b4d('0x3'));var express=require(_0x0b4d('0x4'));var router=express['Router']();var auth=require(_0x0b4d('0x5'));var interaction=require(_0x0b4d('0x6'));var config=require(_0x0b4d('0x7'));var controller=require('./intSugarcrmAccount.controller');router[_0x0b4d('0x8')]('/',auth[_0x0b4d('0x9')](),controller[_0x0b4d('0xa')]);router['get'](_0x0b4d('0xb'),auth['isAuthenticated'](),controller[_0x0b4d('0xc')]);router['get'](_0x0b4d('0xd'),auth[_0x0b4d('0x9')](),controller[_0x0b4d('0xe')]);router[_0x0b4d('0x8')]('/:id/fields',auth[_0x0b4d('0x9')](),controller[_0x0b4d('0xf')]);router[_0x0b4d('0x10')]('/',auth[_0x0b4d('0x9')](),controller[_0x0b4d('0x11')]);router[_0x0b4d('0x10')]('/:id/configurations',auth[_0x0b4d('0x9')](),controller[_0x0b4d('0x12')]);router[_0x0b4d('0x13')](_0x0b4d('0xb'),auth[_0x0b4d('0x9')](),controller[_0x0b4d('0x14')]);router[_0x0b4d('0x15')](_0x0b4d('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2084=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','update','delete'];(function(_0x47d541,_0x17e34a){var _0x3541ce=function(_0x20975f){while(--_0x20975f){_0x47d541['push'](_0x47d541['shift']());}};_0x3541ce(++_0x17e34a);}(_0x2084,0x122));var _0x4208=function(_0xf5d257,_0x349ad7){_0xf5d257=_0xf5d257-0x0;var _0x181a62=_0x2084[_0xf5d257];return _0x181a62;};'use strict';var multer=require(_0x4208('0x0'));var util=require('util');var path=require(_0x4208('0x1'));var timeout=require(_0x4208('0x2'));var express=require(_0x4208('0x3'));var router=express[_0x4208('0x4')]();var auth=require(_0x4208('0x5'));var interaction=require(_0x4208('0x6'));var config=require(_0x4208('0x7'));var controller=require(_0x4208('0x8'));router['get']('/',auth[_0x4208('0x9')](),controller[_0x4208('0xa')]);router[_0x4208('0xb')](_0x4208('0xc'),auth[_0x4208('0x9')](),controller[_0x4208('0xd')]);router[_0x4208('0xb')](_0x4208('0xe'),auth[_0x4208('0x9')](),controller[_0x4208('0xf')]);router['get']('/:id/fields',auth[_0x4208('0x9')](),controller[_0x4208('0x10')]);router[_0x4208('0x11')]('/',auth['isAuthenticated'](),controller[_0x4208('0x12')]);router[_0x4208('0x11')]('/:id/configurations',auth[_0x4208('0x9')](),controller[_0x4208('0x13')]);router['put'](_0x4208('0xc'),auth[_0x4208('0x9')](),controller[_0x4208('0x14')]);router[_0x4208('0x15')](_0x4208('0xc'),auth['isAuthenticated'](),controller[_0x4208('0x16')]);module[_0x4208('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 5460c85..5f94943 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 _0x74c3=['sequelize','exports','STRING','remoteUri'];(function(_0x2adb49,_0x2fb9b5){var _0x16b293=function(_0x3578e3){while(--_0x3578e3){_0x2adb49['push'](_0x2adb49['shift']());}};_0x16b293(++_0x2fb9b5);}(_0x74c3,0x16c));var _0x374c=function(_0x31d5d9,_0x207133){_0x31d5d9=_0x31d5d9-0x0;var _0x1e64c3=_0x74c3[_0x31d5d9];return _0x1e64c3;};'use strict';var Sequelize=require(_0x374c('0x0'));module[_0x374c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x374c('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x374c('0x2')],'unique':_0x374c('0x3')},'serverUrl':{'type':Sequelize[_0x374c('0x2')]}}; \ No newline at end of file +var _0xc8e9=['exports','STRING','username','remoteUri'];(function(_0xc7a066,_0x550196){var _0x2a60ec=function(_0x1baa80){while(--_0x1baa80){_0xc7a066['push'](_0xc7a066['shift']());}};_0x2a60ec(++_0x550196);}(_0xc8e9,0x18c));var _0x9c8e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc8e9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x9c8e('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9c8e('0x1')],'unique':_0x9c8e('0x2')},'password':{'type':Sequelize[_0x9c8e('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x9c8e('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 386fc47..020d91a 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 _0xb89c=['catch','status','json','count','offset','limit','set','apply','end','stack','name','send','SugarcrmAccount','rawAttributes','fieldName','type','key','model','map','query','filters','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','keys','intersection','find','create','body','update','getConfigurations','SugarcrmConfiguration','hasOwnProperty','addConfiguration','findOne','AccountId','channel','getDescriptions','SugarcrmField','Subjects','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_minutes','parent_id','parent_type','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','get_module_fields','Calls','values','module_fields','remove','includes','label','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x19efbc,_0x10b7d7){var _0x205c5e=function(_0x49daa4){while(--_0x49daa4){_0x19efbc['push'](_0x19efbc['shift']());}};_0x205c5e(++_0x10b7d7);}(_0xb89c,0x1e5));var _0xcb89=function(_0x294939,_0x1f6c1f){_0x294939=_0x294939-0x0;var _0x473885=_0xb89c[_0x294939];return _0x473885;};'use strict';var pdf=require(_0xcb89('0x0'));var emlformat=require(_0xcb89('0x1'));var rimraf=require(_0xcb89('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcb89('0x3'));var rp=require('request-promise');var moment=require(_0xcb89('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcb89('0x5'));var util=require(_0xcb89('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xcb89('0x7'));var ejs=require(_0xcb89('0x8'));var fs=require('fs');var _=require(_0xcb89('0x9'));var squel=require(_0xcb89('0xa'));var crypto=require(_0xcb89('0xb'));var jsforce=require(_0xcb89('0xc'));var deskjs=require(_0xcb89('0xd'));var toCsv=require(_0xcb89('0x7'));var querystring=require(_0xcb89('0xe'));var Papa=require(_0xcb89('0xf'));var Redis=require(_0xcb89('0x10'));var authService=require(_0xcb89('0x11'));var qs=require(_0xcb89('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcb89('0x13'))(_0xcb89('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xcb89('0x15'))['db'];var integrations=require(_0xcb89('0x16'));var jayson=require(_0xcb89('0x17'));var client=jayson[_0xcb89('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x280ccd,_0x20e734,_0x16a088){if(_0x16a088){var _0x159ece=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x159ece[_0xcb89('0x19')](_0x20e734)){return _0x280ccd;}else{throw new db[(_0xcb89('0x1a'))]['ValidationError'](_0xcb89('0x1b'));}}else{return _0x280ccd;}}function respondWithRpcPromise(_0x19c0f3,_0x2b35c2,_0x39e2fd,_0x312cfa){return new BPromise(function(_0x4a3531,_0x48d3c9){var _0x3b9d86=_0x312cfa||client;return _0x3b9d86[_0xcb89('0x1c')](_0x19c0f3,_0x39e2fd)[_0xcb89('0x1d')](function(_0x51f296){logger[_0xcb89('0x1e')](_0xcb89('0x1f'),_0x2b35c2,_0xcb89('0x20'));logger[_0xcb89('0x21')](_0xcb89('0x22'),_0x2b35c2,'request\x20sent',JSON['stringify'](_0x51f296));if(_0x51f296[_0xcb89('0x23')]){if(_0x51f296['error'][_0xcb89('0x24')]===0x1f4){logger[_0xcb89('0x23')](_0xcb89('0x1f'),_0x2b35c2,_0x51f296[_0xcb89('0x23')][_0xcb89('0x25')]);return _0x48d3c9(_0x51f296['error'][_0xcb89('0x25')]);}logger[_0xcb89('0x23')](_0xcb89('0x1f'),_0x2b35c2,_0x51f296['error'][_0xcb89('0x25')]);return _0x4a3531(_0x51f296['error'][_0xcb89('0x25')]);}else{logger[_0xcb89('0x1e')]('SugarcrmAccount,\x20%s,\x20%s',_0x2b35c2,'request\x20sent');_0x4a3531(_0x51f296[_0xcb89('0x26')][_0xcb89('0x25')]);}})[_0xcb89('0x27')](function(_0x4f1f22){logger['error'](_0xcb89('0x1f'),_0x2b35c2,_0x4f1f22);_0x48d3c9(_0x4f1f22);});});}function respondWithStatusCode(_0x80f5b8,_0x54b845){_0x54b845=_0x54b845||0xcc;return function(_0x3a4891){if(_0x3a4891){return _0x80f5b8['sendStatus'](_0x54b845);}return _0x80f5b8['status'](_0x54b845)['end']();};}function respondWithResult(_0x3758a6,_0x353fa1){_0x353fa1=_0x353fa1||0xc8;return function(_0x5a2597){if(_0x5a2597){return _0x3758a6[_0xcb89('0x28')](_0x353fa1)[_0xcb89('0x29')](_0x5a2597);}};}function respondWithFilteredResult(_0x31418a,_0x484f55){return function(_0x2f76a0){if(_0x2f76a0){var _0x40c7aa=_0x2f76a0[_0xcb89('0x2a')],_0x5d3d97=_0x484f55['offset'],_0x172fb1=_0x484f55[_0xcb89('0x2b')]+_0x484f55[_0xcb89('0x2c')],_0x2ee5e6;if(_0x172fb1>=_0x40c7aa){_0x172fb1=_0x40c7aa;_0x2ee5e6=0xc8;}else{_0x2ee5e6=0xce;}_0x31418a[_0xcb89('0x28')](_0x2ee5e6);return _0x31418a[_0xcb89('0x2d')]('Content-Range',_0x5d3d97+'-'+_0x172fb1+'/'+_0x40c7aa)[_0xcb89('0x29')](_0x2f76a0);}return null;};}function patchUpdates(_0x356f59){return function(_0x18c5fe){try{jsonpatch[_0xcb89('0x2e')](_0x18c5fe,_0x356f59,!![]);}catch(_0x2329a4){return BPromise['reject'](_0x2329a4);}return _0x18c5fe['save']();};}function saveUpdates(_0x55acdb,_0x91562b){return function(_0x40e89f){if(_0x40e89f){return _0x40e89f['update'](_0x55acdb)[_0xcb89('0x1d')](function(_0x3c4fcc){return _0x3c4fcc;});}return null;};}function removeEntity(_0x4197d8,_0x5535d3){return function(_0x5e9088){if(_0x5e9088){return _0x5e9088['destroy']()[_0xcb89('0x1d')](function(){_0x4197d8['status'](0xcc)[_0xcb89('0x2f')]();});}};}function handleEntityNotFound(_0xb232b9,_0x2c8088){return function(_0x57562a){if(!_0x57562a){_0xb232b9['sendStatus'](0x194);}return _0x57562a;};}function handleError(_0x54358e,_0x481b65){_0x481b65=_0x481b65||0x1f4;return function(_0x221329){logger[_0xcb89('0x23')](_0x221329[_0xcb89('0x30')]);if(_0x221329[_0xcb89('0x31')]){delete _0x221329[_0xcb89('0x31')];}_0x54358e[_0xcb89('0x28')](_0x481b65)[_0xcb89('0x32')](_0x221329);};}exports['index']=function(_0x566d75,_0x44a8b6){var _0x318023={},_0x91afc6={},_0xf01c27={'count':0x0,'rows':[]};var _0x27945b=_['map'](db[_0xcb89('0x33')][_0xcb89('0x34')],function(_0x41de3a){return{'name':_0x41de3a[_0xcb89('0x35')],'type':_0x41de3a[_0xcb89('0x36')][_0xcb89('0x37')]};});_0x91afc6[_0xcb89('0x38')]=_[_0xcb89('0x39')](_0x27945b,_0xcb89('0x31'));_0x91afc6[_0xcb89('0x3a')]=_['keys'](_0x566d75[_0xcb89('0x3a')]);_0x91afc6[_0xcb89('0x3b')]=_['intersection'](_0x91afc6[_0xcb89('0x38')],_0x91afc6[_0xcb89('0x3a')]);_0x318023['attributes']=_['intersection'](_0x91afc6[_0xcb89('0x38')],qs['fields'](_0x566d75[_0xcb89('0x3a')][_0xcb89('0x3c')]));_0x318023['attributes']=_0x318023[_0xcb89('0x3d')][_0xcb89('0x3e')]?_0x318023[_0xcb89('0x3d')]:_0x91afc6[_0xcb89('0x38')];if(!_0x566d75['query']['hasOwnProperty'](_0xcb89('0x3f'))){_0x318023[_0xcb89('0x2c')]=qs[_0xcb89('0x2c')](_0x566d75[_0xcb89('0x3a')]['limit']);_0x318023[_0xcb89('0x2b')]=qs['offset'](_0x566d75['query'][_0xcb89('0x2b')]);}_0x318023[_0xcb89('0x40')]=qs[_0xcb89('0x41')](_0x566d75[_0xcb89('0x3a')][_0xcb89('0x41')]);_0x318023[_0xcb89('0x42')]=qs[_0xcb89('0x3b')](_[_0xcb89('0x43')](_0x566d75[_0xcb89('0x3a')],_0x91afc6[_0xcb89('0x3b')]),_0x27945b);if(_0x566d75[_0xcb89('0x3a')][_0xcb89('0x44')]){_0x318023[_0xcb89('0x42')]=_['merge'](_0x318023[_0xcb89('0x42')],{'$or':_['map'](_0x27945b,function(_0x30555d){if(_0x30555d[_0xcb89('0x36')]!==_0xcb89('0x45')){var _0x210269={};_0x210269[_0x30555d['name']]={'$like':'%'+_0x566d75[_0xcb89('0x3a')][_0xcb89('0x44')]+'%'};return _0x210269;}})});}_0x318023=_[_0xcb89('0x46')]({},_0x318023,_0x566d75[_0xcb89('0x47')]);var _0x3f53e2={'where':_0x318023['where']};return db[_0xcb89('0x33')][_0xcb89('0x2a')](_0x3f53e2)[_0xcb89('0x1d')](function(_0x1b04be){_0xf01c27[_0xcb89('0x2a')]=_0x1b04be;if(_0x566d75[_0xcb89('0x3a')][_0xcb89('0x48')]){_0x318023['include']=[{'all':!![]}];}return db[_0xcb89('0x33')][_0xcb89('0x49')](_0x318023);})[_0xcb89('0x1d')](function(_0x4be03b){_0xf01c27[_0xcb89('0x4a')]=_0x4be03b;return _0xf01c27;})['then'](respondWithFilteredResult(_0x44a8b6,_0x318023))[_0xcb89('0x27')](handleError(_0x44a8b6,null));};exports[_0xcb89('0x4b')]=function(_0x57dd03,_0x1ecbe5){var _0xc4bbe7={'raw':![],'where':{'id':_0x57dd03[_0xcb89('0x4c')]['id']}},_0x1efe83={};_0x1efe83['model']=_['keys'](db[_0xcb89('0x33')][_0xcb89('0x34')]);_0x1efe83[_0xcb89('0x3a')]=_[_0xcb89('0x4d')](_0x57dd03['query']);_0x1efe83[_0xcb89('0x3b')]=_['intersection'](_0x1efe83['model'],_0x1efe83['query']);_0xc4bbe7[_0xcb89('0x3d')]=_[_0xcb89('0x4e')](_0x1efe83['model'],qs[_0xcb89('0x3c')](_0x57dd03[_0xcb89('0x3a')]['fields']));_0xc4bbe7['attributes']=_0xc4bbe7[_0xcb89('0x3d')][_0xcb89('0x3e')]?_0xc4bbe7[_0xcb89('0x3d')]:_0x1efe83[_0xcb89('0x38')];if(_0x57dd03[_0xcb89('0x3a')]['includeAll']){_0xc4bbe7['include']=[{'all':!![]}];}_0xc4bbe7=_[_0xcb89('0x46')]({},_0xc4bbe7,_0x57dd03[_0xcb89('0x47')]);return db[_0xcb89('0x33')][_0xcb89('0x4f')](_0xc4bbe7)[_0xcb89('0x1d')](handleEntityNotFound(_0x1ecbe5,null))[_0xcb89('0x1d')](respondWithResult(_0x1ecbe5,null))[_0xcb89('0x27')](handleError(_0x1ecbe5,null));};exports['create']=function(_0x42fb09,_0x3edbf3){return db[_0xcb89('0x33')][_0xcb89('0x50')](_0x42fb09[_0xcb89('0x51')],{})['then'](respondWithResult(_0x3edbf3,0xc9))[_0xcb89('0x27')](handleError(_0x3edbf3,null));};exports[_0xcb89('0x52')]=function(_0x1e9135,_0xf810df){if(_0x1e9135[_0xcb89('0x51')]['id']){delete _0x1e9135[_0xcb89('0x51')]['id'];}return db[_0xcb89('0x33')][_0xcb89('0x4f')]({'where':{'id':_0x1e9135[_0xcb89('0x4c')]['id']}})[_0xcb89('0x1d')](handleEntityNotFound(_0xf810df,null))['then'](saveUpdates(_0x1e9135[_0xcb89('0x51')],null))[_0xcb89('0x1d')](respondWithResult(_0xf810df,null))[_0xcb89('0x27')](handleError(_0xf810df,null));};exports['destroy']=function(_0x18e891,_0x1777de){return db[_0xcb89('0x33')][_0xcb89('0x4f')]({'where':{'id':_0x18e891[_0xcb89('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1777de,null))['then'](removeEntity(_0x1777de,null))[_0xcb89('0x27')](handleError(_0x1777de,null));};exports[_0xcb89('0x53')]=function(_0x59afe5,_0x330a11,_0x582dcd){var _0x36a111={};var _0xcb898={};var _0x25a1eb;var _0xf357eb;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x59afe5[_0xcb89('0x4c')]['id']}})[_0xcb89('0x1d')](handleEntityNotFound(_0x330a11,null))[_0xcb89('0x1d')](function(_0x35ab70){if(_0x35ab70){_0x25a1eb=_0x35ab70;_0xcb898[_0xcb89('0x38')]=_['keys'](db[_0xcb89('0x54')][_0xcb89('0x34')]);_0xcb898[_0xcb89('0x3a')]=_['keys'](_0x59afe5[_0xcb89('0x3a')]);_0xcb898[_0xcb89('0x3b')]=_['intersection'](_0xcb898[_0xcb89('0x38')],_0xcb898['query']);_0x36a111[_0xcb89('0x3d')]=_[_0xcb89('0x4e')](_0xcb898[_0xcb89('0x38')],qs[_0xcb89('0x3c')](_0x59afe5['query'][_0xcb89('0x3c')]));_0x36a111[_0xcb89('0x3d')]=_0x36a111[_0xcb89('0x3d')]['length']?_0x36a111[_0xcb89('0x3d')]:_0xcb898[_0xcb89('0x38')];_0x36a111[_0xcb89('0x40')]=qs[_0xcb89('0x41')](_0x59afe5['query'][_0xcb89('0x41')]);_0x36a111['where']=qs[_0xcb89('0x3b')](_[_0xcb89('0x43')](_0x59afe5['query'],_0xcb898['filters']));if(_0x59afe5[_0xcb89('0x3a')][_0xcb89('0x44')]){_0x36a111['where']=_['merge'](_0x36a111[_0xcb89('0x42')],{'$or':_[_0xcb89('0x39')](_0x36a111[_0xcb89('0x3d')],function(_0x18c2a9){var _0x436fff={};_0x436fff[_0x18c2a9]={'$like':'%'+_0x59afe5[_0xcb89('0x3a')]['filter']+'%'};return _0x436fff;})});}_0x36a111=_[_0xcb89('0x46')]({},_0x36a111,_0x59afe5[_0xcb89('0x47')]);return _0x25a1eb[_0xcb89('0x53')](_0x36a111);}})['then'](function(_0x12075c){if(_0x12075c){_0xf357eb=_0x12075c[_0xcb89('0x3e')];if(!_0x59afe5['query'][_0xcb89('0x55')](_0xcb89('0x3f'))){_0x36a111[_0xcb89('0x2c')]=qs[_0xcb89('0x2c')](_0x59afe5[_0xcb89('0x3a')][_0xcb89('0x2c')]);_0x36a111[_0xcb89('0x2b')]=qs[_0xcb89('0x2b')](_0x59afe5[_0xcb89('0x3a')][_0xcb89('0x2b')]);}return _0x25a1eb[_0xcb89('0x53')](_0x36a111);}})[_0xcb89('0x1d')](function(_0x3a451f){if(_0x3a451f){return _0x3a451f?{'count':_0xf357eb,'rows':_0x3a451f}:null;}})[_0xcb89('0x1d')](respondWithResult(_0x330a11,null))[_0xcb89('0x27')](handleError(_0x330a11,null));};exports[_0xcb89('0x56')]=function(_0x5dd035,_0x3ad23b,_0x2b34e0){if(_0x5dd035[_0xcb89('0x51')]['id']){delete _0x5dd035[_0xcb89('0x51')]['id'];}return db[_0xcb89('0x33')][_0xcb89('0x57')]({'where':{'id':_0x5dd035[_0xcb89('0x4c')]['id']}})[_0xcb89('0x1d')](handleEntityNotFound(_0x3ad23b,null))[_0xcb89('0x1d')](function(_0x38a613){if(_0x38a613){_0x5dd035[_0xcb89('0x51')][_0xcb89('0x58')]=_0x38a613['id'];_0x5dd035[_0xcb89('0x51')]['Subjects']=integrations['getSubjects'](_0x5dd035[_0xcb89('0x51')][_0xcb89('0x59')],_0x5dd035[_0xcb89('0x51')][_0xcb89('0x36')]);_0x5dd035[_0xcb89('0x51')]['Descriptions']=integrations[_0xcb89('0x5a')](_0x5dd035[_0xcb89('0x51')][_0xcb89('0x59')],_0x5dd035[_0xcb89('0x51')]['type']);return db[_0xcb89('0x54')][_0xcb89('0x50')](_0x5dd035[_0xcb89('0x51')],{'include':[{'model':db[_0xcb89('0x5b')],'as':_0xcb89('0x5c')},{'model':db[_0xcb89('0x5b')],'as':_0xcb89('0x5d')}]});}return null;})[_0xcb89('0x1d')](respondWithResult(_0x3ad23b,null))[_0xcb89('0x27')](handleError(_0x3ad23b,null));};exports[_0xcb89('0x5e')]=function(_0x30ff3a,_0x8199a2,_0x44f1ad){var _0x17a3f7='';var _0x5ba3b3=['id',_0xcb89('0x31'),_0xcb89('0x5f'),_0xcb89('0x60'),_0xcb89('0x61'),_0xcb89('0x62'),'duration_hours',_0xcb89('0x63'),_0xcb89('0x64'),_0xcb89('0x65'),'parent_name',_0xcb89('0x66')];return db[_0xcb89('0x33')][_0xcb89('0x57')]({'where':{'id':_0x30ff3a['params']['id']},'attributes':['id',_0xcb89('0x67'),_0xcb89('0x68'),'remoteUri']})[_0xcb89('0x1d')](handleEntityNotFound(_0x8199a2,null))[_0xcb89('0x1d')](function(_0x3f62a4){if(_0x3f62a4){_0x17a3f7=_0x3f62a4[_0xcb89('0x69')];var _0x4e7c8d=_0x17a3f7[_0xcb89('0x6a')](-0x1);if(_0x4e7c8d==='/'){_0x17a3f7=_0x17a3f7[_0xcb89('0x6b')](0x0,_0x17a3f7[_0xcb89('0x6c')](_0x4e7c8d));}return rp({'method':_0xcb89('0x6d'),'uri':util[_0xcb89('0x6e')]('%s%s',_0x17a3f7,_0xcb89('0x6f')),'json':!![],'form':{'method':_0xcb89('0x70'),'input_type':'JSON','response_type':_0xcb89('0x71'),'rest_data':JSON[_0xcb89('0x72')]({'user_auth':{'user_name':_0x3f62a4['username'],'password':_0x3f62a4[_0xcb89('0x68')],'encryption':_0xcb89('0x73')},'application':_0xcb89('0x74')})}});}})[_0xcb89('0x1d')](function(_0x131d6d){if(_0x131d6d&&_0x131d6d[_0xcb89('0x31')]!==_0xcb89('0x75')&&_0x131d6d['name']!==_0xcb89('0x76')){return rp({'method':_0xcb89('0x6d'),'uri':util[_0xcb89('0x6e')](_0xcb89('0x77'),_0x17a3f7,_0xcb89('0x6f')),'json':!![],'form':{'method':_0xcb89('0x78'),'input_type':_0xcb89('0x71'),'response_type':'JSON','rest_data':JSON[_0xcb89('0x72')]({'session':_0x131d6d['id'],'module_name':_0xcb89('0x79')})}})[_0xcb89('0x1d')](function(_0x1ec480){if(_0x1ec480){var _0x4ba880=_[_0xcb89('0x7a')](_0x1ec480[_0xcb89('0x7b')]);_[_0xcb89('0x7c')](_0x4ba880,function(_0x589181){return _0x5ba3b3[_0xcb89('0x7d')](_0x589181[_0xcb89('0x31')]);});return{'count':_0x4ba880[_0xcb89('0x3e')],'rows':_[_0xcb89('0x39')](_0x4ba880,function(_0xa6595e){return{'id':_0xa6595e['name'],'name':_0xa6595e[_0xcb89('0x7e')],'custom':_['endsWith'](_0xa6595e[_0xcb89('0x31')],'_c')?!![]:![],'options':_0xa6595e['options']?_[_0xcb89('0x39')](_[_0xcb89('0x7a')](_0xa6595e[_0xcb89('0x47')]),function(_0x30e047){return{'name':_0x30e047[_0xcb89('0x7f')],'value':_0x30e047[_0xcb89('0x31')]};}):[]};})};}})[_0xcb89('0x1d')](respondWithResult(_0x8199a2,null))[_0xcb89('0x27')](function(_0x5e7690){var _0x3ab313=_0x30ff3a[_0xcb89('0x3a')][_0xcb89('0x19')]?0x1f4:_0x5e7690[_0xcb89('0x80')]||0x1f4;logger['error'](_0xcb89('0x81'),_0xcb89('0x5e'),_0x3ab313,JSON[_0xcb89('0x72')](_0x5e7690));delete _0x5e7690[_0xcb89('0x31')];if(_0x3ab313===0x191){_0x3ab313=0x190;}_0x8199a2[_0xcb89('0x28')](_0x3ab313)[_0xcb89('0x32')](_0x30ff3a['query'][_0xcb89('0x19')]?{'message':_0xcb89('0x82'),'statusCode':_0x5e7690['statusCode']}:_0x5e7690);});}else{var _0x2205f6=0x1f4;_0x8199a2[_0xcb89('0x28')](_0x2205f6)[_0xcb89('0x32')]({'message':_0xcb89('0x82'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x11fe=['getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','Subjects','getSubjects','channel','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','Invalid\x20Login','Password\x20Expired','POST','Calls','values','module_fields','remove','label','endsWith','statusCode','getFields','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../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','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','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','end','json','offset','status','set','Content-Range','apply','reject','save','destroy','stack','name','send','SugarcrmAccount','rawAttributes','fieldName','type','key','map','keys','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','show','params','options','find','create','body','update'];(function(_0x13a3e9,_0x50a007){var _0x2c3329=function(_0x1d96be){while(--_0x1d96be){_0x13a3e9['push'](_0x13a3e9['shift']());}};_0x2c3329(++_0x50a007);}(_0x11fe,0x1b9));var _0xe11f=function(_0x3cb5d7,_0x24dce1){_0x3cb5d7=_0x3cb5d7-0x0;var _0x495f97=_0x11fe[_0x3cb5d7];return _0x495f97;};'use strict';var pdf=require(_0xe11f('0x0'));var emlformat=require(_0xe11f('0x1'));var rimraf=require(_0xe11f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe11f('0x3'));var rp=require(_0xe11f('0x4'));var moment=require(_0xe11f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe11f('0x6'));var util=require('util');var path=require(_0xe11f('0x7'));var sox=require('sox');var csv=require(_0xe11f('0x8'));var ejs=require(_0xe11f('0x9'));var fs=require('fs');var _=require(_0xe11f('0xa'));var squel=require(_0xe11f('0xb'));var crypto=require(_0xe11f('0xc'));var jsforce=require(_0xe11f('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe11f('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe11f('0xf'));var qs=require(_0xe11f('0x10'));var as=require(_0xe11f('0x11'));var hardwareService=require(_0xe11f('0x12'));var logger=require(_0xe11f('0x13'))(_0xe11f('0x14'));var utils=require(_0xe11f('0x15'));var config=require(_0xe11f('0x16'));var db=require(_0xe11f('0x17'))['db'];var integrations=require(_0xe11f('0x18'));var jayson=require(_0xe11f('0x19'));var client=jayson[_0xe11f('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x1e31b1,_0x7bb0e9,_0xdacca5){if(_0xdacca5){var _0x460a88=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x460a88[_0xe11f('0x1b')](_0x7bb0e9)){return _0x1e31b1;}else{throw new db[(_0xe11f('0x1c'))][(_0xe11f('0x1d'))](_0xe11f('0x1e'));}}else{return _0x1e31b1;}}function respondWithRpcPromise(_0x1ea1a5,_0x1ece53,_0x48f679,_0x2ae2c2){return new BPromise(function(_0x26c993,_0x2e4f1a){var _0x1f7cfc=_0x2ae2c2||client;return _0x1f7cfc[_0xe11f('0x1f')](_0x1ea1a5,_0x48f679)[_0xe11f('0x20')](function(_0x3041b0){logger[_0xe11f('0x21')](_0xe11f('0x22'),_0x1ece53,_0xe11f('0x23'));logger[_0xe11f('0x24')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x1ece53,_0xe11f('0x23'),JSON[_0xe11f('0x25')](_0x3041b0));if(_0x3041b0[_0xe11f('0x26')]){if(_0x3041b0[_0xe11f('0x26')][_0xe11f('0x27')]===0x1f4){logger[_0xe11f('0x26')](_0xe11f('0x22'),_0x1ece53,_0x3041b0[_0xe11f('0x26')][_0xe11f('0x28')]);return _0x2e4f1a(_0x3041b0[_0xe11f('0x26')][_0xe11f('0x28')]);}logger[_0xe11f('0x26')](_0xe11f('0x22'),_0x1ece53,_0x3041b0[_0xe11f('0x26')][_0xe11f('0x28')]);return _0x26c993(_0x3041b0[_0xe11f('0x26')][_0xe11f('0x28')]);}else{logger[_0xe11f('0x21')]('SugarcrmAccount,\x20%s,\x20%s',_0x1ece53,_0xe11f('0x23'));_0x26c993(_0x3041b0['result'][_0xe11f('0x28')]);}})[_0xe11f('0x29')](function(_0x5d2ff0){logger[_0xe11f('0x26')](_0xe11f('0x22'),_0x1ece53,_0x5d2ff0);_0x2e4f1a(_0x5d2ff0);});});}function respondWithStatusCode(_0x194a74,_0x546fad){_0x546fad=_0x546fad||0xcc;return function(_0x50a798){if(_0x50a798){return _0x194a74[_0xe11f('0x2a')](_0x546fad);}return _0x194a74['status'](_0x546fad)[_0xe11f('0x2b')]();};}function respondWithResult(_0x3c0857,_0x45fd56){_0x45fd56=_0x45fd56||0xc8;return function(_0x52b22e){if(_0x52b22e){return _0x3c0857['status'](_0x45fd56)[_0xe11f('0x2c')](_0x52b22e);}};}function respondWithFilteredResult(_0x519a4a,_0x201af6){return function(_0x4864a9){if(_0x4864a9){var _0x226e3a=_0x4864a9['count'],_0x1b2e98=_0x201af6[_0xe11f('0x2d')],_0x236e18=_0x201af6[_0xe11f('0x2d')]+_0x201af6['limit'],_0x4042c9;if(_0x236e18>=_0x226e3a){_0x236e18=_0x226e3a;_0x4042c9=0xc8;}else{_0x4042c9=0xce;}_0x519a4a[_0xe11f('0x2e')](_0x4042c9);return _0x519a4a[_0xe11f('0x2f')](_0xe11f('0x30'),_0x1b2e98+'-'+_0x236e18+'/'+_0x226e3a)[_0xe11f('0x2c')](_0x4864a9);}return null;};}function patchUpdates(_0x93201c){return function(_0x44f37e){try{jsonpatch[_0xe11f('0x31')](_0x44f37e,_0x93201c,!![]);}catch(_0x20f38a){return BPromise[_0xe11f('0x32')](_0x20f38a);}return _0x44f37e[_0xe11f('0x33')]();};}function saveUpdates(_0x3e8e0b,_0x1fbede){return function(_0x44a952){if(_0x44a952){return _0x44a952['update'](_0x3e8e0b)[_0xe11f('0x20')](function(_0x3138bd){return _0x3138bd;});}return null;};}function removeEntity(_0x214578,_0x4abb7f){return function(_0x275148){if(_0x275148){return _0x275148[_0xe11f('0x34')]()['then'](function(){_0x214578[_0xe11f('0x2e')](0xcc)[_0xe11f('0x2b')]();});}};}function handleEntityNotFound(_0x7d6d7a,_0x217754){return function(_0x2fec0c){if(!_0x2fec0c){_0x7d6d7a[_0xe11f('0x2a')](0x194);}return _0x2fec0c;};}function handleError(_0x5163cb,_0x51f124){_0x51f124=_0x51f124||0x1f4;return function(_0x1642ef){logger[_0xe11f('0x26')](_0x1642ef[_0xe11f('0x35')]);if(_0x1642ef[_0xe11f('0x36')]){delete _0x1642ef[_0xe11f('0x36')];}_0x5163cb[_0xe11f('0x2e')](_0x51f124)[_0xe11f('0x37')](_0x1642ef);};}exports['index']=function(_0x406bb9,_0x56f53a){var _0x54ceb8={},_0x11e2f0={},_0x4aceda={'count':0x0,'rows':[]};var _0x315bec=_['map'](db[_0xe11f('0x38')][_0xe11f('0x39')],function(_0x351268){return{'name':_0x351268[_0xe11f('0x3a')],'type':_0x351268[_0xe11f('0x3b')][_0xe11f('0x3c')]};});_0x11e2f0['model']=_[_0xe11f('0x3d')](_0x315bec,_0xe11f('0x36'));_0x11e2f0['query']=_[_0xe11f('0x3e')](_0x406bb9['query']);_0x11e2f0[_0xe11f('0x3f')]=_[_0xe11f('0x40')](_0x11e2f0[_0xe11f('0x41')],_0x11e2f0[_0xe11f('0x42')]);_0x54ceb8['attributes']=_[_0xe11f('0x40')](_0x11e2f0[_0xe11f('0x41')],qs[_0xe11f('0x43')](_0x406bb9['query']['fields']));_0x54ceb8['attributes']=_0x54ceb8[_0xe11f('0x44')][_0xe11f('0x45')]?_0x54ceb8['attributes']:_0x11e2f0[_0xe11f('0x41')];if(!_0x406bb9[_0xe11f('0x42')][_0xe11f('0x46')](_0xe11f('0x47'))){_0x54ceb8[_0xe11f('0x48')]=qs[_0xe11f('0x48')](_0x406bb9[_0xe11f('0x42')]['limit']);_0x54ceb8['offset']=qs[_0xe11f('0x2d')](_0x406bb9[_0xe11f('0x42')][_0xe11f('0x2d')]);}_0x54ceb8[_0xe11f('0x49')]=qs['sort'](_0x406bb9[_0xe11f('0x42')][_0xe11f('0x4a')]);_0x54ceb8[_0xe11f('0x4b')]=qs['filters'](_[_0xe11f('0x4c')](_0x406bb9[_0xe11f('0x42')],_0x11e2f0[_0xe11f('0x3f')]),_0x315bec);if(_0x406bb9[_0xe11f('0x42')][_0xe11f('0x4d')]){_0x54ceb8['where']=_[_0xe11f('0x4e')](_0x54ceb8[_0xe11f('0x4b')],{'$or':_[_0xe11f('0x3d')](_0x315bec,function(_0x429ce5){if(_0x429ce5[_0xe11f('0x3b')]!==_0xe11f('0x4f')){var _0x4d1fb6={};_0x4d1fb6[_0x429ce5[_0xe11f('0x36')]]={'$like':'%'+_0x406bb9['query']['filter']+'%'};return _0x4d1fb6;}})});}_0x54ceb8=_['merge']({},_0x54ceb8,_0x406bb9['options']);var _0x4b335c={'where':_0x54ceb8[_0xe11f('0x4b')]};return db[_0xe11f('0x38')][_0xe11f('0x50')](_0x4b335c)[_0xe11f('0x20')](function(_0x1e2def){_0x4aceda[_0xe11f('0x50')]=_0x1e2def;if(_0x406bb9['query'][_0xe11f('0x51')]){_0x54ceb8['include']=[{'all':!![]}];}return db[_0xe11f('0x38')][_0xe11f('0x52')](_0x54ceb8);})['then'](function(_0x578b4b){_0x4aceda[_0xe11f('0x53')]=_0x578b4b;return _0x4aceda;})[_0xe11f('0x20')](respondWithFilteredResult(_0x56f53a,_0x54ceb8))[_0xe11f('0x29')](handleError(_0x56f53a,null));};exports[_0xe11f('0x54')]=function(_0x2609f7,_0x20b15c){var _0x23c109={'raw':![],'where':{'id':_0x2609f7[_0xe11f('0x55')]['id']}},_0x3ae289={};_0x3ae289[_0xe11f('0x41')]=_[_0xe11f('0x3e')](db[_0xe11f('0x38')]['rawAttributes']);_0x3ae289['query']=_['keys'](_0x2609f7[_0xe11f('0x42')]);_0x3ae289[_0xe11f('0x3f')]=_[_0xe11f('0x40')](_0x3ae289['model'],_0x3ae289[_0xe11f('0x42')]);_0x23c109[_0xe11f('0x44')]=_['intersection'](_0x3ae289[_0xe11f('0x41')],qs[_0xe11f('0x43')](_0x2609f7[_0xe11f('0x42')][_0xe11f('0x43')]));_0x23c109['attributes']=_0x23c109['attributes'][_0xe11f('0x45')]?_0x23c109['attributes']:_0x3ae289[_0xe11f('0x41')];if(_0x2609f7[_0xe11f('0x42')][_0xe11f('0x51')]){_0x23c109['include']=[{'all':!![]}];}_0x23c109=_[_0xe11f('0x4e')]({},_0x23c109,_0x2609f7[_0xe11f('0x56')]);return db[_0xe11f('0x38')][_0xe11f('0x57')](_0x23c109)[_0xe11f('0x20')](handleEntityNotFound(_0x20b15c,null))[_0xe11f('0x20')](respondWithResult(_0x20b15c,null))['catch'](handleError(_0x20b15c,null));};exports[_0xe11f('0x58')]=function(_0x2aec6d,_0x55b78e){return db[_0xe11f('0x38')][_0xe11f('0x58')](_0x2aec6d[_0xe11f('0x59')],{})[_0xe11f('0x20')](respondWithResult(_0x55b78e,0xc9))[_0xe11f('0x29')](handleError(_0x55b78e,null));};exports[_0xe11f('0x5a')]=function(_0x3ade65,_0x4a9678){if(_0x3ade65[_0xe11f('0x59')]['id']){delete _0x3ade65[_0xe11f('0x59')]['id'];}return db[_0xe11f('0x38')][_0xe11f('0x57')]({'where':{'id':_0x3ade65['params']['id']}})[_0xe11f('0x20')](handleEntityNotFound(_0x4a9678,null))[_0xe11f('0x20')](saveUpdates(_0x3ade65[_0xe11f('0x59')],null))[_0xe11f('0x20')](respondWithResult(_0x4a9678,null))['catch'](handleError(_0x4a9678,null));};exports[_0xe11f('0x34')]=function(_0x331a7b,_0x5f07bb){return db[_0xe11f('0x38')]['find']({'where':{'id':_0x331a7b[_0xe11f('0x55')]['id']}})[_0xe11f('0x20')](handleEntityNotFound(_0x5f07bb,null))[_0xe11f('0x20')](removeEntity(_0x5f07bb,null))[_0xe11f('0x29')](handleError(_0x5f07bb,null));};exports[_0xe11f('0x5b')]=function(_0x401f16,_0x1dfb48,_0xef7a91){var _0x3ac182={};var _0x32d42e={};var _0x4bbd90;var _0x406a05;return db[_0xe11f('0x38')][_0xe11f('0x5c')]({'where':{'id':_0x401f16[_0xe11f('0x55')]['id']}})[_0xe11f('0x20')](handleEntityNotFound(_0x1dfb48,null))['then'](function(_0x4153d6){if(_0x4153d6){_0x4bbd90=_0x4153d6;_0x32d42e[_0xe11f('0x41')]=_[_0xe11f('0x3e')](db[_0xe11f('0x5d')]['rawAttributes']);_0x32d42e['query']=_[_0xe11f('0x3e')](_0x401f16['query']);_0x32d42e[_0xe11f('0x3f')]=_[_0xe11f('0x40')](_0x32d42e[_0xe11f('0x41')],_0x32d42e[_0xe11f('0x42')]);_0x3ac182[_0xe11f('0x44')]=_[_0xe11f('0x40')](_0x32d42e[_0xe11f('0x41')],qs[_0xe11f('0x43')](_0x401f16[_0xe11f('0x42')][_0xe11f('0x43')]));_0x3ac182[_0xe11f('0x44')]=_0x3ac182[_0xe11f('0x44')][_0xe11f('0x45')]?_0x3ac182[_0xe11f('0x44')]:_0x32d42e[_0xe11f('0x41')];_0x3ac182['order']=qs[_0xe11f('0x4a')](_0x401f16[_0xe11f('0x42')][_0xe11f('0x4a')]);_0x3ac182[_0xe11f('0x4b')]=qs['filters'](_['pick'](_0x401f16[_0xe11f('0x42')],_0x32d42e[_0xe11f('0x3f')]));if(_0x401f16[_0xe11f('0x42')][_0xe11f('0x4d')]){_0x3ac182[_0xe11f('0x4b')]=_[_0xe11f('0x4e')](_0x3ac182[_0xe11f('0x4b')],{'$or':_[_0xe11f('0x3d')](_0x3ac182[_0xe11f('0x44')],function(_0x4ce14d){var _0x1ee8a1={};_0x1ee8a1[_0x4ce14d]={'$like':'%'+_0x401f16[_0xe11f('0x42')]['filter']+'%'};return _0x1ee8a1;})});}_0x3ac182=_[_0xe11f('0x4e')]({},_0x3ac182,_0x401f16[_0xe11f('0x56')]);return _0x4bbd90[_0xe11f('0x5b')](_0x3ac182);}})[_0xe11f('0x20')](function(_0x5df95e){if(_0x5df95e){_0x406a05=_0x5df95e[_0xe11f('0x45')];if(!_0x401f16[_0xe11f('0x42')][_0xe11f('0x46')](_0xe11f('0x47'))){_0x3ac182['limit']=qs[_0xe11f('0x48')](_0x401f16[_0xe11f('0x42')][_0xe11f('0x48')]);_0x3ac182[_0xe11f('0x2d')]=qs[_0xe11f('0x2d')](_0x401f16[_0xe11f('0x42')][_0xe11f('0x2d')]);}return _0x4bbd90[_0xe11f('0x5b')](_0x3ac182);}})[_0xe11f('0x20')](function(_0x8aba6){if(_0x8aba6){return _0x8aba6?{'count':_0x406a05,'rows':_0x8aba6}:null;}})[_0xe11f('0x20')](respondWithResult(_0x1dfb48,null))[_0xe11f('0x29')](handleError(_0x1dfb48,null));};exports[_0xe11f('0x5e')]=function(_0x19d434,_0x2c264c,_0x54a1b9){if(_0x19d434[_0xe11f('0x59')]['id']){delete _0x19d434[_0xe11f('0x59')]['id'];}return db[_0xe11f('0x38')][_0xe11f('0x5c')]({'where':{'id':_0x19d434[_0xe11f('0x55')]['id']}})[_0xe11f('0x20')](handleEntityNotFound(_0x2c264c,null))[_0xe11f('0x20')](function(_0x256901){if(_0x256901){_0x19d434[_0xe11f('0x59')]['AccountId']=_0x256901['id'];_0x19d434[_0xe11f('0x59')][_0xe11f('0x5f')]=integrations[_0xe11f('0x60')](_0x19d434['body'][_0xe11f('0x61')],_0x19d434[_0xe11f('0x59')][_0xe11f('0x3b')]);_0x19d434[_0xe11f('0x59')]['Descriptions']=integrations['getDescriptions'](_0x19d434[_0xe11f('0x59')][_0xe11f('0x61')],_0x19d434['body']['type']);return db[_0xe11f('0x5d')][_0xe11f('0x58')](_0x19d434[_0xe11f('0x59')],{'include':[{'model':db[_0xe11f('0x62')],'as':_0xe11f('0x5f')},{'model':db[_0xe11f('0x62')],'as':'Descriptions'}]});}return null;})[_0xe11f('0x20')](respondWithResult(_0x2c264c,null))['catch'](handleError(_0x2c264c,null));};exports['getFields']=function(_0x4c391e,_0x1c26a6,_0x4d3e08){var _0x28c47f='';var _0x25c186=['id',_0xe11f('0x36'),_0xe11f('0x63'),_0xe11f('0x64'),_0xe11f('0x65'),_0xe11f('0x66'),_0xe11f('0x67'),_0xe11f('0x68'),_0xe11f('0x69'),_0xe11f('0x6a'),_0xe11f('0x6b'),_0xe11f('0x6c')];return db[_0xe11f('0x38')][_0xe11f('0x5c')]({'where':{'id':_0x4c391e[_0xe11f('0x55')]['id']},'attributes':['id',_0xe11f('0x6d'),_0xe11f('0x6e'),_0xe11f('0x6f')]})['then'](handleEntityNotFound(_0x1c26a6,null))[_0xe11f('0x20')](function(_0x14e6b4){if(_0x14e6b4){_0x28c47f=_0x14e6b4[_0xe11f('0x6f')];var _0x5e2727=_0x28c47f[_0xe11f('0x70')](-0x1);if(_0x5e2727==='/'){_0x28c47f=_0x28c47f[_0xe11f('0x71')](0x0,_0x28c47f[_0xe11f('0x72')](_0x5e2727));}return rp({'method':'POST','uri':util[_0xe11f('0x73')](_0xe11f('0x74'),_0x28c47f,_0xe11f('0x75')),'json':!![],'form':{'method':_0xe11f('0x76'),'input_type':_0xe11f('0x77'),'response_type':_0xe11f('0x77'),'rest_data':JSON[_0xe11f('0x25')]({'user_auth':{'user_name':_0x14e6b4[_0xe11f('0x6d')],'password':_0x14e6b4[_0xe11f('0x6e')],'encryption':_0xe11f('0x78')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xe11f('0x20')](function(_0x4d295d){if(_0x4d295d&&_0x4d295d['name']!==_0xe11f('0x79')&&_0x4d295d[_0xe11f('0x36')]!==_0xe11f('0x7a')){return rp({'method':_0xe11f('0x7b'),'uri':util['format'](_0xe11f('0x74'),_0x28c47f,_0xe11f('0x75')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xe11f('0x77'),'response_type':_0xe11f('0x77'),'rest_data':JSON['stringify']({'session':_0x4d295d['id'],'module_name':_0xe11f('0x7c')})}})[_0xe11f('0x20')](function(_0x1cc7d0){if(_0x1cc7d0){var _0x436c5d=_[_0xe11f('0x7d')](_0x1cc7d0[_0xe11f('0x7e')]);_[_0xe11f('0x7f')](_0x436c5d,function(_0x37d06b){return _0x25c186['includes'](_0x37d06b[_0xe11f('0x36')]);});return{'count':_0x436c5d[_0xe11f('0x45')],'rows':_[_0xe11f('0x3d')](_0x436c5d,function(_0x4ff761){return{'id':_0x4ff761[_0xe11f('0x36')],'name':_0x4ff761[_0xe11f('0x80')],'custom':_[_0xe11f('0x81')](_0x4ff761[_0xe11f('0x36')],'_c')?!![]:![],'options':_0x4ff761[_0xe11f('0x56')]?_[_0xe11f('0x3d')](_['values'](_0x4ff761[_0xe11f('0x56')]),function(_0x22f4ff){return{'name':_0x22f4ff['value'],'value':_0x22f4ff['name']};}):[]};})};}})[_0xe11f('0x20')](respondWithResult(_0x1c26a6,null))['catch'](function(_0x5a0e45){var _0xc6af33=_0x4c391e[_0xe11f('0x42')][_0xe11f('0x1b')]?0x1f4:_0x5a0e45[_0xe11f('0x82')]||0x1f4;logger[_0xe11f('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0xe11f('0x83'),_0xc6af33,JSON[_0xe11f('0x25')](_0x5a0e45));delete _0x5a0e45[_0xe11f('0x36')];if(_0xc6af33===0x191){_0xc6af33=0x190;}_0x1c26a6[_0xe11f('0x2e')](_0xc6af33)[_0xe11f('0x37')](_0x4c391e[_0xe11f('0x42')][_0xe11f('0x1b')]?{'message':_0xe11f('0x84'),'statusCode':_0x5a0e45[_0xe11f('0x82')]}:_0x5a0e45);});}else{var _0x2b4f95=0x1f4;_0x1c26a6[_0xe11f('0x2e')](_0x2b4f95)[_0xe11f('0x37')]({'message':_0xe11f('0x84'),'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 58dc3f7..0f3b404 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 _0x7cf6=['api','bluebird','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','exports','lodash'];(function(_0x3e4547,_0x12a7e9){var _0x507529=function(_0x555fff){while(--_0x555fff){_0x3e4547['push'](_0x3e4547['shift']());}};_0x507529(++_0x12a7e9);}(_0x7cf6,0x1af));var _0x67cf=function(_0x59fb8f,_0x367a3a){_0x59fb8f=_0x59fb8f-0x0;var _0x3e7cf1=_0x7cf6[_0x59fb8f];return _0x3e7cf1;};'use strict';var _=require(_0x67cf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x67cf('0x1'));var moment=require('moment');var BPromise=require(_0x67cf('0x2'));var rp=require(_0x67cf('0x3'));var fs=require('fs');var path=require(_0x67cf('0x4'));var rimraf=require('rimraf');var config=require(_0x67cf('0x5'));var attributes=require(_0x67cf('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x67cf('0x7')]=function(_0x5b293f,_0x388b46){return _0x5b293f['define']('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ad1=['../../config/environment','define','int_sugarcrm_accounts','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x4d6f9e,_0x31f8f6){var _0x418145=function(_0x4801c5){while(--_0x4801c5){_0x4d6f9e['push'](_0x4d6f9e['shift']());}};_0x418145(++_0x31f8f6);}(_0x0ad1,0x1aa));var _0x10ad=function(_0x44a6b4,_0x252ecc){_0x44a6b4=_0x44a6b4-0x0;var _0x5255c8=_0x0ad1[_0x44a6b4];return _0x5255c8;};'use strict';var _=require(_0x10ad('0x0'));var util=require(_0x10ad('0x1'));var logger=require(_0x10ad('0x2'))(_0x10ad('0x3'));var moment=require('moment');var BPromise=require(_0x10ad('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x10ad('0x5'));var rimraf=require('rimraf');var config=require(_0x10ad('0x6'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5b75b2,_0x5d73a5){return _0x5b75b2[_0x10ad('0x7')]('SugarcrmAccount',attributes,{'tableName':_0x10ad('0x8'),'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 32569e2..df018c9 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 _0xe574=['options','raw','where','attributes','limit','include','model','map','stringify','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll'];(function(_0x131f0c,_0x3d8e5b){var _0x37af49=function(_0xfbcab0){while(--_0xfbcab0){_0x131f0c['push'](_0x131f0c['shift']());}};_0x37af49(++_0x3d8e5b);}(_0xe574,0x13b));var _0x4e57=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe574[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x4e57('0x0'));var util=require(_0x4e57('0x1'));var moment=require(_0x4e57('0x2'));var BPromise=require(_0x4e57('0x3'));var rs=require(_0x4e57('0x4'));var fs=require('fs');var Redis=require(_0x4e57('0x5'));var db=require(_0x4e57('0x6'))['db'];var utils=require(_0x4e57('0x7'));var logger=require(_0x4e57('0x8'))('rpc');var config=require(_0x4e57('0x9'));var jayson=require(_0x4e57('0xa'));var client=jayson[_0x4e57('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50a1d6,_0x17dd3e,_0x36153f){return new BPromise(function(_0x5d6260,_0xfc94d){return client[_0x4e57('0xc')](_0x50a1d6,_0x36153f)[_0x4e57('0xd')](function(_0xae75d5){logger[_0x4e57('0xe')](_0x4e57('0xf'),_0x17dd3e,_0x4e57('0x10'));logger[_0x4e57('0x11')](_0x4e57('0x12'),_0x17dd3e,'request\x20sent',JSON['stringify'](_0xae75d5));if(_0xae75d5[_0x4e57('0x13')]){if(_0xae75d5[_0x4e57('0x13')][_0x4e57('0x14')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x17dd3e,_0xae75d5[_0x4e57('0x13')][_0x4e57('0x15')]);return _0xfc94d(_0xae75d5[_0x4e57('0x13')][_0x4e57('0x15')]);}logger['error'](_0x4e57('0xf'),_0x17dd3e,_0xae75d5[_0x4e57('0x13')][_0x4e57('0x15')]);return _0x5d6260(_0xae75d5['error'][_0x4e57('0x15')]);}else{logger[_0x4e57('0xe')](_0x4e57('0xf'),_0x17dd3e,_0x4e57('0x10'));_0x5d6260(_0xae75d5[_0x4e57('0x16')][_0x4e57('0x15')]);}})[_0x4e57('0x17')](function(_0x3e3cf6){logger[_0x4e57('0x13')](_0x4e57('0xf'),_0x17dd3e,_0x3e3cf6);_0xfc94d(_0x3e3cf6);});});}exports[_0x4e57('0x18')]=function(_0x83d100){var _0x2f05d7=this;return new Promise(function(_0x498338,_0x21822f){return db[_0x4e57('0x19')][_0x4e57('0x1a')]({'raw':_0x83d100['options']?_0x83d100[_0x4e57('0x1b')][_0x4e57('0x1c')]===undefined?!![]:![]:!![],'where':_0x83d100[_0x4e57('0x1b')]?_0x83d100[_0x4e57('0x1b')][_0x4e57('0x1d')]||null:null,'attributes':_0x83d100[_0x4e57('0x1b')]?_0x83d100[_0x4e57('0x1b')][_0x4e57('0x1e')]||null:null,'limit':_0x83d100[_0x4e57('0x1b')]?_0x83d100[_0x4e57('0x1b')][_0x4e57('0x1f')]||null:null,'include':_0x83d100[_0x4e57('0x1b')]?_0x83d100[_0x4e57('0x1b')][_0x4e57('0x20')]?_['map'](_0x83d100[_0x4e57('0x1b')]['include'],function(_0x5320a2){return{'model':db[_0x5320a2[_0x4e57('0x21')]],'as':_0x5320a2['as'],'attributes':_0x5320a2[_0x4e57('0x1e')],'include':_0x5320a2['include']?_[_0x4e57('0x22')](_0x5320a2['include'],function(_0xe0da52){return{'model':db[_0xe0da52[_0x4e57('0x21')]],'as':_0xe0da52['as'],'attributes':_0xe0da52[_0x4e57('0x1e')],'include':_0xe0da52['include']?_[_0x4e57('0x22')](_0xe0da52[_0x4e57('0x20')],function(_0x3009bf){return{'model':db[_0x3009bf[_0x4e57('0x21')]],'as':_0x3009bf['as'],'attributes':_0x3009bf[_0x4e57('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4e57('0xd')](function(_0x299c99){logger['info'](_0x4e57('0x18'),_0x83d100);logger[_0x4e57('0x11')](_0x4e57('0x18'),_0x83d100,JSON[_0x4e57('0x23')](_0x299c99));_0x498338(_0x299c99);})[_0x4e57('0x17')](function(_0x1b0023){logger[_0x4e57('0x13')](_0x4e57('0x18'),_0x1b0023[_0x4e57('0x15')],_0x83d100);_0x21822f(_0x2f05d7[_0x4e57('0x13')](0x1f4,_0x1b0023[_0x4e57('0x15')]));});});};exports[_0x4e57('0x24')]=function(_0x2b9df7){var _0x123377=this;return new Promise(function(_0x4dce87,_0x3897ad){return db[_0x4e57('0x19')][_0x4e57('0x25')]({'raw':_0x2b9df7[_0x4e57('0x1b')]?_0x2b9df7[_0x4e57('0x1b')][_0x4e57('0x1c')]===undefined?!![]:![]:!![],'where':_0x2b9df7[_0x4e57('0x1b')]?_0x2b9df7[_0x4e57('0x1b')][_0x4e57('0x1d')]||null:null,'attributes':_0x2b9df7[_0x4e57('0x1b')]?_0x2b9df7[_0x4e57('0x1b')]['attributes']||null:null,'include':_0x2b9df7[_0x4e57('0x1b')]?_0x2b9df7['options'][_0x4e57('0x20')]?_[_0x4e57('0x22')](_0x2b9df7[_0x4e57('0x1b')][_0x4e57('0x20')],function(_0x3419d4){return{'model':db[_0x3419d4[_0x4e57('0x21')]],'as':_0x3419d4['as'],'attributes':_0x3419d4[_0x4e57('0x1e')],'include':_0x3419d4['include']?_[_0x4e57('0x22')](_0x3419d4[_0x4e57('0x20')],function(_0x54ba30){return{'model':db[_0x54ba30[_0x4e57('0x21')]],'as':_0x54ba30['as'],'attributes':_0x54ba30[_0x4e57('0x1e')],'include':_0x54ba30[_0x4e57('0x20')]?_[_0x4e57('0x22')](_0x54ba30[_0x4e57('0x20')],function(_0x5ac6c1){return{'model':db[_0x5ac6c1[_0x4e57('0x21')]],'as':_0x5ac6c1['as'],'attributes':_0x5ac6c1[_0x4e57('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4e57('0xd')](function(_0x2749fd){logger[_0x4e57('0xe')](_0x4e57('0x24'),_0x2b9df7);logger['debug'](_0x4e57('0x24'),_0x2b9df7,JSON['stringify'](_0x2749fd));_0x4dce87(_0x2749fd);})[_0x4e57('0x17')](function(_0x27273b){logger[_0x4e57('0x13')](_0x4e57('0x24'),_0x27273b[_0x4e57('0x15')],_0x2b9df7);_0x3897ad(_0x123377[_0x4e57('0x13')](0x1f4,_0x27273b[_0x4e57('0x15')]));});});}; \ No newline at end of file +var _0x379e=['raw','where','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','GetSugarcrmAccount','findAll','options','attributes','limit','map','include','model','ShowSugarcrmAccount','SugarcrmAccount','find'];(function(_0x55fb83,_0x1d3856){var _0x59a87a=function(_0x38bdd1){while(--_0x38bdd1){_0x55fb83['push'](_0x55fb83['shift']());}};_0x59a87a(++_0x1d3856);}(_0x379e,0x12a));var _0xe379=function(_0x32e98a,_0x3cfdc6){_0x32e98a=_0x32e98a-0x0;var _0x2281b8=_0x379e[_0x32e98a];return _0x2281b8;};'use strict';var _=require(_0xe379('0x0'));var util=require('util');var moment=require(_0xe379('0x1'));var BPromise=require(_0xe379('0x2'));var rs=require(_0xe379('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe379('0x4'))['db'];var utils=require(_0xe379('0x5'));var logger=require(_0xe379('0x6'))(_0xe379('0x7'));var config=require(_0xe379('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe379('0x9')][_0xe379('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1cd9bc,_0x45c3c4,_0x194c72){return new BPromise(function(_0x1731c3,_0xa8dfac){return client[_0xe379('0xb')](_0x1cd9bc,_0x194c72)[_0xe379('0xc')](function(_0x5e0709){logger[_0xe379('0xd')](_0xe379('0xe'),_0x45c3c4,'request\x20sent');logger[_0xe379('0xf')](_0xe379('0x10'),_0x45c3c4,'request\x20sent',JSON[_0xe379('0x11')](_0x5e0709));if(_0x5e0709['error']){if(_0x5e0709['error'][_0xe379('0x12')]===0x1f4){logger[_0xe379('0x13')](_0xe379('0xe'),_0x45c3c4,_0x5e0709[_0xe379('0x13')][_0xe379('0x14')]);return _0xa8dfac(_0x5e0709['error']['message']);}logger[_0xe379('0x13')](_0xe379('0xe'),_0x45c3c4,_0x5e0709[_0xe379('0x13')][_0xe379('0x14')]);return _0x1731c3(_0x5e0709['error'][_0xe379('0x14')]);}else{logger[_0xe379('0xd')](_0xe379('0xe'),_0x45c3c4,_0xe379('0x15'));_0x1731c3(_0x5e0709[_0xe379('0x16')]['message']);}})[_0xe379('0x17')](function(_0x361ecf){logger[_0xe379('0x13')](_0xe379('0xe'),_0x45c3c4,_0x361ecf);_0xa8dfac(_0x361ecf);});});}exports[_0xe379('0x18')]=function(_0x3f8bed){var _0x15741e=this;return new Promise(function(_0x1b4842,_0x464228){return db['SugarcrmAccount'][_0xe379('0x19')]({'raw':_0x3f8bed['options']?_0x3f8bed[_0xe379('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3f8bed[_0xe379('0x1a')]?_0x3f8bed[_0xe379('0x1a')]['where']||null:null,'attributes':_0x3f8bed[_0xe379('0x1a')]?_0x3f8bed['options'][_0xe379('0x1b')]||null:null,'limit':_0x3f8bed[_0xe379('0x1a')]?_0x3f8bed['options'][_0xe379('0x1c')]||null:null,'include':_0x3f8bed[_0xe379('0x1a')]?_0x3f8bed[_0xe379('0x1a')]['include']?_[_0xe379('0x1d')](_0x3f8bed[_0xe379('0x1a')][_0xe379('0x1e')],function(_0x3dd958){return{'model':db[_0x3dd958[_0xe379('0x1f')]],'as':_0x3dd958['as'],'attributes':_0x3dd958[_0xe379('0x1b')],'include':_0x3dd958['include']?_[_0xe379('0x1d')](_0x3dd958['include'],function(_0x49f33a){return{'model':db[_0x49f33a[_0xe379('0x1f')]],'as':_0x49f33a['as'],'attributes':_0x49f33a[_0xe379('0x1b')],'include':_0x49f33a['include']?_[_0xe379('0x1d')](_0x49f33a['include'],function(_0x266c81){return{'model':db[_0x266c81[_0xe379('0x1f')]],'as':_0x266c81['as'],'attributes':_0x266c81[_0xe379('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe379('0xc')](function(_0x53cdd4){logger['info'](_0xe379('0x18'),_0x3f8bed);logger['debug'](_0xe379('0x18'),_0x3f8bed,JSON['stringify'](_0x53cdd4));_0x1b4842(_0x53cdd4);})[_0xe379('0x17')](function(_0x4a0284){logger[_0xe379('0x13')](_0xe379('0x18'),_0x4a0284[_0xe379('0x14')],_0x3f8bed);_0x464228(_0x15741e['error'](0x1f4,_0x4a0284[_0xe379('0x14')]));});});};exports[_0xe379('0x20')]=function(_0x505212){var _0xc5b356=this;return new Promise(function(_0x4f7588,_0x4f1481){return db[_0xe379('0x21')][_0xe379('0x22')]({'raw':_0x505212['options']?_0x505212[_0xe379('0x1a')][_0xe379('0x23')]===undefined?!![]:![]:!![],'where':_0x505212[_0xe379('0x1a')]?_0x505212[_0xe379('0x1a')][_0xe379('0x24')]||null:null,'attributes':_0x505212[_0xe379('0x1a')]?_0x505212[_0xe379('0x1a')][_0xe379('0x1b')]||null:null,'include':_0x505212['options']?_0x505212[_0xe379('0x1a')][_0xe379('0x1e')]?_[_0xe379('0x1d')](_0x505212['options'][_0xe379('0x1e')],function(_0xcefc9b){return{'model':db[_0xcefc9b[_0xe379('0x1f')]],'as':_0xcefc9b['as'],'attributes':_0xcefc9b[_0xe379('0x1b')],'include':_0xcefc9b[_0xe379('0x1e')]?_[_0xe379('0x1d')](_0xcefc9b[_0xe379('0x1e')],function(_0x131fc4){return{'model':db[_0x131fc4[_0xe379('0x1f')]],'as':_0x131fc4['as'],'attributes':_0x131fc4[_0xe379('0x1b')],'include':_0x131fc4[_0xe379('0x1e')]?_[_0xe379('0x1d')](_0x131fc4[_0xe379('0x1e')],function(_0xea2f3d){return{'model':db[_0xea2f3d[_0xe379('0x1f')]],'as':_0xea2f3d['as'],'attributes':_0xea2f3d[_0xe379('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe379('0xc')](function(_0x2082c5){logger['info'](_0xe379('0x20'),_0x505212);logger[_0xe379('0xf')](_0xe379('0x20'),_0x505212,JSON[_0xe379('0x11')](_0x2082c5));_0x4f7588(_0x2082c5);})[_0xe379('0x17')](function(_0x2ba6b5){logger[_0xe379('0x13')]('ShowSugarcrmAccount',_0x2ba6b5[_0xe379('0x14')],_0x505212);_0x4f1481(_0xc5b356[_0xe379('0x13')](0x1f4,_0x2ba6b5[_0xe379('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 26f5f06..f4b83e2 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 _0x0f85=['/:id/descriptions','getDescriptions','post','create','put','update','destroy','multer','util','path','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getFields','getSubjects'];(function(_0x4abd5a,_0x2909ae){var _0x2dedda=function(_0x1733c9){while(--_0x1733c9){_0x4abd5a['push'](_0x4abd5a['shift']());}};_0x2dedda(++_0x2909ae);}(_0x0f85,0x1e7));var _0x50f8=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x0f85[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0x50f8('0x0'));var util=require(_0x50f8('0x1'));var path=require(_0x50f8('0x2'));var timeout=require('connect-timeout');var express=require(_0x50f8('0x3'));var router=express['Router']();var auth=require(_0x50f8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x50f8('0x5'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x50f8('0x6')]('/',auth[_0x50f8('0x7')](),controller[_0x50f8('0x8')]);router[_0x50f8('0x6')](_0x50f8('0x9'),auth[_0x50f8('0x7')](),controller[_0x50f8('0xa')]);router[_0x50f8('0x6')]('/:id/fields',auth[_0x50f8('0x7')](),controller[_0x50f8('0xb')]);router['get']('/:id/subjects',auth[_0x50f8('0x7')](),controller[_0x50f8('0xc')]);router[_0x50f8('0x6')](_0x50f8('0xd'),auth[_0x50f8('0x7')](),controller[_0x50f8('0xe')]);router[_0x50f8('0xf')]('/',auth[_0x50f8('0x7')](),controller[_0x50f8('0x10')]);router[_0x50f8('0x11')](_0x50f8('0x9'),auth[_0x50f8('0x7')](),controller[_0x50f8('0x12')]);router['delete'](_0x50f8('0x9'),auth[_0x50f8('0x7')](),controller[_0x50f8('0x13')]);module['exports']=router; \ No newline at end of file +var _0x5059=['put','/:id','update','delete','destroy','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create'];(function(_0x2fa633,_0x1e5cb6){var _0x14f855=function(_0x1db6e8){while(--_0x1db6e8){_0x2fa633['push'](_0x2fa633['shift']());}};_0x14f855(++_0x1e5cb6);}(_0x5059,0x15e));var _0x9505=function(_0x587ba2,_0x42eb40){_0x587ba2=_0x587ba2-0x0;var _0x50ec73=_0x5059[_0x587ba2];return _0x50ec73;};'use strict';var multer=require('multer');var util=require(_0x9505('0x0'));var path=require(_0x9505('0x1'));var timeout=require(_0x9505('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x9505('0x3'));var interaction=require(_0x9505('0x4'));var config=require(_0x9505('0x5'));var controller=require(_0x9505('0x6'));router[_0x9505('0x7')]('/',auth[_0x9505('0x8')](),controller[_0x9505('0x9')]);router[_0x9505('0x7')]('/:id',auth[_0x9505('0x8')](),controller[_0x9505('0xa')]);router[_0x9505('0x7')](_0x9505('0xb'),auth['isAuthenticated'](),controller[_0x9505('0xc')]);router['get'](_0x9505('0xd'),auth[_0x9505('0x8')](),controller[_0x9505('0xe')]);router[_0x9505('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x9505('0xf')]);router[_0x9505('0x10')]('/',auth[_0x9505('0x8')](),controller[_0x9505('0x11')]);router[_0x9505('0x12')](_0x9505('0x13'),auth[_0x9505('0x8')](),controller[_0x9505('0x14')]);router[_0x9505('0x15')]('/:id',auth[_0x9505('0x8')](),controller[_0x9505('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 8109a79..b020555 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 _0x249e=['STRING','exports'];(function(_0x30d6fe,_0x4001c7){var _0x55229e=function(_0x3bfec4){while(--_0x3bfec4){_0x30d6fe['push'](_0x30d6fe['shift']());}};_0x55229e(++_0x4001c7);}(_0x249e,0x1cf));var _0xe249=function(_0x1e5a25,_0x3b5a85){_0x1e5a25=_0x1e5a25-0x0;var _0x176d9c=_0x249e[_0x1e5a25];return _0x176d9c;};'use strict';var Sequelize=require('sequelize');module[_0xe249('0x0')]={'name':{'type':Sequelize[_0xe249('0x1')]},'description':{'type':Sequelize[_0xe249('0x1')]}}; \ No newline at end of file +var _0xf56d=['STRING','exports'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xf56d,0x19d));var _0xdf56=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf56d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xdf56('0x0')]={'name':{'type':Sequelize[_0xdf56('0x1')]},'description':{'type':Sequelize[_0xdf56('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index b6eea8a..777b6ea 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 _0x61b6=['includeAll','include','findAll','rows','show','params','length','find','create','body','getFields','findOne','SugarcrmField','filter','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','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/environment','../../mysqldb','jayson/promise','http','test','ValidationError','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','map','SugarcrmConfiguration','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','options','count'];(function(_0x57419b,_0x403310){var _0x1ddb2d=function(_0x3df9ba){while(--_0x3df9ba){_0x57419b['push'](_0x57419b['shift']());}};_0x1ddb2d(++_0x403310);}(_0x61b6,0x180));var _0x661b=function(_0x38ead8,_0xc39408){_0x38ead8=_0x38ead8-0x0;var _0x210ce0=_0x61b6[_0x38ead8];return _0x210ce0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x661b('0x0'));var zipdir=require(_0x661b('0x1'));var jsonpatch=require(_0x661b('0x2'));var rp=require('request-promise');var moment=require(_0x661b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x661b('0x4'));var util=require('util');var path=require(_0x661b('0x5'));var sox=require(_0x661b('0x6'));var csv=require(_0x661b('0x7'));var ejs=require(_0x661b('0x8'));var fs=require('fs');var _=require(_0x661b('0x9'));var squel=require(_0x661b('0xa'));var crypto=require(_0x661b('0xb'));var jsforce=require(_0x661b('0xc'));var deskjs=require(_0x661b('0xd'));var toCsv=require(_0x661b('0x7'));var querystring=require(_0x661b('0xe'));var Papa=require(_0x661b('0xf'));var Redis=require(_0x661b('0x10'));var authService=require(_0x661b('0x11'));var qs=require(_0x661b('0x12'));var as=require(_0x661b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x661b('0x14'))(_0x661b('0x15'));var utils=require('../../config/utils');var config=require(_0x661b('0x16'));var db=require(_0x661b('0x17'))['db'];var jayson=require(_0x661b('0x18'));var client=jayson['client'][_0x661b('0x19')]({'port':0x232a});function checkPasswordPattern(_0x4c288c,_0xbe2a5b,_0x51e0b4){if(_0x51e0b4){var _0x139821=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x139821[_0x661b('0x1a')](_0xbe2a5b)){return _0x4c288c;}else{throw new db['Sequelize'][(_0x661b('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 _0x4c288c;}}function respondWithRpcPromise(_0x3b0581,_0x20bcfa,_0x38a416,_0x58a691){return new BPromise(function(_0x156cdd,_0xa610f5){var _0x5beab1=_0x58a691||client;return _0x5beab1[_0x661b('0x1c')](_0x3b0581,_0x38a416)[_0x661b('0x1d')](function(_0x1e3665){logger[_0x661b('0x1e')](_0x661b('0x1f'),_0x20bcfa,'request\x20sent');logger['debug'](_0x661b('0x20'),_0x20bcfa,_0x661b('0x21'),JSON[_0x661b('0x22')](_0x1e3665));if(_0x1e3665['error']){if(_0x1e3665[_0x661b('0x23')][_0x661b('0x24')]===0x1f4){logger[_0x661b('0x23')](_0x661b('0x1f'),_0x20bcfa,_0x1e3665[_0x661b('0x23')][_0x661b('0x25')]);return _0xa610f5(_0x1e3665['error'][_0x661b('0x25')]);}logger['error'](_0x661b('0x1f'),_0x20bcfa,_0x1e3665[_0x661b('0x23')][_0x661b('0x25')]);return _0x156cdd(_0x1e3665[_0x661b('0x23')][_0x661b('0x25')]);}else{logger['info'](_0x661b('0x1f'),_0x20bcfa,_0x661b('0x21'));_0x156cdd(_0x1e3665[_0x661b('0x26')][_0x661b('0x25')]);}})[_0x661b('0x27')](function(_0x44c1f7){logger['error'](_0x661b('0x1f'),_0x20bcfa,_0x44c1f7);_0xa610f5(_0x44c1f7);});});}function respondWithStatusCode(_0x106108,_0x1fa969){_0x1fa969=_0x1fa969||0xcc;return function(_0x129ed8){if(_0x129ed8){return _0x106108[_0x661b('0x28')](_0x1fa969);}return _0x106108[_0x661b('0x29')](_0x1fa969)[_0x661b('0x2a')]();};}function respondWithResult(_0x57ef81,_0x20fdff){_0x20fdff=_0x20fdff||0xc8;return function(_0x24cf58){if(_0x24cf58){return _0x57ef81[_0x661b('0x29')](_0x20fdff)[_0x661b('0x2b')](_0x24cf58);}};}function respondWithFilteredResult(_0x96457,_0x1f51f6){return function(_0x17c9f0){if(_0x17c9f0){var _0x2f03a7=_0x17c9f0['count'],_0x144dab=_0x1f51f6[_0x661b('0x2c')],_0x581cac=_0x1f51f6['offset']+_0x1f51f6[_0x661b('0x2d')],_0x54637b;if(_0x581cac>=_0x2f03a7){_0x581cac=_0x2f03a7;_0x54637b=0xc8;}else{_0x54637b=0xce;}_0x96457[_0x661b('0x29')](_0x54637b);return _0x96457[_0x661b('0x2e')](_0x661b('0x2f'),_0x144dab+'-'+_0x581cac+'/'+_0x2f03a7)[_0x661b('0x2b')](_0x17c9f0);}return null;};}function patchUpdates(_0x532ab9){return function(_0xd8a1db){try{jsonpatch[_0x661b('0x30')](_0xd8a1db,_0x532ab9,!![]);}catch(_0x1d5b8a){return BPromise[_0x661b('0x31')](_0x1d5b8a);}return _0xd8a1db[_0x661b('0x32')]();};}function saveUpdates(_0x5483ed,_0x15e6ab){return function(_0x3789a0){if(_0x3789a0){return _0x3789a0[_0x661b('0x33')](_0x5483ed)[_0x661b('0x1d')](function(_0x4de324){return _0x4de324;});}return null;};}function removeEntity(_0x464798,_0x5edda5){return function(_0x5354ec){if(_0x5354ec){return _0x5354ec[_0x661b('0x34')]()[_0x661b('0x1d')](function(){_0x464798['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ab0ab,_0x3e8e4d){return function(_0x1cecfd){if(!_0x1cecfd){_0x2ab0ab[_0x661b('0x28')](0x194);}return _0x1cecfd;};}function handleError(_0x499abc,_0x3a743f){_0x3a743f=_0x3a743f||0x1f4;return function(_0x292d2b){logger[_0x661b('0x23')](_0x292d2b['stack']);if(_0x292d2b['name']){delete _0x292d2b[_0x661b('0x35')];}_0x499abc[_0x661b('0x29')](_0x3a743f)[_0x661b('0x36')](_0x292d2b);};}exports['index']=function(_0x303039,_0x4c4dc2){var _0x2a742a={},_0x35c545={},_0x181ce3={'count':0x0,'rows':[]};var _0x4b3788=_[_0x661b('0x37')](db[_0x661b('0x38')][_0x661b('0x39')],function(_0x13fe5b){return{'name':_0x13fe5b['fieldName'],'type':_0x13fe5b['type'][_0x661b('0x3a')]};});_0x35c545[_0x661b('0x3b')]=_[_0x661b('0x37')](_0x4b3788,_0x661b('0x35'));_0x35c545[_0x661b('0x3c')]=_[_0x661b('0x3d')](_0x303039[_0x661b('0x3c')]);_0x35c545[_0x661b('0x3e')]=_[_0x661b('0x3f')](_0x35c545[_0x661b('0x3b')],_0x35c545[_0x661b('0x3c')]);_0x2a742a['attributes']=_[_0x661b('0x3f')](_0x35c545[_0x661b('0x3b')],qs[_0x661b('0x40')](_0x303039[_0x661b('0x3c')][_0x661b('0x40')]));_0x2a742a[_0x661b('0x41')]=_0x2a742a[_0x661b('0x41')]['length']?_0x2a742a[_0x661b('0x41')]:_0x35c545[_0x661b('0x3b')];if(!_0x303039['query'][_0x661b('0x42')](_0x661b('0x43'))){_0x2a742a[_0x661b('0x2d')]=qs['limit'](_0x303039[_0x661b('0x3c')][_0x661b('0x2d')]);_0x2a742a[_0x661b('0x2c')]=qs[_0x661b('0x2c')](_0x303039['query'][_0x661b('0x2c')]);}_0x2a742a[_0x661b('0x44')]=qs[_0x661b('0x45')](_0x303039[_0x661b('0x3c')][_0x661b('0x45')]);_0x2a742a['where']=qs['filters'](_[_0x661b('0x46')](_0x303039[_0x661b('0x3c')],_0x35c545[_0x661b('0x3e')]),_0x4b3788);if(_0x303039[_0x661b('0x3c')]['filter']){_0x2a742a[_0x661b('0x47')]=_[_0x661b('0x48')](_0x2a742a[_0x661b('0x47')],{'$or':_[_0x661b('0x37')](_0x4b3788,function(_0xc21c29){if(_0xc21c29[_0x661b('0x49')]!=='VIRTUAL'){var _0x46063c={};_0x46063c[_0xc21c29[_0x661b('0x35')]]={'$like':'%'+_0x303039[_0x661b('0x3c')]['filter']+'%'};return _0x46063c;}})});}_0x2a742a=_[_0x661b('0x48')]({},_0x2a742a,_0x303039[_0x661b('0x4a')]);var _0x54b186={'where':_0x2a742a[_0x661b('0x47')]};return db['SugarcrmConfiguration'][_0x661b('0x4b')](_0x54b186)[_0x661b('0x1d')](function(_0x33ec03){_0x181ce3['count']=_0x33ec03;if(_0x303039[_0x661b('0x3c')][_0x661b('0x4c')]){_0x2a742a[_0x661b('0x4d')]=[{'all':!![]}];}return db[_0x661b('0x38')][_0x661b('0x4e')](_0x2a742a);})['then'](function(_0x4de9ae){_0x181ce3[_0x661b('0x4f')]=_0x4de9ae;return _0x181ce3;})[_0x661b('0x1d')](respondWithFilteredResult(_0x4c4dc2,_0x2a742a))[_0x661b('0x27')](handleError(_0x4c4dc2,null));};exports[_0x661b('0x50')]=function(_0x3373a7,_0x5f9fc8){var _0x3bc033={'raw':![],'where':{'id':_0x3373a7[_0x661b('0x51')]['id']}},_0x24edaa={};_0x24edaa['model']=_['keys'](db[_0x661b('0x38')][_0x661b('0x39')]);_0x24edaa[_0x661b('0x3c')]=_[_0x661b('0x3d')](_0x3373a7[_0x661b('0x3c')]);_0x24edaa[_0x661b('0x3e')]=_['intersection'](_0x24edaa[_0x661b('0x3b')],_0x24edaa[_0x661b('0x3c')]);_0x3bc033[_0x661b('0x41')]=_[_0x661b('0x3f')](_0x24edaa[_0x661b('0x3b')],qs[_0x661b('0x40')](_0x3373a7[_0x661b('0x3c')][_0x661b('0x40')]));_0x3bc033[_0x661b('0x41')]=_0x3bc033[_0x661b('0x41')][_0x661b('0x52')]?_0x3bc033[_0x661b('0x41')]:_0x24edaa[_0x661b('0x3b')];if(_0x3373a7['query']['includeAll']){_0x3bc033[_0x661b('0x4d')]=[{'all':!![]}];}_0x3bc033=_[_0x661b('0x48')]({},_0x3bc033,_0x3373a7[_0x661b('0x4a')]);return db['SugarcrmConfiguration'][_0x661b('0x53')](_0x3bc033)[_0x661b('0x1d')](handleEntityNotFound(_0x5f9fc8,null))[_0x661b('0x1d')](respondWithResult(_0x5f9fc8,null))[_0x661b('0x27')](handleError(_0x5f9fc8,null));};exports[_0x661b('0x54')]=function(_0x2f0418,_0x3c6338){return db[_0x661b('0x38')]['create'](_0x2f0418['body'],{})['then'](respondWithResult(_0x3c6338,0xc9))['catch'](handleError(_0x3c6338,null));};exports[_0x661b('0x33')]=function(_0x426c40,_0x1bee78){if(_0x426c40[_0x661b('0x55')]['id']){delete _0x426c40[_0x661b('0x55')]['id'];}return db[_0x661b('0x38')][_0x661b('0x53')]({'where':{'id':_0x426c40[_0x661b('0x51')]['id']}})[_0x661b('0x1d')](handleEntityNotFound(_0x1bee78,null))[_0x661b('0x1d')](saveUpdates(_0x426c40[_0x661b('0x55')],null))[_0x661b('0x1d')](respondWithResult(_0x1bee78,null))[_0x661b('0x27')](handleError(_0x1bee78,null));};exports[_0x661b('0x34')]=function(_0x46c0c7,_0x2f32d1){return db['SugarcrmConfiguration'][_0x661b('0x53')]({'where':{'id':_0x46c0c7[_0x661b('0x51')]['id']}})[_0x661b('0x1d')](handleEntityNotFound(_0x2f32d1,null))[_0x661b('0x1d')](removeEntity(_0x2f32d1,null))['catch'](handleError(_0x2f32d1,null));};exports[_0x661b('0x56')]=function(_0x2c26bb,_0x1a9f7b,_0xadb1d){var _0x54bdb3={};var _0x58c48f={};var _0xe7fad1;var _0x2d0891;return db[_0x661b('0x38')][_0x661b('0x57')]({'where':{'id':_0x2c26bb['params']['id']}})[_0x661b('0x1d')](handleEntityNotFound(_0x1a9f7b,null))[_0x661b('0x1d')](function(_0x2cd366){if(_0x2cd366){_0xe7fad1=_0x2cd366;_0x58c48f[_0x661b('0x3b')]=_[_0x661b('0x3d')](db[_0x661b('0x58')][_0x661b('0x39')]);_0x58c48f['query']=_[_0x661b('0x3d')](_0x2c26bb[_0x661b('0x3c')]);_0x58c48f['filters']=_[_0x661b('0x3f')](_0x58c48f[_0x661b('0x3b')],_0x58c48f[_0x661b('0x3c')]);_0x54bdb3['attributes']=_[_0x661b('0x3f')](_0x58c48f[_0x661b('0x3b')],qs[_0x661b('0x40')](_0x2c26bb[_0x661b('0x3c')][_0x661b('0x40')]));_0x54bdb3['attributes']=_0x54bdb3[_0x661b('0x41')][_0x661b('0x52')]?_0x54bdb3['attributes']:_0x58c48f['model'];_0x54bdb3[_0x661b('0x44')]=qs['sort'](_0x2c26bb[_0x661b('0x3c')][_0x661b('0x45')]);_0x54bdb3[_0x661b('0x47')]=qs[_0x661b('0x3e')](_['pick'](_0x2c26bb[_0x661b('0x3c')],_0x58c48f[_0x661b('0x3e')]));if(_0x2c26bb['query']['filter']){_0x54bdb3[_0x661b('0x47')]=_[_0x661b('0x48')](_0x54bdb3[_0x661b('0x47')],{'$or':_['map'](_0x54bdb3[_0x661b('0x41')],function(_0x28be8a){var _0x57ec9f={};_0x57ec9f[_0x28be8a]={'$like':'%'+_0x2c26bb[_0x661b('0x3c')][_0x661b('0x59')]+'%'};return _0x57ec9f;})});}_0x54bdb3=_['merge']({},_0x54bdb3,_0x2c26bb[_0x661b('0x4a')]);return _0xe7fad1[_0x661b('0x56')](_0x54bdb3);}})[_0x661b('0x1d')](function(_0x5d1b43){if(_0x5d1b43){_0x2d0891=_0x5d1b43['length'];if(!_0x2c26bb['query'][_0x661b('0x42')](_0x661b('0x43'))){_0x54bdb3[_0x661b('0x2d')]=qs[_0x661b('0x2d')](_0x2c26bb[_0x661b('0x3c')]['limit']);_0x54bdb3[_0x661b('0x2c')]=qs['offset'](_0x2c26bb['query'][_0x661b('0x2c')]);}return _0xe7fad1[_0x661b('0x56')](_0x54bdb3);}})[_0x661b('0x1d')](function(_0x183643){if(_0x183643){return _0x183643?{'count':_0x2d0891,'rows':_0x183643}:null;}})[_0x661b('0x1d')](respondWithResult(_0x1a9f7b,null))[_0x661b('0x27')](handleError(_0x1a9f7b,null));};exports[_0x661b('0x5a')]=function(_0x1c5a38,_0x1d4521,_0x381b55){var _0x12de45={};var _0x574d98={};var _0x2c79f7;var _0xcc0985;return db[_0x661b('0x38')][_0x661b('0x57')]({'where':{'id':_0x1c5a38[_0x661b('0x51')]['id']}})[_0x661b('0x1d')](handleEntityNotFound(_0x1d4521,null))[_0x661b('0x1d')](function(_0x127f15){if(_0x127f15){_0x2c79f7=_0x127f15;_0x574d98[_0x661b('0x3b')]=_[_0x661b('0x3d')](db[_0x661b('0x58')][_0x661b('0x39')]);_0x574d98[_0x661b('0x3c')]=_['keys'](_0x1c5a38[_0x661b('0x3c')]);_0x574d98[_0x661b('0x3e')]=_['intersection'](_0x574d98['model'],_0x574d98[_0x661b('0x3c')]);_0x12de45[_0x661b('0x41')]=_[_0x661b('0x3f')](_0x574d98[_0x661b('0x3b')],qs[_0x661b('0x40')](_0x1c5a38[_0x661b('0x3c')][_0x661b('0x40')]));_0x12de45['attributes']=_0x12de45['attributes']['length']?_0x12de45[_0x661b('0x41')]:_0x574d98['model'];_0x12de45[_0x661b('0x44')]=qs[_0x661b('0x45')](_0x1c5a38[_0x661b('0x3c')]['sort']);_0x12de45[_0x661b('0x47')]=qs[_0x661b('0x3e')](_[_0x661b('0x46')](_0x1c5a38['query'],_0x574d98['filters']));if(_0x1c5a38['query'][_0x661b('0x59')]){_0x12de45[_0x661b('0x47')]=_['merge'](_0x12de45[_0x661b('0x47')],{'$or':_['map'](_0x12de45[_0x661b('0x41')],function(_0x4cab6c){var _0x42759e={};_0x42759e[_0x4cab6c]={'$like':'%'+_0x1c5a38[_0x661b('0x3c')]['filter']+'%'};return _0x42759e;})});}_0x12de45=_[_0x661b('0x48')]({},_0x12de45,_0x1c5a38[_0x661b('0x4a')]);return _0x2c79f7[_0x661b('0x5a')](_0x12de45);}})[_0x661b('0x1d')](function(_0x396e3b){if(_0x396e3b){_0xcc0985=_0x396e3b[_0x661b('0x52')];if(!_0x1c5a38[_0x661b('0x3c')]['hasOwnProperty'](_0x661b('0x43'))){_0x12de45[_0x661b('0x2d')]=qs['limit'](_0x1c5a38[_0x661b('0x3c')][_0x661b('0x2d')]);_0x12de45[_0x661b('0x2c')]=qs[_0x661b('0x2c')](_0x1c5a38[_0x661b('0x3c')][_0x661b('0x2c')]);}return _0x2c79f7['getSubjects'](_0x12de45);}})[_0x661b('0x1d')](function(_0xaa7bb7){if(_0xaa7bb7){return _0xaa7bb7?{'count':_0xcc0985,'rows':_0xaa7bb7}:null;}})[_0x661b('0x1d')](respondWithResult(_0x1d4521,null))['catch'](handleError(_0x1d4521,null));};exports['getDescriptions']=function(_0x401553,_0x63ba,_0x525b8f){var _0x3ee15e={};var _0x5280ef={};var _0x54721e;var _0x5e4458;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x401553['params']['id']}})[_0x661b('0x1d')](handleEntityNotFound(_0x63ba,null))[_0x661b('0x1d')](function(_0x43ca03){if(_0x43ca03){_0x54721e=_0x43ca03;_0x5280ef[_0x661b('0x3b')]=_[_0x661b('0x3d')](db[_0x661b('0x58')][_0x661b('0x39')]);_0x5280ef[_0x661b('0x3c')]=_['keys'](_0x401553[_0x661b('0x3c')]);_0x5280ef[_0x661b('0x3e')]=_[_0x661b('0x3f')](_0x5280ef[_0x661b('0x3b')],_0x5280ef['query']);_0x3ee15e[_0x661b('0x41')]=_[_0x661b('0x3f')](_0x5280ef[_0x661b('0x3b')],qs['fields'](_0x401553['query'][_0x661b('0x40')]));_0x3ee15e[_0x661b('0x41')]=_0x3ee15e['attributes'][_0x661b('0x52')]?_0x3ee15e[_0x661b('0x41')]:_0x5280ef[_0x661b('0x3b')];_0x3ee15e[_0x661b('0x44')]=qs['sort'](_0x401553[_0x661b('0x3c')][_0x661b('0x45')]);_0x3ee15e[_0x661b('0x47')]=qs['filters'](_[_0x661b('0x46')](_0x401553[_0x661b('0x3c')],_0x5280ef[_0x661b('0x3e')]));if(_0x401553[_0x661b('0x3c')]['filter']){_0x3ee15e[_0x661b('0x47')]=_[_0x661b('0x48')](_0x3ee15e[_0x661b('0x47')],{'$or':_['map'](_0x3ee15e[_0x661b('0x41')],function(_0x52be9f){var _0x1683ac={};_0x1683ac[_0x52be9f]={'$like':'%'+_0x401553['query'][_0x661b('0x59')]+'%'};return _0x1683ac;})});}_0x3ee15e=_['merge']({},_0x3ee15e,_0x401553['options']);return _0x54721e[_0x661b('0x5b')](_0x3ee15e);}})['then'](function(_0x2278e5){if(_0x2278e5){_0x5e4458=_0x2278e5[_0x661b('0x52')];if(!_0x401553[_0x661b('0x3c')]['hasOwnProperty'](_0x661b('0x43'))){_0x3ee15e[_0x661b('0x2d')]=qs['limit'](_0x401553[_0x661b('0x3c')][_0x661b('0x2d')]);_0x3ee15e['offset']=qs[_0x661b('0x2c')](_0x401553[_0x661b('0x3c')]['offset']);}return _0x54721e['getDescriptions'](_0x3ee15e);}})['then'](function(_0x2a7fa8){if(_0x2a7fa8){return _0x2a7fa8?{'count':_0x5e4458,'rows':_0x2a7fa8}:null;}})[_0x661b('0x1d')](respondWithResult(_0x63ba,null))[_0x661b('0x27')](handleError(_0x63ba,null));}; \ No newline at end of file +var _0x6a9e=['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','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','end','stack','name','index','SugarcrmConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','getFields','findOne','SugarcrmField','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','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'];(function(_0xe30e17,_0xce02be){var _0x2342c9=function(_0x20b733){while(--_0x20b733){_0xe30e17['push'](_0xe30e17['shift']());}};_0x2342c9(++_0xce02be);}(_0x6a9e,0x16e));var _0xe6a9=function(_0x323e2c,_0x1c07ac){_0x323e2c=_0x323e2c-0x0;var _0x1fb70e=_0x6a9e[_0x323e2c];return _0x1fb70e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe6a9('0x0'));var rimraf=require(_0xe6a9('0x1'));var zipdir=require(_0xe6a9('0x2'));var jsonpatch=require(_0xe6a9('0x3'));var rp=require('request-promise');var moment=require(_0xe6a9('0x4'));var BPromise=require(_0xe6a9('0x5'));var Mustache=require('mustache');var util=require(_0xe6a9('0x6'));var path=require(_0xe6a9('0x7'));var sox=require(_0xe6a9('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xe6a9('0x9'));var crypto=require(_0xe6a9('0xa'));var jsforce=require(_0xe6a9('0xb'));var deskjs=require(_0xe6a9('0xc'));var toCsv=require(_0xe6a9('0xd'));var querystring=require(_0xe6a9('0xe'));var Papa=require(_0xe6a9('0xf'));var Redis=require(_0xe6a9('0x10'));var authService=require(_0xe6a9('0x11'));var qs=require(_0xe6a9('0x12'));var as=require(_0xe6a9('0x13'));var hardwareService=require(_0xe6a9('0x14'));var logger=require(_0xe6a9('0x15'))(_0xe6a9('0x16'));var utils=require(_0xe6a9('0x17'));var config=require(_0xe6a9('0x18'));var db=require(_0xe6a9('0x19'))['db'];var jayson=require(_0xe6a9('0x1a'));var client=jayson[_0xe6a9('0x1b')][_0xe6a9('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x1fcd83,_0x2a770b,_0xe366ef){if(_0xe366ef){var _0x953569=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x953569[_0xe6a9('0x1d')](_0x2a770b)){return _0x1fcd83;}else{throw new db['Sequelize'][(_0xe6a9('0x1e'))](_0xe6a9('0x1f'));}}else{return _0x1fcd83;}}function respondWithRpcPromise(_0x2bc147,_0x2cee7a,_0x5d0d75,_0x56bb7d){return new BPromise(function(_0x198ae1,_0x290f2f){var _0x5b45be=_0x56bb7d||client;return _0x5b45be[_0xe6a9('0x20')](_0x2bc147,_0x5d0d75)[_0xe6a9('0x21')](function(_0x3168de){logger[_0xe6a9('0x22')](_0xe6a9('0x23'),_0x2cee7a,_0xe6a9('0x24'));logger[_0xe6a9('0x25')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x2cee7a,_0xe6a9('0x24'),JSON[_0xe6a9('0x26')](_0x3168de));if(_0x3168de[_0xe6a9('0x27')]){if(_0x3168de[_0xe6a9('0x27')][_0xe6a9('0x28')]===0x1f4){logger[_0xe6a9('0x27')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2cee7a,_0x3168de[_0xe6a9('0x27')][_0xe6a9('0x29')]);return _0x290f2f(_0x3168de[_0xe6a9('0x27')][_0xe6a9('0x29')]);}logger['error'](_0xe6a9('0x23'),_0x2cee7a,_0x3168de[_0xe6a9('0x27')]['message']);return _0x198ae1(_0x3168de[_0xe6a9('0x27')][_0xe6a9('0x29')]);}else{logger[_0xe6a9('0x22')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2cee7a,_0xe6a9('0x24'));_0x198ae1(_0x3168de[_0xe6a9('0x2a')][_0xe6a9('0x29')]);}})['catch'](function(_0x194fca){logger[_0xe6a9('0x27')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2cee7a,_0x194fca);_0x290f2f(_0x194fca);});});}function respondWithStatusCode(_0x272b6e,_0x996b4d){_0x996b4d=_0x996b4d||0xcc;return function(_0x2bbab7){if(_0x2bbab7){return _0x272b6e[_0xe6a9('0x2b')](_0x996b4d);}return _0x272b6e[_0xe6a9('0x2c')](_0x996b4d)['end']();};}function respondWithResult(_0x243ad0,_0xb8b27){_0xb8b27=_0xb8b27||0xc8;return function(_0x1d8637){if(_0x1d8637){return _0x243ad0[_0xe6a9('0x2c')](_0xb8b27)['json'](_0x1d8637);}};}function respondWithFilteredResult(_0x143b95,_0x4b6796){return function(_0x5a5c65){if(_0x5a5c65){var _0x3a0722=_0x5a5c65[_0xe6a9('0x2d')],_0x6b860=_0x4b6796['offset'],_0x39e02d=_0x4b6796[_0xe6a9('0x2e')]+_0x4b6796[_0xe6a9('0x2f')],_0x5bbe13;if(_0x39e02d>=_0x3a0722){_0x39e02d=_0x3a0722;_0x5bbe13=0xc8;}else{_0x5bbe13=0xce;}_0x143b95[_0xe6a9('0x2c')](_0x5bbe13);return _0x143b95[_0xe6a9('0x30')](_0xe6a9('0x31'),_0x6b860+'-'+_0x39e02d+'/'+_0x3a0722)[_0xe6a9('0x32')](_0x5a5c65);}return null;};}function patchUpdates(_0x390eb4){return function(_0x8ee0f6){try{jsonpatch[_0xe6a9('0x33')](_0x8ee0f6,_0x390eb4,!![]);}catch(_0x4bd899){return BPromise[_0xe6a9('0x34')](_0x4bd899);}return _0x8ee0f6[_0xe6a9('0x35')]();};}function saveUpdates(_0x18f914,_0x338abe){return function(_0x51a278){if(_0x51a278){return _0x51a278[_0xe6a9('0x36')](_0x18f914)[_0xe6a9('0x21')](function(_0x5a50e9){return _0x5a50e9;});}return null;};}function removeEntity(_0x4051d5,_0x275a06){return function(_0x57c165){if(_0x57c165){return _0x57c165[_0xe6a9('0x37')]()['then'](function(){_0x4051d5[_0xe6a9('0x2c')](0xcc)[_0xe6a9('0x38')]();});}};}function handleEntityNotFound(_0x3ea23c,_0x32d9a9){return function(_0x94e017){if(!_0x94e017){_0x3ea23c[_0xe6a9('0x2b')](0x194);}return _0x94e017;};}function handleError(_0x93d6bc,_0x4d8115){_0x4d8115=_0x4d8115||0x1f4;return function(_0x475638){logger['error'](_0x475638[_0xe6a9('0x39')]);if(_0x475638['name']){delete _0x475638[_0xe6a9('0x3a')];}_0x93d6bc[_0xe6a9('0x2c')](_0x4d8115)['send'](_0x475638);};}exports[_0xe6a9('0x3b')]=function(_0x4ac4ac,_0x5cc38d){var _0x55967b={},_0x26907c={},_0x1d1597={'count':0x0,'rows':[]};var _0x361844=_['map'](db[_0xe6a9('0x3c')][_0xe6a9('0x3d')],function(_0x4ba276){return{'name':_0x4ba276[_0xe6a9('0x3e')],'type':_0x4ba276[_0xe6a9('0x3f')][_0xe6a9('0x40')]};});_0x26907c['model']=_['map'](_0x361844,_0xe6a9('0x3a'));_0x26907c[_0xe6a9('0x41')]=_[_0xe6a9('0x42')](_0x4ac4ac[_0xe6a9('0x41')]);_0x26907c[_0xe6a9('0x43')]=_[_0xe6a9('0x44')](_0x26907c[_0xe6a9('0x45')],_0x26907c[_0xe6a9('0x41')]);_0x55967b[_0xe6a9('0x46')]=_['intersection'](_0x26907c[_0xe6a9('0x45')],qs[_0xe6a9('0x47')](_0x4ac4ac[_0xe6a9('0x41')][_0xe6a9('0x47')]));_0x55967b['attributes']=_0x55967b[_0xe6a9('0x46')][_0xe6a9('0x48')]?_0x55967b[_0xe6a9('0x46')]:_0x26907c[_0xe6a9('0x45')];if(!_0x4ac4ac[_0xe6a9('0x41')][_0xe6a9('0x49')](_0xe6a9('0x4a'))){_0x55967b['limit']=qs[_0xe6a9('0x2f')](_0x4ac4ac['query']['limit']);_0x55967b[_0xe6a9('0x2e')]=qs[_0xe6a9('0x2e')](_0x4ac4ac[_0xe6a9('0x41')]['offset']);}_0x55967b['order']=qs[_0xe6a9('0x4b')](_0x4ac4ac[_0xe6a9('0x41')][_0xe6a9('0x4b')]);_0x55967b[_0xe6a9('0x4c')]=qs[_0xe6a9('0x43')](_[_0xe6a9('0x4d')](_0x4ac4ac[_0xe6a9('0x41')],_0x26907c[_0xe6a9('0x43')]),_0x361844);if(_0x4ac4ac[_0xe6a9('0x41')][_0xe6a9('0x4e')]){_0x55967b[_0xe6a9('0x4c')]=_[_0xe6a9('0x4f')](_0x55967b[_0xe6a9('0x4c')],{'$or':_[_0xe6a9('0x50')](_0x361844,function(_0x1cfcbe){if(_0x1cfcbe[_0xe6a9('0x3f')]!==_0xe6a9('0x51')){var _0x24c7d8={};_0x24c7d8[_0x1cfcbe[_0xe6a9('0x3a')]]={'$like':'%'+_0x4ac4ac[_0xe6a9('0x41')][_0xe6a9('0x4e')]+'%'};return _0x24c7d8;}})});}_0x55967b=_[_0xe6a9('0x4f')]({},_0x55967b,_0x4ac4ac[_0xe6a9('0x52')]);var _0x4fb014={'where':_0x55967b[_0xe6a9('0x4c')]};return db[_0xe6a9('0x3c')]['count'](_0x4fb014)[_0xe6a9('0x21')](function(_0x5efc83){_0x1d1597[_0xe6a9('0x2d')]=_0x5efc83;if(_0x4ac4ac[_0xe6a9('0x41')][_0xe6a9('0x53')]){_0x55967b[_0xe6a9('0x54')]=[{'all':!![]}];}return db[_0xe6a9('0x3c')][_0xe6a9('0x55')](_0x55967b);})[_0xe6a9('0x21')](function(_0x352247){_0x1d1597[_0xe6a9('0x56')]=_0x352247;return _0x1d1597;})[_0xe6a9('0x21')](respondWithFilteredResult(_0x5cc38d,_0x55967b))[_0xe6a9('0x57')](handleError(_0x5cc38d,null));};exports['show']=function(_0x48feba,_0x446f4e){var _0x3ce6b8={'raw':![],'where':{'id':_0x48feba[_0xe6a9('0x58')]['id']}},_0xbfa512={};_0xbfa512[_0xe6a9('0x45')]=_['keys'](db['SugarcrmConfiguration'][_0xe6a9('0x3d')]);_0xbfa512['query']=_[_0xe6a9('0x42')](_0x48feba[_0xe6a9('0x41')]);_0xbfa512[_0xe6a9('0x43')]=_['intersection'](_0xbfa512['model'],_0xbfa512[_0xe6a9('0x41')]);_0x3ce6b8[_0xe6a9('0x46')]=_[_0xe6a9('0x44')](_0xbfa512[_0xe6a9('0x45')],qs[_0xe6a9('0x47')](_0x48feba[_0xe6a9('0x41')][_0xe6a9('0x47')]));_0x3ce6b8[_0xe6a9('0x46')]=_0x3ce6b8['attributes']['length']?_0x3ce6b8[_0xe6a9('0x46')]:_0xbfa512[_0xe6a9('0x45')];if(_0x48feba['query']['includeAll']){_0x3ce6b8[_0xe6a9('0x54')]=[{'all':!![]}];}_0x3ce6b8=_[_0xe6a9('0x4f')]({},_0x3ce6b8,_0x48feba[_0xe6a9('0x52')]);return db[_0xe6a9('0x3c')][_0xe6a9('0x59')](_0x3ce6b8)[_0xe6a9('0x21')](handleEntityNotFound(_0x446f4e,null))['then'](respondWithResult(_0x446f4e,null))[_0xe6a9('0x57')](handleError(_0x446f4e,null));};exports[_0xe6a9('0x5a')]=function(_0x1ce352,_0x3f0bd9){return db[_0xe6a9('0x3c')][_0xe6a9('0x5a')](_0x1ce352[_0xe6a9('0x5b')],{})[_0xe6a9('0x21')](respondWithResult(_0x3f0bd9,0xc9))[_0xe6a9('0x57')](handleError(_0x3f0bd9,null));};exports['update']=function(_0x4e280e,_0x4b985e){if(_0x4e280e['body']['id']){delete _0x4e280e['body']['id'];}return db[_0xe6a9('0x3c')][_0xe6a9('0x59')]({'where':{'id':_0x4e280e['params']['id']}})[_0xe6a9('0x21')](handleEntityNotFound(_0x4b985e,null))['then'](saveUpdates(_0x4e280e['body'],null))[_0xe6a9('0x21')](respondWithResult(_0x4b985e,null))[_0xe6a9('0x57')](handleError(_0x4b985e,null));};exports[_0xe6a9('0x37')]=function(_0x5e8486,_0x5458a9){return db[_0xe6a9('0x3c')][_0xe6a9('0x59')]({'where':{'id':_0x5e8486['params']['id']}})[_0xe6a9('0x21')](handleEntityNotFound(_0x5458a9,null))[_0xe6a9('0x21')](removeEntity(_0x5458a9,null))[_0xe6a9('0x57')](handleError(_0x5458a9,null));};exports[_0xe6a9('0x5c')]=function(_0x5bc9a5,_0xeeecd5,_0x36751d){var _0x4f1a6b={};var _0xe9875b={};var _0x41cf1f;var _0x1ac30e;return db[_0xe6a9('0x3c')][_0xe6a9('0x5d')]({'where':{'id':_0x5bc9a5[_0xe6a9('0x58')]['id']}})['then'](handleEntityNotFound(_0xeeecd5,null))['then'](function(_0x48ebd8){if(_0x48ebd8){_0x41cf1f=_0x48ebd8;_0xe9875b[_0xe6a9('0x45')]=_[_0xe6a9('0x42')](db[_0xe6a9('0x5e')][_0xe6a9('0x3d')]);_0xe9875b[_0xe6a9('0x41')]=_[_0xe6a9('0x42')](_0x5bc9a5[_0xe6a9('0x41')]);_0xe9875b[_0xe6a9('0x43')]=_[_0xe6a9('0x44')](_0xe9875b[_0xe6a9('0x45')],_0xe9875b[_0xe6a9('0x41')]);_0x4f1a6b['attributes']=_[_0xe6a9('0x44')](_0xe9875b[_0xe6a9('0x45')],qs[_0xe6a9('0x47')](_0x5bc9a5[_0xe6a9('0x41')][_0xe6a9('0x47')]));_0x4f1a6b[_0xe6a9('0x46')]=_0x4f1a6b[_0xe6a9('0x46')][_0xe6a9('0x48')]?_0x4f1a6b[_0xe6a9('0x46')]:_0xe9875b[_0xe6a9('0x45')];_0x4f1a6b[_0xe6a9('0x5f')]=qs[_0xe6a9('0x4b')](_0x5bc9a5[_0xe6a9('0x41')]['sort']);_0x4f1a6b['where']=qs[_0xe6a9('0x43')](_[_0xe6a9('0x4d')](_0x5bc9a5[_0xe6a9('0x41')],_0xe9875b[_0xe6a9('0x43')]));if(_0x5bc9a5[_0xe6a9('0x41')][_0xe6a9('0x4e')]){_0x4f1a6b[_0xe6a9('0x4c')]=_['merge'](_0x4f1a6b[_0xe6a9('0x4c')],{'$or':_['map'](_0x4f1a6b[_0xe6a9('0x46')],function(_0x17836e){var _0x34b4ae={};_0x34b4ae[_0x17836e]={'$like':'%'+_0x5bc9a5[_0xe6a9('0x41')][_0xe6a9('0x4e')]+'%'};return _0x34b4ae;})});}_0x4f1a6b=_[_0xe6a9('0x4f')]({},_0x4f1a6b,_0x5bc9a5[_0xe6a9('0x52')]);return _0x41cf1f[_0xe6a9('0x5c')](_0x4f1a6b);}})[_0xe6a9('0x21')](function(_0x3cd3b9){if(_0x3cd3b9){_0x1ac30e=_0x3cd3b9[_0xe6a9('0x48')];if(!_0x5bc9a5[_0xe6a9('0x41')][_0xe6a9('0x49')]('nolimit')){_0x4f1a6b[_0xe6a9('0x2f')]=qs[_0xe6a9('0x2f')](_0x5bc9a5[_0xe6a9('0x41')][_0xe6a9('0x2f')]);_0x4f1a6b[_0xe6a9('0x2e')]=qs['offset'](_0x5bc9a5[_0xe6a9('0x41')][_0xe6a9('0x2e')]);}return _0x41cf1f[_0xe6a9('0x5c')](_0x4f1a6b);}})[_0xe6a9('0x21')](function(_0x22d66e){if(_0x22d66e){return _0x22d66e?{'count':_0x1ac30e,'rows':_0x22d66e}:null;}})[_0xe6a9('0x21')](respondWithResult(_0xeeecd5,null))[_0xe6a9('0x57')](handleError(_0xeeecd5,null));};exports[_0xe6a9('0x60')]=function(_0x3c4803,_0x908ef6,_0xc68119){var _0x3aa63e={};var _0x4478cd={};var _0xf51312;var _0x39846c;return db['SugarcrmConfiguration'][_0xe6a9('0x5d')]({'where':{'id':_0x3c4803[_0xe6a9('0x58')]['id']}})[_0xe6a9('0x21')](handleEntityNotFound(_0x908ef6,null))['then'](function(_0x2d9876){if(_0x2d9876){_0xf51312=_0x2d9876;_0x4478cd[_0xe6a9('0x45')]=_[_0xe6a9('0x42')](db[_0xe6a9('0x5e')]['rawAttributes']);_0x4478cd[_0xe6a9('0x41')]=_['keys'](_0x3c4803[_0xe6a9('0x41')]);_0x4478cd[_0xe6a9('0x43')]=_[_0xe6a9('0x44')](_0x4478cd['model'],_0x4478cd[_0xe6a9('0x41')]);_0x3aa63e[_0xe6a9('0x46')]=_['intersection'](_0x4478cd[_0xe6a9('0x45')],qs[_0xe6a9('0x47')](_0x3c4803[_0xe6a9('0x41')][_0xe6a9('0x47')]));_0x3aa63e[_0xe6a9('0x46')]=_0x3aa63e[_0xe6a9('0x46')][_0xe6a9('0x48')]?_0x3aa63e[_0xe6a9('0x46')]:_0x4478cd[_0xe6a9('0x45')];_0x3aa63e[_0xe6a9('0x5f')]=qs[_0xe6a9('0x4b')](_0x3c4803['query'][_0xe6a9('0x4b')]);_0x3aa63e['where']=qs[_0xe6a9('0x43')](_[_0xe6a9('0x4d')](_0x3c4803[_0xe6a9('0x41')],_0x4478cd[_0xe6a9('0x43')]));if(_0x3c4803[_0xe6a9('0x41')][_0xe6a9('0x4e')]){_0x3aa63e[_0xe6a9('0x4c')]=_[_0xe6a9('0x4f')](_0x3aa63e[_0xe6a9('0x4c')],{'$or':_[_0xe6a9('0x50')](_0x3aa63e[_0xe6a9('0x46')],function(_0x334b8e){var _0x1f02f0={};_0x1f02f0[_0x334b8e]={'$like':'%'+_0x3c4803[_0xe6a9('0x41')][_0xe6a9('0x4e')]+'%'};return _0x1f02f0;})});}_0x3aa63e=_['merge']({},_0x3aa63e,_0x3c4803[_0xe6a9('0x52')]);return _0xf51312['getSubjects'](_0x3aa63e);}})['then'](function(_0x395e9e){if(_0x395e9e){_0x39846c=_0x395e9e[_0xe6a9('0x48')];if(!_0x3c4803[_0xe6a9('0x41')][_0xe6a9('0x49')](_0xe6a9('0x4a'))){_0x3aa63e[_0xe6a9('0x2f')]=qs[_0xe6a9('0x2f')](_0x3c4803[_0xe6a9('0x41')][_0xe6a9('0x2f')]);_0x3aa63e['offset']=qs[_0xe6a9('0x2e')](_0x3c4803[_0xe6a9('0x41')][_0xe6a9('0x2e')]);}return _0xf51312['getSubjects'](_0x3aa63e);}})[_0xe6a9('0x21')](function(_0x323556){if(_0x323556){return _0x323556?{'count':_0x39846c,'rows':_0x323556}:null;}})[_0xe6a9('0x21')](respondWithResult(_0x908ef6,null))[_0xe6a9('0x57')](handleError(_0x908ef6,null));};exports[_0xe6a9('0x61')]=function(_0x5addb4,_0x4c22ad,_0x4432e8){var _0x346531={};var _0x492fd0={};var _0x291f60;var _0x50db29;return db[_0xe6a9('0x3c')][_0xe6a9('0x5d')]({'where':{'id':_0x5addb4[_0xe6a9('0x58')]['id']}})[_0xe6a9('0x21')](handleEntityNotFound(_0x4c22ad,null))[_0xe6a9('0x21')](function(_0x6e51d){if(_0x6e51d){_0x291f60=_0x6e51d;_0x492fd0[_0xe6a9('0x45')]=_['keys'](db[_0xe6a9('0x5e')][_0xe6a9('0x3d')]);_0x492fd0[_0xe6a9('0x41')]=_[_0xe6a9('0x42')](_0x5addb4[_0xe6a9('0x41')]);_0x492fd0['filters']=_[_0xe6a9('0x44')](_0x492fd0[_0xe6a9('0x45')],_0x492fd0[_0xe6a9('0x41')]);_0x346531[_0xe6a9('0x46')]=_[_0xe6a9('0x44')](_0x492fd0[_0xe6a9('0x45')],qs[_0xe6a9('0x47')](_0x5addb4[_0xe6a9('0x41')][_0xe6a9('0x47')]));_0x346531['attributes']=_0x346531[_0xe6a9('0x46')][_0xe6a9('0x48')]?_0x346531[_0xe6a9('0x46')]:_0x492fd0['model'];_0x346531[_0xe6a9('0x5f')]=qs['sort'](_0x5addb4[_0xe6a9('0x41')][_0xe6a9('0x4b')]);_0x346531['where']=qs[_0xe6a9('0x43')](_[_0xe6a9('0x4d')](_0x5addb4[_0xe6a9('0x41')],_0x492fd0[_0xe6a9('0x43')]));if(_0x5addb4['query'][_0xe6a9('0x4e')]){_0x346531[_0xe6a9('0x4c')]=_[_0xe6a9('0x4f')](_0x346531[_0xe6a9('0x4c')],{'$or':_['map'](_0x346531[_0xe6a9('0x46')],function(_0x538269){var _0x2a9269={};_0x2a9269[_0x538269]={'$like':'%'+_0x5addb4['query'][_0xe6a9('0x4e')]+'%'};return _0x2a9269;})});}_0x346531=_[_0xe6a9('0x4f')]({},_0x346531,_0x5addb4[_0xe6a9('0x52')]);return _0x291f60['getDescriptions'](_0x346531);}})['then'](function(_0x1034b1){if(_0x1034b1){_0x50db29=_0x1034b1[_0xe6a9('0x48')];if(!_0x5addb4[_0xe6a9('0x41')][_0xe6a9('0x49')](_0xe6a9('0x4a'))){_0x346531[_0xe6a9('0x2f')]=qs[_0xe6a9('0x2f')](_0x5addb4[_0xe6a9('0x41')][_0xe6a9('0x2f')]);_0x346531['offset']=qs['offset'](_0x5addb4[_0xe6a9('0x41')][_0xe6a9('0x2e')]);}return _0x291f60[_0xe6a9('0x61')](_0x346531);}})['then'](function(_0x2a3656){if(_0x2a3656){return _0x2a3656?{'count':_0x50db29,'rows':_0x2a3656}:null;}})[_0xe6a9('0x21')](respondWithResult(_0x4c22ad,null))[_0xe6a9('0x57')](handleError(_0x4c22ad,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 309412c..1dbf5e3 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 _0xe041=['path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','moment','request-promise'];(function(_0x192cbe,_0x3b4b43){var _0x4ce395=function(_0x5388ae){while(--_0x5388ae){_0x192cbe['push'](_0x192cbe['shift']());}};_0x4ce395(++_0x3b4b43);}(_0xe041,0x1b5));var _0x1e04=function(_0x55702c,_0x5a1364){_0x55702c=_0x55702c-0x0;var _0x41f489=_0xe041[_0x55702c];return _0x41f489;};'use strict';var _=require(_0x1e04('0x0'));var util=require(_0x1e04('0x1'));var logger=require(_0x1e04('0x2'))('api');var moment=require(_0x1e04('0x3'));var BPromise=require('bluebird');var rp=require(_0x1e04('0x4'));var fs=require('fs');var path=require(_0x1e04('0x5'));var rimraf=require(_0x1e04('0x6'));var config=require(_0x1e04('0x7'));var attributes=require(_0x1e04('0x8'));module[_0x1e04('0x9')]=function(_0x333946,_0x56fb8f){return _0x333946[_0x1e04('0xa')](_0x1e04('0xb'),attributes,{'tableName':_0x1e04('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e2a=['bluebird','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5e2a,0xb1));var _0xa5e2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e2a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa5e2('0x0'));var util=require(_0xa5e2('0x1'));var logger=require(_0xa5e2('0x2'))(_0xa5e2('0x3'));var moment=require(_0xa5e2('0x4'));var BPromise=require(_0xa5e2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa5e2('0x6'));var config=require(_0xa5e2('0x7'));var attributes=require(_0xa5e2('0x8'));module[_0xa5e2('0x9')]=function(_0x23860a,_0x6e32b8){return _0x23860a[_0xa5e2('0xa')](_0xa5e2('0xb'),attributes,{'tableName':_0xa5e2('0xc'),'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 754b7fc..adbc210 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 _0xd91f=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x26ba35,_0x3816f5){var _0x1d073e=function(_0x7ff982){while(--_0x7ff982){_0x26ba35['push'](_0x26ba35['shift']());}};_0x1d073e(++_0x3816f5);}(_0xd91f,0x12d));var _0xfd91=function(_0x1fbdd1,_0x17323f){_0x1fbdd1=_0x1fbdd1-0x0;var _0x3319a2=_0xd91f[_0x1fbdd1];return _0x3319a2;};'use strict';var _=require(_0xfd91('0x0'));var util=require(_0xfd91('0x1'));var moment=require(_0xfd91('0x2'));var BPromise=require(_0xfd91('0x3'));var rs=require(_0xfd91('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd91('0x5'))['db'];var utils=require(_0xfd91('0x6'));var logger=require(_0xfd91('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfd91('0x8'));var client=jayson[_0xfd91('0x9')][_0xfd91('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8fbc8,_0x22b0e9,_0x4e315b){return new BPromise(function(_0x4b4a45,_0x1dd3d7){return client[_0xfd91('0xb')](_0xe8fbc8,_0x4e315b)[_0xfd91('0xc')](function(_0x3abf2d){logger[_0xfd91('0xd')](_0xfd91('0xe'),_0x22b0e9,_0xfd91('0xf'));logger[_0xfd91('0x10')](_0xfd91('0x11'),_0x22b0e9,_0xfd91('0xf'),JSON[_0xfd91('0x12')](_0x3abf2d));if(_0x3abf2d[_0xfd91('0x13')]){if(_0x3abf2d['error'][_0xfd91('0x14')]===0x1f4){logger[_0xfd91('0x13')](_0xfd91('0xe'),_0x22b0e9,_0x3abf2d[_0xfd91('0x13')]['message']);return _0x1dd3d7(_0x3abf2d[_0xfd91('0x13')][_0xfd91('0x15')]);}logger[_0xfd91('0x13')](_0xfd91('0xe'),_0x22b0e9,_0x3abf2d[_0xfd91('0x13')][_0xfd91('0x15')]);return _0x4b4a45(_0x3abf2d[_0xfd91('0x13')][_0xfd91('0x15')]);}else{logger[_0xfd91('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x22b0e9,'request\x20sent');_0x4b4a45(_0x3abf2d['result'][_0xfd91('0x15')]);}})[_0xfd91('0x16')](function(_0x53ff85){logger[_0xfd91('0x13')](_0xfd91('0xe'),_0x22b0e9,_0x53ff85);_0x1dd3d7(_0x53ff85);});});} \ No newline at end of file +var _0x15f7=['jayson/promise','client','http','request','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x5ad60a,_0x5262c5){var _0x266de2=function(_0x467006){while(--_0x467006){_0x5ad60a['push'](_0x5ad60a['shift']());}};_0x266de2(++_0x5262c5);}(_0x15f7,0x158));var _0x715f=function(_0x133ee2,_0x1365ff){_0x133ee2=_0x133ee2-0x0;var _0x28e86f=_0x15f7[_0x133ee2];return _0x28e86f;};'use strict';var _=require('lodash');var util=require(_0x715f('0x0'));var moment=require(_0x715f('0x1'));var BPromise=require(_0x715f('0x2'));var rs=require(_0x715f('0x3'));var fs=require('fs');var Redis=require(_0x715f('0x4'));var db=require(_0x715f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x715f('0x6'));var config=require(_0x715f('0x7'));var jayson=require(_0x715f('0x8'));var client=jayson[_0x715f('0x9')][_0x715f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x155366,_0x9105ab,_0x5dfc96){return new BPromise(function(_0x314428,_0x4a4972){return client[_0x715f('0xb')](_0x155366,_0x5dfc96)['then'](function(_0x52167b){logger[_0x715f('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x9105ab,_0x715f('0xd'));logger[_0x715f('0xe')](_0x715f('0xf'),_0x9105ab,_0x715f('0xd'),JSON[_0x715f('0x10')](_0x52167b));if(_0x52167b[_0x715f('0x11')]){if(_0x52167b[_0x715f('0x11')]['code']===0x1f4){logger['error'](_0x715f('0x12'),_0x9105ab,_0x52167b['error'][_0x715f('0x13')]);return _0x4a4972(_0x52167b[_0x715f('0x11')][_0x715f('0x13')]);}logger['error'](_0x715f('0x12'),_0x9105ab,_0x52167b[_0x715f('0x11')]['message']);return _0x314428(_0x52167b[_0x715f('0x11')][_0x715f('0x13')]);}else{logger[_0x715f('0xc')](_0x715f('0x12'),_0x9105ab,_0x715f('0xd'));_0x314428(_0x52167b[_0x715f('0x14')][_0x715f('0x13')]);}})[_0x715f('0x15')](function(_0x2555db){logger[_0x715f('0x11')](_0x715f('0x12'),_0x9105ab,_0x2555db);_0x4a4972(_0x2555db);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index c0250c5..9b8a815 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 _0xdd5e=['./intSugarcrmField.controller','get','isAuthenticated','index','post','create','put','/:id','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5eee1c,_0x3817d8){var _0x5f2ea1=function(_0x19173b){while(--_0x19173b){_0x5eee1c['push'](_0x5eee1c['shift']());}};_0x5f2ea1(++_0x3817d8);}(_0xdd5e,0x107));var _0xedd5=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xdd5e[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0xedd5('0x0'));var util=require('util');var path=require(_0xedd5('0x1'));var timeout=require(_0xedd5('0x2'));var express=require('express');var router=express[_0xedd5('0x3')]();var auth=require(_0xedd5('0x4'));var interaction=require(_0xedd5('0x5'));var config=require(_0xedd5('0x6'));var controller=require(_0xedd5('0x7'));router[_0xedd5('0x8')]('/',auth[_0xedd5('0x9')](),controller[_0xedd5('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xedd5('0xb')]('/',auth[_0xedd5('0x9')](),controller[_0xedd5('0xc')]);router[_0xedd5('0xd')](_0xedd5('0xe'),auth[_0xedd5('0x9')](),controller['update']);router[_0xedd5('0xf')](_0xedd5('0xe'),auth[_0xedd5('0x9')](),controller[_0xedd5('0x10')]);module[_0xedd5('0x11')]=router; \ No newline at end of file +var _0xb515=['/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','./intSugarcrmField.controller','isAuthenticated','index','get'];(function(_0x215775,_0x15bc76){var _0x2c189d=function(_0x287040){while(--_0x287040){_0x215775['push'](_0x215775['shift']());}};_0x2c189d(++_0x15bc76);}(_0xb515,0xe4));var _0x5b51=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0xb515[_0x31cb5f];return _0x586042;};'use strict';var multer=require(_0x5b51('0x0'));var util=require(_0x5b51('0x1'));var path=require(_0x5b51('0x2'));var timeout=require(_0x5b51('0x3'));var express=require('express');var router=express[_0x5b51('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5b51('0x5'));var config=require('../../config/environment');var controller=require(_0x5b51('0x6'));router['get']('/',auth[_0x5b51('0x7')](),controller[_0x5b51('0x8')]);router[_0x5b51('0x9')](_0x5b51('0xa'),auth[_0x5b51('0x7')](),controller[_0x5b51('0xb')]);router['post']('/',auth[_0x5b51('0x7')](),controller[_0x5b51('0xc')]);router[_0x5b51('0xd')](_0x5b51('0xa'),auth['isAuthenticated'](),controller[_0x5b51('0xe')]);router[_0x5b51('0xf')](_0x5b51('0xa'),auth[_0x5b51('0x7')](),controller[_0x5b51('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 6ae138d..f6bdda8 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 _0xa4c2=['customVariable','STRING','string','BOOLEAN','sequelize','ENUM','variable'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xa4c2,0xc1));var _0x2a4c=function(_0x59d01d,_0x460e84){_0x59d01d=_0x59d01d-0x0;var _0x21b0e0=_0xa4c2[_0x59d01d];return _0x21b0e0;};'use strict';var Sequelize=require(_0x2a4c('0x0'));module['exports']={'type':{'type':Sequelize[_0x2a4c('0x1')]('string',_0x2a4c('0x2'),_0x2a4c('0x3'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0x2a4c('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2a4c('0x1')](_0x2a4c('0x5'),'variable',_0x2a4c('0x3'))},'keyContent':{'type':Sequelize[_0x2a4c('0x4')]},'idField':{'type':Sequelize[_0x2a4c('0x4')]},'nameField':{'type':Sequelize[_0x2a4c('0x4')]},'customField':{'type':Sequelize[_0x2a4c('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2a4c('0x4')]}}; \ No newline at end of file +var _0x9490=['string','customVariable','keyValue','STRING','variable','BOOLEAN'];(function(_0x352085,_0x1d0f79){var _0x7d4859=function(_0x17dda9){while(--_0x17dda9){_0x352085['push'](_0x352085['shift']());}};_0x7d4859(++_0x1d0f79);}(_0x9490,0x15c));var _0x0949=function(_0x4f4417,_0x5e9a07){_0x4f4417=_0x4f4417-0x0;var _0x4414ce=_0x9490[_0x4f4417];return _0x4414ce;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x0949('0x0'),'variable',_0x0949('0x1'),_0x0949('0x2')),'defaultValue':_0x0949('0x0')},'content':{'type':Sequelize[_0x0949('0x3')]},'key':{'type':Sequelize[_0x0949('0x3')]},'keyType':{'type':Sequelize['ENUM'](_0x0949('0x0'),_0x0949('0x4'),_0x0949('0x1'))},'keyContent':{'type':Sequelize[_0x0949('0x3')]},'idField':{'type':Sequelize[_0x0949('0x3')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0949('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0949('0x3')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index cf20389..611748f 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 _0xb6c4=['SugarcrmField','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','length','include','create','body','find','destroy','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb6c4,0x1d1));var _0x4b6c=function(_0x422f80,_0x42bd24){_0x422f80=_0x422f80-0x0;var _0x2d370c=_0xb6c4[_0x422f80];return _0x2d370c;};'use strict';var pdf=require(_0x4b6c('0x0'));var emlformat=require(_0x4b6c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4b6c('0x2'));var rp=require(_0x4b6c('0x3'));var moment=require(_0x4b6c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4b6c('0x5'));var util=require(_0x4b6c('0x6'));var path=require('path');var sox=require(_0x4b6c('0x7'));var csv=require(_0x4b6c('0x8'));var ejs=require(_0x4b6c('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4b6c('0xa'));var crypto=require(_0x4b6c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4b6c('0xc'));var toCsv=require(_0x4b6c('0x8'));var querystring=require('querystring');var Papa=require(_0x4b6c('0xd'));var Redis=require(_0x4b6c('0xe'));var authService=require(_0x4b6c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4b6c('0x10'));var hardwareService=require(_0x4b6c('0x11'));var logger=require('../../config/logger')(_0x4b6c('0x12'));var utils=require(_0x4b6c('0x13'));var config=require('../../config/environment');var db=require(_0x4b6c('0x14'))['db'];function respondWithStatusCode(_0x1619e2,_0x1d7952){_0x1d7952=_0x1d7952||0xcc;return function(_0x1f6866){if(_0x1f6866){return _0x1619e2['sendStatus'](_0x1d7952);}return _0x1619e2['status'](_0x1d7952)[_0x4b6c('0x15')]();};}function respondWithResult(_0x188dac,_0x443bc4){_0x443bc4=_0x443bc4||0xc8;return function(_0x7d3e4b){if(_0x7d3e4b){return _0x188dac['status'](_0x443bc4)[_0x4b6c('0x16')](_0x7d3e4b);}};}function respondWithFilteredResult(_0x290801,_0x252eed){return function(_0x11c4ae){if(_0x11c4ae){var _0x3bfab5=_0x11c4ae[_0x4b6c('0x17')],_0x5ad100=_0x252eed[_0x4b6c('0x18')],_0x44988a=_0x252eed['offset']+_0x252eed[_0x4b6c('0x19')],_0x333399;if(_0x44988a>=_0x3bfab5){_0x44988a=_0x3bfab5;_0x333399=0xc8;}else{_0x333399=0xce;}_0x290801[_0x4b6c('0x1a')](_0x333399);return _0x290801[_0x4b6c('0x1b')](_0x4b6c('0x1c'),_0x5ad100+'-'+_0x44988a+'/'+_0x3bfab5)[_0x4b6c('0x16')](_0x11c4ae);}return null;};}function patchUpdates(_0x42f371){return function(_0x11ca29){try{jsonpatch[_0x4b6c('0x1d')](_0x11ca29,_0x42f371,!![]);}catch(_0x37537a){return BPromise[_0x4b6c('0x1e')](_0x37537a);}return _0x11ca29[_0x4b6c('0x1f')]();};}function saveUpdates(_0x30931c,_0x24753e){return function(_0x2c31dc){if(_0x2c31dc){return _0x2c31dc[_0x4b6c('0x20')](_0x30931c)[_0x4b6c('0x21')](function(_0x30bd43){return _0x30bd43;});}return null;};}function removeEntity(_0x1696d0,_0x4859ae){return function(_0x3b3f72){if(_0x3b3f72){return _0x3b3f72['destroy']()['then'](function(){_0x1696d0['status'](0xcc)[_0x4b6c('0x15')]();});}};}function handleEntityNotFound(_0x9d0439,_0x3f5807){return function(_0x359c81){if(!_0x359c81){_0x9d0439[_0x4b6c('0x22')](0x194);}return _0x359c81;};}function handleError(_0x1b0076,_0x50a69f){_0x50a69f=_0x50a69f||0x1f4;return function(_0x460b68){logger['error'](_0x460b68[_0x4b6c('0x23')]);if(_0x460b68['name']){delete _0x460b68[_0x4b6c('0x24')];}_0x1b0076[_0x4b6c('0x1a')](_0x50a69f)[_0x4b6c('0x25')](_0x460b68);};}exports[_0x4b6c('0x26')]=function(_0x4a9b5c,_0xe99e8c){var _0x4c2633={},_0x3b6a63={},_0x3639b1={'count':0x0,'rows':[]};var _0x56be3f=_['map'](db[_0x4b6c('0x27')][_0x4b6c('0x28')],function(_0x4ef20d){return{'name':_0x4ef20d[_0x4b6c('0x29')],'type':_0x4ef20d[_0x4b6c('0x2a')][_0x4b6c('0x2b')]};});_0x3b6a63[_0x4b6c('0x2c')]=_[_0x4b6c('0x2d')](_0x56be3f,'name');_0x3b6a63[_0x4b6c('0x2e')]=_['keys'](_0x4a9b5c[_0x4b6c('0x2e')]);_0x3b6a63[_0x4b6c('0x2f')]=_[_0x4b6c('0x30')](_0x3b6a63[_0x4b6c('0x2c')],_0x3b6a63[_0x4b6c('0x2e')]);_0x4c2633[_0x4b6c('0x31')]=_['intersection'](_0x3b6a63[_0x4b6c('0x2c')],qs[_0x4b6c('0x32')](_0x4a9b5c[_0x4b6c('0x2e')][_0x4b6c('0x32')]));_0x4c2633[_0x4b6c('0x31')]=_0x4c2633[_0x4b6c('0x31')]['length']?_0x4c2633['attributes']:_0x3b6a63[_0x4b6c('0x2c')];if(!_0x4a9b5c[_0x4b6c('0x2e')][_0x4b6c('0x33')]('nolimit')){_0x4c2633['limit']=qs[_0x4b6c('0x19')](_0x4a9b5c['query']['limit']);_0x4c2633[_0x4b6c('0x18')]=qs[_0x4b6c('0x18')](_0x4a9b5c['query']['offset']);}_0x4c2633[_0x4b6c('0x34')]=qs[_0x4b6c('0x35')](_0x4a9b5c[_0x4b6c('0x2e')][_0x4b6c('0x35')]);_0x4c2633['where']=qs[_0x4b6c('0x2f')](_[_0x4b6c('0x36')](_0x4a9b5c[_0x4b6c('0x2e')],_0x3b6a63[_0x4b6c('0x2f')]),_0x56be3f);if(_0x4a9b5c['query'][_0x4b6c('0x37')]){_0x4c2633['where']=_[_0x4b6c('0x38')](_0x4c2633[_0x4b6c('0x39')],{'$or':_[_0x4b6c('0x2d')](_0x56be3f,function(_0x1990da){if(_0x1990da[_0x4b6c('0x2a')]!==_0x4b6c('0x3a')){var _0x2ab97a={};_0x2ab97a[_0x1990da['name']]={'$like':'%'+_0x4a9b5c[_0x4b6c('0x2e')][_0x4b6c('0x37')]+'%'};return _0x2ab97a;}})});}_0x4c2633=_[_0x4b6c('0x38')]({},_0x4c2633,_0x4a9b5c[_0x4b6c('0x3b')]);var _0x1de965={'where':_0x4c2633['where']};return db[_0x4b6c('0x27')][_0x4b6c('0x17')](_0x1de965)[_0x4b6c('0x21')](function(_0xe9478c){_0x3639b1[_0x4b6c('0x17')]=_0xe9478c;if(_0x4a9b5c[_0x4b6c('0x2e')][_0x4b6c('0x3c')]){_0x4c2633['include']=[{'all':!![]}];}return db[_0x4b6c('0x27')][_0x4b6c('0x3d')](_0x4c2633);})[_0x4b6c('0x21')](function(_0xfb3da2){_0x3639b1[_0x4b6c('0x3e')]=_0xfb3da2;return _0x3639b1;})['then'](respondWithFilteredResult(_0xe99e8c,_0x4c2633))[_0x4b6c('0x3f')](handleError(_0xe99e8c,null));};exports['show']=function(_0xd6d954,_0x346b34){var _0x237cc6={'raw':!![],'where':{'id':_0xd6d954[_0x4b6c('0x40')]['id']}},_0x5085f7={};_0x5085f7['model']=_[_0x4b6c('0x41')](db[_0x4b6c('0x27')][_0x4b6c('0x28')]);_0x5085f7[_0x4b6c('0x2e')]=_[_0x4b6c('0x41')](_0xd6d954[_0x4b6c('0x2e')]);_0x5085f7[_0x4b6c('0x2f')]=_[_0x4b6c('0x30')](_0x5085f7[_0x4b6c('0x2c')],_0x5085f7[_0x4b6c('0x2e')]);_0x237cc6['attributes']=_[_0x4b6c('0x30')](_0x5085f7['model'],qs[_0x4b6c('0x32')](_0xd6d954['query'][_0x4b6c('0x32')]));_0x237cc6[_0x4b6c('0x31')]=_0x237cc6[_0x4b6c('0x31')][_0x4b6c('0x42')]?_0x237cc6['attributes']:_0x5085f7[_0x4b6c('0x2c')];if(_0xd6d954[_0x4b6c('0x2e')][_0x4b6c('0x3c')]){_0x237cc6[_0x4b6c('0x43')]=[{'all':!![]}];}_0x237cc6=_['merge']({},_0x237cc6,_0xd6d954['options']);return db['SugarcrmField']['find'](_0x237cc6)[_0x4b6c('0x21')](handleEntityNotFound(_0x346b34,null))[_0x4b6c('0x21')](respondWithResult(_0x346b34,null))['catch'](handleError(_0x346b34,null));};exports[_0x4b6c('0x44')]=function(_0x24775c,_0x4d75d2){return db['SugarcrmField'][_0x4b6c('0x44')](_0x24775c[_0x4b6c('0x45')],{})[_0x4b6c('0x21')](respondWithResult(_0x4d75d2,0xc9))['catch'](handleError(_0x4d75d2,null));};exports[_0x4b6c('0x20')]=function(_0x12f7ef,_0x225128){if(_0x12f7ef[_0x4b6c('0x45')]['id']){delete _0x12f7ef[_0x4b6c('0x45')]['id'];}return db[_0x4b6c('0x27')][_0x4b6c('0x46')]({'where':{'id':_0x12f7ef[_0x4b6c('0x40')]['id']}})['then'](handleEntityNotFound(_0x225128,null))['then'](saveUpdates(_0x12f7ef[_0x4b6c('0x45')],null))[_0x4b6c('0x21')](respondWithResult(_0x225128,null))[_0x4b6c('0x3f')](handleError(_0x225128,null));};exports[_0x4b6c('0x47')]=function(_0x418130,_0x330296){return db[_0x4b6c('0x27')][_0x4b6c('0x46')]({'where':{'id':_0x418130[_0x4b6c('0x40')]['id']}})[_0x4b6c('0x21')](handleEntityNotFound(_0x330296,null))[_0x4b6c('0x21')](removeEntity(_0x330296,null))[_0x4b6c('0x3f')](handleError(_0x330296,null));}; \ No newline at end of file +var _0x3bcb=['error','stack','name','index','map','SugarcrmField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','findAll','params','include','catch','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy'];(function(_0x121717,_0x17589c){var _0x2765f1=function(_0x3da555){while(--_0x3da555){_0x121717['push'](_0x121717['shift']());}};_0x2765f1(++_0x17589c);}(_0x3bcb,0x6a));var _0xb3bc=function(_0xdbfe3,_0x4ebddd){_0xdbfe3=_0xdbfe3-0x0;var _0x3454b0=_0x3bcb[_0xdbfe3];return _0x3454b0;};'use strict';var pdf=require(_0xb3bc('0x0'));var emlformat=require(_0xb3bc('0x1'));var rimraf=require(_0xb3bc('0x2'));var zipdir=require(_0xb3bc('0x3'));var jsonpatch=require(_0xb3bc('0x4'));var rp=require(_0xb3bc('0x5'));var moment=require(_0xb3bc('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb3bc('0x7'));var sox=require(_0xb3bc('0x8'));var csv=require(_0xb3bc('0x9'));var ejs=require(_0xb3bc('0xa'));var fs=require('fs');var _=require(_0xb3bc('0xb'));var squel=require(_0xb3bc('0xc'));var crypto=require(_0xb3bc('0xd'));var jsforce=require(_0xb3bc('0xe'));var deskjs=require(_0xb3bc('0xf'));var toCsv=require(_0xb3bc('0x9'));var querystring=require('querystring');var Papa=require(_0xb3bc('0x10'));var Redis=require(_0xb3bc('0x11'));var authService=require(_0xb3bc('0x12'));var qs=require(_0xb3bc('0x13'));var as=require(_0xb3bc('0x14'));var hardwareService=require(_0xb3bc('0x15'));var logger=require(_0xb3bc('0x16'))(_0xb3bc('0x17'));var utils=require(_0xb3bc('0x18'));var config=require('../../config/environment');var db=require(_0xb3bc('0x19'))['db'];function respondWithStatusCode(_0x3ffd57,_0x3c5f6d){_0x3c5f6d=_0x3c5f6d||0xcc;return function(_0x21cfb4){if(_0x21cfb4){return _0x3ffd57[_0xb3bc('0x1a')](_0x3c5f6d);}return _0x3ffd57[_0xb3bc('0x1b')](_0x3c5f6d)[_0xb3bc('0x1c')]();};}function respondWithResult(_0x3c588d,_0x1540b7){_0x1540b7=_0x1540b7||0xc8;return function(_0x2df226){if(_0x2df226){return _0x3c588d[_0xb3bc('0x1b')](_0x1540b7)[_0xb3bc('0x1d')](_0x2df226);}};}function respondWithFilteredResult(_0x243724,_0x3ff329){return function(_0x24deaf){if(_0x24deaf){var _0x43ece4=_0x24deaf[_0xb3bc('0x1e')],_0x22dd9f=_0x3ff329['offset'],_0x29091e=_0x3ff329[_0xb3bc('0x1f')]+_0x3ff329[_0xb3bc('0x20')],_0x1a97ac;if(_0x29091e>=_0x43ece4){_0x29091e=_0x43ece4;_0x1a97ac=0xc8;}else{_0x1a97ac=0xce;}_0x243724[_0xb3bc('0x1b')](_0x1a97ac);return _0x243724[_0xb3bc('0x21')](_0xb3bc('0x22'),_0x22dd9f+'-'+_0x29091e+'/'+_0x43ece4)[_0xb3bc('0x1d')](_0x24deaf);}return null;};}function patchUpdates(_0x95153c){return function(_0x3ba81f){try{jsonpatch[_0xb3bc('0x23')](_0x3ba81f,_0x95153c,!![]);}catch(_0x86365d){return BPromise[_0xb3bc('0x24')](_0x86365d);}return _0x3ba81f['save']();};}function saveUpdates(_0x53b122,_0x502741){return function(_0x406110){if(_0x406110){return _0x406110[_0xb3bc('0x25')](_0x53b122)[_0xb3bc('0x26')](function(_0x423ba8){return _0x423ba8;});}return null;};}function removeEntity(_0x1a6f7d,_0x4b348e){return function(_0x27135d){if(_0x27135d){return _0x27135d[_0xb3bc('0x27')]()[_0xb3bc('0x26')](function(){_0x1a6f7d[_0xb3bc('0x1b')](0xcc)[_0xb3bc('0x1c')]();});}};}function handleEntityNotFound(_0x251ecc,_0x301195){return function(_0x2c8d2f){if(!_0x2c8d2f){_0x251ecc[_0xb3bc('0x1a')](0x194);}return _0x2c8d2f;};}function handleError(_0x540eb3,_0x2802c6){_0x2802c6=_0x2802c6||0x1f4;return function(_0x5e7e48){logger[_0xb3bc('0x28')](_0x5e7e48[_0xb3bc('0x29')]);if(_0x5e7e48[_0xb3bc('0x2a')]){delete _0x5e7e48['name'];}_0x540eb3[_0xb3bc('0x1b')](_0x2802c6)['send'](_0x5e7e48);};}exports[_0xb3bc('0x2b')]=function(_0x18096b,_0x2bd666){var _0x3333e3={},_0x28e322={},_0x2ee02e={'count':0x0,'rows':[]};var _0x1a798c=_[_0xb3bc('0x2c')](db[_0xb3bc('0x2d')][_0xb3bc('0x2e')],function(_0x476969){return{'name':_0x476969[_0xb3bc('0x2f')],'type':_0x476969[_0xb3bc('0x30')]['key']};});_0x28e322[_0xb3bc('0x31')]=_[_0xb3bc('0x2c')](_0x1a798c,_0xb3bc('0x2a'));_0x28e322[_0xb3bc('0x32')]=_[_0xb3bc('0x33')](_0x18096b[_0xb3bc('0x32')]);_0x28e322[_0xb3bc('0x34')]=_[_0xb3bc('0x35')](_0x28e322[_0xb3bc('0x31')],_0x28e322['query']);_0x3333e3[_0xb3bc('0x36')]=_[_0xb3bc('0x35')](_0x28e322[_0xb3bc('0x31')],qs[_0xb3bc('0x37')](_0x18096b[_0xb3bc('0x32')]['fields']));_0x3333e3[_0xb3bc('0x36')]=_0x3333e3['attributes'][_0xb3bc('0x38')]?_0x3333e3['attributes']:_0x28e322[_0xb3bc('0x31')];if(!_0x18096b[_0xb3bc('0x32')][_0xb3bc('0x39')](_0xb3bc('0x3a'))){_0x3333e3[_0xb3bc('0x20')]=qs[_0xb3bc('0x20')](_0x18096b[_0xb3bc('0x32')][_0xb3bc('0x20')]);_0x3333e3['offset']=qs['offset'](_0x18096b[_0xb3bc('0x32')][_0xb3bc('0x1f')]);}_0x3333e3['order']=qs[_0xb3bc('0x3b')](_0x18096b[_0xb3bc('0x32')]['sort']);_0x3333e3['where']=qs[_0xb3bc('0x34')](_[_0xb3bc('0x3c')](_0x18096b['query'],_0x28e322[_0xb3bc('0x34')]),_0x1a798c);if(_0x18096b[_0xb3bc('0x32')][_0xb3bc('0x3d')]){_0x3333e3[_0xb3bc('0x3e')]=_['merge'](_0x3333e3['where'],{'$or':_[_0xb3bc('0x2c')](_0x1a798c,function(_0x3b1d35){if(_0x3b1d35[_0xb3bc('0x30')]!=='VIRTUAL'){var _0x164dbf={};_0x164dbf[_0x3b1d35['name']]={'$like':'%'+_0x18096b[_0xb3bc('0x32')][_0xb3bc('0x3d')]+'%'};return _0x164dbf;}})});}_0x3333e3=_[_0xb3bc('0x3f')]({},_0x3333e3,_0x18096b[_0xb3bc('0x40')]);var _0x5e1e3b={'where':_0x3333e3['where']};return db[_0xb3bc('0x2d')]['count'](_0x5e1e3b)[_0xb3bc('0x26')](function(_0x4649eb){_0x2ee02e[_0xb3bc('0x1e')]=_0x4649eb;if(_0x18096b[_0xb3bc('0x32')][_0xb3bc('0x41')]){_0x3333e3['include']=[{'all':!![]}];}return db[_0xb3bc('0x2d')][_0xb3bc('0x42')](_0x3333e3);})[_0xb3bc('0x26')](function(_0xc2fffe){_0x2ee02e['rows']=_0xc2fffe;return _0x2ee02e;})['then'](respondWithFilteredResult(_0x2bd666,_0x3333e3))['catch'](handleError(_0x2bd666,null));};exports['show']=function(_0x3e8374,_0x12f69f){var _0x45bf54={'raw':!![],'where':{'id':_0x3e8374[_0xb3bc('0x43')]['id']}},_0x4574f5={};_0x4574f5[_0xb3bc('0x31')]=_[_0xb3bc('0x33')](db[_0xb3bc('0x2d')][_0xb3bc('0x2e')]);_0x4574f5[_0xb3bc('0x32')]=_[_0xb3bc('0x33')](_0x3e8374[_0xb3bc('0x32')]);_0x4574f5[_0xb3bc('0x34')]=_[_0xb3bc('0x35')](_0x4574f5['model'],_0x4574f5[_0xb3bc('0x32')]);_0x45bf54[_0xb3bc('0x36')]=_[_0xb3bc('0x35')](_0x4574f5[_0xb3bc('0x31')],qs[_0xb3bc('0x37')](_0x3e8374[_0xb3bc('0x32')][_0xb3bc('0x37')]));_0x45bf54[_0xb3bc('0x36')]=_0x45bf54[_0xb3bc('0x36')][_0xb3bc('0x38')]?_0x45bf54['attributes']:_0x4574f5[_0xb3bc('0x31')];if(_0x3e8374[_0xb3bc('0x32')][_0xb3bc('0x41')]){_0x45bf54[_0xb3bc('0x44')]=[{'all':!![]}];}_0x45bf54=_[_0xb3bc('0x3f')]({},_0x45bf54,_0x3e8374[_0xb3bc('0x40')]);return db[_0xb3bc('0x2d')]['find'](_0x45bf54)[_0xb3bc('0x26')](handleEntityNotFound(_0x12f69f,null))[_0xb3bc('0x26')](respondWithResult(_0x12f69f,null))[_0xb3bc('0x45')](handleError(_0x12f69f,null));};exports[_0xb3bc('0x46')]=function(_0x4246d1,_0x385453){return db[_0xb3bc('0x2d')][_0xb3bc('0x46')](_0x4246d1[_0xb3bc('0x47')],{})['then'](respondWithResult(_0x385453,0xc9))[_0xb3bc('0x45')](handleError(_0x385453,null));};exports[_0xb3bc('0x25')]=function(_0x247248,_0x120a8a){if(_0x247248[_0xb3bc('0x47')]['id']){delete _0x247248['body']['id'];}return db[_0xb3bc('0x2d')][_0xb3bc('0x48')]({'where':{'id':_0x247248[_0xb3bc('0x43')]['id']}})['then'](handleEntityNotFound(_0x120a8a,null))[_0xb3bc('0x26')](saveUpdates(_0x247248[_0xb3bc('0x47')],null))[_0xb3bc('0x26')](respondWithResult(_0x120a8a,null))[_0xb3bc('0x45')](handleError(_0x120a8a,null));};exports[_0xb3bc('0x27')]=function(_0x44deb7,_0x5e2e9e){return db[_0xb3bc('0x2d')][_0xb3bc('0x48')]({'where':{'id':_0x44deb7['params']['id']}})[_0xb3bc('0x26')](handleEntityNotFound(_0x5e2e9e,null))['then'](removeEntity(_0x5e2e9e,null))['catch'](handleError(_0x5e2e9e,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 7d951d2..1e5c0e4 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 _0x54b1=['define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x2dd390,_0x1bc894){var _0x3afe47=function(_0x42d8d3){while(--_0x42d8d3){_0x2dd390['push'](_0x2dd390['shift']());}};_0x3afe47(++_0x1bc894);}(_0x54b1,0x7e));var _0x154b=function(_0x2ca431,_0x22bbe7){_0x2ca431=_0x2ca431-0x0;var _0x5d5f6c=_0x54b1[_0x2ca431];return _0x5d5f6c;};'use strict';var _=require(_0x154b('0x0'));var util=require(_0x154b('0x1'));var logger=require('../../config/logger')(_0x154b('0x2'));var moment=require(_0x154b('0x3'));var BPromise=require(_0x154b('0x4'));var rp=require(_0x154b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x154b('0x6'));var config=require(_0x154b('0x7'));var attributes=require('./intSugarcrmField.attributes');module[_0x154b('0x8')]=function(_0x8c2588,_0x4f6472){return _0x8c2588[_0x154b('0x9')](_0x154b('0xa'),attributes,{'tableName':_0x154b('0xb'),'paranoid':![],'indexes':[{'name':_0x154b('0xc'),'fields':[_0x154b('0xd'),_0x154b('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc734=['moment','bluebird','request-promise','path','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x2f27bc,_0x127b82){var _0x149ed4=function(_0x3951d6){while(--_0x3951d6){_0x2f27bc['push'](_0x2f27bc['shift']());}};_0x149ed4(++_0x127b82);}(_0xc734,0xf9));var _0x4c73=function(_0x473738,_0x15ea31){_0x473738=_0x473738-0x0;var _0x1df4ae=_0xc734[_0x473738];return _0x1df4ae;};'use strict';var _=require(_0x4c73('0x0'));var util=require(_0x4c73('0x1'));var logger=require(_0x4c73('0x2'))('api');var moment=require(_0x4c73('0x3'));var BPromise=require(_0x4c73('0x4'));var rp=require(_0x4c73('0x5'));var fs=require('fs');var path=require(_0x4c73('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4c73('0x7'));module[_0x4c73('0x8')]=function(_0x2350a8,_0x4e2272){return _0x2350a8[_0x4c73('0x9')](_0x4c73('0xa'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x4c73('0xb'),'fields':[_0x4c73('0xc'),_0x4c73('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 9a0c213..7eea011 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 _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SugarcrmField,\x20%s,\x20%s','message','catch','lodash'];(function(_0x51febe,_0x2b87b9){var _0xf125af=function(_0x1e2833){while(--_0x1e2833){_0x51febe['push'](_0x51febe['shift']());}};_0xf125af(++_0x2b87b9);}(_0x66fa,0x117));var _0xa66f=function(_0x91cba2,_0x56c536){_0x91cba2=_0x91cba2-0x0;var _0x3c8d2f=_0x66fa[_0x91cba2];return _0x3c8d2f;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});} \ No newline at end of file +var _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0x3ecc30,_0x75412b){var _0x2682bc=function(_0x34c384){while(--_0x34c384){_0x3ecc30['push'](_0x3ecc30['shift']());}};_0x2682bc(++_0x75412b);}(_0xda2d,0x102));var _0xdda2=function(_0xf41d46,_0x1076c6){_0xf41d46=_0xf41d46-0x0;var _0x59fabd=_0xda2d[_0xf41d46];return _0x59fabd;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index d5ea52d..5c33923 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 _0xfed8=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show','get','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports','multer','util'];(function(_0x44684a,_0x37d828){var _0xca3aa3=function(_0x457e9f){while(--_0x457e9f){_0x44684a['push'](_0x44684a['shift']());}};_0xca3aa3(++_0x37d828);}(_0xfed8,0x82));var _0x8fed=function(_0x215237,_0x2812d3){_0x215237=_0x215237-0x0;var _0x15745b=_0xfed8[_0x215237];return _0x15745b;};'use strict';var multer=require(_0x8fed('0x0'));var util=require(_0x8fed('0x1'));var path=require(_0x8fed('0x2'));var timeout=require(_0x8fed('0x3'));var express=require(_0x8fed('0x4'));var router=express['Router']();var auth=require(_0x8fed('0x5'));var interaction=require(_0x8fed('0x6'));var config=require(_0x8fed('0x7'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x8fed('0x8'),auth[_0x8fed('0x9')](),controller[_0x8fed('0xa')]);router[_0x8fed('0xb')](_0x8fed('0xc'),auth[_0x8fed('0x9')](),controller['getConfigurations']);router[_0x8fed('0xb')](_0x8fed('0xd'),auth['isAuthenticated'](),controller[_0x8fed('0xe')]);router[_0x8fed('0xf')]('/',auth['isAuthenticated'](),controller[_0x8fed('0x10')]);router[_0x8fed('0xf')](_0x8fed('0xc'),auth['isAuthenticated'](),controller[_0x8fed('0x11')]);router['put'](_0x8fed('0x8'),auth[_0x8fed('0x9')](),controller[_0x8fed('0x12')]);router[_0x8fed('0x13')](_0x8fed('0x8'),auth[_0x8fed('0x9')](),controller[_0x8fed('0x14')]);module[_0x8fed('0x15')]=router; \ No newline at end of file +var _0x7095=['../../components/auth/service','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','/:id/fields','getFields','post','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x46c9d6,_0x26bfa4){var _0x221a0d=function(_0x1e824e){while(--_0x1e824e){_0x46c9d6['push'](_0x46c9d6['shift']());}};_0x221a0d(++_0x26bfa4);}(_0x7095,0x18a));var _0x5709=function(_0x1ab33f,_0x46262b){_0x1ab33f=_0x1ab33f-0x0;var _0x5b4e3e=_0x7095[_0x1ab33f];return _0x5b4e3e;};'use strict';var multer=require(_0x5709('0x0'));var util=require(_0x5709('0x1'));var path=require(_0x5709('0x2'));var timeout=require(_0x5709('0x3'));var express=require(_0x5709('0x4'));var router=express[_0x5709('0x5')]();var auth=require(_0x5709('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5709('0x7'));router['get']('/',auth[_0x5709('0x8')](),controller[_0x5709('0x9')]);router[_0x5709('0xa')](_0x5709('0xb'),auth[_0x5709('0x8')](),controller[_0x5709('0xc')]);router[_0x5709('0xa')](_0x5709('0xd'),auth[_0x5709('0x8')](),controller['getConfigurations']);router[_0x5709('0xa')](_0x5709('0xe'),auth[_0x5709('0x8')](),controller[_0x5709('0xf')]);router[_0x5709('0x10')]('/',auth[_0x5709('0x8')](),controller['create']);router[_0x5709('0x10')](_0x5709('0xd'),auth[_0x5709('0x8')](),controller['addConfiguration']);router['put'](_0x5709('0xb'),auth[_0x5709('0x8')](),controller[_0x5709('0x11')]);router[_0x5709('0x12')](_0x5709('0xb'),auth[_0x5709('0x8')](),controller['destroy']);module[_0x5709('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index caad6c8..dc61360 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 _0x8234=['exports','STRING','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8234,0x19d));var _0x4823=function(_0x4401e6,_0x130b83){_0x4401e6=_0x4401e6-0x0;var _0x45970a=_0x8234[_0x4401e6];return _0x45970a;};'use strict';var Sequelize=require(_0x4823('0x0'));module[_0x4823('0x1')]={'name':{'type':Sequelize[_0x4823('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4823('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x4823('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x4823('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x4823('0x2')]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xa1cb=['sequelize','STRING','HelpDesk'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xa1cb,0x1bf));var _0xba1c=function(_0x35caba,_0x13138f){_0x35caba=_0x35caba-0x0;var _0x3eddfe=_0xa1cb[_0x35caba];return _0x3eddfe;};'use strict';var Sequelize=require(_0xba1c('0x0'));module['exports']={'name':{'type':Sequelize[_0xba1c('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xba1c('0x1')],'allowNull':![],'defaultValue':_0xba1c('0x2')},'remoteUri':{'type':Sequelize[_0xba1c('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xba1c('0x1')]},'accessKey':{'type':Sequelize[_0xba1c('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index c3e6a4e..be6e70a 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 _0xb91d=['sort','where','filter','map','merge','options','includeAll','findAll','show','keys','rawAttributes','include','find','create','body','params','findOne','VtigerConfiguration','pick','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','username','description','remoteUri','accessKey','moduleName','slice','format','%s/webservice.php','GET','getchallenge','success','POST','login','token','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false','startsWith','cf_','picklist','picklistValues','label','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','name','index','VtigerAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb91d,0x1c6));var _0xdb91=function(_0x30c2ae,_0x4c98a2){_0x30c2ae=_0x30c2ae-0x0;var _0x1ee1cc=_0xb91d[_0x30c2ae];return _0x1ee1cc;};'use strict';var pdf=require(_0xdb91('0x0'));var emlformat=require(_0xdb91('0x1'));var rimraf=require(_0xdb91('0x2'));var zipdir=require(_0xdb91('0x3'));var jsonpatch=require(_0xdb91('0x4'));var rp=require(_0xdb91('0x5'));var moment=require(_0xdb91('0x6'));var BPromise=require(_0xdb91('0x7'));var Mustache=require('mustache');var util=require(_0xdb91('0x8'));var path=require('path');var sox=require(_0xdb91('0x9'));var csv=require(_0xdb91('0xa'));var ejs=require(_0xdb91('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdb91('0xc'));var crypto=require(_0xdb91('0xd'));var jsforce=require(_0xdb91('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdb91('0xf'));var Papa=require('papaparse');var Redis=require(_0xdb91('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdb91('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdb91('0x12'));var utils=require('../../config/utils');var config=require(_0xdb91('0x13'));var db=require(_0xdb91('0x14'))['db'];var integrations=require(_0xdb91('0x15'));var jayson=require(_0xdb91('0x16'));var client=jayson[_0xdb91('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0xf2e3f0,_0x2d9ea8,_0x14e51b){if(_0x14e51b){var _0x139ad4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x139ad4[_0xdb91('0x18')](_0x2d9ea8)){return _0xf2e3f0;}else{throw new db[(_0xdb91('0x19'))][(_0xdb91('0x1a'))](_0xdb91('0x1b'));}}else{return _0xf2e3f0;}}function respondWithRpcPromise(_0x35b705,_0x2cb9b8,_0x15600f,_0x46ecb8){return new BPromise(function(_0x519703,_0x310f93){var _0x184a95=_0x46ecb8||client;return _0x184a95['request'](_0x35b705,_0x15600f)[_0xdb91('0x1c')](function(_0x1a3031){logger['info'](_0xdb91('0x1d'),_0x2cb9b8,'request\x20sent');logger[_0xdb91('0x1e')](_0xdb91('0x1f'),_0x2cb9b8,_0xdb91('0x20'),JSON['stringify'](_0x1a3031));if(_0x1a3031[_0xdb91('0x21')]){if(_0x1a3031[_0xdb91('0x21')][_0xdb91('0x22')]===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x2cb9b8,_0x1a3031['error'][_0xdb91('0x23')]);return _0x310f93(_0x1a3031[_0xdb91('0x21')][_0xdb91('0x23')]);}logger[_0xdb91('0x21')]('VtigerAccount,\x20%s,\x20%s',_0x2cb9b8,_0x1a3031[_0xdb91('0x21')][_0xdb91('0x23')]);return _0x519703(_0x1a3031[_0xdb91('0x21')][_0xdb91('0x23')]);}else{logger['info'](_0xdb91('0x1d'),_0x2cb9b8,'request\x20sent');_0x519703(_0x1a3031[_0xdb91('0x24')][_0xdb91('0x23')]);}})[_0xdb91('0x25')](function(_0x140ffd){logger[_0xdb91('0x21')](_0xdb91('0x1d'),_0x2cb9b8,_0x140ffd);_0x310f93(_0x140ffd);});});}function respondWithStatusCode(_0x37d676,_0x5d1daa){_0x5d1daa=_0x5d1daa||0xcc;return function(_0x5a5096){if(_0x5a5096){return _0x37d676[_0xdb91('0x26')](_0x5d1daa);}return _0x37d676[_0xdb91('0x27')](_0x5d1daa)[_0xdb91('0x28')]();};}function respondWithResult(_0x2e7438,_0x23ca08){_0x23ca08=_0x23ca08||0xc8;return function(_0x369093){if(_0x369093){return _0x2e7438[_0xdb91('0x27')](_0x23ca08)[_0xdb91('0x29')](_0x369093);}};}function respondWithFilteredResult(_0x258062,_0x396280){return function(_0x49211a){if(_0x49211a){var _0x316319=_0x49211a[_0xdb91('0x2a')],_0x3a164a=_0x396280[_0xdb91('0x2b')],_0x573b09=_0x396280[_0xdb91('0x2b')]+_0x396280[_0xdb91('0x2c')],_0x2036ac;if(_0x573b09>=_0x316319){_0x573b09=_0x316319;_0x2036ac=0xc8;}else{_0x2036ac=0xce;}_0x258062['status'](_0x2036ac);return _0x258062['set'](_0xdb91('0x2d'),_0x3a164a+'-'+_0x573b09+'/'+_0x316319)[_0xdb91('0x29')](_0x49211a);}return null;};}function patchUpdates(_0x41716e){return function(_0x4a322c){try{jsonpatch[_0xdb91('0x2e')](_0x4a322c,_0x41716e,!![]);}catch(_0x3d9371){return BPromise[_0xdb91('0x2f')](_0x3d9371);}return _0x4a322c[_0xdb91('0x30')]();};}function saveUpdates(_0x51116c,_0xdf662e){return function(_0xc1863e){if(_0xc1863e){return _0xc1863e[_0xdb91('0x31')](_0x51116c)[_0xdb91('0x1c')](function(_0x5bd3b4){return _0x5bd3b4;});}return null;};}function removeEntity(_0x30dc0d,_0x4988c7){return function(_0x12d5d2){if(_0x12d5d2){return _0x12d5d2[_0xdb91('0x32')]()[_0xdb91('0x1c')](function(){_0x30dc0d[_0xdb91('0x27')](0xcc)[_0xdb91('0x28')]();});}};}function handleEntityNotFound(_0x4b70b6,_0x3ecc16){return function(_0x2ae36a){if(!_0x2ae36a){_0x4b70b6[_0xdb91('0x26')](0x194);}return _0x2ae36a;};}function handleError(_0xc41397,_0x2871b7){_0x2871b7=_0x2871b7||0x1f4;return function(_0x408d45){logger[_0xdb91('0x21')](_0x408d45['stack']);if(_0x408d45[_0xdb91('0x33')]){delete _0x408d45[_0xdb91('0x33')];}_0xc41397['status'](_0x2871b7)['send'](_0x408d45);};}exports[_0xdb91('0x34')]=function(_0x1f028f,_0x4e4d27){var _0x763a6e={},_0x3a0611={},_0x58c5a5={'count':0x0,'rows':[]};var _0xe1f72d=_['map'](db[_0xdb91('0x35')]['rawAttributes'],function(_0x9c9784){return{'name':_0x9c9784[_0xdb91('0x36')],'type':_0x9c9784[_0xdb91('0x37')][_0xdb91('0x38')]};});_0x3a0611[_0xdb91('0x39')]=_['map'](_0xe1f72d,_0xdb91('0x33'));_0x3a0611[_0xdb91('0x3a')]=_['keys'](_0x1f028f[_0xdb91('0x3a')]);_0x3a0611[_0xdb91('0x3b')]=_[_0xdb91('0x3c')](_0x3a0611[_0xdb91('0x39')],_0x3a0611[_0xdb91('0x3a')]);_0x763a6e[_0xdb91('0x3d')]=_[_0xdb91('0x3c')](_0x3a0611[_0xdb91('0x39')],qs[_0xdb91('0x3e')](_0x1f028f[_0xdb91('0x3a')][_0xdb91('0x3e')]));_0x763a6e['attributes']=_0x763a6e['attributes'][_0xdb91('0x3f')]?_0x763a6e['attributes']:_0x3a0611[_0xdb91('0x39')];if(!_0x1f028f[_0xdb91('0x3a')][_0xdb91('0x40')]('nolimit')){_0x763a6e[_0xdb91('0x2c')]=qs[_0xdb91('0x2c')](_0x1f028f['query'][_0xdb91('0x2c')]);_0x763a6e[_0xdb91('0x2b')]=qs[_0xdb91('0x2b')](_0x1f028f[_0xdb91('0x3a')][_0xdb91('0x2b')]);}_0x763a6e[_0xdb91('0x41')]=qs[_0xdb91('0x42')](_0x1f028f[_0xdb91('0x3a')][_0xdb91('0x42')]);_0x763a6e[_0xdb91('0x43')]=qs[_0xdb91('0x3b')](_['pick'](_0x1f028f[_0xdb91('0x3a')],_0x3a0611[_0xdb91('0x3b')]),_0xe1f72d);if(_0x1f028f['query'][_0xdb91('0x44')]){_0x763a6e['where']=_['merge'](_0x763a6e[_0xdb91('0x43')],{'$or':_[_0xdb91('0x45')](_0xe1f72d,function(_0x3a6d8f){if(_0x3a6d8f[_0xdb91('0x37')]!=='VIRTUAL'){var _0x1fc8b3={};_0x1fc8b3[_0x3a6d8f[_0xdb91('0x33')]]={'$like':'%'+_0x1f028f['query'][_0xdb91('0x44')]+'%'};return _0x1fc8b3;}})});}_0x763a6e=_[_0xdb91('0x46')]({},_0x763a6e,_0x1f028f[_0xdb91('0x47')]);var _0x4f5cff={'where':_0x763a6e[_0xdb91('0x43')]};return db['VtigerAccount'][_0xdb91('0x2a')](_0x4f5cff)[_0xdb91('0x1c')](function(_0x5d3011){_0x58c5a5[_0xdb91('0x2a')]=_0x5d3011;if(_0x1f028f[_0xdb91('0x3a')][_0xdb91('0x48')]){_0x763a6e['include']=[{'all':!![]}];}return db[_0xdb91('0x35')][_0xdb91('0x49')](_0x763a6e);})[_0xdb91('0x1c')](function(_0x7be19){_0x58c5a5['rows']=_0x7be19;return _0x58c5a5;})[_0xdb91('0x1c')](respondWithFilteredResult(_0x4e4d27,_0x763a6e))[_0xdb91('0x25')](handleError(_0x4e4d27,null));};exports[_0xdb91('0x4a')]=function(_0x12cd80,_0x153106){var _0xbd9733={'raw':![],'where':{'id':_0x12cd80['params']['id']}},_0x556efb={};_0x556efb['model']=_[_0xdb91('0x4b')](db[_0xdb91('0x35')][_0xdb91('0x4c')]);_0x556efb[_0xdb91('0x3a')]=_['keys'](_0x12cd80[_0xdb91('0x3a')]);_0x556efb[_0xdb91('0x3b')]=_['intersection'](_0x556efb[_0xdb91('0x39')],_0x556efb['query']);_0xbd9733[_0xdb91('0x3d')]=_[_0xdb91('0x3c')](_0x556efb[_0xdb91('0x39')],qs[_0xdb91('0x3e')](_0x12cd80[_0xdb91('0x3a')][_0xdb91('0x3e')]));_0xbd9733[_0xdb91('0x3d')]=_0xbd9733['attributes'][_0xdb91('0x3f')]?_0xbd9733[_0xdb91('0x3d')]:_0x556efb[_0xdb91('0x39')];if(_0x12cd80['query'][_0xdb91('0x48')]){_0xbd9733[_0xdb91('0x4d')]=[{'all':!![]}];}_0xbd9733=_[_0xdb91('0x46')]({},_0xbd9733,_0x12cd80[_0xdb91('0x47')]);return db[_0xdb91('0x35')][_0xdb91('0x4e')](_0xbd9733)[_0xdb91('0x1c')](handleEntityNotFound(_0x153106,null))[_0xdb91('0x1c')](respondWithResult(_0x153106,null))['catch'](handleError(_0x153106,null));};exports[_0xdb91('0x4f')]=function(_0xeab624,_0x2f6601){return db[_0xdb91('0x35')][_0xdb91('0x4f')](_0xeab624[_0xdb91('0x50')],{})['then'](respondWithResult(_0x2f6601,0xc9))[_0xdb91('0x25')](handleError(_0x2f6601,null));};exports['update']=function(_0x38fc52,_0x345770){if(_0x38fc52[_0xdb91('0x50')]['id']){delete _0x38fc52['body']['id'];}return db['VtigerAccount'][_0xdb91('0x4e')]({'where':{'id':_0x38fc52[_0xdb91('0x51')]['id']}})[_0xdb91('0x1c')](handleEntityNotFound(_0x345770,null))[_0xdb91('0x1c')](saveUpdates(_0x38fc52['body'],null))[_0xdb91('0x1c')](respondWithResult(_0x345770,null))[_0xdb91('0x25')](handleError(_0x345770,null));};exports[_0xdb91('0x32')]=function(_0x3ffad2,_0x450472){return db[_0xdb91('0x35')]['find']({'where':{'id':_0x3ffad2[_0xdb91('0x51')]['id']}})[_0xdb91('0x1c')](handleEntityNotFound(_0x450472,null))[_0xdb91('0x1c')](removeEntity(_0x450472,null))[_0xdb91('0x25')](handleError(_0x450472,null));};exports['getConfigurations']=function(_0x534b86,_0x4a3862,_0x9e3582){var _0x82d9b={};var _0x1c7b86={};var _0xe95c0f;var _0x6d3478;return db['VtigerAccount'][_0xdb91('0x52')]({'where':{'id':_0x534b86[_0xdb91('0x51')]['id']}})[_0xdb91('0x1c')](handleEntityNotFound(_0x4a3862,null))[_0xdb91('0x1c')](function(_0x550a89){if(_0x550a89){_0xe95c0f=_0x550a89;_0x1c7b86[_0xdb91('0x39')]=_[_0xdb91('0x4b')](db[_0xdb91('0x53')]['rawAttributes']);_0x1c7b86[_0xdb91('0x3a')]=_[_0xdb91('0x4b')](_0x534b86['query']);_0x1c7b86[_0xdb91('0x3b')]=_[_0xdb91('0x3c')](_0x1c7b86[_0xdb91('0x39')],_0x1c7b86[_0xdb91('0x3a')]);_0x82d9b[_0xdb91('0x3d')]=_[_0xdb91('0x3c')](_0x1c7b86[_0xdb91('0x39')],qs[_0xdb91('0x3e')](_0x534b86[_0xdb91('0x3a')][_0xdb91('0x3e')]));_0x82d9b[_0xdb91('0x3d')]=_0x82d9b[_0xdb91('0x3d')][_0xdb91('0x3f')]?_0x82d9b[_0xdb91('0x3d')]:_0x1c7b86[_0xdb91('0x39')];_0x82d9b[_0xdb91('0x41')]=qs['sort'](_0x534b86[_0xdb91('0x3a')]['sort']);_0x82d9b[_0xdb91('0x43')]=qs[_0xdb91('0x3b')](_[_0xdb91('0x54')](_0x534b86[_0xdb91('0x3a')],_0x1c7b86['filters']));if(_0x534b86[_0xdb91('0x3a')][_0xdb91('0x44')]){_0x82d9b[_0xdb91('0x43')]=_[_0xdb91('0x46')](_0x82d9b[_0xdb91('0x43')],{'$or':_[_0xdb91('0x45')](_0x82d9b['attributes'],function(_0x6f0bf5){var _0x5beb12={};_0x5beb12[_0x6f0bf5]={'$like':'%'+_0x534b86[_0xdb91('0x3a')][_0xdb91('0x44')]+'%'};return _0x5beb12;})});}_0x82d9b=_[_0xdb91('0x46')]({},_0x82d9b,_0x534b86[_0xdb91('0x47')]);return _0xe95c0f['getConfigurations'](_0x82d9b);}})[_0xdb91('0x1c')](function(_0x365305){if(_0x365305){_0x6d3478=_0x365305[_0xdb91('0x3f')];if(!_0x534b86[_0xdb91('0x3a')][_0xdb91('0x40')]('nolimit')){_0x82d9b[_0xdb91('0x2c')]=qs[_0xdb91('0x2c')](_0x534b86['query']['limit']);_0x82d9b[_0xdb91('0x2b')]=qs[_0xdb91('0x2b')](_0x534b86[_0xdb91('0x3a')][_0xdb91('0x2b')]);}return _0xe95c0f[_0xdb91('0x55')](_0x82d9b);}})['then'](function(_0x34c9c6){if(_0x34c9c6){return _0x34c9c6?{'count':_0x6d3478,'rows':_0x34c9c6}:null;}})[_0xdb91('0x1c')](respondWithResult(_0x4a3862,null))[_0xdb91('0x25')](handleError(_0x4a3862,null));};exports[_0xdb91('0x56')]=function(_0x531faf,_0x1b307a,_0x41889b){if(_0x531faf[_0xdb91('0x50')]['id']){delete _0x531faf[_0xdb91('0x50')]['id'];}return db[_0xdb91('0x35')]['findOne']({'where':{'id':_0x531faf['params']['id']}})[_0xdb91('0x1c')](handleEntityNotFound(_0x1b307a,null))[_0xdb91('0x1c')](function(_0x57bc79){if(_0x57bc79){_0x531faf['body'][_0xdb91('0x57')]=_0x57bc79['id'];_0x531faf['body'][_0xdb91('0x58')]=integrations[_0xdb91('0x59')](_0x531faf[_0xdb91('0x50')][_0xdb91('0x5a')],_0x531faf['body'][_0xdb91('0x37')]);_0x531faf[_0xdb91('0x50')][_0xdb91('0x5b')]=integrations[_0xdb91('0x5c')](_0x531faf[_0xdb91('0x50')][_0xdb91('0x5a')],_0x531faf['body'][_0xdb91('0x37')]);return db[_0xdb91('0x53')][_0xdb91('0x4f')](_0x531faf[_0xdb91('0x50')],{'include':[{'model':db['VtigerField'],'as':_0xdb91('0x58')},{'model':db['VtigerField'],'as':_0xdb91('0x5b')}]});}return null;})['then'](respondWithResult(_0x1b307a,null))[_0xdb91('0x25')](handleError(_0x1b307a,null));};var md5=require('md5');exports[_0xdb91('0x5d')]=function(_0x5a4c3f,_0x33a3a8,_0x2c7159){var _0x4882d4=null;var _0x494c3e=null;var _0x200159=null;var _0x3f292b=null;var _0x4035a5='';return db[_0xdb91('0x35')][_0xdb91('0x52')]({'where':{'id':_0x5a4c3f[_0xdb91('0x51')]['id']},'attributes':['id',_0xdb91('0x33'),_0xdb91('0x5e'),_0xdb91('0x5f'),'moduleName',_0xdb91('0x60'),'serverUrl',_0xdb91('0x61')]})['then'](handleEntityNotFound(_0x33a3a8,null))['then'](function(_0x2e481f){if(_0x2e481f){_0x4882d4=_0x2e481f[_0xdb91('0x5e')];_0x494c3e=_0x2e481f[_0xdb91('0x61')];_0x200159=_0x2e481f[_0xdb91('0x62')];_0x4035a5=_0x2e481f[_0xdb91('0x60')];var _0x4ab1bd=_0x4035a5[_0xdb91('0x63')](-0x1);if(_0x4ab1bd==='/'){_0x4035a5=_0x4035a5['substring'](0x0,_0x4035a5['lastIndexOf'](_0x4ab1bd));}_0x3f292b=util[_0xdb91('0x64')](_0xdb91('0x65'),_0x4035a5);var _0x4093ce={'method':_0xdb91('0x66'),'uri':_0x3f292b,'qs':{'operation':_0xdb91('0x67'),'username':_0x2e481f[_0xdb91('0x5e')]},'json':!![]};return rp(_0x4093ce);}})[_0xdb91('0x1c')](function(_0x4aa9c9){if(_0x4aa9c9[_0xdb91('0x68')]){var _0x4b34c0={'method':_0xdb91('0x69'),'uri':_0x3f292b,'form':{'operation':_0xdb91('0x6a'),'username':_0x4882d4,'accessKey':md5(_0x4aa9c9[_0xdb91('0x24')][_0xdb91('0x6b')]+_0x494c3e)},'json':!![]};return rp(_0x4b34c0);}})[_0xdb91('0x1c')](function(_0x43254a){if(_0x43254a['success']){var _0x4f1f8e={'method':_0xdb91('0x66'),'uri':_0x3f292b,'qs':{'operation':_0xdb91('0x6c'),'username':_0x4882d4,'sessionName':_0x43254a[_0xdb91('0x24')][_0xdb91('0x6d')],'elementType':_0x200159},'json':!![]};return rp(_0x4f1f8e);}})[_0xdb91('0x1c')](function(_0x376b1c){if(_0x376b1c[_0xdb91('0x68')]){var _0x174523=[_0xdb91('0x6e'),_0xdb91('0x6f'),_0xdb91('0x70')];_[_0xdb91('0x71')](_0x376b1c['result'][_0xdb91('0x3e')],function(_0x4a8a38){return _0x174523[_0xdb91('0x72')](_0x4a8a38[_0xdb91('0x37')]['name']);});_[_0xdb91('0x71')](_0x376b1c[_0xdb91('0x24')][_0xdb91('0x3e')],function(_0x594278){return _0x594278[_0xdb91('0x73')]===_0xdb91('0x74');});return{'count':_0x376b1c['result'][_0xdb91('0x3e')][_0xdb91('0x3f')],'rows':_[_0xdb91('0x45')](_0x376b1c[_0xdb91('0x24')][_0xdb91('0x3e')],function(_0x1172e3){return{'id':_0x1172e3[_0xdb91('0x33')],'name':_0x1172e3['label'],'custom':_[_0xdb91('0x75')](_0x1172e3[_0xdb91('0x33')],_0xdb91('0x76'))?!![]:![],'options':_0x1172e3['type'][_0xdb91('0x33')]===_0xdb91('0x77')&&_0x1172e3[_0xdb91('0x37')]['picklistValues']['length']>0x0?_['map'](_0x1172e3[_0xdb91('0x37')][_0xdb91('0x78')],function(_0x42f2ff){return{'name':_0x42f2ff[_0xdb91('0x79')],'value':_0x42f2ff[_0xdb91('0x7a')]};}):[]};})};}})[_0xdb91('0x1c')](respondWithResult(_0x33a3a8,null))['catch'](function(_0x4de33f){console[_0xdb91('0x7b')](_0xdb91('0x7c')+_0x4de33f);var _0x4635d7=_0x5a4c3f[_0xdb91('0x3a')][_0xdb91('0x18')]?0x1f4:_0x4de33f[_0xdb91('0x7d')]||0x1f4;logger[_0xdb91('0x21')](_0xdb91('0x7e'),_0xdb91('0x5d'),_0x4635d7,JSON[_0xdb91('0x7f')](_0x4de33f));delete _0x4de33f[_0xdb91('0x33')];if(_0x4635d7===0x191){_0x4635d7=0x190;}_0x33a3a8[_0xdb91('0x27')](_0x4635d7)[_0xdb91('0x80')](_0x5a4c3f[_0xdb91('0x3a')][_0xdb91('0x18')]?{'message':_0xdb91('0x81'),'statusCode':_0x4de33f['statusCode']}:_0x4de33f);});}; \ No newline at end of file +var _0xb3f0=['mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../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~!@#$%^&-_=+[{]}.','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','then','destroy','end','stack','name','send','index','VtigerAccount','rawAttributes','fieldName','type','model','map','query','intersection','attributes','length','hasOwnProperty','order','pick','filters','where','VIRTUAL','merge','options','count','include','findAll','show','params','keys','fields','create','update','body','find','sort','filter','addConfiguration','AccountId','getSubjects','channel','Subjects','VtigerField','Descriptions','md5','getFields','username','description','remoteUri','accessKey','moduleName','slice','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','login','token','GET','describe','autogenerated','owner','remove','includes','editable','label','startsWith','picklistValues','value','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x305b6e,_0x3f814e){var _0x3f7f6c=function(_0xf88913){while(--_0xf88913){_0x305b6e['push'](_0x305b6e['shift']());}};_0x3f7f6c(++_0x3f814e);}(_0xb3f0,0x78));var _0x0b3f=function(_0x4fbb15,_0x21be0c){_0x4fbb15=_0x4fbb15-0x0;var _0x436338=_0xb3f0[_0x4fbb15];return _0x436338;};'use strict';var pdf=require(_0x0b3f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0b3f('0x1'));var zipdir=require(_0x0b3f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0b3f('0x3'));var moment=require(_0x0b3f('0x4'));var BPromise=require(_0x0b3f('0x5'));var Mustache=require(_0x0b3f('0x6'));var util=require('util');var path=require(_0x0b3f('0x7'));var sox=require(_0x0b3f('0x8'));var csv=require(_0x0b3f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0b3f('0xa'));var squel=require(_0x0b3f('0xb'));var crypto=require(_0x0b3f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0b3f('0xd'));var toCsv=require(_0x0b3f('0x9'));var querystring=require(_0x0b3f('0xe'));var Papa=require(_0x0b3f('0xf'));var Redis=require(_0x0b3f('0x10'));var authService=require(_0x0b3f('0x11'));var qs=require(_0x0b3f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0b3f('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x0b3f('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x0b3f('0x15'));var jayson=require(_0x0b3f('0x16'));var client=jayson[_0x0b3f('0x17')][_0x0b3f('0x18')]({'port':0x232a});function checkPasswordPattern(_0x5797c1,_0x477593,_0x4fd990){if(_0x4fd990){var _0x36c46e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x36c46e[_0x0b3f('0x19')](_0x477593)){return _0x5797c1;}else{throw new db[(_0x0b3f('0x1a'))][(_0x0b3f('0x1b'))](_0x0b3f('0x1c'));}}else{return _0x5797c1;}}function respondWithRpcPromise(_0x19a0ae,_0x2b96a4,_0x5e841d,_0x33f81f){return new BPromise(function(_0x5c901c,_0x2fd000){var _0x42cf40=_0x33f81f||client;return _0x42cf40[_0x0b3f('0x1d')](_0x19a0ae,_0x5e841d)['then'](function(_0x42d43c){logger[_0x0b3f('0x1e')](_0x0b3f('0x1f'),_0x2b96a4,_0x0b3f('0x20'));logger[_0x0b3f('0x21')](_0x0b3f('0x22'),_0x2b96a4,_0x0b3f('0x20'),JSON[_0x0b3f('0x23')](_0x42d43c));if(_0x42d43c[_0x0b3f('0x24')]){if(_0x42d43c[_0x0b3f('0x24')][_0x0b3f('0x25')]===0x1f4){logger[_0x0b3f('0x24')]('VtigerAccount,\x20%s,\x20%s',_0x2b96a4,_0x42d43c[_0x0b3f('0x24')][_0x0b3f('0x26')]);return _0x2fd000(_0x42d43c[_0x0b3f('0x24')]['message']);}logger['error'](_0x0b3f('0x1f'),_0x2b96a4,_0x42d43c['error']['message']);return _0x5c901c(_0x42d43c[_0x0b3f('0x24')][_0x0b3f('0x26')]);}else{logger['info'](_0x0b3f('0x1f'),_0x2b96a4,_0x0b3f('0x20'));_0x5c901c(_0x42d43c[_0x0b3f('0x27')][_0x0b3f('0x26')]);}})[_0x0b3f('0x28')](function(_0x5d93b3){logger[_0x0b3f('0x24')]('VtigerAccount,\x20%s,\x20%s',_0x2b96a4,_0x5d93b3);_0x2fd000(_0x5d93b3);});});}function respondWithStatusCode(_0x32e8dd,_0x150daa){_0x150daa=_0x150daa||0xcc;return function(_0x32ef42){if(_0x32ef42){return _0x32e8dd[_0x0b3f('0x29')](_0x150daa);}return _0x32e8dd[_0x0b3f('0x2a')](_0x150daa)['end']();};}function respondWithResult(_0x3e9f13,_0x3ea179){_0x3ea179=_0x3ea179||0xc8;return function(_0x125016){if(_0x125016){return _0x3e9f13[_0x0b3f('0x2a')](_0x3ea179)[_0x0b3f('0x2b')](_0x125016);}};}function respondWithFilteredResult(_0x4391b9,_0x36a3d1){return function(_0x3d168e){if(_0x3d168e){var _0x1eb534=_0x3d168e['count'],_0x2fdd08=_0x36a3d1[_0x0b3f('0x2c')],_0x388aee=_0x36a3d1[_0x0b3f('0x2c')]+_0x36a3d1[_0x0b3f('0x2d')],_0x388df1;if(_0x388aee>=_0x1eb534){_0x388aee=_0x1eb534;_0x388df1=0xc8;}else{_0x388df1=0xce;}_0x4391b9[_0x0b3f('0x2a')](_0x388df1);return _0x4391b9[_0x0b3f('0x2e')](_0x0b3f('0x2f'),_0x2fdd08+'-'+_0x388aee+'/'+_0x1eb534)[_0x0b3f('0x2b')](_0x3d168e);}return null;};}function patchUpdates(_0x2386ab){return function(_0x4ed751){try{jsonpatch[_0x0b3f('0x30')](_0x4ed751,_0x2386ab,!![]);}catch(_0x572444){return BPromise[_0x0b3f('0x31')](_0x572444);}return _0x4ed751['save']();};}function saveUpdates(_0x3a0b63,_0x181d6c){return function(_0x38cfcb){if(_0x38cfcb){return _0x38cfcb['update'](_0x3a0b63)[_0x0b3f('0x32')](function(_0x52215c){return _0x52215c;});}return null;};}function removeEntity(_0x3ba235,_0x3095b4){return function(_0x4ec268){if(_0x4ec268){return _0x4ec268[_0x0b3f('0x33')]()[_0x0b3f('0x32')](function(){_0x3ba235[_0x0b3f('0x2a')](0xcc)[_0x0b3f('0x34')]();});}};}function handleEntityNotFound(_0x4af807,_0x7c0198){return function(_0xabaa22){if(!_0xabaa22){_0x4af807[_0x0b3f('0x29')](0x194);}return _0xabaa22;};}function handleError(_0x55b9a3,_0x11bfe){_0x11bfe=_0x11bfe||0x1f4;return function(_0x3295b1){logger[_0x0b3f('0x24')](_0x3295b1[_0x0b3f('0x35')]);if(_0x3295b1[_0x0b3f('0x36')]){delete _0x3295b1[_0x0b3f('0x36')];}_0x55b9a3[_0x0b3f('0x2a')](_0x11bfe)[_0x0b3f('0x37')](_0x3295b1);};}exports[_0x0b3f('0x38')]=function(_0x5830d3,_0xad3426){var _0x5dc5f4={},_0x3ece41={},_0x37dc63={'count':0x0,'rows':[]};var _0xc448e6=_['map'](db[_0x0b3f('0x39')][_0x0b3f('0x3a')],function(_0x69d725){return{'name':_0x69d725[_0x0b3f('0x3b')],'type':_0x69d725[_0x0b3f('0x3c')]['key']};});_0x3ece41[_0x0b3f('0x3d')]=_[_0x0b3f('0x3e')](_0xc448e6,_0x0b3f('0x36'));_0x3ece41['query']=_['keys'](_0x5830d3[_0x0b3f('0x3f')]);_0x3ece41['filters']=_[_0x0b3f('0x40')](_0x3ece41[_0x0b3f('0x3d')],_0x3ece41[_0x0b3f('0x3f')]);_0x5dc5f4[_0x0b3f('0x41')]=_[_0x0b3f('0x40')](_0x3ece41[_0x0b3f('0x3d')],qs['fields'](_0x5830d3[_0x0b3f('0x3f')]['fields']));_0x5dc5f4[_0x0b3f('0x41')]=_0x5dc5f4[_0x0b3f('0x41')][_0x0b3f('0x42')]?_0x5dc5f4[_0x0b3f('0x41')]:_0x3ece41[_0x0b3f('0x3d')];if(!_0x5830d3[_0x0b3f('0x3f')][_0x0b3f('0x43')]('nolimit')){_0x5dc5f4[_0x0b3f('0x2d')]=qs['limit'](_0x5830d3['query']['limit']);_0x5dc5f4[_0x0b3f('0x2c')]=qs[_0x0b3f('0x2c')](_0x5830d3[_0x0b3f('0x3f')][_0x0b3f('0x2c')]);}_0x5dc5f4[_0x0b3f('0x44')]=qs['sort'](_0x5830d3['query']['sort']);_0x5dc5f4['where']=qs['filters'](_[_0x0b3f('0x45')](_0x5830d3[_0x0b3f('0x3f')],_0x3ece41[_0x0b3f('0x46')]),_0xc448e6);if(_0x5830d3['query']['filter']){_0x5dc5f4[_0x0b3f('0x47')]=_['merge'](_0x5dc5f4[_0x0b3f('0x47')],{'$or':_[_0x0b3f('0x3e')](_0xc448e6,function(_0x44e501){if(_0x44e501[_0x0b3f('0x3c')]!==_0x0b3f('0x48')){var _0xe953d={};_0xe953d[_0x44e501[_0x0b3f('0x36')]]={'$like':'%'+_0x5830d3[_0x0b3f('0x3f')]['filter']+'%'};return _0xe953d;}})});}_0x5dc5f4=_[_0x0b3f('0x49')]({},_0x5dc5f4,_0x5830d3[_0x0b3f('0x4a')]);var _0x324be7={'where':_0x5dc5f4[_0x0b3f('0x47')]};return db['VtigerAccount']['count'](_0x324be7)[_0x0b3f('0x32')](function(_0x134f57){_0x37dc63[_0x0b3f('0x4b')]=_0x134f57;if(_0x5830d3[_0x0b3f('0x3f')]['includeAll']){_0x5dc5f4[_0x0b3f('0x4c')]=[{'all':!![]}];}return db[_0x0b3f('0x39')][_0x0b3f('0x4d')](_0x5dc5f4);})[_0x0b3f('0x32')](function(_0x44375a){_0x37dc63['rows']=_0x44375a;return _0x37dc63;})[_0x0b3f('0x32')](respondWithFilteredResult(_0xad3426,_0x5dc5f4))[_0x0b3f('0x28')](handleError(_0xad3426,null));};exports[_0x0b3f('0x4e')]=function(_0x2a6734,_0x1b5218){var _0x2955eb={'raw':![],'where':{'id':_0x2a6734[_0x0b3f('0x4f')]['id']}},_0x3c9159={};_0x3c9159[_0x0b3f('0x3d')]=_[_0x0b3f('0x50')](db[_0x0b3f('0x39')][_0x0b3f('0x3a')]);_0x3c9159[_0x0b3f('0x3f')]=_[_0x0b3f('0x50')](_0x2a6734[_0x0b3f('0x3f')]);_0x3c9159[_0x0b3f('0x46')]=_[_0x0b3f('0x40')](_0x3c9159[_0x0b3f('0x3d')],_0x3c9159[_0x0b3f('0x3f')]);_0x2955eb['attributes']=_[_0x0b3f('0x40')](_0x3c9159['model'],qs[_0x0b3f('0x51')](_0x2a6734[_0x0b3f('0x3f')][_0x0b3f('0x51')]));_0x2955eb[_0x0b3f('0x41')]=_0x2955eb[_0x0b3f('0x41')][_0x0b3f('0x42')]?_0x2955eb[_0x0b3f('0x41')]:_0x3c9159['model'];if(_0x2a6734[_0x0b3f('0x3f')]['includeAll']){_0x2955eb[_0x0b3f('0x4c')]=[{'all':!![]}];}_0x2955eb=_['merge']({},_0x2955eb,_0x2a6734['options']);return db[_0x0b3f('0x39')]['find'](_0x2955eb)[_0x0b3f('0x32')](handleEntityNotFound(_0x1b5218,null))['then'](respondWithResult(_0x1b5218,null))[_0x0b3f('0x28')](handleError(_0x1b5218,null));};exports[_0x0b3f('0x52')]=function(_0x2a89da,_0x12a2d0){return db['VtigerAccount']['create'](_0x2a89da['body'],{})[_0x0b3f('0x32')](respondWithResult(_0x12a2d0,0xc9))['catch'](handleError(_0x12a2d0,null));};exports[_0x0b3f('0x53')]=function(_0x179011,_0x41d9ba){if(_0x179011['body']['id']){delete _0x179011[_0x0b3f('0x54')]['id'];}return db[_0x0b3f('0x39')][_0x0b3f('0x55')]({'where':{'id':_0x179011[_0x0b3f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x41d9ba,null))['then'](saveUpdates(_0x179011[_0x0b3f('0x54')],null))['then'](respondWithResult(_0x41d9ba,null))['catch'](handleError(_0x41d9ba,null));};exports[_0x0b3f('0x33')]=function(_0x2f1c12,_0x21369a){return db['VtigerAccount']['find']({'where':{'id':_0x2f1c12['params']['id']}})[_0x0b3f('0x32')](handleEntityNotFound(_0x21369a,null))[_0x0b3f('0x32')](removeEntity(_0x21369a,null))['catch'](handleError(_0x21369a,null));};exports['getConfigurations']=function(_0x17a702,_0xcf66f7,_0x5841a7){var _0x30b074={};var _0x11055b={};var _0x1e270f;var _0x1d248b;return db[_0x0b3f('0x39')]['findOne']({'where':{'id':_0x17a702[_0x0b3f('0x4f')]['id']}})[_0x0b3f('0x32')](handleEntityNotFound(_0xcf66f7,null))['then'](function(_0x4f2493){if(_0x4f2493){_0x1e270f=_0x4f2493;_0x11055b[_0x0b3f('0x3d')]=_['keys'](db['VtigerConfiguration'][_0x0b3f('0x3a')]);_0x11055b['query']=_[_0x0b3f('0x50')](_0x17a702[_0x0b3f('0x3f')]);_0x11055b[_0x0b3f('0x46')]=_['intersection'](_0x11055b[_0x0b3f('0x3d')],_0x11055b['query']);_0x30b074[_0x0b3f('0x41')]=_[_0x0b3f('0x40')](_0x11055b['model'],qs[_0x0b3f('0x51')](_0x17a702[_0x0b3f('0x3f')]['fields']));_0x30b074[_0x0b3f('0x41')]=_0x30b074[_0x0b3f('0x41')]['length']?_0x30b074[_0x0b3f('0x41')]:_0x11055b[_0x0b3f('0x3d')];_0x30b074['order']=qs['sort'](_0x17a702[_0x0b3f('0x3f')][_0x0b3f('0x56')]);_0x30b074['where']=qs[_0x0b3f('0x46')](_['pick'](_0x17a702[_0x0b3f('0x3f')],_0x11055b['filters']));if(_0x17a702['query']['filter']){_0x30b074[_0x0b3f('0x47')]=_['merge'](_0x30b074[_0x0b3f('0x47')],{'$or':_['map'](_0x30b074[_0x0b3f('0x41')],function(_0x33b1ac){var _0x331cae={};_0x331cae[_0x33b1ac]={'$like':'%'+_0x17a702[_0x0b3f('0x3f')][_0x0b3f('0x57')]+'%'};return _0x331cae;})});}_0x30b074=_[_0x0b3f('0x49')]({},_0x30b074,_0x17a702[_0x0b3f('0x4a')]);return _0x1e270f['getConfigurations'](_0x30b074);}})[_0x0b3f('0x32')](function(_0x1ac7b0){if(_0x1ac7b0){_0x1d248b=_0x1ac7b0[_0x0b3f('0x42')];if(!_0x17a702[_0x0b3f('0x3f')][_0x0b3f('0x43')]('nolimit')){_0x30b074[_0x0b3f('0x2d')]=qs['limit'](_0x17a702[_0x0b3f('0x3f')]['limit']);_0x30b074[_0x0b3f('0x2c')]=qs['offset'](_0x17a702[_0x0b3f('0x3f')][_0x0b3f('0x2c')]);}return _0x1e270f['getConfigurations'](_0x30b074);}})['then'](function(_0xc2f27e){if(_0xc2f27e){return _0xc2f27e?{'count':_0x1d248b,'rows':_0xc2f27e}:null;}})['then'](respondWithResult(_0xcf66f7,null))['catch'](handleError(_0xcf66f7,null));};exports[_0x0b3f('0x58')]=function(_0x49192e,_0x4b4967,_0x5b619a){if(_0x49192e[_0x0b3f('0x54')]['id']){delete _0x49192e[_0x0b3f('0x54')]['id'];}return db[_0x0b3f('0x39')]['findOne']({'where':{'id':_0x49192e['params']['id']}})[_0x0b3f('0x32')](handleEntityNotFound(_0x4b4967,null))[_0x0b3f('0x32')](function(_0x5cfd3e){if(_0x5cfd3e){_0x49192e[_0x0b3f('0x54')][_0x0b3f('0x59')]=_0x5cfd3e['id'];_0x49192e[_0x0b3f('0x54')]['Subjects']=integrations[_0x0b3f('0x5a')](_0x49192e[_0x0b3f('0x54')][_0x0b3f('0x5b')],_0x49192e[_0x0b3f('0x54')]['type']);_0x49192e[_0x0b3f('0x54')]['Descriptions']=integrations['getDescriptions'](_0x49192e['body'][_0x0b3f('0x5b')],_0x49192e[_0x0b3f('0x54')][_0x0b3f('0x3c')]);return db['VtigerConfiguration'][_0x0b3f('0x52')](_0x49192e[_0x0b3f('0x54')],{'include':[{'model':db['VtigerField'],'as':_0x0b3f('0x5c')},{'model':db[_0x0b3f('0x5d')],'as':_0x0b3f('0x5e')}]});}return null;})[_0x0b3f('0x32')](respondWithResult(_0x4b4967,null))[_0x0b3f('0x28')](handleError(_0x4b4967,null));};var md5=require(_0x0b3f('0x5f'));exports[_0x0b3f('0x60')]=function(_0x1d2b27,_0x52689b,_0x5eeb49){var _0x201cc9=null;var _0x12e86e=null;var _0x12b387=null;var _0x73d68f=null;var _0x42a4fd='';return db['VtigerAccount']['findOne']({'where':{'id':_0x1d2b27[_0x0b3f('0x4f')]['id']},'attributes':['id',_0x0b3f('0x36'),_0x0b3f('0x61'),_0x0b3f('0x62'),'moduleName',_0x0b3f('0x63'),'serverUrl',_0x0b3f('0x64')]})[_0x0b3f('0x32')](handleEntityNotFound(_0x52689b,null))[_0x0b3f('0x32')](function(_0x2ff9c8){if(_0x2ff9c8){_0x201cc9=_0x2ff9c8[_0x0b3f('0x61')];_0x12e86e=_0x2ff9c8[_0x0b3f('0x64')];_0x12b387=_0x2ff9c8[_0x0b3f('0x65')];_0x42a4fd=_0x2ff9c8['remoteUri'];var _0x58d9ce=_0x42a4fd[_0x0b3f('0x66')](-0x1);if(_0x58d9ce==='/'){_0x42a4fd=_0x42a4fd['substring'](0x0,_0x42a4fd[_0x0b3f('0x67')](_0x58d9ce));}_0x73d68f=util[_0x0b3f('0x68')](_0x0b3f('0x69'),_0x42a4fd);var _0x85f9d4={'method':'GET','uri':_0x73d68f,'qs':{'operation':_0x0b3f('0x6a'),'username':_0x2ff9c8['username']},'json':!![]};return rp(_0x85f9d4);}})[_0x0b3f('0x32')](function(_0x317c11){if(_0x317c11[_0x0b3f('0x6b')]){var _0x2de56d={'method':_0x0b3f('0x6c'),'uri':_0x73d68f,'form':{'operation':_0x0b3f('0x6d'),'username':_0x201cc9,'accessKey':md5(_0x317c11[_0x0b3f('0x27')][_0x0b3f('0x6e')]+_0x12e86e)},'json':!![]};return rp(_0x2de56d);}})['then'](function(_0x2ac397){if(_0x2ac397[_0x0b3f('0x6b')]){var _0x2ea232={'method':_0x0b3f('0x6f'),'uri':_0x73d68f,'qs':{'operation':_0x0b3f('0x70'),'username':_0x201cc9,'sessionName':_0x2ac397[_0x0b3f('0x27')]['sessionName'],'elementType':_0x12b387},'json':!![]};return rp(_0x2ea232);}})[_0x0b3f('0x32')](function(_0x117d58){if(_0x117d58[_0x0b3f('0x6b')]){var _0x166dad=[_0x0b3f('0x71'),'reference',_0x0b3f('0x72')];_[_0x0b3f('0x73')](_0x117d58['result'][_0x0b3f('0x51')],function(_0x5ddd39){return _0x166dad[_0x0b3f('0x74')](_0x5ddd39[_0x0b3f('0x3c')][_0x0b3f('0x36')]);});_[_0x0b3f('0x73')](_0x117d58[_0x0b3f('0x27')]['fields'],function(_0x3a5c25){return _0x3a5c25[_0x0b3f('0x75')]==='false';});return{'count':_0x117d58[_0x0b3f('0x27')]['fields'][_0x0b3f('0x42')],'rows':_[_0x0b3f('0x3e')](_0x117d58[_0x0b3f('0x27')][_0x0b3f('0x51')],function(_0x3ac8ca){return{'id':_0x3ac8ca[_0x0b3f('0x36')],'name':_0x3ac8ca[_0x0b3f('0x76')],'custom':_[_0x0b3f('0x77')](_0x3ac8ca[_0x0b3f('0x36')],'cf_')?!![]:![],'options':_0x3ac8ca['type'][_0x0b3f('0x36')]==='picklist'&&_0x3ac8ca['type'][_0x0b3f('0x78')][_0x0b3f('0x42')]>0x0?_[_0x0b3f('0x3e')](_0x3ac8ca[_0x0b3f('0x3c')][_0x0b3f('0x78')],function(_0x1ad80e){return{'name':_0x1ad80e[_0x0b3f('0x76')],'value':_0x1ad80e[_0x0b3f('0x79')]};}):[]};})};}})[_0x0b3f('0x32')](respondWithResult(_0x52689b,null))[_0x0b3f('0x28')](function(_0x2da510){console['log'](_0x0b3f('0x7a')+_0x2da510);var _0x4170ae=_0x1d2b27['query'][_0x0b3f('0x19')]?0x1f4:_0x2da510[_0x0b3f('0x7b')]||0x1f4;logger['error'](_0x0b3f('0x7c'),'getFields',_0x4170ae,JSON[_0x0b3f('0x23')](_0x2da510));delete _0x2da510[_0x0b3f('0x36')];if(_0x4170ae===0x191){_0x4170ae=0x190;}_0x52689b['status'](_0x4170ae)[_0x0b3f('0x37')](_0x1d2b27['query'][_0x0b3f('0x19')]?{'message':_0x0b3f('0x7d'),'statusCode':_0x2da510[_0x0b3f('0x7b')]}:_0x2da510);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index e90c3c4..f52a0b5 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 _0xde9d=['./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x28788f,_0x5b62dc){var _0x2ad785=function(_0x9160a4){while(--_0x9160a4){_0x28788f['push'](_0x28788f['shift']());}};_0x2ad785(++_0x5b62dc);}(_0xde9d,0x156));var _0xdde9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde9d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xdde9('0x0'));var util=require(_0xdde9('0x1'));var logger=require(_0xdde9('0x2'))(_0xdde9('0x3'));var moment=require(_0xdde9('0x4'));var BPromise=require('bluebird');var rp=require(_0xdde9('0x5'));var fs=require('fs');var path=require(_0xdde9('0x6'));var rimraf=require(_0xdde9('0x7'));var config=require('../../config/environment');var attributes=require(_0xdde9('0x8'));var integrations=require(_0xdde9('0x9'));module[_0xdde9('0xa')]=function(_0x4c10e9,_0x289ccb){return _0x4c10e9[_0xdde9('0xb')](_0xdde9('0xc'),attributes,{'tableName':_0xdde9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7edc=['path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','util','../../config/logger','api','moment','bluebird'];(function(_0x2f2763,_0x4d9637){var _0x442362=function(_0xaed4fa){while(--_0xaed4fa){_0x2f2763['push'](_0x2f2763['shift']());}};_0x442362(++_0x4d9637);}(_0x7edc,0x16f));var _0xc7ed=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x7edc[_0x1da527];return _0x40fc7c;};'use strict';var _=require('lodash');var util=require(_0xc7ed('0x0'));var logger=require(_0xc7ed('0x1'))(_0xc7ed('0x2'));var moment=require(_0xc7ed('0x3'));var BPromise=require(_0xc7ed('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc7ed('0x5'));var rimraf=require('rimraf');var config=require(_0xc7ed('0x6'));var attributes=require(_0xc7ed('0x7'));var integrations=require(_0xc7ed('0x8'));module[_0xc7ed('0x9')]=function(_0x3e22ac,_0x26e90a){return _0x3e22ac[_0xc7ed('0xa')](_0xc7ed('0xb'),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 b96b243..e746df2 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 _0x1f0a=['VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','options','raw','limit','include','map','model','attributes','ShowVtigerAccount','where','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4d8b6d,_0x5ebb08){var _0x118c59=function(_0x2c1a20){while(--_0x2c1a20){_0x4d8b6d['push'](_0x4d8b6d['shift']());}};_0x118c59(++_0x5ebb08);}(_0x1f0a,0x1b9));var _0xa1f0=function(_0x31af7b,_0xf90ede){_0x31af7b=_0x31af7b-0x0;var _0xcc3682=_0x1f0a[_0x31af7b];return _0xcc3682;};'use strict';var _=require(_0xa1f0('0x0'));var util=require(_0xa1f0('0x1'));var moment=require(_0xa1f0('0x2'));var BPromise=require('bluebird');var rs=require(_0xa1f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa1f0('0x4'))['db'];var utils=require(_0xa1f0('0x5'));var logger=require(_0xa1f0('0x6'))('rpc');var config=require(_0xa1f0('0x7'));var jayson=require(_0xa1f0('0x8'));var client=jayson[_0xa1f0('0x9')][_0xa1f0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x448bdb,_0x3adb41,_0x32ce8c){return new BPromise(function(_0x36f2cf,_0xfa432a){return client[_0xa1f0('0xb')](_0x448bdb,_0x32ce8c)[_0xa1f0('0xc')](function(_0x52ab09){logger[_0xa1f0('0xd')](_0xa1f0('0xe'),_0x3adb41,_0xa1f0('0xf'));logger[_0xa1f0('0x10')](_0xa1f0('0x11'),_0x3adb41,'request\x20sent',JSON[_0xa1f0('0x12')](_0x52ab09));if(_0x52ab09[_0xa1f0('0x13')]){if(_0x52ab09['error'][_0xa1f0('0x14')]===0x1f4){logger['error'](_0xa1f0('0xe'),_0x3adb41,_0x52ab09[_0xa1f0('0x13')][_0xa1f0('0x15')]);return _0xfa432a(_0x52ab09[_0xa1f0('0x13')][_0xa1f0('0x15')]);}logger[_0xa1f0('0x13')](_0xa1f0('0xe'),_0x3adb41,_0x52ab09[_0xa1f0('0x13')][_0xa1f0('0x15')]);return _0x36f2cf(_0x52ab09[_0xa1f0('0x13')]['message']);}else{logger[_0xa1f0('0xd')](_0xa1f0('0xe'),_0x3adb41,_0xa1f0('0xf'));_0x36f2cf(_0x52ab09[_0xa1f0('0x16')][_0xa1f0('0x15')]);}})[_0xa1f0('0x17')](function(_0x285659){logger[_0xa1f0('0x13')](_0xa1f0('0xe'),_0x3adb41,_0x285659);_0xfa432a(_0x285659);});});}exports[_0xa1f0('0x18')]=function(_0x1c225f){var _0x40620d=this;return new Promise(function(_0x151d83,_0x489414){return db[_0xa1f0('0x19')]['findAll']({'raw':_0x1c225f[_0xa1f0('0x1a')]?_0x1c225f[_0xa1f0('0x1a')][_0xa1f0('0x1b')]===undefined?!![]:![]:!![],'where':_0x1c225f[_0xa1f0('0x1a')]?_0x1c225f[_0xa1f0('0x1a')]['where']||null:null,'attributes':_0x1c225f[_0xa1f0('0x1a')]?_0x1c225f[_0xa1f0('0x1a')]['attributes']||null:null,'limit':_0x1c225f['options']?_0x1c225f[_0xa1f0('0x1a')][_0xa1f0('0x1c')]||null:null,'include':_0x1c225f[_0xa1f0('0x1a')]?_0x1c225f[_0xa1f0('0x1a')][_0xa1f0('0x1d')]?_[_0xa1f0('0x1e')](_0x1c225f[_0xa1f0('0x1a')][_0xa1f0('0x1d')],function(_0x5c71bc){return{'model':db[_0x5c71bc[_0xa1f0('0x1f')]],'as':_0x5c71bc['as'],'attributes':_0x5c71bc[_0xa1f0('0x20')],'include':_0x5c71bc['include']?_[_0xa1f0('0x1e')](_0x5c71bc[_0xa1f0('0x1d')],function(_0x375e6e){return{'model':db[_0x375e6e[_0xa1f0('0x1f')]],'as':_0x375e6e['as'],'attributes':_0x375e6e[_0xa1f0('0x20')],'include':_0x375e6e['include']?_[_0xa1f0('0x1e')](_0x375e6e[_0xa1f0('0x1d')],function(_0x6d9f27){return{'model':db[_0x6d9f27[_0xa1f0('0x1f')]],'as':_0x6d9f27['as'],'attributes':_0x6d9f27[_0xa1f0('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x102211){logger[_0xa1f0('0xd')](_0xa1f0('0x18'),_0x1c225f);logger[_0xa1f0('0x10')](_0xa1f0('0x18'),_0x1c225f,JSON[_0xa1f0('0x12')](_0x102211));_0x151d83(_0x102211);})['catch'](function(_0x1e0c53){logger['error'](_0xa1f0('0x18'),_0x1e0c53[_0xa1f0('0x15')],_0x1c225f);_0x489414(_0x40620d[_0xa1f0('0x13')](0x1f4,_0x1e0c53[_0xa1f0('0x15')]));});});};exports[_0xa1f0('0x21')]=function(_0x3de676){var _0x4a25f5=this;return new Promise(function(_0x288028,_0x253df7){return db[_0xa1f0('0x19')]['find']({'raw':_0x3de676[_0xa1f0('0x1a')]?_0x3de676['options'][_0xa1f0('0x1b')]===undefined?!![]:![]:!![],'where':_0x3de676['options']?_0x3de676['options'][_0xa1f0('0x22')]||null:null,'attributes':_0x3de676[_0xa1f0('0x1a')]?_0x3de676['options']['attributes']||null:null,'include':_0x3de676[_0xa1f0('0x1a')]?_0x3de676[_0xa1f0('0x1a')][_0xa1f0('0x1d')]?_[_0xa1f0('0x1e')](_0x3de676[_0xa1f0('0x1a')][_0xa1f0('0x1d')],function(_0x418e22){return{'model':db[_0x418e22[_0xa1f0('0x1f')]],'as':_0x418e22['as'],'attributes':_0x418e22[_0xa1f0('0x20')],'include':_0x418e22[_0xa1f0('0x1d')]?_[_0xa1f0('0x1e')](_0x418e22[_0xa1f0('0x1d')],function(_0x35c9ea){return{'model':db[_0x35c9ea[_0xa1f0('0x1f')]],'as':_0x35c9ea['as'],'attributes':_0x35c9ea[_0xa1f0('0x20')],'include':_0x35c9ea['include']?_['map'](_0x35c9ea[_0xa1f0('0x1d')],function(_0xae9caf){return{'model':db[_0xae9caf[_0xa1f0('0x1f')]],'as':_0xae9caf['as'],'attributes':_0xae9caf[_0xa1f0('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa1f0('0xc')](function(_0x24c830){logger[_0xa1f0('0xd')](_0xa1f0('0x21'),_0x3de676);logger[_0xa1f0('0x10')](_0xa1f0('0x21'),_0x3de676,JSON[_0xa1f0('0x12')](_0x24c830));_0x288028(_0x24c830);})['catch'](function(_0x3d6b86){logger[_0xa1f0('0x13')](_0xa1f0('0x21'),_0x3d6b86['message'],_0x3de676);_0x253df7(_0x4a25f5['error'](0x1f4,_0x3d6b86[_0xa1f0('0x15')]));});});}; \ No newline at end of file +var _0x9896=['ShowVtigerAccount','find','where','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VtigerAccount','options','raw','attributes','limit','include','map','model','then','GetVtigerAccount','stringify'];(function(_0x133fe4,_0x1f473b){var _0x4c4017=function(_0x3c1fb1){while(--_0x3c1fb1){_0x133fe4['push'](_0x133fe4['shift']());}};_0x4c4017(++_0x1f473b);}(_0x9896,0x1b0));var _0x6989=function(_0x4424f1,_0x4783fb){_0x4424f1=_0x4424f1-0x0;var _0x54d316=_0x9896[_0x4424f1];return _0x54d316;};'use strict';var _=require(_0x6989('0x0'));var util=require(_0x6989('0x1'));var moment=require(_0x6989('0x2'));var BPromise=require(_0x6989('0x3'));var rs=require(_0x6989('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6989('0x5'))(_0x6989('0x6'));var config=require(_0x6989('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x34561d,_0x1ed197,_0x451de2){return new BPromise(function(_0xbb2baf,_0x4bbb58){return client[_0x6989('0x8')](_0x34561d,_0x451de2)['then'](function(_0x551c42){logger[_0x6989('0x9')](_0x6989('0xa'),_0x1ed197,_0x6989('0xb'));logger[_0x6989('0xc')](_0x6989('0xd'),_0x1ed197,_0x6989('0xb'),JSON['stringify'](_0x551c42));if(_0x551c42[_0x6989('0xe')]){if(_0x551c42[_0x6989('0xe')][_0x6989('0xf')]===0x1f4){logger[_0x6989('0xe')](_0x6989('0xa'),_0x1ed197,_0x551c42[_0x6989('0xe')][_0x6989('0x10')]);return _0x4bbb58(_0x551c42[_0x6989('0xe')][_0x6989('0x10')]);}logger[_0x6989('0xe')](_0x6989('0xa'),_0x1ed197,_0x551c42[_0x6989('0xe')][_0x6989('0x10')]);return _0xbb2baf(_0x551c42[_0x6989('0xe')][_0x6989('0x10')]);}else{logger['info'](_0x6989('0xa'),_0x1ed197,_0x6989('0xb'));_0xbb2baf(_0x551c42[_0x6989('0x11')]['message']);}})[_0x6989('0x12')](function(_0x124c47){logger[_0x6989('0xe')](_0x6989('0xa'),_0x1ed197,_0x124c47);_0x4bbb58(_0x124c47);});});}exports['GetVtigerAccount']=function(_0x4d65e3){var _0x2b1f1d=this;return new Promise(function(_0xb5d0c7,_0x48a29f){return db[_0x6989('0x13')]['findAll']({'raw':_0x4d65e3[_0x6989('0x14')]?_0x4d65e3[_0x6989('0x14')][_0x6989('0x15')]===undefined?!![]:![]:!![],'where':_0x4d65e3[_0x6989('0x14')]?_0x4d65e3[_0x6989('0x14')]['where']||null:null,'attributes':_0x4d65e3[_0x6989('0x14')]?_0x4d65e3[_0x6989('0x14')][_0x6989('0x16')]||null:null,'limit':_0x4d65e3['options']?_0x4d65e3['options'][_0x6989('0x17')]||null:null,'include':_0x4d65e3[_0x6989('0x14')]?_0x4d65e3[_0x6989('0x14')][_0x6989('0x18')]?_[_0x6989('0x19')](_0x4d65e3[_0x6989('0x14')]['include'],function(_0x14f2b5){return{'model':db[_0x14f2b5[_0x6989('0x1a')]],'as':_0x14f2b5['as'],'attributes':_0x14f2b5[_0x6989('0x16')],'include':_0x14f2b5[_0x6989('0x18')]?_['map'](_0x14f2b5[_0x6989('0x18')],function(_0x1f26fb){return{'model':db[_0x1f26fb['model']],'as':_0x1f26fb['as'],'attributes':_0x1f26fb[_0x6989('0x16')],'include':_0x1f26fb[_0x6989('0x18')]?_[_0x6989('0x19')](_0x1f26fb[_0x6989('0x18')],function(_0x51ec94){return{'model':db[_0x51ec94['model']],'as':_0x51ec94['as'],'attributes':_0x51ec94[_0x6989('0x16')]};}):[]};}):[]};}):[]:[]})[_0x6989('0x1b')](function(_0x409b9f){logger[_0x6989('0x9')](_0x6989('0x1c'),_0x4d65e3);logger[_0x6989('0xc')]('GetVtigerAccount',_0x4d65e3,JSON[_0x6989('0x1d')](_0x409b9f));_0xb5d0c7(_0x409b9f);})[_0x6989('0x12')](function(_0xa8da3){logger['error'](_0x6989('0x1c'),_0xa8da3[_0x6989('0x10')],_0x4d65e3);_0x48a29f(_0x2b1f1d[_0x6989('0xe')](0x1f4,_0xa8da3['message']));});});};exports[_0x6989('0x1e')]=function(_0x175d0c){var _0x260d0a=this;return new Promise(function(_0x4b95bd,_0x1a9fc2){return db[_0x6989('0x13')][_0x6989('0x1f')]({'raw':_0x175d0c['options']?_0x175d0c[_0x6989('0x14')][_0x6989('0x15')]===undefined?!![]:![]:!![],'where':_0x175d0c['options']?_0x175d0c['options'][_0x6989('0x20')]||null:null,'attributes':_0x175d0c[_0x6989('0x14')]?_0x175d0c[_0x6989('0x14')][_0x6989('0x16')]||null:null,'include':_0x175d0c[_0x6989('0x14')]?_0x175d0c[_0x6989('0x14')][_0x6989('0x18')]?_[_0x6989('0x19')](_0x175d0c[_0x6989('0x14')][_0x6989('0x18')],function(_0x475a45){return{'model':db[_0x475a45[_0x6989('0x1a')]],'as':_0x475a45['as'],'attributes':_0x475a45[_0x6989('0x16')],'include':_0x475a45[_0x6989('0x18')]?_[_0x6989('0x19')](_0x475a45['include'],function(_0x4066b4){return{'model':db[_0x4066b4['model']],'as':_0x4066b4['as'],'attributes':_0x4066b4[_0x6989('0x16')],'include':_0x4066b4[_0x6989('0x18')]?_[_0x6989('0x19')](_0x4066b4[_0x6989('0x18')],function(_0x41a802){return{'model':db[_0x41a802[_0x6989('0x1a')]],'as':_0x41a802['as'],'attributes':_0x41a802[_0x6989('0x16')]};}):[]};}):[]};}):[]:[]})[_0x6989('0x1b')](function(_0x1d5294){logger[_0x6989('0x9')](_0x6989('0x1e'),_0x175d0c);logger[_0x6989('0xc')](_0x6989('0x1e'),_0x175d0c,JSON['stringify'](_0x1d5294));_0x4b95bd(_0x1d5294);})[_0x6989('0x12')](function(_0x41fa55){logger['error'](_0x6989('0x1e'),_0x41fa55['message'],_0x175d0c);_0x1a9fc2(_0x260d0a['error'](0x1f4,_0x41fa55['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index e36265c..c91b2fa 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(_0x3ce4c9,_0x42b5d5){var _0x303dee=function(_0x8dd425){while(--_0x8dd425){_0x3ce4c9['push'](_0x3ce4c9['shift']());}};_0x303dee(++_0x42b5d5);}(_0xb10b,0x12a));var _0xbb10=function(_0x2a8b5c,_0x429c22){_0x2a8b5c=_0x2a8b5c-0x0;var _0x3bbefe=_0xb10b[_0x2a8b5c];return _0x3bbefe;};'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(_0x673ba3,_0x56aab0){var _0x17bce5=function(_0x3405f6){while(--_0x3405f6){_0x673ba3['push'](_0x673ba3['shift']());}};_0x17bce5(++_0x56aab0);}(_0xb10b,0x12a));var _0xbb10=function(_0x5d07bb,_0x271464){_0x5d07bb=_0x5d07bb-0x0;var _0x42960a=_0xb10b[_0x5d07bb];return _0x42960a;};'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 91cafb7..c4bc2ed 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 _0x263d=['exports','STRING'];(function(_0x213b16,_0x5ba88a){var _0x3bc27f=function(_0x30134f){while(--_0x30134f){_0x213b16['push'](_0x213b16['shift']());}};_0x3bc27f(++_0x5ba88a);}(_0x263d,0x17a));var _0xd263=function(_0x482214,_0x2550ff){_0x482214=_0x482214-0x0;var _0x38d0cb=_0x263d[_0x482214];return _0x38d0cb;};'use strict';var Sequelize=require('sequelize');module[_0xd263('0x0')]={'name':{'type':Sequelize[_0xd263('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x69c6=['sequelize','exports','STRING'];(function(_0x20b2f8,_0x32dc96){var _0xf77d1c=function(_0x409ddf){while(--_0x409ddf){_0x20b2f8['push'](_0x20b2f8['shift']());}};_0xf77d1c(++_0x32dc96);}(_0x69c6,0x198));var _0x669c=function(_0x2ea464,_0x3a34ce){_0x2ea464=_0x2ea464-0x0;var _0x381511=_0x69c6[_0x2ea464];return _0x381511;};'use strict';var Sequelize=require(_0x669c('0x0'));module[_0x669c('0x1')]={'name':{'type':Sequelize[_0x669c('0x2')]},'description':{'type':Sequelize[_0x669c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index cc9b4bf..d7db324 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 _0x7829=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','VtigerConfiguration','includeAll','include','findAll','rows','show','params','find','create','body','destroy','getFields','VtigerField','findOne','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','client','test','Sequelize','ValidationError','request','then','info','VtigerConfiguration,\x20%s,\x20%s','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','stack','name','send','rawAttributes','type','key','model'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7829,0xd4));var _0x9782=function(_0x2062d9,_0x330ee8){_0x2062d9=_0x2062d9-0x0;var _0x2c0724=_0x7829[_0x2062d9];return _0x2c0724;};'use strict';var pdf=require(_0x9782('0x0'));var emlformat=require(_0x9782('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9782('0x2'));var jsonpatch=require(_0x9782('0x3'));var rp=require(_0x9782('0x4'));var moment=require(_0x9782('0x5'));var BPromise=require(_0x9782('0x6'));var Mustache=require(_0x9782('0x7'));var util=require(_0x9782('0x8'));var path=require(_0x9782('0x9'));var sox=require('sox');var csv=require(_0x9782('0xa'));var ejs=require(_0x9782('0xb'));var fs=require('fs');var _=require(_0x9782('0xc'));var squel=require(_0x9782('0xd'));var crypto=require(_0x9782('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9782('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9782('0x10'));var Papa=require('papaparse');var Redis=require(_0x9782('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9782('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9782('0x13'));var logger=require('../../config/logger')(_0x9782('0x14'));var utils=require(_0x9782('0x15'));var config=require(_0x9782('0x16'));var db=require(_0x9782('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x9782('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0xfb1a31,_0x346e9e,_0x319e20){if(_0x319e20){var _0x18d8e0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x18d8e0[_0x9782('0x19')](_0x346e9e)){return _0xfb1a31;}else{throw new db[(_0x9782('0x1a'))][(_0x9782('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 _0xfb1a31;}}function respondWithRpcPromise(_0x4b9df1,_0x552c4e,_0x2441fc,_0x4fb2a9){return new BPromise(function(_0x5c3a30,_0x420f7a){var _0x11f82b=_0x4fb2a9||client;return _0x11f82b[_0x9782('0x1c')](_0x4b9df1,_0x2441fc)[_0x9782('0x1d')](function(_0x25c4df){logger[_0x9782('0x1e')](_0x9782('0x1f'),_0x552c4e,'request\x20sent');logger['debug'](_0x9782('0x20'),_0x552c4e,_0x9782('0x21'),JSON[_0x9782('0x22')](_0x25c4df));if(_0x25c4df[_0x9782('0x23')]){if(_0x25c4df[_0x9782('0x23')][_0x9782('0x24')]===0x1f4){logger[_0x9782('0x23')](_0x9782('0x1f'),_0x552c4e,_0x25c4df[_0x9782('0x23')][_0x9782('0x25')]);return _0x420f7a(_0x25c4df['error'][_0x9782('0x25')]);}logger[_0x9782('0x23')](_0x9782('0x1f'),_0x552c4e,_0x25c4df[_0x9782('0x23')]['message']);return _0x5c3a30(_0x25c4df['error']['message']);}else{logger['info'](_0x9782('0x1f'),_0x552c4e,_0x9782('0x21'));_0x5c3a30(_0x25c4df['result'][_0x9782('0x25')]);}})[_0x9782('0x26')](function(_0x23cad2){logger[_0x9782('0x23')](_0x9782('0x1f'),_0x552c4e,_0x23cad2);_0x420f7a(_0x23cad2);});});}function respondWithStatusCode(_0x5ce2fc,_0x1d2eb0){_0x1d2eb0=_0x1d2eb0||0xcc;return function(_0x25a133){if(_0x25a133){return _0x5ce2fc[_0x9782('0x27')](_0x1d2eb0);}return _0x5ce2fc[_0x9782('0x28')](_0x1d2eb0)[_0x9782('0x29')]();};}function respondWithResult(_0x22ee19,_0xf7f45d){_0xf7f45d=_0xf7f45d||0xc8;return function(_0x4e930b){if(_0x4e930b){return _0x22ee19['status'](_0xf7f45d)[_0x9782('0x2a')](_0x4e930b);}};}function respondWithFilteredResult(_0x501196,_0x40c02d){return function(_0x37d089){if(_0x37d089){var _0x4d9f09=_0x37d089[_0x9782('0x2b')],_0x189e08=_0x40c02d['offset'],_0x5c2b11=_0x40c02d[_0x9782('0x2c')]+_0x40c02d[_0x9782('0x2d')],_0x595f6a;if(_0x5c2b11>=_0x4d9f09){_0x5c2b11=_0x4d9f09;_0x595f6a=0xc8;}else{_0x595f6a=0xce;}_0x501196['status'](_0x595f6a);return _0x501196['set'](_0x9782('0x2e'),_0x189e08+'-'+_0x5c2b11+'/'+_0x4d9f09)['json'](_0x37d089);}return null;};}function patchUpdates(_0x553d5a){return function(_0x1c0fde){try{jsonpatch[_0x9782('0x2f')](_0x1c0fde,_0x553d5a,!![]);}catch(_0x36bf49){return BPromise[_0x9782('0x30')](_0x36bf49);}return _0x1c0fde[_0x9782('0x31')]();};}function saveUpdates(_0x4c253a,_0x52c113){return function(_0x381d75){if(_0x381d75){return _0x381d75[_0x9782('0x32')](_0x4c253a)['then'](function(_0x1ca749){return _0x1ca749;});}return null;};}function removeEntity(_0x30e68e,_0x381031){return function(_0xbf962c){if(_0xbf962c){return _0xbf962c['destroy']()[_0x9782('0x1d')](function(){_0x30e68e[_0x9782('0x28')](0xcc)[_0x9782('0x29')]();});}};}function handleEntityNotFound(_0x351273,_0x2c40df){return function(_0x510fa5){if(!_0x510fa5){_0x351273[_0x9782('0x27')](0x194);}return _0x510fa5;};}function handleError(_0x21013b,_0x44c5bd){_0x44c5bd=_0x44c5bd||0x1f4;return function(_0x2cc6e7){logger[_0x9782('0x23')](_0x2cc6e7[_0x9782('0x33')]);if(_0x2cc6e7[_0x9782('0x34')]){delete _0x2cc6e7[_0x9782('0x34')];}_0x21013b[_0x9782('0x28')](_0x44c5bd)[_0x9782('0x35')](_0x2cc6e7);};}exports['index']=function(_0x35abbd,_0x5c7e99){var _0x3f46d4={},_0x2aa48e={},_0x55bd5d={'count':0x0,'rows':[]};var _0x1009a2=_['map'](db['VtigerConfiguration'][_0x9782('0x36')],function(_0x3c83f1){return{'name':_0x3c83f1['fieldName'],'type':_0x3c83f1[_0x9782('0x37')][_0x9782('0x38')]};});_0x2aa48e[_0x9782('0x39')]=_['map'](_0x1009a2,_0x9782('0x34'));_0x2aa48e[_0x9782('0x3a')]=_[_0x9782('0x3b')](_0x35abbd[_0x9782('0x3a')]);_0x2aa48e[_0x9782('0x3c')]=_[_0x9782('0x3d')](_0x2aa48e[_0x9782('0x39')],_0x2aa48e[_0x9782('0x3a')]);_0x3f46d4[_0x9782('0x3e')]=_[_0x9782('0x3d')](_0x2aa48e[_0x9782('0x39')],qs['fields'](_0x35abbd[_0x9782('0x3a')][_0x9782('0x3f')]));_0x3f46d4[_0x9782('0x3e')]=_0x3f46d4[_0x9782('0x3e')][_0x9782('0x40')]?_0x3f46d4[_0x9782('0x3e')]:_0x2aa48e[_0x9782('0x39')];if(!_0x35abbd[_0x9782('0x3a')][_0x9782('0x41')](_0x9782('0x42'))){_0x3f46d4['limit']=qs['limit'](_0x35abbd[_0x9782('0x3a')]['limit']);_0x3f46d4[_0x9782('0x2c')]=qs[_0x9782('0x2c')](_0x35abbd[_0x9782('0x3a')]['offset']);}_0x3f46d4[_0x9782('0x43')]=qs['sort'](_0x35abbd['query'][_0x9782('0x44')]);_0x3f46d4[_0x9782('0x45')]=qs['filters'](_[_0x9782('0x46')](_0x35abbd[_0x9782('0x3a')],_0x2aa48e[_0x9782('0x3c')]),_0x1009a2);if(_0x35abbd['query'][_0x9782('0x47')]){_0x3f46d4[_0x9782('0x45')]=_[_0x9782('0x48')](_0x3f46d4[_0x9782('0x45')],{'$or':_[_0x9782('0x49')](_0x1009a2,function(_0x5d6a1f){if(_0x5d6a1f['type']!=='VIRTUAL'){var _0x30e235={};_0x30e235[_0x5d6a1f['name']]={'$like':'%'+_0x35abbd[_0x9782('0x3a')][_0x9782('0x47')]+'%'};return _0x30e235;}})});}_0x3f46d4=_[_0x9782('0x48')]({},_0x3f46d4,_0x35abbd[_0x9782('0x4a')]);var _0x4a89ac={'where':_0x3f46d4[_0x9782('0x45')]};return db[_0x9782('0x4b')][_0x9782('0x2b')](_0x4a89ac)[_0x9782('0x1d')](function(_0x15838b){_0x55bd5d[_0x9782('0x2b')]=_0x15838b;if(_0x35abbd['query'][_0x9782('0x4c')]){_0x3f46d4[_0x9782('0x4d')]=[{'all':!![]}];}return db[_0x9782('0x4b')][_0x9782('0x4e')](_0x3f46d4);})[_0x9782('0x1d')](function(_0x4a55c8){_0x55bd5d[_0x9782('0x4f')]=_0x4a55c8;return _0x55bd5d;})['then'](respondWithFilteredResult(_0x5c7e99,_0x3f46d4))[_0x9782('0x26')](handleError(_0x5c7e99,null));};exports[_0x9782('0x50')]=function(_0x2e7e01,_0xef5b71){var _0x37e0b8={'raw':![],'where':{'id':_0x2e7e01[_0x9782('0x51')]['id']}},_0x499ca3={};_0x499ca3[_0x9782('0x39')]=_[_0x9782('0x3b')](db['VtigerConfiguration']['rawAttributes']);_0x499ca3['query']=_['keys'](_0x2e7e01['query']);_0x499ca3[_0x9782('0x3c')]=_['intersection'](_0x499ca3['model'],_0x499ca3[_0x9782('0x3a')]);_0x37e0b8[_0x9782('0x3e')]=_[_0x9782('0x3d')](_0x499ca3[_0x9782('0x39')],qs[_0x9782('0x3f')](_0x2e7e01[_0x9782('0x3a')]['fields']));_0x37e0b8[_0x9782('0x3e')]=_0x37e0b8[_0x9782('0x3e')][_0x9782('0x40')]?_0x37e0b8['attributes']:_0x499ca3[_0x9782('0x39')];if(_0x2e7e01[_0x9782('0x3a')][_0x9782('0x4c')]){_0x37e0b8[_0x9782('0x4d')]=[{'all':!![]}];}_0x37e0b8=_['merge']({},_0x37e0b8,_0x2e7e01[_0x9782('0x4a')]);return db[_0x9782('0x4b')][_0x9782('0x52')](_0x37e0b8)['then'](handleEntityNotFound(_0xef5b71,null))['then'](respondWithResult(_0xef5b71,null))[_0x9782('0x26')](handleError(_0xef5b71,null));};exports[_0x9782('0x53')]=function(_0x5290ff,_0x4c01c9){return db[_0x9782('0x4b')][_0x9782('0x53')](_0x5290ff[_0x9782('0x54')],{})['then'](respondWithResult(_0x4c01c9,0xc9))['catch'](handleError(_0x4c01c9,null));};exports[_0x9782('0x32')]=function(_0x4408f5,_0x98204b){if(_0x4408f5[_0x9782('0x54')]['id']){delete _0x4408f5[_0x9782('0x54')]['id'];}return db['VtigerConfiguration'][_0x9782('0x52')]({'where':{'id':_0x4408f5[_0x9782('0x51')]['id']}})['then'](handleEntityNotFound(_0x98204b,null))['then'](saveUpdates(_0x4408f5[_0x9782('0x54')],null))['then'](respondWithResult(_0x98204b,null))[_0x9782('0x26')](handleError(_0x98204b,null));};exports[_0x9782('0x55')]=function(_0x457f74,_0x119c37){return db[_0x9782('0x4b')][_0x9782('0x52')]({'where':{'id':_0x457f74[_0x9782('0x51')]['id']}})[_0x9782('0x1d')](handleEntityNotFound(_0x119c37,null))['then'](removeEntity(_0x119c37,null))['catch'](handleError(_0x119c37,null));};exports[_0x9782('0x56')]=function(_0x3be3bd,_0x152938,_0x27c3fb){var _0x369579={};var _0x4ce3d1={};var _0x5bf1ac;var _0x31fc77;return db[_0x9782('0x4b')]['findOne']({'where':{'id':_0x3be3bd[_0x9782('0x51')]['id']}})[_0x9782('0x1d')](handleEntityNotFound(_0x152938,null))['then'](function(_0x300140){if(_0x300140){_0x5bf1ac=_0x300140;_0x4ce3d1[_0x9782('0x39')]=_[_0x9782('0x3b')](db[_0x9782('0x57')][_0x9782('0x36')]);_0x4ce3d1['query']=_[_0x9782('0x3b')](_0x3be3bd[_0x9782('0x3a')]);_0x4ce3d1[_0x9782('0x3c')]=_['intersection'](_0x4ce3d1['model'],_0x4ce3d1[_0x9782('0x3a')]);_0x369579[_0x9782('0x3e')]=_[_0x9782('0x3d')](_0x4ce3d1[_0x9782('0x39')],qs['fields'](_0x3be3bd[_0x9782('0x3a')]['fields']));_0x369579[_0x9782('0x3e')]=_0x369579[_0x9782('0x3e')]['length']?_0x369579[_0x9782('0x3e')]:_0x4ce3d1[_0x9782('0x39')];_0x369579[_0x9782('0x43')]=qs[_0x9782('0x44')](_0x3be3bd[_0x9782('0x3a')]['sort']);_0x369579[_0x9782('0x45')]=qs['filters'](_['pick'](_0x3be3bd[_0x9782('0x3a')],_0x4ce3d1[_0x9782('0x3c')]));if(_0x3be3bd[_0x9782('0x3a')][_0x9782('0x47')]){_0x369579['where']=_[_0x9782('0x48')](_0x369579[_0x9782('0x45')],{'$or':_[_0x9782('0x49')](_0x369579['attributes'],function(_0x398804){var _0x1d4475={};_0x1d4475[_0x398804]={'$like':'%'+_0x3be3bd[_0x9782('0x3a')][_0x9782('0x47')]+'%'};return _0x1d4475;})});}_0x369579=_['merge']({},_0x369579,_0x3be3bd['options']);return _0x5bf1ac[_0x9782('0x56')](_0x369579);}})[_0x9782('0x1d')](function(_0x30fae7){if(_0x30fae7){_0x31fc77=_0x30fae7[_0x9782('0x40')];if(!_0x3be3bd[_0x9782('0x3a')][_0x9782('0x41')](_0x9782('0x42'))){_0x369579[_0x9782('0x2d')]=qs['limit'](_0x3be3bd['query'][_0x9782('0x2d')]);_0x369579[_0x9782('0x2c')]=qs[_0x9782('0x2c')](_0x3be3bd[_0x9782('0x3a')][_0x9782('0x2c')]);}return _0x5bf1ac[_0x9782('0x56')](_0x369579);}})[_0x9782('0x1d')](function(_0x5c6686){if(_0x5c6686){return _0x5c6686?{'count':_0x31fc77,'rows':_0x5c6686}:null;}})[_0x9782('0x1d')](respondWithResult(_0x152938,null))[_0x9782('0x26')](handleError(_0x152938,null));};exports['getSubjects']=function(_0x44256e,_0x2bdd3,_0x407f47){var _0x1110c4={};var _0x3391d3={};var _0x40a696;var _0x365b52;return db[_0x9782('0x4b')][_0x9782('0x58')]({'where':{'id':_0x44256e[_0x9782('0x51')]['id']}})[_0x9782('0x1d')](handleEntityNotFound(_0x2bdd3,null))[_0x9782('0x1d')](function(_0x59b576){if(_0x59b576){_0x40a696=_0x59b576;_0x3391d3['model']=_[_0x9782('0x3b')](db[_0x9782('0x57')]['rawAttributes']);_0x3391d3[_0x9782('0x3a')]=_[_0x9782('0x3b')](_0x44256e[_0x9782('0x3a')]);_0x3391d3[_0x9782('0x3c')]=_[_0x9782('0x3d')](_0x3391d3[_0x9782('0x39')],_0x3391d3[_0x9782('0x3a')]);_0x1110c4[_0x9782('0x3e')]=_['intersection'](_0x3391d3[_0x9782('0x39')],qs[_0x9782('0x3f')](_0x44256e[_0x9782('0x3a')]['fields']));_0x1110c4[_0x9782('0x3e')]=_0x1110c4['attributes'][_0x9782('0x40')]?_0x1110c4[_0x9782('0x3e')]:_0x3391d3[_0x9782('0x39')];_0x1110c4[_0x9782('0x43')]=qs[_0x9782('0x44')](_0x44256e[_0x9782('0x3a')][_0x9782('0x44')]);_0x1110c4[_0x9782('0x45')]=qs[_0x9782('0x3c')](_[_0x9782('0x46')](_0x44256e[_0x9782('0x3a')],_0x3391d3[_0x9782('0x3c')]));if(_0x44256e[_0x9782('0x3a')][_0x9782('0x47')]){_0x1110c4[_0x9782('0x45')]=_[_0x9782('0x48')](_0x1110c4['where'],{'$or':_[_0x9782('0x49')](_0x1110c4['attributes'],function(_0xdd10ac){var _0x3a998d={};_0x3a998d[_0xdd10ac]={'$like':'%'+_0x44256e[_0x9782('0x3a')][_0x9782('0x47')]+'%'};return _0x3a998d;})});}_0x1110c4=_['merge']({},_0x1110c4,_0x44256e[_0x9782('0x4a')]);return _0x40a696['getSubjects'](_0x1110c4);}})[_0x9782('0x1d')](function(_0x37785d){if(_0x37785d){_0x365b52=_0x37785d[_0x9782('0x40')];if(!_0x44256e[_0x9782('0x3a')][_0x9782('0x41')]('nolimit')){_0x1110c4[_0x9782('0x2d')]=qs[_0x9782('0x2d')](_0x44256e[_0x9782('0x3a')][_0x9782('0x2d')]);_0x1110c4[_0x9782('0x2c')]=qs[_0x9782('0x2c')](_0x44256e[_0x9782('0x3a')][_0x9782('0x2c')]);}return _0x40a696['getSubjects'](_0x1110c4);}})['then'](function(_0x50a2bc){if(_0x50a2bc){return _0x50a2bc?{'count':_0x365b52,'rows':_0x50a2bc}:null;}})[_0x9782('0x1d')](respondWithResult(_0x2bdd3,null))[_0x9782('0x26')](handleError(_0x2bdd3,null));};exports[_0x9782('0x59')]=function(_0xc8a9fd,_0x20255e,_0x121dff){var _0x1ca4d1={};var _0x704e73={};var _0x4f7e63;var _0xc2777b;return db['VtigerConfiguration'][_0x9782('0x58')]({'where':{'id':_0xc8a9fd[_0x9782('0x51')]['id']}})[_0x9782('0x1d')](handleEntityNotFound(_0x20255e,null))['then'](function(_0x222e8a){if(_0x222e8a){_0x4f7e63=_0x222e8a;_0x704e73[_0x9782('0x39')]=_['keys'](db['VtigerField'][_0x9782('0x36')]);_0x704e73[_0x9782('0x3a')]=_[_0x9782('0x3b')](_0xc8a9fd[_0x9782('0x3a')]);_0x704e73['filters']=_[_0x9782('0x3d')](_0x704e73[_0x9782('0x39')],_0x704e73['query']);_0x1ca4d1[_0x9782('0x3e')]=_[_0x9782('0x3d')](_0x704e73[_0x9782('0x39')],qs['fields'](_0xc8a9fd['query'][_0x9782('0x3f')]));_0x1ca4d1[_0x9782('0x3e')]=_0x1ca4d1['attributes'][_0x9782('0x40')]?_0x1ca4d1[_0x9782('0x3e')]:_0x704e73['model'];_0x1ca4d1['order']=qs[_0x9782('0x44')](_0xc8a9fd['query'][_0x9782('0x44')]);_0x1ca4d1[_0x9782('0x45')]=qs['filters'](_[_0x9782('0x46')](_0xc8a9fd[_0x9782('0x3a')],_0x704e73['filters']));if(_0xc8a9fd[_0x9782('0x3a')]['filter']){_0x1ca4d1[_0x9782('0x45')]=_[_0x9782('0x48')](_0x1ca4d1[_0x9782('0x45')],{'$or':_[_0x9782('0x49')](_0x1ca4d1[_0x9782('0x3e')],function(_0x1fc5a2){var _0x16cd0b={};_0x16cd0b[_0x1fc5a2]={'$like':'%'+_0xc8a9fd['query']['filter']+'%'};return _0x16cd0b;})});}_0x1ca4d1=_['merge']({},_0x1ca4d1,_0xc8a9fd['options']);return _0x4f7e63['getDescriptions'](_0x1ca4d1);}})[_0x9782('0x1d')](function(_0x162927){if(_0x162927){_0xc2777b=_0x162927[_0x9782('0x40')];if(!_0xc8a9fd[_0x9782('0x3a')][_0x9782('0x41')](_0x9782('0x42'))){_0x1ca4d1[_0x9782('0x2d')]=qs[_0x9782('0x2d')](_0xc8a9fd[_0x9782('0x3a')][_0x9782('0x2d')]);_0x1ca4d1[_0x9782('0x2c')]=qs[_0x9782('0x2c')](_0xc8a9fd[_0x9782('0x3a')][_0x9782('0x2c')]);}return _0x4f7e63[_0x9782('0x59')](_0x1ca4d1);}})[_0x9782('0x1d')](function(_0x920c7d){if(_0x920c7d){return _0x920c7d?{'count':_0xc2777b,'rows':_0x920c7d}:null;}})['then'](respondWithResult(_0x20255e,null))['catch'](handleError(_0x20255e,null));}; \ No newline at end of file +var _0x09e1=['request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','save','update','destroy','end','stack','name','send','index','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','VtigerConfiguration','includeAll','include','rows','show','params','find','create','body','getFields','VtigerField','order','findOne','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','VtigerConfiguration,\x20%s,\x20%s'];(function(_0x2d2a9b,_0x5870ff){var _0x3d2d49=function(_0x13884d){while(--_0x13884d){_0x2d2a9b['push'](_0x2d2a9b['shift']());}};_0x3d2d49(++_0x5870ff);}(_0x09e1,0x9d));var _0x109e=function(_0x3c1911,_0x463e45){_0x3c1911=_0x3c1911-0x0;var _0x2bcb22=_0x09e1[_0x3c1911];return _0x2bcb22;};'use strict';var pdf=require(_0x109e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x109e('0x1'));var zipdir=require(_0x109e('0x2'));var jsonpatch=require(_0x109e('0x3'));var rp=require(_0x109e('0x4'));var moment=require(_0x109e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x109e('0x6'));var util=require(_0x109e('0x7'));var path=require('path');var sox=require(_0x109e('0x8'));var csv=require('to-csv');var ejs=require(_0x109e('0x9'));var fs=require('fs');var _=require(_0x109e('0xa'));var squel=require(_0x109e('0xb'));var crypto=require(_0x109e('0xc'));var jsforce=require(_0x109e('0xd'));var deskjs=require(_0x109e('0xe'));var toCsv=require(_0x109e('0xf'));var querystring=require(_0x109e('0x10'));var Papa=require(_0x109e('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x109e('0x12'));var as=require(_0x109e('0x13'));var hardwareService=require(_0x109e('0x14'));var logger=require(_0x109e('0x15'))(_0x109e('0x16'));var utils=require(_0x109e('0x17'));var config=require('../../config/environment');var db=require(_0x109e('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x109e('0x19')][_0x109e('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x1615c3,_0x184dbb,_0x21fef4){if(_0x21fef4){var _0x24f41d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x24f41d[_0x109e('0x1b')](_0x184dbb)){return _0x1615c3;}else{throw new db[(_0x109e('0x1c'))][(_0x109e('0x1d'))](_0x109e('0x1e'));}}else{return _0x1615c3;}}function respondWithRpcPromise(_0x36ba7b,_0x24a1b4,_0x31ece3,_0x29c19a){return new BPromise(function(_0x42a5f0,_0x331370){var _0x2adf72=_0x29c19a||client;return _0x2adf72[_0x109e('0x1f')](_0x36ba7b,_0x31ece3)[_0x109e('0x20')](function(_0x540c2b){logger[_0x109e('0x21')](_0x109e('0x22'),_0x24a1b4,_0x109e('0x23'));logger[_0x109e('0x24')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x24a1b4,_0x109e('0x23'),JSON[_0x109e('0x25')](_0x540c2b));if(_0x540c2b[_0x109e('0x26')]){if(_0x540c2b[_0x109e('0x26')][_0x109e('0x27')]===0x1f4){logger['error'](_0x109e('0x22'),_0x24a1b4,_0x540c2b[_0x109e('0x26')][_0x109e('0x28')]);return _0x331370(_0x540c2b[_0x109e('0x26')][_0x109e('0x28')]);}logger[_0x109e('0x26')](_0x109e('0x22'),_0x24a1b4,_0x540c2b[_0x109e('0x26')][_0x109e('0x28')]);return _0x42a5f0(_0x540c2b[_0x109e('0x26')][_0x109e('0x28')]);}else{logger[_0x109e('0x21')](_0x109e('0x22'),_0x24a1b4,_0x109e('0x23'));_0x42a5f0(_0x540c2b[_0x109e('0x29')][_0x109e('0x28')]);}})[_0x109e('0x2a')](function(_0x475331){logger['error'](_0x109e('0x22'),_0x24a1b4,_0x475331);_0x331370(_0x475331);});});}function respondWithStatusCode(_0x58527b,_0x3a994c){_0x3a994c=_0x3a994c||0xcc;return function(_0x16469d){if(_0x16469d){return _0x58527b[_0x109e('0x2b')](_0x3a994c);}return _0x58527b[_0x109e('0x2c')](_0x3a994c)['end']();};}function respondWithResult(_0x555dca,_0x569c03){_0x569c03=_0x569c03||0xc8;return function(_0x1b6a57){if(_0x1b6a57){return _0x555dca[_0x109e('0x2c')](_0x569c03)[_0x109e('0x2d')](_0x1b6a57);}};}function respondWithFilteredResult(_0x2a20f3,_0x3e7c92){return function(_0x1f590d){if(_0x1f590d){var _0x349a19=_0x1f590d[_0x109e('0x2e')],_0x2f2a32=_0x3e7c92[_0x109e('0x2f')],_0xd22259=_0x3e7c92[_0x109e('0x2f')]+_0x3e7c92[_0x109e('0x30')],_0x51e74f;if(_0xd22259>=_0x349a19){_0xd22259=_0x349a19;_0x51e74f=0xc8;}else{_0x51e74f=0xce;}_0x2a20f3[_0x109e('0x2c')](_0x51e74f);return _0x2a20f3[_0x109e('0x31')](_0x109e('0x32'),_0x2f2a32+'-'+_0xd22259+'/'+_0x349a19)[_0x109e('0x2d')](_0x1f590d);}return null;};}function patchUpdates(_0x5dade9){return function(_0x122591){try{jsonpatch['apply'](_0x122591,_0x5dade9,!![]);}catch(_0x326d1e){return BPromise['reject'](_0x326d1e);}return _0x122591[_0x109e('0x33')]();};}function saveUpdates(_0x2d0d83,_0x5a69bc){return function(_0x242a91){if(_0x242a91){return _0x242a91[_0x109e('0x34')](_0x2d0d83)[_0x109e('0x20')](function(_0x3032ae){return _0x3032ae;});}return null;};}function removeEntity(_0x210e5b,_0x358720){return function(_0x117a6d){if(_0x117a6d){return _0x117a6d[_0x109e('0x35')]()[_0x109e('0x20')](function(){_0x210e5b[_0x109e('0x2c')](0xcc)[_0x109e('0x36')]();});}};}function handleEntityNotFound(_0x1585ab,_0x3de19c){return function(_0x42f7b6){if(!_0x42f7b6){_0x1585ab[_0x109e('0x2b')](0x194);}return _0x42f7b6;};}function handleError(_0x17dcc6,_0x32913f){_0x32913f=_0x32913f||0x1f4;return function(_0x3edff3){logger['error'](_0x3edff3[_0x109e('0x37')]);if(_0x3edff3[_0x109e('0x38')]){delete _0x3edff3['name'];}_0x17dcc6['status'](_0x32913f)[_0x109e('0x39')](_0x3edff3);};}exports[_0x109e('0x3a')]=function(_0x18db33,_0x480b4c){var _0x3a60b1={},_0x3c9db4={},_0x129dc0={'count':0x0,'rows':[]};var _0x59c6da=_['map'](db['VtigerConfiguration'][_0x109e('0x3b')],function(_0x2b084c){return{'name':_0x2b084c[_0x109e('0x3c')],'type':_0x2b084c['type'][_0x109e('0x3d')]};});_0x3c9db4['model']=_[_0x109e('0x3e')](_0x59c6da,'name');_0x3c9db4[_0x109e('0x3f')]=_[_0x109e('0x40')](_0x18db33['query']);_0x3c9db4[_0x109e('0x41')]=_[_0x109e('0x42')](_0x3c9db4[_0x109e('0x43')],_0x3c9db4[_0x109e('0x3f')]);_0x3a60b1[_0x109e('0x44')]=_[_0x109e('0x42')](_0x3c9db4[_0x109e('0x43')],qs[_0x109e('0x45')](_0x18db33[_0x109e('0x3f')]['fields']));_0x3a60b1['attributes']=_0x3a60b1[_0x109e('0x44')][_0x109e('0x46')]?_0x3a60b1[_0x109e('0x44')]:_0x3c9db4[_0x109e('0x43')];if(!_0x18db33[_0x109e('0x3f')][_0x109e('0x47')](_0x109e('0x48'))){_0x3a60b1[_0x109e('0x30')]=qs[_0x109e('0x30')](_0x18db33[_0x109e('0x3f')][_0x109e('0x30')]);_0x3a60b1[_0x109e('0x2f')]=qs['offset'](_0x18db33[_0x109e('0x3f')][_0x109e('0x2f')]);}_0x3a60b1['order']=qs['sort'](_0x18db33[_0x109e('0x3f')][_0x109e('0x49')]);_0x3a60b1[_0x109e('0x4a')]=qs[_0x109e('0x41')](_[_0x109e('0x4b')](_0x18db33[_0x109e('0x3f')],_0x3c9db4[_0x109e('0x41')]),_0x59c6da);if(_0x18db33[_0x109e('0x3f')][_0x109e('0x4c')]){_0x3a60b1[_0x109e('0x4a')]=_[_0x109e('0x4d')](_0x3a60b1[_0x109e('0x4a')],{'$or':_[_0x109e('0x3e')](_0x59c6da,function(_0x2a1d4e){if(_0x2a1d4e[_0x109e('0x4e')]!==_0x109e('0x4f')){var _0x943a08={};_0x943a08[_0x2a1d4e[_0x109e('0x38')]]={'$like':'%'+_0x18db33[_0x109e('0x3f')][_0x109e('0x4c')]+'%'};return _0x943a08;}})});}_0x3a60b1=_[_0x109e('0x4d')]({},_0x3a60b1,_0x18db33[_0x109e('0x50')]);var _0x3c3e46={'where':_0x3a60b1['where']};return db[_0x109e('0x51')]['count'](_0x3c3e46)['then'](function(_0x4a8e25){_0x129dc0[_0x109e('0x2e')]=_0x4a8e25;if(_0x18db33[_0x109e('0x3f')][_0x109e('0x52')]){_0x3a60b1[_0x109e('0x53')]=[{'all':!![]}];}return db[_0x109e('0x51')]['findAll'](_0x3a60b1);})['then'](function(_0x245f67){_0x129dc0[_0x109e('0x54')]=_0x245f67;return _0x129dc0;})[_0x109e('0x20')](respondWithFilteredResult(_0x480b4c,_0x3a60b1))[_0x109e('0x2a')](handleError(_0x480b4c,null));};exports[_0x109e('0x55')]=function(_0x4071d6,_0x514e07){var _0x4cde85={'raw':![],'where':{'id':_0x4071d6[_0x109e('0x56')]['id']}},_0x4aa7f2={};_0x4aa7f2[_0x109e('0x43')]=_[_0x109e('0x40')](db[_0x109e('0x51')][_0x109e('0x3b')]);_0x4aa7f2[_0x109e('0x3f')]=_[_0x109e('0x40')](_0x4071d6[_0x109e('0x3f')]);_0x4aa7f2['filters']=_['intersection'](_0x4aa7f2[_0x109e('0x43')],_0x4aa7f2['query']);_0x4cde85['attributes']=_[_0x109e('0x42')](_0x4aa7f2[_0x109e('0x43')],qs[_0x109e('0x45')](_0x4071d6['query']['fields']));_0x4cde85[_0x109e('0x44')]=_0x4cde85[_0x109e('0x44')][_0x109e('0x46')]?_0x4cde85[_0x109e('0x44')]:_0x4aa7f2[_0x109e('0x43')];if(_0x4071d6[_0x109e('0x3f')][_0x109e('0x52')]){_0x4cde85[_0x109e('0x53')]=[{'all':!![]}];}_0x4cde85=_[_0x109e('0x4d')]({},_0x4cde85,_0x4071d6[_0x109e('0x50')]);return db[_0x109e('0x51')][_0x109e('0x57')](_0x4cde85)[_0x109e('0x20')](handleEntityNotFound(_0x514e07,null))['then'](respondWithResult(_0x514e07,null))['catch'](handleError(_0x514e07,null));};exports[_0x109e('0x58')]=function(_0x1f2e0c,_0x494f89){return db[_0x109e('0x51')]['create'](_0x1f2e0c['body'],{})['then'](respondWithResult(_0x494f89,0xc9))['catch'](handleError(_0x494f89,null));};exports[_0x109e('0x34')]=function(_0x501494,_0x18334a){if(_0x501494[_0x109e('0x59')]['id']){delete _0x501494[_0x109e('0x59')]['id'];}return db[_0x109e('0x51')][_0x109e('0x57')]({'where':{'id':_0x501494[_0x109e('0x56')]['id']}})['then'](handleEntityNotFound(_0x18334a,null))[_0x109e('0x20')](saveUpdates(_0x501494[_0x109e('0x59')],null))[_0x109e('0x20')](respondWithResult(_0x18334a,null))[_0x109e('0x2a')](handleError(_0x18334a,null));};exports[_0x109e('0x35')]=function(_0x380293,_0x1fb442){return db[_0x109e('0x51')][_0x109e('0x57')]({'where':{'id':_0x380293[_0x109e('0x56')]['id']}})['then'](handleEntityNotFound(_0x1fb442,null))[_0x109e('0x20')](removeEntity(_0x1fb442,null))[_0x109e('0x2a')](handleError(_0x1fb442,null));};exports[_0x109e('0x5a')]=function(_0x47f578,_0x6599f5,_0x1d786d){var _0x3b6f46={};var _0x2dd749={};var _0x5be12c;var _0x5d522b;return db[_0x109e('0x51')]['findOne']({'where':{'id':_0x47f578[_0x109e('0x56')]['id']}})[_0x109e('0x20')](handleEntityNotFound(_0x6599f5,null))['then'](function(_0x56ee60){if(_0x56ee60){_0x5be12c=_0x56ee60;_0x2dd749['model']=_[_0x109e('0x40')](db[_0x109e('0x5b')][_0x109e('0x3b')]);_0x2dd749[_0x109e('0x3f')]=_['keys'](_0x47f578[_0x109e('0x3f')]);_0x2dd749[_0x109e('0x41')]=_['intersection'](_0x2dd749[_0x109e('0x43')],_0x2dd749[_0x109e('0x3f')]);_0x3b6f46[_0x109e('0x44')]=_[_0x109e('0x42')](_0x2dd749['model'],qs['fields'](_0x47f578[_0x109e('0x3f')]['fields']));_0x3b6f46[_0x109e('0x44')]=_0x3b6f46[_0x109e('0x44')][_0x109e('0x46')]?_0x3b6f46[_0x109e('0x44')]:_0x2dd749[_0x109e('0x43')];_0x3b6f46[_0x109e('0x5c')]=qs[_0x109e('0x49')](_0x47f578[_0x109e('0x3f')][_0x109e('0x49')]);_0x3b6f46['where']=qs['filters'](_[_0x109e('0x4b')](_0x47f578[_0x109e('0x3f')],_0x2dd749[_0x109e('0x41')]));if(_0x47f578[_0x109e('0x3f')]['filter']){_0x3b6f46[_0x109e('0x4a')]=_[_0x109e('0x4d')](_0x3b6f46[_0x109e('0x4a')],{'$or':_[_0x109e('0x3e')](_0x3b6f46[_0x109e('0x44')],function(_0x43ae8e){var _0x4cd133={};_0x4cd133[_0x43ae8e]={'$like':'%'+_0x47f578[_0x109e('0x3f')][_0x109e('0x4c')]+'%'};return _0x4cd133;})});}_0x3b6f46=_[_0x109e('0x4d')]({},_0x3b6f46,_0x47f578[_0x109e('0x50')]);return _0x5be12c[_0x109e('0x5a')](_0x3b6f46);}})[_0x109e('0x20')](function(_0x30d724){if(_0x30d724){_0x5d522b=_0x30d724['length'];if(!_0x47f578[_0x109e('0x3f')][_0x109e('0x47')](_0x109e('0x48'))){_0x3b6f46[_0x109e('0x30')]=qs['limit'](_0x47f578[_0x109e('0x3f')][_0x109e('0x30')]);_0x3b6f46[_0x109e('0x2f')]=qs[_0x109e('0x2f')](_0x47f578[_0x109e('0x3f')][_0x109e('0x2f')]);}return _0x5be12c[_0x109e('0x5a')](_0x3b6f46);}})[_0x109e('0x20')](function(_0x53ec0e){if(_0x53ec0e){return _0x53ec0e?{'count':_0x5d522b,'rows':_0x53ec0e}:null;}})[_0x109e('0x20')](respondWithResult(_0x6599f5,null))['catch'](handleError(_0x6599f5,null));};exports['getSubjects']=function(_0x4e5211,_0x33d162,_0x244271){var _0x34d19a={};var _0x4e6306={};var _0x20afd5;var _0x591aec;return db[_0x109e('0x51')][_0x109e('0x5d')]({'where':{'id':_0x4e5211[_0x109e('0x56')]['id']}})[_0x109e('0x20')](handleEntityNotFound(_0x33d162,null))[_0x109e('0x20')](function(_0x480e24){if(_0x480e24){_0x20afd5=_0x480e24;_0x4e6306[_0x109e('0x43')]=_['keys'](db[_0x109e('0x5b')][_0x109e('0x3b')]);_0x4e6306[_0x109e('0x3f')]=_[_0x109e('0x40')](_0x4e5211[_0x109e('0x3f')]);_0x4e6306[_0x109e('0x41')]=_[_0x109e('0x42')](_0x4e6306['model'],_0x4e6306[_0x109e('0x3f')]);_0x34d19a[_0x109e('0x44')]=_['intersection'](_0x4e6306[_0x109e('0x43')],qs[_0x109e('0x45')](_0x4e5211[_0x109e('0x3f')]['fields']));_0x34d19a[_0x109e('0x44')]=_0x34d19a[_0x109e('0x44')][_0x109e('0x46')]?_0x34d19a['attributes']:_0x4e6306[_0x109e('0x43')];_0x34d19a[_0x109e('0x5c')]=qs[_0x109e('0x49')](_0x4e5211[_0x109e('0x3f')]['sort']);_0x34d19a[_0x109e('0x4a')]=qs[_0x109e('0x41')](_['pick'](_0x4e5211[_0x109e('0x3f')],_0x4e6306[_0x109e('0x41')]));if(_0x4e5211[_0x109e('0x3f')][_0x109e('0x4c')]){_0x34d19a[_0x109e('0x4a')]=_['merge'](_0x34d19a[_0x109e('0x4a')],{'$or':_[_0x109e('0x3e')](_0x34d19a[_0x109e('0x44')],function(_0x39cc58){var _0x2077f7={};_0x2077f7[_0x39cc58]={'$like':'%'+_0x4e5211[_0x109e('0x3f')][_0x109e('0x4c')]+'%'};return _0x2077f7;})});}_0x34d19a=_[_0x109e('0x4d')]({},_0x34d19a,_0x4e5211[_0x109e('0x50')]);return _0x20afd5[_0x109e('0x5e')](_0x34d19a);}})[_0x109e('0x20')](function(_0x27549a){if(_0x27549a){_0x591aec=_0x27549a[_0x109e('0x46')];if(!_0x4e5211[_0x109e('0x3f')]['hasOwnProperty']('nolimit')){_0x34d19a[_0x109e('0x30')]=qs[_0x109e('0x30')](_0x4e5211[_0x109e('0x3f')][_0x109e('0x30')]);_0x34d19a[_0x109e('0x2f')]=qs[_0x109e('0x2f')](_0x4e5211[_0x109e('0x3f')][_0x109e('0x2f')]);}return _0x20afd5[_0x109e('0x5e')](_0x34d19a);}})[_0x109e('0x20')](function(_0x1d773f){if(_0x1d773f){return _0x1d773f?{'count':_0x591aec,'rows':_0x1d773f}:null;}})[_0x109e('0x20')](respondWithResult(_0x33d162,null))['catch'](handleError(_0x33d162,null));};exports[_0x109e('0x5f')]=function(_0x272011,_0x489626,_0x57f68c){var _0x215397={};var _0x45ce29={};var _0x34f9ca;var _0x543daf;return db[_0x109e('0x51')]['findOne']({'where':{'id':_0x272011[_0x109e('0x56')]['id']}})[_0x109e('0x20')](handleEntityNotFound(_0x489626,null))['then'](function(_0x506310){if(_0x506310){_0x34f9ca=_0x506310;_0x45ce29[_0x109e('0x43')]=_['keys'](db[_0x109e('0x5b')][_0x109e('0x3b')]);_0x45ce29[_0x109e('0x3f')]=_[_0x109e('0x40')](_0x272011[_0x109e('0x3f')]);_0x45ce29[_0x109e('0x41')]=_['intersection'](_0x45ce29[_0x109e('0x43')],_0x45ce29[_0x109e('0x3f')]);_0x215397['attributes']=_[_0x109e('0x42')](_0x45ce29[_0x109e('0x43')],qs[_0x109e('0x45')](_0x272011[_0x109e('0x3f')]['fields']));_0x215397[_0x109e('0x44')]=_0x215397[_0x109e('0x44')][_0x109e('0x46')]?_0x215397[_0x109e('0x44')]:_0x45ce29[_0x109e('0x43')];_0x215397[_0x109e('0x5c')]=qs[_0x109e('0x49')](_0x272011[_0x109e('0x3f')][_0x109e('0x49')]);_0x215397['where']=qs[_0x109e('0x41')](_[_0x109e('0x4b')](_0x272011[_0x109e('0x3f')],_0x45ce29[_0x109e('0x41')]));if(_0x272011[_0x109e('0x3f')][_0x109e('0x4c')]){_0x215397[_0x109e('0x4a')]=_['merge'](_0x215397[_0x109e('0x4a')],{'$or':_['map'](_0x215397[_0x109e('0x44')],function(_0x26d562){var _0x177c3f={};_0x177c3f[_0x26d562]={'$like':'%'+_0x272011['query'][_0x109e('0x4c')]+'%'};return _0x177c3f;})});}_0x215397=_['merge']({},_0x215397,_0x272011[_0x109e('0x50')]);return _0x34f9ca[_0x109e('0x5f')](_0x215397);}})[_0x109e('0x20')](function(_0x5f4d66){if(_0x5f4d66){_0x543daf=_0x5f4d66[_0x109e('0x46')];if(!_0x272011[_0x109e('0x3f')][_0x109e('0x47')](_0x109e('0x48'))){_0x215397[_0x109e('0x30')]=qs[_0x109e('0x30')](_0x272011[_0x109e('0x3f')][_0x109e('0x30')]);_0x215397[_0x109e('0x2f')]=qs['offset'](_0x272011[_0x109e('0x3f')]['offset']);}return _0x34f9ca[_0x109e('0x5f')](_0x215397);}})[_0x109e('0x20')](function(_0x5299a0){if(_0x5299a0){return _0x5299a0?{'count':_0x543daf,'rows':_0x5299a0}:null;}})[_0x109e('0x20')](respondWithResult(_0x489626,null))['catch'](handleError(_0x489626,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index f28a88d..6bd9139 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 _0x0140=['../../config/environment','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','api','request-promise','path'];(function(_0x30fe8c,_0x272cb9){var _0x4f1068=function(_0x5f52c7){while(--_0x5f52c7){_0x30fe8c['push'](_0x30fe8c['shift']());}};_0x4f1068(++_0x272cb9);}(_0x0140,0xcd));var _0x0014=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0x0140[_0x1a0daa];return _0x1dbe15;};'use strict';var _=require(_0x0014('0x0'));var util=require(_0x0014('0x1'));var logger=require('../../config/logger')(_0x0014('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0014('0x3'));var fs=require('fs');var path=require(_0x0014('0x4'));var rimraf=require('rimraf');var config=require(_0x0014('0x5'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x0014('0x6')]=function(_0x493cf8,_0x1d38cb){return _0x493cf8[_0x0014('0x7')](_0x0014('0x8'),attributes,{'tableName':_0x0014('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc44a=['./intVtigerConfiguration.attributes','exports','define','int_vtiger_configurations','lodash','util','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x1d30a3,_0x5f428c){var _0x32bba1=function(_0x5a60cc){while(--_0x5a60cc){_0x1d30a3['push'](_0x1d30a3['shift']());}};_0x32bba1(++_0x5f428c);}(_0xc44a,0xbf));var _0xac44=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0xc44a[_0x1780f8];return _0x33a410;};'use strict';var _=require(_0xac44('0x0'));var util=require(_0xac44('0x1'));var logger=require(_0xac44('0x2'))(_0xac44('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xac44('0x4'));var fs=require('fs');var path=require(_0xac44('0x5'));var rimraf=require('rimraf');var config=require(_0xac44('0x6'));var attributes=require(_0xac44('0x7'));module[_0xac44('0x8')]=function(_0x22df57,_0x515ad0){return _0x22df57[_0xac44('0x9')]('VtigerConfiguration',attributes,{'tableName':_0xac44('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 700189b..9efa77c 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 _0x8ca2=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ca2,0xe3));var _0x28ca=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x8ca2[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x28ca('0x0'));var util=require(_0x28ca('0x1'));var moment=require(_0x28ca('0x2'));var BPromise=require(_0x28ca('0x3'));var rs=require(_0x28ca('0x4'));var fs=require('fs');var Redis=require(_0x28ca('0x5'));var db=require(_0x28ca('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x28ca('0x7'))('rpc');var config=require(_0x28ca('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x28ca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x348849,_0x4c16a2,_0x4bf4ad){return new BPromise(function(_0xb2a754,_0x1635c4){return client[_0x28ca('0xa')](_0x348849,_0x4bf4ad)[_0x28ca('0xb')](function(_0x483e26){logger[_0x28ca('0xc')](_0x28ca('0xd'),_0x4c16a2,_0x28ca('0xe'));logger[_0x28ca('0xf')](_0x28ca('0x10'),_0x4c16a2,_0x28ca('0xe'),JSON['stringify'](_0x483e26));if(_0x483e26['error']){if(_0x483e26[_0x28ca('0x11')][_0x28ca('0x12')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x4c16a2,_0x483e26['error'][_0x28ca('0x13')]);return _0x1635c4(_0x483e26['error']['message']);}logger[_0x28ca('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x4c16a2,_0x483e26[_0x28ca('0x11')][_0x28ca('0x13')]);return _0xb2a754(_0x483e26[_0x28ca('0x11')][_0x28ca('0x13')]);}else{logger['info'](_0x28ca('0xd'),_0x4c16a2,_0x28ca('0xe'));_0xb2a754(_0x483e26[_0x28ca('0x14')]['message']);}})['catch'](function(_0x279fe4){logger['error'](_0x28ca('0xd'),_0x4c16a2,_0x279fe4);_0x1635c4(_0x279fe4);});});} \ No newline at end of file +var _0x99d0=['then','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x4e53a7,_0x1a368f){var _0x1f264b=function(_0x121fc7){while(--_0x121fc7){_0x4e53a7['push'](_0x4e53a7['shift']());}};_0x1f264b(++_0x1a368f);}(_0x99d0,0x1ad));var _0x099d=function(_0x4ad0f7,_0x1920b0){_0x4ad0f7=_0x4ad0f7-0x0;var _0x30f5c8=_0x99d0[_0x4ad0f7];return _0x30f5c8;};'use strict';var _=require('lodash');var util=require(_0x099d('0x0'));var moment=require(_0x099d('0x1'));var BPromise=require(_0x099d('0x2'));var rs=require(_0x099d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x099d('0x4'))['db'];var utils=require(_0x099d('0x5'));var logger=require(_0x099d('0x6'))(_0x099d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x099d('0x8')][_0x099d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2834f3,_0x14a8b6,_0x4553dc){return new BPromise(function(_0xf4e840,_0x4f5fdc){return client[_0x099d('0xa')](_0x2834f3,_0x4553dc)[_0x099d('0xb')](function(_0x56ceb7){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x14a8b6,_0x099d('0xc'));logger[_0x099d('0xd')](_0x099d('0xe'),_0x14a8b6,_0x099d('0xc'),JSON[_0x099d('0xf')](_0x56ceb7));if(_0x56ceb7[_0x099d('0x10')]){if(_0x56ceb7[_0x099d('0x10')][_0x099d('0x11')]===0x1f4){logger['error'](_0x099d('0x12'),_0x14a8b6,_0x56ceb7['error'][_0x099d('0x13')]);return _0x4f5fdc(_0x56ceb7[_0x099d('0x10')]['message']);}logger[_0x099d('0x10')](_0x099d('0x12'),_0x14a8b6,_0x56ceb7[_0x099d('0x10')]['message']);return _0xf4e840(_0x56ceb7['error'][_0x099d('0x13')]);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x14a8b6,_0x099d('0xc'));_0xf4e840(_0x56ceb7[_0x099d('0x14')][_0x099d('0x13')]);}})[_0x099d('0x15')](function(_0x2e9a5f){logger[_0x099d('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x14a8b6,_0x2e9a5f);_0x4f5fdc(_0x2e9a5f);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 8c2b450..43c1419 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 _0x880e=['delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','/:id','isAuthenticated','show','post','update'];(function(_0xb499da,_0x2e8849){var _0x482dd6=function(_0x2b86ca){while(--_0x2b86ca){_0xb499da['push'](_0xb499da['shift']());}};_0x482dd6(++_0x2e8849);}(_0x880e,0x1e3));var _0xe880=function(_0x5a8aa3,_0x2294d5){_0x5a8aa3=_0x5a8aa3-0x0;var _0x5d0458=_0x880e[_0x5a8aa3];return _0x5d0458;};'use strict';var multer=require(_0xe880('0x0'));var util=require(_0xe880('0x1'));var path=require(_0xe880('0x2'));var timeout=require('connect-timeout');var express=require(_0xe880('0x3'));var router=express['Router']();var auth=require(_0xe880('0x4'));var interaction=require(_0xe880('0x5'));var config=require('../../config/environment');var controller=require(_0xe880('0x6'));router[_0xe880('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe880('0x7')](_0xe880('0x8'),auth[_0xe880('0x9')](),controller[_0xe880('0xa')]);router[_0xe880('0xb')]('/',auth[_0xe880('0x9')](),controller['create']);router['put'](_0xe880('0x8'),auth[_0xe880('0x9')](),controller[_0xe880('0xc')]);router[_0xe880('0xd')](_0xe880('0x8'),auth['isAuthenticated'](),controller[_0xe880('0xe')]);module[_0xe880('0xf')]=router; \ No newline at end of file +var _0xf70f=['../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','Router'];(function(_0x11139b,_0x3f3d97){var _0x17fa49=function(_0x5ec086){while(--_0x5ec086){_0x11139b['push'](_0x11139b['shift']());}};_0x17fa49(++_0x3f3d97);}(_0xf70f,0x194));var _0xff70=function(_0xee0152,_0xfe1ea7){_0xee0152=_0xee0152-0x0;var _0x1a69d1=_0xf70f[_0xee0152];return _0x1a69d1;};'use strict';var multer=require(_0xff70('0x0'));var util=require(_0xff70('0x1'));var path=require(_0xff70('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xff70('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xff70('0x4'));var controller=require(_0xff70('0x5'));router[_0xff70('0x6')]('/',auth[_0xff70('0x7')](),controller[_0xff70('0x8')]);router[_0xff70('0x6')](_0xff70('0x9'),auth[_0xff70('0x7')](),controller[_0xff70('0xa')]);router[_0xff70('0xb')]('/',auth['isAuthenticated'](),controller[_0xff70('0xc')]);router[_0xff70('0xd')](_0xff70('0x9'),auth['isAuthenticated'](),controller[_0xff70('0xe')]);router['delete'](_0xff70('0x9'),auth[_0xff70('0x7')](),controller[_0xff70('0xf')]);module[_0xff70('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index b97d2b3..712d7a2 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 _0xaa7c=['ENUM','string','variable','BOOLEAN','sequelize','customVariable','keyValue','STRING'];(function(_0x3b865b,_0x31fa7e){var _0x1ce237=function(_0x1a11df){while(--_0x1a11df){_0x3b865b['push'](_0x3b865b['shift']());}};_0x1ce237(++_0x31fa7e);}(_0xaa7c,0x1ec));var _0xcaa7=function(_0x160739,_0x252191){_0x160739=_0x160739-0x0;var _0x20a1d5=_0xaa7c[_0x160739];return _0x20a1d5;};'use strict';var Sequelize=require(_0xcaa7('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0xcaa7('0x1'),_0xcaa7('0x2')),'defaultValue':'string'},'content':{'type':Sequelize[_0xcaa7('0x3')]},'key':{'type':Sequelize[_0xcaa7('0x3')]},'keyType':{'type':Sequelize[_0xcaa7('0x4')](_0xcaa7('0x5'),_0xcaa7('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0xcaa7('0x3')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xcaa7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcaa7('0x3')]}}; \ No newline at end of file +var _0x49fe=['sequelize','exports','ENUM','customVariable','string','STRING','variable','BOOLEAN'];(function(_0x2ff762,_0x342c0b){var _0x158b02=function(_0x13c38e){while(--_0x13c38e){_0x2ff762['push'](_0x2ff762['shift']());}};_0x158b02(++_0x342c0b);}(_0x49fe,0x100));var _0xe49f=function(_0x11b405,_0x55a437){_0x11b405=_0x11b405-0x0;var _0x41b8e5=_0x49fe[_0x11b405];return _0x41b8e5;};'use strict';var Sequelize=require(_0xe49f('0x0'));module[_0xe49f('0x1')]={'type':{'type':Sequelize[_0xe49f('0x2')]('string','variable',_0xe49f('0x3'),'keyValue'),'defaultValue':_0xe49f('0x4')},'content':{'type':Sequelize[_0xe49f('0x5')]},'key':{'type':Sequelize[_0xe49f('0x5')]},'keyType':{'type':Sequelize[_0xe49f('0x2')]('string',_0xe49f('0x6'),_0xe49f('0x3'))},'keyContent':{'type':Sequelize[_0xe49f('0x5')]},'idField':{'type':Sequelize[_0xe49f('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe49f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe49f('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 036e894..27cda13 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 _0x1cf7=['../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','save','update','then','destroy','end','error','stack','name','send','map','VtigerField','rawAttributes','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x29f8f1,_0x5e3d30){var _0x303eef=function(_0x33e772){while(--_0x33e772){_0x29f8f1['push'](_0x29f8f1['shift']());}};_0x303eef(++_0x5e3d30);}(_0x1cf7,0x158));var _0x71cf=function(_0x46d74,_0x4f8af2){_0x46d74=_0x46d74-0x0;var _0x32acdb=_0x1cf7[_0x46d74];return _0x32acdb;};'use strict';var pdf=require(_0x71cf('0x0'));var emlformat=require(_0x71cf('0x1'));var rimraf=require(_0x71cf('0x2'));var zipdir=require(_0x71cf('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x71cf('0x4'));var moment=require(_0x71cf('0x5'));var BPromise=require(_0x71cf('0x6'));var Mustache=require(_0x71cf('0x7'));var util=require('util');var path=require(_0x71cf('0x8'));var sox=require(_0x71cf('0x9'));var csv=require('to-csv');var ejs=require(_0x71cf('0xa'));var fs=require('fs');var _=require(_0x71cf('0xb'));var squel=require(_0x71cf('0xc'));var crypto=require(_0x71cf('0xd'));var jsforce=require(_0x71cf('0xe'));var deskjs=require(_0x71cf('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71cf('0x10'));var Redis=require(_0x71cf('0x11'));var authService=require(_0x71cf('0x12'));var qs=require(_0x71cf('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x71cf('0x14'));var logger=require(_0x71cf('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x71cf('0x16'));var db=require(_0x71cf('0x17'))['db'];function respondWithStatusCode(_0x57b994,_0x1c2ba1){_0x1c2ba1=_0x1c2ba1||0xcc;return function(_0x5ae8ee){if(_0x5ae8ee){return _0x57b994[_0x71cf('0x18')](_0x1c2ba1);}return _0x57b994[_0x71cf('0x19')](_0x1c2ba1)['end']();};}function respondWithResult(_0x49650d,_0x5d8f23){_0x5d8f23=_0x5d8f23||0xc8;return function(_0x584a4d){if(_0x584a4d){return _0x49650d['status'](_0x5d8f23)[_0x71cf('0x1a')](_0x584a4d);}};}function respondWithFilteredResult(_0x200569,_0x117c02){return function(_0x5b526a){if(_0x5b526a){var _0x21cf67=_0x5b526a[_0x71cf('0x1b')],_0x15dc10=_0x117c02[_0x71cf('0x1c')],_0x221b85=_0x117c02[_0x71cf('0x1c')]+_0x117c02[_0x71cf('0x1d')],_0x51e145;if(_0x221b85>=_0x21cf67){_0x221b85=_0x21cf67;_0x51e145=0xc8;}else{_0x51e145=0xce;}_0x200569['status'](_0x51e145);return _0x200569['set']('Content-Range',_0x15dc10+'-'+_0x221b85+'/'+_0x21cf67)['json'](_0x5b526a);}return null;};}function patchUpdates(_0x3e3d8c){return function(_0x5b3347){try{jsonpatch[_0x71cf('0x1e')](_0x5b3347,_0x3e3d8c,!![]);}catch(_0x36c9fb){return BPromise['reject'](_0x36c9fb);}return _0x5b3347[_0x71cf('0x1f')]();};}function saveUpdates(_0x5e78a4,_0xa0f8e1){return function(_0x2a0457){if(_0x2a0457){return _0x2a0457[_0x71cf('0x20')](_0x5e78a4)[_0x71cf('0x21')](function(_0x4c170e){return _0x4c170e;});}return null;};}function removeEntity(_0x139f0a,_0x58c2ea){return function(_0x895c1e){if(_0x895c1e){return _0x895c1e[_0x71cf('0x22')]()['then'](function(){_0x139f0a[_0x71cf('0x19')](0xcc)[_0x71cf('0x23')]();});}};}function handleEntityNotFound(_0x4e440c,_0x55a5b5){return function(_0x38778f){if(!_0x38778f){_0x4e440c[_0x71cf('0x18')](0x194);}return _0x38778f;};}function handleError(_0x245b5c,_0x18f1b2){_0x18f1b2=_0x18f1b2||0x1f4;return function(_0x530b04){logger[_0x71cf('0x24')](_0x530b04[_0x71cf('0x25')]);if(_0x530b04[_0x71cf('0x26')]){delete _0x530b04[_0x71cf('0x26')];}_0x245b5c['status'](_0x18f1b2)[_0x71cf('0x27')](_0x530b04);};}exports['index']=function(_0x2cd110,_0x503571){var _0x25b712={},_0x3944b2={},_0x4de386={'count':0x0,'rows':[]};var _0x47d535=_[_0x71cf('0x28')](db[_0x71cf('0x29')][_0x71cf('0x2a')],function(_0x336064){return{'name':_0x336064['fieldName'],'type':_0x336064['type'][_0x71cf('0x2b')]};});_0x3944b2['model']=_[_0x71cf('0x28')](_0x47d535,'name');_0x3944b2[_0x71cf('0x2c')]=_[_0x71cf('0x2d')](_0x2cd110[_0x71cf('0x2c')]);_0x3944b2['filters']=_[_0x71cf('0x2e')](_0x3944b2[_0x71cf('0x2f')],_0x3944b2[_0x71cf('0x2c')]);_0x25b712[_0x71cf('0x30')]=_['intersection'](_0x3944b2[_0x71cf('0x2f')],qs['fields'](_0x2cd110[_0x71cf('0x2c')][_0x71cf('0x31')]));_0x25b712[_0x71cf('0x30')]=_0x25b712[_0x71cf('0x30')][_0x71cf('0x32')]?_0x25b712[_0x71cf('0x30')]:_0x3944b2[_0x71cf('0x2f')];if(!_0x2cd110[_0x71cf('0x2c')][_0x71cf('0x33')](_0x71cf('0x34'))){_0x25b712[_0x71cf('0x1d')]=qs[_0x71cf('0x1d')](_0x2cd110[_0x71cf('0x2c')][_0x71cf('0x1d')]);_0x25b712[_0x71cf('0x1c')]=qs[_0x71cf('0x1c')](_0x2cd110[_0x71cf('0x2c')]['offset']);}_0x25b712[_0x71cf('0x35')]=qs[_0x71cf('0x36')](_0x2cd110[_0x71cf('0x2c')]['sort']);_0x25b712[_0x71cf('0x37')]=qs[_0x71cf('0x38')](_[_0x71cf('0x39')](_0x2cd110['query'],_0x3944b2[_0x71cf('0x38')]),_0x47d535);if(_0x2cd110['query'][_0x71cf('0x3a')]){_0x25b712[_0x71cf('0x37')]=_[_0x71cf('0x3b')](_0x25b712[_0x71cf('0x37')],{'$or':_[_0x71cf('0x28')](_0x47d535,function(_0x3592b8){if(_0x3592b8[_0x71cf('0x3c')]!==_0x71cf('0x3d')){var _0x4d8a30={};_0x4d8a30[_0x3592b8[_0x71cf('0x26')]]={'$like':'%'+_0x2cd110[_0x71cf('0x2c')][_0x71cf('0x3a')]+'%'};return _0x4d8a30;}})});}_0x25b712=_[_0x71cf('0x3b')]({},_0x25b712,_0x2cd110[_0x71cf('0x3e')]);var _0x4cbc30={'where':_0x25b712['where']};return db[_0x71cf('0x29')][_0x71cf('0x1b')](_0x4cbc30)[_0x71cf('0x21')](function(_0x180490){_0x4de386[_0x71cf('0x1b')]=_0x180490;if(_0x2cd110['query']['includeAll']){_0x25b712['include']=[{'all':!![]}];}return db[_0x71cf('0x29')][_0x71cf('0x3f')](_0x25b712);})[_0x71cf('0x21')](function(_0x2b8f4e){_0x4de386[_0x71cf('0x40')]=_0x2b8f4e;return _0x4de386;})[_0x71cf('0x21')](respondWithFilteredResult(_0x503571,_0x25b712))[_0x71cf('0x41')](handleError(_0x503571,null));};exports[_0x71cf('0x42')]=function(_0x26a834,_0x256a53){var _0x5659b3={'raw':!![],'where':{'id':_0x26a834[_0x71cf('0x43')]['id']}},_0x4e9c3a={};_0x4e9c3a['model']=_[_0x71cf('0x2d')](db[_0x71cf('0x29')][_0x71cf('0x2a')]);_0x4e9c3a[_0x71cf('0x2c')]=_[_0x71cf('0x2d')](_0x26a834[_0x71cf('0x2c')]);_0x4e9c3a['filters']=_[_0x71cf('0x2e')](_0x4e9c3a[_0x71cf('0x2f')],_0x4e9c3a[_0x71cf('0x2c')]);_0x5659b3[_0x71cf('0x30')]=_['intersection'](_0x4e9c3a[_0x71cf('0x2f')],qs[_0x71cf('0x31')](_0x26a834[_0x71cf('0x2c')][_0x71cf('0x31')]));_0x5659b3[_0x71cf('0x30')]=_0x5659b3[_0x71cf('0x30')][_0x71cf('0x32')]?_0x5659b3['attributes']:_0x4e9c3a[_0x71cf('0x2f')];if(_0x26a834['query'][_0x71cf('0x44')]){_0x5659b3[_0x71cf('0x45')]=[{'all':!![]}];}_0x5659b3=_[_0x71cf('0x3b')]({},_0x5659b3,_0x26a834[_0x71cf('0x3e')]);return db[_0x71cf('0x29')][_0x71cf('0x46')](_0x5659b3)[_0x71cf('0x21')](handleEntityNotFound(_0x256a53,null))[_0x71cf('0x21')](respondWithResult(_0x256a53,null))[_0x71cf('0x41')](handleError(_0x256a53,null));};exports[_0x71cf('0x47')]=function(_0x154cce,_0x262240){return db[_0x71cf('0x29')]['create'](_0x154cce['body'],{})['then'](respondWithResult(_0x262240,0xc9))['catch'](handleError(_0x262240,null));};exports[_0x71cf('0x20')]=function(_0x4110a3,_0x2194f6){if(_0x4110a3[_0x71cf('0x48')]['id']){delete _0x4110a3['body']['id'];}return db[_0x71cf('0x29')][_0x71cf('0x46')]({'where':{'id':_0x4110a3[_0x71cf('0x43')]['id']}})['then'](handleEntityNotFound(_0x2194f6,null))[_0x71cf('0x21')](saveUpdates(_0x4110a3['body'],null))['then'](respondWithResult(_0x2194f6,null))[_0x71cf('0x41')](handleError(_0x2194f6,null));};exports[_0x71cf('0x22')]=function(_0x5bf35d,_0x43e20a){return db[_0x71cf('0x29')]['find']({'where':{'id':_0x5bf35d[_0x71cf('0x43')]['id']}})[_0x71cf('0x21')](handleEntityNotFound(_0x43e20a,null))[_0x71cf('0x21')](removeEntity(_0x43e20a,null))[_0x71cf('0x41')](handleError(_0x43e20a,null));}; \ No newline at end of file +var _0x83aa=['../../config/utils','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','VtigerField','rawAttributes','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','merge','options','count','include','findAll','show','params','length','find','catch','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x71528c,_0x414733){var _0x38c479=function(_0x6fd514){while(--_0x6fd514){_0x71528c['push'](_0x71528c['shift']());}};_0x38c479(++_0x414733);}(_0x83aa,0x17f));var _0xa83a=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0x83aa[_0x1d87fc];return _0x492b56;};'use strict';var pdf=require(_0xa83a('0x0'));var emlformat=require(_0xa83a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa83a('0x2'));var jsonpatch=require(_0xa83a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa83a('0x4'));var path=require(_0xa83a('0x5'));var sox=require(_0xa83a('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa83a('0x7'));var squel=require(_0xa83a('0x8'));var crypto=require(_0xa83a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xa83a('0xa'));var toCsv=require(_0xa83a('0xb'));var querystring=require(_0xa83a('0xc'));var Papa=require(_0xa83a('0xd'));var Redis=require(_0xa83a('0xe'));var authService=require(_0xa83a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa83a('0x10'));var hardwareService=require(_0xa83a('0x11'));var logger=require('../../config/logger')(_0xa83a('0x12'));var utils=require(_0xa83a('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6d768c,_0x2e1e7f){_0x2e1e7f=_0x2e1e7f||0xcc;return function(_0x5add37){if(_0x5add37){return _0x6d768c[_0xa83a('0x14')](_0x2e1e7f);}return _0x6d768c[_0xa83a('0x15')](_0x2e1e7f)[_0xa83a('0x16')]();};}function respondWithResult(_0x19b83b,_0x2c7724){_0x2c7724=_0x2c7724||0xc8;return function(_0x3b78ba){if(_0x3b78ba){return _0x19b83b['status'](_0x2c7724)[_0xa83a('0x17')](_0x3b78ba);}};}function respondWithFilteredResult(_0x29e96e,_0xbef76){return function(_0x2ab9dd){if(_0x2ab9dd){var _0x39b4d6=_0x2ab9dd['count'],_0x2afb9c=_0xbef76[_0xa83a('0x18')],_0x532cf0=_0xbef76[_0xa83a('0x18')]+_0xbef76[_0xa83a('0x19')],_0x41a64f;if(_0x532cf0>=_0x39b4d6){_0x532cf0=_0x39b4d6;_0x41a64f=0xc8;}else{_0x41a64f=0xce;}_0x29e96e[_0xa83a('0x15')](_0x41a64f);return _0x29e96e[_0xa83a('0x1a')](_0xa83a('0x1b'),_0x2afb9c+'-'+_0x532cf0+'/'+_0x39b4d6)[_0xa83a('0x17')](_0x2ab9dd);}return null;};}function patchUpdates(_0x563768){return function(_0x578afe){try{jsonpatch[_0xa83a('0x1c')](_0x578afe,_0x563768,!![]);}catch(_0x1643a1){return BPromise[_0xa83a('0x1d')](_0x1643a1);}return _0x578afe[_0xa83a('0x1e')]();};}function saveUpdates(_0x186243,_0x114ac0){return function(_0x4eec67){if(_0x4eec67){return _0x4eec67[_0xa83a('0x1f')](_0x186243)[_0xa83a('0x20')](function(_0x23235c){return _0x23235c;});}return null;};}function removeEntity(_0x29a9d5,_0x43ef67){return function(_0x524b5c){if(_0x524b5c){return _0x524b5c[_0xa83a('0x21')]()[_0xa83a('0x20')](function(){_0x29a9d5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x7df257,_0x45f821){return function(_0x1e709b){if(!_0x1e709b){_0x7df257[_0xa83a('0x14')](0x194);}return _0x1e709b;};}function handleError(_0x382d2d,_0x173c24){_0x173c24=_0x173c24||0x1f4;return function(_0x55214f){logger[_0xa83a('0x22')](_0x55214f[_0xa83a('0x23')]);if(_0x55214f[_0xa83a('0x24')]){delete _0x55214f[_0xa83a('0x24')];}_0x382d2d['status'](_0x173c24)[_0xa83a('0x25')](_0x55214f);};}exports['index']=function(_0x4fcac9,_0x440169){var _0x286d80={},_0x482b88={},_0x211a2e={'count':0x0,'rows':[]};var _0x29e9a4=_[_0xa83a('0x26')](db[_0xa83a('0x27')][_0xa83a('0x28')],function(_0x33ca3c){return{'name':_0x33ca3c['fieldName'],'type':_0x33ca3c['type']['key']};});_0x482b88[_0xa83a('0x29')]=_[_0xa83a('0x26')](_0x29e9a4,'name');_0x482b88[_0xa83a('0x2a')]=_[_0xa83a('0x2b')](_0x4fcac9[_0xa83a('0x2a')]);_0x482b88[_0xa83a('0x2c')]=_[_0xa83a('0x2d')](_0x482b88[_0xa83a('0x29')],_0x482b88['query']);_0x286d80[_0xa83a('0x2e')]=_[_0xa83a('0x2d')](_0x482b88[_0xa83a('0x29')],qs[_0xa83a('0x2f')](_0x4fcac9[_0xa83a('0x2a')][_0xa83a('0x2f')]));_0x286d80['attributes']=_0x286d80['attributes']['length']?_0x286d80['attributes']:_0x482b88[_0xa83a('0x29')];if(!_0x4fcac9['query'][_0xa83a('0x30')](_0xa83a('0x31'))){_0x286d80['limit']=qs[_0xa83a('0x19')](_0x4fcac9[_0xa83a('0x2a')][_0xa83a('0x19')]);_0x286d80['offset']=qs['offset'](_0x4fcac9['query'][_0xa83a('0x18')]);}_0x286d80[_0xa83a('0x32')]=qs[_0xa83a('0x33')](_0x4fcac9[_0xa83a('0x2a')][_0xa83a('0x33')]);_0x286d80[_0xa83a('0x34')]=qs['filters'](_['pick'](_0x4fcac9[_0xa83a('0x2a')],_0x482b88[_0xa83a('0x2c')]),_0x29e9a4);if(_0x4fcac9[_0xa83a('0x2a')]['filter']){_0x286d80[_0xa83a('0x34')]=_['merge'](_0x286d80[_0xa83a('0x34')],{'$or':_[_0xa83a('0x26')](_0x29e9a4,function(_0x1e2c34){if(_0x1e2c34[_0xa83a('0x35')]!==_0xa83a('0x36')){var _0x353ce6={};_0x353ce6[_0x1e2c34[_0xa83a('0x24')]]={'$like':'%'+_0x4fcac9[_0xa83a('0x2a')]['filter']+'%'};return _0x353ce6;}})});}_0x286d80=_[_0xa83a('0x37')]({},_0x286d80,_0x4fcac9[_0xa83a('0x38')]);var _0x33ca31={'where':_0x286d80[_0xa83a('0x34')]};return db[_0xa83a('0x27')][_0xa83a('0x39')](_0x33ca31)['then'](function(_0x4d2f41){_0x211a2e['count']=_0x4d2f41;if(_0x4fcac9['query']['includeAll']){_0x286d80[_0xa83a('0x3a')]=[{'all':!![]}];}return db['VtigerField'][_0xa83a('0x3b')](_0x286d80);})[_0xa83a('0x20')](function(_0x268ee9){_0x211a2e['rows']=_0x268ee9;return _0x211a2e;})[_0xa83a('0x20')](respondWithFilteredResult(_0x440169,_0x286d80))['catch'](handleError(_0x440169,null));};exports[_0xa83a('0x3c')]=function(_0x5e6aaf,_0x2dcdf7){var _0x1e95ee={'raw':!![],'where':{'id':_0x5e6aaf[_0xa83a('0x3d')]['id']}},_0x217632={};_0x217632[_0xa83a('0x29')]=_[_0xa83a('0x2b')](db[_0xa83a('0x27')][_0xa83a('0x28')]);_0x217632['query']=_['keys'](_0x5e6aaf[_0xa83a('0x2a')]);_0x217632[_0xa83a('0x2c')]=_[_0xa83a('0x2d')](_0x217632[_0xa83a('0x29')],_0x217632['query']);_0x1e95ee['attributes']=_[_0xa83a('0x2d')](_0x217632[_0xa83a('0x29')],qs['fields'](_0x5e6aaf[_0xa83a('0x2a')][_0xa83a('0x2f')]));_0x1e95ee[_0xa83a('0x2e')]=_0x1e95ee[_0xa83a('0x2e')][_0xa83a('0x3e')]?_0x1e95ee['attributes']:_0x217632[_0xa83a('0x29')];if(_0x5e6aaf[_0xa83a('0x2a')]['includeAll']){_0x1e95ee['include']=[{'all':!![]}];}_0x1e95ee=_[_0xa83a('0x37')]({},_0x1e95ee,_0x5e6aaf['options']);return db[_0xa83a('0x27')][_0xa83a('0x3f')](_0x1e95ee)[_0xa83a('0x20')](handleEntityNotFound(_0x2dcdf7,null))[_0xa83a('0x20')](respondWithResult(_0x2dcdf7,null))[_0xa83a('0x40')](handleError(_0x2dcdf7,null));};exports['create']=function(_0x1c3383,_0x1036f7){return db[_0xa83a('0x27')][_0xa83a('0x41')](_0x1c3383['body'],{})[_0xa83a('0x20')](respondWithResult(_0x1036f7,0xc9))['catch'](handleError(_0x1036f7,null));};exports[_0xa83a('0x1f')]=function(_0x238663,_0x1b621e){if(_0x238663[_0xa83a('0x42')]['id']){delete _0x238663[_0xa83a('0x42')]['id'];}return db[_0xa83a('0x27')][_0xa83a('0x3f')]({'where':{'id':_0x238663[_0xa83a('0x3d')]['id']}})[_0xa83a('0x20')](handleEntityNotFound(_0x1b621e,null))['then'](saveUpdates(_0x238663[_0xa83a('0x42')],null))[_0xa83a('0x20')](respondWithResult(_0x1b621e,null))[_0xa83a('0x40')](handleError(_0x1b621e,null));};exports[_0xa83a('0x21')]=function(_0x5dd44c,_0x2434d6){return db[_0xa83a('0x27')][_0xa83a('0x3f')]({'where':{'id':_0x5dd44c[_0xa83a('0x3d')]['id']}})[_0xa83a('0x20')](handleEntityNotFound(_0x2434d6,null))['then'](removeEntity(_0x2434d6,null))[_0xa83a('0x40')](handleError(_0x2434d6,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index ea20c91..724d134 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 _0xf4eb=['int_vtiger_fields','FieldId','lodash','bluebird','rimraf','../../config/environment','./intVtigerField.attributes','exports','define'];(function(_0x1f2941,_0x3544ce){var _0x31e313=function(_0x4717f9){while(--_0x4717f9){_0x1f2941['push'](_0x1f2941['shift']());}};_0x31e313(++_0x3544ce);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1cc3e6,_0x44af01){_0x1cc3e6=_0x1cc3e6-0x0;var _0x290f73=_0xf4eb[_0x1cc3e6];return _0x290f73;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbf4e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var attributes=require(_0xbf4e('0x4'));module[_0xbf4e('0x5')]=function(_0xa4dcf5,_0x2fcfed){return _0xa4dcf5[_0xbf4e('0x6')]('VtigerField',attributes,{'tableName':_0xbf4e('0x7'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField',_0xbf4e('0x8')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbdb7=['define','vtiger_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intVtigerField.attributes'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x594ece,_0x2a1f27){_0x594ece=_0x594ece-0x0;var _0x471bc4=_0xbdb7[_0x594ece];return _0x471bc4;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var moment=require(_0x7bdb('0x4'));var BPromise=require(_0x7bdb('0x5'));var rp=require(_0x7bdb('0x6'));var fs=require('fs');var path=require(_0x7bdb('0x7'));var rimraf=require(_0x7bdb('0x8'));var config=require('../../config/environment');var attributes=require(_0x7bdb('0x9'));module['exports']=function(_0x4b5fff,_0xffdc86){return _0x4b5fff[_0x7bdb('0xa')]('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7bdb('0xb'),'fields':[_0x7bdb('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 29b3af1..8a73b66 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 _0xcf37=['info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then'];(function(_0x5e84ed,_0x3c1dcf){var _0x4373c0=function(_0x38394b){while(--_0x38394b){_0x5e84ed['push'](_0x5e84ed['shift']());}};_0x4373c0(++_0x3c1dcf);}(_0xcf37,0xdc));var _0x7cf3=function(_0x1819ca,_0x4583b9){_0x1819ca=_0x1819ca-0x0;var _0x243146=_0xcf37[_0x1819ca];return _0x243146;};'use strict';var _=require('lodash');var util=require(_0x7cf3('0x0'));var moment=require(_0x7cf3('0x1'));var BPromise=require(_0x7cf3('0x2'));var rs=require(_0x7cf3('0x3'));var fs=require('fs');var Redis=require(_0x7cf3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7cf3('0x5'));var logger=require(_0x7cf3('0x6'))(_0x7cf3('0x7'));var config=require(_0x7cf3('0x8'));var jayson=require(_0x7cf3('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4fd617,_0x5be340,_0x78b9a4){return new BPromise(function(_0x53502d,_0x110c99){return client['request'](_0x4fd617,_0x78b9a4)[_0x7cf3('0xa')](function(_0x377577){logger[_0x7cf3('0xb')](_0x7cf3('0xc'),_0x5be340,_0x7cf3('0xd'));logger[_0x7cf3('0xe')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x5be340,_0x7cf3('0xd'),JSON[_0x7cf3('0xf')](_0x377577));if(_0x377577[_0x7cf3('0x10')]){if(_0x377577[_0x7cf3('0x10')][_0x7cf3('0x11')]===0x1f4){logger['error'](_0x7cf3('0xc'),_0x5be340,_0x377577['error'][_0x7cf3('0x12')]);return _0x110c99(_0x377577['error'][_0x7cf3('0x12')]);}logger[_0x7cf3('0x10')]('VtigerField,\x20%s,\x20%s',_0x5be340,_0x377577[_0x7cf3('0x10')][_0x7cf3('0x12')]);return _0x53502d(_0x377577[_0x7cf3('0x10')][_0x7cf3('0x12')]);}else{logger['info'](_0x7cf3('0xc'),_0x5be340,'request\x20sent');_0x53502d(_0x377577[_0x7cf3('0x13')][_0x7cf3('0x12')]);}})[_0x7cf3('0x14')](function(_0x14aef6){logger[_0x7cf3('0x10')](_0x7cf3('0xc'),_0x5be340,_0x14aef6);_0x110c99(_0x14aef6);});});} \ No newline at end of file +var _0x866a=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird'];(function(_0x41f4b1,_0x130052){var _0x148151=function(_0x1ce2c2){while(--_0x1ce2c2){_0x41f4b1['push'](_0x41f4b1['shift']());}};_0x148151(++_0x130052);}(_0x866a,0x156));var _0xa866=function(_0x4e9861,_0x25fe5f){_0x4e9861=_0x4e9861-0x0;var _0x49802f=_0x866a[_0x4e9861];return _0x49802f;};'use strict';var _=require('lodash');var util=require(_0xa866('0x0'));var moment=require(_0xa866('0x1'));var BPromise=require(_0xa866('0x2'));var rs=require(_0xa866('0x3'));var fs=require('fs');var Redis=require(_0xa866('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa866('0x5'));var logger=require(_0xa866('0x6'))(_0xa866('0x7'));var config=require('../../config/environment');var jayson=require(_0xa866('0x8'));var client=jayson[_0xa866('0x9')][_0xa866('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x288582,_0x3d1380,_0x2c7278){return new BPromise(function(_0x41a92a,_0x208625){return client[_0xa866('0xb')](_0x288582,_0x2c7278)[_0xa866('0xc')](function(_0x525ce6){logger[_0xa866('0xd')](_0xa866('0xe'),_0x3d1380,_0xa866('0xf'));logger['debug'](_0xa866('0x10'),_0x3d1380,_0xa866('0xf'),JSON[_0xa866('0x11')](_0x525ce6));if(_0x525ce6[_0xa866('0x12')]){if(_0x525ce6[_0xa866('0x12')][_0xa866('0x13')]===0x1f4){logger['error'](_0xa866('0xe'),_0x3d1380,_0x525ce6[_0xa866('0x12')][_0xa866('0x14')]);return _0x208625(_0x525ce6[_0xa866('0x12')]['message']);}logger[_0xa866('0x12')]('VtigerField,\x20%s,\x20%s',_0x3d1380,_0x525ce6[_0xa866('0x12')]['message']);return _0x41a92a(_0x525ce6[_0xa866('0x12')][_0xa866('0x14')]);}else{logger[_0xa866('0xd')]('VtigerField,\x20%s,\x20%s',_0x3d1380,_0xa866('0xf'));_0x41a92a(_0x525ce6[_0xa866('0x15')][_0xa866('0x14')]);}})[_0xa866('0x16')](function(_0x1e2211){logger[_0xa866('0x12')](_0xa866('0xe'),_0x3d1380,_0x1e2211);_0x208625(_0x1e2211);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index dcb57d2..4e2c87d 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 _0xc0aa=['delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','get','index','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','create','post','update'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc0aa,0xb7));var _0xac0a=function(_0x3db235,_0x491f63){_0x3db235=_0x3db235-0x0;var _0x1ba9b7=_0xc0aa[_0x3db235];return _0x1ba9b7;};'use strict';var multer=require(_0xac0a('0x0'));var util=require(_0xac0a('0x1'));var path=require('path');var timeout=require(_0xac0a('0x2'));var express=require(_0xac0a('0x3'));var router=express['Router']();var auth=require(_0xac0a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router[_0xac0a('0x5')]('/',auth['isAuthenticated'](),controller[_0xac0a('0x6')]);router[_0xac0a('0x5')](_0xac0a('0x7'),auth['isAuthenticated'](),controller[_0xac0a('0x8')]);router['get'](_0xac0a('0x9'),auth[_0xac0a('0xa')](),controller[_0xac0a('0xb')]);router[_0xac0a('0x5')](_0xac0a('0xc'),auth[_0xac0a('0xa')](),controller[_0xac0a('0xd')]);router['post']('/',auth[_0xac0a('0xa')](),controller[_0xac0a('0xe')]);router[_0xac0a('0xf')](_0xac0a('0x9'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0xac0a('0x7'),auth[_0xac0a('0xa')](),controller[_0xac0a('0x10')]);router[_0xac0a('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xac0a('0x12')]);module[_0xac0a('0x13')]=router; \ No newline at end of file +var _0xb535=['express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xb535,0xe4));var _0x5b53=function(_0x4b26b5,_0x4f71fd){_0x4b26b5=_0x4b26b5-0x0;var _0x4dec71=_0xb535[_0x4b26b5];return _0x4dec71;};'use strict';var multer=require(_0x5b53('0x0'));var util=require(_0x5b53('0x1'));var path=require(_0x5b53('0x2'));var timeout=require('connect-timeout');var express=require(_0x5b53('0x3'));var router=express['Router']();var auth=require(_0x5b53('0x4'));var interaction=require(_0x5b53('0x5'));var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router[_0x5b53('0x6')]('/',auth[_0x5b53('0x7')](),controller[_0x5b53('0x8')]);router[_0x5b53('0x6')](_0x5b53('0x9'),auth[_0x5b53('0x7')](),controller[_0x5b53('0xa')]);router[_0x5b53('0x6')](_0x5b53('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x5b53('0x6')](_0x5b53('0xc'),auth[_0x5b53('0x7')](),controller[_0x5b53('0xd')]);router[_0x5b53('0xe')]('/',auth[_0x5b53('0x7')](),controller[_0x5b53('0xf')]);router[_0x5b53('0xe')](_0x5b53('0xb'),auth['isAuthenticated'](),controller[_0x5b53('0x10')]);router[_0x5b53('0x11')](_0x5b53('0x9'),auth[_0x5b53('0x7')](),controller[_0x5b53('0x12')]);router['delete'](_0x5b53('0x9'),auth[_0x5b53('0x7')](),controller[_0x5b53('0x13')]);module[_0x5b53('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 3ba15ef..aced870 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 _0x784b=['STRING','username','remoteUri','ENUM','password','token','integrationTab','sequelize','exports'];(function(_0x18b12c,_0xbb34){var _0x282179=function(_0x19d142){while(--_0x19d142){_0x18b12c['push'](_0x18b12c['shift']());}};_0x282179(++_0xbb34);}(_0x784b,0x115));var _0xb784=function(_0x4dde15,_0x46622e){_0x4dde15=_0x4dde15-0x0;var _0x327123=_0x784b[_0x4dde15];return _0x327123;};'use strict';var Sequelize=require(_0xb784('0x0'));module[_0xb784('0x1')]={'name':{'type':Sequelize[_0xb784('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb784('0x2')],'unique':_0xb784('0x3')},'password':{'type':Sequelize[_0xb784('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xb784('0x2')],'unique':_0xb784('0x4')},'authType':{'type':Sequelize[_0xb784('0x5')](_0xb784('0x6'),_0xb784('0x7')),'defaultValue':_0xb784('0x6')},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb784('0x5')]('integrationTab','newTab'),'defaultValue':_0xb784('0x8')}}; \ No newline at end of file +var _0xd0ab=['ENUM','password','integrationTab','newTab','sequelize','STRING','username','remoteUri'];(function(_0x2dc2b9,_0x826036){var _0x57e2c9=function(_0x5909bc){while(--_0x5909bc){_0x2dc2b9['push'](_0x2dc2b9['shift']());}};_0x57e2c9(++_0x826036);}(_0xd0ab,0xbc));var _0xbd0a=function(_0xbe7b84,_0x343836){_0xbe7b84=_0xbe7b84-0x0;var _0x49e10b=_0xd0ab[_0xbe7b84];return _0x49e10b;};'use strict';var Sequelize=require(_0xbd0a('0x0'));module['exports']={'name':{'type':Sequelize[_0xbd0a('0x1')]},'description':{'type':Sequelize[_0xbd0a('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xbd0a('0x2')},'password':{'type':Sequelize[_0xbd0a('0x1')]},'token':{'type':Sequelize[_0xbd0a('0x1')]},'remoteUri':{'type':Sequelize[_0xbd0a('0x1')],'unique':_0xbd0a('0x3')},'authType':{'type':Sequelize[_0xbd0a('0x4')](_0xbd0a('0x5'),'token'),'defaultValue':_0xbd0a('0x5')},'serverUrl':{'type':Sequelize[_0xbd0a('0x1')]},'type':{'type':Sequelize['ENUM'](_0xbd0a('0x6'),_0xbd0a('0x7')),'defaultValue':_0xbd0a('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index c6d96c6..6260eb9 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 _0xeec9=['ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','save','update','destroy','name','index','map','ZendeskAccount','rawAttributes','type','key','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','filters','merge','where','VIRTUAL','options','includeAll','findAll','show','params','fields','include','find','create','body','getConfigurations','findOne','pick','filter','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','password','token','authType','remoteUri','slice','substring','GET','format','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','Sequelize','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5aaf05,_0x2aad50){var _0x56c733=function(_0xa6ad97){while(--_0xa6ad97){_0x5aaf05['push'](_0x5aaf05['shift']());}};_0x56c733(++_0x2aad50);}(_0xeec9,0x15a));var _0x9eec=function(_0x494dff,_0x614ab9){_0x494dff=_0x494dff-0x0;var _0x55c944=_0xeec9[_0x494dff];return _0x55c944;};'use strict';var pdf=require(_0x9eec('0x0'));var emlformat=require(_0x9eec('0x1'));var rimraf=require(_0x9eec('0x2'));var zipdir=require(_0x9eec('0x3'));var jsonpatch=require(_0x9eec('0x4'));var rp=require(_0x9eec('0x5'));var moment=require(_0x9eec('0x6'));var BPromise=require(_0x9eec('0x7'));var Mustache=require('mustache');var util=require(_0x9eec('0x8'));var path=require(_0x9eec('0x9'));var sox=require(_0x9eec('0xa'));var csv=require(_0x9eec('0xb'));var ejs=require(_0x9eec('0xc'));var fs=require('fs');var _=require(_0x9eec('0xd'));var squel=require(_0x9eec('0xe'));var crypto=require(_0x9eec('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x9eec('0x10'));var toCsv=require(_0x9eec('0xb'));var querystring=require(_0x9eec('0x11'));var Papa=require('papaparse');var Redis=require(_0x9eec('0x12'));var authService=require(_0x9eec('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9eec('0x14'));var logger=require('../../config/logger')(_0x9eec('0x15'));var utils=require(_0x9eec('0x16'));var config=require('../../config/environment');var db=require(_0x9eec('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x9eec('0x18'));var client=jayson[_0x9eec('0x19')][_0x9eec('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x31cfaf,_0x157dd6,_0x1f111c){if(_0x1f111c){var _0x2b0f46=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2b0f46[_0x9eec('0x1b')](_0x157dd6)){return _0x31cfaf;}else{throw new db['Sequelize'][(_0x9eec('0x1c'))](_0x9eec('0x1d'));}}else{return _0x31cfaf;}}function respondWithRpcPromise(_0x2713c2,_0x21fba7,_0x54b9fc,_0x1ce84f){return new BPromise(function(_0x43dfe4,_0x2fd22b){var _0x14c1c9=_0x1ce84f||client;return _0x14c1c9[_0x9eec('0x1e')](_0x2713c2,_0x54b9fc)[_0x9eec('0x1f')](function(_0xa18945){logger['info'](_0x9eec('0x20'),_0x21fba7,_0x9eec('0x21'));logger[_0x9eec('0x22')](_0x9eec('0x23'),_0x21fba7,_0x9eec('0x21'),JSON[_0x9eec('0x24')](_0xa18945));if(_0xa18945['error']){if(_0xa18945[_0x9eec('0x25')][_0x9eec('0x26')]===0x1f4){logger[_0x9eec('0x25')]('ZendeskAccount,\x20%s,\x20%s',_0x21fba7,_0xa18945[_0x9eec('0x25')][_0x9eec('0x27')]);return _0x2fd22b(_0xa18945[_0x9eec('0x25')][_0x9eec('0x27')]);}logger[_0x9eec('0x25')](_0x9eec('0x20'),_0x21fba7,_0xa18945['error'][_0x9eec('0x27')]);return _0x43dfe4(_0xa18945['error'][_0x9eec('0x27')]);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x21fba7,_0x9eec('0x21'));_0x43dfe4(_0xa18945[_0x9eec('0x28')][_0x9eec('0x27')]);}})[_0x9eec('0x29')](function(_0x154a76){logger[_0x9eec('0x25')](_0x9eec('0x20'),_0x21fba7,_0x154a76);_0x2fd22b(_0x154a76);});});}function respondWithStatusCode(_0x3aacac,_0xda695d){_0xda695d=_0xda695d||0xcc;return function(_0x2f994c){if(_0x2f994c){return _0x3aacac[_0x9eec('0x2a')](_0xda695d);}return _0x3aacac['status'](_0xda695d)[_0x9eec('0x2b')]();};}function respondWithResult(_0x22a7c7,_0x547553){_0x547553=_0x547553||0xc8;return function(_0x4856cb){if(_0x4856cb){return _0x22a7c7[_0x9eec('0x2c')](_0x547553)[_0x9eec('0x2d')](_0x4856cb);}};}function respondWithFilteredResult(_0x532f25,_0x560c7a){return function(_0x2e86c9){if(_0x2e86c9){var _0x197fca=_0x2e86c9[_0x9eec('0x2e')],_0x13e7b7=_0x560c7a['offset'],_0x4624d0=_0x560c7a[_0x9eec('0x2f')]+_0x560c7a[_0x9eec('0x30')],_0x430d55;if(_0x4624d0>=_0x197fca){_0x4624d0=_0x197fca;_0x430d55=0xc8;}else{_0x430d55=0xce;}_0x532f25[_0x9eec('0x2c')](_0x430d55);return _0x532f25[_0x9eec('0x31')](_0x9eec('0x32'),_0x13e7b7+'-'+_0x4624d0+'/'+_0x197fca)[_0x9eec('0x2d')](_0x2e86c9);}return null;};}function patchUpdates(_0x146306){return function(_0x1a548d){try{jsonpatch['apply'](_0x1a548d,_0x146306,!![]);}catch(_0x1a1cf9){return BPromise['reject'](_0x1a1cf9);}return _0x1a548d[_0x9eec('0x33')]();};}function saveUpdates(_0x411344,_0x37ec0b){return function(_0x39b653){if(_0x39b653){return _0x39b653[_0x9eec('0x34')](_0x411344)[_0x9eec('0x1f')](function(_0x4eb85a){return _0x4eb85a;});}return null;};}function removeEntity(_0x1692fb,_0x2b29d7){return function(_0x284cce){if(_0x284cce){return _0x284cce[_0x9eec('0x35')]()[_0x9eec('0x1f')](function(){_0x1692fb[_0x9eec('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x582cae,_0x4412a6){return function(_0x5a541a){if(!_0x5a541a){_0x582cae[_0x9eec('0x2a')](0x194);}return _0x5a541a;};}function handleError(_0x279aa3,_0x462753){_0x462753=_0x462753||0x1f4;return function(_0x4302e9){logger[_0x9eec('0x25')](_0x4302e9['stack']);if(_0x4302e9[_0x9eec('0x36')]){delete _0x4302e9[_0x9eec('0x36')];}_0x279aa3[_0x9eec('0x2c')](_0x462753)['send'](_0x4302e9);};}exports[_0x9eec('0x37')]=function(_0x29c40c,_0x22357e){var _0x10265d={},_0x1ce04a={},_0x28d89a={'count':0x0,'rows':[]};var _0x213ee7=_[_0x9eec('0x38')](db[_0x9eec('0x39')][_0x9eec('0x3a')],function(_0x182f01){return{'name':_0x182f01['fieldName'],'type':_0x182f01[_0x9eec('0x3b')][_0x9eec('0x3c')]};});_0x1ce04a['model']=_[_0x9eec('0x38')](_0x213ee7,_0x9eec('0x36'));_0x1ce04a[_0x9eec('0x3d')]=_[_0x9eec('0x3e')](_0x29c40c[_0x9eec('0x3d')]);_0x1ce04a['filters']=_[_0x9eec('0x3f')](_0x1ce04a[_0x9eec('0x40')],_0x1ce04a[_0x9eec('0x3d')]);_0x10265d[_0x9eec('0x41')]=_[_0x9eec('0x3f')](_0x1ce04a[_0x9eec('0x40')],qs['fields'](_0x29c40c[_0x9eec('0x3d')]['fields']));_0x10265d[_0x9eec('0x41')]=_0x10265d[_0x9eec('0x41')][_0x9eec('0x42')]?_0x10265d[_0x9eec('0x41')]:_0x1ce04a['model'];if(!_0x29c40c[_0x9eec('0x3d')][_0x9eec('0x43')](_0x9eec('0x44'))){_0x10265d[_0x9eec('0x30')]=qs[_0x9eec('0x30')](_0x29c40c[_0x9eec('0x3d')][_0x9eec('0x30')]);_0x10265d[_0x9eec('0x2f')]=qs[_0x9eec('0x2f')](_0x29c40c['query'][_0x9eec('0x2f')]);}_0x10265d[_0x9eec('0x45')]=qs[_0x9eec('0x46')](_0x29c40c[_0x9eec('0x3d')]['sort']);_0x10265d['where']=qs['filters'](_['pick'](_0x29c40c[_0x9eec('0x3d')],_0x1ce04a[_0x9eec('0x47')]),_0x213ee7);if(_0x29c40c[_0x9eec('0x3d')]['filter']){_0x10265d['where']=_[_0x9eec('0x48')](_0x10265d[_0x9eec('0x49')],{'$or':_[_0x9eec('0x38')](_0x213ee7,function(_0x585561){if(_0x585561[_0x9eec('0x3b')]!==_0x9eec('0x4a')){var _0xc1a7dc={};_0xc1a7dc[_0x585561[_0x9eec('0x36')]]={'$like':'%'+_0x29c40c[_0x9eec('0x3d')]['filter']+'%'};return _0xc1a7dc;}})});}_0x10265d=_['merge']({},_0x10265d,_0x29c40c[_0x9eec('0x4b')]);var _0x212991={'where':_0x10265d['where']};return db[_0x9eec('0x39')]['count'](_0x212991)[_0x9eec('0x1f')](function(_0x2d424a){_0x28d89a[_0x9eec('0x2e')]=_0x2d424a;if(_0x29c40c[_0x9eec('0x3d')][_0x9eec('0x4c')]){_0x10265d['include']=[{'all':!![]}];}return db[_0x9eec('0x39')][_0x9eec('0x4d')](_0x10265d);})[_0x9eec('0x1f')](function(_0x210479){_0x28d89a['rows']=_0x210479;return _0x28d89a;})[_0x9eec('0x1f')](respondWithFilteredResult(_0x22357e,_0x10265d))['catch'](handleError(_0x22357e,null));};exports[_0x9eec('0x4e')]=function(_0x349af4,_0x145981){var _0x456129={'raw':![],'where':{'id':_0x349af4[_0x9eec('0x4f')]['id']}},_0x3ac384={};_0x3ac384[_0x9eec('0x40')]=_[_0x9eec('0x3e')](db['ZendeskAccount'][_0x9eec('0x3a')]);_0x3ac384[_0x9eec('0x3d')]=_[_0x9eec('0x3e')](_0x349af4[_0x9eec('0x3d')]);_0x3ac384['filters']=_[_0x9eec('0x3f')](_0x3ac384[_0x9eec('0x40')],_0x3ac384[_0x9eec('0x3d')]);_0x456129[_0x9eec('0x41')]=_[_0x9eec('0x3f')](_0x3ac384[_0x9eec('0x40')],qs[_0x9eec('0x50')](_0x349af4[_0x9eec('0x3d')][_0x9eec('0x50')]));_0x456129[_0x9eec('0x41')]=_0x456129[_0x9eec('0x41')]['length']?_0x456129[_0x9eec('0x41')]:_0x3ac384[_0x9eec('0x40')];if(_0x349af4[_0x9eec('0x3d')][_0x9eec('0x4c')]){_0x456129[_0x9eec('0x51')]=[{'all':!![]}];}_0x456129=_['merge']({},_0x456129,_0x349af4[_0x9eec('0x4b')]);return db[_0x9eec('0x39')][_0x9eec('0x52')](_0x456129)[_0x9eec('0x1f')](handleEntityNotFound(_0x145981,null))['then'](respondWithResult(_0x145981,null))[_0x9eec('0x29')](handleError(_0x145981,null));};exports[_0x9eec('0x53')]=function(_0x2bad43,_0x15c32d){return db[_0x9eec('0x39')][_0x9eec('0x53')](_0x2bad43[_0x9eec('0x54')],{})[_0x9eec('0x1f')](respondWithResult(_0x15c32d,0xc9))['catch'](handleError(_0x15c32d,null));};exports['update']=function(_0x17ce1e,_0x2f8a45){if(_0x17ce1e[_0x9eec('0x54')]['id']){delete _0x17ce1e['body']['id'];}return db[_0x9eec('0x39')][_0x9eec('0x52')]({'where':{'id':_0x17ce1e[_0x9eec('0x4f')]['id']}})[_0x9eec('0x1f')](handleEntityNotFound(_0x2f8a45,null))[_0x9eec('0x1f')](saveUpdates(_0x17ce1e[_0x9eec('0x54')],null))[_0x9eec('0x1f')](respondWithResult(_0x2f8a45,null))[_0x9eec('0x29')](handleError(_0x2f8a45,null));};exports[_0x9eec('0x35')]=function(_0x1ed2c8,_0x5b2f7f){return db[_0x9eec('0x39')][_0x9eec('0x52')]({'where':{'id':_0x1ed2c8[_0x9eec('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5b2f7f,null))[_0x9eec('0x1f')](removeEntity(_0x5b2f7f,null))[_0x9eec('0x29')](handleError(_0x5b2f7f,null));};exports[_0x9eec('0x55')]=function(_0x191789,_0x176073,_0x385f8b){var _0x52861f={};var _0x4b50e8={};var _0x3fb915;var _0x5a6b7b;return db['ZendeskAccount'][_0x9eec('0x56')]({'where':{'id':_0x191789['params']['id']}})[_0x9eec('0x1f')](handleEntityNotFound(_0x176073,null))[_0x9eec('0x1f')](function(_0x2de261){if(_0x2de261){_0x3fb915=_0x2de261;_0x4b50e8[_0x9eec('0x40')]=_[_0x9eec('0x3e')](db['ZendeskConfiguration'][_0x9eec('0x3a')]);_0x4b50e8[_0x9eec('0x3d')]=_['keys'](_0x191789['query']);_0x4b50e8[_0x9eec('0x47')]=_[_0x9eec('0x3f')](_0x4b50e8[_0x9eec('0x40')],_0x4b50e8['query']);_0x52861f['attributes']=_[_0x9eec('0x3f')](_0x4b50e8[_0x9eec('0x40')],qs[_0x9eec('0x50')](_0x191789['query'][_0x9eec('0x50')]));_0x52861f[_0x9eec('0x41')]=_0x52861f[_0x9eec('0x41')][_0x9eec('0x42')]?_0x52861f[_0x9eec('0x41')]:_0x4b50e8[_0x9eec('0x40')];_0x52861f[_0x9eec('0x45')]=qs['sort'](_0x191789[_0x9eec('0x3d')][_0x9eec('0x46')]);_0x52861f['where']=qs['filters'](_[_0x9eec('0x57')](_0x191789[_0x9eec('0x3d')],_0x4b50e8[_0x9eec('0x47')]));if(_0x191789[_0x9eec('0x3d')][_0x9eec('0x58')]){_0x52861f[_0x9eec('0x49')]=_[_0x9eec('0x48')](_0x52861f[_0x9eec('0x49')],{'$or':_['map'](_0x52861f[_0x9eec('0x41')],function(_0x26206c){var _0x510ca6={};_0x510ca6[_0x26206c]={'$like':'%'+_0x191789[_0x9eec('0x3d')]['filter']+'%'};return _0x510ca6;})});}_0x52861f=_[_0x9eec('0x48')]({},_0x52861f,_0x191789[_0x9eec('0x4b')]);return _0x3fb915['getConfigurations'](_0x52861f);}})[_0x9eec('0x1f')](function(_0xf42b35){if(_0xf42b35){_0x5a6b7b=_0xf42b35['length'];if(!_0x191789[_0x9eec('0x3d')]['hasOwnProperty'](_0x9eec('0x44'))){_0x52861f['limit']=qs[_0x9eec('0x30')](_0x191789['query'][_0x9eec('0x30')]);_0x52861f[_0x9eec('0x2f')]=qs[_0x9eec('0x2f')](_0x191789[_0x9eec('0x3d')][_0x9eec('0x2f')]);}return _0x3fb915[_0x9eec('0x55')](_0x52861f);}})[_0x9eec('0x1f')](function(_0x4bee45){if(_0x4bee45){return _0x4bee45?{'count':_0x5a6b7b,'rows':_0x4bee45}:null;}})[_0x9eec('0x1f')](respondWithResult(_0x176073,null))['catch'](handleError(_0x176073,null));};exports[_0x9eec('0x59')]=function(_0x428cf0,_0x282b1d,_0x2a245f){if(_0x428cf0[_0x9eec('0x54')]['id']){delete _0x428cf0[_0x9eec('0x54')]['id'];}return db['ZendeskAccount'][_0x9eec('0x56')]({'where':{'id':_0x428cf0[_0x9eec('0x4f')]['id']}})[_0x9eec('0x1f')](handleEntityNotFound(_0x282b1d,null))[_0x9eec('0x1f')](function(_0x343948){if(_0x343948){_0x428cf0[_0x9eec('0x54')][_0x9eec('0x5a')]=_0x343948['id'];_0x428cf0[_0x9eec('0x54')][_0x9eec('0x5b')]=integrations['getSubjects'](_0x428cf0[_0x9eec('0x54')][_0x9eec('0x5c')],_0x428cf0[_0x9eec('0x54')][_0x9eec('0x3b')]);_0x428cf0[_0x9eec('0x54')][_0x9eec('0x5d')]=integrations[_0x9eec('0x5e')](_0x428cf0[_0x9eec('0x54')][_0x9eec('0x5c')],_0x428cf0[_0x9eec('0x54')]['type']);return db['ZendeskConfiguration']['create'](_0x428cf0['body'],{'include':[{'model':db[_0x9eec('0x5f')],'as':_0x9eec('0x5b')},{'model':db[_0x9eec('0x5f')],'as':_0x9eec('0x5d')}]});}return null;})[_0x9eec('0x1f')](respondWithResult(_0x282b1d,null))['catch'](handleError(_0x282b1d,null));};exports[_0x9eec('0x60')]=function(_0x5ad004,_0xd49e94,_0x19830a){var _0x8d76c2='';return db[_0x9eec('0x39')][_0x9eec('0x56')]({'where':{'id':_0x5ad004[_0x9eec('0x4f')]['id']},'attributes':['id','username',_0x9eec('0x61'),_0x9eec('0x62'),_0x9eec('0x63'),'remoteUri']})[_0x9eec('0x1f')](handleEntityNotFound(_0xd49e94,null))[_0x9eec('0x1f')](function(_0x190b1c){if(_0x190b1c){_0x8d76c2=_0x190b1c[_0x9eec('0x64')];var _0x571670=_0x8d76c2[_0x9eec('0x65')](-0x1);if(_0x571670==='/'){_0x8d76c2=_0x8d76c2[_0x9eec('0x66')](0x0,_0x8d76c2['lastIndexOf'](_0x571670));}var _0x57a298={'method':_0x9eec('0x67'),'uri':util[_0x9eec('0x68')]('%s/%s',_0x8d76c2,_0x9eec('0x69')),'json':!![]};switch(_0x190b1c['authType']){case _0x9eec('0x61'):_0x57a298[_0x9eec('0x6a')]={'Authorization':util[_0x9eec('0x68')](_0x9eec('0x6b'),new Buffer(util['format'](_0x9eec('0x6c'),_0x190b1c['username'],_0x190b1c[_0x9eec('0x61')]))[_0x9eec('0x6d')](_0x9eec('0x6e')))};break;case _0x9eec('0x62'):_0x57a298['headers']={'Authorization':util[_0x9eec('0x68')](_0x9eec('0x6b'),new Buffer(util[_0x9eec('0x68')](_0x9eec('0x6f'),_0x190b1c['username'],_0x190b1c[_0x9eec('0x62')]))['toString'](_0x9eec('0x6e')))};break;default:throw new db[(_0x9eec('0x70'))][(_0x9eec('0x1c'))](_0x9eec('0x71'));}return rp(_0x57a298);}})[_0x9eec('0x1f')](function(_0x2e51f7){if(_0x2e51f7){var _0x10985e=[_0x9eec('0x72'),_0x9eec('0x73'),_0x9eec('0x74'),_0x9eec('0x75')];_[_0x9eec('0x76')](_0x2e51f7[_0x9eec('0x69')],function(_0x5a58c5){return _0x10985e['includes'](_0x5a58c5[_0x9eec('0x3b')]);});return{'count':_0x2e51f7[_0x9eec('0x69')]['length'],'rows':_[_0x9eec('0x38')](_0x2e51f7[_0x9eec('0x69')],function(_0x4e83b3){return{'id':_0x4e83b3['id'],'name':_0x4e83b3[_0x9eec('0x77')]>0x7?_0x4e83b3[_0x9eec('0x78')]:_0x4e83b3[_0x9eec('0x3b')],'custom':_0x4e83b3[_0x9eec('0x77')]>0x7?!![]:![],'options':_0x4e83b3[_0x9eec('0x79')]?_0x4e83b3['system_field_options']:_0x4e83b3['custom_field_options']?_0x4e83b3[_0x9eec('0x7a')]:[]};})};}})['then'](respondWithResult(_0xd49e94,null))[_0x9eec('0x29')](function(_0xc2ccc2){var _0x3160d0=_0x5ad004['query'][_0x9eec('0x1b')]?0x1f4:_0xc2ccc2[_0x9eec('0x7b')]||0x1f4;logger[_0x9eec('0x25')](_0x9eec('0x7c'),_0x9eec('0x60'),_0x3160d0,JSON[_0x9eec('0x24')](_0xc2ccc2));delete _0xc2ccc2[_0x9eec('0x36')];if(_0x3160d0===0x191){_0x3160d0=0x190;}_0xd49e94[_0x9eec('0x2c')](_0x3160d0)[_0x9eec('0x7d')](_0x5ad004[_0x9eec('0x3d')][_0x9eec('0x1b')]?{'message':_0x9eec('0x7e'),'statusCode':_0xc2ccc2['statusCode']}:_0xc2ccc2);});}; \ No newline at end of file +var _0x8989=['end','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','create','body','find','ZendeskConfiguration','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskField','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','username','subject','group','assignee','remove','position','system_field_options','custom_field_options','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','save','update','destroy'];(function(_0x4c9f6a,_0xcb2cb2){var _0x5df5b9=function(_0x303cf2){while(--_0x303cf2){_0x4c9f6a['push'](_0x4c9f6a['shift']());}};_0x5df5b9(++_0xcb2cb2);}(_0x8989,0x14a));var _0x9898=function(_0x49c5d4,_0x26aba8){_0x49c5d4=_0x49c5d4-0x0;var _0x22143=_0x8989[_0x49c5d4];return _0x22143;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9898('0x0'));var zipdir=require(_0x9898('0x1'));var jsonpatch=require(_0x9898('0x2'));var rp=require(_0x9898('0x3'));var moment=require(_0x9898('0x4'));var BPromise=require(_0x9898('0x5'));var Mustache=require(_0x9898('0x6'));var util=require(_0x9898('0x7'));var path=require(_0x9898('0x8'));var sox=require(_0x9898('0x9'));var csv=require(_0x9898('0xa'));var ejs=require(_0x9898('0xb'));var fs=require('fs');var _=require(_0x9898('0xc'));var squel=require('squel');var crypto=require(_0x9898('0xd'));var jsforce=require(_0x9898('0xe'));var deskjs=require(_0x9898('0xf'));var toCsv=require(_0x9898('0xa'));var querystring=require('querystring');var Papa=require(_0x9898('0x10'));var Redis=require(_0x9898('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9898('0x12'));var as=require(_0x9898('0x13'));var hardwareService=require(_0x9898('0x14'));var logger=require(_0x9898('0x15'))(_0x9898('0x16'));var utils=require(_0x9898('0x17'));var config=require(_0x9898('0x18'));var db=require(_0x9898('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x9898('0x1a'));var client=jayson['client'][_0x9898('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x10672a,_0x22397a,_0x2bd34f){if(_0x2bd34f){var _0x448343=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x448343[_0x9898('0x1c')](_0x22397a)){return _0x10672a;}else{throw new db[(_0x9898('0x1d'))][(_0x9898('0x1e'))](_0x9898('0x1f'));}}else{return _0x10672a;}}function respondWithRpcPromise(_0x2d4ad8,_0x527945,_0x11e8a0,_0x510cc4){return new BPromise(function(_0x393981,_0x37fde){var _0x55d639=_0x510cc4||client;return _0x55d639[_0x9898('0x20')](_0x2d4ad8,_0x11e8a0)[_0x9898('0x21')](function(_0x3810dd){logger[_0x9898('0x22')](_0x9898('0x23'),_0x527945,'request\x20sent');logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x527945,_0x9898('0x24'),JSON[_0x9898('0x25')](_0x3810dd));if(_0x3810dd[_0x9898('0x26')]){if(_0x3810dd['error']['code']===0x1f4){logger[_0x9898('0x26')](_0x9898('0x23'),_0x527945,_0x3810dd[_0x9898('0x26')][_0x9898('0x27')]);return _0x37fde(_0x3810dd['error'][_0x9898('0x27')]);}logger[_0x9898('0x26')](_0x9898('0x23'),_0x527945,_0x3810dd[_0x9898('0x26')][_0x9898('0x27')]);return _0x393981(_0x3810dd[_0x9898('0x26')][_0x9898('0x27')]);}else{logger[_0x9898('0x22')](_0x9898('0x23'),_0x527945,_0x9898('0x24'));_0x393981(_0x3810dd[_0x9898('0x28')][_0x9898('0x27')]);}})[_0x9898('0x29')](function(_0x1a65be){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x527945,_0x1a65be);_0x37fde(_0x1a65be);});});}function respondWithStatusCode(_0x293078,_0x12e342){_0x12e342=_0x12e342||0xcc;return function(_0x24dae4){if(_0x24dae4){return _0x293078[_0x9898('0x2a')](_0x12e342);}return _0x293078[_0x9898('0x2b')](_0x12e342)['end']();};}function respondWithResult(_0x12dec2,_0x44e023){_0x44e023=_0x44e023||0xc8;return function(_0x343e01){if(_0x343e01){return _0x12dec2[_0x9898('0x2b')](_0x44e023)['json'](_0x343e01);}};}function respondWithFilteredResult(_0x1e2cbc,_0x4ea769){return function(_0x3fac3c){if(_0x3fac3c){var _0x496573=_0x3fac3c[_0x9898('0x2c')],_0x207439=_0x4ea769['offset'],_0x4485c1=_0x4ea769[_0x9898('0x2d')]+_0x4ea769[_0x9898('0x2e')],_0x5003e9;if(_0x4485c1>=_0x496573){_0x4485c1=_0x496573;_0x5003e9=0xc8;}else{_0x5003e9=0xce;}_0x1e2cbc['status'](_0x5003e9);return _0x1e2cbc[_0x9898('0x2f')](_0x9898('0x30'),_0x207439+'-'+_0x4485c1+'/'+_0x496573)[_0x9898('0x31')](_0x3fac3c);}return null;};}function patchUpdates(_0x104432){return function(_0x28ecbc){try{jsonpatch[_0x9898('0x32')](_0x28ecbc,_0x104432,!![]);}catch(_0x22aa93){return BPromise['reject'](_0x22aa93);}return _0x28ecbc[_0x9898('0x33')]();};}function saveUpdates(_0x2a9d4d,_0x41c0ab){return function(_0x5f1c70){if(_0x5f1c70){return _0x5f1c70[_0x9898('0x34')](_0x2a9d4d)[_0x9898('0x21')](function(_0x35f5d0){return _0x35f5d0;});}return null;};}function removeEntity(_0x1314df,_0x107e86){return function(_0x154e50){if(_0x154e50){return _0x154e50[_0x9898('0x35')]()['then'](function(){_0x1314df[_0x9898('0x2b')](0xcc)[_0x9898('0x36')]();});}};}function handleEntityNotFound(_0x59b3f3,_0x5d9f4d){return function(_0x2bcc3b){if(!_0x2bcc3b){_0x59b3f3[_0x9898('0x2a')](0x194);}return _0x2bcc3b;};}function handleError(_0x35bb92,_0x157e0a){_0x157e0a=_0x157e0a||0x1f4;return function(_0x1aba30){logger[_0x9898('0x26')](_0x1aba30[_0x9898('0x37')]);if(_0x1aba30[_0x9898('0x38')]){delete _0x1aba30[_0x9898('0x38')];}_0x35bb92[_0x9898('0x2b')](_0x157e0a)[_0x9898('0x39')](_0x1aba30);};}exports[_0x9898('0x3a')]=function(_0x4ee734,_0x3a7e6a){var _0x331101={},_0x5b6fa8={},_0x2e66ac={'count':0x0,'rows':[]};var _0x461d8e=_['map'](db[_0x9898('0x3b')][_0x9898('0x3c')],function(_0x29ed12){return{'name':_0x29ed12[_0x9898('0x3d')],'type':_0x29ed12[_0x9898('0x3e')][_0x9898('0x3f')]};});_0x5b6fa8[_0x9898('0x40')]=_[_0x9898('0x41')](_0x461d8e,_0x9898('0x38'));_0x5b6fa8['query']=_['keys'](_0x4ee734[_0x9898('0x42')]);_0x5b6fa8[_0x9898('0x43')]=_[_0x9898('0x44')](_0x5b6fa8[_0x9898('0x40')],_0x5b6fa8[_0x9898('0x42')]);_0x331101[_0x9898('0x45')]=_['intersection'](_0x5b6fa8['model'],qs[_0x9898('0x46')](_0x4ee734[_0x9898('0x42')][_0x9898('0x46')]));_0x331101[_0x9898('0x45')]=_0x331101[_0x9898('0x45')][_0x9898('0x47')]?_0x331101[_0x9898('0x45')]:_0x5b6fa8[_0x9898('0x40')];if(!_0x4ee734[_0x9898('0x42')]['hasOwnProperty'](_0x9898('0x48'))){_0x331101[_0x9898('0x2e')]=qs[_0x9898('0x2e')](_0x4ee734[_0x9898('0x42')]['limit']);_0x331101[_0x9898('0x2d')]=qs[_0x9898('0x2d')](_0x4ee734['query'][_0x9898('0x2d')]);}_0x331101[_0x9898('0x49')]=qs[_0x9898('0x4a')](_0x4ee734[_0x9898('0x42')]['sort']);_0x331101[_0x9898('0x4b')]=qs[_0x9898('0x43')](_[_0x9898('0x4c')](_0x4ee734['query'],_0x5b6fa8[_0x9898('0x43')]),_0x461d8e);if(_0x4ee734['query'][_0x9898('0x4d')]){_0x331101[_0x9898('0x4b')]=_[_0x9898('0x4e')](_0x331101[_0x9898('0x4b')],{'$or':_[_0x9898('0x41')](_0x461d8e,function(_0xb2107c){if(_0xb2107c['type']!==_0x9898('0x4f')){var _0x38c78f={};_0x38c78f[_0xb2107c[_0x9898('0x38')]]={'$like':'%'+_0x4ee734['query']['filter']+'%'};return _0x38c78f;}})});}_0x331101=_['merge']({},_0x331101,_0x4ee734[_0x9898('0x50')]);var _0x479351={'where':_0x331101[_0x9898('0x4b')]};return db[_0x9898('0x3b')][_0x9898('0x2c')](_0x479351)[_0x9898('0x21')](function(_0x212165){_0x2e66ac[_0x9898('0x2c')]=_0x212165;if(_0x4ee734[_0x9898('0x42')][_0x9898('0x51')]){_0x331101[_0x9898('0x52')]=[{'all':!![]}];}return db[_0x9898('0x3b')][_0x9898('0x53')](_0x331101);})[_0x9898('0x21')](function(_0x434821){_0x2e66ac[_0x9898('0x54')]=_0x434821;return _0x2e66ac;})['then'](respondWithFilteredResult(_0x3a7e6a,_0x331101))[_0x9898('0x29')](handleError(_0x3a7e6a,null));};exports['show']=function(_0x5c0a83,_0x39e7ec){var _0x6b53a8={'raw':![],'where':{'id':_0x5c0a83[_0x9898('0x55')]['id']}},_0x14cf3b={};_0x14cf3b[_0x9898('0x40')]=_[_0x9898('0x56')](db[_0x9898('0x3b')][_0x9898('0x3c')]);_0x14cf3b[_0x9898('0x42')]=_['keys'](_0x5c0a83['query']);_0x14cf3b[_0x9898('0x43')]=_[_0x9898('0x44')](_0x14cf3b['model'],_0x14cf3b[_0x9898('0x42')]);_0x6b53a8['attributes']=_[_0x9898('0x44')](_0x14cf3b[_0x9898('0x40')],qs['fields'](_0x5c0a83[_0x9898('0x42')]['fields']));_0x6b53a8[_0x9898('0x45')]=_0x6b53a8[_0x9898('0x45')]['length']?_0x6b53a8[_0x9898('0x45')]:_0x14cf3b[_0x9898('0x40')];if(_0x5c0a83['query'][_0x9898('0x51')]){_0x6b53a8[_0x9898('0x52')]=[{'all':!![]}];}_0x6b53a8=_['merge']({},_0x6b53a8,_0x5c0a83['options']);return db[_0x9898('0x3b')]['find'](_0x6b53a8)[_0x9898('0x21')](handleEntityNotFound(_0x39e7ec,null))[_0x9898('0x21')](respondWithResult(_0x39e7ec,null))[_0x9898('0x29')](handleError(_0x39e7ec,null));};exports[_0x9898('0x57')]=function(_0x4a3ce8,_0x4e310f){return db[_0x9898('0x3b')][_0x9898('0x57')](_0x4a3ce8[_0x9898('0x58')],{})[_0x9898('0x21')](respondWithResult(_0x4e310f,0xc9))[_0x9898('0x29')](handleError(_0x4e310f,null));};exports[_0x9898('0x34')]=function(_0x35ed7e,_0x29a78d){if(_0x35ed7e[_0x9898('0x58')]['id']){delete _0x35ed7e['body']['id'];}return db[_0x9898('0x3b')][_0x9898('0x59')]({'where':{'id':_0x35ed7e[_0x9898('0x55')]['id']}})[_0x9898('0x21')](handleEntityNotFound(_0x29a78d,null))[_0x9898('0x21')](saveUpdates(_0x35ed7e[_0x9898('0x58')],null))['then'](respondWithResult(_0x29a78d,null))[_0x9898('0x29')](handleError(_0x29a78d,null));};exports[_0x9898('0x35')]=function(_0x4bae46,_0x10b0a6){return db['ZendeskAccount']['find']({'where':{'id':_0x4bae46['params']['id']}})['then'](handleEntityNotFound(_0x10b0a6,null))[_0x9898('0x21')](removeEntity(_0x10b0a6,null))[_0x9898('0x29')](handleError(_0x10b0a6,null));};exports['getConfigurations']=function(_0x163474,_0x5a34ed,_0x368f06){var _0x2d4289={};var _0x1c2ef5={};var _0x43a6d1;var _0x6e155d;return db[_0x9898('0x3b')]['findOne']({'where':{'id':_0x163474[_0x9898('0x55')]['id']}})[_0x9898('0x21')](handleEntityNotFound(_0x5a34ed,null))[_0x9898('0x21')](function(_0x5c5fb3){if(_0x5c5fb3){_0x43a6d1=_0x5c5fb3;_0x1c2ef5[_0x9898('0x40')]=_[_0x9898('0x56')](db[_0x9898('0x5a')]['rawAttributes']);_0x1c2ef5[_0x9898('0x42')]=_[_0x9898('0x56')](_0x163474[_0x9898('0x42')]);_0x1c2ef5[_0x9898('0x43')]=_[_0x9898('0x44')](_0x1c2ef5[_0x9898('0x40')],_0x1c2ef5['query']);_0x2d4289[_0x9898('0x45')]=_['intersection'](_0x1c2ef5['model'],qs[_0x9898('0x46')](_0x163474['query']['fields']));_0x2d4289['attributes']=_0x2d4289[_0x9898('0x45')]['length']?_0x2d4289['attributes']:_0x1c2ef5[_0x9898('0x40')];_0x2d4289[_0x9898('0x49')]=qs[_0x9898('0x4a')](_0x163474['query'][_0x9898('0x4a')]);_0x2d4289[_0x9898('0x4b')]=qs[_0x9898('0x43')](_[_0x9898('0x4c')](_0x163474[_0x9898('0x42')],_0x1c2ef5['filters']));if(_0x163474[_0x9898('0x42')][_0x9898('0x4d')]){_0x2d4289[_0x9898('0x4b')]=_[_0x9898('0x4e')](_0x2d4289['where'],{'$or':_['map'](_0x2d4289[_0x9898('0x45')],function(_0x332324){var _0x4be203={};_0x4be203[_0x332324]={'$like':'%'+_0x163474['query'][_0x9898('0x4d')]+'%'};return _0x4be203;})});}_0x2d4289=_[_0x9898('0x4e')]({},_0x2d4289,_0x163474[_0x9898('0x50')]);return _0x43a6d1[_0x9898('0x5b')](_0x2d4289);}})['then'](function(_0x1d2c78){if(_0x1d2c78){_0x6e155d=_0x1d2c78[_0x9898('0x47')];if(!_0x163474[_0x9898('0x42')]['hasOwnProperty'](_0x9898('0x48'))){_0x2d4289['limit']=qs[_0x9898('0x2e')](_0x163474['query']['limit']);_0x2d4289['offset']=qs[_0x9898('0x2d')](_0x163474['query'][_0x9898('0x2d')]);}return _0x43a6d1[_0x9898('0x5b')](_0x2d4289);}})[_0x9898('0x21')](function(_0x4f9cc0){if(_0x4f9cc0){return _0x4f9cc0?{'count':_0x6e155d,'rows':_0x4f9cc0}:null;}})['then'](respondWithResult(_0x5a34ed,null))['catch'](handleError(_0x5a34ed,null));};exports[_0x9898('0x5c')]=function(_0x53f5c4,_0x420cbc,_0x1b979e){if(_0x53f5c4[_0x9898('0x58')]['id']){delete _0x53f5c4['body']['id'];}return db['ZendeskAccount'][_0x9898('0x5d')]({'where':{'id':_0x53f5c4['params']['id']}})[_0x9898('0x21')](handleEntityNotFound(_0x420cbc,null))[_0x9898('0x21')](function(_0x37a960){if(_0x37a960){_0x53f5c4[_0x9898('0x58')][_0x9898('0x5e')]=_0x37a960['id'];_0x53f5c4['body'][_0x9898('0x5f')]=integrations[_0x9898('0x60')](_0x53f5c4[_0x9898('0x58')]['channel'],_0x53f5c4[_0x9898('0x58')]['type']);_0x53f5c4[_0x9898('0x58')][_0x9898('0x61')]=integrations[_0x9898('0x62')](_0x53f5c4[_0x9898('0x58')][_0x9898('0x63')],_0x53f5c4[_0x9898('0x58')][_0x9898('0x3e')]);return db[_0x9898('0x5a')][_0x9898('0x57')](_0x53f5c4[_0x9898('0x58')],{'include':[{'model':db[_0x9898('0x64')],'as':_0x9898('0x5f')},{'model':db[_0x9898('0x64')],'as':_0x9898('0x61')}]});}return null;})['then'](respondWithResult(_0x420cbc,null))[_0x9898('0x29')](handleError(_0x420cbc,null));};exports['getFields']=function(_0x589380,_0x17b807,_0x595073){var _0xab2c51='';return db['ZendeskAccount'][_0x9898('0x5d')]({'where':{'id':_0x589380[_0x9898('0x55')]['id']},'attributes':['id','username',_0x9898('0x65'),_0x9898('0x66'),_0x9898('0x67'),_0x9898('0x68')]})[_0x9898('0x21')](handleEntityNotFound(_0x17b807,null))[_0x9898('0x21')](function(_0x5890d6){if(_0x5890d6){_0xab2c51=_0x5890d6[_0x9898('0x68')];var _0x57df18=_0xab2c51[_0x9898('0x69')](-0x1);if(_0x57df18==='/'){_0xab2c51=_0xab2c51['substring'](0x0,_0xab2c51[_0x9898('0x6a')](_0x57df18));}var _0x3e010d={'method':_0x9898('0x6b'),'uri':util[_0x9898('0x6c')](_0x9898('0x6d'),_0xab2c51,_0x9898('0x6e')),'json':!![]};switch(_0x5890d6[_0x9898('0x67')]){case _0x9898('0x65'):_0x3e010d[_0x9898('0x6f')]={'Authorization':util['format'](_0x9898('0x70'),new Buffer(util[_0x9898('0x6c')](_0x9898('0x71'),_0x5890d6['username'],_0x5890d6[_0x9898('0x65')]))[_0x9898('0x72')](_0x9898('0x73')))};break;case _0x9898('0x66'):_0x3e010d['headers']={'Authorization':util['format'](_0x9898('0x70'),new Buffer(util[_0x9898('0x6c')]('%s/token:%s',_0x5890d6[_0x9898('0x74')],_0x5890d6[_0x9898('0x66')]))[_0x9898('0x72')]('base64'))};break;default:throw new db[(_0x9898('0x1d'))][(_0x9898('0x1e'))]('Unknown\x20authentication\x20type');}return rp(_0x3e010d);}})[_0x9898('0x21')](function(_0x341048){if(_0x341048){var _0x4ed1a0=[_0x9898('0x75'),'description',_0x9898('0x76'),_0x9898('0x77')];_[_0x9898('0x78')](_0x341048[_0x9898('0x6e')],function(_0x144a3b){return _0x4ed1a0['includes'](_0x144a3b['type']);});return{'count':_0x341048[_0x9898('0x6e')][_0x9898('0x47')],'rows':_[_0x9898('0x41')](_0x341048[_0x9898('0x6e')],function(_0x2bcc5a){return{'id':_0x2bcc5a['id'],'name':_0x2bcc5a[_0x9898('0x79')]>0x7?_0x2bcc5a['title']:_0x2bcc5a[_0x9898('0x3e')],'custom':_0x2bcc5a[_0x9898('0x79')]>0x7?!![]:![],'options':_0x2bcc5a[_0x9898('0x7a')]?_0x2bcc5a[_0x9898('0x7a')]:_0x2bcc5a[_0x9898('0x7b')]?_0x2bcc5a[_0x9898('0x7b')]:[]};})};}})[_0x9898('0x21')](respondWithResult(_0x17b807,null))[_0x9898('0x29')](function(_0x1cfcd6){var _0xdd01ec=_0x589380['query'][_0x9898('0x1c')]?0x1f4:_0x1cfcd6['statusCode']||0x1f4;logger[_0x9898('0x26')](_0x9898('0x7c'),_0x9898('0x7d'),_0xdd01ec,JSON[_0x9898('0x25')](_0x1cfcd6));delete _0x1cfcd6[_0x9898('0x38')];if(_0xdd01ec===0x191){_0xdd01ec=0x190;}_0x17b807[_0x9898('0x2b')](_0xdd01ec)[_0x9898('0x39')](_0x589380['query'][_0x9898('0x1c')]?{'message':_0x9898('0x7e'),'statusCode':_0x1cfcd6[_0x9898('0x7f')]}:_0x1cfcd6);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index c89fbff..d2a7772 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 _0xf348=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','util'];(function(_0x4d69a6,_0x44cbe8){var _0x56739a=function(_0x50cc2c){while(--_0x50cc2c){_0x4d69a6['push'](_0x4d69a6['shift']());}};_0x56739a(++_0x44cbe8);}(_0xf348,0x12a));var _0x8f34=function(_0xb64337,_0x11aa71){_0xb64337=_0xb64337-0x0;var _0x2eb9e5=_0xf348[_0xb64337];return _0x2eb9e5;};'use strict';var _=require('lodash');var util=require(_0x8f34('0x0'));var logger=require(_0x8f34('0x1'))('api');var moment=require(_0x8f34('0x2'));var BPromise=require(_0x8f34('0x3'));var rp=require(_0x8f34('0x4'));var fs=require('fs');var path=require(_0x8f34('0x5'));var rimraf=require(_0x8f34('0x6'));var config=require('../../config/environment');var attributes=require(_0x8f34('0x7'));var integrations=require(_0x8f34('0x8'));module[_0x8f34('0x9')]=function(_0x20d3a1,_0x4cf015){return _0x20d3a1[_0x8f34('0xa')](_0x8f34('0xb'),attributes,{'tableName':_0x8f34('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x643d=['path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','int_zendesk_accounts','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x643d,0x1d1));var _0xd643=function(_0x2e0a21,_0x13efcd){_0x2e0a21=_0x2e0a21-0x0;var _0x1edd81=_0x643d[_0x2e0a21];return _0x1edd81;};'use strict';var _=require(_0xd643('0x0'));var util=require('util');var logger=require(_0xd643('0x1'))(_0xd643('0x2'));var moment=require('moment');var BPromise=require(_0xd643('0x3'));var rp=require(_0xd643('0x4'));var fs=require('fs');var path=require(_0xd643('0x5'));var rimraf=require('rimraf');var config=require(_0xd643('0x6'));var attributes=require(_0xd643('0x7'));var integrations=require(_0xd643('0x8'));module['exports']=function(_0x62141f,_0x4c81d8){return _0x62141f['define']('ZendeskAccount',attributes,{'tableName':_0xd643('0x9'),'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 c4d681b..ec269e0 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 _0xb7e7=['request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','find','where','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http'];(function(_0x24fa7a,_0x2ae623){var _0x316e25=function(_0x407be4){while(--_0x407be4){_0x24fa7a['push'](_0x24fa7a['shift']());}};_0x316e25(++_0x2ae623);}(_0xb7e7,0x121));var _0x7b7e=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0xb7e7[_0x342700];return _0x53406f;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});}exports[_0x7b7e('0x14')]=function(_0x242368){var _0x200ef7=this;return new Promise(function(_0x2acb8c,_0x429a0e){return db[_0x7b7e('0x15')][_0x7b7e('0x16')]({'raw':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')]['where']||null:null,'attributes':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x19')]||null:null,'limit':_0x242368['options']?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1a')]||null:null,'include':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x53bbb3){return{'model':db[_0x53bbb3['model']],'as':_0x53bbb3['as'],'attributes':_0x53bbb3['attributes'],'include':_0x53bbb3[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x53bbb3[_0x7b7e('0x1b')],function(_0x483c6f){return{'model':db[_0x483c6f['model']],'as':_0x483c6f['as'],'attributes':_0x483c6f['attributes'],'include':_0x483c6f[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x483c6f[_0x7b7e('0x1b')],function(_0x7aa71){return{'model':db[_0x7aa71[_0x7b7e('0x1d')]],'as':_0x7aa71['as'],'attributes':_0x7aa71['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x21a15){logger['info']('GetZendeskAccount',_0x242368);logger['debug'](_0x7b7e('0x14'),_0x242368,JSON[_0x7b7e('0xf')](_0x21a15));_0x2acb8c(_0x21a15);})['catch'](function(_0x3db8c4){logger['error'](_0x7b7e('0x14'),_0x3db8c4[_0x7b7e('0x12')],_0x242368);_0x429a0e(_0x200ef7[_0x7b7e('0x10')](0x1f4,_0x3db8c4['message']));});});};exports[_0x7b7e('0x1e')]=function(_0xe31336){var _0x35602a=this;return new Promise(function(_0x326dd2,_0x33f9a1){return db['ZendeskAccount'][_0x7b7e('0x1f')]({'raw':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x20')]||null:null,'attributes':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')]['attributes']||null:null,'include':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_['map'](_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x2ca366){return{'model':db[_0x2ca366['model']],'as':_0x2ca366['as'],'attributes':_0x2ca366[_0x7b7e('0x19')],'include':_0x2ca366[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x2ca366[_0x7b7e('0x1b')],function(_0x31043a){return{'model':db[_0x31043a[_0x7b7e('0x1d')]],'as':_0x31043a['as'],'attributes':_0x31043a[_0x7b7e('0x19')],'include':_0x31043a[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x31043a[_0x7b7e('0x1b')],function(_0xd5a64d){return{'model':db[_0xd5a64d[_0x7b7e('0x1d')]],'as':_0xd5a64d['as'],'attributes':_0xd5a64d[_0x7b7e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x116563){logger[_0x7b7e('0xa')]('ShowZendeskAccount',_0xe31336);logger[_0x7b7e('0xc')](_0x7b7e('0x1e'),_0xe31336,JSON[_0x7b7e('0xf')](_0x116563));_0x326dd2(_0x116563);})[_0x7b7e('0x13')](function(_0x36abfc){logger[_0x7b7e('0x10')](_0x7b7e('0x1e'),_0x36abfc[_0x7b7e('0x12')],_0xe31336);_0x33f9a1(_0x35602a[_0x7b7e('0x10')](0x1f4,_0x36abfc[_0x7b7e('0x12')]));});});}; \ No newline at end of file +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(_0xb077da,_0x1022ec){var _0x487965=function(_0x360f6e){while(--_0x360f6e){_0xb077da['push'](_0xb077da['shift']());}};_0x487965(++_0x1022ec);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});}exports[_0x3071('0x18')]=function(_0x17dbda){var _0x1068d9=this;return new Promise(function(_0x108a83,_0x3acf0e){return db[_0x3071('0x19')][_0x3071('0x1a')]({'raw':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')]['where']||null:null,'attributes':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1d')]||null:null,'limit':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1e')]||null:null,'include':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x17dbda['options']['include'],function(_0x2ce48a){return{'model':db[_0x2ce48a[_0x3071('0x21')]],'as':_0x2ce48a['as'],'attributes':_0x2ce48a[_0x3071('0x1d')],'include':_0x2ce48a[_0x3071('0x1f')]?_[_0x3071('0x20')](_0x2ce48a[_0x3071('0x1f')],function(_0x7a4cb4){return{'model':db[_0x7a4cb4[_0x3071('0x21')]],'as':_0x7a4cb4['as'],'attributes':_0x7a4cb4[_0x3071('0x1d')],'include':_0x7a4cb4['include']?_[_0x3071('0x20')](_0x7a4cb4[_0x3071('0x1f')],function(_0x177138){return{'model':db[_0x177138['model']],'as':_0x177138['as'],'attributes':_0x177138[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x163604){logger[_0x3071('0xd')](_0x3071('0x18'),_0x17dbda);logger[_0x3071('0x10')](_0x3071('0x18'),_0x17dbda,JSON[_0x3071('0x12')](_0x163604));_0x108a83(_0x163604);})[_0x3071('0x17')](function(_0x292205){logger[_0x3071('0x13')]('GetZendeskAccount',_0x292205['message'],_0x17dbda);_0x3acf0e(_0x1068d9[_0x3071('0x13')](0x1f4,_0x292205[_0x3071('0x15')]));});});};exports[_0x3071('0x22')]=function(_0x40be95){var _0x3f6d90=this;return new Promise(function(_0x29538c,_0x32b6b1){return db[_0x3071('0x19')]['find']({'raw':_0x40be95['options']?_0x40be95['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x40be95[_0x3071('0x1b')]?_0x40be95['options'][_0x3071('0x23')]||null:null,'attributes':_0x40be95[_0x3071('0x1b')]?_0x40be95[_0x3071('0x1b')][_0x3071('0x1d')]||null:null,'include':_0x40be95['options']?_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')],function(_0x2068ce){return{'model':db[_0x2068ce[_0x3071('0x21')]],'as':_0x2068ce['as'],'attributes':_0x2068ce[_0x3071('0x1d')],'include':_0x2068ce['include']?_[_0x3071('0x20')](_0x2068ce['include'],function(_0x4fb1ec){return{'model':db[_0x4fb1ec[_0x3071('0x21')]],'as':_0x4fb1ec['as'],'attributes':_0x4fb1ec[_0x3071('0x1d')],'include':_0x4fb1ec['include']?_[_0x3071('0x20')](_0x4fb1ec[_0x3071('0x1f')],function(_0x265d76){return{'model':db[_0x265d76[_0x3071('0x21')]],'as':_0x265d76['as'],'attributes':_0x265d76[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x5610ab){logger[_0x3071('0xd')](_0x3071('0x22'),_0x40be95);logger['debug'](_0x3071('0x22'),_0x40be95,JSON['stringify'](_0x5610ab));_0x29538c(_0x5610ab);})[_0x3071('0x17')](function(_0x43133a){logger['error']('ShowZendeskAccount',_0x43133a[_0x3071('0x15')],_0x40be95);_0x32b6b1(_0x3f6d90[_0x3071('0x13')](0x1f4,_0x43133a[_0x3071('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index efe136c..205754c 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 _0x5227=['delete','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','put','update'];(function(_0x57784b,_0x49a858){var _0x4505fa=function(_0x14f13c){while(--_0x14f13c){_0x57784b['push'](_0x57784b['shift']());}};_0x4505fa(++_0x49a858);}(_0x5227,0x188));var _0x7522=function(_0x5347f1,_0x1122ab){_0x5347f1=_0x5347f1-0x0;var _0x31216d=_0x5227[_0x5347f1];return _0x31216d;};'use strict';var multer=require(_0x7522('0x0'));var util=require(_0x7522('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7522('0x2'));var router=express['Router']();var auth=require(_0x7522('0x3'));var interaction=require(_0x7522('0x4'));var config=require(_0x7522('0x5'));var controller=require(_0x7522('0x6'));router[_0x7522('0x7')]('/',auth[_0x7522('0x8')](),controller['index']);router[_0x7522('0x7')](_0x7522('0x9'),auth[_0x7522('0x8')](),controller[_0x7522('0xa')]);router[_0x7522('0x7')](_0x7522('0xb'),auth[_0x7522('0x8')](),controller[_0x7522('0xc')]);router['get'](_0x7522('0xd'),auth[_0x7522('0x8')](),controller[_0x7522('0xe')]);router['get'](_0x7522('0xf'),auth[_0x7522('0x8')](),controller[_0x7522('0x10')]);router[_0x7522('0x7')](_0x7522('0x11'),auth[_0x7522('0x8')](),controller[_0x7522('0x12')]);router['post']('/',auth[_0x7522('0x8')](),controller[_0x7522('0x13')]);router[_0x7522('0x14')](_0x7522('0x11'),auth[_0x7522('0x8')](),controller[_0x7522('0x15')]);router[_0x7522('0x16')](_0x7522('0x9'),auth[_0x7522('0x8')](),controller[_0x7522('0x17')]);router[_0x7522('0x18')](_0x7522('0x9'),auth[_0x7522('0x8')](),controller['destroy']);module[_0x7522('0x19')]=router; \ No newline at end of file +var _0x9e35=['../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','destroy','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x411bbc,_0x44eea7){var _0x164e02=function(_0x11be9f){while(--_0x11be9f){_0x411bbc['push'](_0x411bbc['shift']());}};_0x164e02(++_0x44eea7);}(_0x9e35,0x9c));var _0x59e3=function(_0x48871b,_0x20cd97){_0x48871b=_0x48871b-0x0;var _0x45a073=_0x9e35[_0x48871b];return _0x45a073;};'use strict';var multer=require('multer');var util=require(_0x59e3('0x0'));var path=require(_0x59e3('0x1'));var timeout=require(_0x59e3('0x2'));var express=require(_0x59e3('0x3'));var router=express[_0x59e3('0x4')]();var auth=require(_0x59e3('0x5'));var interaction=require(_0x59e3('0x6'));var config=require(_0x59e3('0x7'));var controller=require(_0x59e3('0x8'));router['get']('/',auth[_0x59e3('0x9')](),controller[_0x59e3('0xa')]);router[_0x59e3('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x59e3('0xc')]);router[_0x59e3('0xb')](_0x59e3('0xd'),auth[_0x59e3('0x9')](),controller[_0x59e3('0xe')]);router[_0x59e3('0xb')](_0x59e3('0xf'),auth['isAuthenticated'](),controller[_0x59e3('0x10')]);router[_0x59e3('0xb')](_0x59e3('0x11'),auth['isAuthenticated'](),controller[_0x59e3('0x12')]);router[_0x59e3('0xb')](_0x59e3('0x13'),auth[_0x59e3('0x9')](),controller[_0x59e3('0x14')]);router[_0x59e3('0x15')]('/',auth[_0x59e3('0x9')](),controller[_0x59e3('0x16')]);router[_0x59e3('0x15')](_0x59e3('0x13'),auth[_0x59e3('0x9')](),controller[_0x59e3('0x17')]);router[_0x59e3('0x18')](_0x59e3('0x19'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x59e3('0x19'),auth[_0x59e3('0x9')](),controller[_0x59e3('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index eaf9918..4144be8 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 _0x11f7=['STRING','sequelize'];(function(_0x1d6a81,_0x57813a){var _0x1ae8fa=function(_0x481a21){while(--_0x481a21){_0x1d6a81['push'](_0x1d6a81['shift']());}};_0x1ae8fa(++_0x57813a);}(_0x11f7,0x1c9));var _0x711f=function(_0x5d12a2,_0x1104e2){_0x5d12a2=_0x5d12a2-0x0;var _0x58aa1d=_0x11f7[_0x5d12a2];return _0x58aa1d;};'use strict';var Sequelize=require(_0x711f('0x0'));module['exports']={'name':{'type':Sequelize[_0x711f('0x1')]},'description':{'type':Sequelize[_0x711f('0x1')]}}; \ No newline at end of file +var _0x9c70=['STRING'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x9c70,0x197));var _0x09c7=function(_0x4584f1,_0x566d68){_0x4584f1=_0x4584f1-0x0;var _0x34fe53=_0x9c70[_0x4584f1];return _0x34fe53;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x09c7('0x0')]},'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 f222067..8ecd7e2 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 _0xe3d5=['../../mysqldb','jayson/promise','client','http','test','Sequelize','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','count','offset','limit','set','json','apply','reject','save','update','destroy','end','sendStatus','index','map','fieldName','type','key','name','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','ZendeskConfiguration','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','findOne','ZendeskField','pick','getFields','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x3bd143,_0x13f1ec){var _0x27ecbf=function(_0x312e16){while(--_0x312e16){_0x3bd143['push'](_0x3bd143['shift']());}};_0x27ecbf(++_0x13f1ec);}(_0xe3d5,0x1de));var _0x5e3d=function(_0x297c55,_0x34fa75){_0x297c55=_0x297c55-0x0;var _0x120389=_0xe3d5[_0x297c55];return _0x120389;};'use strict';var pdf=require(_0x5e3d('0x0'));var emlformat=require(_0x5e3d('0x1'));var rimraf=require(_0x5e3d('0x2'));var zipdir=require(_0x5e3d('0x3'));var jsonpatch=require(_0x5e3d('0x4'));var rp=require(_0x5e3d('0x5'));var moment=require(_0x5e3d('0x6'));var BPromise=require(_0x5e3d('0x7'));var Mustache=require(_0x5e3d('0x8'));var util=require(_0x5e3d('0x9'));var path=require(_0x5e3d('0xa'));var sox=require(_0x5e3d('0xb'));var csv=require(_0x5e3d('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5e3d('0xd'));var squel=require(_0x5e3d('0xe'));var crypto=require(_0x5e3d('0xf'));var jsforce=require(_0x5e3d('0x10'));var deskjs=require(_0x5e3d('0x11'));var toCsv=require(_0x5e3d('0xc'));var querystring=require(_0x5e3d('0x12'));var Papa=require(_0x5e3d('0x13'));var Redis=require(_0x5e3d('0x14'));var authService=require(_0x5e3d('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x5e3d('0x16'));var hardwareService=require(_0x5e3d('0x17'));var logger=require(_0x5e3d('0x18'))('api');var utils=require(_0x5e3d('0x19'));var config=require(_0x5e3d('0x1a'));var db=require(_0x5e3d('0x1b'))['db'];var jayson=require(_0x5e3d('0x1c'));var client=jayson[_0x5e3d('0x1d')][_0x5e3d('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x2b3a45,_0x1c577f,_0x8cc301){if(_0x8cc301){var _0x4c8a95=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4c8a95[_0x5e3d('0x1f')](_0x1c577f)){return _0x2b3a45;}else{throw new db[(_0x5e3d('0x20'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2b3a45;}}function respondWithRpcPromise(_0xcf056c,_0x541254,_0x8f3048,_0x4367a1){return new BPromise(function(_0x564286,_0x22542f){var _0x248336=_0x4367a1||client;return _0x248336[_0x5e3d('0x21')](_0xcf056c,_0x8f3048)[_0x5e3d('0x22')](function(_0x478fbd){logger[_0x5e3d('0x23')](_0x5e3d('0x24'),_0x541254,_0x5e3d('0x25'));logger[_0x5e3d('0x26')](_0x5e3d('0x27'),_0x541254,'request\x20sent',JSON[_0x5e3d('0x28')](_0x478fbd));if(_0x478fbd[_0x5e3d('0x29')]){if(_0x478fbd['error']['code']===0x1f4){logger['error'](_0x5e3d('0x24'),_0x541254,_0x478fbd['error'][_0x5e3d('0x2a')]);return _0x22542f(_0x478fbd[_0x5e3d('0x29')]['message']);}logger[_0x5e3d('0x29')](_0x5e3d('0x24'),_0x541254,_0x478fbd['error'][_0x5e3d('0x2a')]);return _0x564286(_0x478fbd[_0x5e3d('0x29')][_0x5e3d('0x2a')]);}else{logger[_0x5e3d('0x23')](_0x5e3d('0x24'),_0x541254,'request\x20sent');_0x564286(_0x478fbd[_0x5e3d('0x2b')][_0x5e3d('0x2a')]);}})[_0x5e3d('0x2c')](function(_0x5a014e){logger['error'](_0x5e3d('0x24'),_0x541254,_0x5a014e);_0x22542f(_0x5a014e);});});}function respondWithStatusCode(_0x46a091,_0x3924a7){_0x3924a7=_0x3924a7||0xcc;return function(_0x11f0a8){if(_0x11f0a8){return _0x46a091['sendStatus'](_0x3924a7);}return _0x46a091[_0x5e3d('0x2d')](_0x3924a7)['end']();};}function respondWithResult(_0x721092,_0x59b8dc){_0x59b8dc=_0x59b8dc||0xc8;return function(_0x137e31){if(_0x137e31){return _0x721092[_0x5e3d('0x2d')](_0x59b8dc)['json'](_0x137e31);}};}function respondWithFilteredResult(_0x491cf2,_0x45314f){return function(_0x35ad7b){if(_0x35ad7b){var _0x3942c8=_0x35ad7b[_0x5e3d('0x2e')],_0x1c39ef=_0x45314f[_0x5e3d('0x2f')],_0x3ab494=_0x45314f['offset']+_0x45314f[_0x5e3d('0x30')],_0x16ec21;if(_0x3ab494>=_0x3942c8){_0x3ab494=_0x3942c8;_0x16ec21=0xc8;}else{_0x16ec21=0xce;}_0x491cf2[_0x5e3d('0x2d')](_0x16ec21);return _0x491cf2[_0x5e3d('0x31')]('Content-Range',_0x1c39ef+'-'+_0x3ab494+'/'+_0x3942c8)[_0x5e3d('0x32')](_0x35ad7b);}return null;};}function patchUpdates(_0x42b741){return function(_0xcc6f0d){try{jsonpatch[_0x5e3d('0x33')](_0xcc6f0d,_0x42b741,!![]);}catch(_0x2b1cc6){return BPromise[_0x5e3d('0x34')](_0x2b1cc6);}return _0xcc6f0d[_0x5e3d('0x35')]();};}function saveUpdates(_0x9d6e8,_0x575ee9){return function(_0x50f9c4){if(_0x50f9c4){return _0x50f9c4[_0x5e3d('0x36')](_0x9d6e8)[_0x5e3d('0x22')](function(_0x2bbef0){return _0x2bbef0;});}return null;};}function removeEntity(_0x30213d,_0x41a01c){return function(_0x12a4aa){if(_0x12a4aa){return _0x12a4aa[_0x5e3d('0x37')]()[_0x5e3d('0x22')](function(){_0x30213d[_0x5e3d('0x2d')](0xcc)[_0x5e3d('0x38')]();});}};}function handleEntityNotFound(_0x8bbb7d,_0x390914){return function(_0x298565){if(!_0x298565){_0x8bbb7d[_0x5e3d('0x39')](0x194);}return _0x298565;};}function handleError(_0x7eeb50,_0x27f195){_0x27f195=_0x27f195||0x1f4;return function(_0x120ef3){logger[_0x5e3d('0x29')](_0x120ef3['stack']);if(_0x120ef3['name']){delete _0x120ef3['name'];}_0x7eeb50['status'](_0x27f195)['send'](_0x120ef3);};}exports[_0x5e3d('0x3a')]=function(_0x34a87a,_0x413b9f){var _0x237d84={},_0x33e214={},_0x6d1edc={'count':0x0,'rows':[]};var _0x383962=_[_0x5e3d('0x3b')](db['ZendeskConfiguration']['rawAttributes'],function(_0x467236){return{'name':_0x467236[_0x5e3d('0x3c')],'type':_0x467236[_0x5e3d('0x3d')][_0x5e3d('0x3e')]};});_0x33e214['model']=_['map'](_0x383962,_0x5e3d('0x3f'));_0x33e214['query']=_[_0x5e3d('0x40')](_0x34a87a[_0x5e3d('0x41')]);_0x33e214['filters']=_[_0x5e3d('0x42')](_0x33e214[_0x5e3d('0x43')],_0x33e214[_0x5e3d('0x41')]);_0x237d84['attributes']=_[_0x5e3d('0x42')](_0x33e214[_0x5e3d('0x43')],qs[_0x5e3d('0x44')](_0x34a87a[_0x5e3d('0x41')][_0x5e3d('0x44')]));_0x237d84[_0x5e3d('0x45')]=_0x237d84[_0x5e3d('0x45')][_0x5e3d('0x46')]?_0x237d84[_0x5e3d('0x45')]:_0x33e214[_0x5e3d('0x43')];if(!_0x34a87a[_0x5e3d('0x41')][_0x5e3d('0x47')](_0x5e3d('0x48'))){_0x237d84[_0x5e3d('0x30')]=qs[_0x5e3d('0x30')](_0x34a87a[_0x5e3d('0x41')]['limit']);_0x237d84['offset']=qs[_0x5e3d('0x2f')](_0x34a87a['query'][_0x5e3d('0x2f')]);}_0x237d84[_0x5e3d('0x49')]=qs[_0x5e3d('0x4a')](_0x34a87a[_0x5e3d('0x41')][_0x5e3d('0x4a')]);_0x237d84[_0x5e3d('0x4b')]=qs[_0x5e3d('0x4c')](_['pick'](_0x34a87a[_0x5e3d('0x41')],_0x33e214[_0x5e3d('0x4c')]),_0x383962);if(_0x34a87a[_0x5e3d('0x41')]['filter']){_0x237d84[_0x5e3d('0x4b')]=_[_0x5e3d('0x4d')](_0x237d84[_0x5e3d('0x4b')],{'$or':_[_0x5e3d('0x3b')](_0x383962,function(_0x347ceb){if(_0x347ceb[_0x5e3d('0x3d')]!==_0x5e3d('0x4e')){var _0x3d9be8={};_0x3d9be8[_0x347ceb['name']]={'$like':'%'+_0x34a87a[_0x5e3d('0x41')][_0x5e3d('0x4f')]+'%'};return _0x3d9be8;}})});}_0x237d84=_[_0x5e3d('0x4d')]({},_0x237d84,_0x34a87a[_0x5e3d('0x50')]);var _0x4f2322={'where':_0x237d84['where']};return db[_0x5e3d('0x51')][_0x5e3d('0x2e')](_0x4f2322)['then'](function(_0x5aad23){_0x6d1edc[_0x5e3d('0x2e')]=_0x5aad23;if(_0x34a87a[_0x5e3d('0x41')][_0x5e3d('0x52')]){_0x237d84[_0x5e3d('0x53')]=[{'all':!![]}];}return db[_0x5e3d('0x51')][_0x5e3d('0x54')](_0x237d84);})['then'](function(_0x2014db){_0x6d1edc[_0x5e3d('0x55')]=_0x2014db;return _0x6d1edc;})[_0x5e3d('0x22')](respondWithFilteredResult(_0x413b9f,_0x237d84))[_0x5e3d('0x2c')](handleError(_0x413b9f,null));};exports[_0x5e3d('0x56')]=function(_0xcea51,_0x43294e){var _0x68c31b={'raw':![],'where':{'id':_0xcea51[_0x5e3d('0x57')]['id']}},_0x42d94c={};_0x42d94c[_0x5e3d('0x43')]=_[_0x5e3d('0x40')](db[_0x5e3d('0x51')][_0x5e3d('0x58')]);_0x42d94c[_0x5e3d('0x41')]=_[_0x5e3d('0x40')](_0xcea51[_0x5e3d('0x41')]);_0x42d94c['filters']=_['intersection'](_0x42d94c[_0x5e3d('0x43')],_0x42d94c[_0x5e3d('0x41')]);_0x68c31b['attributes']=_[_0x5e3d('0x42')](_0x42d94c[_0x5e3d('0x43')],qs['fields'](_0xcea51[_0x5e3d('0x41')][_0x5e3d('0x44')]));_0x68c31b[_0x5e3d('0x45')]=_0x68c31b[_0x5e3d('0x45')][_0x5e3d('0x46')]?_0x68c31b[_0x5e3d('0x45')]:_0x42d94c[_0x5e3d('0x43')];if(_0xcea51[_0x5e3d('0x41')][_0x5e3d('0x52')]){_0x68c31b[_0x5e3d('0x53')]=[{'all':!![]}];}_0x68c31b=_[_0x5e3d('0x4d')]({},_0x68c31b,_0xcea51[_0x5e3d('0x50')]);return db['ZendeskConfiguration'][_0x5e3d('0x59')](_0x68c31b)[_0x5e3d('0x22')](handleEntityNotFound(_0x43294e,null))[_0x5e3d('0x22')](respondWithResult(_0x43294e,null))[_0x5e3d('0x2c')](handleError(_0x43294e,null));};exports[_0x5e3d('0x5a')]=function(_0x3a8728,_0x61d95d){return db[_0x5e3d('0x51')][_0x5e3d('0x5a')](_0x3a8728[_0x5e3d('0x5b')],{})[_0x5e3d('0x22')](respondWithResult(_0x61d95d,0xc9))[_0x5e3d('0x2c')](handleError(_0x61d95d,null));};exports[_0x5e3d('0x36')]=function(_0x274837,_0x57eda3){if(_0x274837['body']['id']){delete _0x274837[_0x5e3d('0x5b')]['id'];}return db[_0x5e3d('0x51')][_0x5e3d('0x59')]({'where':{'id':_0x274837[_0x5e3d('0x57')]['id']}})['then'](handleEntityNotFound(_0x57eda3,null))[_0x5e3d('0x22')](saveUpdates(_0x274837[_0x5e3d('0x5b')],null))[_0x5e3d('0x22')](respondWithResult(_0x57eda3,null))[_0x5e3d('0x2c')](handleError(_0x57eda3,null));};exports[_0x5e3d('0x37')]=function(_0x18a140,_0x1e8409){return db[_0x5e3d('0x51')][_0x5e3d('0x59')]({'where':{'id':_0x18a140['params']['id']}})['then'](handleEntityNotFound(_0x1e8409,null))[_0x5e3d('0x22')](removeEntity(_0x1e8409,null))[_0x5e3d('0x2c')](handleError(_0x1e8409,null));};exports['getFields']=function(_0x451b17,_0x466fbe,_0x379dbc){var _0x54bc47={};var _0x560a7a={};var _0x2db6ac;var _0x144b19;return db[_0x5e3d('0x51')][_0x5e3d('0x5c')]({'where':{'id':_0x451b17[_0x5e3d('0x57')]['id']}})['then'](handleEntityNotFound(_0x466fbe,null))['then'](function(_0x1ae7aa){if(_0x1ae7aa){_0x2db6ac=_0x1ae7aa;_0x560a7a[_0x5e3d('0x43')]=_['keys'](db[_0x5e3d('0x5d')][_0x5e3d('0x58')]);_0x560a7a[_0x5e3d('0x41')]=_[_0x5e3d('0x40')](_0x451b17[_0x5e3d('0x41')]);_0x560a7a['filters']=_[_0x5e3d('0x42')](_0x560a7a['model'],_0x560a7a[_0x5e3d('0x41')]);_0x54bc47[_0x5e3d('0x45')]=_[_0x5e3d('0x42')](_0x560a7a[_0x5e3d('0x43')],qs[_0x5e3d('0x44')](_0x451b17[_0x5e3d('0x41')][_0x5e3d('0x44')]));_0x54bc47[_0x5e3d('0x45')]=_0x54bc47[_0x5e3d('0x45')][_0x5e3d('0x46')]?_0x54bc47[_0x5e3d('0x45')]:_0x560a7a[_0x5e3d('0x43')];_0x54bc47[_0x5e3d('0x49')]=qs['sort'](_0x451b17[_0x5e3d('0x41')][_0x5e3d('0x4a')]);_0x54bc47[_0x5e3d('0x4b')]=qs[_0x5e3d('0x4c')](_[_0x5e3d('0x5e')](_0x451b17['query'],_0x560a7a[_0x5e3d('0x4c')]));if(_0x451b17[_0x5e3d('0x41')][_0x5e3d('0x4f')]){_0x54bc47[_0x5e3d('0x4b')]=_[_0x5e3d('0x4d')](_0x54bc47[_0x5e3d('0x4b')],{'$or':_[_0x5e3d('0x3b')](_0x54bc47[_0x5e3d('0x45')],function(_0x4b8ca5){var _0x116948={};_0x116948[_0x4b8ca5]={'$like':'%'+_0x451b17[_0x5e3d('0x41')][_0x5e3d('0x4f')]+'%'};return _0x116948;})});}_0x54bc47=_[_0x5e3d('0x4d')]({},_0x54bc47,_0x451b17['options']);return _0x2db6ac[_0x5e3d('0x5f')](_0x54bc47);}})['then'](function(_0x28e17f){if(_0x28e17f){_0x144b19=_0x28e17f[_0x5e3d('0x46')];if(!_0x451b17[_0x5e3d('0x41')][_0x5e3d('0x47')](_0x5e3d('0x48'))){_0x54bc47[_0x5e3d('0x30')]=qs['limit'](_0x451b17[_0x5e3d('0x41')][_0x5e3d('0x30')]);_0x54bc47[_0x5e3d('0x2f')]=qs[_0x5e3d('0x2f')](_0x451b17[_0x5e3d('0x41')][_0x5e3d('0x2f')]);}return _0x2db6ac[_0x5e3d('0x5f')](_0x54bc47);}})[_0x5e3d('0x22')](function(_0x5bccf2){if(_0x5bccf2){return _0x5bccf2?{'count':_0x144b19,'rows':_0x5bccf2}:null;}})[_0x5e3d('0x22')](respondWithResult(_0x466fbe,null))['catch'](handleError(_0x466fbe,null));};exports[_0x5e3d('0x60')]=function(_0x58efd1,_0x2a5ead,_0x1606d9){var _0x5cce19={};var _0x4047d3={};var _0x2803b7;var _0x144ae2;return db['ZendeskConfiguration'][_0x5e3d('0x5c')]({'where':{'id':_0x58efd1[_0x5e3d('0x57')]['id']}})[_0x5e3d('0x22')](handleEntityNotFound(_0x2a5ead,null))[_0x5e3d('0x22')](function(_0x26e8fa){if(_0x26e8fa){_0x2803b7=_0x26e8fa;_0x4047d3['model']=_[_0x5e3d('0x40')](db[_0x5e3d('0x5d')][_0x5e3d('0x58')]);_0x4047d3[_0x5e3d('0x41')]=_[_0x5e3d('0x40')](_0x58efd1[_0x5e3d('0x41')]);_0x4047d3[_0x5e3d('0x4c')]=_[_0x5e3d('0x42')](_0x4047d3['model'],_0x4047d3[_0x5e3d('0x41')]);_0x5cce19['attributes']=_[_0x5e3d('0x42')](_0x4047d3[_0x5e3d('0x43')],qs['fields'](_0x58efd1[_0x5e3d('0x41')][_0x5e3d('0x44')]));_0x5cce19[_0x5e3d('0x45')]=_0x5cce19[_0x5e3d('0x45')][_0x5e3d('0x46')]?_0x5cce19[_0x5e3d('0x45')]:_0x4047d3[_0x5e3d('0x43')];_0x5cce19['order']=qs[_0x5e3d('0x4a')](_0x58efd1['query']['sort']);_0x5cce19[_0x5e3d('0x4b')]=qs[_0x5e3d('0x4c')](_[_0x5e3d('0x5e')](_0x58efd1[_0x5e3d('0x41')],_0x4047d3[_0x5e3d('0x4c')]));if(_0x58efd1[_0x5e3d('0x41')][_0x5e3d('0x4f')]){_0x5cce19[_0x5e3d('0x4b')]=_['merge'](_0x5cce19[_0x5e3d('0x4b')],{'$or':_[_0x5e3d('0x3b')](_0x5cce19['attributes'],function(_0x45c57f){var _0x4f2c82={};_0x4f2c82[_0x45c57f]={'$like':'%'+_0x58efd1[_0x5e3d('0x41')][_0x5e3d('0x4f')]+'%'};return _0x4f2c82;})});}_0x5cce19=_['merge']({},_0x5cce19,_0x58efd1[_0x5e3d('0x50')]);return _0x2803b7['getSubjects'](_0x5cce19);}})[_0x5e3d('0x22')](function(_0x41bade){if(_0x41bade){_0x144ae2=_0x41bade[_0x5e3d('0x46')];if(!_0x58efd1[_0x5e3d('0x41')][_0x5e3d('0x47')](_0x5e3d('0x48'))){_0x5cce19[_0x5e3d('0x30')]=qs[_0x5e3d('0x30')](_0x58efd1[_0x5e3d('0x41')][_0x5e3d('0x30')]);_0x5cce19[_0x5e3d('0x2f')]=qs[_0x5e3d('0x2f')](_0x58efd1[_0x5e3d('0x41')][_0x5e3d('0x2f')]);}return _0x2803b7['getSubjects'](_0x5cce19);}})[_0x5e3d('0x22')](function(_0x49c436){if(_0x49c436){return _0x49c436?{'count':_0x144ae2,'rows':_0x49c436}:null;}})[_0x5e3d('0x22')](respondWithResult(_0x2a5ead,null))[_0x5e3d('0x2c')](handleError(_0x2a5ead,null));};exports[_0x5e3d('0x61')]=function(_0x43d799,_0x41b6b8,_0x519411){var _0x53a30f={};var _0x32cdc9={};var _0x1d81f7;var _0x492e72;return db[_0x5e3d('0x51')][_0x5e3d('0x5c')]({'where':{'id':_0x43d799[_0x5e3d('0x57')]['id']}})[_0x5e3d('0x22')](handleEntityNotFound(_0x41b6b8,null))['then'](function(_0x548cac){if(_0x548cac){_0x1d81f7=_0x548cac;_0x32cdc9[_0x5e3d('0x43')]=_['keys'](db['ZendeskField'][_0x5e3d('0x58')]);_0x32cdc9[_0x5e3d('0x41')]=_['keys'](_0x43d799[_0x5e3d('0x41')]);_0x32cdc9['filters']=_[_0x5e3d('0x42')](_0x32cdc9['model'],_0x32cdc9[_0x5e3d('0x41')]);_0x53a30f[_0x5e3d('0x45')]=_[_0x5e3d('0x42')](_0x32cdc9[_0x5e3d('0x43')],qs['fields'](_0x43d799[_0x5e3d('0x41')][_0x5e3d('0x44')]));_0x53a30f['attributes']=_0x53a30f['attributes']['length']?_0x53a30f[_0x5e3d('0x45')]:_0x32cdc9['model'];_0x53a30f[_0x5e3d('0x49')]=qs[_0x5e3d('0x4a')](_0x43d799[_0x5e3d('0x41')][_0x5e3d('0x4a')]);_0x53a30f[_0x5e3d('0x4b')]=qs[_0x5e3d('0x4c')](_[_0x5e3d('0x5e')](_0x43d799[_0x5e3d('0x41')],_0x32cdc9['filters']));if(_0x43d799[_0x5e3d('0x41')][_0x5e3d('0x4f')]){_0x53a30f['where']=_[_0x5e3d('0x4d')](_0x53a30f['where'],{'$or':_[_0x5e3d('0x3b')](_0x53a30f[_0x5e3d('0x45')],function(_0x4e468a){var _0x36e967={};_0x36e967[_0x4e468a]={'$like':'%'+_0x43d799[_0x5e3d('0x41')]['filter']+'%'};return _0x36e967;})});}_0x53a30f=_[_0x5e3d('0x4d')]({},_0x53a30f,_0x43d799[_0x5e3d('0x50')]);return _0x1d81f7['getDescriptions'](_0x53a30f);}})[_0x5e3d('0x22')](function(_0x2dce49){if(_0x2dce49){_0x492e72=_0x2dce49[_0x5e3d('0x46')];if(!_0x43d799['query']['hasOwnProperty']('nolimit')){_0x53a30f[_0x5e3d('0x30')]=qs[_0x5e3d('0x30')](_0x43d799['query'][_0x5e3d('0x30')]);_0x53a30f[_0x5e3d('0x2f')]=qs['offset'](_0x43d799[_0x5e3d('0x41')]['offset']);}return _0x1d81f7[_0x5e3d('0x61')](_0x53a30f);}})['then'](function(_0x3de0f9){if(_0x3de0f9){return _0x3de0f9?{'count':_0x492e72,'rows':_0x3de0f9}:null;}})['then'](respondWithResult(_0x41b6b8,null))[_0x5e3d('0x2c')](handleError(_0x41b6b8,null));};exports[_0x5e3d('0x62')]=function(_0x9abc0f,_0x29fc34,_0x1e686f){var _0x5f02ba={};var _0xd99321={};var _0x233d16;var _0x2dbf8b;return db['ZendeskConfiguration'][_0x5e3d('0x5c')]({'where':{'id':_0x9abc0f[_0x5e3d('0x57')]['id']}})[_0x5e3d('0x22')](handleEntityNotFound(_0x29fc34,null))[_0x5e3d('0x22')](function(_0x2a8540){if(_0x2a8540){_0x233d16=_0x2a8540;_0xd99321[_0x5e3d('0x43')]=_[_0x5e3d('0x40')](db['Tag'][_0x5e3d('0x58')]);_0xd99321['query']=_[_0x5e3d('0x40')](_0x9abc0f['query']);_0xd99321[_0x5e3d('0x4c')]=_[_0x5e3d('0x42')](_0xd99321[_0x5e3d('0x43')],_0xd99321[_0x5e3d('0x41')]);_0x5f02ba[_0x5e3d('0x45')]=_[_0x5e3d('0x42')](_0xd99321[_0x5e3d('0x43')],qs[_0x5e3d('0x44')](_0x9abc0f['query'][_0x5e3d('0x44')]));_0x5f02ba['attributes']=_0x5f02ba[_0x5e3d('0x45')][_0x5e3d('0x46')]?_0x5f02ba[_0x5e3d('0x45')]:_0xd99321[_0x5e3d('0x43')];_0x5f02ba[_0x5e3d('0x49')]=qs[_0x5e3d('0x4a')](_0x9abc0f[_0x5e3d('0x41')][_0x5e3d('0x4a')]);_0x5f02ba[_0x5e3d('0x4b')]=qs[_0x5e3d('0x4c')](_[_0x5e3d('0x5e')](_0x9abc0f[_0x5e3d('0x41')],_0xd99321[_0x5e3d('0x4c')]));if(_0x9abc0f[_0x5e3d('0x41')][_0x5e3d('0x4f')]){_0x5f02ba[_0x5e3d('0x4b')]=_['merge'](_0x5f02ba[_0x5e3d('0x4b')],{'$or':_[_0x5e3d('0x3b')](_0x5f02ba[_0x5e3d('0x45')],function(_0x1c8cbc){var _0x545faa={};_0x545faa[_0x1c8cbc]={'$like':'%'+_0x9abc0f[_0x5e3d('0x41')][_0x5e3d('0x4f')]+'%'};return _0x545faa;})});}_0x5f02ba=_['merge']({},_0x5f02ba,_0x9abc0f[_0x5e3d('0x50')]);return _0x233d16[_0x5e3d('0x62')](_0x5f02ba);}})[_0x5e3d('0x22')](function(_0x2a4529){if(_0x2a4529){_0x2dbf8b=_0x2a4529[_0x5e3d('0x46')];if(!_0x9abc0f[_0x5e3d('0x41')][_0x5e3d('0x47')](_0x5e3d('0x48'))){_0x5f02ba[_0x5e3d('0x30')]=qs[_0x5e3d('0x30')](_0x9abc0f[_0x5e3d('0x41')][_0x5e3d('0x30')]);_0x5f02ba[_0x5e3d('0x2f')]=qs['offset'](_0x9abc0f[_0x5e3d('0x41')][_0x5e3d('0x2f')]);}return _0x233d16[_0x5e3d('0x62')](_0x5f02ba);}})[_0x5e3d('0x22')](function(_0x208231){if(_0x208231){return _0x208231?{'count':_0x2dbf8b,'rows':_0x208231}:null;}})[_0x5e3d('0x22')](respondWithResult(_0x29fc34,null))[_0x5e3d('0x2c')](handleError(_0x29fc34,null));};exports[_0x5e3d('0x63')]=function(_0x1b10f6,_0x4baeb9,_0x2a9627){if(_0x1b10f6['body']['id']){delete _0x1b10f6[_0x5e3d('0x5b')]['id'];}return db[_0x5e3d('0x51')][_0x5e3d('0x5c')]({'where':{'id':_0x1b10f6[_0x5e3d('0x57')]['id']}})[_0x5e3d('0x22')](handleEntityNotFound(_0x4baeb9,null))[_0x5e3d('0x22')](function(_0x55dba4){if(_0x55dba4){return _0x55dba4[_0x5e3d('0x63')](_0x1b10f6['body'][_0x5e3d('0x64')]||[]);}return null;})['then'](respondWithResult(_0x4baeb9,null))[_0x5e3d('0x2c')](handleError(_0x4baeb9,null));}; \ No newline at end of file +var _0x28ff=['getTags','Tag','setTags','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../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','ZendeskConfiguration,\x20%s,\x20%s','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','index','ZendeskConfiguration','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','params','rawAttributes','intersection','includeAll','find','body','getFields','findOne','ZendeskField','map','hasOwnProperty','getSubjects','getDescriptions'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x28ff,0x17f));var _0xf28f=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x28ff[_0x465a0c];return _0x1e202e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf28f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf28f('0x1'));var jsonpatch=require(_0xf28f('0x2'));var rp=require('request-promise');var moment=require(_0xf28f('0x3'));var BPromise=require(_0xf28f('0x4'));var Mustache=require(_0xf28f('0x5'));var util=require(_0xf28f('0x6'));var path=require(_0xf28f('0x7'));var sox=require(_0xf28f('0x8'));var csv=require('to-csv');var ejs=require(_0xf28f('0x9'));var fs=require('fs');var _=require(_0xf28f('0xa'));var squel=require(_0xf28f('0xb'));var crypto=require(_0xf28f('0xc'));var jsforce=require(_0xf28f('0xd'));var deskjs=require(_0xf28f('0xe'));var toCsv=require(_0xf28f('0xf'));var querystring=require(_0xf28f('0x10'));var Papa=require(_0xf28f('0x11'));var Redis=require(_0xf28f('0x12'));var authService=require(_0xf28f('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf28f('0x14'))(_0xf28f('0x15'));var utils=require('../../config/utils');var config=require(_0xf28f('0x16'));var db=require(_0xf28f('0x17'))['db'];var jayson=require(_0xf28f('0x18'));var client=jayson['client'][_0xf28f('0x19')]({'port':0x232a});function checkPasswordPattern(_0x1f17d9,_0x5676ff,_0x2a1319){if(_0x2a1319){var _0x252c2d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x252c2d[_0xf28f('0x1a')](_0x5676ff)){return _0x1f17d9;}else{throw new db[(_0xf28f('0x1b'))][(_0xf28f('0x1c'))](_0xf28f('0x1d'));}}else{return _0x1f17d9;}}function respondWithRpcPromise(_0xee0b45,_0x940e8f,_0x87c2ea,_0x4cc049){return new BPromise(function(_0x4d4d3d,_0x5583ca){var _0x586ed2=_0x4cc049||client;return _0x586ed2[_0xf28f('0x1e')](_0xee0b45,_0x87c2ea)[_0xf28f('0x1f')](function(_0x2e6480){logger[_0xf28f('0x20')](_0xf28f('0x21'),_0x940e8f,'request\x20sent');logger['debug'](_0xf28f('0x22'),_0x940e8f,_0xf28f('0x23'),JSON[_0xf28f('0x24')](_0x2e6480));if(_0x2e6480[_0xf28f('0x25')]){if(_0x2e6480[_0xf28f('0x25')][_0xf28f('0x26')]===0x1f4){logger[_0xf28f('0x25')]('ZendeskConfiguration,\x20%s,\x20%s',_0x940e8f,_0x2e6480[_0xf28f('0x25')][_0xf28f('0x27')]);return _0x5583ca(_0x2e6480[_0xf28f('0x25')]['message']);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x940e8f,_0x2e6480['error'][_0xf28f('0x27')]);return _0x4d4d3d(_0x2e6480['error']['message']);}else{logger[_0xf28f('0x20')](_0xf28f('0x21'),_0x940e8f,'request\x20sent');_0x4d4d3d(_0x2e6480[_0xf28f('0x28')][_0xf28f('0x27')]);}})[_0xf28f('0x29')](function(_0x42635c){logger[_0xf28f('0x25')]('ZendeskConfiguration,\x20%s,\x20%s',_0x940e8f,_0x42635c);_0x5583ca(_0x42635c);});});}function respondWithStatusCode(_0x367d0d,_0x210fc2){_0x210fc2=_0x210fc2||0xcc;return function(_0x5c8ba4){if(_0x5c8ba4){return _0x367d0d[_0xf28f('0x2a')](_0x210fc2);}return _0x367d0d[_0xf28f('0x2b')](_0x210fc2)[_0xf28f('0x2c')]();};}function respondWithResult(_0x2c2dec,_0x2076dc){_0x2076dc=_0x2076dc||0xc8;return function(_0x16507e){if(_0x16507e){return _0x2c2dec[_0xf28f('0x2b')](_0x2076dc)[_0xf28f('0x2d')](_0x16507e);}};}function respondWithFilteredResult(_0x5cde3b,_0x26c877){return function(_0x86fa40){if(_0x86fa40){var _0x1d2d39=_0x86fa40[_0xf28f('0x2e')],_0x4b3657=_0x26c877[_0xf28f('0x2f')],_0x17f388=_0x26c877[_0xf28f('0x2f')]+_0x26c877[_0xf28f('0x30')],_0x4f0361;if(_0x17f388>=_0x1d2d39){_0x17f388=_0x1d2d39;_0x4f0361=0xc8;}else{_0x4f0361=0xce;}_0x5cde3b[_0xf28f('0x2b')](_0x4f0361);return _0x5cde3b[_0xf28f('0x31')](_0xf28f('0x32'),_0x4b3657+'-'+_0x17f388+'/'+_0x1d2d39)['json'](_0x86fa40);}return null;};}function patchUpdates(_0x426e24){return function(_0x540754){try{jsonpatch['apply'](_0x540754,_0x426e24,!![]);}catch(_0x16b300){return BPromise[_0xf28f('0x33')](_0x16b300);}return _0x540754[_0xf28f('0x34')]();};}function saveUpdates(_0x55742c,_0x3f608a){return function(_0x4af513){if(_0x4af513){return _0x4af513[_0xf28f('0x35')](_0x55742c)[_0xf28f('0x1f')](function(_0x4e03e9){return _0x4e03e9;});}return null;};}function removeEntity(_0x32e091,_0x2e4538){return function(_0x1d3091){if(_0x1d3091){return _0x1d3091[_0xf28f('0x36')]()[_0xf28f('0x1f')](function(){_0x32e091[_0xf28f('0x2b')](0xcc)[_0xf28f('0x2c')]();});}};}function handleEntityNotFound(_0x5a873c,_0x3f9003){return function(_0x12507f){if(!_0x12507f){_0x5a873c[_0xf28f('0x2a')](0x194);}return _0x12507f;};}function handleError(_0x5a2ee3,_0xcdc38){_0xcdc38=_0xcdc38||0x1f4;return function(_0x4db053){logger[_0xf28f('0x25')](_0x4db053[_0xf28f('0x37')]);if(_0x4db053[_0xf28f('0x38')]){delete _0x4db053[_0xf28f('0x38')];}_0x5a2ee3[_0xf28f('0x2b')](_0xcdc38)['send'](_0x4db053);};}exports[_0xf28f('0x39')]=function(_0x5fd1d,_0x14f730){var _0x3ec61d={},_0x5b5645={},_0x5efaf9={'count':0x0,'rows':[]};var _0x58ff94=_['map'](db[_0xf28f('0x3a')]['rawAttributes'],function(_0x20664e){return{'name':_0x20664e['fieldName'],'type':_0x20664e['type'][_0xf28f('0x3b')]};});_0x5b5645[_0xf28f('0x3c')]=_['map'](_0x58ff94,_0xf28f('0x38'));_0x5b5645[_0xf28f('0x3d')]=_[_0xf28f('0x3e')](_0x5fd1d[_0xf28f('0x3d')]);_0x5b5645[_0xf28f('0x3f')]=_['intersection'](_0x5b5645['model'],_0x5b5645[_0xf28f('0x3d')]);_0x3ec61d[_0xf28f('0x40')]=_['intersection'](_0x5b5645[_0xf28f('0x3c')],qs[_0xf28f('0x41')](_0x5fd1d['query'][_0xf28f('0x41')]));_0x3ec61d[_0xf28f('0x40')]=_0x3ec61d[_0xf28f('0x40')][_0xf28f('0x42')]?_0x3ec61d['attributes']:_0x5b5645['model'];if(!_0x5fd1d['query']['hasOwnProperty'](_0xf28f('0x43'))){_0x3ec61d[_0xf28f('0x30')]=qs[_0xf28f('0x30')](_0x5fd1d[_0xf28f('0x3d')][_0xf28f('0x30')]);_0x3ec61d[_0xf28f('0x2f')]=qs[_0xf28f('0x2f')](_0x5fd1d['query'][_0xf28f('0x2f')]);}_0x3ec61d[_0xf28f('0x44')]=qs[_0xf28f('0x45')](_0x5fd1d[_0xf28f('0x3d')][_0xf28f('0x45')]);_0x3ec61d[_0xf28f('0x46')]=qs['filters'](_[_0xf28f('0x47')](_0x5fd1d['query'],_0x5b5645[_0xf28f('0x3f')]),_0x58ff94);if(_0x5fd1d[_0xf28f('0x3d')][_0xf28f('0x48')]){_0x3ec61d['where']=_['merge'](_0x3ec61d['where'],{'$or':_['map'](_0x58ff94,function(_0x2eb24b){if(_0x2eb24b['type']!==_0xf28f('0x49')){var _0x57aedf={};_0x57aedf[_0x2eb24b['name']]={'$like':'%'+_0x5fd1d[_0xf28f('0x3d')][_0xf28f('0x48')]+'%'};return _0x57aedf;}})});}_0x3ec61d=_[_0xf28f('0x4a')]({},_0x3ec61d,_0x5fd1d[_0xf28f('0x4b')]);var _0x2a1c15={'where':_0x3ec61d['where']};return db['ZendeskConfiguration'][_0xf28f('0x2e')](_0x2a1c15)[_0xf28f('0x1f')](function(_0x563ad6){_0x5efaf9[_0xf28f('0x2e')]=_0x563ad6;if(_0x5fd1d['query']['includeAll']){_0x3ec61d[_0xf28f('0x4c')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xf28f('0x4d')](_0x3ec61d);})[_0xf28f('0x1f')](function(_0x89f66b){_0x5efaf9[_0xf28f('0x4e')]=_0x89f66b;return _0x5efaf9;})[_0xf28f('0x1f')](respondWithFilteredResult(_0x14f730,_0x3ec61d))[_0xf28f('0x29')](handleError(_0x14f730,null));};exports['show']=function(_0xb138ca,_0x321d5b){var _0xf819a8={'raw':![],'where':{'id':_0xb138ca[_0xf28f('0x4f')]['id']}},_0x3e079e={};_0x3e079e[_0xf28f('0x3c')]=_['keys'](db['ZendeskConfiguration'][_0xf28f('0x50')]);_0x3e079e['query']=_[_0xf28f('0x3e')](_0xb138ca[_0xf28f('0x3d')]);_0x3e079e[_0xf28f('0x3f')]=_[_0xf28f('0x51')](_0x3e079e[_0xf28f('0x3c')],_0x3e079e['query']);_0xf819a8['attributes']=_['intersection'](_0x3e079e[_0xf28f('0x3c')],qs[_0xf28f('0x41')](_0xb138ca[_0xf28f('0x3d')][_0xf28f('0x41')]));_0xf819a8[_0xf28f('0x40')]=_0xf819a8[_0xf28f('0x40')]['length']?_0xf819a8['attributes']:_0x3e079e[_0xf28f('0x3c')];if(_0xb138ca[_0xf28f('0x3d')][_0xf28f('0x52')]){_0xf819a8[_0xf28f('0x4c')]=[{'all':!![]}];}_0xf819a8=_[_0xf28f('0x4a')]({},_0xf819a8,_0xb138ca['options']);return db['ZendeskConfiguration'][_0xf28f('0x53')](_0xf819a8)['then'](handleEntityNotFound(_0x321d5b,null))[_0xf28f('0x1f')](respondWithResult(_0x321d5b,null))['catch'](handleError(_0x321d5b,null));};exports['create']=function(_0x2ea2ad,_0x36c521){return db[_0xf28f('0x3a')]['create'](_0x2ea2ad[_0xf28f('0x54')],{})[_0xf28f('0x1f')](respondWithResult(_0x36c521,0xc9))[_0xf28f('0x29')](handleError(_0x36c521,null));};exports[_0xf28f('0x35')]=function(_0x4f29e9,_0x527a9e){if(_0x4f29e9[_0xf28f('0x54')]['id']){delete _0x4f29e9['body']['id'];}return db[_0xf28f('0x3a')]['find']({'where':{'id':_0x4f29e9[_0xf28f('0x4f')]['id']}})[_0xf28f('0x1f')](handleEntityNotFound(_0x527a9e,null))[_0xf28f('0x1f')](saveUpdates(_0x4f29e9[_0xf28f('0x54')],null))[_0xf28f('0x1f')](respondWithResult(_0x527a9e,null))['catch'](handleError(_0x527a9e,null));};exports[_0xf28f('0x36')]=function(_0x31500b,_0x3d4420){return db[_0xf28f('0x3a')][_0xf28f('0x53')]({'where':{'id':_0x31500b[_0xf28f('0x4f')]['id']}})[_0xf28f('0x1f')](handleEntityNotFound(_0x3d4420,null))[_0xf28f('0x1f')](removeEntity(_0x3d4420,null))[_0xf28f('0x29')](handleError(_0x3d4420,null));};exports[_0xf28f('0x55')]=function(_0x5c3002,_0x27eca8,_0x37f065){var _0x15219a={};var _0x4b313f={};var _0x1d7988;var _0x3a89e1;return db[_0xf28f('0x3a')][_0xf28f('0x56')]({'where':{'id':_0x5c3002[_0xf28f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x27eca8,null))[_0xf28f('0x1f')](function(_0x3a55aa){if(_0x3a55aa){_0x1d7988=_0x3a55aa;_0x4b313f['model']=_[_0xf28f('0x3e')](db[_0xf28f('0x57')]['rawAttributes']);_0x4b313f[_0xf28f('0x3d')]=_[_0xf28f('0x3e')](_0x5c3002[_0xf28f('0x3d')]);_0x4b313f[_0xf28f('0x3f')]=_[_0xf28f('0x51')](_0x4b313f[_0xf28f('0x3c')],_0x4b313f[_0xf28f('0x3d')]);_0x15219a['attributes']=_[_0xf28f('0x51')](_0x4b313f[_0xf28f('0x3c')],qs[_0xf28f('0x41')](_0x5c3002[_0xf28f('0x3d')][_0xf28f('0x41')]));_0x15219a['attributes']=_0x15219a['attributes'][_0xf28f('0x42')]?_0x15219a['attributes']:_0x4b313f[_0xf28f('0x3c')];_0x15219a[_0xf28f('0x44')]=qs[_0xf28f('0x45')](_0x5c3002[_0xf28f('0x3d')][_0xf28f('0x45')]);_0x15219a[_0xf28f('0x46')]=qs[_0xf28f('0x3f')](_['pick'](_0x5c3002[_0xf28f('0x3d')],_0x4b313f['filters']));if(_0x5c3002[_0xf28f('0x3d')][_0xf28f('0x48')]){_0x15219a[_0xf28f('0x46')]=_[_0xf28f('0x4a')](_0x15219a[_0xf28f('0x46')],{'$or':_[_0xf28f('0x58')](_0x15219a[_0xf28f('0x40')],function(_0x3e7b77){var _0x449d6c={};_0x449d6c[_0x3e7b77]={'$like':'%'+_0x5c3002[_0xf28f('0x3d')][_0xf28f('0x48')]+'%'};return _0x449d6c;})});}_0x15219a=_[_0xf28f('0x4a')]({},_0x15219a,_0x5c3002[_0xf28f('0x4b')]);return _0x1d7988[_0xf28f('0x55')](_0x15219a);}})[_0xf28f('0x1f')](function(_0x1b6123){if(_0x1b6123){_0x3a89e1=_0x1b6123[_0xf28f('0x42')];if(!_0x5c3002['query'][_0xf28f('0x59')]('nolimit')){_0x15219a['limit']=qs[_0xf28f('0x30')](_0x5c3002['query'][_0xf28f('0x30')]);_0x15219a[_0xf28f('0x2f')]=qs['offset'](_0x5c3002[_0xf28f('0x3d')][_0xf28f('0x2f')]);}return _0x1d7988['getFields'](_0x15219a);}})['then'](function(_0x36d6c7){if(_0x36d6c7){return _0x36d6c7?{'count':_0x3a89e1,'rows':_0x36d6c7}:null;}})[_0xf28f('0x1f')](respondWithResult(_0x27eca8,null))[_0xf28f('0x29')](handleError(_0x27eca8,null));};exports[_0xf28f('0x5a')]=function(_0x43bf68,_0x372df2,_0x2c521a){var _0x2588e1={};var _0x54ac8a={};var _0x16058e;var _0x159fac;return db[_0xf28f('0x3a')][_0xf28f('0x56')]({'where':{'id':_0x43bf68[_0xf28f('0x4f')]['id']}})[_0xf28f('0x1f')](handleEntityNotFound(_0x372df2,null))[_0xf28f('0x1f')](function(_0xe50588){if(_0xe50588){_0x16058e=_0xe50588;_0x54ac8a['model']=_[_0xf28f('0x3e')](db[_0xf28f('0x57')][_0xf28f('0x50')]);_0x54ac8a[_0xf28f('0x3d')]=_[_0xf28f('0x3e')](_0x43bf68[_0xf28f('0x3d')]);_0x54ac8a[_0xf28f('0x3f')]=_['intersection'](_0x54ac8a[_0xf28f('0x3c')],_0x54ac8a['query']);_0x2588e1['attributes']=_[_0xf28f('0x51')](_0x54ac8a[_0xf28f('0x3c')],qs[_0xf28f('0x41')](_0x43bf68[_0xf28f('0x3d')]['fields']));_0x2588e1[_0xf28f('0x40')]=_0x2588e1[_0xf28f('0x40')]['length']?_0x2588e1[_0xf28f('0x40')]:_0x54ac8a[_0xf28f('0x3c')];_0x2588e1['order']=qs[_0xf28f('0x45')](_0x43bf68[_0xf28f('0x3d')]['sort']);_0x2588e1[_0xf28f('0x46')]=qs[_0xf28f('0x3f')](_[_0xf28f('0x47')](_0x43bf68[_0xf28f('0x3d')],_0x54ac8a[_0xf28f('0x3f')]));if(_0x43bf68[_0xf28f('0x3d')][_0xf28f('0x48')]){_0x2588e1[_0xf28f('0x46')]=_[_0xf28f('0x4a')](_0x2588e1['where'],{'$or':_[_0xf28f('0x58')](_0x2588e1[_0xf28f('0x40')],function(_0x5d7cff){var _0x47e10b={};_0x47e10b[_0x5d7cff]={'$like':'%'+_0x43bf68['query'][_0xf28f('0x48')]+'%'};return _0x47e10b;})});}_0x2588e1=_[_0xf28f('0x4a')]({},_0x2588e1,_0x43bf68[_0xf28f('0x4b')]);return _0x16058e[_0xf28f('0x5a')](_0x2588e1);}})[_0xf28f('0x1f')](function(_0x1999f4){if(_0x1999f4){_0x159fac=_0x1999f4[_0xf28f('0x42')];if(!_0x43bf68[_0xf28f('0x3d')]['hasOwnProperty'](_0xf28f('0x43'))){_0x2588e1[_0xf28f('0x30')]=qs[_0xf28f('0x30')](_0x43bf68[_0xf28f('0x3d')][_0xf28f('0x30')]);_0x2588e1[_0xf28f('0x2f')]=qs[_0xf28f('0x2f')](_0x43bf68[_0xf28f('0x3d')][_0xf28f('0x2f')]);}return _0x16058e[_0xf28f('0x5a')](_0x2588e1);}})[_0xf28f('0x1f')](function(_0x304903){if(_0x304903){return _0x304903?{'count':_0x159fac,'rows':_0x304903}:null;}})['then'](respondWithResult(_0x372df2,null))['catch'](handleError(_0x372df2,null));};exports['getDescriptions']=function(_0x4c8fc9,_0x43ba6c,_0x36caee){var _0xdae595={};var _0x4f629b={};var _0x2a98c3;var _0x4f0fad;return db['ZendeskConfiguration'][_0xf28f('0x56')]({'where':{'id':_0x4c8fc9[_0xf28f('0x4f')]['id']}})[_0xf28f('0x1f')](handleEntityNotFound(_0x43ba6c,null))[_0xf28f('0x1f')](function(_0x1da28b){if(_0x1da28b){_0x2a98c3=_0x1da28b;_0x4f629b['model']=_[_0xf28f('0x3e')](db['ZendeskField'][_0xf28f('0x50')]);_0x4f629b[_0xf28f('0x3d')]=_[_0xf28f('0x3e')](_0x4c8fc9[_0xf28f('0x3d')]);_0x4f629b[_0xf28f('0x3f')]=_[_0xf28f('0x51')](_0x4f629b[_0xf28f('0x3c')],_0x4f629b[_0xf28f('0x3d')]);_0xdae595[_0xf28f('0x40')]=_[_0xf28f('0x51')](_0x4f629b[_0xf28f('0x3c')],qs[_0xf28f('0x41')](_0x4c8fc9[_0xf28f('0x3d')][_0xf28f('0x41')]));_0xdae595[_0xf28f('0x40')]=_0xdae595['attributes'][_0xf28f('0x42')]?_0xdae595[_0xf28f('0x40')]:_0x4f629b[_0xf28f('0x3c')];_0xdae595[_0xf28f('0x44')]=qs['sort'](_0x4c8fc9['query']['sort']);_0xdae595[_0xf28f('0x46')]=qs[_0xf28f('0x3f')](_[_0xf28f('0x47')](_0x4c8fc9['query'],_0x4f629b[_0xf28f('0x3f')]));if(_0x4c8fc9[_0xf28f('0x3d')][_0xf28f('0x48')]){_0xdae595[_0xf28f('0x46')]=_[_0xf28f('0x4a')](_0xdae595[_0xf28f('0x46')],{'$or':_[_0xf28f('0x58')](_0xdae595['attributes'],function(_0x5e1d0b){var _0x3f478b={};_0x3f478b[_0x5e1d0b]={'$like':'%'+_0x4c8fc9[_0xf28f('0x3d')][_0xf28f('0x48')]+'%'};return _0x3f478b;})});}_0xdae595=_[_0xf28f('0x4a')]({},_0xdae595,_0x4c8fc9[_0xf28f('0x4b')]);return _0x2a98c3[_0xf28f('0x5b')](_0xdae595);}})['then'](function(_0x4bd381){if(_0x4bd381){_0x4f0fad=_0x4bd381['length'];if(!_0x4c8fc9[_0xf28f('0x3d')]['hasOwnProperty']('nolimit')){_0xdae595[_0xf28f('0x30')]=qs[_0xf28f('0x30')](_0x4c8fc9[_0xf28f('0x3d')][_0xf28f('0x30')]);_0xdae595[_0xf28f('0x2f')]=qs[_0xf28f('0x2f')](_0x4c8fc9[_0xf28f('0x3d')][_0xf28f('0x2f')]);}return _0x2a98c3['getDescriptions'](_0xdae595);}})[_0xf28f('0x1f')](function(_0x3a3a89){if(_0x3a3a89){return _0x3a3a89?{'count':_0x4f0fad,'rows':_0x3a3a89}:null;}})['then'](respondWithResult(_0x43ba6c,null))['catch'](handleError(_0x43ba6c,null));};exports[_0xf28f('0x5c')]=function(_0x3760ac,_0x1a0b24,_0x3f9fa6){var _0x4bbb86={};var _0xd56b6b={};var _0x5e0803;var _0x3d69cc;return db['ZendeskConfiguration'][_0xf28f('0x56')]({'where':{'id':_0x3760ac[_0xf28f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1a0b24,null))[_0xf28f('0x1f')](function(_0x2ff60e){if(_0x2ff60e){_0x5e0803=_0x2ff60e;_0xd56b6b[_0xf28f('0x3c')]=_['keys'](db[_0xf28f('0x5d')][_0xf28f('0x50')]);_0xd56b6b['query']=_[_0xf28f('0x3e')](_0x3760ac[_0xf28f('0x3d')]);_0xd56b6b['filters']=_[_0xf28f('0x51')](_0xd56b6b[_0xf28f('0x3c')],_0xd56b6b[_0xf28f('0x3d')]);_0x4bbb86['attributes']=_[_0xf28f('0x51')](_0xd56b6b[_0xf28f('0x3c')],qs[_0xf28f('0x41')](_0x3760ac[_0xf28f('0x3d')][_0xf28f('0x41')]));_0x4bbb86['attributes']=_0x4bbb86[_0xf28f('0x40')][_0xf28f('0x42')]?_0x4bbb86['attributes']:_0xd56b6b['model'];_0x4bbb86[_0xf28f('0x44')]=qs['sort'](_0x3760ac['query'][_0xf28f('0x45')]);_0x4bbb86[_0xf28f('0x46')]=qs[_0xf28f('0x3f')](_['pick'](_0x3760ac[_0xf28f('0x3d')],_0xd56b6b[_0xf28f('0x3f')]));if(_0x3760ac[_0xf28f('0x3d')]['filter']){_0x4bbb86[_0xf28f('0x46')]=_[_0xf28f('0x4a')](_0x4bbb86[_0xf28f('0x46')],{'$or':_[_0xf28f('0x58')](_0x4bbb86[_0xf28f('0x40')],function(_0xcee5f8){var _0x2942e7={};_0x2942e7[_0xcee5f8]={'$like':'%'+_0x3760ac[_0xf28f('0x3d')][_0xf28f('0x48')]+'%'};return _0x2942e7;})});}_0x4bbb86=_[_0xf28f('0x4a')]({},_0x4bbb86,_0x3760ac['options']);return _0x5e0803[_0xf28f('0x5c')](_0x4bbb86);}})[_0xf28f('0x1f')](function(_0x4bdb10){if(_0x4bdb10){_0x3d69cc=_0x4bdb10['length'];if(!_0x3760ac[_0xf28f('0x3d')]['hasOwnProperty'](_0xf28f('0x43'))){_0x4bbb86[_0xf28f('0x30')]=qs['limit'](_0x3760ac['query']['limit']);_0x4bbb86[_0xf28f('0x2f')]=qs['offset'](_0x3760ac[_0xf28f('0x3d')]['offset']);}return _0x5e0803['getTags'](_0x4bbb86);}})[_0xf28f('0x1f')](function(_0x5c36ba){if(_0x5c36ba){return _0x5c36ba?{'count':_0x3d69cc,'rows':_0x5c36ba}:null;}})['then'](respondWithResult(_0x1a0b24,null))['catch'](handleError(_0x1a0b24,null));};exports[_0xf28f('0x5e')]=function(_0x596b2e,_0x5ecf01,_0xcc94d9){if(_0x596b2e[_0xf28f('0x54')]['id']){delete _0x596b2e[_0xf28f('0x54')]['id'];}return db[_0xf28f('0x3a')][_0xf28f('0x56')]({'where':{'id':_0x596b2e[_0xf28f('0x4f')]['id']}})[_0xf28f('0x1f')](handleEntityNotFound(_0x5ecf01,null))[_0xf28f('0x1f')](function(_0x124f86){if(_0x124f86){return _0x124f86[_0xf28f('0x5e')](_0x596b2e[_0xf28f('0x54')]['ids']||[]);}return null;})[_0xf28f('0x1f')](respondWithResult(_0x5ecf01,null))[_0xf28f('0x29')](handleError(_0x5ecf01,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 52bba66..7db01b8 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 _0x2aae=['define','int_zendesk_configurations','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0x20ff3d,_0x85ff92){var _0x3dd358=function(_0x573480){while(--_0x573480){_0x20ff3d['push'](_0x20ff3d['shift']());}};_0x3dd358(++_0x85ff92);}(_0x2aae,0x13d));var _0xe2aa=function(_0x738f1,_0x526031){_0x738f1=_0x738f1-0x0;var _0x47bc8c=_0x2aae[_0x738f1];return _0x47bc8c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe2aa('0x0'))('api');var moment=require(_0xe2aa('0x1'));var BPromise=require(_0xe2aa('0x2'));var rp=require(_0xe2aa('0x3'));var fs=require('fs');var path=require(_0xe2aa('0x4'));var rimraf=require('rimraf');var config=require(_0xe2aa('0x5'));var attributes=require(_0xe2aa('0x6'));module['exports']=function(_0x10bd27,_0x31cf92){return _0x10bd27[_0xe2aa('0x7')]('ZendeskConfiguration',attributes,{'tableName':_0xe2aa('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x101b=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports'];(function(_0xc5715a,_0xdb4d97){var _0x19fb62=function(_0x894283){while(--_0x894283){_0xc5715a['push'](_0xc5715a['shift']());}};_0x19fb62(++_0xdb4d97);}(_0x101b,0x168));var _0xb101=function(_0x6cb201,_0x4f2d62){_0x6cb201=_0x6cb201-0x0;var _0xbcad63=_0x101b[_0x6cb201];return _0xbcad63;};'use strict';var _=require('lodash');var util=require(_0xb101('0x0'));var logger=require('../../config/logger')(_0xb101('0x1'));var moment=require(_0xb101('0x2'));var BPromise=require(_0xb101('0x3'));var rp=require(_0xb101('0x4'));var fs=require('fs');var path=require(_0xb101('0x5'));var rimraf=require(_0xb101('0x6'));var config=require(_0xb101('0x7'));var attributes=require(_0xb101('0x8'));module[_0xb101('0x9')]=function(_0x2b8527,_0x5185bd){return _0x2b8527['define']('ZendeskConfiguration',attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 32d8070..383783b 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 _0xb016=['result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0xbad2b4,_0x165d66){var _0x9304ef=function(_0x17aa50){while(--_0x17aa50){_0xbad2b4['push'](_0xbad2b4['shift']());}};_0x9304ef(++_0x165d66);}(_0xb016,0x1d0));var _0x6b01=function(_0x4cba33,_0x29fa55){_0x4cba33=_0x4cba33-0x0;var _0x39c238=_0xb016[_0x4cba33];return _0x39c238;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var moment=require(_0x6b01('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b01('0x3'));var db=require(_0x6b01('0x4'))['db'];var utils=require(_0x6b01('0x5'));var logger=require(_0x6b01('0x6'))(_0x6b01('0x7'));var config=require('../../config/environment');var jayson=require(_0x6b01('0x8'));var client=jayson['client'][_0x6b01('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x464fa4,_0x45a8e0,_0x2a35c1){return new BPromise(function(_0x2439c9,_0x1721ba){return client[_0x6b01('0xa')](_0x464fa4,_0x2a35c1)['then'](function(_0xd2f543){logger[_0x6b01('0xb')](_0x6b01('0xc'),_0x45a8e0,'request\x20sent');logger[_0x6b01('0xd')](_0x6b01('0xe'),_0x45a8e0,_0x6b01('0xf'),JSON[_0x6b01('0x10')](_0xd2f543));if(_0xd2f543[_0x6b01('0x11')]){if(_0xd2f543[_0x6b01('0x11')][_0x6b01('0x12')]===0x1f4){logger[_0x6b01('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x45a8e0,_0xd2f543[_0x6b01('0x11')]['message']);return _0x1721ba(_0xd2f543[_0x6b01('0x11')][_0x6b01('0x13')]);}logger['error'](_0x6b01('0xc'),_0x45a8e0,_0xd2f543[_0x6b01('0x11')][_0x6b01('0x13')]);return _0x2439c9(_0xd2f543['error'][_0x6b01('0x13')]);}else{logger[_0x6b01('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x45a8e0,_0x6b01('0xf'));_0x2439c9(_0xd2f543[_0x6b01('0x14')][_0x6b01('0x13')]);}})[_0x6b01('0x15')](function(_0x5a99cc){logger['error'](_0x6b01('0xc'),_0x45a8e0,_0x5a99cc);_0x1721ba(_0x5a99cc);});});} \ No newline at end of file +var _0x8f2f=['info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1dcd42,_0x2d208e){var _0x381a0f=function(_0x297d8f){while(--_0x297d8f){_0x1dcd42['push'](_0x1dcd42['shift']());}};_0x381a0f(++_0x2d208e);}(_0x8f2f,0x8f));var _0xf8f2=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x8f2f[_0x10004e];return _0x5af990;};'use strict';var _=require('lodash');var util=require(_0xf8f2('0x0'));var moment=require(_0xf8f2('0x1'));var BPromise=require(_0xf8f2('0x2'));var rs=require(_0xf8f2('0x3'));var fs=require('fs');var Redis=require(_0xf8f2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf8f2('0x5'));var logger=require('../../config/logger')(_0xf8f2('0x6'));var config=require(_0xf8f2('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x305bd0,_0x44de06,_0x27469c){return new BPromise(function(_0x234ac3,_0x4afbb5){return client[_0xf8f2('0x8')](_0x305bd0,_0x27469c)[_0xf8f2('0x9')](function(_0x261536){logger['info'](_0xf8f2('0xa'),_0x44de06,_0xf8f2('0xb'));logger['debug'](_0xf8f2('0xc'),_0x44de06,_0xf8f2('0xb'),JSON[_0xf8f2('0xd')](_0x261536));if(_0x261536[_0xf8f2('0xe')]){if(_0x261536[_0xf8f2('0xe')][_0xf8f2('0xf')]===0x1f4){logger[_0xf8f2('0xe')](_0xf8f2('0xa'),_0x44de06,_0x261536['error'][_0xf8f2('0x10')]);return _0x4afbb5(_0x261536[_0xf8f2('0xe')][_0xf8f2('0x10')]);}logger[_0xf8f2('0xe')](_0xf8f2('0xa'),_0x44de06,_0x261536[_0xf8f2('0xe')][_0xf8f2('0x10')]);return _0x234ac3(_0x261536['error']['message']);}else{logger[_0xf8f2('0x11')](_0xf8f2('0xa'),_0x44de06,_0xf8f2('0xb'));_0x234ac3(_0x261536[_0xf8f2('0x12')]['message']);}})[_0xf8f2('0x13')](function(_0x407cf9){logger[_0xf8f2('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x44de06,_0x407cf9);_0x4afbb5(_0x407cf9);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 7b42cd6..7f52023 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 _0xb7cf=['post','create','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb7cf,0xca));var _0xfb7c=function(_0x48ace4,_0x3ecb6d){_0x48ace4=_0x48ace4-0x0;var _0x1605a1=_0xb7cf[_0x48ace4];return _0x1605a1;};'use strict';var multer=require(_0xfb7c('0x0'));var util=require(_0xfb7c('0x1'));var path=require(_0xfb7c('0x2'));var timeout=require(_0xfb7c('0x3'));var express=require(_0xfb7c('0x4'));var router=express['Router']();var auth=require(_0xfb7c('0x5'));var interaction=require(_0xfb7c('0x6'));var config=require(_0xfb7c('0x7'));var controller=require(_0xfb7c('0x8'));router[_0xfb7c('0x9')]('/',auth[_0xfb7c('0xa')](),controller[_0xfb7c('0xb')]);router[_0xfb7c('0x9')](_0xfb7c('0xc'),auth[_0xfb7c('0xa')](),controller[_0xfb7c('0xd')]);router[_0xfb7c('0xe')]('/',auth[_0xfb7c('0xa')](),controller[_0xfb7c('0xf')]);router['put'](_0xfb7c('0xc'),auth[_0xfb7c('0xa')](),controller[_0xfb7c('0x10')]);router['delete'](_0xfb7c('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xfb7c('0x11')]=router; \ No newline at end of file +var _0x2eb1=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x41b616,_0x416029){var _0x111b0c=function(_0x288f5c){while(--_0x288f5c){_0x41b616['push'](_0x41b616['shift']());}};_0x111b0c(++_0x416029);}(_0x2eb1,0xb0));var _0x12eb=function(_0x1d058b,_0x3550d8){_0x1d058b=_0x1d058b-0x0;var _0x5403c0=_0x2eb1[_0x1d058b];return _0x5403c0;};'use strict';var multer=require(_0x12eb('0x0'));var util=require(_0x12eb('0x1'));var path=require('path');var timeout=require(_0x12eb('0x2'));var express=require(_0x12eb('0x3'));var router=express[_0x12eb('0x4')]();var auth=require(_0x12eb('0x5'));var interaction=require(_0x12eb('0x6'));var config=require('../../config/environment');var controller=require(_0x12eb('0x7'));router['get']('/',auth[_0x12eb('0x8')](),controller[_0x12eb('0x9')]);router[_0x12eb('0xa')](_0x12eb('0xb'),auth[_0x12eb('0x8')](),controller[_0x12eb('0xc')]);router[_0x12eb('0xd')]('/',auth[_0x12eb('0x8')](),controller['create']);router[_0x12eb('0xe')](_0x12eb('0xb'),auth[_0x12eb('0x8')](),controller[_0x12eb('0xf')]);router[_0x12eb('0x10')](_0x12eb('0xb'),auth['isAuthenticated'](),controller[_0x12eb('0x11')]);module[_0x12eb('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 9131be5..b6d06e5 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 _0xeddd=['BOOLEAN','sequelize','exports','ENUM','string','customVariable','STRING','variable'];(function(_0xdb2a17,_0x3c803c){var _0x42250f=function(_0x20dd40){while(--_0x20dd40){_0xdb2a17['push'](_0xdb2a17['shift']());}};_0x42250f(++_0x3c803c);}(_0xeddd,0x69));var _0xdedd=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xeddd[_0x11005e];return _0x29338f;};'use strict';var Sequelize=require(_0xdedd('0x0'));module[_0xdedd('0x1')]={'type':{'type':Sequelize[_0xdedd('0x2')](_0xdedd('0x3'),'variable',_0xdedd('0x4'),'keyValue'),'defaultValue':_0xdedd('0x3')},'content':{'type':Sequelize[_0xdedd('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xdedd('0x2')](_0xdedd('0x3'),_0xdedd('0x6'),_0xdedd('0x4'))},'keyContent':{'type':Sequelize[_0xdedd('0x5')]},'idField':{'type':Sequelize[_0xdedd('0x5')]},'nameField':{'type':Sequelize[_0xdedd('0x5')]},'customField':{'type':Sequelize[_0xdedd('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdedd('0x5')]}}; \ No newline at end of file +var _0xfaba=['variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','STRING'];(function(_0x454f6e,_0x13fc60){var _0x495e64=function(_0x33a5e3){while(--_0x33a5e3){_0x454f6e['push'](_0x454f6e['shift']());}};_0x495e64(++_0x13fc60);}(_0xfaba,0xa2));var _0xafab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfaba[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xafab('0x0'));module[_0xafab('0x1')]={'type':{'type':Sequelize[_0xafab('0x2')](_0xafab('0x3'),'variable',_0xafab('0x4'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0xafab('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xafab('0x2')]('string',_0xafab('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0xafab('0x5')]},'idField':{'type':Sequelize[_0xafab('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xafab('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xafab('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 056440c..e9a5e94 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 _0x44d7=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','error','stack','name','send','index','ZendeskField','fieldName','type','model','map','keys','query','filters','intersection'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x44d7,0x136));var _0x744d=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x44d7[_0x2b7764];return _0x848dcb;};'use strict';var pdf=require(_0x744d('0x0'));var emlformat=require(_0x744d('0x1'));var rimraf=require(_0x744d('0x2'));var zipdir=require(_0x744d('0x3'));var jsonpatch=require(_0x744d('0x4'));var rp=require(_0x744d('0x5'));var moment=require(_0x744d('0x6'));var BPromise=require(_0x744d('0x7'));var Mustache=require(_0x744d('0x8'));var util=require('util');var path=require(_0x744d('0x9'));var sox=require(_0x744d('0xa'));var csv=require(_0x744d('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x744d('0xc'));var squel=require(_0x744d('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x744d('0xb'));var querystring=require(_0x744d('0xe'));var Papa=require(_0x744d('0xf'));var Redis=require(_0x744d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x744d('0x11'));var as=require(_0x744d('0x12'));var hardwareService=require(_0x744d('0x13'));var logger=require('../../config/logger')(_0x744d('0x14'));var utils=require(_0x744d('0x15'));var config=require(_0x744d('0x16'));var db=require(_0x744d('0x17'))['db'];function respondWithStatusCode(_0x2eef7c,_0x3cd0b0){_0x3cd0b0=_0x3cd0b0||0xcc;return function(_0x5f3fa3){if(_0x5f3fa3){return _0x2eef7c[_0x744d('0x18')](_0x3cd0b0);}return _0x2eef7c[_0x744d('0x19')](_0x3cd0b0)[_0x744d('0x1a')]();};}function respondWithResult(_0x5ff3c9,_0x43ae4a){_0x43ae4a=_0x43ae4a||0xc8;return function(_0x594415){if(_0x594415){return _0x5ff3c9['status'](_0x43ae4a)[_0x744d('0x1b')](_0x594415);}};}function respondWithFilteredResult(_0x16f788,_0x46544b){return function(_0x30c228){if(_0x30c228){var _0x2bd52c=_0x30c228[_0x744d('0x1c')],_0x21ef84=_0x46544b[_0x744d('0x1d')],_0x30b071=_0x46544b[_0x744d('0x1d')]+_0x46544b[_0x744d('0x1e')],_0x28c6b5;if(_0x30b071>=_0x2bd52c){_0x30b071=_0x2bd52c;_0x28c6b5=0xc8;}else{_0x28c6b5=0xce;}_0x16f788[_0x744d('0x19')](_0x28c6b5);return _0x16f788[_0x744d('0x1f')]('Content-Range',_0x21ef84+'-'+_0x30b071+'/'+_0x2bd52c)[_0x744d('0x1b')](_0x30c228);}return null;};}function patchUpdates(_0x376531){return function(_0x5a3e3c){try{jsonpatch[_0x744d('0x20')](_0x5a3e3c,_0x376531,!![]);}catch(_0x39ba7d){return BPromise[_0x744d('0x21')](_0x39ba7d);}return _0x5a3e3c['save']();};}function saveUpdates(_0xf20936,_0x48b681){return function(_0x2dbf3b){if(_0x2dbf3b){return _0x2dbf3b[_0x744d('0x22')](_0xf20936)[_0x744d('0x23')](function(_0x99452f){return _0x99452f;});}return null;};}function removeEntity(_0x331f73,_0x3973ea){return function(_0x4048c2){if(_0x4048c2){return _0x4048c2['destroy']()[_0x744d('0x23')](function(){_0x331f73['status'](0xcc)[_0x744d('0x1a')]();});}};}function handleEntityNotFound(_0x51b6f4,_0x507cf3){return function(_0x2bc88d){if(!_0x2bc88d){_0x51b6f4[_0x744d('0x18')](0x194);}return _0x2bc88d;};}function handleError(_0x1580e4,_0x5a54c1){_0x5a54c1=_0x5a54c1||0x1f4;return function(_0x23e7c2){logger[_0x744d('0x24')](_0x23e7c2[_0x744d('0x25')]);if(_0x23e7c2[_0x744d('0x26')]){delete _0x23e7c2[_0x744d('0x26')];}_0x1580e4['status'](_0x5a54c1)[_0x744d('0x27')](_0x23e7c2);};}exports[_0x744d('0x28')]=function(_0x160716,_0x360822){var _0x1a2b63={},_0x15094c={},_0x915511={'count':0x0,'rows':[]};var _0x3ab0e5=_['map'](db[_0x744d('0x29')]['rawAttributes'],function(_0x2e10ee){return{'name':_0x2e10ee[_0x744d('0x2a')],'type':_0x2e10ee[_0x744d('0x2b')]['key']};});_0x15094c[_0x744d('0x2c')]=_[_0x744d('0x2d')](_0x3ab0e5,_0x744d('0x26'));_0x15094c['query']=_[_0x744d('0x2e')](_0x160716[_0x744d('0x2f')]);_0x15094c[_0x744d('0x30')]=_[_0x744d('0x31')](_0x15094c[_0x744d('0x2c')],_0x15094c[_0x744d('0x2f')]);_0x1a2b63[_0x744d('0x32')]=_[_0x744d('0x31')](_0x15094c[_0x744d('0x2c')],qs[_0x744d('0x33')](_0x160716['query'][_0x744d('0x33')]));_0x1a2b63[_0x744d('0x32')]=_0x1a2b63[_0x744d('0x32')][_0x744d('0x34')]?_0x1a2b63[_0x744d('0x32')]:_0x15094c[_0x744d('0x2c')];if(!_0x160716[_0x744d('0x2f')][_0x744d('0x35')](_0x744d('0x36'))){_0x1a2b63[_0x744d('0x1e')]=qs[_0x744d('0x1e')](_0x160716[_0x744d('0x2f')]['limit']);_0x1a2b63[_0x744d('0x1d')]=qs[_0x744d('0x1d')](_0x160716[_0x744d('0x2f')]['offset']);}_0x1a2b63[_0x744d('0x37')]=qs[_0x744d('0x38')](_0x160716[_0x744d('0x2f')][_0x744d('0x38')]);_0x1a2b63[_0x744d('0x39')]=qs[_0x744d('0x30')](_[_0x744d('0x3a')](_0x160716[_0x744d('0x2f')],_0x15094c[_0x744d('0x30')]),_0x3ab0e5);if(_0x160716[_0x744d('0x2f')][_0x744d('0x3b')]){_0x1a2b63['where']=_['merge'](_0x1a2b63[_0x744d('0x39')],{'$or':_['map'](_0x3ab0e5,function(_0x2df804){if(_0x2df804[_0x744d('0x2b')]!=='VIRTUAL'){var _0x52b0b0={};_0x52b0b0[_0x2df804[_0x744d('0x26')]]={'$like':'%'+_0x160716[_0x744d('0x2f')][_0x744d('0x3b')]+'%'};return _0x52b0b0;}})});}_0x1a2b63=_[_0x744d('0x3c')]({},_0x1a2b63,_0x160716[_0x744d('0x3d')]);var _0x239d07={'where':_0x1a2b63[_0x744d('0x39')]};return db[_0x744d('0x29')][_0x744d('0x1c')](_0x239d07)[_0x744d('0x23')](function(_0x271865){_0x915511[_0x744d('0x1c')]=_0x271865;if(_0x160716[_0x744d('0x2f')][_0x744d('0x3e')]){_0x1a2b63[_0x744d('0x3f')]=[{'all':!![]}];}return db[_0x744d('0x29')][_0x744d('0x40')](_0x1a2b63);})['then'](function(_0x3c6603){_0x915511[_0x744d('0x41')]=_0x3c6603;return _0x915511;})['then'](respondWithFilteredResult(_0x360822,_0x1a2b63))[_0x744d('0x42')](handleError(_0x360822,null));};exports['show']=function(_0x44c947,_0x120945){var _0x36b377={'raw':!![],'where':{'id':_0x44c947[_0x744d('0x43')]['id']}},_0x32f608={};_0x32f608[_0x744d('0x2c')]=_[_0x744d('0x2e')](db[_0x744d('0x29')]['rawAttributes']);_0x32f608[_0x744d('0x2f')]=_['keys'](_0x44c947[_0x744d('0x2f')]);_0x32f608[_0x744d('0x30')]=_[_0x744d('0x31')](_0x32f608[_0x744d('0x2c')],_0x32f608[_0x744d('0x2f')]);_0x36b377['attributes']=_[_0x744d('0x31')](_0x32f608[_0x744d('0x2c')],qs['fields'](_0x44c947[_0x744d('0x2f')][_0x744d('0x33')]));_0x36b377[_0x744d('0x32')]=_0x36b377[_0x744d('0x32')]['length']?_0x36b377['attributes']:_0x32f608[_0x744d('0x2c')];if(_0x44c947['query']['includeAll']){_0x36b377[_0x744d('0x3f')]=[{'all':!![]}];}_0x36b377=_['merge']({},_0x36b377,_0x44c947['options']);return db[_0x744d('0x29')][_0x744d('0x44')](_0x36b377)[_0x744d('0x23')](handleEntityNotFound(_0x120945,null))[_0x744d('0x23')](respondWithResult(_0x120945,null))[_0x744d('0x42')](handleError(_0x120945,null));};exports[_0x744d('0x45')]=function(_0x26ff77,_0x21d8c1){return db['ZendeskField'][_0x744d('0x45')](_0x26ff77[_0x744d('0x46')],{})[_0x744d('0x23')](respondWithResult(_0x21d8c1,0xc9))['catch'](handleError(_0x21d8c1,null));};exports[_0x744d('0x22')]=function(_0x3032f2,_0x1e7c45){if(_0x3032f2[_0x744d('0x46')]['id']){delete _0x3032f2[_0x744d('0x46')]['id'];}return db[_0x744d('0x29')][_0x744d('0x44')]({'where':{'id':_0x3032f2[_0x744d('0x43')]['id']}})[_0x744d('0x23')](handleEntityNotFound(_0x1e7c45,null))[_0x744d('0x23')](saveUpdates(_0x3032f2[_0x744d('0x46')],null))[_0x744d('0x23')](respondWithResult(_0x1e7c45,null))[_0x744d('0x42')](handleError(_0x1e7c45,null));};exports[_0x744d('0x47')]=function(_0x4cfef0,_0x497246){return db['ZendeskField']['find']({'where':{'id':_0x4cfef0[_0x744d('0x43')]['id']}})[_0x744d('0x23')](handleEntityNotFound(_0x497246,null))['then'](removeEntity(_0x497246,null))[_0x744d('0x42')](handleError(_0x497246,null));}; \ No newline at end of file +var _0x2854=['index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','merge','VIRTUAL','options','ZendeskField','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','json','count','offset','status','set','Content-Range','reject','then','error','name','send'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2854,0x6b));var _0x4285=function(_0x3ae10b,_0x49ae06){_0x3ae10b=_0x3ae10b-0x0;var _0x887af2=_0x2854[_0x3ae10b];return _0x887af2;};'use strict';var pdf=require(_0x4285('0x0'));var emlformat=require(_0x4285('0x1'));var rimraf=require(_0x4285('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4285('0x3'));var moment=require(_0x4285('0x4'));var BPromise=require(_0x4285('0x5'));var Mustache=require(_0x4285('0x6'));var util=require('util');var path=require(_0x4285('0x7'));var sox=require(_0x4285('0x8'));var csv=require(_0x4285('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4285('0xa'));var squel=require(_0x4285('0xb'));var crypto=require(_0x4285('0xc'));var jsforce=require(_0x4285('0xd'));var deskjs=require(_0x4285('0xe'));var toCsv=require(_0x4285('0x9'));var querystring=require(_0x4285('0xf'));var Papa=require(_0x4285('0x10'));var Redis=require(_0x4285('0x11'));var authService=require(_0x4285('0x12'));var qs=require(_0x4285('0x13'));var as=require(_0x4285('0x14'));var hardwareService=require(_0x4285('0x15'));var logger=require(_0x4285('0x16'))(_0x4285('0x17'));var utils=require('../../config/utils');var config=require(_0x4285('0x18'));var db=require(_0x4285('0x19'))['db'];function respondWithStatusCode(_0x391ea4,_0x57a2fc){_0x57a2fc=_0x57a2fc||0xcc;return function(_0x4080cb){if(_0x4080cb){return _0x391ea4['sendStatus'](_0x57a2fc);}return _0x391ea4['status'](_0x57a2fc)['end']();};}function respondWithResult(_0x549cd0,_0x47b0db){_0x47b0db=_0x47b0db||0xc8;return function(_0x4dff04){if(_0x4dff04){return _0x549cd0['status'](_0x47b0db)[_0x4285('0x1a')](_0x4dff04);}};}function respondWithFilteredResult(_0x5e92ff,_0x34904a){return function(_0x25fa9f){if(_0x25fa9f){var _0x1eed1d=_0x25fa9f[_0x4285('0x1b')],_0x4785cd=_0x34904a[_0x4285('0x1c')],_0x2fcef3=_0x34904a[_0x4285('0x1c')]+_0x34904a['limit'],_0x564f68;if(_0x2fcef3>=_0x1eed1d){_0x2fcef3=_0x1eed1d;_0x564f68=0xc8;}else{_0x564f68=0xce;}_0x5e92ff[_0x4285('0x1d')](_0x564f68);return _0x5e92ff[_0x4285('0x1e')](_0x4285('0x1f'),_0x4785cd+'-'+_0x2fcef3+'/'+_0x1eed1d)[_0x4285('0x1a')](_0x25fa9f);}return null;};}function patchUpdates(_0x439104){return function(_0x3368cb){try{jsonpatch['apply'](_0x3368cb,_0x439104,!![]);}catch(_0x46e037){return BPromise[_0x4285('0x20')](_0x46e037);}return _0x3368cb['save']();};}function saveUpdates(_0x5b59ee,_0x542f05){return function(_0x35979e){if(_0x35979e){return _0x35979e['update'](_0x5b59ee)[_0x4285('0x21')](function(_0x5ac500){return _0x5ac500;});}return null;};}function removeEntity(_0x4a71f3,_0xe2c037){return function(_0xd9578){if(_0xd9578){return _0xd9578['destroy']()[_0x4285('0x21')](function(){_0x4a71f3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1da66e,_0x45bc4e){return function(_0x21c78f){if(!_0x21c78f){_0x1da66e['sendStatus'](0x194);}return _0x21c78f;};}function handleError(_0xe49cab,_0x153f13){_0x153f13=_0x153f13||0x1f4;return function(_0x24eb2){logger[_0x4285('0x22')](_0x24eb2['stack']);if(_0x24eb2[_0x4285('0x23')]){delete _0x24eb2[_0x4285('0x23')];}_0xe49cab['status'](_0x153f13)[_0x4285('0x24')](_0x24eb2);};}exports[_0x4285('0x25')]=function(_0x30e7de,_0x14d3a6){var _0x46fa15={},_0x566c80={},_0x2849ad={'count':0x0,'rows':[]};var _0x447cce=_[_0x4285('0x26')](db['ZendeskField'][_0x4285('0x27')],function(_0x1b1633){return{'name':_0x1b1633[_0x4285('0x28')],'type':_0x1b1633[_0x4285('0x29')][_0x4285('0x2a')]};});_0x566c80[_0x4285('0x2b')]=_[_0x4285('0x26')](_0x447cce,'name');_0x566c80[_0x4285('0x2c')]=_[_0x4285('0x2d')](_0x30e7de[_0x4285('0x2c')]);_0x566c80['filters']=_[_0x4285('0x2e')](_0x566c80[_0x4285('0x2b')],_0x566c80[_0x4285('0x2c')]);_0x46fa15[_0x4285('0x2f')]=_[_0x4285('0x2e')](_0x566c80[_0x4285('0x2b')],qs[_0x4285('0x30')](_0x30e7de[_0x4285('0x2c')][_0x4285('0x30')]));_0x46fa15[_0x4285('0x2f')]=_0x46fa15[_0x4285('0x2f')]['length']?_0x46fa15[_0x4285('0x2f')]:_0x566c80[_0x4285('0x2b')];if(!_0x30e7de[_0x4285('0x2c')][_0x4285('0x31')](_0x4285('0x32'))){_0x46fa15[_0x4285('0x33')]=qs['limit'](_0x30e7de[_0x4285('0x2c')][_0x4285('0x33')]);_0x46fa15['offset']=qs['offset'](_0x30e7de[_0x4285('0x2c')][_0x4285('0x1c')]);}_0x46fa15[_0x4285('0x34')]=qs[_0x4285('0x35')](_0x30e7de[_0x4285('0x2c')][_0x4285('0x35')]);_0x46fa15['where']=qs[_0x4285('0x36')](_[_0x4285('0x37')](_0x30e7de['query'],_0x566c80[_0x4285('0x36')]),_0x447cce);if(_0x30e7de[_0x4285('0x2c')]['filter']){_0x46fa15[_0x4285('0x38')]=_[_0x4285('0x39')](_0x46fa15[_0x4285('0x38')],{'$or':_[_0x4285('0x26')](_0x447cce,function(_0x4ec9dc){if(_0x4ec9dc[_0x4285('0x29')]!==_0x4285('0x3a')){var _0x3db018={};_0x3db018[_0x4ec9dc['name']]={'$like':'%'+_0x30e7de[_0x4285('0x2c')]['filter']+'%'};return _0x3db018;}})});}_0x46fa15=_[_0x4285('0x39')]({},_0x46fa15,_0x30e7de[_0x4285('0x3b')]);var _0x37c7d5={'where':_0x46fa15['where']};return db[_0x4285('0x3c')][_0x4285('0x1b')](_0x37c7d5)[_0x4285('0x21')](function(_0x261f93){_0x2849ad[_0x4285('0x1b')]=_0x261f93;if(_0x30e7de[_0x4285('0x2c')][_0x4285('0x3d')]){_0x46fa15[_0x4285('0x3e')]=[{'all':!![]}];}return db[_0x4285('0x3c')][_0x4285('0x3f')](_0x46fa15);})['then'](function(_0x549db7){_0x2849ad[_0x4285('0x40')]=_0x549db7;return _0x2849ad;})[_0x4285('0x21')](respondWithFilteredResult(_0x14d3a6,_0x46fa15))[_0x4285('0x41')](handleError(_0x14d3a6,null));};exports[_0x4285('0x42')]=function(_0xfe619,_0x3592ac){var _0x510de2={'raw':!![],'where':{'id':_0xfe619[_0x4285('0x43')]['id']}},_0x313df1={};_0x313df1['model']=_['keys'](db[_0x4285('0x3c')]['rawAttributes']);_0x313df1[_0x4285('0x2c')]=_[_0x4285('0x2d')](_0xfe619['query']);_0x313df1['filters']=_['intersection'](_0x313df1[_0x4285('0x2b')],_0x313df1[_0x4285('0x2c')]);_0x510de2[_0x4285('0x2f')]=_['intersection'](_0x313df1['model'],qs[_0x4285('0x30')](_0xfe619[_0x4285('0x2c')][_0x4285('0x30')]));_0x510de2[_0x4285('0x2f')]=_0x510de2[_0x4285('0x2f')]['length']?_0x510de2[_0x4285('0x2f')]:_0x313df1[_0x4285('0x2b')];if(_0xfe619[_0x4285('0x2c')][_0x4285('0x3d')]){_0x510de2['include']=[{'all':!![]}];}_0x510de2=_[_0x4285('0x39')]({},_0x510de2,_0xfe619[_0x4285('0x3b')]);return db[_0x4285('0x3c')]['find'](_0x510de2)[_0x4285('0x21')](handleEntityNotFound(_0x3592ac,null))[_0x4285('0x21')](respondWithResult(_0x3592ac,null))[_0x4285('0x41')](handleError(_0x3592ac,null));};exports[_0x4285('0x44')]=function(_0x142ec0,_0x8cb34b){return db['ZendeskField'][_0x4285('0x44')](_0x142ec0[_0x4285('0x45')],{})[_0x4285('0x21')](respondWithResult(_0x8cb34b,0xc9))[_0x4285('0x41')](handleError(_0x8cb34b,null));};exports[_0x4285('0x46')]=function(_0x3396fe,_0x16ef4a){if(_0x3396fe['body']['id']){delete _0x3396fe[_0x4285('0x45')]['id'];}return db[_0x4285('0x3c')][_0x4285('0x47')]({'where':{'id':_0x3396fe[_0x4285('0x43')]['id']}})[_0x4285('0x21')](handleEntityNotFound(_0x16ef4a,null))['then'](saveUpdates(_0x3396fe['body'],null))[_0x4285('0x21')](respondWithResult(_0x16ef4a,null))[_0x4285('0x41')](handleError(_0x16ef4a,null));};exports['destroy']=function(_0x112906,_0x346e95){return db[_0x4285('0x3c')][_0x4285('0x47')]({'where':{'id':_0x112906[_0x4285('0x43')]['id']}})['then'](handleEntityNotFound(_0x346e95,null))[_0x4285('0x21')](removeEntity(_0x346e95,null))[_0x4285('0x41')](handleError(_0x346e95,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 0c7b10c..101198d 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(_0x4cba29,_0x1f219f){var _0x5645ef=function(_0x3f968b){while(--_0x3f968b){_0x4cba29['push'](_0x4cba29['shift']());}};_0x5645ef(++_0x1f219f);}(_0xb574,0x106));var _0x4b57=function(_0x148b7d,_0x8de94c){_0x148b7d=_0x148b7d-0x0;var _0xc59cbb=_0xb574[_0x148b7d];return _0xc59cbb;};'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 _0xb9be=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','ZendeskField','int_zendesk_fields','zendesk_unique_index'];(function(_0x462a82,_0x5ba0e4){var _0x44ce9b=function(_0x3dd916){while(--_0x3dd916){_0x462a82['push'](_0x462a82['shift']());}};_0x44ce9b(++_0x5ba0e4);}(_0xb9be,0xc5));var _0xeb9b=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0xb9be[_0x166742];return _0xb7814a;};'use strict';var _=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var logger=require(_0xeb9b('0x2'))(_0xeb9b('0x3'));var moment=require(_0xeb9b('0x4'));var BPromise=require(_0xeb9b('0x5'));var rp=require(_0xeb9b('0x6'));var fs=require('fs');var path=require(_0xeb9b('0x7'));var rimraf=require(_0xeb9b('0x8'));var config=require('../../config/environment');var attributes=require('./intZendeskField.attributes');module[_0xeb9b('0x9')]=function(_0x181810,_0x2529cb){return _0x181810['define'](_0xeb9b('0xa'),attributes,{'tableName':_0xeb9b('0xb'),'paranoid':![],'indexes':[{'name':_0xeb9b('0xc'),'fields':[_0xeb9b('0xd'),_0xeb9b('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 902f19e..8dfc4f1 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 _0x9513=['catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x21244f,_0x3c24e3){var _0x1fad66=function(_0x264d8e){while(--_0x264d8e){_0x21244f['push'](_0x21244f['shift']());}};_0x1fad66(++_0x3c24e3);}(_0x9513,0x121));var _0x3951=function(_0x2df51f,_0x1de62f){_0x2df51f=_0x2df51f-0x0;var _0x38142e=_0x9513[_0x2df51f];return _0x38142e;};'use strict';var _=require(_0x3951('0x0'));var util=require(_0x3951('0x1'));var moment=require('moment');var BPromise=require(_0x3951('0x2'));var rs=require(_0x3951('0x3'));var fs=require('fs');var Redis=require(_0x3951('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3951('0x5'))(_0x3951('0x6'));var config=require(_0x3951('0x7'));var jayson=require(_0x3951('0x8'));var client=jayson[_0x3951('0x9')][_0x3951('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4672e2,_0x21e606,_0x331f05){return new BPromise(function(_0x4d0c4c,_0x333648){return client[_0x3951('0xb')](_0x4672e2,_0x331f05)[_0x3951('0xc')](function(_0x24e8c5){logger[_0x3951('0xd')](_0x3951('0xe'),_0x21e606,_0x3951('0xf'));logger[_0x3951('0x10')](_0x3951('0x11'),_0x21e606,'request\x20sent',JSON[_0x3951('0x12')](_0x24e8c5));if(_0x24e8c5[_0x3951('0x13')]){if(_0x24e8c5[_0x3951('0x13')][_0x3951('0x14')]===0x1f4){logger[_0x3951('0x13')](_0x3951('0xe'),_0x21e606,_0x24e8c5['error'][_0x3951('0x15')]);return _0x333648(_0x24e8c5[_0x3951('0x13')][_0x3951('0x15')]);}logger['error'](_0x3951('0xe'),_0x21e606,_0x24e8c5[_0x3951('0x13')][_0x3951('0x15')]);return _0x4d0c4c(_0x24e8c5[_0x3951('0x13')][_0x3951('0x15')]);}else{logger[_0x3951('0xd')]('ZendeskField,\x20%s,\x20%s',_0x21e606,'request\x20sent');_0x4d0c4c(_0x24e8c5[_0x3951('0x16')][_0x3951('0x15')]);}})[_0x3951('0x17')](function(_0x208f6c){logger[_0x3951('0x13')](_0x3951('0xe'),_0x21e606,_0x208f6c);_0x333648(_0x208f6c);});});} \ No newline at end of file +var _0x9b1b=['ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x9b1b,0xc4));var _0xb9b1=function(_0x343a9b,_0x1c7afd){_0x343a9b=_0x343a9b-0x0;var _0x99d256=_0x9b1b[_0x343a9b];return _0x99d256;};'use strict';var _=require(_0xb9b1('0x0'));var util=require(_0xb9b1('0x1'));var moment=require('moment');var BPromise=require(_0xb9b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9b1('0x3'))['db'];var utils=require(_0xb9b1('0x4'));var logger=require(_0xb9b1('0x5'))(_0xb9b1('0x6'));var config=require('../../config/environment');var jayson=require(_0xb9b1('0x7'));var client=jayson[_0xb9b1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1be3d5,_0x138700,_0x5a7922){return new BPromise(function(_0x8d9ad3,_0x2211ae){return client[_0xb9b1('0x9')](_0x1be3d5,_0x5a7922)['then'](function(_0x1fdb93){logger[_0xb9b1('0xa')](_0xb9b1('0xb'),_0x138700,_0xb9b1('0xc'));logger[_0xb9b1('0xd')](_0xb9b1('0xe'),_0x138700,_0xb9b1('0xc'),JSON[_0xb9b1('0xf')](_0x1fdb93));if(_0x1fdb93['error']){if(_0x1fdb93[_0xb9b1('0x10')][_0xb9b1('0x11')]===0x1f4){logger[_0xb9b1('0x10')](_0xb9b1('0xb'),_0x138700,_0x1fdb93[_0xb9b1('0x10')][_0xb9b1('0x12')]);return _0x2211ae(_0x1fdb93[_0xb9b1('0x10')][_0xb9b1('0x12')]);}logger['error'](_0xb9b1('0xb'),_0x138700,_0x1fdb93['error'][_0xb9b1('0x12')]);return _0x8d9ad3(_0x1fdb93['error'][_0xb9b1('0x12')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x138700,'request\x20sent');_0x8d9ad3(_0x1fdb93[_0xb9b1('0x13')][_0xb9b1('0x12')]);}})[_0xb9b1('0x14')](function(_0x4cd5a0){logger[_0xb9b1('0x10')]('ZendeskField,\x20%s,\x20%s',_0x138700,_0x4cd5a0);_0x2211ae(_0x4cd5a0);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index cd1bebd..8483720 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 _0xb30e=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','/:id/configurations','getConfigurations','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x3572cb,_0x4149d3){var _0x33a398=function(_0x163e27){while(--_0x163e27){_0x3572cb['push'](_0x3572cb['shift']());}};_0x33a398(++_0x4149d3);}(_0xb30e,0xb9));var _0xeb30=function(_0x1bd230,_0x1da01e){_0x1bd230=_0x1bd230-0x0;var _0x19a3e3=_0xb30e[_0x1bd230];return _0x19a3e3;};'use strict';var multer=require(_0xeb30('0x0'));var util=require(_0xeb30('0x1'));var path=require(_0xeb30('0x2'));var timeout=require(_0xeb30('0x3'));var express=require(_0xeb30('0x4'));var router=express[_0xeb30('0x5')]();var auth=require(_0xeb30('0x6'));var interaction=require(_0xeb30('0x7'));var config=require(_0xeb30('0x8'));var controller=require(_0xeb30('0x9'));router[_0xeb30('0xa')]('/',auth[_0xeb30('0xb')](),controller['index']);router['get']('/:id',auth[_0xeb30('0xb')](),controller['show']);router['get'](_0xeb30('0xc'),auth[_0xeb30('0xb')](),controller[_0xeb30('0xd')]);router[_0xeb30('0xa')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xeb30('0xe')]('/',auth[_0xeb30('0xb')](),controller[_0xeb30('0xf')]);router[_0xeb30('0xe')](_0xeb30('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xeb30('0x10')](_0xeb30('0x11'),auth[_0xeb30('0xb')](),controller[_0xeb30('0x12')]);router[_0xeb30('0x13')](_0xeb30('0x11'),auth[_0xeb30('0xb')](),controller['destroy']);module[_0xeb30('0x14')]=router; \ No newline at end of file +var _0xace2=['addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0xe9b2a1,_0x24b10f){var _0x4aba13=function(_0x332268){while(--_0x332268){_0xe9b2a1['push'](_0xe9b2a1['shift']());}};_0x4aba13(++_0x24b10f);}(_0xace2,0xc6));var _0x2ace=function(_0x1e1020,_0xd64a27){_0x1e1020=_0x1e1020-0x0;var _0x464719=_0xace2[_0x1e1020];return _0x464719;};'use strict';var multer=require(_0x2ace('0x0'));var util=require(_0x2ace('0x1'));var path=require('path');var timeout=require(_0x2ace('0x2'));var express=require('express');var router=express[_0x2ace('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x2ace('0x4'));var config=require(_0x2ace('0x5'));var controller=require(_0x2ace('0x6'));router[_0x2ace('0x7')]('/',auth[_0x2ace('0x8')](),controller[_0x2ace('0x9')]);router[_0x2ace('0x7')](_0x2ace('0xa'),auth[_0x2ace('0x8')](),controller[_0x2ace('0xb')]);router[_0x2ace('0x7')](_0x2ace('0xc'),auth[_0x2ace('0x8')](),controller[_0x2ace('0xd')]);router[_0x2ace('0x7')](_0x2ace('0xe'),auth[_0x2ace('0x8')](),controller[_0x2ace('0xf')]);router[_0x2ace('0x10')]('/',auth[_0x2ace('0x8')](),controller[_0x2ace('0x11')]);router[_0x2ace('0x10')](_0x2ace('0xc'),auth[_0x2ace('0x8')](),controller[_0x2ace('0x12')]);router[_0x2ace('0x13')]('/:id',auth[_0x2ace('0x8')](),controller[_0x2ace('0x14')]);router[_0x2ace('0x15')](_0x2ace('0xa'),auth[_0x2ace('0x8')](),controller[_0x2ace('0x16')]);module[_0x2ace('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 067f1ba..8f18b98 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 _0xeecf=['STRING','exports'];(function(_0x5998d0,_0x24ad81){var _0x47149d=function(_0x5e4d63){while(--_0x5e4d63){_0x5998d0['push'](_0x5998d0['shift']());}};_0x47149d(++_0x24ad81);}(_0xeecf,0xaf));var _0xfeec=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xeecf[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0xfeec('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xfeec('0x1')]},'zone':{'type':Sequelize[_0xfeec('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xfeec('0x1')]},'code':{'type':Sequelize[_0xfeec('0x1')]},'refreshToken':{'type':Sequelize[_0xfeec('0x1')]}}; \ No newline at end of file +var _0x0d91=['exports','STRING','sequelize'];(function(_0x3d9fa4,_0xfbfd60){var _0x2a99ca=function(_0xdc3942){while(--_0xdc3942){_0x3d9fa4['push'](_0x3d9fa4['shift']());}};_0x2a99ca(++_0xfbfd60);}(_0x0d91,0x1f4));var _0x10d9=function(_0x520945,_0x28b144){_0x520945=_0x520945-0x0;var _0x17067a=_0x0d91[_0x520945];return _0x17067a;};'use strict';var Sequelize=require(_0x10d9('0x0'));module[_0x10d9('0x1')]={'name':{'type':Sequelize[_0x10d9('0x2')]},'description':{'type':Sequelize[_0x10d9('0x2')]},'host':{'type':Sequelize[_0x10d9('0x2')]},'zone':{'type':Sequelize[_0x10d9('0x2')]},'clientId':{'type':Sequelize[_0x10d9('0x2')]},'clientSecret':{'type':Sequelize[_0x10d9('0x2')]},'serverUrl':{'type':Sequelize['STRING']},'code':{'type':Sequelize[_0x10d9('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 15232ad..513902b 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 _0x353d=['destroy','stack','name','index','ZohoAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','then','includeAll','include','rows','catch','params','merge','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zoho.eu','com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Subject','Description','WhoId','Call_Result','remove','includes','api_name','push','display_label','custom_field','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../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\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','info','result','status','end','json','count','offset','limit','set','apply','reject','update'];(function(_0x55e06c,_0x3f9052){var _0x797166=function(_0x291a80){while(--_0x291a80){_0x55e06c['push'](_0x55e06c['shift']());}};_0x797166(++_0x3f9052);}(_0x353d,0x174));var _0xd353=function(_0x308dcc,_0x2d1178){_0x308dcc=_0x308dcc-0x0;var _0x361717=_0x353d[_0x308dcc];return _0x361717;};'use strict';var pdf=require(_0xd353('0x0'));var emlformat=require(_0xd353('0x1'));var rimraf=require(_0xd353('0x2'));var zipdir=require(_0xd353('0x3'));var jsonpatch=require(_0xd353('0x4'));var rp=require(_0xd353('0x5'));var moment=require(_0xd353('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xd353('0x7'));var util=require(_0xd353('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xd353('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd353('0xa'));var crypto=require(_0xd353('0xb'));var jsforce=require(_0xd353('0xc'));var deskjs=require(_0xd353('0xd'));var toCsv=require(_0xd353('0x9'));var querystring=require(_0xd353('0xe'));var Papa=require(_0xd353('0xf'));var Redis=require(_0xd353('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd353('0x11'));var hardwareService=require(_0xd353('0x12'));var logger=require(_0xd353('0x13'))(_0xd353('0x14'));var utils=require('../../config/utils');var config=require(_0xd353('0x15'));var db=require(_0xd353('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xd353('0x17'));var client=jayson[_0xd353('0x18')][_0xd353('0x19')]({'port':0x232a});function checkPasswordPattern(_0x3d0024,_0x11e4fe,_0x3cc629){if(_0x3cc629){var _0xfff071=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xfff071[_0xd353('0x1a')](_0x11e4fe)){return _0x3d0024;}else{throw new db['Sequelize'][(_0xd353('0x1b'))](_0xd353('0x1c'));}}else{return _0x3d0024;}}function respondWithRpcPromise(_0x415c48,_0x3eca41,_0x404792,_0x5c708e){return new BPromise(function(_0x5385b5,_0x43e29c){var _0x33229a=_0x5c708e||client;return _0x33229a['request'](_0x415c48,_0x404792)['then'](function(_0x4d6a89){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x3eca41,_0xd353('0x1d'));logger['debug'](_0xd353('0x1e'),_0x3eca41,_0xd353('0x1d'),JSON[_0xd353('0x1f')](_0x4d6a89));if(_0x4d6a89[_0xd353('0x20')]){if(_0x4d6a89['error'][_0xd353('0x21')]===0x1f4){logger[_0xd353('0x20')](_0xd353('0x22'),_0x3eca41,_0x4d6a89[_0xd353('0x20')][_0xd353('0x23')]);return _0x43e29c(_0x4d6a89[_0xd353('0x20')][_0xd353('0x23')]);}logger[_0xd353('0x20')]('ZohoAccount,\x20%s,\x20%s',_0x3eca41,_0x4d6a89['error'][_0xd353('0x23')]);return _0x5385b5(_0x4d6a89[_0xd353('0x20')]['message']);}else{logger[_0xd353('0x24')]('ZohoAccount,\x20%s,\x20%s',_0x3eca41,_0xd353('0x1d'));_0x5385b5(_0x4d6a89[_0xd353('0x25')][_0xd353('0x23')]);}})['catch'](function(_0x4f62cf){logger[_0xd353('0x20')]('ZohoAccount,\x20%s,\x20%s',_0x3eca41,_0x4f62cf);_0x43e29c(_0x4f62cf);});});}function respondWithStatusCode(_0x598e2c,_0x486f53){_0x486f53=_0x486f53||0xcc;return function(_0x31371c){if(_0x31371c){return _0x598e2c['sendStatus'](_0x486f53);}return _0x598e2c[_0xd353('0x26')](_0x486f53)[_0xd353('0x27')]();};}function respondWithResult(_0x7645f5,_0x512852){_0x512852=_0x512852||0xc8;return function(_0x5e7e5e){if(_0x5e7e5e){return _0x7645f5[_0xd353('0x26')](_0x512852)[_0xd353('0x28')](_0x5e7e5e);}};}function respondWithFilteredResult(_0x555c2c,_0x1fcc7b){return function(_0x23b8cc){if(_0x23b8cc){var _0x121454=_0x23b8cc[_0xd353('0x29')],_0x33477e=_0x1fcc7b[_0xd353('0x2a')],_0x1af2cb=_0x1fcc7b[_0xd353('0x2a')]+_0x1fcc7b[_0xd353('0x2b')],_0x498ac2;if(_0x1af2cb>=_0x121454){_0x1af2cb=_0x121454;_0x498ac2=0xc8;}else{_0x498ac2=0xce;}_0x555c2c[_0xd353('0x26')](_0x498ac2);return _0x555c2c[_0xd353('0x2c')]('Content-Range',_0x33477e+'-'+_0x1af2cb+'/'+_0x121454)[_0xd353('0x28')](_0x23b8cc);}return null;};}function patchUpdates(_0x215308){return function(_0x1fc4f9){try{jsonpatch[_0xd353('0x2d')](_0x1fc4f9,_0x215308,!![]);}catch(_0x3364ad){return BPromise[_0xd353('0x2e')](_0x3364ad);}return _0x1fc4f9['save']();};}function saveUpdates(_0xd61f7b,_0x2cbe66){return function(_0x3cf767){if(_0x3cf767){return _0x3cf767[_0xd353('0x2f')](_0xd61f7b)['then'](function(_0x59ca83){return _0x59ca83;});}return null;};}function removeEntity(_0x39c8d9,_0x3517e1){return function(_0x3c7bef){if(_0x3c7bef){return _0x3c7bef[_0xd353('0x30')]()['then'](function(){_0x39c8d9[_0xd353('0x26')](0xcc)[_0xd353('0x27')]();});}};}function handleEntityNotFound(_0x3bdf9a,_0x12c811){return function(_0x4fcd89){if(!_0x4fcd89){_0x3bdf9a['sendStatus'](0x194);}return _0x4fcd89;};}function handleError(_0x2c0c0a,_0x4ec0bf){_0x4ec0bf=_0x4ec0bf||0x1f4;return function(_0x2a394a){logger['error'](_0x2a394a[_0xd353('0x31')]);if(_0x2a394a[_0xd353('0x32')]){delete _0x2a394a[_0xd353('0x32')];}_0x2c0c0a[_0xd353('0x26')](_0x4ec0bf)['send'](_0x2a394a);};}exports[_0xd353('0x33')]=function(_0x4f614b,_0x1b6ab5){var _0x59cd4d={},_0x20c808={},_0x1ca03f={'count':0x0,'rows':[]};var _0x5c3d4c=_['map'](db[_0xd353('0x34')][_0xd353('0x35')],function(_0x58d934){return{'name':_0x58d934[_0xd353('0x36')],'type':_0x58d934['type'][_0xd353('0x37')]};});_0x20c808[_0xd353('0x38')]=_[_0xd353('0x39')](_0x5c3d4c,_0xd353('0x32'));_0x20c808[_0xd353('0x3a')]=_[_0xd353('0x3b')](_0x4f614b[_0xd353('0x3a')]);_0x20c808[_0xd353('0x3c')]=_[_0xd353('0x3d')](_0x20c808[_0xd353('0x38')],_0x20c808[_0xd353('0x3a')]);_0x59cd4d['attributes']=_[_0xd353('0x3d')](_0x20c808[_0xd353('0x38')],qs[_0xd353('0x3e')](_0x4f614b[_0xd353('0x3a')]['fields']));_0x59cd4d['attributes']=_0x59cd4d['attributes'][_0xd353('0x3f')]?_0x59cd4d[_0xd353('0x40')]:_0x20c808['model'];if(!_0x4f614b[_0xd353('0x3a')][_0xd353('0x41')](_0xd353('0x42'))){_0x59cd4d[_0xd353('0x2b')]=qs[_0xd353('0x2b')](_0x4f614b[_0xd353('0x3a')][_0xd353('0x2b')]);_0x59cd4d[_0xd353('0x2a')]=qs['offset'](_0x4f614b['query'][_0xd353('0x2a')]);}_0x59cd4d[_0xd353('0x43')]=qs[_0xd353('0x44')](_0x4f614b[_0xd353('0x3a')][_0xd353('0x44')]);_0x59cd4d[_0xd353('0x45')]=qs[_0xd353('0x3c')](_[_0xd353('0x46')](_0x4f614b[_0xd353('0x3a')],_0x20c808[_0xd353('0x3c')]),_0x5c3d4c);if(_0x4f614b[_0xd353('0x3a')][_0xd353('0x47')]){_0x59cd4d[_0xd353('0x45')]=_['merge'](_0x59cd4d[_0xd353('0x45')],{'$or':_[_0xd353('0x39')](_0x5c3d4c,function(_0x37d1f5){if(_0x37d1f5[_0xd353('0x48')]!==_0xd353('0x49')){var _0x55678f={};_0x55678f[_0x37d1f5[_0xd353('0x32')]]={'$like':'%'+_0x4f614b[_0xd353('0x3a')]['filter']+'%'};return _0x55678f;}})});}_0x59cd4d=_['merge']({},_0x59cd4d,_0x4f614b[_0xd353('0x4a')]);var _0x167bc9={'where':_0x59cd4d[_0xd353('0x45')]};return db[_0xd353('0x34')]['count'](_0x167bc9)[_0xd353('0x4b')](function(_0x1e1df4){_0x1ca03f[_0xd353('0x29')]=_0x1e1df4;if(_0x4f614b[_0xd353('0x3a')][_0xd353('0x4c')]){_0x59cd4d[_0xd353('0x4d')]=[{'all':!![]}];}return db[_0xd353('0x34')]['findAll'](_0x59cd4d);})[_0xd353('0x4b')](function(_0x34286a){_0x1ca03f[_0xd353('0x4e')]=_0x34286a;return _0x1ca03f;})[_0xd353('0x4b')](respondWithFilteredResult(_0x1b6ab5,_0x59cd4d))[_0xd353('0x4f')](handleError(_0x1b6ab5,null));};exports['show']=function(_0xca5a2,_0x4c4d22){var _0x2de632={'raw':![],'where':{'id':_0xca5a2[_0xd353('0x50')]['id']}},_0xd2ee70={};_0xd2ee70[_0xd353('0x38')]=_[_0xd353('0x3b')](db[_0xd353('0x34')][_0xd353('0x35')]);_0xd2ee70['query']=_[_0xd353('0x3b')](_0xca5a2[_0xd353('0x3a')]);_0xd2ee70[_0xd353('0x3c')]=_[_0xd353('0x3d')](_0xd2ee70[_0xd353('0x38')],_0xd2ee70[_0xd353('0x3a')]);_0x2de632[_0xd353('0x40')]=_[_0xd353('0x3d')](_0xd2ee70[_0xd353('0x38')],qs['fields'](_0xca5a2[_0xd353('0x3a')][_0xd353('0x3e')]));_0x2de632[_0xd353('0x40')]=_0x2de632[_0xd353('0x40')][_0xd353('0x3f')]?_0x2de632['attributes']:_0xd2ee70['model'];if(_0xca5a2['query'][_0xd353('0x4c')]){_0x2de632[_0xd353('0x4d')]=[{'all':!![]}];}_0x2de632=_[_0xd353('0x51')]({},_0x2de632,_0xca5a2[_0xd353('0x4a')]);return db['ZohoAccount'][_0xd353('0x52')](_0x2de632)[_0xd353('0x4b')](handleEntityNotFound(_0x4c4d22,null))[_0xd353('0x4b')](respondWithResult(_0x4c4d22,null))[_0xd353('0x4f')](handleError(_0x4c4d22,null));};exports[_0xd353('0x53')]=function(_0x25a34d,_0x48cac5){return db['ZohoAccount'][_0xd353('0x53')](_0x25a34d[_0xd353('0x54')],{})['then'](respondWithResult(_0x48cac5,0xc9))[_0xd353('0x4f')](handleError(_0x48cac5,null));};exports[_0xd353('0x2f')]=function(_0x327f1e,_0x1fc07b){if(_0x327f1e[_0xd353('0x54')]['id']){delete _0x327f1e[_0xd353('0x54')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x327f1e['params']['id']}})[_0xd353('0x4b')](handleEntityNotFound(_0x1fc07b,null))[_0xd353('0x4b')](saveUpdates(_0x327f1e['body'],null))[_0xd353('0x4b')](respondWithResult(_0x1fc07b,null))[_0xd353('0x4f')](handleError(_0x1fc07b,null));};exports['destroy']=function(_0xf3ea91,_0x2432ad){return db[_0xd353('0x34')][_0xd353('0x52')]({'where':{'id':_0xf3ea91['params']['id']}})['then'](handleEntityNotFound(_0x2432ad,null))[_0xd353('0x4b')](removeEntity(_0x2432ad,null))[_0xd353('0x4f')](handleError(_0x2432ad,null));};exports[_0xd353('0x55')]=function(_0x4b9440,_0x1c95b3,_0x3a19a0){var _0x5b292f={};var _0x2dc433={};var _0xc0f07a;var _0x5d0a4e;return db[_0xd353('0x34')][_0xd353('0x56')]({'where':{'id':_0x4b9440['params']['id']}})[_0xd353('0x4b')](handleEntityNotFound(_0x1c95b3,null))[_0xd353('0x4b')](function(_0x89f1e7){if(_0x89f1e7){_0xc0f07a=_0x89f1e7;_0x2dc433[_0xd353('0x38')]=_['keys'](db['ZohoConfiguration'][_0xd353('0x35')]);_0x2dc433[_0xd353('0x3a')]=_[_0xd353('0x3b')](_0x4b9440[_0xd353('0x3a')]);_0x2dc433['filters']=_[_0xd353('0x3d')](_0x2dc433['model'],_0x2dc433[_0xd353('0x3a')]);_0x5b292f[_0xd353('0x40')]=_['intersection'](_0x2dc433['model'],qs[_0xd353('0x3e')](_0x4b9440[_0xd353('0x3a')][_0xd353('0x3e')]));_0x5b292f[_0xd353('0x40')]=_0x5b292f[_0xd353('0x40')][_0xd353('0x3f')]?_0x5b292f[_0xd353('0x40')]:_0x2dc433[_0xd353('0x38')];_0x5b292f['order']=qs[_0xd353('0x44')](_0x4b9440[_0xd353('0x3a')][_0xd353('0x44')]);_0x5b292f['where']=qs[_0xd353('0x3c')](_[_0xd353('0x46')](_0x4b9440['query'],_0x2dc433['filters']));if(_0x4b9440['query'][_0xd353('0x47')]){_0x5b292f[_0xd353('0x45')]=_[_0xd353('0x51')](_0x5b292f[_0xd353('0x45')],{'$or':_['map'](_0x5b292f['attributes'],function(_0xfb703d){var _0xd8a1ac={};_0xd8a1ac[_0xfb703d]={'$like':'%'+_0x4b9440[_0xd353('0x3a')][_0xd353('0x47')]+'%'};return _0xd8a1ac;})});}_0x5b292f=_[_0xd353('0x51')]({},_0x5b292f,_0x4b9440[_0xd353('0x4a')]);return _0xc0f07a[_0xd353('0x55')](_0x5b292f);}})[_0xd353('0x4b')](function(_0x5b58cb){if(_0x5b58cb){_0x5d0a4e=_0x5b58cb[_0xd353('0x3f')];if(!_0x4b9440['query'][_0xd353('0x41')](_0xd353('0x42'))){_0x5b292f['limit']=qs[_0xd353('0x2b')](_0x4b9440[_0xd353('0x3a')]['limit']);_0x5b292f[_0xd353('0x2a')]=qs[_0xd353('0x2a')](_0x4b9440['query'][_0xd353('0x2a')]);}return _0xc0f07a['getConfigurations'](_0x5b292f);}})[_0xd353('0x4b')](function(_0x560b96){if(_0x560b96){return _0x560b96?{'count':_0x5d0a4e,'rows':_0x560b96}:null;}})[_0xd353('0x4b')](respondWithResult(_0x1c95b3,null))[_0xd353('0x4f')](handleError(_0x1c95b3,null));};exports[_0xd353('0x57')]=function(_0x336b2a,_0x20e523,_0x5bfbf9){if(_0x336b2a[_0xd353('0x54')]['id']){delete _0x336b2a[_0xd353('0x54')]['id'];}return db[_0xd353('0x34')]['findOne']({'where':{'id':_0x336b2a[_0xd353('0x50')]['id']}})[_0xd353('0x4b')](handleEntityNotFound(_0x20e523,null))[_0xd353('0x4b')](function(_0x3def4b){if(_0x3def4b){_0x336b2a['body'][_0xd353('0x58')]=_0x3def4b['id'];_0x336b2a[_0xd353('0x54')][_0xd353('0x59')]=integrations[_0xd353('0x5a')](_0x336b2a['body'][_0xd353('0x5b')],_0x336b2a[_0xd353('0x54')][_0xd353('0x48')]);_0x336b2a['body'][_0xd353('0x5c')]=integrations[_0xd353('0x5d')](_0x336b2a['body'][_0xd353('0x5b')],_0x336b2a[_0xd353('0x54')]['type']);return db[_0xd353('0x5e')][_0xd353('0x53')](_0x336b2a[_0xd353('0x54')],{'include':[{'model':db[_0xd353('0x5f')],'as':_0xd353('0x59')},{'model':db[_0xd353('0x5f')],'as':_0xd353('0x5c')}]});}return null;})[_0xd353('0x4b')](respondWithResult(_0x20e523,null))['catch'](handleError(_0x20e523,null));};function getAccessToken(_0x47c9f8){return new Promise(function(_0xffb935,_0x5978fa){var _0x4725b2;switch(_0x47c9f8[_0xd353('0x60')]){case'US':_0x4725b2=_0xd353('0x61');break;case'AU':_0x4725b2=_0xd353('0x62');break;case'EU':_0x4725b2=_0xd353('0x63');break;case'IN':_0x4725b2='https://accounts.zoho.in';break;case'CN':_0x4725b2=_0xd353('0x64');break;default:_0x4725b2='https://accounts.zoho.eu';break;}var _0x191f3f={'method':_0xd353('0x65'),'uri':_0x4725b2+_0xd353('0x66'),'qs':{'refresh_token':_0x47c9f8[_0xd353('0x67')],'client_id':_0x47c9f8[_0xd353('0x68')],'client_secret':_0x47c9f8[_0xd353('0x69')],'grant_type':_0xd353('0x6a')},'json':!![]};return rp(_0x191f3f)[_0xd353('0x4b')](function(_0x54edcd){if(_0x54edcd[_0xd353('0x6b')]){_0xffb935(_0x54edcd['access_token']);}else{_0x5978fa(_0xd353('0x6c'));}})[_0xd353('0x4f')](function(_0x33af33){_0x5978fa(_0x33af33);});});}exports[_0xd353('0x6d')]=function(_0x305522,_0x21f02a,_0x4a36e5){var _0x4684f2,_0x3ed190,_0x238edb,_0x27d10d,_0x39db78;return db[_0xd353('0x34')]['findOne']({'where':{'id':_0x305522[_0xd353('0x50')]['id']},'attributes':['id',_0xd353('0x6e'),_0xd353('0x60'),_0xd353('0x68'),'clientSecret','serverUrl',_0xd353('0x21'),'refreshToken']})[_0xd353('0x4b')](handleEntityNotFound(_0x21f02a,null))[_0xd353('0x4b')](function(_0x55ed04){_0x39db78=_0x55ed04;_0x4684f2=_0x39db78[_0xd353('0x6e')];_0x3ed190=_0x4684f2===_0xd353('0x6f')?'eu':_0xd353('0x70');_0x238edb=_0x39db78[_0xd353('0x71')];var _0x5fdb00=_0x238edb[_0xd353('0x72')](-0x1);if(_0x5fdb00==='/'||_0x5fdb00==='\x5c'||_0x5fdb00===':'){_0x238edb=_0x238edb[_0xd353('0x73')](0x0,_0x238edb[_0xd353('0x74')](_0x5fdb00));}if(!_0x39db78[_0xd353('0x67')]){throw new Error(_0xd353('0x75'));}return getAccessToken(_0x39db78);})[_0xd353('0x4b')](function(_0x290306){if(_0x290306){return rp({'method':_0xd353('0x76'),'uri':util[_0xd353('0x77')](_0xd353('0x78'),_0x3ed190),'qs':{'module':_0xd353('0x79')},'headers':{'Authorization':_0xd353('0x7a')+_0x290306},'json':!![]});}})['then'](function(_0x56bf4b){if(_0x56bf4b){if(_0x56bf4b[_0xd353('0x7b')]&&_0x56bf4b[_0xd353('0x7b')][_0xd353('0x20')]){throw new Error(_0x56bf4b[_0xd353('0x7b')]['error'][_0xd353('0x23')]);}var _0x4fa4f5=[];var _0x514dec=[];var _0x2187d7=['Owner',_0xd353('0x7c'),_0xd353('0x7d'),_0xd353('0x7e'),'Call_Duration',_0xd353('0x7f'),'Call_Start_Time','Call_Type'];_0x514dec=_[_0xd353('0x80')](_0x56bf4b['fields'],function(_0x3d1a29){return _0x2187d7[_0xd353('0x81')](_0x3d1a29[_0xd353('0x82')]);});for(var _0x2538d2=0x0;_0x2538d2<_0x514dec[_0xd353('0x3f')];_0x2538d2++){if(_0x514dec[_0x2538d2]['system_mandatory']===![]){_0x4fa4f5[_0xd353('0x83')]({'id':_0x514dec[_0x2538d2]['id'],'name':_0x514dec[_0x2538d2][_0xd353('0x84')],'custom':_0x514dec[_0x2538d2][_0xd353('0x85')],'options':_0x514dec[_0x2538d2][_0xd353('0x86')]==='picklist'&&_0x514dec[_0x2538d2][_0xd353('0x87')][_0xd353('0x3f')]>-0x1?_[_0xd353('0x39')](_0x514dec[_0x2538d2][_0xd353('0x87')],function(_0x3a0dfa){return{'name':_0x3a0dfa,'value':_0x3a0dfa};}):[]});}}return{'count':_0x4fa4f5[_0xd353('0x3f')],'rows':_0x4fa4f5};}else{return{'count':0x0,'rows':[]};}})[_0xd353('0x4b')](respondWithResult(_0x21f02a,null))[_0xd353('0x4f')](function(_0x1b468d){var _0xe5f051=_0x305522[_0xd353('0x3a')]['test']?0x1f4:_0x1b468d[_0xd353('0x88')]||0x1f4;logger[_0xd353('0x20')](_0xd353('0x89'),'getFields',_0xe5f051,JSON['stringify'](_0x1b468d));delete _0x1b468d['name'];if(_0xe5f051===0x191){_0xe5f051=0x190;}_0x21f02a[_0xd353('0x26')](_0xe5f051)[_0xd353('0x8a')](_0x305522[_0xd353('0x3a')]['test']?{'message':_0xd353('0x8b'),'statusCode':_0x1b468d[_0xd353('0x88')]}:_0x1b468d);});}; \ No newline at end of file +var _0xfb3a=['ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','end','status','json','count','offset','limit','set','apply','reject','save','update','destroy','sendStatus','stack','name','send','map','ZohoAccount','rawAttributes','fieldName','keys','query','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','include','findAll','show','params','intersection','length','find','create','body','findOne','ZohoConfiguration','pick','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoField','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','access_token','getFields','host','serverUrl','zoho.eu','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Owner','Subject','Description','Call_Duration','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','pick_list_values','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','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','../../components/integrations/configuration','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2ef82b,_0x31313d){var _0x228f7f=function(_0x2e0c97){while(--_0x2e0c97){_0x2ef82b['push'](_0x2ef82b['shift']());}};_0x228f7f(++_0x31313d);}(_0xfb3a,0x174));var _0xafb3=function(_0x5a044d,_0x427c8c){_0x5a044d=_0x5a044d-0x0;var _0x209b9b=_0xfb3a[_0x5a044d];return _0x209b9b;};'use strict';var pdf=require(_0xafb3('0x0'));var emlformat=require(_0xafb3('0x1'));var rimraf=require(_0xafb3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xafb3('0x3'));var rp=require('request-promise');var moment=require(_0xafb3('0x4'));var BPromise=require(_0xafb3('0x5'));var Mustache=require('mustache');var util=require(_0xafb3('0x6'));var path=require(_0xafb3('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xafb3('0x8'));var fs=require('fs');var _=require(_0xafb3('0x9'));var squel=require(_0xafb3('0xa'));var crypto=require(_0xafb3('0xb'));var jsforce=require(_0xafb3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xafb3('0xd'));var querystring=require(_0xafb3('0xe'));var Papa=require(_0xafb3('0xf'));var Redis=require(_0xafb3('0x10'));var authService=require(_0xafb3('0x11'));var qs=require(_0xafb3('0x12'));var as=require(_0xafb3('0x13'));var hardwareService=require(_0xafb3('0x14'));var logger=require(_0xafb3('0x15'))(_0xafb3('0x16'));var utils=require(_0xafb3('0x17'));var config=require(_0xafb3('0x18'));var db=require(_0xafb3('0x19'))['db'];var integrations=require(_0xafb3('0x1a'));var jayson=require(_0xafb3('0x1b'));var client=jayson[_0xafb3('0x1c')][_0xafb3('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x1098ec,_0x4279f6,_0x81c39c){if(_0x81c39c){var _0x200939=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x200939['test'](_0x4279f6)){return _0x1098ec;}else{throw new db[(_0xafb3('0x1e'))][(_0xafb3('0x1f'))](_0xafb3('0x20'));}}else{return _0x1098ec;}}function respondWithRpcPromise(_0x5b66ec,_0x5521bb,_0x4a60b8,_0xedcbb4){return new BPromise(function(_0x2d81c9,_0x43b85c){var _0x144c1f=_0xedcbb4||client;return _0x144c1f[_0xafb3('0x21')](_0x5b66ec,_0x4a60b8)[_0xafb3('0x22')](function(_0x150d1d){logger[_0xafb3('0x23')](_0xafb3('0x24'),_0x5521bb,_0xafb3('0x25'));logger[_0xafb3('0x26')](_0xafb3('0x27'),_0x5521bb,_0xafb3('0x25'),JSON[_0xafb3('0x28')](_0x150d1d));if(_0x150d1d[_0xafb3('0x29')]){if(_0x150d1d[_0xafb3('0x29')]['code']===0x1f4){logger[_0xafb3('0x29')](_0xafb3('0x24'),_0x5521bb,_0x150d1d['error'][_0xafb3('0x2a')]);return _0x43b85c(_0x150d1d['error'][_0xafb3('0x2a')]);}logger[_0xafb3('0x29')]('ZohoAccount,\x20%s,\x20%s',_0x5521bb,_0x150d1d[_0xafb3('0x29')][_0xafb3('0x2a')]);return _0x2d81c9(_0x150d1d[_0xafb3('0x29')][_0xafb3('0x2a')]);}else{logger['info'](_0xafb3('0x24'),_0x5521bb,_0xafb3('0x25'));_0x2d81c9(_0x150d1d[_0xafb3('0x2b')][_0xafb3('0x2a')]);}})[_0xafb3('0x2c')](function(_0x3bd060){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x5521bb,_0x3bd060);_0x43b85c(_0x3bd060);});});}function respondWithStatusCode(_0x138ca9,_0x3f2d3e){_0x3f2d3e=_0x3f2d3e||0xcc;return function(_0x1374bd){if(_0x1374bd){return _0x138ca9['sendStatus'](_0x3f2d3e);}return _0x138ca9['status'](_0x3f2d3e)[_0xafb3('0x2d')]();};}function respondWithResult(_0x1d9a7f,_0x2744e6){_0x2744e6=_0x2744e6||0xc8;return function(_0x85d617){if(_0x85d617){return _0x1d9a7f[_0xafb3('0x2e')](_0x2744e6)[_0xafb3('0x2f')](_0x85d617);}};}function respondWithFilteredResult(_0x263da2,_0x89f57){return function(_0x2f6453){if(_0x2f6453){var _0x3a2b63=_0x2f6453[_0xafb3('0x30')],_0x575162=_0x89f57[_0xafb3('0x31')],_0x343ef4=_0x89f57[_0xafb3('0x31')]+_0x89f57[_0xafb3('0x32')],_0x4d4cfd;if(_0x343ef4>=_0x3a2b63){_0x343ef4=_0x3a2b63;_0x4d4cfd=0xc8;}else{_0x4d4cfd=0xce;}_0x263da2[_0xafb3('0x2e')](_0x4d4cfd);return _0x263da2[_0xafb3('0x33')]('Content-Range',_0x575162+'-'+_0x343ef4+'/'+_0x3a2b63)[_0xafb3('0x2f')](_0x2f6453);}return null;};}function patchUpdates(_0x2a9b79){return function(_0x1ca81a){try{jsonpatch[_0xafb3('0x34')](_0x1ca81a,_0x2a9b79,!![]);}catch(_0x1b25c4){return BPromise[_0xafb3('0x35')](_0x1b25c4);}return _0x1ca81a[_0xafb3('0x36')]();};}function saveUpdates(_0x23a264,_0x150805){return function(_0x4eb472){if(_0x4eb472){return _0x4eb472[_0xafb3('0x37')](_0x23a264)[_0xafb3('0x22')](function(_0x15fcc1){return _0x15fcc1;});}return null;};}function removeEntity(_0x3a3e2f,_0x10163b){return function(_0x309f6e){if(_0x309f6e){return _0x309f6e[_0xafb3('0x38')]()[_0xafb3('0x22')](function(){_0x3a3e2f[_0xafb3('0x2e')](0xcc)[_0xafb3('0x2d')]();});}};}function handleEntityNotFound(_0x33ed2f,_0x1805cc){return function(_0x5d3100){if(!_0x5d3100){_0x33ed2f[_0xafb3('0x39')](0x194);}return _0x5d3100;};}function handleError(_0xfc6161,_0x2ec409){_0x2ec409=_0x2ec409||0x1f4;return function(_0x5663ef){logger['error'](_0x5663ef[_0xafb3('0x3a')]);if(_0x5663ef[_0xafb3('0x3b')]){delete _0x5663ef[_0xafb3('0x3b')];}_0xfc6161['status'](_0x2ec409)[_0xafb3('0x3c')](_0x5663ef);};}exports['index']=function(_0x110fc8,_0x83ba23){var _0x43556b={},_0x53446d={},_0x3d159d={'count':0x0,'rows':[]};var _0x335614=_[_0xafb3('0x3d')](db[_0xafb3('0x3e')][_0xafb3('0x3f')],function(_0x5d262f){return{'name':_0x5d262f[_0xafb3('0x40')],'type':_0x5d262f['type']['key']};});_0x53446d['model']=_[_0xafb3('0x3d')](_0x335614,_0xafb3('0x3b'));_0x53446d['query']=_[_0xafb3('0x41')](_0x110fc8[_0xafb3('0x42')]);_0x53446d[_0xafb3('0x43')]=_['intersection'](_0x53446d[_0xafb3('0x44')],_0x53446d[_0xafb3('0x42')]);_0x43556b[_0xafb3('0x45')]=_['intersection'](_0x53446d['model'],qs[_0xafb3('0x46')](_0x110fc8[_0xafb3('0x42')][_0xafb3('0x46')]));_0x43556b[_0xafb3('0x45')]=_0x43556b['attributes']['length']?_0x43556b['attributes']:_0x53446d['model'];if(!_0x110fc8[_0xafb3('0x42')][_0xafb3('0x47')](_0xafb3('0x48'))){_0x43556b[_0xafb3('0x32')]=qs[_0xafb3('0x32')](_0x110fc8[_0xafb3('0x42')][_0xafb3('0x32')]);_0x43556b[_0xafb3('0x31')]=qs[_0xafb3('0x31')](_0x110fc8[_0xafb3('0x42')][_0xafb3('0x31')]);}_0x43556b[_0xafb3('0x49')]=qs[_0xafb3('0x4a')](_0x110fc8[_0xafb3('0x42')][_0xafb3('0x4a')]);_0x43556b[_0xafb3('0x4b')]=qs[_0xafb3('0x43')](_['pick'](_0x110fc8[_0xafb3('0x42')],_0x53446d[_0xafb3('0x43')]),_0x335614);if(_0x110fc8[_0xafb3('0x42')]['filter']){_0x43556b[_0xafb3('0x4b')]=_[_0xafb3('0x4c')](_0x43556b[_0xafb3('0x4b')],{'$or':_[_0xafb3('0x3d')](_0x335614,function(_0x4352ef){if(_0x4352ef[_0xafb3('0x4d')]!==_0xafb3('0x4e')){var _0x54a4ca={};_0x54a4ca[_0x4352ef['name']]={'$like':'%'+_0x110fc8[_0xafb3('0x42')][_0xafb3('0x4f')]+'%'};return _0x54a4ca;}})});}_0x43556b=_['merge']({},_0x43556b,_0x110fc8[_0xafb3('0x50')]);var _0x58d1d1={'where':_0x43556b[_0xafb3('0x4b')]};return db['ZohoAccount']['count'](_0x58d1d1)['then'](function(_0x5629cc){_0x3d159d[_0xafb3('0x30')]=_0x5629cc;if(_0x110fc8[_0xafb3('0x42')]['includeAll']){_0x43556b[_0xafb3('0x51')]=[{'all':!![]}];}return db['ZohoAccount'][_0xafb3('0x52')](_0x43556b);})['then'](function(_0x58bd14){_0x3d159d['rows']=_0x58bd14;return _0x3d159d;})[_0xafb3('0x22')](respondWithFilteredResult(_0x83ba23,_0x43556b))[_0xafb3('0x2c')](handleError(_0x83ba23,null));};exports[_0xafb3('0x53')]=function(_0x2c67dc,_0x4065fd){var _0x1d8dda={'raw':![],'where':{'id':_0x2c67dc[_0xafb3('0x54')]['id']}},_0x34b5ee={};_0x34b5ee[_0xafb3('0x44')]=_[_0xafb3('0x41')](db['ZohoAccount']['rawAttributes']);_0x34b5ee[_0xafb3('0x42')]=_[_0xafb3('0x41')](_0x2c67dc[_0xafb3('0x42')]);_0x34b5ee[_0xafb3('0x43')]=_['intersection'](_0x34b5ee[_0xafb3('0x44')],_0x34b5ee['query']);_0x1d8dda[_0xafb3('0x45')]=_[_0xafb3('0x55')](_0x34b5ee[_0xafb3('0x44')],qs[_0xafb3('0x46')](_0x2c67dc[_0xafb3('0x42')]['fields']));_0x1d8dda['attributes']=_0x1d8dda[_0xafb3('0x45')][_0xafb3('0x56')]?_0x1d8dda[_0xafb3('0x45')]:_0x34b5ee[_0xafb3('0x44')];if(_0x2c67dc[_0xafb3('0x42')]['includeAll']){_0x1d8dda[_0xafb3('0x51')]=[{'all':!![]}];}_0x1d8dda=_[_0xafb3('0x4c')]({},_0x1d8dda,_0x2c67dc[_0xafb3('0x50')]);return db[_0xafb3('0x3e')][_0xafb3('0x57')](_0x1d8dda)[_0xafb3('0x22')](handleEntityNotFound(_0x4065fd,null))[_0xafb3('0x22')](respondWithResult(_0x4065fd,null))['catch'](handleError(_0x4065fd,null));};exports['create']=function(_0xcf2f05,_0x470ea1){return db[_0xafb3('0x3e')][_0xafb3('0x58')](_0xcf2f05[_0xafb3('0x59')],{})[_0xafb3('0x22')](respondWithResult(_0x470ea1,0xc9))[_0xafb3('0x2c')](handleError(_0x470ea1,null));};exports[_0xafb3('0x37')]=function(_0xc96dd,_0x4d45c1){if(_0xc96dd['body']['id']){delete _0xc96dd[_0xafb3('0x59')]['id'];}return db[_0xafb3('0x3e')][_0xafb3('0x57')]({'where':{'id':_0xc96dd['params']['id']}})[_0xafb3('0x22')](handleEntityNotFound(_0x4d45c1,null))[_0xafb3('0x22')](saveUpdates(_0xc96dd[_0xafb3('0x59')],null))[_0xafb3('0x22')](respondWithResult(_0x4d45c1,null))[_0xafb3('0x2c')](handleError(_0x4d45c1,null));};exports[_0xafb3('0x38')]=function(_0x38c1f2,_0x281924){return db[_0xafb3('0x3e')][_0xafb3('0x57')]({'where':{'id':_0x38c1f2['params']['id']}})[_0xafb3('0x22')](handleEntityNotFound(_0x281924,null))[_0xafb3('0x22')](removeEntity(_0x281924,null))[_0xafb3('0x2c')](handleError(_0x281924,null));};exports['getConfigurations']=function(_0x5b7fc0,_0x485ea4,_0x33a484){var _0x162c9a={};var _0x853780={};var _0x2af865;var _0x122028;return db[_0xafb3('0x3e')][_0xafb3('0x5a')]({'where':{'id':_0x5b7fc0[_0xafb3('0x54')]['id']}})[_0xafb3('0x22')](handleEntityNotFound(_0x485ea4,null))[_0xafb3('0x22')](function(_0x2ffefd){if(_0x2ffefd){_0x2af865=_0x2ffefd;_0x853780['model']=_[_0xafb3('0x41')](db[_0xafb3('0x5b')]['rawAttributes']);_0x853780[_0xafb3('0x42')]=_[_0xafb3('0x41')](_0x5b7fc0[_0xafb3('0x42')]);_0x853780[_0xafb3('0x43')]=_[_0xafb3('0x55')](_0x853780['model'],_0x853780[_0xafb3('0x42')]);_0x162c9a[_0xafb3('0x45')]=_[_0xafb3('0x55')](_0x853780[_0xafb3('0x44')],qs[_0xafb3('0x46')](_0x5b7fc0['query'][_0xafb3('0x46')]));_0x162c9a['attributes']=_0x162c9a['attributes'][_0xafb3('0x56')]?_0x162c9a[_0xafb3('0x45')]:_0x853780[_0xafb3('0x44')];_0x162c9a[_0xafb3('0x49')]=qs['sort'](_0x5b7fc0[_0xafb3('0x42')]['sort']);_0x162c9a[_0xafb3('0x4b')]=qs['filters'](_[_0xafb3('0x5c')](_0x5b7fc0[_0xafb3('0x42')],_0x853780['filters']));if(_0x5b7fc0[_0xafb3('0x42')][_0xafb3('0x4f')]){_0x162c9a[_0xafb3('0x4b')]=_['merge'](_0x162c9a[_0xafb3('0x4b')],{'$or':_[_0xafb3('0x3d')](_0x162c9a['attributes'],function(_0x1a440a){var _0x5c12eb={};_0x5c12eb[_0x1a440a]={'$like':'%'+_0x5b7fc0[_0xafb3('0x42')]['filter']+'%'};return _0x5c12eb;})});}_0x162c9a=_[_0xafb3('0x4c')]({},_0x162c9a,_0x5b7fc0['options']);return _0x2af865['getConfigurations'](_0x162c9a);}})[_0xafb3('0x22')](function(_0xc188a1){if(_0xc188a1){_0x122028=_0xc188a1['length'];if(!_0x5b7fc0[_0xafb3('0x42')][_0xafb3('0x47')](_0xafb3('0x48'))){_0x162c9a[_0xafb3('0x32')]=qs[_0xafb3('0x32')](_0x5b7fc0[_0xafb3('0x42')]['limit']);_0x162c9a[_0xafb3('0x31')]=qs[_0xafb3('0x31')](_0x5b7fc0[_0xafb3('0x42')]['offset']);}return _0x2af865['getConfigurations'](_0x162c9a);}})[_0xafb3('0x22')](function(_0x4dd5bf){if(_0x4dd5bf){return _0x4dd5bf?{'count':_0x122028,'rows':_0x4dd5bf}:null;}})[_0xafb3('0x22')](respondWithResult(_0x485ea4,null))['catch'](handleError(_0x485ea4,null));};exports[_0xafb3('0x5d')]=function(_0x3f1baf,_0x1f1934,_0x40cc79){if(_0x3f1baf[_0xafb3('0x59')]['id']){delete _0x3f1baf[_0xafb3('0x59')]['id'];}return db[_0xafb3('0x3e')]['findOne']({'where':{'id':_0x3f1baf['params']['id']}})[_0xafb3('0x22')](handleEntityNotFound(_0x1f1934,null))[_0xafb3('0x22')](function(_0x1e9218){if(_0x1e9218){_0x3f1baf[_0xafb3('0x59')]['AccountId']=_0x1e9218['id'];_0x3f1baf[_0xafb3('0x59')][_0xafb3('0x5e')]=integrations[_0xafb3('0x5f')](_0x3f1baf['body']['channel'],_0x3f1baf[_0xafb3('0x59')][_0xafb3('0x4d')]);_0x3f1baf[_0xafb3('0x59')][_0xafb3('0x60')]=integrations[_0xafb3('0x61')](_0x3f1baf[_0xafb3('0x59')][_0xafb3('0x62')],_0x3f1baf[_0xafb3('0x59')][_0xafb3('0x4d')]);return db[_0xafb3('0x5b')][_0xafb3('0x58')](_0x3f1baf['body'],{'include':[{'model':db[_0xafb3('0x63')],'as':_0xafb3('0x5e')},{'model':db['ZohoField'],'as':_0xafb3('0x60')}]});}return null;})[_0xafb3('0x22')](respondWithResult(_0x1f1934,null))[_0xafb3('0x2c')](handleError(_0x1f1934,null));};function getAccessToken(_0x4e75ba){return new Promise(function(_0x51efb4,_0x5e5007){var _0x33d850;switch(_0x4e75ba['zone']){case'US':_0x33d850='https://accounts.zoho.com';break;case'AU':_0x33d850=_0xafb3('0x64');break;case'EU':_0x33d850=_0xafb3('0x65');break;case'IN':_0x33d850=_0xafb3('0x66');break;case'CN':_0x33d850=_0xafb3('0x67');break;default:_0x33d850=_0xafb3('0x65');break;}var _0x8f4af2={'method':'POST','uri':_0x33d850+_0xafb3('0x68'),'qs':{'refresh_token':_0x4e75ba[_0xafb3('0x69')],'client_id':_0x4e75ba[_0xafb3('0x6a')],'client_secret':_0x4e75ba[_0xafb3('0x6b')],'grant_type':_0xafb3('0x6c')},'json':!![]};return rp(_0x8f4af2)[_0xafb3('0x22')](function(_0x2c80b8){if(_0x2c80b8[_0xafb3('0x6d')]){_0x51efb4(_0x2c80b8[_0xafb3('0x6d')]);}else{_0x5e5007('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xafb3('0x2c')](function(_0x56e41a){_0x5e5007(_0x56e41a);});});}exports[_0xafb3('0x6e')]=function(_0x5540ae,_0x3569e9,_0x40c144){var _0x2c4ab5,_0x1c43ec,_0x27dcc3,_0x16b55d,_0x31737d;return db[_0xafb3('0x3e')][_0xafb3('0x5a')]({'where':{'id':_0x5540ae[_0xafb3('0x54')]['id']},'attributes':['id',_0xafb3('0x6f'),'zone','clientId','clientSecret',_0xafb3('0x70'),'code',_0xafb3('0x69')]})[_0xafb3('0x22')](handleEntityNotFound(_0x3569e9,null))[_0xafb3('0x22')](function(_0x1b4d97){_0x31737d=_0x1b4d97;_0x2c4ab5=_0x31737d[_0xafb3('0x6f')];_0x1c43ec=_0x2c4ab5===_0xafb3('0x71')?'eu':'com';_0x27dcc3=_0x31737d[_0xafb3('0x70')];var _0x5af064=_0x27dcc3['slice'](-0x1);if(_0x5af064==='/'||_0x5af064==='\x5c'||_0x5af064===':'){_0x27dcc3=_0x27dcc3[_0xafb3('0x72')](0x0,_0x27dcc3[_0xafb3('0x73')](_0x5af064));}if(!_0x31737d[_0xafb3('0x69')]){throw new Error(_0xafb3('0x74'));}return getAccessToken(_0x31737d);})[_0xafb3('0x22')](function(_0x328e3d){if(_0x328e3d){return rp({'method':_0xafb3('0x75'),'uri':util[_0xafb3('0x76')](_0xafb3('0x77'),_0x1c43ec),'qs':{'module':_0xafb3('0x78')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x328e3d},'json':!![]});}})['then'](function(_0x56caa9){if(_0x56caa9){if(_0x56caa9[_0xafb3('0x79')]&&_0x56caa9[_0xafb3('0x79')][_0xafb3('0x29')]){throw new Error(_0x56caa9[_0xafb3('0x79')][_0xafb3('0x29')][_0xafb3('0x2a')]);}var _0x5f122d=[];var _0x5bc051=[];var _0x89c54a=[_0xafb3('0x7a'),_0xafb3('0x7b'),_0xafb3('0x7c'),'WhoId',_0xafb3('0x7d'),'Call_Result','Call_Start_Time','Call_Type'];_0x5bc051=_['remove'](_0x56caa9[_0xafb3('0x46')],function(_0x54ec08){return _0x89c54a[_0xafb3('0x7e')](_0x54ec08[_0xafb3('0x7f')]);});for(var _0x2534cd=0x0;_0x2534cd<_0x5bc051[_0xafb3('0x56')];_0x2534cd++){if(_0x5bc051[_0x2534cd][_0xafb3('0x80')]===![]){_0x5f122d[_0xafb3('0x81')]({'id':_0x5bc051[_0x2534cd]['id'],'name':_0x5bc051[_0x2534cd][_0xafb3('0x82')],'custom':_0x5bc051[_0x2534cd][_0xafb3('0x83')],'options':_0x5bc051[_0x2534cd][_0xafb3('0x84')]==='picklist'&&_0x5bc051[_0x2534cd][_0xafb3('0x85')]['length']>-0x1?_[_0xafb3('0x3d')](_0x5bc051[_0x2534cd]['pick_list_values'],function(_0x4f1a88){return{'name':_0x4f1a88,'value':_0x4f1a88};}):[]});}}return{'count':_0x5f122d[_0xafb3('0x56')],'rows':_0x5f122d};}else{return{'count':0x0,'rows':[]};}})[_0xafb3('0x22')](respondWithResult(_0x3569e9,null))['catch'](function(_0x4cf70b){var _0xa2f3f1=_0x5540ae[_0xafb3('0x42')][_0xafb3('0x86')]?0x1f4:_0x4cf70b[_0xafb3('0x87')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xafb3('0x6e'),_0xa2f3f1,JSON['stringify'](_0x4cf70b));delete _0x4cf70b[_0xafb3('0x3b')];if(_0xa2f3f1===0x191){_0xa2f3f1=0x190;}_0x3569e9[_0xafb3('0x2e')](_0xa2f3f1)[_0xafb3('0x3c')](_0x5540ae[_0xafb3('0x42')]['test']?{'message':_0xafb3('0x88'),'statusCode':_0x4cf70b[_0xafb3('0x87')]}:_0x4cf70b);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 1f2513c..c0a1953 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 _0xfee8=['parse','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','clientSecret','serverUrl','slice','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','application/x-www-form-urlencoded','then','refreshToken','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','code','host','authorization_code'];(function(_0x17dd51,_0x2d09c6){var _0x462eb0=function(_0x3b9f21){while(--_0x3b9f21){_0x17dd51['push'](_0x17dd51['shift']());}};_0x462eb0(++_0x2d09c6);}(_0xfee8,0x109));var _0x8fee=function(_0x39780c,_0x5782c9){_0x39780c=_0x39780c-0x0;var _0x53c19b=_0xfee8[_0x39780c];return _0x53c19b;};'use strict';var _=require('lodash');var util=require(_0x8fee('0x0'));var logger=require(_0x8fee('0x1'))(_0x8fee('0x2'));var moment=require(_0x8fee('0x3'));var BPromise=require(_0x8fee('0x4'));var rp=require(_0x8fee('0x5'));var fs=require('fs');var path=require(_0x8fee('0x6'));var rimraf=require('rimraf');var config=require(_0x8fee('0x7'));var attributes=require(_0x8fee('0x8'));var integrations=require(_0x8fee('0x9'));module[_0x8fee('0xa')]=function(_0x3ff3d1,_0x561e63){return _0x3ff3d1[_0x8fee('0xb')](_0x8fee('0xc'),attributes,{'tableName':_0x8fee('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5a0d1e,_0x3615a7,_0x4b41eb){if(_0x5a0d1e[_0x8fee('0xe')](_0x8fee('0xf'))||_0x5a0d1e[_0x8fee('0xe')]('serverUrl')||_0x5a0d1e['changed'](_0x8fee('0x10'))||_0x5a0d1e['changed'](_0x8fee('0x11'))||_0x5a0d1e['changed']('code')||_0x5a0d1e[_0x8fee('0xe')]('host')){var _0x138465,_0x7b1415;_0x138465=_0x5a0d1e[_0x8fee('0x12')];var _0x5b5632=_0x138465[_0x8fee('0x13')](-0x1);if(_0x5b5632==='/'||_0x5b5632==='\x5c'||_0x5b5632===':'){_0x138465=_0x138465['substring'](0x0,_0x138465[_0x8fee('0x14')](_0x5b5632));}switch(_0x5a0d1e['zone']){case'US':_0x7b1415=_0x8fee('0x15');break;case'AU':_0x7b1415=_0x8fee('0x16');break;case'IN':_0x7b1415=_0x8fee('0x17');break;case'CN':_0x7b1415=_0x8fee('0x18');break;default:_0x7b1415=_0x8fee('0x19');break;}var _0x5b240a={'method':_0x8fee('0x1a'),'uri':_0x7b1415+_0x8fee('0x1b'),'form':{'grant_type':'authorization_code','client_id':_0x5a0d1e[_0x8fee('0x10')],'client_secret':_0x5a0d1e['clientSecret'],'redirect_uri':_0x5a0d1e['serverUrl'],'code':_0x5a0d1e['code']},'headers':{'Content-Type':_0x8fee('0x1c')}};return rp(_0x5b240a)[_0x8fee('0x1d')](function(_0x49254c){var _0x4cafec=JSON['parse'](_0x49254c);if(_0x4cafec['refresh_token']){_0x5a0d1e[_0x8fee('0x1e')]=_0x4cafec[_0x8fee('0x1f')];logger[_0x8fee('0x20')](util[_0x8fee('0x21')](_0x8fee('0x22'),_0x5a0d1e[_0x8fee('0x23')],_0x5a0d1e['id']));}else{logger[_0x8fee('0x24')](util['format'](_0x8fee('0x25'),_0x5a0d1e[_0x8fee('0x23')],_0x5a0d1e['id']),util[_0x8fee('0x26')](_0x4cafec,{'showHidden':![],'depth':null}));}return _0x4b41eb(null,_0x3615a7);})[_0x8fee('0x27')](function(_0xd33284){logger['error'](util[_0x8fee('0x21')](_0x8fee('0x25'),_0x5a0d1e[_0x8fee('0x23')],_0x5a0d1e['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x4b41eb(_0xd33284);});}else{return _0x4b41eb(null,_0x3615a7);}},'beforeUpdate':function(_0x4e2d3b,_0x5e61f3,_0x42eeec){if(_0x4e2d3b['changed'](_0x8fee('0xf'))||_0x4e2d3b['changed'](_0x8fee('0x12'))||_0x4e2d3b[_0x8fee('0xe')](_0x8fee('0x10'))||_0x4e2d3b['changed']('clientSecret')||_0x4e2d3b[_0x8fee('0xe')](_0x8fee('0x28'))||_0x4e2d3b['changed'](_0x8fee('0x29'))){var _0x3fbc89,_0x4c2971;_0x3fbc89=_0x4e2d3b[_0x8fee('0x12')];var _0x586501=_0x3fbc89['slice'](-0x1);if(_0x586501==='/'||_0x586501==='\x5c'||_0x586501===':'){_0x3fbc89=_0x3fbc89['substring'](0x0,_0x3fbc89['lastIndexOf'](_0x586501));}switch(_0x4e2d3b['zone']){case'US':_0x4c2971=_0x8fee('0x15');break;case'AU':_0x4c2971=_0x8fee('0x16');break;case'IN':_0x4c2971='https://accounts.zoho.in';break;case'CN':_0x4c2971='https://accounts.zoho.com.cn';break;default:_0x4c2971=_0x8fee('0x19');break;}var _0x5b77d2={'method':_0x8fee('0x1a'),'uri':_0x4c2971+_0x8fee('0x1b'),'form':{'grant_type':_0x8fee('0x2a'),'client_id':_0x4e2d3b[_0x8fee('0x10')],'client_secret':_0x4e2d3b[_0x8fee('0x11')],'redirect_uri':_0x4e2d3b[_0x8fee('0x12')],'code':_0x4e2d3b[_0x8fee('0x28')]},'headers':{'Content-Type':_0x8fee('0x1c')}};return rp(_0x5b77d2)[_0x8fee('0x1d')](function(_0x1c012b){var _0x3a5586=JSON[_0x8fee('0x2b')](_0x1c012b);if(_0x3a5586[_0x8fee('0x1f')]){_0x4e2d3b[_0x8fee('0x1e')]=_0x3a5586['refresh_token'];logger[_0x8fee('0x20')](util[_0x8fee('0x21')](_0x8fee('0x22'),_0x4e2d3b[_0x8fee('0x23')],_0x4e2d3b['id']));}else{logger[_0x8fee('0x24')](util[_0x8fee('0x21')](_0x8fee('0x25'),_0x4e2d3b['name'],_0x4e2d3b['id']),util[_0x8fee('0x26')](_0x3a5586,{'showHidden':![],'depth':null}));}return _0x42eeec(null,_0x5e61f3);})['catch'](function(_0x1fdd3b){logger['error'](util[_0x8fee('0x21')](_0x8fee('0x25'),_0x4e2d3b[_0x8fee('0x23')],_0x4e2d3b['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x42eeec(_0x1fdd3b);});}else{return _0x42eeec(null,_0x5e61f3);}}}});}; \ No newline at end of file +var _0xbad3=['name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','https://accounts.zoho.com.au','POST','info','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d'];(function(_0xcfd30e,_0x372608){var _0x2c92af=function(_0x53f9b8){while(--_0x53f9b8){_0xcfd30e['push'](_0xcfd30e['shift']());}};_0x2c92af(++_0x372608);}(_0xbad3,0xe0));var _0x3bad=function(_0x2235e6,_0x2b44f6){_0x2235e6=_0x2235e6-0x0;var _0x431ec6=_0xbad3[_0x2235e6];return _0x431ec6;};'use strict';var _=require(_0x3bad('0x0'));var util=require('util');var logger=require(_0x3bad('0x1'))(_0x3bad('0x2'));var moment=require(_0x3bad('0x3'));var BPromise=require(_0x3bad('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3bad('0x5'));var rimraf=require(_0x3bad('0x6'));var config=require(_0x3bad('0x7'));var attributes=require(_0x3bad('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x3bad('0x9')]=function(_0x28523a,_0x866563){return _0x28523a['define'](_0x3bad('0xa'),attributes,{'tableName':_0x3bad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4026b2,_0x18e874,_0x3270ea){if(_0x4026b2[_0x3bad('0xc')](_0x3bad('0xd'))||_0x4026b2[_0x3bad('0xc')](_0x3bad('0xe'))||_0x4026b2[_0x3bad('0xc')](_0x3bad('0xf'))||_0x4026b2['changed'](_0x3bad('0x10'))||_0x4026b2[_0x3bad('0xc')]('code')||_0x4026b2[_0x3bad('0xc')](_0x3bad('0x11'))){var _0x1cee74,_0x2e1cc0;_0x1cee74=_0x4026b2[_0x3bad('0xe')];var _0x5c77da=_0x1cee74[_0x3bad('0x12')](-0x1);if(_0x5c77da==='/'||_0x5c77da==='\x5c'||_0x5c77da===':'){_0x1cee74=_0x1cee74[_0x3bad('0x13')](0x0,_0x1cee74[_0x3bad('0x14')](_0x5c77da));}switch(_0x4026b2[_0x3bad('0xd')]){case'US':_0x2e1cc0=_0x3bad('0x15');break;case'AU':_0x2e1cc0='https://accounts.zoho.com.au';break;case'IN':_0x2e1cc0=_0x3bad('0x16');break;case'CN':_0x2e1cc0=_0x3bad('0x17');break;default:_0x2e1cc0=_0x3bad('0x18');break;}var _0x3a631f={'method':'POST','uri':_0x2e1cc0+_0x3bad('0x19'),'form':{'grant_type':_0x3bad('0x1a'),'client_id':_0x4026b2[_0x3bad('0xf')],'client_secret':_0x4026b2['clientSecret'],'redirect_uri':_0x4026b2[_0x3bad('0xe')],'code':_0x4026b2[_0x3bad('0x1b')]},'headers':{'Content-Type':_0x3bad('0x1c')}};return rp(_0x3a631f)[_0x3bad('0x1d')](function(_0x393500){var _0x4d113c=JSON[_0x3bad('0x1e')](_0x393500);if(_0x4d113c[_0x3bad('0x1f')]){_0x4026b2[_0x3bad('0x20')]=_0x4d113c[_0x3bad('0x1f')];logger['info'](util['format'](_0x3bad('0x21'),_0x4026b2[_0x3bad('0x22')],_0x4026b2['id']));}else{logger[_0x3bad('0x23')](util[_0x3bad('0x24')](_0x3bad('0x25'),_0x4026b2[_0x3bad('0x22')],_0x4026b2['id']),util[_0x3bad('0x26')](_0x4d113c,{'showHidden':![],'depth':null}));}return _0x3270ea(null,_0x18e874);})[_0x3bad('0x27')](function(_0x15a4aa){logger['error'](util[_0x3bad('0x24')](_0x3bad('0x25'),_0x4026b2[_0x3bad('0x22')],_0x4026b2['id']),util[_0x3bad('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x3270ea(_0x15a4aa);});}else{return _0x3270ea(null,_0x18e874);}},'beforeUpdate':function(_0x9e7a11,_0x2d51e5,_0x1299d0){if(_0x9e7a11[_0x3bad('0xc')](_0x3bad('0xd'))||_0x9e7a11[_0x3bad('0xc')]('serverUrl')||_0x9e7a11[_0x3bad('0xc')]('clientId')||_0x9e7a11[_0x3bad('0xc')]('clientSecret')||_0x9e7a11[_0x3bad('0xc')]('code')||_0x9e7a11['changed'](_0x3bad('0x11'))){var _0x295c34,_0x447304;_0x295c34=_0x9e7a11[_0x3bad('0xe')];var _0x163f4f=_0x295c34['slice'](-0x1);if(_0x163f4f==='/'||_0x163f4f==='\x5c'||_0x163f4f===':'){_0x295c34=_0x295c34[_0x3bad('0x13')](0x0,_0x295c34[_0x3bad('0x14')](_0x163f4f));}switch(_0x9e7a11['zone']){case'US':_0x447304=_0x3bad('0x15');break;case'AU':_0x447304=_0x3bad('0x28');break;case'IN':_0x447304=_0x3bad('0x16');break;case'CN':_0x447304=_0x3bad('0x17');break;default:_0x447304=_0x3bad('0x18');break;}var _0x274cbd={'method':_0x3bad('0x29'),'uri':_0x447304+_0x3bad('0x19'),'form':{'grant_type':'authorization_code','client_id':_0x9e7a11[_0x3bad('0xf')],'client_secret':_0x9e7a11[_0x3bad('0x10')],'redirect_uri':_0x9e7a11[_0x3bad('0xe')],'code':_0x9e7a11[_0x3bad('0x1b')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x274cbd)[_0x3bad('0x1d')](function(_0x2e6588){var _0x53c43f=JSON[_0x3bad('0x1e')](_0x2e6588);if(_0x53c43f['refresh_token']){_0x9e7a11[_0x3bad('0x20')]=_0x53c43f['refresh_token'];logger[_0x3bad('0x2a')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x9e7a11['name'],_0x9e7a11['id']));}else{logger[_0x3bad('0x23')](util['format'](_0x3bad('0x25'),_0x9e7a11[_0x3bad('0x22')],_0x9e7a11['id']),util['inspect'](_0x53c43f,{'showHidden':![],'depth':null}));}return _0x1299d0(null,_0x2d51e5);})[_0x3bad('0x27')](function(_0x27139f){logger[_0x3bad('0x23')](util[_0x3bad('0x24')](_0x3bad('0x25'),_0x9e7a11[_0x3bad('0x22')],_0x9e7a11['id']),util[_0x3bad('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x1299d0(_0x27139f);});}else{return _0x1299d0(null,_0x2d51e5);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 03db395..4d3fdd5 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 _0xbe79=['include','map','model','GetZohoAccount','ShowZohoAccount','find','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','ZohoAccount,\x20%s,\x20%s','result','catch','ZohoAccount','options','raw','attributes'];(function(_0x2ac475,_0x593bf7){var _0x44bdab=function(_0x27ccfb){while(--_0x27ccfb){_0x2ac475['push'](_0x2ac475['shift']());}};_0x44bdab(++_0x593bf7);}(_0xbe79,0x1e6));var _0x9be7=function(_0x2d7be7,_0x469459){_0x2d7be7=_0x2d7be7-0x0;var _0x29772c=_0xbe79[_0x2d7be7];return _0x29772c;};'use strict';var _=require(_0x9be7('0x0'));var util=require('util');var moment=require(_0x9be7('0x1'));var BPromise=require('bluebird');var rs=require(_0x9be7('0x2'));var fs=require('fs');var Redis=require(_0x9be7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9be7('0x4'));var logger=require(_0x9be7('0x5'))(_0x9be7('0x6'));var config=require(_0x9be7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9be7('0x8')][_0x9be7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c153a,_0x298f23,_0x156cd6){return new BPromise(function(_0xf8315,_0x3f5bd7){return client[_0x9be7('0xa')](_0x1c153a,_0x156cd6)[_0x9be7('0xb')](function(_0x13c3d3){logger[_0x9be7('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x298f23,_0x9be7('0xd'));logger[_0x9be7('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x298f23,'request\x20sent',JSON[_0x9be7('0xf')](_0x13c3d3));if(_0x13c3d3[_0x9be7('0x10')]){if(_0x13c3d3[_0x9be7('0x10')][_0x9be7('0x11')]===0x1f4){logger[_0x9be7('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x298f23,_0x13c3d3[_0x9be7('0x10')]['message']);return _0x3f5bd7(_0x13c3d3[_0x9be7('0x10')][_0x9be7('0x12')]);}logger[_0x9be7('0x10')](_0x9be7('0x13'),_0x298f23,_0x13c3d3[_0x9be7('0x10')][_0x9be7('0x12')]);return _0xf8315(_0x13c3d3['error'][_0x9be7('0x12')]);}else{logger[_0x9be7('0xc')](_0x9be7('0x13'),_0x298f23,_0x9be7('0xd'));_0xf8315(_0x13c3d3[_0x9be7('0x14')][_0x9be7('0x12')]);}})[_0x9be7('0x15')](function(_0x4725d5){logger[_0x9be7('0x10')](_0x9be7('0x13'),_0x298f23,_0x4725d5);_0x3f5bd7(_0x4725d5);});});}exports['GetZohoAccount']=function(_0x372585){var _0x33bbde=this;return new Promise(function(_0x3c3132,_0x46db56){return db[_0x9be7('0x16')]['findAll']({'raw':_0x372585[_0x9be7('0x17')]?_0x372585[_0x9be7('0x17')][_0x9be7('0x18')]===undefined?!![]:![]:!![],'where':_0x372585[_0x9be7('0x17')]?_0x372585[_0x9be7('0x17')]['where']||null:null,'attributes':_0x372585[_0x9be7('0x17')]?_0x372585['options'][_0x9be7('0x19')]||null:null,'limit':_0x372585[_0x9be7('0x17')]?_0x372585[_0x9be7('0x17')]['limit']||null:null,'include':_0x372585[_0x9be7('0x17')]?_0x372585[_0x9be7('0x17')][_0x9be7('0x1a')]?_[_0x9be7('0x1b')](_0x372585['options'][_0x9be7('0x1a')],function(_0x1afc8c){return{'model':db[_0x1afc8c[_0x9be7('0x1c')]],'as':_0x1afc8c['as'],'attributes':_0x1afc8c['attributes'],'include':_0x1afc8c[_0x9be7('0x1a')]?_['map'](_0x1afc8c[_0x9be7('0x1a')],function(_0xac0c5c){return{'model':db[_0xac0c5c[_0x9be7('0x1c')]],'as':_0xac0c5c['as'],'attributes':_0xac0c5c[_0x9be7('0x19')],'include':_0xac0c5c[_0x9be7('0x1a')]?_[_0x9be7('0x1b')](_0xac0c5c[_0x9be7('0x1a')],function(_0x4bd303){return{'model':db[_0x4bd303[_0x9be7('0x1c')]],'as':_0x4bd303['as'],'attributes':_0x4bd303['attributes']};}):[]};}):[]};}):[]:[]})[_0x9be7('0xb')](function(_0x290dee){logger[_0x9be7('0xc')](_0x9be7('0x1d'),_0x372585);logger[_0x9be7('0xe')](_0x9be7('0x1d'),_0x372585,JSON['stringify'](_0x290dee));_0x3c3132(_0x290dee);})['catch'](function(_0x4e0f2a){logger[_0x9be7('0x10')]('GetZohoAccount',_0x4e0f2a[_0x9be7('0x12')],_0x372585);_0x46db56(_0x33bbde['error'](0x1f4,_0x4e0f2a[_0x9be7('0x12')]));});});};exports[_0x9be7('0x1e')]=function(_0xc705c5){var _0x32a7ec=this;return new Promise(function(_0x268397,_0x36da74){return db[_0x9be7('0x16')][_0x9be7('0x1f')]({'raw':_0xc705c5[_0x9be7('0x17')]?_0xc705c5[_0x9be7('0x17')][_0x9be7('0x18')]===undefined?!![]:![]:!![],'where':_0xc705c5[_0x9be7('0x17')]?_0xc705c5['options']['where']||null:null,'attributes':_0xc705c5[_0x9be7('0x17')]?_0xc705c5[_0x9be7('0x17')][_0x9be7('0x19')]||null:null,'include':_0xc705c5[_0x9be7('0x17')]?_0xc705c5[_0x9be7('0x17')][_0x9be7('0x1a')]?_['map'](_0xc705c5['options'][_0x9be7('0x1a')],function(_0x2342bc){return{'model':db[_0x2342bc[_0x9be7('0x1c')]],'as':_0x2342bc['as'],'attributes':_0x2342bc['attributes'],'include':_0x2342bc[_0x9be7('0x1a')]?_[_0x9be7('0x1b')](_0x2342bc[_0x9be7('0x1a')],function(_0x3eeec1){return{'model':db[_0x3eeec1[_0x9be7('0x1c')]],'as':_0x3eeec1['as'],'attributes':_0x3eeec1['attributes'],'include':_0x3eeec1[_0x9be7('0x1a')]?_[_0x9be7('0x1b')](_0x3eeec1[_0x9be7('0x1a')],function(_0x33b61d){return{'model':db[_0x33b61d[_0x9be7('0x1c')]],'as':_0x33b61d['as'],'attributes':_0x33b61d[_0x9be7('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9be7('0xb')](function(_0x599950){logger[_0x9be7('0xc')](_0x9be7('0x1e'),_0xc705c5);logger[_0x9be7('0xe')](_0x9be7('0x1e'),_0xc705c5,JSON[_0x9be7('0xf')](_0x599950));_0x268397(_0x599950);})['catch'](function(_0x37f880){logger['error']('ShowZohoAccount',_0x37f880['message'],_0xc705c5);_0x36da74(_0x32a7ec[_0x9be7('0x10')](0x1f4,_0x37f880[_0x9be7('0x12')]));});});}; \ No newline at end of file +var _0xbc36=['error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowZohoAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x25f3f2,_0x3a66e1){var _0x15e57f=function(_0x57888b){while(--_0x57888b){_0x25f3f2['push'](_0x25f3f2['shift']());}};_0x15e57f(++_0x3a66e1);}(_0xbc36,0x169));var _0x6bc3=function(_0x7e8f21,_0x3c06d4){_0x7e8f21=_0x7e8f21-0x0;var _0x4cbca3=_0xbc36[_0x7e8f21];return _0x4cbca3;};'use strict';var _=require(_0x6bc3('0x0'));var util=require('util');var moment=require(_0x6bc3('0x1'));var BPromise=require(_0x6bc3('0x2'));var rs=require(_0x6bc3('0x3'));var fs=require('fs');var Redis=require(_0x6bc3('0x4'));var db=require(_0x6bc3('0x5'))['db'];var utils=require(_0x6bc3('0x6'));var logger=require(_0x6bc3('0x7'))(_0x6bc3('0x8'));var config=require(_0x6bc3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6bc3('0xa')][_0x6bc3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5584a5,_0x33e11c,_0x1f894a){return new BPromise(function(_0xf07594,_0x4de32d){return client[_0x6bc3('0xc')](_0x5584a5,_0x1f894a)[_0x6bc3('0xd')](function(_0x33e8e0){logger[_0x6bc3('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x33e11c,_0x6bc3('0xf'));logger[_0x6bc3('0x10')](_0x6bc3('0x11'),_0x33e11c,_0x6bc3('0xf'),JSON[_0x6bc3('0x12')](_0x33e8e0));if(_0x33e8e0[_0x6bc3('0x13')]){if(_0x33e8e0[_0x6bc3('0x13')][_0x6bc3('0x14')]===0x1f4){logger[_0x6bc3('0x13')]('ZohoAccount,\x20%s,\x20%s',_0x33e11c,_0x33e8e0[_0x6bc3('0x13')]['message']);return _0x4de32d(_0x33e8e0[_0x6bc3('0x13')]['message']);}logger[_0x6bc3('0x13')](_0x6bc3('0x15'),_0x33e11c,_0x33e8e0['error'][_0x6bc3('0x16')]);return _0xf07594(_0x33e8e0['error']['message']);}else{logger[_0x6bc3('0xe')](_0x6bc3('0x15'),_0x33e11c,_0x6bc3('0xf'));_0xf07594(_0x33e8e0[_0x6bc3('0x17')][_0x6bc3('0x16')]);}})[_0x6bc3('0x18')](function(_0xa1782){logger['error'](_0x6bc3('0x15'),_0x33e11c,_0xa1782);_0x4de32d(_0xa1782);});});}exports[_0x6bc3('0x19')]=function(_0x4c1894){var _0x426a16=this;return new Promise(function(_0x1d27db,_0x232496){return db[_0x6bc3('0x1a')][_0x6bc3('0x1b')]({'raw':_0x4c1894[_0x6bc3('0x1c')]?_0x4c1894[_0x6bc3('0x1c')][_0x6bc3('0x1d')]===undefined?!![]:![]:!![],'where':_0x4c1894[_0x6bc3('0x1c')]?_0x4c1894[_0x6bc3('0x1c')][_0x6bc3('0x1e')]||null:null,'attributes':_0x4c1894[_0x6bc3('0x1c')]?_0x4c1894['options'][_0x6bc3('0x1f')]||null:null,'limit':_0x4c1894[_0x6bc3('0x1c')]?_0x4c1894['options'][_0x6bc3('0x20')]||null:null,'include':_0x4c1894['options']?_0x4c1894[_0x6bc3('0x1c')][_0x6bc3('0x21')]?_[_0x6bc3('0x22')](_0x4c1894[_0x6bc3('0x1c')][_0x6bc3('0x21')],function(_0x453ada){return{'model':db[_0x453ada[_0x6bc3('0x23')]],'as':_0x453ada['as'],'attributes':_0x453ada[_0x6bc3('0x1f')],'include':_0x453ada[_0x6bc3('0x21')]?_[_0x6bc3('0x22')](_0x453ada[_0x6bc3('0x21')],function(_0x1e9a9c){return{'model':db[_0x1e9a9c[_0x6bc3('0x23')]],'as':_0x1e9a9c['as'],'attributes':_0x1e9a9c['attributes'],'include':_0x1e9a9c[_0x6bc3('0x21')]?_[_0x6bc3('0x22')](_0x1e9a9c[_0x6bc3('0x21')],function(_0x1ab236){return{'model':db[_0x1ab236[_0x6bc3('0x23')]],'as':_0x1ab236['as'],'attributes':_0x1ab236['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e6365){logger['info'](_0x6bc3('0x19'),_0x4c1894);logger[_0x6bc3('0x10')](_0x6bc3('0x19'),_0x4c1894,JSON[_0x6bc3('0x12')](_0x3e6365));_0x1d27db(_0x3e6365);})['catch'](function(_0x66fb54){logger[_0x6bc3('0x13')](_0x6bc3('0x19'),_0x66fb54[_0x6bc3('0x16')],_0x4c1894);_0x232496(_0x426a16[_0x6bc3('0x13')](0x1f4,_0x66fb54['message']));});});};exports[_0x6bc3('0x24')]=function(_0xe5c34b){var _0x18cf51=this;return new Promise(function(_0x2815d9,_0x956c55){return db['ZohoAccount'][_0x6bc3('0x25')]({'raw':_0xe5c34b[_0x6bc3('0x1c')]?_0xe5c34b[_0x6bc3('0x1c')][_0x6bc3('0x1d')]===undefined?!![]:![]:!![],'where':_0xe5c34b[_0x6bc3('0x1c')]?_0xe5c34b[_0x6bc3('0x1c')][_0x6bc3('0x1e')]||null:null,'attributes':_0xe5c34b[_0x6bc3('0x1c')]?_0xe5c34b['options'][_0x6bc3('0x1f')]||null:null,'include':_0xe5c34b['options']?_0xe5c34b['options'][_0x6bc3('0x21')]?_[_0x6bc3('0x22')](_0xe5c34b['options'][_0x6bc3('0x21')],function(_0x675b93){return{'model':db[_0x675b93[_0x6bc3('0x23')]],'as':_0x675b93['as'],'attributes':_0x675b93[_0x6bc3('0x1f')],'include':_0x675b93[_0x6bc3('0x21')]?_[_0x6bc3('0x22')](_0x675b93[_0x6bc3('0x21')],function(_0xf0f900){return{'model':db[_0xf0f900[_0x6bc3('0x23')]],'as':_0xf0f900['as'],'attributes':_0xf0f900[_0x6bc3('0x1f')],'include':_0xf0f900[_0x6bc3('0x21')]?_[_0x6bc3('0x22')](_0xf0f900[_0x6bc3('0x21')],function(_0x104537){return{'model':db[_0x104537['model']],'as':_0x104537['as'],'attributes':_0x104537[_0x6bc3('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6bc3('0xd')](function(_0x5d7bcd){logger[_0x6bc3('0xe')]('ShowZohoAccount',_0xe5c34b);logger[_0x6bc3('0x10')](_0x6bc3('0x24'),_0xe5c34b,JSON[_0x6bc3('0x12')](_0x5d7bcd));_0x2815d9(_0x5d7bcd);})[_0x6bc3('0x18')](function(_0x254946){logger[_0x6bc3('0x13')](_0x6bc3('0x24'),_0x254946[_0x6bc3('0x16')],_0xe5c34b);_0x956c55(_0x18cf51[_0x6bc3('0x13')](0x1f4,_0x254946[_0x6bc3('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 80def8d..b0e1c9a 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 _0xa3b7=['put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create'];(function(_0x28ef15,_0x472398){var _0x2cad87=function(_0x23bf9d){while(--_0x23bf9d){_0x28ef15['push'](_0x28ef15['shift']());}};_0x2cad87(++_0x472398);}(_0xa3b7,0xe6));var _0x7a3b=function(_0x3815c2,_0x1f54e3){_0x3815c2=_0x3815c2-0x0;var _0x271f88=_0xa3b7[_0x3815c2];return _0x271f88;};'use strict';var multer=require(_0x7a3b('0x0'));var util=require('util');var path=require(_0x7a3b('0x1'));var timeout=require('connect-timeout');var express=require(_0x7a3b('0x2'));var router=express[_0x7a3b('0x3')]();var auth=require(_0x7a3b('0x4'));var interaction=require(_0x7a3b('0x5'));var config=require(_0x7a3b('0x6'));var controller=require(_0x7a3b('0x7'));router[_0x7a3b('0x8')]('/',auth['isAuthenticated'](),controller[_0x7a3b('0x9')]);router[_0x7a3b('0x8')](_0x7a3b('0xa'),auth[_0x7a3b('0xb')](),controller[_0x7a3b('0xc')]);router[_0x7a3b('0x8')](_0x7a3b('0xd'),auth['isAuthenticated'](),controller[_0x7a3b('0xe')]);router[_0x7a3b('0x8')](_0x7a3b('0xf'),auth[_0x7a3b('0xb')](),controller[_0x7a3b('0x10')]);router[_0x7a3b('0x8')]('/:id/descriptions',auth[_0x7a3b('0xb')](),controller[_0x7a3b('0x11')]);router[_0x7a3b('0x12')]('/',auth['isAuthenticated'](),controller[_0x7a3b('0x13')]);router[_0x7a3b('0x14')]('/:id',auth[_0x7a3b('0xb')](),controller[_0x7a3b('0x15')]);router[_0x7a3b('0x16')]('/:id',auth[_0x7a3b('0xb')](),controller[_0x7a3b('0x17')]);module[_0x7a3b('0x18')]=router; \ No newline at end of file +var _0x9d02=['./intZohoConfiguration.controller','get','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','create','put','/:id','update','delete','exports','multer','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x45b6da,_0x1fb91b){var _0xc9dc6b=function(_0x116442){while(--_0x116442){_0x45b6da['push'](_0x45b6da['shift']());}};_0xc9dc6b(++_0x1fb91b);}(_0x9d02,0x118));var _0x29d0=function(_0x559508,_0x33ddb9){_0x559508=_0x559508-0x0;var _0x2b6aec=_0x9d02[_0x559508];return _0x2b6aec;};'use strict';var multer=require(_0x29d0('0x0'));var util=require('util');var path=require(_0x29d0('0x1'));var timeout=require('connect-timeout');var express=require(_0x29d0('0x2'));var router=express['Router']();var auth=require(_0x29d0('0x3'));var interaction=require(_0x29d0('0x4'));var config=require('../../config/environment');var controller=require(_0x29d0('0x5'));router[_0x29d0('0x6')]('/',auth[_0x29d0('0x7')](),controller['index']);router['get']('/:id',auth[_0x29d0('0x7')](),controller[_0x29d0('0x8')]);router['get'](_0x29d0('0x9'),auth[_0x29d0('0x7')](),controller['getFields']);router[_0x29d0('0x6')](_0x29d0('0xa'),auth['isAuthenticated'](),controller[_0x29d0('0xb')]);router[_0x29d0('0x6')](_0x29d0('0xc'),auth[_0x29d0('0x7')](),controller['getDescriptions']);router['post']('/',auth[_0x29d0('0x7')](),controller[_0x29d0('0xd')]);router[_0x29d0('0xe')](_0x29d0('0xf'),auth[_0x29d0('0x7')](),controller[_0x29d0('0x10')]);router[_0x29d0('0x11')](_0x29d0('0xf'),auth[_0x29d0('0x7')](),controller['destroy']);module[_0x29d0('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 22eaa94..f29ea49 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 _0xcb51=['lead','contact','nothing','contact_lead','sequelize','exports','STRING','ENUM'];(function(_0x36380b,_0x2515ff){var _0x61baa3=function(_0x16e1c4){while(--_0x16e1c4){_0x36380b['push'](_0x36380b['shift']());}};_0x61baa3(++_0x2515ff);}(_0xcb51,0x1a4));var _0x1cb5=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xcb51[_0x5f0089];return _0x193892;};'use strict';var Sequelize=require(_0x1cb5('0x0'));module[_0x1cb5('0x1')]={'name':{'type':Sequelize[_0x1cb5('0x2')]},'moduleCreate':{'type':Sequelize[_0x1cb5('0x3')](_0x1cb5('0x4'),_0x1cb5('0x5'),_0x1cb5('0x6')),'defaultValue':_0x1cb5('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x1cb5('0x7'),_0x1cb5('0x5'),_0x1cb5('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x1cb5('0x2')]}}; \ No newline at end of file +var _0x1c2a=['sequelize','STRING','ENUM','lead','contact_lead','contact'];(function(_0x37c942,_0x12f39b){var _0x17185c=function(_0x2b925a){while(--_0x2b925a){_0x37c942['push'](_0x37c942['shift']());}};_0x17185c(++_0x12f39b);}(_0x1c2a,0xf6));var _0xa1c2=function(_0x3ab9db,_0xe92202){_0x3ab9db=_0x3ab9db-0x0;var _0x51f6d1=_0x1c2a[_0x3ab9db];return _0x51f6d1;};'use strict';var Sequelize=require(_0xa1c2('0x0'));module['exports']={'name':{'type':Sequelize[_0xa1c2('0x1')]},'moduleCreate':{'type':Sequelize[_0xa1c2('0x2')](_0xa1c2('0x3'),'contact','nothing'),'defaultValue':_0xa1c2('0x3')},'moduleSearch':{'type':Sequelize[_0xa1c2('0x2')](_0xa1c2('0x4'),_0xa1c2('0x5'),'lead'),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index fe75fa0..c93eedd 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 _0x9561=['type','VIRTUAL','options','ZohoConfiguration','includeAll','include','findAll','rows','keys','find','create','body','update','params','getFields','findOne','ZohoField','pick','getSubjects','order','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../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','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','sendStatus','status','json','count','offset','limit','apply','reject','save','destroy','end','stack','name','send','index','map','rawAttributes','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x15de7e,_0x56bee3){var _0x37d74d=function(_0x4d44bc){while(--_0x4d44bc){_0x15de7e['push'](_0x15de7e['shift']());}};_0x37d74d(++_0x56bee3);}(_0x9561,0x18d));var _0x1956=function(_0x524bb0,_0x326327){_0x524bb0=_0x524bb0-0x0;var _0x2fb947=_0x9561[_0x524bb0];return _0x2fb947;};'use strict';var pdf=require(_0x1956('0x0'));var emlformat=require(_0x1956('0x1'));var rimraf=require(_0x1956('0x2'));var zipdir=require(_0x1956('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1956('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1956('0x5'));var util=require('util');var path=require(_0x1956('0x6'));var sox=require(_0x1956('0x7'));var csv=require('to-csv');var ejs=require(_0x1956('0x8'));var fs=require('fs');var _=require(_0x1956('0x9'));var squel=require(_0x1956('0xa'));var crypto=require(_0x1956('0xb'));var jsforce=require(_0x1956('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1956('0xd'));var querystring=require(_0x1956('0xe'));var Papa=require(_0x1956('0xf'));var Redis=require(_0x1956('0x10'));var authService=require(_0x1956('0x11'));var qs=require(_0x1956('0x12'));var as=require(_0x1956('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x1956('0x14'));var config=require(_0x1956('0x15'));var db=require(_0x1956('0x16'))['db'];var jayson=require(_0x1956('0x17'));var client=jayson[_0x1956('0x18')][_0x1956('0x19')]({'port':0x232a});function checkPasswordPattern(_0x2fa324,_0x401a92,_0x1aeb7d){if(_0x1aeb7d){var _0x3439f0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3439f0[_0x1956('0x1a')](_0x401a92)){return _0x2fa324;}else{throw new db[(_0x1956('0x1b'))][(_0x1956('0x1c'))](_0x1956('0x1d'));}}else{return _0x2fa324;}}function respondWithRpcPromise(_0x125d77,_0x4d411f,_0x4fefbe,_0x172d0f){return new BPromise(function(_0x5282c9,_0x43ee4b){var _0x3b76b2=_0x172d0f||client;return _0x3b76b2[_0x1956('0x1e')](_0x125d77,_0x4fefbe)[_0x1956('0x1f')](function(_0x3c88ac){logger[_0x1956('0x20')](_0x1956('0x21'),_0x4d411f,_0x1956('0x22'));logger[_0x1956('0x23')](_0x1956('0x24'),_0x4d411f,_0x1956('0x22'),JSON[_0x1956('0x25')](_0x3c88ac));if(_0x3c88ac['error']){if(_0x3c88ac['error'][_0x1956('0x26')]===0x1f4){logger[_0x1956('0x27')]('ZohoConfiguration,\x20%s,\x20%s',_0x4d411f,_0x3c88ac[_0x1956('0x27')]['message']);return _0x43ee4b(_0x3c88ac[_0x1956('0x27')][_0x1956('0x28')]);}logger['error'](_0x1956('0x21'),_0x4d411f,_0x3c88ac[_0x1956('0x27')][_0x1956('0x28')]);return _0x5282c9(_0x3c88ac['error'][_0x1956('0x28')]);}else{logger[_0x1956('0x20')](_0x1956('0x21'),_0x4d411f,_0x1956('0x22'));_0x5282c9(_0x3c88ac['result'][_0x1956('0x28')]);}})[_0x1956('0x29')](function(_0x2163a5){logger[_0x1956('0x27')](_0x1956('0x21'),_0x4d411f,_0x2163a5);_0x43ee4b(_0x2163a5);});});}function respondWithStatusCode(_0x19209f,_0x4500d6){_0x4500d6=_0x4500d6||0xcc;return function(_0x34cba4){if(_0x34cba4){return _0x19209f[_0x1956('0x2a')](_0x4500d6);}return _0x19209f[_0x1956('0x2b')](_0x4500d6)['end']();};}function respondWithResult(_0x543b24,_0x148c90){_0x148c90=_0x148c90||0xc8;return function(_0x406531){if(_0x406531){return _0x543b24[_0x1956('0x2b')](_0x148c90)[_0x1956('0x2c')](_0x406531);}};}function respondWithFilteredResult(_0x152abf,_0x5420dc){return function(_0x45a38e){if(_0x45a38e){var _0x69e4d7=_0x45a38e[_0x1956('0x2d')],_0x1ec17c=_0x5420dc[_0x1956('0x2e')],_0x4cd3b2=_0x5420dc['offset']+_0x5420dc[_0x1956('0x2f')],_0x2f1fda;if(_0x4cd3b2>=_0x69e4d7){_0x4cd3b2=_0x69e4d7;_0x2f1fda=0xc8;}else{_0x2f1fda=0xce;}_0x152abf['status'](_0x2f1fda);return _0x152abf['set']('Content-Range',_0x1ec17c+'-'+_0x4cd3b2+'/'+_0x69e4d7)[_0x1956('0x2c')](_0x45a38e);}return null;};}function patchUpdates(_0x56d435){return function(_0x2065ba){try{jsonpatch[_0x1956('0x30')](_0x2065ba,_0x56d435,!![]);}catch(_0xf3a9a9){return BPromise[_0x1956('0x31')](_0xf3a9a9);}return _0x2065ba[_0x1956('0x32')]();};}function saveUpdates(_0x57804f,_0x275d21){return function(_0x48b8da){if(_0x48b8da){return _0x48b8da['update'](_0x57804f)[_0x1956('0x1f')](function(_0x1b7cc0){return _0x1b7cc0;});}return null;};}function removeEntity(_0x2f0a8c,_0x51e1cb){return function(_0x43ddf8){if(_0x43ddf8){return _0x43ddf8[_0x1956('0x33')]()['then'](function(){_0x2f0a8c['status'](0xcc)[_0x1956('0x34')]();});}};}function handleEntityNotFound(_0x550033,_0x1e03fe){return function(_0x29b725){if(!_0x29b725){_0x550033[_0x1956('0x2a')](0x194);}return _0x29b725;};}function handleError(_0x52add4,_0x58a2a6){_0x58a2a6=_0x58a2a6||0x1f4;return function(_0x32d336){logger[_0x1956('0x27')](_0x32d336[_0x1956('0x35')]);if(_0x32d336[_0x1956('0x36')]){delete _0x32d336[_0x1956('0x36')];}_0x52add4['status'](_0x58a2a6)[_0x1956('0x37')](_0x32d336);};}exports[_0x1956('0x38')]=function(_0x51d8df,_0x1aa2e1){var _0x5b73e8={},_0x2dd6d0={},_0x56d302={'count':0x0,'rows':[]};var _0xa32474=_[_0x1956('0x39')](db['ZohoConfiguration'][_0x1956('0x3a')],function(_0xdfc31d){return{'name':_0xdfc31d['fieldName'],'type':_0xdfc31d['type'][_0x1956('0x3b')]};});_0x2dd6d0['model']=_['map'](_0xa32474,_0x1956('0x36'));_0x2dd6d0['query']=_['keys'](_0x51d8df[_0x1956('0x3c')]);_0x2dd6d0[_0x1956('0x3d')]=_[_0x1956('0x3e')](_0x2dd6d0['model'],_0x2dd6d0[_0x1956('0x3c')]);_0x5b73e8[_0x1956('0x3f')]=_[_0x1956('0x3e')](_0x2dd6d0[_0x1956('0x40')],qs[_0x1956('0x41')](_0x51d8df[_0x1956('0x3c')][_0x1956('0x41')]));_0x5b73e8['attributes']=_0x5b73e8['attributes'][_0x1956('0x42')]?_0x5b73e8['attributes']:_0x2dd6d0[_0x1956('0x40')];if(!_0x51d8df['query'][_0x1956('0x43')](_0x1956('0x44'))){_0x5b73e8['limit']=qs[_0x1956('0x2f')](_0x51d8df['query'][_0x1956('0x2f')]);_0x5b73e8[_0x1956('0x2e')]=qs[_0x1956('0x2e')](_0x51d8df[_0x1956('0x3c')]['offset']);}_0x5b73e8['order']=qs[_0x1956('0x45')](_0x51d8df[_0x1956('0x3c')]['sort']);_0x5b73e8[_0x1956('0x46')]=qs[_0x1956('0x3d')](_['pick'](_0x51d8df['query'],_0x2dd6d0[_0x1956('0x3d')]),_0xa32474);if(_0x51d8df[_0x1956('0x3c')][_0x1956('0x47')]){_0x5b73e8[_0x1956('0x46')]=_[_0x1956('0x48')](_0x5b73e8[_0x1956('0x46')],{'$or':_[_0x1956('0x39')](_0xa32474,function(_0x3561d2){if(_0x3561d2[_0x1956('0x49')]!==_0x1956('0x4a')){var _0x43d97d={};_0x43d97d[_0x3561d2[_0x1956('0x36')]]={'$like':'%'+_0x51d8df[_0x1956('0x3c')]['filter']+'%'};return _0x43d97d;}})});}_0x5b73e8=_[_0x1956('0x48')]({},_0x5b73e8,_0x51d8df[_0x1956('0x4b')]);var _0x3924ca={'where':_0x5b73e8['where']};return db[_0x1956('0x4c')][_0x1956('0x2d')](_0x3924ca)[_0x1956('0x1f')](function(_0x393de4){_0x56d302[_0x1956('0x2d')]=_0x393de4;if(_0x51d8df['query'][_0x1956('0x4d')]){_0x5b73e8[_0x1956('0x4e')]=[{'all':!![]}];}return db[_0x1956('0x4c')][_0x1956('0x4f')](_0x5b73e8);})[_0x1956('0x1f')](function(_0x5106ba){_0x56d302[_0x1956('0x50')]=_0x5106ba;return _0x56d302;})[_0x1956('0x1f')](respondWithFilteredResult(_0x1aa2e1,_0x5b73e8))[_0x1956('0x29')](handleError(_0x1aa2e1,null));};exports['show']=function(_0x4c7d32,_0x16620f){var _0x262f46={'raw':![],'where':{'id':_0x4c7d32['params']['id']}},_0x5d3040={};_0x5d3040[_0x1956('0x40')]=_[_0x1956('0x51')](db[_0x1956('0x4c')]['rawAttributes']);_0x5d3040[_0x1956('0x3c')]=_[_0x1956('0x51')](_0x4c7d32[_0x1956('0x3c')]);_0x5d3040['filters']=_['intersection'](_0x5d3040[_0x1956('0x40')],_0x5d3040['query']);_0x262f46[_0x1956('0x3f')]=_[_0x1956('0x3e')](_0x5d3040[_0x1956('0x40')],qs['fields'](_0x4c7d32[_0x1956('0x3c')][_0x1956('0x41')]));_0x262f46[_0x1956('0x3f')]=_0x262f46[_0x1956('0x3f')][_0x1956('0x42')]?_0x262f46[_0x1956('0x3f')]:_0x5d3040['model'];if(_0x4c7d32[_0x1956('0x3c')][_0x1956('0x4d')]){_0x262f46['include']=[{'all':!![]}];}_0x262f46=_[_0x1956('0x48')]({},_0x262f46,_0x4c7d32[_0x1956('0x4b')]);return db[_0x1956('0x4c')][_0x1956('0x52')](_0x262f46)[_0x1956('0x1f')](handleEntityNotFound(_0x16620f,null))[_0x1956('0x1f')](respondWithResult(_0x16620f,null))['catch'](handleError(_0x16620f,null));};exports[_0x1956('0x53')]=function(_0x2dd933,_0x5e459a){return db[_0x1956('0x4c')]['create'](_0x2dd933[_0x1956('0x54')],{})[_0x1956('0x1f')](respondWithResult(_0x5e459a,0xc9))[_0x1956('0x29')](handleError(_0x5e459a,null));};exports[_0x1956('0x55')]=function(_0x10421d,_0x19fb8b){if(_0x10421d[_0x1956('0x54')]['id']){delete _0x10421d[_0x1956('0x54')]['id'];}return db[_0x1956('0x4c')][_0x1956('0x52')]({'where':{'id':_0x10421d[_0x1956('0x56')]['id']}})[_0x1956('0x1f')](handleEntityNotFound(_0x19fb8b,null))[_0x1956('0x1f')](saveUpdates(_0x10421d[_0x1956('0x54')],null))['then'](respondWithResult(_0x19fb8b,null))['catch'](handleError(_0x19fb8b,null));};exports[_0x1956('0x33')]=function(_0x553172,_0xcfc6d4){return db['ZohoConfiguration'][_0x1956('0x52')]({'where':{'id':_0x553172[_0x1956('0x56')]['id']}})['then'](handleEntityNotFound(_0xcfc6d4,null))[_0x1956('0x1f')](removeEntity(_0xcfc6d4,null))[_0x1956('0x29')](handleError(_0xcfc6d4,null));};exports[_0x1956('0x57')]=function(_0x359f71,_0x3b58be,_0x34471b){var _0x94f866={};var _0x1bcf48={};var _0x27fd19;var _0x47c8e0;return db[_0x1956('0x4c')][_0x1956('0x58')]({'where':{'id':_0x359f71[_0x1956('0x56')]['id']}})['then'](handleEntityNotFound(_0x3b58be,null))[_0x1956('0x1f')](function(_0x406211){if(_0x406211){_0x27fd19=_0x406211;_0x1bcf48[_0x1956('0x40')]=_[_0x1956('0x51')](db[_0x1956('0x59')]['rawAttributes']);_0x1bcf48[_0x1956('0x3c')]=_[_0x1956('0x51')](_0x359f71[_0x1956('0x3c')]);_0x1bcf48['filters']=_['intersection'](_0x1bcf48['model'],_0x1bcf48[_0x1956('0x3c')]);_0x94f866[_0x1956('0x3f')]=_[_0x1956('0x3e')](_0x1bcf48['model'],qs[_0x1956('0x41')](_0x359f71['query'][_0x1956('0x41')]));_0x94f866[_0x1956('0x3f')]=_0x94f866[_0x1956('0x3f')][_0x1956('0x42')]?_0x94f866[_0x1956('0x3f')]:_0x1bcf48[_0x1956('0x40')];_0x94f866['order']=qs[_0x1956('0x45')](_0x359f71[_0x1956('0x3c')][_0x1956('0x45')]);_0x94f866[_0x1956('0x46')]=qs[_0x1956('0x3d')](_[_0x1956('0x5a')](_0x359f71[_0x1956('0x3c')],_0x1bcf48['filters']));if(_0x359f71[_0x1956('0x3c')]['filter']){_0x94f866['where']=_[_0x1956('0x48')](_0x94f866[_0x1956('0x46')],{'$or':_[_0x1956('0x39')](_0x94f866[_0x1956('0x3f')],function(_0x384ce5){var _0x590f03={};_0x590f03[_0x384ce5]={'$like':'%'+_0x359f71['query'][_0x1956('0x47')]+'%'};return _0x590f03;})});}_0x94f866=_[_0x1956('0x48')]({},_0x94f866,_0x359f71[_0x1956('0x4b')]);return _0x27fd19[_0x1956('0x57')](_0x94f866);}})[_0x1956('0x1f')](function(_0x31fb7b){if(_0x31fb7b){_0x47c8e0=_0x31fb7b['length'];if(!_0x359f71[_0x1956('0x3c')][_0x1956('0x43')]('nolimit')){_0x94f866[_0x1956('0x2f')]=qs[_0x1956('0x2f')](_0x359f71[_0x1956('0x3c')]['limit']);_0x94f866['offset']=qs[_0x1956('0x2e')](_0x359f71[_0x1956('0x3c')][_0x1956('0x2e')]);}return _0x27fd19[_0x1956('0x57')](_0x94f866);}})[_0x1956('0x1f')](function(_0x76c344){if(_0x76c344){return _0x76c344?{'count':_0x47c8e0,'rows':_0x76c344}:null;}})['then'](respondWithResult(_0x3b58be,null))[_0x1956('0x29')](handleError(_0x3b58be,null));};exports[_0x1956('0x5b')]=function(_0x1b0545,_0x492f3f,_0x3d3aae){var _0x57ae7d={};var _0x2e8e46={};var _0x5d2b5b;var _0x5b9a6a;return db[_0x1956('0x4c')][_0x1956('0x58')]({'where':{'id':_0x1b0545[_0x1956('0x56')]['id']}})['then'](handleEntityNotFound(_0x492f3f,null))['then'](function(_0x560045){if(_0x560045){_0x5d2b5b=_0x560045;_0x2e8e46['model']=_[_0x1956('0x51')](db[_0x1956('0x59')][_0x1956('0x3a')]);_0x2e8e46[_0x1956('0x3c')]=_[_0x1956('0x51')](_0x1b0545[_0x1956('0x3c')]);_0x2e8e46[_0x1956('0x3d')]=_[_0x1956('0x3e')](_0x2e8e46[_0x1956('0x40')],_0x2e8e46['query']);_0x57ae7d[_0x1956('0x3f')]=_[_0x1956('0x3e')](_0x2e8e46[_0x1956('0x40')],qs[_0x1956('0x41')](_0x1b0545['query'][_0x1956('0x41')]));_0x57ae7d[_0x1956('0x3f')]=_0x57ae7d['attributes'][_0x1956('0x42')]?_0x57ae7d['attributes']:_0x2e8e46[_0x1956('0x40')];_0x57ae7d[_0x1956('0x5c')]=qs[_0x1956('0x45')](_0x1b0545[_0x1956('0x3c')]['sort']);_0x57ae7d[_0x1956('0x46')]=qs[_0x1956('0x3d')](_[_0x1956('0x5a')](_0x1b0545[_0x1956('0x3c')],_0x2e8e46[_0x1956('0x3d')]));if(_0x1b0545['query']['filter']){_0x57ae7d[_0x1956('0x46')]=_[_0x1956('0x48')](_0x57ae7d['where'],{'$or':_[_0x1956('0x39')](_0x57ae7d[_0x1956('0x3f')],function(_0x1c55f8){var _0x402930={};_0x402930[_0x1c55f8]={'$like':'%'+_0x1b0545[_0x1956('0x3c')][_0x1956('0x47')]+'%'};return _0x402930;})});}_0x57ae7d=_[_0x1956('0x48')]({},_0x57ae7d,_0x1b0545['options']);return _0x5d2b5b[_0x1956('0x5b')](_0x57ae7d);}})[_0x1956('0x1f')](function(_0x175e10){if(_0x175e10){_0x5b9a6a=_0x175e10['length'];if(!_0x1b0545[_0x1956('0x3c')]['hasOwnProperty'](_0x1956('0x44'))){_0x57ae7d[_0x1956('0x2f')]=qs[_0x1956('0x2f')](_0x1b0545[_0x1956('0x3c')][_0x1956('0x2f')]);_0x57ae7d['offset']=qs[_0x1956('0x2e')](_0x1b0545[_0x1956('0x3c')]['offset']);}return _0x5d2b5b[_0x1956('0x5b')](_0x57ae7d);}})[_0x1956('0x1f')](function(_0x135b04){if(_0x135b04){return _0x135b04?{'count':_0x5b9a6a,'rows':_0x135b04}:null;}})[_0x1956('0x1f')](respondWithResult(_0x492f3f,null))[_0x1956('0x29')](handleError(_0x492f3f,null));};exports[_0x1956('0x5d')]=function(_0x24aa32,_0x24f305,_0x194288){var _0x1a03e2={};var _0x3c3bcf={};var _0x1972ae;var _0x332307;return db[_0x1956('0x4c')][_0x1956('0x58')]({'where':{'id':_0x24aa32[_0x1956('0x56')]['id']}})[_0x1956('0x1f')](handleEntityNotFound(_0x24f305,null))[_0x1956('0x1f')](function(_0x2726b5){if(_0x2726b5){_0x1972ae=_0x2726b5;_0x3c3bcf['model']=_[_0x1956('0x51')](db[_0x1956('0x59')][_0x1956('0x3a')]);_0x3c3bcf[_0x1956('0x3c')]=_[_0x1956('0x51')](_0x24aa32[_0x1956('0x3c')]);_0x3c3bcf[_0x1956('0x3d')]=_['intersection'](_0x3c3bcf[_0x1956('0x40')],_0x3c3bcf['query']);_0x1a03e2[_0x1956('0x3f')]=_[_0x1956('0x3e')](_0x3c3bcf[_0x1956('0x40')],qs['fields'](_0x24aa32[_0x1956('0x3c')][_0x1956('0x41')]));_0x1a03e2[_0x1956('0x3f')]=_0x1a03e2[_0x1956('0x3f')][_0x1956('0x42')]?_0x1a03e2['attributes']:_0x3c3bcf['model'];_0x1a03e2[_0x1956('0x5c')]=qs[_0x1956('0x45')](_0x24aa32[_0x1956('0x3c')]['sort']);_0x1a03e2[_0x1956('0x46')]=qs[_0x1956('0x3d')](_[_0x1956('0x5a')](_0x24aa32['query'],_0x3c3bcf[_0x1956('0x3d')]));if(_0x24aa32[_0x1956('0x3c')]['filter']){_0x1a03e2[_0x1956('0x46')]=_[_0x1956('0x48')](_0x1a03e2[_0x1956('0x46')],{'$or':_[_0x1956('0x39')](_0x1a03e2[_0x1956('0x3f')],function(_0x2d94de){var _0x208165={};_0x208165[_0x2d94de]={'$like':'%'+_0x24aa32['query'][_0x1956('0x47')]+'%'};return _0x208165;})});}_0x1a03e2=_[_0x1956('0x48')]({},_0x1a03e2,_0x24aa32['options']);return _0x1972ae['getDescriptions'](_0x1a03e2);}})[_0x1956('0x1f')](function(_0x5e1bc5){if(_0x5e1bc5){_0x332307=_0x5e1bc5[_0x1956('0x42')];if(!_0x24aa32['query']['hasOwnProperty'](_0x1956('0x44'))){_0x1a03e2['limit']=qs[_0x1956('0x2f')](_0x24aa32[_0x1956('0x3c')][_0x1956('0x2f')]);_0x1a03e2[_0x1956('0x2e')]=qs[_0x1956('0x2e')](_0x24aa32[_0x1956('0x3c')][_0x1956('0x2e')]);}return _0x1972ae[_0x1956('0x5d')](_0x1a03e2);}})[_0x1956('0x1f')](function(_0x488c1b){if(_0x488c1b){return _0x488c1b?{'count':_0x332307,'rows':_0x488c1b}:null;}})[_0x1956('0x1f')](respondWithResult(_0x24f305,null))[_0x1956('0x29')](handleError(_0x24f305,null));}; \ No newline at end of file +var _0x16ba=['ZohoConfiguration','include','show','params','includeAll','create','body','find','getFields','ZohoField','hasOwnProperty','nolimit','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x16ba,0x123));var _0xa16b=function(_0x5e0ee5,_0x21d640){_0x5e0ee5=_0x5e0ee5-0x0;var _0x111937=_0x16ba[_0x5e0ee5];return _0x111937;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa16b('0x0'));var rimraf=require(_0xa16b('0x1'));var zipdir=require(_0xa16b('0x2'));var jsonpatch=require(_0xa16b('0x3'));var rp=require(_0xa16b('0x4'));var moment=require('moment');var BPromise=require(_0xa16b('0x5'));var Mustache=require(_0xa16b('0x6'));var util=require(_0xa16b('0x7'));var path=require(_0xa16b('0x8'));var sox=require(_0xa16b('0x9'));var csv=require(_0xa16b('0xa'));var ejs=require(_0xa16b('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa16b('0xc'));var crypto=require('crypto');var jsforce=require(_0xa16b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa16b('0xa'));var querystring=require('querystring');var Papa=require(_0xa16b('0xe'));var Redis=require(_0xa16b('0xf'));var authService=require(_0xa16b('0x10'));var qs=require(_0xa16b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa16b('0x12'));var logger=require(_0xa16b('0x13'))(_0xa16b('0x14'));var utils=require(_0xa16b('0x15'));var config=require(_0xa16b('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xa16b('0x17'));var client=jayson[_0xa16b('0x18')][_0xa16b('0x19')]({'port':0x232a});function checkPasswordPattern(_0x50420d,_0x2aa8fa,_0x388351){if(_0x388351){var _0x3d07a4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3d07a4[_0xa16b('0x1a')](_0x2aa8fa)){return _0x50420d;}else{throw new db[(_0xa16b('0x1b'))][(_0xa16b('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x50420d;}}function respondWithRpcPromise(_0x60472a,_0x22258a,_0x7c98af,_0x5721f3){return new BPromise(function(_0x1643ee,_0x24c8d5){var _0x432201=_0x5721f3||client;return _0x432201['request'](_0x60472a,_0x7c98af)[_0xa16b('0x1d')](function(_0x34957f){logger['info'](_0xa16b('0x1e'),_0x22258a,_0xa16b('0x1f'));logger[_0xa16b('0x20')](_0xa16b('0x21'),_0x22258a,_0xa16b('0x1f'),JSON[_0xa16b('0x22')](_0x34957f));if(_0x34957f[_0xa16b('0x23')]){if(_0x34957f[_0xa16b('0x23')][_0xa16b('0x24')]===0x1f4){logger[_0xa16b('0x23')]('ZohoConfiguration,\x20%s,\x20%s',_0x22258a,_0x34957f['error'][_0xa16b('0x25')]);return _0x24c8d5(_0x34957f[_0xa16b('0x23')]['message']);}logger[_0xa16b('0x23')]('ZohoConfiguration,\x20%s,\x20%s',_0x22258a,_0x34957f[_0xa16b('0x23')][_0xa16b('0x25')]);return _0x1643ee(_0x34957f[_0xa16b('0x23')]['message']);}else{logger[_0xa16b('0x26')](_0xa16b('0x1e'),_0x22258a,_0xa16b('0x1f'));_0x1643ee(_0x34957f['result'][_0xa16b('0x25')]);}})[_0xa16b('0x27')](function(_0xd6b665){logger[_0xa16b('0x23')](_0xa16b('0x1e'),_0x22258a,_0xd6b665);_0x24c8d5(_0xd6b665);});});}function respondWithStatusCode(_0x279827,_0x5bf39b){_0x5bf39b=_0x5bf39b||0xcc;return function(_0x380373){if(_0x380373){return _0x279827[_0xa16b('0x28')](_0x5bf39b);}return _0x279827[_0xa16b('0x29')](_0x5bf39b)[_0xa16b('0x2a')]();};}function respondWithResult(_0x46ce6a,_0x249b7b){_0x249b7b=_0x249b7b||0xc8;return function(_0x4ff2ba){if(_0x4ff2ba){return _0x46ce6a[_0xa16b('0x29')](_0x249b7b)[_0xa16b('0x2b')](_0x4ff2ba);}};}function respondWithFilteredResult(_0x44f9a4,_0x113ce4){return function(_0x3ed566){if(_0x3ed566){var _0x1a4aa7=_0x3ed566[_0xa16b('0x2c')],_0x51ea6a=_0x113ce4[_0xa16b('0x2d')],_0x15fc90=_0x113ce4[_0xa16b('0x2d')]+_0x113ce4['limit'],_0x57e081;if(_0x15fc90>=_0x1a4aa7){_0x15fc90=_0x1a4aa7;_0x57e081=0xc8;}else{_0x57e081=0xce;}_0x44f9a4[_0xa16b('0x29')](_0x57e081);return _0x44f9a4[_0xa16b('0x2e')]('Content-Range',_0x51ea6a+'-'+_0x15fc90+'/'+_0x1a4aa7)[_0xa16b('0x2b')](_0x3ed566);}return null;};}function patchUpdates(_0x5c67ed){return function(_0x2bffad){try{jsonpatch[_0xa16b('0x2f')](_0x2bffad,_0x5c67ed,!![]);}catch(_0x48c68c){return BPromise[_0xa16b('0x30')](_0x48c68c);}return _0x2bffad[_0xa16b('0x31')]();};}function saveUpdates(_0x5eade2,_0x36ad53){return function(_0x2f66c3){if(_0x2f66c3){return _0x2f66c3[_0xa16b('0x32')](_0x5eade2)['then'](function(_0x4bd53b){return _0x4bd53b;});}return null;};}function removeEntity(_0x5382c6,_0x4481b9){return function(_0x24b9a5){if(_0x24b9a5){return _0x24b9a5[_0xa16b('0x33')]()[_0xa16b('0x1d')](function(){_0x5382c6[_0xa16b('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e0f12,_0x3e1e98){return function(_0x37458a){if(!_0x37458a){_0x2e0f12[_0xa16b('0x28')](0x194);}return _0x37458a;};}function handleError(_0x877cdb,_0x1664be){_0x1664be=_0x1664be||0x1f4;return function(_0x36f3bb){logger['error'](_0x36f3bb[_0xa16b('0x34')]);if(_0x36f3bb[_0xa16b('0x35')]){delete _0x36f3bb[_0xa16b('0x35')];}_0x877cdb[_0xa16b('0x29')](_0x1664be)[_0xa16b('0x36')](_0x36f3bb);};}exports[_0xa16b('0x37')]=function(_0x1d4737,_0x195149){var _0x2977aa={},_0x4610c6={},_0x27eeed={'count':0x0,'rows':[]};var _0x4774a4=_[_0xa16b('0x38')](db['ZohoConfiguration'][_0xa16b('0x39')],function(_0x2b8bf4){return{'name':_0x2b8bf4['fieldName'],'type':_0x2b8bf4[_0xa16b('0x3a')][_0xa16b('0x3b')]};});_0x4610c6[_0xa16b('0x3c')]=_[_0xa16b('0x38')](_0x4774a4,_0xa16b('0x35'));_0x4610c6[_0xa16b('0x3d')]=_[_0xa16b('0x3e')](_0x1d4737[_0xa16b('0x3d')]);_0x4610c6['filters']=_[_0xa16b('0x3f')](_0x4610c6[_0xa16b('0x3c')],_0x4610c6[_0xa16b('0x3d')]);_0x2977aa[_0xa16b('0x40')]=_[_0xa16b('0x3f')](_0x4610c6['model'],qs['fields'](_0x1d4737[_0xa16b('0x3d')][_0xa16b('0x41')]));_0x2977aa[_0xa16b('0x40')]=_0x2977aa[_0xa16b('0x40')][_0xa16b('0x42')]?_0x2977aa[_0xa16b('0x40')]:_0x4610c6[_0xa16b('0x3c')];if(!_0x1d4737[_0xa16b('0x3d')]['hasOwnProperty']('nolimit')){_0x2977aa[_0xa16b('0x43')]=qs[_0xa16b('0x43')](_0x1d4737[_0xa16b('0x3d')][_0xa16b('0x43')]);_0x2977aa['offset']=qs[_0xa16b('0x2d')](_0x1d4737['query'][_0xa16b('0x2d')]);}_0x2977aa[_0xa16b('0x44')]=qs[_0xa16b('0x45')](_0x1d4737[_0xa16b('0x3d')]['sort']);_0x2977aa[_0xa16b('0x46')]=qs[_0xa16b('0x47')](_[_0xa16b('0x48')](_0x1d4737[_0xa16b('0x3d')],_0x4610c6[_0xa16b('0x47')]),_0x4774a4);if(_0x1d4737[_0xa16b('0x3d')]['filter']){_0x2977aa['where']=_[_0xa16b('0x49')](_0x2977aa[_0xa16b('0x46')],{'$or':_[_0xa16b('0x38')](_0x4774a4,function(_0x531162){if(_0x531162['type']!==_0xa16b('0x4a')){var _0x5b754d={};_0x5b754d[_0x531162[_0xa16b('0x35')]]={'$like':'%'+_0x1d4737[_0xa16b('0x3d')][_0xa16b('0x4b')]+'%'};return _0x5b754d;}})});}_0x2977aa=_[_0xa16b('0x49')]({},_0x2977aa,_0x1d4737[_0xa16b('0x4c')]);var _0x52e6a2={'where':_0x2977aa[_0xa16b('0x46')]};return db[_0xa16b('0x4d')]['count'](_0x52e6a2)[_0xa16b('0x1d')](function(_0x43535d){_0x27eeed[_0xa16b('0x2c')]=_0x43535d;if(_0x1d4737[_0xa16b('0x3d')]['includeAll']){_0x2977aa[_0xa16b('0x4e')]=[{'all':!![]}];}return db[_0xa16b('0x4d')]['findAll'](_0x2977aa);})[_0xa16b('0x1d')](function(_0x446220){_0x27eeed['rows']=_0x446220;return _0x27eeed;})['then'](respondWithFilteredResult(_0x195149,_0x2977aa))[_0xa16b('0x27')](handleError(_0x195149,null));};exports[_0xa16b('0x4f')]=function(_0x3e8220,_0x2b6297){var _0x2300d3={'raw':![],'where':{'id':_0x3e8220[_0xa16b('0x50')]['id']}},_0x276af1={};_0x276af1[_0xa16b('0x3c')]=_[_0xa16b('0x3e')](db['ZohoConfiguration'][_0xa16b('0x39')]);_0x276af1[_0xa16b('0x3d')]=_[_0xa16b('0x3e')](_0x3e8220[_0xa16b('0x3d')]);_0x276af1[_0xa16b('0x47')]=_[_0xa16b('0x3f')](_0x276af1[_0xa16b('0x3c')],_0x276af1[_0xa16b('0x3d')]);_0x2300d3[_0xa16b('0x40')]=_[_0xa16b('0x3f')](_0x276af1['model'],qs[_0xa16b('0x41')](_0x3e8220[_0xa16b('0x3d')]['fields']));_0x2300d3[_0xa16b('0x40')]=_0x2300d3[_0xa16b('0x40')]['length']?_0x2300d3['attributes']:_0x276af1[_0xa16b('0x3c')];if(_0x3e8220[_0xa16b('0x3d')][_0xa16b('0x51')]){_0x2300d3[_0xa16b('0x4e')]=[{'all':!![]}];}_0x2300d3=_['merge']({},_0x2300d3,_0x3e8220['options']);return db['ZohoConfiguration']['find'](_0x2300d3)[_0xa16b('0x1d')](handleEntityNotFound(_0x2b6297,null))[_0xa16b('0x1d')](respondWithResult(_0x2b6297,null))[_0xa16b('0x27')](handleError(_0x2b6297,null));};exports[_0xa16b('0x52')]=function(_0xd2ce97,_0x40d858){return db[_0xa16b('0x4d')][_0xa16b('0x52')](_0xd2ce97['body'],{})[_0xa16b('0x1d')](respondWithResult(_0x40d858,0xc9))[_0xa16b('0x27')](handleError(_0x40d858,null));};exports['update']=function(_0x2ca7cd,_0x3cadf3){if(_0x2ca7cd[_0xa16b('0x53')]['id']){delete _0x2ca7cd[_0xa16b('0x53')]['id'];}return db['ZohoConfiguration'][_0xa16b('0x54')]({'where':{'id':_0x2ca7cd['params']['id']}})[_0xa16b('0x1d')](handleEntityNotFound(_0x3cadf3,null))['then'](saveUpdates(_0x2ca7cd[_0xa16b('0x53')],null))[_0xa16b('0x1d')](respondWithResult(_0x3cadf3,null))['catch'](handleError(_0x3cadf3,null));};exports[_0xa16b('0x33')]=function(_0x2d9c58,_0x2ea2b1){return db[_0xa16b('0x4d')][_0xa16b('0x54')]({'where':{'id':_0x2d9c58['params']['id']}})[_0xa16b('0x1d')](handleEntityNotFound(_0x2ea2b1,null))[_0xa16b('0x1d')](removeEntity(_0x2ea2b1,null))[_0xa16b('0x27')](handleError(_0x2ea2b1,null));};exports[_0xa16b('0x55')]=function(_0x2da3c5,_0xe5e429,_0x241055){var _0x152002={};var _0x84aa20={};var _0x5c979f;var _0x390240;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x2da3c5[_0xa16b('0x50')]['id']}})[_0xa16b('0x1d')](handleEntityNotFound(_0xe5e429,null))[_0xa16b('0x1d')](function(_0x211f71){if(_0x211f71){_0x5c979f=_0x211f71;_0x84aa20[_0xa16b('0x3c')]=_[_0xa16b('0x3e')](db[_0xa16b('0x56')][_0xa16b('0x39')]);_0x84aa20[_0xa16b('0x3d')]=_['keys'](_0x2da3c5['query']);_0x84aa20[_0xa16b('0x47')]=_[_0xa16b('0x3f')](_0x84aa20['model'],_0x84aa20[_0xa16b('0x3d')]);_0x152002[_0xa16b('0x40')]=_['intersection'](_0x84aa20[_0xa16b('0x3c')],qs[_0xa16b('0x41')](_0x2da3c5[_0xa16b('0x3d')]['fields']));_0x152002[_0xa16b('0x40')]=_0x152002['attributes'][_0xa16b('0x42')]?_0x152002[_0xa16b('0x40')]:_0x84aa20['model'];_0x152002[_0xa16b('0x44')]=qs[_0xa16b('0x45')](_0x2da3c5['query'][_0xa16b('0x45')]);_0x152002[_0xa16b('0x46')]=qs[_0xa16b('0x47')](_[_0xa16b('0x48')](_0x2da3c5[_0xa16b('0x3d')],_0x84aa20[_0xa16b('0x47')]));if(_0x2da3c5['query'][_0xa16b('0x4b')]){_0x152002[_0xa16b('0x46')]=_[_0xa16b('0x49')](_0x152002[_0xa16b('0x46')],{'$or':_[_0xa16b('0x38')](_0x152002[_0xa16b('0x40')],function(_0x37975c){var _0x79338a={};_0x79338a[_0x37975c]={'$like':'%'+_0x2da3c5[_0xa16b('0x3d')]['filter']+'%'};return _0x79338a;})});}_0x152002=_[_0xa16b('0x49')]({},_0x152002,_0x2da3c5[_0xa16b('0x4c')]);return _0x5c979f[_0xa16b('0x55')](_0x152002);}})['then'](function(_0x3cbadd){if(_0x3cbadd){_0x390240=_0x3cbadd[_0xa16b('0x42')];if(!_0x2da3c5[_0xa16b('0x3d')][_0xa16b('0x57')](_0xa16b('0x58'))){_0x152002[_0xa16b('0x43')]=qs['limit'](_0x2da3c5['query']['limit']);_0x152002[_0xa16b('0x2d')]=qs[_0xa16b('0x2d')](_0x2da3c5[_0xa16b('0x3d')][_0xa16b('0x2d')]);}return _0x5c979f['getFields'](_0x152002);}})[_0xa16b('0x1d')](function(_0x167c90){if(_0x167c90){return _0x167c90?{'count':_0x390240,'rows':_0x167c90}:null;}})[_0xa16b('0x1d')](respondWithResult(_0xe5e429,null))['catch'](handleError(_0xe5e429,null));};exports['getSubjects']=function(_0x38bda8,_0x5cabf3,_0x5c909a){var _0x1fa83b={};var _0x2631fb={};var _0x4ae984;var _0x172a85;return db[_0xa16b('0x4d')][_0xa16b('0x59')]({'where':{'id':_0x38bda8['params']['id']}})[_0xa16b('0x1d')](handleEntityNotFound(_0x5cabf3,null))[_0xa16b('0x1d')](function(_0x2c2c46){if(_0x2c2c46){_0x4ae984=_0x2c2c46;_0x2631fb[_0xa16b('0x3c')]=_[_0xa16b('0x3e')](db[_0xa16b('0x56')][_0xa16b('0x39')]);_0x2631fb[_0xa16b('0x3d')]=_[_0xa16b('0x3e')](_0x38bda8['query']);_0x2631fb['filters']=_[_0xa16b('0x3f')](_0x2631fb[_0xa16b('0x3c')],_0x2631fb['query']);_0x1fa83b[_0xa16b('0x40')]=_[_0xa16b('0x3f')](_0x2631fb['model'],qs[_0xa16b('0x41')](_0x38bda8['query']['fields']));_0x1fa83b[_0xa16b('0x40')]=_0x1fa83b['attributes'][_0xa16b('0x42')]?_0x1fa83b[_0xa16b('0x40')]:_0x2631fb[_0xa16b('0x3c')];_0x1fa83b[_0xa16b('0x44')]=qs[_0xa16b('0x45')](_0x38bda8[_0xa16b('0x3d')][_0xa16b('0x45')]);_0x1fa83b[_0xa16b('0x46')]=qs['filters'](_['pick'](_0x38bda8[_0xa16b('0x3d')],_0x2631fb[_0xa16b('0x47')]));if(_0x38bda8['query'][_0xa16b('0x4b')]){_0x1fa83b[_0xa16b('0x46')]=_[_0xa16b('0x49')](_0x1fa83b['where'],{'$or':_['map'](_0x1fa83b[_0xa16b('0x40')],function(_0x36504d){var _0x174211={};_0x174211[_0x36504d]={'$like':'%'+_0x38bda8[_0xa16b('0x3d')][_0xa16b('0x4b')]+'%'};return _0x174211;})});}_0x1fa83b=_[_0xa16b('0x49')]({},_0x1fa83b,_0x38bda8['options']);return _0x4ae984[_0xa16b('0x5a')](_0x1fa83b);}})['then'](function(_0x508602){if(_0x508602){_0x172a85=_0x508602[_0xa16b('0x42')];if(!_0x38bda8['query'][_0xa16b('0x57')](_0xa16b('0x58'))){_0x1fa83b['limit']=qs[_0xa16b('0x43')](_0x38bda8['query']['limit']);_0x1fa83b[_0xa16b('0x2d')]=qs[_0xa16b('0x2d')](_0x38bda8['query']['offset']);}return _0x4ae984[_0xa16b('0x5a')](_0x1fa83b);}})[_0xa16b('0x1d')](function(_0x42bfd8){if(_0x42bfd8){return _0x42bfd8?{'count':_0x172a85,'rows':_0x42bfd8}:null;}})[_0xa16b('0x1d')](respondWithResult(_0x5cabf3,null))['catch'](handleError(_0x5cabf3,null));};exports[_0xa16b('0x5b')]=function(_0x5cd6c2,_0xbe5a8d,_0x471042){var _0x26d1dc={};var _0x4b0b55={};var _0x1d087e;var _0x6a6f91;return db[_0xa16b('0x4d')][_0xa16b('0x59')]({'where':{'id':_0x5cd6c2[_0xa16b('0x50')]['id']}})[_0xa16b('0x1d')](handleEntityNotFound(_0xbe5a8d,null))[_0xa16b('0x1d')](function(_0x1985ea){if(_0x1985ea){_0x1d087e=_0x1985ea;_0x4b0b55[_0xa16b('0x3c')]=_['keys'](db[_0xa16b('0x56')][_0xa16b('0x39')]);_0x4b0b55[_0xa16b('0x3d')]=_[_0xa16b('0x3e')](_0x5cd6c2[_0xa16b('0x3d')]);_0x4b0b55[_0xa16b('0x47')]=_[_0xa16b('0x3f')](_0x4b0b55[_0xa16b('0x3c')],_0x4b0b55[_0xa16b('0x3d')]);_0x26d1dc[_0xa16b('0x40')]=_['intersection'](_0x4b0b55[_0xa16b('0x3c')],qs['fields'](_0x5cd6c2['query'][_0xa16b('0x41')]));_0x26d1dc[_0xa16b('0x40')]=_0x26d1dc[_0xa16b('0x40')][_0xa16b('0x42')]?_0x26d1dc[_0xa16b('0x40')]:_0x4b0b55[_0xa16b('0x3c')];_0x26d1dc[_0xa16b('0x44')]=qs[_0xa16b('0x45')](_0x5cd6c2[_0xa16b('0x3d')][_0xa16b('0x45')]);_0x26d1dc[_0xa16b('0x46')]=qs['filters'](_[_0xa16b('0x48')](_0x5cd6c2[_0xa16b('0x3d')],_0x4b0b55[_0xa16b('0x47')]));if(_0x5cd6c2[_0xa16b('0x3d')][_0xa16b('0x4b')]){_0x26d1dc[_0xa16b('0x46')]=_[_0xa16b('0x49')](_0x26d1dc[_0xa16b('0x46')],{'$or':_[_0xa16b('0x38')](_0x26d1dc[_0xa16b('0x40')],function(_0x339d2d){var _0x2c67d1={};_0x2c67d1[_0x339d2d]={'$like':'%'+_0x5cd6c2[_0xa16b('0x3d')][_0xa16b('0x4b')]+'%'};return _0x2c67d1;})});}_0x26d1dc=_[_0xa16b('0x49')]({},_0x26d1dc,_0x5cd6c2[_0xa16b('0x4c')]);return _0x1d087e[_0xa16b('0x5b')](_0x26d1dc);}})[_0xa16b('0x1d')](function(_0x1ad596){if(_0x1ad596){_0x6a6f91=_0x1ad596[_0xa16b('0x42')];if(!_0x5cd6c2[_0xa16b('0x3d')][_0xa16b('0x57')](_0xa16b('0x58'))){_0x26d1dc[_0xa16b('0x43')]=qs[_0xa16b('0x43')](_0x5cd6c2[_0xa16b('0x3d')][_0xa16b('0x43')]);_0x26d1dc[_0xa16b('0x2d')]=qs[_0xa16b('0x2d')](_0x5cd6c2['query'][_0xa16b('0x2d')]);}return _0x1d087e['getDescriptions'](_0x26d1dc);}})[_0xa16b('0x1d')](function(_0x46951d){if(_0x46951d){return _0x46951d?{'count':_0x6a6f91,'rows':_0x46951d}:null;}})[_0xa16b('0x1d')](respondWithResult(_0xbe5a8d,null))[_0xa16b('0x27')](handleError(_0xbe5a8d,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 5d5d107..e1d843d 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 _0x00cc=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','lodash'];(function(_0x383dbb,_0x17d41b){var _0x6e8bde=function(_0x2740f1){while(--_0x2740f1){_0x383dbb['push'](_0x383dbb['shift']());}};_0x6e8bde(++_0x17d41b);}(_0x00cc,0x103));var _0xc00c=function(_0x2b5cf9,_0x3cb5c2){_0x2b5cf9=_0x2b5cf9-0x0;var _0x4d6f06=_0x00cc[_0x2b5cf9];return _0x4d6f06;};'use strict';var _=require(_0xc00c('0x0'));var util=require('util');var logger=require(_0xc00c('0x1'))(_0xc00c('0x2'));var moment=require(_0xc00c('0x3'));var BPromise=require(_0xc00c('0x4'));var rp=require(_0xc00c('0x5'));var fs=require('fs');var path=require(_0xc00c('0x6'));var rimraf=require(_0xc00c('0x7'));var config=require(_0xc00c('0x8'));var attributes=require(_0xc00c('0x9'));module[_0xc00c('0xa')]=function(_0x45947c,_0x7f3350){return _0x45947c[_0xc00c('0xb')](_0xc00c('0xc'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b9c=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations'];(function(_0x54f0a5,_0x111234){var _0x290bd5=function(_0x4239de){while(--_0x4239de){_0x54f0a5['push'](_0x54f0a5['shift']());}};_0x290bd5(++_0x111234);}(_0x3b9c,0x138));var _0xc3b9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3b9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc3b9('0x0'));var util=require(_0xc3b9('0x1'));var logger=require(_0xc3b9('0x2'))('api');var moment=require(_0xc3b9('0x3'));var BPromise=require(_0xc3b9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc3b9('0x5'));var rimraf=require(_0xc3b9('0x6'));var config=require(_0xc3b9('0x7'));var attributes=require(_0xc3b9('0x8'));module[_0xc3b9('0x9')]=function(_0x3273f4,_0x58faa7){return _0x3273f4[_0xc3b9('0xa')](_0xc3b9('0xb'),attributes,{'tableName':_0xc3b9('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 be1a88b..0079b8c 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 _0xa98e=['request','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x3e77ba,_0x19c4a6){var _0x363fc1=function(_0x293356){while(--_0x293356){_0x3e77ba['push'](_0x3e77ba['shift']());}};_0x363fc1(++_0x19c4a6);}(_0xa98e,0x137));var _0xea98=function(_0x3a5c4e,_0xe94030){_0x3a5c4e=_0x3a5c4e-0x0;var _0x156fce=_0xa98e[_0x3a5c4e];return _0x156fce;};'use strict';var _=require(_0xea98('0x0'));var util=require(_0xea98('0x1'));var moment=require('moment');var BPromise=require(_0xea98('0x2'));var rs=require(_0xea98('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea98('0x4'))['db'];var utils=require(_0xea98('0x5'));var logger=require(_0xea98('0x6'))(_0xea98('0x7'));var config=require('../../config/environment');var jayson=require(_0xea98('0x8'));var client=jayson[_0xea98('0x9')][_0xea98('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53d4c9,_0x234170,_0x1261a9){return new BPromise(function(_0xdd8e9d,_0x181e82){return client[_0xea98('0xb')](_0x53d4c9,_0x1261a9)[_0xea98('0xc')](function(_0x318445){logger[_0xea98('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x234170,_0xea98('0xe'));logger[_0xea98('0xf')](_0xea98('0x10'),_0x234170,'request\x20sent',JSON[_0xea98('0x11')](_0x318445));if(_0x318445[_0xea98('0x12')]){if(_0x318445[_0xea98('0x12')]['code']===0x1f4){logger['error'](_0xea98('0x13'),_0x234170,_0x318445['error'][_0xea98('0x14')]);return _0x181e82(_0x318445[_0xea98('0x12')][_0xea98('0x14')]);}logger[_0xea98('0x12')](_0xea98('0x13'),_0x234170,_0x318445['error']['message']);return _0xdd8e9d(_0x318445[_0xea98('0x12')][_0xea98('0x14')]);}else{logger[_0xea98('0xd')](_0xea98('0x13'),_0x234170,'request\x20sent');_0xdd8e9d(_0x318445[_0xea98('0x15')][_0xea98('0x14')]);}})[_0xea98('0x16')](function(_0x2425ab){logger[_0xea98('0x12')](_0xea98('0x13'),_0x234170,_0x2425ab);_0x181e82(_0x2425ab);});});} \ No newline at end of file +var _0x8aea=['../../config/logger','rpc','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x40eb1c,_0x5bbf43){var _0x15ec71=function(_0x373526){while(--_0x373526){_0x40eb1c['push'](_0x40eb1c['shift']());}};_0x15ec71(++_0x5bbf43);}(_0x8aea,0x1c6));var _0xa8ae=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8aea[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xa8ae('0x0'));var util=require(_0xa8ae('0x1'));var moment=require('moment');var BPromise=require(_0xa8ae('0x2'));var rs=require(_0xa8ae('0x3'));var fs=require('fs');var Redis=require(_0xa8ae('0x4'));var db=require(_0xa8ae('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa8ae('0x6'))(_0xa8ae('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa8ae('0x8')][_0xa8ae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2086b1,_0x4aba93,_0x96d8c1){return new BPromise(function(_0x3a270d,_0x3b0a34){return client[_0xa8ae('0xa')](_0x2086b1,_0x96d8c1)[_0xa8ae('0xb')](function(_0x5573f0){logger[_0xa8ae('0xc')](_0xa8ae('0xd'),_0x4aba93,_0xa8ae('0xe'));logger[_0xa8ae('0xf')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x4aba93,'request\x20sent',JSON['stringify'](_0x5573f0));if(_0x5573f0[_0xa8ae('0x10')]){if(_0x5573f0[_0xa8ae('0x10')][_0xa8ae('0x11')]===0x1f4){logger[_0xa8ae('0x10')](_0xa8ae('0xd'),_0x4aba93,_0x5573f0['error'][_0xa8ae('0x12')]);return _0x3b0a34(_0x5573f0[_0xa8ae('0x10')]['message']);}logger[_0xa8ae('0x10')](_0xa8ae('0xd'),_0x4aba93,_0x5573f0['error'][_0xa8ae('0x12')]);return _0x3a270d(_0x5573f0[_0xa8ae('0x10')][_0xa8ae('0x12')]);}else{logger[_0xa8ae('0xc')](_0xa8ae('0xd'),_0x4aba93,_0xa8ae('0xe'));_0x3a270d(_0x5573f0['result'][_0xa8ae('0x12')]);}})[_0xa8ae('0x13')](function(_0x5c94f1){logger[_0xa8ae('0x10')](_0xa8ae('0xd'),_0x4aba93,_0x5c94f1);_0x3b0a34(_0x5c94f1);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index dc041ff..dbcb0dd 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 _0xe820=['create','put','update','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','isAuthenticated','index','get','/:id','post'];(function(_0x4ce734,_0x27fe15){var _0x5f3c38=function(_0x50ec11){while(--_0x50ec11){_0x4ce734['push'](_0x4ce734['shift']());}};_0x5f3c38(++_0x27fe15);}(_0xe820,0xd2));var _0x0e82=function(_0x9039d,_0x3c35e2){_0x9039d=_0x9039d-0x0;var _0x4c995e=_0xe820[_0x9039d];return _0x4c995e;};'use strict';var multer=require(_0x0e82('0x0'));var util=require('util');var path=require(_0x0e82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0e82('0x2')]();var auth=require(_0x0e82('0x3'));var interaction=require(_0x0e82('0x4'));var config=require('../../config/environment');var controller=require(_0x0e82('0x5'));router['get']('/',auth[_0x0e82('0x6')](),controller[_0x0e82('0x7')]);router[_0x0e82('0x8')](_0x0e82('0x9'),auth[_0x0e82('0x6')](),controller['show']);router[_0x0e82('0xa')]('/',auth[_0x0e82('0x6')](),controller[_0x0e82('0xb')]);router[_0x0e82('0xc')](_0x0e82('0x9'),auth['isAuthenticated'](),controller[_0x0e82('0xd')]);router[_0x0e82('0xe')](_0x0e82('0x9'),auth[_0x0e82('0x6')](),controller[_0x0e82('0xf')]);module[_0x0e82('0x10')]=router; \ No newline at end of file +var _0x9582=['show','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id'];(function(_0x1d2370,_0x2446c6){var _0x5de98d=function(_0x1d2c1b){while(--_0x1d2c1b){_0x1d2370['push'](_0x1d2370['shift']());}};_0x5de98d(++_0x2446c6);}(_0x9582,0x95));var _0x2958=function(_0x11b9ae,_0x1e15d2){_0x11b9ae=_0x11b9ae-0x0;var _0x2333b5=_0x9582[_0x11b9ae];return _0x2333b5;};'use strict';var multer=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var path=require(_0x2958('0x2'));var timeout=require(_0x2958('0x3'));var express=require(_0x2958('0x4'));var router=express[_0x2958('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x2958('0x6'));var config=require(_0x2958('0x7'));var controller=require(_0x2958('0x8'));router[_0x2958('0x9')]('/',auth[_0x2958('0xa')](),controller[_0x2958('0xb')]);router[_0x2958('0x9')](_0x2958('0xc'),auth[_0x2958('0xa')](),controller[_0x2958('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2958('0xe')]);router['put'](_0x2958('0xc'),auth['isAuthenticated'](),controller[_0x2958('0xf')]);router['delete'](_0x2958('0xc'),auth[_0x2958('0xa')](),controller[_0x2958('0x10')]);module[_0x2958('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 22b4934..4cd27c4 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 _0xa234=['ENUM','string','variable','keyValue','STRING','customVariable','BOOLEAN','sequelize','exports'];(function(_0x4fb4ff,_0x5ac6a3){var _0x22f51a=function(_0x2d43e4){while(--_0x2d43e4){_0x4fb4ff['push'](_0x4fb4ff['shift']());}};_0x22f51a(++_0x5ac6a3);}(_0xa234,0x142));var _0x4a23=function(_0x1c87c0,_0x7180c6){_0x1c87c0=_0x1c87c0-0x0;var _0x2974f4=_0xa234[_0x1c87c0];return _0x2974f4;};'use strict';var Sequelize=require(_0x4a23('0x0'));module[_0x4a23('0x1')]={'type':{'type':Sequelize[_0x4a23('0x2')](_0x4a23('0x3'),_0x4a23('0x4'),'customVariable',_0x4a23('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4a23('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4a23('0x2')](_0x4a23('0x3'),_0x4a23('0x4'),_0x4a23('0x7'))},'keyContent':{'type':Sequelize[_0x4a23('0x6')]},'idField':{'type':Sequelize[_0x4a23('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4a23('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4a23('0x6')]}}; \ No newline at end of file +var _0x4ce6=['sequelize','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x3d01c3,_0x7e750a){var _0x56c690=function(_0x4fb866){while(--_0x4fb866){_0x3d01c3['push'](_0x3d01c3['shift']());}};_0x56c690(++_0x7e750a);}(_0x4ce6,0x108));var _0x64ce=function(_0x4f3c9b,_0x28e078){_0x4f3c9b=_0x4f3c9b-0x0;var _0x84e58a=_0x4ce6[_0x4f3c9b];return _0x84e58a;};'use strict';var Sequelize=require(_0x64ce('0x0'));module['exports']={'type':{'type':Sequelize[_0x64ce('0x1')](_0x64ce('0x2'),_0x64ce('0x3'),_0x64ce('0x4'),_0x64ce('0x5')),'defaultValue':_0x64ce('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x64ce('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x64ce('0x3'),_0x64ce('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x64ce('0x6')]},'nameField':{'type':Sequelize[_0x64ce('0x6')]},'customField':{'type':Sequelize[_0x64ce('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x64ce('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index b45420d..79b9411 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(_0x707646,_0x2d38e2){var _0x3e8113=function(_0x4a3be5){while(--_0x4a3be5){_0x707646['push'](_0x707646['shift']());}};_0x3e8113(++_0x2d38e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_0x5f54e9,_0x313c72){var _0xdc77e3=function(_0x4babe3){while(--_0x4babe3){_0x5f54e9['push'](_0x5f54e9['shift']());}};_0xdc77e3(++_0x313c72);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 7f00585..e11d277 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 _0x5a11=['idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','zoho_unique_index'];(function(_0x5174f8,_0x5f1606){var _0x28e240=function(_0x480667){while(--_0x480667){_0x5174f8['push'](_0x5174f8['shift']());}};_0x28e240(++_0x5f1606);}(_0x5a11,0x182));var _0x15a1=function(_0x524181,_0x1df5f8){_0x524181=_0x524181-0x0;var _0x215776=_0x5a11[_0x524181];return _0x215776;};'use strict';var _=require(_0x15a1('0x0'));var util=require(_0x15a1('0x1'));var logger=require('../../config/logger')(_0x15a1('0x2'));var moment=require(_0x15a1('0x3'));var BPromise=require(_0x15a1('0x4'));var rp=require(_0x15a1('0x5'));var fs=require('fs');var path=require(_0x15a1('0x6'));var rimraf=require(_0x15a1('0x7'));var config=require(_0x15a1('0x8'));var attributes=require(_0x15a1('0x9'));module[_0x15a1('0xa')]=function(_0x30f62c,_0x1b83e8){return _0x30f62c[_0x15a1('0xb')](_0x15a1('0xc'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x15a1('0xd'),'fields':[_0x15a1('0xe'),_0x15a1('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcf36=['util','../../config/logger','api','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','int_zoho_fields','zoho_unique_index','idField'];(function(_0x91668d,_0x345c8f){var _0x5dc973=function(_0x3c94dc){while(--_0x3c94dc){_0x91668d['push'](_0x91668d['shift']());}};_0x5dc973(++_0x345c8f);}(_0xcf36,0xb4));var _0x6cf3=function(_0x758191,_0x21de4d){_0x758191=_0x758191-0x0;var _0x33bb1a=_0xcf36[_0x758191];return _0x33bb1a;};'use strict';var _=require('lodash');var util=require(_0x6cf3('0x0'));var logger=require(_0x6cf3('0x1'))(_0x6cf3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6cf3('0x3'));var rimraf=require(_0x6cf3('0x4'));var config=require(_0x6cf3('0x5'));var attributes=require(_0x6cf3('0x6'));module[_0x6cf3('0x7')]=function(_0x182485,_0x314634){return _0x182485[_0x6cf3('0x8')]('ZohoField',attributes,{'tableName':_0x6cf3('0x9'),'paranoid':![],'indexes':[{'name':_0x6cf3('0xa'),'fields':[_0x6cf3('0xb'),'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 26a14b7..666c3fe 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 _0x5fd1=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','ZohoField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash'];(function(_0x29cc6f,_0x4c2bb4){var _0x3f317f=function(_0x3c8d08){while(--_0x3c8d08){_0x29cc6f['push'](_0x29cc6f['shift']());}};_0x3f317f(++_0x4c2bb4);}(_0x5fd1,0x155));var _0x15fd=function(_0x433d89,_0x41a765){_0x433d89=_0x433d89-0x0;var _0x260d70=_0x5fd1[_0x433d89];return _0x260d70;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var moment=require(_0x15fd('0x1'));var BPromise=require(_0x15fd('0x2'));var rs=require(_0x15fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x15fd('0x4'));var logger=require(_0x15fd('0x5'))(_0x15fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x15fd('0x7'));var client=jayson[_0x15fd('0x8')][_0x15fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e88bf,_0x225728,_0x534e63){return new BPromise(function(_0x210e90,_0x1ee117){return client[_0x15fd('0xa')](_0x2e88bf,_0x534e63)['then'](function(_0x2d2fbb){logger['info'](_0x15fd('0xb'),_0x225728,_0x15fd('0xc'));logger['debug']('ZohoField,\x20%s,\x20%s,\x20%s',_0x225728,'request\x20sent',JSON[_0x15fd('0xd')](_0x2d2fbb));if(_0x2d2fbb[_0x15fd('0xe')]){if(_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0xf')]===0x1f4){logger[_0x15fd('0xe')](_0x15fd('0xb'),_0x225728,_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);return _0x1ee117(_0x2d2fbb[_0x15fd('0xe')]['message']);}logger['error']('ZohoField,\x20%s,\x20%s',_0x225728,_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);return _0x210e90(_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);}else{logger[_0x15fd('0x11')](_0x15fd('0xb'),_0x225728,_0x15fd('0xc'));_0x210e90(_0x2d2fbb[_0x15fd('0x12')]['message']);}})['catch'](function(_0x25f139){logger['error'](_0x15fd('0xb'),_0x225728,_0x25f139);_0x1ee117(_0x25f139);});});} \ No newline at end of file +var _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x520b98,_0x3ac4cb){var _0x5a0ea7=function(_0x5a5250){while(--_0x5a5250){_0x520b98['push'](_0x520b98['shift']());}};_0x5a0ea7(++_0x3ac4cb);}(_0x55ca,0x126));var _0xa55c=function(_0x412ed6,_0x5ac827){_0x412ed6=_0x412ed6-0x0;var _0x3883d2=_0x55ca[_0x412ed6];return _0x3883d2;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('ZohoField,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('ZohoField,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index aa75ff5..3b931af 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 _0xf084=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','Router'];(function(_0x33593e,_0x22ddd3){var _0x53db1a=function(_0x499ee5){while(--_0x499ee5){_0x33593e['push'](_0x33593e['shift']());}};_0x53db1a(++_0x22ddd3);}(_0xf084,0x183));var _0x4f08=function(_0x27467c,_0x5ecdbb){_0x27467c=_0x27467c-0x0;var _0x5e748b=_0xf084[_0x27467c];return _0x5e748b;};'use strict';var multer=require(_0x4f08('0x0'));var util=require(_0x4f08('0x1'));var path=require(_0x4f08('0x2'));var timeout=require(_0x4f08('0x3'));var express=require('express');var router=express[_0x4f08('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4f08('0x5'));var config=require(_0x4f08('0x6'));module[_0x4f08('0x7')]=router; \ No newline at end of file +var _0xc7e3=['../../components/interaction/service','exports','multer','path','express'];(function(_0x423df0,_0x46a724){var _0x3e1c4d=function(_0x1edd7b){while(--_0x1edd7b){_0x423df0['push'](_0x423df0['shift']());}};_0x3e1c4d(++_0x46a724);}(_0xc7e3,0xfc));var _0x3c7e=function(_0x58e24b,_0x38159c){_0x58e24b=_0x58e24b-0x0;var _0x179099=_0xc7e3[_0x58e24b];return _0x179099;};'use strict';var multer=require(_0x3c7e('0x0'));var util=require('util');var path=require(_0x3c7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x3c7e('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3c7e('0x3'));var config=require('../../config/environment');module[_0x3c7e('0x4')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 78696fc..48a22cd 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 _0xdbaa=['sequelize','exports','STRING','unique_name_and_version','BOOLEAN','state'];(function(_0x36c542,_0x380c94){var _0x2db0e8=function(_0x10978a){while(--_0x10978a){_0x36c542['push'](_0x36c542['shift']());}};_0x2db0e8(++_0x380c94);}(_0xdbaa,0x19e));var _0xadba=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0xdbaa[_0x45b034];return _0x509cb0;};'use strict';var Sequelize=require(_0xadba('0x0'));module[_0xadba('0x1')]={'name':{'type':Sequelize[_0xadba('0x2')],'allowNull':![],'unique':_0xadba('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xadba('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xadba('0x2')]},'path':{'type':Sequelize[_0xadba('0x2')]},'type':{'type':Sequelize[_0xadba('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xadba('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0xadba('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xadba('0x2')],'unique':_0xadba('0x5')},'description':{'type':Sequelize[_0xadba('0x2')]},'title':{'type':Sequelize[_0xadba('0x2')]},'remoteUri':{'type':Sequelize[_0xadba('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x5b19=['INTEGER','BOOLEAN','state','sequelize','STRING','unique_name_and_version','app.js'];(function(_0x41453b,_0x426fd){var _0xab0979=function(_0x13057b){while(--_0x13057b){_0x41453b['push'](_0x41453b['shift']());}};_0xab0979(++_0x426fd);}(_0x5b19,0xc0));var _0x95b1=function(_0xfebe35,_0x26e49a){_0xfebe35=_0xfebe35-0x0;var _0x402491=_0x5b19[_0xfebe35];return _0x402491;};'use strict';var Sequelize=require(_0x95b1('0x0'));module['exports']={'name':{'type':Sequelize[_0x95b1('0x1')],'allowNull':![],'unique':_0x95b1('0x2')},'version':{'type':Sequelize[_0x95b1('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x95b1('0x1')],'defaultValue':_0x95b1('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x95b1('0x1')]},'type':{'type':Sequelize[_0x95b1('0x1')]},'size':{'type':Sequelize[_0x95b1('0x4')]},'active':{'type':Sequelize[_0x95b1('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x95b1('0x1')]},'logo':{'type':Sequelize[_0x95b1('0x1')]},'state':{'type':Sequelize[_0x95b1('0x1')],'unique':_0x95b1('0x6')},'description':{'type':Sequelize[_0x95b1('0x1')]},'title':{'type':Sequelize[_0x95b1('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x95b1('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index b21f9b4..ac50184 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 _0x9587=['path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','json','apply','save','then','destroy','error','stack','name','index','map','Integration','rawAttributes','type','key','query','keys','filters','model','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','update','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x2d62f6,_0x2b85f3){var _0x19f365=function(_0x51774d){while(--_0x51774d){_0x2d62f6['push'](_0x2d62f6['shift']());}};_0x19f365(++_0x2b85f3);}(_0x9587,0x1ea));var _0x7958=function(_0x5d96ec,_0x39248f){_0x5d96ec=_0x5d96ec-0x0;var _0x350f30=_0x9587[_0x5d96ec];return _0x350f30;};'use strict';var pdf=require(_0x7958('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7958('0x1'));var jsonpatch=require(_0x7958('0x2'));var rp=require(_0x7958('0x3'));var moment=require(_0x7958('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7958('0x5'));var util=require(_0x7958('0x6'));var path=require(_0x7958('0x7'));var sox=require(_0x7958('0x8'));var csv=require('to-csv');var ejs=require(_0x7958('0x9'));var fs=require('fs');var _=require(_0x7958('0xa'));var squel=require(_0x7958('0xb'));var crypto=require(_0x7958('0xc'));var jsforce=require(_0x7958('0xd'));var deskjs=require(_0x7958('0xe'));var toCsv=require(_0x7958('0xf'));var querystring=require('querystring');var Papa=require(_0x7958('0x10'));var Redis=require(_0x7958('0x11'));var authService=require(_0x7958('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7958('0x13'));var hardwareService=require(_0x7958('0x14'));var logger=require(_0x7958('0x15'))(_0x7958('0x16'));var utils=require(_0x7958('0x17'));var config=require(_0x7958('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5667e8,_0x4f06c7){_0x4f06c7=_0x4f06c7||0xcc;return function(_0x500d4b){if(_0x500d4b){return _0x5667e8[_0x7958('0x19')](_0x4f06c7);}return _0x5667e8[_0x7958('0x1a')](_0x4f06c7)[_0x7958('0x1b')]();};}function respondWithResult(_0x2b3886,_0x5757f1){_0x5757f1=_0x5757f1||0xc8;return function(_0x431bf3){if(_0x431bf3){return _0x2b3886[_0x7958('0x1a')](_0x5757f1)['json'](_0x431bf3);}};}function respondWithFilteredResult(_0x2d369e,_0x5ec35c){return function(_0x3cbf77){if(_0x3cbf77){var _0x190223=_0x3cbf77[_0x7958('0x1c')],_0x3fd4ad=_0x5ec35c[_0x7958('0x1d')],_0xaf495a=_0x5ec35c[_0x7958('0x1d')]+_0x5ec35c[_0x7958('0x1e')],_0x2a8026;if(_0xaf495a>=_0x190223){_0xaf495a=_0x190223;_0x2a8026=0xc8;}else{_0x2a8026=0xce;}_0x2d369e[_0x7958('0x1a')](_0x2a8026);return _0x2d369e['set']('Content-Range',_0x3fd4ad+'-'+_0xaf495a+'/'+_0x190223)[_0x7958('0x1f')](_0x3cbf77);}return null;};}function patchUpdates(_0xb4a7fd){return function(_0x44ede5){try{jsonpatch[_0x7958('0x20')](_0x44ede5,_0xb4a7fd,!![]);}catch(_0x41f9a2){return BPromise['reject'](_0x41f9a2);}return _0x44ede5[_0x7958('0x21')]();};}function saveUpdates(_0x15476c,_0x22dcd7){return function(_0x4da4fb){if(_0x4da4fb){return _0x4da4fb['update'](_0x15476c)[_0x7958('0x22')](function(_0xb08fb0){return _0xb08fb0;});}return null;};}function removeEntity(_0x55301b,_0x3938ca){return function(_0x4d9163){if(_0x4d9163){return _0x4d9163[_0x7958('0x23')]()[_0x7958('0x22')](function(){_0x55301b['status'](0xcc)[_0x7958('0x1b')]();});}};}function handleEntityNotFound(_0x2dedf1,_0x15d252){return function(_0x50ac81){if(!_0x50ac81){_0x2dedf1[_0x7958('0x19')](0x194);}return _0x50ac81;};}function handleError(_0x4d77e6,_0x2d6184){_0x2d6184=_0x2d6184||0x1f4;return function(_0x2cc3ba){logger[_0x7958('0x24')](_0x2cc3ba[_0x7958('0x25')]);if(_0x2cc3ba[_0x7958('0x26')]){delete _0x2cc3ba[_0x7958('0x26')];}_0x4d77e6[_0x7958('0x1a')](_0x2d6184)['send'](_0x2cc3ba);};}exports[_0x7958('0x27')]=function(_0x403ed2,_0x165b52){var _0x25d410={},_0x5dbb52={},_0x5e4034={'count':0x0,'rows':[]};var _0x4058a2=_[_0x7958('0x28')](db[_0x7958('0x29')][_0x7958('0x2a')],function(_0xf71485){return{'name':_0xf71485['fieldName'],'type':_0xf71485[_0x7958('0x2b')][_0x7958('0x2c')]};});_0x5dbb52['model']=_[_0x7958('0x28')](_0x4058a2,_0x7958('0x26'));_0x5dbb52[_0x7958('0x2d')]=_[_0x7958('0x2e')](_0x403ed2[_0x7958('0x2d')]);_0x5dbb52[_0x7958('0x2f')]=_['intersection'](_0x5dbb52[_0x7958('0x30')],_0x5dbb52['query']);_0x25d410[_0x7958('0x31')]=_['intersection'](_0x5dbb52[_0x7958('0x30')],qs[_0x7958('0x32')](_0x403ed2[_0x7958('0x2d')][_0x7958('0x32')]));_0x25d410[_0x7958('0x31')]=_0x25d410[_0x7958('0x31')][_0x7958('0x33')]?_0x25d410[_0x7958('0x31')]:_0x5dbb52[_0x7958('0x30')];if(!_0x403ed2[_0x7958('0x2d')]['hasOwnProperty']('nolimit')){_0x25d410[_0x7958('0x1e')]=qs[_0x7958('0x1e')](_0x403ed2['query']['limit']);_0x25d410[_0x7958('0x1d')]=qs['offset'](_0x403ed2[_0x7958('0x2d')][_0x7958('0x1d')]);}_0x25d410['order']=qs[_0x7958('0x34')](_0x403ed2[_0x7958('0x2d')]['sort']);_0x25d410[_0x7958('0x35')]=qs['filters'](_[_0x7958('0x36')](_0x403ed2[_0x7958('0x2d')],_0x5dbb52[_0x7958('0x2f')]),_0x4058a2);if(_0x403ed2['query'][_0x7958('0x37')]){_0x25d410['where']=_[_0x7958('0x38')](_0x25d410[_0x7958('0x35')],{'$or':_[_0x7958('0x28')](_0x4058a2,function(_0x3d0d88){if(_0x3d0d88[_0x7958('0x2b')]!==_0x7958('0x39')){var _0x15a1c0={};_0x15a1c0[_0x3d0d88[_0x7958('0x26')]]={'$like':'%'+_0x403ed2[_0x7958('0x2d')][_0x7958('0x37')]+'%'};return _0x15a1c0;}})});}_0x25d410=_[_0x7958('0x38')]({},_0x25d410,_0x403ed2[_0x7958('0x3a')]);var _0xa48d1f={'where':_0x25d410['where']};return db[_0x7958('0x29')][_0x7958('0x1c')](_0xa48d1f)[_0x7958('0x22')](function(_0xacbb3d){_0x5e4034[_0x7958('0x1c')]=_0xacbb3d;if(_0x403ed2['query'][_0x7958('0x3b')]){_0x25d410[_0x7958('0x3c')]=[{'all':!![]}];}return db[_0x7958('0x29')][_0x7958('0x3d')](_0x25d410);})['then'](function(_0x4d1cfc){_0x5e4034[_0x7958('0x3e')]=_0x4d1cfc;return _0x5e4034;})[_0x7958('0x22')](respondWithFilteredResult(_0x165b52,_0x25d410))[_0x7958('0x3f')](handleError(_0x165b52,null));};exports[_0x7958('0x40')]=function(_0x4378df,_0x250ccc){var _0x4ad1e4={'raw':![],'where':{'id':_0x4378df[_0x7958('0x41')]['id']}},_0x5a6a8d={};_0x5a6a8d[_0x7958('0x30')]=_[_0x7958('0x2e')](db[_0x7958('0x29')][_0x7958('0x2a')]);_0x5a6a8d['query']=_[_0x7958('0x2e')](_0x4378df['query']);_0x5a6a8d['filters']=_[_0x7958('0x42')](_0x5a6a8d[_0x7958('0x30')],_0x5a6a8d[_0x7958('0x2d')]);_0x4ad1e4['attributes']=_[_0x7958('0x42')](_0x5a6a8d[_0x7958('0x30')],qs[_0x7958('0x32')](_0x4378df[_0x7958('0x2d')][_0x7958('0x32')]));_0x4ad1e4[_0x7958('0x31')]=_0x4ad1e4[_0x7958('0x31')]['length']?_0x4ad1e4[_0x7958('0x31')]:_0x5a6a8d[_0x7958('0x30')];if(_0x4378df[_0x7958('0x2d')][_0x7958('0x3b')]){_0x4ad1e4[_0x7958('0x3c')]=[{'all':!![]}];}_0x4ad1e4=_[_0x7958('0x38')]({},_0x4ad1e4,_0x4378df['options']);return db[_0x7958('0x29')][_0x7958('0x43')](_0x4ad1e4)[_0x7958('0x22')](handleEntityNotFound(_0x250ccc,null))[_0x7958('0x22')](respondWithResult(_0x250ccc,null))[_0x7958('0x3f')](handleError(_0x250ccc,null));};exports['create']=function(_0x2a58c5,_0x21b378){return db['Integration'][_0x7958('0x44')](_0x2a58c5[_0x7958('0x45')],{})[_0x7958('0x22')](respondWithResult(_0x21b378,0xc9))[_0x7958('0x3f')](handleError(_0x21b378,null));};exports[_0x7958('0x46')]=function(_0x14b182,_0x7105c3){if(_0x14b182['body']['id']){delete _0x14b182[_0x7958('0x45')]['id'];}return db['Integration'][_0x7958('0x43')]({'where':{'id':_0x14b182['params']['id']}})['then'](handleEntityNotFound(_0x7105c3,null))[_0x7958('0x22')](saveUpdates(_0x14b182[_0x7958('0x45')],null))[_0x7958('0x22')](respondWithResult(_0x7105c3,null))[_0x7958('0x3f')](handleError(_0x7105c3,null));};exports[_0x7958('0x23')]=function(_0x4c3ccd,_0x1ed512){return db[_0x7958('0x29')]['find']({'where':{'id':_0x4c3ccd[_0x7958('0x41')]['id']}})[_0x7958('0x22')](handleEntityNotFound(_0x1ed512,null))[_0x7958('0x22')](removeEntity(_0x1ed512,null))[_0x7958('0x3f')](handleError(_0x1ed512,null));}; \ No newline at end of file +var _0xe7e8=['index','map','Integration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','show','params','length','find','create','body','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send'];(function(_0x4f1011,_0x348346){var _0x423cee=function(_0x41c5f0){while(--_0x41c5f0){_0x4f1011['push'](_0x4f1011['shift']());}};_0x423cee(++_0x348346);}(_0xe7e8,0x1c5));var _0x8e7e=function(_0x534c8f,_0x500079){_0x534c8f=_0x534c8f-0x0;var _0x5a57f5=_0xe7e8[_0x534c8f];return _0x5a57f5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8e7e('0x0'));var rimraf=require(_0x8e7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8e7e('0x2'));var rp=require(_0x8e7e('0x3'));var moment=require(_0x8e7e('0x4'));var BPromise=require(_0x8e7e('0x5'));var Mustache=require(_0x8e7e('0x6'));var util=require(_0x8e7e('0x7'));var path=require(_0x8e7e('0x8'));var sox=require('sox');var csv=require(_0x8e7e('0x9'));var ejs=require(_0x8e7e('0xa'));var fs=require('fs');var _=require(_0x8e7e('0xb'));var squel=require(_0x8e7e('0xc'));var crypto=require('crypto');var jsforce=require(_0x8e7e('0xd'));var deskjs=require(_0x8e7e('0xe'));var toCsv=require(_0x8e7e('0x9'));var querystring=require('querystring');var Papa=require(_0x8e7e('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8e7e('0x10'));var hardwareService=require(_0x8e7e('0x11'));var logger=require(_0x8e7e('0x12'))(_0x8e7e('0x13'));var utils=require(_0x8e7e('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c1a2c,_0x515c7e){_0x515c7e=_0x515c7e||0xcc;return function(_0x4dcde4){if(_0x4dcde4){return _0x2c1a2c[_0x8e7e('0x15')](_0x515c7e);}return _0x2c1a2c[_0x8e7e('0x16')](_0x515c7e)[_0x8e7e('0x17')]();};}function respondWithResult(_0x288413,_0x2ea770){_0x2ea770=_0x2ea770||0xc8;return function(_0x41694f){if(_0x41694f){return _0x288413['status'](_0x2ea770)[_0x8e7e('0x18')](_0x41694f);}};}function respondWithFilteredResult(_0x47eed3,_0x579bed){return function(_0x43731b){if(_0x43731b){var _0x148c69=_0x43731b['count'],_0x5ed6fd=_0x579bed['offset'],_0x485431=_0x579bed[_0x8e7e('0x19')]+_0x579bed[_0x8e7e('0x1a')],_0x34dbb1;if(_0x485431>=_0x148c69){_0x485431=_0x148c69;_0x34dbb1=0xc8;}else{_0x34dbb1=0xce;}_0x47eed3[_0x8e7e('0x16')](_0x34dbb1);return _0x47eed3['set'](_0x8e7e('0x1b'),_0x5ed6fd+'-'+_0x485431+'/'+_0x148c69)[_0x8e7e('0x18')](_0x43731b);}return null;};}function patchUpdates(_0x4c2f67){return function(_0x4c538b){try{jsonpatch[_0x8e7e('0x1c')](_0x4c538b,_0x4c2f67,!![]);}catch(_0x10b077){return BPromise[_0x8e7e('0x1d')](_0x10b077);}return _0x4c538b['save']();};}function saveUpdates(_0x2a72da,_0x58fe10){return function(_0x4d3478){if(_0x4d3478){return _0x4d3478[_0x8e7e('0x1e')](_0x2a72da)[_0x8e7e('0x1f')](function(_0x43a742){return _0x43a742;});}return null;};}function removeEntity(_0x5829a6,_0x45c2ba){return function(_0x61c93){if(_0x61c93){return _0x61c93[_0x8e7e('0x20')]()['then'](function(){_0x5829a6[_0x8e7e('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ec2f1,_0x7b64b){return function(_0x51c126){if(!_0x51c126){_0x4ec2f1[_0x8e7e('0x15')](0x194);}return _0x51c126;};}function handleError(_0x278a2b,_0xb93a42){_0xb93a42=_0xb93a42||0x1f4;return function(_0x177a21){logger[_0x8e7e('0x21')](_0x177a21[_0x8e7e('0x22')]);if(_0x177a21[_0x8e7e('0x23')]){delete _0x177a21[_0x8e7e('0x23')];}_0x278a2b[_0x8e7e('0x16')](_0xb93a42)[_0x8e7e('0x24')](_0x177a21);};}exports[_0x8e7e('0x25')]=function(_0x21e26d,_0x5f0a80){var _0x3e2463={},_0x4907e9={},_0x1f7ece={'count':0x0,'rows':[]};var _0x10dea4=_[_0x8e7e('0x26')](db[_0x8e7e('0x27')][_0x8e7e('0x28')],function(_0xed7e64){return{'name':_0xed7e64[_0x8e7e('0x29')],'type':_0xed7e64[_0x8e7e('0x2a')][_0x8e7e('0x2b')]};});_0x4907e9[_0x8e7e('0x2c')]=_[_0x8e7e('0x26')](_0x10dea4,_0x8e7e('0x23'));_0x4907e9['query']=_[_0x8e7e('0x2d')](_0x21e26d['query']);_0x4907e9[_0x8e7e('0x2e')]=_[_0x8e7e('0x2f')](_0x4907e9[_0x8e7e('0x2c')],_0x4907e9[_0x8e7e('0x30')]);_0x3e2463[_0x8e7e('0x31')]=_['intersection'](_0x4907e9[_0x8e7e('0x2c')],qs['fields'](_0x21e26d[_0x8e7e('0x30')][_0x8e7e('0x32')]));_0x3e2463[_0x8e7e('0x31')]=_0x3e2463[_0x8e7e('0x31')]['length']?_0x3e2463[_0x8e7e('0x31')]:_0x4907e9[_0x8e7e('0x2c')];if(!_0x21e26d[_0x8e7e('0x30')]['hasOwnProperty'](_0x8e7e('0x33'))){_0x3e2463[_0x8e7e('0x1a')]=qs[_0x8e7e('0x1a')](_0x21e26d['query'][_0x8e7e('0x1a')]);_0x3e2463['offset']=qs[_0x8e7e('0x19')](_0x21e26d[_0x8e7e('0x30')][_0x8e7e('0x19')]);}_0x3e2463[_0x8e7e('0x34')]=qs[_0x8e7e('0x35')](_0x21e26d['query'][_0x8e7e('0x35')]);_0x3e2463[_0x8e7e('0x36')]=qs['filters'](_[_0x8e7e('0x37')](_0x21e26d['query'],_0x4907e9[_0x8e7e('0x2e')]),_0x10dea4);if(_0x21e26d[_0x8e7e('0x30')][_0x8e7e('0x38')]){_0x3e2463['where']=_[_0x8e7e('0x39')](_0x3e2463[_0x8e7e('0x36')],{'$or':_[_0x8e7e('0x26')](_0x10dea4,function(_0x150279){if(_0x150279[_0x8e7e('0x2a')]!==_0x8e7e('0x3a')){var _0x151d22={};_0x151d22[_0x150279[_0x8e7e('0x23')]]={'$like':'%'+_0x21e26d[_0x8e7e('0x30')][_0x8e7e('0x38')]+'%'};return _0x151d22;}})});}_0x3e2463=_[_0x8e7e('0x39')]({},_0x3e2463,_0x21e26d[_0x8e7e('0x3b')]);var _0x300a08={'where':_0x3e2463[_0x8e7e('0x36')]};return db[_0x8e7e('0x27')][_0x8e7e('0x3c')](_0x300a08)[_0x8e7e('0x1f')](function(_0x5c009b){_0x1f7ece[_0x8e7e('0x3c')]=_0x5c009b;if(_0x21e26d['query'][_0x8e7e('0x3d')]){_0x3e2463[_0x8e7e('0x3e')]=[{'all':!![]}];}return db[_0x8e7e('0x27')]['findAll'](_0x3e2463);})[_0x8e7e('0x1f')](function(_0x340b0f){_0x1f7ece['rows']=_0x340b0f;return _0x1f7ece;})[_0x8e7e('0x1f')](respondWithFilteredResult(_0x5f0a80,_0x3e2463))['catch'](handleError(_0x5f0a80,null));};exports[_0x8e7e('0x3f')]=function(_0x1d2e65,_0x56de02){var _0x49ccd4={'raw':![],'where':{'id':_0x1d2e65[_0x8e7e('0x40')]['id']}},_0x5ebf25={};_0x5ebf25[_0x8e7e('0x2c')]=_[_0x8e7e('0x2d')](db[_0x8e7e('0x27')][_0x8e7e('0x28')]);_0x5ebf25[_0x8e7e('0x30')]=_[_0x8e7e('0x2d')](_0x1d2e65[_0x8e7e('0x30')]);_0x5ebf25[_0x8e7e('0x2e')]=_[_0x8e7e('0x2f')](_0x5ebf25[_0x8e7e('0x2c')],_0x5ebf25['query']);_0x49ccd4['attributes']=_[_0x8e7e('0x2f')](_0x5ebf25['model'],qs['fields'](_0x1d2e65[_0x8e7e('0x30')]['fields']));_0x49ccd4['attributes']=_0x49ccd4['attributes'][_0x8e7e('0x41')]?_0x49ccd4['attributes']:_0x5ebf25[_0x8e7e('0x2c')];if(_0x1d2e65[_0x8e7e('0x30')][_0x8e7e('0x3d')]){_0x49ccd4[_0x8e7e('0x3e')]=[{'all':!![]}];}_0x49ccd4=_[_0x8e7e('0x39')]({},_0x49ccd4,_0x1d2e65[_0x8e7e('0x3b')]);return db[_0x8e7e('0x27')][_0x8e7e('0x42')](_0x49ccd4)[_0x8e7e('0x1f')](handleEntityNotFound(_0x56de02,null))[_0x8e7e('0x1f')](respondWithResult(_0x56de02,null))['catch'](handleError(_0x56de02,null));};exports[_0x8e7e('0x43')]=function(_0x32c777,_0x28aa31){return db[_0x8e7e('0x27')]['create'](_0x32c777[_0x8e7e('0x44')],{})[_0x8e7e('0x1f')](respondWithResult(_0x28aa31,0xc9))[_0x8e7e('0x45')](handleError(_0x28aa31,null));};exports['update']=function(_0x12d25c,_0x5800e2){if(_0x12d25c[_0x8e7e('0x44')]['id']){delete _0x12d25c[_0x8e7e('0x44')]['id'];}return db[_0x8e7e('0x27')][_0x8e7e('0x42')]({'where':{'id':_0x12d25c['params']['id']}})['then'](handleEntityNotFound(_0x5800e2,null))[_0x8e7e('0x1f')](saveUpdates(_0x12d25c[_0x8e7e('0x44')],null))[_0x8e7e('0x1f')](respondWithResult(_0x5800e2,null))[_0x8e7e('0x45')](handleError(_0x5800e2,null));};exports['destroy']=function(_0x17e502,_0x4efbe4){return db[_0x8e7e('0x27')][_0x8e7e('0x42')]({'where':{'id':_0x17e502[_0x8e7e('0x40')]['id']}})[_0x8e7e('0x1f')](handleEntityNotFound(_0x4efbe4,null))['then'](removeEntity(_0x4efbe4,null))[_0x8e7e('0x45')](handleError(_0x4efbe4,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 4532593..e6acf32 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 _0xb042=['../../config/environment','exports','define','Integration','integrations','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x875527,_0x2234fb){var _0x23c22c=function(_0x46e337){while(--_0x46e337){_0x875527['push'](_0x875527['shift']());}};_0x23c22c(++_0x2234fb);}(_0xb042,0x185));var _0x2b04=function(_0x4b4f24,_0x5654a8){_0x4b4f24=_0x4b4f24-0x0;var _0x1c13d4=_0xb042[_0x4b4f24];return _0x1c13d4;};'use strict';var _=require(_0x2b04('0x0'));var util=require(_0x2b04('0x1'));var logger=require(_0x2b04('0x2'))(_0x2b04('0x3'));var moment=require(_0x2b04('0x4'));var BPromise=require('bluebird');var rp=require(_0x2b04('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2b04('0x6'));var config=require(_0x2b04('0x7'));var attributes=require('./integration.attributes');module[_0x2b04('0x8')]=function(_0x3f05cf,_0xee217d){return _0x3f05cf[_0x2b04('0x9')](_0x2b04('0xa'),attributes,{'tableName':_0x2b04('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdaf0=['request-promise','path','rimraf','./integration.attributes','define','Integration','integrations','api','moment','bluebird'];(function(_0x127a60,_0x37f33a){var _0xc1f6a3=function(_0x8ed035){while(--_0x8ed035){_0x127a60['push'](_0x127a60['shift']());}};_0xc1f6a3(++_0x37f33a);}(_0xdaf0,0x9d));var _0x0daf=function(_0x5bf663,_0x431062){_0x5bf663=_0x5bf663-0x0;var _0x235e98=_0xdaf0[_0x5bf663];return _0x235e98;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0daf('0x0'));var moment=require(_0x0daf('0x1'));var BPromise=require(_0x0daf('0x2'));var rp=require(_0x0daf('0x3'));var fs=require('fs');var path=require(_0x0daf('0x4'));var rimraf=require(_0x0daf('0x5'));var config=require('../../config/environment');var attributes=require(_0x0daf('0x6'));module['exports']=function(_0x55d483,_0x3eb0b7){return _0x55d483[_0x0daf('0x7')](_0x0daf('0x8'),attributes,{'tableName':_0x0daf('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 bdbd4bc..a1976b3 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 _0xccdc=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','catch','lodash','util','randomstring','ioredis'];(function(_0x254a19,_0x7b092b){var _0xba020a=function(_0x231bb3){while(--_0x231bb3){_0x254a19['push'](_0x254a19['shift']());}};_0xba020a(++_0x7b092b);}(_0xccdc,0x1c4));var _0xcccd=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xccdc[_0x288f5e];return _0x476cc9;};'use strict';var _=require(_0xcccd('0x0'));var util=require(_0xcccd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcccd('0x2'));var fs=require('fs');var Redis=require(_0xcccd('0x3'));var db=require(_0xcccd('0x4'))['db'];var utils=require(_0xcccd('0x5'));var logger=require(_0xcccd('0x6'))(_0xcccd('0x7'));var config=require(_0xcccd('0x8'));var jayson=require(_0xcccd('0x9'));var client=jayson[_0xcccd('0xa')][_0xcccd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5bd55e,_0x4cc734,_0x270368){return new BPromise(function(_0x1b8c05,_0x41ea2d){return client[_0xcccd('0xc')](_0x5bd55e,_0x270368)[_0xcccd('0xd')](function(_0x1d921f){logger[_0xcccd('0xe')]('Integration,\x20%s,\x20%s',_0x4cc734,_0xcccd('0xf'));logger[_0xcccd('0x10')](_0xcccd('0x11'),_0x4cc734,_0xcccd('0xf'),JSON[_0xcccd('0x12')](_0x1d921f));if(_0x1d921f[_0xcccd('0x13')]){if(_0x1d921f[_0xcccd('0x13')][_0xcccd('0x14')]===0x1f4){logger[_0xcccd('0x13')](_0xcccd('0x15'),_0x4cc734,_0x1d921f[_0xcccd('0x13')][_0xcccd('0x16')]);return _0x41ea2d(_0x1d921f[_0xcccd('0x13')][_0xcccd('0x16')]);}logger[_0xcccd('0x13')](_0xcccd('0x15'),_0x4cc734,_0x1d921f[_0xcccd('0x13')][_0xcccd('0x16')]);return _0x1b8c05(_0x1d921f['error']['message']);}else{logger[_0xcccd('0xe')](_0xcccd('0x15'),_0x4cc734,_0xcccd('0xf'));_0x1b8c05(_0x1d921f['result'][_0xcccd('0x16')]);}})[_0xcccd('0x17')](function(_0x1b3bd9){logger['error'](_0xcccd('0x15'),_0x4cc734,_0x1b3bd9);_0x41ea2d(_0x1b3bd9);});});} \ No newline at end of file +var _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x7644d4,_0x15a8da){var _0x5e85e4=function(_0x3f02c4){while(--_0x3f02c4){_0x7644d4['push'](_0x7644d4['shift']());}};_0x5e85e4(++_0x15a8da);}(_0x8ef6,0xf2));var _0x68ef=function(_0x17eb5a,_0x586319){_0x17eb5a=_0x17eb5a-0x0;var _0x370add=_0x8ef6[_0x17eb5a];return _0x370add;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Integration,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Integration,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index c185e1b..331ac5a 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 _0x374e=['post','create','put','delete','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x323c7e,_0x3d16ec){var _0x2b0f72=function(_0x5a2310){while(--_0x5a2310){_0x323c7e['push'](_0x323c7e['shift']());}};_0x2b0f72(++_0x3d16ec);}(_0x374e,0x146));var _0xe374=function(_0x196f87,_0x36d886){_0x196f87=_0x196f87-0x0;var _0xe3b035=_0x374e[_0x196f87];return _0xe3b035;};'use strict';var multer=require('multer');var util=require(_0xe374('0x0'));var path=require(_0xe374('0x1'));var timeout=require(_0xe374('0x2'));var express=require(_0xe374('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe374('0x4'));var config=require(_0xe374('0x5'));var controller=require(_0xe374('0x6'));router[_0xe374('0x7')]('/',auth[_0xe374('0x8')](),controller[_0xe374('0x9')]);router[_0xe374('0x7')](_0xe374('0xa'),auth[_0xe374('0x8')](),controller[_0xe374('0xb')]);router[_0xe374('0x7')](_0xe374('0xc'),auth['isAuthenticated'](),controller[_0xe374('0xd')]);router[_0xe374('0xe')]('/',auth[_0xe374('0x8')](),controller[_0xe374('0xf')]);router[_0xe374('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xe374('0x11')](_0xe374('0xc'),auth[_0xe374('0x8')](),controller[_0xe374('0x12')]);module[_0xe374('0x13')]=router; \ No newline at end of file +var _0x5981=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','update','delete','destroy','multer'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x5981,0xa7));var _0x1598=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5981[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1598('0x0'));var util=require(_0x1598('0x1'));var path=require(_0x1598('0x2'));var timeout=require(_0x1598('0x3'));var express=require(_0x1598('0x4'));var router=express[_0x1598('0x5')]();var auth=require(_0x1598('0x6'));var interaction=require(_0x1598('0x7'));var config=require(_0x1598('0x8'));var controller=require(_0x1598('0x9'));router['get']('/',auth[_0x1598('0xa')](),controller['index']);router[_0x1598('0xb')](_0x1598('0xc'),auth[_0x1598('0xa')](),controller[_0x1598('0xd')]);router[_0x1598('0xb')](_0x1598('0xe'),auth[_0x1598('0xa')](),controller[_0x1598('0xf')]);router[_0x1598('0x10')]('/',auth[_0x1598('0xa')](),controller[_0x1598('0x11')]);router['put'](_0x1598('0xe'),auth[_0x1598('0xa')](),controller[_0x1598('0x12')]);router[_0x1598('0x13')](_0x1598('0xe'),auth[_0x1598('0xa')](),controller[_0x1598('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 4486c2b..8c54f63 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 _0x1571=['SENDING','FAILED','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','SENT'];(function(_0x261999,_0x15f7e8){var _0x109e04=function(_0x4c8e93){while(--_0x4c8e93){_0x261999['push'](_0x261999['shift']());}};_0x109e04(++_0x15f7e8);}(_0x1571,0x16a));var _0x1157=function(_0x49a456,_0x76c6d6){_0x49a456=_0x49a456-0x0;var _0x5818aa=_0x1571[_0x49a456];return _0x5818aa;};'use strict';var Sequelize=require('sequelize');module[_0x1157('0x0')]={'integration':{'type':Sequelize[_0x1157('0x1')]},'eventChannel':{'type':Sequelize[_0x1157('0x1')]},'exitStatus':{'type':Sequelize[_0x1157('0x1')]},'ticketId':{'type':Sequelize[_0x1157('0x1')]},'integrationId':{'type':Sequelize[_0x1157('0x2')]},'contacts':{'type':Sequelize[_0x1157('0x1')]},'uniqueid':{'type':Sequelize[_0x1157('0x1')]},'calleridnum':{'type':Sequelize[_0x1157('0x1')]},'calleridname':{'type':Sequelize[_0x1157('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x1157('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x1157('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x1157('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x1157('0x3')]},'talktime':{'type':Sequelize[_0x1157('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1157('0x2')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x1157('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x1157('0x3')]},'agentdump':{'type':Sequelize[_0x1157('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x1157('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1157('0x1')]},'channelstate':{'type':Sequelize[_0x1157('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1157('0x1')]},'connectedlinename':{'type':Sequelize[_0x1157('0x1')]},'language':{'type':Sequelize[_0x1157('0x1')]},'accountcode':{'type':Sequelize[_0x1157('0x1')]},'context':{'type':Sequelize[_0x1157('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x1157('0x1')]},'destchannel':{'type':Sequelize[_0x1157('0x1')]},'destchannelstate':{'type':Sequelize[_0x1157('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x1157('0x1')]},'destcalleridnum':{'type':Sequelize[_0x1157('0x1')]},'destcalleridname':{'type':Sequelize[_0x1157('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x1157('0x1')]},'destlanguage':{'type':Sequelize[_0x1157('0x1')]},'destaccountcode':{'type':Sequelize[_0x1157('0x1')]},'destcontext':{'type':Sequelize[_0x1157('0x1')]},'destexten':{'type':Sequelize[_0x1157('0x1')]},'destpriority':{'type':Sequelize[_0x1157('0x1')]},'destuniqueid':{'type':Sequelize[_0x1157('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x1157('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x1157('0x1')]},'cc':{'type':Sequelize[_0x1157('0x1')]},'attachment':{'type':Sequelize[_0x1157('0x5')]},'html':{'type':Sequelize[_0x1157('0x5')]},'text':{'type':Sequelize[_0x1157('0x5')]},'status':{'type':Sequelize['ENUM'](_0x1157('0x6'),_0x1157('0x7'),'RECEIVED',_0x1157('0x8'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x1157('0x1')]},'appdata':{'type':Sequelize[_0x1157('0x1')]},'projectId':{'type':Sequelize[_0x1157('0x2')]}}; \ No newline at end of file +var _0xfdd8=['SENDING','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT'];(function(_0x1406ae,_0x292395){var _0x23a076=function(_0x5e147a){while(--_0x5e147a){_0x1406ae['push'](_0x1406ae['shift']());}};_0x23a076(++_0x292395);}(_0xfdd8,0x65));var _0x8fdd=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xfdd8[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x8fdd('0x0'));module[_0x8fdd('0x1')]={'integration':{'type':Sequelize[_0x8fdd('0x2')]},'eventChannel':{'type':Sequelize[_0x8fdd('0x2')]},'exitStatus':{'type':Sequelize[_0x8fdd('0x2')]},'ticketId':{'type':Sequelize[_0x8fdd('0x2')]},'integrationId':{'type':Sequelize[_0x8fdd('0x3')]},'contacts':{'type':Sequelize[_0x8fdd('0x2')]},'uniqueid':{'type':Sequelize[_0x8fdd('0x2')]},'calleridnum':{'type':Sequelize[_0x8fdd('0x2')]},'calleridname':{'type':Sequelize[_0x8fdd('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x8fdd('0x2')]},'membername':{'type':Sequelize[_0x8fdd('0x2')]},'agentcalledAt':{'type':Sequelize[_0x8fdd('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x8fdd('0x3')]},'agentcomplete':{'type':Sequelize[_0x8fdd('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x8fdd('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8fdd('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x8fdd('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x8fdd('0x4')]},'agentdump':{'type':Sequelize[_0x8fdd('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x8fdd('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8fdd('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x8fdd('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x8fdd('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8fdd('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x8fdd('0x2')]},'destchannel':{'type':Sequelize[_0x8fdd('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x8fdd('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x8fdd('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x8fdd('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x8fdd('0x2')]},'destcontext':{'type':Sequelize[_0x8fdd('0x2')]},'destexten':{'type':Sequelize[_0x8fdd('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x8fdd('0x2')]},'messageId':{'type':Sequelize[_0x8fdd('0x2')]},'inReplyTo':{'type':Sequelize[_0x8fdd('0x2')]},'subject':{'type':Sequelize[_0x8fdd('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x8fdd('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x8fdd('0x6')]},'status':{'type':Sequelize[_0x8fdd('0x7')](_0x8fdd('0x8'),_0x8fdd('0x9'),'RECEIVED',_0x8fdd('0xa'))},'url':{'type':Sequelize[_0x8fdd('0x2')]},'app':{'type':Sequelize[_0x8fdd('0x2')]},'appdata':{'type':Sequelize[_0x8fdd('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index ae112f1..19be0bb 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 _0x8b47=['nolimit','limit','offset','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','params','length','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','set','Content-Range','reject','update','destroy','then','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty'];(function(_0x47f0db,_0x4204e0){var _0xa3150a=function(_0x564812){while(--_0x564812){_0x47f0db['push'](_0x47f0db['shift']());}};_0xa3150a(++_0x4204e0);}(_0x8b47,0x169));var _0x78b4=function(_0x2b784c,_0x2e8db4){_0x2b784c=_0x2b784c-0x0;var _0x3fda4a=_0x8b47[_0x2b784c];return _0x3fda4a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x78b4('0x0'));var rimraf=require(_0x78b4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x78b4('0x2'));var rp=require('request-promise');var moment=require(_0x78b4('0x3'));var BPromise=require(_0x78b4('0x4'));var Mustache=require(_0x78b4('0x5'));var util=require('util');var path=require(_0x78b4('0x6'));var sox=require(_0x78b4('0x7'));var csv=require('to-csv');var ejs=require(_0x78b4('0x8'));var fs=require('fs');var _=require(_0x78b4('0x9'));var squel=require(_0x78b4('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x78b4('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x78b4('0xc'));var authService=require(_0x78b4('0xd'));var qs=require(_0x78b4('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x78b4('0xf'));var logger=require(_0x78b4('0x10'))('api');var utils=require(_0x78b4('0x11'));var config=require('../../config/environment');var db=require(_0x78b4('0x12'))['db'];function respondWithStatusCode(_0x198491,_0x2cad5){_0x2cad5=_0x2cad5||0xcc;return function(_0x43cfda){if(_0x43cfda){return _0x198491[_0x78b4('0x13')](_0x2cad5);}return _0x198491[_0x78b4('0x14')](_0x2cad5)[_0x78b4('0x15')]();};}function respondWithResult(_0x255604,_0x3a1518){_0x3a1518=_0x3a1518||0xc8;return function(_0x18bde8){if(_0x18bde8){return _0x255604[_0x78b4('0x14')](_0x3a1518)[_0x78b4('0x16')](_0x18bde8);}};}function respondWithFilteredResult(_0x2d33eb,_0x3922c8){return function(_0x16f7e5){if(_0x16f7e5){var _0x55fc52=_0x16f7e5[_0x78b4('0x17')],_0x358fd5=_0x3922c8['offset'],_0x57e23b=_0x3922c8['offset']+_0x3922c8['limit'],_0x4efe2e;if(_0x57e23b>=_0x55fc52){_0x57e23b=_0x55fc52;_0x4efe2e=0xc8;}else{_0x4efe2e=0xce;}_0x2d33eb[_0x78b4('0x14')](_0x4efe2e);return _0x2d33eb[_0x78b4('0x18')](_0x78b4('0x19'),_0x358fd5+'-'+_0x57e23b+'/'+_0x55fc52)['json'](_0x16f7e5);}return null;};}function patchUpdates(_0x51f000){return function(_0x3b7532){try{jsonpatch['apply'](_0x3b7532,_0x51f000,!![]);}catch(_0x4254f6){return BPromise[_0x78b4('0x1a')](_0x4254f6);}return _0x3b7532['save']();};}function saveUpdates(_0x485c34,_0x184b74){return function(_0x2d5526){if(_0x2d5526){return _0x2d5526[_0x78b4('0x1b')](_0x485c34)['then'](function(_0x4fdb18){return _0x4fdb18;});}return null;};}function removeEntity(_0x29b442,_0x103182){return function(_0xb3414a){if(_0xb3414a){return _0xb3414a[_0x78b4('0x1c')]()[_0x78b4('0x1d')](function(){_0x29b442[_0x78b4('0x14')](0xcc)[_0x78b4('0x15')]();});}};}function handleEntityNotFound(_0x30cf55,_0x197777){return function(_0x50a920){if(!_0x50a920){_0x30cf55['sendStatus'](0x194);}return _0x50a920;};}function handleError(_0x1d46ef,_0x52ca9d){_0x52ca9d=_0x52ca9d||0x1f4;return function(_0x1d357e){logger['error'](_0x1d357e[_0x78b4('0x1e')]);if(_0x1d357e[_0x78b4('0x1f')]){delete _0x1d357e[_0x78b4('0x1f')];}_0x1d46ef[_0x78b4('0x14')](_0x52ca9d)[_0x78b4('0x20')](_0x1d357e);};}exports[_0x78b4('0x21')]=function(_0x5e5899,_0x253dd3){var _0x1c5294={},_0x4f797a={},_0x3ce499={'count':0x0,'rows':[]};var _0x1faac9=_[_0x78b4('0x22')](db[_0x78b4('0x23')][_0x78b4('0x24')],function(_0x4a70fd){return{'name':_0x4a70fd[_0x78b4('0x25')],'type':_0x4a70fd[_0x78b4('0x26')][_0x78b4('0x27')]};});_0x4f797a[_0x78b4('0x28')]=_[_0x78b4('0x22')](_0x1faac9,'name');_0x4f797a[_0x78b4('0x29')]=_[_0x78b4('0x2a')](_0x5e5899['query']);_0x4f797a['filters']=_['intersection'](_0x4f797a['model'],_0x4f797a['query']);_0x1c5294[_0x78b4('0x2b')]=_[_0x78b4('0x2c')](_0x4f797a['model'],qs[_0x78b4('0x2d')](_0x5e5899[_0x78b4('0x29')][_0x78b4('0x2d')]));_0x1c5294['attributes']=_0x1c5294[_0x78b4('0x2b')]['length']?_0x1c5294[_0x78b4('0x2b')]:_0x4f797a[_0x78b4('0x28')];if(!_0x5e5899[_0x78b4('0x29')][_0x78b4('0x2e')](_0x78b4('0x2f'))){_0x1c5294[_0x78b4('0x30')]=qs['limit'](_0x5e5899[_0x78b4('0x29')][_0x78b4('0x30')]);_0x1c5294['offset']=qs[_0x78b4('0x31')](_0x5e5899[_0x78b4('0x29')][_0x78b4('0x31')]);}_0x1c5294['order']=qs[_0x78b4('0x32')](_0x5e5899[_0x78b4('0x29')][_0x78b4('0x32')]);_0x1c5294[_0x78b4('0x33')]=qs[_0x78b4('0x34')](_[_0x78b4('0x35')](_0x5e5899['query'],_0x4f797a['filters']),_0x1faac9);if(_0x5e5899[_0x78b4('0x29')]['filter']){_0x1c5294['where']=_[_0x78b4('0x36')](_0x1c5294[_0x78b4('0x33')],{'$or':_['map'](_0x1faac9,function(_0x929d41){if(_0x929d41['type']!=='VIRTUAL'){var _0x2ec1b0={};_0x2ec1b0[_0x929d41[_0x78b4('0x1f')]]={'$like':'%'+_0x5e5899['query'][_0x78b4('0x37')]+'%'};return _0x2ec1b0;}})});}_0x1c5294=_['merge']({},_0x1c5294,_0x5e5899[_0x78b4('0x38')]);var _0x4633c4={'where':_0x1c5294['where']};return db[_0x78b4('0x23')]['count'](_0x4633c4)[_0x78b4('0x1d')](function(_0x4ec755){_0x3ce499[_0x78b4('0x17')]=_0x4ec755;if(_0x5e5899['query'][_0x78b4('0x39')]){_0x1c5294[_0x78b4('0x3a')]=[{'all':!![]}];}return db[_0x78b4('0x23')][_0x78b4('0x3b')](_0x1c5294);})[_0x78b4('0x1d')](function(_0x50d40c){_0x3ce499[_0x78b4('0x3c')]=_0x50d40c;return _0x3ce499;})[_0x78b4('0x1d')](respondWithFilteredResult(_0x253dd3,_0x1c5294))['catch'](handleError(_0x253dd3,null));};exports['show']=function(_0x16ae90,_0x49d036){var _0x2c0e08={'raw':![],'where':{'id':_0x16ae90[_0x78b4('0x3d')]['id']}},_0x425451={};_0x425451[_0x78b4('0x28')]=_[_0x78b4('0x2a')](db[_0x78b4('0x23')][_0x78b4('0x24')]);_0x425451[_0x78b4('0x29')]=_[_0x78b4('0x2a')](_0x16ae90[_0x78b4('0x29')]);_0x425451[_0x78b4('0x34')]=_[_0x78b4('0x2c')](_0x425451['model'],_0x425451[_0x78b4('0x29')]);_0x2c0e08[_0x78b4('0x2b')]=_[_0x78b4('0x2c')](_0x425451['model'],qs['fields'](_0x16ae90['query'][_0x78b4('0x2d')]));_0x2c0e08[_0x78b4('0x2b')]=_0x2c0e08[_0x78b4('0x2b')][_0x78b4('0x3e')]?_0x2c0e08[_0x78b4('0x2b')]:_0x425451[_0x78b4('0x28')];if(_0x16ae90[_0x78b4('0x29')]['includeAll']){_0x2c0e08[_0x78b4('0x3a')]=[{'all':!![]}];}_0x2c0e08=_['merge']({},_0x2c0e08,_0x16ae90[_0x78b4('0x38')]);return db[_0x78b4('0x23')][_0x78b4('0x3f')](_0x2c0e08)[_0x78b4('0x1d')](handleEntityNotFound(_0x49d036,null))[_0x78b4('0x1d')](respondWithResult(_0x49d036,null))[_0x78b4('0x40')](handleError(_0x49d036,null));};exports[_0x78b4('0x41')]=function(_0x2c5655,_0x1f357f){return db[_0x78b4('0x23')][_0x78b4('0x41')](_0x2c5655[_0x78b4('0x42')],{})['then'](respondWithResult(_0x1f357f,0xc9))['catch'](handleError(_0x1f357f,null));};exports[_0x78b4('0x1b')]=function(_0x5cc39d,_0x3ed502){if(_0x5cc39d[_0x78b4('0x42')]['id']){delete _0x5cc39d['body']['id'];}return db[_0x78b4('0x23')][_0x78b4('0x3f')]({'where':{'id':_0x5cc39d[_0x78b4('0x3d')]['id']}})[_0x78b4('0x1d')](handleEntityNotFound(_0x3ed502,null))[_0x78b4('0x1d')](saveUpdates(_0x5cc39d[_0x78b4('0x42')],null))[_0x78b4('0x1d')](respondWithResult(_0x3ed502,null))[_0x78b4('0x40')](handleError(_0x3ed502,null));};exports[_0x78b4('0x1c')]=function(_0x5a9c3a,_0x447e0e){return db[_0x78b4('0x23')]['find']({'where':{'id':_0x5a9c3a[_0x78b4('0x3d')]['id']}})[_0x78b4('0x1d')](handleEntityNotFound(_0x447e0e,null))['then'](removeEntity(_0x447e0e,null))[_0x78b4('0x40')](handleError(_0x447e0e,null));};exports['describe']=function(_0x361c17,_0x3aed34){return db['IntegrationReport'][_0x78b4('0x43')]()[_0x78b4('0x1d')](respondWithResult(_0x3aed34,null))[_0x78b4('0x40')](handleError(_0x3aed34,null));}; \ No newline at end of file +var _0xa374=['send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','options','includeAll','findAll','rows','catch','show','keys','include','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa374,0x108));var _0x4a37=function(_0x2ebe98,_0x4f8486){_0x2ebe98=_0x2ebe98-0x0;var _0x12079c=_0xa374[_0x2ebe98];return _0x12079c;};'use strict';var pdf=require(_0x4a37('0x0'));var emlformat=require(_0x4a37('0x1'));var rimraf=require(_0x4a37('0x2'));var zipdir=require(_0x4a37('0x3'));var jsonpatch=require(_0x4a37('0x4'));var rp=require(_0x4a37('0x5'));var moment=require(_0x4a37('0x6'));var BPromise=require(_0x4a37('0x7'));var Mustache=require('mustache');var util=require(_0x4a37('0x8'));var path=require('path');var sox=require(_0x4a37('0x9'));var csv=require(_0x4a37('0xa'));var ejs=require(_0x4a37('0xb'));var fs=require('fs');var _=require(_0x4a37('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4a37('0xd'));var toCsv=require(_0x4a37('0xa'));var querystring=require(_0x4a37('0xe'));var Papa=require(_0x4a37('0xf'));var Redis=require('ioredis');var authService=require(_0x4a37('0x10'));var qs=require(_0x4a37('0x11'));var as=require(_0x4a37('0x12'));var hardwareService=require(_0x4a37('0x13'));var logger=require(_0x4a37('0x14'))(_0x4a37('0x15'));var utils=require(_0x4a37('0x16'));var config=require('../../config/environment');var db=require(_0x4a37('0x17'))['db'];function respondWithStatusCode(_0x53123b,_0xcbcc35){_0xcbcc35=_0xcbcc35||0xcc;return function(_0x48727d){if(_0x48727d){return _0x53123b['sendStatus'](_0xcbcc35);}return _0x53123b[_0x4a37('0x18')](_0xcbcc35)[_0x4a37('0x19')]();};}function respondWithResult(_0x42d485,_0x28b362){_0x28b362=_0x28b362||0xc8;return function(_0x4154d3){if(_0x4154d3){return _0x42d485[_0x4a37('0x18')](_0x28b362)[_0x4a37('0x1a')](_0x4154d3);}};}function respondWithFilteredResult(_0xcdb7dd,_0x27bae3){return function(_0xbd9626){if(_0xbd9626){var _0x2d7dd4=_0xbd9626[_0x4a37('0x1b')],_0x4dcf69=_0x27bae3['offset'],_0x4843f0=_0x27bae3[_0x4a37('0x1c')]+_0x27bae3['limit'],_0x25648e;if(_0x4843f0>=_0x2d7dd4){_0x4843f0=_0x2d7dd4;_0x25648e=0xc8;}else{_0x25648e=0xce;}_0xcdb7dd[_0x4a37('0x18')](_0x25648e);return _0xcdb7dd[_0x4a37('0x1d')](_0x4a37('0x1e'),_0x4dcf69+'-'+_0x4843f0+'/'+_0x2d7dd4)['json'](_0xbd9626);}return null;};}function patchUpdates(_0x1502cf){return function(_0x2d9665){try{jsonpatch[_0x4a37('0x1f')](_0x2d9665,_0x1502cf,!![]);}catch(_0x3c4218){return BPromise[_0x4a37('0x20')](_0x3c4218);}return _0x2d9665[_0x4a37('0x21')]();};}function saveUpdates(_0x2bc657,_0x42ebcd){return function(_0x83c7c){if(_0x83c7c){return _0x83c7c[_0x4a37('0x22')](_0x2bc657)[_0x4a37('0x23')](function(_0x58d8e9){return _0x58d8e9;});}return null;};}function removeEntity(_0x53af8f,_0x31a059){return function(_0x56d063){if(_0x56d063){return _0x56d063[_0x4a37('0x24')]()['then'](function(){_0x53af8f['status'](0xcc)[_0x4a37('0x19')]();});}};}function handleEntityNotFound(_0x138fe8,_0x2a22e0){return function(_0x15c167){if(!_0x15c167){_0x138fe8['sendStatus'](0x194);}return _0x15c167;};}function handleError(_0x5e9f3c,_0x3feec1){_0x3feec1=_0x3feec1||0x1f4;return function(_0x2d3853){logger[_0x4a37('0x25')](_0x2d3853[_0x4a37('0x26')]);if(_0x2d3853[_0x4a37('0x27')]){delete _0x2d3853[_0x4a37('0x27')];}_0x5e9f3c[_0x4a37('0x18')](_0x3feec1)[_0x4a37('0x28')](_0x2d3853);};}exports[_0x4a37('0x29')]=function(_0x54bdfe,_0xcd08d0){var _0x4bf1d6={},_0x23ee20={},_0x3ed570={'count':0x0,'rows':[]};var _0x4fc602=_[_0x4a37('0x2a')](db[_0x4a37('0x2b')][_0x4a37('0x2c')],function(_0x1d1bde){return{'name':_0x1d1bde[_0x4a37('0x2d')],'type':_0x1d1bde[_0x4a37('0x2e')][_0x4a37('0x2f')]};});_0x23ee20[_0x4a37('0x30')]=_[_0x4a37('0x2a')](_0x4fc602,_0x4a37('0x27'));_0x23ee20[_0x4a37('0x31')]=_['keys'](_0x54bdfe[_0x4a37('0x31')]);_0x23ee20['filters']=_[_0x4a37('0x32')](_0x23ee20[_0x4a37('0x30')],_0x23ee20['query']);_0x4bf1d6['attributes']=_[_0x4a37('0x32')](_0x23ee20[_0x4a37('0x30')],qs['fields'](_0x54bdfe[_0x4a37('0x31')][_0x4a37('0x33')]));_0x4bf1d6[_0x4a37('0x34')]=_0x4bf1d6[_0x4a37('0x34')][_0x4a37('0x35')]?_0x4bf1d6[_0x4a37('0x34')]:_0x23ee20[_0x4a37('0x30')];if(!_0x54bdfe[_0x4a37('0x31')][_0x4a37('0x36')](_0x4a37('0x37'))){_0x4bf1d6[_0x4a37('0x38')]=qs['limit'](_0x54bdfe[_0x4a37('0x31')][_0x4a37('0x38')]);_0x4bf1d6[_0x4a37('0x1c')]=qs[_0x4a37('0x1c')](_0x54bdfe[_0x4a37('0x31')][_0x4a37('0x1c')]);}_0x4bf1d6[_0x4a37('0x39')]=qs['sort'](_0x54bdfe[_0x4a37('0x31')][_0x4a37('0x3a')]);_0x4bf1d6['where']=qs[_0x4a37('0x3b')](_[_0x4a37('0x3c')](_0x54bdfe[_0x4a37('0x31')],_0x23ee20[_0x4a37('0x3b')]),_0x4fc602);if(_0x54bdfe['query'][_0x4a37('0x3d')]){_0x4bf1d6[_0x4a37('0x3e')]=_[_0x4a37('0x3f')](_0x4bf1d6['where'],{'$or':_[_0x4a37('0x2a')](_0x4fc602,function(_0x4da941){if(_0x4da941[_0x4a37('0x2e')]!=='VIRTUAL'){var _0x160d39={};_0x160d39[_0x4da941[_0x4a37('0x27')]]={'$like':'%'+_0x54bdfe[_0x4a37('0x31')]['filter']+'%'};return _0x160d39;}})});}_0x4bf1d6=_['merge']({},_0x4bf1d6,_0x54bdfe[_0x4a37('0x40')]);var _0x400d97={'where':_0x4bf1d6['where']};return db['IntegrationReport'][_0x4a37('0x1b')](_0x400d97)[_0x4a37('0x23')](function(_0x356a05){_0x3ed570[_0x4a37('0x1b')]=_0x356a05;if(_0x54bdfe[_0x4a37('0x31')][_0x4a37('0x41')]){_0x4bf1d6['include']=[{'all':!![]}];}return db['IntegrationReport'][_0x4a37('0x42')](_0x4bf1d6);})[_0x4a37('0x23')](function(_0x14af42){_0x3ed570[_0x4a37('0x43')]=_0x14af42;return _0x3ed570;})[_0x4a37('0x23')](respondWithFilteredResult(_0xcd08d0,_0x4bf1d6))[_0x4a37('0x44')](handleError(_0xcd08d0,null));};exports[_0x4a37('0x45')]=function(_0x244d34,_0xdadb9b){var _0x5456a2={'raw':![],'where':{'id':_0x244d34['params']['id']}},_0x5d3da2={};_0x5d3da2[_0x4a37('0x30')]=_[_0x4a37('0x46')](db[_0x4a37('0x2b')][_0x4a37('0x2c')]);_0x5d3da2[_0x4a37('0x31')]=_[_0x4a37('0x46')](_0x244d34[_0x4a37('0x31')]);_0x5d3da2[_0x4a37('0x3b')]=_['intersection'](_0x5d3da2[_0x4a37('0x30')],_0x5d3da2[_0x4a37('0x31')]);_0x5456a2[_0x4a37('0x34')]=_[_0x4a37('0x32')](_0x5d3da2[_0x4a37('0x30')],qs[_0x4a37('0x33')](_0x244d34[_0x4a37('0x31')]['fields']));_0x5456a2[_0x4a37('0x34')]=_0x5456a2[_0x4a37('0x34')]['length']?_0x5456a2[_0x4a37('0x34')]:_0x5d3da2[_0x4a37('0x30')];if(_0x244d34[_0x4a37('0x31')][_0x4a37('0x41')]){_0x5456a2[_0x4a37('0x47')]=[{'all':!![]}];}_0x5456a2=_['merge']({},_0x5456a2,_0x244d34['options']);return db[_0x4a37('0x2b')][_0x4a37('0x48')](_0x5456a2)[_0x4a37('0x23')](handleEntityNotFound(_0xdadb9b,null))[_0x4a37('0x23')](respondWithResult(_0xdadb9b,null))[_0x4a37('0x44')](handleError(_0xdadb9b,null));};exports[_0x4a37('0x49')]=function(_0x4a7789,_0x248942){return db[_0x4a37('0x2b')][_0x4a37('0x49')](_0x4a7789[_0x4a37('0x4a')],{})[_0x4a37('0x23')](respondWithResult(_0x248942,0xc9))[_0x4a37('0x44')](handleError(_0x248942,null));};exports[_0x4a37('0x22')]=function(_0x366f7,_0x2b519a){if(_0x366f7[_0x4a37('0x4a')]['id']){delete _0x366f7[_0x4a37('0x4a')]['id'];}return db[_0x4a37('0x2b')][_0x4a37('0x48')]({'where':{'id':_0x366f7[_0x4a37('0x4b')]['id']}})[_0x4a37('0x23')](handleEntityNotFound(_0x2b519a,null))[_0x4a37('0x23')](saveUpdates(_0x366f7[_0x4a37('0x4a')],null))[_0x4a37('0x23')](respondWithResult(_0x2b519a,null))[_0x4a37('0x44')](handleError(_0x2b519a,null));};exports[_0x4a37('0x24')]=function(_0x173f05,_0x11b4c9){return db[_0x4a37('0x2b')][_0x4a37('0x48')]({'where':{'id':_0x173f05[_0x4a37('0x4b')]['id']}})['then'](handleEntityNotFound(_0x11b4c9,null))[_0x4a37('0x23')](removeEntity(_0x11b4c9,null))[_0x4a37('0x44')](handleError(_0x11b4c9,null));};exports['describe']=function(_0x6fb999,_0x42d685){return db['IntegrationReport']['describe']()['then'](respondWithResult(_0x42d685,null))[_0x4a37('0x44')](handleError(_0x42d685,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index e9a6b51..b3b99a1 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 _0x0a21=['IntegrationReport','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes'];(function(_0x27c21c,_0x1489c3){var _0x4fa029=function(_0x7e5877){while(--_0x7e5877){_0x27c21c['push'](_0x27c21c['shift']());}};_0x4fa029(++_0x1489c3);}(_0x0a21,0x85));var _0x10a2=function(_0x4a08fc,_0x5b57b7){_0x4a08fc=_0x4a08fc-0x0;var _0x27818c=_0x0a21[_0x4a08fc];return _0x27818c;};'use strict';var _=require(_0x10a2('0x0'));var util=require(_0x10a2('0x1'));var logger=require(_0x10a2('0x2'))(_0x10a2('0x3'));var moment=require(_0x10a2('0x4'));var BPromise=require('bluebird');var rp=require(_0x10a2('0x5'));var fs=require('fs');var path=require(_0x10a2('0x6'));var rimraf=require(_0x10a2('0x7'));var config=require(_0x10a2('0x8'));var attributes=require(_0x10a2('0x9'));module['exports']=function(_0x5e4f92,_0x3fa686){return _0x5e4f92['define'](_0x10a2('0xa'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaafb=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xaafb,0xf7));var _0xbaaf=function(_0x552689,_0x296af4){_0x552689=_0x552689-0x0;var _0x1edbc7=_0xaafb[_0x552689];return _0x1edbc7;};'use strict';var _=require(_0xbaaf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbaaf('0x1'));var moment=require(_0xbaaf('0x2'));var BPromise=require(_0xbaaf('0x3'));var rp=require(_0xbaaf('0x4'));var fs=require('fs');var path=require(_0xbaaf('0x5'));var rimraf=require(_0xbaaf('0x6'));var config=require(_0xbaaf('0x7'));var attributes=require(_0xbaaf('0x8'));module[_0xbaaf('0x9')]=function(_0xd8536c,_0x2e33ac){return _0xd8536c[_0xbaaf('0xa')](_0xbaaf('0xb'),attributes,{'tableName':_0xbaaf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 8939218..35726f3 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(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x8603,0x190));var _0x3860=function(_0x3ee7e2,_0x15cf09){_0x3ee7e2=_0x3ee7e2-0x0;var _0x1c1f18=_0x8603[_0x3ee7e2];return _0x1c1f18;};'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 _0x757a=['request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x508d3c,_0x550530){var _0x558ad9=function(_0x5789bb){while(--_0x5789bb){_0x508d3c['push'](_0x508d3c['shift']());}};_0x558ad9(++_0x550530);}(_0x757a,0xde));var _0xa757=function(_0x5270b4,_0x3faa79){_0x5270b4=_0x5270b4-0x0;var _0x212c7f=_0x757a[_0x5270b4];return _0x212c7f;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('IntegrationReport,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 057560a..422e9a7 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(_0x222cff,_0x493c92){var _0x5c931b=function(_0x30f854){while(--_0x30f854){_0x222cff['push'](_0x222cff['shift']());}};_0x5c931b(++_0x493c92);}(_0x7217,0x19e));var _0x7721=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x7217[_0xf0bcac];return _0x4e4c65;};'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 _0x3e74=['isAuthenticated','index','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','./interval.controller','get'];(function(_0x2fc9b4,_0x313e68){var _0x368994=function(_0x2cfcb3){while(--_0x2cfcb3){_0x2fc9b4['push'](_0x2fc9b4['shift']());}};_0x368994(++_0x313e68);}(_0x3e74,0x175));var _0x43e7=function(_0x92c046,_0x3aa4cd){_0x92c046=_0x92c046-0x0;var _0x1cd542=_0x3e74[_0x92c046];return _0x1cd542;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['getIntervals']);router[_0x43e7('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x43e7('0xb')](_0x43e7('0xa'),auth['isAuthenticated'](),controller[_0x43e7('0xc')]);router['post'](_0x43e7('0xd'),auth[_0x43e7('0x7')](),controller['addIntervals']);router[_0x43e7('0xe')](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x10')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x11')]);module[_0x43e7('0x12')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 287c1a4..b093cb9 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 _0xcd2c=['STRING'];(function(_0x4a3ca0,_0x17fb0f){var _0x12a117=function(_0x1f4b26){while(--_0x1f4b26){_0x4a3ca0['push'](_0x4a3ca0['shift']());}};_0x12a117(++_0x17fb0f);}(_0xcd2c,0x1e5));var _0xccd2=function(_0x485d58,_0x195b01){_0x485d58=_0x485d58-0x0;var _0x113d4b=_0xcd2c[_0x485d58];return _0x113d4b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xccd2('0x0')]},'description':{'type':Sequelize[_0xccd2('0x0')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x5909=['STRING','sequelize'];(function(_0x2f1423,_0x9fffe2){var _0x447b3b=function(_0x155458){while(--_0x155458){_0x2f1423['push'](_0x2f1423['shift']());}};_0x447b3b(++_0x9fffe2);}(_0x5909,0xbb));var _0x9590=function(_0x36bff5,_0x3156cb){_0x36bff5=_0x36bff5-0x0;var _0x80ade5=_0x5909[_0x36bff5];return _0x80ade5;};'use strict';var Sequelize=require(_0x9590('0x0'));module['exports']={'name':{'type':Sequelize[_0x9590('0x1')]},'description':{'type':Sequelize[_0x9590('0x1')]},'interval':{'type':Sequelize[_0x9590('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 1369fa1..30b024a 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 _0x6609=['squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../components/extensions/rewrite','sendStatus','status','json','count','offset','apply','reject','update','then','destroy','get','Intervals','UserProfileResource','end','error','stack','name','send','index','map','fieldName','key','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','type','VIRTUAL','Interval','includeAll','include','findAll','catch','params','rawAttributes','options','find','create','body','UserProfileSection','userProfileId','addInterval','getIntervals','findOne','merge','addIntervals','sequelize','transaction','IntervalId','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','lodash'];(function(_0x58dadc,_0x3c1e1d){var _0x1d5749=function(_0x1ea4e1){while(--_0x1ea4e1){_0x58dadc['push'](_0x58dadc['shift']());}};_0x1d5749(++_0x3c1e1d);}(_0x6609,0xef));var _0x9660=function(_0x2d41bb,_0x2c0643){_0x2d41bb=_0x2d41bb-0x0;var _0x2589e0=_0x6609[_0x2d41bb];return _0x2589e0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9660('0x0'));var rimraf=require(_0x9660('0x1'));var zipdir=require(_0x9660('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9660('0x3'));var moment=require(_0x9660('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9660('0x5'));var util=require('util');var path=require('path');var sox=require(_0x9660('0x6'));var csv=require(_0x9660('0x7'));var ejs=require(_0x9660('0x8'));var fs=require('fs');var _=require(_0x9660('0x9'));var squel=require(_0x9660('0xa'));var crypto=require('crypto');var jsforce=require(_0x9660('0xb'));var deskjs=require(_0x9660('0xc'));var toCsv=require(_0x9660('0x7'));var querystring=require(_0x9660('0xd'));var Papa=require('papaparse');var Redis=require(_0x9660('0xe'));var authService=require(_0x9660('0xf'));var qs=require(_0x9660('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9660('0x11'));var logger=require(_0x9660('0x12'))('api');var utils=require(_0x9660('0x13'));var config=require(_0x9660('0x14'));var db=require('../../mysqldb')['db'];var extensions=require(_0x9660('0x15'));function respondWithStatusCode(_0x5db4d6,_0x185d72){_0x185d72=_0x185d72||0xcc;return function(_0x1c43d3){if(_0x1c43d3){return _0x5db4d6[_0x9660('0x16')](_0x185d72);}return _0x5db4d6[_0x9660('0x17')](_0x185d72)['end']();};}function respondWithResult(_0x354da9,_0xbf8b2f){_0xbf8b2f=_0xbf8b2f||0xc8;return function(_0x574dca){if(_0x574dca){return _0x354da9['status'](_0xbf8b2f)[_0x9660('0x18')](_0x574dca);}};}function respondWithFilteredResult(_0x5f39da,_0xf66768){return function(_0x5d0800){if(_0x5d0800){var _0x27a428=_0x5d0800[_0x9660('0x19')],_0x25f1cb=_0xf66768[_0x9660('0x1a')],_0x277015=_0xf66768['offset']+_0xf66768['limit'],_0x9d8adc;if(_0x277015>=_0x27a428){_0x277015=_0x27a428;_0x9d8adc=0xc8;}else{_0x9d8adc=0xce;}_0x5f39da['status'](_0x9d8adc);return _0x5f39da['set']('Content-Range',_0x25f1cb+'-'+_0x277015+'/'+_0x27a428)[_0x9660('0x18')](_0x5d0800);}return null;};}function patchUpdates(_0x2f5899){return function(_0x4b09a5){try{jsonpatch[_0x9660('0x1b')](_0x4b09a5,_0x2f5899,!![]);}catch(_0x4a5632){return BPromise[_0x9660('0x1c')](_0x4a5632);}return _0x4b09a5['save']();};}function saveUpdates(_0x364378,_0x72753){return function(_0x2429b3){if(_0x2429b3){return _0x2429b3[_0x9660('0x1d')](_0x364378)[_0x9660('0x1e')](function(_0x13ae2b){return _0x13ae2b;});}return null;};}function removeEntity(_0x3287b6,_0x56b7ee){return function(_0x25a5b4){if(_0x25a5b4){return _0x25a5b4[_0x9660('0x1f')]()[_0x9660('0x1e')](function(){var _0x3a15fa=_0x25a5b4[_0x9660('0x20')]({'plain':!![]});var _0x310a45=_0x9660('0x21');return db[_0x9660('0x22')][_0x9660('0x1f')]({'where':{'type':_0x310a45,'resourceId':_0x3a15fa['id']}})[_0x9660('0x1e')](function(){return _0x25a5b4;});})[_0x9660('0x1e')](function(){_0x3287b6[_0x9660('0x17')](0xcc)[_0x9660('0x23')]();});}};}function handleEntityNotFound(_0x35eaf3,_0x44941b){return function(_0x13e50f){if(!_0x13e50f){_0x35eaf3['sendStatus'](0x194);}return _0x13e50f;};}function handleError(_0x5a3af5,_0x2cd249){_0x2cd249=_0x2cd249||0x1f4;return function(_0x33c4c7){logger[_0x9660('0x24')](_0x33c4c7[_0x9660('0x25')]);if(_0x33c4c7[_0x9660('0x26')]){delete _0x33c4c7[_0x9660('0x26')];}_0x5a3af5[_0x9660('0x17')](_0x2cd249)[_0x9660('0x27')](_0x33c4c7);};}exports[_0x9660('0x28')]=function(_0x4c9831,_0x5b3101){var _0x54d655={},_0x5eed3d={},_0x15da1a={'count':0x0,'rows':[]};var _0x257fce=_[_0x9660('0x29')](db['Interval']['rawAttributes'],function(_0x16a8ef){return{'name':_0x16a8ef[_0x9660('0x2a')],'type':_0x16a8ef['type'][_0x9660('0x2b')]};});_0x5eed3d['model']=_[_0x9660('0x29')](_0x257fce,_0x9660('0x26'));_0x5eed3d[_0x9660('0x2c')]=_[_0x9660('0x2d')](_0x4c9831[_0x9660('0x2c')]);_0x5eed3d['filters']=_['intersection'](_0x5eed3d['model'],_0x5eed3d['query']);_0x54d655[_0x9660('0x2e')]=_[_0x9660('0x2f')](_0x5eed3d[_0x9660('0x30')],qs[_0x9660('0x31')](_0x4c9831[_0x9660('0x2c')][_0x9660('0x31')]));_0x54d655[_0x9660('0x2e')]=_0x54d655[_0x9660('0x2e')][_0x9660('0x32')]?_0x54d655[_0x9660('0x2e')]:_0x5eed3d[_0x9660('0x30')];if(!_0x4c9831[_0x9660('0x2c')][_0x9660('0x33')](_0x9660('0x34'))){_0x54d655['limit']=qs[_0x9660('0x35')](_0x4c9831[_0x9660('0x2c')][_0x9660('0x35')]);_0x54d655['offset']=qs[_0x9660('0x1a')](_0x4c9831[_0x9660('0x2c')]['offset']);}_0x54d655[_0x9660('0x36')]=qs['sort'](_0x4c9831[_0x9660('0x2c')][_0x9660('0x37')]);_0x54d655[_0x9660('0x38')]=qs[_0x9660('0x39')](_[_0x9660('0x3a')](_0x4c9831['query'],_0x5eed3d['filters']),_0x257fce);if(_0x4c9831[_0x9660('0x2c')][_0x9660('0x3b')]){_0x54d655[_0x9660('0x38')]=_['merge'](_0x54d655['where'],{'$or':_[_0x9660('0x29')](_0x257fce,function(_0x16c862){if(_0x16c862[_0x9660('0x3c')]!==_0x9660('0x3d')){var _0x3a9cde={};_0x3a9cde[_0x16c862[_0x9660('0x26')]]={'$like':'%'+_0x4c9831[_0x9660('0x2c')][_0x9660('0x3b')]+'%'};return _0x3a9cde;}})});}_0x54d655=_['merge']({},_0x54d655,_0x4c9831['options']);var _0xf5a33b={'where':_0x54d655[_0x9660('0x38')]};return db[_0x9660('0x3e')][_0x9660('0x19')](_0xf5a33b)['then'](function(_0x23cb04){_0x15da1a[_0x9660('0x19')]=_0x23cb04;if(_0x4c9831[_0x9660('0x2c')][_0x9660('0x3f')]){_0x54d655[_0x9660('0x40')]=[{'all':!![]}];}return db[_0x9660('0x3e')][_0x9660('0x41')](_0x54d655);})['then'](function(_0xedd85b){_0x15da1a['rows']=_0xedd85b;return _0x15da1a;})[_0x9660('0x1e')](respondWithFilteredResult(_0x5b3101,_0x54d655))[_0x9660('0x42')](handleError(_0x5b3101,null));};exports['show']=function(_0x5e52d4,_0x5b123b){var _0x38b45b={'raw':!![],'where':{'id':_0x5e52d4[_0x9660('0x43')]['id']}},_0x1783db={};_0x1783db[_0x9660('0x30')]=_[_0x9660('0x2d')](db[_0x9660('0x3e')][_0x9660('0x44')]);_0x1783db[_0x9660('0x2c')]=_['keys'](_0x5e52d4['query']);_0x1783db['filters']=_[_0x9660('0x2f')](_0x1783db[_0x9660('0x30')],_0x1783db[_0x9660('0x2c')]);_0x38b45b[_0x9660('0x2e')]=_[_0x9660('0x2f')](_0x1783db[_0x9660('0x30')],qs[_0x9660('0x31')](_0x5e52d4[_0x9660('0x2c')][_0x9660('0x31')]));_0x38b45b[_0x9660('0x2e')]=_0x38b45b[_0x9660('0x2e')][_0x9660('0x32')]?_0x38b45b[_0x9660('0x2e')]:_0x1783db[_0x9660('0x30')];if(_0x5e52d4['query'][_0x9660('0x3f')]){_0x38b45b[_0x9660('0x40')]=[{'all':!![]}];}_0x38b45b=_['merge']({},_0x38b45b,_0x5e52d4[_0x9660('0x45')]);return db[_0x9660('0x3e')][_0x9660('0x46')](_0x38b45b)[_0x9660('0x1e')](handleEntityNotFound(_0x5b123b,null))[_0x9660('0x1e')](respondWithResult(_0x5b123b,null))[_0x9660('0x42')](handleError(_0x5b123b,null));};exports[_0x9660('0x47')]=function(_0xf52d03,_0x456a27){return db['Interval'][_0x9660('0x47')](_0xf52d03[_0x9660('0x48')],{})['then'](function(_0x5d78b6){var _0x58888a=_0xf52d03['user'][_0x9660('0x20')]({'plain':!![]});if(!_0x58888a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58888a['role']==='user'){var _0x49f56b=_0x5d78b6[_0x9660('0x20')]({'plain':!![]});var _0x383c84=_0x9660('0x21');return db[_0x9660('0x49')][_0x9660('0x46')]({'where':{'name':_0x383c84,'userProfileId':_0x58888a[_0x9660('0x4a')]},'raw':!![]})[_0x9660('0x1e')](function(_0x3d71ed){if(_0x3d71ed&&_0x3d71ed['autoAssociation']===0x0){return db[_0x9660('0x22')][_0x9660('0x47')]({'name':_0x49f56b['name'],'resourceId':_0x49f56b['id'],'type':_0x3d71ed[_0x9660('0x26')],'sectionId':_0x3d71ed['id']},{})[_0x9660('0x1e')](function(){return _0x5d78b6;});}else{return _0x5d78b6;}})[_0x9660('0x42')](function(_0x2c8c3f){logger[_0x9660('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c8c3f);throw _0x2c8c3f;});}return _0x5d78b6;})[_0x9660('0x1e')](respondWithResult(_0x456a27,0xc9))[_0x9660('0x42')](handleError(_0x456a27,null));};exports[_0x9660('0x1d')]=function(_0x1e6e64,_0x371ea2){if(_0x1e6e64[_0x9660('0x48')]['id']){delete _0x1e6e64[_0x9660('0x48')]['id'];}return db['Interval']['find']({'where':{'id':_0x1e6e64['params']['id']}})[_0x9660('0x1e')](handleEntityNotFound(_0x371ea2,null))[_0x9660('0x1e')](saveUpdates(_0x1e6e64['body'],null))[_0x9660('0x1e')](respondWithResult(_0x371ea2,null))['catch'](handleError(_0x371ea2,null));};exports[_0x9660('0x1f')]=function(_0x3c78f1,_0x66007f){return db[_0x9660('0x3e')][_0x9660('0x46')]({'where':{'id':_0x3c78f1[_0x9660('0x43')]['id']}})[_0x9660('0x1e')](handleEntityNotFound(_0x66007f,null))[_0x9660('0x1e')](removeEntity(_0x66007f,null))[_0x9660('0x42')](handleError(_0x66007f,null));};exports[_0x9660('0x4b')]=function(_0x3c5419,_0x293c31,_0x319d65){if(_0x3c5419[_0x9660('0x48')]['id']){delete _0x3c5419[_0x9660('0x48')]['id'];}return db[_0x9660('0x3e')]['find']({'where':{'id':_0x3c5419[_0x9660('0x43')]['id']}})[_0x9660('0x1e')](handleEntityNotFound(_0x293c31,null))[_0x9660('0x1e')](function(_0x5574ea){if(_0x5574ea){_0x3c5419[_0x9660('0x48')]['IntervalId']=_0x5574ea['id'];return db[_0x9660('0x3e')][_0x9660('0x47')](_0x3c5419['body']);}})[_0x9660('0x1e')](respondWithResult(_0x293c31,null))[_0x9660('0x42')](handleError(_0x293c31,null));};exports[_0x9660('0x4c')]=function(_0x497ef4,_0x1a8b2a,_0x1a5ed0){var _0x1f81c0={};var _0x5511f8={};var _0x536aa8;var _0x46aa13;return db[_0x9660('0x3e')][_0x9660('0x4d')]({'where':{'id':_0x497ef4['params']['id']}})['then'](handleEntityNotFound(_0x1a8b2a,null))[_0x9660('0x1e')](function(_0x41dcec){if(_0x41dcec){_0x536aa8=_0x41dcec;_0x5511f8[_0x9660('0x30')]=_['keys'](db[_0x9660('0x3e')]['rawAttributes']);_0x5511f8[_0x9660('0x2c')]=_[_0x9660('0x2d')](_0x497ef4['query']);_0x5511f8['filters']=_['intersection'](_0x5511f8['model'],_0x5511f8[_0x9660('0x2c')]);_0x1f81c0[_0x9660('0x2e')]=_[_0x9660('0x2f')](_0x5511f8[_0x9660('0x30')],qs[_0x9660('0x31')](_0x497ef4[_0x9660('0x2c')][_0x9660('0x31')]));_0x1f81c0[_0x9660('0x2e')]=_0x1f81c0[_0x9660('0x2e')][_0x9660('0x32')]?_0x1f81c0['attributes']:_0x5511f8[_0x9660('0x30')];_0x1f81c0[_0x9660('0x36')]=qs[_0x9660('0x37')](_0x497ef4['query'][_0x9660('0x37')]);_0x1f81c0[_0x9660('0x38')]=qs[_0x9660('0x39')](_[_0x9660('0x3a')](_0x497ef4[_0x9660('0x2c')],_0x5511f8[_0x9660('0x39')]));if(_0x497ef4[_0x9660('0x2c')][_0x9660('0x3b')]){_0x1f81c0[_0x9660('0x38')]=_['merge'](_0x1f81c0[_0x9660('0x38')],{'$or':_['map'](_0x1f81c0[_0x9660('0x2e')],function(_0x14d999){var _0x272b00={};_0x272b00[_0x14d999]={'$like':'%'+_0x497ef4[_0x9660('0x2c')][_0x9660('0x3b')]+'%'};return _0x272b00;})});}_0x1f81c0=_[_0x9660('0x4e')]({},_0x1f81c0,_0x497ef4[_0x9660('0x45')]);return _0x536aa8[_0x9660('0x4c')](_0x1f81c0);}})[_0x9660('0x1e')](function(_0x4ff07f){if(_0x4ff07f){_0x46aa13=_0x4ff07f['length'];if(!_0x497ef4[_0x9660('0x2c')]['hasOwnProperty']('nolimit')){_0x1f81c0[_0x9660('0x35')]=qs[_0x9660('0x35')](_0x497ef4[_0x9660('0x2c')]['limit']);_0x1f81c0[_0x9660('0x1a')]=qs[_0x9660('0x1a')](_0x497ef4[_0x9660('0x2c')][_0x9660('0x1a')]);}return _0x536aa8[_0x9660('0x4c')](_0x1f81c0);}})[_0x9660('0x1e')](function(_0x53e914){if(_0x53e914){return _0x53e914?{'count':_0x46aa13,'rows':_0x53e914}:null;}})[_0x9660('0x1e')](respondWithResult(_0x1a8b2a,null))[_0x9660('0x42')](handleError(_0x1a8b2a,null));};exports[_0x9660('0x4f')]=function(_0x5e805e,_0x4d434c,_0x4c5395){return db['Interval']['findOne']({'where':{'id':_0x5e805e[_0x9660('0x43')]['id']}})['then'](handleEntityNotFound(_0x4d434c,null))[_0x9660('0x1e')](function(_0x570d15){if(_0x570d15){return db[_0x9660('0x50')][_0x9660('0x51')](function(_0x4a2e05){return db['Interval']['destroy']({'where':{'IntervalId':_0x5e805e[_0x9660('0x43')]['id']},'transaction':_0x4a2e05})[_0x9660('0x1e')](function(_0x2d147a){var _0x54c53e=_[_0x9660('0x29')](_0x5e805e[_0x9660('0x48')],function(_0x3f166e){delete _0x3f166e['id'];_0x3f166e[_0x9660('0x52')]=_0x5e805e[_0x9660('0x43')]['id'];return _0x3f166e;});return db[_0x9660('0x3e')]['bulkCreate'](_0x54c53e,{'transaction':_0x4a2e05});});})['then'](function(){return db[_0x9660('0x3e')][_0x9660('0x41')]({'where':{'IntervalId':_0x5e805e[_0x9660('0x43')]['id']}});});}})[_0x9660('0x1e')](respondWithResult(_0x4d434c,null))['catch'](handleError(_0x4d434c,null));}; \ No newline at end of file +var _0xca42=['save','update','then','get','Intervals','UserProfileResource','destroy','error','name','send','index','map','rawAttributes','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','sort','filters','pick','filter','where','merge','Interval','includeAll','include','findAll','catch','params','options','find','create','user','role','userProfileId','autoAssociation','body','addInterval','IntervalId','getIntervals','findOne','order','nolimit','addIntervals','sequelize','transaction','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','status','end','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0xb24fad,_0xd58756){var _0x173226=function(_0x33b4d6){while(--_0x33b4d6){_0xb24fad['push'](_0xb24fad['shift']());}};_0x173226(++_0xd58756);}(_0xca42,0xe7));var _0x2ca4=function(_0x3b6896,_0x35fbdd){_0x3b6896=_0x3b6896-0x0;var _0x399829=_0xca42[_0x3b6896];return _0x399829;};'use strict';var pdf=require(_0x2ca4('0x0'));var emlformat=require(_0x2ca4('0x1'));var rimraf=require(_0x2ca4('0x2'));var zipdir=require(_0x2ca4('0x3'));var jsonpatch=require(_0x2ca4('0x4'));var rp=require(_0x2ca4('0x5'));var moment=require(_0x2ca4('0x6'));var BPromise=require(_0x2ca4('0x7'));var Mustache=require('mustache');var util=require(_0x2ca4('0x8'));var path=require(_0x2ca4('0x9'));var sox=require(_0x2ca4('0xa'));var csv=require(_0x2ca4('0xb'));var ejs=require(_0x2ca4('0xc'));var fs=require('fs');var _=require(_0x2ca4('0xd'));var squel=require(_0x2ca4('0xe'));var crypto=require(_0x2ca4('0xf'));var jsforce=require(_0x2ca4('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2ca4('0x11'));var Papa=require(_0x2ca4('0x12'));var Redis=require(_0x2ca4('0x13'));var authService=require(_0x2ca4('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ca4('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x2ca4('0x16'));var config=require(_0x2ca4('0x17'));var db=require(_0x2ca4('0x18'))['db'];var extensions=require(_0x2ca4('0x19'));function respondWithStatusCode(_0x292f87,_0x14a5c7){_0x14a5c7=_0x14a5c7||0xcc;return function(_0x398e69){if(_0x398e69){return _0x292f87['sendStatus'](_0x14a5c7);}return _0x292f87[_0x2ca4('0x1a')](_0x14a5c7)[_0x2ca4('0x1b')]();};}function respondWithResult(_0x3e95de,_0x44e876){_0x44e876=_0x44e876||0xc8;return function(_0x19b456){if(_0x19b456){return _0x3e95de[_0x2ca4('0x1a')](_0x44e876)[_0x2ca4('0x1c')](_0x19b456);}};}function respondWithFilteredResult(_0x1a4ba9,_0x3602e2){return function(_0xe5abf){if(_0xe5abf){var _0xe76615=_0xe5abf[_0x2ca4('0x1d')],_0x197dbb=_0x3602e2[_0x2ca4('0x1e')],_0x493a9b=_0x3602e2['offset']+_0x3602e2[_0x2ca4('0x1f')],_0x24d67b;if(_0x493a9b>=_0xe76615){_0x493a9b=_0xe76615;_0x24d67b=0xc8;}else{_0x24d67b=0xce;}_0x1a4ba9['status'](_0x24d67b);return _0x1a4ba9[_0x2ca4('0x20')](_0x2ca4('0x21'),_0x197dbb+'-'+_0x493a9b+'/'+_0xe76615)[_0x2ca4('0x1c')](_0xe5abf);}return null;};}function patchUpdates(_0x2e3eb4){return function(_0x352268){try{jsonpatch[_0x2ca4('0x22')](_0x352268,_0x2e3eb4,!![]);}catch(_0x1dc665){return BPromise[_0x2ca4('0x23')](_0x1dc665);}return _0x352268[_0x2ca4('0x24')]();};}function saveUpdates(_0x945eec,_0x364a91){return function(_0x1d0085){if(_0x1d0085){return _0x1d0085[_0x2ca4('0x25')](_0x945eec)[_0x2ca4('0x26')](function(_0x364c23){return _0x364c23;});}return null;};}function removeEntity(_0x4cf564,_0x5adb3a){return function(_0x48725a){if(_0x48725a){return _0x48725a['destroy']()[_0x2ca4('0x26')](function(){var _0x49ac05=_0x48725a[_0x2ca4('0x27')]({'plain':!![]});var _0xa2bb0d=_0x2ca4('0x28');return db[_0x2ca4('0x29')][_0x2ca4('0x2a')]({'where':{'type':_0xa2bb0d,'resourceId':_0x49ac05['id']}})[_0x2ca4('0x26')](function(){return _0x48725a;});})[_0x2ca4('0x26')](function(){_0x4cf564[_0x2ca4('0x1a')](0xcc)[_0x2ca4('0x1b')]();});}};}function handleEntityNotFound(_0x409ec0,_0x42e589){return function(_0x572ab6){if(!_0x572ab6){_0x409ec0['sendStatus'](0x194);}return _0x572ab6;};}function handleError(_0x20c2d8,_0x496732){_0x496732=_0x496732||0x1f4;return function(_0x34cab7){logger[_0x2ca4('0x2b')](_0x34cab7['stack']);if(_0x34cab7[_0x2ca4('0x2c')]){delete _0x34cab7[_0x2ca4('0x2c')];}_0x20c2d8[_0x2ca4('0x1a')](_0x496732)[_0x2ca4('0x2d')](_0x34cab7);};}exports[_0x2ca4('0x2e')]=function(_0x5cc766,_0x1aa36d){var _0xa38df1={},_0x3a5e6f={},_0x497384={'count':0x0,'rows':[]};var _0x599304=_[_0x2ca4('0x2f')](db['Interval'][_0x2ca4('0x30')],function(_0x92a5fd){return{'name':_0x92a5fd['fieldName'],'type':_0x92a5fd[_0x2ca4('0x31')][_0x2ca4('0x32')]};});_0x3a5e6f[_0x2ca4('0x33')]=_[_0x2ca4('0x2f')](_0x599304,'name');_0x3a5e6f['query']=_[_0x2ca4('0x34')](_0x5cc766[_0x2ca4('0x35')]);_0x3a5e6f['filters']=_[_0x2ca4('0x36')](_0x3a5e6f['model'],_0x3a5e6f[_0x2ca4('0x35')]);_0xa38df1['attributes']=_['intersection'](_0x3a5e6f['model'],qs[_0x2ca4('0x37')](_0x5cc766['query'][_0x2ca4('0x37')]));_0xa38df1['attributes']=_0xa38df1[_0x2ca4('0x38')][_0x2ca4('0x39')]?_0xa38df1['attributes']:_0x3a5e6f[_0x2ca4('0x33')];if(!_0x5cc766[_0x2ca4('0x35')][_0x2ca4('0x3a')]('nolimit')){_0xa38df1[_0x2ca4('0x1f')]=qs[_0x2ca4('0x1f')](_0x5cc766[_0x2ca4('0x35')][_0x2ca4('0x1f')]);_0xa38df1['offset']=qs[_0x2ca4('0x1e')](_0x5cc766[_0x2ca4('0x35')]['offset']);}_0xa38df1['order']=qs['sort'](_0x5cc766[_0x2ca4('0x35')][_0x2ca4('0x3b')]);_0xa38df1['where']=qs[_0x2ca4('0x3c')](_[_0x2ca4('0x3d')](_0x5cc766[_0x2ca4('0x35')],_0x3a5e6f[_0x2ca4('0x3c')]),_0x599304);if(_0x5cc766[_0x2ca4('0x35')][_0x2ca4('0x3e')]){_0xa38df1[_0x2ca4('0x3f')]=_[_0x2ca4('0x40')](_0xa38df1[_0x2ca4('0x3f')],{'$or':_[_0x2ca4('0x2f')](_0x599304,function(_0x257b02){if(_0x257b02[_0x2ca4('0x31')]!=='VIRTUAL'){var _0x1b3fb6={};_0x1b3fb6[_0x257b02[_0x2ca4('0x2c')]]={'$like':'%'+_0x5cc766[_0x2ca4('0x35')][_0x2ca4('0x3e')]+'%'};return _0x1b3fb6;}})});}_0xa38df1=_[_0x2ca4('0x40')]({},_0xa38df1,_0x5cc766['options']);var _0xacc906={'where':_0xa38df1[_0x2ca4('0x3f')]};return db[_0x2ca4('0x41')][_0x2ca4('0x1d')](_0xacc906)[_0x2ca4('0x26')](function(_0x41695b){_0x497384['count']=_0x41695b;if(_0x5cc766['query'][_0x2ca4('0x42')]){_0xa38df1[_0x2ca4('0x43')]=[{'all':!![]}];}return db[_0x2ca4('0x41')][_0x2ca4('0x44')](_0xa38df1);})[_0x2ca4('0x26')](function(_0x320759){_0x497384['rows']=_0x320759;return _0x497384;})[_0x2ca4('0x26')](respondWithFilteredResult(_0x1aa36d,_0xa38df1))[_0x2ca4('0x45')](handleError(_0x1aa36d,null));};exports['show']=function(_0x460561,_0x187636){var _0x50d603={'raw':!![],'where':{'id':_0x460561[_0x2ca4('0x46')]['id']}},_0x2e7177={};_0x2e7177[_0x2ca4('0x33')]=_['keys'](db['Interval'][_0x2ca4('0x30')]);_0x2e7177[_0x2ca4('0x35')]=_['keys'](_0x460561[_0x2ca4('0x35')]);_0x2e7177[_0x2ca4('0x3c')]=_[_0x2ca4('0x36')](_0x2e7177['model'],_0x2e7177[_0x2ca4('0x35')]);_0x50d603[_0x2ca4('0x38')]=_['intersection'](_0x2e7177[_0x2ca4('0x33')],qs[_0x2ca4('0x37')](_0x460561[_0x2ca4('0x35')][_0x2ca4('0x37')]));_0x50d603['attributes']=_0x50d603[_0x2ca4('0x38')][_0x2ca4('0x39')]?_0x50d603[_0x2ca4('0x38')]:_0x2e7177['model'];if(_0x460561[_0x2ca4('0x35')][_0x2ca4('0x42')]){_0x50d603['include']=[{'all':!![]}];}_0x50d603=_[_0x2ca4('0x40')]({},_0x50d603,_0x460561[_0x2ca4('0x47')]);return db[_0x2ca4('0x41')][_0x2ca4('0x48')](_0x50d603)[_0x2ca4('0x26')](handleEntityNotFound(_0x187636,null))['then'](respondWithResult(_0x187636,null))[_0x2ca4('0x45')](handleError(_0x187636,null));};exports[_0x2ca4('0x49')]=function(_0x386b06,_0x5cf7ba){return db[_0x2ca4('0x41')][_0x2ca4('0x49')](_0x386b06['body'],{})[_0x2ca4('0x26')](function(_0x120e1e){var _0x4080c2=_0x386b06[_0x2ca4('0x4a')][_0x2ca4('0x27')]({'plain':!![]});if(!_0x4080c2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4080c2[_0x2ca4('0x4b')]===_0x2ca4('0x4a')){var _0x3e599f=_0x120e1e[_0x2ca4('0x27')]({'plain':!![]});var _0x52f811=_0x2ca4('0x28');return db['UserProfileSection'][_0x2ca4('0x48')]({'where':{'name':_0x52f811,'userProfileId':_0x4080c2[_0x2ca4('0x4c')]},'raw':!![]})[_0x2ca4('0x26')](function(_0x8fac11){if(_0x8fac11&&_0x8fac11[_0x2ca4('0x4d')]===0x0){return db[_0x2ca4('0x29')]['create']({'name':_0x3e599f[_0x2ca4('0x2c')],'resourceId':_0x3e599f['id'],'type':_0x8fac11[_0x2ca4('0x2c')],'sectionId':_0x8fac11['id']},{})['then'](function(){return _0x120e1e;});}else{return _0x120e1e;}})[_0x2ca4('0x45')](function(_0x28e3d6){logger[_0x2ca4('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28e3d6);throw _0x28e3d6;});}return _0x120e1e;})[_0x2ca4('0x26')](respondWithResult(_0x5cf7ba,0xc9))[_0x2ca4('0x45')](handleError(_0x5cf7ba,null));};exports[_0x2ca4('0x25')]=function(_0x330a45,_0x2245cc){if(_0x330a45[_0x2ca4('0x4e')]['id']){delete _0x330a45[_0x2ca4('0x4e')]['id'];}return db[_0x2ca4('0x41')]['find']({'where':{'id':_0x330a45[_0x2ca4('0x46')]['id']}})[_0x2ca4('0x26')](handleEntityNotFound(_0x2245cc,null))['then'](saveUpdates(_0x330a45[_0x2ca4('0x4e')],null))[_0x2ca4('0x26')](respondWithResult(_0x2245cc,null))['catch'](handleError(_0x2245cc,null));};exports['destroy']=function(_0x4f38ca,_0x1ba14b){return db[_0x2ca4('0x41')][_0x2ca4('0x48')]({'where':{'id':_0x4f38ca[_0x2ca4('0x46')]['id']}})['then'](handleEntityNotFound(_0x1ba14b,null))[_0x2ca4('0x26')](removeEntity(_0x1ba14b,null))[_0x2ca4('0x45')](handleError(_0x1ba14b,null));};exports[_0x2ca4('0x4f')]=function(_0x57a99b,_0x11f407,_0x183e98){if(_0x57a99b[_0x2ca4('0x4e')]['id']){delete _0x57a99b[_0x2ca4('0x4e')]['id'];}return db[_0x2ca4('0x41')][_0x2ca4('0x48')]({'where':{'id':_0x57a99b[_0x2ca4('0x46')]['id']}})['then'](handleEntityNotFound(_0x11f407,null))[_0x2ca4('0x26')](function(_0xcc3244){if(_0xcc3244){_0x57a99b[_0x2ca4('0x4e')][_0x2ca4('0x50')]=_0xcc3244['id'];return db['Interval'][_0x2ca4('0x49')](_0x57a99b[_0x2ca4('0x4e')]);}})['then'](respondWithResult(_0x11f407,null))[_0x2ca4('0x45')](handleError(_0x11f407,null));};exports[_0x2ca4('0x51')]=function(_0x29143c,_0x12e7cd,_0x2e4f06){var _0x4eab35={};var _0x104b11={};var _0x2b89d5;var _0x5a39d3;return db[_0x2ca4('0x41')][_0x2ca4('0x52')]({'where':{'id':_0x29143c['params']['id']}})['then'](handleEntityNotFound(_0x12e7cd,null))[_0x2ca4('0x26')](function(_0x5737d4){if(_0x5737d4){_0x2b89d5=_0x5737d4;_0x104b11[_0x2ca4('0x33')]=_[_0x2ca4('0x34')](db[_0x2ca4('0x41')][_0x2ca4('0x30')]);_0x104b11['query']=_[_0x2ca4('0x34')](_0x29143c['query']);_0x104b11[_0x2ca4('0x3c')]=_[_0x2ca4('0x36')](_0x104b11['model'],_0x104b11[_0x2ca4('0x35')]);_0x4eab35[_0x2ca4('0x38')]=_[_0x2ca4('0x36')](_0x104b11[_0x2ca4('0x33')],qs[_0x2ca4('0x37')](_0x29143c[_0x2ca4('0x35')]['fields']));_0x4eab35[_0x2ca4('0x38')]=_0x4eab35[_0x2ca4('0x38')][_0x2ca4('0x39')]?_0x4eab35[_0x2ca4('0x38')]:_0x104b11['model'];_0x4eab35[_0x2ca4('0x53')]=qs['sort'](_0x29143c[_0x2ca4('0x35')][_0x2ca4('0x3b')]);_0x4eab35[_0x2ca4('0x3f')]=qs[_0x2ca4('0x3c')](_[_0x2ca4('0x3d')](_0x29143c[_0x2ca4('0x35')],_0x104b11[_0x2ca4('0x3c')]));if(_0x29143c[_0x2ca4('0x35')][_0x2ca4('0x3e')]){_0x4eab35[_0x2ca4('0x3f')]=_['merge'](_0x4eab35[_0x2ca4('0x3f')],{'$or':_[_0x2ca4('0x2f')](_0x4eab35[_0x2ca4('0x38')],function(_0x46ea32){var _0x76b9ee={};_0x76b9ee[_0x46ea32]={'$like':'%'+_0x29143c['query'][_0x2ca4('0x3e')]+'%'};return _0x76b9ee;})});}_0x4eab35=_[_0x2ca4('0x40')]({},_0x4eab35,_0x29143c[_0x2ca4('0x47')]);return _0x2b89d5['getIntervals'](_0x4eab35);}})[_0x2ca4('0x26')](function(_0x25fe51){if(_0x25fe51){_0x5a39d3=_0x25fe51[_0x2ca4('0x39')];if(!_0x29143c[_0x2ca4('0x35')][_0x2ca4('0x3a')](_0x2ca4('0x54'))){_0x4eab35[_0x2ca4('0x1f')]=qs[_0x2ca4('0x1f')](_0x29143c[_0x2ca4('0x35')][_0x2ca4('0x1f')]);_0x4eab35[_0x2ca4('0x1e')]=qs[_0x2ca4('0x1e')](_0x29143c['query'][_0x2ca4('0x1e')]);}return _0x2b89d5[_0x2ca4('0x51')](_0x4eab35);}})[_0x2ca4('0x26')](function(_0x5ec6be){if(_0x5ec6be){return _0x5ec6be?{'count':_0x5a39d3,'rows':_0x5ec6be}:null;}})[_0x2ca4('0x26')](respondWithResult(_0x12e7cd,null))[_0x2ca4('0x45')](handleError(_0x12e7cd,null));};exports[_0x2ca4('0x55')]=function(_0x46c093,_0x4d27bb,_0x50595c){return db[_0x2ca4('0x41')][_0x2ca4('0x52')]({'where':{'id':_0x46c093[_0x2ca4('0x46')]['id']}})[_0x2ca4('0x26')](handleEntityNotFound(_0x4d27bb,null))['then'](function(_0x4ecd2b){if(_0x4ecd2b){return db[_0x2ca4('0x56')][_0x2ca4('0x57')](function(_0x2a3b5e){return db['Interval'][_0x2ca4('0x2a')]({'where':{'IntervalId':_0x46c093[_0x2ca4('0x46')]['id']},'transaction':_0x2a3b5e})['then'](function(_0x1f71ba){var _0x1ad03a=_[_0x2ca4('0x2f')](_0x46c093[_0x2ca4('0x4e')],function(_0x36e59f){delete _0x36e59f['id'];_0x36e59f['IntervalId']=_0x46c093['params']['id'];return _0x36e59f;});return db[_0x2ca4('0x41')][_0x2ca4('0x58')](_0x1ad03a,{'transaction':_0x2a3b5e});});})[_0x2ca4('0x26')](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x46c093[_0x2ca4('0x46')]['id']}});});}})['then'](respondWithResult(_0x4d27bb,null))['catch'](handleError(_0x4d27bb,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index bfeec5b..d76b4ff 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 _0x2116=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','define','Interval','tools_intervals','rewrite','util'];(function(_0x415dd7,_0x291b82){var _0x221384=function(_0x5f3590){while(--_0x5f3590){_0x415dd7['push'](_0x415dd7['shift']());}};_0x221384(++_0x291b82);}(_0x2116,0x67));var _0x6211=function(_0x5c509c,_0x123d62){_0x5c509c=_0x5c509c-0x0;var _0x3da3be=_0x2116[_0x5c509c];return _0x3da3be;};'use strict';var _=require('lodash');var util=require(_0x6211('0x0'));var logger=require('../../config/logger')(_0x6211('0x1'));var moment=require(_0x6211('0x2'));var BPromise=require(_0x6211('0x3'));var rp=require(_0x6211('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6211('0x5'));var config=require(_0x6211('0x6'));var attributes=require(_0x6211('0x7'));var extensions=require(_0x6211('0x8'));module['exports']=function(_0x37d71a,_0x57f7e7){return _0x37d71a[_0x6211('0x9')](_0x6211('0xa'),attributes,{'tableName':_0x6211('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x31914a,_0x837b82){extensions[_0x6211('0xc')](_0x37d71a,_0x31914a);},'afterBulkCreate':function(_0x10bb82,_0x5eb8a5,_0x135182){_0x135182();extensions[_0x6211('0xc')](_0x37d71a,_0x10bb82[0x0]);},'afterUpdate':function(_0x245e56,_0x1e0634){extensions[_0x6211('0xc')](_0x37d71a,_0x245e56);},'afterDestroy':function(_0x2f6474,_0x1b0938){extensions['rewrite'](_0x37d71a,_0x2f6474);}}});}; \ No newline at end of file +var _0xa769=['../../config/logger','api','moment','request-promise','../../config/environment','./interval.attributes','exports','define','Interval','tools_intervals','rewrite','lodash'];(function(_0x334fb0,_0x36b283){var _0x32434e=function(_0x1ea336){while(--_0x1ea336){_0x334fb0['push'](_0x334fb0['shift']());}};_0x32434e(++_0x36b283);}(_0xa769,0xfb));var _0x9a76=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xa769[_0x432682];return _0x463d05;};'use strict';var _=require(_0x9a76('0x0'));var util=require('util');var logger=require(_0x9a76('0x1'))(_0x9a76('0x2'));var moment=require(_0x9a76('0x3'));var BPromise=require('bluebird');var rp=require(_0x9a76('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9a76('0x5'));var attributes=require(_0x9a76('0x6'));var extensions=require('../../components/extensions/rewrite');module[_0x9a76('0x7')]=function(_0x29af51,_0x39b607){return _0x29af51[_0x9a76('0x8')](_0x9a76('0x9'),attributes,{'tableName':_0x9a76('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c2b2e,_0x54ebea){extensions[_0x9a76('0xb')](_0x29af51,_0x3c2b2e);},'afterBulkCreate':function(_0x2c068d,_0xc84263,_0xfb7f2c){_0xfb7f2c();extensions['rewrite'](_0x29af51,_0x2c068d[0x0]);},'afterUpdate':function(_0x4d16b0,_0x3db311){extensions['rewrite'](_0x29af51,_0x4d16b0);},'afterDestroy':function(_0x76ba4f,_0xd077d4){extensions['rewrite'](_0x29af51,_0x76ba4f);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 214c1ec..4b6ca08 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 _0x85c9=['then','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetInterval','Interval','findAll','options','raw','attributes','limit','include','map','model','ShowInterval','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x4c1ac4,_0x2cca46){var _0x44f0fd=function(_0x438672){while(--_0x438672){_0x4c1ac4['push'](_0x4c1ac4['shift']());}};_0x44f0fd(++_0x2cca46);}(_0x85c9,0x113));var _0x985c=function(_0x588011,_0x5e9d11){_0x588011=_0x588011-0x0;var _0x3b3773=_0x85c9[_0x588011];return _0x3b3773;};'use strict';var _=require(_0x985c('0x0'));var util=require(_0x985c('0x1'));var moment=require(_0x985c('0x2'));var BPromise=require('bluebird');var rs=require(_0x985c('0x3'));var fs=require('fs');var Redis=require(_0x985c('0x4'));var db=require(_0x985c('0x5'))['db'];var utils=require(_0x985c('0x6'));var logger=require(_0x985c('0x7'))(_0x985c('0x8'));var config=require('../../config/environment');var jayson=require(_0x985c('0x9'));var client=jayson[_0x985c('0xa')][_0x985c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9393,_0x58dbd0,_0x282fb4){return new BPromise(function(_0xfc9983,_0x431bda){return client[_0x985c('0xc')](_0x3f9393,_0x282fb4)[_0x985c('0xd')](function(_0x5420d1){logger[_0x985c('0xe')](_0x985c('0xf'),_0x58dbd0,_0x985c('0x10'));logger[_0x985c('0x11')](_0x985c('0x12'),_0x58dbd0,'request\x20sent',JSON[_0x985c('0x13')](_0x5420d1));if(_0x5420d1[_0x985c('0x14')]){if(_0x5420d1['error'][_0x985c('0x15')]===0x1f4){logger[_0x985c('0x14')]('Interval,\x20%s,\x20%s',_0x58dbd0,_0x5420d1[_0x985c('0x14')][_0x985c('0x16')]);return _0x431bda(_0x5420d1['error'][_0x985c('0x16')]);}logger['error']('Interval,\x20%s,\x20%s',_0x58dbd0,_0x5420d1['error'][_0x985c('0x16')]);return _0xfc9983(_0x5420d1['error'][_0x985c('0x16')]);}else{logger['info'](_0x985c('0xf'),_0x58dbd0,_0x985c('0x10'));_0xfc9983(_0x5420d1[_0x985c('0x17')][_0x985c('0x16')]);}})[_0x985c('0x18')](function(_0x1086f2){logger[_0x985c('0x14')](_0x985c('0xf'),_0x58dbd0,_0x1086f2);_0x431bda(_0x1086f2);});});}exports[_0x985c('0x19')]=function(_0x460628){var _0x571910=this;return new Promise(function(_0x39cc5e,_0x15242b){return db[_0x985c('0x1a')][_0x985c('0x1b')]({'raw':_0x460628[_0x985c('0x1c')]?_0x460628[_0x985c('0x1c')][_0x985c('0x1d')]===undefined?!![]:![]:!![],'where':_0x460628[_0x985c('0x1c')]?_0x460628['options']['where']||null:null,'attributes':_0x460628[_0x985c('0x1c')]?_0x460628[_0x985c('0x1c')][_0x985c('0x1e')]||null:null,'limit':_0x460628[_0x985c('0x1c')]?_0x460628[_0x985c('0x1c')][_0x985c('0x1f')]||null:null,'include':_0x460628[_0x985c('0x1c')]?_0x460628['options'][_0x985c('0x20')]?_[_0x985c('0x21')](_0x460628['options']['include'],function(_0x2e13b5){return{'model':db[_0x2e13b5['model']],'as':_0x2e13b5['as'],'attributes':_0x2e13b5[_0x985c('0x1e')],'include':_0x2e13b5[_0x985c('0x20')]?_[_0x985c('0x21')](_0x2e13b5[_0x985c('0x20')],function(_0x29996c){return{'model':db[_0x29996c['model']],'as':_0x29996c['as'],'attributes':_0x29996c[_0x985c('0x1e')],'include':_0x29996c[_0x985c('0x20')]?_['map'](_0x29996c[_0x985c('0x20')],function(_0x3adf5b){return{'model':db[_0x3adf5b[_0x985c('0x22')]],'as':_0x3adf5b['as'],'attributes':_0x3adf5b[_0x985c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x985c('0xd')](function(_0x4a2f90){logger['info'](_0x985c('0x19'),_0x460628);logger[_0x985c('0x11')]('GetInterval',_0x460628,JSON[_0x985c('0x13')](_0x4a2f90));_0x39cc5e(_0x4a2f90);})['catch'](function(_0x2f1043){logger[_0x985c('0x14')](_0x985c('0x19'),_0x2f1043['message'],_0x460628);_0x15242b(_0x571910[_0x985c('0x14')](0x1f4,_0x2f1043['message']));});});};exports[_0x985c('0x23')]=function(_0xfa0376){var _0xcedb21=this;return new Promise(function(_0x413fd8,_0x50069c){return db[_0x985c('0x1a')]['find']({'raw':_0xfa0376[_0x985c('0x1c')]?_0xfa0376[_0x985c('0x1c')][_0x985c('0x1d')]===undefined?!![]:![]:!![],'where':_0xfa0376['options']?_0xfa0376[_0x985c('0x1c')]['where']||null:null,'attributes':_0xfa0376[_0x985c('0x1c')]?_0xfa0376['options'][_0x985c('0x1e')]||null:null,'include':_0xfa0376[_0x985c('0x1c')]?_0xfa0376[_0x985c('0x1c')]['include']?_[_0x985c('0x21')](_0xfa0376[_0x985c('0x1c')][_0x985c('0x20')],function(_0x12f6f9){return{'model':db[_0x12f6f9[_0x985c('0x22')]],'as':_0x12f6f9['as'],'attributes':_0x12f6f9[_0x985c('0x1e')],'include':_0x12f6f9[_0x985c('0x20')]?_[_0x985c('0x21')](_0x12f6f9['include'],function(_0x35566f){return{'model':db[_0x35566f['model']],'as':_0x35566f['as'],'attributes':_0x35566f[_0x985c('0x1e')],'include':_0x35566f[_0x985c('0x20')]?_['map'](_0x35566f['include'],function(_0x157e9f){return{'model':db[_0x157e9f['model']],'as':_0x157e9f['as'],'attributes':_0x157e9f[_0x985c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x985c('0xd')](function(_0x39fda3){logger[_0x985c('0xe')](_0x985c('0x23'),_0xfa0376);logger['debug'](_0x985c('0x23'),_0xfa0376,JSON['stringify'](_0x39fda3));_0x413fd8(_0x39fda3);})[_0x985c('0x18')](function(_0x290ded){logger[_0x985c('0x14')]('ShowInterval',_0x290ded[_0x985c('0x16')],_0xfa0376);_0x50069c(_0xcedb21[_0x985c('0x14')](0x1f4,_0x290ded[_0x985c('0x16')]));});});}; \ No newline at end of file +var _0x2a52=['../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','Interval,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetInterval','Interval','findAll','options','raw','attributes','limit','map','include','model','then','debug','find','ShowInterval','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x596364,_0x247153){var _0x33fbbb=function(_0x1b565f){while(--_0x1b565f){_0x596364['push'](_0x596364['shift']());}};_0x33fbbb(++_0x247153);}(_0x2a52,0xc6));var _0x22a5=function(_0x52c38b,_0x42afc7){_0x52c38b=_0x52c38b-0x0;var _0x1f264c=_0x2a52[_0x52c38b];return _0x1f264c;};'use strict';var _=require(_0x22a5('0x0'));var util=require(_0x22a5('0x1'));var moment=require(_0x22a5('0x2'));var BPromise=require(_0x22a5('0x3'));var rs=require(_0x22a5('0x4'));var fs=require('fs');var Redis=require(_0x22a5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x22a5('0x6'));var logger=require(_0x22a5('0x7'))(_0x22a5('0x8'));var config=require('../../config/environment');var jayson=require(_0x22a5('0x9'));var client=jayson[_0x22a5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5afee6,_0x110a10,_0x18cde3){return new BPromise(function(_0x108606,_0x28cefc){return client[_0x22a5('0xb')](_0x5afee6,_0x18cde3)['then'](function(_0x21e581){logger[_0x22a5('0xc')](_0x22a5('0xd'),_0x110a10,_0x22a5('0xe'));logger['debug']('Interval,\x20%s,\x20%s,\x20%s',_0x110a10,_0x22a5('0xe'),JSON[_0x22a5('0xf')](_0x21e581));if(_0x21e581[_0x22a5('0x10')]){if(_0x21e581[_0x22a5('0x10')]['code']===0x1f4){logger[_0x22a5('0x10')](_0x22a5('0xd'),_0x110a10,_0x21e581[_0x22a5('0x10')][_0x22a5('0x11')]);return _0x28cefc(_0x21e581[_0x22a5('0x10')][_0x22a5('0x11')]);}logger['error'](_0x22a5('0xd'),_0x110a10,_0x21e581[_0x22a5('0x10')][_0x22a5('0x11')]);return _0x108606(_0x21e581[_0x22a5('0x10')]['message']);}else{logger[_0x22a5('0xc')](_0x22a5('0xd'),_0x110a10,_0x22a5('0xe'));_0x108606(_0x21e581[_0x22a5('0x12')][_0x22a5('0x11')]);}})[_0x22a5('0x13')](function(_0x168de7){logger[_0x22a5('0x10')](_0x22a5('0xd'),_0x110a10,_0x168de7);_0x28cefc(_0x168de7);});});}exports[_0x22a5('0x14')]=function(_0x366960){var _0x445c06=this;return new Promise(function(_0x1de913,_0x24db3e){return db[_0x22a5('0x15')][_0x22a5('0x16')]({'raw':_0x366960[_0x22a5('0x17')]?_0x366960[_0x22a5('0x17')][_0x22a5('0x18')]===undefined?!![]:![]:!![],'where':_0x366960[_0x22a5('0x17')]?_0x366960[_0x22a5('0x17')]['where']||null:null,'attributes':_0x366960[_0x22a5('0x17')]?_0x366960['options'][_0x22a5('0x19')]||null:null,'limit':_0x366960[_0x22a5('0x17')]?_0x366960[_0x22a5('0x17')][_0x22a5('0x1a')]||null:null,'include':_0x366960['options']?_0x366960['options']['include']?_[_0x22a5('0x1b')](_0x366960['options'][_0x22a5('0x1c')],function(_0x31dd79){return{'model':db[_0x31dd79[_0x22a5('0x1d')]],'as':_0x31dd79['as'],'attributes':_0x31dd79['attributes'],'include':_0x31dd79['include']?_[_0x22a5('0x1b')](_0x31dd79[_0x22a5('0x1c')],function(_0x2c6c95){return{'model':db[_0x2c6c95[_0x22a5('0x1d')]],'as':_0x2c6c95['as'],'attributes':_0x2c6c95['attributes'],'include':_0x2c6c95[_0x22a5('0x1c')]?_[_0x22a5('0x1b')](_0x2c6c95['include'],function(_0x11e70e){return{'model':db[_0x11e70e[_0x22a5('0x1d')]],'as':_0x11e70e['as'],'attributes':_0x11e70e[_0x22a5('0x19')]};}):[]};}):[]};}):[]:[]})[_0x22a5('0x1e')](function(_0x5986bd){logger['info'](_0x22a5('0x14'),_0x366960);logger[_0x22a5('0x1f')]('GetInterval',_0x366960,JSON['stringify'](_0x5986bd));_0x1de913(_0x5986bd);})[_0x22a5('0x13')](function(_0xe1924c){logger[_0x22a5('0x10')]('GetInterval',_0xe1924c[_0x22a5('0x11')],_0x366960);_0x24db3e(_0x445c06[_0x22a5('0x10')](0x1f4,_0xe1924c['message']));});});};exports['ShowInterval']=function(_0x2401af){var _0xf10e93=this;return new Promise(function(_0x3573f2,_0x175853){return db[_0x22a5('0x15')][_0x22a5('0x20')]({'raw':_0x2401af[_0x22a5('0x17')]?_0x2401af['options']['raw']===undefined?!![]:![]:!![],'where':_0x2401af['options']?_0x2401af[_0x22a5('0x17')]['where']||null:null,'attributes':_0x2401af[_0x22a5('0x17')]?_0x2401af[_0x22a5('0x17')][_0x22a5('0x19')]||null:null,'include':_0x2401af['options']?_0x2401af[_0x22a5('0x17')][_0x22a5('0x1c')]?_[_0x22a5('0x1b')](_0x2401af[_0x22a5('0x17')][_0x22a5('0x1c')],function(_0x28365e){return{'model':db[_0x28365e['model']],'as':_0x28365e['as'],'attributes':_0x28365e[_0x22a5('0x19')],'include':_0x28365e[_0x22a5('0x1c')]?_['map'](_0x28365e[_0x22a5('0x1c')],function(_0x583cf4){return{'model':db[_0x583cf4['model']],'as':_0x583cf4['as'],'attributes':_0x583cf4[_0x22a5('0x19')],'include':_0x583cf4[_0x22a5('0x1c')]?_[_0x22a5('0x1b')](_0x583cf4[_0x22a5('0x1c')],function(_0x541d10){return{'model':db[_0x541d10['model']],'as':_0x541d10['as'],'attributes':_0x541d10[_0x22a5('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37463e){logger[_0x22a5('0xc')](_0x22a5('0x21'),_0x2401af);logger[_0x22a5('0x1f')](_0x22a5('0x21'),_0x2401af,JSON[_0x22a5('0xf')](_0x37463e));_0x3573f2(_0x37463e);})['catch'](function(_0x35ea1a){logger[_0x22a5('0x10')](_0x22a5('0x21'),_0x35ea1a[_0x22a5('0x11')],_0x2401af);_0x175853(_0xf10e93[_0x22a5('0x10')](0x1f4,_0x35ea1a[_0x22a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 675eefa..42b5543 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 _0x716a=['../../components/auth/service','./jira.controller','post','send','exports'];(function(_0x2edc39,_0x41b27f){var _0x337772=function(_0x26431a){while(--_0x26431a){_0x2edc39['push'](_0x2edc39['shift']());}};_0x337772(++_0x41b27f);}(_0x716a,0x6e));var _0xa716=function(_0x3457b4,_0x4cd8f9){_0x3457b4=_0x3457b4-0x0;var _0xaa8fa9=_0x716a[_0x3457b4];return _0xaa8fa9;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xa716('0x0'));var controller=require(_0xa716('0x1'));router[_0xa716('0x2')]('/',auth['isAuthenticated'](),controller[_0xa716('0x3')]);module[_0xa716('0x4')]=router; \ No newline at end of file +var _0x8a25=['Router','../../components/auth/service','./jira.controller','isAuthenticated','send','exports','express'];(function(_0x132558,_0x521d93){var _0x34f138=function(_0x3e3541){while(--_0x3e3541){_0x132558['push'](_0x132558['shift']());}};_0x34f138(++_0x521d93);}(_0x8a25,0x1aa));var _0x58a2=function(_0x4161d5,_0x4a40e6){_0x4161d5=_0x4161d5-0x0;var _0x43c15c=_0x8a25[_0x4161d5];return _0x43c15c;};'use strict';var express=require(_0x58a2('0x0'));var router=express[_0x58a2('0x1')]();var auth=require(_0x58a2('0x2'));var controller=require(_0x58a2('0x3'));router['post']('/',auth[_0x58a2('0x4')](),controller[_0x58a2('0x5')]);module[_0x58a2('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index ff2c9fe..92ef024 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 _0x3fb9=['Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','send','body','headers','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','stringify','issuetype','email','fields','oldToken','customfield_11502','newToken','customfield_11503','name','reason','customfield_10102','/rest/api/2/issue','POST','Basic\x20','toString','base64','request','setEncoding','data','end','status','statusCode','json','error'];(function(_0x506033,_0x7fe3c4){var _0x3d1e67=function(_0x19244c){while(--_0x19244c){_0x506033['push'](_0x506033['shift']());}};_0x3d1e67(++_0x7fe3c4);}(_0x3fb9,0xdf));var _0x93fb=function(_0x35060d,_0x537dbc){_0x35060d=_0x35060d-0x0;var _0x543bfa=_0x3fb9[_0x35060d];return _0x543bfa;};'use strict';var BPromise=require(_0x93fb('0x0'));var https=require(_0x93fb('0x1'));var logger=require(_0x93fb('0x2'))(_0x93fb('0x3'));var USERNAME=_0x93fb('0x4');var PASSWORD=_0x93fb('0x5');function openIssue(_0x1dcccd,_0x2c9fca){var _0x651ad6={'fields':{'project':{'key':_0x1dcccd[_0x93fb('0x6')]||'MOTGUI'},'summary':(_0x1dcccd[_0x93fb('0x7')]||_0x93fb('0x8'))+_0x93fb('0x9')+_0x1dcccd['ip'],'description':_0x1dcccd[_0x93fb('0xa')]||JSON[_0x93fb('0xb')](_0x1dcccd),'issuetype':{'name':_0x1dcccd[_0x93fb('0xc')]||'Bug'}}};_0x651ad6['fields']['customfield_11500']=_0x1dcccd[_0x93fb('0xd')];_0x651ad6[_0x93fb('0xe')]['customfield_11501']=_0x1dcccd[_0x93fb('0xf')];_0x651ad6[_0x93fb('0xe')][_0x93fb('0x10')]=_0x1dcccd[_0x93fb('0x11')];_0x651ad6[_0x93fb('0xe')][_0x93fb('0x12')]=_0x1dcccd[_0x93fb('0x13')];_0x651ad6[_0x93fb('0xe')]['customfield_11504']=_0x1dcccd[_0x93fb('0x14')];_0x651ad6[_0x93fb('0xe')][_0x93fb('0x15')]=_0x1dcccd['ip'];var _0x11e58e={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x93fb('0x16'),'method':_0x93fb('0x17'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x93fb('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x93fb('0x19')](_0x93fb('0x1a'))}};var _0x1462d2=JSON['stringify'](_0x651ad6);var _0x234753=https[_0x93fb('0x1b')](_0x11e58e,function(_0x148c90){_0x148c90[_0x93fb('0x1c')]('utf8');var _0x1965a4='';_0x148c90['on'](_0x93fb('0x1d'),function(_0x5138ec){_0x1965a4+=_0x5138ec;});_0x148c90['on'](_0x93fb('0x1e'),function(){if(_0x2c9fca){return _0x2c9fca[_0x93fb('0x1f')](_0x148c90[_0x93fb('0x20')])[_0x93fb('0x21')](JSON['parse'](_0x1965a4));}});});_0x234753['on'](_0x93fb('0x22'),function(_0x146060){if(_0x2c9fca){return _0x2c9fca[_0x93fb('0x1f')](0x1f4)['json']({'errors':[{'message':_0x93fb('0x23'),'type':'api.jira'}]});}});_0x234753[_0x93fb('0x24')](_0x1462d2);_0x234753[_0x93fb('0x1e')]();}exports['openIssue']=openIssue;exports[_0x93fb('0x25')]=function(_0x3a51f1,_0x408bbf){_0x3a51f1[_0x93fb('0x26')]['ip']=_0x3a51f1[_0x93fb('0x27')]['x-forwarded-for']||_0x3a51f1[_0x93fb('0x28')][_0x93fb('0x29')]||_0x3a51f1[_0x93fb('0x2a')][_0x93fb('0x29')]||_0x3a51f1['connection']['socket'][_0x93fb('0x29')];return openIssue(_0x3a51f1[_0x93fb('0x26')],_0x408bbf);}; \ No newline at end of file +var _0x1175=['api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','Bug','fields','customfield_11500','email','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','toString','request','setEncoding','utf8','data','end','status','statusCode','error','json','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x1175,0xed));var _0x5117=function(_0x38a4a9,_0x4277f7){_0x38a4a9=_0x38a4a9-0x0;var _0x559c30=_0x1175[_0x38a4a9];return _0x559c30;};'use strict';var BPromise=require(_0x5117('0x0'));var https=require(_0x5117('0x1'));var logger=require(_0x5117('0x2'))(_0x5117('0x3'));var USERNAME=_0x5117('0x4');var PASSWORD=_0x5117('0x5');function openIssue(_0x12f337,_0x1886ee){var _0x44af5c={'fields':{'project':{'key':_0x12f337[_0x5117('0x6')]||_0x5117('0x7')},'summary':(_0x12f337[_0x5117('0x8')]||_0x5117('0x9'))+_0x5117('0xa')+_0x12f337['ip'],'description':_0x12f337[_0x5117('0xb')]||JSON[_0x5117('0xc')](_0x12f337),'issuetype':{'name':_0x12f337['issuetype']||_0x5117('0xd')}}};_0x44af5c[_0x5117('0xe')][_0x5117('0xf')]=_0x12f337[_0x5117('0x10')];_0x44af5c[_0x5117('0xe')]['customfield_11501']=_0x12f337[_0x5117('0x11')];_0x44af5c['fields'][_0x5117('0x12')]=_0x12f337[_0x5117('0x13')];_0x44af5c['fields'][_0x5117('0x14')]=_0x12f337[_0x5117('0x15')];_0x44af5c[_0x5117('0xe')][_0x5117('0x16')]=_0x12f337['reason'];_0x44af5c[_0x5117('0xe')][_0x5117('0x17')]=_0x12f337['ip'];var _0x3672e4={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x5117('0x18'),'method':_0x5117('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0x5117('0x1a'),'Authorization':_0x5117('0x1b')+new Buffer(USERNAME+':'+PASSWORD)[_0x5117('0x1c')]('base64')}};var _0x15c86d=JSON[_0x5117('0xc')](_0x44af5c);var _0x100327=https[_0x5117('0x1d')](_0x3672e4,function(_0x4d0ef5){_0x4d0ef5[_0x5117('0x1e')](_0x5117('0x1f'));var _0x1d4053='';_0x4d0ef5['on'](_0x5117('0x20'),function(_0x2bd2b9){_0x1d4053+=_0x2bd2b9;});_0x4d0ef5['on'](_0x5117('0x21'),function(){if(_0x1886ee){return _0x1886ee[_0x5117('0x22')](_0x4d0ef5[_0x5117('0x23')])['json'](JSON['parse'](_0x1d4053));}});});_0x100327['on'](_0x5117('0x24'),function(_0x39943c){if(_0x1886ee){return _0x1886ee[_0x5117('0x22')](0x1f4)[_0x5117('0x25')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x5117('0x26')}]});}});_0x100327[_0x5117('0x27')](_0x15c86d);_0x100327[_0x5117('0x21')]();}exports[_0x5117('0x28')]=openIssue;exports[_0x5117('0x29')]=function(_0x18b8e4,_0x56c685){_0x18b8e4[_0x5117('0x2a')]['ip']=_0x18b8e4[_0x5117('0x2b')][_0x5117('0x2c')]||_0x18b8e4[_0x5117('0x2d')][_0x5117('0x2e')]||_0x18b8e4['socket'][_0x5117('0x2e')]||_0x18b8e4[_0x5117('0x2d')][_0x5117('0x2f')][_0x5117('0x2e')];return openIssue(_0x18b8e4['body'],_0x56c685);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 55348c4..19ac859 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 _0x8e21=['isAuthenticated','index','describe','/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./jscriptyAnswerReport.controller','get'];(function(_0x7ee890,_0x26bc76){var _0x2c1ef7=function(_0x7f60e5){while(--_0x7f60e5){_0x7ee890['push'](_0x7ee890['shift']());}};_0x2c1ef7(++_0x26bc76);}(_0x8e21,0x115));var _0x18e2=function(_0x4e783c,_0x51a362){_0x4e783c=_0x4e783c-0x0;var _0x2fbd6d=_0x8e21[_0x4e783c];return _0x2fbd6d;};'use strict';var multer=require('multer');var util=require(_0x18e2('0x0'));var path=require(_0x18e2('0x1'));var timeout=require(_0x18e2('0x2'));var express=require(_0x18e2('0x3'));var router=express[_0x18e2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x18e2('0x5'));var config=require('../../config/environment');var controller=require(_0x18e2('0x6'));router[_0x18e2('0x7')]('/',auth[_0x18e2('0x8')](),controller[_0x18e2('0x9')]);router['get']('/describe',auth[_0x18e2('0x8')](),controller[_0x18e2('0xa')]);router[_0x18e2('0x7')](_0x18e2('0xb'),auth[_0x18e2('0x8')](),controller[_0x18e2('0xc')]);router[_0x18e2('0xd')]('/',auth[_0x18e2('0x8')](),controller[_0x18e2('0xe')]);router['put'](_0x18e2('0xb'),auth[_0x18e2('0x8')](),controller[_0x18e2('0xf')]);router[_0x18e2('0x10')](_0x18e2('0xb'),auth[_0x18e2('0x8')](),controller[_0x18e2('0x11')]);module[_0x18e2('0x12')]=router; \ No newline at end of file +var _0x31c3=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','delete','destroy','exports','multer'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x31c3,0x1af));var _0x331c=function(_0x5e81e0,_0x13152f){_0x5e81e0=_0x5e81e0-0x0;var _0x5c8de0=_0x31c3[_0x5e81e0];return _0x5c8de0;};'use strict';var multer=require(_0x331c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x331c('0x1'));var express=require(_0x331c('0x2'));var router=express['Router']();var auth=require(_0x331c('0x3'));var interaction=require(_0x331c('0x4'));var config=require(_0x331c('0x5'));var controller=require(_0x331c('0x6'));router[_0x331c('0x7')]('/',auth[_0x331c('0x8')](),controller[_0x331c('0x9')]);router[_0x331c('0x7')](_0x331c('0xa'),auth[_0x331c('0x8')](),controller[_0x331c('0xb')]);router[_0x331c('0x7')](_0x331c('0xc'),auth[_0x331c('0x8')](),controller[_0x331c('0xd')]);router['post']('/',auth[_0x331c('0x8')](),controller['create']);router[_0x331c('0xe')](_0x331c('0xc'),auth[_0x331c('0x8')](),controller['update']);router[_0x331c('0xf')]('/:id',auth[_0x331c('0x8')](),controller[_0x331c('0x10')]);module[_0x331c('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 0182c66..25b8afd 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 _0x24d8=['TEXT','long','sequelize','exports','STRING'];(function(_0x1b45e2,_0x1fd36a){var _0xfd9616=function(_0x5ccbe7){while(--_0x5ccbe7){_0x1b45e2['push'](_0x1b45e2['shift']());}};_0xfd9616(++_0x1fd36a);}(_0x24d8,0x1c4));var _0x824d=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x24d8[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0x824d('0x0'));module[_0x824d('0x1')]={'question':{'type':Sequelize[_0x824d('0x2')]},'answer':{'type':Sequelize[_0x824d('0x3')](_0x824d('0x4'))},'membername':{'type':Sequelize[_0x824d('0x2')]},'projectname':{'type':Sequelize[_0x824d('0x2')]},'queue':{'type':Sequelize[_0x824d('0x2')]},'uniqueid':{'type':Sequelize[_0x824d('0x2')]},'calleridname':{'type':Sequelize[_0x824d('0x2')]},'calleridnum':{'type':Sequelize[_0x824d('0x2')]},'questionId':{'type':Sequelize[_0x824d('0x2')]}}; \ No newline at end of file +var _0x3849=['sequelize','exports','STRING'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x3849,0x66));var _0x9384=function(_0x3d5307,_0x2d6817){_0x3d5307=_0x3d5307-0x0;var _0x46140c=_0x3849[_0x3d5307];return _0x46140c;};'use strict';var Sequelize=require(_0x9384('0x0'));module[_0x9384('0x1')]={'question':{'type':Sequelize[_0x9384('0x2')]},'answer':{'type':Sequelize['TEXT']('long')},'membername':{'type':Sequelize[_0x9384('0x2')]},'projectname':{'type':Sequelize[_0x9384('0x2')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9384('0x2')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x9384('0x2')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 965926b..ff97255 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 _0x0192=['send','index','JscriptyAnswerReport','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','where','merge','VIRTUAL','filter','options','count','includeAll','include','rows','catch','params','rawAttributes','body','update','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','destroy','then','stack','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0192,0x185));var _0x2019=function(_0x133a7b,_0x1a0d64){_0x133a7b=_0x133a7b-0x0;var _0x5b8091=_0x0192[_0x133a7b];return _0x5b8091;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2019('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2019('0x1'));var jsonpatch=require(_0x2019('0x2'));var rp=require(_0x2019('0x3'));var moment=require(_0x2019('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2019('0x5'));var util=require(_0x2019('0x6'));var path=require(_0x2019('0x7'));var sox=require('sox');var csv=require(_0x2019('0x8'));var ejs=require(_0x2019('0x9'));var fs=require('fs');var _=require(_0x2019('0xa'));var squel=require(_0x2019('0xb'));var crypto=require(_0x2019('0xc'));var jsforce=require(_0x2019('0xd'));var deskjs=require(_0x2019('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2019('0xf'));var Redis=require(_0x2019('0x10'));var authService=require(_0x2019('0x11'));var qs=require(_0x2019('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2019('0x13'))(_0x2019('0x14'));var utils=require('../../config/utils');var config=require(_0x2019('0x15'));var db=require(_0x2019('0x16'))['db'];function respondWithStatusCode(_0x2da395,_0x4a753e){_0x4a753e=_0x4a753e||0xcc;return function(_0x3a0b4c){if(_0x3a0b4c){return _0x2da395[_0x2019('0x17')](_0x4a753e);}return _0x2da395[_0x2019('0x18')](_0x4a753e)[_0x2019('0x19')]();};}function respondWithResult(_0x56de03,_0x25371f){_0x25371f=_0x25371f||0xc8;return function(_0x171191){if(_0x171191){return _0x56de03[_0x2019('0x18')](_0x25371f)[_0x2019('0x1a')](_0x171191);}};}function respondWithFilteredResult(_0x4be33f,_0x3ea8b0){return function(_0x55a9c6){if(_0x55a9c6){var _0x54347b=_0x55a9c6['count'],_0x4c5818=_0x3ea8b0[_0x2019('0x1b')],_0xa83533=_0x3ea8b0[_0x2019('0x1b')]+_0x3ea8b0[_0x2019('0x1c')],_0x7784c0;if(_0xa83533>=_0x54347b){_0xa83533=_0x54347b;_0x7784c0=0xc8;}else{_0x7784c0=0xce;}_0x4be33f[_0x2019('0x18')](_0x7784c0);return _0x4be33f[_0x2019('0x1d')](_0x2019('0x1e'),_0x4c5818+'-'+_0xa83533+'/'+_0x54347b)[_0x2019('0x1a')](_0x55a9c6);}return null;};}function patchUpdates(_0x23615e){return function(_0x2c7f9e){try{jsonpatch[_0x2019('0x1f')](_0x2c7f9e,_0x23615e,!![]);}catch(_0x1cdcca){return BPromise['reject'](_0x1cdcca);}return _0x2c7f9e[_0x2019('0x20')]();};}function saveUpdates(_0x4c406e,_0x53a2a3){return function(_0x4a5433){if(_0x4a5433){return _0x4a5433['update'](_0x4c406e)['then'](function(_0x5a9a45){return _0x5a9a45;});}return null;};}function removeEntity(_0x33bcd2,_0x420370){return function(_0x40ca83){if(_0x40ca83){return _0x40ca83[_0x2019('0x21')]()[_0x2019('0x22')](function(){_0x33bcd2[_0x2019('0x18')](0xcc)[_0x2019('0x19')]();});}};}function handleEntityNotFound(_0x24dbbb,_0x4982e2){return function(_0x3b3b0b){if(!_0x3b3b0b){_0x24dbbb[_0x2019('0x17')](0x194);}return _0x3b3b0b;};}function handleError(_0x1b7839,_0x475906){_0x475906=_0x475906||0x1f4;return function(_0x1d7836){logger['error'](_0x1d7836[_0x2019('0x23')]);if(_0x1d7836['name']){delete _0x1d7836[_0x2019('0x24')];}_0x1b7839[_0x2019('0x18')](_0x475906)[_0x2019('0x25')](_0x1d7836);};}exports[_0x2019('0x26')]=function(_0x432fd4,_0x13ef08){var _0x3e33a3={},_0x3b7576={},_0x1a83a8={'count':0x0,'rows':[]};var _0x3f97c5=_['map'](db[_0x2019('0x27')]['rawAttributes'],function(_0x484a33){return{'name':_0x484a33['fieldName'],'type':_0x484a33[_0x2019('0x28')][_0x2019('0x29')]};});_0x3b7576[_0x2019('0x2a')]=_[_0x2019('0x2b')](_0x3f97c5,_0x2019('0x24'));_0x3b7576[_0x2019('0x2c')]=_[_0x2019('0x2d')](_0x432fd4[_0x2019('0x2c')]);_0x3b7576[_0x2019('0x2e')]=_[_0x2019('0x2f')](_0x3b7576[_0x2019('0x2a')],_0x3b7576[_0x2019('0x2c')]);_0x3e33a3[_0x2019('0x30')]=_['intersection'](_0x3b7576['model'],qs['fields'](_0x432fd4[_0x2019('0x2c')][_0x2019('0x31')]));_0x3e33a3[_0x2019('0x30')]=_0x3e33a3[_0x2019('0x30')][_0x2019('0x32')]?_0x3e33a3[_0x2019('0x30')]:_0x3b7576[_0x2019('0x2a')];if(!_0x432fd4[_0x2019('0x2c')][_0x2019('0x33')](_0x2019('0x34'))){_0x3e33a3[_0x2019('0x1c')]=qs[_0x2019('0x1c')](_0x432fd4[_0x2019('0x2c')][_0x2019('0x1c')]);_0x3e33a3[_0x2019('0x1b')]=qs[_0x2019('0x1b')](_0x432fd4[_0x2019('0x2c')][_0x2019('0x1b')]);}_0x3e33a3[_0x2019('0x35')]=qs['sort'](_0x432fd4[_0x2019('0x2c')]['sort']);_0x3e33a3['where']=qs['filters'](_[_0x2019('0x36')](_0x432fd4[_0x2019('0x2c')],_0x3b7576[_0x2019('0x2e')]),_0x3f97c5);if(_0x432fd4['query']['filter']){_0x3e33a3[_0x2019('0x37')]=_[_0x2019('0x38')](_0x3e33a3[_0x2019('0x37')],{'$or':_[_0x2019('0x2b')](_0x3f97c5,function(_0x1a913a){if(_0x1a913a[_0x2019('0x28')]!==_0x2019('0x39')){var _0x1c86c1={};_0x1c86c1[_0x1a913a[_0x2019('0x24')]]={'$like':'%'+_0x432fd4[_0x2019('0x2c')][_0x2019('0x3a')]+'%'};return _0x1c86c1;}})});}_0x3e33a3=_[_0x2019('0x38')]({},_0x3e33a3,_0x432fd4[_0x2019('0x3b')]);var _0xfd5ec8={'where':_0x3e33a3[_0x2019('0x37')]};return db[_0x2019('0x27')][_0x2019('0x3c')](_0xfd5ec8)['then'](function(_0x46f1db){_0x1a83a8['count']=_0x46f1db;if(_0x432fd4[_0x2019('0x2c')][_0x2019('0x3d')]){_0x3e33a3[_0x2019('0x3e')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x3e33a3);})[_0x2019('0x22')](function(_0x3f9c99){_0x1a83a8[_0x2019('0x3f')]=_0x3f9c99;return _0x1a83a8;})[_0x2019('0x22')](respondWithFilteredResult(_0x13ef08,_0x3e33a3))[_0x2019('0x40')](handleError(_0x13ef08,null));};exports['show']=function(_0x29f772,_0x24d466){var _0x39cc8c={'raw':!![],'where':{'id':_0x29f772[_0x2019('0x41')]['id']}},_0x5e3cb8={};_0x5e3cb8[_0x2019('0x2a')]=_[_0x2019('0x2d')](db['JscriptyAnswerReport'][_0x2019('0x42')]);_0x5e3cb8[_0x2019('0x2c')]=_[_0x2019('0x2d')](_0x29f772[_0x2019('0x2c')]);_0x5e3cb8['filters']=_[_0x2019('0x2f')](_0x5e3cb8[_0x2019('0x2a')],_0x5e3cb8['query']);_0x39cc8c[_0x2019('0x30')]=_[_0x2019('0x2f')](_0x5e3cb8[_0x2019('0x2a')],qs['fields'](_0x29f772[_0x2019('0x2c')][_0x2019('0x31')]));_0x39cc8c['attributes']=_0x39cc8c['attributes']['length']?_0x39cc8c['attributes']:_0x5e3cb8[_0x2019('0x2a')];if(_0x29f772[_0x2019('0x2c')]['includeAll']){_0x39cc8c['include']=[{'all':!![]}];}_0x39cc8c=_[_0x2019('0x38')]({},_0x39cc8c,_0x29f772['options']);return db[_0x2019('0x27')]['find'](_0x39cc8c)[_0x2019('0x22')](handleEntityNotFound(_0x24d466,null))[_0x2019('0x22')](respondWithResult(_0x24d466,null))[_0x2019('0x40')](handleError(_0x24d466,null));};exports['create']=function(_0x2941bc,_0x4036ce){return db[_0x2019('0x27')]['create'](_0x2941bc[_0x2019('0x43')],{})[_0x2019('0x22')](respondWithResult(_0x4036ce,0xc9))[_0x2019('0x40')](handleError(_0x4036ce,null));};exports[_0x2019('0x44')]=function(_0x58f1b5,_0x1bd09f){if(_0x58f1b5[_0x2019('0x43')]['id']){delete _0x58f1b5[_0x2019('0x43')]['id'];}return db[_0x2019('0x27')][_0x2019('0x45')]({'where':{'id':_0x58f1b5[_0x2019('0x41')]['id']}})[_0x2019('0x22')](handleEntityNotFound(_0x1bd09f,null))[_0x2019('0x22')](saveUpdates(_0x58f1b5[_0x2019('0x43')],null))['then'](respondWithResult(_0x1bd09f,null))[_0x2019('0x40')](handleError(_0x1bd09f,null));};exports[_0x2019('0x21')]=function(_0x1256ae,_0x585329){return db[_0x2019('0x27')][_0x2019('0x45')]({'where':{'id':_0x1256ae[_0x2019('0x41')]['id']}})['then'](handleEntityNotFound(_0x585329,null))[_0x2019('0x22')](removeEntity(_0x585329,null))[_0x2019('0x40')](handleError(_0x585329,null));};exports[_0x2019('0x46')]=function(_0x129211,_0xe0e3ca){return db['JscriptyAnswerReport'][_0x2019('0x46')]()[_0x2019('0x22')](respondWithResult(_0xe0e3ca,null))['catch'](handleError(_0xe0e3ca,null));}; \ No newline at end of file +var _0x36dd=['show','params','length','merge','find','body','describe','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','reject','save','update','then','destroy','end','error','stack','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','catch'];(function(_0x32f24c,_0x38fa85){var _0x49136a=function(_0x29b28b){while(--_0x29b28b){_0x32f24c['push'](_0x32f24c['shift']());}};_0x49136a(++_0x38fa85);}(_0x36dd,0x174));var _0xd36d=function(_0x38eb23,_0x196e8b){_0x38eb23=_0x38eb23-0x0;var _0x48506a=_0x36dd[_0x38eb23];return _0x48506a;};'use strict';var pdf=require(_0xd36d('0x0'));var emlformat=require(_0xd36d('0x1'));var rimraf=require(_0xd36d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd36d('0x3'));var BPromise=require(_0xd36d('0x4'));var Mustache=require(_0xd36d('0x5'));var util=require(_0xd36d('0x6'));var path=require(_0xd36d('0x7'));var sox=require(_0xd36d('0x8'));var csv=require(_0xd36d('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd36d('0xa'));var crypto=require(_0xd36d('0xb'));var jsforce=require(_0xd36d('0xc'));var deskjs=require(_0xd36d('0xd'));var toCsv=require(_0xd36d('0x9'));var querystring=require('querystring');var Papa=require(_0xd36d('0xe'));var Redis=require(_0xd36d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd36d('0x10'));var as=require(_0xd36d('0x11'));var hardwareService=require(_0xd36d('0x12'));var logger=require(_0xd36d('0x13'))(_0xd36d('0x14'));var utils=require(_0xd36d('0x15'));var config=require('../../config/environment');var db=require(_0xd36d('0x16'))['db'];function respondWithStatusCode(_0x21b9b0,_0x9154ad){_0x9154ad=_0x9154ad||0xcc;return function(_0x19d832){if(_0x19d832){return _0x21b9b0[_0xd36d('0x17')](_0x9154ad);}return _0x21b9b0[_0xd36d('0x18')](_0x9154ad)['end']();};}function respondWithResult(_0x233bc1,_0x3d9ae8){_0x3d9ae8=_0x3d9ae8||0xc8;return function(_0x43c29e){if(_0x43c29e){return _0x233bc1[_0xd36d('0x18')](_0x3d9ae8)[_0xd36d('0x19')](_0x43c29e);}};}function respondWithFilteredResult(_0x49b7e5,_0x241c33){return function(_0x5ceb63){if(_0x5ceb63){var _0x1761e1=_0x5ceb63[_0xd36d('0x1a')],_0x452059=_0x241c33['offset'],_0x523b0a=_0x241c33[_0xd36d('0x1b')]+_0x241c33[_0xd36d('0x1c')],_0x4274af;if(_0x523b0a>=_0x1761e1){_0x523b0a=_0x1761e1;_0x4274af=0xc8;}else{_0x4274af=0xce;}_0x49b7e5[_0xd36d('0x18')](_0x4274af);return _0x49b7e5['set']('Content-Range',_0x452059+'-'+_0x523b0a+'/'+_0x1761e1)[_0xd36d('0x19')](_0x5ceb63);}return null;};}function patchUpdates(_0x5333d5){return function(_0xa0294e){try{jsonpatch[_0xd36d('0x1d')](_0xa0294e,_0x5333d5,!![]);}catch(_0x350adf){return BPromise[_0xd36d('0x1e')](_0x350adf);}return _0xa0294e[_0xd36d('0x1f')]();};}function saveUpdates(_0x1b2587,_0x376454){return function(_0x513678){if(_0x513678){return _0x513678[_0xd36d('0x20')](_0x1b2587)[_0xd36d('0x21')](function(_0x5a48bc){return _0x5a48bc;});}return null;};}function removeEntity(_0x41c281,_0x5f29d5){return function(_0x3452ad){if(_0x3452ad){return _0x3452ad[_0xd36d('0x22')]()['then'](function(){_0x41c281[_0xd36d('0x18')](0xcc)[_0xd36d('0x23')]();});}};}function handleEntityNotFound(_0x215a76,_0x1b198d){return function(_0xf6357e){if(!_0xf6357e){_0x215a76[_0xd36d('0x17')](0x194);}return _0xf6357e;};}function handleError(_0x3e8c9c,_0x9e351a){_0x9e351a=_0x9e351a||0x1f4;return function(_0xdc7a4a){logger[_0xd36d('0x24')](_0xdc7a4a[_0xd36d('0x25')]);if(_0xdc7a4a['name']){delete _0xdc7a4a['name'];}_0x3e8c9c[_0xd36d('0x18')](_0x9e351a)[_0xd36d('0x26')](_0xdc7a4a);};}exports[_0xd36d('0x27')]=function(_0x37c3c2,_0x5df2d2){var _0x49535d={},_0x152870={},_0x2a28c4={'count':0x0,'rows':[]};var _0x1d2be1=_[_0xd36d('0x28')](db[_0xd36d('0x29')][_0xd36d('0x2a')],function(_0x40d66c){return{'name':_0x40d66c[_0xd36d('0x2b')],'type':_0x40d66c[_0xd36d('0x2c')][_0xd36d('0x2d')]};});_0x152870[_0xd36d('0x2e')]=_[_0xd36d('0x28')](_0x1d2be1,_0xd36d('0x2f'));_0x152870['query']=_[_0xd36d('0x30')](_0x37c3c2[_0xd36d('0x31')]);_0x152870[_0xd36d('0x32')]=_[_0xd36d('0x33')](_0x152870['model'],_0x152870[_0xd36d('0x31')]);_0x49535d['attributes']=_['intersection'](_0x152870['model'],qs['fields'](_0x37c3c2[_0xd36d('0x31')][_0xd36d('0x34')]));_0x49535d['attributes']=_0x49535d['attributes']['length']?_0x49535d[_0xd36d('0x35')]:_0x152870[_0xd36d('0x2e')];if(!_0x37c3c2[_0xd36d('0x31')][_0xd36d('0x36')]('nolimit')){_0x49535d['limit']=qs['limit'](_0x37c3c2[_0xd36d('0x31')][_0xd36d('0x1c')]);_0x49535d[_0xd36d('0x1b')]=qs[_0xd36d('0x1b')](_0x37c3c2[_0xd36d('0x31')][_0xd36d('0x1b')]);}_0x49535d[_0xd36d('0x37')]=qs[_0xd36d('0x38')](_0x37c3c2[_0xd36d('0x31')]['sort']);_0x49535d['where']=qs[_0xd36d('0x32')](_[_0xd36d('0x39')](_0x37c3c2[_0xd36d('0x31')],_0x152870['filters']),_0x1d2be1);if(_0x37c3c2['query'][_0xd36d('0x3a')]){_0x49535d['where']=_['merge'](_0x49535d[_0xd36d('0x3b')],{'$or':_[_0xd36d('0x28')](_0x1d2be1,function(_0x2fb800){if(_0x2fb800[_0xd36d('0x2c')]!==_0xd36d('0x3c')){var _0x3b1460={};_0x3b1460[_0x2fb800[_0xd36d('0x2f')]]={'$like':'%'+_0x37c3c2[_0xd36d('0x31')][_0xd36d('0x3a')]+'%'};return _0x3b1460;}})});}_0x49535d=_['merge']({},_0x49535d,_0x37c3c2[_0xd36d('0x3d')]);var _0x50162e={'where':_0x49535d[_0xd36d('0x3b')]};return db[_0xd36d('0x29')][_0xd36d('0x1a')](_0x50162e)[_0xd36d('0x21')](function(_0x2b0af7){_0x2a28c4['count']=_0x2b0af7;if(_0x37c3c2[_0xd36d('0x31')][_0xd36d('0x3e')]){_0x49535d[_0xd36d('0x3f')]=[{'all':!![]}];}return db[_0xd36d('0x29')][_0xd36d('0x40')](_0x49535d);})[_0xd36d('0x21')](function(_0x2e26b6){_0x2a28c4['rows']=_0x2e26b6;return _0x2a28c4;})[_0xd36d('0x21')](respondWithFilteredResult(_0x5df2d2,_0x49535d))[_0xd36d('0x41')](handleError(_0x5df2d2,null));};exports[_0xd36d('0x42')]=function(_0x2e5a5f,_0xbbb88d){var _0x268eff={'raw':!![],'where':{'id':_0x2e5a5f[_0xd36d('0x43')]['id']}},_0x186575={};_0x186575[_0xd36d('0x2e')]=_['keys'](db['JscriptyAnswerReport'][_0xd36d('0x2a')]);_0x186575['query']=_[_0xd36d('0x30')](_0x2e5a5f[_0xd36d('0x31')]);_0x186575[_0xd36d('0x32')]=_[_0xd36d('0x33')](_0x186575['model'],_0x186575['query']);_0x268eff[_0xd36d('0x35')]=_['intersection'](_0x186575[_0xd36d('0x2e')],qs['fields'](_0x2e5a5f['query']['fields']));_0x268eff[_0xd36d('0x35')]=_0x268eff[_0xd36d('0x35')][_0xd36d('0x44')]?_0x268eff[_0xd36d('0x35')]:_0x186575[_0xd36d('0x2e')];if(_0x2e5a5f[_0xd36d('0x31')][_0xd36d('0x3e')]){_0x268eff[_0xd36d('0x3f')]=[{'all':!![]}];}_0x268eff=_[_0xd36d('0x45')]({},_0x268eff,_0x2e5a5f['options']);return db[_0xd36d('0x29')][_0xd36d('0x46')](_0x268eff)[_0xd36d('0x21')](handleEntityNotFound(_0xbbb88d,null))['then'](respondWithResult(_0xbbb88d,null))['catch'](handleError(_0xbbb88d,null));};exports['create']=function(_0x342e66,_0x203ddf){return db['JscriptyAnswerReport']['create'](_0x342e66[_0xd36d('0x47')],{})[_0xd36d('0x21')](respondWithResult(_0x203ddf,0xc9))[_0xd36d('0x41')](handleError(_0x203ddf,null));};exports['update']=function(_0x567754,_0x3fd32d){if(_0x567754[_0xd36d('0x47')]['id']){delete _0x567754[_0xd36d('0x47')]['id'];}return db['JscriptyAnswerReport'][_0xd36d('0x46')]({'where':{'id':_0x567754[_0xd36d('0x43')]['id']}})[_0xd36d('0x21')](handleEntityNotFound(_0x3fd32d,null))[_0xd36d('0x21')](saveUpdates(_0x567754[_0xd36d('0x47')],null))['then'](respondWithResult(_0x3fd32d,null))['catch'](handleError(_0x3fd32d,null));};exports[_0xd36d('0x22')]=function(_0x5cf418,_0x1e7466){return db[_0xd36d('0x29')]['find']({'where':{'id':_0x5cf418[_0xd36d('0x43')]['id']}})[_0xd36d('0x21')](handleEntityNotFound(_0x1e7466,null))[_0xd36d('0x21')](removeEntity(_0x1e7466,null))['catch'](handleError(_0x1e7466,null));};exports[_0xd36d('0x48')]=function(_0x3b76c2,_0x3ff594){return db['JscriptyAnswerReport'][_0xd36d('0x48')]()[_0xd36d('0x21')](respondWithResult(_0x3ff594,null))['catch'](handleError(_0x3ff594,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index e05786f..ba01440 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 _0x99c8=['rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x99c8,0x1a6));var _0x899c=function(_0x402d07,_0x1e1755){_0x402d07=_0x402d07-0x0;var _0x38f465=_0x99c8[_0x402d07];return _0x38f465;};'use strict';var _=require(_0x899c('0x0'));var util=require(_0x899c('0x1'));var logger=require(_0x899c('0x2'))(_0x899c('0x3'));var moment=require(_0x899c('0x4'));var BPromise=require('bluebird');var rp=require(_0x899c('0x5'));var fs=require('fs');var path=require(_0x899c('0x6'));var rimraf=require(_0x899c('0x7'));var config=require(_0x899c('0x8'));var attributes=require(_0x899c('0x9'));module[_0x899c('0xa')]=function(_0x3439bf,_0x4537b0){return _0x3439bf[_0x899c('0xb')](_0x899c('0xc'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf414=['exports','report_jscripty_answers','lodash','../../config/logger','moment','bluebird','rimraf','./jscriptyAnswerReport.attributes'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xf414,0x10a));var _0x4f41=function(_0x1d5ba8,_0x412a52){_0x1d5ba8=_0x1d5ba8-0x0;var _0x1022a2=_0xf414[_0x1d5ba8];return _0x1022a2;};'use strict';var _=require(_0x4f41('0x0'));var util=require('util');var logger=require(_0x4f41('0x1'))('api');var moment=require(_0x4f41('0x2'));var BPromise=require(_0x4f41('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4f41('0x4'));var config=require('../../config/environment');var attributes=require(_0x4f41('0x5'));module[_0x4f41('0x6')]=function(_0x570e12,_0x1d1c01){return _0x570e12['define']('JscriptyAnswerReport',attributes,{'tableName':_0x4f41('0x7'),'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 9999b7e..bae80b4 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 _0x3ea5=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','JscriptyAnswerReport,\x20%s,\x20%s','message','info','result','lodash','bluebird','randomstring'];(function(_0xa60623,_0x2d4e4f){var _0x4a6487=function(_0xba6cbe){while(--_0xba6cbe){_0xa60623['push'](_0xa60623['shift']());}};_0x4a6487(++_0x2d4e4f);}(_0x3ea5,0x13f));var _0x53ea=function(_0x5ef898,_0x31ad18){_0x5ef898=_0x5ef898-0x0;var _0x54c053=_0x3ea5[_0x5ef898];return _0x54c053;};'use strict';var _=require(_0x53ea('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x53ea('0x1'));var rs=require(_0x53ea('0x2'));var fs=require('fs');var Redis=require(_0x53ea('0x3'));var db=require(_0x53ea('0x4'))['db'];var utils=require(_0x53ea('0x5'));var logger=require(_0x53ea('0x6'))(_0x53ea('0x7'));var config=require(_0x53ea('0x8'));var jayson=require(_0x53ea('0x9'));var client=jayson[_0x53ea('0xa')][_0x53ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52bde7,_0xf8c834,_0x2bbf59){return new BPromise(function(_0x1e026a,_0x40b623){return client[_0x53ea('0xc')](_0x52bde7,_0x2bbf59)[_0x53ea('0xd')](function(_0x48a599){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0xf8c834,'request\x20sent');logger[_0x53ea('0xe')](_0x53ea('0xf'),_0xf8c834,_0x53ea('0x10'),JSON[_0x53ea('0x11')](_0x48a599));if(_0x48a599[_0x53ea('0x12')]){if(_0x48a599['error']['code']===0x1f4){logger[_0x53ea('0x12')](_0x53ea('0x13'),_0xf8c834,_0x48a599[_0x53ea('0x12')]['message']);return _0x40b623(_0x48a599[_0x53ea('0x12')][_0x53ea('0x14')]);}logger[_0x53ea('0x12')](_0x53ea('0x13'),_0xf8c834,_0x48a599[_0x53ea('0x12')][_0x53ea('0x14')]);return _0x1e026a(_0x48a599[_0x53ea('0x12')]['message']);}else{logger[_0x53ea('0x15')](_0x53ea('0x13'),_0xf8c834,_0x53ea('0x10'));_0x1e026a(_0x48a599[_0x53ea('0x16')][_0x53ea('0x14')]);}})['catch'](function(_0x410683){logger['error'](_0x53ea('0x13'),_0xf8c834,_0x410683);_0x40b623(_0x410683);});});} \ No newline at end of file +var _0x741c=['lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x741c,0x150));var _0xc741=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x741c[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xc741('0x0'));var util=require('util');var moment=require(_0xc741('0x1'));var BPromise=require(_0xc741('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc741('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc741('0x4'));var logger=require(_0xc741('0x5'))(_0xc741('0x6'));var config=require('../../config/environment');var jayson=require(_0xc741('0x7'));var client=jayson[_0xc741('0x8')][_0xc741('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x472e56,_0x1a2dd1,_0x1984c6){return new BPromise(function(_0x27599a,_0x90928c){return client[_0xc741('0xa')](_0x472e56,_0x1984c6)[_0xc741('0xb')](function(_0x123095){logger[_0xc741('0xc')](_0xc741('0xd'),_0x1a2dd1,_0xc741('0xe'));logger[_0xc741('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x1a2dd1,_0xc741('0xe'),JSON[_0xc741('0x10')](_0x123095));if(_0x123095[_0xc741('0x11')]){if(_0x123095[_0xc741('0x11')]['code']===0x1f4){logger[_0xc741('0x11')](_0xc741('0xd'),_0x1a2dd1,_0x123095['error'][_0xc741('0x12')]);return _0x90928c(_0x123095[_0xc741('0x11')][_0xc741('0x12')]);}logger[_0xc741('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1a2dd1,_0x123095[_0xc741('0x11')][_0xc741('0x12')]);return _0x27599a(_0x123095[_0xc741('0x11')]['message']);}else{logger['info'](_0xc741('0xd'),_0x1a2dd1,'request\x20sent');_0x27599a(_0x123095[_0xc741('0x13')]['message']);}})[_0xc741('0x14')](function(_0x46f1e1){logger['error'](_0xc741('0xd'),_0x1a2dd1,_0x46f1e1);_0x90928c(_0x46f1e1);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 3f08c5f..f9535c8 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 _0xfaf7=['/:id','update','delete','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','getSessions','getAnswers','/:id/summary','30s','post','create','/:id/clone','clone','put'];(function(_0x443494,_0x51fc7e){var _0x4a6794=function(_0x15197a){while(--_0x15197a){_0x443494['push'](_0x443494['shift']());}};_0x4a6794(++_0x51fc7e);}(_0xfaf7,0x1b9));var _0x7faf=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0xfaf7[_0x4c445a];return _0x2f611c;};'use strict';var multer=require('multer');var util=require(_0x7faf('0x0'));var path=require(_0x7faf('0x1'));var timeout=require('connect-timeout');var express=require(_0x7faf('0x2'));var router=express[_0x7faf('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7faf('0x4'));var config=require(_0x7faf('0x5'));var controller=require(_0x7faf('0x6'));router[_0x7faf('0x7')]('/',auth[_0x7faf('0x8')](),controller[_0x7faf('0x9')]);router[_0x7faf('0x7')]('/:id',auth[_0x7faf('0x8')](),controller['show']);router[_0x7faf('0x7')]('/:id/sessions',auth[_0x7faf('0x8')](),controller[_0x7faf('0xa')]);router[_0x7faf('0x7')]('/:id/answers',auth[_0x7faf('0x8')](),controller[_0x7faf('0xb')]);router[_0x7faf('0x7')](_0x7faf('0xc'),auth[_0x7faf('0x8')](),timeout(_0x7faf('0xd')),controller['getSummary']);router[_0x7faf('0xe')]('/',auth[_0x7faf('0x8')](),controller[_0x7faf('0xf')]);router['post'](_0x7faf('0x10'),auth[_0x7faf('0x8')](),controller[_0x7faf('0x11')]);router[_0x7faf('0x12')](_0x7faf('0x13'),auth[_0x7faf('0x8')](),controller[_0x7faf('0x14')]);router[_0x7faf('0x15')](_0x7faf('0x13'),auth['isAuthenticated'](),controller['destroy']);module[_0x7faf('0x16')]=router; \ No newline at end of file +var _0x7670=['../../config/environment','get','isAuthenticated','/:id','show','getAnswers','/:id/summary','30s','post','create','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x1abe41,_0x567551){var _0x1eb3ad=function(_0x6d8b51){while(--_0x6d8b51){_0x1abe41['push'](_0x1abe41['shift']());}};_0x1eb3ad(++_0x567551);}(_0x7670,0x162));var _0x0767=function(_0x48196b,_0x10296c){_0x48196b=_0x48196b-0x0;var _0xd20d4b=_0x7670[_0x48196b];return _0xd20d4b;};'use strict';var multer=require(_0x0767('0x0'));var util=require(_0x0767('0x1'));var path=require(_0x0767('0x2'));var timeout=require('connect-timeout');var express=require(_0x0767('0x3'));var router=express[_0x0767('0x4')]();var auth=require(_0x0767('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0767('0x6'));var controller=require('./jscriptyProject.controller');router[_0x0767('0x7')]('/',auth[_0x0767('0x8')](),controller['index']);router[_0x0767('0x7')](_0x0767('0x9'),auth[_0x0767('0x8')](),controller[_0x0767('0xa')]);router[_0x0767('0x7')]('/:id/sessions',auth['isAuthenticated'](),controller['getSessions']);router[_0x0767('0x7')]('/:id/answers',auth[_0x0767('0x8')](),controller[_0x0767('0xb')]);router[_0x0767('0x7')](_0x0767('0xc'),auth[_0x0767('0x8')](),timeout(_0x0767('0xd')),controller['getSummary']);router[_0x0767('0xe')]('/',auth['isAuthenticated'](),controller[_0x0767('0xf')]);router['post']('/:id/clone',auth[_0x0767('0x8')](),controller['clone']);router['put']('/:id',auth[_0x0767('0x8')](),controller[_0x0767('0x10')]);router[_0x0767('0x11')](_0x0767('0x9'),auth[_0x0767('0x8')](),controller[_0x0767('0x12')]);module[_0x0767('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 153b471..b7ce45d 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 _0x770e=['setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long','stringify','isString'];(function(_0xdefbc3,_0x1ea49a){var _0x367798=function(_0x594678){while(--_0x594678){_0xdefbc3['push'](_0xdefbc3['shift']());}};_0x367798(++_0x1ea49a);}(_0x770e,0x17d));var _0xe770=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x770e[_0x2fc012];return _0x2891f9;};'use strict';var Sequelize=require(_0xe770('0x0'));var _=require(_0xe770('0x1'));var util=require(_0xe770('0x2'));module[_0xe770('0x3')]={'name':{'type':Sequelize[_0xe770('0x4')],'unique':_0xe770('0x5')},'description':{'type':Sequelize[_0xe770('0x4')]},'formData':{'type':Sequelize[_0xe770('0x6')](_0xe770('0x7')),'set':function(_0x56f5f6){if(_['isObjectLike'](_0x56f5f6)){this['setDataValue']('formData',JSON[_0xe770('0x8')](_0x56f5f6));}else if(_[_0xe770('0x9')](_0x56f5f6)){this['setDataValue']('formData',_0x56f5f6);}else{this[_0xe770('0xa')](_0xe770('0xb'),util[_0xe770('0xc')](_0xe770('0xd'),this[_0xe770('0xe')]('name')||'',this[_0xe770('0xe')](_0xe770('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xe770('0x10')],'defaultValue':![]}}; \ No newline at end of file +var _0x8a9e=['sequelize','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','stringify','isString','formData','format','getDataValue','description','BOOLEAN'];(function(_0x19bb10,_0x1fac77){var _0x18402a=function(_0x9e5c42){while(--_0x9e5c42){_0x19bb10['push'](_0x19bb10['shift']());}};_0x18402a(++_0x1fac77);}(_0x8a9e,0xcc));var _0xe8a9=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x8a9e[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require(_0xe8a9('0x0'));var _=require(_0xe8a9('0x1'));var util=require(_0xe8a9('0x2'));module[_0xe8a9('0x3')]={'name':{'type':Sequelize[_0xe8a9('0x4')],'unique':_0xe8a9('0x5')},'description':{'type':Sequelize[_0xe8a9('0x4')]},'formData':{'type':Sequelize[_0xe8a9('0x6')](_0xe8a9('0x7')),'set':function(_0x2a836f){if(_[_0xe8a9('0x8')](_0x2a836f)){this[_0xe8a9('0x9')]('formData',JSON[_0xe8a9('0xa')](_0x2a836f));}else if(_[_0xe8a9('0xb')](_0x2a836f)){this[_0xe8a9('0x9')](_0xe8a9('0xc'),_0x2a836f);}else{this[_0xe8a9('0x9')](_0xe8a9('0xc'),util[_0xe8a9('0xd')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xe8a9('0xe')](_0xe8a9('0x5'))||'',this[_0xe8a9('0xe')](_0xe8a9('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xe8a9('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 588cb56..040a9b0 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 _0x0c30=['key','model','map','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','JscriptyProject','include','findAll','rows','catch','show','params','keys','rawAttributes','intersection','includeAll','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','error','destroy','getSessions','JscriptySessionReport','ProjectId','getAnswers','findOne','JscriptyAnswerReport','number','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','answer','push','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','get','Projects','UserProfileResource','stack','name','send','index','fieldName','type'];(function(_0x46dc09,_0xdf9dba){var _0x551ec7=function(_0x377c5b){while(--_0x377c5b){_0x46dc09['push'](_0x46dc09['shift']());}};_0x551ec7(++_0xdf9dba);}(_0x0c30,0x137));var _0x00c3=function(_0xa3c06b,_0x490f99){_0xa3c06b=_0xa3c06b-0x0;var _0x33aa1d=_0x0c30[_0xa3c06b];return _0x33aa1d;};'use strict';var pdf=require(_0x00c3('0x0'));var emlformat=require(_0x00c3('0x1'));var rimraf=require(_0x00c3('0x2'));var zipdir=require(_0x00c3('0x3'));var jsonpatch=require(_0x00c3('0x4'));var rp=require(_0x00c3('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x00c3('0x6'));var util=require(_0x00c3('0x7'));var path=require(_0x00c3('0x8'));var sox=require(_0x00c3('0x9'));var csv=require('to-csv');var ejs=require(_0x00c3('0xa'));var fs=require('fs');var _=require(_0x00c3('0xb'));var squel=require(_0x00c3('0xc'));var crypto=require(_0x00c3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x00c3('0xe'));var toCsv=require(_0x00c3('0xf'));var querystring=require(_0x00c3('0x10'));var Papa=require('papaparse');var Redis=require(_0x00c3('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x00c3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x00c3('0x13'));var utils=require('../../config/utils');var config=require(_0x00c3('0x14'));var db=require(_0x00c3('0x15'))['db'];function respondWithStatusCode(_0x459286,_0x4e18fe){_0x4e18fe=_0x4e18fe||0xcc;return function(_0x4898e8){if(_0x4898e8){return _0x459286[_0x00c3('0x16')](_0x4e18fe);}return _0x459286[_0x00c3('0x17')](_0x4e18fe)[_0x00c3('0x18')]();};}function respondWithResult(_0x28308e,_0x2b0181){_0x2b0181=_0x2b0181||0xc8;return function(_0x4c5c00){if(_0x4c5c00){return _0x28308e[_0x00c3('0x17')](_0x2b0181)[_0x00c3('0x19')](_0x4c5c00);}};}function respondWithFilteredResult(_0x512aad,_0x14edd7){return function(_0x51581f){if(_0x51581f){var _0x2956bd=_0x51581f[_0x00c3('0x1a')],_0x411a63=_0x14edd7[_0x00c3('0x1b')],_0x5dd855=_0x14edd7[_0x00c3('0x1b')]+_0x14edd7['limit'],_0x3e1851;if(_0x5dd855>=_0x2956bd){_0x5dd855=_0x2956bd;_0x3e1851=0xc8;}else{_0x3e1851=0xce;}_0x512aad['status'](_0x3e1851);return _0x512aad[_0x00c3('0x1c')]('Content-Range',_0x411a63+'-'+_0x5dd855+'/'+_0x2956bd)['json'](_0x51581f);}return null;};}function patchUpdates(_0x556517){return function(_0x384c0e){try{jsonpatch[_0x00c3('0x1d')](_0x384c0e,_0x556517,!![]);}catch(_0x264e77){return BPromise[_0x00c3('0x1e')](_0x264e77);}return _0x384c0e[_0x00c3('0x1f')]();};}function saveUpdates(_0x11578a,_0x18b364){return function(_0x305257){if(_0x305257){return _0x305257[_0x00c3('0x20')](_0x11578a)[_0x00c3('0x21')](function(_0x57ee5c){return _0x57ee5c;});}return null;};}function removeEntity(_0x24d091,_0x431718){return function(_0x388c85){if(_0x388c85){return _0x388c85['destroy']()[_0x00c3('0x21')](function(){var _0x20589f=_0x388c85[_0x00c3('0x22')]({'plain':!![]});var _0x4ec6ec=_0x00c3('0x23');return db[_0x00c3('0x24')]['destroy']({'where':{'type':_0x4ec6ec,'resourceId':_0x20589f['id']}})[_0x00c3('0x21')](function(){return _0x388c85;});})[_0x00c3('0x21')](function(){_0x24d091[_0x00c3('0x17')](0xcc)[_0x00c3('0x18')]();});}};}function handleEntityNotFound(_0x257711,_0x236baa){return function(_0x59776b){if(!_0x59776b){_0x257711[_0x00c3('0x16')](0x194);}return _0x59776b;};}function handleError(_0x38210c,_0x43249e){_0x43249e=_0x43249e||0x1f4;return function(_0x4e0f46){logger['error'](_0x4e0f46[_0x00c3('0x25')]);if(_0x4e0f46[_0x00c3('0x26')]){delete _0x4e0f46[_0x00c3('0x26')];}_0x38210c['status'](_0x43249e)[_0x00c3('0x27')](_0x4e0f46);};}exports[_0x00c3('0x28')]=function(_0x59cc89,_0x2ef40e){var _0x4d555d={},_0x28892a={},_0xe81345={'count':0x0,'rows':[]};var _0x352fb6=_['map'](db['JscriptyProject']['rawAttributes'],function(_0x47237f){return{'name':_0x47237f[_0x00c3('0x29')],'type':_0x47237f[_0x00c3('0x2a')][_0x00c3('0x2b')]};});_0x28892a[_0x00c3('0x2c')]=_[_0x00c3('0x2d')](_0x352fb6,_0x00c3('0x26'));_0x28892a[_0x00c3('0x2e')]=_['keys'](_0x59cc89[_0x00c3('0x2e')]);_0x28892a['filters']=_['intersection'](_0x28892a[_0x00c3('0x2c')],_0x28892a[_0x00c3('0x2e')]);_0x4d555d[_0x00c3('0x2f')]=_['intersection'](_0x28892a[_0x00c3('0x2c')],qs['fields'](_0x59cc89[_0x00c3('0x2e')][_0x00c3('0x30')]));_0x4d555d[_0x00c3('0x2f')]=_0x4d555d[_0x00c3('0x2f')][_0x00c3('0x31')]?_0x4d555d[_0x00c3('0x2f')]:_0x28892a[_0x00c3('0x2c')];if(!_0x59cc89[_0x00c3('0x2e')][_0x00c3('0x32')](_0x00c3('0x33'))){_0x4d555d[_0x00c3('0x34')]=qs[_0x00c3('0x34')](_0x59cc89[_0x00c3('0x2e')][_0x00c3('0x34')]);_0x4d555d[_0x00c3('0x1b')]=qs[_0x00c3('0x1b')](_0x59cc89[_0x00c3('0x2e')][_0x00c3('0x1b')]);}_0x4d555d[_0x00c3('0x35')]=qs['sort'](_0x59cc89[_0x00c3('0x2e')][_0x00c3('0x36')]);_0x4d555d[_0x00c3('0x37')]=qs['filters'](_[_0x00c3('0x38')](_0x59cc89['query'],_0x28892a[_0x00c3('0x39')]),_0x352fb6);if(_0x59cc89[_0x00c3('0x2e')][_0x00c3('0x3a')]){_0x4d555d['where']=_[_0x00c3('0x3b')](_0x4d555d['where'],{'$or':_[_0x00c3('0x2d')](_0x352fb6,function(_0x5e95cc){if(_0x5e95cc[_0x00c3('0x2a')]!==_0x00c3('0x3c')){var _0x2a5435={};_0x2a5435[_0x5e95cc[_0x00c3('0x26')]]={'$like':'%'+_0x59cc89[_0x00c3('0x2e')][_0x00c3('0x3a')]+'%'};return _0x2a5435;}})});}_0x4d555d=_[_0x00c3('0x3b')]({},_0x4d555d,_0x59cc89[_0x00c3('0x3d')]);var _0xb663c4={'where':_0x4d555d[_0x00c3('0x37')]};return db[_0x00c3('0x3e')]['count'](_0xb663c4)[_0x00c3('0x21')](function(_0x1fe03f){_0xe81345[_0x00c3('0x1a')]=_0x1fe03f;if(_0x59cc89[_0x00c3('0x2e')]['includeAll']){_0x4d555d[_0x00c3('0x3f')]=[{'all':!![]}];}return db[_0x00c3('0x3e')][_0x00c3('0x40')](_0x4d555d);})['then'](function(_0x4a7765){_0xe81345[_0x00c3('0x41')]=_0x4a7765;return _0xe81345;})['then'](respondWithFilteredResult(_0x2ef40e,_0x4d555d))[_0x00c3('0x42')](handleError(_0x2ef40e,null));};exports[_0x00c3('0x43')]=function(_0x127122,_0x24edf3){var _0x2d6a70={'raw':![],'where':{'id':_0x127122[_0x00c3('0x44')]['id']}},_0x3238af={};_0x3238af[_0x00c3('0x2c')]=_[_0x00c3('0x45')](db[_0x00c3('0x3e')][_0x00c3('0x46')]);_0x3238af[_0x00c3('0x2e')]=_[_0x00c3('0x45')](_0x127122[_0x00c3('0x2e')]);_0x3238af['filters']=_[_0x00c3('0x47')](_0x3238af['model'],_0x3238af[_0x00c3('0x2e')]);_0x2d6a70['attributes']=_['intersection'](_0x3238af[_0x00c3('0x2c')],qs['fields'](_0x127122['query']['fields']));_0x2d6a70[_0x00c3('0x2f')]=_0x2d6a70[_0x00c3('0x2f')]['length']?_0x2d6a70[_0x00c3('0x2f')]:_0x3238af[_0x00c3('0x2c')];if(_0x127122[_0x00c3('0x2e')][_0x00c3('0x48')]){_0x2d6a70[_0x00c3('0x3f')]=[{'all':!![]}];}_0x2d6a70=_[_0x00c3('0x3b')]({},_0x2d6a70,_0x127122[_0x00c3('0x3d')]);return db[_0x00c3('0x3e')][_0x00c3('0x49')](_0x2d6a70)[_0x00c3('0x21')](handleEntityNotFound(_0x24edf3,null))[_0x00c3('0x21')](respondWithResult(_0x24edf3,null))[_0x00c3('0x42')](handleError(_0x24edf3,null));};exports['create']=function(_0x37f4ad,_0x2ff6ea){return db[_0x00c3('0x3e')][_0x00c3('0x4a')](_0x37f4ad[_0x00c3('0x4b')],{})['then'](function(_0x151c7f){var _0x4f2624=_0x37f4ad['user']['get']({'plain':!![]});if(!_0x4f2624)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f2624['role']===_0x00c3('0x4c')){var _0x37e699=_0x151c7f[_0x00c3('0x22')]({'plain':!![]});var _0x120ca7='Projects';return db[_0x00c3('0x4d')]['find']({'where':{'name':_0x120ca7,'userProfileId':_0x4f2624[_0x00c3('0x4e')]},'raw':!![]})[_0x00c3('0x21')](function(_0x502174){if(_0x502174&&_0x502174[_0x00c3('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x37e699['name'],'resourceId':_0x37e699['id'],'type':_0x502174[_0x00c3('0x26')],'sectionId':_0x502174['id']},{})[_0x00c3('0x21')](function(){return _0x151c7f;});}else{return _0x151c7f;}})[_0x00c3('0x42')](function(_0x497590){logger['error'](_0x00c3('0x50'),_0x497590);throw _0x497590;});}return _0x151c7f;})['then'](respondWithResult(_0x2ff6ea,0xc9))[_0x00c3('0x42')](handleError(_0x2ff6ea,null));};exports[_0x00c3('0x51')]=function(_0x4beff3,_0x186be6){var _0x40faa5={'where':{'id':_0x4beff3[_0x00c3('0x44')]['id']}},_0x5a0dc3={};_0x5a0dc3[_0x00c3('0x2c')]=_['keys'](db[_0x00c3('0x3e')][_0x00c3('0x46')]);_0x40faa5[_0x00c3('0x2f')]=_['intersection'](_0x5a0dc3[_0x00c3('0x2c')],qs[_0x00c3('0x30')](_0x4beff3[_0x00c3('0x2e')][_0x00c3('0x30')]));_0x40faa5[_0x00c3('0x2f')]=_0x40faa5[_0x00c3('0x2f')][_0x00c3('0x31')]?_0x40faa5[_0x00c3('0x2f')]:_0x5a0dc3['model'];if(_0x4beff3[_0x00c3('0x2e')][_0x00c3('0x48')]){_0x40faa5[_0x00c3('0x3f')]=[{'all':!![]}];}_0x40faa5=_[_0x00c3('0x3b')]({},_0x40faa5,_0x4beff3[_0x00c3('0x3d')]);return db[_0x00c3('0x3e')][_0x00c3('0x49')](_0x40faa5)[_0x00c3('0x21')](handleEntityNotFound(_0x186be6,null))['then'](function(_0x34d4c0){if(_0x34d4c0){var _0x5a9e77=_0x34d4c0[_0x00c3('0x22')]({'plain':!![]});_0x5a9e77=qs[_0x00c3('0x52')](_0x5a9e77,['id',_0x00c3('0x53'),_0x00c3('0x54')]);_0x4beff3[_0x00c3('0x4b')]=_[_0x00c3('0x52')](_0x4beff3[_0x00c3('0x4b')],['id',_0x00c3('0x53'),_0x00c3('0x54')]);return db['JscriptyProject'][_0x00c3('0x4a')](_[_0x00c3('0x3b')](_0x5a9e77,_0x4beff3[_0x00c3('0x4b')]),{'include':_0x4beff3[_0x00c3('0x2e')]['includeAll']?[{'all':!![]}]:undefined})[_0x00c3('0x21')](function(_0x260fd5){var _0x4adde9=_0x4beff3['user'][_0x00c3('0x22')]({'plain':!![]});if(!_0x4adde9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4adde9[_0x00c3('0x55')]===_0x00c3('0x4c')){var _0x3f0eb5=_0x260fd5[_0x00c3('0x22')]({'plain':!![]});var _0x10a579=_0x00c3('0x23');return db['UserProfileSection']['find']({'where':{'name':_0x10a579,'userProfileId':_0x4adde9[_0x00c3('0x4e')]},'raw':!![]})[_0x00c3('0x21')](function(_0x1fbe11){if(_0x1fbe11&&_0x1fbe11[_0x00c3('0x4f')]===0x0){return db[_0x00c3('0x24')]['create']({'name':_0x3f0eb5[_0x00c3('0x26')],'resourceId':_0x3f0eb5['id'],'type':_0x1fbe11['name'],'sectionId':_0x1fbe11['id']},{})[_0x00c3('0x21')](function(){return _0x260fd5;});}else{return _0x260fd5;}})['catch'](function(_0xe95bcc){logger[_0x00c3('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe95bcc);throw _0xe95bcc;});}return _0x260fd5;});}})[_0x00c3('0x21')](respondWithResult(_0x186be6,0xc9))[_0x00c3('0x42')](handleError(_0x186be6,null));};exports[_0x00c3('0x20')]=function(_0x2b82ed,_0x371faf){if(_0x2b82ed[_0x00c3('0x4b')]['id']){delete _0x2b82ed[_0x00c3('0x4b')]['id'];}return db[_0x00c3('0x3e')][_0x00c3('0x49')]({'where':{'id':_0x2b82ed[_0x00c3('0x44')]['id']}})[_0x00c3('0x21')](handleEntityNotFound(_0x371faf,null))[_0x00c3('0x21')](saveUpdates(_0x2b82ed['body'],null))['then'](respondWithResult(_0x371faf,null))[_0x00c3('0x42')](handleError(_0x371faf,null));};exports[_0x00c3('0x57')]=function(_0x3543c5,_0x1c4a43){return db[_0x00c3('0x3e')][_0x00c3('0x49')]({'where':{'id':_0x3543c5[_0x00c3('0x44')]['id']}})[_0x00c3('0x21')](handleEntityNotFound(_0x1c4a43,null))[_0x00c3('0x21')](removeEntity(_0x1c4a43,null))[_0x00c3('0x42')](handleError(_0x1c4a43,null));};exports[_0x00c3('0x58')]=function(_0x579404,_0x4de706,_0x488251){var _0x5dc393={'raw':!![],'where':{}};var _0xb203ab={};var _0xa34378={'count':0x0,'rows':[]};return db[_0x00c3('0x3e')]['findOne']({'where':{'id':_0x579404[_0x00c3('0x44')]['id']}})['then'](handleEntityNotFound(_0x4de706,null))[_0x00c3('0x21')](function(_0x5c84ca){if(_0x5c84ca){_0xb203ab[_0x00c3('0x2c')]=_[_0x00c3('0x45')](db[_0x00c3('0x59')][_0x00c3('0x46')]);_0xb203ab[_0x00c3('0x2e')]=_[_0x00c3('0x45')](_0x579404['query']);_0xb203ab[_0x00c3('0x39')]=_[_0x00c3('0x47')](_0xb203ab[_0x00c3('0x2c')],_0xb203ab[_0x00c3('0x2e')]);_0x5dc393[_0x00c3('0x2f')]=_['intersection'](_0xb203ab[_0x00c3('0x2c')],qs[_0x00c3('0x30')](_0x579404[_0x00c3('0x2e')]['fields']));_0x5dc393[_0x00c3('0x2f')]=_0x5dc393[_0x00c3('0x2f')][_0x00c3('0x31')]?_0x5dc393[_0x00c3('0x2f')]:_0xb203ab[_0x00c3('0x2c')];if(!_0x579404['query']['hasOwnProperty'](_0x00c3('0x33'))){_0x5dc393['limit']=qs[_0x00c3('0x34')](_0x579404[_0x00c3('0x2e')]['limit']);_0x5dc393[_0x00c3('0x1b')]=qs[_0x00c3('0x1b')](_0x579404[_0x00c3('0x2e')][_0x00c3('0x1b')]);}_0x5dc393[_0x00c3('0x35')]=qs[_0x00c3('0x36')](_0x579404[_0x00c3('0x2e')]['sort']);_0x5dc393[_0x00c3('0x37')]=qs[_0x00c3('0x39')](_[_0x00c3('0x38')](_0x579404[_0x00c3('0x2e')],_0xb203ab[_0x00c3('0x39')]));_0x5dc393['where'][_0x00c3('0x5a')]=_0x5c84ca['id'];if(_0x579404[_0x00c3('0x2e')][_0x00c3('0x3a')]){_0x5dc393[_0x00c3('0x37')]=_[_0x00c3('0x3b')](_0x5dc393[_0x00c3('0x37')],{'$or':_[_0x00c3('0x2d')](_0x5dc393['attributes'],function(_0x7cc09b){var _0x521062={};_0x521062[_0x7cc09b]={'$like':'%'+_0x579404[_0x00c3('0x2e')][_0x00c3('0x3a')]+'%'};return _0x521062;})});}_0x5dc393=_['merge']({},_0x5dc393,_0x579404[_0x00c3('0x3d')]);return db[_0x00c3('0x59')][_0x00c3('0x1a')]({'where':_0x5dc393[_0x00c3('0x37')]})['then'](function(_0x53cf54){_0xa34378[_0x00c3('0x1a')]=_0x53cf54;if(_0x579404[_0x00c3('0x2e')][_0x00c3('0x48')]){_0x5dc393[_0x00c3('0x3f')]=[{'all':!![]}];}return db[_0x00c3('0x59')][_0x00c3('0x40')](_0x5dc393);})[_0x00c3('0x21')](function(_0x24bcc7){_0xa34378[_0x00c3('0x41')]=_0x24bcc7;return _0xa34378;});}})[_0x00c3('0x21')](respondWithFilteredResult(_0x4de706,_0x5dc393))[_0x00c3('0x42')](handleError(_0x4de706,null));};exports[_0x00c3('0x5b')]=function(_0x3940bd,_0x145fc3,_0x5c4e86){var _0x5d2902={'raw':!![],'where':{}};var _0x32340c={};var _0x11c7f7={'count':0x0,'rows':[]};return db[_0x00c3('0x3e')][_0x00c3('0x5c')]({'where':{'id':_0x3940bd[_0x00c3('0x44')]['id']}})[_0x00c3('0x21')](handleEntityNotFound(_0x145fc3,null))[_0x00c3('0x21')](function(_0x514e61){if(_0x514e61){_0x32340c[_0x00c3('0x2c')]=_[_0x00c3('0x45')](db[_0x00c3('0x5d')]['rawAttributes']);_0x32340c[_0x00c3('0x2e')]=_[_0x00c3('0x45')](_0x3940bd[_0x00c3('0x2e')]);_0x32340c[_0x00c3('0x39')]=_[_0x00c3('0x47')](_0x32340c[_0x00c3('0x2c')],_0x32340c[_0x00c3('0x2e')]);_0x5d2902['attributes']=_[_0x00c3('0x47')](_0x32340c['model'],qs[_0x00c3('0x30')](_0x3940bd[_0x00c3('0x2e')]['fields']));_0x5d2902[_0x00c3('0x2f')]=_0x5d2902[_0x00c3('0x2f')][_0x00c3('0x31')]?_0x5d2902['attributes']:_0x32340c[_0x00c3('0x2c')];if(!_0x3940bd['query'][_0x00c3('0x32')](_0x00c3('0x33'))){_0x5d2902['limit']=qs[_0x00c3('0x34')](_0x3940bd[_0x00c3('0x2e')]['limit']);_0x5d2902[_0x00c3('0x1b')]=qs[_0x00c3('0x1b')](_0x3940bd[_0x00c3('0x2e')]['offset']);}_0x5d2902['order']=qs[_0x00c3('0x36')](_0x3940bd['query'][_0x00c3('0x36')]);_0x5d2902['where']=qs[_0x00c3('0x39')](_[_0x00c3('0x38')](_0x3940bd[_0x00c3('0x2e')],_0x32340c[_0x00c3('0x39')]));_0x5d2902['where']['ProjectId']=_0x514e61['id'];if(_0x3940bd[_0x00c3('0x2e')]['filter']){_0x5d2902[_0x00c3('0x37')]=_[_0x00c3('0x3b')](_0x5d2902['where'],{'$or':_[_0x00c3('0x2d')](_0x5d2902['attributes'],function(_0x21e221){var _0x2319e9={};_0x2319e9[_0x21e221]={'$like':'%'+_0x3940bd[_0x00c3('0x2e')]['filter']+'%'};return _0x2319e9;})});}_0x5d2902=_[_0x00c3('0x3b')]({},_0x5d2902,_0x3940bd[_0x00c3('0x3d')]);return db[_0x00c3('0x5d')]['count']({'where':_0x5d2902[_0x00c3('0x37')]})[_0x00c3('0x21')](function(_0x2b8694){_0x11c7f7['count']=_0x2b8694;if(_0x3940bd['query']['includeAll']){_0x5d2902[_0x00c3('0x3f')]=[{'all':!![]}];}return db[_0x00c3('0x5d')][_0x00c3('0x40')](_0x5d2902);})[_0x00c3('0x21')](function(_0x2700d8){_0x11c7f7['rows']=_0x2700d8;return _0x11c7f7;});}})[_0x00c3('0x21')](respondWithFilteredResult(_0x145fc3,_0x5d2902))[_0x00c3('0x42')](handleError(_0x145fc3,null));};function char(_0x1f211f){return _0x00c3('0x5e')===typeof _0x1f211f?String['fromCharCode'][_0x00c3('0x1d')](null,arguments):_0x1f211f;}function needsEncapsulation(_0x2c4367){return!!_0x2c4367&&(_0x2c4367[_0x00c3('0x5f')]()[_0x00c3('0x60')](char(0xd))>=0x0||_0x2c4367[_0x00c3('0x5f')]()[_0x00c3('0x60')](char(0xa))>=0x0||_0x2c4367[_0x00c3('0x5f')]()[_0x00c3('0x60')](char(0x2c))>=0x0||_0x2c4367[_0x00c3('0x5f')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x366bed){var _0xdb9280=char(0x22),_0xf42c19='\x5c'+char(0x22),_0x103732=_0x366bed[_0x00c3('0x5f')]()[_0x00c3('0x61')](new RegExp(_0xdb9280,'g'),_0xf42c19);return _0xdb9280+_0x103732+_0xdb9280;}exports[_0x00c3('0x62')]=function(_0x2cc10d,_0x3b5c92,_0x2f4fd2){var _0x3ef455,_0x5870d1;var _0x5e755c={'where':{'ProjectId':_0x2cc10d[_0x00c3('0x44')]['id']}};if(_0x2cc10d[_0x00c3('0x2e')][_0x00c3('0x63')]){_0x5e755c[_0x00c3('0x37')][_0x00c3('0x64')]=JSON[_0x00c3('0x65')](_0x2cc10d[_0x00c3('0x2e')]['startTime']);}return db['JscriptySessionReport'][_0x00c3('0x40')](_0x5e755c)['then'](handleEntityNotFound(_0x3b5c92,null))[_0x00c3('0x21')](function(_0x427a98){if(_0x427a98){_0x3ef455=_0x427a98;return db[_0x00c3('0x66')][_0x00c3('0x40')]({'where':{'SessionId':{'$in':_[_0x00c3('0x2d')](_0x3ef455,'id')},'ProjectId':_0x2cc10d[_0x00c3('0x44')]['id']},'order':_0x00c3('0x67')});}})[_0x00c3('0x21')](handleEntityNotFound(_0x3b5c92,null))[_0x00c3('0x21')](function(_0x28352f){if(_0x28352f){_0x5870d1=_0x28352f;var _0x171028={};for(var _0x5c54cb=0x0,_0xd0331f=_0x5870d1[_0x00c3('0x31')];_0x5c54cb<_0xd0331f;_0x5c54cb++){if(!_0x171028['hasOwnProperty'](_0x5870d1[_0x5c54cb][_0x00c3('0x68')])){_0x171028[_0x5870d1[_0x5c54cb]['questionId']]=needsEncapsulation(_0x5870d1[_0x5c54cb][_0x00c3('0x69')])?encapsulate(_0x5870d1[_0x5c54cb][_0x00c3('0x69')]):_0x5870d1[_0x5c54cb]['question'];}}var _0x3bc76e=[],_0x95a048={};for(var _0x2677d8=0x0,_0x3f616b=_0x3ef455[_0x00c3('0x31')];_0x2677d8<_0x3f616b;_0x2677d8++){_0x95a048={'ProjectId':_0x2cc10d[_0x00c3('0x44')]['id'],'SessionId':_0x3ef455[_0x2677d8]['id'],'StartTime':moment(_0x3ef455[_0x2677d8][_0x00c3('0x64')])['format'](_0x00c3('0x6a'))};for(var _0xb52368=0x0,_0x556b86=_0x5870d1[_0x00c3('0x31')];_0xb52368<_0x556b86;_0xb52368++){if(_0x5870d1[_0xb52368]['SessionId']==_0x3ef455[_0x2677d8]['id']&&_0x171028[_0x00c3('0x32')](_0x5870d1[_0xb52368]['questionId'])){_0x95a048[_0x171028[_0x5870d1[_0xb52368][_0x00c3('0x68')]]]=_0x5870d1[_0xb52368][_0x00c3('0x6b')];}}for(var _0x4b259c in _0x171028){if(!_0x95a048[_0x00c3('0x32')](_0x171028[_0x4b259c])){_0x95a048[_0x171028[_0x4b259c]]=null;}}_0x3bc76e[_0x00c3('0x6c')](_0x95a048);}return _0x3bc76e;}})[_0x00c3('0x21')](function(_0x6a36b2){if(!_['isEmpty'](_0x6a36b2)){var _0x79d2b5=toCsv(_0x6a36b2);var _0x36a93d=Date[_0x00c3('0x6d')]();fs[_0x00c3('0x6e')](util[_0x00c3('0x6f')](_0x00c3('0x70'),_0x2cc10d[_0x00c3('0x44')]['id'],_0x36a93d),_0x79d2b5);_0x3b5c92[_0x00c3('0x71')](_0x00c3('0x72'),_0x00c3('0x73')+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x2cc10d[_0x00c3('0x44')]['id'],_0x36a93d));_0x3b5c92['setHeader'](_0x00c3('0x74'),_0x00c3('0x75'));return _0x3b5c92['download'](util['format'](_0x00c3('0x70'),_0x2cc10d[_0x00c3('0x44')]['id'],_0x36a93d));}else{return _0x3b5c92[_0x00c3('0x16')](0xcc);}})[_0x00c3('0x42')](handleError(_0x3b5c92,null));}; \ No newline at end of file +var _0xc2e3=['key','map','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','count','includeAll','findAll','rows','show','rawAttributes','include','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','catch','getSessions','findOne','JscriptySessionReport','pick','ProjectId','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','starttime','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Content-type','/tmp/Jscripty_Project_%d_Summary_%s.csv','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Projects','UserProfileResource','end','error','stack','name','send','index','JscriptyProject','type'];(function(_0x5f5a3d,_0x1fe698){var _0x2bd5a1=function(_0x5aed6f){while(--_0x5aed6f){_0x5f5a3d['push'](_0x5f5a3d['shift']());}};_0x2bd5a1(++_0x1fe698);}(_0xc2e3,0x12e));var _0x3c2e=function(_0x4f366e,_0x2ba55a){_0x4f366e=_0x4f366e-0x0;var _0x12432b=_0xc2e3[_0x4f366e];return _0x12432b;};'use strict';var pdf=require(_0x3c2e('0x0'));var emlformat=require(_0x3c2e('0x1'));var rimraf=require(_0x3c2e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3c2e('0x3'));var rp=require('request-promise');var moment=require(_0x3c2e('0x4'));var BPromise=require(_0x3c2e('0x5'));var Mustache=require(_0x3c2e('0x6'));var util=require(_0x3c2e('0x7'));var path=require('path');var sox=require(_0x3c2e('0x8'));var csv=require(_0x3c2e('0x9'));var ejs=require(_0x3c2e('0xa'));var fs=require('fs');var _=require(_0x3c2e('0xb'));var squel=require(_0x3c2e('0xc'));var crypto=require('crypto');var jsforce=require(_0x3c2e('0xd'));var deskjs=require(_0x3c2e('0xe'));var toCsv=require(_0x3c2e('0x9'));var querystring=require(_0x3c2e('0xf'));var Papa=require(_0x3c2e('0x10'));var Redis=require(_0x3c2e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3c2e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c2e('0x13'));var logger=require(_0x3c2e('0x14'))(_0x3c2e('0x15'));var utils=require(_0x3c2e('0x16'));var config=require(_0x3c2e('0x17'));var db=require(_0x3c2e('0x18'))['db'];function respondWithStatusCode(_0x3de549,_0x4ce1c7){_0x4ce1c7=_0x4ce1c7||0xcc;return function(_0x56fcba){if(_0x56fcba){return _0x3de549[_0x3c2e('0x19')](_0x4ce1c7);}return _0x3de549['status'](_0x4ce1c7)['end']();};}function respondWithResult(_0x5651a5,_0x5902a3){_0x5902a3=_0x5902a3||0xc8;return function(_0x82cab6){if(_0x82cab6){return _0x5651a5[_0x3c2e('0x1a')](_0x5902a3)[_0x3c2e('0x1b')](_0x82cab6);}};}function respondWithFilteredResult(_0x496160,_0x445426){return function(_0x2ca9d5){if(_0x2ca9d5){var _0x2f502b=_0x2ca9d5['count'],_0x50d9b0=_0x445426[_0x3c2e('0x1c')],_0x1155f9=_0x445426['offset']+_0x445426[_0x3c2e('0x1d')],_0x42899b;if(_0x1155f9>=_0x2f502b){_0x1155f9=_0x2f502b;_0x42899b=0xc8;}else{_0x42899b=0xce;}_0x496160['status'](_0x42899b);return _0x496160[_0x3c2e('0x1e')](_0x3c2e('0x1f'),_0x50d9b0+'-'+_0x1155f9+'/'+_0x2f502b)[_0x3c2e('0x1b')](_0x2ca9d5);}return null;};}function patchUpdates(_0x1b7ccd){return function(_0x477f95){try{jsonpatch[_0x3c2e('0x20')](_0x477f95,_0x1b7ccd,!![]);}catch(_0x5ca7e8){return BPromise[_0x3c2e('0x21')](_0x5ca7e8);}return _0x477f95[_0x3c2e('0x22')]();};}function saveUpdates(_0x2363c7,_0x4c4718){return function(_0x12b434){if(_0x12b434){return _0x12b434[_0x3c2e('0x23')](_0x2363c7)['then'](function(_0x34adfe){return _0x34adfe;});}return null;};}function removeEntity(_0x4cadc8,_0x225f3f){return function(_0x2a9afb){if(_0x2a9afb){return _0x2a9afb[_0x3c2e('0x24')]()[_0x3c2e('0x25')](function(){var _0x5831c3=_0x2a9afb[_0x3c2e('0x26')]({'plain':!![]});var _0x26da39=_0x3c2e('0x27');return db[_0x3c2e('0x28')][_0x3c2e('0x24')]({'where':{'type':_0x26da39,'resourceId':_0x5831c3['id']}})[_0x3c2e('0x25')](function(){return _0x2a9afb;});})['then'](function(){_0x4cadc8['status'](0xcc)[_0x3c2e('0x29')]();});}};}function handleEntityNotFound(_0x5936e2,_0x114da5){return function(_0x4c324c){if(!_0x4c324c){_0x5936e2[_0x3c2e('0x19')](0x194);}return _0x4c324c;};}function handleError(_0x45ba39,_0x162476){_0x162476=_0x162476||0x1f4;return function(_0x151f7d){logger[_0x3c2e('0x2a')](_0x151f7d[_0x3c2e('0x2b')]);if(_0x151f7d[_0x3c2e('0x2c')]){delete _0x151f7d[_0x3c2e('0x2c')];}_0x45ba39[_0x3c2e('0x1a')](_0x162476)[_0x3c2e('0x2d')](_0x151f7d);};}exports[_0x3c2e('0x2e')]=function(_0x17def4,_0x5f26d2){var _0x5b22f0={},_0x13f469={},_0x4bde09={'count':0x0,'rows':[]};var _0x1edbf5=_['map'](db[_0x3c2e('0x2f')]['rawAttributes'],function(_0x1f5a16){return{'name':_0x1f5a16['fieldName'],'type':_0x1f5a16[_0x3c2e('0x30')][_0x3c2e('0x31')]};});_0x13f469['model']=_[_0x3c2e('0x32')](_0x1edbf5,_0x3c2e('0x2c'));_0x13f469[_0x3c2e('0x33')]=_[_0x3c2e('0x34')](_0x17def4[_0x3c2e('0x33')]);_0x13f469[_0x3c2e('0x35')]=_[_0x3c2e('0x36')](_0x13f469['model'],_0x13f469[_0x3c2e('0x33')]);_0x5b22f0['attributes']=_[_0x3c2e('0x36')](_0x13f469['model'],qs[_0x3c2e('0x37')](_0x17def4[_0x3c2e('0x33')]['fields']));_0x5b22f0[_0x3c2e('0x38')]=_0x5b22f0[_0x3c2e('0x38')][_0x3c2e('0x39')]?_0x5b22f0[_0x3c2e('0x38')]:_0x13f469[_0x3c2e('0x3a')];if(!_0x17def4['query'][_0x3c2e('0x3b')]('nolimit')){_0x5b22f0[_0x3c2e('0x1d')]=qs[_0x3c2e('0x1d')](_0x17def4[_0x3c2e('0x33')][_0x3c2e('0x1d')]);_0x5b22f0[_0x3c2e('0x1c')]=qs[_0x3c2e('0x1c')](_0x17def4[_0x3c2e('0x33')][_0x3c2e('0x1c')]);}_0x5b22f0[_0x3c2e('0x3c')]=qs['sort'](_0x17def4[_0x3c2e('0x33')][_0x3c2e('0x3d')]);_0x5b22f0['where']=qs[_0x3c2e('0x35')](_['pick'](_0x17def4['query'],_0x13f469[_0x3c2e('0x35')]),_0x1edbf5);if(_0x17def4[_0x3c2e('0x33')][_0x3c2e('0x3e')]){_0x5b22f0[_0x3c2e('0x3f')]=_[_0x3c2e('0x40')](_0x5b22f0[_0x3c2e('0x3f')],{'$or':_['map'](_0x1edbf5,function(_0x3094e7){if(_0x3094e7[_0x3c2e('0x30')]!==_0x3c2e('0x41')){var _0x275fcb={};_0x275fcb[_0x3094e7[_0x3c2e('0x2c')]]={'$like':'%'+_0x17def4['query']['filter']+'%'};return _0x275fcb;}})});}_0x5b22f0=_[_0x3c2e('0x40')]({},_0x5b22f0,_0x17def4['options']);var _0x420f99={'where':_0x5b22f0[_0x3c2e('0x3f')]};return db['JscriptyProject'][_0x3c2e('0x42')](_0x420f99)[_0x3c2e('0x25')](function(_0xf9374e){_0x4bde09[_0x3c2e('0x42')]=_0xf9374e;if(_0x17def4['query'][_0x3c2e('0x43')]){_0x5b22f0['include']=[{'all':!![]}];}return db['JscriptyProject'][_0x3c2e('0x44')](_0x5b22f0);})['then'](function(_0x19c6e9){_0x4bde09[_0x3c2e('0x45')]=_0x19c6e9;return _0x4bde09;})[_0x3c2e('0x25')](respondWithFilteredResult(_0x5f26d2,_0x5b22f0))['catch'](handleError(_0x5f26d2,null));};exports[_0x3c2e('0x46')]=function(_0x3f9576,_0x543dcf){var _0x2fcbbc={'raw':![],'where':{'id':_0x3f9576['params']['id']}},_0x5392e8={};_0x5392e8[_0x3c2e('0x3a')]=_[_0x3c2e('0x34')](db[_0x3c2e('0x2f')][_0x3c2e('0x47')]);_0x5392e8[_0x3c2e('0x33')]=_[_0x3c2e('0x34')](_0x3f9576['query']);_0x5392e8['filters']=_[_0x3c2e('0x36')](_0x5392e8['model'],_0x5392e8['query']);_0x2fcbbc[_0x3c2e('0x38')]=_[_0x3c2e('0x36')](_0x5392e8[_0x3c2e('0x3a')],qs[_0x3c2e('0x37')](_0x3f9576[_0x3c2e('0x33')][_0x3c2e('0x37')]));_0x2fcbbc[_0x3c2e('0x38')]=_0x2fcbbc[_0x3c2e('0x38')][_0x3c2e('0x39')]?_0x2fcbbc[_0x3c2e('0x38')]:_0x5392e8['model'];if(_0x3f9576[_0x3c2e('0x33')][_0x3c2e('0x43')]){_0x2fcbbc[_0x3c2e('0x48')]=[{'all':!![]}];}_0x2fcbbc=_[_0x3c2e('0x40')]({},_0x2fcbbc,_0x3f9576[_0x3c2e('0x49')]);return db[_0x3c2e('0x2f')][_0x3c2e('0x4a')](_0x2fcbbc)[_0x3c2e('0x25')](handleEntityNotFound(_0x543dcf,null))['then'](respondWithResult(_0x543dcf,null))['catch'](handleError(_0x543dcf,null));};exports['create']=function(_0x24c873,_0x16c29f){return db[_0x3c2e('0x2f')][_0x3c2e('0x4b')](_0x24c873[_0x3c2e('0x4c')],{})[_0x3c2e('0x25')](function(_0x40b518){var _0x18a8a4=_0x24c873[_0x3c2e('0x4d')][_0x3c2e('0x26')]({'plain':!![]});if(!_0x18a8a4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18a8a4[_0x3c2e('0x4e')]===_0x3c2e('0x4d')){var _0x336d38=_0x40b518[_0x3c2e('0x26')]({'plain':!![]});var _0x1eed74=_0x3c2e('0x27');return db[_0x3c2e('0x4f')][_0x3c2e('0x4a')]({'where':{'name':_0x1eed74,'userProfileId':_0x18a8a4[_0x3c2e('0x50')]},'raw':!![]})[_0x3c2e('0x25')](function(_0x13abab){if(_0x13abab&&_0x13abab[_0x3c2e('0x51')]===0x0){return db[_0x3c2e('0x28')]['create']({'name':_0x336d38['name'],'resourceId':_0x336d38['id'],'type':_0x13abab[_0x3c2e('0x2c')],'sectionId':_0x13abab['id']},{})['then'](function(){return _0x40b518;});}else{return _0x40b518;}})['catch'](function(_0x2f56d3){logger['error'](_0x3c2e('0x52'),_0x2f56d3);throw _0x2f56d3;});}return _0x40b518;})['then'](respondWithResult(_0x16c29f,0xc9))['catch'](handleError(_0x16c29f,null));};exports[_0x3c2e('0x53')]=function(_0x39f332,_0x57ab2e){var _0x56ea6b={'where':{'id':_0x39f332[_0x3c2e('0x54')]['id']}},_0x5cf47c={};_0x5cf47c[_0x3c2e('0x3a')]=_['keys'](db[_0x3c2e('0x2f')]['rawAttributes']);_0x56ea6b[_0x3c2e('0x38')]=_[_0x3c2e('0x36')](_0x5cf47c[_0x3c2e('0x3a')],qs['fields'](_0x39f332[_0x3c2e('0x33')][_0x3c2e('0x37')]));_0x56ea6b['attributes']=_0x56ea6b[_0x3c2e('0x38')]['length']?_0x56ea6b['attributes']:_0x5cf47c[_0x3c2e('0x3a')];if(_0x39f332[_0x3c2e('0x33')][_0x3c2e('0x43')]){_0x56ea6b[_0x3c2e('0x48')]=[{'all':!![]}];}_0x56ea6b=_[_0x3c2e('0x40')]({},_0x56ea6b,_0x39f332['options']);return db['JscriptyProject']['find'](_0x56ea6b)[_0x3c2e('0x25')](handleEntityNotFound(_0x57ab2e,null))[_0x3c2e('0x25')](function(_0x50cd53){if(_0x50cd53){var _0x2f85e4=_0x50cd53[_0x3c2e('0x26')]({'plain':!![]});_0x2f85e4=qs[_0x3c2e('0x55')](_0x2f85e4,['id',_0x3c2e('0x56'),'updatedAt']);_0x39f332[_0x3c2e('0x4c')]=_[_0x3c2e('0x55')](_0x39f332['body'],['id',_0x3c2e('0x56'),_0x3c2e('0x57')]);return db[_0x3c2e('0x2f')][_0x3c2e('0x4b')](_[_0x3c2e('0x40')](_0x2f85e4,_0x39f332[_0x3c2e('0x4c')]),{'include':_0x39f332[_0x3c2e('0x33')]['includeAll']?[{'all':!![]}]:undefined})[_0x3c2e('0x25')](function(_0x2453d0){var _0x20e6fb=_0x39f332['user'][_0x3c2e('0x26')]({'plain':!![]});if(!_0x20e6fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20e6fb[_0x3c2e('0x4e')]==='user'){var _0x283cb8=_0x2453d0['get']({'plain':!![]});var _0x12ffed=_0x3c2e('0x27');return db[_0x3c2e('0x4f')][_0x3c2e('0x4a')]({'where':{'name':_0x12ffed,'userProfileId':_0x20e6fb['userProfileId']},'raw':!![]})[_0x3c2e('0x25')](function(_0xb53536){if(_0xb53536&&_0xb53536[_0x3c2e('0x51')]===0x0){return db['UserProfileResource'][_0x3c2e('0x4b')]({'name':_0x283cb8['name'],'resourceId':_0x283cb8['id'],'type':_0xb53536[_0x3c2e('0x2c')],'sectionId':_0xb53536['id']},{})[_0x3c2e('0x25')](function(){return _0x2453d0;});}else{return _0x2453d0;}})[_0x3c2e('0x58')](function(_0x1401e7){logger[_0x3c2e('0x2a')](_0x3c2e('0x52'),_0x1401e7);throw _0x1401e7;});}return _0x2453d0;});}})['then'](respondWithResult(_0x57ab2e,0xc9))[_0x3c2e('0x58')](handleError(_0x57ab2e,null));};exports[_0x3c2e('0x23')]=function(_0x1b240d,_0x12ab67){if(_0x1b240d['body']['id']){delete _0x1b240d[_0x3c2e('0x4c')]['id'];}return db[_0x3c2e('0x2f')][_0x3c2e('0x4a')]({'where':{'id':_0x1b240d[_0x3c2e('0x54')]['id']}})['then'](handleEntityNotFound(_0x12ab67,null))[_0x3c2e('0x25')](saveUpdates(_0x1b240d[_0x3c2e('0x4c')],null))[_0x3c2e('0x25')](respondWithResult(_0x12ab67,null))[_0x3c2e('0x58')](handleError(_0x12ab67,null));};exports[_0x3c2e('0x24')]=function(_0x11c412,_0xdea89b){return db[_0x3c2e('0x2f')][_0x3c2e('0x4a')]({'where':{'id':_0x11c412[_0x3c2e('0x54')]['id']}})[_0x3c2e('0x25')](handleEntityNotFound(_0xdea89b,null))[_0x3c2e('0x25')](removeEntity(_0xdea89b,null))[_0x3c2e('0x58')](handleError(_0xdea89b,null));};exports[_0x3c2e('0x59')]=function(_0x5b891e,_0x4137f8,_0x27407a){var _0x31e34f={'raw':!![],'where':{}};var _0x2f553f={};var _0x43a032={'count':0x0,'rows':[]};return db[_0x3c2e('0x2f')][_0x3c2e('0x5a')]({'where':{'id':_0x5b891e[_0x3c2e('0x54')]['id']}})['then'](handleEntityNotFound(_0x4137f8,null))[_0x3c2e('0x25')](function(_0x50a2d2){if(_0x50a2d2){_0x2f553f[_0x3c2e('0x3a')]=_[_0x3c2e('0x34')](db[_0x3c2e('0x5b')][_0x3c2e('0x47')]);_0x2f553f[_0x3c2e('0x33')]=_['keys'](_0x5b891e[_0x3c2e('0x33')]);_0x2f553f[_0x3c2e('0x35')]=_[_0x3c2e('0x36')](_0x2f553f[_0x3c2e('0x3a')],_0x2f553f[_0x3c2e('0x33')]);_0x31e34f[_0x3c2e('0x38')]=_[_0x3c2e('0x36')](_0x2f553f[_0x3c2e('0x3a')],qs[_0x3c2e('0x37')](_0x5b891e[_0x3c2e('0x33')][_0x3c2e('0x37')]));_0x31e34f[_0x3c2e('0x38')]=_0x31e34f[_0x3c2e('0x38')]['length']?_0x31e34f[_0x3c2e('0x38')]:_0x2f553f[_0x3c2e('0x3a')];if(!_0x5b891e[_0x3c2e('0x33')][_0x3c2e('0x3b')]('nolimit')){_0x31e34f[_0x3c2e('0x1d')]=qs[_0x3c2e('0x1d')](_0x5b891e['query'][_0x3c2e('0x1d')]);_0x31e34f[_0x3c2e('0x1c')]=qs[_0x3c2e('0x1c')](_0x5b891e[_0x3c2e('0x33')][_0x3c2e('0x1c')]);}_0x31e34f[_0x3c2e('0x3c')]=qs[_0x3c2e('0x3d')](_0x5b891e['query'][_0x3c2e('0x3d')]);_0x31e34f[_0x3c2e('0x3f')]=qs[_0x3c2e('0x35')](_[_0x3c2e('0x5c')](_0x5b891e[_0x3c2e('0x33')],_0x2f553f[_0x3c2e('0x35')]));_0x31e34f[_0x3c2e('0x3f')][_0x3c2e('0x5d')]=_0x50a2d2['id'];if(_0x5b891e[_0x3c2e('0x33')][_0x3c2e('0x3e')]){_0x31e34f[_0x3c2e('0x3f')]=_[_0x3c2e('0x40')](_0x31e34f['where'],{'$or':_[_0x3c2e('0x32')](_0x31e34f['attributes'],function(_0x2d16f7){var _0x58ff65={};_0x58ff65[_0x2d16f7]={'$like':'%'+_0x5b891e['query'][_0x3c2e('0x3e')]+'%'};return _0x58ff65;})});}_0x31e34f=_[_0x3c2e('0x40')]({},_0x31e34f,_0x5b891e['options']);return db[_0x3c2e('0x5b')]['count']({'where':_0x31e34f[_0x3c2e('0x3f')]})[_0x3c2e('0x25')](function(_0x11e69f){_0x43a032['count']=_0x11e69f;if(_0x5b891e[_0x3c2e('0x33')][_0x3c2e('0x43')]){_0x31e34f['include']=[{'all':!![]}];}return db[_0x3c2e('0x5b')][_0x3c2e('0x44')](_0x31e34f);})['then'](function(_0x22a22b){_0x43a032[_0x3c2e('0x45')]=_0x22a22b;return _0x43a032;});}})['then'](respondWithFilteredResult(_0x4137f8,_0x31e34f))[_0x3c2e('0x58')](handleError(_0x4137f8,null));};exports['getAnswers']=function(_0x3b0d28,_0x310a4a,_0x2e856f){var _0xb37e8f={'raw':!![],'where':{}};var _0x3d0c17={};var _0xcc2f36={'count':0x0,'rows':[]};return db[_0x3c2e('0x2f')][_0x3c2e('0x5a')]({'where':{'id':_0x3b0d28[_0x3c2e('0x54')]['id']}})[_0x3c2e('0x25')](handleEntityNotFound(_0x310a4a,null))[_0x3c2e('0x25')](function(_0x19e0e1){if(_0x19e0e1){_0x3d0c17['model']=_[_0x3c2e('0x34')](db[_0x3c2e('0x5e')][_0x3c2e('0x47')]);_0x3d0c17[_0x3c2e('0x33')]=_[_0x3c2e('0x34')](_0x3b0d28['query']);_0x3d0c17['filters']=_[_0x3c2e('0x36')](_0x3d0c17[_0x3c2e('0x3a')],_0x3d0c17[_0x3c2e('0x33')]);_0xb37e8f[_0x3c2e('0x38')]=_[_0x3c2e('0x36')](_0x3d0c17[_0x3c2e('0x3a')],qs['fields'](_0x3b0d28[_0x3c2e('0x33')][_0x3c2e('0x37')]));_0xb37e8f[_0x3c2e('0x38')]=_0xb37e8f['attributes']['length']?_0xb37e8f[_0x3c2e('0x38')]:_0x3d0c17[_0x3c2e('0x3a')];if(!_0x3b0d28['query'][_0x3c2e('0x3b')]('nolimit')){_0xb37e8f[_0x3c2e('0x1d')]=qs['limit'](_0x3b0d28[_0x3c2e('0x33')][_0x3c2e('0x1d')]);_0xb37e8f['offset']=qs['offset'](_0x3b0d28[_0x3c2e('0x33')][_0x3c2e('0x1c')]);}_0xb37e8f[_0x3c2e('0x3c')]=qs['sort'](_0x3b0d28[_0x3c2e('0x33')][_0x3c2e('0x3d')]);_0xb37e8f[_0x3c2e('0x3f')]=qs[_0x3c2e('0x35')](_[_0x3c2e('0x5c')](_0x3b0d28[_0x3c2e('0x33')],_0x3d0c17[_0x3c2e('0x35')]));_0xb37e8f[_0x3c2e('0x3f')][_0x3c2e('0x5d')]=_0x19e0e1['id'];if(_0x3b0d28[_0x3c2e('0x33')][_0x3c2e('0x3e')]){_0xb37e8f[_0x3c2e('0x3f')]=_['merge'](_0xb37e8f['where'],{'$or':_[_0x3c2e('0x32')](_0xb37e8f[_0x3c2e('0x38')],function(_0x24c238){var _0x1965ef={};_0x1965ef[_0x24c238]={'$like':'%'+_0x3b0d28['query'][_0x3c2e('0x3e')]+'%'};return _0x1965ef;})});}_0xb37e8f=_[_0x3c2e('0x40')]({},_0xb37e8f,_0x3b0d28['options']);return db['JscriptyAnswerReport'][_0x3c2e('0x42')]({'where':_0xb37e8f[_0x3c2e('0x3f')]})['then'](function(_0x3b8de4){_0xcc2f36['count']=_0x3b8de4;if(_0x3b0d28[_0x3c2e('0x33')][_0x3c2e('0x43')]){_0xb37e8f[_0x3c2e('0x48')]=[{'all':!![]}];}return db[_0x3c2e('0x5e')][_0x3c2e('0x44')](_0xb37e8f);})[_0x3c2e('0x25')](function(_0x15c958){_0xcc2f36['rows']=_0x15c958;return _0xcc2f36;});}})[_0x3c2e('0x25')](respondWithFilteredResult(_0x310a4a,_0xb37e8f))[_0x3c2e('0x58')](handleError(_0x310a4a,null));};function char(_0x163c48){return _0x3c2e('0x5f')===typeof _0x163c48?String[_0x3c2e('0x60')][_0x3c2e('0x20')](null,arguments):_0x163c48;}function needsEncapsulation(_0x584b77){return!!_0x584b77&&(_0x584b77[_0x3c2e('0x61')]()[_0x3c2e('0x62')](char(0xd))>=0x0||_0x584b77[_0x3c2e('0x61')]()[_0x3c2e('0x62')](char(0xa))>=0x0||_0x584b77[_0x3c2e('0x61')]()[_0x3c2e('0x62')](char(0x2c))>=0x0||_0x584b77[_0x3c2e('0x61')]()[_0x3c2e('0x62')](char(0x22))>=0x0);}function encapsulate(_0x1055b2){var _0x53a33e=char(0x22),_0x2eb791='\x5c'+char(0x22),_0x20f8d1=_0x1055b2['toString']()['replace'](new RegExp(_0x53a33e,'g'),_0x2eb791);return _0x53a33e+_0x20f8d1+_0x53a33e;}exports['getSummary']=function(_0x42f0c3,_0x300e40,_0x37b2e5){var _0x567376,_0x3c6427;var _0x3644ee={'where':{'ProjectId':_0x42f0c3['params']['id']}};if(_0x42f0c3['query']['startTime']){_0x3644ee['where'][_0x3c2e('0x63')]=JSON[_0x3c2e('0x64')](_0x42f0c3[_0x3c2e('0x33')][_0x3c2e('0x65')]);}return db[_0x3c2e('0x5b')][_0x3c2e('0x44')](_0x3644ee)[_0x3c2e('0x25')](handleEntityNotFound(_0x300e40,null))[_0x3c2e('0x25')](function(_0x257fcc){if(_0x257fcc){_0x567376=_0x257fcc;return db[_0x3c2e('0x66')][_0x3c2e('0x44')]({'where':{'SessionId':{'$in':_[_0x3c2e('0x32')](_0x567376,'id')},'ProjectId':_0x42f0c3[_0x3c2e('0x54')]['id']},'order':_0x3c2e('0x67')});}})[_0x3c2e('0x25')](handleEntityNotFound(_0x300e40,null))['then'](function(_0x19a19a){if(_0x19a19a){_0x3c6427=_0x19a19a;var _0x3124bc={};for(var _0x3e4b01=0x0,_0x283bb8=_0x3c6427[_0x3c2e('0x39')];_0x3e4b01<_0x283bb8;_0x3e4b01++){if(!_0x3124bc[_0x3c2e('0x3b')](_0x3c6427[_0x3e4b01]['questionId'])){_0x3124bc[_0x3c6427[_0x3e4b01][_0x3c2e('0x68')]]=needsEncapsulation(_0x3c6427[_0x3e4b01][_0x3c2e('0x69')])?encapsulate(_0x3c6427[_0x3e4b01]['question']):_0x3c6427[_0x3e4b01][_0x3c2e('0x69')];}}var _0x4a860a=[],_0x16c300={};for(var _0x14bf2c=0x0,_0x1122a1=_0x567376[_0x3c2e('0x39')];_0x14bf2c<_0x1122a1;_0x14bf2c++){_0x16c300={'ProjectId':_0x42f0c3[_0x3c2e('0x54')]['id'],'SessionId':_0x567376[_0x14bf2c]['id'],'StartTime':moment(_0x567376[_0x14bf2c][_0x3c2e('0x63')])[_0x3c2e('0x6a')](_0x3c2e('0x6b'))};for(var _0x2123a7=0x0,_0x743cb4=_0x3c6427[_0x3c2e('0x39')];_0x2123a7<_0x743cb4;_0x2123a7++){if(_0x3c6427[_0x2123a7][_0x3c2e('0x6c')]==_0x567376[_0x14bf2c]['id']&&_0x3124bc[_0x3c2e('0x3b')](_0x3c6427[_0x2123a7][_0x3c2e('0x68')])){_0x16c300[_0x3124bc[_0x3c6427[_0x2123a7][_0x3c2e('0x68')]]]=_0x3c6427[_0x2123a7]['answer'];}}for(var _0x5779ff in _0x3124bc){if(!_0x16c300['hasOwnProperty'](_0x3124bc[_0x5779ff])){_0x16c300[_0x3124bc[_0x5779ff]]=null;}}_0x4a860a[_0x3c2e('0x6d')](_0x16c300);}return _0x4a860a;}})[_0x3c2e('0x25')](function(_0x2c28a5){if(!_['isEmpty'](_0x2c28a5)){var _0x2e2fd4=toCsv(_0x2c28a5);var _0x1334de=Date[_0x3c2e('0x6e')]();fs[_0x3c2e('0x6f')](util[_0x3c2e('0x6a')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x42f0c3[_0x3c2e('0x54')]['id'],_0x1334de),_0x2e2fd4);_0x300e40[_0x3c2e('0x70')](_0x3c2e('0x71'),_0x3c2e('0x72')+util[_0x3c2e('0x6a')]('Jscripty_Project_%d_Summary_%s.csv',_0x42f0c3[_0x3c2e('0x54')]['id'],_0x1334de));_0x300e40['setHeader'](_0x3c2e('0x73'),'text/csv');return _0x300e40['download'](util[_0x3c2e('0x6a')](_0x3c2e('0x74'),_0x42f0c3[_0x3c2e('0x54')]['id'],_0x1334de));}else{return _0x300e40[_0x3c2e('0x19')](0xcc);}})[_0x3c2e('0x58')](handleError(_0x300e40,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index ee14815..b948017 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 _0x4716=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','jscripty_projects'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x4716,0x79));var _0x6471=function(_0x54336b,_0x48b028){_0x54336b=_0x54336b-0x0;var _0x5b64a3=_0x4716[_0x54336b];return _0x5b64a3;};'use strict';var _=require(_0x6471('0x0'));var util=require(_0x6471('0x1'));var logger=require('../../config/logger')(_0x6471('0x2'));var moment=require(_0x6471('0x3'));var BPromise=require(_0x6471('0x4'));var rp=require(_0x6471('0x5'));var fs=require('fs');var path=require(_0x6471('0x6'));var rimraf=require('rimraf');var config=require(_0x6471('0x7'));var attributes=require('./jscriptyProject.attributes');module[_0x6471('0x8')]=function(_0x47f10e,_0x2c250d){return _0x47f10e[_0x6471('0x9')]('JscriptyProject',attributes,{'tableName':_0x6471('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5936=['request-promise','path','rimraf','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x5936,0x6a));var _0x6593=function(_0xa0d40a,_0x44aa53){_0xa0d40a=_0xa0d40a-0x0;var _0x4e90c5=_0x5936[_0xa0d40a];return _0x4e90c5;};'use strict';var _=require(_0x6593('0x0'));var util=require(_0x6593('0x1'));var logger=require(_0x6593('0x2'))(_0x6593('0x3'));var moment=require(_0x6593('0x4'));var BPromise=require(_0x6593('0x5'));var rp=require(_0x6593('0x6'));var fs=require('fs');var path=require(_0x6593('0x7'));var rimraf=require(_0x6593('0x8'));var config=require('../../config/environment');var attributes=require(_0x6593('0x9'));module[_0x6593('0xa')]=function(_0x46ff32,_0x426fd3){return _0x46ff32[_0x6593('0xb')](_0x6593('0xc'),attributes,{'tableName':_0x6593('0xd'),'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 bef468e..18af002 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 _0x6d18=['request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','JscriptyProject,\x20%s,\x20%s','message','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x6d18,0x109));var _0x86d1=function(_0x4140f3,_0x1c48b0){_0x4140f3=_0x4140f3-0x0;var _0x1b6378=_0x6d18[_0x4140f3];return _0x1b6378;};'use strict';var _=require(_0x86d1('0x0'));var util=require(_0x86d1('0x1'));var moment=require(_0x86d1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x86d1('0x3'));var db=require(_0x86d1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d1('0x5'))('rpc');var config=require(_0x86d1('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x12364e,_0x3934ea,_0x2f0a9d){return new BPromise(function(_0x2f834f,_0x602af2){return client[_0x86d1('0x7')](_0x12364e,_0x2f0a9d)['then'](function(_0x44a1f9){logger[_0x86d1('0x8')]('JscriptyProject,\x20%s,\x20%s',_0x3934ea,_0x86d1('0x9'));logger[_0x86d1('0xa')](_0x86d1('0xb'),_0x3934ea,_0x86d1('0x9'),JSON[_0x86d1('0xc')](_0x44a1f9));if(_0x44a1f9['error']){if(_0x44a1f9['error']['code']===0x1f4){logger[_0x86d1('0xd')](_0x86d1('0xe'),_0x3934ea,_0x44a1f9[_0x86d1('0xd')]['message']);return _0x602af2(_0x44a1f9[_0x86d1('0xd')]['message']);}logger['error'](_0x86d1('0xe'),_0x3934ea,_0x44a1f9[_0x86d1('0xd')]['message']);return _0x2f834f(_0x44a1f9[_0x86d1('0xd')][_0x86d1('0xf')]);}else{logger[_0x86d1('0x8')](_0x86d1('0xe'),_0x3934ea,_0x86d1('0x9'));_0x2f834f(_0x44a1f9['result']['message']);}})['catch'](function(_0x2f4950){logger[_0x86d1('0xd')](_0x86d1('0xe'),_0x3934ea,_0x2f4950);_0x602af2(_0x2f4950);});});} \ No newline at end of file +var _0x6f35=['JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','info','request\x20sent','debug'];(function(_0x45577f,_0x24889f){var _0x2c0140=function(_0x336012){while(--_0x336012){_0x45577f['push'](_0x45577f['shift']());}};_0x2c0140(++_0x24889f);}(_0x6f35,0x1aa));var _0x56f3=function(_0x37926e,_0x441c8b){_0x37926e=_0x37926e-0x0;var _0x3da3c8=_0x6f35[_0x37926e];return _0x3da3c8;};'use strict';var _=require(_0x56f3('0x0'));var util=require(_0x56f3('0x1'));var moment=require(_0x56f3('0x2'));var BPromise=require(_0x56f3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x56f3('0x4'));var db=require(_0x56f3('0x5'))['db'];var utils=require(_0x56f3('0x6'));var logger=require('../../config/logger')(_0x56f3('0x7'));var config=require(_0x56f3('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x56f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1dfafc,_0x1b6fd8,_0x40796e){return new BPromise(function(_0x2c602d,_0x3d1a86){return client[_0x56f3('0xa')](_0x1dfafc,_0x40796e)['then'](function(_0x472828){logger[_0x56f3('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x1b6fd8,_0x56f3('0xc'));logger[_0x56f3('0xd')](_0x56f3('0xe'),_0x1b6fd8,_0x56f3('0xc'),JSON[_0x56f3('0xf')](_0x472828));if(_0x472828[_0x56f3('0x10')]){if(_0x472828[_0x56f3('0x10')][_0x56f3('0x11')]===0x1f4){logger['error'](_0x56f3('0x12'),_0x1b6fd8,_0x472828[_0x56f3('0x10')][_0x56f3('0x13')]);return _0x3d1a86(_0x472828[_0x56f3('0x10')][_0x56f3('0x13')]);}logger['error'](_0x56f3('0x12'),_0x1b6fd8,_0x472828[_0x56f3('0x10')][_0x56f3('0x13')]);return _0x2c602d(_0x472828['error'][_0x56f3('0x13')]);}else{logger[_0x56f3('0xb')](_0x56f3('0x12'),_0x1b6fd8,_0x56f3('0xc'));_0x2c602d(_0x472828[_0x56f3('0x14')][_0x56f3('0x13')]);}})[_0x56f3('0x15')](function(_0x3fa1a5){logger[_0x56f3('0x10')](_0x56f3('0x12'),_0x1b6fd8,_0x3fa1a5);_0x3d1a86(_0x3fa1a5);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 74dea88..e52de0e 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 _0x24bc=['/:id','show','post','put','update','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x1e633e,_0x6f47e1){var _0x4c6d74=function(_0x3a6a2d){while(--_0x3a6a2d){_0x1e633e['push'](_0x1e633e['shift']());}};_0x4c6d74(++_0x6f47e1);}(_0x24bc,0x14b));var _0xc24b=function(_0x2b44b5,_0x5a99b0){_0x2b44b5=_0x2b44b5-0x0;var _0x2acd32=_0x24bc[_0x2b44b5];return _0x2acd32;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc24b('0x0'));var timeout=require(_0xc24b('0x1'));var express=require('express');var router=express[_0xc24b('0x2')]();var auth=require(_0xc24b('0x3'));var interaction=require(_0xc24b('0x4'));var config=require('../../config/environment');var controller=require(_0xc24b('0x5'));router[_0xc24b('0x6')]('/',auth[_0xc24b('0x7')](),controller[_0xc24b('0x8')]);router[_0xc24b('0x6')](_0xc24b('0x9'),auth[_0xc24b('0x7')](),controller[_0xc24b('0xa')]);router['get'](_0xc24b('0xb'),auth[_0xc24b('0x7')](),controller[_0xc24b('0xc')]);router[_0xc24b('0xd')]('/',auth[_0xc24b('0x7')](),controller['create']);router[_0xc24b('0xe')](_0xc24b('0xb'),auth['isAuthenticated'](),controller[_0xc24b('0xf')]);router[_0xc24b('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xc24b('0x11')]);module[_0xc24b('0x12')]=router; \ No newline at end of file +var _0x3721=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','isAuthenticated','get','/describe'];(function(_0x2e7c96,_0x27804d){var _0x36008e=function(_0xd03b6b){while(--_0xd03b6b){_0x2e7c96['push'](_0x2e7c96['shift']());}};_0x36008e(++_0x27804d);}(_0x3721,0x13e));var _0x1372=function(_0x5a3ff5,_0x102eea){_0x5a3ff5=_0x5a3ff5-0x0;var _0xe2034a=_0x3721[_0x5a3ff5];return _0xe2034a;};'use strict';var multer=require(_0x1372('0x0'));var util=require(_0x1372('0x1'));var path=require(_0x1372('0x2'));var timeout=require(_0x1372('0x3'));var express=require(_0x1372('0x4'));var router=express[_0x1372('0x5')]();var auth=require(_0x1372('0x6'));var interaction=require(_0x1372('0x7'));var config=require('../../config/environment');var controller=require(_0x1372('0x8'));router['get']('/',auth[_0x1372('0x9')](),controller['index']);router[_0x1372('0xa')](_0x1372('0xb'),auth[_0x1372('0x9')](),controller[_0x1372('0xc')]);router['get'](_0x1372('0xd'),auth['isAuthenticated'](),controller[_0x1372('0xe')]);router[_0x1372('0xf')]('/',auth[_0x1372('0x9')](),controller[_0x1372('0x10')]);router[_0x1372('0x11')](_0x1372('0xd'),auth[_0x1372('0x9')](),controller[_0x1372('0x12')]);router[_0x1372('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x1372('0x14')]);module[_0x1372('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 0ea2b47..3a22099 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 _0x63c6=['sequelize','exports','STRING','long'];(function(_0x2addd0,_0x302a64){var _0x10bd41=function(_0x5caeaf){while(--_0x5caeaf){_0x2addd0['push'](_0x2addd0['shift']());}};_0x10bd41(++_0x302a64);}(_0x63c6,0x1b4));var _0x663c=function(_0x3d6394,_0x466156){_0x3d6394=_0x3d6394-0x0;var _0x45ef60=_0x63c6[_0x3d6394];return _0x45ef60;};'use strict';var Sequelize=require(_0x663c('0x0'));module[_0x663c('0x1')]={'question':{'type':Sequelize[_0x663c('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x663c('0x3'))},'membername':{'type':Sequelize[_0x663c('0x2')]},'projectname':{'type':Sequelize[_0x663c('0x2')]},'queue':{'type':Sequelize[_0x663c('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x663c('0x2')]},'calleridnum':{'type':Sequelize[_0x663c('0x2')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1591=['long','STRING','sequelize','exports'];(function(_0x4df33d,_0x580bd7){var _0x1705f0=function(_0x5cd5b2){while(--_0x5cd5b2){_0x4df33d['push'](_0x4df33d['shift']());}};_0x1705f0(++_0x580bd7);}(_0x1591,0x18a));var _0x1159=function(_0xdc356f,_0x3003d0){_0xdc356f=_0xdc356f-0x0;var _0x339eaa=_0x1591[_0xdc356f];return _0x339eaa;};'use strict';var Sequelize=require(_0x1159('0x0'));module[_0x1159('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize['TEXT'](_0x1159('0x2'))},'membername':{'type':Sequelize[_0x1159('0x3')]},'projectname':{'type':Sequelize[_0x1159('0x3')]},'queue':{'type':Sequelize[_0x1159('0x3')]},'uniqueid':{'type':Sequelize[_0x1159('0x3')]},'calleridname':{'type':Sequelize[_0x1159('0x3')]},'calleridnum':{'type':Sequelize[_0x1159('0x3')]},'questionId':{'type':Sequelize[_0x1159('0x3')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 98504c2..d6f077f 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 _0x0349=['stack','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show','include','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x19ac6e,_0x435862){var _0x1cdcf3=function(_0x23151c){while(--_0x23151c){_0x19ac6e['push'](_0x19ac6e['shift']());}};_0x1cdcf3(++_0x435862);}(_0x0349,0x6e));var _0x9034=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x0349[_0x342700];return _0x53406f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9034('0x0'));var rimraf=require(_0x9034('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9034('0x2'));var rp=require(_0x9034('0x3'));var moment=require(_0x9034('0x4'));var BPromise=require(_0x9034('0x5'));var Mustache=require(_0x9034('0x6'));var util=require('util');var path=require(_0x9034('0x7'));var sox=require('sox');var csv=require(_0x9034('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9034('0x9'));var squel=require(_0x9034('0xa'));var crypto=require(_0x9034('0xb'));var jsforce=require(_0x9034('0xc'));var deskjs=require(_0x9034('0xd'));var toCsv=require(_0x9034('0x8'));var querystring=require(_0x9034('0xe'));var Papa=require(_0x9034('0xf'));var Redis=require(_0x9034('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9034('0x11'));var hardwareService=require(_0x9034('0x12'));var logger=require(_0x9034('0x13'))('api');var utils=require(_0x9034('0x14'));var config=require(_0x9034('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b7109,_0x297e83){_0x297e83=_0x297e83||0xcc;return function(_0x398892){if(_0x398892){return _0x3b7109[_0x9034('0x16')](_0x297e83);}return _0x3b7109['status'](_0x297e83)[_0x9034('0x17')]();};}function respondWithResult(_0x5c9f77,_0x1a58e8){_0x1a58e8=_0x1a58e8||0xc8;return function(_0x4df19c){if(_0x4df19c){return _0x5c9f77[_0x9034('0x18')](_0x1a58e8)[_0x9034('0x19')](_0x4df19c);}};}function respondWithFilteredResult(_0x1f051a,_0x2983ba){return function(_0x57c6a0){if(_0x57c6a0){var _0x3b634c=_0x57c6a0['count'],_0x1ae595=_0x2983ba[_0x9034('0x1a')],_0x1d042f=_0x2983ba[_0x9034('0x1a')]+_0x2983ba[_0x9034('0x1b')],_0x26aa96;if(_0x1d042f>=_0x3b634c){_0x1d042f=_0x3b634c;_0x26aa96=0xc8;}else{_0x26aa96=0xce;}_0x1f051a[_0x9034('0x18')](_0x26aa96);return _0x1f051a[_0x9034('0x1c')](_0x9034('0x1d'),_0x1ae595+'-'+_0x1d042f+'/'+_0x3b634c)[_0x9034('0x19')](_0x57c6a0);}return null;};}function patchUpdates(_0x38aea7){return function(_0x2ae42c){try{jsonpatch[_0x9034('0x1e')](_0x2ae42c,_0x38aea7,!![]);}catch(_0x5e82f9){return BPromise[_0x9034('0x1f')](_0x5e82f9);}return _0x2ae42c[_0x9034('0x20')]();};}function saveUpdates(_0x50f92a,_0x46be44){return function(_0x566f27){if(_0x566f27){return _0x566f27[_0x9034('0x21')](_0x50f92a)[_0x9034('0x22')](function(_0x58b1dd){return _0x58b1dd;});}return null;};}function removeEntity(_0x4e418d,_0x20a8c8){return function(_0x4185cd){if(_0x4185cd){return _0x4185cd[_0x9034('0x23')]()['then'](function(){_0x4e418d[_0x9034('0x18')](0xcc)[_0x9034('0x17')]();});}};}function handleEntityNotFound(_0x3affc5,_0x23635d){return function(_0x4fc636){if(!_0x4fc636){_0x3affc5[_0x9034('0x16')](0x194);}return _0x4fc636;};}function handleError(_0x4ee0ea,_0x5ebd12){_0x5ebd12=_0x5ebd12||0x1f4;return function(_0x22bded){logger['error'](_0x22bded[_0x9034('0x24')]);if(_0x22bded['name']){delete _0x22bded[_0x9034('0x25')];}_0x4ee0ea['status'](_0x5ebd12)[_0x9034('0x26')](_0x22bded);};}exports['index']=function(_0x416657,_0x29b325){var _0x1a5b74={},_0x5de1d9={},_0x10e14f={'count':0x0,'rows':[]};var _0x457a3d=_[_0x9034('0x27')](db[_0x9034('0x28')][_0x9034('0x29')],function(_0x499ed9){return{'name':_0x499ed9[_0x9034('0x2a')],'type':_0x499ed9[_0x9034('0x2b')][_0x9034('0x2c')]};});_0x5de1d9[_0x9034('0x2d')]=_['map'](_0x457a3d,_0x9034('0x25'));_0x5de1d9[_0x9034('0x2e')]=_[_0x9034('0x2f')](_0x416657[_0x9034('0x2e')]);_0x5de1d9[_0x9034('0x30')]=_[_0x9034('0x31')](_0x5de1d9[_0x9034('0x2d')],_0x5de1d9[_0x9034('0x2e')]);_0x1a5b74[_0x9034('0x32')]=_[_0x9034('0x31')](_0x5de1d9[_0x9034('0x2d')],qs['fields'](_0x416657[_0x9034('0x2e')][_0x9034('0x33')]));_0x1a5b74['attributes']=_0x1a5b74['attributes'][_0x9034('0x34')]?_0x1a5b74[_0x9034('0x32')]:_0x5de1d9[_0x9034('0x2d')];if(!_0x416657['query'][_0x9034('0x35')](_0x9034('0x36'))){_0x1a5b74['limit']=qs['limit'](_0x416657[_0x9034('0x2e')][_0x9034('0x1b')]);_0x1a5b74['offset']=qs['offset'](_0x416657[_0x9034('0x2e')][_0x9034('0x1a')]);}_0x1a5b74[_0x9034('0x37')]=qs[_0x9034('0x38')](_0x416657[_0x9034('0x2e')][_0x9034('0x38')]);_0x1a5b74[_0x9034('0x39')]=qs[_0x9034('0x30')](_['pick'](_0x416657['query'],_0x5de1d9[_0x9034('0x30')]),_0x457a3d);if(_0x416657[_0x9034('0x2e')][_0x9034('0x3a')]){_0x1a5b74[_0x9034('0x39')]=_[_0x9034('0x3b')](_0x1a5b74[_0x9034('0x39')],{'$or':_[_0x9034('0x27')](_0x457a3d,function(_0x597415){if(_0x597415['type']!==_0x9034('0x3c')){var _0x85211={};_0x85211[_0x597415[_0x9034('0x25')]]={'$like':'%'+_0x416657['query'][_0x9034('0x3a')]+'%'};return _0x85211;}})});}_0x1a5b74=_['merge']({},_0x1a5b74,_0x416657[_0x9034('0x3d')]);var _0x4575a8={'where':_0x1a5b74[_0x9034('0x39')]};return db[_0x9034('0x28')][_0x9034('0x3e')](_0x4575a8)[_0x9034('0x22')](function(_0x49f8b9){_0x10e14f['count']=_0x49f8b9;if(_0x416657[_0x9034('0x2e')][_0x9034('0x3f')]){_0x1a5b74['include']=[{'all':!![]}];}return db[_0x9034('0x28')]['findAll'](_0x1a5b74);})[_0x9034('0x22')](function(_0x1fb2dd){_0x10e14f[_0x9034('0x40')]=_0x1fb2dd;return _0x10e14f;})[_0x9034('0x22')](respondWithFilteredResult(_0x29b325,_0x1a5b74))[_0x9034('0x41')](handleError(_0x29b325,null));};exports[_0x9034('0x42')]=function(_0x1a4281,_0x2ac84c){var _0x3a44a1={'raw':!![],'where':{'id':_0x1a4281['params']['id']}},_0x549717={};_0x549717[_0x9034('0x2d')]=_[_0x9034('0x2f')](db[_0x9034('0x28')][_0x9034('0x29')]);_0x549717[_0x9034('0x2e')]=_[_0x9034('0x2f')](_0x1a4281[_0x9034('0x2e')]);_0x549717[_0x9034('0x30')]=_[_0x9034('0x31')](_0x549717[_0x9034('0x2d')],_0x549717[_0x9034('0x2e')]);_0x3a44a1[_0x9034('0x32')]=_[_0x9034('0x31')](_0x549717[_0x9034('0x2d')],qs[_0x9034('0x33')](_0x1a4281[_0x9034('0x2e')]['fields']));_0x3a44a1[_0x9034('0x32')]=_0x3a44a1['attributes'][_0x9034('0x34')]?_0x3a44a1[_0x9034('0x32')]:_0x549717[_0x9034('0x2d')];if(_0x1a4281[_0x9034('0x2e')][_0x9034('0x3f')]){_0x3a44a1[_0x9034('0x43')]=[{'all':!![]}];}_0x3a44a1=_['merge']({},_0x3a44a1,_0x1a4281[_0x9034('0x3d')]);return db[_0x9034('0x28')][_0x9034('0x44')](_0x3a44a1)[_0x9034('0x22')](handleEntityNotFound(_0x2ac84c,null))[_0x9034('0x22')](respondWithResult(_0x2ac84c,null))[_0x9034('0x41')](handleError(_0x2ac84c,null));};exports[_0x9034('0x45')]=function(_0x4b7ad,_0x511631){return db[_0x9034('0x28')][_0x9034('0x45')](_0x4b7ad['body'],{})[_0x9034('0x22')](respondWithResult(_0x511631,0xc9))[_0x9034('0x41')](handleError(_0x511631,null));};exports[_0x9034('0x21')]=function(_0x13c72f,_0x4a090a){if(_0x13c72f[_0x9034('0x46')]['id']){delete _0x13c72f[_0x9034('0x46')]['id'];}return db[_0x9034('0x28')][_0x9034('0x44')]({'where':{'id':_0x13c72f[_0x9034('0x47')]['id']}})['then'](handleEntityNotFound(_0x4a090a,null))[_0x9034('0x22')](saveUpdates(_0x13c72f[_0x9034('0x46')],null))[_0x9034('0x22')](respondWithResult(_0x4a090a,null))[_0x9034('0x41')](handleError(_0x4a090a,null));};exports[_0x9034('0x23')]=function(_0x2f85a1,_0x19d36a){return db[_0x9034('0x28')][_0x9034('0x44')]({'where':{'id':_0x2f85a1[_0x9034('0x47')]['id']}})[_0x9034('0x22')](handleEntityNotFound(_0x19d36a,null))[_0x9034('0x22')](removeEntity(_0x19d36a,null))[_0x9034('0x41')](handleError(_0x19d36a,null));};exports[_0x9034('0x48')]=function(_0xb29670,_0xf32741){return db[_0x9034('0x28')]['describe']()[_0x9034('0x22')](respondWithResult(_0xf32741,null))[_0x9034('0x41')](handleError(_0xf32741,null));}; \ No newline at end of file +var _0x2105=['offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','fieldName','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','show','params','rawAttributes','fields','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count'];(function(_0x1b6994,_0x561a7d){var _0xfb675=function(_0x4f0e47){while(--_0x4f0e47){_0x1b6994['push'](_0x1b6994['shift']());}};_0xfb675(++_0x561a7d);}(_0x2105,0xc6));var _0x5210=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2105[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0x5210('0x0'));var emlformat=require(_0x5210('0x1'));var rimraf=require(_0x5210('0x2'));var zipdir=require(_0x5210('0x3'));var jsonpatch=require(_0x5210('0x4'));var rp=require(_0x5210('0x5'));var moment=require(_0x5210('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x5210('0x7'));var util=require('util');var path=require(_0x5210('0x8'));var sox=require(_0x5210('0x9'));var csv=require(_0x5210('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5210('0xb'));var squel=require(_0x5210('0xc'));var crypto=require(_0x5210('0xd'));var jsforce=require(_0x5210('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5210('0xa'));var querystring=require('querystring');var Papa=require(_0x5210('0xf'));var Redis=require(_0x5210('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5210('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5210('0x12'));var logger=require('../../config/logger')(_0x5210('0x13'));var utils=require(_0x5210('0x14'));var config=require(_0x5210('0x15'));var db=require(_0x5210('0x16'))['db'];function respondWithStatusCode(_0x504c13,_0x1f86bd){_0x1f86bd=_0x1f86bd||0xcc;return function(_0x58a6b7){if(_0x58a6b7){return _0x504c13[_0x5210('0x17')](_0x1f86bd);}return _0x504c13[_0x5210('0x18')](_0x1f86bd)[_0x5210('0x19')]();};}function respondWithResult(_0x4eb6c0,_0x293ee6){_0x293ee6=_0x293ee6||0xc8;return function(_0x2e0a6c){if(_0x2e0a6c){return _0x4eb6c0[_0x5210('0x18')](_0x293ee6)['json'](_0x2e0a6c);}};}function respondWithFilteredResult(_0x1a4db2,_0x637c8c){return function(_0x184f0b){if(_0x184f0b){var _0x399c26=_0x184f0b[_0x5210('0x1a')],_0x3c1b77=_0x637c8c[_0x5210('0x1b')],_0x12459f=_0x637c8c[_0x5210('0x1b')]+_0x637c8c[_0x5210('0x1c')],_0x4f6711;if(_0x12459f>=_0x399c26){_0x12459f=_0x399c26;_0x4f6711=0xc8;}else{_0x4f6711=0xce;}_0x1a4db2['status'](_0x4f6711);return _0x1a4db2[_0x5210('0x1d')](_0x5210('0x1e'),_0x3c1b77+'-'+_0x12459f+'/'+_0x399c26)['json'](_0x184f0b);}return null;};}function patchUpdates(_0x1315bf){return function(_0x38b99f){try{jsonpatch[_0x5210('0x1f')](_0x38b99f,_0x1315bf,!![]);}catch(_0x2c99d1){return BPromise[_0x5210('0x20')](_0x2c99d1);}return _0x38b99f[_0x5210('0x21')]();};}function saveUpdates(_0x348578,_0x3b6b9d){return function(_0x50c655){if(_0x50c655){return _0x50c655[_0x5210('0x22')](_0x348578)[_0x5210('0x23')](function(_0x9ba982){return _0x9ba982;});}return null;};}function removeEntity(_0x429ba2,_0x4709db){return function(_0x215c8e){if(_0x215c8e){return _0x215c8e[_0x5210('0x24')]()['then'](function(){_0x429ba2[_0x5210('0x18')](0xcc)[_0x5210('0x19')]();});}};}function handleEntityNotFound(_0x1109b3,_0x467d95){return function(_0x4dcad8){if(!_0x4dcad8){_0x1109b3[_0x5210('0x17')](0x194);}return _0x4dcad8;};}function handleError(_0x54211d,_0x1ad0d1){_0x1ad0d1=_0x1ad0d1||0x1f4;return function(_0x5017a6){logger[_0x5210('0x25')](_0x5017a6[_0x5210('0x26')]);if(_0x5017a6[_0x5210('0x27')]){delete _0x5017a6[_0x5210('0x27')];}_0x54211d[_0x5210('0x18')](_0x1ad0d1)[_0x5210('0x28')](_0x5017a6);};}exports[_0x5210('0x29')]=function(_0x2a5fe7,_0x44a3da){var _0x15ee0f={},_0x21c90a={},_0x41e4d6={'count':0x0,'rows':[]};var _0x40b503=_[_0x5210('0x2a')](db[_0x5210('0x2b')]['rawAttributes'],function(_0x40d1a7){return{'name':_0x40d1a7[_0x5210('0x2c')],'type':_0x40d1a7['type'][_0x5210('0x2d')]};});_0x21c90a['model']=_['map'](_0x40b503,'name');_0x21c90a[_0x5210('0x2e')]=_[_0x5210('0x2f')](_0x2a5fe7[_0x5210('0x2e')]);_0x21c90a[_0x5210('0x30')]=_[_0x5210('0x31')](_0x21c90a[_0x5210('0x32')],_0x21c90a[_0x5210('0x2e')]);_0x15ee0f[_0x5210('0x33')]=_[_0x5210('0x31')](_0x21c90a[_0x5210('0x32')],qs['fields'](_0x2a5fe7[_0x5210('0x2e')]['fields']));_0x15ee0f[_0x5210('0x33')]=_0x15ee0f[_0x5210('0x33')][_0x5210('0x34')]?_0x15ee0f[_0x5210('0x33')]:_0x21c90a[_0x5210('0x32')];if(!_0x2a5fe7[_0x5210('0x2e')][_0x5210('0x35')](_0x5210('0x36'))){_0x15ee0f[_0x5210('0x1c')]=qs[_0x5210('0x1c')](_0x2a5fe7[_0x5210('0x2e')][_0x5210('0x1c')]);_0x15ee0f[_0x5210('0x1b')]=qs[_0x5210('0x1b')](_0x2a5fe7[_0x5210('0x2e')][_0x5210('0x1b')]);}_0x15ee0f[_0x5210('0x37')]=qs[_0x5210('0x38')](_0x2a5fe7[_0x5210('0x2e')][_0x5210('0x38')]);_0x15ee0f[_0x5210('0x39')]=qs[_0x5210('0x30')](_[_0x5210('0x3a')](_0x2a5fe7[_0x5210('0x2e')],_0x21c90a[_0x5210('0x30')]),_0x40b503);if(_0x2a5fe7[_0x5210('0x2e')]['filter']){_0x15ee0f[_0x5210('0x39')]=_[_0x5210('0x3b')](_0x15ee0f['where'],{'$or':_[_0x5210('0x2a')](_0x40b503,function(_0x548e6a){if(_0x548e6a[_0x5210('0x3c')]!==_0x5210('0x3d')){var _0x5cce7c={};_0x5cce7c[_0x548e6a[_0x5210('0x27')]]={'$like':'%'+_0x2a5fe7[_0x5210('0x2e')][_0x5210('0x3e')]+'%'};return _0x5cce7c;}})});}_0x15ee0f=_[_0x5210('0x3b')]({},_0x15ee0f,_0x2a5fe7[_0x5210('0x3f')]);var _0x6f8907={'where':_0x15ee0f['where']};return db[_0x5210('0x2b')][_0x5210('0x1a')](_0x6f8907)['then'](function(_0x2fb795){_0x41e4d6[_0x5210('0x1a')]=_0x2fb795;if(_0x2a5fe7['query'][_0x5210('0x40')]){_0x15ee0f[_0x5210('0x41')]=[{'all':!![]}];}return db[_0x5210('0x2b')]['findAll'](_0x15ee0f);})[_0x5210('0x23')](function(_0x475c57){_0x41e4d6[_0x5210('0x42')]=_0x475c57;return _0x41e4d6;})[_0x5210('0x23')](respondWithFilteredResult(_0x44a3da,_0x15ee0f))['catch'](handleError(_0x44a3da,null));};exports[_0x5210('0x43')]=function(_0x1ff490,_0x25060f){var _0x359709={'raw':!![],'where':{'id':_0x1ff490[_0x5210('0x44')]['id']}},_0xcee3fe={};_0xcee3fe['model']=_['keys'](db['JscriptyQuestionReport'][_0x5210('0x45')]);_0xcee3fe[_0x5210('0x2e')]=_[_0x5210('0x2f')](_0x1ff490[_0x5210('0x2e')]);_0xcee3fe[_0x5210('0x30')]=_[_0x5210('0x31')](_0xcee3fe[_0x5210('0x32')],_0xcee3fe[_0x5210('0x2e')]);_0x359709[_0x5210('0x33')]=_[_0x5210('0x31')](_0xcee3fe[_0x5210('0x32')],qs[_0x5210('0x46')](_0x1ff490['query'][_0x5210('0x46')]));_0x359709[_0x5210('0x33')]=_0x359709['attributes'][_0x5210('0x34')]?_0x359709[_0x5210('0x33')]:_0xcee3fe[_0x5210('0x32')];if(_0x1ff490[_0x5210('0x2e')][_0x5210('0x40')]){_0x359709[_0x5210('0x41')]=[{'all':!![]}];}_0x359709=_[_0x5210('0x3b')]({},_0x359709,_0x1ff490[_0x5210('0x3f')]);return db[_0x5210('0x2b')][_0x5210('0x47')](_0x359709)['then'](handleEntityNotFound(_0x25060f,null))[_0x5210('0x23')](respondWithResult(_0x25060f,null))[_0x5210('0x48')](handleError(_0x25060f,null));};exports[_0x5210('0x49')]=function(_0x74e749,_0x3ce964){return db[_0x5210('0x2b')][_0x5210('0x49')](_0x74e749[_0x5210('0x4a')],{})[_0x5210('0x23')](respondWithResult(_0x3ce964,0xc9))['catch'](handleError(_0x3ce964,null));};exports[_0x5210('0x22')]=function(_0x3eb097,_0xe6156f){if(_0x3eb097['body']['id']){delete _0x3eb097[_0x5210('0x4a')]['id'];}return db[_0x5210('0x2b')][_0x5210('0x47')]({'where':{'id':_0x3eb097[_0x5210('0x44')]['id']}})[_0x5210('0x23')](handleEntityNotFound(_0xe6156f,null))[_0x5210('0x23')](saveUpdates(_0x3eb097[_0x5210('0x4a')],null))[_0x5210('0x23')](respondWithResult(_0xe6156f,null))[_0x5210('0x48')](handleError(_0xe6156f,null));};exports[_0x5210('0x24')]=function(_0x2f8bec,_0x1faef0){return db['JscriptyQuestionReport'][_0x5210('0x47')]({'where':{'id':_0x2f8bec['params']['id']}})[_0x5210('0x23')](handleEntityNotFound(_0x1faef0,null))[_0x5210('0x23')](removeEntity(_0x1faef0,null))[_0x5210('0x48')](handleError(_0x1faef0,null));};exports['describe']=function(_0x29802b,_0x32ad37){return db['JscriptyQuestionReport']['describe']()['then'](respondWithResult(_0x32ad37,null))[_0x5210('0x48')](handleError(_0x32ad37,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 11b047e..8c29fb3 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 _0x1639=['path','define','JscriptyQuestionReport','report_jscripty_questions','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0x1639,0x14e));var _0x9163=function(_0xfee060,_0x184a79){_0xfee060=_0xfee060-0x0;var _0x5daef8=_0x1639[_0xfee060];return _0x5daef8;};'use strict';var _=require(_0x9163('0x0'));var util=require('util');var logger=require(_0x9163('0x1'))(_0x9163('0x2'));var moment=require(_0x9163('0x3'));var BPromise=require(_0x9163('0x4'));var rp=require(_0x9163('0x5'));var fs=require('fs');var path=require(_0x9163('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x3ce8c9,_0x27bd3e){return _0x3ce8c9[_0x9163('0x7')](_0x9163('0x8'),attributes,{'tableName':_0x9163('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3079=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','report_jscripty_questions','lodash'];(function(_0x14653c,_0x14150b){var _0x4b94b6=function(_0xe31603){while(--_0xe31603){_0x14653c['push'](_0x14653c['shift']());}};_0x4b94b6(++_0x14150b);}(_0x3079,0x12b));var _0x9307=function(_0x28b9f9,_0x5afca5){_0x28b9f9=_0x28b9f9-0x0;var _0x400655=_0x3079[_0x28b9f9];return _0x400655;};'use strict';var _=require(_0x9307('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9307('0x1'));var moment=require(_0x9307('0x2'));var BPromise=require('bluebird');var rp=require(_0x9307('0x3'));var fs=require('fs');var path=require(_0x9307('0x4'));var rimraf=require(_0x9307('0x5'));var config=require(_0x9307('0x6'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x9307('0x7')]=function(_0x235380,_0x126a01){return _0x235380[_0x9307('0x8')]('JscriptyQuestionReport',attributes,{'tableName':_0x9307('0x9'),'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 76ee742..a6dc477 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 _0xff9d=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0xff9d,0x142));var _0xdff9=function(_0x3dfb90,_0x13a3f7){_0x3dfb90=_0x3dfb90-0x0;var _0x59f5d5=_0xff9d[_0x3dfb90];return _0x59f5d5;};'use strict';var _=require(_0xdff9('0x0'));var util=require(_0xdff9('0x1'));var moment=require('moment');var BPromise=require(_0xdff9('0x2'));var rs=require(_0xdff9('0x3'));var fs=require('fs');var Redis=require(_0xdff9('0x4'));var db=require(_0xdff9('0x5'))['db'];var utils=require(_0xdff9('0x6'));var logger=require(_0xdff9('0x7'))(_0xdff9('0x8'));var config=require(_0xdff9('0x9'));var jayson=require(_0xdff9('0xa'));var client=jayson[_0xdff9('0xb')][_0xdff9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2f5f20,_0x55e31a,_0x4555a1){return new BPromise(function(_0x32144e,_0x3c3821){return client[_0xdff9('0xd')](_0x2f5f20,_0x4555a1)[_0xdff9('0xe')](function(_0x12d98c){logger['info'](_0xdff9('0xf'),_0x55e31a,'request\x20sent');logger[_0xdff9('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x55e31a,_0xdff9('0x11'),JSON[_0xdff9('0x12')](_0x12d98c));if(_0x12d98c[_0xdff9('0x13')]){if(_0x12d98c['error'][_0xdff9('0x14')]===0x1f4){logger['error'](_0xdff9('0xf'),_0x55e31a,_0x12d98c[_0xdff9('0x13')][_0xdff9('0x15')]);return _0x3c3821(_0x12d98c[_0xdff9('0x13')][_0xdff9('0x15')]);}logger[_0xdff9('0x13')](_0xdff9('0xf'),_0x55e31a,_0x12d98c['error'][_0xdff9('0x15')]);return _0x32144e(_0x12d98c[_0xdff9('0x13')][_0xdff9('0x15')]);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x55e31a,_0xdff9('0x11'));_0x32144e(_0x12d98c[_0xdff9('0x16')][_0xdff9('0x15')]);}})['catch'](function(_0x2a62b4){logger['error'](_0xdff9('0xf'),_0x55e31a,_0x2a62b4);_0x3c3821(_0x2a62b4);});});} \ No newline at end of file +var _0x1809=['rpc','../../config/environment','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x91e281,_0x2ebe44){var _0x1f4bc7=function(_0x251729){while(--_0x251729){_0x91e281['push'](_0x91e281['shift']());}};_0x1f4bc7(++_0x2ebe44);}(_0x1809,0x110));var _0x9180=function(_0x2773b6,_0x477149){_0x2773b6=_0x2773b6-0x0;var _0x2ac2e5=_0x1809[_0x2773b6];return _0x2ac2e5;};'use strict';var _=require(_0x9180('0x0'));var util=require(_0x9180('0x1'));var moment=require(_0x9180('0x2'));var BPromise=require(_0x9180('0x3'));var rs=require(_0x9180('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9180('0x5'))['db'];var utils=require(_0x9180('0x6'));var logger=require(_0x9180('0x7'))(_0x9180('0x8'));var config=require(_0x9180('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9180('0xa')][_0x9180('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a4486,_0x575330,_0x3fdcda){return new BPromise(function(_0x1074f5,_0x9717fd){return client[_0x9180('0xc')](_0x3a4486,_0x3fdcda)['then'](function(_0x409ead){logger[_0x9180('0xd')](_0x9180('0xe'),_0x575330,_0x9180('0xf'));logger['debug'](_0x9180('0x10'),_0x575330,_0x9180('0xf'),JSON['stringify'](_0x409ead));if(_0x409ead[_0x9180('0x11')]){if(_0x409ead[_0x9180('0x11')][_0x9180('0x12')]===0x1f4){logger[_0x9180('0x11')](_0x9180('0xe'),_0x575330,_0x409ead[_0x9180('0x11')][_0x9180('0x13')]);return _0x9717fd(_0x409ead[_0x9180('0x11')]['message']);}logger[_0x9180('0x11')](_0x9180('0xe'),_0x575330,_0x409ead[_0x9180('0x11')][_0x9180('0x13')]);return _0x1074f5(_0x409ead[_0x9180('0x11')][_0x9180('0x13')]);}else{logger[_0x9180('0xd')](_0x9180('0xe'),_0x575330,_0x9180('0xf'));_0x1074f5(_0x409ead['result'][_0x9180('0x13')]);}})['catch'](function(_0x545adc){logger[_0x9180('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x575330,_0x545adc);_0x9717fd(_0x545adc);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 8725a96..7ed1862 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 _0x7a08=['get','isAuthenticated','index','/describe','describe','/:id','show','getQuestions','post','create','update','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0x7a08,0x11e));var _0x87a0=function(_0x21bad5,_0x23a39d){_0x21bad5=_0x21bad5-0x0;var _0x235106=_0x7a08[_0x21bad5];return _0x235106;};'use strict';var multer=require(_0x87a0('0x0'));var util=require(_0x87a0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x87a0('0x2'));var router=express[_0x87a0('0x3')]();var auth=require(_0x87a0('0x4'));var interaction=require(_0x87a0('0x5'));var config=require(_0x87a0('0x6'));var controller=require(_0x87a0('0x7'));router[_0x87a0('0x8')]('/',auth[_0x87a0('0x9')](),controller[_0x87a0('0xa')]);router[_0x87a0('0x8')](_0x87a0('0xb'),auth['isAuthenticated'](),controller[_0x87a0('0xc')]);router[_0x87a0('0x8')](_0x87a0('0xd'),auth[_0x87a0('0x9')](),controller[_0x87a0('0xe')]);router['get']('/:id/questions',auth[_0x87a0('0x9')](),controller[_0x87a0('0xf')]);router[_0x87a0('0x10')]('/',auth[_0x87a0('0x9')](),controller[_0x87a0('0x11')]);router['put'](_0x87a0('0xd'),auth[_0x87a0('0x9')](),controller[_0x87a0('0x12')]);router['delete'](_0x87a0('0xd'),auth[_0x87a0('0x9')](),controller[_0x87a0('0x13')]);module[_0x87a0('0x14')]=router; \ No newline at end of file +var _0x00b3=['/:id','show','/:id/questions','post','create','destroy','exports','multer','connect-timeout','express','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x3d5f45,_0x15a7a5){var _0x10ab5f=function(_0x3dea5a){while(--_0x3dea5a){_0x3d5f45['push'](_0x3d5f45['shift']());}};_0x10ab5f(++_0x15a7a5);}(_0x00b3,0x97));var _0x300b=function(_0x3850d2,_0x32bb91){_0x3850d2=_0x3850d2-0x0;var _0x2b18d4=_0x00b3[_0x3850d2];return _0x2b18d4;};'use strict';var multer=require(_0x300b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x300b('0x1'));var express=require(_0x300b('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x300b('0x3'));var config=require(_0x300b('0x4'));var controller=require(_0x300b('0x5'));router['get']('/',auth[_0x300b('0x6')](),controller[_0x300b('0x7')]);router[_0x300b('0x8')](_0x300b('0x9'),auth[_0x300b('0x6')](),controller[_0x300b('0xa')]);router[_0x300b('0x8')](_0x300b('0xb'),auth[_0x300b('0x6')](),controller[_0x300b('0xc')]);router[_0x300b('0x8')](_0x300b('0xd'),auth[_0x300b('0x6')](),controller['getQuestions']);router[_0x300b('0xe')]('/',auth[_0x300b('0x6')](),controller[_0x300b('0xf')]);router['put'](_0x300b('0xb'),auth[_0x300b('0x6')](),controller['update']);router['delete'](_0x300b('0xb'),auth['isAuthenticated'](),controller[_0x300b('0x10')]);module[_0x300b('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 8832e45..dc54a6f 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 _0xbd12=['starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','exports','DATE','setDataValue'];(function(_0x3b363f,_0x38fd63){var _0x3730e8=function(_0x122f2b){while(--_0x122f2b){_0x3b363f['push'](_0x3b363f['shift']());}};_0x3730e8(++_0x38fd63);}(_0xbd12,0x1c8));var _0x2bd1=function(_0x58f172,_0x320085){_0x58f172=_0x58f172-0x0;var _0xe519b9=_0xbd12[_0x58f172];return _0xe519b9;};'use strict';var moment=require(_0x2bd1('0x0'));var Sequelize=require('sequelize');module[_0x2bd1('0x1')]={'starttime':{'type':Sequelize[_0x2bd1('0x2')],'set':function(_0x3f6aa5){this[_0x2bd1('0x3')](_0x2bd1('0x4'),_0x3f6aa5);this[_0x2bd1('0x3')](_0x2bd1('0x5'),moment()[_0x2bd1('0x6')](_0x2bd1('0x7')));}},'endtime':{'type':Sequelize[_0x2bd1('0x2')]},'membername':{'type':Sequelize[_0x2bd1('0x8')]},'projectname':{'type':Sequelize[_0x2bd1('0x8')]},'queue':{'type':Sequelize[_0x2bd1('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2bd1('0x8')]},'calleridnum':{'type':Sequelize[_0x2bd1('0x8')]},'completed':{'type':Sequelize[_0x2bd1('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xb7b1=['moment','DATE','starttime','setDataValue','STRING','BOOLEAN'];(function(_0x38acc6,_0x58bb14){var _0x5af052=function(_0x4bdb33){while(--_0x4bdb33){_0x38acc6['push'](_0x38acc6['shift']());}};_0x5af052(++_0x58bb14);}(_0xb7b1,0x126));var _0x1b7b=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xb7b1[_0x35885a];return _0xe86249;};'use strict';var moment=require(_0x1b7b('0x0'));var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize[_0x1b7b('0x1')],'set':function(_0x38de10){this['setDataValue'](_0x1b7b('0x2'),_0x38de10);this[_0x1b7b('0x3')]('endtime',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x1b7b('0x1')]},'membername':{'type':Sequelize[_0x1b7b('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1b7b('0x4')]},'uniqueid':{'type':Sequelize[_0x1b7b('0x4')]},'calleridname':{'type':Sequelize[_0x1b7b('0x4')]},'calleridnum':{'type':Sequelize[_0x1b7b('0x4')]},'completed':{'type':Sequelize[_0x1b7b('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 6430e53..6770ac8 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 _0xbff9=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','set','Content-Range','json','apply','save','update','then','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','length','pick','SessionId','filter','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x93fa43,_0x4a0675){var _0x2233af=function(_0x444918){while(--_0x444918){_0x93fa43['push'](_0x93fa43['shift']());}};_0x2233af(++_0x4a0675);}(_0xbff9,0x96));var _0x9bff=function(_0x29c65b,_0x84ecb0){_0x29c65b=_0x29c65b-0x0;var _0x5689e9=_0xbff9[_0x29c65b];return _0x5689e9;};'use strict';var pdf=require(_0x9bff('0x0'));var emlformat=require(_0x9bff('0x1'));var rimraf=require(_0x9bff('0x2'));var zipdir=require(_0x9bff('0x3'));var jsonpatch=require(_0x9bff('0x4'));var rp=require(_0x9bff('0x5'));var moment=require(_0x9bff('0x6'));var BPromise=require(_0x9bff('0x7'));var Mustache=require(_0x9bff('0x8'));var util=require(_0x9bff('0x9'));var path=require(_0x9bff('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9bff('0xb'));var fs=require('fs');var _=require(_0x9bff('0xc'));var squel=require(_0x9bff('0xd'));var crypto=require(_0x9bff('0xe'));var jsforce=require(_0x9bff('0xf'));var deskjs=require(_0x9bff('0x10'));var toCsv=require(_0x9bff('0x11'));var querystring=require(_0x9bff('0x12'));var Papa=require(_0x9bff('0x13'));var Redis=require(_0x9bff('0x14'));var authService=require(_0x9bff('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x9bff('0x16'));var hardwareService=require(_0x9bff('0x17'));var logger=require(_0x9bff('0x18'))('api');var utils=require(_0x9bff('0x19'));var config=require(_0x9bff('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14525a,_0x4d09c6){_0x4d09c6=_0x4d09c6||0xcc;return function(_0x544a43){if(_0x544a43){return _0x14525a[_0x9bff('0x1b')](_0x4d09c6);}return _0x14525a[_0x9bff('0x1c')](_0x4d09c6)[_0x9bff('0x1d')]();};}function respondWithResult(_0x1b794e,_0x4267f1){_0x4267f1=_0x4267f1||0xc8;return function(_0x6f83e2){if(_0x6f83e2){return _0x1b794e[_0x9bff('0x1c')](_0x4267f1)['json'](_0x6f83e2);}};}function respondWithFilteredResult(_0x3b03e8,_0xdfc01){return function(_0x16a9f9){if(_0x16a9f9){var _0x3bd97f=_0x16a9f9[_0x9bff('0x1e')],_0x759878=_0xdfc01[_0x9bff('0x1f')],_0x58cacb=_0xdfc01[_0x9bff('0x1f')]+_0xdfc01['limit'],_0x470048;if(_0x58cacb>=_0x3bd97f){_0x58cacb=_0x3bd97f;_0x470048=0xc8;}else{_0x470048=0xce;}_0x3b03e8[_0x9bff('0x1c')](_0x470048);return _0x3b03e8[_0x9bff('0x20')](_0x9bff('0x21'),_0x759878+'-'+_0x58cacb+'/'+_0x3bd97f)[_0x9bff('0x22')](_0x16a9f9);}return null;};}function patchUpdates(_0x5cfbd8){return function(_0x44564e){try{jsonpatch[_0x9bff('0x23')](_0x44564e,_0x5cfbd8,!![]);}catch(_0x2d2a70){return BPromise['reject'](_0x2d2a70);}return _0x44564e[_0x9bff('0x24')]();};}function saveUpdates(_0x1a7ae3,_0x101a32){return function(_0xf9eecd){if(_0xf9eecd){return _0xf9eecd[_0x9bff('0x25')](_0x1a7ae3)['then'](function(_0x4b189a){return _0x4b189a;});}return null;};}function removeEntity(_0x2c4fe2,_0x5ccc46){return function(_0x2a642e){if(_0x2a642e){return _0x2a642e['destroy']()[_0x9bff('0x26')](function(){_0x2c4fe2[_0x9bff('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x583762,_0x52b998){return function(_0x291572){if(!_0x291572){_0x583762[_0x9bff('0x1b')](0x194);}return _0x291572;};}function handleError(_0x3a9575,_0x1f96e0){_0x1f96e0=_0x1f96e0||0x1f4;return function(_0x5da5b1){logger[_0x9bff('0x27')](_0x5da5b1[_0x9bff('0x28')]);if(_0x5da5b1['name']){delete _0x5da5b1[_0x9bff('0x29')];}_0x3a9575['status'](_0x1f96e0)[_0x9bff('0x2a')](_0x5da5b1);};}exports[_0x9bff('0x2b')]=function(_0x55a93b,_0x1b099d){var _0x4f286f={},_0x21a1cf={},_0x39bf10={'count':0x0,'rows':[]};var _0x3941cd=_[_0x9bff('0x2c')](db[_0x9bff('0x2d')][_0x9bff('0x2e')],function(_0x1e9bab){return{'name':_0x1e9bab[_0x9bff('0x2f')],'type':_0x1e9bab[_0x9bff('0x30')][_0x9bff('0x31')]};});_0x21a1cf['model']=_[_0x9bff('0x2c')](_0x3941cd,_0x9bff('0x29'));_0x21a1cf['query']=_[_0x9bff('0x32')](_0x55a93b[_0x9bff('0x33')]);_0x21a1cf[_0x9bff('0x34')]=_[_0x9bff('0x35')](_0x21a1cf[_0x9bff('0x36')],_0x21a1cf['query']);_0x4f286f[_0x9bff('0x37')]=_[_0x9bff('0x35')](_0x21a1cf[_0x9bff('0x36')],qs[_0x9bff('0x38')](_0x55a93b['query'][_0x9bff('0x38')]));_0x4f286f[_0x9bff('0x37')]=_0x4f286f['attributes']['length']?_0x4f286f['attributes']:_0x21a1cf[_0x9bff('0x36')];if(!_0x55a93b[_0x9bff('0x33')][_0x9bff('0x39')](_0x9bff('0x3a'))){_0x4f286f[_0x9bff('0x3b')]=qs[_0x9bff('0x3b')](_0x55a93b[_0x9bff('0x33')][_0x9bff('0x3b')]);_0x4f286f[_0x9bff('0x1f')]=qs['offset'](_0x55a93b[_0x9bff('0x33')]['offset']);}_0x4f286f[_0x9bff('0x3c')]=qs[_0x9bff('0x3d')](_0x55a93b[_0x9bff('0x33')][_0x9bff('0x3d')]);_0x4f286f[_0x9bff('0x3e')]=qs[_0x9bff('0x34')](_['pick'](_0x55a93b[_0x9bff('0x33')],_0x21a1cf[_0x9bff('0x34')]),_0x3941cd);if(_0x55a93b[_0x9bff('0x33')]['filter']){_0x4f286f[_0x9bff('0x3e')]=_['merge'](_0x4f286f[_0x9bff('0x3e')],{'$or':_[_0x9bff('0x2c')](_0x3941cd,function(_0x59e912){if(_0x59e912[_0x9bff('0x30')]!==_0x9bff('0x3f')){var _0x31a2d0={};_0x31a2d0[_0x59e912[_0x9bff('0x29')]]={'$like':'%'+_0x55a93b[_0x9bff('0x33')]['filter']+'%'};return _0x31a2d0;}})});}_0x4f286f=_[_0x9bff('0x40')]({},_0x4f286f,_0x55a93b[_0x9bff('0x41')]);var _0x17da8c={'where':_0x4f286f[_0x9bff('0x3e')]};return db[_0x9bff('0x2d')][_0x9bff('0x1e')](_0x17da8c)['then'](function(_0x17d534){_0x39bf10['count']=_0x17d534;if(_0x55a93b[_0x9bff('0x33')][_0x9bff('0x42')]){_0x4f286f[_0x9bff('0x43')]=[{'all':!![]}];}return db[_0x9bff('0x2d')][_0x9bff('0x44')](_0x4f286f);})[_0x9bff('0x26')](function(_0x2fe6df){_0x39bf10[_0x9bff('0x45')]=_0x2fe6df;return _0x39bf10;})[_0x9bff('0x26')](respondWithFilteredResult(_0x1b099d,_0x4f286f))[_0x9bff('0x46')](handleError(_0x1b099d,null));};exports[_0x9bff('0x47')]=function(_0x59c47d,_0x29af63){var _0x1120fe={'raw':!![],'where':{'id':_0x59c47d[_0x9bff('0x48')]['id']}},_0x4a99c8={};_0x4a99c8[_0x9bff('0x36')]=_[_0x9bff('0x32')](db[_0x9bff('0x2d')][_0x9bff('0x2e')]);_0x4a99c8[_0x9bff('0x33')]=_[_0x9bff('0x32')](_0x59c47d[_0x9bff('0x33')]);_0x4a99c8[_0x9bff('0x34')]=_['intersection'](_0x4a99c8[_0x9bff('0x36')],_0x4a99c8['query']);_0x1120fe[_0x9bff('0x37')]=_['intersection'](_0x4a99c8['model'],qs['fields'](_0x59c47d['query']['fields']));_0x1120fe[_0x9bff('0x37')]=_0x1120fe[_0x9bff('0x37')]['length']?_0x1120fe[_0x9bff('0x37')]:_0x4a99c8['model'];if(_0x59c47d[_0x9bff('0x33')]['includeAll']){_0x1120fe['include']=[{'all':!![]}];}_0x1120fe=_[_0x9bff('0x40')]({},_0x1120fe,_0x59c47d[_0x9bff('0x41')]);return db['JscriptySessionReport'][_0x9bff('0x49')](_0x1120fe)[_0x9bff('0x26')](handleEntityNotFound(_0x29af63,null))[_0x9bff('0x26')](respondWithResult(_0x29af63,null))[_0x9bff('0x46')](handleError(_0x29af63,null));};exports['create']=function(_0x2877bc,_0x373a37){return db['JscriptySessionReport'][_0x9bff('0x4a')](_0x2877bc['body'],{})[_0x9bff('0x26')](respondWithResult(_0x373a37,0xc9))[_0x9bff('0x46')](handleError(_0x373a37,null));};exports[_0x9bff('0x25')]=function(_0x3a7334,_0x7033a){if(_0x3a7334['body']['id']){delete _0x3a7334[_0x9bff('0x4b')]['id'];}return db[_0x9bff('0x2d')][_0x9bff('0x49')]({'where':{'id':_0x3a7334['params']['id']}})[_0x9bff('0x26')](handleEntityNotFound(_0x7033a,null))[_0x9bff('0x26')](saveUpdates(_0x3a7334[_0x9bff('0x4b')],null))[_0x9bff('0x26')](respondWithResult(_0x7033a,null))[_0x9bff('0x46')](handleError(_0x7033a,null));};exports[_0x9bff('0x4c')]=function(_0x4c4fec,_0x4faab8){return db[_0x9bff('0x2d')][_0x9bff('0x49')]({'where':{'id':_0x4c4fec[_0x9bff('0x48')]['id']}})[_0x9bff('0x26')](handleEntityNotFound(_0x4faab8,null))[_0x9bff('0x26')](removeEntity(_0x4faab8,null))[_0x9bff('0x46')](handleError(_0x4faab8,null));};exports['describe']=function(_0x160e20,_0x508f1e){return db[_0x9bff('0x2d')][_0x9bff('0x4d')]()['then'](respondWithResult(_0x508f1e,null))[_0x9bff('0x46')](handleError(_0x508f1e,null));};exports[_0x9bff('0x4e')]=function(_0x48d123,_0x5e4827,_0x244389){var _0xd03244={'raw':!![],'where':{}};var _0x39dfa4={};var _0x1f9c4b={'count':0x0,'rows':[]};return db[_0x9bff('0x2d')][_0x9bff('0x4f')]({'where':{'id':_0x48d123['params']['id']}})[_0x9bff('0x26')](handleEntityNotFound(_0x5e4827,null))[_0x9bff('0x26')](function(_0x1231f9){if(_0x1231f9){_0x39dfa4['model']=_[_0x9bff('0x32')](db[_0x9bff('0x50')]['rawAttributes']);_0x39dfa4[_0x9bff('0x33')]=_[_0x9bff('0x32')](_0x48d123[_0x9bff('0x33')]);_0x39dfa4[_0x9bff('0x34')]=_['intersection'](_0x39dfa4[_0x9bff('0x36')],_0x39dfa4[_0x9bff('0x33')]);_0xd03244[_0x9bff('0x37')]=_[_0x9bff('0x35')](_0x39dfa4[_0x9bff('0x36')],qs[_0x9bff('0x38')](_0x48d123[_0x9bff('0x33')][_0x9bff('0x38')]));_0xd03244[_0x9bff('0x37')]=_0xd03244[_0x9bff('0x37')][_0x9bff('0x51')]?_0xd03244[_0x9bff('0x37')]:_0x39dfa4[_0x9bff('0x36')];if(!_0x48d123[_0x9bff('0x33')]['hasOwnProperty'](_0x9bff('0x3a'))){_0xd03244[_0x9bff('0x3b')]=qs['limit'](_0x48d123[_0x9bff('0x33')][_0x9bff('0x3b')]);_0xd03244['offset']=qs[_0x9bff('0x1f')](_0x48d123[_0x9bff('0x33')]['offset']);}_0xd03244[_0x9bff('0x3c')]=qs[_0x9bff('0x3d')](_0x48d123['query']['sort']);_0xd03244[_0x9bff('0x3e')]=qs[_0x9bff('0x34')](_[_0x9bff('0x52')](_0x48d123['query'],_0x39dfa4[_0x9bff('0x34')]));_0xd03244['where'][_0x9bff('0x53')]=_0x1231f9['id'];if(_0x48d123[_0x9bff('0x33')][_0x9bff('0x54')]){_0xd03244[_0x9bff('0x3e')]=_[_0x9bff('0x40')](_0xd03244[_0x9bff('0x3e')],{'$or':_['map'](_0xd03244['attributes'],function(_0x36543e){var _0x58a207={};_0x58a207[_0x36543e]={'$like':'%'+_0x48d123['query']['filter']+'%'};return _0x58a207;})});}_0xd03244=_['merge']({},_0xd03244,_0x48d123['options']);return db['JscriptyQuestionReport']['count']({'where':_0xd03244['where']})['then'](function(_0x1fe8a1){_0x1f9c4b[_0x9bff('0x1e')]=_0x1fe8a1;if(_0x48d123[_0x9bff('0x33')][_0x9bff('0x42')]){_0xd03244['include']=[{'all':!![]}];}return db[_0x9bff('0x50')][_0x9bff('0x44')](_0xd03244);})[_0x9bff('0x26')](function(_0x3db4d3){_0x1f9c4b[_0x9bff('0x45')]=_0x3db4d3;return _0x1f9c4b;});}})['then'](respondWithFilteredResult(_0x5e4827,_0xd03244))['catch'](handleError(_0x5e4827,null));}; \ No newline at end of file +var _0x796e=['query','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','keys','merge','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','filters','order','SessionId','findAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','save','update','destroy','then','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','model'];(function(_0x1a0a00,_0x5f41ad){var _0x93cc23=function(_0x3bf87b){while(--_0x3bf87b){_0x1a0a00['push'](_0x1a0a00['shift']());}};_0x93cc23(++_0x5f41ad);}(_0x796e,0x14c));var _0xe796=function(_0x2d4f7b,_0x25f2ec){_0x2d4f7b=_0x2d4f7b-0x0;var _0x39533d=_0x796e[_0x2d4f7b];return _0x39533d;};'use strict';var pdf=require(_0xe796('0x0'));var emlformat=require(_0xe796('0x1'));var rimraf=require(_0xe796('0x2'));var zipdir=require(_0xe796('0x3'));var jsonpatch=require(_0xe796('0x4'));var rp=require('request-promise');var moment=require(_0xe796('0x5'));var BPromise=require(_0xe796('0x6'));var Mustache=require('mustache');var util=require(_0xe796('0x7'));var path=require('path');var sox=require(_0xe796('0x8'));var csv=require('to-csv');var ejs=require(_0xe796('0x9'));var fs=require('fs');var _=require(_0xe796('0xa'));var squel=require(_0xe796('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe796('0xc'));var toCsv=require(_0xe796('0xd'));var querystring=require(_0xe796('0xe'));var Papa=require(_0xe796('0xf'));var Redis=require('ioredis');var authService=require(_0xe796('0x10'));var qs=require(_0xe796('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe796('0x12'));var logger=require(_0xe796('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xe796('0x14'))['db'];function respondWithStatusCode(_0x363018,_0xcf59ce){_0xcf59ce=_0xcf59ce||0xcc;return function(_0x43043e){if(_0x43043e){return _0x363018[_0xe796('0x15')](_0xcf59ce);}return _0x363018[_0xe796('0x16')](_0xcf59ce)['end']();};}function respondWithResult(_0x2ef8d4,_0x2dff50){_0x2dff50=_0x2dff50||0xc8;return function(_0x5d4e48){if(_0x5d4e48){return _0x2ef8d4['status'](_0x2dff50)[_0xe796('0x17')](_0x5d4e48);}};}function respondWithFilteredResult(_0x18693e,_0x324da6){return function(_0x1abbb0){if(_0x1abbb0){var _0x437fbb=_0x1abbb0['count'],_0x391fcb=_0x324da6['offset'],_0x372c84=_0x324da6[_0xe796('0x18')]+_0x324da6[_0xe796('0x19')],_0x48906d;if(_0x372c84>=_0x437fbb){_0x372c84=_0x437fbb;_0x48906d=0xc8;}else{_0x48906d=0xce;}_0x18693e[_0xe796('0x16')](_0x48906d);return _0x18693e[_0xe796('0x1a')](_0xe796('0x1b'),_0x391fcb+'-'+_0x372c84+'/'+_0x437fbb)[_0xe796('0x17')](_0x1abbb0);}return null;};}function patchUpdates(_0x33aa88){return function(_0x364896){try{jsonpatch['apply'](_0x364896,_0x33aa88,!![]);}catch(_0x1876fc){return BPromise['reject'](_0x1876fc);}return _0x364896[_0xe796('0x1c')]();};}function saveUpdates(_0x8297fb,_0x3e125b){return function(_0x17d2c7){if(_0x17d2c7){return _0x17d2c7[_0xe796('0x1d')](_0x8297fb)['then'](function(_0x4a72a3){return _0x4a72a3;});}return null;};}function removeEntity(_0x223ccd,_0x4a6e30){return function(_0x5ef604){if(_0x5ef604){return _0x5ef604[_0xe796('0x1e')]()[_0xe796('0x1f')](function(){_0x223ccd[_0xe796('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x461b96,_0x46feb4){return function(_0x5c6b4c){if(!_0x5c6b4c){_0x461b96['sendStatus'](0x194);}return _0x5c6b4c;};}function handleError(_0xcf5d76,_0x6f1f87){_0x6f1f87=_0x6f1f87||0x1f4;return function(_0x6c1b6b){logger[_0xe796('0x20')](_0x6c1b6b[_0xe796('0x21')]);if(_0x6c1b6b[_0xe796('0x22')]){delete _0x6c1b6b[_0xe796('0x22')];}_0xcf5d76[_0xe796('0x16')](_0x6f1f87)[_0xe796('0x23')](_0x6c1b6b);};}exports[_0xe796('0x24')]=function(_0x28cb5b,_0x1ef4d1){var _0x575fe7={},_0x5edc38={},_0x1ab86b={'count':0x0,'rows':[]};var _0x308f90=_[_0xe796('0x25')](db[_0xe796('0x26')][_0xe796('0x27')],function(_0x54645c){return{'name':_0x54645c[_0xe796('0x28')],'type':_0x54645c[_0xe796('0x29')]['key']};});_0x5edc38[_0xe796('0x2a')]=_['map'](_0x308f90,_0xe796('0x22'));_0x5edc38[_0xe796('0x2b')]=_['keys'](_0x28cb5b[_0xe796('0x2b')]);_0x5edc38['filters']=_[_0xe796('0x2c')](_0x5edc38[_0xe796('0x2a')],_0x5edc38[_0xe796('0x2b')]);_0x575fe7[_0xe796('0x2d')]=_[_0xe796('0x2c')](_0x5edc38[_0xe796('0x2a')],qs[_0xe796('0x2e')](_0x28cb5b[_0xe796('0x2b')]['fields']));_0x575fe7[_0xe796('0x2d')]=_0x575fe7[_0xe796('0x2d')][_0xe796('0x2f')]?_0x575fe7[_0xe796('0x2d')]:_0x5edc38[_0xe796('0x2a')];if(!_0x28cb5b[_0xe796('0x2b')]['hasOwnProperty'](_0xe796('0x30'))){_0x575fe7[_0xe796('0x19')]=qs[_0xe796('0x19')](_0x28cb5b[_0xe796('0x2b')][_0xe796('0x19')]);_0x575fe7[_0xe796('0x18')]=qs[_0xe796('0x18')](_0x28cb5b['query'][_0xe796('0x18')]);}_0x575fe7['order']=qs[_0xe796('0x31')](_0x28cb5b[_0xe796('0x2b')]['sort']);_0x575fe7['where']=qs['filters'](_[_0xe796('0x32')](_0x28cb5b[_0xe796('0x2b')],_0x5edc38['filters']),_0x308f90);if(_0x28cb5b[_0xe796('0x2b')][_0xe796('0x33')]){_0x575fe7[_0xe796('0x34')]=_['merge'](_0x575fe7[_0xe796('0x34')],{'$or':_[_0xe796('0x25')](_0x308f90,function(_0x489e8f){if(_0x489e8f[_0xe796('0x29')]!==_0xe796('0x35')){var _0x2be36f={};_0x2be36f[_0x489e8f['name']]={'$like':'%'+_0x28cb5b[_0xe796('0x2b')][_0xe796('0x33')]+'%'};return _0x2be36f;}})});}_0x575fe7=_['merge']({},_0x575fe7,_0x28cb5b[_0xe796('0x36')]);var _0x197e35={'where':_0x575fe7['where']};return db[_0xe796('0x26')][_0xe796('0x37')](_0x197e35)[_0xe796('0x1f')](function(_0x3fd560){_0x1ab86b[_0xe796('0x37')]=_0x3fd560;if(_0x28cb5b[_0xe796('0x2b')][_0xe796('0x38')]){_0x575fe7[_0xe796('0x39')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x575fe7);})[_0xe796('0x1f')](function(_0x4a0c24){_0x1ab86b[_0xe796('0x3a')]=_0x4a0c24;return _0x1ab86b;})[_0xe796('0x1f')](respondWithFilteredResult(_0x1ef4d1,_0x575fe7))[_0xe796('0x3b')](handleError(_0x1ef4d1,null));};exports[_0xe796('0x3c')]=function(_0xa10ed7,_0x23e005){var _0x131fbc={'raw':!![],'where':{'id':_0xa10ed7[_0xe796('0x3d')]['id']}},_0x1988a0={};_0x1988a0['model']=_[_0xe796('0x3e')](db[_0xe796('0x26')][_0xe796('0x27')]);_0x1988a0[_0xe796('0x2b')]=_[_0xe796('0x3e')](_0xa10ed7[_0xe796('0x2b')]);_0x1988a0['filters']=_[_0xe796('0x2c')](_0x1988a0[_0xe796('0x2a')],_0x1988a0[_0xe796('0x2b')]);_0x131fbc['attributes']=_[_0xe796('0x2c')](_0x1988a0[_0xe796('0x2a')],qs['fields'](_0xa10ed7['query'][_0xe796('0x2e')]));_0x131fbc[_0xe796('0x2d')]=_0x131fbc[_0xe796('0x2d')][_0xe796('0x2f')]?_0x131fbc['attributes']:_0x1988a0[_0xe796('0x2a')];if(_0xa10ed7[_0xe796('0x2b')][_0xe796('0x38')]){_0x131fbc['include']=[{'all':!![]}];}_0x131fbc=_[_0xe796('0x3f')]({},_0x131fbc,_0xa10ed7[_0xe796('0x36')]);return db[_0xe796('0x26')][_0xe796('0x40')](_0x131fbc)[_0xe796('0x1f')](handleEntityNotFound(_0x23e005,null))['then'](respondWithResult(_0x23e005,null))[_0xe796('0x3b')](handleError(_0x23e005,null));};exports[_0xe796('0x41')]=function(_0x3f461a,_0xed5a16){return db[_0xe796('0x26')][_0xe796('0x41')](_0x3f461a[_0xe796('0x42')],{})[_0xe796('0x1f')](respondWithResult(_0xed5a16,0xc9))[_0xe796('0x3b')](handleError(_0xed5a16,null));};exports['update']=function(_0x1aa6e9,_0x3829af){if(_0x1aa6e9[_0xe796('0x42')]['id']){delete _0x1aa6e9['body']['id'];}return db[_0xe796('0x26')]['find']({'where':{'id':_0x1aa6e9[_0xe796('0x3d')]['id']}})[_0xe796('0x1f')](handleEntityNotFound(_0x3829af,null))['then'](saveUpdates(_0x1aa6e9[_0xe796('0x42')],null))[_0xe796('0x1f')](respondWithResult(_0x3829af,null))[_0xe796('0x3b')](handleError(_0x3829af,null));};exports[_0xe796('0x1e')]=function(_0x4a6f94,_0x41ba25){return db['JscriptySessionReport']['find']({'where':{'id':_0x4a6f94[_0xe796('0x3d')]['id']}})[_0xe796('0x1f')](handleEntityNotFound(_0x41ba25,null))[_0xe796('0x1f')](removeEntity(_0x41ba25,null))[_0xe796('0x3b')](handleError(_0x41ba25,null));};exports[_0xe796('0x43')]=function(_0x2597d6,_0x59fca8){return db[_0xe796('0x26')]['describe']()[_0xe796('0x1f')](respondWithResult(_0x59fca8,null))['catch'](handleError(_0x59fca8,null));};exports[_0xe796('0x44')]=function(_0x1cba40,_0xe70a61,_0x5140ff){var _0x2216ec={'raw':!![],'where':{}};var _0x348408={};var _0x59d570={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xe796('0x45')]({'where':{'id':_0x1cba40[_0xe796('0x3d')]['id']}})[_0xe796('0x1f')](handleEntityNotFound(_0xe70a61,null))[_0xe796('0x1f')](function(_0x2c9eec){if(_0x2c9eec){_0x348408[_0xe796('0x2a')]=_[_0xe796('0x3e')](db[_0xe796('0x46')][_0xe796('0x27')]);_0x348408['query']=_['keys'](_0x1cba40['query']);_0x348408[_0xe796('0x47')]=_[_0xe796('0x2c')](_0x348408[_0xe796('0x2a')],_0x348408[_0xe796('0x2b')]);_0x2216ec[_0xe796('0x2d')]=_[_0xe796('0x2c')](_0x348408[_0xe796('0x2a')],qs['fields'](_0x1cba40[_0xe796('0x2b')][_0xe796('0x2e')]));_0x2216ec['attributes']=_0x2216ec['attributes']['length']?_0x2216ec[_0xe796('0x2d')]:_0x348408[_0xe796('0x2a')];if(!_0x1cba40['query']['hasOwnProperty']('nolimit')){_0x2216ec[_0xe796('0x19')]=qs['limit'](_0x1cba40[_0xe796('0x2b')][_0xe796('0x19')]);_0x2216ec[_0xe796('0x18')]=qs[_0xe796('0x18')](_0x1cba40[_0xe796('0x2b')]['offset']);}_0x2216ec[_0xe796('0x48')]=qs[_0xe796('0x31')](_0x1cba40[_0xe796('0x2b')][_0xe796('0x31')]);_0x2216ec['where']=qs['filters'](_[_0xe796('0x32')](_0x1cba40[_0xe796('0x2b')],_0x348408[_0xe796('0x47')]));_0x2216ec[_0xe796('0x34')][_0xe796('0x49')]=_0x2c9eec['id'];if(_0x1cba40[_0xe796('0x2b')]['filter']){_0x2216ec['where']=_['merge'](_0x2216ec['where'],{'$or':_[_0xe796('0x25')](_0x2216ec[_0xe796('0x2d')],function(_0x15992f){var _0x57598e={};_0x57598e[_0x15992f]={'$like':'%'+_0x1cba40['query'][_0xe796('0x33')]+'%'};return _0x57598e;})});}_0x2216ec=_['merge']({},_0x2216ec,_0x1cba40['options']);return db[_0xe796('0x46')][_0xe796('0x37')]({'where':_0x2216ec['where']})[_0xe796('0x1f')](function(_0x1b7642){_0x59d570[_0xe796('0x37')]=_0x1b7642;if(_0x1cba40[_0xe796('0x2b')][_0xe796('0x38')]){_0x2216ec[_0xe796('0x39')]=[{'all':!![]}];}return db[_0xe796('0x46')][_0xe796('0x4a')](_0x2216ec);})[_0xe796('0x1f')](function(_0x1a8a43){_0x59d570[_0xe796('0x3a')]=_0x1a8a43;return _0x59d570;});}})[_0xe796('0x1f')](respondWithFilteredResult(_0xe70a61,_0x2216ec))[_0xe796('0x3b')](handleError(_0xe70a61,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 9ce037a..dc4abee 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 _0x2da6=['moment','bluebird','request-promise','path','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api'];(function(_0x36203b,_0x276a0b){var _0x398976=function(_0x4a6d6e){while(--_0x4a6d6e){_0x36203b['push'](_0x36203b['shift']());}};_0x398976(++_0x276a0b);}(_0x2da6,0x1dd));var _0x62da=function(_0x467fa3,_0x2fde69){_0x467fa3=_0x467fa3-0x0;var _0x563559=_0x2da6[_0x467fa3];return _0x563559;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var logger=require(_0x62da('0x2'))(_0x62da('0x3'));var moment=require(_0x62da('0x4'));var BPromise=require(_0x62da('0x5'));var rp=require(_0x62da('0x6'));var fs=require('fs');var path=require(_0x62da('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x62da('0x8'));module[_0x62da('0x9')]=function(_0x3a59f8,_0x30437f){return _0x3a59f8[_0x62da('0xa')](_0x62da('0xb'),attributes,{'tableName':_0x62da('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd481=['lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','JscriptySessionReport','report_jscripty_sessions'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0xd481,0x1e4));var _0x1d48=function(_0x4a3f72,_0x2b3f67){_0x4a3f72=_0x4a3f72-0x0;var _0x2d184d=_0xd481[_0x4a3f72];return _0x2d184d;};'use strict';var _=require(_0x1d48('0x0'));var util=require('util');var logger=require(_0x1d48('0x1'))(_0x1d48('0x2'));var moment=require('moment');var BPromise=require(_0x1d48('0x3'));var rp=require(_0x1d48('0x4'));var fs=require('fs');var path=require(_0x1d48('0x5'));var rimraf=require('rimraf');var config=require(_0x1d48('0x6'));var attributes=require('./jscriptySessionReport.attributes');module[_0x1d48('0x7')]=function(_0x2a4830,_0x5a0c28){return _0x2a4830[_0x1d48('0x8')](_0x1d48('0x9'),attributes,{'tableName':_0x1d48('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 78080d1..9d58557 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 _0xa759=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment'];(function(_0x57a068,_0x2557ac){var _0x5542ff=function(_0x2cd3dc){while(--_0x2cd3dc){_0x57a068['push'](_0x57a068['shift']());}};_0x5542ff(++_0x2557ac);}(_0xa759,0x1dd));var _0x9a75=function(_0x2675da,_0x5a250e){_0x2675da=_0x2675da-0x0;var _0x5e6153=_0xa759[_0x2675da];return _0x5e6153;};'use strict';var _=require(_0x9a75('0x0'));var util=require(_0x9a75('0x1'));var moment=require(_0x9a75('0x2'));var BPromise=require(_0x9a75('0x3'));var rs=require(_0x9a75('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9a75('0x5'));var logger=require(_0x9a75('0x6'))(_0x9a75('0x7'));var config=require(_0x9a75('0x8'));var jayson=require(_0x9a75('0x9'));var client=jayson[_0x9a75('0xa')][_0x9a75('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3de1d3,_0x5609cb,_0x2878df){return new BPromise(function(_0x48a4ad,_0x4b0ce5){return client[_0x9a75('0xc')](_0x3de1d3,_0x2878df)[_0x9a75('0xd')](function(_0x1e774a){logger[_0x9a75('0xe')](_0x9a75('0xf'),_0x5609cb,_0x9a75('0x10'));logger[_0x9a75('0x11')](_0x9a75('0x12'),_0x5609cb,_0x9a75('0x10'),JSON['stringify'](_0x1e774a));if(_0x1e774a[_0x9a75('0x13')]){if(_0x1e774a[_0x9a75('0x13')][_0x9a75('0x14')]===0x1f4){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x5609cb,_0x1e774a['error'][_0x9a75('0x15')]);return _0x4b0ce5(_0x1e774a['error'][_0x9a75('0x15')]);}logger[_0x9a75('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x5609cb,_0x1e774a[_0x9a75('0x13')][_0x9a75('0x15')]);return _0x48a4ad(_0x1e774a['error']['message']);}else{logger[_0x9a75('0xe')](_0x9a75('0xf'),_0x5609cb,_0x9a75('0x10'));_0x48a4ad(_0x1e774a[_0x9a75('0x16')][_0x9a75('0x15')]);}})[_0x9a75('0x17')](function(_0x4cd602){logger[_0x9a75('0x13')](_0x9a75('0xf'),_0x5609cb,_0x4cd602);_0x4b0ce5(_0x4cd602);});});} \ No newline at end of file +var _0xe492=['catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x3c6c9b,_0x33e5e3){var _0x3a94dd=function(_0x38ef2e){while(--_0x38ef2e){_0x3c6c9b['push'](_0x3c6c9b['shift']());}};_0x3a94dd(++_0x33e5e3);}(_0xe492,0xf8));var _0x2e49=function(_0x2b77d0,_0x11f932){_0x2b77d0=_0x2b77d0-0x0;var _0x3b1d83=_0xe492[_0x2b77d0];return _0x3b1d83;};'use strict';var _=require(_0x2e49('0x0'));var util=require(_0x2e49('0x1'));var moment=require(_0x2e49('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e49('0x3'));var db=require(_0x2e49('0x4'))['db'];var utils=require(_0x2e49('0x5'));var logger=require(_0x2e49('0x6'))(_0x2e49('0x7'));var config=require('../../config/environment');var jayson=require(_0x2e49('0x8'));var client=jayson[_0x2e49('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c05ed,_0x212e47,_0x579a81){return new BPromise(function(_0x456e5d,_0x3bfa46){return client['request'](_0x5c05ed,_0x579a81)[_0x2e49('0xa')](function(_0x21b2ab){logger['info'](_0x2e49('0xb'),_0x212e47,_0x2e49('0xc'));logger[_0x2e49('0xd')](_0x2e49('0xe'),_0x212e47,_0x2e49('0xc'),JSON['stringify'](_0x21b2ab));if(_0x21b2ab[_0x2e49('0xf')]){if(_0x21b2ab[_0x2e49('0xf')]['code']===0x1f4){logger[_0x2e49('0xf')](_0x2e49('0xb'),_0x212e47,_0x21b2ab['error'][_0x2e49('0x10')]);return _0x3bfa46(_0x21b2ab[_0x2e49('0xf')][_0x2e49('0x10')]);}logger[_0x2e49('0xf')](_0x2e49('0xb'),_0x212e47,_0x21b2ab['error'][_0x2e49('0x10')]);return _0x456e5d(_0x21b2ab[_0x2e49('0xf')][_0x2e49('0x10')]);}else{logger[_0x2e49('0x11')](_0x2e49('0xb'),_0x212e47,_0x2e49('0xc'));_0x456e5d(_0x21b2ab['result'][_0x2e49('0x10')]);}})[_0x2e49('0x12')](function(_0x22790a){logger[_0x2e49('0xf')](_0x2e49('0xb'),_0x212e47,_0x22790a);_0x3bfa46(_0x22790a);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index e036664..c5f9a9b 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 _0xa198=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','put','isAuthenticated','update'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0xa198,0x144));var _0x8a19=function(_0x2e1bd4,_0x373905){_0x2e1bd4=_0x2e1bd4-0x0;var _0x33b5d3=_0xa198[_0x2e1bd4];return _0x33b5d3;};'use strict';var multer=require('multer');var util=require(_0x8a19('0x0'));var path=require(_0x8a19('0x1'));var timeout=require(_0x8a19('0x2'));var express=require(_0x8a19('0x3'));var router=express['Router']();var auth=require(_0x8a19('0x4'));var interaction=require(_0x8a19('0x5'));var config=require(_0x8a19('0x6'));var controller=require(_0x8a19('0x7'));router[_0x8a19('0x8')]('/',controller['index']);router[_0x8a19('0x9')]('/:id',auth[_0x8a19('0xa')](),controller[_0x8a19('0xb')]);module['exports']=router; \ No newline at end of file +var _0xa4e6=['put','/:id','isAuthenticated','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./license.controller','get','index'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xa4e6,0xd6));var _0x6a4e=function(_0x37eaf9,_0x1ccf58){_0x37eaf9=_0x37eaf9-0x0;var _0x2ed2aa=_0xa4e6[_0x37eaf9];return _0x2ed2aa;};'use strict';var multer=require(_0x6a4e('0x0'));var util=require(_0x6a4e('0x1'));var path=require(_0x6a4e('0x2'));var timeout=require(_0x6a4e('0x3'));var express=require(_0x6a4e('0x4'));var router=express[_0x6a4e('0x5')]();var auth=require(_0x6a4e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6a4e('0x7'));var controller=require(_0x6a4e('0x8'));router[_0x6a4e('0x9')]('/',controller[_0x6a4e('0xa')]);router[_0x6a4e('0xb')](_0x6a4e('0xc'),auth[_0x6a4e('0xd')](),controller[_0x6a4e('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 466ffdc..f07838d 100644 --- a/server/api/license/license.attributes.js +++ b/server/api/license/license.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc97=['exports','TEXT','STRING','sequelize'];(function(_0x5d2918,_0x3189a0){var _0x319ea0=function(_0x111ca2){while(--_0x111ca2){_0x5d2918['push'](_0x5d2918['shift']());}};_0x319ea0(++_0x3189a0);}(_0xdc97,0x13b));var _0x7dc9=function(_0x498493,_0x832b76){_0x498493=_0x498493-0x0;var _0x8261b6=_0xdc97[_0x498493];return _0x8261b6;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'license':{'type':Sequelize[_0x7dc9('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x7dc9('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','STRING','INTEGER'];(function(_0x476d4f,_0x33f3ae){var _0x58e61d=function(_0x121c07){while(--_0x121c07){_0x476d4f['push'](_0x476d4f['shift']());}};_0x58e61d(++_0x33f3ae);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2e50a2,_0x27f31e){_0x2e50a2=_0x2e50a2-0x0;var _0x47e5de=_0x5fc3[_0x2e50a2];return _0x47e5de;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x35fc('0x2')]},'data2':{'type':Sequelize[_0x35fc('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x35fc('0x3')],'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 df78153..5e6bea6 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 _0x3502=['reject','then','error','stack','name','send','../../config/license/util','index','model','keys','License','rawAttributes','query','filters','attributes','intersection','fields','length','getLicense','catch','update','body','find','params','get','checkLicense','key','demo','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3502,0x148));var _0x2350=function(_0x16c8bb,_0x49d6a7){_0x16c8bb=_0x16c8bb-0x0;var _0x3b0c30=_0x3502[_0x16c8bb];return _0x3b0c30;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2350('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2350('0x1'));var rp=require(_0x2350('0x2'));var moment=require(_0x2350('0x3'));var BPromise=require(_0x2350('0x4'));var Mustache=require(_0x2350('0x5'));var util=require(_0x2350('0x6'));var path=require(_0x2350('0x7'));var sox=require(_0x2350('0x8'));var csv=require(_0x2350('0x9'));var ejs=require(_0x2350('0xa'));var fs=require('fs');var _=require(_0x2350('0xb'));var squel=require(_0x2350('0xc'));var crypto=require('crypto');var jsforce=require(_0x2350('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2350('0x9'));var querystring=require(_0x2350('0xe'));var Papa=require(_0x2350('0xf'));var Redis=require(_0x2350('0x10'));var authService=require(_0x2350('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2350('0x12'));var logger=require(_0x2350('0x13'))('api');var utils=require(_0x2350('0x14'));var config=require(_0x2350('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e69bb,_0x4f73b8){_0x4f73b8=_0x4f73b8||0xcc;return function(_0xa997d2){if(_0xa997d2){return _0x2e69bb[_0x2350('0x16')](_0x4f73b8);}return _0x2e69bb[_0x2350('0x17')](_0x4f73b8)[_0x2350('0x18')]();};}function respondWithResult(_0x12479b,_0x516ffe){_0x516ffe=_0x516ffe||0xc8;return function(_0x2f41cb){if(_0x2f41cb){return _0x12479b[_0x2350('0x17')](_0x516ffe)[_0x2350('0x19')](_0x2f41cb);}};}function respondWithFilteredResult(_0x148b38,_0xbd2715){return function(_0x236b90){if(_0x236b90){var _0x5d0bb1=_0x236b90[_0x2350('0x1a')],_0x51ee7a=_0xbd2715[_0x2350('0x1b')],_0x2b02f5=_0xbd2715[_0x2350('0x1b')]+_0xbd2715[_0x2350('0x1c')],_0x18c3a5;if(_0x2b02f5>=_0x5d0bb1){_0x2b02f5=_0x5d0bb1;_0x18c3a5=0xc8;}else{_0x18c3a5=0xce;}_0x148b38[_0x2350('0x17')](_0x18c3a5);return _0x148b38[_0x2350('0x1d')](_0x2350('0x1e'),_0x51ee7a+'-'+_0x2b02f5+'/'+_0x5d0bb1)[_0x2350('0x19')](_0x236b90);}return null;};}function patchUpdates(_0x96b6ea){return function(_0xc68fff){try{jsonpatch[_0x2350('0x1f')](_0xc68fff,_0x96b6ea,!![]);}catch(_0x4b1029){return BPromise[_0x2350('0x20')](_0x4b1029);}return _0xc68fff['save']();};}function saveUpdates(_0x2815d3,_0x48e872){return function(_0x409a69){if(_0x409a69){return _0x409a69['update'](_0x2815d3)[_0x2350('0x21')](function(_0x3d230b){return _0x3d230b;});}return null;};}function removeEntity(_0x665d54,_0x4a63b9){return function(_0x329e00){if(_0x329e00){return _0x329e00['destroy']()[_0x2350('0x21')](function(){_0x665d54[_0x2350('0x17')](0xcc)[_0x2350('0x18')]();});}};}function handleEntityNotFound(_0x8e406b,_0x4a23a3){return function(_0x2321ba){if(!_0x2321ba){_0x8e406b[_0x2350('0x16')](0x194);}return _0x2321ba;};}function handleError(_0x51eec3,_0x29f885){_0x29f885=_0x29f885||0x1f4;return function(_0x1e53a9){logger[_0x2350('0x22')](_0x1e53a9[_0x2350('0x23')]);if(_0x1e53a9[_0x2350('0x24')]){delete _0x1e53a9[_0x2350('0x24')];}_0x51eec3[_0x2350('0x17')](_0x29f885)[_0x2350('0x25')](_0x1e53a9);};}var utilLicense=require(_0x2350('0x26'));exports[_0x2350('0x27')]=function(_0x130053,_0x4beffe){var _0x5113ad={'raw':!![],'where':{'id':0x1}},_0x1e2a5b={};_0x1e2a5b[_0x2350('0x28')]=_[_0x2350('0x29')](db[_0x2350('0x2a')][_0x2350('0x2b')]);_0x1e2a5b[_0x2350('0x2c')]=_[_0x2350('0x29')](_0x130053[_0x2350('0x2c')]);_0x1e2a5b[_0x2350('0x2d')]=_['intersection'](_0x1e2a5b['model'],_0x1e2a5b['query']);_0x5113ad[_0x2350('0x2e')]=_[_0x2350('0x2f')](_0x1e2a5b[_0x2350('0x28')],qs[_0x2350('0x30')](_0x130053[_0x2350('0x2c')][_0x2350('0x30')]));_0x5113ad[_0x2350('0x2e')]=_0x5113ad[_0x2350('0x2e')][_0x2350('0x31')]?_0x5113ad['attributes']:_0x1e2a5b['model'];_0x5113ad=_['merge']({},_0x5113ad,_0x130053['options']);return utilLicense[_0x2350('0x32')](_0x5113ad)['then'](respondWithResult(_0x4beffe,null))[_0x2350('0x33')](handleError(_0x4beffe,null));};exports[_0x2350('0x34')]=function(_0x14b4d3,_0xa3d3d2){if(_0x14b4d3[_0x2350('0x35')]['id']){delete _0x14b4d3[_0x2350('0x35')]['id'];}return db[_0x2350('0x2a')][_0x2350('0x36')]({'where':{'id':_0x14b4d3[_0x2350('0x37')]['id']}})[_0x2350('0x21')](handleEntityNotFound(_0xa3d3d2,null))[_0x2350('0x21')](function(_0x2594a7){var _0x5d2b8c=_0x2594a7[_0x2350('0x38')]({'plain':!![]});return utilLicense[_0x2350('0x39')](_0x5d2b8c,_0x14b4d3[_0x2350('0x35')][_0x2350('0x3a')]);})['then'](function(_0x55a8c1){if(!_0x55a8c1[_0x2350('0x3b')]){return saveUpdates(_0x14b4d3['body'],null);}return _0x55a8c1;})[_0x2350('0x21')](respondWithResult(_0xa3d3d2,null))[_0x2350('0x33')](handleError(_0xa3d3d2,null));}; \ No newline at end of file +var _0x45ac=['params','get','checkLicense','demo','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','../../config/license/util','index','model','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','body','License','find'];(function(_0x42bd68,_0x4ad8a6){var _0x2c0f9a=function(_0x308f4c){while(--_0x308f4c){_0x42bd68['push'](_0x42bd68['shift']());}};_0x2c0f9a(++_0x4ad8a6);}(_0x45ac,0x110));var _0xc45a=function(_0x1fe7c3,_0x2f7c6e){_0x1fe7c3=_0x1fe7c3-0x0;var _0x490542=_0x45ac[_0x1fe7c3];return _0x490542;};'use strict';var pdf=require(_0xc45a('0x0'));var emlformat=require(_0xc45a('0x1'));var rimraf=require(_0xc45a('0x2'));var zipdir=require(_0xc45a('0x3'));var jsonpatch=require(_0xc45a('0x4'));var rp=require('request-promise');var moment=require(_0xc45a('0x5'));var BPromise=require(_0xc45a('0x6'));var Mustache=require(_0xc45a('0x7'));var util=require(_0xc45a('0x8'));var path=require(_0xc45a('0x9'));var sox=require(_0xc45a('0xa'));var csv=require(_0xc45a('0xb'));var ejs=require(_0xc45a('0xc'));var fs=require('fs');var _=require(_0xc45a('0xd'));var squel=require(_0xc45a('0xe'));var crypto=require(_0xc45a('0xf'));var jsforce=require(_0xc45a('0x10'));var deskjs=require(_0xc45a('0x11'));var toCsv=require(_0xc45a('0xb'));var querystring=require('querystring');var Papa=require(_0xc45a('0x12'));var Redis=require(_0xc45a('0x13'));var authService=require(_0xc45a('0x14'));var qs=require(_0xc45a('0x15'));var as=require(_0xc45a('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc45a('0x17'))(_0xc45a('0x18'));var utils=require(_0xc45a('0x19'));var config=require(_0xc45a('0x1a'));var db=require(_0xc45a('0x1b'))['db'];function respondWithStatusCode(_0x45608a,_0x53b78f){_0x53b78f=_0x53b78f||0xcc;return function(_0x2ee08c){if(_0x2ee08c){return _0x45608a['sendStatus'](_0x53b78f);}return _0x45608a[_0xc45a('0x1c')](_0x53b78f)[_0xc45a('0x1d')]();};}function respondWithResult(_0x561fe8,_0x30bb8c){_0x30bb8c=_0x30bb8c||0xc8;return function(_0xd4214c){if(_0xd4214c){return _0x561fe8[_0xc45a('0x1c')](_0x30bb8c)[_0xc45a('0x1e')](_0xd4214c);}};}function respondWithFilteredResult(_0x1b0508,_0x5068e3){return function(_0x3ecf20){if(_0x3ecf20){var _0x3d7dc1=_0x3ecf20[_0xc45a('0x1f')],_0x14cb51=_0x5068e3[_0xc45a('0x20')],_0x206176=_0x5068e3[_0xc45a('0x20')]+_0x5068e3[_0xc45a('0x21')],_0x589a11;if(_0x206176>=_0x3d7dc1){_0x206176=_0x3d7dc1;_0x589a11=0xc8;}else{_0x589a11=0xce;}_0x1b0508[_0xc45a('0x1c')](_0x589a11);return _0x1b0508[_0xc45a('0x22')]('Content-Range',_0x14cb51+'-'+_0x206176+'/'+_0x3d7dc1)[_0xc45a('0x1e')](_0x3ecf20);}return null;};}function patchUpdates(_0x220d1b){return function(_0x50fd72){try{jsonpatch[_0xc45a('0x23')](_0x50fd72,_0x220d1b,!![]);}catch(_0x5d2831){return BPromise[_0xc45a('0x24')](_0x5d2831);}return _0x50fd72[_0xc45a('0x25')]();};}function saveUpdates(_0x4c911b,_0x5789fb){return function(_0x6b3213){if(_0x6b3213){return _0x6b3213[_0xc45a('0x26')](_0x4c911b)[_0xc45a('0x27')](function(_0x4b6eb6){return _0x4b6eb6;});}return null;};}function removeEntity(_0x573cac,_0x3ae79a){return function(_0x1b43bc){if(_0x1b43bc){return _0x1b43bc[_0xc45a('0x28')]()[_0xc45a('0x27')](function(){_0x573cac[_0xc45a('0x1c')](0xcc)[_0xc45a('0x1d')]();});}};}function handleEntityNotFound(_0x2f4e42,_0x2d249e){return function(_0x67d134){if(!_0x67d134){_0x2f4e42[_0xc45a('0x29')](0x194);}return _0x67d134;};}function handleError(_0x2acce1,_0x183c2c){_0x183c2c=_0x183c2c||0x1f4;return function(_0x3a18eb){logger[_0xc45a('0x2a')](_0x3a18eb[_0xc45a('0x2b')]);if(_0x3a18eb[_0xc45a('0x2c')]){delete _0x3a18eb[_0xc45a('0x2c')];}_0x2acce1['status'](_0x183c2c)[_0xc45a('0x2d')](_0x3a18eb);};}var utilLicense=require(_0xc45a('0x2e'));exports[_0xc45a('0x2f')]=function(_0xb60613,_0x3ea165){var _0x6d24a4={'raw':!![],'where':{'id':0x1}},_0x599e25={};_0x599e25[_0xc45a('0x30')]=_['keys'](db['License'][_0xc45a('0x31')]);_0x599e25[_0xc45a('0x32')]=_['keys'](_0xb60613[_0xc45a('0x32')]);_0x599e25[_0xc45a('0x33')]=_[_0xc45a('0x34')](_0x599e25[_0xc45a('0x30')],_0x599e25[_0xc45a('0x32')]);_0x6d24a4[_0xc45a('0x35')]=_[_0xc45a('0x34')](_0x599e25['model'],qs[_0xc45a('0x36')](_0xb60613['query']['fields']));_0x6d24a4[_0xc45a('0x35')]=_0x6d24a4[_0xc45a('0x35')][_0xc45a('0x37')]?_0x6d24a4[_0xc45a('0x35')]:_0x599e25[_0xc45a('0x30')];_0x6d24a4=_[_0xc45a('0x38')]({},_0x6d24a4,_0xb60613[_0xc45a('0x39')]);return utilLicense[_0xc45a('0x3a')](_0x6d24a4)['then'](respondWithResult(_0x3ea165,null))[_0xc45a('0x3b')](handleError(_0x3ea165,null));};exports[_0xc45a('0x26')]=function(_0x4efe80,_0x424064){if(_0x4efe80[_0xc45a('0x3c')]['id']){delete _0x4efe80[_0xc45a('0x3c')]['id'];}return db[_0xc45a('0x3d')][_0xc45a('0x3e')]({'where':{'id':_0x4efe80[_0xc45a('0x3f')]['id']}})[_0xc45a('0x27')](handleEntityNotFound(_0x424064,null))[_0xc45a('0x27')](function(_0x35e172){var _0x23150e=_0x35e172[_0xc45a('0x40')]({'plain':!![]});return utilLicense[_0xc45a('0x41')](_0x23150e,_0x4efe80[_0xc45a('0x3c')]['key']);})['then'](function(_0x64faed){if(!_0x64faed[_0xc45a('0x42')]){return saveUpdates(_0x4efe80[_0xc45a('0x3c')],null);}return _0x64faed;})[_0xc45a('0x27')](respondWithResult(_0x424064,null))[_0xc45a('0x3b')](handleError(_0x424064,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index f7a8120..3f0b925 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(_0x197065,_0x2e79d0){var _0x3d9404=function(_0xf582a7){while(--_0xf582a7){_0x197065['push'](_0x197065['shift']());}};_0x3d9404(++_0x2e79d0);}(_0xb10b,0x12a));var _0xbb10=function(_0xa7d678,_0x3dfdff){_0xa7d678=_0xa7d678-0x0;var _0x5cc539=_0xb10b[_0xa7d678];return _0x5cc539;};'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(_0x21d832,_0x45b0bb){var _0xec4fac=function(_0x53ad8f){while(--_0x53ad8f){_0x21d832['push'](_0x21d832['shift']());}};_0xec4fac(++_0x45b0bb);}(_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 799c590..75ecfea 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 _0x2333=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','randomstring','ioredis'];(function(_0x4bd06e,_0x593701){var _0x85ebb=function(_0x26a7f2){while(--_0x26a7f2){_0x4bd06e['push'](_0x4bd06e['shift']());}};_0x85ebb(++_0x593701);}(_0x2333,0x11a));var _0x3233=function(_0x4511ce,_0x55dea4){_0x4511ce=_0x4511ce-0x0;var _0x2790d2=_0x2333[_0x4511ce];return _0x2790d2;};'use strict';var _=require(_0x3233('0x0'));var util=require(_0x3233('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3233('0x2'));var fs=require('fs');var Redis=require(_0x3233('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3233('0x4'));var logger=require(_0x3233('0x5'))(_0x3233('0x6'));var config=require(_0x3233('0x7'));var jayson=require(_0x3233('0x8'));var client=jayson[_0x3233('0x9')][_0x3233('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33a56d,_0x1e93e8,_0x1842a1){return new BPromise(function(_0x1837b6,_0x2ee6df){return client[_0x3233('0xb')](_0x33a56d,_0x1842a1)[_0x3233('0xc')](function(_0x7ff4bd){logger[_0x3233('0xd')](_0x3233('0xe'),_0x1e93e8,_0x3233('0xf'));logger[_0x3233('0x10')](_0x3233('0x11'),_0x1e93e8,_0x3233('0xf'),JSON['stringify'](_0x7ff4bd));if(_0x7ff4bd[_0x3233('0x12')]){if(_0x7ff4bd[_0x3233('0x12')][_0x3233('0x13')]===0x1f4){logger[_0x3233('0x12')](_0x3233('0xe'),_0x1e93e8,_0x7ff4bd[_0x3233('0x12')][_0x3233('0x14')]);return _0x2ee6df(_0x7ff4bd[_0x3233('0x12')][_0x3233('0x14')]);}logger[_0x3233('0x12')](_0x3233('0xe'),_0x1e93e8,_0x7ff4bd[_0x3233('0x12')][_0x3233('0x14')]);return _0x1837b6(_0x7ff4bd['error']['message']);}else{logger[_0x3233('0xd')](_0x3233('0xe'),_0x1e93e8,_0x3233('0xf'));_0x1837b6(_0x7ff4bd['result'][_0x3233('0x14')]);}})[_0x3233('0x15')](function(_0x127227){logger['error'](_0x3233('0xe'),_0x1e93e8,_0x127227);_0x2ee6df(_0x127227);});});} \ No newline at end of file +var _0x84e1=['License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x39c2e7,_0x5d3789){var _0x175f51=function(_0x21b1ca){while(--_0x21b1ca){_0x39c2e7['push'](_0x39c2e7['shift']());}};_0x175f51(++_0x5d3789);}(_0x84e1,0x1dc));var _0x184e=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x84e1[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x184e('0x0'));var util=require(_0x184e('0x1'));var moment=require(_0x184e('0x2'));var BPromise=require(_0x184e('0x3'));var rs=require(_0x184e('0x4'));var fs=require('fs');var Redis=require(_0x184e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x184e('0x6'));var logger=require(_0x184e('0x7'))(_0x184e('0x8'));var config=require(_0x184e('0x9'));var jayson=require(_0x184e('0xa'));var client=jayson[_0x184e('0xb')][_0x184e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ad2c3,_0x3f24d3,_0xa32654){return new BPromise(function(_0x1e79b2,_0x4b6204){return client[_0x184e('0xd')](_0x4ad2c3,_0xa32654)[_0x184e('0xe')](function(_0x22af83){logger[_0x184e('0xf')]('License,\x20%s,\x20%s',_0x3f24d3,_0x184e('0x10'));logger[_0x184e('0x11')](_0x184e('0x12'),_0x3f24d3,_0x184e('0x10'),JSON[_0x184e('0x13')](_0x22af83));if(_0x22af83[_0x184e('0x14')]){if(_0x22af83[_0x184e('0x14')][_0x184e('0x15')]===0x1f4){logger[_0x184e('0x14')](_0x184e('0x16'),_0x3f24d3,_0x22af83[_0x184e('0x14')][_0x184e('0x17')]);return _0x4b6204(_0x22af83['error'][_0x184e('0x17')]);}logger['error'](_0x184e('0x16'),_0x3f24d3,_0x22af83[_0x184e('0x14')][_0x184e('0x17')]);return _0x1e79b2(_0x22af83[_0x184e('0x14')][_0x184e('0x17')]);}else{logger[_0x184e('0xf')](_0x184e('0x16'),_0x3f24d3,_0x184e('0x10'));_0x1e79b2(_0x22af83[_0x184e('0x18')]['message']);}})[_0x184e('0x19')](function(_0x5d3a36){logger[_0x184e('0x14')]('License,\x20%s,\x20%s',_0x3f24d3,_0x5d3a36);_0x4b6204(_0x5d3a36);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index db34d63..262e4af 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 _0xacc5=['/:id/send','/:id','delete','removeAnswers','removeSmtp','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get','index','/describe','isAuthenticated','describe','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/verify','/:id/users','/:id/dispositions','addDisposition','post','create','addImap','/:id/out_servers'];(function(_0x57f2c8,_0x58182c){var _0x135982=function(_0x5ad54b){while(--_0x5ad54b){_0x57f2c8['push'](_0x57f2c8['shift']());}};_0x135982(++_0x58182c);}(_0xacc5,0x1cf));var _0x5acc=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xacc5[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x5acc('0x0'));var util=require('util');var path=require(_0x5acc('0x1'));var timeout=require('connect-timeout');var express=require(_0x5acc('0x2'));var router=express['Router']();var auth=require(_0x5acc('0x3'));var interaction=require(_0x5acc('0x4'));var config=require('../../config/environment');var controller=require(_0x5acc('0x5'));router[_0x5acc('0x6')]('/',auth['isAuthenticated'](),controller[_0x5acc('0x7')]);router[_0x5acc('0x6')](_0x5acc('0x8'),auth[_0x5acc('0x9')](),controller[_0x5acc('0xa')]);router['get']('/:id',auth[_0x5acc('0x9')](),controller[_0x5acc('0xb')]);router[_0x5acc('0x6')]('/:id/dispositions',auth[_0x5acc('0x9')](),controller[_0x5acc('0xc')]);router[_0x5acc('0x6')](_0x5acc('0xd'),auth['isAuthenticated'](),controller[_0x5acc('0xe')]);router['get'](_0x5acc('0xf'),auth[_0x5acc('0x9')](),controller[_0x5acc('0x10')]);router[_0x5acc('0x6')]('/:id/out_servers',auth[_0x5acc('0x9')](),controller[_0x5acc('0x11')]);router[_0x5acc('0x6')](_0x5acc('0x12'),auth[_0x5acc('0x9')](),controller[_0x5acc('0x13')]);router[_0x5acc('0x6')](_0x5acc('0x14'),auth[_0x5acc('0x9')](),controller[_0x5acc('0x15')]);router[_0x5acc('0x6')](_0x5acc('0x16'),auth[_0x5acc('0x9')](),controller['getMessages']);router['get'](_0x5acc('0x17'),auth[_0x5acc('0x9')](),controller['verifySmtp']);router[_0x5acc('0x6')](_0x5acc('0x18'),auth[_0x5acc('0x9')](),controller['getAgents']);router['post'](_0x5acc('0x19'),auth[_0x5acc('0x9')](),controller[_0x5acc('0x1a')]);router[_0x5acc('0x1b')](_0x5acc('0xd'),auth[_0x5acc('0x9')](),controller['addAnswer']);router[_0x5acc('0x1b')]('/',auth['isAuthenticated'](),controller[_0x5acc('0x1c')]);router[_0x5acc('0x1b')]('/:id/in_servers',auth[_0x5acc('0x9')](),controller[_0x5acc('0x1d')]);router[_0x5acc('0x1b')](_0x5acc('0x1e'),auth['isAuthenticated'](),controller['addSmtp']);router[_0x5acc('0x1b')]('/:id/interactions',auth[_0x5acc('0x9')](),controller['addInteraction']);router[_0x5acc('0x1b')](_0x5acc('0x14'),auth[_0x5acc('0x9')](),controller['addApplications']);router[_0x5acc('0x1b')](_0x5acc('0x1f'),auth['isAuthenticated'](),controller['send']);router['post'](_0x5acc('0x18'),auth[_0x5acc('0x9')](),controller['addAgents']);router['put'](_0x5acc('0x20'),auth[_0x5acc('0x9')](),controller['update']);router[_0x5acc('0x21')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0x5acc('0x21')](_0x5acc('0xd'),auth[_0x5acc('0x9')](),controller[_0x5acc('0x22')]);router['delete'](_0x5acc('0xf'),auth[_0x5acc('0x9')](),controller['removeImap']);router[_0x5acc('0x21')](_0x5acc('0x1e'),auth[_0x5acc('0x9')](),controller[_0x5acc('0x23')]);router[_0x5acc('0x21')]('/:id',auth[_0x5acc('0x9')](),controller[_0x5acc('0x24')]);router[_0x5acc('0x21')](_0x5acc('0x18'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x5acc('0x25')]=router; \ No newline at end of file +var _0x6628=['verifySmtp','/:id/users','post','addDisposition','addAnswer','create','addSmtp','addApplications','addAgents','update','removeDispositions','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','util','path','express','Router','./mailAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x6628,0x131));var _0x8662=function(_0x3fec7e,_0x3dd286){_0x3fec7e=_0x3fec7e-0x0;var _0x266b11=_0x6628[_0x3fec7e];return _0x266b11;};'use strict';var multer=require('multer');var util=require(_0x8662('0x0'));var path=require(_0x8662('0x1'));var timeout=require('connect-timeout');var express=require(_0x8662('0x2'));var router=express[_0x8662('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8662('0x4'));router[_0x8662('0x5')]('/',auth['isAuthenticated'](),controller[_0x8662('0x6')]);router[_0x8662('0x5')](_0x8662('0x7'),auth[_0x8662('0x8')](),controller[_0x8662('0x9')]);router['get'](_0x8662('0xa'),auth[_0x8662('0x8')](),controller['show']);router[_0x8662('0x5')](_0x8662('0xb'),auth[_0x8662('0x8')](),controller[_0x8662('0xc')]);router[_0x8662('0x5')](_0x8662('0xd'),auth[_0x8662('0x8')](),controller['getAnswers']);router[_0x8662('0x5')](_0x8662('0xe'),auth['isAuthenticated'](),controller['getImap']);router[_0x8662('0x5')](_0x8662('0xf'),auth[_0x8662('0x8')](),controller[_0x8662('0x10')]);router[_0x8662('0x5')](_0x8662('0x11'),auth['isAuthenticated'](),controller[_0x8662('0x12')]);router['get'](_0x8662('0x13'),auth[_0x8662('0x8')](),controller['getApplications']);router['get'](_0x8662('0x14'),auth[_0x8662('0x8')](),controller[_0x8662('0x15')]);router[_0x8662('0x5')](_0x8662('0x16'),auth[_0x8662('0x8')](),controller[_0x8662('0x17')]);router['get'](_0x8662('0x18'),auth[_0x8662('0x8')](),controller['getAgents']);router[_0x8662('0x19')]('/:id/dispositions',auth[_0x8662('0x8')](),controller[_0x8662('0x1a')]);router[_0x8662('0x19')](_0x8662('0xd'),auth['isAuthenticated'](),controller[_0x8662('0x1b')]);router['post']('/',auth[_0x8662('0x8')](),controller[_0x8662('0x1c')]);router['post'](_0x8662('0xe'),auth['isAuthenticated'](),controller['addImap']);router[_0x8662('0x19')](_0x8662('0xf'),auth[_0x8662('0x8')](),controller[_0x8662('0x1d')]);router[_0x8662('0x19')]('/:id/interactions',auth[_0x8662('0x8')](),controller['addInteraction']);router[_0x8662('0x19')](_0x8662('0x13'),auth[_0x8662('0x8')](),controller[_0x8662('0x1e')]);router['post']('/:id/send',auth['isAuthenticated'](),controller['send']);router['post'](_0x8662('0x18'),auth[_0x8662('0x8')](),controller[_0x8662('0x1f')]);router['put'](_0x8662('0xa'),auth[_0x8662('0x8')](),controller[_0x8662('0x20')]);router['delete'](_0x8662('0xb'),auth[_0x8662('0x8')](),controller[_0x8662('0x21')]);router[_0x8662('0x22')](_0x8662('0xd'),auth['isAuthenticated'](),controller[_0x8662('0x23')]);router[_0x8662('0x22')](_0x8662('0xe'),auth[_0x8662('0x8')](),controller[_0x8662('0x24')]);router['delete'](_0x8662('0xf'),auth['isAuthenticated'](),controller[_0x8662('0x25')]);router[_0x8662('0x22')]('/:id',auth['isAuthenticated'](),controller[_0x8662('0x26')]);router[_0x8662('0x22')](_0x8662('0x18'),auth[_0x8662('0x8')](),controller[_0x8662('0x27')]);module[_0x8662('0x28')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index e8f41f4..54479f3 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 _0x69d9=['INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','BOOLEAN','TEXT'];(function(_0x1dc130,_0x1f8090){var _0x48e316=function(_0x1f3743){while(--_0x1f3743){_0x1dc130['push'](_0x1dc130['shift']());}};_0x48e316(++_0x1f8090);}(_0x69d9,0x164));var _0x969d=function(_0x54bac5,_0x8d3a16){_0x54bac5=_0x54bac5-0x0;var _0xc15971=_0x69d9[_0x54bac5];return _0xc15971;};'use strict';var Sequelize=require(_0x969d('0x0'));module['exports']={'description':{'type':Sequelize[_0x969d('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x969d('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x969d('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x969d('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x969d('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x969d('0x4')](0x2)[_0x969d('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x969d('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x969d('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x969d('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x969d('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x969d('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x969d('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x969d('0x6')},'mandatoryDisposition':{'type':Sequelize[_0x969d('0x2')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4c46d9){if(!_0x4c46d9)this[_0x969d('0x7')](_0x969d('0x8'),null);this['setDataValue'](_0x969d('0x9'),_0x4c46d9);}}}; \ No newline at end of file +var _0x1646=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED'];(function(_0xfd20c3,_0x2c2aa3){var _0x1ed8b4=function(_0x5924c2){while(--_0x5924c2){_0xfd20c3['push'](_0xfd20c3['shift']());}};_0x1ed8b4(++_0x2c2aa3);}(_0x1646,0xae));var _0x6164=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x1646[_0x256b72];return _0x2183e3;};'use strict';var Sequelize=require(_0x6164('0x0'));module[_0x6164('0x1')]={'description':{'type':Sequelize[_0x6164('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x6164('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x6164('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x6164('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x6164('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x6164('0x2')],'allowNull':![],'defaultValue':_0x6164('0x5')},'fontSize':{'type':Sequelize[_0x6164('0x6')](0x2)[_0x6164('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x6164('0x4')],'defaultValue':function(){return _0x6164('0x8');}},'notificationSound':{'type':Sequelize[_0x6164('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6164('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6164('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6164('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6164('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x6164('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6164('0xa'),'set':function(_0x252d3f){if(!_0x252d3f)this[_0x6164('0xb')](_0x6164('0xc'),null);this[_0x6164('0xb')](_0x6164('0xd'),_0x252d3f);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index d1ab3cb..537266a 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 _0xfa79=['host','port','service','password','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','getSmtp','removeSmtp','setSmtp','MailInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','transaction','MailApplication','bulkCreate','findAndCountAll','priority','hasOwnProperty','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','List\x20not\x20found','Contacts','messageId','attach','Interaction','Messages','verifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','nolimit','pick','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','key','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser','pass','cpassword','authentication'];(function(_0x3ecaae,_0x3ed858){var _0x8a331e=function(_0x2f0061){while(--_0x2f0061){_0x3ecaae['push'](_0x3ecaae['shift']());}};_0x8a331e(++_0x3ed858);}(_0xfa79,0x1c7));var _0x9fa7=function(_0x2f6e01,_0x40ce5a){_0x2f6e01=_0x2f6e01-0x0;var _0x5c9346=_0xfa79[_0x2f6e01];return _0x5c9346;};'use strict';var pdf=require(_0x9fa7('0x0'));var emlformat=require(_0x9fa7('0x1'));var rimraf=require(_0x9fa7('0x2'));var zipdir=require(_0x9fa7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9fa7('0x4'));var moment=require(_0x9fa7('0x5'));var BPromise=require(_0x9fa7('0x6'));var Mustache=require(_0x9fa7('0x7'));var util=require('util');var path=require('path');var sox=require(_0x9fa7('0x8'));var csv=require(_0x9fa7('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9fa7('0xa'));var squel=require('squel');var crypto=require(_0x9fa7('0xb'));var jsforce=require(_0x9fa7('0xc'));var deskjs=require(_0x9fa7('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9fa7('0xe'));var Papa=require(_0x9fa7('0xf'));var Redis=require(_0x9fa7('0x10'));var authService=require(_0x9fa7('0x11'));var qs=require(_0x9fa7('0x12'));var as=require(_0x9fa7('0x13'));var hardwareService=require(_0x9fa7('0x14'));var logger=require('../../config/logger')(_0x9fa7('0x15'));var utils=require('../../config/utils');var config=require(_0x9fa7('0x16'));var db=require(_0x9fa7('0x17'))['db'];config[_0x9fa7('0x18')]=_['defaults'](config[_0x9fa7('0x18')],{'host':_0x9fa7('0x19'),'port':0x18eb});var socket=require(_0x9fa7('0x1a'))(new Redis(config['redis']));require(_0x9fa7('0x1b'))[_0x9fa7('0x1c')](socket);var jayson=require(_0x9fa7('0x1d'));var client=jayson[_0x9fa7('0x1e')][_0x9fa7('0x1f')]({'port':0x232b});function checkPasswordPattern(_0x5d08d6,_0x5e58dd,_0x53d02c){if(_0x53d02c){var _0x1cedc2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1cedc2[_0x9fa7('0x20')](_0x5e58dd)){return _0x5d08d6;}else{throw new db[(_0x9fa7('0x21'))][(_0x9fa7('0x22'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x5d08d6;}}function respondWithRpcPromise(_0xadd253,_0x2ce478,_0x1787fb,_0x4ac818){return new BPromise(function(_0x1bcb02,_0x42ed00){var _0x116e19=_0x4ac818||client;return _0x116e19[_0x9fa7('0x23')](_0xadd253,_0x1787fb)[_0x9fa7('0x24')](function(_0x4409bc){logger['info'](_0x9fa7('0x25'),_0x2ce478,_0x9fa7('0x26'));logger[_0x9fa7('0x27')](_0x9fa7('0x28'),_0x2ce478,'request\x20sent',JSON['stringify'](_0x4409bc));if(_0x4409bc[_0x9fa7('0x29')]){if(_0x4409bc[_0x9fa7('0x29')][_0x9fa7('0x2a')]===0x1f4){logger[_0x9fa7('0x29')](_0x9fa7('0x25'),_0x2ce478,_0x4409bc[_0x9fa7('0x29')][_0x9fa7('0x2b')]);return _0x42ed00(_0x4409bc[_0x9fa7('0x29')][_0x9fa7('0x2b')]);}logger[_0x9fa7('0x29')](_0x9fa7('0x25'),_0x2ce478,_0x4409bc[_0x9fa7('0x29')]['message']);return _0x1bcb02(_0x4409bc['error'][_0x9fa7('0x2b')]);}else{logger[_0x9fa7('0x2c')]('MailAccount,\x20%s,\x20%s',_0x2ce478,_0x9fa7('0x26'));_0x1bcb02(_0x4409bc[_0x9fa7('0x2d')][_0x9fa7('0x2b')]);}})[_0x9fa7('0x2e')](function(_0x56da02){logger['error']('MailAccount,\x20%s,\x20%s',_0x2ce478,_0x56da02);_0x42ed00(_0x56da02);});});}function respondWithStatusCode(_0x33f25d,_0x5a43dc){_0x5a43dc=_0x5a43dc||0xcc;return function(_0x18e286){if(_0x18e286){return _0x33f25d[_0x9fa7('0x2f')](_0x5a43dc);}return _0x33f25d['status'](_0x5a43dc)['end']();};}function respondWithResult(_0x266fc4,_0x422cd4){_0x422cd4=_0x422cd4||0xc8;return function(_0xd0e622){if(_0xd0e622){return _0x266fc4[_0x9fa7('0x30')](_0x422cd4)[_0x9fa7('0x31')](_0xd0e622);}};}function respondWithFilteredResult(_0x465f9d,_0x2f4953){return function(_0x8e6a14){if(_0x8e6a14){var _0x4c561a=_0x8e6a14[_0x9fa7('0x32')],_0x36bbf1=_0x2f4953[_0x9fa7('0x33')],_0x144ff8=_0x2f4953['offset']+_0x2f4953[_0x9fa7('0x34')],_0x58cb69;if(_0x144ff8>=_0x4c561a){_0x144ff8=_0x4c561a;_0x58cb69=0xc8;}else{_0x58cb69=0xce;}_0x465f9d[_0x9fa7('0x30')](_0x58cb69);return _0x465f9d[_0x9fa7('0x35')](_0x9fa7('0x36'),_0x36bbf1+'-'+_0x144ff8+'/'+_0x4c561a)['json'](_0x8e6a14);}return null;};}function patchUpdates(_0x34ab45){return function(_0xa62b8c){try{jsonpatch['apply'](_0xa62b8c,_0x34ab45,!![]);}catch(_0x2b77b4){return BPromise[_0x9fa7('0x37')](_0x2b77b4);}return _0xa62b8c['save']();};}function saveUpdates(_0x5bd2f6,_0x2f26d4){return function(_0x399166){if(_0x399166){return _0x399166[_0x9fa7('0x38')](_0x5bd2f6)[_0x9fa7('0x24')](function(_0x3eba4b){return _0x3eba4b;});}return null;};}function removeEntity(_0x19ba63,_0x5f53c9){return function(_0x231806){if(_0x231806){return _0x231806[_0x9fa7('0x39')]()[_0x9fa7('0x24')](function(){var _0x4d4b76=_0x231806[_0x9fa7('0x3a')]({'plain':!![]});var _0x5e02ae=_0x9fa7('0x3b');return db[_0x9fa7('0x3c')][_0x9fa7('0x39')]({'where':{'type':_0x5e02ae,'resourceId':_0x4d4b76['id']}})[_0x9fa7('0x24')](function(){return _0x231806;});})[_0x9fa7('0x24')](function(){_0x19ba63[_0x9fa7('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cefff,_0x4cc8e7){return function(_0x2b82ad){if(!_0x2b82ad){_0x2cefff[_0x9fa7('0x2f')](0x194);}return _0x2b82ad;};}function handleError(_0x1492c5,_0x1f465e){_0x1f465e=_0x1f465e||0x1f4;return function(_0x651a8f){logger[_0x9fa7('0x29')](_0x651a8f[_0x9fa7('0x3d')]);if(_0x651a8f['name']){delete _0x651a8f[_0x9fa7('0x3e')];}_0x1492c5['status'](_0x1f465e)[_0x9fa7('0x3f')](_0x651a8f);};}exports[_0x9fa7('0x40')]=function(_0x14ca9f,_0x4ff88f){var _0x550972={'include':[{'model':db[_0x9fa7('0x41')],'as':_0x9fa7('0x42')},{'model':db[_0x9fa7('0x43')],'as':_0x9fa7('0x44')},{'model':db[_0x9fa7('0x45')],'as':_0x9fa7('0x46')}]},_0x364e68={},_0x319723={'count':0x0,'rows':[]};var _0x511f5e=_[_0x9fa7('0x47')](db[_0x9fa7('0x48')][_0x9fa7('0x49')],function(_0x2c938e){return{'name':_0x2c938e[_0x9fa7('0x4a')],'type':_0x2c938e['type']['key']};});_0x364e68['model']=_[_0x9fa7('0x47')](_0x511f5e,_0x9fa7('0x3e'));_0x364e68[_0x9fa7('0x4b')]=_[_0x9fa7('0x4c')](_0x14ca9f['query']);_0x364e68[_0x9fa7('0x4d')]=_[_0x9fa7('0x4e')](_0x364e68[_0x9fa7('0x4f')],_0x364e68[_0x9fa7('0x4b')]);_0x550972[_0x9fa7('0x50')]=_[_0x9fa7('0x4e')](_0x364e68[_0x9fa7('0x4f')],qs[_0x9fa7('0x51')](_0x14ca9f[_0x9fa7('0x4b')]['fields']));_0x550972['attributes']=_0x550972['attributes'][_0x9fa7('0x52')]?_0x550972[_0x9fa7('0x50')]:_0x364e68[_0x9fa7('0x4f')];if(!_0x14ca9f['query']['hasOwnProperty']('nolimit')){_0x550972[_0x9fa7('0x34')]=qs[_0x9fa7('0x34')](_0x14ca9f[_0x9fa7('0x4b')]['limit']);_0x550972[_0x9fa7('0x33')]=qs[_0x9fa7('0x33')](_0x14ca9f['query'][_0x9fa7('0x33')]);}_0x550972[_0x9fa7('0x53')]=qs[_0x9fa7('0x54')](_0x14ca9f[_0x9fa7('0x4b')][_0x9fa7('0x54')]);_0x550972[_0x9fa7('0x55')]=qs[_0x9fa7('0x4d')](_['pick'](_0x14ca9f[_0x9fa7('0x4b')],_0x364e68['filters']),_0x511f5e);if(_0x14ca9f[_0x9fa7('0x4b')][_0x9fa7('0x56')]){_0x550972[_0x9fa7('0x55')]=_[_0x9fa7('0x57')](_0x550972[_0x9fa7('0x55')],{'$or':_['map'](_0x511f5e,function(_0x5bf862){if(_0x5bf862['type']!==_0x9fa7('0x58')){var _0x18a9a6={};_0x18a9a6[_0x5bf862[_0x9fa7('0x3e')]]={'$like':'%'+_0x14ca9f['query'][_0x9fa7('0x56')]+'%'};return _0x18a9a6;}})});}_0x550972=_[_0x9fa7('0x57')]({},_0x550972,_0x14ca9f['options']);var _0x277fc1={'where':_0x550972[_0x9fa7('0x55')]};return db['MailAccount']['count'](_0x277fc1)[_0x9fa7('0x24')](function(_0x2be9d0){_0x319723[_0x9fa7('0x32')]=_0x2be9d0;if(_0x14ca9f[_0x9fa7('0x4b')][_0x9fa7('0x59')]){_0x550972[_0x9fa7('0x5a')]=[{'all':!![]}];}return db['MailAccount'][_0x9fa7('0x5b')](_0x550972);})[_0x9fa7('0x24')](function(_0xfa4b91){_0x319723[_0x9fa7('0x5c')]=_0xfa4b91;return _0x319723;})[_0x9fa7('0x24')](respondWithFilteredResult(_0x4ff88f,_0x550972))[_0x9fa7('0x2e')](handleError(_0x4ff88f,null));};exports['show']=function(_0x1d2276,_0x294a81){var _0x574975={'raw':![],'where':{'id':_0x1d2276[_0x9fa7('0x5d')]['id']},'include':[{'model':db[_0x9fa7('0x41')],'as':_0x9fa7('0x42')},{'model':db[_0x9fa7('0x43')],'as':_0x9fa7('0x44')},{'model':db[_0x9fa7('0x45')],'as':_0x9fa7('0x46')}]},_0x1ba6df={};_0x1ba6df[_0x9fa7('0x4f')]=_['keys'](db[_0x9fa7('0x48')][_0x9fa7('0x49')]);_0x1ba6df[_0x9fa7('0x4b')]=_[_0x9fa7('0x4c')](_0x1d2276[_0x9fa7('0x4b')]);_0x1ba6df[_0x9fa7('0x4d')]=_['intersection'](_0x1ba6df[_0x9fa7('0x4f')],_0x1ba6df[_0x9fa7('0x4b')]);_0x574975[_0x9fa7('0x50')]=_[_0x9fa7('0x4e')](_0x1ba6df[_0x9fa7('0x4f')],qs[_0x9fa7('0x51')](_0x1d2276[_0x9fa7('0x4b')][_0x9fa7('0x51')]));_0x574975[_0x9fa7('0x50')]=_0x574975[_0x9fa7('0x50')]['length']?_0x574975['attributes']:_0x1ba6df[_0x9fa7('0x4f')];if(_0x1d2276['query']['includeAll']){_0x574975[_0x9fa7('0x5a')]=[{'all':!![]}];}_0x574975=_[_0x9fa7('0x57')]({},_0x574975,_0x1d2276[_0x9fa7('0x5e')]);return db[_0x9fa7('0x48')][_0x9fa7('0x5f')](_0x574975)[_0x9fa7('0x24')](handleEntityNotFound(_0x294a81,null))[_0x9fa7('0x24')](respondWithResult(_0x294a81,null))[_0x9fa7('0x2e')](handleError(_0x294a81,null));};exports[_0x9fa7('0x38')]=function(_0x232ebc,_0x558fe9){if(_0x232ebc['body']['id']){delete _0x232ebc[_0x9fa7('0x60')]['id'];}return db[_0x9fa7('0x48')][_0x9fa7('0x5f')]({'where':{'id':_0x232ebc[_0x9fa7('0x5d')]['id']},'include':[{'model':db[_0x9fa7('0x41')],'as':'Imap'},{'model':db[_0x9fa7('0x43')],'as':_0x9fa7('0x44')},{'model':db[_0x9fa7('0x45')],'as':_0x9fa7('0x46')}]})[_0x9fa7('0x24')](handleEntityNotFound(_0x558fe9,null))[_0x9fa7('0x24')](saveUpdates(_0x232ebc['body'],null))[_0x9fa7('0x24')](function(_0x553d7d){if(_0x553d7d&&_0x232ebc['body'][_0x9fa7('0x42')]){return db[_0x9fa7('0x41')][_0x9fa7('0x38')](_0x232ebc[_0x9fa7('0x60')][_0x9fa7('0x42')],{'where':{'MailAccountId':_0x553d7d['id']}})[_0x9fa7('0x24')](function(){return _0x553d7d;});}return _0x553d7d;})['then'](function(_0x3fd6bb){if(_0x3fd6bb&&_0x232ebc[_0x9fa7('0x60')][_0x9fa7('0x44')]){return db['MailServerOut']['update'](_0x232ebc[_0x9fa7('0x60')][_0x9fa7('0x44')],{'where':{'MailAccountId':_0x3fd6bb['id']}})[_0x9fa7('0x24')](function(){return _0x3fd6bb;});}return _0x3fd6bb;})['then'](respondWithResult(_0x558fe9,null))[_0x9fa7('0x2e')](handleError(_0x558fe9,null));};exports['describe']=function(_0xfd3d41,_0x46582f){return db[_0x9fa7('0x48')][_0x9fa7('0x61')]()['then'](respondWithResult(_0x46582f,null))['catch'](handleError(_0x46582f,null));};exports[_0x9fa7('0x62')]=function(_0x48a889,_0x2d0660,_0x17046e){if(_0x48a889['body']['id']){delete _0x48a889[_0x9fa7('0x60')]['id'];}return db[_0x9fa7('0x48')][_0x9fa7('0x5f')]({'where':{'id':_0x48a889[_0x9fa7('0x5d')]['id']}})[_0x9fa7('0x24')](handleEntityNotFound(_0x2d0660,null))[_0x9fa7('0x24')](function(_0x16a155){if(_0x16a155){_0x48a889[_0x9fa7('0x60')][_0x9fa7('0x63')]=_0x16a155['id'];return db[_0x9fa7('0x64')][_0x9fa7('0x65')](_0x48a889[_0x9fa7('0x60')]);}})[_0x9fa7('0x24')](respondWithResult(_0x2d0660,null))['catch'](handleError(_0x2d0660,null));};exports[_0x9fa7('0x66')]=function(_0x3a99bf,_0x461b31,_0x4070c8){var _0xb6402a={'raw':![],'where':{}};var _0x3b2031={};var _0x9bc364={'count':0x0,'rows':[]};return db[_0x9fa7('0x48')][_0x9fa7('0x67')]({'where':{'id':_0x3a99bf[_0x9fa7('0x5d')]['id']}})[_0x9fa7('0x24')](handleEntityNotFound(_0x461b31,null))['then'](function(_0x3c3b43){if(_0x3c3b43){_0x3b2031[_0x9fa7('0x4f')]=_[_0x9fa7('0x4c')](db['Disposition']['rawAttributes']);_0x3b2031['query']=_[_0x9fa7('0x4c')](_0x3a99bf['query']);_0x3b2031[_0x9fa7('0x4d')]=_[_0x9fa7('0x4e')](_0x3b2031[_0x9fa7('0x4f')],_0x3b2031['query']);_0xb6402a['attributes']=_['intersection'](_0x3b2031[_0x9fa7('0x4f')],qs['fields'](_0x3a99bf[_0x9fa7('0x4b')][_0x9fa7('0x51')]));_0xb6402a['attributes']=_0xb6402a[_0x9fa7('0x50')][_0x9fa7('0x52')]?_0xb6402a[_0x9fa7('0x50')]:_0x3b2031[_0x9fa7('0x4f')];if(!_0x3a99bf[_0x9fa7('0x4b')]['hasOwnProperty'](_0x9fa7('0x68'))){_0xb6402a[_0x9fa7('0x34')]=qs[_0x9fa7('0x34')](_0x3a99bf[_0x9fa7('0x4b')][_0x9fa7('0x34')]);_0xb6402a[_0x9fa7('0x33')]=qs[_0x9fa7('0x33')](_0x3a99bf['query'][_0x9fa7('0x33')]);}_0xb6402a[_0x9fa7('0x53')]=qs[_0x9fa7('0x54')](_0x3a99bf[_0x9fa7('0x4b')][_0x9fa7('0x54')]);_0xb6402a['where']=qs[_0x9fa7('0x4d')](_[_0x9fa7('0x69')](_0x3a99bf[_0x9fa7('0x4b')],_0x3b2031[_0x9fa7('0x4d')]));_0xb6402a[_0x9fa7('0x55')][_0x9fa7('0x63')]=_0x3c3b43['id'];if(_0x3a99bf[_0x9fa7('0x4b')][_0x9fa7('0x56')]){_0xb6402a[_0x9fa7('0x55')]=_[_0x9fa7('0x57')](_0xb6402a[_0x9fa7('0x55')],{'$or':_[_0x9fa7('0x47')](_0xb6402a[_0x9fa7('0x50')],function(_0x57a72d){var _0x182a07={};_0x182a07[_0x57a72d]={'$like':'%'+_0x3a99bf['query'][_0x9fa7('0x56')]+'%'};return _0x182a07;})});}_0xb6402a=_['merge']({},_0xb6402a,_0x3a99bf[_0x9fa7('0x5e')]);return db[_0x9fa7('0x64')][_0x9fa7('0x32')]({'where':_0xb6402a[_0x9fa7('0x55')]})[_0x9fa7('0x24')](function(_0x3ddcf2){_0x9bc364[_0x9fa7('0x32')]=_0x3ddcf2;if(_0x3a99bf[_0x9fa7('0x4b')][_0x9fa7('0x59')]){_0xb6402a[_0x9fa7('0x5a')]=[{'all':!![]}];}return db['Disposition'][_0x9fa7('0x5b')](_0xb6402a);})[_0x9fa7('0x24')](function(_0x397269){_0x9bc364[_0x9fa7('0x5c')]=_0x397269;return _0x9bc364;});}})['then'](respondWithFilteredResult(_0x461b31,_0xb6402a))[_0x9fa7('0x2e')](handleError(_0x461b31,null));};exports['removeDispositions']=function(_0x3acb74,_0x3441a7,_0x431901){return db[_0x9fa7('0x48')][_0x9fa7('0x5f')]({'where':{'id':_0x3acb74[_0x9fa7('0x5d')]['id']}})[_0x9fa7('0x24')](handleEntityNotFound(_0x3441a7,null))['then'](function(_0x406864){if(_0x406864){return _0x406864[_0x9fa7('0x6a')](_0x3acb74[_0x9fa7('0x4b')]['ids']);}})['then'](respondWithStatusCode(_0x3441a7,null))['catch'](handleError(_0x3441a7,null));};exports['addAnswer']=function(_0x3d176f,_0x49c4d7,_0x1e062e){if(_0x3d176f[_0x9fa7('0x60')]['id']){delete _0x3d176f[_0x9fa7('0x60')]['id'];}return db[_0x9fa7('0x48')][_0x9fa7('0x5f')]({'where':{'id':_0x3d176f['params']['id']}})[_0x9fa7('0x24')](handleEntityNotFound(_0x49c4d7,null))[_0x9fa7('0x24')](function(_0x998c8b){if(_0x998c8b){_0x3d176f[_0x9fa7('0x60')][_0x9fa7('0x63')]=_0x998c8b['id'];return db[_0x9fa7('0x6b')][_0x9fa7('0x65')](_0x3d176f[_0x9fa7('0x60')]);}})['then'](respondWithResult(_0x49c4d7,null))['catch'](handleError(_0x49c4d7,null));};exports[_0x9fa7('0x6c')]=function(_0x1f7e35,_0x5e0df4,_0x3ffa37){var _0x55f013={'raw':![],'where':{}};var _0x4a7494={};var _0x214b37={'count':0x0,'rows':[]};return db[_0x9fa7('0x48')][_0x9fa7('0x67')]({'where':{'id':_0x1f7e35['params']['id']}})[_0x9fa7('0x24')](handleEntityNotFound(_0x5e0df4,null))[_0x9fa7('0x24')](function(_0x17eefa){if(_0x17eefa){_0x4a7494[_0x9fa7('0x4f')]=_[_0x9fa7('0x4c')](db[_0x9fa7('0x6b')][_0x9fa7('0x49')]);_0x4a7494[_0x9fa7('0x4b')]=_[_0x9fa7('0x4c')](_0x1f7e35[_0x9fa7('0x4b')]);_0x4a7494[_0x9fa7('0x4d')]=_[_0x9fa7('0x4e')](_0x4a7494[_0x9fa7('0x4f')],_0x4a7494[_0x9fa7('0x4b')]);_0x55f013[_0x9fa7('0x50')]=_['intersection'](_0x4a7494['model'],qs[_0x9fa7('0x51')](_0x1f7e35[_0x9fa7('0x4b')][_0x9fa7('0x51')]));_0x55f013['attributes']=_0x55f013['attributes']['length']?_0x55f013[_0x9fa7('0x50')]:_0x4a7494[_0x9fa7('0x4f')];if(!_0x1f7e35[_0x9fa7('0x4b')]['hasOwnProperty'](_0x9fa7('0x68'))){_0x55f013['limit']=qs[_0x9fa7('0x34')](_0x1f7e35[_0x9fa7('0x4b')]['limit']);_0x55f013[_0x9fa7('0x33')]=qs[_0x9fa7('0x33')](_0x1f7e35[_0x9fa7('0x4b')][_0x9fa7('0x33')]);}_0x55f013['order']=qs[_0x9fa7('0x54')](_0x1f7e35[_0x9fa7('0x4b')][_0x9fa7('0x54')]);_0x55f013[_0x9fa7('0x55')]=qs[_0x9fa7('0x4d')](_['pick'](_0x1f7e35[_0x9fa7('0x4b')],_0x4a7494[_0x9fa7('0x4d')]));_0x55f013[_0x9fa7('0x55')][_0x9fa7('0x63')]=_0x17eefa['id'];if(_0x1f7e35[_0x9fa7('0x4b')][_0x9fa7('0x56')]){_0x55f013[_0x9fa7('0x55')]=_[_0x9fa7('0x57')](_0x55f013['where'],{'$or':_[_0x9fa7('0x47')](_0x55f013[_0x9fa7('0x50')],function(_0x2e6d6e){var _0x239849={};_0x239849[_0x2e6d6e]={'$like':'%'+_0x1f7e35['query'][_0x9fa7('0x56')]+'%'};return _0x239849;})});}_0x55f013=_[_0x9fa7('0x57')]({},_0x55f013,_0x1f7e35[_0x9fa7('0x5e')]);return db['CannedAnswer'][_0x9fa7('0x32')]({'where':_0x55f013['where']})[_0x9fa7('0x24')](function(_0x521114){_0x214b37[_0x9fa7('0x32')]=_0x521114;if(_0x1f7e35[_0x9fa7('0x4b')][_0x9fa7('0x59')]){_0x55f013[_0x9fa7('0x5a')]=[{'all':!![]}];}return db[_0x9fa7('0x6b')][_0x9fa7('0x5b')](_0x55f013);})[_0x9fa7('0x24')](function(_0x11ebc6){_0x214b37['rows']=_0x11ebc6;return _0x214b37;});}})[_0x9fa7('0x24')](respondWithFilteredResult(_0x5e0df4,_0x55f013))[_0x9fa7('0x2e')](handleError(_0x5e0df4,null));};exports['removeAnswers']=function(_0x56cd5b,_0x47bf40,_0x497e10){return db[_0x9fa7('0x48')][_0x9fa7('0x5f')]({'where':{'id':_0x56cd5b['params']['id']}})['then'](handleEntityNotFound(_0x47bf40,null))[_0x9fa7('0x24')](function(_0x21fc92){if(_0x21fc92){return _0x21fc92[_0x9fa7('0x6d')](_0x56cd5b[_0x9fa7('0x4b')][_0x9fa7('0x6e')]);}})[_0x9fa7('0x24')](respondWithStatusCode(_0x47bf40,null))['catch'](handleError(_0x47bf40,null));};exports[_0x9fa7('0x65')]=function(_0x1073e4,_0x43e161){var _0x3613a5={'name':_0x1073e4['body'][_0x9fa7('0x3e')],'key':_0x1073e4[_0x9fa7('0x60')][_0x9fa7('0x6f')],'email':_0x1073e4[_0x9fa7('0x60')][_0x9fa7('0x70')],'ListId':_0x1073e4[_0x9fa7('0x60')][_0x9fa7('0x71')],'active':!_[_0x9fa7('0x72')](_0x1073e4[_0x9fa7('0x60')][_0x9fa7('0x73')])?_0x1073e4['body'][_0x9fa7('0x73')]:!![],'description':_0x1073e4[_0x9fa7('0x60')][_0x9fa7('0x74')]||null,'Imap':{},'Smtp':{}};if(_[_0x9fa7('0x72')](_0x1073e4['body'][_0x9fa7('0x75')])){if(_0x1073e4[_0x9fa7('0x60')][_0x9fa7('0x76')]){_0x3613a5['Imap'][_0x9fa7('0x77')]=_0x3613a5[_0x9fa7('0x44')]['user']=_0x1073e4['body'][_0x9fa7('0x78')];_0x3613a5[_0x9fa7('0x42')]['password']=_0x3613a5['Smtp'][_0x9fa7('0x79')]=_0x1073e4[_0x9fa7('0x60')][_0x9fa7('0x7a')];}else{_0x3613a5[_0x9fa7('0x42')][_0x9fa7('0x7b')]=_0x3613a5['Smtp']['authentication']=![];}_0x3613a5[_0x9fa7('0x42')][_0x9fa7('0x7c')]=_0x1073e4[_0x9fa7('0x60')]['Imap']['host'];_0x3613a5['Imap'][_0x9fa7('0x7d')]=_0x1073e4[_0x9fa7('0x60')]['Imap'][_0x9fa7('0x7d')];_0x3613a5['Smtp']['host']=_0x1073e4['body'][_0x9fa7('0x44')][_0x9fa7('0x7c')];_0x3613a5[_0x9fa7('0x44')][_0x9fa7('0x7d')]=_0x1073e4[_0x9fa7('0x60')][_0x9fa7('0x44')][_0x9fa7('0x7d')];}else{_0x3613a5[_0x9fa7('0x42')]['service']=_0x3613a5[_0x9fa7('0x44')][_0x9fa7('0x7e')]=_0x1073e4[_0x9fa7('0x60')]['cservice'];_0x3613a5[_0x9fa7('0x42')][_0x9fa7('0x77')]=_0x3613a5[_0x9fa7('0x44')]['user']=_0x1073e4[_0x9fa7('0x60')]['cuser'];_0x3613a5[_0x9fa7('0x42')][_0x9fa7('0x7f')]=_0x3613a5[_0x9fa7('0x44')][_0x9fa7('0x79')]=_0x1073e4['body'][_0x9fa7('0x7a')];}return db[_0x9fa7('0x48')][_0x9fa7('0x65')](_0x3613a5,{'include':[{'model':db[_0x9fa7('0x43')],'as':'Smtp'},{'model':db['MailServerIn'],'as':'Imap'}]})[_0x9fa7('0x24')](function(_0x2c8fdb){var _0x193ae5=_0x1073e4[_0x9fa7('0x77')][_0x9fa7('0x3a')]({'plain':!![]});if(!_0x193ae5)throw new Error(_0x9fa7('0x80'));if(_0x193ae5[_0x9fa7('0x81')]==='user'){var _0x1cbcd9=_0x2c8fdb[_0x9fa7('0x3a')]({'plain':!![]});return db[_0x9fa7('0x82')][_0x9fa7('0x5f')]({'where':{'name':_0x9fa7('0x3b'),'userProfileId':_0x193ae5['userProfileId']},'raw':!![]})['then'](function(_0x33fe46){if(_0x33fe46&&_0x33fe46['autoAssociation']===0x0){return db[_0x9fa7('0x3c')][_0x9fa7('0x65')]({'name':_0x1cbcd9['name'],'resourceId':_0x1cbcd9['id'],'type':_0x33fe46[_0x9fa7('0x3e')],'sectionId':_0x33fe46['id']},{})[_0x9fa7('0x24')](function(){return _0x2c8fdb;});}else{return _0x2c8fdb;}})[_0x9fa7('0x2e')](function(_0x426efe){logger[_0x9fa7('0x29')](_0x9fa7('0x83'),_0x426efe);throw _0x426efe;});}return _0x2c8fdb;})[_0x9fa7('0x24')](respondWithResult(_0x43e161,0xc9))[_0x9fa7('0x2e')](handleError(_0x43e161,null));};exports[_0x9fa7('0x84')]=function(_0x4f86e6,_0x4f0363,_0xc04da1){return db[_0x9fa7('0x48')][_0x9fa7('0x67')]({'where':{'id':_0x4f86e6['params']['id']}})[_0x9fa7('0x24')](handleEntityNotFound(_0x4f0363,null))[_0x9fa7('0x24')](function(_0x2020fa){if(_0x2020fa){return _0x2020fa[_0x9fa7('0x84')]();}return null;})[_0x9fa7('0x24')](respondWithResult(_0x4f0363,null))[_0x9fa7('0x2e')](handleError(_0x4f0363,null));};exports['addImap']=function(_0x4ebab1,_0x4d59dd,_0x4d8e0a){if(_0x4ebab1['body']['id']){delete _0x4ebab1['body']['id'];}return db[_0x9fa7('0x48')][_0x9fa7('0x5f')]({'where':{'id':_0x4ebab1[_0x9fa7('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4d59dd,null))[_0x9fa7('0x24')](function(_0x146a41){if(_0x146a41){_0x4ebab1['body'][_0x9fa7('0x63')]=_0x146a41['id'];return db['MailServerIn'][_0x9fa7('0x65')](_0x4ebab1['body']);}})[_0x9fa7('0x24')](respondWithResult(_0x4d59dd,null))[_0x9fa7('0x2e')](handleError(_0x4d59dd,null));};exports[_0x9fa7('0x85')]=function(_0x1b45ed,_0x3cffe9,_0x49261b){return db[_0x9fa7('0x48')]['findOne']({'where':{'id':_0x1b45ed[_0x9fa7('0x5d')]['id']}})[_0x9fa7('0x24')](handleEntityNotFound(_0x3cffe9,null))[_0x9fa7('0x24')](function(_0x2f9143){if(_0x2f9143){return _0x2f9143['setImap'](null);}return null;})[_0x9fa7('0x24')](respondWithStatusCode(_0x3cffe9,null))[_0x9fa7('0x2e')](handleError(_0x3cffe9,null));};exports[_0x9fa7('0x86')]=function(_0x5314b5,_0x57c27e,_0x11bfe6){return db['MailAccount'][_0x9fa7('0x67')]({'where':{'id':_0x5314b5['params']['id']}})[_0x9fa7('0x24')](handleEntityNotFound(_0x57c27e,null))['then'](function(_0x2aade7){if(_0x2aade7){return _0x2aade7[_0x9fa7('0x86')]();}return null;})['then'](respondWithResult(_0x57c27e,null))['catch'](handleError(_0x57c27e,null));};exports['addSmtp']=function(_0x5aa842,_0x4f6f9e,_0x50fdba){if(_0x5aa842[_0x9fa7('0x60')]['id']){delete _0x5aa842[_0x9fa7('0x60')]['id'];}return db[_0x9fa7('0x48')][_0x9fa7('0x5f')]({'where':{'id':_0x5aa842['params']['id']}})[_0x9fa7('0x24')](handleEntityNotFound(_0x4f6f9e,null))[_0x9fa7('0x24')](function(_0x1d0129){if(_0x1d0129){_0x5aa842[_0x9fa7('0x60')][_0x9fa7('0x63')]=_0x1d0129['id'];return db[_0x9fa7('0x43')][_0x9fa7('0x65')](_0x5aa842[_0x9fa7('0x60')]);}})[_0x9fa7('0x24')](respondWithResult(_0x4f6f9e,null))['catch'](handleError(_0x4f6f9e,null));};exports[_0x9fa7('0x87')]=function(_0x358655,_0x4fe07f,_0x428292){return db['MailAccount'][_0x9fa7('0x67')]({'where':{'id':_0x358655[_0x9fa7('0x5d')]['id']}})[_0x9fa7('0x24')](handleEntityNotFound(_0x4fe07f,null))[_0x9fa7('0x24')](function(_0xc6fda2){if(_0xc6fda2){return _0xc6fda2[_0x9fa7('0x88')](null);}return null;})[_0x9fa7('0x24')](respondWithStatusCode(_0x4fe07f,null))[_0x9fa7('0x2e')](handleError(_0x4fe07f,null));};exports['addInteraction']=function(_0x5401da,_0x209b93,_0x4c8aab){return db[_0x9fa7('0x89')][_0x9fa7('0x5f')]({'where':{'id':_0x5401da[_0x9fa7('0x5d')]['id']}})['then'](handleEntityNotFound(_0x209b93,null))[_0x9fa7('0x24')](function(_0x27c92f){if(_0x27c92f){return _0x27c92f['addInteraction'](_0x5401da['body']['ids'],_[_0x9fa7('0x8a')](_0x5401da[_0x9fa7('0x60')],[_0x9fa7('0x6e'),'id'])||{});}})['then'](respondWithResult(_0x209b93,null))[_0x9fa7('0x2e')](handleError(_0x209b93,null));};exports[_0x9fa7('0x8b')]=function(_0x16d6f4,_0x33244d,_0x19844c){var _0x410ab2={'raw':![],'where':{}};var _0x518c23={};var _0x45a534={'count':0x0,'rows':[]};return db[_0x9fa7('0x48')]['findOne']({'where':{'id':_0x16d6f4[_0x9fa7('0x5d')]['id']}})[_0x9fa7('0x24')](handleEntityNotFound(_0x33244d,null))[_0x9fa7('0x24')](function(_0x58a536){if(_0x58a536){_0x518c23[_0x9fa7('0x4f')]=_[_0x9fa7('0x4c')](db['MailInteraction'][_0x9fa7('0x49')]);_0x518c23[_0x9fa7('0x4b')]=_[_0x9fa7('0x4c')](_0x16d6f4[_0x9fa7('0x4b')]);_0x518c23[_0x9fa7('0x4d')]=_[_0x9fa7('0x4e')](_0x518c23[_0x9fa7('0x4f')],_0x518c23[_0x9fa7('0x4b')]);_0x410ab2[_0x9fa7('0x50')]=_[_0x9fa7('0x4e')](_0x518c23['model'],qs[_0x9fa7('0x51')](_0x16d6f4[_0x9fa7('0x4b')][_0x9fa7('0x51')]));_0x410ab2[_0x9fa7('0x50')]=_0x410ab2[_0x9fa7('0x50')]['length']?_0x410ab2[_0x9fa7('0x50')]:_0x518c23[_0x9fa7('0x4f')];if(!_0x16d6f4[_0x9fa7('0x4b')]['hasOwnProperty'](_0x9fa7('0x68'))){_0x410ab2['limit']=qs[_0x9fa7('0x34')](_0x16d6f4['query'][_0x9fa7('0x34')]);_0x410ab2[_0x9fa7('0x33')]=qs[_0x9fa7('0x33')](_0x16d6f4['query'][_0x9fa7('0x33')]);}_0x410ab2['order']=qs[_0x9fa7('0x54')](_0x16d6f4['query']['sort']);_0x410ab2[_0x9fa7('0x55')]=qs[_0x9fa7('0x4d')](_[_0x9fa7('0x69')](_0x16d6f4['query'],_0x518c23['filters']));_0x410ab2[_0x9fa7('0x55')][_0x9fa7('0x63')]=_0x58a536['id'];if(_0x16d6f4[_0x9fa7('0x4b')][_0x9fa7('0x56')]){_0x410ab2[_0x9fa7('0x55')]=_[_0x9fa7('0x57')](_0x410ab2['where'],{'$or':_[_0x9fa7('0x47')](_0x410ab2[_0x9fa7('0x50')],function(_0x558e4d){var _0x247250={};_0x247250[_0x558e4d]={'$like':'%'+_0x16d6f4[_0x9fa7('0x4b')][_0x9fa7('0x56')]+'%'};return _0x247250;})});}_0x410ab2=_['merge']({},_0x410ab2,_0x16d6f4[_0x9fa7('0x5e')]);return db['MailInteraction'][_0x9fa7('0x32')]({'where':_0x410ab2['where']})['then'](function(_0x2e5b48){_0x45a534[_0x9fa7('0x32')]=_0x2e5b48;if(_0x16d6f4['query']['includeAll']){_0x410ab2[_0x9fa7('0x5a')]=[{'model':db['CmContact'],'as':_0x9fa7('0x8c'),'required':![]},{'model':db[_0x9fa7('0x8d')],'as':_0x9fa7('0x8e'),'attributes':[_0x9fa7('0x3e'),_0x9fa7('0x8f'),_0x9fa7('0x90')],'required':![]},{'model':db[_0x9fa7('0x91')],'as':_0x9fa7('0x92'),'attributes':['id',_0x9fa7('0x3e'),_0x9fa7('0x93')],'where':_0x16d6f4[_0x9fa7('0x4b')][_0x9fa7('0x94')]?{'id':_0x16d6f4[_0x9fa7('0x4b')][_0x9fa7('0x94')]}:undefined,'required':_0x16d6f4[_0x9fa7('0x4b')][_0x9fa7('0x94')]?!![]:![]}];}return db[_0x9fa7('0x89')][_0x9fa7('0x5b')](_0x410ab2);})['then'](function(_0x1968ec){_0x45a534['rows']=_0x1968ec;return _0x45a534;});}})[_0x9fa7('0x24')](respondWithFilteredResult(_0x33244d,_0x410ab2))[_0x9fa7('0x2e')](handleError(_0x33244d,null));};exports['addApplications']=function(_0x460fe8,_0x192966,_0x2019ad){return db[_0x9fa7('0x48')]['findOne']({'where':{'id':_0x460fe8[_0x9fa7('0x5d')]['id']}})[_0x9fa7('0x24')](handleEntityNotFound(_0x192966,null))['then'](function(_0xbd864d){if(_0xbd864d){return db['sequelize'][_0x9fa7('0x95')](function(_0x4cf387){return db['MailApplication'][_0x9fa7('0x39')]({'where':{'MailAccountId':_0x460fe8[_0x9fa7('0x5d')]['id']},'transaction':_0x4cf387})[_0x9fa7('0x24')](function(_0x320ffa){var _0x474676=_[_0x9fa7('0x47')](_0x460fe8[_0x9fa7('0x60')],function(_0x4b9dc6){_0x4b9dc6[_0x9fa7('0x63')]=_0x460fe8['params']['id'];return _0x4b9dc6;});return db[_0x9fa7('0x96')][_0x9fa7('0x97')](_0x474676,{'transaction':_0x4cf387});});})['then'](function(){return db[_0x9fa7('0x96')][_0x9fa7('0x98')]({'where':{'MailAccountId':_0x460fe8[_0x9fa7('0x5d')]['id']},'order':_0x9fa7('0x99')});});}})[_0x9fa7('0x24')](respondWithResult(_0x192966,null))[_0x9fa7('0x2e')](handleError(_0x192966,null));};exports['getApplications']=function(_0x56ce12,_0x4a374f,_0x136256){var _0x23822e={};var _0x26e634={};var _0x1049f8;var _0x1be0c4;return db[_0x9fa7('0x48')]['findOne']({'where':{'id':_0x56ce12['params']['id']}})[_0x9fa7('0x24')](handleEntityNotFound(_0x4a374f,null))[_0x9fa7('0x24')](function(_0x4cdde9){if(_0x4cdde9){_0x1049f8=_0x4cdde9;_0x26e634['model']=_[_0x9fa7('0x4c')](db[_0x9fa7('0x96')][_0x9fa7('0x49')]);_0x26e634[_0x9fa7('0x4b')]=_[_0x9fa7('0x4c')](_0x56ce12[_0x9fa7('0x4b')]);_0x26e634[_0x9fa7('0x4d')]=_[_0x9fa7('0x4e')](_0x26e634['model'],_0x26e634[_0x9fa7('0x4b')]);_0x23822e[_0x9fa7('0x50')]=_[_0x9fa7('0x4e')](_0x26e634[_0x9fa7('0x4f')],qs[_0x9fa7('0x51')](_0x56ce12[_0x9fa7('0x4b')][_0x9fa7('0x51')]));_0x23822e[_0x9fa7('0x50')]=_0x23822e[_0x9fa7('0x50')][_0x9fa7('0x52')]?_0x23822e['attributes']:_0x26e634[_0x9fa7('0x4f')];_0x23822e[_0x9fa7('0x53')]=qs['sort'](_0x56ce12[_0x9fa7('0x4b')][_0x9fa7('0x54')]);_0x23822e[_0x9fa7('0x55')]=qs[_0x9fa7('0x4d')](_[_0x9fa7('0x69')](_0x56ce12[_0x9fa7('0x4b')],_0x26e634['filters']));if(_0x56ce12[_0x9fa7('0x4b')][_0x9fa7('0x56')]){_0x23822e[_0x9fa7('0x55')]=_['merge'](_0x23822e[_0x9fa7('0x55')],{'$or':_[_0x9fa7('0x47')](_0x23822e[_0x9fa7('0x50')],function(_0x530b1c){var _0x3f1bad={};_0x3f1bad[_0x530b1c]={'$like':'%'+_0x56ce12[_0x9fa7('0x4b')][_0x9fa7('0x56')]+'%'};return _0x3f1bad;})});}_0x23822e=_[_0x9fa7('0x57')]({},_0x23822e,_0x56ce12[_0x9fa7('0x5e')]);return _0x1049f8['getApplications'](_0x23822e);}})[_0x9fa7('0x24')](function(_0xbfa8b9){if(_0xbfa8b9){_0x1be0c4=_0xbfa8b9[_0x9fa7('0x52')];if(!_0x56ce12[_0x9fa7('0x4b')][_0x9fa7('0x9a')](_0x9fa7('0x68'))){_0x23822e['limit']=qs[_0x9fa7('0x34')](_0x56ce12['query'][_0x9fa7('0x34')]);_0x23822e[_0x9fa7('0x33')]=qs[_0x9fa7('0x33')](_0x56ce12[_0x9fa7('0x4b')]['offset']);}return _0x1049f8[_0x9fa7('0x9b')](_0x23822e);}})[_0x9fa7('0x24')](function(_0x593d30){if(_0x593d30){return _0x593d30?{'count':_0x1be0c4,'rows':_0x593d30}:null;}})[_0x9fa7('0x24')](respondWithResult(_0x4a374f,null))[_0x9fa7('0x2e')](handleError(_0x4a374f,null));};exports[_0x9fa7('0x9c')]=function(_0x341bd6,_0x1faf4e,_0x12913d){var _0x39c33a={'raw':!![],'where':{}};var _0x469d63={};var _0x359e14={'count':0x0,'rows':[]};return db[_0x9fa7('0x48')][_0x9fa7('0x67')]({'where':{'id':_0x341bd6['params']['id']}})[_0x9fa7('0x24')](handleEntityNotFound(_0x1faf4e,null))[_0x9fa7('0x24')](function(_0x125530){if(_0x125530){_0x469d63[_0x9fa7('0x4f')]=_[_0x9fa7('0x4c')](db[_0x9fa7('0x9d')][_0x9fa7('0x49')]);_0x469d63[_0x9fa7('0x4b')]=_['keys'](_0x341bd6[_0x9fa7('0x4b')]);_0x469d63[_0x9fa7('0x4d')]=_[_0x9fa7('0x4e')](_0x469d63[_0x9fa7('0x4f')],_0x469d63[_0x9fa7('0x4b')]);_0x39c33a[_0x9fa7('0x50')]=_[_0x9fa7('0x4e')](_0x469d63['model'],qs['fields'](_0x341bd6[_0x9fa7('0x4b')]['fields']));_0x39c33a[_0x9fa7('0x50')]=_0x39c33a[_0x9fa7('0x50')]['length']?_0x39c33a[_0x9fa7('0x50')]:_0x469d63[_0x9fa7('0x4f')];if(!_0x341bd6['query']['hasOwnProperty'](_0x9fa7('0x68'))){_0x39c33a['limit']=qs[_0x9fa7('0x34')](_0x341bd6['query'][_0x9fa7('0x34')]);_0x39c33a['offset']=qs[_0x9fa7('0x33')](_0x341bd6[_0x9fa7('0x4b')]['offset']);}_0x39c33a[_0x9fa7('0x53')]=qs[_0x9fa7('0x54')](_0x341bd6['query'][_0x9fa7('0x54')]);_0x39c33a[_0x9fa7('0x55')]=qs[_0x9fa7('0x4d')](_[_0x9fa7('0x69')](_0x341bd6[_0x9fa7('0x4b')],_0x469d63['filters']));_0x39c33a[_0x9fa7('0x55')]['MailAccountId']=_0x125530['id'];if(_0x341bd6[_0x9fa7('0x4b')][_0x9fa7('0x56')]){_0x39c33a[_0x9fa7('0x55')]=_[_0x9fa7('0x57')](_0x39c33a['where'],{'$or':_[_0x9fa7('0x47')](_0x39c33a[_0x9fa7('0x50')],function(_0x387bcf){var _0x58a99f={};_0x58a99f[_0x387bcf]={'$like':'%'+_0x341bd6['query']['filter']+'%'};return _0x58a99f;})});}if(_0x341bd6[_0x9fa7('0x4b')][_0x9fa7('0x9e')]){var _0x163da7=_0x341bd6['query']['$gte'][_0x9fa7('0x9f')](',');var _0x10ab9d={};_0x10ab9d[_0x163da7[0x0]]={'$gte':moment(_0x163da7[0x1])[_0x9fa7('0xa0')](_0x9fa7('0xa1'))};_0x39c33a[_0x9fa7('0x55')]=_['merge'](_0x39c33a[_0x9fa7('0x55')],_0x10ab9d);}_0x39c33a=_['merge']({},_0x39c33a,_0x341bd6[_0x9fa7('0x5e')]);return db[_0x9fa7('0x9d')][_0x9fa7('0x32')]({'where':_0x39c33a['where']})[_0x9fa7('0x24')](function(_0xc7578f){_0x359e14['count']=_0xc7578f;if(_0x341bd6[_0x9fa7('0x4b')]['includeAll']){_0x39c33a[_0x9fa7('0x5a')]=[{'all':!![]}];}return db['MailMessage'][_0x9fa7('0x5b')](_0x39c33a);})[_0x9fa7('0x24')](function(_0x444b6d){_0x359e14[_0x9fa7('0x5c')]=_0x444b6d;return _0x359e14;});}})[_0x9fa7('0x24')](respondWithFilteredResult(_0x1faf4e,_0x39c33a))['catch'](handleError(_0x1faf4e,null));};exports[_0x9fa7('0x3f')]=function(_0x5c3be3,_0x5c461d,_0x4243b2){var _0x152b4c,_0x255047={},_0x47bd2d;if(_0x5c3be3['body']['to']){_0x47bd2d=_0x5c3be3[_0x9fa7('0x60')]['to']['split'](',')[0x0];}return db['MailAccount'][_0x9fa7('0x5f')]({'where':{'id':_0x5c3be3['params']['id']},'include':[{'model':db[_0x9fa7('0xa2')],'as':_0x9fa7('0xa3'),'include':[{'model':db[_0x9fa7('0xa4')],'as':'Contacts','where':{'email':_0x47bd2d},'limit':0x1,'order':[[_0x9fa7('0xa5'),_0x9fa7('0xa6')]]}]},{'model':db[_0x9fa7('0x43')],'as':_0x9fa7('0x44'),'raw':!![]}]})[_0x9fa7('0x24')](handleEntityNotFound(_0x5c461d,null))[_0x9fa7('0x24')](function(_0x2b6eac){if(_0x2b6eac){_0x152b4c=_0x2b6eac;if(_0x2b6eac[_0x9fa7('0x44')]){if(_['isNil'](_0x5c3be3[_0x9fa7('0x60')][_0x9fa7('0xa7')])){_0x5c3be3[_0x9fa7('0x60')]['from']=util[_0x9fa7('0xa0')](_0x9fa7('0xa8'),_0x2b6eac['name'],_0x2b6eac[_0x9fa7('0x70')]||_0x2b6eac['Smtp'][_0x9fa7('0x77')]);}if(_0x5c3be3['body'][_0x9fa7('0xa9')]&&_0x5c3be3['body'][_0x9fa7('0xa9')][_0x9fa7('0x52')]){for(var _0x4b9c5f=0x0;_0x4b9c5f<_0x5c3be3[_0x9fa7('0x60')][_0x9fa7('0xa9')][_0x9fa7('0x52')];_0x4b9c5f+=0x1){_0x5c3be3[_0x9fa7('0x60')][_0x9fa7('0xa9')][_0x4b9c5f]={'filename':_0x5c3be3[_0x9fa7('0x60')]['attachments'][_0x4b9c5f][_0x9fa7('0x3e')],'path':path[_0x9fa7('0xaa')](config[_0x9fa7('0xab')],_0x9fa7('0xac'),_0x5c3be3[_0x9fa7('0x60')][_0x9fa7('0xa9')][_0x4b9c5f][_0x9fa7('0xad')])};}}var _0x3ceb07={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x2b6eac[_0x9fa7('0x44')][_0x9fa7('0x7e')])){if(_0x2b6eac[_0x9fa7('0x44')]['authentication']){_0x3ceb07[_0x9fa7('0xae')]={'user':_0x2b6eac[_0x9fa7('0x44')][_0x9fa7('0x77')],'pass':_0x2b6eac[_0x9fa7('0x44')][_0x9fa7('0x79')]};}_0x3ceb07[_0x9fa7('0x7c')]=_0x2b6eac[_0x9fa7('0x44')]['host'];_0x3ceb07[_0x9fa7('0x7d')]=_0x2b6eac[_0x9fa7('0x44')][_0x9fa7('0x7d')];_0x3ceb07[_0x9fa7('0xaf')]=_0x2b6eac['Smtp'][_0x9fa7('0xaf')];}else{_0x3ceb07[_0x9fa7('0x7e')]=_0x2b6eac['Smtp'][_0x9fa7('0x7e')];_0x3ceb07[_0x9fa7('0xae')]={'user':_0x2b6eac['Smtp'][_0x9fa7('0x77')],'pass':_0x2b6eac['Smtp'][_0x9fa7('0x79')]};}return respondWithRpcPromise(_0x9fa7('0xb0'),'sendMail',{'account':_0x3ceb07,'message':_0x5c3be3[_0x9fa7('0x60')]});}else{throw new Error(_0x9fa7('0xb1'));}}})[_0x9fa7('0x24')](function(_0x3dcf96){if(_0x3dcf96){_0x255047=_0x3dcf96;if(_0x152b4c[_0x9fa7('0xa3')]){if(_0x152b4c['List'][_0x9fa7('0xb2')][_0x9fa7('0x52')]){return _0x152b4c[_0x9fa7('0xa3')][_0x9fa7('0xb2')][0x0];}else{return db[_0x9fa7('0xa4')][_0x9fa7('0x65')](_['defaults'](_0x5c3be3[_0x9fa7('0x60')],{'firstName':_0x5c3be3['body']['to'],'email':_0x5c3be3[_0x9fa7('0x60')]['to'],'phone':_0x5c3be3['body']['to'],'ListId':_0x152b4c[_0x9fa7('0x71')]}));}}else{throw new Error(_0x9fa7('0xb1'));}}})[_0x9fa7('0x24')](function(_0x422a06){if(_0x422a06){var _0x4811fb={'UserId':_0x5c3be3[_0x9fa7('0x77')]['id'],'ContactId':_0x422a06['id'],'MailAccountId':_0x152b4c['id'],'inReplyTo':_0x255047[_0x9fa7('0xb3')],'to':_0x5c3be3[_0x9fa7('0x60')][_0x9fa7('0xa7')],'cc':_0x5c3be3[_0x9fa7('0x60')]['cc'],'subject':_0x5c3be3[_0x9fa7('0x60')]['subject'],'attach':_0x5c3be3['body'][_0x9fa7('0xb4')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x9fa7('0xa0')](_0x9fa7('0xa1')),'lastMsgDirection':'out','lastMsgBody':_0x5c3be3[_0x9fa7('0x60')][_0x9fa7('0x60')],'Messages':[_[_0x9fa7('0x57')](_0x5c3be3['body'],{'messageId':_0x255047[_0x9fa7('0xb3')],'sentAt':moment()['format'](_0x9fa7('0xa1')),'read':!![],'MailAccountId':_0x152b4c['id'],'UserId':_0x5c3be3['user']['id'],'ContactId':_0x422a06['id']})]};if(_0x5c3be3[_0x9fa7('0x60')][_0x9fa7('0xb5')]){_0x4811fb=_[_0x9fa7('0x57')](_0x4811fb,_0x5c3be3[_0x9fa7('0x60')]['Interaction']);}return db['MailInteraction'][_0x9fa7('0x65')](_0x4811fb,{'include':[{'model':db[_0x9fa7('0x9d')],'as':_0x9fa7('0xb6')}]});}})[_0x9fa7('0x24')](respondWithResult(_0x5c461d,null))[_0x9fa7('0x2e')](handleError(_0x5c461d,null));};exports[_0x9fa7('0xb7')]=function(_0x565e66,_0xa9e23c,_0x4bfe27){return db[_0x9fa7('0x48')][_0x9fa7('0x5f')]({'where':{'id':_0x565e66['params']['id']},'include':[{'model':db[_0x9fa7('0x43')],'as':_0x9fa7('0x44'),'raw':!![]}]})[_0x9fa7('0x24')](handleEntityNotFound(_0xa9e23c,null))[_0x9fa7('0x24')](function(_0x151397){if(_0x151397&&_0x151397['Smtp']){var _0x3918b8={'id':_0x151397['id'],'tls':{'rejectUnauthorized':![]}};if(_0x151397[_0x9fa7('0x44')][_0x9fa7('0x7e')]){_0x3918b8[_0x9fa7('0x7e')]=_0x151397[_0x9fa7('0x44')][_0x9fa7('0x7e')];}else{_0x3918b8[_0x9fa7('0x7c')]=_0x151397[_0x9fa7('0x44')][_0x9fa7('0x7c')];_0x3918b8[_0x9fa7('0x7d')]=_0x151397[_0x9fa7('0x44')][_0x9fa7('0x7d')];_0x3918b8[_0x9fa7('0xaf')]=_0x151397[_0x9fa7('0x44')][_0x9fa7('0xaf')];}if(_0x151397[_0x9fa7('0x44')][_0x9fa7('0x7b')]){_0x3918b8['auth']={'user':_0x151397[_0x9fa7('0x44')][_0x9fa7('0x77')],'pass':_0x151397[_0x9fa7('0x44')][_0x9fa7('0x79')]};}return respondWithRpcPromise('VerifySmtp',_0x9fa7('0xb7'),{'account':_0x3918b8});}})[_0x9fa7('0x24')](respondWithResult(_0xa9e23c,null))[_0x9fa7('0x2e')](handleError(_0xa9e23c,null));};exports[_0x9fa7('0x39')]=function(_0x4aabc4,_0x659121){return db[_0x9fa7('0x48')][_0x9fa7('0x5f')]({'where':{'id':_0x4aabc4[_0x9fa7('0x5d')]['id']}})[_0x9fa7('0x24')](handleEntityNotFound(_0x659121,null))['then'](function(_0x3cf213){if(_0x3cf213&&_0x3cf213['service']){throw new db[(_0x9fa7('0x21'))][(_0x9fa7('0x22'))](_0x9fa7('0xb8'));}return _0x3cf213;})[_0x9fa7('0x24')](removeEntity(_0x659121,null))[_0x9fa7('0x2e')](handleError(_0x659121,null));};exports[_0x9fa7('0xb9')]=function(_0x419e46,_0x1e8ead,_0x3c9867){return db[_0x9fa7('0x48')][_0x9fa7('0x5f')]({'where':{'id':_0x419e46[_0x9fa7('0x5d')]['id']}})[_0x9fa7('0x24')](handleEntityNotFound(_0x1e8ead,null))[_0x9fa7('0x24')](function(_0x20f099){if(_0x20f099){return _0x20f099[_0x9fa7('0xb9')](_0x419e46[_0x9fa7('0x60')]['ids'],_[_0x9fa7('0x8a')](_0x419e46[_0x9fa7('0x60')],[_0x9fa7('0x6e'),'id'])||{})[_0x9fa7('0xba')](function(_0x10a0c9){for(var _0x2f0144=0x0;_0x2f0144<_0x419e46[_0x9fa7('0x60')]['ids'][_0x9fa7('0x52')];_0x2f0144+=0x1){socket[_0x9fa7('0xbb')](_0x9fa7('0xbc'),{'UserId':_0x419e46[_0x9fa7('0x60')]['ids'][_0x2f0144],'MailAccountId':_0x419e46[_0x9fa7('0x5d')]['id']});}return _0x10a0c9;});}})['then'](respondWithResult(_0x1e8ead,null))['catch'](handleError(_0x1e8ead,null));};exports[_0x9fa7('0xbd')]=function(_0x515220,_0x403d42,_0x4d42b4){return db['MailAccount'][_0x9fa7('0x5f')]({'where':{'id':_0x515220[_0x9fa7('0x5d')]['id']}})[_0x9fa7('0x24')](handleEntityNotFound(_0x403d42,null))['then'](function(_0x4e09f7){if(_0x4e09f7){return _0x4e09f7[_0x9fa7('0xbd')](_0x515220['query'][_0x9fa7('0x6e')])[_0x9fa7('0x24')](function(){if(_[_0x9fa7('0xbe')](_0x515220[_0x9fa7('0x4b')][_0x9fa7('0x6e')])){for(var _0x4cf1fc=0x0;_0x4cf1fc<_0x515220[_0x9fa7('0x4b')][_0x9fa7('0x6e')][_0x9fa7('0x52')];_0x4cf1fc+=0x1){socket['emit'](_0x9fa7('0xbf'),{'UserId':Number(_0x515220['query'][_0x9fa7('0x6e')][_0x4cf1fc]),'MailAccountId':Number(_0x515220[_0x9fa7('0x5d')]['id'])});}}else{socket[_0x9fa7('0xbb')](_0x9fa7('0xbf'),{'UserId':Number(_0x515220['query']['ids']),'MailAccountId':Number(_0x515220[_0x9fa7('0x5d')]['id'])});}});}})[_0x9fa7('0x24')](respondWithStatusCode(_0x403d42,null))[_0x9fa7('0x2e')](handleError(_0x403d42,null));};exports[_0x9fa7('0xc0')]=function(_0x216c47,_0x359ceb,_0x4d6fa2){var _0x16d70d={};var _0x4d8dd3={};var _0x55a274;var _0x512f89;return db[_0x9fa7('0x48')][_0x9fa7('0x67')]({'where':{'id':_0x216c47[_0x9fa7('0x5d')]['id']}})[_0x9fa7('0x24')](handleEntityNotFound(_0x359ceb,null))[_0x9fa7('0x24')](function(_0xc4740f){if(_0xc4740f){_0x55a274=_0xc4740f;_0x4d8dd3[_0x9fa7('0x4f')]=_[_0x9fa7('0x4c')](db['User'][_0x9fa7('0x49')]);_0x4d8dd3[_0x9fa7('0x4b')]=_['keys'](_0x216c47[_0x9fa7('0x4b')]);_0x4d8dd3[_0x9fa7('0x4d')]=_['intersection'](_0x4d8dd3[_0x9fa7('0x4f')],_0x4d8dd3[_0x9fa7('0x4b')]);_0x16d70d[_0x9fa7('0x50')]=_['intersection'](_0x4d8dd3[_0x9fa7('0x4f')],qs[_0x9fa7('0x51')](_0x216c47['query'][_0x9fa7('0x51')]));_0x16d70d['attributes']=_0x16d70d[_0x9fa7('0x50')]['length']?_0x16d70d['attributes']:_0x4d8dd3[_0x9fa7('0x4f')];_0x16d70d[_0x9fa7('0x53')]=qs[_0x9fa7('0x54')](_0x216c47[_0x9fa7('0x4b')][_0x9fa7('0x54')]);_0x16d70d[_0x9fa7('0x55')]=qs[_0x9fa7('0x4d')](_[_0x9fa7('0x69')](_0x216c47[_0x9fa7('0x4b')],_0x4d8dd3[_0x9fa7('0x4d')]));if(_0x216c47['query'][_0x9fa7('0x56')]){_0x16d70d[_0x9fa7('0x55')]=_[_0x9fa7('0x57')](_0x16d70d['where'],{'$or':_[_0x9fa7('0x47')](_0x16d70d[_0x9fa7('0x50')],function(_0x1ca68e){var _0x35ab14={};_0x35ab14[_0x1ca68e]={'$like':'%'+_0x216c47['query']['filter']+'%'};return _0x35ab14;})});}_0x16d70d=_[_0x9fa7('0x57')]({},_0x16d70d,_0x216c47[_0x9fa7('0x5e')]);return _0x55a274[_0x9fa7('0xc0')](_0x16d70d);}})[_0x9fa7('0x24')](function(_0xbe69eb){if(_0xbe69eb){_0x512f89=_0xbe69eb[_0x9fa7('0x52')];if(!_0x216c47[_0x9fa7('0x4b')][_0x9fa7('0x9a')](_0x9fa7('0x68'))){_0x16d70d[_0x9fa7('0x34')]=qs['limit'](_0x216c47[_0x9fa7('0x4b')]['limit']);_0x16d70d[_0x9fa7('0x33')]=qs[_0x9fa7('0x33')](_0x216c47[_0x9fa7('0x4b')][_0x9fa7('0x33')]);}return _0x55a274[_0x9fa7('0xc0')](_0x16d70d);}})[_0x9fa7('0x24')](function(_0x285208){if(_0x285208){return _0x285208?{'count':_0x512f89,'rows':_0x285208}:null;}})[_0x9fa7('0x24')](respondWithResult(_0x359ceb,null))[_0x9fa7('0x2e')](handleError(_0x359ceb,null));}; \ No newline at end of file +var _0x6483=['type','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','MailServerIn','Imap','Pause','mandatoryDispositionPause','include','find','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','order','removeDispositions','addAnswer','CannedAnswer','removeAnswers','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser','pass','cpassword','authentication','host','port','service','password','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','ids','getInteractions','CmContact','Contact','User','Owner','fullname','Tags','tag','addApplications','sequelize','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','CmList','List','Contacts','DESC','attachments','join','server/files/attachments','basename','secure','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Messages','auth','VerifySmtp','verifySmtp','ValidationError','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','ejs','squel','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','redis','defaults','localhost','socket.io-emitter','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','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','end','status','json','count','offset','limit','apply','reject','save','update','destroy','UserProfileResource','sendStatus','stack','name','send','index','MailServerOut','Smtp','map','MailAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter'];(function(_0x43e918,_0x363513){var _0x1694fd=function(_0x5805e8){while(--_0x5805e8){_0x43e918['push'](_0x43e918['shift']());}};_0x1694fd(++_0x363513);}(_0x6483,0x12e));var _0x3648=function(_0x5b87ed,_0x512fb2){_0x5b87ed=_0x5b87ed-0x0;var _0xda7377=_0x6483[_0x5b87ed];return _0xda7377;};'use strict';var pdf=require(_0x3648('0x0'));var emlformat=require(_0x3648('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3648('0x2'));var jsonpatch=require(_0x3648('0x3'));var rp=require(_0x3648('0x4'));var moment=require(_0x3648('0x5'));var BPromise=require(_0x3648('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3648('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3648('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3648('0x9'));var crypto=require('crypto');var jsforce=require(_0x3648('0xa'));var deskjs=require(_0x3648('0xb'));var toCsv=require(_0x3648('0xc'));var querystring=require(_0x3648('0xd'));var Papa=require(_0x3648('0xe'));var Redis=require(_0x3648('0xf'));var authService=require(_0x3648('0x10'));var qs=require(_0x3648('0x11'));var as=require(_0x3648('0x12'));var hardwareService=require(_0x3648('0x13'));var logger=require(_0x3648('0x14'))(_0x3648('0x15'));var utils=require(_0x3648('0x16'));var config=require(_0x3648('0x17'));var db=require('../../mysqldb')['db'];config[_0x3648('0x18')]=_[_0x3648('0x19')](config[_0x3648('0x18')],{'host':_0x3648('0x1a'),'port':0x18eb});var socket=require(_0x3648('0x1b'))(new Redis(config['redis']));require('./mailAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x3648('0x1c')][_0x3648('0x1d')]({'port':0x232b});function checkPasswordPattern(_0x1e4802,_0x448c8a,_0x47297e){if(_0x47297e){var _0x275abf=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x275abf[_0x3648('0x1e')](_0x448c8a)){return _0x1e4802;}else{throw new db[(_0x3648('0x1f'))]['ValidationError'](_0x3648('0x20'));}}else{return _0x1e4802;}}function respondWithRpcPromise(_0x56bb1c,_0x1eb471,_0x5ee731,_0x8a79d8){return new BPromise(function(_0x330e85,_0x498f68){var _0x7e50ce=_0x8a79d8||client;return _0x7e50ce[_0x3648('0x21')](_0x56bb1c,_0x5ee731)[_0x3648('0x22')](function(_0x31bf55){logger['info'](_0x3648('0x23'),_0x1eb471,'request\x20sent');logger['debug'](_0x3648('0x24'),_0x1eb471,_0x3648('0x25'),JSON['stringify'](_0x31bf55));if(_0x31bf55[_0x3648('0x26')]){if(_0x31bf55[_0x3648('0x26')][_0x3648('0x27')]===0x1f4){logger[_0x3648('0x26')](_0x3648('0x23'),_0x1eb471,_0x31bf55['error'][_0x3648('0x28')]);return _0x498f68(_0x31bf55[_0x3648('0x26')][_0x3648('0x28')]);}logger[_0x3648('0x26')](_0x3648('0x23'),_0x1eb471,_0x31bf55['error']['message']);return _0x330e85(_0x31bf55[_0x3648('0x26')][_0x3648('0x28')]);}else{logger[_0x3648('0x29')](_0x3648('0x23'),_0x1eb471,_0x3648('0x25'));_0x330e85(_0x31bf55[_0x3648('0x2a')]['message']);}})[_0x3648('0x2b')](function(_0x50b47e){logger[_0x3648('0x26')](_0x3648('0x23'),_0x1eb471,_0x50b47e);_0x498f68(_0x50b47e);});});}function respondWithStatusCode(_0x4bfe21,_0x17d7c1){_0x17d7c1=_0x17d7c1||0xcc;return function(_0x75e4c6){if(_0x75e4c6){return _0x4bfe21['sendStatus'](_0x17d7c1);}return _0x4bfe21['status'](_0x17d7c1)[_0x3648('0x2c')]();};}function respondWithResult(_0x13baaf,_0x3b382c){_0x3b382c=_0x3b382c||0xc8;return function(_0x2d9cd9){if(_0x2d9cd9){return _0x13baaf[_0x3648('0x2d')](_0x3b382c)[_0x3648('0x2e')](_0x2d9cd9);}};}function respondWithFilteredResult(_0xef4649,_0xf827bd){return function(_0x5f345f){if(_0x5f345f){var _0xefddc7=_0x5f345f[_0x3648('0x2f')],_0x375361=_0xf827bd[_0x3648('0x30')],_0x20578f=_0xf827bd[_0x3648('0x30')]+_0xf827bd[_0x3648('0x31')],_0x49acc9;if(_0x20578f>=_0xefddc7){_0x20578f=_0xefddc7;_0x49acc9=0xc8;}else{_0x49acc9=0xce;}_0xef4649[_0x3648('0x2d')](_0x49acc9);return _0xef4649['set']('Content-Range',_0x375361+'-'+_0x20578f+'/'+_0xefddc7)['json'](_0x5f345f);}return null;};}function patchUpdates(_0xfb83ac){return function(_0xb3fdc5){try{jsonpatch[_0x3648('0x32')](_0xb3fdc5,_0xfb83ac,!![]);}catch(_0x5db44a){return BPromise[_0x3648('0x33')](_0x5db44a);}return _0xb3fdc5[_0x3648('0x34')]();};}function saveUpdates(_0x577808,_0x2367e9){return function(_0x9439c2){if(_0x9439c2){return _0x9439c2[_0x3648('0x35')](_0x577808)['then'](function(_0x2052b3){return _0x2052b3;});}return null;};}function removeEntity(_0x267f3f,_0x2c1315){return function(_0x486450){if(_0x486450){return _0x486450[_0x3648('0x36')]()[_0x3648('0x22')](function(){var _0x50dacb=_0x486450['get']({'plain':!![]});var _0x561124='MailAccounts';return db[_0x3648('0x37')][_0x3648('0x36')]({'where':{'type':_0x561124,'resourceId':_0x50dacb['id']}})[_0x3648('0x22')](function(){return _0x486450;});})['then'](function(){_0x267f3f[_0x3648('0x2d')](0xcc)[_0x3648('0x2c')]();});}};}function handleEntityNotFound(_0x5e363a,_0x3f0485){return function(_0x473477){if(!_0x473477){_0x5e363a[_0x3648('0x38')](0x194);}return _0x473477;};}function handleError(_0x5431e2,_0xff9cfd){_0xff9cfd=_0xff9cfd||0x1f4;return function(_0x406573){logger[_0x3648('0x26')](_0x406573[_0x3648('0x39')]);if(_0x406573[_0x3648('0x3a')]){delete _0x406573[_0x3648('0x3a')];}_0x5431e2[_0x3648('0x2d')](_0xff9cfd)[_0x3648('0x3b')](_0x406573);};}exports[_0x3648('0x3c')]=function(_0x530b80,_0x264f61){var _0x12a84b={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x3648('0x3d')],'as':_0x3648('0x3e')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4a991b={},_0x2990da={'count':0x0,'rows':[]};var _0x27f8dd=_[_0x3648('0x3f')](db[_0x3648('0x40')][_0x3648('0x41')],function(_0x4c40f1){return{'name':_0x4c40f1[_0x3648('0x42')],'type':_0x4c40f1['type'][_0x3648('0x43')]};});_0x4a991b['model']=_[_0x3648('0x3f')](_0x27f8dd,_0x3648('0x3a'));_0x4a991b[_0x3648('0x44')]=_[_0x3648('0x45')](_0x530b80[_0x3648('0x44')]);_0x4a991b[_0x3648('0x46')]=_[_0x3648('0x47')](_0x4a991b[_0x3648('0x48')],_0x4a991b[_0x3648('0x44')]);_0x12a84b[_0x3648('0x49')]=_[_0x3648('0x47')](_0x4a991b[_0x3648('0x48')],qs[_0x3648('0x4a')](_0x530b80[_0x3648('0x44')][_0x3648('0x4a')]));_0x12a84b[_0x3648('0x49')]=_0x12a84b[_0x3648('0x49')][_0x3648('0x4b')]?_0x12a84b[_0x3648('0x49')]:_0x4a991b['model'];if(!_0x530b80[_0x3648('0x44')][_0x3648('0x4c')](_0x3648('0x4d'))){_0x12a84b['limit']=qs[_0x3648('0x31')](_0x530b80[_0x3648('0x44')][_0x3648('0x31')]);_0x12a84b[_0x3648('0x30')]=qs[_0x3648('0x30')](_0x530b80[_0x3648('0x44')][_0x3648('0x30')]);}_0x12a84b['order']=qs['sort'](_0x530b80[_0x3648('0x44')][_0x3648('0x4e')]);_0x12a84b[_0x3648('0x4f')]=qs[_0x3648('0x46')](_[_0x3648('0x50')](_0x530b80[_0x3648('0x44')],_0x4a991b['filters']),_0x27f8dd);if(_0x530b80['query'][_0x3648('0x51')]){_0x12a84b['where']=_['merge'](_0x12a84b[_0x3648('0x4f')],{'$or':_[_0x3648('0x3f')](_0x27f8dd,function(_0x46bfff){if(_0x46bfff[_0x3648('0x52')]!==_0x3648('0x53')){var _0x66fc19={};_0x66fc19[_0x46bfff[_0x3648('0x3a')]]={'$like':'%'+_0x530b80[_0x3648('0x44')][_0x3648('0x51')]+'%'};return _0x66fc19;}})});}_0x12a84b=_[_0x3648('0x54')]({},_0x12a84b,_0x530b80[_0x3648('0x55')]);var _0x28fdba={'where':_0x12a84b['where']};return db[_0x3648('0x40')][_0x3648('0x2f')](_0x28fdba)[_0x3648('0x22')](function(_0x50bb26){_0x2990da['count']=_0x50bb26;if(_0x530b80[_0x3648('0x44')][_0x3648('0x56')]){_0x12a84b['include']=[{'all':!![]}];}return db[_0x3648('0x40')][_0x3648('0x57')](_0x12a84b);})[_0x3648('0x22')](function(_0x302ab6){_0x2990da[_0x3648('0x58')]=_0x302ab6;return _0x2990da;})[_0x3648('0x22')](respondWithFilteredResult(_0x264f61,_0x12a84b))[_0x3648('0x2b')](handleError(_0x264f61,null));};exports[_0x3648('0x59')]=function(_0x1133c4,_0x1d3b40){var _0x51c93b={'raw':![],'where':{'id':_0x1133c4[_0x3648('0x5a')]['id']},'include':[{'model':db[_0x3648('0x5b')],'as':_0x3648('0x5c')},{'model':db['MailServerOut'],'as':_0x3648('0x3e')},{'model':db[_0x3648('0x5d')],'as':_0x3648('0x5e')}]},_0x5c2d6f={};_0x5c2d6f[_0x3648('0x48')]=_[_0x3648('0x45')](db[_0x3648('0x40')][_0x3648('0x41')]);_0x5c2d6f['query']=_[_0x3648('0x45')](_0x1133c4['query']);_0x5c2d6f['filters']=_[_0x3648('0x47')](_0x5c2d6f[_0x3648('0x48')],_0x5c2d6f[_0x3648('0x44')]);_0x51c93b[_0x3648('0x49')]=_[_0x3648('0x47')](_0x5c2d6f[_0x3648('0x48')],qs[_0x3648('0x4a')](_0x1133c4[_0x3648('0x44')][_0x3648('0x4a')]));_0x51c93b['attributes']=_0x51c93b[_0x3648('0x49')][_0x3648('0x4b')]?_0x51c93b[_0x3648('0x49')]:_0x5c2d6f[_0x3648('0x48')];if(_0x1133c4['query'][_0x3648('0x56')]){_0x51c93b[_0x3648('0x5f')]=[{'all':!![]}];}_0x51c93b=_['merge']({},_0x51c93b,_0x1133c4[_0x3648('0x55')]);return db['MailAccount'][_0x3648('0x60')](_0x51c93b)['then'](handleEntityNotFound(_0x1d3b40,null))[_0x3648('0x22')](respondWithResult(_0x1d3b40,null))[_0x3648('0x2b')](handleError(_0x1d3b40,null));};exports['update']=function(_0x449b5a,_0x1cb1f6){if(_0x449b5a[_0x3648('0x61')]['id']){delete _0x449b5a[_0x3648('0x61')]['id'];}return db[_0x3648('0x40')][_0x3648('0x60')]({'where':{'id':_0x449b5a[_0x3648('0x5a')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x3648('0x5c')},{'model':db[_0x3648('0x3d')],'as':'Smtp'},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x1cb1f6,null))[_0x3648('0x22')](saveUpdates(_0x449b5a[_0x3648('0x61')],null))[_0x3648('0x22')](function(_0x6c1ac){if(_0x6c1ac&&_0x449b5a[_0x3648('0x61')]['Imap']){return db[_0x3648('0x5b')][_0x3648('0x35')](_0x449b5a[_0x3648('0x61')][_0x3648('0x5c')],{'where':{'MailAccountId':_0x6c1ac['id']}})[_0x3648('0x22')](function(){return _0x6c1ac;});}return _0x6c1ac;})[_0x3648('0x22')](function(_0x2efb00){if(_0x2efb00&&_0x449b5a[_0x3648('0x61')]['Smtp']){return db[_0x3648('0x3d')][_0x3648('0x35')](_0x449b5a['body'][_0x3648('0x3e')],{'where':{'MailAccountId':_0x2efb00['id']}})[_0x3648('0x22')](function(){return _0x2efb00;});}return _0x2efb00;})[_0x3648('0x22')](respondWithResult(_0x1cb1f6,null))['catch'](handleError(_0x1cb1f6,null));};exports[_0x3648('0x62')]=function(_0x558ed2,_0x6fe882){return db['MailAccount']['describe']()['then'](respondWithResult(_0x6fe882,null))['catch'](handleError(_0x6fe882,null));};exports[_0x3648('0x63')]=function(_0x4825e2,_0xde4316,_0x1da406){if(_0x4825e2[_0x3648('0x61')]['id']){delete _0x4825e2[_0x3648('0x61')]['id'];}return db[_0x3648('0x40')][_0x3648('0x60')]({'where':{'id':_0x4825e2[_0x3648('0x5a')]['id']}})[_0x3648('0x22')](handleEntityNotFound(_0xde4316,null))[_0x3648('0x22')](function(_0x394dc6){if(_0x394dc6){_0x4825e2['body'][_0x3648('0x64')]=_0x394dc6['id'];return db[_0x3648('0x65')][_0x3648('0x66')](_0x4825e2[_0x3648('0x61')]);}})[_0x3648('0x22')](respondWithResult(_0xde4316,null))[_0x3648('0x2b')](handleError(_0xde4316,null));};exports[_0x3648('0x67')]=function(_0x3a62a0,_0x52fdbf,_0x2a884c){var _0x517b31={'raw':![],'where':{}};var _0x39c6dc={};var _0x2193a8={'count':0x0,'rows':[]};return db[_0x3648('0x40')][_0x3648('0x68')]({'where':{'id':_0x3a62a0[_0x3648('0x5a')]['id']}})[_0x3648('0x22')](handleEntityNotFound(_0x52fdbf,null))[_0x3648('0x22')](function(_0x3d2335){if(_0x3d2335){_0x39c6dc['model']=_[_0x3648('0x45')](db[_0x3648('0x65')][_0x3648('0x41')]);_0x39c6dc[_0x3648('0x44')]=_[_0x3648('0x45')](_0x3a62a0['query']);_0x39c6dc[_0x3648('0x46')]=_[_0x3648('0x47')](_0x39c6dc['model'],_0x39c6dc[_0x3648('0x44')]);_0x517b31[_0x3648('0x49')]=_[_0x3648('0x47')](_0x39c6dc[_0x3648('0x48')],qs[_0x3648('0x4a')](_0x3a62a0[_0x3648('0x44')][_0x3648('0x4a')]));_0x517b31[_0x3648('0x49')]=_0x517b31[_0x3648('0x49')][_0x3648('0x4b')]?_0x517b31['attributes']:_0x39c6dc[_0x3648('0x48')];if(!_0x3a62a0[_0x3648('0x44')][_0x3648('0x4c')](_0x3648('0x4d'))){_0x517b31[_0x3648('0x31')]=qs[_0x3648('0x31')](_0x3a62a0[_0x3648('0x44')][_0x3648('0x31')]);_0x517b31['offset']=qs['offset'](_0x3a62a0[_0x3648('0x44')][_0x3648('0x30')]);}_0x517b31[_0x3648('0x69')]=qs[_0x3648('0x4e')](_0x3a62a0['query'][_0x3648('0x4e')]);_0x517b31[_0x3648('0x4f')]=qs['filters'](_[_0x3648('0x50')](_0x3a62a0[_0x3648('0x44')],_0x39c6dc['filters']));_0x517b31[_0x3648('0x4f')][_0x3648('0x64')]=_0x3d2335['id'];if(_0x3a62a0[_0x3648('0x44')][_0x3648('0x51')]){_0x517b31[_0x3648('0x4f')]=_[_0x3648('0x54')](_0x517b31[_0x3648('0x4f')],{'$or':_[_0x3648('0x3f')](_0x517b31[_0x3648('0x49')],function(_0xb5f407){var _0x3759f6={};_0x3759f6[_0xb5f407]={'$like':'%'+_0x3a62a0[_0x3648('0x44')]['filter']+'%'};return _0x3759f6;})});}_0x517b31=_[_0x3648('0x54')]({},_0x517b31,_0x3a62a0[_0x3648('0x55')]);return db['Disposition'][_0x3648('0x2f')]({'where':_0x517b31[_0x3648('0x4f')]})[_0x3648('0x22')](function(_0x320d78){_0x2193a8[_0x3648('0x2f')]=_0x320d78;if(_0x3a62a0[_0x3648('0x44')][_0x3648('0x56')]){_0x517b31[_0x3648('0x5f')]=[{'all':!![]}];}return db[_0x3648('0x65')]['findAll'](_0x517b31);})[_0x3648('0x22')](function(_0x192f14){_0x2193a8[_0x3648('0x58')]=_0x192f14;return _0x2193a8;});}})[_0x3648('0x22')](respondWithFilteredResult(_0x52fdbf,_0x517b31))[_0x3648('0x2b')](handleError(_0x52fdbf,null));};exports[_0x3648('0x6a')]=function(_0x33bb9e,_0x1d9407,_0x3cb569){return db[_0x3648('0x40')][_0x3648('0x60')]({'where':{'id':_0x33bb9e['params']['id']}})['then'](handleEntityNotFound(_0x1d9407,null))[_0x3648('0x22')](function(_0x7dc416){if(_0x7dc416){return _0x7dc416['removeDispositions'](_0x33bb9e['query']['ids']);}})[_0x3648('0x22')](respondWithStatusCode(_0x1d9407,null))['catch'](handleError(_0x1d9407,null));};exports[_0x3648('0x6b')]=function(_0x45691b,_0x53776d,_0x220355){if(_0x45691b[_0x3648('0x61')]['id']){delete _0x45691b[_0x3648('0x61')]['id'];}return db[_0x3648('0x40')]['find']({'where':{'id':_0x45691b[_0x3648('0x5a')]['id']}})[_0x3648('0x22')](handleEntityNotFound(_0x53776d,null))['then'](function(_0x40a22e){if(_0x40a22e){_0x45691b['body'][_0x3648('0x64')]=_0x40a22e['id'];return db[_0x3648('0x6c')][_0x3648('0x66')](_0x45691b['body']);}})[_0x3648('0x22')](respondWithResult(_0x53776d,null))[_0x3648('0x2b')](handleError(_0x53776d,null));};exports['getAnswers']=function(_0x47c87d,_0x42ad7e,_0x186c69){var _0x6bafcd={'raw':![],'where':{}};var _0x46681d={};var _0x3506f1={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x47c87d['params']['id']}})['then'](handleEntityNotFound(_0x42ad7e,null))[_0x3648('0x22')](function(_0x32ea98){if(_0x32ea98){_0x46681d[_0x3648('0x48')]=_[_0x3648('0x45')](db[_0x3648('0x6c')]['rawAttributes']);_0x46681d[_0x3648('0x44')]=_[_0x3648('0x45')](_0x47c87d[_0x3648('0x44')]);_0x46681d[_0x3648('0x46')]=_['intersection'](_0x46681d[_0x3648('0x48')],_0x46681d[_0x3648('0x44')]);_0x6bafcd[_0x3648('0x49')]=_[_0x3648('0x47')](_0x46681d[_0x3648('0x48')],qs['fields'](_0x47c87d[_0x3648('0x44')][_0x3648('0x4a')]));_0x6bafcd[_0x3648('0x49')]=_0x6bafcd[_0x3648('0x49')][_0x3648('0x4b')]?_0x6bafcd[_0x3648('0x49')]:_0x46681d[_0x3648('0x48')];if(!_0x47c87d[_0x3648('0x44')]['hasOwnProperty']('nolimit')){_0x6bafcd[_0x3648('0x31')]=qs['limit'](_0x47c87d[_0x3648('0x44')][_0x3648('0x31')]);_0x6bafcd[_0x3648('0x30')]=qs['offset'](_0x47c87d[_0x3648('0x44')][_0x3648('0x30')]);}_0x6bafcd[_0x3648('0x69')]=qs['sort'](_0x47c87d[_0x3648('0x44')]['sort']);_0x6bafcd[_0x3648('0x4f')]=qs['filters'](_[_0x3648('0x50')](_0x47c87d['query'],_0x46681d[_0x3648('0x46')]));_0x6bafcd[_0x3648('0x4f')][_0x3648('0x64')]=_0x32ea98['id'];if(_0x47c87d[_0x3648('0x44')][_0x3648('0x51')]){_0x6bafcd[_0x3648('0x4f')]=_[_0x3648('0x54')](_0x6bafcd['where'],{'$or':_[_0x3648('0x3f')](_0x6bafcd[_0x3648('0x49')],function(_0x433181){var _0x53410a={};_0x53410a[_0x433181]={'$like':'%'+_0x47c87d[_0x3648('0x44')][_0x3648('0x51')]+'%'};return _0x53410a;})});}_0x6bafcd=_[_0x3648('0x54')]({},_0x6bafcd,_0x47c87d[_0x3648('0x55')]);return db[_0x3648('0x6c')]['count']({'where':_0x6bafcd[_0x3648('0x4f')]})[_0x3648('0x22')](function(_0x2b0222){_0x3506f1['count']=_0x2b0222;if(_0x47c87d['query'][_0x3648('0x56')]){_0x6bafcd['include']=[{'all':!![]}];}return db[_0x3648('0x6c')][_0x3648('0x57')](_0x6bafcd);})[_0x3648('0x22')](function(_0x35257d){_0x3506f1[_0x3648('0x58')]=_0x35257d;return _0x3506f1;});}})['then'](respondWithFilteredResult(_0x42ad7e,_0x6bafcd))['catch'](handleError(_0x42ad7e,null));};exports[_0x3648('0x6d')]=function(_0x4cf72d,_0x414430,_0x5e615d){return db[_0x3648('0x40')]['find']({'where':{'id':_0x4cf72d[_0x3648('0x5a')]['id']}})[_0x3648('0x22')](handleEntityNotFound(_0x414430,null))[_0x3648('0x22')](function(_0xdfe619){if(_0xdfe619){return _0xdfe619[_0x3648('0x6d')](_0x4cf72d['query']['ids']);}})[_0x3648('0x22')](respondWithStatusCode(_0x414430,null))[_0x3648('0x2b')](handleError(_0x414430,null));};exports[_0x3648('0x66')]=function(_0x51912f,_0x185f82){var _0x23fe64={'name':_0x51912f[_0x3648('0x61')][_0x3648('0x3a')],'key':_0x51912f['body'][_0x3648('0x43')],'email':_0x51912f[_0x3648('0x61')][_0x3648('0x6e')],'ListId':_0x51912f[_0x3648('0x61')][_0x3648('0x6f')],'active':!_[_0x3648('0x70')](_0x51912f[_0x3648('0x61')]['active'])?_0x51912f[_0x3648('0x61')][_0x3648('0x71')]:!![],'description':_0x51912f['body'][_0x3648('0x72')]||null,'Imap':{},'Smtp':{}};if(_[_0x3648('0x70')](_0x51912f[_0x3648('0x61')][_0x3648('0x73')])){if(_0x51912f[_0x3648('0x61')][_0x3648('0x74')]){_0x23fe64[_0x3648('0x5c')][_0x3648('0x75')]=_0x23fe64[_0x3648('0x3e')][_0x3648('0x75')]=_0x51912f[_0x3648('0x61')][_0x3648('0x76')];_0x23fe64['Imap']['password']=_0x23fe64[_0x3648('0x3e')][_0x3648('0x77')]=_0x51912f[_0x3648('0x61')][_0x3648('0x78')];}else{_0x23fe64[_0x3648('0x5c')][_0x3648('0x79')]=_0x23fe64[_0x3648('0x3e')][_0x3648('0x79')]=![];}_0x23fe64[_0x3648('0x5c')][_0x3648('0x7a')]=_0x51912f['body'][_0x3648('0x5c')]['host'];_0x23fe64[_0x3648('0x5c')][_0x3648('0x7b')]=_0x51912f['body'][_0x3648('0x5c')][_0x3648('0x7b')];_0x23fe64['Smtp'][_0x3648('0x7a')]=_0x51912f[_0x3648('0x61')]['Smtp'][_0x3648('0x7a')];_0x23fe64[_0x3648('0x3e')][_0x3648('0x7b')]=_0x51912f[_0x3648('0x61')][_0x3648('0x3e')][_0x3648('0x7b')];}else{_0x23fe64[_0x3648('0x5c')][_0x3648('0x7c')]=_0x23fe64['Smtp'][_0x3648('0x7c')]=_0x51912f[_0x3648('0x61')][_0x3648('0x73')];_0x23fe64[_0x3648('0x5c')][_0x3648('0x75')]=_0x23fe64[_0x3648('0x3e')][_0x3648('0x75')]=_0x51912f[_0x3648('0x61')][_0x3648('0x76')];_0x23fe64[_0x3648('0x5c')][_0x3648('0x7d')]=_0x23fe64[_0x3648('0x3e')][_0x3648('0x77')]=_0x51912f[_0x3648('0x61')]['cpassword'];}return db[_0x3648('0x40')]['create'](_0x23fe64,{'include':[{'model':db[_0x3648('0x3d')],'as':'Smtp'},{'model':db[_0x3648('0x5b')],'as':'Imap'}]})['then'](function(_0x4baa28){var _0x238276=_0x51912f[_0x3648('0x75')][_0x3648('0x7e')]({'plain':!![]});if(!_0x238276)throw new Error(_0x3648('0x7f'));if(_0x238276[_0x3648('0x80')]==='user'){var _0x676a7=_0x4baa28['get']({'plain':!![]});return db[_0x3648('0x81')][_0x3648('0x60')]({'where':{'name':_0x3648('0x82'),'userProfileId':_0x238276[_0x3648('0x83')]},'raw':!![]})[_0x3648('0x22')](function(_0x5f1bd9){if(_0x5f1bd9&&_0x5f1bd9['autoAssociation']===0x0){return db[_0x3648('0x37')][_0x3648('0x66')]({'name':_0x676a7[_0x3648('0x3a')],'resourceId':_0x676a7['id'],'type':_0x5f1bd9[_0x3648('0x3a')],'sectionId':_0x5f1bd9['id']},{})[_0x3648('0x22')](function(){return _0x4baa28;});}else{return _0x4baa28;}})[_0x3648('0x2b')](function(_0x53c33a){logger['error'](_0x3648('0x84'),_0x53c33a);throw _0x53c33a;});}return _0x4baa28;})[_0x3648('0x22')](respondWithResult(_0x185f82,0xc9))[_0x3648('0x2b')](handleError(_0x185f82,null));};exports[_0x3648('0x85')]=function(_0x32511e,_0x4855f2,_0xf03b0b){return db[_0x3648('0x40')]['findOne']({'where':{'id':_0x32511e[_0x3648('0x5a')]['id']}})[_0x3648('0x22')](handleEntityNotFound(_0x4855f2,null))[_0x3648('0x22')](function(_0x472302){if(_0x472302){return _0x472302[_0x3648('0x85')]();}return null;})[_0x3648('0x22')](respondWithResult(_0x4855f2,null))['catch'](handleError(_0x4855f2,null));};exports['addImap']=function(_0x220773,_0x232fd7,_0x186985){if(_0x220773[_0x3648('0x61')]['id']){delete _0x220773[_0x3648('0x61')]['id'];}return db['MailAccount'][_0x3648('0x60')]({'where':{'id':_0x220773['params']['id']}})[_0x3648('0x22')](handleEntityNotFound(_0x232fd7,null))['then'](function(_0x3bae1c){if(_0x3bae1c){_0x220773['body'][_0x3648('0x64')]=_0x3bae1c['id'];return db['MailServerIn'][_0x3648('0x66')](_0x220773['body']);}})[_0x3648('0x22')](respondWithResult(_0x232fd7,null))[_0x3648('0x2b')](handleError(_0x232fd7,null));};exports[_0x3648('0x86')]=function(_0x2cbacb,_0x17ebda,_0x3ef204){return db[_0x3648('0x40')][_0x3648('0x68')]({'where':{'id':_0x2cbacb[_0x3648('0x5a')]['id']}})['then'](handleEntityNotFound(_0x17ebda,null))[_0x3648('0x22')](function(_0x7ca451){if(_0x7ca451){return _0x7ca451['setImap'](null);}return null;})[_0x3648('0x22')](respondWithStatusCode(_0x17ebda,null))['catch'](handleError(_0x17ebda,null));};exports[_0x3648('0x87')]=function(_0xfea7ff,_0x55450a,_0x36725b){return db[_0x3648('0x40')][_0x3648('0x68')]({'where':{'id':_0xfea7ff[_0x3648('0x5a')]['id']}})[_0x3648('0x22')](handleEntityNotFound(_0x55450a,null))[_0x3648('0x22')](function(_0x12a101){if(_0x12a101){return _0x12a101[_0x3648('0x87')]();}return null;})[_0x3648('0x22')](respondWithResult(_0x55450a,null))[_0x3648('0x2b')](handleError(_0x55450a,null));};exports[_0x3648('0x88')]=function(_0xda0045,_0x1b3745,_0x3ab06a){if(_0xda0045[_0x3648('0x61')]['id']){delete _0xda0045[_0x3648('0x61')]['id'];}return db[_0x3648('0x40')][_0x3648('0x60')]({'where':{'id':_0xda0045[_0x3648('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1b3745,null))['then'](function(_0x47c684){if(_0x47c684){_0xda0045[_0x3648('0x61')][_0x3648('0x64')]=_0x47c684['id'];return db[_0x3648('0x3d')]['create'](_0xda0045[_0x3648('0x61')]);}})[_0x3648('0x22')](respondWithResult(_0x1b3745,null))['catch'](handleError(_0x1b3745,null));};exports[_0x3648('0x89')]=function(_0x4239d8,_0x281489,_0x2dce2c){return db[_0x3648('0x40')][_0x3648('0x68')]({'where':{'id':_0x4239d8[_0x3648('0x5a')]['id']}})[_0x3648('0x22')](handleEntityNotFound(_0x281489,null))[_0x3648('0x22')](function(_0x558ef8){if(_0x558ef8){return _0x558ef8[_0x3648('0x8a')](null);}return null;})[_0x3648('0x22')](respondWithStatusCode(_0x281489,null))[_0x3648('0x2b')](handleError(_0x281489,null));};exports[_0x3648('0x8b')]=function(_0x39d625,_0x16b885,_0x502362){return db[_0x3648('0x8c')][_0x3648('0x60')]({'where':{'id':_0x39d625[_0x3648('0x5a')]['id']}})[_0x3648('0x22')](handleEntityNotFound(_0x16b885,null))[_0x3648('0x22')](function(_0x5a2964){if(_0x5a2964){return _0x5a2964[_0x3648('0x8b')](_0x39d625['body'][_0x3648('0x8d')],_['omit'](_0x39d625[_0x3648('0x61')],[_0x3648('0x8d'),'id'])||{});}})[_0x3648('0x22')](respondWithResult(_0x16b885,null))[_0x3648('0x2b')](handleError(_0x16b885,null));};exports[_0x3648('0x8e')]=function(_0x39a7b4,_0xbb16a,_0x553ac2){var _0x51a522={'raw':![],'where':{}};var _0x1102f2={};var _0x5f23a7={'count':0x0,'rows':[]};return db[_0x3648('0x40')][_0x3648('0x68')]({'where':{'id':_0x39a7b4[_0x3648('0x5a')]['id']}})[_0x3648('0x22')](handleEntityNotFound(_0xbb16a,null))[_0x3648('0x22')](function(_0x48b251){if(_0x48b251){_0x1102f2[_0x3648('0x48')]=_[_0x3648('0x45')](db[_0x3648('0x8c')][_0x3648('0x41')]);_0x1102f2[_0x3648('0x44')]=_['keys'](_0x39a7b4[_0x3648('0x44')]);_0x1102f2[_0x3648('0x46')]=_['intersection'](_0x1102f2[_0x3648('0x48')],_0x1102f2[_0x3648('0x44')]);_0x51a522[_0x3648('0x49')]=_[_0x3648('0x47')](_0x1102f2[_0x3648('0x48')],qs[_0x3648('0x4a')](_0x39a7b4[_0x3648('0x44')][_0x3648('0x4a')]));_0x51a522[_0x3648('0x49')]=_0x51a522[_0x3648('0x49')][_0x3648('0x4b')]?_0x51a522['attributes']:_0x1102f2[_0x3648('0x48')];if(!_0x39a7b4[_0x3648('0x44')][_0x3648('0x4c')](_0x3648('0x4d'))){_0x51a522[_0x3648('0x31')]=qs[_0x3648('0x31')](_0x39a7b4[_0x3648('0x44')]['limit']);_0x51a522[_0x3648('0x30')]=qs[_0x3648('0x30')](_0x39a7b4[_0x3648('0x44')][_0x3648('0x30')]);}_0x51a522[_0x3648('0x69')]=qs['sort'](_0x39a7b4[_0x3648('0x44')][_0x3648('0x4e')]);_0x51a522['where']=qs[_0x3648('0x46')](_[_0x3648('0x50')](_0x39a7b4[_0x3648('0x44')],_0x1102f2['filters']));_0x51a522[_0x3648('0x4f')][_0x3648('0x64')]=_0x48b251['id'];if(_0x39a7b4[_0x3648('0x44')][_0x3648('0x51')]){_0x51a522['where']=_[_0x3648('0x54')](_0x51a522['where'],{'$or':_[_0x3648('0x3f')](_0x51a522[_0x3648('0x49')],function(_0x109c28){var _0x4985e2={};_0x4985e2[_0x109c28]={'$like':'%'+_0x39a7b4[_0x3648('0x44')]['filter']+'%'};return _0x4985e2;})});}_0x51a522=_[_0x3648('0x54')]({},_0x51a522,_0x39a7b4[_0x3648('0x55')]);return db[_0x3648('0x8c')]['count']({'where':_0x51a522[_0x3648('0x4f')]})[_0x3648('0x22')](function(_0x2ca908){_0x5f23a7[_0x3648('0x2f')]=_0x2ca908;if(_0x39a7b4[_0x3648('0x44')]['includeAll']){_0x51a522[_0x3648('0x5f')]=[{'model':db[_0x3648('0x8f')],'as':_0x3648('0x90'),'required':![]},{'model':db[_0x3648('0x91')],'as':_0x3648('0x92'),'attributes':[_0x3648('0x3a'),_0x3648('0x93'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x3648('0x94'),'attributes':['id',_0x3648('0x3a'),'color'],'where':_0x39a7b4[_0x3648('0x44')][_0x3648('0x95')]?{'id':_0x39a7b4[_0x3648('0x44')][_0x3648('0x95')]}:undefined,'required':_0x39a7b4[_0x3648('0x44')][_0x3648('0x95')]?!![]:![]}];}return db[_0x3648('0x8c')][_0x3648('0x57')](_0x51a522);})[_0x3648('0x22')](function(_0x5bf405){_0x5f23a7[_0x3648('0x58')]=_0x5bf405;return _0x5f23a7;});}})[_0x3648('0x22')](respondWithFilteredResult(_0xbb16a,_0x51a522))[_0x3648('0x2b')](handleError(_0xbb16a,null));};exports[_0x3648('0x96')]=function(_0x243853,_0x16aed3,_0x2af1be){return db[_0x3648('0x40')][_0x3648('0x68')]({'where':{'id':_0x243853[_0x3648('0x5a')]['id']}})[_0x3648('0x22')](handleEntityNotFound(_0x16aed3,null))[_0x3648('0x22')](function(_0x446784){if(_0x446784){return db[_0x3648('0x97')]['transaction'](function(_0x76fe88){return db[_0x3648('0x98')]['destroy']({'where':{'MailAccountId':_0x243853[_0x3648('0x5a')]['id']},'transaction':_0x76fe88})[_0x3648('0x22')](function(_0x11d844){var _0x3b0fd9=_['map'](_0x243853[_0x3648('0x61')],function(_0x1fc884){_0x1fc884[_0x3648('0x64')]=_0x243853['params']['id'];return _0x1fc884;});return db[_0x3648('0x98')][_0x3648('0x99')](_0x3b0fd9,{'transaction':_0x76fe88});});})[_0x3648('0x22')](function(){return db[_0x3648('0x98')][_0x3648('0x9a')]({'where':{'MailAccountId':_0x243853[_0x3648('0x5a')]['id']},'order':_0x3648('0x9b')});});}})[_0x3648('0x22')](respondWithResult(_0x16aed3,null))['catch'](handleError(_0x16aed3,null));};exports[_0x3648('0x9c')]=function(_0x4c7136,_0x12e57a,_0x2780c7){var _0xc0ded0={};var _0x51ab1e={};var _0xcd72c4;var _0x670787;return db['MailAccount'][_0x3648('0x68')]({'where':{'id':_0x4c7136[_0x3648('0x5a')]['id']}})[_0x3648('0x22')](handleEntityNotFound(_0x12e57a,null))[_0x3648('0x22')](function(_0x5e63e3){if(_0x5e63e3){_0xcd72c4=_0x5e63e3;_0x51ab1e[_0x3648('0x48')]=_[_0x3648('0x45')](db['MailApplication'][_0x3648('0x41')]);_0x51ab1e[_0x3648('0x44')]=_[_0x3648('0x45')](_0x4c7136['query']);_0x51ab1e[_0x3648('0x46')]=_[_0x3648('0x47')](_0x51ab1e[_0x3648('0x48')],_0x51ab1e[_0x3648('0x44')]);_0xc0ded0[_0x3648('0x49')]=_[_0x3648('0x47')](_0x51ab1e[_0x3648('0x48')],qs['fields'](_0x4c7136[_0x3648('0x44')][_0x3648('0x4a')]));_0xc0ded0[_0x3648('0x49')]=_0xc0ded0[_0x3648('0x49')]['length']?_0xc0ded0[_0x3648('0x49')]:_0x51ab1e[_0x3648('0x48')];_0xc0ded0[_0x3648('0x69')]=qs[_0x3648('0x4e')](_0x4c7136[_0x3648('0x44')][_0x3648('0x4e')]);_0xc0ded0[_0x3648('0x4f')]=qs[_0x3648('0x46')](_[_0x3648('0x50')](_0x4c7136['query'],_0x51ab1e['filters']));if(_0x4c7136[_0x3648('0x44')][_0x3648('0x51')]){_0xc0ded0[_0x3648('0x4f')]=_[_0x3648('0x54')](_0xc0ded0[_0x3648('0x4f')],{'$or':_[_0x3648('0x3f')](_0xc0ded0[_0x3648('0x49')],function(_0x3e5b05){var _0x228fb4={};_0x228fb4[_0x3e5b05]={'$like':'%'+_0x4c7136['query'][_0x3648('0x51')]+'%'};return _0x228fb4;})});}_0xc0ded0=_['merge']({},_0xc0ded0,_0x4c7136['options']);return _0xcd72c4['getApplications'](_0xc0ded0);}})[_0x3648('0x22')](function(_0x11b045){if(_0x11b045){_0x670787=_0x11b045[_0x3648('0x4b')];if(!_0x4c7136['query']['hasOwnProperty'](_0x3648('0x4d'))){_0xc0ded0['limit']=qs[_0x3648('0x31')](_0x4c7136[_0x3648('0x44')][_0x3648('0x31')]);_0xc0ded0[_0x3648('0x30')]=qs[_0x3648('0x30')](_0x4c7136['query'][_0x3648('0x30')]);}return _0xcd72c4[_0x3648('0x9c')](_0xc0ded0);}})['then'](function(_0x456692){if(_0x456692){return _0x456692?{'count':_0x670787,'rows':_0x456692}:null;}})[_0x3648('0x22')](respondWithResult(_0x12e57a,null))[_0x3648('0x2b')](handleError(_0x12e57a,null));};exports[_0x3648('0x9d')]=function(_0x503b5d,_0xaa5c06,_0x451a7b){var _0x22569c={'raw':!![],'where':{}};var _0x590b25={};var _0x413896={'count':0x0,'rows':[]};return db[_0x3648('0x40')][_0x3648('0x68')]({'where':{'id':_0x503b5d[_0x3648('0x5a')]['id']}})['then'](handleEntityNotFound(_0xaa5c06,null))[_0x3648('0x22')](function(_0x19dff4){if(_0x19dff4){_0x590b25[_0x3648('0x48')]=_['keys'](db[_0x3648('0x9e')]['rawAttributes']);_0x590b25[_0x3648('0x44')]=_[_0x3648('0x45')](_0x503b5d[_0x3648('0x44')]);_0x590b25[_0x3648('0x46')]=_[_0x3648('0x47')](_0x590b25[_0x3648('0x48')],_0x590b25['query']);_0x22569c[_0x3648('0x49')]=_[_0x3648('0x47')](_0x590b25['model'],qs['fields'](_0x503b5d[_0x3648('0x44')]['fields']));_0x22569c[_0x3648('0x49')]=_0x22569c['attributes']['length']?_0x22569c[_0x3648('0x49')]:_0x590b25[_0x3648('0x48')];if(!_0x503b5d['query'][_0x3648('0x4c')](_0x3648('0x4d'))){_0x22569c[_0x3648('0x31')]=qs[_0x3648('0x31')](_0x503b5d['query'][_0x3648('0x31')]);_0x22569c[_0x3648('0x30')]=qs['offset'](_0x503b5d[_0x3648('0x44')][_0x3648('0x30')]);}_0x22569c[_0x3648('0x69')]=qs[_0x3648('0x4e')](_0x503b5d[_0x3648('0x44')][_0x3648('0x4e')]);_0x22569c[_0x3648('0x4f')]=qs[_0x3648('0x46')](_['pick'](_0x503b5d[_0x3648('0x44')],_0x590b25['filters']));_0x22569c[_0x3648('0x4f')]['MailAccountId']=_0x19dff4['id'];if(_0x503b5d['query'][_0x3648('0x51')]){_0x22569c[_0x3648('0x4f')]=_[_0x3648('0x54')](_0x22569c['where'],{'$or':_['map'](_0x22569c[_0x3648('0x49')],function(_0xb5258d){var _0x1c9d04={};_0x1c9d04[_0xb5258d]={'$like':'%'+_0x503b5d['query']['filter']+'%'};return _0x1c9d04;})});}if(_0x503b5d[_0x3648('0x44')][_0x3648('0x9f')]){var _0x4bf59c=_0x503b5d[_0x3648('0x44')]['$gte'][_0x3648('0xa0')](',');var _0x21626e={};_0x21626e[_0x4bf59c[0x0]]={'$gte':moment(_0x4bf59c[0x1])[_0x3648('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x22569c[_0x3648('0x4f')]=_[_0x3648('0x54')](_0x22569c[_0x3648('0x4f')],_0x21626e);}_0x22569c=_[_0x3648('0x54')]({},_0x22569c,_0x503b5d[_0x3648('0x55')]);return db['MailMessage'][_0x3648('0x2f')]({'where':_0x22569c[_0x3648('0x4f')]})[_0x3648('0x22')](function(_0x19f768){_0x413896['count']=_0x19f768;if(_0x503b5d[_0x3648('0x44')][_0x3648('0x56')]){_0x22569c[_0x3648('0x5f')]=[{'all':!![]}];}return db[_0x3648('0x9e')][_0x3648('0x57')](_0x22569c);})[_0x3648('0x22')](function(_0x1c3fa5){_0x413896[_0x3648('0x58')]=_0x1c3fa5;return _0x413896;});}})[_0x3648('0x22')](respondWithFilteredResult(_0xaa5c06,_0x22569c))['catch'](handleError(_0xaa5c06,null));};exports[_0x3648('0x3b')]=function(_0x3bd3e4,_0x140fc0,_0x118952){var _0x236ddd,_0x326614={},_0x390ea9;if(_0x3bd3e4['body']['to']){_0x390ea9=_0x3bd3e4[_0x3648('0x61')]['to'][_0x3648('0xa0')](',')[0x0];}return db[_0x3648('0x40')][_0x3648('0x60')]({'where':{'id':_0x3bd3e4[_0x3648('0x5a')]['id']},'include':[{'model':db[_0x3648('0xa2')],'as':_0x3648('0xa3'),'include':[{'model':db[_0x3648('0x8f')],'as':_0x3648('0xa4'),'where':{'email':_0x390ea9},'limit':0x1,'order':[['updatedAt',_0x3648('0xa5')]]}]},{'model':db[_0x3648('0x3d')],'as':_0x3648('0x3e'),'raw':!![]}]})['then'](handleEntityNotFound(_0x140fc0,null))['then'](function(_0x17d062){if(_0x17d062){_0x236ddd=_0x17d062;if(_0x17d062[_0x3648('0x3e')]){if(_['isNil'](_0x3bd3e4['body']['from'])){_0x3bd3e4[_0x3648('0x61')]['from']=util[_0x3648('0xa1')]('%s\x20<%s>',_0x17d062[_0x3648('0x3a')],_0x17d062['email']||_0x17d062[_0x3648('0x3e')]['user']);}if(_0x3bd3e4[_0x3648('0x61')]['attachments']&&_0x3bd3e4[_0x3648('0x61')][_0x3648('0xa6')][_0x3648('0x4b')]){for(var _0x38a471=0x0;_0x38a471<_0x3bd3e4[_0x3648('0x61')][_0x3648('0xa6')][_0x3648('0x4b')];_0x38a471+=0x1){_0x3bd3e4[_0x3648('0x61')][_0x3648('0xa6')][_0x38a471]={'filename':_0x3bd3e4[_0x3648('0x61')][_0x3648('0xa6')][_0x38a471][_0x3648('0x3a')],'path':path[_0x3648('0xa7')](config['root'],_0x3648('0xa8'),_0x3bd3e4[_0x3648('0x61')][_0x3648('0xa6')][_0x38a471][_0x3648('0xa9')])};}}var _0x254244={'tls':{'rejectUnauthorized':![]}};if(_[_0x3648('0x70')](_0x17d062[_0x3648('0x3e')]['service'])){if(_0x17d062[_0x3648('0x3e')]['authentication']){_0x254244['auth']={'user':_0x17d062[_0x3648('0x3e')]['user'],'pass':_0x17d062['Smtp'][_0x3648('0x77')]};}_0x254244[_0x3648('0x7a')]=_0x17d062[_0x3648('0x3e')][_0x3648('0x7a')];_0x254244[_0x3648('0x7b')]=_0x17d062[_0x3648('0x3e')]['port'];_0x254244[_0x3648('0xaa')]=_0x17d062[_0x3648('0x3e')][_0x3648('0xaa')];}else{_0x254244['service']=_0x17d062[_0x3648('0x3e')][_0x3648('0x7c')];_0x254244['auth']={'user':_0x17d062['Smtp'][_0x3648('0x75')],'pass':_0x17d062[_0x3648('0x3e')][_0x3648('0x77')]};}return respondWithRpcPromise(_0x3648('0xab'),_0x3648('0xac'),{'account':_0x254244,'message':_0x3bd3e4[_0x3648('0x61')]});}else{throw new Error(_0x3648('0xad'));}}})[_0x3648('0x22')](function(_0x4aceb2){if(_0x4aceb2){_0x326614=_0x4aceb2;if(_0x236ddd[_0x3648('0xa3')]){if(_0x236ddd['List'][_0x3648('0xa4')]['length']){return _0x236ddd[_0x3648('0xa3')][_0x3648('0xa4')][0x0];}else{return db['CmContact']['create'](_[_0x3648('0x19')](_0x3bd3e4['body'],{'firstName':_0x3bd3e4[_0x3648('0x61')]['to'],'email':_0x3bd3e4['body']['to'],'phone':_0x3bd3e4[_0x3648('0x61')]['to'],'ListId':_0x236ddd[_0x3648('0x6f')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0x3648('0x22')](function(_0x482ee7){if(_0x482ee7){var _0x3675c8={'UserId':_0x3bd3e4['user']['id'],'ContactId':_0x482ee7['id'],'MailAccountId':_0x236ddd['id'],'inReplyTo':_0x326614[_0x3648('0xae')],'to':_0x3bd3e4[_0x3648('0x61')]['from'],'cc':_0x3bd3e4[_0x3648('0x61')]['cc'],'subject':_0x3bd3e4[_0x3648('0x61')][_0x3648('0xaf')],'attach':_0x3bd3e4[_0x3648('0x61')][_0x3648('0xb0')],'firstMsgDirection':_0x3648('0xb1'),'lastMsgAt':moment()['format'](_0x3648('0xb2')),'lastMsgDirection':_0x3648('0xb1'),'lastMsgBody':_0x3bd3e4[_0x3648('0x61')][_0x3648('0x61')],'Messages':[_[_0x3648('0x54')](_0x3bd3e4[_0x3648('0x61')],{'messageId':_0x326614[_0x3648('0xae')],'sentAt':moment()[_0x3648('0xa1')](_0x3648('0xb2')),'read':!![],'MailAccountId':_0x236ddd['id'],'UserId':_0x3bd3e4['user']['id'],'ContactId':_0x482ee7['id']})]};if(_0x3bd3e4[_0x3648('0x61')]['Interaction']){_0x3675c8=_[_0x3648('0x54')](_0x3675c8,_0x3bd3e4[_0x3648('0x61')]['Interaction']);}return db[_0x3648('0x8c')][_0x3648('0x66')](_0x3675c8,{'include':[{'model':db[_0x3648('0x9e')],'as':_0x3648('0xb3')}]});}})[_0x3648('0x22')](respondWithResult(_0x140fc0,null))[_0x3648('0x2b')](handleError(_0x140fc0,null));};exports['verifySmtp']=function(_0x156c8a,_0x63be8a,_0x4296a8){return db[_0x3648('0x40')]['find']({'where':{'id':_0x156c8a['params']['id']},'include':[{'model':db[_0x3648('0x3d')],'as':_0x3648('0x3e'),'raw':!![]}]})[_0x3648('0x22')](handleEntityNotFound(_0x63be8a,null))[_0x3648('0x22')](function(_0x39cf0c){if(_0x39cf0c&&_0x39cf0c[_0x3648('0x3e')]){var _0x8936fe={'id':_0x39cf0c['id'],'tls':{'rejectUnauthorized':![]}};if(_0x39cf0c['Smtp'][_0x3648('0x7c')]){_0x8936fe[_0x3648('0x7c')]=_0x39cf0c['Smtp']['service'];}else{_0x8936fe['host']=_0x39cf0c[_0x3648('0x3e')][_0x3648('0x7a')];_0x8936fe['port']=_0x39cf0c[_0x3648('0x3e')][_0x3648('0x7b')];_0x8936fe[_0x3648('0xaa')]=_0x39cf0c[_0x3648('0x3e')]['secure'];}if(_0x39cf0c[_0x3648('0x3e')]['authentication']){_0x8936fe[_0x3648('0xb4')]={'user':_0x39cf0c[_0x3648('0x3e')]['user'],'pass':_0x39cf0c[_0x3648('0x3e')]['pass']};}return respondWithRpcPromise(_0x3648('0xb5'),_0x3648('0xb6'),{'account':_0x8936fe});}})[_0x3648('0x22')](respondWithResult(_0x63be8a,null))[_0x3648('0x2b')](handleError(_0x63be8a,null));};exports[_0x3648('0x36')]=function(_0x363662,_0xefcb97){return db['MailAccount'][_0x3648('0x60')]({'where':{'id':_0x363662['params']['id']}})[_0x3648('0x22')](handleEntityNotFound(_0xefcb97,null))[_0x3648('0x22')](function(_0x890925){if(_0x890925&&_0x890925['service']){throw new db[(_0x3648('0x1f'))][(_0x3648('0xb7'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x890925;})[_0x3648('0x22')](removeEntity(_0xefcb97,null))[_0x3648('0x2b')](handleError(_0xefcb97,null));};exports[_0x3648('0xb8')]=function(_0x13e389,_0x4095b5,_0x31c832){return db[_0x3648('0x40')][_0x3648('0x60')]({'where':{'id':_0x13e389[_0x3648('0x5a')]['id']}})[_0x3648('0x22')](handleEntityNotFound(_0x4095b5,null))[_0x3648('0x22')](function(_0x348548){if(_0x348548){return _0x348548[_0x3648('0xb8')](_0x13e389[_0x3648('0x61')][_0x3648('0x8d')],_[_0x3648('0xb9')](_0x13e389[_0x3648('0x61')],[_0x3648('0x8d'),'id'])||{})[_0x3648('0xba')](function(_0x5599e7){for(var _0x16a87d=0x0;_0x16a87d<_0x13e389[_0x3648('0x61')][_0x3648('0x8d')][_0x3648('0x4b')];_0x16a87d+=0x1){socket[_0x3648('0xbb')](_0x3648('0xbc'),{'UserId':_0x13e389[_0x3648('0x61')][_0x3648('0x8d')][_0x16a87d],'MailAccountId':_0x13e389[_0x3648('0x5a')]['id']});}return _0x5599e7;});}})[_0x3648('0x22')](respondWithResult(_0x4095b5,null))[_0x3648('0x2b')](handleError(_0x4095b5,null));};exports[_0x3648('0xbd')]=function(_0x418afb,_0x4b00f8,_0x5b1ad7){return db[_0x3648('0x40')][_0x3648('0x60')]({'where':{'id':_0x418afb[_0x3648('0x5a')]['id']}})[_0x3648('0x22')](handleEntityNotFound(_0x4b00f8,null))[_0x3648('0x22')](function(_0x2baa25){if(_0x2baa25){return _0x2baa25[_0x3648('0xbd')](_0x418afb[_0x3648('0x44')]['ids'])[_0x3648('0x22')](function(){if(_['isArray'](_0x418afb[_0x3648('0x44')][_0x3648('0x8d')])){for(var _0x5cb496=0x0;_0x5cb496<_0x418afb[_0x3648('0x44')]['ids'][_0x3648('0x4b')];_0x5cb496+=0x1){socket['emit'](_0x3648('0xbe'),{'UserId':Number(_0x418afb['query'][_0x3648('0x8d')][_0x5cb496]),'MailAccountId':Number(_0x418afb[_0x3648('0x5a')]['id'])});}}else{socket[_0x3648('0xbb')](_0x3648('0xbe'),{'UserId':Number(_0x418afb[_0x3648('0x44')][_0x3648('0x8d')]),'MailAccountId':Number(_0x418afb[_0x3648('0x5a')]['id'])});}});}})[_0x3648('0x22')](respondWithStatusCode(_0x4b00f8,null))['catch'](handleError(_0x4b00f8,null));};exports[_0x3648('0xbf')]=function(_0x440624,_0x28ea46,_0x5c98c3){var _0x533d0a={};var _0x1e526e={};var _0x1e18a4;var _0x404fcd;return db[_0x3648('0x40')][_0x3648('0x68')]({'where':{'id':_0x440624[_0x3648('0x5a')]['id']}})[_0x3648('0x22')](handleEntityNotFound(_0x28ea46,null))[_0x3648('0x22')](function(_0xaf7272){if(_0xaf7272){_0x1e18a4=_0xaf7272;_0x1e526e[_0x3648('0x48')]=_['keys'](db['User'][_0x3648('0x41')]);_0x1e526e['query']=_[_0x3648('0x45')](_0x440624[_0x3648('0x44')]);_0x1e526e[_0x3648('0x46')]=_[_0x3648('0x47')](_0x1e526e[_0x3648('0x48')],_0x1e526e[_0x3648('0x44')]);_0x533d0a[_0x3648('0x49')]=_[_0x3648('0x47')](_0x1e526e[_0x3648('0x48')],qs['fields'](_0x440624[_0x3648('0x44')][_0x3648('0x4a')]));_0x533d0a[_0x3648('0x49')]=_0x533d0a[_0x3648('0x49')][_0x3648('0x4b')]?_0x533d0a[_0x3648('0x49')]:_0x1e526e[_0x3648('0x48')];_0x533d0a[_0x3648('0x69')]=qs[_0x3648('0x4e')](_0x440624[_0x3648('0x44')][_0x3648('0x4e')]);_0x533d0a['where']=qs[_0x3648('0x46')](_[_0x3648('0x50')](_0x440624[_0x3648('0x44')],_0x1e526e['filters']));if(_0x440624[_0x3648('0x44')][_0x3648('0x51')]){_0x533d0a['where']=_[_0x3648('0x54')](_0x533d0a['where'],{'$or':_[_0x3648('0x3f')](_0x533d0a[_0x3648('0x49')],function(_0x2e5862){var _0x7a90b8={};_0x7a90b8[_0x2e5862]={'$like':'%'+_0x440624[_0x3648('0x44')]['filter']+'%'};return _0x7a90b8;})});}_0x533d0a=_[_0x3648('0x54')]({},_0x533d0a,_0x440624['options']);return _0x1e18a4['getAgents'](_0x533d0a);}})[_0x3648('0x22')](function(_0x39c98b){if(_0x39c98b){_0x404fcd=_0x39c98b[_0x3648('0x4b')];if(!_0x440624[_0x3648('0x44')][_0x3648('0x4c')](_0x3648('0x4d'))){_0x533d0a['limit']=qs[_0x3648('0x31')](_0x440624['query']['limit']);_0x533d0a['offset']=qs['offset'](_0x440624[_0x3648('0x44')][_0x3648('0x30')]);}return _0x1e18a4[_0x3648('0xbf')](_0x533d0a);}})[_0x3648('0x22')](function(_0x138629){if(_0x138629){return _0x138629?{'count':_0x404fcd,'rows':_0x138629}:null;}})[_0x3648('0x22')](respondWithResult(_0x28ea46,null))[_0x3648('0x2b')](handleError(_0x28ea46,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index d1d2eef..070cf28 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 _0x4cfd=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x550b08,_0x46a5e8){var _0x3d807a=function(_0x29f36d){while(--_0x29f36d){_0x550b08['push'](_0x550b08['shift']());}};_0x3d807a(++_0x46a5e8);}(_0x4cfd,0x162));var _0xd4cf=function(_0x3203a1,_0x46c498){_0x3203a1=_0x3203a1-0x0;var _0x24215e=_0x4cfd[_0x3203a1];return _0x24215e;};'use strict';var EventEmitter=require(_0xd4cf('0x0'));var MailAccount=require(_0xd4cf('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xd4cf('0x2')](0x0);var events={'afterCreate':_0xd4cf('0x3'),'afterUpdate':_0xd4cf('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3d27e4){return function(_0x5e40c1,_0x2ef7ef,_0xf277f7){MailAccountEvents[_0xd4cf('0x5')](_0x3d27e4+':'+_0x5e40c1['id'],_0x5e40c1);MailAccountEvents[_0xd4cf('0x5')](_0x3d27e4,_0x5e40c1);_0xf277f7(null);};}for(var e in events){if(events[_0xd4cf('0x6')](e)){var event=events[e];MailAccount[_0xd4cf('0x7')](e,emitEvent(event));}}module[_0xd4cf('0x8')]=MailAccountEvents; \ No newline at end of file +var _0x0e0f=['hook','exports','MailAccount','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x30b0d8,_0x57470c){var _0x459c09=function(_0x5e51b6){while(--_0x5e51b6){_0x30b0d8['push'](_0x30b0d8['shift']());}};_0x459c09(++_0x57470c);}(_0x0e0f,0x19f));var _0xf0e0=function(_0x166330,_0x393f92){_0x166330=_0x166330-0x0;var _0x50571f=_0x0e0f[_0x166330];return _0x50571f;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db'][_0xf0e0('0x0')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xf0e0('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf0e0('0x2')};function emitEvent(_0x15a7e5){return function(_0x22a2b3,_0x56eea0,_0x438df2){MailAccountEvents[_0xf0e0('0x3')](_0x15a7e5+':'+_0x22a2b3['id'],_0x22a2b3);MailAccountEvents[_0xf0e0('0x3')](_0x15a7e5,_0x22a2b3);_0x438df2(null);};}for(var e in events){if(events[_0xf0e0('0x4')](e)){var event=events[e];MailAccount[_0xf0e0('0x5')](e,emitEvent(event));}}module[_0xf0e0('0x6')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 5cd6b3e..e520242 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 _0x8709=['define','MailAccount','mail_accounts','lodash','util','../../config/logger','api','bluebird','path','rimraf','./mailAccount.attributes','exports'];(function(_0xbb5003,_0x16db8e){var _0x55ae29=function(_0xbe98bb){while(--_0xbe98bb){_0xbb5003['push'](_0xbb5003['shift']());}};_0x55ae29(++_0x16db8e);}(_0x8709,0x147));var _0x9870=function(_0x1e99be,_0xe3cf65){_0x1e99be=_0x1e99be-0x0;var _0x11f2b6=_0x8709[_0x1e99be];return _0x11f2b6;};'use strict';var _=require(_0x9870('0x0'));var util=require(_0x9870('0x1'));var logger=require(_0x9870('0x2'))(_0x9870('0x3'));var moment=require('moment');var BPromise=require(_0x9870('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9870('0x5'));var rimraf=require(_0x9870('0x6'));var config=require('../../config/environment');var attributes=require(_0x9870('0x7'));module[_0x9870('0x8')]=function(_0x34ae29,_0x42d1c2){return _0x34ae29[_0x9870('0x9')](_0x9870('0xa'),attributes,{'tableName':_0x9870('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11af=['./mailAccount.attributes','exports','define','../../config/logger','moment','path','rimraf'];(function(_0x1a0ef3,_0x535bbf){var _0x2b86da=function(_0x5d30f9){while(--_0x5d30f9){_0x1a0ef3['push'](_0x1a0ef3['shift']());}};_0x2b86da(++_0x535bbf);}(_0x11af,0xf8));var _0xf11a=function(_0x48caf5,_0x3c485c){_0x48caf5=_0x48caf5-0x0;var _0x49101f=_0x11af[_0x48caf5];return _0x49101f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf11a('0x0'))('api');var moment=require(_0xf11a('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf11a('0x2'));var rimraf=require(_0xf11a('0x3'));var config=require('../../config/environment');var attributes=require(_0xf11a('0x4'));module[_0xf11a('0x5')]=function(_0x4f3329,_0x7066d7){return _0x4f3329[_0xf11a('0x6')]('MailAccount',attributes,{'tableName':'mail_accounts','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 22b0309..dc0f66c 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 _0xa75b=['request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailAccount','MailAccount','options','where','attributes','limit','include','map','model','find','raw','ShowMailAccount','stringify','NotifyMailAccount','body','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','MailApplication','Applications','Smtp','account','omit','applications','list','orderBy','asc','length','autoclose','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailMessage','Messages','Contact\x20not\x20found','spread','update','interaction','get','created','attachments','originTo','bcc','Attachment','unshift','agent','name','Start','startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','MailAccount,\x20%s,\x20%s'];(function(_0x2ebb39,_0x5b323a){var _0x1c00e7=function(_0x61225a){while(--_0x61225a){_0x2ebb39['push'](_0x2ebb39['shift']());}};_0x1c00e7(++_0x5b323a);}(_0xa75b,0x170));var _0xba75=function(_0x389ffc,_0x48d273){_0x389ffc=_0x389ffc-0x0;var _0x561ce6=_0xa75b[_0x389ffc];return _0x561ce6;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xba75('0x1'));var rs=require(_0xba75('0x2'));var fs=require('fs');var Redis=require(_0xba75('0x3'));var db=require(_0xba75('0x4'))['db'];var utils=require(_0xba75('0x5'));var logger=require(_0xba75('0x6'))(_0xba75('0x7'));var config=require(_0xba75('0x8'));var jayson=require(_0xba75('0x9'));var client=jayson[_0xba75('0xa')][_0xba75('0xb')]({'port':0x232c});config[_0xba75('0xc')]=_[_0xba75('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xba75('0xe'))(new Redis(config['redis']));require('./mailAccount.socket')[_0xba75('0xf')](socket);function respondWithRpcPromise(_0x4f4d0a,_0x2e8905,_0x470836){return new BPromise(function(_0x1371f4,_0x141931){return client[_0xba75('0x10')](_0x4f4d0a,_0x470836)[_0xba75('0x11')](function(_0xb5afb8){logger[_0xba75('0x12')](_0xba75('0x13'),_0x2e8905,_0xba75('0x14'));logger[_0xba75('0x15')](_0xba75('0x16'),_0x2e8905,'request\x20sent',JSON['stringify'](_0xb5afb8));if(_0xb5afb8[_0xba75('0x17')]){if(_0xb5afb8['error'][_0xba75('0x18')]===0x1f4){logger[_0xba75('0x17')](_0xba75('0x13'),_0x2e8905,_0xb5afb8[_0xba75('0x17')]['message']);return _0x141931(_0xb5afb8[_0xba75('0x17')][_0xba75('0x19')]);}logger[_0xba75('0x17')](_0xba75('0x13'),_0x2e8905,_0xb5afb8[_0xba75('0x17')]['message']);return _0x1371f4(_0xb5afb8[_0xba75('0x17')][_0xba75('0x19')]);}else{logger[_0xba75('0x12')]('MailAccount,\x20%s,\x20%s',_0x2e8905,_0xba75('0x14'));_0x1371f4(_0xb5afb8[_0xba75('0x1a')][_0xba75('0x19')]);}})[_0xba75('0x1b')](function(_0x30d1ab){logger[_0xba75('0x17')]('MailAccount,\x20%s,\x20%s',_0x2e8905,_0x30d1ab);_0x141931(_0x30d1ab);});});}exports[_0xba75('0x1c')]=function(_0x3fb8f0){var _0x54c510=this;return new Promise(function(_0x5217aa,_0x35ffd2){return db[_0xba75('0x1d')]['findAll']({'raw':_0x3fb8f0['options']?_0x3fb8f0[_0xba75('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3fb8f0[_0xba75('0x1e')]?_0x3fb8f0[_0xba75('0x1e')][_0xba75('0x1f')]||null:null,'attributes':_0x3fb8f0['options']?_0x3fb8f0[_0xba75('0x1e')][_0xba75('0x20')]||null:null,'limit':_0x3fb8f0[_0xba75('0x1e')]?_0x3fb8f0[_0xba75('0x1e')][_0xba75('0x21')]||null:null,'include':_0x3fb8f0[_0xba75('0x1e')]?_0x3fb8f0['options'][_0xba75('0x22')]?_[_0xba75('0x23')](_0x3fb8f0[_0xba75('0x1e')][_0xba75('0x22')],function(_0x1caa6){return{'model':db[_0x1caa6[_0xba75('0x24')]],'as':_0x1caa6['as'],'attributes':_0x1caa6[_0xba75('0x20')],'include':_0x1caa6[_0xba75('0x22')]?_[_0xba75('0x23')](_0x1caa6[_0xba75('0x22')],function(_0x47ddff){return{'model':db[_0x47ddff['model']],'as':_0x47ddff['as'],'attributes':_0x47ddff['attributes'],'include':_0x47ddff[_0xba75('0x22')]?_['map'](_0x47ddff[_0xba75('0x22')],function(_0x58ea2d){return{'model':db[_0x58ea2d[_0xba75('0x24')]],'as':_0x58ea2d['as'],'attributes':_0x58ea2d[_0xba75('0x20')]};}):[]};}):[]};}):[]:[]})[_0xba75('0x11')](function(_0x4edc2e){logger[_0xba75('0x12')](_0xba75('0x1c'),_0x3fb8f0);logger[_0xba75('0x15')](_0xba75('0x1c'),_0x3fb8f0,JSON['stringify'](_0x4edc2e));_0x5217aa(_0x4edc2e);})['catch'](function(_0x200715){logger['error'](_0xba75('0x1c'),_0x200715[_0xba75('0x19')],_0x3fb8f0);_0x35ffd2(_0x54c510[_0xba75('0x17')](0x1f4,_0x200715[_0xba75('0x19')]));});});};exports['ShowMailAccount']=function(_0x238271){var _0x222d98=this;return new Promise(function(_0x5c1a2e,_0x33a732){return db[_0xba75('0x1d')][_0xba75('0x25')]({'raw':_0x238271[_0xba75('0x1e')]?_0x238271['options'][_0xba75('0x26')]===undefined?!![]:![]:!![],'where':_0x238271[_0xba75('0x1e')]?_0x238271['options'][_0xba75('0x1f')]||null:null,'attributes':_0x238271[_0xba75('0x1e')]?_0x238271[_0xba75('0x1e')]['attributes']||null:null,'include':_0x238271[_0xba75('0x1e')]?_0x238271[_0xba75('0x1e')][_0xba75('0x22')]?_[_0xba75('0x23')](_0x238271[_0xba75('0x1e')][_0xba75('0x22')],function(_0x3d8453){return{'model':db[_0x3d8453['model']],'as':_0x3d8453['as'],'attributes':_0x3d8453['attributes'],'include':_0x3d8453[_0xba75('0x22')]?_[_0xba75('0x23')](_0x3d8453[_0xba75('0x22')],function(_0x5c6f1a){return{'model':db[_0x5c6f1a[_0xba75('0x24')]],'as':_0x5c6f1a['as'],'attributes':_0x5c6f1a[_0xba75('0x20')],'include':_0x5c6f1a['include']?_['map'](_0x5c6f1a[_0xba75('0x22')],function(_0x4d2933){return{'model':db[_0x4d2933[_0xba75('0x24')]],'as':_0x4d2933['as'],'attributes':_0x4d2933[_0xba75('0x20')]};}):[]};}):[]};}):[]:[]})[_0xba75('0x11')](function(_0x541989){logger['info'](_0xba75('0x27'),_0x238271);logger[_0xba75('0x15')](_0xba75('0x27'),_0x238271,JSON[_0xba75('0x28')](_0x541989));_0x5c1a2e(_0x541989);})[_0xba75('0x1b')](function(_0x22694f){logger[_0xba75('0x17')]('ShowMailAccount',_0x22694f[_0xba75('0x19')],_0x238271);_0x33a732(_0x222d98[_0xba75('0x17')](0x1f4,_0x22694f['message']));});});};exports[_0xba75('0x29')]=function(_0x3740bd){var _0x2d56c0=this;return new Promise(function(_0x45d8cd,_0x360bf7){var _0x32a61d={'body':_0x3740bd[_0xba75('0x2a')],'channel':'mail'};var _0xf6edc7=_['difference'](_[_0xba75('0x2b')](db['CmContact'][_0xba75('0x2c')]),[_0xba75('0x2d'),_0xba75('0x2e'),_0xba75('0x2f'),_0xba75('0x30')]);var _0x30338c=![];if(_0x3740bd[_0xba75('0x2a')]['id']){delete _0x3740bd[_0xba75('0x2a')]['id'];}if(_[_0xba75('0x31')](_0x3740bd['body'][_0xba75('0x32')])){return _0x360bf7(_0x2d56c0[_0xba75('0x17')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xba75('0x31')](_0x3740bd[_0xba75('0x2a')][_0xba75('0x2a')])||_0x3740bd['body']['body']===''){return _0x360bf7(_0x2d56c0['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xba75('0x31')](_0x3740bd['body'][_0xba75('0x33')])){return _0x360bf7(_0x2d56c0[_0xba75('0x17')](0x1f4,_0xba75('0x34')+_0xf6edc7));}if(!_[_0xba75('0x35')](_0xf6edc7,_0x3740bd[_0xba75('0x2a')]['mapKey'])){return _0x360bf7(_0x2d56c0['error'](0x1f4,_0xba75('0x36')+_0xf6edc7));}var _0x4c7d83={};_0x4c7d83[_0x3740bd[_0xba75('0x2a')]['mapKey']]=_0x3740bd[_0xba75('0x2a')][_0xba75('0x32')];return db[_0xba75('0x1d')][_0xba75('0x25')]({'where':{'id':_0x3740bd['account']['id']},'include':[{'model':db[_0xba75('0x37')],'as':_0xba75('0x38'),'include':[{'model':db[_0xba75('0x39')],'as':_0xba75('0x3a'),'where':_0x4c7d83,'limit':0x1,'order':[[_0xba75('0x2e'),_0xba75('0x3b')]]}]},{'model':db[_0xba75('0x3c')],'as':_0xba75('0x3d')},{'model':db['MailServerOut'],'as':_0xba75('0x3e')}]})[_0xba75('0x11')](function(_0x7c297b){if(_0x7c297b&&_0x7c297b[_0xba75('0x38')]){var _0xbd5c97=_0x7c297b['get']({'plain':!![]});_0x32a61d[_0xba75('0x3f')]=_[_0xba75('0x40')](_0xbd5c97,[_0xba75('0x3d'),_0xba75('0x38')]);_0x32a61d[_0xba75('0x41')]=_0xbd5c97[_0xba75('0x3d')];_0x32a61d[_0xba75('0x42')]=_0xbd5c97['List'];_0x32a61d[_0xba75('0x41')]=_[_0xba75('0x43')](_0x32a61d[_0xba75('0x41')],['priority'],[_0xba75('0x44')]);if(_0x32a61d[_0xba75('0x3f')]&&_0x32a61d['account']['autoclose']){_0x32a61d[_0xba75('0x41')]['push']({'id':0x0,'priority':_0x32a61d['applications'][_0xba75('0x45')]+0x1,'app':'close','appdata':_0xba75('0x46'),'interval':_0xba75('0x47')});}if(_0x32a61d[_0xba75('0x3f')][_0xba75('0x3d')]){delete _0x32a61d[_0xba75('0x3f')]['Applications'];}if(_0x32a61d[_0xba75('0x3f')][_0xba75('0x38')]){delete _0x32a61d['account'][_0xba75('0x38')];}if(_0xbd5c97[_0xba75('0x38')][_0xba75('0x3a')][_0xba75('0x45')]){return _0xbd5c97[_0xba75('0x38')]['Contacts'][0x0];}var _0x43f4b7=_[_0xba75('0xd')](_0x3740bd['body'],{'firstName':_0x3740bd[_0xba75('0x2a')][_0xba75('0x32')],'ListId':_0xbd5c97[_0xba75('0x30')]});_0x43f4b7[_0x3740bd[_0xba75('0x2a')][_0xba75('0x33')]]=_0x3740bd[_0xba75('0x2a')]['from'];return db[_0xba75('0x39')][_0xba75('0x48')](_0x43f4b7);}else{throw new Error(_0xba75('0x49'));}})[_0xba75('0x11')](function(_0x38129c){_0x32a61d[_0xba75('0x4a')]=_0x38129c;if(_0x38129c){if(!_0x3740bd['body']['message']['messageId']){_0x3740bd['body'][_0xba75('0x19')][_0xba75('0x4b')]=rs[_0xba75('0x4c')]()+'\x20'+_0x3740bd[_0xba75('0x2a')][_0xba75('0x19')][_0xba75('0x32')];}var _0x3935bd={'ContactId':_0x38129c['id'],'MailAccountId':_0x3740bd['account']['id'],'inReplyTo':_0x3740bd[_0xba75('0x2a')][_0xba75('0x19')][_0xba75('0x4b')],'to':_0x3740bd[_0xba75('0x2a')]['message'][_0xba75('0x32')],'cc':_0x3740bd[_0xba75('0x2a')]['message']['cc'],'subject':_0x3740bd[_0xba75('0x2a')]['message'][_0xba75('0x4d')],'attach':_0x3740bd[_0xba75('0x2a')]['message'][_0xba75('0x4e')],'lastMsgAt':moment()[_0xba75('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x3740bd['body'][_0xba75('0x2a')]};return db['MailInteraction'][_0xba75('0x25')]({'where':{'closed':![],'MailAccountId':_0x3740bd['account']['id']},'include':[{'model':db[_0xba75('0x50')],'as':_0xba75('0x51'),'attributes':[_0xba75('0x4b')],'where':{'messageId':_0x3740bd[_0xba75('0x2a')][_0xba75('0x19')]['inReplyTo']}}]})[_0xba75('0x11')](function(_0x32e2ae){if(_0x32e2ae){return[_0x32e2ae,![]];}return db['MailInteraction'][_0xba75('0x48')](_0x3935bd)[_0xba75('0x11')](function(_0x16f8ff){return[_0x16f8ff,!![]];});});}else{throw new Error(_0xba75('0x52'));}})[_0xba75('0x53')](function(_0x1d3331,_0x3b2dbb){if(_0x1d3331){_0x30338c=_0x3b2dbb;if(!_0x3b2dbb){return _0x1d3331[_0xba75('0x54')]({'inReplyTo':_0x3740bd[_0xba75('0x2a')][_0xba75('0x19')][_0xba75('0x4b')],'to':_0x3740bd[_0xba75('0x2a')]['message']['from'],'cc':_0x3740bd[_0xba75('0x2a')][_0xba75('0x19')]['cc'],'subject':_0x3740bd[_0xba75('0x2a')][_0xba75('0x19')][_0xba75('0x4d')],'attach':_0x1d3331[_0xba75('0x4e')]?_0x1d3331[_0xba75('0x4e')]:_0x3740bd[_0xba75('0x2a')][_0xba75('0x19')][_0xba75('0x4e')],'substatus':null,'substatusAt':moment()[_0xba75('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0xba75('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x3740bd[_0xba75('0x2a')][_0xba75('0x2a')]});}else{return _0x1d3331;}}})[_0xba75('0x11')](function(_0x43b73b){_0x32a61d[_0xba75('0x55')]=_0x43b73b[_0xba75('0x56')]({'plain':!![]});_0x32a61d['interaction'][_0xba75('0x57')]=_0x30338c;return db['MailMessage'][_0xba75('0x48')]({'body':_0x3740bd[_0xba75('0x2a')]['body'],'MailAccountId':_0x3740bd['account']['id'],'MailInteractionId':_0x43b73b['id'],'direction':'in','ContactId':_0x32a61d[_0xba75('0x4a')]['id'],'messageId':_0x3740bd[_0xba75('0x2a')][_0xba75('0x19')][_0xba75('0x4b')],'from':_0x3740bd[_0xba75('0x2a')][_0xba75('0x19')]['from'],'to':_0x3740bd[_0xba75('0x2a')][_0xba75('0x19')]['to'],'cc':_0x3740bd['body'][_0xba75('0x19')]['cc'],'subject':_0x3740bd[_0xba75('0x2a')][_0xba75('0x19')][_0xba75('0x4d')],'attach':_0x3740bd[_0xba75('0x2a')]['message'][_0xba75('0x4e')],'Attachments':_0x3740bd['body'][_0xba75('0x19')][_0xba75('0x58')],'originTo':_0x3740bd[_0xba75('0x2a')][_0xba75('0x19')][_0xba75('0x59')],'originCc':_0x3740bd[_0xba75('0x2a')]['message']['originCc'],'bcc':_0x3740bd[_0xba75('0x2a')]['message'][_0xba75('0x5a')]},{'include':[{'model':db[_0xba75('0x5b')],'as':'Attachments'}]});})[_0xba75('0x11')](function(_0x178cb3){_0x32a61d[_0xba75('0x19')]=_0x178cb3;if(_0x32a61d['interaction']['UserId']){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x32a61d[_0xba75('0x55')]['UserId']}})[_0xba75('0x11')](function(_0x159c0a){if(_0x159c0a){_0x32a61d[_0xba75('0x41')][_0xba75('0x5c')]({'id':0x0,'priority':0x0,'app':_0xba75('0x5d'),'appdata':_0x159c0a[_0xba75('0x5e')]+','+(_0x32a61d[_0xba75('0x3f')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xba75('0x5f'),_0xba75('0x60'),_0x32a61d);});}return respondWithRpcPromise('Start',_0xba75('0x60'),_0x32a61d);})['then'](function(_0x43506d){_0x45d8cd(_0x43506d);})[_0xba75('0x1b')](function(_0x5ade59){_0x360bf7(_0x2d56c0[_0xba75('0x17')](0x1f4,_0x5ade59['message']));});});}; \ No newline at end of file +var _0xd66c=['mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','MailServerOut','Smtp','Applications','list','orderBy','priority','asc','autoclose','applications','push','length','List\x20not\x20found','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','create','Contact\x20not\x20found','spread','update','subject','interaction','get','created','attachments','originTo','originCc','bcc','Attachment','UserId','User','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','map','model','then','ShowMailAccount','find','stringify','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey'];(function(_0x2f5983,_0x56ede5){var _0x51d985=function(_0x267083){while(--_0x267083){_0x2f5983['push'](_0x2f5983['shift']());}};_0x51d985(++_0x56ede5);}(_0xd66c,0x106));var _0xcd66=function(_0x3ae3d9,_0x8488e4){_0x3ae3d9=_0x3ae3d9-0x0;var _0x3d50bb=_0xd66c[_0x3ae3d9];return _0x3d50bb;};'use strict';var _=require(_0xcd66('0x0'));var util=require('util');var moment=require(_0xcd66('0x1'));var BPromise=require(_0xcd66('0x2'));var rs=require(_0xcd66('0x3'));var fs=require('fs');var Redis=require(_0xcd66('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcd66('0x5'));var logger=require(_0xcd66('0x6'))(_0xcd66('0x7'));var config=require(_0xcd66('0x8'));var jayson=require(_0xcd66('0x9'));var client=jayson[_0xcd66('0xa')][_0xcd66('0xb')]({'port':0x232c});config[_0xcd66('0xc')]=_['defaults'](config[_0xcd66('0xc')],{'host':_0xcd66('0xd'),'port':0x18eb});var socket=require(_0xcd66('0xe'))(new Redis(config[_0xcd66('0xc')]));require(_0xcd66('0xf'))[_0xcd66('0x10')](socket);function respondWithRpcPromise(_0x4b9661,_0x4a38c5,_0x1f3683){return new BPromise(function(_0x567edc,_0x1d79cc){return client[_0xcd66('0x11')](_0x4b9661,_0x1f3683)['then'](function(_0x19c92f){logger['info'](_0xcd66('0x12'),_0x4a38c5,_0xcd66('0x13'));logger[_0xcd66('0x14')](_0xcd66('0x15'),_0x4a38c5,_0xcd66('0x13'),JSON['stringify'](_0x19c92f));if(_0x19c92f['error']){if(_0x19c92f[_0xcd66('0x16')]['code']===0x1f4){logger[_0xcd66('0x16')]('MailAccount,\x20%s,\x20%s',_0x4a38c5,_0x19c92f['error'][_0xcd66('0x17')]);return _0x1d79cc(_0x19c92f[_0xcd66('0x16')][_0xcd66('0x17')]);}logger[_0xcd66('0x16')](_0xcd66('0x12'),_0x4a38c5,_0x19c92f[_0xcd66('0x16')]['message']);return _0x567edc(_0x19c92f[_0xcd66('0x16')]['message']);}else{logger[_0xcd66('0x18')](_0xcd66('0x12'),_0x4a38c5,_0xcd66('0x13'));_0x567edc(_0x19c92f[_0xcd66('0x19')][_0xcd66('0x17')]);}})[_0xcd66('0x1a')](function(_0x1d25d3){logger[_0xcd66('0x16')](_0xcd66('0x12'),_0x4a38c5,_0x1d25d3);_0x1d79cc(_0x1d25d3);});});}exports[_0xcd66('0x1b')]=function(_0x214e56){var _0x1a1ef0=this;return new Promise(function(_0x14b6e9,_0x2d3819){return db[_0xcd66('0x1c')]['findAll']({'raw':_0x214e56[_0xcd66('0x1d')]?_0x214e56[_0xcd66('0x1d')][_0xcd66('0x1e')]===undefined?!![]:![]:!![],'where':_0x214e56[_0xcd66('0x1d')]?_0x214e56[_0xcd66('0x1d')][_0xcd66('0x1f')]||null:null,'attributes':_0x214e56[_0xcd66('0x1d')]?_0x214e56[_0xcd66('0x1d')][_0xcd66('0x20')]||null:null,'limit':_0x214e56[_0xcd66('0x1d')]?_0x214e56['options'][_0xcd66('0x21')]||null:null,'include':_0x214e56[_0xcd66('0x1d')]?_0x214e56['options'][_0xcd66('0x22')]?_[_0xcd66('0x23')](_0x214e56[_0xcd66('0x1d')]['include'],function(_0x141a64){return{'model':db[_0x141a64[_0xcd66('0x24')]],'as':_0x141a64['as'],'attributes':_0x141a64[_0xcd66('0x20')],'include':_0x141a64['include']?_[_0xcd66('0x23')](_0x141a64[_0xcd66('0x22')],function(_0x2d0732){return{'model':db[_0x2d0732[_0xcd66('0x24')]],'as':_0x2d0732['as'],'attributes':_0x2d0732[_0xcd66('0x20')],'include':_0x2d0732[_0xcd66('0x22')]?_[_0xcd66('0x23')](_0x2d0732[_0xcd66('0x22')],function(_0x51201f){return{'model':db[_0x51201f[_0xcd66('0x24')]],'as':_0x51201f['as'],'attributes':_0x51201f[_0xcd66('0x20')]};}):[]};}):[]};}):[]:[]})[_0xcd66('0x25')](function(_0x851a5c){logger[_0xcd66('0x18')](_0xcd66('0x1b'),_0x214e56);logger[_0xcd66('0x14')](_0xcd66('0x1b'),_0x214e56,JSON['stringify'](_0x851a5c));_0x14b6e9(_0x851a5c);})[_0xcd66('0x1a')](function(_0x13a23e){logger[_0xcd66('0x16')](_0xcd66('0x1b'),_0x13a23e['message'],_0x214e56);_0x2d3819(_0x1a1ef0[_0xcd66('0x16')](0x1f4,_0x13a23e[_0xcd66('0x17')]));});});};exports[_0xcd66('0x26')]=function(_0x38172f){var _0x1484a2=this;return new Promise(function(_0x58b93f,_0x926286){return db[_0xcd66('0x1c')][_0xcd66('0x27')]({'raw':_0x38172f[_0xcd66('0x1d')]?_0x38172f['options']['raw']===undefined?!![]:![]:!![],'where':_0x38172f[_0xcd66('0x1d')]?_0x38172f['options'][_0xcd66('0x1f')]||null:null,'attributes':_0x38172f[_0xcd66('0x1d')]?_0x38172f[_0xcd66('0x1d')][_0xcd66('0x20')]||null:null,'include':_0x38172f[_0xcd66('0x1d')]?_0x38172f[_0xcd66('0x1d')][_0xcd66('0x22')]?_['map'](_0x38172f[_0xcd66('0x1d')][_0xcd66('0x22')],function(_0x37f17a){return{'model':db[_0x37f17a[_0xcd66('0x24')]],'as':_0x37f17a['as'],'attributes':_0x37f17a['attributes'],'include':_0x37f17a[_0xcd66('0x22')]?_[_0xcd66('0x23')](_0x37f17a[_0xcd66('0x22')],function(_0x20a98c){return{'model':db[_0x20a98c[_0xcd66('0x24')]],'as':_0x20a98c['as'],'attributes':_0x20a98c[_0xcd66('0x20')],'include':_0x20a98c[_0xcd66('0x22')]?_[_0xcd66('0x23')](_0x20a98c[_0xcd66('0x22')],function(_0x1f3821){return{'model':db[_0x1f3821[_0xcd66('0x24')]],'as':_0x1f3821['as'],'attributes':_0x1f3821[_0xcd66('0x20')]};}):[]};}):[]};}):[]:[]})[_0xcd66('0x25')](function(_0x1f1293){logger[_0xcd66('0x18')](_0xcd66('0x26'),_0x38172f);logger[_0xcd66('0x14')](_0xcd66('0x26'),_0x38172f,JSON[_0xcd66('0x28')](_0x1f1293));_0x58b93f(_0x1f1293);})['catch'](function(_0x50ae16){logger[_0xcd66('0x16')]('ShowMailAccount',_0x50ae16[_0xcd66('0x17')],_0x38172f);_0x926286(_0x1484a2[_0xcd66('0x16')](0x1f4,_0x50ae16[_0xcd66('0x17')]));});});};exports[_0xcd66('0x29')]=function(_0x2bfb26){var _0x4902d4=this;return new Promise(function(_0x1c4bd7,_0x3be90b){var _0x51bfec={'body':_0x2bfb26[_0xcd66('0x2a')],'channel':_0xcd66('0x2b')};var _0x47b8a1=_[_0xcd66('0x2c')](_[_0xcd66('0x2d')](db[_0xcd66('0x2e')][_0xcd66('0x2f')]),[_0xcd66('0x30'),_0xcd66('0x31'),_0xcd66('0x32'),'ListId']);var _0x140568=![];if(_0x2bfb26[_0xcd66('0x2a')]['id']){delete _0x2bfb26[_0xcd66('0x2a')]['id'];}if(_[_0xcd66('0x33')](_0x2bfb26[_0xcd66('0x2a')][_0xcd66('0x34')])){return _0x3be90b(_0x4902d4['error'](0x1f4,_0xcd66('0x35')));}if(_[_0xcd66('0x33')](_0x2bfb26[_0xcd66('0x2a')][_0xcd66('0x2a')])||_0x2bfb26['body'][_0xcd66('0x2a')]===''){return _0x3be90b(_0x4902d4[_0xcd66('0x16')](0x1f4,_0xcd66('0x36')));}if(_[_0xcd66('0x33')](_0x2bfb26[_0xcd66('0x2a')][_0xcd66('0x37')])){return _0x3be90b(_0x4902d4[_0xcd66('0x16')](0x1f4,_0xcd66('0x38')+_0x47b8a1));}if(!_[_0xcd66('0x39')](_0x47b8a1,_0x2bfb26[_0xcd66('0x2a')][_0xcd66('0x37')])){return _0x3be90b(_0x4902d4[_0xcd66('0x16')](0x1f4,_0xcd66('0x3a')+_0x47b8a1));}var _0x2ddd20={};_0x2ddd20[_0x2bfb26[_0xcd66('0x2a')][_0xcd66('0x37')]]=_0x2bfb26[_0xcd66('0x2a')]['from'];return db[_0xcd66('0x1c')][_0xcd66('0x27')]({'where':{'id':_0x2bfb26[_0xcd66('0x3b')]['id']},'include':[{'model':db[_0xcd66('0x3c')],'as':_0xcd66('0x3d'),'include':[{'model':db['CmContact'],'as':_0xcd66('0x3e'),'where':_0x2ddd20,'limit':0x1,'order':[[_0xcd66('0x31'),'DESC']]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db[_0xcd66('0x3f')],'as':_0xcd66('0x40')}]})[_0xcd66('0x25')](function(_0x2fc479){if(_0x2fc479&&_0x2fc479[_0xcd66('0x3d')]){var _0x121cbe=_0x2fc479['get']({'plain':!![]});_0x51bfec[_0xcd66('0x3b')]=_['omit'](_0x121cbe,[_0xcd66('0x41'),_0xcd66('0x3d')]);_0x51bfec['applications']=_0x121cbe['Applications'];_0x51bfec[_0xcd66('0x42')]=_0x121cbe[_0xcd66('0x3d')];_0x51bfec['applications']=_[_0xcd66('0x43')](_0x51bfec['applications'],[_0xcd66('0x44')],[_0xcd66('0x45')]);if(_0x51bfec[_0xcd66('0x3b')]&&_0x51bfec['account'][_0xcd66('0x46')]){_0x51bfec[_0xcd66('0x47')][_0xcd66('0x48')]({'id':0x0,'priority':_0x51bfec[_0xcd66('0x47')][_0xcd66('0x49')]+0x1,'app':'close','appdata':_0xcd66('0x46'),'interval':'*,*,*,*'});}if(_0x51bfec['account'][_0xcd66('0x41')]){delete _0x51bfec['account']['Applications'];}if(_0x51bfec[_0xcd66('0x3b')][_0xcd66('0x3d')]){delete _0x51bfec[_0xcd66('0x3b')][_0xcd66('0x3d')];}if(_0x121cbe['List'][_0xcd66('0x3e')][_0xcd66('0x49')]){return _0x121cbe[_0xcd66('0x3d')][_0xcd66('0x3e')][0x0];}var _0x126195=_['defaults'](_0x2bfb26[_0xcd66('0x2a')],{'firstName':_0x2bfb26[_0xcd66('0x2a')][_0xcd66('0x34')],'ListId':_0x121cbe['ListId']});_0x126195[_0x2bfb26['body'][_0xcd66('0x37')]]=_0x2bfb26[_0xcd66('0x2a')][_0xcd66('0x34')];return db[_0xcd66('0x2e')]['create'](_0x126195);}else{throw new Error(_0xcd66('0x4a'));}})[_0xcd66('0x25')](function(_0x6cc2ce){_0x51bfec[_0xcd66('0x4b')]=_0x6cc2ce;if(_0x6cc2ce){if(!_0x2bfb26[_0xcd66('0x2a')][_0xcd66('0x17')][_0xcd66('0x4c')]){_0x2bfb26['body']['message'][_0xcd66('0x4c')]=rs[_0xcd66('0x4d')]()+'\x20'+_0x2bfb26[_0xcd66('0x2a')]['message'][_0xcd66('0x34')];}var _0x2846a6={'ContactId':_0x6cc2ce['id'],'MailAccountId':_0x2bfb26[_0xcd66('0x3b')]['id'],'inReplyTo':_0x2bfb26[_0xcd66('0x2a')][_0xcd66('0x17')][_0xcd66('0x4c')],'to':_0x2bfb26[_0xcd66('0x2a')]['message'][_0xcd66('0x34')],'cc':_0x2bfb26[_0xcd66('0x2a')][_0xcd66('0x17')]['cc'],'subject':_0x2bfb26['body'][_0xcd66('0x17')]['subject'],'attach':_0x2bfb26[_0xcd66('0x2a')][_0xcd66('0x17')][_0xcd66('0x4e')],'lastMsgAt':moment()[_0xcd66('0x4f')](_0xcd66('0x50')),'lastMsgDirection':'in','lastMsgBody':_0x2bfb26['body'][_0xcd66('0x2a')]};return db[_0xcd66('0x51')][_0xcd66('0x27')]({'where':{'closed':![],'MailAccountId':_0x2bfb26['account']['id']},'include':[{'model':db[_0xcd66('0x52')],'as':'Messages','attributes':[_0xcd66('0x4c')],'where':{'messageId':_0x2bfb26[_0xcd66('0x2a')][_0xcd66('0x17')][_0xcd66('0x53')]}}]})['then'](function(_0x13657a){if(_0x13657a){return[_0x13657a,![]];}return db['MailInteraction'][_0xcd66('0x54')](_0x2846a6)[_0xcd66('0x25')](function(_0x4b54f5){return[_0x4b54f5,!![]];});});}else{throw new Error(_0xcd66('0x55'));}})[_0xcd66('0x56')](function(_0x5ae0c8,_0xe41bf7){if(_0x5ae0c8){_0x140568=_0xe41bf7;if(!_0xe41bf7){return _0x5ae0c8[_0xcd66('0x57')]({'inReplyTo':_0x2bfb26[_0xcd66('0x2a')]['message'][_0xcd66('0x4c')],'to':_0x2bfb26[_0xcd66('0x2a')]['message'][_0xcd66('0x34')],'cc':_0x2bfb26['body']['message']['cc'],'subject':_0x2bfb26[_0xcd66('0x2a')][_0xcd66('0x17')][_0xcd66('0x58')],'attach':_0x5ae0c8[_0xcd66('0x4e')]?_0x5ae0c8[_0xcd66('0x4e')]:_0x2bfb26[_0xcd66('0x2a')][_0xcd66('0x17')][_0xcd66('0x4e')],'substatus':null,'substatusAt':moment()[_0xcd66('0x4f')](_0xcd66('0x50')),'lastMsgAt':moment()[_0xcd66('0x4f')](_0xcd66('0x50')),'lastMsgDirection':'in','lastMsgBody':_0x2bfb26[_0xcd66('0x2a')][_0xcd66('0x2a')]});}else{return _0x5ae0c8;}}})[_0xcd66('0x25')](function(_0x4b90c2){_0x51bfec[_0xcd66('0x59')]=_0x4b90c2[_0xcd66('0x5a')]({'plain':!![]});_0x51bfec[_0xcd66('0x59')][_0xcd66('0x5b')]=_0x140568;return db[_0xcd66('0x52')][_0xcd66('0x54')]({'body':_0x2bfb26[_0xcd66('0x2a')]['body'],'MailAccountId':_0x2bfb26['account']['id'],'MailInteractionId':_0x4b90c2['id'],'direction':'in','ContactId':_0x51bfec[_0xcd66('0x4b')]['id'],'messageId':_0x2bfb26[_0xcd66('0x2a')]['message'][_0xcd66('0x4c')],'from':_0x2bfb26[_0xcd66('0x2a')]['message']['from'],'to':_0x2bfb26[_0xcd66('0x2a')]['message']['to'],'cc':_0x2bfb26[_0xcd66('0x2a')][_0xcd66('0x17')]['cc'],'subject':_0x2bfb26[_0xcd66('0x2a')][_0xcd66('0x17')][_0xcd66('0x58')],'attach':_0x2bfb26[_0xcd66('0x2a')][_0xcd66('0x17')]['attach'],'Attachments':_0x2bfb26[_0xcd66('0x2a')][_0xcd66('0x17')][_0xcd66('0x5c')],'originTo':_0x2bfb26[_0xcd66('0x2a')]['message'][_0xcd66('0x5d')],'originCc':_0x2bfb26[_0xcd66('0x2a')][_0xcd66('0x17')][_0xcd66('0x5e')],'bcc':_0x2bfb26[_0xcd66('0x2a')][_0xcd66('0x17')][_0xcd66('0x5f')]},{'include':[{'model':db[_0xcd66('0x60')],'as':'Attachments'}]});})[_0xcd66('0x25')](function(_0x8df38e){_0x51bfec['message']=_0x8df38e;if(_0x51bfec[_0xcd66('0x59')][_0xcd66('0x61')]){return db[_0xcd66('0x62')][_0xcd66('0x27')]({'attributes':['id',_0xcd66('0x63')],'where':{'id':_0x51bfec[_0xcd66('0x59')][_0xcd66('0x61')]}})[_0xcd66('0x25')](function(_0x42b3e6){if(_0x42b3e6){_0x51bfec[_0xcd66('0x47')][_0xcd66('0x64')]({'id':0x0,'priority':0x0,'app':_0xcd66('0x65'),'appdata':_0x42b3e6['name']+','+(_0x51bfec['account'][_0xcd66('0x66')]||0xa),'interval':_0xcd66('0x67')});}return respondWithRpcPromise('Start','startRouting',_0x51bfec);});}return respondWithRpcPromise(_0xcd66('0x68'),_0xcd66('0x69'),_0x51bfec);})['then'](function(_0x212b82){_0x1c4bd7(_0x212b82);})[_0xcd66('0x1a')](function(_0xdb91e9){_0x3be90b(_0x4902d4[_0xcd66('0x16')](0x1f4,_0xdb91e9['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index f2c83e3..a270b74 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 _0x92e0=['removeListener','register','length','mailAccount:','./mailAccount.events','remove','update','emit'];(function(_0x26f7d4,_0x5d0acf){var _0x4676ed=function(_0x42e9ec){while(--_0x42e9ec){_0x26f7d4['push'](_0x26f7d4['shift']());}};_0x4676ed(++_0x5d0acf);}(_0x92e0,0x154));var _0x092e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x92e0[_0x3dd15e];return _0x231fd0;};'use strict';var MailAccountEvents=require(_0x092e('0x0'));var events=['save',_0x092e('0x1'),_0x092e('0x2')];function createListener(_0x2e3997,_0x116cd1){return function(_0x10ccfe){_0x116cd1[_0x092e('0x3')](_0x2e3997,_0x10ccfe);};}function removeListener(_0x3756db,_0x416760){return function(){MailAccountEvents[_0x092e('0x4')](_0x3756db,_0x416760);};}exports[_0x092e('0x5')]=function(_0x51779f){for(var _0x48af76=0x0,_0x2f1f0b=events[_0x092e('0x6')];_0x48af76<_0x2f1f0b;_0x48af76++){var _0x1af53d=events[_0x48af76];var _0x4c73a9=createListener(_0x092e('0x7')+_0x1af53d,_0x51779f);MailAccountEvents['on'](_0x1af53d,_0x4c73a9);}}; \ No newline at end of file +var _0x7f05=['remove','emit','removeListener','length','./mailAccount.events','save'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x7f05,0xdc));var _0x57f0=function(_0x542f65,_0x348ea7){_0x542f65=_0x542f65-0x0;var _0x1c6557=_0x7f05[_0x542f65];return _0x1c6557;};'use strict';var MailAccountEvents=require(_0x57f0('0x0'));var events=[_0x57f0('0x1'),_0x57f0('0x2'),'update'];function createListener(_0xc52af3,_0x49238d){return function(_0x2f3707){_0x49238d[_0x57f0('0x3')](_0xc52af3,_0x2f3707);};}function removeListener(_0x52bde5,_0x25b25f){return function(){MailAccountEvents[_0x57f0('0x4')](_0x52bde5,_0x25b25f);};}exports['register']=function(_0x27b8f6){for(var _0x295ad5=0x0,_0x4975ec=events[_0x57f0('0x5')];_0x295ad5<_0x4975ec;_0x295ad5++){var _0x574a16=events[_0x295ad5];var _0x3f7ebc=createListener('mailAccount:'+_0x574a16,_0x27b8f6);MailAccountEvents['on'](_0x574a16,_0x3f7ebc);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 78ba632..9d50bfb 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 _0x6324=['multer','util','path','connect-timeout','Router','../../components/interaction/service','./mailApplication.controller','/:id','isAuthenticated','show','put','update','delete','destroy'];(function(_0x621bee,_0x58f8c0){var _0x3076c8=function(_0x228229){while(--_0x228229){_0x621bee['push'](_0x621bee['shift']());}};_0x3076c8(++_0x58f8c0);}(_0x6324,0x142));var _0x4632=function(_0x18be13,_0x12f269){_0x18be13=_0x18be13-0x0;var _0x17317b=_0x6324[_0x18be13];return _0x17317b;};'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'](_0x4632('0x7'),auth[_0x4632('0x8')](),controller[_0x4632('0x9')]);router[_0x4632('0xa')]('/:id',auth[_0x4632('0x8')](),controller[_0x4632('0xb')]);router[_0x4632('0xc')]('/:id',auth[_0x4632('0x8')](),controller[_0x4632('0xd')]);module['exports']=router; \ No newline at end of file +var _0x6b20=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','multer'];(function(_0x380ea5,_0x5c3a54){var _0x5cb0cb=function(_0x5682b0){while(--_0x5682b0){_0x380ea5['push'](_0x380ea5['shift']());}};_0x5cb0cb(++_0x5c3a54);}(_0x6b20,0xd1));var _0x06b2=function(_0x5dfd14,_0x31e188){_0x5dfd14=_0x5dfd14-0x0;var _0x4170c6=_0x6b20[_0x5dfd14];return _0x4170c6;};'use strict';var multer=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var path=require('path');var timeout=require(_0x06b2('0x2'));var express=require('express');var router=express[_0x06b2('0x3')]();var auth=require(_0x06b2('0x4'));var interaction=require(_0x06b2('0x5'));var config=require('../../config/environment');var controller=require(_0x06b2('0x6'));router[_0x06b2('0x7')](_0x06b2('0x8'),auth[_0x06b2('0x9')](),controller[_0x06b2('0xa')]);router[_0x06b2('0xb')](_0x06b2('0x8'),auth['isAuthenticated'](),controller[_0x06b2('0xc')]);router[_0x06b2('0xd')](_0x06b2('0x8'),auth['isAuthenticated'](),controller[_0x06b2('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 12cc314..ed16d8f 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 _0xdc1f=['*,*,*,*','sequelize','exports','STRING','noop','TEXT'];(function(_0x1c41f7,_0x7f257b){var _0x4d5733=function(_0x5d44a1){while(--_0x5d44a1){_0x1c41f7['push'](_0x1c41f7['shift']());}};_0x4d5733(++_0x7f257b);}(_0xdc1f,0xaf));var _0xfdc1=function(_0x19b29a,_0x555030){_0x19b29a=_0x19b29a-0x0;var _0x4f028d=_0xdc1f[_0x19b29a];return _0x4f028d;};'use strict';var Sequelize=require(_0xfdc1('0x0'));module[_0xfdc1('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xfdc1('0x2')],'allowNull':![],'defaultValue':_0xfdc1('0x3')},'appdata':{'type':Sequelize[_0xfdc1('0x4')]()},'description':{'type':Sequelize[_0xfdc1('0x2')]},'interval':{'type':Sequelize[_0xfdc1('0x2')],'defaultValue':_0xfdc1('0x5')}}; \ No newline at end of file +var _0xd01c=['*,*,*,*','sequelize','exports','STRING','noop','TEXT'];(function(_0x83cc7b,_0x337a6b){var _0x77e5ab=function(_0xe70954){while(--_0xe70954){_0x83cc7b['push'](_0x83cc7b['shift']());}};_0x77e5ab(++_0x337a6b);}(_0xd01c,0xa9));var _0xcd01=function(_0x2df802,_0x5f16b0){_0x2df802=_0x2df802-0x0;var _0x48f082=_0xd01c[_0x2df802];return _0x48f082;};'use strict';var Sequelize=require(_0xcd01('0x0'));module[_0xcd01('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xcd01('0x2')],'allowNull':![],'defaultValue':_0xcd01('0x3')},'appdata':{'type':Sequelize[_0xcd01('0x4')]()},'description':{'type':Sequelize[_0xcd01('0x2')]},'interval':{'type':Sequelize[_0xcd01('0x2')],'defaultValue':_0xcd01('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 4fa2782..5c79187 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 _0x003f=['limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','params','keys','MailApplication','rawAttributes','query','filters','attributes','intersection','model','fields','length','includeAll','merge','options','find','catch','body','destroy','html-pdf','eml-format','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset'];(function(_0x485b21,_0x5dc3ef){var _0x13d35a=function(_0x189d43){while(--_0x189d43){_0x485b21['push'](_0x485b21['shift']());}};_0x13d35a(++_0x5dc3ef);}(_0x003f,0x1ad));var _0xf003=function(_0x143187,_0x3f55af){_0x143187=_0x143187-0x0;var _0x5cbff7=_0x003f[_0x143187];return _0x5cbff7;};'use strict';var pdf=require(_0xf003('0x0'));var emlformat=require(_0xf003('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf003('0x2'));var moment=require(_0xf003('0x3'));var BPromise=require(_0xf003('0x4'));var Mustache=require(_0xf003('0x5'));var util=require('util');var path=require(_0xf003('0x6'));var sox=require(_0xf003('0x7'));var csv=require('to-csv');var ejs=require(_0xf003('0x8'));var fs=require('fs');var _=require(_0xf003('0x9'));var squel=require(_0xf003('0xa'));var crypto=require('crypto');var jsforce=require(_0xf003('0xb'));var deskjs=require(_0xf003('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf003('0xd'));var authService=require(_0xf003('0xe'));var qs=require(_0xf003('0xf'));var as=require(_0xf003('0x10'));var hardwareService=require(_0xf003('0x11'));var logger=require(_0xf003('0x12'))(_0xf003('0x13'));var utils=require(_0xf003('0x14'));var config=require(_0xf003('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x72fa6b,_0x1694dc){_0x1694dc=_0x1694dc||0xcc;return function(_0xfdcff3){if(_0xfdcff3){return _0x72fa6b['sendStatus'](_0x1694dc);}return _0x72fa6b[_0xf003('0x16')](_0x1694dc)[_0xf003('0x17')]();};}function respondWithResult(_0x597898,_0x5e2c46){_0x5e2c46=_0x5e2c46||0xc8;return function(_0x1452b1){if(_0x1452b1){return _0x597898[_0xf003('0x16')](_0x5e2c46)[_0xf003('0x18')](_0x1452b1);}};}function respondWithFilteredResult(_0x1dfd84,_0x3cde58){return function(_0x829d8f){if(_0x829d8f){var _0xf6608c=_0x829d8f[_0xf003('0x19')],_0x4ba12e=_0x3cde58[_0xf003('0x1a')],_0x33ac7e=_0x3cde58[_0xf003('0x1a')]+_0x3cde58[_0xf003('0x1b')],_0x1a2357;if(_0x33ac7e>=_0xf6608c){_0x33ac7e=_0xf6608c;_0x1a2357=0xc8;}else{_0x1a2357=0xce;}_0x1dfd84[_0xf003('0x16')](_0x1a2357);return _0x1dfd84[_0xf003('0x1c')](_0xf003('0x1d'),_0x4ba12e+'-'+_0x33ac7e+'/'+_0xf6608c)['json'](_0x829d8f);}return null;};}function patchUpdates(_0x2589a2){return function(_0xb6a9fa){try{jsonpatch[_0xf003('0x1e')](_0xb6a9fa,_0x2589a2,!![]);}catch(_0x165dfd){return BPromise[_0xf003('0x1f')](_0x165dfd);}return _0xb6a9fa[_0xf003('0x20')]();};}function saveUpdates(_0x3e2230,_0x27c8c7){return function(_0x505c79){if(_0x505c79){return _0x505c79[_0xf003('0x21')](_0x3e2230)[_0xf003('0x22')](function(_0x6495a5){return _0x6495a5;});}return null;};}function removeEntity(_0x43b0df,_0x3feb20){return function(_0x9d66b8){if(_0x9d66b8){return _0x9d66b8['destroy']()[_0xf003('0x22')](function(){_0x43b0df[_0xf003('0x16')](0xcc)[_0xf003('0x17')]();});}};}function handleEntityNotFound(_0x8bcd3,_0x13cf8a){return function(_0x5c5218){if(!_0x5c5218){_0x8bcd3[_0xf003('0x23')](0x194);}return _0x5c5218;};}function handleError(_0x4ef2cb,_0x390a1e){_0x390a1e=_0x390a1e||0x1f4;return function(_0x5de6fc){logger[_0xf003('0x24')](_0x5de6fc[_0xf003('0x25')]);if(_0x5de6fc[_0xf003('0x26')]){delete _0x5de6fc['name'];}_0x4ef2cb[_0xf003('0x16')](_0x390a1e)['send'](_0x5de6fc);};}exports['show']=function(_0x4fa5d5,_0x45819c){var _0x34c8ac={'raw':!![],'where':{'id':_0x4fa5d5[_0xf003('0x27')]['id']}},_0x300dac={};_0x300dac['model']=_[_0xf003('0x28')](db[_0xf003('0x29')][_0xf003('0x2a')]);_0x300dac[_0xf003('0x2b')]=_[_0xf003('0x28')](_0x4fa5d5['query']);_0x300dac[_0xf003('0x2c')]=_['intersection'](_0x300dac['model'],_0x300dac[_0xf003('0x2b')]);_0x34c8ac[_0xf003('0x2d')]=_[_0xf003('0x2e')](_0x300dac[_0xf003('0x2f')],qs[_0xf003('0x30')](_0x4fa5d5[_0xf003('0x2b')][_0xf003('0x30')]));_0x34c8ac[_0xf003('0x2d')]=_0x34c8ac[_0xf003('0x2d')][_0xf003('0x31')]?_0x34c8ac[_0xf003('0x2d')]:_0x300dac[_0xf003('0x2f')];if(_0x4fa5d5[_0xf003('0x2b')][_0xf003('0x32')]){_0x34c8ac['include']=[{'all':!![]}];}_0x34c8ac=_[_0xf003('0x33')]({},_0x34c8ac,_0x4fa5d5[_0xf003('0x34')]);return db['MailApplication'][_0xf003('0x35')](_0x34c8ac)[_0xf003('0x22')](handleEntityNotFound(_0x45819c,null))[_0xf003('0x22')](respondWithResult(_0x45819c,null))[_0xf003('0x36')](handleError(_0x45819c,null));};exports[_0xf003('0x21')]=function(_0x1ee3fa,_0x1ab111){if(_0x1ee3fa[_0xf003('0x37')]['id']){delete _0x1ee3fa['body']['id'];}return db['MailApplication'][_0xf003('0x35')]({'where':{'id':_0x1ee3fa[_0xf003('0x27')]['id']}})[_0xf003('0x22')](handleEntityNotFound(_0x1ab111,null))[_0xf003('0x22')](saveUpdates(_0x1ee3fa[_0xf003('0x37')],null))['then'](respondWithResult(_0x1ab111,null))[_0xf003('0x36')](handleError(_0x1ab111,null));};exports[_0xf003('0x38')]=function(_0x35e6da,_0x2494dc){return db[_0xf003('0x29')][_0xf003('0x35')]({'where':{'id':_0x35e6da[_0xf003('0x27')]['id']}})[_0xf003('0x22')](handleEntityNotFound(_0x2494dc,null))[_0xf003('0x22')](removeEntity(_0x2494dc,null))['catch'](handleError(_0x2494dc,null));}; \ No newline at end of file +var _0xfb7e=['destroy','error','stack','send','params','model','keys','MailApplication','rawAttributes','query','intersection','attributes','fields','merge','options','update','body','find','catch','rimraf','zip-dir','request-promise','moment','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then'];(function(_0x2dad9f,_0x23fe8d){var _0x3eac09=function(_0x16d864){while(--_0x16d864){_0x2dad9f['push'](_0x2dad9f['shift']());}};_0x3eac09(++_0x23fe8d);}(_0xfb7e,0x145));var _0xefb7=function(_0x4c0442,_0x5f3c02){_0x4c0442=_0x4c0442-0x0;var _0x22e88b=_0xfb7e[_0x4c0442];return _0x22e88b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xefb7('0x0'));var zipdir=require(_0xefb7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xefb7('0x2'));var moment=require(_0xefb7('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xefb7('0x4'));var path=require(_0xefb7('0x5'));var sox=require(_0xefb7('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xefb7('0x7'));var squel=require(_0xefb7('0x8'));var crypto=require(_0xefb7('0x9'));var jsforce=require(_0xefb7('0xa'));var deskjs=require(_0xefb7('0xb'));var toCsv=require(_0xefb7('0xc'));var querystring=require(_0xefb7('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xefb7('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xefb7('0xf'))(_0xefb7('0x10'));var utils=require(_0xefb7('0x11'));var config=require(_0xefb7('0x12'));var db=require(_0xefb7('0x13'))['db'];function respondWithStatusCode(_0x5db428,_0x560f88){_0x560f88=_0x560f88||0xcc;return function(_0x16d481){if(_0x16d481){return _0x5db428[_0xefb7('0x14')](_0x560f88);}return _0x5db428[_0xefb7('0x15')](_0x560f88)[_0xefb7('0x16')]();};}function respondWithResult(_0x5508d8,_0x46d669){_0x46d669=_0x46d669||0xc8;return function(_0x3d3c33){if(_0x3d3c33){return _0x5508d8['status'](_0x46d669)[_0xefb7('0x17')](_0x3d3c33);}};}function respondWithFilteredResult(_0xe4766,_0x47f3ae){return function(_0x3c0a14){if(_0x3c0a14){var _0x11cea7=_0x3c0a14[_0xefb7('0x18')],_0x460d8d=_0x47f3ae[_0xefb7('0x19')],_0x593b89=_0x47f3ae[_0xefb7('0x19')]+_0x47f3ae[_0xefb7('0x1a')],_0x5eadc8;if(_0x593b89>=_0x11cea7){_0x593b89=_0x11cea7;_0x5eadc8=0xc8;}else{_0x5eadc8=0xce;}_0xe4766[_0xefb7('0x15')](_0x5eadc8);return _0xe4766[_0xefb7('0x1b')](_0xefb7('0x1c'),_0x460d8d+'-'+_0x593b89+'/'+_0x11cea7)['json'](_0x3c0a14);}return null;};}function patchUpdates(_0x209b26){return function(_0x3f1abf){try{jsonpatch[_0xefb7('0x1d')](_0x3f1abf,_0x209b26,!![]);}catch(_0x43c211){return BPromise['reject'](_0x43c211);}return _0x3f1abf[_0xefb7('0x1e')]();};}function saveUpdates(_0x92b3fd,_0x4cdaf6){return function(_0x4a960d){if(_0x4a960d){return _0x4a960d['update'](_0x92b3fd)[_0xefb7('0x1f')](function(_0x5b97f9){return _0x5b97f9;});}return null;};}function removeEntity(_0x2093f3,_0x3e93ae){return function(_0x52b020){if(_0x52b020){return _0x52b020[_0xefb7('0x20')]()[_0xefb7('0x1f')](function(){_0x2093f3[_0xefb7('0x15')](0xcc)[_0xefb7('0x16')]();});}};}function handleEntityNotFound(_0xd770ba,_0x31757b){return function(_0x449117){if(!_0x449117){_0xd770ba['sendStatus'](0x194);}return _0x449117;};}function handleError(_0x15837e,_0x5a955f){_0x5a955f=_0x5a955f||0x1f4;return function(_0x568bcb){logger[_0xefb7('0x21')](_0x568bcb[_0xefb7('0x22')]);if(_0x568bcb['name']){delete _0x568bcb['name'];}_0x15837e['status'](_0x5a955f)[_0xefb7('0x23')](_0x568bcb);};}exports['show']=function(_0x255f33,_0x3fda18){var _0x3c1929={'raw':!![],'where':{'id':_0x255f33[_0xefb7('0x24')]['id']}},_0x10567c={};_0x10567c[_0xefb7('0x25')]=_[_0xefb7('0x26')](db[_0xefb7('0x27')][_0xefb7('0x28')]);_0x10567c[_0xefb7('0x29')]=_['keys'](_0x255f33[_0xefb7('0x29')]);_0x10567c['filters']=_[_0xefb7('0x2a')](_0x10567c[_0xefb7('0x25')],_0x10567c['query']);_0x3c1929[_0xefb7('0x2b')]=_[_0xefb7('0x2a')](_0x10567c[_0xefb7('0x25')],qs[_0xefb7('0x2c')](_0x255f33['query'][_0xefb7('0x2c')]));_0x3c1929[_0xefb7('0x2b')]=_0x3c1929[_0xefb7('0x2b')]['length']?_0x3c1929['attributes']:_0x10567c[_0xefb7('0x25')];if(_0x255f33['query']['includeAll']){_0x3c1929['include']=[{'all':!![]}];}_0x3c1929=_[_0xefb7('0x2d')]({},_0x3c1929,_0x255f33[_0xefb7('0x2e')]);return db['MailApplication']['find'](_0x3c1929)[_0xefb7('0x1f')](handleEntityNotFound(_0x3fda18,null))['then'](respondWithResult(_0x3fda18,null))['catch'](handleError(_0x3fda18,null));};exports[_0xefb7('0x2f')]=function(_0x4159bb,_0x3d4e2c){if(_0x4159bb[_0xefb7('0x30')]['id']){delete _0x4159bb[_0xefb7('0x30')]['id'];}return db[_0xefb7('0x27')][_0xefb7('0x31')]({'where':{'id':_0x4159bb[_0xefb7('0x24')]['id']}})[_0xefb7('0x1f')](handleEntityNotFound(_0x3d4e2c,null))[_0xefb7('0x1f')](saveUpdates(_0x4159bb[_0xefb7('0x30')],null))[_0xefb7('0x1f')](respondWithResult(_0x3d4e2c,null))[_0xefb7('0x32')](handleError(_0x3d4e2c,null));};exports[_0xefb7('0x20')]=function(_0x184f84,_0x1d5226){return db[_0xefb7('0x27')][_0xefb7('0x31')]({'where':{'id':_0x184f84[_0xefb7('0x24')]['id']}})[_0xefb7('0x1f')](handleEntityNotFound(_0x1d5226,null))['then'](removeEntity(_0x1d5226,null))['catch'](handleError(_0x1d5226,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 3cda2f3..82df17b 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 _0x9752=['utf8mb4','utf8mb4_unicode_ci','api','moment','bluebird','path','rimraf','../../config/environment','./mailApplication.attributes','define','mail_applications'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x9752,0x7b));var _0x2975=function(_0x45a0e3,_0xe5ed1b){_0x45a0e3=_0x45a0e3-0x0;var _0x365f01=_0x9752[_0x45a0e3];return _0x365f01;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2975('0x0'));var moment=require(_0x2975('0x1'));var BPromise=require(_0x2975('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2975('0x3'));var rimraf=require(_0x2975('0x4'));var config=require(_0x2975('0x5'));var attributes=require(_0x2975('0x6'));module['exports']=function(_0x36e942,_0x2099bb){return _0x36e942[_0x2975('0x7')]('MailApplication',attributes,{'tableName':_0x2975('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2975('0x9'),'collate':_0x2975('0xa')});}; \ No newline at end of file +var _0x5e3e=['request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird'];(function(_0x591801,_0x38236a){var _0x5de823=function(_0x2cc23f){while(--_0x2cc23f){_0x591801['push'](_0x591801['shift']());}};_0x5de823(++_0x38236a);}(_0x5e3e,0x1ad));var _0xe5e3=function(_0x2bcbc8,_0x3d1f69){_0x2bcbc8=_0x2bcbc8-0x0;var _0xf97356=_0x5e3e[_0x2bcbc8];return _0xf97356;};'use strict';var _=require(_0xe5e3('0x0'));var util=require(_0xe5e3('0x1'));var logger=require('../../config/logger')(_0xe5e3('0x2'));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(_0xe5e3('0x7'));var config=require(_0xe5e3('0x8'));var attributes=require(_0xe5e3('0x9'));module['exports']=function(_0x302cc3,_0x464861){return _0x302cc3[_0xe5e3('0xa')]('MailApplication',attributes,{'tableName':_0xe5e3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe5e3('0xc'),'collate':_0xe5e3('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index a5ec922..630fa52 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 _0xa4fc=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','MailApplication,\x20%s,\x20%s','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','limit','debug','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x571051,_0x80ee6d){var _0xa957ce=function(_0x31d0e2){while(--_0x31d0e2){_0x571051['push'](_0x571051['shift']());}};_0xa957ce(++_0x80ee6d);}(_0xa4fc,0xfb));var _0xca4f=function(_0x4df4ae,_0x1b53e9){_0x4df4ae=_0x4df4ae-0x0;var _0x4f86e7=_0xa4fc[_0x4df4ae];return _0x4f86e7;};'use strict';var _=require(_0xca4f('0x0'));var util=require(_0xca4f('0x1'));var moment=require(_0xca4f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca4f('0x3'));var db=require(_0xca4f('0x4'))['db'];var utils=require(_0xca4f('0x5'));var logger=require(_0xca4f('0x6'))(_0xca4f('0x7'));var config=require(_0xca4f('0x8'));var jayson=require(_0xca4f('0x9'));var client=jayson['client'][_0xca4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18aea9,_0x2eba6b,_0x25d635){return new BPromise(function(_0x51d71e,_0x4c1e46){return client[_0xca4f('0xb')](_0x18aea9,_0x25d635)[_0xca4f('0xc')](function(_0x7fa37){logger['info']('MailApplication,\x20%s,\x20%s',_0x2eba6b,_0xca4f('0xd'));logger['debug'](_0xca4f('0xe'),_0x2eba6b,_0xca4f('0xd'),JSON[_0xca4f('0xf')](_0x7fa37));if(_0x7fa37[_0xca4f('0x10')]){if(_0x7fa37[_0xca4f('0x10')]['code']===0x1f4){logger[_0xca4f('0x10')]('MailApplication,\x20%s,\x20%s',_0x2eba6b,_0x7fa37[_0xca4f('0x10')][_0xca4f('0x11')]);return _0x4c1e46(_0x7fa37[_0xca4f('0x10')]['message']);}logger[_0xca4f('0x10')]('MailApplication,\x20%s,\x20%s',_0x2eba6b,_0x7fa37['error']['message']);return _0x51d71e(_0x7fa37[_0xca4f('0x10')][_0xca4f('0x11')]);}else{logger[_0xca4f('0x12')]('MailApplication,\x20%s,\x20%s',_0x2eba6b,_0xca4f('0xd'));_0x51d71e(_0x7fa37[_0xca4f('0x13')][_0xca4f('0x11')]);}})[_0xca4f('0x14')](function(_0x8ce486){logger[_0xca4f('0x10')](_0xca4f('0x15'),_0x2eba6b,_0x8ce486);_0x4c1e46(_0x8ce486);});});}exports[_0xca4f('0x16')]=function(_0x1a900d){var _0x1ef2aa=this;return new Promise(function(_0x44c75a,_0x382f4a){return db[_0xca4f('0x17')][_0xca4f('0x18')](_0x1a900d[_0xca4f('0x19')],{'raw':_0x1a900d[_0xca4f('0x1a')]?_0x1a900d[_0xca4f('0x1a')][_0xca4f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a900d['options']?_0x1a900d[_0xca4f('0x1a')][_0xca4f('0x1c')]||null:null,'attributes':_0x1a900d['options']?_0x1a900d[_0xca4f('0x1a')][_0xca4f('0x1d')]||null:null,'limit':_0x1a900d[_0xca4f('0x1a')]?_0x1a900d['options'][_0xca4f('0x1e')]||null:null})[_0xca4f('0xc')](function(_0x473c67){logger[_0xca4f('0x12')](_0xca4f('0x16'),_0x1a900d);logger[_0xca4f('0x1f')](_0xca4f('0x16'),_0x1a900d,JSON[_0xca4f('0xf')](_0x473c67));_0x44c75a(_0x473c67);})[_0xca4f('0x14')](function(_0xe86e22){logger[_0xca4f('0x10')](_0xca4f('0x16'),_0xe86e22[_0xca4f('0x11')],_0x1a900d);_0x382f4a(_0x1ef2aa[_0xca4f('0x10')](0x1f4,_0xe86e22[_0xca4f('0x11')]));});});}; \ No newline at end of file +var _0x1e7f=['body','options','raw','where','attributes','limit','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateMailApplication','MailApplication','update'];(function(_0x2b79bf,_0x594e47){var _0x250a45=function(_0x35844f){while(--_0x35844f){_0x2b79bf['push'](_0x2b79bf['shift']());}};_0x250a45(++_0x594e47);}(_0x1e7f,0x1c8));var _0xf1e7=function(_0x35c455,_0x12f60a){_0x35c455=_0x35c455-0x0;var _0x4796dc=_0x1e7f[_0x35c455];return _0x4796dc;};'use strict';var _=require('lodash');var util=require(_0xf1e7('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf1e7('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf1e7('0x2'))['db'];var utils=require(_0xf1e7('0x3'));var logger=require(_0xf1e7('0x4'))(_0xf1e7('0x5'));var config=require(_0xf1e7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf1e7('0x7')][_0xf1e7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x34a948,_0x4786fb,_0x281a99){return new BPromise(function(_0x543139,_0x4acf63){return client[_0xf1e7('0x9')](_0x34a948,_0x281a99)[_0xf1e7('0xa')](function(_0x4d91f6){logger[_0xf1e7('0xb')](_0xf1e7('0xc'),_0x4786fb,_0xf1e7('0xd'));logger[_0xf1e7('0xe')](_0xf1e7('0xf'),_0x4786fb,'request\x20sent',JSON[_0xf1e7('0x10')](_0x4d91f6));if(_0x4d91f6['error']){if(_0x4d91f6[_0xf1e7('0x11')][_0xf1e7('0x12')]===0x1f4){logger[_0xf1e7('0x11')]('MailApplication,\x20%s,\x20%s',_0x4786fb,_0x4d91f6[_0xf1e7('0x11')][_0xf1e7('0x13')]);return _0x4acf63(_0x4d91f6[_0xf1e7('0x11')][_0xf1e7('0x13')]);}logger[_0xf1e7('0x11')](_0xf1e7('0xc'),_0x4786fb,_0x4d91f6[_0xf1e7('0x11')]['message']);return _0x543139(_0x4d91f6[_0xf1e7('0x11')][_0xf1e7('0x13')]);}else{logger[_0xf1e7('0xb')](_0xf1e7('0xc'),_0x4786fb,_0xf1e7('0xd'));_0x543139(_0x4d91f6['result'][_0xf1e7('0x13')]);}})[_0xf1e7('0x14')](function(_0x2034e9){logger[_0xf1e7('0x11')]('MailApplication,\x20%s,\x20%s',_0x4786fb,_0x2034e9);_0x4acf63(_0x2034e9);});});}exports[_0xf1e7('0x15')]=function(_0x4986e3){var _0x395e83=this;return new Promise(function(_0x295e6b,_0x1bf5ba){return db[_0xf1e7('0x16')][_0xf1e7('0x17')](_0x4986e3[_0xf1e7('0x18')],{'raw':_0x4986e3[_0xf1e7('0x19')]?_0x4986e3[_0xf1e7('0x19')][_0xf1e7('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4986e3[_0xf1e7('0x19')]?_0x4986e3[_0xf1e7('0x19')][_0xf1e7('0x1b')]||null:null,'attributes':_0x4986e3['options']?_0x4986e3['options'][_0xf1e7('0x1c')]||null:null,'limit':_0x4986e3[_0xf1e7('0x19')]?_0x4986e3[_0xf1e7('0x19')][_0xf1e7('0x1d')]||null:null})[_0xf1e7('0xa')](function(_0xb6c204){logger[_0xf1e7('0xb')]('UpdateMailApplication',_0x4986e3);logger[_0xf1e7('0xe')]('UpdateMailApplication',_0x4986e3,JSON[_0xf1e7('0x10')](_0xb6c204));_0x295e6b(_0xb6c204);})[_0xf1e7('0x14')](function(_0x34b04d){logger[_0xf1e7('0x11')](_0xf1e7('0x15'),_0x34b04d['message'],_0x4986e3);_0x1bf5ba(_0x395e83[_0xf1e7('0x11')](0x1f4,_0x34b04d[_0xf1e7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index a379cb6..786781c 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 _0xfd64=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','put','/:id','mailinteraction:update','delete','tracked','mailinteraction:destroy','destroy','removeTags','exports','util','path'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xfd64,0x1c5));var _0x4fd6=function(_0x7c7115,_0xcd39c0){_0x7c7115=_0x7c7115-0x0;var _0x1a4c76=_0xfd64[_0x7c7115];return _0x1a4c76;};'use strict';var multer=require('multer');var util=require(_0x4fd6('0x0'));var path=require(_0x4fd6('0x1'));var timeout=require(_0x4fd6('0x2'));var express=require(_0x4fd6('0x3'));var router=express[_0x4fd6('0x4')]();var auth=require(_0x4fd6('0x5'));var interaction=require(_0x4fd6('0x6'));var config=require(_0x4fd6('0x7'));var controller=require(_0x4fd6('0x8'));router[_0x4fd6('0x9')]('/',auth[_0x4fd6('0xa')](),controller[_0x4fd6('0xb')]);router[_0x4fd6('0x9')](_0x4fd6('0xc'),auth[_0x4fd6('0xa')](),controller[_0x4fd6('0xd')]);router[_0x4fd6('0x9')]('/:id',auth[_0x4fd6('0xa')](),controller[_0x4fd6('0xe')]);router['get'](_0x4fd6('0xf'),auth['isAuthenticated'](),controller[_0x4fd6('0x10')]);router[_0x4fd6('0x9')](_0x4fd6('0x11'),auth[_0x4fd6('0xa')](),controller[_0x4fd6('0x12')]);router[_0x4fd6('0x13')]('/',auth['isAuthenticated'](),controller[_0x4fd6('0x14')]);router[_0x4fd6('0x13')]('/:id/messages',auth[_0x4fd6('0xa')](),controller[_0x4fd6('0x15')]);router[_0x4fd6('0x13')](_0x4fd6('0x16'),auth[_0x4fd6('0xa')](),interaction['tracked'](_0x4fd6('0x17'),_0x4fd6('0x18')),controller[_0x4fd6('0x19')]);router[_0x4fd6('0x1a')](_0x4fd6('0x1b'),auth[_0x4fd6('0xa')](),interaction['tracked'](_0x4fd6('0x17'),_0x4fd6('0x1c')),controller['update']);router[_0x4fd6('0x1d')](_0x4fd6('0x1b'),auth['isAuthenticated'](),interaction[_0x4fd6('0x1e')](_0x4fd6('0x17'),_0x4fd6('0x1f')),controller[_0x4fd6('0x20')]);router[_0x4fd6('0x1d')](_0x4fd6('0x16'),auth[_0x4fd6('0xa')](),controller[_0x4fd6('0x21')]);module[_0x4fd6('0x22')]=router; \ No newline at end of file +var _0x3b40=['post','create','addMessage','/:id/tags','mailinteraction:addtags','addTags','put','/:id','tracked','mailinteraction:update','mailinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','isAuthenticated','get','show','/:id/messages','getMessages','/:id/download','download'];(function(_0x50fda9,_0x5ee44b){var _0x36b92b=function(_0x121877){while(--_0x121877){_0x50fda9['push'](_0x50fda9['shift']());}};_0x36b92b(++_0x5ee44b);}(_0x3b40,0x13a));var _0x03b4=function(_0x5e6dca,_0x21c716){_0x5e6dca=_0x5e6dca-0x0;var _0x2a5406=_0x3b40[_0x5e6dca];return _0x2a5406;};'use strict';var multer=require('multer');var util=require(_0x03b4('0x0'));var path=require(_0x03b4('0x1'));var timeout=require(_0x03b4('0x2'));var express=require(_0x03b4('0x3'));var router=express[_0x03b4('0x4')]();var auth=require(_0x03b4('0x5'));var interaction=require(_0x03b4('0x6'));var config=require(_0x03b4('0x7'));var controller=require(_0x03b4('0x8'));router['get']('/',auth[_0x03b4('0x9')](),controller['index']);router[_0x03b4('0xa')]('/describe',auth[_0x03b4('0x9')](),controller['describe']);router[_0x03b4('0xa')]('/:id',auth[_0x03b4('0x9')](),controller[_0x03b4('0xb')]);router['get'](_0x03b4('0xc'),auth['isAuthenticated'](),controller[_0x03b4('0xd')]);router[_0x03b4('0xa')](_0x03b4('0xe'),auth[_0x03b4('0x9')](),controller[_0x03b4('0xf')]);router[_0x03b4('0x10')]('/',auth[_0x03b4('0x9')](),controller[_0x03b4('0x11')]);router[_0x03b4('0x10')]('/:id/messages',auth[_0x03b4('0x9')](),controller[_0x03b4('0x12')]);router['post'](_0x03b4('0x13'),auth[_0x03b4('0x9')](),interaction['tracked']('mail',_0x03b4('0x14')),controller[_0x03b4('0x15')]);router[_0x03b4('0x16')](_0x03b4('0x17'),auth[_0x03b4('0x9')](),interaction[_0x03b4('0x18')]('mail',_0x03b4('0x19')),controller['update']);router['delete'](_0x03b4('0x17'),auth[_0x03b4('0x9')](),interaction[_0x03b4('0x18')]('mail',_0x03b4('0x1a')),controller[_0x03b4('0x1b')]);router['delete'](_0x03b4('0x13'),auth[_0x03b4('0x9')](),controller[_0x03b4('0x1c')]);module[_0x03b4('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index d6c3b74..6c0f6ca 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 _0xec4d=['long','iconv','exports','BOOLEAN','DATE','STRING','TEXT','ENUM','out'];(function(_0xe27035,_0x1f4876){var _0x3745bc=function(_0xfa83f4){while(--_0xfa83f4){_0xe27035['push'](_0xe27035['shift']());}};_0x3745bc(++_0x1f4876);}(_0xec4d,0x1b1));var _0xdec4=function(_0x1ee62e,_0x159bb2){_0x1ee62e=_0x1ee62e-0x0;var _0x27c6c8=_0xec4d[_0x1ee62e];return _0x27c6c8;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xdec4('0x0'));module[_0xdec4('0x1')]={'closed':{'type':Sequelize[_0xdec4('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xdec4('0x3')]},'disposition':{'type':Sequelize[_0xdec4('0x4')]},'note':{'type':Sequelize[_0xdec4('0x4')]},'inReplyTo':{'type':Sequelize[_0xdec4('0x4')](0x1fe)},'to':{'type':Sequelize[_0xdec4('0x4')]},'cc':{'type':Sequelize[_0xdec4('0x5')]('long')},'subject':{'type':Sequelize[_0xdec4('0x5')]()},'attach':{'type':Sequelize[_0xdec4('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xdec4('0x3')]},'substatus':{'type':Sequelize[_0xdec4('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xdec4('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xdec4('0x6')]('in',_0xdec4('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xdec4('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xdec4('0x5')](_0xdec4('0x8'))},'lastMsgText':{'type':Sequelize[_0xdec4('0x5')]('long')}}; \ No newline at end of file +var _0xcf71=['iconv','exports','BOOLEAN','DATE','STRING','long','TEXT','ENUM','out'];(function(_0x405385,_0x56f573){var _0x43837b=function(_0x30e20e){while(--_0x30e20e){_0x405385['push'](_0x405385['shift']());}};_0x43837b(++_0x56f573);}(_0xcf71,0xf3));var _0x1cf7=function(_0x50ee83,_0x106751){_0x50ee83=_0x50ee83-0x0;var _0x3099ea=_0xcf71[_0x50ee83];return _0x3099ea;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x1cf7('0x0'));module[_0x1cf7('0x1')]={'closed':{'type':Sequelize[_0x1cf7('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1cf7('0x3')]},'disposition':{'type':Sequelize[_0x1cf7('0x4')]},'note':{'type':Sequelize[_0x1cf7('0x4')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x1cf7('0x4')]},'cc':{'type':Sequelize['TEXT'](_0x1cf7('0x5'))},'subject':{'type':Sequelize[_0x1cf7('0x6')]()},'attach':{'type':Sequelize[_0x1cf7('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x1cf7('0x3')]},'substatus':{'type':Sequelize[_0x1cf7('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x1cf7('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x1cf7('0x7')]('in',_0x1cf7('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1cf7('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x1cf7('0x7')]('in',_0x1cf7('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x1cf7('0x6')](_0x1cf7('0x5'))},'lastMsgText':{'type':Sequelize[_0x1cf7('0x6')]('long')}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 61240b3..9710036 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(_0x23cd6a,_0x26865e){var _0x130acc=function(_0x4086b0){while(--_0x4086b0){_0x23cd6a['push'](_0x23cd6a['shift']());}};_0x130acc(++_0x26865e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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(_0x5b01ed,_0x2e98e2){var _0x54f725=function(_0x1266fd){while(--_0x1266fd){_0x5b01ed['push'](_0x5b01ed['shift']());}};_0x54f725(++_0x2e98e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 8c21bda..b64f23b 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 _0xbeb7=['../../mysqldb','MailInteraction','setMaxListeners','remove','getUsers','then','setDataValue','findAll','length','emit','hasOwnProperty','exports','events'];(function(_0x6f76f5,_0x29737e){var _0x4b11e6=function(_0xcf4cb9){while(--_0xcf4cb9){_0x6f76f5['push'](_0x6f76f5['shift']());}};_0x4b11e6(++_0x29737e);}(_0xbeb7,0xe9));var _0x7beb=function(_0x210cc8,_0x35d2f2){_0x210cc8=_0x210cc8-0x0;var _0x1df38b=_0xbeb7[_0x210cc8];return _0x1df38b;};'use strict';var EventEmitter=require(_0x7beb('0x0'));var MailInteraction=require(_0x7beb('0x1'))['db'][_0x7beb('0x2')];var MailMessage=require(_0x7beb('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x7beb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7beb('0x4')};function emitEvent(_0x1912e1){return function(_0x2731fe,_0x4f253e,_0x1ee560){_0x2731fe[_0x7beb('0x5')]({'attributes':['id'],'raw':!![]})[_0x7beb('0x6')](function(_0x7066d){_0x2731fe[_0x7beb('0x7')]('Users',_0x7066d['map'](function(_0x1d3d8b){return{'id':_0x1d3d8b['id']};}));return MailMessage[_0x7beb('0x8')]({'where':{'MailInteractionId':_0x2731fe['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5d8956){_0x2731fe[_0x7beb('0x7')]('unreadMessages',_0x5d8956[_0x7beb('0x9')]);MailInteractionEvents['emit'](_0x1912e1+':'+_0x2731fe['id'],_0x2731fe);MailInteractionEvents[_0x7beb('0xa')](_0x1912e1,_0x2731fe);_0x1ee560(null);})['catch'](_0x1ee560(null));};}for(var e in events){if(events[_0x7beb('0xb')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x7beb('0xc')]=MailInteractionEvents; \ No newline at end of file +var _0x0928=['update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hook','exports','events','MailInteraction','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x2b2c2d,_0x7a0f38){var _0xf79f46=function(_0x519c50){while(--_0x519c50){_0x2b2c2d['push'](_0x2b2c2d['shift']());}};_0xf79f46(++_0x7a0f38);}(_0x0928,0x1e1));var _0x8092=function(_0xfe78e,_0x4f2182){_0xfe78e=_0xfe78e-0x0;var _0x58bc50=_0x0928[_0xfe78e];return _0x58bc50;};'use strict';var EventEmitter=require(_0x8092('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x8092('0x1')];var MailMessage=require(_0x8092('0x2'))['db'][_0x8092('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x8092('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8092('0x5'),'afterDestroy':_0x8092('0x6')};function emitEvent(_0x42fa07){return function(_0x4a85b3,_0x118c67,_0x11a97d){_0x4a85b3[_0x8092('0x7')]({'attributes':['id'],'raw':!![]})[_0x8092('0x8')](function(_0x4e7cb5){_0x4a85b3[_0x8092('0x9')](_0x8092('0xa'),_0x4e7cb5[_0x8092('0xb')](function(_0x2ee43e){return{'id':_0x2ee43e['id']};}));return MailMessage[_0x8092('0xc')]({'where':{'MailInteractionId':_0x4a85b3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8092('0x8')](function(_0x87c559){_0x4a85b3[_0x8092('0x9')]('unreadMessages',_0x87c559[_0x8092('0xd')]);MailInteractionEvents['emit'](_0x42fa07+':'+_0x4a85b3['id'],_0x4a85b3);MailInteractionEvents[_0x8092('0xe')](_0x42fa07,_0x4a85b3);_0x11a97d(null);})[_0x8092('0xf')](_0x11a97d(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x8092('0x10')](e,emitEvent(event));}}module[_0x8092('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 75960d1..e14efd7 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(_0x17c776,_0x1b0432){var _0x5511c2=function(_0x4bb4ac){while(--_0x4bb4ac){_0x17c776['push'](_0x17c776['shift']());}};_0x5511c2(++_0x1b0432);}(_0x55ca,0x126));var _0xa55c=function(_0x929c7e,_0x38c4cc){_0x929c7e=_0x929c7e-0x0;var _0x5de099=_0x55ca[_0x929c7e];return _0x5de099;};'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 _0xedd9=['subject','FULLTEXT','substatusAt','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','substatus','get','update','catch','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','MailInteraction','fti_mail_interactions'];(function(_0x37b5c2,_0x5f46d3){var _0x593cac=function(_0x59225f){while(--_0x59225f){_0x37b5c2['push'](_0x37b5c2['shift']());}};_0x593cac(++_0x5f46d3);}(_0xedd9,0xfc));var _0x9edd=function(_0x379816,_0xc6ee82){_0x379816=_0x379816-0x0;var _0xadec45=_0xedd9[_0x379816];return _0xadec45;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x9edd('0xb'),'fields':[_0x9edd('0xc'),'to'],'type':_0x9edd('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3280fd,_0x49d5e3,_0x494a24){if(_0x3280fd['substatus']){_0x3280fd[_0x9edd('0xe')]=moment()[_0x9edd('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3280fd[_0x9edd('0x10')]){_0x3280fd[_0x9edd('0x11')]=moment()['format'](_0x9edd('0x12'));}_0x494a24(null,_0x49d5e3);},'beforeUpdate':function(_0x1b73d1,_0x25e64c,_0xfd544a){if(_0x1b73d1[_0x9edd('0x13')](_0x9edd('0x14'))){_0x1b73d1[_0x9edd('0xe')]=_0x1b73d1[_0x9edd('0x14')]?moment()['format'](_0x9edd('0x12')):null;}if(_0x1b73d1[_0x9edd('0x13')](_0x9edd('0x10'))){_0x1b73d1[_0x9edd('0x11')]=moment()[_0x9edd('0xf')](_0x9edd('0x12'));_0x1b73d1[_0x9edd('0x14')]=null;_0x1b73d1[_0x9edd('0xe')]=null;}_0xfd544a(null,_0x1b73d1);},'afterUpdate':function(_0x4ea60f,_0x5f5bf4,_0x448996){var _0x449cee=_0x268f9e['models'];var _0x1b54c0=_0x4ea60f[_0x9edd('0x15')]({'plain':!![]});if(_0x1b54c0[_0x9edd('0x10')]){return _0x449cee['MailMessage'][_0x9edd('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x1b54c0['id']}})['then'](function(){_0x448996();})[_0x9edd('0x17')](function(_0x1083e4){_0x448996(_0x1083e4);});}else{_0x448996();}}},'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 8abbf2a..744727d 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 _0xf996=['../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','MailInteraction','options','where','attributes','limit','debug','AddTagsToMailInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x2c8543,_0x2c2b3e){var _0x516ba2=function(_0x251bbb){while(--_0x251bbb){_0x2c8543['push'](_0x2c8543['shift']());}};_0x516ba2(++_0x2c2b3e);}(_0xf996,0x74));var _0x6f99=function(_0xfb7fd4,_0xdf44ed){_0xfb7fd4=_0xfb7fd4-0x0;var _0x12b4c4=_0xf996[_0xfb7fd4];return _0x12b4c4;};'use strict';var _=require(_0x6f99('0x0'));var util=require(_0x6f99('0x1'));var moment=require(_0x6f99('0x2'));var BPromise=require('bluebird');var rs=require(_0x6f99('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6f99('0x4'));var logger=require(_0x6f99('0x5'))(_0x6f99('0x6'));var config=require(_0x6f99('0x7'));var jayson=require(_0x6f99('0x8'));var client=jayson[_0x6f99('0x9')][_0x6f99('0xa')]({'port':0x232a});config[_0x6f99('0xb')]=_[_0x6f99('0xc')](config[_0x6f99('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6f99('0xd'))(new Redis(config['redis']));require(_0x6f99('0xe'))[_0x6f99('0xf')](socket);function respondWithRpcPromise(_0x41f436,_0x161b64,_0xf42ba3){return new BPromise(function(_0x2edd9,_0x43b5c0){return client[_0x6f99('0x10')](_0x41f436,_0xf42ba3)[_0x6f99('0x11')](function(_0x509929){logger[_0x6f99('0x12')]('MailInteraction,\x20%s,\x20%s',_0x161b64,'request\x20sent');logger['debug'](_0x6f99('0x13'),_0x161b64,_0x6f99('0x14'),JSON[_0x6f99('0x15')](_0x509929));if(_0x509929[_0x6f99('0x16')]){if(_0x509929[_0x6f99('0x16')][_0x6f99('0x17')]===0x1f4){logger[_0x6f99('0x16')](_0x6f99('0x18'),_0x161b64,_0x509929[_0x6f99('0x16')][_0x6f99('0x19')]);return _0x43b5c0(_0x509929[_0x6f99('0x16')][_0x6f99('0x19')]);}logger['error'](_0x6f99('0x18'),_0x161b64,_0x509929[_0x6f99('0x16')]['message']);return _0x2edd9(_0x509929['error'][_0x6f99('0x19')]);}else{logger['info'](_0x6f99('0x18'),_0x161b64,_0x6f99('0x14'));_0x2edd9(_0x509929[_0x6f99('0x1a')][_0x6f99('0x19')]);}})[_0x6f99('0x1b')](function(_0x5bfb51){logger[_0x6f99('0x16')]('MailInteraction,\x20%s,\x20%s',_0x161b64,_0x5bfb51);_0x43b5c0(_0x5bfb51);});});}exports[_0x6f99('0x1c')]=function(_0x286edb){var _0x4cfa68=this;return new Promise(function(_0x26cd36,_0x1dc9e5){return db[_0x6f99('0x1d')]['update'](_0x286edb['body'],{'raw':_0x286edb[_0x6f99('0x1e')]?_0x286edb[_0x6f99('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x286edb['options']?_0x286edb[_0x6f99('0x1e')][_0x6f99('0x1f')]||null:null,'attributes':_0x286edb[_0x6f99('0x1e')]?_0x286edb[_0x6f99('0x1e')][_0x6f99('0x20')]||null:null,'limit':_0x286edb[_0x6f99('0x1e')]?_0x286edb[_0x6f99('0x1e')][_0x6f99('0x21')]||null:null})[_0x6f99('0x11')](function(_0x41a60b){logger[_0x6f99('0x12')](_0x6f99('0x1c'),_0x286edb);logger[_0x6f99('0x22')](_0x6f99('0x1c'),_0x286edb,JSON['stringify'](_0x41a60b));_0x26cd36(_0x41a60b);})[_0x6f99('0x1b')](function(_0x201070){logger['error']('UpdateMailInteraction',_0x201070[_0x6f99('0x19')],_0x286edb);_0x1dc9e5(_0x4cfa68[_0x6f99('0x16')](0x1f4,_0x201070['message']));});});};exports[_0x6f99('0x23')]=function(_0x3e56f5){return new Promise(function(_0x53ab0e,_0x45fe22){return db[_0x6f99('0x1d')]['find']({'where':_0x3e56f5[_0x6f99('0x1e')]?_0x3e56f5[_0x6f99('0x1e')][_0x6f99('0x1f')]||null:null})[_0x6f99('0x11')](function(_0x292a29){if(_0x292a29){return _0x292a29[_0x6f99('0x24')](_0x3e56f5['body'][_0x6f99('0x25')],_[_0x6f99('0x26')](_0x3e56f5['body'],['ids','id'])||{});}})[_0x6f99('0x27')](function(_0x33ab31){logger[_0x6f99('0x12')](_0x6f99('0x28'),_0x3e56f5);logger[_0x6f99('0x22')](_0x6f99('0x28'),_0x3e56f5,JSON['stringify'](_0x33ab31));_0x53ab0e(_0x33ab31);})['catch'](function(_0x269d9b){logger[_0x6f99('0x16')](_0x6f99('0x28'),_0x269d9b[_0x6f99('0x19')],_0x3e56f5);_0x45fe22(_this[_0x6f99('0x16')](0x1f4,_0x269d9b[_0x6f99('0x19')]));});});}; \ No newline at end of file +var _0xd382=['where','attributes','catch','AddTagsToMailInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','localhost','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateMailInteraction','body','options','raw'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xd382,0x1b6));var _0x2d38=function(_0xca92e1,_0x2c0165){_0xca92e1=_0xca92e1-0x0;var _0x1f8b8f=_0xd382[_0xca92e1];return _0x1f8b8f;};'use strict';var _=require(_0x2d38('0x0'));var util=require(_0x2d38('0x1'));var moment=require(_0x2d38('0x2'));var BPromise=require(_0x2d38('0x3'));var rs=require(_0x2d38('0x4'));var fs=require('fs');var Redis=require(_0x2d38('0x5'));var db=require(_0x2d38('0x6'))['db'];var utils=require(_0x2d38('0x7'));var logger=require(_0x2d38('0x8'))(_0x2d38('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2d38('0xa')]({'port':0x232a});config[_0x2d38('0xb')]=_['defaults'](config[_0x2d38('0xb')],{'host':_0x2d38('0xc'),'port':0x18eb});var socket=require(_0x2d38('0xd'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0x2d38('0xe')](socket);function respondWithRpcPromise(_0x25e9a7,_0x12a9bf,_0x495903){return new BPromise(function(_0x29a847,_0x59c2c3){return client[_0x2d38('0xf')](_0x25e9a7,_0x495903)[_0x2d38('0x10')](function(_0x35b37a){logger[_0x2d38('0x11')](_0x2d38('0x12'),_0x12a9bf,_0x2d38('0x13'));logger[_0x2d38('0x14')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x12a9bf,_0x2d38('0x13'),JSON[_0x2d38('0x15')](_0x35b37a));if(_0x35b37a[_0x2d38('0x16')]){if(_0x35b37a[_0x2d38('0x16')][_0x2d38('0x17')]===0x1f4){logger['error'](_0x2d38('0x12'),_0x12a9bf,_0x35b37a[_0x2d38('0x16')][_0x2d38('0x18')]);return _0x59c2c3(_0x35b37a[_0x2d38('0x16')][_0x2d38('0x18')]);}logger[_0x2d38('0x16')](_0x2d38('0x12'),_0x12a9bf,_0x35b37a[_0x2d38('0x16')][_0x2d38('0x18')]);return _0x29a847(_0x35b37a[_0x2d38('0x16')][_0x2d38('0x18')]);}else{logger[_0x2d38('0x11')](_0x2d38('0x12'),_0x12a9bf,_0x2d38('0x13'));_0x29a847(_0x35b37a[_0x2d38('0x19')][_0x2d38('0x18')]);}})['catch'](function(_0x1a7a8f){logger[_0x2d38('0x16')]('MailInteraction,\x20%s,\x20%s',_0x12a9bf,_0x1a7a8f);_0x59c2c3(_0x1a7a8f);});});}exports[_0x2d38('0x1a')]=function(_0x353874){var _0x246658=this;return new Promise(function(_0x4f519a,_0x46f8be){return db['MailInteraction']['update'](_0x353874[_0x2d38('0x1b')],{'raw':_0x353874[_0x2d38('0x1c')]?_0x353874[_0x2d38('0x1c')][_0x2d38('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x353874[_0x2d38('0x1c')]?_0x353874[_0x2d38('0x1c')][_0x2d38('0x1e')]||null:null,'attributes':_0x353874[_0x2d38('0x1c')]?_0x353874[_0x2d38('0x1c')][_0x2d38('0x1f')]||null:null,'limit':_0x353874['options']?_0x353874[_0x2d38('0x1c')]['limit']||null:null})[_0x2d38('0x10')](function(_0x530fd9){logger[_0x2d38('0x11')](_0x2d38('0x1a'),_0x353874);logger[_0x2d38('0x14')](_0x2d38('0x1a'),_0x353874,JSON[_0x2d38('0x15')](_0x530fd9));_0x4f519a(_0x530fd9);})[_0x2d38('0x20')](function(_0x7ddf6e){logger['error'](_0x2d38('0x1a'),_0x7ddf6e[_0x2d38('0x18')],_0x353874);_0x46f8be(_0x246658[_0x2d38('0x16')](0x1f4,_0x7ddf6e[_0x2d38('0x18')]));});});};exports[_0x2d38('0x21')]=function(_0xe73710){return new Promise(function(_0x81299c,_0x3a6437){return db['MailInteraction']['find']({'where':_0xe73710['options']?_0xe73710[_0x2d38('0x1c')][_0x2d38('0x1e')]||null:null})[_0x2d38('0x10')](function(_0x5ad475){if(_0x5ad475){return _0x5ad475[_0x2d38('0x22')](_0xe73710['body'][_0x2d38('0x23')],_[_0x2d38('0x24')](_0xe73710[_0x2d38('0x1b')],['ids','id'])||{});}})[_0x2d38('0x25')](function(_0x1ce1d7){logger[_0x2d38('0x11')]('AddTags',_0xe73710);logger[_0x2d38('0x14')](_0x2d38('0x26'),_0xe73710,JSON[_0x2d38('0x15')](_0x1ce1d7));_0x81299c(_0x1ce1d7);})[_0x2d38('0x20')](function(_0x7b197e){logger[_0x2d38('0x16')]('AddTags',_0x7b197e[_0x2d38('0x18')],_0xe73710);_0x3a6437(_this[_0x2d38('0x16')](0x1f4,_0x7b197e[_0x2d38('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 21a1034..e8689ec 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 _0xe191=['removeListener','register','length','mailInteraction:','./mailInteraction.events','update'];(function(_0x2a354f,_0x477219){var _0x3dd213=function(_0x3dbabe){while(--_0x3dbabe){_0x2a354f['push'](_0x2a354f['shift']());}};_0x3dd213(++_0x477219);}(_0xe191,0x1ea));var _0x1e19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe191[_0x3dd15e];return _0x231fd0;};'use strict';var MailInteractionEvents=require(_0x1e19('0x0'));var events=['save','remove',_0x1e19('0x1')];function createListener(_0x2eec83,_0x496df7){return function(_0x5c2cb6){_0x496df7['emit'](_0x2eec83,_0x5c2cb6);};}function removeListener(_0x28c6b2,_0x58da9d){return function(){MailInteractionEvents[_0x1e19('0x2')](_0x28c6b2,_0x58da9d);};}exports[_0x1e19('0x3')]=function(_0x505a61){for(var _0x2c6786=0x0,_0x5c993a=events[_0x1e19('0x4')];_0x2c6786<_0x5c993a;_0x2c6786++){var _0x28d0e6=events[_0x2c6786];var _0x4202eb=createListener(_0x1e19('0x5')+_0x28d0e6,_0x505a61);MailInteractionEvents['on'](_0x28d0e6,_0x4202eb);}}; \ No newline at end of file +var _0x2dd8=['removeListener','register','mailInteraction:','./mailInteraction.events','save','update'];(function(_0x53ec91,_0x7eb7bb){var _0x36d102=function(_0x279d65){while(--_0x279d65){_0x53ec91['push'](_0x53ec91['shift']());}};_0x36d102(++_0x7eb7bb);}(_0x2dd8,0x153));var _0x82dd=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2dd8[_0x501510];return _0x1e6ee5;};'use strict';var MailInteractionEvents=require(_0x82dd('0x0'));var events=[_0x82dd('0x1'),'remove',_0x82dd('0x2')];function createListener(_0x363d59,_0x4e5838){return function(_0x328c5c){_0x4e5838['emit'](_0x363d59,_0x328c5c);};}function removeListener(_0x34196d,_0x1fae4c){return function(){MailInteractionEvents[_0x82dd('0x3')](_0x34196d,_0x1fae4c);};}exports[_0x82dd('0x4')]=function(_0x4fc76f){for(var _0x536a69=0x0,_0x3e8434=events['length'];_0x536a69<_0x3e8434;_0x536a69++){var _0x416df4=events[_0x536a69];var _0x55e12a=createListener(_0x82dd('0x5')+_0x416df4,_0x4fc76f);MailInteractionEvents['on'](_0x416df4,_0x55e12a);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 1d0a2d6..ab2467b 100644 --- a/server/api/mailMessage/index.js +++ b/server/api/mailMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['path','connect-timeout','express','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','index','describe','/:id','download','post','tracked','mailmessage:create','create','update','put','accept','/:id/reject','delete','destroy','multer'];(function(_0x511a8f,_0x17c1f3){var _0x3bc09f=function(_0x5dfa42){while(--_0x5dfa42){_0x511a8f['push'](_0x511a8f['shift']());}};_0x3bc09f(++_0x17c1f3);}(_0x3e74,0x175));var _0x43e7=function(_0x345baf,_0xee287a){_0x345baf=_0x345baf-0x0;var _0x4ecdaf=_0x3e74[_0x345baf];return _0x4ecdaf;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/describe',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['show']);router[_0x43e7('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth['isAuthenticated'](),interaction[_0x43e7('0xd')]('mail',_0x43e7('0xe')),controller[_0x43e7('0xf')]);router['put'](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x10')]);router[_0x43e7('0x11')]('/:id/accept',auth['isAuthenticated'](),controller[_0x43e7('0x12')]);router[_0x43e7('0x11')](_0x43e7('0x13'),auth['isAuthenticated'](),controller['reject']);router[_0x43e7('0x14')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x15')]);module['exports']=router; \ No newline at end of file +var _0xe14d=['index','describe','/:id','show','/:id/download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0xe14d,0x1ee));var _0xde14=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe14d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var path=require(_0xde14('0x2'));var timeout=require(_0xde14('0x3'));var express=require('express');var router=express[_0xde14('0x4')]();var auth=require(_0xde14('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xde14('0x6'));var controller=require(_0xde14('0x7'));router[_0xde14('0x8')]('/',auth[_0xde14('0x9')](),controller[_0xde14('0xa')]);router[_0xde14('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xde14('0xb')]);router[_0xde14('0x8')](_0xde14('0xc'),auth[_0xde14('0x9')](),controller[_0xde14('0xd')]);router[_0xde14('0x8')](_0xde14('0xe'),auth[_0xde14('0x9')](),controller['download']);router[_0xde14('0xf')]('/',auth[_0xde14('0x9')](),interaction[_0xde14('0x10')](_0xde14('0x11'),_0xde14('0x12')),controller[_0xde14('0x13')]);router[_0xde14('0x14')](_0xde14('0xc'),auth[_0xde14('0x9')](),controller[_0xde14('0x15')]);router[_0xde14('0x14')](_0xde14('0x16'),auth[_0xde14('0x9')](),controller[_0xde14('0x17')]);router[_0xde14('0x14')]('/:id/reject',auth['isAuthenticated'](),controller[_0xde14('0x18')]);router[_0xde14('0x19')](_0xde14('0xc'),auth['isAuthenticated'](),controller[_0xde14('0x1a')]);module[_0xde14('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 4001975..5f2d192 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 _0x056b=['BOOLEAN','ENUM','out','STRING','INTEGER','DATE','lodash','exports','TEXT','long','medium'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x056b,0xb6));var _0xb056=function(_0x5e07a7,_0x1438b3){_0x5e07a7=_0x5e07a7-0x0;var _0x22ced5=_0x056b[_0x5e07a7];return _0x22ced5;};'use strict';var Sequelize=require('sequelize');var _=require(_0xb056('0x0'));module[_0xb056('0x1')]={'body':{'type':Sequelize[_0xb056('0x2')](_0xb056('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xb056('0x2')](_0xb056('0x4'))},'read':{'type':Sequelize[_0xb056('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb056('0x6')]('in',_0xb056('0x7')),'defaultValue':_0xb056('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb056('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xb056('0x2')](_0xb056('0x3'))},'cc':{'type':Sequelize[_0xb056('0x2')](_0xb056('0x3'))},'bcc':{'type':Sequelize[_0xb056('0x2')](_0xb056('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xb056('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xb056('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xb056('0xa')]},'originTo':{'type':Sequelize[_0xb056('0x2')]('long')},'originCc':{'type':Sequelize[_0xb056('0x2')]('long')}}; \ No newline at end of file +var _0xb6a6=['medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','lodash','long','TEXT'];(function(_0x35f56b,_0x52d62f){var _0x3695ad=function(_0x5da648){while(--_0x5da648){_0x35f56b['push'](_0x35f56b['shift']());}};_0x3695ad(++_0x52d62f);}(_0xb6a6,0x1a0));var _0x6b6a=function(_0x3d8c25,_0x2bdcea){_0x3d8c25=_0x3d8c25-0x0;var _0xfd0121=_0xb6a6[_0x3d8c25];return _0xfd0121;};'use strict';var Sequelize=require(_0x6b6a('0x0'));var _=require(_0x6b6a('0x1'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x6b6a('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x6b6a('0x3')](_0x6b6a('0x4'))},'read':{'type':Sequelize[_0x6b6a('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6b6a('0x6')]('in','out'),'defaultValue':_0x6b6a('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x6b6a('0x8')](0x1fe)},'from':{'type':Sequelize[_0x6b6a('0x8')]},'to':{'type':Sequelize['TEXT'](_0x6b6a('0x2'))},'cc':{'type':Sequelize[_0x6b6a('0x3')]('long')},'bcc':{'type':Sequelize[_0x6b6a('0x3')](_0x6b6a('0x2'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x6b6a('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x6b6a('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x6b6a('0x9')]},'originTo':{'type':Sequelize[_0x6b6a('0x3')]('long')},'originCc':{'type':Sequelize['TEXT'](_0x6b6a('0x2'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 74d80bd..7eda513 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 _0x40c2=['rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','MailMessage','includeAll','include','show','params','keys','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','isNil','Smtp','service','host','secure','authentication','auth','user','pass','attachments','join','root','server/files/attachments','basename','ListId','sendMail','messageId','format','stringify','mail-interactions','YYYY-MM-DD\x20HH:mm:ss','Contact','get','MailInteraction','MailInteractionId','read1stAt','role','interaction','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','mail','UserId','agent','RejectMessage','download','unix','toString','server','files','message-%s.eml','from','createdAt','Attachment','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Attachments','existsSync','push','type','writeFileSync','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','defaults','socket.io-emitter','redis','./mailMessage.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','MailMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send'];(function(_0x431480,_0x40c7a7){var _0x139af7=function(_0x58eb96){while(--_0x58eb96){_0x431480['push'](_0x431480['shift']());}};_0x139af7(++_0x40c7a7);}(_0x40c2,0x10d));var _0x240c=function(_0x37b533,_0x52b69c){_0x37b533=_0x37b533-0x0;var _0x25e7bd=_0x40c2[_0x37b533];return _0x25e7bd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x240c('0x0'));var rimraf=require(_0x240c('0x1'));var zipdir=require(_0x240c('0x2'));var jsonpatch=require(_0x240c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x240c('0x4'));var Mustache=require(_0x240c('0x5'));var util=require(_0x240c('0x6'));var path=require(_0x240c('0x7'));var sox=require(_0x240c('0x8'));var csv=require(_0x240c('0x9'));var ejs=require(_0x240c('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x240c('0xb'));var crypto=require(_0x240c('0xc'));var jsforce=require(_0x240c('0xd'));var deskjs=require(_0x240c('0xe'));var toCsv=require(_0x240c('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x240c('0xf'));var authService=require(_0x240c('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x240c('0x11'))(_0x240c('0x12'));var utils=require(_0x240c('0x13'));var config=require(_0x240c('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x240c('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x240c('0x16'))(new Redis(config[_0x240c('0x17')]));require(_0x240c('0x18'))[_0x240c('0x19')](socket);var jayson=require(_0x240c('0x1a'));var client=jayson[_0x240c('0x1b')]['http']({'port':0x232c});var client9003=jayson[_0x240c('0x1b')][_0x240c('0x1c')]({'port':0x232b});var client9002=jayson[_0x240c('0x1b')][_0x240c('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x376f4b,_0x11676f,_0x5c41bc){if(_0x5c41bc){var _0x3d2251=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3d2251[_0x240c('0x1d')](_0x11676f)){return _0x376f4b;}else{throw new db[(_0x240c('0x1e'))][(_0x240c('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 _0x376f4b;}}function respondWithRpcPromise(_0x354656,_0x592812,_0x1a3212,_0xfc1115){return new BPromise(function(_0x1241af,_0x279fbd){var _0x2b2626=_0xfc1115||client;return _0x2b2626[_0x240c('0x20')](_0x354656,_0x1a3212)[_0x240c('0x21')](function(_0x5e123e){logger[_0x240c('0x22')]('MailMessage,\x20%s,\x20%s',_0x592812,'request\x20sent');logger[_0x240c('0x23')](_0x240c('0x24'),_0x592812,_0x240c('0x25'),JSON['stringify'](_0x5e123e));if(_0x5e123e['error']){if(_0x5e123e['error'][_0x240c('0x26')]===0x1f4){logger[_0x240c('0x27')](_0x240c('0x28'),_0x592812,_0x5e123e[_0x240c('0x27')][_0x240c('0x29')]);return _0x279fbd(_0x5e123e[_0x240c('0x27')][_0x240c('0x29')]);}logger[_0x240c('0x27')](_0x240c('0x28'),_0x592812,_0x5e123e[_0x240c('0x27')][_0x240c('0x29')]);return _0x1241af(_0x5e123e[_0x240c('0x27')][_0x240c('0x29')]);}else{logger['info'](_0x240c('0x28'),_0x592812,'request\x20sent');_0x1241af(_0x5e123e[_0x240c('0x2a')][_0x240c('0x29')]);}})[_0x240c('0x2b')](function(_0x3da2e4){logger[_0x240c('0x27')](_0x240c('0x28'),_0x592812,_0x3da2e4);_0x279fbd(_0x3da2e4);});});}function respondWithStatusCode(_0x5b7c15,_0x3dc6cc){_0x3dc6cc=_0x3dc6cc||0xcc;return function(_0x4c5df8){if(_0x4c5df8){return _0x5b7c15[_0x240c('0x2c')](_0x3dc6cc);}return _0x5b7c15[_0x240c('0x2d')](_0x3dc6cc)[_0x240c('0x2e')]();};}function respondWithResult(_0x81625a,_0x1d38c0){_0x1d38c0=_0x1d38c0||0xc8;return function(_0x4559bb){if(_0x4559bb){return _0x81625a[_0x240c('0x2d')](_0x1d38c0)['json'](_0x4559bb);}};}function respondWithFilteredResult(_0x2017d0,_0x28a49b){return function(_0x569815){if(_0x569815){var _0x17a562=_0x569815[_0x240c('0x2f')],_0x25f181=_0x28a49b['offset'],_0x8f7420=_0x28a49b[_0x240c('0x30')]+_0x28a49b[_0x240c('0x31')],_0x115288;if(_0x8f7420>=_0x17a562){_0x8f7420=_0x17a562;_0x115288=0xc8;}else{_0x115288=0xce;}_0x2017d0['status'](_0x115288);return _0x2017d0[_0x240c('0x32')](_0x240c('0x33'),_0x25f181+'-'+_0x8f7420+'/'+_0x17a562)[_0x240c('0x34')](_0x569815);}return null;};}function patchUpdates(_0x5549f3){return function(_0x401349){try{jsonpatch[_0x240c('0x35')](_0x401349,_0x5549f3,!![]);}catch(_0x4c3d45){return BPromise[_0x240c('0x36')](_0x4c3d45);}return _0x401349[_0x240c('0x37')]();};}function saveUpdates(_0x110808,_0x54ba1d){return function(_0x42c95e){if(_0x42c95e){return _0x42c95e[_0x240c('0x38')](_0x110808)[_0x240c('0x21')](function(_0x4c1849){return _0x4c1849;});}return null;};}function removeEntity(_0x4d2ff1,_0x23dde8){return function(_0x3a04b7){if(_0x3a04b7){return _0x3a04b7[_0x240c('0x39')]()[_0x240c('0x21')](function(){_0x4d2ff1[_0x240c('0x2d')](0xcc)[_0x240c('0x2e')]();});}};}function handleEntityNotFound(_0x123e10,_0x2ffe7c){return function(_0x42983e){if(!_0x42983e){_0x123e10['sendStatus'](0x194);}return _0x42983e;};}function handleError(_0x19714f,_0x4ac22e){_0x4ac22e=_0x4ac22e||0x1f4;return function(_0xdaa7e4){logger[_0x240c('0x27')](_0xdaa7e4[_0x240c('0x3a')]);if(_0xdaa7e4[_0x240c('0x3b')]){delete _0xdaa7e4[_0x240c('0x3b')];}_0x19714f[_0x240c('0x2d')](_0x4ac22e)[_0x240c('0x3c')](_0xdaa7e4);};}exports['index']=function(_0x41aee3,_0x1c1212){var _0x276d80={},_0x45d8d9={},_0x499edc={'count':0x0,'rows':[]};var _0x21c3d3=_['map'](db['MailMessage'][_0x240c('0x3d')],function(_0x58e6fd){return{'name':_0x58e6fd[_0x240c('0x3e')],'type':_0x58e6fd['type'][_0x240c('0x3f')]};});_0x45d8d9[_0x240c('0x40')]=_['map'](_0x21c3d3,_0x240c('0x3b'));_0x45d8d9[_0x240c('0x41')]=_['keys'](_0x41aee3[_0x240c('0x41')]);_0x45d8d9[_0x240c('0x42')]=_['intersection'](_0x45d8d9[_0x240c('0x40')],_0x45d8d9[_0x240c('0x41')]);_0x276d80['attributes']=_[_0x240c('0x43')](_0x45d8d9[_0x240c('0x40')],qs['fields'](_0x41aee3[_0x240c('0x41')][_0x240c('0x44')]));_0x276d80['attributes']=_0x276d80[_0x240c('0x45')][_0x240c('0x46')]?_0x276d80[_0x240c('0x45')]:_0x45d8d9[_0x240c('0x40')];if(!_0x41aee3[_0x240c('0x41')][_0x240c('0x47')]('nolimit')){_0x276d80['limit']=qs[_0x240c('0x31')](_0x41aee3[_0x240c('0x41')][_0x240c('0x31')]);_0x276d80[_0x240c('0x30')]=qs[_0x240c('0x30')](_0x41aee3[_0x240c('0x41')][_0x240c('0x30')]);}_0x276d80[_0x240c('0x48')]=qs[_0x240c('0x49')](_0x41aee3[_0x240c('0x41')][_0x240c('0x49')]);_0x276d80['where']=qs[_0x240c('0x42')](_[_0x240c('0x4a')](_0x41aee3[_0x240c('0x41')],_0x45d8d9[_0x240c('0x42')]),_0x21c3d3);if(_0x41aee3[_0x240c('0x41')][_0x240c('0x4b')]){_0x276d80[_0x240c('0x4c')]=_[_0x240c('0x4d')](_0x276d80[_0x240c('0x4c')],{'$or':_[_0x240c('0x4e')](_0x21c3d3,function(_0xc3e49){if(_0xc3e49['type']!==_0x240c('0x4f')){var _0x5a35b2={};_0x5a35b2[_0xc3e49[_0x240c('0x3b')]]={'$like':'%'+_0x41aee3[_0x240c('0x41')][_0x240c('0x4b')]+'%'};return _0x5a35b2;}})});}_0x276d80=_[_0x240c('0x4d')]({},_0x276d80,_0x41aee3[_0x240c('0x50')]);var _0x248c5e={'where':_0x276d80[_0x240c('0x4c')]};return db[_0x240c('0x51')]['count'](_0x248c5e)['then'](function(_0x35cc63){_0x499edc['count']=_0x35cc63;if(_0x41aee3[_0x240c('0x41')][_0x240c('0x52')]){_0x276d80[_0x240c('0x53')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x276d80);})[_0x240c('0x21')](function(_0x5a5361){_0x499edc['rows']=_0x5a5361;return _0x499edc;})[_0x240c('0x21')](respondWithFilteredResult(_0x1c1212,_0x276d80))[_0x240c('0x2b')](handleError(_0x1c1212,null));};exports[_0x240c('0x54')]=function(_0x54670c,_0xf32730){var _0x2d670d={'raw':!![],'where':{'id':_0x54670c[_0x240c('0x55')]['id']}},_0x1a08ec={};_0x1a08ec[_0x240c('0x40')]=_['keys'](db[_0x240c('0x51')][_0x240c('0x3d')]);_0x1a08ec['query']=_[_0x240c('0x56')](_0x54670c[_0x240c('0x41')]);_0x1a08ec[_0x240c('0x42')]=_[_0x240c('0x43')](_0x1a08ec[_0x240c('0x40')],_0x1a08ec[_0x240c('0x41')]);_0x2d670d[_0x240c('0x45')]=_[_0x240c('0x43')](_0x1a08ec['model'],qs[_0x240c('0x44')](_0x54670c[_0x240c('0x41')][_0x240c('0x44')]));_0x2d670d[_0x240c('0x45')]=_0x2d670d[_0x240c('0x45')][_0x240c('0x46')]?_0x2d670d['attributes']:_0x1a08ec['model'];if(_0x54670c[_0x240c('0x41')][_0x240c('0x52')]){_0x2d670d['include']=[{'all':!![]}];}_0x2d670d=_[_0x240c('0x4d')]({},_0x2d670d,_0x54670c['options']);return db['MailMessage']['find'](_0x2d670d)[_0x240c('0x21')](handleEntityNotFound(_0xf32730,null))[_0x240c('0x21')](respondWithResult(_0xf32730,null))['catch'](handleError(_0xf32730,null));};exports[_0x240c('0x38')]=function(_0xe3b3b8,_0x1491db){if(_0xe3b3b8['body']['id']){delete _0xe3b3b8['body']['id'];}return db[_0x240c('0x51')][_0x240c('0x57')]({'where':{'id':_0xe3b3b8['params']['id']}})[_0x240c('0x21')](handleEntityNotFound(_0x1491db,null))['then'](saveUpdates(_0xe3b3b8[_0x240c('0x58')],null))[_0x240c('0x21')](respondWithResult(_0x1491db,null))['catch'](handleError(_0x1491db,null));};exports[_0x240c('0x39')]=function(_0x4e7ad2,_0x1fc698){return db['MailMessage'][_0x240c('0x57')]({'where':{'id':_0x4e7ad2[_0x240c('0x55')]['id']}})[_0x240c('0x21')](handleEntityNotFound(_0x1fc698,null))[_0x240c('0x21')](removeEntity(_0x1fc698,null))[_0x240c('0x2b')](handleError(_0x1fc698,null));};exports['describe']=function(_0x580847,_0x4d9791){return db[_0x240c('0x51')][_0x240c('0x59')]()[_0x240c('0x21')](respondWithResult(_0x4d9791,null))[_0x240c('0x2b')](handleError(_0x4d9791,null));};exports['create']=function(_0x50b902,_0x2ef007){return db[_0x240c('0x51')][_0x240c('0x5a')](_0x50b902['body'])[_0x240c('0x21')](function(_0x1c5f2f){if(_0x1c5f2f){if(_0x1c5f2f[_0x240c('0x5b')]===_0x240c('0x5c')&&!_0x1c5f2f[_0x240c('0x5d')]){var _0x84552,_0x7b0d8,_0xc7d436;if(_0x50b902[_0x240c('0x58')]['to']){_0x7b0d8=_0x50b902[_0x240c('0x58')]['to'][_0x240c('0x5e')](',')[0x0];}return db[_0x240c('0x5f')][_0x240c('0x60')]({'where':{'id':_0x1c5f2f[_0x240c('0x61')]},'include':[{'model':db[_0x240c('0x62')],'as':_0x240c('0x63'),'include':[{'model':db[_0x240c('0x64')],'as':_0x240c('0x65'),'where':{'email':_0x7b0d8},'limit':0x1,'order':[[_0x240c('0x66'),_0x240c('0x67')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x240c('0x21')](function(_0x1194a5){_0x84552=_0x1194a5;if(_0x84552&&_0x84552['Smtp']){var _0x2baf3a={'tls':{'rejectUnauthorized':![]}};if(_[_0x240c('0x68')](_0x84552[_0x240c('0x69')][_0x240c('0x6a')])){_0x2baf3a['host']=_0x84552[_0x240c('0x69')][_0x240c('0x6b')];_0x2baf3a['port']=_0x84552[_0x240c('0x69')]['port'];_0x2baf3a[_0x240c('0x6c')]=_0x84552[_0x240c('0x69')][_0x240c('0x6c')];if(_0x84552[_0x240c('0x69')][_0x240c('0x6d')]){_0x2baf3a[_0x240c('0x6e')]={'user':_0x84552[_0x240c('0x69')][_0x240c('0x6f')],'pass':_0x84552[_0x240c('0x69')][_0x240c('0x70')]};}}else{_0x2baf3a[_0x240c('0x6a')]=_0x84552[_0x240c('0x69')][_0x240c('0x6a')];_0x2baf3a[_0x240c('0x6e')]={'user':_0x84552['Smtp'][_0x240c('0x6f')],'pass':_0x84552['Smtp'][_0x240c('0x70')]};_0x2baf3a[_0x240c('0x6c')]=_0x84552['Smtp'][_0x240c('0x6c')];}if(_0x50b902['body'][_0x240c('0x71')]&&_0x50b902[_0x240c('0x58')][_0x240c('0x71')]['length']){for(var _0x493038=0x0;_0x493038<_0x50b902[_0x240c('0x58')][_0x240c('0x71')][_0x240c('0x46')];_0x493038+=0x1){_0x50b902[_0x240c('0x58')]['attachments'][_0x493038]={'filename':_0x50b902[_0x240c('0x58')][_0x240c('0x71')][_0x493038][_0x240c('0x3b')],'path':path[_0x240c('0x72')](config[_0x240c('0x73')],_0x240c('0x74'),_0x50b902[_0x240c('0x58')][_0x240c('0x71')][_0x493038][_0x240c('0x75')])};}}_0xc7d436={'account':_0x2baf3a,'message':_0x50b902['body']};return;}})[_0x240c('0x21')](function(){if(_0x84552[_0x240c('0x63')]){if(_0x84552[_0x240c('0x63')][_0x240c('0x65')]['length']){return _0x84552[_0x240c('0x63')][_0x240c('0x65')][0x0];}else{return db['CmContact']['create'](_[_0x240c('0x15')](_0x50b902['body'],{'firstName':_0x50b902['body']['to'],'email':_0x50b902[_0x240c('0x58')]['to'],'phone':_0x50b902[_0x240c('0x58')]['to'],'ListId':_0x84552[_0x240c('0x76')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x240c('0x21')](function(){if(_0xc7d436){return respondWithRpcPromise('SendMail',_0x240c('0x77'),_0xc7d436,client9003)[_0x240c('0x21')](function(_0x5e8021){return _0x1c5f2f[_0x240c('0x38')]({'read':!![],'messageId':_0x5e8021[_0x240c('0x78')],'sentAt':moment()[_0x240c('0x79')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x240c('0x2b')](function(_0x523cca){logger[_0x240c('0x27')]('%s',JSON[_0x240c('0x7a')](_0x523cca));return _0x1c5f2f;});}return _0x1c5f2f;});}return _0x1c5f2f;}})[_0x240c('0x21')](respondWithResult(_0x2ef007,0xc9))[_0x240c('0x2b')](handleError(_0x2ef007,null));};var interaction_log=require(_0x240c('0x11'))(_0x240c('0x7b'));exports['accept']=function(_0x3cd519,_0x2b21c7,_0x5d3947){var _0x368c82={'channel':'mail'};if(_0x3cd519[_0x240c('0x58')]['id']){delete _0x3cd519[_0x240c('0x58')]['id'];}_0x3cd519[_0x240c('0x58')]['read']=!![];_0x3cd519[_0x240c('0x58')]['readAt']=moment()[_0x240c('0x79')](_0x240c('0x7c'));_0x3cd519[_0x240c('0x58')]['UserId']=_0x3cd519['body']['UserId']||_0x3cd519['user']['id'];return db[_0x240c('0x51')][_0x240c('0x57')]({'where':{'id':_0x3cd519['params']['id'],'UserId':null},'include':[{'model':db[_0x240c('0x64')],'as':_0x240c('0x7d')}]})[_0x240c('0x21')](handleEntityNotFound(_0x2b21c7,null))['then'](saveUpdates(_0x3cd519[_0x240c('0x58')],null))[_0x240c('0x21')](function(_0x46c0d4){if(_0x46c0d4){_0x368c82[_0x240c('0x29')]=_0x46c0d4[_0x240c('0x7e')]({'plain':!![]});return db[_0x240c('0x7f')][_0x240c('0x57')]({'where':{'id':_0x46c0d4[_0x240c('0x80')]}});}return null;})[_0x240c('0x21')](handleEntityNotFound(_0x2b21c7,null))[_0x240c('0x21')](function(_0x38b374){if(_0x38b374){return _0x38b374[_0x240c('0x38')]({'UserId':_0x3cd519[_0x240c('0x58')]['UserId'],'read1stAt':_[_0x240c('0x68')](_0x38b374[_0x240c('0x81')])?moment()[_0x240c('0x79')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x4e51ea){if(_0x4e51ea){_0x368c82['interaction']=_0x4e51ea[_0x240c('0x7e')]({'plain':!![]});interaction_log[_0x240c('0x22')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3cd519[_0x240c('0x6f')]['id'],_0x3cd519[_0x240c('0x6f')][_0x240c('0x3b')],_0x3cd519[_0x240c('0x6f')][_0x240c('0x82')],_0x368c82[_0x240c('0x83')]['id'],_0x3cd519['body']?JSON['stringify'](_0x3cd519['body']):'null');return respondWithRpcPromise(_0x240c('0x84'),_0x240c('0x85'),_0x368c82);}return null;})['then'](function(_0x2815a0){if(_0x2815a0){if(_0x3cd519[_0x240c('0x58')][_0x240c('0x86')]){_0x368c82[_0x240c('0x29')][_0x240c('0x87')]=util[_0x240c('0x79')](_0x240c('0x88'),_0x3cd519[_0x240c('0x6f')][_0x240c('0x3b')]);_0x368c82[_0x240c('0x29')][_0x240c('0x89')]=_0x368c82[_0x240c('0x89')];_0x368c82[_0x240c('0x29')][_0x240c('0x8a')]='accept';return respondWithRpcPromise('EventManager',_0x240c('0x8b'),{'event':_0x240c('0x8c'),'message':_0x368c82['message']},client9002)[_0x240c('0x21')](function(){return _0x368c82;});}return _0x368c82;}return null;})[_0x240c('0x21')](respondWithResult(_0x2b21c7,null))[_0x240c('0x2b')](handleError(_0x2b21c7,null));};var interaction_log=require(_0x240c('0x11'))(_0x240c('0x7b'));exports[_0x240c('0x36')]=function(_0x21d9c5,_0x356381,_0x2095c7){var _0x83830e={'agent':{},'channel':_0x240c('0x8d')};if(_0x21d9c5[_0x240c('0x58')]['id']){delete _0x21d9c5[_0x240c('0x58')]['id'];}_0x21d9c5[_0x240c('0x58')]['UserId']=_0x21d9c5[_0x240c('0x58')][_0x240c('0x8e')]||_0x21d9c5[_0x240c('0x6f')]['id'];_0x83830e[_0x240c('0x8f')]['id']=_0x21d9c5['body'][_0x240c('0x8e')];return db[_0x240c('0x51')]['find']({'where':{'id':_0x21d9c5[_0x240c('0x55')]['id'],'UserId':null}})[_0x240c('0x21')](handleEntityNotFound(_0x356381,null))['then'](function(_0x41dedb){if(_0x41dedb){_0x83830e[_0x240c('0x29')]=_0x41dedb[_0x240c('0x7e')]({'plain':!![]});return db[_0x240c('0x7f')]['find']({'where':{'id':_0x41dedb[_0x240c('0x80')]}});}return null;})['then'](handleEntityNotFound(_0x356381,null))['then'](function(_0x3c2137){if(_0x3c2137){_0x83830e[_0x240c('0x83')]=_0x3c2137[_0x240c('0x7e')]({'plain':!![]});interaction_log[_0x240c('0x22')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x21d9c5['user']['id'],_0x21d9c5[_0x240c('0x6f')]['name'],_0x21d9c5['user'][_0x240c('0x82')],_0x83830e[_0x240c('0x83')]['id'],_0x21d9c5[_0x240c('0x58')]?JSON[_0x240c('0x7a')](_0x21d9c5[_0x240c('0x58')]):'null');return respondWithRpcPromise(_0x240c('0x90'),'rejectMessage',_0x83830e);}return null;})[_0x240c('0x21')](function(_0x2d552c){if(_0x2d552c){_0x2d552c[_0x240c('0x29')][_0x240c('0x87')]=util['format']('SIP/%s',_0x21d9c5[_0x240c('0x6f')]['name']);_0x2d552c[_0x240c('0x29')]['channel']=_0x83830e[_0x240c('0x89')];_0x2d552c[_0x240c('0x29')][_0x240c('0x8a')]=_0x240c('0x36');respondWithRpcPromise(_0x240c('0x8b'),_0x240c('0x8b'),{'event':'rejectmessage','message':_0x2d552c[_0x240c('0x29')]},client9002);return _0x83830e;}return null;})['then'](respondWithResult(_0x356381,null))[_0x240c('0x2b')](handleError(_0x356381,null));};exports[_0x240c('0x91')]=function(_0xba5cb1,_0xe4ced3){var _0x4baa2c=moment()[_0x240c('0x92')]()[_0x240c('0x93')]();var _0x376a4f=path[_0x240c('0x72')](config[_0x240c('0x73')],_0x240c('0x94'),_0x240c('0x95'),'tmp');var _0x322e97=path['join'](config[_0x240c('0x73')],_0x240c('0x94'),'files','attachments');var _0x13a058=util[_0x240c('0x79')](_0x240c('0x96'),_0x4baa2c);return db['MailMessage']['find']({'where':{'id':_0xba5cb1[_0x240c('0x55')]['id']},'attributes':['id','body',_0x240c('0x97'),'to','cc','bcc','subject',_0x240c('0x98')],'include':_0xba5cb1[_0x240c('0x41')]['attachments']?[{'model':db[_0x240c('0x99')],'as':'Attachments'}]:undefined})[_0x240c('0x21')](handleEntityNotFound(_0xe4ced3,null))[_0x240c('0x21')](function(_0x244b2b){if(_0x244b2b){var _0x5ed959=_0x244b2b;var _0x2d81cf={'from':_0x5ed959['from'],'to':_0x5ed959['to'],'subject':_0x5ed959[_0x240c('0x9a')],'html':_0x5ed959[_0x240c('0x58')],'headers':{'Date':moment(_0x5ed959[_0x240c('0x98')])[_0x240c('0x79')](_0x240c('0x9b'))},'attachments':[]};if(_0x244b2b['cc']){_0x2d81cf[_0x240c('0x9c')]['Cc']=_0x244b2b['cc'];}if(_0x244b2b[_0x240c('0x9d')]){_0x2d81cf[_0x240c('0x9c')]['Bcc']=_0x244b2b[_0x240c('0x9d')];}return new BPromise(function(_0xe04664,_0x4dd001){if(_0x244b2b['Attachments']){for(var _0x3f124d=0x0;_0x3f124d<_0x244b2b[_0x240c('0x9e')][_0x240c('0x46')];_0x3f124d++){var _0x3b2f61=_0x244b2b[_0x240c('0x9e')][_0x3f124d];var _0x58b751=path[_0x240c('0x72')](_0x322e97,_0x3b2f61[_0x240c('0x75')]);if(fs[_0x240c('0x9f')](_0x58b751)){_0x2d81cf[_0x240c('0x71')][_0x240c('0xa0')]({'name':_0x3b2f61[_0x240c('0x3b')],'contentType':_0x3b2f61[_0x240c('0xa1')],'data':fs['readFileSync'](_0x58b751)});}}}emlformat['build'](_0x2d81cf,function(_0x42b7fa,_0x25fee1){if(_0x42b7fa)return _0x4dd001(_0x42b7fa);fs[_0x240c('0xa2')](path['join'](_0x376a4f,_0x13a058),_0x25fee1);return _0xe04664(_0x25fee1);});});}})[_0x240c('0x21')](function(_0x721c93){if(_0x721c93){return _0xe4ced3[_0x240c('0x91')](path['join'](_0x376a4f,_0x13a058),_0x13a058,function(_0x21644f){if(_0x21644f){console[_0x240c('0xa3')]('err',_0x21644f);}else{fs[_0x240c('0xa4')](path[_0x240c('0x72')](_0x376a4f,_0x13a058));}});}})['catch'](handleError(_0xe4ced3,null));}; \ No newline at end of file +var _0xe14f=['DESC','Smtp','isNil','service','host','port','secure','authentication','auth','pass','attachments','root','server/files/attachments','basename','List','List\x20not\x20found','SendMail','sendMail','messageId','format','mail-interactions','accept','readAt','UserId','user','MailInteraction','MailInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','stringify','null','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','rejectmessage','download','unix','join','server','files','tmp','from','bcc','subject','createdAt','Attachment','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','existsSync','push','build','log','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','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','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','destroy','stack','name','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','keys','catch','body','find','describe','create','direction','split','MailAccount','findOne','CmContact','Contacts'];(function(_0x262cfa,_0x181548){var _0x42fcc9=function(_0x3977e0){while(--_0x3977e0){_0x262cfa['push'](_0x262cfa['shift']());}};_0x42fcc9(++_0x181548);}(_0xe14f,0xea));var _0xfe14=function(_0xb97d23,_0x4eb9e4){_0xb97d23=_0xb97d23-0x0;var _0x1c23af=_0xe14f[_0xb97d23];return _0x1c23af;};'use strict';var pdf=require(_0xfe14('0x0'));var emlformat=require(_0xfe14('0x1'));var rimraf=require(_0xfe14('0x2'));var zipdir=require(_0xfe14('0x3'));var jsonpatch=require(_0xfe14('0x4'));var rp=require(_0xfe14('0x5'));var moment=require(_0xfe14('0x6'));var BPromise=require(_0xfe14('0x7'));var Mustache=require(_0xfe14('0x8'));var util=require('util');var path=require('path');var sox=require(_0xfe14('0x9'));var csv=require('to-csv');var ejs=require(_0xfe14('0xa'));var fs=require('fs');var _=require(_0xfe14('0xb'));var squel=require(_0xfe14('0xc'));var crypto=require(_0xfe14('0xd'));var jsforce=require(_0xfe14('0xe'));var deskjs=require(_0xfe14('0xf'));var toCsv=require(_0xfe14('0x10'));var querystring=require(_0xfe14('0x11'));var Papa=require(_0xfe14('0x12'));var Redis=require('ioredis');var authService=require(_0xfe14('0x13'));var qs=require(_0xfe14('0x14'));var as=require(_0xfe14('0x15'));var hardwareService=require(_0xfe14('0x16'));var logger=require(_0xfe14('0x17'))(_0xfe14('0x18'));var utils=require('../../config/utils');var config=require(_0xfe14('0x19'));var db=require('../../mysqldb')['db'];config[_0xfe14('0x1a')]=_[_0xfe14('0x1b')](config[_0xfe14('0x1a')],{'host':_0xfe14('0x1c'),'port':0x18eb});var socket=require(_0xfe14('0x1d'))(new Redis(config[_0xfe14('0x1a')]));require('./mailMessage.socket')['register'](socket);var jayson=require(_0xfe14('0x1e'));var client=jayson[_0xfe14('0x1f')][_0xfe14('0x20')]({'port':0x232c});var client9003=jayson['client'][_0xfe14('0x20')]({'port':0x232b});var client9002=jayson['client'][_0xfe14('0x20')]({'port':0x232a});function checkPasswordPattern(_0x1cdd4b,_0x9e74b,_0x3ce60b){if(_0x3ce60b){var _0xd65aed=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xd65aed[_0xfe14('0x21')](_0x9e74b)){return _0x1cdd4b;}else{throw new db[(_0xfe14('0x22'))][(_0xfe14('0x23'))](_0xfe14('0x24'));}}else{return _0x1cdd4b;}}function respondWithRpcPromise(_0x492f88,_0x56522f,_0x96a900,_0x44435d){return new BPromise(function(_0xa28634,_0x23c86d){var _0x2995e2=_0x44435d||client;return _0x2995e2[_0xfe14('0x25')](_0x492f88,_0x96a900)[_0xfe14('0x26')](function(_0x16734e){logger['info'](_0xfe14('0x27'),_0x56522f,_0xfe14('0x28'));logger[_0xfe14('0x29')](_0xfe14('0x2a'),_0x56522f,_0xfe14('0x28'),JSON['stringify'](_0x16734e));if(_0x16734e[_0xfe14('0x2b')]){if(_0x16734e[_0xfe14('0x2b')][_0xfe14('0x2c')]===0x1f4){logger[_0xfe14('0x2b')](_0xfe14('0x27'),_0x56522f,_0x16734e['error'][_0xfe14('0x2d')]);return _0x23c86d(_0x16734e[_0xfe14('0x2b')][_0xfe14('0x2d')]);}logger[_0xfe14('0x2b')]('MailMessage,\x20%s,\x20%s',_0x56522f,_0x16734e['error'][_0xfe14('0x2d')]);return _0xa28634(_0x16734e[_0xfe14('0x2b')][_0xfe14('0x2d')]);}else{logger[_0xfe14('0x2e')](_0xfe14('0x27'),_0x56522f,_0xfe14('0x28'));_0xa28634(_0x16734e[_0xfe14('0x2f')][_0xfe14('0x2d')]);}})['catch'](function(_0x3760f2){logger[_0xfe14('0x2b')](_0xfe14('0x27'),_0x56522f,_0x3760f2);_0x23c86d(_0x3760f2);});});}function respondWithStatusCode(_0x247a71,_0xf6b5fe){_0xf6b5fe=_0xf6b5fe||0xcc;return function(_0xce2ec6){if(_0xce2ec6){return _0x247a71[_0xfe14('0x30')](_0xf6b5fe);}return _0x247a71[_0xfe14('0x31')](_0xf6b5fe)[_0xfe14('0x32')]();};}function respondWithResult(_0x5b83de,_0x174319){_0x174319=_0x174319||0xc8;return function(_0xf23d3b){if(_0xf23d3b){return _0x5b83de['status'](_0x174319)[_0xfe14('0x33')](_0xf23d3b);}};}function respondWithFilteredResult(_0x32053c,_0x368cd6){return function(_0x278805){if(_0x278805){var _0x353f9d=_0x278805[_0xfe14('0x34')],_0x18d469=_0x368cd6[_0xfe14('0x35')],_0x4c680d=_0x368cd6[_0xfe14('0x35')]+_0x368cd6[_0xfe14('0x36')],_0x4846ed;if(_0x4c680d>=_0x353f9d){_0x4c680d=_0x353f9d;_0x4846ed=0xc8;}else{_0x4846ed=0xce;}_0x32053c[_0xfe14('0x31')](_0x4846ed);return _0x32053c[_0xfe14('0x37')]('Content-Range',_0x18d469+'-'+_0x4c680d+'/'+_0x353f9d)['json'](_0x278805);}return null;};}function patchUpdates(_0x142747){return function(_0x5450a5){try{jsonpatch['apply'](_0x5450a5,_0x142747,!![]);}catch(_0x2d6480){return BPromise[_0xfe14('0x38')](_0x2d6480);}return _0x5450a5[_0xfe14('0x39')]();};}function saveUpdates(_0x7ae01c,_0x2e56e1){return function(_0x1d4336){if(_0x1d4336){return _0x1d4336[_0xfe14('0x3a')](_0x7ae01c)['then'](function(_0x4f81d2){return _0x4f81d2;});}return null;};}function removeEntity(_0x231181,_0x6573e9){return function(_0x110c45){if(_0x110c45){return _0x110c45[_0xfe14('0x3b')]()[_0xfe14('0x26')](function(){_0x231181[_0xfe14('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x543777,_0xeb954b){return function(_0x5f58f1){if(!_0x5f58f1){_0x543777['sendStatus'](0x194);}return _0x5f58f1;};}function handleError(_0x188959,_0x26a534){_0x26a534=_0x26a534||0x1f4;return function(_0x42a90e){logger[_0xfe14('0x2b')](_0x42a90e[_0xfe14('0x3c')]);if(_0x42a90e['name']){delete _0x42a90e[_0xfe14('0x3d')];}_0x188959[_0xfe14('0x31')](_0x26a534)['send'](_0x42a90e);};}exports[_0xfe14('0x3e')]=function(_0x765f9f,_0x94de21){var _0x50d2cf={},_0x4a2e83={},_0x2e42db={'count':0x0,'rows':[]};var _0xf8150e=_[_0xfe14('0x3f')](db[_0xfe14('0x40')][_0xfe14('0x41')],function(_0x28e8a7){return{'name':_0x28e8a7[_0xfe14('0x42')],'type':_0x28e8a7[_0xfe14('0x43')][_0xfe14('0x44')]};});_0x4a2e83[_0xfe14('0x45')]=_[_0xfe14('0x3f')](_0xf8150e,'name');_0x4a2e83['query']=_['keys'](_0x765f9f[_0xfe14('0x46')]);_0x4a2e83['filters']=_[_0xfe14('0x47')](_0x4a2e83[_0xfe14('0x45')],_0x4a2e83[_0xfe14('0x46')]);_0x50d2cf['attributes']=_[_0xfe14('0x47')](_0x4a2e83[_0xfe14('0x45')],qs[_0xfe14('0x48')](_0x765f9f[_0xfe14('0x46')][_0xfe14('0x48')]));_0x50d2cf['attributes']=_0x50d2cf[_0xfe14('0x49')][_0xfe14('0x4a')]?_0x50d2cf[_0xfe14('0x49')]:_0x4a2e83['model'];if(!_0x765f9f['query']['hasOwnProperty'](_0xfe14('0x4b'))){_0x50d2cf[_0xfe14('0x36')]=qs['limit'](_0x765f9f[_0xfe14('0x46')]['limit']);_0x50d2cf[_0xfe14('0x35')]=qs['offset'](_0x765f9f[_0xfe14('0x46')]['offset']);}_0x50d2cf[_0xfe14('0x4c')]=qs[_0xfe14('0x4d')](_0x765f9f[_0xfe14('0x46')][_0xfe14('0x4d')]);_0x50d2cf[_0xfe14('0x4e')]=qs[_0xfe14('0x4f')](_[_0xfe14('0x50')](_0x765f9f['query'],_0x4a2e83[_0xfe14('0x4f')]),_0xf8150e);if(_0x765f9f[_0xfe14('0x46')]['filter']){_0x50d2cf[_0xfe14('0x4e')]=_[_0xfe14('0x51')](_0x50d2cf[_0xfe14('0x4e')],{'$or':_[_0xfe14('0x3f')](_0xf8150e,function(_0x4e945c){if(_0x4e945c['type']!==_0xfe14('0x52')){var _0x424ec5={};_0x424ec5[_0x4e945c[_0xfe14('0x3d')]]={'$like':'%'+_0x765f9f['query'][_0xfe14('0x53')]+'%'};return _0x424ec5;}})});}_0x50d2cf=_['merge']({},_0x50d2cf,_0x765f9f[_0xfe14('0x54')]);var _0x21b19f={'where':_0x50d2cf[_0xfe14('0x4e')]};return db[_0xfe14('0x40')][_0xfe14('0x34')](_0x21b19f)['then'](function(_0x42b43e){_0x2e42db[_0xfe14('0x34')]=_0x42b43e;if(_0x765f9f['query'][_0xfe14('0x55')]){_0x50d2cf[_0xfe14('0x56')]=[{'all':!![]}];}return db['MailMessage'][_0xfe14('0x57')](_0x50d2cf);})['then'](function(_0x722d39){_0x2e42db['rows']=_0x722d39;return _0x2e42db;})[_0xfe14('0x26')](respondWithFilteredResult(_0x94de21,_0x50d2cf))['catch'](handleError(_0x94de21,null));};exports[_0xfe14('0x58')]=function(_0x5dea78,_0x50e7f3){var _0xfd6398={'raw':!![],'where':{'id':_0x5dea78[_0xfe14('0x59')]['id']}},_0x539727={};_0x539727[_0xfe14('0x45')]=_[_0xfe14('0x5a')](db['MailMessage'][_0xfe14('0x41')]);_0x539727['query']=_[_0xfe14('0x5a')](_0x5dea78['query']);_0x539727[_0xfe14('0x4f')]=_[_0xfe14('0x47')](_0x539727['model'],_0x539727[_0xfe14('0x46')]);_0xfd6398['attributes']=_[_0xfe14('0x47')](_0x539727[_0xfe14('0x45')],qs['fields'](_0x5dea78[_0xfe14('0x46')][_0xfe14('0x48')]));_0xfd6398[_0xfe14('0x49')]=_0xfd6398[_0xfe14('0x49')][_0xfe14('0x4a')]?_0xfd6398['attributes']:_0x539727[_0xfe14('0x45')];if(_0x5dea78[_0xfe14('0x46')][_0xfe14('0x55')]){_0xfd6398[_0xfe14('0x56')]=[{'all':!![]}];}_0xfd6398=_['merge']({},_0xfd6398,_0x5dea78[_0xfe14('0x54')]);return db[_0xfe14('0x40')]['find'](_0xfd6398)[_0xfe14('0x26')](handleEntityNotFound(_0x50e7f3,null))[_0xfe14('0x26')](respondWithResult(_0x50e7f3,null))[_0xfe14('0x5b')](handleError(_0x50e7f3,null));};exports[_0xfe14('0x3a')]=function(_0xaf1339,_0x42732f){if(_0xaf1339['body']['id']){delete _0xaf1339[_0xfe14('0x5c')]['id'];}return db['MailMessage'][_0xfe14('0x5d')]({'where':{'id':_0xaf1339[_0xfe14('0x59')]['id']}})[_0xfe14('0x26')](handleEntityNotFound(_0x42732f,null))[_0xfe14('0x26')](saveUpdates(_0xaf1339[_0xfe14('0x5c')],null))['then'](respondWithResult(_0x42732f,null))['catch'](handleError(_0x42732f,null));};exports['destroy']=function(_0xd2dc2e,_0x34c667){return db[_0xfe14('0x40')]['find']({'where':{'id':_0xd2dc2e['params']['id']}})[_0xfe14('0x26')](handleEntityNotFound(_0x34c667,null))['then'](removeEntity(_0x34c667,null))[_0xfe14('0x5b')](handleError(_0x34c667,null));};exports[_0xfe14('0x5e')]=function(_0x3a66d1,_0x5aa49f){return db[_0xfe14('0x40')][_0xfe14('0x5e')]()[_0xfe14('0x26')](respondWithResult(_0x5aa49f,null))[_0xfe14('0x5b')](handleError(_0x5aa49f,null));};exports[_0xfe14('0x5f')]=function(_0x370566,_0x1973a4){return db['MailMessage'][_0xfe14('0x5f')](_0x370566[_0xfe14('0x5c')])['then'](function(_0x4708ee){if(_0x4708ee){if(_0x4708ee[_0xfe14('0x60')]==='out'&&!_0x4708ee['secret']){var _0x1cfe7b,_0x1014ed,_0x58d58d;if(_0x370566[_0xfe14('0x5c')]['to']){_0x1014ed=_0x370566['body']['to'][_0xfe14('0x61')](',')[0x0];}return db[_0xfe14('0x62')][_0xfe14('0x63')]({'where':{'id':_0x4708ee['MailAccountId']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xfe14('0x64')],'as':_0xfe14('0x65'),'where':{'email':_0x1014ed},'limit':0x1,'order':[['updatedAt',_0xfe14('0x66')]]}]},{'model':db['MailServerOut'],'as':_0xfe14('0x67'),'raw':!![]}]})[_0xfe14('0x26')](function(_0x2fddb8){_0x1cfe7b=_0x2fddb8;if(_0x1cfe7b&&_0x1cfe7b[_0xfe14('0x67')]){var _0x3e2569={'tls':{'rejectUnauthorized':![]}};if(_[_0xfe14('0x68')](_0x1cfe7b['Smtp'][_0xfe14('0x69')])){_0x3e2569[_0xfe14('0x6a')]=_0x1cfe7b[_0xfe14('0x67')]['host'];_0x3e2569[_0xfe14('0x6b')]=_0x1cfe7b[_0xfe14('0x67')]['port'];_0x3e2569[_0xfe14('0x6c')]=_0x1cfe7b[_0xfe14('0x67')][_0xfe14('0x6c')];if(_0x1cfe7b['Smtp'][_0xfe14('0x6d')]){_0x3e2569[_0xfe14('0x6e')]={'user':_0x1cfe7b[_0xfe14('0x67')]['user'],'pass':_0x1cfe7b['Smtp'][_0xfe14('0x6f')]};}}else{_0x3e2569[_0xfe14('0x69')]=_0x1cfe7b['Smtp'][_0xfe14('0x69')];_0x3e2569[_0xfe14('0x6e')]={'user':_0x1cfe7b[_0xfe14('0x67')]['user'],'pass':_0x1cfe7b[_0xfe14('0x67')][_0xfe14('0x6f')]};_0x3e2569[_0xfe14('0x6c')]=_0x1cfe7b[_0xfe14('0x67')][_0xfe14('0x6c')];}if(_0x370566[_0xfe14('0x5c')]['attachments']&&_0x370566[_0xfe14('0x5c')][_0xfe14('0x70')][_0xfe14('0x4a')]){for(var _0x32efc7=0x0;_0x32efc7<_0x370566[_0xfe14('0x5c')][_0xfe14('0x70')][_0xfe14('0x4a')];_0x32efc7+=0x1){_0x370566['body']['attachments'][_0x32efc7]={'filename':_0x370566['body'][_0xfe14('0x70')][_0x32efc7][_0xfe14('0x3d')],'path':path['join'](config[_0xfe14('0x71')],_0xfe14('0x72'),_0x370566[_0xfe14('0x5c')]['attachments'][_0x32efc7][_0xfe14('0x73')])};}}_0x58d58d={'account':_0x3e2569,'message':_0x370566[_0xfe14('0x5c')]};return;}})[_0xfe14('0x26')](function(){if(_0x1cfe7b[_0xfe14('0x74')]){if(_0x1cfe7b[_0xfe14('0x74')][_0xfe14('0x65')][_0xfe14('0x4a')]){return _0x1cfe7b['List'][_0xfe14('0x65')][0x0];}else{return db['CmContact'][_0xfe14('0x5f')](_[_0xfe14('0x1b')](_0x370566[_0xfe14('0x5c')],{'firstName':_0x370566[_0xfe14('0x5c')]['to'],'email':_0x370566['body']['to'],'phone':_0x370566[_0xfe14('0x5c')]['to'],'ListId':_0x1cfe7b['ListId']}));}}else{throw new Error(_0xfe14('0x75'));}})['then'](function(){if(_0x58d58d){return respondWithRpcPromise(_0xfe14('0x76'),_0xfe14('0x77'),_0x58d58d,client9003)[_0xfe14('0x26')](function(_0x21ecaf){return _0x4708ee['update']({'read':!![],'messageId':_0x21ecaf[_0xfe14('0x78')],'sentAt':moment()[_0xfe14('0x79')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xfe14('0x5b')](function(_0x473d1b){logger[_0xfe14('0x2b')]('%s',JSON['stringify'](_0x473d1b));return _0x4708ee;});}return _0x4708ee;});}return _0x4708ee;}})[_0xfe14('0x26')](respondWithResult(_0x1973a4,0xc9))[_0xfe14('0x5b')](handleError(_0x1973a4,null));};var interaction_log=require(_0xfe14('0x17'))(_0xfe14('0x7a'));exports[_0xfe14('0x7b')]=function(_0x3ba148,_0x3759f3,_0x5eda6e){var _0x11b4b8={'channel':'mail'};if(_0x3ba148[_0xfe14('0x5c')]['id']){delete _0x3ba148[_0xfe14('0x5c')]['id'];}_0x3ba148[_0xfe14('0x5c')]['read']=!![];_0x3ba148[_0xfe14('0x5c')][_0xfe14('0x7c')]=moment()[_0xfe14('0x79')]('YYYY-MM-DD\x20HH:mm:ss');_0x3ba148[_0xfe14('0x5c')]['UserId']=_0x3ba148[_0xfe14('0x5c')][_0xfe14('0x7d')]||_0x3ba148[_0xfe14('0x7e')]['id'];return db[_0xfe14('0x40')][_0xfe14('0x5d')]({'where':{'id':_0x3ba148[_0xfe14('0x59')]['id'],'UserId':null},'include':[{'model':db[_0xfe14('0x64')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x3759f3,null))[_0xfe14('0x26')](saveUpdates(_0x3ba148['body'],null))[_0xfe14('0x26')](function(_0x498223){if(_0x498223){_0x11b4b8[_0xfe14('0x2d')]=_0x498223['get']({'plain':!![]});return db[_0xfe14('0x7f')]['find']({'where':{'id':_0x498223[_0xfe14('0x80')]}});}return null;})[_0xfe14('0x26')](handleEntityNotFound(_0x3759f3,null))[_0xfe14('0x26')](function(_0x1a306e){if(_0x1a306e){return _0x1a306e['update']({'UserId':_0x3ba148[_0xfe14('0x5c')][_0xfe14('0x7d')],'read1stAt':_[_0xfe14('0x68')](_0x1a306e[_0xfe14('0x81')])?moment()[_0xfe14('0x79')](_0xfe14('0x82')):undefined});}return null;})[_0xfe14('0x26')](function(_0xbc10e6){if(_0xbc10e6){_0x11b4b8['interaction']=_0xbc10e6[_0xfe14('0x83')]({'plain':!![]});interaction_log['info'](_0xfe14('0x84'),_0x3ba148['user']['id'],_0x3ba148[_0xfe14('0x7e')][_0xfe14('0x3d')],_0x3ba148[_0xfe14('0x7e')]['role'],_0x11b4b8[_0xfe14('0x85')]['id'],_0x3ba148[_0xfe14('0x5c')]?JSON[_0xfe14('0x86')](_0x3ba148[_0xfe14('0x5c')]):_0xfe14('0x87'));return respondWithRpcPromise('AcceptMessage',_0xfe14('0x88'),_0x11b4b8);}return null;})['then'](function(_0x432ae6){if(_0x432ae6){if(_0x3ba148[_0xfe14('0x5c')][_0xfe14('0x89')]){_0x11b4b8['message'][_0xfe14('0x8a')]=util[_0xfe14('0x79')]('SIP/%s',_0x3ba148[_0xfe14('0x7e')][_0xfe14('0x3d')]);_0x11b4b8[_0xfe14('0x2d')][_0xfe14('0x8b')]=_0x11b4b8[_0xfe14('0x8b')];_0x11b4b8[_0xfe14('0x2d')][_0xfe14('0x8c')]=_0xfe14('0x7b');return respondWithRpcPromise(_0xfe14('0x8d'),'EventManager',{'event':_0xfe14('0x8e'),'message':_0x11b4b8[_0xfe14('0x2d')]},client9002)['then'](function(){return _0x11b4b8;});}return _0x11b4b8;}return null;})[_0xfe14('0x26')](respondWithResult(_0x3759f3,null))['catch'](handleError(_0x3759f3,null));};var interaction_log=require(_0xfe14('0x17'))('mail-interactions');exports['reject']=function(_0x45e5b8,_0x1c8321,_0x5da036){var _0x161351={'agent':{},'channel':'mail'};if(_0x45e5b8['body']['id']){delete _0x45e5b8[_0xfe14('0x5c')]['id'];}_0x45e5b8['body'][_0xfe14('0x7d')]=_0x45e5b8[_0xfe14('0x5c')][_0xfe14('0x7d')]||_0x45e5b8[_0xfe14('0x7e')]['id'];_0x161351[_0xfe14('0x8f')]['id']=_0x45e5b8[_0xfe14('0x5c')]['UserId'];return db[_0xfe14('0x40')][_0xfe14('0x5d')]({'where':{'id':_0x45e5b8[_0xfe14('0x59')]['id'],'UserId':null}})[_0xfe14('0x26')](handleEntityNotFound(_0x1c8321,null))[_0xfe14('0x26')](function(_0x213b11){if(_0x213b11){_0x161351[_0xfe14('0x2d')]=_0x213b11['get']({'plain':!![]});return db[_0xfe14('0x7f')]['find']({'where':{'id':_0x213b11['MailInteractionId']}});}return null;})[_0xfe14('0x26')](handleEntityNotFound(_0x1c8321,null))[_0xfe14('0x26')](function(_0x381117){if(_0x381117){_0x161351['interaction']=_0x381117[_0xfe14('0x83')]({'plain':!![]});interaction_log[_0xfe14('0x2e')](_0xfe14('0x90'),_0x45e5b8['user']['id'],_0x45e5b8[_0xfe14('0x7e')][_0xfe14('0x3d')],_0x45e5b8[_0xfe14('0x7e')][_0xfe14('0x91')],_0x161351[_0xfe14('0x85')]['id'],_0x45e5b8[_0xfe14('0x5c')]?JSON[_0xfe14('0x86')](_0x45e5b8['body']):_0xfe14('0x87'));return respondWithRpcPromise(_0xfe14('0x92'),_0xfe14('0x93'),_0x161351);}return null;})[_0xfe14('0x26')](function(_0x53bf0e){if(_0x53bf0e){_0x53bf0e[_0xfe14('0x2d')][_0xfe14('0x8a')]=util['format']('SIP/%s',_0x45e5b8[_0xfe14('0x7e')][_0xfe14('0x3d')]);_0x53bf0e[_0xfe14('0x2d')]['channel']=_0x161351['channel'];_0x53bf0e[_0xfe14('0x2d')][_0xfe14('0x8c')]=_0xfe14('0x38');respondWithRpcPromise(_0xfe14('0x8d'),_0xfe14('0x8d'),{'event':_0xfe14('0x94'),'message':_0x53bf0e[_0xfe14('0x2d')]},client9002);return _0x161351;}return null;})[_0xfe14('0x26')](respondWithResult(_0x1c8321,null))[_0xfe14('0x5b')](handleError(_0x1c8321,null));};exports[_0xfe14('0x95')]=function(_0x288f43,_0x515a82){var _0x19299a=moment()[_0xfe14('0x96')]()['toString']();var _0x3c7182=path[_0xfe14('0x97')](config[_0xfe14('0x71')],_0xfe14('0x98'),_0xfe14('0x99'),_0xfe14('0x9a'));var _0x3efdb4=path['join'](config['root'],_0xfe14('0x98'),_0xfe14('0x99'),_0xfe14('0x70'));var _0x435008=util['format']('message-%s.eml',_0x19299a);return db[_0xfe14('0x40')][_0xfe14('0x5d')]({'where':{'id':_0x288f43[_0xfe14('0x59')]['id']},'attributes':['id',_0xfe14('0x5c'),_0xfe14('0x9b'),'to','cc',_0xfe14('0x9c'),_0xfe14('0x9d'),_0xfe14('0x9e')],'include':_0x288f43[_0xfe14('0x46')]['attachments']?[{'model':db[_0xfe14('0x9f')],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x515a82,null))['then'](function(_0x54650){if(_0x54650){var _0x54bc28=_0x54650;var _0x481a36={'from':_0x54bc28[_0xfe14('0x9b')],'to':_0x54bc28['to'],'subject':_0x54bc28[_0xfe14('0x9d')],'html':_0x54bc28[_0xfe14('0x5c')],'headers':{'Date':moment(_0x54bc28['createdAt'])[_0xfe14('0x79')](_0xfe14('0xa0'))},'attachments':[]};if(_0x54650['cc']){_0x481a36['headers']['Cc']=_0x54650['cc'];}if(_0x54650[_0xfe14('0x9c')]){_0x481a36[_0xfe14('0xa1')]['Bcc']=_0x54650[_0xfe14('0x9c')];}return new BPromise(function(_0x47d2b5,_0x54078d){if(_0x54650['Attachments']){for(var _0x2edbf9=0x0;_0x2edbf9<_0x54650[_0xfe14('0xa2')]['length'];_0x2edbf9++){var _0x3dd8c3=_0x54650['Attachments'][_0x2edbf9];var _0x2cde45=path[_0xfe14('0x97')](_0x3efdb4,_0x3dd8c3[_0xfe14('0x73')]);if(fs[_0xfe14('0xa3')](_0x2cde45)){_0x481a36[_0xfe14('0x70')][_0xfe14('0xa4')]({'name':_0x3dd8c3['name'],'contentType':_0x3dd8c3[_0xfe14('0x43')],'data':fs['readFileSync'](_0x2cde45)});}}}emlformat[_0xfe14('0xa5')](_0x481a36,function(_0x407dc9,_0x50be3c){if(_0x407dc9)return _0x54078d(_0x407dc9);fs['writeFileSync'](path['join'](_0x3c7182,_0x435008),_0x50be3c);return _0x47d2b5(_0x50be3c);});});}})['then'](function(_0x5987df){if(_0x5987df){return _0x515a82[_0xfe14('0x95')](path[_0xfe14('0x97')](_0x3c7182,_0x435008),_0x435008,function(_0x144836){if(_0x144836){console[_0xfe14('0xa6')](_0xfe14('0xa7'),_0x144836);}else{fs['unlinkSync'](path['join'](_0x3c7182,_0x435008));}});}})[_0xfe14('0x5b')](handleError(_0x515a82,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 3ef851b..78109f6 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 _0x64e8=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','MailMessage'];(function(_0x266de6,_0x2983c1){var _0x6b83a2=function(_0x3aad6e){while(--_0x3aad6e){_0x266de6['push'](_0x266de6['shift']());}};_0x6b83a2(++_0x2983c1);}(_0x64e8,0x181));var _0x864e=function(_0x4c7490,_0x26898c){_0x4c7490=_0x4c7490-0x0;var _0x1bc93e=_0x64e8[_0x4c7490];return _0x1bc93e;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x864e('0x0'))['db'][_0x864e('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x864e('0x2'),'afterUpdate':_0x864e('0x3'),'afterDestroy':_0x864e('0x4')};function emitEvent(_0x345c5c){return function(_0x2e5953,_0x3690ef,_0x53a95b){MailMessageEvents[_0x864e('0x5')](_0x345c5c+':'+_0x2e5953['id'],_0x2e5953);MailMessageEvents[_0x864e('0x5')](_0x345c5c,_0x2e5953);_0x53a95b(null);};}for(var e in events){if(events[_0x864e('0x6')](e)){var event=events[e];MailMessage[_0x864e('0x7')](e,emitEvent(event));}}module[_0x864e('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x5b7f=['update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x25701b,_0x2a6976){var _0x3a8a2c=function(_0x1a5e78){while(--_0x1a5e78){_0x25701b['push'](_0x25701b['shift']());}};_0x3a8a2c(++_0x2a6976);}(_0x5b7f,0x163));var _0xf5b7=function(_0x241bb4,_0x1c6222){_0x241bb4=_0x241bb4-0x0;var _0x4dc2bd=_0x5b7f[_0x241bb4];return _0x4dc2bd;};'use strict';var EventEmitter=require(_0xf5b7('0x0'));var MailMessage=require(_0xf5b7('0x1'))['db'][_0xf5b7('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xf5b7('0x3')](0x0);var events={'afterCreate':_0xf5b7('0x4'),'afterUpdate':_0xf5b7('0x5'),'afterDestroy':_0xf5b7('0x6')};function emitEvent(_0x1143bd){return function(_0x3ff0eb,_0x29f9b4,_0x49a666){MailMessageEvents['emit'](_0x1143bd+':'+_0x3ff0eb['id'],_0x3ff0eb);MailMessageEvents['emit'](_0x1143bd,_0x3ff0eb);_0x49a666(null);};}for(var e in events){if(events[_0xf5b7('0x7')](e)){var event=events[e];MailMessage[_0xf5b7('0x8')](e,emitEvent(event));}}module[_0xf5b7('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index cccda45..c4830fa 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 _0x7b14=['findOne','MailInteractionId','then','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages','fti_mail_messages','subject','FULLTEXT','body','plainBody','fromString','models','get','direction','toLowerCase','out','MailInteraction'];(function(_0x1523e0,_0x367509){var _0x9a8c43=function(_0x334fff){while(--_0x334fff){_0x1523e0['push'](_0x1523e0['shift']());}};_0x9a8c43(++_0x367509);}(_0x7b14,0x10f));var _0x47b1=function(_0x1284c7,_0x4238c0){_0x1284c7=_0x1284c7-0x0;var _0x3da16f=_0x7b14[_0x1284c7];return _0x3da16f;};'use strict';var _=require(_0x47b1('0x0'));var util=require(_0x47b1('0x1'));var logger=require(_0x47b1('0x2'))(_0x47b1('0x3'));var moment=require(_0x47b1('0x4'));var BPromise=require(_0x47b1('0x5'));var rp=require('request-promise');var htmlToText=require(_0x47b1('0x6'));var fs=require('fs');var path=require(_0x47b1('0x7'));var rimraf=require(_0x47b1('0x8'));var config=require(_0x47b1('0x9'));var attributes=require(_0x47b1('0xa'));module['exports']=function(_0x3e3f6f,_0x31f92d){return _0x3e3f6f[_0x47b1('0xb')](_0x47b1('0xc'),attributes,{'tableName':_0x47b1('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x47b1('0xe'),'fields':['plainBody',_0x47b1('0xf')],'type':_0x47b1('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xcce901,_0x36d61c,_0x4c1b81){if(_0xcce901[_0x47b1('0x11')]){_0xcce901[_0x47b1('0x12')]=htmlToText[_0x47b1('0x13')](_0xcce901[_0x47b1('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4c1b81(null,_0x36d61c);},'afterCreate':function(_0x448fdd,_0x533f40,_0x9f1e3e){var _0x27f9c8=_0x3e3f6f[_0x47b1('0x14')];var _0x3cee3a=_0x448fdd[_0x47b1('0x15')]({'plain':!![]});if(_0x3cee3a[_0x47b1('0x16')][_0x47b1('0x17')]()==='in'||_0x3cee3a[_0x47b1('0x16')][_0x47b1('0x17')]()===_0x47b1('0x18')&&!_0x3cee3a['secret']&&!_['isNil'](_0x3cee3a['UserId'])){_0x27f9c8[_0x47b1('0x19')][_0x47b1('0x1a')]({'where':{'id':_0x3cee3a[_0x47b1('0x1b')]}})[_0x47b1('0x1c')](function(_0x2cfbcf){if(_0x2cfbcf){_0x2cfbcf['update']({'lastMsgAt':_0x3cee3a[_0x47b1('0x1d')],'lastMsgDirection':_0x3cee3a[_0x47b1('0x16')][_0x47b1('0x17')](),'lastMsgBody':_0x3cee3a[_0x47b1('0x11')]});}})[_0x47b1('0x1e')](function(_0x1976da){console[_0x47b1('0x1f')](_0x1976da);});}_0x9f1e3e();}},'charset':_0x47b1('0x20'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x23f7=['fti_mail_messages','body','models','get','direction','toLowerCase','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','catch','error','utf8mb4','lodash','util','../../config/logger','bluebird','request-promise','html-to-text','rimraf','./mailMessage.attributes','exports','mail_messages','messageId'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x23f7,0x65));var _0x723f=function(_0x19241c,_0x3c99ed){_0x19241c=_0x19241c-0x0;var _0x11ad84=_0x23f7[_0x19241c];return _0x11ad84;};'use strict';var _=require(_0x723f('0x0'));var util=require(_0x723f('0x1'));var logger=require(_0x723f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x723f('0x3'));var rp=require(_0x723f('0x4'));var htmlToText=require(_0x723f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x723f('0x6'));var config=require('../../config/environment');var attributes=require(_0x723f('0x7'));module[_0x723f('0x8')]=function(_0x40075f,_0x4f1607){return _0x40075f['define']('MailMessage',attributes,{'tableName':_0x723f('0x9'),'paranoid':![],'indexes':[{'name':_0x723f('0xa'),'fields':[_0x723f('0xa')]},{'name':_0x723f('0xb'),'fields':['plainBody','subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x42823d,_0x5cee5d,_0x32b1a1){if(_0x42823d[_0x723f('0xc')]){_0x42823d['plainBody']=htmlToText['fromString'](_0x42823d[_0x723f('0xc')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x32b1a1(null,_0x5cee5d);},'afterCreate':function(_0x44c9d6,_0xd6c170,_0x19b290){var _0x220623=_0x40075f[_0x723f('0xd')];var _0xb04e8d=_0x44c9d6[_0x723f('0xe')]({'plain':!![]});if(_0xb04e8d[_0x723f('0xf')][_0x723f('0x10')]()==='in'||_0xb04e8d[_0x723f('0xf')][_0x723f('0x10')]()==='out'&&!_0xb04e8d[_0x723f('0x11')]&&!_[_0x723f('0x12')](_0xb04e8d[_0x723f('0x13')])){_0x220623[_0x723f('0x14')][_0x723f('0x15')]({'where':{'id':_0xb04e8d[_0x723f('0x16')]}})[_0x723f('0x17')](function(_0x27187c){if(_0x27187c){_0x27187c[_0x723f('0x18')]({'lastMsgAt':_0xb04e8d['createdAt'],'lastMsgDirection':_0xb04e8d['direction'][_0x723f('0x10')](),'lastMsgBody':_0xb04e8d['body']});}})[_0x723f('0x19')](function(_0x19c8eb){console[_0x723f('0x1a')](_0x19c8eb);});}_0x19b290();}},'charset':_0x723f('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 55aab22..ffd2b69 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 _0x9a6b=['register','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket'];(function(_0x411df2,_0x223016){var _0x5a71aa=function(_0x4e4022){while(--_0x4e4022){_0x411df2['push'](_0x411df2['shift']());}};_0x5a71aa(++_0x223016);}(_0x9a6b,0x77));var _0xb9a6=function(_0x2d00d7,_0x5da96c){_0x2d00d7=_0x2d00d7-0x0;var _0x518428=_0x9a6b[_0x2d00d7];return _0x518428;};'use strict';var _=require(_0xb9a6('0x0'));var util=require(_0xb9a6('0x1'));var moment=require(_0xb9a6('0x2'));var BPromise=require(_0xb9a6('0x3'));var rs=require(_0xb9a6('0x4'));var fs=require('fs');var Redis=require(_0xb9a6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9a6('0x6'));var logger=require('../../config/logger')(_0xb9a6('0x7'));var config=require(_0xb9a6('0x8'));var jayson=require(_0xb9a6('0x9'));var client=jayson[_0xb9a6('0xa')][_0xb9a6('0xb')]({'port':0x232a});config[_0xb9a6('0xc')]=_[_0xb9a6('0xd')](config[_0xb9a6('0xc')],{'host':_0xb9a6('0xe'),'port':0x18eb});var socket=require(_0xb9a6('0xf'))(new Redis(config['redis']));require(_0xb9a6('0x10'))[_0xb9a6('0x11')](socket);function respondWithRpcPromise(_0x57ddb8,_0x121da3,_0x13f166){return new BPromise(function(_0x296a91,_0x222d3b){return client['request'](_0x57ddb8,_0x13f166)['then'](function(_0x5012ee){logger[_0xb9a6('0x12')]('MailMessage,\x20%s,\x20%s',_0x121da3,_0xb9a6('0x13'));logger['debug'](_0xb9a6('0x14'),_0x121da3,_0xb9a6('0x13'),JSON[_0xb9a6('0x15')](_0x5012ee));if(_0x5012ee[_0xb9a6('0x16')]){if(_0x5012ee[_0xb9a6('0x16')][_0xb9a6('0x17')]===0x1f4){logger[_0xb9a6('0x16')](_0xb9a6('0x18'),_0x121da3,_0x5012ee[_0xb9a6('0x16')]['message']);return _0x222d3b(_0x5012ee[_0xb9a6('0x16')][_0xb9a6('0x19')]);}logger[_0xb9a6('0x16')](_0xb9a6('0x18'),_0x121da3,_0x5012ee['error'][_0xb9a6('0x19')]);return _0x296a91(_0x5012ee[_0xb9a6('0x16')][_0xb9a6('0x19')]);}else{logger['info'](_0xb9a6('0x18'),_0x121da3,_0xb9a6('0x13'));_0x296a91(_0x5012ee[_0xb9a6('0x1a')][_0xb9a6('0x19')]);}})[_0xb9a6('0x1b')](function(_0x5c39a6){logger[_0xb9a6('0x16')](_0xb9a6('0x18'),_0x121da3,_0x5c39a6);_0x222d3b(_0x5c39a6);});});}exports[_0xb9a6('0x1c')]=function(_0x45e6c8){var _0x525841=this;return new Promise(function(_0x5d2374,_0x1cb89e){return db[_0xb9a6('0x1d')][_0xb9a6('0x1e')](_0x45e6c8['body'],{'raw':_0x45e6c8[_0xb9a6('0x1f')]?_0x45e6c8['options'][_0xb9a6('0x20')]===undefined?!![]:![]:!![]})[_0xb9a6('0x21')](function(_0x50d3d4){logger[_0xb9a6('0x12')]('CreateMailMessage',_0x45e6c8);logger['debug'](_0xb9a6('0x1c'),_0x45e6c8,JSON[_0xb9a6('0x15')](_0x50d3d4));_0x5d2374(_0x50d3d4);})[_0xb9a6('0x1b')](function(_0x2122d7){logger['error'](_0xb9a6('0x1c'),_0x2122d7[_0xb9a6('0x19')],_0x45e6c8);_0x1cb89e(_0x525841[_0xb9a6('0x16')](0x1f4,_0x2122d7[_0xb9a6('0x19')]));});});}; \ No newline at end of file +var _0x814b=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','create','options','raw','then','info','CreateMailMessage','catch','lodash','util'];(function(_0x1116fd,_0x1b2ac7){var _0x2e2c06=function(_0xd07eeb){while(--_0xd07eeb){_0x1116fd['push'](_0x1116fd['shift']());}};_0x2e2c06(++_0x1b2ac7);}(_0x814b,0x1a2));var _0xb814=function(_0x2a1b33,_0x409f50){_0x2a1b33=_0x2a1b33-0x0;var _0x4c50e7=_0x814b[_0x2a1b33];return _0x4c50e7;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});config[_0xb814('0xc')]=_[_0xb814('0xd')](config['redis'],{'host':_0xb814('0xe'),'port':0x18eb});var socket=require(_0xb814('0xf'))(new Redis(config[_0xb814('0xc')]));require(_0xb814('0x10'))[_0xb814('0x11')](socket);function respondWithRpcPromise(_0x21d4a5,_0x1086f8,_0x19aad8){return new BPromise(function(_0x207dbc,_0x3450f2){return client[_0xb814('0x12')](_0x21d4a5,_0x19aad8)['then'](function(_0x43dfe6){logger['info'](_0xb814('0x13'),_0x1086f8,_0xb814('0x14'));logger[_0xb814('0x15')](_0xb814('0x16'),_0x1086f8,_0xb814('0x14'),JSON[_0xb814('0x17')](_0x43dfe6));if(_0x43dfe6[_0xb814('0x18')]){if(_0x43dfe6[_0xb814('0x18')][_0xb814('0x19')]===0x1f4){logger[_0xb814('0x18')](_0xb814('0x13'),_0x1086f8,_0x43dfe6[_0xb814('0x18')][_0xb814('0x1a')]);return _0x3450f2(_0x43dfe6[_0xb814('0x18')][_0xb814('0x1a')]);}logger[_0xb814('0x18')](_0xb814('0x13'),_0x1086f8,_0x43dfe6[_0xb814('0x18')][_0xb814('0x1a')]);return _0x207dbc(_0x43dfe6[_0xb814('0x18')][_0xb814('0x1a')]);}else{logger['info'](_0xb814('0x13'),_0x1086f8,'request\x20sent');_0x207dbc(_0x43dfe6[_0xb814('0x1b')][_0xb814('0x1a')]);}})['catch'](function(_0x4b55a7){logger['error'](_0xb814('0x13'),_0x1086f8,_0x4b55a7);_0x3450f2(_0x4b55a7);});});}exports['CreateMailMessage']=function(_0x57c128){var _0xb684ea=this;return new Promise(function(_0x24211d,_0x25b6b6){return db['MailMessage'][_0xb814('0x1c')](_0x57c128['body'],{'raw':_0x57c128[_0xb814('0x1d')]?_0x57c128[_0xb814('0x1d')][_0xb814('0x1e')]===undefined?!![]:![]:!![]})[_0xb814('0x1f')](function(_0x27352e){logger[_0xb814('0x20')](_0xb814('0x21'),_0x57c128);logger['debug'](_0xb814('0x21'),_0x57c128,JSON['stringify'](_0x27352e));_0x24211d(_0x27352e);})[_0xb814('0x22')](function(_0x457dac){logger[_0xb814('0x18')](_0xb814('0x21'),_0x457dac[_0xb814('0x1a')],_0x57c128);_0x25b6b6(_0xb684ea[_0xb814('0x18')](0x1f4,_0x457dac[_0xb814('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 7327dd5..9e85869 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 _0x5139=['register','mailMessage:','./mailMessage.events','save','update','emit'];(function(_0x23e97f,_0x46a20b){var _0x1bd1d7=function(_0x46475e){while(--_0x46475e){_0x23e97f['push'](_0x23e97f['shift']());}};_0x1bd1d7(++_0x46a20b);}(_0x5139,0x8c));var _0x9513=function(_0x2e2162,_0x43f129){_0x2e2162=_0x2e2162-0x0;var _0x53d3cc=_0x5139[_0x2e2162];return _0x53d3cc;};'use strict';var MailMessageEvents=require(_0x9513('0x0'));var events=[_0x9513('0x1'),'remove',_0x9513('0x2')];function createListener(_0x844653,_0x85f4e5){return function(_0x2ada15){_0x85f4e5[_0x9513('0x3')](_0x844653,_0x2ada15);};}function removeListener(_0x453743,_0x6e0d7e){return function(){MailMessageEvents['removeListener'](_0x453743,_0x6e0d7e);};}exports[_0x9513('0x4')]=function(_0x166802){for(var _0x2550f1=0x0,_0x2385d8=events['length'];_0x2550f1<_0x2385d8;_0x2550f1++){var _0x45d209=events[_0x2550f1];var _0x1ce372=createListener(_0x9513('0x5')+_0x45d209,_0x166802);MailMessageEvents['on'](_0x45d209,_0x1ce372);}}; \ No newline at end of file +var _0xa8ca=['remove','emit','register','length','./mailMessage.events'];(function(_0x3a52b1,_0x4bdf93){var _0x4f22cc=function(_0x470f50){while(--_0x470f50){_0x3a52b1['push'](_0x3a52b1['shift']());}};_0x4f22cc(++_0x4bdf93);}(_0xa8ca,0x12b));var _0xaa8c=function(_0x17d640,_0xb0d5c3){_0x17d640=_0x17d640-0x0;var _0x1d4d57=_0xa8ca[_0x17d640];return _0x1d4d57;};'use strict';var MailMessageEvents=require(_0xaa8c('0x0'));var events=['save',_0xaa8c('0x1'),'update'];function createListener(_0x45c417,_0x4278c6){return function(_0x1b7588){_0x4278c6[_0xaa8c('0x2')](_0x45c417,_0x1b7588);};}function removeListener(_0x2c993f,_0x3b6002){return function(){MailMessageEvents['removeListener'](_0x2c993f,_0x3b6002);};}exports[_0xaa8c('0x3')]=function(_0x25dfbc){for(var _0x57a316=0x0,_0x47a6e4=events[_0xaa8c('0x4')];_0x57a316<_0x47a6e4;_0x57a316++){var _0x736ba3=events[_0x57a316];var _0x5e8f2d=createListener('mailMessage:'+_0x736ba3,_0x25dfbc);MailMessageEvents['on'](_0x736ba3,_0x5e8f2d);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 09a67f6..fb327d5 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 _0x7ec7=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','/:id','isAuthenticated','show','/:id/members','/:id/teams','getTeams','getAgents','post','create','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router'];(function(_0x16aa10,_0xc22da3){var _0x3bc706=function(_0x1fd6a7){while(--_0x1fd6a7){_0x16aa10['push'](_0x16aa10['shift']());}};_0x3bc706(++_0xc22da3);}(_0x7ec7,0xa2));var _0x77ec=function(_0x420a56,_0x4b12eb){_0x420a56=_0x420a56-0x0;var _0x4870c8=_0x7ec7[_0x420a56];return _0x4870c8;};'use strict';var multer=require(_0x77ec('0x0'));var util=require(_0x77ec('0x1'));var path=require(_0x77ec('0x2'));var timeout=require(_0x77ec('0x3'));var express=require(_0x77ec('0x4'));var router=express[_0x77ec('0x5')]();var auth=require(_0x77ec('0x6'));var interaction=require(_0x77ec('0x7'));var config=require(_0x77ec('0x8'));var controller=require('./mailQueue.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x77ec('0x9')](_0x77ec('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x77ec('0x9')](_0x77ec('0xb'),auth[_0x77ec('0xc')](),controller[_0x77ec('0xd')]);router[_0x77ec('0x9')](_0x77ec('0xe'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x77ec('0xf'),auth[_0x77ec('0xc')](),controller[_0x77ec('0x10')]);router[_0x77ec('0x9')]('/:id/users',auth[_0x77ec('0xc')](),controller[_0x77ec('0x11')]);router[_0x77ec('0x12')]('/',auth['isAuthenticated'](),controller[_0x77ec('0x13')]);router['post']('/:id/teams',auth[_0x77ec('0xc')](),controller['addTeams']);router[_0x77ec('0x12')](_0x77ec('0x14'),auth[_0x77ec('0xc')](),controller[_0x77ec('0x15')]);router[_0x77ec('0x16')](_0x77ec('0xb'),auth[_0x77ec('0xc')](),controller[_0x77ec('0x17')]);router[_0x77ec('0x18')](_0x77ec('0xb'),auth[_0x77ec('0xc')](),controller[_0x77ec('0x19')]);router[_0x77ec('0x18')](_0x77ec('0xf'),auth['isAuthenticated'](),controller[_0x77ec('0x1a')]);router[_0x77ec('0x18')](_0x77ec('0x14'),auth[_0x77ec('0xc')](),controller[_0x77ec('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xd829=['index','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','update','destroy','delete','removeTeams','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated'];(function(_0x9b3efc,_0x577a0d){var _0x200f05=function(_0x15ad7c){while(--_0x15ad7c){_0x9b3efc['push'](_0x9b3efc['shift']());}};_0x200f05(++_0x577a0d);}(_0xd829,0xdd));var _0x9d82=function(_0x56b8b6,_0x18f055){_0x56b8b6=_0x56b8b6-0x0;var _0x4ba4b7=_0xd829[_0x56b8b6];return _0x4ba4b7;};'use strict';var multer=require(_0x9d82('0x0'));var util=require(_0x9d82('0x1'));var path=require(_0x9d82('0x2'));var timeout=require(_0x9d82('0x3'));var express=require(_0x9d82('0x4'));var router=express[_0x9d82('0x5')]();var auth=require(_0x9d82('0x6'));var interaction=require(_0x9d82('0x7'));var config=require('../../config/environment');var controller=require(_0x9d82('0x8'));router[_0x9d82('0x9')]('/',auth[_0x9d82('0xa')](),controller[_0x9d82('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x9d82('0xc')]);router[_0x9d82('0x9')](_0x9d82('0xd'),auth[_0x9d82('0xa')](),controller[_0x9d82('0xe')]);router[_0x9d82('0x9')](_0x9d82('0xf'),auth[_0x9d82('0xa')](),controller[_0x9d82('0x10')]);router['get'](_0x9d82('0x11'),auth[_0x9d82('0xa')](),controller[_0x9d82('0x12')]);router[_0x9d82('0x9')](_0x9d82('0x13'),auth[_0x9d82('0xa')](),controller[_0x9d82('0x14')]);router[_0x9d82('0x15')]('/',auth[_0x9d82('0xa')](),controller[_0x9d82('0x16')]);router[_0x9d82('0x15')](_0x9d82('0x11'),auth[_0x9d82('0xa')](),controller['addTeams']);router[_0x9d82('0x15')](_0x9d82('0x13'),auth[_0x9d82('0xa')](),controller[_0x9d82('0x17')]);router['put']('/:id',auth[_0x9d82('0xa')](),controller[_0x9d82('0x18')]);router['delete'](_0x9d82('0xd'),auth['isAuthenticated'](),controller[_0x9d82('0x19')]);router[_0x9d82('0x1a')](_0x9d82('0x11'),auth[_0x9d82('0xa')](),controller[_0x9d82('0x1b')]);router[_0x9d82('0x1a')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x9d82('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 9535e8f..69df9e8 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 _0x61c2=['sequelize','exports','STRING','name','ENUM','rrmemory','beepall'];(function(_0x69a764,_0x5d05ea){var _0x558569=function(_0x13b0c2){while(--_0x13b0c2){_0x69a764['push'](_0x69a764['shift']());}};_0x558569(++_0x5d05ea);}(_0x61c2,0x11f));var _0x261c=function(_0xabc239,_0x1d3f03){_0xabc239=_0xabc239-0x0;var _0x2ba9d3=_0x61c2[_0xabc239];return _0x2ba9d3;};'use strict';var Sequelize=require(_0x261c('0x0'));module[_0x261c('0x1')]={'name':{'type':Sequelize[_0x261c('0x2')],'unique':_0x261c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x261c('0x4')](_0x261c('0x5'),_0x261c('0x6'),'roundrobin')}}; \ No newline at end of file +var _0xab47=['rrmemory','beepall','roundrobin','STRING','INTEGER','ENUM'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0xab47,0xb1));var _0x7ab4=function(_0x3a6e4b,_0x118cd9){_0x3a6e4b=_0x3a6e4b-0x0;var _0x36572d=_0xab47[_0x3a6e4b];return _0x36572d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7ab4('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7ab4('0x0')]},'timeout':{'type':Sequelize[_0x7ab4('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7ab4('0x2')](_0x7ab4('0x3'),_0x7ab4('0x4'),_0x7ab4('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 9bd5b53..bb7e54b 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 _0x19b4=['../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','register','sendStatus','end','status','count','offset','limit','set','apply','then','destroy','get','MailQueues','UserProfileResource','error','stack','name','send','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','MailQueue','includeAll','findAll','rows','show','params','length','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserMailQueue','sort','MailQueueId','findAndCountAll','UserId','createdAt','%s/%s','SIP','mailPause','updatedAt','getTeams','addTeams','Team','User','Agents','online','voicePause','interface','flatMap','sequelize','forEach','emit','userMailQueue:save','removeTeams','ids','select','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','every','TeamId','includes','all','union','value','transaction','isEmpty','removeAgents','userMailQueue:remove','addAgents','isArray','getAgents','html-pdf','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x4704dc,_0x575a5f){var _0x254d81=function(_0x3b135d){while(--_0x3b135d){_0x4704dc['push'](_0x4704dc['shift']());}};_0x254d81(++_0x575a5f);}(_0x19b4,0xea));var _0x419b=function(_0x118f9f,_0x17222f){_0x118f9f=_0x118f9f-0x0;var _0x81272b=_0x19b4[_0x118f9f];return _0x81272b;};'use strict';var pdf=require(_0x419b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x419b('0x1'));var moment=require(_0x419b('0x2'));var BPromise=require(_0x419b('0x3'));var Mustache=require(_0x419b('0x4'));var util=require(_0x419b('0x5'));var path=require(_0x419b('0x6'));var sox=require('sox');var csv=require(_0x419b('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x419b('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x419b('0x9'));var Papa=require(_0x419b('0xa'));var Redis=require(_0x419b('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x419b('0xc'));var as=require(_0x419b('0xd'));var hardwareService=require(_0x419b('0xe'));var logger=require('../../config/logger')(_0x419b('0xf'));var utils=require(_0x419b('0x10'));var config=require(_0x419b('0x11'));var db=require(_0x419b('0x12'))['db'];config[_0x419b('0x13')]=_[_0x419b('0x14')](config[_0x419b('0x13')],{'host':_0x419b('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x419b('0x16'))[_0x419b('0x17')](socket);function respondWithStatusCode(_0x37f5ff,_0x5e979a){_0x5e979a=_0x5e979a||0xcc;return function(_0x512e9b){if(_0x512e9b){return _0x37f5ff[_0x419b('0x18')](_0x5e979a);}return _0x37f5ff['status'](_0x5e979a)[_0x419b('0x19')]();};}function respondWithResult(_0x149f12,_0x3e6efd){_0x3e6efd=_0x3e6efd||0xc8;return function(_0x26c651){if(_0x26c651){return _0x149f12[_0x419b('0x1a')](_0x3e6efd)['json'](_0x26c651);}};}function respondWithFilteredResult(_0x536ab9,_0x3c71cc){return function(_0x5136e1){if(_0x5136e1){var _0x10c615=_0x5136e1[_0x419b('0x1b')],_0x77091c=_0x3c71cc[_0x419b('0x1c')],_0x187b28=_0x3c71cc[_0x419b('0x1c')]+_0x3c71cc[_0x419b('0x1d')],_0x315e03;if(_0x187b28>=_0x10c615){_0x187b28=_0x10c615;_0x315e03=0xc8;}else{_0x315e03=0xce;}_0x536ab9[_0x419b('0x1a')](_0x315e03);return _0x536ab9[_0x419b('0x1e')]('Content-Range',_0x77091c+'-'+_0x187b28+'/'+_0x10c615)['json'](_0x5136e1);}return null;};}function patchUpdates(_0x1dc732){return function(_0x59f1c4){try{jsonpatch[_0x419b('0x1f')](_0x59f1c4,_0x1dc732,!![]);}catch(_0x35b765){return BPromise['reject'](_0x35b765);}return _0x59f1c4['save']();};}function saveUpdates(_0x1985c5,_0xf28206){return function(_0x54015d){if(_0x54015d){return _0x54015d['update'](_0x1985c5)[_0x419b('0x20')](function(_0x4a8750){return _0x4a8750;});}return null;};}function removeEntity(_0x2832a7,_0x38066b){return function(_0x542b6a){if(_0x542b6a){return _0x542b6a[_0x419b('0x21')]()[_0x419b('0x20')](function(){var _0x491896=_0x542b6a[_0x419b('0x22')]({'plain':!![]});var _0x45a416=_0x419b('0x23');return db[_0x419b('0x24')][_0x419b('0x21')]({'where':{'type':_0x45a416,'resourceId':_0x491896['id']}})['then'](function(){return _0x542b6a;});})[_0x419b('0x20')](function(){_0x2832a7[_0x419b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29e6d7,_0x563ba4){return function(_0x3e05fe){if(!_0x3e05fe){_0x29e6d7['sendStatus'](0x194);}return _0x3e05fe;};}function handleError(_0x484ddf,_0xb3f203){_0xb3f203=_0xb3f203||0x1f4;return function(_0x1737d1){logger[_0x419b('0x25')](_0x1737d1[_0x419b('0x26')]);if(_0x1737d1[_0x419b('0x27')]){delete _0x1737d1['name'];}_0x484ddf[_0x419b('0x1a')](_0xb3f203)[_0x419b('0x28')](_0x1737d1);};}exports['index']=function(_0x4dfb21,_0x464e20){var _0x38b20d={},_0x18e19d={},_0x558872={'count':0x0,'rows':[]};var _0x279d63=_[_0x419b('0x29')](db['MailQueue'][_0x419b('0x2a')],function(_0x16fc1f){return{'name':_0x16fc1f['fieldName'],'type':_0x16fc1f[_0x419b('0x2b')]['key']};});_0x18e19d[_0x419b('0x2c')]=_['map'](_0x279d63,_0x419b('0x27'));_0x18e19d[_0x419b('0x2d')]=_[_0x419b('0x2e')](_0x4dfb21['query']);_0x18e19d[_0x419b('0x2f')]=_[_0x419b('0x30')](_0x18e19d[_0x419b('0x2c')],_0x18e19d[_0x419b('0x2d')]);_0x38b20d[_0x419b('0x31')]=_[_0x419b('0x30')](_0x18e19d[_0x419b('0x2c')],qs[_0x419b('0x32')](_0x4dfb21[_0x419b('0x2d')][_0x419b('0x32')]));_0x38b20d['attributes']=_0x38b20d['attributes']['length']?_0x38b20d[_0x419b('0x31')]:_0x18e19d[_0x419b('0x2c')];if(!_0x4dfb21[_0x419b('0x2d')][_0x419b('0x33')](_0x419b('0x34'))){_0x38b20d[_0x419b('0x1d')]=qs[_0x419b('0x1d')](_0x4dfb21[_0x419b('0x2d')][_0x419b('0x1d')]);_0x38b20d[_0x419b('0x1c')]=qs[_0x419b('0x1c')](_0x4dfb21[_0x419b('0x2d')][_0x419b('0x1c')]);}_0x38b20d[_0x419b('0x35')]=qs['sort'](_0x4dfb21[_0x419b('0x2d')]['sort']);_0x38b20d['where']=qs[_0x419b('0x2f')](_[_0x419b('0x36')](_0x4dfb21['query'],_0x18e19d['filters']),_0x279d63);if(_0x4dfb21[_0x419b('0x2d')][_0x419b('0x37')]){_0x38b20d[_0x419b('0x38')]=_[_0x419b('0x39')](_0x38b20d[_0x419b('0x38')],{'$or':_['map'](_0x279d63,function(_0x3485a1){if(_0x3485a1[_0x419b('0x2b')]!==_0x419b('0x3a')){var _0x16b219={};_0x16b219[_0x3485a1['name']]={'$like':'%'+_0x4dfb21[_0x419b('0x2d')][_0x419b('0x37')]+'%'};return _0x16b219;}})});}_0x38b20d=_[_0x419b('0x39')]({},_0x38b20d,_0x4dfb21['options']);var _0x47f548={'where':_0x38b20d[_0x419b('0x38')]};return db[_0x419b('0x3b')]['count'](_0x47f548)[_0x419b('0x20')](function(_0x5d8960){_0x558872[_0x419b('0x1b')]=_0x5d8960;if(_0x4dfb21[_0x419b('0x2d')][_0x419b('0x3c')]){_0x38b20d['include']=[{'all':!![]}];}return db[_0x419b('0x3b')][_0x419b('0x3d')](_0x38b20d);})[_0x419b('0x20')](function(_0x2698a3){_0x558872[_0x419b('0x3e')]=_0x2698a3;return _0x558872;})['then'](respondWithFilteredResult(_0x464e20,_0x38b20d))['catch'](handleError(_0x464e20,null));};exports[_0x419b('0x3f')]=function(_0x56c7fc,_0x397968){var _0x5157ea={'raw':!![],'where':{'id':_0x56c7fc[_0x419b('0x40')]['id']}},_0x1bc65a={};_0x1bc65a['model']=_[_0x419b('0x2e')](db[_0x419b('0x3b')][_0x419b('0x2a')]);_0x1bc65a['query']=_[_0x419b('0x2e')](_0x56c7fc[_0x419b('0x2d')]);_0x1bc65a['filters']=_[_0x419b('0x30')](_0x1bc65a[_0x419b('0x2c')],_0x1bc65a['query']);_0x5157ea[_0x419b('0x31')]=_[_0x419b('0x30')](_0x1bc65a[_0x419b('0x2c')],qs[_0x419b('0x32')](_0x56c7fc['query'][_0x419b('0x32')]));_0x5157ea['attributes']=_0x5157ea[_0x419b('0x31')][_0x419b('0x41')]?_0x5157ea[_0x419b('0x31')]:_0x1bc65a[_0x419b('0x2c')];if(_0x56c7fc[_0x419b('0x2d')]['includeAll']){_0x5157ea['include']=[{'all':!![]}];}_0x5157ea=_['merge']({},_0x5157ea,_0x56c7fc[_0x419b('0x42')]);return db[_0x419b('0x3b')][_0x419b('0x43')](_0x5157ea)['then'](handleEntityNotFound(_0x397968,null))[_0x419b('0x20')](respondWithResult(_0x397968,null))[_0x419b('0x44')](handleError(_0x397968,null));};exports['create']=function(_0x3064d0,_0x2c5284){return db[_0x419b('0x3b')][_0x419b('0x45')](_0x3064d0[_0x419b('0x46')],{})[_0x419b('0x20')](function(_0x8055d5){var _0x4621ca=_0x3064d0[_0x419b('0x47')][_0x419b('0x22')]({'plain':!![]});if(!_0x4621ca)throw new Error(_0x419b('0x48'));if(_0x4621ca[_0x419b('0x49')]===_0x419b('0x47')){var _0x3215ad=_0x8055d5[_0x419b('0x22')]({'plain':!![]});var _0x2d3bdd=_0x419b('0x23');return db['UserProfileSection']['find']({'where':{'name':_0x2d3bdd,'userProfileId':_0x4621ca[_0x419b('0x4a')]},'raw':!![]})[_0x419b('0x20')](function(_0x51aa5e){if(_0x51aa5e&&_0x51aa5e[_0x419b('0x4b')]===0x0){return db[_0x419b('0x24')][_0x419b('0x45')]({'name':_0x3215ad[_0x419b('0x27')],'resourceId':_0x3215ad['id'],'type':_0x51aa5e['name'],'sectionId':_0x51aa5e['id']},{})['then'](function(){return _0x8055d5;});}else{return _0x8055d5;}})['catch'](function(_0x1fbf71){logger['error'](_0x419b('0x4c'),_0x1fbf71);throw _0x1fbf71;});}return _0x8055d5;})[_0x419b('0x20')](respondWithResult(_0x2c5284,0xc9))['catch'](handleError(_0x2c5284,null));};exports[_0x419b('0x4d')]=function(_0x38fa16,_0x27d614){if(_0x38fa16['body']['id']){delete _0x38fa16[_0x419b('0x46')]['id'];}return db['MailQueue']['find']({'where':{'id':_0x38fa16[_0x419b('0x40')]['id']}})[_0x419b('0x20')](handleEntityNotFound(_0x27d614,null))[_0x419b('0x20')](saveUpdates(_0x38fa16[_0x419b('0x46')],null))[_0x419b('0x20')](respondWithResult(_0x27d614,null))[_0x419b('0x44')](handleError(_0x27d614,null));};exports[_0x419b('0x21')]=function(_0x4ef125,_0x20e2e6){return db[_0x419b('0x3b')]['find']({'where':{'id':_0x4ef125[_0x419b('0x40')]['id']}})[_0x419b('0x20')](handleEntityNotFound(_0x20e2e6,null))[_0x419b('0x20')](removeEntity(_0x20e2e6,null))[_0x419b('0x44')](handleError(_0x20e2e6,null));};exports[_0x419b('0x4e')]=function(_0x572868,_0x316804){return db['MailQueue'][_0x419b('0x4e')]()[_0x419b('0x20')](respondWithResult(_0x316804,null))[_0x419b('0x44')](handleError(_0x316804,null));};exports['getMembers']=function(_0x3b6124,_0x22c536,_0x1c752d){var _0x5bd06d={'raw':!![],'where':{}},_0x6c3084={},_0x10840a;return db[_0x419b('0x3b')][_0x419b('0x4f')]({'where':{'id':_0x3b6124['params']['id']}})[_0x419b('0x20')](handleEntityNotFound(_0x22c536,null))['then'](function(_0x4bc9db){if(_0x4bc9db){_0x10840a=_0x4bc9db[_0x419b('0x22')]({'plain':!![]});_0x6c3084['model']=_[_0x419b('0x2e')](db[_0x419b('0x50')][_0x419b('0x2a')]);_0x6c3084[_0x419b('0x2d')]=_[_0x419b('0x2e')](_0x3b6124[_0x419b('0x2d')]);_0x6c3084[_0x419b('0x2f')]=_[_0x419b('0x30')](_0x6c3084[_0x419b('0x2c')],_0x6c3084['query']);_0x5bd06d[_0x419b('0x31')]=_[_0x419b('0x30')](_0x6c3084[_0x419b('0x2c')],qs[_0x419b('0x32')](_0x3b6124[_0x419b('0x2d')][_0x419b('0x32')]));_0x5bd06d[_0x419b('0x31')]=_0x5bd06d['attributes']['length']?_0x5bd06d[_0x419b('0x31')]:_0x6c3084[_0x419b('0x2c')];if(!_0x3b6124[_0x419b('0x2d')][_0x419b('0x33')](_0x419b('0x34'))){_0x5bd06d['limit']=qs[_0x419b('0x1d')](_0x3b6124[_0x419b('0x2d')][_0x419b('0x1d')]);_0x5bd06d[_0x419b('0x1c')]=qs['offset'](_0x3b6124['query'][_0x419b('0x1c')]);}_0x5bd06d[_0x419b('0x35')]=qs[_0x419b('0x51')](_0x3b6124[_0x419b('0x2d')]['sort']);_0x5bd06d[_0x419b('0x38')]=qs[_0x419b('0x2f')](_['pick'](_0x3b6124['query'],_0x6c3084[_0x419b('0x2f')]));_0x5bd06d['where'][_0x419b('0x52')]=_0x4bc9db['id'];if(_0x3b6124[_0x419b('0x2d')][_0x419b('0x37')]){_0x5bd06d[_0x419b('0x38')]=_[_0x419b('0x39')](_0x5bd06d[_0x419b('0x38')],{'$or':_[_0x419b('0x29')](_0x5bd06d[_0x419b('0x31')],function(_0xf276a6){var _0x275496={};_0x275496[_0xf276a6]={'$like':'%'+_0x3b6124[_0x419b('0x2d')][_0x419b('0x37')]+'%'};return _0x275496;})});}_0x5bd06d=_[_0x419b('0x39')]({},_0x5bd06d,_0x3b6124[_0x419b('0x42')]);return db[_0x419b('0x50')][_0x419b('0x3d')](_0x5bd06d);}})[_0x419b('0x20')](function(_0x4b7df6){if(_0x4b7df6){return db['User'][_0x419b('0x53')]({'where':{'id':_[_0x419b('0x29')](_0x4b7df6,_0x419b('0x54')),'role':'agent'},'attributes':['id',_0x419b('0x27'),'mailPause','updatedAt',_0x419b('0x55')]});}})[_0x419b('0x20')](function(_0x4c6b40){if(_0x4c6b40){return{'count':_0x4c6b40['count'],'rows':_[_0x419b('0x29')](_0x4c6b40[_0x419b('0x3e')],function(_0x52b602){return{'membername':_0x52b602[_0x419b('0x27')],'UserId':_0x52b602['id'],'queue_name':_0x10840a[_0x419b('0x27')],'MailQueueId':_0x10840a['id'],'interface':util['format'](_0x419b('0x56'),_0x419b('0x57'),_0x52b602['name']),'penalty':0x0,'paused':_0x52b602[_0x419b('0x58')],'createdAt':_0x52b602[_0x419b('0x55')],'updatedAt':_0x52b602[_0x419b('0x59')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x419b('0x20')](respondWithFilteredResult(_0x22c536,_0x5bd06d))[_0x419b('0x44')](handleError(_0x22c536,null));};exports[_0x419b('0x5a')]=function(_0x335cf0,_0xd31d39,_0x1efb56){var _0x8f1a05={};var _0x1e8eb7={};var _0xed6f58;var _0x172b87;return db[_0x419b('0x3b')][_0x419b('0x4f')]({'where':{'id':_0x335cf0[_0x419b('0x40')]['id']}})[_0x419b('0x20')](handleEntityNotFound(_0xd31d39,null))['then'](function(_0x4cf088){if(_0x4cf088){_0xed6f58=_0x4cf088;_0x1e8eb7['model']=_['keys'](db['Team'][_0x419b('0x2a')]);_0x1e8eb7[_0x419b('0x2d')]=_[_0x419b('0x2e')](_0x335cf0[_0x419b('0x2d')]);_0x1e8eb7['filters']=_['intersection'](_0x1e8eb7[_0x419b('0x2c')],_0x1e8eb7[_0x419b('0x2d')]);_0x8f1a05['attributes']=_[_0x419b('0x30')](_0x1e8eb7['model'],qs[_0x419b('0x32')](_0x335cf0[_0x419b('0x2d')]['fields']));_0x8f1a05[_0x419b('0x31')]=_0x8f1a05[_0x419b('0x31')][_0x419b('0x41')]?_0x8f1a05['attributes']:_0x1e8eb7['model'];_0x8f1a05[_0x419b('0x35')]=qs[_0x419b('0x51')](_0x335cf0[_0x419b('0x2d')][_0x419b('0x51')]);_0x8f1a05['where']=qs[_0x419b('0x2f')](_[_0x419b('0x36')](_0x335cf0[_0x419b('0x2d')],_0x1e8eb7['filters']));if(_0x335cf0[_0x419b('0x2d')][_0x419b('0x37')]){_0x8f1a05[_0x419b('0x38')]=_[_0x419b('0x39')](_0x8f1a05[_0x419b('0x38')],{'$or':_[_0x419b('0x29')](_0x8f1a05[_0x419b('0x31')],function(_0x40e300){var _0x133e7d={};_0x133e7d[_0x40e300]={'$like':'%'+_0x335cf0[_0x419b('0x2d')][_0x419b('0x37')]+'%'};return _0x133e7d;})});}_0x8f1a05=_[_0x419b('0x39')]({},_0x8f1a05,_0x335cf0[_0x419b('0x42')]);return _0xed6f58[_0x419b('0x5a')](_0x8f1a05);}})[_0x419b('0x20')](function(_0x439ee1){if(_0x439ee1){_0x172b87=_0x439ee1[_0x419b('0x41')];if(!_0x335cf0[_0x419b('0x2d')]['hasOwnProperty']('nolimit')){_0x8f1a05[_0x419b('0x1d')]=qs[_0x419b('0x1d')](_0x335cf0['query']['limit']);_0x8f1a05[_0x419b('0x1c')]=qs['offset'](_0x335cf0[_0x419b('0x2d')][_0x419b('0x1c')]);}return _0xed6f58[_0x419b('0x5a')](_0x8f1a05);}})[_0x419b('0x20')](function(_0x311ec8){if(_0x311ec8){return _0x311ec8?{'count':_0x172b87,'rows':_0x311ec8}:null;}})['then'](respondWithResult(_0xd31d39,null))[_0x419b('0x44')](handleError(_0xd31d39,null));};exports[_0x419b('0x5b')]=function(_0x2aee09,_0x1a07cf,_0x44a7e8){var _0x1088ac=_0x2aee09[_0x419b('0x46')]['ids'];return db[_0x419b('0x5c')][_0x419b('0x3d')]({'where':{'id':_0x1088ac},'attributes':['id'],'include':[{'model':db[_0x419b('0x5d')],'as':_0x419b('0x5e'),'attributes':['id',_0x419b('0x27'),_0x419b('0x5f'),_0x419b('0x60'),_0x419b('0x61')],'raw':!![]}]})['then'](function(_0x1bb6bb){if(_0x1bb6bb){var _0x59a762=_[_0x419b('0x62')](_0x1bb6bb,function(_0x7dc246){var _0x239a17=_0x7dc246[_0x419b('0x22')]({'plain':!![]});return _0x239a17['Agents'];});return db[_0x419b('0x3b')]['find']({'where':{'id':_0x2aee09[_0x419b('0x40')]['id']}})[_0x419b('0x20')](function(_0x4ceff4){return db[_0x419b('0x63')]['transaction'](function(_0x44c373){return _0x4ceff4[_0x419b('0x5b')](_0x1088ac,{'transaction':_0x44c373})[_0x419b('0x20')](function(){return BPromise['each'](_0x59a762,function(_0x2bfbec){return db[_0x419b('0x50')]['findOrCreate']({'where':{'UserId':_0x2bfbec['id'],'MailQueueId':_0x2aee09['params']['id']},'transaction':_0x44c373});});})[_0x419b('0x20')](function(){_0x59a762[_0x419b('0x64')](function(_0x49a151){socket[_0x419b('0x65')](_0x419b('0x66'),{'UserId':_0x49a151['id'],'MailQueueId':_0x4ceff4['id']});});});});});}})['then'](respondWithStatusCode(_0x1a07cf,null))[_0x419b('0x44')](handleError(_0x1a07cf,null));};exports[_0x419b('0x67')]=function(_0x2175f7,_0x2e007a,_0x3e4473){return db[_0x419b('0x5c')][_0x419b('0x3d')]({'where':{'id':_0x2175f7[_0x419b('0x2d')][_0x419b('0x68')]},'attributes':['id'],'include':[{'model':db[_0x419b('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2e007a,null))[_0x419b('0x20')](function(_0x2d7655){var _0x59abaf=_[_0x419b('0x29')](_0x2d7655,'id');var _0x2b5729=[];var _0x347b69=[];var _0x4aa17a=squel[_0x419b('0x69')]();_0x4aa17a['field']('tq.TeamId')['from'](_0x419b('0x6a'),'tq')['join'](_0x419b('0x6b'),'ut',_0x419b('0x6c'))[_0x419b('0x38')](_0x419b('0x6d'),_0x2175f7['params']['id']);for(var _0xcfb0e=0x0;_0xcfb0e<_0x2d7655['length'];_0xcfb0e+=0x1){let _0x128ff4=_0x2d7655[_0xcfb0e];for(var _0x2571ba=0x0;_0x2571ba<_0x128ff4[_0x419b('0x5e')][_0x419b('0x41')];_0x2571ba+=0x1){let _0x513aba=_0x128ff4[_0x419b('0x5e')][_0x2571ba];var _0xa1b335=_0x4aa17a['clone']();_0xa1b335[_0x419b('0x38')](_0x419b('0x6e'),_0x513aba['id']);_0x347b69['push'](db[_0x419b('0x63')][_0x419b('0x2d')](_0xa1b335[_0x419b('0x6f')](),{'type':db[_0x419b('0x63')]['QueryTypes']['SELECT']})['then'](function(_0x5a83b6){if(_0x5a83b6[_0x419b('0x41')]===0x1){return _0x513aba['id'];}else{var _0x43ab91=_[_0x419b('0x70')](_[_0x419b('0x29')](_0x5a83b6,_0x419b('0x71')),function(_0x47612e){return _[_0x419b('0x72')](_0x59abaf,_0x47612e);});if(_0x43ab91){return _0x513aba['id'];}}}));}}return BPromise[_0x419b('0x73')](_0x347b69)['then'](function(_0x1c44c7){_0x2b5729=_(_0x2b5729)[_0x419b('0x74')](_0x1c44c7)['compact']()[_0x419b('0x75')]();return db[_0x419b('0x3b')][_0x419b('0x43')]({'where':{'id':_0x2175f7['params']['id']}})[_0x419b('0x20')](function(_0x444898){return db[_0x419b('0x63')][_0x419b('0x76')](function(_0x2ea280){return _0x444898[_0x419b('0x67')](_0x2175f7[_0x419b('0x2d')][_0x419b('0x68')],{'transaction':_0x2ea280})[_0x419b('0x20')](function(){if(!_[_0x419b('0x77')](_0x2b5729)){return _0x444898[_0x419b('0x78')](_0x2b5729,{'transaction':_0x2ea280});}})[_0x419b('0x20')](function(){_0x2b5729[_0x419b('0x64')](function(_0x51eaca){socket[_0x419b('0x65')](_0x419b('0x79'),{'UserId':_0x51eaca,'MailQueueId':_0x444898['id']});});});});});});})[_0x419b('0x20')](respondWithStatusCode(_0x2e007a,null))[_0x419b('0x44')](handleError(_0x2e007a,null));};exports[_0x419b('0x7a')]=function(_0x4e0f1a,_0xbe306f,_0x35e010){return db['MailQueue'][_0x419b('0x43')]({'where':{'id':_0x4e0f1a[_0x419b('0x40')]['id']}})[_0x419b('0x20')](handleEntityNotFound(_0xbe306f,null))['then'](function(_0x889b76){if(_0x889b76){return _0x889b76['addAgents'](_0x4e0f1a[_0x419b('0x46')][_0x419b('0x68')],_['omit'](_0x4e0f1a['body'],[_0x419b('0x68'),'id'])||{})['spread'](function(_0x5b1ee9){for(var _0x3e7a35=0x0;_0x3e7a35<_0x4e0f1a['body'][_0x419b('0x68')][_0x419b('0x41')];_0x3e7a35+=0x1){socket[_0x419b('0x65')](_0x419b('0x66'),{'UserId':_0x4e0f1a['body'][_0x419b('0x68')][_0x3e7a35],'MailQueueId':_0x4e0f1a[_0x419b('0x40')]['id']});}return _0x5b1ee9;});}})[_0x419b('0x20')](respondWithResult(_0xbe306f,null))[_0x419b('0x44')](handleError(_0xbe306f,null));};exports[_0x419b('0x78')]=function(_0x2d001b,_0x24474a,_0x41f871){return db[_0x419b('0x3b')]['find']({'where':{'id':_0x2d001b[_0x419b('0x40')]['id']}})[_0x419b('0x20')](handleEntityNotFound(_0x24474a,null))['then'](function(_0x5e023b){if(_0x5e023b){return _0x5e023b[_0x419b('0x78')](_0x2d001b[_0x419b('0x2d')][_0x419b('0x68')])[_0x419b('0x20')](function(){if(_[_0x419b('0x7b')](_0x2d001b['query'][_0x419b('0x68')])){for(var _0x1318f2=0x0;_0x1318f2<_0x2d001b[_0x419b('0x2d')]['ids']['length'];_0x1318f2+=0x1){socket[_0x419b('0x65')](_0x419b('0x79'),{'UserId':Number(_0x2d001b[_0x419b('0x2d')]['ids'][_0x1318f2]),'MailQueueId':Number(_0x2d001b[_0x419b('0x40')]['id'])});}}else{socket[_0x419b('0x65')]('userMailQueue:remove',{'UserId':Number(_0x2d001b[_0x419b('0x2d')][_0x419b('0x68')]),'MailQueueId':Number(_0x2d001b[_0x419b('0x40')]['id'])});}});}})[_0x419b('0x20')](respondWithStatusCode(_0x24474a,null))[_0x419b('0x44')](handleError(_0x24474a,null));};exports['getAgents']=function(_0xbff5c2,_0x43b088,_0x4039f8){var _0x2772c8={};var _0x5ba12e={};var _0x894cfc;var _0x309925;return db['MailQueue'][_0x419b('0x4f')]({'where':{'id':_0xbff5c2[_0x419b('0x40')]['id']}})['then'](handleEntityNotFound(_0x43b088,null))[_0x419b('0x20')](function(_0x3686ab){if(_0x3686ab){_0x894cfc=_0x3686ab;_0x5ba12e['model']=_[_0x419b('0x2e')](db[_0x419b('0x5d')][_0x419b('0x2a')]);_0x5ba12e[_0x419b('0x2d')]=_[_0x419b('0x2e')](_0xbff5c2[_0x419b('0x2d')]);_0x5ba12e['filters']=_[_0x419b('0x30')](_0x5ba12e['model'],_0x5ba12e[_0x419b('0x2d')]);_0x2772c8['attributes']=_[_0x419b('0x30')](_0x5ba12e[_0x419b('0x2c')],qs[_0x419b('0x32')](_0xbff5c2[_0x419b('0x2d')]['fields']));_0x2772c8['attributes']=_0x2772c8[_0x419b('0x31')][_0x419b('0x41')]?_0x2772c8[_0x419b('0x31')]:_0x5ba12e[_0x419b('0x2c')];_0x2772c8[_0x419b('0x35')]=qs[_0x419b('0x51')](_0xbff5c2[_0x419b('0x2d')][_0x419b('0x51')]);_0x2772c8['where']=qs['filters'](_['pick'](_0xbff5c2[_0x419b('0x2d')],_0x5ba12e['filters']));if(_0xbff5c2[_0x419b('0x2d')][_0x419b('0x37')]){_0x2772c8[_0x419b('0x38')]=_[_0x419b('0x39')](_0x2772c8[_0x419b('0x38')],{'$or':_[_0x419b('0x29')](_0x2772c8[_0x419b('0x31')],function(_0x30ce71){var _0x4be938={};_0x4be938[_0x30ce71]={'$like':'%'+_0xbff5c2['query'][_0x419b('0x37')]+'%'};return _0x4be938;})});}_0x2772c8=_[_0x419b('0x39')]({},_0x2772c8,_0xbff5c2['options']);return _0x894cfc[_0x419b('0x7c')](_0x2772c8);}})[_0x419b('0x20')](function(_0x4d4a65){if(_0x4d4a65){_0x309925=_0x4d4a65[_0x419b('0x41')];if(!_0xbff5c2['query'][_0x419b('0x33')](_0x419b('0x34'))){_0x2772c8[_0x419b('0x1d')]=qs[_0x419b('0x1d')](_0xbff5c2[_0x419b('0x2d')][_0x419b('0x1d')]);_0x2772c8[_0x419b('0x1c')]=qs['offset'](_0xbff5c2['query']['offset']);}return _0x894cfc[_0x419b('0x7c')](_0x2772c8);}})['then'](function(_0x135829){if(_0x135829){return _0x135829?{'count':_0x309925,'rows':_0x135829}:null;}})[_0x419b('0x20')](respondWithResult(_0x43b088,null))[_0x419b('0x44')](handleError(_0x43b088,null));}; \ No newline at end of file +var _0x302d=['flatMap','sequelize','transaction','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','removeAgents','userMailQueue:remove','addAgents','omit','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','set','Content-Range','update','then','destroy','get','MailQueues','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','VIRTUAL','filter','options','MailQueue','count','includeAll','include','findAll','catch','show','keys','length','merge','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','UserMailQueue','MailQueueId','User','findAndCountAll','agent','mailPause','updatedAt','createdAt','rows','format','%s/%s','SIP','findOne','Team','pick','getTeams','addTeams','ids','Agents','voicePause'];(function(_0x4b5475,_0x4a29b6){var _0x35ed79=function(_0x15b9ac){while(--_0x15b9ac){_0x4b5475['push'](_0x4b5475['shift']());}};_0x35ed79(++_0x4a29b6);}(_0x302d,0xa7));var _0xd302=function(_0x3b2a92,_0x49e6fe){_0x3b2a92=_0x3b2a92-0x0;var _0x23928f=_0x302d[_0x3b2a92];return _0x23928f;};'use strict';var pdf=require(_0xd302('0x0'));var emlformat=require(_0xd302('0x1'));var rimraf=require(_0xd302('0x2'));var zipdir=require(_0xd302('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd302('0x4'));var moment=require(_0xd302('0x5'));var BPromise=require(_0xd302('0x6'));var Mustache=require('mustache');var util=require(_0xd302('0x7'));var path=require(_0xd302('0x8'));var sox=require('sox');var csv=require(_0xd302('0x9'));var ejs=require(_0xd302('0xa'));var fs=require('fs');var _=require(_0xd302('0xb'));var squel=require(_0xd302('0xc'));var crypto=require(_0xd302('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd302('0xe'));var toCsv=require(_0xd302('0x9'));var querystring=require(_0xd302('0xf'));var Papa=require(_0xd302('0x10'));var Redis=require(_0xd302('0x11'));var authService=require(_0xd302('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd302('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd302('0x14'))(_0xd302('0x15'));var utils=require(_0xd302('0x16'));var config=require(_0xd302('0x17'));var db=require(_0xd302('0x18'))['db'];config[_0xd302('0x19')]=_[_0xd302('0x1a')](config[_0xd302('0x19')],{'host':_0xd302('0x1b'),'port':0x18eb});var socket=require(_0xd302('0x1c'))(new Redis(config[_0xd302('0x19')]));require('./mailQueue.socket')[_0xd302('0x1d')](socket);function respondWithStatusCode(_0x5cd30f,_0x3f9f27){_0x3f9f27=_0x3f9f27||0xcc;return function(_0x580efb){if(_0x580efb){return _0x5cd30f[_0xd302('0x1e')](_0x3f9f27);}return _0x5cd30f[_0xd302('0x1f')](_0x3f9f27)[_0xd302('0x20')]();};}function respondWithResult(_0x49ca73,_0x3a032f){_0x3a032f=_0x3a032f||0xc8;return function(_0x42ddc9){if(_0x42ddc9){return _0x49ca73['status'](_0x3a032f)[_0xd302('0x21')](_0x42ddc9);}};}function respondWithFilteredResult(_0xa550f8,_0x667772){return function(_0x4c7c60){if(_0x4c7c60){var _0x99b1dd=_0x4c7c60['count'],_0x9a2d19=_0x667772['offset'],_0x1f136d=_0x667772[_0xd302('0x22')]+_0x667772['limit'],_0x9977ab;if(_0x1f136d>=_0x99b1dd){_0x1f136d=_0x99b1dd;_0x9977ab=0xc8;}else{_0x9977ab=0xce;}_0xa550f8['status'](_0x9977ab);return _0xa550f8[_0xd302('0x23')](_0xd302('0x24'),_0x9a2d19+'-'+_0x1f136d+'/'+_0x99b1dd)[_0xd302('0x21')](_0x4c7c60);}return null;};}function patchUpdates(_0x347c75){return function(_0x429230){try{jsonpatch['apply'](_0x429230,_0x347c75,!![]);}catch(_0x2671b9){return BPromise['reject'](_0x2671b9);}return _0x429230['save']();};}function saveUpdates(_0x5adc6d,_0x585ccb){return function(_0x234671){if(_0x234671){return _0x234671[_0xd302('0x25')](_0x5adc6d)[_0xd302('0x26')](function(_0xd9da9b){return _0xd9da9b;});}return null;};}function removeEntity(_0x44f0f7,_0x28e333){return function(_0x32baa7){if(_0x32baa7){return _0x32baa7[_0xd302('0x27')]()[_0xd302('0x26')](function(){var _0x220ff8=_0x32baa7[_0xd302('0x28')]({'plain':!![]});var _0x367f3a=_0xd302('0x29');return db[_0xd302('0x2a')][_0xd302('0x27')]({'where':{'type':_0x367f3a,'resourceId':_0x220ff8['id']}})[_0xd302('0x26')](function(){return _0x32baa7;});})[_0xd302('0x26')](function(){_0x44f0f7[_0xd302('0x1f')](0xcc)[_0xd302('0x20')]();});}};}function handleEntityNotFound(_0x10154e,_0x1a1482){return function(_0x1f9773){if(!_0x1f9773){_0x10154e['sendStatus'](0x194);}return _0x1f9773;};}function handleError(_0x532a7c,_0x4b5565){_0x4b5565=_0x4b5565||0x1f4;return function(_0x21b5ff){logger[_0xd302('0x2b')](_0x21b5ff[_0xd302('0x2c')]);if(_0x21b5ff['name']){delete _0x21b5ff[_0xd302('0x2d')];}_0x532a7c[_0xd302('0x1f')](_0x4b5565)['send'](_0x21b5ff);};}exports[_0xd302('0x2e')]=function(_0x10913e,_0x4e4f95){var _0x74ff89={},_0x55af69={},_0x4caa1d={'count':0x0,'rows':[]};var _0xb7dd23=_[_0xd302('0x2f')](db['MailQueue'][_0xd302('0x30')],function(_0xb1c536){return{'name':_0xb1c536[_0xd302('0x31')],'type':_0xb1c536[_0xd302('0x32')]['key']};});_0x55af69[_0xd302('0x33')]=_[_0xd302('0x2f')](_0xb7dd23,_0xd302('0x2d'));_0x55af69[_0xd302('0x34')]=_['keys'](_0x10913e['query']);_0x55af69[_0xd302('0x35')]=_['intersection'](_0x55af69[_0xd302('0x33')],_0x55af69['query']);_0x74ff89['attributes']=_[_0xd302('0x36')](_0x55af69[_0xd302('0x33')],qs[_0xd302('0x37')](_0x10913e[_0xd302('0x34')]['fields']));_0x74ff89['attributes']=_0x74ff89[_0xd302('0x38')]['length']?_0x74ff89[_0xd302('0x38')]:_0x55af69[_0xd302('0x33')];if(!_0x10913e[_0xd302('0x34')][_0xd302('0x39')](_0xd302('0x3a'))){_0x74ff89[_0xd302('0x3b')]=qs[_0xd302('0x3b')](_0x10913e[_0xd302('0x34')]['limit']);_0x74ff89[_0xd302('0x22')]=qs[_0xd302('0x22')](_0x10913e[_0xd302('0x34')][_0xd302('0x22')]);}_0x74ff89[_0xd302('0x3c')]=qs[_0xd302('0x3d')](_0x10913e[_0xd302('0x34')][_0xd302('0x3d')]);_0x74ff89[_0xd302('0x3e')]=qs[_0xd302('0x35')](_['pick'](_0x10913e['query'],_0x55af69[_0xd302('0x35')]),_0xb7dd23);if(_0x10913e[_0xd302('0x34')]['filter']){_0x74ff89[_0xd302('0x3e')]=_['merge'](_0x74ff89[_0xd302('0x3e')],{'$or':_[_0xd302('0x2f')](_0xb7dd23,function(_0x10b140){if(_0x10b140[_0xd302('0x32')]!==_0xd302('0x3f')){var _0x434801={};_0x434801[_0x10b140['name']]={'$like':'%'+_0x10913e[_0xd302('0x34')][_0xd302('0x40')]+'%'};return _0x434801;}})});}_0x74ff89=_['merge']({},_0x74ff89,_0x10913e[_0xd302('0x41')]);var _0x2b8303={'where':_0x74ff89['where']};return db[_0xd302('0x42')]['count'](_0x2b8303)[_0xd302('0x26')](function(_0x4e00b1){_0x4caa1d[_0xd302('0x43')]=_0x4e00b1;if(_0x10913e[_0xd302('0x34')][_0xd302('0x44')]){_0x74ff89[_0xd302('0x45')]=[{'all':!![]}];}return db[_0xd302('0x42')][_0xd302('0x46')](_0x74ff89);})[_0xd302('0x26')](function(_0x72a067){_0x4caa1d['rows']=_0x72a067;return _0x4caa1d;})[_0xd302('0x26')](respondWithFilteredResult(_0x4e4f95,_0x74ff89))[_0xd302('0x47')](handleError(_0x4e4f95,null));};exports[_0xd302('0x48')]=function(_0x55651a,_0x1dcdce){var _0x1b748f={'raw':!![],'where':{'id':_0x55651a['params']['id']}},_0x5f5721={};_0x5f5721['model']=_[_0xd302('0x49')](db[_0xd302('0x42')][_0xd302('0x30')]);_0x5f5721[_0xd302('0x34')]=_['keys'](_0x55651a[_0xd302('0x34')]);_0x5f5721[_0xd302('0x35')]=_[_0xd302('0x36')](_0x5f5721['model'],_0x5f5721[_0xd302('0x34')]);_0x1b748f[_0xd302('0x38')]=_[_0xd302('0x36')](_0x5f5721['model'],qs['fields'](_0x55651a['query'][_0xd302('0x37')]));_0x1b748f[_0xd302('0x38')]=_0x1b748f[_0xd302('0x38')][_0xd302('0x4a')]?_0x1b748f[_0xd302('0x38')]:_0x5f5721[_0xd302('0x33')];if(_0x55651a['query'][_0xd302('0x44')]){_0x1b748f['include']=[{'all':!![]}];}_0x1b748f=_[_0xd302('0x4b')]({},_0x1b748f,_0x55651a['options']);return db['MailQueue'][_0xd302('0x4c')](_0x1b748f)[_0xd302('0x26')](handleEntityNotFound(_0x1dcdce,null))[_0xd302('0x26')](respondWithResult(_0x1dcdce,null))[_0xd302('0x47')](handleError(_0x1dcdce,null));};exports[_0xd302('0x4d')]=function(_0x5be3b5,_0x37c905){return db[_0xd302('0x42')][_0xd302('0x4d')](_0x5be3b5['body'],{})[_0xd302('0x26')](function(_0x58d2fc){var _0x2c910c=_0x5be3b5['user']['get']({'plain':!![]});if(!_0x2c910c)throw new Error(_0xd302('0x4e'));if(_0x2c910c[_0xd302('0x4f')]===_0xd302('0x50')){var _0x308287=_0x58d2fc[_0xd302('0x28')]({'plain':!![]});var _0x17458c='MailQueues';return db[_0xd302('0x51')][_0xd302('0x4c')]({'where':{'name':_0x17458c,'userProfileId':_0x2c910c[_0xd302('0x52')]},'raw':!![]})[_0xd302('0x26')](function(_0x3905ed){if(_0x3905ed&&_0x3905ed[_0xd302('0x53')]===0x0){return db[_0xd302('0x2a')][_0xd302('0x4d')]({'name':_0x308287[_0xd302('0x2d')],'resourceId':_0x308287['id'],'type':_0x3905ed[_0xd302('0x2d')],'sectionId':_0x3905ed['id']},{})[_0xd302('0x26')](function(){return _0x58d2fc;});}else{return _0x58d2fc;}})[_0xd302('0x47')](function(_0x5ba8e8){logger['error'](_0xd302('0x54'),_0x5ba8e8);throw _0x5ba8e8;});}return _0x58d2fc;})[_0xd302('0x26')](respondWithResult(_0x37c905,0xc9))['catch'](handleError(_0x37c905,null));};exports[_0xd302('0x25')]=function(_0x4a7461,_0x2b9464){if(_0x4a7461[_0xd302('0x55')]['id']){delete _0x4a7461[_0xd302('0x55')]['id'];}return db['MailQueue']['find']({'where':{'id':_0x4a7461['params']['id']}})[_0xd302('0x26')](handleEntityNotFound(_0x2b9464,null))[_0xd302('0x26')](saveUpdates(_0x4a7461[_0xd302('0x55')],null))[_0xd302('0x26')](respondWithResult(_0x2b9464,null))[_0xd302('0x47')](handleError(_0x2b9464,null));};exports['destroy']=function(_0x422640,_0x10f6ca){return db[_0xd302('0x42')][_0xd302('0x4c')]({'where':{'id':_0x422640[_0xd302('0x56')]['id']}})['then'](handleEntityNotFound(_0x10f6ca,null))['then'](removeEntity(_0x10f6ca,null))['catch'](handleError(_0x10f6ca,null));};exports[_0xd302('0x57')]=function(_0x313c9b,_0x47c98c){return db[_0xd302('0x42')][_0xd302('0x57')]()[_0xd302('0x26')](respondWithResult(_0x47c98c,null))['catch'](handleError(_0x47c98c,null));};exports[_0xd302('0x58')]=function(_0x18b641,_0x22808f,_0x5a3ccf){var _0x528aff={'raw':!![],'where':{}},_0x46b00c={},_0x33ee0a;return db['MailQueue']['findOne']({'where':{'id':_0x18b641['params']['id']}})[_0xd302('0x26')](handleEntityNotFound(_0x22808f,null))[_0xd302('0x26')](function(_0x456358){if(_0x456358){_0x33ee0a=_0x456358[_0xd302('0x28')]({'plain':!![]});_0x46b00c['model']=_[_0xd302('0x49')](db[_0xd302('0x59')][_0xd302('0x30')]);_0x46b00c['query']=_['keys'](_0x18b641[_0xd302('0x34')]);_0x46b00c[_0xd302('0x35')]=_[_0xd302('0x36')](_0x46b00c[_0xd302('0x33')],_0x46b00c[_0xd302('0x34')]);_0x528aff[_0xd302('0x38')]=_[_0xd302('0x36')](_0x46b00c[_0xd302('0x33')],qs['fields'](_0x18b641[_0xd302('0x34')][_0xd302('0x37')]));_0x528aff[_0xd302('0x38')]=_0x528aff[_0xd302('0x38')][_0xd302('0x4a')]?_0x528aff[_0xd302('0x38')]:_0x46b00c[_0xd302('0x33')];if(!_0x18b641[_0xd302('0x34')]['hasOwnProperty'](_0xd302('0x3a'))){_0x528aff[_0xd302('0x3b')]=qs[_0xd302('0x3b')](_0x18b641['query']['limit']);_0x528aff[_0xd302('0x22')]=qs['offset'](_0x18b641['query']['offset']);}_0x528aff['order']=qs[_0xd302('0x3d')](_0x18b641[_0xd302('0x34')]['sort']);_0x528aff['where']=qs[_0xd302('0x35')](_['pick'](_0x18b641[_0xd302('0x34')],_0x46b00c[_0xd302('0x35')]));_0x528aff['where'][_0xd302('0x5a')]=_0x456358['id'];if(_0x18b641[_0xd302('0x34')]['filter']){_0x528aff['where']=_[_0xd302('0x4b')](_0x528aff[_0xd302('0x3e')],{'$or':_[_0xd302('0x2f')](_0x528aff['attributes'],function(_0x185c23){var _0x46c60f={};_0x46c60f[_0x185c23]={'$like':'%'+_0x18b641[_0xd302('0x34')][_0xd302('0x40')]+'%'};return _0x46c60f;})});}_0x528aff=_[_0xd302('0x4b')]({},_0x528aff,_0x18b641['options']);return db['UserMailQueue'][_0xd302('0x46')](_0x528aff);}})['then'](function(_0x1adb01){if(_0x1adb01){return db[_0xd302('0x5b')][_0xd302('0x5c')]({'where':{'id':_['map'](_0x1adb01,'UserId'),'role':_0xd302('0x5d')},'attributes':['id',_0xd302('0x2d'),_0xd302('0x5e'),_0xd302('0x5f'),_0xd302('0x60')]});}})['then'](function(_0x4a90fb){if(_0x4a90fb){return{'count':_0x4a90fb[_0xd302('0x43')],'rows':_[_0xd302('0x2f')](_0x4a90fb[_0xd302('0x61')],function(_0x28f38c){return{'membername':_0x28f38c[_0xd302('0x2d')],'UserId':_0x28f38c['id'],'queue_name':_0x33ee0a['name'],'MailQueueId':_0x33ee0a['id'],'interface':util[_0xd302('0x62')](_0xd302('0x63'),_0xd302('0x64'),_0x28f38c[_0xd302('0x2d')]),'penalty':0x0,'paused':_0x28f38c['mailPause'],'createdAt':_0x28f38c[_0xd302('0x60')],'updatedAt':_0x28f38c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x22808f,_0x528aff))['catch'](handleError(_0x22808f,null));};exports['getTeams']=function(_0x391cf6,_0x142238,_0x1183b2){var _0x77c14d={};var _0x54ed85={};var _0x496d9c;var _0x423b7c;return db[_0xd302('0x42')][_0xd302('0x65')]({'where':{'id':_0x391cf6['params']['id']}})[_0xd302('0x26')](handleEntityNotFound(_0x142238,null))['then'](function(_0x27a749){if(_0x27a749){_0x496d9c=_0x27a749;_0x54ed85[_0xd302('0x33')]=_[_0xd302('0x49')](db[_0xd302('0x66')][_0xd302('0x30')]);_0x54ed85['query']=_['keys'](_0x391cf6[_0xd302('0x34')]);_0x54ed85[_0xd302('0x35')]=_[_0xd302('0x36')](_0x54ed85[_0xd302('0x33')],_0x54ed85[_0xd302('0x34')]);_0x77c14d[_0xd302('0x38')]=_[_0xd302('0x36')](_0x54ed85[_0xd302('0x33')],qs[_0xd302('0x37')](_0x391cf6['query'][_0xd302('0x37')]));_0x77c14d[_0xd302('0x38')]=_0x77c14d['attributes'][_0xd302('0x4a')]?_0x77c14d[_0xd302('0x38')]:_0x54ed85[_0xd302('0x33')];_0x77c14d['order']=qs['sort'](_0x391cf6[_0xd302('0x34')][_0xd302('0x3d')]);_0x77c14d[_0xd302('0x3e')]=qs[_0xd302('0x35')](_[_0xd302('0x67')](_0x391cf6[_0xd302('0x34')],_0x54ed85['filters']));if(_0x391cf6[_0xd302('0x34')][_0xd302('0x40')]){_0x77c14d[_0xd302('0x3e')]=_[_0xd302('0x4b')](_0x77c14d['where'],{'$or':_[_0xd302('0x2f')](_0x77c14d['attributes'],function(_0x4ce570){var _0x34527a={};_0x34527a[_0x4ce570]={'$like':'%'+_0x391cf6['query']['filter']+'%'};return _0x34527a;})});}_0x77c14d=_[_0xd302('0x4b')]({},_0x77c14d,_0x391cf6['options']);return _0x496d9c['getTeams'](_0x77c14d);}})[_0xd302('0x26')](function(_0x49ea3b){if(_0x49ea3b){_0x423b7c=_0x49ea3b[_0xd302('0x4a')];if(!_0x391cf6[_0xd302('0x34')][_0xd302('0x39')](_0xd302('0x3a'))){_0x77c14d[_0xd302('0x3b')]=qs['limit'](_0x391cf6[_0xd302('0x34')][_0xd302('0x3b')]);_0x77c14d['offset']=qs[_0xd302('0x22')](_0x391cf6[_0xd302('0x34')][_0xd302('0x22')]);}return _0x496d9c[_0xd302('0x68')](_0x77c14d);}})['then'](function(_0x5d4f96){if(_0x5d4f96){return _0x5d4f96?{'count':_0x423b7c,'rows':_0x5d4f96}:null;}})['then'](respondWithResult(_0x142238,null))[_0xd302('0x47')](handleError(_0x142238,null));};exports[_0xd302('0x69')]=function(_0x528110,_0x4348e6,_0x1b25ef){var _0x54ebbb=_0x528110[_0xd302('0x55')][_0xd302('0x6a')];return db[_0xd302('0x66')][_0xd302('0x46')]({'where':{'id':_0x54ebbb},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd302('0x6b'),'attributes':['id','name','online',_0xd302('0x6c'),'interface'],'raw':!![]}]})[_0xd302('0x26')](function(_0x205e82){if(_0x205e82){var _0x442c96=_[_0xd302('0x6d')](_0x205e82,function(_0x45ac2f){var _0x2fc16f=_0x45ac2f[_0xd302('0x28')]({'plain':!![]});return _0x2fc16f[_0xd302('0x6b')];});return db[_0xd302('0x42')]['find']({'where':{'id':_0x528110[_0xd302('0x56')]['id']}})[_0xd302('0x26')](function(_0x32ea01){return db[_0xd302('0x6e')][_0xd302('0x6f')](function(_0x3be924){return _0x32ea01[_0xd302('0x69')](_0x54ebbb,{'transaction':_0x3be924})['then'](function(){return BPromise['each'](_0x442c96,function(_0x5ab589){return db[_0xd302('0x59')]['findOrCreate']({'where':{'UserId':_0x5ab589['id'],'MailQueueId':_0x528110[_0xd302('0x56')]['id']},'transaction':_0x3be924});});})[_0xd302('0x26')](function(){_0x442c96['forEach'](function(_0x2538ef){socket[_0xd302('0x70')](_0xd302('0x71'),{'UserId':_0x2538ef['id'],'MailQueueId':_0x32ea01['id']});});});});});}})[_0xd302('0x26')](respondWithStatusCode(_0x4348e6,null))[_0xd302('0x47')](handleError(_0x4348e6,null));};exports[_0xd302('0x72')]=function(_0x4a32ce,_0x1c2cf0,_0x33cf1d){return db[_0xd302('0x66')][_0xd302('0x46')]({'where':{'id':_0x4a32ce[_0xd302('0x34')][_0xd302('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xd302('0x5b')],'as':_0xd302('0x6b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1c2cf0,null))[_0xd302('0x26')](function(_0x46e8eb){var _0x532a3c=_[_0xd302('0x2f')](_0x46e8eb,'id');var _0x934d3b=[];var _0x52e2c0=[];var _0x260139=squel[_0xd302('0x73')]();_0x260139[_0xd302('0x74')](_0xd302('0x75'))['from'](_0xd302('0x76'),'tq')[_0xd302('0x77')](_0xd302('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xd302('0x3e')](_0xd302('0x79'),_0x4a32ce[_0xd302('0x56')]['id']);for(var _0x3c95e0=0x0;_0x3c95e0<_0x46e8eb[_0xd302('0x4a')];_0x3c95e0+=0x1){let _0x4fbdda=_0x46e8eb[_0x3c95e0];for(var _0x290e2b=0x0;_0x290e2b<_0x4fbdda[_0xd302('0x6b')][_0xd302('0x4a')];_0x290e2b+=0x1){let _0xad9a41=_0x4fbdda['Agents'][_0x290e2b];var _0x326c9a=_0x260139[_0xd302('0x7a')]();_0x326c9a[_0xd302('0x3e')]('ut.UserId\x20=\x20?',_0xad9a41['id']);_0x52e2c0['push'](db[_0xd302('0x6e')][_0xd302('0x34')](_0x326c9a[_0xd302('0x7b')](),{'type':db[_0xd302('0x6e')][_0xd302('0x7c')][_0xd302('0x7d')]})[_0xd302('0x26')](function(_0x39cfbd){if(_0x39cfbd['length']===0x1){return _0xad9a41['id'];}else{var _0x504255=_[_0xd302('0x7e')](_[_0xd302('0x2f')](_0x39cfbd,_0xd302('0x7f')),function(_0x220c8e){return _[_0xd302('0x80')](_0x532a3c,_0x220c8e);});if(_0x504255){return _0xad9a41['id'];}}}));}}return BPromise[_0xd302('0x81')](_0x52e2c0)['then'](function(_0x51a65a){_0x934d3b=_(_0x934d3b)[_0xd302('0x82')](_0x51a65a)[_0xd302('0x83')]()['value']();return db[_0xd302('0x42')][_0xd302('0x4c')]({'where':{'id':_0x4a32ce[_0xd302('0x56')]['id']}})['then'](function(_0x2b8c6b){return db[_0xd302('0x6e')]['transaction'](function(_0x5a60b1){return _0x2b8c6b[_0xd302('0x72')](_0x4a32ce[_0xd302('0x34')][_0xd302('0x6a')],{'transaction':_0x5a60b1})['then'](function(){if(!_['isEmpty'](_0x934d3b)){return _0x2b8c6b[_0xd302('0x84')](_0x934d3b,{'transaction':_0x5a60b1});}})['then'](function(){_0x934d3b['forEach'](function(_0x4d13bb){socket[_0xd302('0x70')](_0xd302('0x85'),{'UserId':_0x4d13bb,'MailQueueId':_0x2b8c6b['id']});});});});});});})[_0xd302('0x26')](respondWithStatusCode(_0x1c2cf0,null))['catch'](handleError(_0x1c2cf0,null));};exports[_0xd302('0x86')]=function(_0x555ce6,_0x4cefc6,_0x1d67a3){return db[_0xd302('0x42')][_0xd302('0x4c')]({'where':{'id':_0x555ce6[_0xd302('0x56')]['id']}})[_0xd302('0x26')](handleEntityNotFound(_0x4cefc6,null))[_0xd302('0x26')](function(_0x2078de){if(_0x2078de){return _0x2078de[_0xd302('0x86')](_0x555ce6[_0xd302('0x55')][_0xd302('0x6a')],_[_0xd302('0x87')](_0x555ce6[_0xd302('0x55')],[_0xd302('0x6a'),'id'])||{})['spread'](function(_0x5218e8){for(var _0x3f404b=0x0;_0x3f404b<_0x555ce6['body']['ids'][_0xd302('0x4a')];_0x3f404b+=0x1){socket['emit'](_0xd302('0x71'),{'UserId':_0x555ce6[_0xd302('0x55')][_0xd302('0x6a')][_0x3f404b],'MailQueueId':_0x555ce6['params']['id']});}return _0x5218e8;});}})[_0xd302('0x26')](respondWithResult(_0x4cefc6,null))['catch'](handleError(_0x4cefc6,null));};exports[_0xd302('0x84')]=function(_0x6f9b9b,_0x221f0e,_0x51e532){return db[_0xd302('0x42')]['find']({'where':{'id':_0x6f9b9b[_0xd302('0x56')]['id']}})[_0xd302('0x26')](handleEntityNotFound(_0x221f0e,null))['then'](function(_0x40b226){if(_0x40b226){return _0x40b226[_0xd302('0x84')](_0x6f9b9b[_0xd302('0x34')]['ids'])[_0xd302('0x26')](function(){if(_[_0xd302('0x88')](_0x6f9b9b[_0xd302('0x34')][_0xd302('0x6a')])){for(var _0x15f873=0x0;_0x15f873<_0x6f9b9b['query']['ids'][_0xd302('0x4a')];_0x15f873+=0x1){socket[_0xd302('0x70')](_0xd302('0x85'),{'UserId':Number(_0x6f9b9b[_0xd302('0x34')][_0xd302('0x6a')][_0x15f873]),'MailQueueId':Number(_0x6f9b9b[_0xd302('0x56')]['id'])});}}else{socket[_0xd302('0x70')](_0xd302('0x85'),{'UserId':Number(_0x6f9b9b[_0xd302('0x34')][_0xd302('0x6a')]),'MailQueueId':Number(_0x6f9b9b['params']['id'])});}});}})[_0xd302('0x26')](respondWithStatusCode(_0x221f0e,null))[_0xd302('0x47')](handleError(_0x221f0e,null));};exports[_0xd302('0x89')]=function(_0x2f6edf,_0xb6444b,_0x1ed91c){var _0x338b42={};var _0x49d377={};var _0x20af88;var _0x8ffb5e;return db[_0xd302('0x42')][_0xd302('0x65')]({'where':{'id':_0x2f6edf['params']['id']}})[_0xd302('0x26')](handleEntityNotFound(_0xb6444b,null))[_0xd302('0x26')](function(_0x2131a4){if(_0x2131a4){_0x20af88=_0x2131a4;_0x49d377[_0xd302('0x33')]=_[_0xd302('0x49')](db['User'][_0xd302('0x30')]);_0x49d377[_0xd302('0x34')]=_[_0xd302('0x49')](_0x2f6edf['query']);_0x49d377['filters']=_[_0xd302('0x36')](_0x49d377['model'],_0x49d377[_0xd302('0x34')]);_0x338b42['attributes']=_[_0xd302('0x36')](_0x49d377[_0xd302('0x33')],qs[_0xd302('0x37')](_0x2f6edf[_0xd302('0x34')][_0xd302('0x37')]));_0x338b42['attributes']=_0x338b42[_0xd302('0x38')][_0xd302('0x4a')]?_0x338b42[_0xd302('0x38')]:_0x49d377[_0xd302('0x33')];_0x338b42[_0xd302('0x3c')]=qs[_0xd302('0x3d')](_0x2f6edf[_0xd302('0x34')][_0xd302('0x3d')]);_0x338b42['where']=qs['filters'](_[_0xd302('0x67')](_0x2f6edf[_0xd302('0x34')],_0x49d377[_0xd302('0x35')]));if(_0x2f6edf[_0xd302('0x34')][_0xd302('0x40')]){_0x338b42[_0xd302('0x3e')]=_['merge'](_0x338b42[_0xd302('0x3e')],{'$or':_[_0xd302('0x2f')](_0x338b42[_0xd302('0x38')],function(_0x110bcb){var _0x2f8dee={};_0x2f8dee[_0x110bcb]={'$like':'%'+_0x2f6edf[_0xd302('0x34')]['filter']+'%'};return _0x2f8dee;})});}_0x338b42=_[_0xd302('0x4b')]({},_0x338b42,_0x2f6edf[_0xd302('0x41')]);return _0x20af88[_0xd302('0x89')](_0x338b42);}})[_0xd302('0x26')](function(_0x1daee7){if(_0x1daee7){_0x8ffb5e=_0x1daee7['length'];if(!_0x2f6edf[_0xd302('0x34')]['hasOwnProperty']('nolimit')){_0x338b42[_0xd302('0x3b')]=qs[_0xd302('0x3b')](_0x2f6edf[_0xd302('0x34')][_0xd302('0x3b')]);_0x338b42[_0xd302('0x22')]=qs['offset'](_0x2f6edf[_0xd302('0x34')][_0xd302('0x22')]);}return _0x20af88[_0xd302('0x89')](_0x338b42);}})[_0xd302('0x26')](function(_0x2b6aa0){if(_0x2b6aa0){return _0x2b6aa0?{'count':_0x8ffb5e,'rows':_0x2b6aa0}:null;}})[_0xd302('0x26')](respondWithResult(_0xb6444b,null))[_0xd302('0x47')](handleError(_0xb6444b,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index b096841..370be92 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 _0xe7a8=['emit','hasOwnProperty','exports','events','setMaxListeners','save','update'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0xe7a8,0x1c3));var _0x8e7a=function(_0x2ffd05,_0x1840e3){_0x2ffd05=_0x2ffd05-0x0;var _0x5038bf=_0xe7a8[_0x2ffd05];return _0x5038bf;};'use strict';var EventEmitter=require(_0x8e7a('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x8e7a('0x1')](0x0);var events={'afterCreate':_0x8e7a('0x2'),'afterUpdate':_0x8e7a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x181855){return function(_0x5e20b0,_0x15bacf,_0x5c2fc0){MailQueueEvents[_0x8e7a('0x4')](_0x181855+':'+_0x5e20b0['id'],_0x5e20b0);MailQueueEvents[_0x8e7a('0x4')](_0x181855,_0x5e20b0);_0x5c2fc0(null);};}for(var e in events){if(events[_0x8e7a('0x5')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x8e7a('0x6')]=MailQueueEvents; \ No newline at end of file +var _0xdeb0=['exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit','hook'];(function(_0x9b163,_0x5d8c8f){var _0x824910=function(_0xe93c8){while(--_0xe93c8){_0x9b163['push'](_0x9b163['shift']());}};_0x824910(++_0x5d8c8f);}(_0xdeb0,0x1e1));var _0x0deb=function(_0x69e89e,_0x1fb302){_0x69e89e=_0x69e89e-0x0;var _0x39b87d=_0xdeb0[_0x69e89e];return _0x39b87d;};'use strict';var EventEmitter=require(_0x0deb('0x0'));var MailQueue=require(_0x0deb('0x1'))['db'][_0x0deb('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x0deb('0x3')](0x0);var events={'afterCreate':_0x0deb('0x4'),'afterUpdate':_0x0deb('0x5'),'afterDestroy':_0x0deb('0x6')};function emitEvent(_0x550871){return function(_0x1d6013,_0x10f57a,_0x5241c1){MailQueueEvents['emit'](_0x550871+':'+_0x1d6013['id'],_0x1d6013);MailQueueEvents[_0x0deb('0x7')](_0x550871,_0x1d6013);_0x5241c1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x0deb('0x8')](e,emitEvent(event));}}module[_0x0deb('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 6f61cbb..89d1130 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 _0x7f7d=['path','rimraf','../../config/environment','./mailQueue.attributes','exports','MailQueue','mail_queues','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x7f7d,0x1cf));var _0xd7f7=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x7f7d[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0xd7f7('0x0'));var util=require('util');var logger=require(_0xd7f7('0x1'))(_0xd7f7('0x2'));var moment=require('moment');var BPromise=require(_0xd7f7('0x3'));var rp=require(_0xd7f7('0x4'));var fs=require('fs');var path=require(_0xd7f7('0x5'));var rimraf=require(_0xd7f7('0x6'));var config=require(_0xd7f7('0x7'));var attributes=require(_0xd7f7('0x8'));module[_0xd7f7('0x9')]=function(_0x28938f,_0x5c256d){return _0x28938f['define'](_0xd7f7('0xa'),attributes,{'tableName':_0xd7f7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c1b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','define','mail_queues','lodash','util','../../config/logger'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x0c1b,0xf4));var _0xb0c1=function(_0x57a50d,_0x2871f8){_0x57a50d=_0x57a50d-0x0;var _0x1b25b3=_0x0c1b[_0x57a50d];return _0x1b25b3;};'use strict';var _=require(_0xb0c1('0x0'));var util=require(_0xb0c1('0x1'));var logger=require(_0xb0c1('0x2'))(_0xb0c1('0x3'));var moment=require(_0xb0c1('0x4'));var BPromise=require(_0xb0c1('0x5'));var rp=require(_0xb0c1('0x6'));var fs=require('fs');var path=require(_0xb0c1('0x7'));var rimraf=require(_0xb0c1('0x8'));var config=require(_0xb0c1('0x9'));var attributes=require(_0xb0c1('0xa'));module['exports']=function(_0x204b66,_0x8a03d1){return _0x204b66[_0xb0c1('0xb')]('MailQueue',attributes,{'tableName':_0xb0c1('0xc'),'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 cd5df31..a9e96b1 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 _0xd815=['where','attributes','limit','include','map','model','stringify','ShowMailQueue','MailQueue','find','raw','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','./mailQueue.socket','request','then','info','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','MailQueue,\x20%s,\x20%s','message','result','catch','GetMailQueue','findAll','options'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0xd815,0x19b));var _0x5d81=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd815[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5d81('0x0'));var util=require(_0x5d81('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5d81('0x2'));var fs=require('fs');var Redis=require(_0x5d81('0x3'));var db=require(_0x5d81('0x4'))['db'];var utils=require(_0x5d81('0x5'));var logger=require('../../config/logger')(_0x5d81('0x6'));var config=require(_0x5d81('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5d81('0x8')][_0x5d81('0x9')]({'port':0x232a});config['redis']=_[_0x5d81('0xa')](config[_0x5d81('0xb')],{'host':_0x5d81('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5d81('0xb')]));require(_0x5d81('0xd'))['register'](socket);function respondWithRpcPromise(_0x3dfcb1,_0x42bdf5,_0x327f5d){return new BPromise(function(_0x3e1a1c,_0x8092bd){return client[_0x5d81('0xe')](_0x3dfcb1,_0x327f5d)[_0x5d81('0xf')](function(_0x59e69c){logger[_0x5d81('0x10')]('MailQueue,\x20%s,\x20%s',_0x42bdf5,'request\x20sent');logger[_0x5d81('0x11')](_0x5d81('0x12'),_0x42bdf5,_0x5d81('0x13'),JSON['stringify'](_0x59e69c));if(_0x59e69c[_0x5d81('0x14')]){if(_0x59e69c[_0x5d81('0x14')][_0x5d81('0x15')]===0x1f4){logger[_0x5d81('0x14')](_0x5d81('0x16'),_0x42bdf5,_0x59e69c['error'][_0x5d81('0x17')]);return _0x8092bd(_0x59e69c['error'][_0x5d81('0x17')]);}logger[_0x5d81('0x14')]('MailQueue,\x20%s,\x20%s',_0x42bdf5,_0x59e69c[_0x5d81('0x14')]['message']);return _0x3e1a1c(_0x59e69c[_0x5d81('0x14')][_0x5d81('0x17')]);}else{logger[_0x5d81('0x10')](_0x5d81('0x16'),_0x42bdf5,_0x5d81('0x13'));_0x3e1a1c(_0x59e69c[_0x5d81('0x18')][_0x5d81('0x17')]);}})[_0x5d81('0x19')](function(_0x1beed3){logger['error'](_0x5d81('0x16'),_0x42bdf5,_0x1beed3);_0x8092bd(_0x1beed3);});});}exports[_0x5d81('0x1a')]=function(_0x21a677){var _0x4a58a4=this;return new Promise(function(_0x2b4c87,_0x1315e1){return db['MailQueue'][_0x5d81('0x1b')]({'raw':_0x21a677[_0x5d81('0x1c')]?_0x21a677[_0x5d81('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x21a677['options']?_0x21a677['options'][_0x5d81('0x1d')]||null:null,'attributes':_0x21a677[_0x5d81('0x1c')]?_0x21a677['options'][_0x5d81('0x1e')]||null:null,'limit':_0x21a677[_0x5d81('0x1c')]?_0x21a677[_0x5d81('0x1c')][_0x5d81('0x1f')]||null:null,'include':_0x21a677[_0x5d81('0x1c')]?_0x21a677[_0x5d81('0x1c')][_0x5d81('0x20')]?_[_0x5d81('0x21')](_0x21a677[_0x5d81('0x1c')][_0x5d81('0x20')],function(_0x2c1b1b){return{'model':db[_0x2c1b1b[_0x5d81('0x22')]],'as':_0x2c1b1b['as'],'attributes':_0x2c1b1b[_0x5d81('0x1e')],'include':_0x2c1b1b[_0x5d81('0x20')]?_[_0x5d81('0x21')](_0x2c1b1b[_0x5d81('0x20')],function(_0x983759){return{'model':db[_0x983759[_0x5d81('0x22')]],'as':_0x983759['as'],'attributes':_0x983759[_0x5d81('0x1e')],'include':_0x983759[_0x5d81('0x20')]?_[_0x5d81('0x21')](_0x983759['include'],function(_0x570cf7){return{'model':db[_0x570cf7[_0x5d81('0x22')]],'as':_0x570cf7['as'],'attributes':_0x570cf7[_0x5d81('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa99f4e){logger[_0x5d81('0x10')](_0x5d81('0x1a'),_0x21a677);logger[_0x5d81('0x11')](_0x5d81('0x1a'),_0x21a677,JSON[_0x5d81('0x23')](_0xa99f4e));_0x2b4c87(_0xa99f4e);})['catch'](function(_0x535134){logger[_0x5d81('0x14')](_0x5d81('0x1a'),_0x535134[_0x5d81('0x17')],_0x21a677);_0x1315e1(_0x4a58a4[_0x5d81('0x14')](0x1f4,_0x535134[_0x5d81('0x17')]));});});};exports[_0x5d81('0x24')]=function(_0x3073f0){var _0x987b17=this;return new Promise(function(_0x11f69b,_0x1f3966){return db[_0x5d81('0x25')][_0x5d81('0x26')]({'raw':_0x3073f0[_0x5d81('0x1c')]?_0x3073f0[_0x5d81('0x1c')][_0x5d81('0x27')]===undefined?!![]:![]:!![],'where':_0x3073f0[_0x5d81('0x1c')]?_0x3073f0[_0x5d81('0x1c')][_0x5d81('0x1d')]||null:null,'attributes':_0x3073f0[_0x5d81('0x1c')]?_0x3073f0['options']['attributes']||null:null,'include':_0x3073f0[_0x5d81('0x1c')]?_0x3073f0['options'][_0x5d81('0x20')]?_[_0x5d81('0x21')](_0x3073f0[_0x5d81('0x1c')][_0x5d81('0x20')],function(_0x323033){return{'model':db[_0x323033[_0x5d81('0x22')]],'as':_0x323033['as'],'attributes':_0x323033['attributes'],'include':_0x323033[_0x5d81('0x20')]?_['map'](_0x323033['include'],function(_0x1d4d82){return{'model':db[_0x1d4d82[_0x5d81('0x22')]],'as':_0x1d4d82['as'],'attributes':_0x1d4d82[_0x5d81('0x1e')],'include':_0x1d4d82[_0x5d81('0x20')]?_[_0x5d81('0x21')](_0x1d4d82[_0x5d81('0x20')],function(_0x5331a5){return{'model':db[_0x5331a5['model']],'as':_0x5331a5['as'],'attributes':_0x5331a5[_0x5d81('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5d81('0xf')](function(_0x1c35d5){logger['info'](_0x5d81('0x24'),_0x3073f0);logger[_0x5d81('0x11')](_0x5d81('0x24'),_0x3073f0,JSON[_0x5d81('0x23')](_0x1c35d5));_0x11f69b(_0x1c35d5);})[_0x5d81('0x19')](function(_0x5e0260){logger[_0x5d81('0x14')](_0x5d81('0x24'),_0x5e0260[_0x5d81('0x17')],_0x3073f0);_0x1f3966(_0x987b17['error'](0x1f4,_0x5e0260[_0x5d81('0x17')]));});});}; \ No newline at end of file +var _0x87d4=['request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMailQueue','MailQueue','findAll','options','raw','limit','include','map','model','attributes','debug','ShowMailQueue','find','where','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x87d4,0x15f));var _0x487d=function(_0x141afe,_0x15ef01){_0x141afe=_0x141afe-0x0;var _0x25db06=_0x87d4[_0x141afe];return _0x25db06;};'use strict';var _=require(_0x487d('0x0'));var util=require(_0x487d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x487d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x487d('0x3'));var logger=require(_0x487d('0x4'))(_0x487d('0x5'));var config=require(_0x487d('0x6'));var jayson=require(_0x487d('0x7'));var client=jayson['client'][_0x487d('0x8')]({'port':0x232a});config['redis']=_[_0x487d('0x9')](config[_0x487d('0xa')],{'host':_0x487d('0xb'),'port':0x18eb});var socket=require(_0x487d('0xc'))(new Redis(config['redis']));require(_0x487d('0xd'))[_0x487d('0xe')](socket);function respondWithRpcPromise(_0x18e7ed,_0x3f08a7,_0x1281be){return new BPromise(function(_0x4e7d3c,_0x430f9d){return client[_0x487d('0xf')](_0x18e7ed,_0x1281be)[_0x487d('0x10')](function(_0x5a888b){logger['info'](_0x487d('0x11'),_0x3f08a7,_0x487d('0x12'));logger['debug'](_0x487d('0x13'),_0x3f08a7,_0x487d('0x12'),JSON[_0x487d('0x14')](_0x5a888b));if(_0x5a888b[_0x487d('0x15')]){if(_0x5a888b['error'][_0x487d('0x16')]===0x1f4){logger[_0x487d('0x15')]('MailQueue,\x20%s,\x20%s',_0x3f08a7,_0x5a888b[_0x487d('0x15')]['message']);return _0x430f9d(_0x5a888b[_0x487d('0x15')][_0x487d('0x17')]);}logger['error'](_0x487d('0x11'),_0x3f08a7,_0x5a888b[_0x487d('0x15')]['message']);return _0x4e7d3c(_0x5a888b['error']['message']);}else{logger[_0x487d('0x18')]('MailQueue,\x20%s,\x20%s',_0x3f08a7,_0x487d('0x12'));_0x4e7d3c(_0x5a888b[_0x487d('0x19')][_0x487d('0x17')]);}})[_0x487d('0x1a')](function(_0x2142fc){logger[_0x487d('0x15')](_0x487d('0x11'),_0x3f08a7,_0x2142fc);_0x430f9d(_0x2142fc);});});}exports[_0x487d('0x1b')]=function(_0x515e41){var _0x54887a=this;return new Promise(function(_0x533fad,_0x3f36dd){return db[_0x487d('0x1c')][_0x487d('0x1d')]({'raw':_0x515e41[_0x487d('0x1e')]?_0x515e41[_0x487d('0x1e')][_0x487d('0x1f')]===undefined?!![]:![]:!![],'where':_0x515e41[_0x487d('0x1e')]?_0x515e41['options']['where']||null:null,'attributes':_0x515e41[_0x487d('0x1e')]?_0x515e41['options']['attributes']||null:null,'limit':_0x515e41[_0x487d('0x1e')]?_0x515e41['options'][_0x487d('0x20')]||null:null,'include':_0x515e41[_0x487d('0x1e')]?_0x515e41[_0x487d('0x1e')][_0x487d('0x21')]?_[_0x487d('0x22')](_0x515e41[_0x487d('0x1e')][_0x487d('0x21')],function(_0x4453b4){return{'model':db[_0x4453b4[_0x487d('0x23')]],'as':_0x4453b4['as'],'attributes':_0x4453b4['attributes'],'include':_0x4453b4[_0x487d('0x21')]?_[_0x487d('0x22')](_0x4453b4['include'],function(_0x5937e7){return{'model':db[_0x5937e7[_0x487d('0x23')]],'as':_0x5937e7['as'],'attributes':_0x5937e7[_0x487d('0x24')],'include':_0x5937e7['include']?_['map'](_0x5937e7[_0x487d('0x21')],function(_0x54a3fa){return{'model':db[_0x54a3fa[_0x487d('0x23')]],'as':_0x54a3fa['as'],'attributes':_0x54a3fa[_0x487d('0x24')]};}):[]};}):[]};}):[]:[]})[_0x487d('0x10')](function(_0x2af07f){logger['info']('GetMailQueue',_0x515e41);logger[_0x487d('0x25')](_0x487d('0x1b'),_0x515e41,JSON[_0x487d('0x14')](_0x2af07f));_0x533fad(_0x2af07f);})[_0x487d('0x1a')](function(_0x4b2a10){logger[_0x487d('0x15')](_0x487d('0x1b'),_0x4b2a10[_0x487d('0x17')],_0x515e41);_0x3f36dd(_0x54887a[_0x487d('0x15')](0x1f4,_0x4b2a10[_0x487d('0x17')]));});});};exports[_0x487d('0x26')]=function(_0x3b0546){var _0x44beef=this;return new Promise(function(_0x47acbb,_0xe2528d){return db['MailQueue'][_0x487d('0x27')]({'raw':_0x3b0546['options']?_0x3b0546['options'][_0x487d('0x1f')]===undefined?!![]:![]:!![],'where':_0x3b0546[_0x487d('0x1e')]?_0x3b0546[_0x487d('0x1e')][_0x487d('0x28')]||null:null,'attributes':_0x3b0546[_0x487d('0x1e')]?_0x3b0546[_0x487d('0x1e')][_0x487d('0x24')]||null:null,'include':_0x3b0546[_0x487d('0x1e')]?_0x3b0546['options'][_0x487d('0x21')]?_[_0x487d('0x22')](_0x3b0546[_0x487d('0x1e')][_0x487d('0x21')],function(_0x15fdcd){return{'model':db[_0x15fdcd['model']],'as':_0x15fdcd['as'],'attributes':_0x15fdcd[_0x487d('0x24')],'include':_0x15fdcd[_0x487d('0x21')]?_['map'](_0x15fdcd[_0x487d('0x21')],function(_0x51f0c5){return{'model':db[_0x51f0c5[_0x487d('0x23')]],'as':_0x51f0c5['as'],'attributes':_0x51f0c5[_0x487d('0x24')],'include':_0x51f0c5[_0x487d('0x21')]?_[_0x487d('0x22')](_0x51f0c5['include'],function(_0x58e3c3){return{'model':db[_0x58e3c3[_0x487d('0x23')]],'as':_0x58e3c3['as'],'attributes':_0x58e3c3['attributes']};}):[]};}):[]};}):[]:[]})[_0x487d('0x10')](function(_0x2d89fb){logger['info'](_0x487d('0x26'),_0x3b0546);logger['debug'](_0x487d('0x26'),_0x3b0546,JSON[_0x487d('0x14')](_0x2d89fb));_0x47acbb(_0x2d89fb);})['catch'](function(_0x28875d){logger[_0x487d('0x15')](_0x487d('0x26'),_0x28875d['message'],_0x3b0546);_0xe2528d(_0x44beef[_0x487d('0x15')](0x1f4,_0x28875d[_0x487d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index b2f9425..ae6dba0 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 _0xff7f=['update','emit','register','length','mailQueue:','./mailQueue.events','save','remove'];(function(_0x2d7ead,_0x48cb08){var _0x4ecf0e=function(_0xca9c69){while(--_0xca9c69){_0x2d7ead['push'](_0x2d7ead['shift']());}};_0x4ecf0e(++_0x48cb08);}(_0xff7f,0x85));var _0xfff7=function(_0x59cf8d,_0x2a541a){_0x59cf8d=_0x59cf8d-0x0;var _0x19bf67=_0xff7f[_0x59cf8d];return _0x19bf67;};'use strict';var MailQueueEvents=require(_0xfff7('0x0'));var events=[_0xfff7('0x1'),_0xfff7('0x2'),_0xfff7('0x3')];function createListener(_0xab59ad,_0x2bac6c){return function(_0x1593d7){_0x2bac6c[_0xfff7('0x4')](_0xab59ad,_0x1593d7);};}function removeListener(_0x526201,_0x5273ff){return function(){MailQueueEvents['removeListener'](_0x526201,_0x5273ff);};}exports[_0xfff7('0x5')]=function(_0x54d9d3){for(var _0x293c56=0x0,_0x7dddca=events[_0xfff7('0x6')];_0x293c56<_0x7dddca;_0x293c56++){var _0x284337=events[_0x293c56];var _0x4d1ef8=createListener(_0xfff7('0x7')+_0x284337,_0x54d9d3);MailQueueEvents['on'](_0x284337,_0x4d1ef8);}}; \ No newline at end of file +var _0xf9eb=['update','emit','removeListener','length','mailQueue:','./mailQueue.events','save','remove'];(function(_0x51c932,_0x8faff4){var _0x366261=function(_0x19497e){while(--_0x19497e){_0x51c932['push'](_0x51c932['shift']());}};_0x366261(++_0x8faff4);}(_0xf9eb,0x1c5));var _0xbf9e=function(_0x56bba4,_0x120555){_0x56bba4=_0x56bba4-0x0;var _0x5b2058=_0xf9eb[_0x56bba4];return _0x5b2058;};'use strict';var MailQueueEvents=require(_0xbf9e('0x0'));var events=[_0xbf9e('0x1'),_0xbf9e('0x2'),_0xbf9e('0x3')];function createListener(_0x321e1c,_0x4cfe38){return function(_0x41e736){_0x4cfe38[_0xbf9e('0x4')](_0x321e1c,_0x41e736);};}function removeListener(_0x3628f1,_0x10ebfd){return function(){MailQueueEvents[_0xbf9e('0x5')](_0x3628f1,_0x10ebfd);};}exports['register']=function(_0x56370f){for(var _0x39bd0b=0x0,_0x585894=events[_0xbf9e('0x6')];_0x39bd0b<_0x585894;_0x39bd0b++){var _0x6575fa=events[_0x39bd0b];var _0x2bf67b=createListener(_0xbf9e('0x7')+_0x6575fa,_0x56370f);MailQueueEvents['on'](_0x6575fa,_0x2bf67b);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index c567c24..2835906 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 _0x70e5=['../../components/interaction/service','./mailQueueReport.controller','isAuthenticated','/describe','describe','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2b22a1,_0x5cb33c){var _0x2a4af6=function(_0x268ec8){while(--_0x268ec8){_0x2b22a1['push'](_0x2b22a1['shift']());}};_0x2a4af6(++_0x5cb33c);}(_0x70e5,0xb7));var _0x570e=function(_0x17c241,_0x1bf660){_0x17c241=_0x17c241-0x0;var _0x472397=_0x70e5[_0x17c241];return _0x472397;};'use strict';var multer=require(_0x570e('0x0'));var util=require('util');var path=require(_0x570e('0x1'));var timeout=require(_0x570e('0x2'));var express=require(_0x570e('0x3'));var router=express[_0x570e('0x4')]();var auth=require(_0x570e('0x5'));var interaction=require(_0x570e('0x6'));var config=require('../../config/environment');var controller=require(_0x570e('0x7'));router['get']('/',auth[_0x570e('0x8')](),controller['index']);router['get'](_0x570e('0x9'),auth[_0x570e('0x8')](),controller[_0x570e('0xa')]);router[_0x570e('0xb')](_0x570e('0xc'),auth['isAuthenticated'](),controller[_0x570e('0xd')]);router[_0x570e('0xe')]('/',auth[_0x570e('0x8')](),controller[_0x570e('0xf')]);router[_0x570e('0x10')]('/:id',auth[_0x570e('0x8')](),controller[_0x570e('0x11')]);router[_0x570e('0x12')](_0x570e('0xc'),auth[_0x570e('0x8')](),controller[_0x570e('0x13')]);module[_0x570e('0x14')]=router; \ No newline at end of file +var _0xc5a6=['update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x2b7c60,_0x571983){var _0x103478=function(_0x56cf46){while(--_0x56cf46){_0x2b7c60['push'](_0x2b7c60['shift']());}};_0x103478(++_0x571983);}(_0xc5a6,0x1d0));var _0x6c5a=function(_0x3824d2,_0x2c6064){_0x3824d2=_0x3824d2-0x0;var _0x8a9e41=_0xc5a6[_0x3824d2];return _0x8a9e41;};'use strict';var multer=require(_0x6c5a('0x0'));var util=require('util');var path=require(_0x6c5a('0x1'));var timeout=require(_0x6c5a('0x2'));var express=require('express');var router=express[_0x6c5a('0x3')]();var auth=require(_0x6c5a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6c5a('0x5'));var controller=require(_0x6c5a('0x6'));router[_0x6c5a('0x7')]('/',auth[_0x6c5a('0x8')](),controller[_0x6c5a('0x9')]);router[_0x6c5a('0x7')](_0x6c5a('0xa'),auth[_0x6c5a('0x8')](),controller[_0x6c5a('0xb')]);router['get'](_0x6c5a('0xc'),auth[_0x6c5a('0x8')](),controller[_0x6c5a('0xd')]);router[_0x6c5a('0xe')]('/',auth[_0x6c5a('0x8')](),controller[_0x6c5a('0xf')]);router['put'](_0x6c5a('0xc'),auth[_0x6c5a('0x8')](),controller[_0x6c5a('0x10')]);router[_0x6c5a('0x11')](_0x6c5a('0xc'),auth[_0x6c5a('0x8')](),controller[_0x6c5a('0x12')]);module[_0x6c5a('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 13169c1..1f0abf6 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 _0x9b3d=['exports','STRING','DATE','sequelize'];(function(_0x4f4c81,_0x597e62){var _0x26beab=function(_0x5016e3){while(--_0x5016e3){_0x4f4c81['push'](_0x4f4c81['shift']());}};_0x26beab(++_0x597e62);}(_0x9b3d,0x77));var _0xd9b3=function(_0x593c1b,_0x35c524){_0x593c1b=_0x593c1b-0x0;var _0x4e0c07=_0x9b3d[_0x593c1b];return _0x4e0c07;};'use strict';var moment=require('moment');var Sequelize=require(_0xd9b3('0x0'));module[_0xd9b3('0x1')]={'uniqueid':{'type':Sequelize[_0xd9b3('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd9b3('0x2')]},'joinAt':{'type':Sequelize[_0xd9b3('0x3')]},'leaveAt':{'type':Sequelize[_0xd9b3('0x3')]},'acceptAt':{'type':Sequelize[_0xd9b3('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xd9b3('0x2')]}}; \ No newline at end of file +var _0x6137=['exports','STRING','DATE','moment','sequelize'];(function(_0x5ad777,_0x28b465){var _0x2a7ae8=function(_0x1578f2){while(--_0x1578f2){_0x5ad777['push'](_0x5ad777['shift']());}};_0x2a7ae8(++_0x28b465);}(_0x6137,0xe4));var _0x7613=function(_0x5b594b,_0x44fab3){_0x5b594b=_0x5b594b-0x0;var _0x4d3cc6=_0x6137[_0x5b594b];return _0x4d3cc6;};'use strict';var moment=require(_0x7613('0x0'));var Sequelize=require(_0x7613('0x1'));module[_0x7613('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x7613('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7613('0x4')]},'acceptAt':{'type':Sequelize[_0x7613('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7613('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 13a7035..bc5a4d1 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 _0xc012=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','error','stack','index','map','MailQueueReport','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','type','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','options','find','create','body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x290806,_0x130b8f){var _0x451b14=function(_0x45cd46){while(--_0x45cd46){_0x290806['push'](_0x290806['shift']());}};_0x451b14(++_0x130b8f);}(_0xc012,0x97));var _0x2c01=function(_0x20de39,_0x371da1){_0x20de39=_0x20de39-0x0;var _0x2ac9eb=_0xc012[_0x20de39];return _0x2ac9eb;};'use strict';var pdf=require(_0x2c01('0x0'));var emlformat=require(_0x2c01('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2c01('0x2'));var jsonpatch=require(_0x2c01('0x3'));var rp=require(_0x2c01('0x4'));var moment=require('moment');var BPromise=require(_0x2c01('0x5'));var Mustache=require(_0x2c01('0x6'));var util=require(_0x2c01('0x7'));var path=require(_0x2c01('0x8'));var sox=require(_0x2c01('0x9'));var csv=require(_0x2c01('0xa'));var ejs=require(_0x2c01('0xb'));var fs=require('fs');var _=require(_0x2c01('0xc'));var squel=require(_0x2c01('0xd'));var crypto=require(_0x2c01('0xe'));var jsforce=require(_0x2c01('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2c01('0x10'));var Papa=require(_0x2c01('0x11'));var Redis=require(_0x2c01('0x12'));var authService=require(_0x2c01('0x13'));var qs=require(_0x2c01('0x14'));var as=require(_0x2c01('0x15'));var hardwareService=require(_0x2c01('0x16'));var logger=require(_0x2c01('0x17'))(_0x2c01('0x18'));var utils=require(_0x2c01('0x19'));var config=require(_0x2c01('0x1a'));var db=require(_0x2c01('0x1b'))['db'];function respondWithStatusCode(_0x46b163,_0x425b51){_0x425b51=_0x425b51||0xcc;return function(_0x3cc5ea){if(_0x3cc5ea){return _0x46b163[_0x2c01('0x1c')](_0x425b51);}return _0x46b163[_0x2c01('0x1d')](_0x425b51)[_0x2c01('0x1e')]();};}function respondWithResult(_0x38aa82,_0x41b3cc){_0x41b3cc=_0x41b3cc||0xc8;return function(_0x206098){if(_0x206098){return _0x38aa82[_0x2c01('0x1d')](_0x41b3cc)[_0x2c01('0x1f')](_0x206098);}};}function respondWithFilteredResult(_0x472bce,_0x4c1c6a){return function(_0x27a079){if(_0x27a079){var _0x458ff9=_0x27a079[_0x2c01('0x20')],_0x47494b=_0x4c1c6a[_0x2c01('0x21')],_0x2ef888=_0x4c1c6a[_0x2c01('0x21')]+_0x4c1c6a[_0x2c01('0x22')],_0xbc37de;if(_0x2ef888>=_0x458ff9){_0x2ef888=_0x458ff9;_0xbc37de=0xc8;}else{_0xbc37de=0xce;}_0x472bce[_0x2c01('0x1d')](_0xbc37de);return _0x472bce[_0x2c01('0x23')](_0x2c01('0x24'),_0x47494b+'-'+_0x2ef888+'/'+_0x458ff9)['json'](_0x27a079);}return null;};}function patchUpdates(_0x1cac42){return function(_0x1c24c3){try{jsonpatch['apply'](_0x1c24c3,_0x1cac42,!![]);}catch(_0x2517b3){return BPromise[_0x2c01('0x25')](_0x2517b3);}return _0x1c24c3['save']();};}function saveUpdates(_0x3b8551,_0x37b66a){return function(_0x5e91e5){if(_0x5e91e5){return _0x5e91e5[_0x2c01('0x26')](_0x3b8551)[_0x2c01('0x27')](function(_0x2f8618){return _0x2f8618;});}return null;};}function removeEntity(_0x5a7f52,_0x51cc09){return function(_0x2596b8){if(_0x2596b8){return _0x2596b8['destroy']()[_0x2c01('0x27')](function(){_0x5a7f52['status'](0xcc)[_0x2c01('0x1e')]();});}};}function handleEntityNotFound(_0x59ecbc,_0x3eb676){return function(_0x3d7a85){if(!_0x3d7a85){_0x59ecbc[_0x2c01('0x1c')](0x194);}return _0x3d7a85;};}function handleError(_0x2970b6,_0x19df7e){_0x19df7e=_0x19df7e||0x1f4;return function(_0x549715){logger[_0x2c01('0x28')](_0x549715[_0x2c01('0x29')]);if(_0x549715['name']){delete _0x549715['name'];}_0x2970b6['status'](_0x19df7e)['send'](_0x549715);};}exports[_0x2c01('0x2a')]=function(_0x460636,_0x11b61a){var _0x1051a2={},_0x16d45b={},_0x53b695={'count':0x0,'rows':[]};var _0x22ff38=_[_0x2c01('0x2b')](db[_0x2c01('0x2c')][_0x2c01('0x2d')],function(_0x3e0075){return{'name':_0x3e0075[_0x2c01('0x2e')],'type':_0x3e0075['type'][_0x2c01('0x2f')]};});_0x16d45b[_0x2c01('0x30')]=_[_0x2c01('0x2b')](_0x22ff38,_0x2c01('0x31'));_0x16d45b[_0x2c01('0x32')]=_[_0x2c01('0x33')](_0x460636[_0x2c01('0x32')]);_0x16d45b[_0x2c01('0x34')]=_[_0x2c01('0x35')](_0x16d45b[_0x2c01('0x30')],_0x16d45b[_0x2c01('0x32')]);_0x1051a2[_0x2c01('0x36')]=_[_0x2c01('0x35')](_0x16d45b[_0x2c01('0x30')],qs[_0x2c01('0x37')](_0x460636[_0x2c01('0x32')][_0x2c01('0x37')]));_0x1051a2[_0x2c01('0x36')]=_0x1051a2[_0x2c01('0x36')][_0x2c01('0x38')]?_0x1051a2[_0x2c01('0x36')]:_0x16d45b[_0x2c01('0x30')];if(!_0x460636[_0x2c01('0x32')][_0x2c01('0x39')](_0x2c01('0x3a'))){_0x1051a2[_0x2c01('0x22')]=qs[_0x2c01('0x22')](_0x460636[_0x2c01('0x32')][_0x2c01('0x22')]);_0x1051a2[_0x2c01('0x21')]=qs[_0x2c01('0x21')](_0x460636[_0x2c01('0x32')]['offset']);}_0x1051a2[_0x2c01('0x3b')]=qs[_0x2c01('0x3c')](_0x460636[_0x2c01('0x32')]['sort']);_0x1051a2['where']=qs['filters'](_['pick'](_0x460636[_0x2c01('0x32')],_0x16d45b[_0x2c01('0x34')]),_0x22ff38);if(_0x460636[_0x2c01('0x32')][_0x2c01('0x3d')]){_0x1051a2[_0x2c01('0x3e')]=_['merge'](_0x1051a2[_0x2c01('0x3e')],{'$or':_[_0x2c01('0x2b')](_0x22ff38,function(_0x214ef6){if(_0x214ef6[_0x2c01('0x3f')]!==_0x2c01('0x40')){var _0x1a4ca1={};_0x1a4ca1[_0x214ef6[_0x2c01('0x31')]]={'$like':'%'+_0x460636[_0x2c01('0x32')][_0x2c01('0x3d')]+'%'};return _0x1a4ca1;}})});}_0x1051a2=_[_0x2c01('0x41')]({},_0x1051a2,_0x460636['options']);var _0x23a7b0={'where':_0x1051a2[_0x2c01('0x3e')]};return db[_0x2c01('0x2c')][_0x2c01('0x20')](_0x23a7b0)[_0x2c01('0x27')](function(_0x5bde06){_0x53b695['count']=_0x5bde06;if(_0x460636['query'][_0x2c01('0x42')]){_0x1051a2[_0x2c01('0x43')]=[{'all':!![]}];}return db[_0x2c01('0x2c')][_0x2c01('0x44')](_0x1051a2);})['then'](function(_0x26cd28){_0x53b695['rows']=_0x26cd28;return _0x53b695;})[_0x2c01('0x27')](respondWithFilteredResult(_0x11b61a,_0x1051a2))[_0x2c01('0x45')](handleError(_0x11b61a,null));};exports[_0x2c01('0x46')]=function(_0x2493d1,_0x5e3e67){var _0xbe281d={'raw':!![],'where':{'id':_0x2493d1[_0x2c01('0x47')]['id']}},_0x158805={};_0x158805['model']=_[_0x2c01('0x33')](db[_0x2c01('0x2c')][_0x2c01('0x2d')]);_0x158805['query']=_[_0x2c01('0x33')](_0x2493d1[_0x2c01('0x32')]);_0x158805[_0x2c01('0x34')]=_['intersection'](_0x158805[_0x2c01('0x30')],_0x158805[_0x2c01('0x32')]);_0xbe281d['attributes']=_['intersection'](_0x158805['model'],qs[_0x2c01('0x37')](_0x2493d1[_0x2c01('0x32')][_0x2c01('0x37')]));_0xbe281d[_0x2c01('0x36')]=_0xbe281d[_0x2c01('0x36')]['length']?_0xbe281d['attributes']:_0x158805[_0x2c01('0x30')];if(_0x2493d1[_0x2c01('0x32')][_0x2c01('0x42')]){_0xbe281d[_0x2c01('0x43')]=[{'all':!![]}];}_0xbe281d=_[_0x2c01('0x41')]({},_0xbe281d,_0x2493d1[_0x2c01('0x48')]);return db[_0x2c01('0x2c')][_0x2c01('0x49')](_0xbe281d)[_0x2c01('0x27')](handleEntityNotFound(_0x5e3e67,null))[_0x2c01('0x27')](respondWithResult(_0x5e3e67,null))[_0x2c01('0x45')](handleError(_0x5e3e67,null));};exports[_0x2c01('0x4a')]=function(_0x58cafa,_0xb67359){return db[_0x2c01('0x2c')][_0x2c01('0x4a')](_0x58cafa['body'],{})[_0x2c01('0x27')](respondWithResult(_0xb67359,0xc9))[_0x2c01('0x45')](handleError(_0xb67359,null));};exports[_0x2c01('0x26')]=function(_0x182312,_0x247977){if(_0x182312[_0x2c01('0x4b')]['id']){delete _0x182312['body']['id'];}return db[_0x2c01('0x2c')]['find']({'where':{'id':_0x182312['params']['id']}})['then'](handleEntityNotFound(_0x247977,null))[_0x2c01('0x27')](saveUpdates(_0x182312[_0x2c01('0x4b')],null))[_0x2c01('0x27')](respondWithResult(_0x247977,null))[_0x2c01('0x45')](handleError(_0x247977,null));};exports[_0x2c01('0x4c')]=function(_0x31190f,_0x1a7ab3){return db['MailQueueReport'][_0x2c01('0x49')]({'where':{'id':_0x31190f[_0x2c01('0x47')]['id']}})[_0x2c01('0x27')](handleEntityNotFound(_0x1a7ab3,null))[_0x2c01('0x27')](removeEntity(_0x1a7ab3,null))[_0x2c01('0x45')](handleError(_0x1a7ab3,null));};exports[_0x2c01('0x4d')]=function(_0x42bef1,_0x3dfc84){return db[_0x2c01('0x2c')][_0x2c01('0x4d')]()[_0x2c01('0x27')](respondWithResult(_0x3dfc84,null))[_0x2c01('0x45')](handleError(_0x3dfc84,null));}; \ No newline at end of file +var _0x83f1=['map','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','MailQueueReport','findAll','catch','intersection','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','stack','name','send'];(function(_0x2206fc,_0x1c184c){var _0x1861f1=function(_0x25114f){while(--_0x25114f){_0x2206fc['push'](_0x2206fc['shift']());}};_0x1861f1(++_0x1c184c);}(_0x83f1,0xa8));var _0x183f=function(_0x2f8746,_0x49f11e){_0x2f8746=_0x2f8746-0x0;var _0x15af93=_0x83f1[_0x2f8746];return _0x15af93;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x183f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x183f('0x1'));var jsonpatch=require(_0x183f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x183f('0x3'));var Mustache=require('mustache');var util=require(_0x183f('0x4'));var path=require(_0x183f('0x5'));var sox=require(_0x183f('0x6'));var csv=require(_0x183f('0x7'));var ejs=require(_0x183f('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x183f('0x9'));var crypto=require('crypto');var jsforce=require(_0x183f('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x183f('0xb'));var Redis=require(_0x183f('0xc'));var authService=require(_0x183f('0xd'));var qs=require(_0x183f('0xe'));var as=require(_0x183f('0xf'));var hardwareService=require(_0x183f('0x10'));var logger=require('../../config/logger')(_0x183f('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x183f('0x12'))['db'];function respondWithStatusCode(_0x36141d,_0x125f8c){_0x125f8c=_0x125f8c||0xcc;return function(_0x5c25eb){if(_0x5c25eb){return _0x36141d[_0x183f('0x13')](_0x125f8c);}return _0x36141d[_0x183f('0x14')](_0x125f8c)[_0x183f('0x15')]();};}function respondWithResult(_0x471f31,_0xfbafbb){_0xfbafbb=_0xfbafbb||0xc8;return function(_0x21155c){if(_0x21155c){return _0x471f31[_0x183f('0x14')](_0xfbafbb)[_0x183f('0x16')](_0x21155c);}};}function respondWithFilteredResult(_0x42eb68,_0x5ec14d){return function(_0x410293){if(_0x410293){var _0x5a6747=_0x410293[_0x183f('0x17')],_0x4a0d4f=_0x5ec14d[_0x183f('0x18')],_0x46289f=_0x5ec14d[_0x183f('0x18')]+_0x5ec14d[_0x183f('0x19')],_0x314eab;if(_0x46289f>=_0x5a6747){_0x46289f=_0x5a6747;_0x314eab=0xc8;}else{_0x314eab=0xce;}_0x42eb68['status'](_0x314eab);return _0x42eb68['set'](_0x183f('0x1a'),_0x4a0d4f+'-'+_0x46289f+'/'+_0x5a6747)[_0x183f('0x16')](_0x410293);}return null;};}function patchUpdates(_0x1db4db){return function(_0x5ca448){try{jsonpatch[_0x183f('0x1b')](_0x5ca448,_0x1db4db,!![]);}catch(_0x5097ca){return BPromise[_0x183f('0x1c')](_0x5097ca);}return _0x5ca448[_0x183f('0x1d')]();};}function saveUpdates(_0x32780b,_0x3addd4){return function(_0x1ad46a){if(_0x1ad46a){return _0x1ad46a[_0x183f('0x1e')](_0x32780b)['then'](function(_0x210244){return _0x210244;});}return null;};}function removeEntity(_0x2a7c3c,_0x11cdae){return function(_0x26950a){if(_0x26950a){return _0x26950a[_0x183f('0x1f')]()[_0x183f('0x20')](function(){_0x2a7c3c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15f744,_0x4e75a6){return function(_0x1f1881){if(!_0x1f1881){_0x15f744[_0x183f('0x13')](0x194);}return _0x1f1881;};}function handleError(_0x5ebd3b,_0x5bb36f){_0x5bb36f=_0x5bb36f||0x1f4;return function(_0x4a06fe){logger['error'](_0x4a06fe[_0x183f('0x21')]);if(_0x4a06fe[_0x183f('0x22')]){delete _0x4a06fe['name'];}_0x5ebd3b[_0x183f('0x14')](_0x5bb36f)[_0x183f('0x23')](_0x4a06fe);};}exports['index']=function(_0x14a903,_0x414542){var _0x33a981={},_0x5461fa={},_0x1500a8={'count':0x0,'rows':[]};var _0x3160b4=_[_0x183f('0x24')](db['MailQueueReport'][_0x183f('0x25')],function(_0x3de834){return{'name':_0x3de834[_0x183f('0x26')],'type':_0x3de834[_0x183f('0x27')][_0x183f('0x28')]};});_0x5461fa[_0x183f('0x29')]=_[_0x183f('0x24')](_0x3160b4,_0x183f('0x22'));_0x5461fa[_0x183f('0x2a')]=_[_0x183f('0x2b')](_0x14a903[_0x183f('0x2a')]);_0x5461fa['filters']=_['intersection'](_0x5461fa[_0x183f('0x29')],_0x5461fa[_0x183f('0x2a')]);_0x33a981[_0x183f('0x2c')]=_['intersection'](_0x5461fa['model'],qs[_0x183f('0x2d')](_0x14a903[_0x183f('0x2a')][_0x183f('0x2d')]));_0x33a981[_0x183f('0x2c')]=_0x33a981[_0x183f('0x2c')][_0x183f('0x2e')]?_0x33a981[_0x183f('0x2c')]:_0x5461fa[_0x183f('0x29')];if(!_0x14a903[_0x183f('0x2a')][_0x183f('0x2f')](_0x183f('0x30'))){_0x33a981['limit']=qs[_0x183f('0x19')](_0x14a903[_0x183f('0x2a')][_0x183f('0x19')]);_0x33a981['offset']=qs[_0x183f('0x18')](_0x14a903['query'][_0x183f('0x18')]);}_0x33a981[_0x183f('0x31')]=qs[_0x183f('0x32')](_0x14a903[_0x183f('0x2a')][_0x183f('0x32')]);_0x33a981['where']=qs[_0x183f('0x33')](_[_0x183f('0x34')](_0x14a903[_0x183f('0x2a')],_0x5461fa['filters']),_0x3160b4);if(_0x14a903['query'][_0x183f('0x35')]){_0x33a981[_0x183f('0x36')]=_['merge'](_0x33a981[_0x183f('0x36')],{'$or':_[_0x183f('0x24')](_0x3160b4,function(_0x262a78){if(_0x262a78['type']!==_0x183f('0x37')){var _0x542c94={};_0x542c94[_0x262a78[_0x183f('0x22')]]={'$like':'%'+_0x14a903[_0x183f('0x2a')][_0x183f('0x35')]+'%'};return _0x542c94;}})});}_0x33a981=_[_0x183f('0x38')]({},_0x33a981,_0x14a903[_0x183f('0x39')]);var _0x2afed5={'where':_0x33a981['where']};return db['MailQueueReport']['count'](_0x2afed5)[_0x183f('0x20')](function(_0x1bed63){_0x1500a8[_0x183f('0x17')]=_0x1bed63;if(_0x14a903[_0x183f('0x2a')][_0x183f('0x3a')]){_0x33a981['include']=[{'all':!![]}];}return db[_0x183f('0x3b')][_0x183f('0x3c')](_0x33a981);})[_0x183f('0x20')](function(_0xf55438){_0x1500a8['rows']=_0xf55438;return _0x1500a8;})['then'](respondWithFilteredResult(_0x414542,_0x33a981))[_0x183f('0x3d')](handleError(_0x414542,null));};exports['show']=function(_0x414aab,_0x3321db){var _0x4821d3={'raw':!![],'where':{'id':_0x414aab['params']['id']}},_0x240af6={};_0x240af6['model']=_[_0x183f('0x2b')](db['MailQueueReport']['rawAttributes']);_0x240af6[_0x183f('0x2a')]=_['keys'](_0x414aab[_0x183f('0x2a')]);_0x240af6['filters']=_[_0x183f('0x3e')](_0x240af6[_0x183f('0x29')],_0x240af6['query']);_0x4821d3[_0x183f('0x2c')]=_[_0x183f('0x3e')](_0x240af6['model'],qs[_0x183f('0x2d')](_0x414aab[_0x183f('0x2a')][_0x183f('0x2d')]));_0x4821d3['attributes']=_0x4821d3[_0x183f('0x2c')][_0x183f('0x2e')]?_0x4821d3[_0x183f('0x2c')]:_0x240af6['model'];if(_0x414aab[_0x183f('0x2a')][_0x183f('0x3a')]){_0x4821d3['include']=[{'all':!![]}];}_0x4821d3=_[_0x183f('0x38')]({},_0x4821d3,_0x414aab['options']);return db[_0x183f('0x3b')][_0x183f('0x3f')](_0x4821d3)['then'](handleEntityNotFound(_0x3321db,null))[_0x183f('0x20')](respondWithResult(_0x3321db,null))[_0x183f('0x3d')](handleError(_0x3321db,null));};exports[_0x183f('0x40')]=function(_0xed63a9,_0x56e8e6){return db[_0x183f('0x3b')][_0x183f('0x40')](_0xed63a9[_0x183f('0x41')],{})['then'](respondWithResult(_0x56e8e6,0xc9))['catch'](handleError(_0x56e8e6,null));};exports['update']=function(_0x4b3203,_0x4db178){if(_0x4b3203[_0x183f('0x41')]['id']){delete _0x4b3203[_0x183f('0x41')]['id'];}return db[_0x183f('0x3b')]['find']({'where':{'id':_0x4b3203[_0x183f('0x42')]['id']}})[_0x183f('0x20')](handleEntityNotFound(_0x4db178,null))[_0x183f('0x20')](saveUpdates(_0x4b3203['body'],null))[_0x183f('0x20')](respondWithResult(_0x4db178,null))[_0x183f('0x3d')](handleError(_0x4db178,null));};exports[_0x183f('0x1f')]=function(_0x2fb845,_0x545117){return db[_0x183f('0x3b')][_0x183f('0x3f')]({'where':{'id':_0x2fb845[_0x183f('0x42')]['id']}})['then'](handleEntityNotFound(_0x545117,null))[_0x183f('0x20')](removeEntity(_0x545117,null))['catch'](handleError(_0x545117,null));};exports['describe']=function(_0x5dbeb7,_0x154333){return db[_0x183f('0x3b')][_0x183f('0x43')]()[_0x183f('0x20')](respondWithResult(_0x154333,null))['catch'](handleError(_0x154333,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 635e76b..cb9cbce 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 _0xcefd=['MailQueueReport','report_mail_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailQueueReport.attributes','exports'];(function(_0x183bd6,_0x4d25df){var _0x312e61=function(_0x3c5cf2){while(--_0x3c5cf2){_0x183bd6['push'](_0x183bd6['shift']());}};_0x312e61(++_0x4d25df);}(_0xcefd,0x1bd));var _0xdcef=function(_0x46060a,_0x4ed109){_0x46060a=_0x46060a-0x0;var _0x119e5e=_0xcefd[_0x46060a];return _0x119e5e;};'use strict';var _=require('lodash');var util=require(_0xdcef('0x0'));var logger=require(_0xdcef('0x1'))(_0xdcef('0x2'));var moment=require(_0xdcef('0x3'));var BPromise=require(_0xdcef('0x4'));var rp=require(_0xdcef('0x5'));var fs=require('fs');var path=require(_0xdcef('0x6'));var rimraf=require('rimraf');var config=require(_0xdcef('0x7'));var attributes=require(_0xdcef('0x8'));module[_0xdcef('0x9')]=function(_0x373ed9,_0x31c2d4){return _0x373ed9['define'](_0xdcef('0xa'),attributes,{'tableName':_0xdcef('0xb'),'paranoid':![],'indexes':[{'name':_0xdcef('0xc'),'fields':[_0xdcef('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xda2d=['./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','util','../../config/logger','api','moment','bluebird','../../config/environment'];(function(_0x39832d,_0x37a86a){var _0x4360e7=function(_0x1c8790){while(--_0x1c8790){_0x39832d['push'](_0x39832d['shift']());}};_0x4360e7(++_0x37a86a);}(_0xda2d,0x102));var _0xdda2=function(_0x1af47d,_0x303fe0){_0x1af47d=_0x1af47d-0x0;var _0x3de1cb=_0xda2d[_0x1af47d];return _0x3de1cb;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var logger=require(_0xdda2('0x1'))(_0xdda2('0x2'));var moment=require(_0xdda2('0x3'));var BPromise=require(_0xdda2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdda2('0x5'));var attributes=require(_0xdda2('0x6'));module[_0xdda2('0x7')]=function(_0x39f6c9,_0xc256bc){return _0x39f6c9[_0xdda2('0x8')](_0xdda2('0x9'),attributes,{'tableName':_0xdda2('0xa'),'paranoid':![],'indexes':[{'name':_0xdda2('0xb'),'fields':[_0xdda2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index e16c896..8f862a1 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 _0xbd51=['MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','stringify','UpdateMailQueueReport','update','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','then','info'];(function(_0x4c630b,_0x25f8ef){var _0x181259=function(_0x5d0e58){while(--_0x5d0e58){_0x4c630b['push'](_0x4c630b['shift']());}};_0x181259(++_0x25f8ef);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x1ad90a,_0x1ff3c5){_0x1ad90a=_0x1ad90a-0x0;var _0xcd9bc0=_0xbd51[_0x1ad90a];return _0xcd9bc0;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var moment=require(_0x1bd5('0x1'));var BPromise=require(_0x1bd5('0x2'));var rs=require(_0x1bd5('0x3'));var fs=require('fs');var Redis=require(_0x1bd5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1bd5('0x5'));var jayson=require(_0x1bd5('0x6'));var client=jayson[_0x1bd5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29abea,_0x30a385,_0x19077c){return new BPromise(function(_0x27d58f,_0xd8418f){return client['request'](_0x29abea,_0x19077c)[_0x1bd5('0x8')](function(_0x5c8e0d){logger[_0x1bd5('0x9')](_0x1bd5('0xa'),_0x30a385,_0x1bd5('0xb'));logger[_0x1bd5('0xc')](_0x1bd5('0xd'),_0x30a385,_0x1bd5('0xb'),JSON['stringify'](_0x5c8e0d));if(_0x5c8e0d[_0x1bd5('0xe')]){if(_0x5c8e0d['error'][_0x1bd5('0xf')]===0x1f4){logger[_0x1bd5('0xe')](_0x1bd5('0xa'),_0x30a385,_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);return _0xd8418f(_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);}logger['error']('MailQueueReport,\x20%s,\x20%s',_0x30a385,_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);return _0x27d58f(_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);}else{logger['info']('MailQueueReport,\x20%s,\x20%s',_0x30a385,_0x1bd5('0xb'));_0x27d58f(_0x5c8e0d[_0x1bd5('0x11')][_0x1bd5('0x10')]);}})[_0x1bd5('0x12')](function(_0x43ea3e){logger[_0x1bd5('0xe')](_0x1bd5('0xa'),_0x30a385,_0x43ea3e);_0xd8418f(_0x43ea3e);});});}exports[_0x1bd5('0x13')]=function(_0x4670b5){var _0x4c1e84=this;return new Promise(function(_0x53ad5e,_0x2fe1a1){return db[_0x1bd5('0x14')][_0x1bd5('0x15')](_0x4670b5[_0x1bd5('0x16')],{'raw':_0x4670b5[_0x1bd5('0x17')]?_0x4670b5[_0x1bd5('0x17')][_0x1bd5('0x18')]===undefined?!![]:![]:!![]})[_0x1bd5('0x8')](function(_0x456051){logger[_0x1bd5('0x9')](_0x1bd5('0x13'),_0x4670b5);logger[_0x1bd5('0xc')](_0x1bd5('0x13'),_0x4670b5,JSON[_0x1bd5('0x19')](_0x456051));_0x53ad5e(_0x456051);})[_0x1bd5('0x12')](function(_0x46c580){logger[_0x1bd5('0xe')](_0x1bd5('0x13'),_0x46c580['message'],_0x4670b5);_0x2fe1a1(_0x4c1e84[_0x1bd5('0xe')](0x1f4,_0x46c580['message']));});});};exports[_0x1bd5('0x1a')]=function(_0x1e534e){var _0x3b6eb8=this;return new Promise(function(_0x48316b,_0x3f4156){return db['MailQueueReport'][_0x1bd5('0x1b')](_0x1e534e[_0x1bd5('0x16')],{'raw':_0x1e534e[_0x1bd5('0x17')]?_0x1e534e[_0x1bd5('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e534e[_0x1bd5('0x17')]?_0x1e534e[_0x1bd5('0x17')][_0x1bd5('0x1c')]||null:null,'attributes':_0x1e534e[_0x1bd5('0x17')]?_0x1e534e['options'][_0x1bd5('0x1d')]||null:null,'limit':_0x1e534e[_0x1bd5('0x17')]?_0x1e534e[_0x1bd5('0x17')][_0x1bd5('0x1e')]||null:null})[_0x1bd5('0x8')](function(_0xc73670){logger['info'](_0x1bd5('0x1a'),_0x1e534e);logger[_0x1bd5('0xc')](_0x1bd5('0x1a'),_0x1e534e,JSON['stringify'](_0xc73670));_0x48316b(_0xc73670);})[_0x1bd5('0x12')](function(_0x32748e){logger[_0x1bd5('0xe')](_0x1bd5('0x1a'),_0x32748e[_0x1bd5('0x10')],_0x1e534e);_0x3f4156(_0x3b6eb8[_0x1bd5('0xe')](0x1f4,_0x32748e['message']));});});}; \ No newline at end of file +var _0x9536=['code','message','info','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x9536,0x179));var _0x6953=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x9536[_0x373dee];return _0x46798f;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb026,_0x385f2d,_0x3e1aff){return new BPromise(function(_0x1c8225,_0x58ac30){return client[_0x6953('0xb')](_0x2bb026,_0x3e1aff)[_0x6953('0xc')](function(_0x449acb){logger['info'](_0x6953('0xd'),_0x385f2d,_0x6953('0xe'));logger[_0x6953('0xf')](_0x6953('0x10'),_0x385f2d,_0x6953('0xe'),JSON[_0x6953('0x11')](_0x449acb));if(_0x449acb[_0x6953('0x12')]){if(_0x449acb[_0x6953('0x12')][_0x6953('0x13')]===0x1f4){logger['error'](_0x6953('0xd'),_0x385f2d,_0x449acb['error'][_0x6953('0x14')]);return _0x58ac30(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}logger[_0x6953('0x12')](_0x6953('0xd'),_0x385f2d,_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);return _0x1c8225(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}else{logger[_0x6953('0x15')](_0x6953('0xd'),_0x385f2d,'request\x20sent');_0x1c8225(_0x449acb['result'][_0x6953('0x14')]);}})[_0x6953('0x16')](function(_0x16b79b){logger[_0x6953('0x12')]('MailQueueReport,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});}exports[_0x6953('0x17')]=function(_0x2da771){var _0x4b43ae=this;return new Promise(function(_0x10858a,_0x3207dd){return db[_0x6953('0x18')][_0x6953('0x19')](_0x2da771[_0x6953('0x1a')],{'raw':_0x2da771['options']?_0x2da771[_0x6953('0x1b')][_0x6953('0x1c')]===undefined?!![]:![]:!![]})[_0x6953('0xc')](function(_0x2ba433){logger[_0x6953('0x15')]('CreateMailQueueReport',_0x2da771);logger[_0x6953('0xf')](_0x6953('0x17'),_0x2da771,JSON['stringify'](_0x2ba433));_0x10858a(_0x2ba433);})[_0x6953('0x16')](function(_0x40c9d1){logger[_0x6953('0x12')](_0x6953('0x17'),_0x40c9d1['message'],_0x2da771);_0x3207dd(_0x4b43ae[_0x6953('0x12')](0x1f4,_0x40c9d1[_0x6953('0x14')]));});});};exports[_0x6953('0x1d')]=function(_0x508ea7){var _0x495ebd=this;return new Promise(function(_0x5a4cd7,_0xc85d42){return db[_0x6953('0x18')]['update'](_0x508ea7[_0x6953('0x1a')],{'raw':_0x508ea7['options']?_0x508ea7[_0x6953('0x1b')][_0x6953('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x508ea7[_0x6953('0x1b')]?_0x508ea7[_0x6953('0x1b')][_0x6953('0x1e')]||null:null,'attributes':_0x508ea7[_0x6953('0x1b')]?_0x508ea7['options'][_0x6953('0x1f')]||null:null,'limit':_0x508ea7[_0x6953('0x1b')]?_0x508ea7['options'][_0x6953('0x20')]||null:null})['then'](function(_0x173b3c){logger[_0x6953('0x15')](_0x6953('0x1d'),_0x508ea7);logger['debug'](_0x6953('0x1d'),_0x508ea7,JSON[_0x6953('0x11')](_0x173b3c));_0x5a4cd7(_0x173b3c);})[_0x6953('0x16')](function(_0x47ed2f){logger[_0x6953('0x12')](_0x6953('0x1d'),_0x47ed2f['message'],_0x508ea7);_0xc85d42(_0x495ebd['error'](0x1f4,_0x47ed2f[_0x6953('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 91dd2e5..8ed14cc 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 _0xd6cb=['../../components/interaction/service','exports','path','connect-timeout','express','../../components/auth/service'];(function(_0x29261a,_0xe38191){var _0x4d3cbe=function(_0xc43528){while(--_0xc43528){_0x29261a['push'](_0x29261a['shift']());}};_0x4d3cbe(++_0xe38191);}(_0xd6cb,0xe6));var _0xbd6c=function(_0x338782,_0x608258){_0x338782=_0x338782-0x0;var _0x3555ee=_0xd6cb[_0x338782];return _0x3555ee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbd6c('0x0'));var timeout=require(_0xbd6c('0x1'));var express=require(_0xbd6c('0x2'));var router=express['Router']();var auth=require(_0xbd6c('0x3'));var interaction=require(_0xbd6c('0x4'));var config=require('../../config/environment');module[_0xbd6c('0x5')]=router; \ No newline at end of file +var _0xd901=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','exports','multer'];(function(_0x96259e,_0x442b0c){var _0x489327=function(_0x33523d){while(--_0x33523d){_0x96259e['push'](_0x96259e['shift']());}};_0x489327(++_0x442b0c);}(_0xd901,0x1d4));var _0x1d90=function(_0x2ae1e0,_0x14c2cf){_0x2ae1e0=_0x2ae1e0-0x0;var _0x4b9827=_0xd901[_0x2ae1e0];return _0x4b9827;};'use strict';var multer=require(_0x1d90('0x0'));var util=require('util');var path=require(_0x1d90('0x1'));var timeout=require(_0x1d90('0x2'));var express=require(_0x1d90('0x3'));var router=express['Router']();var auth=require(_0x1d90('0x4'));var interaction=require(_0x1d90('0x5'));var config=require('../../config/environment');module[_0x1d90('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 64c7d7f..0776a64 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 _0x7814=['STRING','BOOLEAN','username','INBOX','INTEGER','sequelize','exports'];(function(_0x8ce4af,_0x763b2e){var _0x540000=function(_0x51f54b){while(--_0x51f54b){_0x8ce4af['push'](_0x8ce4af['shift']());}};_0x540000(++_0x763b2e);}(_0x7814,0x14e));var _0x4781=function(_0x242361,_0x5f23ba){_0x242361=_0x242361-0x0;var _0x3905ff=_0x7814[_0x242361];return _0x3905ff;};'use strict';var Sequelize=require(_0x4781('0x0'));module[_0x4781('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4781('0x2')]},'authentication':{'type':Sequelize[_0x4781('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':_0x4781('0x4')},'password':{'type':Sequelize[_0x4781('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x4781('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x4781('0x2')],'defaultValue':_0x4781('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x4781('0x6')],'defaultValue':0x5},'service':{'type':Sequelize[_0x4781('0x2')]}}; \ No newline at end of file +var _0x8243=['INBOX','INTEGER','sequelize','exports','STRING','BOOLEAN','username'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x8243,0x1bb));var _0x3824=function(_0x36ec2f,_0x5b24ef){_0x36ec2f=_0x36ec2f-0x0;var _0x5c3a9f=_0x8243[_0x36ec2f];return _0x5c3a9f;};'use strict';var Sequelize=require(_0x3824('0x0'));module[_0x3824('0x1')]={'description':{'type':Sequelize[_0x3824('0x2')]},'host':{'type':Sequelize[_0x3824('0x2')]},'authentication':{'type':Sequelize[_0x3824('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':_0x3824('0x4')},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x3824('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x3824('0x5')},'connTimeout':{'type':Sequelize[_0x3824('0x6')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x3824('0x6')],'defaultValue':0x5},'service':{'type':Sequelize[_0x3824('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 1d10b1b..9d708d7 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 _0x4cfd=['bluebird','request-promise','path','rimraf','./mailServerIn.attributes','exports','define','MailServerIn','lodash','util','api','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4cfd,0x170));var _0xd4cf=function(_0x54de5d,_0x1f8b26){_0x54de5d=_0x54de5d-0x0;var _0x1b349e=_0x4cfd[_0x54de5d];return _0x1b349e;};'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':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcbe=['mail_servers_in','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x241c41,_0x37ce1){var _0x554dde=function(_0x235bfb){while(--_0x235bfb){_0x241c41['push'](_0x241c41['shift']());}};_0x554dde(++_0x37ce1);}(_0xfcbe,0x1b1));var _0xefcb=function(_0x27fc2b,_0x510b4b){_0x27fc2b=_0x27fc2b-0x0;var _0x324dab=_0xfcbe[_0x27fc2b];return _0x324dab;};'use strict';var _=require('lodash');var util=require(_0xefcb('0x0'));var logger=require(_0xefcb('0x1'))(_0xefcb('0x2'));var moment=require(_0xefcb('0x3'));var BPromise=require(_0xefcb('0x4'));var rp=require(_0xefcb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xefcb('0x6'));var config=require(_0xefcb('0x7'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x50dcde,_0x3f322c){return _0x50dcde['define']('MailServerIn',attributes,{'tableName':_0xefcb('0x8'),'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 b63ab77..b2e4e74 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 _0x3acd=['request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','include','model','map','GetMailServerIn','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3acd,0x195));var _0xd3ac=function(_0x58a65e,_0x5d0a0f){_0x58a65e=_0x58a65e-0x0;var _0x5ac81d=_0x3acd[_0x58a65e];return _0x5ac81d;};'use strict';var _=require(_0xd3ac('0x0'));var util=require(_0xd3ac('0x1'));var moment=require(_0xd3ac('0x2'));var BPromise=require(_0xd3ac('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd3ac('0x4'))['db'];var utils=require(_0xd3ac('0x5'));var logger=require(_0xd3ac('0x6'))(_0xd3ac('0x7'));var config=require(_0xd3ac('0x8'));var jayson=require(_0xd3ac('0x9'));var client=jayson[_0xd3ac('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d9bd4,_0x11e474,_0xac45ef){return new BPromise(function(_0x3ffb28,_0x2c569e){return client[_0xd3ac('0xb')](_0x4d9bd4,_0xac45ef)[_0xd3ac('0xc')](function(_0x3274b1){logger[_0xd3ac('0xd')](_0xd3ac('0xe'),_0x11e474,_0xd3ac('0xf'));logger[_0xd3ac('0x10')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x11e474,_0xd3ac('0xf'),JSON[_0xd3ac('0x11')](_0x3274b1));if(_0x3274b1['error']){if(_0x3274b1[_0xd3ac('0x12')][_0xd3ac('0x13')]===0x1f4){logger[_0xd3ac('0x12')](_0xd3ac('0xe'),_0x11e474,_0x3274b1['error'][_0xd3ac('0x14')]);return _0x2c569e(_0x3274b1[_0xd3ac('0x12')]['message']);}logger['error'](_0xd3ac('0xe'),_0x11e474,_0x3274b1[_0xd3ac('0x12')][_0xd3ac('0x14')]);return _0x3ffb28(_0x3274b1[_0xd3ac('0x12')][_0xd3ac('0x14')]);}else{logger[_0xd3ac('0xd')](_0xd3ac('0xe'),_0x11e474,_0xd3ac('0xf'));_0x3ffb28(_0x3274b1[_0xd3ac('0x15')][_0xd3ac('0x14')]);}})[_0xd3ac('0x16')](function(_0x46e77b){logger[_0xd3ac('0x12')](_0xd3ac('0xe'),_0x11e474,_0x46e77b);_0x2c569e(_0x46e77b);});});}exports['GetMailServerIn']=function(_0x4d03ae){var _0x536f5b=this;return new Promise(function(_0x4fc054,_0xaf863a){return db['MailServerIn'][_0xd3ac('0x17')]({'raw':_0x4d03ae[_0xd3ac('0x18')]?_0x4d03ae['options'][_0xd3ac('0x19')]===undefined?!![]:![]:!![],'where':_0x4d03ae[_0xd3ac('0x18')]?_0x4d03ae[_0xd3ac('0x18')][_0xd3ac('0x1a')]||null:null,'attributes':_0x4d03ae['options']?_0x4d03ae[_0xd3ac('0x18')][_0xd3ac('0x1b')]||null:null,'limit':_0x4d03ae['options']?_0x4d03ae['options']['limit']||null:null,'include':_0x4d03ae[_0xd3ac('0x18')]?_0x4d03ae['options']['include']?_['map'](_0x4d03ae[_0xd3ac('0x18')][_0xd3ac('0x1c')],function(_0x4db0a5){return{'model':db[_0x4db0a5[_0xd3ac('0x1d')]],'as':_0x4db0a5['as'],'attributes':_0x4db0a5[_0xd3ac('0x1b')],'include':_0x4db0a5['include']?_[_0xd3ac('0x1e')](_0x4db0a5['include'],function(_0x15bb53){return{'model':db[_0x15bb53[_0xd3ac('0x1d')]],'as':_0x15bb53['as'],'attributes':_0x15bb53['attributes'],'include':_0x15bb53[_0xd3ac('0x1c')]?_[_0xd3ac('0x1e')](_0x15bb53['include'],function(_0x6f184c){return{'model':db[_0x6f184c[_0xd3ac('0x1d')]],'as':_0x6f184c['as'],'attributes':_0x6f184c[_0xd3ac('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd3ac('0xc')](function(_0x39c15c){logger[_0xd3ac('0xd')](_0xd3ac('0x1f'),_0x4d03ae);logger['debug'](_0xd3ac('0x1f'),_0x4d03ae,JSON[_0xd3ac('0x11')](_0x39c15c));_0x4fc054(_0x39c15c);})['catch'](function(_0x526912){logger[_0xd3ac('0x12')]('GetMailServerIn',_0x526912['message'],_0x4d03ae);_0xaf863a(_0x536f5b[_0xd3ac('0x12')](0x1f4,_0x526912['message']));});});}; \ No newline at end of file +var _0xaca3=['map','info','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','GetMailServerIn','MailServerIn','findAll','raw','options','attributes','include','model'];(function(_0x19b783,_0x1efb2a){var _0x2f6027=function(_0x11f760){while(--_0x11f760){_0x19b783['push'](_0x19b783['shift']());}};_0x2f6027(++_0x1efb2a);}(_0xaca3,0x195));var _0x3aca=function(_0x201eba,_0x1019a1){_0x201eba=_0x201eba-0x0;var _0x585364=_0xaca3[_0x201eba];return _0x585364;};'use strict';var _=require(_0x3aca('0x0'));var util=require(_0x3aca('0x1'));var moment=require(_0x3aca('0x2'));var BPromise=require(_0x3aca('0x3'));var rs=require(_0x3aca('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3aca('0x5'))['db'];var utils=require(_0x3aca('0x6'));var logger=require('../../config/logger')(_0x3aca('0x7'));var config=require(_0x3aca('0x8'));var jayson=require(_0x3aca('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x47fa92,_0x89946d,_0x4157e0){return new BPromise(function(_0x11429b,_0x284067){return client[_0x3aca('0xa')](_0x47fa92,_0x4157e0)[_0x3aca('0xb')](function(_0x21a07c){logger['info'](_0x3aca('0xc'),_0x89946d,_0x3aca('0xd'));logger[_0x3aca('0xe')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x89946d,_0x3aca('0xd'),JSON[_0x3aca('0xf')](_0x21a07c));if(_0x21a07c['error']){if(_0x21a07c['error'][_0x3aca('0x10')]===0x1f4){logger[_0x3aca('0x11')](_0x3aca('0xc'),_0x89946d,_0x21a07c[_0x3aca('0x11')]['message']);return _0x284067(_0x21a07c[_0x3aca('0x11')][_0x3aca('0x12')]);}logger[_0x3aca('0x11')](_0x3aca('0xc'),_0x89946d,_0x21a07c['error'][_0x3aca('0x12')]);return _0x11429b(_0x21a07c['error'][_0x3aca('0x12')]);}else{logger['info'](_0x3aca('0xc'),_0x89946d,_0x3aca('0xd'));_0x11429b(_0x21a07c[_0x3aca('0x13')][_0x3aca('0x12')]);}})[_0x3aca('0x14')](function(_0x389841){logger['error'](_0x3aca('0xc'),_0x89946d,_0x389841);_0x284067(_0x389841);});});}exports[_0x3aca('0x15')]=function(_0x11c311){var _0x4da22f=this;return new Promise(function(_0x31b897,_0x5780ba){return db[_0x3aca('0x16')][_0x3aca('0x17')]({'raw':_0x11c311['options']?_0x11c311['options'][_0x3aca('0x18')]===undefined?!![]:![]:!![],'where':_0x11c311[_0x3aca('0x19')]?_0x11c311[_0x3aca('0x19')]['where']||null:null,'attributes':_0x11c311['options']?_0x11c311['options'][_0x3aca('0x1a')]||null:null,'limit':_0x11c311[_0x3aca('0x19')]?_0x11c311[_0x3aca('0x19')]['limit']||null:null,'include':_0x11c311['options']?_0x11c311['options'][_0x3aca('0x1b')]?_['map'](_0x11c311[_0x3aca('0x19')][_0x3aca('0x1b')],function(_0xaa865a){return{'model':db[_0xaa865a[_0x3aca('0x1c')]],'as':_0xaa865a['as'],'attributes':_0xaa865a[_0x3aca('0x1a')],'include':_0xaa865a[_0x3aca('0x1b')]?_['map'](_0xaa865a[_0x3aca('0x1b')],function(_0x55b3fe){return{'model':db[_0x55b3fe['model']],'as':_0x55b3fe['as'],'attributes':_0x55b3fe[_0x3aca('0x1a')],'include':_0x55b3fe['include']?_[_0x3aca('0x1d')](_0x55b3fe['include'],function(_0x37dfec){return{'model':db[_0x37dfec[_0x3aca('0x1c')]],'as':_0x37dfec['as'],'attributes':_0x37dfec[_0x3aca('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c84e4){logger[_0x3aca('0x1e')](_0x3aca('0x15'),_0x11c311);logger['debug'](_0x3aca('0x15'),_0x11c311,JSON[_0x3aca('0xf')](_0x3c84e4));_0x31b897(_0x3c84e4);})['catch'](function(_0x3ea35f){logger['error'](_0x3aca('0x15'),_0x3ea35f[_0x3aca('0x12')],_0x11c311);_0x5780ba(_0x4da22f[_0x3aca('0x11')](0x1f4,_0x3ea35f[_0x3aca('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index c37ad83..6429750 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 _0xeb2d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','index','get','/:id','isAuthenticated','show','post','put','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x44e824,_0x122837){var _0x2829bd=function(_0xfe4c1f){while(--_0xfe4c1f){_0x44e824['push'](_0x44e824['shift']());}};_0x2829bd(++_0x122837);}(_0xeb2d,0xb0));var _0xdeb2=function(_0x521b68,_0x2338f1){_0x521b68=_0x521b68-0x0;var _0x21a028=_0xeb2d[_0x521b68];return _0x21a028;};'use strict';var multer=require('multer');var util=require(_0xdeb2('0x0'));var path=require('path');var timeout=require(_0xdeb2('0x1'));var express=require(_0xdeb2('0x2'));var router=express[_0xdeb2('0x3')]();var auth=require(_0xdeb2('0x4'));var interaction=require(_0xdeb2('0x5'));var config=require(_0xdeb2('0x6'));var controller=require(_0xdeb2('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xdeb2('0x8')]);router[_0xdeb2('0x9')](_0xdeb2('0xa'),auth[_0xdeb2('0xb')](),controller[_0xdeb2('0xc')]);router[_0xdeb2('0xd')]('/',auth[_0xdeb2('0xb')](),controller['create']);router[_0xdeb2('0xe')]('/:id',auth[_0xdeb2('0xb')](),controller['update']);router[_0xdeb2('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xdeb2('0x10')]);module[_0xdeb2('0x11')]=router; \ No newline at end of file +var _0x1569=['/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','isAuthenticated','index','get'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x1569,0x196));var _0x9156=function(_0x9166ea,_0x1f21b0){_0x9166ea=_0x9166ea-0x0;var _0xdceec9=_0x1569[_0x9166ea];return _0xdceec9;};'use strict';var multer=require(_0x9156('0x0'));var util=require(_0x9156('0x1'));var path=require(_0x9156('0x2'));var timeout=require(_0x9156('0x3'));var express=require(_0x9156('0x4'));var router=express[_0x9156('0x5')]();var auth=require(_0x9156('0x6'));var interaction=require(_0x9156('0x7'));var config=require('../../config/environment');var controller=require(_0x9156('0x8'));router['get']('/',auth[_0x9156('0x9')](),controller[_0x9156('0xa')]);router[_0x9156('0xb')](_0x9156('0xc'),auth[_0x9156('0x9')](),controller[_0x9156('0xd')]);router[_0x9156('0xe')]('/',auth[_0x9156('0x9')](),controller[_0x9156('0xf')]);router[_0x9156('0x10')](_0x9156('0xc'),auth[_0x9156('0x9')](),controller[_0x9156('0x11')]);router['delete'](_0x9156('0xc'),auth[_0x9156('0x9')](),controller['destroy']);module[_0x9156('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 578ee8f..acadba1 100644 --- a/server/api/mailServerOut/mailServerOut.attributes.js +++ b/server/api/mailServerOut/mailServerOut.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa93a=['STRING','BOOLEAN'];(function(_0x38db3a,_0x244702){var _0x2ead95=function(_0x558eab){while(--_0x558eab){_0x38db3a['push'](_0x38db3a['shift']());}};_0x2ead95(++_0x244702);}(_0xa93a,0xb8));var _0xaa93=function(_0x311f9d,_0x11409c){_0x311f9d=_0x311f9d-0x0;var _0x26e524=_0xa93a[_0x311f9d];return _0x26e524;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xaa93('0x0')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xaa93('0x0')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xaa93('0x1')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xaa93('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5ae0=['STRING','BOOLEAN','exports'];(function(_0x45f69a,_0x5a7901){var _0x5637c9=function(_0x244c88){while(--_0x244c88){_0x45f69a['push'](_0x45f69a['shift']());}};_0x5637c9(++_0x5a7901);}(_0x5ae0,0xf8));var _0x05ae=function(_0x311212,_0x41435e){_0x311212=_0x311212-0x0;var _0x146ee5=_0x5ae0[_0x311212];return _0x146ee5;};'use strict';var Sequelize=require('sequelize');module[_0x05ae('0x0')]={'description':{'type':Sequelize[_0x05ae('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x05ae('0x1')]},'pass':{'type':Sequelize[_0x05ae('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x05ae('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0x05ae('0x1')]},'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 f3d93f1..ee06212 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 _0xeb8d=['create','body','catch','params','destroy','html-pdf','eml-format','fast-json-patch','moment','mustache','path','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','error','name','MailServerOut','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','show','find'];(function(_0x233fd3,_0x28adf9){var _0x2fd00e=function(_0x5e1a67){while(--_0x5e1a67){_0x233fd3['push'](_0x233fd3['shift']());}};_0x2fd00e(++_0x28adf9);}(_0xeb8d,0x89));var _0xdeb8=function(_0x192d1a,_0x3e7389){_0x192d1a=_0x192d1a-0x0;var _0xef435d=_0xeb8d[_0x192d1a];return _0xef435d;};'use strict';var pdf=require(_0xdeb8('0x0'));var emlformat=require(_0xdeb8('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdeb8('0x2'));var rp=require('request-promise');var moment=require(_0xdeb8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdeb8('0x4'));var util=require('util');var path=require(_0xdeb8('0x5'));var sox=require('sox');var csv=require(_0xdeb8('0x6'));var ejs=require(_0xdeb8('0x7'));var fs=require('fs');var _=require(_0xdeb8('0x8'));var squel=require('squel');var crypto=require(_0xdeb8('0x9'));var jsforce=require(_0xdeb8('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xdeb8('0x6'));var querystring=require('querystring');var Papa=require(_0xdeb8('0xb'));var Redis=require(_0xdeb8('0xc'));var authService=require(_0xdeb8('0xd'));var qs=require(_0xdeb8('0xe'));var as=require(_0xdeb8('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdeb8('0x10'))(_0xdeb8('0x11'));var utils=require('../../config/utils');var config=require(_0xdeb8('0x12'));var db=require(_0xdeb8('0x13'))['db'];function respondWithStatusCode(_0x2fc7b1,_0xe4c925){_0xe4c925=_0xe4c925||0xcc;return function(_0x4bd2cf){if(_0x4bd2cf){return _0x2fc7b1[_0xdeb8('0x14')](_0xe4c925);}return _0x2fc7b1['status'](_0xe4c925)[_0xdeb8('0x15')]();};}function respondWithResult(_0x2f9dc7,_0x44fd04){_0x44fd04=_0x44fd04||0xc8;return function(_0x32079b){if(_0x32079b){return _0x2f9dc7['status'](_0x44fd04)[_0xdeb8('0x16')](_0x32079b);}};}function respondWithFilteredResult(_0x30b4b5,_0x2aabd5){return function(_0x5cf641){if(_0x5cf641){var _0x5ae59a=_0x5cf641[_0xdeb8('0x17')],_0x3b84f7=_0x2aabd5['offset'],_0x4246c7=_0x2aabd5[_0xdeb8('0x18')]+_0x2aabd5[_0xdeb8('0x19')],_0x55c683;if(_0x4246c7>=_0x5ae59a){_0x4246c7=_0x5ae59a;_0x55c683=0xc8;}else{_0x55c683=0xce;}_0x30b4b5['status'](_0x55c683);return _0x30b4b5[_0xdeb8('0x1a')](_0xdeb8('0x1b'),_0x3b84f7+'-'+_0x4246c7+'/'+_0x5ae59a)[_0xdeb8('0x16')](_0x5cf641);}return null;};}function patchUpdates(_0x2922de){return function(_0x10461e){try{jsonpatch[_0xdeb8('0x1c')](_0x10461e,_0x2922de,!![]);}catch(_0x296e02){return BPromise[_0xdeb8('0x1d')](_0x296e02);}return _0x10461e['save']();};}function saveUpdates(_0x53f7da,_0x2f45c0){return function(_0x487ce0){if(_0x487ce0){return _0x487ce0[_0xdeb8('0x1e')](_0x53f7da)[_0xdeb8('0x1f')](function(_0x2e851e){return _0x2e851e;});}return null;};}function removeEntity(_0x37c831,_0x44adfd){return function(_0x1a00ec){if(_0x1a00ec){return _0x1a00ec['destroy']()[_0xdeb8('0x1f')](function(){_0x37c831['status'](0xcc)[_0xdeb8('0x15')]();});}};}function handleEntityNotFound(_0xaa197,_0x5e6ced){return function(_0x1b9ebb){if(!_0x1b9ebb){_0xaa197[_0xdeb8('0x14')](0x194);}return _0x1b9ebb;};}function handleError(_0x5b1204,_0x5f0069){_0x5f0069=_0x5f0069||0x1f4;return function(_0x2bc0c7){logger[_0xdeb8('0x20')](_0x2bc0c7['stack']);if(_0x2bc0c7[_0xdeb8('0x21')]){delete _0x2bc0c7[_0xdeb8('0x21')];}_0x5b1204['status'](_0x5f0069)['send'](_0x2bc0c7);};}exports['index']=function(_0x1e8577,_0x3ecd00){var _0x3e19e5={},_0x132229={},_0x27d939={'count':0x0,'rows':[]};var _0x5c8d5d=_['map'](db[_0xdeb8('0x22')][_0xdeb8('0x23')],function(_0x2098d0){return{'name':_0x2098d0[_0xdeb8('0x24')],'type':_0x2098d0['type'][_0xdeb8('0x25')]};});_0x132229['model']=_['map'](_0x5c8d5d,_0xdeb8('0x21'));_0x132229['query']=_[_0xdeb8('0x26')](_0x1e8577[_0xdeb8('0x27')]);_0x132229[_0xdeb8('0x28')]=_[_0xdeb8('0x29')](_0x132229[_0xdeb8('0x2a')],_0x132229[_0xdeb8('0x27')]);_0x3e19e5[_0xdeb8('0x2b')]=_[_0xdeb8('0x29')](_0x132229[_0xdeb8('0x2a')],qs[_0xdeb8('0x2c')](_0x1e8577[_0xdeb8('0x27')][_0xdeb8('0x2c')]));_0x3e19e5[_0xdeb8('0x2b')]=_0x3e19e5[_0xdeb8('0x2b')][_0xdeb8('0x2d')]?_0x3e19e5[_0xdeb8('0x2b')]:_0x132229[_0xdeb8('0x2a')];if(!_0x1e8577[_0xdeb8('0x27')][_0xdeb8('0x2e')](_0xdeb8('0x2f'))){_0x3e19e5['limit']=qs[_0xdeb8('0x19')](_0x1e8577[_0xdeb8('0x27')]['limit']);_0x3e19e5['offset']=qs[_0xdeb8('0x18')](_0x1e8577[_0xdeb8('0x27')][_0xdeb8('0x18')]);}_0x3e19e5[_0xdeb8('0x30')]=qs[_0xdeb8('0x31')](_0x1e8577[_0xdeb8('0x27')][_0xdeb8('0x31')]);_0x3e19e5['where']=qs[_0xdeb8('0x28')](_[_0xdeb8('0x32')](_0x1e8577[_0xdeb8('0x27')],_0x132229[_0xdeb8('0x28')]),_0x5c8d5d);if(_0x1e8577[_0xdeb8('0x27')][_0xdeb8('0x33')]){_0x3e19e5[_0xdeb8('0x34')]=_[_0xdeb8('0x35')](_0x3e19e5[_0xdeb8('0x34')],{'$or':_[_0xdeb8('0x36')](_0x5c8d5d,function(_0x997302){if(_0x997302['type']!==_0xdeb8('0x37')){var _0x31fad9={};_0x31fad9[_0x997302[_0xdeb8('0x21')]]={'$like':'%'+_0x1e8577[_0xdeb8('0x27')][_0xdeb8('0x33')]+'%'};return _0x31fad9;}})});}_0x3e19e5=_[_0xdeb8('0x35')]({},_0x3e19e5,_0x1e8577[_0xdeb8('0x38')]);var _0x4519a0={'where':_0x3e19e5['where']};return db[_0xdeb8('0x22')]['count'](_0x4519a0)[_0xdeb8('0x1f')](function(_0x339cf2){_0x27d939['count']=_0x339cf2;if(_0x1e8577[_0xdeb8('0x27')][_0xdeb8('0x39')]){_0x3e19e5[_0xdeb8('0x3a')]=[{'all':!![]}];}return db[_0xdeb8('0x22')]['findAll'](_0x3e19e5);})[_0xdeb8('0x1f')](function(_0x9784c4){_0x27d939['rows']=_0x9784c4;return _0x27d939;})['then'](respondWithFilteredResult(_0x3ecd00,_0x3e19e5))['catch'](handleError(_0x3ecd00,null));};exports[_0xdeb8('0x3b')]=function(_0x3dfd1d,_0x10ad3b){var _0x1b2759={'raw':!![],'where':{'id':_0x3dfd1d['params']['id']}},_0x425ee6={};_0x425ee6['model']=_[_0xdeb8('0x26')](db[_0xdeb8('0x22')][_0xdeb8('0x23')]);_0x425ee6['query']=_[_0xdeb8('0x26')](_0x3dfd1d['query']);_0x425ee6[_0xdeb8('0x28')]=_[_0xdeb8('0x29')](_0x425ee6[_0xdeb8('0x2a')],_0x425ee6[_0xdeb8('0x27')]);_0x1b2759['attributes']=_[_0xdeb8('0x29')](_0x425ee6['model'],qs['fields'](_0x3dfd1d[_0xdeb8('0x27')][_0xdeb8('0x2c')]));_0x1b2759['attributes']=_0x1b2759[_0xdeb8('0x2b')][_0xdeb8('0x2d')]?_0x1b2759['attributes']:_0x425ee6[_0xdeb8('0x2a')];if(_0x3dfd1d[_0xdeb8('0x27')]['includeAll']){_0x1b2759['include']=[{'all':!![]}];}_0x1b2759=_[_0xdeb8('0x35')]({},_0x1b2759,_0x3dfd1d[_0xdeb8('0x38')]);return db['MailServerOut'][_0xdeb8('0x3c')](_0x1b2759)[_0xdeb8('0x1f')](handleEntityNotFound(_0x10ad3b,null))[_0xdeb8('0x1f')](respondWithResult(_0x10ad3b,null))['catch'](handleError(_0x10ad3b,null));};exports[_0xdeb8('0x3d')]=function(_0xe4989,_0x54738f){return db['MailServerOut'][_0xdeb8('0x3d')](_0xe4989[_0xdeb8('0x3e')],{})['then'](respondWithResult(_0x54738f,0xc9))[_0xdeb8('0x3f')](handleError(_0x54738f,null));};exports[_0xdeb8('0x1e')]=function(_0x32a928,_0xf53e3f){if(_0x32a928[_0xdeb8('0x3e')]['id']){delete _0x32a928[_0xdeb8('0x3e')]['id'];}return db[_0xdeb8('0x22')][_0xdeb8('0x3c')]({'where':{'id':_0x32a928[_0xdeb8('0x40')]['id']}})[_0xdeb8('0x1f')](handleEntityNotFound(_0xf53e3f,null))[_0xdeb8('0x1f')](saveUpdates(_0x32a928[_0xdeb8('0x3e')],null))[_0xdeb8('0x1f')](respondWithResult(_0xf53e3f,null))[_0xdeb8('0x3f')](handleError(_0xf53e3f,null));};exports[_0xdeb8('0x41')]=function(_0x413b82,_0x5531ed){return db[_0xdeb8('0x22')]['find']({'where':{'id':_0x413b82[_0xdeb8('0x40')]['id']}})[_0xdeb8('0x1f')](handleEntityNotFound(_0x5531ed,null))[_0xdeb8('0x1f')](removeEntity(_0x5531ed,null))[_0xdeb8('0x3f')](handleError(_0x5531ed,null));}; \ No newline at end of file +var _0x88ac=['pick','merge','VIRTUAL','filter','MailServerOut','findAll','rows','catch','show','params','length','includeAll','options','create','body','find','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','count','offset','limit','status','apply','save','update','destroy','then','name','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where'];(function(_0xd77854,_0x5e1b3d){var _0x801c14=function(_0x5225cc){while(--_0x5225cc){_0xd77854['push'](_0xd77854['shift']());}};_0x801c14(++_0x5e1b3d);}(_0x88ac,0x124));var _0xc88a=function(_0x17d314,_0x4c6cc8){_0x17d314=_0x17d314-0x0;var _0x58e7d3=_0x88ac[_0x17d314];return _0x58e7d3;};'use strict';var pdf=require(_0xc88a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc88a('0x1'));var rp=require(_0xc88a('0x2'));var moment=require(_0xc88a('0x3'));var BPromise=require(_0xc88a('0x4'));var Mustache=require(_0xc88a('0x5'));var util=require('util');var path=require(_0xc88a('0x6'));var sox=require(_0xc88a('0x7'));var csv=require(_0xc88a('0x8'));var ejs=require(_0xc88a('0x9'));var fs=require('fs');var _=require(_0xc88a('0xa'));var squel=require(_0xc88a('0xb'));var crypto=require(_0xc88a('0xc'));var jsforce=require(_0xc88a('0xd'));var deskjs=require(_0xc88a('0xe'));var toCsv=require(_0xc88a('0x8'));var querystring=require(_0xc88a('0xf'));var Papa=require(_0xc88a('0x10'));var Redis=require(_0xc88a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc88a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc88a('0x13'));var logger=require(_0xc88a('0x14'))(_0xc88a('0x15'));var utils=require(_0xc88a('0x16'));var config=require(_0xc88a('0x17'));var db=require(_0xc88a('0x18'))['db'];function respondWithStatusCode(_0xf66be9,_0xf02aca){_0xf02aca=_0xf02aca||0xcc;return function(_0x2a6340){if(_0x2a6340){return _0xf66be9[_0xc88a('0x19')](_0xf02aca);}return _0xf66be9['status'](_0xf02aca)['end']();};}function respondWithResult(_0x367a34,_0x159e65){_0x159e65=_0x159e65||0xc8;return function(_0x3c8f6){if(_0x3c8f6){return _0x367a34['status'](_0x159e65)[_0xc88a('0x1a')](_0x3c8f6);}};}function respondWithFilteredResult(_0x26c6c7,_0x14b24b){return function(_0x1b7cec){if(_0x1b7cec){var _0x5728a8=_0x1b7cec[_0xc88a('0x1b')],_0x15c269=_0x14b24b[_0xc88a('0x1c')],_0x423179=_0x14b24b['offset']+_0x14b24b[_0xc88a('0x1d')],_0x1a36be;if(_0x423179>=_0x5728a8){_0x423179=_0x5728a8;_0x1a36be=0xc8;}else{_0x1a36be=0xce;}_0x26c6c7[_0xc88a('0x1e')](_0x1a36be);return _0x26c6c7['set']('Content-Range',_0x15c269+'-'+_0x423179+'/'+_0x5728a8)['json'](_0x1b7cec);}return null;};}function patchUpdates(_0x2b29bf){return function(_0x10a781){try{jsonpatch[_0xc88a('0x1f')](_0x10a781,_0x2b29bf,!![]);}catch(_0x480f33){return BPromise['reject'](_0x480f33);}return _0x10a781[_0xc88a('0x20')]();};}function saveUpdates(_0x292323,_0xecd6d3){return function(_0x5d5bb4){if(_0x5d5bb4){return _0x5d5bb4[_0xc88a('0x21')](_0x292323)['then'](function(_0x4710c7){return _0x4710c7;});}return null;};}function removeEntity(_0x51d300,_0x535356){return function(_0x371a4e){if(_0x371a4e){return _0x371a4e[_0xc88a('0x22')]()[_0xc88a('0x23')](function(){_0x51d300[_0xc88a('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x320767,_0x154614){return function(_0x558978){if(!_0x558978){_0x320767[_0xc88a('0x19')](0x194);}return _0x558978;};}function handleError(_0x129132,_0xcf46ce){_0xcf46ce=_0xcf46ce||0x1f4;return function(_0x5c7db6){logger['error'](_0x5c7db6['stack']);if(_0x5c7db6[_0xc88a('0x24')]){delete _0x5c7db6[_0xc88a('0x24')];}_0x129132[_0xc88a('0x1e')](_0xcf46ce)['send'](_0x5c7db6);};}exports[_0xc88a('0x25')]=function(_0x5caaa7,_0x320d0f){var _0x3c4a21={},_0x141f3a={},_0x3324b5={'count':0x0,'rows':[]};var _0x47d30f=_[_0xc88a('0x26')](db['MailServerOut'][_0xc88a('0x27')],function(_0x1d75f6){return{'name':_0x1d75f6['fieldName'],'type':_0x1d75f6[_0xc88a('0x28')][_0xc88a('0x29')]};});_0x141f3a['model']=_[_0xc88a('0x26')](_0x47d30f,_0xc88a('0x24'));_0x141f3a[_0xc88a('0x2a')]=_[_0xc88a('0x2b')](_0x5caaa7[_0xc88a('0x2a')]);_0x141f3a[_0xc88a('0x2c')]=_[_0xc88a('0x2d')](_0x141f3a[_0xc88a('0x2e')],_0x141f3a[_0xc88a('0x2a')]);_0x3c4a21[_0xc88a('0x2f')]=_['intersection'](_0x141f3a[_0xc88a('0x2e')],qs[_0xc88a('0x30')](_0x5caaa7[_0xc88a('0x2a')][_0xc88a('0x30')]));_0x3c4a21[_0xc88a('0x2f')]=_0x3c4a21[_0xc88a('0x2f')]['length']?_0x3c4a21[_0xc88a('0x2f')]:_0x141f3a[_0xc88a('0x2e')];if(!_0x5caaa7[_0xc88a('0x2a')][_0xc88a('0x31')]('nolimit')){_0x3c4a21[_0xc88a('0x1d')]=qs[_0xc88a('0x1d')](_0x5caaa7[_0xc88a('0x2a')]['limit']);_0x3c4a21['offset']=qs[_0xc88a('0x1c')](_0x5caaa7[_0xc88a('0x2a')][_0xc88a('0x1c')]);}_0x3c4a21[_0xc88a('0x32')]=qs[_0xc88a('0x33')](_0x5caaa7[_0xc88a('0x2a')][_0xc88a('0x33')]);_0x3c4a21[_0xc88a('0x34')]=qs[_0xc88a('0x2c')](_[_0xc88a('0x35')](_0x5caaa7[_0xc88a('0x2a')],_0x141f3a[_0xc88a('0x2c')]),_0x47d30f);if(_0x5caaa7['query']['filter']){_0x3c4a21[_0xc88a('0x34')]=_[_0xc88a('0x36')](_0x3c4a21[_0xc88a('0x34')],{'$or':_['map'](_0x47d30f,function(_0x39b2f9){if(_0x39b2f9[_0xc88a('0x28')]!==_0xc88a('0x37')){var _0x2cf4ff={};_0x2cf4ff[_0x39b2f9[_0xc88a('0x24')]]={'$like':'%'+_0x5caaa7['query'][_0xc88a('0x38')]+'%'};return _0x2cf4ff;}})});}_0x3c4a21=_[_0xc88a('0x36')]({},_0x3c4a21,_0x5caaa7['options']);var _0x1271eb={'where':_0x3c4a21[_0xc88a('0x34')]};return db[_0xc88a('0x39')][_0xc88a('0x1b')](_0x1271eb)[_0xc88a('0x23')](function(_0x39cf92){_0x3324b5[_0xc88a('0x1b')]=_0x39cf92;if(_0x5caaa7['query']['includeAll']){_0x3c4a21['include']=[{'all':!![]}];}return db[_0xc88a('0x39')][_0xc88a('0x3a')](_0x3c4a21);})[_0xc88a('0x23')](function(_0x368842){_0x3324b5[_0xc88a('0x3b')]=_0x368842;return _0x3324b5;})['then'](respondWithFilteredResult(_0x320d0f,_0x3c4a21))[_0xc88a('0x3c')](handleError(_0x320d0f,null));};exports[_0xc88a('0x3d')]=function(_0x7634ce,_0x1102c8){var _0x1d2928={'raw':!![],'where':{'id':_0x7634ce[_0xc88a('0x3e')]['id']}},_0x497224={};_0x497224[_0xc88a('0x2e')]=_['keys'](db[_0xc88a('0x39')][_0xc88a('0x27')]);_0x497224[_0xc88a('0x2a')]=_[_0xc88a('0x2b')](_0x7634ce[_0xc88a('0x2a')]);_0x497224[_0xc88a('0x2c')]=_[_0xc88a('0x2d')](_0x497224['model'],_0x497224[_0xc88a('0x2a')]);_0x1d2928[_0xc88a('0x2f')]=_[_0xc88a('0x2d')](_0x497224[_0xc88a('0x2e')],qs['fields'](_0x7634ce[_0xc88a('0x2a')][_0xc88a('0x30')]));_0x1d2928[_0xc88a('0x2f')]=_0x1d2928[_0xc88a('0x2f')][_0xc88a('0x3f')]?_0x1d2928['attributes']:_0x497224[_0xc88a('0x2e')];if(_0x7634ce[_0xc88a('0x2a')][_0xc88a('0x40')]){_0x1d2928['include']=[{'all':!![]}];}_0x1d2928=_[_0xc88a('0x36')]({},_0x1d2928,_0x7634ce[_0xc88a('0x41')]);return db[_0xc88a('0x39')]['find'](_0x1d2928)[_0xc88a('0x23')](handleEntityNotFound(_0x1102c8,null))[_0xc88a('0x23')](respondWithResult(_0x1102c8,null))['catch'](handleError(_0x1102c8,null));};exports[_0xc88a('0x42')]=function(_0x23ddac,_0x4d4390){return db[_0xc88a('0x39')][_0xc88a('0x42')](_0x23ddac[_0xc88a('0x43')],{})['then'](respondWithResult(_0x4d4390,0xc9))[_0xc88a('0x3c')](handleError(_0x4d4390,null));};exports['update']=function(_0x2b40e9,_0x254fb7){if(_0x2b40e9[_0xc88a('0x43')]['id']){delete _0x2b40e9[_0xc88a('0x43')]['id'];}return db[_0xc88a('0x39')][_0xc88a('0x44')]({'where':{'id':_0x2b40e9[_0xc88a('0x3e')]['id']}})[_0xc88a('0x23')](handleEntityNotFound(_0x254fb7,null))['then'](saveUpdates(_0x2b40e9[_0xc88a('0x43')],null))[_0xc88a('0x23')](respondWithResult(_0x254fb7,null))[_0xc88a('0x3c')](handleError(_0x254fb7,null));};exports[_0xc88a('0x22')]=function(_0x2480d7,_0x56ee9a){return db[_0xc88a('0x39')][_0xc88a('0x44')]({'where':{'id':_0x2480d7[_0xc88a('0x3e')]['id']}})[_0xc88a('0x23')](handleEntityNotFound(_0x56ee9a,null))[_0xc88a('0x23')](removeEntity(_0x56ee9a,null))[_0xc88a('0x3c')](handleError(_0x56ee9a,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index e13379b..7ae66f7 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 _0xa744=['rimraf','./mailServerOut.attributes','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x420c21,_0x4d7fba){var _0x5e4a6d=function(_0x1fb7a7){while(--_0x1fb7a7){_0x420c21['push'](_0x420c21['shift']());}};_0x5e4a6d(++_0x4d7fba);}(_0xa744,0x16d));var _0x4a74=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa744[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x4a74('0x0'));var util=require(_0x4a74('0x1'));var logger=require(_0x4a74('0x2'))(_0x4a74('0x3'));var moment=require(_0x4a74('0x4'));var BPromise=require(_0x4a74('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a74('0x6'));var rimraf=require(_0x4a74('0x7'));var config=require('../../config/environment');var attributes=require(_0x4a74('0x8'));module['exports']=function(_0x2b1bf1,_0x702cce){return _0x2b1bf1[_0x4a74('0x9')](_0x4a74('0xa'),attributes,{'tableName':_0x4a74('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4785=['path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','mail_servers_out','lodash','util','api','bluebird','request-promise'];(function(_0x5cfa43,_0x5dc788){var _0x266f92=function(_0x33e56a){while(--_0x33e56a){_0x5cfa43['push'](_0x5cfa43['shift']());}};_0x266f92(++_0x5dc788);}(_0x4785,0x16f));var _0x5478=function(_0x5a7f66,_0x4c82b3){_0x5a7f66=_0x5a7f66-0x0;var _0x3e5205=_0x4785[_0x5a7f66];return _0x3e5205;};'use strict';var _=require(_0x5478('0x0'));var util=require(_0x5478('0x1'));var logger=require('../../config/logger')(_0x5478('0x2'));var moment=require('moment');var BPromise=require(_0x5478('0x3'));var rp=require(_0x5478('0x4'));var fs=require('fs');var path=require(_0x5478('0x5'));var rimraf=require(_0x5478('0x6'));var config=require(_0x5478('0x7'));var attributes=require(_0x5478('0x8'));module[_0x5478('0x9')]=function(_0x3d0b5e,_0x546e14){return _0x3d0b5e[_0x5478('0xa')]('MailServerOut',attributes,{'tableName':_0x5478('0xb'),'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 86673de..bbefdc3 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 _0x56e9=['MailServerOut,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then'];(function(_0x4754fb,_0x47fdd1){var _0x48b29d=function(_0x86111){while(--_0x86111){_0x4754fb['push'](_0x4754fb['shift']());}};_0x48b29d(++_0x47fdd1);}(_0x56e9,0xe4));var _0x956e=function(_0x1846b8,_0x5e9fd2){_0x1846b8=_0x1846b8-0x0;var _0x5d29ea=_0x56e9[_0x1846b8];return _0x5d29ea;};'use strict';var _=require(_0x956e('0x0'));var util=require(_0x956e('0x1'));var moment=require(_0x956e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x956e('0x3'));var db=require(_0x956e('0x4'))['db'];var utils=require(_0x956e('0x5'));var logger=require(_0x956e('0x6'))('rpc');var config=require(_0x956e('0x7'));var jayson=require(_0x956e('0x8'));var client=jayson['client'][_0x956e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5120a3,_0x4ec9ad,_0x5385b4){return new BPromise(function(_0x4fb76f,_0x1215e3){return client[_0x956e('0xa')](_0x5120a3,_0x5385b4)[_0x956e('0xb')](function(_0x326f4e){logger['info'](_0x956e('0xc'),_0x4ec9ad,_0x956e('0xd'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0x4ec9ad,_0x956e('0xd'),JSON[_0x956e('0xe')](_0x326f4e));if(_0x326f4e[_0x956e('0xf')]){if(_0x326f4e[_0x956e('0xf')][_0x956e('0x10')]===0x1f4){logger[_0x956e('0xf')](_0x956e('0xc'),_0x4ec9ad,_0x326f4e[_0x956e('0xf')][_0x956e('0x11')]);return _0x1215e3(_0x326f4e['error']['message']);}logger[_0x956e('0xf')]('MailServerOut,\x20%s,\x20%s',_0x4ec9ad,_0x326f4e[_0x956e('0xf')][_0x956e('0x11')]);return _0x4fb76f(_0x326f4e['error'][_0x956e('0x11')]);}else{logger['info'](_0x956e('0xc'),_0x4ec9ad,_0x956e('0xd'));_0x4fb76f(_0x326f4e[_0x956e('0x12')][_0x956e('0x11')]);}})[_0x956e('0x13')](function(_0x12e8b5){logger[_0x956e('0xf')]('MailServerOut,\x20%s,\x20%s',_0x4ec9ad,_0x12e8b5);_0x1215e3(_0x12e8b5);});});} \ No newline at end of file +var _0x2014=['catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x530c5f,_0x2403b7){var _0x1eb5e6=function(_0x14b241){while(--_0x14b241){_0x530c5f['push'](_0x530c5f['shift']());}};_0x1eb5e6(++_0x2403b7);}(_0x2014,0xfd));var _0x4201=function(_0x3222c4,_0x2a1da1){_0x3222c4=_0x3222c4-0x0;var _0x5afe96=_0x2014[_0x3222c4];return _0x5afe96;};'use strict';var _=require(_0x4201('0x0'));var util=require('util');var moment=require(_0x4201('0x1'));var BPromise=require(_0x4201('0x2'));var rs=require(_0x4201('0x3'));var fs=require('fs');var Redis=require(_0x4201('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4201('0x5'))(_0x4201('0x6'));var config=require(_0x4201('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4201('0x8')][_0x4201('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59317b,_0x5e303b,_0x7d13dc){return new BPromise(function(_0x2eca61,_0x4f8418){return client['request'](_0x59317b,_0x7d13dc)[_0x4201('0xa')](function(_0x3bb3ab){logger[_0x4201('0xb')](_0x4201('0xc'),_0x5e303b,_0x4201('0xd'));logger[_0x4201('0xe')](_0x4201('0xf'),_0x5e303b,_0x4201('0xd'),JSON[_0x4201('0x10')](_0x3bb3ab));if(_0x3bb3ab['error']){if(_0x3bb3ab[_0x4201('0x11')]['code']===0x1f4){logger[_0x4201('0x11')](_0x4201('0xc'),_0x5e303b,_0x3bb3ab[_0x4201('0x11')][_0x4201('0x12')]);return _0x4f8418(_0x3bb3ab['error'][_0x4201('0x12')]);}logger[_0x4201('0x11')]('MailServerOut,\x20%s,\x20%s',_0x5e303b,_0x3bb3ab[_0x4201('0x11')][_0x4201('0x12')]);return _0x2eca61(_0x3bb3ab[_0x4201('0x11')]['message']);}else{logger[_0x4201('0xb')](_0x4201('0xc'),_0x5e303b,_0x4201('0xd'));_0x2eca61(_0x3bb3ab[_0x4201('0x13')][_0x4201('0x12')]);}})[_0x4201('0x14')](function(_0x48e30f){logger['error'](_0x4201('0xc'),_0x5e303b,_0x48e30f);_0x4f8418(_0x48e30f);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index f318f68..edfe183 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 _0x2a71=['exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','/describe','describe','/:id','isAuthenticated','create','update','delete'];(function(_0x1b49eb,_0x327535){var _0x52ec8a=function(_0x45b22c){while(--_0x45b22c){_0x1b49eb['push'](_0x1b49eb['shift']());}};_0x52ec8a(++_0x327535);}(_0x2a71,0x121));var _0x12a7=function(_0x350079,_0x510691){_0x350079=_0x350079-0x0;var _0x220852=_0x2a71[_0x350079];return _0x220852;};'use strict';var multer=require(_0x12a7('0x0'));var util=require('util');var path=require(_0x12a7('0x1'));var timeout=require(_0x12a7('0x2'));var express=require(_0x12a7('0x3'));var router=express[_0x12a7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x12a7('0x5'));var config=require(_0x12a7('0x6'));var controller=require(_0x12a7('0x7'));router[_0x12a7('0x8')]('/',auth['isAuthenticated'](),controller[_0x12a7('0x9')]);router[_0x12a7('0x8')](_0x12a7('0xa'),auth['isAuthenticated'](),controller[_0x12a7('0xb')]);router[_0x12a7('0x8')](_0x12a7('0xc'),auth[_0x12a7('0xd')](),controller['show']);router['post']('/',auth[_0x12a7('0xd')](),controller[_0x12a7('0xe')]);router['put'](_0x12a7('0xc'),auth['isAuthenticated'](),controller[_0x12a7('0xf')]);router[_0x12a7('0x10')](_0x12a7('0xc'),auth[_0x12a7('0xd')](),controller['destroy']);module[_0x12a7('0x11')]=router; \ No newline at end of file +var _0x7fa0=['../../components/interaction/service','./mailSubstatus.controller','get','/describe','isAuthenticated','describe','post','/:id','destroy','util','path','connect-timeout','express','Router'];(function(_0x235b5c,_0x3a62d0){var _0x297d92=function(_0x54d837){while(--_0x54d837){_0x235b5c['push'](_0x235b5c['shift']());}};_0x297d92(++_0x3a62d0);}(_0x7fa0,0x6b));var _0x07fa=function(_0x499f42,_0x47a05c){_0x499f42=_0x499f42-0x0;var _0x285e92=_0x7fa0[_0x499f42];return _0x285e92;};'use strict';var multer=require('multer');var util=require(_0x07fa('0x0'));var path=require(_0x07fa('0x1'));var timeout=require(_0x07fa('0x2'));var express=require(_0x07fa('0x3'));var router=express[_0x07fa('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x07fa('0x5'));var config=require('../../config/environment');var controller=require(_0x07fa('0x6'));router[_0x07fa('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x07fa('0x7')](_0x07fa('0x8'),auth[_0x07fa('0x9')](),controller[_0x07fa('0xa')]);router[_0x07fa('0x7')]('/:id',auth[_0x07fa('0x9')](),controller['show']);router[_0x07fa('0xb')]('/',auth[_0x07fa('0x9')](),controller['create']);router['put']('/:id',auth[_0x07fa('0x9')](),controller['update']);router['delete'](_0x07fa('0xc'),auth[_0x07fa('0x9')](),controller[_0x07fa('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index e0d7954..f2ddf7e 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 _0x1261=['exports','STRING','name'];(function(_0x239893,_0x520a8d){var _0x1b7a89=function(_0x5d995c){while(--_0x5d995c){_0x239893['push'](_0x239893['shift']());}};_0x1b7a89(++_0x520a8d);}(_0x1261,0x144));var _0x1126=function(_0x33c70e,_0xd8cb0b){_0x33c70e=_0x33c70e-0x0;var _0x5a33e5=_0x1261[_0x33c70e];return _0x5a33e5;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'name':{'type':Sequelize[_0x1126('0x1')],'unique':_0x1126('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1126('0x1')]}}; \ No newline at end of file +var _0xf19c=['sequelize','exports','STRING'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xf19c,0x10b));var _0xcf19=function(_0x3fd27c,_0x4eecde){_0x3fd27c=_0x3fd27c-0x0;var _0x4cf41e=_0xf19c[_0x3fd27c];return _0x4cf41e;};'use strict';var Sequelize=require(_0xcf19('0x0'));module[_0xcf19('0x1')]={'name':{'type':Sequelize[_0xcf19('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xcf19('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 3f57c4d..4cd392c 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 _0xac37=['json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','map','MailSubstatus','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','include','find','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','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/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x463608,_0x31f1dc){var _0x1f2a92=function(_0x450be4){while(--_0x450be4){_0x463608['push'](_0x463608['shift']());}};_0x1f2a92(++_0x31f1dc);}(_0xac37,0x199));var _0x7ac3=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xac37[_0x50aa2e];return _0x5e07f0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7ac3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7ac3('0x1'));var jsonpatch=require(_0x7ac3('0x2'));var rp=require(_0x7ac3('0x3'));var moment=require(_0x7ac3('0x4'));var BPromise=require(_0x7ac3('0x5'));var Mustache=require(_0x7ac3('0x6'));var util=require('util');var path=require(_0x7ac3('0x7'));var sox=require(_0x7ac3('0x8'));var csv=require(_0x7ac3('0x9'));var ejs=require(_0x7ac3('0xa'));var fs=require('fs');var _=require(_0x7ac3('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7ac3('0xc'));var deskjs=require(_0x7ac3('0xd'));var toCsv=require(_0x7ac3('0x9'));var querystring=require(_0x7ac3('0xe'));var Papa=require(_0x7ac3('0xf'));var Redis=require(_0x7ac3('0x10'));var authService=require(_0x7ac3('0x11'));var qs=require(_0x7ac3('0x12'));var as=require(_0x7ac3('0x13'));var hardwareService=require(_0x7ac3('0x14'));var logger=require(_0x7ac3('0x15'))(_0x7ac3('0x16'));var utils=require(_0x7ac3('0x17'));var config=require(_0x7ac3('0x18'));var db=require(_0x7ac3('0x19'))['db'];function respondWithStatusCode(_0x48ec80,_0x123bcb){_0x123bcb=_0x123bcb||0xcc;return function(_0x128eed){if(_0x128eed){return _0x48ec80[_0x7ac3('0x1a')](_0x123bcb);}return _0x48ec80[_0x7ac3('0x1b')](_0x123bcb)[_0x7ac3('0x1c')]();};}function respondWithResult(_0x213d40,_0x2f42fc){_0x2f42fc=_0x2f42fc||0xc8;return function(_0x4f203){if(_0x4f203){return _0x213d40['status'](_0x2f42fc)[_0x7ac3('0x1d')](_0x4f203);}};}function respondWithFilteredResult(_0x169165,_0x223fb4){return function(_0x74a59b){if(_0x74a59b){var _0x3db55d=_0x74a59b[_0x7ac3('0x1e')],_0x5c36be=_0x223fb4[_0x7ac3('0x1f')],_0x366ab3=_0x223fb4[_0x7ac3('0x1f')]+_0x223fb4[_0x7ac3('0x20')],_0x2ff608;if(_0x366ab3>=_0x3db55d){_0x366ab3=_0x3db55d;_0x2ff608=0xc8;}else{_0x2ff608=0xce;}_0x169165['status'](_0x2ff608);return _0x169165[_0x7ac3('0x21')](_0x7ac3('0x22'),_0x5c36be+'-'+_0x366ab3+'/'+_0x3db55d)['json'](_0x74a59b);}return null;};}function patchUpdates(_0x495326){return function(_0x4c3abc){try{jsonpatch[_0x7ac3('0x23')](_0x4c3abc,_0x495326,!![]);}catch(_0xe3e07a){return BPromise[_0x7ac3('0x24')](_0xe3e07a);}return _0x4c3abc['save']();};}function saveUpdates(_0x49b8aa,_0x13e712){return function(_0x477f9f){if(_0x477f9f){return _0x477f9f[_0x7ac3('0x25')](_0x49b8aa)[_0x7ac3('0x26')](function(_0x36ddc3){return _0x36ddc3;});}return null;};}function removeEntity(_0x431c83,_0x2bedad){return function(_0x256100){if(_0x256100){return _0x256100[_0x7ac3('0x27')]()[_0x7ac3('0x26')](function(){_0x431c83[_0x7ac3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb734c8,_0x349b00){return function(_0x11a594){if(!_0x11a594){_0xb734c8[_0x7ac3('0x1a')](0x194);}return _0x11a594;};}function handleError(_0x12a084,_0x1c6da2){_0x1c6da2=_0x1c6da2||0x1f4;return function(_0x592b17){logger['error'](_0x592b17[_0x7ac3('0x28')]);if(_0x592b17[_0x7ac3('0x29')]){delete _0x592b17[_0x7ac3('0x29')];}_0x12a084['status'](_0x1c6da2)[_0x7ac3('0x2a')](_0x592b17);};}exports['index']=function(_0x2ee4c7,_0x22e90b){var _0x181fd9={},_0x3c2a24={},_0x5f2d87={'count':0x0,'rows':[]};var _0x502a39=_[_0x7ac3('0x2b')](db[_0x7ac3('0x2c')][_0x7ac3('0x2d')],function(_0x299977){return{'name':_0x299977['fieldName'],'type':_0x299977[_0x7ac3('0x2e')]['key']};});_0x3c2a24[_0x7ac3('0x2f')]=_[_0x7ac3('0x2b')](_0x502a39,'name');_0x3c2a24[_0x7ac3('0x30')]=_[_0x7ac3('0x31')](_0x2ee4c7['query']);_0x3c2a24[_0x7ac3('0x32')]=_[_0x7ac3('0x33')](_0x3c2a24['model'],_0x3c2a24['query']);_0x181fd9[_0x7ac3('0x34')]=_[_0x7ac3('0x33')](_0x3c2a24[_0x7ac3('0x2f')],qs[_0x7ac3('0x35')](_0x2ee4c7[_0x7ac3('0x30')][_0x7ac3('0x35')]));_0x181fd9[_0x7ac3('0x34')]=_0x181fd9[_0x7ac3('0x34')][_0x7ac3('0x36')]?_0x181fd9['attributes']:_0x3c2a24[_0x7ac3('0x2f')];if(!_0x2ee4c7[_0x7ac3('0x30')]['hasOwnProperty'](_0x7ac3('0x37'))){_0x181fd9[_0x7ac3('0x20')]=qs[_0x7ac3('0x20')](_0x2ee4c7[_0x7ac3('0x30')][_0x7ac3('0x20')]);_0x181fd9[_0x7ac3('0x1f')]=qs[_0x7ac3('0x1f')](_0x2ee4c7[_0x7ac3('0x30')][_0x7ac3('0x1f')]);}_0x181fd9['order']=qs[_0x7ac3('0x38')](_0x2ee4c7['query'][_0x7ac3('0x38')]);_0x181fd9[_0x7ac3('0x39')]=qs['filters'](_[_0x7ac3('0x3a')](_0x2ee4c7[_0x7ac3('0x30')],_0x3c2a24[_0x7ac3('0x32')]),_0x502a39);if(_0x2ee4c7[_0x7ac3('0x30')]['filter']){_0x181fd9[_0x7ac3('0x39')]=_[_0x7ac3('0x3b')](_0x181fd9[_0x7ac3('0x39')],{'$or':_[_0x7ac3('0x2b')](_0x502a39,function(_0x14dba0){if(_0x14dba0[_0x7ac3('0x2e')]!==_0x7ac3('0x3c')){var _0x523f6b={};_0x523f6b[_0x14dba0[_0x7ac3('0x29')]]={'$like':'%'+_0x2ee4c7[_0x7ac3('0x30')][_0x7ac3('0x3d')]+'%'};return _0x523f6b;}})});}_0x181fd9=_[_0x7ac3('0x3b')]({},_0x181fd9,_0x2ee4c7[_0x7ac3('0x3e')]);var _0x27af7a={'where':_0x181fd9[_0x7ac3('0x39')]};return db[_0x7ac3('0x2c')][_0x7ac3('0x1e')](_0x27af7a)[_0x7ac3('0x26')](function(_0xb29ca8){_0x5f2d87[_0x7ac3('0x1e')]=_0xb29ca8;if(_0x2ee4c7[_0x7ac3('0x30')][_0x7ac3('0x3f')]){_0x181fd9['include']=[{'all':!![]}];}return db['MailSubstatus'][_0x7ac3('0x40')](_0x181fd9);})['then'](function(_0x2ba81f){_0x5f2d87[_0x7ac3('0x41')]=_0x2ba81f;return _0x5f2d87;})[_0x7ac3('0x26')](respondWithFilteredResult(_0x22e90b,_0x181fd9))[_0x7ac3('0x42')](handleError(_0x22e90b,null));};exports[_0x7ac3('0x43')]=function(_0x4fbaac,_0x1abdf7){var _0x54af8d={'raw':!![],'where':{'id':_0x4fbaac[_0x7ac3('0x44')]['id']}},_0x1800a0={};_0x1800a0[_0x7ac3('0x2f')]=_['keys'](db['MailSubstatus'][_0x7ac3('0x2d')]);_0x1800a0['query']=_[_0x7ac3('0x31')](_0x4fbaac[_0x7ac3('0x30')]);_0x1800a0[_0x7ac3('0x32')]=_[_0x7ac3('0x33')](_0x1800a0[_0x7ac3('0x2f')],_0x1800a0['query']);_0x54af8d[_0x7ac3('0x34')]=_[_0x7ac3('0x33')](_0x1800a0[_0x7ac3('0x2f')],qs[_0x7ac3('0x35')](_0x4fbaac['query'][_0x7ac3('0x35')]));_0x54af8d[_0x7ac3('0x34')]=_0x54af8d['attributes'][_0x7ac3('0x36')]?_0x54af8d[_0x7ac3('0x34')]:_0x1800a0[_0x7ac3('0x2f')];if(_0x4fbaac[_0x7ac3('0x30')][_0x7ac3('0x3f')]){_0x54af8d[_0x7ac3('0x45')]=[{'all':!![]}];}_0x54af8d=_[_0x7ac3('0x3b')]({},_0x54af8d,_0x4fbaac[_0x7ac3('0x3e')]);return db[_0x7ac3('0x2c')][_0x7ac3('0x46')](_0x54af8d)['then'](handleEntityNotFound(_0x1abdf7,null))['then'](respondWithResult(_0x1abdf7,null))[_0x7ac3('0x42')](handleError(_0x1abdf7,null));};exports['create']=function(_0x3d694b,_0x22925b){return db[_0x7ac3('0x2c')]['create'](_0x3d694b['body'],{})[_0x7ac3('0x26')](respondWithResult(_0x22925b,0xc9))[_0x7ac3('0x42')](handleError(_0x22925b,null));};exports['update']=function(_0x19211f,_0x2e010b){if(_0x19211f[_0x7ac3('0x47')]['id']){delete _0x19211f[_0x7ac3('0x47')]['id'];}return db[_0x7ac3('0x2c')][_0x7ac3('0x46')]({'where':{'id':_0x19211f['params']['id']}})['then'](handleEntityNotFound(_0x2e010b,null))[_0x7ac3('0x26')](saveUpdates(_0x19211f['body'],null))['then'](respondWithResult(_0x2e010b,null))[_0x7ac3('0x42')](handleError(_0x2e010b,null));};exports['destroy']=function(_0xa3ad4,_0x1273e9){return db['MailSubstatus'][_0x7ac3('0x46')]({'where':{'id':_0xa3ad4[_0x7ac3('0x44')]['id']}})[_0x7ac3('0x26')](handleEntityNotFound(_0x1273e9,null))[_0x7ac3('0x26')](removeEntity(_0x1273e9,null))[_0x7ac3('0x42')](handleError(_0x1273e9,null));};exports[_0x7ac3('0x48')]=function(_0x1fc61a,_0x27da64){return db['MailSubstatus'][_0x7ac3('0x48')]()[_0x7ac3('0x26')](respondWithResult(_0x27da64,null))[_0x7ac3('0x42')](handleError(_0x27da64,null));}; \ No newline at end of file +var _0xb31e=['length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','find','create','update','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','reject','then','destroy','stack','name','send','MailSubstatus','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0xb31e,0x16e));var _0xeb31=function(_0x5d404d,_0x837ae2){_0x5d404d=_0x5d404d-0x0;var _0x9ab532=_0xb31e[_0x5d404d];return _0x9ab532;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xeb31('0x0'));var rimraf=require(_0xeb31('0x1'));var zipdir=require(_0xeb31('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xeb31('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xeb31('0x4'));var util=require(_0xeb31('0x5'));var path=require('path');var sox=require(_0xeb31('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xeb31('0x7'));var squel=require(_0xeb31('0x8'));var crypto=require(_0xeb31('0x9'));var jsforce=require(_0xeb31('0xa'));var deskjs=require(_0xeb31('0xb'));var toCsv=require(_0xeb31('0xc'));var querystring=require('querystring');var Papa=require(_0xeb31('0xd'));var Redis=require(_0xeb31('0xe'));var authService=require(_0xeb31('0xf'));var qs=require(_0xeb31('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb31('0x11'));var logger=require(_0xeb31('0x12'))(_0xeb31('0x13'));var utils=require(_0xeb31('0x14'));var config=require(_0xeb31('0x15'));var db=require(_0xeb31('0x16'))['db'];function respondWithStatusCode(_0x1f3c7b,_0x1b9d94){_0x1b9d94=_0x1b9d94||0xcc;return function(_0x22f5d3){if(_0x22f5d3){return _0x1f3c7b[_0xeb31('0x17')](_0x1b9d94);}return _0x1f3c7b[_0xeb31('0x18')](_0x1b9d94)[_0xeb31('0x19')]();};}function respondWithResult(_0xac393e,_0x4b8640){_0x4b8640=_0x4b8640||0xc8;return function(_0x21f3f5){if(_0x21f3f5){return _0xac393e[_0xeb31('0x18')](_0x4b8640)[_0xeb31('0x1a')](_0x21f3f5);}};}function respondWithFilteredResult(_0xcead94,_0x57a37f){return function(_0x2dce8d){if(_0x2dce8d){var _0x2c3a1a=_0x2dce8d['count'],_0x8b6c72=_0x57a37f['offset'],_0x19dbbd=_0x57a37f[_0xeb31('0x1b')]+_0x57a37f[_0xeb31('0x1c')],_0xdd2bb7;if(_0x19dbbd>=_0x2c3a1a){_0x19dbbd=_0x2c3a1a;_0xdd2bb7=0xc8;}else{_0xdd2bb7=0xce;}_0xcead94[_0xeb31('0x18')](_0xdd2bb7);return _0xcead94['set']('Content-Range',_0x8b6c72+'-'+_0x19dbbd+'/'+_0x2c3a1a)['json'](_0x2dce8d);}return null;};}function patchUpdates(_0x5bf014){return function(_0x21b2ae){try{jsonpatch[_0xeb31('0x1d')](_0x21b2ae,_0x5bf014,!![]);}catch(_0x29f928){return BPromise[_0xeb31('0x1e')](_0x29f928);}return _0x21b2ae['save']();};}function saveUpdates(_0x3d6478,_0x191e7e){return function(_0x17cef9){if(_0x17cef9){return _0x17cef9['update'](_0x3d6478)[_0xeb31('0x1f')](function(_0x2c5161){return _0x2c5161;});}return null;};}function removeEntity(_0x192999,_0x5b5f92){return function(_0x507ad0){if(_0x507ad0){return _0x507ad0[_0xeb31('0x20')]()[_0xeb31('0x1f')](function(){_0x192999[_0xeb31('0x18')](0xcc)[_0xeb31('0x19')]();});}};}function handleEntityNotFound(_0x29bd1f,_0x1844c7){return function(_0x3fa0e8){if(!_0x3fa0e8){_0x29bd1f['sendStatus'](0x194);}return _0x3fa0e8;};}function handleError(_0x2e7c35,_0x33266e){_0x33266e=_0x33266e||0x1f4;return function(_0x51fb73){logger['error'](_0x51fb73[_0xeb31('0x21')]);if(_0x51fb73[_0xeb31('0x22')]){delete _0x51fb73[_0xeb31('0x22')];}_0x2e7c35[_0xeb31('0x18')](_0x33266e)[_0xeb31('0x23')](_0x51fb73);};}exports['index']=function(_0x3e8147,_0x5656be){var _0x4be518={},_0x3ad64f={},_0x5f82d7={'count':0x0,'rows':[]};var _0x2eeb72=_['map'](db[_0xeb31('0x24')][_0xeb31('0x25')],function(_0x3ddccd){return{'name':_0x3ddccd['fieldName'],'type':_0x3ddccd[_0xeb31('0x26')][_0xeb31('0x27')]};});_0x3ad64f[_0xeb31('0x28')]=_[_0xeb31('0x29')](_0x2eeb72,'name');_0x3ad64f[_0xeb31('0x2a')]=_[_0xeb31('0x2b')](_0x3e8147[_0xeb31('0x2a')]);_0x3ad64f[_0xeb31('0x2c')]=_[_0xeb31('0x2d')](_0x3ad64f[_0xeb31('0x28')],_0x3ad64f['query']);_0x4be518['attributes']=_[_0xeb31('0x2d')](_0x3ad64f[_0xeb31('0x28')],qs[_0xeb31('0x2e')](_0x3e8147[_0xeb31('0x2a')][_0xeb31('0x2e')]));_0x4be518[_0xeb31('0x2f')]=_0x4be518['attributes'][_0xeb31('0x30')]?_0x4be518[_0xeb31('0x2f')]:_0x3ad64f[_0xeb31('0x28')];if(!_0x3e8147[_0xeb31('0x2a')][_0xeb31('0x31')]('nolimit')){_0x4be518[_0xeb31('0x1c')]=qs[_0xeb31('0x1c')](_0x3e8147[_0xeb31('0x2a')][_0xeb31('0x1c')]);_0x4be518[_0xeb31('0x1b')]=qs['offset'](_0x3e8147[_0xeb31('0x2a')]['offset']);}_0x4be518['order']=qs[_0xeb31('0x32')](_0x3e8147['query'][_0xeb31('0x32')]);_0x4be518[_0xeb31('0x33')]=qs[_0xeb31('0x2c')](_['pick'](_0x3e8147[_0xeb31('0x2a')],_0x3ad64f['filters']),_0x2eeb72);if(_0x3e8147[_0xeb31('0x2a')][_0xeb31('0x34')]){_0x4be518[_0xeb31('0x33')]=_[_0xeb31('0x35')](_0x4be518[_0xeb31('0x33')],{'$or':_[_0xeb31('0x29')](_0x2eeb72,function(_0x1af53c){if(_0x1af53c[_0xeb31('0x26')]!==_0xeb31('0x36')){var _0x2475ab={};_0x2475ab[_0x1af53c[_0xeb31('0x22')]]={'$like':'%'+_0x3e8147['query'][_0xeb31('0x34')]+'%'};return _0x2475ab;}})});}_0x4be518=_[_0xeb31('0x35')]({},_0x4be518,_0x3e8147['options']);var _0x4d1d2c={'where':_0x4be518[_0xeb31('0x33')]};return db[_0xeb31('0x24')][_0xeb31('0x37')](_0x4d1d2c)[_0xeb31('0x1f')](function(_0x230196){_0x5f82d7[_0xeb31('0x37')]=_0x230196;if(_0x3e8147[_0xeb31('0x2a')]['includeAll']){_0x4be518[_0xeb31('0x38')]=[{'all':!![]}];}return db[_0xeb31('0x24')][_0xeb31('0x39')](_0x4be518);})['then'](function(_0xd29742){_0x5f82d7[_0xeb31('0x3a')]=_0xd29742;return _0x5f82d7;})[_0xeb31('0x1f')](respondWithFilteredResult(_0x5656be,_0x4be518))[_0xeb31('0x3b')](handleError(_0x5656be,null));};exports[_0xeb31('0x3c')]=function(_0x5b8f0c,_0x1a2758){var _0x461d0b={'raw':!![],'where':{'id':_0x5b8f0c[_0xeb31('0x3d')]['id']}},_0x4cff7a={};_0x4cff7a['model']=_['keys'](db[_0xeb31('0x24')]['rawAttributes']);_0x4cff7a[_0xeb31('0x2a')]=_[_0xeb31('0x2b')](_0x5b8f0c[_0xeb31('0x2a')]);_0x4cff7a[_0xeb31('0x2c')]=_[_0xeb31('0x2d')](_0x4cff7a[_0xeb31('0x28')],_0x4cff7a[_0xeb31('0x2a')]);_0x461d0b[_0xeb31('0x2f')]=_['intersection'](_0x4cff7a[_0xeb31('0x28')],qs[_0xeb31('0x2e')](_0x5b8f0c[_0xeb31('0x2a')][_0xeb31('0x2e')]));_0x461d0b['attributes']=_0x461d0b[_0xeb31('0x2f')][_0xeb31('0x30')]?_0x461d0b[_0xeb31('0x2f')]:_0x4cff7a[_0xeb31('0x28')];if(_0x5b8f0c[_0xeb31('0x2a')][_0xeb31('0x3e')]){_0x461d0b['include']=[{'all':!![]}];}_0x461d0b=_[_0xeb31('0x35')]({},_0x461d0b,_0x5b8f0c[_0xeb31('0x3f')]);return db[_0xeb31('0x24')][_0xeb31('0x40')](_0x461d0b)[_0xeb31('0x1f')](handleEntityNotFound(_0x1a2758,null))[_0xeb31('0x1f')](respondWithResult(_0x1a2758,null))[_0xeb31('0x3b')](handleError(_0x1a2758,null));};exports[_0xeb31('0x41')]=function(_0x453a91,_0x4e608f){return db['MailSubstatus'][_0xeb31('0x41')](_0x453a91['body'],{})[_0xeb31('0x1f')](respondWithResult(_0x4e608f,0xc9))[_0xeb31('0x3b')](handleError(_0x4e608f,null));};exports[_0xeb31('0x42')]=function(_0x23a50e,_0x10ab29){if(_0x23a50e['body']['id']){delete _0x23a50e[_0xeb31('0x43')]['id'];}return db[_0xeb31('0x24')][_0xeb31('0x40')]({'where':{'id':_0x23a50e[_0xeb31('0x3d')]['id']}})['then'](handleEntityNotFound(_0x10ab29,null))[_0xeb31('0x1f')](saveUpdates(_0x23a50e[_0xeb31('0x43')],null))[_0xeb31('0x1f')](respondWithResult(_0x10ab29,null))['catch'](handleError(_0x10ab29,null));};exports[_0xeb31('0x20')]=function(_0xc40211,_0x5d0b90){return db[_0xeb31('0x24')][_0xeb31('0x40')]({'where':{'id':_0xc40211['params']['id']}})[_0xeb31('0x1f')](handleEntityNotFound(_0x5d0b90,null))[_0xeb31('0x1f')](removeEntity(_0x5d0b90,null))['catch'](handleError(_0x5d0b90,null));};exports[_0xeb31('0x44')]=function(_0x5d1d74,_0x7f8ed0){return db[_0xeb31('0x24')][_0xeb31('0x44')]()[_0xeb31('0x1f')](respondWithResult(_0x7f8ed0,null))[_0xeb31('0x3b')](handleError(_0x7f8ed0,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 4c7876c..056d9a8 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 _0xe97e=['define','MailSubstatus','mail_substatuses','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailSubstatus.attributes','exports'];(function(_0xa45c8e,_0x4631e6){var _0x56f4ea=function(_0x5db1ce){while(--_0x5db1ce){_0xa45c8e['push'](_0xa45c8e['shift']());}};_0x56f4ea(++_0x4631e6);}(_0xe97e,0x162));var _0xee97=function(_0x1d2dde,_0x43821b){_0x1d2dde=_0x1d2dde-0x0;var _0x315d19=_0xe97e[_0x1d2dde];return _0x315d19;};'use strict';var _=require('lodash');var util=require(_0xee97('0x0'));var logger=require(_0xee97('0x1'))(_0xee97('0x2'));var moment=require(_0xee97('0x3'));var BPromise=require(_0xee97('0x4'));var rp=require(_0xee97('0x5'));var fs=require('fs');var path=require(_0xee97('0x6'));var rimraf=require(_0xee97('0x7'));var config=require('../../config/environment');var attributes=require(_0xee97('0x8'));module[_0xee97('0x9')]=function(_0x4678d9,_0x4b2cab){return _0x4678d9[_0xee97('0xa')](_0xee97('0xb'),attributes,{'tableName':_0xee97('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3f0=['../../config/logger','api','moment','request-promise','path','rimraf','exports','define','MailSubstatus','mail_substatuses','lodash','util'];(function(_0x21bee1,_0x1bc743){var _0x40df80=function(_0x160abc){while(--_0x160abc){_0x21bee1['push'](_0x21bee1['shift']());}};_0x40df80(++_0x1bc743);}(_0xf3f0,0x82));var _0x0f3f=function(_0x599a23,_0x353cc4){_0x599a23=_0x599a23-0x0;var _0x5f130b=_0xf3f0[_0x599a23];return _0x5f130b;};'use strict';var _=require(_0x0f3f('0x0'));var util=require(_0x0f3f('0x1'));var logger=require(_0x0f3f('0x2'))(_0x0f3f('0x3'));var moment=require(_0x0f3f('0x4'));var BPromise=require('bluebird');var rp=require(_0x0f3f('0x5'));var fs=require('fs');var path=require(_0x0f3f('0x6'));var rimraf=require(_0x0f3f('0x7'));var config=require('../../config/environment');var attributes=require('./mailSubstatus.attributes');module[_0x0f3f('0x8')]=function(_0x382713,_0x5f27d2){return _0x382713[_0x0f3f('0x9')](_0x0f3f('0xa'),attributes,{'tableName':_0x0f3f('0xb'),'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 14038df..b1bc4fa 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 _0x702d=['stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0x589222,_0x1cfc0c){var _0x167251=function(_0x2e2d71){while(--_0x2e2d71){_0x589222['push'](_0x589222['shift']());}};_0x167251(++_0x1cfc0c);}(_0x702d,0x147));var _0xd702=function(_0x176f41,_0x4a64ae){_0x176f41=_0x176f41-0x0;var _0x41e7ad=_0x702d[_0x176f41];return _0x41e7ad;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var moment=require(_0xd702('0x2'));var BPromise=require(_0xd702('0x3'));var rs=require(_0xd702('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd702('0x5'))['db'];var utils=require(_0xd702('0x6'));var logger=require(_0xd702('0x7'))(_0xd702('0x8'));var config=require('../../config/environment');var jayson=require(_0xd702('0x9'));var client=jayson['client'][_0xd702('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a2c03,_0xf4bf4f,_0x5af246){return new BPromise(function(_0x12bb75,_0x53bd02){return client[_0xd702('0xb')](_0x3a2c03,_0x5af246)[_0xd702('0xc')](function(_0x907a9f){logger[_0xd702('0xd')](_0xd702('0xe'),_0xf4bf4f,_0xd702('0xf'));logger[_0xd702('0x10')](_0xd702('0x11'),_0xf4bf4f,_0xd702('0xf'),JSON[_0xd702('0x12')](_0x907a9f));if(_0x907a9f['error']){if(_0x907a9f['error'][_0xd702('0x13')]===0x1f4){logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x907a9f['error'][_0xd702('0x15')]);return _0x53bd02(_0x907a9f[_0xd702('0x14')][_0xd702('0x15')]);}logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x907a9f[_0xd702('0x14')]['message']);return _0x12bb75(_0x907a9f[_0xd702('0x14')][_0xd702('0x15')]);}else{logger['info'](_0xd702('0xe'),_0xf4bf4f,'request\x20sent');_0x12bb75(_0x907a9f[_0xd702('0x16')][_0xd702('0x15')]);}})['catch'](function(_0x2ba791){logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x2ba791);_0x53bd02(_0x2ba791);});});} \ No newline at end of file +var _0x41bb=['MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x166671,_0xd34b4b){var _0x521180=function(_0x55d82a){while(--_0x55d82a){_0x166671['push'](_0x166671['shift']());}};_0x521180(++_0xd34b4b);}(_0x41bb,0xc5));var _0xb41b=function(_0x40d44a,_0x41ad54){_0x40d44a=_0x40d44a-0x0;var _0x45225d=_0x41bb[_0x40d44a];return _0x45225d;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var moment=require('moment');var BPromise=require(_0xb41b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb41b('0x3'));var db=require(_0xb41b('0x4'))['db'];var utils=require(_0xb41b('0x5'));var logger=require(_0xb41b('0x6'))('rpc');var config=require(_0xb41b('0x7'));var jayson=require(_0xb41b('0x8'));var client=jayson[_0xb41b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5455ce,_0x497242,_0x2704f0){return new BPromise(function(_0x29c30d,_0x53722a){return client[_0xb41b('0xa')](_0x5455ce,_0x2704f0)[_0xb41b('0xb')](function(_0x11b8b2){logger[_0xb41b('0xc')](_0xb41b('0xd'),_0x497242,_0xb41b('0xe'));logger[_0xb41b('0xf')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x497242,_0xb41b('0xe'),JSON['stringify'](_0x11b8b2));if(_0x11b8b2[_0xb41b('0x10')]){if(_0x11b8b2[_0xb41b('0x10')][_0xb41b('0x11')]===0x1f4){logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0x11b8b2['error'][_0xb41b('0x12')]);return _0x53722a(_0x11b8b2[_0xb41b('0x10')][_0xb41b('0x12')]);}logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0x11b8b2['error']['message']);return _0x29c30d(_0x11b8b2['error'][_0xb41b('0x12')]);}else{logger[_0xb41b('0xc')](_0xb41b('0xd'),_0x497242,_0xb41b('0xe'));_0x29c30d(_0x11b8b2[_0xb41b('0x13')]['message']);}})[_0xb41b('0x14')](function(_0xd0b6b5){logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0xd0b6b5);_0x53722a(_0xd0b6b5);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 6d485d4..a8e1fed 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 _0xe3b8=['connect-timeout','express','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','destroy','exports','multer','util','path'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0xe3b8,0xb1));var _0x8e3b=function(_0x370708,_0x1ce78c){_0x370708=_0x370708-0x0;var _0x1ea845=_0xe3b8[_0x370708];return _0x1ea845;};'use strict';var multer=require(_0x8e3b('0x0'));var util=require(_0x8e3b('0x1'));var path=require(_0x8e3b('0x2'));var timeout=require(_0x8e3b('0x3'));var express=require(_0x8e3b('0x4'));var router=express['Router']();var auth=require(_0x8e3b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8e3b('0x6'));var controller=require(_0x8e3b('0x7'));router[_0x8e3b('0x8')]('/',auth[_0x8e3b('0x9')](),controller[_0x8e3b('0xa')]);router[_0x8e3b('0x8')](_0x8e3b('0xb'),auth['isAuthenticated'](),controller[_0x8e3b('0xc')]);router[_0x8e3b('0x8')](_0x8e3b('0xd'),auth['isAuthenticated'](),controller[_0x8e3b('0xe')]);router[_0x8e3b('0xf')]('/',auth['isAuthenticated'](),controller[_0x8e3b('0x10')]);router['put']('/:id',auth[_0x8e3b('0x9')](),controller[_0x8e3b('0x11')]);router['delete']('/:id',auth[_0x8e3b('0x9')](),controller[_0x8e3b('0x12')]);module[_0x8e3b('0x13')]=router; \ No newline at end of file +var _0x3a35=['get','show','post','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','/describe'];(function(_0x1e9556,_0x259efb){var _0x2d5233=function(_0x493c0a){while(--_0x493c0a){_0x1e9556['push'](_0x1e9556['shift']());}};_0x2d5233(++_0x259efb);}(_0x3a35,0x127));var _0x53a3=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x3a35[_0x3de8a4];return _0x4635cf;};'use strict';var multer=require(_0x53a3('0x0'));var util=require(_0x53a3('0x1'));var path=require(_0x53a3('0x2'));var timeout=require(_0x53a3('0x3'));var express=require(_0x53a3('0x4'));var router=express[_0x53a3('0x5')]();var auth=require(_0x53a3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x53a3('0x7'));var controller=require(_0x53a3('0x8'));router['get']('/',auth[_0x53a3('0x9')](),controller['index']);router['get'](_0x53a3('0xa'),auth[_0x53a3('0x9')](),controller['describe']);router[_0x53a3('0xb')]('/:id',auth[_0x53a3('0x9')](),controller[_0x53a3('0xc')]);router[_0x53a3('0xd')]('/',auth[_0x53a3('0x9')](),controller['create']);router[_0x53a3('0xe')](_0x53a3('0xf'),auth[_0x53a3('0x9')](),controller[_0x53a3('0x10')]);router[_0x53a3('0x11')]('/:id',auth[_0x53a3('0x9')](),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 512ac61..5a395be 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 _0xc3eb=['account','queue','NOW','moment','exports','STRING'];(function(_0x5b869b,_0x5da478){var _0x1a1312=function(_0x4d7993){while(--_0x4d7993){_0x5b869b['push'](_0x5b869b['shift']());}};_0x1a1312(++_0x5da478);}(_0xc3eb,0xe1));var _0xbc3e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xc3eb[_0x2a6809];return _0x11c371;};'use strict';var moment=require(_0xbc3e('0x0'));var Sequelize=require('sequelize');module[_0xbc3e('0x1')]={'uniqueid':{'type':Sequelize[_0xbc3e('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbc3e('0x3'),'agent',_0xbc3e('0x4')),'allowNull':![],'defaultValue':_0xbc3e('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xbc3e('0x5')]}}; \ No newline at end of file +var _0xdc9d=['queue','NOW','moment','sequelize','exports','STRING','ENUM','account','agent'];(function(_0x6bfb1a,_0x59e024){var _0x7e6759=function(_0x126273){while(--_0x126273){_0x6bfb1a['push'](_0x6bfb1a['shift']());}};_0x7e6759(++_0x59e024);}(_0xdc9d,0x197));var _0xddc9=function(_0x173c29,_0x467a04){_0x173c29=_0x173c29-0x0;var _0xbd77bb=_0xdc9d[_0x173c29];return _0xbd77bb;};'use strict';var moment=require(_0xddc9('0x0'));var Sequelize=require(_0xddc9('0x1'));module[_0xddc9('0x2')]={'uniqueid':{'type':Sequelize[_0xddc9('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xddc9('0x4')](_0xddc9('0x5'),_0xddc9('0x6'),_0xddc9('0x7')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xddc9('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 81b9431..19ab089 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 _0x4938=['rimraf','fast-json-patch','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','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','then','destroy','stack','name','send','index','map','MailTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','describe','html-pdf'];(function(_0x4be67c,_0xca024a){var _0x3f71af=function(_0x4b91be){while(--_0x4b91be){_0x4be67c['push'](_0x4be67c['shift']());}};_0x3f71af(++_0xca024a);}(_0x4938,0xda));var _0x8493=function(_0x1d2bc8,_0x2860bc){_0x1d2bc8=_0x1d2bc8-0x0;var _0x1857e1=_0x4938[_0x1d2bc8];return _0x1857e1;};'use strict';var pdf=require(_0x8493('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8493('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8493('0x2'));var rp=require(_0x8493('0x3'));var moment=require(_0x8493('0x4'));var BPromise=require(_0x8493('0x5'));var Mustache=require(_0x8493('0x6'));var util=require(_0x8493('0x7'));var path=require(_0x8493('0x8'));var sox=require(_0x8493('0x9'));var csv=require('to-csv');var ejs=require(_0x8493('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8493('0xb'));var crypto=require(_0x8493('0xc'));var jsforce=require(_0x8493('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8493('0xe'));var querystring=require(_0x8493('0xf'));var Papa=require(_0x8493('0x10'));var Redis=require(_0x8493('0x11'));var authService=require(_0x8493('0x12'));var qs=require(_0x8493('0x13'));var as=require(_0x8493('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8493('0x15'))(_0x8493('0x16'));var utils=require(_0x8493('0x17'));var config=require('../../config/environment');var db=require(_0x8493('0x18'))['db'];function respondWithStatusCode(_0x28fdac,_0xe758a6){_0xe758a6=_0xe758a6||0xcc;return function(_0x999ed3){if(_0x999ed3){return _0x28fdac[_0x8493('0x19')](_0xe758a6);}return _0x28fdac[_0x8493('0x1a')](_0xe758a6)[_0x8493('0x1b')]();};}function respondWithResult(_0x276ee8,_0x4c0ec7){_0x4c0ec7=_0x4c0ec7||0xc8;return function(_0x5d7c5e){if(_0x5d7c5e){return _0x276ee8[_0x8493('0x1a')](_0x4c0ec7)['json'](_0x5d7c5e);}};}function respondWithFilteredResult(_0x7d4a4c,_0x427ef1){return function(_0x3833ec){if(_0x3833ec){var _0x2cb65d=_0x3833ec[_0x8493('0x1c')],_0x319925=_0x427ef1[_0x8493('0x1d')],_0x4c88e9=_0x427ef1['offset']+_0x427ef1[_0x8493('0x1e')],_0x19ff41;if(_0x4c88e9>=_0x2cb65d){_0x4c88e9=_0x2cb65d;_0x19ff41=0xc8;}else{_0x19ff41=0xce;}_0x7d4a4c[_0x8493('0x1a')](_0x19ff41);return _0x7d4a4c[_0x8493('0x1f')](_0x8493('0x20'),_0x319925+'-'+_0x4c88e9+'/'+_0x2cb65d)[_0x8493('0x21')](_0x3833ec);}return null;};}function patchUpdates(_0x140ab9){return function(_0x363919){try{jsonpatch[_0x8493('0x22')](_0x363919,_0x140ab9,!![]);}catch(_0x30f3e6){return BPromise['reject'](_0x30f3e6);}return _0x363919['save']();};}function saveUpdates(_0x168d8a,_0x33f768){return function(_0x181bf4){if(_0x181bf4){return _0x181bf4['update'](_0x168d8a)[_0x8493('0x23')](function(_0x10b0a2){return _0x10b0a2;});}return null;};}function removeEntity(_0x243921,_0x215a4d){return function(_0x5307ac){if(_0x5307ac){return _0x5307ac[_0x8493('0x24')]()[_0x8493('0x23')](function(){_0x243921['status'](0xcc)[_0x8493('0x1b')]();});}};}function handleEntityNotFound(_0x4ce79c,_0x8327bf){return function(_0xb385ee){if(!_0xb385ee){_0x4ce79c['sendStatus'](0x194);}return _0xb385ee;};}function handleError(_0x30092b,_0xfe19d2){_0xfe19d2=_0xfe19d2||0x1f4;return function(_0x874372){logger['error'](_0x874372[_0x8493('0x25')]);if(_0x874372[_0x8493('0x26')]){delete _0x874372[_0x8493('0x26')];}_0x30092b[_0x8493('0x1a')](_0xfe19d2)[_0x8493('0x27')](_0x874372);};}exports[_0x8493('0x28')]=function(_0x3dbe44,_0x37163a){var _0xa12c46={},_0x424442={},_0x196ed1={'count':0x0,'rows':[]};var _0x144b38=_[_0x8493('0x29')](db[_0x8493('0x2a')][_0x8493('0x2b')],function(_0x5db872){return{'name':_0x5db872['fieldName'],'type':_0x5db872[_0x8493('0x2c')][_0x8493('0x2d')]};});_0x424442[_0x8493('0x2e')]=_[_0x8493('0x29')](_0x144b38,'name');_0x424442[_0x8493('0x2f')]=_[_0x8493('0x30')](_0x3dbe44[_0x8493('0x2f')]);_0x424442[_0x8493('0x31')]=_[_0x8493('0x32')](_0x424442[_0x8493('0x2e')],_0x424442[_0x8493('0x2f')]);_0xa12c46[_0x8493('0x33')]=_['intersection'](_0x424442[_0x8493('0x2e')],qs[_0x8493('0x34')](_0x3dbe44[_0x8493('0x2f')]['fields']));_0xa12c46[_0x8493('0x33')]=_0xa12c46[_0x8493('0x33')][_0x8493('0x35')]?_0xa12c46[_0x8493('0x33')]:_0x424442[_0x8493('0x2e')];if(!_0x3dbe44['query'][_0x8493('0x36')]('nolimit')){_0xa12c46['limit']=qs[_0x8493('0x1e')](_0x3dbe44[_0x8493('0x2f')][_0x8493('0x1e')]);_0xa12c46[_0x8493('0x1d')]=qs[_0x8493('0x1d')](_0x3dbe44[_0x8493('0x2f')]['offset']);}_0xa12c46['order']=qs[_0x8493('0x37')](_0x3dbe44[_0x8493('0x2f')][_0x8493('0x37')]);_0xa12c46['where']=qs[_0x8493('0x31')](_['pick'](_0x3dbe44[_0x8493('0x2f')],_0x424442[_0x8493('0x31')]),_0x144b38);if(_0x3dbe44[_0x8493('0x2f')][_0x8493('0x38')]){_0xa12c46[_0x8493('0x39')]=_[_0x8493('0x3a')](_0xa12c46[_0x8493('0x39')],{'$or':_[_0x8493('0x29')](_0x144b38,function(_0x22cc78){if(_0x22cc78['type']!==_0x8493('0x3b')){var _0x3575d0={};_0x3575d0[_0x22cc78[_0x8493('0x26')]]={'$like':'%'+_0x3dbe44[_0x8493('0x2f')][_0x8493('0x38')]+'%'};return _0x3575d0;}})});}_0xa12c46=_[_0x8493('0x3a')]({},_0xa12c46,_0x3dbe44['options']);var _0x4fd02e={'where':_0xa12c46[_0x8493('0x39')]};return db[_0x8493('0x2a')][_0x8493('0x1c')](_0x4fd02e)[_0x8493('0x23')](function(_0x3aeb86){_0x196ed1[_0x8493('0x1c')]=_0x3aeb86;if(_0x3dbe44[_0x8493('0x2f')][_0x8493('0x3c')]){_0xa12c46[_0x8493('0x3d')]=[{'all':!![]}];}return db['MailTransferReport'][_0x8493('0x3e')](_0xa12c46);})[_0x8493('0x23')](function(_0x2518bc){_0x196ed1[_0x8493('0x3f')]=_0x2518bc;return _0x196ed1;})[_0x8493('0x23')](respondWithFilteredResult(_0x37163a,_0xa12c46))[_0x8493('0x40')](handleError(_0x37163a,null));};exports[_0x8493('0x41')]=function(_0x5af5cb,_0x2f8a8f){var _0x13e369={'raw':!![],'where':{'id':_0x5af5cb[_0x8493('0x42')]['id']}},_0x286d20={};_0x286d20[_0x8493('0x2e')]=_[_0x8493('0x30')](db['MailTransferReport'][_0x8493('0x2b')]);_0x286d20[_0x8493('0x2f')]=_[_0x8493('0x30')](_0x5af5cb[_0x8493('0x2f')]);_0x286d20[_0x8493('0x31')]=_[_0x8493('0x32')](_0x286d20[_0x8493('0x2e')],_0x286d20[_0x8493('0x2f')]);_0x13e369[_0x8493('0x33')]=_[_0x8493('0x32')](_0x286d20[_0x8493('0x2e')],qs[_0x8493('0x34')](_0x5af5cb['query'][_0x8493('0x34')]));_0x13e369['attributes']=_0x13e369['attributes'][_0x8493('0x35')]?_0x13e369[_0x8493('0x33')]:_0x286d20[_0x8493('0x2e')];if(_0x5af5cb[_0x8493('0x2f')][_0x8493('0x3c')]){_0x13e369['include']=[{'all':!![]}];}_0x13e369=_[_0x8493('0x3a')]({},_0x13e369,_0x5af5cb[_0x8493('0x43')]);return db['MailTransferReport'][_0x8493('0x44')](_0x13e369)[_0x8493('0x23')](handleEntityNotFound(_0x2f8a8f,null))[_0x8493('0x23')](respondWithResult(_0x2f8a8f,null))[_0x8493('0x40')](handleError(_0x2f8a8f,null));};exports[_0x8493('0x45')]=function(_0x536511,_0x151c86){return db[_0x8493('0x2a')][_0x8493('0x45')](_0x536511[_0x8493('0x46')],{})['then'](respondWithResult(_0x151c86,0xc9))[_0x8493('0x40')](handleError(_0x151c86,null));};exports[_0x8493('0x47')]=function(_0x512379,_0x3726a4){if(_0x512379[_0x8493('0x46')]['id']){delete _0x512379['body']['id'];}return db[_0x8493('0x2a')][_0x8493('0x44')]({'where':{'id':_0x512379[_0x8493('0x42')]['id']}})[_0x8493('0x23')](handleEntityNotFound(_0x3726a4,null))[_0x8493('0x23')](saveUpdates(_0x512379['body'],null))[_0x8493('0x23')](respondWithResult(_0x3726a4,null))[_0x8493('0x40')](handleError(_0x3726a4,null));};exports[_0x8493('0x24')]=function(_0x50f2cc,_0x3f456c){return db[_0x8493('0x2a')]['find']({'where':{'id':_0x50f2cc[_0x8493('0x42')]['id']}})[_0x8493('0x23')](handleEntityNotFound(_0x3f456c,null))[_0x8493('0x23')](removeEntity(_0x3f456c,null))[_0x8493('0x40')](handleError(_0x3f456c,null));};exports[_0x8493('0x48')]=function(_0x2b11ef,_0x5a0043){return db[_0x8493('0x2a')][_0x8493('0x48')]()[_0x8493('0x23')](respondWithResult(_0x5a0043,null))['catch'](handleError(_0x5a0043,null));}; \ No newline at end of file +var _0x7a2d=['name','send','index','MailTransferReport','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','length','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','status','json','count','limit','save','update','then','end','sendStatus','error','stack'];(function(_0x54d526,_0x30ed3e){var _0x1e44e2=function(_0x2e24da){while(--_0x2e24da){_0x54d526['push'](_0x54d526['shift']());}};_0x1e44e2(++_0x30ed3e);}(_0x7a2d,0x13d));var _0xd7a2=function(_0x268c5b,_0x366e6f){_0x268c5b=_0x268c5b-0x0;var _0x18f1d8=_0x7a2d[_0x268c5b];return _0x18f1d8;};'use strict';var pdf=require(_0xd7a2('0x0'));var emlformat=require(_0xd7a2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd7a2('0x2'));var jsonpatch=require(_0xd7a2('0x3'));var rp=require(_0xd7a2('0x4'));var moment=require('moment');var BPromise=require(_0xd7a2('0x5'));var Mustache=require(_0xd7a2('0x6'));var util=require(_0xd7a2('0x7'));var path=require(_0xd7a2('0x8'));var sox=require(_0xd7a2('0x9'));var csv=require(_0xd7a2('0xa'));var ejs=require(_0xd7a2('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd7a2('0xc'));var jsforce=require(_0xd7a2('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd7a2('0xe'));var Papa=require(_0xd7a2('0xf'));var Redis=require(_0xd7a2('0x10'));var authService=require(_0xd7a2('0x11'));var qs=require(_0xd7a2('0x12'));var as=require(_0xd7a2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd7a2('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xd7a2('0x15'))['db'];function respondWithStatusCode(_0x5efcbd,_0x2d5795){_0x2d5795=_0x2d5795||0xcc;return function(_0x20fde3){if(_0x20fde3){return _0x5efcbd['sendStatus'](_0x2d5795);}return _0x5efcbd[_0xd7a2('0x16')](_0x2d5795)['end']();};}function respondWithResult(_0x5de4cb,_0x5e52a1){_0x5e52a1=_0x5e52a1||0xc8;return function(_0x59e62a){if(_0x59e62a){return _0x5de4cb[_0xd7a2('0x16')](_0x5e52a1)[_0xd7a2('0x17')](_0x59e62a);}};}function respondWithFilteredResult(_0x80173d,_0x1c1ebb){return function(_0x21f492){if(_0x21f492){var _0x2fd10f=_0x21f492[_0xd7a2('0x18')],_0x3e0d6f=_0x1c1ebb['offset'],_0x2576d1=_0x1c1ebb['offset']+_0x1c1ebb[_0xd7a2('0x19')],_0x1d44a3;if(_0x2576d1>=_0x2fd10f){_0x2576d1=_0x2fd10f;_0x1d44a3=0xc8;}else{_0x1d44a3=0xce;}_0x80173d[_0xd7a2('0x16')](_0x1d44a3);return _0x80173d['set']('Content-Range',_0x3e0d6f+'-'+_0x2576d1+'/'+_0x2fd10f)[_0xd7a2('0x17')](_0x21f492);}return null;};}function patchUpdates(_0x13702d){return function(_0x4335ab){try{jsonpatch['apply'](_0x4335ab,_0x13702d,!![]);}catch(_0x2a2a18){return BPromise['reject'](_0x2a2a18);}return _0x4335ab[_0xd7a2('0x1a')]();};}function saveUpdates(_0x3514ce,_0x5ad17e){return function(_0x1d4df6){if(_0x1d4df6){return _0x1d4df6[_0xd7a2('0x1b')](_0x3514ce)[_0xd7a2('0x1c')](function(_0x58d9d3){return _0x58d9d3;});}return null;};}function removeEntity(_0x590e74,_0x1ed4ee){return function(_0x2040b9){if(_0x2040b9){return _0x2040b9['destroy']()[_0xd7a2('0x1c')](function(){_0x590e74[_0xd7a2('0x16')](0xcc)[_0xd7a2('0x1d')]();});}};}function handleEntityNotFound(_0x5d6dc2,_0x579e9b){return function(_0x2e9ec6){if(!_0x2e9ec6){_0x5d6dc2[_0xd7a2('0x1e')](0x194);}return _0x2e9ec6;};}function handleError(_0x25acd1,_0x27fa40){_0x27fa40=_0x27fa40||0x1f4;return function(_0x4b4c7f){logger[_0xd7a2('0x1f')](_0x4b4c7f[_0xd7a2('0x20')]);if(_0x4b4c7f['name']){delete _0x4b4c7f[_0xd7a2('0x21')];}_0x25acd1[_0xd7a2('0x16')](_0x27fa40)[_0xd7a2('0x22')](_0x4b4c7f);};}exports[_0xd7a2('0x23')]=function(_0x1a429d,_0x512207){var _0x455cbc={},_0x226779={},_0x340a09={'count':0x0,'rows':[]};var _0x564467=_['map'](db[_0xd7a2('0x24')]['rawAttributes'],function(_0x5cf67f){return{'name':_0x5cf67f[_0xd7a2('0x25')],'type':_0x5cf67f[_0xd7a2('0x26')][_0xd7a2('0x27')]};});_0x226779[_0xd7a2('0x28')]=_[_0xd7a2('0x29')](_0x564467,_0xd7a2('0x21'));_0x226779[_0xd7a2('0x2a')]=_['keys'](_0x1a429d[_0xd7a2('0x2a')]);_0x226779[_0xd7a2('0x2b')]=_[_0xd7a2('0x2c')](_0x226779[_0xd7a2('0x28')],_0x226779['query']);_0x455cbc['attributes']=_[_0xd7a2('0x2c')](_0x226779[_0xd7a2('0x28')],qs['fields'](_0x1a429d['query'][_0xd7a2('0x2d')]));_0x455cbc[_0xd7a2('0x2e')]=_0x455cbc[_0xd7a2('0x2e')]['length']?_0x455cbc[_0xd7a2('0x2e')]:_0x226779[_0xd7a2('0x28')];if(!_0x1a429d[_0xd7a2('0x2a')][_0xd7a2('0x2f')](_0xd7a2('0x30'))){_0x455cbc[_0xd7a2('0x19')]=qs[_0xd7a2('0x19')](_0x1a429d[_0xd7a2('0x2a')]['limit']);_0x455cbc[_0xd7a2('0x31')]=qs[_0xd7a2('0x31')](_0x1a429d['query'][_0xd7a2('0x31')]);}_0x455cbc['order']=qs[_0xd7a2('0x32')](_0x1a429d['query'][_0xd7a2('0x32')]);_0x455cbc[_0xd7a2('0x33')]=qs['filters'](_[_0xd7a2('0x34')](_0x1a429d[_0xd7a2('0x2a')],_0x226779['filters']),_0x564467);if(_0x1a429d[_0xd7a2('0x2a')]['filter']){_0x455cbc[_0xd7a2('0x33')]=_[_0xd7a2('0x35')](_0x455cbc['where'],{'$or':_[_0xd7a2('0x29')](_0x564467,function(_0x313473){if(_0x313473['type']!==_0xd7a2('0x36')){var _0x36ce9d={};_0x36ce9d[_0x313473[_0xd7a2('0x21')]]={'$like':'%'+_0x1a429d[_0xd7a2('0x2a')][_0xd7a2('0x37')]+'%'};return _0x36ce9d;}})});}_0x455cbc=_[_0xd7a2('0x35')]({},_0x455cbc,_0x1a429d[_0xd7a2('0x38')]);var _0x28b4b2={'where':_0x455cbc[_0xd7a2('0x33')]};return db[_0xd7a2('0x24')][_0xd7a2('0x18')](_0x28b4b2)[_0xd7a2('0x1c')](function(_0x2cdadb){_0x340a09[_0xd7a2('0x18')]=_0x2cdadb;if(_0x1a429d[_0xd7a2('0x2a')][_0xd7a2('0x39')]){_0x455cbc[_0xd7a2('0x3a')]=[{'all':!![]}];}return db[_0xd7a2('0x24')][_0xd7a2('0x3b')](_0x455cbc);})['then'](function(_0x3eef57){_0x340a09[_0xd7a2('0x3c')]=_0x3eef57;return _0x340a09;})[_0xd7a2('0x1c')](respondWithFilteredResult(_0x512207,_0x455cbc))[_0xd7a2('0x3d')](handleError(_0x512207,null));};exports['show']=function(_0x5f48bb,_0x3a9136){var _0x21b4c2={'raw':!![],'where':{'id':_0x5f48bb[_0xd7a2('0x3e')]['id']}},_0x1bd909={};_0x1bd909[_0xd7a2('0x28')]=_[_0xd7a2('0x3f')](db[_0xd7a2('0x24')][_0xd7a2('0x40')]);_0x1bd909[_0xd7a2('0x2a')]=_[_0xd7a2('0x3f')](_0x5f48bb[_0xd7a2('0x2a')]);_0x1bd909[_0xd7a2('0x2b')]=_[_0xd7a2('0x2c')](_0x1bd909[_0xd7a2('0x28')],_0x1bd909['query']);_0x21b4c2[_0xd7a2('0x2e')]=_['intersection'](_0x1bd909[_0xd7a2('0x28')],qs[_0xd7a2('0x2d')](_0x5f48bb['query'][_0xd7a2('0x2d')]));_0x21b4c2[_0xd7a2('0x2e')]=_0x21b4c2[_0xd7a2('0x2e')][_0xd7a2('0x41')]?_0x21b4c2['attributes']:_0x1bd909[_0xd7a2('0x28')];if(_0x5f48bb[_0xd7a2('0x2a')]['includeAll']){_0x21b4c2[_0xd7a2('0x3a')]=[{'all':!![]}];}_0x21b4c2=_[_0xd7a2('0x35')]({},_0x21b4c2,_0x5f48bb['options']);return db[_0xd7a2('0x24')][_0xd7a2('0x42')](_0x21b4c2)[_0xd7a2('0x1c')](handleEntityNotFound(_0x3a9136,null))[_0xd7a2('0x1c')](respondWithResult(_0x3a9136,null))[_0xd7a2('0x3d')](handleError(_0x3a9136,null));};exports[_0xd7a2('0x43')]=function(_0x1413ec,_0x3bfd55){return db[_0xd7a2('0x24')][_0xd7a2('0x43')](_0x1413ec[_0xd7a2('0x44')],{})['then'](respondWithResult(_0x3bfd55,0xc9))[_0xd7a2('0x3d')](handleError(_0x3bfd55,null));};exports[_0xd7a2('0x1b')]=function(_0x396539,_0x93ef94){if(_0x396539['body']['id']){delete _0x396539[_0xd7a2('0x44')]['id'];}return db[_0xd7a2('0x24')][_0xd7a2('0x42')]({'where':{'id':_0x396539['params']['id']}})[_0xd7a2('0x1c')](handleEntityNotFound(_0x93ef94,null))['then'](saveUpdates(_0x396539[_0xd7a2('0x44')],null))[_0xd7a2('0x1c')](respondWithResult(_0x93ef94,null))[_0xd7a2('0x3d')](handleError(_0x93ef94,null));};exports['destroy']=function(_0x19a3b2,_0x916e68){return db[_0xd7a2('0x24')][_0xd7a2('0x42')]({'where':{'id':_0x19a3b2[_0xd7a2('0x3e')]['id']}})[_0xd7a2('0x1c')](handleEntityNotFound(_0x916e68,null))[_0xd7a2('0x1c')](removeEntity(_0x916e68,null))[_0xd7a2('0x3d')](handleError(_0x916e68,null));};exports[_0xd7a2('0x45')]=function(_0x5454bf,_0x4957c5){return db[_0xd7a2('0x24')][_0xd7a2('0x45')]()[_0xd7a2('0x1c')](respondWithResult(_0x4957c5,null))[_0xd7a2('0x3d')](handleError(_0x4957c5,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index d1d97c3..3ea3df3 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 _0x693b=['api','moment','bluebird','request-promise','./mailTransferReport.attributes','exports','define','report_mail_transfer','uniqueid','lodash','../../config/logger'];(function(_0x260fcf,_0x44ea0c){var _0x5d1d08=function(_0xb234aa){while(--_0xb234aa){_0x260fcf['push'](_0x260fcf['shift']());}};_0x5d1d08(++_0x44ea0c);}(_0x693b,0x111));var _0xb693=function(_0x25245c,_0x5d4131){_0x25245c=_0x25245c-0x0;var _0x1ddffd=_0x693b[_0x25245c];return _0x1ddffd;};'use strict';var _=require(_0xb693('0x0'));var util=require('util');var logger=require(_0xb693('0x1'))(_0xb693('0x2'));var moment=require(_0xb693('0x3'));var BPromise=require(_0xb693('0x4'));var rp=require(_0xb693('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb693('0x6'));module[_0xb693('0x7')]=function(_0x37ef06,_0xc69c5e){return _0x37ef06[_0xb693('0x8')]('MailTransferReport',attributes,{'tableName':_0xb693('0x9'),'paranoid':![],'indexes':[{'name':_0xb693('0xa'),'fields':[_0xb693('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa937=['api','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x53bf57,_0xc0c26f){var _0x3eea29=function(_0x840d59){while(--_0x840d59){_0x53bf57['push'](_0x53bf57['shift']());}};_0x3eea29(++_0xc0c26f);}(_0xa937,0x6d));var _0x7a93=function(_0x52bf68,_0x382e6e){_0x52bf68=_0x52bf68-0x0;var _0x17c162=_0xa937[_0x52bf68];return _0x17c162;};'use strict';var _=require(_0x7a93('0x0'));var util=require(_0x7a93('0x1'));var logger=require(_0x7a93('0x2'))(_0x7a93('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7a93('0x4'));var fs=require('fs');var path=require(_0x7a93('0x5'));var rimraf=require(_0x7a93('0x6'));var config=require(_0x7a93('0x7'));var attributes=require(_0x7a93('0x8'));module[_0x7a93('0x9')]=function(_0x5d681e,_0x5f53cc){return _0x5d681e[_0x7a93('0xa')](_0x7a93('0xb'),attributes,{'tableName':_0x7a93('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7a93('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index b9b7f5f..06590ea 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 _0x3a13=['jayson/promise','client','http','request','request\x20sent','debug','error','code','message','info','MailTransferReport,\x20%s,\x20%s','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3a13,0x14f));var _0x33a1=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x3a13[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x33a1('0x0'));var util=require('util');var moment=require(_0x33a1('0x1'));var BPromise=require('bluebird');var rs=require(_0x33a1('0x2'));var fs=require('fs');var Redis=require(_0x33a1('0x3'));var db=require(_0x33a1('0x4'))['db'];var utils=require(_0x33a1('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x33a1('0x6'));var jayson=require(_0x33a1('0x7'));var client=jayson[_0x33a1('0x8')][_0x33a1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14ae71,_0x2a51c2,_0x48d185){return new BPromise(function(_0x4541bf,_0x37e7fd){return client[_0x33a1('0xa')](_0x14ae71,_0x48d185)['then'](function(_0x274f09){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x2a51c2,_0x33a1('0xb'));logger[_0x33a1('0xc')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x2a51c2,_0x33a1('0xb'),JSON['stringify'](_0x274f09));if(_0x274f09[_0x33a1('0xd')]){if(_0x274f09[_0x33a1('0xd')][_0x33a1('0xe')]===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x2a51c2,_0x274f09[_0x33a1('0xd')][_0x33a1('0xf')]);return _0x37e7fd(_0x274f09['error'][_0x33a1('0xf')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x2a51c2,_0x274f09['error']['message']);return _0x4541bf(_0x274f09[_0x33a1('0xd')]['message']);}else{logger[_0x33a1('0x10')](_0x33a1('0x11'),_0x2a51c2,'request\x20sent');_0x4541bf(_0x274f09['result'][_0x33a1('0xf')]);}})[_0x33a1('0x12')](function(_0x35fe5d){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x2a51c2,_0x35fe5d);_0x37e7fd(_0x35fe5d);});});} \ No newline at end of file +var _0x9d23=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','then','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','MailTransferReport,\x20%s,\x20%s','message','result'];(function(_0x40453a,_0x1ff061){var _0x2da74d=function(_0x73e877){while(--_0x73e877){_0x40453a['push'](_0x40453a['shift']());}};_0x2da74d(++_0x1ff061);}(_0x9d23,0xbf));var _0x39d2=function(_0x49ebd8,_0x1e81b0){_0x49ebd8=_0x49ebd8-0x0;var _0x179591=_0x9d23[_0x49ebd8];return _0x179591;};'use strict';var _=require(_0x39d2('0x0'));var util=require(_0x39d2('0x1'));var moment=require(_0x39d2('0x2'));var BPromise=require(_0x39d2('0x3'));var rs=require(_0x39d2('0x4'));var fs=require('fs');var Redis=require(_0x39d2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x39d2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x39d2('0x7'));var client=jayson[_0x39d2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe6b17e,_0x4a8fc2,_0xf53a5a){return new BPromise(function(_0x200110,_0xaaecd5){return client['request'](_0xe6b17e,_0xf53a5a)[_0x39d2('0x9')](function(_0x4e37b1){logger[_0x39d2('0xa')]('MailTransferReport,\x20%s,\x20%s',_0x4a8fc2,_0x39d2('0xb'));logger[_0x39d2('0xc')](_0x39d2('0xd'),_0x4a8fc2,_0x39d2('0xb'),JSON['stringify'](_0x4e37b1));if(_0x4e37b1[_0x39d2('0xe')]){if(_0x4e37b1[_0x39d2('0xe')]['code']===0x1f4){logger[_0x39d2('0xe')](_0x39d2('0xf'),_0x4a8fc2,_0x4e37b1['error']['message']);return _0xaaecd5(_0x4e37b1[_0x39d2('0xe')]['message']);}logger['error'](_0x39d2('0xf'),_0x4a8fc2,_0x4e37b1['error'][_0x39d2('0x10')]);return _0x200110(_0x4e37b1[_0x39d2('0xe')][_0x39d2('0x10')]);}else{logger[_0x39d2('0xa')](_0x39d2('0xf'),_0x4a8fc2,_0x39d2('0xb'));_0x200110(_0x4e37b1[_0x39d2('0x11')]['message']);}})[_0x39d2('0x12')](function(_0x462c54){logger[_0x39d2('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x4a8fc2,_0x462c54);_0xaaecd5(_0x462c54);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index a14b843..1d8ea73 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 _0x5f48=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f48,0xb0));var _0x85f4=function(_0x13b9f5,_0x67f583){_0x13b9f5=_0x13b9f5-0x0;var _0x3f3489=_0x5f48[_0x13b9f5];return _0x3f3489;};'use strict';var multer=require(_0x85f4('0x0'));var util=require(_0x85f4('0x1'));var path=require('path');var timeout=require(_0x85f4('0x2'));var express=require(_0x85f4('0x3'));var router=express['Router']();var auth=require(_0x85f4('0x4'));var interaction=require(_0x85f4('0x5'));var config=require(_0x85f4('0x6'));var controller=require('./memberReport.controller');router[_0x85f4('0x7')]('/',auth[_0x85f4('0x8')](),controller['index']);router[_0x85f4('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x85f4('0x9')]);router[_0x85f4('0x7')](_0x85f4('0xa'),auth['isAuthenticated'](),controller[_0x85f4('0xb')]);router[_0x85f4('0xc')]('/',auth[_0x85f4('0x8')](),controller[_0x85f4('0xd')]);router['put'](_0x85f4('0xa'),auth[_0x85f4('0x8')](),controller[_0x85f4('0xe')]);router[_0x85f4('0xf')](_0x85f4('0xa'),auth['isAuthenticated'](),controller[_0x85f4('0x10')]);module[_0x85f4('0x11')]=router; \ No newline at end of file +var _0x7157=['get','index','/describe','isAuthenticated','describe','post','create','put','/:id','update','delete','exports','multer','path','Router','../../components/auth/service','../../config/environment'];(function(_0x29a9a7,_0x3c30d2){var _0x41eda3=function(_0x5b8cfd){while(--_0x5b8cfd){_0x29a9a7['push'](_0x29a9a7['shift']());}};_0x41eda3(++_0x3c30d2);}(_0x7157,0x13e));var _0x7715=function(_0x4a87da,_0x30004b){_0x4a87da=_0x4a87da-0x0;var _0x1509f2=_0x7157[_0x4a87da];return _0x1509f2;};'use strict';var multer=require(_0x7715('0x0'));var util=require('util');var path=require(_0x7715('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7715('0x2')]();var auth=require(_0x7715('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7715('0x4'));var controller=require('./memberReport.controller');router[_0x7715('0x5')]('/',auth['isAuthenticated'](),controller[_0x7715('0x6')]);router[_0x7715('0x5')](_0x7715('0x7'),auth[_0x7715('0x8')](),controller[_0x7715('0x9')]);router[_0x7715('0x5')]('/:id',auth[_0x7715('0x8')](),controller['show']);router[_0x7715('0xa')]('/',auth[_0x7715('0x8')](),controller[_0x7715('0xb')]);router[_0x7715('0xc')](_0x7715('0xd'),auth[_0x7715('0x8')](),controller[_0x7715('0xe')]);router[_0x7715('0xf')](_0x7715('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x7715('0x10')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 3161e30..643de7f 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 _0x005e=['getDataValue','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING','LOGIN,\x20PAUSE,\x20TALKING','DATE'];(function(_0xacc729,_0x1a6059){var _0x13ba9d=function(_0xccce3){while(--_0xccce3){_0xacc729['push'](_0xacc729['shift']());}};_0x13ba9d(++_0x1a6059);}(_0x005e,0x1f3));var _0xe005=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x005e[_0x32f7d7];return _0x133d09;};'use strict';var Sequelize=require(_0xe005('0x0'));var moment=require(_0xe005('0x1'));module['exports']={'channel':{'type':Sequelize[_0xe005('0x2')]},'membername':{'type':Sequelize[_0xe005('0x2')]},'interface':{'type':Sequelize[_0xe005('0x2')]},'type':{'type':Sequelize[_0xe005('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xe005('0x3')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe005('0x4')],'set':function(_0x5a0123){var _0xfbb3d5=moment(_0x5a0123);var _0x125162=moment(this[_0xe005('0x5')]('enterAt'));var _0x3c6d80=_0xfbb3d5['diff'](_0x125162,_0xe005('0x6'));this[_0xe005('0x7')](_0xe005('0x8'),_0x5a0123);this['setDataValue'](_0xe005('0x9'),_0x3c6d80||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xe005('0xa')},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xe005('0x2')],'comment':_0xe005('0xb')},'data4':{'type':Sequelize[_0xe005('0x2')],'comment':_0xe005('0xc')},'data5':{'type':Sequelize['STRING'],'comment':_0xe005('0xd')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0f8e=['DATE','enterAt','diff','seconds','exitAt','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','sequelize','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER'];(function(_0x46f75,_0x4b747b){var _0x4e0609=function(_0x153c6e){while(--_0x153c6e){_0x46f75['push'](_0x46f75['shift']());}};_0x4e0609(++_0x4b747b);}(_0x0f8e,0xbe));var _0xe0f8=function(_0x47c958,_0x3cfe09){_0x47c958=_0x47c958-0x0;var _0x573eab=_0x0f8e[_0x47c958];return _0x573eab;};'use strict';var Sequelize=require(_0xe0f8('0x0'));var moment=require(_0xe0f8('0x1'));module['exports']={'channel':{'type':Sequelize[_0xe0f8('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xe0f8('0x2')]},'type':{'type':Sequelize[_0xe0f8('0x2')],'defaultValue':_0xe0f8('0x3'),'comment':_0xe0f8('0x4')},'duration':{'type':Sequelize[_0xe0f8('0x5')]},'enterAt':{'type':Sequelize[_0xe0f8('0x6')]},'exitAt':{'type':Sequelize[_0xe0f8('0x6')],'set':function(_0x525981){var _0x671257=moment(_0x525981);var _0x3f4a4c=moment(this['getDataValue'](_0xe0f8('0x7')));var _0x626ab3=_0x671257[_0xe0f8('0x8')](_0x3f4a4c,_0xe0f8('0x9'));this['setDataValue'](_0xe0f8('0xa'),_0x525981);this[_0xe0f8('0xb')]('duration',_0x626ab3||null);}},'data1':{'type':Sequelize[_0xe0f8('0x2')],'comment':_0xe0f8('0xc')},'data2':{'type':Sequelize['STRING'],'comment':_0xe0f8('0xd')},'data3':{'type':Sequelize[_0xe0f8('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xe0f8('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xe0f8('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xe0f8('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index fb4e09d..9dd709f 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 _0xcfdf=['describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MemberReport','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','params','options','find','create','body','catch'];(function(_0x546fd1,_0x524034){var _0x3fb790=function(_0x5ed3b9){while(--_0x5ed3b9){_0x546fd1['push'](_0x546fd1['shift']());}};_0x3fb790(++_0x524034);}(_0xcfdf,0x93));var _0xfcfd=function(_0x1bec60,_0x554ed4){_0x1bec60=_0x1bec60-0x0;var _0x2c94b8=_0xcfdf[_0x1bec60];return _0x2c94b8;};'use strict';var pdf=require(_0xfcfd('0x0'));var emlformat=require(_0xfcfd('0x1'));var rimraf=require(_0xfcfd('0x2'));var zipdir=require(_0xfcfd('0x3'));var jsonpatch=require(_0xfcfd('0x4'));var rp=require('request-promise');var moment=require(_0xfcfd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfcfd('0x6'));var util=require(_0xfcfd('0x7'));var path=require(_0xfcfd('0x8'));var sox=require(_0xfcfd('0x9'));var csv=require(_0xfcfd('0xa'));var ejs=require(_0xfcfd('0xb'));var fs=require('fs');var _=require(_0xfcfd('0xc'));var squel=require(_0xfcfd('0xd'));var crypto=require(_0xfcfd('0xe'));var jsforce=require(_0xfcfd('0xf'));var deskjs=require(_0xfcfd('0x10'));var toCsv=require(_0xfcfd('0xa'));var querystring=require(_0xfcfd('0x11'));var Papa=require('papaparse');var Redis=require(_0xfcfd('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfcfd('0x13'));var hardwareService=require(_0xfcfd('0x14'));var logger=require(_0xfcfd('0x15'))(_0xfcfd('0x16'));var utils=require(_0xfcfd('0x17'));var config=require('../../config/environment');var db=require(_0xfcfd('0x18'))['db'];function respondWithStatusCode(_0x11542e,_0x3f1d2f){_0x3f1d2f=_0x3f1d2f||0xcc;return function(_0x1f6f03){if(_0x1f6f03){return _0x11542e[_0xfcfd('0x19')](_0x3f1d2f);}return _0x11542e[_0xfcfd('0x1a')](_0x3f1d2f)[_0xfcfd('0x1b')]();};}function respondWithResult(_0xf33ce,_0xad843a){_0xad843a=_0xad843a||0xc8;return function(_0x42e16e){if(_0x42e16e){return _0xf33ce['status'](_0xad843a)[_0xfcfd('0x1c')](_0x42e16e);}};}function respondWithFilteredResult(_0x415f79,_0x42106b){return function(_0x2954fb){if(_0x2954fb){var _0x50486d=_0x2954fb['count'],_0x3cce81=_0x42106b[_0xfcfd('0x1d')],_0x33e45d=_0x42106b[_0xfcfd('0x1d')]+_0x42106b['limit'],_0x31eae4;if(_0x33e45d>=_0x50486d){_0x33e45d=_0x50486d;_0x31eae4=0xc8;}else{_0x31eae4=0xce;}_0x415f79['status'](_0x31eae4);return _0x415f79['set'](_0xfcfd('0x1e'),_0x3cce81+'-'+_0x33e45d+'/'+_0x50486d)[_0xfcfd('0x1c')](_0x2954fb);}return null;};}function patchUpdates(_0x4f80e6){return function(_0x27a533){try{jsonpatch[_0xfcfd('0x1f')](_0x27a533,_0x4f80e6,!![]);}catch(_0x425534){return BPromise[_0xfcfd('0x20')](_0x425534);}return _0x27a533[_0xfcfd('0x21')]();};}function saveUpdates(_0x2713e8,_0x316b5b){return function(_0x512279){if(_0x512279){return _0x512279[_0xfcfd('0x22')](_0x2713e8)[_0xfcfd('0x23')](function(_0x45d68c){return _0x45d68c;});}return null;};}function removeEntity(_0x8dbb62,_0x329fbc){return function(_0x5ebf76){if(_0x5ebf76){return _0x5ebf76[_0xfcfd('0x24')]()['then'](function(){_0x8dbb62[_0xfcfd('0x1a')](0xcc)[_0xfcfd('0x1b')]();});}};}function handleEntityNotFound(_0x13bacd,_0x415246){return function(_0xd71884){if(!_0xd71884){_0x13bacd[_0xfcfd('0x19')](0x194);}return _0xd71884;};}function handleError(_0x1b5d35,_0x5dfbe6){_0x5dfbe6=_0x5dfbe6||0x1f4;return function(_0x474e77){logger[_0xfcfd('0x25')](_0x474e77[_0xfcfd('0x26')]);if(_0x474e77[_0xfcfd('0x27')]){delete _0x474e77[_0xfcfd('0x27')];}_0x1b5d35['status'](_0x5dfbe6)[_0xfcfd('0x28')](_0x474e77);};}exports[_0xfcfd('0x29')]=function(_0x404039,_0xd3710f){var _0x4c6e43={},_0x3bb483={},_0x3c8b4c={'count':0x0,'rows':[]};var _0x5d9e6e=_[_0xfcfd('0x2a')](db[_0xfcfd('0x2b')][_0xfcfd('0x2c')],function(_0x104853){return{'name':_0x104853['fieldName'],'type':_0x104853['type']['key']};});_0x3bb483[_0xfcfd('0x2d')]=_[_0xfcfd('0x2a')](_0x5d9e6e,_0xfcfd('0x27'));_0x3bb483[_0xfcfd('0x2e')]=_[_0xfcfd('0x2f')](_0x404039['query']);_0x3bb483[_0xfcfd('0x30')]=_[_0xfcfd('0x31')](_0x3bb483[_0xfcfd('0x2d')],_0x3bb483[_0xfcfd('0x2e')]);_0x4c6e43['attributes']=_[_0xfcfd('0x31')](_0x3bb483[_0xfcfd('0x2d')],qs[_0xfcfd('0x32')](_0x404039[_0xfcfd('0x2e')][_0xfcfd('0x32')]));_0x4c6e43[_0xfcfd('0x33')]=_0x4c6e43[_0xfcfd('0x33')][_0xfcfd('0x34')]?_0x4c6e43['attributes']:_0x3bb483[_0xfcfd('0x2d')];if(!_0x404039[_0xfcfd('0x2e')][_0xfcfd('0x35')](_0xfcfd('0x36'))){_0x4c6e43[_0xfcfd('0x37')]=qs[_0xfcfd('0x37')](_0x404039[_0xfcfd('0x2e')][_0xfcfd('0x37')]);_0x4c6e43[_0xfcfd('0x1d')]=qs['offset'](_0x404039[_0xfcfd('0x2e')]['offset']);}_0x4c6e43[_0xfcfd('0x38')]=qs[_0xfcfd('0x39')](_0x404039[_0xfcfd('0x2e')]['sort']);_0x4c6e43[_0xfcfd('0x3a')]=qs[_0xfcfd('0x30')](_[_0xfcfd('0x3b')](_0x404039[_0xfcfd('0x2e')],_0x3bb483[_0xfcfd('0x30')]),_0x5d9e6e);if(_0x404039[_0xfcfd('0x2e')][_0xfcfd('0x3c')]){_0x4c6e43[_0xfcfd('0x3a')]=_[_0xfcfd('0x3d')](_0x4c6e43[_0xfcfd('0x3a')],{'$or':_[_0xfcfd('0x2a')](_0x5d9e6e,function(_0x3f287f){if(_0x3f287f['type']!==_0xfcfd('0x3e')){var _0x583f46={};_0x583f46[_0x3f287f[_0xfcfd('0x27')]]={'$like':'%'+_0x404039[_0xfcfd('0x2e')][_0xfcfd('0x3c')]+'%'};return _0x583f46;}})});}_0x4c6e43=_[_0xfcfd('0x3d')]({},_0x4c6e43,_0x404039['options']);var _0xfd3531={'where':_0x4c6e43[_0xfcfd('0x3a')]};return db[_0xfcfd('0x2b')][_0xfcfd('0x3f')](_0xfd3531)['then'](function(_0x1a1694){_0x3c8b4c['count']=_0x1a1694;if(_0x404039[_0xfcfd('0x2e')][_0xfcfd('0x40')]){_0x4c6e43['include']=[{'all':!![]}];}return db[_0xfcfd('0x2b')][_0xfcfd('0x41')](_0x4c6e43);})[_0xfcfd('0x23')](function(_0x275f62){_0x3c8b4c['rows']=_0x275f62;return _0x3c8b4c;})[_0xfcfd('0x23')](respondWithFilteredResult(_0xd3710f,_0x4c6e43))['catch'](handleError(_0xd3710f,null));};exports['show']=function(_0x48d97f,_0x1e9736){var _0x8c693={'raw':!![],'where':{'id':_0x48d97f[_0xfcfd('0x42')]['id']}},_0x31df15={};_0x31df15['model']=_['keys'](db[_0xfcfd('0x2b')][_0xfcfd('0x2c')]);_0x31df15[_0xfcfd('0x2e')]=_[_0xfcfd('0x2f')](_0x48d97f[_0xfcfd('0x2e')]);_0x31df15[_0xfcfd('0x30')]=_[_0xfcfd('0x31')](_0x31df15[_0xfcfd('0x2d')],_0x31df15['query']);_0x8c693[_0xfcfd('0x33')]=_[_0xfcfd('0x31')](_0x31df15[_0xfcfd('0x2d')],qs[_0xfcfd('0x32')](_0x48d97f[_0xfcfd('0x2e')][_0xfcfd('0x32')]));_0x8c693[_0xfcfd('0x33')]=_0x8c693[_0xfcfd('0x33')]['length']?_0x8c693[_0xfcfd('0x33')]:_0x31df15[_0xfcfd('0x2d')];if(_0x48d97f[_0xfcfd('0x2e')][_0xfcfd('0x40')]){_0x8c693['include']=[{'all':!![]}];}_0x8c693=_['merge']({},_0x8c693,_0x48d97f[_0xfcfd('0x43')]);return db[_0xfcfd('0x2b')][_0xfcfd('0x44')](_0x8c693)[_0xfcfd('0x23')](handleEntityNotFound(_0x1e9736,null))[_0xfcfd('0x23')](respondWithResult(_0x1e9736,null))['catch'](handleError(_0x1e9736,null));};exports[_0xfcfd('0x45')]=function(_0x1bca4d,_0x36af46){return db[_0xfcfd('0x2b')][_0xfcfd('0x45')](_0x1bca4d[_0xfcfd('0x46')],{})[_0xfcfd('0x23')](respondWithResult(_0x36af46,0xc9))['catch'](handleError(_0x36af46,null));};exports[_0xfcfd('0x22')]=function(_0x744c3b,_0x2fcd86){if(_0x744c3b[_0xfcfd('0x46')]['id']){delete _0x744c3b['body']['id'];}return db[_0xfcfd('0x2b')]['find']({'where':{'id':_0x744c3b[_0xfcfd('0x42')]['id']}})[_0xfcfd('0x23')](handleEntityNotFound(_0x2fcd86,null))[_0xfcfd('0x23')](saveUpdates(_0x744c3b['body'],null))['then'](respondWithResult(_0x2fcd86,null))[_0xfcfd('0x47')](handleError(_0x2fcd86,null));};exports[_0xfcfd('0x24')]=function(_0x4940f4,_0x131cfa){return db[_0xfcfd('0x2b')][_0xfcfd('0x44')]({'where':{'id':_0x4940f4[_0xfcfd('0x42')]['id']}})[_0xfcfd('0x23')](handleEntityNotFound(_0x131cfa,null))[_0xfcfd('0x23')](removeEntity(_0x131cfa,null))['catch'](handleError(_0x131cfa,null));};exports[_0xfcfd('0x48')]=function(_0x30e421,_0x413d90){return db['MemberReport'][_0xfcfd('0x48')]()['then'](respondWithResult(_0x413d90,null))['catch'](handleError(_0x413d90,null));}; \ No newline at end of file +var _0xd56c=['keys','rawAttributes','find','create','body','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','../../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','save','update','then','destroy','error','stack','name','MemberReport','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','findAll','rows','catch','params'];(function(_0x1581bc,_0x23b9de){var _0x5e7936=function(_0x302ade){while(--_0x302ade){_0x1581bc['push'](_0x1581bc['shift']());}};_0x5e7936(++_0x23b9de);}(_0xd56c,0x1f0));var _0xcd56=function(_0x1afba7,_0x10bd9e){_0x1afba7=_0x1afba7-0x0;var _0xbb2fb8=_0xd56c[_0x1afba7];return _0xbb2fb8;};'use strict';var pdf=require(_0xcd56('0x0'));var emlformat=require(_0xcd56('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcd56('0x2'));var rp=require(_0xcd56('0x3'));var moment=require(_0xcd56('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcd56('0x5'));var util=require(_0xcd56('0x6'));var path=require(_0xcd56('0x7'));var sox=require(_0xcd56('0x8'));var csv=require('to-csv');var ejs=require(_0xcd56('0x9'));var fs=require('fs');var _=require(_0xcd56('0xa'));var squel=require(_0xcd56('0xb'));var crypto=require(_0xcd56('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xcd56('0xd'));var toCsv=require(_0xcd56('0xe'));var querystring=require(_0xcd56('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcd56('0x10'));var qs=require(_0xcd56('0x11'));var as=require(_0xcd56('0x12'));var hardwareService=require(_0xcd56('0x13'));var logger=require(_0xcd56('0x14'))(_0xcd56('0x15'));var utils=require(_0xcd56('0x16'));var config=require(_0xcd56('0x17'));var db=require(_0xcd56('0x18'))['db'];function respondWithStatusCode(_0x5e8309,_0x23ca46){_0x23ca46=_0x23ca46||0xcc;return function(_0xd10558){if(_0xd10558){return _0x5e8309[_0xcd56('0x19')](_0x23ca46);}return _0x5e8309[_0xcd56('0x1a')](_0x23ca46)[_0xcd56('0x1b')]();};}function respondWithResult(_0x37809f,_0x3cdafb){_0x3cdafb=_0x3cdafb||0xc8;return function(_0x1be8ae){if(_0x1be8ae){return _0x37809f['status'](_0x3cdafb)[_0xcd56('0x1c')](_0x1be8ae);}};}function respondWithFilteredResult(_0xd5b42,_0x33c816){return function(_0x28692d){if(_0x28692d){var _0x42f0dc=_0x28692d['count'],_0x423ed9=_0x33c816[_0xcd56('0x1d')],_0x1259cc=_0x33c816[_0xcd56('0x1d')]+_0x33c816[_0xcd56('0x1e')],_0x121e60;if(_0x1259cc>=_0x42f0dc){_0x1259cc=_0x42f0dc;_0x121e60=0xc8;}else{_0x121e60=0xce;}_0xd5b42[_0xcd56('0x1a')](_0x121e60);return _0xd5b42['set']('Content-Range',_0x423ed9+'-'+_0x1259cc+'/'+_0x42f0dc)['json'](_0x28692d);}return null;};}function patchUpdates(_0x5a4673){return function(_0x3db977){try{jsonpatch[_0xcd56('0x1f')](_0x3db977,_0x5a4673,!![]);}catch(_0x45934e){return BPromise['reject'](_0x45934e);}return _0x3db977[_0xcd56('0x20')]();};}function saveUpdates(_0x5a570a,_0x28d03c){return function(_0x295231){if(_0x295231){return _0x295231[_0xcd56('0x21')](_0x5a570a)[_0xcd56('0x22')](function(_0x40e957){return _0x40e957;});}return null;};}function removeEntity(_0x412ac5,_0x5334af){return function(_0xfc364a){if(_0xfc364a){return _0xfc364a[_0xcd56('0x23')]()[_0xcd56('0x22')](function(){_0x412ac5['status'](0xcc)[_0xcd56('0x1b')]();});}};}function handleEntityNotFound(_0x129969,_0x4884bb){return function(_0x4bc147){if(!_0x4bc147){_0x129969[_0xcd56('0x19')](0x194);}return _0x4bc147;};}function handleError(_0x123812,_0xe39131){_0xe39131=_0xe39131||0x1f4;return function(_0x4b1644){logger[_0xcd56('0x24')](_0x4b1644[_0xcd56('0x25')]);if(_0x4b1644[_0xcd56('0x26')]){delete _0x4b1644['name'];}_0x123812['status'](_0xe39131)['send'](_0x4b1644);};}exports['index']=function(_0x17d75b,_0x42a75d){var _0x5e1e47={},_0x574cb1={},_0x24c69b={'count':0x0,'rows':[]};var _0x7bc46b=_['map'](db[_0xcd56('0x27')]['rawAttributes'],function(_0x28e759){return{'name':_0x28e759[_0xcd56('0x28')],'type':_0x28e759[_0xcd56('0x29')][_0xcd56('0x2a')]};});_0x574cb1['model']=_[_0xcd56('0x2b')](_0x7bc46b,_0xcd56('0x26'));_0x574cb1[_0xcd56('0x2c')]=_['keys'](_0x17d75b[_0xcd56('0x2c')]);_0x574cb1[_0xcd56('0x2d')]=_[_0xcd56('0x2e')](_0x574cb1['model'],_0x574cb1[_0xcd56('0x2c')]);_0x5e1e47['attributes']=_['intersection'](_0x574cb1[_0xcd56('0x2f')],qs['fields'](_0x17d75b['query'][_0xcd56('0x30')]));_0x5e1e47[_0xcd56('0x31')]=_0x5e1e47[_0xcd56('0x31')]['length']?_0x5e1e47[_0xcd56('0x31')]:_0x574cb1[_0xcd56('0x2f')];if(!_0x17d75b[_0xcd56('0x2c')][_0xcd56('0x32')]('nolimit')){_0x5e1e47[_0xcd56('0x1e')]=qs['limit'](_0x17d75b['query'][_0xcd56('0x1e')]);_0x5e1e47[_0xcd56('0x1d')]=qs[_0xcd56('0x1d')](_0x17d75b['query'][_0xcd56('0x1d')]);}_0x5e1e47[_0xcd56('0x33')]=qs[_0xcd56('0x34')](_0x17d75b['query'][_0xcd56('0x34')]);_0x5e1e47[_0xcd56('0x35')]=qs[_0xcd56('0x2d')](_[_0xcd56('0x36')](_0x17d75b['query'],_0x574cb1[_0xcd56('0x2d')]),_0x7bc46b);if(_0x17d75b[_0xcd56('0x2c')][_0xcd56('0x37')]){_0x5e1e47[_0xcd56('0x35')]=_['merge'](_0x5e1e47[_0xcd56('0x35')],{'$or':_[_0xcd56('0x2b')](_0x7bc46b,function(_0x3ec280){if(_0x3ec280[_0xcd56('0x29')]!=='VIRTUAL'){var _0x5934ae={};_0x5934ae[_0x3ec280['name']]={'$like':'%'+_0x17d75b[_0xcd56('0x2c')][_0xcd56('0x37')]+'%'};return _0x5934ae;}})});}_0x5e1e47=_[_0xcd56('0x38')]({},_0x5e1e47,_0x17d75b[_0xcd56('0x39')]);var _0x2f9066={'where':_0x5e1e47[_0xcd56('0x35')]};return db[_0xcd56('0x27')][_0xcd56('0x3a')](_0x2f9066)[_0xcd56('0x22')](function(_0x59b611){_0x24c69b['count']=_0x59b611;if(_0x17d75b[_0xcd56('0x2c')][_0xcd56('0x3b')]){_0x5e1e47['include']=[{'all':!![]}];}return db[_0xcd56('0x27')][_0xcd56('0x3c')](_0x5e1e47);})['then'](function(_0x5e3f19){_0x24c69b[_0xcd56('0x3d')]=_0x5e3f19;return _0x24c69b;})[_0xcd56('0x22')](respondWithFilteredResult(_0x42a75d,_0x5e1e47))[_0xcd56('0x3e')](handleError(_0x42a75d,null));};exports['show']=function(_0x17a3bf,_0xbb4a05){var _0x4b07e0={'raw':!![],'where':{'id':_0x17a3bf[_0xcd56('0x3f')]['id']}},_0x39e8c1={};_0x39e8c1[_0xcd56('0x2f')]=_[_0xcd56('0x40')](db[_0xcd56('0x27')][_0xcd56('0x41')]);_0x39e8c1[_0xcd56('0x2c')]=_['keys'](_0x17a3bf[_0xcd56('0x2c')]);_0x39e8c1[_0xcd56('0x2d')]=_[_0xcd56('0x2e')](_0x39e8c1[_0xcd56('0x2f')],_0x39e8c1[_0xcd56('0x2c')]);_0x4b07e0[_0xcd56('0x31')]=_[_0xcd56('0x2e')](_0x39e8c1[_0xcd56('0x2f')],qs['fields'](_0x17a3bf[_0xcd56('0x2c')]['fields']));_0x4b07e0[_0xcd56('0x31')]=_0x4b07e0[_0xcd56('0x31')]['length']?_0x4b07e0['attributes']:_0x39e8c1['model'];if(_0x17a3bf[_0xcd56('0x2c')][_0xcd56('0x3b')]){_0x4b07e0['include']=[{'all':!![]}];}_0x4b07e0=_[_0xcd56('0x38')]({},_0x4b07e0,_0x17a3bf[_0xcd56('0x39')]);return db[_0xcd56('0x27')][_0xcd56('0x42')](_0x4b07e0)[_0xcd56('0x22')](handleEntityNotFound(_0xbb4a05,null))[_0xcd56('0x22')](respondWithResult(_0xbb4a05,null))['catch'](handleError(_0xbb4a05,null));};exports[_0xcd56('0x43')]=function(_0x316d0d,_0x539333){return db[_0xcd56('0x27')][_0xcd56('0x43')](_0x316d0d[_0xcd56('0x44')],{})[_0xcd56('0x22')](respondWithResult(_0x539333,0xc9))[_0xcd56('0x3e')](handleError(_0x539333,null));};exports[_0xcd56('0x21')]=function(_0x3b9ea3,_0x30d9e4){if(_0x3b9ea3[_0xcd56('0x44')]['id']){delete _0x3b9ea3[_0xcd56('0x44')]['id'];}return db[_0xcd56('0x27')][_0xcd56('0x42')]({'where':{'id':_0x3b9ea3['params']['id']}})[_0xcd56('0x22')](handleEntityNotFound(_0x30d9e4,null))[_0xcd56('0x22')](saveUpdates(_0x3b9ea3[_0xcd56('0x44')],null))[_0xcd56('0x22')](respondWithResult(_0x30d9e4,null))[_0xcd56('0x3e')](handleError(_0x30d9e4,null));};exports[_0xcd56('0x23')]=function(_0x507229,_0x49a8d7){return db[_0xcd56('0x27')][_0xcd56('0x42')]({'where':{'id':_0x507229[_0xcd56('0x3f')]['id']}})[_0xcd56('0x22')](handleEntityNotFound(_0x49a8d7,null))[_0xcd56('0x22')](removeEntity(_0x49a8d7,null))[_0xcd56('0x3e')](handleError(_0x49a8d7,null));};exports[_0xcd56('0x45')]=function(_0x1a17c9,_0x4724fd){return db['MemberReport'][_0xcd56('0x45')]()['then'](respondWithResult(_0x4724fd,null))['catch'](handleError(_0x4724fd,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 351e1d5..6737f09 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 _0xdb94=['path','rimraf','./memberReport.attributes','define','MemberReport','report_member','membername','interface','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x30272e,_0x55abc4){var _0x309031=function(_0xb9f2cb){while(--_0xb9f2cb){_0x30272e['push'](_0x30272e['shift']());}};_0x309031(++_0x55abc4);}(_0xdb94,0xe5));var _0x4db9=function(_0x413ce0,_0xa948d8){_0x413ce0=_0x413ce0-0x0;var _0x1973fb=_0xdb94[_0x413ce0];return _0x1973fb;};'use strict';var _=require('lodash');var util=require(_0x4db9('0x0'));var logger=require(_0x4db9('0x1'))('api');var moment=require(_0x4db9('0x2'));var BPromise=require(_0x4db9('0x3'));var rp=require(_0x4db9('0x4'));var fs=require('fs');var path=require(_0x4db9('0x5'));var rimraf=require(_0x4db9('0x6'));var config=require('../../config/environment');var attributes=require(_0x4db9('0x7'));module['exports']=function(_0x1d21a8,_0xc76bc1){return _0x1d21a8[_0x4db9('0x8')](_0x4db9('0x9'),attributes,{'tableName':_0x4db9('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x4db9('0xb'),_0x4db9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./memberReport.attributes','exports','define','report_member','membername_interface','interface','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x44db7e,_0x2e16e3){var _0x26ad2c=function(_0x39f2ce){while(--_0x39f2ce){_0x44db7e['push'](_0x44db7e['shift']());}};_0x26ad2c(++_0x2e16e3);}(_0x55ca,0x126));var _0xa55c=function(_0x3f578f,_0x51f172){_0x3f578f=_0x3f578f-0x0;var _0x32c754=_0x55ca[_0x3f578f];return _0x32c754;};'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')]('MemberReport',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[{'name':_0xa55c('0xa'),'fields':['membername',_0xa55c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index f211501..df34216 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 _0x98b2=['request\x20sent','stringify','error','code','message','MemberReport,\x20%s,\x20%s','result','GetMemberReport','MemberReport','findAll','options','raw','where','limit','include','map','model','attributes','debug','CreateMemberReport','create','UpdateMemberReport','update','body','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x2464d1,_0x38b10a){var _0x1674f8=function(_0x29386e){while(--_0x29386e){_0x2464d1['push'](_0x2464d1['shift']());}};_0x1674f8(++_0x38b10a);}(_0x98b2,0x67));var _0x298b=function(_0x40dc39,_0xc4a47){_0x40dc39=_0x40dc39-0x0;var _0x4e03a0=_0x98b2[_0x40dc39];return _0x4e03a0;};'use strict';var _=require(_0x298b('0x0'));var util=require(_0x298b('0x1'));var moment=require(_0x298b('0x2'));var BPromise=require(_0x298b('0x3'));var rs=require(_0x298b('0x4'));var fs=require('fs');var Redis=require(_0x298b('0x5'));var db=require(_0x298b('0x6'))['db'];var utils=require(_0x298b('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x298b('0x8'));var jayson=require(_0x298b('0x9'));var client=jayson[_0x298b('0xa')][_0x298b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50a39b,_0x1d1dba,_0x589118){return new BPromise(function(_0x782a3f,_0x212a6f){return client['request'](_0x50a39b,_0x589118)[_0x298b('0xc')](function(_0x1c172a){logger[_0x298b('0xd')]('MemberReport,\x20%s,\x20%s',_0x1d1dba,_0x298b('0xe'));logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x1d1dba,_0x298b('0xe'),JSON[_0x298b('0xf')](_0x1c172a));if(_0x1c172a[_0x298b('0x10')]){if(_0x1c172a[_0x298b('0x10')][_0x298b('0x11')]===0x1f4){logger[_0x298b('0x10')]('MemberReport,\x20%s,\x20%s',_0x1d1dba,_0x1c172a[_0x298b('0x10')][_0x298b('0x12')]);return _0x212a6f(_0x1c172a[_0x298b('0x10')][_0x298b('0x12')]);}logger[_0x298b('0x10')](_0x298b('0x13'),_0x1d1dba,_0x1c172a['error'][_0x298b('0x12')]);return _0x782a3f(_0x1c172a[_0x298b('0x10')][_0x298b('0x12')]);}else{logger[_0x298b('0xd')](_0x298b('0x13'),_0x1d1dba,_0x298b('0xe'));_0x782a3f(_0x1c172a[_0x298b('0x14')]['message']);}})['catch'](function(_0x4c18e9){logger[_0x298b('0x10')]('MemberReport,\x20%s,\x20%s',_0x1d1dba,_0x4c18e9);_0x212a6f(_0x4c18e9);});});}exports[_0x298b('0x15')]=function(_0x23ab77){var _0x2a493e=this;return new Promise(function(_0x4f1853,_0x2ba599){return db[_0x298b('0x16')][_0x298b('0x17')]({'raw':_0x23ab77[_0x298b('0x18')]?_0x23ab77[_0x298b('0x18')][_0x298b('0x19')]===undefined?!![]:![]:!![],'where':_0x23ab77['options']?_0x23ab77[_0x298b('0x18')][_0x298b('0x1a')]||null:null,'attributes':_0x23ab77[_0x298b('0x18')]?_0x23ab77[_0x298b('0x18')]['attributes']||null:null,'limit':_0x23ab77['options']?_0x23ab77[_0x298b('0x18')][_0x298b('0x1b')]||null:null,'include':_0x23ab77['options']?_0x23ab77['options'][_0x298b('0x1c')]?_[_0x298b('0x1d')](_0x23ab77[_0x298b('0x18')][_0x298b('0x1c')],function(_0x5aeb24){return{'model':db[_0x5aeb24[_0x298b('0x1e')]],'as':_0x5aeb24['as'],'attributes':_0x5aeb24[_0x298b('0x1f')],'include':_0x5aeb24['include']?_[_0x298b('0x1d')](_0x5aeb24['include'],function(_0x23b173){return{'model':db[_0x23b173['model']],'as':_0x23b173['as'],'attributes':_0x23b173[_0x298b('0x1f')],'include':_0x23b173[_0x298b('0x1c')]?_[_0x298b('0x1d')](_0x23b173[_0x298b('0x1c')],function(_0x5009e9){return{'model':db[_0x5009e9[_0x298b('0x1e')]],'as':_0x5009e9['as'],'attributes':_0x5009e9[_0x298b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x298b('0xc')](function(_0x81fd34){logger[_0x298b('0xd')](_0x298b('0x15'),_0x23ab77);logger[_0x298b('0x20')](_0x298b('0x15'),_0x23ab77,JSON[_0x298b('0xf')](_0x81fd34));_0x4f1853(_0x81fd34);})['catch'](function(_0x1e3f57){logger[_0x298b('0x10')](_0x298b('0x15'),_0x1e3f57[_0x298b('0x12')],_0x23ab77);_0x2ba599(_0x2a493e[_0x298b('0x10')](0x1f4,_0x1e3f57[_0x298b('0x12')]));});});};exports[_0x298b('0x21')]=function(_0x223595){var _0x14c037=this;return new Promise(function(_0x12d992,_0x30788a){return db[_0x298b('0x16')][_0x298b('0x22')](_0x223595['body'],{'raw':_0x223595[_0x298b('0x18')]?_0x223595[_0x298b('0x18')][_0x298b('0x19')]===undefined?!![]:![]:!![]})[_0x298b('0xc')](function(_0x4bb99d){logger[_0x298b('0xd')](_0x298b('0x21'),_0x223595);logger[_0x298b('0x20')](_0x298b('0x21'),_0x223595,JSON[_0x298b('0xf')](_0x4bb99d));_0x12d992(_0x4bb99d);})['catch'](function(_0x599bdd){logger['error'](_0x298b('0x21'),_0x599bdd[_0x298b('0x12')],_0x223595);_0x30788a(_0x14c037[_0x298b('0x10')](0x1f4,_0x599bdd[_0x298b('0x12')]));});});};exports[_0x298b('0x23')]=function(_0x59d8d8){var _0xe3c415=this;return new Promise(function(_0x1cd1f0,_0x43ce6d){return db[_0x298b('0x16')][_0x298b('0x24')](_0x59d8d8[_0x298b('0x25')],{'raw':_0x59d8d8[_0x298b('0x18')]?_0x59d8d8[_0x298b('0x18')][_0x298b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59d8d8[_0x298b('0x18')]?_0x59d8d8['options'][_0x298b('0x1a')]||null:null,'attributes':_0x59d8d8['options']?_0x59d8d8[_0x298b('0x18')]['attributes']||null:null,'limit':_0x59d8d8[_0x298b('0x18')]?_0x59d8d8[_0x298b('0x18')][_0x298b('0x1b')]||null:null})['then'](function(_0x198bba){logger['info'](_0x298b('0x23'),_0x59d8d8);logger['debug'](_0x298b('0x23'),_0x59d8d8,JSON[_0x298b('0xf')](_0x198bba));_0x1cd1f0(_0x198bba);})[_0x298b('0x26')](function(_0x274697){logger[_0x298b('0x10')]('UpdateMemberReport',_0x274697[_0x298b('0x12')],_0x59d8d8);_0x43ce6d(_0xe3c415[_0x298b('0x10')](0x1f4,_0x274697[_0x298b('0x12')]));});});}; \ No newline at end of file +var _0xd959=['debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MemberReport','options','raw','where','attributes','limit','include','map','model','GetMemberReport','CreateMemberReport','update','body','UpdateMemberReport'];(function(_0x3d094a,_0x527a6d){var _0x1199b4=function(_0x48bc97){while(--_0x48bc97){_0x3d094a['push'](_0x3d094a['shift']());}};_0x1199b4(++_0x527a6d);}(_0xd959,0x73));var _0x9d95=function(_0x217d63,_0x220d0d){_0x217d63=_0x217d63-0x0;var _0x312d07=_0xd959[_0x217d63];return _0x312d07;};'use strict';var _=require(_0x9d95('0x0'));var util=require(_0x9d95('0x1'));var moment=require(_0x9d95('0x2'));var BPromise=require('bluebird');var rs=require(_0x9d95('0x3'));var fs=require('fs');var Redis=require(_0x9d95('0x4'));var db=require(_0x9d95('0x5'))['db'];var utils=require(_0x9d95('0x6'));var logger=require('../../config/logger')(_0x9d95('0x7'));var config=require(_0x9d95('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9d95('0x9')][_0x9d95('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d36ba,_0x1549aa,_0x249771){return new BPromise(function(_0xa5d307,_0x2eaff5){return client[_0x9d95('0xb')](_0x2d36ba,_0x249771)[_0x9d95('0xc')](function(_0x5d21fa){logger[_0x9d95('0xd')](_0x9d95('0xe'),_0x1549aa,_0x9d95('0xf'));logger['debug'](_0x9d95('0x10'),_0x1549aa,_0x9d95('0xf'),JSON[_0x9d95('0x11')](_0x5d21fa));if(_0x5d21fa[_0x9d95('0x12')]){if(_0x5d21fa[_0x9d95('0x12')][_0x9d95('0x13')]===0x1f4){logger['error'](_0x9d95('0xe'),_0x1549aa,_0x5d21fa[_0x9d95('0x12')]['message']);return _0x2eaff5(_0x5d21fa[_0x9d95('0x12')]['message']);}logger[_0x9d95('0x12')](_0x9d95('0xe'),_0x1549aa,_0x5d21fa['error']['message']);return _0xa5d307(_0x5d21fa[_0x9d95('0x12')][_0x9d95('0x14')]);}else{logger[_0x9d95('0xd')](_0x9d95('0xe'),_0x1549aa,_0x9d95('0xf'));_0xa5d307(_0x5d21fa[_0x9d95('0x15')][_0x9d95('0x14')]);}})[_0x9d95('0x16')](function(_0x2b9802){logger[_0x9d95('0x12')](_0x9d95('0xe'),_0x1549aa,_0x2b9802);_0x2eaff5(_0x2b9802);});});}exports['GetMemberReport']=function(_0x1862dd){var _0x3f90a=this;return new Promise(function(_0x303f7f,_0x3c8180){return db[_0x9d95('0x17')]['findAll']({'raw':_0x1862dd[_0x9d95('0x18')]?_0x1862dd[_0x9d95('0x18')][_0x9d95('0x19')]===undefined?!![]:![]:!![],'where':_0x1862dd['options']?_0x1862dd[_0x9d95('0x18')][_0x9d95('0x1a')]||null:null,'attributes':_0x1862dd['options']?_0x1862dd[_0x9d95('0x18')][_0x9d95('0x1b')]||null:null,'limit':_0x1862dd[_0x9d95('0x18')]?_0x1862dd[_0x9d95('0x18')][_0x9d95('0x1c')]||null:null,'include':_0x1862dd[_0x9d95('0x18')]?_0x1862dd['options'][_0x9d95('0x1d')]?_[_0x9d95('0x1e')](_0x1862dd['options'][_0x9d95('0x1d')],function(_0x569659){return{'model':db[_0x569659[_0x9d95('0x1f')]],'as':_0x569659['as'],'attributes':_0x569659[_0x9d95('0x1b')],'include':_0x569659['include']?_[_0x9d95('0x1e')](_0x569659[_0x9d95('0x1d')],function(_0x59084b){return{'model':db[_0x59084b[_0x9d95('0x1f')]],'as':_0x59084b['as'],'attributes':_0x59084b[_0x9d95('0x1b')],'include':_0x59084b[_0x9d95('0x1d')]?_['map'](_0x59084b[_0x9d95('0x1d')],function(_0xc03f5b){return{'model':db[_0xc03f5b[_0x9d95('0x1f')]],'as':_0xc03f5b['as'],'attributes':_0xc03f5b[_0x9d95('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f458d){logger[_0x9d95('0xd')]('GetMemberReport',_0x1862dd);logger['debug'](_0x9d95('0x20'),_0x1862dd,JSON[_0x9d95('0x11')](_0x1f458d));_0x303f7f(_0x1f458d);})['catch'](function(_0x3105dd){logger[_0x9d95('0x12')]('GetMemberReport',_0x3105dd[_0x9d95('0x14')],_0x1862dd);_0x3c8180(_0x3f90a[_0x9d95('0x12')](0x1f4,_0x3105dd['message']));});});};exports['CreateMemberReport']=function(_0x898890){var _0x3aed4d=this;return new Promise(function(_0x4e8f70,_0x33e533){return db[_0x9d95('0x17')]['create'](_0x898890['body'],{'raw':_0x898890[_0x9d95('0x18')]?_0x898890[_0x9d95('0x18')][_0x9d95('0x19')]===undefined?!![]:![]:!![]})[_0x9d95('0xc')](function(_0x434b32){logger[_0x9d95('0xd')]('CreateMemberReport',_0x898890);logger['debug'](_0x9d95('0x21'),_0x898890,JSON[_0x9d95('0x11')](_0x434b32));_0x4e8f70(_0x434b32);})[_0x9d95('0x16')](function(_0x140183){logger[_0x9d95('0x12')](_0x9d95('0x21'),_0x140183[_0x9d95('0x14')],_0x898890);_0x33e533(_0x3aed4d[_0x9d95('0x12')](0x1f4,_0x140183[_0x9d95('0x14')]));});});};exports['UpdateMemberReport']=function(_0x13f5b3){var _0x53729f=this;return new Promise(function(_0x1a0437,_0x3d7683){return db[_0x9d95('0x17')][_0x9d95('0x22')](_0x13f5b3[_0x9d95('0x23')],{'raw':_0x13f5b3[_0x9d95('0x18')]?_0x13f5b3[_0x9d95('0x18')][_0x9d95('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13f5b3[_0x9d95('0x18')]?_0x13f5b3[_0x9d95('0x18')][_0x9d95('0x1a')]||null:null,'attributes':_0x13f5b3[_0x9d95('0x18')]?_0x13f5b3[_0x9d95('0x18')][_0x9d95('0x1b')]||null:null,'limit':_0x13f5b3[_0x9d95('0x18')]?_0x13f5b3[_0x9d95('0x18')][_0x9d95('0x1c')]||null:null})[_0x9d95('0xc')](function(_0x478870){logger['info'](_0x9d95('0x24'),_0x13f5b3);logger[_0x9d95('0x25')](_0x9d95('0x24'),_0x13f5b3,JSON['stringify'](_0x478870));_0x1a0437(_0x478870);})['catch'](function(_0x327434){logger[_0x9d95('0x12')]('UpdateMemberReport',_0x327434[_0x9d95('0x14')],_0x13f5b3);_0x3d7683(_0x53729f['error'](0x1f4,_0x327434[_0x9d95('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 947a197..3ff80ea 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 _0xe2cf=['index','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0xf3de7a,_0x464f47){_0xf3de7a=_0xf3de7a-0x0;var _0x56f74a=_0xe2cf[_0xf3de7a];return _0x56f74a;};'use strict';var multer=require('multer');var util=require(_0xfe2c('0x0'));var path=require('path');var timeout=require(_0xfe2c('0x1'));var express=require('express');var router=express[_0xfe2c('0x2')]();var auth=require(_0xfe2c('0x3'));var interaction=require(_0xfe2c('0x4'));var config=require(_0xfe2c('0x5'));var controller=require('./migration.controller');router[_0xfe2c('0x6')]('/',controller[_0xfe2c('0x7')]);module['exports']=router; \ No newline at end of file +var _0x63a5=['./migration.controller','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x54bb5e,_0xc9513a){var _0x2cfe75=function(_0x52ef1b){while(--_0x52ef1b){_0x54bb5e['push'](_0x54bb5e['shift']());}};_0x2cfe75(++_0xc9513a);}(_0x63a5,0x18e));var _0x563a=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x63a5[_0x29d94e];return _0x106237;};'use strict';var multer=require(_0x563a('0x0'));var util=require(_0x563a('0x1'));var path=require(_0x563a('0x2'));var timeout=require('connect-timeout');var express=require(_0x563a('0x3'));var router=express['Router']();var auth=require(_0x563a('0x4'));var interaction=require(_0x563a('0x5'));var config=require(_0x563a('0x6'));var controller=require(_0x563a('0x7'));router['get']('/',controller['index']);module[_0x563a('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index bb88cde..98b8d93 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 _0x1910=['sequelize','exports','version'];(function(_0x1f95b7,_0x3aed0a){var _0x228885=function(_0x1d817c){while(--_0x1d817c){_0x1f95b7['push'](_0x1f95b7['shift']());}};_0x228885(++_0x3aed0a);}(_0x1910,0xc0));var _0x0191=function(_0xa17394,_0x2d656f){_0xa17394=_0xa17394-0x0;var _0x145cbd=_0x1910[_0xa17394];return _0x145cbd;};'use strict';var Sequelize=require(_0x0191('0x0'));module[_0x0191('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x0191('0x2')}}; \ No newline at end of file +var _0x833c=['exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x833c,0x166));var _0xc833=function(_0x4fc496,_0x54290f){_0x4fc496=_0x4fc496-0x0;var _0x458cc8=_0x833c[_0x4fc496];return _0x458cc8;};'use strict';var Sequelize=require('sequelize');module[_0xc833('0x0')]={'version':{'type':Sequelize[_0xc833('0x1')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 60e6a3f..578b882 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 _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(_0x1716eb,_0x3d99ad){var _0x29f8b8=function(_0x34850f){while(--_0x34850f){_0x1716eb['push'](_0x1716eb['shift']());}};_0x29f8b8(++_0x3d99ad);}(_0xf4eb,0xec));var _0xbf4e=function(_0x242b14,_0x3d02f3){_0x242b14=_0x242b14-0x0;var _0x545cac=_0xf4eb[_0x242b14];return _0x545cac;};'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 +var _0x9c44=['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','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Migration','include','findAll','rows','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'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['Migration'][_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));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index aa0d629..05d8be7 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 _0xfc79=['migrations','../../config/logger','bluebird','request-promise','path','rimraf','./migration.attributes','exports','Migration'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfc79,0x1c3));var _0x9fc7=function(_0x23139b,_0xabe89e){_0x23139b=_0x23139b-0x0;var _0x42272a=_0xfc79[_0x23139b];return _0x42272a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9fc7('0x0'))('api');var moment=require('moment');var BPromise=require(_0x9fc7('0x1'));var rp=require(_0x9fc7('0x2'));var fs=require('fs');var path=require(_0x9fc7('0x3'));var rimraf=require(_0x9fc7('0x4'));var config=require('../../config/environment');var attributes=require(_0x9fc7('0x5'));module[_0x9fc7('0x6')]=function(_0x5777c0,_0x32c028){return _0x5777c0['define'](_0x9fc7('0x7'),attributes,{'tableName':_0x9fc7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8840=['path','rimraf','../../config/environment','define','Migration','lodash','../../config/logger','bluebird','request-promise'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x8840,0x1ac));var _0x0884=function(_0x568cf0,_0x1a44cb){_0x568cf0=_0x568cf0-0x0;var _0x360f81=_0x8840[_0x568cf0];return _0x360f81;};'use strict';var _=require(_0x0884('0x0'));var util=require('util');var logger=require(_0x0884('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0884('0x2'));var rp=require(_0x0884('0x3'));var fs=require('fs');var path=require(_0x0884('0x4'));var rimraf=require(_0x0884('0x5'));var config=require(_0x0884('0x6'));var attributes=require('./migration.attributes');module['exports']=function(_0x3011e4,_0x5d1866){return _0x3011e4[_0x0884('0x7')](_0x0884('0x8'),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 08dceef..cc24656 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 _0xf4c9=['Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xf4c9,0x1aa));var _0x9f4c=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xf4c9[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x9f4c('0x0'));var util=require(_0x9f4c('0x1'));var moment=require(_0x9f4c('0x2'));var BPromise=require('bluebird');var rs=require(_0x9f4c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f4c('0x4'))['db'];var utils=require(_0x9f4c('0x5'));var logger=require(_0x9f4c('0x6'))('rpc');var config=require(_0x9f4c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9f4c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cf322,_0x498795,_0x12aeb7){return new BPromise(function(_0x398b30,_0x72c8ea){return client[_0x9f4c('0x9')](_0x5cf322,_0x12aeb7)[_0x9f4c('0xa')](function(_0x37b693){logger['info'](_0x9f4c('0xb'),_0x498795,_0x9f4c('0xc'));logger[_0x9f4c('0xd')](_0x9f4c('0xe'),_0x498795,_0x9f4c('0xc'),JSON[_0x9f4c('0xf')](_0x37b693));if(_0x37b693[_0x9f4c('0x10')]){if(_0x37b693[_0x9f4c('0x10')]['code']===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x498795,_0x37b693[_0x9f4c('0x10')]['message']);return _0x72c8ea(_0x37b693['error'][_0x9f4c('0x11')]);}logger['error']('Migration,\x20%s,\x20%s',_0x498795,_0x37b693[_0x9f4c('0x10')]['message']);return _0x398b30(_0x37b693['error'][_0x9f4c('0x11')]);}else{logger['info'](_0x9f4c('0xb'),_0x498795,_0x9f4c('0xc'));_0x398b30(_0x37b693[_0x9f4c('0x12')][_0x9f4c('0x11')]);}})[_0x9f4c('0x13')](function(_0xb61bdf){logger['error'](_0x9f4c('0xb'),_0x498795,_0xb61bdf);_0x72c8ea(_0xb61bdf);});});} \ No newline at end of file +var _0x21a8=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x21a8,0xed));var _0x821a=function(_0x1ede51,_0x30c587){_0x1ede51=_0x1ede51-0x0;var _0xc71804=_0x21a8[_0x1ede51];return _0xc71804;};'use strict';var _=require(_0x821a('0x0'));var util=require(_0x821a('0x1'));var moment=require(_0x821a('0x2'));var BPromise=require(_0x821a('0x3'));var rs=require(_0x821a('0x4'));var fs=require('fs');var Redis=require(_0x821a('0x5'));var db=require(_0x821a('0x6'))['db'];var utils=require(_0x821a('0x7'));var logger=require(_0x821a('0x8'))('rpc');var config=require(_0x821a('0x9'));var jayson=require(_0x821a('0xa'));var client=jayson[_0x821a('0xb')][_0x821a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xcae829,_0x1de26f,_0x3d76a9){return new BPromise(function(_0x1e54aa,_0x5dd47a){return client[_0x821a('0xd')](_0xcae829,_0x3d76a9)[_0x821a('0xe')](function(_0x32a236){logger[_0x821a('0xf')](_0x821a('0x10'),_0x1de26f,_0x821a('0x11'));logger[_0x821a('0x12')](_0x821a('0x13'),_0x1de26f,_0x821a('0x11'),JSON[_0x821a('0x14')](_0x32a236));if(_0x32a236[_0x821a('0x15')]){if(_0x32a236['error'][_0x821a('0x16')]===0x1f4){logger[_0x821a('0x15')](_0x821a('0x10'),_0x1de26f,_0x32a236[_0x821a('0x15')][_0x821a('0x17')]);return _0x5dd47a(_0x32a236[_0x821a('0x15')]['message']);}logger[_0x821a('0x15')](_0x821a('0x10'),_0x1de26f,_0x32a236[_0x821a('0x15')][_0x821a('0x17')]);return _0x1e54aa(_0x32a236['error']['message']);}else{logger[_0x821a('0xf')]('Migration,\x20%s,\x20%s',_0x1de26f,_0x821a('0x11'));_0x1e54aa(_0x32a236[_0x821a('0x18')][_0x821a('0x17')]);}})[_0x821a('0x19')](function(_0x1177e6){logger[_0x821a('0x15')]('Migration,\x20%s,\x20%s',_0x1de26f,_0x1177e6);_0x5dd47a(_0x1177e6);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 738dfcb..de400de 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 _0x4c85=['../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','/:id','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0xffd1b5,_0x1ede18){var _0x3176d6=function(_0xe9ba48){while(--_0xe9ba48){_0xffd1b5['push'](_0xffd1b5['shift']());}};_0x3176d6(++_0x1ede18);}(_0x4c85,0xa5));var _0x54c8=function(_0x3cce93,_0x3daed2){_0x3cce93=_0x3cce93-0x0;var _0x56174e=_0x4c85[_0x3cce93];return _0x56174e;};'use strict';var multer=require(_0x54c8('0x0'));var util=require('util');var path=require(_0x54c8('0x1'));var timeout=require(_0x54c8('0x2'));var express=require(_0x54c8('0x3'));var router=express[_0x54c8('0x4')]();var auth=require(_0x54c8('0x5'));var interaction=require(_0x54c8('0x6'));var config=require(_0x54c8('0x7'));var controller=require(_0x54c8('0x8'));router[_0x54c8('0x9')]('/',auth[_0x54c8('0xa')](),controller['index']);router['get'](_0x54c8('0xb'),auth[_0x54c8('0xa')](),controller['show']);router['post']('/',auth[_0x54c8('0xa')](),controller[_0x54c8('0xc')]);router['put'](_0x54c8('0xb'),auth['isAuthenticated'](),controller[_0x54c8('0xd')]);router[_0x54c8('0xe')]('/:id',auth[_0x54c8('0xa')](),controller[_0x54c8('0xf')]);module[_0x54c8('0x10')]=router; \ No newline at end of file +var _0x2a38=['../../config/environment','./network.controller','get','index','show','isAuthenticated','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x1814a0,_0x20f29c){var _0x3049d9=function(_0x4bc8dc){while(--_0x4bc8dc){_0x1814a0['push'](_0x1814a0['shift']());}};_0x3049d9(++_0x20f29c);}(_0x2a38,0x1e8));var _0x82a3=function(_0x5445a1,_0x1ba385){_0x5445a1=_0x5445a1-0x0;var _0x3bf175=_0x2a38[_0x5445a1];return _0x3bf175;};'use strict';var multer=require('multer');var util=require(_0x82a3('0x0'));var path=require(_0x82a3('0x1'));var timeout=require(_0x82a3('0x2'));var express=require(_0x82a3('0x3'));var router=express[_0x82a3('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x82a3('0x5'));var controller=require(_0x82a3('0x6'));router[_0x82a3('0x7')]('/',auth['isAuthenticated'](),controller[_0x82a3('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x82a3('0x9')]);router['post']('/',auth[_0x82a3('0xa')](),controller['create']);router[_0x82a3('0xb')](_0x82a3('0xc'),auth[_0x82a3('0xa')](),controller[_0x82a3('0xd')]);router[_0x82a3('0xe')]('/:id',auth[_0x82a3('0xa')](),controller[_0x82a3('0xf')]);module[_0x82a3('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 11dbe46..d237788 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(_0x4eb2c7,_0x3d6d8f){var _0xcec0a4=function(_0x400fee){while(--_0x400fee){_0x4eb2c7['push'](_0x4eb2c7['shift']());}};_0xcec0a4(++_0x3d6d8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x3ef3c7,_0x5dcd95){var _0x3f168b=function(_0x1134fd){while(--_0x1134fd){_0x3ef3c7['push'](_0x3ef3c7['shift']());}};_0x3f168b(++_0x5dcd95);}(_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')]={'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 80e62ea..8c30522 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 _0xe3e5=['join','server/files/templates/turn_multiple.ejs','utf8','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','/etc/asterisk/stun_xcally.conf','/etc/asterisk/turn_xcally.conf','update','destroy','TURN','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','test','ValidationError','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','name','send','index','Network','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','Reload','res_stun_monitor.so'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3e5,0x77));var _0x5e3e=function(_0x4b2dd6,_0x346f36){_0x4b2dd6=_0x4b2dd6-0x0;var _0x15ed34=_0xe3e5[_0x4b2dd6];return _0x15ed34;};'use strict';var pdf=require(_0x5e3e('0x0'));var emlformat=require(_0x5e3e('0x1'));var rimraf=require(_0x5e3e('0x2'));var zipdir=require(_0x5e3e('0x3'));var jsonpatch=require(_0x5e3e('0x4'));var rp=require(_0x5e3e('0x5'));var moment=require(_0x5e3e('0x6'));var BPromise=require(_0x5e3e('0x7'));var Mustache=require(_0x5e3e('0x8'));var util=require(_0x5e3e('0x9'));var path=require(_0x5e3e('0xa'));var sox=require(_0x5e3e('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5e3e('0xc'));var jsforce=require(_0x5e3e('0xd'));var deskjs=require(_0x5e3e('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5e3e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5e3e('0x10'));var hardwareService=require(_0x5e3e('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x5e3e('0x12'));var config=require(_0x5e3e('0x13'));var db=require(_0x5e3e('0x14'))['db'];var jayson=require(_0x5e3e('0x15'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x5cbe49,_0x40c30e,_0x3267e2){if(_0x3267e2){var _0x5ab780=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5ab780[_0x5e3e('0x16')](_0x40c30e)){return _0x5cbe49;}else{throw new db['Sequelize'][(_0x5e3e('0x17'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x5cbe49;}}function respondWithRpcPromise(_0x16d7ee,_0x1cdaff,_0x2f04f3,_0x5d44a8){return new BPromise(function(_0x306641,_0xbbbbec){var _0x894614=_0x5d44a8||client;return _0x894614['request'](_0x16d7ee,_0x2f04f3)[_0x5e3e('0x18')](function(_0x378f9c){logger[_0x5e3e('0x19')](_0x5e3e('0x1a'),_0x1cdaff,_0x5e3e('0x1b'));logger[_0x5e3e('0x1c')](_0x5e3e('0x1d'),_0x1cdaff,'request\x20sent',JSON[_0x5e3e('0x1e')](_0x378f9c));if(_0x378f9c[_0x5e3e('0x1f')]){if(_0x378f9c[_0x5e3e('0x1f')][_0x5e3e('0x20')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x1cdaff,_0x378f9c[_0x5e3e('0x1f')][_0x5e3e('0x21')]);return _0xbbbbec(_0x378f9c[_0x5e3e('0x1f')][_0x5e3e('0x21')]);}logger[_0x5e3e('0x1f')](_0x5e3e('0x1a'),_0x1cdaff,_0x378f9c[_0x5e3e('0x1f')][_0x5e3e('0x21')]);return _0x306641(_0x378f9c[_0x5e3e('0x1f')][_0x5e3e('0x21')]);}else{logger[_0x5e3e('0x19')]('Network,\x20%s,\x20%s',_0x1cdaff,_0x5e3e('0x1b'));_0x306641(_0x378f9c[_0x5e3e('0x22')][_0x5e3e('0x21')]);}})['catch'](function(_0x23ac2b){logger['error'](_0x5e3e('0x1a'),_0x1cdaff,_0x23ac2b);_0xbbbbec(_0x23ac2b);});});}function respondWithStatusCode(_0x250930,_0x3f4f0c){_0x3f4f0c=_0x3f4f0c||0xcc;return function(_0x3633a8){if(_0x3633a8){return _0x250930[_0x5e3e('0x23')](_0x3f4f0c);}return _0x250930['status'](_0x3f4f0c)[_0x5e3e('0x24')]();};}function respondWithResult(_0x3d9b64,_0x4e1859){_0x4e1859=_0x4e1859||0xc8;return function(_0x10572a){if(_0x10572a){return _0x3d9b64[_0x5e3e('0x25')](_0x4e1859)[_0x5e3e('0x26')](_0x10572a);}};}function respondWithFilteredResult(_0x103000,_0x2f1693){return function(_0x4ba6b4){if(_0x4ba6b4){var _0x1f3b25=_0x4ba6b4['count'],_0x416a00=_0x2f1693[_0x5e3e('0x27')],_0x46f262=_0x2f1693[_0x5e3e('0x27')]+_0x2f1693[_0x5e3e('0x28')],_0x5b0937;if(_0x46f262>=_0x1f3b25){_0x46f262=_0x1f3b25;_0x5b0937=0xc8;}else{_0x5b0937=0xce;}_0x103000[_0x5e3e('0x25')](_0x5b0937);return _0x103000[_0x5e3e('0x29')](_0x5e3e('0x2a'),_0x416a00+'-'+_0x46f262+'/'+_0x1f3b25)[_0x5e3e('0x26')](_0x4ba6b4);}return null;};}function patchUpdates(_0x1def9c){return function(_0x3151d0){try{jsonpatch[_0x5e3e('0x2b')](_0x3151d0,_0x1def9c,!![]);}catch(_0x163b1c){return BPromise[_0x5e3e('0x2c')](_0x163b1c);}return _0x3151d0['save']();};}function saveUpdates(_0x422c74,_0x20829b){return function(_0x544764){if(_0x544764){return _0x544764['update'](_0x422c74)[_0x5e3e('0x18')](function(_0x2a2777){return _0x2a2777;});}return null;};}function removeEntity(_0x4ccb27,_0x4cf667){return function(_0x4b6f94){if(_0x4b6f94){return _0x4b6f94['destroy']()['then'](function(){_0x4ccb27[_0x5e3e('0x25')](0xcc)[_0x5e3e('0x24')]();});}};}function handleEntityNotFound(_0x43f530,_0x16efb9){return function(_0x27670e){if(!_0x27670e){_0x43f530['sendStatus'](0x194);}return _0x27670e;};}function handleError(_0x57e5dd,_0x4a31fb){_0x4a31fb=_0x4a31fb||0x1f4;return function(_0x1ef849){logger[_0x5e3e('0x1f')](_0x1ef849['stack']);if(_0x1ef849[_0x5e3e('0x2d')]){delete _0x1ef849[_0x5e3e('0x2d')];}_0x57e5dd[_0x5e3e('0x25')](_0x4a31fb)[_0x5e3e('0x2e')](_0x1ef849);};}exports[_0x5e3e('0x2f')]=function(_0x4d9a13,_0x122474){var _0x3f5a3c={},_0x1c206f={},_0x16b4e5={'count':0x0,'rows':[]};var _0x325c31=_['map'](db[_0x5e3e('0x30')][_0x5e3e('0x31')],function(_0x50249d){return{'name':_0x50249d[_0x5e3e('0x32')],'type':_0x50249d['type'][_0x5e3e('0x33')]};});_0x1c206f[_0x5e3e('0x34')]=_[_0x5e3e('0x35')](_0x325c31,_0x5e3e('0x2d'));_0x1c206f['query']=_[_0x5e3e('0x36')](_0x4d9a13[_0x5e3e('0x37')]);_0x1c206f[_0x5e3e('0x38')]=_[_0x5e3e('0x39')](_0x1c206f[_0x5e3e('0x34')],_0x1c206f[_0x5e3e('0x37')]);_0x3f5a3c['attributes']=_[_0x5e3e('0x39')](_0x1c206f[_0x5e3e('0x34')],qs[_0x5e3e('0x3a')](_0x4d9a13[_0x5e3e('0x37')]['fields']));_0x3f5a3c[_0x5e3e('0x3b')]=_0x3f5a3c[_0x5e3e('0x3b')][_0x5e3e('0x3c')]?_0x3f5a3c[_0x5e3e('0x3b')]:_0x1c206f[_0x5e3e('0x34')];if(!_0x4d9a13[_0x5e3e('0x37')][_0x5e3e('0x3d')](_0x5e3e('0x3e'))){_0x3f5a3c['limit']=qs['limit'](_0x4d9a13[_0x5e3e('0x37')][_0x5e3e('0x28')]);_0x3f5a3c[_0x5e3e('0x27')]=qs['offset'](_0x4d9a13['query'][_0x5e3e('0x27')]);}_0x3f5a3c[_0x5e3e('0x3f')]=qs[_0x5e3e('0x40')](_0x4d9a13[_0x5e3e('0x37')][_0x5e3e('0x40')]);_0x3f5a3c[_0x5e3e('0x41')]=qs[_0x5e3e('0x38')](_[_0x5e3e('0x42')](_0x4d9a13[_0x5e3e('0x37')],_0x1c206f[_0x5e3e('0x38')]),_0x325c31);if(_0x4d9a13[_0x5e3e('0x37')]['filter']){_0x3f5a3c[_0x5e3e('0x41')]=_[_0x5e3e('0x43')](_0x3f5a3c[_0x5e3e('0x41')],{'$or':_[_0x5e3e('0x35')](_0x325c31,function(_0x40fc70){if(_0x40fc70[_0x5e3e('0x44')]!=='VIRTUAL'){var _0x177493={};_0x177493[_0x40fc70[_0x5e3e('0x2d')]]={'$like':'%'+_0x4d9a13['query'][_0x5e3e('0x45')]+'%'};return _0x177493;}})});}_0x3f5a3c=_[_0x5e3e('0x43')]({},_0x3f5a3c,_0x4d9a13[_0x5e3e('0x46')]);var _0x279260={'where':_0x3f5a3c[_0x5e3e('0x41')]};return db[_0x5e3e('0x30')]['count'](_0x279260)[_0x5e3e('0x18')](function(_0x2cd3a6){_0x16b4e5[_0x5e3e('0x47')]=_0x2cd3a6;if(_0x4d9a13['query'][_0x5e3e('0x48')]){_0x3f5a3c[_0x5e3e('0x49')]=[{'all':!![]}];}return db['Network'][_0x5e3e('0x4a')](_0x3f5a3c);})[_0x5e3e('0x18')](function(_0x56fe55){_0x16b4e5[_0x5e3e('0x4b')]=_0x56fe55;return _0x16b4e5;})['then'](respondWithFilteredResult(_0x122474,_0x3f5a3c))[_0x5e3e('0x4c')](handleError(_0x122474,null));};exports[_0x5e3e('0x4d')]=function(_0xc54791,_0x532142){var _0x3b67e2={'raw':!![],'where':{'id':_0xc54791[_0x5e3e('0x4e')]['id']}},_0x4f917d={};_0x4f917d[_0x5e3e('0x34')]=_['keys'](db['Network'][_0x5e3e('0x31')]);_0x4f917d[_0x5e3e('0x37')]=_['keys'](_0xc54791['query']);_0x4f917d[_0x5e3e('0x38')]=_[_0x5e3e('0x39')](_0x4f917d[_0x5e3e('0x34')],_0x4f917d[_0x5e3e('0x37')]);_0x3b67e2[_0x5e3e('0x3b')]=_[_0x5e3e('0x39')](_0x4f917d[_0x5e3e('0x34')],qs[_0x5e3e('0x3a')](_0xc54791[_0x5e3e('0x37')][_0x5e3e('0x3a')]));_0x3b67e2[_0x5e3e('0x3b')]=_0x3b67e2[_0x5e3e('0x3b')][_0x5e3e('0x3c')]?_0x3b67e2[_0x5e3e('0x3b')]:_0x4f917d[_0x5e3e('0x34')];if(_0xc54791[_0x5e3e('0x37')]['includeAll']){_0x3b67e2[_0x5e3e('0x49')]=[{'all':!![]}];}_0x3b67e2=_[_0x5e3e('0x43')]({},_0x3b67e2,_0xc54791[_0x5e3e('0x46')]);return db[_0x5e3e('0x30')][_0x5e3e('0x4f')](_0x3b67e2)['then'](handleEntityNotFound(_0x532142,null))[_0x5e3e('0x18')](respondWithResult(_0x532142,null))[_0x5e3e('0x4c')](handleError(_0x532142,null));};exports[_0x5e3e('0x50')]=function(_0x5bc9ba,_0x1bdc32,_0xae04e3){var _0x47cd3a;return db[_0x5e3e('0x51')][_0x5e3e('0x52')](function(_0xf8758f){return db[_0x5e3e('0x30')][_0x5e3e('0x50')](_0x5bc9ba[_0x5e3e('0x53')],{'raw':!![]})[_0x5e3e('0x18')](function(_0x25becf){_0x47cd3a=_0x25becf;return db[_0x5e3e('0x30')][_0x5e3e('0x4a')]({'where':{'type':_0x5bc9ba[_0x5e3e('0x53')][_0x5e3e('0x44')]},'raw':!![]});})[_0x5e3e('0x18')](function(_0x472cc7){if(_0x47cd3a[_0x5e3e('0x44')][_0x5e3e('0x54')]()==_0x5e3e('0x55')){var _0x3404c7=fs[_0x5e3e('0x56')](path['join'](config[_0x5e3e('0x57')],_0x5e3e('0x58')),'utf8');var _0x35e38e=ejs[_0x5e3e('0x59')](_0x3404c7,{'networks':_0x472cc7||[]});fs[_0x5e3e('0x5a')]('/etc/asterisk/stun_xcally.conf',_0x35e38e);return respondWithRpcPromise(_0x5e3e('0x5b'),_0x5e3e('0x50'),{'module':_0x5e3e('0x5c')});}else if(_0x47cd3a['type'][_0x5e3e('0x54')]()=='TURN'){var _0x443fbc=fs[_0x5e3e('0x56')](path[_0x5e3e('0x5d')](config['root'],_0x5e3e('0x5e')),_0x5e3e('0x5f'));var _0x70839a=ejs[_0x5e3e('0x59')](_0x443fbc,{'networks':_0x472cc7||[]});fs[_0x5e3e('0x5a')]('/etc/asterisk/turn_xcally.conf',_0x70839a);return respondWithRpcPromise(_0x5e3e('0x5b'),_0x5e3e('0x50'),{'module':_0x5e3e('0x5c')});}else{var _0x41a618=fs[_0x5e3e('0x56')](path[_0x5e3e('0x5d')](config['root'],_0x5e3e('0x60')),'utf8');var _0x488f66=ejs['render'](_0x41a618,{'networks':_0x472cc7||[]});fs[_0x5e3e('0x5a')](util[_0x5e3e('0x61')](_0x5e3e('0x62'),_0x5bc9ba['body'][_0x5e3e('0x44')][_0x5e3e('0x63')]()),_0x488f66);return respondWithRpcPromise(_0x5e3e('0x5b'),'create',{'module':_0x5e3e('0x64')});}return null;})[_0x5e3e('0x18')](function(){return _0x47cd3a;});})[_0x5e3e('0x18')](respondWithResult(_0x1bdc32,0xc9))[_0x5e3e('0x4c')](handleError(_0x1bdc32,null));};exports['update']=function(_0x583ac2,_0x15f80c,_0x5bd5b8){var _0x4ff79c;return db[_0x5e3e('0x51')][_0x5e3e('0x52')](function(_0x1055b3){return db[_0x5e3e('0x30')]['find']({'where':{'id':_0x583ac2[_0x5e3e('0x4e')]['id']}})[_0x5e3e('0x18')](handleEntityNotFound(_0x15f80c,null))[_0x5e3e('0x18')](saveUpdates(_0x583ac2[_0x5e3e('0x53')],null))[_0x5e3e('0x18')](function(_0x9ac191){if(_0x9ac191){_0x4ff79c=_0x9ac191;return db[_0x5e3e('0x30')][_0x5e3e('0x4a')]({'where':{'type':_0x4ff79c[_0x5e3e('0x44')]},'raw':!![]});}return null;})[_0x5e3e('0x18')](function(_0x304ada){if(_0x4ff79c[_0x5e3e('0x44')][_0x5e3e('0x54')]()==_0x5e3e('0x55')){var _0x4dddc1=fs[_0x5e3e('0x56')](path[_0x5e3e('0x5d')](config[_0x5e3e('0x57')],'server/files/templates/stun_multiple.ejs'),_0x5e3e('0x5f'));var _0x4a1910=ejs[_0x5e3e('0x59')](_0x4dddc1,{'networks':_0x304ada||[]});fs['writeFileSync'](_0x5e3e('0x65'),_0x4a1910);return respondWithRpcPromise(_0x5e3e('0x5b'),'update',{'module':_0x5e3e('0x5c')});}else if(_0x4ff79c[_0x5e3e('0x44')]['toUpperCase']()=='TURN'){var _0x3d68c5=fs['readFileSync'](path['join'](config[_0x5e3e('0x57')],_0x5e3e('0x5e')),'utf8');var _0x199800=ejs['render'](_0x3d68c5,{'networks':_0x304ada||[]});fs['writeFileSync'](_0x5e3e('0x66'),_0x199800);return respondWithRpcPromise(_0x5e3e('0x5b'),'update',{'module':'res_stun_monitor.so'});}else{var _0x330273=fs['readFileSync'](path[_0x5e3e('0x5d')](config[_0x5e3e('0x57')],_0x5e3e('0x60')),_0x5e3e('0x5f'));var _0x1b5fc7=ejs[_0x5e3e('0x59')](_0x330273,{'networks':_0x304ada||[]});fs['writeFileSync'](util[_0x5e3e('0x61')](_0x5e3e('0x62'),_0x583ac2[_0x5e3e('0x53')][_0x5e3e('0x44')][_0x5e3e('0x63')]()),_0x1b5fc7);return respondWithRpcPromise(_0x5e3e('0x5b'),_0x5e3e('0x67'),{'module':_0x5e3e('0x64')});}return null;})['then'](function(_0x1ee6a5){if(_0x1ee6a5){return _0x4ff79c;}return null;});})['then'](respondWithResult(_0x15f80c,null))[_0x5e3e('0x4c')](handleError(_0x15f80c,null));};exports[_0x5e3e('0x68')]=function(_0x551831,_0x1ff8dd,_0x1cfe21){var _0x407972;return db[_0x5e3e('0x30')][_0x5e3e('0x4f')]({'where':{'id':_0x551831[_0x5e3e('0x4e')]['id']}})[_0x5e3e('0x18')](function(_0x1e0c96){_0x407972=_0x1e0c96;return _0x1e0c96;})[_0x5e3e('0x18')](handleEntityNotFound(_0x1ff8dd,null))['then'](removeEntity(_0x1ff8dd,null))[_0x5e3e('0x18')](function(){if(_0x407972){return db[_0x5e3e('0x30')]['findAll']({'where':{'type':_0x407972[_0x5e3e('0x44')]},'raw':!![]});}})['then'](function(_0xc531bc){if(_0x407972[_0x5e3e('0x44')][_0x5e3e('0x54')]()=='STUN'){var _0x3d665a=fs[_0x5e3e('0x56')](path[_0x5e3e('0x5d')](config[_0x5e3e('0x57')],_0x5e3e('0x58')),_0x5e3e('0x5f'));var _0x20ff28=ejs[_0x5e3e('0x59')](_0x3d665a,{'networks':_0xc531bc||[]});fs[_0x5e3e('0x5a')](_0x5e3e('0x65'),_0x20ff28);return respondWithRpcPromise(_0x5e3e('0x5b'),_0x5e3e('0x68'),{'module':_0x5e3e('0x5c')});}else if(_0x407972[_0x5e3e('0x44')][_0x5e3e('0x54')]()==_0x5e3e('0x69')){var _0x5062e9=fs['readFileSync'](path[_0x5e3e('0x5d')](config['root'],_0x5e3e('0x5e')),_0x5e3e('0x5f'));var _0x28243d=ejs[_0x5e3e('0x59')](_0x5062e9,{'networks':_0xc531bc||[]});fs[_0x5e3e('0x5a')](_0x5e3e('0x66'),_0x28243d);return respondWithRpcPromise(_0x5e3e('0x5b'),_0x5e3e('0x68'),{'module':'res_stun_monitor.so'});}else{var _0x1c2fed=fs[_0x5e3e('0x56')](path[_0x5e3e('0x5d')](config[_0x5e3e('0x57')],_0x5e3e('0x60')),_0x5e3e('0x5f'));var _0x5b36d0=ejs['render'](_0x1c2fed,{'networks':_0xc531bc||[]});fs[_0x5e3e('0x5a')](util[_0x5e3e('0x61')](_0x5e3e('0x62'),_0x551831[_0x5e3e('0x53')]['type']['toLowerCase']()),_0x5b36d0);return respondWithRpcPromise(_0x5e3e('0x5b'),_0x5e3e('0x68'),{'module':_0x5e3e('0x64')});}return null;})[_0x5e3e('0x4c')](handleError(_0x1ff8dd,null));}; \ No newline at end of file +var _0x9d55=['fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','show','params','includeAll','options','create','sequelize','body','toUpperCase','readFileSync','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','join','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','root','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','transaction','find','STUN','server/files/templates/stun_multiple.ejs','update','destroy','/etc/asterisk/sip_xcally_%s.conf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','http','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','stack','name','index','map','Network','rawAttributes','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x1738c1,_0x1ae7a7){var _0x7e9634=function(_0x122e62){while(--_0x122e62){_0x1738c1['push'](_0x1738c1['shift']());}};_0x7e9634(++_0x1ae7a7);}(_0x9d55,0xfe));var _0x59d5=function(_0x39b000,_0x38e834){_0x39b000=_0x39b000-0x0;var _0x3884c1=_0x9d55[_0x39b000];return _0x3884c1;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x59d5('0x0'));var jsonpatch=require(_0x59d5('0x1'));var rp=require(_0x59d5('0x2'));var moment=require(_0x59d5('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x59d5('0x4'));var path=require('path');var sox=require(_0x59d5('0x5'));var csv=require(_0x59d5('0x6'));var ejs=require(_0x59d5('0x7'));var fs=require('fs');var _=require(_0x59d5('0x8'));var squel=require(_0x59d5('0x9'));var crypto=require('crypto');var jsforce=require(_0x59d5('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x59d5('0x6'));var querystring=require(_0x59d5('0xb'));var Papa=require(_0x59d5('0xc'));var Redis=require(_0x59d5('0xd'));var authService=require(_0x59d5('0xe'));var qs=require(_0x59d5('0xf'));var as=require(_0x59d5('0x10'));var hardwareService=require(_0x59d5('0x11'));var logger=require('../../config/logger')(_0x59d5('0x12'));var utils=require(_0x59d5('0x13'));var config=require(_0x59d5('0x14'));var db=require(_0x59d5('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x59d5('0x16')]({'port':0x232a});function checkPasswordPattern(_0x5f3edf,_0x3414a3,_0x245e99){if(_0x245e99){var _0x234a8a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x234a8a['test'](_0x3414a3)){return _0x5f3edf;}else{throw new db['Sequelize']['ValidationError'](_0x59d5('0x17'));}}else{return _0x5f3edf;}}function respondWithRpcPromise(_0x2d4c9e,_0x3a09eb,_0x50c331,_0x1a5257){return new BPromise(function(_0x31b7b4,_0x1bd37f){var _0x272647=_0x1a5257||client;return _0x272647[_0x59d5('0x18')](_0x2d4c9e,_0x50c331)[_0x59d5('0x19')](function(_0xb14ef2){logger[_0x59d5('0x1a')](_0x59d5('0x1b'),_0x3a09eb,_0x59d5('0x1c'));logger['debug'](_0x59d5('0x1d'),_0x3a09eb,_0x59d5('0x1c'),JSON['stringify'](_0xb14ef2));if(_0xb14ef2[_0x59d5('0x1e')]){if(_0xb14ef2[_0x59d5('0x1e')][_0x59d5('0x1f')]===0x1f4){logger['error'](_0x59d5('0x1b'),_0x3a09eb,_0xb14ef2[_0x59d5('0x1e')][_0x59d5('0x20')]);return _0x1bd37f(_0xb14ef2[_0x59d5('0x1e')][_0x59d5('0x20')]);}logger[_0x59d5('0x1e')](_0x59d5('0x1b'),_0x3a09eb,_0xb14ef2[_0x59d5('0x1e')][_0x59d5('0x20')]);return _0x31b7b4(_0xb14ef2[_0x59d5('0x1e')][_0x59d5('0x20')]);}else{logger[_0x59d5('0x1a')](_0x59d5('0x1b'),_0x3a09eb,_0x59d5('0x1c'));_0x31b7b4(_0xb14ef2[_0x59d5('0x21')][_0x59d5('0x20')]);}})[_0x59d5('0x22')](function(_0x2ad36a){logger[_0x59d5('0x1e')](_0x59d5('0x1b'),_0x3a09eb,_0x2ad36a);_0x1bd37f(_0x2ad36a);});});}function respondWithStatusCode(_0x210e2e,_0x210fba){_0x210fba=_0x210fba||0xcc;return function(_0x4c9ae0){if(_0x4c9ae0){return _0x210e2e[_0x59d5('0x23')](_0x210fba);}return _0x210e2e[_0x59d5('0x24')](_0x210fba)[_0x59d5('0x25')]();};}function respondWithResult(_0x44b02e,_0x3931f2){_0x3931f2=_0x3931f2||0xc8;return function(_0x3a66b2){if(_0x3a66b2){return _0x44b02e['status'](_0x3931f2)['json'](_0x3a66b2);}};}function respondWithFilteredResult(_0x429e7c,_0x3c1f15){return function(_0x21e4c0){if(_0x21e4c0){var _0x265ed8=_0x21e4c0[_0x59d5('0x26')],_0x57b4a5=_0x3c1f15[_0x59d5('0x27')],_0x551ff0=_0x3c1f15[_0x59d5('0x27')]+_0x3c1f15[_0x59d5('0x28')],_0x3c0635;if(_0x551ff0>=_0x265ed8){_0x551ff0=_0x265ed8;_0x3c0635=0xc8;}else{_0x3c0635=0xce;}_0x429e7c['status'](_0x3c0635);return _0x429e7c[_0x59d5('0x29')](_0x59d5('0x2a'),_0x57b4a5+'-'+_0x551ff0+'/'+_0x265ed8)[_0x59d5('0x2b')](_0x21e4c0);}return null;};}function patchUpdates(_0x3dcdf9){return function(_0x5ebedf){try{jsonpatch[_0x59d5('0x2c')](_0x5ebedf,_0x3dcdf9,!![]);}catch(_0x4c4417){return BPromise[_0x59d5('0x2d')](_0x4c4417);}return _0x5ebedf[_0x59d5('0x2e')]();};}function saveUpdates(_0x3f6c1d,_0x13a7a2){return function(_0x202701){if(_0x202701){return _0x202701['update'](_0x3f6c1d)[_0x59d5('0x19')](function(_0x573ec7){return _0x573ec7;});}return null;};}function removeEntity(_0x2dd676,_0x53ac97){return function(_0x35ef81){if(_0x35ef81){return _0x35ef81['destroy']()['then'](function(){_0x2dd676[_0x59d5('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11793a,_0x303f10){return function(_0x6303a1){if(!_0x6303a1){_0x11793a[_0x59d5('0x23')](0x194);}return _0x6303a1;};}function handleError(_0x98af6a,_0x37aae3){_0x37aae3=_0x37aae3||0x1f4;return function(_0x3d1348){logger[_0x59d5('0x1e')](_0x3d1348[_0x59d5('0x2f')]);if(_0x3d1348['name']){delete _0x3d1348[_0x59d5('0x30')];}_0x98af6a[_0x59d5('0x24')](_0x37aae3)['send'](_0x3d1348);};}exports[_0x59d5('0x31')]=function(_0x16f86c,_0x3c812c){var _0x11b32e={},_0x4e441b={},_0x24d828={'count':0x0,'rows':[]};var _0xc0c2f=_[_0x59d5('0x32')](db[_0x59d5('0x33')][_0x59d5('0x34')],function(_0x14d0ec){return{'name':_0x14d0ec['fieldName'],'type':_0x14d0ec[_0x59d5('0x35')][_0x59d5('0x36')]};});_0x4e441b[_0x59d5('0x37')]=_[_0x59d5('0x32')](_0xc0c2f,_0x59d5('0x30'));_0x4e441b[_0x59d5('0x38')]=_[_0x59d5('0x39')](_0x16f86c['query']);_0x4e441b[_0x59d5('0x3a')]=_[_0x59d5('0x3b')](_0x4e441b[_0x59d5('0x37')],_0x4e441b['query']);_0x11b32e[_0x59d5('0x3c')]=_[_0x59d5('0x3b')](_0x4e441b[_0x59d5('0x37')],qs['fields'](_0x16f86c['query'][_0x59d5('0x3d')]));_0x11b32e[_0x59d5('0x3c')]=_0x11b32e['attributes'][_0x59d5('0x3e')]?_0x11b32e[_0x59d5('0x3c')]:_0x4e441b[_0x59d5('0x37')];if(!_0x16f86c[_0x59d5('0x38')][_0x59d5('0x3f')]('nolimit')){_0x11b32e[_0x59d5('0x28')]=qs[_0x59d5('0x28')](_0x16f86c[_0x59d5('0x38')]['limit']);_0x11b32e[_0x59d5('0x27')]=qs['offset'](_0x16f86c[_0x59d5('0x38')][_0x59d5('0x27')]);}_0x11b32e[_0x59d5('0x40')]=qs[_0x59d5('0x41')](_0x16f86c[_0x59d5('0x38')][_0x59d5('0x41')]);_0x11b32e[_0x59d5('0x42')]=qs[_0x59d5('0x3a')](_[_0x59d5('0x43')](_0x16f86c['query'],_0x4e441b[_0x59d5('0x3a')]),_0xc0c2f);if(_0x16f86c[_0x59d5('0x38')]['filter']){_0x11b32e[_0x59d5('0x42')]=_[_0x59d5('0x44')](_0x11b32e[_0x59d5('0x42')],{'$or':_[_0x59d5('0x32')](_0xc0c2f,function(_0x1f91ce){if(_0x1f91ce[_0x59d5('0x35')]!==_0x59d5('0x45')){var _0x396248={};_0x396248[_0x1f91ce[_0x59d5('0x30')]]={'$like':'%'+_0x16f86c[_0x59d5('0x38')][_0x59d5('0x46')]+'%'};return _0x396248;}})});}_0x11b32e=_['merge']({},_0x11b32e,_0x16f86c['options']);var _0x527f6c={'where':_0x11b32e['where']};return db[_0x59d5('0x33')]['count'](_0x527f6c)[_0x59d5('0x19')](function(_0x321f86){_0x24d828[_0x59d5('0x26')]=_0x321f86;if(_0x16f86c[_0x59d5('0x38')]['includeAll']){_0x11b32e[_0x59d5('0x47')]=[{'all':!![]}];}return db[_0x59d5('0x33')][_0x59d5('0x48')](_0x11b32e);})[_0x59d5('0x19')](function(_0xbb0a5){_0x24d828[_0x59d5('0x49')]=_0xbb0a5;return _0x24d828;})[_0x59d5('0x19')](respondWithFilteredResult(_0x3c812c,_0x11b32e))[_0x59d5('0x22')](handleError(_0x3c812c,null));};exports[_0x59d5('0x4a')]=function(_0x32f36b,_0x6c3eab){var _0x874d16={'raw':!![],'where':{'id':_0x32f36b[_0x59d5('0x4b')]['id']}},_0x16af62={};_0x16af62[_0x59d5('0x37')]=_[_0x59d5('0x39')](db[_0x59d5('0x33')][_0x59d5('0x34')]);_0x16af62[_0x59d5('0x38')]=_[_0x59d5('0x39')](_0x32f36b[_0x59d5('0x38')]);_0x16af62[_0x59d5('0x3a')]=_[_0x59d5('0x3b')](_0x16af62[_0x59d5('0x37')],_0x16af62['query']);_0x874d16[_0x59d5('0x3c')]=_[_0x59d5('0x3b')](_0x16af62[_0x59d5('0x37')],qs[_0x59d5('0x3d')](_0x32f36b[_0x59d5('0x38')][_0x59d5('0x3d')]));_0x874d16[_0x59d5('0x3c')]=_0x874d16['attributes']['length']?_0x874d16['attributes']:_0x16af62[_0x59d5('0x37')];if(_0x32f36b[_0x59d5('0x38')][_0x59d5('0x4c')]){_0x874d16['include']=[{'all':!![]}];}_0x874d16=_[_0x59d5('0x44')]({},_0x874d16,_0x32f36b[_0x59d5('0x4d')]);return db[_0x59d5('0x33')]['find'](_0x874d16)[_0x59d5('0x19')](handleEntityNotFound(_0x6c3eab,null))[_0x59d5('0x19')](respondWithResult(_0x6c3eab,null))[_0x59d5('0x22')](handleError(_0x6c3eab,null));};exports[_0x59d5('0x4e')]=function(_0x33f601,_0x5cb128,_0x13fd1b){var _0x5e197c;return db[_0x59d5('0x4f')]['transaction'](function(_0x460cba){return db[_0x59d5('0x33')][_0x59d5('0x4e')](_0x33f601[_0x59d5('0x50')],{'raw':!![]})[_0x59d5('0x19')](function(_0x303883){_0x5e197c=_0x303883;return db[_0x59d5('0x33')]['findAll']({'where':{'type':_0x33f601[_0x59d5('0x50')][_0x59d5('0x35')]},'raw':!![]});})[_0x59d5('0x19')](function(_0x538b70){if(_0x5e197c[_0x59d5('0x35')][_0x59d5('0x51')]()=='STUN'){var _0x399711=fs[_0x59d5('0x52')](path['join'](config['root'],'server/files/templates/stun_multiple.ejs'),_0x59d5('0x53'));var _0x398642=ejs[_0x59d5('0x54')](_0x399711,{'networks':_0x538b70||[]});fs[_0x59d5('0x55')](_0x59d5('0x56'),_0x398642);return respondWithRpcPromise(_0x59d5('0x57'),_0x59d5('0x4e'),{'module':_0x59d5('0x58')});}else if(_0x5e197c[_0x59d5('0x35')]['toUpperCase']()==_0x59d5('0x59')){var _0x2ba61f=fs['readFileSync'](path[_0x59d5('0x5a')](config['root'],_0x59d5('0x5b')),'utf8');var _0x5c0c73=ejs[_0x59d5('0x54')](_0x2ba61f,{'networks':_0x538b70||[]});fs[_0x59d5('0x55')](_0x59d5('0x5c'),_0x5c0c73);return respondWithRpcPromise('Reload','create',{'module':_0x59d5('0x58')});}else{var _0x533b28=fs[_0x59d5('0x52')](path[_0x59d5('0x5a')](config[_0x59d5('0x5d')],_0x59d5('0x5e')),_0x59d5('0x53'));var _0x3b0317=ejs[_0x59d5('0x54')](_0x533b28,{'networks':_0x538b70||[]});fs['writeFileSync'](util[_0x59d5('0x5f')]('/etc/asterisk/sip_xcally_%s.conf',_0x33f601[_0x59d5('0x50')]['type'][_0x59d5('0x60')]()),_0x3b0317);return respondWithRpcPromise(_0x59d5('0x57'),_0x59d5('0x4e'),{'module':_0x59d5('0x61')});}return null;})[_0x59d5('0x19')](function(){return _0x5e197c;});})['then'](respondWithResult(_0x5cb128,0xc9))[_0x59d5('0x22')](handleError(_0x5cb128,null));};exports['update']=function(_0x27227f,_0x229137,_0x328810){var _0x4aadf9;return db[_0x59d5('0x4f')][_0x59d5('0x62')](function(_0x3f9d66){return db[_0x59d5('0x33')][_0x59d5('0x63')]({'where':{'id':_0x27227f[_0x59d5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x229137,null))[_0x59d5('0x19')](saveUpdates(_0x27227f['body'],null))[_0x59d5('0x19')](function(_0x14a258){if(_0x14a258){_0x4aadf9=_0x14a258;return db[_0x59d5('0x33')][_0x59d5('0x48')]({'where':{'type':_0x4aadf9['type']},'raw':!![]});}return null;})['then'](function(_0x46aade){if(_0x4aadf9[_0x59d5('0x35')][_0x59d5('0x51')]()==_0x59d5('0x64')){var _0x22124e=fs[_0x59d5('0x52')](path[_0x59d5('0x5a')](config['root'],_0x59d5('0x65')),_0x59d5('0x53'));var _0x112f56=ejs[_0x59d5('0x54')](_0x22124e,{'networks':_0x46aade||[]});fs[_0x59d5('0x55')](_0x59d5('0x56'),_0x112f56);return respondWithRpcPromise(_0x59d5('0x57'),'update',{'module':'res_stun_monitor.so'});}else if(_0x4aadf9[_0x59d5('0x35')]['toUpperCase']()==_0x59d5('0x59')){var _0x197ee6=fs[_0x59d5('0x52')](path[_0x59d5('0x5a')](config[_0x59d5('0x5d')],_0x59d5('0x5b')),'utf8');var _0x3989ed=ejs[_0x59d5('0x54')](_0x197ee6,{'networks':_0x46aade||[]});fs[_0x59d5('0x55')](_0x59d5('0x5c'),_0x3989ed);return respondWithRpcPromise(_0x59d5('0x57'),'update',{'module':'res_stun_monitor.so'});}else{var _0x9d05d4=fs[_0x59d5('0x52')](path[_0x59d5('0x5a')](config[_0x59d5('0x5d')],_0x59d5('0x5e')),_0x59d5('0x53'));var _0x4a6200=ejs[_0x59d5('0x54')](_0x9d05d4,{'networks':_0x46aade||[]});fs[_0x59d5('0x55')](util[_0x59d5('0x5f')]('/etc/asterisk/sip_xcally_%s.conf',_0x27227f[_0x59d5('0x50')][_0x59d5('0x35')]['toLowerCase']()),_0x4a6200);return respondWithRpcPromise('Reload',_0x59d5('0x66'),{'module':'chan_sip.so'});}return null;})[_0x59d5('0x19')](function(_0x12fceb){if(_0x12fceb){return _0x4aadf9;}return null;});})[_0x59d5('0x19')](respondWithResult(_0x229137,null))[_0x59d5('0x22')](handleError(_0x229137,null));};exports['destroy']=function(_0x28d7c,_0x3bfc3f,_0x4d0df1){var _0x2f4671;return db['Network'][_0x59d5('0x63')]({'where':{'id':_0x28d7c[_0x59d5('0x4b')]['id']}})[_0x59d5('0x19')](function(_0x130df4){_0x2f4671=_0x130df4;return _0x130df4;})[_0x59d5('0x19')](handleEntityNotFound(_0x3bfc3f,null))[_0x59d5('0x19')](removeEntity(_0x3bfc3f,null))['then'](function(){if(_0x2f4671){return db['Network'][_0x59d5('0x48')]({'where':{'type':_0x2f4671[_0x59d5('0x35')]},'raw':!![]});}})[_0x59d5('0x19')](function(_0x4013b8){if(_0x2f4671['type'][_0x59d5('0x51')]()==_0x59d5('0x64')){var _0x1c3ccd=fs['readFileSync'](path[_0x59d5('0x5a')](config['root'],_0x59d5('0x65')),_0x59d5('0x53'));var _0x1e617e=ejs[_0x59d5('0x54')](_0x1c3ccd,{'networks':_0x4013b8||[]});fs[_0x59d5('0x55')]('/etc/asterisk/stun_xcally.conf',_0x1e617e);return respondWithRpcPromise(_0x59d5('0x57'),_0x59d5('0x67'),{'module':_0x59d5('0x58')});}else if(_0x2f4671['type'][_0x59d5('0x51')]()==_0x59d5('0x59')){var _0x5716e7=fs[_0x59d5('0x52')](path[_0x59d5('0x5a')](config['root'],_0x59d5('0x5b')),'utf8');var _0x2c7b47=ejs[_0x59d5('0x54')](_0x5716e7,{'networks':_0x4013b8||[]});fs[_0x59d5('0x55')](_0x59d5('0x5c'),_0x2c7b47);return respondWithRpcPromise(_0x59d5('0x57'),_0x59d5('0x67'),{'module':'res_stun_monitor.so'});}else{var _0x5603a9=fs[_0x59d5('0x52')](path[_0x59d5('0x5a')](config['root'],'server/files/templates/network.ejs'),_0x59d5('0x53'));var _0x228634=ejs['render'](_0x5603a9,{'networks':_0x4013b8||[]});fs[_0x59d5('0x55')](util[_0x59d5('0x5f')](_0x59d5('0x68'),_0x28d7c[_0x59d5('0x50')][_0x59d5('0x35')][_0x59d5('0x60')]()),_0x228634);return respondWithRpcPromise(_0x59d5('0x57'),_0x59d5('0x67'),{'module':_0x59d5('0x61')});}return null;})[_0x59d5('0x22')](handleError(_0x3bfc3f,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 9eaf81e..25eb783 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 _0xf3cd=['path','rimraf','../../config/environment','exports','define','Network','network','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x11c53f,_0x556016){var _0x40f275=function(_0x4f3514){while(--_0x4f3514){_0x11c53f['push'](_0x11c53f['shift']());}};_0x40f275(++_0x556016);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3aa0ac,_0x5f5da6){_0x3aa0ac=_0x3aa0ac-0x0;var _0x568a11=_0xf3cd[_0x3aa0ac];return _0x568a11;};'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('./network.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a2c=['path','rimraf','../../config/environment','exports','network','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xfac185,_0x41591f){var _0x29cf80=function(_0x34ae34){while(--_0x34ae34){_0xfac185['push'](_0xfac185['shift']());}};_0x29cf80(++_0x41591f);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x419704,_0x2882e6){_0x419704=_0x419704-0x0;var _0x42817d=_0x7a2c[_0x419704];return _0x42817d;};'use strict';var _=require(_0xc7a2('0x0'));var util=require('util');var logger=require(_0xc7a2('0x1'))(_0xc7a2('0x2'));var moment=require(_0xc7a2('0x3'));var BPromise=require(_0xc7a2('0x4'));var rp=require(_0xc7a2('0x5'));var fs=require('fs');var path=require(_0xc7a2('0x6'));var rimraf=require(_0xc7a2('0x7'));var config=require(_0xc7a2('0x8'));var attributes=require('./network.attributes');module[_0xc7a2('0x9')]=function(_0x1ddbae,_0x5f334e){return _0x1ddbae['define']('Network',attributes,{'tableName':_0xc7a2('0xa'),'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 9b0a447..f0624db 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 _0x097c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','code','message','info','Network,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring'];(function(_0x4471b3,_0x511a9f){var _0x386593=function(_0x1057e2){while(--_0x1057e2){_0x4471b3['push'](_0x4471b3['shift']());}};_0x386593(++_0x511a9f);}(_0x097c,0x13e));var _0xc097=function(_0x5e5316,_0x427a98){_0x5e5316=_0x5e5316-0x0;var _0xcdb0d=_0x097c[_0x5e5316];return _0xcdb0d;};'use strict';var _=require(_0xc097('0x0'));var util=require(_0xc097('0x1'));var moment=require(_0xc097('0x2'));var BPromise=require('bluebird');var rs=require(_0xc097('0x3'));var fs=require('fs');var Redis=require(_0xc097('0x4'));var db=require(_0xc097('0x5'))['db'];var utils=require(_0xc097('0x6'));var logger=require(_0xc097('0x7'))(_0xc097('0x8'));var config=require(_0xc097('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc097('0xa')][_0xc097('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x518d7b,_0x168733,_0x3b20e5){return new BPromise(function(_0x3bf151,_0xb8f82b){return client[_0xc097('0xc')](_0x518d7b,_0x3b20e5)[_0xc097('0xd')](function(_0x33acd6){logger['info']('Network,\x20%s,\x20%s',_0x168733,_0xc097('0xe'));logger['debug'](_0xc097('0xf'),_0x168733,_0xc097('0xe'),JSON['stringify'](_0x33acd6));if(_0x33acd6[_0xc097('0x10')]){if(_0x33acd6[_0xc097('0x10')][_0xc097('0x11')]===0x1f4){logger[_0xc097('0x10')]('Network,\x20%s,\x20%s',_0x168733,_0x33acd6[_0xc097('0x10')][_0xc097('0x12')]);return _0xb8f82b(_0x33acd6[_0xc097('0x10')][_0xc097('0x12')]);}logger[_0xc097('0x10')]('Network,\x20%s,\x20%s',_0x168733,_0x33acd6[_0xc097('0x10')]['message']);return _0x3bf151(_0x33acd6[_0xc097('0x10')]['message']);}else{logger[_0xc097('0x13')](_0xc097('0x14'),_0x168733,'request\x20sent');_0x3bf151(_0x33acd6[_0xc097('0x15')][_0xc097('0x12')]);}})[_0xc097('0x16')](function(_0x3e473d){logger[_0xc097('0x10')](_0xc097('0x14'),_0x168733,_0x3e473d);_0xb8f82b(_0x3e473d);});});} \ No newline at end of file +var _0x437a=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','Network,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x60a268,_0x2a5b1d){var _0x2259ab=function(_0x41ae83){while(--_0x41ae83){_0x60a268['push'](_0x60a268['shift']());}};_0x2259ab(++_0x2a5b1d);}(_0x437a,0x1f3));var _0xa437=function(_0x4a73f2,_0x352409){_0x4a73f2=_0x4a73f2-0x0;var _0x4190ee=_0x437a[_0x4a73f2];return _0x4190ee;};'use strict';var _=require(_0xa437('0x0'));var util=require(_0xa437('0x1'));var moment=require(_0xa437('0x2'));var BPromise=require('bluebird');var rs=require(_0xa437('0x3'));var fs=require('fs');var Redis=require(_0xa437('0x4'));var db=require(_0xa437('0x5'))['db'];var utils=require(_0xa437('0x6'));var logger=require(_0xa437('0x7'))('rpc');var config=require(_0xa437('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa437('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3781cb,_0x316be5,_0x2f9d39){return new BPromise(function(_0x5da88a,_0x191c1e){return client[_0xa437('0xa')](_0x3781cb,_0x2f9d39)['then'](function(_0x7a73d){logger[_0xa437('0xb')](_0xa437('0xc'),_0x316be5,'request\x20sent');logger[_0xa437('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x316be5,_0xa437('0xe'),JSON[_0xa437('0xf')](_0x7a73d));if(_0x7a73d[_0xa437('0x10')]){if(_0x7a73d['error'][_0xa437('0x11')]===0x1f4){logger[_0xa437('0x10')](_0xa437('0xc'),_0x316be5,_0x7a73d[_0xa437('0x10')][_0xa437('0x12')]);return _0x191c1e(_0x7a73d['error'][_0xa437('0x12')]);}logger[_0xa437('0x10')](_0xa437('0xc'),_0x316be5,_0x7a73d[_0xa437('0x10')][_0xa437('0x12')]);return _0x5da88a(_0x7a73d[_0xa437('0x10')][_0xa437('0x12')]);}else{logger[_0xa437('0xb')](_0xa437('0xc'),_0x316be5,_0xa437('0xe'));_0x5da88a(_0x7a73d[_0xa437('0x13')][_0xa437('0x12')]);}})[_0xa437('0x14')](function(_0x1a8af1){logger[_0xa437('0x10')]('Network,\x20%s,\x20%s',_0x316be5,_0x1a8af1);_0x191c1e(_0x1a8af1);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index f548603..be8f8f6 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 _0x2e39=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','post','isAuthenticated','sendNotification','multer'];(function(_0x49f118,_0x5138e4){var _0x3a0443=function(_0x557a45){while(--_0x557a45){_0x49f118['push'](_0x49f118['shift']());}};_0x3a0443(++_0x5138e4);}(_0x2e39,0xe0));var _0x92e3=function(_0x13e35e,_0x175451){_0x13e35e=_0x13e35e-0x0;var _0x1fa344=_0x2e39[_0x13e35e];return _0x1fa344;};'use strict';var multer=require(_0x92e3('0x0'));var util=require('util');var path=require(_0x92e3('0x1'));var timeout=require(_0x92e3('0x2'));var express=require(_0x92e3('0x3'));var router=express['Router']();var auth=require(_0x92e3('0x4'));var interaction=require(_0x92e3('0x5'));var config=require('../../config/environment');var controller=require('./notification.controller');router[_0x92e3('0x6')]('/',auth[_0x92e3('0x7')](),controller[_0x92e3('0x8')]);module['exports']=router; \ No newline at end of file +var _0x6530=['../../components/auth/service','../../components/interaction/service','../../config/environment','./notification.controller','post','sendNotification','multer','util','connect-timeout','express','Router'];(function(_0x23eef6,_0x476f63){var _0x45b0dd=function(_0x578260){while(--_0x578260){_0x23eef6['push'](_0x23eef6['shift']());}};_0x45b0dd(++_0x476f63);}(_0x6530,0x103));var _0x0653=function(_0xb7f071,_0x34134a){_0xb7f071=_0xb7f071-0x0;var _0xdc2c6d=_0x6530[_0xb7f071];return _0xdc2c6d;};'use strict';var multer=require(_0x0653('0x0'));var util=require(_0x0653('0x1'));var path=require('path');var timeout=require(_0x0653('0x2'));var express=require(_0x0653('0x3'));var router=express[_0x0653('0x4')]();var auth=require(_0x0653('0x5'));var interaction=require(_0x0653('0x6'));var config=require(_0x0653('0x7'));var controller=require(_0x0653('0x8'));router[_0x0653('0x9')]('/',auth['isAuthenticated'](),controller[_0x0653('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index 0a276f8..7ce5589 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 _0xfba3=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x5f25dd,_0x2e5567){var _0x3b48e3=function(_0x41d00e){while(--_0x41d00e){_0x5f25dd['push'](_0x5f25dd['shift']());}};_0x3b48e3(++_0x2e5567);}(_0xfba3,0x121));var _0x3fba=function(_0x864c0c,_0x1d3d2f){_0x864c0c=_0x864c0c-0x0;var _0x2ef6ba=_0xfba3[_0x864c0c];return _0x2ef6ba;};'use strict';var Sequelize=require(_0x3fba('0x0'));module[_0x3fba('0x1')]={'body':{'type':Sequelize[_0x3fba('0x2')]},'senderName':{'type':Sequelize[_0x3fba('0x3')]},'recipientsId':{'type':Sequelize[_0x3fba('0x2')]},'recipientsDescription':{'type':Sequelize[_0x3fba('0x3')]},'beep':{'type':Sequelize[_0x3fba('0x4')]}}; \ No newline at end of file +var _0xcf18=['STRING','BOOLEAN','TEXT'];(function(_0x1f83a5,_0x59843f){var _0x45edf0=function(_0x431e25){while(--_0x431e25){_0x1f83a5['push'](_0x1f83a5['shift']());}};_0x45edf0(++_0x59843f);}(_0xcf18,0x1af));var _0x8cf1=function(_0x59afb4,_0x456158){_0x59afb4=_0x59afb4-0x0;var _0x2569f1=_0xcf18[_0x59afb4];return _0x2569f1;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x8cf1('0x0')]},'senderName':{'type':Sequelize[_0x8cf1('0x1')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x8cf1('0x1')]},'beep':{'type':Sequelize[_0x8cf1('0x2')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index e454cdd..6e2a7d8 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 _0x85da=['api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','sendNotification','text','body','hasOwnProperty','Sequelize','TemplateId','view','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','sortBy','join','sequelize','transaction','Notification','create','forEach','recipient','emit','notification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','ids','queue','replace','Queue','push','flatten','getAgents','map','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x325783,_0x4e0d7f){var _0xa4bfe3=function(_0x4d7fcf){while(--_0x4d7fcf){_0x325783['push'](_0x325783['shift']());}};_0xa4bfe3(++_0x4e0d7f);}(_0x85da,0x1cf));var _0xa85d=function(_0x495b3d,_0x4d3da4){_0x495b3d=_0x495b3d-0x0;var _0x4cb329=_0x85da[_0x495b3d];return _0x4cb329;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa85d('0x0'));var rimraf=require(_0xa85d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa85d('0x2'));var rp=require(_0xa85d('0x3'));var moment=require(_0xa85d('0x4'));var BPromise=require(_0xa85d('0x5'));var Mustache=require(_0xa85d('0x6'));var util=require('util');var path=require(_0xa85d('0x7'));var sox=require('sox');var csv=require(_0xa85d('0x8'));var ejs=require(_0xa85d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa85d('0xa'));var jsforce=require(_0xa85d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa85d('0x8'));var querystring=require(_0xa85d('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa85d('0xd'));var as=require(_0xa85d('0xe'));var hardwareService=require(_0xa85d('0xf'));var logger=require(_0xa85d('0x10'))(_0xa85d('0x11'));var utils=require('../../config/utils');var config=require(_0xa85d('0x12'));var db=require('../../mysqldb')['db'];config[_0xa85d('0x13')]=_[_0xa85d('0x14')](config[_0xa85d('0x13')],{'host':_0xa85d('0x15'),'port':0x18eb});var socket=require(_0xa85d('0x16'))(new Redis(config[_0xa85d('0x13')]));require(_0xa85d('0x17'))[_0xa85d('0x18')](socket);function respondWithStatusCode(_0x31b5de,_0x9ea276){_0x9ea276=_0x9ea276||0xcc;return function(_0x5dcd1f){if(_0x5dcd1f){return _0x31b5de[_0xa85d('0x19')](_0x9ea276);}return _0x31b5de[_0xa85d('0x1a')](_0x9ea276)[_0xa85d('0x1b')]();};}function respondWithResult(_0x3b8904,_0x395a66){_0x395a66=_0x395a66||0xc8;return function(_0x1ee2e3){if(_0x1ee2e3){return _0x3b8904[_0xa85d('0x1a')](_0x395a66)[_0xa85d('0x1c')](_0x1ee2e3);}};}function respondWithFilteredResult(_0x5f4858,_0x4583f9){return function(_0x57e536){if(_0x57e536){var _0x5988f6=_0x57e536[_0xa85d('0x1d')],_0x68ee48=_0x4583f9['offset'],_0x520d30=_0x4583f9[_0xa85d('0x1e')]+_0x4583f9[_0xa85d('0x1f')],_0x219b8b;if(_0x520d30>=_0x5988f6){_0x520d30=_0x5988f6;_0x219b8b=0xc8;}else{_0x219b8b=0xce;}_0x5f4858['status'](_0x219b8b);return _0x5f4858[_0xa85d('0x20')](_0xa85d('0x21'),_0x68ee48+'-'+_0x520d30+'/'+_0x5988f6)[_0xa85d('0x1c')](_0x57e536);}return null;};}function patchUpdates(_0x823e6c){return function(_0x1da2e0){try{jsonpatch[_0xa85d('0x22')](_0x1da2e0,_0x823e6c,!![]);}catch(_0x5ea595){return BPromise[_0xa85d('0x23')](_0x5ea595);}return _0x1da2e0[_0xa85d('0x24')]();};}function saveUpdates(_0xbe366c,_0x5d0173){return function(_0x5e57a6){if(_0x5e57a6){return _0x5e57a6['update'](_0xbe366c)[_0xa85d('0x25')](function(_0x1e86b0){return _0x1e86b0;});}return null;};}function removeEntity(_0x1564b2,_0x512805){return function(_0x543b77){if(_0x543b77){return _0x543b77[_0xa85d('0x26')]()['then'](function(){_0x1564b2['status'](0xcc)[_0xa85d('0x1b')]();});}};}function handleEntityNotFound(_0x517519,_0x2ec66e){return function(_0x50922e){if(!_0x50922e){_0x517519[_0xa85d('0x19')](0x194);}return _0x50922e;};}function handleError(_0x23b6d4,_0x17054c){_0x17054c=_0x17054c||0x1f4;return function(_0x145dd8){logger[_0xa85d('0x27')](_0x145dd8['stack']);if(_0x145dd8['name']){delete _0x145dd8[_0xa85d('0x28')];}_0x23b6d4[_0xa85d('0x1a')](_0x17054c)[_0xa85d('0x29')](_0x145dd8);};}exports[_0xa85d('0x2a')]=function(_0x3d9dd6,_0x7793f9,_0x2bcc8e){if(!_0x3d9dd6['body']['hasOwnProperty'](_0xa85d('0x2b'))&&!_0x3d9dd6[_0xa85d('0x2c')][_0xa85d('0x2d')]('TemplateId')){throw new db[(_0xa85d('0x2e'))]['ValidationError']('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x3d9dd6[_0xa85d('0x2c')][_0xa85d('0x2d')](_0xa85d('0x2f'))&&!_0x3d9dd6['body'][_0xa85d('0x2d')](_0xa85d('0x30'))){throw new db[(_0xa85d('0x2e'))][(_0xa85d('0x31'))](_0xa85d('0x32'));}if(!_0x3d9dd6[_0xa85d('0x2c')]['hasOwnProperty'](_0xa85d('0x33'))){throw new db[(_0xa85d('0x2e'))][(_0xa85d('0x31'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x5eed47=JSON[_0xa85d('0x34')](_0x3d9dd6[_0xa85d('0x2c')][_0xa85d('0x33')]);}catch(_0x5b69a7){logger[_0xa85d('0x27')](_0x5b69a7);throw new db[(_0xa85d('0x2e'))][(_0xa85d('0x31'))](_0xa85d('0x35'));}var _0x20358e=['chatqueue',_0xa85d('0x36'),_0xa85d('0x37'),_0xa85d('0x38'),_0xa85d('0x39'),_0xa85d('0x3a'),_0xa85d('0x3b'),'team',_0xa85d('0x3c')];if(_['some'](_0x5eed47,function(_0x235bc4){return!_['includes'](_0x20358e,_0x235bc4[_0xa85d('0x3d')]['toLowerCase']());})){throw new db[(_0xa85d('0x2e'))][(_0xa85d('0x31'))](_0xa85d('0x3e'));}}}var _0x52dd44={};_0x52dd44[_0xa85d('0x3f')]=_0x3d9dd6[_0xa85d('0x2c')]['hasOwnProperty'](_0xa85d('0x3f'))?_0x3d9dd6[_0xa85d('0x2c')][_0xa85d('0x3f')]:_0x3d9dd6[_0xa85d('0x3c')][_0xa85d('0x40')];_0x52dd44['recipientsDescription']=_[_0xa85d('0x41')](_0x3d9dd6[_0xa85d('0x2c')][_0xa85d('0x42')])?null:_0x3d9dd6[_0xa85d('0x2c')][_0xa85d('0x42')];_0x52dd44[_0xa85d('0x43')]=_0x3d9dd6[_0xa85d('0x2c')][_0xa85d('0x43')]||![];_0x52dd44[_0xa85d('0x44')]=_0x3d9dd6[_0xa85d('0x3c')]['id'];return getContent(_0x3d9dd6[_0xa85d('0x2c')])[_0xa85d('0x25')](function(_0x32add0){_0x52dd44[_0xa85d('0x2c')]=_0x32add0;return getRecipients(_0x5eed47);})[_0xa85d('0x25')](function(_0x532193){_0x52dd44['recipientsId']=_[_0xa85d('0x45')](_0x532193)[_0xa85d('0x46')](',');return db[_0xa85d('0x47')][_0xa85d('0x48')](function(_0x3c2c95){return db[_0xa85d('0x49')][_0xa85d('0x4a')](_0x52dd44,{'raw':!![],'transaction':_0x3c2c95})[_0xa85d('0x25')](function(_0x36f6d6){var _0x2b451a={'sender':_0x52dd44[_0xa85d('0x3f')],'description':_0x52dd44[_0xa85d('0x42')],'content':_0x52dd44[_0xa85d('0x2c')],'beep':_0x52dd44[_0xa85d('0x43')]};_0x532193[_0xa85d('0x4b')](function(_0x49bbe7){_0x2b451a[_0xa85d('0x4c')]=_0x49bbe7;socket[_0xa85d('0x4d')](_0xa85d('0x4e'),_0x2b451a);});return _0x36f6d6;});});})[_0xa85d('0x25')](respondWithResult(_0x7793f9,0xc9))[_0xa85d('0x4f')](handleError(_0x7793f9,null));};function getContent(_0x13edb0){return new BPromise(function(_0x1fec6c,_0x2b5c2a){if(_0x13edb0['text']){_0x1fec6c(_0x13edb0[_0xa85d('0x2b')]);return;}return db[_0xa85d('0x50')][_0xa85d('0x51')]({'attributes':[_0xa85d('0x52')],'where':{'id':_0x13edb0[_0xa85d('0x2f')]},'raw':!![]})['then'](function(_0x39c3ad){if(!_0x39c3ad)throw new db[(_0xa85d('0x2e'))][(_0xa85d('0x31'))](_0xa85d('0x53'));var _0x557d5b=Mustache[_0xa85d('0x54')](_0x39c3ad['html'],_0x13edb0[_0xa85d('0x30')]);_0x1fec6c(_0x557d5b);})[_0xa85d('0x4f')](function(_0x14fbb1){_0x2b5c2a(_0x14fbb1);});});}function getRecipients(_0x76acd0){return new BPromise(function(_0x2c8e43,_0x4ee7b8){var _0x5671a4=[];var _0x5462e5=[];_0x76acd0['forEach'](function(_0x465e14){var _0x5a3499=_[_0xa85d('0x55')](_0x465e14['model']['toLowerCase']());if(_0x5a3499===_0xa85d('0x56')){_0x5671a4=_[_0xa85d('0x57')](_0x5671a4,_0x465e14[_0xa85d('0x58')]);}else{if(_['includes'](_0x5a3499,_0xa85d('0x59')))_0x5a3499=_0x5a3499[_0xa85d('0x5a')](_0xa85d('0x59'),_0xa85d('0x5b'));_0x465e14['ids'][_0xa85d('0x4b')](function(_0x38b815){_0x5462e5[_0xa85d('0x5c')](getAgents(_0x5a3499,_0x38b815));});}});return BPromise['all'](_0x5462e5)[_0xa85d('0x25')](function(_0x252668){_0x5671a4=_['union'](_0x5671a4,_[_0xa85d('0x5d')](_0x252668));_0x2c8e43(_0x5671a4);})['catch'](function(_0x45edb3){_0x4ee7b8(_0x45edb3);});});}function getAgents(_0x384154,_0x481533){return new BPromise(function(_0x46ea60,_0xea8c89){return db[_0x384154][_0xa85d('0x51')]({'where':{'id':_0x481533}})[_0xa85d('0x25')](function(_0x2b2ad4){return _0x2b2ad4[_0xa85d('0x5e')]({'attributes':['id'],'raw':!![]})['then'](function(_0x17fbc0){var _0x33dce0=_[_0xa85d('0x5f')](_0x17fbc0,'id');_0x46ea60(_0x33dce0);});})['catch'](function(_0x124acc){_0xea8c89(_0x124acc);});});} \ No newline at end of file +var _0x115a=['Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','smsqueue','voicequeue','whatsappqueue','some','includes','model','toLowerCase','senderName','user','fullname','recipientsDescription','isEmpty','beep','recipientsId','sortBy','join','sequelize','transaction','create','recipient','emit','notification:send','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','forEach','User','union','ids','queue','replace','Queue','all','flatten','findOne','getAgents','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','./notification.socket','register','end','status','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','sendNotification','hasOwnProperty','text','body','TemplateId','ValidationError'];(function(_0x3ee5a7,_0x34bbdf){var _0x92bcdc=function(_0x1a1999){while(--_0x1a1999){_0x3ee5a7['push'](_0x3ee5a7['shift']());}};_0x92bcdc(++_0x34bbdf);}(_0x115a,0xf1));var _0xa115=function(_0x43ff99,_0x5d6a94){_0x43ff99=_0x43ff99-0x0;var _0x4bf23d=_0x115a[_0x43ff99];return _0x4bf23d;};'use strict';var pdf=require(_0xa115('0x0'));var emlformat=require(_0xa115('0x1'));var rimraf=require(_0xa115('0x2'));var zipdir=require(_0xa115('0x3'));var jsonpatch=require(_0xa115('0x4'));var rp=require(_0xa115('0x5'));var moment=require('moment');var BPromise=require(_0xa115('0x6'));var Mustache=require(_0xa115('0x7'));var util=require('util');var path=require('path');var sox=require(_0xa115('0x8'));var csv=require(_0xa115('0x9'));var ejs=require(_0xa115('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa115('0xb'));var jsforce=require(_0xa115('0xc'));var deskjs=require(_0xa115('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa115('0xe'));var Papa=require('papaparse');var Redis=require(_0xa115('0xf'));var authService=require(_0xa115('0x10'));var qs=require(_0xa115('0x11'));var as=require(_0xa115('0x12'));var hardwareService=require(_0xa115('0x13'));var logger=require(_0xa115('0x14'))(_0xa115('0x15'));var utils=require(_0xa115('0x16'));var config=require(_0xa115('0x17'));var db=require(_0xa115('0x18'))['db'];config['redis']=_[_0xa115('0x19')](config['redis'],{'host':_0xa115('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa115('0x1b'))[_0xa115('0x1c')](socket);function respondWithStatusCode(_0x57eb3f,_0x12742c){_0x12742c=_0x12742c||0xcc;return function(_0x2d920e){if(_0x2d920e){return _0x57eb3f['sendStatus'](_0x12742c);}return _0x57eb3f['status'](_0x12742c)[_0xa115('0x1d')]();};}function respondWithResult(_0x1c7f4a,_0x4c7ed0){_0x4c7ed0=_0x4c7ed0||0xc8;return function(_0x12c5e1){if(_0x12c5e1){return _0x1c7f4a[_0xa115('0x1e')](_0x4c7ed0)['json'](_0x12c5e1);}};}function respondWithFilteredResult(_0x12f18d,_0x3a1c6f){return function(_0x345b3f){if(_0x345b3f){var _0xadf48d=_0x345b3f[_0xa115('0x1f')],_0x214a77=_0x3a1c6f[_0xa115('0x20')],_0x4d7cb9=_0x3a1c6f[_0xa115('0x20')]+_0x3a1c6f[_0xa115('0x21')],_0x26bd8d;if(_0x4d7cb9>=_0xadf48d){_0x4d7cb9=_0xadf48d;_0x26bd8d=0xc8;}else{_0x26bd8d=0xce;}_0x12f18d[_0xa115('0x1e')](_0x26bd8d);return _0x12f18d[_0xa115('0x22')](_0xa115('0x23'),_0x214a77+'-'+_0x4d7cb9+'/'+_0xadf48d)['json'](_0x345b3f);}return null;};}function patchUpdates(_0x1f57dd){return function(_0x2aefb6){try{jsonpatch[_0xa115('0x24')](_0x2aefb6,_0x1f57dd,!![]);}catch(_0x2f732c){return BPromise[_0xa115('0x25')](_0x2f732c);}return _0x2aefb6[_0xa115('0x26')]();};}function saveUpdates(_0x5d715d,_0xa2f49b){return function(_0x300aff){if(_0x300aff){return _0x300aff['update'](_0x5d715d)[_0xa115('0x27')](function(_0x2fa891){return _0x2fa891;});}return null;};}function removeEntity(_0x3ca4e4,_0x1be07e){return function(_0xf3e767){if(_0xf3e767){return _0xf3e767['destroy']()[_0xa115('0x27')](function(){_0x3ca4e4[_0xa115('0x1e')](0xcc)[_0xa115('0x1d')]();});}};}function handleEntityNotFound(_0x6dde64,_0x474b22){return function(_0x1a7c55){if(!_0x1a7c55){_0x6dde64['sendStatus'](0x194);}return _0x1a7c55;};}function handleError(_0x5e2604,_0x2033f3){_0x2033f3=_0x2033f3||0x1f4;return function(_0x2fa7f9){logger[_0xa115('0x28')](_0x2fa7f9[_0xa115('0x29')]);if(_0x2fa7f9[_0xa115('0x2a')]){delete _0x2fa7f9[_0xa115('0x2a')];}_0x5e2604['status'](_0x2033f3)[_0xa115('0x2b')](_0x2fa7f9);};}exports[_0xa115('0x2c')]=function(_0x1579ab,_0x3c5a2e,_0x3d4403){if(!_0x1579ab['body'][_0xa115('0x2d')](_0xa115('0x2e'))&&!_0x1579ab[_0xa115('0x2f')][_0xa115('0x2d')](_0xa115('0x30'))){throw new db['Sequelize'][(_0xa115('0x31'))](_0xa115('0x32'));}else{if(_0x1579ab[_0xa115('0x2f')][_0xa115('0x2d')](_0xa115('0x30'))&&!_0x1579ab[_0xa115('0x2f')][_0xa115('0x2d')]('view')){throw new db[(_0xa115('0x33'))][(_0xa115('0x31'))](_0xa115('0x34'));}if(!_0x1579ab[_0xa115('0x2f')]['hasOwnProperty'](_0xa115('0x35'))){throw new db[(_0xa115('0x33'))][(_0xa115('0x31'))](_0xa115('0x36'));}else{try{var _0x15fa42=JSON[_0xa115('0x37')](_0x1579ab[_0xa115('0x2f')][_0xa115('0x35')]);}catch(_0x5be546){logger[_0xa115('0x28')](_0x5be546);throw new db[(_0xa115('0x33'))][(_0xa115('0x31'))](_0xa115('0x38'));}var _0x11089b=[_0xa115('0x39'),_0xa115('0x3a'),'mailqueue','openchannelqueue',_0xa115('0x3b'),_0xa115('0x3c'),_0xa115('0x3d'),'team','user'];if(_[_0xa115('0x3e')](_0x15fa42,function(_0x1ebc36){return!_[_0xa115('0x3f')](_0x11089b,_0x1ebc36[_0xa115('0x40')][_0xa115('0x41')]());})){throw new db[(_0xa115('0x33'))][(_0xa115('0x31'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x29a488={};_0x29a488['senderName']=_0x1579ab[_0xa115('0x2f')][_0xa115('0x2d')](_0xa115('0x42'))?_0x1579ab[_0xa115('0x2f')]['senderName']:_0x1579ab[_0xa115('0x43')][_0xa115('0x44')];_0x29a488[_0xa115('0x45')]=_[_0xa115('0x46')](_0x1579ab[_0xa115('0x2f')][_0xa115('0x45')])?null:_0x1579ab[_0xa115('0x2f')][_0xa115('0x45')];_0x29a488['beep']=_0x1579ab['body'][_0xa115('0x47')]||![];_0x29a488['SenderId']=_0x1579ab['user']['id'];return getContent(_0x1579ab['body'])[_0xa115('0x27')](function(_0x1ec4d9){_0x29a488[_0xa115('0x2f')]=_0x1ec4d9;return getRecipients(_0x15fa42);})['then'](function(_0x1a0523){_0x29a488[_0xa115('0x48')]=_[_0xa115('0x49')](_0x1a0523)[_0xa115('0x4a')](',');return db[_0xa115('0x4b')][_0xa115('0x4c')](function(_0x5dc87e){return db['Notification'][_0xa115('0x4d')](_0x29a488,{'raw':!![],'transaction':_0x5dc87e})[_0xa115('0x27')](function(_0x3ed42d){var _0x230edc={'sender':_0x29a488[_0xa115('0x42')],'description':_0x29a488['recipientsDescription'],'content':_0x29a488['body'],'beep':_0x29a488[_0xa115('0x47')]};_0x1a0523['forEach'](function(_0x3fad62){_0x230edc[_0xa115('0x4e')]=_0x3fad62;socket[_0xa115('0x4f')](_0xa115('0x50'),_0x230edc);});return _0x3ed42d;});});})[_0xa115('0x27')](respondWithResult(_0x3c5a2e,0xc9))['catch'](handleError(_0x3c5a2e,null));};function getContent(_0x498636){return new BPromise(function(_0xdd8e2e,_0x48c67a){if(_0x498636[_0xa115('0x2e')]){_0xdd8e2e(_0x498636['text']);return;}return db['Template']['findOne']({'attributes':[_0xa115('0x51')],'where':{'id':_0x498636['TemplateId']},'raw':!![]})[_0xa115('0x27')](function(_0x199169){if(!_0x199169)throw new db['Sequelize']['ValidationError'](_0xa115('0x52'));var _0x1dd765=Mustache[_0xa115('0x53')](_0x199169[_0xa115('0x51')],_0x498636['view']);_0xdd8e2e(_0x1dd765);})[_0xa115('0x54')](function(_0x44ec35){_0x48c67a(_0x44ec35);});});}function getRecipients(_0x2d8d04){return new BPromise(function(_0xef21ca,_0x15c509){var _0x5f057c=[];var _0x3261f6=[];_0x2d8d04[_0xa115('0x55')](function(_0x47d74d){var _0x186c76=_['startCase'](_0x47d74d[_0xa115('0x40')][_0xa115('0x41')]());if(_0x186c76===_0xa115('0x56')){_0x5f057c=_[_0xa115('0x57')](_0x5f057c,_0x47d74d[_0xa115('0x58')]);}else{if(_['includes'](_0x186c76,_0xa115('0x59')))_0x186c76=_0x186c76[_0xa115('0x5a')](_0xa115('0x59'),_0xa115('0x5b'));_0x47d74d[_0xa115('0x58')][_0xa115('0x55')](function(_0x2ea0ac){_0x3261f6['push'](getAgents(_0x186c76,_0x2ea0ac));});}});return BPromise[_0xa115('0x5c')](_0x3261f6)['then'](function(_0x3a5e04){_0x5f057c=_[_0xa115('0x57')](_0x5f057c,_[_0xa115('0x5d')](_0x3a5e04));_0xef21ca(_0x5f057c);})[_0xa115('0x54')](function(_0x4256a8){_0x15c509(_0x4256a8);});});}function getAgents(_0x219537,_0x1da820){return new BPromise(function(_0x54c71e,_0x910c6){return db[_0x219537][_0xa115('0x5e')]({'where':{'id':_0x1da820}})['then'](function(_0x1440c3){return _0x1440c3[_0xa115('0x5f')]({'attributes':['id'],'raw':!![]})[_0xa115('0x27')](function(_0x32b13e){var _0x18a7fb=_[_0xa115('0x60')](_0x32b13e,'id');_0x54c71e(_0x18a7fb);});})[_0xa115('0x54')](function(_0xb4bc17){_0x910c6(_0xb4bc17);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index ae1280c..c26f651 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 _0xdb28=['Notification','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x567ac1,_0x11e696){var _0x120bf2=function(_0x17110e){while(--_0x17110e){_0x567ac1['push'](_0x567ac1['shift']());}};_0x120bf2(++_0x11e696);}(_0xdb28,0x106));var _0x8db2=function(_0x4cf4ce,_0x30367a){_0x4cf4ce=_0x4cf4ce-0x0;var _0x5f2482=_0xdb28[_0x4cf4ce];return _0x5f2482;};'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 +var _0xdb28=['Notification','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x59d3ed,_0x444850){var _0x232c12=function(_0x6c6fba){while(--_0x6c6fba){_0x59d3ed['push'](_0x59d3ed['shift']());}};_0x232c12(++_0x444850);}(_0xdb28,0x106));var _0x8db2=function(_0xe5dd94,_0x2b6e6b){_0xe5dd94=_0xe5dd94-0x0;var _0x2a8773=_0xdb28[_0xe5dd94];return _0x2a8773;};'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 a1c5e65..8181daa 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 _0xed3c=['exports','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','path','./notification.attributes'];(function(_0x290c1f,_0xd2de73){var _0x37d4c0=function(_0x733878){while(--_0x733878){_0x290c1f['push'](_0x290c1f['shift']());}};_0x37d4c0(++_0xd2de73);}(_0xed3c,0x1a6));var _0xced3=function(_0x1b903c,_0x3e369c){_0x1b903c=_0x1b903c-0x0;var _0x41b5ed=_0xed3c[_0x1b903c];return _0x41b5ed;};'use strict';var _=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var logger=require(_0xced3('0x2'))(_0xced3('0x3'));var moment=require('moment');var BPromise=require(_0xced3('0x4'));var rp=require(_0xced3('0x5'));var fs=require('fs');var path=require(_0xced3('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xced3('0x7'));module[_0xced3('0x8')]=function(_0x2f92f8,_0x1cd694){return _0x2f92f8['define']('Notification',attributes,{'tableName':'notifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xced3('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4024=['define','notifications','lodash','util','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x4d7b76,_0xfebbdd){var _0x462144=function(_0x2ee119){while(--_0x2ee119){_0x4d7b76['push'](_0x4d7b76['shift']());}};_0x462144(++_0xfebbdd);}(_0x4024,0x89));var _0x4402=function(_0x177e5f,_0x4918dd){_0x177e5f=_0x177e5f-0x0;var _0x1c1365=_0x4024[_0x177e5f];return _0x1c1365;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var logger=require('../../config/logger')(_0x4402('0x2'));var moment=require(_0x4402('0x3'));var BPromise=require('bluebird');var rp=require(_0x4402('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var attributes=require('./notification.attributes');module['exports']=function(_0x17699b,_0x346ddc){return _0x17699b[_0x4402('0x7')]('Notification',attributes,{'tableName':_0x4402('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 5b512be..9e97225 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 _0x7420=['moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost','./notification.socket','request','info','Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util'];(function(_0x26e1e7,_0x128d99){var _0x50272e=function(_0x100476){while(--_0x100476){_0x26e1e7['push'](_0x26e1e7['shift']());}};_0x50272e(++_0x128d99);}(_0x7420,0x129));var _0x0742=function(_0x40d503,_0x1eda2){_0x40d503=_0x40d503-0x0;var _0x3abaab=_0x7420[_0x40d503];return _0x3abaab;};'use strict';var _=require(_0x0742('0x0'));var util=require(_0x0742('0x1'));var moment=require(_0x0742('0x2'));var BPromise=require('bluebird');var rs=require(_0x0742('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0742('0x4'))['db'];var utils=require(_0x0742('0x5'));var logger=require('../../config/logger')(_0x0742('0x6'));var config=require('../../config/environment');var jayson=require(_0x0742('0x7'));var client=jayson['client'][_0x0742('0x8')]({'port':0x232a});config[_0x0742('0x9')]=_[_0x0742('0xa')](config[_0x0742('0x9')],{'host':_0x0742('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0742('0x9')]));require(_0x0742('0xc'))['register'](socket);function respondWithRpcPromise(_0x2b3702,_0x2416a1,_0x347a49){return new BPromise(function(_0x4ce414,_0x2b022d){return client[_0x0742('0xd')](_0x2b3702,_0x347a49)['then'](function(_0xd40dd0){logger[_0x0742('0xe')](_0x0742('0xf'),_0x2416a1,_0x0742('0x10'));logger[_0x0742('0x11')](_0x0742('0x12'),_0x2416a1,_0x0742('0x10'),JSON['stringify'](_0xd40dd0));if(_0xd40dd0['error']){if(_0xd40dd0[_0x0742('0x13')]['code']===0x1f4){logger['error'](_0x0742('0xf'),_0x2416a1,_0xd40dd0['error'][_0x0742('0x14')]);return _0x2b022d(_0xd40dd0[_0x0742('0x13')][_0x0742('0x14')]);}logger[_0x0742('0x13')](_0x0742('0xf'),_0x2416a1,_0xd40dd0[_0x0742('0x13')]['message']);return _0x4ce414(_0xd40dd0[_0x0742('0x13')][_0x0742('0x14')]);}else{logger[_0x0742('0xe')]('Notification,\x20%s,\x20%s',_0x2416a1,_0x0742('0x10'));_0x4ce414(_0xd40dd0[_0x0742('0x15')][_0x0742('0x14')]);}})[_0x0742('0x16')](function(_0x1a313a){logger[_0x0742('0x13')](_0x0742('0xf'),_0x2416a1,_0x1a313a);_0x2b022d(_0x1a313a);});});} \ No newline at end of file +var _0x0135=['then','Notification,\x20%s,\x20%s','debug','Notification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./notification.socket','register','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0135,0xb4));var _0x5013=function(_0x14a75b,_0x2dab7a){_0x14a75b=_0x14a75b-0x0;var _0x826f3b=_0x0135[_0x14a75b];return _0x826f3b;};'use strict';var _=require('lodash');var util=require(_0x5013('0x0'));var moment=require(_0x5013('0x1'));var BPromise=require(_0x5013('0x2'));var rs=require(_0x5013('0x3'));var fs=require('fs');var Redis=require(_0x5013('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5013('0x5'));var logger=require(_0x5013('0x6'))(_0x5013('0x7'));var config=require('../../config/environment');var jayson=require(_0x5013('0x8'));var client=jayson[_0x5013('0x9')][_0x5013('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5013('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x5013('0xc'))(new Redis(config[_0x5013('0xb')]));require(_0x5013('0xd'))[_0x5013('0xe')](socket);function respondWithRpcPromise(_0x2a299e,_0x4694fd,_0x5441a4){return new BPromise(function(_0x54fb61,_0x29df6c){return client[_0x5013('0xf')](_0x2a299e,_0x5441a4)[_0x5013('0x10')](function(_0x1f69e4){logger['info'](_0x5013('0x11'),_0x4694fd,'request\x20sent');logger[_0x5013('0x12')](_0x5013('0x13'),_0x4694fd,_0x5013('0x14'),JSON[_0x5013('0x15')](_0x1f69e4));if(_0x1f69e4[_0x5013('0x16')]){if(_0x1f69e4[_0x5013('0x16')][_0x5013('0x17')]===0x1f4){logger[_0x5013('0x16')](_0x5013('0x11'),_0x4694fd,_0x1f69e4[_0x5013('0x16')][_0x5013('0x18')]);return _0x29df6c(_0x1f69e4[_0x5013('0x16')]['message']);}logger['error'](_0x5013('0x11'),_0x4694fd,_0x1f69e4['error'][_0x5013('0x18')]);return _0x54fb61(_0x1f69e4[_0x5013('0x16')][_0x5013('0x18')]);}else{logger[_0x5013('0x19')](_0x5013('0x11'),_0x4694fd,_0x5013('0x14'));_0x54fb61(_0x1f69e4[_0x5013('0x1a')]['message']);}})[_0x5013('0x1b')](function(_0x65189){logger[_0x5013('0x16')](_0x5013('0x11'),_0x4694fd,_0x65189);_0x29df6c(_0x65189);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 619d9c7..7288e63 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 _0x27c0=['remove','update','emit','removeListener','register','length'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x27c0,0x1a4));var _0x027c=function(_0x2c367d,_0x16fdf3){_0x2c367d=_0x2c367d-0x0;var _0x34d53c=_0x27c0[_0x2c367d];return _0x34d53c;};'use strict';var NotificationEvents=require('./notification.events');var events=['save',_0x027c('0x0'),_0x027c('0x1')];function createListener(_0x448ffe,_0x4b21dd){return function(_0x1a16fb){_0x4b21dd[_0x027c('0x2')](_0x448ffe,_0x1a16fb);};}function removeListener(_0x20a85d,_0x267977){return function(){NotificationEvents[_0x027c('0x3')](_0x20a85d,_0x267977);};}exports[_0x027c('0x4')]=function(_0x37c76c){for(var _0x315a43=0x0,_0xa7a385=events[_0x027c('0x5')];_0x315a43<_0xa7a385;_0x315a43++){var _0x49616a=events[_0x315a43];var _0xbe15fb=createListener('notification:'+_0x49616a,_0x37c76c);NotificationEvents['on'](_0x49616a,_0xbe15fb);}}; \ No newline at end of file +var _0x7e7b=['register','notification:','./notification.events','save','remove','emit','removeListener'];(function(_0x3aed54,_0x2ee3ec){var _0x3fedf3=function(_0x4c8bd9){while(--_0x4c8bd9){_0x3aed54['push'](_0x3aed54['shift']());}};_0x3fedf3(++_0x2ee3ec);}(_0x7e7b,0x1de));var _0xb7e7=function(_0x20aad7,_0x3f6efe){_0x20aad7=_0x20aad7-0x0;var _0x597769=_0x7e7b[_0x20aad7];return _0x597769;};'use strict';var NotificationEvents=require(_0xb7e7('0x0'));var events=[_0xb7e7('0x1'),_0xb7e7('0x2'),'update'];function createListener(_0x1253ac,_0xa9e71f){return function(_0x40b38a){_0xa9e71f[_0xb7e7('0x3')](_0x1253ac,_0x40b38a);};}function removeListener(_0x5c1391,_0x4fbcb2){return function(){NotificationEvents[_0xb7e7('0x4')](_0x5c1391,_0x4fbcb2);};}exports[_0xb7e7('0x5')]=function(_0x4e7f63){for(var _0x477bf1=0x0,_0x4904f5=events['length'];_0x477bf1<_0x4904f5;_0x477bf1++){var _0x253598=events[_0x477bf1];var _0x507723=createListener(_0xb7e7('0x6')+_0x253598,_0x4e7f63);NotificationEvents['on'](_0x253598,_0x507723);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 2887862..89ac044 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 _0x7ac3=['/:id/applications','/:id/users','/:id/send','send','update','delete','destroy','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getApplications','getInteractions','post','create','addDisposition','addAnswer','/:id/notify','notify'];(function(_0x402094,_0x33a6e6){var _0x2f2d3c=function(_0x497c72){while(--_0x497c72){_0x402094['push'](_0x402094['shift']());}};_0x2f2d3c(++_0x33a6e6);}(_0x7ac3,0x195));var _0x37ac=function(_0x3f0f95,_0x498023){_0x3f0f95=_0x3f0f95-0x0;var _0x17693e=_0x7ac3[_0x3f0f95];return _0x17693e;};'use strict';var multer=require(_0x37ac('0x0'));var util=require(_0x37ac('0x1'));var path=require(_0x37ac('0x2'));var timeout=require(_0x37ac('0x3'));var express=require(_0x37ac('0x4'));var router=express[_0x37ac('0x5')]();var auth=require(_0x37ac('0x6'));var interaction=require(_0x37ac('0x7'));var config=require('../../config/environment');var controller=require(_0x37ac('0x8'));router[_0x37ac('0x9')]('/',auth['isAuthenticated'](),controller[_0x37ac('0xa')]);router[_0x37ac('0x9')](_0x37ac('0xb'),auth[_0x37ac('0xc')](),controller[_0x37ac('0xd')]);router[_0x37ac('0x9')](_0x37ac('0xe'),auth[_0x37ac('0xc')](),controller[_0x37ac('0xf')]);router[_0x37ac('0x9')](_0x37ac('0x10'),auth[_0x37ac('0xc')](),controller[_0x37ac('0x11')]);router[_0x37ac('0x9')](_0x37ac('0x12'),auth[_0x37ac('0xc')](),controller['getAnswers']);router[_0x37ac('0x9')]('/:id/applications',auth[_0x37ac('0xc')](),controller[_0x37ac('0x13')]);router[_0x37ac('0x9')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x37ac('0x14')]);router[_0x37ac('0x9')]('/:id/users',auth[_0x37ac('0xc')](),controller['getAgents']);router[_0x37ac('0x15')]('/',auth['isAuthenticated'](),controller[_0x37ac('0x16')]);router[_0x37ac('0x15')](_0x37ac('0x10'),auth['isAuthenticated'](),controller[_0x37ac('0x17')]);router['post']('/:id/canned_answers',auth[_0x37ac('0xc')](),controller[_0x37ac('0x18')]);router['post'](_0x37ac('0x19'),controller[_0x37ac('0x1a')]);router[_0x37ac('0x15')](_0x37ac('0x1b'),auth[_0x37ac('0xc')](),controller['addApplications']);router[_0x37ac('0x15')](_0x37ac('0x1c'),auth[_0x37ac('0xc')](),controller['addAgents']);router[_0x37ac('0x15')](_0x37ac('0x1d'),auth['isAuthenticated'](),controller[_0x37ac('0x1e')]);router['put']('/:id',auth[_0x37ac('0xc')](),controller[_0x37ac('0x1f')]);router[_0x37ac('0x20')](_0x37ac('0xe'),auth[_0x37ac('0xc')](),controller[_0x37ac('0x21')]);router[_0x37ac('0x20')]('/:id/dispositions',auth[_0x37ac('0xc')](),controller[_0x37ac('0x22')]);router[_0x37ac('0x20')](_0x37ac('0x12'),auth[_0x37ac('0xc')](),controller['removeAnswers']);router[_0x37ac('0x20')](_0x37ac('0x1c'),auth[_0x37ac('0xc')](),controller['removeAgents']);module[_0x37ac('0x23')]=router; \ No newline at end of file +var _0xf476=['/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','put','update','destroy','delete','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions'];(function(_0x373b0b,_0x7e94e1){var _0x20e6d9=function(_0x48953c){while(--_0x48953c){_0x373b0b['push'](_0x373b0b['shift']());}};_0x20e6d9(++_0x7e94e1);}(_0xf476,0x19e));var _0x6f47=function(_0xa26d47,_0x456f4a){_0xa26d47=_0xa26d47-0x0;var _0x1c31d6=_0xf476[_0xa26d47];return _0x1c31d6;};'use strict';var multer=require(_0x6f47('0x0'));var util=require(_0x6f47('0x1'));var path=require(_0x6f47('0x2'));var timeout=require(_0x6f47('0x3'));var express=require('express');var router=express[_0x6f47('0x4')]();var auth=require(_0x6f47('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router[_0x6f47('0x6')]('/',auth[_0x6f47('0x7')](),controller[_0x6f47('0x8')]);router[_0x6f47('0x6')](_0x6f47('0x9'),auth[_0x6f47('0x7')](),controller[_0x6f47('0xa')]);router[_0x6f47('0x6')](_0x6f47('0xb'),auth[_0x6f47('0x7')](),controller[_0x6f47('0xc')]);router[_0x6f47('0x6')](_0x6f47('0xd'),auth['isAuthenticated'](),controller[_0x6f47('0xe')]);router[_0x6f47('0x6')](_0x6f47('0xf'),auth['isAuthenticated'](),controller[_0x6f47('0x10')]);router[_0x6f47('0x6')](_0x6f47('0x11'),auth[_0x6f47('0x7')](),controller[_0x6f47('0x12')]);router[_0x6f47('0x6')](_0x6f47('0x13'),auth[_0x6f47('0x7')](),controller[_0x6f47('0x14')]);router[_0x6f47('0x6')](_0x6f47('0x15'),auth[_0x6f47('0x7')](),controller[_0x6f47('0x16')]);router[_0x6f47('0x17')]('/',auth[_0x6f47('0x7')](),controller[_0x6f47('0x18')]);router[_0x6f47('0x17')]('/:id/dispositions',auth[_0x6f47('0x7')](),controller[_0x6f47('0x19')]);router[_0x6f47('0x17')](_0x6f47('0xf'),auth[_0x6f47('0x7')](),controller[_0x6f47('0x1a')]);router[_0x6f47('0x17')](_0x6f47('0x1b'),controller[_0x6f47('0x1c')]);router[_0x6f47('0x17')](_0x6f47('0x11'),auth[_0x6f47('0x7')](),controller[_0x6f47('0x1d')]);router[_0x6f47('0x17')](_0x6f47('0x15'),auth[_0x6f47('0x7')](),controller[_0x6f47('0x1e')]);router['post'](_0x6f47('0x1f'),auth[_0x6f47('0x7')](),controller['send']);router[_0x6f47('0x20')](_0x6f47('0xb'),auth[_0x6f47('0x7')](),controller[_0x6f47('0x21')]);router['delete'](_0x6f47('0xb'),auth['isAuthenticated'](),controller[_0x6f47('0x22')]);router[_0x6f47('0x23')]('/:id/dispositions',auth[_0x6f47('0x7')](),controller[_0x6f47('0x24')]);router[_0x6f47('0x23')](_0x6f47('0xf'),auth[_0x6f47('0x7')](),controller['removeAnswers']);router[_0x6f47('0x23')](_0x6f47('0x15'),auth[_0x6f47('0x7')](),controller[_0x6f47('0x25')]);module[_0x6f47('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 2b68794..1551b1c 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 _0x1b21=['STRING','name','generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','randomstring'];(function(_0x36bff5,_0x3156cb){var _0x80ade5=function(_0x5eee65){while(--_0x5eee65){_0x36bff5['push'](_0x36bff5['shift']());}};_0x80ade5(++_0x3156cb);}(_0x1b21,0x149));var _0x11b2=function(_0x24ce1a,_0x1b851c){_0x24ce1a=_0x24ce1a-0x0;var _0x15938e=_0x1b21[_0x24ce1a];return _0x15938e;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x11b2('0x0'));module['exports']={'name':{'type':Sequelize[_0x11b2('0x1')],'unique':_0x11b2('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x11b2('0x3')]();}},'replyUri':{'type':Sequelize[_0x11b2('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x11b2('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x11b2('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x11b2('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x11b2('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x11b2('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x11b2('0x1')]},'queueTransfer':{'type':Sequelize[_0x11b2('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x11b2('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x11b2('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x11b2('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x11b2('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x11b2('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x11b2('0x5')],'defaultValue':![],'comment':_0x11b2('0x8'),'set':function(_0x4de18e){if(!_0x4de18e)this[_0x11b2('0x9')](_0x11b2('0xa'),null);this['setDataValue']('mandatoryDisposition',_0x4de18e);}}}; \ No newline at end of file +var _0x385b=['setDataValue','mandatoryDisposition','randomstring','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x284ab5,_0x362d98){var _0x1f780c=function(_0x4bef0d){while(--_0x4bef0d){_0x284ab5['push'](_0x284ab5['shift']());}};_0x1f780c(++_0x362d98);}(_0x385b,0xff));var _0xb385=function(_0x2a260c,_0x39a569){_0x2a260c=_0x2a260c-0x0;var _0x4455eb=_0x385b[_0x2a260c];return _0x4455eb;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xb385('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xb385('0x1')]},'token':{'type':Sequelize[_0xb385('0x1')],'defaultValue':function(){return rs[_0xb385('0x2')]();}},'replyUri':{'type':Sequelize[_0xb385('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xb385('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb385('0x3')],'defaultValue':function(){return _0xb385('0x4');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb385('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xb385('0x1')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb385('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xb385('0x6')},'mandatoryDisposition':{'type':Sequelize[_0xb385('0x7')],'defaultValue':![],'comment':_0xb385('0x8'),'set':function(_0x459444){if(!_0x459444)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xb385('0x9')](_0xb385('0xa'),_0x459444);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index d93a1d0..e1a63f4 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 _0x3f66=['offset','limit','set','apply','reject','update','destroy','get','OpenchannelAccounts','UserProfileResource','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','OpenchannelAccount','count','includeAll','include','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','OpenchannelAccountId','removeDispositions','ids','CannedAnswer','getAnswers','findOne','findAll','notify','openchannel','no\x20available\x20attributes','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','OpenchannelApplication','applications','Applications','list','orderBy','priority','asc','account','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','User','UserId','unshift','agent','forcedOwnership','Start','startRouting','EventManager','bulkCreate','findAndCountAll','getApplications','getInteractions','Owner','fullname','internal','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','send','out','dataValues','Messages','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','jayson/promise','client','http','test','Sequelize','ValidationError','then','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','info','catch','status','end','json'];(function(_0x4f795a,_0x5e2571){var _0x3e447b=function(_0x43657a){while(--_0x43657a){_0x4f795a['push'](_0x4f795a['shift']());}};_0x3e447b(++_0x5e2571);}(_0x3f66,0x8b));var _0x63f6=function(_0x4401d2,_0x4fd983){_0x4401d2=_0x4401d2-0x0;var _0x27026b=_0x3f66[_0x4401d2];return _0x27026b;};'use strict';var pdf=require(_0x63f6('0x0'));var emlformat=require(_0x63f6('0x1'));var rimraf=require(_0x63f6('0x2'));var zipdir=require(_0x63f6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x63f6('0x4'));var moment=require(_0x63f6('0x5'));var BPromise=require(_0x63f6('0x6'));var Mustache=require(_0x63f6('0x7'));var util=require(_0x63f6('0x8'));var path=require(_0x63f6('0x9'));var sox=require('sox');var csv=require(_0x63f6('0xa'));var ejs=require(_0x63f6('0xb'));var fs=require('fs');var _=require(_0x63f6('0xc'));var squel=require(_0x63f6('0xd'));var crypto=require('crypto');var jsforce=require(_0x63f6('0xe'));var deskjs=require(_0x63f6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x63f6('0x10'));var Papa=require('papaparse');var Redis=require(_0x63f6('0x11'));var authService=require(_0x63f6('0x12'));var qs=require(_0x63f6('0x13'));var as=require(_0x63f6('0x14'));var hardwareService=require(_0x63f6('0x15'));var logger=require('../../config/logger')(_0x63f6('0x16'));var utils=require(_0x63f6('0x17'));var config=require(_0x63f6('0x18'));var db=require(_0x63f6('0x19'))['db'];config[_0x63f6('0x1a')]=_[_0x63f6('0x1b')](config[_0x63f6('0x1a')],{'host':_0x63f6('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x63f6('0x1d'))['register'](socket);var jayson=require(_0x63f6('0x1e'));var client=jayson[_0x63f6('0x1f')][_0x63f6('0x20')]({'port':0x232c});var client9002=jayson[_0x63f6('0x1f')]['http']({'port':0x232a});function checkPasswordPattern(_0x164cb2,_0x2e863e,_0x151632){if(_0x151632){var _0x118f94=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x118f94[_0x63f6('0x21')](_0x2e863e)){return _0x164cb2;}else{throw new db[(_0x63f6('0x22'))][(_0x63f6('0x23'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x164cb2;}}function respondWithRpcPromise(_0x395108,_0x2b78c8,_0x1c69ad,_0x187a0c){return new BPromise(function(_0x3aec5b,_0x3189e0){var _0x19e1d9=_0x187a0c||client;return _0x19e1d9['request'](_0x395108,_0x1c69ad)[_0x63f6('0x24')](function(_0x730e9d){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x2b78c8,_0x63f6('0x25'));logger['debug'](_0x63f6('0x26'),_0x2b78c8,_0x63f6('0x25'),JSON[_0x63f6('0x27')](_0x730e9d));if(_0x730e9d['error']){if(_0x730e9d[_0x63f6('0x28')][_0x63f6('0x29')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x2b78c8,_0x730e9d[_0x63f6('0x28')]['message']);return _0x3189e0(_0x730e9d[_0x63f6('0x28')][_0x63f6('0x2a')]);}logger['error'](_0x63f6('0x2b'),_0x2b78c8,_0x730e9d[_0x63f6('0x28')][_0x63f6('0x2a')]);return _0x3aec5b(_0x730e9d[_0x63f6('0x28')][_0x63f6('0x2a')]);}else{logger[_0x63f6('0x2c')](_0x63f6('0x2b'),_0x2b78c8,_0x63f6('0x25'));_0x3aec5b(_0x730e9d['result']['message']);}})[_0x63f6('0x2d')](function(_0x298352){logger[_0x63f6('0x28')](_0x63f6('0x2b'),_0x2b78c8,_0x298352);_0x3189e0(_0x298352);});});}function respondWithStatusCode(_0xd24642,_0x486c1f){_0x486c1f=_0x486c1f||0xcc;return function(_0x15c158){if(_0x15c158){return _0xd24642['sendStatus'](_0x486c1f);}return _0xd24642[_0x63f6('0x2e')](_0x486c1f)[_0x63f6('0x2f')]();};}function respondWithResult(_0x199198,_0x198b30){_0x198b30=_0x198b30||0xc8;return function(_0x17d138){if(_0x17d138){return _0x199198[_0x63f6('0x2e')](_0x198b30)[_0x63f6('0x30')](_0x17d138);}};}function respondWithFilteredResult(_0x47b679,_0x394cd1){return function(_0x39933b){if(_0x39933b){var _0x35e06c=_0x39933b['count'],_0x129b2a=_0x394cd1[_0x63f6('0x31')],_0x514541=_0x394cd1[_0x63f6('0x31')]+_0x394cd1[_0x63f6('0x32')],_0x11e049;if(_0x514541>=_0x35e06c){_0x514541=_0x35e06c;_0x11e049=0xc8;}else{_0x11e049=0xce;}_0x47b679[_0x63f6('0x2e')](_0x11e049);return _0x47b679[_0x63f6('0x33')]('Content-Range',_0x129b2a+'-'+_0x514541+'/'+_0x35e06c)[_0x63f6('0x30')](_0x39933b);}return null;};}function patchUpdates(_0x32574b){return function(_0x2a6823){try{jsonpatch[_0x63f6('0x34')](_0x2a6823,_0x32574b,!![]);}catch(_0x311cfc){return BPromise[_0x63f6('0x35')](_0x311cfc);}return _0x2a6823['save']();};}function saveUpdates(_0x56ed24,_0x23f09e){return function(_0x277388){if(_0x277388){return _0x277388[_0x63f6('0x36')](_0x56ed24)[_0x63f6('0x24')](function(_0x417262){return _0x417262;});}return null;};}function removeEntity(_0x259bbe,_0x5b4c8e){return function(_0x36107d){if(_0x36107d){return _0x36107d[_0x63f6('0x37')]()['then'](function(){var _0x3fc4b9=_0x36107d[_0x63f6('0x38')]({'plain':!![]});var _0x28a892=_0x63f6('0x39');return db[_0x63f6('0x3a')]['destroy']({'where':{'type':_0x28a892,'resourceId':_0x3fc4b9['id']}})['then'](function(){return _0x36107d;});})[_0x63f6('0x24')](function(){_0x259bbe[_0x63f6('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x483519,_0xa79632){return function(_0x1e43fc){if(!_0x1e43fc){_0x483519[_0x63f6('0x3b')](0x194);}return _0x1e43fc;};}function handleError(_0x51e857,_0x5211d2){_0x5211d2=_0x5211d2||0x1f4;return function(_0xb00d3c){logger[_0x63f6('0x28')](_0xb00d3c[_0x63f6('0x3c')]);if(_0xb00d3c[_0x63f6('0x3d')]){delete _0xb00d3c[_0x63f6('0x3d')];}_0x51e857[_0x63f6('0x2e')](_0x5211d2)['send'](_0xb00d3c);};}exports[_0x63f6('0x3e')]=function(_0xce95e2,_0x491f2c){var _0x3a5e7a={'include':[{'model':db[_0x63f6('0x3f')],'as':_0x63f6('0x40')}]},_0xc42c0d={},_0x36a41d={'count':0x0,'rows':[]};var _0x34e82a=_[_0x63f6('0x41')](db['OpenchannelAccount'][_0x63f6('0x42')],function(_0x5c7f33){return{'name':_0x5c7f33[_0x63f6('0x43')],'type':_0x5c7f33[_0x63f6('0x44')][_0x63f6('0x45')]};});_0xc42c0d[_0x63f6('0x46')]=_[_0x63f6('0x41')](_0x34e82a,_0x63f6('0x3d'));_0xc42c0d['query']=_[_0x63f6('0x47')](_0xce95e2[_0x63f6('0x48')]);_0xc42c0d[_0x63f6('0x49')]=_['intersection'](_0xc42c0d[_0x63f6('0x46')],_0xc42c0d['query']);_0x3a5e7a['attributes']=_[_0x63f6('0x4a')](_0xc42c0d[_0x63f6('0x46')],qs[_0x63f6('0x4b')](_0xce95e2['query'][_0x63f6('0x4b')]));_0x3a5e7a['attributes']=_0x3a5e7a[_0x63f6('0x4c')][_0x63f6('0x4d')]?_0x3a5e7a[_0x63f6('0x4c')]:_0xc42c0d[_0x63f6('0x46')];if(!_0xce95e2[_0x63f6('0x48')][_0x63f6('0x4e')](_0x63f6('0x4f'))){_0x3a5e7a['limit']=qs['limit'](_0xce95e2[_0x63f6('0x48')][_0x63f6('0x32')]);_0x3a5e7a['offset']=qs['offset'](_0xce95e2[_0x63f6('0x48')][_0x63f6('0x31')]);}_0x3a5e7a[_0x63f6('0x50')]=qs[_0x63f6('0x51')](_0xce95e2[_0x63f6('0x48')][_0x63f6('0x51')]);_0x3a5e7a['where']=qs['filters'](_[_0x63f6('0x52')](_0xce95e2[_0x63f6('0x48')],_0xc42c0d[_0x63f6('0x49')]),_0x34e82a);if(_0xce95e2[_0x63f6('0x48')][_0x63f6('0x53')]){_0x3a5e7a[_0x63f6('0x54')]=_[_0x63f6('0x55')](_0x3a5e7a[_0x63f6('0x54')],{'$or':_[_0x63f6('0x41')](_0x34e82a,function(_0x46ef13){if(_0x46ef13[_0x63f6('0x44')]!==_0x63f6('0x56')){var _0x2e8918={};_0x2e8918[_0x46ef13[_0x63f6('0x3d')]]={'$like':'%'+_0xce95e2[_0x63f6('0x48')][_0x63f6('0x53')]+'%'};return _0x2e8918;}})});}_0x3a5e7a=_['merge']({},_0x3a5e7a,_0xce95e2[_0x63f6('0x57')]);var _0x5bf3cb={'where':_0x3a5e7a[_0x63f6('0x54')]};return db[_0x63f6('0x58')][_0x63f6('0x59')](_0x5bf3cb)[_0x63f6('0x24')](function(_0x1fcd22){_0x36a41d[_0x63f6('0x59')]=_0x1fcd22;if(_0xce95e2[_0x63f6('0x48')][_0x63f6('0x5a')]){_0x3a5e7a[_0x63f6('0x5b')]=[{'all':!![]}];}return db[_0x63f6('0x58')]['findAll'](_0x3a5e7a);})[_0x63f6('0x24')](function(_0x5bc51f){_0x36a41d[_0x63f6('0x5c')]=_0x5bc51f;return _0x36a41d;})[_0x63f6('0x24')](respondWithFilteredResult(_0x491f2c,_0x3a5e7a))[_0x63f6('0x2d')](handleError(_0x491f2c,null));};exports[_0x63f6('0x5d')]=function(_0x2ed06f,_0x13df2d){var _0x1bffd5={'raw':![],'where':{'id':_0x2ed06f[_0x63f6('0x5e')]['id']},'include':[{'model':db[_0x63f6('0x3f')],'as':'mandatoryDispositionPause'}]},_0x593b2a={};_0x593b2a[_0x63f6('0x46')]=_[_0x63f6('0x47')](db[_0x63f6('0x58')][_0x63f6('0x42')]);_0x593b2a['query']=_['keys'](_0x2ed06f[_0x63f6('0x48')]);_0x593b2a[_0x63f6('0x49')]=_['intersection'](_0x593b2a[_0x63f6('0x46')],_0x593b2a[_0x63f6('0x48')]);_0x1bffd5['attributes']=_[_0x63f6('0x4a')](_0x593b2a[_0x63f6('0x46')],qs[_0x63f6('0x4b')](_0x2ed06f[_0x63f6('0x48')][_0x63f6('0x4b')]));_0x1bffd5['attributes']=_0x1bffd5['attributes'][_0x63f6('0x4d')]?_0x1bffd5[_0x63f6('0x4c')]:_0x593b2a['model'];if(_0x2ed06f[_0x63f6('0x48')][_0x63f6('0x5a')]){_0x1bffd5[_0x63f6('0x5b')]=[{'all':!![]}];}_0x1bffd5=_[_0x63f6('0x55')]({},_0x1bffd5,_0x2ed06f['options']);return db[_0x63f6('0x58')][_0x63f6('0x5f')](_0x1bffd5)['then'](handleEntityNotFound(_0x13df2d,null))[_0x63f6('0x24')](respondWithResult(_0x13df2d,null))[_0x63f6('0x2d')](handleError(_0x13df2d,null));};exports[_0x63f6('0x60')]=function(_0x1ccbbb,_0x46c243){return db[_0x63f6('0x58')][_0x63f6('0x60')](_0x1ccbbb[_0x63f6('0x61')],{})[_0x63f6('0x24')](function(_0x2b7564){var _0x10ce6e=_0x1ccbbb[_0x63f6('0x62')]['get']({'plain':!![]});if(!_0x10ce6e)throw new Error(_0x63f6('0x63'));if(_0x10ce6e[_0x63f6('0x64')]===_0x63f6('0x62')){var _0x337479=_0x2b7564[_0x63f6('0x38')]({'plain':!![]});var _0x497924='OpenchannelAccounts';return db['UserProfileSection']['find']({'where':{'name':_0x497924,'userProfileId':_0x10ce6e[_0x63f6('0x65')]},'raw':!![]})[_0x63f6('0x24')](function(_0x36455e){if(_0x36455e&&_0x36455e[_0x63f6('0x66')]===0x0){return db[_0x63f6('0x3a')][_0x63f6('0x60')]({'name':_0x337479[_0x63f6('0x3d')],'resourceId':_0x337479['id'],'type':_0x36455e[_0x63f6('0x3d')],'sectionId':_0x36455e['id']},{})[_0x63f6('0x24')](function(){return _0x2b7564;});}else{return _0x2b7564;}})[_0x63f6('0x2d')](function(_0x23671d){logger['error'](_0x63f6('0x67'),_0x23671d);throw _0x23671d;});}return _0x2b7564;})[_0x63f6('0x24')](respondWithResult(_0x46c243,0xc9))[_0x63f6('0x2d')](handleError(_0x46c243,null));};exports['update']=function(_0x3d779a,_0x202220){if(_0x3d779a[_0x63f6('0x61')]['id']){delete _0x3d779a[_0x63f6('0x61')]['id'];}return db[_0x63f6('0x58')]['find']({'where':{'id':_0x3d779a[_0x63f6('0x5e')]['id']},'include':[{'model':db[_0x63f6('0x3f')],'as':_0x63f6('0x40')}]})[_0x63f6('0x24')](handleEntityNotFound(_0x202220,null))[_0x63f6('0x24')](saveUpdates(_0x3d779a[_0x63f6('0x61')],null))[_0x63f6('0x24')](respondWithResult(_0x202220,null))[_0x63f6('0x2d')](handleError(_0x202220,null));};exports[_0x63f6('0x37')]=function(_0x5de637,_0x38c616){return db[_0x63f6('0x58')][_0x63f6('0x5f')]({'where':{'id':_0x5de637[_0x63f6('0x5e')]['id']}})['then'](handleEntityNotFound(_0x38c616,null))['then'](removeEntity(_0x38c616,null))['catch'](handleError(_0x38c616,null));};exports[_0x63f6('0x68')]=function(_0x41b570,_0x412a9f){return db[_0x63f6('0x58')][_0x63f6('0x68')]()[_0x63f6('0x24')](respondWithResult(_0x412a9f,null))[_0x63f6('0x2d')](handleError(_0x412a9f,null));};exports[_0x63f6('0x69')]=function(_0x3500b4,_0x54e844,_0xe5e234){if(_0x3500b4[_0x63f6('0x61')]['id']){delete _0x3500b4[_0x63f6('0x61')]['id'];}return db[_0x63f6('0x58')][_0x63f6('0x5f')]({'where':{'id':_0x3500b4['params']['id']}})['then'](handleEntityNotFound(_0x54e844,null))['then'](function(_0x1ef961){if(_0x1ef961){_0x3500b4[_0x63f6('0x61')]['OpnechannelAccountId']=_0x1ef961['id'];return db[_0x63f6('0x6a')][_0x63f6('0x60')](_0x3500b4['body']);}})[_0x63f6('0x24')](respondWithResult(_0x54e844,null))['catch'](handleError(_0x54e844,null));};exports[_0x63f6('0x6b')]=function(_0x19cbcf,_0x2cf2a7,_0x19e9cb){var _0xf910c3={'raw':![],'where':{}};var _0x56ddd7={};var _0x1549fa={'count':0x0,'rows':[]};return db[_0x63f6('0x58')]['findOne']({'where':{'id':_0x19cbcf[_0x63f6('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2cf2a7,null))[_0x63f6('0x24')](function(_0x1005ba){if(_0x1005ba){_0x56ddd7['model']=_['keys'](db[_0x63f6('0x6a')]['rawAttributes']);_0x56ddd7['query']=_[_0x63f6('0x47')](_0x19cbcf['query']);_0x56ddd7['filters']=_[_0x63f6('0x4a')](_0x56ddd7['model'],_0x56ddd7[_0x63f6('0x48')]);_0xf910c3['attributes']=_[_0x63f6('0x4a')](_0x56ddd7[_0x63f6('0x46')],qs[_0x63f6('0x4b')](_0x19cbcf[_0x63f6('0x48')][_0x63f6('0x4b')]));_0xf910c3['attributes']=_0xf910c3[_0x63f6('0x4c')]['length']?_0xf910c3[_0x63f6('0x4c')]:_0x56ddd7['model'];if(!_0x19cbcf[_0x63f6('0x48')][_0x63f6('0x4e')](_0x63f6('0x4f'))){_0xf910c3[_0x63f6('0x32')]=qs[_0x63f6('0x32')](_0x19cbcf[_0x63f6('0x48')][_0x63f6('0x32')]);_0xf910c3['offset']=qs[_0x63f6('0x31')](_0x19cbcf[_0x63f6('0x48')][_0x63f6('0x31')]);}_0xf910c3[_0x63f6('0x50')]=qs['sort'](_0x19cbcf['query'][_0x63f6('0x51')]);_0xf910c3[_0x63f6('0x54')]=qs[_0x63f6('0x49')](_[_0x63f6('0x52')](_0x19cbcf[_0x63f6('0x48')],_0x56ddd7[_0x63f6('0x49')]));_0xf910c3['where'][_0x63f6('0x6c')]=_0x1005ba['id'];if(_0x19cbcf['query'][_0x63f6('0x53')]){_0xf910c3[_0x63f6('0x54')]=_['merge'](_0xf910c3[_0x63f6('0x54')],{'$or':_[_0x63f6('0x41')](_0xf910c3[_0x63f6('0x4c')],function(_0x2c22ac){var _0x558287={};_0x558287[_0x2c22ac]={'$like':'%'+_0x19cbcf[_0x63f6('0x48')][_0x63f6('0x53')]+'%'};return _0x558287;})});}_0xf910c3=_[_0x63f6('0x55')]({},_0xf910c3,_0x19cbcf[_0x63f6('0x57')]);return db['Disposition'][_0x63f6('0x59')]({'where':_0xf910c3[_0x63f6('0x54')]})[_0x63f6('0x24')](function(_0x19fc97){_0x1549fa[_0x63f6('0x59')]=_0x19fc97;if(_0x19cbcf[_0x63f6('0x48')][_0x63f6('0x5a')]){_0xf910c3[_0x63f6('0x5b')]=[{'all':!![]}];}return db[_0x63f6('0x6a')]['findAll'](_0xf910c3);})[_0x63f6('0x24')](function(_0x3d4cfe){_0x1549fa[_0x63f6('0x5c')]=_0x3d4cfe;return _0x1549fa;});}})['then'](respondWithFilteredResult(_0x2cf2a7,_0xf910c3))['catch'](handleError(_0x2cf2a7,null));};exports['removeDispositions']=function(_0x5e0678,_0x2f60db,_0x57a8a8){return db[_0x63f6('0x58')]['find']({'where':{'id':_0x5e0678[_0x63f6('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2f60db,null))[_0x63f6('0x24')](function(_0x5882b4){if(_0x5882b4){return _0x5882b4[_0x63f6('0x6d')](_0x5e0678[_0x63f6('0x48')][_0x63f6('0x6e')]);}})['then'](respondWithStatusCode(_0x2f60db,null))[_0x63f6('0x2d')](handleError(_0x2f60db,null));};exports['addAnswer']=function(_0x42e32d,_0xe320a8,_0x1c4c05){if(_0x42e32d[_0x63f6('0x61')]['id']){delete _0x42e32d[_0x63f6('0x61')]['id'];}return db[_0x63f6('0x58')]['find']({'where':{'id':_0x42e32d[_0x63f6('0x5e')]['id']}})[_0x63f6('0x24')](handleEntityNotFound(_0xe320a8,null))[_0x63f6('0x24')](function(_0x35c8a6){if(_0x35c8a6){_0x42e32d[_0x63f6('0x61')][_0x63f6('0x6c')]=_0x35c8a6['id'];return db[_0x63f6('0x6f')][_0x63f6('0x60')](_0x42e32d[_0x63f6('0x61')]);}})[_0x63f6('0x24')](respondWithResult(_0xe320a8,null))[_0x63f6('0x2d')](handleError(_0xe320a8,null));};exports[_0x63f6('0x70')]=function(_0x183a73,_0x2cfb1b,_0x39e0c7){var _0x525263={'raw':![],'where':{}};var _0x5449e7={};var _0xfc499d={'count':0x0,'rows':[]};return db[_0x63f6('0x58')][_0x63f6('0x71')]({'where':{'id':_0x183a73[_0x63f6('0x5e')]['id']}})[_0x63f6('0x24')](handleEntityNotFound(_0x2cfb1b,null))['then'](function(_0x4ceb23){if(_0x4ceb23){_0x5449e7['model']=_['keys'](db[_0x63f6('0x6f')][_0x63f6('0x42')]);_0x5449e7['query']=_[_0x63f6('0x47')](_0x183a73[_0x63f6('0x48')]);_0x5449e7[_0x63f6('0x49')]=_[_0x63f6('0x4a')](_0x5449e7[_0x63f6('0x46')],_0x5449e7[_0x63f6('0x48')]);_0x525263[_0x63f6('0x4c')]=_['intersection'](_0x5449e7[_0x63f6('0x46')],qs[_0x63f6('0x4b')](_0x183a73[_0x63f6('0x48')][_0x63f6('0x4b')]));_0x525263['attributes']=_0x525263['attributes'][_0x63f6('0x4d')]?_0x525263[_0x63f6('0x4c')]:_0x5449e7['model'];if(!_0x183a73['query'][_0x63f6('0x4e')](_0x63f6('0x4f'))){_0x525263[_0x63f6('0x32')]=qs[_0x63f6('0x32')](_0x183a73[_0x63f6('0x48')]['limit']);_0x525263[_0x63f6('0x31')]=qs['offset'](_0x183a73['query'][_0x63f6('0x31')]);}_0x525263[_0x63f6('0x50')]=qs[_0x63f6('0x51')](_0x183a73[_0x63f6('0x48')][_0x63f6('0x51')]);_0x525263['where']=qs['filters'](_[_0x63f6('0x52')](_0x183a73[_0x63f6('0x48')],_0x5449e7['filters']));_0x525263[_0x63f6('0x54')][_0x63f6('0x6c')]=_0x4ceb23['id'];if(_0x183a73[_0x63f6('0x48')][_0x63f6('0x53')]){_0x525263[_0x63f6('0x54')]=_[_0x63f6('0x55')](_0x525263[_0x63f6('0x54')],{'$or':_[_0x63f6('0x41')](_0x525263[_0x63f6('0x4c')],function(_0x50a3d7){var _0x746a23={};_0x746a23[_0x50a3d7]={'$like':'%'+_0x183a73[_0x63f6('0x48')]['filter']+'%'};return _0x746a23;})});}_0x525263=_[_0x63f6('0x55')]({},_0x525263,_0x183a73[_0x63f6('0x57')]);return db[_0x63f6('0x6f')][_0x63f6('0x59')]({'where':_0x525263['where']})[_0x63f6('0x24')](function(_0x3aad2d){_0xfc499d[_0x63f6('0x59')]=_0x3aad2d;if(_0x183a73[_0x63f6('0x48')][_0x63f6('0x5a')]){_0x525263[_0x63f6('0x5b')]=[{'all':!![]}];}return db[_0x63f6('0x6f')][_0x63f6('0x72')](_0x525263);})['then'](function(_0x55d690){_0xfc499d[_0x63f6('0x5c')]=_0x55d690;return _0xfc499d;});}})[_0x63f6('0x24')](respondWithFilteredResult(_0x2cfb1b,_0x525263))[_0x63f6('0x2d')](handleError(_0x2cfb1b,null));};exports['removeAnswers']=function(_0x16112f,_0x5c0474,_0x4e2afe){return db[_0x63f6('0x58')][_0x63f6('0x5f')]({'where':{'id':_0x16112f[_0x63f6('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5c0474,null))['then'](function(_0x45aff4){if(_0x45aff4){return _0x45aff4['removeAnswers'](_0x16112f['query']['ids']);}})['then'](respondWithStatusCode(_0x5c0474,null))[_0x63f6('0x2d')](handleError(_0x5c0474,null));};exports[_0x63f6('0x73')]=function(_0x29cd6b,_0x3247cc,_0x59779d){var _0x2df3bd={'body':_0x29cd6b[_0x63f6('0x61')],'channel':_0x63f6('0x74')};var _0x5a8b3d=[];var _0x51c745=[];var _0x56d496={};var _0x502ec1=![];return db['CmContact'][_0x63f6('0x68')]()[_0x63f6('0x24')](function(_0x344b7b){if(!_0x344b7b){throw new db[(_0x63f6('0x22'))][(_0x63f6('0x23'))](_0x63f6('0x75'));}_0x5a8b3d=_['difference'](_[_0x63f6('0x47')](_0x344b7b),[_0x63f6('0x76'),'updatedAt']);_0x51c745=_['difference'](_['keys'](_0x344b7b),[_0x63f6('0x76'),_0x63f6('0x77'),'CompanyId',_0x63f6('0x78')]);if(_0x29cd6b[_0x63f6('0x61')]['id']){delete _0x29cd6b['body']['id'];}if(_[_0x63f6('0x79')](_0x29cd6b['body'][_0x63f6('0x7a')])){throw new db[(_0x63f6('0x22'))][(_0x63f6('0x23'))](_0x63f6('0x7b'));}if(_['isNil'](_0x29cd6b[_0x63f6('0x61')][_0x63f6('0x61')])||_0x29cd6b[_0x63f6('0x61')][_0x63f6('0x61')]===''){throw new db['Sequelize'][(_0x63f6('0x23'))](_0x63f6('0x7c'));}if(_[_0x63f6('0x79')](_0x29cd6b['body'][_0x63f6('0x7d')])){throw new db[(_0x63f6('0x22'))][(_0x63f6('0x23'))](_0x63f6('0x7e')+_0x51c745);}if(!_[_0x63f6('0x7f')](_0x51c745,_0x29cd6b['body'][_0x63f6('0x7d')])){throw new db['Sequelize'][(_0x63f6('0x23'))](_0x63f6('0x80')+_0x51c745);}_0x56d496[_0x29cd6b[_0x63f6('0x61')][_0x63f6('0x7d')]]=_0x29cd6b[_0x63f6('0x61')][_0x63f6('0x7a')];})[_0x63f6('0x24')](function(){return db[_0x63f6('0x58')][_0x63f6('0x5f')]({'where':{'id':_0x29cd6b[_0x63f6('0x5e')]['id']},'include':[{'model':db[_0x63f6('0x81')],'as':_0x63f6('0x82'),'include':[{'model':db[_0x63f6('0x83')],'as':_0x63f6('0x84'),'where':_0x56d496,'limit':0x1,'order':[['updatedAt',_0x63f6('0x85')]]}]},{'model':db[_0x63f6('0x86')],'as':'Applications'}]});})[_0x63f6('0x24')](handleEntityNotFound(_0x3247cc,null))[_0x63f6('0x24')](function(_0x2b5fd2){if(_0x2b5fd2&&_0x2b5fd2[_0x63f6('0x82')]){_0x2df3bd['account']=_0x2b5fd2;_0x2df3bd[_0x63f6('0x87')]=_0x2b5fd2[_0x63f6('0x88')];_0x2df3bd[_0x63f6('0x89')]=_0x2b5fd2[_0x63f6('0x82')];_0x2df3bd[_0x63f6('0x87')]=_[_0x63f6('0x8a')](_0x2df3bd[_0x63f6('0x87')],[_0x63f6('0x8b')],[_0x63f6('0x8c')]);if(_0x2df3bd[_0x63f6('0x8d')][_0x63f6('0x88')]){delete _0x2df3bd['account'][_0x63f6('0x88')];}if(_0x2df3bd[_0x63f6('0x8d')][_0x63f6('0x82')]&&_0x2df3bd[_0x63f6('0x8d')][_0x63f6('0x82')][_0x63f6('0x84')]['length']){return _0x2df3bd[_0x63f6('0x8d')][_0x63f6('0x82')][_0x63f6('0x84')][0x0];}var _0x4224b6=_[_0x63f6('0x1b')](_0x29cd6b[_0x63f6('0x61')],{'firstName':_0x29cd6b['body']['from'],'ListId':_0x2b5fd2[_0x63f6('0x78')]});_0x4224b6[_0x29cd6b[_0x63f6('0x61')][_0x63f6('0x7d')]]=_0x29cd6b['body'][_0x63f6('0x7a')];return db['CmContact'][_0x63f6('0x60')](_0x4224b6,{'fields':_0x5a8b3d,'raw':!![]});}})[_0x63f6('0x24')](handleEntityNotFound(_0x3247cc,null))['then'](function(_0x109cf7){_0x2df3bd[_0x63f6('0x8e')]=_0x109cf7;if(_0x109cf7){var _0xd178bb={'ContactId':_0x109cf7['id'],'OpenchannelAccountId':_0x29cd6b['params']['id'],'from':(_0x109cf7[_0x63f6('0x8f')]||'')+'\x20'+(_0x109cf7[_0x63f6('0x90')]||'')};var _0x1e419e={'OpenchannelAccountId':_0x29cd6b[_0x63f6('0x5e')]['id'],'closed':![]};if(_0x29cd6b['body'][_0x63f6('0x91')]){_0x1e419e[_0x63f6('0x91')]=_0x29cd6b[_0x63f6('0x61')][_0x63f6('0x91')];return db[_0x63f6('0x92')][_0x63f6('0x5f')]({'where':_0x1e419e})['then'](function(_0xa47a34){if(_0xa47a34){return[_0xa47a34,![]];}_0xd178bb[_0x63f6('0x91')]=_0x29cd6b['body'][_0x63f6('0x91')];_0xd178bb[_0x63f6('0x93')]=_0x29cd6b[_0x63f6('0x61')]['externalUrl'];return db[_0x63f6('0x92')][_0x63f6('0x60')](_0xd178bb)['then'](function(_0x1928ce){return[_0x1928ce,!![]];});});}else{_0x1e419e[_0x63f6('0x91')]=null;}_0x1e419e[_0x63f6('0x94')]=_0x109cf7['id'];return db[_0x63f6('0x92')][_0x63f6('0x5f')]({'where':_0x1e419e})[_0x63f6('0x24')](function(_0x117e19){if(_0x117e19){return[_0x117e19,![]];}return db[_0x63f6('0x92')][_0x63f6('0x60')](_0xd178bb)['then'](function(_0x30bd92){return[_0x30bd92,!![]];});});}})[_0x63f6('0x95')](function(_0x23a4f2,_0x1f9d90){if(_0x23a4f2){_0x502ec1=_0x1f9d90;if(!_0x1f9d90){var _0x443be3={'from':(_0x2df3bd[_0x63f6('0x8e')]['firstName']||'')+'\x20'+(_0x2df3bd[_0x63f6('0x8e')]['lastName']||'')};if(_0x29cd6b['body'][_0x63f6('0x91')]&&_0x29cd6b[_0x63f6('0x61')]['messageId']&&_0x29cd6b[_0x63f6('0x61')][_0x63f6('0x91')]!=_0x29cd6b['body'][_0x63f6('0x96')]){_0x443be3[_0x63f6('0x91')]=_0x29cd6b[_0x63f6('0x61')][_0x63f6('0x96')];}return _0x23a4f2[_0x63f6('0x36')](_0x443be3);}else{return _0x23a4f2;}}})[_0x63f6('0x24')](function(_0x24f499){_0x2df3bd[_0x63f6('0x97')]=_0x24f499['get']({'plain':!![]});_0x2df3bd[_0x63f6('0x97')][_0x63f6('0x98')]=_0x502ec1;if(_0x2df3bd[_0x63f6('0x97')][_0x63f6('0x98')]){if(_0x2df3bd[_0x63f6('0x8d')]['autoclose']){_0x2df3bd[_0x63f6('0x87')][_0x63f6('0x99')]({'id':0x0,'priority':_0x2df3bd[_0x63f6('0x87')][_0x63f6('0x4d')]+0x1,'app':_0x63f6('0x9a'),'appdata':_0x63f6('0x9b'),'interval':_0x63f6('0x9c')});}}return db[_0x63f6('0x9d')]['create']({'body':_0x29cd6b[_0x63f6('0x61')][_0x63f6('0x61')],'OpenchannelAccountId':_0x29cd6b[_0x63f6('0x5e')]['id'],'OpenchannelInteractionId':_0x24f499['id'],'direction':'in','ContactId':_0x2df3bd[_0x63f6('0x8e')]['id'],'AttachmentId':_0x29cd6b['body']['AttachmentId']});})['then'](function(_0x430f5c){_0x2df3bd[_0x63f6('0x2a')]=_0x430f5c;if(_0x2df3bd[_0x63f6('0x97')]['UserId']){return db[_0x63f6('0x9e')][_0x63f6('0x5f')]({'attributes':['id',_0x63f6('0x3d')],'where':{'id':_0x2df3bd['interaction'][_0x63f6('0x9f')]}})[_0x63f6('0x24')](function(_0x119a4a){if(_0x119a4a){_0x2df3bd[_0x63f6('0x87')][_0x63f6('0xa0')]({'id':0x0,'priority':0x0,'app':_0x63f6('0xa1'),'appdata':_0x119a4a[_0x63f6('0x3d')]+','+(_0x2df3bd[_0x63f6('0x8d')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x2df3bd[_0x63f6('0xa2')]=![];}return respondWithRpcPromise(_0x63f6('0xa3'),_0x63f6('0xa4'),_0x2df3bd);});}return respondWithRpcPromise(_0x63f6('0xa3'),_0x63f6('0xa4'),_0x2df3bd);})['then'](function(_0xf9f2d6){respondWithRpcPromise(_0x63f6('0xa5'),'EventManager',{'event':_0x63f6('0x73'),'message':_0xf9f2d6},client9002);return _0xf9f2d6;})[_0x63f6('0x24')](respondWithResult(_0x3247cc,null))[_0x63f6('0x2d')](handleError(_0x3247cc,null));};exports['addApplications']=function(_0x435665,_0x5aa33a,_0xf76eaf){return db[_0x63f6('0x58')]['findOne']({'where':{'id':_0x435665[_0x63f6('0x5e')]['id']}})[_0x63f6('0x24')](handleEntityNotFound(_0x5aa33a,null))['then'](function(_0x106168){if(_0x106168){return db['sequelize']['transaction'](function(_0x14f63d){return db[_0x63f6('0x86')][_0x63f6('0x37')]({'where':{'OpenchannelAccountId':_0x435665[_0x63f6('0x5e')]['id']},'transaction':_0x14f63d})[_0x63f6('0x24')](function(_0x3e1976){var _0x37a2da=_[_0x63f6('0x41')](_0x435665[_0x63f6('0x61')],function(_0x422e76){_0x422e76[_0x63f6('0x6c')]=_0x435665['params']['id'];return _0x422e76;});return db[_0x63f6('0x86')][_0x63f6('0xa6')](_0x37a2da,{'transaction':_0x14f63d});});})[_0x63f6('0x24')](function(){return db[_0x63f6('0x86')][_0x63f6('0xa7')]({'where':{'OpenchannelAccountId':_0x435665[_0x63f6('0x5e')]['id']},'order':'priority'});});}})[_0x63f6('0x24')](respondWithResult(_0x5aa33a,null))[_0x63f6('0x2d')](handleError(_0x5aa33a,null));};exports[_0x63f6('0xa8')]=function(_0x5b16b2,_0x5e25c2,_0xfb2f90){var _0x3b91d0={};var _0x28585f={};var _0x213c56;var _0x26505a;return db[_0x63f6('0x58')]['findOne']({'where':{'id':_0x5b16b2[_0x63f6('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5e25c2,null))[_0x63f6('0x24')](function(_0x15a5eb){if(_0x15a5eb){_0x213c56=_0x15a5eb;_0x28585f[_0x63f6('0x46')]=_[_0x63f6('0x47')](db[_0x63f6('0x86')][_0x63f6('0x42')]);_0x28585f[_0x63f6('0x48')]=_['keys'](_0x5b16b2['query']);_0x28585f[_0x63f6('0x49')]=_[_0x63f6('0x4a')](_0x28585f[_0x63f6('0x46')],_0x28585f[_0x63f6('0x48')]);_0x3b91d0[_0x63f6('0x4c')]=_[_0x63f6('0x4a')](_0x28585f[_0x63f6('0x46')],qs[_0x63f6('0x4b')](_0x5b16b2[_0x63f6('0x48')][_0x63f6('0x4b')]));_0x3b91d0[_0x63f6('0x4c')]=_0x3b91d0[_0x63f6('0x4c')][_0x63f6('0x4d')]?_0x3b91d0[_0x63f6('0x4c')]:_0x28585f[_0x63f6('0x46')];_0x3b91d0['order']=qs['sort'](_0x5b16b2['query'][_0x63f6('0x51')]);_0x3b91d0[_0x63f6('0x54')]=qs['filters'](_[_0x63f6('0x52')](_0x5b16b2[_0x63f6('0x48')],_0x28585f[_0x63f6('0x49')]));if(_0x5b16b2['query']['filter']){_0x3b91d0[_0x63f6('0x54')]=_[_0x63f6('0x55')](_0x3b91d0[_0x63f6('0x54')],{'$or':_[_0x63f6('0x41')](_0x3b91d0[_0x63f6('0x4c')],function(_0x11cb30){var _0xc10d2e={};_0xc10d2e[_0x11cb30]={'$like':'%'+_0x5b16b2['query'][_0x63f6('0x53')]+'%'};return _0xc10d2e;})});}_0x3b91d0=_['merge']({},_0x3b91d0,_0x5b16b2[_0x63f6('0x57')]);return _0x213c56[_0x63f6('0xa8')](_0x3b91d0);}})[_0x63f6('0x24')](function(_0x48a595){if(_0x48a595){_0x26505a=_0x48a595['length'];if(!_0x5b16b2['query'][_0x63f6('0x4e')]('nolimit')){_0x3b91d0[_0x63f6('0x32')]=qs[_0x63f6('0x32')](_0x5b16b2[_0x63f6('0x48')][_0x63f6('0x32')]);_0x3b91d0[_0x63f6('0x31')]=qs[_0x63f6('0x31')](_0x5b16b2[_0x63f6('0x48')][_0x63f6('0x31')]);}return _0x213c56['getApplications'](_0x3b91d0);}})[_0x63f6('0x24')](function(_0x5eb836){if(_0x5eb836){return _0x5eb836?{'count':_0x26505a,'rows':_0x5eb836}:null;}})[_0x63f6('0x24')](respondWithResult(_0x5e25c2,null))[_0x63f6('0x2d')](handleError(_0x5e25c2,null));};exports[_0x63f6('0xa9')]=function(_0x4ed1e0,_0x1563d8,_0x3479f7){var _0x5d3f79={'raw':![],'where':{}};var _0x81b3df={};var _0x418b41={'count':0x0,'rows':[]};return db[_0x63f6('0x58')][_0x63f6('0x71')]({'where':{'id':_0x4ed1e0['params']['id']}})[_0x63f6('0x24')](handleEntityNotFound(_0x1563d8,null))[_0x63f6('0x24')](function(_0x5430ab){if(_0x5430ab){_0x81b3df['model']=_['keys'](db[_0x63f6('0x92')][_0x63f6('0x42')]);_0x81b3df[_0x63f6('0x48')]=_['keys'](_0x4ed1e0[_0x63f6('0x48')]);_0x81b3df['filters']=_[_0x63f6('0x4a')](_0x81b3df[_0x63f6('0x46')],_0x81b3df['query']);_0x5d3f79[_0x63f6('0x4c')]=_[_0x63f6('0x4a')](_0x81b3df['model'],qs['fields'](_0x4ed1e0[_0x63f6('0x48')]['fields']));_0x5d3f79['attributes']=_0x5d3f79[_0x63f6('0x4c')][_0x63f6('0x4d')]?_0x5d3f79['attributes']:_0x81b3df['model'];if(!_0x4ed1e0[_0x63f6('0x48')][_0x63f6('0x4e')](_0x63f6('0x4f'))){_0x5d3f79['limit']=qs['limit'](_0x4ed1e0[_0x63f6('0x48')]['limit']);_0x5d3f79[_0x63f6('0x31')]=qs[_0x63f6('0x31')](_0x4ed1e0[_0x63f6('0x48')][_0x63f6('0x31')]);}_0x5d3f79[_0x63f6('0x50')]=qs['sort'](_0x4ed1e0[_0x63f6('0x48')][_0x63f6('0x51')]);_0x5d3f79[_0x63f6('0x54')]=qs['filters'](_[_0x63f6('0x52')](_0x4ed1e0['query'],_0x81b3df[_0x63f6('0x49')]));_0x5d3f79[_0x63f6('0x54')][_0x63f6('0x6c')]=_0x5430ab['id'];if(_0x4ed1e0[_0x63f6('0x48')][_0x63f6('0x53')]){_0x5d3f79[_0x63f6('0x54')]=_[_0x63f6('0x55')](_0x5d3f79['where'],{'$or':_['map'](_0x5d3f79[_0x63f6('0x4c')],function(_0x1d709b){var _0x55f9d4={};_0x55f9d4[_0x1d709b]={'$like':'%'+_0x4ed1e0[_0x63f6('0x48')][_0x63f6('0x53')]+'%'};return _0x55f9d4;})});}_0x5d3f79=_[_0x63f6('0x55')]({},_0x5d3f79,_0x4ed1e0[_0x63f6('0x57')]);return db[_0x63f6('0x92')][_0x63f6('0x59')]({'where':_0x5d3f79[_0x63f6('0x54')]})[_0x63f6('0x24')](function(_0x4e5274){_0x418b41[_0x63f6('0x59')]=_0x4e5274;if(_0x4ed1e0[_0x63f6('0x48')][_0x63f6('0x5a')]){_0x5d3f79[_0x63f6('0x5b')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x63f6('0x9e')],'as':_0x63f6('0xaa'),'attributes':['name',_0x63f6('0xab'),_0x63f6('0xac')],'required':![]},{'model':db['Tag'],'as':_0x63f6('0xad'),'attributes':['id',_0x63f6('0x3d'),_0x63f6('0xae')],'where':_0x4ed1e0[_0x63f6('0x48')][_0x63f6('0xaf')]?{'id':_0x4ed1e0[_0x63f6('0x48')][_0x63f6('0xaf')]}:undefined,'required':_0x4ed1e0['query'][_0x63f6('0xaf')]?!![]:![]}];}return db[_0x63f6('0x92')][_0x63f6('0x72')](_0x5d3f79);})[_0x63f6('0x24')](function(_0x418b00){_0x418b41[_0x63f6('0x5c')]=_0x418b00;return _0x418b41;});}})[_0x63f6('0x24')](respondWithFilteredResult(_0x1563d8,_0x5d3f79))['catch'](handleError(_0x1563d8,null));};exports[_0x63f6('0xb0')]=function(_0x44f3f2,_0x3e33ff,_0x232efb){return db['OpenchannelAccount'][_0x63f6('0x5f')]({'where':{'id':_0x44f3f2[_0x63f6('0x5e')]['id']}})[_0x63f6('0x24')](handleEntityNotFound(_0x3e33ff,null))[_0x63f6('0x24')](function(_0x1d2380){if(_0x1d2380){return _0x1d2380['addAgents'](_0x44f3f2[_0x63f6('0x61')]['ids'],_[_0x63f6('0xb1')](_0x44f3f2['body'],[_0x63f6('0x6e'),'id'])||{})[_0x63f6('0x95')](function(_0x56a0ba){for(var _0x2d8db5=0x0;_0x2d8db5<_0x44f3f2[_0x63f6('0x61')][_0x63f6('0x6e')][_0x63f6('0x4d')];_0x2d8db5+=0x1){socket['emit'](_0x63f6('0xb2'),{'UserId':_0x44f3f2['body']['ids'][_0x2d8db5],'OpenchannelAccountId':_0x44f3f2[_0x63f6('0x5e')]['id']});}return _0x56a0ba;});}})[_0x63f6('0x24')](respondWithResult(_0x3e33ff,null))[_0x63f6('0x2d')](handleError(_0x3e33ff,null));};exports[_0x63f6('0xb3')]=function(_0x2f0767,_0x3c471e,_0x23fdef){return db['OpenchannelAccount'][_0x63f6('0x5f')]({'where':{'id':_0x2f0767[_0x63f6('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3c471e,null))[_0x63f6('0x24')](function(_0x1288bb){if(_0x1288bb){return _0x1288bb[_0x63f6('0xb3')](_0x2f0767[_0x63f6('0x48')][_0x63f6('0x6e')])[_0x63f6('0x24')](function(){if(_[_0x63f6('0xb4')](_0x2f0767['query'][_0x63f6('0x6e')])){for(var _0x1736ef=0x0;_0x1736ef<_0x2f0767[_0x63f6('0x48')][_0x63f6('0x6e')]['length'];_0x1736ef+=0x1){socket[_0x63f6('0xb5')](_0x63f6('0xb6'),{'UserId':Number(_0x2f0767['query'][_0x63f6('0x6e')][_0x1736ef]),'OpenchannelAccountId':Number(_0x2f0767[_0x63f6('0x5e')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x2f0767[_0x63f6('0x48')][_0x63f6('0x6e')]),'OpenchannelAccountId':Number(_0x2f0767[_0x63f6('0x5e')]['id'])});}});}})[_0x63f6('0x24')](respondWithStatusCode(_0x3c471e,null))['catch'](handleError(_0x3c471e,null));};exports[_0x63f6('0xb7')]=function(_0x40f9b0,_0x48415f,_0x3271fe){var _0x4d5df3={};var _0x5cb1b1={};var _0x6249e5;var _0x1318ef;return db[_0x63f6('0x58')][_0x63f6('0x71')]({'where':{'id':_0x40f9b0[_0x63f6('0x5e')]['id']}})[_0x63f6('0x24')](handleEntityNotFound(_0x48415f,null))[_0x63f6('0x24')](function(_0x29e4f5){if(_0x29e4f5){_0x6249e5=_0x29e4f5;_0x5cb1b1['model']=_[_0x63f6('0x47')](db[_0x63f6('0x9e')]['rawAttributes']);_0x5cb1b1[_0x63f6('0x48')]=_[_0x63f6('0x47')](_0x40f9b0['query']);_0x5cb1b1[_0x63f6('0x49')]=_[_0x63f6('0x4a')](_0x5cb1b1[_0x63f6('0x46')],_0x5cb1b1['query']);_0x4d5df3[_0x63f6('0x4c')]=_[_0x63f6('0x4a')](_0x5cb1b1[_0x63f6('0x46')],qs[_0x63f6('0x4b')](_0x40f9b0[_0x63f6('0x48')][_0x63f6('0x4b')]));_0x4d5df3[_0x63f6('0x4c')]=_0x4d5df3[_0x63f6('0x4c')]['length']?_0x4d5df3['attributes']:_0x5cb1b1['model'];_0x4d5df3[_0x63f6('0x50')]=qs[_0x63f6('0x51')](_0x40f9b0[_0x63f6('0x48')][_0x63f6('0x51')]);_0x4d5df3[_0x63f6('0x54')]=qs['filters'](_[_0x63f6('0x52')](_0x40f9b0[_0x63f6('0x48')],_0x5cb1b1[_0x63f6('0x49')]));if(_0x40f9b0[_0x63f6('0x48')]['filter']){_0x4d5df3[_0x63f6('0x54')]=_[_0x63f6('0x55')](_0x4d5df3[_0x63f6('0x54')],{'$or':_[_0x63f6('0x41')](_0x4d5df3['attributes'],function(_0x1847b3){var _0x2653d0={};_0x2653d0[_0x1847b3]={'$like':'%'+_0x40f9b0[_0x63f6('0x48')][_0x63f6('0x53')]+'%'};return _0x2653d0;})});}_0x4d5df3=_[_0x63f6('0x55')]({},_0x4d5df3,_0x40f9b0[_0x63f6('0x57')]);return _0x6249e5['getAgents'](_0x4d5df3);}})[_0x63f6('0x24')](function(_0x2a4aca){if(_0x2a4aca){_0x1318ef=_0x2a4aca[_0x63f6('0x4d')];if(!_0x40f9b0[_0x63f6('0x48')][_0x63f6('0x4e')](_0x63f6('0x4f'))){_0x4d5df3[_0x63f6('0x32')]=qs[_0x63f6('0x32')](_0x40f9b0[_0x63f6('0x48')][_0x63f6('0x32')]);_0x4d5df3[_0x63f6('0x31')]=qs[_0x63f6('0x31')](_0x40f9b0['query']['offset']);}return _0x6249e5[_0x63f6('0xb7')](_0x4d5df3);}})[_0x63f6('0x24')](function(_0x55c5e8){if(_0x55c5e8){return _0x55c5e8?{'count':_0x1318ef,'rows':_0x55c5e8}:null;}})['then'](respondWithResult(_0x48415f,null))[_0x63f6('0x2d')](handleError(_0x48415f,null));};exports[_0x63f6('0xb8')]=function(_0x57a0ed,_0x5e5624,_0x4e8c52){var _0x2aec2e,_0x1e6d4e,_0x5dd2ba;if(_[_0x63f6('0x79')](_0x57a0ed['body'][_0x63f6('0x61')])||_0x57a0ed['body'][_0x63f6('0x61')]===''){throw new db[(_0x63f6('0x22'))][(_0x63f6('0x23'))](_0x63f6('0x7c'));}if(_[_0x63f6('0x79')](_0x57a0ed[_0x63f6('0x61')]['to'])){}_0x2aec2e=_0x57a0ed['body']['to'];return db[_0x63f6('0x58')]['findOne']({'where':{'id':_0x57a0ed[_0x63f6('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5e5624,null))[_0x63f6('0x24')](function(_0x2fbdb5){if(_0x2fbdb5){return db[_0x63f6('0x58')][_0x63f6('0x5f')]({'where':{'id':_0x2fbdb5['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x63f6('0x83')],'as':_0x63f6('0x84'),'where':{[_0x2fbdb5[_0x63f6('0x7d')]]:_0x2aec2e},'limit':0x1,'order':[[_0x63f6('0x77'),_0x63f6('0x85')]]}]}]})[_0x63f6('0x24')](handleEntityNotFound(_0x5e5624,null))[_0x63f6('0x24')](function(_0x1b551c){if(_0x1b551c&&_0x1b551c[_0x63f6('0x82')]){_0x1e6d4e=_0x1b551c[_0x63f6('0x38')]({'plain':!![]});if(_0x1e6d4e['List']&&_0x1e6d4e['List'][_0x63f6('0x84')][_0x63f6('0x4d')]){return _0x1e6d4e[_0x63f6('0x82')][_0x63f6('0x84')][0x0];}return db[_0x63f6('0x83')][_0x63f6('0x60')](_[_0x63f6('0x1b')](_0x57a0ed['body'],{'firstName':_0x2aec2e,[_0x1b551c[_0x63f6('0x7d')]]:_0x2aec2e,'phone':_0x2aec2e,'ListId':_0x1e6d4e[_0x63f6('0x78')]}));}})[_0x63f6('0x24')](handleEntityNotFound(_0x5e5624,null))[_0x63f6('0x24')](function(_0x29b866){if(_0x29b866){_0x5dd2ba=_0x29b866;return db[_0x63f6('0x92')][_0x63f6('0x5f')]({'where':{'ContactId':_0x5dd2ba['id'],'closed':![],'OpenchannelAccountId':_0x1e6d4e['id']}})[_0x63f6('0x24')](function(_0x265df8){if(_0x265df8){return[_0x265df8,![]];}return db[_0x63f6('0x92')]['create']({'UserId':_0x57a0ed[_0x63f6('0x62')]['id'],'ContactId':_0x5dd2ba['id'],'OpenchannelAccountId':_0x1e6d4e['id'],'lastMsgDirection':_0x63f6('0xb9'),'Messages':[_['merge'](_0x57a0ed[_0x63f6('0x61')],{'read':![],'body':_0x57a0ed[_0x63f6('0x61')]['body'],'OpenchannelAccountId':_0x1e6d4e['id'],'UserId':_0x57a0ed[_0x63f6('0x62')]['id'],'ContactId':_0x5dd2ba['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})['then'](function(_0xf582b0){return[_0xf582b0,!![]];});});}})['spread'](function(_0x32ed0e,_0x109acc){if(_0x109acc){return _0x32ed0e;}return db['OpenchannelMessage'][_0x63f6('0x60')](_[_0x63f6('0x55')](_0x57a0ed[_0x63f6('0x61')],{'read':![],'body':_0x57a0ed['body'][_0x63f6('0x61')],'OpenchannelAccountId':_0x1e6d4e['id'],'OpenchannelInteractionId':_0x32ed0e['id'],'UserId':_0x57a0ed[_0x63f6('0x62')]['id'],'ContactId':_0x5dd2ba['id']}))[_0x63f6('0x24')](function(_0x45ce11){_0x32ed0e[_0x63f6('0xba')][_0x63f6('0xbb')]=[];_0x32ed0e['dataValues']['Messages'][_0x63f6('0x99')](_0x45ce11[_0x63f6('0xba')]);return _0x32ed0e;});});}})[_0x63f6('0x24')](respondWithResult(_0x5e5624,null))['catch'](handleError(_0x5e5624,null));}; \ No newline at end of file +var _0x44a1=['filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','Pause','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpnechannelAccountId','Disposition','getDispositions','order','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','contact','firstName','threadId','OpenchannelInteraction','lastName','messageId','update','created','interaction','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','Contact','fullname','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','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','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','count','offset','Content-Range','apply','reject','save','then','destroy','OpenchannelAccounts','UserProfileResource','stack','send','index','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','map','name','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where'];(function(_0x4b2f3b,_0x2a700d){var _0xcdfede=function(_0x5e289c){while(--_0x5e289c){_0x4b2f3b['push'](_0x4b2f3b['shift']());}};_0xcdfede(++_0x2a700d);}(_0x44a1,0x1ed));var _0x144a=function(_0x48746e,_0x53da0a){_0x48746e=_0x48746e-0x0;var _0x2a74d1=_0x44a1[_0x48746e];return _0x2a74d1;};'use strict';var pdf=require(_0x144a('0x0'));var emlformat=require(_0x144a('0x1'));var rimraf=require(_0x144a('0x2'));var zipdir=require(_0x144a('0x3'));var jsonpatch=require(_0x144a('0x4'));var rp=require('request-promise');var moment=require(_0x144a('0x5'));var BPromise=require(_0x144a('0x6'));var Mustache=require('mustache');var util=require(_0x144a('0x7'));var path=require(_0x144a('0x8'));var sox=require(_0x144a('0x9'));var csv=require(_0x144a('0xa'));var ejs=require(_0x144a('0xb'));var fs=require('fs');var _=require(_0x144a('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x144a('0xd'));var deskjs=require(_0x144a('0xe'));var toCsv=require(_0x144a('0xa'));var querystring=require('querystring');var Papa=require(_0x144a('0xf'));var Redis=require(_0x144a('0x10'));var authService=require(_0x144a('0x11'));var qs=require(_0x144a('0x12'));var as=require(_0x144a('0x13'));var hardwareService=require(_0x144a('0x14'));var logger=require('../../config/logger')(_0x144a('0x15'));var utils=require(_0x144a('0x16'));var config=require(_0x144a('0x17'));var db=require(_0x144a('0x18'))['db'];config[_0x144a('0x19')]=_[_0x144a('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x144a('0x1b'))(new Redis(config[_0x144a('0x19')]));require(_0x144a('0x1c'))[_0x144a('0x1d')](socket);var jayson=require(_0x144a('0x1e'));var client=jayson[_0x144a('0x1f')]['http']({'port':0x232c});var client9002=jayson['client'][_0x144a('0x20')]({'port':0x232a});function checkPasswordPattern(_0x58801b,_0x4043af,_0x183d04){if(_0x183d04){var _0x480cc4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x480cc4['test'](_0x4043af)){return _0x58801b;}else{throw new db['Sequelize']['ValidationError'](_0x144a('0x21'));}}else{return _0x58801b;}}function respondWithRpcPromise(_0xe41515,_0x408c9c,_0x539a0f,_0x194f34){return new BPromise(function(_0x3874c2,_0x37f74a){var _0x1278a4=_0x194f34||client;return _0x1278a4[_0x144a('0x22')](_0xe41515,_0x539a0f)['then'](function(_0xd6356c){logger[_0x144a('0x23')](_0x144a('0x24'),_0x408c9c,_0x144a('0x25'));logger[_0x144a('0x26')](_0x144a('0x27'),_0x408c9c,_0x144a('0x25'),JSON[_0x144a('0x28')](_0xd6356c));if(_0xd6356c[_0x144a('0x29')]){if(_0xd6356c[_0x144a('0x29')]['code']===0x1f4){logger['error'](_0x144a('0x24'),_0x408c9c,_0xd6356c[_0x144a('0x29')][_0x144a('0x2a')]);return _0x37f74a(_0xd6356c['error'][_0x144a('0x2a')]);}logger[_0x144a('0x29')](_0x144a('0x24'),_0x408c9c,_0xd6356c[_0x144a('0x29')][_0x144a('0x2a')]);return _0x3874c2(_0xd6356c[_0x144a('0x29')]['message']);}else{logger[_0x144a('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x408c9c,_0x144a('0x25'));_0x3874c2(_0xd6356c['result'][_0x144a('0x2a')]);}})[_0x144a('0x2b')](function(_0x4c1f9d){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x408c9c,_0x4c1f9d);_0x37f74a(_0x4c1f9d);});});}function respondWithStatusCode(_0x23f8e5,_0x3621a4){_0x3621a4=_0x3621a4||0xcc;return function(_0x1b889a){if(_0x1b889a){return _0x23f8e5[_0x144a('0x2c')](_0x3621a4);}return _0x23f8e5[_0x144a('0x2d')](_0x3621a4)['end']();};}function respondWithResult(_0x3417f0,_0x23929c){_0x23929c=_0x23929c||0xc8;return function(_0x40c849){if(_0x40c849){return _0x3417f0[_0x144a('0x2d')](_0x23929c)[_0x144a('0x2e')](_0x40c849);}};}function respondWithFilteredResult(_0x410a69,_0x25434a){return function(_0x527bd0){if(_0x527bd0){var _0x4fb52f=_0x527bd0[_0x144a('0x2f')],_0x3ed998=_0x25434a['offset'],_0x5e3631=_0x25434a[_0x144a('0x30')]+_0x25434a['limit'],_0x2fe0b2;if(_0x5e3631>=_0x4fb52f){_0x5e3631=_0x4fb52f;_0x2fe0b2=0xc8;}else{_0x2fe0b2=0xce;}_0x410a69[_0x144a('0x2d')](_0x2fe0b2);return _0x410a69['set'](_0x144a('0x31'),_0x3ed998+'-'+_0x5e3631+'/'+_0x4fb52f)['json'](_0x527bd0);}return null;};}function patchUpdates(_0x37498c){return function(_0x25bb7c){try{jsonpatch[_0x144a('0x32')](_0x25bb7c,_0x37498c,!![]);}catch(_0x2b70a8){return BPromise[_0x144a('0x33')](_0x2b70a8);}return _0x25bb7c[_0x144a('0x34')]();};}function saveUpdates(_0x314a33,_0x51dbde){return function(_0x12ffc6){if(_0x12ffc6){return _0x12ffc6['update'](_0x314a33)[_0x144a('0x35')](function(_0x2bebb4){return _0x2bebb4;});}return null;};}function removeEntity(_0x233278,_0xcb7098){return function(_0x49319f){if(_0x49319f){return _0x49319f[_0x144a('0x36')]()[_0x144a('0x35')](function(){var _0x520a6a=_0x49319f['get']({'plain':!![]});var _0x52cda8=_0x144a('0x37');return db[_0x144a('0x38')][_0x144a('0x36')]({'where':{'type':_0x52cda8,'resourceId':_0x520a6a['id']}})[_0x144a('0x35')](function(){return _0x49319f;});})['then'](function(){_0x233278['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x241092,_0x1179a0){return function(_0x51980f){if(!_0x51980f){_0x241092[_0x144a('0x2c')](0x194);}return _0x51980f;};}function handleError(_0x1c5ee3,_0x23feba){_0x23feba=_0x23feba||0x1f4;return function(_0x394fc7){logger[_0x144a('0x29')](_0x394fc7[_0x144a('0x39')]);if(_0x394fc7['name']){delete _0x394fc7['name'];}_0x1c5ee3[_0x144a('0x2d')](_0x23feba)[_0x144a('0x3a')](_0x394fc7);};}exports[_0x144a('0x3b')]=function(_0x126424,_0x19806b){var _0x13f3e3={'include':[{'model':db['Pause'],'as':_0x144a('0x3c')}]},_0x72ca6={},_0x5acdaa={'count':0x0,'rows':[]};var _0x48613a=_['map'](db[_0x144a('0x3d')][_0x144a('0x3e')],function(_0x5a0b8e){return{'name':_0x5a0b8e[_0x144a('0x3f')],'type':_0x5a0b8e[_0x144a('0x40')][_0x144a('0x41')]};});_0x72ca6[_0x144a('0x42')]=_[_0x144a('0x43')](_0x48613a,_0x144a('0x44'));_0x72ca6['query']=_[_0x144a('0x45')](_0x126424[_0x144a('0x46')]);_0x72ca6['filters']=_['intersection'](_0x72ca6[_0x144a('0x42')],_0x72ca6[_0x144a('0x46')]);_0x13f3e3['attributes']=_[_0x144a('0x47')](_0x72ca6['model'],qs[_0x144a('0x48')](_0x126424['query'][_0x144a('0x48')]));_0x13f3e3[_0x144a('0x49')]=_0x13f3e3[_0x144a('0x49')][_0x144a('0x4a')]?_0x13f3e3[_0x144a('0x49')]:_0x72ca6[_0x144a('0x42')];if(!_0x126424[_0x144a('0x46')][_0x144a('0x4b')](_0x144a('0x4c'))){_0x13f3e3[_0x144a('0x4d')]=qs[_0x144a('0x4d')](_0x126424['query'][_0x144a('0x4d')]);_0x13f3e3[_0x144a('0x30')]=qs[_0x144a('0x30')](_0x126424[_0x144a('0x46')][_0x144a('0x30')]);}_0x13f3e3['order']=qs[_0x144a('0x4e')](_0x126424[_0x144a('0x46')][_0x144a('0x4e')]);_0x13f3e3[_0x144a('0x4f')]=qs[_0x144a('0x50')](_[_0x144a('0x51')](_0x126424[_0x144a('0x46')],_0x72ca6[_0x144a('0x50')]),_0x48613a);if(_0x126424['query'][_0x144a('0x52')]){_0x13f3e3[_0x144a('0x4f')]=_[_0x144a('0x53')](_0x13f3e3[_0x144a('0x4f')],{'$or':_[_0x144a('0x43')](_0x48613a,function(_0x3da515){if(_0x3da515['type']!==_0x144a('0x54')){var _0xfb1baf={};_0xfb1baf[_0x3da515[_0x144a('0x44')]]={'$like':'%'+_0x126424[_0x144a('0x46')][_0x144a('0x52')]+'%'};return _0xfb1baf;}})});}_0x13f3e3=_[_0x144a('0x53')]({},_0x13f3e3,_0x126424['options']);var _0x1a1748={'where':_0x13f3e3[_0x144a('0x4f')]};return db[_0x144a('0x3d')][_0x144a('0x2f')](_0x1a1748)[_0x144a('0x35')](function(_0x139abe){_0x5acdaa['count']=_0x139abe;if(_0x126424[_0x144a('0x46')][_0x144a('0x55')]){_0x13f3e3[_0x144a('0x56')]=[{'all':!![]}];}return db[_0x144a('0x3d')][_0x144a('0x57')](_0x13f3e3);})[_0x144a('0x35')](function(_0x117ea9){_0x5acdaa[_0x144a('0x58')]=_0x117ea9;return _0x5acdaa;})[_0x144a('0x35')](respondWithFilteredResult(_0x19806b,_0x13f3e3))[_0x144a('0x2b')](handleError(_0x19806b,null));};exports[_0x144a('0x59')]=function(_0x53281b,_0x40b485){var _0x433e1d={'raw':![],'where':{'id':_0x53281b[_0x144a('0x5a')]['id']},'include':[{'model':db[_0x144a('0x5b')],'as':'mandatoryDispositionPause'}]},_0x3572b8={};_0x3572b8[_0x144a('0x42')]=_[_0x144a('0x45')](db['OpenchannelAccount']['rawAttributes']);_0x3572b8[_0x144a('0x46')]=_[_0x144a('0x45')](_0x53281b[_0x144a('0x46')]);_0x3572b8['filters']=_[_0x144a('0x47')](_0x3572b8[_0x144a('0x42')],_0x3572b8[_0x144a('0x46')]);_0x433e1d[_0x144a('0x49')]=_[_0x144a('0x47')](_0x3572b8['model'],qs[_0x144a('0x48')](_0x53281b[_0x144a('0x46')][_0x144a('0x48')]));_0x433e1d[_0x144a('0x49')]=_0x433e1d[_0x144a('0x49')]['length']?_0x433e1d['attributes']:_0x3572b8[_0x144a('0x42')];if(_0x53281b[_0x144a('0x46')]['includeAll']){_0x433e1d[_0x144a('0x56')]=[{'all':!![]}];}_0x433e1d=_['merge']({},_0x433e1d,_0x53281b[_0x144a('0x5c')]);return db[_0x144a('0x3d')]['find'](_0x433e1d)[_0x144a('0x35')](handleEntityNotFound(_0x40b485,null))[_0x144a('0x35')](respondWithResult(_0x40b485,null))['catch'](handleError(_0x40b485,null));};exports[_0x144a('0x5d')]=function(_0x36f634,_0x4e9bda){return db[_0x144a('0x3d')][_0x144a('0x5d')](_0x36f634[_0x144a('0x5e')],{})[_0x144a('0x35')](function(_0x18dccd){var _0x446971=_0x36f634[_0x144a('0x5f')][_0x144a('0x60')]({'plain':!![]});if(!_0x446971)throw new Error(_0x144a('0x61'));if(_0x446971[_0x144a('0x62')]===_0x144a('0x5f')){var _0x5edce0=_0x18dccd[_0x144a('0x60')]({'plain':!![]});var _0x115539=_0x144a('0x37');return db[_0x144a('0x63')][_0x144a('0x64')]({'where':{'name':_0x115539,'userProfileId':_0x446971['userProfileId']},'raw':!![]})['then'](function(_0x50b0d4){if(_0x50b0d4&&_0x50b0d4[_0x144a('0x65')]===0x0){return db[_0x144a('0x38')][_0x144a('0x5d')]({'name':_0x5edce0['name'],'resourceId':_0x5edce0['id'],'type':_0x50b0d4[_0x144a('0x44')],'sectionId':_0x50b0d4['id']},{})[_0x144a('0x35')](function(){return _0x18dccd;});}else{return _0x18dccd;}})[_0x144a('0x2b')](function(_0x3d554a){logger['error'](_0x144a('0x66'),_0x3d554a);throw _0x3d554a;});}return _0x18dccd;})[_0x144a('0x35')](respondWithResult(_0x4e9bda,0xc9))[_0x144a('0x2b')](handleError(_0x4e9bda,null));};exports['update']=function(_0x5bc6b2,_0x497f5e){if(_0x5bc6b2[_0x144a('0x5e')]['id']){delete _0x5bc6b2[_0x144a('0x5e')]['id'];}return db[_0x144a('0x3d')][_0x144a('0x64')]({'where':{'id':_0x5bc6b2[_0x144a('0x5a')]['id']},'include':[{'model':db[_0x144a('0x5b')],'as':'mandatoryDispositionPause'}]})[_0x144a('0x35')](handleEntityNotFound(_0x497f5e,null))[_0x144a('0x35')](saveUpdates(_0x5bc6b2['body'],null))['then'](respondWithResult(_0x497f5e,null))[_0x144a('0x2b')](handleError(_0x497f5e,null));};exports[_0x144a('0x36')]=function(_0x4ad2e1,_0x5825e5){return db[_0x144a('0x3d')]['find']({'where':{'id':_0x4ad2e1[_0x144a('0x5a')]['id']}})[_0x144a('0x35')](handleEntityNotFound(_0x5825e5,null))[_0x144a('0x35')](removeEntity(_0x5825e5,null))[_0x144a('0x2b')](handleError(_0x5825e5,null));};exports['describe']=function(_0x444c59,_0x1a0ba0){return db[_0x144a('0x3d')][_0x144a('0x67')]()['then'](respondWithResult(_0x1a0ba0,null))[_0x144a('0x2b')](handleError(_0x1a0ba0,null));};exports['addDisposition']=function(_0x36d82e,_0x49a966,_0x160dc1){if(_0x36d82e[_0x144a('0x5e')]['id']){delete _0x36d82e[_0x144a('0x5e')]['id'];}return db[_0x144a('0x3d')][_0x144a('0x64')]({'where':{'id':_0x36d82e['params']['id']}})[_0x144a('0x35')](handleEntityNotFound(_0x49a966,null))[_0x144a('0x35')](function(_0x3bb64a){if(_0x3bb64a){_0x36d82e['body'][_0x144a('0x68')]=_0x3bb64a['id'];return db[_0x144a('0x69')][_0x144a('0x5d')](_0x36d82e[_0x144a('0x5e')]);}})[_0x144a('0x35')](respondWithResult(_0x49a966,null))['catch'](handleError(_0x49a966,null));};exports[_0x144a('0x6a')]=function(_0x274491,_0x347945,_0x221f51){var _0x578016={'raw':![],'where':{}};var _0x3ab492={};var _0x54743e={'count':0x0,'rows':[]};return db[_0x144a('0x3d')]['findOne']({'where':{'id':_0x274491[_0x144a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x347945,null))[_0x144a('0x35')](function(_0x2b5843){if(_0x2b5843){_0x3ab492[_0x144a('0x42')]=_[_0x144a('0x45')](db[_0x144a('0x69')][_0x144a('0x3e')]);_0x3ab492[_0x144a('0x46')]=_[_0x144a('0x45')](_0x274491[_0x144a('0x46')]);_0x3ab492[_0x144a('0x50')]=_[_0x144a('0x47')](_0x3ab492[_0x144a('0x42')],_0x3ab492[_0x144a('0x46')]);_0x578016[_0x144a('0x49')]=_['intersection'](_0x3ab492[_0x144a('0x42')],qs['fields'](_0x274491[_0x144a('0x46')][_0x144a('0x48')]));_0x578016[_0x144a('0x49')]=_0x578016['attributes'][_0x144a('0x4a')]?_0x578016[_0x144a('0x49')]:_0x3ab492['model'];if(!_0x274491[_0x144a('0x46')][_0x144a('0x4b')]('nolimit')){_0x578016['limit']=qs[_0x144a('0x4d')](_0x274491[_0x144a('0x46')][_0x144a('0x4d')]);_0x578016[_0x144a('0x30')]=qs[_0x144a('0x30')](_0x274491[_0x144a('0x46')][_0x144a('0x30')]);}_0x578016[_0x144a('0x6b')]=qs[_0x144a('0x4e')](_0x274491[_0x144a('0x46')]['sort']);_0x578016[_0x144a('0x4f')]=qs['filters'](_['pick'](_0x274491['query'],_0x3ab492[_0x144a('0x50')]));_0x578016[_0x144a('0x4f')][_0x144a('0x6c')]=_0x2b5843['id'];if(_0x274491[_0x144a('0x46')][_0x144a('0x52')]){_0x578016[_0x144a('0x4f')]=_[_0x144a('0x53')](_0x578016['where'],{'$or':_[_0x144a('0x43')](_0x578016['attributes'],function(_0x1521b4){var _0x1be659={};_0x1be659[_0x1521b4]={'$like':'%'+_0x274491['query'][_0x144a('0x52')]+'%'};return _0x1be659;})});}_0x578016=_[_0x144a('0x53')]({},_0x578016,_0x274491[_0x144a('0x5c')]);return db['Disposition'][_0x144a('0x2f')]({'where':_0x578016[_0x144a('0x4f')]})[_0x144a('0x35')](function(_0x82a291){_0x54743e[_0x144a('0x2f')]=_0x82a291;if(_0x274491[_0x144a('0x46')][_0x144a('0x55')]){_0x578016[_0x144a('0x56')]=[{'all':!![]}];}return db[_0x144a('0x69')]['findAll'](_0x578016);})[_0x144a('0x35')](function(_0x2e0f44){_0x54743e[_0x144a('0x58')]=_0x2e0f44;return _0x54743e;});}})[_0x144a('0x35')](respondWithFilteredResult(_0x347945,_0x578016))['catch'](handleError(_0x347945,null));};exports[_0x144a('0x6d')]=function(_0x1cc5be,_0x1e80cf,_0x9a0a72){return db[_0x144a('0x3d')][_0x144a('0x64')]({'where':{'id':_0x1cc5be[_0x144a('0x5a')]['id']}})[_0x144a('0x35')](handleEntityNotFound(_0x1e80cf,null))[_0x144a('0x35')](function(_0x1623ab){if(_0x1623ab){return _0x1623ab[_0x144a('0x6d')](_0x1cc5be[_0x144a('0x46')][_0x144a('0x6e')]);}})['then'](respondWithStatusCode(_0x1e80cf,null))[_0x144a('0x2b')](handleError(_0x1e80cf,null));};exports[_0x144a('0x6f')]=function(_0xa958cf,_0x50ca42,_0x4b2fcf){if(_0xa958cf[_0x144a('0x5e')]['id']){delete _0xa958cf['body']['id'];}return db['OpenchannelAccount'][_0x144a('0x64')]({'where':{'id':_0xa958cf[_0x144a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x50ca42,null))['then'](function(_0x52ad4b){if(_0x52ad4b){_0xa958cf['body'][_0x144a('0x6c')]=_0x52ad4b['id'];return db[_0x144a('0x70')]['create'](_0xa958cf[_0x144a('0x5e')]);}})[_0x144a('0x35')](respondWithResult(_0x50ca42,null))[_0x144a('0x2b')](handleError(_0x50ca42,null));};exports['getAnswers']=function(_0x32928e,_0x1688b3,_0x49784c){var _0x1e24e6={'raw':![],'where':{}};var _0xd2b067={};var _0x154bc2={'count':0x0,'rows':[]};return db[_0x144a('0x3d')][_0x144a('0x71')]({'where':{'id':_0x32928e[_0x144a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1688b3,null))[_0x144a('0x35')](function(_0x1b533f){if(_0x1b533f){_0xd2b067['model']=_[_0x144a('0x45')](db[_0x144a('0x70')][_0x144a('0x3e')]);_0xd2b067[_0x144a('0x46')]=_['keys'](_0x32928e['query']);_0xd2b067['filters']=_[_0x144a('0x47')](_0xd2b067[_0x144a('0x42')],_0xd2b067[_0x144a('0x46')]);_0x1e24e6[_0x144a('0x49')]=_['intersection'](_0xd2b067[_0x144a('0x42')],qs[_0x144a('0x48')](_0x32928e[_0x144a('0x46')][_0x144a('0x48')]));_0x1e24e6['attributes']=_0x1e24e6[_0x144a('0x49')][_0x144a('0x4a')]?_0x1e24e6[_0x144a('0x49')]:_0xd2b067[_0x144a('0x42')];if(!_0x32928e[_0x144a('0x46')][_0x144a('0x4b')](_0x144a('0x4c'))){_0x1e24e6[_0x144a('0x4d')]=qs[_0x144a('0x4d')](_0x32928e[_0x144a('0x46')][_0x144a('0x4d')]);_0x1e24e6[_0x144a('0x30')]=qs[_0x144a('0x30')](_0x32928e['query']['offset']);}_0x1e24e6[_0x144a('0x6b')]=qs[_0x144a('0x4e')](_0x32928e[_0x144a('0x46')][_0x144a('0x4e')]);_0x1e24e6['where']=qs['filters'](_[_0x144a('0x51')](_0x32928e[_0x144a('0x46')],_0xd2b067[_0x144a('0x50')]));_0x1e24e6[_0x144a('0x4f')][_0x144a('0x6c')]=_0x1b533f['id'];if(_0x32928e[_0x144a('0x46')][_0x144a('0x52')]){_0x1e24e6[_0x144a('0x4f')]=_[_0x144a('0x53')](_0x1e24e6[_0x144a('0x4f')],{'$or':_[_0x144a('0x43')](_0x1e24e6[_0x144a('0x49')],function(_0x299a28){var _0x638fcf={};_0x638fcf[_0x299a28]={'$like':'%'+_0x32928e['query'][_0x144a('0x52')]+'%'};return _0x638fcf;})});}_0x1e24e6=_[_0x144a('0x53')]({},_0x1e24e6,_0x32928e[_0x144a('0x5c')]);return db[_0x144a('0x70')][_0x144a('0x2f')]({'where':_0x1e24e6[_0x144a('0x4f')]})[_0x144a('0x35')](function(_0x40fb83){_0x154bc2[_0x144a('0x2f')]=_0x40fb83;if(_0x32928e[_0x144a('0x46')]['includeAll']){_0x1e24e6[_0x144a('0x56')]=[{'all':!![]}];}return db[_0x144a('0x70')][_0x144a('0x57')](_0x1e24e6);})['then'](function(_0x1a4032){_0x154bc2['rows']=_0x1a4032;return _0x154bc2;});}})[_0x144a('0x35')](respondWithFilteredResult(_0x1688b3,_0x1e24e6))[_0x144a('0x2b')](handleError(_0x1688b3,null));};exports[_0x144a('0x72')]=function(_0x5c3a42,_0x28c731,_0x47044a){return db[_0x144a('0x3d')]['find']({'where':{'id':_0x5c3a42['params']['id']}})[_0x144a('0x35')](handleEntityNotFound(_0x28c731,null))['then'](function(_0x4b241d){if(_0x4b241d){return _0x4b241d[_0x144a('0x72')](_0x5c3a42[_0x144a('0x46')][_0x144a('0x6e')]);}})[_0x144a('0x35')](respondWithStatusCode(_0x28c731,null))['catch'](handleError(_0x28c731,null));};exports[_0x144a('0x73')]=function(_0x1e65f4,_0x1740fc,_0x4aac52){var _0x149145={'body':_0x1e65f4[_0x144a('0x5e')],'channel':_0x144a('0x74')};var _0x52c098=[];var _0x5195fe=[];var _0x4880a5={};var _0x2027c9=![];return db[_0x144a('0x75')][_0x144a('0x67')]()['then'](function(_0x1852e2){if(!_0x1852e2){throw new db[(_0x144a('0x76'))]['ValidationError'](_0x144a('0x77'));}_0x52c098=_[_0x144a('0x78')](_[_0x144a('0x45')](_0x1852e2),[_0x144a('0x79'),_0x144a('0x7a')]);_0x5195fe=_[_0x144a('0x78')](_[_0x144a('0x45')](_0x1852e2),[_0x144a('0x79'),_0x144a('0x7a'),_0x144a('0x7b'),_0x144a('0x7c')]);if(_0x1e65f4[_0x144a('0x5e')]['id']){delete _0x1e65f4['body']['id'];}if(_[_0x144a('0x7d')](_0x1e65f4['body'][_0x144a('0x7e')])){throw new db[(_0x144a('0x76'))][(_0x144a('0x7f'))](_0x144a('0x80'));}if(_[_0x144a('0x7d')](_0x1e65f4[_0x144a('0x5e')]['body'])||_0x1e65f4[_0x144a('0x5e')][_0x144a('0x5e')]===''){throw new db[(_0x144a('0x76'))][(_0x144a('0x7f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x144a('0x7d')](_0x1e65f4[_0x144a('0x5e')][_0x144a('0x81')])){throw new db['Sequelize'][(_0x144a('0x7f'))](_0x144a('0x82')+_0x5195fe);}if(!_[_0x144a('0x83')](_0x5195fe,_0x1e65f4[_0x144a('0x5e')]['mapKey'])){throw new db[(_0x144a('0x76'))][(_0x144a('0x7f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5195fe);}_0x4880a5[_0x1e65f4[_0x144a('0x5e')]['mapKey']]=_0x1e65f4[_0x144a('0x5e')][_0x144a('0x7e')];})[_0x144a('0x35')](function(){return db[_0x144a('0x3d')][_0x144a('0x64')]({'where':{'id':_0x1e65f4['params']['id']},'include':[{'model':db[_0x144a('0x84')],'as':_0x144a('0x85'),'include':[{'model':db[_0x144a('0x75')],'as':_0x144a('0x86'),'where':_0x4880a5,'limit':0x1,'order':[[_0x144a('0x7a'),_0x144a('0x87')]]}]},{'model':db[_0x144a('0x88')],'as':_0x144a('0x89')}]});})[_0x144a('0x35')](handleEntityNotFound(_0x1740fc,null))[_0x144a('0x35')](function(_0x59354d){if(_0x59354d&&_0x59354d[_0x144a('0x85')]){_0x149145[_0x144a('0x8a')]=_0x59354d;_0x149145[_0x144a('0x8b')]=_0x59354d[_0x144a('0x89')];_0x149145[_0x144a('0x8c')]=_0x59354d[_0x144a('0x85')];_0x149145[_0x144a('0x8b')]=_[_0x144a('0x8d')](_0x149145[_0x144a('0x8b')],[_0x144a('0x8e')],[_0x144a('0x8f')]);if(_0x149145['account'][_0x144a('0x89')]){delete _0x149145['account'][_0x144a('0x89')];}if(_0x149145[_0x144a('0x8a')][_0x144a('0x85')]&&_0x149145[_0x144a('0x8a')][_0x144a('0x85')][_0x144a('0x86')][_0x144a('0x4a')]){return _0x149145[_0x144a('0x8a')][_0x144a('0x85')][_0x144a('0x86')][0x0];}var _0xb19052=_[_0x144a('0x1a')](_0x1e65f4[_0x144a('0x5e')],{'firstName':_0x1e65f4[_0x144a('0x5e')]['from'],'ListId':_0x59354d[_0x144a('0x7c')]});_0xb19052[_0x1e65f4['body'][_0x144a('0x81')]]=_0x1e65f4[_0x144a('0x5e')][_0x144a('0x7e')];return db[_0x144a('0x75')][_0x144a('0x5d')](_0xb19052,{'fields':_0x52c098,'raw':!![]});}})[_0x144a('0x35')](handleEntityNotFound(_0x1740fc,null))[_0x144a('0x35')](function(_0x418f1b){_0x149145[_0x144a('0x90')]=_0x418f1b;if(_0x418f1b){var _0x379450={'ContactId':_0x418f1b['id'],'OpenchannelAccountId':_0x1e65f4[_0x144a('0x5a')]['id'],'from':(_0x418f1b[_0x144a('0x91')]||'')+'\x20'+(_0x418f1b['lastName']||'')};var _0x500906={'OpenchannelAccountId':_0x1e65f4['params']['id'],'closed':![]};if(_0x1e65f4[_0x144a('0x5e')][_0x144a('0x92')]){_0x500906['threadId']=_0x1e65f4[_0x144a('0x5e')][_0x144a('0x92')];return db[_0x144a('0x93')]['find']({'where':_0x500906})[_0x144a('0x35')](function(_0x5b45bb){if(_0x5b45bb){return[_0x5b45bb,![]];}_0x379450['threadId']=_0x1e65f4[_0x144a('0x5e')]['threadId'];_0x379450['externalUrl']=_0x1e65f4[_0x144a('0x5e')]['externalUrl'];return db[_0x144a('0x93')]['create'](_0x379450)['then'](function(_0x38fb89){return[_0x38fb89,!![]];});});}else{_0x500906[_0x144a('0x92')]=null;}_0x500906['ContactId']=_0x418f1b['id'];return db[_0x144a('0x93')][_0x144a('0x64')]({'where':_0x500906})['then'](function(_0x8a83ae){if(_0x8a83ae){return[_0x8a83ae,![]];}return db[_0x144a('0x93')][_0x144a('0x5d')](_0x379450)[_0x144a('0x35')](function(_0x5d9875){return[_0x5d9875,!![]];});});}})['spread'](function(_0x18bbde,_0x4cba55){if(_0x18bbde){_0x2027c9=_0x4cba55;if(!_0x4cba55){var _0x4f0c46={'from':(_0x149145[_0x144a('0x90')][_0x144a('0x91')]||'')+'\x20'+(_0x149145[_0x144a('0x90')][_0x144a('0x94')]||'')};if(_0x1e65f4[_0x144a('0x5e')][_0x144a('0x92')]&&_0x1e65f4[_0x144a('0x5e')][_0x144a('0x95')]&&_0x1e65f4[_0x144a('0x5e')][_0x144a('0x92')]!=_0x1e65f4['body'][_0x144a('0x95')]){_0x4f0c46[_0x144a('0x92')]=_0x1e65f4['body'][_0x144a('0x95')];}return _0x18bbde[_0x144a('0x96')](_0x4f0c46);}else{return _0x18bbde;}}})['then'](function(_0x252346){_0x149145['interaction']=_0x252346[_0x144a('0x60')]({'plain':!![]});_0x149145['interaction'][_0x144a('0x97')]=_0x2027c9;if(_0x149145[_0x144a('0x98')][_0x144a('0x97')]){if(_0x149145[_0x144a('0x8a')][_0x144a('0x99')]){_0x149145['applications'][_0x144a('0x9a')]({'id':0x0,'priority':_0x149145[_0x144a('0x8b')]['length']+0x1,'app':'close','appdata':_0x144a('0x9b'),'interval':_0x144a('0x9c')});}}return db[_0x144a('0x9d')][_0x144a('0x5d')]({'body':_0x1e65f4[_0x144a('0x5e')][_0x144a('0x5e')],'OpenchannelAccountId':_0x1e65f4[_0x144a('0x5a')]['id'],'OpenchannelInteractionId':_0x252346['id'],'direction':'in','ContactId':_0x149145[_0x144a('0x90')]['id'],'AttachmentId':_0x1e65f4[_0x144a('0x5e')][_0x144a('0x9e')]});})['then'](function(_0x5c6489){_0x149145[_0x144a('0x2a')]=_0x5c6489;if(_0x149145[_0x144a('0x98')][_0x144a('0x9f')]){return db[_0x144a('0xa0')][_0x144a('0x64')]({'attributes':['id',_0x144a('0x44')],'where':{'id':_0x149145[_0x144a('0x98')]['UserId']}})['then'](function(_0x594055){if(_0x594055){_0x149145[_0x144a('0x8b')][_0x144a('0xa1')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x594055[_0x144a('0x44')]+','+(_0x149145[_0x144a('0x8a')][_0x144a('0xa2')]||0xa),'interval':_0x144a('0x9c')});_0x149145[_0x144a('0xa3')]=![];}return respondWithRpcPromise('Start',_0x144a('0xa4'),_0x149145);});}return respondWithRpcPromise(_0x144a('0xa5'),_0x144a('0xa4'),_0x149145);})[_0x144a('0x35')](function(_0x3aa1bc){respondWithRpcPromise(_0x144a('0xa6'),_0x144a('0xa6'),{'event':_0x144a('0x73'),'message':_0x3aa1bc},client9002);return _0x3aa1bc;})[_0x144a('0x35')](respondWithResult(_0x1740fc,null))[_0x144a('0x2b')](handleError(_0x1740fc,null));};exports[_0x144a('0xa7')]=function(_0x5ed559,_0x1ec270,_0x57e5b5){return db[_0x144a('0x3d')][_0x144a('0x71')]({'where':{'id':_0x5ed559[_0x144a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1ec270,null))[_0x144a('0x35')](function(_0x254371){if(_0x254371){return db[_0x144a('0xa8')][_0x144a('0xa9')](function(_0x1d0a6b){return db[_0x144a('0x88')][_0x144a('0x36')]({'where':{'OpenchannelAccountId':_0x5ed559['params']['id']},'transaction':_0x1d0a6b})[_0x144a('0x35')](function(_0x3a9417){var _0x5cb6e4=_[_0x144a('0x43')](_0x5ed559['body'],function(_0x226108){_0x226108['OpenchannelAccountId']=_0x5ed559['params']['id'];return _0x226108;});return db[_0x144a('0x88')][_0x144a('0xaa')](_0x5cb6e4,{'transaction':_0x1d0a6b});});})[_0x144a('0x35')](function(){return db[_0x144a('0x88')][_0x144a('0xab')]({'where':{'OpenchannelAccountId':_0x5ed559[_0x144a('0x5a')]['id']},'order':'priority'});});}})[_0x144a('0x35')](respondWithResult(_0x1ec270,null))[_0x144a('0x2b')](handleError(_0x1ec270,null));};exports[_0x144a('0xac')]=function(_0x18a8b4,_0x3256ce,_0x51e05d){var _0x3d8bc8={};var _0x241309={};var _0x88dd88;var _0x261122;return db[_0x144a('0x3d')][_0x144a('0x71')]({'where':{'id':_0x18a8b4[_0x144a('0x5a')]['id']}})[_0x144a('0x35')](handleEntityNotFound(_0x3256ce,null))[_0x144a('0x35')](function(_0x1f16c2){if(_0x1f16c2){_0x88dd88=_0x1f16c2;_0x241309[_0x144a('0x42')]=_['keys'](db['OpenchannelApplication'][_0x144a('0x3e')]);_0x241309[_0x144a('0x46')]=_[_0x144a('0x45')](_0x18a8b4[_0x144a('0x46')]);_0x241309[_0x144a('0x50')]=_[_0x144a('0x47')](_0x241309[_0x144a('0x42')],_0x241309[_0x144a('0x46')]);_0x3d8bc8['attributes']=_['intersection'](_0x241309[_0x144a('0x42')],qs['fields'](_0x18a8b4[_0x144a('0x46')][_0x144a('0x48')]));_0x3d8bc8[_0x144a('0x49')]=_0x3d8bc8[_0x144a('0x49')][_0x144a('0x4a')]?_0x3d8bc8[_0x144a('0x49')]:_0x241309[_0x144a('0x42')];_0x3d8bc8[_0x144a('0x6b')]=qs['sort'](_0x18a8b4[_0x144a('0x46')][_0x144a('0x4e')]);_0x3d8bc8['where']=qs[_0x144a('0x50')](_['pick'](_0x18a8b4['query'],_0x241309[_0x144a('0x50')]));if(_0x18a8b4[_0x144a('0x46')][_0x144a('0x52')]){_0x3d8bc8['where']=_['merge'](_0x3d8bc8['where'],{'$or':_[_0x144a('0x43')](_0x3d8bc8[_0x144a('0x49')],function(_0x1833fa){var _0x3fb023={};_0x3fb023[_0x1833fa]={'$like':'%'+_0x18a8b4['query'][_0x144a('0x52')]+'%'};return _0x3fb023;})});}_0x3d8bc8=_['merge']({},_0x3d8bc8,_0x18a8b4['options']);return _0x88dd88[_0x144a('0xac')](_0x3d8bc8);}})['then'](function(_0x1ad3e0){if(_0x1ad3e0){_0x261122=_0x1ad3e0[_0x144a('0x4a')];if(!_0x18a8b4[_0x144a('0x46')][_0x144a('0x4b')]('nolimit')){_0x3d8bc8['limit']=qs[_0x144a('0x4d')](_0x18a8b4[_0x144a('0x46')][_0x144a('0x4d')]);_0x3d8bc8['offset']=qs['offset'](_0x18a8b4[_0x144a('0x46')][_0x144a('0x30')]);}return _0x88dd88[_0x144a('0xac')](_0x3d8bc8);}})[_0x144a('0x35')](function(_0x48736f){if(_0x48736f){return _0x48736f?{'count':_0x261122,'rows':_0x48736f}:null;}})[_0x144a('0x35')](respondWithResult(_0x3256ce,null))[_0x144a('0x2b')](handleError(_0x3256ce,null));};exports['getInteractions']=function(_0x2426bf,_0x549927,_0x440ef2){var _0x36e586={'raw':![],'where':{}};var _0x124ffe={};var _0x221db2={'count':0x0,'rows':[]};return db[_0x144a('0x3d')][_0x144a('0x71')]({'where':{'id':_0x2426bf[_0x144a('0x5a')]['id']}})[_0x144a('0x35')](handleEntityNotFound(_0x549927,null))[_0x144a('0x35')](function(_0x45a1ab){if(_0x45a1ab){_0x124ffe[_0x144a('0x42')]=_[_0x144a('0x45')](db[_0x144a('0x93')]['rawAttributes']);_0x124ffe[_0x144a('0x46')]=_[_0x144a('0x45')](_0x2426bf[_0x144a('0x46')]);_0x124ffe[_0x144a('0x50')]=_[_0x144a('0x47')](_0x124ffe[_0x144a('0x42')],_0x124ffe[_0x144a('0x46')]);_0x36e586[_0x144a('0x49')]=_[_0x144a('0x47')](_0x124ffe[_0x144a('0x42')],qs[_0x144a('0x48')](_0x2426bf[_0x144a('0x46')][_0x144a('0x48')]));_0x36e586['attributes']=_0x36e586[_0x144a('0x49')][_0x144a('0x4a')]?_0x36e586[_0x144a('0x49')]:_0x124ffe[_0x144a('0x42')];if(!_0x2426bf['query'][_0x144a('0x4b')](_0x144a('0x4c'))){_0x36e586[_0x144a('0x4d')]=qs['limit'](_0x2426bf[_0x144a('0x46')][_0x144a('0x4d')]);_0x36e586[_0x144a('0x30')]=qs['offset'](_0x2426bf['query'][_0x144a('0x30')]);}_0x36e586[_0x144a('0x6b')]=qs[_0x144a('0x4e')](_0x2426bf[_0x144a('0x46')]['sort']);_0x36e586[_0x144a('0x4f')]=qs[_0x144a('0x50')](_[_0x144a('0x51')](_0x2426bf[_0x144a('0x46')],_0x124ffe[_0x144a('0x50')]));_0x36e586[_0x144a('0x4f')][_0x144a('0x6c')]=_0x45a1ab['id'];if(_0x2426bf[_0x144a('0x46')][_0x144a('0x52')]){_0x36e586[_0x144a('0x4f')]=_[_0x144a('0x53')](_0x36e586[_0x144a('0x4f')],{'$or':_[_0x144a('0x43')](_0x36e586[_0x144a('0x49')],function(_0x43c0dc){var _0xfec084={};_0xfec084[_0x43c0dc]={'$like':'%'+_0x2426bf[_0x144a('0x46')][_0x144a('0x52')]+'%'};return _0xfec084;})});}_0x36e586=_[_0x144a('0x53')]({},_0x36e586,_0x2426bf[_0x144a('0x5c')]);return db['OpenchannelInteraction'][_0x144a('0x2f')]({'where':_0x36e586[_0x144a('0x4f')]})[_0x144a('0x35')](function(_0x26430a){_0x221db2[_0x144a('0x2f')]=_0x26430a;if(_0x2426bf[_0x144a('0x46')][_0x144a('0x55')]){_0x36e586['include']=[{'model':db[_0x144a('0x75')],'as':_0x144a('0xad'),'required':![]},{'model':db[_0x144a('0xa0')],'as':'Owner','attributes':[_0x144a('0x44'),_0x144a('0xae'),'internal'],'required':![]},{'model':db[_0x144a('0xaf')],'as':_0x144a('0xb0'),'attributes':['id','name',_0x144a('0xb1')],'where':_0x2426bf[_0x144a('0x46')][_0x144a('0xb2')]?{'id':_0x2426bf[_0x144a('0x46')][_0x144a('0xb2')]}:undefined,'required':_0x2426bf['query']['tag']?!![]:![]}];}return db[_0x144a('0x93')][_0x144a('0x57')](_0x36e586);})[_0x144a('0x35')](function(_0x37fd95){_0x221db2[_0x144a('0x58')]=_0x37fd95;return _0x221db2;});}})[_0x144a('0x35')](respondWithFilteredResult(_0x549927,_0x36e586))[_0x144a('0x2b')](handleError(_0x549927,null));};exports[_0x144a('0xb3')]=function(_0x54a607,_0x4e19f9,_0x471b2c){return db[_0x144a('0x3d')][_0x144a('0x64')]({'where':{'id':_0x54a607[_0x144a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4e19f9,null))['then'](function(_0x3a094b){if(_0x3a094b){return _0x3a094b['addAgents'](_0x54a607['body'][_0x144a('0x6e')],_[_0x144a('0xb4')](_0x54a607[_0x144a('0x5e')],[_0x144a('0x6e'),'id'])||{})['spread'](function(_0x165b1c){for(var _0x47072a=0x0;_0x47072a<_0x54a607[_0x144a('0x5e')][_0x144a('0x6e')][_0x144a('0x4a')];_0x47072a+=0x1){socket[_0x144a('0xb5')](_0x144a('0xb6'),{'UserId':_0x54a607['body'][_0x144a('0x6e')][_0x47072a],'OpenchannelAccountId':_0x54a607[_0x144a('0x5a')]['id']});}return _0x165b1c;});}})[_0x144a('0x35')](respondWithResult(_0x4e19f9,null))['catch'](handleError(_0x4e19f9,null));};exports[_0x144a('0xb7')]=function(_0x516fb0,_0x11e4a9,_0x224b26){return db[_0x144a('0x3d')]['find']({'where':{'id':_0x516fb0[_0x144a('0x5a')]['id']}})[_0x144a('0x35')](handleEntityNotFound(_0x11e4a9,null))[_0x144a('0x35')](function(_0xf7bab8){if(_0xf7bab8){return _0xf7bab8['removeAgents'](_0x516fb0['query'][_0x144a('0x6e')])[_0x144a('0x35')](function(){if(_[_0x144a('0xb8')](_0x516fb0[_0x144a('0x46')][_0x144a('0x6e')])){for(var _0x58a3d8=0x0;_0x58a3d8<_0x516fb0[_0x144a('0x46')]['ids']['length'];_0x58a3d8+=0x1){socket[_0x144a('0xb5')](_0x144a('0xb9'),{'UserId':Number(_0x516fb0[_0x144a('0x46')][_0x144a('0x6e')][_0x58a3d8]),'OpenchannelAccountId':Number(_0x516fb0[_0x144a('0x5a')]['id'])});}}else{socket[_0x144a('0xb5')](_0x144a('0xb9'),{'UserId':Number(_0x516fb0[_0x144a('0x46')]['ids']),'OpenchannelAccountId':Number(_0x516fb0[_0x144a('0x5a')]['id'])});}});}})[_0x144a('0x35')](respondWithStatusCode(_0x11e4a9,null))[_0x144a('0x2b')](handleError(_0x11e4a9,null));};exports[_0x144a('0xba')]=function(_0xa4d914,_0x2e6608,_0x491495){var _0x3c570a={};var _0x4529c8={};var _0x763647;var _0x3012f6;return db[_0x144a('0x3d')]['findOne']({'where':{'id':_0xa4d914[_0x144a('0x5a')]['id']}})[_0x144a('0x35')](handleEntityNotFound(_0x2e6608,null))[_0x144a('0x35')](function(_0x1fb2ac){if(_0x1fb2ac){_0x763647=_0x1fb2ac;_0x4529c8[_0x144a('0x42')]=_[_0x144a('0x45')](db[_0x144a('0xa0')]['rawAttributes']);_0x4529c8['query']=_[_0x144a('0x45')](_0xa4d914[_0x144a('0x46')]);_0x4529c8[_0x144a('0x50')]=_[_0x144a('0x47')](_0x4529c8[_0x144a('0x42')],_0x4529c8['query']);_0x3c570a[_0x144a('0x49')]=_['intersection'](_0x4529c8[_0x144a('0x42')],qs[_0x144a('0x48')](_0xa4d914[_0x144a('0x46')][_0x144a('0x48')]));_0x3c570a[_0x144a('0x49')]=_0x3c570a[_0x144a('0x49')][_0x144a('0x4a')]?_0x3c570a['attributes']:_0x4529c8[_0x144a('0x42')];_0x3c570a[_0x144a('0x6b')]=qs[_0x144a('0x4e')](_0xa4d914[_0x144a('0x46')][_0x144a('0x4e')]);_0x3c570a[_0x144a('0x4f')]=qs[_0x144a('0x50')](_[_0x144a('0x51')](_0xa4d914[_0x144a('0x46')],_0x4529c8[_0x144a('0x50')]));if(_0xa4d914['query']['filter']){_0x3c570a[_0x144a('0x4f')]=_[_0x144a('0x53')](_0x3c570a['where'],{'$or':_[_0x144a('0x43')](_0x3c570a[_0x144a('0x49')],function(_0xd474e2){var _0x34006e={};_0x34006e[_0xd474e2]={'$like':'%'+_0xa4d914[_0x144a('0x46')][_0x144a('0x52')]+'%'};return _0x34006e;})});}_0x3c570a=_[_0x144a('0x53')]({},_0x3c570a,_0xa4d914[_0x144a('0x5c')]);return _0x763647['getAgents'](_0x3c570a);}})['then'](function(_0xbe4083){if(_0xbe4083){_0x3012f6=_0xbe4083[_0x144a('0x4a')];if(!_0xa4d914[_0x144a('0x46')][_0x144a('0x4b')]('nolimit')){_0x3c570a['limit']=qs[_0x144a('0x4d')](_0xa4d914[_0x144a('0x46')][_0x144a('0x4d')]);_0x3c570a[_0x144a('0x30')]=qs[_0x144a('0x30')](_0xa4d914[_0x144a('0x46')]['offset']);}return _0x763647[_0x144a('0xba')](_0x3c570a);}})['then'](function(_0x4b7a7e){if(_0x4b7a7e){return _0x4b7a7e?{'count':_0x3012f6,'rows':_0x4b7a7e}:null;}})['then'](respondWithResult(_0x2e6608,null))[_0x144a('0x2b')](handleError(_0x2e6608,null));};exports[_0x144a('0x3a')]=function(_0x1f7c1b,_0x115326,_0x564936){var _0x478cfd,_0x1cd9ba,_0x63c411;if(_[_0x144a('0x7d')](_0x1f7c1b[_0x144a('0x5e')]['body'])||_0x1f7c1b[_0x144a('0x5e')]['body']===''){throw new db[(_0x144a('0x76'))][(_0x144a('0x7f'))](_0x144a('0xbb'));}if(_[_0x144a('0x7d')](_0x1f7c1b['body']['to'])){}_0x478cfd=_0x1f7c1b[_0x144a('0x5e')]['to'];return db[_0x144a('0x3d')][_0x144a('0x71')]({'where':{'id':_0x1f7c1b[_0x144a('0x5a')]['id']}})[_0x144a('0x35')](handleEntityNotFound(_0x115326,null))['then'](function(_0x14b6b4){if(_0x14b6b4){return db[_0x144a('0x3d')][_0x144a('0x64')]({'where':{'id':_0x14b6b4['id']},'include':[{'model':db[_0x144a('0x84')],'as':_0x144a('0x85'),'include':[{'model':db[_0x144a('0x75')],'as':_0x144a('0x86'),'where':{[_0x14b6b4[_0x144a('0x81')]]:_0x478cfd},'limit':0x1,'order':[[_0x144a('0x7a'),_0x144a('0x87')]]}]}]})[_0x144a('0x35')](handleEntityNotFound(_0x115326,null))['then'](function(_0x271af9){if(_0x271af9&&_0x271af9[_0x144a('0x85')]){_0x1cd9ba=_0x271af9[_0x144a('0x60')]({'plain':!![]});if(_0x1cd9ba[_0x144a('0x85')]&&_0x1cd9ba['List'][_0x144a('0x86')]['length']){return _0x1cd9ba['List'][_0x144a('0x86')][0x0];}return db[_0x144a('0x75')]['create'](_[_0x144a('0x1a')](_0x1f7c1b[_0x144a('0x5e')],{'firstName':_0x478cfd,[_0x271af9[_0x144a('0x81')]]:_0x478cfd,'phone':_0x478cfd,'ListId':_0x1cd9ba['ListId']}));}})[_0x144a('0x35')](handleEntityNotFound(_0x115326,null))['then'](function(_0xeb0307){if(_0xeb0307){_0x63c411=_0xeb0307;return db[_0x144a('0x93')][_0x144a('0x64')]({'where':{'ContactId':_0x63c411['id'],'closed':![],'OpenchannelAccountId':_0x1cd9ba['id']}})[_0x144a('0x35')](function(_0xde5725){if(_0xde5725){return[_0xde5725,![]];}return db[_0x144a('0x93')]['create']({'UserId':_0x1f7c1b[_0x144a('0x5f')]['id'],'ContactId':_0x63c411['id'],'OpenchannelAccountId':_0x1cd9ba['id'],'lastMsgDirection':_0x144a('0xbc'),'Messages':[_[_0x144a('0x53')](_0x1f7c1b[_0x144a('0x5e')],{'read':![],'body':_0x1f7c1b['body']['body'],'OpenchannelAccountId':_0x1cd9ba['id'],'UserId':_0x1f7c1b[_0x144a('0x5f')]['id'],'ContactId':_0x63c411['id']})]},{'include':[{'model':db[_0x144a('0x9d')],'as':_0x144a('0xbd')}]})[_0x144a('0x35')](function(_0x13b77f){return[_0x13b77f,!![]];});});}})['spread'](function(_0x4bc561,_0x5d9c15){if(_0x5d9c15){return _0x4bc561;}return db[_0x144a('0x9d')][_0x144a('0x5d')](_['merge'](_0x1f7c1b[_0x144a('0x5e')],{'read':![],'body':_0x1f7c1b['body']['body'],'OpenchannelAccountId':_0x1cd9ba['id'],'OpenchannelInteractionId':_0x4bc561['id'],'UserId':_0x1f7c1b['user']['id'],'ContactId':_0x63c411['id']}))[_0x144a('0x35')](function(_0x2ef8b8){_0x4bc561[_0x144a('0xbe')][_0x144a('0xbd')]=[];_0x4bc561['dataValues'][_0x144a('0xbd')]['push'](_0x2ef8b8[_0x144a('0xbe')]);return _0x4bc561;});});}})[_0x144a('0x35')](respondWithResult(_0x115326,null))[_0x144a('0x2b')](handleError(_0x115326,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index e13a369..6b49d1f 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 _0xf7c5=['exports','events','OpenchannelAccount','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xf7c5,0xa9));var _0x5f7c=function(_0x44e00a,_0x248bbc){_0x44e00a=_0x44e00a-0x0;var _0x2bdfba=_0xf7c5[_0x44e00a];return _0x2bdfba;};'use strict';var EventEmitter=require(_0x5f7c('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x5f7c('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x5f7c('0x2')](0x0);var events={'afterCreate':_0x5f7c('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1def70){return function(_0x2594d9,_0x430ab4,_0xc92946){OpenchannelAccountEvents[_0x5f7c('0x4')](_0x1def70+':'+_0x2594d9['id'],_0x2594d9);OpenchannelAccountEvents[_0x5f7c('0x4')](_0x1def70,_0x2594d9);_0xc92946(null);};}for(var e in events){if(events[_0x5f7c('0x5')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x5f7c('0x6')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xc488=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0xd6657b,_0x44dc6b){var _0x46c453=function(_0x3c8ad3){while(--_0x3c8ad3){_0xd6657b['push'](_0xd6657b['shift']());}};_0x46c453(++_0x44dc6b);}(_0xc488,0x18c));var _0x8c48=function(_0x3762a9,_0x58bcff){_0x3762a9=_0x3762a9-0x0;var _0x4ce905=_0xc488[_0x3762a9];return _0x4ce905;};'use strict';var EventEmitter=require(_0x8c48('0x0'));var OpenchannelAccount=require(_0x8c48('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8c48('0x2')](0x0);var events={'afterCreate':_0x8c48('0x3'),'afterUpdate':_0x8c48('0x4'),'afterDestroy':_0x8c48('0x5')};function emitEvent(_0x160829){return function(_0x3e7625,_0x4e2ffd,_0x1b559c){OpenchannelAccountEvents[_0x8c48('0x6')](_0x160829+':'+_0x3e7625['id'],_0x3e7625);OpenchannelAccountEvents[_0x8c48('0x6')](_0x160829,_0x3e7625);_0x1b559c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x8c48('0x7')](e,emitEvent(event));}}module[_0x8c48('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 4d3b8b1..f0380c8 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 _0x2167=['rimraf','exports','define','OpenchannelAccount','openchannel_accounts','lodash','util','api','moment','request-promise','path'];(function(_0x2629db,_0x317a0d){var _0x23c846=function(_0xc7f372){while(--_0xc7f372){_0x2629db['push'](_0x2629db['shift']());}};_0x23c846(++_0x317a0d);}(_0x2167,0xaa));var _0x7216=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x2167[_0x1f9f37];return _0x21c080;};'use strict';var _=require(_0x7216('0x0'));var util=require(_0x7216('0x1'));var logger=require('../../config/logger')(_0x7216('0x2'));var moment=require(_0x7216('0x3'));var BPromise=require('bluebird');var rp=require(_0x7216('0x4'));var fs=require('fs');var path=require(_0x7216('0x5'));var rimraf=require(_0x7216('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelAccount.attributes');module[_0x7216('0x7')]=function(_0x2d4bcc,_0x3eb049){return _0x2d4bcc[_0x7216('0x8')](_0x7216('0x9'),attributes,{'tableName':_0x7216('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7850=['bluebird','request-promise','path','rimraf','./openchannelAccount.attributes','exports','define','OpenchannelAccount','openchannel_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x209ec9,_0x30378c){var _0x129b1b=function(_0x2f2b9e){while(--_0x2f2b9e){_0x209ec9['push'](_0x209ec9['shift']());}};_0x129b1b(++_0x30378c);}(_0x7850,0x1e5));var _0x0785=function(_0x34349e,_0x41b617){_0x34349e=_0x34349e-0x0;var _0x22593d=_0x7850[_0x34349e];return _0x22593d;};'use strict';var _=require(_0x0785('0x0'));var util=require(_0x0785('0x1'));var logger=require(_0x0785('0x2'))(_0x0785('0x3'));var moment=require(_0x0785('0x4'));var BPromise=require(_0x0785('0x5'));var rp=require(_0x0785('0x6'));var fs=require('fs');var path=require(_0x0785('0x7'));var rimraf=require(_0x0785('0x8'));var config=require('../../config/environment');var attributes=require(_0x0785('0x9'));module[_0x0785('0xa')]=function(_0x2f6192,_0x5d58e6){return _0x2f6192[_0x0785('0xb')](_0x0785('0xc'),attributes,{'tableName':_0x0785('0xd'),'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 bb187a6..ab5903d 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 _0x19c3=['bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x5a6a1f,_0x5ce170){var _0x1a17bd=function(_0x5012da){while(--_0x5012da){_0x5a6a1f['push'](_0x5a6a1f['shift']());}};_0x1a17bd(++_0x5ce170);}(_0x19c3,0x15d));var _0x319c=function(_0x2ee687,_0x58b317){_0x2ee687=_0x2ee687-0x0;var _0x2cc00b=_0x19c3[_0x2ee687];return _0x2cc00b;};'use strict';var _=require(_0x319c('0x0'));var util=require(_0x319c('0x1'));var moment=require('moment');var BPromise=require(_0x319c('0x2'));var rs=require(_0x319c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x319c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x319c('0x5'));var config=require(_0x319c('0x6'));var jayson=require(_0x319c('0x7'));var client=jayson[_0x319c('0x8')][_0x319c('0x9')]({'port':0x232a});config[_0x319c('0xa')]=_[_0x319c('0xb')](config[_0x319c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x319c('0xc'))(new Redis(config[_0x319c('0xa')]));require(_0x319c('0xd'))[_0x319c('0xe')](socket);function respondWithRpcPromise(_0x2b536a,_0x5b8f17,_0x3edbbb){return new BPromise(function(_0x3d7d8e,_0x550d43){return client[_0x319c('0xf')](_0x2b536a,_0x3edbbb)[_0x319c('0x10')](function(_0x1363e9){logger[_0x319c('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x5b8f17,_0x319c('0x12'));logger[_0x319c('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5b8f17,_0x319c('0x12'),JSON[_0x319c('0x14')](_0x1363e9));if(_0x1363e9[_0x319c('0x15')]){if(_0x1363e9['error'][_0x319c('0x16')]===0x1f4){logger[_0x319c('0x15')](_0x319c('0x17'),_0x5b8f17,_0x1363e9[_0x319c('0x15')][_0x319c('0x18')]);return _0x550d43(_0x1363e9[_0x319c('0x15')][_0x319c('0x18')]);}logger[_0x319c('0x15')](_0x319c('0x17'),_0x5b8f17,_0x1363e9[_0x319c('0x15')][_0x319c('0x18')]);return _0x3d7d8e(_0x1363e9['error'][_0x319c('0x18')]);}else{logger[_0x319c('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x5b8f17,_0x319c('0x12'));_0x3d7d8e(_0x1363e9[_0x319c('0x19')]['message']);}})[_0x319c('0x1a')](function(_0x21b1f6){logger[_0x319c('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x5b8f17,_0x21b1f6);_0x550d43(_0x21b1f6);});});} \ No newline at end of file +var _0x552b=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','request','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','OpenchannelAccount,\x20%s,\x20%s','message'];(function(_0x4b8ba3,_0x53bf4b){var _0xbbff1a=function(_0x3e99c5){while(--_0x3e99c5){_0x4b8ba3['push'](_0x4b8ba3['shift']());}};_0xbbff1a(++_0x53bf4b);}(_0x552b,0x16d));var _0xb552=function(_0x8343a2,_0x2a068f){_0x8343a2=_0x8343a2-0x0;var _0x5eb92d=_0x552b[_0x8343a2];return _0x5eb92d;};'use strict';var _=require(_0xb552('0x0'));var util=require('util');var moment=require(_0xb552('0x1'));var BPromise=require(_0xb552('0x2'));var rs=require(_0xb552('0x3'));var fs=require('fs');var Redis=require(_0xb552('0x4'));var db=require(_0xb552('0x5'))['db'];var utils=require(_0xb552('0x6'));var logger=require(_0xb552('0x7'))(_0xb552('0x8'));var config=require(_0xb552('0x9'));var jayson=require(_0xb552('0xa'));var client=jayson[_0xb552('0xb')][_0xb552('0xc')]({'port':0x232a});config[_0xb552('0xd')]=_['defaults'](config['redis'],{'host':_0xb552('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb552('0xd')]));require('./openchannelAccount.socket')[_0xb552('0xf')](socket);function respondWithRpcPromise(_0x30fc1f,_0x4be8bc,_0x572bea){return new BPromise(function(_0x37419f,_0x1a6ec9){return client[_0xb552('0x10')](_0x30fc1f,_0x572bea)['then'](function(_0x332c1a){logger[_0xb552('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x4be8bc,_0xb552('0x12'));logger[_0xb552('0x13')](_0xb552('0x14'),_0x4be8bc,'request\x20sent',JSON['stringify'](_0x332c1a));if(_0x332c1a[_0xb552('0x15')]){if(_0x332c1a['error'][_0xb552('0x16')]===0x1f4){logger[_0xb552('0x15')](_0xb552('0x17'),_0x4be8bc,_0x332c1a[_0xb552('0x15')]['message']);return _0x1a6ec9(_0x332c1a[_0xb552('0x15')][_0xb552('0x18')]);}logger[_0xb552('0x15')](_0xb552('0x17'),_0x4be8bc,_0x332c1a[_0xb552('0x15')][_0xb552('0x18')]);return _0x37419f(_0x332c1a[_0xb552('0x15')][_0xb552('0x18')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x4be8bc,'request\x20sent');_0x37419f(_0x332c1a['result']['message']);}})[_0xb552('0x19')](function(_0x1b61c1){logger['error'](_0xb552('0x17'),_0x4be8bc,_0x1b61c1);_0x1a6ec9(_0x1b61c1);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index e541c90..5918bf4 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 _0x2b4e=['save','update','emit','register','openchannelAccount:','./openchannelAccount.events'];(function(_0x48c33e,_0x39c833){var _0x45519a=function(_0x2b4207){while(--_0x2b4207){_0x48c33e['push'](_0x48c33e['shift']());}};_0x45519a(++_0x39c833);}(_0x2b4e,0x65));var _0xe2b4=function(_0x80f51a,_0x32e95e){_0x80f51a=_0x80f51a-0x0;var _0x327148=_0x2b4e[_0x80f51a];return _0x327148;};'use strict';var OpenchannelAccountEvents=require(_0xe2b4('0x0'));var events=[_0xe2b4('0x1'),'remove',_0xe2b4('0x2')];function createListener(_0xb02ad6,_0x387ec6){return function(_0x122407){_0x387ec6[_0xe2b4('0x3')](_0xb02ad6,_0x122407);};}function removeListener(_0x3e4a4f,_0x246871){return function(){OpenchannelAccountEvents['removeListener'](_0x3e4a4f,_0x246871);};}exports[_0xe2b4('0x4')]=function(_0x5651d6){for(var _0x1b4bd6=0x0,_0x28449c=events['length'];_0x1b4bd6<_0x28449c;_0x1b4bd6++){var _0x50f577=events[_0x1b4bd6];var _0x4b87a8=createListener(_0xe2b4('0x5')+_0x50f577,_0x5651d6);OpenchannelAccountEvents['on'](_0x50f577,_0x4b87a8);}}; \ No newline at end of file +var _0x10a4=['length','openchannelAccount:','./openchannelAccount.events','save','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10a4,0x15e));var _0x410a=function(_0x75ce5b,_0x3b582f){_0x75ce5b=_0x75ce5b-0x0;var _0x22195e=_0x10a4[_0x75ce5b];return _0x22195e;};'use strict';var OpenchannelAccountEvents=require(_0x410a('0x0'));var events=[_0x410a('0x1'),'remove','update'];function createListener(_0x109a8c,_0x460d5f){return function(_0x1ef59e){_0x460d5f[_0x410a('0x2')](_0x109a8c,_0x1ef59e);};}function removeListener(_0xd001c0,_0x19df33){return function(){OpenchannelAccountEvents[_0x410a('0x3')](_0xd001c0,_0x19df33);};}exports['register']=function(_0x5345a4){for(var _0xd4e4aa=0x0,_0x2d4862=events[_0x410a('0x4')];_0xd4e4aa<_0x2d4862;_0xd4e4aa++){var _0xb4791f=events[_0xd4e4aa];var _0x16f468=createListener(_0x410a('0x5')+_0xb4791f,_0x5345a4);OpenchannelAccountEvents['on'](_0xb4791f,_0x16f468);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index ac66599..906a88e 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 _0x5858=['../../components/interaction/service','get','isAuthenticated','/:id','post','create','put','delete','destroy','exports','multer','util','path','express','../../components/auth/service'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x5858,0x1cc));var _0x8585=function(_0x2f6d97,_0x5a9889){_0x2f6d97=_0x2f6d97-0x0;var _0x5da3af=_0x5858[_0x2f6d97];return _0x5da3af;};'use strict';var multer=require(_0x8585('0x0'));var util=require(_0x8585('0x1'));var path=require(_0x8585('0x2'));var timeout=require('connect-timeout');var express=require(_0x8585('0x3'));var router=express['Router']();var auth=require(_0x8585('0x4'));var interaction=require(_0x8585('0x5'));var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0x8585('0x6')]('/',auth[_0x8585('0x7')](),controller['index']);router[_0x8585('0x6')](_0x8585('0x8'),auth[_0x8585('0x7')](),controller['show']);router[_0x8585('0x9')]('/',auth[_0x8585('0x7')](),controller[_0x8585('0xa')]);router[_0x8585('0xb')]('/:id',auth[_0x8585('0x7')](),controller['update']);router[_0x8585('0xc')](_0x8585('0x8'),auth[_0x8585('0x7')](),controller[_0x8585('0xd')]);module[_0x8585('0xe')]=router; \ No newline at end of file +var _0xb61c=['destroy','exports','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete'];(function(_0x3220bb,_0x342a03){var _0x23415c=function(_0x56cc05){while(--_0x56cc05){_0x3220bb['push'](_0x3220bb['shift']());}};_0x23415c(++_0x342a03);}(_0xb61c,0x9b));var _0xcb61=function(_0x2f4e32,_0x418e02){_0x2f4e32=_0x2f4e32-0x0;var _0x36520d=_0xb61c[_0x2f4e32];return _0x36520d;};'use strict';var multer=require('multer');var util=require(_0xcb61('0x0'));var path=require('path');var timeout=require(_0xcb61('0x1'));var express=require(_0xcb61('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xcb61('0x3'));var config=require(_0xcb61('0x4'));var controller=require(_0xcb61('0x5'));router[_0xcb61('0x6')]('/',auth[_0xcb61('0x7')](),controller[_0xcb61('0x8')]);router['get'](_0xcb61('0x9'),auth[_0xcb61('0x7')](),controller[_0xcb61('0xa')]);router['post']('/',auth[_0xcb61('0x7')](),controller[_0xcb61('0xb')]);router[_0xcb61('0xc')](_0xcb61('0x9'),auth[_0xcb61('0x7')](),controller[_0xcb61('0xd')]);router[_0xcb61('0xe')](_0xcb61('0x9'),auth['isAuthenticated'](),controller[_0xcb61('0xf')]);module[_0xcb61('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index cf16f68..ae1a6b8 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 _0xdfe7=['*,*,*,*','sequelize','STRING','TEXT'];(function(_0x255ab0,_0x15c694){var _0x251be0=function(_0xf3efed){while(--_0xf3efed){_0x255ab0['push'](_0x255ab0['shift']());}};_0x251be0(++_0x15c694);}(_0xdfe7,0x69));var _0x7dfe=function(_0x35d4a1,_0x2d5827){_0x35d4a1=_0x35d4a1-0x0;var _0x57fa02=_0xdfe7[_0x35d4a1];return _0x57fa02;};'use strict';var Sequelize=require(_0x7dfe('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x7dfe('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7dfe('0x2')]()},'description':{'type':Sequelize[_0x7dfe('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7dfe('0x3')}}; \ No newline at end of file +var _0xcd3c=['noop','TEXT','INTEGER'];(function(_0x36d320,_0x90ee6b){var _0x4a1e05=function(_0x21b818){while(--_0x21b818){_0x36d320['push'](_0x36d320['shift']());}};_0x4a1e05(++_0x90ee6b);}(_0xcd3c,0xdd));var _0xccd3=function(_0x27f092,_0x563fc0){_0x27f092=_0x27f092-0x0;var _0x5edc71=_0xcd3c[_0x27f092];return _0x5edc71;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xccd3('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xccd3('0x1')},'appdata':{'type':Sequelize[_0xccd3('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index ab6b434..4b2fe29 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 _0x2e41=['sendStatus','error','stack','name','send','index','OpenchannelApplication','rawAttributes','type','model','map','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','query','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','save','then'];(function(_0x51ca23,_0x5a055f){var _0x23ef2e=function(_0x41982f){while(--_0x41982f){_0x51ca23['push'](_0x51ca23['shift']());}};_0x23ef2e(++_0x5a055f);}(_0x2e41,0x150));var _0x12e4=function(_0x566438,_0x3abb6a){_0x566438=_0x566438-0x0;var _0x2d8c26=_0x2e41[_0x566438];return _0x2d8c26;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x12e4('0x0'));var rimraf=require(_0x12e4('0x1'));var zipdir=require(_0x12e4('0x2'));var jsonpatch=require(_0x12e4('0x3'));var rp=require(_0x12e4('0x4'));var moment=require(_0x12e4('0x5'));var BPromise=require(_0x12e4('0x6'));var Mustache=require(_0x12e4('0x7'));var util=require(_0x12e4('0x8'));var path=require(_0x12e4('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x12e4('0xa'));var fs=require('fs');var _=require(_0x12e4('0xb'));var squel=require('squel');var crypto=require(_0x12e4('0xc'));var jsforce=require(_0x12e4('0xd'));var deskjs=require(_0x12e4('0xe'));var toCsv=require('to-csv');var querystring=require(_0x12e4('0xf'));var Papa=require(_0x12e4('0x10'));var Redis=require('ioredis');var authService=require(_0x12e4('0x11'));var qs=require(_0x12e4('0x12'));var as=require(_0x12e4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x12e4('0x14'))(_0x12e4('0x15'));var utils=require(_0x12e4('0x16'));var config=require(_0x12e4('0x17'));var db=require(_0x12e4('0x18'))['db'];function respondWithStatusCode(_0x5535c2,_0x3aa1c0){_0x3aa1c0=_0x3aa1c0||0xcc;return function(_0x5060df){if(_0x5060df){return _0x5535c2['sendStatus'](_0x3aa1c0);}return _0x5535c2[_0x12e4('0x19')](_0x3aa1c0)[_0x12e4('0x1a')]();};}function respondWithResult(_0x455edd,_0x2e0ba3){_0x2e0ba3=_0x2e0ba3||0xc8;return function(_0x8374a2){if(_0x8374a2){return _0x455edd[_0x12e4('0x19')](_0x2e0ba3)[_0x12e4('0x1b')](_0x8374a2);}};}function respondWithFilteredResult(_0xee3b9d,_0xcb649){return function(_0x190ff6){if(_0x190ff6){var _0x500cd0=_0x190ff6[_0x12e4('0x1c')],_0x3a3caa=_0xcb649[_0x12e4('0x1d')],_0x1f750f=_0xcb649[_0x12e4('0x1d')]+_0xcb649['limit'],_0x367cdc;if(_0x1f750f>=_0x500cd0){_0x1f750f=_0x500cd0;_0x367cdc=0xc8;}else{_0x367cdc=0xce;}_0xee3b9d[_0x12e4('0x19')](_0x367cdc);return _0xee3b9d[_0x12e4('0x1e')](_0x12e4('0x1f'),_0x3a3caa+'-'+_0x1f750f+'/'+_0x500cd0)[_0x12e4('0x1b')](_0x190ff6);}return null;};}function patchUpdates(_0x34abdf){return function(_0x426b49){try{jsonpatch['apply'](_0x426b49,_0x34abdf,!![]);}catch(_0x5c89bf){return BPromise['reject'](_0x5c89bf);}return _0x426b49[_0x12e4('0x20')]();};}function saveUpdates(_0x36c8fd,_0x3ce960){return function(_0x4d36f3){if(_0x4d36f3){return _0x4d36f3['update'](_0x36c8fd)[_0x12e4('0x21')](function(_0x5681e0){return _0x5681e0;});}return null;};}function removeEntity(_0x543f4c,_0x1fc2b7){return function(_0x523e14){if(_0x523e14){return _0x523e14['destroy']()[_0x12e4('0x21')](function(){_0x543f4c[_0x12e4('0x19')](0xcc)[_0x12e4('0x1a')]();});}};}function handleEntityNotFound(_0x1c0d4a,_0x171a2c){return function(_0x10bac4){if(!_0x10bac4){_0x1c0d4a[_0x12e4('0x22')](0x194);}return _0x10bac4;};}function handleError(_0x5cc240,_0x4f9756){_0x4f9756=_0x4f9756||0x1f4;return function(_0x5c71d4){logger[_0x12e4('0x23')](_0x5c71d4[_0x12e4('0x24')]);if(_0x5c71d4[_0x12e4('0x25')]){delete _0x5c71d4[_0x12e4('0x25')];}_0x5cc240[_0x12e4('0x19')](_0x4f9756)[_0x12e4('0x26')](_0x5c71d4);};}exports[_0x12e4('0x27')]=function(_0x8ad9de,_0x439119){var _0x168805={},_0x4f2f34={},_0x5bf9a5={'count':0x0,'rows':[]};var _0x7b952b=_['map'](db[_0x12e4('0x28')][_0x12e4('0x29')],function(_0x21dbb7){return{'name':_0x21dbb7['fieldName'],'type':_0x21dbb7[_0x12e4('0x2a')]['key']};});_0x4f2f34[_0x12e4('0x2b')]=_[_0x12e4('0x2c')](_0x7b952b,_0x12e4('0x25'));_0x4f2f34['query']=_[_0x12e4('0x2d')](_0x8ad9de['query']);_0x4f2f34[_0x12e4('0x2e')]=_[_0x12e4('0x2f')](_0x4f2f34[_0x12e4('0x2b')],_0x4f2f34['query']);_0x168805[_0x12e4('0x30')]=_[_0x12e4('0x2f')](_0x4f2f34['model'],qs['fields'](_0x8ad9de['query'][_0x12e4('0x31')]));_0x168805[_0x12e4('0x30')]=_0x168805['attributes']['length']?_0x168805[_0x12e4('0x30')]:_0x4f2f34[_0x12e4('0x2b')];if(!_0x8ad9de['query'][_0x12e4('0x32')](_0x12e4('0x33'))){_0x168805[_0x12e4('0x34')]=qs[_0x12e4('0x34')](_0x8ad9de['query'][_0x12e4('0x34')]);_0x168805['offset']=qs['offset'](_0x8ad9de[_0x12e4('0x35')][_0x12e4('0x1d')]);}_0x168805[_0x12e4('0x36')]=qs[_0x12e4('0x37')](_0x8ad9de[_0x12e4('0x35')][_0x12e4('0x37')]);_0x168805['where']=qs[_0x12e4('0x2e')](_[_0x12e4('0x38')](_0x8ad9de[_0x12e4('0x35')],_0x4f2f34[_0x12e4('0x2e')]),_0x7b952b);if(_0x8ad9de['query'][_0x12e4('0x39')]){_0x168805[_0x12e4('0x3a')]=_[_0x12e4('0x3b')](_0x168805[_0x12e4('0x3a')],{'$or':_[_0x12e4('0x2c')](_0x7b952b,function(_0x369e94){if(_0x369e94[_0x12e4('0x2a')]!==_0x12e4('0x3c')){var _0x20a0e9={};_0x20a0e9[_0x369e94[_0x12e4('0x25')]]={'$like':'%'+_0x8ad9de[_0x12e4('0x35')]['filter']+'%'};return _0x20a0e9;}})});}_0x168805=_['merge']({},_0x168805,_0x8ad9de[_0x12e4('0x3d')]);var _0x52d176={'where':_0x168805[_0x12e4('0x3a')]};return db['OpenchannelApplication'][_0x12e4('0x1c')](_0x52d176)[_0x12e4('0x21')](function(_0x1ef122){_0x5bf9a5[_0x12e4('0x1c')]=_0x1ef122;if(_0x8ad9de[_0x12e4('0x35')][_0x12e4('0x3e')]){_0x168805[_0x12e4('0x3f')]=[{'all':!![]}];}return db[_0x12e4('0x28')][_0x12e4('0x40')](_0x168805);})[_0x12e4('0x21')](function(_0x8b1c78){_0x5bf9a5[_0x12e4('0x41')]=_0x8b1c78;return _0x5bf9a5;})['then'](respondWithFilteredResult(_0x439119,_0x168805))[_0x12e4('0x42')](handleError(_0x439119,null));};exports[_0x12e4('0x43')]=function(_0x1ef8e6,_0x137a3b){var _0x66bdde={'raw':!![],'where':{'id':_0x1ef8e6[_0x12e4('0x44')]['id']}},_0x3b13e0={};_0x3b13e0[_0x12e4('0x2b')]=_[_0x12e4('0x2d')](db[_0x12e4('0x28')][_0x12e4('0x29')]);_0x3b13e0[_0x12e4('0x35')]=_[_0x12e4('0x2d')](_0x1ef8e6['query']);_0x3b13e0[_0x12e4('0x2e')]=_[_0x12e4('0x2f')](_0x3b13e0[_0x12e4('0x2b')],_0x3b13e0[_0x12e4('0x35')]);_0x66bdde[_0x12e4('0x30')]=_[_0x12e4('0x2f')](_0x3b13e0[_0x12e4('0x2b')],qs['fields'](_0x1ef8e6[_0x12e4('0x35')][_0x12e4('0x31')]));_0x66bdde[_0x12e4('0x30')]=_0x66bdde['attributes'][_0x12e4('0x45')]?_0x66bdde[_0x12e4('0x30')]:_0x3b13e0['model'];if(_0x1ef8e6[_0x12e4('0x35')]['includeAll']){_0x66bdde[_0x12e4('0x3f')]=[{'all':!![]}];}_0x66bdde=_['merge']({},_0x66bdde,_0x1ef8e6['options']);return db[_0x12e4('0x28')][_0x12e4('0x46')](_0x66bdde)[_0x12e4('0x21')](handleEntityNotFound(_0x137a3b,null))[_0x12e4('0x21')](respondWithResult(_0x137a3b,null))[_0x12e4('0x42')](handleError(_0x137a3b,null));};exports['create']=function(_0x2c3b20,_0x3c0a33){return db[_0x12e4('0x28')][_0x12e4('0x47')](_0x2c3b20[_0x12e4('0x48')],{})[_0x12e4('0x21')](respondWithResult(_0x3c0a33,0xc9))[_0x12e4('0x42')](handleError(_0x3c0a33,null));};exports[_0x12e4('0x49')]=function(_0x1027da,_0xe30dea){if(_0x1027da['body']['id']){delete _0x1027da['body']['id'];}return db[_0x12e4('0x28')][_0x12e4('0x46')]({'where':{'id':_0x1027da[_0x12e4('0x44')]['id']}})['then'](handleEntityNotFound(_0xe30dea,null))[_0x12e4('0x21')](saveUpdates(_0x1027da[_0x12e4('0x48')],null))['then'](respondWithResult(_0xe30dea,null))[_0x12e4('0x42')](handleError(_0xe30dea,null));};exports['destroy']=function(_0x3a8049,_0x4eff07){return db[_0x12e4('0x28')]['find']({'where':{'id':_0x3a8049['params']['id']}})[_0x12e4('0x21')](handleEntityNotFound(_0x4eff07,null))['then'](removeEntity(_0x4eff07,null))['catch'](handleError(_0x4eff07,null));}; \ No newline at end of file +var _0x5cc5=['rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','index','OpenchannelApplication'];(function(_0xaaca1c,_0x2153d2){var _0xa2724b=function(_0x289ad5){while(--_0x289ad5){_0xaaca1c['push'](_0xaaca1c['shift']());}};_0xa2724b(++_0x2153d2);}(_0x5cc5,0x190));var _0x55cc=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x5cc5[_0x411017];return _0x2adeea;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x55cc('0x0'));var jsonpatch=require(_0x55cc('0x1'));var rp=require(_0x55cc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x55cc('0x3'));var util=require('util');var path=require(_0x55cc('0x4'));var sox=require(_0x55cc('0x5'));var csv=require('to-csv');var ejs=require(_0x55cc('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x55cc('0x7'));var crypto=require(_0x55cc('0x8'));var jsforce=require(_0x55cc('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x55cc('0xa'));var querystring=require(_0x55cc('0xb'));var Papa=require('papaparse');var Redis=require(_0x55cc('0xc'));var authService=require(_0x55cc('0xd'));var qs=require(_0x55cc('0xe'));var as=require(_0x55cc('0xf'));var hardwareService=require(_0x55cc('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x55cc('0x11'));var config=require(_0x55cc('0x12'));var db=require(_0x55cc('0x13'))['db'];function respondWithStatusCode(_0x57b84c,_0x318333){_0x318333=_0x318333||0xcc;return function(_0x236117){if(_0x236117){return _0x57b84c['sendStatus'](_0x318333);}return _0x57b84c[_0x55cc('0x14')](_0x318333)['end']();};}function respondWithResult(_0x27a6b6,_0x49feba){_0x49feba=_0x49feba||0xc8;return function(_0x501331){if(_0x501331){return _0x27a6b6[_0x55cc('0x14')](_0x49feba)[_0x55cc('0x15')](_0x501331);}};}function respondWithFilteredResult(_0x3507fe,_0x3a373c){return function(_0x8aa8de){if(_0x8aa8de){var _0xc9fafe=_0x8aa8de['count'],_0x2b1f7a=_0x3a373c[_0x55cc('0x16')],_0x2a6513=_0x3a373c[_0x55cc('0x16')]+_0x3a373c[_0x55cc('0x17')],_0x27e02c;if(_0x2a6513>=_0xc9fafe){_0x2a6513=_0xc9fafe;_0x27e02c=0xc8;}else{_0x27e02c=0xce;}_0x3507fe[_0x55cc('0x14')](_0x27e02c);return _0x3507fe[_0x55cc('0x18')](_0x55cc('0x19'),_0x2b1f7a+'-'+_0x2a6513+'/'+_0xc9fafe)[_0x55cc('0x15')](_0x8aa8de);}return null;};}function patchUpdates(_0xf3c00){return function(_0x49b4bd){try{jsonpatch[_0x55cc('0x1a')](_0x49b4bd,_0xf3c00,!![]);}catch(_0x436968){return BPromise[_0x55cc('0x1b')](_0x436968);}return _0x49b4bd[_0x55cc('0x1c')]();};}function saveUpdates(_0x2112df,_0xbac5c8){return function(_0x1bf078){if(_0x1bf078){return _0x1bf078['update'](_0x2112df)[_0x55cc('0x1d')](function(_0x18445e){return _0x18445e;});}return null;};}function removeEntity(_0x5d02d6,_0x9883ea){return function(_0x126dbc){if(_0x126dbc){return _0x126dbc[_0x55cc('0x1e')]()[_0x55cc('0x1d')](function(){_0x5d02d6[_0x55cc('0x14')](0xcc)[_0x55cc('0x1f')]();});}};}function handleEntityNotFound(_0x3c3670,_0x52b4d1){return function(_0x562588){if(!_0x562588){_0x3c3670[_0x55cc('0x20')](0x194);}return _0x562588;};}function handleError(_0x4d4a72,_0x548796){_0x548796=_0x548796||0x1f4;return function(_0x348dc5){logger[_0x55cc('0x21')](_0x348dc5[_0x55cc('0x22')]);if(_0x348dc5[_0x55cc('0x23')]){delete _0x348dc5[_0x55cc('0x23')];}_0x4d4a72[_0x55cc('0x14')](_0x548796)['send'](_0x348dc5);};}exports[_0x55cc('0x24')]=function(_0xf182b4,_0x3ff636){var _0xa421c9={},_0x524bdf={},_0x33b6cc={'count':0x0,'rows':[]};var _0x5ddd56=_['map'](db[_0x55cc('0x25')][_0x55cc('0x26')],function(_0x2e3242){return{'name':_0x2e3242[_0x55cc('0x27')],'type':_0x2e3242['type'][_0x55cc('0x28')]};});_0x524bdf['model']=_[_0x55cc('0x29')](_0x5ddd56,_0x55cc('0x23'));_0x524bdf[_0x55cc('0x2a')]=_[_0x55cc('0x2b')](_0xf182b4[_0x55cc('0x2a')]);_0x524bdf[_0x55cc('0x2c')]=_[_0x55cc('0x2d')](_0x524bdf[_0x55cc('0x2e')],_0x524bdf[_0x55cc('0x2a')]);_0xa421c9[_0x55cc('0x2f')]=_[_0x55cc('0x2d')](_0x524bdf[_0x55cc('0x2e')],qs['fields'](_0xf182b4[_0x55cc('0x2a')][_0x55cc('0x30')]));_0xa421c9[_0x55cc('0x2f')]=_0xa421c9[_0x55cc('0x2f')][_0x55cc('0x31')]?_0xa421c9[_0x55cc('0x2f')]:_0x524bdf[_0x55cc('0x2e')];if(!_0xf182b4[_0x55cc('0x2a')][_0x55cc('0x32')](_0x55cc('0x33'))){_0xa421c9['limit']=qs[_0x55cc('0x17')](_0xf182b4[_0x55cc('0x2a')][_0x55cc('0x17')]);_0xa421c9[_0x55cc('0x16')]=qs[_0x55cc('0x16')](_0xf182b4[_0x55cc('0x2a')]['offset']);}_0xa421c9[_0x55cc('0x34')]=qs['sort'](_0xf182b4['query'][_0x55cc('0x35')]);_0xa421c9[_0x55cc('0x36')]=qs[_0x55cc('0x2c')](_[_0x55cc('0x37')](_0xf182b4[_0x55cc('0x2a')],_0x524bdf['filters']),_0x5ddd56);if(_0xf182b4[_0x55cc('0x2a')][_0x55cc('0x38')]){_0xa421c9[_0x55cc('0x36')]=_[_0x55cc('0x39')](_0xa421c9[_0x55cc('0x36')],{'$or':_['map'](_0x5ddd56,function(_0x66b382){if(_0x66b382[_0x55cc('0x3a')]!==_0x55cc('0x3b')){var _0x52bbb3={};_0x52bbb3[_0x66b382[_0x55cc('0x23')]]={'$like':'%'+_0xf182b4[_0x55cc('0x2a')][_0x55cc('0x38')]+'%'};return _0x52bbb3;}})});}_0xa421c9=_[_0x55cc('0x39')]({},_0xa421c9,_0xf182b4['options']);var _0x2bc08f={'where':_0xa421c9[_0x55cc('0x36')]};return db[_0x55cc('0x25')][_0x55cc('0x3c')](_0x2bc08f)['then'](function(_0x2732af){_0x33b6cc[_0x55cc('0x3c')]=_0x2732af;if(_0xf182b4[_0x55cc('0x2a')][_0x55cc('0x3d')]){_0xa421c9[_0x55cc('0x3e')]=[{'all':!![]}];}return db[_0x55cc('0x25')][_0x55cc('0x3f')](_0xa421c9);})[_0x55cc('0x1d')](function(_0x29b177){_0x33b6cc[_0x55cc('0x40')]=_0x29b177;return _0x33b6cc;})[_0x55cc('0x1d')](respondWithFilteredResult(_0x3ff636,_0xa421c9))[_0x55cc('0x41')](handleError(_0x3ff636,null));};exports[_0x55cc('0x42')]=function(_0x4898cd,_0x40dc02){var _0x540d92={'raw':!![],'where':{'id':_0x4898cd[_0x55cc('0x43')]['id']}},_0x499b45={};_0x499b45[_0x55cc('0x2e')]=_['keys'](db[_0x55cc('0x25')][_0x55cc('0x26')]);_0x499b45[_0x55cc('0x2a')]=_[_0x55cc('0x2b')](_0x4898cd[_0x55cc('0x2a')]);_0x499b45['filters']=_[_0x55cc('0x2d')](_0x499b45[_0x55cc('0x2e')],_0x499b45['query']);_0x540d92[_0x55cc('0x2f')]=_[_0x55cc('0x2d')](_0x499b45[_0x55cc('0x2e')],qs[_0x55cc('0x30')](_0x4898cd[_0x55cc('0x2a')][_0x55cc('0x30')]));_0x540d92[_0x55cc('0x2f')]=_0x540d92[_0x55cc('0x2f')][_0x55cc('0x31')]?_0x540d92[_0x55cc('0x2f')]:_0x499b45[_0x55cc('0x2e')];if(_0x4898cd['query']['includeAll']){_0x540d92['include']=[{'all':!![]}];}_0x540d92=_[_0x55cc('0x39')]({},_0x540d92,_0x4898cd[_0x55cc('0x44')]);return db[_0x55cc('0x25')][_0x55cc('0x45')](_0x540d92)[_0x55cc('0x1d')](handleEntityNotFound(_0x40dc02,null))[_0x55cc('0x1d')](respondWithResult(_0x40dc02,null))[_0x55cc('0x41')](handleError(_0x40dc02,null));};exports[_0x55cc('0x46')]=function(_0x4e2e7a,_0x3db9bf){return db[_0x55cc('0x25')][_0x55cc('0x46')](_0x4e2e7a[_0x55cc('0x47')],{})[_0x55cc('0x1d')](respondWithResult(_0x3db9bf,0xc9))['catch'](handleError(_0x3db9bf,null));};exports[_0x55cc('0x48')]=function(_0x526e86,_0x5f1669){if(_0x526e86[_0x55cc('0x47')]['id']){delete _0x526e86[_0x55cc('0x47')]['id'];}return db[_0x55cc('0x25')][_0x55cc('0x45')]({'where':{'id':_0x526e86[_0x55cc('0x43')]['id']}})[_0x55cc('0x1d')](handleEntityNotFound(_0x5f1669,null))[_0x55cc('0x1d')](saveUpdates(_0x526e86['body'],null))[_0x55cc('0x1d')](respondWithResult(_0x5f1669,null))[_0x55cc('0x41')](handleError(_0x5f1669,null));};exports[_0x55cc('0x1e')]=function(_0x2935e2,_0x4436e5){return db['OpenchannelApplication']['find']({'where':{'id':_0x2935e2[_0x55cc('0x43')]['id']}})[_0x55cc('0x1d')](handleEntityNotFound(_0x4436e5,null))[_0x55cc('0x1d')](removeEntity(_0x4436e5,null))[_0x55cc('0x41')](handleError(_0x4436e5,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index f93490b..66d886f 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 _0x1b73=['openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x233fa2,_0x4896e4){var _0x48bb3f=function(_0x5b0145){while(--_0x5b0145){_0x233fa2['push'](_0x233fa2['shift']());}};_0x48bb3f(++_0x4896e4);}(_0x1b73,0x8f));var _0x31b7=function(_0x7d4b32,_0x18579b){_0x7d4b32=_0x7d4b32-0x0;var _0x98ac55=_0x1b73[_0x7d4b32];return _0x98ac55;};'use strict';var _=require('lodash');var util=require(_0x31b7('0x0'));var logger=require('../../config/logger')(_0x31b7('0x1'));var moment=require(_0x31b7('0x2'));var BPromise=require(_0x31b7('0x3'));var rp=require(_0x31b7('0x4'));var fs=require('fs');var path=require(_0x31b7('0x5'));var rimraf=require('rimraf');var config=require(_0x31b7('0x6'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x4b25dd,_0x3ed8a7){return _0x4b25dd['define']('OpenchannelApplication',attributes,{'tableName':_0x31b7('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x31b7('0x8'),'collate':_0x31b7('0x9')});}; \ No newline at end of file +var _0x246a=['openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes'];(function(_0x49d4c6,_0x17a049){var _0x15c66c=function(_0x29e2a7){while(--_0x29e2a7){_0x49d4c6['push'](_0x49d4c6['shift']());}};_0x15c66c(++_0x17a049);}(_0x246a,0x16b));var _0xa246=function(_0x5b1e2b,_0x413bd5){_0x5b1e2b=_0x5b1e2b-0x0;var _0x407644=_0x246a[_0x5b1e2b];return _0x407644;};'use strict';var _=require(_0xa246('0x0'));var util=require(_0xa246('0x1'));var logger=require('../../config/logger')(_0xa246('0x2'));var moment=require(_0xa246('0x3'));var BPromise=require('bluebird');var rp=require(_0xa246('0x4'));var fs=require('fs');var path=require(_0xa246('0x5'));var rimraf=require(_0xa246('0x6'));var config=require(_0xa246('0x7'));var attributes=require(_0xa246('0x8'));module['exports']=function(_0x59f0fa,_0x398944){return _0x59f0fa['define']('OpenchannelApplication',attributes,{'tableName':_0xa246('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa246('0xa'),'collate':_0xa246('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 5f8d3a9..b415128 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['OpenchannelApplication','body','options','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['update'](_0x5fecbd[_0x0d8b('0x18')],{'raw':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1b')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['attributes']||null:null,'limit':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['limit']||null:null})['then'](function(_0x238728){logger[_0x0d8b('0xb')](_0x0d8b('0x16'),_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON[_0x0d8b('0x10')](_0x238728));_0x18dd2d(_0x238728);})[_0x0d8b('0x15')](function(_0x4562cb){logger[_0x0d8b('0x11')]('UpdateOpenchannelApplication',_0x4562cb[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x4562cb['message']));});});}; \ No newline at end of file +var _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(_0x4c79aa,_0x456fcd){var _0x28e73a=function(_0x2f9084){while(--_0x2f9084){_0x4c79aa['push'](_0x4c79aa['shift']());}};_0x28e73a(++_0x456fcd);}(_0xb10b,0x12a));var _0xbb10=function(_0x26a09d,_0x21aa2d){_0x26a09d=_0x26a09d-0x0;var _0x5c4fb4=_0xb10b[_0x26a09d];return _0x5c4fb4;};'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 507c8a8..b3befdf 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 _0x06bc=['exports','multer','util','express','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','isAuthenticated','index','get','describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','addTags','put','openchannel','update','delete','openchannelinteraction:destroy','removeTags'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x06bc,0x1dd));var _0xc06b=function(_0x2d0241,_0x4101ca){_0x2d0241=_0x2d0241-0x0;var _0x47f807=_0x06bc[_0x2d0241];return _0x47f807;};'use strict';var multer=require(_0xc06b('0x0'));var util=require(_0xc06b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc06b('0x2'));var router=express['Router']();var auth=require(_0xc06b('0x3'));var interaction=require(_0xc06b('0x4'));var config=require('../../config/environment');var controller=require(_0xc06b('0x5'));router['get']('/',auth[_0xc06b('0x6')](),controller[_0xc06b('0x7')]);router[_0xc06b('0x8')]('/describe',auth[_0xc06b('0x6')](),controller[_0xc06b('0x9')]);router[_0xc06b('0x8')](_0xc06b('0xa'),auth['isAuthenticated'](),controller[_0xc06b('0xb')]);router[_0xc06b('0x8')](_0xc06b('0xc'),auth['isAuthenticated'](),controller['getMessages']);router[_0xc06b('0x8')](_0xc06b('0xd'),auth[_0xc06b('0x6')](),controller[_0xc06b('0xe')]);router[_0xc06b('0xf')]('/',auth[_0xc06b('0x6')](),controller[_0xc06b('0x10')]);router[_0xc06b('0xf')]('/:id/messages',auth[_0xc06b('0x6')](),controller[_0xc06b('0x11')]);router[_0xc06b('0xf')](_0xc06b('0x12'),auth[_0xc06b('0x6')](),interaction[_0xc06b('0x13')]('openchannel','openchannelinteraction:addtags'),controller[_0xc06b('0x14')]);router[_0xc06b('0x15')](_0xc06b('0xa'),auth[_0xc06b('0x6')](),interaction[_0xc06b('0x13')](_0xc06b('0x16'),'openchannelinteraction:update'),controller[_0xc06b('0x17')]);router[_0xc06b('0x18')](_0xc06b('0xa'),auth[_0xc06b('0x6')](),interaction[_0xc06b('0x13')](_0xc06b('0x16'),_0xc06b('0x19')),controller['destroy']);router[_0xc06b('0x18')](_0xc06b('0x12'),auth[_0xc06b('0x6')](),controller[_0xc06b('0x1a')]);module[_0xc06b('0x1b')]=router; \ No newline at end of file +var _0x3a27=['update','delete','openchannelinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','connect-timeout','Router','../../components/auth/service','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','create','post','tracked','openchannelinteraction:addtags','addTags','/:id','openchannel','openchannelinteraction:update'];(function(_0x30ff80,_0x54efc6){var _0x544fb6=function(_0x343862){while(--_0x343862){_0x30ff80['push'](_0x30ff80['shift']());}};_0x544fb6(++_0x54efc6);}(_0x3a27,0xc1));var _0x73a2=function(_0x54777a,_0x153d36){_0x54777a=_0x54777a-0x0;var _0x4d1d54=_0x3a27[_0x54777a];return _0x4d1d54;};'use strict';var multer=require(_0x73a2('0x0'));var util=require(_0x73a2('0x1'));var path=require('path');var timeout=require(_0x73a2('0x2'));var express=require('express');var router=express[_0x73a2('0x3')]();var auth=require(_0x73a2('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x73a2('0x5'));router[_0x73a2('0x6')]('/',auth[_0x73a2('0x7')](),controller[_0x73a2('0x8')]);router[_0x73a2('0x6')](_0x73a2('0x9'),auth[_0x73a2('0x7')](),controller[_0x73a2('0xa')]);router[_0x73a2('0x6')]('/:id',auth[_0x73a2('0x7')](),controller[_0x73a2('0xb')]);router[_0x73a2('0x6')](_0x73a2('0xc'),auth[_0x73a2('0x7')](),controller[_0x73a2('0xd')]);router[_0x73a2('0x6')](_0x73a2('0xe'),auth[_0x73a2('0x7')](),controller[_0x73a2('0xf')]);router['post']('/',auth[_0x73a2('0x7')](),controller[_0x73a2('0x10')]);router[_0x73a2('0x11')]('/:id/messages',auth[_0x73a2('0x7')](),controller['addMessage']);router[_0x73a2('0x11')]('/:id/tags',auth[_0x73a2('0x7')](),interaction[_0x73a2('0x12')]('openchannel',_0x73a2('0x13')),controller[_0x73a2('0x14')]);router['put'](_0x73a2('0x15'),auth[_0x73a2('0x7')](),interaction[_0x73a2('0x12')](_0x73a2('0x16'),_0x73a2('0x17')),controller[_0x73a2('0x18')]);router[_0x73a2('0x19')](_0x73a2('0x15'),auth['isAuthenticated'](),interaction[_0x73a2('0x12')](_0x73a2('0x16'),_0x73a2('0x1a')),controller[_0x73a2('0x1b')]);router['delete'](_0x73a2('0x1c'),auth[_0x73a2('0x7')](),controller[_0x73a2('0x1d')]);module[_0x73a2('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index cdfdfc5..cddb511 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 _0xc90d=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x48d037,_0x310797){var _0x5e63ce=function(_0x2a4c8e){while(--_0x2a4c8e){_0x48d037['push'](_0x48d037['shift']());}};_0x5e63ce(++_0x310797);}(_0xc90d,0x12b));var _0xdc90=function(_0x20bc10,_0x35bed9){_0x20bc10=_0x20bc10-0x0;var _0x3bd5ce=_0xc90d[_0x20bc10];return _0x3bd5ce;};'use strict';var Sequelize=require(_0xdc90('0x0'));module[_0xdc90('0x1')]={'closed':{'type':Sequelize[_0xdc90('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xdc90('0x3')]},'disposition':{'type':Sequelize[_0xdc90('0x4')]},'note':{'type':Sequelize[_0xdc90('0x4')]},'read1stAt':{'type':Sequelize[_0xdc90('0x3')]},'threadId':{'type':Sequelize[_0xdc90('0x4')]},'externalUrl':{'type':Sequelize[_0xdc90('0x4')]},'lastMsgAt':{'type':Sequelize[_0xdc90('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xdc90('0x5')]('in',_0xdc90('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xdc90('0x4')]}}; \ No newline at end of file +var _0xcd61=['sequelize','exports','BOOLEAN','DATE','STRING','out'];(function(_0x5241ba,_0x41a1d4){var _0x26e7c5=function(_0x2b85ec){while(--_0x2b85ec){_0x5241ba['push'](_0x5241ba['shift']());}};_0x26e7c5(++_0x41a1d4);}(_0xcd61,0x120));var _0x1cd6=function(_0x239d4a,_0x5ad3ea){_0x239d4a=_0x239d4a-0x0;var _0x370d88=_0xcd61[_0x239d4a];return _0x370d88;};'use strict';var Sequelize=require(_0x1cd6('0x0'));module[_0x1cd6('0x1')]={'closed':{'type':Sequelize[_0x1cd6('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1cd6('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x1cd6('0x4')]},'externalUrl':{'type':Sequelize[_0x1cd6('0x4')]},'lastMsgAt':{'type':Sequelize[_0x1cd6('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x1cd6('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x1cd6('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 13c4b32..80ac439 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 _0x0cad=['ContactId','buildExpression','text','start','forEach','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','Account.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','show','params','includeAll','options','catch','create','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','OpenchannelInteractionId','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','openchannelInteractionTags:save','removeTags','unix','root','server','files','attachments','join','format','transcript-%d-%s.zip','Contact','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','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','closedAt','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','firstName','renderFile','views','downloadInteraction.html','toFile','.pdf','download','log','unlinkSync','html-pdf','eml-format','rimraf','moment','util','path','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','stack','name','Users','fullname','TagIds','Tags','split','push','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.OpenchannelInteractionId','left_join','u.id\x20=\x20ui.UserId','cm_contacts','users','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','`\x20=\x200','`\x20>\x200','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?'];(function(_0x3c11dd,_0x342a12){var _0x3312ff=function(_0x522c17){while(--_0x522c17){_0x3c11dd['push'](_0x3c11dd['shift']());}};_0x3312ff(++_0x342a12);}(_0x0cad,0x8c));var _0xd0ca=function(_0x4494bd,_0x5d4c66){_0x4494bd=_0x4494bd-0x0;var _0x49ede9=_0x0cad[_0x4494bd];return _0x49ede9;};'use strict';var pdf=require(_0xd0ca('0x0'));var emlformat=require(_0xd0ca('0x1'));var rimraf=require(_0xd0ca('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd0ca('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd0ca('0x4'));var path=require(_0xd0ca('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd0ca('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd0ca('0x7'));var crypto=require(_0xd0ca('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xd0ca('0x9'));var toCsv=require(_0xd0ca('0xa'));var querystring=require(_0xd0ca('0xb'));var Papa=require(_0xd0ca('0xc'));var Redis=require(_0xd0ca('0xd'));var authService=require(_0xd0ca('0xe'));var qs=require(_0xd0ca('0xf'));var as=require(_0xd0ca('0x10'));var hardwareService=require(_0xd0ca('0x11'));var logger=require(_0xd0ca('0x12'))(_0xd0ca('0x13'));var utils=require(_0xd0ca('0x14'));var config=require(_0xd0ca('0x15'));var db=require(_0xd0ca('0x16'))['db'];config['redis']=_[_0xd0ca('0x17')](config['redis'],{'host':_0xd0ca('0x18'),'port':0x18eb});var socket=require(_0xd0ca('0x19'))(new Redis(config['redis']));require(_0xd0ca('0x1a'))[_0xd0ca('0x1b')](socket);function respondWithStatusCode(_0x28fb24,_0x2a90cc){_0x2a90cc=_0x2a90cc||0xcc;return function(_0x597d4f){if(_0x597d4f){return _0x28fb24['sendStatus'](_0x2a90cc);}return _0x28fb24[_0xd0ca('0x1c')](_0x2a90cc)[_0xd0ca('0x1d')]();};}function respondWithResult(_0x2c556d,_0x3783d1){_0x3783d1=_0x3783d1||0xc8;return function(_0x11ea37){if(_0x11ea37){return _0x2c556d[_0xd0ca('0x1c')](_0x3783d1)['json'](_0x11ea37);}};}function respondWithFilteredResult(_0x1d95be,_0x4c3d1f){return function(_0x5a7f41){if(_0x5a7f41){var _0x2e1ef5=_0x5a7f41[_0xd0ca('0x1e')],_0x2eaacb=_0x4c3d1f[_0xd0ca('0x1f')],_0x3063b9=_0x4c3d1f[_0xd0ca('0x1f')]+_0x4c3d1f[_0xd0ca('0x20')],_0xb8cfc2;if(_0x3063b9>=_0x2e1ef5){_0x3063b9=_0x2e1ef5;_0xb8cfc2=0xc8;}else{_0xb8cfc2=0xce;}_0x1d95be[_0xd0ca('0x1c')](_0xb8cfc2);return _0x1d95be[_0xd0ca('0x21')](_0xd0ca('0x22'),_0x2eaacb+'-'+_0x3063b9+'/'+_0x2e1ef5)[_0xd0ca('0x23')](_0x5a7f41);}return null;};}function patchUpdates(_0x458b4c){return function(_0xfb1964){try{jsonpatch[_0xd0ca('0x24')](_0xfb1964,_0x458b4c,!![]);}catch(_0x13f56a){return BPromise[_0xd0ca('0x25')](_0x13f56a);}return _0xfb1964[_0xd0ca('0x26')]();};}function saveUpdates(_0x53aee2,_0x431eff){return function(_0xdac5a7){if(_0xdac5a7){return _0xdac5a7[_0xd0ca('0x27')](_0x53aee2)['then'](function(_0x5dc426){return _0x5dc426;});}return null;};}function removeEntity(_0x28074d,_0xab9f74){return function(_0x2074e0){if(_0x2074e0){return _0x2074e0[_0xd0ca('0x28')]()[_0xd0ca('0x29')](function(){_0x28074d[_0xd0ca('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481c,_0x53b6b2){return function(_0x532a95){if(!_0x532a95){_0x481c[_0xd0ca('0x2a')](0x194);}return _0x532a95;};}function handleError(_0x290f85,_0x5cdea7){_0x5cdea7=_0x5cdea7||0x1f4;return function(_0x20b84a){logger['error'](_0x20b84a[_0xd0ca('0x2b')]);if(_0x20b84a['name']){delete _0x20b84a[_0xd0ca('0x2c')];}_0x290f85[_0xd0ca('0x1c')](_0x5cdea7)['send'](_0x20b84a);};}function getInteractionUsers(_0x338e83,_0x4f50b1){return new BPromise(function(_0x1e7fcd,_0x5f3700){try{if(_0x4f50b1[_0x338e83['id']]){_0x338e83[_0xd0ca('0x2d')]=_['map'](_0x4f50b1[_0x338e83['id']],function(_0x1bc10d){return{'id':_0x1bc10d['id'],'fullname':_0x1bc10d[_0xd0ca('0x2e')]};});}}catch(_0x2c3bbb){_0x5f3700(_0x2c3bbb);}_0x1e7fcd(_0x338e83);});}function getInteractionTags(_0x2c0c6c,_0xd890c1){return new BPromise(function(_0x4be0b9,_0x5c9314){try{if(_0x2c0c6c[_0xd0ca('0x2f')]){_0x2c0c6c[_0xd0ca('0x30')]=[];_0x2c0c6c[_0xd0ca('0x2f')][_0xd0ca('0x31')](',')['forEach'](function(_0x1f297a){_0x2c0c6c[_0xd0ca('0x30')][_0xd0ca('0x32')](_0xd890c1[_0x1f297a]);});}delete _0x2c0c6c[_0xd0ca('0x2f')];}catch(_0x33dc85){_0x5c9314(_0x33dc85);}_0x4be0b9(_0x2c0c6c);});}function updateOpenchannelInteraction(_0x47d6ca,_0x155629,_0x5ce26b){return new BPromise(function(_0xaf38e2,_0x1fefaf){return getInteractionUsers(_0x47d6ca,_0x5ce26b)[_0xd0ca('0x29')](function(_0x6a028c){return getInteractionTags(_0x6a028c,_0x155629);})[_0xd0ca('0x29')](function(_0x2d0042){_0xaf38e2(_0x2d0042);})['catch'](function(_0x2eceb3){_0x1fefaf(_0x2eceb3);});});}exports[_0xd0ca('0x33')]=function(_0x3116a6,_0x21c9bc){var _0x43c6fc={},_0x43d8d7={},_0x52afde={'count':0x0,'rows':[]};var _0x1f9f36=_[_0xd0ca('0x34')](db[_0xd0ca('0x35')][_0xd0ca('0x36')],function(_0x316b7f){return{'name':_0x316b7f[_0xd0ca('0x37')],'type':_0x316b7f[_0xd0ca('0x38')][_0xd0ca('0x39')]};});_0x43d8d7['model']=_[_0xd0ca('0x34')](_0x1f9f36,_0xd0ca('0x2c'));_0x43d8d7['query']=_[_0xd0ca('0x3a')](_0x3116a6[_0xd0ca('0x3b')]);_0x43d8d7[_0xd0ca('0x3c')]=_[_0xd0ca('0x3d')](_0x43d8d7['model'],_0x43d8d7[_0xd0ca('0x3b')]);_0x43c6fc['attributes']=_[_0xd0ca('0x3d')](_0x43d8d7[_0xd0ca('0x3e')],qs[_0xd0ca('0x3f')](_0x3116a6[_0xd0ca('0x3b')][_0xd0ca('0x3f')]));_0x43c6fc[_0xd0ca('0x40')]=_0x43c6fc[_0xd0ca('0x40')][_0xd0ca('0x41')]?_0x43c6fc[_0xd0ca('0x40')]:_0x43d8d7['model'];if(!_0x3116a6[_0xd0ca('0x3b')][_0xd0ca('0x42')](_0xd0ca('0x43'))){_0x43c6fc[_0xd0ca('0x20')]=qs[_0xd0ca('0x20')](_0x3116a6[_0xd0ca('0x3b')][_0xd0ca('0x20')]);_0x43c6fc[_0xd0ca('0x1f')]=qs[_0xd0ca('0x1f')](_0x3116a6['query'][_0xd0ca('0x1f')]);}_0x43c6fc[_0xd0ca('0x44')]=qs[_0xd0ca('0x45')](_0x3116a6[_0xd0ca('0x3b')]['sort']);_0x43c6fc[_0xd0ca('0x46')]=qs[_0xd0ca('0x3c')](_[_0xd0ca('0x47')](_0x3116a6[_0xd0ca('0x3b')],_0x43d8d7['filters']),_0x1f9f36);var _0x290fe3=[];var _0x191be9=squel[_0xd0ca('0x48')]()['field']('id')[_0xd0ca('0x49')](_0xd0ca('0x2c'))[_0xd0ca('0x49')](_0xd0ca('0x4a'))[_0xd0ca('0x4b')]('tools_tags');var _0xd0dc34=squel[_0xd0ca('0x48')]()[_0xd0ca('0x49')](_0xd0ca('0x4c'))[_0xd0ca('0x49')](_0xd0ca('0x4d'))[_0xd0ca('0x49')](_0xd0ca('0x4e'))['from']('user_has_openchannel_interactions','ui')[_0xd0ca('0x4f')]('users','u',_0xd0ca('0x50'));var _0x3bb346=squel[_0xd0ca('0x48')]()[_0xd0ca('0x4b')]('openchannel_interactions','i')['left_join'](_0xd0ca('0x51'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xd0ca('0x52'),'o',_0xd0ca('0x53'))[_0xd0ca('0x4f')](_0xd0ca('0x54'),'a',_0xd0ca('0x55'))['left_join'](_0xd0ca('0x56'),'me',_0xd0ca('0x57'))['left_join']('openchannel_interaction_has_tags','it',_0xd0ca('0x58'))[_0xd0ca('0x4f')]('tools_tags','t',_0xd0ca('0x59'));var _0x1f4e66=squel[_0xd0ca('0x5a')]();var _0x8b75ea=[];var _0x530d19=squel['expr']();var _0x532542;if(_0x3116a6[_0xd0ca('0x3b')][_0xd0ca('0x5b')]){_0x532542=as[_0xd0ca('0x5c')](_0x3116a6[_0xd0ca('0x3b')][_0xd0ca('0x5b')]);var _0x4152b9=_0x532542[_0xd0ca('0x5d')];for(var _0x584635=0x0;_0x584635<_0x532542[_0xd0ca('0x5e')]['length'];_0x584635++){var _0x5672f7=_0x532542[_0xd0ca('0x5e')][_0x584635];var _0x3ee3dd='i';var _0x45ab37=_[_0xd0ca('0x5f')](_0x1f9f36,[_0xd0ca('0x2c'),_0x5672f7['field']]);if(!_0x45ab37){switch(_0x5672f7[_0xd0ca('0x49')]){case'unreadMessages':if(_0x5672f7[_0xd0ca('0x60')]==0x1){_0x3bb346['having']('`'+_0x5672f7[_0xd0ca('0x49')]+_0xd0ca('0x61'));}else{_0x3bb346['having']('`'+_0x5672f7[_0xd0ca('0x49')]+_0xd0ca('0x62'));}break;case'Contact':if(_0x5672f7[_0xd0ca('0x63')]===_0xd0ca('0x64')){if(_0x5672f7['value']['split']('\x20')[_0xd0ca('0x41')]>0x1){_0x1f4e66[_0x4152b9](_0xd0ca('0x65'),qs[_0xd0ca('0x66')](_0x5672f7[_0xd0ca('0x60')]),null);}else{var _0x75f685='%'+_0x5672f7[_0xd0ca('0x60')]+'%';_0x1f4e66[_0x4152b9](_0xd0ca('0x67'),_0x75f685,_0x75f685,_0x75f685);}}else{_0x45ab37=_['find'](_0x1f9f36,[_0xd0ca('0x2c'),_0xd0ca('0x68')]);_0x5672f7[_0xd0ca('0x49')]=_0xd0ca('0x68');_0x3b45e9=as[_0xd0ca('0x69')](_0x3ee3dd,_0x45ab37[_0xd0ca('0x38')],_0x5672f7);_0x1f4e66[_0x4152b9](_0x3b45e9[_0xd0ca('0x6a')],_0x3b45e9['value'][_0xd0ca('0x6b')],_0x3b45e9[_0xd0ca('0x60')][_0xd0ca('0x1d')]);}break;case'Tag':var _0x3d3c08=_0x5672f7[_0xd0ca('0x60')][_0xd0ca('0x31')](',')[_0xd0ca('0x34')](function(_0x447be2){return Number(_0x447be2);});_0x3d3c08[_0xd0ca('0x6c')](function(_0xfcc379){_0x530d19['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xfcc379+',%');});_0x8b75ea=_[_0xd0ca('0x6d')](_0x8b75ea,_0x3d3c08);break;case _0xd0ca('0x6e'):if(_0x5672f7[_0xd0ca('0x63')]===_0xd0ca('0x64')){_0x1f4e66[_0x4152b9](_0xd0ca('0x6f'),'%'+_0x5672f7[_0xd0ca('0x60')]+'%',null);}else{_0x45ab37=_[_0xd0ca('0x5f')](_0x1f9f36,[_0xd0ca('0x2c'),_0xd0ca('0x70')]);_0x5672f7[_0xd0ca('0x49')]=_0xd0ca('0x70');_0x3b45e9=as[_0xd0ca('0x69')](_0x3ee3dd,_0x45ab37[_0xd0ca('0x38')],_0x5672f7);_0x1f4e66[_0x4152b9](_0x3b45e9[_0xd0ca('0x6a')],_0x3b45e9[_0xd0ca('0x60')][_0xd0ca('0x6b')],_0x3b45e9['value']['end']);}break;case _0xd0ca('0x71'):_0x3b45e9=as['buildExpression']('me',null,_0x5672f7);_0x1f4e66[_0x4152b9](_0x3b45e9[_0xd0ca('0x6a')],_0x3b45e9[_0xd0ca('0x60')][_0xd0ca('0x6b')],_0x3b45e9[_0xd0ca('0x60')][_0xd0ca('0x1d')]);break;}}else{var _0x3b45e9=as['buildExpression'](_0x3ee3dd,_0x45ab37[_0xd0ca('0x38')],_0x5672f7);_0x1f4e66[_0x4152b9](_0x3b45e9[_0xd0ca('0x6a')],_0x3b45e9[_0xd0ca('0x60')][_0xd0ca('0x6b')],_0x3b45e9[_0xd0ca('0x60')][_0xd0ca('0x1d')]);}}}else{var _0x273027=_(_0x3116a6['query'])[_0xd0ca('0x3a')]()[_0xd0ca('0x34')](function(_0x3c349e){return _[_0xd0ca('0x72')](_0x1f9f36,[_0xd0ca('0x2c'),_0x3c349e])?_0x3c349e:undefined;})[_0xd0ca('0x73')]()[_0xd0ca('0x60')]();if(!_['isEmpty'](_0x273027)){_0x273027[_0xd0ca('0x6c')](function(_0x2e8e9f){if(_0x2e8e9f===_0xd0ca('0x74')){_0x3bb346[_0xd0ca('0x46')](_0xd0ca('0x75'),[][_0xd0ca('0x76')](_0x3116a6[_0xd0ca('0x3b')][_0x2e8e9f]));}else if(_0x2e8e9f===_0xd0ca('0x77')){var _0x4e1649=JSON[_0xd0ca('0x78')](_0x3116a6[_0xd0ca('0x3b')][_0x2e8e9f])['$gte'];var _0x12f976=JSON[_0xd0ca('0x78')](_0x3116a6[_0xd0ca('0x3b')][_0x2e8e9f])['$lte'];_0x3bb346[_0xd0ca('0x46')](_0xd0ca('0x79'),_0x4e1649,_0x12f976);}else{if(_0x3116a6[_0xd0ca('0x3b')][_0x2e8e9f]==='null'){_0x3bb346['where']('i.'+_0x2e8e9f+_0xd0ca('0x7a'));}else{_0x3bb346[_0xd0ca('0x46')]('i.'+_0x2e8e9f+_0xd0ca('0x7b'),_0x3116a6[_0xd0ca('0x3b')][_0x2e8e9f]);}}});}if(_0x3116a6[_0xd0ca('0x3b')][_0xd0ca('0x7c')]){if(_0x3116a6[_0xd0ca('0x3b')][_0xd0ca('0x7c')]==0x1){_0x3bb346[_0xd0ca('0x7d')](_0xd0ca('0x7e'));}else{_0x3bb346[_0xd0ca('0x7d')]('`unreadMessages`\x20>\x200');}}if(_0x3116a6[_0xd0ca('0x3b')]['tag']){_0x8b75ea=_[_0xd0ca('0x7f')](_0x3116a6[_0xd0ca('0x3b')][_0xd0ca('0x80')])?_0x3116a6[_0xd0ca('0x3b')][_0xd0ca('0x80')]:new Array(_0x3116a6['query']['tag']);_0x8b75ea[_0xd0ca('0x6c')](function(_0x5198d8){_0x530d19['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5198d8+',%');});}if(_0x3116a6['query'][_0xd0ca('0x81')]){var _0x5e6018=_0x3116a6[_0xd0ca('0x3b')][_0xd0ca('0x81')]['replace']('\x5c','\x5c\x5c')[_0xd0ca('0x82')]('\x27\x27',_0xd0ca('0x83'));if(qs[_0xd0ca('0x84')](_0x5e6018)){_0x1f4e66['or'](_0xd0ca('0x85'),_0x5e6018+'%');}else{_0x1f4e66['or'](_0xd0ca('0x86'),qs[_0xd0ca('0x66')](_0x5e6018))['or'](_0xd0ca('0x87'),_0x5e6018+'%')['or'](_0xd0ca('0x88'),_0x5e6018+'%');}}}_0x3bb346['where'](_0x1f4e66);_0x3bb346[_0xd0ca('0x89')](_0xd0ca('0x8a'));var _0x56e232={'type':db[_0xd0ca('0x8b')][_0xd0ca('0x8c')]['SELECT'],'raw':!![]};var _0x57c4a6=_0x3bb346[_0xd0ca('0x8d')]();_0x57c4a6[_0xd0ca('0x49')](_0xd0ca('0x8a'));_0x57c4a6[_0xd0ca('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x43c6fc['order']){_0x43c6fc['order']['forEach'](function(_0x1e53fa){_0x3bb346[_0xd0ca('0x44')]('i.'+_0x1e53fa[0x0],_0x1e53fa[0x1]===_0xd0ca('0x8e')?![]:!![]);});}if(!_[_0xd0ca('0x8f')](_0x8b75ea)){_0x3bb346['having'](_0x530d19);_0x57c4a6[_0xd0ca('0x46')](_0xd0ca('0x90'),_0x8b75ea);}BPromise[_0xd0ca('0x91')]()[_0xd0ca('0x29')](function(){if(!_0x532542){if(_0x3116a6[_0xd0ca('0x3b')][_0xd0ca('0x74')]||_0x3116a6[_0xd0ca('0x3b')][_0xd0ca('0x92')])return;_0x57c4a6[_0xd0ca('0x46')](_0xd0ca('0x93'));_0x3bb346[_0xd0ca('0x46')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3116a6[_0xd0ca('0x94')][_0xd0ca('0x95')]({'attributes':['id'],'raw':!![]})['then'](function(_0x49edb0){if(_['isEmpty'](_0x49edb0)){_0x57c4a6[_0xd0ca('0x46')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x3bb346[_0xd0ca('0x46')](_0xd0ca('0x96'));}else{_0x57c4a6[_0xd0ca('0x46')]('i.OpenchannelAccountId\x20IN\x20?',_[_0xd0ca('0x34')](_0x49edb0,'id'));_0x3bb346[_0xd0ca('0x46')](_0xd0ca('0x75'),_[_0xd0ca('0x34')](_0x49edb0,'id'));}});})['then'](function(){db[_0xd0ca('0x97')][_0xd0ca('0x3b')](_0x57c4a6[_0xd0ca('0x98')](),_0x56e232)[_0xd0ca('0x29')](function(_0x1a3aa1){_0x52afde['count']=_0x1a3aa1[_0xd0ca('0x41')];if(_0x52afde[_0xd0ca('0x1e')]===0x0)return[];return db[_0xd0ca('0x97')]['query'](_0x191be9['toString'](),_0x56e232)[_0xd0ca('0x29')](function(_0x4d8641){_0x290fe3=_['keyBy'](_0x4d8641,'id');_0x56e232=_[_0xd0ca('0x99')](_0x56e232,{'model':db[_0xd0ca('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3116a6['query'][_0xd0ca('0x3f')]){_0x43c6fc['attributes'][_0xd0ca('0x6c')](function(_0xca7257){_0x3bb346[_0xd0ca('0x49')]('i.'+_0xca7257);});}else{_0x3bb346[_0xd0ca('0x49')](_0xd0ca('0x9a'),_0xd0ca('0x9b'));_0x3bb346[_0xd0ca('0x49')](_0xd0ca('0x9c'),_0xd0ca('0x9d'));_0x3bb346['field'](_0xd0ca('0x9e'),'Account.mandatoryDisposition');_0x3bb346[_0xd0ca('0x49')](_0xd0ca('0x9f'));_0x3bb346['field'](_0xd0ca('0xa0'),_0xd0ca('0xa1'));_0x3bb346['field'](_0xd0ca('0xa2'),_0xd0ca('0xa3'));_0x3bb346['field'](_0xd0ca('0xa4'),'Contact.email');_0x3bb346['field'](_0xd0ca('0xa5'),_0xd0ca('0xa6'));_0x3bb346['field']('c.mobile',_0xd0ca('0xa7'));_0x3bb346[_0xd0ca('0x49')]('c.fax',_0xd0ca('0xa8'));_0x3bb346[_0xd0ca('0x49')](_0xd0ca('0xa9'),_0xd0ca('0xaa'));_0x3bb346[_0xd0ca('0x49')](_0xd0ca('0xab'),_0xd0ca('0xac'));_0x3bb346[_0xd0ca('0x49')](_0xd0ca('0xad'),_0xd0ca('0x2f'));}if(_0x43c6fc[_0xd0ca('0x20')])_0x3bb346[_0xd0ca('0x20')](_0x43c6fc['limit']);if(_0x43c6fc[_0xd0ca('0x1f')])_0x3bb346['offset'](_0x43c6fc['offset']);return db[_0xd0ca('0x97')][_0xd0ca('0x3b')](_0x3bb346[_0xd0ca('0x98')](),_0x56e232);})[_0xd0ca('0x29')](function(_0x3da3ee){_0xd0dc34[_0xd0ca('0x46')]('ui.OpenchannelInteractionId\x20IN\x20?',_['map'](_0x3da3ee,'id'));return db[_0xd0ca('0x97')][_0xd0ca('0x3b')](_0xd0dc34[_0xd0ca('0x98')](),_0x56e232)['then'](function(_0x1db646){var _0x1e806c=_[_0xd0ca('0xae')](_0x1db646,'OpenchannelInteractionId');var _0x5967b6=[];_0x3da3ee[_0xd0ca('0x6c')](function(_0x82cd31){_0x5967b6[_0xd0ca('0x32')](updateOpenchannelInteraction(_0x82cd31,_0x290fe3,_0x1e806c));});return BPromise[_0xd0ca('0xaf')](_0x5967b6);});});})[_0xd0ca('0x29')](function(_0x4ccaa0){_0x52afde['rows']=_0x4ccaa0;return _0x52afde;})[_0xd0ca('0x29')](respondWithFilteredResult(_0x21c9bc,_0x43c6fc));})['catch'](handleError(_0x21c9bc,null));};exports[_0xd0ca('0xb0')]=function(_0x1503d9,_0x51e319){var _0x12c27b={'raw':![],'where':{'id':_0x1503d9[_0xd0ca('0xb1')]['id']}},_0x46fc8b={};_0x46fc8b[_0xd0ca('0x3e')]=_[_0xd0ca('0x3a')](db['OpenchannelInteraction'][_0xd0ca('0x36')]);_0x46fc8b['query']=_[_0xd0ca('0x3a')](_0x1503d9[_0xd0ca('0x3b')]);_0x46fc8b[_0xd0ca('0x3c')]=_[_0xd0ca('0x3d')](_0x46fc8b[_0xd0ca('0x3e')],_0x46fc8b[_0xd0ca('0x3b')]);_0x12c27b[_0xd0ca('0x40')]=_[_0xd0ca('0x3d')](_0x46fc8b[_0xd0ca('0x3e')],qs[_0xd0ca('0x3f')](_0x1503d9[_0xd0ca('0x3b')][_0xd0ca('0x3f')]));_0x12c27b['attributes']=_0x12c27b[_0xd0ca('0x40')]['length']?_0x12c27b[_0xd0ca('0x40')]:_0x46fc8b[_0xd0ca('0x3e')];if(_0x1503d9['query'][_0xd0ca('0xb2')]){_0x12c27b['include']=[{'all':!![]}];}_0x12c27b=_['merge']({},_0x12c27b,_0x1503d9[_0xd0ca('0xb3')]);return db[_0xd0ca('0x35')]['find'](_0x12c27b)['then'](handleEntityNotFound(_0x51e319,null))[_0xd0ca('0x29')](respondWithResult(_0x51e319,null))[_0xd0ca('0xb4')](handleError(_0x51e319,null));};exports[_0xd0ca('0xb5')]=function(_0x3ab9ba,_0x1563c8){return db[_0xd0ca('0x35')]['create'](_0x3ab9ba['body'],{})[_0xd0ca('0x29')](respondWithResult(_0x1563c8,0xc9))[_0xd0ca('0xb4')](handleError(_0x1563c8,null));};exports['update']=function(_0xd732d6,_0x40e07b){if(_0xd732d6[_0xd0ca('0x71')]['id']){delete _0xd732d6['body']['id'];}return db['OpenchannelInteraction'][_0xd0ca('0x5f')]({'where':{'id':_0xd732d6[_0xd0ca('0xb1')]['id']}})[_0xd0ca('0x29')](handleEntityNotFound(_0x40e07b,null))['then'](saveUpdates(_0xd732d6['body'],null))[_0xd0ca('0x29')](respondWithResult(_0x40e07b,null))[_0xd0ca('0xb4')](handleError(_0x40e07b,null));};exports[_0xd0ca('0x28')]=function(_0x23d04c,_0xd831e6){return db[_0xd0ca('0x35')][_0xd0ca('0x5f')]({'where':{'id':_0x23d04c[_0xd0ca('0xb1')]['id']}})[_0xd0ca('0x29')](handleEntityNotFound(_0xd831e6,null))['then'](removeEntity(_0xd831e6,null))['catch'](handleError(_0xd831e6,null));};exports[_0xd0ca('0xb6')]=function(_0x318189,_0x18bb9c){return db['OpenchannelInteraction'][_0xd0ca('0xb6')]()[_0xd0ca('0x29')](respondWithResult(_0x18bb9c,null))['catch'](handleError(_0x18bb9c,null));};exports[_0xd0ca('0xb7')]=function(_0x544681,_0x5ca4eb,_0xc5ba6c){return db[_0xd0ca('0xb8')][_0xd0ca('0x5f')]({'where':{'id':_0x544681[_0xd0ca('0xb1')]['id']}})[_0xd0ca('0x29')](handleEntityNotFound(_0x5ca4eb,null))[_0xd0ca('0x29')](function(_0x222649){if(_0x222649){return _0x222649[_0xd0ca('0xb7')](_0x544681['body']['ids'],_[_0xd0ca('0xb9')](_0x544681[_0xd0ca('0x71')],[_0xd0ca('0xba'),'id'])||{});}})[_0xd0ca('0x29')](respondWithResult(_0x5ca4eb,null))[_0xd0ca('0xb4')](handleError(_0x5ca4eb,null));};exports[_0xd0ca('0xbb')]=function(_0x4a4043,_0x2174ab,_0x198278){var _0x21eb9e={'raw':![],'where':{}};var _0x52ffea={};var _0x48b921={'count':0x0,'rows':[]};return db[_0xd0ca('0x35')]['findOne']({'where':{'id':_0x4a4043['params']['id']}})[_0xd0ca('0x29')](handleEntityNotFound(_0x2174ab,null))[_0xd0ca('0x29')](function(_0x2c0af0){if(_0x2c0af0){_0x52ffea[_0xd0ca('0x3e')]=_[_0xd0ca('0x3a')](db[_0xd0ca('0xb8')][_0xd0ca('0x36')]);_0x52ffea['query']=_[_0xd0ca('0x3a')](_0x4a4043[_0xd0ca('0x3b')]);_0x52ffea[_0xd0ca('0x3c')]=_[_0xd0ca('0x3d')](_0x52ffea[_0xd0ca('0x3e')],_0x52ffea['query']);_0x21eb9e[_0xd0ca('0x40')]=_[_0xd0ca('0x3d')](_0x52ffea[_0xd0ca('0x3e')],qs[_0xd0ca('0x3f')](_0x4a4043[_0xd0ca('0x3b')][_0xd0ca('0x3f')]));_0x21eb9e['attributes']=_0x21eb9e[_0xd0ca('0x40')][_0xd0ca('0x41')]?_0x21eb9e['attributes']:_0x52ffea['model'];if(!_0x4a4043[_0xd0ca('0x3b')][_0xd0ca('0x42')](_0xd0ca('0x43'))){_0x21eb9e[_0xd0ca('0x20')]=qs[_0xd0ca('0x20')](_0x4a4043['query'][_0xd0ca('0x20')]);_0x21eb9e['offset']=qs[_0xd0ca('0x1f')](_0x4a4043[_0xd0ca('0x3b')]['offset']);}_0x21eb9e[_0xd0ca('0x44')]=qs[_0xd0ca('0x45')](_0x4a4043[_0xd0ca('0x3b')]['sort']);_0x21eb9e[_0xd0ca('0x46')]=qs[_0xd0ca('0x3c')](_[_0xd0ca('0x47')](_0x4a4043[_0xd0ca('0x3b')],_0x52ffea[_0xd0ca('0x3c')]));_0x21eb9e['where'][_0xd0ca('0xbc')]=_0x2c0af0['id'];if(_0x4a4043[_0xd0ca('0x3b')]['filter']){_0x21eb9e[_0xd0ca('0x46')]=_['merge'](_0x21eb9e[_0xd0ca('0x46')],{'$or':_[_0xd0ca('0x34')](_0x21eb9e[_0xd0ca('0x40')],function(_0x467bdd){var _0x1129a3={};_0x1129a3[_0x467bdd]={'$like':'%'+_0x4a4043[_0xd0ca('0x3b')][_0xd0ca('0x81')]+'%'};return _0x1129a3;})});}if(_0x4a4043['query'][_0xd0ca('0xbd')]){var _0x16cec9=_0x4a4043[_0xd0ca('0x3b')][_0xd0ca('0xbd')][_0xd0ca('0x31')](',');var _0x58ccc0={};_0x58ccc0[_0x16cec9[0x0]]={'$gte':moment(_0x16cec9[0x1])['format'](_0xd0ca('0xbe'))};_0x21eb9e[_0xd0ca('0x46')]=_[_0xd0ca('0x99')](_0x21eb9e[_0xd0ca('0x46')],_0x58ccc0);}_0x21eb9e=_[_0xd0ca('0x99')]({},_0x21eb9e,_0x4a4043[_0xd0ca('0xb3')]);return db[_0xd0ca('0xb8')][_0xd0ca('0x1e')]({'where':_0x21eb9e[_0xd0ca('0x46')]})['then'](function(_0x113f62){_0x48b921['count']=_0x113f62;if(_0x4a4043[_0xd0ca('0x3b')][_0xd0ca('0xb2')]){_0x21eb9e['include']=[{'all':!![]}];}return db[_0xd0ca('0xb8')][_0xd0ca('0xbf')](_0x21eb9e);})[_0xd0ca('0x29')](function(_0x393704){_0x48b921['rows']=_0x393704;return _0x48b921;});}})[_0xd0ca('0x29')](respondWithFilteredResult(_0x2174ab,_0x21eb9e))[_0xd0ca('0xb4')](handleError(_0x2174ab,null));};exports[_0xd0ca('0xc0')]=function(_0x1e9ac1,_0x25951a,_0x486cdf){return db[_0xd0ca('0x35')]['find']({'where':{'id':_0x1e9ac1[_0xd0ca('0xb1')]['id']}})['then'](handleEntityNotFound(_0x25951a,null))[_0xd0ca('0x29')](function(_0x2208fe){if(_0x2208fe){return _0x2208fe[_0xd0ca('0xc1')](_0x1e9ac1[_0xd0ca('0x71')]['ids'],_['omit'](_0x1e9ac1[_0xd0ca('0x71')],[_0xd0ca('0xba'),'id'])||{})[_0xd0ca('0xc2')](function(){return db['Tag'][_0xd0ca('0xbf')]({'attributes':['id',_0xd0ca('0x2c'),_0xd0ca('0x4a')],'where':{'id':_0x1e9ac1[_0xd0ca('0x71')]['ids']}});})[_0xd0ca('0x29')](function(_0x24cfb5){socket['emit'](_0xd0ca('0xc3'),{'id':Number(_0x1e9ac1[_0xd0ca('0xb1')]['id']),'tags':_0x24cfb5||[]});return{'id':Number(_0x1e9ac1[_0xd0ca('0xb1')]['id']),'tags':_0x24cfb5||[]};});}})[_0xd0ca('0x29')](respondWithResult(_0x25951a,null))[_0xd0ca('0xb4')](handleError(_0x25951a,null));};exports['removeTags']=function(_0x3f98d0,_0x3819b3,_0x2893bf){return db[_0xd0ca('0x35')][_0xd0ca('0x5f')]({'where':{'id':_0x3f98d0[_0xd0ca('0xb1')]['id']}})[_0xd0ca('0x29')](handleEntityNotFound(_0x3819b3,null))['then'](function(_0x62d7f){if(_0x62d7f){return _0x62d7f[_0xd0ca('0xc4')](_0x3f98d0[_0xd0ca('0x3b')]['ids']);}})[_0xd0ca('0x29')](respondWithStatusCode(_0x3819b3,null))[_0xd0ca('0xb4')](handleError(_0x3819b3,null));};exports['download']=function(_0x59b2ff,_0x117544){var _0x4a0924=moment()[_0xd0ca('0xc5')]()[_0xd0ca('0x98')]();var _0x548a14=path['join'](config[_0xd0ca('0xc6')],_0xd0ca('0xc7'),'files','tmp');var _0x253850=path['join'](config[_0xd0ca('0xc6')],_0xd0ca('0xc7'),_0xd0ca('0xc8'),_0xd0ca('0xc9'));var _0x2fe886=path[_0xd0ca('0xca')](_0x548a14,_0x4a0924);var _0x101ab3=util[_0xd0ca('0xcb')](_0xd0ca('0xcc'),_0x59b2ff['params']['id'],_0x4a0924);var _0x49a675=path[_0xd0ca('0xca')](_0x548a14,_0x101ab3);var _0x518969=[];_0x518969['push']({'model':db[_0xd0ca('0x6e')],'as':_0xd0ca('0x6e'),'attributes':['id',_0xd0ca('0x2e')],'raw':!![]});_0x518969['push']({'model':db['CmContact'],'as':_0xd0ca('0xcd'),'attributes':['id','firstName',_0xd0ca('0xce')],'raw':!![]});if(_0x59b2ff[_0xd0ca('0x3b')][_0xd0ca('0xc9')]){_0x518969[_0xd0ca('0x32')]({'model':db['Attachment'],'as':_0xd0ca('0xcf'),'raw':!![]});}var _0x90cc51=[{'model':db[_0xd0ca('0xb8')],'as':_0xd0ca('0xd0'),'attributes':['id',_0xd0ca('0x71'),_0xd0ca('0x77'),_0xd0ca('0xd1'),_0xd0ca('0xd2'),'read'],'include':_0x518969}];_0x90cc51[_0xd0ca('0x32')]({'model':db[_0xd0ca('0xd3')],'as':_0xd0ca('0xd4'),'attributes':['id',_0xd0ca('0x2c')]});_0x90cc51[_0xd0ca('0x32')]({'model':db['User'],'as':_0xd0ca('0xd5'),'attributes':['id',_0xd0ca('0x2e')]});return db['OpenchannelInteraction'][_0xd0ca('0x5f')]({'where':{'id':_0x59b2ff['params']['id']},'include':_0x90cc51})[_0xd0ca('0x29')](handleEntityNotFound(_0x117544,null))[_0xd0ca('0x29')](function(_0x182b65){if(_0x182b65){var _0x28db34=_0x182b65[_0xd0ca('0xd6')]({'plain':!![]});fs[_0xd0ca('0xd7')](_0x2fe886);var _0x366016={'format':'A4','border':_0xd0ca('0xd8'),'header':{'height':_0xd0ca('0xd9'),'contents':{'first':_0xd0ca('0xda')}},'footer':{'height':_0xd0ca('0xdb'),'contents':{'default':util[_0xd0ca('0xcb')](_0xd0ca('0xdc'),util['format'](_0xd0ca('0xdd'),_0xd0ca('0xde'),_0x28db34['id']),moment()[_0xd0ca('0xcb')](_0xd0ca('0xdf'))['toString']())}}};var _0x4378dd={'channel':_0xd0ca('0xde'),'account':_0x28db34['Account'][_0xd0ca('0x2c')],'agent':_0x28db34[_0xd0ca('0xd5')]?_0x28db34[_0xd0ca('0xd5')][_0xd0ca('0x2e')]:'N.A.','createdAt':moment(_0x28db34[_0xd0ca('0x77')])[_0xd0ca('0xcb')](_0xd0ca('0xbe'))['toString'](),'closedAt':_0x28db34['closed']?moment(_0x28db34[_0xd0ca('0xe0')])[_0xd0ca('0xcb')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd0ca('0x98')]():'','disposition':_0x28db34['disposition'],'visibility':_0x28db34[_0xd0ca('0xe1')]?_0xd0ca('0xe2'):_0xd0ca('0xe3'),'messages':_(_0x28db34[_0xd0ca('0xd0')])[_0xd0ca('0x81')]({'secret':![]})[_0xd0ca('0x34')](function(_0x35c0f4){if(_0x35c0f4[_0xd0ca('0xcf')]){var _0x4b67e3=path['join'](_0x253850,_0x35c0f4[_0xd0ca('0xcf')][_0xd0ca('0xe4')]);if(fs[_0xd0ca('0xe5')](_0x4b67e3)){fs[_0xd0ca('0xe6')](_0x4b67e3)[_0xd0ca('0xe7')](fs[_0xd0ca('0xe8')](path[_0xd0ca('0xca')](_0x2fe886,_0x35c0f4[_0xd0ca('0xcf')][_0xd0ca('0xe4')])));}}return{'date':moment(_0x35c0f4['createdAt'])['format'](_0xd0ca('0xbe'))['toString'](),'sender':_0x35c0f4[_0xd0ca('0xd1')]===_0xd0ca('0xe9')?_0x35c0f4[_0xd0ca('0x6e')]?_0x35c0f4[_0xd0ca('0x6e')]['fullname']:_0xd0ca('0xea'):_0x35c0f4[_0xd0ca('0xcd')][_0xd0ca('0xeb')]+(_0x35c0f4[_0xd0ca('0xcd')]['lastName']?'\x20'+_0x35c0f4['Contact']['lastName']:''),'body':_0x35c0f4[_0xd0ca('0xcf')]?_0x35c0f4[_0xd0ca('0xcf')][_0xd0ca('0xe4')]:_0x35c0f4[_0xd0ca('0x71')],'direction':_0x35c0f4[_0xd0ca('0xd1')]===_0xd0ca('0xe9')?'A':'C','secret':_0x35c0f4['secret'],'read':_0x35c0f4[_0xd0ca('0x7c')],'attachment':_0x35c0f4[_0xd0ca('0xcf')]};})[_0xd0ca('0x60')]()};return ejs[_0xd0ca('0xec')](path[_0xd0ca('0xca')](config['root'],_0xd0ca('0xc7'),_0xd0ca('0xed'),_0xd0ca('0xee')),{'interaction':_0x4378dd})[_0xd0ca('0x29')](function(_0x477dd2){return new BPromise(function(_0xdf07a2,_0x5ca89a){pdf['create'](_0x477dd2,_0x366016)[_0xd0ca('0xef')](path[_0xd0ca('0xca')](_0x2fe886,'transcript-'+_0x28db34['id']+'-'+_0x4a0924+_0xd0ca('0xf0')),function(_0x4a13c8,_0x53d70f){if(_0x4a13c8)return _0x5ca89a(_0x4a13c8);_0xdf07a2(_0x53d70f);});});})['then'](function(){return new BPromise(function(_0x3857e3,_0x1a3afe){zipdir(_0x2fe886,{'saveTo':_0x49a675},function(_0x5a9ee3,_0xf3ebe){if(_0x5a9ee3)return _0x1a3afe(_0x5a9ee3);return _0x3857e3(_0xf3ebe);});})[_0xd0ca('0x29')](function(){return new BPromise(function(_0x5d4bb7,_0xc4ae95){rimraf(_0x2fe886,function(_0x433795){if(_0x433795)_0xc4ae95(_0x433795);return _0x5d4bb7();});});})['then'](function(){return _0x117544[_0xd0ca('0xf1')](_0x49a675,_0x101ab3,function(_0x45edd9){if(_0x45edd9){console[_0xd0ca('0xf2')]('err',_0x45edd9);}else{fs[_0xd0ca('0xf3')](_0x49a675);}});});});}else{return _0x117544[_0xd0ca('0x2a')](0xc8);}})[_0xd0ca('0xb4')](handleError(_0x117544,null));}; \ No newline at end of file +var _0x8c34=['parseSearch','sqlOperator','conditions','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','getFullTextValue','value','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?','find','UserId','start','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','toString','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','sequelize','groupBy','all','rows','params','includeAll','options','create','body','destroy','describe','addMessage','ids','getMessages','findOne','OpenchannelMessage','rawAttributes','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','omit','spread','emit','openchannelInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','Messages','createdAt','direction','secret','Account','Owner','get','mkdirSync','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','N.A.','closed','closedAt','disposition','Public','Private','existsSync','createReadStream','createWriteStream','basename','out','renderFile','views','toFile','transcript-','.pdf','log','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','fullname','TagIds','Tags','split','forEach','push','catch','index','OpenchannelInteraction','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','color','u.id','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','from','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','tools_tags','expr','search'];(function(_0xc12a69,_0x420225){var _0x1c7e6f=function(_0xf0393a){while(--_0xf0393a){_0xc12a69['push'](_0xc12a69['shift']());}};_0x1c7e6f(++_0x420225);}(_0x8c34,0x181));var _0x48c3=function(_0x1b6ca7,_0x26e1cc){_0x1b6ca7=_0x1b6ca7-0x0;var _0x1cf523=_0x8c34[_0x1b6ca7];return _0x1cf523;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x48c3('0x0'));var rimraf=require(_0x48c3('0x1'));var zipdir=require(_0x48c3('0x2'));var jsonpatch=require(_0x48c3('0x3'));var rp=require(_0x48c3('0x4'));var moment=require(_0x48c3('0x5'));var BPromise=require(_0x48c3('0x6'));var Mustache=require(_0x48c3('0x7'));var util=require(_0x48c3('0x8'));var path=require(_0x48c3('0x9'));var sox=require(_0x48c3('0xa'));var csv=require(_0x48c3('0xb'));var ejs=require(_0x48c3('0xc'));var fs=require('fs');var _=require(_0x48c3('0xd'));var squel=require(_0x48c3('0xe'));var crypto=require(_0x48c3('0xf'));var jsforce=require(_0x48c3('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x48c3('0xb'));var querystring=require('querystring');var Papa=require(_0x48c3('0x11'));var Redis=require(_0x48c3('0x12'));var authService=require(_0x48c3('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x48c3('0x14'));var hardwareService=require(_0x48c3('0x15'));var logger=require(_0x48c3('0x16'))(_0x48c3('0x17'));var utils=require('../../config/utils');var config=require(_0x48c3('0x18'));var db=require(_0x48c3('0x19'))['db'];config[_0x48c3('0x1a')]=_['defaults'](config[_0x48c3('0x1a')],{'host':_0x48c3('0x1b'),'port':0x18eb});var socket=require(_0x48c3('0x1c'))(new Redis(config[_0x48c3('0x1a')]));require(_0x48c3('0x1d'))[_0x48c3('0x1e')](socket);function respondWithStatusCode(_0x1231be,_0x30bde8){_0x30bde8=_0x30bde8||0xcc;return function(_0x40e052){if(_0x40e052){return _0x1231be[_0x48c3('0x1f')](_0x30bde8);}return _0x1231be['status'](_0x30bde8)[_0x48c3('0x20')]();};}function respondWithResult(_0x81587d,_0x226469){_0x226469=_0x226469||0xc8;return function(_0x4db972){if(_0x4db972){return _0x81587d['status'](_0x226469)[_0x48c3('0x21')](_0x4db972);}};}function respondWithFilteredResult(_0x201c12,_0x3dc003){return function(_0x2dafb8){if(_0x2dafb8){var _0x39b4a5=_0x2dafb8[_0x48c3('0x22')],_0x55c110=_0x3dc003[_0x48c3('0x23')],_0x398195=_0x3dc003['offset']+_0x3dc003[_0x48c3('0x24')],_0x10160c;if(_0x398195>=_0x39b4a5){_0x398195=_0x39b4a5;_0x10160c=0xc8;}else{_0x10160c=0xce;}_0x201c12[_0x48c3('0x25')](_0x10160c);return _0x201c12[_0x48c3('0x26')](_0x48c3('0x27'),_0x55c110+'-'+_0x398195+'/'+_0x39b4a5)[_0x48c3('0x21')](_0x2dafb8);}return null;};}function patchUpdates(_0x172cdf){return function(_0x57e6e5){try{jsonpatch[_0x48c3('0x28')](_0x57e6e5,_0x172cdf,!![]);}catch(_0x50ec82){return BPromise[_0x48c3('0x29')](_0x50ec82);}return _0x57e6e5[_0x48c3('0x2a')]();};}function saveUpdates(_0x3786cd,_0x4069f4){return function(_0x2c551d){if(_0x2c551d){return _0x2c551d[_0x48c3('0x2b')](_0x3786cd)[_0x48c3('0x2c')](function(_0x13264a){return _0x13264a;});}return null;};}function removeEntity(_0x192fb8,_0x225bff){return function(_0x3eb22f){if(_0x3eb22f){return _0x3eb22f['destroy']()[_0x48c3('0x2c')](function(){_0x192fb8[_0x48c3('0x25')](0xcc)[_0x48c3('0x20')]();});}};}function handleEntityNotFound(_0x1eff2e,_0x2c4639){return function(_0x1342e3){if(!_0x1342e3){_0x1eff2e['sendStatus'](0x194);}return _0x1342e3;};}function handleError(_0x31c4ab,_0x558867){_0x558867=_0x558867||0x1f4;return function(_0x32f00f){logger[_0x48c3('0x2d')](_0x32f00f[_0x48c3('0x2e')]);if(_0x32f00f[_0x48c3('0x2f')]){delete _0x32f00f[_0x48c3('0x2f')];}_0x31c4ab[_0x48c3('0x25')](_0x558867)[_0x48c3('0x30')](_0x32f00f);};}function getInteractionUsers(_0x2a45c9,_0x192ed1){return new BPromise(function(_0x24529d,_0x23f544){try{if(_0x192ed1[_0x2a45c9['id']]){_0x2a45c9['Users']=_[_0x48c3('0x31')](_0x192ed1[_0x2a45c9['id']],function(_0x35bc48){return{'id':_0x35bc48['id'],'fullname':_0x35bc48[_0x48c3('0x32')]};});}}catch(_0x47d98e){_0x23f544(_0x47d98e);}_0x24529d(_0x2a45c9);});}function getInteractionTags(_0x19cb24,_0x3ba9a1){return new BPromise(function(_0x362db7,_0x1c21e1){try{if(_0x19cb24[_0x48c3('0x33')]){_0x19cb24[_0x48c3('0x34')]=[];_0x19cb24[_0x48c3('0x33')][_0x48c3('0x35')](',')[_0x48c3('0x36')](function(_0x536b93){_0x19cb24[_0x48c3('0x34')][_0x48c3('0x37')](_0x3ba9a1[_0x536b93]);});}delete _0x19cb24[_0x48c3('0x33')];}catch(_0x2179d1){_0x1c21e1(_0x2179d1);}_0x362db7(_0x19cb24);});}function updateOpenchannelInteraction(_0x508d7a,_0x2c150d,_0x3e4abf){return new BPromise(function(_0x10785b,_0x3fed21){return getInteractionUsers(_0x508d7a,_0x3e4abf)[_0x48c3('0x2c')](function(_0x569d73){return getInteractionTags(_0x569d73,_0x2c150d);})['then'](function(_0xc92404){_0x10785b(_0xc92404);})[_0x48c3('0x38')](function(_0x543151){_0x3fed21(_0x543151);});});}exports[_0x48c3('0x39')]=function(_0x44cb69,_0x475e3a){var _0x304170={},_0x4a47a2={},_0x168da0={'count':0x0,'rows':[]};var _0x4fccf8=_[_0x48c3('0x31')](db[_0x48c3('0x3a')]['rawAttributes'],function(_0x4efd5f){return{'name':_0x4efd5f['fieldName'],'type':_0x4efd5f[_0x48c3('0x3b')][_0x48c3('0x3c')]};});_0x4a47a2[_0x48c3('0x3d')]=_[_0x48c3('0x31')](_0x4fccf8,_0x48c3('0x2f'));_0x4a47a2[_0x48c3('0x3e')]=_[_0x48c3('0x3f')](_0x44cb69[_0x48c3('0x3e')]);_0x4a47a2[_0x48c3('0x40')]=_[_0x48c3('0x41')](_0x4a47a2['model'],_0x4a47a2['query']);_0x304170[_0x48c3('0x42')]=_[_0x48c3('0x41')](_0x4a47a2[_0x48c3('0x3d')],qs[_0x48c3('0x43')](_0x44cb69[_0x48c3('0x3e')][_0x48c3('0x43')]));_0x304170['attributes']=_0x304170[_0x48c3('0x42')][_0x48c3('0x44')]?_0x304170['attributes']:_0x4a47a2[_0x48c3('0x3d')];if(!_0x44cb69[_0x48c3('0x3e')][_0x48c3('0x45')](_0x48c3('0x46'))){_0x304170[_0x48c3('0x24')]=qs[_0x48c3('0x24')](_0x44cb69[_0x48c3('0x3e')][_0x48c3('0x24')]);_0x304170[_0x48c3('0x23')]=qs['offset'](_0x44cb69[_0x48c3('0x3e')][_0x48c3('0x23')]);}_0x304170[_0x48c3('0x47')]=qs[_0x48c3('0x48')](_0x44cb69[_0x48c3('0x3e')]['sort']);_0x304170[_0x48c3('0x49')]=qs[_0x48c3('0x40')](_[_0x48c3('0x4a')](_0x44cb69['query'],_0x4a47a2['filters']),_0x4fccf8);var _0x2722d1=[];var _0x226813=squel['select']()['field']('id')[_0x48c3('0x4b')](_0x48c3('0x2f'))[_0x48c3('0x4b')](_0x48c3('0x4c'))['from']('tools_tags');var _0x78256e=squel['select']()[_0x48c3('0x4b')](_0x48c3('0x4d'))['field']('u.fullname')['field']('ui.OpenchannelInteractionId')['from'](_0x48c3('0x4e'),'ui')['left_join'](_0x48c3('0x4f'),'u',_0x48c3('0x50'));var _0x442214=squel['select']()[_0x48c3('0x51')]('openchannel_interactions','i')[_0x48c3('0x52')]('cm_contacts','c',_0x48c3('0x53'))[_0x48c3('0x52')](_0x48c3('0x4f'),'o',_0x48c3('0x54'))[_0x48c3('0x52')](_0x48c3('0x55'),'a',_0x48c3('0x56'))[_0x48c3('0x52')](_0x48c3('0x57'),'me',_0x48c3('0x58'))[_0x48c3('0x52')](_0x48c3('0x59'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x48c3('0x52')](_0x48c3('0x5a'),'t','t.id\x20=\x20it.TagId');var _0x7533fe=squel[_0x48c3('0x5b')]();var _0x1dccdb=[];var _0x5dee82=squel[_0x48c3('0x5b')]();var _0x35e506;if(_0x44cb69[_0x48c3('0x3e')][_0x48c3('0x5c')]){_0x35e506=as[_0x48c3('0x5d')](_0x44cb69[_0x48c3('0x3e')]['search']);var _0x3b480d=_0x35e506[_0x48c3('0x5e')];for(var _0x56fa52=0x0;_0x56fa52<_0x35e506[_0x48c3('0x5f')][_0x48c3('0x44')];_0x56fa52++){var _0x4a288f=_0x35e506['conditions'][_0x56fa52];var _0x1b8a06='i';var _0x4dfb25=_['find'](_0x4fccf8,[_0x48c3('0x2f'),_0x4a288f[_0x48c3('0x4b')]]);if(!_0x4dfb25){switch(_0x4a288f[_0x48c3('0x4b')]){case _0x48c3('0x60'):if(_0x4a288f['value']==0x1){_0x442214[_0x48c3('0x61')]('`'+_0x4a288f[_0x48c3('0x4b')]+'`\x20=\x200');}else{_0x442214['having']('`'+_0x4a288f[_0x48c3('0x4b')]+_0x48c3('0x62'));}break;case _0x48c3('0x63'):if(_0x4a288f[_0x48c3('0x64')]===_0x48c3('0x65')){if(_0x4a288f['value']['split']('\x20')[_0x48c3('0x44')]>0x1){_0x7533fe[_0x3b480d]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x48c3('0x66')](_0x4a288f[_0x48c3('0x67')]),null);}else{var _0x548818='%'+_0x4a288f[_0x48c3('0x67')]+'%';_0x7533fe[_0x3b480d](_0x48c3('0x68'),_0x548818,_0x548818,_0x548818);}}else{_0x4dfb25=_['find'](_0x4fccf8,[_0x48c3('0x2f'),_0x48c3('0x69')]);_0x4a288f[_0x48c3('0x4b')]='ContactId';_0x4aff48=as[_0x48c3('0x6a')](_0x1b8a06,_0x4dfb25[_0x48c3('0x3b')],_0x4a288f);_0x7533fe[_0x3b480d](_0x4aff48[_0x48c3('0x6b')],_0x4aff48['value']['start'],_0x4aff48[_0x48c3('0x67')]['end']);}break;case _0x48c3('0x6c'):var _0x50d88d=_0x4a288f[_0x48c3('0x67')][_0x48c3('0x35')](',')[_0x48c3('0x31')](function(_0x4d86a8){return Number(_0x4d86a8);});_0x50d88d['forEach'](function(_0x4734c9){_0x5dee82['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4734c9+',%');});_0x1dccdb=_[_0x48c3('0x6d')](_0x1dccdb,_0x50d88d);break;case _0x48c3('0x6e'):if(_0x4a288f[_0x48c3('0x64')]===_0x48c3('0x65')){_0x7533fe[_0x3b480d](_0x48c3('0x6f'),'%'+_0x4a288f['value']+'%',null);}else{_0x4dfb25=_[_0x48c3('0x70')](_0x4fccf8,[_0x48c3('0x2f'),_0x48c3('0x71')]);_0x4a288f[_0x48c3('0x4b')]=_0x48c3('0x71');_0x4aff48=as[_0x48c3('0x6a')](_0x1b8a06,_0x4dfb25['type'],_0x4a288f);_0x7533fe[_0x3b480d](_0x4aff48[_0x48c3('0x6b')],_0x4aff48[_0x48c3('0x67')][_0x48c3('0x72')],_0x4aff48['value'][_0x48c3('0x20')]);}break;case'body':_0x4aff48=as['buildExpression']('me',null,_0x4a288f);_0x7533fe[_0x3b480d](_0x4aff48[_0x48c3('0x6b')],_0x4aff48['value'][_0x48c3('0x72')],_0x4aff48[_0x48c3('0x67')][_0x48c3('0x20')]);break;}}else{var _0x4aff48=as[_0x48c3('0x6a')](_0x1b8a06,_0x4dfb25['type'],_0x4a288f);_0x7533fe[_0x3b480d](_0x4aff48[_0x48c3('0x6b')],_0x4aff48[_0x48c3('0x67')][_0x48c3('0x72')],_0x4aff48[_0x48c3('0x67')]['end']);}}}else{var _0x25d76a=_(_0x44cb69[_0x48c3('0x3e')])[_0x48c3('0x3f')]()[_0x48c3('0x31')](function(_0x349d95){return _['some'](_0x4fccf8,[_0x48c3('0x2f'),_0x349d95])?_0x349d95:undefined;})[_0x48c3('0x73')]()[_0x48c3('0x67')]();if(!_[_0x48c3('0x74')](_0x25d76a)){_0x25d76a['forEach'](function(_0x29d372){if(_0x29d372===_0x48c3('0x75')){_0x442214[_0x48c3('0x49')](_0x48c3('0x76'),[][_0x48c3('0x77')](_0x44cb69[_0x48c3('0x3e')][_0x29d372]));}else if(_0x29d372==='createdAt'){var _0x5d8b66=JSON['parse'](_0x44cb69['query'][_0x29d372])[_0x48c3('0x78')];var _0x42113f=JSON[_0x48c3('0x79')](_0x44cb69['query'][_0x29d372])[_0x48c3('0x7a')];_0x442214[_0x48c3('0x49')](_0x48c3('0x7b'),_0x5d8b66,_0x42113f);}else{if(_0x44cb69[_0x48c3('0x3e')][_0x29d372]==='null'){_0x442214['where']('i.'+_0x29d372+'\x20IS\x20NULL');}else{_0x442214[_0x48c3('0x49')]('i.'+_0x29d372+_0x48c3('0x7c'),_0x44cb69[_0x48c3('0x3e')][_0x29d372]);}}});}if(_0x44cb69['query'][_0x48c3('0x7d')]){if(_0x44cb69[_0x48c3('0x3e')]['read']==0x1){_0x442214[_0x48c3('0x61')]('`unreadMessages`\x20=\x200');}else{_0x442214[_0x48c3('0x61')](_0x48c3('0x7e'));}}if(_0x44cb69[_0x48c3('0x3e')][_0x48c3('0x7f')]){_0x1dccdb=_[_0x48c3('0x80')](_0x44cb69[_0x48c3('0x3e')]['tag'])?_0x44cb69[_0x48c3('0x3e')][_0x48c3('0x7f')]:new Array(_0x44cb69[_0x48c3('0x3e')][_0x48c3('0x7f')]);_0x1dccdb[_0x48c3('0x36')](function(_0x20a88e){_0x5dee82['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20a88e+',%');});}if(_0x44cb69[_0x48c3('0x3e')]['filter']){var _0x40e7d0=_0x44cb69['query'][_0x48c3('0x81')][_0x48c3('0x82')]('\x5c','\x5c\x5c')[_0x48c3('0x82')]('\x27\x27',_0x48c3('0x83'));if(qs[_0x48c3('0x84')](_0x40e7d0)){_0x7533fe['or'](_0x48c3('0x85'),_0x40e7d0+'%');}else{_0x7533fe['or'](_0x48c3('0x86'),qs['getFullTextValue'](_0x40e7d0))['or']('i.from\x20LIKE\x20?',_0x40e7d0+'%')['or'](_0x48c3('0x87'),_0x40e7d0+'%');}}}_0x442214[_0x48c3('0x49')](_0x7533fe);_0x442214[_0x48c3('0x88')](_0x48c3('0x89'));var _0x4521e9={'type':db[_0x48c3('0x8a')][_0x48c3('0x8b')][_0x48c3('0x8c')],'raw':!![]};var _0x1b3118=_0x442214[_0x48c3('0x8d')]();_0x1b3118[_0x48c3('0x4b')](_0x48c3('0x89'));_0x1b3118[_0x48c3('0x4b')](_0x48c3('0x8e'),_0x48c3('0x60'));if(_0x304170[_0x48c3('0x47')]){_0x304170[_0x48c3('0x47')]['forEach'](function(_0x17c89b){_0x442214[_0x48c3('0x47')]('i.'+_0x17c89b[0x0],_0x17c89b[0x1]===_0x48c3('0x8f')?![]:!![]);});}if(!_[_0x48c3('0x74')](_0x1dccdb)){_0x442214[_0x48c3('0x61')](_0x5dee82);_0x1b3118['where'](_0x48c3('0x90'),_0x1dccdb);}BPromise[_0x48c3('0x91')]()[_0x48c3('0x2c')](function(){if(!_0x35e506){if(_0x44cb69[_0x48c3('0x3e')][_0x48c3('0x75')]||_0x44cb69['query'][_0x48c3('0x92')])return;_0x1b3118[_0x48c3('0x49')](_0x48c3('0x93'));_0x442214['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}return _0x44cb69['user'][_0x48c3('0x94')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2f9e96){if(_['isEmpty'](_0x2f9e96)){_0x1b3118[_0x48c3('0x49')](_0x48c3('0x95'));_0x442214[_0x48c3('0x49')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x1b3118[_0x48c3('0x49')](_0x48c3('0x76'),_[_0x48c3('0x31')](_0x2f9e96,'id'));_0x442214[_0x48c3('0x49')](_0x48c3('0x76'),_[_0x48c3('0x31')](_0x2f9e96,'id'));}});})[_0x48c3('0x2c')](function(){db['sequelize'][_0x48c3('0x3e')](_0x1b3118[_0x48c3('0x96')](),_0x4521e9)[_0x48c3('0x2c')](function(_0x21049b){_0x168da0[_0x48c3('0x22')]=_0x21049b[_0x48c3('0x44')];if(_0x168da0[_0x48c3('0x22')]===0x0)return[];return db['sequelize'][_0x48c3('0x3e')](_0x226813[_0x48c3('0x96')](),_0x4521e9)[_0x48c3('0x2c')](function(_0x5dd884){_0x2722d1=_['keyBy'](_0x5dd884,'id');_0x4521e9=_[_0x48c3('0x97')](_0x4521e9,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x44cb69[_0x48c3('0x3e')][_0x48c3('0x43')]){_0x304170[_0x48c3('0x42')][_0x48c3('0x36')](function(_0xec05f9){_0x442214[_0x48c3('0x4b')]('i.'+_0xec05f9);});}else{_0x442214['field'](_0x48c3('0x8e'),_0x48c3('0x60'));_0x442214[_0x48c3('0x4b')](_0x48c3('0x98'),'Account.key');_0x442214[_0x48c3('0x4b')](_0x48c3('0x99'),_0x48c3('0x9a'));_0x442214[_0x48c3('0x4b')](_0x48c3('0x9b'));_0x442214['field'](_0x48c3('0x9c'),_0x48c3('0x9d'));_0x442214['field'](_0x48c3('0x9e'),_0x48c3('0x9f'));_0x442214['field']('c.email',_0x48c3('0xa0'));_0x442214[_0x48c3('0x4b')](_0x48c3('0xa1'),_0x48c3('0xa2'));_0x442214[_0x48c3('0x4b')](_0x48c3('0xa3'),'Contact.mobile');_0x442214[_0x48c3('0x4b')](_0x48c3('0xa4'),_0x48c3('0xa5'));_0x442214[_0x48c3('0x4b')]('o.fullname',_0x48c3('0xa6'));_0x442214[_0x48c3('0x4b')](_0x48c3('0xa7'),'Owner.internal');_0x442214[_0x48c3('0x4b')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x304170[_0x48c3('0x24')])_0x442214[_0x48c3('0x24')](_0x304170[_0x48c3('0x24')]);if(_0x304170['offset'])_0x442214['offset'](_0x304170[_0x48c3('0x23')]);return db['sequelize']['query'](_0x442214[_0x48c3('0x96')](),_0x4521e9);})[_0x48c3('0x2c')](function(_0x416eab){_0x78256e[_0x48c3('0x49')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0x48c3('0x31')](_0x416eab,'id'));return db[_0x48c3('0xa8')][_0x48c3('0x3e')](_0x78256e[_0x48c3('0x96')](),_0x4521e9)['then'](function(_0xdd8e2c){var _0x26cf6b=_[_0x48c3('0xa9')](_0xdd8e2c,'OpenchannelInteractionId');var _0x21fc6f=[];_0x416eab[_0x48c3('0x36')](function(_0x4b5f2f){_0x21fc6f[_0x48c3('0x37')](updateOpenchannelInteraction(_0x4b5f2f,_0x2722d1,_0x26cf6b));});return BPromise[_0x48c3('0xaa')](_0x21fc6f);});});})[_0x48c3('0x2c')](function(_0x860a3d){_0x168da0[_0x48c3('0xab')]=_0x860a3d;return _0x168da0;})[_0x48c3('0x2c')](respondWithFilteredResult(_0x475e3a,_0x304170));})[_0x48c3('0x38')](handleError(_0x475e3a,null));};exports['show']=function(_0x6c7430,_0xc72fd3){var _0x317117={'raw':![],'where':{'id':_0x6c7430[_0x48c3('0xac')]['id']}},_0x39bd9f={};_0x39bd9f[_0x48c3('0x3d')]=_[_0x48c3('0x3f')](db[_0x48c3('0x3a')]['rawAttributes']);_0x39bd9f[_0x48c3('0x3e')]=_['keys'](_0x6c7430[_0x48c3('0x3e')]);_0x39bd9f['filters']=_['intersection'](_0x39bd9f[_0x48c3('0x3d')],_0x39bd9f['query']);_0x317117[_0x48c3('0x42')]=_[_0x48c3('0x41')](_0x39bd9f['model'],qs['fields'](_0x6c7430[_0x48c3('0x3e')][_0x48c3('0x43')]));_0x317117[_0x48c3('0x42')]=_0x317117[_0x48c3('0x42')][_0x48c3('0x44')]?_0x317117['attributes']:_0x39bd9f['model'];if(_0x6c7430['query'][_0x48c3('0xad')]){_0x317117['include']=[{'all':!![]}];}_0x317117=_[_0x48c3('0x97')]({},_0x317117,_0x6c7430[_0x48c3('0xae')]);return db[_0x48c3('0x3a')]['find'](_0x317117)['then'](handleEntityNotFound(_0xc72fd3,null))[_0x48c3('0x2c')](respondWithResult(_0xc72fd3,null))[_0x48c3('0x38')](handleError(_0xc72fd3,null));};exports[_0x48c3('0xaf')]=function(_0x14577a,_0x3813fe){return db[_0x48c3('0x3a')][_0x48c3('0xaf')](_0x14577a[_0x48c3('0xb0')],{})[_0x48c3('0x2c')](respondWithResult(_0x3813fe,0xc9))[_0x48c3('0x38')](handleError(_0x3813fe,null));};exports[_0x48c3('0x2b')]=function(_0x4e3beb,_0x23ae5d){if(_0x4e3beb[_0x48c3('0xb0')]['id']){delete _0x4e3beb[_0x48c3('0xb0')]['id'];}return db[_0x48c3('0x3a')][_0x48c3('0x70')]({'where':{'id':_0x4e3beb[_0x48c3('0xac')]['id']}})[_0x48c3('0x2c')](handleEntityNotFound(_0x23ae5d,null))[_0x48c3('0x2c')](saveUpdates(_0x4e3beb['body'],null))[_0x48c3('0x2c')](respondWithResult(_0x23ae5d,null))[_0x48c3('0x38')](handleError(_0x23ae5d,null));};exports[_0x48c3('0xb1')]=function(_0x1abbea,_0x559145){return db['OpenchannelInteraction'][_0x48c3('0x70')]({'where':{'id':_0x1abbea['params']['id']}})[_0x48c3('0x2c')](handleEntityNotFound(_0x559145,null))[_0x48c3('0x2c')](removeEntity(_0x559145,null))['catch'](handleError(_0x559145,null));};exports[_0x48c3('0xb2')]=function(_0x32b150,_0x54c26f){return db[_0x48c3('0x3a')][_0x48c3('0xb2')]()['then'](respondWithResult(_0x54c26f,null))['catch'](handleError(_0x54c26f,null));};exports['addMessage']=function(_0x11937f,_0x21e801,_0x2eacc1){return db['OpenchannelMessage'][_0x48c3('0x70')]({'where':{'id':_0x11937f['params']['id']}})[_0x48c3('0x2c')](handleEntityNotFound(_0x21e801,null))['then'](function(_0x18740d){if(_0x18740d){return _0x18740d[_0x48c3('0xb3')](_0x11937f['body'][_0x48c3('0xb4')],_['omit'](_0x11937f[_0x48c3('0xb0')],[_0x48c3('0xb4'),'id'])||{});}})['then'](respondWithResult(_0x21e801,null))[_0x48c3('0x38')](handleError(_0x21e801,null));};exports[_0x48c3('0xb5')]=function(_0x89b5c2,_0x25c097,_0x326cd2){var _0x257e95={'raw':![],'where':{}};var _0x16d0e7={};var _0x3e0328={'count':0x0,'rows':[]};return db[_0x48c3('0x3a')][_0x48c3('0xb6')]({'where':{'id':_0x89b5c2[_0x48c3('0xac')]['id']}})[_0x48c3('0x2c')](handleEntityNotFound(_0x25c097,null))[_0x48c3('0x2c')](function(_0x21b67f){if(_0x21b67f){_0x16d0e7['model']=_[_0x48c3('0x3f')](db[_0x48c3('0xb7')][_0x48c3('0xb8')]);_0x16d0e7['query']=_[_0x48c3('0x3f')](_0x89b5c2[_0x48c3('0x3e')]);_0x16d0e7[_0x48c3('0x40')]=_[_0x48c3('0x41')](_0x16d0e7[_0x48c3('0x3d')],_0x16d0e7[_0x48c3('0x3e')]);_0x257e95[_0x48c3('0x42')]=_[_0x48c3('0x41')](_0x16d0e7[_0x48c3('0x3d')],qs[_0x48c3('0x43')](_0x89b5c2[_0x48c3('0x3e')][_0x48c3('0x43')]));_0x257e95[_0x48c3('0x42')]=_0x257e95['attributes'][_0x48c3('0x44')]?_0x257e95[_0x48c3('0x42')]:_0x16d0e7[_0x48c3('0x3d')];if(!_0x89b5c2['query'][_0x48c3('0x45')](_0x48c3('0x46'))){_0x257e95['limit']=qs[_0x48c3('0x24')](_0x89b5c2[_0x48c3('0x3e')][_0x48c3('0x24')]);_0x257e95[_0x48c3('0x23')]=qs[_0x48c3('0x23')](_0x89b5c2[_0x48c3('0x3e')][_0x48c3('0x23')]);}_0x257e95['order']=qs['sort'](_0x89b5c2[_0x48c3('0x3e')][_0x48c3('0x48')]);_0x257e95[_0x48c3('0x49')]=qs[_0x48c3('0x40')](_[_0x48c3('0x4a')](_0x89b5c2['query'],_0x16d0e7[_0x48c3('0x40')]));_0x257e95[_0x48c3('0x49')]['OpenchannelInteractionId']=_0x21b67f['id'];if(_0x89b5c2[_0x48c3('0x3e')][_0x48c3('0x81')]){_0x257e95['where']=_[_0x48c3('0x97')](_0x257e95[_0x48c3('0x49')],{'$or':_['map'](_0x257e95[_0x48c3('0x42')],function(_0x2bfb87){var _0x5cd61c={};_0x5cd61c[_0x2bfb87]={'$like':'%'+_0x89b5c2['query'][_0x48c3('0x81')]+'%'};return _0x5cd61c;})});}if(_0x89b5c2['query'][_0x48c3('0x78')]){var _0x3914ec=_0x89b5c2['query'][_0x48c3('0x78')][_0x48c3('0x35')](',');var _0x328f74={};_0x328f74[_0x3914ec[0x0]]={'$gte':moment(_0x3914ec[0x1])[_0x48c3('0xb9')](_0x48c3('0xba'))};_0x257e95[_0x48c3('0x49')]=_[_0x48c3('0x97')](_0x257e95['where'],_0x328f74);}_0x257e95=_[_0x48c3('0x97')]({},_0x257e95,_0x89b5c2['options']);return db['OpenchannelMessage'][_0x48c3('0x22')]({'where':_0x257e95[_0x48c3('0x49')]})[_0x48c3('0x2c')](function(_0x4fa456){_0x3e0328[_0x48c3('0x22')]=_0x4fa456;if(_0x89b5c2['query']['includeAll']){_0x257e95[_0x48c3('0xbb')]=[{'all':!![]}];}return db[_0x48c3('0xb7')][_0x48c3('0xbc')](_0x257e95);})[_0x48c3('0x2c')](function(_0x3dfab8){_0x3e0328['rows']=_0x3dfab8;return _0x3e0328;});}})[_0x48c3('0x2c')](respondWithFilteredResult(_0x25c097,_0x257e95))[_0x48c3('0x38')](handleError(_0x25c097,null));};exports[_0x48c3('0xbd')]=function(_0x92e982,_0x2a9fa7,_0x119fa3){return db[_0x48c3('0x3a')][_0x48c3('0x70')]({'where':{'id':_0x92e982[_0x48c3('0xac')]['id']}})[_0x48c3('0x2c')](handleEntityNotFound(_0x2a9fa7,null))[_0x48c3('0x2c')](function(_0xcaa4be){if(_0xcaa4be){return _0xcaa4be[_0x48c3('0xbe')](_0x92e982[_0x48c3('0xb0')][_0x48c3('0xb4')],_[_0x48c3('0xbf')](_0x92e982[_0x48c3('0xb0')],[_0x48c3('0xb4'),'id'])||{})[_0x48c3('0xc0')](function(){return db[_0x48c3('0x6c')][_0x48c3('0xbc')]({'attributes':['id','name',_0x48c3('0x4c')],'where':{'id':_0x92e982[_0x48c3('0xb0')]['ids']}});})[_0x48c3('0x2c')](function(_0x28c0e7){socket[_0x48c3('0xc1')](_0x48c3('0xc2'),{'id':Number(_0x92e982[_0x48c3('0xac')]['id']),'tags':_0x28c0e7||[]});return{'id':Number(_0x92e982[_0x48c3('0xac')]['id']),'tags':_0x28c0e7||[]};});}})['then'](respondWithResult(_0x2a9fa7,null))['catch'](handleError(_0x2a9fa7,null));};exports[_0x48c3('0xc3')]=function(_0xc2100d,_0x1cf471,_0x178177){return db['OpenchannelInteraction'][_0x48c3('0x70')]({'where':{'id':_0xc2100d[_0x48c3('0xac')]['id']}})[_0x48c3('0x2c')](handleEntityNotFound(_0x1cf471,null))['then'](function(_0x1bb601){if(_0x1bb601){return _0x1bb601['removeTags'](_0xc2100d[_0x48c3('0x3e')][_0x48c3('0xb4')]);}})[_0x48c3('0x2c')](respondWithStatusCode(_0x1cf471,null))['catch'](handleError(_0x1cf471,null));};exports[_0x48c3('0xc4')]=function(_0x2c1c3b,_0x56e933){var _0x517536=moment()['unix']()[_0x48c3('0x96')]();var _0x28c608=path[_0x48c3('0xc5')](config[_0x48c3('0xc6')],_0x48c3('0xc7'),_0x48c3('0xc8'),_0x48c3('0xc9'));var _0x2d5dd4=path[_0x48c3('0xc5')](config[_0x48c3('0xc6')],_0x48c3('0xc7'),_0x48c3('0xc8'),_0x48c3('0xca'));var _0x8b858a=path['join'](_0x28c608,_0x517536);var _0x5c7a7b=util[_0x48c3('0xb9')](_0x48c3('0xcb'),_0x2c1c3b[_0x48c3('0xac')]['id'],_0x517536);var _0x2732ec=path[_0x48c3('0xc5')](_0x28c608,_0x5c7a7b);var _0x37669d=[];_0x37669d[_0x48c3('0x37')]({'model':db[_0x48c3('0x6e')],'as':_0x48c3('0x6e'),'attributes':['id','fullname'],'raw':!![]});_0x37669d['push']({'model':db['CmContact'],'as':_0x48c3('0x63'),'attributes':['id',_0x48c3('0xcc'),_0x48c3('0xcd')],'raw':!![]});if(_0x2c1c3b[_0x48c3('0x3e')]['attachments']){_0x37669d[_0x48c3('0x37')]({'model':db[_0x48c3('0xce')],'as':_0x48c3('0xce'),'raw':!![]});}var _0x3d795c=[{'model':db[_0x48c3('0xb7')],'as':_0x48c3('0xcf'),'attributes':['id','body',_0x48c3('0xd0'),_0x48c3('0xd1'),_0x48c3('0xd2'),_0x48c3('0x7d')],'include':_0x37669d}];_0x3d795c[_0x48c3('0x37')]({'model':db['OpenchannelAccount'],'as':_0x48c3('0xd3'),'attributes':['id',_0x48c3('0x2f')]});_0x3d795c[_0x48c3('0x37')]({'model':db[_0x48c3('0x6e')],'as':_0x48c3('0xd4'),'attributes':['id','fullname']});return db[_0x48c3('0x3a')][_0x48c3('0x70')]({'where':{'id':_0x2c1c3b['params']['id']},'include':_0x3d795c})[_0x48c3('0x2c')](handleEntityNotFound(_0x56e933,null))[_0x48c3('0x2c')](function(_0x1a87f9){if(_0x1a87f9){var _0x55600d=_0x1a87f9[_0x48c3('0xd5')]({'plain':!![]});fs[_0x48c3('0xd6')](_0x8b858a);var _0x2b4935={'format':'A4','border':_0x48c3('0xd7'),'header':{'height':_0x48c3('0xd8'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x48c3('0xd9'),'contents':{'default':util[_0x48c3('0xb9')](_0x48c3('0xda'),util[_0x48c3('0xb9')](_0x48c3('0xdb'),_0x48c3('0xdc'),_0x55600d['id']),moment()['format']('YYYY-MM-DD')[_0x48c3('0x96')]())}}};var _0x475d5f={'channel':_0x48c3('0xdc'),'account':_0x55600d['Account']['name'],'agent':_0x55600d[_0x48c3('0xd4')]?_0x55600d[_0x48c3('0xd4')]['fullname']:_0x48c3('0xdd'),'createdAt':moment(_0x55600d['createdAt'])[_0x48c3('0xb9')](_0x48c3('0xba'))[_0x48c3('0x96')](),'closedAt':_0x55600d[_0x48c3('0xde')]?moment(_0x55600d[_0x48c3('0xdf')])['format'](_0x48c3('0xba'))[_0x48c3('0x96')]():'','disposition':_0x55600d[_0x48c3('0xe0')],'visibility':_0x55600d['threadId']?_0x48c3('0xe1'):_0x48c3('0xe2'),'messages':_(_0x55600d[_0x48c3('0xcf')])[_0x48c3('0x81')]({'secret':![]})['map'](function(_0x42b5ac){if(_0x42b5ac[_0x48c3('0xce')]){var _0x41c294=path[_0x48c3('0xc5')](_0x2d5dd4,_0x42b5ac[_0x48c3('0xce')]['basename']);if(fs[_0x48c3('0xe3')](_0x41c294)){fs[_0x48c3('0xe4')](_0x41c294)['pipe'](fs[_0x48c3('0xe5')](path[_0x48c3('0xc5')](_0x8b858a,_0x42b5ac[_0x48c3('0xce')][_0x48c3('0xe6')])));}}return{'date':moment(_0x42b5ac['createdAt'])['format'](_0x48c3('0xba'))['toString'](),'sender':_0x42b5ac[_0x48c3('0xd1')]===_0x48c3('0xe7')?_0x42b5ac['User']?_0x42b5ac[_0x48c3('0x6e')][_0x48c3('0x32')]:'System':_0x42b5ac['Contact']['firstName']+(_0x42b5ac['Contact'][_0x48c3('0xcd')]?'\x20'+_0x42b5ac[_0x48c3('0x63')][_0x48c3('0xcd')]:''),'body':_0x42b5ac[_0x48c3('0xce')]?_0x42b5ac[_0x48c3('0xce')][_0x48c3('0xe6')]:_0x42b5ac[_0x48c3('0xb0')],'direction':_0x42b5ac[_0x48c3('0xd1')]===_0x48c3('0xe7')?'A':'C','secret':_0x42b5ac[_0x48c3('0xd2')],'read':_0x42b5ac[_0x48c3('0x7d')],'attachment':_0x42b5ac[_0x48c3('0xce')]};})[_0x48c3('0x67')]()};return ejs[_0x48c3('0xe8')](path[_0x48c3('0xc5')](config[_0x48c3('0xc6')],_0x48c3('0xc7'),_0x48c3('0xe9'),'downloadInteraction.html'),{'interaction':_0x475d5f})[_0x48c3('0x2c')](function(_0x1de20c){return new BPromise(function(_0x42d9a1,_0x5a0886){pdf['create'](_0x1de20c,_0x2b4935)[_0x48c3('0xea')](path[_0x48c3('0xc5')](_0x8b858a,_0x48c3('0xeb')+_0x55600d['id']+'-'+_0x517536+_0x48c3('0xec')),function(_0x6876a4,_0x3fb0d4){if(_0x6876a4)return _0x5a0886(_0x6876a4);_0x42d9a1(_0x3fb0d4);});});})[_0x48c3('0x2c')](function(){return new BPromise(function(_0x35f7ff,_0x19ed77){zipdir(_0x8b858a,{'saveTo':_0x2732ec},function(_0xf37d3f,_0x5842ba){if(_0xf37d3f)return _0x19ed77(_0xf37d3f);return _0x35f7ff(_0x5842ba);});})['then'](function(){return new BPromise(function(_0x335a4f,_0x35acb5){rimraf(_0x8b858a,function(_0x1abcb1){if(_0x1abcb1)_0x35acb5(_0x1abcb1);return _0x335a4f();});});})[_0x48c3('0x2c')](function(){return _0x56e933[_0x48c3('0xc4')](_0x2732ec,_0x5c7a7b,function(_0x57ec55){if(_0x57ec55){console[_0x48c3('0xed')](_0x48c3('0xee'),_0x57ec55);}else{fs['unlinkSync'](_0x2732ec);}});});});}else{return _0x56e933[_0x48c3('0x1f')](0xc8);}})['catch'](handleError(_0x56e933,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 228e815..4db5bba 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 _0x217c=['exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','update','remove','getUsers','map','findAll','then','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook'];(function(_0x61c24d,_0x212fb6){var _0x2723eb=function(_0x2c0e12){while(--_0x2c0e12){_0x61c24d['push'](_0x61c24d['shift']());}};_0x2723eb(++_0x212fb6);}(_0x217c,0x133));var _0xc217=function(_0x482660,_0x3af7c7){_0x482660=_0x482660-0x0;var _0x544086=_0x217c[_0x482660];return _0x544086;};'use strict';var EventEmitter=require(_0xc217('0x0'));var OpenchannelInteraction=require(_0xc217('0x1'))['db'][_0xc217('0x2')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xc217('0x3')](0x0);var events={'afterCreate':_0xc217('0x4'),'afterUpdate':_0xc217('0x5'),'afterDestroy':_0xc217('0x6')};function emitEvent(_0x1072c2){return function(_0x50fec5,_0x18a7fb,_0x2a720e){_0x50fec5[_0xc217('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x58bb85){_0x50fec5['setDataValue']('Users',_0x58bb85[_0xc217('0x8')](function(_0x427a22){return{'id':_0x427a22['id']};}));return OpenchannelMessage[_0xc217('0x9')]({'where':{'OpenchannelInteractionId':_0x50fec5['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc217('0xa')](function(_0x2f0aa6){_0x50fec5[_0xc217('0xb')](_0xc217('0xc'),_0x2f0aa6[_0xc217('0xd')]);OpenchannelInteractionEvents[_0xc217('0xe')](_0x1072c2+':'+_0x50fec5['id'],_0x50fec5);OpenchannelInteractionEvents[_0xc217('0xe')](_0x1072c2,_0x50fec5);_0x2a720e(null);})['catch'](_0x2a720e(null));};}for(var e in events){if(events[_0xc217('0xf')](e)){var event=events[e];OpenchannelInteraction[_0xc217('0x10')](e,emitEvent(event));}}module[_0xc217('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xb746=['unreadMessages','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','then','Users','map','findAll','setDataValue'];(function(_0x450d4e,_0xcacc3){var _0x300304=function(_0x49ab27){while(--_0x49ab27){_0x450d4e['push'](_0x450d4e['shift']());}};_0x300304(++_0xcacc3);}(_0xb746,0x75));var _0x6b74=function(_0x3dd0c4,_0x128e12){_0x3dd0c4=_0x3dd0c4-0x0;var _0x4eb373=_0xb746[_0x3dd0c4];return _0x4eb373;};'use strict';var EventEmitter=require(_0x6b74('0x0'));var OpenchannelInteraction=require(_0x6b74('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x6b74('0x1'))['db'][_0x6b74('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x6b74('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6b74('0x4'),'afterDestroy':_0x6b74('0x5')};function emitEvent(_0x546ad3){return function(_0x366a39,_0x3a185e,_0x591c6e){_0x366a39['getUsers']({'attributes':['id'],'raw':!![]})[_0x6b74('0x6')](function(_0x5da2dc){_0x366a39['setDataValue'](_0x6b74('0x7'),_0x5da2dc[_0x6b74('0x8')](function(_0x38ce4f){return{'id':_0x38ce4f['id']};}));return OpenchannelMessage[_0x6b74('0x9')]({'where':{'OpenchannelInteractionId':_0x366a39['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6b74('0x6')](function(_0x1fe3a0){_0x366a39[_0x6b74('0xa')](_0x6b74('0xb'),_0x1fe3a0['length']);OpenchannelInteractionEvents[_0x6b74('0xc')](_0x546ad3+':'+_0x366a39['id'],_0x366a39);OpenchannelInteractionEvents[_0x6b74('0xc')](_0x546ad3,_0x366a39);_0x591c6e(null);})['catch'](_0x591c6e(null));};}for(var e in events){if(events[_0x6b74('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x6b74('0xe')](e,emitEvent(event));}}module[_0x6b74('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index c14fea5..6e0c6b4 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 _0x0930=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','closed','closedAt','format','lodash','util'];(function(_0x2b2583,_0x2a154b){var _0x4cd668=function(_0x210866){while(--_0x210866){_0x2b2583['push'](_0x2b2583['shift']());}};_0x4cd668(++_0x2a154b);}(_0x0930,0x6e));var _0x0093=function(_0x284a61,_0x231686){_0x284a61=_0x284a61-0x0;var _0x220e3c=_0x0930[_0x284a61];return _0x220e3c;};'use strict';var _=require(_0x0093('0x0'));var util=require(_0x0093('0x1'));var logger=require(_0x0093('0x2'))(_0x0093('0x3'));var moment=require(_0x0093('0x4'));var BPromise=require(_0x0093('0x5'));var rp=require(_0x0093('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0093('0x7'));var config=require(_0x0093('0x8'));var attributes=require(_0x0093('0x9'));module[_0x0093('0xa')]=function(_0x192dec,_0x5f4f71){return _0x192dec[_0x0093('0xb')](_0x0093('0xc'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x23c1d7,_0x4ada6c,_0x34866b){if(_0x23c1d7['changed'](_0x0093('0xd'))){_0x23c1d7[_0x0093('0xe')]=moment()[_0x0093('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x34866b(null,_0x23c1d7);}}});}; \ No newline at end of file +var _0x3660=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x25806b,_0x16bd9c){var _0x2f93e5=function(_0x2f3485){while(--_0x2f3485){_0x25806b['push'](_0x25806b['shift']());}};_0x2f93e5(++_0x16bd9c);}(_0x3660,0xdd));var _0x0366=function(_0x4dbfe9,_0x15abe4){_0x4dbfe9=_0x4dbfe9-0x0;var _0x59e405=_0x3660[_0x4dbfe9];return _0x59e405;};'use strict';var _=require('lodash');var util=require(_0x0366('0x0'));var logger=require(_0x0366('0x1'))(_0x0366('0x2'));var moment=require(_0x0366('0x3'));var BPromise=require('bluebird');var rp=require(_0x0366('0x4'));var fs=require('fs');var path=require(_0x0366('0x5'));var rimraf=require(_0x0366('0x6'));var config=require(_0x0366('0x7'));var attributes=require(_0x0366('0x8'));module[_0x0366('0x9')]=function(_0x3ea964,_0x1bdabb){return _0x3ea964[_0x0366('0xa')](_0x0366('0xb'),attributes,{'tableName':_0x0366('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1c19f0,_0x7bfb8c,_0x39e18f){if(_0x1c19f0[_0x0366('0xd')](_0x0366('0xe'))){_0x1c19f0[_0x0366('0xf')]=moment()['format'](_0x0366('0x10'));}_0x39e18f(null,_0x1c19f0);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 77b7ba8..e3bbb54 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 _0x8fbb=['stringify','error','code','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','where','attributes','limit','debug','find','addTags','body','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x47b8b1,_0x4ae7d9){var _0x4a0fe0=function(_0x5eb1a0){while(--_0x5eb1a0){_0x47b8b1['push'](_0x47b8b1['shift']());}};_0x4a0fe0(++_0x4ae7d9);}(_0x8fbb,0xc1));var _0xb8fb=function(_0x1ffc3c,_0x3dfb06){_0x1ffc3c=_0x1ffc3c-0x0;var _0x29a70a=_0x8fbb[_0x1ffc3c];return _0x29a70a;};'use strict';var _=require(_0xb8fb('0x0'));var util=require('util');var moment=require(_0xb8fb('0x1'));var BPromise=require(_0xb8fb('0x2'));var rs=require(_0xb8fb('0x3'));var fs=require('fs');var Redis=require(_0xb8fb('0x4'));var db=require(_0xb8fb('0x5'))['db'];var utils=require(_0xb8fb('0x6'));var logger=require(_0xb8fb('0x7'))(_0xb8fb('0x8'));var config=require('../../config/environment');var jayson=require(_0xb8fb('0x9'));var client=jayson['client'][_0xb8fb('0xa')]({'port':0x232a});config['redis']=_[_0xb8fb('0xb')](config[_0xb8fb('0xc')],{'host':_0xb8fb('0xd'),'port':0x18eb});var socket=require(_0xb8fb('0xe'))(new Redis(config['redis']));require(_0xb8fb('0xf'))[_0xb8fb('0x10')](socket);function respondWithRpcPromise(_0x3a49f8,_0x27c23b,_0x32a071){return new BPromise(function(_0x5569ce,_0x256abd){return client[_0xb8fb('0x11')](_0x3a49f8,_0x32a071)[_0xb8fb('0x12')](function(_0x139b91){logger[_0xb8fb('0x13')](_0xb8fb('0x14'),_0x27c23b,_0xb8fb('0x15'));logger['debug']('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x27c23b,_0xb8fb('0x15'),JSON[_0xb8fb('0x16')](_0x139b91));if(_0x139b91[_0xb8fb('0x17')]){if(_0x139b91[_0xb8fb('0x17')][_0xb8fb('0x18')]===0x1f4){logger[_0xb8fb('0x17')](_0xb8fb('0x14'),_0x27c23b,_0x139b91[_0xb8fb('0x17')][_0xb8fb('0x19')]);return _0x256abd(_0x139b91[_0xb8fb('0x17')]['message']);}logger[_0xb8fb('0x17')](_0xb8fb('0x14'),_0x27c23b,_0x139b91[_0xb8fb('0x17')][_0xb8fb('0x19')]);return _0x5569ce(_0x139b91[_0xb8fb('0x17')][_0xb8fb('0x19')]);}else{logger[_0xb8fb('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x27c23b,_0xb8fb('0x15'));_0x5569ce(_0x139b91['result'][_0xb8fb('0x19')]);}})[_0xb8fb('0x1a')](function(_0x4347ae){logger[_0xb8fb('0x17')](_0xb8fb('0x14'),_0x27c23b,_0x4347ae);_0x256abd(_0x4347ae);});});}exports[_0xb8fb('0x1b')]=function(_0x40d9d2){var _0x1930df=this;return new Promise(function(_0x34cd6c,_0x5df120){return db[_0xb8fb('0x1c')][_0xb8fb('0x1d')](_0x40d9d2['body'],{'raw':_0x40d9d2[_0xb8fb('0x1e')]?_0x40d9d2[_0xb8fb('0x1e')][_0xb8fb('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40d9d2['options']?_0x40d9d2[_0xb8fb('0x1e')][_0xb8fb('0x20')]||null:null,'attributes':_0x40d9d2[_0xb8fb('0x1e')]?_0x40d9d2[_0xb8fb('0x1e')][_0xb8fb('0x21')]||null:null,'limit':_0x40d9d2[_0xb8fb('0x1e')]?_0x40d9d2[_0xb8fb('0x1e')][_0xb8fb('0x22')]||null:null})[_0xb8fb('0x12')](function(_0x3ef619){logger[_0xb8fb('0x13')](_0xb8fb('0x1b'),_0x40d9d2);logger[_0xb8fb('0x23')](_0xb8fb('0x1b'),_0x40d9d2,JSON[_0xb8fb('0x16')](_0x3ef619));_0x34cd6c(_0x3ef619);})['catch'](function(_0x31e52a){logger[_0xb8fb('0x17')](_0xb8fb('0x1b'),_0x31e52a[_0xb8fb('0x19')],_0x40d9d2);_0x5df120(_0x1930df['error'](0x1f4,_0x31e52a[_0xb8fb('0x19')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x11bbf2){return new Promise(function(_0x97b1b,_0x315bff){return db[_0xb8fb('0x1c')][_0xb8fb('0x24')]({'where':_0x11bbf2[_0xb8fb('0x1e')]?_0x11bbf2[_0xb8fb('0x1e')][_0xb8fb('0x20')]||null:null})[_0xb8fb('0x12')](function(_0x50d3c4){if(_0x50d3c4){return _0x50d3c4[_0xb8fb('0x25')](_0x11bbf2[_0xb8fb('0x26')][_0xb8fb('0x27')],_[_0xb8fb('0x28')](_0x11bbf2['body'],[_0xb8fb('0x27'),'id'])||{});}})[_0xb8fb('0x29')](function(_0x38077d){logger['info'](_0xb8fb('0x2a'),_0x11bbf2);logger[_0xb8fb('0x23')](_0xb8fb('0x2a'),_0x11bbf2,JSON[_0xb8fb('0x16')](_0x38077d));_0x97b1b(_0x38077d);})['catch'](function(_0x3f9e09){logger['error'](_0xb8fb('0x2a'),_0x3f9e09['message'],_0x11bbf2);_0x315bff(_this[_0xb8fb('0x17')](0x1f4,_0x3f9e09[_0xb8fb('0x19')]));});});}; \ No newline at end of file +var _0x628c=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateOpenchannelInteraction','body','options','raw','limit','debug','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','ids','omit','AddTags','lodash','util','moment','bluebird'];(function(_0x134448,_0x591d7b){var _0x2d52a1=function(_0x56b840){while(--_0x56b840){_0x134448['push'](_0x134448['shift']());}};_0x2d52a1(++_0x591d7b);}(_0x628c,0x11b));var _0xc628=function(_0x366388,_0x4595a6){_0x366388=_0x366388-0x0;var _0x41c97e=_0x628c[_0x366388];return _0x41c97e;};'use strict';var _=require(_0xc628('0x0'));var util=require(_0xc628('0x1'));var moment=require(_0xc628('0x2'));var BPromise=require(_0xc628('0x3'));var rs=require(_0xc628('0x4'));var fs=require('fs');var Redis=require(_0xc628('0x5'));var db=require(_0xc628('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc628('0x7'))(_0xc628('0x8'));var config=require(_0xc628('0x9'));var jayson=require(_0xc628('0xa'));var client=jayson[_0xc628('0xb')][_0xc628('0xc')]({'port':0x232a});config[_0xc628('0xd')]=_['defaults'](config[_0xc628('0xd')],{'host':_0xc628('0xe'),'port':0x18eb});var socket=require(_0xc628('0xf'))(new Redis(config[_0xc628('0xd')]));require('./openchannelInteraction.socket')[_0xc628('0x10')](socket);function respondWithRpcPromise(_0x37bc57,_0x3366a9,_0xe153ba){return new BPromise(function(_0x3de0d9,_0x5e9025){return client[_0xc628('0x11')](_0x37bc57,_0xe153ba)[_0xc628('0x12')](function(_0x3843bc){logger['info'](_0xc628('0x13'),_0x3366a9,_0xc628('0x14'));logger['debug'](_0xc628('0x15'),_0x3366a9,_0xc628('0x14'),JSON[_0xc628('0x16')](_0x3843bc));if(_0x3843bc[_0xc628('0x17')]){if(_0x3843bc[_0xc628('0x17')][_0xc628('0x18')]===0x1f4){logger['error'](_0xc628('0x13'),_0x3366a9,_0x3843bc[_0xc628('0x17')][_0xc628('0x19')]);return _0x5e9025(_0x3843bc[_0xc628('0x17')][_0xc628('0x19')]);}logger[_0xc628('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3366a9,_0x3843bc[_0xc628('0x17')][_0xc628('0x19')]);return _0x3de0d9(_0x3843bc['error'][_0xc628('0x19')]);}else{logger[_0xc628('0x1a')](_0xc628('0x13'),_0x3366a9,_0xc628('0x14'));_0x3de0d9(_0x3843bc[_0xc628('0x1b')]['message']);}})[_0xc628('0x1c')](function(_0x5ce8f6){logger['error'](_0xc628('0x13'),_0x3366a9,_0x5ce8f6);_0x5e9025(_0x5ce8f6);});});}exports[_0xc628('0x1d')]=function(_0x119961){var _0x1ae958=this;return new Promise(function(_0xb745ce,_0x288d78){return db['OpenchannelInteraction']['update'](_0x119961[_0xc628('0x1e')],{'raw':_0x119961[_0xc628('0x1f')]?_0x119961[_0xc628('0x1f')][_0xc628('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x119961['options']?_0x119961[_0xc628('0x1f')]['where']||null:null,'attributes':_0x119961[_0xc628('0x1f')]?_0x119961['options']['attributes']||null:null,'limit':_0x119961[_0xc628('0x1f')]?_0x119961[_0xc628('0x1f')][_0xc628('0x21')]||null:null})[_0xc628('0x12')](function(_0xa767f4){logger[_0xc628('0x1a')](_0xc628('0x1d'),_0x119961);logger[_0xc628('0x22')](_0xc628('0x1d'),_0x119961,JSON[_0xc628('0x16')](_0xa767f4));_0xb745ce(_0xa767f4);})[_0xc628('0x1c')](function(_0x41d1e4){logger[_0xc628('0x17')](_0xc628('0x1d'),_0x41d1e4[_0xc628('0x19')],_0x119961);_0x288d78(_0x1ae958[_0xc628('0x17')](0x1f4,_0x41d1e4[_0xc628('0x19')]));});});};exports[_0xc628('0x23')]=function(_0x3ec050){return new Promise(function(_0x3eb9be,_0x4e6f78){return db[_0xc628('0x24')][_0xc628('0x25')]({'where':_0x3ec050['options']?_0x3ec050['options']['where']||null:null})[_0xc628('0x12')](function(_0x4e953c){if(_0x4e953c){return _0x4e953c['addTags'](_0x3ec050[_0xc628('0x1e')][_0xc628('0x26')],_[_0xc628('0x27')](_0x3ec050[_0xc628('0x1e')],[_0xc628('0x26'),'id'])||{});}})['spread'](function(_0x358aa5){logger[_0xc628('0x1a')](_0xc628('0x28'),_0x3ec050);logger['debug'](_0xc628('0x28'),_0x3ec050,JSON[_0xc628('0x16')](_0x358aa5));_0x3eb9be(_0x358aa5);})[_0xc628('0x1c')](function(_0x4da0ca){logger[_0xc628('0x17')]('AddTags',_0x4da0ca[_0xc628('0x19')],_0x3ec050);_0x4e6f78(_this['error'](0x1f4,_0x4da0ca[_0xc628('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 26a69ea..fd59027 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 _0x24af=['emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update'];(function(_0x3d17f5,_0x248c4e){var _0x3a2dbf=function(_0x3d5928){while(--_0x3d5928){_0x3d17f5['push'](_0x3d17f5['shift']());}};_0x3a2dbf(++_0x248c4e);}(_0x24af,0xe6));var _0xf24a=function(_0x2e50a2,_0x27f31e){_0x2e50a2=_0x2e50a2-0x0;var _0x47e5de=_0x24af[_0x2e50a2];return _0x47e5de;};'use strict';var OpenchannelInteractionEvents=require(_0xf24a('0x0'));var events=[_0xf24a('0x1'),_0xf24a('0x2'),_0xf24a('0x3')];function createListener(_0x159bc2,_0x43077c){return function(_0x314541){_0x43077c[_0xf24a('0x4')](_0x159bc2,_0x314541);};}function removeListener(_0x5bc53b,_0x2585a4){return function(){OpenchannelInteractionEvents[_0xf24a('0x5')](_0x5bc53b,_0x2585a4);};}exports[_0xf24a('0x6')]=function(_0xf5e5e7){for(var _0x50e97d=0x0,_0x1740b3=events[_0xf24a('0x7')];_0x50e97d<_0x1740b3;_0x50e97d++){var _0x36ff40=events[_0x50e97d];var _0x49270b=createListener(_0xf24a('0x8')+_0x36ff40,_0xf5e5e7);OpenchannelInteractionEvents['on'](_0x36ff40,_0x49270b);}}; \ No newline at end of file +var _0x068a=['./openchannelInteraction.events','update','emit','register','openchannelInteraction:'];(function(_0x57b96a,_0x14b0cc){var _0x53f527=function(_0x3bc228){while(--_0x3bc228){_0x57b96a['push'](_0x57b96a['shift']());}};_0x53f527(++_0x14b0cc);}(_0x068a,0x1db));var _0xa068=function(_0x5b6e83,_0x2b7622){_0x5b6e83=_0x5b6e83-0x0;var _0x200f4c=_0x068a[_0x5b6e83];return _0x200f4c;};'use strict';var OpenchannelInteractionEvents=require(_0xa068('0x0'));var events=['save','remove',_0xa068('0x1')];function createListener(_0xf8863e,_0x2e5bec){return function(_0x88b4f4){_0x2e5bec[_0xa068('0x2')](_0xf8863e,_0x88b4f4);};}function removeListener(_0x1f1c8b,_0x1c2c07){return function(){OpenchannelInteractionEvents['removeListener'](_0x1f1c8b,_0x1c2c07);};}exports[_0xa068('0x3')]=function(_0x16065b){for(var _0x142c21=0x0,_0x54149b=events['length'];_0x142c21<_0x54149b;_0x142c21++){var _0x3124f7=events[_0x142c21];var _0x4559a2=createListener(_0xa068('0x4')+_0x3124f7,_0x16065b);OpenchannelInteractionEvents['on'](_0x3124f7,_0x4559a2);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index f858b63..a142a10 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 _0xc6ab=['reject','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','tracked','openchannelmessage:create','create','put','/:id','/:id/accept','accept'];(function(_0x866dbd,_0x520da1){var _0x13f769=function(_0x1d9948){while(--_0x1d9948){_0x866dbd['push'](_0x866dbd['shift']());}};_0x13f769(++_0x520da1);}(_0xc6ab,0xd1));var _0xbc6a=function(_0x4cfb85,_0x382e47){_0x4cfb85=_0x4cfb85-0x0;var _0x49e2b7=_0xc6ab[_0x4cfb85];return _0x49e2b7;};'use strict';var multer=require(_0xbc6a('0x0'));var util=require(_0xbc6a('0x1'));var path=require('path');var timeout=require(_0xbc6a('0x2'));var express=require(_0xbc6a('0x3'));var router=express['Router']();var auth=require(_0xbc6a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbc6a('0x5'));var controller=require(_0xbc6a('0x6'));router[_0xbc6a('0x7')]('/',auth[_0xbc6a('0x8')](),controller[_0xbc6a('0x9')]);router[_0xbc6a('0x7')](_0xbc6a('0xa'),auth[_0xbc6a('0x8')](),controller[_0xbc6a('0xb')]);router['get']('/:id',auth[_0xbc6a('0x8')](),controller[_0xbc6a('0xc')]);router[_0xbc6a('0xd')]('/',auth['isAuthenticated'](),interaction[_0xbc6a('0xe')]('openchannel',_0xbc6a('0xf')),controller[_0xbc6a('0x10')]);router[_0xbc6a('0x11')](_0xbc6a('0x12'),auth[_0xbc6a('0x8')](),controller['update']);router[_0xbc6a('0x11')](_0xbc6a('0x13'),auth['isAuthenticated'](),controller[_0xbc6a('0x14')]);router[_0xbc6a('0x11')]('/:id/reject',auth[_0xbc6a('0x8')](),controller[_0xbc6a('0x15')]);router['delete']('/:id',auth[_0xbc6a('0x8')](),controller[_0xbc6a('0x16')]);module['exports']=router; \ No newline at end of file +var _0x14fa=['get','isAuthenticated','index','/describe','describe','/:id','show','tracked','openchannelmessage:create','update','/:id/accept','accept','put','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./openchannelMessage.controller'];(function(_0x4a3398,_0x14931c){var _0x368ac7=function(_0xd1d55){while(--_0xd1d55){_0x4a3398['push'](_0x4a3398['shift']());}};_0x368ac7(++_0x14931c);}(_0x14fa,0xa8));var _0xa14f=function(_0x5089ea,_0x3d8378){_0x5089ea=_0x5089ea-0x0;var _0xabe953=_0x14fa[_0x5089ea];return _0xabe953;};'use strict';var multer=require(_0xa14f('0x0'));var util=require('util');var path=require(_0xa14f('0x1'));var timeout=require(_0xa14f('0x2'));var express=require(_0xa14f('0x3'));var router=express[_0xa14f('0x4')]();var auth=require(_0xa14f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa14f('0x6'));router[_0xa14f('0x7')]('/',auth[_0xa14f('0x8')](),controller[_0xa14f('0x9')]);router['get'](_0xa14f('0xa'),auth[_0xa14f('0x8')](),controller[_0xa14f('0xb')]);router['get'](_0xa14f('0xc'),auth[_0xa14f('0x8')](),controller[_0xa14f('0xd')]);router['post']('/',auth[_0xa14f('0x8')](),interaction[_0xa14f('0xe')]('openchannel',_0xa14f('0xf')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xa14f('0x10')]);router['put'](_0xa14f('0x11'),auth[_0xa14f('0x8')](),controller[_0xa14f('0x12')]);router[_0xa14f('0x13')](_0xa14f('0x14'),auth['isAuthenticated'](),controller[_0xa14f('0x15')]);router[_0xa14f('0x16')](_0xa14f('0xc'),auth[_0xa14f('0x8')](),controller[_0xa14f('0x17')]);module[_0xa14f('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 3001b42..b353131 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 _0x6cbc=['DATE','sequelize','TEXT','BOOLEAN','out'];(function(_0x301825,_0x177da2){var _0xa56d5a=function(_0x525bb7){while(--_0x525bb7){_0x301825['push'](_0x301825['shift']());}};_0xa56d5a(++_0x177da2);}(_0x6cbc,0x15a));var _0xc6cb=function(_0x2e3416,_0x5073f4){_0x2e3416=_0x2e3416-0x0;var _0x1749ff=_0x6cbc[_0x2e3416];return _0x1749ff;};'use strict';var Sequelize=require(_0xc6cb('0x0'));module['exports']={'body':{'type':Sequelize[_0xc6cb('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xc6cb('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xc6cb('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc6cb('0x4')]}}; \ No newline at end of file +var _0xb592=['BOOLEAN','out','DATE','sequelize','TEXT','medium'];(function(_0xdf5452,_0x19af67){var _0xf35e7b=function(_0x4a4ad8){while(--_0x4a4ad8){_0xdf5452['push'](_0xdf5452['shift']());}};_0xf35e7b(++_0x19af67);}(_0xb592,0xc3));var _0x2b59=function(_0x50e086,_0x18f9b9){_0x50e086=_0x50e086-0x0;var _0x4e9143=_0xb592[_0x50e086];return _0x4e9143;};'use strict';var Sequelize=require(_0x2b59('0x0'));module['exports']={'body':{'type':Sequelize[_0x2b59('0x1')](_0x2b59('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x2b59('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x2b59('0x4')),'defaultValue':_0x2b59('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x2b59('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index f659b7f..e507129 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 _0x44c3=['mustache','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','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','status','name','send','map','OpenchannelMessage','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','where','filter','merge','options','includeAll','findAll','rows','show','params','include','find','create','body','describe','accept','read','readAt','UserId','user','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','openchannel-interactions','openchannel','agent','role','null','RejectMessage','rejectMessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x502d3c,_0x16c5e9){var _0x33336a=function(_0x13c01b){while(--_0x13c01b){_0x502d3c['push'](_0x502d3c['shift']());}};_0x33336a(++_0x16c5e9);}(_0x44c3,0x16f));var _0x344c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x44c3[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x344c('0x0'));var emlformat=require(_0x344c('0x1'));var rimraf=require(_0x344c('0x2'));var zipdir=require(_0x344c('0x3'));var jsonpatch=require(_0x344c('0x4'));var rp=require(_0x344c('0x5'));var moment=require(_0x344c('0x6'));var BPromise=require(_0x344c('0x7'));var Mustache=require(_0x344c('0x8'));var util=require('util');var path=require(_0x344c('0x9'));var sox=require(_0x344c('0xa'));var csv=require(_0x344c('0xb'));var ejs=require(_0x344c('0xc'));var fs=require('fs');var _=require(_0x344c('0xd'));var squel=require(_0x344c('0xe'));var crypto=require(_0x344c('0xf'));var jsforce=require(_0x344c('0x10'));var deskjs=require(_0x344c('0x11'));var toCsv=require(_0x344c('0xb'));var querystring=require(_0x344c('0x12'));var Papa=require(_0x344c('0x13'));var Redis=require('ioredis');var authService=require(_0x344c('0x14'));var qs=require(_0x344c('0x15'));var as=require(_0x344c('0x16'));var hardwareService=require(_0x344c('0x17'));var logger=require(_0x344c('0x18'))('api');var utils=require(_0x344c('0x19'));var config=require(_0x344c('0x1a'));var db=require(_0x344c('0x1b'))['db'];config[_0x344c('0x1c')]=_[_0x344c('0x1d')](config[_0x344c('0x1c')],{'host':_0x344c('0x1e'),'port':0x18eb});var socket=require(_0x344c('0x1f'))(new Redis(config[_0x344c('0x1c')]));require('./openchannelMessage.socket')[_0x344c('0x20')](socket);var jayson=require(_0x344c('0x21'));var client=jayson[_0x344c('0x22')][_0x344c('0x23')]({'port':0x232c});var client9002=jayson[_0x344c('0x22')][_0x344c('0x23')]({'port':0x232a});function checkPasswordPattern(_0x2fddd1,_0xfc48d,_0x4e3709){if(_0x4e3709){var _0x3b1f58=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3b1f58[_0x344c('0x24')](_0xfc48d)){return _0x2fddd1;}else{throw new db[(_0x344c('0x25'))][(_0x344c('0x26'))](_0x344c('0x27'));}}else{return _0x2fddd1;}}function respondWithRpcPromise(_0xffc454,_0x44f099,_0x2a0501,_0x11a70d){return new BPromise(function(_0x548b1d,_0x5960dc){var _0x1e7b1c=_0x11a70d||client;return _0x1e7b1c[_0x344c('0x28')](_0xffc454,_0x2a0501)[_0x344c('0x29')](function(_0x4d05da){logger['info'](_0x344c('0x2a'),_0x44f099,_0x344c('0x2b'));logger['debug'](_0x344c('0x2c'),_0x44f099,_0x344c('0x2b'),JSON[_0x344c('0x2d')](_0x4d05da));if(_0x4d05da['error']){if(_0x4d05da[_0x344c('0x2e')][_0x344c('0x2f')]===0x1f4){logger[_0x344c('0x2e')](_0x344c('0x2a'),_0x44f099,_0x4d05da[_0x344c('0x2e')]['message']);return _0x5960dc(_0x4d05da[_0x344c('0x2e')][_0x344c('0x30')]);}logger[_0x344c('0x2e')](_0x344c('0x2a'),_0x44f099,_0x4d05da['error'][_0x344c('0x30')]);return _0x548b1d(_0x4d05da['error'][_0x344c('0x30')]);}else{logger[_0x344c('0x31')]('OpenchannelMessage,\x20%s,\x20%s',_0x44f099,_0x344c('0x2b'));_0x548b1d(_0x4d05da[_0x344c('0x32')][_0x344c('0x30')]);}})[_0x344c('0x33')](function(_0xa10f52){logger['error'](_0x344c('0x2a'),_0x44f099,_0xa10f52);_0x5960dc(_0xa10f52);});});}function respondWithStatusCode(_0x32bad4,_0x238fcb){_0x238fcb=_0x238fcb||0xcc;return function(_0x521ccc){if(_0x521ccc){return _0x32bad4[_0x344c('0x34')](_0x238fcb);}return _0x32bad4['status'](_0x238fcb)[_0x344c('0x35')]();};}function respondWithResult(_0x57f10a,_0x31f78f){_0x31f78f=_0x31f78f||0xc8;return function(_0x25223c){if(_0x25223c){return _0x57f10a['status'](_0x31f78f)[_0x344c('0x36')](_0x25223c);}};}function respondWithFilteredResult(_0x3984d7,_0x50ce7c){return function(_0x347ed8){if(_0x347ed8){var _0xcb5d97=_0x347ed8[_0x344c('0x37')],_0x4ca10b=_0x50ce7c[_0x344c('0x38')],_0x104377=_0x50ce7c[_0x344c('0x38')]+_0x50ce7c[_0x344c('0x39')],_0xec3acd;if(_0x104377>=_0xcb5d97){_0x104377=_0xcb5d97;_0xec3acd=0xc8;}else{_0xec3acd=0xce;}_0x3984d7['status'](_0xec3acd);return _0x3984d7[_0x344c('0x3a')](_0x344c('0x3b'),_0x4ca10b+'-'+_0x104377+'/'+_0xcb5d97)[_0x344c('0x36')](_0x347ed8);}return null;};}function patchUpdates(_0x1e5914){return function(_0x466988){try{jsonpatch[_0x344c('0x3c')](_0x466988,_0x1e5914,!![]);}catch(_0xb25c46){return BPromise[_0x344c('0x3d')](_0xb25c46);}return _0x466988['save']();};}function saveUpdates(_0x1469b9,_0x3245ae){return function(_0x14f69a){if(_0x14f69a){return _0x14f69a[_0x344c('0x3e')](_0x1469b9)[_0x344c('0x29')](function(_0x16793e){return _0x16793e;});}return null;};}function removeEntity(_0x24c425,_0x305abe){return function(_0x2a6333){if(_0x2a6333){return _0x2a6333[_0x344c('0x3f')]()[_0x344c('0x29')](function(){_0x24c425[_0x344c('0x40')](0xcc)[_0x344c('0x35')]();});}};}function handleEntityNotFound(_0x29c62f,_0x109867){return function(_0x58e6c0){if(!_0x58e6c0){_0x29c62f[_0x344c('0x34')](0x194);}return _0x58e6c0;};}function handleError(_0x52267c,_0x2c95d8){_0x2c95d8=_0x2c95d8||0x1f4;return function(_0x2faa14){logger[_0x344c('0x2e')](_0x2faa14['stack']);if(_0x2faa14[_0x344c('0x41')]){delete _0x2faa14[_0x344c('0x41')];}_0x52267c['status'](_0x2c95d8)[_0x344c('0x42')](_0x2faa14);};}exports['index']=function(_0x1d178d,_0x5c714f){var _0x54b420={},_0x5558b4={},_0x181a6c={'count':0x0,'rows':[]};var _0x524226=_[_0x344c('0x43')](db[_0x344c('0x44')][_0x344c('0x45')],function(_0x58224e){return{'name':_0x58224e['fieldName'],'type':_0x58224e[_0x344c('0x46')][_0x344c('0x47')]};});_0x5558b4['model']=_['map'](_0x524226,_0x344c('0x41'));_0x5558b4[_0x344c('0x48')]=_[_0x344c('0x49')](_0x1d178d[_0x344c('0x48')]);_0x5558b4[_0x344c('0x4a')]=_[_0x344c('0x4b')](_0x5558b4[_0x344c('0x4c')],_0x5558b4['query']);_0x54b420[_0x344c('0x4d')]=_['intersection'](_0x5558b4['model'],qs[_0x344c('0x4e')](_0x1d178d[_0x344c('0x48')]['fields']));_0x54b420[_0x344c('0x4d')]=_0x54b420[_0x344c('0x4d')][_0x344c('0x4f')]?_0x54b420['attributes']:_0x5558b4[_0x344c('0x4c')];if(!_0x1d178d[_0x344c('0x48')]['hasOwnProperty'](_0x344c('0x50'))){_0x54b420[_0x344c('0x39')]=qs['limit'](_0x1d178d[_0x344c('0x48')]['limit']);_0x54b420[_0x344c('0x38')]=qs[_0x344c('0x38')](_0x1d178d[_0x344c('0x48')][_0x344c('0x38')]);}_0x54b420['order']=qs['sort'](_0x1d178d[_0x344c('0x48')]['sort']);_0x54b420[_0x344c('0x51')]=qs['filters'](_['pick'](_0x1d178d['query'],_0x5558b4[_0x344c('0x4a')]),_0x524226);if(_0x1d178d['query'][_0x344c('0x52')]){_0x54b420[_0x344c('0x51')]=_[_0x344c('0x53')](_0x54b420[_0x344c('0x51')],{'$or':_[_0x344c('0x43')](_0x524226,function(_0x4ec674){if(_0x4ec674[_0x344c('0x46')]!=='VIRTUAL'){var _0x56d2fd={};_0x56d2fd[_0x4ec674['name']]={'$like':'%'+_0x1d178d[_0x344c('0x48')][_0x344c('0x52')]+'%'};return _0x56d2fd;}})});}_0x54b420=_[_0x344c('0x53')]({},_0x54b420,_0x1d178d[_0x344c('0x54')]);var _0x249cdc={'where':_0x54b420[_0x344c('0x51')]};return db[_0x344c('0x44')]['count'](_0x249cdc)[_0x344c('0x29')](function(_0x145620){_0x181a6c['count']=_0x145620;if(_0x1d178d[_0x344c('0x48')][_0x344c('0x55')]){_0x54b420['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x344c('0x56')](_0x54b420);})[_0x344c('0x29')](function(_0xa674){_0x181a6c[_0x344c('0x57')]=_0xa674;return _0x181a6c;})[_0x344c('0x29')](respondWithFilteredResult(_0x5c714f,_0x54b420))['catch'](handleError(_0x5c714f,null));};exports[_0x344c('0x58')]=function(_0x449590,_0x5728e7){var _0x49c39d={'raw':!![],'where':{'id':_0x449590[_0x344c('0x59')]['id']}},_0x45aef2={};_0x45aef2['model']=_[_0x344c('0x49')](db[_0x344c('0x44')][_0x344c('0x45')]);_0x45aef2['query']=_[_0x344c('0x49')](_0x449590[_0x344c('0x48')]);_0x45aef2['filters']=_['intersection'](_0x45aef2[_0x344c('0x4c')],_0x45aef2[_0x344c('0x48')]);_0x49c39d[_0x344c('0x4d')]=_[_0x344c('0x4b')](_0x45aef2[_0x344c('0x4c')],qs['fields'](_0x449590[_0x344c('0x48')]['fields']));_0x49c39d['attributes']=_0x49c39d[_0x344c('0x4d')]['length']?_0x49c39d[_0x344c('0x4d')]:_0x45aef2[_0x344c('0x4c')];if(_0x449590[_0x344c('0x48')][_0x344c('0x55')]){_0x49c39d[_0x344c('0x5a')]=[{'all':!![]}];}_0x49c39d=_[_0x344c('0x53')]({},_0x49c39d,_0x449590['options']);return db['OpenchannelMessage'][_0x344c('0x5b')](_0x49c39d)[_0x344c('0x29')](handleEntityNotFound(_0x5728e7,null))[_0x344c('0x29')](respondWithResult(_0x5728e7,null))['catch'](handleError(_0x5728e7,null));};exports[_0x344c('0x5c')]=function(_0x5e2b39,_0x56fb52){return db[_0x344c('0x44')][_0x344c('0x5c')](_0x5e2b39['body'],{})[_0x344c('0x29')](respondWithResult(_0x56fb52,0xc9))['catch'](handleError(_0x56fb52,null));};exports[_0x344c('0x3e')]=function(_0x435407,_0x11a0fc){if(_0x435407[_0x344c('0x5d')]['id']){delete _0x435407[_0x344c('0x5d')]['id'];}return db['OpenchannelMessage']['find']({'where':{'id':_0x435407[_0x344c('0x59')]['id']}})[_0x344c('0x29')](handleEntityNotFound(_0x11a0fc,null))[_0x344c('0x29')](saveUpdates(_0x435407['body'],null))['then'](respondWithResult(_0x11a0fc,null))[_0x344c('0x33')](handleError(_0x11a0fc,null));};exports[_0x344c('0x3f')]=function(_0x144e49,_0x56230a){return db[_0x344c('0x44')]['find']({'where':{'id':_0x144e49[_0x344c('0x59')]['id']}})[_0x344c('0x29')](handleEntityNotFound(_0x56230a,null))[_0x344c('0x29')](removeEntity(_0x56230a,null))['catch'](handleError(_0x56230a,null));};exports[_0x344c('0x5e')]=function(_0x594599,_0x29a572){return db[_0x344c('0x44')][_0x344c('0x5e')]()[_0x344c('0x29')](respondWithResult(_0x29a572,null))[_0x344c('0x33')](handleError(_0x29a572,null));};var interaction_log=require(_0x344c('0x18'))('openchannel-interactions');exports[_0x344c('0x5f')]=function(_0xc936aa,_0x323698,_0x17b233){var _0x44ba03={'channel':'openchannel'};if(_0xc936aa['body']['id']){delete _0xc936aa[_0x344c('0x5d')]['id'];}_0xc936aa['body'][_0x344c('0x60')]=!![];_0xc936aa[_0x344c('0x5d')][_0x344c('0x61')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xc936aa['body'][_0x344c('0x62')]=_0xc936aa[_0x344c('0x5d')][_0x344c('0x62')]||_0xc936aa[_0x344c('0x63')]['id'];return db[_0x344c('0x44')][_0x344c('0x5b')]({'where':{'id':_0xc936aa['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x344c('0x64')}]})['then'](handleEntityNotFound(_0x323698,null))['then'](saveUpdates(_0xc936aa[_0x344c('0x5d')],null))[_0x344c('0x29')](function(_0x22230a){if(_0x22230a){_0x44ba03[_0x344c('0x30')]=_0x22230a[_0x344c('0x65')]({'plain':!![]});return db[_0x344c('0x66')][_0x344c('0x5b')]({'where':{'id':_0x22230a[_0x344c('0x67')]}});}return null;})[_0x344c('0x29')](handleEntityNotFound(_0x323698,null))['then'](function(_0x35934c){if(_0x35934c){return _0x35934c[_0x344c('0x3e')]({'UserId':_0xc936aa[_0x344c('0x5d')][_0x344c('0x62')],'read1stAt':_[_0x344c('0x68')](_0x35934c[_0x344c('0x69')])?moment()[_0x344c('0x6a')](_0x344c('0x6b')):undefined});}return null;})[_0x344c('0x29')](function(_0x381615){if(_0x381615){_0x44ba03[_0x344c('0x6c')]=_0x381615[_0x344c('0x65')]({'plain':!![]});interaction_log[_0x344c('0x31')](_0x344c('0x6d'),_0xc936aa['user']['id'],_0xc936aa['user'][_0x344c('0x41')],_0xc936aa['user']['role'],_0x44ba03[_0x344c('0x6c')]['id'],_0xc936aa[_0x344c('0x5d')]?JSON[_0x344c('0x2d')](_0xc936aa['body']):'null');return respondWithRpcPromise(_0x344c('0x6e'),_0x344c('0x6f'),_0x44ba03);}return null;})[_0x344c('0x29')](function(_0x3bde8a){if(_0x3bde8a){if(_0xc936aa[_0x344c('0x5d')]['manual']){_0x44ba03[_0x344c('0x30')][_0x344c('0x70')]=util[_0x344c('0x6a')](_0x344c('0x71'),_0xc936aa[_0x344c('0x63')][_0x344c('0x41')]);_0x44ba03[_0x344c('0x30')][_0x344c('0x72')]=_0x44ba03[_0x344c('0x72')];_0x44ba03[_0x344c('0x30')][_0x344c('0x73')]=_0x344c('0x5f');return respondWithRpcPromise(_0x344c('0x74'),'EventManager',{'event':_0x344c('0x75'),'message':_0x44ba03['message']},client9002)['then'](function(){return _0x44ba03;});}return _0x44ba03;}return null;})[_0x344c('0x29')](respondWithResult(_0x323698,null))['catch'](handleError(_0x323698,null));};var interaction_log=require(_0x344c('0x18'))(_0x344c('0x76'));exports['reject']=function(_0x48e4fa,_0x24efce,_0x28f5c5){var _0x2a3b4a={'agent':{},'channel':_0x344c('0x77')};if(_0x48e4fa[_0x344c('0x5d')]['id']){delete _0x48e4fa['body']['id'];}_0x48e4fa['body'][_0x344c('0x62')]=_0x48e4fa['body'][_0x344c('0x62')]||_0x48e4fa[_0x344c('0x63')]['id'];_0x2a3b4a[_0x344c('0x78')]['id']=_0x48e4fa[_0x344c('0x5d')]['UserId'];return db[_0x344c('0x44')]['find']({'where':{'id':_0x48e4fa[_0x344c('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x24efce,null))[_0x344c('0x29')](function(_0x1cf045){if(_0x1cf045){_0x2a3b4a[_0x344c('0x30')]=_0x1cf045[_0x344c('0x65')]({'plain':!![]});return db[_0x344c('0x66')][_0x344c('0x5b')]({'where':{'id':_0x1cf045[_0x344c('0x67')]}});}return null;})[_0x344c('0x29')](handleEntityNotFound(_0x24efce,null))['then'](function(_0x32df53){if(_0x32df53){_0x2a3b4a['interaction']=_0x32df53[_0x344c('0x65')]({'plain':!![]});interaction_log[_0x344c('0x31')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x48e4fa[_0x344c('0x63')]['id'],_0x48e4fa[_0x344c('0x63')]['name'],_0x48e4fa['user'][_0x344c('0x79')],_0x2a3b4a[_0x344c('0x6c')]['id'],_0x48e4fa[_0x344c('0x5d')]?JSON['stringify'](_0x48e4fa['body']):_0x344c('0x7a'));return respondWithRpcPromise(_0x344c('0x7b'),_0x344c('0x7c'),_0x2a3b4a);}return null;})[_0x344c('0x29')](function(_0x16e110){if(_0x16e110){_0x16e110['message']['interface']=util[_0x344c('0x6a')](_0x344c('0x71'),_0x48e4fa[_0x344c('0x63')][_0x344c('0x41')]);_0x16e110['message']['channel']=_0x2a3b4a['channel'];_0x16e110[_0x344c('0x30')][_0x344c('0x73')]=_0x344c('0x3d');respondWithRpcPromise('EventManager',_0x344c('0x74'),{'event':'rejectmessage','message':_0x16e110[_0x344c('0x30')]},client9002);return _0x2a3b4a;}return null;})[_0x344c('0x29')](respondWithResult(_0x24efce,null))[_0x344c('0x33')](handleError(_0x24efce,null));}; \ No newline at end of file +var _0x3196=['read1stAt','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','name','index','map','OpenchannelMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','rawAttributes','find','create','body','update','params','describe','openchannel-interactions','accept','openchannel','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil'];(function(_0x73a3f6,_0x35b218){var _0x3ddd58=function(_0x4d4a8f){while(--_0x4d4a8f){_0x73a3f6['push'](_0x73a3f6['shift']());}};_0x3ddd58(++_0x35b218);}(_0x3196,0x108));var _0x6319=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3196[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x6319('0x0'));var emlformat=require(_0x6319('0x1'));var rimraf=require(_0x6319('0x2'));var zipdir=require(_0x6319('0x3'));var jsonpatch=require(_0x6319('0x4'));var rp=require(_0x6319('0x5'));var moment=require(_0x6319('0x6'));var BPromise=require(_0x6319('0x7'));var Mustache=require(_0x6319('0x8'));var util=require(_0x6319('0x9'));var path=require(_0x6319('0xa'));var sox=require('sox');var csv=require(_0x6319('0xb'));var ejs=require(_0x6319('0xc'));var fs=require('fs');var _=require(_0x6319('0xd'));var squel=require(_0x6319('0xe'));var crypto=require(_0x6319('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x6319('0x10'));var toCsv=require(_0x6319('0xb'));var querystring=require(_0x6319('0x11'));var Papa=require(_0x6319('0x12'));var Redis=require(_0x6319('0x13'));var authService=require(_0x6319('0x14'));var qs=require(_0x6319('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6319('0x16'));var logger=require(_0x6319('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x6319('0x18'));var db=require('../../mysqldb')['db'];config[_0x6319('0x19')]=_[_0x6319('0x1a')](config[_0x6319('0x19')],{'host':_0x6319('0x1b'),'port':0x18eb});var socket=require(_0x6319('0x1c'))(new Redis(config['redis']));require(_0x6319('0x1d'))[_0x6319('0x1e')](socket);var jayson=require(_0x6319('0x1f'));var client=jayson[_0x6319('0x20')][_0x6319('0x21')]({'port':0x232c});var client9002=jayson[_0x6319('0x20')]['http']({'port':0x232a});function checkPasswordPattern(_0x41af05,_0x13bb98,_0x5ccc37){if(_0x5ccc37){var _0x1e6491=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e6491[_0x6319('0x22')](_0x13bb98)){return _0x41af05;}else{throw new db[(_0x6319('0x23'))]['ValidationError'](_0x6319('0x24'));}}else{return _0x41af05;}}function respondWithRpcPromise(_0x28d406,_0xa552a0,_0x1a1dbf,_0x95efe4){return new BPromise(function(_0x542997,_0x125187){var _0x13218f=_0x95efe4||client;return _0x13218f[_0x6319('0x25')](_0x28d406,_0x1a1dbf)[_0x6319('0x26')](function(_0x43b166){logger[_0x6319('0x27')](_0x6319('0x28'),_0xa552a0,_0x6319('0x29'));logger['debug'](_0x6319('0x2a'),_0xa552a0,'request\x20sent',JSON[_0x6319('0x2b')](_0x43b166));if(_0x43b166['error']){if(_0x43b166[_0x6319('0x2c')][_0x6319('0x2d')]===0x1f4){logger[_0x6319('0x2c')](_0x6319('0x28'),_0xa552a0,_0x43b166[_0x6319('0x2c')]['message']);return _0x125187(_0x43b166[_0x6319('0x2c')][_0x6319('0x2e')]);}logger[_0x6319('0x2c')]('OpenchannelMessage,\x20%s,\x20%s',_0xa552a0,_0x43b166[_0x6319('0x2c')]['message']);return _0x542997(_0x43b166['error'][_0x6319('0x2e')]);}else{logger[_0x6319('0x27')](_0x6319('0x28'),_0xa552a0,_0x6319('0x29'));_0x542997(_0x43b166[_0x6319('0x2f')][_0x6319('0x2e')]);}})[_0x6319('0x30')](function(_0x3a38b9){logger[_0x6319('0x2c')](_0x6319('0x28'),_0xa552a0,_0x3a38b9);_0x125187(_0x3a38b9);});});}function respondWithStatusCode(_0x172788,_0x3bcb09){_0x3bcb09=_0x3bcb09||0xcc;return function(_0x198915){if(_0x198915){return _0x172788[_0x6319('0x31')](_0x3bcb09);}return _0x172788[_0x6319('0x32')](_0x3bcb09)[_0x6319('0x33')]();};}function respondWithResult(_0x4911da,_0x357888){_0x357888=_0x357888||0xc8;return function(_0x29a71e){if(_0x29a71e){return _0x4911da[_0x6319('0x32')](_0x357888)['json'](_0x29a71e);}};}function respondWithFilteredResult(_0xa69b89,_0x10df37){return function(_0x361039){if(_0x361039){var _0xbea7b7=_0x361039[_0x6319('0x34')],_0x5e2b46=_0x10df37[_0x6319('0x35')],_0x1daf66=_0x10df37[_0x6319('0x35')]+_0x10df37[_0x6319('0x36')],_0x2f58d6;if(_0x1daf66>=_0xbea7b7){_0x1daf66=_0xbea7b7;_0x2f58d6=0xc8;}else{_0x2f58d6=0xce;}_0xa69b89[_0x6319('0x32')](_0x2f58d6);return _0xa69b89[_0x6319('0x37')](_0x6319('0x38'),_0x5e2b46+'-'+_0x1daf66+'/'+_0xbea7b7)[_0x6319('0x39')](_0x361039);}return null;};}function patchUpdates(_0x41dc84){return function(_0x4618f5){try{jsonpatch[_0x6319('0x3a')](_0x4618f5,_0x41dc84,!![]);}catch(_0x542957){return BPromise[_0x6319('0x3b')](_0x542957);}return _0x4618f5[_0x6319('0x3c')]();};}function saveUpdates(_0x52fad2,_0x105c98){return function(_0x52e91d){if(_0x52e91d){return _0x52e91d['update'](_0x52fad2)[_0x6319('0x26')](function(_0x2fd16b){return _0x2fd16b;});}return null;};}function removeEntity(_0x183f9b,_0x4f3ebb){return function(_0x102579){if(_0x102579){return _0x102579[_0x6319('0x3d')]()[_0x6319('0x26')](function(){_0x183f9b[_0x6319('0x32')](0xcc)[_0x6319('0x33')]();});}};}function handleEntityNotFound(_0x1e46d3,_0x5de4d7){return function(_0xf9e90a){if(!_0xf9e90a){_0x1e46d3['sendStatus'](0x194);}return _0xf9e90a;};}function handleError(_0x23c833,_0x5227f9){_0x5227f9=_0x5227f9||0x1f4;return function(_0x517dce){logger[_0x6319('0x2c')](_0x517dce['stack']);if(_0x517dce[_0x6319('0x3e')]){delete _0x517dce['name'];}_0x23c833[_0x6319('0x32')](_0x5227f9)['send'](_0x517dce);};}exports[_0x6319('0x3f')]=function(_0x1629a3,_0x300914){var _0x54633f={},_0x34d7b4={},_0x239b46={'count':0x0,'rows':[]};var _0x179c69=_[_0x6319('0x40')](db[_0x6319('0x41')]['rawAttributes'],function(_0xd8b4d2){return{'name':_0xd8b4d2[_0x6319('0x42')],'type':_0xd8b4d2[_0x6319('0x43')][_0x6319('0x44')]};});_0x34d7b4[_0x6319('0x45')]=_[_0x6319('0x40')](_0x179c69,_0x6319('0x3e'));_0x34d7b4[_0x6319('0x46')]=_[_0x6319('0x47')](_0x1629a3[_0x6319('0x46')]);_0x34d7b4[_0x6319('0x48')]=_[_0x6319('0x49')](_0x34d7b4[_0x6319('0x45')],_0x34d7b4['query']);_0x54633f[_0x6319('0x4a')]=_[_0x6319('0x49')](_0x34d7b4[_0x6319('0x45')],qs[_0x6319('0x4b')](_0x1629a3[_0x6319('0x46')][_0x6319('0x4b')]));_0x54633f['attributes']=_0x54633f[_0x6319('0x4a')][_0x6319('0x4c')]?_0x54633f[_0x6319('0x4a')]:_0x34d7b4['model'];if(!_0x1629a3['query']['hasOwnProperty'](_0x6319('0x4d'))){_0x54633f['limit']=qs[_0x6319('0x36')](_0x1629a3[_0x6319('0x46')][_0x6319('0x36')]);_0x54633f[_0x6319('0x35')]=qs['offset'](_0x1629a3['query']['offset']);}_0x54633f[_0x6319('0x4e')]=qs['sort'](_0x1629a3['query'][_0x6319('0x4f')]);_0x54633f[_0x6319('0x50')]=qs[_0x6319('0x48')](_[_0x6319('0x51')](_0x1629a3[_0x6319('0x46')],_0x34d7b4[_0x6319('0x48')]),_0x179c69);if(_0x1629a3[_0x6319('0x46')][_0x6319('0x52')]){_0x54633f[_0x6319('0x50')]=_[_0x6319('0x53')](_0x54633f[_0x6319('0x50')],{'$or':_[_0x6319('0x40')](_0x179c69,function(_0x414af8){if(_0x414af8[_0x6319('0x43')]!==_0x6319('0x54')){var _0x5908cc={};_0x5908cc[_0x414af8[_0x6319('0x3e')]]={'$like':'%'+_0x1629a3[_0x6319('0x46')][_0x6319('0x52')]+'%'};return _0x5908cc;}})});}_0x54633f=_[_0x6319('0x53')]({},_0x54633f,_0x1629a3['options']);var _0x2f80d8={'where':_0x54633f[_0x6319('0x50')]};return db['OpenchannelMessage'][_0x6319('0x34')](_0x2f80d8)[_0x6319('0x26')](function(_0x3159d8){_0x239b46[_0x6319('0x34')]=_0x3159d8;if(_0x1629a3[_0x6319('0x46')][_0x6319('0x55')]){_0x54633f[_0x6319('0x56')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x6319('0x57')](_0x54633f);})[_0x6319('0x26')](function(_0x501fb5){_0x239b46['rows']=_0x501fb5;return _0x239b46;})[_0x6319('0x26')](respondWithFilteredResult(_0x300914,_0x54633f))[_0x6319('0x30')](handleError(_0x300914,null));};exports[_0x6319('0x58')]=function(_0x2195cd,_0x3db84b){var _0x17493c={'raw':!![],'where':{'id':_0x2195cd['params']['id']}},_0x40ffc9={};_0x40ffc9[_0x6319('0x45')]=_[_0x6319('0x47')](db[_0x6319('0x41')][_0x6319('0x59')]);_0x40ffc9[_0x6319('0x46')]=_[_0x6319('0x47')](_0x2195cd[_0x6319('0x46')]);_0x40ffc9[_0x6319('0x48')]=_[_0x6319('0x49')](_0x40ffc9[_0x6319('0x45')],_0x40ffc9['query']);_0x17493c['attributes']=_[_0x6319('0x49')](_0x40ffc9[_0x6319('0x45')],qs[_0x6319('0x4b')](_0x2195cd['query'][_0x6319('0x4b')]));_0x17493c[_0x6319('0x4a')]=_0x17493c[_0x6319('0x4a')][_0x6319('0x4c')]?_0x17493c['attributes']:_0x40ffc9[_0x6319('0x45')];if(_0x2195cd['query'][_0x6319('0x55')]){_0x17493c[_0x6319('0x56')]=[{'all':!![]}];}_0x17493c=_[_0x6319('0x53')]({},_0x17493c,_0x2195cd['options']);return db[_0x6319('0x41')][_0x6319('0x5a')](_0x17493c)[_0x6319('0x26')](handleEntityNotFound(_0x3db84b,null))[_0x6319('0x26')](respondWithResult(_0x3db84b,null))[_0x6319('0x30')](handleError(_0x3db84b,null));};exports['create']=function(_0x198d01,_0x171b8b){return db['OpenchannelMessage'][_0x6319('0x5b')](_0x198d01[_0x6319('0x5c')],{})[_0x6319('0x26')](respondWithResult(_0x171b8b,0xc9))[_0x6319('0x30')](handleError(_0x171b8b,null));};exports[_0x6319('0x5d')]=function(_0x264214,_0xd3078d){if(_0x264214['body']['id']){delete _0x264214[_0x6319('0x5c')]['id'];}return db[_0x6319('0x41')][_0x6319('0x5a')]({'where':{'id':_0x264214[_0x6319('0x5e')]['id']}})[_0x6319('0x26')](handleEntityNotFound(_0xd3078d,null))[_0x6319('0x26')](saveUpdates(_0x264214[_0x6319('0x5c')],null))[_0x6319('0x26')](respondWithResult(_0xd3078d,null))[_0x6319('0x30')](handleError(_0xd3078d,null));};exports['destroy']=function(_0x4f55c8,_0x1549df){return db[_0x6319('0x41')][_0x6319('0x5a')]({'where':{'id':_0x4f55c8[_0x6319('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1549df,null))[_0x6319('0x26')](removeEntity(_0x1549df,null))[_0x6319('0x30')](handleError(_0x1549df,null));};exports[_0x6319('0x5f')]=function(_0x486ba3,_0x46ed9c){return db[_0x6319('0x41')][_0x6319('0x5f')]()[_0x6319('0x26')](respondWithResult(_0x46ed9c,null))[_0x6319('0x30')](handleError(_0x46ed9c,null));};var interaction_log=require(_0x6319('0x17'))(_0x6319('0x60'));exports[_0x6319('0x61')]=function(_0x130f66,_0x4bc15c,_0x49b286){var _0x28b311={'channel':_0x6319('0x62')};if(_0x130f66[_0x6319('0x5c')]['id']){delete _0x130f66[_0x6319('0x5c')]['id'];}_0x130f66[_0x6319('0x5c')]['read']=!![];_0x130f66['body'][_0x6319('0x63')]=moment()['format'](_0x6319('0x64'));_0x130f66[_0x6319('0x5c')]['UserId']=_0x130f66['body'][_0x6319('0x65')]||_0x130f66[_0x6319('0x66')]['id'];return db[_0x6319('0x41')][_0x6319('0x5a')]({'where':{'id':_0x130f66[_0x6319('0x5e')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x6319('0x67')}]})[_0x6319('0x26')](handleEntityNotFound(_0x4bc15c,null))['then'](saveUpdates(_0x130f66['body'],null))['then'](function(_0x3642d4){if(_0x3642d4){_0x28b311[_0x6319('0x2e')]=_0x3642d4[_0x6319('0x68')]({'plain':!![]});return db[_0x6319('0x69')]['find']({'where':{'id':_0x3642d4[_0x6319('0x6a')]}});}return null;})[_0x6319('0x26')](handleEntityNotFound(_0x4bc15c,null))[_0x6319('0x26')](function(_0x5dbc0b){if(_0x5dbc0b){return _0x5dbc0b[_0x6319('0x5d')]({'UserId':_0x130f66['body'][_0x6319('0x65')],'read1stAt':_[_0x6319('0x6b')](_0x5dbc0b[_0x6319('0x6c')])?moment()[_0x6319('0x6d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x6319('0x26')](function(_0x3f21fd){if(_0x3f21fd){_0x28b311[_0x6319('0x6e')]=_0x3f21fd['get']({'plain':!![]});interaction_log[_0x6319('0x27')](_0x6319('0x6f'),_0x130f66[_0x6319('0x66')]['id'],_0x130f66[_0x6319('0x66')][_0x6319('0x3e')],_0x130f66['user']['role'],_0x28b311[_0x6319('0x6e')]['id'],_0x130f66[_0x6319('0x5c')]?JSON['stringify'](_0x130f66[_0x6319('0x5c')]):_0x6319('0x70'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x28b311);}return null;})[_0x6319('0x26')](function(_0x5978c0){if(_0x5978c0){if(_0x130f66[_0x6319('0x5c')]['manual']){_0x28b311[_0x6319('0x2e')][_0x6319('0x71')]=util['format'](_0x6319('0x72'),_0x130f66[_0x6319('0x66')][_0x6319('0x3e')]);_0x28b311[_0x6319('0x2e')][_0x6319('0x73')]=_0x28b311[_0x6319('0x73')];_0x28b311[_0x6319('0x2e')][_0x6319('0x74')]='accept';return respondWithRpcPromise(_0x6319('0x75'),'EventManager',{'event':_0x6319('0x76'),'message':_0x28b311[_0x6319('0x2e')]},client9002)[_0x6319('0x26')](function(){return _0x28b311;});}return _0x28b311;}return null;})[_0x6319('0x26')](respondWithResult(_0x4bc15c,null))[_0x6319('0x30')](handleError(_0x4bc15c,null));};var interaction_log=require(_0x6319('0x17'))(_0x6319('0x60'));exports[_0x6319('0x3b')]=function(_0x3f2f3b,_0x50e530,_0x542b05){var _0x5400c8={'agent':{},'channel':_0x6319('0x62')};if(_0x3f2f3b[_0x6319('0x5c')]['id']){delete _0x3f2f3b[_0x6319('0x5c')]['id'];}_0x3f2f3b[_0x6319('0x5c')][_0x6319('0x65')]=_0x3f2f3b[_0x6319('0x5c')][_0x6319('0x65')]||_0x3f2f3b['user']['id'];_0x5400c8[_0x6319('0x77')]['id']=_0x3f2f3b[_0x6319('0x5c')][_0x6319('0x65')];return db['OpenchannelMessage'][_0x6319('0x5a')]({'where':{'id':_0x3f2f3b[_0x6319('0x5e')]['id'],'UserId':null}})[_0x6319('0x26')](handleEntityNotFound(_0x50e530,null))[_0x6319('0x26')](function(_0x3e01b7){if(_0x3e01b7){_0x5400c8['message']=_0x3e01b7[_0x6319('0x68')]({'plain':!![]});return db[_0x6319('0x69')]['find']({'where':{'id':_0x3e01b7[_0x6319('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x50e530,null))[_0x6319('0x26')](function(_0x594676){if(_0x594676){_0x5400c8[_0x6319('0x6e')]=_0x594676[_0x6319('0x68')]({'plain':!![]});interaction_log[_0x6319('0x27')](_0x6319('0x78'),_0x3f2f3b['user']['id'],_0x3f2f3b[_0x6319('0x66')][_0x6319('0x3e')],_0x3f2f3b[_0x6319('0x66')][_0x6319('0x79')],_0x5400c8['interaction']['id'],_0x3f2f3b['body']?JSON[_0x6319('0x2b')](_0x3f2f3b[_0x6319('0x5c')]):_0x6319('0x70'));return respondWithRpcPromise(_0x6319('0x7a'),_0x6319('0x7b'),_0x5400c8);}return null;})[_0x6319('0x26')](function(_0xd9cb39){if(_0xd9cb39){_0xd9cb39[_0x6319('0x2e')][_0x6319('0x71')]=util[_0x6319('0x6d')]('SIP/%s',_0x3f2f3b[_0x6319('0x66')]['name']);_0xd9cb39[_0x6319('0x2e')][_0x6319('0x73')]=_0x5400c8[_0x6319('0x73')];_0xd9cb39[_0x6319('0x2e')]['event']=_0x6319('0x3b');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0xd9cb39[_0x6319('0x2e')]},client9002);return _0x5400c8;}return null;})[_0x6319('0x26')](respondWithResult(_0x50e530,null))[_0x6319('0x30')](handleError(_0x50e530,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index d42faed..ae72b8a 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 _0xea92=['hasOwnProperty','hook','exports','events','setMaxListeners','update','remove','emit'];(function(_0x55100f,_0x52b6e9){var _0x5ca4c8=function(_0x378948){while(--_0x378948){_0x55100f['push'](_0x55100f['shift']());}};_0x5ca4c8(++_0x52b6e9);}(_0xea92,0x73));var _0x2ea9=function(_0x5387c2,_0x2951de){_0x5387c2=_0x5387c2-0x0;var _0x540ab0=_0xea92[_0x5387c2];return _0x540ab0;};'use strict';var EventEmitter=require(_0x2ea9('0x0'));var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x2ea9('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2ea9('0x2'),'afterDestroy':_0x2ea9('0x3')};function emitEvent(_0x46fcbe){return function(_0x350844,_0x243568,_0x193b62){OpenchannelMessageEvents[_0x2ea9('0x4')](_0x46fcbe+':'+_0x350844['id'],_0x350844);OpenchannelMessageEvents[_0x2ea9('0x4')](_0x46fcbe,_0x350844);_0x193b62(null);};}for(var e in events){if(events[_0x2ea9('0x5')](e)){var event=events[e];OpenchannelMessage[_0x2ea9('0x6')](e,emitEvent(event));}}module[_0x2ea9('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x0500=['update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x1139fe,_0x2eee8c){var _0x339a31=function(_0xc946c5){while(--_0xc946c5){_0x1139fe['push'](_0x1139fe['shift']());}};_0x339a31(++_0x2eee8c);}(_0x0500,0x1e5));var _0x0050=function(_0x3dd3c1,_0x50db45){_0x3dd3c1=_0x3dd3c1-0x0;var _0x22d1cc=_0x0500[_0x3dd3c1];return _0x22d1cc;};'use strict';var EventEmitter=require(_0x0050('0x0'));var OpenchannelMessage=require(_0x0050('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x0050('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0050('0x3'),'afterDestroy':_0x0050('0x4')};function emitEvent(_0x4eaab5){return function(_0x1914b8,_0x223006,_0x2188c3){OpenchannelMessageEvents[_0x0050('0x5')](_0x4eaab5+':'+_0x1914b8['id'],_0x1914b8);OpenchannelMessageEvents[_0x0050('0x5')](_0x4eaab5,_0x1914b8);_0x2188c3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x0050('0x6')](e,emitEvent(event));}}module[_0x0050('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 3f8c868..de2e0fb 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 _0x0b78=['length','Interaction','omit','POST','method','GET','format','threadId','update','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','then','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','Interactions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0b78,0x1ad));var _0x80b7=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0b78[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x80b7('0x0'));var util=require(_0x80b7('0x1'));var logger=require('../../config/logger')(_0x80b7('0x2'));var moment=require(_0x80b7('0x3'));var BPromise=require('bluebird');var rp=require(_0x80b7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x80b7('0x5'));var config=require(_0x80b7('0x6'));var attributes=require(_0x80b7('0x7'));module['exports']=function(_0x49bc7f,_0x167ddd){return _0x49bc7f['define'](_0x80b7('0x8'),attributes,{'tableName':_0x80b7('0x9'),'paranoid':![],'indexes':[{'name':_0x80b7('0xa'),'fields':[_0x80b7('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x74b4a8,_0x25a015,_0x374c52){var _0x5176b2=_0x49bc7f[_0x80b7('0xc')];var _0x522a21=_0x74b4a8[_0x80b7('0xd')]({'plain':!![]});if(_0x522a21[_0x80b7('0xe')][_0x80b7('0xf')]()==='in'||_0x522a21[_0x80b7('0xe')][_0x80b7('0xf')]()===_0x80b7('0x10')&&!_0x522a21[_0x80b7('0x11')]&&!_[_0x80b7('0x12')](_0x522a21[_0x80b7('0x13')])){_0x5176b2[_0x80b7('0x14')][_0x80b7('0x15')]({'where':{'id':_0x522a21['OpenchannelInteractionId']}})[_0x80b7('0x16')](function(_0x401ad3){if(_0x401ad3){_0x401ad3['update']({'lastMsgAt':_0x522a21[_0x80b7('0x17')],'lastMsgDirection':_0x522a21[_0x80b7('0xe')]['toLowerCase']()});}})[_0x80b7('0x18')](function(_0x3b6b13){console[_0x80b7('0x19')](_0x3b6b13);});}if(_0x522a21[_0x80b7('0xe')]===_0x80b7('0x10')&&!_0x522a21[_0x80b7('0x11')]){var _0x1e3d1c;_0x5176b2[_0x80b7('0x1a')][_0x80b7('0x1b')]()[_0x80b7('0x16')](function(_0x4c12b1){return _0x5176b2[_0x80b7('0x1c')][_0x80b7('0x1d')]({'where':{'id':_0x522a21[_0x80b7('0x1e')]},'include':[{'model':_0x5176b2[_0x80b7('0x14')],'as':'Interactions','where':{'id':_0x522a21['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x5176b2[_0x80b7('0x1a')],'as':_0x80b7('0x1f'),'attributes':_[_0x80b7('0x20')](_0x4c12b1)}]}]});})[_0x80b7('0x16')](function(_0x574e5c){_0x1e3d1c=_0x574e5c['get']({'plain':!![]});if(_0x1e3d1c&&_0x1e3d1c[_0x80b7('0x21')]){logger[_0x80b7('0x22')](_0x80b7('0x23'),_0x80b7('0x24'),util['format'](_0x80b7('0x25'),_0x522a21['id'],_0x1e3d1c['replyUri']));if(_0x1e3d1c['Interactions']&&_0x1e3d1c[_0x80b7('0x26')][_0x80b7('0x27')]){_0x522a21[_0x80b7('0x28')]=_[_0x80b7('0x29')](_0x1e3d1c[_0x80b7('0x26')][0x0],_0x80b7('0x1f'));_0x522a21[_0x80b7('0x1f')]=_0x1e3d1c[_0x80b7('0x26')][0x0][_0x80b7('0x1f')];}var _0x25a015={'method':_0x80b7('0x2a'),'uri':encodeURI(_0x1e3d1c[_0x80b7('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x25a015[_0x80b7('0x2b')]){case _0x80b7('0x2c'):_0x25a015['qs']=_0x522a21;break;case _0x80b7('0x2a'):_0x25a015['body']=_0x522a21;break;}return rp(_0x25a015)[_0x80b7('0x16')](function(_0x1661be){logger['info'](_0x80b7('0x23'),_0x80b7('0x24'),util[_0x80b7('0x2d')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x522a21['id'],_0x1e3d1c[_0x80b7('0x21')]));if(_0x1661be[_0x80b7('0xb')][_0x80b7('0x2e')]&&_0x1661be[_0x80b7('0xb')][_0x80b7('0x2e')]!=_0x522a21[_0x80b7('0x28')][_0x80b7('0x2e')]){return _0x5176b2[_0x80b7('0x14')][_0x80b7('0x2f')]({'threadId':_0x1661be[_0x80b7('0xb')][_0x80b7('0x2e')]},{'logging':!![],'where':{'id':_0x522a21[_0x80b7('0x28')]['id']}});}else{return;}})[_0x80b7('0x16')](function(){return _0x74b4a8['update']({'read':!![]});})['catch'](function(_0x36f25e){logger[_0x80b7('0x19')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x80b7('0x30')](_0x36f25e,{'showHidden':![],'depth':null}));_0x374c52();});}else{_0x374c52();}})[_0x80b7('0x31')](function(){_0x374c52();});}else{_0x374c52();}}},'charset':_0x80b7('0x32'),'collate':_0x80b7('0x33')});}; \ No newline at end of file +var _0x9957=['out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','catch','error','CmContact','describe','then','OpenchannelAccount','find','Interactions','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body','models','get','toLowerCase','direction'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'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':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xa2e5f0,_0x3116fb,_0x18c8a3){var _0x35b5fe=_0x137b6b[_0x7995('0xe')];var _0x1e400a=_0xa2e5f0[_0x7995('0xf')]({'plain':!![]});if(_0x1e400a['direction'][_0x7995('0x10')]()==='in'||_0x1e400a[_0x7995('0x11')]['toLowerCase']()===_0x7995('0x12')&&!_0x1e400a[_0x7995('0x13')]&&!_[_0x7995('0x14')](_0x1e400a[_0x7995('0x15')])){_0x35b5fe[_0x7995('0x16')][_0x7995('0x17')]({'where':{'id':_0x1e400a[_0x7995('0x18')]}})['then'](function(_0x58f5ad){if(_0x58f5ad){_0x58f5ad[_0x7995('0x19')]({'lastMsgAt':_0x1e400a[_0x7995('0x1a')],'lastMsgDirection':_0x1e400a[_0x7995('0x11')][_0x7995('0x10')]()});}})[_0x7995('0x1b')](function(_0x1a5310){console[_0x7995('0x1c')](_0x1a5310);});}if(_0x1e400a[_0x7995('0x11')]==='out'&&!_0x1e400a[_0x7995('0x13')]){var _0x565d97;_0x35b5fe[_0x7995('0x1d')][_0x7995('0x1e')]()[_0x7995('0x1f')](function(_0x291317){return _0x35b5fe[_0x7995('0x20')][_0x7995('0x21')]({'where':{'id':_0x1e400a['OpenchannelAccountId']},'include':[{'model':_0x35b5fe['OpenchannelInteraction'],'as':_0x7995('0x22'),'where':{'id':_0x1e400a['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x35b5fe['CmContact'],'as':_0x7995('0x23'),'attributes':_[_0x7995('0x24')](_0x291317)}]}]});})['then'](function(_0x3a9b54){_0x565d97=_0x3a9b54['get']({'plain':!![]});if(_0x565d97&&_0x565d97['replyUri']){logger[_0x7995('0x25')](_0x7995('0x26'),_0x7995('0x27'),util[_0x7995('0x28')](_0x7995('0x29'),_0x1e400a['id'],_0x565d97[_0x7995('0x2a')]));if(_0x565d97['Interactions']&&_0x565d97[_0x7995('0x22')][_0x7995('0x2b')]){_0x1e400a[_0x7995('0x2c')]=_[_0x7995('0x2d')](_0x565d97[_0x7995('0x22')][0x0],_0x7995('0x23'));_0x1e400a[_0x7995('0x23')]=_0x565d97[_0x7995('0x22')][0x0]['Contact'];}var _0x3116fb={'method':_0x7995('0x2e'),'uri':encodeURI(_0x565d97[_0x7995('0x2a')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3116fb[_0x7995('0x2f')]){case _0x7995('0x30'):_0x3116fb['qs']=_0x1e400a;break;case _0x7995('0x2e'):_0x3116fb['body']=_0x1e400a;break;}return rp(_0x3116fb)[_0x7995('0x1f')](function(_0x5911c3){logger[_0x7995('0x25')](_0x7995('0x26'),_0x7995('0x27'),util[_0x7995('0x28')](_0x7995('0x31'),_0x1e400a['id'],_0x565d97['replyUri']));if(_0x5911c3[_0x7995('0xd')]['threadId']&&_0x5911c3[_0x7995('0xd')][_0x7995('0x32')]!=_0x1e400a[_0x7995('0x2c')]['threadId']){return _0x35b5fe['OpenchannelInteraction']['update']({'threadId':_0x5911c3[_0x7995('0xd')][_0x7995('0x32')]},{'logging':!![],'where':{'id':_0x1e400a[_0x7995('0x2c')]['id']}});}else{return;}})[_0x7995('0x1f')](function(){return _0xa2e5f0[_0x7995('0x19')]({'read':!![]});})[_0x7995('0x1b')](function(_0x538841){logger['error'](_0x7995('0x26'),'afterCreate',util[_0x7995('0x33')](_0x538841,{'showHidden':![],'depth':null}));_0x18c8a3();});}else{_0x18c8a3();}})[_0x7995('0x34')](function(){_0x18c8a3();});}else{_0x18c8a3();}}},'charset':_0x7995('0x35'),'collate':_0x7995('0x36')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 4ec60b4..902c17a 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 _0x7292=['create','body','options','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','request','then','info','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','OpenchannelMessage,\x20%s,\x20%s','result','catch','CreateOpenchannelMessage','OpenchannelMessage'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0x7292,0x6d));var _0x2729=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x7292[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x2729('0x0'));var util=require(_0x2729('0x1'));var moment=require(_0x2729('0x2'));var BPromise=require(_0x2729('0x3'));var rs=require(_0x2729('0x4'));var fs=require('fs');var Redis=require(_0x2729('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2729('0x6'));var logger=require(_0x2729('0x7'))(_0x2729('0x8'));var config=require(_0x2729('0x9'));var jayson=require(_0x2729('0xa'));var client=jayson['client'][_0x2729('0xb')]({'port':0x232a});config[_0x2729('0xc')]=_[_0x2729('0xd')](config[_0x2729('0xc')],{'host':_0x2729('0xe'),'port':0x18eb});var socket=require(_0x2729('0xf'))(new Redis(config['redis']));require(_0x2729('0x10'))['register'](socket);function respondWithRpcPromise(_0x22d1c5,_0x595e43,_0x4e46a1){return new BPromise(function(_0x26d5cf,_0x4374cd){return client[_0x2729('0x11')](_0x22d1c5,_0x4e46a1)[_0x2729('0x12')](function(_0x2c3fa3){logger[_0x2729('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x595e43,'request\x20sent');logger[_0x2729('0x14')](_0x2729('0x15'),_0x595e43,_0x2729('0x16'),JSON['stringify'](_0x2c3fa3));if(_0x2c3fa3['error']){if(_0x2c3fa3[_0x2729('0x17')][_0x2729('0x18')]===0x1f4){logger[_0x2729('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0x595e43,_0x2c3fa3[_0x2729('0x17')][_0x2729('0x19')]);return _0x4374cd(_0x2c3fa3[_0x2729('0x17')][_0x2729('0x19')]);}logger[_0x2729('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0x595e43,_0x2c3fa3[_0x2729('0x17')][_0x2729('0x19')]);return _0x26d5cf(_0x2c3fa3[_0x2729('0x17')][_0x2729('0x19')]);}else{logger[_0x2729('0x13')](_0x2729('0x1a'),_0x595e43,_0x2729('0x16'));_0x26d5cf(_0x2c3fa3[_0x2729('0x1b')][_0x2729('0x19')]);}})[_0x2729('0x1c')](function(_0x2fc850){logger[_0x2729('0x17')](_0x2729('0x1a'),_0x595e43,_0x2fc850);_0x4374cd(_0x2fc850);});});}exports[_0x2729('0x1d')]=function(_0x17db0a){var _0x24eea1=this;return new Promise(function(_0x372eeb,_0x1f7769){return db[_0x2729('0x1e')][_0x2729('0x1f')](_0x17db0a[_0x2729('0x20')],{'raw':_0x17db0a[_0x2729('0x21')]?_0x17db0a[_0x2729('0x21')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x348379){logger[_0x2729('0x13')](_0x2729('0x1d'),_0x17db0a);logger[_0x2729('0x14')]('CreateOpenchannelMessage',_0x17db0a,JSON[_0x2729('0x22')](_0x348379));_0x372eeb(_0x348379);})['catch'](function(_0x149789){logger[_0x2729('0x17')](_0x2729('0x1d'),_0x149789['message'],_0x17db0a);_0x1f7769(_0x24eea1[_0x2729('0x17')](0x1f4,_0x149789['message']));});});}; \ No newline at end of file +var _0x6050=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','localhost','socket.io-emitter','redis','./openchannelMessage.socket','register','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','lodash','util'];(function(_0x40c5f4,_0x11e29f){var _0x2ced53=function(_0x332064){while(--_0x332064){_0x40c5f4['push'](_0x40c5f4['shift']());}};_0x2ced53(++_0x11e29f);}(_0x6050,0x196));var _0x0605=function(_0x1649df,_0x1dc847){_0x1649df=_0x1649df-0x0;var _0xbb5237=_0x6050[_0x1649df];return _0xbb5237;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var moment=require(_0x0605('0x2'));var BPromise=require(_0x0605('0x3'));var rs=require(_0x0605('0x4'));var fs=require('fs');var Redis=require(_0x0605('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0605('0x6'));var logger=require(_0x0605('0x7'))(_0x0605('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0605('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x0605('0xa'),'port':0x18eb});var socket=require(_0x0605('0xb'))(new Redis(config[_0x0605('0xc')]));require(_0x0605('0xd'))[_0x0605('0xe')](socket);function respondWithRpcPromise(_0x52bb63,_0x1882e6,_0x23dc2b){return new BPromise(function(_0xe54b22,_0x2c5e23){return client[_0x0605('0xf')](_0x52bb63,_0x23dc2b)[_0x0605('0x10')](function(_0x4385d3){logger[_0x0605('0x11')](_0x0605('0x12'),_0x1882e6,_0x0605('0x13'));logger[_0x0605('0x14')](_0x0605('0x15'),_0x1882e6,_0x0605('0x13'),JSON[_0x0605('0x16')](_0x4385d3));if(_0x4385d3[_0x0605('0x17')]){if(_0x4385d3[_0x0605('0x17')][_0x0605('0x18')]===0x1f4){logger[_0x0605('0x17')](_0x0605('0x12'),_0x1882e6,_0x4385d3['error'][_0x0605('0x19')]);return _0x2c5e23(_0x4385d3[_0x0605('0x17')][_0x0605('0x19')]);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x1882e6,_0x4385d3[_0x0605('0x17')][_0x0605('0x19')]);return _0xe54b22(_0x4385d3[_0x0605('0x17')][_0x0605('0x19')]);}else{logger[_0x0605('0x11')](_0x0605('0x12'),_0x1882e6,_0x0605('0x13'));_0xe54b22(_0x4385d3[_0x0605('0x1a')][_0x0605('0x19')]);}})[_0x0605('0x1b')](function(_0x3a22e9){logger[_0x0605('0x17')](_0x0605('0x12'),_0x1882e6,_0x3a22e9);_0x2c5e23(_0x3a22e9);});});}exports[_0x0605('0x1c')]=function(_0x59bc87){var _0x254020=this;return new Promise(function(_0x14a920,_0x430f28){return db[_0x0605('0x1d')][_0x0605('0x1e')](_0x59bc87[_0x0605('0x1f')],{'raw':_0x59bc87[_0x0605('0x20')]?_0x59bc87[_0x0605('0x20')][_0x0605('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0xc334b8){logger['info'](_0x0605('0x1c'),_0x59bc87);logger[_0x0605('0x14')](_0x0605('0x1c'),_0x59bc87,JSON[_0x0605('0x16')](_0xc334b8));_0x14a920(_0xc334b8);})[_0x0605('0x1b')](function(_0xb4d805){logger[_0x0605('0x17')](_0x0605('0x1c'),_0xb4d805[_0x0605('0x19')],_0x59bc87);_0x430f28(_0x254020[_0x0605('0x17')](0x1f4,_0xb4d805[_0x0605('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 6f4a096..46fb4c2 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 _0xa9e0=['register','length','openchannelMessage:','./openchannelMessage.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var OpenchannelMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){OpenchannelMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);OpenchannelMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','openchannelMessage:','./openchannelMessage.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var OpenchannelMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){OpenchannelMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);OpenchannelMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 9293eae..9d500d1 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 _0xef39=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','destroy','removeAgents','util','path','connect-timeout','express'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0xef39,0x92));var _0x9ef3=function(_0x10469f,_0x584ad0){_0x10469f=_0x10469f-0x0;var _0x35e036=_0xef39[_0x10469f];return _0x35e036;};'use strict';var multer=require('multer');var util=require(_0x9ef3('0x0'));var path=require(_0x9ef3('0x1'));var timeout=require(_0x9ef3('0x2'));var express=require(_0x9ef3('0x3'));var router=express[_0x9ef3('0x4')]();var auth=require(_0x9ef3('0x5'));var interaction=require(_0x9ef3('0x6'));var config=require(_0x9ef3('0x7'));var controller=require(_0x9ef3('0x8'));router[_0x9ef3('0x9')]('/',auth[_0x9ef3('0xa')](),controller[_0x9ef3('0xb')]);router['get'](_0x9ef3('0xc'),auth[_0x9ef3('0xa')](),controller[_0x9ef3('0xd')]);router[_0x9ef3('0x9')](_0x9ef3('0xe'),auth[_0x9ef3('0xa')](),controller[_0x9ef3('0xf')]);router[_0x9ef3('0x9')](_0x9ef3('0x10'),auth[_0x9ef3('0xa')](),controller[_0x9ef3('0x11')]);router[_0x9ef3('0x9')](_0x9ef3('0x12'),auth['isAuthenticated'](),controller[_0x9ef3('0x13')]);router[_0x9ef3('0x9')](_0x9ef3('0x14'),auth[_0x9ef3('0xa')](),controller[_0x9ef3('0x15')]);router[_0x9ef3('0x16')]('/',auth['isAuthenticated'](),controller[_0x9ef3('0x17')]);router[_0x9ef3('0x16')](_0x9ef3('0x12'),auth['isAuthenticated'](),controller[_0x9ef3('0x18')]);router[_0x9ef3('0x16')]('/:id/users',auth[_0x9ef3('0xa')](),controller[_0x9ef3('0x19')]);router[_0x9ef3('0x1a')](_0x9ef3('0xe'),auth[_0x9ef3('0xa')](),controller[_0x9ef3('0x1b')]);router['delete'](_0x9ef3('0xe'),auth[_0x9ef3('0xa')](),controller[_0x9ef3('0x1c')]);router['delete'](_0x9ef3('0x12'),auth[_0x9ef3('0xa')](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x9ef3('0xa')](),controller[_0x9ef3('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x41ec=['show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','update','removeTeams','delete','removeAgents','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x41ec,0x143));var _0xc41e=function(_0x41f28e,_0x129f76){_0x41f28e=_0x41f28e-0x0;var _0x5a641b=_0x41ec[_0x41f28e];return _0x5a641b;};'use strict';var multer=require('multer');var util=require(_0xc41e('0x0'));var path=require('path');var timeout=require(_0xc41e('0x1'));var express=require(_0xc41e('0x2'));var router=express['Router']();var auth=require(_0xc41e('0x3'));var interaction=require(_0xc41e('0x4'));var config=require(_0xc41e('0x5'));var controller=require(_0xc41e('0x6'));router[_0xc41e('0x7')]('/',auth[_0xc41e('0x8')](),controller[_0xc41e('0x9')]);router[_0xc41e('0x7')](_0xc41e('0xa'),auth[_0xc41e('0x8')](),controller[_0xc41e('0xb')]);router['get'](_0xc41e('0xc'),auth[_0xc41e('0x8')](),controller[_0xc41e('0xd')]);router[_0xc41e('0x7')](_0xc41e('0xe'),auth[_0xc41e('0x8')](),controller[_0xc41e('0xf')]);router[_0xc41e('0x7')](_0xc41e('0x10'),auth[_0xc41e('0x8')](),controller[_0xc41e('0x11')]);router['get'](_0xc41e('0x12'),auth[_0xc41e('0x8')](),controller[_0xc41e('0x13')]);router[_0xc41e('0x14')]('/',auth[_0xc41e('0x8')](),controller[_0xc41e('0x15')]);router[_0xc41e('0x14')](_0xc41e('0x10'),auth['isAuthenticated'](),controller[_0xc41e('0x16')]);router[_0xc41e('0x14')](_0xc41e('0x12'),auth[_0xc41e('0x8')](),controller['addAgents']);router['put'](_0xc41e('0xc'),auth[_0xc41e('0x8')](),controller[_0xc41e('0x17')]);router['delete'](_0xc41e('0xc'),auth[_0xc41e('0x8')](),controller['destroy']);router['delete'](_0xc41e('0x10'),auth['isAuthenticated'](),controller[_0xc41e('0x18')]);router[_0xc41e('0x19')]('/:id/users',auth[_0xc41e('0x8')](),controller[_0xc41e('0x1a')]);module[_0xc41e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index a4235d2..cfddc45 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 _0xf5dd=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xf5dd,0x1ad));var _0xdf5d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xf5dd[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0xdf5d('0x0'));module[_0xdf5d('0x1')]={'name':{'type':Sequelize[_0xdf5d('0x2')],'unique':_0xdf5d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdf5d('0x2')]},'timeout':{'type':Sequelize[_0xdf5d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdf5d('0x5')](_0xdf5d('0x6'),_0xdf5d('0x7'),_0xdf5d('0x8'))}}; \ No newline at end of file +var _0xe452=['sequelize','STRING','ENUM','beepall','roundrobin'];(function(_0x589dac,_0x1efd20){var _0x26775f=function(_0x233d50){while(--_0x233d50){_0x589dac['push'](_0x589dac['shift']());}};_0x26775f(++_0x1efd20);}(_0xe452,0x159));var _0x2e45=function(_0x528050,_0x47894f){_0x528050=_0x528050-0x0;var _0x170eeb=_0xe452[_0x528050];return _0x170eeb;};'use strict';var Sequelize=require(_0x2e45('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2e45('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2e45('0x2')]('rrmemory',_0x2e45('0x3'),_0x2e45('0x4'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 8c5e6fd..df1ab11 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 _0x2b22=['find','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','OpenchannelQueues','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserOpenchannelQueue','length','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','addTeams','ids','Team','online','voicePause','interface','sequelize','each','findOrCreate','forEach','emit','removeTeams','field','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','Agents','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','all','union','compact','value','transaction','isEmpty','addAgents','omit','userOpenchannelQueue:save','removeAgents','isArray','userOpenchannelQueue:remove','getAgents','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','merge'];(function(_0x25e5ef,_0x2a1960){var _0xbbb239=function(_0x134f23){while(--_0x134f23){_0x25e5ef['push'](_0x25e5ef['shift']());}};_0xbbb239(++_0x2a1960);}(_0x2b22,0x15e));var _0x22b2=function(_0x27522d,_0x266e5c){_0x27522d=_0x27522d-0x0;var _0x20a9af=_0x2b22[_0x27522d];return _0x20a9af;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x22b2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x22b2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x22b2('0x2'));var BPromise=require(_0x22b2('0x3'));var Mustache=require('mustache');var util=require(_0x22b2('0x4'));var path=require(_0x22b2('0x5'));var sox=require(_0x22b2('0x6'));var csv=require(_0x22b2('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x22b2('0x8'));var squel=require(_0x22b2('0x9'));var crypto=require(_0x22b2('0xa'));var jsforce=require(_0x22b2('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x22b2('0x7'));var querystring=require(_0x22b2('0xc'));var Papa=require(_0x22b2('0xd'));var Redis=require('ioredis');var authService=require(_0x22b2('0xe'));var qs=require(_0x22b2('0xf'));var as=require(_0x22b2('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x22b2('0x11'))(_0x22b2('0x12'));var utils=require(_0x22b2('0x13'));var config=require(_0x22b2('0x14'));var db=require(_0x22b2('0x15'))['db'];config['redis']=_[_0x22b2('0x16')](config['redis'],{'host':_0x22b2('0x17'),'port':0x18eb});var socket=require(_0x22b2('0x18'))(new Redis(config[_0x22b2('0x19')]));require(_0x22b2('0x1a'))[_0x22b2('0x1b')](socket);function respondWithStatusCode(_0x177dcd,_0x168a7c){_0x168a7c=_0x168a7c||0xcc;return function(_0x5524e9){if(_0x5524e9){return _0x177dcd[_0x22b2('0x1c')](_0x168a7c);}return _0x177dcd[_0x22b2('0x1d')](_0x168a7c)[_0x22b2('0x1e')]();};}function respondWithResult(_0x126a87,_0x21f777){_0x21f777=_0x21f777||0xc8;return function(_0x2c353c){if(_0x2c353c){return _0x126a87[_0x22b2('0x1d')](_0x21f777)[_0x22b2('0x1f')](_0x2c353c);}};}function respondWithFilteredResult(_0x1fc80c,_0x365fc4){return function(_0x47d14e){if(_0x47d14e){var _0x576ab9=_0x47d14e[_0x22b2('0x20')],_0x40f7f3=_0x365fc4[_0x22b2('0x21')],_0x4bec80=_0x365fc4[_0x22b2('0x21')]+_0x365fc4[_0x22b2('0x22')],_0x35882d;if(_0x4bec80>=_0x576ab9){_0x4bec80=_0x576ab9;_0x35882d=0xc8;}else{_0x35882d=0xce;}_0x1fc80c[_0x22b2('0x1d')](_0x35882d);return _0x1fc80c[_0x22b2('0x23')](_0x22b2('0x24'),_0x40f7f3+'-'+_0x4bec80+'/'+_0x576ab9)[_0x22b2('0x1f')](_0x47d14e);}return null;};}function patchUpdates(_0xa5ec20){return function(_0x154389){try{jsonpatch[_0x22b2('0x25')](_0x154389,_0xa5ec20,!![]);}catch(_0x4a3bb1){return BPromise[_0x22b2('0x26')](_0x4a3bb1);}return _0x154389[_0x22b2('0x27')]();};}function saveUpdates(_0x5df453,_0x40e76a){return function(_0x2623a1){if(_0x2623a1){return _0x2623a1[_0x22b2('0x28')](_0x5df453)[_0x22b2('0x29')](function(_0xc1e31c){return _0xc1e31c;});}return null;};}function removeEntity(_0x1d8e2b,_0x18bc93){return function(_0x29bb5c){if(_0x29bb5c){return _0x29bb5c[_0x22b2('0x2a')]()[_0x22b2('0x29')](function(){var _0x2e77b4=_0x29bb5c[_0x22b2('0x2b')]({'plain':!![]});var _0x504ec3='OpenchannelQueues';return db[_0x22b2('0x2c')][_0x22b2('0x2a')]({'where':{'type':_0x504ec3,'resourceId':_0x2e77b4['id']}})[_0x22b2('0x29')](function(){return _0x29bb5c;});})[_0x22b2('0x29')](function(){_0x1d8e2b[_0x22b2('0x1d')](0xcc)[_0x22b2('0x1e')]();});}};}function handleEntityNotFound(_0x32c9bb,_0x497c32){return function(_0xb9dfa5){if(!_0xb9dfa5){_0x32c9bb['sendStatus'](0x194);}return _0xb9dfa5;};}function handleError(_0x2b508d,_0x4a841b){_0x4a841b=_0x4a841b||0x1f4;return function(_0x3ffdca){logger['error'](_0x3ffdca['stack']);if(_0x3ffdca['name']){delete _0x3ffdca['name'];}_0x2b508d[_0x22b2('0x1d')](_0x4a841b)[_0x22b2('0x2d')](_0x3ffdca);};}exports[_0x22b2('0x2e')]=function(_0x297625,_0x3cfb73){var _0x6da0af={},_0x5c0871={},_0x11c7ca={'count':0x0,'rows':[]};var _0x1e8cc5=_[_0x22b2('0x2f')](db[_0x22b2('0x30')][_0x22b2('0x31')],function(_0x51d562){return{'name':_0x51d562[_0x22b2('0x32')],'type':_0x51d562[_0x22b2('0x33')]['key']};});_0x5c0871[_0x22b2('0x34')]=_[_0x22b2('0x2f')](_0x1e8cc5,_0x22b2('0x35'));_0x5c0871[_0x22b2('0x36')]=_['keys'](_0x297625[_0x22b2('0x36')]);_0x5c0871[_0x22b2('0x37')]=_[_0x22b2('0x38')](_0x5c0871[_0x22b2('0x34')],_0x5c0871['query']);_0x6da0af[_0x22b2('0x39')]=_[_0x22b2('0x38')](_0x5c0871[_0x22b2('0x34')],qs[_0x22b2('0x3a')](_0x297625[_0x22b2('0x36')][_0x22b2('0x3a')]));_0x6da0af[_0x22b2('0x39')]=_0x6da0af[_0x22b2('0x39')]['length']?_0x6da0af[_0x22b2('0x39')]:_0x5c0871[_0x22b2('0x34')];if(!_0x297625[_0x22b2('0x36')][_0x22b2('0x3b')](_0x22b2('0x3c'))){_0x6da0af[_0x22b2('0x22')]=qs[_0x22b2('0x22')](_0x297625[_0x22b2('0x36')]['limit']);_0x6da0af[_0x22b2('0x21')]=qs[_0x22b2('0x21')](_0x297625[_0x22b2('0x36')][_0x22b2('0x21')]);}_0x6da0af[_0x22b2('0x3d')]=qs[_0x22b2('0x3e')](_0x297625[_0x22b2('0x36')][_0x22b2('0x3e')]);_0x6da0af[_0x22b2('0x3f')]=qs[_0x22b2('0x37')](_[_0x22b2('0x40')](_0x297625[_0x22b2('0x36')],_0x5c0871[_0x22b2('0x37')]),_0x1e8cc5);if(_0x297625[_0x22b2('0x36')][_0x22b2('0x41')]){_0x6da0af['where']=_['merge'](_0x6da0af['where'],{'$or':_['map'](_0x1e8cc5,function(_0x1cacea){if(_0x1cacea['type']!==_0x22b2('0x42')){var _0x2c8760={};_0x2c8760[_0x1cacea['name']]={'$like':'%'+_0x297625['query'][_0x22b2('0x41')]+'%'};return _0x2c8760;}})});}_0x6da0af=_['merge']({},_0x6da0af,_0x297625[_0x22b2('0x43')]);var _0x19c584={'where':_0x6da0af[_0x22b2('0x3f')]};return db[_0x22b2('0x30')][_0x22b2('0x20')](_0x19c584)[_0x22b2('0x29')](function(_0x3b8567){_0x11c7ca[_0x22b2('0x20')]=_0x3b8567;if(_0x297625[_0x22b2('0x36')][_0x22b2('0x44')]){_0x6da0af[_0x22b2('0x45')]=[{'all':!![]}];}return db[_0x22b2('0x30')][_0x22b2('0x46')](_0x6da0af);})['then'](function(_0x248d6f){_0x11c7ca['rows']=_0x248d6f;return _0x11c7ca;})['then'](respondWithFilteredResult(_0x3cfb73,_0x6da0af))[_0x22b2('0x47')](handleError(_0x3cfb73,null));};exports[_0x22b2('0x48')]=function(_0x57e906,_0x2b4757){var _0x74caeb={'raw':!![],'where':{'id':_0x57e906[_0x22b2('0x49')]['id']}},_0x210d1b={};_0x210d1b[_0x22b2('0x34')]=_[_0x22b2('0x4a')](db['OpenchannelQueue'][_0x22b2('0x31')]);_0x210d1b['query']=_[_0x22b2('0x4a')](_0x57e906[_0x22b2('0x36')]);_0x210d1b[_0x22b2('0x37')]=_['intersection'](_0x210d1b[_0x22b2('0x34')],_0x210d1b[_0x22b2('0x36')]);_0x74caeb['attributes']=_[_0x22b2('0x38')](_0x210d1b[_0x22b2('0x34')],qs[_0x22b2('0x3a')](_0x57e906[_0x22b2('0x36')][_0x22b2('0x3a')]));_0x74caeb[_0x22b2('0x39')]=_0x74caeb[_0x22b2('0x39')]['length']?_0x74caeb[_0x22b2('0x39')]:_0x210d1b[_0x22b2('0x34')];if(_0x57e906[_0x22b2('0x36')][_0x22b2('0x44')]){_0x74caeb[_0x22b2('0x45')]=[{'all':!![]}];}_0x74caeb=_[_0x22b2('0x4b')]({},_0x74caeb,_0x57e906[_0x22b2('0x43')]);return db['OpenchannelQueue'][_0x22b2('0x4c')](_0x74caeb)[_0x22b2('0x29')](handleEntityNotFound(_0x2b4757,null))[_0x22b2('0x29')](respondWithResult(_0x2b4757,null))[_0x22b2('0x47')](handleError(_0x2b4757,null));};exports['create']=function(_0x2e24e7,_0x1fa49f){return db['OpenchannelQueue']['create'](_0x2e24e7['body'],{})[_0x22b2('0x29')](function(_0x39cf59){var _0x803df5=_0x2e24e7['user']['get']({'plain':!![]});if(!_0x803df5)throw new Error(_0x22b2('0x4d'));if(_0x803df5[_0x22b2('0x4e')]===_0x22b2('0x4f')){var _0xfbe4c7=_0x39cf59['get']({'plain':!![]});var _0x872094=_0x22b2('0x50');return db[_0x22b2('0x51')][_0x22b2('0x4c')]({'where':{'name':_0x872094,'userProfileId':_0x803df5[_0x22b2('0x52')]},'raw':!![]})['then'](function(_0x299418){if(_0x299418&&_0x299418[_0x22b2('0x53')]===0x0){return db[_0x22b2('0x2c')]['create']({'name':_0xfbe4c7[_0x22b2('0x35')],'resourceId':_0xfbe4c7['id'],'type':_0x299418[_0x22b2('0x35')],'sectionId':_0x299418['id']},{})[_0x22b2('0x29')](function(){return _0x39cf59;});}else{return _0x39cf59;}})[_0x22b2('0x47')](function(_0x20df1f){logger[_0x22b2('0x54')](_0x22b2('0x55'),_0x20df1f);throw _0x20df1f;});}return _0x39cf59;})[_0x22b2('0x29')](respondWithResult(_0x1fa49f,0xc9))[_0x22b2('0x47')](handleError(_0x1fa49f,null));};exports[_0x22b2('0x28')]=function(_0x360e4e,_0x14fbd5){if(_0x360e4e[_0x22b2('0x56')]['id']){delete _0x360e4e[_0x22b2('0x56')]['id'];}return db[_0x22b2('0x30')][_0x22b2('0x4c')]({'where':{'id':_0x360e4e[_0x22b2('0x49')]['id']}})[_0x22b2('0x29')](handleEntityNotFound(_0x14fbd5,null))[_0x22b2('0x29')](saveUpdates(_0x360e4e[_0x22b2('0x56')],null))[_0x22b2('0x29')](respondWithResult(_0x14fbd5,null))['catch'](handleError(_0x14fbd5,null));};exports['destroy']=function(_0x13ebc4,_0x2aa0f3){return db[_0x22b2('0x30')][_0x22b2('0x4c')]({'where':{'id':_0x13ebc4['params']['id']}})[_0x22b2('0x29')](handleEntityNotFound(_0x2aa0f3,null))['then'](removeEntity(_0x2aa0f3,null))['catch'](handleError(_0x2aa0f3,null));};exports[_0x22b2('0x57')]=function(_0x2189db,_0x45fcc0){return db['OpenchannelQueue'][_0x22b2('0x57')]()[_0x22b2('0x29')](respondWithResult(_0x45fcc0,null))[_0x22b2('0x47')](handleError(_0x45fcc0,null));};exports[_0x22b2('0x58')]=function(_0x4debf6,_0x25a00c,_0x4790b4){var _0x53a7a9={'raw':!![],'where':{}},_0x14e393={},_0x4e4928;return db[_0x22b2('0x30')][_0x22b2('0x59')]({'where':{'id':_0x4debf6[_0x22b2('0x49')]['id']}})[_0x22b2('0x29')](handleEntityNotFound(_0x25a00c,null))['then'](function(_0x1e6bba){if(_0x1e6bba){_0x4e4928=_0x1e6bba['get']({'plain':!![]});_0x14e393[_0x22b2('0x34')]=_['keys'](db[_0x22b2('0x5a')][_0x22b2('0x31')]);_0x14e393[_0x22b2('0x36')]=_[_0x22b2('0x4a')](_0x4debf6[_0x22b2('0x36')]);_0x14e393[_0x22b2('0x37')]=_[_0x22b2('0x38')](_0x14e393[_0x22b2('0x34')],_0x14e393[_0x22b2('0x36')]);_0x53a7a9[_0x22b2('0x39')]=_[_0x22b2('0x38')](_0x14e393['model'],qs[_0x22b2('0x3a')](_0x4debf6[_0x22b2('0x36')][_0x22b2('0x3a')]));_0x53a7a9['attributes']=_0x53a7a9[_0x22b2('0x39')][_0x22b2('0x5b')]?_0x53a7a9['attributes']:_0x14e393[_0x22b2('0x34')];if(!_0x4debf6[_0x22b2('0x36')][_0x22b2('0x3b')](_0x22b2('0x3c'))){_0x53a7a9[_0x22b2('0x22')]=qs['limit'](_0x4debf6[_0x22b2('0x36')][_0x22b2('0x22')]);_0x53a7a9['offset']=qs[_0x22b2('0x21')](_0x4debf6[_0x22b2('0x36')][_0x22b2('0x21')]);}_0x53a7a9[_0x22b2('0x3d')]=qs[_0x22b2('0x3e')](_0x4debf6['query'][_0x22b2('0x3e')]);_0x53a7a9[_0x22b2('0x3f')]=qs[_0x22b2('0x37')](_['pick'](_0x4debf6[_0x22b2('0x36')],_0x14e393[_0x22b2('0x37')]));_0x53a7a9['where'][_0x22b2('0x5c')]=_0x1e6bba['id'];if(_0x4debf6[_0x22b2('0x36')][_0x22b2('0x41')]){_0x53a7a9[_0x22b2('0x3f')]=_[_0x22b2('0x4b')](_0x53a7a9[_0x22b2('0x3f')],{'$or':_[_0x22b2('0x2f')](_0x53a7a9['attributes'],function(_0x4038b2){var _0x2c820d={};_0x2c820d[_0x4038b2]={'$like':'%'+_0x4debf6['query'][_0x22b2('0x41')]+'%'};return _0x2c820d;})});}_0x53a7a9=_['merge']({},_0x53a7a9,_0x4debf6[_0x22b2('0x43')]);return db[_0x22b2('0x5a')][_0x22b2('0x46')](_0x53a7a9);}})[_0x22b2('0x29')](function(_0x3c0d48){if(_0x3c0d48){return db[_0x22b2('0x5d')][_0x22b2('0x5e')]({'where':{'id':_[_0x22b2('0x2f')](_0x3c0d48,_0x22b2('0x5f')),'role':_0x22b2('0x60')},'attributes':['id',_0x22b2('0x35'),_0x22b2('0x61'),_0x22b2('0x62'),'createdAt']});}})['then'](function(_0x10cf03){if(_0x10cf03){return{'count':_0x10cf03['count'],'rows':_[_0x22b2('0x2f')](_0x10cf03[_0x22b2('0x63')],function(_0x1685b2){return{'membername':_0x1685b2[_0x22b2('0x35')],'UserId':_0x1685b2['id'],'queue_name':_0x4e4928['name'],'OpenchannelQueueId':_0x4e4928['id'],'interface':util[_0x22b2('0x64')](_0x22b2('0x65'),_0x22b2('0x66'),_0x1685b2[_0x22b2('0x35')]),'penalty':0x0,'paused':_0x1685b2[_0x22b2('0x61')],'createdAt':_0x1685b2[_0x22b2('0x67')],'updatedAt':_0x1685b2['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x22b2('0x29')](respondWithFilteredResult(_0x25a00c,_0x53a7a9))['catch'](handleError(_0x25a00c,null));};exports[_0x22b2('0x68')]=function(_0x80baa3,_0x282060,_0x25af4c){var _0x5661d2={};var _0x5963a4={};var _0x42d78a;var _0xa4b2cf;return db[_0x22b2('0x30')]['findOne']({'where':{'id':_0x80baa3[_0x22b2('0x49')]['id']}})['then'](handleEntityNotFound(_0x282060,null))[_0x22b2('0x29')](function(_0x2096ea){if(_0x2096ea){_0x42d78a=_0x2096ea;_0x5963a4[_0x22b2('0x34')]=_['keys'](db['Team'][_0x22b2('0x31')]);_0x5963a4['query']=_[_0x22b2('0x4a')](_0x80baa3[_0x22b2('0x36')]);_0x5963a4[_0x22b2('0x37')]=_[_0x22b2('0x38')](_0x5963a4[_0x22b2('0x34')],_0x5963a4['query']);_0x5661d2[_0x22b2('0x39')]=_[_0x22b2('0x38')](_0x5963a4[_0x22b2('0x34')],qs['fields'](_0x80baa3[_0x22b2('0x36')][_0x22b2('0x3a')]));_0x5661d2[_0x22b2('0x39')]=_0x5661d2[_0x22b2('0x39')][_0x22b2('0x5b')]?_0x5661d2['attributes']:_0x5963a4[_0x22b2('0x34')];_0x5661d2[_0x22b2('0x3d')]=qs[_0x22b2('0x3e')](_0x80baa3[_0x22b2('0x36')][_0x22b2('0x3e')]);_0x5661d2[_0x22b2('0x3f')]=qs[_0x22b2('0x37')](_[_0x22b2('0x40')](_0x80baa3[_0x22b2('0x36')],_0x5963a4[_0x22b2('0x37')]));if(_0x80baa3[_0x22b2('0x36')]['filter']){_0x5661d2[_0x22b2('0x3f')]=_[_0x22b2('0x4b')](_0x5661d2['where'],{'$or':_[_0x22b2('0x2f')](_0x5661d2[_0x22b2('0x39')],function(_0x112372){var _0x5513ac={};_0x5513ac[_0x112372]={'$like':'%'+_0x80baa3[_0x22b2('0x36')][_0x22b2('0x41')]+'%'};return _0x5513ac;})});}_0x5661d2=_['merge']({},_0x5661d2,_0x80baa3['options']);return _0x42d78a['getTeams'](_0x5661d2);}})[_0x22b2('0x29')](function(_0x59e7d2){if(_0x59e7d2){_0xa4b2cf=_0x59e7d2[_0x22b2('0x5b')];if(!_0x80baa3[_0x22b2('0x36')][_0x22b2('0x3b')](_0x22b2('0x3c'))){_0x5661d2[_0x22b2('0x22')]=qs[_0x22b2('0x22')](_0x80baa3[_0x22b2('0x36')]['limit']);_0x5661d2['offset']=qs[_0x22b2('0x21')](_0x80baa3[_0x22b2('0x36')][_0x22b2('0x21')]);}return _0x42d78a[_0x22b2('0x68')](_0x5661d2);}})[_0x22b2('0x29')](function(_0x44503f){if(_0x44503f){return _0x44503f?{'count':_0xa4b2cf,'rows':_0x44503f}:null;}})[_0x22b2('0x29')](respondWithResult(_0x282060,null))[_0x22b2('0x47')](handleError(_0x282060,null));};exports[_0x22b2('0x69')]=function(_0x2d24ad,_0x295c08,_0x4430c2){var _0x201b0c=_0x2d24ad[_0x22b2('0x56')][_0x22b2('0x6a')];return db[_0x22b2('0x6b')][_0x22b2('0x46')]({'where':{'id':_0x201b0c},'attributes':['id'],'include':[{'model':db[_0x22b2('0x5d')],'as':'Agents','attributes':['id',_0x22b2('0x35'),_0x22b2('0x6c'),_0x22b2('0x6d'),_0x22b2('0x6e')],'raw':!![]}]})[_0x22b2('0x29')](function(_0x1f308a){if(_0x1f308a){var _0x52e95a=_['flatMap'](_0x1f308a,function(_0x39f5c8){var _0x5039df=_0x39f5c8[_0x22b2('0x2b')]({'plain':!![]});return _0x5039df['Agents'];});return db[_0x22b2('0x30')][_0x22b2('0x4c')]({'where':{'id':_0x2d24ad['params']['id']}})[_0x22b2('0x29')](function(_0x35a777){return db[_0x22b2('0x6f')]['transaction'](function(_0x5c2528){return _0x35a777[_0x22b2('0x69')](_0x201b0c,{'transaction':_0x5c2528})[_0x22b2('0x29')](function(){return BPromise[_0x22b2('0x70')](_0x52e95a,function(_0x5481d1){return db[_0x22b2('0x5a')][_0x22b2('0x71')]({'where':{'UserId':_0x5481d1['id'],'OpenchannelQueueId':_0x2d24ad[_0x22b2('0x49')]['id']},'transaction':_0x5c2528});});})[_0x22b2('0x29')](function(){_0x52e95a[_0x22b2('0x72')](function(_0x402c54){socket[_0x22b2('0x73')]('userOpenchannelQueue:save',{'UserId':_0x402c54['id'],'OpenchannelQueueId':_0x35a777['id']});});});});});}})[_0x22b2('0x29')](respondWithStatusCode(_0x295c08,null))['catch'](handleError(_0x295c08,null));};exports[_0x22b2('0x74')]=function(_0x4c098b,_0x261c9b,_0x22f24e){return db[_0x22b2('0x6b')]['findAll']({'where':{'id':_0x4c098b[_0x22b2('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x22b2('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x22b2('0x29')](handleEntityNotFound(_0x261c9b,null))[_0x22b2('0x29')](function(_0x5e3d90){var _0x4135a8=_[_0x22b2('0x2f')](_0x5e3d90,'id');var _0x4741f7=[];var _0x493be8=[];var _0xa735e1=squel['select']();_0xa735e1[_0x22b2('0x75')]('tq.TeamId')['from']('team_has_openchannel_queues','tq')[_0x22b2('0x76')](_0x22b2('0x77'),'ut',_0x22b2('0x78'))[_0x22b2('0x3f')](_0x22b2('0x79'),_0x4c098b[_0x22b2('0x49')]['id']);for(var _0x55a891=0x0;_0x55a891<_0x5e3d90[_0x22b2('0x5b')];_0x55a891+=0x1){let _0x4effd4=_0x5e3d90[_0x55a891];for(var _0x4ead2b=0x0;_0x4ead2b<_0x4effd4[_0x22b2('0x7a')][_0x22b2('0x5b')];_0x4ead2b+=0x1){let _0x24017f=_0x4effd4[_0x22b2('0x7a')][_0x4ead2b];var _0x372669=_0xa735e1[_0x22b2('0x7b')]();_0x372669['where'](_0x22b2('0x7c'),_0x24017f['id']);_0x493be8[_0x22b2('0x7d')](db[_0x22b2('0x6f')][_0x22b2('0x36')](_0x372669['toString'](),{'type':db[_0x22b2('0x6f')][_0x22b2('0x7e')][_0x22b2('0x7f')]})['then'](function(_0x23f0ed){if(_0x23f0ed[_0x22b2('0x5b')]===0x1){return _0x24017f['id'];}else{var _0x4ec637=_[_0x22b2('0x80')](_[_0x22b2('0x2f')](_0x23f0ed,'TeamId'),function(_0x4caab4){return _['includes'](_0x4135a8,_0x4caab4);});if(_0x4ec637){return _0x24017f['id'];}}}));}}return BPromise[_0x22b2('0x81')](_0x493be8)['then'](function(_0x40e2d7){_0x4741f7=_(_0x4741f7)[_0x22b2('0x82')](_0x40e2d7)[_0x22b2('0x83')]()[_0x22b2('0x84')]();return db[_0x22b2('0x30')]['find']({'where':{'id':_0x4c098b[_0x22b2('0x49')]['id']}})[_0x22b2('0x29')](function(_0x519527){return db['sequelize'][_0x22b2('0x85')](function(_0xa84e12){return _0x519527[_0x22b2('0x74')](_0x4c098b[_0x22b2('0x36')][_0x22b2('0x6a')],{'transaction':_0xa84e12})['then'](function(){if(!_[_0x22b2('0x86')](_0x4741f7)){return _0x519527['removeAgents'](_0x4741f7,{'transaction':_0xa84e12});}})[_0x22b2('0x29')](function(){_0x4741f7['forEach'](function(_0x36bb87){socket[_0x22b2('0x73')]('userOpenchannelQueue:remove',{'UserId':_0x36bb87,'OpenchannelQueueId':_0x519527['id']});});});});});});})[_0x22b2('0x29')](respondWithStatusCode(_0x261c9b,null))[_0x22b2('0x47')](handleError(_0x261c9b,null));};exports[_0x22b2('0x87')]=function(_0xfbdb43,_0x2f7093,_0x5b5682){return db[_0x22b2('0x30')][_0x22b2('0x4c')]({'where':{'id':_0xfbdb43[_0x22b2('0x49')]['id']}})[_0x22b2('0x29')](handleEntityNotFound(_0x2f7093,null))['then'](function(_0x4986d1){if(_0x4986d1){return _0x4986d1[_0x22b2('0x87')](_0xfbdb43[_0x22b2('0x56')]['ids'],_[_0x22b2('0x88')](_0xfbdb43['body'],[_0x22b2('0x6a'),'id'])||{})['spread'](function(_0x1b6bee){for(var _0x74170=0x0;_0x74170<_0xfbdb43[_0x22b2('0x56')][_0x22b2('0x6a')]['length'];_0x74170+=0x1){socket['emit'](_0x22b2('0x89'),{'UserId':_0xfbdb43[_0x22b2('0x56')]['ids'][_0x74170],'OpenchannelQueueId':_0xfbdb43[_0x22b2('0x49')]['id']});}return _0x1b6bee;});}})[_0x22b2('0x29')](respondWithResult(_0x2f7093,null))[_0x22b2('0x47')](handleError(_0x2f7093,null));};exports[_0x22b2('0x8a')]=function(_0x27a95e,_0x340c00,_0x3d4a2d){return db[_0x22b2('0x30')][_0x22b2('0x4c')]({'where':{'id':_0x27a95e['params']['id']}})[_0x22b2('0x29')](handleEntityNotFound(_0x340c00,null))['then'](function(_0x4cec94){if(_0x4cec94){return _0x4cec94[_0x22b2('0x8a')](_0x27a95e['query'][_0x22b2('0x6a')])['then'](function(){if(_[_0x22b2('0x8b')](_0x27a95e['query'][_0x22b2('0x6a')])){for(var _0x5ba2e1=0x0;_0x5ba2e1<_0x27a95e[_0x22b2('0x36')][_0x22b2('0x6a')]['length'];_0x5ba2e1+=0x1){socket['emit'](_0x22b2('0x8c'),{'UserId':Number(_0x27a95e['query'][_0x22b2('0x6a')][_0x5ba2e1]),'OpenchannelQueueId':Number(_0x27a95e[_0x22b2('0x49')]['id'])});}}else{socket[_0x22b2('0x73')](_0x22b2('0x8c'),{'UserId':Number(_0x27a95e[_0x22b2('0x36')][_0x22b2('0x6a')]),'OpenchannelQueueId':Number(_0x27a95e[_0x22b2('0x49')]['id'])});}});}})[_0x22b2('0x29')](respondWithStatusCode(_0x340c00,null))[_0x22b2('0x47')](handleError(_0x340c00,null));};exports[_0x22b2('0x8d')]=function(_0x12bd94,_0x10be62,_0x31777c){var _0x3003de={};var _0x1c7fa8={};var _0x4f941a;var _0x3b57a9;return db[_0x22b2('0x30')][_0x22b2('0x59')]({'where':{'id':_0x12bd94['params']['id']}})['then'](handleEntityNotFound(_0x10be62,null))[_0x22b2('0x29')](function(_0xf88d8b){if(_0xf88d8b){_0x4f941a=_0xf88d8b;_0x1c7fa8[_0x22b2('0x34')]=_[_0x22b2('0x4a')](db[_0x22b2('0x5d')][_0x22b2('0x31')]);_0x1c7fa8[_0x22b2('0x36')]=_['keys'](_0x12bd94[_0x22b2('0x36')]);_0x1c7fa8[_0x22b2('0x37')]=_[_0x22b2('0x38')](_0x1c7fa8['model'],_0x1c7fa8[_0x22b2('0x36')]);_0x3003de[_0x22b2('0x39')]=_[_0x22b2('0x38')](_0x1c7fa8[_0x22b2('0x34')],qs[_0x22b2('0x3a')](_0x12bd94['query'][_0x22b2('0x3a')]));_0x3003de[_0x22b2('0x39')]=_0x3003de[_0x22b2('0x39')][_0x22b2('0x5b')]?_0x3003de[_0x22b2('0x39')]:_0x1c7fa8[_0x22b2('0x34')];_0x3003de[_0x22b2('0x3d')]=qs[_0x22b2('0x3e')](_0x12bd94[_0x22b2('0x36')][_0x22b2('0x3e')]);_0x3003de[_0x22b2('0x3f')]=qs['filters'](_[_0x22b2('0x40')](_0x12bd94[_0x22b2('0x36')],_0x1c7fa8[_0x22b2('0x37')]));if(_0x12bd94[_0x22b2('0x36')][_0x22b2('0x41')]){_0x3003de[_0x22b2('0x3f')]=_['merge'](_0x3003de[_0x22b2('0x3f')],{'$or':_[_0x22b2('0x2f')](_0x3003de['attributes'],function(_0x1b177c){var _0x56137a={};_0x56137a[_0x1b177c]={'$like':'%'+_0x12bd94[_0x22b2('0x36')]['filter']+'%'};return _0x56137a;})});}_0x3003de=_[_0x22b2('0x4b')]({},_0x3003de,_0x12bd94[_0x22b2('0x43')]);return _0x4f941a[_0x22b2('0x8d')](_0x3003de);}})[_0x22b2('0x29')](function(_0x5a495b){if(_0x5a495b){_0x3b57a9=_0x5a495b[_0x22b2('0x5b')];if(!_0x12bd94['query'][_0x22b2('0x3b')](_0x22b2('0x3c'))){_0x3003de[_0x22b2('0x22')]=qs[_0x22b2('0x22')](_0x12bd94[_0x22b2('0x36')][_0x22b2('0x22')]);_0x3003de[_0x22b2('0x21')]=qs[_0x22b2('0x21')](_0x12bd94[_0x22b2('0x36')][_0x22b2('0x21')]);}return _0x4f941a[_0x22b2('0x8d')](_0x3003de);}})['then'](function(_0x298ea0){if(_0x298ea0){return _0x298ea0?{'count':_0x3b57a9,'rows':_0x298ea0}:null;}})[_0x22b2('0x29')](respondWithResult(_0x10be62,null))[_0x22b2('0x47')](handleError(_0x10be62,null));}; \ No newline at end of file +var _0x2dc6=['agent','openchannelPause','updatedAt','createdAt','rows','SIP','getTeams','findOne','Team','addTeams','ids','online','interface','flatMap','Agents','sequelize','transaction','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','spread','userOpenchannelQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','catch','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserOpenchannelQueue','findAll','User','findAndCountAll','UserId'];(function(_0x1993d5,_0xb5991a){var _0x31229f=function(_0x16167d){while(--_0x16167d){_0x1993d5['push'](_0x1993d5['shift']());}};_0x31229f(++_0xb5991a);}(_0x2dc6,0x13f));var _0x62dc=function(_0x26590f,_0x5bd8ca){_0x26590f=_0x26590f-0x0;var _0x92fefc=_0x2dc6[_0x26590f];return _0x92fefc;};'use strict';var pdf=require(_0x62dc('0x0'));var emlformat=require(_0x62dc('0x1'));var rimraf=require(_0x62dc('0x2'));var zipdir=require(_0x62dc('0x3'));var jsonpatch=require(_0x62dc('0x4'));var rp=require('request-promise');var moment=require(_0x62dc('0x5'));var BPromise=require(_0x62dc('0x6'));var Mustache=require(_0x62dc('0x7'));var util=require('util');var path=require(_0x62dc('0x8'));var sox=require(_0x62dc('0x9'));var csv=require(_0x62dc('0xa'));var ejs=require(_0x62dc('0xb'));var fs=require('fs');var _=require(_0x62dc('0xc'));var squel=require(_0x62dc('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x62dc('0xe'));var toCsv=require(_0x62dc('0xa'));var querystring=require(_0x62dc('0xf'));var Papa=require(_0x62dc('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x62dc('0x11'));var as=require(_0x62dc('0x12'));var hardwareService=require(_0x62dc('0x13'));var logger=require(_0x62dc('0x14'))(_0x62dc('0x15'));var utils=require(_0x62dc('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x62dc('0x17')]=_[_0x62dc('0x18')](config[_0x62dc('0x17')],{'host':_0x62dc('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x62dc('0x17')]));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x4192c1,_0xecaa1){_0xecaa1=_0xecaa1||0xcc;return function(_0x569060){if(_0x569060){return _0x4192c1[_0x62dc('0x1a')](_0xecaa1);}return _0x4192c1['status'](_0xecaa1)[_0x62dc('0x1b')]();};}function respondWithResult(_0x48d3dd,_0x45d364){_0x45d364=_0x45d364||0xc8;return function(_0x5b1331){if(_0x5b1331){return _0x48d3dd[_0x62dc('0x1c')](_0x45d364)[_0x62dc('0x1d')](_0x5b1331);}};}function respondWithFilteredResult(_0x5cb4d1,_0x587907){return function(_0x206606){if(_0x206606){var _0x4e3364=_0x206606['count'],_0x111ad2=_0x587907['offset'],_0x239f98=_0x587907[_0x62dc('0x1e')]+_0x587907[_0x62dc('0x1f')],_0x3643dc;if(_0x239f98>=_0x4e3364){_0x239f98=_0x4e3364;_0x3643dc=0xc8;}else{_0x3643dc=0xce;}_0x5cb4d1[_0x62dc('0x1c')](_0x3643dc);return _0x5cb4d1[_0x62dc('0x20')](_0x62dc('0x21'),_0x111ad2+'-'+_0x239f98+'/'+_0x4e3364)[_0x62dc('0x1d')](_0x206606);}return null;};}function patchUpdates(_0x2ed74d){return function(_0x18cf81){try{jsonpatch[_0x62dc('0x22')](_0x18cf81,_0x2ed74d,!![]);}catch(_0x389705){return BPromise[_0x62dc('0x23')](_0x389705);}return _0x18cf81[_0x62dc('0x24')]();};}function saveUpdates(_0x5ea119,_0x116b6a){return function(_0x32e67e){if(_0x32e67e){return _0x32e67e[_0x62dc('0x25')](_0x5ea119)[_0x62dc('0x26')](function(_0x48561b){return _0x48561b;});}return null;};}function removeEntity(_0x369e4e,_0x439a12){return function(_0x190cde){if(_0x190cde){return _0x190cde[_0x62dc('0x27')]()[_0x62dc('0x26')](function(){var _0x2637b9=_0x190cde['get']({'plain':!![]});var _0x586834=_0x62dc('0x28');return db[_0x62dc('0x29')][_0x62dc('0x27')]({'where':{'type':_0x586834,'resourceId':_0x2637b9['id']}})['then'](function(){return _0x190cde;});})[_0x62dc('0x26')](function(){_0x369e4e[_0x62dc('0x1c')](0xcc)[_0x62dc('0x1b')]();});}};}function handleEntityNotFound(_0x514a2d,_0x473351){return function(_0x4d38ea){if(!_0x4d38ea){_0x514a2d['sendStatus'](0x194);}return _0x4d38ea;};}function handleError(_0x38a9f1,_0x338643){_0x338643=_0x338643||0x1f4;return function(_0x2090af){logger[_0x62dc('0x2a')](_0x2090af[_0x62dc('0x2b')]);if(_0x2090af[_0x62dc('0x2c')]){delete _0x2090af['name'];}_0x38a9f1['status'](_0x338643)[_0x62dc('0x2d')](_0x2090af);};}exports[_0x62dc('0x2e')]=function(_0x440c2c,_0x48e132){var _0x5f1aa8={},_0x4be8e8={},_0x341a8f={'count':0x0,'rows':[]};var _0x2a51ce=_[_0x62dc('0x2f')](db[_0x62dc('0x30')]['rawAttributes'],function(_0x20652b){return{'name':_0x20652b[_0x62dc('0x31')],'type':_0x20652b['type'][_0x62dc('0x32')]};});_0x4be8e8[_0x62dc('0x33')]=_[_0x62dc('0x2f')](_0x2a51ce,_0x62dc('0x2c'));_0x4be8e8[_0x62dc('0x34')]=_[_0x62dc('0x35')](_0x440c2c[_0x62dc('0x34')]);_0x4be8e8[_0x62dc('0x36')]=_[_0x62dc('0x37')](_0x4be8e8['model'],_0x4be8e8[_0x62dc('0x34')]);_0x5f1aa8[_0x62dc('0x38')]=_['intersection'](_0x4be8e8[_0x62dc('0x33')],qs[_0x62dc('0x39')](_0x440c2c[_0x62dc('0x34')][_0x62dc('0x39')]));_0x5f1aa8['attributes']=_0x5f1aa8[_0x62dc('0x38')][_0x62dc('0x3a')]?_0x5f1aa8[_0x62dc('0x38')]:_0x4be8e8[_0x62dc('0x33')];if(!_0x440c2c[_0x62dc('0x34')][_0x62dc('0x3b')](_0x62dc('0x3c'))){_0x5f1aa8[_0x62dc('0x1f')]=qs['limit'](_0x440c2c[_0x62dc('0x34')][_0x62dc('0x1f')]);_0x5f1aa8[_0x62dc('0x1e')]=qs[_0x62dc('0x1e')](_0x440c2c['query'][_0x62dc('0x1e')]);}_0x5f1aa8[_0x62dc('0x3d')]=qs[_0x62dc('0x3e')](_0x440c2c[_0x62dc('0x34')][_0x62dc('0x3e')]);_0x5f1aa8[_0x62dc('0x3f')]=qs['filters'](_[_0x62dc('0x40')](_0x440c2c[_0x62dc('0x34')],_0x4be8e8[_0x62dc('0x36')]),_0x2a51ce);if(_0x440c2c[_0x62dc('0x34')][_0x62dc('0x41')]){_0x5f1aa8[_0x62dc('0x3f')]=_['merge'](_0x5f1aa8['where'],{'$or':_['map'](_0x2a51ce,function(_0x17508c){if(_0x17508c['type']!==_0x62dc('0x42')){var _0x15bb1d={};_0x15bb1d[_0x17508c[_0x62dc('0x2c')]]={'$like':'%'+_0x440c2c[_0x62dc('0x34')][_0x62dc('0x41')]+'%'};return _0x15bb1d;}})});}_0x5f1aa8=_[_0x62dc('0x43')]({},_0x5f1aa8,_0x440c2c[_0x62dc('0x44')]);var _0x590ae2={'where':_0x5f1aa8['where']};return db[_0x62dc('0x30')][_0x62dc('0x45')](_0x590ae2)[_0x62dc('0x26')](function(_0x380822){_0x341a8f[_0x62dc('0x45')]=_0x380822;if(_0x440c2c[_0x62dc('0x34')]['includeAll']){_0x5f1aa8[_0x62dc('0x46')]=[{'all':!![]}];}return db['OpenchannelQueue']['findAll'](_0x5f1aa8);})['then'](function(_0x102b50){_0x341a8f['rows']=_0x102b50;return _0x341a8f;})[_0x62dc('0x26')](respondWithFilteredResult(_0x48e132,_0x5f1aa8))[_0x62dc('0x47')](handleError(_0x48e132,null));};exports[_0x62dc('0x48')]=function(_0x127358,_0x321032){var _0x253890={'raw':!![],'where':{'id':_0x127358[_0x62dc('0x49')]['id']}},_0x94e518={};_0x94e518[_0x62dc('0x33')]=_['keys'](db['OpenchannelQueue'][_0x62dc('0x4a')]);_0x94e518[_0x62dc('0x34')]=_[_0x62dc('0x35')](_0x127358[_0x62dc('0x34')]);_0x94e518[_0x62dc('0x36')]=_[_0x62dc('0x37')](_0x94e518[_0x62dc('0x33')],_0x94e518[_0x62dc('0x34')]);_0x253890['attributes']=_[_0x62dc('0x37')](_0x94e518[_0x62dc('0x33')],qs[_0x62dc('0x39')](_0x127358[_0x62dc('0x34')][_0x62dc('0x39')]));_0x253890[_0x62dc('0x38')]=_0x253890[_0x62dc('0x38')][_0x62dc('0x3a')]?_0x253890[_0x62dc('0x38')]:_0x94e518[_0x62dc('0x33')];if(_0x127358['query']['includeAll']){_0x253890[_0x62dc('0x46')]=[{'all':!![]}];}_0x253890=_['merge']({},_0x253890,_0x127358[_0x62dc('0x44')]);return db[_0x62dc('0x30')][_0x62dc('0x4b')](_0x253890)[_0x62dc('0x26')](handleEntityNotFound(_0x321032,null))[_0x62dc('0x26')](respondWithResult(_0x321032,null))[_0x62dc('0x47')](handleError(_0x321032,null));};exports[_0x62dc('0x4c')]=function(_0x35ef7f,_0x59b600){return db['OpenchannelQueue'][_0x62dc('0x4c')](_0x35ef7f[_0x62dc('0x4d')],{})[_0x62dc('0x26')](function(_0x1d3735){var _0x2eb9a0=_0x35ef7f[_0x62dc('0x4e')][_0x62dc('0x4f')]({'plain':!![]});if(!_0x2eb9a0)throw new Error(_0x62dc('0x50'));if(_0x2eb9a0[_0x62dc('0x51')]===_0x62dc('0x4e')){var _0x3d5687=_0x1d3735[_0x62dc('0x4f')]({'plain':!![]});var _0x36e9cf=_0x62dc('0x28');return db[_0x62dc('0x52')][_0x62dc('0x4b')]({'where':{'name':_0x36e9cf,'userProfileId':_0x2eb9a0['userProfileId']},'raw':!![]})[_0x62dc('0x26')](function(_0x121c60){if(_0x121c60&&_0x121c60[_0x62dc('0x53')]===0x0){return db[_0x62dc('0x29')][_0x62dc('0x4c')]({'name':_0x3d5687[_0x62dc('0x2c')],'resourceId':_0x3d5687['id'],'type':_0x121c60[_0x62dc('0x2c')],'sectionId':_0x121c60['id']},{})[_0x62dc('0x26')](function(){return _0x1d3735;});}else{return _0x1d3735;}})['catch'](function(_0x298b4e){logger[_0x62dc('0x2a')](_0x62dc('0x54'),_0x298b4e);throw _0x298b4e;});}return _0x1d3735;})[_0x62dc('0x26')](respondWithResult(_0x59b600,0xc9))[_0x62dc('0x47')](handleError(_0x59b600,null));};exports['update']=function(_0x463357,_0x5e67ec){if(_0x463357['body']['id']){delete _0x463357[_0x62dc('0x4d')]['id'];}return db[_0x62dc('0x30')][_0x62dc('0x4b')]({'where':{'id':_0x463357['params']['id']}})[_0x62dc('0x26')](handleEntityNotFound(_0x5e67ec,null))['then'](saveUpdates(_0x463357[_0x62dc('0x4d')],null))[_0x62dc('0x26')](respondWithResult(_0x5e67ec,null))[_0x62dc('0x47')](handleError(_0x5e67ec,null));};exports[_0x62dc('0x27')]=function(_0x5739fd,_0x57a8d9){return db[_0x62dc('0x30')][_0x62dc('0x4b')]({'where':{'id':_0x5739fd['params']['id']}})[_0x62dc('0x26')](handleEntityNotFound(_0x57a8d9,null))[_0x62dc('0x26')](removeEntity(_0x57a8d9,null))[_0x62dc('0x47')](handleError(_0x57a8d9,null));};exports[_0x62dc('0x55')]=function(_0x5246fe,_0x49ae70){return db[_0x62dc('0x30')][_0x62dc('0x55')]()[_0x62dc('0x26')](respondWithResult(_0x49ae70,null))[_0x62dc('0x47')](handleError(_0x49ae70,null));};exports[_0x62dc('0x56')]=function(_0xea306e,_0x41653c,_0xd5ab67){var _0x568c0b={'raw':!![],'where':{}},_0x542968={},_0x5de7a2;return db['OpenchannelQueue']['findOne']({'where':{'id':_0xea306e['params']['id']}})['then'](handleEntityNotFound(_0x41653c,null))[_0x62dc('0x26')](function(_0x17e89c){if(_0x17e89c){_0x5de7a2=_0x17e89c[_0x62dc('0x4f')]({'plain':!![]});_0x542968[_0x62dc('0x33')]=_[_0x62dc('0x35')](db[_0x62dc('0x57')][_0x62dc('0x4a')]);_0x542968['query']=_[_0x62dc('0x35')](_0xea306e[_0x62dc('0x34')]);_0x542968[_0x62dc('0x36')]=_[_0x62dc('0x37')](_0x542968[_0x62dc('0x33')],_0x542968[_0x62dc('0x34')]);_0x568c0b[_0x62dc('0x38')]=_[_0x62dc('0x37')](_0x542968[_0x62dc('0x33')],qs[_0x62dc('0x39')](_0xea306e[_0x62dc('0x34')][_0x62dc('0x39')]));_0x568c0b['attributes']=_0x568c0b['attributes']['length']?_0x568c0b[_0x62dc('0x38')]:_0x542968[_0x62dc('0x33')];if(!_0xea306e[_0x62dc('0x34')]['hasOwnProperty'](_0x62dc('0x3c'))){_0x568c0b['limit']=qs[_0x62dc('0x1f')](_0xea306e[_0x62dc('0x34')][_0x62dc('0x1f')]);_0x568c0b[_0x62dc('0x1e')]=qs[_0x62dc('0x1e')](_0xea306e[_0x62dc('0x34')][_0x62dc('0x1e')]);}_0x568c0b[_0x62dc('0x3d')]=qs[_0x62dc('0x3e')](_0xea306e[_0x62dc('0x34')][_0x62dc('0x3e')]);_0x568c0b[_0x62dc('0x3f')]=qs[_0x62dc('0x36')](_['pick'](_0xea306e[_0x62dc('0x34')],_0x542968[_0x62dc('0x36')]));_0x568c0b['where']['OpenchannelQueueId']=_0x17e89c['id'];if(_0xea306e[_0x62dc('0x34')][_0x62dc('0x41')]){_0x568c0b[_0x62dc('0x3f')]=_['merge'](_0x568c0b[_0x62dc('0x3f')],{'$or':_['map'](_0x568c0b[_0x62dc('0x38')],function(_0x32a2f7){var _0x15543c={};_0x15543c[_0x32a2f7]={'$like':'%'+_0xea306e['query'][_0x62dc('0x41')]+'%'};return _0x15543c;})});}_0x568c0b=_[_0x62dc('0x43')]({},_0x568c0b,_0xea306e[_0x62dc('0x44')]);return db['UserOpenchannelQueue'][_0x62dc('0x58')](_0x568c0b);}})[_0x62dc('0x26')](function(_0x5c6483){if(_0x5c6483){return db[_0x62dc('0x59')][_0x62dc('0x5a')]({'where':{'id':_[_0x62dc('0x2f')](_0x5c6483,_0x62dc('0x5b')),'role':_0x62dc('0x5c')},'attributes':['id','name',_0x62dc('0x5d'),_0x62dc('0x5e'),_0x62dc('0x5f')]});}})['then'](function(_0x1473a6){if(_0x1473a6){return{'count':_0x1473a6[_0x62dc('0x45')],'rows':_[_0x62dc('0x2f')](_0x1473a6[_0x62dc('0x60')],function(_0x401165){return{'membername':_0x401165['name'],'UserId':_0x401165['id'],'queue_name':_0x5de7a2['name'],'OpenchannelQueueId':_0x5de7a2['id'],'interface':util['format']('%s/%s',_0x62dc('0x61'),_0x401165['name']),'penalty':0x0,'paused':_0x401165['openchannelPause'],'createdAt':_0x401165['createdAt'],'updatedAt':_0x401165[_0x62dc('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x62dc('0x26')](respondWithFilteredResult(_0x41653c,_0x568c0b))[_0x62dc('0x47')](handleError(_0x41653c,null));};exports[_0x62dc('0x62')]=function(_0x148078,_0x3ff864,_0x539a6b){var _0x415cd9={};var _0x4383fd={};var _0x4a9590;var _0x2be39e;return db['OpenchannelQueue'][_0x62dc('0x63')]({'where':{'id':_0x148078[_0x62dc('0x49')]['id']}})[_0x62dc('0x26')](handleEntityNotFound(_0x3ff864,null))[_0x62dc('0x26')](function(_0xc77bda){if(_0xc77bda){_0x4a9590=_0xc77bda;_0x4383fd[_0x62dc('0x33')]=_['keys'](db[_0x62dc('0x64')][_0x62dc('0x4a')]);_0x4383fd[_0x62dc('0x34')]=_[_0x62dc('0x35')](_0x148078[_0x62dc('0x34')]);_0x4383fd[_0x62dc('0x36')]=_[_0x62dc('0x37')](_0x4383fd[_0x62dc('0x33')],_0x4383fd[_0x62dc('0x34')]);_0x415cd9[_0x62dc('0x38')]=_[_0x62dc('0x37')](_0x4383fd[_0x62dc('0x33')],qs[_0x62dc('0x39')](_0x148078[_0x62dc('0x34')][_0x62dc('0x39')]));_0x415cd9[_0x62dc('0x38')]=_0x415cd9[_0x62dc('0x38')][_0x62dc('0x3a')]?_0x415cd9[_0x62dc('0x38')]:_0x4383fd['model'];_0x415cd9['order']=qs[_0x62dc('0x3e')](_0x148078[_0x62dc('0x34')]['sort']);_0x415cd9[_0x62dc('0x3f')]=qs[_0x62dc('0x36')](_['pick'](_0x148078[_0x62dc('0x34')],_0x4383fd['filters']));if(_0x148078['query'][_0x62dc('0x41')]){_0x415cd9[_0x62dc('0x3f')]=_[_0x62dc('0x43')](_0x415cd9[_0x62dc('0x3f')],{'$or':_[_0x62dc('0x2f')](_0x415cd9[_0x62dc('0x38')],function(_0x5aaf7){var _0x526d3d={};_0x526d3d[_0x5aaf7]={'$like':'%'+_0x148078[_0x62dc('0x34')][_0x62dc('0x41')]+'%'};return _0x526d3d;})});}_0x415cd9=_[_0x62dc('0x43')]({},_0x415cd9,_0x148078[_0x62dc('0x44')]);return _0x4a9590[_0x62dc('0x62')](_0x415cd9);}})[_0x62dc('0x26')](function(_0x1e5be1){if(_0x1e5be1){_0x2be39e=_0x1e5be1['length'];if(!_0x148078[_0x62dc('0x34')][_0x62dc('0x3b')](_0x62dc('0x3c'))){_0x415cd9['limit']=qs['limit'](_0x148078[_0x62dc('0x34')]['limit']);_0x415cd9[_0x62dc('0x1e')]=qs[_0x62dc('0x1e')](_0x148078[_0x62dc('0x34')]['offset']);}return _0x4a9590['getTeams'](_0x415cd9);}})['then'](function(_0x34fd5b){if(_0x34fd5b){return _0x34fd5b?{'count':_0x2be39e,'rows':_0x34fd5b}:null;}})[_0x62dc('0x26')](respondWithResult(_0x3ff864,null))['catch'](handleError(_0x3ff864,null));};exports[_0x62dc('0x65')]=function(_0x2301eb,_0x3b79bd,_0x2ae836){var _0x7fbf64=_0x2301eb[_0x62dc('0x4d')][_0x62dc('0x66')];return db[_0x62dc('0x64')]['findAll']({'where':{'id':_0x7fbf64},'attributes':['id'],'include':[{'model':db[_0x62dc('0x59')],'as':'Agents','attributes':['id',_0x62dc('0x2c'),_0x62dc('0x67'),'voicePause',_0x62dc('0x68')],'raw':!![]}]})[_0x62dc('0x26')](function(_0x2b56e6){if(_0x2b56e6){var _0x30faed=_[_0x62dc('0x69')](_0x2b56e6,function(_0x4bc323){var _0x32f123=_0x4bc323[_0x62dc('0x4f')]({'plain':!![]});return _0x32f123[_0x62dc('0x6a')];});return db[_0x62dc('0x30')]['find']({'where':{'id':_0x2301eb[_0x62dc('0x49')]['id']}})[_0x62dc('0x26')](function(_0x3edb2a){return db[_0x62dc('0x6b')][_0x62dc('0x6c')](function(_0x1eb50b){return _0x3edb2a[_0x62dc('0x65')](_0x7fbf64,{'transaction':_0x1eb50b})[_0x62dc('0x26')](function(){return BPromise['each'](_0x30faed,function(_0x1a41ae){return db[_0x62dc('0x57')][_0x62dc('0x6d')]({'where':{'UserId':_0x1a41ae['id'],'OpenchannelQueueId':_0x2301eb[_0x62dc('0x49')]['id']},'transaction':_0x1eb50b});});})[_0x62dc('0x26')](function(){_0x30faed[_0x62dc('0x6e')](function(_0x31563b){socket[_0x62dc('0x6f')](_0x62dc('0x70'),{'UserId':_0x31563b['id'],'OpenchannelQueueId':_0x3edb2a['id']});});});});});}})[_0x62dc('0x26')](respondWithStatusCode(_0x3b79bd,null))[_0x62dc('0x47')](handleError(_0x3b79bd,null));};exports[_0x62dc('0x71')]=function(_0x2871f,_0x5bf30d,_0x503d25){return db['Team'][_0x62dc('0x58')]({'where':{'id':_0x2871f['query'][_0x62dc('0x66')]},'attributes':['id'],'include':[{'model':db[_0x62dc('0x59')],'as':_0x62dc('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x62dc('0x26')](handleEntityNotFound(_0x5bf30d,null))[_0x62dc('0x26')](function(_0x365d11){var _0x224adf=_['map'](_0x365d11,'id');var _0x1a5cc5=[];var _0x1d5e84=[];var _0xafb921=squel[_0x62dc('0x72')]();_0xafb921['field'](_0x62dc('0x73'))[_0x62dc('0x74')]('team_has_openchannel_queues','tq')[_0x62dc('0x75')](_0x62dc('0x76'),'ut',_0x62dc('0x77'))['where'](_0x62dc('0x78'),_0x2871f['params']['id']);for(var _0x58cfa0=0x0;_0x58cfa0<_0x365d11[_0x62dc('0x3a')];_0x58cfa0+=0x1){let _0x589732=_0x365d11[_0x58cfa0];for(var _0x1feba8=0x0;_0x1feba8<_0x589732[_0x62dc('0x6a')]['length'];_0x1feba8+=0x1){let _0x59c532=_0x589732['Agents'][_0x1feba8];var _0xb2b585=_0xafb921[_0x62dc('0x79')]();_0xb2b585[_0x62dc('0x3f')](_0x62dc('0x7a'),_0x59c532['id']);_0x1d5e84[_0x62dc('0x7b')](db['sequelize'][_0x62dc('0x34')](_0xb2b585[_0x62dc('0x7c')](),{'type':db[_0x62dc('0x6b')]['QueryTypes'][_0x62dc('0x7d')]})[_0x62dc('0x26')](function(_0x5d3fc2){if(_0x5d3fc2[_0x62dc('0x3a')]===0x1){return _0x59c532['id'];}else{var _0x1ab4c1=_[_0x62dc('0x7e')](_[_0x62dc('0x2f')](_0x5d3fc2,_0x62dc('0x7f')),function(_0x59f126){return _[_0x62dc('0x80')](_0x224adf,_0x59f126);});if(_0x1ab4c1){return _0x59c532['id'];}}}));}}return BPromise[_0x62dc('0x81')](_0x1d5e84)['then'](function(_0x1fbf3b){_0x1a5cc5=_(_0x1a5cc5)['union'](_0x1fbf3b)[_0x62dc('0x82')]()[_0x62dc('0x83')]();return db[_0x62dc('0x30')][_0x62dc('0x4b')]({'where':{'id':_0x2871f[_0x62dc('0x49')]['id']}})[_0x62dc('0x26')](function(_0x2190c1){return db[_0x62dc('0x6b')][_0x62dc('0x6c')](function(_0x371732){return _0x2190c1[_0x62dc('0x71')](_0x2871f['query'][_0x62dc('0x66')],{'transaction':_0x371732})[_0x62dc('0x26')](function(){if(!_[_0x62dc('0x84')](_0x1a5cc5)){return _0x2190c1[_0x62dc('0x85')](_0x1a5cc5,{'transaction':_0x371732});}})[_0x62dc('0x26')](function(){_0x1a5cc5[_0x62dc('0x6e')](function(_0xf0547d){socket[_0x62dc('0x6f')]('userOpenchannelQueue:remove',{'UserId':_0xf0547d,'OpenchannelQueueId':_0x2190c1['id']});});});});});});})['then'](respondWithStatusCode(_0x5bf30d,null))[_0x62dc('0x47')](handleError(_0x5bf30d,null));};exports['addAgents']=function(_0x1717e0,_0x498d93,_0x30a2e6){return db[_0x62dc('0x30')][_0x62dc('0x4b')]({'where':{'id':_0x1717e0[_0x62dc('0x49')]['id']}})[_0x62dc('0x26')](handleEntityNotFound(_0x498d93,null))[_0x62dc('0x26')](function(_0x4d526a){if(_0x4d526a){return _0x4d526a['addAgents'](_0x1717e0[_0x62dc('0x4d')][_0x62dc('0x66')],_['omit'](_0x1717e0[_0x62dc('0x4d')],[_0x62dc('0x66'),'id'])||{})[_0x62dc('0x86')](function(_0x2ff6c0){for(var _0xdbe210=0x0;_0xdbe210<_0x1717e0['body'][_0x62dc('0x66')][_0x62dc('0x3a')];_0xdbe210+=0x1){socket[_0x62dc('0x6f')]('userOpenchannelQueue:save',{'UserId':_0x1717e0[_0x62dc('0x4d')]['ids'][_0xdbe210],'OpenchannelQueueId':_0x1717e0[_0x62dc('0x49')]['id']});}return _0x2ff6c0;});}})[_0x62dc('0x26')](respondWithResult(_0x498d93,null))['catch'](handleError(_0x498d93,null));};exports[_0x62dc('0x85')]=function(_0x2f1d6c,_0x5ddfe4,_0x2b75ad){return db[_0x62dc('0x30')][_0x62dc('0x4b')]({'where':{'id':_0x2f1d6c['params']['id']}})[_0x62dc('0x26')](handleEntityNotFound(_0x5ddfe4,null))[_0x62dc('0x26')](function(_0x559f1b){if(_0x559f1b){return _0x559f1b[_0x62dc('0x85')](_0x2f1d6c[_0x62dc('0x34')][_0x62dc('0x66')])['then'](function(){if(_['isArray'](_0x2f1d6c['query'][_0x62dc('0x66')])){for(var _0xb0c0fb=0x0;_0xb0c0fb<_0x2f1d6c['query'][_0x62dc('0x66')]['length'];_0xb0c0fb+=0x1){socket[_0x62dc('0x6f')]('userOpenchannelQueue:remove',{'UserId':Number(_0x2f1d6c[_0x62dc('0x34')]['ids'][_0xb0c0fb]),'OpenchannelQueueId':Number(_0x2f1d6c[_0x62dc('0x49')]['id'])});}}else{socket['emit'](_0x62dc('0x87'),{'UserId':Number(_0x2f1d6c[_0x62dc('0x34')][_0x62dc('0x66')]),'OpenchannelQueueId':Number(_0x2f1d6c[_0x62dc('0x49')]['id'])});}});}})[_0x62dc('0x26')](respondWithStatusCode(_0x5ddfe4,null))[_0x62dc('0x47')](handleError(_0x5ddfe4,null));};exports[_0x62dc('0x88')]=function(_0x427990,_0x42df60,_0x2c73dc){var _0x28d893={};var _0xb23755={};var _0x3fd48c;var _0x45e255;return db[_0x62dc('0x30')][_0x62dc('0x63')]({'where':{'id':_0x427990[_0x62dc('0x49')]['id']}})[_0x62dc('0x26')](handleEntityNotFound(_0x42df60,null))[_0x62dc('0x26')](function(_0x15f71b){if(_0x15f71b){_0x3fd48c=_0x15f71b;_0xb23755[_0x62dc('0x33')]=_[_0x62dc('0x35')](db[_0x62dc('0x59')]['rawAttributes']);_0xb23755['query']=_[_0x62dc('0x35')](_0x427990[_0x62dc('0x34')]);_0xb23755[_0x62dc('0x36')]=_[_0x62dc('0x37')](_0xb23755[_0x62dc('0x33')],_0xb23755[_0x62dc('0x34')]);_0x28d893[_0x62dc('0x38')]=_['intersection'](_0xb23755[_0x62dc('0x33')],qs[_0x62dc('0x39')](_0x427990['query'][_0x62dc('0x39')]));_0x28d893[_0x62dc('0x38')]=_0x28d893['attributes'][_0x62dc('0x3a')]?_0x28d893['attributes']:_0xb23755['model'];_0x28d893['order']=qs[_0x62dc('0x3e')](_0x427990[_0x62dc('0x34')]['sort']);_0x28d893[_0x62dc('0x3f')]=qs[_0x62dc('0x36')](_[_0x62dc('0x40')](_0x427990[_0x62dc('0x34')],_0xb23755[_0x62dc('0x36')]));if(_0x427990[_0x62dc('0x34')][_0x62dc('0x41')]){_0x28d893[_0x62dc('0x3f')]=_[_0x62dc('0x43')](_0x28d893[_0x62dc('0x3f')],{'$or':_['map'](_0x28d893['attributes'],function(_0x1b737a){var _0x2c606c={};_0x2c606c[_0x1b737a]={'$like':'%'+_0x427990[_0x62dc('0x34')][_0x62dc('0x41')]+'%'};return _0x2c606c;})});}_0x28d893=_[_0x62dc('0x43')]({},_0x28d893,_0x427990['options']);return _0x3fd48c[_0x62dc('0x88')](_0x28d893);}})[_0x62dc('0x26')](function(_0x24e7b0){if(_0x24e7b0){_0x45e255=_0x24e7b0[_0x62dc('0x3a')];if(!_0x427990[_0x62dc('0x34')][_0x62dc('0x3b')]('nolimit')){_0x28d893[_0x62dc('0x1f')]=qs['limit'](_0x427990[_0x62dc('0x34')][_0x62dc('0x1f')]);_0x28d893[_0x62dc('0x1e')]=qs[_0x62dc('0x1e')](_0x427990[_0x62dc('0x34')][_0x62dc('0x1e')]);}return _0x3fd48c[_0x62dc('0x88')](_0x28d893);}})[_0x62dc('0x26')](function(_0x8e9578){if(_0x8e9578){return _0x8e9578?{'count':_0x45e255,'rows':_0x8e9578}:null;}})[_0x62dc('0x26')](respondWithResult(_0x42df60,null))[_0x62dc('0x47')](handleError(_0x42df60,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index f6a3d10..44fcb2b 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 _0x6c37=['OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x35aeda,_0x264a31){var _0x40498c=function(_0x25f8fc){while(--_0x25f8fc){_0x35aeda['push'](_0x35aeda['shift']());}};_0x40498c(++_0x264a31);}(_0x6c37,0x13a));var _0x76c3=function(_0x208c3b,_0x3481c0){_0x208c3b=_0x208c3b-0x0;var _0x1ea841=_0x6c37[_0x208c3b];return _0x1ea841;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x76c3('0x0'))['db'][_0x76c3('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x76c3('0x2')](0x0);var events={'afterCreate':_0x76c3('0x3'),'afterUpdate':_0x76c3('0x4'),'afterDestroy':_0x76c3('0x5')};function emitEvent(_0x244ed5){return function(_0xd2635f,_0x49b1bb,_0xd5213c){OpenchannelQueueEvents[_0x76c3('0x6')](_0x244ed5+':'+_0xd2635f['id'],_0xd2635f);OpenchannelQueueEvents[_0x76c3('0x6')](_0x244ed5,_0xd2635f);_0xd5213c(null);};}for(var e in events){if(events[_0x76c3('0x7')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x76c3('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xb608=['../../mysqldb','OpenchannelQueue','setMaxListeners','remove','emit','hasOwnProperty','events'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xb608,0x16b));var _0x8b60=function(_0x24f052,_0x2d48e6){_0x24f052=_0x24f052-0x0;var _0x26d48f=_0xb608[_0x24f052];return _0x26d48f;};'use strict';var EventEmitter=require(_0x8b60('0x0'));var OpenchannelQueue=require(_0x8b60('0x1'))['db'][_0x8b60('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x8b60('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8b60('0x4')};function emitEvent(_0x1c6966){return function(_0x1072d6,_0x23e0f5,_0x19d40b){OpenchannelQueueEvents[_0x8b60('0x5')](_0x1c6966+':'+_0x1072d6['id'],_0x1072d6);OpenchannelQueueEvents[_0x8b60('0x5')](_0x1c6966,_0x1072d6);_0x19d40b(null);};}for(var e in events){if(events[_0x8b60('0x6')](e)){var event=events[e];OpenchannelQueue['hook'](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 64cf8ab..79ddc91 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 _0x30f0=['util','../../config/logger','api','request-promise','path','../../config/environment','define','OpenchannelQueue'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x30f0,0x180));var _0x030f=function(_0x3076f9,_0x379308){_0x3076f9=_0x3076f9-0x0;var _0x552d12=_0x30f0[_0x3076f9];return _0x552d12;};'use strict';var _=require('lodash');var util=require(_0x030f('0x0'));var logger=require(_0x030f('0x1'))(_0x030f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x030f('0x3'));var fs=require('fs');var path=require(_0x030f('0x4'));var rimraf=require('rimraf');var config=require(_0x030f('0x5'));var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x4b48d8,_0x2754c3){return _0x4b48d8[_0x030f('0x6')](_0x030f('0x7'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e20=['request-promise','path','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','lodash','../../config/logger','api','moment'];(function(_0x1a6585,_0x1fd81e){var _0x47350c=function(_0x1f782a){while(--_0x1f782a){_0x1a6585['push'](_0x1a6585['shift']());}};_0x47350c(++_0x1fd81e);}(_0x4e20,0x1ca));var _0x04e2=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x4e20[_0xc8a931];return _0x28bd27;};'use strict';var _=require(_0x04e2('0x0'));var util=require('util');var logger=require(_0x04e2('0x1'))(_0x04e2('0x2'));var moment=require(_0x04e2('0x3'));var BPromise=require('bluebird');var rp=require(_0x04e2('0x4'));var fs=require('fs');var path=require(_0x04e2('0x5'));var rimraf=require('rimraf');var config=require(_0x04e2('0x6'));var attributes=require(_0x04e2('0x7'));module[_0x04e2('0x8')]=function(_0x3ad228,_0x5f035e){return _0x3ad228[_0x04e2('0x9')](_0x04e2('0xa'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index b639260..9a59f08 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 _0x281b=['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','error','code','message','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','attributes','limit','include','map','model','stringify','ShowOpenchannelQueue','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0xbeefde,_0x31b267){var _0x49185a=function(_0x4eeaa1){while(--_0x4eeaa1){_0xbeefde['push'](_0xbeefde['shift']());}};_0x49185a(++_0x31b267);}(_0x281b,0xc5));var _0xb281=function(_0x18fd4b,_0x475e2e){_0x18fd4b=_0x18fd4b-0x0;var _0xe5d6b4=_0x281b[_0x18fd4b];return _0xe5d6b4;};'use strict';var _=require(_0xb281('0x0'));var util=require(_0xb281('0x1'));var moment=require(_0xb281('0x2'));var BPromise=require(_0xb281('0x3'));var rs=require(_0xb281('0x4'));var fs=require('fs');var Redis=require(_0xb281('0x5'));var db=require(_0xb281('0x6'))['db'];var utils=require(_0xb281('0x7'));var logger=require('../../config/logger')(_0xb281('0x8'));var config=require(_0xb281('0x9'));var jayson=require(_0xb281('0xa'));var client=jayson[_0xb281('0xb')]['http']({'port':0x232a});config[_0xb281('0xc')]=_[_0xb281('0xd')](config[_0xb281('0xc')],{'host':_0xb281('0xe'),'port':0x18eb});var socket=require(_0xb281('0xf'))(new Redis(config['redis']));require(_0xb281('0x10'))[_0xb281('0x11')](socket);function respondWithRpcPromise(_0x41a668,_0x5e783f,_0x75041d){return new BPromise(function(_0x4224a8,_0x156e0c){return client[_0xb281('0x12')](_0x41a668,_0x75041d)[_0xb281('0x13')](function(_0x441bd4){logger[_0xb281('0x14')](_0xb281('0x15'),_0x5e783f,_0xb281('0x16'));logger[_0xb281('0x17')](_0xb281('0x18'),_0x5e783f,_0xb281('0x16'),JSON['stringify'](_0x441bd4));if(_0x441bd4[_0xb281('0x19')]){if(_0x441bd4[_0xb281('0x19')][_0xb281('0x1a')]===0x1f4){logger[_0xb281('0x19')](_0xb281('0x15'),_0x5e783f,_0x441bd4['error'][_0xb281('0x1b')]);return _0x156e0c(_0x441bd4[_0xb281('0x19')]['message']);}logger[_0xb281('0x19')](_0xb281('0x15'),_0x5e783f,_0x441bd4[_0xb281('0x19')][_0xb281('0x1b')]);return _0x4224a8(_0x441bd4[_0xb281('0x19')][_0xb281('0x1b')]);}else{logger[_0xb281('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x5e783f,'request\x20sent');_0x4224a8(_0x441bd4['result']['message']);}})[_0xb281('0x1c')](function(_0x10b133){logger[_0xb281('0x19')](_0xb281('0x15'),_0x5e783f,_0x10b133);_0x156e0c(_0x10b133);});});}exports[_0xb281('0x1d')]=function(_0x31616d){var _0x36ca66=this;return new Promise(function(_0x429a5d,_0x4d4dc3){return db[_0xb281('0x1e')][_0xb281('0x1f')]({'raw':_0x31616d[_0xb281('0x20')]?_0x31616d[_0xb281('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x31616d[_0xb281('0x20')]?_0x31616d[_0xb281('0x20')][_0xb281('0x21')]||null:null,'attributes':_0x31616d[_0xb281('0x20')]?_0x31616d['options'][_0xb281('0x22')]||null:null,'limit':_0x31616d[_0xb281('0x20')]?_0x31616d[_0xb281('0x20')][_0xb281('0x23')]||null:null,'include':_0x31616d[_0xb281('0x20')]?_0x31616d[_0xb281('0x20')][_0xb281('0x24')]?_[_0xb281('0x25')](_0x31616d[_0xb281('0x20')][_0xb281('0x24')],function(_0x160ca4){return{'model':db[_0x160ca4[_0xb281('0x26')]],'as':_0x160ca4['as'],'attributes':_0x160ca4['attributes'],'include':_0x160ca4[_0xb281('0x24')]?_[_0xb281('0x25')](_0x160ca4['include'],function(_0x7c3468){return{'model':db[_0x7c3468['model']],'as':_0x7c3468['as'],'attributes':_0x7c3468[_0xb281('0x22')],'include':_0x7c3468['include']?_['map'](_0x7c3468[_0xb281('0x24')],function(_0x25ae8e){return{'model':db[_0x25ae8e[_0xb281('0x26')]],'as':_0x25ae8e['as'],'attributes':_0x25ae8e[_0xb281('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb281('0x13')](function(_0x55db3c){logger['info'](_0xb281('0x1d'),_0x31616d);logger['debug'](_0xb281('0x1d'),_0x31616d,JSON[_0xb281('0x27')](_0x55db3c));_0x429a5d(_0x55db3c);})[_0xb281('0x1c')](function(_0xc67b5e){logger['error'](_0xb281('0x1d'),_0xc67b5e[_0xb281('0x1b')],_0x31616d);_0x4d4dc3(_0x36ca66[_0xb281('0x19')](0x1f4,_0xc67b5e[_0xb281('0x1b')]));});});};exports[_0xb281('0x28')]=function(_0x449625){var _0x337cf9=this;return new Promise(function(_0xee4e5f,_0x5b181b){return db[_0xb281('0x1e')]['find']({'raw':_0x449625[_0xb281('0x20')]?_0x449625['options'][_0xb281('0x29')]===undefined?!![]:![]:!![],'where':_0x449625[_0xb281('0x20')]?_0x449625[_0xb281('0x20')][_0xb281('0x21')]||null:null,'attributes':_0x449625[_0xb281('0x20')]?_0x449625[_0xb281('0x20')]['attributes']||null:null,'include':_0x449625['options']?_0x449625['options'][_0xb281('0x24')]?_[_0xb281('0x25')](_0x449625[_0xb281('0x20')][_0xb281('0x24')],function(_0x811509){return{'model':db[_0x811509[_0xb281('0x26')]],'as':_0x811509['as'],'attributes':_0x811509[_0xb281('0x22')],'include':_0x811509[_0xb281('0x24')]?_[_0xb281('0x25')](_0x811509['include'],function(_0x20fd6e){return{'model':db[_0x20fd6e[_0xb281('0x26')]],'as':_0x20fd6e['as'],'attributes':_0x20fd6e[_0xb281('0x22')],'include':_0x20fd6e[_0xb281('0x24')]?_['map'](_0x20fd6e['include'],function(_0x44fe32){return{'model':db[_0x44fe32['model']],'as':_0x44fe32['as'],'attributes':_0x44fe32[_0xb281('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb281('0x13')](function(_0x1d637a){logger[_0xb281('0x14')](_0xb281('0x28'),_0x449625);logger[_0xb281('0x17')](_0xb281('0x28'),_0x449625,JSON['stringify'](_0x1d637a));_0xee4e5f(_0x1d637a);})[_0xb281('0x1c')](function(_0xd65cfc){logger[_0xb281('0x19')](_0xb281('0x28'),_0xd65cfc['message'],_0x449625);_0x5b181b(_0x337cf9[_0xb281('0x19')](0x1f4,_0xd65cfc[_0xb281('0x1b')]));});});}; \ No newline at end of file +var _0xf755=['client','http','defaults','redis','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','OpenchannelQueue,\x20%s,\x20%s','message','result','OpenchannelQueue','findAll','options','where','limit','include','map','model','attributes','GetOpenchannelQueue','catch','ShowOpenchannelQueue','find','raw','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4295aa,_0x2e2d18){var _0x1e8f6d=function(_0xcd631d){while(--_0xcd631d){_0x4295aa['push'](_0x4295aa['shift']());}};_0x1e8f6d(++_0x2e2d18);}(_0xf755,0x1af));var _0x5f75=function(_0x1a9c1d,_0x25f27c){_0x1a9c1d=_0x1a9c1d-0x0;var _0x1eb97a=_0xf755[_0x1a9c1d];return _0x1eb97a;};'use strict';var _=require(_0x5f75('0x0'));var util=require(_0x5f75('0x1'));var moment=require(_0x5f75('0x2'));var BPromise=require('bluebird');var rs=require(_0x5f75('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5f75('0x4'))['db'];var utils=require(_0x5f75('0x5'));var logger=require(_0x5f75('0x6'))('rpc');var config=require(_0x5f75('0x7'));var jayson=require(_0x5f75('0x8'));var client=jayson[_0x5f75('0x9')][_0x5f75('0xa')]({'port':0x232a});config['redis']=_[_0x5f75('0xb')](config[_0x5f75('0xc')],{'host':_0x5f75('0xd'),'port':0x18eb});var socket=require(_0x5f75('0xe'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x5f75('0xf')](socket);function respondWithRpcPromise(_0x4b93fa,_0x45afce,_0x3e4301){return new BPromise(function(_0x5b10c8,_0x35bcbc){return client['request'](_0x4b93fa,_0x3e4301)[_0x5f75('0x10')](function(_0x4066cd){logger[_0x5f75('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x45afce,_0x5f75('0x12'));logger[_0x5f75('0x13')](_0x5f75('0x14'),_0x45afce,_0x5f75('0x12'),JSON['stringify'](_0x4066cd));if(_0x4066cd['error']){if(_0x4066cd[_0x5f75('0x15')]['code']===0x1f4){logger[_0x5f75('0x15')](_0x5f75('0x16'),_0x45afce,_0x4066cd[_0x5f75('0x15')][_0x5f75('0x17')]);return _0x35bcbc(_0x4066cd[_0x5f75('0x15')][_0x5f75('0x17')]);}logger[_0x5f75('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x45afce,_0x4066cd[_0x5f75('0x15')][_0x5f75('0x17')]);return _0x5b10c8(_0x4066cd['error']['message']);}else{logger[_0x5f75('0x11')](_0x5f75('0x16'),_0x45afce,_0x5f75('0x12'));_0x5b10c8(_0x4066cd[_0x5f75('0x18')]['message']);}})['catch'](function(_0x15f702){logger[_0x5f75('0x15')](_0x5f75('0x16'),_0x45afce,_0x15f702);_0x35bcbc(_0x15f702);});});}exports['GetOpenchannelQueue']=function(_0x497d93){var _0x561404=this;return new Promise(function(_0x5d302c,_0x1c39e8){return db[_0x5f75('0x19')][_0x5f75('0x1a')]({'raw':_0x497d93[_0x5f75('0x1b')]?_0x497d93[_0x5f75('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x497d93[_0x5f75('0x1b')]?_0x497d93['options'][_0x5f75('0x1c')]||null:null,'attributes':_0x497d93[_0x5f75('0x1b')]?_0x497d93['options']['attributes']||null:null,'limit':_0x497d93['options']?_0x497d93['options'][_0x5f75('0x1d')]||null:null,'include':_0x497d93[_0x5f75('0x1b')]?_0x497d93[_0x5f75('0x1b')][_0x5f75('0x1e')]?_[_0x5f75('0x1f')](_0x497d93[_0x5f75('0x1b')]['include'],function(_0x359afa){return{'model':db[_0x359afa[_0x5f75('0x20')]],'as':_0x359afa['as'],'attributes':_0x359afa[_0x5f75('0x21')],'include':_0x359afa[_0x5f75('0x1e')]?_[_0x5f75('0x1f')](_0x359afa[_0x5f75('0x1e')],function(_0x1ecb6f){return{'model':db[_0x1ecb6f['model']],'as':_0x1ecb6f['as'],'attributes':_0x1ecb6f[_0x5f75('0x21')],'include':_0x1ecb6f[_0x5f75('0x1e')]?_['map'](_0x1ecb6f['include'],function(_0x5ced76){return{'model':db[_0x5ced76['model']],'as':_0x5ced76['as'],'attributes':_0x5ced76[_0x5f75('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5f75('0x10')](function(_0x271c0f){logger['info'](_0x5f75('0x22'),_0x497d93);logger[_0x5f75('0x13')](_0x5f75('0x22'),_0x497d93,JSON['stringify'](_0x271c0f));_0x5d302c(_0x271c0f);})[_0x5f75('0x23')](function(_0x4b76af){logger[_0x5f75('0x15')]('GetOpenchannelQueue',_0x4b76af[_0x5f75('0x17')],_0x497d93);_0x1c39e8(_0x561404[_0x5f75('0x15')](0x1f4,_0x4b76af['message']));});});};exports[_0x5f75('0x24')]=function(_0x218d1e){var _0x19baa1=this;return new Promise(function(_0x17f8cf,_0x19d2dc){return db[_0x5f75('0x19')][_0x5f75('0x25')]({'raw':_0x218d1e[_0x5f75('0x1b')]?_0x218d1e['options'][_0x5f75('0x26')]===undefined?!![]:![]:!![],'where':_0x218d1e[_0x5f75('0x1b')]?_0x218d1e[_0x5f75('0x1b')][_0x5f75('0x1c')]||null:null,'attributes':_0x218d1e[_0x5f75('0x1b')]?_0x218d1e[_0x5f75('0x1b')]['attributes']||null:null,'include':_0x218d1e[_0x5f75('0x1b')]?_0x218d1e[_0x5f75('0x1b')][_0x5f75('0x1e')]?_['map'](_0x218d1e['options'][_0x5f75('0x1e')],function(_0x1d7079){return{'model':db[_0x1d7079[_0x5f75('0x20')]],'as':_0x1d7079['as'],'attributes':_0x1d7079[_0x5f75('0x21')],'include':_0x1d7079[_0x5f75('0x1e')]?_[_0x5f75('0x1f')](_0x1d7079[_0x5f75('0x1e')],function(_0x7a8a42){return{'model':db[_0x7a8a42[_0x5f75('0x20')]],'as':_0x7a8a42['as'],'attributes':_0x7a8a42['attributes'],'include':_0x7a8a42[_0x5f75('0x1e')]?_[_0x5f75('0x1f')](_0x7a8a42[_0x5f75('0x1e')],function(_0x545d6d){return{'model':db[_0x545d6d[_0x5f75('0x20')]],'as':_0x545d6d['as'],'attributes':_0x545d6d[_0x5f75('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5f75('0x10')](function(_0x2a4403){logger[_0x5f75('0x11')](_0x5f75('0x24'),_0x218d1e);logger['debug']('ShowOpenchannelQueue',_0x218d1e,JSON[_0x5f75('0x27')](_0x2a4403));_0x17f8cf(_0x2a4403);})[_0x5f75('0x23')](function(_0x23dbba){logger['error'](_0x5f75('0x24'),_0x23dbba[_0x5f75('0x17')],_0x218d1e);_0x19d2dc(_0x19baa1[_0x5f75('0x15')](0x1f4,_0x23dbba[_0x5f75('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index db292c1..b07d10f 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 _0x8e01=['./openchannelQueue.events','save','remove','update','emit','removeListener','register','length','openchannelQueue:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8e01,0x14d));var _0x18e0=function(_0x2f4bbb,_0x3df713){_0x2f4bbb=_0x2f4bbb-0x0;var _0x36cc4e=_0x8e01[_0x2f4bbb];return _0x36cc4e;};'use strict';var OpenchannelQueueEvents=require(_0x18e0('0x0'));var events=[_0x18e0('0x1'),_0x18e0('0x2'),_0x18e0('0x3')];function createListener(_0x595506,_0x4a4f52){return function(_0x5bd451){_0x4a4f52[_0x18e0('0x4')](_0x595506,_0x5bd451);};}function removeListener(_0x565458,_0x5bf57b){return function(){OpenchannelQueueEvents[_0x18e0('0x5')](_0x565458,_0x5bf57b);};}exports[_0x18e0('0x6')]=function(_0x2f8adc){for(var _0x28ec50=0x0,_0x3c586d=events[_0x18e0('0x7')];_0x28ec50<_0x3c586d;_0x28ec50++){var _0x49a3ea=events[_0x28ec50];var _0xdf7dd7=createListener(_0x18e0('0x8')+_0x49a3ea,_0x2f8adc);OpenchannelQueueEvents['on'](_0x49a3ea,_0xdf7dd7);}}; \ No newline at end of file +var _0x735b=['./openchannelQueue.events','save','update','emit','removeListener','register','length','openchannelQueue:'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x735b,0xf0));var _0xb735=function(_0x117dcc,_0x403a10){_0x117dcc=_0x117dcc-0x0;var _0x1729c8=_0x735b[_0x117dcc];return _0x1729c8;};'use strict';var OpenchannelQueueEvents=require(_0xb735('0x0'));var events=[_0xb735('0x1'),'remove',_0xb735('0x2')];function createListener(_0x4d6f34,_0x216043){return function(_0x42ec5e){_0x216043[_0xb735('0x3')](_0x4d6f34,_0x42ec5e);};}function removeListener(_0x54be77,_0x214151){return function(){OpenchannelQueueEvents[_0xb735('0x4')](_0x54be77,_0x214151);};}exports[_0xb735('0x5')]=function(_0x3d9e0a){for(var _0x2f1b1a=0x0,_0x1798ab=events[_0xb735('0x6')];_0x2f1b1a<_0x1798ab;_0x2f1b1a++){var _0x1196a2=events[_0x2f1b1a];var _0x1270f2=createListener(_0xb735('0x7')+_0x1196a2,_0x3d9e0a);OpenchannelQueueEvents['on'](_0x1196a2,_0x1270f2);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 183c1b4..4c42760 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 _0xeef3=['../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x260509,_0x436bc6){var _0x7dc09f=function(_0x49c0fe){while(--_0x49c0fe){_0x260509['push'](_0x260509['shift']());}};_0x7dc09f(++_0x436bc6);}(_0xeef3,0x19c));var _0x3eef=function(_0x1fd675,_0x165dfe){_0x1fd675=_0x1fd675-0x0;var _0x16b554=_0xeef3[_0x1fd675];return _0x16b554;};'use strict';var multer=require(_0x3eef('0x0'));var util=require('util');var path=require(_0x3eef('0x1'));var timeout=require(_0x3eef('0x2'));var express=require('express');var router=express[_0x3eef('0x3')]();var auth=require(_0x3eef('0x4'));var interaction=require(_0x3eef('0x5'));var config=require(_0x3eef('0x6'));var controller=require(_0x3eef('0x7'));router[_0x3eef('0x8')]('/',auth[_0x3eef('0x9')](),controller[_0x3eef('0xa')]);router['get'](_0x3eef('0xb'),auth['isAuthenticated'](),controller[_0x3eef('0xc')]);router[_0x3eef('0x8')]('/:id',auth[_0x3eef('0x9')](),controller[_0x3eef('0xd')]);router[_0x3eef('0xe')]('/',auth[_0x3eef('0x9')](),controller[_0x3eef('0xf')]);router[_0x3eef('0x10')](_0x3eef('0x11'),auth['isAuthenticated'](),controller[_0x3eef('0x12')]);router[_0x3eef('0x13')](_0x3eef('0x11'),auth[_0x3eef('0x9')](),controller[_0x3eef('0x14')]);module[_0x3eef('0x15')]=router; \ No newline at end of file +var _0xa33b=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1075a2,_0xb2f371){var _0x43f5f9=function(_0x2f7760){while(--_0x2f7760){_0x1075a2['push'](_0x1075a2['shift']());}};_0x43f5f9(++_0xb2f371);}(_0xa33b,0x68));var _0xba33=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xa33b[_0x17b6e3];return _0x3906f3;};'use strict';var multer=require(_0xba33('0x0'));var util=require(_0xba33('0x1'));var path=require(_0xba33('0x2'));var timeout=require(_0xba33('0x3'));var express=require(_0xba33('0x4'));var router=express[_0xba33('0x5')]();var auth=require(_0xba33('0x6'));var interaction=require(_0xba33('0x7'));var config=require(_0xba33('0x8'));var controller=require('./openchannelQueueReport.controller');router[_0xba33('0x9')]('/',auth['isAuthenticated'](),controller[_0xba33('0xa')]);router[_0xba33('0x9')](_0xba33('0xb'),auth[_0xba33('0xc')](),controller[_0xba33('0xd')]);router[_0xba33('0x9')](_0xba33('0xe'),auth[_0xba33('0xc')](),controller['show']);router[_0xba33('0xf')]('/',auth[_0xba33('0xc')](),controller[_0xba33('0x10')]);router[_0xba33('0x11')](_0xba33('0xe'),auth[_0xba33('0xc')](),controller[_0xba33('0x12')]);router[_0xba33('0x13')](_0xba33('0xe'),auth[_0xba33('0xc')](),controller[_0xba33('0x14')]);module[_0xba33('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index ce69cbe..9766883 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 _0xe81b=['exports','STRING','DATE','sequelize'];(function(_0x22d122,_0x30802a){var _0x37e370=function(_0x510d58){while(--_0x510d58){_0x22d122['push'](_0x22d122['shift']());}};_0x37e370(++_0x30802a);}(_0xe81b,0x73));var _0xbe81=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xe81b[_0x3070dc];return _0x431489;};'use strict';var moment=require('moment');var Sequelize=require(_0xbe81('0x0'));module[_0xbe81('0x1')]={'uniqueid':{'type':Sequelize[_0xbe81('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xbe81('0x2')]},'joinAt':{'type':Sequelize[_0xbe81('0x3')]},'leaveAt':{'type':Sequelize[_0xbe81('0x3')]},'acceptAt':{'type':Sequelize[_0xbe81('0x3')]},'exitAt':{'type':Sequelize[_0xbe81('0x3')]},'reason':{'type':Sequelize[_0xbe81('0x2')]}}; \ No newline at end of file +var _0x38f6=['sequelize','exports','STRING','DATE','moment'];(function(_0x36c580,_0x4d5712){var _0x4690ce=function(_0x1ee850){while(--_0x1ee850){_0x36c580['push'](_0x36c580['shift']());}};_0x4690ce(++_0x4d5712);}(_0x38f6,0x176));var _0x638f=function(_0x246e9e,_0x3bf100){_0x246e9e=_0x246e9e-0x0;var _0x9236dc=_0x38f6[_0x246e9e];return _0x9236dc;};'use strict';var moment=require(_0x638f('0x0'));var Sequelize=require(_0x638f('0x1'));module[_0x638f('0x2')]={'uniqueid':{'type':Sequelize[_0x638f('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x638f('0x3')]},'joinAt':{'type':Sequelize[_0x638f('0x4')]},'leaveAt':{'type':Sequelize[_0x638f('0x4')]},'acceptAt':{'type':Sequelize[_0x638f('0x4')]},'exitAt':{'type':Sequelize[_0x638f('0x4')]},'reason':{'type':Sequelize[_0x638f('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index fcb1ba6..5a914d9 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 _0x66b8=['rawAttributes','intersection','create','body','find','destroy','describe','html-pdf','rimraf','zip-dir','moment','bluebird','util','to-csv','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','limit','apply','save','update','then','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','fields','attributes','length','nolimit','offset','order','sort','filter','where','merge','options','OpenchannelQueueReport','includeAll','include','catch','show','params'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x66b8,0x8b));var _0x866b=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x66b8[_0x2070da];return _0x4f9fe1;};'use strict';var pdf=require(_0x866b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x866b('0x1'));var zipdir=require(_0x866b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x866b('0x3'));var BPromise=require(_0x866b('0x4'));var Mustache=require('mustache');var util=require(_0x866b('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x866b('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x866b('0x7'));var squel=require('squel');var crypto=require(_0x866b('0x8'));var jsforce=require(_0x866b('0x9'));var deskjs=require(_0x866b('0xa'));var toCsv=require(_0x866b('0x6'));var querystring=require(_0x866b('0xb'));var Papa=require(_0x866b('0xc'));var Redis=require(_0x866b('0xd'));var authService=require(_0x866b('0xe'));var qs=require(_0x866b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x866b('0x10'));var logger=require('../../config/logger')(_0x866b('0x11'));var utils=require(_0x866b('0x12'));var config=require(_0x866b('0x13'));var db=require(_0x866b('0x14'))['db'];function respondWithStatusCode(_0x386656,_0x27387a){_0x27387a=_0x27387a||0xcc;return function(_0x285140){if(_0x285140){return _0x386656[_0x866b('0x15')](_0x27387a);}return _0x386656['status'](_0x27387a)['end']();};}function respondWithResult(_0x4aeea4,_0x1c97a9){_0x1c97a9=_0x1c97a9||0xc8;return function(_0x199a9b){if(_0x199a9b){return _0x4aeea4[_0x866b('0x16')](_0x1c97a9)[_0x866b('0x17')](_0x199a9b);}};}function respondWithFilteredResult(_0x3c3cd4,_0x1b8abd){return function(_0x2fa062){if(_0x2fa062){var _0x536606=_0x2fa062[_0x866b('0x18')],_0xc1d310=_0x1b8abd['offset'],_0x24ef13=_0x1b8abd['offset']+_0x1b8abd[_0x866b('0x19')],_0x2af57d;if(_0x24ef13>=_0x536606){_0x24ef13=_0x536606;_0x2af57d=0xc8;}else{_0x2af57d=0xce;}_0x3c3cd4[_0x866b('0x16')](_0x2af57d);return _0x3c3cd4['set']('Content-Range',_0xc1d310+'-'+_0x24ef13+'/'+_0x536606)[_0x866b('0x17')](_0x2fa062);}return null;};}function patchUpdates(_0x348635){return function(_0x1be9d1){try{jsonpatch[_0x866b('0x1a')](_0x1be9d1,_0x348635,!![]);}catch(_0x217b57){return BPromise['reject'](_0x217b57);}return _0x1be9d1[_0x866b('0x1b')]();};}function saveUpdates(_0x252ed0,_0x1541be){return function(_0x26dd31){if(_0x26dd31){return _0x26dd31[_0x866b('0x1c')](_0x252ed0)['then'](function(_0x30d562){return _0x30d562;});}return null;};}function removeEntity(_0x32c151,_0x2bf6b9){return function(_0x369c38){if(_0x369c38){return _0x369c38['destroy']()[_0x866b('0x1d')](function(){_0x32c151[_0x866b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28f5f5,_0x544313){return function(_0x230cf9){if(!_0x230cf9){_0x28f5f5[_0x866b('0x15')](0x194);}return _0x230cf9;};}function handleError(_0x11fc69,_0x40a894){_0x40a894=_0x40a894||0x1f4;return function(_0xdd0ec6){logger['error'](_0xdd0ec6[_0x866b('0x1e')]);if(_0xdd0ec6[_0x866b('0x1f')]){delete _0xdd0ec6[_0x866b('0x1f')];}_0x11fc69[_0x866b('0x16')](_0x40a894)[_0x866b('0x20')](_0xdd0ec6);};}exports[_0x866b('0x21')]=function(_0x28f6bf,_0x5ed7a0){var _0xae3a29={},_0x4d4e98={},_0x4812ae={'count':0x0,'rows':[]};var _0x8bb25d=_[_0x866b('0x22')](db['OpenchannelQueueReport']['rawAttributes'],function(_0xdfaf1a){return{'name':_0xdfaf1a[_0x866b('0x23')],'type':_0xdfaf1a[_0x866b('0x24')][_0x866b('0x25')]};});_0x4d4e98[_0x866b('0x26')]=_[_0x866b('0x22')](_0x8bb25d,_0x866b('0x1f'));_0x4d4e98[_0x866b('0x27')]=_[_0x866b('0x28')](_0x28f6bf['query']);_0x4d4e98[_0x866b('0x29')]=_['intersection'](_0x4d4e98[_0x866b('0x26')],_0x4d4e98[_0x866b('0x27')]);_0xae3a29['attributes']=_['intersection'](_0x4d4e98[_0x866b('0x26')],qs[_0x866b('0x2a')](_0x28f6bf[_0x866b('0x27')][_0x866b('0x2a')]));_0xae3a29['attributes']=_0xae3a29[_0x866b('0x2b')][_0x866b('0x2c')]?_0xae3a29[_0x866b('0x2b')]:_0x4d4e98['model'];if(!_0x28f6bf[_0x866b('0x27')]['hasOwnProperty'](_0x866b('0x2d'))){_0xae3a29[_0x866b('0x19')]=qs[_0x866b('0x19')](_0x28f6bf[_0x866b('0x27')]['limit']);_0xae3a29[_0x866b('0x2e')]=qs[_0x866b('0x2e')](_0x28f6bf['query'][_0x866b('0x2e')]);}_0xae3a29[_0x866b('0x2f')]=qs[_0x866b('0x30')](_0x28f6bf['query'][_0x866b('0x30')]);_0xae3a29['where']=qs['filters'](_['pick'](_0x28f6bf['query'],_0x4d4e98['filters']),_0x8bb25d);if(_0x28f6bf[_0x866b('0x27')][_0x866b('0x31')]){_0xae3a29[_0x866b('0x32')]=_[_0x866b('0x33')](_0xae3a29['where'],{'$or':_[_0x866b('0x22')](_0x8bb25d,function(_0x2ba1c2){if(_0x2ba1c2[_0x866b('0x24')]!=='VIRTUAL'){var _0x1ebca7={};_0x1ebca7[_0x2ba1c2[_0x866b('0x1f')]]={'$like':'%'+_0x28f6bf[_0x866b('0x27')][_0x866b('0x31')]+'%'};return _0x1ebca7;}})});}_0xae3a29=_['merge']({},_0xae3a29,_0x28f6bf[_0x866b('0x34')]);var _0x557404={'where':_0xae3a29[_0x866b('0x32')]};return db[_0x866b('0x35')][_0x866b('0x18')](_0x557404)[_0x866b('0x1d')](function(_0x34b7d1){_0x4812ae[_0x866b('0x18')]=_0x34b7d1;if(_0x28f6bf[_0x866b('0x27')][_0x866b('0x36')]){_0xae3a29[_0x866b('0x37')]=[{'all':!![]}];}return db[_0x866b('0x35')]['findAll'](_0xae3a29);})[_0x866b('0x1d')](function(_0x129925){_0x4812ae['rows']=_0x129925;return _0x4812ae;})[_0x866b('0x1d')](respondWithFilteredResult(_0x5ed7a0,_0xae3a29))[_0x866b('0x38')](handleError(_0x5ed7a0,null));};exports[_0x866b('0x39')]=function(_0x58a31b,_0x4f52de){var _0x17ca48={'raw':!![],'where':{'id':_0x58a31b[_0x866b('0x3a')]['id']}},_0xd4b95d={};_0xd4b95d['model']=_[_0x866b('0x28')](db[_0x866b('0x35')][_0x866b('0x3b')]);_0xd4b95d[_0x866b('0x27')]=_[_0x866b('0x28')](_0x58a31b['query']);_0xd4b95d['filters']=_[_0x866b('0x3c')](_0xd4b95d[_0x866b('0x26')],_0xd4b95d[_0x866b('0x27')]);_0x17ca48[_0x866b('0x2b')]=_[_0x866b('0x3c')](_0xd4b95d[_0x866b('0x26')],qs[_0x866b('0x2a')](_0x58a31b['query']['fields']));_0x17ca48[_0x866b('0x2b')]=_0x17ca48[_0x866b('0x2b')][_0x866b('0x2c')]?_0x17ca48[_0x866b('0x2b')]:_0xd4b95d['model'];if(_0x58a31b[_0x866b('0x27')][_0x866b('0x36')]){_0x17ca48[_0x866b('0x37')]=[{'all':!![]}];}_0x17ca48=_[_0x866b('0x33')]({},_0x17ca48,_0x58a31b[_0x866b('0x34')]);return db['OpenchannelQueueReport']['find'](_0x17ca48)[_0x866b('0x1d')](handleEntityNotFound(_0x4f52de,null))[_0x866b('0x1d')](respondWithResult(_0x4f52de,null))[_0x866b('0x38')](handleError(_0x4f52de,null));};exports[_0x866b('0x3d')]=function(_0x497e2f,_0x981556){return db[_0x866b('0x35')][_0x866b('0x3d')](_0x497e2f[_0x866b('0x3e')],{})[_0x866b('0x1d')](respondWithResult(_0x981556,0xc9))[_0x866b('0x38')](handleError(_0x981556,null));};exports[_0x866b('0x1c')]=function(_0x16e72d,_0x338e18){if(_0x16e72d[_0x866b('0x3e')]['id']){delete _0x16e72d[_0x866b('0x3e')]['id'];}return db[_0x866b('0x35')][_0x866b('0x3f')]({'where':{'id':_0x16e72d['params']['id']}})[_0x866b('0x1d')](handleEntityNotFound(_0x338e18,null))[_0x866b('0x1d')](saveUpdates(_0x16e72d['body'],null))[_0x866b('0x1d')](respondWithResult(_0x338e18,null))[_0x866b('0x38')](handleError(_0x338e18,null));};exports[_0x866b('0x40')]=function(_0x10b0fd,_0x84eb5){return db[_0x866b('0x35')]['find']({'where':{'id':_0x10b0fd[_0x866b('0x3a')]['id']}})['then'](handleEntityNotFound(_0x84eb5,null))[_0x866b('0x1d')](removeEntity(_0x84eb5,null))[_0x866b('0x38')](handleError(_0x84eb5,null));};exports[_0x866b('0x41')]=function(_0x5bea61,_0x557b01){return db[_0x866b('0x35')][_0x866b('0x41')]()[_0x866b('0x1d')](respondWithResult(_0x557b01,null))[_0x866b('0x38')](handleError(_0x557b01,null));}; \ No newline at end of file +var _0x302e=['index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','OpenchannelQueueReport','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','json','count','offset','limit','status','Content-Range','apply','save','then','destroy','error','stack','name'];(function(_0x900170,_0x58ac4c){var _0x5de8a1=function(_0x3b0b31){while(--_0x3b0b31){_0x900170['push'](_0x900170['shift']());}};_0x5de8a1(++_0x58ac4c);}(_0x302e,0x1eb));var _0xe302=function(_0x20ba54,_0x39c971){_0x20ba54=_0x20ba54-0x0;var _0x3602c7=_0x302e[_0x20ba54];return _0x3602c7;};'use strict';var pdf=require(_0xe302('0x0'));var emlformat=require(_0xe302('0x1'));var rimraf=require(_0xe302('0x2'));var zipdir=require(_0xe302('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe302('0x4'));var moment=require(_0xe302('0x5'));var BPromise=require(_0xe302('0x6'));var Mustache=require('mustache');var util=require(_0xe302('0x7'));var path=require(_0xe302('0x8'));var sox=require('sox');var csv=require(_0xe302('0x9'));var ejs=require(_0xe302('0xa'));var fs=require('fs');var _=require(_0xe302('0xb'));var squel=require(_0xe302('0xc'));var crypto=require(_0xe302('0xd'));var jsforce=require(_0xe302('0xe'));var deskjs=require(_0xe302('0xf'));var toCsv=require(_0xe302('0x9'));var querystring=require(_0xe302('0x10'));var Papa=require(_0xe302('0x11'));var Redis=require(_0xe302('0x12'));var authService=require(_0xe302('0x13'));var qs=require(_0xe302('0x14'));var as=require(_0xe302('0x15'));var hardwareService=require(_0xe302('0x16'));var logger=require(_0xe302('0x17'))('api');var utils=require(_0xe302('0x18'));var config=require('../../config/environment');var db=require(_0xe302('0x19'))['db'];function respondWithStatusCode(_0x8c1591,_0x56a8bf){_0x56a8bf=_0x56a8bf||0xcc;return function(_0xd9a2fd){if(_0xd9a2fd){return _0x8c1591[_0xe302('0x1a')](_0x56a8bf);}return _0x8c1591['status'](_0x56a8bf)[_0xe302('0x1b')]();};}function respondWithResult(_0x285263,_0x5171a5){_0x5171a5=_0x5171a5||0xc8;return function(_0x11b7fc){if(_0x11b7fc){return _0x285263['status'](_0x5171a5)[_0xe302('0x1c')](_0x11b7fc);}};}function respondWithFilteredResult(_0x3b333a,_0x8acfc3){return function(_0xc1e0b2){if(_0xc1e0b2){var _0x5c8cda=_0xc1e0b2[_0xe302('0x1d')],_0x49bd55=_0x8acfc3['offset'],_0xae5d79=_0x8acfc3[_0xe302('0x1e')]+_0x8acfc3[_0xe302('0x1f')],_0x13c4ad;if(_0xae5d79>=_0x5c8cda){_0xae5d79=_0x5c8cda;_0x13c4ad=0xc8;}else{_0x13c4ad=0xce;}_0x3b333a[_0xe302('0x20')](_0x13c4ad);return _0x3b333a['set'](_0xe302('0x21'),_0x49bd55+'-'+_0xae5d79+'/'+_0x5c8cda)[_0xe302('0x1c')](_0xc1e0b2);}return null;};}function patchUpdates(_0x54c6ec){return function(_0x5e0971){try{jsonpatch[_0xe302('0x22')](_0x5e0971,_0x54c6ec,!![]);}catch(_0x281649){return BPromise['reject'](_0x281649);}return _0x5e0971[_0xe302('0x23')]();};}function saveUpdates(_0x5bc041,_0x560964){return function(_0x46a34f){if(_0x46a34f){return _0x46a34f['update'](_0x5bc041)[_0xe302('0x24')](function(_0x13b6ed){return _0x13b6ed;});}return null;};}function removeEntity(_0x924111,_0x390678){return function(_0x52a692){if(_0x52a692){return _0x52a692[_0xe302('0x25')]()['then'](function(){_0x924111[_0xe302('0x20')](0xcc)[_0xe302('0x1b')]();});}};}function handleEntityNotFound(_0x523c46,_0xb272b2){return function(_0x48fea5){if(!_0x48fea5){_0x523c46[_0xe302('0x1a')](0x194);}return _0x48fea5;};}function handleError(_0x532e94,_0x30b49e){_0x30b49e=_0x30b49e||0x1f4;return function(_0x42b6ff){logger[_0xe302('0x26')](_0x42b6ff[_0xe302('0x27')]);if(_0x42b6ff[_0xe302('0x28')]){delete _0x42b6ff[_0xe302('0x28')];}_0x532e94['status'](_0x30b49e)['send'](_0x42b6ff);};}exports[_0xe302('0x29')]=function(_0x377097,_0x4ab7b9){var _0x250134={},_0x5b0d56={},_0x22e47d={'count':0x0,'rows':[]};var _0x59d0cb=_['map'](db['OpenchannelQueueReport'][_0xe302('0x2a')],function(_0x4f82d4){return{'name':_0x4f82d4[_0xe302('0x2b')],'type':_0x4f82d4['type'][_0xe302('0x2c')]};});_0x5b0d56[_0xe302('0x2d')]=_[_0xe302('0x2e')](_0x59d0cb,_0xe302('0x28'));_0x5b0d56[_0xe302('0x2f')]=_[_0xe302('0x30')](_0x377097[_0xe302('0x2f')]);_0x5b0d56[_0xe302('0x31')]=_[_0xe302('0x32')](_0x5b0d56[_0xe302('0x2d')],_0x5b0d56[_0xe302('0x2f')]);_0x250134[_0xe302('0x33')]=_['intersection'](_0x5b0d56[_0xe302('0x2d')],qs[_0xe302('0x34')](_0x377097[_0xe302('0x2f')][_0xe302('0x34')]));_0x250134['attributes']=_0x250134['attributes']['length']?_0x250134['attributes']:_0x5b0d56[_0xe302('0x2d')];if(!_0x377097['query'][_0xe302('0x35')](_0xe302('0x36'))){_0x250134[_0xe302('0x1f')]=qs[_0xe302('0x1f')](_0x377097[_0xe302('0x2f')][_0xe302('0x1f')]);_0x250134[_0xe302('0x1e')]=qs['offset'](_0x377097[_0xe302('0x2f')]['offset']);}_0x250134['order']=qs[_0xe302('0x37')](_0x377097[_0xe302('0x2f')]['sort']);_0x250134['where']=qs[_0xe302('0x31')](_[_0xe302('0x38')](_0x377097[_0xe302('0x2f')],_0x5b0d56['filters']),_0x59d0cb);if(_0x377097[_0xe302('0x2f')][_0xe302('0x39')]){_0x250134['where']=_[_0xe302('0x3a')](_0x250134[_0xe302('0x3b')],{'$or':_[_0xe302('0x2e')](_0x59d0cb,function(_0x2ef02c){if(_0x2ef02c['type']!==_0xe302('0x3c')){var _0x134be7={};_0x134be7[_0x2ef02c[_0xe302('0x28')]]={'$like':'%'+_0x377097[_0xe302('0x2f')][_0xe302('0x39')]+'%'};return _0x134be7;}})});}_0x250134=_[_0xe302('0x3a')]({},_0x250134,_0x377097[_0xe302('0x3d')]);var _0x138457={'where':_0x250134[_0xe302('0x3b')]};return db[_0xe302('0x3e')][_0xe302('0x1d')](_0x138457)[_0xe302('0x24')](function(_0x32c009){_0x22e47d[_0xe302('0x1d')]=_0x32c009;if(_0x377097[_0xe302('0x2f')][_0xe302('0x3f')]){_0x250134[_0xe302('0x40')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xe302('0x41')](_0x250134);})[_0xe302('0x24')](function(_0x53d14c){_0x22e47d[_0xe302('0x42')]=_0x53d14c;return _0x22e47d;})[_0xe302('0x24')](respondWithFilteredResult(_0x4ab7b9,_0x250134))[_0xe302('0x43')](handleError(_0x4ab7b9,null));};exports[_0xe302('0x44')]=function(_0x456b30,_0x1d83bf){var _0x1e9582={'raw':!![],'where':{'id':_0x456b30[_0xe302('0x45')]['id']}},_0x4146c3={};_0x4146c3[_0xe302('0x2d')]=_[_0xe302('0x30')](db['OpenchannelQueueReport'][_0xe302('0x2a')]);_0x4146c3[_0xe302('0x2f')]=_['keys'](_0x456b30[_0xe302('0x2f')]);_0x4146c3['filters']=_['intersection'](_0x4146c3['model'],_0x4146c3[_0xe302('0x2f')]);_0x1e9582[_0xe302('0x33')]=_['intersection'](_0x4146c3['model'],qs[_0xe302('0x34')](_0x456b30[_0xe302('0x2f')][_0xe302('0x34')]));_0x1e9582[_0xe302('0x33')]=_0x1e9582['attributes'][_0xe302('0x46')]?_0x1e9582[_0xe302('0x33')]:_0x4146c3[_0xe302('0x2d')];if(_0x456b30['query'][_0xe302('0x3f')]){_0x1e9582[_0xe302('0x40')]=[{'all':!![]}];}_0x1e9582=_[_0xe302('0x3a')]({},_0x1e9582,_0x456b30[_0xe302('0x3d')]);return db[_0xe302('0x3e')][_0xe302('0x47')](_0x1e9582)['then'](handleEntityNotFound(_0x1d83bf,null))[_0xe302('0x24')](respondWithResult(_0x1d83bf,null))[_0xe302('0x43')](handleError(_0x1d83bf,null));};exports[_0xe302('0x48')]=function(_0x1cbfc9,_0x4ed8ed){return db[_0xe302('0x3e')][_0xe302('0x48')](_0x1cbfc9[_0xe302('0x49')],{})['then'](respondWithResult(_0x4ed8ed,0xc9))[_0xe302('0x43')](handleError(_0x4ed8ed,null));};exports[_0xe302('0x4a')]=function(_0x429fb0,_0x19631c){if(_0x429fb0[_0xe302('0x49')]['id']){delete _0x429fb0['body']['id'];}return db[_0xe302('0x3e')]['find']({'where':{'id':_0x429fb0[_0xe302('0x45')]['id']}})[_0xe302('0x24')](handleEntityNotFound(_0x19631c,null))[_0xe302('0x24')](saveUpdates(_0x429fb0[_0xe302('0x49')],null))['then'](respondWithResult(_0x19631c,null))[_0xe302('0x43')](handleError(_0x19631c,null));};exports[_0xe302('0x25')]=function(_0xc0b4e4,_0x1cd22f){return db[_0xe302('0x3e')]['find']({'where':{'id':_0xc0b4e4[_0xe302('0x45')]['id']}})[_0xe302('0x24')](handleEntityNotFound(_0x1cd22f,null))[_0xe302('0x24')](removeEntity(_0x1cd22f,null))[_0xe302('0x43')](handleError(_0x1cd22f,null));};exports[_0xe302('0x4b')]=function(_0x1ebf1e,_0x4d38b4){return db[_0xe302('0x3e')][_0xe302('0x4b')]()[_0xe302('0x24')](respondWithResult(_0x4d38b4,null))['catch'](handleError(_0x4d38b4,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index a90e77e..27088e3 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 _0x1735=['report_openchannel_queue','uniqueid','util','moment','bluebird','request-promise','path','rimraf','./openchannelQueueReport.attributes','exports','define'];(function(_0x415869,_0x9f502e){var _0x3454e9=function(_0x44f9e6){while(--_0x44f9e6){_0x415869['push'](_0x415869['shift']());}};_0x3454e9(++_0x9f502e);}(_0x1735,0x136));var _0x5173=function(_0x2669c8,_0x401161){_0x2669c8=_0x2669c8-0x0;var _0x45a28b=_0x1735[_0x2669c8];return _0x45a28b;};'use strict';var _=require('lodash');var util=require(_0x5173('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5173('0x1'));var BPromise=require(_0x5173('0x2'));var rp=require(_0x5173('0x3'));var fs=require('fs');var path=require(_0x5173('0x4'));var rimraf=require(_0x5173('0x5'));var config=require('../../config/environment');var attributes=require(_0x5173('0x6'));module[_0x5173('0x7')]=function(_0x125736,_0x230d7c){return _0x125736[_0x5173('0x8')]('OpenchannelQueueReport',attributes,{'tableName':_0x5173('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5173('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4494=['request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','../../config/logger','bluebird'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x4494,0x8a));var _0x4449=function(_0xdb3ebf,_0x4f289c){_0xdb3ebf=_0xdb3ebf-0x0;var _0x19d87b=_0x4494[_0xdb3ebf];return _0x19d87b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4449('0x0'))('api');var moment=require('moment');var BPromise=require(_0x4449('0x1'));var rp=require(_0x4449('0x2'));var fs=require('fs');var path=require(_0x4449('0x3'));var rimraf=require('rimraf');var config=require(_0x4449('0x4'));var attributes=require(_0x4449('0x5'));module[_0x4449('0x6')]=function(_0x47f90c,_0x289afc){return _0x47f90c[_0x4449('0x7')](_0x4449('0x8'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0x4449('0x9'),'fields':[_0x4449('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index bcda37f..1bd76fa 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 _0x8921=['body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create'];(function(_0x129b6b,_0x4faf08){var _0x24d8df=function(_0x6e758b){while(--_0x6e758b){_0x129b6b['push'](_0x129b6b['shift']());}};_0x24d8df(++_0x4faf08);}(_0x8921,0x9a));var _0x1892=function(_0x3a53a1,_0x52a91d){_0x3a53a1=_0x3a53a1-0x0;var _0x3f714e=_0x8921[_0x3a53a1];return _0x3f714e;};'use strict';var _=require(_0x1892('0x0'));var util=require('util');var moment=require(_0x1892('0x1'));var BPromise=require(_0x1892('0x2'));var rs=require(_0x1892('0x3'));var fs=require('fs');var Redis=require(_0x1892('0x4'));var db=require(_0x1892('0x5'))['db'];var utils=require(_0x1892('0x6'));var logger=require(_0x1892('0x7'))(_0x1892('0x8'));var config=require(_0x1892('0x9'));var jayson=require(_0x1892('0xa'));var client=jayson[_0x1892('0xb')][_0x1892('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x504741,_0xfe2155,_0x6a2604){return new BPromise(function(_0x2db820,_0x18d62f){return client[_0x1892('0xd')](_0x504741,_0x6a2604)[_0x1892('0xe')](function(_0x4d15a4){logger[_0x1892('0xf')](_0x1892('0x10'),_0xfe2155,_0x1892('0x11'));logger[_0x1892('0x12')](_0x1892('0x13'),_0xfe2155,_0x1892('0x11'),JSON[_0x1892('0x14')](_0x4d15a4));if(_0x4d15a4[_0x1892('0x15')]){if(_0x4d15a4[_0x1892('0x15')][_0x1892('0x16')]===0x1f4){logger[_0x1892('0x15')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xfe2155,_0x4d15a4[_0x1892('0x15')][_0x1892('0x17')]);return _0x18d62f(_0x4d15a4[_0x1892('0x15')]['message']);}logger[_0x1892('0x15')](_0x1892('0x10'),_0xfe2155,_0x4d15a4[_0x1892('0x15')][_0x1892('0x17')]);return _0x2db820(_0x4d15a4['error']['message']);}else{logger[_0x1892('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xfe2155,_0x1892('0x11'));_0x2db820(_0x4d15a4['result'][_0x1892('0x17')]);}})[_0x1892('0x18')](function(_0x237451){logger[_0x1892('0x15')](_0x1892('0x10'),_0xfe2155,_0x237451);_0x18d62f(_0x237451);});});}exports['CreateOpenchannelQueueReport']=function(_0x5d28fc){var _0x349b58=this;return new Promise(function(_0x49937d,_0x437502){return db['OpenchannelQueueReport'][_0x1892('0x19')](_0x5d28fc[_0x1892('0x1a')],{'raw':_0x5d28fc['options']?_0x5d28fc[_0x1892('0x1b')][_0x1892('0x1c')]===undefined?!![]:![]:!![]})[_0x1892('0xe')](function(_0xf4d237){logger['info']('CreateOpenchannelQueueReport',_0x5d28fc);logger['debug'](_0x1892('0x1d'),_0x5d28fc,JSON[_0x1892('0x14')](_0xf4d237));_0x49937d(_0xf4d237);})['catch'](function(_0xa9a3e0){logger[_0x1892('0x15')](_0x1892('0x1d'),_0xa9a3e0[_0x1892('0x17')],_0x5d28fc);_0x437502(_0x349b58['error'](0x1f4,_0xa9a3e0[_0x1892('0x17')]));});});};exports[_0x1892('0x1e')]=function(_0x2fc141){var _0x23114a=this;return new Promise(function(_0x573e5e,_0x8e9dd4){return db[_0x1892('0x1f')][_0x1892('0x20')](_0x2fc141[_0x1892('0x1a')],{'raw':_0x2fc141[_0x1892('0x1b')]?_0x2fc141[_0x1892('0x1b')][_0x1892('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fc141[_0x1892('0x1b')]?_0x2fc141[_0x1892('0x1b')][_0x1892('0x21')]||null:null,'attributes':_0x2fc141[_0x1892('0x1b')]?_0x2fc141['options'][_0x1892('0x22')]||null:null,'limit':_0x2fc141[_0x1892('0x1b')]?_0x2fc141['options'][_0x1892('0x23')]||null:null})['then'](function(_0x23098b){logger[_0x1892('0xf')](_0x1892('0x1e'),_0x2fc141);logger[_0x1892('0x12')](_0x1892('0x1e'),_0x2fc141,JSON['stringify'](_0x23098b));_0x573e5e(_0x23098b);})[_0x1892('0x18')](function(_0x160ba0){logger[_0x1892('0x15')](_0x1892('0x1e'),_0x160ba0[_0x1892('0x17')],_0x2fc141);_0x8e9dd4(_0x23114a[_0x1892('0x15')](0x1f4,_0x160ba0[_0x1892('0x17')]));});});}; \ No newline at end of file +var _0xc7da=['update','body','where','limit','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','stringify','UpdateOpenchannelQueueReport'];(function(_0x3944b3,_0xf05375){var _0xbf7a53=function(_0x1c5aa2){while(--_0x1c5aa2){_0x3944b3['push'](_0x3944b3['shift']());}};_0xbf7a53(++_0xf05375);}(_0xc7da,0xf2));var _0xac7d=function(_0x5eada6,_0x55308c){_0x5eada6=_0x5eada6-0x0;var _0x581510=_0xc7da[_0x5eada6];return _0x581510;};'use strict';var _=require(_0xac7d('0x0'));var util=require(_0xac7d('0x1'));var moment=require(_0xac7d('0x2'));var BPromise=require('bluebird');var rs=require(_0xac7d('0x3'));var fs=require('fs');var Redis=require(_0xac7d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xac7d('0x5'));var logger=require(_0xac7d('0x6'))('rpc');var config=require(_0xac7d('0x7'));var jayson=require(_0xac7d('0x8'));var client=jayson[_0xac7d('0x9')][_0xac7d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x268265,_0x153ce5,_0x48ca59){return new BPromise(function(_0x44eb2b,_0x457e2d){return client[_0xac7d('0xb')](_0x268265,_0x48ca59)[_0xac7d('0xc')](function(_0x217811){logger[_0xac7d('0xd')](_0xac7d('0xe'),_0x153ce5,'request\x20sent');logger[_0xac7d('0xf')](_0xac7d('0x10'),_0x153ce5,_0xac7d('0x11'),JSON['stringify'](_0x217811));if(_0x217811[_0xac7d('0x12')]){if(_0x217811[_0xac7d('0x12')][_0xac7d('0x13')]===0x1f4){logger[_0xac7d('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x153ce5,_0x217811[_0xac7d('0x12')][_0xac7d('0x14')]);return _0x457e2d(_0x217811[_0xac7d('0x12')][_0xac7d('0x14')]);}logger[_0xac7d('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x153ce5,_0x217811[_0xac7d('0x12')]['message']);return _0x44eb2b(_0x217811[_0xac7d('0x12')][_0xac7d('0x14')]);}else{logger[_0xac7d('0xd')](_0xac7d('0xe'),_0x153ce5,'request\x20sent');_0x44eb2b(_0x217811[_0xac7d('0x15')][_0xac7d('0x14')]);}})[_0xac7d('0x16')](function(_0x12813a){logger[_0xac7d('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x153ce5,_0x12813a);_0x457e2d(_0x12813a);});});}exports[_0xac7d('0x17')]=function(_0x3cb12d){var _0x563634=this;return new Promise(function(_0x2e4790,_0x2d2494){return db[_0xac7d('0x18')][_0xac7d('0x19')](_0x3cb12d['body'],{'raw':_0x3cb12d[_0xac7d('0x1a')]?_0x3cb12d[_0xac7d('0x1a')][_0xac7d('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0xd42c40){logger['info'](_0xac7d('0x17'),_0x3cb12d);logger[_0xac7d('0xf')](_0xac7d('0x17'),_0x3cb12d,JSON[_0xac7d('0x1c')](_0xd42c40));_0x2e4790(_0xd42c40);})[_0xac7d('0x16')](function(_0x365269){logger['error']('CreateOpenchannelQueueReport',_0x365269[_0xac7d('0x14')],_0x3cb12d);_0x2d2494(_0x563634[_0xac7d('0x12')](0x1f4,_0x365269['message']));});});};exports[_0xac7d('0x1d')]=function(_0x3966dd){var _0x2a5774=this;return new Promise(function(_0x1c1f88,_0x43aa8e){return db[_0xac7d('0x18')][_0xac7d('0x1e')](_0x3966dd[_0xac7d('0x1f')],{'raw':_0x3966dd[_0xac7d('0x1a')]?_0x3966dd[_0xac7d('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3966dd[_0xac7d('0x1a')]?_0x3966dd[_0xac7d('0x1a')][_0xac7d('0x20')]||null:null,'attributes':_0x3966dd[_0xac7d('0x1a')]?_0x3966dd['options']['attributes']||null:null,'limit':_0x3966dd['options']?_0x3966dd[_0xac7d('0x1a')][_0xac7d('0x21')]||null:null})[_0xac7d('0xc')](function(_0x5bd39b){logger[_0xac7d('0xd')]('UpdateOpenchannelQueueReport',_0x3966dd);logger['debug']('UpdateOpenchannelQueueReport',_0x3966dd,JSON['stringify'](_0x5bd39b));_0x1c1f88(_0x5bd39b);})['catch'](function(_0x104186){logger[_0xac7d('0x12')](_0xac7d('0x1d'),_0x104186[_0xac7d('0x14')],_0x3966dd);_0x43aa8e(_0x2a5774[_0xac7d('0x12')](0x1f4,_0x104186['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 005317f..3994fa2 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(_0xd1b4d7,_0x28b2c1){var _0x3002ec=function(_0x3d95ce){while(--_0x3d95ce){_0xd1b4d7['push'](_0xd1b4d7['shift']());}};_0x3002ec(++_0x28b2c1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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(_0xb24fad,_0xd58756){var _0x173226=function(_0x33b4d6){while(--_0x33b4d6){_0xb24fad['push'](_0xb24fad['shift']());}};_0x173226(++_0xd58756);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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 ca28ad4..f3a0391 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 _0x3fca=['STRING','ENUM','account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x4ee881,_0x10ddc8){var _0x305f48=function(_0x5303d5){while(--_0x5303d5){_0x4ee881['push'](_0x4ee881['shift']());}};_0x305f48(++_0x10ddc8);}(_0x3fca,0x192));var _0xa3fc=function(_0xe598a7,_0x109eb9){_0xe598a7=_0xe598a7-0x0;var _0x5283f8=_0x3fca[_0xe598a7];return _0x5283f8;};'use strict';var moment=require(_0xa3fc('0x0'));var Sequelize=require(_0xa3fc('0x1'));module[_0xa3fc('0x2')]={'uniqueid':{'type':Sequelize[_0xa3fc('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xa3fc('0x4')](_0xa3fc('0x5'),'agent',_0xa3fc('0x6')),'allowNull':![],'defaultValue':_0xa3fc('0x6')},'transferredAt':{'type':Sequelize[_0xa3fc('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xa3fc('0x8')]}}; \ No newline at end of file +var _0x758c=['ENUM','agent','queue','DATE','moment','sequelize','exports','STRING'];(function(_0x19b293,_0x1656d6){var _0x2a46b6=function(_0x73691c){while(--_0x73691c){_0x19b293['push'](_0x19b293['shift']());}};_0x2a46b6(++_0x1656d6);}(_0x758c,0x12c));var _0xc758=function(_0x386626,_0x24037e){_0x386626=_0x386626-0x0;var _0x3fd959=_0x758c[_0x386626];return _0x3fd959;};'use strict';var moment=require(_0xc758('0x0'));var Sequelize=require(_0xc758('0x1'));module[_0xc758('0x2')]={'uniqueid':{'type':Sequelize[_0xc758('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc758('0x4')]('account',_0xc758('0x5'),_0xc758('0x6')),'allowNull':![],'defaultValue':_0xc758('0x6')},'transferredAt':{'type':Sequelize[_0xc758('0x7')],'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 17ca07d..6f7cff8 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 _0x7f70=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','update','then','destroy','stack','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','name','options','includeAll','include','findAll','rows','keys','find','create','body','catch','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','jsforce','desk.js','papaparse','ioredis'];(function(_0x301426,_0x38c9a1){var _0x4e1cb0=function(_0xbbc896){while(--_0xbbc896){_0x301426['push'](_0x301426['shift']());}};_0x4e1cb0(++_0x38c9a1);}(_0x7f70,0x1a0));var _0x07f7=function(_0xa9718f,_0x1d6670){_0xa9718f=_0xa9718f-0x0;var _0x161003=_0x7f70[_0xa9718f];return _0x161003;};'use strict';var pdf=require(_0x07f7('0x0'));var emlformat=require(_0x07f7('0x1'));var rimraf=require(_0x07f7('0x2'));var zipdir=require(_0x07f7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x07f7('0x4'));var moment=require(_0x07f7('0x5'));var BPromise=require(_0x07f7('0x6'));var Mustache=require('mustache');var util=require(_0x07f7('0x7'));var path=require(_0x07f7('0x8'));var sox=require(_0x07f7('0x9'));var csv=require(_0x07f7('0xa'));var ejs=require(_0x07f7('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x07f7('0xc'));var deskjs=require(_0x07f7('0xd'));var toCsv=require(_0x07f7('0xa'));var querystring=require('querystring');var Papa=require(_0x07f7('0xe'));var Redis=require(_0x07f7('0xf'));var authService=require(_0x07f7('0x10'));var qs=require(_0x07f7('0x11'));var as=require(_0x07f7('0x12'));var hardwareService=require(_0x07f7('0x13'));var logger=require(_0x07f7('0x14'))(_0x07f7('0x15'));var utils=require('../../config/utils');var config=require(_0x07f7('0x16'));var db=require(_0x07f7('0x17'))['db'];function respondWithStatusCode(_0xe663a5,_0x575594){_0x575594=_0x575594||0xcc;return function(_0x51a56f){if(_0x51a56f){return _0xe663a5[_0x07f7('0x18')](_0x575594);}return _0xe663a5['status'](_0x575594)[_0x07f7('0x19')]();};}function respondWithResult(_0x1772d2,_0x10cb40){_0x10cb40=_0x10cb40||0xc8;return function(_0x4b006c){if(_0x4b006c){return _0x1772d2[_0x07f7('0x1a')](_0x10cb40)[_0x07f7('0x1b')](_0x4b006c);}};}function respondWithFilteredResult(_0x36400a,_0x5ad2f1){return function(_0x4b380f){if(_0x4b380f){var _0x20d2c2=_0x4b380f[_0x07f7('0x1c')],_0x4ee04f=_0x5ad2f1[_0x07f7('0x1d')],_0x46a6f4=_0x5ad2f1['offset']+_0x5ad2f1[_0x07f7('0x1e')],_0x6da707;if(_0x46a6f4>=_0x20d2c2){_0x46a6f4=_0x20d2c2;_0x6da707=0xc8;}else{_0x6da707=0xce;}_0x36400a[_0x07f7('0x1a')](_0x6da707);return _0x36400a[_0x07f7('0x1f')]('Content-Range',_0x4ee04f+'-'+_0x46a6f4+'/'+_0x20d2c2)[_0x07f7('0x1b')](_0x4b380f);}return null;};}function patchUpdates(_0x11ae82){return function(_0x474e62){try{jsonpatch[_0x07f7('0x20')](_0x474e62,_0x11ae82,!![]);}catch(_0x15b990){return BPromise[_0x07f7('0x21')](_0x15b990);}return _0x474e62['save']();};}function saveUpdates(_0x23c6b8,_0xc481c6){return function(_0x817fd3){if(_0x817fd3){return _0x817fd3[_0x07f7('0x22')](_0x23c6b8)[_0x07f7('0x23')](function(_0x31f9df){return _0x31f9df;});}return null;};}function removeEntity(_0x22dc96,_0x16e2e4){return function(_0x5daa99){if(_0x5daa99){return _0x5daa99[_0x07f7('0x24')]()[_0x07f7('0x23')](function(){_0x22dc96['status'](0xcc)[_0x07f7('0x19')]();});}};}function handleEntityNotFound(_0x5a98db,_0x118508){return function(_0x53c7c5){if(!_0x53c7c5){_0x5a98db[_0x07f7('0x18')](0x194);}return _0x53c7c5;};}function handleError(_0x59bead,_0x2857e0){_0x2857e0=_0x2857e0||0x1f4;return function(_0x53a57e){logger['error'](_0x53a57e[_0x07f7('0x25')]);if(_0x53a57e['name']){delete _0x53a57e['name'];}_0x59bead[_0x07f7('0x1a')](_0x2857e0)[_0x07f7('0x26')](_0x53a57e);};}exports[_0x07f7('0x27')]=function(_0x392a50,_0x1f7f58){var _0x4e3192={},_0x2971c3={},_0x4c5123={'count':0x0,'rows':[]};var _0x1aca1a=_[_0x07f7('0x28')](db[_0x07f7('0x29')][_0x07f7('0x2a')],function(_0x1c2669){return{'name':_0x1c2669[_0x07f7('0x2b')],'type':_0x1c2669['type'][_0x07f7('0x2c')]};});_0x2971c3[_0x07f7('0x2d')]=_[_0x07f7('0x28')](_0x1aca1a,'name');_0x2971c3['query']=_['keys'](_0x392a50[_0x07f7('0x2e')]);_0x2971c3[_0x07f7('0x2f')]=_[_0x07f7('0x30')](_0x2971c3[_0x07f7('0x2d')],_0x2971c3[_0x07f7('0x2e')]);_0x4e3192['attributes']=_[_0x07f7('0x30')](_0x2971c3[_0x07f7('0x2d')],qs[_0x07f7('0x31')](_0x392a50[_0x07f7('0x2e')]['fields']));_0x4e3192[_0x07f7('0x32')]=_0x4e3192[_0x07f7('0x32')][_0x07f7('0x33')]?_0x4e3192['attributes']:_0x2971c3['model'];if(!_0x392a50['query']['hasOwnProperty'](_0x07f7('0x34'))){_0x4e3192[_0x07f7('0x1e')]=qs['limit'](_0x392a50['query'][_0x07f7('0x1e')]);_0x4e3192[_0x07f7('0x1d')]=qs['offset'](_0x392a50['query'][_0x07f7('0x1d')]);}_0x4e3192[_0x07f7('0x35')]=qs['sort'](_0x392a50[_0x07f7('0x2e')][_0x07f7('0x36')]);_0x4e3192[_0x07f7('0x37')]=qs[_0x07f7('0x2f')](_[_0x07f7('0x38')](_0x392a50['query'],_0x2971c3[_0x07f7('0x2f')]),_0x1aca1a);if(_0x392a50['query'][_0x07f7('0x39')]){_0x4e3192[_0x07f7('0x37')]=_[_0x07f7('0x3a')](_0x4e3192[_0x07f7('0x37')],{'$or':_[_0x07f7('0x28')](_0x1aca1a,function(_0x7b23fd){if(_0x7b23fd['type']!=='VIRTUAL'){var _0x4bb16e={};_0x4bb16e[_0x7b23fd[_0x07f7('0x3b')]]={'$like':'%'+_0x392a50[_0x07f7('0x2e')][_0x07f7('0x39')]+'%'};return _0x4bb16e;}})});}_0x4e3192=_[_0x07f7('0x3a')]({},_0x4e3192,_0x392a50[_0x07f7('0x3c')]);var _0x47fae5={'where':_0x4e3192[_0x07f7('0x37')]};return db[_0x07f7('0x29')][_0x07f7('0x1c')](_0x47fae5)[_0x07f7('0x23')](function(_0x389592){_0x4c5123[_0x07f7('0x1c')]=_0x389592;if(_0x392a50[_0x07f7('0x2e')][_0x07f7('0x3d')]){_0x4e3192[_0x07f7('0x3e')]=[{'all':!![]}];}return db[_0x07f7('0x29')][_0x07f7('0x3f')](_0x4e3192);})[_0x07f7('0x23')](function(_0x5f0864){_0x4c5123[_0x07f7('0x40')]=_0x5f0864;return _0x4c5123;})[_0x07f7('0x23')](respondWithFilteredResult(_0x1f7f58,_0x4e3192))['catch'](handleError(_0x1f7f58,null));};exports['show']=function(_0x436c55,_0x47a6bc){var _0x1eba02={'raw':!![],'where':{'id':_0x436c55['params']['id']}},_0x56ab30={};_0x56ab30[_0x07f7('0x2d')]=_['keys'](db[_0x07f7('0x29')]['rawAttributes']);_0x56ab30[_0x07f7('0x2e')]=_[_0x07f7('0x41')](_0x436c55['query']);_0x56ab30[_0x07f7('0x2f')]=_[_0x07f7('0x30')](_0x56ab30['model'],_0x56ab30['query']);_0x1eba02[_0x07f7('0x32')]=_[_0x07f7('0x30')](_0x56ab30['model'],qs['fields'](_0x436c55[_0x07f7('0x2e')][_0x07f7('0x31')]));_0x1eba02[_0x07f7('0x32')]=_0x1eba02[_0x07f7('0x32')][_0x07f7('0x33')]?_0x1eba02['attributes']:_0x56ab30['model'];if(_0x436c55[_0x07f7('0x2e')][_0x07f7('0x3d')]){_0x1eba02[_0x07f7('0x3e')]=[{'all':!![]}];}_0x1eba02=_['merge']({},_0x1eba02,_0x436c55[_0x07f7('0x3c')]);return db[_0x07f7('0x29')][_0x07f7('0x42')](_0x1eba02)[_0x07f7('0x23')](handleEntityNotFound(_0x47a6bc,null))['then'](respondWithResult(_0x47a6bc,null))['catch'](handleError(_0x47a6bc,null));};exports[_0x07f7('0x43')]=function(_0x4ea492,_0x5d47f3){return db[_0x07f7('0x29')][_0x07f7('0x43')](_0x4ea492[_0x07f7('0x44')],{})[_0x07f7('0x23')](respondWithResult(_0x5d47f3,0xc9))[_0x07f7('0x45')](handleError(_0x5d47f3,null));};exports[_0x07f7('0x22')]=function(_0x4150a0,_0x9a0929){if(_0x4150a0[_0x07f7('0x44')]['id']){delete _0x4150a0[_0x07f7('0x44')]['id'];}return db[_0x07f7('0x29')]['find']({'where':{'id':_0x4150a0[_0x07f7('0x46')]['id']}})[_0x07f7('0x23')](handleEntityNotFound(_0x9a0929,null))[_0x07f7('0x23')](saveUpdates(_0x4150a0[_0x07f7('0x44')],null))[_0x07f7('0x23')](respondWithResult(_0x9a0929,null))[_0x07f7('0x45')](handleError(_0x9a0929,null));};exports['destroy']=function(_0xa83bc,_0x4f4d84){return db[_0x07f7('0x29')][_0x07f7('0x42')]({'where':{'id':_0xa83bc[_0x07f7('0x46')]['id']}})['then'](handleEntityNotFound(_0x4f4d84,null))[_0x07f7('0x23')](removeEntity(_0x4f4d84,null))[_0x07f7('0x45')](handleError(_0x4f4d84,null));};exports[_0x07f7('0x47')]=function(_0x1d4300,_0x183ebe){return db['OpenchannelTransferReport'][_0x07f7('0x47')]()['then'](respondWithResult(_0x183ebe,null))[_0x07f7('0x45')](handleError(_0x183ebe,null));}; \ No newline at end of file +var _0x1049=['find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','map','OpenchannelTransferReport','fieldName','key','query','keys','intersection','model','fields','attributes','length','nolimit','offset','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','includeAll','create','body','update'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1049,0x97));var _0x9104=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1049[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9104('0x0'));var rimraf=require(_0x9104('0x1'));var zipdir=require(_0x9104('0x2'));var jsonpatch=require(_0x9104('0x3'));var rp=require(_0x9104('0x4'));var moment=require(_0x9104('0x5'));var BPromise=require(_0x9104('0x6'));var Mustache=require(_0x9104('0x7'));var util=require(_0x9104('0x8'));var path=require(_0x9104('0x9'));var sox=require('sox');var csv=require(_0x9104('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9104('0xb'));var squel=require(_0x9104('0xc'));var crypto=require(_0x9104('0xd'));var jsforce=require(_0x9104('0xe'));var deskjs=require(_0x9104('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9104('0x10'));var Papa=require(_0x9104('0x11'));var Redis=require(_0x9104('0x12'));var authService=require(_0x9104('0x13'));var qs=require(_0x9104('0x14'));var as=require(_0x9104('0x15'));var hardwareService=require(_0x9104('0x16'));var logger=require('../../config/logger')(_0x9104('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x9104('0x18'))['db'];function respondWithStatusCode(_0x29e454,_0x2423be){_0x2423be=_0x2423be||0xcc;return function(_0x488e97){if(_0x488e97){return _0x29e454[_0x9104('0x19')](_0x2423be);}return _0x29e454[_0x9104('0x1a')](_0x2423be)[_0x9104('0x1b')]();};}function respondWithResult(_0x561d0b,_0x3fdebb){_0x3fdebb=_0x3fdebb||0xc8;return function(_0x320c96){if(_0x320c96){return _0x561d0b[_0x9104('0x1a')](_0x3fdebb)[_0x9104('0x1c')](_0x320c96);}};}function respondWithFilteredResult(_0x1b71a5,_0x18deee){return function(_0x3efea6){if(_0x3efea6){var _0x242a07=_0x3efea6['count'],_0x23c905=_0x18deee['offset'],_0x4c8c12=_0x18deee['offset']+_0x18deee[_0x9104('0x1d')],_0x8fb8fb;if(_0x4c8c12>=_0x242a07){_0x4c8c12=_0x242a07;_0x8fb8fb=0xc8;}else{_0x8fb8fb=0xce;}_0x1b71a5[_0x9104('0x1a')](_0x8fb8fb);return _0x1b71a5[_0x9104('0x1e')](_0x9104('0x1f'),_0x23c905+'-'+_0x4c8c12+'/'+_0x242a07)[_0x9104('0x1c')](_0x3efea6);}return null;};}function patchUpdates(_0x3f5d30){return function(_0x3b776a){try{jsonpatch[_0x9104('0x20')](_0x3b776a,_0x3f5d30,!![]);}catch(_0x2d2231){return BPromise[_0x9104('0x21')](_0x2d2231);}return _0x3b776a[_0x9104('0x22')]();};}function saveUpdates(_0x196b8d,_0x5d5186){return function(_0x498e40){if(_0x498e40){return _0x498e40['update'](_0x196b8d)[_0x9104('0x23')](function(_0x39c544){return _0x39c544;});}return null;};}function removeEntity(_0x2aa9b4,_0x3e16a6){return function(_0x1c9da1){if(_0x1c9da1){return _0x1c9da1[_0x9104('0x24')]()[_0x9104('0x23')](function(){_0x2aa9b4[_0x9104('0x1a')](0xcc)[_0x9104('0x1b')]();});}};}function handleEntityNotFound(_0xac5c38,_0x54467e){return function(_0x54f43e){if(!_0x54f43e){_0xac5c38['sendStatus'](0x194);}return _0x54f43e;};}function handleError(_0x1de511,_0x4c1f24){_0x4c1f24=_0x4c1f24||0x1f4;return function(_0x1c0650){logger['error'](_0x1c0650[_0x9104('0x25')]);if(_0x1c0650[_0x9104('0x26')]){delete _0x1c0650[_0x9104('0x26')];}_0x1de511[_0x9104('0x1a')](_0x4c1f24)[_0x9104('0x27')](_0x1c0650);};}exports['index']=function(_0x45d9d1,_0x29406f){var _0x5a4a80={},_0x19c998={},_0x5c9acf={'count':0x0,'rows':[]};var _0x2bf23d=_[_0x9104('0x28')](db[_0x9104('0x29')]['rawAttributes'],function(_0x3e39bc){return{'name':_0x3e39bc[_0x9104('0x2a')],'type':_0x3e39bc['type'][_0x9104('0x2b')]};});_0x19c998['model']=_[_0x9104('0x28')](_0x2bf23d,_0x9104('0x26'));_0x19c998[_0x9104('0x2c')]=_[_0x9104('0x2d')](_0x45d9d1['query']);_0x19c998['filters']=_[_0x9104('0x2e')](_0x19c998[_0x9104('0x2f')],_0x19c998['query']);_0x5a4a80['attributes']=_[_0x9104('0x2e')](_0x19c998['model'],qs['fields'](_0x45d9d1['query'][_0x9104('0x30')]));_0x5a4a80[_0x9104('0x31')]=_0x5a4a80[_0x9104('0x31')][_0x9104('0x32')]?_0x5a4a80[_0x9104('0x31')]:_0x19c998[_0x9104('0x2f')];if(!_0x45d9d1[_0x9104('0x2c')]['hasOwnProperty'](_0x9104('0x33'))){_0x5a4a80[_0x9104('0x1d')]=qs['limit'](_0x45d9d1['query'][_0x9104('0x1d')]);_0x5a4a80[_0x9104('0x34')]=qs[_0x9104('0x34')](_0x45d9d1['query'][_0x9104('0x34')]);}_0x5a4a80['order']=qs['sort'](_0x45d9d1[_0x9104('0x2c')][_0x9104('0x35')]);_0x5a4a80[_0x9104('0x36')]=qs[_0x9104('0x37')](_[_0x9104('0x38')](_0x45d9d1[_0x9104('0x2c')],_0x19c998[_0x9104('0x37')]),_0x2bf23d);if(_0x45d9d1[_0x9104('0x2c')][_0x9104('0x39')]){_0x5a4a80['where']=_[_0x9104('0x3a')](_0x5a4a80[_0x9104('0x36')],{'$or':_[_0x9104('0x28')](_0x2bf23d,function(_0x504ae3){if(_0x504ae3['type']!==_0x9104('0x3b')){var _0x491e2d={};_0x491e2d[_0x504ae3[_0x9104('0x26')]]={'$like':'%'+_0x45d9d1[_0x9104('0x2c')][_0x9104('0x39')]+'%'};return _0x491e2d;}})});}_0x5a4a80=_[_0x9104('0x3a')]({},_0x5a4a80,_0x45d9d1[_0x9104('0x3c')]);var _0x3219c8={'where':_0x5a4a80[_0x9104('0x36')]};return db[_0x9104('0x29')][_0x9104('0x3d')](_0x3219c8)[_0x9104('0x23')](function(_0x582b8e){_0x5c9acf[_0x9104('0x3d')]=_0x582b8e;if(_0x45d9d1['query']['includeAll']){_0x5a4a80[_0x9104('0x3e')]=[{'all':!![]}];}return db[_0x9104('0x29')][_0x9104('0x3f')](_0x5a4a80);})[_0x9104('0x23')](function(_0x233cf3){_0x5c9acf[_0x9104('0x40')]=_0x233cf3;return _0x5c9acf;})['then'](respondWithFilteredResult(_0x29406f,_0x5a4a80))[_0x9104('0x41')](handleError(_0x29406f,null));};exports[_0x9104('0x42')]=function(_0x8f3e32,_0x3a1f7c){var _0x50bb8b={'raw':!![],'where':{'id':_0x8f3e32['params']['id']}},_0x584224={};_0x584224['model']=_[_0x9104('0x2d')](db['OpenchannelTransferReport']['rawAttributes']);_0x584224[_0x9104('0x2c')]=_[_0x9104('0x2d')](_0x8f3e32[_0x9104('0x2c')]);_0x584224['filters']=_[_0x9104('0x2e')](_0x584224[_0x9104('0x2f')],_0x584224[_0x9104('0x2c')]);_0x50bb8b[_0x9104('0x31')]=_['intersection'](_0x584224[_0x9104('0x2f')],qs['fields'](_0x8f3e32[_0x9104('0x2c')]['fields']));_0x50bb8b['attributes']=_0x50bb8b[_0x9104('0x31')][_0x9104('0x32')]?_0x50bb8b['attributes']:_0x584224['model'];if(_0x8f3e32[_0x9104('0x2c')][_0x9104('0x43')]){_0x50bb8b[_0x9104('0x3e')]=[{'all':!![]}];}_0x50bb8b=_[_0x9104('0x3a')]({},_0x50bb8b,_0x8f3e32[_0x9104('0x3c')]);return db[_0x9104('0x29')]['find'](_0x50bb8b)[_0x9104('0x23')](handleEntityNotFound(_0x3a1f7c,null))[_0x9104('0x23')](respondWithResult(_0x3a1f7c,null))[_0x9104('0x41')](handleError(_0x3a1f7c,null));};exports[_0x9104('0x44')]=function(_0xedb0c8,_0x36c8ba){return db[_0x9104('0x29')]['create'](_0xedb0c8[_0x9104('0x45')],{})[_0x9104('0x23')](respondWithResult(_0x36c8ba,0xc9))[_0x9104('0x41')](handleError(_0x36c8ba,null));};exports[_0x9104('0x46')]=function(_0xa23af9,_0x249960){if(_0xa23af9['body']['id']){delete _0xa23af9[_0x9104('0x45')]['id'];}return db['OpenchannelTransferReport'][_0x9104('0x47')]({'where':{'id':_0xa23af9[_0x9104('0x48')]['id']}})[_0x9104('0x23')](handleEntityNotFound(_0x249960,null))[_0x9104('0x23')](saveUpdates(_0xa23af9['body'],null))[_0x9104('0x23')](respondWithResult(_0x249960,null))[_0x9104('0x41')](handleError(_0x249960,null));};exports['destroy']=function(_0x4ee502,_0x357106){return db[_0x9104('0x29')]['find']({'where':{'id':_0x4ee502[_0x9104('0x48')]['id']}})[_0x9104('0x23')](handleEntityNotFound(_0x357106,null))[_0x9104('0x23')](removeEntity(_0x357106,null))[_0x9104('0x41')](handleError(_0x357106,null));};exports['describe']=function(_0x12ed7f,_0x527663){return db[_0x9104('0x29')][_0x9104('0x49')]()['then'](respondWithResult(_0x527663,null))[_0x9104('0x41')](handleError(_0x527663,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index a42420a..b830a18 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 _0x044a=['path','rimraf','../../config/environment','exports','define','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x247cbc,_0x4985db){var _0x487113=function(_0xa6d0ec){while(--_0xa6d0ec){_0x247cbc['push'](_0x247cbc['shift']());}};_0x487113(++_0x4985db);}(_0x044a,0x173));var _0xa044=function(_0x116feb,_0x254c56){_0x116feb=_0x116feb-0x0;var _0x2ca71b=_0x044a[_0x116feb];return _0x2ca71b;};'use strict';var _=require(_0xa044('0x0'));var util=require(_0xa044('0x1'));var logger=require(_0xa044('0x2'))(_0xa044('0x3'));var moment=require(_0xa044('0x4'));var BPromise=require(_0xa044('0x5'));var rp=require(_0xa044('0x6'));var fs=require('fs');var path=require(_0xa044('0x7'));var rimraf=require(_0xa044('0x8'));var config=require(_0xa044('0x9'));var attributes=require('./openchannelTransferReport.attributes');module[_0xa044('0xa')]=function(_0x1103e7,_0x1bdd1b){return _0x1103e7[_0xa044('0xb')]('OpenchannelTransferReport',attributes,{'tableName':_0xa044('0xc'),'paranoid':![],'indexes':[{'name':_0xa044('0xd'),'fields':[_0xa044('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa6b0=['./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x116d3c,_0x6c488e){_0x116d3c=_0x116d3c-0x0;var _0x305cdb=_0xa6b0[_0x116d3c];return _0x305cdb;};'use strict';var _=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a6b('0x2'));var BPromise=require(_0x0a6b('0x3'));var rp=require(_0x0a6b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a6b('0x5'));var config=require(_0x0a6b('0x6'));var attributes=require(_0x0a6b('0x7'));module[_0x0a6b('0x8')]=function(_0x3dc2b0,_0x3b6967){return _0x3dc2b0[_0x0a6b('0x9')](_0x0a6b('0xa'),attributes,{'tableName':_0x0a6b('0xb'),'paranoid':![],'indexes':[{'name':_0x0a6b('0xc'),'fields':[_0x0a6b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 9e7de38..ef86b62 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 _0x7f3a=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x275122,_0x4305b5){var _0x15249c=function(_0x5206b2){while(--_0x5206b2){_0x275122['push'](_0x275122['shift']());}};_0x15249c(++_0x4305b5);}(_0x7f3a,0x19f));var _0xa7f3=function(_0x96ff08,_0xe80d7e){_0x96ff08=_0x96ff08-0x0;var _0x50d65d=_0x7f3a[_0x96ff08];return _0x50d65d;};'use strict';var _=require(_0xa7f3('0x0'));var util=require(_0xa7f3('0x1'));var moment=require(_0xa7f3('0x2'));var BPromise=require(_0xa7f3('0x3'));var rs=require(_0xa7f3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa7f3('0x5'))['db'];var utils=require(_0xa7f3('0x6'));var logger=require(_0xa7f3('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa7f3('0x8'));var client=jayson['client'][_0xa7f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x121919,_0x4374bb,_0x4d5ffa){return new BPromise(function(_0x21fb14,_0x220fa5){return client[_0xa7f3('0xa')](_0x121919,_0x4d5ffa)[_0xa7f3('0xb')](function(_0x27664a){logger[_0xa7f3('0xc')](_0xa7f3('0xd'),_0x4374bb,_0xa7f3('0xe'));logger[_0xa7f3('0xf')](_0xa7f3('0x10'),_0x4374bb,_0xa7f3('0xe'),JSON['stringify'](_0x27664a));if(_0x27664a[_0xa7f3('0x11')]){if(_0x27664a[_0xa7f3('0x11')][_0xa7f3('0x12')]===0x1f4){logger[_0xa7f3('0x11')](_0xa7f3('0xd'),_0x4374bb,_0x27664a['error'][_0xa7f3('0x13')]);return _0x220fa5(_0x27664a['error'][_0xa7f3('0x13')]);}logger['error'](_0xa7f3('0xd'),_0x4374bb,_0x27664a[_0xa7f3('0x11')][_0xa7f3('0x13')]);return _0x21fb14(_0x27664a['error'][_0xa7f3('0x13')]);}else{logger['info'](_0xa7f3('0xd'),_0x4374bb,'request\x20sent');_0x21fb14(_0x27664a[_0xa7f3('0x14')][_0xa7f3('0x13')]);}})['catch'](function(_0x1e467a){logger[_0xa7f3('0x11')](_0xa7f3('0xd'),_0x4374bb,_0x1e467a);_0x220fa5(_0x1e467a);});});} \ No newline at end of file +var _0x6841=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x5ce819,_0x293542){var _0x515965=function(_0x5cca0b){while(--_0x5cca0b){_0x5ce819['push'](_0x5ce819['shift']());}};_0x515965(++_0x293542);}(_0x6841,0xc6));var _0x1684=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x6841[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x1684('0x0'));var util=require(_0x1684('0x1'));var moment=require(_0x1684('0x2'));var BPromise=require(_0x1684('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1684('0x4'));var db=require(_0x1684('0x5'))['db'];var utils=require(_0x1684('0x6'));var logger=require(_0x1684('0x7'))(_0x1684('0x8'));var config=require(_0x1684('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1684('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12fb25,_0x32cc42,_0x566151){return new BPromise(function(_0x27630d,_0x53bcf3){return client[_0x1684('0xb')](_0x12fb25,_0x566151)['then'](function(_0xc34406){logger[_0x1684('0xc')](_0x1684('0xd'),_0x32cc42,_0x1684('0xe'));logger[_0x1684('0xf')](_0x1684('0x10'),_0x32cc42,_0x1684('0xe'),JSON[_0x1684('0x11')](_0xc34406));if(_0xc34406[_0x1684('0x12')]){if(_0xc34406[_0x1684('0x12')][_0x1684('0x13')]===0x1f4){logger[_0x1684('0x12')](_0x1684('0xd'),_0x32cc42,_0xc34406['error'][_0x1684('0x14')]);return _0x53bcf3(_0xc34406[_0x1684('0x12')][_0x1684('0x14')]);}logger[_0x1684('0x12')](_0x1684('0xd'),_0x32cc42,_0xc34406[_0x1684('0x12')][_0x1684('0x14')]);return _0x27630d(_0xc34406[_0x1684('0x12')][_0x1684('0x14')]);}else{logger[_0x1684('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x32cc42,_0x1684('0xe'));_0x27630d(_0xc34406['result'][_0x1684('0x14')]);}})[_0x1684('0x15')](function(_0x114d9c){logger['error'](_0x1684('0xd'),_0x32cc42,_0x114d9c);_0x53bcf3(_0x114d9c);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 4085d65..6a674f1 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 _0xe0fe=['show','post','create','update','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id'];(function(_0x4032e3,_0x6d6449){var _0x34f51a=function(_0x3f77e4){while(--_0x3f77e4){_0x4032e3['push'](_0x4032e3['shift']());}};_0x34f51a(++_0x6d6449);}(_0xe0fe,0xe4));var _0xee0f=function(_0x66bc7c,_0xe6be30){_0x66bc7c=_0x66bc7c-0x0;var _0x4c9845=_0xe0fe[_0x66bc7c];return _0x4c9845;};'use strict';var multer=require(_0xee0f('0x0'));var util=require(_0xee0f('0x1'));var path=require(_0xee0f('0x2'));var timeout=require(_0xee0f('0x3'));var express=require('express');var router=express[_0xee0f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xee0f('0x5'));var config=require(_0xee0f('0x6'));var controller=require(_0xee0f('0x7'));router[_0xee0f('0x8')]('/',auth[_0xee0f('0x9')](),controller[_0xee0f('0xa')]);router[_0xee0f('0x8')](_0xee0f('0xb'),auth[_0xee0f('0x9')](),controller[_0xee0f('0xc')]);router[_0xee0f('0xd')]('/',auth[_0xee0f('0x9')](),controller[_0xee0f('0xe')]);router['put'](_0xee0f('0xb'),auth[_0xee0f('0x9')](),controller[_0xee0f('0xf')]);router['delete'](_0xee0f('0xb'),auth[_0xee0f('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0274=['./pause.controller','get','isAuthenticated','/:id','show','create','put','update','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x0274,0x175));var _0x4027=function(_0x227622,_0x2d11fd){_0x227622=_0x227622-0x0;var _0x40823a=_0x0274[_0x227622];return _0x40823a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4027('0x0'));var timeout=require(_0x4027('0x1'));var express=require(_0x4027('0x2'));var router=express['Router']();var auth=require(_0x4027('0x3'));var interaction=require(_0x4027('0x4'));var config=require('../../config/environment');var controller=require(_0x4027('0x5'));router[_0x4027('0x6')]('/',auth[_0x4027('0x7')](),controller['index']);router[_0x4027('0x6')](_0x4027('0x8'),auth[_0x4027('0x7')](),controller[_0x4027('0x9')]);router['post']('/',auth[_0x4027('0x7')](),controller[_0x4027('0xa')]);router[_0x4027('0xb')]('/:id',auth[_0x4027('0x7')](),controller[_0x4027('0xc')]);router['delete']('/:id',auth[_0x4027('0x7')](),controller['destroy']);module[_0x4027('0xd')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index ce0d716..efaeb48 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 _0xa5dc=['name','sequelize','exports','STRING'];(function(_0x4b8e16,_0x728754){var _0x168a7f=function(_0x541150){while(--_0x541150){_0x4b8e16['push'](_0x4b8e16['shift']());}};_0x168a7f(++_0x728754);}(_0xa5dc,0xc9));var _0xca5d=function(_0x4f9b3a,_0x4b31a2){_0x4f9b3a=_0x4f9b3a-0x0;var _0x10cb16=_0xa5dc[_0x4f9b3a];return _0x10cb16;};'use strict';var Sequelize=require(_0xca5d('0x0'));module[_0xca5d('0x1')]={'name':{'type':Sequelize[_0xca5d('0x2')],'unique':_0xca5d('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xca5d('0x2')]}}; \ No newline at end of file +var _0x17fe=['sequelize','STRING'];(function(_0x463183,_0x56bd4e){var _0xd5fe56=function(_0x55cb29){while(--_0x55cb29){_0x463183['push'](_0x463183['shift']());}};_0xd5fe56(++_0x56bd4e);}(_0x17fe,0x1be));var _0xe17f=function(_0x2c62c7,_0x34a728){_0x2c62c7=_0x2c62c7-0x0;var _0x57a354=_0x17fe[_0x2c62c7];return _0x57a354;};'use strict';var Sequelize=require(_0xe17f('0x0'));module['exports']={'name':{'type':Sequelize[_0xe17f('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xe17f('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index a1c6546..36749d5 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 _0x9afb=['end','status','json','offset','limit','Content-Range','apply','reject','save','then','destroy','Pauses','UserProfileResource','sendStatus','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','findAll','rows','catch','show','params','keys','includeAll','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x364fbd,_0x50b089){var _0xfc8e88=function(_0xcd1cf1){while(--_0xcd1cf1){_0x364fbd['push'](_0x364fbd['shift']());}};_0xfc8e88(++_0x50b089);}(_0x9afb,0x183));var _0xb9af=function(_0x4ada50,_0x54757b){_0x4ada50=_0x4ada50-0x0;var _0x3d85d5=_0x9afb[_0x4ada50];return _0x3d85d5;};'use strict';var pdf=require(_0xb9af('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb9af('0x1'));var zipdir=require(_0xb9af('0x2'));var jsonpatch=require(_0xb9af('0x3'));var rp=require('request-promise');var moment=require(_0xb9af('0x4'));var BPromise=require(_0xb9af('0x5'));var Mustache=require('mustache');var util=require(_0xb9af('0x6'));var path=require('path');var sox=require(_0xb9af('0x7'));var csv=require(_0xb9af('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb9af('0x9'));var squel=require(_0xb9af('0xa'));var crypto=require(_0xb9af('0xb'));var jsforce=require(_0xb9af('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb9af('0x8'));var querystring=require(_0xb9af('0xd'));var Papa=require(_0xb9af('0xe'));var Redis=require(_0xb9af('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb9af('0x10'));var as=require(_0xb9af('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb9af('0x12'))(_0xb9af('0x13'));var utils=require(_0xb9af('0x14'));var config=require(_0xb9af('0x15'));var db=require(_0xb9af('0x16'))['db'];function respondWithStatusCode(_0x3de5d5,_0x27409e){_0x27409e=_0x27409e||0xcc;return function(_0x19f4c9){if(_0x19f4c9){return _0x3de5d5['sendStatus'](_0x27409e);}return _0x3de5d5['status'](_0x27409e)[_0xb9af('0x17')]();};}function respondWithResult(_0x3fb6ed,_0x3e2928){_0x3e2928=_0x3e2928||0xc8;return function(_0x578733){if(_0x578733){return _0x3fb6ed[_0xb9af('0x18')](_0x3e2928)[_0xb9af('0x19')](_0x578733);}};}function respondWithFilteredResult(_0x80932e,_0x2300a4){return function(_0x4bc494){if(_0x4bc494){var _0x12ec67=_0x4bc494['count'],_0x272d7f=_0x2300a4[_0xb9af('0x1a')],_0x1bb3ab=_0x2300a4['offset']+_0x2300a4[_0xb9af('0x1b')],_0x4fc677;if(_0x1bb3ab>=_0x12ec67){_0x1bb3ab=_0x12ec67;_0x4fc677=0xc8;}else{_0x4fc677=0xce;}_0x80932e[_0xb9af('0x18')](_0x4fc677);return _0x80932e['set'](_0xb9af('0x1c'),_0x272d7f+'-'+_0x1bb3ab+'/'+_0x12ec67)['json'](_0x4bc494);}return null;};}function patchUpdates(_0x5461a8){return function(_0x484923){try{jsonpatch[_0xb9af('0x1d')](_0x484923,_0x5461a8,!![]);}catch(_0xa0bec9){return BPromise[_0xb9af('0x1e')](_0xa0bec9);}return _0x484923[_0xb9af('0x1f')]();};}function saveUpdates(_0x7d02ed,_0x36f989){return function(_0x5e6542){if(_0x5e6542){return _0x5e6542['update'](_0x7d02ed)[_0xb9af('0x20')](function(_0x474e4b){return _0x474e4b;});}return null;};}function removeEntity(_0x2882f1,_0x5e28c3){return function(_0x56f2b5){if(_0x56f2b5){return _0x56f2b5[_0xb9af('0x21')]()[_0xb9af('0x20')](function(){var _0x3e6e94=_0x56f2b5['get']({'plain':!![]});var _0x1a354d=_0xb9af('0x22');return db[_0xb9af('0x23')]['destroy']({'where':{'type':_0x1a354d,'resourceId':_0x3e6e94['id']}})[_0xb9af('0x20')](function(){return _0x56f2b5;});})[_0xb9af('0x20')](function(){_0x2882f1[_0xb9af('0x18')](0xcc)[_0xb9af('0x17')]();});}};}function handleEntityNotFound(_0x4ea010,_0x456e93){return function(_0x45a7e4){if(!_0x45a7e4){_0x4ea010[_0xb9af('0x24')](0x194);}return _0x45a7e4;};}function handleError(_0x30ead4,_0x2c86c0){_0x2c86c0=_0x2c86c0||0x1f4;return function(_0x58b1d8){logger['error'](_0x58b1d8[_0xb9af('0x25')]);if(_0x58b1d8[_0xb9af('0x26')]){delete _0x58b1d8[_0xb9af('0x26')];}_0x30ead4[_0xb9af('0x18')](_0x2c86c0)[_0xb9af('0x27')](_0x58b1d8);};}exports[_0xb9af('0x28')]=function(_0xf37dac,_0x4ca7e8){var _0xe6bb9f={},_0x336d77={},_0x180ca6={'count':0x0,'rows':[]};var _0x5aa7c8=_[_0xb9af('0x29')](db[_0xb9af('0x2a')][_0xb9af('0x2b')],function(_0x272957){return{'name':_0x272957[_0xb9af('0x2c')],'type':_0x272957[_0xb9af('0x2d')][_0xb9af('0x2e')]};});_0x336d77[_0xb9af('0x2f')]=_[_0xb9af('0x29')](_0x5aa7c8,'name');_0x336d77[_0xb9af('0x30')]=_['keys'](_0xf37dac[_0xb9af('0x30')]);_0x336d77['filters']=_[_0xb9af('0x31')](_0x336d77[_0xb9af('0x2f')],_0x336d77[_0xb9af('0x30')]);_0xe6bb9f[_0xb9af('0x32')]=_[_0xb9af('0x31')](_0x336d77[_0xb9af('0x2f')],qs[_0xb9af('0x33')](_0xf37dac['query'][_0xb9af('0x33')]));_0xe6bb9f[_0xb9af('0x32')]=_0xe6bb9f[_0xb9af('0x32')][_0xb9af('0x34')]?_0xe6bb9f[_0xb9af('0x32')]:_0x336d77[_0xb9af('0x2f')];if(!_0xf37dac['query'][_0xb9af('0x35')](_0xb9af('0x36'))){_0xe6bb9f[_0xb9af('0x1b')]=qs[_0xb9af('0x1b')](_0xf37dac['query'][_0xb9af('0x1b')]);_0xe6bb9f['offset']=qs['offset'](_0xf37dac[_0xb9af('0x30')][_0xb9af('0x1a')]);}_0xe6bb9f[_0xb9af('0x37')]=qs['sort'](_0xf37dac[_0xb9af('0x30')][_0xb9af('0x38')]);_0xe6bb9f[_0xb9af('0x39')]=qs[_0xb9af('0x3a')](_[_0xb9af('0x3b')](_0xf37dac['query'],_0x336d77[_0xb9af('0x3a')]),_0x5aa7c8);if(_0xf37dac[_0xb9af('0x30')][_0xb9af('0x3c')]){_0xe6bb9f[_0xb9af('0x39')]=_['merge'](_0xe6bb9f['where'],{'$or':_[_0xb9af('0x29')](_0x5aa7c8,function(_0x1364f8){if(_0x1364f8[_0xb9af('0x2d')]!==_0xb9af('0x3d')){var _0x239bd9={};_0x239bd9[_0x1364f8[_0xb9af('0x26')]]={'$like':'%'+_0xf37dac[_0xb9af('0x30')][_0xb9af('0x3c')]+'%'};return _0x239bd9;}})});}_0xe6bb9f=_[_0xb9af('0x3e')]({},_0xe6bb9f,_0xf37dac[_0xb9af('0x3f')]);var _0x122dde={'where':_0xe6bb9f[_0xb9af('0x39')]};return db[_0xb9af('0x2a')][_0xb9af('0x40')](_0x122dde)[_0xb9af('0x20')](function(_0x2ac17a){_0x180ca6['count']=_0x2ac17a;if(_0xf37dac[_0xb9af('0x30')]['includeAll']){_0xe6bb9f['include']=[{'all':!![]}];}return db[_0xb9af('0x2a')][_0xb9af('0x41')](_0xe6bb9f);})[_0xb9af('0x20')](function(_0x276c0e){_0x180ca6[_0xb9af('0x42')]=_0x276c0e;return _0x180ca6;})['then'](respondWithFilteredResult(_0x4ca7e8,_0xe6bb9f))[_0xb9af('0x43')](handleError(_0x4ca7e8,null));};exports[_0xb9af('0x44')]=function(_0x27c336,_0x48afc2){var _0x4f83ea={'raw':!![],'where':{'id':_0x27c336[_0xb9af('0x45')]['id']}},_0x566e55={};_0x566e55[_0xb9af('0x2f')]=_[_0xb9af('0x46')](db['Pause'][_0xb9af('0x2b')]);_0x566e55[_0xb9af('0x30')]=_[_0xb9af('0x46')](_0x27c336['query']);_0x566e55[_0xb9af('0x3a')]=_[_0xb9af('0x31')](_0x566e55[_0xb9af('0x2f')],_0x566e55[_0xb9af('0x30')]);_0x4f83ea[_0xb9af('0x32')]=_['intersection'](_0x566e55[_0xb9af('0x2f')],qs[_0xb9af('0x33')](_0x27c336[_0xb9af('0x30')][_0xb9af('0x33')]));_0x4f83ea[_0xb9af('0x32')]=_0x4f83ea['attributes'][_0xb9af('0x34')]?_0x4f83ea[_0xb9af('0x32')]:_0x566e55[_0xb9af('0x2f')];if(_0x27c336['query'][_0xb9af('0x47')]){_0x4f83ea[_0xb9af('0x48')]=[{'all':!![]}];}_0x4f83ea=_[_0xb9af('0x3e')]({},_0x4f83ea,_0x27c336['options']);return db[_0xb9af('0x2a')]['find'](_0x4f83ea)[_0xb9af('0x20')](handleEntityNotFound(_0x48afc2,null))[_0xb9af('0x20')](respondWithResult(_0x48afc2,null))['catch'](handleError(_0x48afc2,null));};exports[_0xb9af('0x49')]=function(_0x2fd9b0,_0xb74d71){return db[_0xb9af('0x2a')][_0xb9af('0x49')](_0x2fd9b0[_0xb9af('0x4a')],{})['then'](function(_0x437422){var _0x2c98c7=_0x2fd9b0[_0xb9af('0x4b')][_0xb9af('0x4c')]({'plain':!![]});if(!_0x2c98c7)throw new Error(_0xb9af('0x4d'));if(_0x2c98c7['role']===_0xb9af('0x4b')){var _0x5db949=_0x437422[_0xb9af('0x4c')]({'plain':!![]});var _0x3bee46='Pauses';return db[_0xb9af('0x4e')][_0xb9af('0x4f')]({'where':{'name':_0x3bee46,'userProfileId':_0x2c98c7['userProfileId']},'raw':!![]})['then'](function(_0x28a0b1){if(_0x28a0b1&&_0x28a0b1['autoAssociation']===0x0){return db[_0xb9af('0x23')][_0xb9af('0x49')]({'name':_0x5db949[_0xb9af('0x26')],'resourceId':_0x5db949['id'],'type':_0x28a0b1[_0xb9af('0x26')],'sectionId':_0x28a0b1['id']},{})[_0xb9af('0x20')](function(){return _0x437422;});}else{return _0x437422;}})[_0xb9af('0x43')](function(_0x8c5462){logger[_0xb9af('0x50')](_0xb9af('0x51'),_0x8c5462);throw _0x8c5462;});}return _0x437422;})['then'](respondWithResult(_0xb74d71,0xc9))[_0xb9af('0x43')](handleError(_0xb74d71,null));};exports['update']=function(_0x2c924e,_0xbf8754){if(_0x2c924e[_0xb9af('0x4a')]['id']){delete _0x2c924e[_0xb9af('0x4a')]['id'];}return db['Pause']['find']({'where':{'id':_0x2c924e[_0xb9af('0x45')]['id']}})[_0xb9af('0x20')](handleEntityNotFound(_0xbf8754,null))[_0xb9af('0x20')](saveUpdates(_0x2c924e[_0xb9af('0x4a')],null))['then'](respondWithResult(_0xbf8754,null))[_0xb9af('0x43')](handleError(_0xbf8754,null));};exports[_0xb9af('0x21')]=function(_0x32204f,_0x133e8d){return db[_0xb9af('0x2a')]['find']({'where':{'id':_0x32204f[_0xb9af('0x45')]['id']}})['then'](handleEntityNotFound(_0x133e8d,null))[_0xb9af('0x20')](removeEntity(_0x133e8d,null))['catch'](handleError(_0x133e8d,null));}; \ No newline at end of file +var _0x293a=['hasOwnProperty','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','rawAttributes','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Pauses','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','stack','name','index','map','Pause','fieldName','type','key','model','keys','intersection','query','attributes','fields','length'];(function(_0x4fb1df,_0x449725){var _0x1b24f3=function(_0x2effff){while(--_0x2effff){_0x4fb1df['push'](_0x4fb1df['shift']());}};_0x1b24f3(++_0x449725);}(_0x293a,0x167));var _0xa293=function(_0x140d94,_0x25e2a5){_0x140d94=_0x140d94-0x0;var _0x50ecb7=_0x293a[_0x140d94];return _0x50ecb7;};'use strict';var pdf=require(_0xa293('0x0'));var emlformat=require(_0xa293('0x1'));var rimraf=require(_0xa293('0x2'));var zipdir=require(_0xa293('0x3'));var jsonpatch=require(_0xa293('0x4'));var rp=require(_0xa293('0x5'));var moment=require(_0xa293('0x6'));var BPromise=require(_0xa293('0x7'));var Mustache=require(_0xa293('0x8'));var util=require(_0xa293('0x9'));var path=require(_0xa293('0xa'));var sox=require(_0xa293('0xb'));var csv=require(_0xa293('0xc'));var ejs=require(_0xa293('0xd'));var fs=require('fs');var _=require(_0xa293('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa293('0xf'));var deskjs=require(_0xa293('0x10'));var toCsv=require(_0xa293('0xc'));var querystring=require(_0xa293('0x11'));var Papa=require(_0xa293('0x12'));var Redis=require('ioredis');var authService=require(_0xa293('0x13'));var qs=require(_0xa293('0x14'));var as=require(_0xa293('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa293('0x16'))(_0xa293('0x17'));var utils=require(_0xa293('0x18'));var config=require(_0xa293('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f3a51,_0x5d064b){_0x5d064b=_0x5d064b||0xcc;return function(_0x4aa87a){if(_0x4aa87a){return _0x1f3a51[_0xa293('0x1a')](_0x5d064b);}return _0x1f3a51['status'](_0x5d064b)[_0xa293('0x1b')]();};}function respondWithResult(_0x6e01b3,_0x4a835a){_0x4a835a=_0x4a835a||0xc8;return function(_0x7705e6){if(_0x7705e6){return _0x6e01b3[_0xa293('0x1c')](_0x4a835a)[_0xa293('0x1d')](_0x7705e6);}};}function respondWithFilteredResult(_0x24b0d6,_0x333b55){return function(_0x4bd415){if(_0x4bd415){var _0x2e5987=_0x4bd415[_0xa293('0x1e')],_0x4a27cc=_0x333b55[_0xa293('0x1f')],_0x40912c=_0x333b55[_0xa293('0x1f')]+_0x333b55[_0xa293('0x20')],_0x47c8b6;if(_0x40912c>=_0x2e5987){_0x40912c=_0x2e5987;_0x47c8b6=0xc8;}else{_0x47c8b6=0xce;}_0x24b0d6[_0xa293('0x1c')](_0x47c8b6);return _0x24b0d6[_0xa293('0x21')](_0xa293('0x22'),_0x4a27cc+'-'+_0x40912c+'/'+_0x2e5987)[_0xa293('0x1d')](_0x4bd415);}return null;};}function patchUpdates(_0x182223){return function(_0x41a9a8){try{jsonpatch[_0xa293('0x23')](_0x41a9a8,_0x182223,!![]);}catch(_0x5f0a7b){return BPromise[_0xa293('0x24')](_0x5f0a7b);}return _0x41a9a8[_0xa293('0x25')]();};}function saveUpdates(_0x2ea3e1,_0x4f6739){return function(_0x3e538d){if(_0x3e538d){return _0x3e538d['update'](_0x2ea3e1)[_0xa293('0x26')](function(_0x247a75){return _0x247a75;});}return null;};}function removeEntity(_0x2855ce,_0x402e08){return function(_0x2cc282){if(_0x2cc282){return _0x2cc282[_0xa293('0x27')]()[_0xa293('0x26')](function(){var _0x1a9c08=_0x2cc282['get']({'plain':!![]});var _0x27c0ee='Pauses';return db[_0xa293('0x28')][_0xa293('0x27')]({'where':{'type':_0x27c0ee,'resourceId':_0x1a9c08['id']}})[_0xa293('0x26')](function(){return _0x2cc282;});})['then'](function(){_0x2855ce[_0xa293('0x1c')](0xcc)[_0xa293('0x1b')]();});}};}function handleEntityNotFound(_0x1aa707,_0x25458e){return function(_0x1eb998){if(!_0x1eb998){_0x1aa707[_0xa293('0x1a')](0x194);}return _0x1eb998;};}function handleError(_0x11fc00,_0x248c69){_0x248c69=_0x248c69||0x1f4;return function(_0x80d971){logger['error'](_0x80d971[_0xa293('0x29')]);if(_0x80d971['name']){delete _0x80d971[_0xa293('0x2a')];}_0x11fc00['status'](_0x248c69)['send'](_0x80d971);};}exports[_0xa293('0x2b')]=function(_0x57c15a,_0x2dd4cb){var _0xda64b8={},_0x19e463={},_0x40bfeb={'count':0x0,'rows':[]};var _0x2858b8=_[_0xa293('0x2c')](db[_0xa293('0x2d')]['rawAttributes'],function(_0x4942d5){return{'name':_0x4942d5[_0xa293('0x2e')],'type':_0x4942d5[_0xa293('0x2f')][_0xa293('0x30')]};});_0x19e463[_0xa293('0x31')]=_[_0xa293('0x2c')](_0x2858b8,_0xa293('0x2a'));_0x19e463['query']=_[_0xa293('0x32')](_0x57c15a['query']);_0x19e463['filters']=_[_0xa293('0x33')](_0x19e463[_0xa293('0x31')],_0x19e463[_0xa293('0x34')]);_0xda64b8[_0xa293('0x35')]=_['intersection'](_0x19e463['model'],qs[_0xa293('0x36')](_0x57c15a['query']['fields']));_0xda64b8[_0xa293('0x35')]=_0xda64b8[_0xa293('0x35')][_0xa293('0x37')]?_0xda64b8[_0xa293('0x35')]:_0x19e463[_0xa293('0x31')];if(!_0x57c15a[_0xa293('0x34')][_0xa293('0x38')]('nolimit')){_0xda64b8[_0xa293('0x20')]=qs[_0xa293('0x20')](_0x57c15a[_0xa293('0x34')][_0xa293('0x20')]);_0xda64b8[_0xa293('0x1f')]=qs[_0xa293('0x1f')](_0x57c15a[_0xa293('0x34')][_0xa293('0x1f')]);}_0xda64b8[_0xa293('0x39')]=qs[_0xa293('0x3a')](_0x57c15a['query'][_0xa293('0x3a')]);_0xda64b8['where']=qs[_0xa293('0x3b')](_[_0xa293('0x3c')](_0x57c15a['query'],_0x19e463[_0xa293('0x3b')]),_0x2858b8);if(_0x57c15a['query'][_0xa293('0x3d')]){_0xda64b8[_0xa293('0x3e')]=_[_0xa293('0x3f')](_0xda64b8[_0xa293('0x3e')],{'$or':_[_0xa293('0x2c')](_0x2858b8,function(_0x537c16){if(_0x537c16[_0xa293('0x2f')]!=='VIRTUAL'){var _0x1229f2={};_0x1229f2[_0x537c16[_0xa293('0x2a')]]={'$like':'%'+_0x57c15a[_0xa293('0x34')]['filter']+'%'};return _0x1229f2;}})});}_0xda64b8=_['merge']({},_0xda64b8,_0x57c15a[_0xa293('0x40')]);var _0x457c9c={'where':_0xda64b8['where']};return db[_0xa293('0x2d')][_0xa293('0x1e')](_0x457c9c)['then'](function(_0x3b2a54){_0x40bfeb[_0xa293('0x1e')]=_0x3b2a54;if(_0x57c15a[_0xa293('0x34')][_0xa293('0x41')]){_0xda64b8[_0xa293('0x42')]=[{'all':!![]}];}return db[_0xa293('0x2d')][_0xa293('0x43')](_0xda64b8);})[_0xa293('0x26')](function(_0x307040){_0x40bfeb[_0xa293('0x44')]=_0x307040;return _0x40bfeb;})[_0xa293('0x26')](respondWithFilteredResult(_0x2dd4cb,_0xda64b8))[_0xa293('0x45')](handleError(_0x2dd4cb,null));};exports['show']=function(_0x32e879,_0x4453f6){var _0xfde824={'raw':!![],'where':{'id':_0x32e879['params']['id']}},_0x1a4ec2={};_0x1a4ec2[_0xa293('0x31')]=_[_0xa293('0x32')](db[_0xa293('0x2d')][_0xa293('0x46')]);_0x1a4ec2[_0xa293('0x34')]=_[_0xa293('0x32')](_0x32e879[_0xa293('0x34')]);_0x1a4ec2[_0xa293('0x3b')]=_[_0xa293('0x33')](_0x1a4ec2[_0xa293('0x31')],_0x1a4ec2['query']);_0xfde824['attributes']=_[_0xa293('0x33')](_0x1a4ec2['model'],qs[_0xa293('0x36')](_0x32e879[_0xa293('0x34')][_0xa293('0x36')]));_0xfde824[_0xa293('0x35')]=_0xfde824[_0xa293('0x35')][_0xa293('0x37')]?_0xfde824['attributes']:_0x1a4ec2['model'];if(_0x32e879['query'][_0xa293('0x41')]){_0xfde824[_0xa293('0x42')]=[{'all':!![]}];}_0xfde824=_[_0xa293('0x3f')]({},_0xfde824,_0x32e879[_0xa293('0x40')]);return db['Pause'][_0xa293('0x47')](_0xfde824)[_0xa293('0x26')](handleEntityNotFound(_0x4453f6,null))[_0xa293('0x26')](respondWithResult(_0x4453f6,null))['catch'](handleError(_0x4453f6,null));};exports[_0xa293('0x48')]=function(_0x133464,_0x3913c2){return db['Pause'][_0xa293('0x48')](_0x133464['body'],{})[_0xa293('0x26')](function(_0x238204){var _0x325cc3=_0x133464['user'][_0xa293('0x49')]({'plain':!![]});if(!_0x325cc3)throw new Error(_0xa293('0x4a'));if(_0x325cc3[_0xa293('0x4b')]===_0xa293('0x4c')){var _0x31ae50=_0x238204[_0xa293('0x49')]({'plain':!![]});var _0x2a09ef=_0xa293('0x4d');return db['UserProfileSection']['find']({'where':{'name':_0x2a09ef,'userProfileId':_0x325cc3['userProfileId']},'raw':!![]})[_0xa293('0x26')](function(_0x4835f1){if(_0x4835f1&&_0x4835f1[_0xa293('0x4e')]===0x0){return db['UserProfileResource'][_0xa293('0x48')]({'name':_0x31ae50[_0xa293('0x2a')],'resourceId':_0x31ae50['id'],'type':_0x4835f1['name'],'sectionId':_0x4835f1['id']},{})['then'](function(){return _0x238204;});}else{return _0x238204;}})[_0xa293('0x45')](function(_0x4cba5e){logger[_0xa293('0x4f')](_0xa293('0x50'),_0x4cba5e);throw _0x4cba5e;});}return _0x238204;})['then'](respondWithResult(_0x3913c2,0xc9))[_0xa293('0x45')](handleError(_0x3913c2,null));};exports[_0xa293('0x51')]=function(_0x342876,_0x2f29b6){if(_0x342876[_0xa293('0x52')]['id']){delete _0x342876[_0xa293('0x52')]['id'];}return db[_0xa293('0x2d')][_0xa293('0x47')]({'where':{'id':_0x342876['params']['id']}})[_0xa293('0x26')](handleEntityNotFound(_0x2f29b6,null))[_0xa293('0x26')](saveUpdates(_0x342876['body'],null))[_0xa293('0x26')](respondWithResult(_0x2f29b6,null))[_0xa293('0x45')](handleError(_0x2f29b6,null));};exports[_0xa293('0x27')]=function(_0xf1aba0,_0x3410b5){return db['Pause']['find']({'where':{'id':_0xf1aba0['params']['id']}})[_0xa293('0x26')](handleEntityNotFound(_0x3410b5,null))[_0xa293('0x26')](removeEntity(_0x3410b5,null))[_0xa293('0x45')](handleError(_0x3410b5,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 47f0eed..5aeb64a 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 _0x02d8=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x56b3a8,_0x272dc9){var _0x1397d4=function(_0x1427cb){while(--_0x1427cb){_0x56b3a8['push'](_0x56b3a8['shift']());}};_0x1397d4(++_0x272dc9);}(_0x02d8,0x108));var _0x802d=function(_0x32ce0a,_0x553b2a){_0x32ce0a=_0x32ce0a-0x0;var _0x5f294c=_0x02d8[_0x32ce0a];return _0x5f294c;};'use strict';var _=require(_0x802d('0x0'));var util=require('util');var logger=require(_0x802d('0x1'))(_0x802d('0x2'));var moment=require(_0x802d('0x3'));var BPromise=require(_0x802d('0x4'));var rp=require(_0x802d('0x5'));var fs=require('fs');var path=require(_0x802d('0x6'));var rimraf=require(_0x802d('0x7'));var config=require(_0x802d('0x8'));var attributes=require('./pause.attributes');module[_0x802d('0x9')]=function(_0x108f6f,_0x232396){return _0x108f6f[_0x802d('0xa')]('Pause',attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ec7=['moment','bluebird','request-promise','../../config/environment','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api'];(function(_0x3ae3cf,_0x24af35){var _0x11385a=function(_0x482fda){while(--_0x482fda){_0x3ae3cf['push'](_0x3ae3cf['shift']());}};_0x11385a(++_0x24af35);}(_0x3ec7,0x11c));var _0x73ec=function(_0x1fa31b,_0xfeba17){_0x1fa31b=_0x1fa31b-0x0;var _0x21aaeb=_0x3ec7[_0x1fa31b];return _0x21aaeb;};'use strict';var _=require(_0x73ec('0x0'));var util=require(_0x73ec('0x1'));var logger=require(_0x73ec('0x2'))(_0x73ec('0x3'));var moment=require(_0x73ec('0x4'));var BPromise=require(_0x73ec('0x5'));var rp=require(_0x73ec('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x73ec('0x7'));var attributes=require('./pause.attributes');module[_0x73ec('0x8')]=function(_0x142e5b,_0x4a99d2){return _0x142e5b[_0x73ec('0x9')](_0x73ec('0xa'),attributes,{'tableName':_0x73ec('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 b8aa6b4..14ebcb2 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 _0xad7c=['find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','Pause,\x20%s,\x20%s','message','result','catch','ShowPause','Pause'];(function(_0x3e4c86,_0x5d4516){var _0x510cca=function(_0x41397c){while(--_0x41397c){_0x3e4c86['push'](_0x3e4c86['shift']());}};_0x510cca(++_0x5d4516);}(_0xad7c,0x8c));var _0xcad7=function(_0x2186b8,_0x59c1e6){_0x2186b8=_0x2186b8-0x0;var _0xaaf4b1=_0xad7c[_0x2186b8];return _0xaaf4b1;};'use strict';var _=require(_0xcad7('0x0'));var util=require(_0xcad7('0x1'));var moment=require(_0xcad7('0x2'));var BPromise=require(_0xcad7('0x3'));var rs=require(_0xcad7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcad7('0x5'))['db'];var utils=require(_0xcad7('0x6'));var logger=require(_0xcad7('0x7'))(_0xcad7('0x8'));var config=require(_0xcad7('0x9'));var jayson=require(_0xcad7('0xa'));var client=jayson[_0xcad7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf9b48e,_0x1f8b66,_0x483fa0){return new BPromise(function(_0x1575a3,_0x42cfa2){return client[_0xcad7('0xc')](_0xf9b48e,_0x483fa0)[_0xcad7('0xd')](function(_0x304136){logger[_0xcad7('0xe')]('Pause,\x20%s,\x20%s',_0x1f8b66,_0xcad7('0xf'));logger[_0xcad7('0x10')]('Pause,\x20%s,\x20%s,\x20%s',_0x1f8b66,_0xcad7('0xf'),JSON[_0xcad7('0x11')](_0x304136));if(_0x304136[_0xcad7('0x12')]){if(_0x304136[_0xcad7('0x12')]['code']===0x1f4){logger[_0xcad7('0x12')](_0xcad7('0x13'),_0x1f8b66,_0x304136[_0xcad7('0x12')][_0xcad7('0x14')]);return _0x42cfa2(_0x304136['error'][_0xcad7('0x14')]);}logger[_0xcad7('0x12')](_0xcad7('0x13'),_0x1f8b66,_0x304136[_0xcad7('0x12')][_0xcad7('0x14')]);return _0x1575a3(_0x304136[_0xcad7('0x12')][_0xcad7('0x14')]);}else{logger[_0xcad7('0xe')](_0xcad7('0x13'),_0x1f8b66,'request\x20sent');_0x1575a3(_0x304136[_0xcad7('0x15')][_0xcad7('0x14')]);}})[_0xcad7('0x16')](function(_0x28bd02){logger[_0xcad7('0x12')](_0xcad7('0x13'),_0x1f8b66,_0x28bd02);_0x42cfa2(_0x28bd02);});});}exports[_0xcad7('0x17')]=function(_0x3d9789){var _0x4701df=this;return new Promise(function(_0x3c2196,_0x426ce0){return db[_0xcad7('0x18')][_0xcad7('0x19')]({'raw':_0x3d9789[_0xcad7('0x1a')]?_0x3d9789[_0xcad7('0x1a')][_0xcad7('0x1b')]===undefined?!![]:![]:!![],'where':_0x3d9789[_0xcad7('0x1a')]?_0x3d9789[_0xcad7('0x1a')][_0xcad7('0x1c')]||null:null,'attributes':_0x3d9789['options']?_0x3d9789[_0xcad7('0x1a')][_0xcad7('0x1d')]||null:null,'include':_0x3d9789[_0xcad7('0x1a')]?_0x3d9789['options'][_0xcad7('0x1e')]?_[_0xcad7('0x1f')](_0x3d9789[_0xcad7('0x1a')]['include'],function(_0x40ade5){return{'model':db[_0x40ade5[_0xcad7('0x20')]],'as':_0x40ade5['as'],'attributes':_0x40ade5[_0xcad7('0x1d')],'include':_0x40ade5[_0xcad7('0x1e')]?_['map'](_0x40ade5[_0xcad7('0x1e')],function(_0x37f80f){return{'model':db[_0x37f80f[_0xcad7('0x20')]],'as':_0x37f80f['as'],'attributes':_0x37f80f[_0xcad7('0x1d')],'include':_0x37f80f[_0xcad7('0x1e')]?_[_0xcad7('0x1f')](_0x37f80f[_0xcad7('0x1e')],function(_0x215f49){return{'model':db[_0x215f49[_0xcad7('0x20')]],'as':_0x215f49['as'],'attributes':_0x215f49[_0xcad7('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x135b90){logger[_0xcad7('0xe')](_0xcad7('0x17'),_0x3d9789);logger['debug'](_0xcad7('0x17'),_0x3d9789,JSON['stringify'](_0x135b90));_0x3c2196(_0x135b90);})[_0xcad7('0x16')](function(_0x567e7a){logger[_0xcad7('0x12')](_0xcad7('0x17'),_0x567e7a['message'],_0x3d9789);_0x426ce0(_0x4701df[_0xcad7('0x12')](0x1f4,_0x567e7a[_0xcad7('0x14')]));});});}; \ No newline at end of file +var _0x5b93=['model','map','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','message','Pause,\x20%s,\x20%s','result','catch','ShowPause','Pause','options','raw','where','attributes','include'];(function(_0x30d14d,_0x5b7cdc){var _0x47054e=function(_0x3535f2){while(--_0x3535f2){_0x30d14d['push'](_0x30d14d['shift']());}};_0x47054e(++_0x5b7cdc);}(_0x5b93,0x152));var _0x35b9=function(_0x31a9ae,_0x6136dc){_0x31a9ae=_0x31a9ae-0x0;var _0xe36c38=_0x5b93[_0x31a9ae];return _0xe36c38;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x35b9('0x0'));var BPromise=require('bluebird');var rs=require(_0x35b9('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x35b9('0x2'));var logger=require(_0x35b9('0x3'))(_0x35b9('0x4'));var config=require(_0x35b9('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x35b9('0x6')][_0x35b9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x401890,_0x1df169,_0x47c468){return new BPromise(function(_0x19f652,_0x231f4e){return client['request'](_0x401890,_0x47c468)[_0x35b9('0x8')](function(_0x5ed1b2){logger[_0x35b9('0x9')]('Pause,\x20%s,\x20%s',_0x1df169,_0x35b9('0xa'));logger[_0x35b9('0xb')](_0x35b9('0xc'),_0x1df169,_0x35b9('0xa'),JSON[_0x35b9('0xd')](_0x5ed1b2));if(_0x5ed1b2[_0x35b9('0xe')]){if(_0x5ed1b2[_0x35b9('0xe')]['code']===0x1f4){logger[_0x35b9('0xe')]('Pause,\x20%s,\x20%s',_0x1df169,_0x5ed1b2['error'][_0x35b9('0xf')]);return _0x231f4e(_0x5ed1b2[_0x35b9('0xe')][_0x35b9('0xf')]);}logger['error'](_0x35b9('0x10'),_0x1df169,_0x5ed1b2[_0x35b9('0xe')]['message']);return _0x19f652(_0x5ed1b2['error']['message']);}else{logger[_0x35b9('0x9')]('Pause,\x20%s,\x20%s',_0x1df169,_0x35b9('0xa'));_0x19f652(_0x5ed1b2[_0x35b9('0x11')]['message']);}})[_0x35b9('0x12')](function(_0x24ce3e){logger[_0x35b9('0xe')]('Pause,\x20%s,\x20%s',_0x1df169,_0x24ce3e);_0x231f4e(_0x24ce3e);});});}exports[_0x35b9('0x13')]=function(_0x18487e){var _0x16aa19=this;return new Promise(function(_0x4cd276,_0x465a02){return db[_0x35b9('0x14')]['find']({'raw':_0x18487e[_0x35b9('0x15')]?_0x18487e[_0x35b9('0x15')][_0x35b9('0x16')]===undefined?!![]:![]:!![],'where':_0x18487e[_0x35b9('0x15')]?_0x18487e[_0x35b9('0x15')][_0x35b9('0x17')]||null:null,'attributes':_0x18487e[_0x35b9('0x15')]?_0x18487e['options'][_0x35b9('0x18')]||null:null,'include':_0x18487e[_0x35b9('0x15')]?_0x18487e[_0x35b9('0x15')]['include']?_['map'](_0x18487e[_0x35b9('0x15')][_0x35b9('0x19')],function(_0x14b906){return{'model':db[_0x14b906[_0x35b9('0x1a')]],'as':_0x14b906['as'],'attributes':_0x14b906[_0x35b9('0x18')],'include':_0x14b906[_0x35b9('0x19')]?_[_0x35b9('0x1b')](_0x14b906['include'],function(_0x576449){return{'model':db[_0x576449[_0x35b9('0x1a')]],'as':_0x576449['as'],'attributes':_0x576449[_0x35b9('0x18')],'include':_0x576449['include']?_['map'](_0x576449[_0x35b9('0x19')],function(_0x2216c6){return{'model':db[_0x2216c6[_0x35b9('0x1a')]],'as':_0x2216c6['as'],'attributes':_0x2216c6[_0x35b9('0x18')]};}):[]};}):[]};}):[]:[]})[_0x35b9('0x8')](function(_0x574f40){logger[_0x35b9('0x9')](_0x35b9('0x13'),_0x18487e);logger[_0x35b9('0xb')]('ShowPause',_0x18487e,JSON[_0x35b9('0xd')](_0x574f40));_0x4cd276(_0x574f40);})[_0x35b9('0x12')](function(_0x3938d9){logger['error'](_0x35b9('0x13'),_0x3938d9[_0x35b9('0xf')],_0x18487e);_0x465a02(_0x16aa19[_0x35b9('0xe')](0x1f4,_0x3938d9['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index d3593c9..8a5cf2a 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 _0x28f2=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','isAuthenticated','index','/webhook','show','/:id/download','download','join','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','/:id','delete','exports','multer','util','path'];(function(_0x454bd6,_0x5662ea){var _0x132a84=function(_0xf4b4e2){while(--_0xf4b4e2){_0x454bd6['push'](_0x454bd6['shift']());}};_0x132a84(++_0x5662ea);}(_0x28f2,0x81));var _0x228f=function(_0x23774e,_0x50bd36){_0x23774e=_0x23774e-0x0;var _0x21882f=_0x28f2[_0x23774e];return _0x21882f;};'use strict';var multer=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var path=require(_0x228f('0x2'));var timeout=require(_0x228f('0x3'));var express=require(_0x228f('0x4'));var router=express[_0x228f('0x5')]();var auth=require(_0x228f('0x6'));var interaction=require(_0x228f('0x7'));var config=require('../../config/environment');var controller=require(_0x228f('0x8'));router[_0x228f('0x9')]('/',auth[_0x228f('0xa')](),controller[_0x228f('0xb')]);router[_0x228f('0x9')](_0x228f('0xc'),controller['webhookGet']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x228f('0xd')]);router[_0x228f('0x9')](_0x228f('0xe'),auth[_0x228f('0xa')](),controller[_0x228f('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x52f37a,_0x5518c9,_0x2b34b1){_0x2b34b1(null,path[_0x228f('0x10')](config['root'],_0x228f('0x11')));},'filename':function(_0x19c6d3,_0x238507,_0x112d37){_0x238507[_0x228f('0x12')]=_0x238507[_0x228f('0x12')][_0x228f('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x112d37(null,util['format'](_0x228f('0x14'),path[_0x228f('0x15')](_0x238507['originalname'],path[_0x228f('0x16')](_0x238507['originalname'])),Date[_0x228f('0x17')](),path[_0x228f('0x16')](_0x238507[_0x228f('0x12')])));}})});router[_0x228f('0x18')]('/',upload[_0x228f('0x19')](_0x228f('0x1a')),controller[_0x228f('0x1b')]);router[_0x228f('0x18')](_0x228f('0xc'),controller[_0x228f('0x1c')]);router[_0x228f('0x1d')](_0x228f('0x1e'),auth[_0x228f('0xa')](),controller['update']);router[_0x228f('0x1f')](_0x228f('0x1e'),auth[_0x228f('0xa')](),controller[_0x228f('0x1f')]);module[_0x228f('0x20')]=router; \ No newline at end of file +var _0x82c8=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','index','get','/webhook','webhookGet','/:id','isAuthenticated','/:id/download','download','diskStorage','join','server/files/plugins','originalname','%s-%s%s','basename','now','single','file','upload','webhookPost'];(function(_0x5514c7,_0x4959f3){var _0x3bd1ad=function(_0x4f63f0){while(--_0x4f63f0){_0x5514c7['push'](_0x5514c7['shift']());}};_0x3bd1ad(++_0x4959f3);}(_0x82c8,0x1b1));var _0x882c=function(_0x2f030d,_0x3a70dc){_0x2f030d=_0x2f030d-0x0;var _0xaba79d=_0x82c8[_0x2f030d];return _0xaba79d;};'use strict';var multer=require(_0x882c('0x0'));var util=require(_0x882c('0x1'));var path=require(_0x882c('0x2'));var timeout=require(_0x882c('0x3'));var express=require(_0x882c('0x4'));var router=express[_0x882c('0x5')]();var auth=require(_0x882c('0x6'));var interaction=require(_0x882c('0x7'));var config=require(_0x882c('0x8'));var controller=require(_0x882c('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x882c('0xa')]);router[_0x882c('0xb')](_0x882c('0xc'),controller[_0x882c('0xd')]);router[_0x882c('0xb')](_0x882c('0xe'),auth[_0x882c('0xf')](),controller['show']);router[_0x882c('0xb')](_0x882c('0x10'),auth[_0x882c('0xf')](),controller[_0x882c('0x11')]);var upload=multer({'storage':multer[_0x882c('0x12')]({'destination':function(_0x3b575a,_0x31e59b,_0x28ede4){_0x28ede4(null,path[_0x882c('0x13')](config['root'],_0x882c('0x14')));},'filename':function(_0x200cb9,_0x2a54c3,_0x4fc9b6){_0x2a54c3[_0x882c('0x15')]=_0x2a54c3[_0x882c('0x15')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4fc9b6(null,util['format'](_0x882c('0x16'),path[_0x882c('0x17')](_0x2a54c3[_0x882c('0x15')],path['extname'](_0x2a54c3[_0x882c('0x15')])),Date[_0x882c('0x18')](),path['extname'](_0x2a54c3[_0x882c('0x15')])));}})});router['post']('/',upload[_0x882c('0x19')](_0x882c('0x1a')),controller[_0x882c('0x1b')]);router['post'](_0x882c('0xc'),controller[_0x882c('0x1c')]);router[_0x882c('0x1d')](_0x882c('0xe'),auth[_0x882c('0xf')](),controller[_0x882c('0x1e')]);router[_0x882c('0x1f')]('/:id',auth[_0x882c('0xf')](),controller[_0x882c('0x1f')]);module[_0x882c('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index a0b2871..fb428e3 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 _0x26ed=['agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x51f7a3,_0x3f9940){var _0x174039=function(_0x4bf86e){while(--_0x4bf86e){_0x51f7a3['push'](_0x51f7a3['shift']());}};_0x174039(++_0x3f9940);}(_0x26ed,0x1f0));var _0xd26e=function(_0x27842c,_0x324fcb){_0x27842c=_0x27842c-0x0;var _0x493de8=_0x26ed[_0x27842c];return _0x493de8;};'use strict';var Sequelize=require(_0xd26e('0x0'));module['exports']={'name':{'type':Sequelize[_0xd26e('0x1')]},'type':{'type':Sequelize[_0xd26e('0x2')]('html',_0xd26e('0x3'))},'description':{'type':Sequelize[_0xd26e('0x4')]},'version':{'type':Sequelize[_0xd26e('0x4')]},'path':{'type':Sequelize[_0xd26e('0x1')],'comment':_0xd26e('0x5')},'active':{'type':Sequelize[_0xd26e('0x6')],'defaultValue':0x0,'comment':_0xd26e('0x7')},'sidebar':{'type':Sequelize[_0xd26e('0x2')]('adminOnly',_0xd26e('0x8'),_0xd26e('0x9'),_0xd26e('0xa')),'defaultValue':_0xd26e('0x9'),'comment':_0xd26e('0xb')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xd26e('0x1')]},'agentUrl':{'type':Sequelize[_0xd26e('0x1')]},'scriptName':{'type':Sequelize[_0xd26e('0x1')]},'scriptPath':{'type':Sequelize[_0xd26e('0x1')]}}; \ No newline at end of file +var _0x9d8d=['BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x9d8d,0x1f2));var _0xd9d8=function(_0x409f70,_0x4be9ba){_0x409f70=_0x409f70-0x0;var _0x348b15=_0x9d8d[_0x409f70];return _0x348b15;};'use strict';var Sequelize=require('sequelize');module[_0xd9d8('0x0')]={'name':{'type':Sequelize[_0xd9d8('0x1')]},'type':{'type':Sequelize[_0xd9d8('0x2')](_0xd9d8('0x3'),'script')},'description':{'type':Sequelize[_0xd9d8('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0xd9d8('0x5')},'active':{'type':Sequelize[_0xd9d8('0x6')],'defaultValue':0x0,'comment':_0xd9d8('0x7')},'sidebar':{'type':Sequelize['ENUM']('adminOnly',_0xd9d8('0x8'),_0xd9d8('0x9'),_0xd9d8('0xa')),'defaultValue':_0xd9d8('0x9'),'comment':_0xd9d8('0xb')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xd9d8('0x1')]},'agentUrl':{'type':Sequelize[_0xd9d8('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index f9d3013..1ee0236 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 _0x6444=['set','apply','reject','save','update','destroy','then','get','Plugins','UserProfileResource','sendStatus','error','stack','send','map','Plugin','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','download','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','root','server/files/plugins','dirname','node_modules/**/*','join','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','lstatSync','Invalid\x20plugin\x20structure','isDirectory','manifest.json','Plugin\x20manifest\x20missing','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20no\x20view\x20specified','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','script','scriptPath','create','body','role','userProfileId','user','UserProfileSection','autoAssociation','Zip\x20archive\x20removed','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-type','endsWith','statusCode','content-length','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./plugin.socket','register','status','end','json','count','offset','limit'];(function(_0x3bfc1a,_0x2aee03){var _0x29a176=function(_0x1904b3){while(--_0x1904b3){_0x3bfc1a['push'](_0x3bfc1a['shift']());}};_0x29a176(++_0x2aee03);}(_0x6444,0x87));var _0x4644=function(_0x23ff2a,_0x1d692c){_0x23ff2a=_0x23ff2a-0x0;var _0x4c0753=_0x6444[_0x23ff2a];return _0x4c0753;};'use strict';var pdf=require(_0x4644('0x0'));var emlformat=require(_0x4644('0x1'));var rimraf=require(_0x4644('0x2'));var zipdir=require(_0x4644('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4644('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4644('0x5'));var util=require(_0x4644('0x6'));var path=require(_0x4644('0x7'));var sox=require('sox');var csv=require(_0x4644('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x4644('0x9'));var crypto=require(_0x4644('0xa'));var jsforce=require(_0x4644('0xb'));var deskjs=require(_0x4644('0xc'));var toCsv=require(_0x4644('0x8'));var querystring=require(_0x4644('0xd'));var Papa=require(_0x4644('0xe'));var extract=require(_0x4644('0xf'));var rimraf=require(_0x4644('0x2'));var archiver=require('archiver');var Redis=require(_0x4644('0x10'));var authService=require(_0x4644('0x11'));var qs=require(_0x4644('0x12'));var as=require(_0x4644('0x13'));var hardwareService=require(_0x4644('0x14'));var logger=require(_0x4644('0x15'))(_0x4644('0x16'));var utils=require(_0x4644('0x17'));var config=require(_0x4644('0x18'));var db=require(_0x4644('0x19'))['db'];config[_0x4644('0x1a')]=_[_0x4644('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4644('0x1c'))(new Redis(config[_0x4644('0x1a')]));require(_0x4644('0x1d'))[_0x4644('0x1e')](socket);function respondWithStatusCode(_0x23e219,_0x1331f5){_0x1331f5=_0x1331f5||0xcc;return function(_0x29e131){if(_0x29e131){return _0x23e219['sendStatus'](_0x1331f5);}return _0x23e219[_0x4644('0x1f')](_0x1331f5)[_0x4644('0x20')]();};}function respondWithResult(_0x49a102,_0x2bb5f2){_0x2bb5f2=_0x2bb5f2||0xc8;return function(_0x1c4acb){if(_0x1c4acb){return _0x49a102['status'](_0x2bb5f2)[_0x4644('0x21')](_0x1c4acb);}};}function respondWithFilteredResult(_0x3a5b4f,_0x29c5c7){return function(_0x31a85d){if(_0x31a85d){var _0x2025d7=_0x31a85d[_0x4644('0x22')],_0x4f6f5f=_0x29c5c7[_0x4644('0x23')],_0x44e1de=_0x29c5c7[_0x4644('0x23')]+_0x29c5c7[_0x4644('0x24')],_0xdd90ec;if(_0x44e1de>=_0x2025d7){_0x44e1de=_0x2025d7;_0xdd90ec=0xc8;}else{_0xdd90ec=0xce;}_0x3a5b4f[_0x4644('0x1f')](_0xdd90ec);return _0x3a5b4f[_0x4644('0x25')]('Content-Range',_0x4f6f5f+'-'+_0x44e1de+'/'+_0x2025d7)['json'](_0x31a85d);}return null;};}function patchUpdates(_0x3b86fc){return function(_0x2b96ce){try{jsonpatch[_0x4644('0x26')](_0x2b96ce,_0x3b86fc,!![]);}catch(_0x1c92c8){return BPromise[_0x4644('0x27')](_0x1c92c8);}return _0x2b96ce[_0x4644('0x28')]();};}function saveUpdates(_0x4f182b,_0x57b6d0){return function(_0x5cb95f){if(_0x5cb95f){return _0x5cb95f[_0x4644('0x29')](_0x4f182b)['then'](function(_0x56d6fb){return _0x56d6fb;});}return null;};}function removeEntity(_0x5b5cce,_0x32e633){return function(_0x55c949){if(_0x55c949){return _0x55c949[_0x4644('0x2a')]()[_0x4644('0x2b')](function(){var _0x55f076=_0x55c949[_0x4644('0x2c')]({'plain':!![]});var _0x3e4d02=_0x4644('0x2d');return db[_0x4644('0x2e')]['destroy']({'where':{'type':_0x3e4d02,'resourceId':_0x55f076['id']}})[_0x4644('0x2b')](function(){return _0x55c949;});})[_0x4644('0x2b')](function(){_0x5b5cce[_0x4644('0x1f')](0xcc)[_0x4644('0x20')]();});}};}function handleEntityNotFound(_0x342488,_0x18d123){return function(_0xe10ab3){if(!_0xe10ab3){_0x342488[_0x4644('0x2f')](0x194);}return _0xe10ab3;};}function handleError(_0x525256,_0x242e19){_0x242e19=_0x242e19||0x1f4;return function(_0x47486f){logger[_0x4644('0x30')](_0x47486f[_0x4644('0x31')]);if(_0x47486f['name']){delete _0x47486f['name'];}_0x525256[_0x4644('0x1f')](_0x242e19)[_0x4644('0x32')](_0x47486f);};}exports['index']=function(_0x18793a,_0x1e436c){var _0x58c853={},_0xcb2c2c={},_0x2acc97={'count':0x0,'rows':[]};var _0x3457eb=_[_0x4644('0x33')](db[_0x4644('0x34')][_0x4644('0x35')],function(_0x3722fb){return{'name':_0x3722fb[_0x4644('0x36')],'type':_0x3722fb[_0x4644('0x37')][_0x4644('0x38')]};});_0xcb2c2c[_0x4644('0x39')]=_['map'](_0x3457eb,_0x4644('0x3a'));_0xcb2c2c['query']=_[_0x4644('0x3b')](_0x18793a[_0x4644('0x3c')]);_0xcb2c2c[_0x4644('0x3d')]=_[_0x4644('0x3e')](_0xcb2c2c[_0x4644('0x39')],_0xcb2c2c[_0x4644('0x3c')]);_0x58c853[_0x4644('0x3f')]=_[_0x4644('0x3e')](_0xcb2c2c['model'],qs[_0x4644('0x40')](_0x18793a['query'][_0x4644('0x40')]));_0x58c853['attributes']=_0x58c853[_0x4644('0x3f')]['length']?_0x58c853['attributes']:_0xcb2c2c[_0x4644('0x39')];if(!_0x18793a[_0x4644('0x3c')][_0x4644('0x41')](_0x4644('0x42'))){_0x58c853[_0x4644('0x24')]=qs[_0x4644('0x24')](_0x18793a['query'][_0x4644('0x24')]);_0x58c853[_0x4644('0x23')]=qs[_0x4644('0x23')](_0x18793a[_0x4644('0x3c')][_0x4644('0x23')]);}_0x58c853[_0x4644('0x43')]=qs['sort'](_0x18793a[_0x4644('0x3c')][_0x4644('0x44')]);_0x58c853[_0x4644('0x45')]=qs['filters'](_[_0x4644('0x46')](_0x18793a[_0x4644('0x3c')],_0xcb2c2c['filters']),_0x3457eb);if(_0x18793a[_0x4644('0x3c')][_0x4644('0x47')]){_0x58c853[_0x4644('0x45')]=_['merge'](_0x58c853[_0x4644('0x45')],{'$or':_[_0x4644('0x33')](_0x3457eb,function(_0x27aa60){if(_0x27aa60['type']!==_0x4644('0x48')){var _0x26991a={};_0x26991a[_0x27aa60[_0x4644('0x3a')]]={'$like':'%'+_0x18793a[_0x4644('0x3c')]['filter']+'%'};return _0x26991a;}})});}_0x58c853=_[_0x4644('0x49')]({},_0x58c853,_0x18793a[_0x4644('0x4a')]);var _0x2eec7c={'where':_0x58c853[_0x4644('0x45')]};return db[_0x4644('0x34')][_0x4644('0x22')](_0x2eec7c)[_0x4644('0x2b')](function(_0x3cdf04){_0x2acc97[_0x4644('0x22')]=_0x3cdf04;if(_0x18793a['query'][_0x4644('0x4b')]){_0x58c853[_0x4644('0x4c')]=[{'all':!![]}];}return db[_0x4644('0x34')][_0x4644('0x4d')](_0x58c853);})[_0x4644('0x2b')](function(_0xf46e60){_0x2acc97[_0x4644('0x4e')]=_0xf46e60;return _0x2acc97;})[_0x4644('0x2b')](respondWithFilteredResult(_0x1e436c,_0x58c853))[_0x4644('0x4f')](handleError(_0x1e436c,null));};exports[_0x4644('0x50')]=function(_0x5a0b38,_0x8570d9){var _0x31492e={'raw':!![],'where':{'id':_0x5a0b38[_0x4644('0x51')]['id']}},_0x1e965a={};_0x1e965a[_0x4644('0x39')]=_[_0x4644('0x3b')](db[_0x4644('0x34')][_0x4644('0x35')]);_0x1e965a[_0x4644('0x3c')]=_['keys'](_0x5a0b38[_0x4644('0x3c')]);_0x1e965a[_0x4644('0x3d')]=_['intersection'](_0x1e965a[_0x4644('0x39')],_0x1e965a[_0x4644('0x3c')]);_0x31492e['attributes']=_['intersection'](_0x1e965a[_0x4644('0x39')],qs['fields'](_0x5a0b38['query'][_0x4644('0x40')]));_0x31492e['attributes']=_0x31492e[_0x4644('0x3f')][_0x4644('0x52')]?_0x31492e[_0x4644('0x3f')]:_0x1e965a[_0x4644('0x39')];if(_0x5a0b38[_0x4644('0x3c')][_0x4644('0x4b')]){_0x31492e[_0x4644('0x4c')]=[{'all':!![]}];}_0x31492e=_['merge']({},_0x31492e,_0x5a0b38[_0x4644('0x4a')]);return db[_0x4644('0x34')][_0x4644('0x53')](_0x31492e)[_0x4644('0x2b')](handleEntityNotFound(_0x8570d9,null))[_0x4644('0x2b')](respondWithResult(_0x8570d9,null))[_0x4644('0x4f')](handleError(_0x8570d9,null));};exports[_0x4644('0x54')]=function(_0x45339e,_0x46e07d,_0x41e01c){return db[_0x4644('0x34')]['find']({'where':{'id':_0x45339e['params']['id']},'attributes':[_0x4644('0x3a'),_0x4644('0x7')],'raw':!![]})[_0x4644('0x2b')](handleEntityNotFound(_0x46e07d,null))['then'](function(_0x2a6ee8){if(_0x2a6ee8){var _0x568e97=path['join'](config['root'],'server/files/plugins',util[_0x4644('0x55')](_0x4644('0x56'),path[_0x4644('0x57')](_0x2a6ee8[_0x4644('0x7')])));var _0x2d343b=fs[_0x4644('0x58')](_0x568e97);var _0x384464=archiver(_0x4644('0x59'),{'zlib':{'level':0x9}});_0x384464['on'](_0x4644('0x5a'),function(_0x30b25e){if(_0x30b25e[_0x4644('0x5b')]===_0x4644('0x5c')){logger[_0x4644('0x30')](_0x30b25e);}else{throw new db[(_0x4644('0x5d'))][(_0x4644('0x5e'))](_0x4644('0x5f'));}});_0x384464['on'](_0x4644('0x30'),function(_0x2272ad){throw new db[(_0x4644('0x5d'))][(_0x4644('0x5e'))](_0x4644('0x5f'));});_0x384464['pipe'](_0x2d343b);_0x384464[_0x4644('0x60')]('**/*',{'cwd':path['join'](config[_0x4644('0x61')],_0x4644('0x62'),path[_0x4644('0x63')](_0x2a6ee8[_0x4644('0x7')])),'ignore':[path['join'](path[_0x4644('0x57')](_0x2a6ee8[_0x4644('0x7')]),_0x4644('0x64')),path[_0x4644('0x65')](path[_0x4644('0x57')](_0x2a6ee8[_0x4644('0x7')]),_0x4644('0x66'))],'nodir':!![]})[_0x4644('0x67')]();_0x2d343b['on'](_0x4644('0x68'),function(){if(!fs[_0x4644('0x69')](_0x568e97)){throw new db['Sequelize'][(_0x4644('0x5e'))](_0x4644('0x6a'));}return _0x46e07d['download'](_0x568e97,util[_0x4644('0x55')]('%s.zip',path['basename'](_0x2a6ee8['path'])),function(_0x5482fe){if(_0x5482fe){throw new db[(_0x4644('0x5d'))][(_0x4644('0x5e'))](_0x4644('0x6b'));}fs[_0x4644('0x6c')](_0x568e97);logger[_0x4644('0x6d')](_0x4644('0x6e'));logger[_0x4644('0x6d')](_0x4644('0x6f'));});});}return null;})[_0x4644('0x4f')](handleError(_0x46e07d,null));};exports[_0x4644('0x70')]=function(_0x4b318d,_0x522f93,_0x5adff4){var _0x47a93c=path[_0x4644('0x57')](_0x4b318d['file'][_0x4644('0x71')],path[_0x4644('0x72')](_0x4b318d[_0x4644('0x73')][_0x4644('0x71')]));var _0x2d4821=path['join'](config[_0x4644('0x61')],'server/files/plugins',_0x4b318d[_0x4644('0x73')][_0x4644('0x71')]);var _0x4a5936=path['join'](config[_0x4644('0x61')],'server/files/plugins',_0x47a93c);logger['info'](_0x4644('0x74'),_0x2d4821);logger[_0x4644('0x6d')](_0x4644('0x75'),_0x4a5936);try{fs[_0x4644('0x76')](_0x2d4821,parseInt(_0x4644('0x77'),0x8));extract(_0x2d4821,{'dir':_0x4a5936},function(_0x2dc266){if(_0x2dc266){logger[_0x4644('0x30')](_0x2dc266);handleError(_0x2dc266,!![]);};var _0x4a85bf=fs[_0x4644('0x78')](_0x4a5936);if(_0x4a85bf[_0x4644('0x52')]>0x1){removeReferences(_0x2d4821,_0x4a5936);logger[_0x4644('0x30')]('Invalid\x20plugin\x20structure');return _0x5adff4(new Error('Invalid\x20plugin\x20structure'));}var _0x2ce068=fs[_0x4644('0x79')](path[_0x4644('0x65')](_0x4a5936,_0x4a85bf[0x0]));if(_0x2ce068['isFile']()){removeReferences(_0x2d4821,_0x4a5936);logger['error']('Invalid\x20plugin\x20structure');return _0x5adff4(new Error(_0x4644('0x7a')));}if(_0x2ce068[_0x4644('0x7b')]()){var _0x4f804f=fs[_0x4644('0x78')](path['join'](_0x4a5936,_0x4a85bf[0x0]));if(_0x4f804f[_0x4644('0x52')]===0x0){removeReferences(_0x2d4821,_0x4a5936);logger['error'](_0x4644('0x7a'));return _0x5adff4(new Error(_0x4644('0x7a')));}var _0x344cd1=_0x4f804f['some'](function(_0x477365){return _0x477365===_0x4644('0x7c');});if(!_0x344cd1){return _0x5adff4(new Error(_0x4644('0x7d')));}var _0x2add9c=fs['readFileSync'](path[_0x4644('0x65')](_0x4a5936,_0x4a85bf[0x0],_0x4644('0x7c')));var _0xf8907=JSON[_0x4644('0x7e')](_0x2add9c);if(_0x4644('0x7f')==typeof _0xf8907[_0x4644('0x3a')]){return _0x5adff4(new Error(_0x4644('0x80')));}if(_0x4644('0x7f')==typeof _0xf8907['type']){return _0x5adff4(new Error(_0x4644('0x81')));}if('undefined'==typeof _0xf8907[_0x4644('0x82')]){return _0x5adff4(new Error(_0x4644('0x83')));}if('undefined'==typeof _0xf8907[_0x4644('0x84')]){return _0x5adff4(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0xf8907[_0x4644('0x37')]===_0x4644('0x85')){if(_0x4644('0x7f')==typeof _0xf8907[_0x4644('0x84')][_0x4644('0x86')]){return _0x5adff4(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x4644('0x7f')==typeof _0xf8907[_0x4644('0x84')]['views']['admin']&&_0x4644('0x7f')==typeof _0xf8907['parameters'][_0x4644('0x86')]['agent']){return _0x5adff4(new Error(_0x4644('0x87')));}}else if(_0xf8907[_0x4644('0x37')]==='script'){if('undefined'==typeof _0xf8907['parameters']['scriptName']){return _0x5adff4(new Error(_0x4644('0x88')));}if(_0x4644('0x7f')==typeof _0xf8907[_0x4644('0x84')]['scriptPath']){return _0x5adff4(new Error(_0x4644('0x89')));}}else{return _0x5adff4(new Error(_0x4644('0x8a')));}var _0x54bea2=_0xf8907['name'];var _0x1425d2=_0xf8907['description'];var _0xc0a9a5=_0xf8907[_0x4644('0x37')];var _0x215683=_0xf8907['sidebar']?_0xf8907['sidebar']:_0x4644('0x8b');var _0x5c9479=_0xf8907[_0x4644('0x8c')]?_0xf8907[_0x4644('0x8c')]:_0x4644('0x8d');var _0x488b10='';var _0x5d3fa='';var _0x43ba8b='';var _0x113e26='';var _0x406c7b=_0xf8907['version'];if(_0xc0a9a5===_0x4644('0x85')){if(_0x4644('0x7f')!=typeof _0xf8907[_0x4644('0x84')][_0x4644('0x86')]['admin']){var _0x24df7e=_0xf8907[_0x4644('0x84')][_0x4644('0x86')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x4644('0x8e')](_0x24df7e)){_0x488b10=path['join'](_0x4644('0x8f'),_0x47a93c,_0x4a85bf[0x0],_0x24df7e);}else{_0x488b10=_0x24df7e;}}else{logger[_0x4644('0x6d')](_0x4644('0x90'));}if('undefined'!=typeof _0xf8907[_0x4644('0x84')]['views'][_0x4644('0x91')]){var _0x42f2f9=_0xf8907[_0x4644('0x84')]['views'][_0x4644('0x91')];if(!/^(f|ht)tps?:\/\//i['test'](_0x42f2f9)){_0x5d3fa=path[_0x4644('0x65')](_0x4644('0x8f'),_0x47a93c,_0x4a85bf[0x0],_0x42f2f9);}else{_0x5d3fa=_0x42f2f9;}}else{logger[_0x4644('0x6d')](_0x4644('0x92'));}}else if(_0xc0a9a5===_0x4644('0x93')){_0x43ba8b=_0xf8907[_0x4644('0x84')]['scriptName'];_0x113e26=_0xf8907[_0x4644('0x84')][_0x4644('0x94')];if(_0x4644('0x7f')!=typeof _0xf8907[_0x4644('0x84')][_0x4644('0x86')]){if(_0x4644('0x7f')!=typeof _0xf8907[_0x4644('0x84')][_0x4644('0x86')]['admin']){var _0x24df7e=_0xf8907[_0x4644('0x84')][_0x4644('0x86')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x4644('0x8e')](_0x24df7e)){_0x488b10=path[_0x4644('0x65')](_0x4644('0x8f'),_0x47a93c,_0x4a85bf[0x0],_0x24df7e);}else{_0x488b10=_0x24df7e;}}if(_0x4644('0x7f')!=typeof _0xf8907[_0x4644('0x84')]['views'][_0x4644('0x91')]){var _0x42f2f9=_0xf8907['parameters'][_0x4644('0x86')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x4644('0x8e')](_0x42f2f9)){_0x5d3fa=path['join'](_0x4644('0x8f'),_0x47a93c,_0x4a85bf[0x0],_0x42f2f9);}else{_0x5d3fa=_0x42f2f9;}}}}var _0xb17fee={'name':_0x54bea2,'description':_0x1425d2,'path':path[_0x4644('0x65')](_0x47a93c,_0x4a85bf[0x0]),'type':_0xc0a9a5,'sidebar':_0x215683,'icon':_0x5c9479,'adminUrl':_0x488b10,'agentUrl':_0x5d3fa,'scriptName':_0x43ba8b,'scriptPath':_0x113e26,'version':_0x406c7b};removeReferences(_0x2d4821,null);return db[_0x4644('0x34')][_0x4644('0x95')](_0xb17fee)[_0x4644('0x2b')](function(_0x22a1c3){var _0x365f43={'role':_0x4b318d[_0x4644('0x96')][_0x4644('0x97')],'userProfileId':_0x4b318d[_0x4644('0x96')][_0x4644('0x98')]};if(!_0x365f43)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x365f43[_0x4644('0x97')]===_0x4644('0x99')){var _0x1c9542=_0x22a1c3[_0x4644('0x2c')]({'plain':!![]});return db[_0x4644('0x9a')][_0x4644('0x53')]({'where':{'name':_0x4644('0x2d'),'userProfileId':_0x365f43[_0x4644('0x98')]},'raw':!![]})[_0x4644('0x2b')](function(_0xbff3d2){if(_0xbff3d2&&_0xbff3d2[_0x4644('0x9b')]===0x0){return db[_0x4644('0x2e')][_0x4644('0x95')]({'name':_0x1c9542[_0x4644('0x3a')],'resourceId':_0x1c9542['id'],'type':_0xbff3d2['name'],'sectionId':_0xbff3d2['id']},{})[_0x4644('0x2b')](function(){return _0x22a1c3;});}else{return _0x22a1c3;}})['catch'](function(_0x17c498){logger[_0x4644('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17c498);throw _0x17c498;});}return _0x22a1c3;})[_0x4644('0x2b')](respondWithResult(_0x522f93,null))[_0x4644('0x4f')](handleError(_0x522f93,null));}});}catch(_0x5aa1d1){_0x522f93[_0x4644('0x1f')](0x1f4)[_0x4644('0x32')](_0x5aa1d1);}};function removeReferences(_0x33c455,_0x513073){try{if(_0x33c455){fs[_0x4644('0x6c')](_0x33c455);logger['info'](_0x4644('0x9c'));}if(_0x513073){rimraf(_0x513073,function(){});logger[_0x4644('0x6d')]('Extracted\x20folder\x20removed');}}catch(_0x2b5c5d){logger[_0x4644('0x30')](_0x2b5c5d);}}exports[_0x4644('0x29')]=function(_0x56f6de,_0xdab8a0,_0x44ae2a){return db[_0x4644('0x34')][_0x4644('0x53')]({'where':{'id':_0x56f6de[_0x4644('0x51')]['id']}})[_0x4644('0x2b')](handleEntityNotFound(_0xdab8a0,null))[_0x4644('0x2b')](saveUpdates(_0x56f6de[_0x4644('0x96')],null))['then'](respondWithResult(_0xdab8a0,null))[_0x4644('0x4f')](handleError(_0xdab8a0,null));};exports['delete']=function(_0xe5ea0d,_0x1b4be8,_0x5912e2){return db[_0x4644('0x34')][_0x4644('0x53')]({'where':{'id':_0xe5ea0d['params']['id']}})[_0x4644('0x2b')](function(_0x4f1e2e){if(_0x4f1e2e){return _0x4f1e2e[_0x4644('0x2a')]();}})[_0x4644('0x2b')](function(_0x233de2){rimraf(path[_0x4644('0x65')](config[_0x4644('0x61')],_0x4644('0x62'),path[_0x4644('0x63')](_0x233de2[_0x4644('0x7')])),function(){});return _0x233de2;})[_0x4644('0x2b')](handleEntityNotFound(_0x1b4be8,null))[_0x4644('0x2b')](respondWithStatusCode(_0x1b4be8,null))[_0x4644('0x4f')](handleError(_0x1b4be8,null));};exports[_0x4644('0x9d')]=function(_0x5e5cbe,_0x4e7ef6,_0x30bc7e){return BPromise[_0x4644('0x9e')]()['then'](function(){if(!_0x5e5cbe[_0x4644('0x3c')][_0x4644('0x7')]){throw new Error(_0x4644('0x9f'));}if(!_0x5e5cbe[_0x4644('0x3c')]['port']){throw new Error(_0x4644('0xa0'));}var _0x4f7e77=_0x5e5cbe[_0x4644('0x3c')]['hostname']?_0x5e5cbe[_0x4644('0x3c')][_0x4644('0xa1')]+':'+_0x5e5cbe[_0x4644('0x3c')][_0x4644('0xa2')]:_0x4644('0xa3')+_0x5e5cbe[_0x4644('0x3c')][_0x4644('0xa2')];var _0x1f36fb=_0x5e5cbe[_0x4644('0x3c')][_0x4644('0x21')]?_0x5e5cbe['query'][_0x4644('0x21')]:!![];var _0x5282b4=_0x5e5cbe[_0x4644('0x3c')]['encoding']?_0x5e5cbe['query'][_0x4644('0xa4')]:null;var _0x844d27={'method':_0x5e5cbe[_0x4644('0xa5')],'uri':util[_0x4644('0x55')](_0x4644('0xa6'),_0x4f7e77,_0x5e5cbe[_0x4644('0x3c')][_0x4644('0x7')]),'json':_0x1f36fb,'resolveWithFullResponse':!![],'encoding':_0x5282b4,'qs':_0x5e5cbe['query']};if(_0x5e5cbe[_0x4644('0xa7')]){_0x844d27[_0x4644('0xa7')]=_0x5e5cbe['headers'];if(_0x844d27[_0x4644('0xa7')]['content-length']){delete _0x844d27[_0x4644('0xa7')]['content-length'];}}if(_0x844d27[_0x4644('0xa7')][_0x4644('0xa8')]){delete _0x844d27[_0x4644('0xa7')]['content-type'];}return rp(_0x844d27);})[_0x4644('0x2b')](function(_0x23e849){if(_0x23e849){_0x4e7ef6[_0x4644('0x25')](_0x23e849[_0x4644('0xa7')]);logger[_0x4644('0x6d')](_0x23e849[_0x4644('0x96')]);if(_[_0x4644('0xa9')](_0x5e5cbe[_0x4644('0x3c')][_0x4644('0x7')],'download')&&_0x23e849[_0x4644('0xaa')]==0x1f4){return _0x4e7ef6[_0x4644('0x2f')](_0x23e849[_0x4644('0xaa')]);}else{return _0x4e7ef6['status'](_0x23e849[_0x4644('0xaa')])[_0x4644('0x32')](_0x23e849[_0x4644('0x96')]);}}else{return _0x4e7ef6[_0x4644('0x2f')](0xc8);}})[_0x4644('0x4f')](handleError(_0x4e7ef6,null));};exports['webhookPost']=function(_0x4c24fd,_0x139bd0,_0x29323c){return BPromise['resolve']()[_0x4644('0x2b')](function(){if(!_0x4c24fd[_0x4644('0x3c')][_0x4644('0x7')]){throw new Error(_0x4644('0x9f'));}if(!_0x4c24fd[_0x4644('0x3c')][_0x4644('0xa2')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x51bca4=_0x4c24fd[_0x4644('0x3c')][_0x4644('0xa1')]?_0x4c24fd[_0x4644('0x3c')][_0x4644('0xa1')]+':'+_0x4c24fd[_0x4644('0x3c')][_0x4644('0xa2')]:'http://localhost:'+_0x4c24fd['query'][_0x4644('0xa2')];var _0x154dea=_0x4c24fd[_0x4644('0x3c')][_0x4644('0x21')]?_0x4c24fd[_0x4644('0x3c')][_0x4644('0x21')]:!![];var _0x446c5c=_0x4c24fd['query'][_0x4644('0xa4')]?_0x4c24fd[_0x4644('0x3c')]['encoding']:null;var _0x28ee9c={'method':_0x4c24fd[_0x4644('0xa5')],'uri':util[_0x4644('0x55')]('%s%s',_0x51bca4,_0x4c24fd[_0x4644('0x3c')]['path']),'json':_0x154dea,'resolveWithFullResponse':!![],'encoding':_0x446c5c,'body':_0x4c24fd['body']};if(_0x4c24fd[_0x4644('0xa7')]){_0x28ee9c[_0x4644('0xa7')]=_0x4c24fd[_0x4644('0xa7')];if(_0x28ee9c[_0x4644('0xa7')][_0x4644('0xab')]){delete _0x28ee9c[_0x4644('0xa7')][_0x4644('0xab')];}}if(_0x28ee9c['headers'][_0x4644('0xa8')]){delete _0x28ee9c[_0x4644('0xa7')][_0x4644('0xa8')];}return rp(_0x28ee9c);})[_0x4644('0x2b')](function(_0x376091){if(_0x376091){_0x139bd0[_0x4644('0x25')](_0x376091[_0x4644('0xa7')]);logger['info'](_0x376091[_0x4644('0x96')]);return _0x139bd0['status'](_0x376091[_0x4644('0xaa')])[_0x4644('0x32')](_0x376091[_0x4644('0x96')]);}else{return _0x139bd0['sendStatus'](0xc8);}})[_0x4644('0x4f')](handleError(_0x139bd0,null));}; \ No newline at end of file +var _0x9b5b=['Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','join','root','server/files/plugins','dirname','node_modules/**/*','finalize','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','undefined','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','views','Invalid\x20manifest:\x20views\x20missing','agent','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','html','admin','test','plugins','scriptPath','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','extract-zip','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Plugins','error','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','include','params','options','find','catch','download','path','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error'];(function(_0x110f45,_0x3a8afe){var _0x2166c2=function(_0x207926){while(--_0x207926){_0x110f45['push'](_0x110f45['shift']());}};_0x2166c2(++_0x3a8afe);}(_0x9b5b,0xf8));var _0xb9b5=function(_0x2aa1a9,_0x48e793){_0x2aa1a9=_0x2aa1a9-0x0;var _0x17d7e9=_0x9b5b[_0x2aa1a9];return _0x17d7e9;};'use strict';var pdf=require(_0xb9b5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb9b5('0x1'));var zipdir=require(_0xb9b5('0x2'));var jsonpatch=require(_0xb9b5('0x3'));var rp=require(_0xb9b5('0x4'));var moment=require(_0xb9b5('0x5'));var BPromise=require(_0xb9b5('0x6'));var Mustache=require('mustache');var util=require(_0xb9b5('0x7'));var path=require('path');var sox=require(_0xb9b5('0x8'));var csv=require(_0xb9b5('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb9b5('0xa'));var squel=require(_0xb9b5('0xb'));var crypto=require(_0xb9b5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb9b5('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb9b5('0xe'));var Papa=require(_0xb9b5('0xf'));var extract=require(_0xb9b5('0x10'));var rimraf=require(_0xb9b5('0x1'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb9b5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9b5('0x12'));var logger=require('../../config/logger')(_0xb9b5('0x13'));var utils=require(_0xb9b5('0x14'));var config=require(_0xb9b5('0x15'));var db=require(_0xb9b5('0x16'))['db'];config[_0xb9b5('0x17')]=_[_0xb9b5('0x18')](config[_0xb9b5('0x17')],{'host':_0xb9b5('0x19'),'port':0x18eb});var socket=require(_0xb9b5('0x1a'))(new Redis(config['redis']));require(_0xb9b5('0x1b'))[_0xb9b5('0x1c')](socket);function respondWithStatusCode(_0x54304c,_0x581a98){_0x581a98=_0x581a98||0xcc;return function(_0x455f13){if(_0x455f13){return _0x54304c[_0xb9b5('0x1d')](_0x581a98);}return _0x54304c['status'](_0x581a98)[_0xb9b5('0x1e')]();};}function respondWithResult(_0x26f829,_0x1ff547){_0x1ff547=_0x1ff547||0xc8;return function(_0xa85f11){if(_0xa85f11){return _0x26f829[_0xb9b5('0x1f')](_0x1ff547)[_0xb9b5('0x20')](_0xa85f11);}};}function respondWithFilteredResult(_0x257e58,_0x19f9f2){return function(_0x44b133){if(_0x44b133){var _0x16cb65=_0x44b133[_0xb9b5('0x21')],_0xb4e57a=_0x19f9f2[_0xb9b5('0x22')],_0x7a4dbf=_0x19f9f2[_0xb9b5('0x22')]+_0x19f9f2[_0xb9b5('0x23')],_0x14edf7;if(_0x7a4dbf>=_0x16cb65){_0x7a4dbf=_0x16cb65;_0x14edf7=0xc8;}else{_0x14edf7=0xce;}_0x257e58[_0xb9b5('0x1f')](_0x14edf7);return _0x257e58[_0xb9b5('0x24')](_0xb9b5('0x25'),_0xb4e57a+'-'+_0x7a4dbf+'/'+_0x16cb65)[_0xb9b5('0x20')](_0x44b133);}return null;};}function patchUpdates(_0x135e5c){return function(_0xda571b){try{jsonpatch[_0xb9b5('0x26')](_0xda571b,_0x135e5c,!![]);}catch(_0x22ad4e){return BPromise[_0xb9b5('0x27')](_0x22ad4e);}return _0xda571b[_0xb9b5('0x28')]();};}function saveUpdates(_0x238e79,_0x13e58e){return function(_0x277b45){if(_0x277b45){return _0x277b45[_0xb9b5('0x29')](_0x238e79)['then'](function(_0x181699){return _0x181699;});}return null;};}function removeEntity(_0x200b94,_0x1b4ff9){return function(_0x35fd81){if(_0x35fd81){return _0x35fd81[_0xb9b5('0x2a')]()[_0xb9b5('0x2b')](function(){var _0x23800a=_0x35fd81[_0xb9b5('0x2c')]({'plain':!![]});var _0x52ab48=_0xb9b5('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x52ab48,'resourceId':_0x23800a['id']}})[_0xb9b5('0x2b')](function(){return _0x35fd81;});})[_0xb9b5('0x2b')](function(){_0x200b94[_0xb9b5('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd31d46,_0xd96061){return function(_0x24cda5){if(!_0x24cda5){_0xd31d46['sendStatus'](0x194);}return _0x24cda5;};}function handleError(_0x149ac2,_0x4566cf){_0x4566cf=_0x4566cf||0x1f4;return function(_0x4e07ac){logger[_0xb9b5('0x2e')](_0x4e07ac['stack']);if(_0x4e07ac['name']){delete _0x4e07ac[_0xb9b5('0x2f')];}_0x149ac2[_0xb9b5('0x1f')](_0x4566cf)[_0xb9b5('0x30')](_0x4e07ac);};}exports[_0xb9b5('0x31')]=function(_0x30a1b9,_0x2d7b59){var _0x57403d={},_0x3acfab={},_0x2dcc0a={'count':0x0,'rows':[]};var _0x467eb7=_[_0xb9b5('0x32')](db[_0xb9b5('0x33')][_0xb9b5('0x34')],function(_0x403d45){return{'name':_0x403d45[_0xb9b5('0x35')],'type':_0x403d45[_0xb9b5('0x36')][_0xb9b5('0x37')]};});_0x3acfab[_0xb9b5('0x38')]=_[_0xb9b5('0x32')](_0x467eb7,_0xb9b5('0x2f'));_0x3acfab[_0xb9b5('0x39')]=_[_0xb9b5('0x3a')](_0x30a1b9[_0xb9b5('0x39')]);_0x3acfab['filters']=_[_0xb9b5('0x3b')](_0x3acfab['model'],_0x3acfab[_0xb9b5('0x39')]);_0x57403d['attributes']=_[_0xb9b5('0x3b')](_0x3acfab[_0xb9b5('0x38')],qs[_0xb9b5('0x3c')](_0x30a1b9[_0xb9b5('0x39')][_0xb9b5('0x3c')]));_0x57403d[_0xb9b5('0x3d')]=_0x57403d[_0xb9b5('0x3d')][_0xb9b5('0x3e')]?_0x57403d[_0xb9b5('0x3d')]:_0x3acfab[_0xb9b5('0x38')];if(!_0x30a1b9[_0xb9b5('0x39')][_0xb9b5('0x3f')](_0xb9b5('0x40'))){_0x57403d[_0xb9b5('0x23')]=qs['limit'](_0x30a1b9[_0xb9b5('0x39')][_0xb9b5('0x23')]);_0x57403d[_0xb9b5('0x22')]=qs[_0xb9b5('0x22')](_0x30a1b9[_0xb9b5('0x39')][_0xb9b5('0x22')]);}_0x57403d[_0xb9b5('0x41')]=qs[_0xb9b5('0x42')](_0x30a1b9['query'][_0xb9b5('0x42')]);_0x57403d['where']=qs[_0xb9b5('0x43')](_['pick'](_0x30a1b9[_0xb9b5('0x39')],_0x3acfab['filters']),_0x467eb7);if(_0x30a1b9[_0xb9b5('0x39')][_0xb9b5('0x44')]){_0x57403d[_0xb9b5('0x45')]=_[_0xb9b5('0x46')](_0x57403d[_0xb9b5('0x45')],{'$or':_[_0xb9b5('0x32')](_0x467eb7,function(_0x347d9b){if(_0x347d9b[_0xb9b5('0x36')]!==_0xb9b5('0x47')){var _0x4af9bd={};_0x4af9bd[_0x347d9b[_0xb9b5('0x2f')]]={'$like':'%'+_0x30a1b9[_0xb9b5('0x39')][_0xb9b5('0x44')]+'%'};return _0x4af9bd;}})});}_0x57403d=_['merge']({},_0x57403d,_0x30a1b9['options']);var _0x3f02af={'where':_0x57403d[_0xb9b5('0x45')]};return db['Plugin']['count'](_0x3f02af)[_0xb9b5('0x2b')](function(_0x21d39b){_0x2dcc0a[_0xb9b5('0x21')]=_0x21d39b;if(_0x30a1b9[_0xb9b5('0x39')][_0xb9b5('0x48')]){_0x57403d[_0xb9b5('0x49')]=[{'all':!![]}];}return db[_0xb9b5('0x33')]['findAll'](_0x57403d);})[_0xb9b5('0x2b')](function(_0x57c0b8){_0x2dcc0a['rows']=_0x57c0b8;return _0x2dcc0a;})[_0xb9b5('0x2b')](respondWithFilteredResult(_0x2d7b59,_0x57403d))['catch'](handleError(_0x2d7b59,null));};exports['show']=function(_0x59cf30,_0x51d114){var _0x27b85a={'raw':!![],'where':{'id':_0x59cf30[_0xb9b5('0x4a')]['id']}},_0x31d55e={};_0x31d55e[_0xb9b5('0x38')]=_[_0xb9b5('0x3a')](db[_0xb9b5('0x33')][_0xb9b5('0x34')]);_0x31d55e[_0xb9b5('0x39')]=_[_0xb9b5('0x3a')](_0x59cf30[_0xb9b5('0x39')]);_0x31d55e[_0xb9b5('0x43')]=_[_0xb9b5('0x3b')](_0x31d55e[_0xb9b5('0x38')],_0x31d55e[_0xb9b5('0x39')]);_0x27b85a[_0xb9b5('0x3d')]=_[_0xb9b5('0x3b')](_0x31d55e['model'],qs[_0xb9b5('0x3c')](_0x59cf30[_0xb9b5('0x39')][_0xb9b5('0x3c')]));_0x27b85a['attributes']=_0x27b85a[_0xb9b5('0x3d')][_0xb9b5('0x3e')]?_0x27b85a['attributes']:_0x31d55e[_0xb9b5('0x38')];if(_0x59cf30[_0xb9b5('0x39')][_0xb9b5('0x48')]){_0x27b85a[_0xb9b5('0x49')]=[{'all':!![]}];}_0x27b85a=_[_0xb9b5('0x46')]({},_0x27b85a,_0x59cf30[_0xb9b5('0x4b')]);return db[_0xb9b5('0x33')][_0xb9b5('0x4c')](_0x27b85a)['then'](handleEntityNotFound(_0x51d114,null))['then'](respondWithResult(_0x51d114,null))[_0xb9b5('0x4d')](handleError(_0x51d114,null));};exports[_0xb9b5('0x4e')]=function(_0x1d64f7,_0x3b4349,_0x5b8176){return db[_0xb9b5('0x33')]['find']({'where':{'id':_0x1d64f7[_0xb9b5('0x4a')]['id']},'attributes':[_0xb9b5('0x2f'),_0xb9b5('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x3b4349,null))['then'](function(_0x2b4de3){if(_0x2b4de3){var _0x54dd45=path['join'](config['root'],'server/files/plugins',util[_0xb9b5('0x50')](_0xb9b5('0x51'),path[_0xb9b5('0x52')](_0x2b4de3[_0xb9b5('0x4f')])));var _0x16b8d4=fs[_0xb9b5('0x53')](_0x54dd45);var _0x5420e2=archiver(_0xb9b5('0x54'),{'zlib':{'level':0x9}});_0x5420e2['on'](_0xb9b5('0x55'),function(_0x57f5fb){if(_0x57f5fb[_0xb9b5('0x56')]===_0xb9b5('0x57')){logger[_0xb9b5('0x2e')](_0x57f5fb);}else{throw new db[(_0xb9b5('0x58'))][(_0xb9b5('0x59'))](_0xb9b5('0x5a'));}});_0x5420e2['on'](_0xb9b5('0x2e'),function(_0x5c7aa9){throw new db[(_0xb9b5('0x58'))][(_0xb9b5('0x59'))](_0xb9b5('0x5a'));});_0x5420e2[_0xb9b5('0x5b')](_0x16b8d4);_0x5420e2['glob'](_0xb9b5('0x5c'),{'cwd':path[_0xb9b5('0x5d')](config[_0xb9b5('0x5e')],_0xb9b5('0x5f'),path[_0xb9b5('0x60')](_0x2b4de3[_0xb9b5('0x4f')])),'ignore':[path[_0xb9b5('0x5d')](path['basename'](_0x2b4de3[_0xb9b5('0x4f')]),_0xb9b5('0x61')),path[_0xb9b5('0x5d')](path[_0xb9b5('0x52')](_0x2b4de3[_0xb9b5('0x4f')]),'attachments/**/*')],'nodir':!![]})[_0xb9b5('0x62')]();_0x16b8d4['on'](_0xb9b5('0x63'),function(){if(!fs['existsSync'](_0x54dd45)){throw new db['Sequelize'][(_0xb9b5('0x59'))](_0xb9b5('0x64'));}return _0x3b4349[_0xb9b5('0x4e')](_0x54dd45,util[_0xb9b5('0x50')](_0xb9b5('0x51'),path[_0xb9b5('0x52')](_0x2b4de3['path'])),function(_0x43305a){if(_0x43305a){throw new db[(_0xb9b5('0x58'))][(_0xb9b5('0x59'))](_0xb9b5('0x65'));}fs[_0xb9b5('0x66')](_0x54dd45);logger[_0xb9b5('0x67')](_0xb9b5('0x68'));logger[_0xb9b5('0x67')](_0xb9b5('0x69'));});});}return null;})[_0xb9b5('0x4d')](handleError(_0x3b4349,null));};exports[_0xb9b5('0x6a')]=function(_0x325c13,_0x287b15,_0x54f2f0){var _0x5de21c=path[_0xb9b5('0x52')](_0x325c13[_0xb9b5('0x6b')][_0xb9b5('0x6c')],path[_0xb9b5('0x6d')](_0x325c13[_0xb9b5('0x6b')][_0xb9b5('0x6c')]));var _0x4fbe32=path[_0xb9b5('0x5d')](config['root'],_0xb9b5('0x5f'),_0x325c13[_0xb9b5('0x6b')][_0xb9b5('0x6c')]);var _0x1dc54f=path[_0xb9b5('0x5d')](config[_0xb9b5('0x5e')],'server/files/plugins',_0x5de21c);logger['info'](_0xb9b5('0x6e'),_0x4fbe32);logger[_0xb9b5('0x67')](_0xb9b5('0x6f'),_0x1dc54f);try{fs[_0xb9b5('0x70')](_0x4fbe32,parseInt(_0xb9b5('0x71'),0x8));extract(_0x4fbe32,{'dir':_0x1dc54f},function(_0x5f2599){if(_0x5f2599){logger[_0xb9b5('0x2e')](_0x5f2599);handleError(_0x5f2599,!![]);};var _0x22c296=fs['readdirSync'](_0x1dc54f);if(_0x22c296[_0xb9b5('0x3e')]>0x1){removeReferences(_0x4fbe32,_0x1dc54f);logger[_0xb9b5('0x2e')](_0xb9b5('0x72'));return _0x54f2f0(new Error(_0xb9b5('0x72')));}var _0x3497cf=fs['lstatSync'](path[_0xb9b5('0x5d')](_0x1dc54f,_0x22c296[0x0]));if(_0x3497cf['isFile']()){removeReferences(_0x4fbe32,_0x1dc54f);logger[_0xb9b5('0x2e')]('Invalid\x20plugin\x20structure');return _0x54f2f0(new Error(_0xb9b5('0x72')));}if(_0x3497cf['isDirectory']()){var _0x4baeec=fs[_0xb9b5('0x73')](path[_0xb9b5('0x5d')](_0x1dc54f,_0x22c296[0x0]));if(_0x4baeec['length']===0x0){removeReferences(_0x4fbe32,_0x1dc54f);logger[_0xb9b5('0x2e')](_0xb9b5('0x72'));return _0x54f2f0(new Error('Invalid\x20plugin\x20structure'));}var _0x166eb3=_0x4baeec[_0xb9b5('0x74')](function(_0x409ce5){return _0x409ce5===_0xb9b5('0x75');});if(!_0x166eb3){return _0x54f2f0(new Error(_0xb9b5('0x76')));}var _0x279a27=fs[_0xb9b5('0x77')](path[_0xb9b5('0x5d')](_0x1dc54f,_0x22c296[0x0],'manifest.json'));var _0x3ce686=JSON[_0xb9b5('0x78')](_0x279a27);if('undefined'==typeof _0x3ce686['name']){return _0x54f2f0(new Error(_0xb9b5('0x79')));}if('undefined'==typeof _0x3ce686[_0xb9b5('0x36')]){return _0x54f2f0(new Error(_0xb9b5('0x7a')));}if(_0xb9b5('0x7b')==typeof _0x3ce686[_0xb9b5('0x7c')]){return _0x54f2f0(new Error(_0xb9b5('0x7d')));}if('undefined'==typeof _0x3ce686[_0xb9b5('0x7e')]){return _0x54f2f0(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x3ce686[_0xb9b5('0x36')]==='html'){if(_0xb9b5('0x7b')==typeof _0x3ce686[_0xb9b5('0x7e')][_0xb9b5('0x7f')]){return _0x54f2f0(new Error(_0xb9b5('0x80')));}if(_0xb9b5('0x7b')==typeof _0x3ce686[_0xb9b5('0x7e')]['views']['admin']&&'undefined'==typeof _0x3ce686[_0xb9b5('0x7e')][_0xb9b5('0x7f')][_0xb9b5('0x81')]){return _0x54f2f0(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x3ce686[_0xb9b5('0x36')]==='script'){if(_0xb9b5('0x7b')==typeof _0x3ce686['parameters'][_0xb9b5('0x82')]){return _0x54f2f0(new Error(_0xb9b5('0x83')));}if(_0xb9b5('0x7b')==typeof _0x3ce686['parameters']['scriptPath']){return _0x54f2f0(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x54f2f0(new Error(_0xb9b5('0x84')));}var _0x6d25e5=_0x3ce686[_0xb9b5('0x2f')];var _0x21206c=_0x3ce686[_0xb9b5('0x85')];var _0x537ef6=_0x3ce686[_0xb9b5('0x36')];var _0x273485=_0x3ce686[_0xb9b5('0x86')]?_0x3ce686['sidebar']:_0xb9b5('0x87');var _0xc5f55a=_0x3ce686['icon']?_0x3ce686['icon']:'icon-apps';var _0x41a74b='';var _0x19d850='';var _0x2fce1f='';var _0x46963a='';var _0x35586f=_0x3ce686[_0xb9b5('0x7c')];if(_0x537ef6===_0xb9b5('0x88')){if(_0xb9b5('0x7b')!=typeof _0x3ce686[_0xb9b5('0x7e')][_0xb9b5('0x7f')]['admin']){var _0x4a60bf=_0x3ce686[_0xb9b5('0x7e')]['views'][_0xb9b5('0x89')];if(!/^(f|ht)tps?:\/\//i[_0xb9b5('0x8a')](_0x4a60bf)){_0x41a74b=path[_0xb9b5('0x5d')]('plugins',_0x5de21c,_0x22c296[0x0],_0x4a60bf);}else{_0x41a74b=_0x4a60bf;}}else{logger[_0xb9b5('0x67')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xb9b5('0x7b')!=typeof _0x3ce686[_0xb9b5('0x7e')]['views'][_0xb9b5('0x81')]){var _0x1345a7=_0x3ce686['parameters'][_0xb9b5('0x7f')][_0xb9b5('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xb9b5('0x8a')](_0x1345a7)){_0x19d850=path[_0xb9b5('0x5d')](_0xb9b5('0x8b'),_0x5de21c,_0x22c296[0x0],_0x1345a7);}else{_0x19d850=_0x1345a7;}}else{logger[_0xb9b5('0x67')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x537ef6==='script'){_0x2fce1f=_0x3ce686[_0xb9b5('0x7e')][_0xb9b5('0x82')];_0x46963a=_0x3ce686[_0xb9b5('0x7e')][_0xb9b5('0x8c')];if(_0xb9b5('0x7b')!=typeof _0x3ce686[_0xb9b5('0x7e')][_0xb9b5('0x7f')]){if('undefined'!=typeof _0x3ce686['parameters']['views'][_0xb9b5('0x89')]){var _0x4a60bf=_0x3ce686[_0xb9b5('0x7e')][_0xb9b5('0x7f')][_0xb9b5('0x89')];if(!/^(f|ht)tps?:\/\//i[_0xb9b5('0x8a')](_0x4a60bf)){_0x41a74b=path[_0xb9b5('0x5d')](_0xb9b5('0x8b'),_0x5de21c,_0x22c296[0x0],_0x4a60bf);}else{_0x41a74b=_0x4a60bf;}}if(_0xb9b5('0x7b')!=typeof _0x3ce686['parameters'][_0xb9b5('0x7f')][_0xb9b5('0x81')]){var _0x1345a7=_0x3ce686[_0xb9b5('0x7e')][_0xb9b5('0x7f')][_0xb9b5('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xb9b5('0x8a')](_0x1345a7)){_0x19d850=path[_0xb9b5('0x5d')](_0xb9b5('0x8b'),_0x5de21c,_0x22c296[0x0],_0x1345a7);}else{_0x19d850=_0x1345a7;}}}}var _0x3ca543={'name':_0x6d25e5,'description':_0x21206c,'path':path[_0xb9b5('0x5d')](_0x5de21c,_0x22c296[0x0]),'type':_0x537ef6,'sidebar':_0x273485,'icon':_0xc5f55a,'adminUrl':_0x41a74b,'agentUrl':_0x19d850,'scriptName':_0x2fce1f,'scriptPath':_0x46963a,'version':_0x35586f};removeReferences(_0x4fbe32,null);return db[_0xb9b5('0x33')][_0xb9b5('0x8d')](_0x3ca543)[_0xb9b5('0x2b')](function(_0x2d53e3){var _0x495ca9={'role':_0x325c13[_0xb9b5('0x8e')][_0xb9b5('0x8f')],'userProfileId':_0x325c13[_0xb9b5('0x8e')]['userProfileId']};if(!_0x495ca9)throw new Error(_0xb9b5('0x90'));if(_0x495ca9[_0xb9b5('0x8f')]===_0xb9b5('0x91')){var _0x2d6666=_0x2d53e3['get']({'plain':!![]});return db[_0xb9b5('0x92')][_0xb9b5('0x4c')]({'where':{'name':'Plugins','userProfileId':_0x495ca9[_0xb9b5('0x93')]},'raw':!![]})['then'](function(_0x56ab16){if(_0x56ab16&&_0x56ab16[_0xb9b5('0x94')]===0x0){return db[_0xb9b5('0x95')]['create']({'name':_0x2d6666[_0xb9b5('0x2f')],'resourceId':_0x2d6666['id'],'type':_0x56ab16[_0xb9b5('0x2f')],'sectionId':_0x56ab16['id']},{})[_0xb9b5('0x2b')](function(){return _0x2d53e3;});}else{return _0x2d53e3;}})['catch'](function(_0x364cf3){logger[_0xb9b5('0x2e')](_0xb9b5('0x96'),_0x364cf3);throw _0x364cf3;});}return _0x2d53e3;})['then'](respondWithResult(_0x287b15,null))[_0xb9b5('0x4d')](handleError(_0x287b15,null));}});}catch(_0x7654dd){_0x287b15['status'](0x1f4)[_0xb9b5('0x30')](_0x7654dd);}};function removeReferences(_0x119e41,_0x3106b6){try{if(_0x119e41){fs['unlinkSync'](_0x119e41);logger[_0xb9b5('0x67')](_0xb9b5('0x97'));}if(_0x3106b6){rimraf(_0x3106b6,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x3f2270){logger[_0xb9b5('0x2e')](_0x3f2270);}}exports[_0xb9b5('0x29')]=function(_0x179212,_0x1b8727,_0x485e4a){return db[_0xb9b5('0x33')][_0xb9b5('0x4c')]({'where':{'id':_0x179212['params']['id']}})[_0xb9b5('0x2b')](handleEntityNotFound(_0x1b8727,null))[_0xb9b5('0x2b')](saveUpdates(_0x179212['body'],null))[_0xb9b5('0x2b')](respondWithResult(_0x1b8727,null))[_0xb9b5('0x4d')](handleError(_0x1b8727,null));};exports[_0xb9b5('0x98')]=function(_0x101212,_0x2aa09d,_0x215579){return db['Plugin'][_0xb9b5('0x4c')]({'where':{'id':_0x101212['params']['id']}})['then'](function(_0x1847a4){if(_0x1847a4){return _0x1847a4[_0xb9b5('0x2a')]();}})[_0xb9b5('0x2b')](function(_0x4c0e8b){rimraf(path[_0xb9b5('0x5d')](config[_0xb9b5('0x5e')],_0xb9b5('0x5f'),path[_0xb9b5('0x60')](_0x4c0e8b[_0xb9b5('0x4f')])),function(){});return _0x4c0e8b;})[_0xb9b5('0x2b')](handleEntityNotFound(_0x2aa09d,null))[_0xb9b5('0x2b')](respondWithStatusCode(_0x2aa09d,null))[_0xb9b5('0x4d')](handleError(_0x2aa09d,null));};exports[_0xb9b5('0x99')]=function(_0x2480a3,_0xb0fa7b,_0x26a8a1){return BPromise[_0xb9b5('0x9a')]()[_0xb9b5('0x2b')](function(){if(!_0x2480a3[_0xb9b5('0x39')][_0xb9b5('0x4f')]){throw new Error(_0xb9b5('0x9b'));}if(!_0x2480a3[_0xb9b5('0x39')][_0xb9b5('0x9c')]){throw new Error(_0xb9b5('0x9d'));}var _0x52d87f=_0x2480a3['query'][_0xb9b5('0x9e')]?_0x2480a3[_0xb9b5('0x39')][_0xb9b5('0x9e')]+':'+_0x2480a3[_0xb9b5('0x39')]['port']:_0xb9b5('0x9f')+_0x2480a3[_0xb9b5('0x39')][_0xb9b5('0x9c')];var _0x2ffbe1=_0x2480a3['query']['json']?_0x2480a3['query']['json']:!![];var _0x555373=_0x2480a3['query'][_0xb9b5('0xa0')]?_0x2480a3[_0xb9b5('0x39')][_0xb9b5('0xa0')]:null;var _0x1c1526={'method':_0x2480a3[_0xb9b5('0xa1')],'uri':util[_0xb9b5('0x50')](_0xb9b5('0xa2'),_0x52d87f,_0x2480a3['query']['path']),'json':_0x2ffbe1,'resolveWithFullResponse':!![],'encoding':_0x555373,'qs':_0x2480a3[_0xb9b5('0x39')]};if(_0x2480a3['headers']){_0x1c1526[_0xb9b5('0xa3')]=_0x2480a3[_0xb9b5('0xa3')];if(_0x1c1526[_0xb9b5('0xa3')]['content-length']){delete _0x1c1526[_0xb9b5('0xa3')][_0xb9b5('0xa4')];}}if(_0x1c1526[_0xb9b5('0xa3')][_0xb9b5('0xa5')]){delete _0x1c1526['headers'][_0xb9b5('0xa5')];}return rp(_0x1c1526);})[_0xb9b5('0x2b')](function(_0x2a0212){if(_0x2a0212){_0xb0fa7b[_0xb9b5('0x24')](_0x2a0212[_0xb9b5('0xa3')]);logger[_0xb9b5('0x67')](_0x2a0212[_0xb9b5('0x8e')]);if(_[_0xb9b5('0xa6')](_0x2480a3[_0xb9b5('0x39')][_0xb9b5('0x4f')],_0xb9b5('0x4e'))&&_0x2a0212[_0xb9b5('0xa7')]==0x1f4){return _0xb0fa7b[_0xb9b5('0x1d')](_0x2a0212['statusCode']);}else{return _0xb0fa7b[_0xb9b5('0x1f')](_0x2a0212[_0xb9b5('0xa7')])[_0xb9b5('0x30')](_0x2a0212[_0xb9b5('0x8e')]);}}else{return _0xb0fa7b['sendStatus'](0xc8);}})[_0xb9b5('0x4d')](handleError(_0xb0fa7b,null));};exports[_0xb9b5('0xa8')]=function(_0x382baf,_0x17d526,_0x50a500){return BPromise[_0xb9b5('0x9a')]()[_0xb9b5('0x2b')](function(){if(!_0x382baf[_0xb9b5('0x39')]['path']){throw new Error(_0xb9b5('0x9b'));}if(!_0x382baf[_0xb9b5('0x39')][_0xb9b5('0x9c')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x5f173a=_0x382baf[_0xb9b5('0x39')][_0xb9b5('0x9e')]?_0x382baf[_0xb9b5('0x39')][_0xb9b5('0x9e')]+':'+_0x382baf['query']['port']:_0xb9b5('0x9f')+_0x382baf[_0xb9b5('0x39')][_0xb9b5('0x9c')];var _0x44b423=_0x382baf[_0xb9b5('0x39')][_0xb9b5('0x20')]?_0x382baf[_0xb9b5('0x39')][_0xb9b5('0x20')]:!![];var _0x214938=_0x382baf[_0xb9b5('0x39')][_0xb9b5('0xa0')]?_0x382baf['query'][_0xb9b5('0xa0')]:null;var _0x420934={'method':_0x382baf[_0xb9b5('0xa1')],'uri':util[_0xb9b5('0x50')](_0xb9b5('0xa2'),_0x5f173a,_0x382baf['query'][_0xb9b5('0x4f')]),'json':_0x44b423,'resolveWithFullResponse':!![],'encoding':_0x214938,'body':_0x382baf['body']};if(_0x382baf[_0xb9b5('0xa3')]){_0x420934[_0xb9b5('0xa3')]=_0x382baf['headers'];if(_0x420934['headers'][_0xb9b5('0xa4')]){delete _0x420934[_0xb9b5('0xa3')]['content-length'];}}if(_0x420934[_0xb9b5('0xa3')]['content-type']){delete _0x420934['headers'][_0xb9b5('0xa5')];}return rp(_0x420934);})[_0xb9b5('0x2b')](function(_0x169711){if(_0x169711){_0x17d526[_0xb9b5('0x24')](_0x169711['headers']);logger[_0xb9b5('0x67')](_0x169711[_0xb9b5('0x8e')]);return _0x17d526[_0xb9b5('0x1f')](_0x169711['statusCode'])[_0xb9b5('0x30')](_0x169711[_0xb9b5('0x8e')]);}else{return _0x17d526[_0xb9b5('0x1d')](0xc8);}})[_0xb9b5('0x4d')](handleError(_0x17d526,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 4aa434b..f9cc589 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 _0xb44a=['Plugin','save','emit','hasOwnProperty','hook','exports'];(function(_0x2f47fd,_0x5d07bf){var _0x3581e9=function(_0xd62c1a){while(--_0xd62c1a){_0x2f47fd['push'](_0x2f47fd['shift']());}};_0x3581e9(++_0x5d07bf);}(_0xb44a,0x1c2));var _0xab44=function(_0x153846,_0x1227ad){_0x153846=_0x153846-0x0;var _0x3ee557=_0xb44a[_0x153846];return _0x3ee557;};'use strict';var EventEmitter=require('events');var Plugin=require('../../mysqldb')['db'][_0xab44('0x0')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xab44('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3aa69c){return function(_0x5c93b4,_0x1b9e05,_0x32396c){PluginEvents[_0xab44('0x2')](_0x3aa69c+':'+_0x5c93b4['id'],_0x5c93b4);PluginEvents[_0xab44('0x2')](_0x3aa69c,_0x5c93b4);_0x32396c(null);};}for(var e in events){if(events[_0xab44('0x3')](e)){var event=events[e];Plugin[_0xab44('0x4')](e,emitEvent(event));}}module[_0xab44('0x5')]=PluginEvents; \ No newline at end of file +var _0x524e=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','Plugin'];(function(_0xb6fe97,_0x241f93){var _0x46b0dc=function(_0x1c6455){while(--_0x1c6455){_0xb6fe97['push'](_0xb6fe97['shift']());}};_0x46b0dc(++_0x241f93);}(_0x524e,0x15e));var _0xe524=function(_0x5b4184,_0x367cbc){_0x5b4184=_0x5b4184-0x0;var _0x4b0fdd=_0x524e[_0x5b4184];return _0x4b0fdd;};'use strict';var EventEmitter=require('events');var Plugin=require('../../mysqldb')['db'][_0xe524('0x0')];var PluginEvents=new EventEmitter();PluginEvents[_0xe524('0x1')](0x0);var events={'afterCreate':_0xe524('0x2'),'afterUpdate':_0xe524('0x3'),'afterDestroy':_0xe524('0x4')};function emitEvent(_0x379eb1){return function(_0xabd694,_0x32c90b,_0x10d37a){PluginEvents[_0xe524('0x5')](_0x379eb1+':'+_0xabd694['id'],_0xabd694);PluginEvents['emit'](_0x379eb1,_0xabd694);_0x10d37a(null);};}for(var e in events){if(events[_0xe524('0x6')](e)){var event=events[e];Plugin[_0xe524('0x7')](e,emitEvent(event));}}module[_0xe524('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 d446ee1..7b1a3cc 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 _0xf4a8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','../../config/logger','api'];(function(_0x381f03,_0x4c3f61){var _0x21a630=function(_0x34a2fa){while(--_0x34a2fa){_0x381f03['push'](_0x381f03['shift']());}};_0x21a630(++_0x4c3f61);}(_0xf4a8,0x89));var _0x8f4a=function(_0x254abd,_0x1ab7f0){_0x254abd=_0x254abd-0x0;var _0x31bf1b=_0xf4a8[_0x254abd];return _0x31bf1b;};'use strict';var _=require(_0x8f4a('0x0'));var util=require('util');var logger=require(_0x8f4a('0x1'))(_0x8f4a('0x2'));var moment=require(_0x8f4a('0x3'));var BPromise=require(_0x8f4a('0x4'));var rp=require(_0x8f4a('0x5'));var fs=require('fs');var path=require(_0x8f4a('0x6'));var rimraf=require(_0x8f4a('0x7'));var config=require(_0x8f4a('0x8'));var attributes=require(_0x8f4a('0x9'));module[_0x8f4a('0xa')]=function(_0x18e296,_0x25da42){return _0x18e296[_0x8f4a('0xb')](_0x8f4a('0xc'),attributes,{'tableName':_0x8f4a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e57=['request-promise','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0e57,0x1f2));var _0x70e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0e57[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x70e5('0x0'));var util=require(_0x70e5('0x1'));var logger=require(_0x70e5('0x2'))(_0x70e5('0x3'));var moment=require(_0x70e5('0x4'));var BPromise=require(_0x70e5('0x5'));var rp=require(_0x70e5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x70e5('0x7'));var config=require(_0x70e5('0x8'));var attributes=require(_0x70e5('0x9'));module[_0x70e5('0xa')]=function(_0x1d14ff,_0x2994ba){return _0x1d14ff[_0x70e5('0xb')](_0x70e5('0xc'),attributes,{'tableName':_0x70e5('0xd'),'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 1db803a..eff06da 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 _0xd870=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./plugin.socket','register','then','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','Plugin,\x20%s,\x20%s','message','result','catch','CreatePlugin','Plugin','create','options','raw','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x15ed5d,_0xdd2d44){var _0x2ab46d=function(_0x391a5d){while(--_0x391a5d){_0x15ed5d['push'](_0x15ed5d['shift']());}};_0x2ab46d(++_0xdd2d44);}(_0xd870,0x14e));var _0x0d87=function(_0x3ca39c,_0x263221){_0x3ca39c=_0x3ca39c-0x0;var _0x3aad48=_0xd870[_0x3ca39c];return _0x3aad48;};'use strict';var _=require(_0x0d87('0x0'));var util=require(_0x0d87('0x1'));var moment=require(_0x0d87('0x2'));var BPromise=require(_0x0d87('0x3'));var rs=require(_0x0d87('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d87('0x5'))['db'];var utils=require(_0x0d87('0x6'));var logger=require(_0x0d87('0x7'))('rpc');var config=require(_0x0d87('0x8'));var jayson=require(_0x0d87('0x9'));var client=jayson[_0x0d87('0xa')][_0x0d87('0xb')]({'port':0x232a});config[_0x0d87('0xc')]=_['defaults'](config[_0x0d87('0xc')],{'host':_0x0d87('0xd'),'port':0x18eb});var socket=require(_0x0d87('0xe'))(new Redis(config[_0x0d87('0xc')]));require(_0x0d87('0xf'))[_0x0d87('0x10')](socket);function respondWithRpcPromise(_0x13cea7,_0x10eb18,_0x2f9b55){return new BPromise(function(_0x59b3d0,_0x27f7a9){return client['request'](_0x13cea7,_0x2f9b55)[_0x0d87('0x11')](function(_0xa94a21){logger[_0x0d87('0x12')]('Plugin,\x20%s,\x20%s',_0x10eb18,_0x0d87('0x13'));logger[_0x0d87('0x14')](_0x0d87('0x15'),_0x10eb18,'request\x20sent',JSON['stringify'](_0xa94a21));if(_0xa94a21[_0x0d87('0x16')]){if(_0xa94a21['error'][_0x0d87('0x17')]===0x1f4){logger['error'](_0x0d87('0x18'),_0x10eb18,_0xa94a21[_0x0d87('0x16')][_0x0d87('0x19')]);return _0x27f7a9(_0xa94a21[_0x0d87('0x16')][_0x0d87('0x19')]);}logger[_0x0d87('0x16')](_0x0d87('0x18'),_0x10eb18,_0xa94a21[_0x0d87('0x16')][_0x0d87('0x19')]);return _0x59b3d0(_0xa94a21[_0x0d87('0x16')][_0x0d87('0x19')]);}else{logger[_0x0d87('0x12')](_0x0d87('0x18'),_0x10eb18,'request\x20sent');_0x59b3d0(_0xa94a21[_0x0d87('0x1a')][_0x0d87('0x19')]);}})[_0x0d87('0x1b')](function(_0x3810da){logger[_0x0d87('0x16')]('Plugin,\x20%s,\x20%s',_0x10eb18,_0x3810da);_0x27f7a9(_0x3810da);});});}exports[_0x0d87('0x1c')]=function(_0x88a4e4){var _0x88fcf0=this;return new Promise(function(_0x42cb4a,_0x14bc3c){return db[_0x0d87('0x1d')][_0x0d87('0x1e')](_0x88a4e4['body'],{'raw':_0x88a4e4['options']?_0x88a4e4[_0x0d87('0x1f')][_0x0d87('0x20')]===undefined?!![]:![]:!![]})[_0x0d87('0x11')](function(_0x3a91bc){logger[_0x0d87('0x12')]('CreatePlugin',_0x88a4e4);logger[_0x0d87('0x14')](_0x0d87('0x1c'),_0x88a4e4,JSON[_0x0d87('0x21')](_0x3a91bc));_0x42cb4a(_0x3a91bc);})[_0x0d87('0x1b')](function(_0x4344d4){logger[_0x0d87('0x16')](_0x0d87('0x1c'),_0x4344d4[_0x0d87('0x19')],_0x88a4e4);_0x14bc3c(_0x88fcf0[_0x0d87('0x16')](0x1f4,_0x4344d4[_0x0d87('0x19')]));});});}; \ No newline at end of file +var _0x0614=['../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','./plugin.socket','register','then','debug','request\x20sent','stringify','error','code','message','Plugin,\x20%s,\x20%s','result','Plugin','create','body','options','raw','info','CreatePlugin','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x0614,0x1cb));var _0x4061=function(_0x5cf66d,_0x15ddc8){_0x5cf66d=_0x5cf66d-0x0;var _0x1cc23a=_0x0614[_0x5cf66d];return _0x1cc23a;};'use strict';var _=require(_0x4061('0x0'));var util=require(_0x4061('0x1'));var moment=require('moment');var BPromise=require(_0x4061('0x2'));var rs=require(_0x4061('0x3'));var fs=require('fs');var Redis=require(_0x4061('0x4'));var db=require(_0x4061('0x5'))['db'];var utils=require(_0x4061('0x6'));var logger=require(_0x4061('0x7'))('rpc');var config=require(_0x4061('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4061('0x9')]['http']({'port':0x232a});config[_0x4061('0xa')]=_[_0x4061('0xb')](config[_0x4061('0xa')],{'host':_0x4061('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4061('0xa')]));require(_0x4061('0xd'))[_0x4061('0xe')](socket);function respondWithRpcPromise(_0x5c07a0,_0x32e3c9,_0x143dfd){return new BPromise(function(_0x8d90bd,_0x35468b){return client['request'](_0x5c07a0,_0x143dfd)[_0x4061('0xf')](function(_0x46d42d){logger['info']('Plugin,\x20%s,\x20%s',_0x32e3c9,'request\x20sent');logger[_0x4061('0x10')]('Plugin,\x20%s,\x20%s,\x20%s',_0x32e3c9,_0x4061('0x11'),JSON[_0x4061('0x12')](_0x46d42d));if(_0x46d42d[_0x4061('0x13')]){if(_0x46d42d['error'][_0x4061('0x14')]===0x1f4){logger[_0x4061('0x13')]('Plugin,\x20%s,\x20%s',_0x32e3c9,_0x46d42d[_0x4061('0x13')][_0x4061('0x15')]);return _0x35468b(_0x46d42d[_0x4061('0x13')][_0x4061('0x15')]);}logger[_0x4061('0x13')]('Plugin,\x20%s,\x20%s',_0x32e3c9,_0x46d42d['error'][_0x4061('0x15')]);return _0x8d90bd(_0x46d42d[_0x4061('0x13')][_0x4061('0x15')]);}else{logger['info'](_0x4061('0x16'),_0x32e3c9,_0x4061('0x11'));_0x8d90bd(_0x46d42d[_0x4061('0x17')][_0x4061('0x15')]);}})['catch'](function(_0x4d8d8b){logger['error']('Plugin,\x20%s,\x20%s',_0x32e3c9,_0x4d8d8b);_0x35468b(_0x4d8d8b);});});}exports['CreatePlugin']=function(_0x50f632){var _0x5170b6=this;return new Promise(function(_0x51e0b1,_0xbf437f){return db[_0x4061('0x18')][_0x4061('0x19')](_0x50f632[_0x4061('0x1a')],{'raw':_0x50f632[_0x4061('0x1b')]?_0x50f632[_0x4061('0x1b')][_0x4061('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x36d546){logger[_0x4061('0x1d')](_0x4061('0x1e'),_0x50f632);logger[_0x4061('0x10')](_0x4061('0x1e'),_0x50f632,JSON[_0x4061('0x12')](_0x36d546));_0x51e0b1(_0x36d546);})['catch'](function(_0x3b4350){logger[_0x4061('0x13')](_0x4061('0x1e'),_0x3b4350[_0x4061('0x15')],_0x50f632);_0xbf437f(_0x5170b6['error'](0x1f4,_0x3b4350[_0x4061('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 03e4b80..4c79bb5 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 _0xf0b0=['plugin:','save','remove','update','emit','removeListener','register'];(function(_0x39c646,_0x1bbf0f){var _0x12ea70=function(_0x1b80ce){while(--_0x1b80ce){_0x39c646['push'](_0x39c646['shift']());}};_0x12ea70(++_0x1bbf0f);}(_0xf0b0,0x143));var _0x0f0b=function(_0x12afef,_0x348cb6){_0x12afef=_0x12afef-0x0;var _0x37919b=_0xf0b0[_0x12afef];return _0x37919b;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x0f0b('0x0'),_0x0f0b('0x1'),_0x0f0b('0x2')];function createListener(_0x5520e8,_0x35c758){return function(_0x479c96){_0x35c758[_0x0f0b('0x3')](_0x5520e8,_0x479c96);};}function removeListener(_0x550b05,_0x1fc3c2){return function(){PluginEvents[_0x0f0b('0x4')](_0x550b05,_0x1fc3c2);};}exports[_0x0f0b('0x5')]=function(_0x56e2db){for(var _0x109705=0x0,_0x1495a7=events['length'];_0x109705<_0x1495a7;_0x109705++){var _0x2f0b0a=events[_0x109705];var _0x449f1b=createListener(_0x0f0b('0x6')+_0x2f0b0a,_0x56e2db);PluginEvents['on'](_0x2f0b0a,_0x449f1b);}}; \ No newline at end of file +var _0x36e9=['emit','removeListener','register','length','save','remove'];(function(_0x59c86e,_0x38ce57){var _0x48a50e=function(_0x1eeda5){while(--_0x1eeda5){_0x59c86e['push'](_0x59c86e['shift']());}};_0x48a50e(++_0x38ce57);}(_0x36e9,0x106));var _0x936e=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x36e9[_0x5d80de];return _0x1c7556;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x936e('0x0'),_0x936e('0x1'),'update'];function createListener(_0xeefb25,_0x18e947){return function(_0x3a9d74){_0x18e947[_0x936e('0x2')](_0xeefb25,_0x3a9d74);};}function removeListener(_0x27e865,_0x14073a){return function(){PluginEvents[_0x936e('0x3')](_0x27e865,_0x14073a);};}exports[_0x936e('0x4')]=function(_0x323b0c){for(var _0x10e635=0x0,_0x49a6ed=events[_0x936e('0x5')];_0x10e635<_0x49a6ed;_0x10e635++){var _0x3d057b=events[_0x10e635];var _0x1dac3f=createListener('plugin:'+_0x3d057b,_0x323b0c);PluginEvents['on'](_0x3d057b,_0x1dac3f);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index a34750c..3eef06e 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 _0xf3fd=['show','post','create','delete','destroy','exports','Router','../../components/auth/service','./pm2.controller','isAuthenticated','index','get','/:id'];(function(_0x3dfeb9,_0x1cc6e4){var _0x412314=function(_0x321253){while(--_0x321253){_0x3dfeb9['push'](_0x3dfeb9['shift']());}};_0x412314(++_0x1cc6e4);}(_0xf3fd,0xd6));var _0xdf3f=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xf3fd[_0x2f5ac5];return _0x37c9a8;};'use strict';var express=require('express');var router=express[_0xdf3f('0x0')]();var auth=require(_0xdf3f('0x1'));var controller=require(_0xdf3f('0x2'));router['get']('/',auth[_0xdf3f('0x3')](),controller[_0xdf3f('0x4')]);router[_0xdf3f('0x5')](_0xdf3f('0x6'),auth[_0xdf3f('0x3')](),controller[_0xdf3f('0x7')]);router[_0xdf3f('0x8')]('/',auth['isAuthenticated'](),controller[_0xdf3f('0x9')]);router['put'](_0xdf3f('0x6'),auth['isAuthenticated'](),controller['update']);router[_0xdf3f('0xa')](_0xdf3f('0x6'),auth['isAuthenticated'](),controller[_0xdf3f('0xb')]);module[_0xdf3f('0xc')]=router; \ No newline at end of file +var _0xfd38=['show','create','/:id','update','delete','destroy','exports','../../components/auth/service','./pm2.controller','isAuthenticated','index','get'];(function(_0x2e25f7,_0x22a21b){var _0x5d86e2=function(_0x1c4109){while(--_0x1c4109){_0x2e25f7['push'](_0x2e25f7['shift']());}};_0x5d86e2(++_0x22a21b);}(_0xfd38,0xf7));var _0x8fd3=function(_0x46e2e1,_0x1bbc83){_0x46e2e1=_0x46e2e1-0x0;var _0x109bbe=_0xfd38[_0x46e2e1];return _0x109bbe;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x8fd3('0x0'));var controller=require(_0x8fd3('0x1'));router['get']('/',auth[_0x8fd3('0x2')](),controller[_0x8fd3('0x3')]);router[_0x8fd3('0x4')]('/:id',auth[_0x8fd3('0x2')](),controller[_0x8fd3('0x5')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8fd3('0x6')]);router['put'](_0x8fd3('0x7'),auth['isAuthenticated'](),controller[_0x8fd3('0x8')]);router[_0x8fd3('0x9')](_0x8fd3('0x7'),auth[_0x8fd3('0x2')](),controller[_0x8fd3('0xa')]);module[_0x8fd3('0xb')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 93e50eb..411feca 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 _0x2915=['path','exec','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','index','reject','express','motion2','length','then','catch','show','describe','params','create','body','script','join','../../files/plugins','chdir','start','dump','update','restart','Unknown\x20status','delete','Unknown\x20id','../../config/logger'];(function(_0x27790c,_0x507d46){var _0x1e573b=function(_0x2275a8){while(--_0x2275a8){_0x27790c['push'](_0x27790c['shift']());}};_0x1e573b(++_0x507d46);}(_0x2915,0x13a));var _0x5291=function(_0xd4636c,_0x34dbf6){_0xd4636c=_0xd4636c-0x0;var _0x5ee17d=_0x2915[_0xd4636c];return _0x5ee17d;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0x5291('0x0'))('api');var path=require(_0x5291('0x1'));var exec=require('child_process')[_0x5291('0x2')];var BPromise=require(_0x5291('0x3'));function handleEntityNotFound(_0x3adb8d,_0x5eb077){return function(_0x5a92b2){if(!_0x5a92b2){_0x3adb8d[_0x5291('0x4')](0x194);;}return _0x5a92b2;};}function respondWithResult(_0x2095b0,_0x576d57){_0x576d57=_0x576d57||0xc8;return function(_0x5d0e16){if(_0x5d0e16){return _0x2095b0[_0x5291('0x5')](_0x576d57)[_0x5291('0x6')](_0x5d0e16);}return null;};}function handleError(_0x196125,_0x55fb76){_0x55fb76=_0x55fb76||0x1f4;return function(_0xa80233){logger[_0x5291('0x7')](_0xa80233['stack']);if(_0xa80233[_0x5291('0x8')]){delete _0xa80233[_0x5291('0x8')];}_0x196125['status'](_0x55fb76)[_0x5291('0x9')](_0xa80233);};}function execChildProcess(){return new BPromise(function(_0x5794fa,_0x5ac3cc){exec(_0x5291('0xa'),function(_0x26e7a0,_0x399ba7,_0x5e715f){logger[_0x5291('0xb')](_0x399ba7);logger[_0x5291('0xb')](_0x5e715f);if(_0x26e7a0){logger[_0x5291('0x7')](_0x26e7a0);return _0x5ac3cc(_0x26e7a0);}return _0x5794fa(_0x399ba7);});});}exports[_0x5291('0xc')]=function(_0x3a3309,_0xc58a7d){return pm2['list']()['then'](function(_0x354a1a){if(_0x354a1a){var _0x283fd9=_[_0x5291('0xd')](_0x354a1a,function(_0x1bced0){return _0x1bced0['name']===_0x5291('0xe')||_0x1bced0[_0x5291('0x8')]===_0x5291('0xf');});return{'rows':_0x283fd9,'count':_0x283fd9[_0x5291('0x10')]};}return null;})[_0x5291('0x11')](respondWithResult(_0xc58a7d,null))[_0x5291('0x12')](handleError(_0xc58a7d,null));};exports[_0x5291('0x13')]=function(_0x1dff7a,_0x245617){return pm2[_0x5291('0x14')](_0x1dff7a[_0x5291('0x15')]['id'])['then'](respondWithResult(_0x245617,null))['then'](handleEntityNotFound(_0x245617,null))['catch'](handleError(_0x245617,null));};exports[_0x5291('0x16')]=function(_0x398f56,_0x30960f){if(_0x398f56[_0x5291('0x17')][_0x5291('0x8')]&&_0x398f56[_0x5291('0x17')][_0x5291('0x18')]){var _0x3534e2=path[_0x5291('0x19')](__dirname,_0x5291('0x1a'),_0x398f56[_0x5291('0x17')][_0x5291('0x18')]);var _0x2a6346=process['cwd']();process['chdir'](path['dirname'](_0x3534e2));return execChildProcess()['then'](function(_0x2ce91a){process[_0x5291('0x1b')](_0x2a6346);return pm2[_0x5291('0x1c')]({'name':_0x398f56['body'][_0x5291('0x8')],'script':_0x3534e2});})['then'](function(_0x2963fc){pm2[_0x5291('0x1d')]();return _0x2963fc[0x0];})['then'](respondWithResult(_0x30960f,0xc9))[_0x5291('0x12')](handleError(_0x30960f,null));}else{return _0x30960f['status'](0x1f4)[_0x5291('0x9')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x5291('0x1e')]=function(_0x421e09,_0x4d0665){if(_0x421e09[_0x5291('0x17')]['id']){delete _0x421e09[_0x5291('0x17')]['id'];}var _0x48db31={'online':_0x5291('0x1f'),'stopped':'stop'};if(_0x48db31['hasOwnProperty'](_0x421e09[_0x5291('0x17')][_0x5291('0x5')])){return pm2[_0x48db31[_0x421e09[_0x5291('0x17')][_0x5291('0x5')]]](_0x421e09[_0x5291('0x15')]['id'])[_0x5291('0x11')](respondWithResult(_0x4d0665,0xc8))[_0x5291('0x12')](handleError(_0x4d0665,null));}else{return _0x4d0665[_0x5291('0x5')](0x1f4)[_0x5291('0x9')]({'message':_0x5291('0x20')});}};exports['destroy']=function(_0x55b7f2,_0x1f1916){if(_0x55b7f2['body']['id']){delete _0x55b7f2[_0x5291('0x17')]['id'];}if(_0x55b7f2[_0x5291('0x15')]['id']){return pm2[_0x5291('0x21')](_0x55b7f2[_0x5291('0x15')]['id'])['then'](function(_0x186889){pm2['dump']();return _0x186889[0x0];})[_0x5291('0x11')](respondWithResult(_0x1f1916,null))[_0x5291('0x12')](handleError(_0x1f1916,null));}else{return _0x1f1916[_0x5291('0x5')](0x1f4)[_0x5291('0x9')]({'message':_0x5291('0x22')});}}; \ No newline at end of file +var _0xf7fe=['Missing\x20name\x20and/or\x20path','update','restart','stop','Unknown\x20status','delete','dump','Unknown\x20id','lodash','../../config/pm2','api','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','npm\x20install','info','index','list','then','express','motion2','length','catch','describe','params','create','script','join','body','chdir','dirname'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xf7fe,0xec));var _0xef7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf7fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xef7f('0x0'));var pm2=require(_0xef7f('0x1'));var logger=require('../../config/logger')(_0xef7f('0x2'));var path=require('path');var exec=require(_0xef7f('0x3'))[_0xef7f('0x4')];var BPromise=require(_0xef7f('0x5'));function handleEntityNotFound(_0x52cd7e,_0x1a027d){return function(_0x3b97ca){if(!_0x3b97ca){_0x52cd7e[_0xef7f('0x6')](0x194);;}return _0x3b97ca;};}function respondWithResult(_0x4e8fcd,_0x1b1ff6){_0x1b1ff6=_0x1b1ff6||0xc8;return function(_0x4492ae){if(_0x4492ae){return _0x4e8fcd[_0xef7f('0x7')](_0x1b1ff6)[_0xef7f('0x8')](_0x4492ae);}return null;};}function handleError(_0x4f7a5c,_0x3ff5cf){_0x3ff5cf=_0x3ff5cf||0x1f4;return function(_0x286333){logger[_0xef7f('0x9')](_0x286333[_0xef7f('0xa')]);if(_0x286333[_0xef7f('0xb')]){delete _0x286333[_0xef7f('0xb')];}_0x4f7a5c[_0xef7f('0x7')](_0x3ff5cf)[_0xef7f('0xc')](_0x286333);};}function execChildProcess(){return new BPromise(function(_0x488ead,_0xa7f0d0){exec(_0xef7f('0xd'),function(_0x14c540,_0x8253eb,_0x3d85b1){logger[_0xef7f('0xe')](_0x8253eb);logger[_0xef7f('0xe')](_0x3d85b1);if(_0x14c540){logger[_0xef7f('0x9')](_0x14c540);return _0xa7f0d0(_0x14c540);}return _0x488ead(_0x8253eb);});});}exports[_0xef7f('0xf')]=function(_0x2155cf,_0x54f0d0){return pm2[_0xef7f('0x10')]()[_0xef7f('0x11')](function(_0x584be0){if(_0x584be0){var _0x413edb=_['reject'](_0x584be0,function(_0x576ead){return _0x576ead[_0xef7f('0xb')]===_0xef7f('0x12')||_0x576ead[_0xef7f('0xb')]===_0xef7f('0x13');});return{'rows':_0x413edb,'count':_0x413edb[_0xef7f('0x14')]};}return null;})['then'](respondWithResult(_0x54f0d0,null))[_0xef7f('0x15')](handleError(_0x54f0d0,null));};exports['show']=function(_0x184428,_0x260587){return pm2[_0xef7f('0x16')](_0x184428[_0xef7f('0x17')]['id'])['then'](respondWithResult(_0x260587,null))[_0xef7f('0x11')](handleEntityNotFound(_0x260587,null))[_0xef7f('0x15')](handleError(_0x260587,null));};exports[_0xef7f('0x18')]=function(_0x279d07,_0x277cf0){if(_0x279d07['body'][_0xef7f('0xb')]&&_0x279d07['body'][_0xef7f('0x19')]){var _0x8e659a=path[_0xef7f('0x1a')](__dirname,'../../files/plugins',_0x279d07[_0xef7f('0x1b')][_0xef7f('0x19')]);var _0x492fb2=process['cwd']();process[_0xef7f('0x1c')](path[_0xef7f('0x1d')](_0x8e659a));return execChildProcess()[_0xef7f('0x11')](function(_0x172ebd){process['chdir'](_0x492fb2);return pm2['start']({'name':_0x279d07[_0xef7f('0x1b')][_0xef7f('0xb')],'script':_0x8e659a});})[_0xef7f('0x11')](function(_0x4d382a){pm2['dump']();return _0x4d382a[0x0];})[_0xef7f('0x11')](respondWithResult(_0x277cf0,0xc9))['catch'](handleError(_0x277cf0,null));}else{return _0x277cf0[_0xef7f('0x7')](0x1f4)[_0xef7f('0xc')]({'message':_0xef7f('0x1e')});}};exports[_0xef7f('0x1f')]=function(_0x395662,_0x1479e4){if(_0x395662[_0xef7f('0x1b')]['id']){delete _0x395662[_0xef7f('0x1b')]['id'];}var _0x1d80e2={'online':_0xef7f('0x20'),'stopped':_0xef7f('0x21')};if(_0x1d80e2['hasOwnProperty'](_0x395662[_0xef7f('0x1b')][_0xef7f('0x7')])){return pm2[_0x1d80e2[_0x395662[_0xef7f('0x1b')][_0xef7f('0x7')]]](_0x395662[_0xef7f('0x17')]['id'])[_0xef7f('0x11')](respondWithResult(_0x1479e4,0xc8))[_0xef7f('0x15')](handleError(_0x1479e4,null));}else{return _0x1479e4['status'](0x1f4)[_0xef7f('0xc')]({'message':_0xef7f('0x22')});}};exports['destroy']=function(_0x55a774,_0x4234b9){if(_0x55a774[_0xef7f('0x1b')]['id']){delete _0x55a774[_0xef7f('0x1b')]['id'];}if(_0x55a774['params']['id']){return pm2[_0xef7f('0x23')](_0x55a774['params']['id'])[_0xef7f('0x11')](function(_0x1d8902){pm2[_0xef7f('0x24')]();return _0x1d8902[0x0];})[_0xef7f('0x11')](respondWithResult(_0x4234b9,null))[_0xef7f('0x15')](handleError(_0x4234b9,null));}else{return _0x4234b9[_0xef7f('0x7')](0x1f4)['send']({'message':_0xef7f('0x25')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index a73c1cf..d4f24c5 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 _0xfcb4=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x330e70,_0x366811){var _0x470854=function(_0x504dcf){while(--_0x504dcf){_0x330e70['push'](_0x330e70['shift']());}};_0x470854(++_0x366811);}(_0xfcb4,0x1d5));var _0x4fcb=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xfcb4[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4fcb('0x0'));var timeout=require('connect-timeout');var express=require(_0x4fcb('0x1'));var router=express[_0x4fcb('0x2')]();var auth=require(_0x4fcb('0x3'));var interaction=require(_0x4fcb('0x4'));var config=require(_0x4fcb('0x5'));module[_0x4fcb('0x6')]=router; \ No newline at end of file +var _0x7b4c=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','path','express','Router'];(function(_0x548d42,_0x3954a2){var _0x17efc5=function(_0x4ac67f){while(--_0x4ac67f){_0x548d42['push'](_0x548d42['shift']());}};_0x17efc5(++_0x3954a2);}(_0x7b4c,0x1dc));var _0xc7b4=function(_0x6d7b85,_0x2828e6){_0x6d7b85=_0x6d7b85-0x0;var _0x29dd23=_0x7b4c[_0x6d7b85];return _0x29dd23;};'use strict';var multer=require('multer');var util=require(_0xc7b4('0x0'));var path=require(_0xc7b4('0x1'));var timeout=require('connect-timeout');var express=require(_0xc7b4('0x2'));var router=express[_0xc7b4('0x3')]();var auth=require(_0xc7b4('0x4'));var interaction=require(_0xc7b4('0x5'));var config=require(_0xc7b4('0x6'));module[_0xc7b4('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 30220eb..f84de1f 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 _0x2a4e=['DATE','exports','INTEGER','STRING'];(function(_0x256439,_0x39a309){var _0x4f30fe=function(_0x48ed50){while(--_0x48ed50){_0x256439['push'](_0x256439['shift']());}};_0x4f30fe(++_0x39a309);}(_0x2a4e,0x119));var _0xe2a4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a4e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xe2a4('0x0')]={'state':{'type':Sequelize[_0xe2a4('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xe2a4('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xe2a4('0x2')]},'starttime':{'type':Sequelize[_0xe2a4('0x3')]},'responsetime':{'type':Sequelize[_0xe2a4('0x3')]},'ringtime':{'type':Sequelize[_0xe2a4('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xe2a4('0x2')]},'campaigntype':{'type':Sequelize[_0xe2a4('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5e3b=['DATE','exports','INTEGER','STRING'];(function(_0x5d4377,_0x17d818){var _0x1aee1d=function(_0xd2f109){while(--_0xd2f109){_0x5d4377['push'](_0x5d4377['shift']());}};_0x1aee1d(++_0x17d818);}(_0x5e3b,0xbd));var _0xb5e3=function(_0x2ff9a7,_0x11406a){_0x2ff9a7=_0x2ff9a7-0x0;var _0x357bb2=_0x5e3b[_0x2ff9a7];return _0x357bb2;};'use strict';var Sequelize=require('sequelize');module[_0xb5e3('0x0')]={'state':{'type':Sequelize[_0xb5e3('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xb5e3('0x2')]},'scheduledat':{'type':Sequelize[_0xb5e3('0x3')]},'uniqueid':{'type':Sequelize[_0xb5e3('0x2')]},'starttime':{'type':Sequelize[_0xb5e3('0x3')]},'responsetime':{'type':Sequelize[_0xb5e3('0x3')]},'ringtime':{'type':Sequelize[_0xb5e3('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xb5e3('0x2')]},'campaigntype':{'type':Sequelize[_0xb5e3('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index baa9d18..cf8933a 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 _0x5efc=['rimraf','../../config/environment','exports','ReportAgentPreview','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x47f7ec,_0x369f9d){var _0x415101=function(_0x41317a){while(--_0x41317a){_0x47f7ec['push'](_0x47f7ec['shift']());}};_0x415101(++_0x369f9d);}(_0x5efc,0x1a6));var _0xc5ef=function(_0x27a28d,_0x1ee332){_0x27a28d=_0x27a28d-0x0;var _0x1552e9=_0x5efc[_0x27a28d];return _0x1552e9;};'use strict';var _=require(_0xc5ef('0x0'));var util=require('util');var logger=require(_0xc5ef('0x1'))(_0xc5ef('0x2'));var moment=require(_0xc5ef('0x3'));var BPromise=require(_0xc5ef('0x4'));var rp=require(_0xc5ef('0x5'));var fs=require('fs');var path=require(_0xc5ef('0x6'));var rimraf=require(_0xc5ef('0x7'));var config=require(_0xc5ef('0x8'));var attributes=require('./reportAgentPreview.attributes');module[_0xc5ef('0x9')]=function(_0xb1405,_0x50a742){return _0xb1405['define'](_0xc5ef('0xa'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xacc0=['bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','lodash','../../config/logger'];(function(_0x1a22a5,_0xb95d4d){var _0x325476=function(_0x1109f9){while(--_0x1109f9){_0x1a22a5['push'](_0x1a22a5['shift']());}};_0x325476(++_0xb95d4d);}(_0xacc0,0xae));var _0x0acc=function(_0x4af2dc,_0x207796){_0x4af2dc=_0x4af2dc-0x0;var _0x2d0100=_0xacc0[_0x4af2dc];return _0x2d0100;};'use strict';var _=require(_0x0acc('0x0'));var util=require('util');var logger=require(_0x0acc('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0acc('0x2'));var rp=require(_0x0acc('0x3'));var fs=require('fs');var path=require(_0x0acc('0x4'));var rimraf=require(_0x0acc('0x5'));var config=require(_0x0acc('0x6'));var attributes=require(_0x0acc('0x7'));module[_0x0acc('0x8')]=function(_0x5d89ca,_0x258f00){return _0x5d89ca['define'](_0x0acc('0x9'),attributes,{'tableName':_0x0acc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 905f38f..cc7528e 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 _0xf6fc=['../../config/environment','client','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','then','stringify','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xf6fc,0x1a3));var _0xcf6f=function(_0x55b32a,_0x3bb7fa){_0x55b32a=_0x55b32a-0x0;var _0x2f3bb4=_0xf6fc[_0x55b32a];return _0x2f3bb4;};'use strict';var _=require(_0xcf6f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcf6f('0x1'));var fs=require('fs');var Redis=require(_0xcf6f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xcf6f('0x3'));var logger=require(_0xcf6f('0x4'))(_0xcf6f('0x5'));var config=require(_0xcf6f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcf6f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x66b2b0,_0x1a5a50,_0x4a84a8){return new BPromise(function(_0x409471,_0x201401){return client[_0xcf6f('0x8')](_0x66b2b0,_0x4a84a8)['then'](function(_0x1dd932){logger[_0xcf6f('0x9')](_0xcf6f('0xa'),_0x1a5a50,_0xcf6f('0xb'));logger[_0xcf6f('0xc')](_0xcf6f('0xd'),_0x1a5a50,_0xcf6f('0xb'),JSON['stringify'](_0x1dd932));if(_0x1dd932[_0xcf6f('0xe')]){if(_0x1dd932['error'][_0xcf6f('0xf')]===0x1f4){logger[_0xcf6f('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x1a5a50,_0x1dd932[_0xcf6f('0xe')][_0xcf6f('0x10')]);return _0x201401(_0x1dd932[_0xcf6f('0xe')][_0xcf6f('0x10')]);}logger['error'](_0xcf6f('0xa'),_0x1a5a50,_0x1dd932[_0xcf6f('0xe')]['message']);return _0x409471(_0x1dd932[_0xcf6f('0xe')][_0xcf6f('0x10')]);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x1a5a50,'request\x20sent');_0x409471(_0x1dd932['result'][_0xcf6f('0x10')]);}})[_0xcf6f('0x11')](function(_0x218b58){logger[_0xcf6f('0xe')](_0xcf6f('0xa'),_0x1a5a50,_0x218b58);_0x201401(_0x218b58);});});}exports[_0xcf6f('0x12')]=function(_0x23b5df){var _0x45068f=this;return new Promise(function(_0x1df05a,_0x592b6a){return db[_0xcf6f('0x13')][_0xcf6f('0x14')](_0x23b5df[_0xcf6f('0x15')],{'raw':_0x23b5df[_0xcf6f('0x16')]?_0x23b5df[_0xcf6f('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xcf6f('0x17')](function(_0x20ae57){logger[_0xcf6f('0x9')]('CreateReportAgentPreview',_0x23b5df);logger[_0xcf6f('0xc')]('CreateReportAgentPreview',_0x23b5df,JSON[_0xcf6f('0x18')](_0x20ae57));_0x1df05a(_0x20ae57);})[_0xcf6f('0x11')](function(_0x148046){logger[_0xcf6f('0xe')](_0xcf6f('0x12'),_0x148046[_0xcf6f('0x10')],_0x23b5df);_0x592b6a(_0x45068f[_0xcf6f('0xe')](0x1f4,_0x148046[_0xcf6f('0x10')]));});});}; \ No newline at end of file +var _0xd408=['../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x356a95,_0x4bedd8){var _0x1ca23a=function(_0x36e984){while(--_0x36e984){_0x356a95['push'](_0x356a95['shift']());}};_0x1ca23a(++_0x4bedd8);}(_0xd408,0x154));var _0x8d40=function(_0x22783c,_0x5cf3a5){_0x22783c=_0x22783c-0x0;var _0x44f0e0=_0xd408[_0x22783c];return _0x44f0e0;};'use strict';var _=require(_0x8d40('0x0'));var util=require(_0x8d40('0x1'));var moment=require(_0x8d40('0x2'));var BPromise=require(_0x8d40('0x3'));var rs=require(_0x8d40('0x4'));var fs=require('fs');var Redis=require(_0x8d40('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8d40('0x6'));var logger=require('../../config/logger')(_0x8d40('0x7'));var config=require(_0x8d40('0x8'));var jayson=require(_0x8d40('0x9'));var client=jayson[_0x8d40('0xa')][_0x8d40('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fb3c0,_0x395dc2,_0x5e6b19){return new BPromise(function(_0x478ac7,_0x448405){return client[_0x8d40('0xc')](_0x4fb3c0,_0x5e6b19)[_0x8d40('0xd')](function(_0x5b9483){logger[_0x8d40('0xe')](_0x8d40('0xf'),_0x395dc2,_0x8d40('0x10'));logger[_0x8d40('0x11')](_0x8d40('0x12'),_0x395dc2,_0x8d40('0x10'),JSON[_0x8d40('0x13')](_0x5b9483));if(_0x5b9483[_0x8d40('0x14')]){if(_0x5b9483[_0x8d40('0x14')][_0x8d40('0x15')]===0x1f4){logger[_0x8d40('0x14')](_0x8d40('0xf'),_0x395dc2,_0x5b9483[_0x8d40('0x14')]['message']);return _0x448405(_0x5b9483[_0x8d40('0x14')][_0x8d40('0x16')]);}logger[_0x8d40('0x14')](_0x8d40('0xf'),_0x395dc2,_0x5b9483[_0x8d40('0x14')]['message']);return _0x478ac7(_0x5b9483['error'][_0x8d40('0x16')]);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x395dc2,_0x8d40('0x10'));_0x478ac7(_0x5b9483[_0x8d40('0x17')][_0x8d40('0x16')]);}})[_0x8d40('0x18')](function(_0x1767bd){logger[_0x8d40('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x395dc2,_0x1767bd);_0x448405(_0x1767bd);});});}exports[_0x8d40('0x19')]=function(_0x4b5977){var _0x1987ac=this;return new Promise(function(_0x56f691,_0x51f5c7){return db['ReportAgentPreview']['create'](_0x4b5977[_0x8d40('0x1a')],{'raw':_0x4b5977['options']?_0x4b5977[_0x8d40('0x1b')][_0x8d40('0x1c')]===undefined?!![]:![]:!![]})[_0x8d40('0xd')](function(_0x37e53d){logger[_0x8d40('0xe')](_0x8d40('0x19'),_0x4b5977);logger[_0x8d40('0x11')]('CreateReportAgentPreview',_0x4b5977,JSON['stringify'](_0x37e53d));_0x56f691(_0x37e53d);})[_0x8d40('0x18')](function(_0x378f25){logger[_0x8d40('0x14')](_0x8d40('0x19'),_0x378f25[_0x8d40('0x16')],_0x4b5977);_0x51f5c7(_0x1987ac['error'](0x1f4,_0x378f25[_0x8d40('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index eda0064..0c95913 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 _0xf22d=['/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','outbound','/outbound/channels','outboundChannels','/agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','queueNotify','mail','/mail/queues/:id','post','chat','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel'];(function(_0x48dfb3,_0x4c9908){var _0x511daa=function(_0x51f2e5){while(--_0x51f2e5){_0x48dfb3['push'](_0x48dfb3['shift']());}};_0x511daa(++_0x4c9908);}(_0xf22d,0x1d3));var _0xdf22=function(_0x512c83,_0x42a67a){_0x512c83=_0x512c83-0x0;var _0x1f7f25=_0xf22d[_0x512c83];return _0x1f7f25;};'use strict';var multer=require(_0xdf22('0x0'));var util=require(_0xdf22('0x1'));var path=require(_0xdf22('0x2'));var express=require(_0xdf22('0x3'));var router=express[_0xdf22('0x4')]();var auth=require('../../components/auth/service');var controller=require(_0xdf22('0x5'));router['get'](_0xdf22('0x6'),auth[_0xdf22('0x7')](),controller[_0xdf22('0x8')]);router[_0xdf22('0x9')](_0xdf22('0xa'),auth[_0xdf22('0x7')](),controller[_0xdf22('0xb')]);router['get'](_0xdf22('0xc'),auth[_0xdf22('0x7')](),controller[_0xdf22('0xd')]);router['get'](_0xdf22('0xe'),auth[_0xdf22('0x7')](),controller[_0xdf22('0xf')]);router['get']('/chat/queues',auth[_0xdf22('0x7')](),controller[_0xdf22('0x10')]);router[_0xdf22('0x9')](_0xdf22('0x11'),auth['isAuthenticated'](),controller['mailQueues']);router[_0xdf22('0x9')]('/mail/accounts',auth['isAuthenticated'](),controller[_0xdf22('0x12')]);router[_0xdf22('0x9')](_0xdf22('0x13'),auth[_0xdf22('0x7')](),controller[_0xdf22('0x14')]);router[_0xdf22('0x9')](_0xdf22('0x15'),auth[_0xdf22('0x7')](),controller[_0xdf22('0x16')]);router[_0xdf22('0x9')]('/whatsapp/queues',auth[_0xdf22('0x7')](),controller[_0xdf22('0x17')]);router[_0xdf22('0x9')](_0xdf22('0x18'),auth['isAuthenticated'](),controller[_0xdf22('0x19')]);router[_0xdf22('0x9')](_0xdf22('0x1a'),auth['isAuthenticated'](),controller[_0xdf22('0x1b')]);router[_0xdf22('0x9')]('/voice/queues/channels',auth[_0xdf22('0x7')](),controller[_0xdf22('0x1c')]);router[_0xdf22('0x9')](_0xdf22('0x1d'),auth[_0xdf22('0x7')](),controller[_0xdf22('0x1e')]);router['get'](_0xdf22('0x1f'),auth['isAuthenticated'](),controller[_0xdf22('0x20')]);router['get'](_0xdf22('0x21'),auth[_0xdf22('0x7')](),controller[_0xdf22('0x22')]);router[_0xdf22('0x9')](_0xdf22('0x23'),auth[_0xdf22('0x7')](),controller[_0xdf22('0x24')]);router[_0xdf22('0x9')]('/outbound',auth[_0xdf22('0x7')](),controller[_0xdf22('0x25')]);router[_0xdf22('0x9')](_0xdf22('0x26'),auth['isAuthenticated'](),controller[_0xdf22('0x27')]);router[_0xdf22('0x9')](_0xdf22('0x28'),auth['isAuthenticated'](),controller['agents']);router[_0xdf22('0x29')](_0xdf22('0x2a'),auth['isAuthenticated'](),controller[_0xdf22('0x2b')]);router[_0xdf22('0x9')](_0xdf22('0x2c'),auth[_0xdf22('0x7')](),controller[_0xdf22('0x2d')]);router[_0xdf22('0x9')](_0xdf22('0x2e'),auth[_0xdf22('0x7')](),controller[_0xdf22('0x2f')]);router[_0xdf22('0x9')](_0xdf22('0x30'),auth[_0xdf22('0x7')](),controller[_0xdf22('0x31')]);router['get']('/fax/accounts',auth[_0xdf22('0x7')](),controller[_0xdf22('0x32')]);router[_0xdf22('0x9')]('/chat/queues/waitinginteractions',auth[_0xdf22('0x7')](),controller['chatQueuesWaitingInteractions']);router[_0xdf22('0x9')](_0xdf22('0x33'),auth[_0xdf22('0x7')](),controller[_0xdf22('0x34')]);router['get'](_0xdf22('0x35'),auth[_0xdf22('0x7')](),controller[_0xdf22('0x36')]);router[_0xdf22('0x9')]('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xdf22('0x37')]);router[_0xdf22('0x9')](_0xdf22('0x38'),auth['isAuthenticated'](),controller[_0xdf22('0x39')]);router[_0xdf22('0x9')](_0xdf22('0x3a'),auth[_0xdf22('0x7')](),controller[_0xdf22('0x3b')]);router['post']('/mail/queues/:id/notify',auth[_0xdf22('0x7')](),controller[_0xdf22('0x3c')](_0xdf22('0x3d')));router[_0xdf22('0x9')](_0xdf22('0x3e'),auth['isAuthenticated'](),controller['showMailQueues']);router[_0xdf22('0x3f')]('/chat/queues/:id/notify',auth[_0xdf22('0x7')](),controller[_0xdf22('0x3c')](_0xdf22('0x40')));router[_0xdf22('0x9')]('/chat/queues/:id',auth[_0xdf22('0x7')](),controller[_0xdf22('0x41')]);router[_0xdf22('0x3f')](_0xdf22('0x42'),auth[_0xdf22('0x7')](),controller['queueNotify'](_0xdf22('0x43')));router[_0xdf22('0x9')](_0xdf22('0x44'),auth[_0xdf22('0x7')](),controller[_0xdf22('0x45')]);router['post'](_0xdf22('0x46'),auth[_0xdf22('0x7')](),controller[_0xdf22('0x3c')](_0xdf22('0x47')));router[_0xdf22('0x9')]('/openchannel/queues/:id',auth[_0xdf22('0x7')](),controller[_0xdf22('0x48')]);router[_0xdf22('0x3f')](_0xdf22('0x49'),auth[_0xdf22('0x7')](),controller[_0xdf22('0x3c')]('sms'));router[_0xdf22('0x3f')](_0xdf22('0x4a'),auth[_0xdf22('0x7')](),controller[_0xdf22('0x3c')](_0xdf22('0x4b')));router[_0xdf22('0x9')](_0xdf22('0x4c'),auth['isAuthenticated'](),controller[_0xdf22('0x4d')]);router[_0xdf22('0x9')](_0xdf22('0x4e'),auth[_0xdf22('0x7')](),controller[_0xdf22('0x4f')]);router[_0xdf22('0x3f')](_0xdf22('0x50'),auth['isAuthenticated'](),controller[_0xdf22('0x51')]);module[_0xdf22('0x52')]=router; \ No newline at end of file +var _0xec15=['smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','outbound','/outbound/channels','outboundChannels','put','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues'];(function(_0x3522c8,_0x1e7c82){var _0x22f498=function(_0x5bf143){while(--_0x5bf143){_0x3522c8['push'](_0x3522c8['shift']());}};_0x22f498(++_0x1e7c82);}(_0xec15,0x138));var _0x5ec1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xec15[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x5ec1('0x0'));var util=require(_0x5ec1('0x1'));var path=require(_0x5ec1('0x2'));var express=require(_0x5ec1('0x3'));var router=express[_0x5ec1('0x4')]();var auth=require(_0x5ec1('0x5'));var controller=require(_0x5ec1('0x6'));router[_0x5ec1('0x7')](_0x5ec1('0x8'),auth[_0x5ec1('0x9')](),controller[_0x5ec1('0xa')]);router[_0x5ec1('0x7')](_0x5ec1('0xb'),auth[_0x5ec1('0x9')](),controller[_0x5ec1('0xc')]);router['get'](_0x5ec1('0xd'),auth['isAuthenticated'](),controller[_0x5ec1('0xe')]);router[_0x5ec1('0x7')](_0x5ec1('0xf'),auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x10')]);router['get'](_0x5ec1('0x11'),auth[_0x5ec1('0x9')](),controller['chatQueues']);router[_0x5ec1('0x7')](_0x5ec1('0x12'),auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x13')]);router[_0x5ec1('0x7')](_0x5ec1('0x14'),auth['isAuthenticated'](),controller[_0x5ec1('0x15')]);router[_0x5ec1('0x7')](_0x5ec1('0x16'),auth[_0x5ec1('0x9')](),controller['openchannelQueues']);router[_0x5ec1('0x7')](_0x5ec1('0x17'),auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x18')]);router[_0x5ec1('0x7')](_0x5ec1('0x19'),auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x1a')]);router['get'](_0x5ec1('0x1b'),auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x1c')]);router[_0x5ec1('0x7')]('/voice/queues/preview/:id',auth[_0x5ec1('0x9')](),controller['voiceQueuesPreview']);router['get']('/voice/queues/channels',auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x1d')]);router[_0x5ec1('0x7')](_0x5ec1('0x1e'),auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x1f')]);router['get'](_0x5ec1('0x20'),auth['isAuthenticated'](),controller[_0x5ec1('0x21')]);router[_0x5ec1('0x7')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x22')]);router[_0x5ec1('0x7')](_0x5ec1('0x23'),auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x24')]);router['get']('/outbound',auth['isAuthenticated'](),controller[_0x5ec1('0x25')]);router['get'](_0x5ec1('0x26'),auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x27')]);router[_0x5ec1('0x7')]('/agents',auth[_0x5ec1('0x9')](),controller['agents']);router[_0x5ec1('0x28')](_0x5ec1('0x29'),auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x2a')]);router[_0x5ec1('0x7')]('/telephones',auth['isAuthenticated'](),controller[_0x5ec1('0x2b')]);router[_0x5ec1('0x7')](_0x5ec1('0x2c'),auth['isAuthenticated'](),controller[_0x5ec1('0x2d')]);router[_0x5ec1('0x7')]('/campaigns',auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x2e')]);router['get'](_0x5ec1('0x2f'),auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x30')]);router['get'](_0x5ec1('0x31'),auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x32')]);router[_0x5ec1('0x7')](_0x5ec1('0x33'),auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x34')]);router['get'](_0x5ec1('0x35'),auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x36')]);router[_0x5ec1('0x7')](_0x5ec1('0x37'),auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x38')]);router[_0x5ec1('0x7')]('/whatsapp/queues/waitinginteractions',auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x39')]);router[_0x5ec1('0x7')]('/fax/queues/waitinginteractions',auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x3a')]);router[_0x5ec1('0x3b')](_0x5ec1('0x3c'),auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x3d')](_0x5ec1('0x3e')));router[_0x5ec1('0x7')](_0x5ec1('0x3f'),auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x40')]);router[_0x5ec1('0x3b')](_0x5ec1('0x41'),auth[_0x5ec1('0x9')](),controller['queueNotify'](_0x5ec1('0x42')));router['get'](_0x5ec1('0x43'),auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x44')]);router[_0x5ec1('0x3b')]('/fax/queues/:id/notify',auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x3d')](_0x5ec1('0x45')));router[_0x5ec1('0x7')](_0x5ec1('0x46'),auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x47')]);router[_0x5ec1('0x3b')]('/openchannel/queues/:id/notify',auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x3d')](_0x5ec1('0x48')));router[_0x5ec1('0x7')](_0x5ec1('0x49'),auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x4a')]);router[_0x5ec1('0x3b')](_0x5ec1('0x4b'),auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x3d')](_0x5ec1('0x4c')));router['post'](_0x5ec1('0x4d'),auth['isAuthenticated'](),controller[_0x5ec1('0x3d')](_0x5ec1('0x4e')));router[_0x5ec1('0x7')]('/sms/queues/:id',auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x4f')]);router['get'](_0x5ec1('0x50'),auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x51')]);router[_0x5ec1('0x3b')](_0x5ec1('0x52'),auth[_0x5ec1('0x9')](),controller[_0x5ec1('0x53')]);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 5127730..62a35ba 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 _0x1f7d=['chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','SmsQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','findOne','Interaction','Account','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','TransferReport','create','*,*,*,*','agentNotify','channel','User','Agent\x20not\x20found','Message','queue','Start','agentTransferTimeout','moment','lodash','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','catch','json','sendStatus','stack','name','send','isNil','rows','find','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','Outbound','OutboundChannels','agents','Agents','agentCapacity','body','user','interaction','hasOwnProperty','MemberReport','findAll','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','format','agent','AgentCapacity','capacity','Telephones','trunks','campaigns','Campaigns'];(function(_0x1d7492,_0x34abc1){var _0xc17b6d=function(_0x11e13a){while(--_0x11e13a){_0x1d7492['push'](_0x1d7492['shift']());}};_0xc17b6d(++_0x34abc1);}(_0x1f7d,0xa2));var _0xd1f7=function(_0x2bd4c3,_0x407026){_0x2bd4c3=_0x2bd4c3-0x0;var _0x18ee4d=_0x1f7d[_0x2bd4c3];return _0x18ee4d;};'use strict';var BPromise=require('bluebird');var moment=require(_0xd1f7('0x0'));var _=require(_0xd1f7('0x1'));var util=require('util');var db=require(_0xd1f7('0x2'))['db'];var logger=require(_0xd1f7('0x3'))(_0xd1f7('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0xd1f7('0x5')]['http']({'port':0x232a});var mailClient=jayson[_0xd1f7('0x5')]['http']({'port':0x232b});var routingClient=jayson['client'][_0xd1f7('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x57493c,_0xdcc065,_0x5c6aa4){return new BPromise(function(_0x5396ea,_0x285b48){var _0x42f647=_0x5c6aa4?_0x5c6aa4:amiClient;return _0x42f647[_0xd1f7('0x7')](_0x57493c,_0xdcc065)[_0xd1f7('0x8')](function(_0x16a96b){if(_0x16a96b[_0xd1f7('0x9')]){if(_0x16a96b[_0xd1f7('0x9')][_0xd1f7('0xa')]===0x1f4){return _0x285b48(_0x16a96b[_0xd1f7('0x9')][_0xd1f7('0xb')]);}return _0x5396ea(_0x16a96b[_0xd1f7('0x9')][_0xd1f7('0xb')]);}else{_0x5396ea(_0x16a96b[_0xd1f7('0xc')]);}})[_0xd1f7('0xd')](function(_0x5acfd0){_0x285b48(_0x5acfd0);});});}function respondWithResult(_0x5661c8,_0x1af53f){_0x1af53f=_0x1af53f||0xc8;return function(_0x5c017f){if(_0x5c017f){return _0x5661c8['status'](_0x1af53f)[_0xd1f7('0xe')](_0x5c017f);}return _0x5661c8[_0xd1f7('0xf')](0x194);};}function handleError(_0xcab890,_0x8668ce){_0x8668ce=_0x8668ce||0x1f4;return function(_0x452ef8){logger[_0xd1f7('0x9')](_0x452ef8[_0xd1f7('0x10')]);if(_0x452ef8[_0xd1f7('0x11')]){delete _0x452ef8[_0xd1f7('0x11')];}_0xcab890['status'](_0x8668ce)[_0xd1f7('0x12')](_0x452ef8);};}function findById(_0x41e98d){return function(_0x16a241){if(!_[_0xd1f7('0x13')](_0x41e98d)&&!_[_0xd1f7('0x13')](_0x16a241)&&!_[_0xd1f7('0x13')](_0x16a241[_0xd1f7('0x14')])){return _[_0xd1f7('0x15')](_0x16a241['rows'],function(_0x312125){return _0x312125['id']==_0x41e98d;});}return null;};}exports['voiceChannels']=function(_0x3b4046,_0x39e58f){return respondWithRpcPromise(_0xd1f7('0x16'),_0x3b4046[_0xd1f7('0x17')])['then'](respondWithResult(_0x39e58f,null))['catch'](handleError(_0x39e58f,null));};exports[_0xd1f7('0x18')]=function(_0x2c1152,_0x567ff9){return respondWithRpcPromise(_0xd1f7('0x19'),_[_0xd1f7('0x1a')](_0x2c1152['query'],_0x2c1152[_0xd1f7('0x1b')]))[_0xd1f7('0x8')](respondWithResult(_0x567ff9,null))['catch'](handleError(_0x567ff9,null));};exports[_0xd1f7('0x1c')]=function(_0x2de095,_0x4ea278){return respondWithRpcPromise(_0xd1f7('0x1d'),_[_0xd1f7('0x1a')](_0x2de095[_0xd1f7('0x17')],_0x2de095[_0xd1f7('0x1b')]))[_0xd1f7('0x8')](respondWithResult(_0x4ea278,null))[_0xd1f7('0xd')](handleError(_0x4ea278,null));};exports['voiceQueues']=function(_0x3bebb2,_0x530640){return respondWithRpcPromise(_0xd1f7('0x1e'),_0x3bebb2[_0xd1f7('0x17')])['then'](respondWithResult(_0x530640,null))['catch'](handleError(_0x530640,null));};exports[_0xd1f7('0x1f')]=function(_0x156d39,_0x1e49b7){return respondWithRpcPromise('VoiceQueues',_0x156d39[_0xd1f7('0x17')])[_0xd1f7('0x8')](findById(_0x156d39[_0xd1f7('0x1b')]['id']))[_0xd1f7('0x8')](respondWithResult(_0x1e49b7,null))[_0xd1f7('0xd')](handleError(_0x1e49b7,null));};exports[_0xd1f7('0x20')]=function(_0x22229c,_0x32deb2){return respondWithRpcPromise(_0xd1f7('0x21'),_[_0xd1f7('0x1a')](_0x22229c[_0xd1f7('0x17')],_0x22229c[_0xd1f7('0x1b')]))[_0xd1f7('0x8')](respondWithResult(_0x32deb2,null))[_0xd1f7('0xd')](handleError(_0x32deb2,null));};exports[_0xd1f7('0x22')]=function(_0x2e1832,_0x3ea05b){return respondWithRpcPromise(_0xd1f7('0x23'),_0x2e1832[_0xd1f7('0x17')])['then'](respondWithResult(_0x3ea05b,null))['catch'](handleError(_0x3ea05b,null));};exports[_0xd1f7('0x24')]=function(_0x1bbb3b,_0xe8c23a){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xd1f7('0x1a')](_0x1bbb3b[_0xd1f7('0x17')],_0x1bbb3b[_0xd1f7('0x1b')]))[_0xd1f7('0x8')](respondWithResult(_0xe8c23a,null))[_0xd1f7('0xd')](handleError(_0xe8c23a,null));};exports[_0xd1f7('0x25')]=function(_0x124c3e,_0x234813){return respondWithRpcPromise(_0xd1f7('0x26'),_[_0xd1f7('0x1a')](_0x124c3e[_0xd1f7('0x17')],_0x124c3e[_0xd1f7('0x1b')]))[_0xd1f7('0x8')](respondWithResult(_0x234813,null))[_0xd1f7('0xd')](handleError(_0x234813,null));};exports[_0xd1f7('0x27')]=function(_0xb27f11,_0x3339f4){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xd1f7('0x1a')](_0xb27f11[_0xd1f7('0x17')],_0xb27f11[_0xd1f7('0x1b')]))[_0xd1f7('0x8')](respondWithResult(_0x3339f4,null))[_0xd1f7('0xd')](handleError(_0x3339f4,null));};exports['outbound']=function(_0x4b119d,_0x3ded5e){return respondWithRpcPromise(_0xd1f7('0x28'),_0x4b119d[_0xd1f7('0x17')])[_0xd1f7('0x8')](respondWithResult(_0x3ded5e,null))[_0xd1f7('0xd')](handleError(_0x3ded5e,null));};exports['outboundChannels']=function(_0x58270e,_0x15cdcd){return respondWithRpcPromise(_0xd1f7('0x29'),_0x58270e[_0xd1f7('0x17')])[_0xd1f7('0x8')](respondWithResult(_0x15cdcd,null))[_0xd1f7('0xd')](handleError(_0x15cdcd,null));};exports[_0xd1f7('0x2a')]=function(_0x2bfe06,_0x59825c){var _0x340cb1;return respondWithRpcPromise(_0xd1f7('0x2b'),_0x2bfe06[_0xd1f7('0x17')])[_0xd1f7('0x8')](function(_0x851963){_0x340cb1=_0x851963;return respondWithRpcPromise(_0xd1f7('0x2b'),_0x2bfe06[_0xd1f7('0x17')],routingClient);})[_0xd1f7('0x8')](function(_0x56daa2){return _[_0xd1f7('0x1a')]({},_0x56daa2,_0x340cb1);})[_0xd1f7('0x8')](respondWithResult(_0x59825c,null))[_0xd1f7('0xd')](handleError(_0x59825c,null));};exports[_0xd1f7('0x2c')]=function(_0x24847f,_0x2601ec){if(_0x24847f[_0xd1f7('0x2d')]&&_0x24847f[_0xd1f7('0x2d')]['interaction']&&_0x24847f[_0xd1f7('0x2e')]&&_0x24847f[_0xd1f7('0x2e')]['name']){for(var _0xbb6b71 in _0x24847f['body'][_0xd1f7('0x2f')]){if(_0x24847f['body'][_0xd1f7('0x2f')][_0xd1f7('0x30')](_0xbb6b71)){db[_0xd1f7('0x31')][_0xd1f7('0x32')]({'where':{'channel':_0xbb6b71,'membername':_0x24847f[_0xd1f7('0x2e')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x24847f['body']['interaction'][_0xbb6b71]&&_0x24847f[_0xd1f7('0x2d')]['interaction'][_0xbb6b71][_0xd1f7('0x33')]?{'$notIn':_0x24847f['body'][_0xd1f7('0x2f')][_0xbb6b71]}:{'$ne':null}}})[_0xd1f7('0x8')](function(_0x53132f){var _0xd97af4=moment()['format'](_0xd1f7('0x34'));for(var _0x8a1d4a=0x0,_0x138f40=_0x53132f[_0xd1f7('0x33')];_0x8a1d4a<_0x138f40;_0x8a1d4a+=0x1){_0x53132f[_0x8a1d4a][_0xd1f7('0x35')]({'exitAt':_0xd97af4});}});for(var _0xa76e20=0x0;_0xa76e20<_0x24847f['body'][_0xd1f7('0x2f')][_0xbb6b71][_0xd1f7('0x33')];_0xa76e20+=0x1){db[_0xd1f7('0x31')][_0xd1f7('0x36')]({'where':{'channel':_0xbb6b71,'membername':_0x24847f[_0xd1f7('0x2e')][_0xd1f7('0x11')],'type':'INTERACTION','uniqueid':_0x24847f['body']['interaction'][_0xbb6b71][_0xa76e20],'exitAt':null},'defaults':{'channel':_0xbb6b71,'membername':_0x24847f[_0xd1f7('0x2e')][_0xd1f7('0x11')],'interface':_[_0xd1f7('0x13')](_0x24847f[_0xd1f7('0x2e')][_0xd1f7('0x37')])?util[_0xd1f7('0x38')]('SIP/%s',_0x24847f[_0xd1f7('0x2e')][_0xd1f7('0x11')]):_0x24847f[_0xd1f7('0x2e')]['interface'],'type':'INTERACTION','enterAt':moment()['format'](_0xd1f7('0x34')),'role':_0xd1f7('0x39'),'internal':_0x24847f[_0xd1f7('0x2e')]['internal'],'uniqueid':_0x24847f[_0xd1f7('0x2d')][_0xd1f7('0x2f')][_0xbb6b71][_0xa76e20]}});}}}}return respondWithRpcPromise(_0xd1f7('0x3a'),{'id':_0x24847f[_0xd1f7('0x1b')]['id'],'capacity':_0x24847f['body'][_0xd1f7('0x3b')]},routingClient)[_0xd1f7('0x8')](respondWithResult(_0x2601ec,null))['catch'](handleError(_0x2601ec,null));};exports['telephones']=function(_0xa50907,_0x549a69){return respondWithRpcPromise(_0xd1f7('0x3c'),_0xa50907[_0xd1f7('0x17')])[_0xd1f7('0x8')](respondWithResult(_0x549a69,null))[_0xd1f7('0xd')](handleError(_0x549a69,null));};exports[_0xd1f7('0x3d')]=function(_0xefd812,_0xed7fc1){return respondWithRpcPromise('Trunks',_0xefd812[_0xd1f7('0x17')])[_0xd1f7('0x8')](respondWithResult(_0xed7fc1,null))[_0xd1f7('0xd')](handleError(_0xed7fc1,null));};exports[_0xd1f7('0x3e')]=function(_0x566b0d,_0x3ccc76){return respondWithRpcPromise(_0xd1f7('0x3f'),_0x566b0d[_0xd1f7('0x17')])[_0xd1f7('0x8')](respondWithResult(_0x3ccc76,null))['catch'](handleError(_0x3ccc76,null));};exports[_0xd1f7('0x40')]=function(_0x215fe0,_0x5f45dd){return respondWithRpcPromise(_0xd1f7('0x41'),_0x215fe0['query'],routingClient)[_0xd1f7('0x8')](respondWithResult(_0x5f45dd,null))['catch'](handleError(_0x5f45dd,null));};exports[_0xd1f7('0x42')]=function(_0x4eb3fb,_0x1a2201){return respondWithRpcPromise(_0xd1f7('0x41'),_0x4eb3fb[_0xd1f7('0x17')],routingClient)[_0xd1f7('0x8')](findById(_0x4eb3fb[_0xd1f7('0x1b')]['id']))[_0xd1f7('0x8')](respondWithResult(_0x1a2201,null))[_0xd1f7('0xd')](handleError(_0x1a2201,null));};exports[_0xd1f7('0x43')]=function(_0x15555b,_0x5ae745){return respondWithRpcPromise(_0xd1f7('0x44'),_0x15555b[_0xd1f7('0x17')],routingClient)[_0xd1f7('0x8')](respondWithResult(_0x5ae745,null))[_0xd1f7('0xd')](handleError(_0x5ae745,null));};exports['showMailQueues']=function(_0x36b82d,_0xea2e18){return respondWithRpcPromise(_0xd1f7('0x44'),_0x36b82d[_0xd1f7('0x17')],routingClient)[_0xd1f7('0x8')](findById(_0x36b82d[_0xd1f7('0x1b')]['id']))[_0xd1f7('0x8')](respondWithResult(_0xea2e18,null))['catch'](handleError(_0xea2e18,null));};exports[_0xd1f7('0x45')]=function(_0x3ffff0,_0x34e7f2){return respondWithRpcPromise(_0xd1f7('0x46'),_0x3ffff0[_0xd1f7('0x17')],mailClient)[_0xd1f7('0x8')](respondWithResult(_0x34e7f2,null))[_0xd1f7('0xd')](handleError(_0x34e7f2,null));};exports[_0xd1f7('0x47')]=function(_0x4c3de6,_0x30396d){return respondWithRpcPromise(_0xd1f7('0x48'),_0x4c3de6[_0xd1f7('0x17')],routingClient)[_0xd1f7('0x8')](respondWithResult(_0x30396d,null))[_0xd1f7('0xd')](handleError(_0x30396d,null));};exports[_0xd1f7('0x49')]=function(_0x56dc29,_0x58ddd6){return respondWithRpcPromise(_0xd1f7('0x48'),_0x56dc29[_0xd1f7('0x17')],routingClient)[_0xd1f7('0x8')](findById(_0x56dc29[_0xd1f7('0x1b')]['id']))[_0xd1f7('0x8')](respondWithResult(_0x58ddd6,null))['catch'](handleError(_0x58ddd6,null));};exports['smsQueues']=function(_0x42cc2c,_0x208a12){return respondWithRpcPromise(_0xd1f7('0x4a'),_0x42cc2c[_0xd1f7('0x17')],routingClient)[_0xd1f7('0x8')](respondWithResult(_0x208a12,null))[_0xd1f7('0xd')](handleError(_0x208a12,null));};exports['showSmsQueues']=function(_0x3ff86f,_0x401199){return respondWithRpcPromise('SmsQueues',_0x3ff86f[_0xd1f7('0x17')],routingClient)[_0xd1f7('0x8')](findById(_0x3ff86f['params']['id']))[_0xd1f7('0x8')](respondWithResult(_0x401199,null))[_0xd1f7('0xd')](handleError(_0x401199,null));};exports['whatsappQueues']=function(_0x99cc49,_0x461f9f){return respondWithRpcPromise(_0xd1f7('0x4b'),_0x99cc49['query'],routingClient)[_0xd1f7('0x8')](respondWithResult(_0x461f9f,null))[_0xd1f7('0xd')](handleError(_0x461f9f,null));};exports['showWhatsappQueues']=function(_0x456472,_0x47d7cf){return respondWithRpcPromise('WhatsappQueues',_0x456472[_0xd1f7('0x17')],routingClient)[_0xd1f7('0x8')](findById(_0x456472['params']['id']))[_0xd1f7('0x8')](respondWithResult(_0x47d7cf,null))[_0xd1f7('0xd')](handleError(_0x47d7cf,null));};exports[_0xd1f7('0x4c')]=function(_0x1172fe,_0x405727){return respondWithRpcPromise(_0xd1f7('0x4d'),_0x1172fe[_0xd1f7('0x17')],routingClient)['then'](respondWithResult(_0x405727,null))[_0xd1f7('0xd')](handleError(_0x405727,null));};exports[_0xd1f7('0x4e')]=function(_0x2ba31,_0x12aa8c){return respondWithRpcPromise(_0xd1f7('0x4d'),_0x2ba31[_0xd1f7('0x17')],routingClient)[_0xd1f7('0x8')](findById(_0x2ba31[_0xd1f7('0x1b')]['id']))['then'](respondWithResult(_0x12aa8c,null))['catch'](handleError(_0x12aa8c,null));};exports[_0xd1f7('0x4f')]=function(_0x488b1f,_0x135700){return respondWithRpcPromise(_0xd1f7('0x50'),_0x488b1f[_0xd1f7('0x17')])['then'](respondWithResult(_0x135700,null))[_0xd1f7('0xd')](handleError(_0x135700,null));};exports[_0xd1f7('0x51')]=function(_0x226042,_0xb4b364){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x226042['query'],routingClient)[_0xd1f7('0x8')](respondWithResult(_0xb4b364,null))[_0xd1f7('0xd')](handleError(_0xb4b364,null));};exports[_0xd1f7('0x52')]=function(_0x28ad84,_0x201e10){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x28ad84[_0xd1f7('0x17')],routingClient)[_0xd1f7('0x8')](respondWithResult(_0x201e10,null))[_0xd1f7('0xd')](handleError(_0x201e10,null));};exports[_0xd1f7('0x53')]=function(_0x426d28,_0xef0200){return respondWithRpcPromise(_0xd1f7('0x54'),_0x426d28[_0xd1f7('0x17')],routingClient)[_0xd1f7('0x8')](respondWithResult(_0xef0200,null))[_0xd1f7('0xd')](handleError(_0xef0200,null));};exports['smsQueuesWaitingInteractions']=function(_0x3db1bb,_0x1cfdcb){return respondWithRpcPromise(_0xd1f7('0x55'),_0x3db1bb[_0xd1f7('0x17')],routingClient)[_0xd1f7('0x8')](respondWithResult(_0x1cfdcb,null))[_0xd1f7('0xd')](handleError(_0x1cfdcb,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x483d4c,_0x404d09){return respondWithRpcPromise(_0xd1f7('0x56'),_0x483d4c[_0xd1f7('0x17')],routingClient)[_0xd1f7('0x8')](respondWithResult(_0x404d09,null))[_0xd1f7('0xd')](handleError(_0x404d09,null));};exports[_0xd1f7('0x57')]=function(_0x279b43,_0xa78f3e){return respondWithRpcPromise(_0xd1f7('0x58'),_0x279b43[_0xd1f7('0x17')],routingClient)['then'](respondWithResult(_0xa78f3e,null))[_0xd1f7('0xd')](handleError(_0xa78f3e,null));};exports[_0xd1f7('0x59')]=function(_0x522ca0){return function(_0xd9a285,_0x4ba31f){var _0x367e59,_0xe823b;var _0x2083f1=_[_0xd1f7('0x5a')](_0x522ca0);var _0x4dbae9=_0x522ca0===_0xd1f7('0x5b')?_0xd1f7('0x5c'):'Account';return db[_0x2083f1+_0xd1f7('0x5d')][_0xd1f7('0x5e')]({'raw':!![],'where':{'id':_0xd9a285[_0xd1f7('0x1b')]['id']}})['then'](function(_0x2bdfac){if(_[_0xd1f7('0x13')](_0x2bdfac)){throw new Error(_0x2083f1+'\x20Queue\x20not\x20found');}_0x367e59=_0x2bdfac;return db[_0x2083f1+'Message']['findOne']({'where':{'id':_0xd9a285[_0xd1f7('0x2d')]['messageId']},'include':[{'model':db[_0x2083f1+_0xd1f7('0x5f')],'as':_0xd1f7('0x5f')},{'model':db[_0x2083f1+_0x4dbae9],'as':_0xd1f7('0x60')}]});})[_0xd1f7('0x8')](function(_0x243b11){if(_[_0xd1f7('0x13')](_0x243b11)){throw new Error(_0x2083f1+_0xd1f7('0x61'));}_0xe823b=_0x243b11;return _0x243b11[_0xd1f7('0x62')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd1f7('0x8')](function(){var _0x5eecf8={'uniqueid':_0x522ca0+'.'+_0xe823b['id']+'.'+_0xe823b['Interaction']['id'],'FromUserId':_0xd9a285[_0xd1f7('0x2e')]['id'],'type':'queue'};_0x5eecf8[_0x2083f1+_0xd1f7('0x63')]=_0xe823b['id'];_0x5eecf8[_0x2083f1+_0xd1f7('0x64')]=_0xe823b[_0xd1f7('0x5f')]['id'];_0x5eecf8[_0xd1f7('0x65')+_0x2083f1+_0x4dbae9+'Id']=_0xe823b['Account']['id'];_0x5eecf8['To'+_0x2083f1+'QueueId']=_0x367e59['id'];return db[_0x2083f1+_0xd1f7('0x66')][_0xd1f7('0x67')](_0x5eecf8);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x522ca0,'interaction':_0xe823b[_0xd1f7('0x5f')],'message':_0xe823b,'account':_0xe823b[_0xd1f7('0x60')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x367e59['name']+','+(_0xe823b[_0xd1f7('0x60')]['queueTransferTimeout']||0x12c),'interval':_0xd1f7('0x68')}]},routingClient);})[_0xd1f7('0x8')](respondWithResult(_0x4ba31f,null))[_0xd1f7('0xd')](handleError(_0x4ba31f,null));};};exports[_0xd1f7('0x69')]=function(_0x407c2b,_0x57ce5c){var _0x37ca2f,_0x10118e;if(_[_0xd1f7('0x13')](_0x407c2b[_0xd1f7('0x2d')][_0xd1f7('0x6a')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x55cd0e=_0x407c2b[_0xd1f7('0x2d')]['channel'];var _0x17bc7b=_['capitalize'](_0x55cd0e);var _0x53cdb8=_0x55cd0e===_0xd1f7('0x5b')?_0xd1f7('0x5c'):_0xd1f7('0x60');return db[_0xd1f7('0x6b')][_0xd1f7('0x5e')]({'raw':!![],'where':{'id':_0x407c2b[_0xd1f7('0x1b')]['id'],'role':_0xd1f7('0x39')}})['then'](function(_0x404a13){if(_['isNil'](_0x404a13)){throw new Error(_0xd1f7('0x6c'));}_0x37ca2f=_0x404a13;return db[_0x17bc7b+_0xd1f7('0x6d')]['findOne']({'where':{'id':_0x407c2b[_0xd1f7('0x2d')]['messageId']},'include':[{'model':db[_0x17bc7b+_0xd1f7('0x5f')],'as':_0xd1f7('0x5f')},{'model':db[_0x17bc7b+_0x53cdb8],'as':_0xd1f7('0x60')}]});})[_0xd1f7('0x8')](function(_0x18d5bc){if(_['isNil'](_0x18d5bc)){throw new Error(_0x17bc7b+'\x20Message\x20not\x20found');}_0x10118e=_0x18d5bc;return _0x18d5bc['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xd1f7('0x8')](function(){var _0x39a917={'uniqueid':_0x55cd0e+'.'+_0x10118e['id']+'.'+_0x10118e['Interaction']['id'],'FromUserId':_0x407c2b[_0xd1f7('0x2e')]['id'],'type':_0xd1f7('0x6e'),'ToUserId':_0x37ca2f['id']};_0x39a917[_0x17bc7b+_0xd1f7('0x63')]=_0x10118e['id'];_0x39a917[_0x17bc7b+'InteractionId']=_0x10118e[_0xd1f7('0x5f')]['id'];_0x39a917['From'+_0x17bc7b+_0x53cdb8+'Id']=_0x10118e[_0xd1f7('0x60')]['id'];return db[_0x17bc7b+_0xd1f7('0x66')][_0xd1f7('0x67')](_0x39a917);})[_0xd1f7('0x8')](function(){return respondWithRpcPromise(_0xd1f7('0x6f'),{'channel':_0x55cd0e,'interaction':_0x10118e['Interaction'],'message':_0x10118e,'account':_0x10118e[_0xd1f7('0x60')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd1f7('0x39'),'appdata':_0x37ca2f[_0xd1f7('0x11')]+','+(_0x10118e[_0xd1f7('0x60')][_0xd1f7('0x70')]||0x12c),'interval':_0xd1f7('0x68')}]},routingClient);})[_0xd1f7('0x8')](respondWithResult(_0x57ce5c,null))['catch'](handleError(_0x57ce5c,null));}; \ No newline at end of file +var _0x19e2=['queueNotify','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','Interaction','update','queue','MessageId','InteractionId','From','QueueId','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','create','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','status','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','catch','VoiceChannelMixMonitor','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','OutboundChannels','agents','Agents','body','interaction','user','hasOwnProperty','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','agent','internal','AgentCapacity','capacity','trunks','Trunks','campaigns','Campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x19e2,0x109));var _0x219e=function(_0x8e68b3,_0x5126d6){_0x8e68b3=_0x8e68b3-0x0;var _0x559dc3=_0x19e2[_0x8e68b3];return _0x559dc3;};'use strict';var BPromise=require(_0x219e('0x0'));var moment=require(_0x219e('0x1'));var _=require(_0x219e('0x2'));var util=require(_0x219e('0x3'));var db=require(_0x219e('0x4'))['db'];var logger=require(_0x219e('0x5'))(_0x219e('0x6'));var jayson=require(_0x219e('0x7'));var amiClient=jayson[_0x219e('0x8')][_0x219e('0x9')]({'port':0x232a});var mailClient=jayson['client'][_0x219e('0x9')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x45a6a1,_0x19e898,_0x21eb78){return new BPromise(function(_0x2456ed,_0x6023d8){var _0x27c5c8=_0x21eb78?_0x21eb78:amiClient;return _0x27c5c8[_0x219e('0xa')](_0x45a6a1,_0x19e898)[_0x219e('0xb')](function(_0x2601c3){if(_0x2601c3[_0x219e('0xc')]){if(_0x2601c3['error'][_0x219e('0xd')]===0x1f4){return _0x6023d8(_0x2601c3['error'][_0x219e('0xe')]);}return _0x2456ed(_0x2601c3[_0x219e('0xc')]['message']);}else{_0x2456ed(_0x2601c3['result']);}})['catch'](function(_0x54bdb6){_0x6023d8(_0x54bdb6);});});}function respondWithResult(_0x5ed87b,_0x41de2d){_0x41de2d=_0x41de2d||0xc8;return function(_0x1ffee1){if(_0x1ffee1){return _0x5ed87b[_0x219e('0xf')](_0x41de2d)['json'](_0x1ffee1);}return _0x5ed87b[_0x219e('0x10')](0x194);};}function handleError(_0x5780dd,_0x3d3604){_0x3d3604=_0x3d3604||0x1f4;return function(_0x5d0fc7){logger[_0x219e('0xc')](_0x5d0fc7[_0x219e('0x11')]);if(_0x5d0fc7[_0x219e('0x12')]){delete _0x5d0fc7[_0x219e('0x12')];}_0x5780dd[_0x219e('0xf')](_0x3d3604)[_0x219e('0x13')](_0x5d0fc7);};}function findById(_0x8a5c2f){return function(_0x3cadcb){if(!_['isNil'](_0x8a5c2f)&&!_['isNil'](_0x3cadcb)&&!_[_0x219e('0x14')](_0x3cadcb[_0x219e('0x15')])){return _[_0x219e('0x16')](_0x3cadcb[_0x219e('0x15')],function(_0x51395d){return _0x51395d['id']==_0x8a5c2f;});}return null;};}exports[_0x219e('0x17')]=function(_0x4e1bde,_0x1e56cb){return respondWithRpcPromise(_0x219e('0x18'),_0x4e1bde[_0x219e('0x19')])['then'](respondWithResult(_0x1e56cb,null))[_0x219e('0x1a')](handleError(_0x1e56cb,null));};exports['voiceChannelMixMonitor']=function(_0x361130,_0x1bfefc){return respondWithRpcPromise(_0x219e('0x1b'),_['merge'](_0x361130[_0x219e('0x19')],_0x361130[_0x219e('0x1c')]))[_0x219e('0xb')](respondWithResult(_0x1bfefc,null))[_0x219e('0x1a')](handleError(_0x1bfefc,null));};exports[_0x219e('0x1d')]=function(_0x407fe1,_0xfe8e51){return respondWithRpcPromise(_0x219e('0x1e'),_[_0x219e('0x1f')](_0x407fe1[_0x219e('0x19')],_0x407fe1[_0x219e('0x1c')]))[_0x219e('0xb')](respondWithResult(_0xfe8e51,null))[_0x219e('0x1a')](handleError(_0xfe8e51,null));};exports[_0x219e('0x20')]=function(_0xf60401,_0x290665){return respondWithRpcPromise(_0x219e('0x21'),_0xf60401['query'])['then'](respondWithResult(_0x290665,null))[_0x219e('0x1a')](handleError(_0x290665,null));};exports[_0x219e('0x22')]=function(_0x50879e,_0x4d03ea){return respondWithRpcPromise(_0x219e('0x21'),_0x50879e[_0x219e('0x19')])['then'](findById(_0x50879e[_0x219e('0x1c')]['id']))[_0x219e('0xb')](respondWithResult(_0x4d03ea,null))['catch'](handleError(_0x4d03ea,null));};exports['voiceQueuesPreview']=function(_0x135cdd,_0x22b986){return respondWithRpcPromise(_0x219e('0x23'),_['merge'](_0x135cdd[_0x219e('0x19')],_0x135cdd[_0x219e('0x1c')]))[_0x219e('0xb')](respondWithResult(_0x22b986,null))[_0x219e('0x1a')](handleError(_0x22b986,null));};exports[_0x219e('0x24')]=function(_0x50fe5d,_0x29395f){return respondWithRpcPromise(_0x219e('0x25'),_0x50fe5d[_0x219e('0x19')])[_0x219e('0xb')](respondWithResult(_0x29395f,null))[_0x219e('0x1a')](handleError(_0x29395f,null));};exports[_0x219e('0x26')]=function(_0x24c261,_0xf5ba3f){return respondWithRpcPromise(_0x219e('0x27'),_[_0x219e('0x1f')](_0x24c261[_0x219e('0x19')],_0x24c261[_0x219e('0x1c')]))[_0x219e('0xb')](respondWithResult(_0xf5ba3f,null))[_0x219e('0x1a')](handleError(_0xf5ba3f,null));};exports[_0x219e('0x28')]=function(_0x196af5,_0x3f6702){return respondWithRpcPromise(_0x219e('0x29'),_[_0x219e('0x1f')](_0x196af5[_0x219e('0x19')],_0x196af5[_0x219e('0x1c')]))[_0x219e('0xb')](respondWithResult(_0x3f6702,null))[_0x219e('0x1a')](handleError(_0x3f6702,null));};exports[_0x219e('0x2a')]=function(_0x48895e,_0x396703){return respondWithRpcPromise(_0x219e('0x2b'),_[_0x219e('0x1f')](_0x48895e['query'],_0x48895e[_0x219e('0x1c')]))[_0x219e('0xb')](respondWithResult(_0x396703,null))[_0x219e('0x1a')](handleError(_0x396703,null));};exports[_0x219e('0x2c')]=function(_0x10aa68,_0x145082){return respondWithRpcPromise('Outbound',_0x10aa68[_0x219e('0x19')])[_0x219e('0xb')](respondWithResult(_0x145082,null))[_0x219e('0x1a')](handleError(_0x145082,null));};exports['outboundChannels']=function(_0x4b03ff,_0x79c72a){return respondWithRpcPromise(_0x219e('0x2d'),_0x4b03ff['query'])[_0x219e('0xb')](respondWithResult(_0x79c72a,null))[_0x219e('0x1a')](handleError(_0x79c72a,null));};exports[_0x219e('0x2e')]=function(_0x4e3194,_0x4f6c27){var _0x2b05b2;return respondWithRpcPromise(_0x219e('0x2f'),_0x4e3194['query'])['then'](function(_0x5797e6){_0x2b05b2=_0x5797e6;return respondWithRpcPromise(_0x219e('0x2f'),_0x4e3194['query'],routingClient);})[_0x219e('0xb')](function(_0x3440e7){return _[_0x219e('0x1f')]({},_0x3440e7,_0x2b05b2);})['then'](respondWithResult(_0x4f6c27,null))[_0x219e('0x1a')](handleError(_0x4f6c27,null));};exports['agentCapacity']=function(_0x3e32b7,_0x224f10){if(_0x3e32b7[_0x219e('0x30')]&&_0x3e32b7['body'][_0x219e('0x31')]&&_0x3e32b7[_0x219e('0x32')]&&_0x3e32b7[_0x219e('0x32')][_0x219e('0x12')]){for(var _0x5a22ae in _0x3e32b7[_0x219e('0x30')][_0x219e('0x31')]){if(_0x3e32b7[_0x219e('0x30')][_0x219e('0x31')][_0x219e('0x33')](_0x5a22ae)){db['MemberReport'][_0x219e('0x34')]({'where':{'channel':_0x5a22ae,'membername':_0x3e32b7[_0x219e('0x32')]['name'],'type':_0x219e('0x35'),'exitAt':null,'uniqueid':_0x3e32b7[_0x219e('0x30')][_0x219e('0x31')][_0x5a22ae]&&_0x3e32b7[_0x219e('0x30')][_0x219e('0x31')][_0x5a22ae][_0x219e('0x36')]?{'$notIn':_0x3e32b7['body']['interaction'][_0x5a22ae]}:{'$ne':null}}})[_0x219e('0xb')](function(_0x2d49d9){var _0x59f086=moment()[_0x219e('0x37')](_0x219e('0x38'));for(var _0xf485ad=0x0,_0x2d71cc=_0x2d49d9[_0x219e('0x36')];_0xf485ad<_0x2d71cc;_0xf485ad+=0x1){_0x2d49d9[_0xf485ad][_0x219e('0x39')]({'exitAt':_0x59f086});}});for(var _0x53622a=0x0;_0x53622a<_0x3e32b7[_0x219e('0x30')][_0x219e('0x31')][_0x5a22ae][_0x219e('0x36')];_0x53622a+=0x1){db['MemberReport'][_0x219e('0x3a')]({'where':{'channel':_0x5a22ae,'membername':_0x3e32b7[_0x219e('0x32')]['name'],'type':_0x219e('0x35'),'uniqueid':_0x3e32b7[_0x219e('0x30')][_0x219e('0x31')][_0x5a22ae][_0x53622a],'exitAt':null},'defaults':{'channel':_0x5a22ae,'membername':_0x3e32b7['user'][_0x219e('0x12')],'interface':_[_0x219e('0x14')](_0x3e32b7[_0x219e('0x32')][_0x219e('0x3b')])?util[_0x219e('0x37')]('SIP/%s',_0x3e32b7[_0x219e('0x32')][_0x219e('0x12')]):_0x3e32b7[_0x219e('0x32')]['interface'],'type':_0x219e('0x35'),'enterAt':moment()['format'](_0x219e('0x38')),'role':_0x219e('0x3c'),'internal':_0x3e32b7['user'][_0x219e('0x3d')],'uniqueid':_0x3e32b7['body']['interaction'][_0x5a22ae][_0x53622a]}});}}}}return respondWithRpcPromise(_0x219e('0x3e'),{'id':_0x3e32b7[_0x219e('0x1c')]['id'],'capacity':_0x3e32b7[_0x219e('0x30')][_0x219e('0x3f')]},routingClient)[_0x219e('0xb')](respondWithResult(_0x224f10,null))['catch'](handleError(_0x224f10,null));};exports['telephones']=function(_0x5ccb7f,_0xf370ec){return respondWithRpcPromise('Telephones',_0x5ccb7f[_0x219e('0x19')])['then'](respondWithResult(_0xf370ec,null))['catch'](handleError(_0xf370ec,null));};exports[_0x219e('0x40')]=function(_0x4041ab,_0x38b120){return respondWithRpcPromise(_0x219e('0x41'),_0x4041ab[_0x219e('0x19')])[_0x219e('0xb')](respondWithResult(_0x38b120,null))[_0x219e('0x1a')](handleError(_0x38b120,null));};exports[_0x219e('0x42')]=function(_0x1236eb,_0x2ba0da){return respondWithRpcPromise(_0x219e('0x43'),_0x1236eb[_0x219e('0x19')])['then'](respondWithResult(_0x2ba0da,null))[_0x219e('0x1a')](handleError(_0x2ba0da,null));};exports['chatQueues']=function(_0x5f37fe,_0x28d8dd){return respondWithRpcPromise(_0x219e('0x44'),_0x5f37fe[_0x219e('0x19')],routingClient)[_0x219e('0xb')](respondWithResult(_0x28d8dd,null))[_0x219e('0x1a')](handleError(_0x28d8dd,null));};exports[_0x219e('0x45')]=function(_0x2bc8cc,_0x10ff75){return respondWithRpcPromise('ChatQueues',_0x2bc8cc[_0x219e('0x19')],routingClient)['then'](findById(_0x2bc8cc[_0x219e('0x1c')]['id']))[_0x219e('0xb')](respondWithResult(_0x10ff75,null))[_0x219e('0x1a')](handleError(_0x10ff75,null));};exports[_0x219e('0x46')]=function(_0x5c5f4d,_0x5f14ea){return respondWithRpcPromise(_0x219e('0x47'),_0x5c5f4d[_0x219e('0x19')],routingClient)[_0x219e('0xb')](respondWithResult(_0x5f14ea,null))[_0x219e('0x1a')](handleError(_0x5f14ea,null));};exports[_0x219e('0x48')]=function(_0x4663a9,_0x49668e){return respondWithRpcPromise('MailQueues',_0x4663a9[_0x219e('0x19')],routingClient)['then'](findById(_0x4663a9[_0x219e('0x1c')]['id']))[_0x219e('0xb')](respondWithResult(_0x49668e,null))[_0x219e('0x1a')](handleError(_0x49668e,null));};exports['mailAccounts']=function(_0x3ec0af,_0x4e315d){return respondWithRpcPromise('MailAccounts',_0x3ec0af[_0x219e('0x19')],mailClient)[_0x219e('0xb')](respondWithResult(_0x4e315d,null))[_0x219e('0x1a')](handleError(_0x4e315d,null));};exports[_0x219e('0x49')]=function(_0x321672,_0x49cf83){return respondWithRpcPromise(_0x219e('0x4a'),_0x321672[_0x219e('0x19')],routingClient)[_0x219e('0xb')](respondWithResult(_0x49cf83,null))['catch'](handleError(_0x49cf83,null));};exports['showOpenchannelQueues']=function(_0x19244c,_0x2fb561){return respondWithRpcPromise(_0x219e('0x4a'),_0x19244c[_0x219e('0x19')],routingClient)[_0x219e('0xb')](findById(_0x19244c['params']['id']))[_0x219e('0xb')](respondWithResult(_0x2fb561,null))['catch'](handleError(_0x2fb561,null));};exports[_0x219e('0x4b')]=function(_0x5b7cb1,_0x464820){return respondWithRpcPromise(_0x219e('0x4c'),_0x5b7cb1[_0x219e('0x19')],routingClient)[_0x219e('0xb')](respondWithResult(_0x464820,null))['catch'](handleError(_0x464820,null));};exports['showSmsQueues']=function(_0x3c4a00,_0x4243cf){return respondWithRpcPromise(_0x219e('0x4c'),_0x3c4a00[_0x219e('0x19')],routingClient)[_0x219e('0xb')](findById(_0x3c4a00['params']['id']))[_0x219e('0xb')](respondWithResult(_0x4243cf,null))['catch'](handleError(_0x4243cf,null));};exports[_0x219e('0x4d')]=function(_0x4d563c,_0x56a8d4){return respondWithRpcPromise('WhatsappQueues',_0x4d563c[_0x219e('0x19')],routingClient)[_0x219e('0xb')](respondWithResult(_0x56a8d4,null))[_0x219e('0x1a')](handleError(_0x56a8d4,null));};exports[_0x219e('0x4e')]=function(_0x34d210,_0x20d0ce){return respondWithRpcPromise(_0x219e('0x4f'),_0x34d210[_0x219e('0x19')],routingClient)[_0x219e('0xb')](findById(_0x34d210['params']['id']))[_0x219e('0xb')](respondWithResult(_0x20d0ce,null))[_0x219e('0x1a')](handleError(_0x20d0ce,null));};exports[_0x219e('0x50')]=function(_0x43777c,_0x2ec10a){return respondWithRpcPromise(_0x219e('0x51'),_0x43777c[_0x219e('0x19')],routingClient)[_0x219e('0xb')](respondWithResult(_0x2ec10a,null))[_0x219e('0x1a')](handleError(_0x2ec10a,null));};exports[_0x219e('0x52')]=function(_0x12d38b,_0x21621a){return respondWithRpcPromise(_0x219e('0x51'),_0x12d38b[_0x219e('0x19')],routingClient)['then'](findById(_0x12d38b[_0x219e('0x1c')]['id']))['then'](respondWithResult(_0x21621a,null))[_0x219e('0x1a')](handleError(_0x21621a,null));};exports[_0x219e('0x53')]=function(_0xa66e5b,_0x553579){return respondWithRpcPromise(_0x219e('0x54'),_0xa66e5b[_0x219e('0x19')])[_0x219e('0xb')](respondWithResult(_0x553579,null))[_0x219e('0x1a')](handleError(_0x553579,null));};exports[_0x219e('0x55')]=function(_0x2d7b65,_0x272a3a){return respondWithRpcPromise(_0x219e('0x56'),_0x2d7b65[_0x219e('0x19')],routingClient)[_0x219e('0xb')](respondWithResult(_0x272a3a,null))['catch'](handleError(_0x272a3a,null));};exports[_0x219e('0x57')]=function(_0x1bdfdc,_0x800454){return respondWithRpcPromise(_0x219e('0x58'),_0x1bdfdc[_0x219e('0x19')],routingClient)[_0x219e('0xb')](respondWithResult(_0x800454,null))[_0x219e('0x1a')](handleError(_0x800454,null));};exports[_0x219e('0x59')]=function(_0x3bbad3,_0x3258c7){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x3bbad3['query'],routingClient)[_0x219e('0xb')](respondWithResult(_0x3258c7,null))['catch'](handleError(_0x3258c7,null));};exports['smsQueuesWaitingInteractions']=function(_0x3e0f23,_0x5ce932){return respondWithRpcPromise(_0x219e('0x5a'),_0x3e0f23[_0x219e('0x19')],routingClient)[_0x219e('0xb')](respondWithResult(_0x5ce932,null))[_0x219e('0x1a')](handleError(_0x5ce932,null));};exports[_0x219e('0x5b')]=function(_0x17c567,_0x3a2ca3){return respondWithRpcPromise(_0x219e('0x5c'),_0x17c567[_0x219e('0x19')],routingClient)[_0x219e('0xb')](respondWithResult(_0x3a2ca3,null))[_0x219e('0x1a')](handleError(_0x3a2ca3,null));};exports[_0x219e('0x5d')]=function(_0x596d27,_0xffba7d){return respondWithRpcPromise(_0x219e('0x5e'),_0x596d27[_0x219e('0x19')],routingClient)[_0x219e('0xb')](respondWithResult(_0xffba7d,null))[_0x219e('0x1a')](handleError(_0xffba7d,null));};exports[_0x219e('0x5f')]=function(_0x3527d0){return function(_0x3ed31f,_0x254ee3){var _0x207ebd,_0x2eb4b0;var _0x3f8eb4=_[_0x219e('0x60')](_0x3527d0);var _0x59ebf7=_0x3527d0===_0x219e('0x61')?_0x219e('0x62'):_0x219e('0x63');return db[_0x3f8eb4+'Queue'][_0x219e('0x64')]({'raw':!![],'where':{'id':_0x3ed31f[_0x219e('0x1c')]['id']}})['then'](function(_0x40a156){if(_['isNil'](_0x40a156)){throw new Error(_0x3f8eb4+_0x219e('0x65'));}_0x207ebd=_0x40a156;return db[_0x3f8eb4+_0x219e('0x66')]['findOne']({'where':{'id':_0x3ed31f['body']['messageId']},'include':[{'model':db[_0x3f8eb4+_0x219e('0x67')],'as':_0x219e('0x67')},{'model':db[_0x3f8eb4+_0x59ebf7],'as':_0x219e('0x63')}]});})[_0x219e('0xb')](function(_0x39c139){if(_['isNil'](_0x39c139)){throw new Error(_0x3f8eb4+'\x20Message\x20not\x20found');}_0x2eb4b0=_0x39c139;return _0x39c139[_0x219e('0x68')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x2019bd={'uniqueid':_0x3527d0+'.'+_0x2eb4b0['id']+'.'+_0x2eb4b0['Interaction']['id'],'FromUserId':_0x3ed31f[_0x219e('0x32')]['id'],'type':_0x219e('0x69')};_0x2019bd[_0x3f8eb4+_0x219e('0x6a')]=_0x2eb4b0['id'];_0x2019bd[_0x3f8eb4+_0x219e('0x6b')]=_0x2eb4b0[_0x219e('0x67')]['id'];_0x2019bd[_0x219e('0x6c')+_0x3f8eb4+_0x59ebf7+'Id']=_0x2eb4b0[_0x219e('0x63')]['id'];_0x2019bd['To'+_0x3f8eb4+_0x219e('0x6d')]=_0x207ebd['id'];return db[_0x3f8eb4+'TransferReport']['create'](_0x2019bd);})[_0x219e('0xb')](function(){return respondWithRpcPromise(_0x219e('0x6e'),{'channel':_0x3527d0,'interaction':_0x2eb4b0['Interaction'],'message':_0x2eb4b0,'account':_0x2eb4b0[_0x219e('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':_0x219e('0x69'),'appdata':_0x207ebd[_0x219e('0x12')]+','+(_0x2eb4b0[_0x219e('0x63')][_0x219e('0x6f')]||0x12c),'interval':_0x219e('0x70')}]},routingClient);})[_0x219e('0xb')](respondWithResult(_0x254ee3,null))[_0x219e('0x1a')](handleError(_0x254ee3,null));};};exports[_0x219e('0x71')]=function(_0x28adb6,_0x3b6915){var _0x245705,_0x23eaa6;if(_['isNil'](_0x28adb6[_0x219e('0x30')][_0x219e('0x72')])){throw new Error(_0x219e('0x73'));}var _0x2509bd=_0x28adb6[_0x219e('0x30')][_0x219e('0x72')];var _0x93a0a9=_['capitalize'](_0x2509bd);var _0x2fd3d9=_0x2509bd==='chat'?'Website':_0x219e('0x63');return db['User']['findOne']({'raw':!![],'where':{'id':_0x28adb6[_0x219e('0x1c')]['id'],'role':_0x219e('0x3c')}})[_0x219e('0xb')](function(_0x1db2ad){if(_[_0x219e('0x14')](_0x1db2ad)){throw new Error(_0x219e('0x74'));}_0x245705=_0x1db2ad;return db[_0x93a0a9+'Message']['findOne']({'where':{'id':_0x28adb6[_0x219e('0x30')][_0x219e('0x75')]},'include':[{'model':db[_0x93a0a9+_0x219e('0x67')],'as':_0x219e('0x67')},{'model':db[_0x93a0a9+_0x2fd3d9],'as':'Account'}]});})[_0x219e('0xb')](function(_0x41c165){if(_['isNil'](_0x41c165)){throw new Error(_0x93a0a9+_0x219e('0x76'));}_0x23eaa6=_0x41c165;return _0x41c165[_0x219e('0x68')]({'read':0x0,'readAt':null,'UserId':null});})[_0x219e('0xb')](function(){var _0x494176={'uniqueid':_0x2509bd+'.'+_0x23eaa6['id']+'.'+_0x23eaa6[_0x219e('0x67')]['id'],'FromUserId':_0x28adb6[_0x219e('0x32')]['id'],'type':_0x219e('0x69'),'ToUserId':_0x245705['id']};_0x494176[_0x93a0a9+_0x219e('0x6a')]=_0x23eaa6['id'];_0x494176[_0x93a0a9+_0x219e('0x6b')]=_0x23eaa6[_0x219e('0x67')]['id'];_0x494176[_0x219e('0x6c')+_0x93a0a9+_0x2fd3d9+'Id']=_0x23eaa6[_0x219e('0x63')]['id'];return db[_0x93a0a9+'TransferReport'][_0x219e('0x77')](_0x494176);})['then'](function(){return respondWithRpcPromise(_0x219e('0x6e'),{'channel':_0x2509bd,'interaction':_0x23eaa6[_0x219e('0x67')],'message':_0x23eaa6,'account':_0x23eaa6[_0x219e('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':_0x219e('0x3c'),'appdata':_0x245705[_0x219e('0x12')]+','+(_0x23eaa6[_0x219e('0x63')]['agentTransferTimeout']||0x12c),'interval':_0x219e('0x70')}]},routingClient);})['then'](respondWithResult(_0x3b6915,null))['catch'](handleError(_0x3b6915,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 5d514c8..c40faf3 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 _0xd9b4=['isAuthenticated','index','show','get','/:id/run','run','post','create','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller'];(function(_0x5bc0ef,_0x212473){var _0xe7216e=function(_0x208c38){while(--_0x208c38){_0x5bc0ef['push'](_0x5bc0ef['shift']());}};_0xe7216e(++_0x212473);}(_0xd9b4,0x1ac));var _0x4d9b=function(_0x38bbfd,_0x5bf36e){_0x38bbfd=_0x38bbfd-0x0;var _0x2543e3=_0xd9b4[_0x38bbfd];return _0x2543e3;};'use strict';var multer=require(_0x4d9b('0x0'));var util=require('util');var path=require(_0x4d9b('0x1'));var timeout=require(_0x4d9b('0x2'));var express=require(_0x4d9b('0x3'));var router=express[_0x4d9b('0x4')]();var auth=require(_0x4d9b('0x5'));var interaction=require(_0x4d9b('0x6'));var config=require(_0x4d9b('0x7'));var controller=require(_0x4d9b('0x8'));router['get']('/',auth[_0x4d9b('0x9')](),controller[_0x4d9b('0xa')]);router['get']('/:id',auth[_0x4d9b('0x9')](),controller[_0x4d9b('0xb')]);router[_0x4d9b('0xc')](_0x4d9b('0xd'),auth['isAuthenticated'](),controller[_0x4d9b('0xe')]);router[_0x4d9b('0xf')]('/',auth[_0x4d9b('0x9')](),controller[_0x4d9b('0x10')]);router[_0x4d9b('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x4d9b('0x12')]);router[_0x4d9b('0x13')](_0x4d9b('0x14'),auth[_0x4d9b('0x9')](),controller[_0x4d9b('0x15')]);module[_0x4d9b('0x16')]=router; \ No newline at end of file +var _0x660f=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','post','create','put','update','destroy','exports','path'];(function(_0x206bb5,_0x105be7){var _0x3e0028=function(_0x3e199a){while(--_0x3e199a){_0x206bb5['push'](_0x206bb5['shift']());}};_0x3e0028(++_0x105be7);}(_0x660f,0xe3));var _0xf660=function(_0x234995,_0x48c007){_0x234995=_0x234995-0x0;var _0x5115f0=_0x660f[_0x234995];return _0x5115f0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf660('0x0'));var timeout=require('connect-timeout');var express=require(_0xf660('0x1'));var router=express[_0xf660('0x2')]();var auth=require(_0xf660('0x3'));var interaction=require(_0xf660('0x4'));var config=require(_0xf660('0x5'));var controller=require(_0xf660('0x6'));router[_0xf660('0x7')]('/',auth[_0xf660('0x8')](),controller[_0xf660('0x9')]);router['get'](_0xf660('0xa'),auth['isAuthenticated'](),controller[_0xf660('0xb')]);router[_0xf660('0x7')](_0xf660('0xc'),auth['isAuthenticated'](),controller['run']);router[_0xf660('0xd')]('/',auth['isAuthenticated'](),controller[_0xf660('0xe')]);router[_0xf660('0xf')]('/:id',auth[_0xf660('0x8')](),controller[_0xf660('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xf660('0x11')]);module[_0xf660('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 6507559..21cf061 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 _0xe714=['months','weeks','hours','minutes','days','csv','xlsx','custom','default','TEXT','sequelize','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters'];(function(_0x31aa0d,_0x217049){var _0x53e7e0=function(_0x244397){while(--_0x244397){_0x31aa0d['push'](_0x31aa0d['shift']());}};_0x53e7e0(++_0x217049);}(_0xe714,0xe2));var _0x4e71=function(_0x3736bf,_0x4be223){_0x3736bf=_0x3736bf-0x0;var _0x3d0784=_0xe714[_0x3736bf];return _0x3d0784;};'use strict';var Sequelize=require(_0x4e71('0x0'));module['exports']={'name':{'type':Sequelize[_0x4e71('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x4e71('0x1')]},'active':{'type':Sequelize[_0x4e71('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x4e71('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x4e71('0x3')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x4e71('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x4e71('0x5')](_0x4e71('0x6'),_0x4e71('0x7'),_0x4e71('0x8'),_0x4e71('0x9'),'days',_0x4e71('0xa'),_0x4e71('0xb')),'allowNull':![],'defaultValue':_0x4e71('0xc')},'output':{'type':Sequelize['ENUM'](_0x4e71('0xd'),'pdf',_0x4e71('0xe')),'allowNull':![],'defaultValue':_0x4e71('0xd')},'type':{'type':Sequelize[_0x4e71('0x5')](_0x4e71('0xf'),_0x4e71('0x10')),'allowNull':![],'defaultValue':_0x4e71('0xf')},'sendMail':{'type':Sequelize[_0x4e71('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x4e71('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x4e71('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x4e71('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x126e=['BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','hours','minutes','days','csv','xlsx','custom','default','TEXT','exports','STRING'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x126e,0x108));var _0xe126=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x126e[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require('sequelize');module[_0xe126('0x0')]={'name':{'type':Sequelize[_0xe126('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xe126('0x1')]},'active':{'type':Sequelize[_0xe126('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xe126('0x1')],'allowNull':![],'defaultValue':_0xe126('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xe126('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xe126('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xe126('0x6')](_0xe126('0x7'),_0xe126('0x8'),_0xe126('0x9'),_0xe126('0xa'),'days',_0xe126('0xb'),_0xe126('0xc')),'allowNull':![],'defaultValue':_0xe126('0xd')},'output':{'type':Sequelize[_0xe126('0x6')](_0xe126('0xe'),'pdf',_0xe126('0xf')),'allowNull':![],'defaultValue':_0xe126('0xe')},'type':{'type':Sequelize['ENUM'](_0xe126('0x10'),_0xe126('0x11')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xe126('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xe126('0x12')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0xe126('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 4103446..0024bac 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 _0x86dd=['attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','user','get','role','Scheduler','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','run','../../config/schedule','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','then','destroy','UserProfileResource','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','type','model','keys','query','filters','intersection'];(function(_0x3bdf48,_0x1979a2){var _0x8b4812=function(_0x44d545){while(--_0x44d545){_0x3bdf48['push'](_0x3bdf48['shift']());}};_0x8b4812(++_0x1979a2);}(_0x86dd,0x1be));var _0xd86d=function(_0x1722bc,_0x4a3b3c){_0x1722bc=_0x1722bc-0x0;var _0x2588de=_0x86dd[_0x1722bc];return _0x2588de;};'use strict';var pdf=require(_0xd86d('0x0'));var emlformat=require(_0xd86d('0x1'));var rimraf=require(_0xd86d('0x2'));var zipdir=require(_0xd86d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd86d('0x4'));var moment=require('moment');var BPromise=require(_0xd86d('0x5'));var Mustache=require(_0xd86d('0x6'));var util=require(_0xd86d('0x7'));var path=require(_0xd86d('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd86d('0x9'));var fs=require('fs');var _=require(_0xd86d('0xa'));var squel=require(_0xd86d('0xb'));var crypto=require(_0xd86d('0xc'));var jsforce=require(_0xd86d('0xd'));var deskjs=require(_0xd86d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd86d('0xf'));var Papa=require(_0xd86d('0x10'));var Redis=require('ioredis');var authService=require(_0xd86d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd86d('0x12'));var hardwareService=require(_0xd86d('0x13'));var logger=require(_0xd86d('0x14'))(_0xd86d('0x15'));var utils=require(_0xd86d('0x16'));var config=require('../../config/environment');var db=require(_0xd86d('0x17'))['db'];function respondWithStatusCode(_0x4bf269,_0x10794f){_0x10794f=_0x10794f||0xcc;return function(_0x4bc397){if(_0x4bc397){return _0x4bf269[_0xd86d('0x18')](_0x10794f);}return _0x4bf269[_0xd86d('0x19')](_0x10794f)[_0xd86d('0x1a')]();};}function respondWithResult(_0x232f31,_0x247192){_0x247192=_0x247192||0xc8;return function(_0x50b597){if(_0x50b597){return _0x232f31[_0xd86d('0x19')](_0x247192)[_0xd86d('0x1b')](_0x50b597);}};}function respondWithFilteredResult(_0x20fee1,_0x5d8f9d){return function(_0x50156a){if(_0x50156a){var _0x20f97c=_0x50156a[_0xd86d('0x1c')],_0x3feec2=_0x5d8f9d['offset'],_0x56ccfc=_0x5d8f9d[_0xd86d('0x1d')]+_0x5d8f9d[_0xd86d('0x1e')],_0x694c6;if(_0x56ccfc>=_0x20f97c){_0x56ccfc=_0x20f97c;_0x694c6=0xc8;}else{_0x694c6=0xce;}_0x20fee1['status'](_0x694c6);return _0x20fee1['set'](_0xd86d('0x1f'),_0x3feec2+'-'+_0x56ccfc+'/'+_0x20f97c)[_0xd86d('0x1b')](_0x50156a);}return null;};}function patchUpdates(_0x4fb5d6){return function(_0x5d3a98){try{jsonpatch['apply'](_0x5d3a98,_0x4fb5d6,!![]);}catch(_0x58ce6e){return BPromise[_0xd86d('0x20')](_0x58ce6e);}return _0x5d3a98[_0xd86d('0x21')]();};}function saveUpdates(_0x4b377a,_0x161935){return function(_0x5dbfba){if(_0x5dbfba){return _0x5dbfba['update'](_0x4b377a)[_0xd86d('0x22')](function(_0x4515cd){return _0x4515cd;});}return null;};}function removeEntity(_0x5c9021,_0x521b00){return function(_0x26ec2f){if(_0x26ec2f){return _0x26ec2f[_0xd86d('0x23')]()[_0xd86d('0x22')](function(){var _0x46d1e8=_0x26ec2f['get']({'plain':!![]});var _0x1269d0='Scheduler';return db[_0xd86d('0x24')][_0xd86d('0x23')]({'where':{'type':_0x1269d0,'resourceId':_0x46d1e8['id']}})[_0xd86d('0x22')](function(){return _0x26ec2f;});})[_0xd86d('0x22')](function(){_0x5c9021['status'](0xcc)[_0xd86d('0x1a')]();});}};}function handleEntityNotFound(_0x1ba0ca,_0x363ec3){return function(_0x4d8c6b){if(!_0x4d8c6b){_0x1ba0ca[_0xd86d('0x18')](0x194);}return _0x4d8c6b;};}function handleError(_0x8dc333,_0x3a40a1){_0x3a40a1=_0x3a40a1||0x1f4;return function(_0x160474){logger[_0xd86d('0x25')](_0x160474[_0xd86d('0x26')]);if(_0x160474['name']){delete _0x160474[_0xd86d('0x27')];}_0x8dc333[_0xd86d('0x19')](_0x3a40a1)[_0xd86d('0x28')](_0x160474);};}exports[_0xd86d('0x29')]=function(_0x581fe9,_0x24e8f1){var _0x344fe2={},_0x39b586={},_0xc582d5={'count':0x0,'rows':[]};var _0x5b590f=_[_0xd86d('0x2a')](db[_0xd86d('0x2b')][_0xd86d('0x2c')],function(_0x8bd1a3){return{'name':_0x8bd1a3[_0xd86d('0x2d')],'type':_0x8bd1a3[_0xd86d('0x2e')]['key']};});_0x39b586[_0xd86d('0x2f')]=_[_0xd86d('0x2a')](_0x5b590f,_0xd86d('0x27'));_0x39b586['query']=_[_0xd86d('0x30')](_0x581fe9[_0xd86d('0x31')]);_0x39b586[_0xd86d('0x32')]=_[_0xd86d('0x33')](_0x39b586[_0xd86d('0x2f')],_0x39b586[_0xd86d('0x31')]);_0x344fe2[_0xd86d('0x34')]=_[_0xd86d('0x33')](_0x39b586[_0xd86d('0x2f')],qs[_0xd86d('0x35')](_0x581fe9[_0xd86d('0x31')][_0xd86d('0x35')]));_0x344fe2[_0xd86d('0x34')]=_0x344fe2[_0xd86d('0x34')][_0xd86d('0x36')]?_0x344fe2['attributes']:_0x39b586[_0xd86d('0x2f')];if(!_0x581fe9['query'][_0xd86d('0x37')]('nolimit')){_0x344fe2['limit']=qs[_0xd86d('0x1e')](_0x581fe9[_0xd86d('0x31')]['limit']);_0x344fe2[_0xd86d('0x1d')]=qs['offset'](_0x581fe9[_0xd86d('0x31')][_0xd86d('0x1d')]);}_0x344fe2[_0xd86d('0x38')]=qs[_0xd86d('0x39')](_0x581fe9[_0xd86d('0x31')]['sort']);_0x344fe2['where']=qs[_0xd86d('0x32')](_[_0xd86d('0x3a')](_0x581fe9[_0xd86d('0x31')],_0x39b586[_0xd86d('0x32')]),_0x5b590f);if(_0x581fe9[_0xd86d('0x31')][_0xd86d('0x3b')]){_0x344fe2[_0xd86d('0x3c')]=_[_0xd86d('0x3d')](_0x344fe2['where'],{'$or':_[_0xd86d('0x2a')](_0x5b590f,function(_0x273f0a){if(_0x273f0a['type']!==_0xd86d('0x3e')){var _0x2415be={};_0x2415be[_0x273f0a[_0xd86d('0x27')]]={'$like':'%'+_0x581fe9[_0xd86d('0x31')][_0xd86d('0x3b')]+'%'};return _0x2415be;}})});}_0x344fe2=_['merge']({},_0x344fe2,_0x581fe9[_0xd86d('0x3f')]);var _0xd2ac02={'where':_0x344fe2['where']};return db['Schedule'][_0xd86d('0x1c')](_0xd2ac02)[_0xd86d('0x22')](function(_0x4d1fe2){_0xc582d5[_0xd86d('0x1c')]=_0x4d1fe2;if(_0x581fe9['query'][_0xd86d('0x40')]){_0x344fe2[_0xd86d('0x41')]=[{'all':!![]}];}return db[_0xd86d('0x2b')]['findAll'](_0x344fe2);})[_0xd86d('0x22')](function(_0x2e5a27){_0xc582d5[_0xd86d('0x42')]=_0x2e5a27;return _0xc582d5;})[_0xd86d('0x22')](respondWithFilteredResult(_0x24e8f1,_0x344fe2))['catch'](handleError(_0x24e8f1,null));};exports[_0xd86d('0x43')]=function(_0x48dc58,_0x12d3f0){var _0x4fa991={'raw':![],'where':{'id':_0x48dc58[_0xd86d('0x44')]['id']}},_0x47cdda={};_0x47cdda[_0xd86d('0x2f')]=_[_0xd86d('0x30')](db[_0xd86d('0x2b')]['rawAttributes']);_0x47cdda[_0xd86d('0x31')]=_[_0xd86d('0x30')](_0x48dc58[_0xd86d('0x31')]);_0x47cdda['filters']=_[_0xd86d('0x33')](_0x47cdda[_0xd86d('0x2f')],_0x47cdda[_0xd86d('0x31')]);_0x4fa991[_0xd86d('0x34')]=_[_0xd86d('0x33')](_0x47cdda[_0xd86d('0x2f')],qs[_0xd86d('0x35')](_0x48dc58['query'][_0xd86d('0x35')]));_0x4fa991['attributes']=_0x4fa991[_0xd86d('0x34')][_0xd86d('0x36')]?_0x4fa991[_0xd86d('0x34')]:_0x47cdda[_0xd86d('0x2f')];if(_0x48dc58[_0xd86d('0x31')]['includeAll']){_0x4fa991[_0xd86d('0x41')]=[{'all':!![]}];}_0x4fa991=_[_0xd86d('0x3d')]({},_0x4fa991,_0x48dc58['options']);return db[_0xd86d('0x2b')][_0xd86d('0x45')](_0x4fa991)[_0xd86d('0x22')](handleEntityNotFound(_0x12d3f0,null))[_0xd86d('0x22')](respondWithResult(_0x12d3f0,null))[_0xd86d('0x46')](handleError(_0x12d3f0,null));};exports['create']=function(_0x3db7e0,_0x219ffc){return db[_0xd86d('0x2b')][_0xd86d('0x47')](_0x3db7e0[_0xd86d('0x48')],{})[_0xd86d('0x22')](function(_0x377b88){var _0x53e53a=_0x3db7e0[_0xd86d('0x49')][_0xd86d('0x4a')]({'plain':!![]});if(!_0x53e53a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x53e53a[_0xd86d('0x4b')]===_0xd86d('0x49')){var _0x357139=_0x377b88[_0xd86d('0x4a')]({'plain':!![]});var _0x1e2bed=_0xd86d('0x4c');return db[_0xd86d('0x4d')][_0xd86d('0x45')]({'where':{'name':_0x1e2bed,'userProfileId':_0x53e53a['userProfileId']},'raw':!![]})[_0xd86d('0x22')](function(_0x81cf06){if(_0x81cf06&&_0x81cf06[_0xd86d('0x4e')]===0x0){return db[_0xd86d('0x24')][_0xd86d('0x47')]({'name':_0x357139[_0xd86d('0x27')],'resourceId':_0x357139['id'],'type':_0x81cf06[_0xd86d('0x27')],'sectionId':_0x81cf06['id']},{})[_0xd86d('0x22')](function(){return _0x377b88;});}else{return _0x377b88;}})[_0xd86d('0x46')](function(_0x2148c9){logger[_0xd86d('0x25')](_0xd86d('0x4f'),_0x2148c9);throw _0x2148c9;});}return _0x377b88;})[_0xd86d('0x22')](respondWithResult(_0x219ffc,0xc9))[_0xd86d('0x46')](handleError(_0x219ffc,null));};exports[_0xd86d('0x50')]=function(_0x3c887e,_0x2ef0b3){if(_0x3c887e[_0xd86d('0x48')]['id']){delete _0x3c887e['body']['id'];}return db['Schedule']['find']({'where':{'id':_0x3c887e[_0xd86d('0x44')]['id']}})['then'](handleEntityNotFound(_0x2ef0b3,null))[_0xd86d('0x22')](saveUpdates(_0x3c887e[_0xd86d('0x48')],null))[_0xd86d('0x22')](respondWithResult(_0x2ef0b3,null))[_0xd86d('0x46')](handleError(_0x2ef0b3,null));};exports[_0xd86d('0x23')]=function(_0x314087,_0x565a93){return db['Schedule'][_0xd86d('0x45')]({'where':{'id':_0x314087[_0xd86d('0x44')]['id']}})[_0xd86d('0x22')](handleEntityNotFound(_0x565a93,null))[_0xd86d('0x22')](removeEntity(_0x565a93,null))[_0xd86d('0x46')](handleError(_0x565a93,null));};exports[_0xd86d('0x51')]=function(_0x522aa0,_0x1aedbd,_0x4da97d){var _0x205f63=require(_0xd86d('0x52'));return db[_0xd86d('0x2b')]['find']({'where':{'id':_0x522aa0[_0xd86d('0x44')]['id']},'raw':!![]})[_0xd86d('0x22')](handleEntityNotFound(_0x1aedbd,null))[_0xd86d('0x22')](function(){_0x205f63[_0xd86d('0x51')](_0x522aa0[_0xd86d('0x44')]['id']);})[_0xd86d('0x22')](respondWithStatusCode(_0x1aedbd,null))['catch'](handleError(_0x1aedbd,null));}; \ No newline at end of file +var _0xc4c9=['stack','name','send','index','map','rawAttributes','type','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','Schedule','includeAll','include','findAll','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','mustache','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','count','offset','limit','set','json','apply','reject','save','update','destroy','then','get','error'];(function(_0x120376,_0x571898){var _0x28c529=function(_0x4f130c){while(--_0x4f130c){_0x120376['push'](_0x120376['shift']());}};_0x28c529(++_0x571898);}(_0xc4c9,0x114));var _0x9c4c=function(_0x332c70,_0x13f8f7){_0x332c70=_0x332c70-0x0;var _0x2b81f1=_0xc4c9[_0x332c70];return _0x2b81f1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9c4c('0x0'));var rimraf=require(_0x9c4c('0x1'));var zipdir=require(_0x9c4c('0x2'));var jsonpatch=require(_0x9c4c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9c4c('0x4'));var util=require('util');var path=require('path');var sox=require(_0x9c4c('0x5'));var csv=require('to-csv');var ejs=require(_0x9c4c('0x6'));var fs=require('fs');var _=require(_0x9c4c('0x7'));var squel=require(_0x9c4c('0x8'));var crypto=require(_0x9c4c('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9c4c('0xa'));var querystring=require(_0x9c4c('0xb'));var Papa=require(_0x9c4c('0xc'));var Redis=require(_0x9c4c('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x9c4c('0xe'));var as=require(_0x9c4c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c4c('0x10'))(_0x9c4c('0x11'));var utils=require(_0x9c4c('0x12'));var config=require('../../config/environment');var db=require(_0x9c4c('0x13'))['db'];function respondWithStatusCode(_0x56cbac,_0x49e00a){_0x49e00a=_0x49e00a||0xcc;return function(_0x320cd9){if(_0x320cd9){return _0x56cbac[_0x9c4c('0x14')](_0x49e00a);}return _0x56cbac['status'](_0x49e00a)[_0x9c4c('0x15')]();};}function respondWithResult(_0x7b92ba,_0x492367){_0x492367=_0x492367||0xc8;return function(_0x184d5d){if(_0x184d5d){return _0x7b92ba[_0x9c4c('0x16')](_0x492367)['json'](_0x184d5d);}};}function respondWithFilteredResult(_0x242147,_0x108741){return function(_0x43c055){if(_0x43c055){var _0x3569d8=_0x43c055[_0x9c4c('0x17')],_0x27ae68=_0x108741[_0x9c4c('0x18')],_0x3e896f=_0x108741['offset']+_0x108741[_0x9c4c('0x19')],_0x475aa2;if(_0x3e896f>=_0x3569d8){_0x3e896f=_0x3569d8;_0x475aa2=0xc8;}else{_0x475aa2=0xce;}_0x242147['status'](_0x475aa2);return _0x242147[_0x9c4c('0x1a')]('Content-Range',_0x27ae68+'-'+_0x3e896f+'/'+_0x3569d8)[_0x9c4c('0x1b')](_0x43c055);}return null;};}function patchUpdates(_0x139574){return function(_0x5be947){try{jsonpatch[_0x9c4c('0x1c')](_0x5be947,_0x139574,!![]);}catch(_0x4cd8b9){return BPromise[_0x9c4c('0x1d')](_0x4cd8b9);}return _0x5be947[_0x9c4c('0x1e')]();};}function saveUpdates(_0x63f4a1,_0x19243a){return function(_0x20c01b){if(_0x20c01b){return _0x20c01b[_0x9c4c('0x1f')](_0x63f4a1)['then'](function(_0x28fc61){return _0x28fc61;});}return null;};}function removeEntity(_0x407fb3,_0x3f8f4b){return function(_0x410c0f){if(_0x410c0f){return _0x410c0f[_0x9c4c('0x20')]()[_0x9c4c('0x21')](function(){var _0x44d6ee=_0x410c0f[_0x9c4c('0x22')]({'plain':!![]});var _0x39c3fe='Scheduler';return db['UserProfileResource'][_0x9c4c('0x20')]({'where':{'type':_0x39c3fe,'resourceId':_0x44d6ee['id']}})[_0x9c4c('0x21')](function(){return _0x410c0f;});})[_0x9c4c('0x21')](function(){_0x407fb3[_0x9c4c('0x16')](0xcc)[_0x9c4c('0x15')]();});}};}function handleEntityNotFound(_0x5660f6,_0x1a101){return function(_0x5a5b68){if(!_0x5a5b68){_0x5660f6['sendStatus'](0x194);}return _0x5a5b68;};}function handleError(_0x42af68,_0x2b694c){_0x2b694c=_0x2b694c||0x1f4;return function(_0x1dd353){logger[_0x9c4c('0x23')](_0x1dd353[_0x9c4c('0x24')]);if(_0x1dd353[_0x9c4c('0x25')]){delete _0x1dd353['name'];}_0x42af68['status'](_0x2b694c)[_0x9c4c('0x26')](_0x1dd353);};}exports[_0x9c4c('0x27')]=function(_0x51375f,_0x251b3a){var _0x1190cd={},_0x4abae4={},_0x3d25cf={'count':0x0,'rows':[]};var _0x590a38=_[_0x9c4c('0x28')](db['Schedule'][_0x9c4c('0x29')],function(_0x1112b8){return{'name':_0x1112b8['fieldName'],'type':_0x1112b8[_0x9c4c('0x2a')]['key']};});_0x4abae4[_0x9c4c('0x2b')]=_[_0x9c4c('0x28')](_0x590a38,_0x9c4c('0x25'));_0x4abae4[_0x9c4c('0x2c')]=_['keys'](_0x51375f[_0x9c4c('0x2c')]);_0x4abae4['filters']=_[_0x9c4c('0x2d')](_0x4abae4[_0x9c4c('0x2b')],_0x4abae4[_0x9c4c('0x2c')]);_0x1190cd[_0x9c4c('0x2e')]=_[_0x9c4c('0x2d')](_0x4abae4[_0x9c4c('0x2b')],qs[_0x9c4c('0x2f')](_0x51375f['query']['fields']));_0x1190cd[_0x9c4c('0x2e')]=_0x1190cd['attributes'][_0x9c4c('0x30')]?_0x1190cd[_0x9c4c('0x2e')]:_0x4abae4[_0x9c4c('0x2b')];if(!_0x51375f[_0x9c4c('0x2c')][_0x9c4c('0x31')]('nolimit')){_0x1190cd['limit']=qs['limit'](_0x51375f['query'][_0x9c4c('0x19')]);_0x1190cd['offset']=qs[_0x9c4c('0x18')](_0x51375f[_0x9c4c('0x2c')]['offset']);}_0x1190cd[_0x9c4c('0x32')]=qs[_0x9c4c('0x33')](_0x51375f[_0x9c4c('0x2c')][_0x9c4c('0x33')]);_0x1190cd[_0x9c4c('0x34')]=qs[_0x9c4c('0x35')](_['pick'](_0x51375f['query'],_0x4abae4[_0x9c4c('0x35')]),_0x590a38);if(_0x51375f[_0x9c4c('0x2c')][_0x9c4c('0x36')]){_0x1190cd['where']=_[_0x9c4c('0x37')](_0x1190cd[_0x9c4c('0x34')],{'$or':_[_0x9c4c('0x28')](_0x590a38,function(_0x9290f5){if(_0x9290f5[_0x9c4c('0x2a')]!==_0x9c4c('0x38')){var _0x369670={};_0x369670[_0x9290f5['name']]={'$like':'%'+_0x51375f[_0x9c4c('0x2c')][_0x9c4c('0x36')]+'%'};return _0x369670;}})});}_0x1190cd=_[_0x9c4c('0x37')]({},_0x1190cd,_0x51375f[_0x9c4c('0x39')]);var _0x15402a={'where':_0x1190cd[_0x9c4c('0x34')]};return db[_0x9c4c('0x3a')][_0x9c4c('0x17')](_0x15402a)['then'](function(_0x2aff6b){_0x3d25cf[_0x9c4c('0x17')]=_0x2aff6b;if(_0x51375f[_0x9c4c('0x2c')][_0x9c4c('0x3b')]){_0x1190cd[_0x9c4c('0x3c')]=[{'all':!![]}];}return db[_0x9c4c('0x3a')][_0x9c4c('0x3d')](_0x1190cd);})['then'](function(_0x166140){_0x3d25cf['rows']=_0x166140;return _0x3d25cf;})[_0x9c4c('0x21')](respondWithFilteredResult(_0x251b3a,_0x1190cd))[_0x9c4c('0x3e')](handleError(_0x251b3a,null));};exports[_0x9c4c('0x3f')]=function(_0x48199e,_0x2c84c7){var _0x2a8d16={'raw':![],'where':{'id':_0x48199e[_0x9c4c('0x40')]['id']}},_0x39a304={};_0x39a304[_0x9c4c('0x2b')]=_['keys'](db[_0x9c4c('0x3a')][_0x9c4c('0x29')]);_0x39a304['query']=_['keys'](_0x48199e[_0x9c4c('0x2c')]);_0x39a304[_0x9c4c('0x35')]=_[_0x9c4c('0x2d')](_0x39a304['model'],_0x39a304['query']);_0x2a8d16[_0x9c4c('0x2e')]=_[_0x9c4c('0x2d')](_0x39a304[_0x9c4c('0x2b')],qs[_0x9c4c('0x2f')](_0x48199e[_0x9c4c('0x2c')][_0x9c4c('0x2f')]));_0x2a8d16[_0x9c4c('0x2e')]=_0x2a8d16[_0x9c4c('0x2e')][_0x9c4c('0x30')]?_0x2a8d16[_0x9c4c('0x2e')]:_0x39a304[_0x9c4c('0x2b')];if(_0x48199e[_0x9c4c('0x2c')][_0x9c4c('0x3b')]){_0x2a8d16['include']=[{'all':!![]}];}_0x2a8d16=_[_0x9c4c('0x37')]({},_0x2a8d16,_0x48199e[_0x9c4c('0x39')]);return db[_0x9c4c('0x3a')]['find'](_0x2a8d16)[_0x9c4c('0x21')](handleEntityNotFound(_0x2c84c7,null))[_0x9c4c('0x21')](respondWithResult(_0x2c84c7,null))[_0x9c4c('0x3e')](handleError(_0x2c84c7,null));};exports['create']=function(_0x159127,_0x1d94bb){return db[_0x9c4c('0x3a')][_0x9c4c('0x41')](_0x159127['body'],{})[_0x9c4c('0x21')](function(_0x31e3cc){var _0x560c12=_0x159127[_0x9c4c('0x42')]['get']({'plain':!![]});if(!_0x560c12)throw new Error(_0x9c4c('0x43'));if(_0x560c12[_0x9c4c('0x44')]==='user'){var _0x52dee3=_0x31e3cc[_0x9c4c('0x22')]({'plain':!![]});var _0x2f2dd9=_0x9c4c('0x45');return db[_0x9c4c('0x46')][_0x9c4c('0x47')]({'where':{'name':_0x2f2dd9,'userProfileId':_0x560c12[_0x9c4c('0x48')]},'raw':!![]})['then'](function(_0x28fa71){if(_0x28fa71&&_0x28fa71[_0x9c4c('0x49')]===0x0){return db[_0x9c4c('0x4a')][_0x9c4c('0x41')]({'name':_0x52dee3['name'],'resourceId':_0x52dee3['id'],'type':_0x28fa71[_0x9c4c('0x25')],'sectionId':_0x28fa71['id']},{})[_0x9c4c('0x21')](function(){return _0x31e3cc;});}else{return _0x31e3cc;}})['catch'](function(_0x59ad5d){logger[_0x9c4c('0x23')](_0x9c4c('0x4b'),_0x59ad5d);throw _0x59ad5d;});}return _0x31e3cc;})['then'](respondWithResult(_0x1d94bb,0xc9))[_0x9c4c('0x3e')](handleError(_0x1d94bb,null));};exports[_0x9c4c('0x1f')]=function(_0x169a84,_0x4a6f42){if(_0x169a84[_0x9c4c('0x4c')]['id']){delete _0x169a84[_0x9c4c('0x4c')]['id'];}return db[_0x9c4c('0x3a')][_0x9c4c('0x47')]({'where':{'id':_0x169a84['params']['id']}})[_0x9c4c('0x21')](handleEntityNotFound(_0x4a6f42,null))['then'](saveUpdates(_0x169a84['body'],null))[_0x9c4c('0x21')](respondWithResult(_0x4a6f42,null))['catch'](handleError(_0x4a6f42,null));};exports[_0x9c4c('0x20')]=function(_0x496bef,_0x4211cf){return db[_0x9c4c('0x3a')][_0x9c4c('0x47')]({'where':{'id':_0x496bef[_0x9c4c('0x40')]['id']}})[_0x9c4c('0x21')](handleEntityNotFound(_0x4211cf,null))['then'](removeEntity(_0x4211cf,null))[_0x9c4c('0x3e')](handleError(_0x4211cf,null));};exports['run']=function(_0x3e1f75,_0x5d823a,_0x6fffdc){var _0x54f98a=require(_0x9c4c('0x4d'));return db[_0x9c4c('0x3a')][_0x9c4c('0x47')]({'where':{'id':_0x3e1f75[_0x9c4c('0x40')]['id']},'raw':!![]})[_0x9c4c('0x21')](handleEntityNotFound(_0x5d823a,null))['then'](function(){_0x54f98a['run'](_0x3e1f75[_0x9c4c('0x40')]['id']);})[_0x9c4c('0x21')](respondWithStatusCode(_0x5d823a,null))[_0x9c4c('0x3e')](handleError(_0x5d823a,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 25c3ba6..ac4f561 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 _0xf58e=['moment','bluebird','request-promise','path','rimraf','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','api'];(function(_0xbe6a41,_0x94619f){var _0x4e57dd=function(_0x532c4f){while(--_0x532c4f){_0xbe6a41['push'](_0xbe6a41['shift']());}};_0x4e57dd(++_0x94619f);}(_0xf58e,0x1ba));var _0xef58=function(_0x4af13c,_0xc4e12e){_0x4af13c=_0x4af13c-0x0;var _0x242637=_0xf58e[_0x4af13c];return _0x242637;};'use strict';var _=require(_0xef58('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xef58('0x1'));var moment=require(_0xef58('0x2'));var BPromise=require(_0xef58('0x3'));var rp=require(_0xef58('0x4'));var fs=require('fs');var path=require(_0xef58('0x5'));var rimraf=require(_0xef58('0x6'));var config=require('../../config/environment');var attributes=require(_0xef58('0x7'));module[_0xef58('0x8')]=function(_0x2d2dec,_0x2651c0){return _0x2d2dec[_0xef58('0x9')](_0xef58('0xa'),attributes,{'tableName':_0xef58('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe444=['Schedule','tools_schedules','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports'];(function(_0x1f18e5,_0x4a5cee){var _0x12046c=function(_0x247bd2){while(--_0x247bd2){_0x1f18e5['push'](_0x1f18e5['shift']());}};_0x12046c(++_0x4a5cee);}(_0xe444,0x16a));var _0x4e44=function(_0x381230,_0x57017a){_0x381230=_0x381230-0x0;var _0x1cf046=_0xe444[_0x381230];return _0x1cf046;};'use strict';var _=require(_0x4e44('0x0'));var util=require('util');var logger=require(_0x4e44('0x1'))('api');var moment=require(_0x4e44('0x2'));var BPromise=require(_0x4e44('0x3'));var rp=require(_0x4e44('0x4'));var fs=require('fs');var path=require(_0x4e44('0x5'));var rimraf=require(_0x4e44('0x6'));var config=require(_0x4e44('0x7'));var attributes=require(_0x4e44('0x8'));module[_0x4e44('0x9')]=function(_0x5b064b,_0x4b9dcf){return _0x5b064b['define'](_0x4e44('0xa'),attributes,{'tableName':_0x4e44('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 e381082..abd63a0 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 _0x30a0=['error','code','message','result','lodash','util','moment','ioredis','../../config/environment','jayson/promise','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s'];(function(_0x588f2c,_0x10e069){var _0x467467=function(_0xa0110d){while(--_0xa0110d){_0x588f2c['push'](_0x588f2c['shift']());}};_0x467467(++_0x10e069);}(_0x30a0,0xa6));var _0x030a=function(_0x4cc694,_0x545151){_0x4cc694=_0x4cc694-0x0;var _0x28d029=_0x30a0[_0x4cc694];return _0x28d029;};'use strict';var _=require(_0x030a('0x0'));var util=require(_0x030a('0x1'));var moment=require(_0x030a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x030a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x030a('0x4'));var jayson=require(_0x030a('0x5'));var client=jayson['client'][_0x030a('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2475fb,_0xaf9481,_0x61792d){return new BPromise(function(_0x2374ad,_0x228dce){return client[_0x030a('0x7')](_0x2475fb,_0x61792d)[_0x030a('0x8')](function(_0x313264){logger[_0x030a('0x9')](_0x030a('0xa'),_0xaf9481,_0x030a('0xb'));logger[_0x030a('0xc')](_0x030a('0xd'),_0xaf9481,'request\x20sent',JSON['stringify'](_0x313264));if(_0x313264[_0x030a('0xe')]){if(_0x313264['error'][_0x030a('0xf')]===0x1f4){logger[_0x030a('0xe')]('Schedule,\x20%s,\x20%s',_0xaf9481,_0x313264[_0x030a('0xe')]['message']);return _0x228dce(_0x313264['error']['message']);}logger['error'](_0x030a('0xa'),_0xaf9481,_0x313264[_0x030a('0xe')][_0x030a('0x10')]);return _0x2374ad(_0x313264[_0x030a('0xe')][_0x030a('0x10')]);}else{logger['info'](_0x030a('0xa'),_0xaf9481,_0x030a('0xb'));_0x2374ad(_0x313264[_0x030a('0x11')]['message']);}})['catch'](function(_0x40d000){logger[_0x030a('0xe')](_0x030a('0xa'),_0xaf9481,_0x40d000);_0x228dce(_0x40d000);});});} \ No newline at end of file +var _0x333d=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','Schedule,\x20%s,\x20%s','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x4067ac,_0x363603){var _0x53d74d=function(_0x492ad4){while(--_0x492ad4){_0x4067ac['push'](_0x4067ac['shift']());}};_0x53d74d(++_0x363603);}(_0x333d,0x10d));var _0xd333=function(_0x2077c2,_0x275ab5){_0x2077c2=_0x2077c2-0x0;var _0x312f9f=_0x333d[_0x2077c2];return _0x312f9f;};'use strict';var _=require('lodash');var util=require(_0xd333('0x0'));var moment=require(_0xd333('0x1'));var BPromise=require(_0xd333('0x2'));var rs=require(_0xd333('0x3'));var fs=require('fs');var Redis=require(_0xd333('0x4'));var db=require(_0xd333('0x5'))['db'];var utils=require(_0xd333('0x6'));var logger=require('../../config/logger')(_0xd333('0x7'));var config=require(_0xd333('0x8'));var jayson=require(_0xd333('0x9'));var client=jayson[_0xd333('0xa')][_0xd333('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e87a8,_0x28ecff,_0x2dffde){return new BPromise(function(_0x58e70d,_0xf853b6){return client['request'](_0x2e87a8,_0x2dffde)['then'](function(_0x4e15cb){logger[_0xd333('0xc')](_0xd333('0xd'),_0x28ecff,'request\x20sent');logger['debug'](_0xd333('0xe'),_0x28ecff,_0xd333('0xf'),JSON[_0xd333('0x10')](_0x4e15cb));if(_0x4e15cb['error']){if(_0x4e15cb[_0xd333('0x11')]['code']===0x1f4){logger['error'](_0xd333('0xd'),_0x28ecff,_0x4e15cb['error'][_0xd333('0x12')]);return _0xf853b6(_0x4e15cb[_0xd333('0x11')][_0xd333('0x12')]);}logger[_0xd333('0x11')](_0xd333('0xd'),_0x28ecff,_0x4e15cb[_0xd333('0x11')][_0xd333('0x12')]);return _0x58e70d(_0x4e15cb[_0xd333('0x11')][_0xd333('0x12')]);}else{logger[_0xd333('0xc')](_0xd333('0xd'),_0x28ecff,'request\x20sent');_0x58e70d(_0x4e15cb[_0xd333('0x13')][_0xd333('0x12')]);}})[_0xd333('0x14')](function(_0x356616){logger[_0xd333('0x11')](_0xd333('0xd'),_0x28ecff,_0x356616);_0xf853b6(_0x356616);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index a4d3a60..15a9d0e 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 _0x2550=['Router','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','/:id','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x453b6d,_0x42c4b6){var _0x2510d8=function(_0x5762c6){while(--_0x5762c6){_0x453b6d['push'](_0x453b6d['shift']());}};_0x2510d8(++_0x42c4b6);}(_0x2550,0xeb));var _0x0255=function(_0xb00f0d,_0xa51fd3){_0xb00f0d=_0xb00f0d-0x0;var _0x2a9876=_0x2550[_0xb00f0d];return _0x2a9876;};'use strict';var multer=require(_0x0255('0x0'));var util=require(_0x0255('0x1'));var path=require(_0x0255('0x2'));var timeout=require(_0x0255('0x3'));var express=require(_0x0255('0x4'));var router=express[_0x0255('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0255('0x6'));var controller=require(_0x0255('0x7'));router[_0x0255('0x8')]('/',auth[_0x0255('0x9')](),controller[_0x0255('0xa')]);router[_0x0255('0x8')](_0x0255('0xb'),auth[_0x0255('0x9')](),controller[_0x0255('0xc')]);router[_0x0255('0x8')]('/:id',auth[_0x0255('0x9')](),controller[_0x0255('0xd')]);router[_0x0255('0x8')](_0x0255('0xe'),auth['isAuthenticated'](),controller[_0x0255('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x0255('0x10'),auth['isAuthenticated'](),controller[_0x0255('0x11')]);router[_0x0255('0x12')](_0x0255('0x10'),auth[_0x0255('0x9')](),controller['destroy']);module[_0x0255('0x13')]=router; \ No newline at end of file +var _0xf952=['../../config/environment','./screenRecording.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','download','create','put','update','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xfa0765,_0x504b04){var _0x3c98c3=function(_0x245f74){while(--_0x245f74){_0xfa0765['push'](_0xfa0765['shift']());}};_0x3c98c3(++_0x504b04);}(_0xf952,0x185));var _0x2f95=function(_0x2f39c3,_0x17093b){_0x2f39c3=_0x2f39c3-0x0;var _0x4ee488=_0xf952[_0x2f39c3];return _0x4ee488;};'use strict';var multer=require(_0x2f95('0x0'));var util=require('util');var path=require(_0x2f95('0x1'));var timeout=require(_0x2f95('0x2'));var express=require(_0x2f95('0x3'));var router=express[_0x2f95('0x4')]();var auth=require(_0x2f95('0x5'));var interaction=require(_0x2f95('0x6'));var config=require(_0x2f95('0x7'));var controller=require(_0x2f95('0x8'));router['get']('/',auth[_0x2f95('0x9')](),controller[_0x2f95('0xa')]);router[_0x2f95('0xb')](_0x2f95('0xc'),auth[_0x2f95('0x9')](),controller[_0x2f95('0xd')]);router[_0x2f95('0xb')](_0x2f95('0xe'),auth[_0x2f95('0x9')](),controller[_0x2f95('0xf')]);router[_0x2f95('0xb')](_0x2f95('0x10'),auth['isAuthenticated'](),controller[_0x2f95('0x11')]);router['post']('/',auth[_0x2f95('0x9')](),controller[_0x2f95('0x12')]);router[_0x2f95('0x13')]('/:id',auth[_0x2f95('0x9')](),controller[_0x2f95('0x14')]);router[_0x2f95('0x15')](_0x2f95('0xe'),auth[_0x2f95('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index a87b367..33c6f7f 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 _0xb138=['extname','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0xb138,0x1dd));var _0x8b13=function(_0x3849a1,_0x38b53f){_0x3849a1=_0x3849a1-0x0;var _0x49364=_0xb138[_0x3849a1];return _0x49364;};'use strict';var Sequelize=require(_0x8b13('0x0'));var moment=require(_0x8b13('0x1'));var path=require(_0x8b13('0x2'));var config=require(_0x8b13('0x3'));module[_0x8b13('0x4')]={'format':{'type':Sequelize[_0x8b13('0x5')],'get':function(){return this[_0x8b13('0x6')]('value')?path[_0x8b13('0x7')](this[_0x8b13('0x6')](_0x8b13('0x8'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8b13('0x9')]},'value':{'type':Sequelize[_0x8b13('0x9')],'set':function(_0x5d51b1){var _0x3fdf4d=_0x5d51b1[_0x8b13('0xa')](/\\/g,'/');this[_0x8b13('0xb')]('value',_0x3fdf4d);}},'rating':{'type':Sequelize[_0x8b13('0xc')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x8b13('0xc')],'set':function(_0x58683a){this['setDataValue'](_0x8b13('0xd'),moment()[_0x8b13('0xe')](_0x58683a,'ms'));this[_0x8b13('0xb')](_0x8b13('0xf'),moment());this[_0x8b13('0xb')]('duration',_0x58683a);}},'startedAt':{'type':Sequelize[_0x8b13('0x10')],'get':function(){return moment(this[_0x8b13('0x6')](_0x8b13('0xd')))[_0x8b13('0x11')](_0x8b13('0x12'))[_0x8b13('0x13')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x8b13('0xf')))[_0x8b13('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x8b13('0x6')](_0x8b13('0x14')))[_0x8b13('0x11')](_0x8b13('0x12'))[_0x8b13('0x13')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x8b13('0x6')](_0x8b13('0x15')))[_0x8b13('0x11')](_0x8b13('0x12'))[_0x8b13('0x13')]();}}}; \ No newline at end of file +var _0x425d=['exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','path','../../config/environment'];(function(_0x27691e,_0xe22572){var _0x54ba73=function(_0x30002c){while(--_0x30002c){_0x27691e['push'](_0x27691e['shift']());}};_0x54ba73(++_0xe22572);}(_0x425d,0x1e0));var _0xd425=function(_0x54bc4b,_0x47747a){_0x54bc4b=_0x54bc4b-0x0;var _0x1a9163=_0x425d[_0x54bc4b];return _0x1a9163;};'use strict';var Sequelize=require(_0xd425('0x0'));var moment=require('moment');var path=require(_0xd425('0x1'));var config=require(_0xd425('0x2'));module[_0xd425('0x3')]={'format':{'type':Sequelize[_0xd425('0x4')],'get':function(){return this[_0xd425('0x5')](_0xd425('0x6'))?path[_0xd425('0x7')](this['getDataValue'](_0xd425('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xd425('0x8')]},'channel':{'type':Sequelize[_0xd425('0x8')]},'value':{'type':Sequelize[_0xd425('0x8')],'set':function(_0x1d97d9){var _0x1d2ed0=_0x1d97d9['replace'](/\\/g,'/');this[_0xd425('0x9')](_0xd425('0x6'),_0x1d2ed0);}},'rating':{'type':Sequelize[_0xd425('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xd425('0xa')],'set':function(_0x2db9da){this[_0xd425('0x9')](_0xd425('0xb'),moment()[_0xd425('0xc')](_0x2db9da,'ms'));this[_0xd425('0x9')](_0xd425('0xd'),moment());this[_0xd425('0x9')](_0xd425('0xe'),_0x2db9da);}},'startedAt':{'type':Sequelize[_0xd425('0xf')],'get':function(){return moment(this[_0xd425('0x5')](_0xd425('0xb')))[_0xd425('0x10')](_0xd425('0x11'))[_0xd425('0x12')]();}},'closedAt':{'type':Sequelize[_0xd425('0xf')],'get':function(){return moment(this[_0xd425('0x5')]('closedAt'))[_0xd425('0x10')](_0xd425('0x11'))[_0xd425('0x12')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xd425('0x5')](_0xd425('0x13')))[_0xd425('0x10')](_0xd425('0x11'))[_0xd425('0x12')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xd425('0x5')](_0xd425('0x14')))[_0xd425('0x10')](_0xd425('0x11'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 83e1120..4b25518 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 _0xebe5=['fast-json-patch','request-promise','bluebird','mustache','path','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','reject','save','destroy','then','end','error','name','send','index','map','ScreenRecording','rawAttributes','fieldName','key','model','differenceBy','format','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','duration','closedAt','describe','download','../../components/encryptor','uniqueid','value','join','%s.cypher','existsSync','decryptFile','secrets','recording','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','root','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir'];(function(_0x4d8789,_0x3fdff1){var _0x404e41=function(_0x33d5a6){while(--_0x33d5a6){_0x4d8789['push'](_0x4d8789['shift']());}};_0x404e41(++_0x3fdff1);}(_0xebe5,0xc9));var _0x5ebe=function(_0x44080e,_0x537af9){_0x44080e=_0x44080e-0x0;var _0x15c6b9=_0xebe5[_0x44080e];return _0x15c6b9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5ebe('0x0'));var rimraf=require(_0x5ebe('0x1'));var zipdir=require(_0x5ebe('0x2'));var jsonpatch=require(_0x5ebe('0x3'));var rp=require(_0x5ebe('0x4'));var moment=require('moment');var BPromise=require(_0x5ebe('0x5'));var Mustache=require(_0x5ebe('0x6'));var util=require('util');var path=require(_0x5ebe('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5ebe('0x8'));var squel=require(_0x5ebe('0x9'));var crypto=require('crypto');var jsforce=require(_0x5ebe('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x5ebe('0xb'));var querystring=require(_0x5ebe('0xc'));var Papa=require(_0x5ebe('0xd'));var Redis=require(_0x5ebe('0xe'));var authService=require(_0x5ebe('0xf'));var qs=require(_0x5ebe('0x10'));var as=require(_0x5ebe('0x11'));var hardwareService=require(_0x5ebe('0x12'));var logger=require(_0x5ebe('0x13'))(_0x5ebe('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5ebe('0x15'))['db'];function respondWithStatusCode(_0x4ae01c,_0x1d16b9){_0x1d16b9=_0x1d16b9||0xcc;return function(_0x389939){if(_0x389939){return _0x4ae01c[_0x5ebe('0x16')](_0x1d16b9);}return _0x4ae01c[_0x5ebe('0x17')](_0x1d16b9)['end']();};}function respondWithResult(_0xae8193,_0x5b65d5){_0x5b65d5=_0x5b65d5||0xc8;return function(_0x27cd74){if(_0x27cd74){return _0xae8193['status'](_0x5b65d5)[_0x5ebe('0x18')](_0x27cd74);}};}function respondWithFilteredResult(_0x5d7e99,_0x5e5873){return function(_0x1a11b8){if(_0x1a11b8){var _0x30210d=_0x1a11b8[_0x5ebe('0x19')],_0x46cec5=_0x5e5873[_0x5ebe('0x1a')],_0x354566=_0x5e5873[_0x5ebe('0x1a')]+_0x5e5873['limit'],_0x3a1e3d;if(_0x354566>=_0x30210d){_0x354566=_0x30210d;_0x3a1e3d=0xc8;}else{_0x3a1e3d=0xce;}_0x5d7e99['status'](_0x3a1e3d);return _0x5d7e99['set'](_0x5ebe('0x1b'),_0x46cec5+'-'+_0x354566+'/'+_0x30210d)[_0x5ebe('0x18')](_0x1a11b8);}return null;};}function patchUpdates(_0x54af91){return function(_0x3175cd){try{jsonpatch['apply'](_0x3175cd,_0x54af91,!![]);}catch(_0x1bf663){return BPromise[_0x5ebe('0x1c')](_0x1bf663);}return _0x3175cd[_0x5ebe('0x1d')]();};}function saveUpdates(_0x3bb98e,_0x2f38d0){return function(_0x3f1f5f){if(_0x3f1f5f){return _0x3f1f5f['update'](_0x3bb98e)['then'](function(_0x147ee2){return _0x147ee2;});}return null;};}function removeEntity(_0x3a45a1,_0x4293b3){return function(_0x4ef769){if(_0x4ef769){return _0x4ef769[_0x5ebe('0x1e')]()[_0x5ebe('0x1f')](function(){_0x3a45a1[_0x5ebe('0x17')](0xcc)[_0x5ebe('0x20')]();});}};}function handleEntityNotFound(_0x4a023c,_0x408081){return function(_0x30cd4a){if(!_0x30cd4a){_0x4a023c['sendStatus'](0x194);}return _0x30cd4a;};}function handleError(_0x1209aa,_0x5007b6){_0x5007b6=_0x5007b6||0x1f4;return function(_0x2fc3e3){logger[_0x5ebe('0x21')](_0x2fc3e3['stack']);if(_0x2fc3e3['name']){delete _0x2fc3e3[_0x5ebe('0x22')];}_0x1209aa[_0x5ebe('0x17')](_0x5007b6)[_0x5ebe('0x23')](_0x2fc3e3);};}exports[_0x5ebe('0x24')]=function(_0xf1bcad,_0x1c6bd8){var _0xb0f8ea={},_0x14c6e4={},_0x89b8be={'count':0x0,'rows':[]};var _0x192d3c=_[_0x5ebe('0x25')](db[_0x5ebe('0x26')][_0x5ebe('0x27')],function(_0x9d0c95){return{'name':_0x9d0c95[_0x5ebe('0x28')],'type':_0x9d0c95['type'][_0x5ebe('0x29')]};});_0x14c6e4[_0x5ebe('0x2a')]=_[_0x5ebe('0x2b')](_[_0x5ebe('0x25')](_0x192d3c,'name'),[_0x5ebe('0x2c')]);_0x14c6e4[_0x5ebe('0x2d')]=_['keys'](_0xf1bcad[_0x5ebe('0x2d')]);_0x14c6e4[_0x5ebe('0x2e')]=_[_0x5ebe('0x2f')](_0x14c6e4[_0x5ebe('0x2a')],_0x14c6e4[_0x5ebe('0x2d')]);_0xb0f8ea[_0x5ebe('0x30')]=_[_0x5ebe('0x2f')](_0x14c6e4[_0x5ebe('0x2a')],qs['fields'](_0xf1bcad[_0x5ebe('0x2d')][_0x5ebe('0x31')]));_0xb0f8ea[_0x5ebe('0x30')]=_0xb0f8ea['attributes']['length']?_0xb0f8ea[_0x5ebe('0x30')]:_0x14c6e4[_0x5ebe('0x2a')];if(!_0xf1bcad[_0x5ebe('0x2d')][_0x5ebe('0x32')](_0x5ebe('0x33'))){_0xb0f8ea['limit']=qs[_0x5ebe('0x34')](_0xf1bcad['query']['limit']);_0xb0f8ea['offset']=qs[_0x5ebe('0x1a')](_0xf1bcad[_0x5ebe('0x2d')][_0x5ebe('0x1a')]);}_0xb0f8ea['order']=qs[_0x5ebe('0x35')](_0xf1bcad['query'][_0x5ebe('0x35')]);_0xb0f8ea['where']=qs[_0x5ebe('0x2e')](_[_0x5ebe('0x36')](_0xf1bcad[_0x5ebe('0x2d')],_0x14c6e4[_0x5ebe('0x2e')]),_0x192d3c);if(_0xf1bcad[_0x5ebe('0x2d')][_0x5ebe('0x37')]){_0xb0f8ea[_0x5ebe('0x38')]=_[_0x5ebe('0x39')](_0xb0f8ea[_0x5ebe('0x38')],{'$or':_[_0x5ebe('0x25')](_0x192d3c,function(_0x13e94f){if(_0x13e94f[_0x5ebe('0x3a')]!==_0x5ebe('0x3b')){var _0x56d4a7={};_0x56d4a7[_0x13e94f['name']]={'$like':'%'+_0xf1bcad[_0x5ebe('0x2d')]['filter']+'%'};return _0x56d4a7;}})});}_0xb0f8ea=_[_0x5ebe('0x39')]({},_0xb0f8ea,_0xf1bcad[_0x5ebe('0x3c')]);var _0x3435f5={'where':_0xb0f8ea[_0x5ebe('0x38')]};return db['ScreenRecording'][_0x5ebe('0x19')](_0x3435f5)[_0x5ebe('0x1f')](function(_0x49abac){_0x89b8be['count']=_0x49abac;if(_0xf1bcad[_0x5ebe('0x2d')][_0x5ebe('0x3d')]){_0xb0f8ea[_0x5ebe('0x3e')]=[{'all':!![]}];}return db['ScreenRecording'][_0x5ebe('0x3f')](_0xb0f8ea);})[_0x5ebe('0x1f')](function(_0x5e2f65){_0x89b8be[_0x5ebe('0x40')]=_0x5e2f65;return _0x89b8be;})[_0x5ebe('0x1f')](respondWithFilteredResult(_0x1c6bd8,_0xb0f8ea))['catch'](handleError(_0x1c6bd8,null));};exports[_0x5ebe('0x41')]=function(_0x3b4d30,_0x50c809){var _0x3c1156={'raw':![],'where':{'id':_0x3b4d30[_0x5ebe('0x42')]['id']}},_0x238e0d={};_0x238e0d[_0x5ebe('0x2a')]=_[_0x5ebe('0x43')](db[_0x5ebe('0x26')][_0x5ebe('0x27')]);_0x238e0d[_0x5ebe('0x2d')]=_[_0x5ebe('0x43')](_0x3b4d30[_0x5ebe('0x2d')]);_0x238e0d[_0x5ebe('0x2e')]=_[_0x5ebe('0x2f')](_0x238e0d[_0x5ebe('0x2a')],_0x238e0d[_0x5ebe('0x2d')]);_0x3c1156[_0x5ebe('0x30')]=_[_0x5ebe('0x2f')](_0x238e0d[_0x5ebe('0x2a')],qs['fields'](_0x3b4d30[_0x5ebe('0x2d')][_0x5ebe('0x31')]));_0x3c1156[_0x5ebe('0x30')]=_0x3c1156['attributes']['length']?_0x3c1156[_0x5ebe('0x30')]:_0x238e0d[_0x5ebe('0x2a')];if(_0x3b4d30[_0x5ebe('0x2d')]['includeAll']){_0x3c1156[_0x5ebe('0x3e')]=[{'all':!![]}];}_0x3c1156=_[_0x5ebe('0x39')]({},_0x3c1156,_0x3b4d30['options']);return db[_0x5ebe('0x26')][_0x5ebe('0x44')](_0x3c1156)[_0x5ebe('0x1f')](handleEntityNotFound(_0x50c809,null))[_0x5ebe('0x1f')](respondWithResult(_0x50c809,null))[_0x5ebe('0x45')](handleError(_0x50c809,null));};exports[_0x5ebe('0x46')]=function(_0x4a8e74,_0x1c32d2){return db['ScreenRecording'][_0x5ebe('0x46')](_0x4a8e74['body'],{})[_0x5ebe('0x1f')](respondWithResult(_0x1c32d2,0xc9))[_0x5ebe('0x45')](handleError(_0x1c32d2,null));};exports['update']=function(_0x4637a4,_0x1d64b3){if(_0x4637a4[_0x5ebe('0x47')]['id']){delete _0x4637a4[_0x5ebe('0x47')]['id'];}delete _0x4637a4[_0x5ebe('0x47')][_0x5ebe('0x48')];delete _0x4637a4[_0x5ebe('0x47')]['createdAt'];delete _0x4637a4[_0x5ebe('0x47')][_0x5ebe('0x49')];delete _0x4637a4[_0x5ebe('0x47')]['value'];return db[_0x5ebe('0x26')][_0x5ebe('0x44')]({'where':{'id':_0x4637a4[_0x5ebe('0x42')]['id']}})[_0x5ebe('0x1f')](handleEntityNotFound(_0x1d64b3,null))[_0x5ebe('0x1f')](saveUpdates(_0x4637a4[_0x5ebe('0x47')],null))[_0x5ebe('0x1f')](respondWithResult(_0x1d64b3,null))['catch'](handleError(_0x1d64b3,null));};exports[_0x5ebe('0x4a')]=function(_0x2e4e14,_0x5a55a4){return db[_0x5ebe('0x26')][_0x5ebe('0x4a')]()[_0x5ebe('0x1f')](respondWithResult(_0x5a55a4,null))['catch'](handleError(_0x5a55a4,null));};exports[_0x5ebe('0x4b')]=function(_0x85c119,_0x4394be,_0x19e81f){var _0x16107b=require(_0x5ebe('0x4c'));var _0x216415=![];var _0x1ff1bd={};if(_0x85c119[_0x5ebe('0x2d')]['type']&&_0x85c119[_0x5ebe('0x2d')][_0x5ebe('0x3a')]===_0x5ebe('0x4d')){_0x1ff1bd[_0x5ebe('0x4d')]=_0x85c119[_0x5ebe('0x42')]['id'];}else{_0x1ff1bd['id']=_0x85c119[_0x5ebe('0x42')]['id'];}return db[_0x5ebe('0x26')]['find']({'where':_0x1ff1bd,'attributes':['id',_0x5ebe('0x4e')],'raw':!![]})[_0x5ebe('0x1f')](handleEntityNotFound(_0x4394be,null))[_0x5ebe('0x1f')](function(_0x3864e3){if(_0x3864e3){var _0x5759a0=path[_0x5ebe('0x4f')](config['root'],'server/files/screen_recordings',_0x3864e3[_0x5ebe('0x4e')]);var _0x53cf62=util[_0x5ebe('0x2c')](_0x5ebe('0x50'),_0x5759a0);if(fs[_0x5ebe('0x51')](_0x53cf62)){_0x216415=!![];return _0x16107b[_0x5ebe('0x52')](_0x53cf62,_0x5759a0,config[_0x5ebe('0x53')][_0x5ebe('0x54')])['then'](function(){return _0x3864e3;});}return _0x3864e3;}})[_0x5ebe('0x1f')](function(_0x4b3f35){if(_0x4b3f35){var _0x3aa352=path[_0x5ebe('0x4f')](config['root'],_0x5ebe('0x55'),_0x4b3f35[_0x5ebe('0x4e')]);if(!fs[_0x5ebe('0x51')](_0x3aa352)){throw new db[(_0x5ebe('0x56'))][(_0x5ebe('0x57'))](_0x5ebe('0x58'));}if(_0x4b3f35[_0x5ebe('0x59')]){return _0x4394be['download'](_0x3aa352,_0x4b3f35[_0x5ebe('0x59')]+path[_0x5ebe('0x5a')](_0x3aa352),function(){if(_0x216415){fs[_0x5ebe('0x5b')](_0x3aa352);}});}else{return _0x4394be[_0x5ebe('0x4b')](_0x3aa352,function(_0x322bbf){if(_0x216415){fs[_0x5ebe('0x5b')](_0x3aa352);}});}}})[_0x5ebe('0x45')](function(_0x11b098){if(_0x11b098[_0x5ebe('0x5c')]===_0x5ebe('0x58')){_0x4394be[_0x5ebe('0x17')](0x194)['send'](_0x5ebe('0x5d'));}else{return handleError(_0x4394be,null);}});};exports['destroy']=function(_0x3ec568,_0x5ab422){return db[_0x5ebe('0x26')][_0x5ebe('0x44')]({'where':{'id':_0x3ec568['params']['id']}})['then'](function(_0x3abaf9){if(!_0x3abaf9)throw new ReferenceError(_0x5ebe('0x5e'));return _0x3abaf9;})['then'](function(_0x2144c2){var _0x5f359f=path['join'](config[_0x5ebe('0x5f')],_0x5ebe('0x55'),_0x2144c2[_0x5ebe('0x4e')]);logger[_0x5ebe('0x60')]('cancellazione\x20fisica\x20documento\x20%s',_0x5f359f);if(!_[_0x5ebe('0x61')](_0x2144c2[_0x5ebe('0x4e')])&&fs[_0x5ebe('0x51')](_0x5f359f)){logger[_0x5ebe('0x60')](_0x5ebe('0x62')+_0x5f359f+_0x5ebe('0x63'));fs[_0x5ebe('0x64')](_0x5f359f);}_0x5f359f=_0x5f359f+_0x5ebe('0x65');if(!_[_0x5ebe('0x61')](_0x2144c2[_0x5ebe('0x4e')])&&fs[_0x5ebe('0x51')](_0x5f359f)){logger['info'](_0x5ebe('0x62')+_0x5f359f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x5ebe('0x64')](_0x5f359f);}return _0x2144c2;})['then'](function(_0x334eea){if(!_0x334eea)throw new InternalError();return _0x334eea[_0x5ebe('0x1e')]();})['then'](function(){_0x5ab422[_0x5ebe('0x17')](0xcc)['end']();})['catch'](handleError(_0x5ab422,null));}; \ No newline at end of file +var _0xc92f=['catch','show','params','find','create','body','duration','closedAt','describe','download','../../components/encryptor','uniqueid','value','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','join','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','save','update','then','error','stack','name','index','ScreenRecording','rawAttributes','fieldName','key','model','map','format','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','rows'];(function(_0x3911a1,_0x2a8237){var _0x32c7ec=function(_0x3a4c65){while(--_0x3a4c65){_0x3911a1['push'](_0x3911a1['shift']());}};_0x32c7ec(++_0x2a8237);}(_0xc92f,0xf3));var _0xfc92=function(_0x2abfb8,_0x5436da){_0x2abfb8=_0x2abfb8-0x0;var _0x47a904=_0xc92f[_0x2abfb8];return _0x47a904;};'use strict';var pdf=require(_0xfc92('0x0'));var emlformat=require(_0xfc92('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfc92('0x2'));var jsonpatch=require(_0xfc92('0x3'));var rp=require(_0xfc92('0x4'));var moment=require('moment');var BPromise=require(_0xfc92('0x5'));var Mustache=require(_0xfc92('0x6'));var util=require(_0xfc92('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xfc92('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfc92('0x9'));var squel=require('squel');var crypto=require(_0xfc92('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfc92('0xb'));var toCsv=require(_0xfc92('0x8'));var querystring=require(_0xfc92('0xc'));var Papa=require('papaparse');var Redis=require(_0xfc92('0xd'));var authService=require(_0xfc92('0xe'));var qs=require(_0xfc92('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc92('0x10'));var logger=require(_0xfc92('0x11'))(_0xfc92('0x12'));var utils=require(_0xfc92('0x13'));var config=require(_0xfc92('0x14'));var db=require(_0xfc92('0x15'))['db'];function respondWithStatusCode(_0x30c021,_0x17b4e6){_0x17b4e6=_0x17b4e6||0xcc;return function(_0x115a0f){if(_0x115a0f){return _0x30c021[_0xfc92('0x16')](_0x17b4e6);}return _0x30c021[_0xfc92('0x17')](_0x17b4e6)[_0xfc92('0x18')]();};}function respondWithResult(_0x53d174,_0x55d532){_0x55d532=_0x55d532||0xc8;return function(_0x4bb1ca){if(_0x4bb1ca){return _0x53d174[_0xfc92('0x17')](_0x55d532)[_0xfc92('0x19')](_0x4bb1ca);}};}function respondWithFilteredResult(_0x5dbd16,_0x213025){return function(_0x15ee68){if(_0x15ee68){var _0x3abcf3=_0x15ee68['count'],_0xbd6dee=_0x213025[_0xfc92('0x1a')],_0x45f191=_0x213025[_0xfc92('0x1a')]+_0x213025[_0xfc92('0x1b')],_0x26148c;if(_0x45f191>=_0x3abcf3){_0x45f191=_0x3abcf3;_0x26148c=0xc8;}else{_0x26148c=0xce;}_0x5dbd16[_0xfc92('0x17')](_0x26148c);return _0x5dbd16['set']('Content-Range',_0xbd6dee+'-'+_0x45f191+'/'+_0x3abcf3)[_0xfc92('0x19')](_0x15ee68);}return null;};}function patchUpdates(_0x328345){return function(_0x4de202){try{jsonpatch[_0xfc92('0x1c')](_0x4de202,_0x328345,!![]);}catch(_0x2e77b8){return BPromise['reject'](_0x2e77b8);}return _0x4de202[_0xfc92('0x1d')]();};}function saveUpdates(_0x5ec474,_0x376551){return function(_0x35ad35){if(_0x35ad35){return _0x35ad35[_0xfc92('0x1e')](_0x5ec474)[_0xfc92('0x1f')](function(_0x16cc95){return _0x16cc95;});}return null;};}function removeEntity(_0x413719,_0x4ea927){return function(_0x194587){if(_0x194587){return _0x194587['destroy']()[_0xfc92('0x1f')](function(){_0x413719[_0xfc92('0x17')](0xcc)[_0xfc92('0x18')]();});}};}function handleEntityNotFound(_0x55d9da,_0x4bb9ea){return function(_0x58a82e){if(!_0x58a82e){_0x55d9da['sendStatus'](0x194);}return _0x58a82e;};}function handleError(_0x1f6fe7,_0xbc3d98){_0xbc3d98=_0xbc3d98||0x1f4;return function(_0x12ffc2){logger[_0xfc92('0x20')](_0x12ffc2[_0xfc92('0x21')]);if(_0x12ffc2[_0xfc92('0x22')]){delete _0x12ffc2[_0xfc92('0x22')];}_0x1f6fe7[_0xfc92('0x17')](_0xbc3d98)['send'](_0x12ffc2);};}exports[_0xfc92('0x23')]=function(_0x29187c,_0x35cea1){var _0x5f083f={},_0x17b0c2={},_0x17cb0d={'count':0x0,'rows':[]};var _0x50fb4c=_['map'](db[_0xfc92('0x24')][_0xfc92('0x25')],function(_0x58d37a){return{'name':_0x58d37a[_0xfc92('0x26')],'type':_0x58d37a['type'][_0xfc92('0x27')]};});_0x17b0c2[_0xfc92('0x28')]=_['differenceBy'](_[_0xfc92('0x29')](_0x50fb4c,_0xfc92('0x22')),[_0xfc92('0x2a')]);_0x17b0c2[_0xfc92('0x2b')]=_[_0xfc92('0x2c')](_0x29187c[_0xfc92('0x2b')]);_0x17b0c2[_0xfc92('0x2d')]=_[_0xfc92('0x2e')](_0x17b0c2[_0xfc92('0x28')],_0x17b0c2['query']);_0x5f083f['attributes']=_[_0xfc92('0x2e')](_0x17b0c2['model'],qs[_0xfc92('0x2f')](_0x29187c[_0xfc92('0x2b')][_0xfc92('0x2f')]));_0x5f083f[_0xfc92('0x30')]=_0x5f083f['attributes']['length']?_0x5f083f[_0xfc92('0x30')]:_0x17b0c2[_0xfc92('0x28')];if(!_0x29187c[_0xfc92('0x2b')][_0xfc92('0x31')](_0xfc92('0x32'))){_0x5f083f[_0xfc92('0x1b')]=qs[_0xfc92('0x1b')](_0x29187c['query'][_0xfc92('0x1b')]);_0x5f083f[_0xfc92('0x1a')]=qs[_0xfc92('0x1a')](_0x29187c[_0xfc92('0x2b')]['offset']);}_0x5f083f[_0xfc92('0x33')]=qs['sort'](_0x29187c['query'][_0xfc92('0x34')]);_0x5f083f[_0xfc92('0x35')]=qs[_0xfc92('0x2d')](_['pick'](_0x29187c[_0xfc92('0x2b')],_0x17b0c2['filters']),_0x50fb4c);if(_0x29187c[_0xfc92('0x2b')][_0xfc92('0x36')]){_0x5f083f['where']=_[_0xfc92('0x37')](_0x5f083f[_0xfc92('0x35')],{'$or':_['map'](_0x50fb4c,function(_0x111cf0){if(_0x111cf0[_0xfc92('0x38')]!==_0xfc92('0x39')){var _0xd0493c={};_0xd0493c[_0x111cf0['name']]={'$like':'%'+_0x29187c['query'][_0xfc92('0x36')]+'%'};return _0xd0493c;}})});}_0x5f083f=_[_0xfc92('0x37')]({},_0x5f083f,_0x29187c[_0xfc92('0x3a')]);var _0x58e0fa={'where':_0x5f083f['where']};return db[_0xfc92('0x24')][_0xfc92('0x3b')](_0x58e0fa)[_0xfc92('0x1f')](function(_0x37de63){_0x17cb0d[_0xfc92('0x3b')]=_0x37de63;if(_0x29187c[_0xfc92('0x2b')][_0xfc92('0x3c')]){_0x5f083f[_0xfc92('0x3d')]=[{'all':!![]}];}return db[_0xfc92('0x24')]['findAll'](_0x5f083f);})[_0xfc92('0x1f')](function(_0xb55b67){_0x17cb0d[_0xfc92('0x3e')]=_0xb55b67;return _0x17cb0d;})[_0xfc92('0x1f')](respondWithFilteredResult(_0x35cea1,_0x5f083f))[_0xfc92('0x3f')](handleError(_0x35cea1,null));};exports[_0xfc92('0x40')]=function(_0x2739ed,_0x376491){var _0x340254={'raw':![],'where':{'id':_0x2739ed[_0xfc92('0x41')]['id']}},_0x54db01={};_0x54db01['model']=_[_0xfc92('0x2c')](db[_0xfc92('0x24')]['rawAttributes']);_0x54db01['query']=_[_0xfc92('0x2c')](_0x2739ed[_0xfc92('0x2b')]);_0x54db01[_0xfc92('0x2d')]=_[_0xfc92('0x2e')](_0x54db01[_0xfc92('0x28')],_0x54db01[_0xfc92('0x2b')]);_0x340254[_0xfc92('0x30')]=_['intersection'](_0x54db01[_0xfc92('0x28')],qs[_0xfc92('0x2f')](_0x2739ed[_0xfc92('0x2b')]['fields']));_0x340254[_0xfc92('0x30')]=_0x340254[_0xfc92('0x30')]['length']?_0x340254[_0xfc92('0x30')]:_0x54db01[_0xfc92('0x28')];if(_0x2739ed[_0xfc92('0x2b')]['includeAll']){_0x340254[_0xfc92('0x3d')]=[{'all':!![]}];}_0x340254=_[_0xfc92('0x37')]({},_0x340254,_0x2739ed[_0xfc92('0x3a')]);return db[_0xfc92('0x24')][_0xfc92('0x42')](_0x340254)[_0xfc92('0x1f')](handleEntityNotFound(_0x376491,null))['then'](respondWithResult(_0x376491,null))['catch'](handleError(_0x376491,null));};exports[_0xfc92('0x43')]=function(_0x10f3bd,_0x2d857d){return db[_0xfc92('0x24')][_0xfc92('0x43')](_0x10f3bd[_0xfc92('0x44')],{})[_0xfc92('0x1f')](respondWithResult(_0x2d857d,0xc9))[_0xfc92('0x3f')](handleError(_0x2d857d,null));};exports[_0xfc92('0x1e')]=function(_0x137300,_0x3bf03d){if(_0x137300[_0xfc92('0x44')]['id']){delete _0x137300[_0xfc92('0x44')]['id'];}delete _0x137300[_0xfc92('0x44')][_0xfc92('0x45')];delete _0x137300['body']['createdAt'];delete _0x137300['body'][_0xfc92('0x46')];delete _0x137300[_0xfc92('0x44')]['value'];return db[_0xfc92('0x24')][_0xfc92('0x42')]({'where':{'id':_0x137300[_0xfc92('0x41')]['id']}})[_0xfc92('0x1f')](handleEntityNotFound(_0x3bf03d,null))[_0xfc92('0x1f')](saveUpdates(_0x137300['body'],null))['then'](respondWithResult(_0x3bf03d,null))[_0xfc92('0x3f')](handleError(_0x3bf03d,null));};exports[_0xfc92('0x47')]=function(_0x1293d0,_0x341d0d){return db['ScreenRecording'][_0xfc92('0x47')]()[_0xfc92('0x1f')](respondWithResult(_0x341d0d,null))[_0xfc92('0x3f')](handleError(_0x341d0d,null));};exports[_0xfc92('0x48')]=function(_0x2b8325,_0x116f08,_0x14908d){var _0x298803=require(_0xfc92('0x49'));var _0x3af4b0=![];var _0x5c297f={};if(_0x2b8325['query'][_0xfc92('0x38')]&&_0x2b8325[_0xfc92('0x2b')][_0xfc92('0x38')]==='uniqueid'){_0x5c297f[_0xfc92('0x4a')]=_0x2b8325[_0xfc92('0x41')]['id'];}else{_0x5c297f['id']=_0x2b8325[_0xfc92('0x41')]['id'];}return db['ScreenRecording']['find']({'where':_0x5c297f,'attributes':['id',_0xfc92('0x4b')],'raw':!![]})[_0xfc92('0x1f')](handleEntityNotFound(_0x116f08,null))[_0xfc92('0x1f')](function(_0x41fc52){if(_0x41fc52){var _0x4efa0d=path['join'](config[_0xfc92('0x4c')],_0xfc92('0x4d'),_0x41fc52['value']);var _0xa67d6d=util[_0xfc92('0x2a')](_0xfc92('0x4e'),_0x4efa0d);if(fs[_0xfc92('0x4f')](_0xa67d6d)){_0x3af4b0=!![];return _0x298803[_0xfc92('0x50')](_0xa67d6d,_0x4efa0d,config[_0xfc92('0x51')][_0xfc92('0x52')])['then'](function(){return _0x41fc52;});}return _0x41fc52;}})[_0xfc92('0x1f')](function(_0xf00109){if(_0xf00109){var _0x4c8f4d=path[_0xfc92('0x53')](config[_0xfc92('0x4c')],_0xfc92('0x4d'),_0xf00109[_0xfc92('0x4b')]);if(!fs[_0xfc92('0x4f')](_0x4c8f4d)){throw new db[(_0xfc92('0x54'))][(_0xfc92('0x55'))](_0xfc92('0x56'));}if(_0xf00109[_0xfc92('0x57')]){return _0x116f08[_0xfc92('0x48')](_0x4c8f4d,_0xf00109[_0xfc92('0x57')]+path[_0xfc92('0x58')](_0x4c8f4d),function(){if(_0x3af4b0){fs[_0xfc92('0x59')](_0x4c8f4d);}});}else{return _0x116f08[_0xfc92('0x48')](_0x4c8f4d,function(_0x2ce5e7){if(_0x3af4b0){fs[_0xfc92('0x59')](_0x4c8f4d);}});}}})[_0xfc92('0x3f')](function(_0xde44b5){if(_0xde44b5[_0xfc92('0x5a')]===_0xfc92('0x56')){_0x116f08['status'](0x194)[_0xfc92('0x5b')](_0xfc92('0x5c'));}else{return handleError(_0x116f08,null);}});};exports[_0xfc92('0x5d')]=function(_0x69dca7,_0x5f4420){return db[_0xfc92('0x24')][_0xfc92('0x42')]({'where':{'id':_0x69dca7[_0xfc92('0x41')]['id']}})[_0xfc92('0x1f')](function(_0x2f41a0){if(!_0x2f41a0)throw new ReferenceError(_0xfc92('0x5e'));return _0x2f41a0;})['then'](function(_0x5ea9cd){var _0x190b0e=path[_0xfc92('0x53')](config[_0xfc92('0x4c')],_0xfc92('0x4d'),_0x5ea9cd[_0xfc92('0x4b')]);logger[_0xfc92('0x5f')](_0xfc92('0x60'),_0x190b0e);if(!_[_0xfc92('0x61')](_0x5ea9cd['value'])&&fs[_0xfc92('0x4f')](_0x190b0e)){logger[_0xfc92('0x5f')](_0xfc92('0x62')+_0x190b0e+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xfc92('0x63')](_0x190b0e);}_0x190b0e=_0x190b0e+_0xfc92('0x64');if(!_[_0xfc92('0x61')](_0x5ea9cd[_0xfc92('0x4b')])&&fs['existsSync'](_0x190b0e)){logger[_0xfc92('0x5f')]('File:\x20\x22'+_0x190b0e+_0xfc92('0x65'));fs[_0xfc92('0x63')](_0x190b0e);}return _0x5ea9cd;})[_0xfc92('0x1f')](function(_0x260366){if(!_0x260366)throw new InternalError();return _0x260366['destroy']();})[_0xfc92('0x1f')](function(){_0x5f4420[_0xfc92('0x17')](0xcc)[_0xfc92('0x18')]();})['catch'](handleError(_0x5f4420,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 697db82..159ae1e 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 _0x398a=['./screenRecording.attributes','define','ScreenRecording','interactionid','lodash','util','api','request-promise','path','rimraf','../../config/environment'];(function(_0x30c4f6,_0x5c2f4a){var _0x2affc3=function(_0x195e7e){while(--_0x195e7e){_0x30c4f6['push'](_0x30c4f6['shift']());}};_0x2affc3(++_0x5c2f4a);}(_0x398a,0xe0));var _0xa398=function(_0x1dbe2b,_0x4e6c80){_0x1dbe2b=_0x1dbe2b-0x0;var _0x2ecc3b=_0x398a[_0x1dbe2b];return _0x2ecc3b;};'use strict';var _=require(_0xa398('0x0'));var util=require(_0xa398('0x1'));var logger=require('../../config/logger')(_0xa398('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa398('0x3'));var fs=require('fs');var path=require(_0xa398('0x4'));var rimraf=require(_0xa398('0x5'));var config=require(_0xa398('0x6'));var attributes=require(_0xa398('0x7'));module['exports']=function(_0x33a281,_0x2e173c){return _0x33a281[_0xa398('0x8')](_0xa398('0x9'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xa398('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x51b1=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid'];(function(_0x9df1c2,_0x1c8815){var _0x3ced18=function(_0x5a28f3){while(--_0x5a28f3){_0x9df1c2['push'](_0x9df1c2['shift']());}};_0x3ced18(++_0x1c8815);}(_0x51b1,0x70));var _0x151b=function(_0x270061,_0x4e41e1){_0x270061=_0x270061-0x0;var _0x329604=_0x51b1[_0x270061];return _0x329604;};'use strict';var _=require(_0x151b('0x0'));var util=require(_0x151b('0x1'));var logger=require(_0x151b('0x2'))(_0x151b('0x3'));var moment=require('moment');var BPromise=require(_0x151b('0x4'));var rp=require(_0x151b('0x5'));var fs=require('fs');var path=require(_0x151b('0x6'));var rimraf=require(_0x151b('0x7'));var config=require(_0x151b('0x8'));var attributes=require(_0x151b('0x9'));module[_0x151b('0xa')]=function(_0x694ef8,_0x446497){return _0x694ef8['define'](_0x151b('0xb'),attributes,{'tableName':_0x151b('0xc'),'paranoid':![],'indexes':[{'name':_0x151b('0xd'),'fields':[_0x151b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index fd6ff9a..30a753a 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(_0x408718,_0x37fd0c){var _0x3a2e14=function(_0x41a9d9){while(--_0x41a9d9){_0x408718['push'](_0x408718['shift']());}};_0x3a2e14(++_0x37fd0c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _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(_0x252b2c,_0x2ca061){var _0x1e0e7d=function(_0x13ebdd){while(--_0x13ebdd){_0x252b2c['push'](_0x252b2c['shift']());}};_0x1e0e7d(++_0x2ca061);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 8c94c0b..cc8b0a2 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 _0x615b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','/:id','show','getLogo','getPreferred','getFavicon','diskStorage','join','root','format','extname','post','/:id/logo','single','addLogo','server/files/images/logos/','%s%s','logologin','originalname','file','addLogoLogin','/:id/preferred','addPreferred','favicon','addFavicon','put','exports','multer','connect-timeout','Router'];(function(_0x2026d1,_0x19df64){var _0x41de23=function(_0x48c2ea){while(--_0x48c2ea){_0x2026d1['push'](_0x2026d1['shift']());}};_0x41de23(++_0x19df64);}(_0x615b,0x66));var _0xb615=function(_0x31aec1,_0x394b02){_0x31aec1=_0x31aec1-0x0;var _0x277efa=_0x615b[_0x31aec1];return _0x277efa;};'use strict';var multer=require(_0xb615('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb615('0x1'));var express=require('express');var router=express[_0xb615('0x2')]();var auth=require(_0xb615('0x3'));var interaction=require(_0xb615('0x4'));var config=require(_0xb615('0x5'));var controller=require(_0xb615('0x6'));router[_0xb615('0x7')]('/',auth[_0xb615('0x8')](),controller['index']);router[_0xb615('0x7')](_0xb615('0x9'),controller[_0xb615('0xa')]);router['get']('/:id/logo',controller[_0xb615('0xb')]);router['get']('/:id/logo_login',controller['getLogoLogin']);router['get']('/:id/gdpr',controller['gdpr']);router[_0xb615('0x7')]('/:id/preferred',controller[_0xb615('0xc')]);router[_0xb615('0x7')]('/:id/favicon',controller[_0xb615('0xd')]);var upload=multer({'storage':multer[_0xb615('0xe')]({'destination':function(_0x84e7f9,_0x472f84,_0x1d1e1d){_0x1d1e1d(null,path[_0xb615('0xf')](config[_0xb615('0x10')],'server/files/images/logos/'));},'filename':function(_0x3663f0,_0x427b31,_0x19ea7c){_0x19ea7c(null,util[_0xb615('0x11')]('%s%s','logo',path[_0xb615('0x12')](_0x427b31['originalname'])));}})});router[_0xb615('0x13')](_0xb615('0x14'),upload[_0xb615('0x15')]('file'),controller[_0xb615('0x16')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x19af94,_0x5839a0,_0x368b61){_0x368b61(null,path['join'](config[_0xb615('0x10')],_0xb615('0x17')));},'filename':function(_0x403c83,_0x903721,_0x17e97f){_0x17e97f(null,util[_0xb615('0x11')](_0xb615('0x18'),_0xb615('0x19'),path['extname'](_0x903721[_0xb615('0x1a')])));}})});router[_0xb615('0x13')]('/:id/logo_login',upload[_0xb615('0x15')](_0xb615('0x1b')),controller[_0xb615('0x1c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x469961,_0x1f704c,_0x21baf7){_0x21baf7(null,path[_0xb615('0xf')](config[_0xb615('0x10')],_0xb615('0x17')));},'filename':function(_0xbb6e48,_0x3bc406,_0x210033){_0x210033(null,util[_0xb615('0x11')](_0xb615('0x18'),'preferred',path['extname'](_0x3bc406['originalname'])));}})});router[_0xb615('0x13')](_0xb615('0x1d'),upload['single'](_0xb615('0x1b')),controller[_0xb615('0x1e')]);var upload=multer({'storage':multer[_0xb615('0xe')]({'destination':function(_0x119674,_0x491b2d,_0x5691a2){_0x5691a2(null,path[_0xb615('0xf')](config[_0xb615('0x10')],_0xb615('0x17')));},'filename':function(_0x197e86,_0x17433c,_0x439920){_0x439920(null,util[_0xb615('0x11')](_0xb615('0x18'),_0xb615('0x1f'),path['extname'](_0x17433c['originalname'])));}})});router[_0xb615('0x13')]('/:id/favicon',upload[_0xb615('0x15')](_0xb615('0x1b')),controller[_0xb615('0x20')]);router[_0xb615('0x21')](_0xb615('0x9'),auth['isAuthenticated'](),controller['update']);module[_0xb615('0x22')]=router; \ No newline at end of file +var _0xddd6=['getLogo','getLogoLogin','/:id/gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','join','format','%s%s','logo','extname','originalname','single','addLogo','root','server/files/images/logos/','logologin','post','addLogoLogin','/:id/preferred','file','addPreferred','addFavicon','put','/:id','update','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','show','/:id/logo'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0xddd6,0x13b));var _0x6ddd=function(_0x148b3c,_0x5bf45e){_0x148b3c=_0x148b3c-0x0;var _0x4dc4c4=_0xddd6[_0x148b3c];return _0x4dc4c4;};'use strict';var multer=require(_0x6ddd('0x0'));var util=require(_0x6ddd('0x1'));var path=require(_0x6ddd('0x2'));var timeout=require(_0x6ddd('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x6ddd('0x4'));var interaction=require(_0x6ddd('0x5'));var config=require(_0x6ddd('0x6'));var controller=require(_0x6ddd('0x7'));router[_0x6ddd('0x8')]('/',auth[_0x6ddd('0x9')](),controller[_0x6ddd('0xa')]);router[_0x6ddd('0x8')]('/:id',controller[_0x6ddd('0xb')]);router[_0x6ddd('0x8')](_0x6ddd('0xc'),controller[_0x6ddd('0xd')]);router['get']('/:id/logo_login',controller[_0x6ddd('0xe')]);router[_0x6ddd('0x8')](_0x6ddd('0xf'),controller['gdpr']);router[_0x6ddd('0x8')]('/:id/preferred',controller[_0x6ddd('0x10')]);router['get'](_0x6ddd('0x11'),controller[_0x6ddd('0x12')]);var upload=multer({'storage':multer[_0x6ddd('0x13')]({'destination':function(_0x629aee,_0x5e3de0,_0x15218){_0x15218(null,path[_0x6ddd('0x14')](config['root'],'server/files/images/logos/'));},'filename':function(_0xa56a46,_0x38c315,_0x38db7c){_0x38db7c(null,util[_0x6ddd('0x15')](_0x6ddd('0x16'),_0x6ddd('0x17'),path[_0x6ddd('0x18')](_0x38c315[_0x6ddd('0x19')])));}})});router['post']('/:id/logo',upload[_0x6ddd('0x1a')]('file'),controller[_0x6ddd('0x1b')]);var upload=multer({'storage':multer[_0x6ddd('0x13')]({'destination':function(_0x199491,_0x58002d,_0x46e65a){_0x46e65a(null,path[_0x6ddd('0x14')](config[_0x6ddd('0x1c')],_0x6ddd('0x1d')));},'filename':function(_0x524756,_0x37a3d2,_0x23edc5){_0x23edc5(null,util[_0x6ddd('0x15')]('%s%s',_0x6ddd('0x1e'),path[_0x6ddd('0x18')](_0x37a3d2[_0x6ddd('0x19')])));}})});router[_0x6ddd('0x1f')]('/:id/logo_login',upload['single']('file'),controller[_0x6ddd('0x20')]);var upload=multer({'storage':multer[_0x6ddd('0x13')]({'destination':function(_0x20018c,_0x1fe0ac,_0x35df3a){_0x35df3a(null,path[_0x6ddd('0x14')](config['root'],_0x6ddd('0x1d')));},'filename':function(_0x4a3294,_0x4b7741,_0x16c36f){_0x16c36f(null,util[_0x6ddd('0x15')](_0x6ddd('0x16'),'preferred',path['extname'](_0x4b7741[_0x6ddd('0x19')])));}})});router['post'](_0x6ddd('0x21'),upload[_0x6ddd('0x1a')](_0x6ddd('0x22')),controller[_0x6ddd('0x23')]);var upload=multer({'storage':multer[_0x6ddd('0x13')]({'destination':function(_0x137c48,_0x48cf89,_0x2c6868){_0x2c6868(null,path[_0x6ddd('0x14')](config[_0x6ddd('0x1c')],_0x6ddd('0x1d')));},'filename':function(_0x36ec4e,_0x4ec60e,_0x4d348a){_0x4d348a(null,util[_0x6ddd('0x15')]('%s%s','favicon',path[_0x6ddd('0x18')](_0x4ec60e['originalname'])));}})});router[_0x6ddd('0x1f')](_0x6ddd('0x11'),upload[_0x6ddd('0x1a')](_0x6ddd('0x22')),controller[_0x6ddd('0x24')]);router[_0x6ddd('0x25')](_0x6ddd('0x26'),auth[_0x6ddd('0x9')](),controller[_0x6ddd('0x27')]);module[_0x6ddd('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 9849aff..8008f2c 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 _0x7b95=['INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','exports'];(function(_0x44a612,_0x37c2ec){var _0xbda14e=function(_0x221966){while(--_0x221966){_0x44a612['push'](_0x44a612['shift']());}};_0xbda14e(++_0x37c2ec);}(_0x7b95,0x11f));var _0x57b9=function(_0xbf3d75,_0x312384){_0xbf3d75=_0xbf3d75-0x0;var _0x56c687=_0x7b95[_0xbf3d75];return _0x56c687;};'use strict';var Sequelize=require('sequelize');module[_0x57b9('0x0')]={'min_internal':{'type':Sequelize[_0x57b9('0x1')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x57b9('0x1')](0xb),'unique':_0x57b9('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x57b9('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x57b9('0x3')],'defaultValue':_0x57b9('0x4')},'logo':{'type':Sequelize[_0x57b9('0x3')]},'defaultLogo':{'type':Sequelize[_0x57b9('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x57b9('0x3')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x57b9('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x57b9('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x57b9('0x3')]},'turnaddr':{'type':Sequelize[_0x57b9('0x3')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x57b9('0x3')]},'pageTitle':{'type':Sequelize[_0x57b9('0x3')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x57b9('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x57b9('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x57b9('0x3')],'defaultValue':_0x57b9('0x6')},'enableEmailPreview':{'type':Sequelize[_0x57b9('0x5')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x57b9('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x57b9('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x57b9('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x57b9('0x7')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x57b9('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x57b9('0x3')]},'defaultPreferred':{'type':Sequelize[_0x57b9('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x57b9('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x57b9('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0x57b9('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x57b9('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x57b9('0x3')]},'defaultFavicon':{'type':Sequelize[_0x57b9('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x57b9('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x57b9('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x57b9('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x57b9('0x1')]},'transcribeRegion':{'type':Sequelize[_0x57b9('0x3')]},'sentiment':{'type':Sequelize[_0x57b9('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x57b9('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x57b9('0x1')]},'sentimentRegion':{'type':Sequelize[_0x57b9('0x3')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x57b9('0x3')]},'googleSsoEnabled':{'type':Sequelize[_0x57b9('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0xe9eb=['STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','sequelize','exports','INTEGER','min_internal'];(function(_0x92032b,_0x55fee6){var _0x112184=function(_0x2e7ac8){while(--_0x2e7ac8){_0x92032b['push'](_0x92032b['shift']());}};_0x112184(++_0x55fee6);}(_0xe9eb,0x1c7));var _0xbe9e=function(_0x20f643,_0xa02b6a){_0x20f643=_0x20f643-0x0;var _0x1e98f4=_0xe9eb[_0x20f643];return _0x1e98f4;};'use strict';var Sequelize=require(_0xbe9e('0x0'));module[_0xbe9e('0x1')]={'min_internal':{'type':Sequelize[_0xbe9e('0x2')](0xb),'unique':_0xbe9e('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xbe9e('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xbe9e('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xbe9e('0x4')],'defaultValue':_0xbe9e('0x5')},'logo':{'type':Sequelize[_0xbe9e('0x4')]},'defaultLogo':{'type':Sequelize[_0xbe9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xbe9e('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0xbe9e('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xbe9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xbe9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xbe9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xbe9e('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xbe9e('0x4')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xbe9e('0x4')]},'turnpassword':{'type':Sequelize[_0xbe9e('0x4')]},'pageTitle':{'type':Sequelize[_0xbe9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xbe9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xbe9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xbe9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xbe9e('0x4')],'defaultValue':_0xbe9e('0x7')},'enableEmailPreview':{'type':Sequelize[_0xbe9e('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xbe9e('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xbe9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xbe9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xbe9e('0x4')],'defaultValue':_0xbe9e('0x8')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xbe9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xbe9e('0x4')]},'defaultPreferred':{'type':Sequelize[_0xbe9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xbe9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0xbe9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xbe9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xbe9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xbe9e('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xbe9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xbe9e('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0xbe9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xbe9e('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xbe9e('0x2')]},'sentimentRegion':{'type':Sequelize[_0xbe9e('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0xbe9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0xbe9e('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index ad76605..41d46c4 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 _0x591e=['merge','options','includeAll','findAll','rows','params','intersection','include','body','find','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','root','toLower','join','default_logo.svg','upperFirst','custom','Sequelize','\x20not\x20found','download','getLogoLogin','getLicense','default_loginLogo.svg','default','addPreferred','getPreferred','default_preferred.png','getFavicon','default_favicon.ico','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','Setting,\x20%s,\x20%s','message','info','result','catch','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','name','index','map','Setting','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x3169e9,_0x12e682){var _0x22a452=function(_0x345a21){while(--_0x345a21){_0x3169e9['push'](_0x3169e9['shift']());}};_0x22a452(++_0x12e682);}(_0x591e,0x11b));var _0xe591=function(_0x23e3f9,_0x5b495e){_0x23e3f9=_0x23e3f9-0x0;var _0x188309=_0x591e[_0x23e3f9];return _0x188309;};'use strict';var pdf=require(_0xe591('0x0'));var emlformat=require(_0xe591('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe591('0x2'));var jsonpatch=require(_0xe591('0x3'));var rp=require(_0xe591('0x4'));var moment=require('moment');var BPromise=require(_0xe591('0x5'));var Mustache=require(_0xe591('0x6'));var util=require(_0xe591('0x7'));var path=require(_0xe591('0x8'));var sox=require(_0xe591('0x9'));var csv=require(_0xe591('0xa'));var ejs=require(_0xe591('0xb'));var fs=require('fs');var _=require(_0xe591('0xc'));var squel=require(_0xe591('0xd'));var crypto=require(_0xe591('0xe'));var jsforce=require(_0xe591('0xf'));var deskjs=require(_0xe591('0x10'));var toCsv=require(_0xe591('0xa'));var querystring=require('querystring');var Papa=require(_0xe591('0x11'));var Redis=require(_0xe591('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe591('0x13'));var as=require(_0xe591('0x14'));var hardwareService=require(_0xe591('0x15'));var logger=require(_0xe591('0x16'))(_0xe591('0x17'));var utils=require(_0xe591('0x18'));var config=require('../../config/environment');var db=require(_0xe591('0x19'))['db'];var jayson=require(_0xe591('0x1a'));var client=jayson[_0xe591('0x1b')][_0xe591('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x5867dc,_0x491dcd,_0x229a7c){if(_0x229a7c){var _0x5c6284=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5c6284['test'](_0x491dcd)){return _0x5867dc;}else{throw new db['Sequelize'][(_0xe591('0x1d'))](_0xe591('0x1e'));}}else{return _0x5867dc;}}function respondWithRpcPromise(_0xbada04,_0x11429e,_0x99fd94,_0x2f410a){return new BPromise(function(_0x49768c,_0x2dbe22){var _0x33ef85=_0x2f410a||client;return _0x33ef85[_0xe591('0x1f')](_0xbada04,_0x99fd94)[_0xe591('0x20')](function(_0x214b6){logger['info']('Setting,\x20%s,\x20%s',_0x11429e,_0xe591('0x21'));logger[_0xe591('0x22')](_0xe591('0x23'),_0x11429e,_0xe591('0x21'),JSON['stringify'](_0x214b6));if(_0x214b6[_0xe591('0x24')]){if(_0x214b6['error'][_0xe591('0x25')]===0x1f4){logger[_0xe591('0x24')](_0xe591('0x26'),_0x11429e,_0x214b6['error'][_0xe591('0x27')]);return _0x2dbe22(_0x214b6[_0xe591('0x24')][_0xe591('0x27')]);}logger[_0xe591('0x24')](_0xe591('0x26'),_0x11429e,_0x214b6[_0xe591('0x24')][_0xe591('0x27')]);return _0x49768c(_0x214b6[_0xe591('0x24')][_0xe591('0x27')]);}else{logger[_0xe591('0x28')]('Setting,\x20%s,\x20%s',_0x11429e,'request\x20sent');_0x49768c(_0x214b6[_0xe591('0x29')][_0xe591('0x27')]);}})[_0xe591('0x2a')](function(_0x4fa6a3){logger[_0xe591('0x24')](_0xe591('0x26'),_0x11429e,_0x4fa6a3);_0x2dbe22(_0x4fa6a3);});});}function respondWithStatusCode(_0x4f5712,_0x59f20d){_0x59f20d=_0x59f20d||0xcc;return function(_0x15f5b7){if(_0x15f5b7){return _0x4f5712['sendStatus'](_0x59f20d);}return _0x4f5712['status'](_0x59f20d)['end']();};}function respondWithResult(_0x337643,_0x220192){_0x220192=_0x220192||0xc8;return function(_0x184b5c){if(_0x184b5c){return _0x337643['status'](_0x220192)[_0xe591('0x2b')](_0x184b5c);}};}function respondWithFilteredResult(_0x37d15b,_0x2a9da1){return function(_0x4e12b5){if(_0x4e12b5){var _0x5a0590=_0x4e12b5[_0xe591('0x2c')],_0x31936a=_0x2a9da1[_0xe591('0x2d')],_0x2f25b5=_0x2a9da1[_0xe591('0x2d')]+_0x2a9da1[_0xe591('0x2e')],_0x48fb4a;if(_0x2f25b5>=_0x5a0590){_0x2f25b5=_0x5a0590;_0x48fb4a=0xc8;}else{_0x48fb4a=0xce;}_0x37d15b[_0xe591('0x2f')](_0x48fb4a);return _0x37d15b[_0xe591('0x30')](_0xe591('0x31'),_0x31936a+'-'+_0x2f25b5+'/'+_0x5a0590)['json'](_0x4e12b5);}return null;};}function patchUpdates(_0x538e03){return function(_0x3a564b){try{jsonpatch[_0xe591('0x32')](_0x3a564b,_0x538e03,!![]);}catch(_0x52a475){return BPromise[_0xe591('0x33')](_0x52a475);}return _0x3a564b[_0xe591('0x34')]();};}function saveUpdates(_0x276ebd,_0xeb8519){return function(_0x564f29){if(_0x564f29){return _0x564f29[_0xe591('0x35')](_0x276ebd)[_0xe591('0x20')](function(_0x40d3a8){return _0x40d3a8;});}return null;};}function removeEntity(_0x21db98,_0x9b803f){return function(_0x29f20a){if(_0x29f20a){return _0x29f20a[_0xe591('0x36')]()[_0xe591('0x20')](function(){_0x21db98[_0xe591('0x2f')](0xcc)[_0xe591('0x37')]();});}};}function handleEntityNotFound(_0x479212,_0x264b40){return function(_0x4d28b5){if(!_0x4d28b5){_0x479212[_0xe591('0x38')](0x194);}return _0x4d28b5;};}function handleError(_0x16665a,_0x248eb5){_0x248eb5=_0x248eb5||0x1f4;return function(_0x2adecd){logger[_0xe591('0x24')](_0x2adecd['stack']);if(_0x2adecd[_0xe591('0x39')]){delete _0x2adecd[_0xe591('0x39')];}_0x16665a[_0xe591('0x2f')](_0x248eb5)['send'](_0x2adecd);};}exports[_0xe591('0x3a')]=function(_0x14a0e9,_0x354c69){var _0x290f03={},_0x4896f7={},_0xe36525={'count':0x0,'rows':[]};var _0x6f4e12=_[_0xe591('0x3b')](db[_0xe591('0x3c')][_0xe591('0x3d')],function(_0x9e2511){return{'name':_0x9e2511['fieldName'],'type':_0x9e2511[_0xe591('0x3e')][_0xe591('0x3f')]};});_0x4896f7[_0xe591('0x40')]=_[_0xe591('0x3b')](_0x6f4e12,_0xe591('0x39'));_0x4896f7[_0xe591('0x41')]=_[_0xe591('0x42')](_0x14a0e9['query']);_0x4896f7[_0xe591('0x43')]=_['intersection'](_0x4896f7[_0xe591('0x40')],_0x4896f7[_0xe591('0x41')]);_0x290f03[_0xe591('0x44')]=_['intersection'](_0x4896f7['model'],qs[_0xe591('0x45')](_0x14a0e9[_0xe591('0x41')]['fields']));_0x290f03[_0xe591('0x44')]=_0x290f03['attributes'][_0xe591('0x46')]?_0x290f03[_0xe591('0x44')]:_0x4896f7[_0xe591('0x40')];if(!_0x14a0e9[_0xe591('0x41')][_0xe591('0x47')](_0xe591('0x48'))){_0x290f03[_0xe591('0x2e')]=qs[_0xe591('0x2e')](_0x14a0e9[_0xe591('0x41')]['limit']);_0x290f03[_0xe591('0x2d')]=qs[_0xe591('0x2d')](_0x14a0e9[_0xe591('0x41')][_0xe591('0x2d')]);}_0x290f03[_0xe591('0x49')]=qs[_0xe591('0x4a')](_0x14a0e9[_0xe591('0x41')][_0xe591('0x4a')]);_0x290f03[_0xe591('0x4b')]=qs[_0xe591('0x43')](_[_0xe591('0x4c')](_0x14a0e9['query'],_0x4896f7[_0xe591('0x43')]),_0x6f4e12);if(_0x14a0e9[_0xe591('0x41')]['filter']){_0x290f03[_0xe591('0x4b')]=_[_0xe591('0x4d')](_0x290f03[_0xe591('0x4b')],{'$or':_[_0xe591('0x3b')](_0x6f4e12,function(_0x5c51e3){if(_0x5c51e3[_0xe591('0x3e')]!=='VIRTUAL'){var _0x56be46={};_0x56be46[_0x5c51e3[_0xe591('0x39')]]={'$like':'%'+_0x14a0e9['query']['filter']+'%'};return _0x56be46;}})});}_0x290f03=_['merge']({},_0x290f03,_0x14a0e9[_0xe591('0x4e')]);var _0x776d6={'where':_0x290f03[_0xe591('0x4b')]};return db['Setting']['count'](_0x776d6)[_0xe591('0x20')](function(_0x151a0c){_0xe36525[_0xe591('0x2c')]=_0x151a0c;if(_0x14a0e9[_0xe591('0x41')][_0xe591('0x4f')]){_0x290f03['include']=[{'all':!![]}];}return db[_0xe591('0x3c')][_0xe591('0x50')](_0x290f03);})[_0xe591('0x20')](function(_0x1a336f){_0xe36525[_0xe591('0x51')]=_0x1a336f;return _0xe36525;})['then'](respondWithFilteredResult(_0x354c69,_0x290f03))[_0xe591('0x2a')](handleError(_0x354c69,null));};exports['show']=function(_0xd1ef00,_0x5b5cab){var _0xa58b4a={'raw':![],'where':{'id':_0xd1ef00[_0xe591('0x52')]['id']}},_0x10a700={};_0x10a700[_0xe591('0x40')]=_['keys'](db[_0xe591('0x3c')][_0xe591('0x3d')]);_0x10a700[_0xe591('0x41')]=_['keys'](_0xd1ef00[_0xe591('0x41')]);_0x10a700['filters']=_[_0xe591('0x53')](_0x10a700['model'],_0x10a700[_0xe591('0x41')]);_0xa58b4a[_0xe591('0x44')]=_[_0xe591('0x53')](_0x10a700[_0xe591('0x40')],qs[_0xe591('0x45')](_0xd1ef00[_0xe591('0x41')][_0xe591('0x45')]));_0xa58b4a[_0xe591('0x44')]=_0xa58b4a[_0xe591('0x44')][_0xe591('0x46')]?_0xa58b4a['attributes']:_0x10a700[_0xe591('0x40')];if(_0xd1ef00[_0xe591('0x41')][_0xe591('0x4f')]){_0xa58b4a[_0xe591('0x54')]=[{'all':!![]}];}_0xa58b4a=_[_0xe591('0x4d')]({},_0xa58b4a,_0xd1ef00[_0xe591('0x4e')]);return db[_0xe591('0x3c')]['find'](_0xa58b4a)[_0xe591('0x20')](handleEntityNotFound(_0x5b5cab,null))[_0xe591('0x20')](respondWithResult(_0x5b5cab,null))[_0xe591('0x2a')](handleError(_0x5b5cab,null));};exports['update']=function(_0x3fb8fe,_0x1672c1){if(_0x3fb8fe[_0xe591('0x55')]['id']){delete _0x3fb8fe[_0xe591('0x55')]['id'];}return db[_0xe591('0x3c')][_0xe591('0x56')]({'where':{'id':_0x3fb8fe['params']['id']}})[_0xe591('0x20')](handleEntityNotFound(_0x1672c1,null))[_0xe591('0x20')](saveUpdates(_0x3fb8fe[_0xe591('0x55')],null))[_0xe591('0x20')](respondWithResult(_0x1672c1,null))[_0xe591('0x2a')](handleError(_0x1672c1,null));};exports['addLogo']=function(_0x40557b,_0x3fbf2c,_0x26e7fd){if(_0x40557b['file']&&_0x40557b[_0xe591('0x57')][_0xe591('0x58')]){_0x40557b[_0xe591('0x55')][_0xe591('0x59')]=_0x40557b[_0xe591('0x57')][_0xe591('0x58')];}return db[_0xe591('0x3c')][_0xe591('0x56')]({'where':{'id':_0x40557b[_0xe591('0x52')]['id']}})[_0xe591('0x20')](handleEntityNotFound(_0x3fbf2c,null))[_0xe591('0x20')](saveUpdates(_0x40557b['body'],null))['then'](respondWithResult(_0x3fbf2c,null))[_0xe591('0x2a')](handleError(_0x3fbf2c,null));};exports[_0xe591('0x5a')]=function(_0xd6602c,_0x12557c,_0x27c836){if(_0xd6602c[_0xe591('0x57')]&&_0xd6602c[_0xe591('0x57')][_0xe591('0x58')]){_0xd6602c[_0xe591('0x55')][_0xe591('0x5b')]=_0xd6602c['file'][_0xe591('0x58')];}return db[_0xe591('0x3c')][_0xe591('0x56')]({'where':{'id':_0xd6602c['params']['id']}})[_0xe591('0x20')](handleEntityNotFound(_0x12557c,null))[_0xe591('0x20')](saveUpdates(_0xd6602c[_0xe591('0x55')],null))[_0xe591('0x20')](respondWithResult(_0x12557c,null))[_0xe591('0x2a')](handleError(_0x12557c,null));};var utilLicense=require(_0xe591('0x5c'));exports[_0xe591('0x5d')]=function(_0x451914,_0x40db91,_0x4722cb){var _0x57db7b=_0xe591('0x5e');var _0xf67732={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x322413){if(_0x322413){_0xf67732=_0x322413;}return db[_0xe591('0x3c')][_0xe591('0x56')]({'where':{'id':_0x451914[_0xe591('0x52')]['id']},'attributes':[_0xe591('0x59'),_0xe591('0x5b'),_0xe591('0x5f'),_0xe591('0x60'),_0xe591('0x61'),_0xe591('0x62'),_0xe591('0x63'),_0xe591('0x64')],'raw':!![]});})[_0xe591('0x20')](handleEntityNotFound(_0x40db91,null))[_0xe591('0x20')](function(_0x114e3f){if(_0x114e3f){var _0x2593df=_0x114e3f[_0xe591('0x59')]&&fs[_0xe591('0x65')](path['join'](config[_0xe591('0x66')],_0x57db7b,_[_0xe591('0x67')](_0x114e3f[_0xe591('0x59')])))?path[_0xe591('0x68')](config[_0xe591('0x66')],_0x57db7b,_[_0xe591('0x67')](_0x114e3f[_0xe591('0x59')])):path[_0xe591('0x68')](config[_0xe591('0x66')],_0x57db7b,_[_0xe591('0x67')](_0xe591('0x69')));var _0xb468ea='default'+_[_0xe591('0x6a')](_0xe591('0x59'));if(_0x114e3f[_0xb468ea]||!_0xf67732[_0xe591('0x6b')]){_0x2593df=path[_0xe591('0x68')](config[_0xe591('0x66')],_0x57db7b,_['toLower'](_0xe591('0x69')));}if(!fs['existsSync'](_0x2593df)){throw new db[(_0xe591('0x6c'))][(_0xe591('0x1d'))](_[_0xe591('0x6a')]('logo')+_0xe591('0x6d'));}return _0x40db91[_0xe591('0x6e')](_0x2593df);}})[_0xe591('0x2a')](handleError(_0x40db91,null));};var utilLicense=require('../../config/license/util');exports[_0xe591('0x6f')]=function(_0x555724,_0x1791f9,_0x38de4b){var _0x2d1319=_0xe591('0x5e');var _0x1e1d23={'custom':![]};return utilLicense[_0xe591('0x70')]()['then'](function(_0x3110df){if(_0x3110df){_0x1e1d23=_0x3110df;}return db[_0xe591('0x3c')]['find']({'where':{'id':_0x555724[_0xe591('0x52')]['id']},'attributes':['logo',_0xe591('0x5b'),_0xe591('0x5f'),_0xe591('0x60'),'defaultLogo',_0xe591('0x62'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xe591('0x20')](handleEntityNotFound(_0x1791f9,null))[_0xe591('0x20')](function(_0x553b69){if(_0x553b69){var _0x3a6b1e=_0x553b69['loginLogo']&&fs[_0xe591('0x65')](path[_0xe591('0x68')](config[_0xe591('0x66')],_0x2d1319,_[_0xe591('0x67')](_0x553b69[_0xe591('0x5b')])))?path[_0xe591('0x68')](config[_0xe591('0x66')],_0x2d1319,_['toLower'](_0x553b69['loginLogo'])):path[_0xe591('0x68')](config['root'],_0x2d1319,_[_0xe591('0x67')](_0xe591('0x71')));var _0x3f0fbb=_0xe591('0x72')+_['upperFirst'](_0xe591('0x5b'));if(_0x553b69[_0x3f0fbb]||!_0x1e1d23[_0xe591('0x6b')]){_0x3a6b1e=path[_0xe591('0x68')](config[_0xe591('0x66')],_0x2d1319,_[_0xe591('0x67')]('default_loginLogo.svg'));}if(!fs[_0xe591('0x65')](_0x3a6b1e)){throw new db[(_0xe591('0x6c'))][(_0xe591('0x1d'))](_[_0xe591('0x6a')](_0xe591('0x5b'))+_0xe591('0x6d'));}return _0x1791f9[_0xe591('0x6e')](_0x3a6b1e);}})[_0xe591('0x2a')](handleError(_0x1791f9,null));};exports['gdpr']=function(_0x191d14,_0x2dfe2b){return db['Setting']['find']({'where':{'id':_0x191d14[_0xe591('0x52')]['id']},'attributes':['securePassword']})[_0xe591('0x20')](respondWithResult(_0x2dfe2b,null))[_0xe591('0x2a')](handleError(_0x2dfe2b,null));};exports[_0xe591('0x73')]=function(_0x253b97,_0x2b6a62,_0x246254){if(_0x253b97[_0xe591('0x57')]&&_0x253b97[_0xe591('0x57')][_0xe591('0x58')]){_0x253b97[_0xe591('0x55')][_0xe591('0x5f')]=_0x253b97[_0xe591('0x57')][_0xe591('0x58')];}return db[_0xe591('0x3c')][_0xe591('0x56')]({'where':{'id':_0x253b97[_0xe591('0x52')]['id']}})[_0xe591('0x20')](handleEntityNotFound(_0x2b6a62,null))[_0xe591('0x20')](saveUpdates(_0x253b97[_0xe591('0x55')],null))[_0xe591('0x20')](respondWithResult(_0x2b6a62,null))[_0xe591('0x2a')](handleError(_0x2b6a62,null));};var utilLicense=require(_0xe591('0x5c'));exports[_0xe591('0x74')]=function(_0x4e310e,_0x5b4968,_0x23c615){var _0x3f4604='server/files/images/logos';var _0x3e2d53={'custom':![]};return utilLicense[_0xe591('0x70')]()[_0xe591('0x20')](function(_0x1b89ed){if(_0x1b89ed){_0x3e2d53=_0x1b89ed;}return db['Setting'][_0xe591('0x56')]({'where':{'id':_0x4e310e[_0xe591('0x52')]['id']},'attributes':[_0xe591('0x59'),_0xe591('0x5b'),_0xe591('0x5f'),_0xe591('0x60'),_0xe591('0x61'),_0xe591('0x62'),_0xe591('0x63'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x5b4968,null))[_0xe591('0x20')](function(_0x27dce1){if(_0x27dce1){var _0x626aaa=_0x27dce1['preferred']&&fs[_0xe591('0x65')](path[_0xe591('0x68')](config['root'],_0x3f4604,_['toLower'](_0x27dce1['preferred'])))?path['join'](config[_0xe591('0x66')],_0x3f4604,_[_0xe591('0x67')](_0x27dce1[_0xe591('0x5f')])):path[_0xe591('0x68')](config['root'],_0x3f4604,_['toLower'](_0xe591('0x75')));var _0x460250=_0xe591('0x72')+_[_0xe591('0x6a')]('preferred');if(_0x27dce1[_0x460250]||!_0x3e2d53[_0xe591('0x6b')]||!_0x3e2d53[_0xe591('0x5f')]){_0x626aaa=path[_0xe591('0x68')](config[_0xe591('0x66')],_0x3f4604,_[_0xe591('0x67')](_0xe591('0x75')));}if(!fs[_0xe591('0x65')](_0x626aaa)){throw new db[(_0xe591('0x6c'))][(_0xe591('0x1d'))](_[_0xe591('0x6a')](_0xe591('0x5f'))+_0xe591('0x6d'));}return _0x5b4968[_0xe591('0x6e')](_0x626aaa);}})[_0xe591('0x2a')](handleError(_0x5b4968,null));};exports['addFavicon']=function(_0x102826,_0x172116,_0x6b55f8){if(_0x102826[_0xe591('0x57')]&&_0x102826['file'][_0xe591('0x58')]){_0x102826[_0xe591('0x55')][_0xe591('0x60')]=_0x102826['file'][_0xe591('0x58')];}return db['Setting'][_0xe591('0x56')]({'where':{'id':_0x102826[_0xe591('0x52')]['id']}})[_0xe591('0x20')](handleEntityNotFound(_0x172116,null))[_0xe591('0x20')](saveUpdates(_0x102826[_0xe591('0x55')],null))['then'](respondWithResult(_0x172116,null))['catch'](handleError(_0x172116,null));};var utilLicense=require('../../config/license/util');exports[_0xe591('0x76')]=function(_0x3ab092,_0x4eeed1,_0x581596){var _0x5c6f89='server/files/images/logos';var _0x2737e2={'custom':![]};return utilLicense[_0xe591('0x70')]()[_0xe591('0x20')](function(_0x14d3ed){if(_0x14d3ed){_0x2737e2=_0x14d3ed;}return db[_0xe591('0x3c')][_0xe591('0x56')]({'where':{'id':_0x3ab092[_0xe591('0x52')]['id']},'attributes':[_0xe591('0x59'),'loginLogo',_0xe591('0x5f'),_0xe591('0x60'),'defaultLogo',_0xe591('0x62'),'defaultPreferred',_0xe591('0x64')],'raw':!![]});})[_0xe591('0x20')](handleEntityNotFound(_0x4eeed1,null))[_0xe591('0x20')](function(_0x3031fc){if(_0x3031fc){var _0xaf5c60=_0x3031fc[_0xe591('0x60')]&&fs['existsSync'](path[_0xe591('0x68')](config[_0xe591('0x66')],_0x5c6f89,_[_0xe591('0x67')](_0x3031fc[_0xe591('0x60')])))?path[_0xe591('0x68')](config[_0xe591('0x66')],_0x5c6f89,_[_0xe591('0x67')](_0x3031fc[_0xe591('0x60')])):path[_0xe591('0x68')](config[_0xe591('0x66')],_0x5c6f89,_[_0xe591('0x67')](_0xe591('0x77')));var _0x383967=_0xe591('0x72')+_[_0xe591('0x6a')]('favicon');if(_0x3031fc[_0x383967]||!_0x2737e2[_0xe591('0x6b')]){_0xaf5c60=path[_0xe591('0x68')](config[_0xe591('0x66')],_0x5c6f89,_[_0xe591('0x67')]('default_favicon.ico'));}if(!fs[_0xe591('0x65')](_0xaf5c60)){throw new db[(_0xe591('0x6c'))][(_0xe591('0x1d'))](_['upperFirst'](_0xe591('0x60'))+_0xe591('0x6d'));}return _0x4eeed1['download'](_0xaf5c60);}})[_0xe591('0x2a')](handleError(_0x4eeed1,null));}; \ No newline at end of file +var _0x3e49=['merge','options','where','count','includeAll','include','findAll','show','find','body','params','file','logo','filename','addLogoLogin','loginLogo','getLicense','preferred','favicon','defaultFavicon','existsSync','join','toLower','root','default','upperFirst','custom','Sequelize','download','getLogoLogin','defaultLogo','defaultPreferred','default_loginLogo.svg','\x20not\x20found','gdpr','securePassword','addPreferred','getPreferred','server/files/images/logos','defaultLoginLogo','default_preferred.png','../../config/license/util','getFavicon','default_favicon.ico','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../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','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','offset','limit','set','Content-Range','update','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick'];(function(_0x1b1cfe,_0x5c2482){var _0x59c388=function(_0x169dda){while(--_0x169dda){_0x1b1cfe['push'](_0x1b1cfe['shift']());}};_0x59c388(++_0x5c2482);}(_0x3e49,0x9f));var _0x93e4=function(_0x4c59a9,_0x3230da){_0x4c59a9=_0x4c59a9-0x0;var _0x32e8b3=_0x3e49[_0x4c59a9];return _0x32e8b3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x93e4('0x0'));var rimraf=require(_0x93e4('0x1'));var zipdir=require(_0x93e4('0x2'));var jsonpatch=require(_0x93e4('0x3'));var rp=require(_0x93e4('0x4'));var moment=require(_0x93e4('0x5'));var BPromise=require(_0x93e4('0x6'));var Mustache=require(_0x93e4('0x7'));var util=require(_0x93e4('0x8'));var path=require(_0x93e4('0x9'));var sox=require(_0x93e4('0xa'));var csv=require(_0x93e4('0xb'));var ejs=require(_0x93e4('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x93e4('0xd'));var crypto=require(_0x93e4('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x93e4('0xf'));var toCsv=require(_0x93e4('0xb'));var querystring=require('querystring');var Papa=require(_0x93e4('0x10'));var Redis=require(_0x93e4('0x11'));var authService=require(_0x93e4('0x12'));var qs=require(_0x93e4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x93e4('0x14'));var logger=require('../../config/logger')(_0x93e4('0x15'));var utils=require('../../config/utils');var config=require(_0x93e4('0x16'));var db=require(_0x93e4('0x17'))['db'];var jayson=require(_0x93e4('0x18'));var client=jayson[_0x93e4('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x4f7de8,_0x5e9718,_0x341062){if(_0x341062){var _0x2fe2a3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2fe2a3[_0x93e4('0x1a')](_0x5e9718)){return _0x4f7de8;}else{throw new db['Sequelize'][(_0x93e4('0x1b'))](_0x93e4('0x1c'));}}else{return _0x4f7de8;}}function respondWithRpcPromise(_0x3737da,_0x43f1f5,_0x4ce0d0,_0x2700a4){return new BPromise(function(_0x14c563,_0x1731e7){var _0x1c2027=_0x2700a4||client;return _0x1c2027[_0x93e4('0x1d')](_0x3737da,_0x4ce0d0)[_0x93e4('0x1e')](function(_0x3f5cb0){logger[_0x93e4('0x1f')](_0x93e4('0x20'),_0x43f1f5,_0x93e4('0x21'));logger[_0x93e4('0x22')](_0x93e4('0x23'),_0x43f1f5,_0x93e4('0x21'),JSON[_0x93e4('0x24')](_0x3f5cb0));if(_0x3f5cb0['error']){if(_0x3f5cb0[_0x93e4('0x25')][_0x93e4('0x26')]===0x1f4){logger[_0x93e4('0x25')](_0x93e4('0x20'),_0x43f1f5,_0x3f5cb0[_0x93e4('0x25')][_0x93e4('0x27')]);return _0x1731e7(_0x3f5cb0['error'][_0x93e4('0x27')]);}logger[_0x93e4('0x25')](_0x93e4('0x20'),_0x43f1f5,_0x3f5cb0[_0x93e4('0x25')][_0x93e4('0x27')]);return _0x14c563(_0x3f5cb0[_0x93e4('0x25')]['message']);}else{logger[_0x93e4('0x1f')]('Setting,\x20%s,\x20%s',_0x43f1f5,_0x93e4('0x21'));_0x14c563(_0x3f5cb0['result'][_0x93e4('0x27')]);}})[_0x93e4('0x28')](function(_0x3aa258){logger['error']('Setting,\x20%s,\x20%s',_0x43f1f5,_0x3aa258);_0x1731e7(_0x3aa258);});});}function respondWithStatusCode(_0x27e3d7,_0x5b01aa){_0x5b01aa=_0x5b01aa||0xcc;return function(_0x294add){if(_0x294add){return _0x27e3d7[_0x93e4('0x29')](_0x5b01aa);}return _0x27e3d7[_0x93e4('0x2a')](_0x5b01aa)[_0x93e4('0x2b')]();};}function respondWithResult(_0x6d3a92,_0x3de534){_0x3de534=_0x3de534||0xc8;return function(_0x45fb88){if(_0x45fb88){return _0x6d3a92['status'](_0x3de534)['json'](_0x45fb88);}};}function respondWithFilteredResult(_0x21736f,_0x3b92ad){return function(_0x153941){if(_0x153941){var _0x4a863b=_0x153941['count'],_0x198c50=_0x3b92ad[_0x93e4('0x2c')],_0x5e8964=_0x3b92ad[_0x93e4('0x2c')]+_0x3b92ad[_0x93e4('0x2d')],_0x4916a3;if(_0x5e8964>=_0x4a863b){_0x5e8964=_0x4a863b;_0x4916a3=0xc8;}else{_0x4916a3=0xce;}_0x21736f['status'](_0x4916a3);return _0x21736f[_0x93e4('0x2e')](_0x93e4('0x2f'),_0x198c50+'-'+_0x5e8964+'/'+_0x4a863b)['json'](_0x153941);}return null;};}function patchUpdates(_0x242db1){return function(_0x1796cf){try{jsonpatch['apply'](_0x1796cf,_0x242db1,!![]);}catch(_0x2d5007){return BPromise['reject'](_0x2d5007);}return _0x1796cf['save']();};}function saveUpdates(_0x10a3fe,_0x23fb23){return function(_0x144b5e){if(_0x144b5e){return _0x144b5e[_0x93e4('0x30')](_0x10a3fe)[_0x93e4('0x1e')](function(_0x97a711){return _0x97a711;});}return null;};}function removeEntity(_0x34784b,_0x38af47){return function(_0x553a4d){if(_0x553a4d){return _0x553a4d['destroy']()[_0x93e4('0x1e')](function(){_0x34784b['status'](0xcc)[_0x93e4('0x2b')]();});}};}function handleEntityNotFound(_0x36bd59,_0x3f58e2){return function(_0xdec847){if(!_0xdec847){_0x36bd59[_0x93e4('0x29')](0x194);}return _0xdec847;};}function handleError(_0x420aa6,_0x1b25ba){_0x1b25ba=_0x1b25ba||0x1f4;return function(_0x5e076a){logger['error'](_0x5e076a[_0x93e4('0x31')]);if(_0x5e076a[_0x93e4('0x32')]){delete _0x5e076a[_0x93e4('0x32')];}_0x420aa6['status'](_0x1b25ba)[_0x93e4('0x33')](_0x5e076a);};}exports[_0x93e4('0x34')]=function(_0x50b25e,_0x171cbb){var _0x36767e={},_0x4bfbc0={},_0x292d2a={'count':0x0,'rows':[]};var _0x2d4e76=_[_0x93e4('0x35')](db[_0x93e4('0x36')][_0x93e4('0x37')],function(_0x3d5d11){return{'name':_0x3d5d11[_0x93e4('0x38')],'type':_0x3d5d11[_0x93e4('0x39')][_0x93e4('0x3a')]};});_0x4bfbc0[_0x93e4('0x3b')]=_[_0x93e4('0x35')](_0x2d4e76,_0x93e4('0x32'));_0x4bfbc0[_0x93e4('0x3c')]=_[_0x93e4('0x3d')](_0x50b25e['query']);_0x4bfbc0['filters']=_[_0x93e4('0x3e')](_0x4bfbc0[_0x93e4('0x3b')],_0x4bfbc0[_0x93e4('0x3c')]);_0x36767e[_0x93e4('0x3f')]=_[_0x93e4('0x3e')](_0x4bfbc0[_0x93e4('0x3b')],qs['fields'](_0x50b25e[_0x93e4('0x3c')][_0x93e4('0x40')]));_0x36767e[_0x93e4('0x3f')]=_0x36767e['attributes'][_0x93e4('0x41')]?_0x36767e['attributes']:_0x4bfbc0['model'];if(!_0x50b25e[_0x93e4('0x3c')]['hasOwnProperty'](_0x93e4('0x42'))){_0x36767e[_0x93e4('0x2d')]=qs[_0x93e4('0x2d')](_0x50b25e['query']['limit']);_0x36767e[_0x93e4('0x2c')]=qs[_0x93e4('0x2c')](_0x50b25e[_0x93e4('0x3c')]['offset']);}_0x36767e[_0x93e4('0x43')]=qs[_0x93e4('0x44')](_0x50b25e[_0x93e4('0x3c')][_0x93e4('0x44')]);_0x36767e['where']=qs[_0x93e4('0x45')](_[_0x93e4('0x46')](_0x50b25e[_0x93e4('0x3c')],_0x4bfbc0[_0x93e4('0x45')]),_0x2d4e76);if(_0x50b25e['query']['filter']){_0x36767e['where']=_[_0x93e4('0x47')](_0x36767e['where'],{'$or':_[_0x93e4('0x35')](_0x2d4e76,function(_0x2b324d){if(_0x2b324d['type']!=='VIRTUAL'){var _0x13bbc2={};_0x13bbc2[_0x2b324d[_0x93e4('0x32')]]={'$like':'%'+_0x50b25e['query']['filter']+'%'};return _0x13bbc2;}})});}_0x36767e=_['merge']({},_0x36767e,_0x50b25e[_0x93e4('0x48')]);var _0x26230b={'where':_0x36767e[_0x93e4('0x49')]};return db[_0x93e4('0x36')][_0x93e4('0x4a')](_0x26230b)['then'](function(_0x4af198){_0x292d2a[_0x93e4('0x4a')]=_0x4af198;if(_0x50b25e[_0x93e4('0x3c')][_0x93e4('0x4b')]){_0x36767e[_0x93e4('0x4c')]=[{'all':!![]}];}return db[_0x93e4('0x36')][_0x93e4('0x4d')](_0x36767e);})[_0x93e4('0x1e')](function(_0x3b0aa5){_0x292d2a['rows']=_0x3b0aa5;return _0x292d2a;})[_0x93e4('0x1e')](respondWithFilteredResult(_0x171cbb,_0x36767e))[_0x93e4('0x28')](handleError(_0x171cbb,null));};exports[_0x93e4('0x4e')]=function(_0x2537ac,_0xe452d2){var _0x3599a9={'raw':![],'where':{'id':_0x2537ac['params']['id']}},_0x52b05b={};_0x52b05b['model']=_['keys'](db[_0x93e4('0x36')][_0x93e4('0x37')]);_0x52b05b['query']=_[_0x93e4('0x3d')](_0x2537ac[_0x93e4('0x3c')]);_0x52b05b['filters']=_['intersection'](_0x52b05b[_0x93e4('0x3b')],_0x52b05b[_0x93e4('0x3c')]);_0x3599a9[_0x93e4('0x3f')]=_['intersection'](_0x52b05b[_0x93e4('0x3b')],qs[_0x93e4('0x40')](_0x2537ac[_0x93e4('0x3c')][_0x93e4('0x40')]));_0x3599a9[_0x93e4('0x3f')]=_0x3599a9[_0x93e4('0x3f')]['length']?_0x3599a9[_0x93e4('0x3f')]:_0x52b05b[_0x93e4('0x3b')];if(_0x2537ac[_0x93e4('0x3c')][_0x93e4('0x4b')]){_0x3599a9['include']=[{'all':!![]}];}_0x3599a9=_[_0x93e4('0x47')]({},_0x3599a9,_0x2537ac[_0x93e4('0x48')]);return db[_0x93e4('0x36')][_0x93e4('0x4f')](_0x3599a9)[_0x93e4('0x1e')](handleEntityNotFound(_0xe452d2,null))[_0x93e4('0x1e')](respondWithResult(_0xe452d2,null))[_0x93e4('0x28')](handleError(_0xe452d2,null));};exports[_0x93e4('0x30')]=function(_0x42d032,_0x11d35c){if(_0x42d032[_0x93e4('0x50')]['id']){delete _0x42d032['body']['id'];}return db[_0x93e4('0x36')][_0x93e4('0x4f')]({'where':{'id':_0x42d032[_0x93e4('0x51')]['id']}})[_0x93e4('0x1e')](handleEntityNotFound(_0x11d35c,null))['then'](saveUpdates(_0x42d032['body'],null))['then'](respondWithResult(_0x11d35c,null))[_0x93e4('0x28')](handleError(_0x11d35c,null));};exports['addLogo']=function(_0x11acf7,_0x9ca10c,_0x41b5f0){if(_0x11acf7[_0x93e4('0x52')]&&_0x11acf7[_0x93e4('0x52')]['filename']){_0x11acf7[_0x93e4('0x50')][_0x93e4('0x53')]=_0x11acf7[_0x93e4('0x52')][_0x93e4('0x54')];}return db[_0x93e4('0x36')][_0x93e4('0x4f')]({'where':{'id':_0x11acf7[_0x93e4('0x51')]['id']}})[_0x93e4('0x1e')](handleEntityNotFound(_0x9ca10c,null))[_0x93e4('0x1e')](saveUpdates(_0x11acf7['body'],null))[_0x93e4('0x1e')](respondWithResult(_0x9ca10c,null))[_0x93e4('0x28')](handleError(_0x9ca10c,null));};exports[_0x93e4('0x55')]=function(_0x115873,_0x3ae53c,_0x1f92c6){if(_0x115873[_0x93e4('0x52')]&&_0x115873[_0x93e4('0x52')][_0x93e4('0x54')]){_0x115873['body'][_0x93e4('0x56')]=_0x115873[_0x93e4('0x52')][_0x93e4('0x54')];}return db[_0x93e4('0x36')][_0x93e4('0x4f')]({'where':{'id':_0x115873[_0x93e4('0x51')]['id']}})['then'](handleEntityNotFound(_0x3ae53c,null))['then'](saveUpdates(_0x115873[_0x93e4('0x50')],null))[_0x93e4('0x1e')](respondWithResult(_0x3ae53c,null))[_0x93e4('0x28')](handleError(_0x3ae53c,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x573b87,_0x2f6730,_0x2e55c7){var _0x39557a='server/files/images/logos';var _0xd90ace={'custom':![]};return utilLicense[_0x93e4('0x57')]()[_0x93e4('0x1e')](function(_0x44c237){if(_0x44c237){_0xd90ace=_0x44c237;}return db[_0x93e4('0x36')]['find']({'where':{'id':_0x573b87['params']['id']},'attributes':[_0x93e4('0x53'),_0x93e4('0x56'),_0x93e4('0x58'),_0x93e4('0x59'),'defaultLogo','defaultLoginLogo','defaultPreferred',_0x93e4('0x5a')],'raw':!![]});})[_0x93e4('0x1e')](handleEntityNotFound(_0x2f6730,null))[_0x93e4('0x1e')](function(_0x1d8570){if(_0x1d8570){var _0x487ec2=_0x1d8570[_0x93e4('0x53')]&&fs[_0x93e4('0x5b')](path[_0x93e4('0x5c')](config['root'],_0x39557a,_[_0x93e4('0x5d')](_0x1d8570[_0x93e4('0x53')])))?path[_0x93e4('0x5c')](config[_0x93e4('0x5e')],_0x39557a,_[_0x93e4('0x5d')](_0x1d8570[_0x93e4('0x53')])):path[_0x93e4('0x5c')](config[_0x93e4('0x5e')],_0x39557a,_[_0x93e4('0x5d')]('default_logo.svg'));var _0x29e50a=_0x93e4('0x5f')+_[_0x93e4('0x60')]('logo');if(_0x1d8570[_0x29e50a]||!_0xd90ace[_0x93e4('0x61')]){_0x487ec2=path['join'](config[_0x93e4('0x5e')],_0x39557a,_['toLower']('default_logo.svg'));}if(!fs['existsSync'](_0x487ec2)){throw new db[(_0x93e4('0x62'))]['ValidationError'](_[_0x93e4('0x60')]('logo')+'\x20not\x20found');}return _0x2f6730[_0x93e4('0x63')](_0x487ec2);}})[_0x93e4('0x28')](handleError(_0x2f6730,null));};var utilLicense=require('../../config/license/util');exports[_0x93e4('0x64')]=function(_0x455b60,_0xcb939a,_0x241067){var _0x45e906='server/files/images/logos';var _0x34320d={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x5025c5){if(_0x5025c5){_0x34320d=_0x5025c5;}return db[_0x93e4('0x36')][_0x93e4('0x4f')]({'where':{'id':_0x455b60[_0x93e4('0x51')]['id']},'attributes':[_0x93e4('0x53'),'loginLogo','preferred',_0x93e4('0x59'),_0x93e4('0x65'),'defaultLoginLogo',_0x93e4('0x66'),_0x93e4('0x5a')],'raw':!![]});})['then'](handleEntityNotFound(_0xcb939a,null))[_0x93e4('0x1e')](function(_0x1464d3){if(_0x1464d3){var _0x5e71a8=_0x1464d3[_0x93e4('0x56')]&&fs[_0x93e4('0x5b')](path['join'](config[_0x93e4('0x5e')],_0x45e906,_[_0x93e4('0x5d')](_0x1464d3[_0x93e4('0x56')])))?path[_0x93e4('0x5c')](config[_0x93e4('0x5e')],_0x45e906,_['toLower'](_0x1464d3['loginLogo'])):path[_0x93e4('0x5c')](config['root'],_0x45e906,_[_0x93e4('0x5d')](_0x93e4('0x67')));var _0x27f437='default'+_[_0x93e4('0x60')](_0x93e4('0x56'));if(_0x1464d3[_0x27f437]||!_0x34320d[_0x93e4('0x61')]){_0x5e71a8=path[_0x93e4('0x5c')](config[_0x93e4('0x5e')],_0x45e906,_['toLower'](_0x93e4('0x67')));}if(!fs[_0x93e4('0x5b')](_0x5e71a8)){throw new db[(_0x93e4('0x62'))][(_0x93e4('0x1b'))](_[_0x93e4('0x60')](_0x93e4('0x56'))+_0x93e4('0x68'));}return _0xcb939a[_0x93e4('0x63')](_0x5e71a8);}})[_0x93e4('0x28')](handleError(_0xcb939a,null));};exports[_0x93e4('0x69')]=function(_0x2ac244,_0x2ec879){return db[_0x93e4('0x36')][_0x93e4('0x4f')]({'where':{'id':_0x2ac244[_0x93e4('0x51')]['id']},'attributes':[_0x93e4('0x6a')]})[_0x93e4('0x1e')](respondWithResult(_0x2ec879,null))['catch'](handleError(_0x2ec879,null));};exports[_0x93e4('0x6b')]=function(_0x1536d2,_0x42ef3c,_0x2b2eda){if(_0x1536d2[_0x93e4('0x52')]&&_0x1536d2[_0x93e4('0x52')][_0x93e4('0x54')]){_0x1536d2[_0x93e4('0x50')][_0x93e4('0x58')]=_0x1536d2['file'][_0x93e4('0x54')];}return db['Setting'][_0x93e4('0x4f')]({'where':{'id':_0x1536d2[_0x93e4('0x51')]['id']}})[_0x93e4('0x1e')](handleEntityNotFound(_0x42ef3c,null))[_0x93e4('0x1e')](saveUpdates(_0x1536d2[_0x93e4('0x50')],null))[_0x93e4('0x1e')](respondWithResult(_0x42ef3c,null))['catch'](handleError(_0x42ef3c,null));};var utilLicense=require('../../config/license/util');exports[_0x93e4('0x6c')]=function(_0x332835,_0x55bc0c,_0x3b7e5d){var _0x24789c=_0x93e4('0x6d');var _0x3445d3={'custom':![]};return utilLicense[_0x93e4('0x57')]()[_0x93e4('0x1e')](function(_0x57d976){if(_0x57d976){_0x3445d3=_0x57d976;}return db[_0x93e4('0x36')][_0x93e4('0x4f')]({'where':{'id':_0x332835[_0x93e4('0x51')]['id']},'attributes':['logo',_0x93e4('0x56'),_0x93e4('0x58'),_0x93e4('0x59'),'defaultLogo',_0x93e4('0x6e'),_0x93e4('0x66'),'defaultFavicon'],'raw':!![]});})[_0x93e4('0x1e')](handleEntityNotFound(_0x55bc0c,null))[_0x93e4('0x1e')](function(_0x5dc5cb){if(_0x5dc5cb){var _0x1306f8=_0x5dc5cb[_0x93e4('0x58')]&&fs['existsSync'](path['join'](config[_0x93e4('0x5e')],_0x24789c,_[_0x93e4('0x5d')](_0x5dc5cb[_0x93e4('0x58')])))?path['join'](config[_0x93e4('0x5e')],_0x24789c,_[_0x93e4('0x5d')](_0x5dc5cb[_0x93e4('0x58')])):path[_0x93e4('0x5c')](config[_0x93e4('0x5e')],_0x24789c,_['toLower']('default_preferred.png'));var _0x331415='default'+_['upperFirst'](_0x93e4('0x58'));if(_0x5dc5cb[_0x331415]||!_0x3445d3[_0x93e4('0x61')]||!_0x3445d3[_0x93e4('0x58')]){_0x1306f8=path[_0x93e4('0x5c')](config[_0x93e4('0x5e')],_0x24789c,_[_0x93e4('0x5d')](_0x93e4('0x6f')));}if(!fs[_0x93e4('0x5b')](_0x1306f8)){throw new db[(_0x93e4('0x62'))][(_0x93e4('0x1b'))](_[_0x93e4('0x60')](_0x93e4('0x58'))+_0x93e4('0x68'));}return _0x55bc0c[_0x93e4('0x63')](_0x1306f8);}})[_0x93e4('0x28')](handleError(_0x55bc0c,null));};exports['addFavicon']=function(_0x43e95e,_0x35b039,_0x3a5b48){if(_0x43e95e['file']&&_0x43e95e[_0x93e4('0x52')][_0x93e4('0x54')]){_0x43e95e[_0x93e4('0x50')]['favicon']=_0x43e95e[_0x93e4('0x52')][_0x93e4('0x54')];}return db[_0x93e4('0x36')][_0x93e4('0x4f')]({'where':{'id':_0x43e95e[_0x93e4('0x51')]['id']}})['then'](handleEntityNotFound(_0x35b039,null))['then'](saveUpdates(_0x43e95e[_0x93e4('0x50')],null))['then'](respondWithResult(_0x35b039,null))[_0x93e4('0x28')](handleError(_0x35b039,null));};var utilLicense=require(_0x93e4('0x70'));exports[_0x93e4('0x71')]=function(_0xd75c90,_0xcd7435,_0x3c0834){var _0x391f21='server/files/images/logos';var _0x643b27={'custom':![]};return utilLicense['getLicense']()[_0x93e4('0x1e')](function(_0x3ba016){if(_0x3ba016){_0x643b27=_0x3ba016;}return db[_0x93e4('0x36')][_0x93e4('0x4f')]({'where':{'id':_0xd75c90[_0x93e4('0x51')]['id']},'attributes':['logo','loginLogo',_0x93e4('0x58'),_0x93e4('0x59'),_0x93e4('0x65'),_0x93e4('0x6e'),'defaultPreferred',_0x93e4('0x5a')],'raw':!![]});})[_0x93e4('0x1e')](handleEntityNotFound(_0xcd7435,null))['then'](function(_0x4d9610){if(_0x4d9610){var _0x3cec8e=_0x4d9610['favicon']&&fs['existsSync'](path['join'](config[_0x93e4('0x5e')],_0x391f21,_[_0x93e4('0x5d')](_0x4d9610[_0x93e4('0x59')])))?path[_0x93e4('0x5c')](config[_0x93e4('0x5e')],_0x391f21,_[_0x93e4('0x5d')](_0x4d9610['favicon'])):path[_0x93e4('0x5c')](config['root'],_0x391f21,_['toLower'](_0x93e4('0x72')));var _0x157fde=_0x93e4('0x5f')+_[_0x93e4('0x60')](_0x93e4('0x59'));if(_0x4d9610[_0x157fde]||!_0x643b27['custom']){_0x3cec8e=path['join'](config[_0x93e4('0x5e')],_0x391f21,_[_0x93e4('0x5d')](_0x93e4('0x72')));}if(!fs[_0x93e4('0x5b')](_0x3cec8e)){throw new db['Sequelize'][(_0x93e4('0x1b'))](_[_0x93e4('0x60')]('favicon')+_0x93e4('0x68'));}return _0xcd7435[_0x93e4('0x63')](_0x3cec8e);}})[_0x93e4('0x28')](handleError(_0xcd7435,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index c32b730..a6470a5 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 _0x7a4f=['rimraf','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4207a6,_0x3a3110){var _0x42b37a=function(_0x574360){while(--_0x574360){_0x4207a6['push'](_0x4207a6['shift']());}};_0x42b37a(++_0x3a3110);}(_0x7a4f,0x179));var _0xf7a4=function(_0x109e39,_0x27f91c){_0x109e39=_0x109e39-0x0;var _0x3b142f=_0x7a4f[_0x109e39];return _0x3b142f;};'use strict';var _=require(_0xf7a4('0x0'));var util=require('util');var logger=require(_0xf7a4('0x1'))(_0xf7a4('0x2'));var moment=require(_0xf7a4('0x3'));var BPromise=require(_0xf7a4('0x4'));var rp=require(_0xf7a4('0x5'));var fs=require('fs');var path=require(_0xf7a4('0x6'));var rimraf=require(_0xf7a4('0x7'));var config=require('../../config/environment');var attributes=require('./setting.attributes');module[_0xf7a4('0x8')]=function(_0x2f603d,_0xe41c72){return _0x2f603d[_0xf7a4('0x9')](_0xf7a4('0xa'),attributes,{'tableName':_0xf7a4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x423c=['define','Setting','settings','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x423c,0x15f));var _0xc423=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x423c[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0xc423('0x0'));var util=require('util');var logger=require(_0xc423('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc423('0x2'));var rp=require(_0xc423('0x3'));var fs=require('fs');var path=require(_0xc423('0x4'));var rimraf=require(_0xc423('0x5'));var config=require(_0xc423('0x6'));var attributes=require(_0xc423('0x7'));module[_0xc423('0x8')]=function(_0x441400,_0x2da068){return _0x441400[_0xc423('0x9')](_0xc423('0xa'),attributes,{'tableName':_0xc423('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 3a6030d..bfb510e 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 _0xc233=['request','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','Setting,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0xc233,0x1c0));var _0x3c23=function(_0xabbd2f,_0x44d05a){_0xabbd2f=_0xabbd2f-0x0;var _0x34a040=_0xc233[_0xabbd2f];return _0x34a040;};'use strict';var _=require(_0x3c23('0x0'));var util=require(_0x3c23('0x1'));var moment=require(_0x3c23('0x2'));var BPromise=require(_0x3c23('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c23('0x4'));var db=require(_0x3c23('0x5'))['db'];var utils=require(_0x3c23('0x6'));var logger=require(_0x3c23('0x7'))(_0x3c23('0x8'));var config=require(_0x3c23('0x9'));var jayson=require(_0x3c23('0xa'));var client=jayson[_0x3c23('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2af032,_0x49bbe0,_0x6cc614){return new BPromise(function(_0x82f4dc,_0x335155){return client[_0x3c23('0xc')](_0x2af032,_0x6cc614)[_0x3c23('0xd')](function(_0xd5bfe7){logger['info']('Setting,\x20%s,\x20%s',_0x49bbe0,_0x3c23('0xe'));logger[_0x3c23('0xf')](_0x3c23('0x10'),_0x49bbe0,_0x3c23('0xe'),JSON['stringify'](_0xd5bfe7));if(_0xd5bfe7[_0x3c23('0x11')]){if(_0xd5bfe7['error']['code']===0x1f4){logger[_0x3c23('0x11')](_0x3c23('0x12'),_0x49bbe0,_0xd5bfe7[_0x3c23('0x11')][_0x3c23('0x13')]);return _0x335155(_0xd5bfe7[_0x3c23('0x11')][_0x3c23('0x13')]);}logger[_0x3c23('0x11')](_0x3c23('0x12'),_0x49bbe0,_0xd5bfe7[_0x3c23('0x11')]['message']);return _0x82f4dc(_0xd5bfe7['error'][_0x3c23('0x13')]);}else{logger[_0x3c23('0x14')](_0x3c23('0x12'),_0x49bbe0,_0x3c23('0xe'));_0x82f4dc(_0xd5bfe7[_0x3c23('0x15')][_0x3c23('0x13')]);}})[_0x3c23('0x16')](function(_0x7f43a4){logger['error'](_0x3c23('0x12'),_0x49bbe0,_0x7f43a4);_0x335155(_0x7f43a4);});});} \ No newline at end of file +var _0xb1d5=['debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xb1d5,0x149));var _0x5b1d=function(_0x5d09d9,_0x181abf){_0x5d09d9=_0x5d09d9-0x0;var _0x7ce182=_0xb1d5[_0x5d09d9];return _0x7ce182;};'use strict';var _=require(_0x5b1d('0x0'));var util=require(_0x5b1d('0x1'));var moment=require(_0x5b1d('0x2'));var BPromise=require(_0x5b1d('0x3'));var rs=require(_0x5b1d('0x4'));var fs=require('fs');var Redis=require(_0x5b1d('0x5'));var db=require(_0x5b1d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b1d('0x7'))(_0x5b1d('0x8'));var config=require('../../config/environment');var jayson=require(_0x5b1d('0x9'));var client=jayson[_0x5b1d('0xa')][_0x5b1d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x655273,_0xea9133,_0x57990f){return new BPromise(function(_0x62537c,_0xdf6515){return client[_0x5b1d('0xc')](_0x655273,_0x57990f)['then'](function(_0x167c43){logger[_0x5b1d('0xd')](_0x5b1d('0xe'),_0xea9133,_0x5b1d('0xf'));logger[_0x5b1d('0x10')](_0x5b1d('0x11'),_0xea9133,_0x5b1d('0xf'),JSON[_0x5b1d('0x12')](_0x167c43));if(_0x167c43['error']){if(_0x167c43[_0x5b1d('0x13')]['code']===0x1f4){logger[_0x5b1d('0x13')](_0x5b1d('0xe'),_0xea9133,_0x167c43[_0x5b1d('0x13')][_0x5b1d('0x14')]);return _0xdf6515(_0x167c43[_0x5b1d('0x13')]['message']);}logger['error'](_0x5b1d('0xe'),_0xea9133,_0x167c43[_0x5b1d('0x13')][_0x5b1d('0x14')]);return _0x62537c(_0x167c43[_0x5b1d('0x13')][_0x5b1d('0x14')]);}else{logger[_0x5b1d('0xd')](_0x5b1d('0xe'),_0xea9133,_0x5b1d('0xf'));_0x62537c(_0x167c43[_0x5b1d('0x15')][_0x5b1d('0x14')]);}})[_0x5b1d('0x16')](function(_0x3a9274){logger[_0x5b1d('0x13')](_0x5b1d('0xe'),_0xea9133,_0x3a9274);_0xdf6515(_0x3a9274);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 8536bd8..35870b5 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 _0xc701=['getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/status','statusGet','/:id/users','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','addAgents','put','/:id','delete','destroy','removeDispositions','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','isAuthenticated','index','get','/describe','/:id/dispositions','/:id/canned_answers'];(function(_0x591b0d,_0xa34ef2){var _0x58ac3e=function(_0x104dd6){while(--_0x104dd6){_0x591b0d['push'](_0x591b0d['shift']());}};_0x58ac3e(++_0xa34ef2);}(_0xc701,0x19e));var _0x1c70=function(_0xe9fdc4,_0x1cc454){_0xe9fdc4=_0xe9fdc4-0x0;var _0x529cdd=_0xc701[_0xe9fdc4];return _0x529cdd;};'use strict';var multer=require('multer');var util=require(_0x1c70('0x0'));var path=require(_0x1c70('0x1'));var timeout=require(_0x1c70('0x2'));var express=require(_0x1c70('0x3'));var router=express[_0x1c70('0x4')]();var auth=require(_0x1c70('0x5'));var interaction=require(_0x1c70('0x6'));var config=require(_0x1c70('0x7'));var controller=require(_0x1c70('0x8'));router['get']('/',auth[_0x1c70('0x9')](),controller[_0x1c70('0xa')]);router[_0x1c70('0xb')](_0x1c70('0xc'),auth[_0x1c70('0x9')](),controller['describe']);router[_0x1c70('0xb')]('/:id',auth[_0x1c70('0x9')](),controller['show']);router[_0x1c70('0xb')](_0x1c70('0xd'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x1c70('0xb')](_0x1c70('0xe'),auth[_0x1c70('0x9')](),controller[_0x1c70('0xf')]);router[_0x1c70('0xb')](_0x1c70('0x10'),auth['isAuthenticated'](),controller[_0x1c70('0x11')]);router[_0x1c70('0xb')](_0x1c70('0x12'),auth[_0x1c70('0x9')](),controller['getInteractions']);router[_0x1c70('0xb')](_0x1c70('0x13'),controller[_0x1c70('0x14')]);router[_0x1c70('0xb')](_0x1c70('0x15'),auth[_0x1c70('0x9')](),controller['getAgents']);router[_0x1c70('0x16')]('/',auth['isAuthenticated'](),controller[_0x1c70('0x17')]);router['post'](_0x1c70('0xd'),auth[_0x1c70('0x9')](),controller[_0x1c70('0x18')]);router[_0x1c70('0x16')](_0x1c70('0xe'),auth['isAuthenticated'](),controller[_0x1c70('0x19')]);router['post'](_0x1c70('0x1a'),controller[_0x1c70('0x1b')]);router[_0x1c70('0x16')](_0x1c70('0x10'),auth[_0x1c70('0x9')](),controller[_0x1c70('0x1c')]);router[_0x1c70('0x16')](_0x1c70('0x1d'),auth[_0x1c70('0x9')](),controller[_0x1c70('0x1e')]);router[_0x1c70('0x16')](_0x1c70('0x13'),controller['status']);router[_0x1c70('0x16')](_0x1c70('0x15'),auth[_0x1c70('0x9')](),controller[_0x1c70('0x1f')]);router[_0x1c70('0x20')](_0x1c70('0x21'),auth[_0x1c70('0x9')](),controller['update']);router[_0x1c70('0x22')](_0x1c70('0x21'),auth[_0x1c70('0x9')](),controller[_0x1c70('0x23')]);router[_0x1c70('0x22')](_0x1c70('0xd'),auth[_0x1c70('0x9')](),controller[_0x1c70('0x24')]);router[_0x1c70('0x22')]('/:id/canned_answers',auth[_0x1c70('0x9')](),controller['removeAnswers']);router[_0x1c70('0x22')](_0x1c70('0x15'),auth[_0x1c70('0x9')](),controller[_0x1c70('0x25')]);module[_0x1c70('0x26')]=router; \ No newline at end of file +var _0xda09=['/:id/status','statusGet','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','/:id/send','send','status','/:id/users','addAgents','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/applications','/:id/interactions','getInteractions'];(function(_0x1650c6,_0x1d4b99){var _0x2b1d76=function(_0x1e1177){while(--_0x1e1177){_0x1650c6['push'](_0x1650c6['shift']());}};_0x2b1d76(++_0x1d4b99);}(_0xda09,0xff));var _0x9da0=function(_0x372aa9,_0x578986){_0x372aa9=_0x372aa9-0x0;var _0x55b1c2=_0xda09[_0x372aa9];return _0x55b1c2;};'use strict';var multer=require(_0x9da0('0x0'));var util=require('util');var path=require(_0x9da0('0x1'));var timeout=require(_0x9da0('0x2'));var express=require(_0x9da0('0x3'));var router=express['Router']();var auth=require(_0x9da0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9da0('0x5'));var controller=require('./smsAccount.controller');router[_0x9da0('0x6')]('/',auth['isAuthenticated'](),controller[_0x9da0('0x7')]);router['get'](_0x9da0('0x8'),auth[_0x9da0('0x9')](),controller[_0x9da0('0xa')]);router[_0x9da0('0x6')](_0x9da0('0xb'),auth[_0x9da0('0x9')](),controller['show']);router[_0x9da0('0x6')](_0x9da0('0xc'),auth[_0x9da0('0x9')](),controller[_0x9da0('0xd')]);router[_0x9da0('0x6')]('/:id/canned_answers',auth[_0x9da0('0x9')](),controller[_0x9da0('0xe')]);router[_0x9da0('0x6')](_0x9da0('0xf'),auth[_0x9da0('0x9')](),controller['getApplications']);router[_0x9da0('0x6')](_0x9da0('0x10'),auth[_0x9da0('0x9')](),controller[_0x9da0('0x11')]);router[_0x9da0('0x6')](_0x9da0('0x12'),controller[_0x9da0('0x13')]);router[_0x9da0('0x6')]('/:id/users',auth[_0x9da0('0x9')](),controller[_0x9da0('0x14')]);router[_0x9da0('0x15')]('/',auth[_0x9da0('0x9')](),controller[_0x9da0('0x16')]);router[_0x9da0('0x15')](_0x9da0('0xc'),auth[_0x9da0('0x9')](),controller[_0x9da0('0x17')]);router['post'](_0x9da0('0x18'),auth['isAuthenticated'](),controller[_0x9da0('0x19')]);router[_0x9da0('0x15')](_0x9da0('0x1a'),controller[_0x9da0('0x1b')]);router[_0x9da0('0x15')](_0x9da0('0xf'),auth[_0x9da0('0x9')](),controller['addApplications']);router[_0x9da0('0x15')](_0x9da0('0x1c'),auth[_0x9da0('0x9')](),controller[_0x9da0('0x1d')]);router[_0x9da0('0x15')](_0x9da0('0x12'),controller[_0x9da0('0x1e')]);router[_0x9da0('0x15')](_0x9da0('0x1f'),auth[_0x9da0('0x9')](),controller[_0x9da0('0x20')]);router['put'](_0x9da0('0xb'),auth[_0x9da0('0x9')](),controller[_0x9da0('0x21')]);router[_0x9da0('0x22')](_0x9da0('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0x9da0('0x22')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x9da0('0x23')]);router[_0x9da0('0x22')]('/:id/canned_answers',auth[_0x9da0('0x9')](),controller[_0x9da0('0x24')]);router['delete'](_0x9da0('0x1f'),auth[_0x9da0('0x9')](),controller[_0x9da0('0x25')]);module[_0x9da0('0x26')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index a9456c0..38cfc7a 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 _0x30cd=['twilio','skebby','clicksend','plivo','clickatell','csc','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM'];(function(_0x116a23,_0xe53a90){var _0x27186e=function(_0x10cdbe){while(--_0x10cdbe){_0x116a23['push'](_0x116a23['shift']());}};_0x27186e(++_0xe53a90);}(_0x30cd,0x126));var _0xd30c=function(_0x453536,_0x46622b){_0x453536=_0x453536-0x0;var _0x252fb0=_0x30cd[_0x453536];return _0x252fb0;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xd30c('0x0'));module[_0xd30c('0x1')]={'name':{'type':Sequelize[_0xd30c('0x2')],'unique':_0xd30c('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xd30c('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xd30c('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xd30c('0x2')],'defaultValue':function(){return rs[_0xd30c('0x4')]();}},'phone':{'type':Sequelize[_0xd30c('0x2')]},'type':{'type':Sequelize[_0xd30c('0x5')](_0xd30c('0x6'),_0xd30c('0x7'),'connectel',_0xd30c('0x8'),_0xd30c('0x9'),_0xd30c('0xa'),_0xd30c('0xb'),'infobip',_0xd30c('0xc'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xd30c('0x2')]},'authToken':{'type':Sequelize[_0xd30c('0x2')]},'smsMethod':{'type':Sequelize[_0xd30c('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xd30c('0x2')]},'password':{'type':Sequelize[_0xd30c('0x2')]},'apiKey':{'type':Sequelize[_0xd30c('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xd30c('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0xd30c('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xd30c('0xe');}},'notificationSound':{'type':Sequelize[_0xd30c('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd30c('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd30c('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd30c('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd30c('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd30c('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xd30c('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd30c('0xf')],'comment':_0xd30c('0x10')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xd30c('0x11'),'set':function(_0x525408){if(!_0x525408)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xd30c('0x12')](_0xd30c('0x13'),_0x525408);}}}; \ No newline at end of file +var _0xff76=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','skebby','connectel','clicksend','clickatell','infobip','intelepeer','TEXT'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0xff76,0x1d3));var _0x6ff7=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xff76[_0x173d7e];return _0x2220d6;};'use strict';var Sequelize=require(_0x6ff7('0x0'));var rs=require(_0x6ff7('0x1'));module[_0x6ff7('0x2')]={'name':{'type':Sequelize[_0x6ff7('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x6ff7('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x6ff7('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6ff7('0x5')]('twilio',_0x6ff7('0x6'),_0x6ff7('0x7'),_0x6ff7('0x8'),'plivo',_0x6ff7('0x9'),'csc',_0x6ff7('0xa'),_0x6ff7('0xb'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x6ff7('0x3')]},'authToken':{'type':Sequelize[_0x6ff7('0x3')]},'smsMethod':{'type':Sequelize[_0x6ff7('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x6ff7('0x3')]},'password':{'type':Sequelize[_0x6ff7('0x3')]},'apiKey':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x6ff7('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x6ff7('0x3')]},'notificationTemplate':{'type':Sequelize[_0x6ff7('0xc')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6ff7('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6ff7('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6ff7('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6ff7('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6ff7('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6ff7('0xe')],'comment':_0x6ff7('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x6ff7('0xd')],'defaultValue':![],'comment':_0x6ff7('0x10'),'set':function(_0x1f4d10){if(!_0x1f4d10)this[_0x6ff7('0x11')](_0x6ff7('0x12'),null);this[_0x6ff7('0x11')](_0x6ff7('0x13'),_0x1f4d10);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index d8fd478..c9c0b3c 100644 --- a/server/api/smsAccount/smsAccount.controller.js +++ b/server/api/smsAccount/smsAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['show','params','fields','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','sort','pick','rows','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','account','applications','orderBy','Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','list','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','debug','entity\x20found','stringify','Content-Type','text/xml','addApplications','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','DESC','dataValues','Messages','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','intelepeer','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','test','ValidationError','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','apply','save','destroy','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','limit','order','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x42f270,_0x452dec){var _0x57bc5b=function(_0x258159){while(--_0x258159){_0x42f270['push'](_0x42f270['shift']());}};_0x57bc5b(++_0x452dec);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x7995('0x1e'));var client=jayson[_0x7995('0x1f')][_0x7995('0x20')]({'port':0x232c});function checkPasswordPattern(_0x321ae8,_0x3f1d3e,_0x1a5310){if(_0x1a5310){var _0x2202ce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2202ce[_0x7995('0x21')](_0x3f1d3e)){return _0x321ae8;}else{throw new db['Sequelize'][(_0x7995('0x22'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x321ae8;}}function respondWithRpcPromise(_0x2f832e,_0x37f297,_0x43d4b8,_0x291317){return new BPromise(function(_0x1e1415,_0x37a7d4){var _0x4faa60=_0x291317||client;return _0x4faa60['request'](_0x2f832e,_0x43d4b8)[_0x7995('0x23')](function(_0x5e6f90){logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));logger['debug'](_0x7995('0x26'),_0x37f297,'request\x20sent',JSON['stringify'](_0x5e6f90));if(_0x5e6f90[_0x7995('0x27')]){if(_0x5e6f90[_0x7995('0x27')][_0x7995('0x28')]===0x1f4){logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')]['message']);return _0x37a7d4(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);return _0x1e1415(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}else{logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));_0x1e1415(_0x5e6f90[_0x7995('0x2a')][_0x7995('0x29')]);}})[_0x7995('0x2b')](function(_0x2a307e){logger['error'](_0x7995('0x24'),_0x37f297,_0x2a307e);_0x37a7d4(_0x2a307e);});});}function respondWithStatusCode(_0x5911c3,_0x229742){_0x229742=_0x229742||0xcc;return function(_0x49bc7e){if(_0x49bc7e){return _0x5911c3[_0x7995('0x2c')](_0x229742);}return _0x5911c3[_0x7995('0x2d')](_0x229742)[_0x7995('0x2e')]();};}function respondWithResult(_0x4b6f99,_0x9b2a15){_0x9b2a15=_0x9b2a15||0xc8;return function(_0x514445){if(_0x514445){return _0x4b6f99[_0x7995('0x2d')](_0x9b2a15)[_0x7995('0x2f')](_0x514445);}};}function respondWithFilteredResult(_0x4253e5,_0x574574){return function(_0x530611){if(_0x530611){var _0x48e573=_0x530611[_0x7995('0x30')],_0x3573be=_0x574574[_0x7995('0x31')],_0xe6b0b3=_0x574574[_0x7995('0x31')]+_0x574574['limit'],_0x327a81;if(_0xe6b0b3>=_0x48e573){_0xe6b0b3=_0x48e573;_0x327a81=0xc8;}else{_0x327a81=0xce;}_0x4253e5['status'](_0x327a81);return _0x4253e5[_0x7995('0x32')]('Content-Range',_0x3573be+'-'+_0xe6b0b3+'/'+_0x48e573)[_0x7995('0x2f')](_0x530611);}return null;};}function patchUpdates(_0x3eb566){return function(_0x29fac5){try{jsonpatch[_0x7995('0x33')](_0x29fac5,_0x3eb566,!![]);}catch(_0x1f7d27){return BPromise['reject'](_0x1f7d27);}return _0x29fac5[_0x7995('0x34')]();};}function saveUpdates(_0x33e24e,_0x5dd802){return function(_0x48db25){if(_0x48db25){return _0x48db25['update'](_0x33e24e)[_0x7995('0x23')](function(_0x3acfc3){return _0x3acfc3;});}return null;};}function removeEntity(_0x4a176f,_0x3e7020){return function(_0x51b95d){if(_0x51b95d){return _0x51b95d[_0x7995('0x35')]()[_0x7995('0x23')](function(){var _0x177cb4=_0x51b95d['get']({'plain':!![]});var _0x52d76d=_0x7995('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x52d76d,'resourceId':_0x177cb4['id']}})[_0x7995('0x23')](function(){return _0x51b95d;});})[_0x7995('0x23')](function(){_0x4a176f['status'](0xcc)[_0x7995('0x2e')]();});}};}function handleEntityNotFound(_0x1922b4,_0x2b772f){return function(_0x18667c){if(!_0x18667c){_0x1922b4[_0x7995('0x2c')](0x194);}return _0x18667c;};}function handleError(_0x53002a,_0x2d4285){_0x2d4285=_0x2d4285||0x1f4;return function(_0x242713){logger[_0x7995('0x27')](_0x242713[_0x7995('0x37')]);if(_0x242713['name']){delete _0x242713[_0x7995('0x38')];}_0x53002a[_0x7995('0x2d')](_0x2d4285)[_0x7995('0x39')](_0x242713);};}exports[_0x7995('0x3a')]=function(_0x1f5bee,_0x1035dc){var _0x5688a1={'include':[{'model':db[_0x7995('0x3b')],'as':_0x7995('0x3c')}]},_0x183a68={},_0x3be298={'count':0x0,'rows':[]};var _0x2e04cd=_[_0x7995('0x3d')](db[_0x7995('0x3e')][_0x7995('0x3f')],function(_0x1234e1){return{'name':_0x1234e1[_0x7995('0x40')],'type':_0x1234e1[_0x7995('0x41')][_0x7995('0x42')]};});_0x183a68[_0x7995('0x43')]=_['map'](_0x2e04cd,'name');_0x183a68[_0x7995('0x44')]=_[_0x7995('0x45')](_0x1f5bee['query']);_0x183a68['filters']=_[_0x7995('0x46')](_0x183a68['model'],_0x183a68['query']);_0x5688a1[_0x7995('0x47')]=_[_0x7995('0x46')](_0x183a68[_0x7995('0x43')],qs['fields'](_0x1f5bee[_0x7995('0x44')]['fields']));_0x5688a1[_0x7995('0x47')]=_0x5688a1['attributes']['length']?_0x5688a1[_0x7995('0x47')]:_0x183a68[_0x7995('0x43')];if(!_0x1f5bee[_0x7995('0x44')][_0x7995('0x48')]('nolimit')){_0x5688a1[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x1f5bee[_0x7995('0x44')][_0x7995('0x49')]);_0x5688a1['offset']=qs['offset'](_0x1f5bee[_0x7995('0x44')]['offset']);}_0x5688a1[_0x7995('0x4a')]=qs['sort'](_0x1f5bee[_0x7995('0x44')]['sort']);_0x5688a1[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x1f5bee[_0x7995('0x44')],_0x183a68[_0x7995('0x4c')]),_0x2e04cd);if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x4d')]){_0x5688a1['where']=_[_0x7995('0x4e')](_0x5688a1[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x2e04cd,function(_0x491184){if(_0x491184[_0x7995('0x41')]!==_0x7995('0x4f')){var _0x511567={};_0x511567[_0x491184[_0x7995('0x38')]]={'$like':'%'+_0x1f5bee[_0x7995('0x44')]['filter']+'%'};return _0x511567;}})});}_0x5688a1=_[_0x7995('0x4e')]({},_0x5688a1,_0x1f5bee[_0x7995('0x50')]);var _0x5921b9={'where':_0x5688a1[_0x7995('0x4b')]};return db['SmsAccount'][_0x7995('0x30')](_0x5921b9)[_0x7995('0x23')](function(_0x1afab4){_0x3be298[_0x7995('0x30')]=_0x1afab4;if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x51')]){_0x5688a1[_0x7995('0x52')]=[{'all':!![]}];}return db['SmsAccount'][_0x7995('0x53')](_0x5688a1);})[_0x7995('0x23')](function(_0x418eb9){_0x3be298['rows']=_0x418eb9;return _0x3be298;})[_0x7995('0x23')](respondWithFilteredResult(_0x1035dc,_0x5688a1))[_0x7995('0x2b')](handleError(_0x1035dc,null));};exports[_0x7995('0x54')]=function(_0x47d1d8,_0x4ec548){var _0x5a592e={'raw':![],'where':{'id':_0x47d1d8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]},_0xb70620={};_0xb70620[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0x3e')][_0x7995('0x3f')]);_0xb70620['query']=_[_0x7995('0x45')](_0x47d1d8['query']);_0xb70620[_0x7995('0x4c')]=_[_0x7995('0x46')](_0xb70620[_0x7995('0x43')],_0xb70620['query']);_0x5a592e['attributes']=_['intersection'](_0xb70620['model'],qs[_0x7995('0x56')](_0x47d1d8[_0x7995('0x44')][_0x7995('0x56')]));_0x5a592e[_0x7995('0x47')]=_0x5a592e[_0x7995('0x47')][_0x7995('0x57')]?_0x5a592e[_0x7995('0x47')]:_0xb70620[_0x7995('0x43')];if(_0x47d1d8[_0x7995('0x44')][_0x7995('0x51')]){_0x5a592e[_0x7995('0x52')]=[{'all':!![]}];}_0x5a592e=_[_0x7995('0x4e')]({},_0x5a592e,_0x47d1d8[_0x7995('0x50')]);return db[_0x7995('0x3e')][_0x7995('0x58')](_0x5a592e)[_0x7995('0x23')](handleEntityNotFound(_0x4ec548,null))[_0x7995('0x23')](respondWithResult(_0x4ec548,null))[_0x7995('0x2b')](handleError(_0x4ec548,null));};exports[_0x7995('0x59')]=function(_0x50b7c2,_0x56a374){return db[_0x7995('0x3e')][_0x7995('0x59')](_0x50b7c2[_0x7995('0x5a')],{})['then'](function(_0x53125a){var _0x402fa0=_0x50b7c2[_0x7995('0x5b')][_0x7995('0x5c')]({'plain':!![]});if(!_0x402fa0)throw new Error(_0x7995('0x5d'));if(_0x402fa0['role']===_0x7995('0x5b')){var _0x74ff38=_0x53125a[_0x7995('0x5c')]({'plain':!![]});var _0x33c49c='SmsAccounts';return db['UserProfileSection'][_0x7995('0x58')]({'where':{'name':_0x33c49c,'userProfileId':_0x402fa0[_0x7995('0x5e')]},'raw':!![]})[_0x7995('0x23')](function(_0x1d69ce){if(_0x1d69ce&&_0x1d69ce[_0x7995('0x5f')]===0x0){return db[_0x7995('0x60')][_0x7995('0x59')]({'name':_0x74ff38[_0x7995('0x38')],'resourceId':_0x74ff38['id'],'type':_0x1d69ce[_0x7995('0x38')],'sectionId':_0x1d69ce['id']},{})['then'](function(){return _0x53125a;});}else{return _0x53125a;}})[_0x7995('0x2b')](function(_0x3ec5a8){logger[_0x7995('0x27')](_0x7995('0x61'),_0x3ec5a8);throw _0x3ec5a8;});}return _0x53125a;})['then'](respondWithResult(_0x56a374,0xc9))['catch'](handleError(_0x56a374,null));};exports[_0x7995('0x62')]=function(_0xebb5c8,_0x47d5d7){if(_0xebb5c8[_0x7995('0x5a')]['id']){delete _0xebb5c8[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xebb5c8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]})['then'](handleEntityNotFound(_0x47d5d7,null))[_0x7995('0x23')](saveUpdates(_0xebb5c8[_0x7995('0x5a')],null))[_0x7995('0x23')](respondWithResult(_0x47d5d7,null))[_0x7995('0x2b')](handleError(_0x47d5d7,null));};exports[_0x7995('0x35')]=function(_0xeb8920,_0x2b3c1d){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xeb8920[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x2b3c1d,null))[_0x7995('0x23')](removeEntity(_0x2b3c1d,null))['catch'](handleError(_0x2b3c1d,null));};exports[_0x7995('0x63')]=function(_0x23bbc1,_0x293480){return db[_0x7995('0x3e')][_0x7995('0x63')]()['then'](respondWithResult(_0x293480,null))['catch'](handleError(_0x293480,null));};exports[_0x7995('0x64')]=function(_0x87e38d,_0x221542,_0xae6166){if(_0x87e38d['body']['id']){delete _0x87e38d[_0x7995('0x5a')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x87e38d[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x221542,null))[_0x7995('0x23')](function(_0x44bf2b){if(_0x44bf2b){_0x87e38d[_0x7995('0x5a')][_0x7995('0x65')]=_0x44bf2b['id'];return db[_0x7995('0x66')][_0x7995('0x59')](_0x87e38d[_0x7995('0x5a')]);}})[_0x7995('0x23')](respondWithResult(_0x221542,null))['catch'](handleError(_0x221542,null));};exports[_0x7995('0x67')]=function(_0x8908cd,_0x3c5802,_0x4cc247){var _0x1fe1cb={'raw':![],'where':{}};var _0x1d2f9d={};var _0x705f0={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x8908cd[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3c5802,null))[_0x7995('0x23')](function(_0x2f94c4){if(_0x2f94c4){_0x1d2f9d[_0x7995('0x43')]=_[_0x7995('0x45')](db['Disposition']['rawAttributes']);_0x1d2f9d[_0x7995('0x44')]=_[_0x7995('0x45')](_0x8908cd[_0x7995('0x44')]);_0x1d2f9d[_0x7995('0x4c')]=_['intersection'](_0x1d2f9d[_0x7995('0x43')],_0x1d2f9d[_0x7995('0x44')]);_0x1fe1cb['attributes']=_['intersection'](_0x1d2f9d[_0x7995('0x43')],qs[_0x7995('0x56')](_0x8908cd['query'][_0x7995('0x56')]));_0x1fe1cb['attributes']=_0x1fe1cb[_0x7995('0x47')][_0x7995('0x57')]?_0x1fe1cb['attributes']:_0x1d2f9d['model'];if(!_0x8908cd[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x1fe1cb[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x8908cd[_0x7995('0x44')][_0x7995('0x49')]);_0x1fe1cb[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x8908cd[_0x7995('0x44')][_0x7995('0x31')]);}_0x1fe1cb[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x8908cd[_0x7995('0x44')][_0x7995('0x6a')]);_0x1fe1cb[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x8908cd[_0x7995('0x44')],_0x1d2f9d[_0x7995('0x4c')]));_0x1fe1cb[_0x7995('0x4b')][_0x7995('0x65')]=_0x2f94c4['id'];if(_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]){_0x1fe1cb[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x1fe1cb[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x1fe1cb[_0x7995('0x47')],function(_0x34724d){var _0x59efff={};_0x59efff[_0x34724d]={'$like':'%'+_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x59efff;})});}_0x1fe1cb=_['merge']({},_0x1fe1cb,_0x8908cd['options']);return db[_0x7995('0x66')][_0x7995('0x30')]({'where':_0x1fe1cb[_0x7995('0x4b')]})[_0x7995('0x23')](function(_0xe1ce4){_0x705f0[_0x7995('0x30')]=_0xe1ce4;if(_0x8908cd['query'][_0x7995('0x51')]){_0x1fe1cb[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x66')][_0x7995('0x53')](_0x1fe1cb);})[_0x7995('0x23')](function(_0x3f0bff){_0x705f0[_0x7995('0x6c')]=_0x3f0bff;return _0x705f0;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x3c5802,_0x1fe1cb))['catch'](handleError(_0x3c5802,null));};exports[_0x7995('0x6d')]=function(_0x2b8217,_0x5c04c9,_0x479271){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x2b8217[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x5c04c9,null))[_0x7995('0x23')](function(_0x4a02ea){if(_0x4a02ea){return _0x4a02ea[_0x7995('0x6d')](_0x2b8217[_0x7995('0x44')]['ids']);}})[_0x7995('0x23')](respondWithStatusCode(_0x5c04c9,null))[_0x7995('0x2b')](handleError(_0x5c04c9,null));};exports['addAnswer']=function(_0x1535a3,_0x4a5bc5,_0x135191){if(_0x1535a3[_0x7995('0x5a')]['id']){delete _0x1535a3[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x1535a3['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4a5bc5,null))[_0x7995('0x23')](function(_0x38b37f){if(_0x38b37f){_0x1535a3['body'][_0x7995('0x65')]=_0x38b37f['id'];return db[_0x7995('0x6e')][_0x7995('0x59')](_0x1535a3[_0x7995('0x5a')]);}})['then'](respondWithResult(_0x4a5bc5,null))[_0x7995('0x2b')](handleError(_0x4a5bc5,null));};exports[_0x7995('0x6f')]=function(_0x3a5f5e,_0x4aafa3,_0x5358d4){var _0x3fc10={'raw':![],'where':{}};var _0x333379={};var _0x4800a8={'count':0x0,'rows':[]};return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x3a5f5e[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4aafa3,null))[_0x7995('0x23')](function(_0x2ba606){if(_0x2ba606){_0x333379['model']=_['keys'](db[_0x7995('0x6e')]['rawAttributes']);_0x333379['query']=_[_0x7995('0x45')](_0x3a5f5e[_0x7995('0x44')]);_0x333379[_0x7995('0x4c')]=_['intersection'](_0x333379[_0x7995('0x43')],_0x333379[_0x7995('0x44')]);_0x3fc10[_0x7995('0x47')]=_[_0x7995('0x46')](_0x333379[_0x7995('0x43')],qs['fields'](_0x3a5f5e[_0x7995('0x44')][_0x7995('0x56')]));_0x3fc10[_0x7995('0x47')]=_0x3fc10[_0x7995('0x47')]['length']?_0x3fc10[_0x7995('0x47')]:_0x333379[_0x7995('0x43')];if(!_0x3a5f5e['query'][_0x7995('0x48')](_0x7995('0x69'))){_0x3fc10['limit']=qs[_0x7995('0x49')](_0x3a5f5e['query'][_0x7995('0x49')]);_0x3fc10['offset']=qs[_0x7995('0x31')](_0x3a5f5e['query'][_0x7995('0x31')]);}_0x3fc10[_0x7995('0x4a')]=qs['sort'](_0x3a5f5e[_0x7995('0x44')]['sort']);_0x3fc10['where']=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x3a5f5e[_0x7995('0x44')],_0x333379[_0x7995('0x4c')]));_0x3fc10['where'][_0x7995('0x65')]=_0x2ba606['id'];if(_0x3a5f5e[_0x7995('0x44')]['filter']){_0x3fc10['where']=_[_0x7995('0x4e')](_0x3fc10['where'],{'$or':_[_0x7995('0x3d')](_0x3fc10[_0x7995('0x47')],function(_0xfb4479){var _0x5b42be={};_0x5b42be[_0xfb4479]={'$like':'%'+_0x3a5f5e['query'][_0x7995('0x4d')]+'%'};return _0x5b42be;})});}_0x3fc10=_['merge']({},_0x3fc10,_0x3a5f5e[_0x7995('0x50')]);return db[_0x7995('0x6e')][_0x7995('0x30')]({'where':_0x3fc10[_0x7995('0x4b')]})['then'](function(_0x52d102){_0x4800a8['count']=_0x52d102;if(_0x3a5f5e[_0x7995('0x44')][_0x7995('0x51')]){_0x3fc10[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x6e')][_0x7995('0x53')](_0x3fc10);})[_0x7995('0x23')](function(_0x59a793){_0x4800a8['rows']=_0x59a793;return _0x4800a8;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x4aafa3,_0x3fc10))['catch'](handleError(_0x4aafa3,null));};exports['removeAnswers']=function(_0x17d00f,_0x5e95c0,_0x57a164){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x17d00f[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x5e95c0,null))[_0x7995('0x23')](function(_0xf604d9){if(_0xf604d9){return _0xf604d9[_0x7995('0x70')](_0x17d00f[_0x7995('0x44')][_0x7995('0x71')]);}})[_0x7995('0x23')](respondWithStatusCode(_0x5e95c0,null))[_0x7995('0x2b')](handleError(_0x5e95c0,null));};exports[_0x7995('0x72')]=function(_0x19d746,_0x570b71,_0x3eb3fa){var _0x87a539={'channel':_0x7995('0x73')};var _0x2056da=[];var _0x2a01d4=[];var _0x5a4695={};return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x19d746[_0x7995('0x55')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x17f7d6){_0x87a539[_0x7995('0x74')]=_0x17f7d6;_0x87a539[_0x7995('0x75')]=_[_0x7995('0x76')](_0x17f7d6[_0x7995('0x77')],['priority'],[_0x7995('0x78')]);if(_0x87a539['account'][_0x7995('0x77')]){delete _0x87a539[_0x7995('0x74')][_0x7995('0x77')];}return db[_0x7995('0x79')][_0x7995('0x63')]();})[_0x7995('0x23')](function(_0x4f929b){if(!_0x4f929b){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x7b'));}_0x2056da=_[_0x7995('0x7c')](_['keys'](_0x4f929b),[_0x7995('0x7d'),'updatedAt']);_0x2a01d4=_[_0x7995('0x7c')](_[_0x7995('0x45')](_0x4f929b),['createdAt','updatedAt',_0x7995('0x7e'),_0x7995('0x7f')]);_0x87a539[_0x7995('0x5a')]={'mapKey':_0x7995('0x80')};if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){switch(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){case _0x7995('0x81'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x83')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x85')];break;case _0x7995('0x86'):_0x87a539['body'][_0x7995('0x82')]='+'+_0x19d746['body'][_0x7995('0x87')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x88')];break;case _0x7995('0x89'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['message'];break;case _0x7995('0x8a'):_0x87a539[_0x7995('0x5a')]['from']=_0x19d746['body'][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['body'];_0x87a539['body'][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8b')];break;case _0x7995('0x8c'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')]['Text'];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x8d')];break;case _0x7995('0x8e'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]='+'+_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x88')];_0x87a539[_0x7995('0x5a')]['messageId']=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x84')];break;case _0x7995('0x90'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x91')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x92')][_0x7995('0x29')];break;case _0x7995('0x93'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746['body'][_0x7995('0x94')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x88')];_0x87a539['body'][_0x7995('0x84')]=_0x19d746['body']['replyMessageId'];break;case'intelepeer':_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['from'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x29')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x95')];break;}}if(_0x87a539['body']['id']){delete _0x87a539[_0x7995('0x5a')]['id'];}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x82')])){throw new db['Sequelize'][(_0x7995('0x22'))](_0x7995('0x97'));}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')])||_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x98'));}if(_['isNil'](_0x87a539[_0x7995('0x5a')]['mapKey'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x99')+_0x2a01d4);}if(!_['includes'](_0x2a01d4,_0x87a539['body'][_0x7995('0x9a')])){throw new db[(_0x7995('0x7a'))]['ValidationError'](_0x7995('0x9b')+_0x2a01d4);}_0x5a4695[_0x87a539['body'][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')][_0x7995('0x82')];return db[_0x7995('0x9c')]['find']({'where':{'id':_0x87a539['account'][_0x7995('0x7f')]},'include':[{'model':db[_0x7995('0x79')],'as':_0x7995('0x9d'),'where':_0x5a4695,'limit':0x1,'order':[[_0x7995('0x9e'),'DESC']]}]});})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x8b820b){if(_0x8b820b){_0x87a539[_0x7995('0x9f')]=_[_0x7995('0xa0')](_0x8b820b,['Contacts']);if(_0x8b820b['Contacts']['length']){return _0x8b820b[_0x7995('0x9d')][0x0];}var _0x24a3cf=_['defaults'](_0x87a539[_0x7995('0x5a')],{'firstName':_0x87a539['body'][_0x7995('0x82')],'ListId':_0x8b820b['id']});_0x24a3cf[_0x87a539[_0x7995('0x5a')][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')]['from'];return db[_0x7995('0x79')][_0x7995('0x59')](_0x24a3cf,{'fields':_0x2056da,'raw':!![]});}})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x2023a7){if(_0x2023a7){_0x87a539[_0x7995('0xa1')]=_0x2023a7;var _0x1d200d={'ContactId':_0x2023a7['id'],'phone':_0x87a539[_0x7995('0x5a')][_0x7995('0x82')],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id']};var _0x30893a={'ContactId':_0x2023a7['id'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'closed':![]};return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':_0x30893a})['then'](function(_0x764245){if(_0x764245){return[_0x764245,![]];}return db['SmsInteraction'][_0x7995('0x59')](_0x1d200d)[_0x7995('0x23')](function(_0x5cf7b2){return[_0x5cf7b2,!![]];});});}})[_0x7995('0xa3')](function(_0x55dc6c,_0x17c3f9){_0x87a539[_0x7995('0xa4')]=_0x55dc6c['get']({'plain':!![]});_0x87a539['interaction']['created']=![];if(_0x17c3f9){if(_0x87a539[_0x7995('0x74')][_0x7995('0xa5')]){_0x87a539[_0x7995('0x75')][_0x7995('0xa6')]({'id':0x0,'priority':_0x87a539['applications'][_0x7995('0x57')]+0x1,'app':_0x7995('0xa7'),'appdata':_0x7995('0xa8'),'interval':_0x7995('0xa9')});}_0x87a539[_0x7995('0xa4')][_0x7995('0xaa')]=!![];}return db[_0x7995('0xab')][_0x7995('0x59')]({'phone':_0x87a539['body'][_0x7995('0x82')],'messageId':_0x87a539[_0x7995('0x5a')][_0x7995('0x84')],'body':_0x87a539[_0x7995('0x5a')]['body'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'SmsInteractionId':_0x55dc6c['id'],'direction':'in','ContactId':_0x55dc6c[_0x7995('0xac')],'AttachmentId':_0x87a539[_0x7995('0x5a')][_0x7995('0xad')]});})[_0x7995('0x23')](function(_0x2e7416){_0x87a539['message']=_0x2e7416;if(_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]){return db[_0x7995('0xaf')][_0x7995('0x58')]({'attributes':['id',_0x7995('0x38')],'where':{'id':_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]}})[_0x7995('0x23')](function(_0xf76f46){if(_0xf76f46){_0x87a539[_0x7995('0x75')][_0x7995('0xb0')]({'id':0x0,'priority':0x0,'app':_0x7995('0xb1'),'appdata':_0xf76f46[_0x7995('0x38')]+','+(_0x87a539[_0x7995('0x74')][_0x7995('0xb2')]||0xa),'interval':_0x7995('0xa9')});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);})[_0x7995('0x23')](function(_0x51f854){if(_0x51f854){var _0x4cf7f1=0xc8;var _0x1a980b=_0x7995('0xb5');logger['info'](_0x7995('0x26'),_0x1a980b,_0x4cf7f1,'entity\x20found');logger[_0x7995('0xb6')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1a980b,_0x4cf7f1,_0x7995('0xb7'),JSON[_0x7995('0xb8')](_0x51f854));if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]===_0x7995('0x81')){return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x32')](_0x7995('0xb9'),_0x7995('0xba'))[_0x7995('0x39')]('\x0a');}else{return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x2f')](_0x51f854);}}})[_0x7995('0x2b')](handleError(_0x570b71,null));};exports[_0x7995('0xbb')]=function(_0x54b803,_0x408c22,_0x1d2afe){return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x54b803['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x408c22,null))[_0x7995('0x23')](function(_0x31d0e9){if(_0x31d0e9){return db[_0x7995('0xbc')][_0x7995('0xbd')](function(_0x13dda4){return db[_0x7995('0xbe')][_0x7995('0x35')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'transaction':_0x13dda4})['then'](function(_0x3c81cc){var _0x5f5496=_[_0x7995('0x3d')](_0x54b803[_0x7995('0x5a')],function(_0x35b217){_0x35b217[_0x7995('0x65')]=_0x54b803['params']['id'];return _0x35b217;});return db[_0x7995('0xbe')][_0x7995('0xbf')](_0x5f5496,{'transaction':_0x13dda4});});})[_0x7995('0x23')](function(){return db[_0x7995('0xbe')][_0x7995('0xc0')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'order':_0x7995('0xc1')});});}})[_0x7995('0x23')](respondWithResult(_0x408c22,null))[_0x7995('0x2b')](handleError(_0x408c22,null));};exports[_0x7995('0xc2')]=function(_0x45f389,_0x44d6a8,_0x7d14e2){var _0x405711={};var _0x54e341={};var _0x5cb30e;var _0xdfc11d;return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x45f389['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x44d6a8,null))[_0x7995('0x23')](function(_0x610b81){if(_0x610b81){_0x5cb30e=_0x610b81;_0x54e341['model']=_[_0x7995('0x45')](db[_0x7995('0xbe')][_0x7995('0x3f')]);_0x54e341[_0x7995('0x44')]=_[_0x7995('0x45')](_0x45f389[_0x7995('0x44')]);_0x54e341[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x54e341[_0x7995('0x43')],_0x54e341[_0x7995('0x44')]);_0x405711[_0x7995('0x47')]=_['intersection'](_0x54e341['model'],qs[_0x7995('0x56')](_0x45f389['query'][_0x7995('0x56')]));_0x405711[_0x7995('0x47')]=_0x405711[_0x7995('0x47')][_0x7995('0x57')]?_0x405711[_0x7995('0x47')]:_0x54e341['model'];_0x405711['order']=qs[_0x7995('0x6a')](_0x45f389[_0x7995('0x44')][_0x7995('0x6a')]);_0x405711[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x45f389[_0x7995('0x44')],_0x54e341[_0x7995('0x4c')]));if(_0x45f389[_0x7995('0x44')][_0x7995('0x4d')]){_0x405711['where']=_[_0x7995('0x4e')](_0x405711[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x405711[_0x7995('0x47')],function(_0x511cf8){var _0x4d6da0={};_0x4d6da0[_0x511cf8]={'$like':'%'+_0x45f389['query']['filter']+'%'};return _0x4d6da0;})});}_0x405711=_['merge']({},_0x405711,_0x45f389[_0x7995('0x50')]);return _0x5cb30e['getApplications'](_0x405711);}})['then'](function(_0x32f19d){if(_0x32f19d){_0xdfc11d=_0x32f19d[_0x7995('0x57')];if(!_0x45f389[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x405711['limit']=qs[_0x7995('0x49')](_0x45f389[_0x7995('0x44')][_0x7995('0x49')]);_0x405711['offset']=qs[_0x7995('0x31')](_0x45f389[_0x7995('0x44')][_0x7995('0x31')]);}return _0x5cb30e['getApplications'](_0x405711);}})[_0x7995('0x23')](function(_0x15cfd3){if(_0x15cfd3){return _0x15cfd3?{'count':_0xdfc11d,'rows':_0x15cfd3}:null;}})[_0x7995('0x23')](respondWithResult(_0x44d6a8,null))[_0x7995('0x2b')](handleError(_0x44d6a8,null));};exports[_0x7995('0xc3')]=function(_0x574e2a,_0x1761e1,_0x2a4991){var _0xc8bbb4={'raw':![],'where':{}};var _0x484b6c={};var _0x20852c={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x574e2a[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1761e1,null))['then'](function(_0x2995a3){if(_0x2995a3){_0x484b6c[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xa2')][_0x7995('0x3f')]);_0x484b6c[_0x7995('0x44')]=_[_0x7995('0x45')](_0x574e2a['query']);_0x484b6c['filters']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],_0x484b6c['query']);_0xc8bbb4['attributes']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],qs[_0x7995('0x56')](_0x574e2a[_0x7995('0x44')][_0x7995('0x56')]));_0xc8bbb4[_0x7995('0x47')]=_0xc8bbb4[_0x7995('0x47')]['length']?_0xc8bbb4[_0x7995('0x47')]:_0x484b6c[_0x7995('0x43')];if(!_0x574e2a[_0x7995('0x44')][_0x7995('0x48')](_0x7995('0x69'))){_0xc8bbb4[_0x7995('0x49')]=qs['limit'](_0x574e2a[_0x7995('0x44')][_0x7995('0x49')]);_0xc8bbb4[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x574e2a[_0x7995('0x44')][_0x7995('0x31')]);}_0xc8bbb4[_0x7995('0x4a')]=qs['sort'](_0x574e2a[_0x7995('0x44')][_0x7995('0x6a')]);_0xc8bbb4[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x574e2a[_0x7995('0x44')],_0x484b6c['filters']));_0xc8bbb4[_0x7995('0x4b')][_0x7995('0x65')]=_0x2995a3['id'];if(_0x574e2a['query']['filter']){_0xc8bbb4['where']=_[_0x7995('0x4e')](_0xc8bbb4[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0xc8bbb4[_0x7995('0x47')],function(_0x503b32){var _0x2da21e={};_0x2da21e[_0x503b32]={'$like':'%'+_0x574e2a[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x2da21e;})});}_0xc8bbb4=_[_0x7995('0x4e')]({},_0xc8bbb4,_0x574e2a[_0x7995('0x50')]);return db[_0x7995('0xa2')][_0x7995('0x30')]({'where':_0xc8bbb4['where']})['then'](function(_0x2695eb){_0x20852c['count']=_0x2695eb;if(_0x574e2a['query'][_0x7995('0x51')]){_0xc8bbb4[_0x7995('0x52')]=[{'model':db[_0x7995('0x79')],'as':_0x7995('0xc4'),'required':![]},{'model':db[_0x7995('0xaf')],'as':_0x7995('0xc5'),'attributes':[_0x7995('0x38'),_0x7995('0xc6'),_0x7995('0xc7')],'required':![]},{'model':db[_0x7995('0xc8')],'as':_0x7995('0xc9'),'attributes':['id',_0x7995('0x38'),'color'],'where':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?{'id':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]}:undefined,'required':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?!![]:![]}];}return db[_0x7995('0xa2')]['findAll'](_0xc8bbb4);})[_0x7995('0x23')](function(_0x234832){_0x20852c[_0x7995('0x6c')]=_0x234832;return _0x20852c;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x1761e1,_0xc8bbb4))[_0x7995('0x2b')](handleError(_0x1761e1,null));};exports['send']=function(_0x2d1c14,_0x5e7fde,_0x156b65){var _0x12f4c5,_0x221be8,_0x5150aa;if(_[_0x7995('0x96')](_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')])||_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2d1c14[_0x7995('0x5a')]['to'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0xcb'));}_0x12f4c5=_0x2d1c14[_0x7995('0x5a')]['to'];return db[_0x7995('0x3e')]['find']({'where':{'id':_0x2d1c14[_0x7995('0x55')]['id']},'include':[{'model':db[_0x7995('0x9c')],'as':_0x7995('0xcc'),'include':[{'model':db[_0x7995('0x79')],'as':'Contacts','where':{'mobile':_0x12f4c5},'limit':0x1,'order':[['updatedAt',_0x7995('0xcd')]]}]}]})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0x3130f2){if(_0x3130f2&&_0x3130f2[_0x7995('0xcc')]){_0x221be8=_0x3130f2['get']({'plain':!![]});if(_0x221be8[_0x7995('0xcc')]&&_0x221be8[_0x7995('0xcc')][_0x7995('0x9d')][_0x7995('0x57')]){return _0x221be8[_0x7995('0xcc')]['Contacts'][0x0];}return db['CmContact'][_0x7995('0x59')](_[_0x7995('0x1b')](_0x2d1c14[_0x7995('0x5a')],{'firstName':_0x12f4c5,'mobile':_0x12f4c5,'phone':_0x12f4c5,'ListId':_0x221be8[_0x7995('0x7f')]}));}})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0xd0da6e){if(_0xd0da6e){_0x5150aa=_0xd0da6e;return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':{'ContactId':_0x5150aa['id'],'closed':![],'SmsAccountId':_0x221be8['id']}})[_0x7995('0x23')](function(_0x1949f5){if(_0x1949f5){return[_0x1949f5,![]];}return db['SmsInteraction']['create']({'UserId':_0x2d1c14['user']['id'],'ContactId':_0x5150aa['id'],'SmsAccountId':_0x221be8['id'],'phone':_0x12f4c5,'firstMsgDirection':'out','Messages':[_[_0x7995('0x4e')](_0x2d1c14[_0x7995('0x5a')],{'read':![],'body':_0x2d1c14['body'][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x7995('0x23')](function(_0x3ee80c){return[_0x3ee80c,!![]];});});}})[_0x7995('0xa3')](function(_0x8bd55,_0x20a056){if(_0x20a056){return _0x8bd55;}return db[_0x7995('0xab')][_0x7995('0x59')](_['merge'](_0x2d1c14['body'],{'read':![],'body':_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'SmsInteractionId':_0x8bd55['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']}))['then'](function(_0x2f96fd){_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')]=[];_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')][_0x7995('0xa6')](_0x2f96fd[_0x7995('0xce')]);return _0x8bd55;});})[_0x7995('0x23')](respondWithResult(_0x5e7fde,null))[_0x7995('0x2b')](handleError(_0x5e7fde,null));};exports['status']=function(_0x5136f5,_0x1161f2,_0x4bd222){if(_0x5136f5[_0x7995('0x5a')]['id']){delete _0x5136f5['body']['id'];}console[_0x7995('0xd0')](_0x7995('0xd1'),_0x5136f5[_0x7995('0x5a')]);var _0x4a75d2,_0x4c810d,_0x1401b4;return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x5136f5[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0xb0164a){if(_0xb0164a){_0x1401b4=_0xb0164a;logger[_0x7995('0xb6')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0xd2'),_0xb0164a['type'],util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));switch(_0xb0164a[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x5136f5[_0x7995('0x5a')]['skebby_dispatch_id']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd4')]}});}break;case _0x7995('0x89'):if(_0x5136f5['body']['requestid']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd6')]}});}break;case _0x7995('0x8a'):if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')];return db['SmsMessage']['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]}});}break;case _0x7995('0x8e'):var _0x296643=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x296643[_0x7995('0x84')]&&_0x296643[_0x7995('0x2d')]['groupName']==='DELIVERED'){_0x4c810d=_0x296643[_0x7995('0x2d')][_0x7995('0xd8')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x296643['messageId']}});}break;case'clickatell':if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]}});}break;case _0x7995('0xd9'):if(_0x5136f5[_0x7995('0x5a')]['redif']&&_0x5136f5['body'][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')]['redif']}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0x308d0e){if(_0x308d0e){_0x4a75d2=_0x308d0e;switch(_0x1401b4[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x4c810d===_0x7995('0xda')){return _0x4a75d2['update']({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x86'),util['inspect'](_0x5136f5['body'],{'showHidden':![],'depth':null}));}break;case _0x7995('0x89'):if(_0x4c810d==='1'){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status',_0x7995('0x86'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5136f5[_0x7995('0x5a')][_0x7995('0xdb')]&&_0x4c810d>=0xc8&&_0x4c810d<=0xce){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x8a'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0x8e'):var _0x1f6c3e=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x1f6c3e['status'][_0x7995('0xd8')]===_0x7995('0xda')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7995('0x2d'),_0x7995('0x8e'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4c810d==_0x7995('0xdc')||_0x4c810d==_0x7995('0xdd')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x93'),util['inspect'](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0xd9'):if(_0x4c810d===_0x7995('0xde')||_0x4c810d===_0x7995('0xdf')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),'status',_0x7995('0xd9'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x4a75d2;}})['then'](respondWithResult(_0x1161f2,null))['catch'](handleError(_0x1161f2,null));};exports['statusGet']=function(_0x21ff84,_0x1763aa,_0x32e443){var _0x35b6f9,_0x17fab0,_0x4da0e8;return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x21ff84[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x5bc1b4){if(_0x5bc1b4){_0x4da0e8=_0x5bc1b4;logger[_0x7995('0xb6')](_0x7995('0x26'),'status',_0x7995('0xd2'),_0x5bc1b4['type'],util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));switch(_0x5bc1b4[_0x7995('0x41')]){case'csc':if(_0x21ff84['query'][_0x7995('0xe0')]&&_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')]){_0x17fab0=_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x21ff84[_0x7995('0x44')][_0x7995('0xe0')]}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x48c9fc){if(_0x48c9fc){_0x35b6f9=_0x48c9fc;switch(_0x4da0e8['type']){case _0x7995('0x90'):if(_0x17fab0==='2'||_0x17fab0==='6'){return _0x35b6f9[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status','csc',util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x35b6f9;}})['then'](respondWithResult(_0x1763aa,null))['catch'](handleError(_0x1763aa,null));};exports[_0x7995('0xe2')]=function(_0x469cd6,_0x3ad24,_0x17c27b){return db[_0x7995('0x3e')]['find']({'where':{'id':_0x469cd6[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3ad24,null))['then'](function(_0xf9859c){if(_0xf9859c){return _0xf9859c[_0x7995('0xe2')](_0x469cd6[_0x7995('0x5a')]['ids'],_[_0x7995('0xa0')](_0x469cd6[_0x7995('0x5a')],[_0x7995('0x71'),'id'])||{})[_0x7995('0xa3')](function(_0x113e03){for(var _0x5348b1=0x0;_0x5348b1<_0x469cd6['body'][_0x7995('0x71')]['length'];_0x5348b1+=0x1){socket[_0x7995('0xe3')]('userSmsAccount:save',{'UserId':_0x469cd6[_0x7995('0x5a')][_0x7995('0x71')][_0x5348b1],'SmsAccountId':_0x469cd6[_0x7995('0x55')]['id']});}return _0x113e03;});}})['then'](respondWithResult(_0x3ad24,null))['catch'](handleError(_0x3ad24,null));};exports['removeAgents']=function(_0x362580,_0x1da57f,_0x270ef3){return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x362580[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x1da57f,null))[_0x7995('0x23')](function(_0x39449e){if(_0x39449e){return _0x39449e[_0x7995('0xe4')](_0x362580[_0x7995('0x44')][_0x7995('0x71')])['then'](function(){if(_['isArray'](_0x362580[_0x7995('0x44')][_0x7995('0x71')])){for(var _0x134da2=0x0;_0x134da2<_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x7995('0x57')];_0x134da2+=0x1){socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x134da2]),'SmsAccountId':Number(_0x362580['params']['id'])});}}else{socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')]),'SmsAccountId':Number(_0x362580[_0x7995('0x55')]['id'])});}});}})[_0x7995('0x23')](respondWithStatusCode(_0x1da57f,null))[_0x7995('0x2b')](handleError(_0x1da57f,null));};exports['getAgents']=function(_0x5d0fe6,_0x43a8a4,_0x2aec8d){var _0x12df49={};var _0x1f4efc={};var _0x55ce63;var _0x572c53;return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x5d0fe6[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x43a8a4,null))[_0x7995('0x23')](function(_0x2265cf){if(_0x2265cf){_0x55ce63=_0x2265cf;_0x1f4efc[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xaf')][_0x7995('0x3f')]);_0x1f4efc[_0x7995('0x44')]=_[_0x7995('0x45')](_0x5d0fe6['query']);_0x1f4efc[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x1f4efc[_0x7995('0x43')],_0x1f4efc['query']);_0x12df49[_0x7995('0x47')]=_['intersection'](_0x1f4efc['model'],qs['fields'](_0x5d0fe6['query'][_0x7995('0x56')]));_0x12df49['attributes']=_0x12df49[_0x7995('0x47')][_0x7995('0x57')]?_0x12df49['attributes']:_0x1f4efc[_0x7995('0x43')];_0x12df49[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x5d0fe6[_0x7995('0x44')]['sort']);_0x12df49[_0x7995('0x4b')]=qs['filters'](_[_0x7995('0x6b')](_0x5d0fe6[_0x7995('0x44')],_0x1f4efc[_0x7995('0x4c')]));if(_0x5d0fe6[_0x7995('0x44')][_0x7995('0x4d')]){_0x12df49[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x12df49[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x12df49[_0x7995('0x47')],function(_0x4aa202){var _0x8c9b6f={};_0x8c9b6f[_0x4aa202]={'$like':'%'+_0x5d0fe6[_0x7995('0x44')]['filter']+'%'};return _0x8c9b6f;})});}_0x12df49=_[_0x7995('0x4e')]({},_0x12df49,_0x5d0fe6[_0x7995('0x50')]);return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x1a6f42){if(_0x1a6f42){_0x572c53=_0x1a6f42[_0x7995('0x57')];if(!_0x5d0fe6['query'][_0x7995('0x48')]('nolimit')){_0x12df49[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x5d0fe6[_0x7995('0x44')][_0x7995('0x49')]);_0x12df49[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x5d0fe6['query'][_0x7995('0x31')]);}return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x4c2faf){if(_0x4c2faf){return _0x4c2faf?{'count':_0x572c53,'rows':_0x4c2faf}:null;}})[_0x7995('0x23')](respondWithResult(_0x43a8a4,null))[_0x7995('0x2b')](handleError(_0x43a8a4,null));}; \ No newline at end of file +var _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(_0x1b3f2d,_0x1522de){var _0x264bc4=function(_0x344615){while(--_0x344615){_0x1b3f2d['push'](_0x1b3f2d['shift']());}};_0x264bc4(++_0x1522de);}(_0x7a54,0x106));var _0x47a5=function(_0x2dd996,_0x4d55f9){_0x2dd996=_0x2dd996-0x0;var _0x10b8e5=_0x7a54[_0x2dd996];return _0x10b8e5;};'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 0f4b59c..0024481 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 _0xe49f=['emit','hasOwnProperty','hook','exports','SmsAccount','setMaxListeners','save','update','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe49f,0x163));var _0xfe49=function(_0x2e4528,_0xa6c63d){_0x2e4528=_0x2e4528-0x0;var _0x1b8f2b=_0xe49f[_0x2e4528];return _0x1b8f2b;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db'][_0xfe49('0x0')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xfe49('0x1')](0x0);var events={'afterCreate':_0xfe49('0x2'),'afterUpdate':_0xfe49('0x3'),'afterDestroy':_0xfe49('0x4')};function emitEvent(_0x15efe6){return function(_0x314f5f,_0xcf7a69,_0x1f0cf2){SmsAccountEvents[_0xfe49('0x5')](_0x15efe6+':'+_0x314f5f['id'],_0x314f5f);SmsAccountEvents[_0xfe49('0x5')](_0x15efe6,_0x314f5f);_0x1f0cf2(null);};}for(var e in events){if(events[_0xfe49('0x6')](e)){var event=events[e];SmsAccount[_0xfe49('0x7')](e,emitEvent(event));}}module[_0xfe49('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0xdc3c=['update','remove','emit','hasOwnProperty','hook','exports','events','SmsAccount','setMaxListeners','save'];(function(_0xf65d45,_0x4824c6){var _0x37ce40=function(_0x2a07b9){while(--_0x2a07b9){_0xf65d45['push'](_0xf65d45['shift']());}};_0x37ce40(++_0x4824c6);}(_0xdc3c,0x1b4));var _0xcdc3=function(_0x169f81,_0x3555b8){_0x169f81=_0x169f81-0x0;var _0x4d108b=_0xdc3c[_0x169f81];return _0x4d108b;};'use strict';var EventEmitter=require(_0xcdc3('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0xcdc3('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xcdc3('0x2')](0x0);var events={'afterCreate':_0xcdc3('0x3'),'afterUpdate':_0xcdc3('0x4'),'afterDestroy':_0xcdc3('0x5')};function emitEvent(_0x344010){return function(_0x8da9aa,_0x30c1fb,_0x2ad1f4){SmsAccountEvents[_0xcdc3('0x6')](_0x344010+':'+_0x8da9aa['id'],_0x8da9aa);SmsAccountEvents[_0xcdc3('0x6')](_0x344010,_0x8da9aa);_0x2ad1f4(null);};}for(var e in events){if(events[_0xcdc3('0x7')](e)){var event=events[e];SmsAccount[_0xcdc3('0x8')](e,emitEvent(event));}}module[_0xcdc3('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index eebfeb0..f2fdba7 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(_0x5b15d2,_0x37b7c6){var _0x4989f8=function(_0x33c341){while(--_0x33c341){_0x5b15d2['push'](_0x5b15d2['shift']());}};_0x4989f8(++_0x37b7c6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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(_0x55ddf3,_0x41ecf5){var _0x29522c=function(_0x48ae01){while(--_0x48ae01){_0x55ddf3['push'](_0x55ddf3['shift']());}};_0x29522c(++_0x41ecf5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 4ef076b..5a30f98 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 _0x98b4=['attributes','include','map','model','then','ShowSmsAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','SmsAccount','options','raw'];(function(_0x32cf10,_0x21237a){var _0x225c84=function(_0x490c3b){while(--_0x490c3b){_0x32cf10['push'](_0x32cf10['shift']());}};_0x225c84(++_0x21237a);}(_0x98b4,0x1a8));var _0x498b=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x98b4[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x498b('0x0'));var util=require(_0x498b('0x1'));var moment=require(_0x498b('0x2'));var BPromise=require(_0x498b('0x3'));var rs=require(_0x498b('0x4'));var fs=require('fs');var Redis=require(_0x498b('0x5'));var db=require(_0x498b('0x6'))['db'];var utils=require(_0x498b('0x7'));var logger=require('../../config/logger')(_0x498b('0x8'));var config=require(_0x498b('0x9'));var jayson=require(_0x498b('0xa'));var client=jayson[_0x498b('0xb')][_0x498b('0xc')]({'port':0x232a});config[_0x498b('0xd')]=_[_0x498b('0xe')](config['redis'],{'host':_0x498b('0xf'),'port':0x18eb});var socket=require(_0x498b('0x10'))(new Redis(config['redis']));require(_0x498b('0x11'))[_0x498b('0x12')](socket);function respondWithRpcPromise(_0x311872,_0x6bc9b9,_0x2ef867){return new BPromise(function(_0x42d5ce,_0xf8d62c){return client[_0x498b('0x13')](_0x311872,_0x2ef867)['then'](function(_0x520d07){logger[_0x498b('0x14')](_0x498b('0x15'),_0x6bc9b9,_0x498b('0x16'));logger[_0x498b('0x17')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6bc9b9,_0x498b('0x16'),JSON[_0x498b('0x18')](_0x520d07));if(_0x520d07[_0x498b('0x19')]){if(_0x520d07[_0x498b('0x19')]['code']===0x1f4){logger[_0x498b('0x19')](_0x498b('0x15'),_0x6bc9b9,_0x520d07[_0x498b('0x19')][_0x498b('0x1a')]);return _0xf8d62c(_0x520d07['error'][_0x498b('0x1a')]);}logger['error'](_0x498b('0x15'),_0x6bc9b9,_0x520d07[_0x498b('0x19')][_0x498b('0x1a')]);return _0x42d5ce(_0x520d07[_0x498b('0x19')][_0x498b('0x1a')]);}else{logger[_0x498b('0x14')](_0x498b('0x15'),_0x6bc9b9,_0x498b('0x16'));_0x42d5ce(_0x520d07[_0x498b('0x1b')][_0x498b('0x1a')]);}})[_0x498b('0x1c')](function(_0x2fefe4){logger[_0x498b('0x19')](_0x498b('0x15'),_0x6bc9b9,_0x2fefe4);_0xf8d62c(_0x2fefe4);});});}exports['ShowSmsAccount']=function(_0x48c994){var _0x12789d=this;return new Promise(function(_0xb89aba,_0x269767){return db[_0x498b('0x1d')]['find']({'raw':_0x48c994[_0x498b('0x1e')]?_0x48c994[_0x498b('0x1e')][_0x498b('0x1f')]===undefined?!![]:![]:!![],'where':_0x48c994[_0x498b('0x1e')]?_0x48c994[_0x498b('0x1e')]['where']||null:null,'attributes':_0x48c994[_0x498b('0x1e')]?_0x48c994[_0x498b('0x1e')][_0x498b('0x20')]||null:null,'include':_0x48c994[_0x498b('0x1e')]?_0x48c994['options'][_0x498b('0x21')]?_[_0x498b('0x22')](_0x48c994['options'][_0x498b('0x21')],function(_0x26fa29){return{'model':db[_0x26fa29[_0x498b('0x23')]],'as':_0x26fa29['as'],'attributes':_0x26fa29['attributes'],'include':_0x26fa29[_0x498b('0x21')]?_[_0x498b('0x22')](_0x26fa29[_0x498b('0x21')],function(_0x3ab903){return{'model':db[_0x3ab903['model']],'as':_0x3ab903['as'],'attributes':_0x3ab903[_0x498b('0x20')],'include':_0x3ab903['include']?_[_0x498b('0x22')](_0x3ab903[_0x498b('0x21')],function(_0x5a3961){return{'model':db[_0x5a3961['model']],'as':_0x5a3961['as'],'attributes':_0x5a3961[_0x498b('0x20')]};}):[]};}):[]};}):[]:[]})[_0x498b('0x24')](function(_0x1bd030){logger[_0x498b('0x14')](_0x498b('0x25'),_0x48c994);logger[_0x498b('0x17')](_0x498b('0x25'),_0x48c994,JSON[_0x498b('0x18')](_0x1bd030));_0xb89aba(_0x1bd030);})[_0x498b('0x1c')](function(_0x2bc26f){logger[_0x498b('0x19')](_0x498b('0x25'),_0x2bc26f[_0x498b('0x1a')],_0x48c994);_0x269767(_0x12789d[_0x498b('0x19')](0x1f4,_0x2bc26f[_0x498b('0x1a')]));});});}; \ No newline at end of file +var _0x57b4=['attributes','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','request','then','info','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','find','options','raw'];(function(_0x3737e6,_0x5b2de3){var _0x589409=function(_0x45422b){while(--_0x45422b){_0x3737e6['push'](_0x3737e6['shift']());}};_0x589409(++_0x5b2de3);}(_0x57b4,0x1d2));var _0x457b=function(_0x4c8086,_0x5e2195){_0x4c8086=_0x4c8086-0x0;var _0x37ec91=_0x57b4[_0x4c8086];return _0x37ec91;};'use strict';var _=require(_0x457b('0x0'));var util=require(_0x457b('0x1'));var moment=require(_0x457b('0x2'));var BPromise=require(_0x457b('0x3'));var rs=require(_0x457b('0x4'));var fs=require('fs');var Redis=require(_0x457b('0x5'));var db=require(_0x457b('0x6'))['db'];var utils=require(_0x457b('0x7'));var logger=require('../../config/logger')(_0x457b('0x8'));var config=require(_0x457b('0x9'));var jayson=require(_0x457b('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x457b('0xb')]=_['defaults'](config[_0x457b('0xb')],{'host':_0x457b('0xc'),'port':0x18eb});var socket=require(_0x457b('0xd'))(new Redis(config[_0x457b('0xb')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0xdf8afd,_0x435467,_0x34faa7){return new BPromise(function(_0x8898e,_0x1a7510){return client[_0x457b('0xe')](_0xdf8afd,_0x34faa7)[_0x457b('0xf')](function(_0xa22180){logger[_0x457b('0x10')]('SmsAccount,\x20%s,\x20%s',_0x435467,_0x457b('0x11'));logger['debug'](_0x457b('0x12'),_0x435467,'request\x20sent',JSON[_0x457b('0x13')](_0xa22180));if(_0xa22180[_0x457b('0x14')]){if(_0xa22180['error']['code']===0x1f4){logger[_0x457b('0x14')](_0x457b('0x15'),_0x435467,_0xa22180[_0x457b('0x14')][_0x457b('0x16')]);return _0x1a7510(_0xa22180[_0x457b('0x14')][_0x457b('0x16')]);}logger[_0x457b('0x14')](_0x457b('0x15'),_0x435467,_0xa22180['error']['message']);return _0x8898e(_0xa22180[_0x457b('0x14')][_0x457b('0x16')]);}else{logger[_0x457b('0x10')](_0x457b('0x15'),_0x435467,_0x457b('0x11'));_0x8898e(_0xa22180[_0x457b('0x17')][_0x457b('0x16')]);}})[_0x457b('0x18')](function(_0x360588){logger[_0x457b('0x14')](_0x457b('0x15'),_0x435467,_0x360588);_0x1a7510(_0x360588);});});}exports[_0x457b('0x19')]=function(_0x161cd0){var _0x25acb1=this;return new Promise(function(_0x41105f,_0x4ab780){return db['SmsAccount'][_0x457b('0x1a')]({'raw':_0x161cd0[_0x457b('0x1b')]?_0x161cd0['options'][_0x457b('0x1c')]===undefined?!![]:![]:!![],'where':_0x161cd0['options']?_0x161cd0[_0x457b('0x1b')]['where']||null:null,'attributes':_0x161cd0['options']?_0x161cd0[_0x457b('0x1b')][_0x457b('0x1d')]||null:null,'include':_0x161cd0[_0x457b('0x1b')]?_0x161cd0[_0x457b('0x1b')]['include']?_[_0x457b('0x1e')](_0x161cd0[_0x457b('0x1b')][_0x457b('0x1f')],function(_0x46ef27){return{'model':db[_0x46ef27[_0x457b('0x20')]],'as':_0x46ef27['as'],'attributes':_0x46ef27[_0x457b('0x1d')],'include':_0x46ef27['include']?_[_0x457b('0x1e')](_0x46ef27['include'],function(_0x549984){return{'model':db[_0x549984[_0x457b('0x20')]],'as':_0x549984['as'],'attributes':_0x549984[_0x457b('0x1d')],'include':_0x549984[_0x457b('0x1f')]?_['map'](_0x549984[_0x457b('0x1f')],function(_0x41906e){return{'model':db[_0x41906e[_0x457b('0x20')]],'as':_0x41906e['as'],'attributes':_0x41906e[_0x457b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x457b('0xf')](function(_0x2beb3a){logger[_0x457b('0x10')]('ShowSmsAccount',_0x161cd0);logger['debug']('ShowSmsAccount',_0x161cd0,JSON[_0x457b('0x13')](_0x2beb3a));_0x41105f(_0x2beb3a);})['catch'](function(_0x2373e9){logger['error'](_0x457b('0x19'),_0x2373e9[_0x457b('0x16')],_0x161cd0);_0x4ab780(_0x25acb1['error'](0x1f4,_0x2373e9[_0x457b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index c07ec29..f5ef255 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 _0x8945=['update','emit','removeListener','length','smsAccount:','save','remove'];(function(_0x4c3c4b,_0x2cf1ef){var _0x5004fa=function(_0x5124eb){while(--_0x5124eb){_0x4c3c4b['push'](_0x4c3c4b['shift']());}};_0x5004fa(++_0x2cf1ef);}(_0x8945,0x12b));var _0x5894=function(_0xdcfd07,_0x3a481b){_0xdcfd07=_0xdcfd07-0x0;var _0x2dc2b7=_0x8945[_0xdcfd07];return _0x2dc2b7;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0x5894('0x0'),_0x5894('0x1'),_0x5894('0x2')];function createListener(_0x26bb70,_0x9694d7){return function(_0x408e8c){_0x9694d7[_0x5894('0x3')](_0x26bb70,_0x408e8c);};}function removeListener(_0x3f3f79,_0x25d1f8){return function(){SmsAccountEvents[_0x5894('0x4')](_0x3f3f79,_0x25d1f8);};}exports['register']=function(_0x71d30a){for(var _0x3c082e=0x0,_0x3beb24=events[_0x5894('0x5')];_0x3c082e<_0x3beb24;_0x3c082e++){var _0x5d60a2=events[_0x3c082e];var _0x14b051=createListener(_0x5894('0x6')+_0x5d60a2,_0x71d30a);SmsAccountEvents['on'](_0x5d60a2,_0x14b051);}}; \ No newline at end of file +var _0x28a6=['smsAccount:','save','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x28a6,0x166));var _0x628a=function(_0x2c3bd9,_0x45f815){_0x2c3bd9=_0x2c3bd9-0x0;var _0x112e55=_0x28a6[_0x2c3bd9];return _0x112e55;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0x628a('0x0'),'remove','update'];function createListener(_0x3ba1f5,_0x593f82){return function(_0x3550dd){_0x593f82['emit'](_0x3ba1f5,_0x3550dd);};}function removeListener(_0x10fae7,_0x57a402){return function(){SmsAccountEvents['removeListener'](_0x10fae7,_0x57a402);};}exports['register']=function(_0x49cfbe){for(var _0x304a93=0x0,_0x471023=events[_0x628a('0x1')];_0x304a93<_0x471023;_0x304a93++){var _0x124819=events[_0x304a93];var _0x251da8=createListener(_0x628a('0x2')+_0x124819,_0x49cfbe);SmsAccountEvents['on'](_0x124819,_0x251da8);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index bf1e5a8..ac786c9 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 _0xf170=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsApplication.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy'];(function(_0x2ab7f0,_0x446b5b){var _0x2c82d9=function(_0x26fe8e){while(--_0x26fe8e){_0x2ab7f0['push'](_0x2ab7f0['shift']());}};_0x2c82d9(++_0x446b5b);}(_0xf170,0x1a3));var _0x0f17=function(_0x29e35f,_0x4859ef){_0x29e35f=_0x29e35f-0x0;var _0x266b74=_0xf170[_0x29e35f];return _0x266b74;};'use strict';var multer=require('multer');var util=require(_0x0f17('0x0'));var path=require(_0x0f17('0x1'));var timeout=require(_0x0f17('0x2'));var express=require(_0x0f17('0x3'));var router=express[_0x0f17('0x4')]();var auth=require(_0x0f17('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0f17('0x6'));var controller=require(_0x0f17('0x7'));router['get']('/',auth[_0x0f17('0x8')](),controller[_0x0f17('0x9')]);router[_0x0f17('0xa')](_0x0f17('0xb'),auth[_0x0f17('0x8')](),controller[_0x0f17('0xc')]);router['post']('/',auth[_0x0f17('0x8')](),controller[_0x0f17('0xd')]);router[_0x0f17('0xe')](_0x0f17('0xb'),auth['isAuthenticated'](),controller[_0x0f17('0xf')]);router[_0x0f17('0x10')](_0x0f17('0xb'),auth[_0x0f17('0x8')](),controller[_0x0f17('0x11')]);module[_0x0f17('0x12')]=router; \ No newline at end of file +var _0x1ce9=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','/:id','show','create','update','destroy','util','path'];(function(_0x639ea3,_0x443282){var _0x169c8f=function(_0x184639){while(--_0x184639){_0x639ea3['push'](_0x639ea3['shift']());}};_0x169c8f(++_0x443282);}(_0x1ce9,0x193));var _0x91ce=function(_0x329132,_0x50a456){_0x329132=_0x329132-0x0;var _0x189d30=_0x1ce9[_0x329132];return _0x189d30;};'use strict';var multer=require('multer');var util=require(_0x91ce('0x0'));var path=require(_0x91ce('0x1'));var timeout=require(_0x91ce('0x2'));var express=require(_0x91ce('0x3'));var router=express[_0x91ce('0x4')]();var auth=require(_0x91ce('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x91ce('0x6'));var controller=require(_0x91ce('0x7'));router[_0x91ce('0x8')]('/',auth[_0x91ce('0x9')](),controller['index']);router['get'](_0x91ce('0xa'),auth[_0x91ce('0x9')](),controller[_0x91ce('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x91ce('0xc')]);router['put']('/:id',auth[_0x91ce('0x9')](),controller[_0x91ce('0xd')]);router['delete'](_0x91ce('0xa'),auth[_0x91ce('0x9')](),controller[_0x91ce('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index d7f573e..e5dfb09 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 _0xbdeb=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x400322,_0x4353a8){var _0xfdd597=function(_0xd914b6){while(--_0xd914b6){_0x400322['push'](_0x400322['shift']());}};_0xfdd597(++_0x4353a8);}(_0xbdeb,0x162));var _0xbbde=function(_0x4ad364,_0x3ff8d7){_0x4ad364=_0x4ad364-0x0;var _0x4ac3c3=_0xbdeb[_0x4ad364];return _0x4ac3c3;};'use strict';var Sequelize=require(_0xbbde('0x0'));module[_0xbbde('0x1')]={'priority':{'type':Sequelize[_0xbbde('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xbbde('0x3')],'allowNull':![],'defaultValue':_0xbbde('0x4')},'appdata':{'type':Sequelize[_0xbbde('0x5')]()},'description':{'type':Sequelize[_0xbbde('0x3')]},'interval':{'type':Sequelize[_0xbbde('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xe360=['STRING','noop','*,*,*,*','exports','INTEGER'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xe360,0x1d9));var _0x0e36=function(_0x2962d5,_0x38deda){_0x2962d5=_0x2962d5-0x0;var _0x273406=_0xe360[_0x2962d5];return _0x273406;};'use strict';var Sequelize=require('sequelize');module[_0x0e36('0x0')]={'priority':{'type':Sequelize[_0x0e36('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x0e36('0x2')],'allowNull':![],'defaultValue':_0x0e36('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x0e36('0x2')]},'interval':{'type':Sequelize[_0x0e36('0x2')],'defaultValue':_0x0e36('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 0c6be60..5d8ee17 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 _0x8952=['querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','save','update','then','destroy','end','stack','name','send','index','SmsApplication','fieldName','model','map','query','keys','filters','attributes','fields','length','order','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','intersection','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js'];(function(_0x3b632f,_0x453380){var _0x10e788=function(_0x2228a4){while(--_0x2228a4){_0x3b632f['push'](_0x3b632f['shift']());}};_0x10e788(++_0x453380);}(_0x8952,0x17e));var _0x2895=function(_0x272aea,_0x59b853){_0x272aea=_0x272aea-0x0;var _0x526a95=_0x8952[_0x272aea];return _0x526a95;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2895('0x0'));var rimraf=require(_0x2895('0x1'));var zipdir=require(_0x2895('0x2'));var jsonpatch=require(_0x2895('0x3'));var rp=require(_0x2895('0x4'));var moment=require('moment');var BPromise=require(_0x2895('0x5'));var Mustache=require(_0x2895('0x6'));var util=require(_0x2895('0x7'));var path=require('path');var sox=require(_0x2895('0x8'));var csv=require(_0x2895('0x9'));var ejs=require(_0x2895('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2895('0xb'));var jsforce=require(_0x2895('0xc'));var deskjs=require(_0x2895('0xd'));var toCsv=require(_0x2895('0x9'));var querystring=require(_0x2895('0xe'));var Papa=require('papaparse');var Redis=require(_0x2895('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2895('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2895('0x11'));var utils=require(_0x2895('0x12'));var config=require(_0x2895('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x981298,_0x3924be){_0x3924be=_0x3924be||0xcc;return function(_0x4b1342){if(_0x4b1342){return _0x981298[_0x2895('0x14')](_0x3924be);}return _0x981298[_0x2895('0x15')](_0x3924be)['end']();};}function respondWithResult(_0x590a1b,_0x1d1493){_0x1d1493=_0x1d1493||0xc8;return function(_0x2ca2ac){if(_0x2ca2ac){return _0x590a1b['status'](_0x1d1493)[_0x2895('0x16')](_0x2ca2ac);}};}function respondWithFilteredResult(_0xd8192e,_0x27b50e){return function(_0x1ae013){if(_0x1ae013){var _0x1d3659=_0x1ae013[_0x2895('0x17')],_0x2627e6=_0x27b50e[_0x2895('0x18')],_0x6a5c7e=_0x27b50e[_0x2895('0x18')]+_0x27b50e[_0x2895('0x19')],_0x31bb7f;if(_0x6a5c7e>=_0x1d3659){_0x6a5c7e=_0x1d3659;_0x31bb7f=0xc8;}else{_0x31bb7f=0xce;}_0xd8192e[_0x2895('0x15')](_0x31bb7f);return _0xd8192e[_0x2895('0x1a')](_0x2895('0x1b'),_0x2627e6+'-'+_0x6a5c7e+'/'+_0x1d3659)[_0x2895('0x16')](_0x1ae013);}return null;};}function patchUpdates(_0x2fe8fe){return function(_0x1e8d47){try{jsonpatch['apply'](_0x1e8d47,_0x2fe8fe,!![]);}catch(_0x4b3ba0){return BPromise['reject'](_0x4b3ba0);}return _0x1e8d47[_0x2895('0x1c')]();};}function saveUpdates(_0x12c2fb,_0x3ec4da){return function(_0x593e47){if(_0x593e47){return _0x593e47[_0x2895('0x1d')](_0x12c2fb)[_0x2895('0x1e')](function(_0x2743b5){return _0x2743b5;});}return null;};}function removeEntity(_0x19228e,_0x8b75e0){return function(_0x5dbbfe){if(_0x5dbbfe){return _0x5dbbfe[_0x2895('0x1f')]()[_0x2895('0x1e')](function(){_0x19228e['status'](0xcc)[_0x2895('0x20')]();});}};}function handleEntityNotFound(_0x384357,_0x6f8ad4){return function(_0x511286){if(!_0x511286){_0x384357['sendStatus'](0x194);}return _0x511286;};}function handleError(_0x3a72fa,_0x4569b5){_0x4569b5=_0x4569b5||0x1f4;return function(_0x23b0eb){logger['error'](_0x23b0eb[_0x2895('0x21')]);if(_0x23b0eb[_0x2895('0x22')]){delete _0x23b0eb['name'];}_0x3a72fa[_0x2895('0x15')](_0x4569b5)[_0x2895('0x23')](_0x23b0eb);};}exports[_0x2895('0x24')]=function(_0x5c6c21,_0x320661){var _0x30f491={},_0x5eedfc={},_0x21f549={'count':0x0,'rows':[]};var _0x501898=_['map'](db[_0x2895('0x25')]['rawAttributes'],function(_0xfa4f85){return{'name':_0xfa4f85[_0x2895('0x26')],'type':_0xfa4f85['type']['key']};});_0x5eedfc[_0x2895('0x27')]=_[_0x2895('0x28')](_0x501898,_0x2895('0x22'));_0x5eedfc[_0x2895('0x29')]=_[_0x2895('0x2a')](_0x5c6c21[_0x2895('0x29')]);_0x5eedfc[_0x2895('0x2b')]=_['intersection'](_0x5eedfc[_0x2895('0x27')],_0x5eedfc[_0x2895('0x29')]);_0x30f491[_0x2895('0x2c')]=_['intersection'](_0x5eedfc[_0x2895('0x27')],qs[_0x2895('0x2d')](_0x5c6c21[_0x2895('0x29')][_0x2895('0x2d')]));_0x30f491['attributes']=_0x30f491[_0x2895('0x2c')][_0x2895('0x2e')]?_0x30f491[_0x2895('0x2c')]:_0x5eedfc[_0x2895('0x27')];if(!_0x5c6c21[_0x2895('0x29')]['hasOwnProperty']('nolimit')){_0x30f491[_0x2895('0x19')]=qs[_0x2895('0x19')](_0x5c6c21['query'][_0x2895('0x19')]);_0x30f491['offset']=qs[_0x2895('0x18')](_0x5c6c21[_0x2895('0x29')]['offset']);}_0x30f491[_0x2895('0x2f')]=qs['sort'](_0x5c6c21[_0x2895('0x29')]['sort']);_0x30f491['where']=qs[_0x2895('0x2b')](_[_0x2895('0x30')](_0x5c6c21[_0x2895('0x29')],_0x5eedfc['filters']),_0x501898);if(_0x5c6c21[_0x2895('0x29')][_0x2895('0x31')]){_0x30f491[_0x2895('0x32')]=_[_0x2895('0x33')](_0x30f491[_0x2895('0x32')],{'$or':_[_0x2895('0x28')](_0x501898,function(_0xf44bda){if(_0xf44bda[_0x2895('0x34')]!==_0x2895('0x35')){var _0xa6b8c5={};_0xa6b8c5[_0xf44bda['name']]={'$like':'%'+_0x5c6c21[_0x2895('0x29')][_0x2895('0x31')]+'%'};return _0xa6b8c5;}})});}_0x30f491=_[_0x2895('0x33')]({},_0x30f491,_0x5c6c21[_0x2895('0x36')]);var _0x41a66b={'where':_0x30f491[_0x2895('0x32')]};return db[_0x2895('0x25')]['count'](_0x41a66b)['then'](function(_0x2c2dd3){_0x21f549[_0x2895('0x17')]=_0x2c2dd3;if(_0x5c6c21[_0x2895('0x29')][_0x2895('0x37')]){_0x30f491[_0x2895('0x38')]=[{'all':!![]}];}return db[_0x2895('0x25')]['findAll'](_0x30f491);})['then'](function(_0x3f083e){_0x21f549[_0x2895('0x39')]=_0x3f083e;return _0x21f549;})['then'](respondWithFilteredResult(_0x320661,_0x30f491))['catch'](handleError(_0x320661,null));};exports[_0x2895('0x3a')]=function(_0x3fa454,_0x3cc827){var _0x28967f={'raw':!![],'where':{'id':_0x3fa454[_0x2895('0x3b')]['id']}},_0x2bac35={};_0x2bac35['model']=_[_0x2895('0x2a')](db[_0x2895('0x25')][_0x2895('0x3c')]);_0x2bac35[_0x2895('0x29')]=_['keys'](_0x3fa454[_0x2895('0x29')]);_0x2bac35[_0x2895('0x2b')]=_[_0x2895('0x3d')](_0x2bac35[_0x2895('0x27')],_0x2bac35['query']);_0x28967f['attributes']=_[_0x2895('0x3d')](_0x2bac35[_0x2895('0x27')],qs[_0x2895('0x2d')](_0x3fa454[_0x2895('0x29')][_0x2895('0x2d')]));_0x28967f['attributes']=_0x28967f['attributes'][_0x2895('0x2e')]?_0x28967f[_0x2895('0x2c')]:_0x2bac35[_0x2895('0x27')];if(_0x3fa454[_0x2895('0x29')][_0x2895('0x37')]){_0x28967f[_0x2895('0x38')]=[{'all':!![]}];}_0x28967f=_[_0x2895('0x33')]({},_0x28967f,_0x3fa454['options']);return db[_0x2895('0x25')][_0x2895('0x3e')](_0x28967f)[_0x2895('0x1e')](handleEntityNotFound(_0x3cc827,null))[_0x2895('0x1e')](respondWithResult(_0x3cc827,null))[_0x2895('0x3f')](handleError(_0x3cc827,null));};exports[_0x2895('0x40')]=function(_0x232464,_0x299d71){return db['SmsApplication'][_0x2895('0x40')](_0x232464[_0x2895('0x41')],{})[_0x2895('0x1e')](respondWithResult(_0x299d71,0xc9))['catch'](handleError(_0x299d71,null));};exports[_0x2895('0x1d')]=function(_0x5307a9,_0x5e4f70){if(_0x5307a9[_0x2895('0x41')]['id']){delete _0x5307a9[_0x2895('0x41')]['id'];}return db[_0x2895('0x25')][_0x2895('0x3e')]({'where':{'id':_0x5307a9[_0x2895('0x3b')]['id']}})[_0x2895('0x1e')](handleEntityNotFound(_0x5e4f70,null))[_0x2895('0x1e')](saveUpdates(_0x5307a9['body'],null))[_0x2895('0x1e')](respondWithResult(_0x5e4f70,null))[_0x2895('0x3f')](handleError(_0x5e4f70,null));};exports['destroy']=function(_0x4e1d47,_0x574839){return db[_0x2895('0x25')][_0x2895('0x3e')]({'where':{'id':_0x4e1d47[_0x2895('0x3b')]['id']}})[_0x2895('0x1e')](handleEntityNotFound(_0x574839,null))[_0x2895('0x1e')](removeEntity(_0x574839,null))[_0x2895('0x3f')](handleError(_0x574839,null));}; \ No newline at end of file +var _0xb44a=['end','error','name','send','index','SmsApplication','rawAttributes','fieldName','type','key','map','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','keys','find','create','body','catch','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy'];(function(_0x4f4593,_0x565ddb){var _0x119201=function(_0x2cc69e){while(--_0x2cc69e){_0x4f4593['push'](_0x4f4593['shift']());}};_0x119201(++_0x565ddb);}(_0xb44a,0x1c2));var _0xab44=function(_0x207140,_0x4c6556){_0x207140=_0x207140-0x0;var _0x39e8cf=_0xb44a[_0x207140];return _0x39e8cf;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xab44('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xab44('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xab44('0x2'));var Mustache=require('mustache');var util=require(_0xab44('0x3'));var path=require(_0xab44('0x4'));var sox=require(_0xab44('0x5'));var csv=require(_0xab44('0x6'));var ejs=require(_0xab44('0x7'));var fs=require('fs');var _=require(_0xab44('0x8'));var squel=require(_0xab44('0x9'));var crypto=require(_0xab44('0xa'));var jsforce=require(_0xab44('0xb'));var deskjs=require(_0xab44('0xc'));var toCsv=require(_0xab44('0x6'));var querystring=require(_0xab44('0xd'));var Papa=require(_0xab44('0xe'));var Redis=require('ioredis');var authService=require(_0xab44('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xab44('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xab44('0x11'));var utils=require(_0xab44('0x12'));var config=require(_0xab44('0x13'));var db=require(_0xab44('0x14'))['db'];function respondWithStatusCode(_0x2208fb,_0x237c26){_0x237c26=_0x237c26||0xcc;return function(_0x52d282){if(_0x52d282){return _0x2208fb['sendStatus'](_0x237c26);}return _0x2208fb[_0xab44('0x15')](_0x237c26)['end']();};}function respondWithResult(_0x15db10,_0x5ae369){_0x5ae369=_0x5ae369||0xc8;return function(_0x25f611){if(_0x25f611){return _0x15db10[_0xab44('0x15')](_0x5ae369)[_0xab44('0x16')](_0x25f611);}};}function respondWithFilteredResult(_0x384f02,_0x31404d){return function(_0x41701b){if(_0x41701b){var _0x4875df=_0x41701b[_0xab44('0x17')],_0x51251b=_0x31404d[_0xab44('0x18')],_0x44c85e=_0x31404d[_0xab44('0x18')]+_0x31404d[_0xab44('0x19')],_0x272a5b;if(_0x44c85e>=_0x4875df){_0x44c85e=_0x4875df;_0x272a5b=0xc8;}else{_0x272a5b=0xce;}_0x384f02[_0xab44('0x15')](_0x272a5b);return _0x384f02[_0xab44('0x1a')](_0xab44('0x1b'),_0x51251b+'-'+_0x44c85e+'/'+_0x4875df)[_0xab44('0x16')](_0x41701b);}return null;};}function patchUpdates(_0x27fc7f){return function(_0x5cc897){try{jsonpatch[_0xab44('0x1c')](_0x5cc897,_0x27fc7f,!![]);}catch(_0x401379){return BPromise[_0xab44('0x1d')](_0x401379);}return _0x5cc897[_0xab44('0x1e')]();};}function saveUpdates(_0x29bb73,_0x5123b1){return function(_0xcd426){if(_0xcd426){return _0xcd426['update'](_0x29bb73)[_0xab44('0x1f')](function(_0x2917bf){return _0x2917bf;});}return null;};}function removeEntity(_0x193b66,_0x355083){return function(_0x486317){if(_0x486317){return _0x486317[_0xab44('0x20')]()[_0xab44('0x1f')](function(){_0x193b66[_0xab44('0x15')](0xcc)[_0xab44('0x21')]();});}};}function handleEntityNotFound(_0x11f0b,_0x402950){return function(_0x43f1c6){if(!_0x43f1c6){_0x11f0b['sendStatus'](0x194);}return _0x43f1c6;};}function handleError(_0x595761,_0x1d4a2f){_0x1d4a2f=_0x1d4a2f||0x1f4;return function(_0x572e0b){logger[_0xab44('0x22')](_0x572e0b['stack']);if(_0x572e0b[_0xab44('0x23')]){delete _0x572e0b['name'];}_0x595761['status'](_0x1d4a2f)[_0xab44('0x24')](_0x572e0b);};}exports[_0xab44('0x25')]=function(_0x259192,_0x4620ed){var _0x132bf6={},_0x4e820c={},_0x2f86ac={'count':0x0,'rows':[]};var _0x5587fe=_['map'](db[_0xab44('0x26')][_0xab44('0x27')],function(_0x21131e){return{'name':_0x21131e[_0xab44('0x28')],'type':_0x21131e[_0xab44('0x29')][_0xab44('0x2a')]};});_0x4e820c['model']=_[_0xab44('0x2b')](_0x5587fe,_0xab44('0x23'));_0x4e820c[_0xab44('0x2c')]=_['keys'](_0x259192['query']);_0x4e820c[_0xab44('0x2d')]=_['intersection'](_0x4e820c['model'],_0x4e820c[_0xab44('0x2c')]);_0x132bf6[_0xab44('0x2e')]=_[_0xab44('0x2f')](_0x4e820c[_0xab44('0x30')],qs[_0xab44('0x31')](_0x259192[_0xab44('0x2c')][_0xab44('0x31')]));_0x132bf6[_0xab44('0x2e')]=_0x132bf6[_0xab44('0x2e')][_0xab44('0x32')]?_0x132bf6[_0xab44('0x2e')]:_0x4e820c[_0xab44('0x30')];if(!_0x259192[_0xab44('0x2c')][_0xab44('0x33')]('nolimit')){_0x132bf6['limit']=qs[_0xab44('0x19')](_0x259192[_0xab44('0x2c')]['limit']);_0x132bf6[_0xab44('0x18')]=qs[_0xab44('0x18')](_0x259192[_0xab44('0x2c')][_0xab44('0x18')]);}_0x132bf6[_0xab44('0x34')]=qs[_0xab44('0x35')](_0x259192[_0xab44('0x2c')][_0xab44('0x35')]);_0x132bf6[_0xab44('0x36')]=qs[_0xab44('0x2d')](_[_0xab44('0x37')](_0x259192[_0xab44('0x2c')],_0x4e820c[_0xab44('0x2d')]),_0x5587fe);if(_0x259192[_0xab44('0x2c')][_0xab44('0x38')]){_0x132bf6[_0xab44('0x36')]=_[_0xab44('0x39')](_0x132bf6[_0xab44('0x36')],{'$or':_['map'](_0x5587fe,function(_0x643dec){if(_0x643dec[_0xab44('0x29')]!==_0xab44('0x3a')){var _0x21a1ed={};_0x21a1ed[_0x643dec['name']]={'$like':'%'+_0x259192[_0xab44('0x2c')][_0xab44('0x38')]+'%'};return _0x21a1ed;}})});}_0x132bf6=_[_0xab44('0x39')]({},_0x132bf6,_0x259192[_0xab44('0x3b')]);var _0x411d6c={'where':_0x132bf6['where']};return db[_0xab44('0x26')][_0xab44('0x17')](_0x411d6c)[_0xab44('0x1f')](function(_0x5b4f4d){_0x2f86ac[_0xab44('0x17')]=_0x5b4f4d;if(_0x259192[_0xab44('0x2c')][_0xab44('0x3c')]){_0x132bf6[_0xab44('0x3d')]=[{'all':!![]}];}return db[_0xab44('0x26')]['findAll'](_0x132bf6);})[_0xab44('0x1f')](function(_0x4aaee9){_0x2f86ac[_0xab44('0x3e')]=_0x4aaee9;return _0x2f86ac;})['then'](respondWithFilteredResult(_0x4620ed,_0x132bf6))['catch'](handleError(_0x4620ed,null));};exports['show']=function(_0x540102,_0x52e3de){var _0x120585={'raw':!![],'where':{'id':_0x540102[_0xab44('0x3f')]['id']}},_0x6131f2={};_0x6131f2[_0xab44('0x30')]=_[_0xab44('0x40')](db[_0xab44('0x26')][_0xab44('0x27')]);_0x6131f2[_0xab44('0x2c')]=_[_0xab44('0x40')](_0x540102[_0xab44('0x2c')]);_0x6131f2['filters']=_[_0xab44('0x2f')](_0x6131f2[_0xab44('0x30')],_0x6131f2[_0xab44('0x2c')]);_0x120585[_0xab44('0x2e')]=_['intersection'](_0x6131f2[_0xab44('0x30')],qs[_0xab44('0x31')](_0x540102[_0xab44('0x2c')][_0xab44('0x31')]));_0x120585[_0xab44('0x2e')]=_0x120585[_0xab44('0x2e')]['length']?_0x120585['attributes']:_0x6131f2[_0xab44('0x30')];if(_0x540102[_0xab44('0x2c')][_0xab44('0x3c')]){_0x120585[_0xab44('0x3d')]=[{'all':!![]}];}_0x120585=_[_0xab44('0x39')]({},_0x120585,_0x540102['options']);return db[_0xab44('0x26')][_0xab44('0x41')](_0x120585)[_0xab44('0x1f')](handleEntityNotFound(_0x52e3de,null))[_0xab44('0x1f')](respondWithResult(_0x52e3de,null))['catch'](handleError(_0x52e3de,null));};exports[_0xab44('0x42')]=function(_0x1ab92d,_0x3e2ba1){return db['SmsApplication'][_0xab44('0x42')](_0x1ab92d[_0xab44('0x43')],{})[_0xab44('0x1f')](respondWithResult(_0x3e2ba1,0xc9))[_0xab44('0x44')](handleError(_0x3e2ba1,null));};exports['update']=function(_0x13892d,_0x50d700){if(_0x13892d[_0xab44('0x43')]['id']){delete _0x13892d[_0xab44('0x43')]['id'];}return db[_0xab44('0x26')][_0xab44('0x41')]({'where':{'id':_0x13892d['params']['id']}})[_0xab44('0x1f')](handleEntityNotFound(_0x50d700,null))['then'](saveUpdates(_0x13892d[_0xab44('0x43')],null))[_0xab44('0x1f')](respondWithResult(_0x50d700,null))[_0xab44('0x44')](handleError(_0x50d700,null));};exports[_0xab44('0x20')]=function(_0x14bd54,_0x4eeef0){return db[_0xab44('0x26')]['find']({'where':{'id':_0x14bd54[_0xab44('0x3f')]['id']}})[_0xab44('0x1f')](handleEntityNotFound(_0x4eeef0,null))[_0xab44('0x1f')](removeEntity(_0x4eeef0,null))['catch'](handleError(_0x4eeef0,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index f2ddf15..0b4cfe4 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 _0xa639=['lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication','sms_applications','utf8mb4_unicode_ci'];(function(_0x357174,_0x3875e2){var _0x13d040=function(_0x12341b){while(--_0x12341b){_0x357174['push'](_0x357174['shift']());}};_0x13d040(++_0x3875e2);}(_0xa639,0x78));var _0x9a63=function(_0x2d099d,_0x39d932){_0x2d099d=_0x2d099d-0x0;var _0x5d66da=_0xa639[_0x2d099d];return _0x5d66da;};'use strict';var _=require(_0x9a63('0x0'));var util=require('util');var logger=require(_0x9a63('0x1'))(_0x9a63('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9a63('0x3'));var fs=require('fs');var path=require(_0x9a63('0x4'));var rimraf=require(_0x9a63('0x5'));var config=require(_0x9a63('0x6'));var attributes=require(_0x9a63('0x7'));module['exports']=function(_0x299c66,_0x1e0736){return _0x299c66[_0x9a63('0x8')](_0x9a63('0x9'),attributes,{'tableName':_0x9a63('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9a63('0xb')});}; \ No newline at end of file +var _0x10c3=['utf8mb4_unicode_ci','util','api','moment','../../config/environment','./smsApplication.attributes','exports','sms_applications'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10c3,0x1b9));var _0x310c=function(_0x3cde73,_0x2810e5){_0x3cde73=_0x3cde73-0x0;var _0x474f40=_0x10c3[_0x3cde73];return _0x474f40;};'use strict';var _=require('lodash');var util=require(_0x310c('0x0'));var logger=require('../../config/logger')(_0x310c('0x1'));var moment=require(_0x310c('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x310c('0x3'));var attributes=require(_0x310c('0x4'));module[_0x310c('0x5')]=function(_0x4f5041,_0x5b1f27){return _0x4f5041['define']('SmsApplication',attributes,{'tableName':_0x310c('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x310c('0x7')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 8446c70..e6cd6cc 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 _0x5577=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5577,0x1b4));var _0x7557=function(_0x2bc6a2,_0x44e6ea){_0x2bc6a2=_0x2bc6a2-0x0;var _0x50f1ce=_0x5577[_0x2bc6a2];return _0x50f1ce;};'use strict';var _=require(_0x7557('0x0'));var util=require('util');var moment=require(_0x7557('0x1'));var BPromise=require(_0x7557('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7557('0x3'));var db=require(_0x7557('0x4'))['db'];var utils=require(_0x7557('0x5'));var logger=require(_0x7557('0x6'))(_0x7557('0x7'));var config=require(_0x7557('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7557('0x9')][_0x7557('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3da895,_0x1446fd,_0x33e9aa){return new BPromise(function(_0x37f335,_0xa4f49a){return client[_0x7557('0xb')](_0x3da895,_0x33e9aa)[_0x7557('0xc')](function(_0x24b592){logger[_0x7557('0xd')](_0x7557('0xe'),_0x1446fd,_0x7557('0xf'));logger[_0x7557('0x10')](_0x7557('0x11'),_0x1446fd,'request\x20sent',JSON['stringify'](_0x24b592));if(_0x24b592[_0x7557('0x12')]){if(_0x24b592[_0x7557('0x12')][_0x7557('0x13')]===0x1f4){logger[_0x7557('0x12')](_0x7557('0xe'),_0x1446fd,_0x24b592[_0x7557('0x12')][_0x7557('0x14')]);return _0xa4f49a(_0x24b592[_0x7557('0x12')][_0x7557('0x14')]);}logger[_0x7557('0x12')]('SmsApplication,\x20%s,\x20%s',_0x1446fd,_0x24b592[_0x7557('0x12')][_0x7557('0x14')]);return _0x37f335(_0x24b592[_0x7557('0x12')]['message']);}else{logger[_0x7557('0xd')](_0x7557('0xe'),_0x1446fd,_0x7557('0xf'));_0x37f335(_0x24b592[_0x7557('0x15')]['message']);}})[_0x7557('0x16')](function(_0x46057c){logger['error']('SmsApplication,\x20%s,\x20%s',_0x1446fd,_0x46057c);_0xa4f49a(_0x46057c);});});} \ No newline at end of file +var _0xf987=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','message','SmsApplication,\x20%s,\x20%s','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x40ec64,_0x36577d){var _0x2663f7=function(_0x38b54a){while(--_0x38b54a){_0x40ec64['push'](_0x40ec64['shift']());}};_0x2663f7(++_0x36577d);}(_0xf987,0x18a));var _0x7f98=function(_0x34f1dd,_0x39f09a){_0x34f1dd=_0x34f1dd-0x0;var _0x224d64=_0xf987[_0x34f1dd];return _0x224d64;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7f98('0x0'));var BPromise=require(_0x7f98('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f98('0x2'));var db=require(_0x7f98('0x3'))['db'];var utils=require(_0x7f98('0x4'));var logger=require(_0x7f98('0x5'))(_0x7f98('0x6'));var config=require(_0x7f98('0x7'));var jayson=require(_0x7f98('0x8'));var client=jayson[_0x7f98('0x9')][_0x7f98('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25001e,_0x3e25d9,_0x290763){return new BPromise(function(_0x5bb41e,_0x2ab24d){return client[_0x7f98('0xb')](_0x25001e,_0x290763)[_0x7f98('0xc')](function(_0xc579d0){logger[_0x7f98('0xd')]('SmsApplication,\x20%s,\x20%s',_0x3e25d9,_0x7f98('0xe'));logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x3e25d9,_0x7f98('0xe'),JSON[_0x7f98('0xf')](_0xc579d0));if(_0xc579d0[_0x7f98('0x10')]){if(_0xc579d0[_0x7f98('0x10')]['code']===0x1f4){logger[_0x7f98('0x10')]('SmsApplication,\x20%s,\x20%s',_0x3e25d9,_0xc579d0[_0x7f98('0x10')][_0x7f98('0x11')]);return _0x2ab24d(_0xc579d0[_0x7f98('0x10')][_0x7f98('0x11')]);}logger[_0x7f98('0x10')](_0x7f98('0x12'),_0x3e25d9,_0xc579d0[_0x7f98('0x10')][_0x7f98('0x11')]);return _0x5bb41e(_0xc579d0[_0x7f98('0x10')][_0x7f98('0x11')]);}else{logger[_0x7f98('0xd')](_0x7f98('0x12'),_0x3e25d9,'request\x20sent');_0x5bb41e(_0xc579d0[_0x7f98('0x13')]['message']);}})['catch'](function(_0x3ac563){logger[_0x7f98('0x10')]('SmsApplication,\x20%s,\x20%s',_0x3e25d9,_0x3ac563);_0x2ab24d(_0x3ac563);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 4af8414..58df08a 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 _0xb0d2=['exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','post','create','/:id/messages','addMessage','tracked','smsinteraction:addtags','addTags','sms','smsinteraction:update','update','delete','smsinteraction:destroy'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xb0d2,0x1b4));var _0x2b0d=function(_0x13682e,_0x431f67){_0x13682e=_0x13682e-0x0;var _0x244503=_0xb0d2[_0x13682e];return _0x244503;};'use strict';var multer=require(_0x2b0d('0x0'));var util=require('util');var path=require(_0x2b0d('0x1'));var timeout=require(_0x2b0d('0x2'));var express=require(_0x2b0d('0x3'));var router=express['Router']();var auth=require(_0x2b0d('0x4'));var interaction=require(_0x2b0d('0x5'));var config=require(_0x2b0d('0x6'));var controller=require(_0x2b0d('0x7'));router[_0x2b0d('0x8')]('/',auth['isAuthenticated'](),controller[_0x2b0d('0x9')]);router[_0x2b0d('0x8')](_0x2b0d('0xa'),auth[_0x2b0d('0xb')](),controller[_0x2b0d('0xc')]);router[_0x2b0d('0x8')](_0x2b0d('0xd'),auth[_0x2b0d('0xb')](),controller[_0x2b0d('0xe')]);router[_0x2b0d('0x8')]('/:id/messages',auth[_0x2b0d('0xb')](),controller['getMessages']);router[_0x2b0d('0x8')](_0x2b0d('0xf'),auth[_0x2b0d('0xb')](),controller['download']);router[_0x2b0d('0x10')]('/',auth[_0x2b0d('0xb')](),controller[_0x2b0d('0x11')]);router[_0x2b0d('0x10')](_0x2b0d('0x12'),auth[_0x2b0d('0xb')](),controller[_0x2b0d('0x13')]);router[_0x2b0d('0x10')]('/:id/tags',auth[_0x2b0d('0xb')](),interaction[_0x2b0d('0x14')]('sms',_0x2b0d('0x15')),controller[_0x2b0d('0x16')]);router['put'](_0x2b0d('0xd'),auth[_0x2b0d('0xb')](),interaction[_0x2b0d('0x14')](_0x2b0d('0x17'),_0x2b0d('0x18')),controller[_0x2b0d('0x19')]);router[_0x2b0d('0x1a')](_0x2b0d('0xd'),auth[_0x2b0d('0xb')](),interaction[_0x2b0d('0x14')]('sms',_0x2b0d('0x1b')),controller['destroy']);router[_0x2b0d('0x1a')]('/:id/tags',auth[_0x2b0d('0xb')](),controller['removeTags']);module[_0x2b0d('0x1c')]=router; \ No newline at end of file +var _0xce62=['/:id/messages','getMessages','post','create','addMessage','/:id/tags','sms','addTags','put','tracked','smsinteraction:update','update','delete','smsinteraction:destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xce62,0x83));var _0x2ce6=function(_0x13c152,_0x26c3c1){_0x13c152=_0x13c152-0x0;var _0x3bc85f=_0xce62[_0x13c152];return _0x3bc85f;};'use strict';var multer=require(_0x2ce6('0x0'));var util=require(_0x2ce6('0x1'));var path=require('path');var timeout=require(_0x2ce6('0x2'));var express=require(_0x2ce6('0x3'));var router=express[_0x2ce6('0x4')]();var auth=require(_0x2ce6('0x5'));var interaction=require(_0x2ce6('0x6'));var config=require(_0x2ce6('0x7'));var controller=require('./smsInteraction.controller');router[_0x2ce6('0x8')]('/',auth[_0x2ce6('0x9')](),controller[_0x2ce6('0xa')]);router[_0x2ce6('0x8')](_0x2ce6('0xb'),auth[_0x2ce6('0x9')](),controller['describe']);router[_0x2ce6('0x8')](_0x2ce6('0xc'),auth['isAuthenticated'](),controller[_0x2ce6('0xd')]);router[_0x2ce6('0x8')](_0x2ce6('0xe'),auth['isAuthenticated'](),controller[_0x2ce6('0xf')]);router['get']('/:id/download',auth[_0x2ce6('0x9')](),controller['download']);router[_0x2ce6('0x10')]('/',auth['isAuthenticated'](),controller[_0x2ce6('0x11')]);router[_0x2ce6('0x10')](_0x2ce6('0xe'),auth[_0x2ce6('0x9')](),controller[_0x2ce6('0x12')]);router[_0x2ce6('0x10')](_0x2ce6('0x13'),auth[_0x2ce6('0x9')](),interaction['tracked'](_0x2ce6('0x14'),'smsinteraction:addtags'),controller[_0x2ce6('0x15')]);router[_0x2ce6('0x16')](_0x2ce6('0xc'),auth['isAuthenticated'](),interaction[_0x2ce6('0x17')](_0x2ce6('0x14'),_0x2ce6('0x18')),controller[_0x2ce6('0x19')]);router[_0x2ce6('0x1a')](_0x2ce6('0xc'),auth[_0x2ce6('0x9')](),interaction[_0x2ce6('0x17')](_0x2ce6('0x14'),_0x2ce6('0x1b')),controller['destroy']);router[_0x2ce6('0x1a')](_0x2ce6('0x13'),auth[_0x2ce6('0x9')](),controller['removeTags']);module[_0x2ce6('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index a906117..a03131f 100644 --- a/server/api/smsInteraction/smsInteraction.attributes.js +++ b/server/api/smsInteraction/smsInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['moment','STRING','DATE','ENUM','out','sequelize'];(function(_0x58c239,_0x1788bc){var _0x1cd7cb=function(_0x4359b5){while(--_0x4359b5){_0x58c239['push'](_0x58c239['shift']());}};_0x1cd7cb(++_0x1788bc);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0d8b('0x2')]},'note':{'type':Sequelize[_0x0d8b('0x2')]},'phone':{'type':Sequelize[_0x0d8b('0x2')]},'read1stAt':{'type':Sequelize[_0x0d8b('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0d8b('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x0d8b('0x4')]('in',_0x0d8b('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x0713=['DATE','STRING','ENUM','out','exports','BOOLEAN'];(function(_0x19159a,_0x1cb5c3){var _0xa677f4=function(_0x24bb85){while(--_0x24bb85){_0x19159a['push'](_0x19159a['shift']());}};_0xa677f4(++_0x1cb5c3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x3071('0x0')]={'closed':{'type':Sequelize[_0x3071('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3071('0x2')]},'disposition':{'type':Sequelize[_0x3071('0x3')]},'note':{'type':Sequelize[_0x3071('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x3071('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x3071('0x4')]('in',_0x3071('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3071('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x3071('0x4')]('in',_0x3071('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 39a2cb1..698855c 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 _0x4e81=['to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','index','SmsInteraction','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','users','left_join','cm_contacts','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','length','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)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','\x20IS\x20NULL','read','isArray','tag','filter','replace','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?','Sequelize','QueryTypes','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','sequelize','toString','keyBy','merge','a.key','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','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','show','params','rawAttributes','includeAll','options','create','destroy','describe','SmsMessage','addMessage','ids','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','rows','setTags','omit','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','transcript-%d-%s.zip','CmContact','lastName','direction','secret','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','\x0a\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','N.A.','closed','closedAt','disposition','out','firstName','renderFile','views','transcript-','.pdf','log','err','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x4e81,0x1bc));var _0x14e8=function(_0x403fc7,_0x32931a){_0x403fc7=_0x403fc7-0x0;var _0x5d0827=_0x4e81[_0x403fc7];return _0x5d0827;};'use strict';var pdf=require(_0x14e8('0x0'));var emlformat=require(_0x14e8('0x1'));var rimraf=require(_0x14e8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x14e8('0x3'));var BPromise=require(_0x14e8('0x4'));var Mustache=require(_0x14e8('0x5'));var util=require(_0x14e8('0x6'));var path=require(_0x14e8('0x7'));var sox=require(_0x14e8('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x14e8('0x9'));var squel=require(_0x14e8('0xa'));var crypto=require(_0x14e8('0xb'));var jsforce=require(_0x14e8('0xc'));var deskjs=require(_0x14e8('0xd'));var toCsv=require(_0x14e8('0xe'));var querystring=require(_0x14e8('0xf'));var Papa=require(_0x14e8('0x10'));var Redis=require(_0x14e8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x14e8('0x12'));var as=require(_0x14e8('0x13'));var hardwareService=require(_0x14e8('0x14'));var logger=require(_0x14e8('0x15'))(_0x14e8('0x16'));var utils=require(_0x14e8('0x17'));var config=require(_0x14e8('0x18'));var db=require(_0x14e8('0x19'))['db'];config['redis']=_[_0x14e8('0x1a')](config['redis'],{'host':_0x14e8('0x1b'),'port':0x18eb});var socket=require(_0x14e8('0x1c'))(new Redis(config[_0x14e8('0x1d')]));require('./smsInteraction.socket')[_0x14e8('0x1e')](socket);function respondWithStatusCode(_0x4e1064,_0x458e4a){_0x458e4a=_0x458e4a||0xcc;return function(_0x58d26e){if(_0x58d26e){return _0x4e1064[_0x14e8('0x1f')](_0x458e4a);}return _0x4e1064[_0x14e8('0x20')](_0x458e4a)[_0x14e8('0x21')]();};}function respondWithResult(_0x135996,_0x52e64f){_0x52e64f=_0x52e64f||0xc8;return function(_0x10c4a9){if(_0x10c4a9){return _0x135996[_0x14e8('0x20')](_0x52e64f)[_0x14e8('0x22')](_0x10c4a9);}};}function respondWithFilteredResult(_0x412c0a,_0xd4d6b2){return function(_0x1f1a0d){if(_0x1f1a0d){var _0x10dc8b=_0x1f1a0d[_0x14e8('0x23')],_0x462259=_0xd4d6b2[_0x14e8('0x24')],_0x5a38c1=_0xd4d6b2[_0x14e8('0x24')]+_0xd4d6b2[_0x14e8('0x25')],_0x328c5a;if(_0x5a38c1>=_0x10dc8b){_0x5a38c1=_0x10dc8b;_0x328c5a=0xc8;}else{_0x328c5a=0xce;}_0x412c0a['status'](_0x328c5a);return _0x412c0a[_0x14e8('0x26')](_0x14e8('0x27'),_0x462259+'-'+_0x5a38c1+'/'+_0x10dc8b)[_0x14e8('0x22')](_0x1f1a0d);}return null;};}function patchUpdates(_0x48e30a){return function(_0x2c3f45){try{jsonpatch['apply'](_0x2c3f45,_0x48e30a,!![]);}catch(_0x4cca43){return BPromise[_0x14e8('0x28')](_0x4cca43);}return _0x2c3f45[_0x14e8('0x29')]();};}function saveUpdates(_0x117b00,_0xcf673){return function(_0x4ad25d){if(_0x4ad25d){return _0x4ad25d[_0x14e8('0x2a')](_0x117b00)['then'](function(_0x31bdd3){return _0x31bdd3;});}return null;};}function removeEntity(_0x185a0e,_0x4ffc8b){return function(_0x58a3a1){if(_0x58a3a1){return _0x58a3a1['destroy']()[_0x14e8('0x2b')](function(){_0x185a0e[_0x14e8('0x20')](0xcc)[_0x14e8('0x21')]();});}};}function handleEntityNotFound(_0x20bfe8,_0x333d44){return function(_0x57eb46){if(!_0x57eb46){_0x20bfe8[_0x14e8('0x1f')](0x194);}return _0x57eb46;};}function handleError(_0x3fd96d,_0x3c09cb){_0x3c09cb=_0x3c09cb||0x1f4;return function(_0x2f5818){logger[_0x14e8('0x2c')](_0x2f5818[_0x14e8('0x2d')]);if(_0x2f5818[_0x14e8('0x2e')]){delete _0x2f5818['name'];}_0x3fd96d[_0x14e8('0x20')](_0x3c09cb)[_0x14e8('0x2f')](_0x2f5818);};}function getInteractionUsers(_0x393ab0,_0x5f5abb){return new BPromise(function(_0x48eed0,_0x5cacd7){try{if(_0x5f5abb[_0x393ab0['id']]){_0x393ab0[_0x14e8('0x30')]=_[_0x14e8('0x31')](_0x5f5abb[_0x393ab0['id']],function(_0x567385){return{'id':_0x567385['id'],'fullname':_0x567385[_0x14e8('0x32')]};});}}catch(_0x1d71ca){_0x5cacd7(_0x1d71ca);}_0x48eed0(_0x393ab0);});}function getInteractionTags(_0x176e8f,_0xa83433){return new BPromise(function(_0x5c2635,_0x1f1259){try{if(_0x176e8f[_0x14e8('0x33')]){_0x176e8f[_0x14e8('0x34')]=[];_0x176e8f[_0x14e8('0x33')][_0x14e8('0x35')](',')['forEach'](function(_0x2f83c3){_0x176e8f[_0x14e8('0x34')][_0x14e8('0x36')](_0xa83433[_0x2f83c3]);});}delete _0x176e8f[_0x14e8('0x33')];}catch(_0x538764){_0x1f1259(_0x538764);}_0x5c2635(_0x176e8f);});}function updateSmsInteraction(_0xbb8003,_0x4fe501,_0x14a038){return new BPromise(function(_0x44c6fb,_0x1f4876){return getInteractionUsers(_0xbb8003,_0x14a038)[_0x14e8('0x2b')](function(_0x17fc40){return getInteractionTags(_0x17fc40,_0x4fe501);})[_0x14e8('0x2b')](function(_0xbe9eab){_0x44c6fb(_0xbe9eab);})[_0x14e8('0x37')](function(_0xd144b){_0x1f4876(_0xd144b);});});}exports[_0x14e8('0x38')]=function(_0x13dec7,_0x4411e9){var _0x54e624={},_0x54ff6d={},_0x4dac15={'count':0x0,'rows':[]};var _0x16ff09=_['map'](db[_0x14e8('0x39')]['rawAttributes'],function(_0x16afca){return{'name':_0x16afca[_0x14e8('0x3a')],'type':_0x16afca[_0x14e8('0x3b')][_0x14e8('0x3c')]};});_0x54ff6d['model']=_[_0x14e8('0x31')](_0x16ff09,'name');_0x54ff6d[_0x14e8('0x3d')]=_[_0x14e8('0x3e')](_0x13dec7[_0x14e8('0x3d')]);_0x54ff6d[_0x14e8('0x3f')]=_[_0x14e8('0x40')](_0x54ff6d[_0x14e8('0x41')],_0x54ff6d['query']);_0x54e624[_0x14e8('0x42')]=_['intersection'](_0x54ff6d[_0x14e8('0x41')],qs[_0x14e8('0x43')](_0x13dec7[_0x14e8('0x3d')]['fields']));_0x54e624[_0x14e8('0x42')]=_0x54e624[_0x14e8('0x42')]['length']?_0x54e624[_0x14e8('0x42')]:_0x54ff6d[_0x14e8('0x41')];if(!_0x13dec7[_0x14e8('0x3d')][_0x14e8('0x44')](_0x14e8('0x45'))){_0x54e624[_0x14e8('0x25')]=qs[_0x14e8('0x25')](_0x13dec7[_0x14e8('0x3d')][_0x14e8('0x25')]);_0x54e624[_0x14e8('0x24')]=qs[_0x14e8('0x24')](_0x13dec7[_0x14e8('0x3d')][_0x14e8('0x24')]);}_0x54e624[_0x14e8('0x46')]=qs[_0x14e8('0x47')](_0x13dec7['query'][_0x14e8('0x47')]);_0x54e624['where']=qs['filters'](_['pick'](_0x13dec7[_0x14e8('0x3d')],_0x54ff6d['filters']),_0x16ff09);var _0x46a3c4=[];var _0x45bff0=squel[_0x14e8('0x48')]()[_0x14e8('0x49')]('id')[_0x14e8('0x49')](_0x14e8('0x2e'))[_0x14e8('0x49')](_0x14e8('0x4a'))[_0x14e8('0x4b')](_0x14e8('0x4c'));var _0x6c3e1f=squel['select']()[_0x14e8('0x49')](_0x14e8('0x4d'))[_0x14e8('0x49')](_0x14e8('0x4e'))['field'](_0x14e8('0x4f'))[_0x14e8('0x4b')]('user_has_sms_interactions','ui')['left_join'](_0x14e8('0x50'),'u','u.id\x20=\x20ui.UserId');var _0x58b609=squel[_0x14e8('0x48')]()[_0x14e8('0x4b')]('sms_interactions','i')[_0x14e8('0x51')](_0x14e8('0x52'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x14e8('0x51')](_0x14e8('0x50'),'o',_0x14e8('0x53'))[_0x14e8('0x51')](_0x14e8('0x54'),'a',_0x14e8('0x55'))[_0x14e8('0x51')](_0x14e8('0x56'),'me',_0x14e8('0x57'))[_0x14e8('0x51')](_0x14e8('0x58'),'it',_0x14e8('0x59'))[_0x14e8('0x51')](_0x14e8('0x4c'),'t',_0x14e8('0x5a'));var _0x1f50bc=squel['expr']();var _0x40aa43=[];var _0x49324a=squel[_0x14e8('0x5b')]();var _0x3fadc2;if(_0x13dec7[_0x14e8('0x3d')][_0x14e8('0x5c')]){_0x3fadc2=as['parseSearch'](_0x13dec7['query']['search']);var _0x291fe2=_0x3fadc2['sqlOperator'];for(var _0x55f9b0=0x0;_0x55f9b0<_0x3fadc2[_0x14e8('0x5d')][_0x14e8('0x5e')];_0x55f9b0++){var _0x590bcd=_0x3fadc2[_0x14e8('0x5d')][_0x55f9b0];var _0x27e319='i';var _0x7d6759=_[_0x14e8('0x5f')](_0x16ff09,['name',_0x590bcd['field']]);if(!_0x7d6759){switch(_0x590bcd[_0x14e8('0x49')]){case _0x14e8('0x60'):if(_0x590bcd[_0x14e8('0x61')]==0x1){_0x58b609[_0x14e8('0x62')]('`'+_0x590bcd[_0x14e8('0x49')]+_0x14e8('0x63'));}else{_0x58b609['having']('`'+_0x590bcd[_0x14e8('0x49')]+_0x14e8('0x64'));}break;case _0x14e8('0x65'):if(_0x590bcd[_0x14e8('0x66')]==='$substring'){if(_0x590bcd[_0x14e8('0x61')][_0x14e8('0x35')]('\x20')[_0x14e8('0x5e')]>0x1){_0x1f50bc[_0x291fe2](_0x14e8('0x67'),qs['getFullTextValue'](_0x590bcd[_0x14e8('0x61')]),null);}else{var _0x45020b='%'+_0x590bcd[_0x14e8('0x61')]+'%';_0x1f50bc[_0x291fe2](_0x14e8('0x68'),_0x45020b,_0x45020b,_0x45020b);}}else{_0x7d6759=_[_0x14e8('0x5f')](_0x16ff09,[_0x14e8('0x2e'),_0x14e8('0x69')]);_0x590bcd[_0x14e8('0x49')]='ContactId';_0x4848be=as['buildExpression'](_0x27e319,_0x7d6759[_0x14e8('0x3b')],_0x590bcd);_0x1f50bc[_0x291fe2](_0x4848be[_0x14e8('0x6a')],_0x4848be[_0x14e8('0x61')][_0x14e8('0x6b')],_0x4848be[_0x14e8('0x61')]['end']);}break;case'Tag':var _0x4c49e5=_0x590bcd[_0x14e8('0x61')][_0x14e8('0x35')](',')[_0x14e8('0x31')](function(_0x58e2a4){return Number(_0x58e2a4);});_0x4c49e5[_0x14e8('0x6c')](function(_0xbd38ae){_0x49324a['or'](_0x14e8('0x6d'),'%,'+_0xbd38ae+',%');});_0x40aa43=_['union'](_0x40aa43,_0x4c49e5);break;case _0x14e8('0x6e'):if(_0x590bcd[_0x14e8('0x66')]===_0x14e8('0x6f')){_0x1f50bc[_0x291fe2](_0x14e8('0x70'),'%'+_0x590bcd[_0x14e8('0x61')]+'%',null);}else{_0x7d6759=_[_0x14e8('0x5f')](_0x16ff09,[_0x14e8('0x2e'),_0x14e8('0x71')]);_0x590bcd[_0x14e8('0x49')]=_0x14e8('0x71');_0x4848be=as[_0x14e8('0x72')](_0x27e319,_0x7d6759['type'],_0x590bcd);_0x1f50bc[_0x291fe2](_0x4848be[_0x14e8('0x6a')],_0x4848be[_0x14e8('0x61')][_0x14e8('0x6b')],_0x4848be[_0x14e8('0x61')][_0x14e8('0x21')]);}break;case _0x14e8('0x73'):_0x4848be=as[_0x14e8('0x72')]('me',null,_0x590bcd);_0x1f50bc[_0x291fe2](_0x4848be[_0x14e8('0x6a')],_0x4848be[_0x14e8('0x61')][_0x14e8('0x6b')],_0x4848be[_0x14e8('0x61')][_0x14e8('0x21')]);break;}}else{var _0x4848be=as[_0x14e8('0x72')](_0x27e319,_0x7d6759[_0x14e8('0x3b')],_0x590bcd);_0x1f50bc[_0x291fe2](_0x4848be['text'],_0x4848be[_0x14e8('0x61')][_0x14e8('0x6b')],_0x4848be[_0x14e8('0x61')][_0x14e8('0x21')]);}}}else{var _0x3228ea=_(_0x13dec7[_0x14e8('0x3d')])[_0x14e8('0x3e')]()['map'](function(_0x4c30dd){return _['some'](_0x16ff09,[_0x14e8('0x2e'),_0x4c30dd])?_0x4c30dd:undefined;})[_0x14e8('0x74')]()[_0x14e8('0x61')]();if(!_[_0x14e8('0x75')](_0x3228ea)){_0x3228ea[_0x14e8('0x6c')](function(_0x369c3b){if(_0x369c3b===_0x14e8('0x76')){_0x58b609['where'](_0x14e8('0x77'),[][_0x14e8('0x78')](_0x13dec7['query'][_0x369c3b]));}else if(_0x369c3b===_0x14e8('0x79')){var _0x3a5602=JSON['parse'](_0x13dec7['query'][_0x369c3b])['$gte'];var _0x379734=JSON[_0x14e8('0x7a')](_0x13dec7[_0x14e8('0x3d')][_0x369c3b])[_0x14e8('0x7b')];_0x58b609['where'](_0x14e8('0x7c'),_0x3a5602,_0x379734);}else{if(_0x13dec7[_0x14e8('0x3d')][_0x369c3b]===_0x14e8('0x7d')){_0x58b609[_0x14e8('0x7e')]('i.'+_0x369c3b+_0x14e8('0x7f'));}else{_0x58b609[_0x14e8('0x7e')]('i.'+_0x369c3b+'\x20=\x20?',_0x13dec7[_0x14e8('0x3d')][_0x369c3b]);}}});}if(_0x13dec7[_0x14e8('0x3d')][_0x14e8('0x80')]){if(_0x13dec7['query']['read']==0x1){_0x58b609[_0x14e8('0x62')]('`unreadMessages`\x20=\x200');}else{_0x58b609[_0x14e8('0x62')]('`unreadMessages`\x20>\x200');}}if(_0x13dec7[_0x14e8('0x3d')]['tag']){_0x40aa43=_[_0x14e8('0x81')](_0x13dec7[_0x14e8('0x3d')]['tag'])?_0x13dec7[_0x14e8('0x3d')][_0x14e8('0x82')]:new Array(_0x13dec7[_0x14e8('0x3d')][_0x14e8('0x82')]);_0x40aa43[_0x14e8('0x6c')](function(_0x6dee32){_0x49324a['or'](_0x14e8('0x6d'),'%,'+_0x6dee32+',%');});}if(_0x13dec7[_0x14e8('0x3d')][_0x14e8('0x83')]){var _0x3858cf=_0x13dec7[_0x14e8('0x3d')][_0x14e8('0x83')][_0x14e8('0x84')]('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs['isNumeric'](_0x3858cf)){_0x1f50bc['or'](_0x14e8('0x85'),_0x3858cf+'%')['or'](_0x14e8('0x86'),_0x3858cf+'%');}else{_0x1f50bc['or'](_0x14e8('0x87'),qs['getFullTextValue'](_0x3858cf))['or'](_0x14e8('0x88'),_0x3858cf+'%');}}}_0x58b609['where'](_0x1f50bc);_0x58b609['group']('i.id');var _0x304328={'type':db[_0x14e8('0x89')][_0x14e8('0x8a')]['SELECT'],'raw':!![]};var _0xfc647b=_0x58b609['clone']();_0xfc647b[_0x14e8('0x49')](_0x14e8('0x8b'));_0xfc647b[_0x14e8('0x49')](_0x14e8('0x8c'),_0x14e8('0x60'));if(_0x54e624[_0x14e8('0x46')]){_0x54e624[_0x14e8('0x46')][_0x14e8('0x6c')](function(_0x25e26d){_0x58b609['order']('i.'+_0x25e26d[0x0],_0x25e26d[0x1]===_0x14e8('0x8d')?![]:!![]);});}if(!_['isEmpty'](_0x40aa43)){_0x58b609[_0x14e8('0x62')](_0x49324a);_0xfc647b[_0x14e8('0x7e')](_0x14e8('0x8e'),_0x40aa43);}BPromise[_0x14e8('0x8f')]()[_0x14e8('0x2b')](function(){if(!_0x3fadc2){if(_0x13dec7[_0x14e8('0x3d')][_0x14e8('0x76')]||_0x13dec7[_0x14e8('0x3d')][_0x14e8('0x90')])return;_0xfc647b['where'](_0x14e8('0x91'));_0x58b609[_0x14e8('0x7e')](_0x14e8('0x91'));return;}return _0x13dec7[_0x14e8('0x92')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x14e8('0x2b')](function(_0x21ead5){if(_[_0x14e8('0x75')](_0x21ead5)){_0xfc647b[_0x14e8('0x7e')]('i.SmsAccountId\x20IS\x20NULL');_0x58b609[_0x14e8('0x7e')]('i.SmsAccountId\x20IS\x20NULL');}else{_0xfc647b[_0x14e8('0x7e')]('i.SmsAccountId\x20IN\x20?',_['map'](_0x21ead5,'id'));_0x58b609[_0x14e8('0x7e')](_0x14e8('0x77'),_[_0x14e8('0x31')](_0x21ead5,'id'));}});})[_0x14e8('0x2b')](function(){db[_0x14e8('0x93')][_0x14e8('0x3d')](_0xfc647b[_0x14e8('0x94')](),_0x304328)[_0x14e8('0x2b')](function(_0x14d4b7){_0x4dac15[_0x14e8('0x23')]=_0x14d4b7[_0x14e8('0x5e')];if(_0x4dac15['count']===0x0)return[];return db[_0x14e8('0x93')][_0x14e8('0x3d')](_0x45bff0[_0x14e8('0x94')](),_0x304328)['then'](function(_0x5a9e57){_0x46a3c4=_[_0x14e8('0x95')](_0x5a9e57,'id');_0x304328=_[_0x14e8('0x96')](_0x304328,{'model':db[_0x14e8('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x13dec7[_0x14e8('0x3d')][_0x14e8('0x43')]){_0x54e624[_0x14e8('0x42')][_0x14e8('0x6c')](function(_0x196815){_0x58b609[_0x14e8('0x49')]('i.'+_0x196815);});}else{_0x58b609[_0x14e8('0x49')](_0x14e8('0x8c'),_0x14e8('0x60'));_0x58b609[_0x14e8('0x49')](_0x14e8('0x97'),'Account.key');_0x58b609[_0x14e8('0x49')]('a.mandatoryDisposition',_0x14e8('0x98'));_0x58b609[_0x14e8('0x49')](_0x14e8('0x99'));_0x58b609[_0x14e8('0x49')](_0x14e8('0x9a'),_0x14e8('0x9b'));_0x58b609['field'](_0x14e8('0x9c'),_0x14e8('0x9d'));_0x58b609['field'](_0x14e8('0x9e'),_0x14e8('0x9f'));_0x58b609[_0x14e8('0x49')]('c.phone',_0x14e8('0xa0'));_0x58b609[_0x14e8('0x49')](_0x14e8('0xa1'),_0x14e8('0xa2'));_0x58b609[_0x14e8('0x49')](_0x14e8('0xa3'),_0x14e8('0xa4'));_0x58b609[_0x14e8('0x49')](_0x14e8('0xa5'),_0x14e8('0xa6'));_0x58b609[_0x14e8('0x49')](_0x14e8('0xa7'),'Owner.internal');_0x58b609[_0x14e8('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x54e624[_0x14e8('0x25')])_0x58b609['limit'](_0x54e624[_0x14e8('0x25')]);if(_0x54e624[_0x14e8('0x24')])_0x58b609[_0x14e8('0x24')](_0x54e624[_0x14e8('0x24')]);return db['sequelize'][_0x14e8('0x3d')](_0x58b609[_0x14e8('0x94')](),_0x304328);})[_0x14e8('0x2b')](function(_0x509c76){_0x6c3e1f['where'](_0x14e8('0xa8'),_[_0x14e8('0x31')](_0x509c76,'id'));return db[_0x14e8('0x93')]['query'](_0x6c3e1f[_0x14e8('0x94')](),_0x304328)[_0x14e8('0x2b')](function(_0x4e57c6){var _0x2c7c45=_[_0x14e8('0xa9')](_0x4e57c6,_0x14e8('0xaa'));var _0x4a05b3=[];_0x509c76[_0x14e8('0x6c')](function(_0x2015d3){_0x4a05b3[_0x14e8('0x36')](updateSmsInteraction(_0x2015d3,_0x46a3c4,_0x2c7c45));});return BPromise[_0x14e8('0xab')](_0x4a05b3);});});})[_0x14e8('0x2b')](function(_0x214dcf){_0x4dac15['rows']=_0x214dcf;return _0x4dac15;})[_0x14e8('0x2b')](respondWithFilteredResult(_0x4411e9,_0x54e624));})['catch'](handleError(_0x4411e9,null));};exports[_0x14e8('0xac')]=function(_0xe738a2,_0x10e9ac){var _0x58fa79={'raw':![],'where':{'id':_0xe738a2[_0x14e8('0xad')]['id']}},_0x4cf205={};_0x4cf205[_0x14e8('0x41')]=_[_0x14e8('0x3e')](db[_0x14e8('0x39')][_0x14e8('0xae')]);_0x4cf205[_0x14e8('0x3d')]=_['keys'](_0xe738a2[_0x14e8('0x3d')]);_0x4cf205['filters']=_[_0x14e8('0x40')](_0x4cf205[_0x14e8('0x41')],_0x4cf205[_0x14e8('0x3d')]);_0x58fa79['attributes']=_[_0x14e8('0x40')](_0x4cf205[_0x14e8('0x41')],qs[_0x14e8('0x43')](_0xe738a2[_0x14e8('0x3d')][_0x14e8('0x43')]));_0x58fa79['attributes']=_0x58fa79[_0x14e8('0x42')][_0x14e8('0x5e')]?_0x58fa79['attributes']:_0x4cf205['model'];if(_0xe738a2['query'][_0x14e8('0xaf')]){_0x58fa79['include']=[{'all':!![]}];}_0x58fa79=_[_0x14e8('0x96')]({},_0x58fa79,_0xe738a2[_0x14e8('0xb0')]);return db[_0x14e8('0x39')][_0x14e8('0x5f')](_0x58fa79)[_0x14e8('0x2b')](handleEntityNotFound(_0x10e9ac,null))[_0x14e8('0x2b')](respondWithResult(_0x10e9ac,null))[_0x14e8('0x37')](handleError(_0x10e9ac,null));};exports[_0x14e8('0xb1')]=function(_0x2eb108,_0x586f7f){return db[_0x14e8('0x39')]['create'](_0x2eb108[_0x14e8('0x73')],{})[_0x14e8('0x2b')](respondWithResult(_0x586f7f,0xc9))['catch'](handleError(_0x586f7f,null));};exports[_0x14e8('0x2a')]=function(_0x525408,_0x15784f){if(_0x525408[_0x14e8('0x73')]['id']){delete _0x525408[_0x14e8('0x73')]['id'];}return db['SmsInteraction'][_0x14e8('0x5f')]({'where':{'id':_0x525408['params']['id']}})[_0x14e8('0x2b')](handleEntityNotFound(_0x15784f,null))['then'](saveUpdates(_0x525408['body'],null))['then'](respondWithResult(_0x15784f,null))[_0x14e8('0x37')](handleError(_0x15784f,null));};exports[_0x14e8('0xb2')]=function(_0xd6f663,_0x29d121){return db['SmsInteraction']['find']({'where':{'id':_0xd6f663[_0x14e8('0xad')]['id']}})['then'](handleEntityNotFound(_0x29d121,null))[_0x14e8('0x2b')](removeEntity(_0x29d121,null))[_0x14e8('0x37')](handleError(_0x29d121,null));};exports['describe']=function(_0x4d80d2,_0x14846c){return db[_0x14e8('0x39')][_0x14e8('0xb3')]()['then'](respondWithResult(_0x14846c,null))[_0x14e8('0x37')](handleError(_0x14846c,null));};exports['addMessage']=function(_0x151b58,_0x1c0986,_0x22a8ca){return db[_0x14e8('0xb4')][_0x14e8('0x5f')]({'where':{'id':_0x151b58[_0x14e8('0xad')]['id']}})[_0x14e8('0x2b')](handleEntityNotFound(_0x1c0986,null))[_0x14e8('0x2b')](function(_0x110a61){if(_0x110a61){return _0x110a61[_0x14e8('0xb5')](_0x151b58[_0x14e8('0x73')][_0x14e8('0xb6')],_['omit'](_0x151b58[_0x14e8('0x73')],[_0x14e8('0xb6'),'id'])||{});}})[_0x14e8('0x2b')](respondWithResult(_0x1c0986,null))[_0x14e8('0x37')](handleError(_0x1c0986,null));};exports['getMessages']=function(_0x2f342d,_0x5ba50f,_0x28b9d1){var _0xb378={'raw':![],'where':{}};var _0x1262c1={};var _0x1c3036={'count':0x0,'rows':[]};return db[_0x14e8('0x39')][_0x14e8('0xb7')]({'where':{'id':_0x2f342d[_0x14e8('0xad')]['id']}})[_0x14e8('0x2b')](handleEntityNotFound(_0x5ba50f,null))[_0x14e8('0x2b')](function(_0x387ded){if(_0x387ded){_0x1262c1[_0x14e8('0x41')]=_[_0x14e8('0x3e')](db[_0x14e8('0xb4')]['rawAttributes']);_0x1262c1['query']=_[_0x14e8('0x3e')](_0x2f342d['query']);_0x1262c1[_0x14e8('0x3f')]=_[_0x14e8('0x40')](_0x1262c1['model'],_0x1262c1[_0x14e8('0x3d')]);_0xb378[_0x14e8('0x42')]=_[_0x14e8('0x40')](_0x1262c1[_0x14e8('0x41')],qs[_0x14e8('0x43')](_0x2f342d[_0x14e8('0x3d')]['fields']));_0xb378[_0x14e8('0x42')]=_0xb378[_0x14e8('0x42')][_0x14e8('0x5e')]?_0xb378[_0x14e8('0x42')]:_0x1262c1[_0x14e8('0x41')];if(!_0x2f342d['query'][_0x14e8('0x44')]('nolimit')){_0xb378['limit']=qs[_0x14e8('0x25')](_0x2f342d[_0x14e8('0x3d')]['limit']);_0xb378[_0x14e8('0x24')]=qs['offset'](_0x2f342d[_0x14e8('0x3d')][_0x14e8('0x24')]);}_0xb378['order']=qs[_0x14e8('0x47')](_0x2f342d[_0x14e8('0x3d')][_0x14e8('0x47')]);_0xb378[_0x14e8('0x7e')]=qs[_0x14e8('0x3f')](_['pick'](_0x2f342d[_0x14e8('0x3d')],_0x1262c1[_0x14e8('0x3f')]));_0xb378[_0x14e8('0x7e')]['SmsInteractionId']=_0x387ded['id'];if(_0x2f342d['query'][_0x14e8('0x83')]){_0xb378['where']=_['merge'](_0xb378[_0x14e8('0x7e')],{'$or':_['map'](_0xb378['attributes'],function(_0x814975){var _0x300270={};_0x300270[_0x814975]={'$like':'%'+_0x2f342d[_0x14e8('0x3d')]['filter']+'%'};return _0x300270;})});}if(_0x2f342d[_0x14e8('0x3d')]['$gte']){var _0x52e21a=_0x2f342d['query'][_0x14e8('0xb8')][_0x14e8('0x35')](',');var _0x1607be={};_0x1607be[_0x52e21a[0x0]]={'$gte':moment(_0x52e21a[0x1])[_0x14e8('0xb9')](_0x14e8('0xba'))};_0xb378['where']=_[_0x14e8('0x96')](_0xb378[_0x14e8('0x7e')],_0x1607be);}_0xb378=_[_0x14e8('0x96')]({},_0xb378,_0x2f342d[_0x14e8('0xb0')]);return db[_0x14e8('0xb4')][_0x14e8('0x23')]({'where':_0xb378[_0x14e8('0x7e')]})[_0x14e8('0x2b')](function(_0x40e637){_0x1c3036[_0x14e8('0x23')]=_0x40e637;if(_0x2f342d[_0x14e8('0x3d')][_0x14e8('0xaf')]){_0xb378[_0x14e8('0xbb')]=[{'all':!![]}];}return db[_0x14e8('0xb4')][_0x14e8('0xbc')](_0xb378);})['then'](function(_0x2bd99e){_0x1c3036[_0x14e8('0xbd')]=_0x2bd99e;return _0x1c3036;});}})[_0x14e8('0x2b')](respondWithFilteredResult(_0x5ba50f,_0xb378))[_0x14e8('0x37')](handleError(_0x5ba50f,null));};exports['addTags']=function(_0x2f5465,_0x9401b7,_0x2801e9){return db[_0x14e8('0x39')]['find']({'where':{'id':_0x2f5465[_0x14e8('0xad')]['id']}})[_0x14e8('0x2b')](handleEntityNotFound(_0x9401b7,null))[_0x14e8('0x2b')](function(_0x3844c9){if(_0x3844c9){return _0x3844c9[_0x14e8('0xbe')](_0x2f5465[_0x14e8('0x73')][_0x14e8('0xb6')],_[_0x14e8('0xbf')](_0x2f5465['body'],[_0x14e8('0xb6'),'id'])||{})[_0x14e8('0xc0')](function(){return db[_0x14e8('0xc1')][_0x14e8('0xbc')]({'attributes':['id',_0x14e8('0x2e'),_0x14e8('0x4a')],'where':{'id':_0x2f5465['body'][_0x14e8('0xb6')]}});})[_0x14e8('0x2b')](function(_0x376023){socket[_0x14e8('0xc2')](_0x14e8('0xc3'),{'id':Number(_0x2f5465['params']['id']),'tags':_0x376023||[]});return{'id':Number(_0x2f5465[_0x14e8('0xad')]['id']),'tags':_0x376023||[]};});}})[_0x14e8('0x2b')](respondWithResult(_0x9401b7,null))[_0x14e8('0x37')](handleError(_0x9401b7,null));};exports[_0x14e8('0xc4')]=function(_0x3b390b,_0x3f2edc,_0x1ad0ce){return db[_0x14e8('0x39')]['find']({'where':{'id':_0x3b390b[_0x14e8('0xad')]['id']}})[_0x14e8('0x2b')](handleEntityNotFound(_0x3f2edc,null))[_0x14e8('0x2b')](function(_0x549f96){if(_0x549f96){return _0x549f96[_0x14e8('0xc4')](_0x3b390b['query']['ids']);}})[_0x14e8('0x2b')](respondWithStatusCode(_0x3f2edc,null))['catch'](handleError(_0x3f2edc,null));};exports[_0x14e8('0xc5')]=function(_0x3950fa,_0x767357){var _0x3e989d=moment()[_0x14e8('0xc6')]()[_0x14e8('0x94')]();var _0x446b97=path[_0x14e8('0xc7')](config['root'],_0x14e8('0xc8'),_0x14e8('0xc9'),_0x14e8('0xca'));var _0x2cf8bf=path[_0x14e8('0xc7')](config[_0x14e8('0xcb')],_0x14e8('0xc8'),'files','attachments');var _0x539785=path[_0x14e8('0xc7')](_0x446b97,_0x3e989d);var _0x330160=util['format'](_0x14e8('0xcc'),_0x3950fa['params']['id'],_0x3e989d);var _0xb46471=path[_0x14e8('0xc7')](_0x446b97,_0x330160);var _0x7accea=[];_0x7accea[_0x14e8('0x36')]({'model':db['User'],'as':_0x14e8('0x6e'),'attributes':['id',_0x14e8('0x32')],'raw':!![]});_0x7accea[_0x14e8('0x36')]({'model':db[_0x14e8('0xcd')],'as':_0x14e8('0x65'),'attributes':['id','firstName',_0x14e8('0xce')],'raw':!![]});var _0x46b097=[{'model':db[_0x14e8('0xb4')],'as':'Messages','attributes':['id','body',_0x14e8('0x79'),_0x14e8('0xcf'),_0x14e8('0xd0'),_0x14e8('0x80')],'include':_0x7accea}];_0x46b097[_0x14e8('0x36')]({'model':db['SmsAccount'],'as':'Account','attributes':['id','name']});_0x46b097[_0x14e8('0x36')]({'model':db['User'],'as':_0x14e8('0xd1'),'attributes':['id',_0x14e8('0x32')]});return db['SmsInteraction']['find']({'where':{'id':_0x3950fa[_0x14e8('0xad')]['id']},'include':_0x46b097})[_0x14e8('0x2b')](handleEntityNotFound(_0x767357,null))['then'](function(_0x4120e1){if(_0x4120e1){var _0x92e465=_0x4120e1[_0x14e8('0xd2')]({'plain':!![]});fs['mkdirSync'](_0x539785);var _0xe9ecf4={'format':'A4','border':_0x14e8('0xd3'),'header':{'height':_0x14e8('0xd4'),'contents':{'first':_0x14e8('0xd5')}},'footer':{'height':'30px','contents':{'default':util[_0x14e8('0xb9')](_0x14e8('0xd6'),util[_0x14e8('0xb9')](_0x14e8('0xd7'),_0x14e8('0xd8'),_0x92e465['id']),moment()['format']('YYYY-MM-DD')['toString']())}}};var _0x4611f9={'channel':_0x14e8('0xd8'),'account':_0x92e465['Account']['name'],'agent':_0x92e465['Owner']?_0x92e465[_0x14e8('0xd1')][_0x14e8('0x32')]:_0x14e8('0xd9'),'createdAt':moment(_0x92e465[_0x14e8('0x79')])[_0x14e8('0xb9')](_0x14e8('0xba'))[_0x14e8('0x94')](),'closedAt':_0x92e465[_0x14e8('0xda')]?moment(_0x92e465[_0x14e8('0xdb')])[_0x14e8('0xb9')](_0x14e8('0xba'))[_0x14e8('0x94')]():'','disposition':_0x92e465[_0x14e8('0xdc')],'messages':_(_0x92e465['Messages'])['filter']({'secret':![]})[_0x14e8('0x31')](function(_0x1b7dbf){return{'date':moment(_0x1b7dbf[_0x14e8('0x79')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x14e8('0x94')](),'sender':_0x1b7dbf[_0x14e8('0xcf')]===_0x14e8('0xdd')?_0x1b7dbf[_0x14e8('0x6e')]?_0x1b7dbf[_0x14e8('0x6e')][_0x14e8('0x32')]:'System':_0x1b7dbf[_0x14e8('0x65')][_0x14e8('0xde')]+(_0x1b7dbf[_0x14e8('0x65')]['lastName']?'\x20'+_0x1b7dbf[_0x14e8('0x65')][_0x14e8('0xce')]:''),'body':_0x1b7dbf[_0x14e8('0x73')],'direction':_0x1b7dbf[_0x14e8('0xcf')]===_0x14e8('0xdd')?'A':'C','secret':_0x1b7dbf[_0x14e8('0xd0')],'read':_0x1b7dbf[_0x14e8('0x80')]};})['value']()};return ejs[_0x14e8('0xdf')](path['join'](config['root'],_0x14e8('0xc8'),_0x14e8('0xe0'),'downloadInteraction.html'),{'interaction':_0x4611f9})[_0x14e8('0x2b')](function(_0x5e3dba){return new BPromise(function(_0x12516d,_0x3a4a17){pdf['create'](_0x5e3dba,_0xe9ecf4)['toFile'](path[_0x14e8('0xc7')](_0x539785,_0x14e8('0xe1')+_0x92e465['id']+'-'+_0x3e989d+_0x14e8('0xe2')),function(_0x42b79c,_0x82e208){if(_0x42b79c)return _0x3a4a17(_0x42b79c);_0x12516d(_0x82e208);});});})[_0x14e8('0x2b')](function(){return new BPromise(function(_0x473c25,_0x30926e){zipdir(_0x539785,{'saveTo':_0xb46471},function(_0x368c89,_0x356320){if(_0x368c89)return _0x30926e(_0x368c89);return _0x473c25(_0x356320);});})[_0x14e8('0x2b')](function(){return new BPromise(function(_0x5e63ce,_0xf2af74){rimraf(_0x539785,function(_0x1dd8cf){if(_0x1dd8cf)_0xf2af74(_0x1dd8cf);return _0x5e63ce();});});})[_0x14e8('0x2b')](function(){return _0x767357['download'](_0xb46471,_0x330160,function(_0x3cf235){if(_0x3cf235){console[_0x14e8('0xe3')](_0x14e8('0xe4'),_0x3cf235);}else{fs['unlinkSync'](_0xb46471);}});});});}else{return _0x767357[_0x14e8('0x1f')](0xc8);}})[_0x14e8('0x37')](handleError(_0x767357,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(_0x2c1592,_0x32b4f4){var _0xe9702d=function(_0x2a8556){while(--_0x2a8556){_0x2c1592['push'](_0x2c1592['shift']());}};_0xe9702d(++_0x32b4f4);}(_0x6c76,0x184));var _0x66c7=function(_0x5ce55c,_0x63d267){_0x5ce55c=_0x5ce55c-0x0;var _0x170d04=_0x6c76[_0x5ce55c];return _0x170d04;};'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 e10dde4..917e55e 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 _0x84e7=['length','emit','catch','hook','exports','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','update','remove','then','setDataValue','Users','findAll'];(function(_0x3d60a8,_0x3dd7c8){var _0x434106=function(_0x58f833){while(--_0x58f833){_0x3d60a8['push'](_0x3d60a8['shift']());}};_0x434106(++_0x3dd7c8);}(_0x84e7,0x122));var _0x784e=function(_0x583571,_0x55f9d4){_0x583571=_0x583571-0x0;var _0x5666ef=_0x84e7[_0x583571];return _0x5666ef;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x784e('0x0'))['db'][_0x784e('0x1')];var SmsMessage=require('../../mysqldb')['db'][_0x784e('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x784e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x784e('0x4'),'afterDestroy':_0x784e('0x5')};function emitEvent(_0x205619){return function(_0xdc7692,_0x42993b,_0x133296){_0xdc7692['getUsers']({'attributes':['id'],'raw':!![]})[_0x784e('0x6')](function(_0x5d5595){_0xdc7692[_0x784e('0x7')](_0x784e('0x8'),_0x5d5595['map'](function(_0x18be55){return{'id':_0x18be55['id']};}));return SmsMessage[_0x784e('0x9')]({'where':{'SmsInteractionId':_0xdc7692['id'],'direction':'in','read':![]},'raw':!![]});})[_0x784e('0x6')](function(_0x3ddd55){_0xdc7692['setDataValue']('unreadMessages',_0x3ddd55[_0x784e('0xa')]);SmsInteractionEvents[_0x784e('0xb')](_0x205619+':'+_0xdc7692['id'],_0xdc7692);SmsInteractionEvents[_0x784e('0xb')](_0x205619,_0xdc7692);_0x133296(null);})[_0x784e('0xc')](_0x133296(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x784e('0xd')](e,emitEvent(event));}}module[_0x784e('0xe')]=SmsInteractionEvents; \ No newline at end of file +var _0xdb94=['update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save'];(function(_0x25b396,_0x5764d8){var _0x5668ef=function(_0xf16fa9){while(--_0xf16fa9){_0x25b396['push'](_0x25b396['shift']());}};_0x5668ef(++_0x5764d8);}(_0xdb94,0xe5));var _0x4db9=function(_0x467ece,_0x3ac2e0){_0x467ece=_0x467ece-0x0;var _0x2c6a20=_0xdb94[_0x467ece];return _0x2c6a20;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x4db9('0x0'))['db'][_0x4db9('0x1')];var SmsMessage=require('../../mysqldb')['db'][_0x4db9('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x4db9('0x3')](0x0);var events={'afterCreate':_0x4db9('0x4'),'afterUpdate':_0x4db9('0x5'),'afterDestroy':_0x4db9('0x6')};function emitEvent(_0x592097){return function(_0x39eccb,_0x541226,_0x1d21a8){_0x39eccb[_0x4db9('0x7')]({'attributes':['id'],'raw':!![]})[_0x4db9('0x8')](function(_0x3404f6){_0x39eccb[_0x4db9('0x9')]('Users',_0x3404f6[_0x4db9('0xa')](function(_0x4376c8){return{'id':_0x4376c8['id']};}));return SmsMessage[_0x4db9('0xb')]({'where':{'SmsInteractionId':_0x39eccb['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4db9('0x8')](function(_0x402132){_0x39eccb['setDataValue'](_0x4db9('0xc'),_0x402132[_0x4db9('0xd')]);SmsInteractionEvents[_0x4db9('0xe')](_0x592097+':'+_0x39eccb['id'],_0x39eccb);SmsInteractionEvents[_0x4db9('0xe')](_0x592097,_0x39eccb);_0x1d21a8(null);})[_0x4db9('0xf')](_0x1d21a8(null));};}for(var e in events){if(events[_0x4db9('0x10')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x4db9('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 2124d48..23e4d5d 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 _0x0ec5=['./smsInteraction.attributes','exports','define','sms_interactions','changed','closed','closedAt','format','lodash','util','../../config/logger','api','moment','path','../../config/environment'];(function(_0x51951a,_0x1e40fd){var _0x22dc23=function(_0x1412b8){while(--_0x1412b8){_0x51951a['push'](_0x51951a['shift']());}};_0x22dc23(++_0x1e40fd);}(_0x0ec5,0x9e));var _0x50ec=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x0ec5[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0x50ec('0x0'));var util=require(_0x50ec('0x1'));var logger=require(_0x50ec('0x2'))(_0x50ec('0x3'));var moment=require(_0x50ec('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x50ec('0x5'));var rimraf=require('rimraf');var config=require(_0x50ec('0x6'));var attributes=require(_0x50ec('0x7'));module[_0x50ec('0x8')]=function(_0x51659e,_0x632ba0){return _0x51659e[_0x50ec('0x9')]('SmsInteraction',attributes,{'tableName':_0x50ec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x458360,_0x5915d5,_0x29e5b3){if(_0x458360[_0x50ec('0xb')](_0x50ec('0xc'))){_0x458360[_0x50ec('0xd')]=moment()[_0x50ec('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x29e5b3(null,_0x458360);}}});}; \ No newline at end of file +var _0xc1f0=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt'];(function(_0x2c594a,_0x1db489){var _0x1ea7b0=function(_0x2ed1b0){while(--_0x2ed1b0){_0x2c594a['push'](_0x2c594a['shift']());}};_0x1ea7b0(++_0x1db489);}(_0xc1f0,0x10f));var _0x0c1f=function(_0x20b4d9,_0x2b9b16){_0x20b4d9=_0x20b4d9-0x0;var _0x2f00ac=_0xc1f0[_0x20b4d9];return _0x2f00ac;};'use strict';var _=require(_0x0c1f('0x0'));var util=require(_0x0c1f('0x1'));var logger=require(_0x0c1f('0x2'))(_0x0c1f('0x3'));var moment=require(_0x0c1f('0x4'));var BPromise=require('bluebird');var rp=require(_0x0c1f('0x5'));var fs=require('fs');var path=require(_0x0c1f('0x6'));var rimraf=require(_0x0c1f('0x7'));var config=require(_0x0c1f('0x8'));var attributes=require(_0x0c1f('0x9'));module[_0x0c1f('0xa')]=function(_0x22841e,_0x186f8b){return _0x22841e[_0x0c1f('0xb')](_0x0c1f('0xc'),attributes,{'tableName':_0x0c1f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x361221,_0x17d215,_0x49fecd){if(_0x361221[_0x0c1f('0xe')](_0x0c1f('0xf'))){_0x361221[_0x0c1f('0x10')]=moment()['format'](_0x0c1f('0x11'));}_0x49fecd(null,_0x361221);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index b948379..bcdbb92 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 _0xdda5=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','attributes','find','omit','ids','spread','AddTags'];(function(_0x353d3d,_0xc7ebc){var _0x1c5409=function(_0x54838e){while(--_0x54838e){_0x353d3d['push'](_0x353d3d['shift']());}};_0x1c5409(++_0xc7ebc);}(_0xdda5,0x11f));var _0x5dda=function(_0xbf8a2,_0x4c910b){_0xbf8a2=_0xbf8a2-0x0;var _0x15d931=_0xdda5[_0xbf8a2];return _0x15d931;};'use strict';var _=require(_0x5dda('0x0'));var util=require('util');var moment=require(_0x5dda('0x1'));var BPromise=require(_0x5dda('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5dda('0x3'));var db=require(_0x5dda('0x4'))['db'];var utils=require(_0x5dda('0x5'));var logger=require(_0x5dda('0x6'))(_0x5dda('0x7'));var config=require(_0x5dda('0x8'));var jayson=require(_0x5dda('0x9'));var client=jayson[_0x5dda('0xa')]['http']({'port':0x232a});config[_0x5dda('0xb')]=_[_0x5dda('0xc')](config[_0x5dda('0xb')],{'host':_0x5dda('0xd'),'port':0x18eb});var socket=require(_0x5dda('0xe'))(new Redis(config[_0x5dda('0xb')]));require('./smsInteraction.socket')[_0x5dda('0xf')](socket);function respondWithRpcPromise(_0x2ad493,_0x2fd772,_0x48477f){return new BPromise(function(_0x1a8188,_0x5978f3){return client[_0x5dda('0x10')](_0x2ad493,_0x48477f)[_0x5dda('0x11')](function(_0x3b7e85){logger[_0x5dda('0x12')](_0x5dda('0x13'),_0x2fd772,_0x5dda('0x14'));logger[_0x5dda('0x15')](_0x5dda('0x16'),_0x2fd772,_0x5dda('0x14'),JSON[_0x5dda('0x17')](_0x3b7e85));if(_0x3b7e85[_0x5dda('0x18')]){if(_0x3b7e85[_0x5dda('0x18')][_0x5dda('0x19')]===0x1f4){logger['error'](_0x5dda('0x13'),_0x2fd772,_0x3b7e85[_0x5dda('0x18')][_0x5dda('0x1a')]);return _0x5978f3(_0x3b7e85['error'][_0x5dda('0x1a')]);}logger[_0x5dda('0x18')](_0x5dda('0x13'),_0x2fd772,_0x3b7e85[_0x5dda('0x18')]['message']);return _0x1a8188(_0x3b7e85[_0x5dda('0x18')][_0x5dda('0x1a')]);}else{logger[_0x5dda('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x2fd772,_0x5dda('0x14'));_0x1a8188(_0x3b7e85[_0x5dda('0x1b')][_0x5dda('0x1a')]);}})[_0x5dda('0x1c')](function(_0x45482f){logger['error'](_0x5dda('0x13'),_0x2fd772,_0x45482f);_0x5978f3(_0x45482f);});});}exports[_0x5dda('0x1d')]=function(_0x31b35b){var _0x1aec83=this;return new Promise(function(_0x3155f9,_0x55fed4){return db[_0x5dda('0x1e')][_0x5dda('0x1f')](_0x31b35b[_0x5dda('0x20')],{'raw':_0x31b35b[_0x5dda('0x21')]?_0x31b35b['options'][_0x5dda('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31b35b[_0x5dda('0x21')]?_0x31b35b[_0x5dda('0x21')]['where']||null:null,'attributes':_0x31b35b['options']?_0x31b35b[_0x5dda('0x21')][_0x5dda('0x23')]||null:null,'limit':_0x31b35b[_0x5dda('0x21')]?_0x31b35b[_0x5dda('0x21')]['limit']||null:null})[_0x5dda('0x11')](function(_0x4ec017){logger['info']('UpdateSmsInteraction',_0x31b35b);logger['debug']('UpdateSmsInteraction',_0x31b35b,JSON['stringify'](_0x4ec017));_0x3155f9(_0x4ec017);})[_0x5dda('0x1c')](function(_0x5d9844){logger[_0x5dda('0x18')](_0x5dda('0x1d'),_0x5d9844[_0x5dda('0x1a')],_0x31b35b);_0x55fed4(_0x1aec83[_0x5dda('0x18')](0x1f4,_0x5d9844[_0x5dda('0x1a')]));});});};exports['AddTagsToSmsInteraction']=function(_0x735047){return new Promise(function(_0x43f2b7,_0x10de3a){return db[_0x5dda('0x1e')][_0x5dda('0x24')]({'where':_0x735047[_0x5dda('0x21')]?_0x735047[_0x5dda('0x21')]['where']||null:null})['then'](function(_0x56dab9){if(_0x56dab9){return _0x56dab9['addTags'](_0x735047[_0x5dda('0x20')]['ids'],_[_0x5dda('0x25')](_0x735047['body'],[_0x5dda('0x26'),'id'])||{});}})[_0x5dda('0x27')](function(_0x293481){logger[_0x5dda('0x12')](_0x5dda('0x28'),_0x735047);logger['debug'](_0x5dda('0x28'),_0x735047,JSON[_0x5dda('0x17')](_0x293481));_0x43f2b7(_0x293481);})[_0x5dda('0x1c')](function(_0x5a1ccb){logger['error'](_0x5dda('0x28'),_0x5a1ccb[_0x5dda('0x1a')],_0x735047);_0x10de3a(_this[_0x5dda('0x18')](0x1f4,_0x5a1ccb[_0x5dda('0x1a')]));});});}; \ No newline at end of file +var _0xe89b=['rpc','../../config/environment','jayson/promise','client','http','redis','localhost','request','then','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','find','addTags','omit','ids','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x137312,_0x1a522e){var _0x420e05=function(_0x51a867){while(--_0x51a867){_0x137312['push'](_0x137312['shift']());}};_0x420e05(++_0x1a522e);}(_0xe89b,0x69));var _0xbe89=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xe89b[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xbe89('0x0'));var util=require('util');var moment=require(_0xbe89('0x1'));var BPromise=require('bluebird');var rs=require(_0xbe89('0x2'));var fs=require('fs');var Redis=require(_0xbe89('0x3'));var db=require(_0xbe89('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbe89('0x5'))(_0xbe89('0x6'));var config=require(_0xbe89('0x7'));var jayson=require(_0xbe89('0x8'));var client=jayson[_0xbe89('0x9')][_0xbe89('0xa')]({'port':0x232a});config[_0xbe89('0xb')]=_['defaults'](config['redis'],{'host':_0xbe89('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbe89('0xb')]));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x2a6148,_0x109a7c,_0x1e244e){return new BPromise(function(_0x1957a3,_0x1ce4e8){return client[_0xbe89('0xd')](_0x2a6148,_0x1e244e)[_0xbe89('0xe')](function(_0x52521d){logger['info'](_0xbe89('0xf'),_0x109a7c,'request\x20sent');logger[_0xbe89('0x10')](_0xbe89('0x11'),_0x109a7c,'request\x20sent',JSON['stringify'](_0x52521d));if(_0x52521d[_0xbe89('0x12')]){if(_0x52521d[_0xbe89('0x12')][_0xbe89('0x13')]===0x1f4){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x109a7c,_0x52521d['error'][_0xbe89('0x14')]);return _0x1ce4e8(_0x52521d[_0xbe89('0x12')][_0xbe89('0x14')]);}logger[_0xbe89('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x109a7c,_0x52521d[_0xbe89('0x12')][_0xbe89('0x14')]);return _0x1957a3(_0x52521d['error']['message']);}else{logger[_0xbe89('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x109a7c,'request\x20sent');_0x1957a3(_0x52521d[_0xbe89('0x16')][_0xbe89('0x14')]);}})[_0xbe89('0x17')](function(_0x1e3dff){logger['error'](_0xbe89('0xf'),_0x109a7c,_0x1e3dff);_0x1ce4e8(_0x1e3dff);});});}exports[_0xbe89('0x18')]=function(_0x24a6da){var _0x245b8b=this;return new Promise(function(_0x4e6f37,_0x4001a0){return db[_0xbe89('0x19')][_0xbe89('0x1a')](_0x24a6da[_0xbe89('0x1b')],{'raw':_0x24a6da['options']?_0x24a6da['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24a6da[_0xbe89('0x1c')]?_0x24a6da[_0xbe89('0x1c')][_0xbe89('0x1d')]||null:null,'attributes':_0x24a6da[_0xbe89('0x1c')]?_0x24a6da[_0xbe89('0x1c')][_0xbe89('0x1e')]||null:null,'limit':_0x24a6da[_0xbe89('0x1c')]?_0x24a6da[_0xbe89('0x1c')]['limit']||null:null})[_0xbe89('0xe')](function(_0x96c201){logger[_0xbe89('0x15')](_0xbe89('0x18'),_0x24a6da);logger[_0xbe89('0x10')](_0xbe89('0x18'),_0x24a6da,JSON['stringify'](_0x96c201));_0x4e6f37(_0x96c201);})[_0xbe89('0x17')](function(_0x1fb0fb){logger['error'](_0xbe89('0x18'),_0x1fb0fb[_0xbe89('0x14')],_0x24a6da);_0x4001a0(_0x245b8b[_0xbe89('0x12')](0x1f4,_0x1fb0fb[_0xbe89('0x14')]));});});};exports['AddTagsToSmsInteraction']=function(_0x4af273){return new Promise(function(_0x30519f,_0x1de67e){return db[_0xbe89('0x19')][_0xbe89('0x1f')]({'where':_0x4af273[_0xbe89('0x1c')]?_0x4af273[_0xbe89('0x1c')][_0xbe89('0x1d')]||null:null})[_0xbe89('0xe')](function(_0x20699e){if(_0x20699e){return _0x20699e[_0xbe89('0x20')](_0x4af273[_0xbe89('0x1b')]['ids'],_[_0xbe89('0x21')](_0x4af273[_0xbe89('0x1b')],[_0xbe89('0x22'),'id'])||{});}})[_0xbe89('0x23')](function(_0x6e94e5){logger['info'](_0xbe89('0x24'),_0x4af273);logger[_0xbe89('0x10')](_0xbe89('0x24'),_0x4af273,JSON['stringify'](_0x6e94e5));_0x30519f(_0x6e94e5);})[_0xbe89('0x17')](function(_0xf2d613){logger['error']('AddTags',_0xf2d613[_0xbe89('0x14')],_0x4af273);_0x1de67e(_this[_0xbe89('0x12')](0x1f4,_0xf2d613[_0xbe89('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 65c5197..3997690 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 _0x757a=['save','remove','emit','removeListener','register','smsInteraction:'];(function(_0x432400,_0x3cc68d){var _0xdd5de3=function(_0x5cb6d3){while(--_0x5cb6d3){_0x432400['push'](_0x432400['shift']());}};_0xdd5de3(++_0x3cc68d);}(_0x757a,0xde));var _0xa757=function(_0x2d306f,_0x500e99){_0x2d306f=_0x2d306f-0x0;var _0x49f030=_0x757a[_0x2d306f];return _0x49f030;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xa757('0x0'),_0xa757('0x1'),'update'];function createListener(_0x5c03c3,_0x5709ed){return function(_0x32be3b){_0x5709ed[_0xa757('0x2')](_0x5c03c3,_0x32be3b);};}function removeListener(_0x1c2932,_0x453d07){return function(){SmsInteractionEvents[_0xa757('0x3')](_0x1c2932,_0x453d07);};}exports[_0xa757('0x4')]=function(_0x5edca8){for(var _0xae0e7c=0x0,_0x4343b6=events['length'];_0xae0e7c<_0x4343b6;_0xae0e7c++){var _0x2930fa=events[_0xae0e7c];var _0x2f7793=createListener(_0xa757('0x5')+_0x2930fa,_0x5edca8);SmsInteractionEvents['on'](_0x2930fa,_0x2f7793);}}; \ No newline at end of file +var _0x0b0e=['smsInteraction:','./smsInteraction.events','remove','emit','removeListener','register'];(function(_0x544716,_0x5a3f93){var _0x4d647b=function(_0x3539d0){while(--_0x3539d0){_0x544716['push'](_0x544716['shift']());}};_0x4d647b(++_0x5a3f93);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5178fb,_0x121e19){_0x5178fb=_0x5178fb-0x0;var _0x348183=_0x0b0e[_0x5178fb];return _0x348183;};'use strict';var SmsInteractionEvents=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(){SmsInteractionEvents[_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);SmsInteractionEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 1a6472c..89928d6 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 _0x822d=['create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create'];(function(_0x100c92,_0x30362f){var _0x2e2b34=function(_0x5d1c9c){while(--_0x5d1c9c){_0x100c92['push'](_0x100c92['shift']());}};_0x2e2b34(++_0x30362f);}(_0x822d,0xa2));var _0xd822=function(_0x378720,_0xa711f1){_0x378720=_0x378720-0x0;var _0x47920a=_0x822d[_0x378720];return _0x47920a;};'use strict';var multer=require(_0xd822('0x0'));var util=require(_0xd822('0x1'));var path=require(_0xd822('0x2'));var timeout=require(_0xd822('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xd822('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd822('0x5'));var controller=require(_0xd822('0x6'));router[_0xd822('0x7')]('/',auth[_0xd822('0x8')](),controller[_0xd822('0x9')]);router['get'](_0xd822('0xa'),auth[_0xd822('0x8')](),controller[_0xd822('0xb')]);router['get'](_0xd822('0xc'),auth[_0xd822('0x8')](),controller[_0xd822('0xd')]);router[_0xd822('0xe')]('/',auth[_0xd822('0x8')](),interaction[_0xd822('0xf')](_0xd822('0x10'),_0xd822('0x11')),controller[_0xd822('0x12')]);router['post'](_0xd822('0x13'),controller[_0xd822('0x14')]);router[_0xd822('0x15')](_0xd822('0xc'),auth[_0xd822('0x8')](),controller[_0xd822('0x16')]);router[_0xd822('0x15')](_0xd822('0x17'),auth[_0xd822('0x8')](),controller[_0xd822('0x18')]);router['put'](_0xd822('0x19'),auth['isAuthenticated'](),controller[_0xd822('0x1a')]);router[_0xd822('0x1b')](_0xd822('0xc'),auth[_0xd822('0x8')](),controller[_0xd822('0x1c')]);module[_0xd822('0x1d')]=router; \ No newline at end of file +var _0x5ea3=['isAuthenticated','index','/describe','describe','/:id','show','tracked','sms','smsmessage:create','/:id/status','status','put','update','accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x1c9839,_0x261206){var _0xe36f53=function(_0x45c8b6){while(--_0x45c8b6){_0x1c9839['push'](_0x1c9839['shift']());}};_0xe36f53(++_0x261206);}(_0x5ea3,0x120));var _0x35ea=function(_0x44a833,_0x124f44){_0x44a833=_0x44a833-0x0;var _0x208348=_0x5ea3[_0x44a833];return _0x208348;};'use strict';var multer=require(_0x35ea('0x0'));var util=require(_0x35ea('0x1'));var path=require(_0x35ea('0x2'));var timeout=require(_0x35ea('0x3'));var express=require(_0x35ea('0x4'));var router=express['Router']();var auth=require(_0x35ea('0x5'));var interaction=require(_0x35ea('0x6'));var config=require(_0x35ea('0x7'));var controller=require('./smsMessage.controller');router[_0x35ea('0x8')]('/',auth[_0x35ea('0x9')](),controller[_0x35ea('0xa')]);router[_0x35ea('0x8')](_0x35ea('0xb'),auth[_0x35ea('0x9')](),controller[_0x35ea('0xc')]);router['get'](_0x35ea('0xd'),auth[_0x35ea('0x9')](),controller[_0x35ea('0xe')]);router['post']('/',auth[_0x35ea('0x9')](),interaction[_0x35ea('0xf')](_0x35ea('0x10'),_0x35ea('0x11')),controller['create']);router['post'](_0x35ea('0x12'),controller[_0x35ea('0x13')]);router[_0x35ea('0x14')](_0x35ea('0xd'),auth[_0x35ea('0x9')](),controller[_0x35ea('0x15')]);router[_0x35ea('0x14')]('/:id/accept',auth[_0x35ea('0x9')](),controller[_0x35ea('0x16')]);router[_0x35ea('0x14')]('/:id/reject',auth[_0x35ea('0x9')](),controller[_0x35ea('0x17')]);router[_0x35ea('0x18')](_0x35ea('0xd'),auth[_0x35ea('0x9')](),controller[_0x35ea('0x19')]);module[_0x35ea('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 acd66bf..95c28fb 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 _0x2b29=['ENUM','out','STRING','DATE','BOOLEAN','sequelize','TEXT','medium'];(function(_0x5cf130,_0x25bad2){var _0x336f51=function(_0x39bfe4){while(--_0x39bfe4){_0x5cf130['push'](_0x5cf130['shift']());}};_0x336f51(++_0x25bad2);}(_0x2b29,0x135));var _0x92b2=function(_0xb1e4ac,_0xab8379){_0xb1e4ac=_0xb1e4ac-0x0;var _0x593279=_0x2b29[_0xb1e4ac];return _0x593279;};'use strict';var Sequelize=require(_0x92b2('0x0'));module['exports']={'body':{'type':Sequelize[_0x92b2('0x1')](_0x92b2('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x92b2('0x3')]('in',_0x92b2('0x4')),'defaultValue':_0x92b2('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x92b2('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x92b2('0x6')]},'secret':{'type':Sequelize[_0x92b2('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0xf83d=['TEXT','medium','BOOLEAN','out','STRING','DATE','sequelize','exports'];(function(_0x46e352,_0x4a0042){var _0x5bf1b0=function(_0x3301d8){while(--_0x3301d8){_0x46e352['push'](_0x46e352['shift']());}};_0x5bf1b0(++_0x4a0042);}(_0xf83d,0x19e));var _0xdf83=function(_0x2b5e51,_0x443d76){_0x2b5e51=_0x2b5e51-0x0;var _0x23982e=_0xf83d[_0x2b5e51];return _0x23982e;};'use strict';var Sequelize=require(_0xdf83('0x0'));module[_0xdf83('0x1')]={'body':{'type':Sequelize[_0xdf83('0x2')](_0xdf83('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xdf83('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xdf83('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xdf83('0x6')](0xbe)},'phone':{'type':Sequelize[_0xdf83('0x6')]},'readAt':{'type':Sequelize[_0xdf83('0x7')]},'secret':{'type':Sequelize[_0xdf83('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 32caba9..41f3003 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 _0x8e44=['SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','Status','plivio','infobip','results','groupName','DELIVERED','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','register','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','end','json','offset','limit','status','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','SmsMessage','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','count','includeAll','include','show','params','rawAttributes','create','body','find','describe','sms-interactions','accept','sms','read','readAt','format','UserId','CmContact','Contact','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','user','role','null','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','agent','SmsInteraction','RejectMessage','rejectMessage','event','rejectmessage','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId'];(function(_0x576811,_0x25ff72){var _0x4d66d6=function(_0x1b454e){while(--_0x1b454e){_0x576811['push'](_0x576811['shift']());}};_0x4d66d6(++_0x25ff72);}(_0x8e44,0x1ac));var _0x48e4=function(_0x1146d7,_0xa4368d){_0x1146d7=_0x1146d7-0x0;var _0x3fb9b2=_0x8e44[_0x1146d7];return _0x3fb9b2;};'use strict';var pdf=require(_0x48e4('0x0'));var emlformat=require(_0x48e4('0x1'));var rimraf=require(_0x48e4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x48e4('0x3'));var moment=require(_0x48e4('0x4'));var BPromise=require(_0x48e4('0x5'));var Mustache=require(_0x48e4('0x6'));var util=require('util');var path=require(_0x48e4('0x7'));var sox=require(_0x48e4('0x8'));var csv=require(_0x48e4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x48e4('0xa'));var crypto=require(_0x48e4('0xb'));var jsforce=require(_0x48e4('0xc'));var deskjs=require(_0x48e4('0xd'));var toCsv=require(_0x48e4('0x9'));var querystring=require(_0x48e4('0xe'));var Papa=require(_0x48e4('0xf'));var Redis=require(_0x48e4('0x10'));var authService=require(_0x48e4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x48e4('0x12'));var hardwareService=require(_0x48e4('0x13'));var logger=require(_0x48e4('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x48e4('0x15'));var db=require(_0x48e4('0x16'))['db'];config[_0x48e4('0x17')]=_[_0x48e4('0x18')](config['redis'],{'host':_0x48e4('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x48e4('0x17')]));require(_0x48e4('0x1a'))[_0x48e4('0x1b')](socket);var jayson=require(_0x48e4('0x1c'));var client=jayson[_0x48e4('0x1d')][_0x48e4('0x1e')]({'port':0x232c});var client9002=jayson[_0x48e4('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x1c82d2,_0x15519c,_0x5c8fe5){if(_0x5c8fe5){var _0x171f89=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x171f89[_0x48e4('0x1f')](_0x15519c)){return _0x1c82d2;}else{throw new db['Sequelize'][(_0x48e4('0x20'))](_0x48e4('0x21'));}}else{return _0x1c82d2;}}function respondWithRpcPromise(_0x12fc37,_0x4ffc0d,_0x231dcd,_0x16e405){return new BPromise(function(_0x4e3943,_0x4e75f6){var _0xbaa743=_0x16e405||client;return _0xbaa743['request'](_0x12fc37,_0x231dcd)['then'](function(_0x113ff4){logger[_0x48e4('0x22')](_0x48e4('0x23'),_0x4ffc0d,_0x48e4('0x24'));logger[_0x48e4('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4ffc0d,'request\x20sent',JSON[_0x48e4('0x26')](_0x113ff4));if(_0x113ff4[_0x48e4('0x27')]){if(_0x113ff4[_0x48e4('0x27')][_0x48e4('0x28')]===0x1f4){logger[_0x48e4('0x27')](_0x48e4('0x23'),_0x4ffc0d,_0x113ff4[_0x48e4('0x27')][_0x48e4('0x29')]);return _0x4e75f6(_0x113ff4[_0x48e4('0x27')][_0x48e4('0x29')]);}logger[_0x48e4('0x27')]('SmsMessage,\x20%s,\x20%s',_0x4ffc0d,_0x113ff4[_0x48e4('0x27')][_0x48e4('0x29')]);return _0x4e3943(_0x113ff4['error'][_0x48e4('0x29')]);}else{logger[_0x48e4('0x22')]('SmsMessage,\x20%s,\x20%s',_0x4ffc0d,_0x48e4('0x24'));_0x4e3943(_0x113ff4[_0x48e4('0x2a')][_0x48e4('0x29')]);}})[_0x48e4('0x2b')](function(_0x1e7d7e){logger[_0x48e4('0x27')](_0x48e4('0x23'),_0x4ffc0d,_0x1e7d7e);_0x4e75f6(_0x1e7d7e);});});}function respondWithStatusCode(_0x4ae6ba,_0xb7627d){_0xb7627d=_0xb7627d||0xcc;return function(_0xcaa9cb){if(_0xcaa9cb){return _0x4ae6ba['sendStatus'](_0xb7627d);}return _0x4ae6ba['status'](_0xb7627d)[_0x48e4('0x2c')]();};}function respondWithResult(_0x4b8f3c,_0x346765){_0x346765=_0x346765||0xc8;return function(_0x214def){if(_0x214def){return _0x4b8f3c['status'](_0x346765)[_0x48e4('0x2d')](_0x214def);}};}function respondWithFilteredResult(_0x28c1,_0x14b545){return function(_0xea1c5b){if(_0xea1c5b){var _0x15a413=_0xea1c5b['count'],_0x4f6459=_0x14b545['offset'],_0x108f46=_0x14b545[_0x48e4('0x2e')]+_0x14b545[_0x48e4('0x2f')],_0x53511e;if(_0x108f46>=_0x15a413){_0x108f46=_0x15a413;_0x53511e=0xc8;}else{_0x53511e=0xce;}_0x28c1[_0x48e4('0x30')](_0x53511e);return _0x28c1[_0x48e4('0x31')](_0x48e4('0x32'),_0x4f6459+'-'+_0x108f46+'/'+_0x15a413)[_0x48e4('0x2d')](_0xea1c5b);}return null;};}function patchUpdates(_0x109c9d){return function(_0x45a052){try{jsonpatch[_0x48e4('0x33')](_0x45a052,_0x109c9d,!![]);}catch(_0x12af4d){return BPromise[_0x48e4('0x34')](_0x12af4d);}return _0x45a052['save']();};}function saveUpdates(_0x521a65,_0x5f13aa){return function(_0x3d336d){if(_0x3d336d){return _0x3d336d[_0x48e4('0x35')](_0x521a65)['then'](function(_0x2fc2ef){return _0x2fc2ef;});}return null;};}function removeEntity(_0x8ef937,_0x5ddf17){return function(_0x38da48){if(_0x38da48){return _0x38da48[_0x48e4('0x36')]()[_0x48e4('0x37')](function(){_0x8ef937[_0x48e4('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb5a6f3,_0x21a05c){return function(_0x4d83e9){if(!_0x4d83e9){_0xb5a6f3['sendStatus'](0x194);}return _0x4d83e9;};}function handleError(_0x1c4d86,_0x2d29cd){_0x2d29cd=_0x2d29cd||0x1f4;return function(_0x20923e){logger['error'](_0x20923e[_0x48e4('0x38')]);if(_0x20923e[_0x48e4('0x39')]){delete _0x20923e['name'];}_0x1c4d86[_0x48e4('0x30')](_0x2d29cd)[_0x48e4('0x3a')](_0x20923e);};}exports[_0x48e4('0x3b')]=function(_0xbe8ca1,_0x3a4b75){var _0x59b381={},_0x21e829={},_0x3f695e={'count':0x0,'rows':[]};var _0x44f206=_['map'](db[_0x48e4('0x3c')]['rawAttributes'],function(_0x465a2f){return{'name':_0x465a2f[_0x48e4('0x3d')],'type':_0x465a2f[_0x48e4('0x3e')][_0x48e4('0x3f')]};});_0x21e829[_0x48e4('0x40')]=_[_0x48e4('0x41')](_0x44f206,_0x48e4('0x39'));_0x21e829[_0x48e4('0x42')]=_[_0x48e4('0x43')](_0xbe8ca1[_0x48e4('0x42')]);_0x21e829[_0x48e4('0x44')]=_['intersection'](_0x21e829[_0x48e4('0x40')],_0x21e829[_0x48e4('0x42')]);_0x59b381[_0x48e4('0x45')]=_[_0x48e4('0x46')](_0x21e829[_0x48e4('0x40')],qs[_0x48e4('0x47')](_0xbe8ca1[_0x48e4('0x42')]['fields']));_0x59b381[_0x48e4('0x45')]=_0x59b381[_0x48e4('0x45')][_0x48e4('0x48')]?_0x59b381['attributes']:_0x21e829[_0x48e4('0x40')];if(!_0xbe8ca1[_0x48e4('0x42')][_0x48e4('0x49')]('nolimit')){_0x59b381['limit']=qs[_0x48e4('0x2f')](_0xbe8ca1[_0x48e4('0x42')]['limit']);_0x59b381[_0x48e4('0x2e')]=qs['offset'](_0xbe8ca1['query']['offset']);}_0x59b381['order']=qs[_0x48e4('0x4a')](_0xbe8ca1[_0x48e4('0x42')][_0x48e4('0x4a')]);_0x59b381[_0x48e4('0x4b')]=qs[_0x48e4('0x44')](_[_0x48e4('0x4c')](_0xbe8ca1['query'],_0x21e829[_0x48e4('0x44')]),_0x44f206);if(_0xbe8ca1[_0x48e4('0x42')]['filter']){_0x59b381['where']=_[_0x48e4('0x4d')](_0x59b381[_0x48e4('0x4b')],{'$or':_[_0x48e4('0x41')](_0x44f206,function(_0x34b9dc){if(_0x34b9dc['type']!==_0x48e4('0x4e')){var _0x25ea8e={};_0x25ea8e[_0x34b9dc[_0x48e4('0x39')]]={'$like':'%'+_0xbe8ca1[_0x48e4('0x42')][_0x48e4('0x4f')]+'%'};return _0x25ea8e;}})});}_0x59b381=_[_0x48e4('0x4d')]({},_0x59b381,_0xbe8ca1['options']);var _0x31dd8c={'where':_0x59b381[_0x48e4('0x4b')]};return db[_0x48e4('0x3c')][_0x48e4('0x50')](_0x31dd8c)[_0x48e4('0x37')](function(_0x384a52){_0x3f695e[_0x48e4('0x50')]=_0x384a52;if(_0xbe8ca1[_0x48e4('0x42')][_0x48e4('0x51')]){_0x59b381[_0x48e4('0x52')]=[{'all':!![]}];}return db[_0x48e4('0x3c')]['findAll'](_0x59b381);})[_0x48e4('0x37')](function(_0x48717f){_0x3f695e['rows']=_0x48717f;return _0x3f695e;})[_0x48e4('0x37')](respondWithFilteredResult(_0x3a4b75,_0x59b381))['catch'](handleError(_0x3a4b75,null));};exports[_0x48e4('0x53')]=function(_0x14511b,_0x3a5670){var _0x1f10e3={'raw':!![],'where':{'id':_0x14511b[_0x48e4('0x54')]['id']}},_0x214d1f={};_0x214d1f[_0x48e4('0x40')]=_['keys'](db['SmsMessage'][_0x48e4('0x55')]);_0x214d1f['query']=_[_0x48e4('0x43')](_0x14511b[_0x48e4('0x42')]);_0x214d1f[_0x48e4('0x44')]=_['intersection'](_0x214d1f[_0x48e4('0x40')],_0x214d1f[_0x48e4('0x42')]);_0x1f10e3[_0x48e4('0x45')]=_['intersection'](_0x214d1f[_0x48e4('0x40')],qs[_0x48e4('0x47')](_0x14511b[_0x48e4('0x42')][_0x48e4('0x47')]));_0x1f10e3[_0x48e4('0x45')]=_0x1f10e3['attributes'][_0x48e4('0x48')]?_0x1f10e3[_0x48e4('0x45')]:_0x214d1f['model'];if(_0x14511b[_0x48e4('0x42')][_0x48e4('0x51')]){_0x1f10e3[_0x48e4('0x52')]=[{'all':!![]}];}_0x1f10e3=_[_0x48e4('0x4d')]({},_0x1f10e3,_0x14511b['options']);return db['SmsMessage']['find'](_0x1f10e3)['then'](handleEntityNotFound(_0x3a5670,null))[_0x48e4('0x37')](respondWithResult(_0x3a5670,null))[_0x48e4('0x2b')](handleError(_0x3a5670,null));};exports[_0x48e4('0x56')]=function(_0x23727e,_0x32abe0){return db[_0x48e4('0x3c')][_0x48e4('0x56')](_0x23727e[_0x48e4('0x57')],{})[_0x48e4('0x37')](respondWithResult(_0x32abe0,0xc9))[_0x48e4('0x2b')](handleError(_0x32abe0,null));};exports[_0x48e4('0x35')]=function(_0x2f0955,_0x180ae4){if(_0x2f0955['body']['id']){delete _0x2f0955[_0x48e4('0x57')]['id'];}return db[_0x48e4('0x3c')][_0x48e4('0x58')]({'where':{'id':_0x2f0955[_0x48e4('0x54')]['id']}})[_0x48e4('0x37')](handleEntityNotFound(_0x180ae4,null))[_0x48e4('0x37')](saveUpdates(_0x2f0955[_0x48e4('0x57')],null))[_0x48e4('0x37')](respondWithResult(_0x180ae4,null))[_0x48e4('0x2b')](handleError(_0x180ae4,null));};exports[_0x48e4('0x36')]=function(_0x3a22b4,_0x4624b0){return db['SmsMessage']['find']({'where':{'id':_0x3a22b4[_0x48e4('0x54')]['id']}})[_0x48e4('0x37')](handleEntityNotFound(_0x4624b0,null))[_0x48e4('0x37')](removeEntity(_0x4624b0,null))[_0x48e4('0x2b')](handleError(_0x4624b0,null));};exports[_0x48e4('0x59')]=function(_0x599988,_0x256e79){return db['SmsMessage'][_0x48e4('0x59')]()[_0x48e4('0x37')](respondWithResult(_0x256e79,null))[_0x48e4('0x2b')](handleError(_0x256e79,null));};var interaction_log=require('../../config/logger')(_0x48e4('0x5a'));exports[_0x48e4('0x5b')]=function(_0x3e1b92,_0x18c18e,_0x20f0f0){var _0x153fb6={'channel':_0x48e4('0x5c')};if(_0x3e1b92['body']['id']){delete _0x3e1b92[_0x48e4('0x57')]['id'];}_0x3e1b92[_0x48e4('0x57')][_0x48e4('0x5d')]=!![];_0x3e1b92['body'][_0x48e4('0x5e')]=moment()[_0x48e4('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x3e1b92['body']['UserId']=_0x3e1b92[_0x48e4('0x57')][_0x48e4('0x60')]||_0x3e1b92['user']['id'];return db[_0x48e4('0x3c')][_0x48e4('0x58')]({'where':{'id':_0x3e1b92[_0x48e4('0x54')]['id'],'UserId':null},'include':[{'model':db[_0x48e4('0x61')],'as':_0x48e4('0x62')}]})[_0x48e4('0x37')](handleEntityNotFound(_0x18c18e,null))[_0x48e4('0x37')](saveUpdates(_0x3e1b92[_0x48e4('0x57')],null))[_0x48e4('0x37')](function(_0x456a6c){if(_0x456a6c){_0x153fb6['message']=_0x456a6c['get']({'plain':!![]});return db['SmsInteraction'][_0x48e4('0x58')]({'where':{'id':_0x456a6c[_0x48e4('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x18c18e,null))[_0x48e4('0x37')](function(_0x4a6def){if(_0x4a6def){return _0x4a6def[_0x48e4('0x35')]({'UserId':_0x3e1b92[_0x48e4('0x57')][_0x48e4('0x60')],'read1stAt':_[_0x48e4('0x64')](_0x4a6def[_0x48e4('0x65')])?moment()[_0x48e4('0x5f')](_0x48e4('0x66')):undefined});}return null;})[_0x48e4('0x37')](function(_0x2ab596){if(_0x2ab596){_0x153fb6[_0x48e4('0x67')]=_0x2ab596[_0x48e4('0x68')]({'plain':!![]});interaction_log[_0x48e4('0x22')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3e1b92['user']['id'],_0x3e1b92[_0x48e4('0x69')]['name'],_0x3e1b92[_0x48e4('0x69')][_0x48e4('0x6a')],_0x153fb6['interaction']['id'],_0x3e1b92[_0x48e4('0x57')]?JSON[_0x48e4('0x26')](_0x3e1b92[_0x48e4('0x57')]):_0x48e4('0x6b'));return respondWithRpcPromise('AcceptMessage',_0x48e4('0x6c'),_0x153fb6);}return null;})['then'](function(_0x3d9252){if(_0x3d9252){if(_0x3e1b92[_0x48e4('0x57')][_0x48e4('0x6d')]){_0x153fb6[_0x48e4('0x29')][_0x48e4('0x6e')]=util['format'](_0x48e4('0x6f'),_0x3e1b92['user'][_0x48e4('0x39')]);_0x153fb6[_0x48e4('0x29')][_0x48e4('0x70')]=_0x153fb6[_0x48e4('0x70')];_0x153fb6[_0x48e4('0x29')]['event']=_0x48e4('0x5b');return respondWithRpcPromise(_0x48e4('0x71'),_0x48e4('0x71'),{'event':_0x48e4('0x72'),'message':_0x153fb6[_0x48e4('0x29')]},client9002)[_0x48e4('0x37')](function(){return _0x153fb6;});}return _0x153fb6;}return null;})[_0x48e4('0x37')](respondWithResult(_0x18c18e,null))[_0x48e4('0x2b')](handleError(_0x18c18e,null));};var interaction_log=require(_0x48e4('0x14'))(_0x48e4('0x5a'));exports['reject']=function(_0x4b7106,_0x2f71e8,_0x5d6d17){var _0x4bc126={'agent':{},'channel':_0x48e4('0x5c')};if(_0x4b7106['body']['id']){delete _0x4b7106[_0x48e4('0x57')]['id'];}_0x4b7106['body'][_0x48e4('0x60')]=_0x4b7106['body'][_0x48e4('0x60')]||_0x4b7106[_0x48e4('0x69')]['id'];_0x4bc126[_0x48e4('0x73')]['id']=_0x4b7106['body']['UserId'];return db['SmsMessage'][_0x48e4('0x58')]({'where':{'id':_0x4b7106['params']['id'],'UserId':null}})[_0x48e4('0x37')](handleEntityNotFound(_0x2f71e8,null))[_0x48e4('0x37')](function(_0x58bb85){if(_0x58bb85){_0x4bc126['message']=_0x58bb85[_0x48e4('0x68')]({'plain':!![]});return db[_0x48e4('0x74')][_0x48e4('0x58')]({'where':{'id':_0x58bb85[_0x48e4('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x2f71e8,null))[_0x48e4('0x37')](function(_0xc44015){if(_0xc44015){_0x4bc126['interaction']=_0xc44015['get']({'plain':!![]});interaction_log[_0x48e4('0x22')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4b7106['user']['id'],_0x4b7106[_0x48e4('0x69')][_0x48e4('0x39')],_0x4b7106[_0x48e4('0x69')][_0x48e4('0x6a')],_0x4bc126[_0x48e4('0x67')]['id'],_0x4b7106['body']?JSON['stringify'](_0x4b7106[_0x48e4('0x57')]):_0x48e4('0x6b'));return respondWithRpcPromise(_0x48e4('0x75'),_0x48e4('0x76'),_0x4bc126);}return null;})[_0x48e4('0x37')](function(_0x33f9b7){if(_0x33f9b7){_0x33f9b7[_0x48e4('0x29')]['interface']=util[_0x48e4('0x5f')]('SIP/%s',_0x4b7106['user'][_0x48e4('0x39')]);_0x33f9b7[_0x48e4('0x29')][_0x48e4('0x70')]=_0x4bc126[_0x48e4('0x70')];_0x33f9b7[_0x48e4('0x29')][_0x48e4('0x77')]=_0x48e4('0x34');respondWithRpcPromise('EventManager',_0x48e4('0x71'),{'event':_0x48e4('0x78'),'message':_0x33f9b7['message']},client9002);return _0x4bc126;}return null;})['then'](respondWithResult(_0x2f71e8,null))[_0x48e4('0x2b')](handleError(_0x2f71e8,null));};exports[_0x48e4('0x30')]=function(_0x3d2014,_0x27d4a3,_0x7da4de){if(_0x3d2014[_0x48e4('0x57')]['id']){delete _0x3d2014[_0x48e4('0x57')]['id'];}var _0x130bea;return db[_0x48e4('0x3c')][_0x48e4('0x58')]({'where':{'id':_0x3d2014[_0x48e4('0x54')]['id']}})[_0x48e4('0x37')](handleEntityNotFound(_0x27d4a3,null))[_0x48e4('0x37')](function(_0x5c323e){if(_0x5c323e){_0x130bea=_0x5c323e;return db['SmsAccount'][_0x48e4('0x58')]({'where':{'id':_0x5c323e[_0x48e4('0x79')]}});}})[_0x48e4('0x37')](handleEntityNotFound(_0x27d4a3,null))[_0x48e4('0x37')](function(_0x4eec59){if(_0x4eec59){logger[_0x48e4('0x25')](_0x48e4('0x7a'),_0x48e4('0x30'),_0x48e4('0x7b'),_0x4eec59[_0x48e4('0x3e')],util[_0x48e4('0x7c')](_0x3d2014[_0x48e4('0x57')],{'showHidden':![],'depth':null}));switch(_0x4eec59[_0x48e4('0x3e')]){case _0x48e4('0x7d'):if(_0x3d2014[_0x48e4('0x57')][_0x48e4('0x7e')]&&_0x3d2014['body'][_0x48e4('0x7e')]===_0x130bea[_0x48e4('0x7f')]){return _0x130bea[_0x48e4('0x35')]({'read':!![]});}else{logger[_0x48e4('0x27')](_0x48e4('0x80'),'status','twilio',util[_0x48e4('0x7c')](_0x3d2014[_0x48e4('0x57')],{'showHidden':![],'depth':null}));}break;case _0x48e4('0x81'):if(_0x3d2014['body'][_0x48e4('0x82')]&&_0x3d2014[_0x48e4('0x57')][_0x48e4('0x82')]===_0x130bea[_0x48e4('0x7f')]&&_[_0x48e4('0x83')]([_0x48e4('0x84'),'delivered'],_0x3d2014[_0x48e4('0x57')][_0x48e4('0x85')])>=0x0){return _0x130bea[_0x48e4('0x35')]({'read':!![]});}else{logger[_0x48e4('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x48e4('0x30'),_0x48e4('0x86'),util[_0x48e4('0x7c')](_0x3d2014[_0x48e4('0x57')],{'showHidden':![],'depth':null}));}break;case _0x48e4('0x87'):var _0x1e3c73=_0x3d2014[_0x48e4('0x57')][_0x48e4('0x88')][0x0];if(_0x1e3c73[_0x48e4('0x30')][_0x48e4('0x89')]===_0x48e4('0x8a')){return _0x130bea[_0x48e4('0x35')]({'read':!![]});}else{logger[_0x48e4('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x48e4('0x30'),_0x48e4('0x87'),util[_0x48e4('0x7c')](_0x3d2014[_0x48e4('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x130bea;}})[_0x48e4('0x37')](respondWithResult(_0x27d4a3,null))[_0x48e4('0x2b')](handleError(_0x27d4a3,null));}; \ No newline at end of file +var _0x25a3=['indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','SmsMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','include','catch','show','params','rawAttributes','includeAll','options','find','create','body','describe','sms-interactions','accept','sms','read','readAt','format','UserId','user','CmContact','get','SmsInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','../../config/logger','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','MessageUUID'];(function(_0x54613e,_0x1ed801){var _0x2f8572=function(_0x4834e1){while(--_0x4834e1){_0x54613e['push'](_0x54613e['shift']());}};_0x2f8572(++_0x1ed801);}(_0x25a3,0x121));var _0x325a=function(_0x1a6903,_0x18943d){_0x1a6903=_0x1a6903-0x0;var _0xc5a81b=_0x25a3[_0x1a6903];return _0xc5a81b;};'use strict';var pdf=require(_0x325a('0x0'));var emlformat=require(_0x325a('0x1'));var rimraf=require(_0x325a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x325a('0x3'));var rp=require('request-promise');var moment=require(_0x325a('0x4'));var BPromise=require(_0x325a('0x5'));var Mustache=require(_0x325a('0x6'));var util=require('util');var path=require(_0x325a('0x7'));var sox=require(_0x325a('0x8'));var csv=require(_0x325a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x325a('0xa'));var crypto=require(_0x325a('0xb'));var jsforce=require(_0x325a('0xc'));var deskjs=require(_0x325a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x325a('0xe'));var Redis=require(_0x325a('0xf'));var authService=require(_0x325a('0x10'));var qs=require(_0x325a('0x11'));var as=require(_0x325a('0x12'));var hardwareService=require(_0x325a('0x13'));var logger=require('../../config/logger')(_0x325a('0x14'));var utils=require(_0x325a('0x15'));var config=require('../../config/environment');var db=require(_0x325a('0x16'))['db'];config[_0x325a('0x17')]=_[_0x325a('0x18')](config[_0x325a('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x325a('0x17')]));require('./smsMessage.socket')[_0x325a('0x19')](socket);var jayson=require(_0x325a('0x1a'));var client=jayson[_0x325a('0x1b')][_0x325a('0x1c')]({'port':0x232c});var client9002=jayson[_0x325a('0x1b')][_0x325a('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x1d7efc,_0x4412ba,_0x1fd4ec){if(_0x1fd4ec){var _0x1b0f33=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1b0f33[_0x325a('0x1d')](_0x4412ba)){return _0x1d7efc;}else{throw new db[(_0x325a('0x1e'))][(_0x325a('0x1f'))](_0x325a('0x20'));}}else{return _0x1d7efc;}}function respondWithRpcPromise(_0x4d934d,_0x4cba7,_0x4fbd50,_0x4a1f9f){return new BPromise(function(_0x34c4c8,_0x192aa2){var _0xdba744=_0x4a1f9f||client;return _0xdba744[_0x325a('0x21')](_0x4d934d,_0x4fbd50)[_0x325a('0x22')](function(_0x993bff){logger[_0x325a('0x23')](_0x325a('0x24'),_0x4cba7,_0x325a('0x25'));logger[_0x325a('0x26')](_0x325a('0x27'),_0x4cba7,_0x325a('0x25'),JSON['stringify'](_0x993bff));if(_0x993bff[_0x325a('0x28')]){if(_0x993bff[_0x325a('0x28')][_0x325a('0x29')]===0x1f4){logger[_0x325a('0x28')](_0x325a('0x24'),_0x4cba7,_0x993bff[_0x325a('0x28')]['message']);return _0x192aa2(_0x993bff[_0x325a('0x28')]['message']);}logger[_0x325a('0x28')](_0x325a('0x24'),_0x4cba7,_0x993bff[_0x325a('0x28')][_0x325a('0x2a')]);return _0x34c4c8(_0x993bff[_0x325a('0x28')]['message']);}else{logger[_0x325a('0x23')]('SmsMessage,\x20%s,\x20%s',_0x4cba7,_0x325a('0x25'));_0x34c4c8(_0x993bff[_0x325a('0x2b')][_0x325a('0x2a')]);}})['catch'](function(_0x2ff37a){logger[_0x325a('0x28')](_0x325a('0x24'),_0x4cba7,_0x2ff37a);_0x192aa2(_0x2ff37a);});});}function respondWithStatusCode(_0x473d91,_0xc6c008){_0xc6c008=_0xc6c008||0xcc;return function(_0x18a8d7){if(_0x18a8d7){return _0x473d91[_0x325a('0x2c')](_0xc6c008);}return _0x473d91[_0x325a('0x2d')](_0xc6c008)[_0x325a('0x2e')]();};}function respondWithResult(_0x5cdfd1,_0x201e01){_0x201e01=_0x201e01||0xc8;return function(_0x3fa4f6){if(_0x3fa4f6){return _0x5cdfd1[_0x325a('0x2d')](_0x201e01)[_0x325a('0x2f')](_0x3fa4f6);}};}function respondWithFilteredResult(_0x44311d,_0x5acbcd){return function(_0x27b3f7){if(_0x27b3f7){var _0x4b1e46=_0x27b3f7[_0x325a('0x30')],_0x34ef69=_0x5acbcd[_0x325a('0x31')],_0x1f487e=_0x5acbcd[_0x325a('0x31')]+_0x5acbcd[_0x325a('0x32')],_0x5b66e9;if(_0x1f487e>=_0x4b1e46){_0x1f487e=_0x4b1e46;_0x5b66e9=0xc8;}else{_0x5b66e9=0xce;}_0x44311d['status'](_0x5b66e9);return _0x44311d[_0x325a('0x33')](_0x325a('0x34'),_0x34ef69+'-'+_0x1f487e+'/'+_0x4b1e46)[_0x325a('0x2f')](_0x27b3f7);}return null;};}function patchUpdates(_0x46b5b2){return function(_0x4c0132){try{jsonpatch[_0x325a('0x35')](_0x4c0132,_0x46b5b2,!![]);}catch(_0x518604){return BPromise[_0x325a('0x36')](_0x518604);}return _0x4c0132[_0x325a('0x37')]();};}function saveUpdates(_0x26cabc,_0x41562f){return function(_0x4c330e){if(_0x4c330e){return _0x4c330e[_0x325a('0x38')](_0x26cabc)[_0x325a('0x22')](function(_0x4e9795){return _0x4e9795;});}return null;};}function removeEntity(_0x3a283f,_0x3d53ef){return function(_0x5bcf31){if(_0x5bcf31){return _0x5bcf31[_0x325a('0x39')]()['then'](function(){_0x3a283f[_0x325a('0x2d')](0xcc)[_0x325a('0x2e')]();});}};}function handleEntityNotFound(_0x245aed,_0x36b7c7){return function(_0x585d01){if(!_0x585d01){_0x245aed[_0x325a('0x2c')](0x194);}return _0x585d01;};}function handleError(_0x5ef8fc,_0x88b327){_0x88b327=_0x88b327||0x1f4;return function(_0x5a92c2){logger['error'](_0x5a92c2[_0x325a('0x3a')]);if(_0x5a92c2[_0x325a('0x3b')]){delete _0x5a92c2[_0x325a('0x3b')];}_0x5ef8fc['status'](_0x88b327)[_0x325a('0x3c')](_0x5a92c2);};}exports['index']=function(_0xfc32bc,_0x445da7){var _0xc264e3={},_0xb99e9d={},_0x3877c6={'count':0x0,'rows':[]};var _0x1caa7f=_[_0x325a('0x3d')](db[_0x325a('0x3e')]['rawAttributes'],function(_0x45b9cc){return{'name':_0x45b9cc[_0x325a('0x3f')],'type':_0x45b9cc[_0x325a('0x40')][_0x325a('0x41')]};});_0xb99e9d[_0x325a('0x42')]=_[_0x325a('0x3d')](_0x1caa7f,_0x325a('0x3b'));_0xb99e9d[_0x325a('0x43')]=_[_0x325a('0x44')](_0xfc32bc['query']);_0xb99e9d[_0x325a('0x45')]=_[_0x325a('0x46')](_0xb99e9d[_0x325a('0x42')],_0xb99e9d[_0x325a('0x43')]);_0xc264e3[_0x325a('0x47')]=_[_0x325a('0x46')](_0xb99e9d[_0x325a('0x42')],qs[_0x325a('0x48')](_0xfc32bc[_0x325a('0x43')][_0x325a('0x48')]));_0xc264e3[_0x325a('0x47')]=_0xc264e3['attributes'][_0x325a('0x49')]?_0xc264e3[_0x325a('0x47')]:_0xb99e9d[_0x325a('0x42')];if(!_0xfc32bc[_0x325a('0x43')][_0x325a('0x4a')](_0x325a('0x4b'))){_0xc264e3['limit']=qs[_0x325a('0x32')](_0xfc32bc[_0x325a('0x43')][_0x325a('0x32')]);_0xc264e3[_0x325a('0x31')]=qs[_0x325a('0x31')](_0xfc32bc['query'][_0x325a('0x31')]);}_0xc264e3[_0x325a('0x4c')]=qs[_0x325a('0x4d')](_0xfc32bc['query'][_0x325a('0x4d')]);_0xc264e3[_0x325a('0x4e')]=qs[_0x325a('0x45')](_['pick'](_0xfc32bc['query'],_0xb99e9d[_0x325a('0x45')]),_0x1caa7f);if(_0xfc32bc[_0x325a('0x43')][_0x325a('0x4f')]){_0xc264e3[_0x325a('0x4e')]=_['merge'](_0xc264e3[_0x325a('0x4e')],{'$or':_[_0x325a('0x3d')](_0x1caa7f,function(_0x50cd19){if(_0x50cd19[_0x325a('0x40')]!==_0x325a('0x50')){var _0x4c751c={};_0x4c751c[_0x50cd19[_0x325a('0x3b')]]={'$like':'%'+_0xfc32bc[_0x325a('0x43')]['filter']+'%'};return _0x4c751c;}})});}_0xc264e3=_[_0x325a('0x51')]({},_0xc264e3,_0xfc32bc['options']);var _0x53df12={'where':_0xc264e3[_0x325a('0x4e')]};return db[_0x325a('0x3e')][_0x325a('0x30')](_0x53df12)['then'](function(_0x13faee){_0x3877c6[_0x325a('0x30')]=_0x13faee;if(_0xfc32bc['query']['includeAll']){_0xc264e3[_0x325a('0x52')]=[{'all':!![]}];}return db[_0x325a('0x3e')]['findAll'](_0xc264e3);})[_0x325a('0x22')](function(_0x4ab88b){_0x3877c6['rows']=_0x4ab88b;return _0x3877c6;})['then'](respondWithFilteredResult(_0x445da7,_0xc264e3))[_0x325a('0x53')](handleError(_0x445da7,null));};exports[_0x325a('0x54')]=function(_0x5c3c04,_0xf5fb62){var _0x32ac20={'raw':!![],'where':{'id':_0x5c3c04[_0x325a('0x55')]['id']}},_0x579b4f={};_0x579b4f[_0x325a('0x42')]=_[_0x325a('0x44')](db[_0x325a('0x3e')][_0x325a('0x56')]);_0x579b4f[_0x325a('0x43')]=_['keys'](_0x5c3c04[_0x325a('0x43')]);_0x579b4f[_0x325a('0x45')]=_['intersection'](_0x579b4f[_0x325a('0x42')],_0x579b4f['query']);_0x32ac20[_0x325a('0x47')]=_[_0x325a('0x46')](_0x579b4f[_0x325a('0x42')],qs[_0x325a('0x48')](_0x5c3c04[_0x325a('0x43')][_0x325a('0x48')]));_0x32ac20[_0x325a('0x47')]=_0x32ac20[_0x325a('0x47')][_0x325a('0x49')]?_0x32ac20[_0x325a('0x47')]:_0x579b4f['model'];if(_0x5c3c04[_0x325a('0x43')][_0x325a('0x57')]){_0x32ac20['include']=[{'all':!![]}];}_0x32ac20=_[_0x325a('0x51')]({},_0x32ac20,_0x5c3c04[_0x325a('0x58')]);return db[_0x325a('0x3e')][_0x325a('0x59')](_0x32ac20)[_0x325a('0x22')](handleEntityNotFound(_0xf5fb62,null))[_0x325a('0x22')](respondWithResult(_0xf5fb62,null))[_0x325a('0x53')](handleError(_0xf5fb62,null));};exports[_0x325a('0x5a')]=function(_0x45d8a4,_0xc022fd){return db[_0x325a('0x3e')][_0x325a('0x5a')](_0x45d8a4[_0x325a('0x5b')],{})[_0x325a('0x22')](respondWithResult(_0xc022fd,0xc9))['catch'](handleError(_0xc022fd,null));};exports[_0x325a('0x38')]=function(_0x17e576,_0x140a40){if(_0x17e576[_0x325a('0x5b')]['id']){delete _0x17e576[_0x325a('0x5b')]['id'];}return db[_0x325a('0x3e')][_0x325a('0x59')]({'where':{'id':_0x17e576[_0x325a('0x55')]['id']}})[_0x325a('0x22')](handleEntityNotFound(_0x140a40,null))[_0x325a('0x22')](saveUpdates(_0x17e576[_0x325a('0x5b')],null))[_0x325a('0x22')](respondWithResult(_0x140a40,null))['catch'](handleError(_0x140a40,null));};exports[_0x325a('0x39')]=function(_0x110f26,_0x50e0b9){return db[_0x325a('0x3e')][_0x325a('0x59')]({'where':{'id':_0x110f26[_0x325a('0x55')]['id']}})['then'](handleEntityNotFound(_0x50e0b9,null))[_0x325a('0x22')](removeEntity(_0x50e0b9,null))[_0x325a('0x53')](handleError(_0x50e0b9,null));};exports[_0x325a('0x5c')]=function(_0xaeff87,_0x3d0f93){return db[_0x325a('0x3e')][_0x325a('0x5c')]()[_0x325a('0x22')](respondWithResult(_0x3d0f93,null))[_0x325a('0x53')](handleError(_0x3d0f93,null));};var interaction_log=require('../../config/logger')(_0x325a('0x5d'));exports[_0x325a('0x5e')]=function(_0x30a431,_0x3a93cc,_0x283765){var _0x292f0c={'channel':_0x325a('0x5f')};if(_0x30a431[_0x325a('0x5b')]['id']){delete _0x30a431[_0x325a('0x5b')]['id'];}_0x30a431[_0x325a('0x5b')][_0x325a('0x60')]=!![];_0x30a431[_0x325a('0x5b')][_0x325a('0x61')]=moment()[_0x325a('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x30a431[_0x325a('0x5b')][_0x325a('0x63')]=_0x30a431['body'][_0x325a('0x63')]||_0x30a431[_0x325a('0x64')]['id'];return db[_0x325a('0x3e')][_0x325a('0x59')]({'where':{'id':_0x30a431[_0x325a('0x55')]['id'],'UserId':null},'include':[{'model':db[_0x325a('0x65')],'as':'Contact'}]})[_0x325a('0x22')](handleEntityNotFound(_0x3a93cc,null))[_0x325a('0x22')](saveUpdates(_0x30a431[_0x325a('0x5b')],null))[_0x325a('0x22')](function(_0x333db2){if(_0x333db2){_0x292f0c['message']=_0x333db2[_0x325a('0x66')]({'plain':!![]});return db[_0x325a('0x67')]['find']({'where':{'id':_0x333db2['SmsInteractionId']}});}return null;})[_0x325a('0x22')](handleEntityNotFound(_0x3a93cc,null))['then'](function(_0x586a32){if(_0x586a32){return _0x586a32[_0x325a('0x38')]({'UserId':_0x30a431[_0x325a('0x5b')]['UserId'],'read1stAt':_[_0x325a('0x68')](_0x586a32[_0x325a('0x69')])?moment()['format'](_0x325a('0x6a')):undefined});}return null;})['then'](function(_0x37fc7e){if(_0x37fc7e){_0x292f0c[_0x325a('0x6b')]=_0x37fc7e[_0x325a('0x66')]({'plain':!![]});interaction_log[_0x325a('0x23')](_0x325a('0x6c'),_0x30a431[_0x325a('0x64')]['id'],_0x30a431['user'][_0x325a('0x3b')],_0x30a431[_0x325a('0x64')][_0x325a('0x6d')],_0x292f0c['interaction']['id'],_0x30a431['body']?JSON['stringify'](_0x30a431[_0x325a('0x5b')]):_0x325a('0x6e'));return respondWithRpcPromise('AcceptMessage',_0x325a('0x6f'),_0x292f0c);}return null;})[_0x325a('0x22')](function(_0x5afb20){if(_0x5afb20){if(_0x30a431[_0x325a('0x5b')]['manual']){_0x292f0c[_0x325a('0x2a')][_0x325a('0x70')]=util[_0x325a('0x62')](_0x325a('0x71'),_0x30a431[_0x325a('0x64')][_0x325a('0x3b')]);_0x292f0c[_0x325a('0x2a')][_0x325a('0x72')]=_0x292f0c[_0x325a('0x72')];_0x292f0c[_0x325a('0x2a')][_0x325a('0x73')]=_0x325a('0x5e');return respondWithRpcPromise(_0x325a('0x74'),'EventManager',{'event':_0x325a('0x75'),'message':_0x292f0c[_0x325a('0x2a')]},client9002)['then'](function(){return _0x292f0c;});}return _0x292f0c;}return null;})[_0x325a('0x22')](respondWithResult(_0x3a93cc,null))[_0x325a('0x53')](handleError(_0x3a93cc,null));};var interaction_log=require(_0x325a('0x76'))('sms-interactions');exports['reject']=function(_0xb31055,_0x27e25b,_0x57e222){var _0x4d4dbc={'agent':{},'channel':_0x325a('0x5f')};if(_0xb31055[_0x325a('0x5b')]['id']){delete _0xb31055[_0x325a('0x5b')]['id'];}_0xb31055['body'][_0x325a('0x63')]=_0xb31055[_0x325a('0x5b')]['UserId']||_0xb31055[_0x325a('0x64')]['id'];_0x4d4dbc[_0x325a('0x77')]['id']=_0xb31055[_0x325a('0x5b')][_0x325a('0x63')];return db['SmsMessage'][_0x325a('0x59')]({'where':{'id':_0xb31055[_0x325a('0x55')]['id'],'UserId':null}})[_0x325a('0x22')](handleEntityNotFound(_0x27e25b,null))[_0x325a('0x22')](function(_0x21825b){if(_0x21825b){_0x4d4dbc[_0x325a('0x2a')]=_0x21825b[_0x325a('0x66')]({'plain':!![]});return db[_0x325a('0x67')]['find']({'where':{'id':_0x21825b['SmsInteractionId']}});}return null;})[_0x325a('0x22')](handleEntityNotFound(_0x27e25b,null))['then'](function(_0x25af14){if(_0x25af14){_0x4d4dbc[_0x325a('0x6b')]=_0x25af14[_0x325a('0x66')]({'plain':!![]});interaction_log[_0x325a('0x23')](_0x325a('0x78'),_0xb31055[_0x325a('0x64')]['id'],_0xb31055[_0x325a('0x64')][_0x325a('0x3b')],_0xb31055[_0x325a('0x64')][_0x325a('0x6d')],_0x4d4dbc[_0x325a('0x6b')]['id'],_0xb31055[_0x325a('0x5b')]?JSON['stringify'](_0xb31055[_0x325a('0x5b')]):'null');return respondWithRpcPromise('RejectMessage',_0x325a('0x79'),_0x4d4dbc);}return null;})[_0x325a('0x22')](function(_0x242eb2){if(_0x242eb2){_0x242eb2[_0x325a('0x2a')][_0x325a('0x70')]=util[_0x325a('0x62')](_0x325a('0x71'),_0xb31055[_0x325a('0x64')][_0x325a('0x3b')]);_0x242eb2[_0x325a('0x2a')][_0x325a('0x72')]=_0x4d4dbc['channel'];_0x242eb2[_0x325a('0x2a')][_0x325a('0x73')]='reject';respondWithRpcPromise(_0x325a('0x74'),'EventManager',{'event':_0x325a('0x7a'),'message':_0x242eb2[_0x325a('0x2a')]},client9002);return _0x4d4dbc;}return null;})[_0x325a('0x22')](respondWithResult(_0x27e25b,null))['catch'](handleError(_0x27e25b,null));};exports['status']=function(_0x4885c9,_0x118cc0,_0x4678b4){if(_0x4885c9[_0x325a('0x5b')]['id']){delete _0x4885c9['body']['id'];}var _0xdbad46;return db[_0x325a('0x3e')]['find']({'where':{'id':_0x4885c9['params']['id']}})['then'](handleEntityNotFound(_0x118cc0,null))['then'](function(_0x15f11e){if(_0x15f11e){_0xdbad46=_0x15f11e;return db[_0x325a('0x7b')][_0x325a('0x59')]({'where':{'id':_0x15f11e['SmsAccountId']}});}})['then'](handleEntityNotFound(_0x118cc0,null))[_0x325a('0x22')](function(_0x35f248){if(_0x35f248){logger[_0x325a('0x26')](_0x325a('0x27'),_0x325a('0x2d'),_0x325a('0x7c'),_0x35f248['type'],util[_0x325a('0x7d')](_0x4885c9[_0x325a('0x5b')],{'showHidden':![],'depth':null}));switch(_0x35f248[_0x325a('0x40')]){case'twilio':if(_0x4885c9['body'][_0x325a('0x7e')]&&_0x4885c9[_0x325a('0x5b')][_0x325a('0x7e')]===_0xdbad46[_0x325a('0x7f')]){return _0xdbad46[_0x325a('0x38')]({'read':!![]});}else{logger['error'](_0x325a('0x80'),_0x325a('0x2d'),_0x325a('0x81'),util['inspect'](_0x4885c9[_0x325a('0x5b')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x4885c9[_0x325a('0x5b')][_0x325a('0x82')]&&_0x4885c9['body'][_0x325a('0x82')]===_0xdbad46[_0x325a('0x7f')]&&_[_0x325a('0x83')]([_0x325a('0x84'),_0x325a('0x85')],_0x4885c9[_0x325a('0x5b')][_0x325a('0x86')])>=0x0){return _0xdbad46[_0x325a('0x38')]({'read':!![]});}else{logger[_0x325a('0x28')](_0x325a('0x80'),_0x325a('0x2d'),_0x325a('0x87'),util[_0x325a('0x7d')](_0x4885c9[_0x325a('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x325a('0x88'):var _0x27d2a6=_0x4885c9[_0x325a('0x5b')][_0x325a('0x89')][0x0];if(_0x27d2a6[_0x325a('0x2d')][_0x325a('0x8a')]===_0x325a('0x8b')){return _0xdbad46[_0x325a('0x38')]({'read':!![]});}else{logger['error'](_0x325a('0x80'),_0x325a('0x2d'),_0x325a('0x88'),util[_0x325a('0x7d')](_0x4885c9[_0x325a('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0xdbad46;}})[_0x325a('0x22')](respondWithResult(_0x118cc0,null))[_0x325a('0x53')](handleError(_0x118cc0,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index afc3788..13f0c99 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 _0xe820=['remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x8e579f,_0x5d7ddd){var _0x438bcb=function(_0x1fb930){while(--_0x1fb930){_0x8e579f['push'](_0x8e579f['shift']());}};_0x438bcb(++_0x5d7ddd);}(_0xe820,0x114));var _0x0e82=function(_0x9d3ae8,_0x9217bc){_0x9d3ae8=_0x9d3ae8-0x0;var _0x24d9f2=_0xe820[_0x9d3ae8];return _0x24d9f2;};'use strict';var EventEmitter=require(_0x0e82('0x0'));var SmsMessage=require(_0x0e82('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x0e82('0x2')](0x0);var events={'afterCreate':_0x0e82('0x3'),'afterUpdate':'update','afterDestroy':_0x0e82('0x4')};function emitEvent(_0x142a22){return function(_0x14100e,_0x8927ef,_0x37285c){SmsMessageEvents[_0x0e82('0x5')](_0x142a22+':'+_0x14100e['id'],_0x14100e);SmsMessageEvents[_0x0e82('0x5')](_0x142a22,_0x14100e);_0x37285c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x0e82('0x6')](e,emitEvent(event));}}module[_0x0e82('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0xb750=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x2143ff,_0x3c0b09){var _0x215a1a=function(_0x2f1f8e){while(--_0x2f1f8e){_0x2143ff['push'](_0x2143ff['shift']());}};_0x215a1a(++_0x3c0b09);}(_0xb750,0x132));var _0x0b75=function(_0x3c2780,_0x18917e){_0x3c2780=_0x3c2780-0x0;var _0x24d83d=_0xb750[_0x3c2780];return _0x24d83d;};'use strict';var EventEmitter=require(_0x0b75('0x0'));var SmsMessage=require(_0x0b75('0x1'))['db'][_0x0b75('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x0b75('0x3')](0x0);var events={'afterCreate':_0x0b75('0x4'),'afterUpdate':_0x0b75('0x5'),'afterDestroy':_0x0b75('0x6')};function emitEvent(_0x790736){return function(_0x505277,_0x489078,_0xd352c6){SmsMessageEvents[_0x0b75('0x7')](_0x790736+':'+_0x505277['id'],_0x505277);SmsMessageEvents[_0x0b75('0x7')](_0x790736,_0x505277);_0xd352c6(null);};}for(var e in events){if(events[_0x0b75('0x8')](e)){var event=events[e];SmsMessage[_0x0b75('0x9')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index e0341b3..a54cc3a 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 _0xebda=['/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','GET','split','sms','POST','total_sent','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','clickSend','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','authId','toString','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','timestamp','keys','length','digest','hex','/external/get/send.php?','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','Token\x20not\x20received','finally','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsMessage','sms_messages','messageId','body','get','direction','toLowerCase','out','secret','UserId','SmsInteraction','findOne','SmsInteractionId','update','catch','then','type','accountSid','authToken','phone','messages','create','remote'];(function(_0x4f8931,_0x2879a8){var _0x35c82d=function(_0x43a484){while(--_0x43a484){_0x4f8931['push'](_0x4f8931['shift']());}};_0x35c82d(++_0x2879a8);}(_0xebda,0x12f));var _0xaebd=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xebda[_0xd0b415];return _0x2bdf2c;};'use strict';var _=require(_0xaebd('0x0'));var util=require(_0xaebd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xaebd('0x2'));var BPromise=require(_0xaebd('0x3'));var rp=require(_0xaebd('0x4'));var fs=require('fs');var path=require(_0xaebd('0x5'));var rimraf=require(_0xaebd('0x6'));var config=require(_0xaebd('0x7'));var attributes=require('./smsMessage.attributes');module[_0xaebd('0x8')]=function(_0x451995,_0x5a3a3b){return _0x451995[_0xaebd('0x9')](_0xaebd('0xa'),attributes,{'tableName':_0xaebd('0xb'),'paranoid':![],'indexes':[{'name':_0xaebd('0xc'),'fields':[_0xaebd('0xc')]},{'name':'fti_sms_messages','fields':[_0xaebd('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x21f52e,_0xcdc332,_0x19d2a9){var _0x16b4c1=_0x451995['models'];var _0x537261=_0x21f52e[_0xaebd('0xe')]({'plain':!![]});if(_0x537261[_0xaebd('0xf')]['toLowerCase']()==='in'||_0x537261[_0xaebd('0xf')][_0xaebd('0x10')]()===_0xaebd('0x11')&&!_0x537261[_0xaebd('0x12')]&&!_['isNil'](_0x537261[_0xaebd('0x13')])){_0x16b4c1[_0xaebd('0x14')][_0xaebd('0x15')]({'where':{'id':_0x537261[_0xaebd('0x16')]}})['then'](function(_0x161160){if(_0x161160){_0x161160[_0xaebd('0x17')]({'lastMsgAt':_0x537261['createdAt'],'lastMsgDirection':_0x537261[_0xaebd('0xf')][_0xaebd('0x10')]()});}})[_0xaebd('0x18')](function(_0xbe606b){console['error'](_0xbe606b);});}if(_0x537261[_0xaebd('0xf')]===_0xaebd('0x11')&&!_0x537261[_0xaebd('0x12')]){var _0x493607;_0x16b4c1['SmsAccount']['find']({'where':{'id':_0x537261['SmsAccountId']},'raw':!![]})[_0xaebd('0x19')](function(_0x208a9f){_0x493607=_0x208a9f;if(_0x493607&&_0x493607[_0xaebd('0x1a')]){switch(_0x493607[_0xaebd('0x1a')]){case'twilio':var _0x375053=require('twilio');if(_0x493607[_0xaebd('0x1b')]&&_0x493607[_0xaebd('0x1c')]&&_0x493607[_0xaebd('0x1d')]){var _0x415d7d=new _0x375053(_0x493607['accountSid'],_0x493607[_0xaebd('0x1c')]);_0x415d7d[_0xaebd('0x1e')][_0xaebd('0x1f')]({'body':_0x537261[_0xaebd('0xd')],'to':_0x537261['phone'],'from':_0x493607[_0xaebd('0x1d')],'statusCallback':_0x493607[_0xaebd('0x20')]+'/api/sms/messages/'+_0x537261['id']+_0xaebd('0x21')+_0x493607[_0xaebd('0x22')]})[_0xaebd('0x19')](function(_0x3c4014){if(_0x3c4014[_0xaebd('0x23')]){return _0x21f52e[_0xaebd('0x17')]({'messageId':_0x3c4014[_0xaebd('0x23')]});}})[_0xaebd('0x18')](function(_0x4644b1){logger[_0xaebd('0x24')](_0xaebd('0x25'),_0xaebd('0x26'),_0xaebd('0x27'),util[_0xaebd('0x28')](_0x4644b1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xaebd('0x25'),_0xaebd('0x26'),_0xaebd('0x27'),_0xaebd('0x29'));}break;case'skebby':var _0x111f8f=_0xaebd('0x2a');if(_0x493607[_0xaebd('0x2b')]&&_0x493607[_0xaebd('0x2c')]){var _0x2426c4={'recipient':[_0x537261[_0xaebd('0x1d')]],'message':_0x537261[_0xaebd('0xd')],'message_type':_0x493607[_0xaebd('0x2d')]};if(_0x493607[_0xaebd('0x2d')]&&_0x493607[_0xaebd('0x2d')]!=='SI'){_0x2426c4[_0xaebd('0x2e')]=_0x493607[_0xaebd('0x1d')];}var _0x2e29d6={'url':_0x111f8f+_0xaebd('0x2f')+_0x493607['username']+'&password='+_0x493607['password'],'method':_0xaebd('0x30')};rp(_0x2e29d6)[_0xaebd('0x19')](function(_0x3942f8){var _0x263fa8=_0x3942f8[_0xaebd('0x31')](';');var _0x339150={'user_key':_0x263fa8[0x0],'session_key':_0x263fa8[0x1]};_0x2e29d6={'url':_0x111f8f+_0xaebd('0x32'),'method':_0xaebd('0x33'),'headers':{'user_key':_0x339150['user_key'],'Session_key':_0x339150['session_key']},'json':!![],'body':_0x2426c4};return rp(_0x2e29d6);})[_0xaebd('0x19')](function(_0x338828){if(_0x338828[_0xaebd('0x34')]>=0x1){var _0x3bf11f={'messageId':_0x338828[_0xaebd('0x35')]};if(_0x493607[_0xaebd('0x2d')]!=='GP'||!_0x493607[_0xaebd('0x36')]){_0x3bf11f[_0xaebd('0x37')]=!![];}return _0x21f52e[_0xaebd('0x17')](_0x3bf11f);}else{return logger[_0xaebd('0x24')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaebd('0x26'),_0xaebd('0x38'),util[_0xaebd('0x28')](_0x338828,{'showHidden':![],'depth':null}));}})[_0xaebd('0x18')](function(_0x5b7ec1){return logger[_0xaebd('0x24')](_0xaebd('0x25'),'afterCreate',_0xaebd('0x38'),util[_0xaebd('0x28')](_0x5b7ec1,{'showHidden':![],'depth':null}));});}else{logger[_0xaebd('0x24')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xaebd('0x38'),_0xaebd('0x39'));}break;case _0xaebd('0x3a'):if(_0x493607['authToken']){var _0x913287={'recipient':_0x537261[_0xaebd('0x1d')],'message':_0x537261['body'],'sender':_0x493607[_0xaebd('0x3b')]||_0x493607[_0xaebd('0x1d')],'authorization':_0x493607['authToken']};var _0xcdc332={'method':_0xaebd('0x33'),'uri':_0xaebd('0x3c'),'body':_0x913287,'json':!![]};rp(_0xcdc332)[_0xaebd('0x19')](function(_0x3b3460){var _0x5368af={'messageId':_0x3b3460[_0xaebd('0x3d')]};if(!_0x493607[_0xaebd('0x36')]){_0x5368af[_0xaebd('0x37')]=!![];}return _0x21f52e[_0xaebd('0x17')](_0x5368af);})[_0xaebd('0x18')](function(_0x3eddec){logger[_0xaebd('0x24')](_0xaebd('0x25'),'afterCreate',_0xaebd('0x3a'),util['inspect'](_0x3eddec,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaebd('0x26'),_0xaebd('0x3a'),_0xaebd('0x3e'));}break;case _0xaebd('0x3f'):if(_0x493607[_0xaebd('0x2b')]&&_0x493607[_0xaebd('0x2c')]){var _0x913287={'messages':[{'source':_0xaebd('0x40'),'to':_0x537261[_0xaebd('0x1d')],'body':_0x537261[_0xaebd('0xd')],'from':_0x493607['senderString']||_0x493607[_0xaebd('0x1d')]}]};var _0xe56ee0=util[_0xaebd('0x41')](_0xaebd('0x42'),_0x493607[_0xaebd('0x2b')],_0x493607['password']);var _0xcdc332={'method':_0xaebd('0x33'),'uri':_0xaebd('0x43'),'body':_0x913287,'headers':{'Authorization':util['format'](_0xaebd('0x44'),new Buffer(_0xe56ee0)['toString'](_0xaebd('0x45')))},'json':!![]};rp(_0xcdc332)[_0xaebd('0x19')](function(_0x3fe9e9){if(_0x3fe9e9[_0xaebd('0x46')]>=0xc8&&_0x3fe9e9[_0xaebd('0x46')]<=0xce){if(_0x3fe9e9[_0xaebd('0x47')]&&_0x3fe9e9[_0xaebd('0x47')][_0xaebd('0x48')]>0x0){var _0x569759=_[_0xaebd('0x49')](_0x3fe9e9[_0xaebd('0x47')][_0xaebd('0x1e')]);var _0x4bfdf1={'messageId':_0x569759['message_id']};if(!_0x493607[_0xaebd('0x36')]){_0x4bfdf1['read']=!![];}return _0x21f52e[_0xaebd('0x17')](_0x4bfdf1);}else{logger[_0xaebd('0x24')](_0xaebd('0x25'),'afterCreate',_0xaebd('0x4a'),util['inspect'](_0x3fe9e9,{'showHidden':![],'depth':null}));}}else{logger[_0xaebd('0x24')](_0xaebd('0x25'),_0xaebd('0x26'),_0xaebd('0x4a'),util['inspect'](_0x3fe9e9,{'showHidden':![],'depth':null}));}})['catch'](function(_0xbfb1ff){logger[_0xaebd('0x24')](_0xaebd('0x25'),_0xaebd('0x26'),_0xaebd('0x4a'),util[_0xaebd('0x28')](_0xbfb1ff,{'showHidden':![],'depth':null}));});}else{logger[_0xaebd('0x24')](_0xaebd('0x25'),_0xaebd('0x26'),'clickSend','Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x493607['authId']&&_0x493607[_0xaebd('0x1c')]){var _0x913287={'dst':_0x537261[_0xaebd('0x1d')],'text':_0x537261[_0xaebd('0xd')],'src':_0x493607[_0xaebd('0x3b')]||_0x493607[_0xaebd('0x1d')],'url':_0x493607[_0xaebd('0x20')]+_0xaebd('0x4b')+_0x537261['id']+_0xaebd('0x21')+_0x493607['token']};var _0xe56ee0=util[_0xaebd('0x41')](_0xaebd('0x42'),_0x493607['authId'],_0x493607[_0xaebd('0x1c')]);var _0xcdc332={'method':_0xaebd('0x33'),'uri':util[_0xaebd('0x41')](_0xaebd('0x4c'),_0x493607[_0xaebd('0x4d')]),'body':_0x913287,'headers':{'Authorization':util['format'](_0xaebd('0x44'),new Buffer(_0xe56ee0)[_0xaebd('0x4e')](_0xaebd('0x45')))},'json':!![]};rp(_0xcdc332)['then'](function(_0x52f6ef){var _0x1e4c97={'messageId':_0x52f6ef[_0xaebd('0x4f')][0x0]};return _0x21f52e[_0xaebd('0x17')](_0x1e4c97);})[_0xaebd('0x18')](function(_0x48ea49){logger[_0xaebd('0x24')](_0xaebd('0x25'),'afterCreate',_0xaebd('0x50'),util['inspect'](_0x48ea49,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaebd('0x26'),_0xaebd('0x50'),_0xaebd('0x51'));}break;case _0xaebd('0x52'):if(_0x493607[_0xaebd('0x2b')]&&_0x493607['password']){if(_0x493607[_0xaebd('0x53')]){var _0x59feb9={'method':_0xaebd('0x33'),'uri':_0x493607[_0xaebd('0x53')]+_0xaebd('0x54'),'body':{'username':_0x493607[_0xaebd('0x2b')],'password':_0x493607[_0xaebd('0x2c')]},'json':!![]};return rp(_0x59feb9)['then'](function(_0x443b0a){var _0x484e53={'method':_0xaebd('0x33'),'uri':_0x493607[_0xaebd('0x53')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x493607[_0xaebd('0x1d')],'destinations':[{'to':_0x537261[_0xaebd('0x1d')]}],'text':_0x537261[_0xaebd('0xd')],'notifyUrl':_0x493607[_0xaebd('0x20')]+_0xaebd('0x4b')+_0x537261['id']+'/status?token='+_0x493607[_0xaebd('0x22')],'notifyContentType':_0xaebd('0x55'),'callbackData':_0x493607[_0xaebd('0x1d')]+';'+_0x537261['body']}]},'headers':{'Authorization':_0xaebd('0x56')+_0x443b0a[_0xaebd('0x22')]},'json':!![]};return rp(_0x484e53)['then'](function(_0x11f24b){if(_0x11f24b[_0xaebd('0x1e')]){var _0x15d7c9={'messageId':_0x11f24b[_0xaebd('0x1e')][0x0]['messageId']};if(!_0x493607[_0xaebd('0x36')]){_0x15d7c9[_0xaebd('0x37')]=!![];}return _0x21f52e[_0xaebd('0x17')](_0x15d7c9);}else{return logger[_0xaebd('0x24')](_0xaebd('0x25'),_0xaebd('0x26'),_0xaebd('0x52'),util['inspect'](_0x11f24b,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x21d2d1){return logger[_0xaebd('0x24')](_0xaebd('0x25'),_0xaebd('0x26'),_0xaebd('0x52'),util[_0xaebd('0x28')](_0x21d2d1,{'showHidden':![],'depth':null}));});}else{logger[_0xaebd('0x24')](_0xaebd('0x25'),'afterCreate',_0xaebd('0x52'),_0xaebd('0x57'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaebd('0x26'),_0xaebd('0x52'),_0xaebd('0x39'));}break;case _0xaebd('0x58'):var _0xeac2ff=require(_0xaebd('0x59'));if(_0x493607[_0xaebd('0x5a')]){var _0x1d81f7={};_0x1d81f7['login']=_0x493607['username'];_0x1d81f7[_0xaebd('0x1d')]=_0x537261[_0xaebd('0x1d')];_0x1d81f7[_0xaebd('0x2e')]=_0x493607['phone'];_0x1d81f7['text']=_0x537261['body'];_0x1d81f7[_0xaebd('0x5b')]=+new Date();var _0x54996e='';var _0x3c6f71='';var _0x27e705=Object[_0xaebd('0x5c')](_0x1d81f7);_0x27e705['sort']();for(var _0x3a26b4=0x0;_0x3a26b4<_0x27e705[_0xaebd('0x5d')];_0x3a26b4++){if(_0x54996e!=''){_0x54996e+='&';}_0x54996e+=_0x27e705[_0x3a26b4]+'='+encodeURIComponent(_0x1d81f7[_0x27e705[_0x3a26b4]]);_0x3c6f71+=_0x1d81f7[_0x27e705[_0x3a26b4]];}_0x3c6f71+=_0x493607['apiKey'];_0x3c6f71=_0xeac2ff['createHash']('md5')[_0xaebd('0x17')](_0x3c6f71)[_0xaebd('0x5e')](_0xaebd('0x5f'));if(_0x54996e!==''){_0x54996e+='&';}_0x54996e+='signature='+_0x3c6f71;var _0x2e29d6={'method':_0xaebd('0x30'),'uri':_0x493607[_0xaebd('0x53')]+_0xaebd('0x60')+_0x54996e,'json':!![]};return rp(_0x2e29d6)[_0xaebd('0x19')](function(_0x4cd2ab){var _0x1e416b=Object[_0xaebd('0x5c')](_0x4cd2ab);if(_0x4cd2ab[_0x1e416b[0x0]][_0xaebd('0x24')]&&parseInt(_0x4cd2ab[_0x1e416b[0x0]][_0xaebd('0x24')])===0x0){var _0x3f8d60={'messageId':_0x4cd2ab[_0x1e416b[0x0]]['id_sms']};if(!_0x493607[_0xaebd('0x36')]){_0x3f8d60[_0xaebd('0x37')]=!![];}return _0x21f52e[_0xaebd('0x17')](_0x3f8d60);}else{return logger[_0xaebd('0x24')](_0xaebd('0x25'),_0xaebd('0x26'),_0xaebd('0x58'),util[_0xaebd('0x28')](_0x4cd2ab['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x350b57){return logger['error'](_0xaebd('0x25'),_0xaebd('0x26'),_0xaebd('0x58'),util[_0xaebd('0x28')](_0x350b57,{'showHidden':![],'depth':null}));});}else{logger[_0xaebd('0x24')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xaebd('0x58'),'Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0x493607['apiKey']){var _0x10cac1={'method':'POST','uri':_0xaebd('0x61'),'headers':{'Authorization':_0x493607[_0xaebd('0x5a')]},'body':{'content':_0x537261[_0xaebd('0xd')],'to':[_0x537261[_0xaebd('0x1d')]],'from':_0x493607['phone'],'binary':![],'clientMessageId':_0xaebd('0x62'),'charset':_0xaebd('0x63')},'json':!![]};rp(_0x10cac1)[_0xaebd('0x19')](function(_0x380693){if(!_0x380693[_0xaebd('0x24')]){var _0x1195d3={'messageId':_0x380693['messages'][0x0][_0xaebd('0x64')]};if(!_0x493607[_0xaebd('0x36')]){_0x1195d3[_0xaebd('0x37')]=!![];}return _0x21f52e[_0xaebd('0x17')](_0x1195d3);}else{return logger[_0xaebd('0x24')](_0xaebd('0x25'),_0xaebd('0x26'),'clickatell',util[_0xaebd('0x28')](_0x380693[_0xaebd('0x24')],{'showHidden':![],'depth':null}));}})[_0xaebd('0x18')](function(_0x3e0bbe){return logger[_0xaebd('0x24')](_0xaebd('0x25'),'afterCreate','clickatell',util[_0xaebd('0x28')](_0x3e0bbe,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xaebd('0x25'),_0xaebd('0x26'),_0xaebd('0x65'),'Missing\x20parameters:\x20apiKey');}break;case _0xaebd('0x66'):if(_0x493607[_0xaebd('0x5a')]){var _0x16b1c5={};var _0x2e29d6={'method':_0xaebd('0x33'),'uri':_0xaebd('0x67'),'headers':{'Authorization':_0xaebd('0x68')+_0x493607[_0xaebd('0x5a')],'Content-Type':_0xaebd('0x55')},'body':{'from':_0x493607['phone'],'to':_0x537261['phone'],'text':_0x537261['body']},'json':!![]};return rp(_0x2e29d6)['then'](function(_0x5e7a91){if(_0x5e7a91[_0xaebd('0x69')]==0xca){_0x16b1c5[_0xaebd('0x6a')]=_0x5e7a91;var _0x2e56b7={'method':_0xaebd('0x33'),'uri':_0xaebd('0x6b'),'headers':{'Authorization':'Bearer\x20'+_0x493607[_0xaebd('0x5a')],'Content-Type':'application/json'},'body':{'refid':_0x16b1c5[_0xaebd('0x6a')][_0xaebd('0x6c')]},'json':!![]};return rp(_0x2e56b7)['then'](function(_0x50edec){_0x16b1c5['status']=_0x50edec;var _0x21364f={'messageId':_0x16b1c5[_0xaebd('0x6a')][_0xaebd('0x6c')],'read':!![]};return _0x21f52e[_0xaebd('0x17')](_0x21364f);});}else{return logger[_0xaebd('0x24')](_0xaebd('0x25'),_0xaebd('0x26'),_0xaebd('0x66'),util['inspect'](_0x5e7a91,{'showHidden':![],'depth':null}));}})[_0xaebd('0x18')](function(_0x2876dd){return logger[_0xaebd('0x24')](_0xaebd('0x25'),_0xaebd('0x26'),'intelepeer',util['inspect'](_0x2876dd,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xaebd('0x25'),'afterCreate',_0xaebd('0x66'),_0xaebd('0x6d'));}break;}}})[_0xaebd('0x6e')](function(){_0x19d2a9();});}else{_0x19d2a9();}}},'charset':'utf8mb4','collate':_0xaebd('0x6f')});}; \ No newline at end of file +var _0x65fc=['message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','sort','md5','id_sms','Missing\x20parameters:\x20apiKey','uuid','UTF-8','clickatell','intelepeer','message','Bearer\x20','refid','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','body','direction','toLowerCase','secret','UserId','findOne','update','createdAt','catch','out','SmsAccount','find','SmsAccountId','then','type','twilio','accountSid','authToken','phone','create','remote','/api/sms/messages/','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','password','GET','split','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/send/','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','messages','read','clickSend','authId','/status?token='];(function(_0x32917a,_0x3559ea){var _0x1881e1=function(_0x56730d){while(--_0x56730d){_0x32917a['push'](_0x32917a['shift']());}};_0x1881e1(++_0x3559ea);}(_0x65fc,0x1cb));var _0xc65f=function(_0x1a0905,_0x21abe6){_0x1a0905=_0x1a0905-0x0;var _0x38d6f0=_0x65fc[_0x1a0905];return _0x38d6f0;};'use strict';var _=require('lodash');var util=require(_0xc65f('0x0'));var logger=require(_0xc65f('0x1'))('api');var moment=require(_0xc65f('0x2'));var BPromise=require(_0xc65f('0x3'));var rp=require(_0xc65f('0x4'));var fs=require('fs');var path=require(_0xc65f('0x5'));var rimraf=require(_0xc65f('0x6'));var config=require(_0xc65f('0x7'));var attributes=require(_0xc65f('0x8'));module[_0xc65f('0x9')]=function(_0x5f5225,_0x254ab5){return _0x5f5225[_0xc65f('0xa')]('SmsMessage',attributes,{'tableName':_0xc65f('0xb'),'paranoid':![],'indexes':[{'name':_0xc65f('0xc'),'fields':[_0xc65f('0xc')]},{'name':'fti_sms_messages','fields':[_0xc65f('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x6ca745,_0x58c38d,_0x42299f){var _0x319179=_0x5f5225['models'];var _0x271733=_0x6ca745['get']({'plain':!![]});if(_0x271733[_0xc65f('0xe')]['toLowerCase']()==='in'||_0x271733[_0xc65f('0xe')][_0xc65f('0xf')]()==='out'&&!_0x271733[_0xc65f('0x10')]&&!_['isNil'](_0x271733[_0xc65f('0x11')])){_0x319179['SmsInteraction'][_0xc65f('0x12')]({'where':{'id':_0x271733['SmsInteractionId']}})['then'](function(_0x4d997e){if(_0x4d997e){_0x4d997e[_0xc65f('0x13')]({'lastMsgAt':_0x271733[_0xc65f('0x14')],'lastMsgDirection':_0x271733['direction']['toLowerCase']()});}})[_0xc65f('0x15')](function(_0x439981){console['error'](_0x439981);});}if(_0x271733[_0xc65f('0xe')]===_0xc65f('0x16')&&!_0x271733[_0xc65f('0x10')]){var _0xf9176f;_0x319179[_0xc65f('0x17')][_0xc65f('0x18')]({'where':{'id':_0x271733[_0xc65f('0x19')]},'raw':!![]})[_0xc65f('0x1a')](function(_0x302fbb){_0xf9176f=_0x302fbb;if(_0xf9176f&&_0xf9176f['type']){switch(_0xf9176f[_0xc65f('0x1b')]){case _0xc65f('0x1c'):var _0x168a01=require(_0xc65f('0x1c'));if(_0xf9176f[_0xc65f('0x1d')]&&_0xf9176f[_0xc65f('0x1e')]&&_0xf9176f[_0xc65f('0x1f')]){var _0x3bf745=new _0x168a01(_0xf9176f[_0xc65f('0x1d')],_0xf9176f['authToken']);_0x3bf745['messages'][_0xc65f('0x20')]({'body':_0x271733[_0xc65f('0xd')],'to':_0x271733['phone'],'from':_0xf9176f[_0xc65f('0x1f')],'statusCallback':_0xf9176f[_0xc65f('0x21')]+_0xc65f('0x22')+_0x271733['id']+'/status?token='+_0xf9176f[_0xc65f('0x23')]})[_0xc65f('0x1a')](function(_0xbdd33a){if(_0xbdd33a['sid']){return _0x6ca745['update']({'messageId':_0xbdd33a[_0xc65f('0x24')]});}})[_0xc65f('0x15')](function(_0x595919){logger[_0xc65f('0x25')](_0xc65f('0x26'),_0xc65f('0x27'),_0xc65f('0x1c'),util['inspect'](_0x595919,{'showHidden':![],'depth':null}));});}else{logger[_0xc65f('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc65f('0x27'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xc65f('0x28'):var _0x5455b7=_0xc65f('0x29');if(_0xf9176f[_0xc65f('0x2a')]&&_0xf9176f['password']){var _0x40328f={'recipient':[_0x271733[_0xc65f('0x1f')]],'message':_0x271733[_0xc65f('0xd')],'message_type':_0xf9176f[_0xc65f('0x2b')]};if(_0xf9176f[_0xc65f('0x2b')]&&_0xf9176f[_0xc65f('0x2b')]!=='SI'){_0x40328f[_0xc65f('0x2c')]=_0xf9176f['phone'];}var _0x50682e={'url':_0x5455b7+_0xc65f('0x2d')+_0xf9176f['username']+_0xc65f('0x2e')+_0xf9176f[_0xc65f('0x2f')],'method':_0xc65f('0x30')};rp(_0x50682e)[_0xc65f('0x1a')](function(_0x4cc279){var _0x1d662a=_0x4cc279[_0xc65f('0x31')](';');var _0x204a15={'user_key':_0x1d662a[0x0],'session_key':_0x1d662a[0x1]};_0x50682e={'url':_0x5455b7+'sms','method':_0xc65f('0x32'),'headers':{'user_key':_0x204a15[_0xc65f('0x33')],'Session_key':_0x204a15[_0xc65f('0x34')]},'json':!![],'body':_0x40328f};return rp(_0x50682e);})[_0xc65f('0x1a')](function(_0x392254){if(_0x392254[_0xc65f('0x35')]>=0x1){var _0x95199b={'messageId':_0x392254[_0xc65f('0x36')]};if(_0xf9176f['smsMethod']!=='GP'||!_0xf9176f[_0xc65f('0x37')]){_0x95199b['read']=!![];}return _0x6ca745[_0xc65f('0x13')](_0x95199b);}else{return logger[_0xc65f('0x25')](_0xc65f('0x26'),_0xc65f('0x27'),'skebby',util['inspect'](_0x392254,{'showHidden':![],'depth':null}));}})[_0xc65f('0x15')](function(_0x404cd4){return logger['error'](_0xc65f('0x26'),_0xc65f('0x27'),_0xc65f('0x28'),util[_0xc65f('0x38')](_0x404cd4,{'showHidden':![],'depth':null}));});}else{logger[_0xc65f('0x25')](_0xc65f('0x26'),'afterCreate',_0xc65f('0x28'),_0xc65f('0x39'));}break;case _0xc65f('0x3a'):if(_0xf9176f[_0xc65f('0x1e')]){var _0x1280b6={'recipient':_0x271733['phone'],'message':_0x271733['body'],'sender':_0xf9176f[_0xc65f('0x3b')]||_0xf9176f[_0xc65f('0x1f')],'authorization':_0xf9176f[_0xc65f('0x1e')]};var _0x58c38d={'method':_0xc65f('0x32'),'uri':_0xc65f('0x3c'),'body':_0x1280b6,'json':!![]};rp(_0x58c38d)[_0xc65f('0x1a')](function(_0x26da32){var _0xf5c072={'messageId':_0x26da32['requestid']};if(!_0xf9176f[_0xc65f('0x37')]){_0xf5c072['read']=!![];}return _0x6ca745[_0xc65f('0x13')](_0xf5c072);})['catch'](function(_0x2cb14b){logger[_0xc65f('0x25')](_0xc65f('0x26'),_0xc65f('0x27'),_0xc65f('0x3a'),util[_0xc65f('0x38')](_0x2cb14b,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xc65f('0x3a'),'Missing\x20parameters:\x20authToken');}break;case _0xc65f('0x3d'):if(_0xf9176f[_0xc65f('0x2a')]&&_0xf9176f[_0xc65f('0x2f')]){var _0x1280b6={'messages':[{'source':'xCALLY\x20Motion','to':_0x271733[_0xc65f('0x1f')],'body':_0x271733[_0xc65f('0xd')],'from':_0xf9176f[_0xc65f('0x3b')]||_0xf9176f[_0xc65f('0x1f')]}]};var _0x39f4c5=util[_0xc65f('0x3e')](_0xc65f('0x3f'),_0xf9176f['username'],_0xf9176f[_0xc65f('0x2f')]);var _0x58c38d={'method':_0xc65f('0x32'),'uri':_0xc65f('0x40'),'body':_0x1280b6,'headers':{'Authorization':util['format'](_0xc65f('0x41'),new Buffer(_0x39f4c5)[_0xc65f('0x42')]('base64'))},'json':!![]};rp(_0x58c38d)['then'](function(_0x3c2fcc){if(_0x3c2fcc[_0xc65f('0x43')]>=0xc8&&_0x3c2fcc[_0xc65f('0x43')]<=0xce){if(_0x3c2fcc[_0xc65f('0x44')]&&_0x3c2fcc['data'][_0xc65f('0x45')]>0x0){var _0x200b30=_[_0xc65f('0x46')](_0x3c2fcc[_0xc65f('0x44')][_0xc65f('0x47')]);var _0x5b3b3e={'messageId':_0x200b30['message_id']};if(!_0xf9176f[_0xc65f('0x37')]){_0x5b3b3e[_0xc65f('0x48')]=!![];}return _0x6ca745[_0xc65f('0x13')](_0x5b3b3e);}else{logger[_0xc65f('0x25')](_0xc65f('0x26'),_0xc65f('0x27'),'clickSend',util['inspect'](_0x3c2fcc,{'showHidden':![],'depth':null}));}}else{logger[_0xc65f('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xc65f('0x49'),util[_0xc65f('0x38')](_0x3c2fcc,{'showHidden':![],'depth':null}));}})[_0xc65f('0x15')](function(_0x313b39){logger[_0xc65f('0x25')](_0xc65f('0x26'),'afterCreate',_0xc65f('0x49'),util[_0xc65f('0x38')](_0x313b39,{'showHidden':![],'depth':null}));});}else{logger[_0xc65f('0x25')](_0xc65f('0x26'),'afterCreate',_0xc65f('0x49'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0xf9176f[_0xc65f('0x4a')]&&_0xf9176f[_0xc65f('0x1e')]){var _0x1280b6={'dst':_0x271733[_0xc65f('0x1f')],'text':_0x271733[_0xc65f('0xd')],'src':_0xf9176f[_0xc65f('0x3b')]||_0xf9176f['phone'],'url':_0xf9176f['remote']+'/api/sms/messages/'+_0x271733['id']+_0xc65f('0x4b')+_0xf9176f[_0xc65f('0x23')]};var _0x39f4c5=util[_0xc65f('0x3e')](_0xc65f('0x3f'),_0xf9176f[_0xc65f('0x4a')],_0xf9176f[_0xc65f('0x1e')]);var _0x58c38d={'method':_0xc65f('0x32'),'uri':util['format']('https://api.plivo.com/v1/Account/%s/Message/',_0xf9176f[_0xc65f('0x4a')]),'body':_0x1280b6,'headers':{'Authorization':util[_0xc65f('0x3e')](_0xc65f('0x41'),new Buffer(_0x39f4c5)[_0xc65f('0x42')]('base64'))},'json':!![]};rp(_0x58c38d)['then'](function(_0x31e26f){var _0x527750={'messageId':_0x31e26f[_0xc65f('0x4c')][0x0]};return _0x6ca745[_0xc65f('0x13')](_0x527750);})[_0xc65f('0x15')](function(_0xb60b8d){logger[_0xc65f('0x25')](_0xc65f('0x26'),_0xc65f('0x27'),_0xc65f('0x4d'),util[_0xc65f('0x38')](_0xb60b8d,{'showHidden':![],'depth':null}));});}else{logger[_0xc65f('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','plivo',_0xc65f('0x4e'));}break;case'infobip':if(_0xf9176f[_0xc65f('0x2a')]&&_0xf9176f[_0xc65f('0x2f')]){if(_0xf9176f[_0xc65f('0x4f')]){var _0x4cd3c0={'method':_0xc65f('0x32'),'uri':_0xf9176f['baseUrl']+_0xc65f('0x50'),'body':{'username':_0xf9176f['username'],'password':_0xf9176f[_0xc65f('0x2f')]},'json':!![]};return rp(_0x4cd3c0)[_0xc65f('0x1a')](function(_0x13e548){var _0x8282d5={'method':_0xc65f('0x32'),'uri':_0xf9176f[_0xc65f('0x4f')]+_0xc65f('0x51'),'body':{'messages':[{'from':_0xf9176f[_0xc65f('0x1f')],'destinations':[{'to':_0x271733[_0xc65f('0x1f')]}],'text':_0x271733[_0xc65f('0xd')],'notifyUrl':_0xf9176f['remote']+_0xc65f('0x22')+_0x271733['id']+_0xc65f('0x4b')+_0xf9176f[_0xc65f('0x23')],'notifyContentType':_0xc65f('0x52'),'callbackData':_0xf9176f[_0xc65f('0x1f')]+';'+_0x271733[_0xc65f('0xd')]}]},'headers':{'Authorization':_0xc65f('0x53')+_0x13e548[_0xc65f('0x23')]},'json':!![]};return rp(_0x8282d5)['then'](function(_0x3f020f){if(_0x3f020f['messages']){var _0x24d6db={'messageId':_0x3f020f[_0xc65f('0x47')][0x0]['messageId']};if(!_0xf9176f[_0xc65f('0x37')]){_0x24d6db['read']=!![];}return _0x6ca745['update'](_0x24d6db);}else{return logger[_0xc65f('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xc65f('0x54'),util['inspect'](_0x3f020f,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x55e700){return logger['error'](_0xc65f('0x26'),_0xc65f('0x27'),'infobip',util[_0xc65f('0x38')](_0x55e700,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc65f('0x27'),_0xc65f('0x54'),_0xc65f('0x55'));}}else{logger[_0xc65f('0x25')](_0xc65f('0x26'),_0xc65f('0x27'),_0xc65f('0x54'),_0xc65f('0x39'));}break;case _0xc65f('0x56'):var _0x1570c4=require(_0xc65f('0x57'));if(_0xf9176f[_0xc65f('0x58')]){var _0x4cc952={};_0x4cc952[_0xc65f('0x59')]=_0xf9176f[_0xc65f('0x2a')];_0x4cc952[_0xc65f('0x1f')]=_0x271733['phone'];_0x4cc952[_0xc65f('0x2c')]=_0xf9176f[_0xc65f('0x1f')];_0x4cc952[_0xc65f('0x5a')]=_0x271733[_0xc65f('0xd')];_0x4cc952[_0xc65f('0x5b')]=+new Date();var _0x4006ed='';var _0x2157e4='';var _0x18ff3f=Object[_0xc65f('0x5c')](_0x4cc952);_0x18ff3f[_0xc65f('0x5d')]();for(var _0x5df5f8=0x0;_0x5df5f8<_0x18ff3f['length'];_0x5df5f8++){if(_0x4006ed!=''){_0x4006ed+='&';}_0x4006ed+=_0x18ff3f[_0x5df5f8]+'='+encodeURIComponent(_0x4cc952[_0x18ff3f[_0x5df5f8]]);_0x2157e4+=_0x4cc952[_0x18ff3f[_0x5df5f8]];}_0x2157e4+=_0xf9176f[_0xc65f('0x58')];_0x2157e4=_0x1570c4['createHash'](_0xc65f('0x5e'))[_0xc65f('0x13')](_0x2157e4)['digest']('hex');if(_0x4006ed!==''){_0x4006ed+='&';}_0x4006ed+='signature='+_0x2157e4;var _0x50682e={'method':_0xc65f('0x30'),'uri':_0xf9176f[_0xc65f('0x4f')]+'/external/get/send.php?'+_0x4006ed,'json':!![]};return rp(_0x50682e)[_0xc65f('0x1a')](function(_0x3a5406){var _0x1d0f3b=Object[_0xc65f('0x5c')](_0x3a5406);if(_0x3a5406[_0x1d0f3b[0x0]][_0xc65f('0x25')]&&parseInt(_0x3a5406[_0x1d0f3b[0x0]][_0xc65f('0x25')])===0x0){var _0x5c4332={'messageId':_0x3a5406[_0x1d0f3b[0x0]][_0xc65f('0x5f')]};if(!_0xf9176f['deliveryReport']){_0x5c4332['read']=!![];}return _0x6ca745[_0xc65f('0x13')](_0x5c4332);}else{return logger[_0xc65f('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc65f('0x27'),_0xc65f('0x56'),util[_0xc65f('0x38')](_0x3a5406[_0xc65f('0x25')],{'showHidden':![],'depth':null}));}})[_0xc65f('0x15')](function(_0x6bc6d3){return logger[_0xc65f('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc65f('0x27'),_0xc65f('0x56'),util[_0xc65f('0x38')](_0x6bc6d3,{'showHidden':![],'depth':null}));});}else{logger[_0xc65f('0x25')](_0xc65f('0x26'),_0xc65f('0x27'),_0xc65f('0x56'),_0xc65f('0x60'));}break;case'clickatell':if(_0xf9176f[_0xc65f('0x58')]){var _0x5671ce={'method':_0xc65f('0x32'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0xf9176f[_0xc65f('0x58')]},'body':{'content':_0x271733[_0xc65f('0xd')],'to':[_0x271733[_0xc65f('0x1f')]],'from':_0xf9176f[_0xc65f('0x1f')],'binary':![],'clientMessageId':_0xc65f('0x61'),'charset':_0xc65f('0x62')},'json':!![]};rp(_0x5671ce)[_0xc65f('0x1a')](function(_0x4a2989){if(!_0x4a2989[_0xc65f('0x25')]){var _0x207f45={'messageId':_0x4a2989[_0xc65f('0x47')][0x0]['apiMessageId']};if(!_0xf9176f[_0xc65f('0x37')]){_0x207f45[_0xc65f('0x48')]=!![];}return _0x6ca745[_0xc65f('0x13')](_0x207f45);}else{return logger['error'](_0xc65f('0x26'),_0xc65f('0x27'),_0xc65f('0x63'),util[_0xc65f('0x38')](_0x4a2989['error'],{'showHidden':![],'depth':null}));}})[_0xc65f('0x15')](function(_0x40cb84){return logger['error'](_0xc65f('0x26'),_0xc65f('0x27'),_0xc65f('0x63'),util[_0xc65f('0x38')](_0x40cb84,{'showHidden':![],'depth':null}));});}else{logger[_0xc65f('0x25')](_0xc65f('0x26'),_0xc65f('0x27'),_0xc65f('0x63'),_0xc65f('0x60'));}break;case _0xc65f('0x64'):if(_0xf9176f[_0xc65f('0x58')]){var _0x5dea78={};var _0x50682e={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0xf9176f[_0xc65f('0x58')],'Content-Type':_0xc65f('0x52')},'body':{'from':_0xf9176f[_0xc65f('0x1f')],'to':_0x271733[_0xc65f('0x1f')],'text':_0x271733[_0xc65f('0xd')]},'json':!![]};return rp(_0x50682e)[_0xc65f('0x1a')](function(_0x3650cd){if(_0x3650cd['code']==0xca){_0x5dea78[_0xc65f('0x65')]=_0x3650cd;var _0x482063={'method':_0xc65f('0x32'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xc65f('0x66')+_0xf9176f[_0xc65f('0x58')],'Content-Type':_0xc65f('0x52')},'body':{'refid':_0x5dea78[_0xc65f('0x65')]['refid']},'json':!![]};return rp(_0x482063)['then'](function(_0x4d2b6a){_0x5dea78['status']=_0x4d2b6a;var _0x1b42e8={'messageId':_0x5dea78['message'][_0xc65f('0x67')],'read':!![]};return _0x6ca745['update'](_0x1b42e8);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc65f('0x27'),_0xc65f('0x64'),util[_0xc65f('0x38')](_0x3650cd,{'showHidden':![],'depth':null}));}})['catch'](function(_0x262d8d){return logger[_0xc65f('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc65f('0x27'),'intelepeer',util[_0xc65f('0x38')](_0x262d8d,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xc65f('0x26'),'afterCreate',_0xc65f('0x64'),_0xc65f('0x68'));}break;}}})['finally'](function(){_0x42299f();});}else{_0x42299f();}}},'charset':_0xc65f('0x69'),'collate':_0xc65f('0x6a')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index c0cc83f..76392d6 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 _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(_0x3ea40d,_0x1e2b89){var _0x2839dd=function(_0x2efd27){while(--_0x2efd27){_0x3ea40d['push'](_0x3ea40d['shift']());}};_0x2839dd(++_0x1e2b89);}(_0x5eb8,0xb0));var _0x85eb=function(_0xe1269d,_0x57b7c3){_0xe1269d=_0xe1269d-0x0;var _0x261ca1=_0x5eb8[_0xe1269d];return _0x261ca1;};'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 +var _0x1a85=['info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','options','raw','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','socket.io-emitter','register','request','then'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x1a85,0x178));var _0x51a8=function(_0x2565d5,_0xe6c944){_0x2565d5=_0x2565d5-0x0;var _0x1b546c=_0x1a85[_0x2565d5];return _0x1b546c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});config['redis']=_[_0x51a8('0x8')](config[_0x51a8('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x51a8('0xa'))(new Redis(config['redis']));require('./smsMessage.socket')[_0x51a8('0xb')](socket);function respondWithRpcPromise(_0x2f276b,_0x1a476d,_0x45a3f4){return new BPromise(function(_0x418f06,_0x421fa4){return client[_0x51a8('0xc')](_0x2f276b,_0x45a3f4)[_0x51a8('0xd')](function(_0x34c887){logger[_0x51a8('0xe')](_0x51a8('0xf'),_0x1a476d,_0x51a8('0x10'));logger[_0x51a8('0x11')](_0x51a8('0x12'),_0x1a476d,_0x51a8('0x10'),JSON[_0x51a8('0x13')](_0x34c887));if(_0x34c887[_0x51a8('0x14')]){if(_0x34c887['error'][_0x51a8('0x15')]===0x1f4){logger[_0x51a8('0x14')](_0x51a8('0xf'),_0x1a476d,_0x34c887['error'][_0x51a8('0x16')]);return _0x421fa4(_0x34c887['error'][_0x51a8('0x16')]);}logger[_0x51a8('0x14')](_0x51a8('0xf'),_0x1a476d,_0x34c887[_0x51a8('0x14')][_0x51a8('0x16')]);return _0x418f06(_0x34c887[_0x51a8('0x14')][_0x51a8('0x16')]);}else{logger['info'](_0x51a8('0xf'),_0x1a476d,_0x51a8('0x10'));_0x418f06(_0x34c887[_0x51a8('0x17')][_0x51a8('0x16')]);}})[_0x51a8('0x18')](function(_0x544886){logger['error'](_0x51a8('0xf'),_0x1a476d,_0x544886);_0x421fa4(_0x544886);});});}exports[_0x51a8('0x19')]=function(_0x2217ce){var _0x2f2681=this;return new Promise(function(_0x2a4c4c,_0x3bc044){return db[_0x51a8('0x1a')][_0x51a8('0x1b')](_0x2217ce['body'],{'raw':_0x2217ce[_0x51a8('0x1c')]?_0x2217ce['options'][_0x51a8('0x1d')]===undefined?!![]:![]:!![]})[_0x51a8('0xd')](function(_0x8bda40){logger[_0x51a8('0xe')]('CreateSmsMessage',_0x2217ce);logger[_0x51a8('0x11')]('CreateSmsMessage',_0x2217ce,JSON['stringify'](_0x8bda40));_0x2a4c4c(_0x8bda40);})[_0x51a8('0x18')](function(_0x52e503){logger[_0x51a8('0x14')](_0x51a8('0x19'),_0x52e503[_0x51a8('0x16')],_0x2217ce);_0x3bc044(_0x2f2681[_0x51a8('0x14')](0x1f4,_0x52e503[_0x51a8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 9b6ea74..4c705b0 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 _0x90d1=['emit','removeListener','length','smsMessage:','./smsMessage.events','save','remove','update'];(function(_0x11458e,_0x27088b){var _0x48be5e=function(_0x575ea1){while(--_0x575ea1){_0x11458e['push'](_0x11458e['shift']());}};_0x48be5e(++_0x27088b);}(_0x90d1,0x18c));var _0x190d=function(_0x263e17,_0x244755){_0x263e17=_0x263e17-0x0;var _0x3c1b7f=_0x90d1[_0x263e17];return _0x3c1b7f;};'use strict';var SmsMessageEvents=require(_0x190d('0x0'));var events=[_0x190d('0x1'),_0x190d('0x2'),_0x190d('0x3')];function createListener(_0x3fd9af,_0x1dba24){return function(_0x3224d5){_0x1dba24[_0x190d('0x4')](_0x3fd9af,_0x3224d5);};}function removeListener(_0x23ac27,_0x14c400){return function(){SmsMessageEvents[_0x190d('0x5')](_0x23ac27,_0x14c400);};}exports['register']=function(_0x3c62b5){for(var _0x4630d5=0x0,_0x3744c4=events[_0x190d('0x6')];_0x4630d5<_0x3744c4;_0x4630d5++){var _0x8a913a=events[_0x4630d5];var _0x1d7f4c=createListener(_0x190d('0x7')+_0x8a913a,_0x3c62b5);SmsMessageEvents['on'](_0x8a913a,_0x1d7f4c);}}; \ No newline at end of file +var _0x870d=['./smsMessage.events','save','remove','update','emit','removeListener','register','length','smsMessage:'];(function(_0x2d1371,_0x43aef7){var _0xf17680=function(_0x31ae99){while(--_0x31ae99){_0x2d1371['push'](_0x2d1371['shift']());}};_0xf17680(++_0x43aef7);}(_0x870d,0xe1));var _0xd870=function(_0x3d6eb2,_0x45da1f){_0x3d6eb2=_0x3d6eb2-0x0;var _0x3c0661=_0x870d[_0x3d6eb2];return _0x3c0661;};'use strict';var SmsMessageEvents=require(_0xd870('0x0'));var events=[_0xd870('0x1'),_0xd870('0x2'),_0xd870('0x3')];function createListener(_0x33537f,_0x25242d){return function(_0x450eba){_0x25242d[_0xd870('0x4')](_0x33537f,_0x450eba);};}function removeListener(_0xfea4f7,_0x3c4eee){return function(){SmsMessageEvents[_0xd870('0x5')](_0xfea4f7,_0x3c4eee);};}exports[_0xd870('0x6')]=function(_0x165201){for(var _0x2a0b7e=0x0,_0x471f03=events[_0xd870('0x7')];_0x2a0b7e<_0x471f03;_0x2a0b7e++){var _0x16fd01=events[_0x2a0b7e];var _0x187ec6=createListener(_0xd870('0x8')+_0x16fd01,_0x165201);SmsMessageEvents['on'](_0x16fd01,_0x187ec6);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index a61bb73..0179746 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 _0x8375=['getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','delete','destroy','removeAgents','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get','/describe','/:id'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x8375,0xa8));var _0x5837=function(_0x2cb44f,_0x23a9f5){_0x2cb44f=_0x2cb44f-0x0;var _0x54f088=_0x8375[_0x2cb44f];return _0x54f088;};'use strict';var multer=require(_0x5837('0x0'));var util=require(_0x5837('0x1'));var path=require(_0x5837('0x2'));var timeout=require('connect-timeout');var express=require(_0x5837('0x3'));var router=express[_0x5837('0x4')]();var auth=require(_0x5837('0x5'));var interaction=require(_0x5837('0x6'));var config=require(_0x5837('0x7'));var controller=require(_0x5837('0x8'));router['get']('/',auth[_0x5837('0x9')](),controller[_0x5837('0xa')]);router[_0x5837('0xb')](_0x5837('0xc'),auth[_0x5837('0x9')](),controller['describe']);router['get'](_0x5837('0xd'),auth[_0x5837('0x9')](),controller['show']);router[_0x5837('0xb')]('/:id/members',auth[_0x5837('0x9')](),controller[_0x5837('0xe')]);router[_0x5837('0xb')](_0x5837('0xf'),auth[_0x5837('0x9')](),controller[_0x5837('0x10')]);router['get'](_0x5837('0x11'),auth[_0x5837('0x9')](),controller[_0x5837('0x12')]);router[_0x5837('0x13')]('/',auth[_0x5837('0x9')](),controller['create']);router['post']('/:id/teams',auth[_0x5837('0x9')](),controller[_0x5837('0x14')]);router[_0x5837('0x13')](_0x5837('0x11'),auth[_0x5837('0x9')](),controller[_0x5837('0x15')]);router[_0x5837('0x16')](_0x5837('0xd'),auth[_0x5837('0x9')](),controller['update']);router[_0x5837('0x17')](_0x5837('0xd'),auth['isAuthenticated'](),controller[_0x5837('0x18')]);router[_0x5837('0x17')](_0x5837('0xf'),auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0x5837('0x11'),auth[_0x5837('0x9')](),controller[_0x5837('0x19')]);module['exports']=router; \ No newline at end of file +var _0xfdcd=['getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','/:id','update','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members'];(function(_0x1df803,_0x25192d){var _0x20ef12=function(_0xfc0101){while(--_0xfc0101){_0x1df803['push'](_0x1df803['shift']());}};_0x20ef12(++_0x25192d);}(_0xfdcd,0xe9));var _0xdfdc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfdcd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xdfdc('0x0'));var path=require(_0xdfdc('0x1'));var timeout=require(_0xdfdc('0x2'));var express=require('express');var router=express[_0xdfdc('0x3')]();var auth=require(_0xdfdc('0x4'));var interaction=require(_0xdfdc('0x5'));var config=require(_0xdfdc('0x6'));var controller=require(_0xdfdc('0x7'));router[_0xdfdc('0x8')]('/',auth[_0xdfdc('0x9')](),controller[_0xdfdc('0xa')]);router[_0xdfdc('0x8')](_0xdfdc('0xb'),auth[_0xdfdc('0x9')](),controller[_0xdfdc('0xc')]);router[_0xdfdc('0x8')]('/:id',auth[_0xdfdc('0x9')](),controller[_0xdfdc('0xd')]);router['get'](_0xdfdc('0xe'),auth[_0xdfdc('0x9')](),controller[_0xdfdc('0xf')]);router[_0xdfdc('0x8')](_0xdfdc('0x10'),auth['isAuthenticated'](),controller[_0xdfdc('0x11')]);router['get']('/:id/users',auth[_0xdfdc('0x9')](),controller[_0xdfdc('0x12')]);router[_0xdfdc('0x13')]('/',auth[_0xdfdc('0x9')](),controller[_0xdfdc('0x14')]);router[_0xdfdc('0x13')](_0xdfdc('0x10'),auth['isAuthenticated'](),controller[_0xdfdc('0x15')]);router[_0xdfdc('0x13')](_0xdfdc('0x16'),auth['isAuthenticated'](),controller[_0xdfdc('0x17')]);router[_0xdfdc('0x18')](_0xdfdc('0x19'),auth['isAuthenticated'](),controller[_0xdfdc('0x1a')]);router['delete'](_0xdfdc('0x19'),auth[_0xdfdc('0x9')](),controller['destroy']);router[_0xdfdc('0x1b')]('/:id/teams',auth[_0xdfdc('0x9')](),controller[_0xdfdc('0x1c')]);router[_0xdfdc('0x1b')](_0xdfdc('0x16'),auth['isAuthenticated'](),controller[_0xdfdc('0x1d')]);module[_0xdfdc('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 4f96822..4f516b3 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 _0x1540=['STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports'];(function(_0x3d5064,_0x543444){var _0x49a127=function(_0x545094){while(--_0x545094){_0x3d5064['push'](_0x3d5064['shift']());}};_0x49a127(++_0x543444);}(_0x1540,0x18d));var _0x0154=function(_0x442398,_0x486809){_0x442398=_0x442398-0x0;var _0xaf58dd=_0x1540[_0x442398];return _0xaf58dd;};'use strict';var Sequelize=require(_0x0154('0x0'));module[_0x0154('0x1')]={'name':{'type':Sequelize[_0x0154('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0154('0x2')]},'timeout':{'type':Sequelize[_0x0154('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0154('0x4')](_0x0154('0x5'),'beepall',_0x0154('0x6'))}}; \ No newline at end of file +var _0x8add=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x4bdb89,_0x160e4b){var _0x392e17=function(_0x1fcdd1){while(--_0x1fcdd1){_0x4bdb89['push'](_0x4bdb89['shift']());}};_0x392e17(++_0x160e4b);}(_0x8add,0x13a));var _0xd8ad=function(_0x4e84e6,_0xb796d0){_0x4e84e6=_0x4e84e6-0x0;var _0x339388=_0x8add[_0x4e84e6];return _0x339388;};'use strict';var Sequelize=require(_0xd8ad('0x0'));module[_0xd8ad('0x1')]={'name':{'type':Sequelize[_0xd8ad('0x2')],'unique':_0xd8ad('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd8ad('0x2')]},'timeout':{'type':Sequelize[_0xd8ad('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd8ad('0x5')](_0xd8ad('0x6'),_0xd8ad('0x7'),_0xd8ad('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index ce983aa..ac51f9d 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 _0x3c0f=['end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','SmsQueues','UserProfileResource','error','name','send','index','map','SmsQueue','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','User','agent','createdAt','format','%s/%s','SIP','smsPause','getTeams','Team','pick','addTeams','body','ids','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','userSmsQueue:save','removeTeams','field','from','team_has_sms_queues','user_has_teams','SmsQueueId\x20=\x20?','Agents','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status'];(function(_0x44b3bd,_0x44c97d){var _0x1efc4a=function(_0x5d0205){while(--_0x5d0205){_0x44b3bd['push'](_0x44b3bd['shift']());}};_0x1efc4a(++_0x44c97d);}(_0x3c0f,0x69));var _0xf3c0=function(_0x7feb90,_0x28e700){_0x7feb90=_0x7feb90-0x0;var _0x3c5b33=_0x3c0f[_0x7feb90];return _0x3c5b33;};'use strict';var pdf=require(_0xf3c0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf3c0('0x1'));var zipdir=require(_0xf3c0('0x2'));var jsonpatch=require(_0xf3c0('0x3'));var rp=require(_0xf3c0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf3c0('0x5'));var util=require(_0xf3c0('0x6'));var path=require(_0xf3c0('0x7'));var sox=require('sox');var csv=require(_0xf3c0('0x8'));var ejs=require(_0xf3c0('0x9'));var fs=require('fs');var _=require(_0xf3c0('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf3c0('0xb'));var deskjs=require(_0xf3c0('0xc'));var toCsv=require(_0xf3c0('0x8'));var querystring=require(_0xf3c0('0xd'));var Papa=require('papaparse');var Redis=require(_0xf3c0('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf3c0('0xf'));var as=require(_0xf3c0('0x10'));var hardwareService=require(_0xf3c0('0x11'));var logger=require(_0xf3c0('0x12'))(_0xf3c0('0x13'));var utils=require(_0xf3c0('0x14'));var config=require(_0xf3c0('0x15'));var db=require('../../mysqldb')['db'];config[_0xf3c0('0x16')]=_[_0xf3c0('0x17')](config[_0xf3c0('0x16')],{'host':_0xf3c0('0x18'),'port':0x18eb});var socket=require(_0xf3c0('0x19'))(new Redis(config[_0xf3c0('0x16')]));require('./smsQueue.socket')[_0xf3c0('0x1a')](socket);function respondWithStatusCode(_0x433f88,_0x3a2036){_0x3a2036=_0x3a2036||0xcc;return function(_0x4f701e){if(_0x4f701e){return _0x433f88[_0xf3c0('0x1b')](_0x3a2036);}return _0x433f88[_0xf3c0('0x1c')](_0x3a2036)[_0xf3c0('0x1d')]();};}function respondWithResult(_0x5d1aaf,_0x3d880c){_0x3d880c=_0x3d880c||0xc8;return function(_0xbf3d97){if(_0xbf3d97){return _0x5d1aaf[_0xf3c0('0x1c')](_0x3d880c)[_0xf3c0('0x1e')](_0xbf3d97);}};}function respondWithFilteredResult(_0x37362e,_0x3ada87){return function(_0x40c7f2){if(_0x40c7f2){var _0x2f15ff=_0x40c7f2['count'],_0x142330=_0x3ada87[_0xf3c0('0x1f')],_0x5a21b0=_0x3ada87[_0xf3c0('0x1f')]+_0x3ada87[_0xf3c0('0x20')],_0x2f109e;if(_0x5a21b0>=_0x2f15ff){_0x5a21b0=_0x2f15ff;_0x2f109e=0xc8;}else{_0x2f109e=0xce;}_0x37362e['status'](_0x2f109e);return _0x37362e[_0xf3c0('0x21')](_0xf3c0('0x22'),_0x142330+'-'+_0x5a21b0+'/'+_0x2f15ff)[_0xf3c0('0x1e')](_0x40c7f2);}return null;};}function patchUpdates(_0x2277ab){return function(_0x5deddc){try{jsonpatch[_0xf3c0('0x23')](_0x5deddc,_0x2277ab,!![]);}catch(_0x533352){return BPromise['reject'](_0x533352);}return _0x5deddc[_0xf3c0('0x24')]();};}function saveUpdates(_0x49bafb,_0x1c969d){return function(_0x56be4e){if(_0x56be4e){return _0x56be4e[_0xf3c0('0x25')](_0x49bafb)[_0xf3c0('0x26')](function(_0x14b3a8){return _0x14b3a8;});}return null;};}function removeEntity(_0x529f99,_0x53e1f9){return function(_0x3d858b){if(_0x3d858b){return _0x3d858b[_0xf3c0('0x27')]()[_0xf3c0('0x26')](function(){var _0x33045d=_0x3d858b[_0xf3c0('0x28')]({'plain':!![]});var _0x5b95ba=_0xf3c0('0x29');return db[_0xf3c0('0x2a')][_0xf3c0('0x27')]({'where':{'type':_0x5b95ba,'resourceId':_0x33045d['id']}})['then'](function(){return _0x3d858b;});})['then'](function(){_0x529f99[_0xf3c0('0x1c')](0xcc)[_0xf3c0('0x1d')]();});}};}function handleEntityNotFound(_0x1b5661,_0x30aca7){return function(_0x379ca5){if(!_0x379ca5){_0x1b5661[_0xf3c0('0x1b')](0x194);}return _0x379ca5;};}function handleError(_0x106b70,_0x18bf97){_0x18bf97=_0x18bf97||0x1f4;return function(_0x2c262a){logger[_0xf3c0('0x2b')](_0x2c262a['stack']);if(_0x2c262a[_0xf3c0('0x2c')]){delete _0x2c262a[_0xf3c0('0x2c')];}_0x106b70[_0xf3c0('0x1c')](_0x18bf97)[_0xf3c0('0x2d')](_0x2c262a);};}exports[_0xf3c0('0x2e')]=function(_0x3f1386,_0x326827){var _0x394b4f={},_0x430a3c={},_0x438cf6={'count':0x0,'rows':[]};var _0xfe9079=_[_0xf3c0('0x2f')](db[_0xf3c0('0x30')]['rawAttributes'],function(_0xe3f8b8){return{'name':_0xe3f8b8[_0xf3c0('0x31')],'type':_0xe3f8b8[_0xf3c0('0x32')][_0xf3c0('0x33')]};});_0x430a3c[_0xf3c0('0x34')]=_[_0xf3c0('0x2f')](_0xfe9079,_0xf3c0('0x2c'));_0x430a3c[_0xf3c0('0x35')]=_['keys'](_0x3f1386[_0xf3c0('0x35')]);_0x430a3c[_0xf3c0('0x36')]=_[_0xf3c0('0x37')](_0x430a3c[_0xf3c0('0x34')],_0x430a3c[_0xf3c0('0x35')]);_0x394b4f[_0xf3c0('0x38')]=_[_0xf3c0('0x37')](_0x430a3c['model'],qs[_0xf3c0('0x39')](_0x3f1386[_0xf3c0('0x35')][_0xf3c0('0x39')]));_0x394b4f['attributes']=_0x394b4f[_0xf3c0('0x38')][_0xf3c0('0x3a')]?_0x394b4f['attributes']:_0x430a3c['model'];if(!_0x3f1386[_0xf3c0('0x35')][_0xf3c0('0x3b')](_0xf3c0('0x3c'))){_0x394b4f[_0xf3c0('0x20')]=qs['limit'](_0x3f1386[_0xf3c0('0x35')]['limit']);_0x394b4f[_0xf3c0('0x1f')]=qs[_0xf3c0('0x1f')](_0x3f1386['query'][_0xf3c0('0x1f')]);}_0x394b4f[_0xf3c0('0x3d')]=qs[_0xf3c0('0x3e')](_0x3f1386[_0xf3c0('0x35')][_0xf3c0('0x3e')]);_0x394b4f[_0xf3c0('0x3f')]=qs[_0xf3c0('0x36')](_['pick'](_0x3f1386[_0xf3c0('0x35')],_0x430a3c[_0xf3c0('0x36')]),_0xfe9079);if(_0x3f1386[_0xf3c0('0x35')][_0xf3c0('0x40')]){_0x394b4f[_0xf3c0('0x3f')]=_[_0xf3c0('0x41')](_0x394b4f[_0xf3c0('0x3f')],{'$or':_[_0xf3c0('0x2f')](_0xfe9079,function(_0x1d42e0){if(_0x1d42e0[_0xf3c0('0x32')]!=='VIRTUAL'){var _0x43b22d={};_0x43b22d[_0x1d42e0[_0xf3c0('0x2c')]]={'$like':'%'+_0x3f1386['query'][_0xf3c0('0x40')]+'%'};return _0x43b22d;}})});}_0x394b4f=_[_0xf3c0('0x41')]({},_0x394b4f,_0x3f1386[_0xf3c0('0x42')]);var _0x10d324={'where':_0x394b4f[_0xf3c0('0x3f')]};return db[_0xf3c0('0x30')][_0xf3c0('0x43')](_0x10d324)[_0xf3c0('0x26')](function(_0x265f7c){_0x438cf6[_0xf3c0('0x43')]=_0x265f7c;if(_0x3f1386['query'][_0xf3c0('0x44')]){_0x394b4f[_0xf3c0('0x45')]=[{'all':!![]}];}return db[_0xf3c0('0x30')]['findAll'](_0x394b4f);})[_0xf3c0('0x26')](function(_0x475c10){_0x438cf6[_0xf3c0('0x46')]=_0x475c10;return _0x438cf6;})[_0xf3c0('0x26')](respondWithFilteredResult(_0x326827,_0x394b4f))[_0xf3c0('0x47')](handleError(_0x326827,null));};exports[_0xf3c0('0x48')]=function(_0x2ce2f2,_0x1f63d9){var _0x215d3a={'raw':!![],'where':{'id':_0x2ce2f2[_0xf3c0('0x49')]['id']}},_0x2bf643={};_0x2bf643[_0xf3c0('0x34')]=_[_0xf3c0('0x4a')](db[_0xf3c0('0x30')][_0xf3c0('0x4b')]);_0x2bf643[_0xf3c0('0x35')]=_['keys'](_0x2ce2f2['query']);_0x2bf643['filters']=_[_0xf3c0('0x37')](_0x2bf643['model'],_0x2bf643[_0xf3c0('0x35')]);_0x215d3a['attributes']=_[_0xf3c0('0x37')](_0x2bf643[_0xf3c0('0x34')],qs[_0xf3c0('0x39')](_0x2ce2f2[_0xf3c0('0x35')][_0xf3c0('0x39')]));_0x215d3a['attributes']=_0x215d3a[_0xf3c0('0x38')]['length']?_0x215d3a[_0xf3c0('0x38')]:_0x2bf643[_0xf3c0('0x34')];if(_0x2ce2f2[_0xf3c0('0x35')][_0xf3c0('0x44')]){_0x215d3a[_0xf3c0('0x45')]=[{'all':!![]}];}_0x215d3a=_[_0xf3c0('0x41')]({},_0x215d3a,_0x2ce2f2[_0xf3c0('0x42')]);return db[_0xf3c0('0x30')][_0xf3c0('0x4c')](_0x215d3a)[_0xf3c0('0x26')](handleEntityNotFound(_0x1f63d9,null))[_0xf3c0('0x26')](respondWithResult(_0x1f63d9,null))['catch'](handleError(_0x1f63d9,null));};exports[_0xf3c0('0x4d')]=function(_0x31b0ef,_0x36ae0a){return db[_0xf3c0('0x30')][_0xf3c0('0x4d')](_0x31b0ef['body'],{})[_0xf3c0('0x26')](function(_0x4ce394){var _0x1860f0=_0x31b0ef[_0xf3c0('0x4e')][_0xf3c0('0x28')]({'plain':!![]});if(!_0x1860f0)throw new Error(_0xf3c0('0x4f'));if(_0x1860f0['role']===_0xf3c0('0x4e')){var _0x441633=_0x4ce394[_0xf3c0('0x28')]({'plain':!![]});var _0x708b5=_0xf3c0('0x29');return db[_0xf3c0('0x50')][_0xf3c0('0x4c')]({'where':{'name':_0x708b5,'userProfileId':_0x1860f0['userProfileId']},'raw':!![]})[_0xf3c0('0x26')](function(_0x2abc78){if(_0x2abc78&&_0x2abc78[_0xf3c0('0x51')]===0x0){return db[_0xf3c0('0x2a')][_0xf3c0('0x4d')]({'name':_0x441633[_0xf3c0('0x2c')],'resourceId':_0x441633['id'],'type':_0x2abc78[_0xf3c0('0x2c')],'sectionId':_0x2abc78['id']},{})[_0xf3c0('0x26')](function(){return _0x4ce394;});}else{return _0x4ce394;}})[_0xf3c0('0x47')](function(_0x216299){logger[_0xf3c0('0x2b')](_0xf3c0('0x52'),_0x216299);throw _0x216299;});}return _0x4ce394;})[_0xf3c0('0x26')](respondWithResult(_0x36ae0a,0xc9))[_0xf3c0('0x47')](handleError(_0x36ae0a,null));};exports[_0xf3c0('0x25')]=function(_0x2f677d,_0x38e20a){if(_0x2f677d['body']['id']){delete _0x2f677d['body']['id'];}return db['SmsQueue'][_0xf3c0('0x4c')]({'where':{'id':_0x2f677d[_0xf3c0('0x49')]['id']}})[_0xf3c0('0x26')](handleEntityNotFound(_0x38e20a,null))[_0xf3c0('0x26')](saveUpdates(_0x2f677d['body'],null))[_0xf3c0('0x26')](respondWithResult(_0x38e20a,null))[_0xf3c0('0x47')](handleError(_0x38e20a,null));};exports[_0xf3c0('0x27')]=function(_0x2408f7,_0x3514d4){return db[_0xf3c0('0x30')]['find']({'where':{'id':_0x2408f7[_0xf3c0('0x49')]['id']}})[_0xf3c0('0x26')](handleEntityNotFound(_0x3514d4,null))['then'](removeEntity(_0x3514d4,null))[_0xf3c0('0x47')](handleError(_0x3514d4,null));};exports[_0xf3c0('0x53')]=function(_0x46155f,_0x57fa83){return db[_0xf3c0('0x30')][_0xf3c0('0x53')]()[_0xf3c0('0x26')](respondWithResult(_0x57fa83,null))['catch'](handleError(_0x57fa83,null));};exports[_0xf3c0('0x54')]=function(_0x500b91,_0x3ff874,_0x306d86){var _0x499919={'raw':!![],'where':{}},_0x3665e2={},_0x5bbd36;return db[_0xf3c0('0x30')][_0xf3c0('0x55')]({'where':{'id':_0x500b91['params']['id']}})[_0xf3c0('0x26')](handleEntityNotFound(_0x3ff874,null))[_0xf3c0('0x26')](function(_0x923c09){if(_0x923c09){_0x5bbd36=_0x923c09[_0xf3c0('0x28')]({'plain':!![]});_0x3665e2[_0xf3c0('0x34')]=_[_0xf3c0('0x4a')](db['UserSmsQueue'][_0xf3c0('0x4b')]);_0x3665e2[_0xf3c0('0x35')]=_[_0xf3c0('0x4a')](_0x500b91[_0xf3c0('0x35')]);_0x3665e2[_0xf3c0('0x36')]=_[_0xf3c0('0x37')](_0x3665e2[_0xf3c0('0x34')],_0x3665e2[_0xf3c0('0x35')]);_0x499919[_0xf3c0('0x38')]=_[_0xf3c0('0x37')](_0x3665e2['model'],qs[_0xf3c0('0x39')](_0x500b91['query'][_0xf3c0('0x39')]));_0x499919[_0xf3c0('0x38')]=_0x499919[_0xf3c0('0x38')][_0xf3c0('0x3a')]?_0x499919['attributes']:_0x3665e2[_0xf3c0('0x34')];if(!_0x500b91[_0xf3c0('0x35')][_0xf3c0('0x3b')](_0xf3c0('0x3c'))){_0x499919['limit']=qs[_0xf3c0('0x20')](_0x500b91[_0xf3c0('0x35')][_0xf3c0('0x20')]);_0x499919[_0xf3c0('0x1f')]=qs[_0xf3c0('0x1f')](_0x500b91[_0xf3c0('0x35')][_0xf3c0('0x1f')]);}_0x499919['order']=qs[_0xf3c0('0x3e')](_0x500b91['query'][_0xf3c0('0x3e')]);_0x499919[_0xf3c0('0x3f')]=qs[_0xf3c0('0x36')](_['pick'](_0x500b91[_0xf3c0('0x35')],_0x3665e2['filters']));_0x499919[_0xf3c0('0x3f')]['SmsQueueId']=_0x923c09['id'];if(_0x500b91[_0xf3c0('0x35')][_0xf3c0('0x40')]){_0x499919[_0xf3c0('0x3f')]=_[_0xf3c0('0x41')](_0x499919[_0xf3c0('0x3f')],{'$or':_[_0xf3c0('0x2f')](_0x499919['attributes'],function(_0x2078ed){var _0x3eb3de={};_0x3eb3de[_0x2078ed]={'$like':'%'+_0x500b91[_0xf3c0('0x35')][_0xf3c0('0x40')]+'%'};return _0x3eb3de;})});}_0x499919=_[_0xf3c0('0x41')]({},_0x499919,_0x500b91[_0xf3c0('0x42')]);return db[_0xf3c0('0x56')]['findAll'](_0x499919);}})[_0xf3c0('0x26')](function(_0x469348){if(_0x469348){return db[_0xf3c0('0x57')]['findAndCountAll']({'where':{'id':_['map'](_0x469348,'UserId'),'role':_0xf3c0('0x58')},'attributes':['id',_0xf3c0('0x2c'),'smsPause','updatedAt',_0xf3c0('0x59')]});}})[_0xf3c0('0x26')](function(_0x33510e){if(_0x33510e){return{'count':_0x33510e[_0xf3c0('0x43')],'rows':_[_0xf3c0('0x2f')](_0x33510e[_0xf3c0('0x46')],function(_0xa2ec50){return{'membername':_0xa2ec50[_0xf3c0('0x2c')],'UserId':_0xa2ec50['id'],'queue_name':_0x5bbd36['name'],'SmsQueueId':_0x5bbd36['id'],'interface':util[_0xf3c0('0x5a')](_0xf3c0('0x5b'),_0xf3c0('0x5c'),_0xa2ec50['name']),'penalty':0x0,'paused':_0xa2ec50[_0xf3c0('0x5d')],'createdAt':_0xa2ec50[_0xf3c0('0x59')],'updatedAt':_0xa2ec50['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xf3c0('0x26')](respondWithFilteredResult(_0x3ff874,_0x499919))['catch'](handleError(_0x3ff874,null));};exports[_0xf3c0('0x5e')]=function(_0x58e467,_0x4f7503,_0x553b3f){var _0x1dacbc={};var _0x3abe38={};var _0x10b10f;var _0xcc3019;return db['SmsQueue'][_0xf3c0('0x55')]({'where':{'id':_0x58e467[_0xf3c0('0x49')]['id']}})[_0xf3c0('0x26')](handleEntityNotFound(_0x4f7503,null))[_0xf3c0('0x26')](function(_0x4bef6b){if(_0x4bef6b){_0x10b10f=_0x4bef6b;_0x3abe38[_0xf3c0('0x34')]=_['keys'](db[_0xf3c0('0x5f')]['rawAttributes']);_0x3abe38['query']=_[_0xf3c0('0x4a')](_0x58e467[_0xf3c0('0x35')]);_0x3abe38['filters']=_[_0xf3c0('0x37')](_0x3abe38[_0xf3c0('0x34')],_0x3abe38[_0xf3c0('0x35')]);_0x1dacbc[_0xf3c0('0x38')]=_['intersection'](_0x3abe38[_0xf3c0('0x34')],qs[_0xf3c0('0x39')](_0x58e467[_0xf3c0('0x35')][_0xf3c0('0x39')]));_0x1dacbc[_0xf3c0('0x38')]=_0x1dacbc[_0xf3c0('0x38')]['length']?_0x1dacbc[_0xf3c0('0x38')]:_0x3abe38[_0xf3c0('0x34')];_0x1dacbc[_0xf3c0('0x3d')]=qs[_0xf3c0('0x3e')](_0x58e467[_0xf3c0('0x35')][_0xf3c0('0x3e')]);_0x1dacbc[_0xf3c0('0x3f')]=qs[_0xf3c0('0x36')](_[_0xf3c0('0x60')](_0x58e467[_0xf3c0('0x35')],_0x3abe38['filters']));if(_0x58e467['query'][_0xf3c0('0x40')]){_0x1dacbc['where']=_['merge'](_0x1dacbc[_0xf3c0('0x3f')],{'$or':_[_0xf3c0('0x2f')](_0x1dacbc[_0xf3c0('0x38')],function(_0x4095b4){var _0x423cf8={};_0x423cf8[_0x4095b4]={'$like':'%'+_0x58e467[_0xf3c0('0x35')][_0xf3c0('0x40')]+'%'};return _0x423cf8;})});}_0x1dacbc=_[_0xf3c0('0x41')]({},_0x1dacbc,_0x58e467['options']);return _0x10b10f['getTeams'](_0x1dacbc);}})['then'](function(_0x819bd3){if(_0x819bd3){_0xcc3019=_0x819bd3['length'];if(!_0x58e467[_0xf3c0('0x35')][_0xf3c0('0x3b')](_0xf3c0('0x3c'))){_0x1dacbc[_0xf3c0('0x20')]=qs[_0xf3c0('0x20')](_0x58e467[_0xf3c0('0x35')][_0xf3c0('0x20')]);_0x1dacbc[_0xf3c0('0x1f')]=qs[_0xf3c0('0x1f')](_0x58e467['query']['offset']);}return _0x10b10f[_0xf3c0('0x5e')](_0x1dacbc);}})[_0xf3c0('0x26')](function(_0x174469){if(_0x174469){return _0x174469?{'count':_0xcc3019,'rows':_0x174469}:null;}})[_0xf3c0('0x26')](respondWithResult(_0x4f7503,null))['catch'](handleError(_0x4f7503,null));};exports[_0xf3c0('0x61')]=function(_0x50dd7f,_0x8d7b92,_0x492148){var _0x2b7a09=_0x50dd7f[_0xf3c0('0x62')][_0xf3c0('0x63')];return db['Team']['findAll']({'where':{'id':_0x2b7a09},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xf3c0('0x2c'),'online',_0xf3c0('0x64'),'interface'],'raw':!![]}]})[_0xf3c0('0x26')](function(_0x439a7a){if(_0x439a7a){var _0x32e3e7=_[_0xf3c0('0x65')](_0x439a7a,function(_0x56c348){var _0x26601d=_0x56c348[_0xf3c0('0x28')]({'plain':!![]});return _0x26601d['Agents'];});return db['SmsQueue']['find']({'where':{'id':_0x50dd7f[_0xf3c0('0x49')]['id']}})['then'](function(_0x44c182){return db[_0xf3c0('0x66')][_0xf3c0('0x67')](function(_0x3d0b63){return _0x44c182[_0xf3c0('0x61')](_0x2b7a09,{'transaction':_0x3d0b63})[_0xf3c0('0x26')](function(){return BPromise[_0xf3c0('0x68')](_0x32e3e7,function(_0x2fd994){return db['UserSmsQueue'][_0xf3c0('0x69')]({'where':{'UserId':_0x2fd994['id'],'SmsQueueId':_0x50dd7f['params']['id']},'transaction':_0x3d0b63});});})[_0xf3c0('0x26')](function(){_0x32e3e7[_0xf3c0('0x6a')](function(_0xf5afae){socket['emit'](_0xf3c0('0x6b'),{'UserId':_0xf5afae['id'],'SmsQueueId':_0x44c182['id']});});});});});}})[_0xf3c0('0x26')](respondWithStatusCode(_0x8d7b92,null))[_0xf3c0('0x47')](handleError(_0x8d7b92,null));};exports[_0xf3c0('0x6c')]=function(_0x170d86,_0x2ae600,_0x2014c7){return db[_0xf3c0('0x5f')]['findAll']({'where':{'id':_0x170d86[_0xf3c0('0x35')][_0xf3c0('0x63')]},'attributes':['id'],'include':[{'model':db[_0xf3c0('0x57')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf3c0('0x26')](handleEntityNotFound(_0x2ae600,null))[_0xf3c0('0x26')](function(_0x4ed0e4){var _0x955570=_[_0xf3c0('0x2f')](_0x4ed0e4,'id');var _0x3f8453=[];var _0xd9b50f=[];var _0xc292ae=squel['select']();_0xc292ae[_0xf3c0('0x6d')]('tq.TeamId')[_0xf3c0('0x6e')](_0xf3c0('0x6f'),'tq')['join'](_0xf3c0('0x70'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf3c0('0x3f')](_0xf3c0('0x71'),_0x170d86['params']['id']);for(var _0x1a4d76=0x0;_0x1a4d76<_0x4ed0e4[_0xf3c0('0x3a')];_0x1a4d76+=0x1){let _0x5e83e9=_0x4ed0e4[_0x1a4d76];for(var _0xacaae4=0x0;_0xacaae4<_0x5e83e9['Agents']['length'];_0xacaae4+=0x1){let _0x2e0c21=_0x5e83e9[_0xf3c0('0x72')][_0xacaae4];var _0x26a12d=_0xc292ae['clone']();_0x26a12d[_0xf3c0('0x3f')](_0xf3c0('0x73'),_0x2e0c21['id']);_0xd9b50f['push'](db[_0xf3c0('0x66')][_0xf3c0('0x35')](_0x26a12d['toString'](),{'type':db[_0xf3c0('0x66')][_0xf3c0('0x74')][_0xf3c0('0x75')]})[_0xf3c0('0x26')](function(_0x2f1dc9){if(_0x2f1dc9['length']===0x1){return _0x2e0c21['id'];}else{var _0x10690d=_[_0xf3c0('0x76')](_[_0xf3c0('0x2f')](_0x2f1dc9,_0xf3c0('0x77')),function(_0x469bcb){return _[_0xf3c0('0x78')](_0x955570,_0x469bcb);});if(_0x10690d){return _0x2e0c21['id'];}}}));}}return BPromise[_0xf3c0('0x79')](_0xd9b50f)[_0xf3c0('0x26')](function(_0x5c8b56){_0x3f8453=_(_0x3f8453)[_0xf3c0('0x7a')](_0x5c8b56)[_0xf3c0('0x7b')]()[_0xf3c0('0x7c')]();return db[_0xf3c0('0x30')][_0xf3c0('0x4c')]({'where':{'id':_0x170d86[_0xf3c0('0x49')]['id']}})[_0xf3c0('0x26')](function(_0x1df73d){return db[_0xf3c0('0x66')][_0xf3c0('0x67')](function(_0xb52c5a){return _0x1df73d[_0xf3c0('0x6c')](_0x170d86[_0xf3c0('0x35')][_0xf3c0('0x63')],{'transaction':_0xb52c5a})['then'](function(){if(!_[_0xf3c0('0x7d')](_0x3f8453)){return _0x1df73d[_0xf3c0('0x7e')](_0x3f8453,{'transaction':_0xb52c5a});}})[_0xf3c0('0x26')](function(){_0x3f8453[_0xf3c0('0x6a')](function(_0x10c7cc){socket[_0xf3c0('0x7f')](_0xf3c0('0x80'),{'UserId':_0x10c7cc,'SmsQueueId':_0x1df73d['id']});});});});});});})[_0xf3c0('0x26')](respondWithStatusCode(_0x2ae600,null))['catch'](handleError(_0x2ae600,null));};exports[_0xf3c0('0x81')]=function(_0xa23e4b,_0x57a661,_0x549a91){return db[_0xf3c0('0x30')][_0xf3c0('0x4c')]({'where':{'id':_0xa23e4b[_0xf3c0('0x49')]['id']}})[_0xf3c0('0x26')](handleEntityNotFound(_0x57a661,null))['then'](function(_0x457c4d){if(_0x457c4d){return _0x457c4d[_0xf3c0('0x81')](_0xa23e4b['body'][_0xf3c0('0x63')],_[_0xf3c0('0x82')](_0xa23e4b[_0xf3c0('0x62')],['ids','id'])||{})[_0xf3c0('0x83')](function(_0x376943){for(var _0x33a34e=0x0;_0x33a34e<_0xa23e4b[_0xf3c0('0x62')][_0xf3c0('0x63')][_0xf3c0('0x3a')];_0x33a34e+=0x1){socket[_0xf3c0('0x7f')](_0xf3c0('0x6b'),{'UserId':_0xa23e4b['body'][_0xf3c0('0x63')][_0x33a34e],'SmsQueueId':_0xa23e4b[_0xf3c0('0x49')]['id']});}return _0x376943;});}})['then'](respondWithResult(_0x57a661,null))[_0xf3c0('0x47')](handleError(_0x57a661,null));};exports[_0xf3c0('0x7e')]=function(_0x2f94bf,_0x42eb7d,_0x4afa8c){return db[_0xf3c0('0x30')][_0xf3c0('0x4c')]({'where':{'id':_0x2f94bf['params']['id']}})['then'](handleEntityNotFound(_0x42eb7d,null))[_0xf3c0('0x26')](function(_0x51a234){if(_0x51a234){return _0x51a234['removeAgents'](_0x2f94bf['query'][_0xf3c0('0x63')])[_0xf3c0('0x26')](function(){if(_[_0xf3c0('0x84')](_0x2f94bf['query'][_0xf3c0('0x63')])){for(var _0x23b2c2=0x0;_0x23b2c2<_0x2f94bf[_0xf3c0('0x35')][_0xf3c0('0x63')]['length'];_0x23b2c2+=0x1){socket[_0xf3c0('0x7f')](_0xf3c0('0x80'),{'UserId':Number(_0x2f94bf[_0xf3c0('0x35')][_0xf3c0('0x63')][_0x23b2c2]),'SmsQueueId':Number(_0x2f94bf[_0xf3c0('0x49')]['id'])});}}else{socket[_0xf3c0('0x7f')](_0xf3c0('0x80'),{'UserId':Number(_0x2f94bf[_0xf3c0('0x35')][_0xf3c0('0x63')]),'SmsQueueId':Number(_0x2f94bf[_0xf3c0('0x49')]['id'])});}});}})[_0xf3c0('0x26')](respondWithStatusCode(_0x42eb7d,null))[_0xf3c0('0x47')](handleError(_0x42eb7d,null));};exports[_0xf3c0('0x85')]=function(_0x5bca41,_0x506057,_0x4eea8a){var _0x5c9163={};var _0x129e02={};var _0x635022;var _0x5d2a9a;return db[_0xf3c0('0x30')]['findOne']({'where':{'id':_0x5bca41['params']['id']}})[_0xf3c0('0x26')](handleEntityNotFound(_0x506057,null))['then'](function(_0x19ef16){if(_0x19ef16){_0x635022=_0x19ef16;_0x129e02[_0xf3c0('0x34')]=_[_0xf3c0('0x4a')](db[_0xf3c0('0x57')][_0xf3c0('0x4b')]);_0x129e02[_0xf3c0('0x35')]=_[_0xf3c0('0x4a')](_0x5bca41[_0xf3c0('0x35')]);_0x129e02[_0xf3c0('0x36')]=_[_0xf3c0('0x37')](_0x129e02[_0xf3c0('0x34')],_0x129e02[_0xf3c0('0x35')]);_0x5c9163['attributes']=_[_0xf3c0('0x37')](_0x129e02[_0xf3c0('0x34')],qs[_0xf3c0('0x39')](_0x5bca41['query'][_0xf3c0('0x39')]));_0x5c9163[_0xf3c0('0x38')]=_0x5c9163[_0xf3c0('0x38')]['length']?_0x5c9163[_0xf3c0('0x38')]:_0x129e02[_0xf3c0('0x34')];_0x5c9163[_0xf3c0('0x3d')]=qs[_0xf3c0('0x3e')](_0x5bca41[_0xf3c0('0x35')][_0xf3c0('0x3e')]);_0x5c9163[_0xf3c0('0x3f')]=qs[_0xf3c0('0x36')](_['pick'](_0x5bca41[_0xf3c0('0x35')],_0x129e02['filters']));if(_0x5bca41[_0xf3c0('0x35')][_0xf3c0('0x40')]){_0x5c9163['where']=_[_0xf3c0('0x41')](_0x5c9163['where'],{'$or':_[_0xf3c0('0x2f')](_0x5c9163['attributes'],function(_0x39c7a1){var _0x254e62={};_0x254e62[_0x39c7a1]={'$like':'%'+_0x5bca41['query']['filter']+'%'};return _0x254e62;})});}_0x5c9163=_[_0xf3c0('0x41')]({},_0x5c9163,_0x5bca41[_0xf3c0('0x42')]);return _0x635022[_0xf3c0('0x85')](_0x5c9163);}})[_0xf3c0('0x26')](function(_0x3dce38){if(_0x3dce38){_0x5d2a9a=_0x3dce38[_0xf3c0('0x3a')];if(!_0x5bca41['query']['hasOwnProperty']('nolimit')){_0x5c9163['limit']=qs[_0xf3c0('0x20')](_0x5bca41[_0xf3c0('0x35')][_0xf3c0('0x20')]);_0x5c9163[_0xf3c0('0x1f')]=qs[_0xf3c0('0x1f')](_0x5bca41[_0xf3c0('0x35')][_0xf3c0('0x1f')]);}return _0x635022['getAgents'](_0x5c9163);}})[_0xf3c0('0x26')](function(_0x2bcb1d){if(_0x2bcb1d){return _0x2bcb1d?{'count':_0x5d2a9a,'rows':_0x2bcb1d}:null;}})[_0xf3c0('0x26')](respondWithResult(_0x506057,null))[_0xf3c0('0x47')](handleError(_0x506057,null));}; \ No newline at end of file +var _0x2c79=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','SmsQueues','UserProfileResource','sendStatus','stack','name','send','index','SmsQueue','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','includeAll','catch','params','include','find','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','hasOwnProperty','options','User','findAndCountAll','map','UserId','agent','updatedAt','createdAt','format','%s/%s','smsPause','getTeams','Team','addTeams','ids','findAll','Agents','online','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','removeTeams','select','field','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','every','TeamId','includes','all','union','compact','value','removeAgents','userSmsQueue:remove','addAgents','omit','spread','userSmsQueue:save','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x31d482,_0x48ac90){var _0x26d771=function(_0x41b3f7){while(--_0x41b3f7){_0x31d482['push'](_0x31d482['shift']());}};_0x26d771(++_0x48ac90);}(_0x2c79,0x102));var _0x92c7=function(_0x59cec8,_0x5a770e){_0x59cec8=_0x59cec8-0x0;var _0x260932=_0x2c79[_0x59cec8];return _0x260932;};'use strict';var pdf=require(_0x92c7('0x0'));var emlformat=require(_0x92c7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x92c7('0x2'));var jsonpatch=require(_0x92c7('0x3'));var rp=require('request-promise');var moment=require(_0x92c7('0x4'));var BPromise=require(_0x92c7('0x5'));var Mustache=require('mustache');var util=require(_0x92c7('0x6'));var path=require(_0x92c7('0x7'));var sox=require(_0x92c7('0x8'));var csv=require(_0x92c7('0x9'));var ejs=require(_0x92c7('0xa'));var fs=require('fs');var _=require(_0x92c7('0xb'));var squel=require(_0x92c7('0xc'));var crypto=require('crypto');var jsforce=require(_0x92c7('0xd'));var deskjs=require(_0x92c7('0xe'));var toCsv=require(_0x92c7('0x9'));var querystring=require(_0x92c7('0xf'));var Papa=require(_0x92c7('0x10'));var Redis=require(_0x92c7('0x11'));var authService=require(_0x92c7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x92c7('0x13'));var hardwareService=require(_0x92c7('0x14'));var logger=require(_0x92c7('0x15'))(_0x92c7('0x16'));var utils=require(_0x92c7('0x17'));var config=require('../../config/environment');var db=require(_0x92c7('0x18'))['db'];config[_0x92c7('0x19')]=_[_0x92c7('0x1a')](config[_0x92c7('0x19')],{'host':_0x92c7('0x1b'),'port':0x18eb});var socket=require(_0x92c7('0x1c'))(new Redis(config[_0x92c7('0x19')]));require(_0x92c7('0x1d'))['register'](socket);function respondWithStatusCode(_0x54615b,_0x39bbb9){_0x39bbb9=_0x39bbb9||0xcc;return function(_0x68e31b){if(_0x68e31b){return _0x54615b['sendStatus'](_0x39bbb9);}return _0x54615b[_0x92c7('0x1e')](_0x39bbb9)[_0x92c7('0x1f')]();};}function respondWithResult(_0x547fc5,_0x2604cb){_0x2604cb=_0x2604cb||0xc8;return function(_0x2e4e13){if(_0x2e4e13){return _0x547fc5[_0x92c7('0x1e')](_0x2604cb)[_0x92c7('0x20')](_0x2e4e13);}};}function respondWithFilteredResult(_0x4e184d,_0x10d18f){return function(_0x3cc7c7){if(_0x3cc7c7){var _0x4a9f9d=_0x3cc7c7[_0x92c7('0x21')],_0x1909da=_0x10d18f[_0x92c7('0x22')],_0x5980e2=_0x10d18f[_0x92c7('0x22')]+_0x10d18f['limit'],_0x35589d;if(_0x5980e2>=_0x4a9f9d){_0x5980e2=_0x4a9f9d;_0x35589d=0xc8;}else{_0x35589d=0xce;}_0x4e184d[_0x92c7('0x1e')](_0x35589d);return _0x4e184d['set'](_0x92c7('0x23'),_0x1909da+'-'+_0x5980e2+'/'+_0x4a9f9d)[_0x92c7('0x20')](_0x3cc7c7);}return null;};}function patchUpdates(_0x272a1e){return function(_0x1f9ab5){try{jsonpatch[_0x92c7('0x24')](_0x1f9ab5,_0x272a1e,!![]);}catch(_0x382aec){return BPromise[_0x92c7('0x25')](_0x382aec);}return _0x1f9ab5[_0x92c7('0x26')]();};}function saveUpdates(_0x1c9bd2,_0x29d9c3){return function(_0x1fb2f6){if(_0x1fb2f6){return _0x1fb2f6[_0x92c7('0x27')](_0x1c9bd2)[_0x92c7('0x28')](function(_0x5f5169){return _0x5f5169;});}return null;};}function removeEntity(_0x48bce3,_0x132acf){return function(_0x401130){if(_0x401130){return _0x401130[_0x92c7('0x29')]()[_0x92c7('0x28')](function(){var _0x360350=_0x401130['get']({'plain':!![]});var _0x4bf780=_0x92c7('0x2a');return db[_0x92c7('0x2b')][_0x92c7('0x29')]({'where':{'type':_0x4bf780,'resourceId':_0x360350['id']}})['then'](function(){return _0x401130;});})[_0x92c7('0x28')](function(){_0x48bce3[_0x92c7('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6d554f,_0x35433b){return function(_0x58ecc7){if(!_0x58ecc7){_0x6d554f[_0x92c7('0x2c')](0x194);}return _0x58ecc7;};}function handleError(_0x55ee98,_0x25e18a){_0x25e18a=_0x25e18a||0x1f4;return function(_0x3dc9ed){logger['error'](_0x3dc9ed[_0x92c7('0x2d')]);if(_0x3dc9ed[_0x92c7('0x2e')]){delete _0x3dc9ed[_0x92c7('0x2e')];}_0x55ee98[_0x92c7('0x1e')](_0x25e18a)[_0x92c7('0x2f')](_0x3dc9ed);};}exports[_0x92c7('0x30')]=function(_0x4685cf,_0x3f3d19){var _0x511f53={},_0x6b3cea={},_0x29190c={'count':0x0,'rows':[]};var _0x40858f=_['map'](db[_0x92c7('0x31')][_0x92c7('0x32')],function(_0x5cdb75){return{'name':_0x5cdb75['fieldName'],'type':_0x5cdb75['type'][_0x92c7('0x33')]};});_0x6b3cea[_0x92c7('0x34')]=_['map'](_0x40858f,'name');_0x6b3cea[_0x92c7('0x35')]=_[_0x92c7('0x36')](_0x4685cf[_0x92c7('0x35')]);_0x6b3cea['filters']=_[_0x92c7('0x37')](_0x6b3cea[_0x92c7('0x34')],_0x6b3cea[_0x92c7('0x35')]);_0x511f53[_0x92c7('0x38')]=_['intersection'](_0x6b3cea[_0x92c7('0x34')],qs[_0x92c7('0x39')](_0x4685cf['query']['fields']));_0x511f53[_0x92c7('0x38')]=_0x511f53[_0x92c7('0x38')][_0x92c7('0x3a')]?_0x511f53[_0x92c7('0x38')]:_0x6b3cea['model'];if(!_0x4685cf[_0x92c7('0x35')]['hasOwnProperty'](_0x92c7('0x3b'))){_0x511f53['limit']=qs[_0x92c7('0x3c')](_0x4685cf['query'][_0x92c7('0x3c')]);_0x511f53[_0x92c7('0x22')]=qs[_0x92c7('0x22')](_0x4685cf['query'][_0x92c7('0x22')]);}_0x511f53[_0x92c7('0x3d')]=qs[_0x92c7('0x3e')](_0x4685cf['query']['sort']);_0x511f53[_0x92c7('0x3f')]=qs[_0x92c7('0x40')](_[_0x92c7('0x41')](_0x4685cf[_0x92c7('0x35')],_0x6b3cea[_0x92c7('0x40')]),_0x40858f);if(_0x4685cf['query']['filter']){_0x511f53['where']=_[_0x92c7('0x42')](_0x511f53[_0x92c7('0x3f')],{'$or':_['map'](_0x40858f,function(_0xee8627){if(_0xee8627[_0x92c7('0x43')]!==_0x92c7('0x44')){var _0x58ae00={};_0x58ae00[_0xee8627[_0x92c7('0x2e')]]={'$like':'%'+_0x4685cf[_0x92c7('0x35')][_0x92c7('0x45')]+'%'};return _0x58ae00;}})});}_0x511f53=_['merge']({},_0x511f53,_0x4685cf['options']);var _0x263712={'where':_0x511f53[_0x92c7('0x3f')]};return db[_0x92c7('0x31')][_0x92c7('0x21')](_0x263712)[_0x92c7('0x28')](function(_0x50c54d){_0x29190c[_0x92c7('0x21')]=_0x50c54d;if(_0x4685cf['query'][_0x92c7('0x46')]){_0x511f53['include']=[{'all':!![]}];}return db[_0x92c7('0x31')]['findAll'](_0x511f53);})['then'](function(_0x30b7f2){_0x29190c['rows']=_0x30b7f2;return _0x29190c;})['then'](respondWithFilteredResult(_0x3f3d19,_0x511f53))[_0x92c7('0x47')](handleError(_0x3f3d19,null));};exports['show']=function(_0x4738b7,_0x48aa1d){var _0x33b763={'raw':!![],'where':{'id':_0x4738b7[_0x92c7('0x48')]['id']}},_0x2cd40f={};_0x2cd40f[_0x92c7('0x34')]=_['keys'](db['SmsQueue'][_0x92c7('0x32')]);_0x2cd40f[_0x92c7('0x35')]=_[_0x92c7('0x36')](_0x4738b7[_0x92c7('0x35')]);_0x2cd40f[_0x92c7('0x40')]=_['intersection'](_0x2cd40f[_0x92c7('0x34')],_0x2cd40f[_0x92c7('0x35')]);_0x33b763[_0x92c7('0x38')]=_['intersection'](_0x2cd40f['model'],qs['fields'](_0x4738b7[_0x92c7('0x35')][_0x92c7('0x39')]));_0x33b763[_0x92c7('0x38')]=_0x33b763[_0x92c7('0x38')]['length']?_0x33b763[_0x92c7('0x38')]:_0x2cd40f['model'];if(_0x4738b7[_0x92c7('0x35')]['includeAll']){_0x33b763[_0x92c7('0x49')]=[{'all':!![]}];}_0x33b763=_[_0x92c7('0x42')]({},_0x33b763,_0x4738b7['options']);return db[_0x92c7('0x31')][_0x92c7('0x4a')](_0x33b763)[_0x92c7('0x28')](handleEntityNotFound(_0x48aa1d,null))[_0x92c7('0x28')](respondWithResult(_0x48aa1d,null))[_0x92c7('0x47')](handleError(_0x48aa1d,null));};exports[_0x92c7('0x4b')]=function(_0x39b6d2,_0x1580fd){return db[_0x92c7('0x31')]['create'](_0x39b6d2[_0x92c7('0x4c')],{})[_0x92c7('0x28')](function(_0x42b26c){var _0x226ee5=_0x39b6d2[_0x92c7('0x4d')][_0x92c7('0x4e')]({'plain':!![]});if(!_0x226ee5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x226ee5['role']===_0x92c7('0x4d')){var _0x4e749b=_0x42b26c['get']({'plain':!![]});var _0x34e6a8=_0x92c7('0x2a');return db[_0x92c7('0x4f')]['find']({'where':{'name':_0x34e6a8,'userProfileId':_0x226ee5[_0x92c7('0x50')]},'raw':!![]})[_0x92c7('0x28')](function(_0x109bb3){if(_0x109bb3&&_0x109bb3[_0x92c7('0x51')]===0x0){return db[_0x92c7('0x2b')][_0x92c7('0x4b')]({'name':_0x4e749b[_0x92c7('0x2e')],'resourceId':_0x4e749b['id'],'type':_0x109bb3[_0x92c7('0x2e')],'sectionId':_0x109bb3['id']},{})['then'](function(){return _0x42b26c;});}else{return _0x42b26c;}})[_0x92c7('0x47')](function(_0x662a17){logger[_0x92c7('0x52')](_0x92c7('0x53'),_0x662a17);throw _0x662a17;});}return _0x42b26c;})[_0x92c7('0x28')](respondWithResult(_0x1580fd,0xc9))[_0x92c7('0x47')](handleError(_0x1580fd,null));};exports[_0x92c7('0x27')]=function(_0x45a0f3,_0x12c985){if(_0x45a0f3['body']['id']){delete _0x45a0f3[_0x92c7('0x4c')]['id'];}return db[_0x92c7('0x31')][_0x92c7('0x4a')]({'where':{'id':_0x45a0f3[_0x92c7('0x48')]['id']}})[_0x92c7('0x28')](handleEntityNotFound(_0x12c985,null))[_0x92c7('0x28')](saveUpdates(_0x45a0f3[_0x92c7('0x4c')],null))[_0x92c7('0x28')](respondWithResult(_0x12c985,null))[_0x92c7('0x47')](handleError(_0x12c985,null));};exports[_0x92c7('0x29')]=function(_0x2c97ee,_0x5008f3){return db[_0x92c7('0x31')]['find']({'where':{'id':_0x2c97ee[_0x92c7('0x48')]['id']}})[_0x92c7('0x28')](handleEntityNotFound(_0x5008f3,null))['then'](removeEntity(_0x5008f3,null))[_0x92c7('0x47')](handleError(_0x5008f3,null));};exports[_0x92c7('0x54')]=function(_0x205531,_0x5c8f20){return db['SmsQueue'][_0x92c7('0x54')]()[_0x92c7('0x28')](respondWithResult(_0x5c8f20,null))[_0x92c7('0x47')](handleError(_0x5c8f20,null));};exports[_0x92c7('0x55')]=function(_0x52c333,_0x146562,_0x3b8ed9){var _0x119479={'raw':!![],'where':{}},_0x2f1525={},_0x26b578;return db['SmsQueue'][_0x92c7('0x56')]({'where':{'id':_0x52c333[_0x92c7('0x48')]['id']}})[_0x92c7('0x28')](handleEntityNotFound(_0x146562,null))['then'](function(_0x53e3b3){if(_0x53e3b3){_0x26b578=_0x53e3b3[_0x92c7('0x4e')]({'plain':!![]});_0x2f1525[_0x92c7('0x34')]=_[_0x92c7('0x36')](db[_0x92c7('0x57')][_0x92c7('0x32')]);_0x2f1525[_0x92c7('0x35')]=_[_0x92c7('0x36')](_0x52c333['query']);_0x2f1525[_0x92c7('0x40')]=_[_0x92c7('0x37')](_0x2f1525['model'],_0x2f1525['query']);_0x119479[_0x92c7('0x38')]=_[_0x92c7('0x37')](_0x2f1525[_0x92c7('0x34')],qs['fields'](_0x52c333[_0x92c7('0x35')][_0x92c7('0x39')]));_0x119479['attributes']=_0x119479[_0x92c7('0x38')][_0x92c7('0x3a')]?_0x119479[_0x92c7('0x38')]:_0x2f1525[_0x92c7('0x34')];if(!_0x52c333[_0x92c7('0x35')][_0x92c7('0x58')](_0x92c7('0x3b'))){_0x119479['limit']=qs[_0x92c7('0x3c')](_0x52c333[_0x92c7('0x35')][_0x92c7('0x3c')]);_0x119479[_0x92c7('0x22')]=qs[_0x92c7('0x22')](_0x52c333[_0x92c7('0x35')][_0x92c7('0x22')]);}_0x119479['order']=qs['sort'](_0x52c333[_0x92c7('0x35')][_0x92c7('0x3e')]);_0x119479['where']=qs['filters'](_['pick'](_0x52c333['query'],_0x2f1525[_0x92c7('0x40')]));_0x119479['where']['SmsQueueId']=_0x53e3b3['id'];if(_0x52c333[_0x92c7('0x35')][_0x92c7('0x45')]){_0x119479[_0x92c7('0x3f')]=_['merge'](_0x119479['where'],{'$or':_['map'](_0x119479[_0x92c7('0x38')],function(_0x4f75e0){var _0x5d7c15={};_0x5d7c15[_0x4f75e0]={'$like':'%'+_0x52c333[_0x92c7('0x35')][_0x92c7('0x45')]+'%'};return _0x5d7c15;})});}_0x119479=_['merge']({},_0x119479,_0x52c333[_0x92c7('0x59')]);return db[_0x92c7('0x57')]['findAll'](_0x119479);}})[_0x92c7('0x28')](function(_0x3b55be){if(_0x3b55be){return db[_0x92c7('0x5a')][_0x92c7('0x5b')]({'where':{'id':_[_0x92c7('0x5c')](_0x3b55be,_0x92c7('0x5d')),'role':_0x92c7('0x5e')},'attributes':['id',_0x92c7('0x2e'),'smsPause',_0x92c7('0x5f'),_0x92c7('0x60')]});}})['then'](function(_0x3253a0){if(_0x3253a0){return{'count':_0x3253a0[_0x92c7('0x21')],'rows':_['map'](_0x3253a0['rows'],function(_0x580da2){return{'membername':_0x580da2[_0x92c7('0x2e')],'UserId':_0x580da2['id'],'queue_name':_0x26b578['name'],'SmsQueueId':_0x26b578['id'],'interface':util[_0x92c7('0x61')](_0x92c7('0x62'),'SIP',_0x580da2[_0x92c7('0x2e')]),'penalty':0x0,'paused':_0x580da2[_0x92c7('0x63')],'createdAt':_0x580da2[_0x92c7('0x60')],'updatedAt':_0x580da2[_0x92c7('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x146562,_0x119479))[_0x92c7('0x47')](handleError(_0x146562,null));};exports[_0x92c7('0x64')]=function(_0xb7ae8b,_0x144faa,_0x2e4d87){var _0xcb35df={};var _0x28d46b={};var _0x1d39de;var _0x4222c9;return db['SmsQueue'][_0x92c7('0x56')]({'where':{'id':_0xb7ae8b[_0x92c7('0x48')]['id']}})['then'](handleEntityNotFound(_0x144faa,null))[_0x92c7('0x28')](function(_0x3ae948){if(_0x3ae948){_0x1d39de=_0x3ae948;_0x28d46b[_0x92c7('0x34')]=_[_0x92c7('0x36')](db[_0x92c7('0x65')][_0x92c7('0x32')]);_0x28d46b[_0x92c7('0x35')]=_[_0x92c7('0x36')](_0xb7ae8b[_0x92c7('0x35')]);_0x28d46b[_0x92c7('0x40')]=_[_0x92c7('0x37')](_0x28d46b[_0x92c7('0x34')],_0x28d46b[_0x92c7('0x35')]);_0xcb35df[_0x92c7('0x38')]=_[_0x92c7('0x37')](_0x28d46b[_0x92c7('0x34')],qs[_0x92c7('0x39')](_0xb7ae8b['query'][_0x92c7('0x39')]));_0xcb35df[_0x92c7('0x38')]=_0xcb35df[_0x92c7('0x38')][_0x92c7('0x3a')]?_0xcb35df['attributes']:_0x28d46b[_0x92c7('0x34')];_0xcb35df['order']=qs[_0x92c7('0x3e')](_0xb7ae8b[_0x92c7('0x35')][_0x92c7('0x3e')]);_0xcb35df[_0x92c7('0x3f')]=qs[_0x92c7('0x40')](_[_0x92c7('0x41')](_0xb7ae8b[_0x92c7('0x35')],_0x28d46b[_0x92c7('0x40')]));if(_0xb7ae8b[_0x92c7('0x35')][_0x92c7('0x45')]){_0xcb35df[_0x92c7('0x3f')]=_[_0x92c7('0x42')](_0xcb35df[_0x92c7('0x3f')],{'$or':_[_0x92c7('0x5c')](_0xcb35df['attributes'],function(_0x24610d){var _0x73fc4a={};_0x73fc4a[_0x24610d]={'$like':'%'+_0xb7ae8b[_0x92c7('0x35')][_0x92c7('0x45')]+'%'};return _0x73fc4a;})});}_0xcb35df=_['merge']({},_0xcb35df,_0xb7ae8b[_0x92c7('0x59')]);return _0x1d39de[_0x92c7('0x64')](_0xcb35df);}})[_0x92c7('0x28')](function(_0x1105cf){if(_0x1105cf){_0x4222c9=_0x1105cf['length'];if(!_0xb7ae8b[_0x92c7('0x35')][_0x92c7('0x58')](_0x92c7('0x3b'))){_0xcb35df['limit']=qs['limit'](_0xb7ae8b['query'][_0x92c7('0x3c')]);_0xcb35df[_0x92c7('0x22')]=qs[_0x92c7('0x22')](_0xb7ae8b[_0x92c7('0x35')][_0x92c7('0x22')]);}return _0x1d39de[_0x92c7('0x64')](_0xcb35df);}})[_0x92c7('0x28')](function(_0x1b392b){if(_0x1b392b){return _0x1b392b?{'count':_0x4222c9,'rows':_0x1b392b}:null;}})[_0x92c7('0x28')](respondWithResult(_0x144faa,null))['catch'](handleError(_0x144faa,null));};exports[_0x92c7('0x66')]=function(_0x3b02c2,_0x58be5b,_0x3ae985){var _0x5a84b2=_0x3b02c2['body'][_0x92c7('0x67')];return db[_0x92c7('0x65')][_0x92c7('0x68')]({'where':{'id':_0x5a84b2},'attributes':['id'],'include':[{'model':db['User'],'as':_0x92c7('0x69'),'attributes':['id',_0x92c7('0x2e'),_0x92c7('0x6a'),'voicePause',_0x92c7('0x6b')],'raw':!![]}]})[_0x92c7('0x28')](function(_0x2cd975){if(_0x2cd975){var _0xca428b=_[_0x92c7('0x6c')](_0x2cd975,function(_0x432ca7){var _0xbf5799=_0x432ca7[_0x92c7('0x4e')]({'plain':!![]});return _0xbf5799[_0x92c7('0x69')];});return db[_0x92c7('0x31')][_0x92c7('0x4a')]({'where':{'id':_0x3b02c2[_0x92c7('0x48')]['id']}})[_0x92c7('0x28')](function(_0x2b298c){return db[_0x92c7('0x6d')][_0x92c7('0x6e')](function(_0x16390a){return _0x2b298c[_0x92c7('0x66')](_0x5a84b2,{'transaction':_0x16390a})[_0x92c7('0x28')](function(){return BPromise['each'](_0xca428b,function(_0x3125dc){return db[_0x92c7('0x57')][_0x92c7('0x6f')]({'where':{'UserId':_0x3125dc['id'],'SmsQueueId':_0x3b02c2[_0x92c7('0x48')]['id']},'transaction':_0x16390a});});})[_0x92c7('0x28')](function(){_0xca428b[_0x92c7('0x70')](function(_0x114fc9){socket[_0x92c7('0x71')]('userSmsQueue:save',{'UserId':_0x114fc9['id'],'SmsQueueId':_0x2b298c['id']});});});});});}})['then'](respondWithStatusCode(_0x58be5b,null))[_0x92c7('0x47')](handleError(_0x58be5b,null));};exports[_0x92c7('0x72')]=function(_0x59a4f1,_0x3a3021,_0x15a161){return db[_0x92c7('0x65')]['findAll']({'where':{'id':_0x59a4f1[_0x92c7('0x35')][_0x92c7('0x67')]},'attributes':['id'],'include':[{'model':db[_0x92c7('0x5a')],'as':_0x92c7('0x69'),'attributes':['id'],'raw':!![]}]})[_0x92c7('0x28')](handleEntityNotFound(_0x3a3021,null))['then'](function(_0x342fbb){var _0x623cdd=_[_0x92c7('0x5c')](_0x342fbb,'id');var _0x15c836=[];var _0x1295bc=[];var _0x2790a7=squel[_0x92c7('0x73')]();_0x2790a7[_0x92c7('0x74')]('tq.TeamId')['from'](_0x92c7('0x75'),'tq')[_0x92c7('0x76')](_0x92c7('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x92c7('0x3f')](_0x92c7('0x78'),_0x59a4f1[_0x92c7('0x48')]['id']);for(var _0x2b18b9=0x0;_0x2b18b9<_0x342fbb[_0x92c7('0x3a')];_0x2b18b9+=0x1){let _0x59c797=_0x342fbb[_0x2b18b9];for(var _0x578911=0x0;_0x578911<_0x59c797[_0x92c7('0x69')][_0x92c7('0x3a')];_0x578911+=0x1){let _0x42589b=_0x59c797[_0x92c7('0x69')][_0x578911];var _0x1e70ee=_0x2790a7['clone']();_0x1e70ee[_0x92c7('0x3f')](_0x92c7('0x79'),_0x42589b['id']);_0x1295bc[_0x92c7('0x7a')](db[_0x92c7('0x6d')][_0x92c7('0x35')](_0x1e70ee['toString'](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0x92c7('0x28')](function(_0x1639e9){if(_0x1639e9[_0x92c7('0x3a')]===0x1){return _0x42589b['id'];}else{var _0x23bd05=_[_0x92c7('0x7b')](_[_0x92c7('0x5c')](_0x1639e9,_0x92c7('0x7c')),function(_0x4c4079){return _[_0x92c7('0x7d')](_0x623cdd,_0x4c4079);});if(_0x23bd05){return _0x42589b['id'];}}}));}}return BPromise[_0x92c7('0x7e')](_0x1295bc)[_0x92c7('0x28')](function(_0x2947ea){_0x15c836=_(_0x15c836)[_0x92c7('0x7f')](_0x2947ea)[_0x92c7('0x80')]()[_0x92c7('0x81')]();return db[_0x92c7('0x31')]['find']({'where':{'id':_0x59a4f1[_0x92c7('0x48')]['id']}})[_0x92c7('0x28')](function(_0x3aacb2){return db[_0x92c7('0x6d')][_0x92c7('0x6e')](function(_0x565c06){return _0x3aacb2[_0x92c7('0x72')](_0x59a4f1[_0x92c7('0x35')][_0x92c7('0x67')],{'transaction':_0x565c06})[_0x92c7('0x28')](function(){if(!_['isEmpty'](_0x15c836)){return _0x3aacb2[_0x92c7('0x82')](_0x15c836,{'transaction':_0x565c06});}})[_0x92c7('0x28')](function(){_0x15c836[_0x92c7('0x70')](function(_0x5eb3ca){socket[_0x92c7('0x71')](_0x92c7('0x83'),{'UserId':_0x5eb3ca,'SmsQueueId':_0x3aacb2['id']});});});});});});})[_0x92c7('0x28')](respondWithStatusCode(_0x3a3021,null))[_0x92c7('0x47')](handleError(_0x3a3021,null));};exports[_0x92c7('0x84')]=function(_0x3528b4,_0x4a42d8,_0x578105){return db['SmsQueue'][_0x92c7('0x4a')]({'where':{'id':_0x3528b4['params']['id']}})['then'](handleEntityNotFound(_0x4a42d8,null))[_0x92c7('0x28')](function(_0x1254e9){if(_0x1254e9){return _0x1254e9['addAgents'](_0x3528b4['body'][_0x92c7('0x67')],_[_0x92c7('0x85')](_0x3528b4[_0x92c7('0x4c')],[_0x92c7('0x67'),'id'])||{})[_0x92c7('0x86')](function(_0x201840){for(var _0x2ee2de=0x0;_0x2ee2de<_0x3528b4[_0x92c7('0x4c')][_0x92c7('0x67')]['length'];_0x2ee2de+=0x1){socket[_0x92c7('0x71')](_0x92c7('0x87'),{'UserId':_0x3528b4['body'][_0x92c7('0x67')][_0x2ee2de],'SmsQueueId':_0x3528b4[_0x92c7('0x48')]['id']});}return _0x201840;});}})[_0x92c7('0x28')](respondWithResult(_0x4a42d8,null))[_0x92c7('0x47')](handleError(_0x4a42d8,null));};exports[_0x92c7('0x82')]=function(_0x59460f,_0x273a6c,_0x2790f1){return db[_0x92c7('0x31')][_0x92c7('0x4a')]({'where':{'id':_0x59460f[_0x92c7('0x48')]['id']}})[_0x92c7('0x28')](handleEntityNotFound(_0x273a6c,null))['then'](function(_0x48eeab){if(_0x48eeab){return _0x48eeab[_0x92c7('0x82')](_0x59460f[_0x92c7('0x35')]['ids'])['then'](function(){if(_[_0x92c7('0x88')](_0x59460f['query'][_0x92c7('0x67')])){for(var _0x3afdf0=0x0;_0x3afdf0<_0x59460f[_0x92c7('0x35')][_0x92c7('0x67')]['length'];_0x3afdf0+=0x1){socket[_0x92c7('0x71')](_0x92c7('0x83'),{'UserId':Number(_0x59460f[_0x92c7('0x35')][_0x92c7('0x67')][_0x3afdf0]),'SmsQueueId':Number(_0x59460f[_0x92c7('0x48')]['id'])});}}else{socket[_0x92c7('0x71')](_0x92c7('0x83'),{'UserId':Number(_0x59460f['query'][_0x92c7('0x67')]),'SmsQueueId':Number(_0x59460f[_0x92c7('0x48')]['id'])});}});}})[_0x92c7('0x28')](respondWithStatusCode(_0x273a6c,null))['catch'](handleError(_0x273a6c,null));};exports[_0x92c7('0x89')]=function(_0x36d94c,_0xe34aa3,_0x5da3c0){var _0x4d42d5={};var _0xde833e={};var _0xf7c101;var _0x81823f;return db[_0x92c7('0x31')]['findOne']({'where':{'id':_0x36d94c[_0x92c7('0x48')]['id']}})[_0x92c7('0x28')](handleEntityNotFound(_0xe34aa3,null))[_0x92c7('0x28')](function(_0x541233){if(_0x541233){_0xf7c101=_0x541233;_0xde833e[_0x92c7('0x34')]=_['keys'](db[_0x92c7('0x5a')][_0x92c7('0x32')]);_0xde833e['query']=_[_0x92c7('0x36')](_0x36d94c[_0x92c7('0x35')]);_0xde833e['filters']=_[_0x92c7('0x37')](_0xde833e['model'],_0xde833e[_0x92c7('0x35')]);_0x4d42d5[_0x92c7('0x38')]=_[_0x92c7('0x37')](_0xde833e['model'],qs[_0x92c7('0x39')](_0x36d94c[_0x92c7('0x35')][_0x92c7('0x39')]));_0x4d42d5[_0x92c7('0x38')]=_0x4d42d5[_0x92c7('0x38')][_0x92c7('0x3a')]?_0x4d42d5[_0x92c7('0x38')]:_0xde833e['model'];_0x4d42d5[_0x92c7('0x3d')]=qs[_0x92c7('0x3e')](_0x36d94c['query'][_0x92c7('0x3e')]);_0x4d42d5[_0x92c7('0x3f')]=qs[_0x92c7('0x40')](_[_0x92c7('0x41')](_0x36d94c['query'],_0xde833e[_0x92c7('0x40')]));if(_0x36d94c[_0x92c7('0x35')][_0x92c7('0x45')]){_0x4d42d5[_0x92c7('0x3f')]=_[_0x92c7('0x42')](_0x4d42d5[_0x92c7('0x3f')],{'$or':_[_0x92c7('0x5c')](_0x4d42d5['attributes'],function(_0x42c9ab){var _0x52e948={};_0x52e948[_0x42c9ab]={'$like':'%'+_0x36d94c[_0x92c7('0x35')]['filter']+'%'};return _0x52e948;})});}_0x4d42d5=_['merge']({},_0x4d42d5,_0x36d94c[_0x92c7('0x59')]);return _0xf7c101['getAgents'](_0x4d42d5);}})['then'](function(_0x262689){if(_0x262689){_0x81823f=_0x262689['length'];if(!_0x36d94c[_0x92c7('0x35')][_0x92c7('0x58')]('nolimit')){_0x4d42d5[_0x92c7('0x3c')]=qs[_0x92c7('0x3c')](_0x36d94c[_0x92c7('0x35')][_0x92c7('0x3c')]);_0x4d42d5['offset']=qs[_0x92c7('0x22')](_0x36d94c[_0x92c7('0x35')][_0x92c7('0x22')]);}return _0xf7c101['getAgents'](_0x4d42d5);}})[_0x92c7('0x28')](function(_0xe279e7){if(_0xe279e7){return _0xe279e7?{'count':_0x81823f,'rows':_0xe279e7}:null;}})[_0x92c7('0x28')](respondWithResult(_0xe34aa3,null))[_0x92c7('0x47')](handleError(_0xe34aa3,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 2fb58a0..9aa965c 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 _0x27f2=['exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x36bf11,_0x1ea7b7){var _0x164a98=function(_0x2cd5c7){while(--_0x2cd5c7){_0x36bf11['push'](_0x36bf11['shift']());}};_0x164a98(++_0x1ea7b7);}(_0x27f2,0x6f));var _0x227f=function(_0xc7e123,_0x1fb099){_0xc7e123=_0xc7e123-0x0;var _0x5621cc=_0x27f2[_0xc7e123];return _0x5621cc;};'use strict';var EventEmitter=require(_0x227f('0x0'));var SmsQueue=require(_0x227f('0x1'))['db'][_0x227f('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x227f('0x3')](0x0);var events={'afterCreate':_0x227f('0x4'),'afterUpdate':_0x227f('0x5'),'afterDestroy':_0x227f('0x6')};function emitEvent(_0x4a166f){return function(_0x3cd131,_0x2e9ed8,_0x221473){SmsQueueEvents[_0x227f('0x7')](_0x4a166f+':'+_0x3cd131['id'],_0x3cd131);SmsQueueEvents['emit'](_0x4a166f,_0x3cd131);_0x221473(null);};}for(var e in events){if(events[_0x227f('0x8')](e)){var event=events[e];SmsQueue[_0x227f('0x9')](e,emitEvent(event));}}module[_0x227f('0xa')]=SmsQueueEvents; \ No newline at end of file +var _0x02a7=['emit','hasOwnProperty','hook','exports','events','SmsQueue','setMaxListeners','update','remove'];(function(_0x3a3437,_0xab48bd){var _0x1c7d12=function(_0x5261bf){while(--_0x5261bf){_0x3a3437['push'](_0x3a3437['shift']());}};_0x1c7d12(++_0xab48bd);}(_0x02a7,0x12d));var _0x702a=function(_0x32ca4d,_0x531319){_0x32ca4d=_0x32ca4d-0x0;var _0x3bf878=_0x02a7[_0x32ca4d];return _0x3bf878;};'use strict';var EventEmitter=require(_0x702a('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x702a('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x702a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x702a('0x3'),'afterDestroy':_0x702a('0x4')};function emitEvent(_0x12b55c){return function(_0x41e913,_0x2ce275,_0xfddcdb){SmsQueueEvents[_0x702a('0x5')](_0x12b55c+':'+_0x41e913['id'],_0x41e913);SmsQueueEvents[_0x702a('0x5')](_0x12b55c,_0x41e913);_0xfddcdb(null);};}for(var e in events){if(events[_0x702a('0x6')](e)){var event=events[e];SmsQueue[_0x702a('0x7')](e,emitEvent(event));}}module[_0x702a('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index cdbb7b9..61d4d81 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 _0x3a5e=['path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','sms_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3a5e,0x14c));var _0xe3a5=function(_0x13199e,_0x5ee6aa){_0x13199e=_0x13199e-0x0;var _0x355269=_0x3a5e[_0x13199e];return _0x355269;};'use strict';var _=require(_0xe3a5('0x0'));var util=require(_0xe3a5('0x1'));var logger=require(_0xe3a5('0x2'))(_0xe3a5('0x3'));var moment=require(_0xe3a5('0x4'));var BPromise=require(_0xe3a5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3a5('0x6'));var rimraf=require(_0xe3a5('0x7'));var config=require(_0xe3a5('0x8'));var attributes=require(_0xe3a5('0x9'));module[_0xe3a5('0xa')]=function(_0x499f61,_0x5e1507){return _0x499f61[_0xe3a5('0xb')]('SmsQueue',attributes,{'tableName':_0xe3a5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa5c=['SmsQueue','sms_queues','lodash','util','../../config/logger','api','rimraf','exports'];(function(_0x37bb41,_0x1003de){var _0x29145d=function(_0x20e9e3){while(--_0x20e9e3){_0x37bb41['push'](_0x37bb41['shift']());}};_0x29145d(++_0x1003de);}(_0xaa5c,0x1f2));var _0xcaa5=function(_0xc7f1c,_0x543944){_0xc7f1c=_0xc7f1c-0x0;var _0x334986=_0xaa5c[_0xc7f1c];return _0x334986;};'use strict';var _=require(_0xcaa5('0x0'));var util=require(_0xcaa5('0x1'));var logger=require(_0xcaa5('0x2'))(_0xcaa5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcaa5('0x4'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0xcaa5('0x5')]=function(_0x42afd4,_0x1877d0){return _0x42afd4['define'](_0xcaa5('0x6'),attributes,{'tableName':_0xcaa5('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index ad2562e..09f74a8 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 _0xb5e6=['findAll','options','where','attributes','include','map','model','catch','ShowSmsQueue','find','raw','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./smsQueue.socket','register','then','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueue,\x20%s,\x20%s','message','info','result','GetSmsQueue','SmsQueue'];(function(_0x24f326,_0x616a7){var _0x488e2d=function(_0x293d9a){while(--_0x293d9a){_0x24f326['push'](_0x24f326['shift']());}};_0x488e2d(++_0x616a7);}(_0xb5e6,0xf5));var _0x6b5e=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xb5e6[_0x432682];return _0x463d05;};'use strict';var _=require(_0x6b5e('0x0'));var util=require(_0x6b5e('0x1'));var moment=require('moment');var BPromise=require(_0x6b5e('0x2'));var rs=require(_0x6b5e('0x3'));var fs=require('fs');var Redis=require(_0x6b5e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6b5e('0x5'));var logger=require(_0x6b5e('0x6'))(_0x6b5e('0x7'));var config=require(_0x6b5e('0x8'));var jayson=require(_0x6b5e('0x9'));var client=jayson[_0x6b5e('0xa')][_0x6b5e('0xb')]({'port':0x232a});config[_0x6b5e('0xc')]=_['defaults'](config[_0x6b5e('0xc')],{'host':_0x6b5e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6b5e('0xe'))[_0x6b5e('0xf')](socket);function respondWithRpcPromise(_0x21eb83,_0x1d9ac5,_0x1b19bc){return new BPromise(function(_0x3f83bd,_0x1c5cbb){return client['request'](_0x21eb83,_0x1b19bc)[_0x6b5e('0x10')](function(_0x251d66){logger['info']('SmsQueue,\x20%s,\x20%s',_0x1d9ac5,_0x6b5e('0x11'));logger[_0x6b5e('0x12')](_0x6b5e('0x13'),_0x1d9ac5,_0x6b5e('0x11'),JSON[_0x6b5e('0x14')](_0x251d66));if(_0x251d66[_0x6b5e('0x15')]){if(_0x251d66['error']['code']===0x1f4){logger['error'](_0x6b5e('0x16'),_0x1d9ac5,_0x251d66[_0x6b5e('0x15')][_0x6b5e('0x17')]);return _0x1c5cbb(_0x251d66[_0x6b5e('0x15')][_0x6b5e('0x17')]);}logger['error'](_0x6b5e('0x16'),_0x1d9ac5,_0x251d66[_0x6b5e('0x15')][_0x6b5e('0x17')]);return _0x3f83bd(_0x251d66['error'][_0x6b5e('0x17')]);}else{logger[_0x6b5e('0x18')](_0x6b5e('0x16'),_0x1d9ac5,'request\x20sent');_0x3f83bd(_0x251d66[_0x6b5e('0x19')]['message']);}})['catch'](function(_0x5e5e5c){logger[_0x6b5e('0x15')](_0x6b5e('0x16'),_0x1d9ac5,_0x5e5e5c);_0x1c5cbb(_0x5e5e5c);});});}exports[_0x6b5e('0x1a')]=function(_0x65f553){var _0x4f6944=this;return new Promise(function(_0x1f83f0,_0x339edc){return db[_0x6b5e('0x1b')][_0x6b5e('0x1c')]({'raw':_0x65f553['options']?_0x65f553[_0x6b5e('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x65f553[_0x6b5e('0x1d')]?_0x65f553[_0x6b5e('0x1d')][_0x6b5e('0x1e')]||null:null,'attributes':_0x65f553['options']?_0x65f553['options'][_0x6b5e('0x1f')]||null:null,'limit':_0x65f553[_0x6b5e('0x1d')]?_0x65f553[_0x6b5e('0x1d')]['limit']||null:null,'include':_0x65f553[_0x6b5e('0x1d')]?_0x65f553[_0x6b5e('0x1d')][_0x6b5e('0x20')]?_[_0x6b5e('0x21')](_0x65f553[_0x6b5e('0x1d')][_0x6b5e('0x20')],function(_0x400827){return{'model':db[_0x400827[_0x6b5e('0x22')]],'as':_0x400827['as'],'attributes':_0x400827[_0x6b5e('0x1f')],'include':_0x400827[_0x6b5e('0x20')]?_[_0x6b5e('0x21')](_0x400827['include'],function(_0x4a3c30){return{'model':db[_0x4a3c30['model']],'as':_0x4a3c30['as'],'attributes':_0x4a3c30[_0x6b5e('0x1f')],'include':_0x4a3c30[_0x6b5e('0x20')]?_[_0x6b5e('0x21')](_0x4a3c30[_0x6b5e('0x20')],function(_0x36dec7){return{'model':db[_0x36dec7[_0x6b5e('0x22')]],'as':_0x36dec7['as'],'attributes':_0x36dec7[_0x6b5e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6b5e('0x10')](function(_0x5471f1){logger[_0x6b5e('0x18')](_0x6b5e('0x1a'),_0x65f553);logger[_0x6b5e('0x12')](_0x6b5e('0x1a'),_0x65f553,JSON[_0x6b5e('0x14')](_0x5471f1));_0x1f83f0(_0x5471f1);})[_0x6b5e('0x23')](function(_0x5a7619){logger[_0x6b5e('0x15')](_0x6b5e('0x1a'),_0x5a7619['message'],_0x65f553);_0x339edc(_0x4f6944[_0x6b5e('0x15')](0x1f4,_0x5a7619[_0x6b5e('0x17')]));});});};exports[_0x6b5e('0x24')]=function(_0x5aaeac){var _0x9d2649=this;return new Promise(function(_0x2d8de6,_0x2efb93){return db[_0x6b5e('0x1b')][_0x6b5e('0x25')]({'raw':_0x5aaeac[_0x6b5e('0x1d')]?_0x5aaeac['options'][_0x6b5e('0x26')]===undefined?!![]:![]:!![],'where':_0x5aaeac[_0x6b5e('0x1d')]?_0x5aaeac[_0x6b5e('0x1d')][_0x6b5e('0x1e')]||null:null,'attributes':_0x5aaeac[_0x6b5e('0x1d')]?_0x5aaeac[_0x6b5e('0x1d')][_0x6b5e('0x1f')]||null:null,'include':_0x5aaeac[_0x6b5e('0x1d')]?_0x5aaeac['options'][_0x6b5e('0x20')]?_[_0x6b5e('0x21')](_0x5aaeac[_0x6b5e('0x1d')][_0x6b5e('0x20')],function(_0x5af1ad){return{'model':db[_0x5af1ad[_0x6b5e('0x22')]],'as':_0x5af1ad['as'],'attributes':_0x5af1ad[_0x6b5e('0x1f')],'include':_0x5af1ad[_0x6b5e('0x20')]?_[_0x6b5e('0x21')](_0x5af1ad[_0x6b5e('0x20')],function(_0x369129){return{'model':db[_0x369129[_0x6b5e('0x22')]],'as':_0x369129['as'],'attributes':_0x369129[_0x6b5e('0x1f')],'include':_0x369129[_0x6b5e('0x20')]?_[_0x6b5e('0x21')](_0x369129[_0x6b5e('0x20')],function(_0x5165bc){return{'model':db[_0x5165bc['model']],'as':_0x5165bc['as'],'attributes':_0x5165bc[_0x6b5e('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x364733){logger[_0x6b5e('0x18')](_0x6b5e('0x24'),_0x5aaeac);logger['debug']('ShowSmsQueue',_0x5aaeac,JSON[_0x6b5e('0x14')](_0x364733));_0x2d8de6(_0x364733);})[_0x6b5e('0x23')](function(_0x3e8022){logger[_0x6b5e('0x15')](_0x6b5e('0x24'),_0x3e8022['message'],_0x5aaeac);_0x2efb93(_0x9d2649['error'](0x1f4,_0x3e8022[_0x6b5e('0x17')]));});});}; \ No newline at end of file +var _0xe0e6=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','raw','options','attributes','limit','include','map','model','ShowSmsQueue','find','where'];(function(_0x20895e,_0x2ddef4){var _0x9c898e=function(_0x27830d){while(--_0x27830d){_0x20895e['push'](_0x20895e['shift']());}};_0x9c898e(++_0x2ddef4);}(_0xe0e6,0x1c3));var _0x6e0e=function(_0x479fca,_0x5466c5){_0x479fca=_0x479fca-0x0;var _0x5f0526=_0xe0e6[_0x479fca];return _0x5f0526;};'use strict';var _=require('lodash');var util=require(_0x6e0e('0x0'));var moment=require(_0x6e0e('0x1'));var BPromise=require(_0x6e0e('0x2'));var rs=require(_0x6e0e('0x3'));var fs=require('fs');var Redis=require(_0x6e0e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6e0e('0x5'));var logger=require(_0x6e0e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6e0e('0x7'));var client=jayson[_0x6e0e('0x8')][_0x6e0e('0x9')]({'port':0x232a});config[_0x6e0e('0xa')]=_[_0x6e0e('0xb')](config[_0x6e0e('0xa')],{'host':_0x6e0e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6e0e('0xa')]));require(_0x6e0e('0xd'))[_0x6e0e('0xe')](socket);function respondWithRpcPromise(_0x521493,_0x4858f3,_0x4e9651){return new BPromise(function(_0x1ce908,_0x636da4){return client[_0x6e0e('0xf')](_0x521493,_0x4e9651)[_0x6e0e('0x10')](function(_0x35709a){logger[_0x6e0e('0x11')](_0x6e0e('0x12'),_0x4858f3,_0x6e0e('0x13'));logger[_0x6e0e('0x14')](_0x6e0e('0x15'),_0x4858f3,_0x6e0e('0x13'),JSON[_0x6e0e('0x16')](_0x35709a));if(_0x35709a[_0x6e0e('0x17')]){if(_0x35709a[_0x6e0e('0x17')][_0x6e0e('0x18')]===0x1f4){logger[_0x6e0e('0x17')](_0x6e0e('0x12'),_0x4858f3,_0x35709a[_0x6e0e('0x17')]['message']);return _0x636da4(_0x35709a['error'][_0x6e0e('0x19')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x4858f3,_0x35709a[_0x6e0e('0x17')][_0x6e0e('0x19')]);return _0x1ce908(_0x35709a['error']['message']);}else{logger[_0x6e0e('0x11')](_0x6e0e('0x12'),_0x4858f3,_0x6e0e('0x13'));_0x1ce908(_0x35709a[_0x6e0e('0x1a')]['message']);}})[_0x6e0e('0x1b')](function(_0x2770ff){logger[_0x6e0e('0x17')](_0x6e0e('0x12'),_0x4858f3,_0x2770ff);_0x636da4(_0x2770ff);});});}exports[_0x6e0e('0x1c')]=function(_0xfb86c6){var _0x3799f3=this;return new Promise(function(_0x4dd8e0,_0x4f6744){return db[_0x6e0e('0x1d')][_0x6e0e('0x1e')]({'raw':_0xfb86c6['options']?_0xfb86c6['options'][_0x6e0e('0x1f')]===undefined?!![]:![]:!![],'where':_0xfb86c6[_0x6e0e('0x20')]?_0xfb86c6[_0x6e0e('0x20')]['where']||null:null,'attributes':_0xfb86c6['options']?_0xfb86c6[_0x6e0e('0x20')][_0x6e0e('0x21')]||null:null,'limit':_0xfb86c6[_0x6e0e('0x20')]?_0xfb86c6[_0x6e0e('0x20')][_0x6e0e('0x22')]||null:null,'include':_0xfb86c6[_0x6e0e('0x20')]?_0xfb86c6[_0x6e0e('0x20')][_0x6e0e('0x23')]?_[_0x6e0e('0x24')](_0xfb86c6[_0x6e0e('0x20')][_0x6e0e('0x23')],function(_0x42b50c){return{'model':db[_0x42b50c['model']],'as':_0x42b50c['as'],'attributes':_0x42b50c['attributes'],'include':_0x42b50c[_0x6e0e('0x23')]?_[_0x6e0e('0x24')](_0x42b50c[_0x6e0e('0x23')],function(_0x1e2cad){return{'model':db[_0x1e2cad['model']],'as':_0x1e2cad['as'],'attributes':_0x1e2cad[_0x6e0e('0x21')],'include':_0x1e2cad[_0x6e0e('0x23')]?_[_0x6e0e('0x24')](_0x1e2cad[_0x6e0e('0x23')],function(_0x4a4ac9){return{'model':db[_0x4a4ac9[_0x6e0e('0x25')]],'as':_0x4a4ac9['as'],'attributes':_0x4a4ac9[_0x6e0e('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d49c6){logger[_0x6e0e('0x11')](_0x6e0e('0x1c'),_0xfb86c6);logger[_0x6e0e('0x14')](_0x6e0e('0x1c'),_0xfb86c6,JSON[_0x6e0e('0x16')](_0x4d49c6));_0x4dd8e0(_0x4d49c6);})[_0x6e0e('0x1b')](function(_0x31b1e3){logger[_0x6e0e('0x17')]('GetSmsQueue',_0x31b1e3['message'],_0xfb86c6);_0x4f6744(_0x3799f3['error'](0x1f4,_0x31b1e3[_0x6e0e('0x19')]));});});};exports[_0x6e0e('0x26')]=function(_0x3fe0d0){var _0x1278cd=this;return new Promise(function(_0x33e21f,_0x120660){return db[_0x6e0e('0x1d')][_0x6e0e('0x27')]({'raw':_0x3fe0d0['options']?_0x3fe0d0[_0x6e0e('0x20')][_0x6e0e('0x1f')]===undefined?!![]:![]:!![],'where':_0x3fe0d0[_0x6e0e('0x20')]?_0x3fe0d0['options'][_0x6e0e('0x28')]||null:null,'attributes':_0x3fe0d0[_0x6e0e('0x20')]?_0x3fe0d0[_0x6e0e('0x20')][_0x6e0e('0x21')]||null:null,'include':_0x3fe0d0[_0x6e0e('0x20')]?_0x3fe0d0[_0x6e0e('0x20')][_0x6e0e('0x23')]?_[_0x6e0e('0x24')](_0x3fe0d0[_0x6e0e('0x20')]['include'],function(_0x2631ab){return{'model':db[_0x2631ab[_0x6e0e('0x25')]],'as':_0x2631ab['as'],'attributes':_0x2631ab['attributes'],'include':_0x2631ab[_0x6e0e('0x23')]?_[_0x6e0e('0x24')](_0x2631ab[_0x6e0e('0x23')],function(_0x3603ba){return{'model':db[_0x3603ba[_0x6e0e('0x25')]],'as':_0x3603ba['as'],'attributes':_0x3603ba[_0x6e0e('0x21')],'include':_0x3603ba['include']?_[_0x6e0e('0x24')](_0x3603ba[_0x6e0e('0x23')],function(_0x3362ab){return{'model':db[_0x3362ab[_0x6e0e('0x25')]],'as':_0x3362ab['as'],'attributes':_0x3362ab[_0x6e0e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6e0e('0x10')](function(_0x37ff63){logger[_0x6e0e('0x11')](_0x6e0e('0x26'),_0x3fe0d0);logger[_0x6e0e('0x14')](_0x6e0e('0x26'),_0x3fe0d0,JSON[_0x6e0e('0x16')](_0x37ff63));_0x33e21f(_0x37ff63);})['catch'](function(_0x9a6e64){logger['error'](_0x6e0e('0x26'),_0x9a6e64[_0x6e0e('0x19')],_0x3fe0d0);_0x120660(_0x1278cd[_0x6e0e('0x17')](0x1f4,_0x9a6e64[_0x6e0e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index dd234c3..a0664ed 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 _0x8695=['length','smsQueue:','./smsQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x18631f,_0x286206){var _0x59b62c=function(_0x728bf3){while(--_0x728bf3){_0x18631f['push'](_0x18631f['shift']());}};_0x59b62c(++_0x286206);}(_0x8695,0x12b));var _0x5869=function(_0x3fa7d3,_0x37f83c){_0x3fa7d3=_0x3fa7d3-0x0;var _0x4c51bd=_0x8695[_0x3fa7d3];return _0x4c51bd;};'use strict';var SmsQueueEvents=require(_0x5869('0x0'));var events=[_0x5869('0x1'),_0x5869('0x2'),_0x5869('0x3')];function createListener(_0x1f60de,_0x3b2410){return function(_0x2f2887){_0x3b2410[_0x5869('0x4')](_0x1f60de,_0x2f2887);};}function removeListener(_0x5d5080,_0x3d79ca){return function(){SmsQueueEvents[_0x5869('0x5')](_0x5d5080,_0x3d79ca);};}exports[_0x5869('0x6')]=function(_0x38b92e){for(var _0x3c7c09=0x0,_0x30fe3c=events[_0x5869('0x7')];_0x3c7c09<_0x30fe3c;_0x3c7c09++){var _0x232208=events[_0x3c7c09];var _0x5708f6=createListener(_0x5869('0x8')+_0x232208,_0x38b92e);SmsQueueEvents['on'](_0x232208,_0x5708f6);}}; \ No newline at end of file +var _0xbb35=['./smsQueue.events','remove','update','removeListener','length','smsQueue:'];(function(_0x536020,_0x3fef24){var _0x44587d=function(_0x29cb49){while(--_0x29cb49){_0x536020['push'](_0x536020['shift']());}};_0x44587d(++_0x3fef24);}(_0xbb35,0x1e6));var _0x5bb3=function(_0x195949,_0x54817f){_0x195949=_0x195949-0x0;var _0x10b08d=_0xbb35[_0x195949];return _0x10b08d;};'use strict';var SmsQueueEvents=require(_0x5bb3('0x0'));var events=['save',_0x5bb3('0x1'),_0x5bb3('0x2')];function createListener(_0x162a0f,_0x2e026a){return function(_0x1f751d){_0x2e026a['emit'](_0x162a0f,_0x1f751d);};}function removeListener(_0x337f40,_0x24b9c0){return function(){SmsQueueEvents[_0x5bb3('0x3')](_0x337f40,_0x24b9c0);};}exports['register']=function(_0x1a71fb){for(var _0x384baf=0x0,_0x3489d6=events[_0x5bb3('0x4')];_0x384baf<_0x3489d6;_0x384baf++){var _0x3f26ec=events[_0x384baf];var _0x2aed9c=createListener(_0x5bb3('0x5')+_0x3f26ec,_0x1a71fb);SmsQueueEvents['on'](_0x3f26ec,_0x2aed9c);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index e0259df..d79ae45 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 _0x6c4f=['../../config/environment','./smsQueueReport.controller','index','get','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xbc4f4,_0x415333){var _0x7c988a=function(_0x19de63){while(--_0x19de63){_0xbc4f4['push'](_0xbc4f4['shift']());}};_0x7c988a(++_0x415333);}(_0x6c4f,0x168));var _0xf6c4=function(_0x374154,_0x174ddb){_0x374154=_0x374154-0x0;var _0x275e99=_0x6c4f[_0x374154];return _0x275e99;};'use strict';var multer=require(_0xf6c4('0x0'));var util=require(_0xf6c4('0x1'));var path=require(_0xf6c4('0x2'));var timeout=require(_0xf6c4('0x3'));var express=require(_0xf6c4('0x4'));var router=express[_0xf6c4('0x5')]();var auth=require(_0xf6c4('0x6'));var interaction=require(_0xf6c4('0x7'));var config=require(_0xf6c4('0x8'));var controller=require(_0xf6c4('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf6c4('0xa')]);router[_0xf6c4('0xb')](_0xf6c4('0xc'),auth[_0xf6c4('0xd')](),controller[_0xf6c4('0xe')]);router['get'](_0xf6c4('0xf'),auth[_0xf6c4('0xd')](),controller['show']);router[_0xf6c4('0x10')]('/',auth[_0xf6c4('0xd')](),controller[_0xf6c4('0x11')]);router[_0xf6c4('0x12')](_0xf6c4('0xf'),auth[_0xf6c4('0xd')](),controller[_0xf6c4('0x13')]);router[_0xf6c4('0x14')](_0xf6c4('0xf'),auth[_0xf6c4('0xd')](),controller[_0xf6c4('0x15')]);module[_0xf6c4('0x16')]=router; \ No newline at end of file +var _0x287d=['get','index','/:id','isAuthenticated','create','put','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller'];(function(_0x4f9c38,_0x34e26d){var _0x68edb3=function(_0x496c4f){while(--_0x496c4f){_0x4f9c38['push'](_0x4f9c38['shift']());}};_0x68edb3(++_0x34e26d);}(_0x287d,0x198));var _0xd287=function(_0x5d340a,_0x2441da){_0x5d340a=_0x5d340a-0x0;var _0x435564=_0x287d[_0x5d340a];return _0x435564;};'use strict';var multer=require('multer');var util=require(_0xd287('0x0'));var path=require(_0xd287('0x1'));var timeout=require(_0xd287('0x2'));var express=require('express');var router=express[_0xd287('0x3')]();var auth=require(_0xd287('0x4'));var interaction=require(_0xd287('0x5'));var config=require(_0xd287('0x6'));var controller=require(_0xd287('0x7'));router[_0xd287('0x8')]('/',auth['isAuthenticated'](),controller[_0xd287('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xd287('0x8')](_0xd287('0xa'),auth[_0xd287('0xb')](),controller['show']);router['post']('/',auth[_0xd287('0xb')](),controller[_0xd287('0xc')]);router[_0xd287('0xd')](_0xd287('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xd287('0xe')](_0xd287('0xa'),auth[_0xd287('0xb')](),controller[_0xd287('0xf')]);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 b478790..4c0caed 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 _0xfca8=['DATE','moment','sequelize','exports','STRING'];(function(_0x22ae6b,_0x37caa3){var _0x5d7551=function(_0x29a18f){while(--_0x29a18f){_0x22ae6b['push'](_0x22ae6b['shift']());}};_0x5d7551(++_0x37caa3);}(_0xfca8,0x10a));var _0x8fca=function(_0x387765,_0x1eec4a){_0x387765=_0x387765-0x0;var _0x3846c6=_0xfca8[_0x387765];return _0x3846c6;};'use strict';var moment=require(_0x8fca('0x0'));var Sequelize=require(_0x8fca('0x1'));module[_0x8fca('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x8fca('0x3')]},'joinAt':{'type':Sequelize[_0x8fca('0x4')]},'leaveAt':{'type':Sequelize[_0x8fca('0x4')]},'acceptAt':{'type':Sequelize[_0x8fca('0x4')]},'exitAt':{'type':Sequelize[_0x8fca('0x4')]},'reason':{'type':Sequelize[_0x8fca('0x3')]}}; \ No newline at end of file +var _0x2314=['DATE','sequelize','exports','STRING'];(function(_0x308106,_0x40d8c4){var _0x21caaf=function(_0xb8ede9){while(--_0xb8ede9){_0x308106['push'](_0x308106['shift']());}};_0x21caaf(++_0x40d8c4);}(_0x2314,0x1d5));var _0x4231=function(_0x2a276d,_0x482b0c){_0x2a276d=_0x2a276d-0x0;var _0x2914cd=_0x2314[_0x2a276d];return _0x2914cd;};'use strict';var moment=require('moment');var Sequelize=require(_0x4231('0x0'));module[_0x4231('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x4231('0x2')]},'joinAt':{'type':Sequelize[_0x4231('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x4231('0x3')]},'exitAt':{'type':Sequelize[_0x4231('0x3')]},'reason':{'type':Sequelize[_0x4231('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index cd9874c..41ac1de 100644 --- a/server/api/smsQueueReport/smsQueueReport.controller.js +++ b/server/api/smsQueueReport/smsQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['index','map','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','SmsQueueReport','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send'];(function(_0x14d4d5,_0x3c298e){var _0x516cf5=function(_0x10a2f6){while(--_0x10a2f6){_0x14d4d5['push'](_0x14d4d5['shift']());}};_0x516cf5(++_0x3c298e);}(_0x814b,0x1a2));var _0xb814=function(_0x5180c3,_0x4b35f7){_0x5180c3=_0x5180c3-0x0;var _0x55c975=_0x814b[_0x5180c3];return _0x55c975;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var db=require(_0xb814('0x19'))['db'];function respondWithStatusCode(_0x15d6ef,_0x35b10d){_0x35b10d=_0x35b10d||0xcc;return function(_0x2cc46b){if(_0x2cc46b){return _0x15d6ef[_0xb814('0x1a')](_0x35b10d);}return _0x15d6ef[_0xb814('0x1b')](_0x35b10d)[_0xb814('0x1c')]();};}function respondWithResult(_0x41ed7b,_0xa0a2e5){_0xa0a2e5=_0xa0a2e5||0xc8;return function(_0x2ab627){if(_0x2ab627){return _0x41ed7b[_0xb814('0x1b')](_0xa0a2e5)[_0xb814('0x1d')](_0x2ab627);}};}function respondWithFilteredResult(_0x17f5bd,_0x39bfcf){return function(_0x303aca){if(_0x303aca){var _0x3a71d6=_0x303aca[_0xb814('0x1e')],_0x45e0d0=_0x39bfcf[_0xb814('0x1f')],_0x265a83=_0x39bfcf['offset']+_0x39bfcf[_0xb814('0x20')],_0x125ce2;if(_0x265a83>=_0x3a71d6){_0x265a83=_0x3a71d6;_0x125ce2=0xc8;}else{_0x125ce2=0xce;}_0x17f5bd['status'](_0x125ce2);return _0x17f5bd[_0xb814('0x21')](_0xb814('0x22'),_0x45e0d0+'-'+_0x265a83+'/'+_0x3a71d6)['json'](_0x303aca);}return null;};}function patchUpdates(_0x4b55a7){return function(_0x55d63c){try{jsonpatch[_0xb814('0x23')](_0x55d63c,_0x4b55a7,!![]);}catch(_0x4d5276){return BPromise['reject'](_0x4d5276);}return _0x55d63c[_0xb814('0x24')]();};}function saveUpdates(_0x24211d,_0x25b6b6){return function(_0x4e139e){if(_0x4e139e){return _0x4e139e[_0xb814('0x25')](_0x24211d)['then'](function(_0x1e6393){return _0x1e6393;});}return null;};}function removeEntity(_0x1808a3,_0x3b267e){return function(_0x470e81){if(_0x470e81){return _0x470e81[_0xb814('0x26')]()[_0xb814('0x27')](function(){_0x1808a3[_0xb814('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(!_0x3f81d0){_0x2ead86[_0xb814('0x1a')](0x194);}return _0x3f81d0;};}function handleError(_0x31c7ec,_0x208927){_0x208927=_0x208927||0x1f4;return function(_0x1c8a2e){logger[_0xb814('0x28')](_0x1c8a2e[_0xb814('0x29')]);if(_0x1c8a2e['name']){delete _0x1c8a2e[_0xb814('0x2a')];}_0x31c7ec[_0xb814('0x1b')](_0x208927)[_0xb814('0x2b')](_0x1c8a2e);};}exports[_0xb814('0x2c')]=function(_0x32ed56,_0x1d5965){var _0x3f0150={},_0x1e4e89={},_0x5a6291={'count':0x0,'rows':[]};var _0x271aa8=_[_0xb814('0x2d')](db['SmsQueueReport'][_0xb814('0x2e')],function(_0x37d24d){return{'name':_0x37d24d[_0xb814('0x2f')],'type':_0x37d24d['type'][_0xb814('0x30')]};});_0x1e4e89[_0xb814('0x31')]=_['map'](_0x271aa8,_0xb814('0x2a'));_0x1e4e89['query']=_[_0xb814('0x32')](_0x32ed56['query']);_0x1e4e89['filters']=_[_0xb814('0x33')](_0x1e4e89['model'],_0x1e4e89[_0xb814('0x34')]);_0x3f0150[_0xb814('0x35')]=_[_0xb814('0x33')](_0x1e4e89['model'],qs['fields'](_0x32ed56[_0xb814('0x34')][_0xb814('0x36')]));_0x3f0150['attributes']=_0x3f0150[_0xb814('0x35')][_0xb814('0x37')]?_0x3f0150[_0xb814('0x35')]:_0x1e4e89[_0xb814('0x31')];if(!_0x32ed56[_0xb814('0x34')][_0xb814('0x38')](_0xb814('0x39'))){_0x3f0150['limit']=qs[_0xb814('0x20')](_0x32ed56[_0xb814('0x34')][_0xb814('0x20')]);_0x3f0150[_0xb814('0x1f')]=qs[_0xb814('0x1f')](_0x32ed56['query'][_0xb814('0x1f')]);}_0x3f0150['order']=qs[_0xb814('0x3a')](_0x32ed56[_0xb814('0x34')][_0xb814('0x3a')]);_0x3f0150['where']=qs[_0xb814('0x3b')](_[_0xb814('0x3c')](_0x32ed56['query'],_0x1e4e89[_0xb814('0x3b')]),_0x271aa8);if(_0x32ed56[_0xb814('0x34')][_0xb814('0x3d')]){_0x3f0150[_0xb814('0x3e')]=_[_0xb814('0x3f')](_0x3f0150[_0xb814('0x3e')],{'$or':_['map'](_0x271aa8,function(_0xa6ce87){if(_0xa6ce87['type']!==_0xb814('0x40')){var _0x4b5583={};_0x4b5583[_0xa6ce87[_0xb814('0x2a')]]={'$like':'%'+_0x32ed56['query'][_0xb814('0x3d')]+'%'};return _0x4b5583;}})});}_0x3f0150=_[_0xb814('0x3f')]({},_0x3f0150,_0x32ed56['options']);var _0x4d308a={'where':_0x3f0150['where']};return db['SmsQueueReport'][_0xb814('0x1e')](_0x4d308a)[_0xb814('0x27')](function(_0x38cdc2){_0x5a6291[_0xb814('0x1e')]=_0x38cdc2;if(_0x32ed56['query']['includeAll']){_0x3f0150[_0xb814('0x41')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xb814('0x42')](_0x3f0150);})[_0xb814('0x27')](function(_0x178823){_0x5a6291[_0xb814('0x43')]=_0x178823;return _0x5a6291;})[_0xb814('0x27')](respondWithFilteredResult(_0x1d5965,_0x3f0150))[_0xb814('0x44')](handleError(_0x1d5965,null));};exports[_0xb814('0x45')]=function(_0x28b2b4,_0x31989d){var _0x4b6ff8={'raw':!![],'where':{'id':_0x28b2b4['params']['id']}},_0x544d36={};_0x544d36[_0xb814('0x31')]=_['keys'](db[_0xb814('0x46')]['rawAttributes']);_0x544d36[_0xb814('0x34')]=_[_0xb814('0x32')](_0x28b2b4[_0xb814('0x34')]);_0x544d36[_0xb814('0x3b')]=_['intersection'](_0x544d36[_0xb814('0x31')],_0x544d36[_0xb814('0x34')]);_0x4b6ff8[_0xb814('0x35')]=_[_0xb814('0x33')](_0x544d36[_0xb814('0x31')],qs[_0xb814('0x36')](_0x28b2b4['query'][_0xb814('0x36')]));_0x4b6ff8[_0xb814('0x35')]=_0x4b6ff8[_0xb814('0x35')][_0xb814('0x37')]?_0x4b6ff8[_0xb814('0x35')]:_0x544d36[_0xb814('0x31')];if(_0x28b2b4[_0xb814('0x34')]['includeAll']){_0x4b6ff8['include']=[{'all':!![]}];}_0x4b6ff8=_[_0xb814('0x3f')]({},_0x4b6ff8,_0x28b2b4[_0xb814('0x47')]);return db[_0xb814('0x46')][_0xb814('0x48')](_0x4b6ff8)[_0xb814('0x27')](handleEntityNotFound(_0x31989d,null))[_0xb814('0x27')](respondWithResult(_0x31989d,null))[_0xb814('0x44')](handleError(_0x31989d,null));};exports[_0xb814('0x49')]=function(_0x2eb9b6,_0x344198){return db[_0xb814('0x46')]['create'](_0x2eb9b6[_0xb814('0x4a')],{})[_0xb814('0x27')](respondWithResult(_0x344198,0xc9))['catch'](handleError(_0x344198,null));};exports[_0xb814('0x25')]=function(_0x55234d,_0x2fb0f7){if(_0x55234d[_0xb814('0x4a')]['id']){delete _0x55234d[_0xb814('0x4a')]['id'];}return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x55234d[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x2fb0f7,null))[_0xb814('0x27')](saveUpdates(_0x55234d[_0xb814('0x4a')],null))[_0xb814('0x27')](respondWithResult(_0x2fb0f7,null))['catch'](handleError(_0x2fb0f7,null));};exports['destroy']=function(_0x32eca6,_0x30f07b){return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x32eca6[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x30f07b,null))[_0xb814('0x27')](removeEntity(_0x30f07b,null))['catch'](handleError(_0x30f07b,null));};exports[_0xb814('0x4c')]=function(_0x388324,_0xf27a6e){return db['SmsQueueReport'][_0xb814('0x4c')]()['then'](respondWithResult(_0xf27a6e,null))[_0xb814('0x44')](handleError(_0xf27a6e,null));}; \ No newline at end of file +var _0x3e74=['save','update','then','destroy','stack','name','send','index','map','SmsQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','limit','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','count','offset','status','set','Content-Range','json','apply','reject'];(function(_0x6c5509,_0x2f25a7){var _0xe0ca1=function(_0x3399a6){while(--_0x3399a6){_0x6c5509['push'](_0x6c5509['shift']());}};_0xe0ca1(++_0x2f25a7);}(_0x3e74,0x175));var _0x43e7=function(_0x27dd68,_0x11a2fb){_0x27dd68=_0x27dd68-0x0;var _0x44a155=_0x3e74[_0x27dd68];return _0x44a155;};'use strict';var pdf=require(_0x43e7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x43e7('0x1'));var zipdir=require(_0x43e7('0x2'));var jsonpatch=require(_0x43e7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x43e7('0x4'));var Mustache=require('mustache');var util=require(_0x43e7('0x5'));var path=require(_0x43e7('0x6'));var sox=require(_0x43e7('0x7'));var csv=require(_0x43e7('0x8'));var ejs=require(_0x43e7('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x8'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3eb206,_0xc960ea){_0xc960ea=_0xc960ea||0xcc;return function(_0x2718d3){if(_0x2718d3){return _0x3eb206[_0x43e7('0x14')](_0xc960ea);}return _0x3eb206['status'](_0xc960ea)['end']();};}function respondWithResult(_0x2fcb36,_0x21fdd3){_0x21fdd3=_0x21fdd3||0xc8;return function(_0x44b0bd){if(_0x44b0bd){return _0x2fcb36['status'](_0x21fdd3)['json'](_0x44b0bd);}};}function respondWithFilteredResult(_0x16849c,_0x14c146){return function(_0x203378){if(_0x203378){var _0x328445=_0x203378[_0x43e7('0x15')],_0x4de324=_0x14c146[_0x43e7('0x16')],_0x5c4eaa=_0x14c146['offset']+_0x14c146['limit'],_0xdf16c;if(_0x5c4eaa>=_0x328445){_0x5c4eaa=_0x328445;_0xdf16c=0xc8;}else{_0xdf16c=0xce;}_0x16849c[_0x43e7('0x17')](_0xdf16c);return _0x16849c[_0x43e7('0x18')](_0x43e7('0x19'),_0x4de324+'-'+_0x5c4eaa+'/'+_0x328445)[_0x43e7('0x1a')](_0x203378);}return null;};}function patchUpdates(_0x3776f5){return function(_0x1f24fb){try{jsonpatch[_0x43e7('0x1b')](_0x1f24fb,_0x3776f5,!![]);}catch(_0x1441ef){return BPromise[_0x43e7('0x1c')](_0x1441ef);}return _0x1f24fb[_0x43e7('0x1d')]();};}function saveUpdates(_0x191dd5,_0x177ee1){return function(_0x4b5d64){if(_0x4b5d64){return _0x4b5d64[_0x43e7('0x1e')](_0x191dd5)[_0x43e7('0x1f')](function(_0x4b386b){return _0x4b386b;});}return null;};}function removeEntity(_0x2898b5,_0x3e281e){return function(_0x3945bb){if(_0x3945bb){return _0x3945bb[_0x43e7('0x20')]()[_0x43e7('0x1f')](function(){_0x2898b5[_0x43e7('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x454359,_0x4eea52){return function(_0x4c9df3){if(!_0x4c9df3){_0x454359[_0x43e7('0x14')](0x194);}return _0x4c9df3;};}function handleError(_0x43f4ff,_0x4b2b9f){_0x4b2b9f=_0x4b2b9f||0x1f4;return function(_0x1f0673){logger['error'](_0x1f0673[_0x43e7('0x21')]);if(_0x1f0673['name']){delete _0x1f0673[_0x43e7('0x22')];}_0x43f4ff[_0x43e7('0x17')](_0x4b2b9f)[_0x43e7('0x23')](_0x1f0673);};}exports[_0x43e7('0x24')]=function(_0x51f4d7,_0x52b7b3){var _0x805b54={},_0x501551={},_0x2dd5f={'count':0x0,'rows':[]};var _0x40dc8f=_[_0x43e7('0x25')](db[_0x43e7('0x26')]['rawAttributes'],function(_0x33a1a5){return{'name':_0x33a1a5[_0x43e7('0x27')],'type':_0x33a1a5[_0x43e7('0x28')][_0x43e7('0x29')]};});_0x501551[_0x43e7('0x2a')]=_[_0x43e7('0x25')](_0x40dc8f,_0x43e7('0x22'));_0x501551[_0x43e7('0x2b')]=_[_0x43e7('0x2c')](_0x51f4d7[_0x43e7('0x2b')]);_0x501551[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](_0x501551[_0x43e7('0x2a')],_0x501551[_0x43e7('0x2b')]);_0x805b54['attributes']=_[_0x43e7('0x2e')](_0x501551[_0x43e7('0x2a')],qs[_0x43e7('0x2f')](_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x2f')]));_0x805b54['attributes']=_0x805b54[_0x43e7('0x30')][_0x43e7('0x31')]?_0x805b54[_0x43e7('0x30')]:_0x501551[_0x43e7('0x2a')];if(!_0x51f4d7['query']['hasOwnProperty']('nolimit')){_0x805b54[_0x43e7('0x32')]=qs[_0x43e7('0x32')](_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x32')]);_0x805b54[_0x43e7('0x16')]=qs[_0x43e7('0x16')](_0x51f4d7['query']['offset']);}_0x805b54['order']=qs['sort'](_0x51f4d7['query']['sort']);_0x805b54['where']=qs[_0x43e7('0x2d')](_['pick'](_0x51f4d7[_0x43e7('0x2b')],_0x501551[_0x43e7('0x2d')]),_0x40dc8f);if(_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x33')]){_0x805b54[_0x43e7('0x34')]=_[_0x43e7('0x35')](_0x805b54[_0x43e7('0x34')],{'$or':_['map'](_0x40dc8f,function(_0x5332d9){if(_0x5332d9['type']!==_0x43e7('0x36')){var _0xfe70e9={};_0xfe70e9[_0x5332d9[_0x43e7('0x22')]]={'$like':'%'+_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x33')]+'%'};return _0xfe70e9;}})});}_0x805b54=_[_0x43e7('0x35')]({},_0x805b54,_0x51f4d7[_0x43e7('0x37')]);var _0x2ffd43={'where':_0x805b54['where']};return db[_0x43e7('0x26')][_0x43e7('0x15')](_0x2ffd43)['then'](function(_0x2d54c1){_0x2dd5f['count']=_0x2d54c1;if(_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x38')]){_0x805b54[_0x43e7('0x39')]=[{'all':!![]}];}return db[_0x43e7('0x26')][_0x43e7('0x3a')](_0x805b54);})[_0x43e7('0x1f')](function(_0x5e731b){_0x2dd5f['rows']=_0x5e731b;return _0x2dd5f;})[_0x43e7('0x1f')](respondWithFilteredResult(_0x52b7b3,_0x805b54))[_0x43e7('0x3b')](handleError(_0x52b7b3,null));};exports[_0x43e7('0x3c')]=function(_0xc8ffa5,_0x127d77){var _0x4a4a85={'raw':!![],'where':{'id':_0xc8ffa5[_0x43e7('0x3d')]['id']}},_0x32a451={};_0x32a451['model']=_[_0x43e7('0x2c')](db['SmsQueueReport'][_0x43e7('0x3e')]);_0x32a451['query']=_[_0x43e7('0x2c')](_0xc8ffa5[_0x43e7('0x2b')]);_0x32a451[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](_0x32a451['model'],_0x32a451['query']);_0x4a4a85[_0x43e7('0x30')]=_[_0x43e7('0x2e')](_0x32a451[_0x43e7('0x2a')],qs[_0x43e7('0x2f')](_0xc8ffa5['query']['fields']));_0x4a4a85['attributes']=_0x4a4a85[_0x43e7('0x30')]['length']?_0x4a4a85[_0x43e7('0x30')]:_0x32a451['model'];if(_0xc8ffa5['query'][_0x43e7('0x38')]){_0x4a4a85['include']=[{'all':!![]}];}_0x4a4a85=_[_0x43e7('0x35')]({},_0x4a4a85,_0xc8ffa5[_0x43e7('0x37')]);return db[_0x43e7('0x26')][_0x43e7('0x3f')](_0x4a4a85)['then'](handleEntityNotFound(_0x127d77,null))[_0x43e7('0x1f')](respondWithResult(_0x127d77,null))[_0x43e7('0x3b')](handleError(_0x127d77,null));};exports[_0x43e7('0x40')]=function(_0x1fd277,_0x296dc8){return db[_0x43e7('0x26')]['create'](_0x1fd277['body'],{})[_0x43e7('0x1f')](respondWithResult(_0x296dc8,0xc9))[_0x43e7('0x3b')](handleError(_0x296dc8,null));};exports[_0x43e7('0x1e')]=function(_0x4c00a8,_0x5c1c18){if(_0x4c00a8['body']['id']){delete _0x4c00a8[_0x43e7('0x41')]['id'];}return db[_0x43e7('0x26')]['find']({'where':{'id':_0x4c00a8[_0x43e7('0x3d')]['id']}})[_0x43e7('0x1f')](handleEntityNotFound(_0x5c1c18,null))[_0x43e7('0x1f')](saveUpdates(_0x4c00a8['body'],null))['then'](respondWithResult(_0x5c1c18,null))['catch'](handleError(_0x5c1c18,null));};exports['destroy']=function(_0x214e7e,_0xe955fc){return db['SmsQueueReport'][_0x43e7('0x3f')]({'where':{'id':_0x214e7e[_0x43e7('0x3d')]['id']}})[_0x43e7('0x1f')](handleEntityNotFound(_0xe955fc,null))[_0x43e7('0x1f')](removeEntity(_0xe955fc,null))['catch'](handleError(_0xe955fc,null));};exports[_0x43e7('0x42')]=function(_0x483f20,_0x4bebd4){return db[_0x43e7('0x26')][_0x43e7('0x42')]()[_0x43e7('0x1f')](respondWithResult(_0x4bebd4,null))[_0x43e7('0x3b')](handleError(_0x4bebd4,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 10153e0..bc419c7 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 _0xa03c=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x1b9bb3,_0x314e5d){var _0x52f37e=function(_0x2282f4){while(--_0x2282f4){_0x1b9bb3['push'](_0x1b9bb3['shift']());}};_0x52f37e(++_0x314e5d);}(_0xa03c,0xeb));var _0xca03=function(_0x31543a,_0x41b33d){_0x31543a=_0x31543a-0x0;var _0x468934=_0xa03c[_0x31543a];return _0x468934;};'use strict';var _=require(_0xca03('0x0'));var util=require(_0xca03('0x1'));var logger=require(_0xca03('0x2'))(_0xca03('0x3'));var moment=require(_0xca03('0x4'));var BPromise=require(_0xca03('0x5'));var rp=require(_0xca03('0x6'));var fs=require('fs');var path=require(_0xca03('0x7'));var rimraf=require(_0xca03('0x8'));var config=require(_0xca03('0x9'));var attributes=require('./smsQueueReport.attributes');module[_0xca03('0xa')]=function(_0xeff83e,_0x3f5072){return _0xeff83e[_0xca03('0xb')](_0xca03('0xc'),attributes,{'tableName':_0xca03('0xd'),'paranoid':![],'indexes':[{'name':_0xca03('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbbfd=['exports','report_sms_queue','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes'];(function(_0x2f9396,_0x185a1e){var _0x4608c9=function(_0x10046c){while(--_0x10046c){_0x2f9396['push'](_0x2f9396['shift']());}};_0x4608c9(++_0x185a1e);}(_0xbbfd,0xd3));var _0xdbbf=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xbbfd[_0x2112d4];return _0x434972;};'use strict';var _=require('lodash');var util=require(_0xdbbf('0x0'));var logger=require(_0xdbbf('0x1'))(_0xdbbf('0x2'));var moment=require(_0xdbbf('0x3'));var BPromise=require('bluebird');var rp=require(_0xdbbf('0x4'));var fs=require('fs');var path=require(_0xdbbf('0x5'));var rimraf=require(_0xdbbf('0x6'));var config=require(_0xdbbf('0x7'));var attributes=require(_0xdbbf('0x8'));module[_0xdbbf('0x9')]=function(_0xa3351c,_0xd67c0f){return _0xa3351c['define']('SmsQueueReport',attributes,{'tableName':_0xdbbf('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 4314acb..476961b 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 _0x397f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','then','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','CreateSmsQueueReport','SmsQueueReport','create','options','raw','catch','UpdateSmsQueueReport','update','where','attributes','limit'];(function(_0x85fdbc,_0x31d350){var _0x6e4308=function(_0xda48ef){while(--_0xda48ef){_0x85fdbc['push'](_0x85fdbc['shift']());}};_0x6e4308(++_0x31d350);}(_0x397f,0xc0));var _0xf397=function(_0x17c579,_0x1968f3){_0x17c579=_0x17c579-0x0;var _0xe506d7=_0x397f[_0x17c579];return _0xe506d7;};'use strict';var _=require(_0xf397('0x0'));var util=require(_0xf397('0x1'));var moment=require(_0xf397('0x2'));var BPromise=require(_0xf397('0x3'));var rs=require(_0xf397('0x4'));var fs=require('fs');var Redis=require(_0xf397('0x5'));var db=require(_0xf397('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf397('0x7'));var config=require('../../config/environment');var jayson=require(_0xf397('0x8'));var client=jayson[_0xf397('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x352c6f,_0x558959,_0x17150f){return new BPromise(function(_0x379faf,_0x443538){return client['request'](_0x352c6f,_0x17150f)[_0xf397('0xa')](function(_0x8c1174){logger[_0xf397('0xb')](_0xf397('0xc'),_0x558959,'request\x20sent');logger[_0xf397('0xd')](_0xf397('0xe'),_0x558959,_0xf397('0xf'),JSON[_0xf397('0x10')](_0x8c1174));if(_0x8c1174['error']){if(_0x8c1174['error'][_0xf397('0x11')]===0x1f4){logger[_0xf397('0x12')](_0xf397('0xc'),_0x558959,_0x8c1174[_0xf397('0x12')][_0xf397('0x13')]);return _0x443538(_0x8c1174[_0xf397('0x12')][_0xf397('0x13')]);}logger['error'](_0xf397('0xc'),_0x558959,_0x8c1174[_0xf397('0x12')][_0xf397('0x13')]);return _0x379faf(_0x8c1174[_0xf397('0x12')][_0xf397('0x13')]);}else{logger[_0xf397('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x558959,_0xf397('0xf'));_0x379faf(_0x8c1174[_0xf397('0x14')][_0xf397('0x13')]);}})['catch'](function(_0x215cd0){logger['error'](_0xf397('0xc'),_0x558959,_0x215cd0);_0x443538(_0x215cd0);});});}exports[_0xf397('0x15')]=function(_0x16b56a){var _0x473d0f=this;return new Promise(function(_0x3a1bd0,_0x1610fe){return db[_0xf397('0x16')][_0xf397('0x17')](_0x16b56a['body'],{'raw':_0x16b56a[_0xf397('0x18')]?_0x16b56a[_0xf397('0x18')][_0xf397('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x336ccb){logger[_0xf397('0xb')](_0xf397('0x15'),_0x16b56a);logger[_0xf397('0xd')](_0xf397('0x15'),_0x16b56a,JSON[_0xf397('0x10')](_0x336ccb));_0x3a1bd0(_0x336ccb);})[_0xf397('0x1a')](function(_0x38f140){logger['error']('CreateSmsQueueReport',_0x38f140[_0xf397('0x13')],_0x16b56a);_0x1610fe(_0x473d0f[_0xf397('0x12')](0x1f4,_0x38f140['message']));});});};exports[_0xf397('0x1b')]=function(_0x537dca){var _0xc805b=this;return new Promise(function(_0x5ea81e,_0xb6b3b1){return db['SmsQueueReport'][_0xf397('0x1c')](_0x537dca['body'],{'raw':_0x537dca[_0xf397('0x18')]?_0x537dca['options'][_0xf397('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x537dca['options']?_0x537dca[_0xf397('0x18')][_0xf397('0x1d')]||null:null,'attributes':_0x537dca[_0xf397('0x18')]?_0x537dca[_0xf397('0x18')][_0xf397('0x1e')]||null:null,'limit':_0x537dca[_0xf397('0x18')]?_0x537dca[_0xf397('0x18')][_0xf397('0x1f')]||null:null})[_0xf397('0xa')](function(_0x5d5f72){logger['info'](_0xf397('0x1b'),_0x537dca);logger[_0xf397('0xd')](_0xf397('0x1b'),_0x537dca,JSON['stringify'](_0x5d5f72));_0x5ea81e(_0x5d5f72);})[_0xf397('0x1a')](function(_0x3707e8){logger['error'](_0xf397('0x1b'),_0x3707e8['message'],_0x537dca);_0xb6b3b1(_0xc805b[_0xf397('0x12')](0x1f4,_0x3707e8['message']));});});}; \ No newline at end of file +var _0x9bc2=['SmsQueueReport,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','update','body','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','then','info'];(function(_0x3d0c92,_0x3849b8){var _0x299a85=function(_0x477ee6){while(--_0x477ee6){_0x3d0c92['push'](_0x3d0c92['shift']());}};_0x299a85(++_0x3849b8);}(_0x9bc2,0x167));var _0x29bc=function(_0x3dcd56,_0x12abbe){_0x3dcd56=_0x3dcd56-0x0;var _0x45bee4=_0x9bc2[_0x3dcd56];return _0x45bee4;};'use strict';var _=require(_0x29bc('0x0'));var util=require(_0x29bc('0x1'));var moment=require(_0x29bc('0x2'));var BPromise=require(_0x29bc('0x3'));var rs=require(_0x29bc('0x4'));var fs=require('fs');var Redis=require(_0x29bc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x29bc('0x6'));var logger=require(_0x29bc('0x7'))('rpc');var config=require(_0x29bc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x29bc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52ae0a,_0x59de6b,_0x1a095a){return new BPromise(function(_0x4d26a,_0x2addf1){return client[_0x29bc('0xa')](_0x52ae0a,_0x1a095a)[_0x29bc('0xb')](function(_0x1dc261){logger[_0x29bc('0xc')](_0x29bc('0xd'),_0x59de6b,'request\x20sent');logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x59de6b,'request\x20sent',JSON[_0x29bc('0xe')](_0x1dc261));if(_0x1dc261['error']){if(_0x1dc261[_0x29bc('0xf')][_0x29bc('0x10')]===0x1f4){logger[_0x29bc('0xf')](_0x29bc('0xd'),_0x59de6b,_0x1dc261[_0x29bc('0xf')]['message']);return _0x2addf1(_0x1dc261[_0x29bc('0xf')]['message']);}logger[_0x29bc('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x59de6b,_0x1dc261[_0x29bc('0xf')][_0x29bc('0x11')]);return _0x4d26a(_0x1dc261[_0x29bc('0xf')]['message']);}else{logger['info'](_0x29bc('0xd'),_0x59de6b,_0x29bc('0x12'));_0x4d26a(_0x1dc261[_0x29bc('0x13')][_0x29bc('0x11')]);}})[_0x29bc('0x14')](function(_0x140f6e){logger[_0x29bc('0xf')](_0x29bc('0xd'),_0x59de6b,_0x140f6e);_0x2addf1(_0x140f6e);});});}exports[_0x29bc('0x15')]=function(_0x424d2b){var _0x5f22ff=this;return new Promise(function(_0x5a7c5a,_0x4d1f04){return db[_0x29bc('0x16')][_0x29bc('0x17')](_0x424d2b['body'],{'raw':_0x424d2b[_0x29bc('0x18')]?_0x424d2b[_0x29bc('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x29bc('0xb')](function(_0x8cd04f){logger[_0x29bc('0xc')](_0x29bc('0x15'),_0x424d2b);logger['debug'](_0x29bc('0x15'),_0x424d2b,JSON[_0x29bc('0xe')](_0x8cd04f));_0x5a7c5a(_0x8cd04f);})['catch'](function(_0x43689b){logger['error'](_0x29bc('0x15'),_0x43689b[_0x29bc('0x11')],_0x424d2b);_0x4d1f04(_0x5f22ff['error'](0x1f4,_0x43689b['message']));});});};exports['UpdateSmsQueueReport']=function(_0x240bbd){var _0x22b217=this;return new Promise(function(_0xf1f811,_0x21c8a7){return db[_0x29bc('0x16')][_0x29bc('0x19')](_0x240bbd[_0x29bc('0x1a')],{'raw':_0x240bbd[_0x29bc('0x18')]?_0x240bbd[_0x29bc('0x18')][_0x29bc('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x240bbd[_0x29bc('0x18')]?_0x240bbd[_0x29bc('0x18')][_0x29bc('0x1c')]||null:null,'attributes':_0x240bbd[_0x29bc('0x18')]?_0x240bbd[_0x29bc('0x18')][_0x29bc('0x1d')]||null:null,'limit':_0x240bbd[_0x29bc('0x18')]?_0x240bbd[_0x29bc('0x18')][_0x29bc('0x1e')]||null:null})[_0x29bc('0xb')](function(_0x54c0fb){logger[_0x29bc('0xc')]('UpdateSmsQueueReport',_0x240bbd);logger['debug']('UpdateSmsQueueReport',_0x240bbd,JSON['stringify'](_0x54c0fb));_0xf1f811(_0x54c0fb);})['catch'](function(_0x36db63){logger[_0x29bc('0xf')]('UpdateSmsQueueReport',_0x36db63[_0x29bc('0x11')],_0x240bbd);_0x21c8a7(_0x22b217[_0x29bc('0xf')](0x1f4,_0x36db63['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index a4623bf..0060544 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 _0x0abf=['get','isAuthenticated','index','/describe','describe','/:id','post','create','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../config/environment','./smsTransferReport.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0abf,0xe8));var _0xf0ab=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x0abf[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0xf0ab('0x0'));var util=require('util');var path=require(_0xf0ab('0x1'));var timeout=require(_0xf0ab('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xf0ab('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf0ab('0x4'));var controller=require(_0xf0ab('0x5'));router[_0xf0ab('0x6')]('/',auth[_0xf0ab('0x7')](),controller[_0xf0ab('0x8')]);router[_0xf0ab('0x6')](_0xf0ab('0x9'),auth['isAuthenticated'](),controller[_0xf0ab('0xa')]);router[_0xf0ab('0x6')](_0xf0ab('0xb'),auth[_0xf0ab('0x7')](),controller['show']);router[_0xf0ab('0xc')]('/',auth[_0xf0ab('0x7')](),controller[_0xf0ab('0xd')]);router['put']('/:id',auth[_0xf0ab('0x7')](),controller['update']);router[_0xf0ab('0xe')](_0xf0ab('0xb'),auth[_0xf0ab('0x7')](),controller[_0xf0ab('0xf')]);module[_0xf0ab('0x10')]=router; \ No newline at end of file +var _0x4cf8=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','/describe','describe','show','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x2179f1,_0x21c653){var _0x176ec9=function(_0x4c4a4c){while(--_0x4c4a4c){_0x2179f1['push'](_0x2179f1['shift']());}};_0x176ec9(++_0x21c653);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x155c64,_0x26ff95){_0x155c64=_0x155c64-0x0;var _0x1f154a=_0x4cf8[_0x155c64];return _0x1f154a;};'use strict';var multer=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var path=require(_0x84cf('0x2'));var timeout=require(_0x84cf('0x3'));var express=require(_0x84cf('0x4'));var router=express[_0x84cf('0x5')]();var auth=require(_0x84cf('0x6'));var interaction=require(_0x84cf('0x7'));var config=require(_0x84cf('0x8'));var controller=require(_0x84cf('0x9'));router[_0x84cf('0xa')]('/',auth[_0x84cf('0xb')](),controller['index']);router['get'](_0x84cf('0xc'),auth['isAuthenticated'](),controller[_0x84cf('0xd')]);router[_0x84cf('0xa')]('/:id',auth[_0x84cf('0xb')](),controller[_0x84cf('0xe')]);router['post']('/',auth[_0x84cf('0xb')](),controller[_0x84cf('0xf')]);router[_0x84cf('0x10')](_0x84cf('0x11'),auth['isAuthenticated'](),controller[_0x84cf('0x12')]);router[_0x84cf('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x84cf('0x14')]);module[_0x84cf('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 865c007..f1cd5eb 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 _0xb1f4=['queue','NOW','moment','sequelize','exports','STRING','ENUM','account'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb1f4,0x122));var _0x4b1f=function(_0x169da7,_0x54bf47){_0x169da7=_0x169da7-0x0;var _0x5a87ca=_0xb1f4[_0x169da7];return _0x5a87ca;};'use strict';var moment=require(_0x4b1f('0x0'));var Sequelize=require(_0x4b1f('0x1'));module[_0x4b1f('0x2')]={'uniqueid':{'type':Sequelize[_0x4b1f('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x4b1f('0x4')](_0x4b1f('0x5'),'agent',_0x4b1f('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x4b1f('0x7')]}}; \ No newline at end of file +var _0x9fd6=['queue','exports','ENUM'];(function(_0x39b0b2,_0xef37ec){var _0x354231=function(_0x57b25e){while(--_0x57b25e){_0x39b0b2['push'](_0x39b0b2['shift']());}};_0x354231(++_0xef37ec);}(_0x9fd6,0x79));var _0x69fd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9fd6[_0x122ef9];return _0x42fba0;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x69fd('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x69fd('0x1')]('account','agent',_0x69fd('0x2')),'allowNull':![],'defaultValue':_0x69fd('0x2')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index b8c6931..4d81f56 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 _0xd8b0=['intersection','fields','attributes','length','model','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','SmsTransferReport','count','includeAll','include','findAll','catch','show','params','options','create','body','find','destroy','describe','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys'];(function(_0x26139d,_0x12206b){var _0x1bd4a9=function(_0x9f4228){while(--_0x9f4228){_0x26139d['push'](_0x26139d['shift']());}};_0x1bd4a9(++_0x12206b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var db=require(_0x0d8b('0x15'))['db'];function respondWithStatusCode(_0x340cc4,_0x92cdd8){_0x92cdd8=_0x92cdd8||0xcc;return function(_0x35a07b){if(_0x35a07b){return _0x340cc4[_0x0d8b('0x16')](_0x92cdd8);}return _0x340cc4[_0x0d8b('0x17')](_0x92cdd8)[_0x0d8b('0x18')]();};}function respondWithResult(_0x1d4bbc,_0x2ce75e){_0x2ce75e=_0x2ce75e||0xc8;return function(_0x5ad086){if(_0x5ad086){return _0x1d4bbc[_0x0d8b('0x17')](_0x2ce75e)[_0x0d8b('0x19')](_0x5ad086);}};}function respondWithFilteredResult(_0x2d4e1c,_0x4f6f21){return function(_0x23eb7b){if(_0x23eb7b){var _0xa86349=_0x23eb7b['count'],_0x17f7df=_0x4f6f21[_0x0d8b('0x1a')],_0xe2e167=_0x4f6f21[_0x0d8b('0x1a')]+_0x4f6f21[_0x0d8b('0x1b')],_0x2cb03c;if(_0xe2e167>=_0xa86349){_0xe2e167=_0xa86349;_0x2cb03c=0xc8;}else{_0x2cb03c=0xce;}_0x2d4e1c[_0x0d8b('0x17')](_0x2cb03c);return _0x2d4e1c[_0x0d8b('0x1c')](_0x0d8b('0x1d'),_0x17f7df+'-'+_0xe2e167+'/'+_0xa86349)[_0x0d8b('0x19')](_0x23eb7b);}return null;};}function patchUpdates(_0xa3612a){return function(_0x4a15bf){try{jsonpatch[_0x0d8b('0x1e')](_0x4a15bf,_0xa3612a,!![]);}catch(_0x23d58f){return BPromise[_0x0d8b('0x1f')](_0x23d58f);}return _0x4a15bf[_0x0d8b('0x20')]();};}function saveUpdates(_0x24e8ed,_0x5b709c){return function(_0x393beb){if(_0x393beb){return _0x393beb[_0x0d8b('0x21')](_0x24e8ed)['then'](function(_0x4f0a1a){return _0x4f0a1a;});}return null;};}function removeEntity(_0x33fb87,_0x54a9a7){return function(_0x56c729){if(_0x56c729){return _0x56c729['destroy']()[_0x0d8b('0x22')](function(){_0x33fb87[_0x0d8b('0x17')](0xcc)[_0x0d8b('0x18')]();});}};}function handleEntityNotFound(_0x38efc8,_0x221071){return function(_0x2c64e2){if(!_0x2c64e2){_0x38efc8[_0x0d8b('0x16')](0x194);}return _0x2c64e2;};}function handleError(_0x4562cb,_0x27b695){_0x27b695=_0x27b695||0x1f4;return function(_0x5e5bc3){logger[_0x0d8b('0x23')](_0x5e5bc3[_0x0d8b('0x24')]);if(_0x5e5bc3['name']){delete _0x5e5bc3[_0x0d8b('0x25')];}_0x4562cb['status'](_0x27b695)[_0x0d8b('0x26')](_0x5e5bc3);};}exports[_0x0d8b('0x27')]=function(_0xa2af02,_0x4fe6f9){var _0x59a905={},_0x28f639={},_0x3ef745={'count':0x0,'rows':[]};var _0x4c05ee=_[_0x0d8b('0x28')](db['SmsTransferReport'][_0x0d8b('0x29')],function(_0x4b59e5){return{'name':_0x4b59e5[_0x0d8b('0x2a')],'type':_0x4b59e5['type'][_0x0d8b('0x2b')]};});_0x28f639['model']=_[_0x0d8b('0x28')](_0x4c05ee,'name');_0x28f639[_0x0d8b('0x2c')]=_[_0x0d8b('0x2d')](_0xa2af02[_0x0d8b('0x2c')]);_0x28f639['filters']=_['intersection'](_0x28f639['model'],_0x28f639[_0x0d8b('0x2c')]);_0x59a905['attributes']=_[_0x0d8b('0x2e')](_0x28f639['model'],qs['fields'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x2f')]));_0x59a905[_0x0d8b('0x30')]=_0x59a905[_0x0d8b('0x30')][_0x0d8b('0x31')]?_0x59a905[_0x0d8b('0x30')]:_0x28f639[_0x0d8b('0x32')];if(!_0xa2af02[_0x0d8b('0x2c')]['hasOwnProperty'](_0x0d8b('0x33'))){_0x59a905[_0x0d8b('0x1b')]=qs['limit'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x1b')]);_0x59a905[_0x0d8b('0x1a')]=qs['offset'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x1a')]);}_0x59a905[_0x0d8b('0x34')]=qs[_0x0d8b('0x35')](_0xa2af02[_0x0d8b('0x2c')]['sort']);_0x59a905[_0x0d8b('0x36')]=qs[_0x0d8b('0x37')](_['pick'](_0xa2af02[_0x0d8b('0x2c')],_0x28f639[_0x0d8b('0x37')]),_0x4c05ee);if(_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x59a905[_0x0d8b('0x36')]=_['merge'](_0x59a905['where'],{'$or':_[_0x0d8b('0x28')](_0x4c05ee,function(_0x5c2c04){if(_0x5c2c04['type']!==_0x0d8b('0x39')){var _0x2e279c={};_0x2e279c[_0x5c2c04[_0x0d8b('0x25')]]={'$like':'%'+_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x2e279c;}})});}_0x59a905=_[_0x0d8b('0x3a')]({},_0x59a905,_0xa2af02['options']);var _0x6e5bab={'where':_0x59a905[_0x0d8b('0x36')]};return db[_0x0d8b('0x3b')][_0x0d8b('0x3c')](_0x6e5bab)[_0x0d8b('0x22')](function(_0x1a39ad){_0x3ef745[_0x0d8b('0x3c')]=_0x1a39ad;if(_0xa2af02['query'][_0x0d8b('0x3d')]){_0x59a905[_0x0d8b('0x3e')]=[{'all':!![]}];}return db[_0x0d8b('0x3b')][_0x0d8b('0x3f')](_0x59a905);})['then'](function(_0xe0bf42){_0x3ef745['rows']=_0xe0bf42;return _0x3ef745;})[_0x0d8b('0x22')](respondWithFilteredResult(_0x4fe6f9,_0x59a905))[_0x0d8b('0x40')](handleError(_0x4fe6f9,null));};exports[_0x0d8b('0x41')]=function(_0x26ac10,_0x35fa7e){var _0x3e632e={'raw':!![],'where':{'id':_0x26ac10[_0x0d8b('0x42')]['id']}},_0x1ff17d={};_0x1ff17d[_0x0d8b('0x32')]=_[_0x0d8b('0x2d')](db['SmsTransferReport']['rawAttributes']);_0x1ff17d['query']=_['keys'](_0x26ac10['query']);_0x1ff17d[_0x0d8b('0x37')]=_[_0x0d8b('0x2e')](_0x1ff17d[_0x0d8b('0x32')],_0x1ff17d['query']);_0x3e632e['attributes']=_[_0x0d8b('0x2e')](_0x1ff17d[_0x0d8b('0x32')],qs[_0x0d8b('0x2f')](_0x26ac10['query'][_0x0d8b('0x2f')]));_0x3e632e[_0x0d8b('0x30')]=_0x3e632e['attributes']['length']?_0x3e632e[_0x0d8b('0x30')]:_0x1ff17d['model'];if(_0x26ac10[_0x0d8b('0x2c')]['includeAll']){_0x3e632e['include']=[{'all':!![]}];}_0x3e632e=_[_0x0d8b('0x3a')]({},_0x3e632e,_0x26ac10[_0x0d8b('0x43')]);return db['SmsTransferReport']['find'](_0x3e632e)['then'](handleEntityNotFound(_0x35fa7e,null))['then'](respondWithResult(_0x35fa7e,null))[_0x0d8b('0x40')](handleError(_0x35fa7e,null));};exports[_0x0d8b('0x44')]=function(_0xd9d4c3,_0x490eda){return db[_0x0d8b('0x3b')][_0x0d8b('0x44')](_0xd9d4c3[_0x0d8b('0x45')],{})[_0x0d8b('0x22')](respondWithResult(_0x490eda,0xc9))[_0x0d8b('0x40')](handleError(_0x490eda,null));};exports[_0x0d8b('0x21')]=function(_0x11d22b,_0x1d5067){if(_0x11d22b[_0x0d8b('0x45')]['id']){delete _0x11d22b[_0x0d8b('0x45')]['id'];}return db[_0x0d8b('0x3b')][_0x0d8b('0x46')]({'where':{'id':_0x11d22b[_0x0d8b('0x42')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x1d5067,null))[_0x0d8b('0x22')](saveUpdates(_0x11d22b[_0x0d8b('0x45')],null))[_0x0d8b('0x22')](respondWithResult(_0x1d5067,null))[_0x0d8b('0x40')](handleError(_0x1d5067,null));};exports[_0x0d8b('0x47')]=function(_0x574b90,_0x371fa0){return db['SmsTransferReport']['find']({'where':{'id':_0x574b90[_0x0d8b('0x42')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x371fa0,null))[_0x0d8b('0x22')](removeEntity(_0x371fa0,null))[_0x0d8b('0x40')](handleError(_0x371fa0,null));};exports['describe']=function(_0x131579,_0x1106d6){return db[_0x0d8b('0x3b')][_0x0d8b('0x48')]()[_0x0d8b('0x22')](respondWithResult(_0x1106d6,null))['catch'](handleError(_0x1106d6,null));}; \ No newline at end of file +var _0xa9e0=['merge','options','include','findAll','catch','params','includeAll','create','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','SmsTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL'];(function(_0x24c285,_0xda5f90){var _0x544675=function(_0x582db3){while(--_0x582db3){_0x24c285['push'](_0x24c285['shift']());}};_0x544675(++_0xda5f90);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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));};exports[_0x0a9e('0x45')]=function(_0x3fe430,_0x4f7240){return db['SmsTransferReport']['describe']()[_0x0a9e('0x1f')](respondWithResult(_0x4f7240,null))[_0x0a9e('0x3f')](handleError(_0x4f7240,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index f4cf1e4..28df808 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 _0x2456=['request-promise','rimraf','../../config/environment','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','api','moment'];(function(_0x3f8d91,_0x26d57f){var _0x4f3aab=function(_0x4659c1){while(--_0x4659c1){_0x3f8d91['push'](_0x3f8d91['shift']());}};_0x4f3aab(++_0x26d57f);}(_0x2456,0xc8));var _0x6245=function(_0x3669bf,_0x13f4f4){_0x3669bf=_0x3669bf-0x0;var _0x4bae1a=_0x2456[_0x3669bf];return _0x4bae1a;};'use strict';var _=require(_0x6245('0x0'));var util=require(_0x6245('0x1'));var logger=require('../../config/logger')(_0x6245('0x2'));var moment=require(_0x6245('0x3'));var BPromise=require('bluebird');var rp=require(_0x6245('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6245('0x5'));var config=require(_0x6245('0x6'));var attributes=require('./smsTransferReport.attributes');module[_0x6245('0x7')]=function(_0x3cee26,_0x2fdae3){return _0x3cee26[_0x6245('0x8')](_0x6245('0x9'),attributes,{'tableName':_0x6245('0xa'),'paranoid':![],'indexes':[{'name':_0x6245('0xb'),'fields':[_0x6245('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7994=['util','../../config/logger','bluebird','request-promise','rimraf','exports','report_sms_transfer','uniqueid','lodash'];(function(_0x11262c,_0x20d80b){var _0x23977b=function(_0x273f88){while(--_0x273f88){_0x11262c['push'](_0x11262c['shift']());}};_0x23977b(++_0x20d80b);}(_0x7994,0x14c));var _0x4799=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7994[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4799('0x0'));var util=require(_0x4799('0x1'));var logger=require(_0x4799('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4799('0x3'));var rp=require(_0x4799('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4799('0x5'));var config=require('../../config/environment');var attributes=require('./smsTransferReport.attributes');module[_0x4799('0x6')]=function(_0x4b219d,_0x2ed9d7){return _0x4b219d['define']('SmsTransferReport',attributes,{'tableName':_0x4799('0x7'),'paranoid':![],'indexes':[{'name':_0x4799('0x8'),'fields':[_0x4799('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 4034d51..78129c5 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 _0x941c=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x42c24f,_0x5e4327){var _0x36b58e=function(_0xd30559){while(--_0xd30559){_0x42c24f['push'](_0x42c24f['shift']());}};_0x36b58e(++_0x5e4327);}(_0x941c,0x1b2));var _0xc941=function(_0x2f708e,_0x312f9b){_0x2f708e=_0x2f708e-0x0;var _0x3771fb=_0x941c[_0x2f708e];return _0x3771fb;};'use strict';var _=require(_0xc941('0x0'));var util=require(_0xc941('0x1'));var moment=require(_0xc941('0x2'));var BPromise=require('bluebird');var rs=require(_0xc941('0x3'));var fs=require('fs');var Redis=require(_0xc941('0x4'));var db=require(_0xc941('0x5'))['db'];var utils=require(_0xc941('0x6'));var logger=require(_0xc941('0x7'))(_0xc941('0x8'));var config=require(_0xc941('0x9'));var jayson=require(_0xc941('0xa'));var client=jayson[_0xc941('0xb')][_0xc941('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x35059f,_0x242865,_0x4671ef){return new BPromise(function(_0x5e34b7,_0x44c51b){return client['request'](_0x35059f,_0x4671ef)['then'](function(_0x3670ae){logger[_0xc941('0xd')](_0xc941('0xe'),_0x242865,_0xc941('0xf'));logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x242865,_0xc941('0xf'),JSON[_0xc941('0x10')](_0x3670ae));if(_0x3670ae[_0xc941('0x11')]){if(_0x3670ae['error'][_0xc941('0x12')]===0x1f4){logger[_0xc941('0x11')](_0xc941('0xe'),_0x242865,_0x3670ae[_0xc941('0x11')][_0xc941('0x13')]);return _0x44c51b(_0x3670ae[_0xc941('0x11')]['message']);}logger['error'](_0xc941('0xe'),_0x242865,_0x3670ae['error'][_0xc941('0x13')]);return _0x5e34b7(_0x3670ae[_0xc941('0x11')][_0xc941('0x13')]);}else{logger[_0xc941('0xd')](_0xc941('0xe'),_0x242865,_0xc941('0xf'));_0x5e34b7(_0x3670ae[_0xc941('0x14')][_0xc941('0x13')]);}})[_0xc941('0x15')](function(_0x55383f){logger[_0xc941('0x11')](_0xc941('0xe'),_0x242865,_0x55383f);_0x44c51b(_0x55383f);});});} \ No newline at end of file +var _0x8acf=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2f8748,_0x17bce3){var _0x4d717d=function(_0x37b88f){while(--_0x37b88f){_0x2f8748['push'](_0x2f8748['shift']());}};_0x4d717d(++_0x17bce3);}(_0x8acf,0xb9));var _0xf8ac=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x8acf[_0x59d89e];return _0x554e93;};'use strict';var _=require(_0xf8ac('0x0'));var util=require(_0xf8ac('0x1'));var moment=require(_0xf8ac('0x2'));var BPromise=require(_0xf8ac('0x3'));var rs=require(_0xf8ac('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf8ac('0x5'))['db'];var utils=require(_0xf8ac('0x6'));var logger=require(_0xf8ac('0x7'))(_0xf8ac('0x8'));var config=require(_0xf8ac('0x9'));var jayson=require(_0xf8ac('0xa'));var client=jayson[_0xf8ac('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55c6af,_0xea5cd8,_0xb16cc2){return new BPromise(function(_0x5f4ea1,_0x1805a3){return client[_0xf8ac('0xc')](_0x55c6af,_0xb16cc2)[_0xf8ac('0xd')](function(_0x14323b){logger[_0xf8ac('0xe')](_0xf8ac('0xf'),_0xea5cd8,_0xf8ac('0x10'));logger[_0xf8ac('0x11')](_0xf8ac('0x12'),_0xea5cd8,'request\x20sent',JSON[_0xf8ac('0x13')](_0x14323b));if(_0x14323b[_0xf8ac('0x14')]){if(_0x14323b[_0xf8ac('0x14')][_0xf8ac('0x15')]===0x1f4){logger[_0xf8ac('0x14')](_0xf8ac('0xf'),_0xea5cd8,_0x14323b[_0xf8ac('0x14')][_0xf8ac('0x16')]);return _0x1805a3(_0x14323b['error'][_0xf8ac('0x16')]);}logger[_0xf8ac('0x14')](_0xf8ac('0xf'),_0xea5cd8,_0x14323b[_0xf8ac('0x14')]['message']);return _0x5f4ea1(_0x14323b['error'][_0xf8ac('0x16')]);}else{logger[_0xf8ac('0xe')](_0xf8ac('0xf'),_0xea5cd8,_0xf8ac('0x10'));_0x5f4ea1(_0x14323b['result'][_0xf8ac('0x16')]);}})[_0xf8ac('0x17')](function(_0x47c84f){logger['error'](_0xf8ac('0xf'),_0xea5cd8,_0x47c84f);_0x1805a3(_0x47c84f);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 322a5c2..d1d45e4 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 _0x5e1e=['diskStorage','server/files/sounds/original/','replace','extname','originalname','now','post','single','file','create','put','update','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','index','/:id','isAuthenticated','show','/:id/download'];(function(_0x17b90c,_0x46ba51){var _0x4100d2=function(_0x1ba8dd){while(--_0x1ba8dd){_0x17b90c['push'](_0x17b90c['shift']());}};_0x4100d2(++_0x46ba51);}(_0x5e1e,0xd2));var _0xe5e1=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5e1e[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0xe5e1('0x0'));var util=require(_0xe5e1('0x1'));var path=require(_0xe5e1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe5e1('0x3')]();var auth=require(_0xe5e1('0x4'));var interaction=require(_0xe5e1('0x5'));var config=require(_0xe5e1('0x6'));var controller=require(_0xe5e1('0x7'));router[_0xe5e1('0x8')]('/',auth['isAuthenticated'](),controller[_0xe5e1('0x9')]);router[_0xe5e1('0x8')](_0xe5e1('0xa'),auth[_0xe5e1('0xb')](),controller[_0xe5e1('0xc')]);router[_0xe5e1('0x8')](_0xe5e1('0xd'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0xe5e1('0xe')]({'destination':function(_0x245524,_0x42cfcb,_0x5ed004){_0x5ed004(null,path['join'](config['root'],_0xe5e1('0xf')));},'filename':function(_0x1103d9,_0x4cb01d,_0x58dedf){_0x4cb01d['originalname']=_0x4cb01d['originalname'][_0xe5e1('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x58dedf(null,util['format']('%s-%s%s',path['basename'](_0x4cb01d['originalname'],path[_0xe5e1('0x11')](_0x4cb01d[_0xe5e1('0x12')])),Date[_0xe5e1('0x13')](),path[_0xe5e1('0x11')](_0x4cb01d[_0xe5e1('0x12')])));}})});router[_0xe5e1('0x14')]('/',upload[_0xe5e1('0x15')](_0xe5e1('0x16')),controller[_0xe5e1('0x17')]);router[_0xe5e1('0x18')]('/:id',auth[_0xe5e1('0xb')](),controller[_0xe5e1('0x19')]);router['delete'](_0xe5e1('0xa'),auth[_0xe5e1('0xb')](),controller[_0xe5e1('0x1a')]);module[_0xe5e1('0x1b')]=router; \ No newline at end of file +var _0xcfba=['server/files/sounds/original/','originalname','replace','format','basename','extname','now','post','single','file','put','update','delete','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/download','download','join','root'];(function(_0x2889c7,_0x9967c9){var _0x169573=function(_0x1e2fcc){while(--_0x1e2fcc){_0x2889c7['push'](_0x2889c7['shift']());}};_0x169573(++_0x9967c9);}(_0xcfba,0xb6));var _0xacfb=function(_0xca8ec6,_0xd194fb){_0xca8ec6=_0xca8ec6-0x0;var _0xcc0d0e=_0xcfba[_0xca8ec6];return _0xcc0d0e;};'use strict';var multer=require(_0xacfb('0x0'));var util=require('util');var path=require(_0xacfb('0x1'));var timeout=require(_0xacfb('0x2'));var express=require('express');var router=express[_0xacfb('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xacfb('0x4'));var config=require(_0xacfb('0x5'));var controller=require('./sound.controller');router[_0xacfb('0x6')]('/',auth[_0xacfb('0x7')](),controller[_0xacfb('0x8')]);router['get'](_0xacfb('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xacfb('0x6')](_0xacfb('0xa'),auth['isAuthenticated'](),controller[_0xacfb('0xb')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2a1f98,_0x505ddb,_0x280b02){_0x280b02(null,path[_0xacfb('0xc')](config[_0xacfb('0xd')],_0xacfb('0xe')));},'filename':function(_0x2a84ad,_0x2c8486,_0x388209){_0x2c8486[_0xacfb('0xf')]=_0x2c8486['originalname'][_0xacfb('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x388209(null,util[_0xacfb('0x11')]('%s-%s%s',path[_0xacfb('0x12')](_0x2c8486['originalname'],path[_0xacfb('0x13')](_0x2c8486[_0xacfb('0xf')])),Date[_0xacfb('0x14')](),path[_0xacfb('0x13')](_0x2c8486[_0xacfb('0xf')])));}})});router[_0xacfb('0x15')]('/',upload[_0xacfb('0x16')](_0xacfb('0x17')),controller['create']);router[_0xacfb('0x18')](_0xacfb('0x9'),auth[_0xacfb('0x7')](),controller[_0xacfb('0x19')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xacfb('0x1a')]);module[_0xacfb('0x1b')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index b014ebb..c284c7a 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 _0xb332=['INTEGER','sequelize','exports','STRING','FLOAT','BIGINT'];(function(_0x43c8b8,_0x5e8934){var _0x413be3=function(_0x23969c){while(--_0x23969c){_0x43c8b8['push'](_0x43c8b8['shift']());}};_0x413be3(++_0x5e8934);}(_0xb332,0x109));var _0x2b33=function(_0x216428,_0x5d20ea){_0x216428=_0x216428-0x0;var _0x313dd4=_0xb332[_0x216428];return _0x313dd4;};'use strict';var Sequelize=require(_0x2b33('0x0'));module[_0x2b33('0x1')]={'name':{'type':Sequelize[_0x2b33('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x2b33('0x2')]},'display_name':{'type':Sequelize[_0x2b33('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x2b33('0x2')]},'original_format':{'type':Sequelize[_0x2b33('0x2')]},'original_duration':{'type':Sequelize[_0x2b33('0x3')]},'original_sampleCount':{'type':Sequelize[_0x2b33('0x4')]},'original_channelCount':{'type':Sequelize[_0x2b33('0x5')]},'original_bitRate':{'type':Sequelize[_0x2b33('0x4')]},'original_sampleRate':{'type':Sequelize[_0x2b33('0x5')]},'converted_format':{'type':Sequelize[_0x2b33('0x2')]},'converted_duration':{'type':Sequelize[_0x2b33('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x2b33('0x4')]},'converted_channelCount':{'type':Sequelize[_0x2b33('0x5')]},'converted_bitRate':{'type':Sequelize[_0x2b33('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x2b33('0x5')]}}; \ No newline at end of file +var _0xf89c=['sequelize','exports','name','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x2ca794,_0x3e0030){var _0x27b67b=function(_0x40f96b){while(--_0x40f96b){_0x2ca794['push'](_0x2ca794['shift']());}};_0x27b67b(++_0x3e0030);}(_0xf89c,0x70));var _0xcf89=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf89c[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xcf89('0x0'));module[_0xcf89('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xcf89('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xcf89('0x3')]},'display_name':{'type':Sequelize[_0xcf89('0x3')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xcf89('0x3')]},'original_duration':{'type':Sequelize[_0xcf89('0x4')]},'original_sampleCount':{'type':Sequelize[_0xcf89('0x5')]},'original_channelCount':{'type':Sequelize[_0xcf89('0x6')]},'original_bitRate':{'type':Sequelize[_0xcf89('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xcf89('0x3')]},'converted_duration':{'type':Sequelize[_0xcf89('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xcf89('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xcf89('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index aae2575..16f9319 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 _0x1b0a=['show','params','rawAttributes','includeAll','find','download','existsSync','root','server/files/sounds/converted','save_name','converted_format','Sequelize','ValidationError','format','%s.%s','create','basename','originalname','extname','file','filename','substring','wav','join','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','0777','unlinkSync','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','description','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','error','name','send','index','map','Sound','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','include','catch'];(function(_0x2e4a0f,_0x3a9bb6){var _0x25a3cd=function(_0x1c614f){while(--_0x1c614f){_0x2e4a0f['push'](_0x2e4a0f['shift']());}};_0x25a3cd(++_0x3a9bb6);}(_0x1b0a,0x19f));var _0xa1b0=function(_0x11c8dd,_0x563b34){_0x11c8dd=_0x11c8dd-0x0;var _0x1aefb1=_0x1b0a[_0x11c8dd];return _0x1aefb1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa1b0('0x0'));var rimraf=require(_0xa1b0('0x1'));var zipdir=require(_0xa1b0('0x2'));var jsonpatch=require(_0xa1b0('0x3'));var rp=require(_0xa1b0('0x4'));var moment=require(_0xa1b0('0x5'));var BPromise=require(_0xa1b0('0x6'));var Mustache=require(_0xa1b0('0x7'));var util=require(_0xa1b0('0x8'));var path=require('path');var sox=require(_0xa1b0('0x9'));var csv=require(_0xa1b0('0xa'));var ejs=require(_0xa1b0('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa1b0('0xc'));var crypto=require(_0xa1b0('0xd'));var jsforce=require(_0xa1b0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa1b0('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa1b0('0xf'));var authService=require(_0xa1b0('0x10'));var qs=require(_0xa1b0('0x11'));var as=require(_0xa1b0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa1b0('0x13'));var utils=require(_0xa1b0('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1438cc,_0x4d384a){_0x4d384a=_0x4d384a||0xcc;return function(_0x2b9a91){if(_0x2b9a91){return _0x1438cc[_0xa1b0('0x15')](_0x4d384a);}return _0x1438cc[_0xa1b0('0x16')](_0x4d384a)[_0xa1b0('0x17')]();};}function respondWithResult(_0x47945e,_0x50805f){_0x50805f=_0x50805f||0xc8;return function(_0x7a2d47){if(_0x7a2d47){return _0x47945e[_0xa1b0('0x16')](_0x50805f)[_0xa1b0('0x18')](_0x7a2d47);}};}function respondWithFilteredResult(_0x4c46af,_0x53c5ec){return function(_0x45b0c7){if(_0x45b0c7){var _0x2af77b=_0x45b0c7[_0xa1b0('0x19')],_0x26335e=_0x53c5ec[_0xa1b0('0x1a')],_0x18ecb7=_0x53c5ec[_0xa1b0('0x1a')]+_0x53c5ec[_0xa1b0('0x1b')],_0x15dd94;if(_0x18ecb7>=_0x2af77b){_0x18ecb7=_0x2af77b;_0x15dd94=0xc8;}else{_0x15dd94=0xce;}_0x4c46af[_0xa1b0('0x16')](_0x15dd94);return _0x4c46af[_0xa1b0('0x1c')](_0xa1b0('0x1d'),_0x26335e+'-'+_0x18ecb7+'/'+_0x2af77b)[_0xa1b0('0x18')](_0x45b0c7);}return null;};}function patchUpdates(_0x286b0d){return function(_0x36acd4){try{jsonpatch[_0xa1b0('0x1e')](_0x36acd4,_0x286b0d,!![]);}catch(_0x300ca3){return BPromise[_0xa1b0('0x1f')](_0x300ca3);}return _0x36acd4[_0xa1b0('0x20')]();};}function saveUpdates(_0x2d6ce4,_0xb148d6){return function(_0x1f4ada){if(_0x1f4ada){return _0x1f4ada[_0xa1b0('0x21')](_0x2d6ce4)[_0xa1b0('0x22')](function(_0x5da121){return _0x5da121;});}return null;};}function removeEntity(_0x1a302b,_0x5eeb05){return function(_0x17c559){if(_0x17c559){return _0x17c559[_0xa1b0('0x23')]()['then'](function(){var _0x1b2acd=_0x17c559[_0xa1b0('0x24')]({'plain':!![]});var _0x7c5efa=_0xa1b0('0x25');return db[_0xa1b0('0x26')][_0xa1b0('0x23')]({'where':{'type':_0x7c5efa,'resourceId':_0x1b2acd['id']}})['then'](function(){return _0x17c559;});})[_0xa1b0('0x22')](function(){_0x1a302b['status'](0xcc)[_0xa1b0('0x17')]();});}};}function handleEntityNotFound(_0xbf07a0,_0x107db7){return function(_0x5b094b){if(!_0x5b094b){_0xbf07a0['sendStatus'](0x194);}return _0x5b094b;};}function handleError(_0x1267e3,_0x41a65b){_0x41a65b=_0x41a65b||0x1f4;return function(_0x1c1780){logger[_0xa1b0('0x27')](_0x1c1780['stack']);if(_0x1c1780[_0xa1b0('0x28')]){delete _0x1c1780['name'];}_0x1267e3[_0xa1b0('0x16')](_0x41a65b)[_0xa1b0('0x29')](_0x1c1780);};}exports[_0xa1b0('0x2a')]=function(_0x31bbc1,_0x2bcf52){var _0x26925a={},_0x59dfd3={},_0x42663d={'count':0x0,'rows':[]};var _0x2445c6=_[_0xa1b0('0x2b')](db[_0xa1b0('0x2c')]['rawAttributes'],function(_0x2977b1){return{'name':_0x2977b1[_0xa1b0('0x2d')],'type':_0x2977b1[_0xa1b0('0x2e')]['key']};});_0x59dfd3[_0xa1b0('0x2f')]=_['map'](_0x2445c6,_0xa1b0('0x28'));_0x59dfd3['query']=_[_0xa1b0('0x30')](_0x31bbc1[_0xa1b0('0x31')]);_0x59dfd3[_0xa1b0('0x32')]=_[_0xa1b0('0x33')](_0x59dfd3['model'],_0x59dfd3[_0xa1b0('0x31')]);_0x26925a['attributes']=_[_0xa1b0('0x33')](_0x59dfd3['model'],qs[_0xa1b0('0x34')](_0x31bbc1[_0xa1b0('0x31')][_0xa1b0('0x34')]));_0x26925a['attributes']=_0x26925a[_0xa1b0('0x35')][_0xa1b0('0x36')]?_0x26925a[_0xa1b0('0x35')]:_0x59dfd3[_0xa1b0('0x2f')];if(!_0x31bbc1[_0xa1b0('0x31')][_0xa1b0('0x37')]('nolimit')){_0x26925a[_0xa1b0('0x1b')]=qs['limit'](_0x31bbc1[_0xa1b0('0x31')][_0xa1b0('0x1b')]);_0x26925a[_0xa1b0('0x1a')]=qs[_0xa1b0('0x1a')](_0x31bbc1[_0xa1b0('0x31')][_0xa1b0('0x1a')]);}_0x26925a[_0xa1b0('0x38')]=qs[_0xa1b0('0x39')](_0x31bbc1['query'][_0xa1b0('0x39')]);_0x26925a[_0xa1b0('0x3a')]=qs[_0xa1b0('0x32')](_['pick'](_0x31bbc1[_0xa1b0('0x31')],_0x59dfd3['filters']),_0x2445c6);if(_0x31bbc1[_0xa1b0('0x31')]['filter']){_0x26925a['where']=_[_0xa1b0('0x3b')](_0x26925a[_0xa1b0('0x3a')],{'$or':_[_0xa1b0('0x2b')](_0x2445c6,function(_0x4006b9){if(_0x4006b9[_0xa1b0('0x2e')]!==_0xa1b0('0x3c')){var _0x1e3079={};_0x1e3079[_0x4006b9[_0xa1b0('0x28')]]={'$like':'%'+_0x31bbc1['query'][_0xa1b0('0x3d')]+'%'};return _0x1e3079;}})});}_0x26925a=_[_0xa1b0('0x3b')]({},_0x26925a,_0x31bbc1[_0xa1b0('0x3e')]);var _0x4223e={'where':_0x26925a[_0xa1b0('0x3a')]};return db[_0xa1b0('0x2c')]['count'](_0x4223e)['then'](function(_0xa97559){_0x42663d[_0xa1b0('0x19')]=_0xa97559;if(_0x31bbc1[_0xa1b0('0x31')]['includeAll']){_0x26925a[_0xa1b0('0x3f')]=[{'all':!![]}];}return db[_0xa1b0('0x2c')]['findAll'](_0x26925a);})[_0xa1b0('0x22')](function(_0xa071ee){_0x42663d['rows']=_0xa071ee;return _0x42663d;})[_0xa1b0('0x22')](respondWithFilteredResult(_0x2bcf52,_0x26925a))[_0xa1b0('0x40')](handleError(_0x2bcf52,null));};exports[_0xa1b0('0x41')]=function(_0x478d0f,_0x31dc27){var _0x2e57f7={'raw':!![],'where':{'id':_0x478d0f[_0xa1b0('0x42')]['id']}},_0x3469a3={};_0x3469a3[_0xa1b0('0x2f')]=_[_0xa1b0('0x30')](db['Sound'][_0xa1b0('0x43')]);_0x3469a3[_0xa1b0('0x31')]=_[_0xa1b0('0x30')](_0x478d0f[_0xa1b0('0x31')]);_0x3469a3[_0xa1b0('0x32')]=_[_0xa1b0('0x33')](_0x3469a3[_0xa1b0('0x2f')],_0x3469a3[_0xa1b0('0x31')]);_0x2e57f7[_0xa1b0('0x35')]=_[_0xa1b0('0x33')](_0x3469a3[_0xa1b0('0x2f')],qs[_0xa1b0('0x34')](_0x478d0f[_0xa1b0('0x31')][_0xa1b0('0x34')]));_0x2e57f7[_0xa1b0('0x35')]=_0x2e57f7[_0xa1b0('0x35')]['length']?_0x2e57f7[_0xa1b0('0x35')]:_0x3469a3[_0xa1b0('0x2f')];if(_0x478d0f[_0xa1b0('0x31')][_0xa1b0('0x44')]){_0x2e57f7['include']=[{'all':!![]}];}_0x2e57f7=_['merge']({},_0x2e57f7,_0x478d0f[_0xa1b0('0x3e')]);return db[_0xa1b0('0x2c')][_0xa1b0('0x45')](_0x2e57f7)[_0xa1b0('0x22')](handleEntityNotFound(_0x31dc27,null))[_0xa1b0('0x22')](respondWithResult(_0x31dc27,null))[_0xa1b0('0x40')](handleError(_0x31dc27,null));};exports[_0xa1b0('0x46')]=function(_0x160004,_0x5455c0,_0x33056c){return db[_0xa1b0('0x2c')]['find']({'where':{'id':_0x160004[_0xa1b0('0x42')]['id']},'attributes':[_0xa1b0('0x28'),'save_name','converted_format'],'raw':!![]})[_0xa1b0('0x22')](handleEntityNotFound(_0x5455c0,null))['then'](function(_0x4c068b){if(_0x4c068b){if(!fs[_0xa1b0('0x47')](path['join'](config[_0xa1b0('0x48')],_0xa1b0('0x49'),_0x4c068b[_0xa1b0('0x4a')]+'.'+_0x4c068b[_0xa1b0('0x4b')]))){throw new db[(_0xa1b0('0x4c'))][(_0xa1b0('0x4d'))]('Sound\x20not\x20found');}return _0x5455c0[_0xa1b0('0x46')](path['join'](config['root'],_0xa1b0('0x49'),util['format']('%s.%s',_0x4c068b[_0xa1b0('0x4a')],_0x4c068b[_0xa1b0('0x4b')])),util[_0xa1b0('0x4e')](_0xa1b0('0x4f'),_0x4c068b[_0xa1b0('0x28')],_0x4c068b[_0xa1b0('0x4b')]));}return null;})[_0xa1b0('0x40')](handleError(_0x5455c0,null));};exports[_0xa1b0('0x50')]=function(_0x4d1bbf,_0x2c23aa,_0x1f7f20){var _0xdf7c10={'name':path[_0xa1b0('0x51')](_0x4d1bbf['file'][_0xa1b0('0x52')],path[_0xa1b0('0x53')](_0x4d1bbf['file'][_0xa1b0('0x52')])),'save_name':path[_0xa1b0('0x51')](_0x4d1bbf[_0xa1b0('0x54')][_0xa1b0('0x55')],path[_0xa1b0('0x53')](_0x4d1bbf[_0xa1b0('0x54')][_0xa1b0('0x55')])),'original_format':path[_0xa1b0('0x53')](_0x4d1bbf[_0xa1b0('0x54')][_0xa1b0('0x52')])[_0xa1b0('0x56')](0x1),'converted_format':_0xa1b0('0x57')};var _0x3f3b51=path[_0xa1b0('0x58')](config['root'],_0xa1b0('0x59'),_0x4d1bbf[_0xa1b0('0x54')][_0xa1b0('0x55')]);var _0x4048d1=path[_0xa1b0('0x58')](config[_0xa1b0('0x48')],_0xa1b0('0x49'),util['format']('%s.%s',path[_0xa1b0('0x51')](_0x4d1bbf['file'][_0xa1b0('0x55')],path[_0xa1b0('0x53')](_0x4d1bbf[_0xa1b0('0x54')]['filename'])),_0xdf7c10['converted_format']));logger[_0xa1b0('0x5a')]('Sound\x20upload\x20filepath:\x20%s',_0x3f3b51);logger[_0xa1b0('0x5a')](_0xa1b0('0x5b'),_0x4048d1);try{fs['chmodSync'](_0x3f3b51,parseInt(_0xa1b0('0x5c'),0x8));var _0x7f5a2e=sox['transcode'](_0x3f3b51,_0x4048d1,{'sampleRate':0x1f40,'format':_0xa1b0('0x57'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x7f5a2e['on'](_0xa1b0('0x27'),function(_0x571a93){fs[_0xa1b0('0x5d')](_0x3f3b51);_0x2c23aa['status'](0x1f4)[_0xa1b0('0x29')](_0x571a93);});_0x7f5a2e['on'](_0xa1b0('0x5e'),function(_0x428170){_0xdf7c10[_0xa1b0('0x5f')]=isNaN(_0x428170[_0xa1b0('0x60')])?null:_0x428170[_0xa1b0('0x60')]*0x3e8;_0xdf7c10['original_sampleCount']=isNaN(_0x428170[_0xa1b0('0x61')])?null:_0x428170[_0xa1b0('0x61')];_0xdf7c10[_0xa1b0('0x62')]=isNaN(_0x428170[_0xa1b0('0x63')])?null:_0x428170[_0xa1b0('0x63')];_0xdf7c10[_0xa1b0('0x64')]=isNaN(_0x428170[_0xa1b0('0x65')])?null:_0x428170[_0xa1b0('0x65')];_0xdf7c10['original_sampleRate']=isNaN(_0x428170[_0xa1b0('0x66')])?null:_0x428170[_0xa1b0('0x66')];});_0x7f5a2e['on'](_0xa1b0('0x67'),function(_0x4d1965){_0xdf7c10[_0xa1b0('0x68')]=isNaN(_0x4d1965[_0xa1b0('0x60')])?null:_0x4d1965[_0xa1b0('0x60')]*0x3e8;_0xdf7c10[_0xa1b0('0x69')]=isNaN(_0x4d1965[_0xa1b0('0x61')])?null:_0x4d1965['sampleCount'];_0xdf7c10[_0xa1b0('0x6a')]=isNaN(_0x4d1965['channelCount'])?null:_0x4d1965['channelCount'];_0xdf7c10[_0xa1b0('0x6b')]=isNaN(_0x4d1965['bitRate'])?null:_0x4d1965['bitRate'];_0xdf7c10[_0xa1b0('0x6c')]=isNaN(_0x4d1965[_0xa1b0('0x66')])?null:_0x4d1965['sampleRate'];});_0x7f5a2e['on'](_0xa1b0('0x17'),function(){fs[_0xa1b0('0x6d')](_0x4048d1,parseInt(_0xa1b0('0x5c'),0x8));return db[_0xa1b0('0x2c')][_0xa1b0('0x50')](_0xdf7c10)[_0xa1b0('0x22')](function(_0x3387c6){var _0xa4472d={'role':_0x4d1bbf[_0xa1b0('0x6e')][_0xa1b0('0x6f')],'userProfileId':_0x4d1bbf['body'][_0xa1b0('0x70')]};if(!_0xa4472d)throw new Error(_0xa1b0('0x71'));if(_0xa4472d[_0xa1b0('0x6f')]===_0xa1b0('0x72')){var _0x83ff56=_0x3387c6[_0xa1b0('0x24')]({'plain':!![]});return db[_0xa1b0('0x73')][_0xa1b0('0x45')]({'where':{'name':_0xa1b0('0x25'),'userProfileId':_0xa4472d['userProfileId']},'raw':!![]})[_0xa1b0('0x22')](function(_0x3f48b3){if(_0x3f48b3&&_0x3f48b3[_0xa1b0('0x74')]===0x0){return db[_0xa1b0('0x26')][_0xa1b0('0x50')]({'name':_0x83ff56[_0xa1b0('0x28')],'resourceId':_0x83ff56['id'],'type':_0x3f48b3[_0xa1b0('0x28')],'sectionId':_0x3f48b3['id']},{})[_0xa1b0('0x22')](function(){return _0x3387c6;});}else{return _0x3387c6;}})[_0xa1b0('0x40')](function(_0x1f0b58){logger[_0xa1b0('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f0b58);throw _0x1f0b58;});}return _0x3387c6;})[_0xa1b0('0x22')](respondWithResult(_0x2c23aa,null))[_0xa1b0('0x40')](handleError(_0x2c23aa,null));});_0x7f5a2e['start']();}catch(_0x51bc0a){_0x2c23aa[_0xa1b0('0x16')](0x1f4)[_0xa1b0('0x29')](_0x51bc0a);}};exports[_0xa1b0('0x21')]=function(_0x5866cd,_0xf5f354,_0x68a7e1){return db[_0xa1b0('0x2c')][_0xa1b0('0x45')]({'where':{'id':_0x5866cd[_0xa1b0('0x42')]['id']}})[_0xa1b0('0x22')](handleEntityNotFound(_0xf5f354,null))[_0xa1b0('0x22')](saveUpdates(_['pick'](_0x5866cd[_0xa1b0('0x6e')],[_0xa1b0('0x28'),_0xa1b0('0x75')]),null))['then'](respondWithResult(_0xf5f354,null))[_0xa1b0('0x40')](handleError(_0xf5f354,null));};exports[_0xa1b0('0x76')]=function(_0x3de966,_0x95f23f,_0x386d52){return db['Sound'][_0xa1b0('0x45')]({'where':{'id':_0x3de966[_0xa1b0('0x42')]['id']}})['then'](function(_0x55f676){if(_0x55f676){return _0x55f676[_0xa1b0('0x23')]();}})[_0xa1b0('0x22')](function(_0x3a414d){var _0x440ad4=path['join'](config[_0xa1b0('0x48')],_0xa1b0('0x59'),util[_0xa1b0('0x4e')]('%s.%s',_0x3a414d['save_name'],_0x3a414d[_0xa1b0('0x77')]));var _0x267e1f=path[_0xa1b0('0x58')](config[_0xa1b0('0x48')],'server/files/sounds/converted',util[_0xa1b0('0x4e')](_0xa1b0('0x4f'),_0x3a414d[_0xa1b0('0x4a')],_0x3a414d[_0xa1b0('0x4b')]));fs['unlinkSync'](_0x440ad4);fs[_0xa1b0('0x5d')](_0x267e1f);return _0x3a414d;})[_0xa1b0('0x22')](function(_0x22632c){if(_0x22632c){return _0x95f23f['status'](0xcc)[_0xa1b0('0x17')]();}})[_0xa1b0('0x22')](handleEntityNotFound(_0x95f23f,null))['catch'](handleError(_0x95f23f,null));}; \ No newline at end of file +var _0x2cf5=['substring','basename','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_sampleCount','converted_channelCount','converted_bitRate','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','autoAssociation','start','update','pick','description','server/files/sounds/original','original_format','html-pdf','eml-format','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','then','UserProfileResource','destroy','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','save_name','join','root','server/files/sounds/converted','converted_format','Sequelize','ValidationError','download','format','%s.%s','originalname','extname','file','filename'];(function(_0x107675,_0x355df1){var _0x3b3a03=function(_0x3261eb){while(--_0x3261eb){_0x107675['push'](_0x107675['shift']());}};_0x3b3a03(++_0x355df1);}(_0x2cf5,0xa0));var _0x52cf=function(_0x406ecb,_0x2cd3f8){_0x406ecb=_0x406ecb-0x0;var _0x5957df=_0x2cf5[_0x406ecb];return _0x5957df;};'use strict';var pdf=require(_0x52cf('0x0'));var emlformat=require(_0x52cf('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x52cf('0x2'));var moment=require(_0x52cf('0x3'));var BPromise=require(_0x52cf('0x4'));var Mustache=require(_0x52cf('0x5'));var util=require('util');var path=require(_0x52cf('0x6'));var sox=require(_0x52cf('0x7'));var csv=require(_0x52cf('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x52cf('0x9'));var squel=require(_0x52cf('0xa'));var crypto=require(_0x52cf('0xb'));var jsforce=require(_0x52cf('0xc'));var deskjs=require(_0x52cf('0xd'));var toCsv=require('to-csv');var querystring=require(_0x52cf('0xe'));var Papa=require(_0x52cf('0xf'));var Redis=require(_0x52cf('0x10'));var authService=require(_0x52cf('0x11'));var qs=require(_0x52cf('0x12'));var as=require(_0x52cf('0x13'));var hardwareService=require(_0x52cf('0x14'));var logger=require(_0x52cf('0x15'))(_0x52cf('0x16'));var utils=require('../../config/utils');var config=require(_0x52cf('0x17'));var db=require(_0x52cf('0x18'))['db'];function respondWithStatusCode(_0xb50b2b,_0xdc0000){_0xdc0000=_0xdc0000||0xcc;return function(_0x1ccf58){if(_0x1ccf58){return _0xb50b2b[_0x52cf('0x19')](_0xdc0000);}return _0xb50b2b[_0x52cf('0x1a')](_0xdc0000)[_0x52cf('0x1b')]();};}function respondWithResult(_0x53c52b,_0x448189){_0x448189=_0x448189||0xc8;return function(_0x3d41e8){if(_0x3d41e8){return _0x53c52b[_0x52cf('0x1a')](_0x448189)[_0x52cf('0x1c')](_0x3d41e8);}};}function respondWithFilteredResult(_0x4d3afd,_0x32fd9e){return function(_0x52545c){if(_0x52545c){var _0x295b12=_0x52545c[_0x52cf('0x1d')],_0x19c0db=_0x32fd9e[_0x52cf('0x1e')],_0x6f3370=_0x32fd9e[_0x52cf('0x1e')]+_0x32fd9e[_0x52cf('0x1f')],_0x35a486;if(_0x6f3370>=_0x295b12){_0x6f3370=_0x295b12;_0x35a486=0xc8;}else{_0x35a486=0xce;}_0x4d3afd[_0x52cf('0x1a')](_0x35a486);return _0x4d3afd['set'](_0x52cf('0x20'),_0x19c0db+'-'+_0x6f3370+'/'+_0x295b12)[_0x52cf('0x1c')](_0x52545c);}return null;};}function patchUpdates(_0x3d87e1){return function(_0x38183b){try{jsonpatch[_0x52cf('0x21')](_0x38183b,_0x3d87e1,!![]);}catch(_0x3bb58c){return BPromise['reject'](_0x3bb58c);}return _0x38183b['save']();};}function saveUpdates(_0x15973c,_0x58659f){return function(_0xf0f3f){if(_0xf0f3f){return _0xf0f3f['update'](_0x15973c)[_0x52cf('0x22')](function(_0x103bad){return _0x103bad;});}return null;};}function removeEntity(_0x1f88c9,_0x9c40d3){return function(_0x435155){if(_0x435155){return _0x435155['destroy']()[_0x52cf('0x22')](function(){var _0x28524d=_0x435155['get']({'plain':!![]});var _0x34e336='Sounds';return db[_0x52cf('0x23')][_0x52cf('0x24')]({'where':{'type':_0x34e336,'resourceId':_0x28524d['id']}})[_0x52cf('0x22')](function(){return _0x435155;});})['then'](function(){_0x1f88c9[_0x52cf('0x1a')](0xcc)[_0x52cf('0x1b')]();});}};}function handleEntityNotFound(_0x368f2b,_0x198d56){return function(_0x3a4e88){if(!_0x3a4e88){_0x368f2b[_0x52cf('0x19')](0x194);}return _0x3a4e88;};}function handleError(_0x2cf7fc,_0x122e50){_0x122e50=_0x122e50||0x1f4;return function(_0x4c9971){logger[_0x52cf('0x25')](_0x4c9971[_0x52cf('0x26')]);if(_0x4c9971[_0x52cf('0x27')]){delete _0x4c9971['name'];}_0x2cf7fc['status'](_0x122e50)[_0x52cf('0x28')](_0x4c9971);};}exports[_0x52cf('0x29')]=function(_0x224ce2,_0x45a336){var _0x271489={},_0x54d3d2={},_0xf0642f={'count':0x0,'rows':[]};var _0xd18143=_[_0x52cf('0x2a')](db[_0x52cf('0x2b')][_0x52cf('0x2c')],function(_0x114341){return{'name':_0x114341[_0x52cf('0x2d')],'type':_0x114341[_0x52cf('0x2e')]['key']};});_0x54d3d2['model']=_[_0x52cf('0x2a')](_0xd18143,_0x52cf('0x27'));_0x54d3d2[_0x52cf('0x2f')]=_[_0x52cf('0x30')](_0x224ce2[_0x52cf('0x2f')]);_0x54d3d2[_0x52cf('0x31')]=_[_0x52cf('0x32')](_0x54d3d2[_0x52cf('0x33')],_0x54d3d2[_0x52cf('0x2f')]);_0x271489[_0x52cf('0x34')]=_[_0x52cf('0x32')](_0x54d3d2['model'],qs[_0x52cf('0x35')](_0x224ce2[_0x52cf('0x2f')][_0x52cf('0x35')]));_0x271489[_0x52cf('0x34')]=_0x271489[_0x52cf('0x34')][_0x52cf('0x36')]?_0x271489[_0x52cf('0x34')]:_0x54d3d2[_0x52cf('0x33')];if(!_0x224ce2[_0x52cf('0x2f')][_0x52cf('0x37')]('nolimit')){_0x271489[_0x52cf('0x1f')]=qs[_0x52cf('0x1f')](_0x224ce2[_0x52cf('0x2f')][_0x52cf('0x1f')]);_0x271489[_0x52cf('0x1e')]=qs['offset'](_0x224ce2[_0x52cf('0x2f')]['offset']);}_0x271489[_0x52cf('0x38')]=qs[_0x52cf('0x39')](_0x224ce2[_0x52cf('0x2f')]['sort']);_0x271489[_0x52cf('0x3a')]=qs[_0x52cf('0x31')](_['pick'](_0x224ce2[_0x52cf('0x2f')],_0x54d3d2[_0x52cf('0x31')]),_0xd18143);if(_0x224ce2['query']['filter']){_0x271489[_0x52cf('0x3a')]=_[_0x52cf('0x3b')](_0x271489['where'],{'$or':_[_0x52cf('0x2a')](_0xd18143,function(_0x25e1c9){if(_0x25e1c9[_0x52cf('0x2e')]!==_0x52cf('0x3c')){var _0x508f06={};_0x508f06[_0x25e1c9[_0x52cf('0x27')]]={'$like':'%'+_0x224ce2[_0x52cf('0x2f')][_0x52cf('0x3d')]+'%'};return _0x508f06;}})});}_0x271489=_[_0x52cf('0x3b')]({},_0x271489,_0x224ce2[_0x52cf('0x3e')]);var _0x118551={'where':_0x271489[_0x52cf('0x3a')]};return db[_0x52cf('0x2b')][_0x52cf('0x1d')](_0x118551)[_0x52cf('0x22')](function(_0x16ceb9){_0xf0642f[_0x52cf('0x1d')]=_0x16ceb9;if(_0x224ce2[_0x52cf('0x2f')][_0x52cf('0x3f')]){_0x271489[_0x52cf('0x40')]=[{'all':!![]}];}return db[_0x52cf('0x2b')][_0x52cf('0x41')](_0x271489);})[_0x52cf('0x22')](function(_0x59af86){_0xf0642f[_0x52cf('0x42')]=_0x59af86;return _0xf0642f;})['then'](respondWithFilteredResult(_0x45a336,_0x271489))[_0x52cf('0x43')](handleError(_0x45a336,null));};exports['show']=function(_0x53661c,_0x27a8ee){var _0x40cec2={'raw':!![],'where':{'id':_0x53661c[_0x52cf('0x44')]['id']}},_0x31b431={};_0x31b431['model']=_[_0x52cf('0x30')](db[_0x52cf('0x2b')]['rawAttributes']);_0x31b431[_0x52cf('0x2f')]=_[_0x52cf('0x30')](_0x53661c[_0x52cf('0x2f')]);_0x31b431[_0x52cf('0x31')]=_[_0x52cf('0x32')](_0x31b431[_0x52cf('0x33')],_0x31b431[_0x52cf('0x2f')]);_0x40cec2[_0x52cf('0x34')]=_[_0x52cf('0x32')](_0x31b431[_0x52cf('0x33')],qs[_0x52cf('0x35')](_0x53661c[_0x52cf('0x2f')][_0x52cf('0x35')]));_0x40cec2[_0x52cf('0x34')]=_0x40cec2[_0x52cf('0x34')][_0x52cf('0x36')]?_0x40cec2[_0x52cf('0x34')]:_0x31b431[_0x52cf('0x33')];if(_0x53661c[_0x52cf('0x2f')][_0x52cf('0x3f')]){_0x40cec2[_0x52cf('0x40')]=[{'all':!![]}];}_0x40cec2=_[_0x52cf('0x3b')]({},_0x40cec2,_0x53661c[_0x52cf('0x3e')]);return db[_0x52cf('0x2b')][_0x52cf('0x45')](_0x40cec2)[_0x52cf('0x22')](handleEntityNotFound(_0x27a8ee,null))[_0x52cf('0x22')](respondWithResult(_0x27a8ee,null))[_0x52cf('0x43')](handleError(_0x27a8ee,null));};exports['download']=function(_0x19f059,_0x30ae2e,_0x21680d){return db[_0x52cf('0x2b')]['find']({'where':{'id':_0x19f059[_0x52cf('0x44')]['id']},'attributes':[_0x52cf('0x27'),_0x52cf('0x46'),'converted_format'],'raw':!![]})[_0x52cf('0x22')](handleEntityNotFound(_0x30ae2e,null))['then'](function(_0x2eeae2){if(_0x2eeae2){if(!fs['existsSync'](path[_0x52cf('0x47')](config[_0x52cf('0x48')],_0x52cf('0x49'),_0x2eeae2[_0x52cf('0x46')]+'.'+_0x2eeae2[_0x52cf('0x4a')]))){throw new db[(_0x52cf('0x4b'))][(_0x52cf('0x4c'))]('Sound\x20not\x20found');}return _0x30ae2e[_0x52cf('0x4d')](path[_0x52cf('0x47')](config['root'],'server/files/sounds/converted',util[_0x52cf('0x4e')]('%s.%s',_0x2eeae2['save_name'],_0x2eeae2['converted_format'])),util[_0x52cf('0x4e')](_0x52cf('0x4f'),_0x2eeae2['name'],_0x2eeae2['converted_format']));}return null;})[_0x52cf('0x43')](handleError(_0x30ae2e,null));};exports['create']=function(_0x42b504,_0x59c50d,_0x3eb001){var _0x329cd7={'name':path['basename'](_0x42b504['file'][_0x52cf('0x50')],path[_0x52cf('0x51')](_0x42b504[_0x52cf('0x52')][_0x52cf('0x50')])),'save_name':path['basename'](_0x42b504[_0x52cf('0x52')]['filename'],path[_0x52cf('0x51')](_0x42b504['file'][_0x52cf('0x53')])),'original_format':path[_0x52cf('0x51')](_0x42b504[_0x52cf('0x52')][_0x52cf('0x50')])[_0x52cf('0x54')](0x1),'converted_format':'wav'};var _0x1e4a93=path[_0x52cf('0x47')](config[_0x52cf('0x48')],'server/files/sounds/original',_0x42b504[_0x52cf('0x52')][_0x52cf('0x53')]);var _0x3b2459=path[_0x52cf('0x47')](config[_0x52cf('0x48')],'server/files/sounds/converted',util[_0x52cf('0x4e')](_0x52cf('0x4f'),path[_0x52cf('0x55')](_0x42b504['file'][_0x52cf('0x53')],path[_0x52cf('0x51')](_0x42b504[_0x52cf('0x52')][_0x52cf('0x53')])),_0x329cd7['converted_format']));logger[_0x52cf('0x56')]('Sound\x20upload\x20filepath:\x20%s',_0x1e4a93);logger['info'](_0x52cf('0x57'),_0x3b2459);try{fs[_0x52cf('0x58')](_0x1e4a93,parseInt(_0x52cf('0x59'),0x8));var _0x210600=sox[_0x52cf('0x5a')](_0x1e4a93,_0x3b2459,{'sampleRate':0x1f40,'format':_0x52cf('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x210600['on'](_0x52cf('0x25'),function(_0x45b352){fs[_0x52cf('0x5c')](_0x1e4a93);_0x59c50d['status'](0x1f4)['send'](_0x45b352);});_0x210600['on'](_0x52cf('0x5d'),function(_0x10587f){_0x329cd7[_0x52cf('0x5e')]=isNaN(_0x10587f['duration'])?null:_0x10587f[_0x52cf('0x5f')]*0x3e8;_0x329cd7[_0x52cf('0x60')]=isNaN(_0x10587f['sampleCount'])?null:_0x10587f[_0x52cf('0x61')];_0x329cd7[_0x52cf('0x62')]=isNaN(_0x10587f['channelCount'])?null:_0x10587f[_0x52cf('0x63')];_0x329cd7[_0x52cf('0x64')]=isNaN(_0x10587f[_0x52cf('0x65')])?null:_0x10587f[_0x52cf('0x65')];_0x329cd7[_0x52cf('0x66')]=isNaN(_0x10587f[_0x52cf('0x67')])?null:_0x10587f[_0x52cf('0x67')];});_0x210600['on']('dest',function(_0x2d69ea){_0x329cd7['converted_duration']=isNaN(_0x2d69ea[_0x52cf('0x5f')])?null:_0x2d69ea['duration']*0x3e8;_0x329cd7[_0x52cf('0x68')]=isNaN(_0x2d69ea[_0x52cf('0x61')])?null:_0x2d69ea[_0x52cf('0x61')];_0x329cd7[_0x52cf('0x69')]=isNaN(_0x2d69ea['channelCount'])?null:_0x2d69ea['channelCount'];_0x329cd7[_0x52cf('0x6a')]=isNaN(_0x2d69ea[_0x52cf('0x65')])?null:_0x2d69ea[_0x52cf('0x65')];_0x329cd7['converted_sampleRate']=isNaN(_0x2d69ea[_0x52cf('0x67')])?null:_0x2d69ea[_0x52cf('0x67')];});_0x210600['on'](_0x52cf('0x1b'),function(){fs[_0x52cf('0x58')](_0x3b2459,parseInt(_0x52cf('0x59'),0x8));return db[_0x52cf('0x2b')][_0x52cf('0x6b')](_0x329cd7)[_0x52cf('0x22')](function(_0x7d2633){var _0x18e09a={'role':_0x42b504['body']['role'],'userProfileId':_0x42b504[_0x52cf('0x6c')][_0x52cf('0x6d')]};if(!_0x18e09a)throw new Error(_0x52cf('0x6e'));if(_0x18e09a[_0x52cf('0x6f')]===_0x52cf('0x70')){var _0x116535=_0x7d2633[_0x52cf('0x71')]({'plain':!![]});return db[_0x52cf('0x72')][_0x52cf('0x45')]({'where':{'name':'Sounds','userProfileId':_0x18e09a[_0x52cf('0x6d')]},'raw':!![]})[_0x52cf('0x22')](function(_0x3d945b){if(_0x3d945b&&_0x3d945b[_0x52cf('0x73')]===0x0){return db[_0x52cf('0x23')]['create']({'name':_0x116535[_0x52cf('0x27')],'resourceId':_0x116535['id'],'type':_0x3d945b[_0x52cf('0x27')],'sectionId':_0x3d945b['id']},{})[_0x52cf('0x22')](function(){return _0x7d2633;});}else{return _0x7d2633;}})[_0x52cf('0x43')](function(_0x1208a3){logger[_0x52cf('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1208a3);throw _0x1208a3;});}return _0x7d2633;})[_0x52cf('0x22')](respondWithResult(_0x59c50d,null))[_0x52cf('0x43')](handleError(_0x59c50d,null));});_0x210600[_0x52cf('0x74')]();}catch(_0xa93579){_0x59c50d['status'](0x1f4)[_0x52cf('0x28')](_0xa93579);}};exports[_0x52cf('0x75')]=function(_0x3b7db8,_0x5a0021,_0x1ed96e){return db[_0x52cf('0x2b')][_0x52cf('0x45')]({'where':{'id':_0x3b7db8['params']['id']}})[_0x52cf('0x22')](handleEntityNotFound(_0x5a0021,null))['then'](saveUpdates(_[_0x52cf('0x76')](_0x3b7db8[_0x52cf('0x6c')],[_0x52cf('0x27'),_0x52cf('0x77')]),null))[_0x52cf('0x22')](respondWithResult(_0x5a0021,null))['catch'](handleError(_0x5a0021,null));};exports['delete']=function(_0x3ab1d0,_0x236eb0,_0x331c2a){return db['Sound']['find']({'where':{'id':_0x3ab1d0[_0x52cf('0x44')]['id']}})[_0x52cf('0x22')](function(_0x52b705){if(_0x52b705){return _0x52b705[_0x52cf('0x24')]();}})[_0x52cf('0x22')](function(_0x103459){var _0x632df9=path[_0x52cf('0x47')](config[_0x52cf('0x48')],_0x52cf('0x78'),util[_0x52cf('0x4e')](_0x52cf('0x4f'),_0x103459['save_name'],_0x103459[_0x52cf('0x79')]));var _0x1be4b8=path[_0x52cf('0x47')](config['root'],'server/files/sounds/converted',util[_0x52cf('0x4e')](_0x52cf('0x4f'),_0x103459[_0x52cf('0x46')],_0x103459[_0x52cf('0x4a')]));fs[_0x52cf('0x5c')](_0x632df9);fs['unlinkSync'](_0x1be4b8);return _0x103459;})[_0x52cf('0x22')](function(_0x2dd696){if(_0x2dd696){return _0x236eb0[_0x52cf('0x1a')](0xcc)[_0x52cf('0x1b')]();}})[_0x52cf('0x22')](handleEntityNotFound(_0x236eb0,null))[_0x52cf('0x43')](handleError(_0x236eb0,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 801a137..ddbc2dc 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 _0x29ea=['request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','lodash','util','api','moment','bluebird'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x29ea,0x14d));var _0xa29e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x29ea[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa29e('0x0'));var util=require(_0xa29e('0x1'));var logger=require('../../config/logger')(_0xa29e('0x2'));var moment=require(_0xa29e('0x3'));var BPromise=require(_0xa29e('0x4'));var rp=require(_0xa29e('0x5'));var fs=require('fs');var path=require(_0xa29e('0x6'));var rimraf=require(_0xa29e('0x7'));var config=require(_0xa29e('0x8'));var attributes=require(_0xa29e('0x9'));module[_0xa29e('0xa')]=function(_0x44b59b,_0x551d02){return _0x44b59b[_0xa29e('0xb')](_0xa29e('0xc'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa876=['bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','../../config/logger','api','moment'];(function(_0x4fcaee,_0x2f83a7){var _0x4bb2fb=function(_0x2b3673){while(--_0x2b3673){_0x4fcaee['push'](_0x4fcaee['shift']());}};_0x4bb2fb(++_0x2f83a7);}(_0xa876,0x1db));var _0x6a87=function(_0x216f53,_0x9d79bf){_0x216f53=_0x216f53-0x0;var _0x207a3f=_0xa876[_0x216f53];return _0x207a3f;};'use strict';var _=require(_0x6a87('0x0'));var util=require(_0x6a87('0x1'));var logger=require(_0x6a87('0x2'))(_0x6a87('0x3'));var moment=require(_0x6a87('0x4'));var BPromise=require(_0x6a87('0x5'));var rp=require(_0x6a87('0x6'));var fs=require('fs');var path=require(_0x6a87('0x7'));var rimraf=require(_0x6a87('0x8'));var config=require(_0x6a87('0x9'));var attributes=require(_0x6a87('0xa'));module[_0x6a87('0xb')]=function(_0x26833c,_0x3cdf9e){return _0x26833c[_0x6a87('0xc')](_0x6a87('0xd'),attributes,{'tableName':_0x6a87('0xe'),'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 ab58871..344f75e 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 _0x6389=['request\x20sent','debug','stringify','error','message','result','catch','ShowSound','Sound','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s'];(function(_0x6e7f4a,_0x5d114d){var _0x4407b6=function(_0x5d9525){while(--_0x5d9525){_0x6e7f4a['push'](_0x6e7f4a['shift']());}};_0x4407b6(++_0x5d114d);}(_0x6389,0x14c));var _0x9638=function(_0x25986f,_0x10785d){_0x25986f=_0x25986f-0x0;var _0x496221=_0x6389[_0x25986f];return _0x496221;};'use strict';var _=require(_0x9638('0x0'));var util=require(_0x9638('0x1'));var moment=require(_0x9638('0x2'));var BPromise=require(_0x9638('0x3'));var rs=require(_0x9638('0x4'));var fs=require('fs');var Redis=require(_0x9638('0x5'));var db=require(_0x9638('0x6'))['db'];var utils=require(_0x9638('0x7'));var logger=require(_0x9638('0x8'))(_0x9638('0x9'));var config=require(_0x9638('0xa'));var jayson=require(_0x9638('0xb'));var client=jayson[_0x9638('0xc')][_0x9638('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x575ca2,_0x488f04,_0x315819){return new BPromise(function(_0x372db0,_0x4262da){return client[_0x9638('0xe')](_0x575ca2,_0x315819)[_0x9638('0xf')](function(_0x5b5da3){logger[_0x9638('0x10')](_0x9638('0x11'),_0x488f04,_0x9638('0x12'));logger[_0x9638('0x13')]('Sound,\x20%s,\x20%s,\x20%s',_0x488f04,_0x9638('0x12'),JSON[_0x9638('0x14')](_0x5b5da3));if(_0x5b5da3[_0x9638('0x15')]){if(_0x5b5da3[_0x9638('0x15')]['code']===0x1f4){logger[_0x9638('0x15')](_0x9638('0x11'),_0x488f04,_0x5b5da3['error'][_0x9638('0x16')]);return _0x4262da(_0x5b5da3['error'][_0x9638('0x16')]);}logger[_0x9638('0x15')](_0x9638('0x11'),_0x488f04,_0x5b5da3[_0x9638('0x15')][_0x9638('0x16')]);return _0x372db0(_0x5b5da3[_0x9638('0x15')][_0x9638('0x16')]);}else{logger['info'](_0x9638('0x11'),_0x488f04,'request\x20sent');_0x372db0(_0x5b5da3[_0x9638('0x17')][_0x9638('0x16')]);}})[_0x9638('0x18')](function(_0x2d7635){logger[_0x9638('0x15')](_0x9638('0x11'),_0x488f04,_0x2d7635);_0x4262da(_0x2d7635);});});}exports[_0x9638('0x19')]=function(_0x2aab85){var _0x5bb4b7=this;return new Promise(function(_0xccb320,_0x54bc04){return db[_0x9638('0x1a')][_0x9638('0x1b')]({'raw':_0x2aab85['options']?_0x2aab85[_0x9638('0x1c')][_0x9638('0x1d')]===undefined?!![]:![]:!![],'where':_0x2aab85[_0x9638('0x1c')]?_0x2aab85[_0x9638('0x1c')][_0x9638('0x1e')]||null:null,'attributes':_0x2aab85['options']?_0x2aab85[_0x9638('0x1c')][_0x9638('0x1f')]||null:null,'include':_0x2aab85[_0x9638('0x1c')]?_0x2aab85['options'][_0x9638('0x20')]?_[_0x9638('0x21')](_0x2aab85[_0x9638('0x1c')]['include'],function(_0x324704){return{'model':db[_0x324704[_0x9638('0x22')]],'as':_0x324704['as'],'attributes':_0x324704[_0x9638('0x1f')],'include':_0x324704[_0x9638('0x20')]?_[_0x9638('0x21')](_0x324704[_0x9638('0x20')],function(_0x42647b){return{'model':db[_0x42647b[_0x9638('0x22')]],'as':_0x42647b['as'],'attributes':_0x42647b['attributes'],'include':_0x42647b[_0x9638('0x20')]?_[_0x9638('0x21')](_0x42647b[_0x9638('0x20')],function(_0xdea163){return{'model':db[_0xdea163[_0x9638('0x22')]],'as':_0xdea163['as'],'attributes':_0xdea163['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x34baf0){logger[_0x9638('0x10')](_0x9638('0x19'),_0x2aab85);logger[_0x9638('0x13')](_0x9638('0x19'),_0x2aab85,JSON['stringify'](_0x34baf0));_0xccb320(_0x34baf0);})['catch'](function(_0x288998){logger[_0x9638('0x15')](_0x9638('0x19'),_0x288998['message'],_0x2aab85);_0x54bc04(_0x5bb4b7[_0x9638('0x15')](0x1f4,_0x288998[_0x9638('0x16')]));});});}; \ No newline at end of file +var _0x6cf9=['model','include','map','ShowSound','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','info','Sound,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','Sound','find','options','raw','where','attributes'];(function(_0x496285,_0x297d87){var _0x2f7996=function(_0x4d8a0e){while(--_0x4d8a0e){_0x496285['push'](_0x496285['shift']());}};_0x2f7996(++_0x297d87);}(_0x6cf9,0x14e));var _0x96cf=function(_0x35d8af,_0x14fd75){_0x35d8af=_0x35d8af-0x0;var _0x1d08b0=_0x6cf9[_0x35d8af];return _0x1d08b0;};'use strict';var _=require(_0x96cf('0x0'));var util=require(_0x96cf('0x1'));var moment=require('moment');var BPromise=require(_0x96cf('0x2'));var rs=require(_0x96cf('0x3'));var fs=require('fs');var Redis=require(_0x96cf('0x4'));var db=require(_0x96cf('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x96cf('0x6'));var jayson=require(_0x96cf('0x7'));var client=jayson[_0x96cf('0x8')][_0x96cf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ec213,_0x1dc154,_0xf2e433){return new BPromise(function(_0x418227,_0x3658a8){return client[_0x96cf('0xa')](_0x1ec213,_0xf2e433)['then'](function(_0x25cfc8){logger[_0x96cf('0xb')](_0x96cf('0xc'),_0x1dc154,'request\x20sent');logger[_0x96cf('0xd')]('Sound,\x20%s,\x20%s,\x20%s',_0x1dc154,'request\x20sent',JSON[_0x96cf('0xe')](_0x25cfc8));if(_0x25cfc8[_0x96cf('0xf')]){if(_0x25cfc8['error'][_0x96cf('0x10')]===0x1f4){logger[_0x96cf('0xf')](_0x96cf('0xc'),_0x1dc154,_0x25cfc8[_0x96cf('0xf')][_0x96cf('0x11')]);return _0x3658a8(_0x25cfc8[_0x96cf('0xf')][_0x96cf('0x11')]);}logger[_0x96cf('0xf')]('Sound,\x20%s,\x20%s',_0x1dc154,_0x25cfc8['error'][_0x96cf('0x11')]);return _0x418227(_0x25cfc8[_0x96cf('0xf')][_0x96cf('0x11')]);}else{logger['info']('Sound,\x20%s,\x20%s',_0x1dc154,_0x96cf('0x12'));_0x418227(_0x25cfc8['result'][_0x96cf('0x11')]);}})[_0x96cf('0x13')](function(_0x2d0c64){logger[_0x96cf('0xf')](_0x96cf('0xc'),_0x1dc154,_0x2d0c64);_0x3658a8(_0x2d0c64);});});}exports['ShowSound']=function(_0x47f915){var _0x33ceb6=this;return new Promise(function(_0x3299d7,_0x4f66ee){return db[_0x96cf('0x14')][_0x96cf('0x15')]({'raw':_0x47f915[_0x96cf('0x16')]?_0x47f915[_0x96cf('0x16')][_0x96cf('0x17')]===undefined?!![]:![]:!![],'where':_0x47f915[_0x96cf('0x16')]?_0x47f915[_0x96cf('0x16')][_0x96cf('0x18')]||null:null,'attributes':_0x47f915[_0x96cf('0x16')]?_0x47f915['options'][_0x96cf('0x19')]||null:null,'include':_0x47f915[_0x96cf('0x16')]?_0x47f915[_0x96cf('0x16')]['include']?_['map'](_0x47f915[_0x96cf('0x16')]['include'],function(_0xfed1f1){return{'model':db[_0xfed1f1[_0x96cf('0x1a')]],'as':_0xfed1f1['as'],'attributes':_0xfed1f1[_0x96cf('0x19')],'include':_0xfed1f1[_0x96cf('0x1b')]?_[_0x96cf('0x1c')](_0xfed1f1['include'],function(_0x52fc2e){return{'model':db[_0x52fc2e[_0x96cf('0x1a')]],'as':_0x52fc2e['as'],'attributes':_0x52fc2e[_0x96cf('0x19')],'include':_0x52fc2e[_0x96cf('0x1b')]?_[_0x96cf('0x1c')](_0x52fc2e[_0x96cf('0x1b')],function(_0x175b7b){return{'model':db[_0x175b7b[_0x96cf('0x1a')]],'as':_0x175b7b['as'],'attributes':_0x175b7b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x27d516){logger[_0x96cf('0xb')](_0x96cf('0x1d'),_0x47f915);logger[_0x96cf('0xd')](_0x96cf('0x1d'),_0x47f915,JSON[_0x96cf('0xe')](_0x27d516));_0x3299d7(_0x27d516);})[_0x96cf('0x13')](function(_0xa4d5ad){logger[_0x96cf('0xf')](_0x96cf('0x1d'),_0xa4d5ad[_0x96cf('0x11')],_0x47f915);_0x4f66ee(_0x33ceb6[_0x96cf('0xf')](0x1f4,_0xa4d5ad['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 3c949b9..4921e8b 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 _0x157d=['./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','connect-timeout','express','Router','../../config/environment'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x157d,0x13e));var _0xd157=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x157d[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xd157('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd157('0x1'));var express=require(_0xd157('0x2'));var router=express[_0xd157('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd157('0x4'));var controller=require(_0xd157('0x5'));router[_0xd157('0x6')]('/',auth[_0xd157('0x7')](),controller[_0xd157('0x8')]);router[_0xd157('0x6')](_0xd157('0x9'),auth['isAuthenticated'](),controller[_0xd157('0xa')]);router[_0xd157('0xb')]('/',auth['isAuthenticated'](),controller[_0xd157('0xc')]);router[_0xd157('0xd')](_0xd157('0x9'),auth[_0xd157('0x7')](),controller[_0xd157('0xe')]);router['delete'](_0xd157('0x9'),auth['isAuthenticated'](),controller[_0xd157('0xf')]);module[_0xd157('0x10')]=router; \ No newline at end of file +var _0x3bbd=['show','post','isAuthenticated','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareMessage.controller','index','get','/:id'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3bbd,0x171));var _0xd3bb=function(_0x7242b9,_0x423621){_0x7242b9=_0x7242b9-0x0;var _0x48eb51=_0x3bbd[_0x7242b9];return _0x48eb51;};'use strict';var multer=require(_0xd3bb('0x0'));var util=require(_0xd3bb('0x1'));var path=require('path');var timeout=require(_0xd3bb('0x2'));var express=require(_0xd3bb('0x3'));var router=express[_0xd3bb('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd3bb('0x5'));var config=require(_0xd3bb('0x6'));var controller=require(_0xd3bb('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xd3bb('0x8')]);router[_0xd3bb('0x9')](_0xd3bb('0xa'),auth['isAuthenticated'](),controller[_0xd3bb('0xb')]);router[_0xd3bb('0xc')]('/',auth[_0xd3bb('0xd')](),controller['create']);router[_0xd3bb('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xd3bb('0xf')]);router[_0xd3bb('0x10')](_0xd3bb('0xa'),auth['isAuthenticated'](),controller[_0xd3bb('0x11')]);module[_0xd3bb('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 3ebcd41..31cf709 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 _0x6f54=['out','sequelize','exports','STRING','medium','ENUM'];(function(_0xbc82c2,_0x514272){var _0x1421d1=function(_0x17b4df){while(--_0x17b4df){_0xbc82c2['push'](_0xbc82c2['shift']());}};_0x1421d1(++_0x514272);}(_0x6f54,0x1ab));var _0x46f5=function(_0x3f08be,_0x1fea44){_0x3f08be=_0x3f08be-0x0;var _0x55f1c9=_0x6f54[_0x3f08be];return _0x55f1c9;};'use strict';var Sequelize=require(_0x46f5('0x0'));module[_0x46f5('0x1')]={'uniqueid':{'type':Sequelize[_0x46f5('0x2')]},'body':{'type':Sequelize['TEXT'](_0x46f5('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x46f5('0x4')]('in',_0x46f5('0x5')),'defaultValue':_0x46f5('0x5'),'allowNull':![]}}; \ No newline at end of file +var _0xbc71=['ENUM','out','exports','STRING','medium'];(function(_0x4853fc,_0x52cd55){var _0x23be73=function(_0x541448){while(--_0x541448){_0x4853fc['push'](_0x4853fc['shift']());}};_0x23be73(++_0x52cd55);}(_0xbc71,0xca));var _0x1bc7=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xbc71[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require('sequelize');module[_0x1bc7('0x0')]={'uniqueid':{'type':Sequelize[_0x1bc7('0x1')]},'body':{'type':Sequelize['TEXT'](_0x1bc7('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x1bc7('0x3')]('in',_0x1bc7('0x4')),'defaultValue':'out','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 6a23f1a..93691e7 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 _0xe728=['reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','SquareMessage','count','includeAll','include','rows','catch','show','params','find','create','body','html-pdf','zip-dir','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply'];(function(_0xfc91c8,_0x3a1001){var _0x85178e=function(_0x1d4f95){while(--_0x1d4f95){_0xfc91c8['push'](_0xfc91c8['shift']());}};_0x85178e(++_0x3a1001);}(_0xe728,0xfc));var _0x8e72=function(_0x3c66c9,_0x47ebc5){_0x3c66c9=_0x3c66c9-0x0;var _0x5580d6=_0xe728[_0x3c66c9];return _0x5580d6;};'use strict';var pdf=require(_0x8e72('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8e72('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8e72('0x2'));var Mustache=require(_0x8e72('0x3'));var util=require(_0x8e72('0x4'));var path=require(_0x8e72('0x5'));var sox=require(_0x8e72('0x6'));var csv=require(_0x8e72('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8e72('0x8'));var squel=require(_0x8e72('0x9'));var crypto=require(_0x8e72('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8e72('0x7'));var querystring=require(_0x8e72('0xb'));var Papa=require('papaparse');var Redis=require(_0x8e72('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x8e72('0xd'));var as=require(_0x8e72('0xe'));var hardwareService=require(_0x8e72('0xf'));var logger=require(_0x8e72('0x10'))('api');var utils=require(_0x8e72('0x11'));var config=require(_0x8e72('0x12'));var db=require(_0x8e72('0x13'))['db'];function respondWithStatusCode(_0x198d9c,_0x5ce37f){_0x5ce37f=_0x5ce37f||0xcc;return function(_0x9b39e3){if(_0x9b39e3){return _0x198d9c[_0x8e72('0x14')](_0x5ce37f);}return _0x198d9c[_0x8e72('0x15')](_0x5ce37f)[_0x8e72('0x16')]();};}function respondWithResult(_0xbd248,_0x3d92b0){_0x3d92b0=_0x3d92b0||0xc8;return function(_0x3013bd){if(_0x3013bd){return _0xbd248[_0x8e72('0x15')](_0x3d92b0)[_0x8e72('0x17')](_0x3013bd);}};}function respondWithFilteredResult(_0x9c3516,_0x22fa01){return function(_0x269c1e){if(_0x269c1e){var _0x229f4e=_0x269c1e['count'],_0x19b552=_0x22fa01[_0x8e72('0x18')],_0x4af83b=_0x22fa01[_0x8e72('0x18')]+_0x22fa01[_0x8e72('0x19')],_0x3d8120;if(_0x4af83b>=_0x229f4e){_0x4af83b=_0x229f4e;_0x3d8120=0xc8;}else{_0x3d8120=0xce;}_0x9c3516[_0x8e72('0x15')](_0x3d8120);return _0x9c3516[_0x8e72('0x1a')]('Content-Range',_0x19b552+'-'+_0x4af83b+'/'+_0x229f4e)[_0x8e72('0x17')](_0x269c1e);}return null;};}function patchUpdates(_0xa16b9e){return function(_0x4c9d91){try{jsonpatch[_0x8e72('0x1b')](_0x4c9d91,_0xa16b9e,!![]);}catch(_0x291d48){return BPromise[_0x8e72('0x1c')](_0x291d48);}return _0x4c9d91[_0x8e72('0x1d')]();};}function saveUpdates(_0x5358c2,_0x441d7a){return function(_0x505844){if(_0x505844){return _0x505844[_0x8e72('0x1e')](_0x5358c2)[_0x8e72('0x1f')](function(_0x25130e){return _0x25130e;});}return null;};}function removeEntity(_0x546157,_0x3d8d03){return function(_0x3ba227){if(_0x3ba227){return _0x3ba227[_0x8e72('0x20')]()[_0x8e72('0x1f')](function(){_0x546157[_0x8e72('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b56c1,_0x1a64a2){return function(_0x250e2f){if(!_0x250e2f){_0x3b56c1[_0x8e72('0x14')](0x194);}return _0x250e2f;};}function handleError(_0x14c6f8,_0x1b8c13){_0x1b8c13=_0x1b8c13||0x1f4;return function(_0x57c56d){logger[_0x8e72('0x21')](_0x57c56d[_0x8e72('0x22')]);if(_0x57c56d[_0x8e72('0x23')]){delete _0x57c56d[_0x8e72('0x23')];}_0x14c6f8[_0x8e72('0x15')](_0x1b8c13)[_0x8e72('0x24')](_0x57c56d);};}exports[_0x8e72('0x25')]=function(_0x50b723,_0x23105b){var _0x16de81={},_0x50bea3={},_0x1f20b8={'count':0x0,'rows':[]};var _0x4f7f21=_[_0x8e72('0x26')](db['SquareMessage'][_0x8e72('0x27')],function(_0x3a1fbc){return{'name':_0x3a1fbc[_0x8e72('0x28')],'type':_0x3a1fbc[_0x8e72('0x29')]['key']};});_0x50bea3['model']=_[_0x8e72('0x26')](_0x4f7f21,'name');_0x50bea3[_0x8e72('0x2a')]=_[_0x8e72('0x2b')](_0x50b723[_0x8e72('0x2a')]);_0x50bea3[_0x8e72('0x2c')]=_[_0x8e72('0x2d')](_0x50bea3[_0x8e72('0x2e')],_0x50bea3[_0x8e72('0x2a')]);_0x16de81[_0x8e72('0x2f')]=_[_0x8e72('0x2d')](_0x50bea3['model'],qs[_0x8e72('0x30')](_0x50b723['query'][_0x8e72('0x30')]));_0x16de81['attributes']=_0x16de81[_0x8e72('0x2f')][_0x8e72('0x31')]?_0x16de81[_0x8e72('0x2f')]:_0x50bea3[_0x8e72('0x2e')];if(!_0x50b723[_0x8e72('0x2a')][_0x8e72('0x32')]('nolimit')){_0x16de81['limit']=qs['limit'](_0x50b723['query']['limit']);_0x16de81[_0x8e72('0x18')]=qs['offset'](_0x50b723[_0x8e72('0x2a')][_0x8e72('0x18')]);}_0x16de81[_0x8e72('0x33')]=qs[_0x8e72('0x34')](_0x50b723['query'][_0x8e72('0x34')]);_0x16de81['where']=qs['filters'](_[_0x8e72('0x35')](_0x50b723[_0x8e72('0x2a')],_0x50bea3['filters']),_0x4f7f21);if(_0x50b723['query'][_0x8e72('0x36')]){_0x16de81[_0x8e72('0x37')]=_[_0x8e72('0x38')](_0x16de81[_0x8e72('0x37')],{'$or':_[_0x8e72('0x26')](_0x4f7f21,function(_0x232058){if(_0x232058[_0x8e72('0x29')]!==_0x8e72('0x39')){var _0x12973d={};_0x12973d[_0x232058[_0x8e72('0x23')]]={'$like':'%'+_0x50b723[_0x8e72('0x2a')][_0x8e72('0x36')]+'%'};return _0x12973d;}})});}_0x16de81=_['merge']({},_0x16de81,_0x50b723[_0x8e72('0x3a')]);var _0x57e816={'where':_0x16de81[_0x8e72('0x37')]};return db[_0x8e72('0x3b')][_0x8e72('0x3c')](_0x57e816)[_0x8e72('0x1f')](function(_0x369c82){_0x1f20b8[_0x8e72('0x3c')]=_0x369c82;if(_0x50b723[_0x8e72('0x2a')][_0x8e72('0x3d')]){_0x16de81[_0x8e72('0x3e')]=[{'all':!![]}];}return db[_0x8e72('0x3b')]['findAll'](_0x16de81);})['then'](function(_0x2ad235){_0x1f20b8[_0x8e72('0x3f')]=_0x2ad235;return _0x1f20b8;})[_0x8e72('0x1f')](respondWithFilteredResult(_0x23105b,_0x16de81))[_0x8e72('0x40')](handleError(_0x23105b,null));};exports[_0x8e72('0x41')]=function(_0x49e522,_0x27cc2b){var _0x3b7aff={'raw':!![],'where':{'id':_0x49e522[_0x8e72('0x42')]['id']}},_0x230aa8={};_0x230aa8[_0x8e72('0x2e')]=_[_0x8e72('0x2b')](db[_0x8e72('0x3b')][_0x8e72('0x27')]);_0x230aa8[_0x8e72('0x2a')]=_[_0x8e72('0x2b')](_0x49e522[_0x8e72('0x2a')]);_0x230aa8[_0x8e72('0x2c')]=_[_0x8e72('0x2d')](_0x230aa8['model'],_0x230aa8[_0x8e72('0x2a')]);_0x3b7aff[_0x8e72('0x2f')]=_['intersection'](_0x230aa8[_0x8e72('0x2e')],qs[_0x8e72('0x30')](_0x49e522[_0x8e72('0x2a')][_0x8e72('0x30')]));_0x3b7aff[_0x8e72('0x2f')]=_0x3b7aff[_0x8e72('0x2f')]['length']?_0x3b7aff[_0x8e72('0x2f')]:_0x230aa8[_0x8e72('0x2e')];if(_0x49e522[_0x8e72('0x2a')][_0x8e72('0x3d')]){_0x3b7aff['include']=[{'all':!![]}];}_0x3b7aff=_[_0x8e72('0x38')]({},_0x3b7aff,_0x49e522['options']);return db['SquareMessage'][_0x8e72('0x43')](_0x3b7aff)[_0x8e72('0x1f')](handleEntityNotFound(_0x27cc2b,null))[_0x8e72('0x1f')](respondWithResult(_0x27cc2b,null))['catch'](handleError(_0x27cc2b,null));};exports[_0x8e72('0x44')]=function(_0x744f02,_0x579e7f){return db[_0x8e72('0x3b')][_0x8e72('0x44')](_0x744f02['body'],{})[_0x8e72('0x1f')](respondWithResult(_0x579e7f,0xc9))[_0x8e72('0x40')](handleError(_0x579e7f,null));};exports[_0x8e72('0x1e')]=function(_0x5f05b7,_0x6af20b){if(_0x5f05b7[_0x8e72('0x45')]['id']){delete _0x5f05b7['body']['id'];}return db[_0x8e72('0x3b')][_0x8e72('0x43')]({'where':{'id':_0x5f05b7[_0x8e72('0x42')]['id']}})[_0x8e72('0x1f')](handleEntityNotFound(_0x6af20b,null))['then'](saveUpdates(_0x5f05b7[_0x8e72('0x45')],null))[_0x8e72('0x1f')](respondWithResult(_0x6af20b,null))[_0x8e72('0x40')](handleError(_0x6af20b,null));};exports['destroy']=function(_0x470cd9,_0x2ff547){return db['SquareMessage']['find']({'where':{'id':_0x470cd9[_0x8e72('0x42')]['id']}})['then'](handleEntityNotFound(_0x2ff547,null))[_0x8e72('0x1f')](removeEntity(_0x2ff547,null))[_0x8e72('0x40')](handleError(_0x2ff547,null));}; \ No newline at end of file +var _0xc33a=['create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','SquareMessage','includeAll','findAll','rows','catch','params','keys','length','include','options','find'];(function(_0x54b4a4,_0x2f0fd9){var _0x4897b7=function(_0x4a446e){while(--_0x4a446e){_0x54b4a4['push'](_0x54b4a4['shift']());}};_0x4897b7(++_0x2f0fd9);}(_0xc33a,0x126));var _0xac33=function(_0x1d426f,_0x37e919){_0x1d426f=_0x1d426f-0x0;var _0x17f71a=_0xc33a[_0x1d426f];return _0x17f71a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xac33('0x0'));var zipdir=require(_0xac33('0x1'));var jsonpatch=require(_0xac33('0x2'));var rp=require(_0xac33('0x3'));var moment=require(_0xac33('0x4'));var BPromise=require(_0xac33('0x5'));var Mustache=require('mustache');var util=require(_0xac33('0x6'));var path=require(_0xac33('0x7'));var sox=require(_0xac33('0x8'));var csv=require(_0xac33('0x9'));var ejs=require(_0xac33('0xa'));var fs=require('fs');var _=require(_0xac33('0xb'));var squel=require(_0xac33('0xc'));var crypto=require(_0xac33('0xd'));var jsforce=require(_0xac33('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xac33('0xf'));var Papa=require('papaparse');var Redis=require(_0xac33('0x10'));var authService=require(_0xac33('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xac33('0x12'));var hardwareService=require(_0xac33('0x13'));var logger=require(_0xac33('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xac33('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14658e,_0x10bfd9){_0x10bfd9=_0x10bfd9||0xcc;return function(_0x339ef3){if(_0x339ef3){return _0x14658e[_0xac33('0x16')](_0x10bfd9);}return _0x14658e[_0xac33('0x17')](_0x10bfd9)[_0xac33('0x18')]();};}function respondWithResult(_0xf64fe2,_0x2e5174){_0x2e5174=_0x2e5174||0xc8;return function(_0x2bd8a1){if(_0x2bd8a1){return _0xf64fe2[_0xac33('0x17')](_0x2e5174)['json'](_0x2bd8a1);}};}function respondWithFilteredResult(_0x343887,_0x95a980){return function(_0x38ca2c){if(_0x38ca2c){var _0x5dd6de=_0x38ca2c[_0xac33('0x19')],_0x3dcded=_0x95a980['offset'],_0x892855=_0x95a980[_0xac33('0x1a')]+_0x95a980['limit'],_0x32b705;if(_0x892855>=_0x5dd6de){_0x892855=_0x5dd6de;_0x32b705=0xc8;}else{_0x32b705=0xce;}_0x343887[_0xac33('0x17')](_0x32b705);return _0x343887[_0xac33('0x1b')](_0xac33('0x1c'),_0x3dcded+'-'+_0x892855+'/'+_0x5dd6de)[_0xac33('0x1d')](_0x38ca2c);}return null;};}function patchUpdates(_0x22f9c4){return function(_0x350e98){try{jsonpatch[_0xac33('0x1e')](_0x350e98,_0x22f9c4,!![]);}catch(_0x423535){return BPromise[_0xac33('0x1f')](_0x423535);}return _0x350e98['save']();};}function saveUpdates(_0x197d30,_0x567ab2){return function(_0x5e9e8d){if(_0x5e9e8d){return _0x5e9e8d[_0xac33('0x20')](_0x197d30)[_0xac33('0x21')](function(_0x3f4782){return _0x3f4782;});}return null;};}function removeEntity(_0xe0dec1,_0x27325d){return function(_0x109edb){if(_0x109edb){return _0x109edb[_0xac33('0x22')]()[_0xac33('0x21')](function(){_0xe0dec1[_0xac33('0x17')](0xcc)[_0xac33('0x18')]();});}};}function handleEntityNotFound(_0x54072a,_0x944c0c){return function(_0x13754a){if(!_0x13754a){_0x54072a[_0xac33('0x16')](0x194);}return _0x13754a;};}function handleError(_0x5e1c6d,_0x14e638){_0x14e638=_0x14e638||0x1f4;return function(_0x539cff){logger[_0xac33('0x23')](_0x539cff[_0xac33('0x24')]);if(_0x539cff[_0xac33('0x25')]){delete _0x539cff[_0xac33('0x25')];}_0x5e1c6d[_0xac33('0x17')](_0x14e638)[_0xac33('0x26')](_0x539cff);};}exports[_0xac33('0x27')]=function(_0x41717b,_0x33c663){var _0x125daa={},_0x259802={},_0xa1573b={'count':0x0,'rows':[]};var _0x49cb2f=_[_0xac33('0x28')](db['SquareMessage'][_0xac33('0x29')],function(_0x49a70a){return{'name':_0x49a70a[_0xac33('0x2a')],'type':_0x49a70a[_0xac33('0x2b')][_0xac33('0x2c')]};});_0x259802[_0xac33('0x2d')]=_[_0xac33('0x28')](_0x49cb2f,'name');_0x259802[_0xac33('0x2e')]=_['keys'](_0x41717b[_0xac33('0x2e')]);_0x259802[_0xac33('0x2f')]=_[_0xac33('0x30')](_0x259802['model'],_0x259802[_0xac33('0x2e')]);_0x125daa['attributes']=_[_0xac33('0x30')](_0x259802[_0xac33('0x2d')],qs[_0xac33('0x31')](_0x41717b[_0xac33('0x2e')][_0xac33('0x31')]));_0x125daa[_0xac33('0x32')]=_0x125daa['attributes']['length']?_0x125daa[_0xac33('0x32')]:_0x259802['model'];if(!_0x41717b[_0xac33('0x2e')][_0xac33('0x33')](_0xac33('0x34'))){_0x125daa[_0xac33('0x35')]=qs[_0xac33('0x35')](_0x41717b[_0xac33('0x2e')][_0xac33('0x35')]);_0x125daa[_0xac33('0x1a')]=qs[_0xac33('0x1a')](_0x41717b[_0xac33('0x2e')]['offset']);}_0x125daa['order']=qs['sort'](_0x41717b[_0xac33('0x2e')][_0xac33('0x36')]);_0x125daa[_0xac33('0x37')]=qs[_0xac33('0x2f')](_[_0xac33('0x38')](_0x41717b[_0xac33('0x2e')],_0x259802[_0xac33('0x2f')]),_0x49cb2f);if(_0x41717b[_0xac33('0x2e')][_0xac33('0x39')]){_0x125daa[_0xac33('0x37')]=_[_0xac33('0x3a')](_0x125daa[_0xac33('0x37')],{'$or':_['map'](_0x49cb2f,function(_0x23d7f6){if(_0x23d7f6['type']!==_0xac33('0x3b')){var _0x542e8b={};_0x542e8b[_0x23d7f6[_0xac33('0x25')]]={'$like':'%'+_0x41717b[_0xac33('0x2e')][_0xac33('0x39')]+'%'};return _0x542e8b;}})});}_0x125daa=_[_0xac33('0x3a')]({},_0x125daa,_0x41717b['options']);var _0x45b199={'where':_0x125daa['where']};return db[_0xac33('0x3c')][_0xac33('0x19')](_0x45b199)[_0xac33('0x21')](function(_0x3451ec){_0xa1573b[_0xac33('0x19')]=_0x3451ec;if(_0x41717b[_0xac33('0x2e')][_0xac33('0x3d')]){_0x125daa['include']=[{'all':!![]}];}return db[_0xac33('0x3c')][_0xac33('0x3e')](_0x125daa);})[_0xac33('0x21')](function(_0x54bf1b){_0xa1573b[_0xac33('0x3f')]=_0x54bf1b;return _0xa1573b;})[_0xac33('0x21')](respondWithFilteredResult(_0x33c663,_0x125daa))[_0xac33('0x40')](handleError(_0x33c663,null));};exports['show']=function(_0x32f150,_0x37eee6){var _0x4875ec={'raw':!![],'where':{'id':_0x32f150[_0xac33('0x41')]['id']}},_0xf1ea67={};_0xf1ea67[_0xac33('0x2d')]=_[_0xac33('0x42')](db[_0xac33('0x3c')]['rawAttributes']);_0xf1ea67[_0xac33('0x2e')]=_[_0xac33('0x42')](_0x32f150['query']);_0xf1ea67[_0xac33('0x2f')]=_[_0xac33('0x30')](_0xf1ea67[_0xac33('0x2d')],_0xf1ea67[_0xac33('0x2e')]);_0x4875ec[_0xac33('0x32')]=_[_0xac33('0x30')](_0xf1ea67[_0xac33('0x2d')],qs['fields'](_0x32f150[_0xac33('0x2e')][_0xac33('0x31')]));_0x4875ec[_0xac33('0x32')]=_0x4875ec['attributes'][_0xac33('0x43')]?_0x4875ec[_0xac33('0x32')]:_0xf1ea67[_0xac33('0x2d')];if(_0x32f150[_0xac33('0x2e')][_0xac33('0x3d')]){_0x4875ec[_0xac33('0x44')]=[{'all':!![]}];}_0x4875ec=_['merge']({},_0x4875ec,_0x32f150[_0xac33('0x45')]);return db['SquareMessage'][_0xac33('0x46')](_0x4875ec)['then'](handleEntityNotFound(_0x37eee6,null))['then'](respondWithResult(_0x37eee6,null))[_0xac33('0x40')](handleError(_0x37eee6,null));};exports[_0xac33('0x47')]=function(_0x3137e7,_0x3bac6e){return db['SquareMessage'][_0xac33('0x47')](_0x3137e7[_0xac33('0x48')],{})['then'](respondWithResult(_0x3bac6e,0xc9))[_0xac33('0x40')](handleError(_0x3bac6e,null));};exports[_0xac33('0x20')]=function(_0x746a4c,_0x38802c){if(_0x746a4c[_0xac33('0x48')]['id']){delete _0x746a4c[_0xac33('0x48')]['id'];}return db['SquareMessage'][_0xac33('0x46')]({'where':{'id':_0x746a4c[_0xac33('0x41')]['id']}})[_0xac33('0x21')](handleEntityNotFound(_0x38802c,null))[_0xac33('0x21')](saveUpdates(_0x746a4c[_0xac33('0x48')],null))['then'](respondWithResult(_0x38802c,null))['catch'](handleError(_0x38802c,null));};exports[_0xac33('0x22')]=function(_0x4d1075,_0x2f67b9){return db[_0xac33('0x3c')][_0xac33('0x46')]({'where':{'id':_0x4d1075[_0xac33('0x41')]['id']}})[_0xac33('0x21')](handleEntityNotFound(_0x2f67b9,null))[_0xac33('0x21')](removeEntity(_0x2f67b9,null))[_0xac33('0x40')](handleError(_0x2f67b9,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 26f26e2..483b6da 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 _0x814b=['define','SquareMessage','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes','exports'];(function(_0x1ccbc7,_0x4ee7da){var _0x350dd1=function(_0x18eedb){while(--_0x18eedb){_0x1ccbc7['push'](_0x1ccbc7['shift']());}};_0x350dd1(++_0x4ee7da);}(_0x814b,0x1a2));var _0xb814=function(_0x161f59,_0x42e9ff){_0x161f59=_0x161f59-0x0;var _0x3ffa0e=_0x814b[_0x161f59];return _0x3ffa0e;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages','lodash','util'];(function(_0x2e50f1,_0x4b3469){var _0x42ac15=function(_0x32c440){while(--_0x32c440){_0x2e50f1['push'](_0x2e50f1['shift']());}};_0x42ac15(++_0x4b3469);}(_0x7a54,0x106));var _0x47a5=function(_0x375f05,_0x10a4ea){_0x375f05=_0x375f05-0x0;var _0x71cd1f=_0x7a54[_0x375f05];return _0x71cd1f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 3259eb8..cb016d1 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 _0x8458=['body','options','raw','debug','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','CreateSquareMessage'];(function(_0x32c4d0,_0x4eded1){var _0x4b235c=function(_0x26cb8b){while(--_0x26cb8b){_0x32c4d0['push'](_0x32c4d0['shift']());}};_0x4b235c(++_0x4eded1);}(_0x8458,0x1a5));var _0x8845=function(_0x26e121,_0x4dd9a5){_0x26e121=_0x26e121-0x0;var _0x308357=_0x8458[_0x26e121];return _0x308357;};'use strict';var _=require(_0x8845('0x0'));var util=require('util');var moment=require(_0x8845('0x1'));var BPromise=require(_0x8845('0x2'));var rs=require(_0x8845('0x3'));var fs=require('fs');var Redis=require(_0x8845('0x4'));var db=require(_0x8845('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8845('0x6'))(_0x8845('0x7'));var config=require(_0x8845('0x8'));var jayson=require(_0x8845('0x9'));var client=jayson[_0x8845('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c4099,_0x59d900,_0x2a91b4){return new BPromise(function(_0x3067d1,_0xd94398){return client['request'](_0x3c4099,_0x2a91b4)[_0x8845('0xb')](function(_0x33b0dc){logger['info'](_0x8845('0xc'),_0x59d900,_0x8845('0xd'));logger['debug'](_0x8845('0xe'),_0x59d900,_0x8845('0xd'),JSON[_0x8845('0xf')](_0x33b0dc));if(_0x33b0dc[_0x8845('0x10')]){if(_0x33b0dc[_0x8845('0x10')][_0x8845('0x11')]===0x1f4){logger[_0x8845('0x10')](_0x8845('0xc'),_0x59d900,_0x33b0dc[_0x8845('0x10')][_0x8845('0x12')]);return _0xd94398(_0x33b0dc[_0x8845('0x10')][_0x8845('0x12')]);}logger[_0x8845('0x10')](_0x8845('0xc'),_0x59d900,_0x33b0dc['error'][_0x8845('0x12')]);return _0x3067d1(_0x33b0dc[_0x8845('0x10')]['message']);}else{logger[_0x8845('0x13')](_0x8845('0xc'),_0x59d900,_0x8845('0xd'));_0x3067d1(_0x33b0dc['result']['message']);}})['catch'](function(_0x3c3864){logger[_0x8845('0x10')](_0x8845('0xc'),_0x59d900,_0x3c3864);_0xd94398(_0x3c3864);});});}exports[_0x8845('0x14')]=function(_0x10f1d5){var _0x27761f=this;return new Promise(function(_0x433170,_0x49c56a){return db['SquareMessage']['create'](_0x10f1d5[_0x8845('0x15')],{'raw':_0x10f1d5[_0x8845('0x16')]?_0x10f1d5[_0x8845('0x16')][_0x8845('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x2e94f5){logger['info']('CreateSquareMessage',_0x10f1d5);logger[_0x8845('0x18')](_0x8845('0x14'),_0x10f1d5,JSON['stringify'](_0x2e94f5));_0x433170(_0x2e94f5);})[_0x8845('0x19')](function(_0x23a0d3){logger['error'](_0x8845('0x14'),_0x23a0d3[_0x8845('0x12')],_0x10f1d5);_0x49c56a(_0x27761f[_0x8845('0x10')](0x1f4,_0x23a0d3[_0x8845('0x12')]));});});}; \ No newline at end of file +var _0x14b2=['code','message','info','result','CreateSquareMessage','SquareMessage','create','body','options','raw','then','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','SquareMessage,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x317ff1,_0x5117df){var _0x1f3dd3=function(_0x1abbba){while(--_0x1abbba){_0x317ff1['push'](_0x317ff1['shift']());}};_0x1f3dd3(++_0x5117df);}(_0x14b2,0x1a1));var _0x214b=function(_0x799d17,_0x3a1444){_0x799d17=_0x799d17-0x0;var _0x550838=_0x14b2[_0x799d17];return _0x550838;};'use strict';var _=require(_0x214b('0x0'));var util=require(_0x214b('0x1'));var moment=require('moment');var BPromise=require(_0x214b('0x2'));var rs=require(_0x214b('0x3'));var fs=require('fs');var Redis=require(_0x214b('0x4'));var db=require(_0x214b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x214b('0x6'))(_0x214b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x214b('0x8')][_0x214b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30867e,_0x3003ab,_0x188bab){return new BPromise(function(_0x117ddd,_0x4cd18e){return client[_0x214b('0xa')](_0x30867e,_0x188bab)['then'](function(_0x232e01){logger['info'](_0x214b('0xb'),_0x3003ab,'request\x20sent');logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0x3003ab,_0x214b('0xc'),JSON[_0x214b('0xd')](_0x232e01));if(_0x232e01['error']){if(_0x232e01[_0x214b('0xe')][_0x214b('0xf')]===0x1f4){logger[_0x214b('0xe')]('SquareMessage,\x20%s,\x20%s',_0x3003ab,_0x232e01[_0x214b('0xe')]['message']);return _0x4cd18e(_0x232e01['error'][_0x214b('0x10')]);}logger[_0x214b('0xe')](_0x214b('0xb'),_0x3003ab,_0x232e01[_0x214b('0xe')][_0x214b('0x10')]);return _0x117ddd(_0x232e01[_0x214b('0xe')]['message']);}else{logger[_0x214b('0x11')]('SquareMessage,\x20%s,\x20%s',_0x3003ab,_0x214b('0xc'));_0x117ddd(_0x232e01[_0x214b('0x12')][_0x214b('0x10')]);}})['catch'](function(_0x4d2557){logger[_0x214b('0xe')]('SquareMessage,\x20%s,\x20%s',_0x3003ab,_0x4d2557);_0x4cd18e(_0x4d2557);});});}exports[_0x214b('0x13')]=function(_0xbe4932){var _0x4d42e6=this;return new Promise(function(_0x25e18a,_0x4cc219){return db[_0x214b('0x14')][_0x214b('0x15')](_0xbe4932[_0x214b('0x16')],{'raw':_0xbe4932['options']?_0xbe4932[_0x214b('0x17')][_0x214b('0x18')]===undefined?!![]:![]:!![]})[_0x214b('0x19')](function(_0x3dc351){logger[_0x214b('0x11')]('CreateSquareMessage',_0xbe4932);logger['debug'](_0x214b('0x13'),_0xbe4932,JSON[_0x214b('0xd')](_0x3dc351));_0x25e18a(_0x3dc351);})[_0x214b('0x1a')](function(_0x2ddfe4){logger['error'](_0x214b('0x13'),_0x2ddfe4[_0x214b('0x10')],_0xbe4932);_0x4cc219(_0x4d42e6[_0x214b('0xe')](0x1f4,_0x2ddfe4[_0x214b('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 40b1bea..c93ce78 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 _0x7d91=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','/:id','isAuthenticated','show','/:id/test','15s','post','create','put','exports','util'];(function(_0x29e7f0,_0x56e947){var _0x391b64=function(_0x2541f9){while(--_0x2541f9){_0x29e7f0['push'](_0x29e7f0['shift']());}};_0x391b64(++_0x56e947);}(_0x7d91,0x10f));var _0x17d9=function(_0x45dacb,_0x4b50b2){_0x45dacb=_0x45dacb-0x0;var _0x1b8c13=_0x7d91[_0x45dacb];return _0x1b8c13;};'use strict';var multer=require('multer');var util=require(_0x17d9('0x0'));var path=require('path');var timeout=require(_0x17d9('0x1'));var express=require(_0x17d9('0x2'));var router=express[_0x17d9('0x3')]();var auth=require(_0x17d9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x17d9('0x5'));var controller=require(_0x17d9('0x6'));router[_0x17d9('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x17d9('0x8'),auth[_0x17d9('0x9')](),controller[_0x17d9('0xa')]);router[_0x17d9('0x7')](_0x17d9('0xb'),auth['isAuthenticated'](),timeout(_0x17d9('0xc')),controller['test']);router[_0x17d9('0xd')]('/',auth[_0x17d9('0x9')](),controller[_0x17d9('0xe')]);router[_0x17d9('0xf')](_0x17d9('0x8'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x17d9('0x8'),auth[_0x17d9('0x9')](),controller['destroy']);module[_0x17d9('0x10')]=router; \ No newline at end of file +var _0x8eab=['isAuthenticated','/:id','/:id/test','15s','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get'];(function(_0x4c8566,_0x19063c){var _0x26c6a3=function(_0x4dad82){while(--_0x4dad82){_0x4c8566['push'](_0x4c8566['shift']());}};_0x26c6a3(++_0x19063c);}(_0x8eab,0xee));var _0xb8ea=function(_0x3beec7,_0x12439e){_0x3beec7=_0x3beec7-0x0;var _0x42485a=_0x8eab[_0x3beec7];return _0x42485a;};'use strict';var multer=require(_0xb8ea('0x0'));var util=require(_0xb8ea('0x1'));var path=require('path');var timeout=require(_0xb8ea('0x2'));var express=require(_0xb8ea('0x3'));var router=express[_0xb8ea('0x4')]();var auth=require(_0xb8ea('0x5'));var interaction=require(_0xb8ea('0x6'));var config=require('../../config/environment');var controller=require(_0xb8ea('0x7'));router[_0xb8ea('0x8')]('/',auth[_0xb8ea('0x9')](),controller['index']);router[_0xb8ea('0x8')](_0xb8ea('0xa'),auth[_0xb8ea('0x9')](),controller['show']);router[_0xb8ea('0x8')](_0xb8ea('0xb'),auth[_0xb8ea('0x9')](),timeout(_0xb8ea('0xc')),controller['test']);router[_0xb8ea('0xd')]('/',auth[_0xb8ea('0x9')](),controller[_0xb8ea('0xe')]);router[_0xb8ea('0xf')](_0xb8ea('0xa'),auth[_0xb8ea('0x9')](),controller[_0xb8ea('0x10')]);router[_0xb8ea('0x11')]('/:id',auth[_0xb8ea('0x9')](),controller[_0xb8ea('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 0dc851e..b26ee1e 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 _0xd530=['name','sequelize','exports','STRING'];(function(_0x398423,_0x227dbe){var _0x5e9555=function(_0x5bee5f){while(--_0x5bee5f){_0x398423['push'](_0x398423['shift']());}};_0x5e9555(++_0x227dbe);}(_0xd530,0xdd));var _0x0d53=function(_0x43beb7,_0x339a88){_0x43beb7=_0x43beb7-0x0;var _0xc06e66=_0xd530[_0x43beb7];return _0xc06e66;};'use strict';var Sequelize=require(_0x0d53('0x0'));module[_0x0d53('0x1')]={'name':{'type':Sequelize[_0x0d53('0x2')],'unique':_0x0d53('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x0d53('0x2')]},'description':{'type':Sequelize[_0x0d53('0x2')]}}; \ No newline at end of file +var _0x3f11=['sequelize','STRING'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x3f11,0x7a));var _0x13f1=function(_0x311c75,_0x25dba0){_0x311c75=_0x311c75-0x0;var _0x5a7a4d=_0x3f11[_0x311c75];return _0x5a7a4d;};'use strict';var Sequelize=require(_0x13f1('0x0'));module['exports']={'name':{'type':Sequelize[_0x13f1('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x13f1('0x1')]},'description':{'type':Sequelize[_0x13f1('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 9f39389..11694a7 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 _0x5613=['../../mysqldb','status','offset','limit','set','apply','reject','then','destroy','get','ODBC','UserProfileResource','end','error','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','test','dsn','odbc','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5613,0x8f));var _0x3561=function(_0x89a540,_0x36e397){_0x89a540=_0x89a540-0x0;var _0x22794d=_0x5613[_0x89a540];return _0x22794d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3561('0x0'));var rimraf=require(_0x3561('0x1'));var zipdir=require(_0x3561('0x2'));var jsonpatch=require(_0x3561('0x3'));var rp=require(_0x3561('0x4'));var moment=require(_0x3561('0x5'));var BPromise=require(_0x3561('0x6'));var Mustache=require('mustache');var util=require(_0x3561('0x7'));var path=require(_0x3561('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3561('0x9'));var squel=require('squel');var crypto=require(_0x3561('0xa'));var jsforce=require(_0x3561('0xb'));var deskjs=require(_0x3561('0xc'));var toCsv=require(_0x3561('0xd'));var querystring=require(_0x3561('0xe'));var Papa=require(_0x3561('0xf'));var Redis=require(_0x3561('0x10'));var authService=require(_0x3561('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3561('0x12'))(_0x3561('0x13'));var utils=require('../../config/utils');var config=require(_0x3561('0x14'));var db=require(_0x3561('0x15'))['db'];function respondWithStatusCode(_0x1c3652,_0x109003){_0x109003=_0x109003||0xcc;return function(_0x1be381){if(_0x1be381){return _0x1c3652['sendStatus'](_0x109003);}return _0x1c3652[_0x3561('0x16')](_0x109003)['end']();};}function respondWithResult(_0x2c206e,_0x1343a6){_0x1343a6=_0x1343a6||0xc8;return function(_0x3511e6){if(_0x3511e6){return _0x2c206e['status'](_0x1343a6)['json'](_0x3511e6);}};}function respondWithFilteredResult(_0x11237b,_0x5a5927){return function(_0x2d9dbc){if(_0x2d9dbc){var _0x538a6f=_0x2d9dbc['count'],_0x399aaa=_0x5a5927[_0x3561('0x17')],_0x1f24e7=_0x5a5927[_0x3561('0x17')]+_0x5a5927[_0x3561('0x18')],_0x481b61;if(_0x1f24e7>=_0x538a6f){_0x1f24e7=_0x538a6f;_0x481b61=0xc8;}else{_0x481b61=0xce;}_0x11237b[_0x3561('0x16')](_0x481b61);return _0x11237b[_0x3561('0x19')]('Content-Range',_0x399aaa+'-'+_0x1f24e7+'/'+_0x538a6f)['json'](_0x2d9dbc);}return null;};}function patchUpdates(_0x4cfed8){return function(_0x185365){try{jsonpatch[_0x3561('0x1a')](_0x185365,_0x4cfed8,!![]);}catch(_0xade305){return BPromise[_0x3561('0x1b')](_0xade305);}return _0x185365['save']();};}function saveUpdates(_0x345f65,_0x1a15c7){return function(_0x11985f){if(_0x11985f){return _0x11985f['update'](_0x345f65)[_0x3561('0x1c')](function(_0x1b7b95){return _0x1b7b95;});}return null;};}function removeEntity(_0x562b2c,_0x4aff29){return function(_0x435771){if(_0x435771){return _0x435771[_0x3561('0x1d')]()[_0x3561('0x1c')](function(){var _0x5d43de=_0x435771[_0x3561('0x1e')]({'plain':!![]});var _0x2916c0=_0x3561('0x1f');return db[_0x3561('0x20')][_0x3561('0x1d')]({'where':{'type':_0x2916c0,'resourceId':_0x5d43de['id']}})['then'](function(){return _0x435771;});})[_0x3561('0x1c')](function(){_0x562b2c[_0x3561('0x16')](0xcc)[_0x3561('0x21')]();});}};}function handleEntityNotFound(_0x25f496,_0x16d009){return function(_0x1a9e60){if(!_0x1a9e60){_0x25f496['sendStatus'](0x194);}return _0x1a9e60;};}function handleError(_0x860487,_0x4ad5d5){_0x4ad5d5=_0x4ad5d5||0x1f4;return function(_0x3ba704){logger[_0x3561('0x22')](_0x3ba704[_0x3561('0x23')]);if(_0x3ba704[_0x3561('0x24')]){delete _0x3ba704[_0x3561('0x24')];}_0x860487[_0x3561('0x16')](_0x4ad5d5)[_0x3561('0x25')](_0x3ba704);};}exports['index']=function(_0x133ecc,_0x3f6189){var _0x2beede={},_0xcb843c={},_0x4b2e13={'count':0x0,'rows':[]};var _0x4639d9=_[_0x3561('0x26')](db[_0x3561('0x27')][_0x3561('0x28')],function(_0x4a759c){return{'name':_0x4a759c[_0x3561('0x29')],'type':_0x4a759c[_0x3561('0x2a')][_0x3561('0x2b')]};});_0xcb843c[_0x3561('0x2c')]=_['map'](_0x4639d9,_0x3561('0x24'));_0xcb843c[_0x3561('0x2d')]=_['keys'](_0x133ecc[_0x3561('0x2d')]);_0xcb843c[_0x3561('0x2e')]=_[_0x3561('0x2f')](_0xcb843c[_0x3561('0x2c')],_0xcb843c[_0x3561('0x2d')]);_0x2beede['attributes']=_[_0x3561('0x2f')](_0xcb843c[_0x3561('0x2c')],qs[_0x3561('0x30')](_0x133ecc[_0x3561('0x2d')][_0x3561('0x30')]));_0x2beede[_0x3561('0x31')]=_0x2beede[_0x3561('0x31')]['length']?_0x2beede[_0x3561('0x31')]:_0xcb843c[_0x3561('0x2c')];if(!_0x133ecc[_0x3561('0x2d')][_0x3561('0x32')](_0x3561('0x33'))){_0x2beede[_0x3561('0x18')]=qs['limit'](_0x133ecc['query'][_0x3561('0x18')]);_0x2beede[_0x3561('0x17')]=qs['offset'](_0x133ecc[_0x3561('0x2d')]['offset']);}_0x2beede[_0x3561('0x34')]=qs[_0x3561('0x35')](_0x133ecc[_0x3561('0x2d')][_0x3561('0x35')]);_0x2beede[_0x3561('0x36')]=qs['filters'](_['pick'](_0x133ecc[_0x3561('0x2d')],_0xcb843c[_0x3561('0x2e')]),_0x4639d9);if(_0x133ecc[_0x3561('0x2d')]['filter']){_0x2beede[_0x3561('0x36')]=_['merge'](_0x2beede[_0x3561('0x36')],{'$or':_[_0x3561('0x26')](_0x4639d9,function(_0x42ce39){if(_0x42ce39[_0x3561('0x2a')]!=='VIRTUAL'){var _0x2f1c76={};_0x2f1c76[_0x42ce39[_0x3561('0x24')]]={'$like':'%'+_0x133ecc[_0x3561('0x2d')][_0x3561('0x37')]+'%'};return _0x2f1c76;}})});}_0x2beede=_[_0x3561('0x38')]({},_0x2beede,_0x133ecc[_0x3561('0x39')]);var _0x1ffc6e={'where':_0x2beede[_0x3561('0x36')]};return db[_0x3561('0x27')]['count'](_0x1ffc6e)[_0x3561('0x1c')](function(_0x5db2e8){_0x4b2e13[_0x3561('0x3a')]=_0x5db2e8;if(_0x133ecc['query'][_0x3561('0x3b')]){_0x2beede[_0x3561('0x3c')]=[{'all':!![]}];}return db[_0x3561('0x27')][_0x3561('0x3d')](_0x2beede);})[_0x3561('0x1c')](function(_0x42551a){_0x4b2e13[_0x3561('0x3e')]=_0x42551a;return _0x4b2e13;})[_0x3561('0x1c')](respondWithFilteredResult(_0x3f6189,_0x2beede))[_0x3561('0x3f')](handleError(_0x3f6189,null));};exports[_0x3561('0x40')]=function(_0x31251a,_0x1e7433){var _0xc17f88={'raw':!![],'where':{'id':_0x31251a[_0x3561('0x41')]['id']}},_0x28412f={};_0x28412f[_0x3561('0x2c')]=_[_0x3561('0x42')](db['SquareOdbc'][_0x3561('0x28')]);_0x28412f[_0x3561('0x2d')]=_[_0x3561('0x42')](_0x31251a[_0x3561('0x2d')]);_0x28412f[_0x3561('0x2e')]=_[_0x3561('0x2f')](_0x28412f['model'],_0x28412f[_0x3561('0x2d')]);_0xc17f88[_0x3561('0x31')]=_[_0x3561('0x2f')](_0x28412f[_0x3561('0x2c')],qs[_0x3561('0x30')](_0x31251a[_0x3561('0x2d')][_0x3561('0x30')]));_0xc17f88[_0x3561('0x31')]=_0xc17f88[_0x3561('0x31')][_0x3561('0x43')]?_0xc17f88[_0x3561('0x31')]:_0x28412f['model'];if(_0x31251a[_0x3561('0x2d')][_0x3561('0x3b')]){_0xc17f88['include']=[{'all':!![]}];}_0xc17f88=_[_0x3561('0x38')]({},_0xc17f88,_0x31251a[_0x3561('0x39')]);return db[_0x3561('0x27')]['find'](_0xc17f88)[_0x3561('0x1c')](handleEntityNotFound(_0x1e7433,null))[_0x3561('0x1c')](respondWithResult(_0x1e7433,null))[_0x3561('0x3f')](handleError(_0x1e7433,null));};exports[_0x3561('0x44')]=function(_0x2e70e4,_0x359337){return db[_0x3561('0x27')]['create'](_0x2e70e4['body'],{})[_0x3561('0x1c')](function(_0x5132c7){var _0x2b7929=_0x2e70e4[_0x3561('0x45')]['get']({'plain':!![]});if(!_0x2b7929)throw new Error(_0x3561('0x46'));if(_0x2b7929['role']==='user'){var _0x34ef4f=_0x5132c7[_0x3561('0x1e')]({'plain':!![]});var _0x29ab77='ODBC';return db[_0x3561('0x47')][_0x3561('0x48')]({'where':{'name':_0x29ab77,'userProfileId':_0x2b7929[_0x3561('0x49')]},'raw':!![]})[_0x3561('0x1c')](function(_0x5417f3){if(_0x5417f3&&_0x5417f3[_0x3561('0x4a')]===0x0){return db[_0x3561('0x20')]['create']({'name':_0x34ef4f[_0x3561('0x24')],'resourceId':_0x34ef4f['id'],'type':_0x5417f3[_0x3561('0x24')],'sectionId':_0x5417f3['id']},{})['then'](function(){return _0x5132c7;});}else{return _0x5132c7;}})[_0x3561('0x3f')](function(_0xf1d72d){logger[_0x3561('0x22')](_0x3561('0x4b'),_0xf1d72d);throw _0xf1d72d;});}return _0x5132c7;})[_0x3561('0x1c')](respondWithResult(_0x359337,0xc9))[_0x3561('0x3f')](handleError(_0x359337,null));};exports[_0x3561('0x4c')]=function(_0x252541,_0x5c1448){if(_0x252541[_0x3561('0x4d')]['id']){delete _0x252541[_0x3561('0x4d')]['id'];}return db[_0x3561('0x27')][_0x3561('0x48')]({'where':{'id':_0x252541[_0x3561('0x41')]['id']}})[_0x3561('0x1c')](handleEntityNotFound(_0x5c1448,null))[_0x3561('0x1c')](saveUpdates(_0x252541[_0x3561('0x4d')],null))[_0x3561('0x1c')](respondWithResult(_0x5c1448,null))[_0x3561('0x3f')](handleError(_0x5c1448,null));};exports[_0x3561('0x1d')]=function(_0x55fea1,_0x1bb0a4){return db[_0x3561('0x27')][_0x3561('0x48')]({'where':{'id':_0x55fea1[_0x3561('0x41')]['id']}})[_0x3561('0x1c')](handleEntityNotFound(_0x1bb0a4,null))[_0x3561('0x1c')](removeEntity(_0x1bb0a4,null))[_0x3561('0x3f')](handleError(_0x1bb0a4,null));};exports[_0x3561('0x4e')]=function(_0x2dedfb,_0x20fcbe,_0x4216b4){var _0xa4fbad;return db[_0x3561('0x27')][_0x3561('0x48')]({'where':{'id':_0x2dedfb[_0x3561('0x41')]['id']},'attributes':['id',_0x3561('0x4f')]})['then'](handleEntityNotFound(_0x20fcbe,null))[_0x3561('0x1c')](function(_0x1f2eb5){if(_0x1f2eb5){var _0xcafb3c=require(_0x3561('0x50'))();_0xcafb3c['openSync'](_0x1f2eb5[_0x3561('0x4f')]);_0xcafb3c[_0x3561('0x51')]();return _0x1f2eb5;}})['then'](respondWithResult(_0x20fcbe,null))[_0x3561('0x3f')](handleError(_0x20fcbe,null));}; \ No newline at end of file +var _0x8e67=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','get','ODBC','error','stack','name','map','SquareOdbc','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse'];(function(_0x261c52,_0x15921f){var _0x1a5043=function(_0x36c9de){while(--_0x36c9de){_0x261c52['push'](_0x261c52['shift']());}};_0x1a5043(++_0x15921f);}(_0x8e67,0x9e));var _0x78e6=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0x8e67[_0x33554b];return _0x256954;};'use strict';var pdf=require(_0x78e6('0x0'));var emlformat=require(_0x78e6('0x1'));var rimraf=require(_0x78e6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x78e6('0x3'));var rp=require(_0x78e6('0x4'));var moment=require(_0x78e6('0x5'));var BPromise=require(_0x78e6('0x6'));var Mustache=require(_0x78e6('0x7'));var util=require(_0x78e6('0x8'));var path=require('path');var sox=require(_0x78e6('0x9'));var csv=require('to-csv');var ejs=require(_0x78e6('0xa'));var fs=require('fs');var _=require(_0x78e6('0xb'));var squel=require(_0x78e6('0xc'));var crypto=require(_0x78e6('0xd'));var jsforce=require(_0x78e6('0xe'));var deskjs=require(_0x78e6('0xf'));var toCsv=require(_0x78e6('0x10'));var querystring=require('querystring');var Papa=require(_0x78e6('0x11'));var Redis=require(_0x78e6('0x12'));var authService=require(_0x78e6('0x13'));var qs=require(_0x78e6('0x14'));var as=require(_0x78e6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x78e6('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x78e6('0x17'));var db=require(_0x78e6('0x18'))['db'];function respondWithStatusCode(_0x1b4d2c,_0x3752ba){_0x3752ba=_0x3752ba||0xcc;return function(_0x4af6ff){if(_0x4af6ff){return _0x1b4d2c[_0x78e6('0x19')](_0x3752ba);}return _0x1b4d2c[_0x78e6('0x1a')](_0x3752ba)[_0x78e6('0x1b')]();};}function respondWithResult(_0x2ad395,_0x2a905a){_0x2a905a=_0x2a905a||0xc8;return function(_0x662200){if(_0x662200){return _0x2ad395[_0x78e6('0x1a')](_0x2a905a)['json'](_0x662200);}};}function respondWithFilteredResult(_0x3dd34d,_0x4a5eb5){return function(_0x497b28){if(_0x497b28){var _0x42a84c=_0x497b28[_0x78e6('0x1c')],_0x4bf631=_0x4a5eb5[_0x78e6('0x1d')],_0x58d5d1=_0x4a5eb5['offset']+_0x4a5eb5[_0x78e6('0x1e')],_0x913bf9;if(_0x58d5d1>=_0x42a84c){_0x58d5d1=_0x42a84c;_0x913bf9=0xc8;}else{_0x913bf9=0xce;}_0x3dd34d[_0x78e6('0x1a')](_0x913bf9);return _0x3dd34d[_0x78e6('0x1f')](_0x78e6('0x20'),_0x4bf631+'-'+_0x58d5d1+'/'+_0x42a84c)['json'](_0x497b28);}return null;};}function patchUpdates(_0x50b655){return function(_0x593f05){try{jsonpatch[_0x78e6('0x21')](_0x593f05,_0x50b655,!![]);}catch(_0x9022c){return BPromise['reject'](_0x9022c);}return _0x593f05[_0x78e6('0x22')]();};}function saveUpdates(_0x1983c7,_0x549612){return function(_0x1f915d){if(_0x1f915d){return _0x1f915d[_0x78e6('0x23')](_0x1983c7)['then'](function(_0x35cf7a){return _0x35cf7a;});}return null;};}function removeEntity(_0x1803e6,_0x45ee94){return function(_0x35bda5){if(_0x35bda5){return _0x35bda5[_0x78e6('0x24')]()[_0x78e6('0x25')](function(){var _0x4012c5=_0x35bda5[_0x78e6('0x26')]({'plain':!![]});var _0x1fdc0a=_0x78e6('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x1fdc0a,'resourceId':_0x4012c5['id']}})[_0x78e6('0x25')](function(){return _0x35bda5;});})[_0x78e6('0x25')](function(){_0x1803e6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2df7cc,_0x9ce71e){return function(_0x2dc768){if(!_0x2dc768){_0x2df7cc[_0x78e6('0x19')](0x194);}return _0x2dc768;};}function handleError(_0x399457,_0x5e018c){_0x5e018c=_0x5e018c||0x1f4;return function(_0x40ceda){logger[_0x78e6('0x28')](_0x40ceda[_0x78e6('0x29')]);if(_0x40ceda[_0x78e6('0x2a')]){delete _0x40ceda[_0x78e6('0x2a')];}_0x399457[_0x78e6('0x1a')](_0x5e018c)['send'](_0x40ceda);};}exports['index']=function(_0x4b88c8,_0x1bc6c2){var _0x1fca4f={},_0x48a084={},_0xe4df1d={'count':0x0,'rows':[]};var _0x215be0=_[_0x78e6('0x2b')](db[_0x78e6('0x2c')][_0x78e6('0x2d')],function(_0x29b1bc){return{'name':_0x29b1bc['fieldName'],'type':_0x29b1bc[_0x78e6('0x2e')][_0x78e6('0x2f')]};});_0x48a084[_0x78e6('0x30')]=_[_0x78e6('0x2b')](_0x215be0,'name');_0x48a084[_0x78e6('0x31')]=_[_0x78e6('0x32')](_0x4b88c8[_0x78e6('0x31')]);_0x48a084[_0x78e6('0x33')]=_['intersection'](_0x48a084['model'],_0x48a084['query']);_0x1fca4f[_0x78e6('0x34')]=_[_0x78e6('0x35')](_0x48a084[_0x78e6('0x30')],qs[_0x78e6('0x36')](_0x4b88c8[_0x78e6('0x31')]['fields']));_0x1fca4f[_0x78e6('0x34')]=_0x1fca4f[_0x78e6('0x34')]['length']?_0x1fca4f['attributes']:_0x48a084['model'];if(!_0x4b88c8[_0x78e6('0x31')][_0x78e6('0x37')](_0x78e6('0x38'))){_0x1fca4f['limit']=qs[_0x78e6('0x1e')](_0x4b88c8[_0x78e6('0x31')][_0x78e6('0x1e')]);_0x1fca4f[_0x78e6('0x1d')]=qs[_0x78e6('0x1d')](_0x4b88c8[_0x78e6('0x31')][_0x78e6('0x1d')]);}_0x1fca4f[_0x78e6('0x39')]=qs['sort'](_0x4b88c8[_0x78e6('0x31')][_0x78e6('0x3a')]);_0x1fca4f[_0x78e6('0x3b')]=qs[_0x78e6('0x33')](_[_0x78e6('0x3c')](_0x4b88c8[_0x78e6('0x31')],_0x48a084[_0x78e6('0x33')]),_0x215be0);if(_0x4b88c8[_0x78e6('0x31')][_0x78e6('0x3d')]){_0x1fca4f[_0x78e6('0x3b')]=_['merge'](_0x1fca4f[_0x78e6('0x3b')],{'$or':_[_0x78e6('0x2b')](_0x215be0,function(_0x234412){if(_0x234412[_0x78e6('0x2e')]!==_0x78e6('0x3e')){var _0x46221e={};_0x46221e[_0x234412['name']]={'$like':'%'+_0x4b88c8[_0x78e6('0x31')][_0x78e6('0x3d')]+'%'};return _0x46221e;}})});}_0x1fca4f=_[_0x78e6('0x3f')]({},_0x1fca4f,_0x4b88c8[_0x78e6('0x40')]);var _0x14910c={'where':_0x1fca4f['where']};return db['SquareOdbc'][_0x78e6('0x1c')](_0x14910c)[_0x78e6('0x25')](function(_0x5edd9d){_0xe4df1d[_0x78e6('0x1c')]=_0x5edd9d;if(_0x4b88c8[_0x78e6('0x31')]['includeAll']){_0x1fca4f[_0x78e6('0x41')]=[{'all':!![]}];}return db[_0x78e6('0x2c')][_0x78e6('0x42')](_0x1fca4f);})['then'](function(_0x142c52){_0xe4df1d[_0x78e6('0x43')]=_0x142c52;return _0xe4df1d;})['then'](respondWithFilteredResult(_0x1bc6c2,_0x1fca4f))[_0x78e6('0x44')](handleError(_0x1bc6c2,null));};exports['show']=function(_0x214dbd,_0x525bdc){var _0xa3c3d0={'raw':!![],'where':{'id':_0x214dbd[_0x78e6('0x45')]['id']}},_0x13efe1={};_0x13efe1[_0x78e6('0x30')]=_[_0x78e6('0x32')](db[_0x78e6('0x2c')][_0x78e6('0x2d')]);_0x13efe1['query']=_['keys'](_0x214dbd['query']);_0x13efe1[_0x78e6('0x33')]=_[_0x78e6('0x35')](_0x13efe1[_0x78e6('0x30')],_0x13efe1[_0x78e6('0x31')]);_0xa3c3d0[_0x78e6('0x34')]=_[_0x78e6('0x35')](_0x13efe1['model'],qs[_0x78e6('0x36')](_0x214dbd['query'][_0x78e6('0x36')]));_0xa3c3d0[_0x78e6('0x34')]=_0xa3c3d0[_0x78e6('0x34')][_0x78e6('0x46')]?_0xa3c3d0[_0x78e6('0x34')]:_0x13efe1[_0x78e6('0x30')];if(_0x214dbd[_0x78e6('0x31')][_0x78e6('0x47')]){_0xa3c3d0[_0x78e6('0x41')]=[{'all':!![]}];}_0xa3c3d0=_[_0x78e6('0x3f')]({},_0xa3c3d0,_0x214dbd['options']);return db[_0x78e6('0x2c')][_0x78e6('0x48')](_0xa3c3d0)[_0x78e6('0x25')](handleEntityNotFound(_0x525bdc,null))['then'](respondWithResult(_0x525bdc,null))[_0x78e6('0x44')](handleError(_0x525bdc,null));};exports[_0x78e6('0x49')]=function(_0x2cd93c,_0x4b763c){return db[_0x78e6('0x2c')][_0x78e6('0x49')](_0x2cd93c[_0x78e6('0x4a')],{})[_0x78e6('0x25')](function(_0x301f49){var _0x508e9c=_0x2cd93c[_0x78e6('0x4b')][_0x78e6('0x26')]({'plain':!![]});if(!_0x508e9c)throw new Error(_0x78e6('0x4c'));if(_0x508e9c[_0x78e6('0x4d')]===_0x78e6('0x4b')){var _0xdf1607=_0x301f49['get']({'plain':!![]});var _0x92513a=_0x78e6('0x27');return db[_0x78e6('0x4e')][_0x78e6('0x48')]({'where':{'name':_0x92513a,'userProfileId':_0x508e9c[_0x78e6('0x4f')]},'raw':!![]})[_0x78e6('0x25')](function(_0x6de772){if(_0x6de772&&_0x6de772[_0x78e6('0x50')]===0x0){return db[_0x78e6('0x51')][_0x78e6('0x49')]({'name':_0xdf1607['name'],'resourceId':_0xdf1607['id'],'type':_0x6de772[_0x78e6('0x2a')],'sectionId':_0x6de772['id']},{})[_0x78e6('0x25')](function(){return _0x301f49;});}else{return _0x301f49;}})[_0x78e6('0x44')](function(_0x434c36){logger['error'](_0x78e6('0x52'),_0x434c36);throw _0x434c36;});}return _0x301f49;})[_0x78e6('0x25')](respondWithResult(_0x4b763c,0xc9))['catch'](handleError(_0x4b763c,null));};exports['update']=function(_0x491db4,_0x5c6072){if(_0x491db4['body']['id']){delete _0x491db4[_0x78e6('0x4a')]['id'];}return db[_0x78e6('0x2c')][_0x78e6('0x48')]({'where':{'id':_0x491db4[_0x78e6('0x45')]['id']}})[_0x78e6('0x25')](handleEntityNotFound(_0x5c6072,null))[_0x78e6('0x25')](saveUpdates(_0x491db4[_0x78e6('0x4a')],null))[_0x78e6('0x25')](respondWithResult(_0x5c6072,null))[_0x78e6('0x44')](handleError(_0x5c6072,null));};exports[_0x78e6('0x24')]=function(_0x19241e,_0x17cdee){return db[_0x78e6('0x2c')]['find']({'where':{'id':_0x19241e[_0x78e6('0x45')]['id']}})['then'](handleEntityNotFound(_0x17cdee,null))[_0x78e6('0x25')](removeEntity(_0x17cdee,null))['catch'](handleError(_0x17cdee,null));};exports[_0x78e6('0x53')]=function(_0x260dab,_0xc0e38d,_0x2fc981){var _0xa840db;return db['SquareOdbc']['find']({'where':{'id':_0x260dab[_0x78e6('0x45')]['id']},'attributes':['id',_0x78e6('0x54')]})[_0x78e6('0x25')](handleEntityNotFound(_0xc0e38d,null))[_0x78e6('0x25')](function(_0x593b28){if(_0x593b28){var _0x5bf88b=require(_0x78e6('0x55'))();_0x5bf88b[_0x78e6('0x56')](_0x593b28[_0x78e6('0x54')]);_0x5bf88b[_0x78e6('0x57')]();return _0x593b28;}})['then'](respondWithResult(_0xc0e38d,null))[_0x78e6('0x44')](handleError(_0xc0e38d,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 2212f0b..fd68ed5 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 _0x1a7f=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','SquareOdbc','square_odbc'];(function(_0x1c3124,_0x218186){var _0x23477a=function(_0x34df96){while(--_0x34df96){_0x1c3124['push'](_0x1c3124['shift']());}};_0x23477a(++_0x218186);}(_0x1a7f,0xb4));var _0xf1a7=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x1a7f[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xf1a7('0x0'));var util=require(_0xf1a7('0x1'));var logger=require('../../config/logger')(_0xf1a7('0x2'));var moment=require(_0xf1a7('0x3'));var BPromise=require('bluebird');var rp=require(_0xf1a7('0x4'));var fs=require('fs');var path=require(_0xf1a7('0x5'));var rimraf=require(_0xf1a7('0x6'));var config=require(_0xf1a7('0x7'));var attributes=require('./squareOdbc.attributes');module[_0xf1a7('0x8')]=function(_0x6f06d,_0x17a05e){return _0x6f06d[_0xf1a7('0x9')](_0xf1a7('0xa'),attributes,{'tableName':_0xf1a7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf04a=['SquareOdbc','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x4d867a,_0x303125){var _0x5e854a=function(_0x4cda16){while(--_0x4cda16){_0x4d867a['push'](_0x4d867a['shift']());}};_0x5e854a(++_0x303125);}(_0xf04a,0xa9));var _0xaf04=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xf04a[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0xaf04('0x0'));var logger=require(_0xaf04('0x1'))(_0xaf04('0x2'));var moment=require(_0xaf04('0x3'));var BPromise=require(_0xaf04('0x4'));var rp=require(_0xaf04('0x5'));var fs=require('fs');var path=require(_0xaf04('0x6'));var rimraf=require(_0xaf04('0x7'));var config=require(_0xaf04('0x8'));var attributes=require('./squareOdbc.attributes');module[_0xaf04('0x9')]=function(_0x2856e6,_0x583147){return _0x2856e6[_0xaf04('0xa')](_0xaf04('0xb'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index d62f2b5..97a0f49 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 _0x3e74=['catch','SquareOdbc','find','options','raw','where','attributes','include','map','model','then','ShowSquareOdbc','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','SquareOdbc,\x20%s,\x20%s','message','info'];(function(_0x33bb07,_0x5b1849){var _0x481c81=function(_0x1709f0){while(--_0x1709f0){_0x33bb07['push'](_0x33bb07['shift']());}};_0x481c81(++_0x5b1849);}(_0x3e74,0x175));var _0x43e7=function(_0x3cda63,_0x479eb3){_0x3cda63=_0x3cda63-0x0;var _0x46f0ac=_0x3e74[_0x3cda63];return _0x46f0ac;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('SquareOdbc,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}exports['ShowSquareOdbc']=function(_0x446986){var _0x1ca758=this;return new Promise(function(_0x9037d3,_0x140657){return db[_0x43e7('0x12')][_0x43e7('0x13')]({'raw':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x15')]===undefined?!![]:![]:!![],'where':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x16')]||null:null,'attributes':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x17')]||null:null,'include':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x18')]?_[_0x43e7('0x19')](_0x446986[_0x43e7('0x14')][_0x43e7('0x18')],function(_0x2f4cb4){return{'model':db[_0x2f4cb4['model']],'as':_0x2f4cb4['as'],'attributes':_0x2f4cb4[_0x43e7('0x17')],'include':_0x2f4cb4['include']?_['map'](_0x2f4cb4[_0x43e7('0x18')],function(_0x43f4ff){return{'model':db[_0x43f4ff['model']],'as':_0x43f4ff['as'],'attributes':_0x43f4ff[_0x43e7('0x17')],'include':_0x43f4ff['include']?_[_0x43e7('0x19')](_0x43f4ff['include'],function(_0x1af208){return{'model':db[_0x1af208[_0x43e7('0x1a')]],'as':_0x1af208['as'],'attributes':_0x1af208[_0x43e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x43e7('0x1b')](function(_0x51f4d7){logger['info'](_0x43e7('0x1c'),_0x446986);logger['debug'](_0x43e7('0x1c'),_0x446986,JSON[_0x43e7('0x1d')](_0x51f4d7));_0x9037d3(_0x51f4d7);})[_0x43e7('0x11')](function(_0xb1fc63){logger['error'](_0x43e7('0x1c'),_0xb1fc63[_0x43e7('0xf')],_0x446986);_0x140657(_0x1ca758[_0x43e7('0xd')](0x1f4,_0xb1fc63[_0x43e7('0xf')]));});});}; \ No newline at end of file +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(_0x5e570c,_0x233990){var _0xc62527=function(_0xd18777){while(--_0xd18777){_0x5e570c['push'](_0x5e570c['shift']());}};_0xc62527(++_0x233990);}(_0xe14b,0x93));var _0xbe14=function(_0x119c6f,_0x15470c){_0x119c6f=_0x119c6f-0x0;var _0xa9963e=_0xe14b[_0x119c6f];return _0xa9963e;};'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 2e4cca8..e7f9310 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 _0x4213=['post','addUsers','put','/:id','update','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/users'];(function(_0x3b99bd,_0x186207){var _0x5808b6=function(_0x1b4e85){while(--_0x1b4e85){_0x3b99bd['push'](_0x3b99bd['shift']());}};_0x5808b6(++_0x186207);}(_0x4213,0x77));var _0x3421=function(_0x7ac7b2,_0x29cd45){_0x7ac7b2=_0x7ac7b2-0x0;var _0x2089f8=_0x4213[_0x7ac7b2];return _0x2089f8;};'use strict';var multer=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var path=require(_0x3421('0x2'));var timeout=require(_0x3421('0x3'));var express=require(_0x3421('0x4'));var router=express[_0x3421('0x5')]();var auth=require(_0x3421('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3421('0x7'));var controller=require('./squareProject.controller');router[_0x3421('0x8')]('/',auth[_0x3421('0x9')](),controller[_0x3421('0xa')]);router[_0x3421('0x8')]('/:id',auth[_0x3421('0x9')](),controller[_0x3421('0xb')]);router[_0x3421('0x8')](_0x3421('0xc'),auth[_0x3421('0x9')](),controller['getUsers']);router[_0x3421('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3421('0xd')]('/:id/users',auth[_0x3421('0x9')](),controller[_0x3421('0xe')]);router[_0x3421('0xf')](_0x3421('0x10'),auth[_0x3421('0x9')](),controller[_0x3421('0x11')]);router[_0x3421('0x12')]('/:id',auth[_0x3421('0x9')](),controller[_0x3421('0x13')]);router[_0x3421('0x12')](_0x3421('0xc'),auth[_0x3421('0x9')](),controller[_0x3421('0x14')]);module[_0x3421('0x15')]=router; \ No newline at end of file +var _0xab40=['addUsers','put','update','destroy','delete','removeUsers','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','index','/:id','isAuthenticated','show','get','post','create','/:id/users'];(function(_0x46cbda,_0x45b7e4){var _0x4b0f69=function(_0x3d63d9){while(--_0x3d63d9){_0x46cbda['push'](_0x46cbda['shift']());}};_0x4b0f69(++_0x45b7e4);}(_0xab40,0xcd));var _0x0ab4=function(_0x22efb5,_0x122797){_0x22efb5=_0x22efb5-0x0;var _0x1a4d0d=_0xab40[_0x22efb5];return _0x1a4d0d;};'use strict';var multer=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0ab4('0x2')]();var auth=require(_0x0ab4('0x3'));var interaction=require(_0x0ab4('0x4'));var config=require(_0x0ab4('0x5'));var controller=require(_0x0ab4('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0ab4('0x7')]);router['get'](_0x0ab4('0x8'),auth[_0x0ab4('0x9')](),controller[_0x0ab4('0xa')]);router[_0x0ab4('0xb')]('/:id/users',auth['isAuthenticated'](),controller['getUsers']);router[_0x0ab4('0xc')]('/',auth[_0x0ab4('0x9')](),controller[_0x0ab4('0xd')]);router[_0x0ab4('0xc')](_0x0ab4('0xe'),auth[_0x0ab4('0x9')](),controller[_0x0ab4('0xf')]);router[_0x0ab4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x0ab4('0x11')]);router['delete'](_0x0ab4('0x8'),auth[_0x0ab4('0x9')](),controller[_0x0ab4('0x12')]);router[_0x0ab4('0x13')](_0x0ab4('0xe'),auth[_0x0ab4('0x9')](),controller[_0x0ab4('0x14')]);module[_0x0ab4('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 dbabb3d..8ef319d 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 _0x4660=['toString','utf8','production','exports','STRING','name','TEXT','BLOB','long','preproduction','getDataValue'];(function(_0x332ee1,_0x38ccad){var _0x23e120=function(_0x393f6c){while(--_0x393f6c){_0x332ee1['push'](_0x332ee1['shift']());}};_0x23e120(++_0x38ccad);}(_0x4660,0x1e7));var _0x0466=function(_0x291b05,_0x54d15c){_0x291b05=_0x291b05-0x0;var _0x5171b8=_0x4660[_0x291b05];return _0x5171b8;};'use strict';var Sequelize=require('sequelize');module[_0x0466('0x0')]={'name':{'type':Sequelize[_0x0466('0x1')],'unique':_0x0466('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x0466('0x1')]},'notes':{'type':Sequelize[_0x0466('0x3')]},'preproduction':{'type':Sequelize[_0x0466('0x4')](_0x0466('0x5')),'get':function(){if(this['getDataValue'](_0x0466('0x6'))){return this[_0x0466('0x7')](_0x0466('0x6'))[_0x0466('0x8')](_0x0466('0x9'));}}},'production':{'type':Sequelize[_0x0466('0x4')]('long'),'get':function(){if(this[_0x0466('0x7')](_0x0466('0xa'))){return this[_0x0466('0x7')]('production')[_0x0466('0x8')]('utf8');}}}}; \ No newline at end of file +var _0xad58=['preproduction','utf8','production','sequelize','exports','STRING','name','BLOB','long'];(function(_0x2d7226,_0x35edb1){var _0x59b03f=function(_0x45c59a){while(--_0x45c59a){_0x2d7226['push'](_0x2d7226['shift']());}};_0x59b03f(++_0x35edb1);}(_0xad58,0x1e9));var _0x8ad5=function(_0x59a591,_0xc9132b){_0x59a591=_0x59a591-0x0;var _0x325ff9=_0xad58[_0x59a591];return _0x325ff9;};'use strict';var Sequelize=require(_0x8ad5('0x0'));module[_0x8ad5('0x1')]={'name':{'type':Sequelize[_0x8ad5('0x2')],'unique':_0x8ad5('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x8ad5('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x8ad5('0x4')](_0x8ad5('0x5')),'get':function(){if(this['getDataValue'](_0x8ad5('0x6'))){return this['getDataValue'](_0x8ad5('0x6'))['toString'](_0x8ad5('0x7'));}}},'production':{'type':Sequelize[_0x8ad5('0x4')]('long'),'get':function(){if(this['getDataValue'](_0x8ad5('0x8'))){return this['getDataValue'](_0x8ad5('0x8'))['toString'](_0x8ad5('0x7'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index ace147a..e64ec7f 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 _0x9d67=['sort','where','filters','pick','filter','merge','type','VIRTUAL','options','SquareProject','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','addUsers','omit','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','./squareProject.socket','register','status','end','count','offset','limit','set','Content-Range','json','reject','update','destroy','then','get','SquareProjects','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order'];(function(_0x363ad1,_0x5802f9){var _0x4bc051=function(_0x2ad917){while(--_0x2ad917){_0x363ad1['push'](_0x363ad1['shift']());}};_0x4bc051(++_0x5802f9);}(_0x9d67,0xe0));var _0x79d6=function(_0x34190c,_0x4df8fe){_0x34190c=_0x34190c-0x0;var _0x2a03fe=_0x9d67[_0x34190c];return _0x2a03fe;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x79d6('0x0'));var rimraf=require(_0x79d6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x79d6('0x2'));var moment=require(_0x79d6('0x3'));var BPromise=require(_0x79d6('0x4'));var Mustache=require(_0x79d6('0x5'));var util=require('util');var path=require(_0x79d6('0x6'));var sox=require(_0x79d6('0x7'));var csv=require(_0x79d6('0x8'));var ejs=require(_0x79d6('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x79d6('0xa'));var jsforce=require(_0x79d6('0xb'));var deskjs=require(_0x79d6('0xc'));var toCsv=require('to-csv');var querystring=require(_0x79d6('0xd'));var Papa=require(_0x79d6('0xe'));var Redis=require(_0x79d6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x79d6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x79d6('0x11'));var logger=require(_0x79d6('0x12'))('api');var utils=require(_0x79d6('0x13'));var config=require(_0x79d6('0x14'));var db=require(_0x79d6('0x15'))['db'];config['redis']=_[_0x79d6('0x16')](config['redis'],{'host':_0x79d6('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x79d6('0x18'))[_0x79d6('0x19')](socket);function respondWithStatusCode(_0x5bd3ec,_0x27767b){_0x27767b=_0x27767b||0xcc;return function(_0x110ca2){if(_0x110ca2){return _0x5bd3ec['sendStatus'](_0x27767b);}return _0x5bd3ec[_0x79d6('0x1a')](_0x27767b)[_0x79d6('0x1b')]();};}function respondWithResult(_0x5bf325,_0xc638b2){_0xc638b2=_0xc638b2||0xc8;return function(_0x2356f5){if(_0x2356f5){return _0x5bf325[_0x79d6('0x1a')](_0xc638b2)['json'](_0x2356f5);}};}function respondWithFilteredResult(_0x5cf4a9,_0x2c2d93){return function(_0x283778){if(_0x283778){var _0x2364a2=_0x283778[_0x79d6('0x1c')],_0x67eae2=_0x2c2d93[_0x79d6('0x1d')],_0x3c6158=_0x2c2d93[_0x79d6('0x1d')]+_0x2c2d93[_0x79d6('0x1e')],_0x3b7842;if(_0x3c6158>=_0x2364a2){_0x3c6158=_0x2364a2;_0x3b7842=0xc8;}else{_0x3b7842=0xce;}_0x5cf4a9[_0x79d6('0x1a')](_0x3b7842);return _0x5cf4a9[_0x79d6('0x1f')](_0x79d6('0x20'),_0x67eae2+'-'+_0x3c6158+'/'+_0x2364a2)[_0x79d6('0x21')](_0x283778);}return null;};}function patchUpdates(_0x3518c9){return function(_0x567be6){try{jsonpatch['apply'](_0x567be6,_0x3518c9,!![]);}catch(_0x481913){return BPromise[_0x79d6('0x22')](_0x481913);}return _0x567be6['save']();};}function saveUpdates(_0x1f8fe6,_0x1819b3){return function(_0x4d6bb4){if(_0x4d6bb4){return _0x4d6bb4[_0x79d6('0x23')](_0x1f8fe6)['then'](function(_0x3abf20){return _0x3abf20;});}return null;};}function removeEntity(_0x62b1eb,_0x467a9b){return function(_0x175523){if(_0x175523){return _0x175523[_0x79d6('0x24')]()[_0x79d6('0x25')](function(){var _0x763a75=_0x175523[_0x79d6('0x26')]({'plain':!![]});var _0x472636=_0x79d6('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x472636,'resourceId':_0x763a75['id']}})[_0x79d6('0x25')](function(){return _0x175523;});})[_0x79d6('0x25')](function(){_0x62b1eb['status'](0xcc)[_0x79d6('0x1b')]();});}};}function handleEntityNotFound(_0x271337,_0x81b61d){return function(_0x278cfb){if(!_0x278cfb){_0x271337[_0x79d6('0x28')](0x194);}return _0x278cfb;};}function handleError(_0x131075,_0x488915){_0x488915=_0x488915||0x1f4;return function(_0x500e98){logger[_0x79d6('0x29')](_0x500e98[_0x79d6('0x2a')]);if(_0x500e98['name']){delete _0x500e98[_0x79d6('0x2b')];}_0x131075[_0x79d6('0x1a')](_0x488915)[_0x79d6('0x2c')](_0x500e98);};}exports[_0x79d6('0x2d')]=function(_0x31efa2,_0x4d29c8){var _0x4c2bc7={},_0x173e98={},_0x3855fb={'count':0x0,'rows':[]};var _0x332f16=_['map'](db['SquareProject'][_0x79d6('0x2e')],function(_0x3e26fe){return{'name':_0x3e26fe[_0x79d6('0x2f')],'type':_0x3e26fe['type']['key']};});_0x173e98[_0x79d6('0x30')]=_[_0x79d6('0x31')](_0x332f16,'name');_0x173e98[_0x79d6('0x32')]=_[_0x79d6('0x33')](_0x31efa2[_0x79d6('0x32')]);_0x173e98['filters']=_[_0x79d6('0x34')](_0x173e98['model'],_0x173e98['query']);_0x4c2bc7['attributes']=_['intersection'](_0x173e98[_0x79d6('0x30')],qs[_0x79d6('0x35')](_0x31efa2['query'][_0x79d6('0x35')]));_0x4c2bc7[_0x79d6('0x36')]=_0x4c2bc7['attributes']['length']?_0x4c2bc7['attributes']:_0x173e98[_0x79d6('0x30')];if(!_0x31efa2[_0x79d6('0x32')][_0x79d6('0x37')](_0x79d6('0x38'))){_0x4c2bc7[_0x79d6('0x1e')]=qs[_0x79d6('0x1e')](_0x31efa2[_0x79d6('0x32')][_0x79d6('0x1e')]);_0x4c2bc7['offset']=qs[_0x79d6('0x1d')](_0x31efa2[_0x79d6('0x32')][_0x79d6('0x1d')]);}_0x4c2bc7[_0x79d6('0x39')]=qs['sort'](_0x31efa2[_0x79d6('0x32')][_0x79d6('0x3a')]);_0x4c2bc7[_0x79d6('0x3b')]=qs[_0x79d6('0x3c')](_[_0x79d6('0x3d')](_0x31efa2[_0x79d6('0x32')],_0x173e98[_0x79d6('0x3c')]),_0x332f16);if(_0x31efa2[_0x79d6('0x32')][_0x79d6('0x3e')]){_0x4c2bc7[_0x79d6('0x3b')]=_[_0x79d6('0x3f')](_0x4c2bc7['where'],{'$or':_[_0x79d6('0x31')](_0x332f16,function(_0x1a978f){if(_0x1a978f[_0x79d6('0x40')]!==_0x79d6('0x41')){var _0x4f5614={};_0x4f5614[_0x1a978f[_0x79d6('0x2b')]]={'$like':'%'+_0x31efa2[_0x79d6('0x32')][_0x79d6('0x3e')]+'%'};return _0x4f5614;}})});}_0x4c2bc7=_['merge']({},_0x4c2bc7,_0x31efa2[_0x79d6('0x42')]);var _0x150be0={'where':_0x4c2bc7[_0x79d6('0x3b')]};return db[_0x79d6('0x43')][_0x79d6('0x1c')](_0x150be0)['then'](function(_0x4a7e98){_0x3855fb['count']=_0x4a7e98;if(_0x31efa2[_0x79d6('0x32')][_0x79d6('0x44')]){_0x4c2bc7[_0x79d6('0x45')]=[{'all':!![]}];}return db[_0x79d6('0x43')][_0x79d6('0x46')](_0x4c2bc7);})[_0x79d6('0x25')](function(_0x521d71){_0x3855fb[_0x79d6('0x47')]=_0x521d71;return _0x3855fb;})['then'](respondWithFilteredResult(_0x4d29c8,_0x4c2bc7))[_0x79d6('0x48')](handleError(_0x4d29c8,null));};exports[_0x79d6('0x49')]=function(_0x458ce7,_0xe9b310){var _0x4f182f={'raw':![],'where':{'id':_0x458ce7[_0x79d6('0x4a')]['id']}},_0x1fc71a={};_0x1fc71a[_0x79d6('0x30')]=_[_0x79d6('0x33')](db[_0x79d6('0x43')][_0x79d6('0x2e')]);_0x1fc71a[_0x79d6('0x32')]=_[_0x79d6('0x33')](_0x458ce7['query']);_0x1fc71a[_0x79d6('0x3c')]=_[_0x79d6('0x34')](_0x1fc71a[_0x79d6('0x30')],_0x1fc71a[_0x79d6('0x32')]);_0x4f182f[_0x79d6('0x36')]=_[_0x79d6('0x34')](_0x1fc71a[_0x79d6('0x30')],qs[_0x79d6('0x35')](_0x458ce7[_0x79d6('0x32')]['fields']));_0x4f182f[_0x79d6('0x36')]=_0x4f182f[_0x79d6('0x36')][_0x79d6('0x4b')]?_0x4f182f['attributes']:_0x1fc71a[_0x79d6('0x30')];if(_0x458ce7[_0x79d6('0x32')][_0x79d6('0x44')]){_0x4f182f[_0x79d6('0x45')]=[{'all':!![]}];}_0x4f182f=_[_0x79d6('0x3f')]({},_0x4f182f,_0x458ce7[_0x79d6('0x42')]);return db['SquareProject'][_0x79d6('0x4c')](_0x4f182f)[_0x79d6('0x25')](handleEntityNotFound(_0xe9b310,null))[_0x79d6('0x25')](respondWithResult(_0xe9b310,null))[_0x79d6('0x48')](handleError(_0xe9b310,null));};exports[_0x79d6('0x4d')]=function(_0x14000a,_0x61782e){return db[_0x79d6('0x43')][_0x79d6('0x4d')](_0x14000a[_0x79d6('0x4e')],{})[_0x79d6('0x25')](function(_0x543495){var _0x44f9a6=_0x14000a[_0x79d6('0x4f')]['get']({'plain':!![]});if(!_0x44f9a6)throw new Error(_0x79d6('0x50'));if(_0x44f9a6['role']===_0x79d6('0x4f')){var _0x26884b=_0x543495[_0x79d6('0x26')]({'plain':!![]});var _0x13d7d2=_0x79d6('0x27');return db[_0x79d6('0x51')][_0x79d6('0x4c')]({'where':{'name':_0x13d7d2,'userProfileId':_0x44f9a6[_0x79d6('0x52')]},'raw':!![]})[_0x79d6('0x25')](function(_0x32b507){if(_0x32b507&&_0x32b507[_0x79d6('0x53')]===0x0){return db['UserProfileResource'][_0x79d6('0x4d')]({'name':_0x26884b[_0x79d6('0x2b')],'resourceId':_0x26884b['id'],'type':_0x32b507[_0x79d6('0x2b')],'sectionId':_0x32b507['id']},{})[_0x79d6('0x25')](function(){return _0x543495;});}else{return _0x543495;}})[_0x79d6('0x48')](function(_0x4418d8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4418d8);throw _0x4418d8;});}return _0x543495;})['then'](respondWithResult(_0x61782e,0xc9))['catch'](handleError(_0x61782e,null));};exports[_0x79d6('0x23')]=function(_0x3c81cc,_0x360753){if(_0x3c81cc[_0x79d6('0x4e')]['id']){delete _0x3c81cc['body']['id'];}return db[_0x79d6('0x43')][_0x79d6('0x4c')]({'where':{'id':_0x3c81cc[_0x79d6('0x4a')]['id']}})[_0x79d6('0x25')](handleEntityNotFound(_0x360753,null))[_0x79d6('0x25')](saveUpdates(_0x3c81cc[_0x79d6('0x4e')],null))[_0x79d6('0x25')](respondWithResult(_0x360753,null))[_0x79d6('0x48')](handleError(_0x360753,null));};exports[_0x79d6('0x24')]=function(_0x531d83,_0x1b2405){return db[_0x79d6('0x43')][_0x79d6('0x4c')]({'where':{'id':_0x531d83[_0x79d6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1b2405,null))['then'](removeEntity(_0x1b2405,null))['catch'](handleError(_0x1b2405,null));};exports['addUsers']=function(_0x67257e,_0x16a283,_0x5641a6){return db[_0x79d6('0x43')][_0x79d6('0x4c')]({'where':{'id':_0x67257e['params']['id']}})['then'](handleEntityNotFound(_0x16a283,null))[_0x79d6('0x25')](function(_0x10c7d7){if(_0x10c7d7){return _0x10c7d7[_0x79d6('0x54')](_0x67257e[_0x79d6('0x4e')]['ids'],_[_0x79d6('0x55')](_0x67257e[_0x79d6('0x4e')],[_0x79d6('0x56'),'id'])||{});}})[_0x79d6('0x25')](respondWithResult(_0x16a283,null))[_0x79d6('0x48')](handleError(_0x16a283,null));};exports[_0x79d6('0x57')]=function(_0xc06ff8,_0x17d447,_0x1c5962){return db['SquareProject'][_0x79d6('0x4c')]({'where':{'id':_0xc06ff8[_0x79d6('0x4a')]['id']}})[_0x79d6('0x25')](handleEntityNotFound(_0x17d447,null))[_0x79d6('0x25')](function(_0x118861){if(_0x118861){return _0x118861['removeUsers'](_0xc06ff8[_0x79d6('0x32')][_0x79d6('0x56')])[_0x79d6('0x25')](function(){if(_[_0x79d6('0x58')](_0xc06ff8[_0x79d6('0x32')][_0x79d6('0x56')])){for(var _0x938042=0x0;_0x938042<_0xc06ff8['query'][_0x79d6('0x56')][_0x79d6('0x4b')];_0x938042+=0x1){socket['emit']('userSquareProject:remove',{'UserId':Number(_0xc06ff8[_0x79d6('0x32')]['ids'][_0x938042]),'SquareProjectId':Number(_0xc06ff8[_0x79d6('0x4a')]['id'])});}}else{socket[_0x79d6('0x59')](_0x79d6('0x5a'),{'UserId':Number(_0xc06ff8[_0x79d6('0x32')]['ids']),'SquareProjectId':Number(_0xc06ff8['params']['id'])});}});}})[_0x79d6('0x25')](respondWithStatusCode(_0x17d447,null))[_0x79d6('0x48')](handleError(_0x17d447,null));};exports[_0x79d6('0x5b')]=function(_0x32e116,_0x46d749,_0x10dad8){var _0x43844d={};var _0x34c7d2={};var _0x18f945;var _0x5a59ce;return db[_0x79d6('0x43')][_0x79d6('0x5c')]({'where':{'id':_0x32e116[_0x79d6('0x4a')]['id']}})[_0x79d6('0x25')](handleEntityNotFound(_0x46d749,null))[_0x79d6('0x25')](function(_0x190ba5){if(_0x190ba5){_0x18f945=_0x190ba5;_0x34c7d2['model']=_[_0x79d6('0x33')](db[_0x79d6('0x5d')]['rawAttributes']);_0x34c7d2[_0x79d6('0x32')]=_[_0x79d6('0x33')](_0x32e116['query']);_0x34c7d2[_0x79d6('0x3c')]=_['intersection'](_0x34c7d2['model'],_0x34c7d2[_0x79d6('0x32')]);_0x43844d[_0x79d6('0x36')]=_[_0x79d6('0x34')](_0x34c7d2[_0x79d6('0x30')],qs['fields'](_0x32e116[_0x79d6('0x32')][_0x79d6('0x35')]));_0x43844d[_0x79d6('0x36')]=_0x43844d[_0x79d6('0x36')][_0x79d6('0x4b')]?_0x43844d[_0x79d6('0x36')]:_0x34c7d2[_0x79d6('0x30')];_0x43844d['order']=qs[_0x79d6('0x3a')](_0x32e116[_0x79d6('0x32')][_0x79d6('0x3a')]);_0x43844d[_0x79d6('0x3b')]=qs[_0x79d6('0x3c')](_['pick'](_0x32e116['query'],_0x34c7d2['filters']));if(_0x32e116[_0x79d6('0x32')][_0x79d6('0x3e')]){_0x43844d['where']=_['merge'](_0x43844d[_0x79d6('0x3b')],{'$or':_[_0x79d6('0x31')](_0x43844d['attributes'],function(_0x4499c0){var _0xd11a66={};_0xd11a66[_0x4499c0]={'$like':'%'+_0x32e116['query'][_0x79d6('0x3e')]+'%'};return _0xd11a66;})});}_0x43844d=_[_0x79d6('0x3f')]({},_0x43844d,_0x32e116['options']);return _0x18f945['getUsers'](_0x43844d);}})['then'](function(_0x1867b1){if(_0x1867b1){_0x5a59ce=_0x1867b1[_0x79d6('0x4b')];if(!_0x32e116[_0x79d6('0x32')][_0x79d6('0x37')](_0x79d6('0x38'))){_0x43844d[_0x79d6('0x1e')]=qs[_0x79d6('0x1e')](_0x32e116['query'][_0x79d6('0x1e')]);_0x43844d['offset']=qs['offset'](_0x32e116[_0x79d6('0x32')]['offset']);}return _0x18f945[_0x79d6('0x5b')](_0x43844d);}})[_0x79d6('0x25')](function(_0x5f1d34){if(_0x5f1d34){return _0x5f1d34?{'count':_0x5a59ce,'rows':_0x5f1d34}:null;}})[_0x79d6('0x25')](respondWithResult(_0x46d749,null))[_0x79d6('0x48')](handleError(_0x46d749,null));}; \ No newline at end of file +var _0x22a6=['catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','omit','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','SquareProjects','UserProfileResource','sendStatus','name','send','index','SquareProject','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','params','keys','rawAttributes','find'];(function(_0x569caa,_0x5174ce){var _0x44cb5a=function(_0x456df4){while(--_0x456df4){_0x569caa['push'](_0x569caa['shift']());}};_0x44cb5a(++_0x5174ce);}(_0x22a6,0x182));var _0x622a=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x22a6[_0x15c421];return _0x5e5ed5;};'use strict';var pdf=require(_0x622a('0x0'));var emlformat=require(_0x622a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x622a('0x2'));var rp=require(_0x622a('0x3'));var moment=require(_0x622a('0x4'));var BPromise=require(_0x622a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x622a('0x6'));var sox=require(_0x622a('0x7'));var csv=require(_0x622a('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x622a('0x9'));var crypto=require(_0x622a('0xa'));var jsforce=require(_0x622a('0xb'));var deskjs=require(_0x622a('0xc'));var toCsv=require(_0x622a('0x8'));var querystring=require('querystring');var Papa=require(_0x622a('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x622a('0xe'));var hardwareService=require(_0x622a('0xf'));var logger=require('../../config/logger')(_0x622a('0x10'));var utils=require(_0x622a('0x11'));var config=require(_0x622a('0x12'));var db=require('../../mysqldb')['db'];config[_0x622a('0x13')]=_[_0x622a('0x14')](config['redis'],{'host':_0x622a('0x15'),'port':0x18eb});var socket=require(_0x622a('0x16'))(new Redis(config[_0x622a('0x13')]));require(_0x622a('0x17'))['register'](socket);function respondWithStatusCode(_0x38e652,_0x5744f4){_0x5744f4=_0x5744f4||0xcc;return function(_0x450e87){if(_0x450e87){return _0x38e652['sendStatus'](_0x5744f4);}return _0x38e652['status'](_0x5744f4)['end']();};}function respondWithResult(_0x5dc68c,_0x4cdaf9){_0x4cdaf9=_0x4cdaf9||0xc8;return function(_0x38f789){if(_0x38f789){return _0x5dc68c[_0x622a('0x18')](_0x4cdaf9)[_0x622a('0x19')](_0x38f789);}};}function respondWithFilteredResult(_0x380795,_0x46a14c){return function(_0x3d3c16){if(_0x3d3c16){var _0x3b5c9a=_0x3d3c16['count'],_0x4b9803=_0x46a14c[_0x622a('0x1a')],_0x1d7d89=_0x46a14c[_0x622a('0x1a')]+_0x46a14c[_0x622a('0x1b')],_0x44c307;if(_0x1d7d89>=_0x3b5c9a){_0x1d7d89=_0x3b5c9a;_0x44c307=0xc8;}else{_0x44c307=0xce;}_0x380795[_0x622a('0x18')](_0x44c307);return _0x380795[_0x622a('0x1c')](_0x622a('0x1d'),_0x4b9803+'-'+_0x1d7d89+'/'+_0x3b5c9a)[_0x622a('0x19')](_0x3d3c16);}return null;};}function patchUpdates(_0x1d9271){return function(_0x2ae65d){try{jsonpatch[_0x622a('0x1e')](_0x2ae65d,_0x1d9271,!![]);}catch(_0x449865){return BPromise[_0x622a('0x1f')](_0x449865);}return _0x2ae65d[_0x622a('0x20')]();};}function saveUpdates(_0x12e28b,_0x3d57a0){return function(_0x1895ad){if(_0x1895ad){return _0x1895ad[_0x622a('0x21')](_0x12e28b)['then'](function(_0x140657){return _0x140657;});}return null;};}function removeEntity(_0x24b485,_0x25f490){return function(_0x185334){if(_0x185334){return _0x185334[_0x622a('0x22')]()[_0x622a('0x23')](function(){var _0x53baae=_0x185334[_0x622a('0x24')]({'plain':!![]});var _0x5c101d=_0x622a('0x25');return db[_0x622a('0x26')][_0x622a('0x22')]({'where':{'type':_0x5c101d,'resourceId':_0x53baae['id']}})['then'](function(){return _0x185334;});})[_0x622a('0x23')](function(){_0x24b485[_0x622a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29061c,_0x4fe303){return function(_0x449531){if(!_0x449531){_0x29061c[_0x622a('0x27')](0x194);}return _0x449531;};}function handleError(_0x58946b,_0x12ab61){_0x12ab61=_0x12ab61||0x1f4;return function(_0x19f114){logger['error'](_0x19f114['stack']);if(_0x19f114[_0x622a('0x28')]){delete _0x19f114[_0x622a('0x28')];}_0x58946b[_0x622a('0x18')](_0x12ab61)[_0x622a('0x29')](_0x19f114);};}exports[_0x622a('0x2a')]=function(_0x175b2f,_0x45ecee){var _0x174247={},_0x1d0427={},_0x15ad98={'count':0x0,'rows':[]};var _0x360791=_['map'](db[_0x622a('0x2b')]['rawAttributes'],function(_0x572c5f){return{'name':_0x572c5f[_0x622a('0x2c')],'type':_0x572c5f[_0x622a('0x2d')][_0x622a('0x2e')]};});_0x1d0427[_0x622a('0x2f')]=_[_0x622a('0x30')](_0x360791,_0x622a('0x28'));_0x1d0427['query']=_['keys'](_0x175b2f[_0x622a('0x31')]);_0x1d0427[_0x622a('0x32')]=_[_0x622a('0x33')](_0x1d0427[_0x622a('0x2f')],_0x1d0427['query']);_0x174247[_0x622a('0x34')]=_[_0x622a('0x33')](_0x1d0427[_0x622a('0x2f')],qs['fields'](_0x175b2f['query'][_0x622a('0x35')]));_0x174247[_0x622a('0x34')]=_0x174247['attributes'][_0x622a('0x36')]?_0x174247[_0x622a('0x34')]:_0x1d0427[_0x622a('0x2f')];if(!_0x175b2f[_0x622a('0x31')][_0x622a('0x37')](_0x622a('0x38'))){_0x174247[_0x622a('0x1b')]=qs['limit'](_0x175b2f[_0x622a('0x31')][_0x622a('0x1b')]);_0x174247['offset']=qs[_0x622a('0x1a')](_0x175b2f[_0x622a('0x31')][_0x622a('0x1a')]);}_0x174247[_0x622a('0x39')]=qs[_0x622a('0x3a')](_0x175b2f['query'][_0x622a('0x3a')]);_0x174247['where']=qs[_0x622a('0x32')](_[_0x622a('0x3b')](_0x175b2f[_0x622a('0x31')],_0x1d0427[_0x622a('0x32')]),_0x360791);if(_0x175b2f['query']['filter']){_0x174247[_0x622a('0x3c')]=_[_0x622a('0x3d')](_0x174247[_0x622a('0x3c')],{'$or':_[_0x622a('0x30')](_0x360791,function(_0x2e91dd){if(_0x2e91dd['type']!==_0x622a('0x3e')){var _0x456339={};_0x456339[_0x2e91dd[_0x622a('0x28')]]={'$like':'%'+_0x175b2f[_0x622a('0x31')][_0x622a('0x3f')]+'%'};return _0x456339;}})});}_0x174247=_['merge']({},_0x174247,_0x175b2f[_0x622a('0x40')]);var _0x5adb11={'where':_0x174247['where']};return db[_0x622a('0x2b')][_0x622a('0x41')](_0x5adb11)[_0x622a('0x23')](function(_0xd18085){_0x15ad98[_0x622a('0x41')]=_0xd18085;if(_0x175b2f[_0x622a('0x31')][_0x622a('0x42')]){_0x174247[_0x622a('0x43')]=[{'all':!![]}];}return db['SquareProject'][_0x622a('0x44')](_0x174247);})['then'](function(_0xafcb30){_0x15ad98[_0x622a('0x45')]=_0xafcb30;return _0x15ad98;})['then'](respondWithFilteredResult(_0x45ecee,_0x174247))['catch'](handleError(_0x45ecee,null));};exports['show']=function(_0x9eec12,_0x3996bd){var _0x31d9b4={'raw':![],'where':{'id':_0x9eec12[_0x622a('0x46')]['id']}},_0x33d1f7={};_0x33d1f7[_0x622a('0x2f')]=_[_0x622a('0x47')](db['SquareProject'][_0x622a('0x48')]);_0x33d1f7['query']=_['keys'](_0x9eec12['query']);_0x33d1f7['filters']=_[_0x622a('0x33')](_0x33d1f7[_0x622a('0x2f')],_0x33d1f7['query']);_0x31d9b4[_0x622a('0x34')]=_[_0x622a('0x33')](_0x33d1f7[_0x622a('0x2f')],qs[_0x622a('0x35')](_0x9eec12[_0x622a('0x31')]['fields']));_0x31d9b4[_0x622a('0x34')]=_0x31d9b4[_0x622a('0x34')]['length']?_0x31d9b4[_0x622a('0x34')]:_0x33d1f7['model'];if(_0x9eec12[_0x622a('0x31')][_0x622a('0x42')]){_0x31d9b4[_0x622a('0x43')]=[{'all':!![]}];}_0x31d9b4=_[_0x622a('0x3d')]({},_0x31d9b4,_0x9eec12['options']);return db[_0x622a('0x2b')][_0x622a('0x49')](_0x31d9b4)['then'](handleEntityNotFound(_0x3996bd,null))[_0x622a('0x23')](respondWithResult(_0x3996bd,null))[_0x622a('0x4a')](handleError(_0x3996bd,null));};exports[_0x622a('0x4b')]=function(_0x5d512a,_0x1c976b){return db[_0x622a('0x2b')][_0x622a('0x4b')](_0x5d512a[_0x622a('0x4c')],{})[_0x622a('0x23')](function(_0x17be66){var _0x1dba22=_0x5d512a[_0x622a('0x4d')]['get']({'plain':!![]});if(!_0x1dba22)throw new Error(_0x622a('0x4e'));if(_0x1dba22['role']===_0x622a('0x4d')){var _0x4b77dd=_0x17be66[_0x622a('0x24')]({'plain':!![]});var _0x5de3d2=_0x622a('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x5de3d2,'userProfileId':_0x1dba22[_0x622a('0x4f')]},'raw':!![]})[_0x622a('0x23')](function(_0x1d01b5){if(_0x1d01b5&&_0x1d01b5['autoAssociation']===0x0){return db['UserProfileResource'][_0x622a('0x4b')]({'name':_0x4b77dd['name'],'resourceId':_0x4b77dd['id'],'type':_0x1d01b5[_0x622a('0x28')],'sectionId':_0x1d01b5['id']},{})[_0x622a('0x23')](function(){return _0x17be66;});}else{return _0x17be66;}})[_0x622a('0x4a')](function(_0x29e0f5){logger[_0x622a('0x50')](_0x622a('0x51'),_0x29e0f5);throw _0x29e0f5;});}return _0x17be66;})[_0x622a('0x23')](respondWithResult(_0x1c976b,0xc9))[_0x622a('0x4a')](handleError(_0x1c976b,null));};exports['update']=function(_0x5df4f9,_0x21834d){if(_0x5df4f9['body']['id']){delete _0x5df4f9[_0x622a('0x4c')]['id'];}return db[_0x622a('0x2b')]['find']({'where':{'id':_0x5df4f9[_0x622a('0x46')]['id']}})['then'](handleEntityNotFound(_0x21834d,null))[_0x622a('0x23')](saveUpdates(_0x5df4f9[_0x622a('0x4c')],null))[_0x622a('0x23')](respondWithResult(_0x21834d,null))['catch'](handleError(_0x21834d,null));};exports['destroy']=function(_0x32d630,_0x1cc45e){return db['SquareProject']['find']({'where':{'id':_0x32d630[_0x622a('0x46')]['id']}})['then'](handleEntityNotFound(_0x1cc45e,null))[_0x622a('0x23')](removeEntity(_0x1cc45e,null))['catch'](handleError(_0x1cc45e,null));};exports[_0x622a('0x52')]=function(_0x4a5bac,_0x1d2269,_0x134139){return db['SquareProject'][_0x622a('0x49')]({'where':{'id':_0x4a5bac[_0x622a('0x46')]['id']}})['then'](handleEntityNotFound(_0x1d2269,null))[_0x622a('0x23')](function(_0x21f176){if(_0x21f176){return _0x21f176[_0x622a('0x52')](_0x4a5bac[_0x622a('0x4c')]['ids'],_[_0x622a('0x53')](_0x4a5bac[_0x622a('0x4c')],[_0x622a('0x54'),'id'])||{});}})['then'](respondWithResult(_0x1d2269,null))[_0x622a('0x4a')](handleError(_0x1d2269,null));};exports[_0x622a('0x55')]=function(_0x1c7a65,_0x295b52,_0x13ccc3){return db[_0x622a('0x2b')][_0x622a('0x49')]({'where':{'id':_0x1c7a65['params']['id']}})[_0x622a('0x23')](handleEntityNotFound(_0x295b52,null))['then'](function(_0x21a2f4){if(_0x21a2f4){return _0x21a2f4[_0x622a('0x55')](_0x1c7a65[_0x622a('0x31')][_0x622a('0x54')])[_0x622a('0x23')](function(){if(_[_0x622a('0x56')](_0x1c7a65[_0x622a('0x31')][_0x622a('0x54')])){for(var _0x44492c=0x0;_0x44492c<_0x1c7a65[_0x622a('0x31')][_0x622a('0x54')][_0x622a('0x36')];_0x44492c+=0x1){socket[_0x622a('0x57')](_0x622a('0x58'),{'UserId':Number(_0x1c7a65[_0x622a('0x31')][_0x622a('0x54')][_0x44492c]),'SquareProjectId':Number(_0x1c7a65[_0x622a('0x46')]['id'])});}}else{socket[_0x622a('0x57')](_0x622a('0x58'),{'UserId':Number(_0x1c7a65[_0x622a('0x31')][_0x622a('0x54')]),'SquareProjectId':Number(_0x1c7a65[_0x622a('0x46')]['id'])});}});}})[_0x622a('0x23')](respondWithStatusCode(_0x295b52,null))['catch'](handleError(_0x295b52,null));};exports[_0x622a('0x59')]=function(_0x1910f2,_0x2822fd,_0x32bdb2){var _0x460b5c={};var _0x3f08fc={};var _0x1ae9b8;var _0x5e6b79;return db[_0x622a('0x2b')][_0x622a('0x5a')]({'where':{'id':_0x1910f2[_0x622a('0x46')]['id']}})[_0x622a('0x23')](handleEntityNotFound(_0x2822fd,null))[_0x622a('0x23')](function(_0xbec62a){if(_0xbec62a){_0x1ae9b8=_0xbec62a;_0x3f08fc[_0x622a('0x2f')]=_['keys'](db[_0x622a('0x5b')][_0x622a('0x48')]);_0x3f08fc[_0x622a('0x31')]=_[_0x622a('0x47')](_0x1910f2[_0x622a('0x31')]);_0x3f08fc['filters']=_[_0x622a('0x33')](_0x3f08fc[_0x622a('0x2f')],_0x3f08fc[_0x622a('0x31')]);_0x460b5c[_0x622a('0x34')]=_[_0x622a('0x33')](_0x3f08fc[_0x622a('0x2f')],qs[_0x622a('0x35')](_0x1910f2[_0x622a('0x31')][_0x622a('0x35')]));_0x460b5c['attributes']=_0x460b5c[_0x622a('0x34')][_0x622a('0x36')]?_0x460b5c[_0x622a('0x34')]:_0x3f08fc[_0x622a('0x2f')];_0x460b5c[_0x622a('0x39')]=qs[_0x622a('0x3a')](_0x1910f2[_0x622a('0x31')][_0x622a('0x3a')]);_0x460b5c[_0x622a('0x3c')]=qs[_0x622a('0x32')](_[_0x622a('0x3b')](_0x1910f2[_0x622a('0x31')],_0x3f08fc['filters']));if(_0x1910f2[_0x622a('0x31')][_0x622a('0x3f')]){_0x460b5c[_0x622a('0x3c')]=_['merge'](_0x460b5c[_0x622a('0x3c')],{'$or':_[_0x622a('0x30')](_0x460b5c['attributes'],function(_0x37020c){var _0x50b643={};_0x50b643[_0x37020c]={'$like':'%'+_0x1910f2['query']['filter']+'%'};return _0x50b643;})});}_0x460b5c=_[_0x622a('0x3d')]({},_0x460b5c,_0x1910f2[_0x622a('0x40')]);return _0x1ae9b8[_0x622a('0x59')](_0x460b5c);}})[_0x622a('0x23')](function(_0x55382a){if(_0x55382a){_0x5e6b79=_0x55382a['length'];if(!_0x1910f2[_0x622a('0x31')]['hasOwnProperty']('nolimit')){_0x460b5c[_0x622a('0x1b')]=qs[_0x622a('0x1b')](_0x1910f2[_0x622a('0x31')]['limit']);_0x460b5c[_0x622a('0x1a')]=qs[_0x622a('0x1a')](_0x1910f2[_0x622a('0x31')][_0x622a('0x1a')]);}return _0x1ae9b8['getUsers'](_0x460b5c);}})[_0x622a('0x23')](function(_0x16bcb0){if(_0x16bcb0){return _0x16bcb0?{'count':_0x5e6b79,'rows':_0x16bcb0}:null;}})[_0x622a('0x23')](respondWithResult(_0x2822fd,null))[_0x622a('0x4a')](handleError(_0x2822fd,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 0b0fec2..0bdc447 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 _0x8f82=['../../mysqldb','SquareProject','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x5e25af,_0x2c5385){var _0x449b15=function(_0x29533d){while(--_0x29533d){_0x5e25af['push'](_0x5e25af['shift']());}};_0x449b15(++_0x2c5385);}(_0x8f82,0x77));var _0x28f8=function(_0x2401a6,_0x44ddc6){_0x2401a6=_0x2401a6-0x0;var _0x5d2af9=_0x8f82[_0x2401a6];return _0x5d2af9;};'use strict';var EventEmitter=require(_0x28f8('0x0'));var SquareProject=require(_0x28f8('0x1'))['db'][_0x28f8('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x28f8('0x3')](0x0);var events={'afterCreate':_0x28f8('0x4'),'afterUpdate':'update','afterDestroy':_0x28f8('0x5')};function emitEvent(_0x23e5d3){return function(_0x30ba43,_0x3cee73,_0x25a734){SquareProjectEvents[_0x28f8('0x6')](_0x23e5d3+':'+_0x30ba43['id'],_0x30ba43);SquareProjectEvents[_0x28f8('0x6')](_0x23e5d3,_0x30ba43);_0x25a734(null);};}for(var e in events){if(events[_0x28f8('0x7')](e)){var event=events[e];SquareProject[_0x28f8('0x8')](e,emitEvent(event));}}module[_0x28f8('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x2208=['setMaxListeners','update','remove','emit','hook','exports','../../mysqldb'];(function(_0x4eef0f,_0x1fda66){var _0x1cfd70=function(_0x53a0cd){while(--_0x53a0cd){_0x4eef0f['push'](_0x4eef0f['shift']());}};_0x1cfd70(++_0x1fda66);}(_0x2208,0x11e));var _0x8220=function(_0x4459ca,_0x6cb559){_0x4459ca=_0x4459ca-0x0;var _0x396f50=_0x2208[_0x4459ca];return _0x396f50;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x8220('0x0'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x8220('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8220('0x2'),'afterDestroy':_0x8220('0x3')};function emitEvent(_0x3d2530){return function(_0x231a4b,_0x464d1c,_0x32703d){SquareProjectEvents['emit'](_0x3d2530+':'+_0x231a4b['id'],_0x231a4b);SquareProjectEvents[_0x8220('0x4')](_0x3d2530,_0x231a4b);_0x32703d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x8220('0x5')](e,emitEvent(event));}}module[_0x8220('0x6')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 989b31c..2adc191 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 _0x66fa=['define','SquareProject','square_projects','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x66fa,0x117));var _0xa66f=function(_0x388888,_0x446258){_0x388888=_0x388888-0x0;var _0x50809e=_0x66fa[_0x388888];return _0x50809e;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var logger=require('../../config/logger')(_0xa66f('0x2'));var moment=require(_0xa66f('0x3'));var BPromise=require(_0xa66f('0x4'));var rp=require(_0xa66f('0x5'));var fs=require('fs');var path=require(_0xa66f('0x6'));var rimraf=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var attributes=require('./squareProject.attributes');module['exports']=function(_0x2239d3,_0x20a150){return _0x2239d3[_0xa66f('0x9')](_0xa66f('0xa'),attributes,{'tableName':_0xa66f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14a0=['../../config/logger','api','moment','bluebird','request-promise','path','./squareProject.attributes','exports','SquareProject','square_projects','util'];(function(_0x31762e,_0x52013c){var _0x208487=function(_0x3adb16){while(--_0x3adb16){_0x31762e['push'](_0x31762e['shift']());}};_0x208487(++_0x52013c);}(_0x14a0,0x8e));var _0x014a=function(_0x280a01,_0x5c6d2f){_0x280a01=_0x280a01-0x0;var _0x3d6e53=_0x14a0[_0x280a01];return _0x3d6e53;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var logger=require(_0x014a('0x1'))(_0x014a('0x2'));var moment=require(_0x014a('0x3'));var BPromise=require(_0x014a('0x4'));var rp=require(_0x014a('0x5'));var fs=require('fs');var path=require(_0x014a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x014a('0x7'));module[_0x014a('0x8')]=function(_0x38a22c,_0x5ec84d){return _0x38a22c['define'](_0x014a('0x9'),attributes,{'tableName':_0x014a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 3d9f9b8..b77a279 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 _0x6cfc=['ShowSquareProject','SquareProject','find','options','where','attributes','include','map','model','debug','catch','lodash','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x164e8f,_0xdba27a){var _0x2b2840=function(_0x4458f0){while(--_0x4458f0){_0x164e8f['push'](_0x164e8f['shift']());}};_0x2b2840(++_0xdba27a);}(_0x6cfc,0x1e7));var _0xc6cf=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x6cfc[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xc6cf('0x0'));var util=require(_0xc6cf('0x1'));var moment=require('moment');var BPromise=require(_0xc6cf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc6cf('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc6cf('0x4'))(_0xc6cf('0x5'));var config=require(_0xc6cf('0x6'));var jayson=require(_0xc6cf('0x7'));var client=jayson['client'][_0xc6cf('0x8')]({'port':0x232a});config[_0xc6cf('0x9')]=_['defaults'](config[_0xc6cf('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xc6cf('0xa'))(new Redis(config[_0xc6cf('0x9')]));require(_0xc6cf('0xb'))[_0xc6cf('0xc')](socket);function respondWithRpcPromise(_0x1b075e,_0x376840,_0x24aef0){return new BPromise(function(_0x290e6c,_0x42e5b2){return client[_0xc6cf('0xd')](_0x1b075e,_0x24aef0)[_0xc6cf('0xe')](function(_0x5cb791){logger[_0xc6cf('0xf')](_0xc6cf('0x10'),_0x376840,_0xc6cf('0x11'));logger['debug'](_0xc6cf('0x12'),_0x376840,'request\x20sent',JSON[_0xc6cf('0x13')](_0x5cb791));if(_0x5cb791['error']){if(_0x5cb791[_0xc6cf('0x14')]['code']===0x1f4){logger['error']('SquareProject,\x20%s,\x20%s',_0x376840,_0x5cb791['error'][_0xc6cf('0x15')]);return _0x42e5b2(_0x5cb791['error']['message']);}logger[_0xc6cf('0x14')]('SquareProject,\x20%s,\x20%s',_0x376840,_0x5cb791['error'][_0xc6cf('0x15')]);return _0x290e6c(_0x5cb791[_0xc6cf('0x14')][_0xc6cf('0x15')]);}else{logger[_0xc6cf('0xf')](_0xc6cf('0x10'),_0x376840,_0xc6cf('0x11'));_0x290e6c(_0x5cb791[_0xc6cf('0x16')][_0xc6cf('0x15')]);}})['catch'](function(_0x54dcf9){logger['error'](_0xc6cf('0x10'),_0x376840,_0x54dcf9);_0x42e5b2(_0x54dcf9);});});}exports[_0xc6cf('0x17')]=function(_0x47f154){var _0x4b0f2a=this;return new Promise(function(_0x1de596,_0x6eaa87){return db[_0xc6cf('0x18')][_0xc6cf('0x19')]({'raw':_0x47f154[_0xc6cf('0x1a')]?_0x47f154['options']['raw']===undefined?!![]:![]:!![],'where':_0x47f154['options']?_0x47f154[_0xc6cf('0x1a')][_0xc6cf('0x1b')]||null:null,'attributes':_0x47f154['options']?_0x47f154['options'][_0xc6cf('0x1c')]||null:null,'include':_0x47f154['options']?_0x47f154[_0xc6cf('0x1a')][_0xc6cf('0x1d')]?_[_0xc6cf('0x1e')](_0x47f154[_0xc6cf('0x1a')][_0xc6cf('0x1d')],function(_0x22ff87){return{'model':db[_0x22ff87['model']],'as':_0x22ff87['as'],'attributes':_0x22ff87[_0xc6cf('0x1c')],'include':_0x22ff87['include']?_[_0xc6cf('0x1e')](_0x22ff87['include'],function(_0x546f3f){return{'model':db[_0x546f3f[_0xc6cf('0x1f')]],'as':_0x546f3f['as'],'attributes':_0x546f3f[_0xc6cf('0x1c')],'include':_0x546f3f[_0xc6cf('0x1d')]?_[_0xc6cf('0x1e')](_0x546f3f[_0xc6cf('0x1d')],function(_0x4974d0){return{'model':db[_0x4974d0[_0xc6cf('0x1f')]],'as':_0x4974d0['as'],'attributes':_0x4974d0['attributes']};}):[]};}):[]};}):[]:[]})[_0xc6cf('0xe')](function(_0x34fdb7){logger['info']('ShowSquareProject',_0x47f154);logger[_0xc6cf('0x20')](_0xc6cf('0x17'),_0x47f154,JSON[_0xc6cf('0x13')](_0x34fdb7));_0x1de596(_0x34fdb7);})[_0xc6cf('0x21')](function(_0xdd77e0){logger[_0xc6cf('0x14')](_0xc6cf('0x17'),_0xdd77e0['message'],_0x47f154);_0x6eaa87(_0x4b0f2a[_0xc6cf('0x14')](0x1f4,_0xdd77e0[_0xc6cf('0x15')]));});});}; \ No newline at end of file +var _0x9dc6=['then','debug','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','./squareProject.socket','register','request','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareProject,\x20%s,\x20%s','message','info','result','catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','model','map'];(function(_0x1c86cf,_0xd758df){var _0x22c104=function(_0x330796){while(--_0x330796){_0x1c86cf['push'](_0x1c86cf['shift']());}};_0x22c104(++_0xd758df);}(_0x9dc6,0x146));var _0x69dc=function(_0x264e1f,_0x5f5dc0){_0x264e1f=_0x264e1f-0x0;var _0x46b895=_0x9dc6[_0x264e1f];return _0x46b895;};'use strict';var _=require(_0x69dc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x69dc('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x69dc('0x2'));var db=require(_0x69dc('0x3'))['db'];var utils=require(_0x69dc('0x4'));var logger=require(_0x69dc('0x5'))(_0x69dc('0x6'));var config=require(_0x69dc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x69dc('0x8')][_0x69dc('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x69dc('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x69dc('0xa')]));require(_0x69dc('0xb'))[_0x69dc('0xc')](socket);function respondWithRpcPromise(_0x434d54,_0x57e4b7,_0x407fe3){return new BPromise(function(_0x2c997b,_0x277182){return client[_0x69dc('0xd')](_0x434d54,_0x407fe3)['then'](function(_0x341104){logger['info']('SquareProject,\x20%s,\x20%s',_0x57e4b7,_0x69dc('0xe'));logger['debug'](_0x69dc('0xf'),_0x57e4b7,_0x69dc('0xe'),JSON[_0x69dc('0x10')](_0x341104));if(_0x341104['error']){if(_0x341104[_0x69dc('0x11')][_0x69dc('0x12')]===0x1f4){logger[_0x69dc('0x11')](_0x69dc('0x13'),_0x57e4b7,_0x341104[_0x69dc('0x11')][_0x69dc('0x14')]);return _0x277182(_0x341104['error'][_0x69dc('0x14')]);}logger[_0x69dc('0x11')](_0x69dc('0x13'),_0x57e4b7,_0x341104['error']['message']);return _0x2c997b(_0x341104[_0x69dc('0x11')][_0x69dc('0x14')]);}else{logger[_0x69dc('0x15')](_0x69dc('0x13'),_0x57e4b7,_0x69dc('0xe'));_0x2c997b(_0x341104[_0x69dc('0x16')][_0x69dc('0x14')]);}})[_0x69dc('0x17')](function(_0x562e1c){logger[_0x69dc('0x11')]('SquareProject,\x20%s,\x20%s',_0x57e4b7,_0x562e1c);_0x277182(_0x562e1c);});});}exports[_0x69dc('0x18')]=function(_0x13ccae){var _0x16c01e=this;return new Promise(function(_0x40e7bd,_0x36ddf0){return db[_0x69dc('0x19')][_0x69dc('0x1a')]({'raw':_0x13ccae[_0x69dc('0x1b')]?_0x13ccae[_0x69dc('0x1b')][_0x69dc('0x1c')]===undefined?!![]:![]:!![],'where':_0x13ccae[_0x69dc('0x1b')]?_0x13ccae[_0x69dc('0x1b')][_0x69dc('0x1d')]||null:null,'attributes':_0x13ccae[_0x69dc('0x1b')]?_0x13ccae['options'][_0x69dc('0x1e')]||null:null,'include':_0x13ccae['options']?_0x13ccae[_0x69dc('0x1b')][_0x69dc('0x1f')]?_['map'](_0x13ccae['options']['include'],function(_0x38948c){return{'model':db[_0x38948c[_0x69dc('0x20')]],'as':_0x38948c['as'],'attributes':_0x38948c[_0x69dc('0x1e')],'include':_0x38948c[_0x69dc('0x1f')]?_[_0x69dc('0x21')](_0x38948c['include'],function(_0x1bfb97){return{'model':db[_0x1bfb97[_0x69dc('0x20')]],'as':_0x1bfb97['as'],'attributes':_0x1bfb97[_0x69dc('0x1e')],'include':_0x1bfb97[_0x69dc('0x1f')]?_[_0x69dc('0x21')](_0x1bfb97[_0x69dc('0x1f')],function(_0x49e7c9){return{'model':db[_0x49e7c9[_0x69dc('0x20')]],'as':_0x49e7c9['as'],'attributes':_0x49e7c9[_0x69dc('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x69dc('0x22')](function(_0x7e2982){logger[_0x69dc('0x15')]('ShowSquareProject',_0x13ccae);logger[_0x69dc('0x23')](_0x69dc('0x18'),_0x13ccae,JSON[_0x69dc('0x10')](_0x7e2982));_0x40e7bd(_0x7e2982);})[_0x69dc('0x17')](function(_0x214204){logger[_0x69dc('0x11')]('ShowSquareProject',_0x214204[_0x69dc('0x14')],_0x13ccae);_0x36ddf0(_0x16c01e['error'](0x1f4,_0x214204[_0x69dc('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 7f737f8..e75c094 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 _0xd117=['save','remove','update','emit','removeListener','register','length','squareProject:','./squareProject.events'];(function(_0x6e0673,_0xb815cb){var _0x2fe57e=function(_0x20c41c){while(--_0x20c41c){_0x6e0673['push'](_0x6e0673['shift']());}};_0x2fe57e(++_0xb815cb);}(_0xd117,0x182));var _0x7d11=function(_0x1dc01f,_0x157a75){_0x1dc01f=_0x1dc01f-0x0;var _0x298041=_0xd117[_0x1dc01f];return _0x298041;};'use strict';var SquareProjectEvents=require(_0x7d11('0x0'));var events=[_0x7d11('0x1'),_0x7d11('0x2'),_0x7d11('0x3')];function createListener(_0x454387,_0x26e0f0){return function(_0x306ae4){_0x26e0f0[_0x7d11('0x4')](_0x454387,_0x306ae4);};}function removeListener(_0x3c07be,_0x31fcb0){return function(){SquareProjectEvents[_0x7d11('0x5')](_0x3c07be,_0x31fcb0);};}exports[_0x7d11('0x6')]=function(_0x27d7e8){for(var _0x40c3c4=0x0,_0x345602=events[_0x7d11('0x7')];_0x40c3c4<_0x345602;_0x40c3c4++){var _0x47b5e6=events[_0x40c3c4];var _0x3803b5=createListener(_0x7d11('0x8')+_0x47b5e6,_0x27d7e8);SquareProjectEvents['on'](_0x47b5e6,_0x3803b5);}}; \ No newline at end of file +var _0x781d=['squareProject:','./squareProject.events','save','emit','removeListener','register','length'];(function(_0x60c661,_0x4e3a24){var _0x268911=function(_0x159798){while(--_0x159798){_0x60c661['push'](_0x60c661['shift']());}};_0x268911(++_0x4e3a24);}(_0x781d,0x14a));var _0xd781=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x781d[_0x5b644e];return _0x49c6bf;};'use strict';var SquareProjectEvents=require(_0xd781('0x0'));var events=[_0xd781('0x1'),'remove','update'];function createListener(_0xb125bf,_0x44a72d){return function(_0x3cd308){_0x44a72d[_0xd781('0x2')](_0xb125bf,_0x3cd308);};}function removeListener(_0xfd915d,_0x42258e){return function(){SquareProjectEvents[_0xd781('0x3')](_0xfd915d,_0x42258e);};}exports[_0xd781('0x4')]=function(_0x830b){for(var _0x2f98ee=0x0,_0x5a07f0=events[_0xd781('0x5')];_0x2f98ee<_0x5a07f0;_0x2f98ee++){var _0x1a242d=events[_0x2f98ee];var _0x50610d=createListener(_0xd781('0x6')+_0x1a242d,_0x830b);SquareProjectEvents['on'](_0x1a242d,_0x50610d);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 9c2abb2..c9b8fe1 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 _0x407f=['destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','post','put','update','delete'];(function(_0x4ae756,_0x2d489c){var _0x2f04d1=function(_0xcb965b){while(--_0xcb965b){_0x4ae756['push'](_0x4ae756['shift']());}};_0x2f04d1(++_0x2d489c);}(_0x407f,0x106));var _0xf407=function(_0x302a84,_0xfaf37c){_0x302a84=_0x302a84-0x0;var _0x28ef60=_0x407f[_0x302a84];return _0x28ef60;};'use strict';var multer=require('multer');var util=require(_0xf407('0x0'));var path=require(_0xf407('0x1'));var timeout=require(_0xf407('0x2'));var express=require(_0xf407('0x3'));var router=express[_0xf407('0x4')]();var auth=require(_0xf407('0x5'));var interaction=require(_0xf407('0x6'));var config=require(_0xf407('0x7'));var controller=require('./squareRecording.controller');router[_0xf407('0x8')]('/',auth[_0xf407('0x9')](),controller['index']);router['get'](_0xf407('0xa'),auth[_0xf407('0x9')](),controller[_0xf407('0xb')]);router[_0xf407('0x8')](_0xf407('0xc'),auth[_0xf407('0x9')](),controller[_0xf407('0xd')]);router[_0xf407('0xe')]('/',auth[_0xf407('0x9')](),controller['create']);router[_0xf407('0xf')](_0xf407('0xa'),auth[_0xf407('0x9')](),controller[_0xf407('0x10')]);router[_0xf407('0x11')]('/:id/delete',auth['isAuthenticated'](),controller[_0xf407('0x12')]);module[_0xf407('0x13')]=router; \ No newline at end of file +var _0x4b1e=['delete','/:id/delete','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','download','post','create','put'];(function(_0x1f87a3,_0x3799c5){var _0x17ebae=function(_0x55b076){while(--_0x55b076){_0x1f87a3['push'](_0x1f87a3['shift']());}};_0x17ebae(++_0x3799c5);}(_0x4b1e,0x15a));var _0xe4b1=function(_0xe39824,_0xbdf61f){_0xe39824=_0xe39824-0x0;var _0x4bc31e=_0x4b1e[_0xe39824];return _0x4bc31e;};'use strict';var multer=require(_0xe4b1('0x0'));var util=require('util');var path=require(_0xe4b1('0x1'));var timeout=require(_0xe4b1('0x2'));var express=require(_0xe4b1('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe4b1('0x4'));var config=require(_0xe4b1('0x5'));var controller=require('./squareRecording.controller');router[_0xe4b1('0x6')]('/',auth[_0xe4b1('0x7')](),controller[_0xe4b1('0x8')]);router['get'](_0xe4b1('0x9'),auth[_0xe4b1('0x7')](),controller['show']);router[_0xe4b1('0x6')]('/:id/download',auth[_0xe4b1('0x7')](),controller[_0xe4b1('0xa')]);router[_0xe4b1('0xb')]('/',auth['isAuthenticated'](),controller[_0xe4b1('0xc')]);router[_0xe4b1('0xd')](_0xe4b1('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xe4b1('0xe')](_0xe4b1('0xf'),auth[_0xe4b1('0x7')](),controller[_0xe4b1('0x10')]);module[_0xe4b1('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 7be3f27..97e4613 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 _0x99fd=['sequelize','STRING','VIRTUAL','getDataValue','savePath','substring'];(function(_0x2d9548,_0x2c84d8){var _0x2088cc=function(_0x1ca8c){while(--_0x1ca8c){_0x2d9548['push'](_0x2d9548['shift']());}};_0x2088cc(++_0x2c84d8);}(_0x99fd,0x1e0));var _0xd99f=function(_0x1ff15d,_0x21b441){_0x1ff15d=_0x1ff15d-0x0;var _0x51a67f=_0x99fd[_0x1ff15d];return _0x51a67f;};'use strict';var Sequelize=require(_0xd99f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xd99f('0x1')]},'callerid':{'type':Sequelize[_0xd99f('0x1')]},'calleridname':{'type':Sequelize[_0xd99f('0x1')]},'context':{'type':Sequelize[_0xd99f('0x1')]},'extension':{'type':Sequelize[_0xd99f('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd99f('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0xd99f('0x1')]},'filename':{'type':Sequelize[_0xd99f('0x1')]},'savePath':{'type':Sequelize[_0xd99f('0x1')]},'format':{'type':Sequelize[_0xd99f('0x2')],'get':function(){var _0x4a6671='';var _0x2c78c7=this[_0xd99f('0x3')](_0xd99f('0x4'));if(_0x2c78c7){_0x4a6671=_0x2c78c7[_0xd99f('0x5')](_0x2c78c7['lastIndexOf']('.'));}return _0x4a6671;}}}; \ No newline at end of file +var _0x956b=['STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','exports'];(function(_0xb249e6,_0x25b5be){var _0x5da21c=function(_0x2b9a1f){while(--_0x2b9a1f){_0xb249e6['push'](_0xb249e6['shift']());}};_0x5da21c(++_0x25b5be);}(_0x956b,0x16e));var _0xb956=function(_0x3fb9a0,_0x3fc898){_0x3fb9a0=_0x3fb9a0-0x0;var _0x1b860f=_0x956b[_0x3fb9a0];return _0x1b860f;};'use strict';var Sequelize=require(_0xb956('0x0'));module[_0xb956('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb956('0x2')]},'context':{'type':Sequelize[_0xb956('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb956('0x2')]},'accountcode':{'type':Sequelize[_0xb956('0x2')]},'dnid':{'type':Sequelize[_0xb956('0x2')]},'projectName':{'type':Sequelize[_0xb956('0x2')]},'saveName':{'type':Sequelize[_0xb956('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xb956('0x2')]},'format':{'type':Sequelize[_0xb956('0x3')],'get':function(){var _0x37f7b7='';var _0x335d9f=this[_0xb956('0x4')](_0xb956('0x5'));if(_0x335d9f){_0x37f7b7=_0x335d9f[_0xb956('0x6')](_0x335d9f[_0xb956('0x7')]('.'));}return _0x37f7b7;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 8d9da9d..be445b1 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 _0x0080=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','rows','catch','show','params','options','create','body','update','find','../../components/encryptor','type','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','download','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','isNil','info','unlinkSync','.cypher','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','status','json','offset','limit','apply','save','destroy','then','sendStatus','error','stack','name','send','SquareRecording','rawAttributes','fieldName','key','model','map','keys','query','filters','attributes','intersection','fields'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x0080,0x91));var _0x0008=function(_0x544141,_0x231e35){_0x544141=_0x544141-0x0;var _0x3ff9a8=_0x0080[_0x544141];return _0x3ff9a8;};'use strict';var pdf=require(_0x0008('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0008('0x1'));var zipdir=require(_0x0008('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0008('0x3'));var moment=require(_0x0008('0x4'));var BPromise=require(_0x0008('0x5'));var Mustache=require(_0x0008('0x6'));var util=require(_0x0008('0x7'));var path=require(_0x0008('0x8'));var sox=require(_0x0008('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0008('0xa'));var squel=require(_0x0008('0xb'));var crypto=require(_0x0008('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0008('0xd'));var toCsv=require(_0x0008('0xe'));var querystring=require(_0x0008('0xf'));var Papa=require(_0x0008('0x10'));var Redis=require(_0x0008('0x11'));var authService=require(_0x0008('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0008('0x13'));var hardwareService=require(_0x0008('0x14'));var logger=require(_0x0008('0x15'))(_0x0008('0x16'));var utils=require(_0x0008('0x17'));var config=require('../../config/environment');var db=require(_0x0008('0x18'))['db'];function respondWithStatusCode(_0x2b771c,_0x4c4cc1){_0x4c4cc1=_0x4c4cc1||0xcc;return function(_0x50e20b){if(_0x50e20b){return _0x2b771c['sendStatus'](_0x4c4cc1);}return _0x2b771c['status'](_0x4c4cc1)[_0x0008('0x19')]();};}function respondWithResult(_0x317f23,_0x191d43){_0x191d43=_0x191d43||0xc8;return function(_0x1ead57){if(_0x1ead57){return _0x317f23[_0x0008('0x1a')](_0x191d43)[_0x0008('0x1b')](_0x1ead57);}};}function respondWithFilteredResult(_0x271f34,_0x31d082){return function(_0x51271e){if(_0x51271e){var _0x2b73bc=_0x51271e['count'],_0x4e7f35=_0x31d082[_0x0008('0x1c')],_0x22f47b=_0x31d082[_0x0008('0x1c')]+_0x31d082[_0x0008('0x1d')],_0x5f0b30;if(_0x22f47b>=_0x2b73bc){_0x22f47b=_0x2b73bc;_0x5f0b30=0xc8;}else{_0x5f0b30=0xce;}_0x271f34[_0x0008('0x1a')](_0x5f0b30);return _0x271f34['set']('Content-Range',_0x4e7f35+'-'+_0x22f47b+'/'+_0x2b73bc)['json'](_0x51271e);}return null;};}function patchUpdates(_0x4e5ebd){return function(_0xa88095){try{jsonpatch[_0x0008('0x1e')](_0xa88095,_0x4e5ebd,!![]);}catch(_0x133223){return BPromise['reject'](_0x133223);}return _0xa88095[_0x0008('0x1f')]();};}function saveUpdates(_0x206792,_0x5720da){return function(_0x4fee77){if(_0x4fee77){return _0x4fee77['update'](_0x206792)['then'](function(_0x42e1d6){return _0x42e1d6;});}return null;};}function removeEntity(_0x1962f5,_0x3b64d2){return function(_0x442488){if(_0x442488){return _0x442488[_0x0008('0x20')]()[_0x0008('0x21')](function(){_0x1962f5[_0x0008('0x1a')](0xcc)[_0x0008('0x19')]();});}};}function handleEntityNotFound(_0xbe9068,_0xdeefc9){return function(_0x480165){if(!_0x480165){_0xbe9068[_0x0008('0x22')](0x194);}return _0x480165;};}function handleError(_0x38a908,_0x29ecfb){_0x29ecfb=_0x29ecfb||0x1f4;return function(_0x1d80e3){logger[_0x0008('0x23')](_0x1d80e3[_0x0008('0x24')]);if(_0x1d80e3[_0x0008('0x25')]){delete _0x1d80e3[_0x0008('0x25')];}_0x38a908[_0x0008('0x1a')](_0x29ecfb)[_0x0008('0x26')](_0x1d80e3);};}exports['index']=function(_0x4e9419,_0x54806e){var _0x43df6c={},_0x227205={},_0x19d2ea={'count':0x0,'rows':[]};var _0x50a8d1=_['map'](db[_0x0008('0x27')][_0x0008('0x28')],function(_0x138d64){return{'name':_0x138d64[_0x0008('0x29')],'type':_0x138d64['type'][_0x0008('0x2a')]};});_0x227205[_0x0008('0x2b')]=_[_0x0008('0x2c')](_0x50a8d1,_0x0008('0x25'));_0x227205['query']=_[_0x0008('0x2d')](_0x4e9419[_0x0008('0x2e')]);_0x227205[_0x0008('0x2f')]=_['intersection'](_0x227205[_0x0008('0x2b')],_0x227205[_0x0008('0x2e')]);_0x43df6c[_0x0008('0x30')]=_[_0x0008('0x31')](_0x227205[_0x0008('0x2b')],qs['fields'](_0x4e9419['query'][_0x0008('0x32')]));_0x43df6c[_0x0008('0x30')]=_0x43df6c[_0x0008('0x30')][_0x0008('0x33')]?_0x43df6c[_0x0008('0x30')]:_0x227205[_0x0008('0x2b')];if(!_0x4e9419[_0x0008('0x2e')][_0x0008('0x34')](_0x0008('0x35'))){_0x43df6c['limit']=qs[_0x0008('0x1d')](_0x4e9419[_0x0008('0x2e')]['limit']);_0x43df6c[_0x0008('0x1c')]=qs['offset'](_0x4e9419[_0x0008('0x2e')][_0x0008('0x1c')]);}_0x43df6c[_0x0008('0x36')]=qs[_0x0008('0x37')](_0x4e9419[_0x0008('0x2e')]['sort']);_0x43df6c[_0x0008('0x38')]=qs[_0x0008('0x2f')](_[_0x0008('0x39')](_0x4e9419[_0x0008('0x2e')],_0x227205['filters']),_0x50a8d1);if(_0x4e9419[_0x0008('0x2e')][_0x0008('0x3a')]){_0x43df6c[_0x0008('0x38')]=_[_0x0008('0x3b')](_0x43df6c[_0x0008('0x38')],{'$or':_['map'](_0x50a8d1,function(_0x340998){if(_0x340998['type']!==_0x0008('0x3c')){var _0x247d46={};_0x247d46[_0x340998[_0x0008('0x25')]]={'$like':'%'+_0x4e9419[_0x0008('0x2e')][_0x0008('0x3a')]+'%'};return _0x247d46;}})});}_0x43df6c=_[_0x0008('0x3b')]({},_0x43df6c,_0x4e9419['options']);var _0xaf9c50={'where':_0x43df6c[_0x0008('0x38')]};return db[_0x0008('0x27')]['count'](_0xaf9c50)[_0x0008('0x21')](function(_0x642c4c){_0x19d2ea[_0x0008('0x3d')]=_0x642c4c;if(_0x4e9419[_0x0008('0x2e')][_0x0008('0x3e')]){_0x43df6c[_0x0008('0x3f')]=[{'all':!![]}];}return db[_0x0008('0x27')]['findAll'](_0x43df6c);})[_0x0008('0x21')](function(_0x41a7f9){_0x19d2ea[_0x0008('0x40')]=_0x41a7f9;return _0x19d2ea;})[_0x0008('0x21')](respondWithFilteredResult(_0x54806e,_0x43df6c))[_0x0008('0x41')](handleError(_0x54806e,null));};exports[_0x0008('0x42')]=function(_0x2b0931,_0x57d1c8){var _0x5653d5={'raw':!![],'where':{'id':_0x2b0931[_0x0008('0x43')]['id']}},_0x41e0dd={};_0x41e0dd[_0x0008('0x2b')]=_[_0x0008('0x2d')](db[_0x0008('0x27')][_0x0008('0x28')]);_0x41e0dd[_0x0008('0x2e')]=_['keys'](_0x2b0931[_0x0008('0x2e')]);_0x41e0dd[_0x0008('0x2f')]=_[_0x0008('0x31')](_0x41e0dd['model'],_0x41e0dd['query']);_0x5653d5[_0x0008('0x30')]=_[_0x0008('0x31')](_0x41e0dd['model'],qs[_0x0008('0x32')](_0x2b0931[_0x0008('0x2e')][_0x0008('0x32')]));_0x5653d5[_0x0008('0x30')]=_0x5653d5[_0x0008('0x30')][_0x0008('0x33')]?_0x5653d5[_0x0008('0x30')]:_0x41e0dd[_0x0008('0x2b')];if(_0x2b0931[_0x0008('0x2e')]['includeAll']){_0x5653d5[_0x0008('0x3f')]=[{'all':!![]}];}_0x5653d5=_['merge']({},_0x5653d5,_0x2b0931[_0x0008('0x44')]);return db['SquareRecording']['find'](_0x5653d5)[_0x0008('0x21')](handleEntityNotFound(_0x57d1c8,null))[_0x0008('0x21')](respondWithResult(_0x57d1c8,null))['catch'](handleError(_0x57d1c8,null));};exports[_0x0008('0x45')]=function(_0xc801cd,_0x286f23){return db[_0x0008('0x27')]['create'](_0xc801cd[_0x0008('0x46')],{})['then'](respondWithResult(_0x286f23,0xc9))['catch'](handleError(_0x286f23,null));};exports[_0x0008('0x47')]=function(_0x29367b,_0x555e3b){if(_0x29367b['body']['id']){delete _0x29367b[_0x0008('0x46')]['id'];}return db[_0x0008('0x27')][_0x0008('0x48')]({'where':{'id':_0x29367b[_0x0008('0x43')]['id']}})[_0x0008('0x21')](handleEntityNotFound(_0x555e3b,null))[_0x0008('0x21')](saveUpdates(_0x29367b[_0x0008('0x46')],null))[_0x0008('0x21')](respondWithResult(_0x555e3b,null))['catch'](handleError(_0x555e3b,null));};exports['download']=function(_0x2a30d0,_0x55a926,_0x4d63ac){var _0x4fd3d6=require(_0x0008('0x49'));var _0xda9d7e=![];var _0x5858ab={};if(_0x2a30d0[_0x0008('0x2e')][_0x0008('0x4a')]&&_0x2a30d0[_0x0008('0x2e')]['type']===_0x0008('0x4b')){_0x5858ab['uniqueid']=_0x2a30d0[_0x0008('0x43')]['id'];}else{_0x5858ab['id']=_0x2a30d0[_0x0008('0x43')]['id'];}return db[_0x0008('0x27')][_0x0008('0x48')]({'where':_0x5858ab,'attributes':['id',_0x0008('0x4c'),_0x0008('0x4d')],'raw':!![]})[_0x0008('0x21')](handleEntityNotFound(_0x55a926,null))['then'](function(_0x742f0){if(_0x742f0){var _0x4f91ad=_0x742f0['savePath'];var _0x305d76=util[_0x0008('0x4e')](_0x0008('0x4f'),_0x4f91ad);if(fs[_0x0008('0x50')](_0x305d76)){_0xda9d7e=!![];return _0x4fd3d6[_0x0008('0x51')](_0x305d76,_0x4f91ad,config[_0x0008('0x52')][_0x0008('0x53')])[_0x0008('0x21')](function(){return _0x742f0;});}return _0x742f0;}})['then'](function(_0x3d96cc){if(_0x3d96cc){var _0x324673=_0x3d96cc['savePath'];if(!fs['existsSync'](_0x324673)){throw new db[(_0x0008('0x54'))][(_0x0008('0x55'))]('SquareRecording\x20not\x20found');}if(_0x3d96cc['filename']){return _0x55a926[_0x0008('0x56')](_0x324673,_0x3d96cc[_0x0008('0x4d')]+path[_0x0008('0x57')](_0x324673),function(){if(_0xda9d7e){fs[_0x0008('0x58')](_0x324673);}});}else{return _0x55a926[_0x0008('0x56')](_0x324673,function(_0x474253){if(_0xda9d7e){fs['unlink'](_0x324673);}});}}})['catch'](function(_0x4872ce){if(_0x4872ce[_0x0008('0x59')]===_0x0008('0x5a')){_0x55a926[_0x0008('0x1a')](0x194)['send'](_0x0008('0x5b'));}else{return handleError(_0x55a926,null);}});};exports[_0x0008('0x20')]=function(_0x4e0c83,_0x6293b9){return db[_0x0008('0x27')][_0x0008('0x48')]({'where':{'id':_0x4e0c83['params']['id']}})[_0x0008('0x21')](function(_0x37e668){if(!_0x37e668)throw new ReferenceError('Entity\x20not\x20found');return _0x37e668;})[_0x0008('0x21')](function(_0x5651b3){var _0x1658a3=_0x5651b3[_0x0008('0x4c')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x1658a3);if(!_[_0x0008('0x5c')](_0x5651b3['savePath'])&&fs['existsSync'](_0x1658a3)){logger[_0x0008('0x5d')]('File:\x20\x22'+_0x1658a3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x0008('0x5e')](_0x1658a3);}_0x1658a3=_0x1658a3+_0x0008('0x5f');if(!_[_0x0008('0x5c')](_0x5651b3['savePath'])&&fs[_0x0008('0x50')](_0x1658a3)){logger['info'](_0x0008('0x60')+_0x1658a3+_0x0008('0x61'));fs[_0x0008('0x5e')](_0x1658a3);}return _0x5651b3;})[_0x0008('0x21')](function(_0x1d558c){if(!_0x1d558c)throw new InternalError();return _0x1d558c['destroy']();})[_0x0008('0x21')](function(){_0x6293b9['status'](0xcc)[_0x0008('0x19')]();})[_0x0008('0x41')](handleError(_0x6293b9,null));}; \ No newline at end of file +var _0xb411=['recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','set','Content-Range','apply','save','update','then','destroy','end','error','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','SquareRecording','find','create','body','download','uniqueid','savePath','filename','format','%s.cypher','existsSync','secrets'];(function(_0x4442f5,_0x58ff30){var _0x4b064d=function(_0x24e62e){while(--_0x24e62e){_0x4442f5['push'](_0x4442f5['shift']());}};_0x4b064d(++_0x58ff30);}(_0xb411,0x6c));var _0x1b41=function(_0x534619,_0xf252de){_0x534619=_0x534619-0x0;var _0x32402b=_0xb411[_0x534619];return _0x32402b;};'use strict';var pdf=require(_0x1b41('0x0'));var emlformat=require(_0x1b41('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1b41('0x2'));var jsonpatch=require(_0x1b41('0x3'));var rp=require(_0x1b41('0x4'));var moment=require('moment');var BPromise=require(_0x1b41('0x5'));var Mustache=require(_0x1b41('0x6'));var util=require(_0x1b41('0x7'));var path=require(_0x1b41('0x8'));var sox=require(_0x1b41('0x9'));var csv=require(_0x1b41('0xa'));var ejs=require(_0x1b41('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1b41('0xc'));var crypto=require('crypto');var jsforce=require(_0x1b41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1b41('0xa'));var querystring=require('querystring');var Papa=require(_0x1b41('0xe'));var Redis=require(_0x1b41('0xf'));var authService=require(_0x1b41('0x10'));var qs=require(_0x1b41('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b41('0x12'));var logger=require(_0x1b41('0x13'))(_0x1b41('0x14'));var utils=require(_0x1b41('0x15'));var config=require(_0x1b41('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ef67a,_0x3636f9){_0x3636f9=_0x3636f9||0xcc;return function(_0x16bad2){if(_0x16bad2){return _0x4ef67a[_0x1b41('0x17')](_0x3636f9);}return _0x4ef67a['status'](_0x3636f9)['end']();};}function respondWithResult(_0x3b4653,_0x486fed){_0x486fed=_0x486fed||0xc8;return function(_0x3fd7a1){if(_0x3fd7a1){return _0x3b4653[_0x1b41('0x18')](_0x486fed)[_0x1b41('0x19')](_0x3fd7a1);}};}function respondWithFilteredResult(_0x202a89,_0x58e013){return function(_0x547400){if(_0x547400){var _0x545f43=_0x547400[_0x1b41('0x1a')],_0x35b881=_0x58e013[_0x1b41('0x1b')],_0x8f2c71=_0x58e013[_0x1b41('0x1b')]+_0x58e013['limit'],_0x73569a;if(_0x8f2c71>=_0x545f43){_0x8f2c71=_0x545f43;_0x73569a=0xc8;}else{_0x73569a=0xce;}_0x202a89[_0x1b41('0x18')](_0x73569a);return _0x202a89[_0x1b41('0x1c')](_0x1b41('0x1d'),_0x35b881+'-'+_0x8f2c71+'/'+_0x545f43)[_0x1b41('0x19')](_0x547400);}return null;};}function patchUpdates(_0x17f780){return function(_0x75b3ba){try{jsonpatch[_0x1b41('0x1e')](_0x75b3ba,_0x17f780,!![]);}catch(_0x3656ab){return BPromise['reject'](_0x3656ab);}return _0x75b3ba[_0x1b41('0x1f')]();};}function saveUpdates(_0x257f41,_0x2d044e){return function(_0x146897){if(_0x146897){return _0x146897[_0x1b41('0x20')](_0x257f41)[_0x1b41('0x21')](function(_0x5374b4){return _0x5374b4;});}return null;};}function removeEntity(_0xa448e1,_0x4ed502){return function(_0x576b0d){if(_0x576b0d){return _0x576b0d[_0x1b41('0x22')]()[_0x1b41('0x21')](function(){_0xa448e1[_0x1b41('0x18')](0xcc)[_0x1b41('0x23')]();});}};}function handleEntityNotFound(_0x460eaa,_0x440ec5){return function(_0x21d09b){if(!_0x21d09b){_0x460eaa['sendStatus'](0x194);}return _0x21d09b;};}function handleError(_0x1202c1,_0x2e8d49){_0x2e8d49=_0x2e8d49||0x1f4;return function(_0x251a6b){logger[_0x1b41('0x24')](_0x251a6b['stack']);if(_0x251a6b[_0x1b41('0x25')]){delete _0x251a6b[_0x1b41('0x25')];}_0x1202c1[_0x1b41('0x18')](_0x2e8d49)[_0x1b41('0x26')](_0x251a6b);};}exports[_0x1b41('0x27')]=function(_0x1a7076,_0x130405){var _0x4b68cb={},_0x5f02f2={},_0x3c10e0={'count':0x0,'rows':[]};var _0x370a9b=_['map'](db['SquareRecording'][_0x1b41('0x28')],function(_0x12812a){return{'name':_0x12812a['fieldName'],'type':_0x12812a[_0x1b41('0x29')][_0x1b41('0x2a')]};});_0x5f02f2[_0x1b41('0x2b')]=_[_0x1b41('0x2c')](_0x370a9b,_0x1b41('0x25'));_0x5f02f2[_0x1b41('0x2d')]=_[_0x1b41('0x2e')](_0x1a7076['query']);_0x5f02f2[_0x1b41('0x2f')]=_[_0x1b41('0x30')](_0x5f02f2[_0x1b41('0x2b')],_0x5f02f2['query']);_0x4b68cb['attributes']=_[_0x1b41('0x30')](_0x5f02f2['model'],qs['fields'](_0x1a7076[_0x1b41('0x2d')][_0x1b41('0x31')]));_0x4b68cb[_0x1b41('0x32')]=_0x4b68cb['attributes'][_0x1b41('0x33')]?_0x4b68cb[_0x1b41('0x32')]:_0x5f02f2['model'];if(!_0x1a7076[_0x1b41('0x2d')][_0x1b41('0x34')](_0x1b41('0x35'))){_0x4b68cb[_0x1b41('0x36')]=qs[_0x1b41('0x36')](_0x1a7076[_0x1b41('0x2d')][_0x1b41('0x36')]);_0x4b68cb[_0x1b41('0x1b')]=qs[_0x1b41('0x1b')](_0x1a7076[_0x1b41('0x2d')]['offset']);}_0x4b68cb['order']=qs[_0x1b41('0x37')](_0x1a7076[_0x1b41('0x2d')][_0x1b41('0x37')]);_0x4b68cb[_0x1b41('0x38')]=qs[_0x1b41('0x2f')](_[_0x1b41('0x39')](_0x1a7076[_0x1b41('0x2d')],_0x5f02f2[_0x1b41('0x2f')]),_0x370a9b);if(_0x1a7076[_0x1b41('0x2d')][_0x1b41('0x3a')]){_0x4b68cb[_0x1b41('0x38')]=_[_0x1b41('0x3b')](_0x4b68cb[_0x1b41('0x38')],{'$or':_['map'](_0x370a9b,function(_0x5240b7){if(_0x5240b7[_0x1b41('0x29')]!==_0x1b41('0x3c')){var _0xd57692={};_0xd57692[_0x5240b7[_0x1b41('0x25')]]={'$like':'%'+_0x1a7076[_0x1b41('0x2d')][_0x1b41('0x3a')]+'%'};return _0xd57692;}})});}_0x4b68cb=_['merge']({},_0x4b68cb,_0x1a7076[_0x1b41('0x3d')]);var _0xce64fb={'where':_0x4b68cb[_0x1b41('0x38')]};return db['SquareRecording'][_0x1b41('0x1a')](_0xce64fb)[_0x1b41('0x21')](function(_0x3d1bdc){_0x3c10e0['count']=_0x3d1bdc;if(_0x1a7076[_0x1b41('0x2d')][_0x1b41('0x3e')]){_0x4b68cb[_0x1b41('0x3f')]=[{'all':!![]}];}return db['SquareRecording'][_0x1b41('0x40')](_0x4b68cb);})[_0x1b41('0x21')](function(_0x1741d6){_0x3c10e0['rows']=_0x1741d6;return _0x3c10e0;})['then'](respondWithFilteredResult(_0x130405,_0x4b68cb))[_0x1b41('0x41')](handleError(_0x130405,null));};exports[_0x1b41('0x42')]=function(_0xee43c5,_0x2d3ced){var _0x10bc64={'raw':!![],'where':{'id':_0xee43c5[_0x1b41('0x43')]['id']}},_0x170f59={};_0x170f59['model']=_[_0x1b41('0x2e')](db[_0x1b41('0x44')]['rawAttributes']);_0x170f59['query']=_[_0x1b41('0x2e')](_0xee43c5[_0x1b41('0x2d')]);_0x170f59['filters']=_[_0x1b41('0x30')](_0x170f59[_0x1b41('0x2b')],_0x170f59[_0x1b41('0x2d')]);_0x10bc64[_0x1b41('0x32')]=_[_0x1b41('0x30')](_0x170f59['model'],qs[_0x1b41('0x31')](_0xee43c5[_0x1b41('0x2d')][_0x1b41('0x31')]));_0x10bc64[_0x1b41('0x32')]=_0x10bc64['attributes']['length']?_0x10bc64['attributes']:_0x170f59[_0x1b41('0x2b')];if(_0xee43c5[_0x1b41('0x2d')]['includeAll']){_0x10bc64[_0x1b41('0x3f')]=[{'all':!![]}];}_0x10bc64=_[_0x1b41('0x3b')]({},_0x10bc64,_0xee43c5['options']);return db['SquareRecording'][_0x1b41('0x45')](_0x10bc64)[_0x1b41('0x21')](handleEntityNotFound(_0x2d3ced,null))[_0x1b41('0x21')](respondWithResult(_0x2d3ced,null))[_0x1b41('0x41')](handleError(_0x2d3ced,null));};exports[_0x1b41('0x46')]=function(_0x1ba6e5,_0x53e6a8){return db[_0x1b41('0x44')]['create'](_0x1ba6e5['body'],{})[_0x1b41('0x21')](respondWithResult(_0x53e6a8,0xc9))[_0x1b41('0x41')](handleError(_0x53e6a8,null));};exports[_0x1b41('0x20')]=function(_0x3c0b63,_0x25eb55){if(_0x3c0b63[_0x1b41('0x47')]['id']){delete _0x3c0b63[_0x1b41('0x47')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0x3c0b63[_0x1b41('0x43')]['id']}})[_0x1b41('0x21')](handleEntityNotFound(_0x25eb55,null))[_0x1b41('0x21')](saveUpdates(_0x3c0b63[_0x1b41('0x47')],null))[_0x1b41('0x21')](respondWithResult(_0x25eb55,null))[_0x1b41('0x41')](handleError(_0x25eb55,null));};exports[_0x1b41('0x48')]=function(_0x11cca8,_0x58f8d9,_0x188ffd){var _0x33be93=require('../../components/encryptor');var _0x291d35=![];var _0x2c9548={};if(_0x11cca8[_0x1b41('0x2d')][_0x1b41('0x29')]&&_0x11cca8[_0x1b41('0x2d')]['type']===_0x1b41('0x49')){_0x2c9548[_0x1b41('0x49')]=_0x11cca8[_0x1b41('0x43')]['id'];}else{_0x2c9548['id']=_0x11cca8[_0x1b41('0x43')]['id'];}return db[_0x1b41('0x44')][_0x1b41('0x45')]({'where':_0x2c9548,'attributes':['id',_0x1b41('0x4a'),_0x1b41('0x4b')],'raw':!![]})[_0x1b41('0x21')](handleEntityNotFound(_0x58f8d9,null))['then'](function(_0x581039){if(_0x581039){var _0x41a99f=_0x581039[_0x1b41('0x4a')];var _0x126139=util[_0x1b41('0x4c')](_0x1b41('0x4d'),_0x41a99f);if(fs[_0x1b41('0x4e')](_0x126139)){_0x291d35=!![];return _0x33be93['decryptFile'](_0x126139,_0x41a99f,config[_0x1b41('0x4f')][_0x1b41('0x50')])['then'](function(){return _0x581039;});}return _0x581039;}})[_0x1b41('0x21')](function(_0x3ba4d3){if(_0x3ba4d3){var _0xb6f6bc=_0x3ba4d3['savePath'];if(!fs[_0x1b41('0x4e')](_0xb6f6bc)){throw new db[(_0x1b41('0x51'))][(_0x1b41('0x52'))](_0x1b41('0x53'));}if(_0x3ba4d3[_0x1b41('0x4b')]){return _0x58f8d9[_0x1b41('0x48')](_0xb6f6bc,_0x3ba4d3[_0x1b41('0x4b')]+path[_0x1b41('0x54')](_0xb6f6bc),function(){if(_0x291d35){fs[_0x1b41('0x55')](_0xb6f6bc);}});}else{return _0x58f8d9[_0x1b41('0x48')](_0xb6f6bc,function(_0x48efa7){if(_0x291d35){fs[_0x1b41('0x55')](_0xb6f6bc);}});}}})['catch'](function(_0x302e78){if(_0x302e78[_0x1b41('0x56')]===_0x1b41('0x53')){_0x58f8d9['status'](0x194)[_0x1b41('0x26')](_0x1b41('0x57'));}else{return handleError(_0x58f8d9,null);}});};exports[_0x1b41('0x22')]=function(_0x17344e,_0x3c4575){return db['SquareRecording']['find']({'where':{'id':_0x17344e[_0x1b41('0x43')]['id']}})[_0x1b41('0x21')](function(_0x286cfe){if(!_0x286cfe)throw new ReferenceError('Entity\x20not\x20found');return _0x286cfe;})[_0x1b41('0x21')](function(_0x6f55bd){var _0x195e1c=_0x6f55bd[_0x1b41('0x4a')];logger[_0x1b41('0x58')](_0x1b41('0x59'),_0x195e1c);if(!_[_0x1b41('0x5a')](_0x6f55bd[_0x1b41('0x4a')])&&fs['existsSync'](_0x195e1c)){logger[_0x1b41('0x58')]('File:\x20\x22'+_0x195e1c+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x1b41('0x5b')](_0x195e1c);}_0x195e1c=_0x195e1c+_0x1b41('0x5c');if(!_[_0x1b41('0x5a')](_0x6f55bd[_0x1b41('0x4a')])&&fs[_0x1b41('0x4e')](_0x195e1c)){logger[_0x1b41('0x58')]('File:\x20\x22'+_0x195e1c+_0x1b41('0x5d'));fs['unlinkSync'](_0x195e1c);}return _0x6f55bd;})[_0x1b41('0x21')](function(_0x389df2){if(!_0x389df2)throw new InternalError();return _0x389df2[_0x1b41('0x22')]();})[_0x1b41('0x21')](function(){_0x3c4575[_0x1b41('0x18')](0xcc)[_0x1b41('0x23')]();})[_0x1b41('0x41')](handleError(_0x3c4575,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index a39dee2..e4007c2 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 _0x2d21=['../../config/logger','bluebird','path','exports','define','SquareRecording','square_recordings','util'];(function(_0x374ada,_0x27b3a5){var _0x449ed8=function(_0x3efc46){while(--_0x3efc46){_0x374ada['push'](_0x374ada['shift']());}};_0x449ed8(++_0x27b3a5);}(_0x2d21,0x137));var _0x12d2=function(_0x1b8524,_0x1bb669){_0x1b8524=_0x1b8524-0x0;var _0x81418d=_0x2d21[_0x1b8524];return _0x81418d;};'use strict';var _=require('lodash');var util=require(_0x12d2('0x0'));var logger=require(_0x12d2('0x1'))('api');var moment=require('moment');var BPromise=require(_0x12d2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x12d2('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module[_0x12d2('0x4')]=function(_0x2aea04,_0xf8a1d0){return _0x2aea04[_0x12d2('0x5')](_0x12d2('0x6'),attributes,{'tableName':_0x12d2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x308f=['path','rimraf','./squareRecording.attributes','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x1a3243,_0x201872){var _0x33f2ca=function(_0x59d32e){while(--_0x59d32e){_0x1a3243['push'](_0x1a3243['shift']());}};_0x33f2ca(++_0x201872);}(_0x308f,0x153));var _0xf308=function(_0x23e7f1,_0x305828){_0x23e7f1=_0x23e7f1-0x0;var _0x56ee8f=_0x308f[_0x23e7f1];return _0x56ee8f;};'use strict';var _=require(_0xf308('0x0'));var util=require('util');var logger=require(_0xf308('0x1'))(_0xf308('0x2'));var moment=require('moment');var BPromise=require(_0xf308('0x3'));var rp=require(_0xf308('0x4'));var fs=require('fs');var path=require(_0xf308('0x5'));var rimraf=require(_0xf308('0x6'));var config=require('../../config/environment');var attributes=require(_0xf308('0x7'));module['exports']=function(_0x2cccb8,_0x2af098){return _0x2cccb8['define']('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index fa9cb56..90168f0 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 _0xdd3f=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareRecording','SquareRecording','body','options','raw','info','debug','catch','lodash','util','moment'];(function(_0x3a796e,_0x4e8a8c){var _0x11cc46=function(_0x3652de){while(--_0x3652de){_0x3a796e['push'](_0x3a796e['shift']());}};_0x11cc46(++_0x4e8a8c);}(_0xdd3f,0x147));var _0xfdd3=function(_0x37c33a,_0x523e81){_0x37c33a=_0x37c33a-0x0;var _0x1a41fc=_0xdd3f[_0x37c33a];return _0x1a41fc;};'use strict';var _=require(_0xfdd3('0x0'));var util=require(_0xfdd3('0x1'));var moment=require(_0xfdd3('0x2'));var BPromise=require('bluebird');var rs=require(_0xfdd3('0x3'));var fs=require('fs');var Redis=require(_0xfdd3('0x4'));var db=require(_0xfdd3('0x5'))['db'];var utils=require(_0xfdd3('0x6'));var logger=require(_0xfdd3('0x7'))(_0xfdd3('0x8'));var config=require(_0xfdd3('0x9'));var jayson=require(_0xfdd3('0xa'));var client=jayson['client'][_0xfdd3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ce46e,_0x4bb242,_0x2e92f3){return new BPromise(function(_0x205249,_0x82c8fb){return client[_0xfdd3('0xc')](_0x5ce46e,_0x2e92f3)[_0xfdd3('0xd')](function(_0x25dac2){logger['info'](_0xfdd3('0xe'),_0x4bb242,_0xfdd3('0xf'));logger['debug'](_0xfdd3('0x10'),_0x4bb242,'request\x20sent',JSON[_0xfdd3('0x11')](_0x25dac2));if(_0x25dac2[_0xfdd3('0x12')]){if(_0x25dac2[_0xfdd3('0x12')][_0xfdd3('0x13')]===0x1f4){logger[_0xfdd3('0x12')](_0xfdd3('0xe'),_0x4bb242,_0x25dac2[_0xfdd3('0x12')][_0xfdd3('0x14')]);return _0x82c8fb(_0x25dac2['error'][_0xfdd3('0x14')]);}logger[_0xfdd3('0x12')](_0xfdd3('0xe'),_0x4bb242,_0x25dac2[_0xfdd3('0x12')][_0xfdd3('0x14')]);return _0x205249(_0x25dac2[_0xfdd3('0x12')][_0xfdd3('0x14')]);}else{logger['info'](_0xfdd3('0xe'),_0x4bb242,_0xfdd3('0xf'));_0x205249(_0x25dac2[_0xfdd3('0x15')]['message']);}})['catch'](function(_0x573560){logger['error'](_0xfdd3('0xe'),_0x4bb242,_0x573560);_0x82c8fb(_0x573560);});});}exports[_0xfdd3('0x16')]=function(_0x16085a){var _0x4caafc=this;return new Promise(function(_0x1abee1,_0x3c5be6){return db[_0xfdd3('0x17')]['create'](_0x16085a[_0xfdd3('0x18')],{'raw':_0x16085a[_0xfdd3('0x19')]?_0x16085a['options'][_0xfdd3('0x1a')]===undefined?!![]:![]:!![]})[_0xfdd3('0xd')](function(_0x274893){logger[_0xfdd3('0x1b')](_0xfdd3('0x16'),_0x16085a);logger[_0xfdd3('0x1c')](_0xfdd3('0x16'),_0x16085a,JSON[_0xfdd3('0x11')](_0x274893));_0x1abee1(_0x274893);})[_0xfdd3('0x1d')](function(_0x25c643){logger[_0xfdd3('0x12')](_0xfdd3('0x16'),_0x25c643['message'],_0x16085a);_0x3c5be6(_0x4caafc[_0xfdd3('0x12')](0x1f4,_0x25c643[_0xfdd3('0x14')]));});});}; \ No newline at end of file +var _0x4738=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareRecording,\x20%s,\x20%s','catch','SquareRecording','create','body','options','raw','then','CreateSquareRecording','moment','bluebird','randomstring','ioredis'];(function(_0x49f6d3,_0x20cb6c){var _0x8b457b=function(_0xf55e){while(--_0xf55e){_0x49f6d3['push'](_0x49f6d3['shift']());}};_0x8b457b(++_0x20cb6c);}(_0x4738,0x14c));var _0x8473=function(_0x2b6426,_0x3a72a9){_0x2b6426=_0x2b6426-0x0;var _0x4e2c28=_0x4738[_0x2b6426];return _0x4e2c28;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8473('0x0'));var BPromise=require(_0x8473('0x1'));var rs=require(_0x8473('0x2'));var fs=require('fs');var Redis=require(_0x8473('0x3'));var db=require(_0x8473('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8473('0x5'))('rpc');var config=require(_0x8473('0x6'));var jayson=require(_0x8473('0x7'));var client=jayson[_0x8473('0x8')][_0x8473('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14e59b,_0x546224,_0x5e71f2){return new BPromise(function(_0x3df9d0,_0x4da447){return client[_0x8473('0xa')](_0x14e59b,_0x5e71f2)['then'](function(_0x525c25){logger[_0x8473('0xb')]('SquareRecording,\x20%s,\x20%s',_0x546224,_0x8473('0xc'));logger[_0x8473('0xd')](_0x8473('0xe'),_0x546224,_0x8473('0xc'),JSON[_0x8473('0xf')](_0x525c25));if(_0x525c25['error']){if(_0x525c25[_0x8473('0x10')][_0x8473('0x11')]===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x546224,_0x525c25['error'][_0x8473('0x12')]);return _0x4da447(_0x525c25['error'][_0x8473('0x12')]);}logger['error'](_0x8473('0x13'),_0x546224,_0x525c25[_0x8473('0x10')]['message']);return _0x3df9d0(_0x525c25[_0x8473('0x10')][_0x8473('0x12')]);}else{logger[_0x8473('0xb')]('SquareRecording,\x20%s,\x20%s',_0x546224,_0x8473('0xc'));_0x3df9d0(_0x525c25['result'][_0x8473('0x12')]);}})[_0x8473('0x14')](function(_0x1de16a){logger['error'](_0x8473('0x13'),_0x546224,_0x1de16a);_0x4da447(_0x1de16a);});});}exports['CreateSquareRecording']=function(_0xe92ba2){var _0xf0cbc7=this;return new Promise(function(_0x50702c,_0x345b74){return db[_0x8473('0x15')][_0x8473('0x16')](_0xe92ba2[_0x8473('0x17')],{'raw':_0xe92ba2[_0x8473('0x18')]?_0xe92ba2[_0x8473('0x18')][_0x8473('0x19')]===undefined?!![]:![]:!![]})[_0x8473('0x1a')](function(_0x2d45e1){logger[_0x8473('0xb')](_0x8473('0x1b'),_0xe92ba2);logger[_0x8473('0xd')](_0x8473('0x1b'),_0xe92ba2,JSON[_0x8473('0xf')](_0x2d45e1));_0x50702c(_0x2d45e1);})['catch'](function(_0x1f8648){logger[_0x8473('0x10')]('CreateSquareRecording',_0x1f8648[_0x8473('0x12')],_0xe92ba2);_0x345b74(_0xf0cbc7['error'](0x1f4,_0x1f8648[_0x8473('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index e678cf8..b10395f 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 _0x2f02=['index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./squareReport.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f02,0x170));var _0x22f0=function(_0xd6fcb5,_0x526523){_0xd6fcb5=_0xd6fcb5-0x0;var _0x278ac7=_0x2f02[_0xd6fcb5];return _0x278ac7;};'use strict';var multer=require(_0x22f0('0x0'));var util=require(_0x22f0('0x1'));var path=require(_0x22f0('0x2'));var timeout=require(_0x22f0('0x3'));var express=require(_0x22f0('0x4'));var router=express['Router']();var auth=require(_0x22f0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x22f0('0x6'));var controller=require(_0x22f0('0x7'));router[_0x22f0('0x8')]('/',auth[_0x22f0('0x9')](),controller[_0x22f0('0xa')]);router['get'](_0x22f0('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x22f0('0xc'),auth[_0x22f0('0x9')](),controller[_0x22f0('0xd')]);router[_0x22f0('0xe')]('/',auth['isAuthenticated'](),controller[_0x22f0('0xf')]);router[_0x22f0('0x10')](_0x22f0('0xc'),auth['isAuthenticated'](),controller[_0x22f0('0x11')]);router[_0x22f0('0x12')](_0x22f0('0xc'),auth[_0x22f0('0x9')](),controller[_0x22f0('0x13')]);module[_0x22f0('0x14')]=router; \ No newline at end of file +var _0xf250=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','isAuthenticated','show','post','create','put','/:id'];(function(_0x3476f3,_0x5e7e32){var _0x1fedf1=function(_0x1f4bdb){while(--_0x1f4bdb){_0x3476f3['push'](_0x3476f3['shift']());}};_0x1fedf1(++_0x5e7e32);}(_0xf250,0x1d1));var _0x0f25=function(_0x4491ef,_0x5153d9){_0x4491ef=_0x4491ef-0x0;var _0x3c72dc=_0xf250[_0x4491ef];return _0x3c72dc;};'use strict';var multer=require(_0x0f25('0x0'));var util=require(_0x0f25('0x1'));var path=require(_0x0f25('0x2'));var timeout=require(_0x0f25('0x3'));var express=require(_0x0f25('0x4'));var router=express[_0x0f25('0x5')]();var auth=require(_0x0f25('0x6'));var interaction=require(_0x0f25('0x7'));var config=require(_0x0f25('0x8'));var controller=require(_0x0f25('0x9'));router[_0x0f25('0xa')]('/',auth['isAuthenticated'](),controller[_0x0f25('0xb')]);router[_0x0f25('0xa')]('/describe',auth[_0x0f25('0xc')](),controller['describe']);router[_0x0f25('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0f25('0xd')]);router[_0x0f25('0xe')]('/',auth[_0x0f25('0xc')](),controller[_0x0f25('0xf')]);router[_0x0f25('0x10')](_0x0f25('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x0f25('0x12')](_0x0f25('0x11'),auth[_0x0f25('0xc')](),controller[_0x0f25('0x13')]);module[_0x0f25('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index d00c786..86f6916 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 _0xf5e0=['BOOLEAN','exports','STRING','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf5e0,0xa5));var _0x0f5e=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xf5e0[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module[_0x0f5e('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x0f5e('0x1')]},'channel':{'type':Sequelize[_0x0f5e('0x1')]},'language':{'type':Sequelize[_0x0f5e('0x1')]},'type':{'type':Sequelize[_0x0f5e('0x1')]},'uniqueid':{'type':Sequelize[_0x0f5e('0x1')]},'version':{'type':Sequelize[_0x0f5e('0x1')]},'callerid':{'type':Sequelize[_0x0f5e('0x1')]},'calleridname':{'type':Sequelize[_0x0f5e('0x1')]},'callingpres':{'type':Sequelize[_0x0f5e('0x1')]},'callingani2':{'type':Sequelize[_0x0f5e('0x1')]},'callington':{'type':Sequelize[_0x0f5e('0x1')]},'callingtns':{'type':Sequelize[_0x0f5e('0x1')]},'dnid':{'type':Sequelize[_0x0f5e('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x0f5e('0x1')]},'extension':{'type':Sequelize[_0x0f5e('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x0f5e('0x1')]},'joinAt':{'type':Sequelize[_0x0f5e('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x0f5e('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x8e67=['sequelize','STRING','DATE','BOOLEAN'];(function(_0x297883,_0x3983b7){var _0x9b8e97=function(_0x293efd){while(--_0x293efd){_0x297883['push'](_0x297883['shift']());}};_0x9b8e97(++_0x3983b7);}(_0x8e67,0xb4));var _0x78e6=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0x8e67[_0x243217];return _0x478029;};'use strict';var Sequelize=require(_0x78e6('0x0'));module['exports']={'network':{'type':Sequelize[_0x78e6('0x1')]},'network_script':{'type':Sequelize[_0x78e6('0x1')]},'request':{'type':Sequelize[_0x78e6('0x1')]},'channel':{'type':Sequelize[_0x78e6('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x78e6('0x1')]},'calleridname':{'type':Sequelize[_0x78e6('0x1')]},'callingpres':{'type':Sequelize[_0x78e6('0x1')]},'callingani2':{'type':Sequelize[_0x78e6('0x1')]},'callington':{'type':Sequelize[_0x78e6('0x1')]},'callingtns':{'type':Sequelize[_0x78e6('0x1')]},'dnid':{'type':Sequelize[_0x78e6('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x78e6('0x1')]},'priority':{'type':Sequelize[_0x78e6('0x1')]},'enhanced':{'type':Sequelize[_0x78e6('0x1')]},'accountcode':{'type':Sequelize[_0x78e6('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x78e6('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x78e6('0x2')]},'bot':{'type':Sequelize[_0x78e6('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 6790b6e..bc70ceb 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 _0x6fed=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','include','findAll','catch','show','keys','rawAttributes','includeAll','find','create','body','update','params','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','then','end','error','stack','name','send','index','SquareReport','fieldName','type','key','query','filters','intersection','model'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6fed,0xfa));var _0xd6fe=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6fed[_0x397e5f];return _0x5302b8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd6fe('0x0'));var zipdir=require(_0xd6fe('0x1'));var jsonpatch=require(_0xd6fe('0x2'));var rp=require(_0xd6fe('0x3'));var moment=require('moment');var BPromise=require(_0xd6fe('0x4'));var Mustache=require(_0xd6fe('0x5'));var util=require(_0xd6fe('0x6'));var path=require(_0xd6fe('0x7'));var sox=require(_0xd6fe('0x8'));var csv=require(_0xd6fe('0x9'));var ejs=require(_0xd6fe('0xa'));var fs=require('fs');var _=require(_0xd6fe('0xb'));var squel=require('squel');var crypto=require(_0xd6fe('0xc'));var jsforce=require(_0xd6fe('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd6fe('0x9'));var querystring=require(_0xd6fe('0xe'));var Papa=require(_0xd6fe('0xf'));var Redis=require(_0xd6fe('0x10'));var authService=require(_0xd6fe('0x11'));var qs=require(_0xd6fe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6fe('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xd6fe('0x14'))['db'];function respondWithStatusCode(_0x1c6e31,_0xe31cef){_0xe31cef=_0xe31cef||0xcc;return function(_0x5c7501){if(_0x5c7501){return _0x1c6e31[_0xd6fe('0x15')](_0xe31cef);}return _0x1c6e31[_0xd6fe('0x16')](_0xe31cef)['end']();};}function respondWithResult(_0x2411fe,_0x2f72eb){_0x2f72eb=_0x2f72eb||0xc8;return function(_0x18deae){if(_0x18deae){return _0x2411fe[_0xd6fe('0x16')](_0x2f72eb)['json'](_0x18deae);}};}function respondWithFilteredResult(_0x236269,_0xaa7a35){return function(_0x1131bc){if(_0x1131bc){var _0x25ce9e=_0x1131bc[_0xd6fe('0x17')],_0x3b3c1f=_0xaa7a35['offset'],_0x16b983=_0xaa7a35[_0xd6fe('0x18')]+_0xaa7a35[_0xd6fe('0x19')],_0x283ebd;if(_0x16b983>=_0x25ce9e){_0x16b983=_0x25ce9e;_0x283ebd=0xc8;}else{_0x283ebd=0xce;}_0x236269['status'](_0x283ebd);return _0x236269[_0xd6fe('0x1a')](_0xd6fe('0x1b'),_0x3b3c1f+'-'+_0x16b983+'/'+_0x25ce9e)[_0xd6fe('0x1c')](_0x1131bc);}return null;};}function patchUpdates(_0x303227){return function(_0x174869){try{jsonpatch['apply'](_0x174869,_0x303227,!![]);}catch(_0x28d504){return BPromise[_0xd6fe('0x1d')](_0x28d504);}return _0x174869[_0xd6fe('0x1e')]();};}function saveUpdates(_0x54ccc,_0x4edf78){return function(_0x1722f3){if(_0x1722f3){return _0x1722f3['update'](_0x54ccc)[_0xd6fe('0x1f')](function(_0x516125){return _0x516125;});}return null;};}function removeEntity(_0x3ce66f,_0x5a1060){return function(_0x198eaa){if(_0x198eaa){return _0x198eaa['destroy']()[_0xd6fe('0x1f')](function(){_0x3ce66f[_0xd6fe('0x16')](0xcc)[_0xd6fe('0x20')]();});}};}function handleEntityNotFound(_0x182893,_0x671535){return function(_0x37bfe9){if(!_0x37bfe9){_0x182893[_0xd6fe('0x15')](0x194);}return _0x37bfe9;};}function handleError(_0x1b2411,_0x323dd0){_0x323dd0=_0x323dd0||0x1f4;return function(_0x2332d7){logger[_0xd6fe('0x21')](_0x2332d7[_0xd6fe('0x22')]);if(_0x2332d7[_0xd6fe('0x23')]){delete _0x2332d7[_0xd6fe('0x23')];}_0x1b2411[_0xd6fe('0x16')](_0x323dd0)[_0xd6fe('0x24')](_0x2332d7);};}exports[_0xd6fe('0x25')]=function(_0x57d9a4,_0x595c4c){var _0x593257={},_0x1eb3fe={},_0x3c3bb8={'count':0x0,'rows':[]};var _0x2f42ac=_['map'](db[_0xd6fe('0x26')]['rawAttributes'],function(_0x27dc69){return{'name':_0x27dc69[_0xd6fe('0x27')],'type':_0x27dc69[_0xd6fe('0x28')][_0xd6fe('0x29')]};});_0x1eb3fe['model']=_['map'](_0x2f42ac,_0xd6fe('0x23'));_0x1eb3fe[_0xd6fe('0x2a')]=_['keys'](_0x57d9a4['query']);_0x1eb3fe[_0xd6fe('0x2b')]=_[_0xd6fe('0x2c')](_0x1eb3fe[_0xd6fe('0x2d')],_0x1eb3fe[_0xd6fe('0x2a')]);_0x593257[_0xd6fe('0x2e')]=_[_0xd6fe('0x2c')](_0x1eb3fe['model'],qs[_0xd6fe('0x2f')](_0x57d9a4[_0xd6fe('0x2a')]['fields']));_0x593257[_0xd6fe('0x2e')]=_0x593257[_0xd6fe('0x2e')][_0xd6fe('0x30')]?_0x593257[_0xd6fe('0x2e')]:_0x1eb3fe[_0xd6fe('0x2d')];if(!_0x57d9a4[_0xd6fe('0x2a')][_0xd6fe('0x31')](_0xd6fe('0x32'))){_0x593257['limit']=qs['limit'](_0x57d9a4[_0xd6fe('0x2a')][_0xd6fe('0x19')]);_0x593257[_0xd6fe('0x18')]=qs[_0xd6fe('0x18')](_0x57d9a4[_0xd6fe('0x2a')]['offset']);}_0x593257[_0xd6fe('0x33')]=qs[_0xd6fe('0x34')](_0x57d9a4['query']['sort']);_0x593257['where']=qs['filters'](_[_0xd6fe('0x35')](_0x57d9a4['query'],_0x1eb3fe[_0xd6fe('0x2b')]),_0x2f42ac);if(_0x57d9a4[_0xd6fe('0x2a')][_0xd6fe('0x36')]){_0x593257[_0xd6fe('0x37')]=_[_0xd6fe('0x38')](_0x593257[_0xd6fe('0x37')],{'$or':_[_0xd6fe('0x39')](_0x2f42ac,function(_0x3493ab){if(_0x3493ab['type']!==_0xd6fe('0x3a')){var _0x34331c={};_0x34331c[_0x3493ab[_0xd6fe('0x23')]]={'$like':'%'+_0x57d9a4[_0xd6fe('0x2a')]['filter']+'%'};return _0x34331c;}})});}_0x593257=_[_0xd6fe('0x38')]({},_0x593257,_0x57d9a4[_0xd6fe('0x3b')]);var _0x278ec2={'where':_0x593257[_0xd6fe('0x37')]};return db[_0xd6fe('0x26')][_0xd6fe('0x17')](_0x278ec2)[_0xd6fe('0x1f')](function(_0x327a59){_0x3c3bb8['count']=_0x327a59;if(_0x57d9a4[_0xd6fe('0x2a')]['includeAll']){_0x593257[_0xd6fe('0x3c')]=[{'all':!![]}];}return db[_0xd6fe('0x26')][_0xd6fe('0x3d')](_0x593257);})['then'](function(_0x49b45a){_0x3c3bb8['rows']=_0x49b45a;return _0x3c3bb8;})[_0xd6fe('0x1f')](respondWithFilteredResult(_0x595c4c,_0x593257))[_0xd6fe('0x3e')](handleError(_0x595c4c,null));};exports[_0xd6fe('0x3f')]=function(_0x244a82,_0x312e2a){var _0x3802d6={'raw':!![],'where':{'id':_0x244a82['params']['id']}},_0x499447={};_0x499447[_0xd6fe('0x2d')]=_[_0xd6fe('0x40')](db[_0xd6fe('0x26')][_0xd6fe('0x41')]);_0x499447[_0xd6fe('0x2a')]=_['keys'](_0x244a82['query']);_0x499447['filters']=_[_0xd6fe('0x2c')](_0x499447[_0xd6fe('0x2d')],_0x499447[_0xd6fe('0x2a')]);_0x3802d6[_0xd6fe('0x2e')]=_[_0xd6fe('0x2c')](_0x499447[_0xd6fe('0x2d')],qs['fields'](_0x244a82[_0xd6fe('0x2a')][_0xd6fe('0x2f')]));_0x3802d6[_0xd6fe('0x2e')]=_0x3802d6[_0xd6fe('0x2e')][_0xd6fe('0x30')]?_0x3802d6['attributes']:_0x499447[_0xd6fe('0x2d')];if(_0x244a82[_0xd6fe('0x2a')][_0xd6fe('0x42')]){_0x3802d6[_0xd6fe('0x3c')]=[{'all':!![]}];}_0x3802d6=_[_0xd6fe('0x38')]({},_0x3802d6,_0x244a82[_0xd6fe('0x3b')]);return db[_0xd6fe('0x26')][_0xd6fe('0x43')](_0x3802d6)['then'](handleEntityNotFound(_0x312e2a,null))[_0xd6fe('0x1f')](respondWithResult(_0x312e2a,null))[_0xd6fe('0x3e')](handleError(_0x312e2a,null));};exports[_0xd6fe('0x44')]=function(_0xa65059,_0x4a5fd7){return db[_0xd6fe('0x26')]['create'](_0xa65059[_0xd6fe('0x45')],{})[_0xd6fe('0x1f')](respondWithResult(_0x4a5fd7,0xc9))[_0xd6fe('0x3e')](handleError(_0x4a5fd7,null));};exports[_0xd6fe('0x46')]=function(_0x4a030e,_0x25e0b3){if(_0x4a030e['body']['id']){delete _0x4a030e[_0xd6fe('0x45')]['id'];}return db['SquareReport'][_0xd6fe('0x43')]({'where':{'id':_0x4a030e[_0xd6fe('0x47')]['id']}})[_0xd6fe('0x1f')](handleEntityNotFound(_0x25e0b3,null))[_0xd6fe('0x1f')](saveUpdates(_0x4a030e['body'],null))[_0xd6fe('0x1f')](respondWithResult(_0x25e0b3,null))[_0xd6fe('0x3e')](handleError(_0x25e0b3,null));};exports[_0xd6fe('0x48')]=function(_0x4cf95c,_0x37f635){return db[_0xd6fe('0x26')][_0xd6fe('0x43')]({'where':{'id':_0x4cf95c[_0xd6fe('0x47')]['id']}})['then'](handleEntityNotFound(_0x37f635,null))['then'](removeEntity(_0x37f635,null))[_0xd6fe('0x3e')](handleError(_0x37f635,null));};exports[_0xd6fe('0x49')]=function(_0x5e6c99,_0x3c1fa8){return db[_0xd6fe('0x26')][_0xd6fe('0x49')]()['then'](respondWithResult(_0x3c1fa8,null))[_0xd6fe('0x3e')](handleError(_0x3c1fa8,null));}; \ No newline at end of file +var _0x8d5a=['squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','SquareReport','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs'];(function(_0x51ad33,_0x2ed428){var _0x203c2f=function(_0x38c122){while(--_0x38c122){_0x51ad33['push'](_0x51ad33['shift']());}};_0x203c2f(++_0x2ed428);}(_0x8d5a,0x1da));var _0xa8d5=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x8d5a[_0x13d07a];return _0x5ee0ee;};'use strict';var pdf=require(_0xa8d5('0x0'));var emlformat=require(_0xa8d5('0x1'));var rimraf=require(_0xa8d5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa8d5('0x3'));var rp=require(_0xa8d5('0x4'));var moment=require(_0xa8d5('0x5'));var BPromise=require(_0xa8d5('0x6'));var Mustache=require('mustache');var util=require(_0xa8d5('0x7'));var path=require(_0xa8d5('0x8'));var sox=require(_0xa8d5('0x9'));var csv=require(_0xa8d5('0xa'));var ejs=require(_0xa8d5('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa8d5('0xc'));var crypto=require(_0xa8d5('0xd'));var jsforce=require(_0xa8d5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa8d5('0xa'));var querystring=require(_0xa8d5('0xf'));var Papa=require(_0xa8d5('0x10'));var Redis=require(_0xa8d5('0x11'));var authService=require(_0xa8d5('0x12'));var qs=require(_0xa8d5('0x13'));var as=require(_0xa8d5('0x14'));var hardwareService=require(_0xa8d5('0x15'));var logger=require(_0xa8d5('0x16'))(_0xa8d5('0x17'));var utils=require(_0xa8d5('0x18'));var config=require(_0xa8d5('0x19'));var db=require(_0xa8d5('0x1a'))['db'];function respondWithStatusCode(_0x2da8c8,_0x96df19){_0x96df19=_0x96df19||0xcc;return function(_0x131e3d){if(_0x131e3d){return _0x2da8c8['sendStatus'](_0x96df19);}return _0x2da8c8['status'](_0x96df19)[_0xa8d5('0x1b')]();};}function respondWithResult(_0x4cca4c,_0x145827){_0x145827=_0x145827||0xc8;return function(_0x24a650){if(_0x24a650){return _0x4cca4c['status'](_0x145827)[_0xa8d5('0x1c')](_0x24a650);}};}function respondWithFilteredResult(_0x2de647,_0x5061a2){return function(_0x37603b){if(_0x37603b){var _0x4d9f60=_0x37603b[_0xa8d5('0x1d')],_0xfc9af8=_0x5061a2[_0xa8d5('0x1e')],_0x5e84f9=_0x5061a2[_0xa8d5('0x1e')]+_0x5061a2[_0xa8d5('0x1f')],_0xe0a53e;if(_0x5e84f9>=_0x4d9f60){_0x5e84f9=_0x4d9f60;_0xe0a53e=0xc8;}else{_0xe0a53e=0xce;}_0x2de647[_0xa8d5('0x20')](_0xe0a53e);return _0x2de647[_0xa8d5('0x21')](_0xa8d5('0x22'),_0xfc9af8+'-'+_0x5e84f9+'/'+_0x4d9f60)['json'](_0x37603b);}return null;};}function patchUpdates(_0x41542f){return function(_0x15bf88){try{jsonpatch[_0xa8d5('0x23')](_0x15bf88,_0x41542f,!![]);}catch(_0x47d150){return BPromise[_0xa8d5('0x24')](_0x47d150);}return _0x15bf88[_0xa8d5('0x25')]();};}function saveUpdates(_0x4e2a95,_0x53e1eb){return function(_0x566f68){if(_0x566f68){return _0x566f68[_0xa8d5('0x26')](_0x4e2a95)[_0xa8d5('0x27')](function(_0x40fdf1){return _0x40fdf1;});}return null;};}function removeEntity(_0x34f060,_0x45eeaa){return function(_0x55acb1){if(_0x55acb1){return _0x55acb1[_0xa8d5('0x28')]()[_0xa8d5('0x27')](function(){_0x34f060[_0xa8d5('0x20')](0xcc)[_0xa8d5('0x1b')]();});}};}function handleEntityNotFound(_0x2f62e9,_0x52ac3e){return function(_0x41d75e){if(!_0x41d75e){_0x2f62e9[_0xa8d5('0x29')](0x194);}return _0x41d75e;};}function handleError(_0xd897a2,_0x2da2be){_0x2da2be=_0x2da2be||0x1f4;return function(_0x926be5){logger[_0xa8d5('0x2a')](_0x926be5[_0xa8d5('0x2b')]);if(_0x926be5['name']){delete _0x926be5[_0xa8d5('0x2c')];}_0xd897a2[_0xa8d5('0x20')](_0x2da2be)[_0xa8d5('0x2d')](_0x926be5);};}exports[_0xa8d5('0x2e')]=function(_0x4d612c,_0x1c8651){var _0x26f95c={},_0x56fe7b={},_0x1f3b33={'count':0x0,'rows':[]};var _0x5ccff3=_[_0xa8d5('0x2f')](db['SquareReport'][_0xa8d5('0x30')],function(_0x426c86){return{'name':_0x426c86[_0xa8d5('0x31')],'type':_0x426c86[_0xa8d5('0x32')][_0xa8d5('0x33')]};});_0x56fe7b[_0xa8d5('0x34')]=_[_0xa8d5('0x2f')](_0x5ccff3,_0xa8d5('0x2c'));_0x56fe7b[_0xa8d5('0x35')]=_[_0xa8d5('0x36')](_0x4d612c[_0xa8d5('0x35')]);_0x56fe7b[_0xa8d5('0x37')]=_[_0xa8d5('0x38')](_0x56fe7b['model'],_0x56fe7b['query']);_0x26f95c[_0xa8d5('0x39')]=_[_0xa8d5('0x38')](_0x56fe7b[_0xa8d5('0x34')],qs[_0xa8d5('0x3a')](_0x4d612c[_0xa8d5('0x35')]['fields']));_0x26f95c['attributes']=_0x26f95c[_0xa8d5('0x39')][_0xa8d5('0x3b')]?_0x26f95c[_0xa8d5('0x39')]:_0x56fe7b[_0xa8d5('0x34')];if(!_0x4d612c[_0xa8d5('0x35')][_0xa8d5('0x3c')](_0xa8d5('0x3d'))){_0x26f95c[_0xa8d5('0x1f')]=qs['limit'](_0x4d612c[_0xa8d5('0x35')]['limit']);_0x26f95c[_0xa8d5('0x1e')]=qs[_0xa8d5('0x1e')](_0x4d612c['query'][_0xa8d5('0x1e')]);}_0x26f95c[_0xa8d5('0x3e')]=qs[_0xa8d5('0x3f')](_0x4d612c[_0xa8d5('0x35')][_0xa8d5('0x3f')]);_0x26f95c[_0xa8d5('0x40')]=qs[_0xa8d5('0x37')](_[_0xa8d5('0x41')](_0x4d612c[_0xa8d5('0x35')],_0x56fe7b['filters']),_0x5ccff3);if(_0x4d612c[_0xa8d5('0x35')]['filter']){_0x26f95c[_0xa8d5('0x40')]=_[_0xa8d5('0x42')](_0x26f95c[_0xa8d5('0x40')],{'$or':_['map'](_0x5ccff3,function(_0x74bc77){if(_0x74bc77[_0xa8d5('0x32')]!==_0xa8d5('0x43')){var _0xdbf2ba={};_0xdbf2ba[_0x74bc77[_0xa8d5('0x2c')]]={'$like':'%'+_0x4d612c[_0xa8d5('0x35')]['filter']+'%'};return _0xdbf2ba;}})});}_0x26f95c=_[_0xa8d5('0x42')]({},_0x26f95c,_0x4d612c[_0xa8d5('0x44')]);var _0x4cecdf={'where':_0x26f95c[_0xa8d5('0x40')]};return db[_0xa8d5('0x45')][_0xa8d5('0x1d')](_0x4cecdf)[_0xa8d5('0x27')](function(_0x3de54f){_0x1f3b33['count']=_0x3de54f;if(_0x4d612c['query']['includeAll']){_0x26f95c[_0xa8d5('0x46')]=[{'all':!![]}];}return db[_0xa8d5('0x45')][_0xa8d5('0x47')](_0x26f95c);})[_0xa8d5('0x27')](function(_0x2672ed){_0x1f3b33[_0xa8d5('0x48')]=_0x2672ed;return _0x1f3b33;})[_0xa8d5('0x27')](respondWithFilteredResult(_0x1c8651,_0x26f95c))[_0xa8d5('0x49')](handleError(_0x1c8651,null));};exports[_0xa8d5('0x4a')]=function(_0x113f3b,_0x4155ff){var _0x449346={'raw':!![],'where':{'id':_0x113f3b['params']['id']}},_0x581536={};_0x581536[_0xa8d5('0x34')]=_['keys'](db[_0xa8d5('0x45')][_0xa8d5('0x30')]);_0x581536[_0xa8d5('0x35')]=_[_0xa8d5('0x36')](_0x113f3b['query']);_0x581536[_0xa8d5('0x37')]=_[_0xa8d5('0x38')](_0x581536[_0xa8d5('0x34')],_0x581536[_0xa8d5('0x35')]);_0x449346[_0xa8d5('0x39')]=_[_0xa8d5('0x38')](_0x581536[_0xa8d5('0x34')],qs[_0xa8d5('0x3a')](_0x113f3b[_0xa8d5('0x35')][_0xa8d5('0x3a')]));_0x449346['attributes']=_0x449346[_0xa8d5('0x39')][_0xa8d5('0x3b')]?_0x449346[_0xa8d5('0x39')]:_0x581536['model'];if(_0x113f3b[_0xa8d5('0x35')][_0xa8d5('0x4b')]){_0x449346[_0xa8d5('0x46')]=[{'all':!![]}];}_0x449346=_['merge']({},_0x449346,_0x113f3b[_0xa8d5('0x44')]);return db[_0xa8d5('0x45')][_0xa8d5('0x4c')](_0x449346)[_0xa8d5('0x27')](handleEntityNotFound(_0x4155ff,null))['then'](respondWithResult(_0x4155ff,null))[_0xa8d5('0x49')](handleError(_0x4155ff,null));};exports[_0xa8d5('0x4d')]=function(_0x39da23,_0x28ed3b){return db[_0xa8d5('0x45')]['create'](_0x39da23[_0xa8d5('0x4e')],{})[_0xa8d5('0x27')](respondWithResult(_0x28ed3b,0xc9))[_0xa8d5('0x49')](handleError(_0x28ed3b,null));};exports[_0xa8d5('0x26')]=function(_0xd98cd1,_0x2caf38){if(_0xd98cd1['body']['id']){delete _0xd98cd1[_0xa8d5('0x4e')]['id'];}return db['SquareReport'][_0xa8d5('0x4c')]({'where':{'id':_0xd98cd1['params']['id']}})[_0xa8d5('0x27')](handleEntityNotFound(_0x2caf38,null))['then'](saveUpdates(_0xd98cd1['body'],null))['then'](respondWithResult(_0x2caf38,null))[_0xa8d5('0x49')](handleError(_0x2caf38,null));};exports[_0xa8d5('0x28')]=function(_0x14d698,_0x117b4b){return db['SquareReport'][_0xa8d5('0x4c')]({'where':{'id':_0x14d698[_0xa8d5('0x4f')]['id']}})[_0xa8d5('0x27')](handleEntityNotFound(_0x117b4b,null))[_0xa8d5('0x27')](removeEntity(_0x117b4b,null))[_0xa8d5('0x49')](handleError(_0x117b4b,null));};exports['describe']=function(_0x244522,_0x31293b){return db[_0xa8d5('0x45')][_0xa8d5('0x50')]()[_0xa8d5('0x27')](respondWithResult(_0x31293b,null))['catch'](handleError(_0x31293b,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 846d386..ed8f7fb 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 _0xfae7=['./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','project_name','leaveAt','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x296260,_0x1c8a20){var _0x56b38f=function(_0x59bbf7){while(--_0x59bbf7){_0x296260['push'](_0x296260['shift']());}};_0x56b38f(++_0x1c8a20);}(_0xfae7,0x18f));var _0x7fae=function(_0x8f9691,_0x2cb861){_0x8f9691=_0x8f9691-0x0;var _0x314fa5=_0xfae7[_0x8f9691];return _0x314fa5;};'use strict';var _=require(_0x7fae('0x0'));var util=require('util');var logger=require(_0x7fae('0x1'))(_0x7fae('0x2'));var moment=require(_0x7fae('0x3'));var BPromise=require(_0x7fae('0x4'));var rp=require(_0x7fae('0x5'));var fs=require('fs');var path=require(_0x7fae('0x6'));var rimraf=require(_0x7fae('0x7'));var config=require(_0x7fae('0x8'));var attributes=require(_0x7fae('0x9'));module[_0x7fae('0xa')]=function(_0x19d25f,_0x12109e){return _0x19d25f[_0x7fae('0xb')](_0x7fae('0xc'),attributes,{'tableName':_0x7fae('0xd'),'paranoid':![],'indexes':[{'name':_0x7fae('0xe'),'fields':['uniqueid',_0x7fae('0xf')]},{'name':_0x7fae('0x10'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x82bf=['exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReport.attributes'];(function(_0x34d6ae,_0x457fee){var _0x201f2c=function(_0x21a4e8){while(--_0x21a4e8){_0x34d6ae['push'](_0x34d6ae['shift']());}};_0x201f2c(++_0x457fee);}(_0x82bf,0xe0));var _0xf82b=function(_0x409670,_0x4c9151){_0x409670=_0x409670-0x0;var _0x1e0ba6=_0x82bf[_0x409670];return _0x1e0ba6;};'use strict';var _=require(_0xf82b('0x0'));var util=require(_0xf82b('0x1'));var logger=require(_0xf82b('0x2'))(_0xf82b('0x3'));var moment=require(_0xf82b('0x4'));var BPromise=require(_0xf82b('0x5'));var rp=require(_0xf82b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf82b('0x7'));var config=require(_0xf82b('0x8'));var attributes=require(_0xf82b('0x9'));module[_0xf82b('0xa')]=function(_0x4b4d7b,_0x5b13a4){return _0x4b4d7b[_0xf82b('0xb')](_0xf82b('0xc'),attributes,{'tableName':_0xf82b('0xd'),'paranoid':![],'indexes':[{'name':_0xf82b('0xe'),'fields':[_0xf82b('0xf'),_0xf82b('0x10')]},{'name':'leaveAt','fields':[_0xf82b('0x11')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 14d2e5c..d42df30 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 _0xe16b=['debug','stringify','error','code','message','info','result','catch','CreateSquareReport','create','body','options','raw','UpdateSquareReport','SquareReport','update','where','attributes','limit','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent'];(function(_0xb4d02b,_0x42e388){var _0x177778=function(_0x5681c3){while(--_0x5681c3){_0xb4d02b['push'](_0xb4d02b['shift']());}};_0x177778(++_0x42e388);}(_0xe16b,0x145));var _0xbe16=function(_0x4b8156,_0x437af2){_0x4b8156=_0x4b8156-0x0;var _0x4a819c=_0xe16b[_0x4b8156];return _0x4a819c;};'use strict';var _=require(_0xbe16('0x0'));var util=require(_0xbe16('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe16('0x2'));var fs=require('fs');var Redis=require(_0xbe16('0x3'));var db=require(_0xbe16('0x4'))['db'];var utils=require(_0xbe16('0x5'));var logger=require(_0xbe16('0x6'))(_0xbe16('0x7'));var config=require(_0xbe16('0x8'));var jayson=require(_0xbe16('0x9'));var client=jayson['client'][_0xbe16('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4323ff,_0x38e990,_0x395d10){return new BPromise(function(_0x871782,_0x265d9f){return client[_0xbe16('0xb')](_0x4323ff,_0x395d10)[_0xbe16('0xc')](function(_0x262ddd){logger['info'](_0xbe16('0xd'),_0x38e990,_0xbe16('0xe'));logger[_0xbe16('0xf')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x38e990,_0xbe16('0xe'),JSON[_0xbe16('0x10')](_0x262ddd));if(_0x262ddd[_0xbe16('0x11')]){if(_0x262ddd['error'][_0xbe16('0x12')]===0x1f4){logger[_0xbe16('0x11')](_0xbe16('0xd'),_0x38e990,_0x262ddd[_0xbe16('0x11')]['message']);return _0x265d9f(_0x262ddd[_0xbe16('0x11')][_0xbe16('0x13')]);}logger['error'](_0xbe16('0xd'),_0x38e990,_0x262ddd[_0xbe16('0x11')][_0xbe16('0x13')]);return _0x871782(_0x262ddd['error']['message']);}else{logger[_0xbe16('0x14')](_0xbe16('0xd'),_0x38e990,'request\x20sent');_0x871782(_0x262ddd[_0xbe16('0x15')][_0xbe16('0x13')]);}})[_0xbe16('0x16')](function(_0x49f2cf){logger[_0xbe16('0x11')]('SquareReport,\x20%s,\x20%s',_0x38e990,_0x49f2cf);_0x265d9f(_0x49f2cf);});});}exports[_0xbe16('0x17')]=function(_0xb82763){var _0x45a8e9=this;return new Promise(function(_0x177f97,_0x4aff99){return db['SquareReport'][_0xbe16('0x18')](_0xb82763[_0xbe16('0x19')],{'raw':_0xb82763[_0xbe16('0x1a')]?_0xb82763[_0xbe16('0x1a')][_0xbe16('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x438b7e){logger[_0xbe16('0x14')](_0xbe16('0x17'),_0xb82763);logger['debug'](_0xbe16('0x17'),_0xb82763,JSON[_0xbe16('0x10')](_0x438b7e));_0x177f97(_0x438b7e);})[_0xbe16('0x16')](function(_0x5c4a56){logger[_0xbe16('0x11')](_0xbe16('0x17'),_0x5c4a56[_0xbe16('0x13')],_0xb82763);_0x4aff99(_0x45a8e9[_0xbe16('0x11')](0x1f4,_0x5c4a56['message']));});});};exports[_0xbe16('0x1c')]=function(_0x32deae){var _0x2edd85=this;return new Promise(function(_0x26d348,_0x4a6157){return db[_0xbe16('0x1d')][_0xbe16('0x1e')](_0x32deae[_0xbe16('0x19')],{'raw':_0x32deae['options']?_0x32deae[_0xbe16('0x1a')][_0xbe16('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32deae['options']?_0x32deae[_0xbe16('0x1a')][_0xbe16('0x1f')]||null:null,'attributes':_0x32deae['options']?_0x32deae[_0xbe16('0x1a')][_0xbe16('0x20')]||null:null,'limit':_0x32deae[_0xbe16('0x1a')]?_0x32deae[_0xbe16('0x1a')][_0xbe16('0x21')]||null:null})['then'](function(_0x5c5517){logger[_0xbe16('0x14')](_0xbe16('0x1c'),_0x32deae);logger['debug'](_0xbe16('0x1c'),_0x32deae,JSON[_0xbe16('0x10')](_0x5c5517));_0x26d348(_0x5c5517);})[_0xbe16('0x16')](function(_0x215a69){logger[_0xbe16('0x11')](_0xbe16('0x1c'),_0x215a69[_0xbe16('0x13')],_0x32deae);_0x4a6157(_0x2edd85[_0xbe16('0x11')](0x1f4,_0x215a69[_0xbe16('0x13')]));});});}; \ No newline at end of file +var _0x7833=['http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','CreateSquareReport','SquareReport','create','body','options','stringify','UpdateSquareReport','update','raw','where','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x12b240,_0x1f5fc1){var _0x3b890f=function(_0x40be9e){while(--_0x40be9e){_0x12b240['push'](_0x12b240['shift']());}};_0x3b890f(++_0x1f5fc1);}(_0x7833,0x1d6));var _0x3783=function(_0xd1c39b,_0x16f0c6){_0xd1c39b=_0xd1c39b-0x0;var _0x58f5bc=_0x7833[_0xd1c39b];return _0x58f5bc;};'use strict';var _=require(_0x3783('0x0'));var util=require(_0x3783('0x1'));var moment=require('moment');var BPromise=require(_0x3783('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3783('0x3'));var db=require(_0x3783('0x4'))['db'];var utils=require(_0x3783('0x5'));var logger=require('../../config/logger')(_0x3783('0x6'));var config=require(_0x3783('0x7'));var jayson=require(_0x3783('0x8'));var client=jayson[_0x3783('0x9')][_0x3783('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24d305,_0x2c0bed,_0x257517){return new BPromise(function(_0x43915b,_0x157a16){return client[_0x3783('0xb')](_0x24d305,_0x257517)[_0x3783('0xc')](function(_0x30387a){logger[_0x3783('0xd')](_0x3783('0xe'),_0x2c0bed,_0x3783('0xf'));logger[_0x3783('0x10')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x2c0bed,'request\x20sent',JSON['stringify'](_0x30387a));if(_0x30387a['error']){if(_0x30387a[_0x3783('0x11')]['code']===0x1f4){logger[_0x3783('0x11')]('SquareReport,\x20%s,\x20%s',_0x2c0bed,_0x30387a['error']['message']);return _0x157a16(_0x30387a[_0x3783('0x11')][_0x3783('0x12')]);}logger[_0x3783('0x11')]('SquareReport,\x20%s,\x20%s',_0x2c0bed,_0x30387a[_0x3783('0x11')][_0x3783('0x12')]);return _0x43915b(_0x30387a[_0x3783('0x11')][_0x3783('0x12')]);}else{logger[_0x3783('0xd')](_0x3783('0xe'),_0x2c0bed,_0x3783('0xf'));_0x43915b(_0x30387a[_0x3783('0x13')][_0x3783('0x12')]);}})[_0x3783('0x14')](function(_0x3e7fbf){logger[_0x3783('0x11')](_0x3783('0xe'),_0x2c0bed,_0x3e7fbf);_0x157a16(_0x3e7fbf);});});}exports[_0x3783('0x15')]=function(_0x1013ea){var _0x2b6d26=this;return new Promise(function(_0x13188a,_0x29cf4d){return db[_0x3783('0x16')][_0x3783('0x17')](_0x1013ea[_0x3783('0x18')],{'raw':_0x1013ea[_0x3783('0x19')]?_0x1013ea[_0x3783('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x244b91){logger['info']('CreateSquareReport',_0x1013ea);logger['debug'](_0x3783('0x15'),_0x1013ea,JSON[_0x3783('0x1a')](_0x244b91));_0x13188a(_0x244b91);})[_0x3783('0x14')](function(_0x6a7179){logger[_0x3783('0x11')](_0x3783('0x15'),_0x6a7179[_0x3783('0x12')],_0x1013ea);_0x29cf4d(_0x2b6d26[_0x3783('0x11')](0x1f4,_0x6a7179['message']));});});};exports[_0x3783('0x1b')]=function(_0x42149a){var _0x437a03=this;return new Promise(function(_0x20fb69,_0x191033){return db[_0x3783('0x16')][_0x3783('0x1c')](_0x42149a[_0x3783('0x18')],{'raw':_0x42149a[_0x3783('0x19')]?_0x42149a['options'][_0x3783('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42149a['options']?_0x42149a[_0x3783('0x19')][_0x3783('0x1e')]||null:null,'attributes':_0x42149a[_0x3783('0x19')]?_0x42149a[_0x3783('0x19')]['attributes']||null:null,'limit':_0x42149a['options']?_0x42149a[_0x3783('0x19')][_0x3783('0x1f')]||null:null})['then'](function(_0x1ae3ae){logger['info'](_0x3783('0x1b'),_0x42149a);logger['debug']('UpdateSquareReport',_0x42149a,JSON['stringify'](_0x1ae3ae));_0x20fb69(_0x1ae3ae);})[_0x3783('0x14')](function(_0x4c46cc){logger[_0x3783('0x11')](_0x3783('0x1b'),_0x4c46cc[_0x3783('0x12')],_0x42149a);_0x191033(_0x437a03[_0x3783('0x11')](0x1f4,_0x4c46cc[_0x3783('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 3bad2b9..4cbe630 100644 --- a/server/api/squareReportDetail/index.js +++ b/server/api/squareReportDetail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x19dfee,_0x314a43){var _0x6f4a82=function(_0x52ff86){while(--_0x52ff86){_0x19dfee['push'](_0x19dfee['shift']());}};_0x6f4a82(++_0x314a43);}(_0x5f2f,0x73));var _0xf5f2=function(_0x459f94,_0x570e5e){_0x459f94=_0x459f94-0x0;var _0xa1ac8c=_0x5f2f[_0x459f94];return _0xa1ac8c;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file +var _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x27b1f4,_0x28b3ce){var _0x825597=function(_0x14d5f3){while(--_0x14d5f3){_0x27b1f4['push'](_0x27b1f4['shift']());}};_0x825597(++_0x28b3ce);}(_0x7a54,0x106));var _0x47a5=function(_0x1d1816,_0x9e50aa){_0x1d1816=_0x1d1816-0x0;var _0x285dfa=_0x7a54[_0x1d1816];return _0x285dfa;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index f3198a2..fd9a10b 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 _0xd44c=['sequelize','exports','STRING','TEXT'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xd44c,0x1e0));var _0xcd44=function(_0x115621,_0x341cde){_0x115621=_0x115621-0x0;var _0x5ef5ce=_0xd44c[_0x115621];return _0x5ef5ce;};'use strict';var Sequelize=require(_0xcd44('0x0'));module[_0xcd44('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0xcd44('0x2')]},'application':{'type':Sequelize[_0xcd44('0x2')]},'data':{'type':Sequelize[_0xcd44('0x3')]},'project_name':{'type':Sequelize[_0xcd44('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3907=['sequelize','exports','STRING','TEXT'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3907,0xb4));var _0x7390=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x3907[_0x273c39];return _0x46d6b5;};'use strict';var Sequelize=require(_0x7390('0x0'));module[_0x7390('0x1')]={'uniqueid':{'type':Sequelize[_0x7390('0x2')]},'node':{'type':Sequelize[_0x7390('0x2')]},'application':{'type':Sequelize[_0x7390('0x2')]},'data':{'type':Sequelize[_0x7390('0x3')]},'project_name':{'type':Sequelize[_0x7390('0x2')]},'callerid':{'type':Sequelize[_0x7390('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 545d875..69d7a87 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 _0x6557=['status','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','nolimit','sort','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','params','intersection','length','find','create','body','catch','describe','eml-format','zip-dir','request-promise','bluebird','mustache','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/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x6557,0x146));var _0x7655=function(_0x5498f3,_0x133c45){_0x5498f3=_0x5498f3-0x0;var _0x1fcb0b=_0x6557[_0x5498f3];return _0x1fcb0b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7655('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7655('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7655('0x2'));var moment=require('moment');var BPromise=require(_0x7655('0x3'));var Mustache=require(_0x7655('0x4'));var util=require('util');var path=require('path');var sox=require(_0x7655('0x5'));var csv=require(_0x7655('0x6'));var ejs=require(_0x7655('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7655('0x8'));var crypto=require(_0x7655('0x9'));var jsforce=require(_0x7655('0xa'));var deskjs=require(_0x7655('0xb'));var toCsv=require(_0x7655('0x6'));var querystring=require(_0x7655('0xc'));var Papa=require('papaparse');var Redis=require(_0x7655('0xd'));var authService=require(_0x7655('0xe'));var qs=require(_0x7655('0xf'));var as=require(_0x7655('0x10'));var hardwareService=require(_0x7655('0x11'));var logger=require(_0x7655('0x12'))(_0x7655('0x13'));var utils=require(_0x7655('0x14'));var config=require(_0x7655('0x15'));var db=require(_0x7655('0x16'))['db'];function respondWithStatusCode(_0x1d002f,_0x2169d3){_0x2169d3=_0x2169d3||0xcc;return function(_0xaa27a0){if(_0xaa27a0){return _0x1d002f[_0x7655('0x17')](_0x2169d3);}return _0x1d002f[_0x7655('0x18')](_0x2169d3)['end']();};}function respondWithResult(_0x5ef4a0,_0x3c9b41){_0x3c9b41=_0x3c9b41||0xc8;return function(_0x415275){if(_0x415275){return _0x5ef4a0[_0x7655('0x18')](_0x3c9b41)[_0x7655('0x19')](_0x415275);}};}function respondWithFilteredResult(_0x58e323,_0x45328f){return function(_0x5aace7){if(_0x5aace7){var _0xf8edf6=_0x5aace7['count'],_0x576685=_0x45328f['offset'],_0x3ad57b=_0x45328f[_0x7655('0x1a')]+_0x45328f[_0x7655('0x1b')],_0x358584;if(_0x3ad57b>=_0xf8edf6){_0x3ad57b=_0xf8edf6;_0x358584=0xc8;}else{_0x358584=0xce;}_0x58e323['status'](_0x358584);return _0x58e323[_0x7655('0x1c')](_0x7655('0x1d'),_0x576685+'-'+_0x3ad57b+'/'+_0xf8edf6)[_0x7655('0x19')](_0x5aace7);}return null;};}function patchUpdates(_0x2352b3){return function(_0xebc871){try{jsonpatch['apply'](_0xebc871,_0x2352b3,!![]);}catch(_0x2fd2c4){return BPromise[_0x7655('0x1e')](_0x2fd2c4);}return _0xebc871[_0x7655('0x1f')]();};}function saveUpdates(_0x20bb15,_0x1da301){return function(_0x550c97){if(_0x550c97){return _0x550c97[_0x7655('0x20')](_0x20bb15)[_0x7655('0x21')](function(_0x1ad418){return _0x1ad418;});}return null;};}function removeEntity(_0x1e01f6,_0x14af5a){return function(_0x26fb7a){if(_0x26fb7a){return _0x26fb7a[_0x7655('0x22')]()['then'](function(){_0x1e01f6[_0x7655('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xecc4f7,_0x2137c5){return function(_0x18a3fa){if(!_0x18a3fa){_0xecc4f7['sendStatus'](0x194);}return _0x18a3fa;};}function handleError(_0x43af7b,_0x3f68a7){_0x3f68a7=_0x3f68a7||0x1f4;return function(_0x310d3f){logger['error'](_0x310d3f[_0x7655('0x23')]);if(_0x310d3f[_0x7655('0x24')]){delete _0x310d3f[_0x7655('0x24')];}_0x43af7b[_0x7655('0x18')](_0x3f68a7)[_0x7655('0x25')](_0x310d3f);};}exports[_0x7655('0x26')]=function(_0x7373fd,_0x324735){var _0x223262={},_0x2175f2={},_0x54af35={'count':0x0,'rows':[]};var _0x851cf5=_[_0x7655('0x27')](db[_0x7655('0x28')][_0x7655('0x29')],function(_0x2ab742){return{'name':_0x2ab742[_0x7655('0x2a')],'type':_0x2ab742[_0x7655('0x2b')][_0x7655('0x2c')]};});_0x2175f2[_0x7655('0x2d')]=_[_0x7655('0x27')](_0x851cf5,_0x7655('0x24'));_0x2175f2[_0x7655('0x2e')]=_[_0x7655('0x2f')](_0x7373fd[_0x7655('0x2e')]);_0x2175f2[_0x7655('0x30')]=_['intersection'](_0x2175f2[_0x7655('0x2d')],_0x2175f2[_0x7655('0x2e')]);_0x223262[_0x7655('0x31')]=_['intersection'](_0x2175f2['model'],qs[_0x7655('0x32')](_0x7373fd['query']['fields']));_0x223262[_0x7655('0x31')]=_0x223262[_0x7655('0x31')]['length']?_0x223262['attributes']:_0x2175f2[_0x7655('0x2d')];if(!_0x7373fd[_0x7655('0x2e')]['hasOwnProperty'](_0x7655('0x33'))){_0x223262[_0x7655('0x1b')]=qs[_0x7655('0x1b')](_0x7373fd[_0x7655('0x2e')]['limit']);_0x223262[_0x7655('0x1a')]=qs['offset'](_0x7373fd[_0x7655('0x2e')]['offset']);}_0x223262['order']=qs[_0x7655('0x34')](_0x7373fd[_0x7655('0x2e')][_0x7655('0x34')]);_0x223262['where']=qs[_0x7655('0x30')](_['pick'](_0x7373fd[_0x7655('0x2e')],_0x2175f2['filters']),_0x851cf5);if(_0x7373fd['query']['filter']){_0x223262['where']=_['merge'](_0x223262['where'],{'$or':_[_0x7655('0x27')](_0x851cf5,function(_0xae2c8d){if(_0xae2c8d[_0x7655('0x2b')]!==_0x7655('0x35')){var _0x443830={};_0x443830[_0xae2c8d['name']]={'$like':'%'+_0x7373fd[_0x7655('0x2e')]['filter']+'%'};return _0x443830;}})});}_0x223262=_[_0x7655('0x36')]({},_0x223262,_0x7373fd[_0x7655('0x37')]);var _0x2b7439={'where':_0x223262['where']};return db[_0x7655('0x28')]['count'](_0x2b7439)[_0x7655('0x21')](function(_0x262119){_0x54af35[_0x7655('0x38')]=_0x262119;if(_0x7373fd[_0x7655('0x2e')][_0x7655('0x39')]){_0x223262[_0x7655('0x3a')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x7655('0x3b')](_0x223262);})[_0x7655('0x21')](function(_0x469e0b){_0x54af35[_0x7655('0x3c')]=_0x469e0b;return _0x54af35;})[_0x7655('0x21')](respondWithFilteredResult(_0x324735,_0x223262))['catch'](handleError(_0x324735,null));};exports[_0x7655('0x3d')]=function(_0x431f66,_0x43b4fd){var _0x2e2ec9={'raw':!![],'where':{'id':_0x431f66[_0x7655('0x3e')]['id']}},_0x243498={};_0x243498[_0x7655('0x2d')]=_[_0x7655('0x2f')](db[_0x7655('0x28')][_0x7655('0x29')]);_0x243498[_0x7655('0x2e')]=_[_0x7655('0x2f')](_0x431f66[_0x7655('0x2e')]);_0x243498[_0x7655('0x30')]=_[_0x7655('0x3f')](_0x243498[_0x7655('0x2d')],_0x243498[_0x7655('0x2e')]);_0x2e2ec9[_0x7655('0x31')]=_['intersection'](_0x243498[_0x7655('0x2d')],qs['fields'](_0x431f66[_0x7655('0x2e')][_0x7655('0x32')]));_0x2e2ec9['attributes']=_0x2e2ec9[_0x7655('0x31')][_0x7655('0x40')]?_0x2e2ec9['attributes']:_0x243498[_0x7655('0x2d')];if(_0x431f66[_0x7655('0x2e')][_0x7655('0x39')]){_0x2e2ec9['include']=[{'all':!![]}];}_0x2e2ec9=_[_0x7655('0x36')]({},_0x2e2ec9,_0x431f66['options']);return db['SquareDetailsReport'][_0x7655('0x41')](_0x2e2ec9)[_0x7655('0x21')](handleEntityNotFound(_0x43b4fd,null))[_0x7655('0x21')](respondWithResult(_0x43b4fd,null))['catch'](handleError(_0x43b4fd,null));};exports[_0x7655('0x42')]=function(_0x4651fd,_0x3ea87b){return db[_0x7655('0x28')]['create'](_0x4651fd[_0x7655('0x43')],{})[_0x7655('0x21')](respondWithResult(_0x3ea87b,0xc9))[_0x7655('0x44')](handleError(_0x3ea87b,null));};exports[_0x7655('0x20')]=function(_0xf8c8e8,_0x38179e){if(_0xf8c8e8['body']['id']){delete _0xf8c8e8[_0x7655('0x43')]['id'];}return db[_0x7655('0x28')][_0x7655('0x41')]({'where':{'id':_0xf8c8e8[_0x7655('0x3e')]['id']}})[_0x7655('0x21')](handleEntityNotFound(_0x38179e,null))['then'](saveUpdates(_0xf8c8e8[_0x7655('0x43')],null))[_0x7655('0x21')](respondWithResult(_0x38179e,null))[_0x7655('0x44')](handleError(_0x38179e,null));};exports['destroy']=function(_0x5022f5,_0x49ba53){return db[_0x7655('0x28')][_0x7655('0x41')]({'where':{'id':_0x5022f5[_0x7655('0x3e')]['id']}})[_0x7655('0x21')](handleEntityNotFound(_0x49ba53,null))['then'](removeEntity(_0x49ba53,null))[_0x7655('0x44')](handleError(_0x49ba53,null));};exports[_0x7655('0x45')]=function(_0x35567e,_0x1cb69f){return db[_0x7655('0x28')][_0x7655('0x45')]()['then'](respondWithResult(_0x1cb69f,null))[_0x7655('0x44')](handleError(_0x1cb69f,null));}; \ No newline at end of file +var _0x1ba8=['lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','reject','save','update','destroy','error','stack','name','send','index','SquareDetailsReport','rawAttributes','fieldName','type','key','map','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','describe','rimraf','moment','mustache','util','path','sox','to-csv'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1ba8,0x15c));var _0x81ba=function(_0x5b367e,_0x4bd1c8){_0x5b367e=_0x5b367e-0x0;var _0x422265=_0x1ba8[_0x5b367e];return _0x422265;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x81ba('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x81ba('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x81ba('0x2'));var util=require(_0x81ba('0x3'));var path=require(_0x81ba('0x4'));var sox=require(_0x81ba('0x5'));var csv=require(_0x81ba('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x81ba('0x7'));var squel=require(_0x81ba('0x8'));var crypto=require('crypto');var jsforce=require(_0x81ba('0x9'));var deskjs=require(_0x81ba('0xa'));var toCsv=require(_0x81ba('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x81ba('0xb'));var qs=require(_0x81ba('0xc'));var as=require(_0x81ba('0xd'));var hardwareService=require(_0x81ba('0xe'));var logger=require(_0x81ba('0xf'))(_0x81ba('0x10'));var utils=require(_0x81ba('0x11'));var config=require('../../config/environment');var db=require(_0x81ba('0x12'))['db'];function respondWithStatusCode(_0x12f4e3,_0x13a14e){_0x13a14e=_0x13a14e||0xcc;return function(_0x33412e){if(_0x33412e){return _0x12f4e3['sendStatus'](_0x13a14e);}return _0x12f4e3[_0x81ba('0x13')](_0x13a14e)[_0x81ba('0x14')]();};}function respondWithResult(_0x531079,_0x415e28){_0x415e28=_0x415e28||0xc8;return function(_0x575196){if(_0x575196){return _0x531079[_0x81ba('0x13')](_0x415e28)[_0x81ba('0x15')](_0x575196);}};}function respondWithFilteredResult(_0x42a20f,_0x4e7659){return function(_0x422353){if(_0x422353){var _0x23ed7c=_0x422353[_0x81ba('0x16')],_0x98319b=_0x4e7659['offset'],_0xe17191=_0x4e7659[_0x81ba('0x17')]+_0x4e7659[_0x81ba('0x18')],_0xe83c9a;if(_0xe17191>=_0x23ed7c){_0xe17191=_0x23ed7c;_0xe83c9a=0xc8;}else{_0xe83c9a=0xce;}_0x42a20f[_0x81ba('0x13')](_0xe83c9a);return _0x42a20f[_0x81ba('0x19')]('Content-Range',_0x98319b+'-'+_0xe17191+'/'+_0x23ed7c)[_0x81ba('0x15')](_0x422353);}return null;};}function patchUpdates(_0x598548){return function(_0x51d4b3){try{jsonpatch['apply'](_0x51d4b3,_0x598548,!![]);}catch(_0x48fcf8){return BPromise[_0x81ba('0x1a')](_0x48fcf8);}return _0x51d4b3[_0x81ba('0x1b')]();};}function saveUpdates(_0x2595c5,_0xd7a516){return function(_0x3f13d5){if(_0x3f13d5){return _0x3f13d5[_0x81ba('0x1c')](_0x2595c5)['then'](function(_0x2ce66a){return _0x2ce66a;});}return null;};}function removeEntity(_0x43dcbf,_0x16236c){return function(_0x13a32a){if(_0x13a32a){return _0x13a32a[_0x81ba('0x1d')]()['then'](function(){_0x43dcbf[_0x81ba('0x13')](0xcc)[_0x81ba('0x14')]();});}};}function handleEntityNotFound(_0x29438c,_0x474953){return function(_0xf0ea0e){if(!_0xf0ea0e){_0x29438c['sendStatus'](0x194);}return _0xf0ea0e;};}function handleError(_0x15b48f,_0x197538){_0x197538=_0x197538||0x1f4;return function(_0x2106d7){logger[_0x81ba('0x1e')](_0x2106d7[_0x81ba('0x1f')]);if(_0x2106d7['name']){delete _0x2106d7[_0x81ba('0x20')];}_0x15b48f[_0x81ba('0x13')](_0x197538)[_0x81ba('0x21')](_0x2106d7);};}exports[_0x81ba('0x22')]=function(_0x26bb0d,_0x12b9b7){var _0x5d84d0={},_0xd364aa={},_0x15b594={'count':0x0,'rows':[]};var _0x448a3b=_['map'](db[_0x81ba('0x23')][_0x81ba('0x24')],function(_0x64b660){return{'name':_0x64b660[_0x81ba('0x25')],'type':_0x64b660[_0x81ba('0x26')][_0x81ba('0x27')]};});_0xd364aa['model']=_[_0x81ba('0x28')](_0x448a3b,'name');_0xd364aa[_0x81ba('0x29')]=_['keys'](_0x26bb0d[_0x81ba('0x29')]);_0xd364aa[_0x81ba('0x2a')]=_[_0x81ba('0x2b')](_0xd364aa['model'],_0xd364aa[_0x81ba('0x29')]);_0x5d84d0[_0x81ba('0x2c')]=_[_0x81ba('0x2b')](_0xd364aa['model'],qs[_0x81ba('0x2d')](_0x26bb0d['query'][_0x81ba('0x2d')]));_0x5d84d0[_0x81ba('0x2c')]=_0x5d84d0[_0x81ba('0x2c')][_0x81ba('0x2e')]?_0x5d84d0[_0x81ba('0x2c')]:_0xd364aa[_0x81ba('0x2f')];if(!_0x26bb0d['query'][_0x81ba('0x30')](_0x81ba('0x31'))){_0x5d84d0['limit']=qs[_0x81ba('0x18')](_0x26bb0d[_0x81ba('0x29')][_0x81ba('0x18')]);_0x5d84d0[_0x81ba('0x17')]=qs['offset'](_0x26bb0d['query'][_0x81ba('0x17')]);}_0x5d84d0[_0x81ba('0x32')]=qs[_0x81ba('0x33')](_0x26bb0d['query'][_0x81ba('0x33')]);_0x5d84d0[_0x81ba('0x34')]=qs['filters'](_[_0x81ba('0x35')](_0x26bb0d[_0x81ba('0x29')],_0xd364aa[_0x81ba('0x2a')]),_0x448a3b);if(_0x26bb0d[_0x81ba('0x29')]['filter']){_0x5d84d0[_0x81ba('0x34')]=_[_0x81ba('0x36')](_0x5d84d0[_0x81ba('0x34')],{'$or':_[_0x81ba('0x28')](_0x448a3b,function(_0x5f4b88){if(_0x5f4b88[_0x81ba('0x26')]!==_0x81ba('0x37')){var _0x4c68b3={};_0x4c68b3[_0x5f4b88[_0x81ba('0x20')]]={'$like':'%'+_0x26bb0d[_0x81ba('0x29')][_0x81ba('0x38')]+'%'};return _0x4c68b3;}})});}_0x5d84d0=_['merge']({},_0x5d84d0,_0x26bb0d[_0x81ba('0x39')]);var _0x458c81={'where':_0x5d84d0['where']};return db['SquareDetailsReport'][_0x81ba('0x16')](_0x458c81)[_0x81ba('0x3a')](function(_0x7316d0){_0x15b594[_0x81ba('0x16')]=_0x7316d0;if(_0x26bb0d[_0x81ba('0x29')][_0x81ba('0x3b')]){_0x5d84d0[_0x81ba('0x3c')]=[{'all':!![]}];}return db[_0x81ba('0x23')][_0x81ba('0x3d')](_0x5d84d0);})[_0x81ba('0x3a')](function(_0xd34d73){_0x15b594[_0x81ba('0x3e')]=_0xd34d73;return _0x15b594;})[_0x81ba('0x3a')](respondWithFilteredResult(_0x12b9b7,_0x5d84d0))[_0x81ba('0x3f')](handleError(_0x12b9b7,null));};exports[_0x81ba('0x40')]=function(_0x4d0a5c,_0x121c1d){var _0x16a61d={'raw':!![],'where':{'id':_0x4d0a5c['params']['id']}},_0xc2fd5a={};_0xc2fd5a[_0x81ba('0x2f')]=_[_0x81ba('0x41')](db[_0x81ba('0x23')][_0x81ba('0x24')]);_0xc2fd5a[_0x81ba('0x29')]=_[_0x81ba('0x41')](_0x4d0a5c[_0x81ba('0x29')]);_0xc2fd5a[_0x81ba('0x2a')]=_['intersection'](_0xc2fd5a['model'],_0xc2fd5a[_0x81ba('0x29')]);_0x16a61d[_0x81ba('0x2c')]=_[_0x81ba('0x2b')](_0xc2fd5a[_0x81ba('0x2f')],qs[_0x81ba('0x2d')](_0x4d0a5c[_0x81ba('0x29')][_0x81ba('0x2d')]));_0x16a61d[_0x81ba('0x2c')]=_0x16a61d[_0x81ba('0x2c')][_0x81ba('0x2e')]?_0x16a61d[_0x81ba('0x2c')]:_0xc2fd5a[_0x81ba('0x2f')];if(_0x4d0a5c['query'][_0x81ba('0x3b')]){_0x16a61d[_0x81ba('0x3c')]=[{'all':!![]}];}_0x16a61d=_[_0x81ba('0x36')]({},_0x16a61d,_0x4d0a5c[_0x81ba('0x39')]);return db['SquareDetailsReport'][_0x81ba('0x42')](_0x16a61d)[_0x81ba('0x3a')](handleEntityNotFound(_0x121c1d,null))['then'](respondWithResult(_0x121c1d,null))[_0x81ba('0x3f')](handleError(_0x121c1d,null));};exports[_0x81ba('0x43')]=function(_0x20a326,_0x1ae3df){return db[_0x81ba('0x23')]['create'](_0x20a326['body'],{})['then'](respondWithResult(_0x1ae3df,0xc9))[_0x81ba('0x3f')](handleError(_0x1ae3df,null));};exports[_0x81ba('0x1c')]=function(_0x27f9ab,_0x57ceec){if(_0x27f9ab[_0x81ba('0x44')]['id']){delete _0x27f9ab[_0x81ba('0x44')]['id'];}return db[_0x81ba('0x23')][_0x81ba('0x42')]({'where':{'id':_0x27f9ab[_0x81ba('0x45')]['id']}})['then'](handleEntityNotFound(_0x57ceec,null))['then'](saveUpdates(_0x27f9ab['body'],null))[_0x81ba('0x3a')](respondWithResult(_0x57ceec,null))[_0x81ba('0x3f')](handleError(_0x57ceec,null));};exports['destroy']=function(_0x43e43c,_0x5cda9d){return db[_0x81ba('0x23')][_0x81ba('0x42')]({'where':{'id':_0x43e43c[_0x81ba('0x45')]['id']}})[_0x81ba('0x3a')](handleEntityNotFound(_0x5cda9d,null))[_0x81ba('0x3a')](removeEntity(_0x5cda9d,null))[_0x81ba('0x3f')](handleError(_0x5cda9d,null));};exports[_0x81ba('0x46')]=function(_0xea7aff,_0x267337){return db[_0x81ba('0x23')]['describe']()[_0x81ba('0x3a')](respondWithResult(_0x267337,null))[_0x81ba('0x3f')](handleError(_0x267337,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index d57e373..72076d3 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 _0xef6e=['../../config/environment','./squareReportDetail.attributes','exports','define','report_square_details','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x16a400,_0x598592){var _0x1e9b69=function(_0xca5276){while(--_0xca5276){_0x16a400['push'](_0x16a400['shift']());}};_0x1e9b69(++_0x598592);}(_0xef6e,0x1b5));var _0xeef6=function(_0x1d7de6,_0x4d1adf){_0x1d7de6=_0x1d7de6-0x0;var _0x2d0d63=_0xef6e[_0x1d7de6];return _0x2d0d63;};'use strict';var _=require(_0xeef6('0x0'));var util=require(_0xeef6('0x1'));var logger=require(_0xeef6('0x2'))(_0xeef6('0x3'));var moment=require(_0xeef6('0x4'));var BPromise=require('bluebird');var rp=require(_0xeef6('0x5'));var fs=require('fs');var path=require(_0xeef6('0x6'));var rimraf=require('rimraf');var config=require(_0xeef6('0x7'));var attributes=require(_0xeef6('0x8'));module[_0xeef6('0x9')]=function(_0xda0373,_0x1461b7){return _0xda0373[_0xeef6('0xa')]('SquareDetailsReport',attributes,{'tableName':_0xeef6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d23=['./squareReportDetail.attributes','exports','define','SquareDetailsReport','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x289e48,_0x2fe387){var _0x56d497=function(_0x2abb13){while(--_0x2abb13){_0x289e48['push'](_0x289e48['shift']());}};_0x56d497(++_0x2fe387);}(_0x7d23,0x130));var _0x37d2=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x7d23[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x37d2('0x0'));var BPromise=require(_0x37d2('0x1'));var rp=require(_0x37d2('0x2'));var fs=require('fs');var path=require(_0x37d2('0x3'));var rimraf=require(_0x37d2('0x4'));var config=require(_0x37d2('0x5'));var attributes=require(_0x37d2('0x6'));module[_0x37d2('0x7')]=function(_0x220ac2,_0x414443){return _0x220ac2[_0x37d2('0x8')](_0x37d2('0x9'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index d8e9981..25b890e 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 _0x0524=['body','options','then','stringify','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateSquareDetailsReport','SquareDetailsReport','create'];(function(_0x553aeb,_0x2f772e){var _0x3317eb=function(_0x2fe4a1){while(--_0x2fe4a1){_0x553aeb['push'](_0x553aeb['shift']());}};_0x3317eb(++_0x2f772e);}(_0x0524,0xd5));var _0x4052=function(_0x35ef6b,_0x202c42){_0x35ef6b=_0x35ef6b-0x0;var _0x3ad145=_0x0524[_0x35ef6b];return _0x3ad145;};'use strict';var _=require('lodash');var util=require(_0x4052('0x0'));var moment=require(_0x4052('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4052('0x2'));var db=require(_0x4052('0x3'))['db'];var utils=require(_0x4052('0x4'));var logger=require(_0x4052('0x5'))(_0x4052('0x6'));var config=require(_0x4052('0x7'));var jayson=require(_0x4052('0x8'));var client=jayson[_0x4052('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43404a,_0x500c35,_0x4cc5b4){return new BPromise(function(_0x386011,_0xeccdd5){return client['request'](_0x43404a,_0x4cc5b4)['then'](function(_0x2ca157){logger['info'](_0x4052('0xa'),_0x500c35,'request\x20sent');logger[_0x4052('0xb')](_0x4052('0xc'),_0x500c35,_0x4052('0xd'),JSON['stringify'](_0x2ca157));if(_0x2ca157[_0x4052('0xe')]){if(_0x2ca157[_0x4052('0xe')][_0x4052('0xf')]===0x1f4){logger[_0x4052('0xe')](_0x4052('0xa'),_0x500c35,_0x2ca157[_0x4052('0xe')][_0x4052('0x10')]);return _0xeccdd5(_0x2ca157['error'][_0x4052('0x10')]);}logger[_0x4052('0xe')](_0x4052('0xa'),_0x500c35,_0x2ca157[_0x4052('0xe')][_0x4052('0x10')]);return _0x386011(_0x2ca157['error'][_0x4052('0x10')]);}else{logger['info'](_0x4052('0xa'),_0x500c35,_0x4052('0xd'));_0x386011(_0x2ca157[_0x4052('0x11')][_0x4052('0x10')]);}})['catch'](function(_0x179eba){logger[_0x4052('0xe')](_0x4052('0xa'),_0x500c35,_0x179eba);_0xeccdd5(_0x179eba);});});}exports[_0x4052('0x12')]=function(_0x128dc6){var _0x56421e=this;return new Promise(function(_0x156479,_0x292038){return db[_0x4052('0x13')][_0x4052('0x14')](_0x128dc6[_0x4052('0x15')],{'raw':_0x128dc6['options']?_0x128dc6[_0x4052('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x4052('0x17')](function(_0x29e562){logger['info'](_0x4052('0x12'),_0x128dc6);logger[_0x4052('0xb')](_0x4052('0x12'),_0x128dc6,JSON[_0x4052('0x18')](_0x29e562));_0x156479(_0x29e562);})[_0x4052('0x19')](function(_0x5b3159){logger['error']('CreateSquareDetailsReport',_0x5b3159['message'],_0x128dc6);_0x292038(_0x56421e[_0x4052('0xe')](0x1f4,_0x5b3159['message']));});});}; \ No newline at end of file +var _0x2f9a=['error','message','info','result','catch','CreateSquareDetailsReport','create','body','options','then','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x2f9a,0x91));var _0xa2f9=function(_0x778a34,_0xb4f3d3){_0x778a34=_0x778a34-0x0;var _0x4b956f=_0x2f9a[_0x778a34];return _0x4b956f;};'use strict';var _=require(_0xa2f9('0x0'));var util=require(_0xa2f9('0x1'));var moment=require('moment');var BPromise=require(_0xa2f9('0x2'));var rs=require(_0xa2f9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa2f9('0x4'))['db'];var utils=require(_0xa2f9('0x5'));var logger=require('../../config/logger')(_0xa2f9('0x6'));var config=require(_0xa2f9('0x7'));var jayson=require(_0xa2f9('0x8'));var client=jayson[_0xa2f9('0x9')][_0xa2f9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x137e76,_0x5bfe58,_0x1301ba){return new BPromise(function(_0x35f2ee,_0x3ed56e){return client[_0xa2f9('0xb')](_0x137e76,_0x1301ba)['then'](function(_0x2b5ca1){logger['info'](_0xa2f9('0xc'),_0x5bfe58,_0xa2f9('0xd'));logger[_0xa2f9('0xe')](_0xa2f9('0xf'),_0x5bfe58,_0xa2f9('0xd'),JSON[_0xa2f9('0x10')](_0x2b5ca1));if(_0x2b5ca1[_0xa2f9('0x11')]){if(_0x2b5ca1[_0xa2f9('0x11')]['code']===0x1f4){logger[_0xa2f9('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x5bfe58,_0x2b5ca1[_0xa2f9('0x11')][_0xa2f9('0x12')]);return _0x3ed56e(_0x2b5ca1[_0xa2f9('0x11')][_0xa2f9('0x12')]);}logger[_0xa2f9('0x11')](_0xa2f9('0xc'),_0x5bfe58,_0x2b5ca1[_0xa2f9('0x11')][_0xa2f9('0x12')]);return _0x35f2ee(_0x2b5ca1[_0xa2f9('0x11')][_0xa2f9('0x12')]);}else{logger[_0xa2f9('0x13')](_0xa2f9('0xc'),_0x5bfe58,'request\x20sent');_0x35f2ee(_0x2b5ca1[_0xa2f9('0x14')][_0xa2f9('0x12')]);}})[_0xa2f9('0x15')](function(_0xd6be98){logger[_0xa2f9('0x11')](_0xa2f9('0xc'),_0x5bfe58,_0xd6be98);_0x3ed56e(_0xd6be98);});});}exports[_0xa2f9('0x16')]=function(_0x2355c3){var _0x3f0679=this;return new Promise(function(_0x64e9ee,_0x4aaa65){return db['SquareDetailsReport'][_0xa2f9('0x17')](_0x2355c3[_0xa2f9('0x18')],{'raw':_0x2355c3[_0xa2f9('0x19')]?_0x2355c3[_0xa2f9('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xa2f9('0x1a')](function(_0x36f5d2){logger[_0xa2f9('0x13')](_0xa2f9('0x16'),_0x2355c3);logger[_0xa2f9('0xe')](_0xa2f9('0x16'),_0x2355c3,JSON[_0xa2f9('0x10')](_0x36f5d2));_0x64e9ee(_0x36f5d2);})['catch'](function(_0x49d895){logger[_0xa2f9('0x11')](_0xa2f9('0x16'),_0x49d895[_0xa2f9('0x12')],_0x2355c3);_0x4aaa65(_0x3f0679[_0xa2f9('0x11')](0x1f4,_0x49d895[_0xa2f9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 1fe730e..0ccd1bf 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 _0x576b=['get','isAuthenticated','index','/process/:pid/kill','killProcess','exports','express','Router'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x576b,0x9e));var _0xb576=function(_0x51ec6d,_0x134dd1){_0x51ec6d=_0x51ec6d-0x0;var _0x26d83c=_0x576b[_0x51ec6d];return _0x26d83c;};'use strict';var express=require(_0xb576('0x0'));var router=express[_0xb576('0x1')]();var auth=require('../../components/auth/service');var controller=require('./system.controller');router[_0xb576('0x2')]('/',auth[_0xb576('0x3')](),controller[_0xb576('0x4')]);router['get'](_0xb576('0x5'),auth[_0xb576('0x3')](),controller[_0xb576('0x6')]);module[_0xb576('0x7')]=router; \ No newline at end of file +var _0xdbf2=['express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','killProcess','exports'];(function(_0x1026d2,_0x42fe66){var _0x4a6773=function(_0x1a295f){while(--_0x1a295f){_0x1026d2['push'](_0x1026d2['shift']());}};_0x4a6773(++_0x42fe66);}(_0xdbf2,0x1cb));var _0x2dbf=function(_0x1f3ec4,_0x1fcaed){_0x1f3ec4=_0x1f3ec4-0x0;var _0x33012b=_0xdbf2[_0x1f3ec4];return _0x33012b;};'use strict';var express=require(_0x2dbf('0x0'));var router=express[_0x2dbf('0x1')]();var auth=require(_0x2dbf('0x2'));var controller=require(_0x2dbf('0x3'));router[_0x2dbf('0x4')]('/',auth[_0x2dbf('0x5')](),controller[_0x2dbf('0x6')]);router[_0x2dbf('0x4')]('/process/:pid/kill',auth['isAuthenticated'](),controller[_0x2dbf('0x7')]);module[_0x2dbf('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 64f673a..ed81ef0 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 _0xd117=['name','status','send','getAllData','then','json','catch','killProcess','components/import/cm','format','indexOf','params','pid','kill','SIGINT','exec','../../config/logger','api','util','bluebird','lodash','error','inspect'];(function(_0x42aa93,_0x4548a8){var _0x265de5=function(_0x2def5b){while(--_0x2def5b){_0x42aa93['push'](_0x42aa93['shift']());}};_0x265de5(++_0x4548a8);}(_0xd117,0xf5));var _0x7d11=function(_0x13945b,_0x289c94){_0x13945b=_0x13945b-0x0;var _0x1b1643=_0xd117[_0x13945b];return _0x1b1643;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0x7d11('0x0')];var logger=require(_0x7d11('0x1'))(_0x7d11('0x2'));var util=require(_0x7d11('0x3'));var BPromise=require(_0x7d11('0x4'));var _=require(_0x7d11('0x5'));function handleError(_0x3f5b68,_0x21c293,_0x1720b8){_0x21c293=_0x21c293||0x1f4;return function(_0x2245e5){logger[_0x7d11('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x1720b8,_0x21c293,util[_0x7d11('0x7')](_0x2245e5,{'showHidden':![],'depth':null}));delete _0x2245e5[_0x7d11('0x8')];_0x3f5b68[_0x7d11('0x9')](_0x21c293)[_0x7d11('0xa')](_0x2245e5);};}exports['index']=function(_0x477360,_0x24a1dc){return info[_0x7d11('0xb')]()[_0x7d11('0xc')](function(_0x36988a){return _0x24a1dc['status'](0xc8)[_0x7d11('0xd')](_0x36988a);})[_0x7d11('0xe')](function(_0x1d5df2){return _0x24a1dc['status'](0x1f4)[_0x7d11('0xd')](_0x1d5df2);});};exports[_0x7d11('0xf')]=function(_0x5e136b,_0x282437){var _0x5b7ff9=[_0x7d11('0x10')];return new BPromise(function(_0x2abcfe,_0x3f3f78){return exec(util[_0x7d11('0x11')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x5e136b['params']['pid']),function(_0x2c3ec8,_0x2a9491,_0x122f8a){if(_0x2c3ec8){return _0x3f3f78(_0x2c3ec8);}return _0x2abcfe(_0x2a9491);});})['then'](function(_0xa74683){var _0x58991c=![];var _0x17b61c=_0xa74683['split'](/\n/);for(var _0x411b79=0x0,_0x4f6399=_0x5b7ff9['length'];_0x411b79<_0x4f6399,_0x58991c===![];_0x411b79+=0x1){if(_0xa74683[_0x7d11('0x12')](_0x5b7ff9[_0x411b79])>=0x0){_0x58991c=!![];}}if(!_0x58991c){throw new Error(util[_0x7d11('0x11')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x5e136b[_0x7d11('0x13')][_0x7d11('0x14')]));}process[_0x7d11('0x15')](_0x5e136b[_0x7d11('0x13')]['pid'],_0x7d11('0x16'));return _0x282437['status'](0xc8)['json']({'message':util[_0x7d11('0x11')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x5e136b[_0x7d11('0x13')]['pid'])});})['catch'](handleError(_0x282437,null,_0x7d11('0xf')));}; \ No newline at end of file +var _0x475a=['ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','exec','../../config/logger','api','util','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send','index','getAllData','json','status','killProcess','components/import/cm','format'];(function(_0x2fd3db,_0x2027ab){var _0x32f6aa=function(_0x4e2c81){while(--_0x4e2c81){_0x2fd3db['push'](_0x2fd3db['shift']());}};_0x32f6aa(++_0x2027ab);}(_0x475a,0x10c));var _0xa475=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x475a[_0xa464c9];return _0x3d73c4;};'use strict';var info=require(_0xa475('0x0'));var exec=require(_0xa475('0x1'))[_0xa475('0x2')];var logger=require(_0xa475('0x3'))(_0xa475('0x4'));var util=require(_0xa475('0x5'));var BPromise=require('bluebird');var _=require('lodash');function handleError(_0xe0f31e,_0x4f5a7b,_0x1bcea2){_0x4f5a7b=_0x4f5a7b||0x1f4;return function(_0x1b59fb){logger[_0xa475('0x6')](_0xa475('0x7'),_0x1bcea2,_0x4f5a7b,util[_0xa475('0x8')](_0x1b59fb,{'showHidden':![],'depth':null}));delete _0x1b59fb[_0xa475('0x9')];_0xe0f31e['status'](_0x4f5a7b)[_0xa475('0xa')](_0x1b59fb);};}exports[_0xa475('0xb')]=function(_0x180823,_0x2e3a94){return info[_0xa475('0xc')]()['then'](function(_0x1b3ef0){return _0x2e3a94['status'](0xc8)[_0xa475('0xd')](_0x1b3ef0);})['catch'](function(_0x439413){return _0x2e3a94[_0xa475('0xe')](0x1f4)[_0xa475('0xd')](_0x439413);});};exports[_0xa475('0xf')]=function(_0x487717,_0x1c632a){var _0x388868=[_0xa475('0x10')];return new BPromise(function(_0x3beb3c,_0x15fcdc){return exec(util[_0xa475('0x11')](_0xa475('0x12'),_0x487717[_0xa475('0x13')][_0xa475('0x14')]),function(_0x38cbcd,_0x12256c,_0x17dc5e){if(_0x38cbcd){return _0x15fcdc(_0x38cbcd);}return _0x3beb3c(_0x12256c);});})['then'](function(_0x5ad095){var _0x1cf102=![];var _0x213042=_0x5ad095['split'](/\n/);for(var _0x3187a1=0x0,_0x484e51=_0x388868['length'];_0x3187a1<_0x484e51,_0x1cf102===![];_0x3187a1+=0x1){if(_0x5ad095[_0xa475('0x15')](_0x388868[_0x3187a1])>=0x0){_0x1cf102=!![];}}if(!_0x1cf102){throw new Error(util[_0xa475('0x11')](_0xa475('0x16'),_0x487717[_0xa475('0x13')][_0xa475('0x14')]));}process[_0xa475('0x17')](_0x487717[_0xa475('0x13')][_0xa475('0x14')],'SIGINT');return _0x1c632a[_0xa475('0xe')](0xc8)['json']({'message':util['format'](_0xa475('0x18'),_0x487717[_0xa475('0x13')][_0xa475('0x14')])});})[_0xa475('0x19')](handleError(_0x1c632a,null,_0xa475('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index f4462b5..dd7a524 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 _0x34e8=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x51b1a5,_0x285a4f){var _0x15c738=function(_0x5c94d7){while(--_0x5c94d7){_0x51b1a5['push'](_0x51b1a5['shift']());}};_0x15c738(++_0x285a4f);}(_0x34e8,0x12c));var _0x834e=function(_0x5cf82f,_0x1de011){_0x5cf82f=_0x5cf82f-0x0;var _0x12b820=_0x34e8[_0x5cf82f];return _0x12b820;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/:id',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0xc')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0xe')](_0x834e('0xf'),auth[_0x834e('0xa')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xf'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);module[_0x834e('0x13')]=router; \ No newline at end of file +var _0x6f0d=['delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','index','/:id','isAuthenticated','show','post','put','update'];(function(_0x48e349,_0xeb151f){var _0x13e764=function(_0x112b28){while(--_0x112b28){_0x48e349['push'](_0x48e349['shift']());}};_0x13e764(++_0xeb151f);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x316f2c,_0x11eb02){_0x316f2c=_0x316f2c-0x0;var _0xcc4add=_0x6f0d[_0x316f2c];return _0xcc4add;};'use strict';var multer=require('multer');var util=require(_0xd6f0('0x0'));var path=require(_0xd6f0('0x1'));var timeout=require(_0xd6f0('0x2'));var express=require(_0xd6f0('0x3'));var router=express['Router']();var auth=require(_0xd6f0('0x4'));var interaction=require(_0xd6f0('0x5'));var config=require(_0xd6f0('0x6'));var controller=require(_0xd6f0('0x7'));router[_0xd6f0('0x8')]('/',auth['isAuthenticated'](),controller[_0xd6f0('0x9')]);router['get'](_0xd6f0('0xa'),auth[_0xd6f0('0xb')](),controller[_0xd6f0('0xc')]);router[_0xd6f0('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd6f0('0xe')](_0xd6f0('0xa'),auth[_0xd6f0('0xb')](),controller[_0xd6f0('0xf')]);router[_0xd6f0('0x10')]('/:id',auth[_0xd6f0('0xb')](),controller[_0xd6f0('0x11')]);module[_0xd6f0('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index e877c0a..d707874 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 _0x36ee=['STRING','#0091EA'];(function(_0x274940,_0x4fa4ea){var _0x69da60=function(_0x1303ad){while(--_0x1303ad){_0x274940['push'](_0x274940['shift']());}};_0x69da60(++_0x4fa4ea);}(_0x36ee,0xe8));var _0xe36e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x36ee[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe36e('0x0')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xe36e('0x0')],'defaultValue':_0xe36e('0x1')},'description':{'type':Sequelize[_0xe36e('0x0')]}}; \ No newline at end of file +var _0x0713=['#0091EA','STRING','name'];(function(_0x6f2397,_0x5a3d30){var _0x305861=function(_0x480388){while(--_0x480388){_0x6f2397['push'](_0x6f2397['shift']());}};_0x305861(++_0x5a3d30);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'unique':_0x3071('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0x2')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 5f5c6c3..b2331df 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 _0x9373=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Tags','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0xab82b9,_0x2c5f4f){var _0x3c1ef9=function(_0x1c38f5){while(--_0x1c38f5){_0xab82b9['push'](_0xab82b9['shift']());}};_0x3c1ef9(++_0x2c5f4f);}(_0x9373,0x1a7));var _0x3937=function(_0x22b516,_0x5034c7){_0x22b516=_0x22b516-0x0;var _0x442e0b=_0x9373[_0x22b516];return _0x442e0b;};'use strict';var pdf=require(_0x3937('0x0'));var emlformat=require(_0x3937('0x1'));var rimraf=require(_0x3937('0x2'));var zipdir=require(_0x3937('0x3'));var jsonpatch=require(_0x3937('0x4'));var rp=require(_0x3937('0x5'));var moment=require(_0x3937('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x3937('0x7'));var util=require(_0x3937('0x8'));var path=require(_0x3937('0x9'));var sox=require(_0x3937('0xa'));var csv=require(_0x3937('0xb'));var ejs=require(_0x3937('0xc'));var fs=require('fs');var _=require(_0x3937('0xd'));var squel=require(_0x3937('0xe'));var crypto=require(_0x3937('0xf'));var jsforce=require(_0x3937('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x3937('0xb'));var querystring=require(_0x3937('0x11'));var Papa=require(_0x3937('0x12'));var Redis=require(_0x3937('0x13'));var authService=require(_0x3937('0x14'));var qs=require(_0x3937('0x15'));var as=require(_0x3937('0x16'));var hardwareService=require(_0x3937('0x17'));var logger=require(_0x3937('0x18'))(_0x3937('0x19'));var utils=require(_0x3937('0x1a'));var config=require(_0x3937('0x1b'));var db=require(_0x3937('0x1c'))['db'];function respondWithStatusCode(_0x44425f,_0x241942){_0x241942=_0x241942||0xcc;return function(_0x4a5120){if(_0x4a5120){return _0x44425f[_0x3937('0x1d')](_0x241942);}return _0x44425f[_0x3937('0x1e')](_0x241942)['end']();};}function respondWithResult(_0x492b70,_0x4c2796){_0x4c2796=_0x4c2796||0xc8;return function(_0x5f525d){if(_0x5f525d){return _0x492b70['status'](_0x4c2796)[_0x3937('0x1f')](_0x5f525d);}};}function respondWithFilteredResult(_0x323e77,_0x4dfdc9){return function(_0x57163a){if(_0x57163a){var _0x10f194=_0x57163a[_0x3937('0x20')],_0x229693=_0x4dfdc9[_0x3937('0x21')],_0x14c809=_0x4dfdc9[_0x3937('0x21')]+_0x4dfdc9['limit'],_0x46509a;if(_0x14c809>=_0x10f194){_0x14c809=_0x10f194;_0x46509a=0xc8;}else{_0x46509a=0xce;}_0x323e77['status'](_0x46509a);return _0x323e77[_0x3937('0x22')](_0x3937('0x23'),_0x229693+'-'+_0x14c809+'/'+_0x10f194)['json'](_0x57163a);}return null;};}function patchUpdates(_0x16ad9b){return function(_0x457b8b){try{jsonpatch[_0x3937('0x24')](_0x457b8b,_0x16ad9b,!![]);}catch(_0x8dc7ad){return BPromise[_0x3937('0x25')](_0x8dc7ad);}return _0x457b8b[_0x3937('0x26')]();};}function saveUpdates(_0x4df054,_0x375434){return function(_0x10b4ad){if(_0x10b4ad){return _0x10b4ad['update'](_0x4df054)[_0x3937('0x27')](function(_0x1816a9){return _0x1816a9;});}return null;};}function removeEntity(_0x5ed068,_0x5de1c6){return function(_0x245d83){if(_0x245d83){return _0x245d83[_0x3937('0x28')]()['then'](function(){var _0x51893f=_0x245d83[_0x3937('0x29')]({'plain':!![]});var _0x3cd8bf='Tags';return db[_0x3937('0x2a')][_0x3937('0x28')]({'where':{'type':_0x3cd8bf,'resourceId':_0x51893f['id']}})[_0x3937('0x27')](function(){return _0x245d83;});})['then'](function(){_0x5ed068['status'](0xcc)[_0x3937('0x2b')]();});}};}function handleEntityNotFound(_0x38d9f8,_0x2acf11){return function(_0x488df5){if(!_0x488df5){_0x38d9f8[_0x3937('0x1d')](0x194);}return _0x488df5;};}function handleError(_0x22abb9,_0x57668a){_0x57668a=_0x57668a||0x1f4;return function(_0x448b93){logger[_0x3937('0x2c')](_0x448b93[_0x3937('0x2d')]);if(_0x448b93[_0x3937('0x2e')]){delete _0x448b93[_0x3937('0x2e')];}_0x22abb9[_0x3937('0x1e')](_0x57668a)[_0x3937('0x2f')](_0x448b93);};}exports[_0x3937('0x30')]=function(_0x2e2dbf,_0x23d647){var _0x2c3556={},_0x443134={},_0x47fc07={'count':0x0,'rows':[]};var _0x3bdbf7=_[_0x3937('0x31')](db[_0x3937('0x32')][_0x3937('0x33')],function(_0x9849d){return{'name':_0x9849d[_0x3937('0x34')],'type':_0x9849d[_0x3937('0x35')]['key']};});_0x443134['model']=_['map'](_0x3bdbf7,'name');_0x443134[_0x3937('0x36')]=_[_0x3937('0x37')](_0x2e2dbf[_0x3937('0x36')]);_0x443134[_0x3937('0x38')]=_[_0x3937('0x39')](_0x443134[_0x3937('0x3a')],_0x443134['query']);_0x2c3556[_0x3937('0x3b')]=_[_0x3937('0x39')](_0x443134[_0x3937('0x3a')],qs[_0x3937('0x3c')](_0x2e2dbf[_0x3937('0x36')][_0x3937('0x3c')]));_0x2c3556[_0x3937('0x3b')]=_0x2c3556[_0x3937('0x3b')][_0x3937('0x3d')]?_0x2c3556['attributes']:_0x443134[_0x3937('0x3a')];if(!_0x2e2dbf[_0x3937('0x36')][_0x3937('0x3e')](_0x3937('0x3f'))){_0x2c3556[_0x3937('0x40')]=qs[_0x3937('0x40')](_0x2e2dbf[_0x3937('0x36')][_0x3937('0x40')]);_0x2c3556[_0x3937('0x21')]=qs[_0x3937('0x21')](_0x2e2dbf[_0x3937('0x36')][_0x3937('0x21')]);}_0x2c3556[_0x3937('0x41')]=qs[_0x3937('0x42')](_0x2e2dbf[_0x3937('0x36')][_0x3937('0x42')]);_0x2c3556[_0x3937('0x43')]=qs[_0x3937('0x38')](_[_0x3937('0x44')](_0x2e2dbf['query'],_0x443134[_0x3937('0x38')]),_0x3bdbf7);if(_0x2e2dbf['query'][_0x3937('0x45')]){_0x2c3556[_0x3937('0x43')]=_['merge'](_0x2c3556[_0x3937('0x43')],{'$or':_[_0x3937('0x31')](_0x3bdbf7,function(_0x14ad7d){if(_0x14ad7d[_0x3937('0x35')]!==_0x3937('0x46')){var _0x3270b7={};_0x3270b7[_0x14ad7d['name']]={'$like':'%'+_0x2e2dbf[_0x3937('0x36')][_0x3937('0x45')]+'%'};return _0x3270b7;}})});}_0x2c3556=_[_0x3937('0x47')]({},_0x2c3556,_0x2e2dbf[_0x3937('0x48')]);var _0x429228={'where':_0x2c3556['where']};return db[_0x3937('0x32')]['count'](_0x429228)['then'](function(_0x46bd26){_0x47fc07['count']=_0x46bd26;if(_0x2e2dbf[_0x3937('0x36')][_0x3937('0x49')]){_0x2c3556[_0x3937('0x4a')]=[{'all':!![]}];}return db[_0x3937('0x32')][_0x3937('0x4b')](_0x2c3556);})['then'](function(_0x2e48c9){_0x47fc07['rows']=_0x2e48c9;return _0x47fc07;})['then'](respondWithFilteredResult(_0x23d647,_0x2c3556))[_0x3937('0x4c')](handleError(_0x23d647,null));};exports[_0x3937('0x4d')]=function(_0x2c40d0,_0x9243c2){var _0x239fc7={'raw':!![],'where':{'id':_0x2c40d0[_0x3937('0x4e')]['id']}},_0x3be60d={};_0x3be60d[_0x3937('0x3a')]=_[_0x3937('0x37')](db['Tag'][_0x3937('0x33')]);_0x3be60d[_0x3937('0x36')]=_[_0x3937('0x37')](_0x2c40d0['query']);_0x3be60d['filters']=_[_0x3937('0x39')](_0x3be60d[_0x3937('0x3a')],_0x3be60d['query']);_0x239fc7[_0x3937('0x3b')]=_[_0x3937('0x39')](_0x3be60d[_0x3937('0x3a')],qs[_0x3937('0x3c')](_0x2c40d0[_0x3937('0x36')][_0x3937('0x3c')]));_0x239fc7['attributes']=_0x239fc7[_0x3937('0x3b')][_0x3937('0x3d')]?_0x239fc7[_0x3937('0x3b')]:_0x3be60d[_0x3937('0x3a')];if(_0x2c40d0[_0x3937('0x36')][_0x3937('0x49')]){_0x239fc7[_0x3937('0x4a')]=[{'all':!![]}];}_0x239fc7=_[_0x3937('0x47')]({},_0x239fc7,_0x2c40d0[_0x3937('0x48')]);return db['Tag'][_0x3937('0x4f')](_0x239fc7)[_0x3937('0x27')](handleEntityNotFound(_0x9243c2,null))['then'](respondWithResult(_0x9243c2,null))[_0x3937('0x4c')](handleError(_0x9243c2,null));};exports[_0x3937('0x50')]=function(_0x2e5787,_0x4680aa){return db['Tag'][_0x3937('0x50')](_0x2e5787[_0x3937('0x51')],{})[_0x3937('0x27')](function(_0x45e28a){var _0x5db0bf=_0x2e5787[_0x3937('0x52')]['get']({'plain':!![]});if(!_0x5db0bf)throw new Error(_0x3937('0x53'));if(_0x5db0bf['role']===_0x3937('0x52')){var _0x34fcf1=_0x45e28a[_0x3937('0x29')]({'plain':!![]});var _0x28e648=_0x3937('0x54');return db[_0x3937('0x55')][_0x3937('0x4f')]({'where':{'name':_0x28e648,'userProfileId':_0x5db0bf['userProfileId']},'raw':!![]})[_0x3937('0x27')](function(_0x4327d4){if(_0x4327d4&&_0x4327d4[_0x3937('0x56')]===0x0){return db['UserProfileResource'][_0x3937('0x50')]({'name':_0x34fcf1[_0x3937('0x2e')],'resourceId':_0x34fcf1['id'],'type':_0x4327d4[_0x3937('0x2e')],'sectionId':_0x4327d4['id']},{})[_0x3937('0x27')](function(){return _0x45e28a;});}else{return _0x45e28a;}})[_0x3937('0x4c')](function(_0x19eda4){logger[_0x3937('0x2c')](_0x3937('0x57'),_0x19eda4);throw _0x19eda4;});}return _0x45e28a;})['then'](respondWithResult(_0x4680aa,0xc9))[_0x3937('0x4c')](handleError(_0x4680aa,null));};exports[_0x3937('0x58')]=function(_0x5b4c40,_0x5eef4f){if(_0x5b4c40[_0x3937('0x51')]['id']){delete _0x5b4c40['body']['id'];}return db[_0x3937('0x32')]['find']({'where':{'id':_0x5b4c40[_0x3937('0x4e')]['id']}})[_0x3937('0x27')](handleEntityNotFound(_0x5eef4f,null))['then'](saveUpdates(_0x5b4c40['body'],null))[_0x3937('0x27')](respondWithResult(_0x5eef4f,null))[_0x3937('0x4c')](handleError(_0x5eef4f,null));};exports[_0x3937('0x28')]=function(_0xc4c173,_0x45a379){return db[_0x3937('0x32')][_0x3937('0x4f')]({'where':{'id':_0xc4c173[_0x3937('0x4e')]['id']}})[_0x3937('0x27')](handleEntityNotFound(_0x45a379,null))[_0x3937('0x27')](removeEntity(_0x45a379,null))[_0x3937('0x4c')](handleError(_0x45a379,null));}; \ No newline at end of file +var _0x28c9=['where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','merge','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','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/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','update','then','destroy','Tags','UserProfileResource','error','stack','name','index','map','Tag','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort'];(function(_0x5beaa7,_0x5c9b3b){var _0x211dba=function(_0x325fcf){while(--_0x325fcf){_0x5beaa7['push'](_0x5beaa7['shift']());}};_0x211dba(++_0x5c9b3b);}(_0x28c9,0x1a1));var _0x928c=function(_0x4782eb,_0x1dafc9){_0x4782eb=_0x4782eb-0x0;var _0x9f1353=_0x28c9[_0x4782eb];return _0x9f1353;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x928c('0x0'));var rimraf=require(_0x928c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x928c('0x2'));var rp=require(_0x928c('0x3'));var moment=require(_0x928c('0x4'));var BPromise=require(_0x928c('0x5'));var Mustache=require('mustache');var util=require(_0x928c('0x6'));var path=require(_0x928c('0x7'));var sox=require(_0x928c('0x8'));var csv=require(_0x928c('0x9'));var ejs=require(_0x928c('0xa'));var fs=require('fs');var _=require(_0x928c('0xb'));var squel=require(_0x928c('0xc'));var crypto=require(_0x928c('0xd'));var jsforce=require(_0x928c('0xe'));var deskjs=require(_0x928c('0xf'));var toCsv=require(_0x928c('0x9'));var querystring=require('querystring');var Papa=require(_0x928c('0x10'));var Redis=require(_0x928c('0x11'));var authService=require(_0x928c('0x12'));var qs=require(_0x928c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x928c('0x14'));var logger=require(_0x928c('0x15'))(_0x928c('0x16'));var utils=require('../../config/utils');var config=require(_0x928c('0x17'));var db=require(_0x928c('0x18'))['db'];function respondWithStatusCode(_0x1c2b20,_0x237d09){_0x237d09=_0x237d09||0xcc;return function(_0x5e1f0b){if(_0x5e1f0b){return _0x1c2b20[_0x928c('0x19')](_0x237d09);}return _0x1c2b20['status'](_0x237d09)[_0x928c('0x1a')]();};}function respondWithResult(_0x5efbb8,_0x4b4452){_0x4b4452=_0x4b4452||0xc8;return function(_0x42b9ed){if(_0x42b9ed){return _0x5efbb8[_0x928c('0x1b')](_0x4b4452)[_0x928c('0x1c')](_0x42b9ed);}};}function respondWithFilteredResult(_0x309a13,_0x39c461){return function(_0x53380b){if(_0x53380b){var _0x314a31=_0x53380b[_0x928c('0x1d')],_0x2a00f1=_0x39c461[_0x928c('0x1e')],_0x435799=_0x39c461[_0x928c('0x1e')]+_0x39c461[_0x928c('0x1f')],_0x261199;if(_0x435799>=_0x314a31){_0x435799=_0x314a31;_0x261199=0xc8;}else{_0x261199=0xce;}_0x309a13[_0x928c('0x1b')](_0x261199);return _0x309a13['set'](_0x928c('0x20'),_0x2a00f1+'-'+_0x435799+'/'+_0x314a31)[_0x928c('0x1c')](_0x53380b);}return null;};}function patchUpdates(_0x49feea){return function(_0x9d404c){try{jsonpatch['apply'](_0x9d404c,_0x49feea,!![]);}catch(_0x576faf){return BPromise[_0x928c('0x21')](_0x576faf);}return _0x9d404c['save']();};}function saveUpdates(_0x2e5841,_0x39357f){return function(_0x305ade){if(_0x305ade){return _0x305ade[_0x928c('0x22')](_0x2e5841)[_0x928c('0x23')](function(_0x269f25){return _0x269f25;});}return null;};}function removeEntity(_0x44a6d9,_0x49f830){return function(_0xb8e83c){if(_0xb8e83c){return _0xb8e83c[_0x928c('0x24')]()[_0x928c('0x23')](function(){var _0x4d1613=_0xb8e83c['get']({'plain':!![]});var _0x514bc3=_0x928c('0x25');return db[_0x928c('0x26')][_0x928c('0x24')]({'where':{'type':_0x514bc3,'resourceId':_0x4d1613['id']}})[_0x928c('0x23')](function(){return _0xb8e83c;});})['then'](function(){_0x44a6d9[_0x928c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43c734,_0xd1ec8a){return function(_0x5bed00){if(!_0x5bed00){_0x43c734[_0x928c('0x19')](0x194);}return _0x5bed00;};}function handleError(_0x4bc657,_0x4c1704){_0x4c1704=_0x4c1704||0x1f4;return function(_0x49c286){logger[_0x928c('0x27')](_0x49c286[_0x928c('0x28')]);if(_0x49c286[_0x928c('0x29')]){delete _0x49c286[_0x928c('0x29')];}_0x4bc657['status'](_0x4c1704)['send'](_0x49c286);};}exports[_0x928c('0x2a')]=function(_0x8fab7b,_0x118112){var _0x3d1cb2={},_0xe9cc75={},_0x1275b7={'count':0x0,'rows':[]};var _0x59de8b=_[_0x928c('0x2b')](db[_0x928c('0x2c')][_0x928c('0x2d')],function(_0x47fc53){return{'name':_0x47fc53['fieldName'],'type':_0x47fc53[_0x928c('0x2e')][_0x928c('0x2f')]};});_0xe9cc75[_0x928c('0x30')]=_['map'](_0x59de8b,_0x928c('0x29'));_0xe9cc75[_0x928c('0x31')]=_[_0x928c('0x32')](_0x8fab7b[_0x928c('0x31')]);_0xe9cc75[_0x928c('0x33')]=_[_0x928c('0x34')](_0xe9cc75[_0x928c('0x30')],_0xe9cc75[_0x928c('0x31')]);_0x3d1cb2[_0x928c('0x35')]=_['intersection'](_0xe9cc75['model'],qs[_0x928c('0x36')](_0x8fab7b['query']['fields']));_0x3d1cb2[_0x928c('0x35')]=_0x3d1cb2[_0x928c('0x35')]['length']?_0x3d1cb2[_0x928c('0x35')]:_0xe9cc75['model'];if(!_0x8fab7b[_0x928c('0x31')]['hasOwnProperty'](_0x928c('0x37'))){_0x3d1cb2[_0x928c('0x1f')]=qs['limit'](_0x8fab7b['query']['limit']);_0x3d1cb2[_0x928c('0x1e')]=qs[_0x928c('0x1e')](_0x8fab7b['query'][_0x928c('0x1e')]);}_0x3d1cb2['order']=qs[_0x928c('0x38')](_0x8fab7b[_0x928c('0x31')]['sort']);_0x3d1cb2[_0x928c('0x39')]=qs[_0x928c('0x33')](_[_0x928c('0x3a')](_0x8fab7b[_0x928c('0x31')],_0xe9cc75[_0x928c('0x33')]),_0x59de8b);if(_0x8fab7b[_0x928c('0x31')][_0x928c('0x3b')]){_0x3d1cb2[_0x928c('0x39')]=_['merge'](_0x3d1cb2[_0x928c('0x39')],{'$or':_[_0x928c('0x2b')](_0x59de8b,function(_0x2a6b20){if(_0x2a6b20[_0x928c('0x2e')]!==_0x928c('0x3c')){var _0x22deeb={};_0x22deeb[_0x2a6b20[_0x928c('0x29')]]={'$like':'%'+_0x8fab7b[_0x928c('0x31')][_0x928c('0x3b')]+'%'};return _0x22deeb;}})});}_0x3d1cb2=_['merge']({},_0x3d1cb2,_0x8fab7b[_0x928c('0x3d')]);var _0x26c7dc={'where':_0x3d1cb2['where']};return db[_0x928c('0x2c')][_0x928c('0x1d')](_0x26c7dc)['then'](function(_0x57b763){_0x1275b7[_0x928c('0x1d')]=_0x57b763;if(_0x8fab7b[_0x928c('0x31')][_0x928c('0x3e')]){_0x3d1cb2[_0x928c('0x3f')]=[{'all':!![]}];}return db[_0x928c('0x2c')][_0x928c('0x40')](_0x3d1cb2);})[_0x928c('0x23')](function(_0x22a180){_0x1275b7[_0x928c('0x41')]=_0x22a180;return _0x1275b7;})[_0x928c('0x23')](respondWithFilteredResult(_0x118112,_0x3d1cb2))['catch'](handleError(_0x118112,null));};exports[_0x928c('0x42')]=function(_0x15a070,_0x5d5b4f){var _0x1f3ba2={'raw':!![],'where':{'id':_0x15a070[_0x928c('0x43')]['id']}},_0x290e07={};_0x290e07[_0x928c('0x30')]=_[_0x928c('0x32')](db[_0x928c('0x2c')][_0x928c('0x2d')]);_0x290e07['query']=_[_0x928c('0x32')](_0x15a070['query']);_0x290e07['filters']=_[_0x928c('0x34')](_0x290e07[_0x928c('0x30')],_0x290e07[_0x928c('0x31')]);_0x1f3ba2[_0x928c('0x35')]=_[_0x928c('0x34')](_0x290e07[_0x928c('0x30')],qs['fields'](_0x15a070[_0x928c('0x31')][_0x928c('0x36')]));_0x1f3ba2['attributes']=_0x1f3ba2[_0x928c('0x35')]['length']?_0x1f3ba2['attributes']:_0x290e07[_0x928c('0x30')];if(_0x15a070[_0x928c('0x31')][_0x928c('0x3e')]){_0x1f3ba2[_0x928c('0x3f')]=[{'all':!![]}];}_0x1f3ba2=_[_0x928c('0x44')]({},_0x1f3ba2,_0x15a070[_0x928c('0x3d')]);return db['Tag'][_0x928c('0x45')](_0x1f3ba2)[_0x928c('0x23')](handleEntityNotFound(_0x5d5b4f,null))['then'](respondWithResult(_0x5d5b4f,null))[_0x928c('0x46')](handleError(_0x5d5b4f,null));};exports[_0x928c('0x47')]=function(_0x2051af,_0x1a6558){return db['Tag'][_0x928c('0x47')](_0x2051af[_0x928c('0x48')],{})[_0x928c('0x23')](function(_0x2d9ee3){var _0xba864c=_0x2051af[_0x928c('0x49')][_0x928c('0x4a')]({'plain':!![]});if(!_0xba864c)throw new Error(_0x928c('0x4b'));if(_0xba864c[_0x928c('0x4c')]===_0x928c('0x49')){var _0x51c012=_0x2d9ee3[_0x928c('0x4a')]({'plain':!![]});var _0x16c91e='Tags';return db['UserProfileSection']['find']({'where':{'name':_0x16c91e,'userProfileId':_0xba864c[_0x928c('0x4d')]},'raw':!![]})[_0x928c('0x23')](function(_0x2bb13c){if(_0x2bb13c&&_0x2bb13c[_0x928c('0x4e')]===0x0){return db['UserProfileResource'][_0x928c('0x47')]({'name':_0x51c012['name'],'resourceId':_0x51c012['id'],'type':_0x2bb13c['name'],'sectionId':_0x2bb13c['id']},{})[_0x928c('0x23')](function(){return _0x2d9ee3;});}else{return _0x2d9ee3;}})['catch'](function(_0x118a77){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x118a77);throw _0x118a77;});}return _0x2d9ee3;})[_0x928c('0x23')](respondWithResult(_0x1a6558,0xc9))[_0x928c('0x46')](handleError(_0x1a6558,null));};exports['update']=function(_0x3f8692,_0x48482f){if(_0x3f8692[_0x928c('0x48')]['id']){delete _0x3f8692[_0x928c('0x48')]['id'];}return db[_0x928c('0x2c')]['find']({'where':{'id':_0x3f8692[_0x928c('0x43')]['id']}})['then'](handleEntityNotFound(_0x48482f,null))[_0x928c('0x23')](saveUpdates(_0x3f8692[_0x928c('0x48')],null))[_0x928c('0x23')](respondWithResult(_0x48482f,null))['catch'](handleError(_0x48482f,null));};exports[_0x928c('0x24')]=function(_0x1c1e0a,_0x75c994){return db[_0x928c('0x2c')][_0x928c('0x45')]({'where':{'id':_0x1c1e0a[_0x928c('0x43')]['id']}})[_0x928c('0x23')](handleEntityNotFound(_0x75c994,null))[_0x928c('0x23')](removeEntity(_0x75c994,null))[_0x928c('0x46')](handleError(_0x75c994,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index e0036bc..86a0c53 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 _0xb0b3=['api','moment','bluebird','request-promise','rimraf','./tag.attributes','Tag','tools_tags','lodash','util','../../config/logger'];(function(_0x49e0d8,_0x3041b6){var _0x3f1c1b=function(_0x3caf63){while(--_0x3caf63){_0x49e0d8['push'](_0x49e0d8['shift']());}};_0x3f1c1b(++_0x3041b6);}(_0xb0b3,0xa2));var _0x3b0b=function(_0x4075bc,_0x2aa562){_0x4075bc=_0x4075bc-0x0;var _0x138d75=_0xb0b3[_0x4075bc];return _0x138d75;};'use strict';var _=require(_0x3b0b('0x0'));var util=require(_0x3b0b('0x1'));var logger=require(_0x3b0b('0x2'))(_0x3b0b('0x3'));var moment=require(_0x3b0b('0x4'));var BPromise=require(_0x3b0b('0x5'));var rp=require(_0x3b0b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b0b('0x7'));var config=require('../../config/environment');var attributes=require(_0x3b0b('0x8'));module['exports']=function(_0x4a8065,_0x1f3437){return _0x4a8065['define'](_0x3b0b('0x9'),attributes,{'tableName':_0x3b0b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf200=['../../config/environment','./tag.attributes','define','Tag','lodash','util','../../config/logger','api','bluebird','rimraf'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xf200,0x1a8));var _0x0f20=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf200[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0f20('0x0'));var util=require(_0x0f20('0x1'));var logger=require(_0x0f20('0x2'))(_0x0f20('0x3'));var moment=require('moment');var BPromise=require(_0x0f20('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0f20('0x5'));var config=require(_0x0f20('0x6'));var attributes=require(_0x0f20('0x7'));module['exports']=function(_0x44b59a,_0x2b1028){return _0x44b59a[_0x0f20('0x8')](_0x0f20('0x9'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index f602133..1b002fb 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 _0x7072=['randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird'];(function(_0x58bec1,_0x42c53f){var _0x16439f=function(_0x19b7ec){while(--_0x19b7ec){_0x58bec1['push'](_0x58bec1['shift']());}};_0x16439f(++_0x42c53f);}(_0x7072,0x138));var _0x2707=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x7072[_0xc0a3d3];return _0x3386e8;};'use strict';var _=require('lodash');var util=require(_0x2707('0x0'));var moment=require(_0x2707('0x1'));var BPromise=require(_0x2707('0x2'));var rs=require(_0x2707('0x3'));var fs=require('fs');var Redis=require(_0x2707('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2707('0x5'))('rpc');var config=require(_0x2707('0x6'));var jayson=require(_0x2707('0x7'));var client=jayson[_0x2707('0x8')][_0x2707('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fd8ff,_0x128205,_0x21b0a0){return new BPromise(function(_0x745cfd,_0x4062b6){return client[_0x2707('0xa')](_0x2fd8ff,_0x21b0a0)['then'](function(_0x597ff9){logger[_0x2707('0xb')](_0x2707('0xc'),_0x128205,_0x2707('0xd'));logger[_0x2707('0xe')](_0x2707('0xf'),_0x128205,_0x2707('0xd'),JSON[_0x2707('0x10')](_0x597ff9));if(_0x597ff9[_0x2707('0x11')]){if(_0x597ff9[_0x2707('0x11')][_0x2707('0x12')]===0x1f4){logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x597ff9[_0x2707('0x11')]['message']);return _0x4062b6(_0x597ff9[_0x2707('0x11')]['message']);}logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x597ff9[_0x2707('0x11')][_0x2707('0x13')]);return _0x745cfd(_0x597ff9[_0x2707('0x11')]['message']);}else{logger[_0x2707('0xb')](_0x2707('0xc'),_0x128205,_0x2707('0xd'));_0x745cfd(_0x597ff9['result'][_0x2707('0x13')]);}})[_0x2707('0x14')](function(_0x1a979e){logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x1a979e);_0x4062b6(_0x1a979e);});});} \ No newline at end of file +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(_0x8188da,_0x417778){var _0x5b6a3b=function(_0x4fb33a){while(--_0x4fb33a){_0x8188da['push'](_0x8188da['shift']());}};_0x5b6a3b(++_0x417778);}(_0xca66,0x8b));var _0x6ca6=function(_0x2fecf5,_0x1b5ed){_0x2fecf5=_0x2fecf5-0x0;var _0x3f36c4=_0xca66[_0x2fecf5];return _0x3f36c4;};'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 diff --git a/server/api/team/index.js b/server/api/team/index.js index b1497bb..e1ad930 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 _0xecb4=['../../config/environment','./team.controller','get','index','/:id','isAuthenticated','getQueues','getAgents','post','create','/:id/queues','addQueues','/:id/users','addAgents','update','delete','destroy','removeQueues','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x754f7f,_0x5a0753){var _0x20d21b=function(_0x36594e){while(--_0x36594e){_0x754f7f['push'](_0x754f7f['shift']());}};_0x20d21b(++_0x5a0753);}(_0xecb4,0x1a4));var _0x4ecb=function(_0x3bdf49,_0x47ddb4){_0x3bdf49=_0x3bdf49-0x0;var _0x556d46=_0xecb4[_0x3bdf49];return _0x556d46;};'use strict';var multer=require(_0x4ecb('0x0'));var util=require('util');var path=require(_0x4ecb('0x1'));var timeout=require(_0x4ecb('0x2'));var express=require(_0x4ecb('0x3'));var router=express['Router']();var auth=require(_0x4ecb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4ecb('0x5'));var controller=require(_0x4ecb('0x6'));router[_0x4ecb('0x7')]('/',auth['isAuthenticated'](),controller[_0x4ecb('0x8')]);router[_0x4ecb('0x7')](_0x4ecb('0x9'),auth[_0x4ecb('0xa')](),controller['show']);router[_0x4ecb('0x7')]('/:id/queues',auth[_0x4ecb('0xa')](),controller[_0x4ecb('0xb')]);router['get']('/:id/users',auth[_0x4ecb('0xa')](),controller[_0x4ecb('0xc')]);router[_0x4ecb('0xd')]('/',auth[_0x4ecb('0xa')](),controller[_0x4ecb('0xe')]);router['post'](_0x4ecb('0xf'),auth[_0x4ecb('0xa')](),controller[_0x4ecb('0x10')]);router[_0x4ecb('0xd')](_0x4ecb('0x11'),auth[_0x4ecb('0xa')](),controller[_0x4ecb('0x12')]);router['put'](_0x4ecb('0x9'),auth[_0x4ecb('0xa')](),controller[_0x4ecb('0x13')]);router[_0x4ecb('0x14')]('/:id',auth[_0x4ecb('0xa')](),controller[_0x4ecb('0x15')]);router[_0x4ecb('0x14')](_0x4ecb('0xf'),auth['isAuthenticated'](),controller[_0x4ecb('0x16')]);router[_0x4ecb('0x14')](_0x4ecb('0x11'),auth['isAuthenticated'](),controller[_0x4ecb('0x17')]);module[_0x4ecb('0x18')]=router; \ No newline at end of file +var _0xd344=['isAuthenticated','index','get','show','/:id/queues','getQueues','getAgents','create','post','addQueues','/:id/users','addAgents','put','delete','/:id','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./team.controller'];(function(_0x50cb4b,_0x140d9a){var _0x53b81a=function(_0x5a5d1a){while(--_0x5a5d1a){_0x50cb4b['push'](_0x50cb4b['shift']());}};_0x53b81a(++_0x140d9a);}(_0xd344,0x125));var _0x4d34=function(_0x35720e,_0x20d474){_0x35720e=_0x35720e-0x0;var _0x3f4a73=_0xd344[_0x35720e];return _0x3f4a73;};'use strict';var multer=require(_0x4d34('0x0'));var util=require(_0x4d34('0x1'));var path=require(_0x4d34('0x2'));var timeout=require(_0x4d34('0x3'));var express=require(_0x4d34('0x4'));var router=express['Router']();var auth=require(_0x4d34('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4d34('0x6'));router['get']('/',auth[_0x4d34('0x7')](),controller[_0x4d34('0x8')]);router[_0x4d34('0x9')]('/:id',auth[_0x4d34('0x7')](),controller[_0x4d34('0xa')]);router[_0x4d34('0x9')](_0x4d34('0xb'),auth[_0x4d34('0x7')](),controller[_0x4d34('0xc')]);router[_0x4d34('0x9')]('/:id/users',auth[_0x4d34('0x7')](),controller[_0x4d34('0xd')]);router['post']('/',auth[_0x4d34('0x7')](),controller[_0x4d34('0xe')]);router[_0x4d34('0xf')](_0x4d34('0xb'),auth[_0x4d34('0x7')](),controller[_0x4d34('0x10')]);router[_0x4d34('0xf')](_0x4d34('0x11'),auth[_0x4d34('0x7')](),controller[_0x4d34('0x12')]);router[_0x4d34('0x13')]('/:id',auth[_0x4d34('0x7')](),controller['update']);router[_0x4d34('0x14')](_0x4d34('0x15'),auth[_0x4d34('0x7')](),controller[_0x4d34('0x16')]);router[_0x4d34('0x14')]('/:id/queues',auth[_0x4d34('0x7')](),controller['removeQueues']);router[_0x4d34('0x14')](_0x4d34('0x11'),auth['isAuthenticated'](),controller[_0x4d34('0x17')]);module[_0x4d34('0x18')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 37380b4..b3a818f 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 _0x1ec3=['exports','STRING','name'];(function(_0x2fcd90,_0x4780cc){var _0x55b596=function(_0xe475f6){while(--_0xe475f6){_0x2fcd90['push'](_0x2fcd90['shift']());}};_0x55b596(++_0x4780cc);}(_0x1ec3,0x7e));var _0x31ec=function(_0xd6956c,_0x116a90){_0xd6956c=_0xd6956c-0x0;var _0x521362=_0x1ec3[_0xd6956c];return _0x521362;};'use strict';var Sequelize=require('sequelize');module[_0x31ec('0x0')]={'name':{'type':Sequelize[_0x31ec('0x1')],'allowNull':![],'unique':_0x31ec('0x2')},'description':{'type':Sequelize[_0x31ec('0x1')]}}; \ No newline at end of file +var _0x5db2=['sequelize','exports','name','STRING'];(function(_0x20118a,_0x3dbdf3){var _0x538b5f=function(_0x31c5b4){while(--_0x31c5b4){_0x20118a['push'](_0x20118a['shift']());}};_0x538b5f(++_0x3dbdf3);}(_0x5db2,0x90));var _0x25db=function(_0x563364,_0x2cdc4f){_0x563364=_0x563364-0x0;var _0x300dd0=_0x5db2[_0x563364];return _0x300dd0;};'use strict';var Sequelize=require(_0x25db('0x0'));module[_0x25db('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x25db('0x2')},'description':{'type':Sequelize[_0x25db('0x3')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 07e496c..88445be 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 _0xda9d=['format','interface','omit','spread','emit','userTeam:save','removeAgents','voice','chat','mail','userTeam:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./team.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','update','destroy','then','get','Teams','error','stack','name','send','index','map','Team','type','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','fields','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','findOne','add','Queues','removeQueues','Sequelize','ids','Voice','Chat','Mail','Sms','Fax','each','addAgents','User','online','voicePause','UserVoiceQueueRt','upsert','isNil'];(function(_0x2b3c2c,_0x2f21c6){var _0xd4557e=function(_0x4e2736){while(--_0x4e2736){_0x2b3c2c['push'](_0x2b3c2c['shift']());}};_0xd4557e(++_0x2f21c6);}(_0xda9d,0x85));var _0xdda9=function(_0x48b5e0,_0xb3826){_0x48b5e0=_0x48b5e0-0x0;var _0x4287ea=_0xda9d[_0x48b5e0];return _0x4287ea;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdda9('0x0'));var rimraf=require(_0xdda9('0x1'));var zipdir=require(_0xdda9('0x2'));var jsonpatch=require(_0xdda9('0x3'));var rp=require(_0xdda9('0x4'));var moment=require('moment');var BPromise=require(_0xdda9('0x5'));var Mustache=require('mustache');var util=require(_0xdda9('0x6'));var path=require('path');var sox=require(_0xdda9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xdda9('0x8'));var crypto=require(_0xdda9('0x9'));var jsforce=require(_0xdda9('0xa'));var deskjs=require(_0xdda9('0xb'));var toCsv=require('to-csv');var querystring=require(_0xdda9('0xc'));var Papa=require(_0xdda9('0xd'));var Redis=require(_0xdda9('0xe'));var authService=require(_0xdda9('0xf'));var qs=require(_0xdda9('0x10'));var as=require(_0xdda9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xdda9('0x12'));var config=require(_0xdda9('0x13'));var db=require(_0xdda9('0x14'))['db'];config['redis']=_[_0xdda9('0x15')](config[_0xdda9('0x16')],{'host':_0xdda9('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdda9('0x18'))[_0xdda9('0x19')](socket);function respondWithStatusCode(_0x2045f3,_0x10061f){_0x10061f=_0x10061f||0xcc;return function(_0x389750){if(_0x389750){return _0x2045f3[_0xdda9('0x1a')](_0x10061f);}return _0x2045f3[_0xdda9('0x1b')](_0x10061f)[_0xdda9('0x1c')]();};}function respondWithResult(_0x27899a,_0x18a3f8){_0x18a3f8=_0x18a3f8||0xc8;return function(_0x14ad33){if(_0x14ad33){return _0x27899a[_0xdda9('0x1b')](_0x18a3f8)[_0xdda9('0x1d')](_0x14ad33);}};}function respondWithFilteredResult(_0x30dec2,_0x1c0bbc){return function(_0x4ae02a){if(_0x4ae02a){var _0x2e8c4e=_0x4ae02a[_0xdda9('0x1e')],_0x200b60=_0x1c0bbc[_0xdda9('0x1f')],_0x1c46b9=_0x1c0bbc[_0xdda9('0x1f')]+_0x1c0bbc[_0xdda9('0x20')],_0x25d1e7;if(_0x1c46b9>=_0x2e8c4e){_0x1c46b9=_0x2e8c4e;_0x25d1e7=0xc8;}else{_0x25d1e7=0xce;}_0x30dec2[_0xdda9('0x1b')](_0x25d1e7);return _0x30dec2[_0xdda9('0x21')]('Content-Range',_0x200b60+'-'+_0x1c46b9+'/'+_0x2e8c4e)[_0xdda9('0x1d')](_0x4ae02a);}return null;};}function patchUpdates(_0x518f92){return function(_0x471056){try{jsonpatch[_0xdda9('0x22')](_0x471056,_0x518f92,!![]);}catch(_0x90dafa){return BPromise['reject'](_0x90dafa);}return _0x471056['save']();};}function saveUpdates(_0x2ec141,_0x2c9048){return function(_0x326db6){if(_0x326db6){return _0x326db6[_0xdda9('0x23')](_0x2ec141)['then'](function(_0x3462ce){return _0x3462ce;});}return null;};}function removeEntity(_0x402134,_0x3ddb32){return function(_0x4e4710){if(_0x4e4710){return _0x4e4710[_0xdda9('0x24')]()[_0xdda9('0x25')](function(){var _0x2257f1=_0x4e4710[_0xdda9('0x26')]({'plain':!![]});var _0x2b67d4=_0xdda9('0x27');return db['UserProfileResource'][_0xdda9('0x24')]({'where':{'type':_0x2b67d4,'resourceId':_0x2257f1['id']}})[_0xdda9('0x25')](function(){return _0x4e4710;});})[_0xdda9('0x25')](function(){_0x402134[_0xdda9('0x1b')](0xcc)[_0xdda9('0x1c')]();});}};}function handleEntityNotFound(_0x22ac80,_0xb10a83){return function(_0x8eae05){if(!_0x8eae05){_0x22ac80[_0xdda9('0x1a')](0x194);}return _0x8eae05;};}function handleError(_0x130105,_0x2278cd){_0x2278cd=_0x2278cd||0x1f4;return function(_0x3a74de){logger[_0xdda9('0x28')](_0x3a74de[_0xdda9('0x29')]);if(_0x3a74de['name']){delete _0x3a74de[_0xdda9('0x2a')];}_0x130105[_0xdda9('0x1b')](_0x2278cd)[_0xdda9('0x2b')](_0x3a74de);};}exports[_0xdda9('0x2c')]=function(_0x1f078f,_0x2a88af){var _0x553036={},_0x516c7d={},_0x239ae9={'count':0x0,'rows':[]};var _0x4857c0=_[_0xdda9('0x2d')](db[_0xdda9('0x2e')]['rawAttributes'],function(_0x5f5478){return{'name':_0x5f5478['fieldName'],'type':_0x5f5478[_0xdda9('0x2f')]['key']};});_0x516c7d[_0xdda9('0x30')]=_['map'](_0x4857c0,_0xdda9('0x2a'));_0x516c7d[_0xdda9('0x31')]=_[_0xdda9('0x32')](_0x1f078f[_0xdda9('0x31')]);_0x516c7d['filters']=_[_0xdda9('0x33')](_0x516c7d[_0xdda9('0x30')],_0x516c7d[_0xdda9('0x31')]);_0x553036[_0xdda9('0x34')]=_[_0xdda9('0x33')](_0x516c7d[_0xdda9('0x30')],qs['fields'](_0x1f078f['query']['fields']));_0x553036[_0xdda9('0x34')]=_0x553036[_0xdda9('0x34')][_0xdda9('0x35')]?_0x553036[_0xdda9('0x34')]:_0x516c7d[_0xdda9('0x30')];if(!_0x1f078f['query'][_0xdda9('0x36')](_0xdda9('0x37'))){_0x553036[_0xdda9('0x20')]=qs[_0xdda9('0x20')](_0x1f078f[_0xdda9('0x31')]['limit']);_0x553036[_0xdda9('0x1f')]=qs[_0xdda9('0x1f')](_0x1f078f[_0xdda9('0x31')]['offset']);}_0x553036[_0xdda9('0x38')]=qs[_0xdda9('0x39')](_0x1f078f[_0xdda9('0x31')][_0xdda9('0x39')]);_0x553036[_0xdda9('0x3a')]=qs['filters'](_[_0xdda9('0x3b')](_0x1f078f[_0xdda9('0x31')],_0x516c7d[_0xdda9('0x3c')]),_0x4857c0);if(_0x1f078f['query'][_0xdda9('0x3d')]){_0x553036['where']=_[_0xdda9('0x3e')](_0x553036[_0xdda9('0x3a')],{'$or':_['map'](_0x4857c0,function(_0x5ab11d){if(_0x5ab11d[_0xdda9('0x2f')]!==_0xdda9('0x3f')){var _0x261c42={};_0x261c42[_0x5ab11d[_0xdda9('0x2a')]]={'$like':'%'+_0x1f078f['query'][_0xdda9('0x3d')]+'%'};return _0x261c42;}})});}_0x553036=_[_0xdda9('0x3e')]({},_0x553036,_0x1f078f[_0xdda9('0x40')]);var _0x5cd55a={'where':_0x553036[_0xdda9('0x3a')]};return db[_0xdda9('0x2e')][_0xdda9('0x1e')](_0x5cd55a)[_0xdda9('0x25')](function(_0x573c86){_0x239ae9['count']=_0x573c86;if(_0x1f078f[_0xdda9('0x31')]['includeAll']){_0x553036[_0xdda9('0x41')]=[{'all':!![]}];}return db[_0xdda9('0x2e')][_0xdda9('0x42')](_0x553036);})[_0xdda9('0x25')](function(_0x4a1794){_0x239ae9[_0xdda9('0x43')]=_0x4a1794;return _0x239ae9;})[_0xdda9('0x25')](respondWithFilteredResult(_0x2a88af,_0x553036))['catch'](handleError(_0x2a88af,null));};exports[_0xdda9('0x44')]=function(_0x3d563a,_0x4bf8c3){var _0x35210f={'raw':![],'where':{'id':_0x3d563a[_0xdda9('0x45')]['id']}},_0x3bbd35={};_0x3bbd35[_0xdda9('0x30')]=_[_0xdda9('0x32')](db['Team'][_0xdda9('0x46')]);_0x3bbd35[_0xdda9('0x31')]=_[_0xdda9('0x32')](_0x3d563a[_0xdda9('0x31')]);_0x3bbd35[_0xdda9('0x3c')]=_[_0xdda9('0x33')](_0x3bbd35[_0xdda9('0x30')],_0x3bbd35[_0xdda9('0x31')]);_0x35210f[_0xdda9('0x34')]=_[_0xdda9('0x33')](_0x3bbd35[_0xdda9('0x30')],qs[_0xdda9('0x47')](_0x3d563a[_0xdda9('0x31')]['fields']));_0x35210f[_0xdda9('0x34')]=_0x35210f[_0xdda9('0x34')]['length']?_0x35210f[_0xdda9('0x34')]:_0x3bbd35['model'];if(_0x3d563a[_0xdda9('0x31')][_0xdda9('0x48')]){_0x35210f[_0xdda9('0x41')]=[{'all':!![]}];}_0x35210f=_[_0xdda9('0x3e')]({},_0x35210f,_0x3d563a[_0xdda9('0x40')]);return db[_0xdda9('0x2e')][_0xdda9('0x49')](_0x35210f)[_0xdda9('0x25')](handleEntityNotFound(_0x4bf8c3,null))['then'](respondWithResult(_0x4bf8c3,null))[_0xdda9('0x4a')](handleError(_0x4bf8c3,null));};exports[_0xdda9('0x4b')]=function(_0x5b667f,_0x444528){return db['Team']['create'](_0x5b667f[_0xdda9('0x4c')],{})[_0xdda9('0x25')](function(_0x28ff32){var _0x34cd55=_0x5b667f[_0xdda9('0x4d')][_0xdda9('0x26')]({'plain':!![]});if(!_0x34cd55)throw new Error(_0xdda9('0x4e'));if(_0x34cd55[_0xdda9('0x4f')]==='user'){var _0x2e745e=_0x28ff32['get']({'plain':!![]});var _0x140448='Teams';return db[_0xdda9('0x50')][_0xdda9('0x49')]({'where':{'name':_0x140448,'userProfileId':_0x34cd55['userProfileId']},'raw':!![]})[_0xdda9('0x25')](function(_0x1f6af1){if(_0x1f6af1&&_0x1f6af1['autoAssociation']===0x0){return db['UserProfileResource'][_0xdda9('0x4b')]({'name':_0x2e745e[_0xdda9('0x2a')],'resourceId':_0x2e745e['id'],'type':_0x1f6af1[_0xdda9('0x2a')],'sectionId':_0x1f6af1['id']},{})[_0xdda9('0x25')](function(){return _0x28ff32;});}else{return _0x28ff32;}})[_0xdda9('0x4a')](function(_0x4cad1b){logger[_0xdda9('0x28')](_0xdda9('0x51'),_0x4cad1b);throw _0x4cad1b;});}return _0x28ff32;})[_0xdda9('0x25')](respondWithResult(_0x444528,0xc9))[_0xdda9('0x4a')](handleError(_0x444528,null));};exports['update']=function(_0x474283,_0x432a54){if(_0x474283[_0xdda9('0x4c')]['id']){delete _0x474283[_0xdda9('0x4c')]['id'];}return db['Team'][_0xdda9('0x49')]({'where':{'id':_0x474283[_0xdda9('0x45')]['id']}})[_0xdda9('0x25')](handleEntityNotFound(_0x432a54,null))['then'](saveUpdates(_0x474283[_0xdda9('0x4c')],null))[_0xdda9('0x25')](respondWithResult(_0x432a54,null))[_0xdda9('0x4a')](handleError(_0x432a54,null));};exports[_0xdda9('0x24')]=function(_0x38a6da,_0x200ce1){return db[_0xdda9('0x2e')]['find']({'where':{'id':_0x38a6da[_0xdda9('0x45')]['id']}})[_0xdda9('0x25')](handleEntityNotFound(_0x200ce1,null))[_0xdda9('0x25')](removeEntity(_0x200ce1,null))[_0xdda9('0x4a')](handleError(_0x200ce1,null));};exports[_0xdda9('0x52')]=function(_0x472382,_0x4cdbe7,_0x2aaf62){return db[_0xdda9('0x2e')]['findOne']({'where':{'id':_0x472382[_0xdda9('0x45')]['id']}})[_0xdda9('0x25')](handleEntityNotFound(_0x4cdbe7,null))['then'](function(_0x57d543){if(!_0x472382[_0xdda9('0x31')][_0xdda9('0x53')]||!utils[_0xdda9('0x54')](_0x472382[_0xdda9('0x31')]['channel'])){throw new db['Sequelize'][(_0xdda9('0x55'))](_0xdda9('0x56'));}var _0x2be189={};var _0x3efb34={};_0x3efb34['model']=_[_0xdda9('0x32')](db[_[_0xdda9('0x57')](_0x472382['query'][_0xdda9('0x53')][_0xdda9('0x58')]())+_0xdda9('0x59')][_0xdda9('0x46')]);_0x3efb34[_0xdda9('0x31')]=_['keys'](_0x472382[_0xdda9('0x31')]);_0x3efb34[_0xdda9('0x3c')]=_[_0xdda9('0x33')](_0x3efb34[_0xdda9('0x30')],_0x3efb34[_0xdda9('0x31')]);_0x2be189['attributes']=_[_0xdda9('0x33')](_0x3efb34[_0xdda9('0x30')],qs[_0xdda9('0x47')](_0x472382[_0xdda9('0x31')][_0xdda9('0x47')]));_0x2be189[_0xdda9('0x34')]=_0x2be189[_0xdda9('0x34')][_0xdda9('0x35')]?_0x2be189['attributes']:_0x3efb34[_0xdda9('0x30')];_0x2be189[_0xdda9('0x20')]=qs[_0xdda9('0x20')](_0x472382['query']['limit']);_0x2be189[_0xdda9('0x1f')]=qs[_0xdda9('0x1f')](_0x472382[_0xdda9('0x31')][_0xdda9('0x1f')]);_0x2be189[_0xdda9('0x38')]=qs['sort'](_0x472382[_0xdda9('0x31')][_0xdda9('0x39')]);_0x2be189['where']=qs['filters'](_[_0xdda9('0x3b')](_0x472382['query'],_0x3efb34[_0xdda9('0x3c')]));_0x2be189=_[_0xdda9('0x3e')]({},_0x2be189,_0x472382['options']);return _0x57d543['get'+_[_0xdda9('0x57')](_0x472382[_0xdda9('0x31')][_0xdda9('0x53')][_0xdda9('0x58')]())+'Queues'](_0x2be189);})['then'](respondWithResult(_0x4cdbe7,null))[_0xdda9('0x4a')](handleError(_0x4cdbe7,null));};exports['addQueues']=function(_0x3a010e,_0x4be237,_0x5ddbd9){return db[_0xdda9('0x2e')][_0xdda9('0x5a')]({'where':{'id':_0x3a010e[_0xdda9('0x45')]['id']}})[_0xdda9('0x25')](function(_0x5a1882){if(_0x5a1882){if(!_0x3a010e[_0xdda9('0x4c')][_0xdda9('0x53')]||!utils[_0xdda9('0x54')](_0x3a010e[_0xdda9('0x4c')][_0xdda9('0x53')])){throw new db['Sequelize']['ValidationError'](_0xdda9('0x56'));}return _0x5a1882[_0xdda9('0x5b')+_['capitalize'](_0x3a010e['body'][_0xdda9('0x53')][_0xdda9('0x58')]())+_0xdda9('0x5c')](_0x3a010e[_0xdda9('0x4c')]['ids']);}return null;})[_0xdda9('0x25')](handleEntityNotFound(_0x4be237,null))[_0xdda9('0x25')](respondWithStatusCode(_0x4be237,null))[_0xdda9('0x4a')](handleError(_0x4be237,null));};exports[_0xdda9('0x5d')]=function(_0x54b364,_0x38d22c,_0x244739){return db[_0xdda9('0x2e')][_0xdda9('0x5a')]({'where':{'id':_0x54b364[_0xdda9('0x45')]['id']}})[_0xdda9('0x25')](function(_0x3bc785){if(_0x3bc785){if(!_0x54b364[_0xdda9('0x31')][_0xdda9('0x53')]||!utils[_0xdda9('0x54')](_0x54b364[_0xdda9('0x31')][_0xdda9('0x53')])){throw new db[(_0xdda9('0x5e'))][(_0xdda9('0x55'))]('Unknown\x20channel');}return _0x3bc785['remove'+_[_0xdda9('0x57')](_0x54b364[_0xdda9('0x31')][_0xdda9('0x53')][_0xdda9('0x58')]())+'Queues'](_0x54b364[_0xdda9('0x31')][_0xdda9('0x5f')]);}return null;})[_0xdda9('0x25')](handleEntityNotFound(_0x38d22c,null))[_0xdda9('0x25')](respondWithStatusCode(_0x38d22c,null))[_0xdda9('0x4a')](handleError(_0x38d22c,null));};exports['addAgents']=function(_0x1bcce7,_0x1b3181,_0x4dbd07){return db[_0xdda9('0x2e')][_0xdda9('0x49')]({'where':{'id':_0x1bcce7[_0xdda9('0x45')]['id']}})[_0xdda9('0x25')](handleEntityNotFound(_0x1b3181,null))[_0xdda9('0x25')](function(_0x54bfee){if(_0x54bfee){var _0xa4358e=[_0xdda9('0x60'),_0xdda9('0x61'),_0xdda9('0x62'),_0xdda9('0x63'),_0xdda9('0x64'),'Openchannel','Whatsapp'];return BPromise['each'](_0xa4358e,function(_0x4bae5f){return _0x54bfee['get'+_0x4bae5f+'Queues']({'attributes':['id',_0xdda9('0x2a')]})[_0xdda9('0x25')](function(_0x10ab0f){return BPromise[_0xdda9('0x65')](_0x10ab0f,function(_0x5454da){return _0x5454da[_0xdda9('0x66')](_0x1bcce7['body'][_0xdda9('0x5f')])[_0xdda9('0x25')](function(){if(_0x4bae5f===_0xdda9('0x60')){return db[_0xdda9('0x67')][_0xdda9('0x42')]({'where':{'id':_0x1bcce7[_0xdda9('0x4c')][_0xdda9('0x5f')]},'attributes':['id',_0xdda9('0x2a'),_0xdda9('0x68'),_0xdda9('0x69'),'interface'],'raw':!![]})[_0xdda9('0x25')](function(_0x54ab76){return BPromise['each'](_[_0xdda9('0x3d')](_0x54ab76,{'online':0x1}),function(_0x322413){return db[_0xdda9('0x6a')][_0xdda9('0x6b')]({'membername':_0x322413[_0xdda9('0x2a')],'UserId':_0x322413['id'],'queue_name':_0x5454da[_0xdda9('0x2a')],'VoiceQueueId':_0x5454da['id'],'interface':_[_0xdda9('0x6c')](_0x322413['interface'])?util[_0xdda9('0x6d')]('SIP/%s',_0x322413[_0xdda9('0x2a')]):_0x322413[_0xdda9('0x6e')],'paused':_0x322413[_0xdda9('0x69')]||![],'penalty':0x0});});});}});});})[_0xdda9('0x25')](function(){return _0x54bfee;});})[_0xdda9('0x25')](function(){return _0x54bfee;});}})['then'](function(_0x33b264){if(_0x33b264){return _0x33b264['addAgents'](_0x1bcce7[_0xdda9('0x4c')]['ids'],_[_0xdda9('0x6f')](_0x1bcce7[_0xdda9('0x4c')],[_0xdda9('0x5f'),'id'])||{})[_0xdda9('0x70')](function(_0x28c4fe){for(var _0x4c16c2=0x0;_0x4c16c2<_0x1bcce7[_0xdda9('0x4c')][_0xdda9('0x5f')][_0xdda9('0x35')];_0x4c16c2+=0x1){socket[_0xdda9('0x71')](_0xdda9('0x72'),{'UserId':_0x1bcce7['body'][_0xdda9('0x5f')][_0x4c16c2],'TeamId':_0x1bcce7[_0xdda9('0x45')]['id']});}return _0x28c4fe;});}})[_0xdda9('0x25')](respondWithResult(_0x1b3181,null))[_0xdda9('0x4a')](handleError(_0x1b3181,null));};exports[_0xdda9('0x73')]=function(_0x4a2834,_0x3d4800,_0x1be3bc){return db[_0xdda9('0x2e')][_0xdda9('0x49')]({'where':{'id':_0x4a2834['params']['id']}})[_0xdda9('0x25')](handleEntityNotFound(_0x3d4800,null))[_0xdda9('0x25')](function(_0xa0cc0){if(_0xa0cc0){return BPromise[_0xdda9('0x65')]([_0xdda9('0x74'),_0xdda9('0x75'),_0xdda9('0x76'),'sms','fax','openchannel','whatsapp'],function(_0x24af25){return _0xa0cc0[_0xdda9('0x26')+_[_0xdda9('0x57')](_0x24af25)+'Queues']({'attributes':['id',_0xdda9('0x2a')]})['then'](function(_0x46252d){return BPromise['each'](_0x46252d,function(_0x119434){return _0x119434[_0xdda9('0x73')](_0x4a2834[_0xdda9('0x31')][_0xdda9('0x5f')])[_0xdda9('0x25')](function(){if(_0x24af25==='voice'){return db[_0xdda9('0x6a')][_0xdda9('0x24')]({'where':{'VoiceQueueId':_0x119434['id'],'UserId':_0x4a2834['query'][_0xdda9('0x5f')]}});}});});})[_0xdda9('0x25')](function(){return _0xa0cc0;});})[_0xdda9('0x25')](function(){return _0xa0cc0;});}})[_0xdda9('0x25')](function(_0x383656){if(_0x383656){return _0x383656[_0xdda9('0x73')](_0x4a2834[_0xdda9('0x31')][_0xdda9('0x5f')])[_0xdda9('0x25')](function(){if(_['isArray'](_0x4a2834[_0xdda9('0x31')][_0xdda9('0x5f')])){for(var _0x422904=0x0;_0x422904<_0x4a2834['query']['ids']['length'];_0x422904+=0x1){socket[_0xdda9('0x71')](_0xdda9('0x77'),{'UserId':Number(_0x4a2834[_0xdda9('0x31')][_0xdda9('0x5f')][_0x422904]),'TeamId':Number(_0x4a2834['params']['id'])});}}else{socket['emit'](_0xdda9('0x77'),{'UserId':Number(_0x4a2834[_0xdda9('0x31')][_0xdda9('0x5f')]),'TeamId':Number(_0x4a2834[_0xdda9('0x45')]['id'])});}});}})['then'](respondWithStatusCode(_0x3d4800,null))[_0xdda9('0x4a')](handleError(_0x3d4800,null));};exports[_0xdda9('0x78')]=function(_0x1d73ac,_0x184583,_0x595b1e){var _0x214bcd={};var _0x23a7ee={};var _0x304e3a;var _0x1d54c5;return db['Team']['findOne']({'where':{'id':_0x1d73ac[_0xdda9('0x45')]['id']}})[_0xdda9('0x25')](handleEntityNotFound(_0x184583,null))[_0xdda9('0x25')](function(_0xd69329){if(_0xd69329){_0x304e3a=_0xd69329;_0x23a7ee[_0xdda9('0x30')]=_['keys'](db[_0xdda9('0x67')]['rawAttributes']);_0x23a7ee[_0xdda9('0x31')]=_[_0xdda9('0x32')](_0x1d73ac['query']);_0x23a7ee['filters']=_[_0xdda9('0x33')](_0x23a7ee[_0xdda9('0x30')],_0x23a7ee['query']);_0x214bcd['attributes']=_[_0xdda9('0x33')](_0x23a7ee[_0xdda9('0x30')],qs['fields'](_0x1d73ac[_0xdda9('0x31')][_0xdda9('0x47')]));_0x214bcd[_0xdda9('0x34')]=_0x214bcd['attributes']['length']?_0x214bcd['attributes']:_0x23a7ee['model'];_0x214bcd[_0xdda9('0x38')]=qs[_0xdda9('0x39')](_0x1d73ac[_0xdda9('0x31')][_0xdda9('0x39')]);_0x214bcd[_0xdda9('0x3a')]=qs[_0xdda9('0x3c')](_[_0xdda9('0x3b')](_0x1d73ac[_0xdda9('0x31')],_0x23a7ee['filters']));if(_0x1d73ac[_0xdda9('0x31')]['filter']){_0x214bcd[_0xdda9('0x3a')]=_['merge'](_0x214bcd['where'],{'$or':_[_0xdda9('0x2d')](_0x214bcd[_0xdda9('0x34')],function(_0x602285){var _0x31f305={};_0x31f305[_0x602285]={'$like':'%'+_0x1d73ac[_0xdda9('0x31')][_0xdda9('0x3d')]+'%'};return _0x31f305;})});}_0x214bcd=_[_0xdda9('0x3e')]({},_0x214bcd,_0x1d73ac['options']);return _0x304e3a[_0xdda9('0x78')](_0x214bcd);}})['then'](function(_0x557a13){if(_0x557a13){_0x1d54c5=_0x557a13['length'];if(!_0x1d73ac[_0xdda9('0x31')]['hasOwnProperty']('nolimit')){_0x214bcd[_0xdda9('0x20')]=qs[_0xdda9('0x20')](_0x1d73ac[_0xdda9('0x31')]['limit']);_0x214bcd[_0xdda9('0x1f')]=qs[_0xdda9('0x1f')](_0x1d73ac[_0xdda9('0x31')]['offset']);}return _0x304e3a[_0xdda9('0x78')](_0x214bcd);}})[_0xdda9('0x25')](function(_0x385d8a){if(_0x385d8a){return _0x385d8a?{'count':_0x1d54c5,'rows':_0x385d8a}:null;}})[_0xdda9('0x25')](respondWithResult(_0x184583,null))[_0xdda9('0x4a')](handleError(_0x184583,null));}; \ No newline at end of file +var _0xd217=['where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','rawAttributes','length','find','create','body','user','get','role','Teams','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getQueues','findOne','channel','Sequelize','capitalize','toLowerCase','options','addQueues','ValidationError','add','ids','removeQueues','isValidChannel','Unknown\x20channel','Queues','addAgents','Voice','Chat','Sms','Openchannel','Whatsapp','each','findAll','online','voicePause','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','interface','omit','spread','emit','userTeam:save','removeAgents','voice','chat','mail','whatsapp','userTeam:remove','getAgents','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','redis','defaults','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','map','Team','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xd217,0x141));var _0x7d21=function(_0x37f044,_0x17a6b4){_0x37f044=_0x37f044-0x0;var _0x8f68ac=_0xd217[_0x37f044];return _0x8f68ac;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7d21('0x0'));var rimraf=require(_0x7d21('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7d21('0x2'));var rp=require(_0x7d21('0x3'));var moment=require(_0x7d21('0x4'));var BPromise=require(_0x7d21('0x5'));var Mustache=require(_0x7d21('0x6'));var util=require(_0x7d21('0x7'));var path=require(_0x7d21('0x8'));var sox=require(_0x7d21('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7d21('0xa'));var squel=require(_0x7d21('0xb'));var crypto=require(_0x7d21('0xc'));var jsforce=require(_0x7d21('0xd'));var deskjs=require(_0x7d21('0xe'));var toCsv=require(_0x7d21('0xf'));var querystring=require(_0x7d21('0x10'));var Papa=require(_0x7d21('0x11'));var Redis=require(_0x7d21('0x12'));var authService=require(_0x7d21('0x13'));var qs=require(_0x7d21('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d21('0x15'))('api');var utils=require(_0x7d21('0x16'));var config=require(_0x7d21('0x17'));var db=require('../../mysqldb')['db'];config[_0x7d21('0x18')]=_[_0x7d21('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7d21('0x18')]));require('./team.socket')[_0x7d21('0x1a')](socket);function respondWithStatusCode(_0x28fc27,_0x14da44){_0x14da44=_0x14da44||0xcc;return function(_0x18fc52){if(_0x18fc52){return _0x28fc27[_0x7d21('0x1b')](_0x14da44);}return _0x28fc27['status'](_0x14da44)[_0x7d21('0x1c')]();};}function respondWithResult(_0x2e7a90,_0x903fd7){_0x903fd7=_0x903fd7||0xc8;return function(_0x5e725f){if(_0x5e725f){return _0x2e7a90[_0x7d21('0x1d')](_0x903fd7)[_0x7d21('0x1e')](_0x5e725f);}};}function respondWithFilteredResult(_0x8966ca,_0x57ec1d){return function(_0x10dcbe){if(_0x10dcbe){var _0x14d084=_0x10dcbe[_0x7d21('0x1f')],_0x2bba32=_0x57ec1d[_0x7d21('0x20')],_0x5302f3=_0x57ec1d[_0x7d21('0x20')]+_0x57ec1d[_0x7d21('0x21')],_0x5b15c5;if(_0x5302f3>=_0x14d084){_0x5302f3=_0x14d084;_0x5b15c5=0xc8;}else{_0x5b15c5=0xce;}_0x8966ca[_0x7d21('0x1d')](_0x5b15c5);return _0x8966ca[_0x7d21('0x22')](_0x7d21('0x23'),_0x2bba32+'-'+_0x5302f3+'/'+_0x14d084)[_0x7d21('0x1e')](_0x10dcbe);}return null;};}function patchUpdates(_0x29fd15){return function(_0x1237e2){try{jsonpatch[_0x7d21('0x24')](_0x1237e2,_0x29fd15,!![]);}catch(_0x241ff3){return BPromise[_0x7d21('0x25')](_0x241ff3);}return _0x1237e2[_0x7d21('0x26')]();};}function saveUpdates(_0x5b3ffa,_0x593cb7){return function(_0x4a2cad){if(_0x4a2cad){return _0x4a2cad[_0x7d21('0x27')](_0x5b3ffa)['then'](function(_0x72e361){return _0x72e361;});}return null;};}function removeEntity(_0x321d8e,_0xf1cedf){return function(_0x1deee8){if(_0x1deee8){return _0x1deee8[_0x7d21('0x28')]()[_0x7d21('0x29')](function(){var _0x497373=_0x1deee8['get']({'plain':!![]});var _0x232d0e='Teams';return db['UserProfileResource'][_0x7d21('0x28')]({'where':{'type':_0x232d0e,'resourceId':_0x497373['id']}})[_0x7d21('0x29')](function(){return _0x1deee8;});})[_0x7d21('0x29')](function(){_0x321d8e[_0x7d21('0x1d')](0xcc)[_0x7d21('0x1c')]();});}};}function handleEntityNotFound(_0x42c377,_0x1d22bc){return function(_0x5ab0c6){if(!_0x5ab0c6){_0x42c377['sendStatus'](0x194);}return _0x5ab0c6;};}function handleError(_0x5e9a82,_0x5dacbf){_0x5dacbf=_0x5dacbf||0x1f4;return function(_0x1ed02c){logger[_0x7d21('0x2a')](_0x1ed02c['stack']);if(_0x1ed02c[_0x7d21('0x2b')]){delete _0x1ed02c['name'];}_0x5e9a82[_0x7d21('0x1d')](_0x5dacbf)[_0x7d21('0x2c')](_0x1ed02c);};}exports['index']=function(_0x5220d8,_0x5d32ac){var _0x5412d2={},_0x596104={},_0x187012={'count':0x0,'rows':[]};var _0x56a952=_[_0x7d21('0x2d')](db[_0x7d21('0x2e')]['rawAttributes'],function(_0x323a8a){return{'name':_0x323a8a[_0x7d21('0x2f')],'type':_0x323a8a[_0x7d21('0x30')][_0x7d21('0x31')]};});_0x596104[_0x7d21('0x32')]=_[_0x7d21('0x2d')](_0x56a952,_0x7d21('0x2b'));_0x596104[_0x7d21('0x33')]=_[_0x7d21('0x34')](_0x5220d8[_0x7d21('0x33')]);_0x596104[_0x7d21('0x35')]=_['intersection'](_0x596104[_0x7d21('0x32')],_0x596104[_0x7d21('0x33')]);_0x5412d2[_0x7d21('0x36')]=_[_0x7d21('0x37')](_0x596104[_0x7d21('0x32')],qs[_0x7d21('0x38')](_0x5220d8[_0x7d21('0x33')][_0x7d21('0x38')]));_0x5412d2[_0x7d21('0x36')]=_0x5412d2[_0x7d21('0x36')]['length']?_0x5412d2[_0x7d21('0x36')]:_0x596104[_0x7d21('0x32')];if(!_0x5220d8[_0x7d21('0x33')][_0x7d21('0x39')]('nolimit')){_0x5412d2[_0x7d21('0x21')]=qs[_0x7d21('0x21')](_0x5220d8[_0x7d21('0x33')][_0x7d21('0x21')]);_0x5412d2[_0x7d21('0x20')]=qs[_0x7d21('0x20')](_0x5220d8[_0x7d21('0x33')][_0x7d21('0x20')]);}_0x5412d2[_0x7d21('0x3a')]=qs['sort'](_0x5220d8[_0x7d21('0x33')][_0x7d21('0x3b')]);_0x5412d2[_0x7d21('0x3c')]=qs[_0x7d21('0x35')](_[_0x7d21('0x3d')](_0x5220d8[_0x7d21('0x33')],_0x596104[_0x7d21('0x35')]),_0x56a952);if(_0x5220d8['query'][_0x7d21('0x3e')]){_0x5412d2[_0x7d21('0x3c')]=_[_0x7d21('0x3f')](_0x5412d2[_0x7d21('0x3c')],{'$or':_[_0x7d21('0x2d')](_0x56a952,function(_0xfea736){if(_0xfea736[_0x7d21('0x30')]!==_0x7d21('0x40')){var _0x24f26d={};_0x24f26d[_0xfea736[_0x7d21('0x2b')]]={'$like':'%'+_0x5220d8[_0x7d21('0x33')][_0x7d21('0x3e')]+'%'};return _0x24f26d;}})});}_0x5412d2=_[_0x7d21('0x3f')]({},_0x5412d2,_0x5220d8['options']);var _0x3d8563={'where':_0x5412d2[_0x7d21('0x3c')]};return db[_0x7d21('0x2e')]['count'](_0x3d8563)[_0x7d21('0x29')](function(_0x369d26){_0x187012[_0x7d21('0x1f')]=_0x369d26;if(_0x5220d8['query'][_0x7d21('0x41')]){_0x5412d2[_0x7d21('0x42')]=[{'all':!![]}];}return db[_0x7d21('0x2e')]['findAll'](_0x5412d2);})['then'](function(_0x4bc87c){_0x187012[_0x7d21('0x43')]=_0x4bc87c;return _0x187012;})[_0x7d21('0x29')](respondWithFilteredResult(_0x5d32ac,_0x5412d2))[_0x7d21('0x44')](handleError(_0x5d32ac,null));};exports[_0x7d21('0x45')]=function(_0x3e00e0,_0xf2c061){var _0x29c59a={'raw':![],'where':{'id':_0x3e00e0['params']['id']}},_0x5d1466={};_0x5d1466[_0x7d21('0x32')]=_[_0x7d21('0x34')](db['Team'][_0x7d21('0x46')]);_0x5d1466[_0x7d21('0x33')]=_[_0x7d21('0x34')](_0x3e00e0[_0x7d21('0x33')]);_0x5d1466[_0x7d21('0x35')]=_[_0x7d21('0x37')](_0x5d1466['model'],_0x5d1466[_0x7d21('0x33')]);_0x29c59a[_0x7d21('0x36')]=_[_0x7d21('0x37')](_0x5d1466[_0x7d21('0x32')],qs[_0x7d21('0x38')](_0x3e00e0[_0x7d21('0x33')][_0x7d21('0x38')]));_0x29c59a[_0x7d21('0x36')]=_0x29c59a[_0x7d21('0x36')][_0x7d21('0x47')]?_0x29c59a['attributes']:_0x5d1466[_0x7d21('0x32')];if(_0x3e00e0['query'][_0x7d21('0x41')]){_0x29c59a[_0x7d21('0x42')]=[{'all':!![]}];}_0x29c59a=_['merge']({},_0x29c59a,_0x3e00e0['options']);return db[_0x7d21('0x2e')][_0x7d21('0x48')](_0x29c59a)['then'](handleEntityNotFound(_0xf2c061,null))[_0x7d21('0x29')](respondWithResult(_0xf2c061,null))['catch'](handleError(_0xf2c061,null));};exports[_0x7d21('0x49')]=function(_0x248eed,_0x580999){return db[_0x7d21('0x2e')][_0x7d21('0x49')](_0x248eed[_0x7d21('0x4a')],{})[_0x7d21('0x29')](function(_0x512e5b){var _0x5267dc=_0x248eed[_0x7d21('0x4b')][_0x7d21('0x4c')]({'plain':!![]});if(!_0x5267dc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5267dc[_0x7d21('0x4d')]===_0x7d21('0x4b')){var _0x1f24c1=_0x512e5b['get']({'plain':!![]});var _0x113abd=_0x7d21('0x4e');return db[_0x7d21('0x4f')][_0x7d21('0x48')]({'where':{'name':_0x113abd,'userProfileId':_0x5267dc[_0x7d21('0x50')]},'raw':!![]})[_0x7d21('0x29')](function(_0x74d0db){if(_0x74d0db&&_0x74d0db[_0x7d21('0x51')]===0x0){return db['UserProfileResource'][_0x7d21('0x49')]({'name':_0x1f24c1[_0x7d21('0x2b')],'resourceId':_0x1f24c1['id'],'type':_0x74d0db[_0x7d21('0x2b')],'sectionId':_0x74d0db['id']},{})[_0x7d21('0x29')](function(){return _0x512e5b;});}else{return _0x512e5b;}})[_0x7d21('0x44')](function(_0x5acb19){logger['error'](_0x7d21('0x52'),_0x5acb19);throw _0x5acb19;});}return _0x512e5b;})['then'](respondWithResult(_0x580999,0xc9))['catch'](handleError(_0x580999,null));};exports[_0x7d21('0x27')]=function(_0x268f1c,_0x584718){if(_0x268f1c[_0x7d21('0x4a')]['id']){delete _0x268f1c[_0x7d21('0x4a')]['id'];}return db[_0x7d21('0x2e')][_0x7d21('0x48')]({'where':{'id':_0x268f1c[_0x7d21('0x53')]['id']}})[_0x7d21('0x29')](handleEntityNotFound(_0x584718,null))[_0x7d21('0x29')](saveUpdates(_0x268f1c[_0x7d21('0x4a')],null))[_0x7d21('0x29')](respondWithResult(_0x584718,null))['catch'](handleError(_0x584718,null));};exports['destroy']=function(_0x2b6dcd,_0x3b669e){return db[_0x7d21('0x2e')]['find']({'where':{'id':_0x2b6dcd[_0x7d21('0x53')]['id']}})[_0x7d21('0x29')](handleEntityNotFound(_0x3b669e,null))[_0x7d21('0x29')](removeEntity(_0x3b669e,null))[_0x7d21('0x44')](handleError(_0x3b669e,null));};exports[_0x7d21('0x54')]=function(_0x15517d,_0x5b1682,_0xb14355){return db[_0x7d21('0x2e')][_0x7d21('0x55')]({'where':{'id':_0x15517d['params']['id']}})[_0x7d21('0x29')](handleEntityNotFound(_0x5b1682,null))[_0x7d21('0x29')](function(_0x496779){if(!_0x15517d['query'][_0x7d21('0x56')]||!utils['isValidChannel'](_0x15517d[_0x7d21('0x33')][_0x7d21('0x56')])){throw new db[(_0x7d21('0x57'))]['ValidationError']('Unknown\x20channel');}var _0x2e6b27={};var _0x13870a={};_0x13870a[_0x7d21('0x32')]=_['keys'](db[_[_0x7d21('0x58')](_0x15517d[_0x7d21('0x33')]['channel'][_0x7d21('0x59')]())+'Queue'][_0x7d21('0x46')]);_0x13870a[_0x7d21('0x33')]=_[_0x7d21('0x34')](_0x15517d['query']);_0x13870a[_0x7d21('0x35')]=_[_0x7d21('0x37')](_0x13870a[_0x7d21('0x32')],_0x13870a[_0x7d21('0x33')]);_0x2e6b27[_0x7d21('0x36')]=_[_0x7d21('0x37')](_0x13870a[_0x7d21('0x32')],qs[_0x7d21('0x38')](_0x15517d[_0x7d21('0x33')][_0x7d21('0x38')]));_0x2e6b27['attributes']=_0x2e6b27['attributes'][_0x7d21('0x47')]?_0x2e6b27['attributes']:_0x13870a[_0x7d21('0x32')];_0x2e6b27['limit']=qs['limit'](_0x15517d[_0x7d21('0x33')]['limit']);_0x2e6b27[_0x7d21('0x20')]=qs[_0x7d21('0x20')](_0x15517d[_0x7d21('0x33')][_0x7d21('0x20')]);_0x2e6b27[_0x7d21('0x3a')]=qs[_0x7d21('0x3b')](_0x15517d['query']['sort']);_0x2e6b27[_0x7d21('0x3c')]=qs[_0x7d21('0x35')](_[_0x7d21('0x3d')](_0x15517d[_0x7d21('0x33')],_0x13870a[_0x7d21('0x35')]));_0x2e6b27=_[_0x7d21('0x3f')]({},_0x2e6b27,_0x15517d[_0x7d21('0x5a')]);return _0x496779[_0x7d21('0x4c')+_[_0x7d21('0x58')](_0x15517d['query'][_0x7d21('0x56')][_0x7d21('0x59')]())+'Queues'](_0x2e6b27);})[_0x7d21('0x29')](respondWithResult(_0x5b1682,null))[_0x7d21('0x44')](handleError(_0x5b1682,null));};exports[_0x7d21('0x5b')]=function(_0x61ac9a,_0xacb847,_0x5abe02){return db[_0x7d21('0x2e')][_0x7d21('0x55')]({'where':{'id':_0x61ac9a[_0x7d21('0x53')]['id']}})[_0x7d21('0x29')](function(_0x21f986){if(_0x21f986){if(!_0x61ac9a['body'][_0x7d21('0x56')]||!utils['isValidChannel'](_0x61ac9a['body'][_0x7d21('0x56')])){throw new db[(_0x7d21('0x57'))][(_0x7d21('0x5c'))]('Unknown\x20channel');}return _0x21f986[_0x7d21('0x5d')+_['capitalize'](_0x61ac9a[_0x7d21('0x4a')][_0x7d21('0x56')][_0x7d21('0x59')]())+'Queues'](_0x61ac9a[_0x7d21('0x4a')][_0x7d21('0x5e')]);}return null;})['then'](handleEntityNotFound(_0xacb847,null))['then'](respondWithStatusCode(_0xacb847,null))[_0x7d21('0x44')](handleError(_0xacb847,null));};exports[_0x7d21('0x5f')]=function(_0x7f59b9,_0x42b241,_0x470e77){return db['Team'][_0x7d21('0x55')]({'where':{'id':_0x7f59b9[_0x7d21('0x53')]['id']}})['then'](function(_0x1d7fd7){if(_0x1d7fd7){if(!_0x7f59b9[_0x7d21('0x33')][_0x7d21('0x56')]||!utils[_0x7d21('0x60')](_0x7f59b9[_0x7d21('0x33')][_0x7d21('0x56')])){throw new db[(_0x7d21('0x57'))][(_0x7d21('0x5c'))](_0x7d21('0x61'));}return _0x1d7fd7['remove'+_[_0x7d21('0x58')](_0x7f59b9['query']['channel'][_0x7d21('0x59')]())+_0x7d21('0x62')](_0x7f59b9[_0x7d21('0x33')][_0x7d21('0x5e')]);}return null;})[_0x7d21('0x29')](handleEntityNotFound(_0x42b241,null))[_0x7d21('0x29')](respondWithStatusCode(_0x42b241,null))['catch'](handleError(_0x42b241,null));};exports[_0x7d21('0x63')]=function(_0x22bd76,_0x50d4ee,_0x1d5da4){return db[_0x7d21('0x2e')][_0x7d21('0x48')]({'where':{'id':_0x22bd76[_0x7d21('0x53')]['id']}})[_0x7d21('0x29')](handleEntityNotFound(_0x50d4ee,null))[_0x7d21('0x29')](function(_0x23b37b){if(_0x23b37b){var _0x49122a=[_0x7d21('0x64'),_0x7d21('0x65'),'Mail',_0x7d21('0x66'),'Fax',_0x7d21('0x67'),_0x7d21('0x68')];return BPromise[_0x7d21('0x69')](_0x49122a,function(_0x1c084e){return _0x23b37b[_0x7d21('0x4c')+_0x1c084e+'Queues']({'attributes':['id',_0x7d21('0x2b')]})[_0x7d21('0x29')](function(_0x1dfded){return BPromise['each'](_0x1dfded,function(_0xabfe44){return _0xabfe44[_0x7d21('0x63')](_0x22bd76[_0x7d21('0x4a')][_0x7d21('0x5e')])['then'](function(){if(_0x1c084e===_0x7d21('0x64')){return db['User'][_0x7d21('0x6a')]({'where':{'id':_0x22bd76['body'][_0x7d21('0x5e')]},'attributes':['id','name',_0x7d21('0x6b'),_0x7d21('0x6c'),'interface'],'raw':!![]})[_0x7d21('0x29')](function(_0x4f35f6){return BPromise[_0x7d21('0x69')](_['filter'](_0x4f35f6,{'online':0x1}),function(_0x42e24a){return db[_0x7d21('0x6d')][_0x7d21('0x6e')]({'membername':_0x42e24a[_0x7d21('0x2b')],'UserId':_0x42e24a['id'],'queue_name':_0xabfe44[_0x7d21('0x2b')],'VoiceQueueId':_0xabfe44['id'],'interface':_[_0x7d21('0x6f')](_0x42e24a['interface'])?util[_0x7d21('0x70')](_0x7d21('0x71'),_0x42e24a[_0x7d21('0x2b')]):_0x42e24a[_0x7d21('0x72')],'paused':_0x42e24a[_0x7d21('0x6c')]||![],'penalty':0x0});});});}});});})[_0x7d21('0x29')](function(){return _0x23b37b;});})[_0x7d21('0x29')](function(){return _0x23b37b;});}})[_0x7d21('0x29')](function(_0x197844){if(_0x197844){return _0x197844['addAgents'](_0x22bd76['body']['ids'],_[_0x7d21('0x73')](_0x22bd76['body'],[_0x7d21('0x5e'),'id'])||{})[_0x7d21('0x74')](function(_0x3bef95){for(var _0x1d74d1=0x0;_0x1d74d1<_0x22bd76[_0x7d21('0x4a')]['ids'][_0x7d21('0x47')];_0x1d74d1+=0x1){socket[_0x7d21('0x75')](_0x7d21('0x76'),{'UserId':_0x22bd76[_0x7d21('0x4a')]['ids'][_0x1d74d1],'TeamId':_0x22bd76[_0x7d21('0x53')]['id']});}return _0x3bef95;});}})[_0x7d21('0x29')](respondWithResult(_0x50d4ee,null))[_0x7d21('0x44')](handleError(_0x50d4ee,null));};exports[_0x7d21('0x77')]=function(_0x3cd712,_0x35a2d3,_0x4fa47b){return db[_0x7d21('0x2e')][_0x7d21('0x48')]({'where':{'id':_0x3cd712[_0x7d21('0x53')]['id']}})['then'](handleEntityNotFound(_0x35a2d3,null))[_0x7d21('0x29')](function(_0x24254d){if(_0x24254d){return BPromise['each']([_0x7d21('0x78'),_0x7d21('0x79'),_0x7d21('0x7a'),'sms','fax','openchannel',_0x7d21('0x7b')],function(_0xbbfd1b){return _0x24254d[_0x7d21('0x4c')+_[_0x7d21('0x58')](_0xbbfd1b)+_0x7d21('0x62')]({'attributes':['id','name']})[_0x7d21('0x29')](function(_0x335180){return BPromise['each'](_0x335180,function(_0x4ca526){return _0x4ca526[_0x7d21('0x77')](_0x3cd712[_0x7d21('0x33')][_0x7d21('0x5e')])[_0x7d21('0x29')](function(){if(_0xbbfd1b===_0x7d21('0x78')){return db[_0x7d21('0x6d')][_0x7d21('0x28')]({'where':{'VoiceQueueId':_0x4ca526['id'],'UserId':_0x3cd712[_0x7d21('0x33')]['ids']}});}});});})[_0x7d21('0x29')](function(){return _0x24254d;});})[_0x7d21('0x29')](function(){return _0x24254d;});}})[_0x7d21('0x29')](function(_0x2ddfcb){if(_0x2ddfcb){return _0x2ddfcb[_0x7d21('0x77')](_0x3cd712[_0x7d21('0x33')][_0x7d21('0x5e')])[_0x7d21('0x29')](function(){if(_['isArray'](_0x3cd712[_0x7d21('0x33')]['ids'])){for(var _0x38616d=0x0;_0x38616d<_0x3cd712[_0x7d21('0x33')][_0x7d21('0x5e')]['length'];_0x38616d+=0x1){socket[_0x7d21('0x75')](_0x7d21('0x7c'),{'UserId':Number(_0x3cd712[_0x7d21('0x33')][_0x7d21('0x5e')][_0x38616d]),'TeamId':Number(_0x3cd712['params']['id'])});}}else{socket[_0x7d21('0x75')](_0x7d21('0x7c'),{'UserId':Number(_0x3cd712[_0x7d21('0x33')]['ids']),'TeamId':Number(_0x3cd712['params']['id'])});}});}})['then'](respondWithStatusCode(_0x35a2d3,null))[_0x7d21('0x44')](handleError(_0x35a2d3,null));};exports['getAgents']=function(_0xe38bb8,_0x109389,_0x251246){var _0x250a6e={};var _0x2e8e6d={};var _0x2dd217;var _0x5beeb8;return db[_0x7d21('0x2e')][_0x7d21('0x55')]({'where':{'id':_0xe38bb8[_0x7d21('0x53')]['id']}})[_0x7d21('0x29')](handleEntityNotFound(_0x109389,null))[_0x7d21('0x29')](function(_0x56105c){if(_0x56105c){_0x2dd217=_0x56105c;_0x2e8e6d['model']=_['keys'](db['User']['rawAttributes']);_0x2e8e6d[_0x7d21('0x33')]=_[_0x7d21('0x34')](_0xe38bb8[_0x7d21('0x33')]);_0x2e8e6d['filters']=_['intersection'](_0x2e8e6d[_0x7d21('0x32')],_0x2e8e6d['query']);_0x250a6e['attributes']=_[_0x7d21('0x37')](_0x2e8e6d[_0x7d21('0x32')],qs['fields'](_0xe38bb8['query'][_0x7d21('0x38')]));_0x250a6e[_0x7d21('0x36')]=_0x250a6e[_0x7d21('0x36')][_0x7d21('0x47')]?_0x250a6e['attributes']:_0x2e8e6d['model'];_0x250a6e[_0x7d21('0x3a')]=qs[_0x7d21('0x3b')](_0xe38bb8[_0x7d21('0x33')][_0x7d21('0x3b')]);_0x250a6e['where']=qs[_0x7d21('0x35')](_[_0x7d21('0x3d')](_0xe38bb8['query'],_0x2e8e6d['filters']));if(_0xe38bb8['query'][_0x7d21('0x3e')]){_0x250a6e[_0x7d21('0x3c')]=_[_0x7d21('0x3f')](_0x250a6e['where'],{'$or':_['map'](_0x250a6e[_0x7d21('0x36')],function(_0xbdcdd7){var _0x51cc3a={};_0x51cc3a[_0xbdcdd7]={'$like':'%'+_0xe38bb8[_0x7d21('0x33')]['filter']+'%'};return _0x51cc3a;})});}_0x250a6e=_[_0x7d21('0x3f')]({},_0x250a6e,_0xe38bb8[_0x7d21('0x5a')]);return _0x2dd217[_0x7d21('0x7d')](_0x250a6e);}})[_0x7d21('0x29')](function(_0x48f722){if(_0x48f722){_0x5beeb8=_0x48f722[_0x7d21('0x47')];if(!_0xe38bb8[_0x7d21('0x33')]['hasOwnProperty'](_0x7d21('0x7e'))){_0x250a6e[_0x7d21('0x21')]=qs['limit'](_0xe38bb8[_0x7d21('0x33')]['limit']);_0x250a6e[_0x7d21('0x20')]=qs[_0x7d21('0x20')](_0xe38bb8[_0x7d21('0x33')][_0x7d21('0x20')]);}return _0x2dd217[_0x7d21('0x7d')](_0x250a6e);}})[_0x7d21('0x29')](function(_0x1c80c6){if(_0x1c80c6){return _0x1c80c6?{'count':_0x5beeb8,'rows':_0x1c80c6}:null;}})[_0x7d21('0x29')](respondWithResult(_0x109389,null))[_0x7d21('0x44')](handleError(_0x109389,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 165a605..421eee0 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 _0x87bf=['save','remove','emit','hook','exports','../../mysqldb','Team'];(function(_0x4fdcc0,_0x560a01){var _0xc0ce94=function(_0x36ea12){while(--_0x36ea12){_0x4fdcc0['push'](_0x4fdcc0['shift']());}};_0xc0ce94(++_0x560a01);}(_0x87bf,0x194));var _0xf87b=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0x87bf[_0x44a64f];return _0x52024b;};'use strict';var EventEmitter=require('events');var Team=require(_0xf87b('0x0'))['db'][_0xf87b('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf87b('0x2'),'afterUpdate':'update','afterDestroy':_0xf87b('0x3')};function emitEvent(_0x15b01c){return function(_0x11411f,_0x48c7db,_0x15ca03){TeamEvents[_0xf87b('0x4')](_0x15b01c+':'+_0x11411f['id'],_0x11411f);TeamEvents[_0xf87b('0x4')](_0x15b01c,_0x11411f);_0x15ca03(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xf87b('0x5')](e,emitEvent(event));}}module[_0xf87b('0x6')]=TeamEvents; \ No newline at end of file +var _0x6bd0=['emit','hasOwnProperty','exports','events','Team','setMaxListeners','update'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x6bd0,0x192));var _0x06bd=function(_0x32e197,_0x451ab2){_0x32e197=_0x32e197-0x0;var _0x273251=_0x6bd0[_0x32e197];return _0x273251;};'use strict';var EventEmitter=require(_0x06bd('0x0'));var Team=require('../../mysqldb')['db'][_0x06bd('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x06bd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x06bd('0x3'),'afterDestroy':'remove'};function emitEvent(_0x49d588){return function(_0x37eeb1,_0x2e12d0,_0x30f819){TeamEvents[_0x06bd('0x4')](_0x49d588+':'+_0x37eeb1['id'],_0x37eeb1);TeamEvents[_0x06bd('0x4')](_0x49d588,_0x37eeb1);_0x30f819(null);};}for(var e in events){if(events[_0x06bd('0x5')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x06bd('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 626d500..f1a9104 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 _0x23cf=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','exports','define','Team','teams'];(function(_0x5e2118,_0x2d6c5e){var _0x10dee5=function(_0x255d11){while(--_0x255d11){_0x5e2118['push'](_0x5e2118['shift']());}};_0x10dee5(++_0x2d6c5e);}(_0x23cf,0xf2));var _0xf23c=function(_0x182acf,_0x727cda){_0x182acf=_0x182acf-0x0;var _0x278535=_0x23cf[_0x182acf];return _0x278535;};'use strict';var _=require(_0xf23c('0x0'));var util=require(_0xf23c('0x1'));var logger=require(_0xf23c('0x2'))('api');var moment=require(_0xf23c('0x3'));var BPromise=require(_0xf23c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf23c('0x5'));var rimraf=require(_0xf23c('0x6'));var config=require('../../config/environment');var attributes=require('./team.attributes');module[_0xf23c('0x7')]=function(_0x5e58c6,_0x33864c){return _0x5e58c6[_0xf23c('0x8')](_0xf23c('0x9'),attributes,{'tableName':_0xf23c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb852=['exports','define','Team','lodash','util','../../config/logger','api','moment','request-promise','./team.attributes'];(function(_0xf536b,_0xa2454d){var _0x5872ce=function(_0x4beeb8){while(--_0x4beeb8){_0xf536b['push'](_0xf536b['shift']());}};_0x5872ce(++_0xa2454d);}(_0xb852,0x1b1));var _0x2b85=function(_0x31d127,_0x3a12cd){_0x31d127=_0x31d127-0x0;var _0x441c8a=_0xb852[_0x31d127];return _0x441c8a;};'use strict';var _=require(_0x2b85('0x0'));var util=require(_0x2b85('0x1'));var logger=require(_0x2b85('0x2'))(_0x2b85('0x3'));var moment=require(_0x2b85('0x4'));var BPromise=require('bluebird');var rp=require(_0x2b85('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2b85('0x6'));module[_0x2b85('0x7')]=function(_0x190bab,_0x3bd12d){return _0x190bab[_0x2b85('0x8')](_0x2b85('0x9'),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 22140f0..4a829e7 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 _0x0704=['redis','localhost','socket.io-emitter','./team.socket','register','then','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','../../config/logger','rpc','../../config/environment','jayson/promise','defaults'];(function(_0x1add6e,_0x2f858d){var _0x48258b=function(_0x425cac){while(--_0x425cac){_0x1add6e['push'](_0x1add6e['shift']());}};_0x48258b(++_0x2f858d);}(_0x0704,0x152));var _0x4070=function(_0x101751,_0x295b14){_0x101751=_0x101751-0x0;var _0x22d38b=_0x0704[_0x101751];return _0x22d38b;};'use strict';var _=require(_0x4070('0x0'));var util=require('util');var moment=require(_0x4070('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4070('0x2'))(_0x4070('0x3'));var config=require(_0x4070('0x4'));var jayson=require(_0x4070('0x5'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x4070('0x6')](config[_0x4070('0x7')],{'host':_0x4070('0x8'),'port':0x18eb});var socket=require(_0x4070('0x9'))(new Redis(config['redis']));require(_0x4070('0xa'))[_0x4070('0xb')](socket);function respondWithRpcPromise(_0x28d4b5,_0x2eb665,_0x244d7f){return new BPromise(function(_0x59ed20,_0x3bc5b7){return client['request'](_0x28d4b5,_0x244d7f)[_0x4070('0xc')](function(_0x583eca){logger[_0x4070('0xd')](_0x4070('0xe'),_0x2eb665,'request\x20sent');logger[_0x4070('0xf')](_0x4070('0x10'),_0x2eb665,_0x4070('0x11'),JSON[_0x4070('0x12')](_0x583eca));if(_0x583eca[_0x4070('0x13')]){if(_0x583eca[_0x4070('0x13')][_0x4070('0x14')]===0x1f4){logger['error'](_0x4070('0xe'),_0x2eb665,_0x583eca[_0x4070('0x13')][_0x4070('0x15')]);return _0x3bc5b7(_0x583eca[_0x4070('0x13')]['message']);}logger['error']('Team,\x20%s,\x20%s',_0x2eb665,_0x583eca[_0x4070('0x13')]['message']);return _0x59ed20(_0x583eca['error']['message']);}else{logger[_0x4070('0xd')](_0x4070('0xe'),_0x2eb665,_0x4070('0x11'));_0x59ed20(_0x583eca[_0x4070('0x16')][_0x4070('0x15')]);}})['catch'](function(_0x475bdb){logger['error'](_0x4070('0xe'),_0x2eb665,_0x475bdb);_0x3bc5b7(_0x475bdb);});});} \ No newline at end of file +var _0x5ed1=['Team,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent'];(function(_0x5333ba,_0x22e1bb){var _0x20f9dc=function(_0x1956af){while(--_0x1956af){_0x5333ba['push'](_0x5333ba['shift']());}};_0x20f9dc(++_0x22e1bb);}(_0x5ed1,0x156));var _0x15ed=function(_0x870b62,_0x2143f9){_0x870b62=_0x870b62-0x0;var _0x2dcb39=_0x5ed1[_0x870b62];return _0x2dcb39;};'use strict';var _=require(_0x15ed('0x0'));var util=require(_0x15ed('0x1'));var moment=require(_0x15ed('0x2'));var BPromise=require(_0x15ed('0x3'));var rs=require(_0x15ed('0x4'));var fs=require('fs');var Redis=require(_0x15ed('0x5'));var db=require(_0x15ed('0x6'))['db'];var utils=require(_0x15ed('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x15ed('0x8'));var jayson=require(_0x15ed('0x9'));var client=jayson[_0x15ed('0xa')]['http']({'port':0x232a});config[_0x15ed('0xb')]=_[_0x15ed('0xc')](config[_0x15ed('0xb')],{'host':_0x15ed('0xd'),'port':0x18eb});var socket=require(_0x15ed('0xe'))(new Redis(config[_0x15ed('0xb')]));require(_0x15ed('0xf'))[_0x15ed('0x10')](socket);function respondWithRpcPromise(_0x2640b0,_0x5eab3f,_0x402e55){return new BPromise(function(_0xefeb6c,_0x54e088){return client[_0x15ed('0x11')](_0x2640b0,_0x402e55)[_0x15ed('0x12')](function(_0xc04a54){logger[_0x15ed('0x13')](_0x15ed('0x14'),_0x5eab3f,_0x15ed('0x15'));logger['debug'](_0x15ed('0x16'),_0x5eab3f,_0x15ed('0x15'),JSON['stringify'](_0xc04a54));if(_0xc04a54[_0x15ed('0x17')]){if(_0xc04a54[_0x15ed('0x17')]['code']===0x1f4){logger[_0x15ed('0x17')](_0x15ed('0x14'),_0x5eab3f,_0xc04a54[_0x15ed('0x17')][_0x15ed('0x18')]);return _0x54e088(_0xc04a54[_0x15ed('0x17')]['message']);}logger['error'](_0x15ed('0x14'),_0x5eab3f,_0xc04a54['error']['message']);return _0xefeb6c(_0xc04a54['error']['message']);}else{logger[_0x15ed('0x13')](_0x15ed('0x14'),_0x5eab3f,'request\x20sent');_0xefeb6c(_0xc04a54['result'][_0x15ed('0x18')]);}})[_0x15ed('0x19')](function(_0x448eb9){logger[_0x15ed('0x17')](_0x15ed('0x14'),_0x5eab3f,_0x448eb9);_0x54e088(_0x448eb9);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 0eee5dd..9ea9490 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 _0x7a3e=['remove','removeListener','length','team:','./team.events','save'];(function(_0x1428a1,_0x467550){var _0x5e21d7=function(_0x25d3c6){while(--_0x25d3c6){_0x1428a1['push'](_0x1428a1['shift']());}};_0x5e21d7(++_0x467550);}(_0x7a3e,0x18a));var _0xe7a3=function(_0x4a3705,_0x3ad460){_0x4a3705=_0x4a3705-0x0;var _0x16c23b=_0x7a3e[_0x4a3705];return _0x16c23b;};'use strict';var TeamEvents=require(_0xe7a3('0x0'));var events=[_0xe7a3('0x1'),_0xe7a3('0x2'),'update'];function createListener(_0xd95a19,_0x37f29c){return function(_0x49157a){_0x37f29c['emit'](_0xd95a19,_0x49157a);};}function removeListener(_0x9d97ac,_0x4053f3){return function(){TeamEvents[_0xe7a3('0x3')](_0x9d97ac,_0x4053f3);};}exports['register']=function(_0x401117){for(var _0x45b019=0x0,_0x46ecf7=events[_0xe7a3('0x4')];_0x45b019<_0x46ecf7;_0x45b019++){var _0x1a7627=events[_0x45b019];var _0x5524ad=createListener(_0xe7a3('0x5')+_0x1a7627,_0x401117);TeamEvents['on'](_0x1a7627,_0x5524ad);}}; \ No newline at end of file +var _0xa786=['team:','./team.events','save','remove','emit','removeListener','register','length'];(function(_0x2b8077,_0x453634){var _0x308091=function(_0x426df7){while(--_0x426df7){_0x2b8077['push'](_0x2b8077['shift']());}};_0x308091(++_0x453634);}(_0xa786,0x71));var _0x6a78=function(_0x16d96f,_0x56b1cf){_0x16d96f=_0x16d96f-0x0;var _0xf43f49=_0xa786[_0x16d96f];return _0xf43f49;};'use strict';var TeamEvents=require(_0x6a78('0x0'));var events=[_0x6a78('0x1'),_0x6a78('0x2'),'update'];function createListener(_0x30bd42,_0x49c803){return function(_0x5edaa9){_0x49c803[_0x6a78('0x3')](_0x30bd42,_0x5edaa9);};}function removeListener(_0x2b0fed,_0x3b3608){return function(){TeamEvents[_0x6a78('0x4')](_0x2b0fed,_0x3b3608);};}exports[_0x6a78('0x5')]=function(_0x112e35){for(var _0x386861=0x0,_0x4dd11b=events[_0x6a78('0x6')];_0x386861<_0x4dd11b;_0x386861++){var _0x103f4a=events[_0x386861];var _0x23ebbd=createListener(_0x6a78('0x7')+_0x103f4a,_0x112e35);TeamEvents['on'](_0x103f4a,_0x23ebbd);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 962902a..f60a49e 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 _0x0580=['get','/:id','show','post','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','isAuthenticated','index'];(function(_0x3c7f2a,_0x1ace46){var _0x1e8fdf=function(_0x1a2bf5){while(--_0x1a2bf5){_0x3c7f2a['push'](_0x3c7f2a['shift']());}};_0x1e8fdf(++_0x1ace46);}(_0x0580,0x1cf));var _0x0058=function(_0x201b9b,_0x558203){_0x201b9b=_0x201b9b-0x0;var _0x5f3730=_0x0580[_0x201b9b];return _0x5f3730;};'use strict';var multer=require(_0x0058('0x0'));var util=require(_0x0058('0x1'));var path=require(_0x0058('0x2'));var timeout=require(_0x0058('0x3'));var express=require(_0x0058('0x4'));var router=express[_0x0058('0x5')]();var auth=require(_0x0058('0x6'));var interaction=require(_0x0058('0x7'));var config=require(_0x0058('0x8'));var controller=require(_0x0058('0x9'));router['get']('/',auth[_0x0058('0xa')](),controller[_0x0058('0xb')]);router[_0x0058('0xc')](_0x0058('0xd'),auth[_0x0058('0xa')](),controller[_0x0058('0xe')]);router[_0x0058('0xf')]('/',auth[_0x0058('0xa')](),controller['create']);router['put'](_0x0058('0xd'),auth[_0x0058('0xa')](),controller[_0x0058('0x10')]);router[_0x0058('0x11')]('/:id',auth[_0x0058('0xa')](),controller[_0x0058('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0d09=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./template.controller','get','isAuthenticated','index','show','create','put','/:id','delete'];(function(_0x1375bb,_0x592517){var _0x55b5a8=function(_0x5c47d8){while(--_0x5c47d8){_0x1375bb['push'](_0x1375bb['shift']());}};_0x55b5a8(++_0x592517);}(_0x0d09,0x10c));var _0x90d0=function(_0x113a6c,_0x10df30){_0x113a6c=_0x113a6c-0x0;var _0x1ac632=_0x0d09[_0x113a6c];return _0x1ac632;};'use strict';var multer=require(_0x90d0('0x0'));var util=require(_0x90d0('0x1'));var path=require(_0x90d0('0x2'));var timeout=require(_0x90d0('0x3'));var express=require(_0x90d0('0x4'));var router=express[_0x90d0('0x5')]();var auth=require(_0x90d0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x90d0('0x7'));var controller=require(_0x90d0('0x8'));router[_0x90d0('0x9')]('/',auth[_0x90d0('0xa')](),controller[_0x90d0('0xb')]);router[_0x90d0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x90d0('0xc')]);router['post']('/',auth[_0x90d0('0xa')](),controller[_0x90d0('0xd')]);router[_0x90d0('0xe')](_0x90d0('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x90d0('0x10')]('/:id',auth[_0x90d0('0xa')](),controller[_0x90d0('0x11')]);module[_0x90d0('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index b0a66a7..2b550c4 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 _0xc55f=['STRING','TEXT','sequelize','exports'];(function(_0x44a2f1,_0x40c54a){var _0x34d15b=function(_0x3fe0f8){while(--_0x3fe0f8){_0x44a2f1['push'](_0x44a2f1['shift']());}};_0x34d15b(++_0x40c54a);}(_0xc55f,0x8a));var _0xfc55=function(_0x277af0,_0x1af851){_0x277af0=_0x277af0-0x0;var _0x15a5a7=_0xc55f[_0x277af0];return _0x15a5a7;};'use strict';var Sequelize=require(_0xfc55('0x0'));module[_0xfc55('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfc55('0x2')]},'html':{'type':Sequelize[_0xfc55('0x3')]}}; \ No newline at end of file +var _0xe803=['sequelize','exports','STRING','TEXT'];(function(_0x2b598d,_0x12e7e7){var _0x169b15=function(_0xad6ca6){while(--_0xad6ca6){_0x2b598d['push'](_0x2b598d['shift']());}};_0x169b15(++_0x12e7e7);}(_0xe803,0x1b0));var _0x3e80=function(_0x2eb586,_0x4b08cb){_0x2eb586=_0x2eb586-0x0;var _0x25c18d=_0xe803[_0x2eb586];return _0x25c18d;};'use strict';var Sequelize=require(_0x3e80('0x0'));module[_0x3e80('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3e80('0x2')]},'html':{'type':Sequelize[_0x3e80('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 71b95c7..661d074 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 _0x5345=['nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','show','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','stack','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty'];(function(_0x51c440,_0x3b6802){var _0x67a2d6=function(_0x3d15ab){while(--_0x3d15ab){_0x51c440['push'](_0x51c440['shift']());}};_0x67a2d6(++_0x3b6802);}(_0x5345,0x1b3));var _0x5534=function(_0x565801,_0x11c9d8){_0x565801=_0x565801-0x0;var _0x48e721=_0x5345[_0x565801];return _0x48e721;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5534('0x0'));var rimraf=require(_0x5534('0x1'));var zipdir=require(_0x5534('0x2'));var jsonpatch=require(_0x5534('0x3'));var rp=require(_0x5534('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5534('0x5'));var path=require(_0x5534('0x6'));var sox=require(_0x5534('0x7'));var csv=require(_0x5534('0x8'));var ejs=require(_0x5534('0x9'));var fs=require('fs');var _=require(_0x5534('0xa'));var squel=require(_0x5534('0xb'));var crypto=require('crypto');var jsforce=require(_0x5534('0xc'));var deskjs=require(_0x5534('0xd'));var toCsv=require(_0x5534('0x8'));var querystring=require(_0x5534('0xe'));var Papa=require(_0x5534('0xf'));var Redis=require(_0x5534('0x10'));var authService=require(_0x5534('0x11'));var qs=require(_0x5534('0x12'));var as=require(_0x5534('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5534('0x14'));var utils=require(_0x5534('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1926f0,_0x3d4bec){_0x3d4bec=_0x3d4bec||0xcc;return function(_0x521657){if(_0x521657){return _0x1926f0[_0x5534('0x16')](_0x3d4bec);}return _0x1926f0[_0x5534('0x17')](_0x3d4bec)[_0x5534('0x18')]();};}function respondWithResult(_0x3b4e29,_0x5bcc7){_0x5bcc7=_0x5bcc7||0xc8;return function(_0x6e34dd){if(_0x6e34dd){return _0x3b4e29[_0x5534('0x17')](_0x5bcc7)[_0x5534('0x19')](_0x6e34dd);}};}function respondWithFilteredResult(_0x348421,_0x24d63b){return function(_0x54b768){if(_0x54b768){var _0x2e5258=_0x54b768[_0x5534('0x1a')],_0x34e7d5=_0x24d63b[_0x5534('0x1b')],_0x2a6ffe=_0x24d63b[_0x5534('0x1b')]+_0x24d63b[_0x5534('0x1c')],_0xbb8e9f;if(_0x2a6ffe>=_0x2e5258){_0x2a6ffe=_0x2e5258;_0xbb8e9f=0xc8;}else{_0xbb8e9f=0xce;}_0x348421[_0x5534('0x17')](_0xbb8e9f);return _0x348421[_0x5534('0x1d')](_0x5534('0x1e'),_0x34e7d5+'-'+_0x2a6ffe+'/'+_0x2e5258)[_0x5534('0x19')](_0x54b768);}return null;};}function patchUpdates(_0x13b6d1){return function(_0xb572f){try{jsonpatch[_0x5534('0x1f')](_0xb572f,_0x13b6d1,!![]);}catch(_0x5a7138){return BPromise[_0x5534('0x20')](_0x5a7138);}return _0xb572f[_0x5534('0x21')]();};}function saveUpdates(_0x4e29df,_0x1b712e){return function(_0x341157){if(_0x341157){return _0x341157[_0x5534('0x22')](_0x4e29df)[_0x5534('0x23')](function(_0x3201b8){return _0x3201b8;});}return null;};}function removeEntity(_0x1f7899,_0x1ec0bb){return function(_0x4d1826){if(_0x4d1826){return _0x4d1826[_0x5534('0x24')]()[_0x5534('0x23')](function(){var _0x10e8b4=_0x4d1826[_0x5534('0x25')]({'plain':!![]});var _0x11bb2d=_0x5534('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x11bb2d,'resourceId':_0x10e8b4['id']}})['then'](function(){return _0x4d1826;});})[_0x5534('0x23')](function(){_0x1f7899['status'](0xcc)[_0x5534('0x18')]();});}};}function handleEntityNotFound(_0x381251,_0x21e36e){return function(_0x4bd972){if(!_0x4bd972){_0x381251[_0x5534('0x16')](0x194);}return _0x4bd972;};}function handleError(_0x496b1b,_0x52a28a){_0x52a28a=_0x52a28a||0x1f4;return function(_0xf13074){logger['error'](_0xf13074[_0x5534('0x27')]);if(_0xf13074['name']){delete _0xf13074[_0x5534('0x28')];}_0x496b1b['status'](_0x52a28a)[_0x5534('0x29')](_0xf13074);};}exports[_0x5534('0x2a')]=function(_0x2aedba,_0x4a597a){var _0x4c7738={},_0x4a2c6b={},_0x42a1c5={'count':0x0,'rows':[]};var _0x106e4b=_[_0x5534('0x2b')](db[_0x5534('0x2c')][_0x5534('0x2d')],function(_0x2494be){return{'name':_0x2494be[_0x5534('0x2e')],'type':_0x2494be[_0x5534('0x2f')][_0x5534('0x30')]};});_0x4a2c6b[_0x5534('0x31')]=_[_0x5534('0x2b')](_0x106e4b,_0x5534('0x28'));_0x4a2c6b['query']=_[_0x5534('0x32')](_0x2aedba['query']);_0x4a2c6b[_0x5534('0x33')]=_[_0x5534('0x34')](_0x4a2c6b['model'],_0x4a2c6b[_0x5534('0x35')]);_0x4c7738[_0x5534('0x36')]=_[_0x5534('0x34')](_0x4a2c6b['model'],qs['fields'](_0x2aedba['query'][_0x5534('0x37')]));_0x4c7738[_0x5534('0x36')]=_0x4c7738[_0x5534('0x36')]['length']?_0x4c7738[_0x5534('0x36')]:_0x4a2c6b['model'];if(!_0x2aedba[_0x5534('0x35')][_0x5534('0x38')](_0x5534('0x39'))){_0x4c7738[_0x5534('0x1c')]=qs[_0x5534('0x1c')](_0x2aedba['query'][_0x5534('0x1c')]);_0x4c7738[_0x5534('0x1b')]=qs[_0x5534('0x1b')](_0x2aedba[_0x5534('0x35')][_0x5534('0x1b')]);}_0x4c7738[_0x5534('0x3a')]=qs[_0x5534('0x3b')](_0x2aedba[_0x5534('0x35')][_0x5534('0x3b')]);_0x4c7738['where']=qs[_0x5534('0x33')](_[_0x5534('0x3c')](_0x2aedba[_0x5534('0x35')],_0x4a2c6b[_0x5534('0x33')]),_0x106e4b);if(_0x2aedba['query'][_0x5534('0x3d')]){_0x4c7738[_0x5534('0x3e')]=_[_0x5534('0x3f')](_0x4c7738[_0x5534('0x3e')],{'$or':_['map'](_0x106e4b,function(_0x56cfbe){if(_0x56cfbe[_0x5534('0x2f')]!=='VIRTUAL'){var _0x464443={};_0x464443[_0x56cfbe['name']]={'$like':'%'+_0x2aedba[_0x5534('0x35')][_0x5534('0x3d')]+'%'};return _0x464443;}})});}_0x4c7738=_[_0x5534('0x3f')]({},_0x4c7738,_0x2aedba[_0x5534('0x40')]);var _0xdb1214={'where':_0x4c7738[_0x5534('0x3e')]};return db['Template'][_0x5534('0x1a')](_0xdb1214)[_0x5534('0x23')](function(_0x4b0a75){_0x42a1c5[_0x5534('0x1a')]=_0x4b0a75;if(_0x2aedba[_0x5534('0x35')][_0x5534('0x41')]){_0x4c7738[_0x5534('0x42')]=[{'all':!![]}];}return db['Template'][_0x5534('0x43')](_0x4c7738);})[_0x5534('0x23')](function(_0x41ab87){_0x42a1c5['rows']=_0x41ab87;return _0x42a1c5;})[_0x5534('0x23')](respondWithFilteredResult(_0x4a597a,_0x4c7738))['catch'](handleError(_0x4a597a,null));};exports[_0x5534('0x44')]=function(_0x10f65d,_0x7a0057){var _0x1bf8ad={'raw':!![],'where':{'id':_0x10f65d['params']['id']}},_0x588460={};_0x588460['model']=_[_0x5534('0x32')](db[_0x5534('0x2c')][_0x5534('0x2d')]);_0x588460[_0x5534('0x35')]=_[_0x5534('0x32')](_0x10f65d[_0x5534('0x35')]);_0x588460[_0x5534('0x33')]=_['intersection'](_0x588460[_0x5534('0x31')],_0x588460[_0x5534('0x35')]);_0x1bf8ad[_0x5534('0x36')]=_['intersection'](_0x588460[_0x5534('0x31')],qs[_0x5534('0x37')](_0x10f65d['query'][_0x5534('0x37')]));_0x1bf8ad[_0x5534('0x36')]=_0x1bf8ad[_0x5534('0x36')][_0x5534('0x45')]?_0x1bf8ad['attributes']:_0x588460['model'];if(_0x10f65d[_0x5534('0x35')]['includeAll']){_0x1bf8ad[_0x5534('0x42')]=[{'all':!![]}];}_0x1bf8ad=_[_0x5534('0x3f')]({},_0x1bf8ad,_0x10f65d[_0x5534('0x40')]);return db[_0x5534('0x2c')][_0x5534('0x46')](_0x1bf8ad)[_0x5534('0x23')](handleEntityNotFound(_0x7a0057,null))['then'](respondWithResult(_0x7a0057,null))[_0x5534('0x47')](handleError(_0x7a0057,null));};exports[_0x5534('0x48')]=function(_0x5272fe,_0xa22009){return db[_0x5534('0x2c')][_0x5534('0x48')](_0x5272fe[_0x5534('0x49')],{})[_0x5534('0x23')](function(_0x46415c){var _0x3f6202=_0x5272fe[_0x5534('0x4a')]['get']({'plain':!![]});if(!_0x3f6202)throw new Error(_0x5534('0x4b'));if(_0x3f6202[_0x5534('0x4c')]===_0x5534('0x4a')){var _0x1ee53d=_0x46415c[_0x5534('0x25')]({'plain':!![]});var _0x919f5=_0x5534('0x26');return db['UserProfileSection'][_0x5534('0x46')]({'where':{'name':_0x919f5,'userProfileId':_0x3f6202[_0x5534('0x4d')]},'raw':!![]})['then'](function(_0x5b8e0f){if(_0x5b8e0f&&_0x5b8e0f[_0x5534('0x4e')]===0x0){return db[_0x5534('0x4f')][_0x5534('0x48')]({'name':_0x1ee53d[_0x5534('0x28')],'resourceId':_0x1ee53d['id'],'type':_0x5b8e0f['name'],'sectionId':_0x5b8e0f['id']},{})['then'](function(){return _0x46415c;});}else{return _0x46415c;}})[_0x5534('0x47')](function(_0x242035){logger[_0x5534('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x242035);throw _0x242035;});}return _0x46415c;})[_0x5534('0x23')](respondWithResult(_0xa22009,0xc9))[_0x5534('0x47')](handleError(_0xa22009,null));};exports[_0x5534('0x22')]=function(_0x656ea4,_0x23d588){if(_0x656ea4['body']['id']){delete _0x656ea4[_0x5534('0x49')]['id'];}return db[_0x5534('0x2c')][_0x5534('0x46')]({'where':{'id':_0x656ea4[_0x5534('0x51')]['id']}})[_0x5534('0x23')](handleEntityNotFound(_0x23d588,null))['then'](saveUpdates(_0x656ea4[_0x5534('0x49')],null))[_0x5534('0x23')](respondWithResult(_0x23d588,null))[_0x5534('0x47')](handleError(_0x23d588,null));};exports['destroy']=function(_0xcd5302,_0x437f71){return db[_0x5534('0x2c')][_0x5534('0x46')]({'where':{'id':_0xcd5302[_0x5534('0x51')]['id']}})[_0x5534('0x23')](handleEntityNotFound(_0x437f71,null))[_0x5534('0x23')](removeEntity(_0x437f71,null))[_0x5534('0x47')](handleError(_0x437f71,null));}; \ No newline at end of file +var _0x3755=['count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','get','Templates','UserProfileResource','sendStatus','error','name','send','map','Template','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','findAll','show','params','keys','includeAll','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','status','end','json'];(function(_0xea9f45,_0x55708e){var _0x17864b=function(_0x29bf54){while(--_0x29bf54){_0xea9f45['push'](_0xea9f45['shift']());}};_0x17864b(++_0x55708e);}(_0x3755,0x156));var _0x5375=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x3755[_0x432682];return _0x463d05;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x5375('0x0'));var zipdir=require(_0x5375('0x1'));var jsonpatch=require(_0x5375('0x2'));var rp=require(_0x5375('0x3'));var moment=require(_0x5375('0x4'));var BPromise=require(_0x5375('0x5'));var Mustache=require('mustache');var util=require(_0x5375('0x6'));var path=require('path');var sox=require(_0x5375('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5375('0x8'));var crypto=require(_0x5375('0x9'));var jsforce=require(_0x5375('0xa'));var deskjs=require(_0x5375('0xb'));var toCsv=require(_0x5375('0xc'));var querystring=require(_0x5375('0xd'));var Papa=require(_0x5375('0xe'));var Redis=require(_0x5375('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5375('0x10'));var hardwareService=require(_0x5375('0x11'));var logger=require(_0x5375('0x12'))(_0x5375('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xec69c1,_0x171491){_0x171491=_0x171491||0xcc;return function(_0x140807){if(_0x140807){return _0xec69c1['sendStatus'](_0x171491);}return _0xec69c1[_0x5375('0x14')](_0x171491)[_0x5375('0x15')]();};}function respondWithResult(_0x2de352,_0x5d315a){_0x5d315a=_0x5d315a||0xc8;return function(_0x564837){if(_0x564837){return _0x2de352[_0x5375('0x14')](_0x5d315a)[_0x5375('0x16')](_0x564837);}};}function respondWithFilteredResult(_0x1c5aa9,_0x5318d2){return function(_0x3672e8){if(_0x3672e8){var _0x2d68df=_0x3672e8[_0x5375('0x17')],_0x109448=_0x5318d2[_0x5375('0x18')],_0x36f6b4=_0x5318d2['offset']+_0x5318d2[_0x5375('0x19')],_0xa290c9;if(_0x36f6b4>=_0x2d68df){_0x36f6b4=_0x2d68df;_0xa290c9=0xc8;}else{_0xa290c9=0xce;}_0x1c5aa9[_0x5375('0x14')](_0xa290c9);return _0x1c5aa9[_0x5375('0x1a')](_0x5375('0x1b'),_0x109448+'-'+_0x36f6b4+'/'+_0x2d68df)[_0x5375('0x16')](_0x3672e8);}return null;};}function patchUpdates(_0x264bbb){return function(_0x4cd428){try{jsonpatch[_0x5375('0x1c')](_0x4cd428,_0x264bbb,!![]);}catch(_0x418778){return BPromise[_0x5375('0x1d')](_0x418778);}return _0x4cd428[_0x5375('0x1e')]();};}function saveUpdates(_0x1dc864,_0xd7be68){return function(_0x54f720){if(_0x54f720){return _0x54f720['update'](_0x1dc864)['then'](function(_0x198c3e){return _0x198c3e;});}return null;};}function removeEntity(_0x26f99d,_0x1b7cea){return function(_0xe2921f){if(_0xe2921f){return _0xe2921f[_0x5375('0x1f')]()[_0x5375('0x20')](function(){var _0x17f929=_0xe2921f[_0x5375('0x21')]({'plain':!![]});var _0x181330=_0x5375('0x22');return db[_0x5375('0x23')][_0x5375('0x1f')]({'where':{'type':_0x181330,'resourceId':_0x17f929['id']}})[_0x5375('0x20')](function(){return _0xe2921f;});})['then'](function(){_0x26f99d[_0x5375('0x14')](0xcc)[_0x5375('0x15')]();});}};}function handleEntityNotFound(_0x549269,_0x445d44){return function(_0xa9085b){if(!_0xa9085b){_0x549269[_0x5375('0x24')](0x194);}return _0xa9085b;};}function handleError(_0x31b2d2,_0x503aae){_0x503aae=_0x503aae||0x1f4;return function(_0x531d0c){logger[_0x5375('0x25')](_0x531d0c['stack']);if(_0x531d0c['name']){delete _0x531d0c[_0x5375('0x26')];}_0x31b2d2[_0x5375('0x14')](_0x503aae)[_0x5375('0x27')](_0x531d0c);};}exports['index']=function(_0x1546e4,_0x54c2ff){var _0x54c27d={},_0x51ec96={},_0x14e500={'count':0x0,'rows':[]};var _0xb94b9e=_[_0x5375('0x28')](db[_0x5375('0x29')][_0x5375('0x2a')],function(_0x5ef748){return{'name':_0x5ef748[_0x5375('0x2b')],'type':_0x5ef748[_0x5375('0x2c')]['key']};});_0x51ec96[_0x5375('0x2d')]=_['map'](_0xb94b9e,_0x5375('0x26'));_0x51ec96[_0x5375('0x2e')]=_['keys'](_0x1546e4[_0x5375('0x2e')]);_0x51ec96[_0x5375('0x2f')]=_['intersection'](_0x51ec96['model'],_0x51ec96[_0x5375('0x2e')]);_0x54c27d[_0x5375('0x30')]=_[_0x5375('0x31')](_0x51ec96['model'],qs[_0x5375('0x32')](_0x1546e4[_0x5375('0x2e')][_0x5375('0x32')]));_0x54c27d[_0x5375('0x30')]=_0x54c27d[_0x5375('0x30')][_0x5375('0x33')]?_0x54c27d[_0x5375('0x30')]:_0x51ec96[_0x5375('0x2d')];if(!_0x1546e4[_0x5375('0x2e')]['hasOwnProperty'](_0x5375('0x34'))){_0x54c27d['limit']=qs[_0x5375('0x19')](_0x1546e4['query']['limit']);_0x54c27d[_0x5375('0x18')]=qs[_0x5375('0x18')](_0x1546e4['query'][_0x5375('0x18')]);}_0x54c27d[_0x5375('0x35')]=qs[_0x5375('0x36')](_0x1546e4[_0x5375('0x2e')][_0x5375('0x36')]);_0x54c27d['where']=qs[_0x5375('0x2f')](_['pick'](_0x1546e4[_0x5375('0x2e')],_0x51ec96[_0x5375('0x2f')]),_0xb94b9e);if(_0x1546e4[_0x5375('0x2e')][_0x5375('0x37')]){_0x54c27d[_0x5375('0x38')]=_[_0x5375('0x39')](_0x54c27d[_0x5375('0x38')],{'$or':_[_0x5375('0x28')](_0xb94b9e,function(_0x1ac3d5){if(_0x1ac3d5['type']!==_0x5375('0x3a')){var _0x3992ed={};_0x3992ed[_0x1ac3d5[_0x5375('0x26')]]={'$like':'%'+_0x1546e4[_0x5375('0x2e')][_0x5375('0x37')]+'%'};return _0x3992ed;}})});}_0x54c27d=_['merge']({},_0x54c27d,_0x1546e4['options']);var _0x5a71d0={'where':_0x54c27d['where']};return db['Template'][_0x5375('0x17')](_0x5a71d0)[_0x5375('0x20')](function(_0x9383b0){_0x14e500[_0x5375('0x17')]=_0x9383b0;if(_0x1546e4['query']['includeAll']){_0x54c27d['include']=[{'all':!![]}];}return db['Template'][_0x5375('0x3b')](_0x54c27d);})['then'](function(_0x11992e){_0x14e500['rows']=_0x11992e;return _0x14e500;})['then'](respondWithFilteredResult(_0x54c2ff,_0x54c27d))['catch'](handleError(_0x54c2ff,null));};exports[_0x5375('0x3c')]=function(_0x564827,_0x4cf7b9){var _0x1f53ef={'raw':!![],'where':{'id':_0x564827[_0x5375('0x3d')]['id']}},_0x299300={};_0x299300[_0x5375('0x2d')]=_['keys'](db[_0x5375('0x29')][_0x5375('0x2a')]);_0x299300[_0x5375('0x2e')]=_[_0x5375('0x3e')](_0x564827[_0x5375('0x2e')]);_0x299300['filters']=_[_0x5375('0x31')](_0x299300[_0x5375('0x2d')],_0x299300[_0x5375('0x2e')]);_0x1f53ef[_0x5375('0x30')]=_['intersection'](_0x299300[_0x5375('0x2d')],qs[_0x5375('0x32')](_0x564827['query'][_0x5375('0x32')]));_0x1f53ef['attributes']=_0x1f53ef[_0x5375('0x30')][_0x5375('0x33')]?_0x1f53ef[_0x5375('0x30')]:_0x299300['model'];if(_0x564827['query'][_0x5375('0x3f')]){_0x1f53ef[_0x5375('0x40')]=[{'all':!![]}];}_0x1f53ef=_[_0x5375('0x39')]({},_0x1f53ef,_0x564827['options']);return db['Template'][_0x5375('0x41')](_0x1f53ef)[_0x5375('0x20')](handleEntityNotFound(_0x4cf7b9,null))[_0x5375('0x20')](respondWithResult(_0x4cf7b9,null))[_0x5375('0x42')](handleError(_0x4cf7b9,null));};exports[_0x5375('0x43')]=function(_0x3bef0c,_0x1914f2){return db[_0x5375('0x29')][_0x5375('0x43')](_0x3bef0c[_0x5375('0x44')],{})[_0x5375('0x20')](function(_0x2c81eb){var _0x1f2530=_0x3bef0c['user'][_0x5375('0x21')]({'plain':!![]});if(!_0x1f2530)throw new Error(_0x5375('0x45'));if(_0x1f2530[_0x5375('0x46')]===_0x5375('0x47')){var _0x4a40b0=_0x2c81eb['get']({'plain':!![]});var _0x52b2df=_0x5375('0x22');return db['UserProfileSection']['find']({'where':{'name':_0x52b2df,'userProfileId':_0x1f2530[_0x5375('0x48')]},'raw':!![]})[_0x5375('0x20')](function(_0xc49b7a){if(_0xc49b7a&&_0xc49b7a['autoAssociation']===0x0){return db[_0x5375('0x23')][_0x5375('0x43')]({'name':_0x4a40b0[_0x5375('0x26')],'resourceId':_0x4a40b0['id'],'type':_0xc49b7a['name'],'sectionId':_0xc49b7a['id']},{})[_0x5375('0x20')](function(){return _0x2c81eb;});}else{return _0x2c81eb;}})[_0x5375('0x42')](function(_0x2cef4e){logger[_0x5375('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2cef4e);throw _0x2cef4e;});}return _0x2c81eb;})[_0x5375('0x20')](respondWithResult(_0x1914f2,0xc9))[_0x5375('0x42')](handleError(_0x1914f2,null));};exports['update']=function(_0x21a090,_0x4510a3){if(_0x21a090[_0x5375('0x44')]['id']){delete _0x21a090[_0x5375('0x44')]['id'];}return db['Template']['find']({'where':{'id':_0x21a090[_0x5375('0x3d')]['id']}})[_0x5375('0x20')](handleEntityNotFound(_0x4510a3,null))['then'](saveUpdates(_0x21a090[_0x5375('0x44')],null))['then'](respondWithResult(_0x4510a3,null))[_0x5375('0x42')](handleError(_0x4510a3,null));};exports[_0x5375('0x1f')]=function(_0x5cae0f,_0x34754c){return db[_0x5375('0x29')][_0x5375('0x41')]({'where':{'id':_0x5cae0f[_0x5375('0x3d')]['id']}})[_0x5375('0x20')](handleEntityNotFound(_0x34754c,null))['then'](removeEntity(_0x34754c,null))[_0x5375('0x42')](handleError(_0x34754c,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 29a5174..ea54642 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 _0xfc03=['bluebird','path','../../config/environment','./template.attributes','define','Template','lodash','util','../../config/logger','api','moment'];(function(_0x41bbaa,_0x532d97){var _0x2f639f=function(_0xa577a3){while(--_0xa577a3){_0x41bbaa['push'](_0x41bbaa['shift']());}};_0x2f639f(++_0x532d97);}(_0xfc03,0x103));var _0x3fc0=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0xfc03[_0xb24a3e];return _0x4038d7;};'use strict';var _=require(_0x3fc0('0x0'));var util=require(_0x3fc0('0x1'));var logger=require(_0x3fc0('0x2'))(_0x3fc0('0x3'));var moment=require(_0x3fc0('0x4'));var BPromise=require(_0x3fc0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3fc0('0x6'));var rimraf=require('rimraf');var config=require(_0x3fc0('0x7'));var attributes=require(_0x3fc0('0x8'));module['exports']=function(_0x47d6fc,_0xa5a8b7){return _0x47d6fc[_0x3fc0('0x9')](_0x3fc0('0xa'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5574=['Template','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./template.attributes','exports','define'];(function(_0x472063,_0x11a264){var _0x17a1bf=function(_0x21f9d4){while(--_0x21f9d4){_0x472063['push'](_0x472063['shift']());}};_0x17a1bf(++_0x11a264);}(_0x5574,0x169));var _0x4557=function(_0x2abf95,_0x3c9cfd){_0x2abf95=_0x2abf95-0x0;var _0x3fd414=_0x5574[_0x2abf95];return _0x3fd414;};'use strict';var _=require(_0x4557('0x0'));var util=require(_0x4557('0x1'));var logger=require(_0x4557('0x2'))(_0x4557('0x3'));var moment=require(_0x4557('0x4'));var BPromise=require(_0x4557('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4557('0x6'));var rimraf=require('rimraf');var config=require(_0x4557('0x7'));var attributes=require(_0x4557('0x8'));module[_0x4557('0x9')]=function(_0x13e916,_0x48e070){return _0x13e916[_0x4557('0xa')](_0x4557('0xb'),attributes,{'tableName':'tools_templates','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 3cf9f3d..a8eb52d 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 _0x5729=['then','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetTemplate','Template','options','raw','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request'];(function(_0x58d26d,_0x5ccb56){var _0x58e0a1=function(_0x456712){while(--_0x456712){_0x58d26d['push'](_0x58d26d['shift']());}};_0x58e0a1(++_0x5ccb56);}(_0x5729,0xce));var _0x9572=function(_0xc7d92f,_0x2f2193){_0xc7d92f=_0xc7d92f-0x0;var _0x3a17ea=_0x5729[_0xc7d92f];return _0x3a17ea;};'use strict';var _=require('lodash');var util=require(_0x9572('0x0'));var moment=require(_0x9572('0x1'));var BPromise=require(_0x9572('0x2'));var rs=require(_0x9572('0x3'));var fs=require('fs');var Redis=require(_0x9572('0x4'));var db=require(_0x9572('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9572('0x6'))(_0x9572('0x7'));var config=require(_0x9572('0x8'));var jayson=require(_0x9572('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x596fd9,_0x43b775,_0xc73dcf){return new BPromise(function(_0x245a33,_0x230afe){return client[_0x9572('0xa')](_0x596fd9,_0xc73dcf)[_0x9572('0xb')](function(_0x482e9e){logger[_0x9572('0xc')](_0x9572('0xd'),_0x43b775,'request\x20sent');logger[_0x9572('0xe')](_0x9572('0xf'),_0x43b775,_0x9572('0x10'),JSON[_0x9572('0x11')](_0x482e9e));if(_0x482e9e[_0x9572('0x12')]){if(_0x482e9e['error'][_0x9572('0x13')]===0x1f4){logger[_0x9572('0x12')](_0x9572('0xd'),_0x43b775,_0x482e9e[_0x9572('0x12')][_0x9572('0x14')]);return _0x230afe(_0x482e9e[_0x9572('0x12')]['message']);}logger[_0x9572('0x12')](_0x9572('0xd'),_0x43b775,_0x482e9e['error'][_0x9572('0x14')]);return _0x245a33(_0x482e9e[_0x9572('0x12')][_0x9572('0x14')]);}else{logger['info'](_0x9572('0xd'),_0x43b775,_0x9572('0x10'));_0x245a33(_0x482e9e[_0x9572('0x15')][_0x9572('0x14')]);}})[_0x9572('0x16')](function(_0x5dd8f2){logger[_0x9572('0x12')]('Template,\x20%s,\x20%s',_0x43b775,_0x5dd8f2);_0x230afe(_0x5dd8f2);});});}exports[_0x9572('0x17')]=function(_0x1b411c){var _0x3d5f71=this;return new Promise(function(_0x5de8d4,_0x1fc14){return db[_0x9572('0x18')]['findAll']({'raw':_0x1b411c[_0x9572('0x19')]?_0x1b411c[_0x9572('0x19')][_0x9572('0x1a')]===undefined?!![]:![]:!![],'where':_0x1b411c['options']?_0x1b411c[_0x9572('0x19')]['where']||null:null,'attributes':_0x1b411c['options']?_0x1b411c[_0x9572('0x19')][_0x9572('0x1b')]||null:null,'limit':_0x1b411c[_0x9572('0x19')]?_0x1b411c['options']['limit']||null:null,'include':_0x1b411c[_0x9572('0x19')]?_0x1b411c[_0x9572('0x19')][_0x9572('0x1c')]?_[_0x9572('0x1d')](_0x1b411c[_0x9572('0x19')][_0x9572('0x1c')],function(_0x2bc587){return{'model':db[_0x2bc587['model']],'as':_0x2bc587['as'],'attributes':_0x2bc587[_0x9572('0x1b')],'include':_0x2bc587[_0x9572('0x1c')]?_[_0x9572('0x1d')](_0x2bc587[_0x9572('0x1c')],function(_0xf23aac){return{'model':db[_0xf23aac[_0x9572('0x1e')]],'as':_0xf23aac['as'],'attributes':_0xf23aac[_0x9572('0x1b')],'include':_0xf23aac[_0x9572('0x1c')]?_['map'](_0xf23aac['include'],function(_0x34cc5a){return{'model':db[_0x34cc5a[_0x9572('0x1e')]],'as':_0x34cc5a['as'],'attributes':_0x34cc5a[_0x9572('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a7e76){logger[_0x9572('0xc')](_0x9572('0x17'),_0x1b411c);logger[_0x9572('0xe')]('GetTemplate',_0x1b411c,JSON[_0x9572('0x11')](_0x3a7e76));_0x5de8d4(_0x3a7e76);})[_0x9572('0x16')](function(_0xbbf445){logger[_0x9572('0x12')](_0x9572('0x17'),_0xbbf445[_0x9572('0x14')],_0x1b411c);_0x1fc14(_0x3d5f71[_0x9572('0x12')](0x1f4,_0xbbf445['message']));});});}; \ No newline at end of file +var _0x4a4a=['model','map','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetTemplate','Template','findAll','options','raw','attributes','limit','include'];(function(_0x32ed5d,_0xc96c3){var _0x4e52a3=function(_0x1b0478){while(--_0x1b0478){_0x32ed5d['push'](_0x32ed5d['shift']());}};_0x4e52a3(++_0xc96c3);}(_0x4a4a,0x112));var _0xa4a4=function(_0x5ca377,_0xe734f4){_0x5ca377=_0x5ca377-0x0;var _0x1cebe9=_0x4a4a[_0x5ca377];return _0x1cebe9;};'use strict';var _=require(_0xa4a4('0x0'));var util=require(_0xa4a4('0x1'));var moment=require(_0xa4a4('0x2'));var BPromise=require('bluebird');var rs=require(_0xa4a4('0x3'));var fs=require('fs');var Redis=require(_0xa4a4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa4a4('0x5'));var logger=require(_0xa4a4('0x6'))(_0xa4a4('0x7'));var config=require(_0xa4a4('0x8'));var jayson=require(_0xa4a4('0x9'));var client=jayson[_0xa4a4('0xa')][_0xa4a4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8ec0,_0x488ab,_0x596dcd){return new BPromise(function(_0x2e533c,_0x433d60){return client[_0xa4a4('0xc')](_0x4a8ec0,_0x596dcd)[_0xa4a4('0xd')](function(_0x4188b2){logger[_0xa4a4('0xe')](_0xa4a4('0xf'),_0x488ab,_0xa4a4('0x10'));logger[_0xa4a4('0x11')](_0xa4a4('0x12'),_0x488ab,_0xa4a4('0x10'),JSON[_0xa4a4('0x13')](_0x4188b2));if(_0x4188b2[_0xa4a4('0x14')]){if(_0x4188b2[_0xa4a4('0x14')]['code']===0x1f4){logger[_0xa4a4('0x14')](_0xa4a4('0xf'),_0x488ab,_0x4188b2['error'][_0xa4a4('0x15')]);return _0x433d60(_0x4188b2[_0xa4a4('0x14')]['message']);}logger[_0xa4a4('0x14')](_0xa4a4('0xf'),_0x488ab,_0x4188b2['error'][_0xa4a4('0x15')]);return _0x2e533c(_0x4188b2[_0xa4a4('0x14')][_0xa4a4('0x15')]);}else{logger['info'](_0xa4a4('0xf'),_0x488ab,_0xa4a4('0x10'));_0x2e533c(_0x4188b2[_0xa4a4('0x16')][_0xa4a4('0x15')]);}})[_0xa4a4('0x17')](function(_0x288885){logger['error'](_0xa4a4('0xf'),_0x488ab,_0x288885);_0x433d60(_0x288885);});});}exports[_0xa4a4('0x18')]=function(_0x45efe){var _0x471e42=this;return new Promise(function(_0x5890da,_0x534427){return db[_0xa4a4('0x19')][_0xa4a4('0x1a')]({'raw':_0x45efe[_0xa4a4('0x1b')]?_0x45efe[_0xa4a4('0x1b')][_0xa4a4('0x1c')]===undefined?!![]:![]:!![],'where':_0x45efe[_0xa4a4('0x1b')]?_0x45efe[_0xa4a4('0x1b')]['where']||null:null,'attributes':_0x45efe[_0xa4a4('0x1b')]?_0x45efe['options'][_0xa4a4('0x1d')]||null:null,'limit':_0x45efe[_0xa4a4('0x1b')]?_0x45efe['options'][_0xa4a4('0x1e')]||null:null,'include':_0x45efe[_0xa4a4('0x1b')]?_0x45efe['options']['include']?_['map'](_0x45efe[_0xa4a4('0x1b')][_0xa4a4('0x1f')],function(_0x900097){return{'model':db[_0x900097[_0xa4a4('0x20')]],'as':_0x900097['as'],'attributes':_0x900097['attributes'],'include':_0x900097[_0xa4a4('0x1f')]?_[_0xa4a4('0x21')](_0x900097['include'],function(_0x3fdc1c){return{'model':db[_0x3fdc1c[_0xa4a4('0x20')]],'as':_0x3fdc1c['as'],'attributes':_0x3fdc1c[_0xa4a4('0x1d')],'include':_0x3fdc1c[_0xa4a4('0x1f')]?_[_0xa4a4('0x21')](_0x3fdc1c[_0xa4a4('0x1f')],function(_0x3aeacd){return{'model':db[_0x3aeacd[_0xa4a4('0x20')]],'as':_0x3aeacd['as'],'attributes':_0x3aeacd[_0xa4a4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa4a4('0xd')](function(_0x3f9f25){logger[_0xa4a4('0xe')]('GetTemplate',_0x45efe);logger['debug']('GetTemplate',_0x45efe,JSON['stringify'](_0x3f9f25));_0x5890da(_0x3f9f25);})[_0xa4a4('0x17')](function(_0x25aeab){logger[_0xa4a4('0x14')](_0xa4a4('0x18'),_0x25aeab['message'],_0x45efe);_0x534427(_0x471e42[_0xa4a4('0x14')](0x1f4,_0x25aeab[_0xa4a4('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 62ad7b2..c7937a5 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 _0xbb87=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','show','/:id/all_conditions','isAuthenticated','getAllConditions','get','/:id/actions','getActions','post','addAllCondition','addAnyCondition','addAction','delete','destroy','exports','util'];(function(_0x5d9f3a,_0x398dd7){var _0x2f8258=function(_0x51e76d){while(--_0x51e76d){_0x5d9f3a['push'](_0x5d9f3a['shift']());}};_0x2f8258(++_0x398dd7);}(_0xbb87,0x1af));var _0x7bb8=function(_0x4d5e23,_0x1df8fa){_0x4d5e23=_0x4d5e23-0x0;var _0x2bfb07=_0xbb87[_0x4d5e23];return _0x2bfb07;};'use strict';var multer=require('multer');var util=require(_0x7bb8('0x0'));var path=require(_0x7bb8('0x1'));var timeout=require(_0x7bb8('0x2'));var express=require(_0x7bb8('0x3'));var router=express[_0x7bb8('0x4')]();var auth=require(_0x7bb8('0x5'));var interaction=require(_0x7bb8('0x6'));var config=require(_0x7bb8('0x7'));var controller=require('./trigger.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x7bb8('0x8')]);router['get'](_0x7bb8('0x9'),auth['isAuthenticated'](),controller[_0x7bb8('0xa')]);router['get'](_0x7bb8('0xb'),auth[_0x7bb8('0xc')](),controller[_0x7bb8('0xd')]);router[_0x7bb8('0xe')]('/:id/any_conditions',auth[_0x7bb8('0xc')](),controller['getAnyConditions']);router[_0x7bb8('0xe')](_0x7bb8('0xf'),auth['isAuthenticated'](),controller[_0x7bb8('0x10')]);router['post']('/',auth[_0x7bb8('0xc')](),controller['create']);router[_0x7bb8('0x11')](_0x7bb8('0xb'),auth[_0x7bb8('0xc')](),controller[_0x7bb8('0x12')]);router[_0x7bb8('0x11')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x7bb8('0x13')]);router[_0x7bb8('0x11')](_0x7bb8('0xf'),auth[_0x7bb8('0xc')](),controller[_0x7bb8('0x14')]);router['put'](_0x7bb8('0x9'),auth[_0x7bb8('0xc')](),controller['update']);router[_0x7bb8('0x15')](_0x7bb8('0x9'),auth[_0x7bb8('0xc')](),controller[_0x7bb8('0x16')]);module[_0x7bb8('0x17')]=router; \ No newline at end of file +var _0x5fdf=['addAnyCondition','put','delete','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','create','addAllCondition','post'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x5fdf,0x65));var _0xf5fd=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x5fdf[_0x37bd26];return _0xe83dc4;};'use strict';var multer=require('multer');var util=require(_0xf5fd('0x0'));var path=require('path');var timeout=require(_0xf5fd('0x1'));var express=require(_0xf5fd('0x2'));var router=express['Router']();var auth=require(_0xf5fd('0x3'));var interaction=require(_0xf5fd('0x4'));var config=require(_0xf5fd('0x5'));var controller=require(_0xf5fd('0x6'));router[_0xf5fd('0x7')]('/',auth[_0xf5fd('0x8')](),controller[_0xf5fd('0x9')]);router['get'](_0xf5fd('0xa'),auth[_0xf5fd('0x8')](),controller['show']);router[_0xf5fd('0x7')](_0xf5fd('0xb'),auth[_0xf5fd('0x8')](),controller[_0xf5fd('0xc')]);router[_0xf5fd('0x7')](_0xf5fd('0xd'),auth['isAuthenticated'](),controller[_0xf5fd('0xe')]);router['get'](_0xf5fd('0xf'),auth[_0xf5fd('0x8')](),controller['getActions']);router['post']('/',auth['isAuthenticated'](),controller[_0xf5fd('0x10')]);router['post']('/:id/all_conditions',auth[_0xf5fd('0x8')](),controller[_0xf5fd('0x11')]);router[_0xf5fd('0x12')](_0xf5fd('0xd'),auth[_0xf5fd('0x8')](),controller[_0xf5fd('0x13')]);router[_0xf5fd('0x12')]('/:id/actions',auth['isAuthenticated'](),controller['addAction']);router[_0xf5fd('0x14')](_0xf5fd('0xa'),auth[_0xf5fd('0x8')](),controller['update']);router[_0xf5fd('0x15')](_0xf5fd('0xa'),auth[_0xf5fd('0x8')](),controller[_0xf5fd('0x16')]);module[_0xf5fd('0x17')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 1711adb..8105093 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 _0x6807=['BOOLEAN','sequelize','exports','STRING'];(function(_0x5bd612,_0x47e025){var _0x5f0715=function(_0x27ec10){while(--_0x27ec10){_0x5bd612['push'](_0x5bd612['shift']());}};_0x5f0715(++_0x47e025);}(_0x6807,0x105));var _0x7680=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6807[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x7680('0x0'));module[_0x7680('0x1')]={'name':{'type':Sequelize[_0x7680('0x2')]},'channel':{'type':Sequelize[_0x7680('0x2')]},'description':{'type':Sequelize[_0x7680('0x2')]},'status':{'type':Sequelize[_0x7680('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x6e12=['exports','STRING','BOOLEAN','sequelize'];(function(_0x334f33,_0x316249){var _0x4b0957=function(_0x3a47ad){while(--_0x3a47ad){_0x334f33['push'](_0x334f33['shift']());}};_0x4b0957(++_0x316249);}(_0x6e12,0x137));var _0x26e1=function(_0x1627ff,_0x2bde1e){_0x1627ff=_0x1627ff-0x0;var _0x4fbc1e=_0x6e12[_0x1627ff];return _0x4fbc1e;};'use strict';var Sequelize=require(_0x26e1('0x0'));module[_0x26e1('0x1')]={'name':{'type':Sequelize[_0x26e1('0x2')]},'channel':{'type':Sequelize[_0x26e1('0x2')]},'description':{'type':Sequelize[_0x26e1('0x2')]},'status':{'type':Sequelize[_0x26e1('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 44c5cbf..de223b0 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 _0xbc3a=['nolimit','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','find','userProfileId','autoAssociation','addAllCondition','Condition','addAnyCondition','TriggerAnyId','getAllConditions','order','getAnyConditions','findOne','addAction','Action','getActions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','Trigger','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x4386e0,_0x5092cd){var _0x34e4c9=function(_0x4b20fd){while(--_0x4b20fd){_0x4386e0['push'](_0x4386e0['shift']());}};_0x34e4c9(++_0x5092cd);}(_0xbc3a,0x83));var _0xabc3=function(_0x4020c0,_0x2bfdbd){_0x4020c0=_0x4020c0-0x0;var _0x5725d6=_0xbc3a[_0x4020c0];return _0x5725d6;};'use strict';var pdf=require(_0xabc3('0x0'));var emlformat=require(_0xabc3('0x1'));var rimraf=require(_0xabc3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xabc3('0x3'));var rp=require(_0xabc3('0x4'));var moment=require('moment');var BPromise=require(_0xabc3('0x5'));var Mustache=require(_0xabc3('0x6'));var util=require(_0xabc3('0x7'));var path=require('path');var sox=require(_0xabc3('0x8'));var csv=require(_0xabc3('0x9'));var ejs=require(_0xabc3('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xabc3('0xb'));var crypto=require(_0xabc3('0xc'));var jsforce=require(_0xabc3('0xd'));var deskjs=require(_0xabc3('0xe'));var toCsv=require(_0xabc3('0x9'));var querystring=require(_0xabc3('0xf'));var Papa=require(_0xabc3('0x10'));var Redis=require(_0xabc3('0x11'));var authService=require(_0xabc3('0x12'));var qs=require(_0xabc3('0x13'));var as=require(_0xabc3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xabc3('0x15'));var config=require(_0xabc3('0x16'));var db=require(_0xabc3('0x17'))['db'];function respondWithStatusCode(_0x1bb1e6,_0xc27692){_0xc27692=_0xc27692||0xcc;return function(_0x42651c){if(_0x42651c){return _0x1bb1e6['sendStatus'](_0xc27692);}return _0x1bb1e6[_0xabc3('0x18')](_0xc27692)[_0xabc3('0x19')]();};}function respondWithResult(_0x253faa,_0x350e88){_0x350e88=_0x350e88||0xc8;return function(_0x2e73a3){if(_0x2e73a3){return _0x253faa[_0xabc3('0x18')](_0x350e88)['json'](_0x2e73a3);}};}function respondWithFilteredResult(_0x267024,_0x5ae09e){return function(_0x1dbfa9){if(_0x1dbfa9){var _0x25094b=_0x1dbfa9[_0xabc3('0x1a')],_0x14d78c=_0x5ae09e[_0xabc3('0x1b')],_0x523d8b=_0x5ae09e[_0xabc3('0x1b')]+_0x5ae09e[_0xabc3('0x1c')],_0x2e6e72;if(_0x523d8b>=_0x25094b){_0x523d8b=_0x25094b;_0x2e6e72=0xc8;}else{_0x2e6e72=0xce;}_0x267024[_0xabc3('0x18')](_0x2e6e72);return _0x267024[_0xabc3('0x1d')](_0xabc3('0x1e'),_0x14d78c+'-'+_0x523d8b+'/'+_0x25094b)[_0xabc3('0x1f')](_0x1dbfa9);}return null;};}function patchUpdates(_0x531371){return function(_0xa48182){try{jsonpatch['apply'](_0xa48182,_0x531371,!![]);}catch(_0x5d0ce8){return BPromise['reject'](_0x5d0ce8);}return _0xa48182[_0xabc3('0x20')]();};}function saveUpdates(_0x378e2d,_0x4ed795){return function(_0x1a2dbb){if(_0x1a2dbb){return _0x1a2dbb['update'](_0x378e2d)[_0xabc3('0x21')](function(_0x524ff9){return _0x524ff9;});}return null;};}function removeEntity(_0x2a8efc,_0x46b8ce){return function(_0x5c7ea2){if(_0x5c7ea2){return _0x5c7ea2[_0xabc3('0x22')]()[_0xabc3('0x21')](function(){var _0x27bcbf=_0x5c7ea2[_0xabc3('0x23')]({'plain':!![]});var _0x57bc7b='Triggers';return db[_0xabc3('0x24')][_0xabc3('0x22')]({'where':{'type':_0x57bc7b,'resourceId':_0x27bcbf['id']}})[_0xabc3('0x21')](function(){return _0x5c7ea2;});})[_0xabc3('0x21')](function(){_0x2a8efc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c4acc,_0x2c387d){return function(_0x9592e9){if(!_0x9592e9){_0x4c4acc['sendStatus'](0x194);}return _0x9592e9;};}function handleError(_0x10ab88,_0x2c4241){_0x2c4241=_0x2c4241||0x1f4;return function(_0x204e87){logger[_0xabc3('0x25')](_0x204e87[_0xabc3('0x26')]);if(_0x204e87[_0xabc3('0x27')]){delete _0x204e87[_0xabc3('0x27')];}_0x10ab88[_0xabc3('0x18')](_0x2c4241)[_0xabc3('0x28')](_0x204e87);};}exports[_0xabc3('0x29')]=function(_0xab98f3,_0x2798c0){var _0x258d51={},_0x55b63f={},_0x18d5b2={'count':0x0,'rows':[]};var _0x559038=_['map'](db[_0xabc3('0x2a')]['rawAttributes'],function(_0x3f14a7){return{'name':_0x3f14a7[_0xabc3('0x2b')],'type':_0x3f14a7['type'][_0xabc3('0x2c')]};});_0x55b63f[_0xabc3('0x2d')]=_[_0xabc3('0x2e')](_0x559038,'name');_0x55b63f[_0xabc3('0x2f')]=_['keys'](_0xab98f3[_0xabc3('0x2f')]);_0x55b63f['filters']=_[_0xabc3('0x30')](_0x55b63f[_0xabc3('0x2d')],_0x55b63f[_0xabc3('0x2f')]);_0x258d51[_0xabc3('0x31')]=_['intersection'](_0x55b63f[_0xabc3('0x2d')],qs[_0xabc3('0x32')](_0xab98f3[_0xabc3('0x2f')][_0xabc3('0x32')]));_0x258d51[_0xabc3('0x31')]=_0x258d51[_0xabc3('0x31')][_0xabc3('0x33')]?_0x258d51['attributes']:_0x55b63f[_0xabc3('0x2d')];if(!_0xab98f3[_0xabc3('0x2f')][_0xabc3('0x34')](_0xabc3('0x35'))){_0x258d51[_0xabc3('0x1c')]=qs['limit'](_0xab98f3[_0xabc3('0x2f')][_0xabc3('0x1c')]);_0x258d51['offset']=qs[_0xabc3('0x1b')](_0xab98f3[_0xabc3('0x2f')][_0xabc3('0x1b')]);}_0x258d51['order']=qs['sort'](_0xab98f3[_0xabc3('0x2f')][_0xabc3('0x36')]);_0x258d51[_0xabc3('0x37')]=qs[_0xabc3('0x38')](_[_0xabc3('0x39')](_0xab98f3['query'],_0x55b63f[_0xabc3('0x38')]),_0x559038);if(_0xab98f3[_0xabc3('0x2f')][_0xabc3('0x3a')]){_0x258d51[_0xabc3('0x37')]=_[_0xabc3('0x3b')](_0x258d51[_0xabc3('0x37')],{'$or':_[_0xabc3('0x2e')](_0x559038,function(_0x592c02){if(_0x592c02[_0xabc3('0x3c')]!=='VIRTUAL'){var _0x14c3c1={};_0x14c3c1[_0x592c02[_0xabc3('0x27')]]={'$like':'%'+_0xab98f3[_0xabc3('0x2f')][_0xabc3('0x3a')]+'%'};return _0x14c3c1;}})});}_0x258d51=_[_0xabc3('0x3b')]({},_0x258d51,_0xab98f3[_0xabc3('0x3d')]);var _0xe4a15e={'where':_0x258d51[_0xabc3('0x37')]};return db[_0xabc3('0x2a')][_0xabc3('0x1a')](_0xe4a15e)[_0xabc3('0x21')](function(_0x39e7b6){_0x18d5b2[_0xabc3('0x1a')]=_0x39e7b6;if(_0xab98f3[_0xabc3('0x2f')][_0xabc3('0x3e')]){_0x258d51[_0xabc3('0x3f')]=[{'all':!![]}];}return db[_0xabc3('0x2a')][_0xabc3('0x40')](_0x258d51);})['then'](function(_0x585d5d){_0x18d5b2[_0xabc3('0x41')]=_0x585d5d;return _0x18d5b2;})[_0xabc3('0x21')](respondWithFilteredResult(_0x2798c0,_0x258d51))[_0xabc3('0x42')](handleError(_0x2798c0,null));};exports[_0xabc3('0x43')]=function(_0x1f868c,_0x48df3a){var _0x10b1a0={'raw':![],'where':{'id':_0x1f868c[_0xabc3('0x44')]['id']}},_0x52cc4c={};_0x52cc4c[_0xabc3('0x2d')]=_[_0xabc3('0x45')](db[_0xabc3('0x2a')][_0xabc3('0x46')]);_0x52cc4c[_0xabc3('0x2f')]=_['keys'](_0x1f868c[_0xabc3('0x2f')]);_0x52cc4c[_0xabc3('0x38')]=_[_0xabc3('0x30')](_0x52cc4c[_0xabc3('0x2d')],_0x52cc4c[_0xabc3('0x2f')]);_0x10b1a0[_0xabc3('0x31')]=_['intersection'](_0x52cc4c[_0xabc3('0x2d')],qs[_0xabc3('0x32')](_0x1f868c[_0xabc3('0x2f')][_0xabc3('0x32')]));_0x10b1a0['attributes']=_0x10b1a0[_0xabc3('0x31')][_0xabc3('0x33')]?_0x10b1a0['attributes']:_0x52cc4c['model'];if(_0x1f868c[_0xabc3('0x2f')][_0xabc3('0x3e')]){_0x10b1a0[_0xabc3('0x3f')]=[{'all':!![]}];}_0x10b1a0=_[_0xabc3('0x3b')]({},_0x10b1a0,_0x1f868c['options']);return db[_0xabc3('0x2a')]['find'](_0x10b1a0)[_0xabc3('0x21')](handleEntityNotFound(_0x48df3a,null))['then'](respondWithResult(_0x48df3a,null))['catch'](handleError(_0x48df3a,null));};exports[_0xabc3('0x47')]=function(_0x5c62e9,_0x2c709a){return db['Trigger'][_0xabc3('0x47')](_0x5c62e9[_0xabc3('0x48')],{})['then'](function(_0x48064b){var _0x5082d3=_0x5c62e9[_0xabc3('0x49')][_0xabc3('0x23')]({'plain':!![]});if(!_0x5082d3)throw new Error(_0xabc3('0x4a'));if(_0x5082d3[_0xabc3('0x4b')]===_0xabc3('0x49')){var _0x4ea160=_0x48064b[_0xabc3('0x23')]({'plain':!![]});var _0x25df78=_0xabc3('0x4c');return db[_0xabc3('0x4d')][_0xabc3('0x4e')]({'where':{'name':_0x25df78,'userProfileId':_0x5082d3[_0xabc3('0x4f')]},'raw':!![]})['then'](function(_0xa36656){if(_0xa36656&&_0xa36656[_0xabc3('0x50')]===0x0){return db[_0xabc3('0x24')][_0xabc3('0x47')]({'name':_0x4ea160[_0xabc3('0x27')],'resourceId':_0x4ea160['id'],'type':_0xa36656[_0xabc3('0x27')],'sectionId':_0xa36656['id']},{})['then'](function(){return _0x48064b;});}else{return _0x48064b;}})['catch'](function(_0x134c8f){logger[_0xabc3('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x134c8f);throw _0x134c8f;});}return _0x48064b;})[_0xabc3('0x21')](respondWithResult(_0x2c709a,0xc9))[_0xabc3('0x42')](handleError(_0x2c709a,null));};exports['update']=function(_0x488514,_0x3211e1){if(_0x488514['body']['id']){delete _0x488514[_0xabc3('0x48')]['id'];}return db[_0xabc3('0x2a')]['find']({'where':{'id':_0x488514['params']['id']}})[_0xabc3('0x21')](handleEntityNotFound(_0x3211e1,null))['then'](saveUpdates(_0x488514[_0xabc3('0x48')],null))[_0xabc3('0x21')](respondWithResult(_0x3211e1,null))[_0xabc3('0x42')](handleError(_0x3211e1,null));};exports[_0xabc3('0x22')]=function(_0xe66998,_0x5e0c16){return db[_0xabc3('0x2a')]['find']({'where':{'id':_0xe66998['params']['id']}})[_0xabc3('0x21')](handleEntityNotFound(_0x5e0c16,null))[_0xabc3('0x21')](removeEntity(_0x5e0c16,null))[_0xabc3('0x42')](handleError(_0x5e0c16,null));};exports[_0xabc3('0x51')]=function(_0x4b3142,_0x58c54f,_0xd34d9c){if(_0x4b3142['body']['id']){delete _0x4b3142[_0xabc3('0x48')]['id'];}return db['Trigger'][_0xabc3('0x4e')]({'where':{'id':_0x4b3142['params']['id']}})['then'](handleEntityNotFound(_0x58c54f,null))['then'](function(_0x3cb1c8){if(_0x3cb1c8){_0x4b3142[_0xabc3('0x48')]['TriggerAllId']=_0x3cb1c8['id'];return db[_0xabc3('0x52')][_0xabc3('0x47')](_0x4b3142[_0xabc3('0x48')]);}})[_0xabc3('0x21')](respondWithResult(_0x58c54f,null))[_0xabc3('0x42')](handleError(_0x58c54f,null));};exports[_0xabc3('0x53')]=function(_0x1fb563,_0x22185a,_0x2a5211){if(_0x1fb563[_0xabc3('0x48')]['id']){delete _0x1fb563[_0xabc3('0x48')]['id'];}return db[_0xabc3('0x2a')]['find']({'where':{'id':_0x1fb563['params']['id']}})[_0xabc3('0x21')](handleEntityNotFound(_0x22185a,null))['then'](function(_0x28b757){if(_0x28b757){_0x1fb563[_0xabc3('0x48')][_0xabc3('0x54')]=_0x28b757['id'];return db[_0xabc3('0x52')][_0xabc3('0x47')](_0x1fb563[_0xabc3('0x48')]);}})[_0xabc3('0x21')](respondWithResult(_0x22185a,null))[_0xabc3('0x42')](handleError(_0x22185a,null));};exports[_0xabc3('0x55')]=function(_0xe91db1,_0x4442e0,_0x27edaa){var _0x494f4a={};var _0x6ec7e4={};var _0x5591ce;var _0x17428b;return db[_0xabc3('0x2a')]['findOne']({'where':{'id':_0xe91db1[_0xabc3('0x44')]['id']}})['then'](handleEntityNotFound(_0x4442e0,null))[_0xabc3('0x21')](function(_0x122321){if(_0x122321){_0x5591ce=_0x122321;_0x6ec7e4['model']=_[_0xabc3('0x45')](db[_0xabc3('0x52')][_0xabc3('0x46')]);_0x6ec7e4[_0xabc3('0x2f')]=_[_0xabc3('0x45')](_0xe91db1[_0xabc3('0x2f')]);_0x6ec7e4['filters']=_[_0xabc3('0x30')](_0x6ec7e4[_0xabc3('0x2d')],_0x6ec7e4[_0xabc3('0x2f')]);_0x494f4a[_0xabc3('0x31')]=_[_0xabc3('0x30')](_0x6ec7e4[_0xabc3('0x2d')],qs['fields'](_0xe91db1['query'][_0xabc3('0x32')]));_0x494f4a[_0xabc3('0x31')]=_0x494f4a[_0xabc3('0x31')]['length']?_0x494f4a[_0xabc3('0x31')]:_0x6ec7e4['model'];_0x494f4a[_0xabc3('0x56')]=qs['sort'](_0xe91db1['query'][_0xabc3('0x36')]);_0x494f4a[_0xabc3('0x37')]=qs['filters'](_[_0xabc3('0x39')](_0xe91db1[_0xabc3('0x2f')],_0x6ec7e4[_0xabc3('0x38')]));if(_0xe91db1[_0xabc3('0x2f')]['filter']){_0x494f4a[_0xabc3('0x37')]=_['merge'](_0x494f4a['where'],{'$or':_['map'](_0x494f4a['attributes'],function(_0x1b095b){var _0x54a0b7={};_0x54a0b7[_0x1b095b]={'$like':'%'+_0xe91db1[_0xabc3('0x2f')][_0xabc3('0x3a')]+'%'};return _0x54a0b7;})});}_0x494f4a=_[_0xabc3('0x3b')]({},_0x494f4a,_0xe91db1[_0xabc3('0x3d')]);return _0x5591ce[_0xabc3('0x55')](_0x494f4a);}})[_0xabc3('0x21')](function(_0x2af885){if(_0x2af885){_0x17428b=_0x2af885[_0xabc3('0x33')];if(!_0xe91db1[_0xabc3('0x2f')][_0xabc3('0x34')](_0xabc3('0x35'))){_0x494f4a[_0xabc3('0x1c')]=qs[_0xabc3('0x1c')](_0xe91db1[_0xabc3('0x2f')]['limit']);_0x494f4a[_0xabc3('0x1b')]=qs[_0xabc3('0x1b')](_0xe91db1[_0xabc3('0x2f')][_0xabc3('0x1b')]);}return _0x5591ce[_0xabc3('0x55')](_0x494f4a);}})[_0xabc3('0x21')](function(_0x3fe75d){if(_0x3fe75d){return _0x3fe75d?{'count':_0x17428b,'rows':_0x3fe75d}:null;}})[_0xabc3('0x21')](respondWithResult(_0x4442e0,null))['catch'](handleError(_0x4442e0,null));};exports[_0xabc3('0x57')]=function(_0xa6e254,_0x4366e2,_0x42162b){var _0x439a3d={};var _0x3804ed={};var _0x20d43f;var _0x4fbf06;return db[_0xabc3('0x2a')][_0xabc3('0x58')]({'where':{'id':_0xa6e254[_0xabc3('0x44')]['id']}})['then'](handleEntityNotFound(_0x4366e2,null))[_0xabc3('0x21')](function(_0x483500){if(_0x483500){_0x20d43f=_0x483500;_0x3804ed['model']=_[_0xabc3('0x45')](db[_0xabc3('0x52')][_0xabc3('0x46')]);_0x3804ed[_0xabc3('0x2f')]=_[_0xabc3('0x45')](_0xa6e254[_0xabc3('0x2f')]);_0x3804ed[_0xabc3('0x38')]=_[_0xabc3('0x30')](_0x3804ed[_0xabc3('0x2d')],_0x3804ed['query']);_0x439a3d['attributes']=_[_0xabc3('0x30')](_0x3804ed[_0xabc3('0x2d')],qs['fields'](_0xa6e254[_0xabc3('0x2f')][_0xabc3('0x32')]));_0x439a3d[_0xabc3('0x31')]=_0x439a3d[_0xabc3('0x31')][_0xabc3('0x33')]?_0x439a3d[_0xabc3('0x31')]:_0x3804ed['model'];_0x439a3d[_0xabc3('0x56')]=qs['sort'](_0xa6e254['query'][_0xabc3('0x36')]);_0x439a3d[_0xabc3('0x37')]=qs['filters'](_['pick'](_0xa6e254[_0xabc3('0x2f')],_0x3804ed[_0xabc3('0x38')]));if(_0xa6e254[_0xabc3('0x2f')][_0xabc3('0x3a')]){_0x439a3d[_0xabc3('0x37')]=_[_0xabc3('0x3b')](_0x439a3d[_0xabc3('0x37')],{'$or':_[_0xabc3('0x2e')](_0x439a3d[_0xabc3('0x31')],function(_0x3d2b48){var _0x581682={};_0x581682[_0x3d2b48]={'$like':'%'+_0xa6e254[_0xabc3('0x2f')][_0xabc3('0x3a')]+'%'};return _0x581682;})});}_0x439a3d=_[_0xabc3('0x3b')]({},_0x439a3d,_0xa6e254[_0xabc3('0x3d')]);return _0x20d43f[_0xabc3('0x57')](_0x439a3d);}})['then'](function(_0x3545a2){if(_0x3545a2){_0x4fbf06=_0x3545a2[_0xabc3('0x33')];if(!_0xa6e254[_0xabc3('0x2f')][_0xabc3('0x34')](_0xabc3('0x35'))){_0x439a3d[_0xabc3('0x1c')]=qs[_0xabc3('0x1c')](_0xa6e254[_0xabc3('0x2f')]['limit']);_0x439a3d[_0xabc3('0x1b')]=qs[_0xabc3('0x1b')](_0xa6e254[_0xabc3('0x2f')][_0xabc3('0x1b')]);}return _0x20d43f[_0xabc3('0x57')](_0x439a3d);}})[_0xabc3('0x21')](function(_0x2e698b){if(_0x2e698b){return _0x2e698b?{'count':_0x4fbf06,'rows':_0x2e698b}:null;}})['then'](respondWithResult(_0x4366e2,null))[_0xabc3('0x42')](handleError(_0x4366e2,null));};exports[_0xabc3('0x59')]=function(_0x2a5182,_0x588bc8,_0x2e1f12){if(_0x2a5182[_0xabc3('0x48')]['id']){delete _0x2a5182[_0xabc3('0x48')]['id'];}return db['Trigger'][_0xabc3('0x4e')]({'where':{'id':_0x2a5182[_0xabc3('0x44')]['id']}})[_0xabc3('0x21')](handleEntityNotFound(_0x588bc8,null))[_0xabc3('0x21')](function(_0x55795b){if(_0x55795b){_0x2a5182[_0xabc3('0x48')]['TriggerId']=_0x55795b['id'];return db[_0xabc3('0x5a')][_0xabc3('0x47')](_0x2a5182[_0xabc3('0x48')]);}})[_0xabc3('0x21')](respondWithResult(_0x588bc8,null))[_0xabc3('0x42')](handleError(_0x588bc8,null));};exports[_0xabc3('0x5b')]=function(_0x58696f,_0x46e026,_0x11cd88){var _0x36d628={};var _0x263141={};var _0x158a32;var _0x22ad1e;return db[_0xabc3('0x2a')][_0xabc3('0x58')]({'where':{'id':_0x58696f[_0xabc3('0x44')]['id']}})[_0xabc3('0x21')](handleEntityNotFound(_0x46e026,null))[_0xabc3('0x21')](function(_0x46c2b6){if(_0x46c2b6){_0x158a32=_0x46c2b6;_0x263141[_0xabc3('0x2d')]=_['keys'](db[_0xabc3('0x5a')][_0xabc3('0x46')]);_0x263141[_0xabc3('0x2f')]=_[_0xabc3('0x45')](_0x58696f[_0xabc3('0x2f')]);_0x263141['filters']=_[_0xabc3('0x30')](_0x263141[_0xabc3('0x2d')],_0x263141[_0xabc3('0x2f')]);_0x36d628[_0xabc3('0x31')]=_[_0xabc3('0x30')](_0x263141[_0xabc3('0x2d')],qs[_0xabc3('0x32')](_0x58696f[_0xabc3('0x2f')][_0xabc3('0x32')]));_0x36d628['attributes']=_0x36d628[_0xabc3('0x31')][_0xabc3('0x33')]?_0x36d628[_0xabc3('0x31')]:_0x263141[_0xabc3('0x2d')];_0x36d628[_0xabc3('0x56')]=qs[_0xabc3('0x36')](_0x58696f[_0xabc3('0x2f')][_0xabc3('0x36')]);_0x36d628[_0xabc3('0x37')]=qs[_0xabc3('0x38')](_['pick'](_0x58696f[_0xabc3('0x2f')],_0x263141[_0xabc3('0x38')]));if(_0x58696f['query'][_0xabc3('0x3a')]){_0x36d628[_0xabc3('0x37')]=_[_0xabc3('0x3b')](_0x36d628['where'],{'$or':_[_0xabc3('0x2e')](_0x36d628['attributes'],function(_0x4ff2ae){var _0x421dbb={};_0x421dbb[_0x4ff2ae]={'$like':'%'+_0x58696f[_0xabc3('0x2f')][_0xabc3('0x3a')]+'%'};return _0x421dbb;})});}_0x36d628=_[_0xabc3('0x3b')]({},_0x36d628,_0x58696f[_0xabc3('0x3d')]);return _0x158a32[_0xabc3('0x5b')](_0x36d628);}})[_0xabc3('0x21')](function(_0x1180ac){if(_0x1180ac){_0x22ad1e=_0x1180ac['length'];if(!_0x58696f[_0xabc3('0x2f')]['hasOwnProperty'](_0xabc3('0x35'))){_0x36d628[_0xabc3('0x1c')]=qs[_0xabc3('0x1c')](_0x58696f['query'][_0xabc3('0x1c')]);_0x36d628[_0xabc3('0x1b')]=qs[_0xabc3('0x1b')](_0x58696f[_0xabc3('0x2f')][_0xabc3('0x1b')]);}return _0x158a32[_0xabc3('0x5b')](_0x36d628);}})[_0xabc3('0x21')](function(_0x1bfafd){if(_0x1bfafd){return _0x1bfafd?{'count':_0x22ad1e,'rows':_0x1bfafd}:null;}})[_0xabc3('0x21')](respondWithResult(_0x46e026,null))[_0xabc3('0x42')](handleError(_0x46e026,null));}; \ No newline at end of file +var _0x4658=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','pick','nolimit','getAnyConditions','findOne','addAction','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','options','Trigger','includeAll','findAll','rows','params','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Triggers','UserProfileSection','autoAssociation','catch'];(function(_0x6d20d1,_0x5981e8){var _0x14c58a=function(_0x478e10){while(--_0x478e10){_0x6d20d1['push'](_0x6d20d1['shift']());}};_0x14c58a(++_0x5981e8);}(_0x4658,0x10f));var _0x8465=function(_0x180a99,_0x422758){_0x180a99=_0x180a99-0x0;var _0x2d75b8=_0x4658[_0x180a99];return _0x2d75b8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8465('0x0'));var rimraf=require(_0x8465('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8465('0x2'));var rp=require(_0x8465('0x3'));var moment=require('moment');var BPromise=require(_0x8465('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8465('0x5'));var ejs=require(_0x8465('0x6'));var fs=require('fs');var _=require(_0x8465('0x7'));var squel=require('squel');var crypto=require(_0x8465('0x8'));var jsforce=require(_0x8465('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x8465('0x5'));var querystring=require('querystring');var Papa=require(_0x8465('0xa'));var Redis=require(_0x8465('0xb'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8465('0xc'));var hardwareService=require(_0x8465('0xd'));var logger=require(_0x8465('0xe'))(_0x8465('0xf'));var utils=require(_0x8465('0x10'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27d76b,_0x3013e5){_0x3013e5=_0x3013e5||0xcc;return function(_0xdcc2ec){if(_0xdcc2ec){return _0x27d76b['sendStatus'](_0x3013e5);}return _0x27d76b[_0x8465('0x11')](_0x3013e5)['end']();};}function respondWithResult(_0x305e6e,_0x53aad3){_0x53aad3=_0x53aad3||0xc8;return function(_0x5ce8d8){if(_0x5ce8d8){return _0x305e6e[_0x8465('0x11')](_0x53aad3)[_0x8465('0x12')](_0x5ce8d8);}};}function respondWithFilteredResult(_0x3d85b7,_0x339d00){return function(_0x4fc2a5){if(_0x4fc2a5){var _0x4c39f9=_0x4fc2a5[_0x8465('0x13')],_0x2b1484=_0x339d00[_0x8465('0x14')],_0x2aabea=_0x339d00['offset']+_0x339d00[_0x8465('0x15')],_0x37fa03;if(_0x2aabea>=_0x4c39f9){_0x2aabea=_0x4c39f9;_0x37fa03=0xc8;}else{_0x37fa03=0xce;}_0x3d85b7[_0x8465('0x11')](_0x37fa03);return _0x3d85b7[_0x8465('0x16')](_0x8465('0x17'),_0x2b1484+'-'+_0x2aabea+'/'+_0x4c39f9)[_0x8465('0x12')](_0x4fc2a5);}return null;};}function patchUpdates(_0xfc7367){return function(_0x7fad1e){try{jsonpatch[_0x8465('0x18')](_0x7fad1e,_0xfc7367,!![]);}catch(_0x551753){return BPromise[_0x8465('0x19')](_0x551753);}return _0x7fad1e[_0x8465('0x1a')]();};}function saveUpdates(_0x536ee7,_0x3d1cda){return function(_0x1936f6){if(_0x1936f6){return _0x1936f6[_0x8465('0x1b')](_0x536ee7)[_0x8465('0x1c')](function(_0x3f490){return _0x3f490;});}return null;};}function removeEntity(_0x3c43ad,_0x5b9e10){return function(_0x33629c){if(_0x33629c){return _0x33629c[_0x8465('0x1d')]()[_0x8465('0x1c')](function(){var _0x56caa0=_0x33629c['get']({'plain':!![]});var _0x177d6a='Triggers';return db[_0x8465('0x1e')][_0x8465('0x1d')]({'where':{'type':_0x177d6a,'resourceId':_0x56caa0['id']}})[_0x8465('0x1c')](function(){return _0x33629c;});})[_0x8465('0x1c')](function(){_0x3c43ad[_0x8465('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5afeaf,_0x16d651){return function(_0x24955f){if(!_0x24955f){_0x5afeaf[_0x8465('0x1f')](0x194);}return _0x24955f;};}function handleError(_0x1f8037,_0x292359){_0x292359=_0x292359||0x1f4;return function(_0x59e5f5){logger[_0x8465('0x20')](_0x59e5f5[_0x8465('0x21')]);if(_0x59e5f5[_0x8465('0x22')]){delete _0x59e5f5[_0x8465('0x22')];}_0x1f8037[_0x8465('0x11')](_0x292359)[_0x8465('0x23')](_0x59e5f5);};}exports['index']=function(_0x452fed,_0x5ac1ba){var _0x284a2b={},_0x12851c={},_0x18f425={'count':0x0,'rows':[]};var _0x18af2f=_[_0x8465('0x24')](db['Trigger'][_0x8465('0x25')],function(_0x57a79e){return{'name':_0x57a79e[_0x8465('0x26')],'type':_0x57a79e[_0x8465('0x27')][_0x8465('0x28')]};});_0x12851c[_0x8465('0x29')]=_['map'](_0x18af2f,_0x8465('0x22'));_0x12851c[_0x8465('0x2a')]=_[_0x8465('0x2b')](_0x452fed[_0x8465('0x2a')]);_0x12851c['filters']=_[_0x8465('0x2c')](_0x12851c['model'],_0x12851c[_0x8465('0x2a')]);_0x284a2b[_0x8465('0x2d')]=_[_0x8465('0x2c')](_0x12851c[_0x8465('0x29')],qs[_0x8465('0x2e')](_0x452fed[_0x8465('0x2a')]['fields']));_0x284a2b[_0x8465('0x2d')]=_0x284a2b[_0x8465('0x2d')][_0x8465('0x2f')]?_0x284a2b['attributes']:_0x12851c[_0x8465('0x29')];if(!_0x452fed[_0x8465('0x2a')][_0x8465('0x30')]('nolimit')){_0x284a2b[_0x8465('0x15')]=qs[_0x8465('0x15')](_0x452fed[_0x8465('0x2a')][_0x8465('0x15')]);_0x284a2b[_0x8465('0x14')]=qs[_0x8465('0x14')](_0x452fed[_0x8465('0x2a')][_0x8465('0x14')]);}_0x284a2b[_0x8465('0x31')]=qs[_0x8465('0x32')](_0x452fed[_0x8465('0x2a')][_0x8465('0x32')]);_0x284a2b['where']=qs[_0x8465('0x33')](_['pick'](_0x452fed[_0x8465('0x2a')],_0x12851c[_0x8465('0x33')]),_0x18af2f);if(_0x452fed[_0x8465('0x2a')][_0x8465('0x34')]){_0x284a2b[_0x8465('0x35')]=_[_0x8465('0x36')](_0x284a2b[_0x8465('0x35')],{'$or':_[_0x8465('0x24')](_0x18af2f,function(_0x241ccf){if(_0x241ccf['type']!==_0x8465('0x37')){var _0x52fb46={};_0x52fb46[_0x241ccf[_0x8465('0x22')]]={'$like':'%'+_0x452fed[_0x8465('0x2a')][_0x8465('0x34')]+'%'};return _0x52fb46;}})});}_0x284a2b=_['merge']({},_0x284a2b,_0x452fed[_0x8465('0x38')]);var _0x41bd16={'where':_0x284a2b[_0x8465('0x35')]};return db[_0x8465('0x39')][_0x8465('0x13')](_0x41bd16)[_0x8465('0x1c')](function(_0x3f72e2){_0x18f425[_0x8465('0x13')]=_0x3f72e2;if(_0x452fed[_0x8465('0x2a')][_0x8465('0x3a')]){_0x284a2b['include']=[{'all':!![]}];}return db[_0x8465('0x39')][_0x8465('0x3b')](_0x284a2b);})[_0x8465('0x1c')](function(_0x54a77f){_0x18f425[_0x8465('0x3c')]=_0x54a77f;return _0x18f425;})[_0x8465('0x1c')](respondWithFilteredResult(_0x5ac1ba,_0x284a2b))['catch'](handleError(_0x5ac1ba,null));};exports['show']=function(_0x520f39,_0x5326c3){var _0x55b42b={'raw':![],'where':{'id':_0x520f39[_0x8465('0x3d')]['id']}},_0x546814={};_0x546814[_0x8465('0x29')]=_[_0x8465('0x2b')](db[_0x8465('0x39')]['rawAttributes']);_0x546814[_0x8465('0x2a')]=_[_0x8465('0x2b')](_0x520f39[_0x8465('0x2a')]);_0x546814[_0x8465('0x33')]=_[_0x8465('0x2c')](_0x546814[_0x8465('0x29')],_0x546814[_0x8465('0x2a')]);_0x55b42b[_0x8465('0x2d')]=_['intersection'](_0x546814[_0x8465('0x29')],qs[_0x8465('0x2e')](_0x520f39['query'][_0x8465('0x2e')]));_0x55b42b['attributes']=_0x55b42b[_0x8465('0x2d')][_0x8465('0x2f')]?_0x55b42b[_0x8465('0x2d')]:_0x546814[_0x8465('0x29')];if(_0x520f39[_0x8465('0x2a')]['includeAll']){_0x55b42b[_0x8465('0x3e')]=[{'all':!![]}];}_0x55b42b=_['merge']({},_0x55b42b,_0x520f39[_0x8465('0x38')]);return db[_0x8465('0x39')][_0x8465('0x3f')](_0x55b42b)['then'](handleEntityNotFound(_0x5326c3,null))[_0x8465('0x1c')](respondWithResult(_0x5326c3,null))['catch'](handleError(_0x5326c3,null));};exports[_0x8465('0x40')]=function(_0x2f3d7a,_0x3163a8){return db[_0x8465('0x39')][_0x8465('0x40')](_0x2f3d7a[_0x8465('0x41')],{})[_0x8465('0x1c')](function(_0x119ea7){var _0x3f1758=_0x2f3d7a[_0x8465('0x42')][_0x8465('0x43')]({'plain':!![]});if(!_0x3f1758)throw new Error(_0x8465('0x44'));if(_0x3f1758['role']==='user'){var _0x2ac7ec=_0x119ea7[_0x8465('0x43')]({'plain':!![]});var _0x454663=_0x8465('0x45');return db[_0x8465('0x46')][_0x8465('0x3f')]({'where':{'name':_0x454663,'userProfileId':_0x3f1758['userProfileId']},'raw':!![]})[_0x8465('0x1c')](function(_0x28ce94){if(_0x28ce94&&_0x28ce94[_0x8465('0x47')]===0x0){return db['UserProfileResource']['create']({'name':_0x2ac7ec['name'],'resourceId':_0x2ac7ec['id'],'type':_0x28ce94[_0x8465('0x22')],'sectionId':_0x28ce94['id']},{})['then'](function(){return _0x119ea7;});}else{return _0x119ea7;}})[_0x8465('0x48')](function(_0x22fb1c){logger[_0x8465('0x20')](_0x8465('0x49'),_0x22fb1c);throw _0x22fb1c;});}return _0x119ea7;})[_0x8465('0x1c')](respondWithResult(_0x3163a8,0xc9))['catch'](handleError(_0x3163a8,null));};exports[_0x8465('0x1b')]=function(_0x3282aa,_0x25ab17){if(_0x3282aa[_0x8465('0x41')]['id']){delete _0x3282aa[_0x8465('0x41')]['id'];}return db['Trigger'][_0x8465('0x3f')]({'where':{'id':_0x3282aa['params']['id']}})['then'](handleEntityNotFound(_0x25ab17,null))[_0x8465('0x1c')](saveUpdates(_0x3282aa['body'],null))[_0x8465('0x1c')](respondWithResult(_0x25ab17,null))[_0x8465('0x48')](handleError(_0x25ab17,null));};exports['destroy']=function(_0x106bf0,_0x273598){return db['Trigger'][_0x8465('0x3f')]({'where':{'id':_0x106bf0['params']['id']}})[_0x8465('0x1c')](handleEntityNotFound(_0x273598,null))[_0x8465('0x1c')](removeEntity(_0x273598,null))[_0x8465('0x48')](handleError(_0x273598,null));};exports[_0x8465('0x4a')]=function(_0x58589d,_0x2d6092,_0x4ad908){if(_0x58589d[_0x8465('0x41')]['id']){delete _0x58589d[_0x8465('0x41')]['id'];}return db[_0x8465('0x39')][_0x8465('0x3f')]({'where':{'id':_0x58589d['params']['id']}})['then'](handleEntityNotFound(_0x2d6092,null))['then'](function(_0x36b0a0){if(_0x36b0a0){_0x58589d[_0x8465('0x41')][_0x8465('0x4b')]=_0x36b0a0['id'];return db[_0x8465('0x4c')][_0x8465('0x40')](_0x58589d[_0x8465('0x41')]);}})['then'](respondWithResult(_0x2d6092,null))['catch'](handleError(_0x2d6092,null));};exports[_0x8465('0x4d')]=function(_0x1a9246,_0x33bffa,_0x196665){if(_0x1a9246[_0x8465('0x41')]['id']){delete _0x1a9246['body']['id'];}return db[_0x8465('0x39')][_0x8465('0x3f')]({'where':{'id':_0x1a9246[_0x8465('0x3d')]['id']}})['then'](handleEntityNotFound(_0x33bffa,null))[_0x8465('0x1c')](function(_0x2d9762){if(_0x2d9762){_0x1a9246[_0x8465('0x41')][_0x8465('0x4e')]=_0x2d9762['id'];return db[_0x8465('0x4c')][_0x8465('0x40')](_0x1a9246[_0x8465('0x41')]);}})[_0x8465('0x1c')](respondWithResult(_0x33bffa,null))['catch'](handleError(_0x33bffa,null));};exports['getAllConditions']=function(_0x44cc54,_0x1fd642,_0x35fd13){var _0x225260={};var _0x108445={};var _0x58eea0;var _0x42f0b6;return db[_0x8465('0x39')]['findOne']({'where':{'id':_0x44cc54[_0x8465('0x3d')]['id']}})[_0x8465('0x1c')](handleEntityNotFound(_0x1fd642,null))['then'](function(_0x522181){if(_0x522181){_0x58eea0=_0x522181;_0x108445['model']=_[_0x8465('0x2b')](db[_0x8465('0x4c')]['rawAttributes']);_0x108445[_0x8465('0x2a')]=_[_0x8465('0x2b')](_0x44cc54['query']);_0x108445['filters']=_['intersection'](_0x108445[_0x8465('0x29')],_0x108445[_0x8465('0x2a')]);_0x225260[_0x8465('0x2d')]=_[_0x8465('0x2c')](_0x108445[_0x8465('0x29')],qs[_0x8465('0x2e')](_0x44cc54[_0x8465('0x2a')][_0x8465('0x2e')]));_0x225260['attributes']=_0x225260[_0x8465('0x2d')][_0x8465('0x2f')]?_0x225260[_0x8465('0x2d')]:_0x108445[_0x8465('0x29')];_0x225260[_0x8465('0x31')]=qs['sort'](_0x44cc54[_0x8465('0x2a')][_0x8465('0x32')]);_0x225260[_0x8465('0x35')]=qs[_0x8465('0x33')](_[_0x8465('0x4f')](_0x44cc54[_0x8465('0x2a')],_0x108445[_0x8465('0x33')]));if(_0x44cc54[_0x8465('0x2a')][_0x8465('0x34')]){_0x225260[_0x8465('0x35')]=_[_0x8465('0x36')](_0x225260['where'],{'$or':_[_0x8465('0x24')](_0x225260[_0x8465('0x2d')],function(_0x27bf19){var _0x4bb332={};_0x4bb332[_0x27bf19]={'$like':'%'+_0x44cc54[_0x8465('0x2a')][_0x8465('0x34')]+'%'};return _0x4bb332;})});}_0x225260=_['merge']({},_0x225260,_0x44cc54[_0x8465('0x38')]);return _0x58eea0['getAllConditions'](_0x225260);}})['then'](function(_0x3a4ddb){if(_0x3a4ddb){_0x42f0b6=_0x3a4ddb[_0x8465('0x2f')];if(!_0x44cc54[_0x8465('0x2a')]['hasOwnProperty'](_0x8465('0x50'))){_0x225260[_0x8465('0x15')]=qs[_0x8465('0x15')](_0x44cc54[_0x8465('0x2a')][_0x8465('0x15')]);_0x225260[_0x8465('0x14')]=qs['offset'](_0x44cc54[_0x8465('0x2a')][_0x8465('0x14')]);}return _0x58eea0['getAllConditions'](_0x225260);}})[_0x8465('0x1c')](function(_0x260bfd){if(_0x260bfd){return _0x260bfd?{'count':_0x42f0b6,'rows':_0x260bfd}:null;}})['then'](respondWithResult(_0x1fd642,null))[_0x8465('0x48')](handleError(_0x1fd642,null));};exports[_0x8465('0x51')]=function(_0x2ae843,_0x59381e,_0x240f36){var _0x4d5758={};var _0x58579c={};var _0x5799fe;var _0x322448;return db[_0x8465('0x39')][_0x8465('0x52')]({'where':{'id':_0x2ae843['params']['id']}})[_0x8465('0x1c')](handleEntityNotFound(_0x59381e,null))[_0x8465('0x1c')](function(_0x104872){if(_0x104872){_0x5799fe=_0x104872;_0x58579c['model']=_[_0x8465('0x2b')](db[_0x8465('0x4c')][_0x8465('0x25')]);_0x58579c[_0x8465('0x2a')]=_[_0x8465('0x2b')](_0x2ae843[_0x8465('0x2a')]);_0x58579c['filters']=_[_0x8465('0x2c')](_0x58579c['model'],_0x58579c[_0x8465('0x2a')]);_0x4d5758['attributes']=_['intersection'](_0x58579c[_0x8465('0x29')],qs[_0x8465('0x2e')](_0x2ae843[_0x8465('0x2a')][_0x8465('0x2e')]));_0x4d5758[_0x8465('0x2d')]=_0x4d5758[_0x8465('0x2d')][_0x8465('0x2f')]?_0x4d5758[_0x8465('0x2d')]:_0x58579c[_0x8465('0x29')];_0x4d5758['order']=qs[_0x8465('0x32')](_0x2ae843[_0x8465('0x2a')][_0x8465('0x32')]);_0x4d5758[_0x8465('0x35')]=qs[_0x8465('0x33')](_[_0x8465('0x4f')](_0x2ae843[_0x8465('0x2a')],_0x58579c[_0x8465('0x33')]));if(_0x2ae843['query'][_0x8465('0x34')]){_0x4d5758[_0x8465('0x35')]=_[_0x8465('0x36')](_0x4d5758[_0x8465('0x35')],{'$or':_[_0x8465('0x24')](_0x4d5758[_0x8465('0x2d')],function(_0x5023ca){var _0xb6c1e8={};_0xb6c1e8[_0x5023ca]={'$like':'%'+_0x2ae843['query'][_0x8465('0x34')]+'%'};return _0xb6c1e8;})});}_0x4d5758=_[_0x8465('0x36')]({},_0x4d5758,_0x2ae843['options']);return _0x5799fe[_0x8465('0x51')](_0x4d5758);}})[_0x8465('0x1c')](function(_0x4a7010){if(_0x4a7010){_0x322448=_0x4a7010['length'];if(!_0x2ae843[_0x8465('0x2a')][_0x8465('0x30')](_0x8465('0x50'))){_0x4d5758[_0x8465('0x15')]=qs['limit'](_0x2ae843[_0x8465('0x2a')][_0x8465('0x15')]);_0x4d5758[_0x8465('0x14')]=qs[_0x8465('0x14')](_0x2ae843[_0x8465('0x2a')][_0x8465('0x14')]);}return _0x5799fe['getAnyConditions'](_0x4d5758);}})[_0x8465('0x1c')](function(_0x41058b){if(_0x41058b){return _0x41058b?{'count':_0x322448,'rows':_0x41058b}:null;}})[_0x8465('0x1c')](respondWithResult(_0x59381e,null))[_0x8465('0x48')](handleError(_0x59381e,null));};exports[_0x8465('0x53')]=function(_0x6a7381,_0x3463bd,_0xb2a52d){if(_0x6a7381[_0x8465('0x41')]['id']){delete _0x6a7381[_0x8465('0x41')]['id'];}return db['Trigger'][_0x8465('0x3f')]({'where':{'id':_0x6a7381[_0x8465('0x3d')]['id']}})[_0x8465('0x1c')](handleEntityNotFound(_0x3463bd,null))['then'](function(_0x3d3792){if(_0x3d3792){_0x6a7381[_0x8465('0x41')]['TriggerId']=_0x3d3792['id'];return db[_0x8465('0x54')][_0x8465('0x40')](_0x6a7381[_0x8465('0x41')]);}})[_0x8465('0x1c')](respondWithResult(_0x3463bd,null))[_0x8465('0x48')](handleError(_0x3463bd,null));};exports[_0x8465('0x55')]=function(_0x435010,_0x10d352,_0x51b836){var _0x2ee7b0={};var _0xa7aaf8={};var _0x1cba34;var _0x2d3eb7;return db[_0x8465('0x39')]['findOne']({'where':{'id':_0x435010['params']['id']}})[_0x8465('0x1c')](handleEntityNotFound(_0x10d352,null))[_0x8465('0x1c')](function(_0x382d60){if(_0x382d60){_0x1cba34=_0x382d60;_0xa7aaf8[_0x8465('0x29')]=_[_0x8465('0x2b')](db[_0x8465('0x54')]['rawAttributes']);_0xa7aaf8[_0x8465('0x2a')]=_['keys'](_0x435010['query']);_0xa7aaf8['filters']=_['intersection'](_0xa7aaf8[_0x8465('0x29')],_0xa7aaf8[_0x8465('0x2a')]);_0x2ee7b0['attributes']=_[_0x8465('0x2c')](_0xa7aaf8[_0x8465('0x29')],qs[_0x8465('0x2e')](_0x435010[_0x8465('0x2a')]['fields']));_0x2ee7b0[_0x8465('0x2d')]=_0x2ee7b0['attributes'][_0x8465('0x2f')]?_0x2ee7b0[_0x8465('0x2d')]:_0xa7aaf8[_0x8465('0x29')];_0x2ee7b0[_0x8465('0x31')]=qs[_0x8465('0x32')](_0x435010[_0x8465('0x2a')][_0x8465('0x32')]);_0x2ee7b0['where']=qs[_0x8465('0x33')](_[_0x8465('0x4f')](_0x435010[_0x8465('0x2a')],_0xa7aaf8[_0x8465('0x33')]));if(_0x435010['query'][_0x8465('0x34')]){_0x2ee7b0['where']=_[_0x8465('0x36')](_0x2ee7b0[_0x8465('0x35')],{'$or':_[_0x8465('0x24')](_0x2ee7b0[_0x8465('0x2d')],function(_0x2a42ed){var _0x5990ee={};_0x5990ee[_0x2a42ed]={'$like':'%'+_0x435010[_0x8465('0x2a')][_0x8465('0x34')]+'%'};return _0x5990ee;})});}_0x2ee7b0=_[_0x8465('0x36')]({},_0x2ee7b0,_0x435010[_0x8465('0x38')]);return _0x1cba34[_0x8465('0x55')](_0x2ee7b0);}})[_0x8465('0x1c')](function(_0x851d7b){if(_0x851d7b){_0x2d3eb7=_0x851d7b[_0x8465('0x2f')];if(!_0x435010[_0x8465('0x2a')][_0x8465('0x30')](_0x8465('0x50'))){_0x2ee7b0[_0x8465('0x15')]=qs['limit'](_0x435010['query'][_0x8465('0x15')]);_0x2ee7b0['offset']=qs[_0x8465('0x14')](_0x435010[_0x8465('0x2a')][_0x8465('0x14')]);}return _0x1cba34['getActions'](_0x2ee7b0);}})[_0x8465('0x1c')](function(_0x4f99aa){if(_0x4f99aa){return _0x4f99aa?{'count':_0x2d3eb7,'rows':_0x4f99aa}:null;}})[_0x8465('0x1c')](respondWithResult(_0x10d352,null))[_0x8465('0x48')](handleError(_0x10d352,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 95d0a75..5907afb 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 _0x5f66=['request-promise','path','../../config/environment','exports','Trigger','tools_triggers','util','api','moment','bluebird'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5f66[_0x5f0089];return _0x193892;};'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 +var _0xdb28=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','Trigger','tools_triggers','lodash','util'];(function(_0x5d772d,_0x318fc3){var _0x529bbc=function(_0x20c047){while(--_0x20c047){_0x5d772d['push'](_0x5d772d['shift']());}};_0x529bbc(++_0x318fc3);}(_0xdb28,0x106));var _0x8db2=function(_0x5e31fd,_0x56fbaf){_0x5e31fd=_0x5e31fd-0x0;var _0x590238=_0xdb28[_0x5e31fd];return _0x590238;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./trigger.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index e68d5de..bfeaf0a 100644 --- a/server/api/trigger/trigger.rpc.js +++ b/server/api/trigger/trigger.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf45e=['options','raw','where','attributes','limit','include','model','map','Trigger','find','ShowTrigger','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','findAll'];(function(_0x9b21a7,_0x1c9566){var _0x573370=function(_0x569f24){while(--_0x569f24){_0x9b21a7['push'](_0x9b21a7['shift']());}};_0x573370(++_0x1c9566);}(_0xf45e,0x115));var _0xef45=function(_0x1b1d60,_0x515fe2){_0x1b1d60=_0x1b1d60-0x0;var _0x4c385b=_0xf45e[_0x1b1d60];return _0x4c385b;};'use strict';var _=require(_0xef45('0x0'));var util=require('util');var moment=require(_0xef45('0x1'));var BPromise=require('bluebird');var rs=require(_0xef45('0x2'));var fs=require('fs');var Redis=require(_0xef45('0x3'));var db=require(_0xef45('0x4'))['db'];var utils=require(_0xef45('0x5'));var logger=require(_0xef45('0x6'))(_0xef45('0x7'));var config=require(_0xef45('0x8'));var jayson=require(_0xef45('0x9'));var client=jayson[_0xef45('0xa')][_0xef45('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f2e92,_0x3303ad,_0x1a68c4){return new BPromise(function(_0x1e0def,_0x268ef6){return client[_0xef45('0xc')](_0x2f2e92,_0x1a68c4)[_0xef45('0xd')](function(_0x158a0b){logger[_0xef45('0xe')]('Trigger,\x20%s,\x20%s',_0x3303ad,_0xef45('0xf'));logger[_0xef45('0x10')](_0xef45('0x11'),_0x3303ad,_0xef45('0xf'),JSON[_0xef45('0x12')](_0x158a0b));if(_0x158a0b[_0xef45('0x13')]){if(_0x158a0b['error'][_0xef45('0x14')]===0x1f4){logger[_0xef45('0x13')](_0xef45('0x15'),_0x3303ad,_0x158a0b[_0xef45('0x13')][_0xef45('0x16')]);return _0x268ef6(_0x158a0b['error']['message']);}logger[_0xef45('0x13')]('Trigger,\x20%s,\x20%s',_0x3303ad,_0x158a0b[_0xef45('0x13')][_0xef45('0x16')]);return _0x1e0def(_0x158a0b[_0xef45('0x13')]['message']);}else{logger['info'](_0xef45('0x15'),_0x3303ad,'request\x20sent');_0x1e0def(_0x158a0b[_0xef45('0x17')][_0xef45('0x16')]);}})[_0xef45('0x18')](function(_0x3f40e5){logger['error']('Trigger,\x20%s,\x20%s',_0x3303ad,_0x3f40e5);_0x268ef6(_0x3f40e5);});});}exports[_0xef45('0x19')]=function(_0x219778){var _0x3ba1f4=this;return new Promise(function(_0x258785,_0x4ca902){return db['Trigger'][_0xef45('0x1a')]({'raw':_0x219778[_0xef45('0x1b')]?_0x219778[_0xef45('0x1b')][_0xef45('0x1c')]===undefined?!![]:![]:!![],'where':_0x219778[_0xef45('0x1b')]?_0x219778[_0xef45('0x1b')][_0xef45('0x1d')]||null:null,'attributes':_0x219778['options']?_0x219778[_0xef45('0x1b')][_0xef45('0x1e')]||null:null,'limit':_0x219778[_0xef45('0x1b')]?_0x219778[_0xef45('0x1b')][_0xef45('0x1f')]||null:null,'include':_0x219778['options']?_0x219778[_0xef45('0x1b')]['include']?_['map'](_0x219778[_0xef45('0x1b')][_0xef45('0x20')],function(_0xbb859b){return{'model':db[_0xbb859b[_0xef45('0x21')]],'as':_0xbb859b['as'],'attributes':_0xbb859b[_0xef45('0x1e')],'include':_0xbb859b[_0xef45('0x20')]?_[_0xef45('0x22')](_0xbb859b['include'],function(_0x208b35){return{'model':db[_0x208b35['model']],'as':_0x208b35['as'],'attributes':_0x208b35[_0xef45('0x1e')],'include':_0x208b35[_0xef45('0x20')]?_['map'](_0x208b35[_0xef45('0x20')],function(_0x2c356d){return{'model':db[_0x2c356d['model']],'as':_0x2c356d['as'],'attributes':_0x2c356d[_0xef45('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x550e18){logger['info']('GetTrigger',_0x219778);logger[_0xef45('0x10')](_0xef45('0x19'),_0x219778,JSON[_0xef45('0x12')](_0x550e18));_0x258785(_0x550e18);})[_0xef45('0x18')](function(_0x5782d0){logger[_0xef45('0x13')]('GetTrigger',_0x5782d0[_0xef45('0x16')],_0x219778);_0x4ca902(_0x3ba1f4['error'](0x1f4,_0x5782d0[_0xef45('0x16')]));});});};exports['ShowTrigger']=function(_0x575734){var _0x14ce5a=this;return new Promise(function(_0x3e45de,_0x390a7a){return db[_0xef45('0x23')][_0xef45('0x24')]({'raw':_0x575734['options']?_0x575734['options']['raw']===undefined?!![]:![]:!![],'where':_0x575734[_0xef45('0x1b')]?_0x575734[_0xef45('0x1b')][_0xef45('0x1d')]||null:null,'attributes':_0x575734[_0xef45('0x1b')]?_0x575734[_0xef45('0x1b')][_0xef45('0x1e')]||null:null,'include':_0x575734[_0xef45('0x1b')]?_0x575734['options']['include']?_[_0xef45('0x22')](_0x575734['options'][_0xef45('0x20')],function(_0x5116b0){return{'model':db[_0x5116b0[_0xef45('0x21')]],'as':_0x5116b0['as'],'attributes':_0x5116b0[_0xef45('0x1e')],'include':_0x5116b0[_0xef45('0x20')]?_[_0xef45('0x22')](_0x5116b0[_0xef45('0x20')],function(_0x5b7d73){return{'model':db[_0x5b7d73[_0xef45('0x21')]],'as':_0x5b7d73['as'],'attributes':_0x5b7d73[_0xef45('0x1e')],'include':_0x5b7d73[_0xef45('0x20')]?_['map'](_0x5b7d73['include'],function(_0x787387){return{'model':db[_0x787387[_0xef45('0x21')]],'as':_0x787387['as'],'attributes':_0x787387['attributes']};}):[]};}):[]};}):[]:[]})[_0xef45('0xd')](function(_0x501eb3){logger['info'](_0xef45('0x25'),_0x575734);logger[_0xef45('0x10')](_0xef45('0x25'),_0x575734,JSON['stringify'](_0x501eb3));_0x3e45de(_0x501eb3);})[_0xef45('0x18')](function(_0x3a1bcc){logger[_0xef45('0x13')](_0xef45('0x25'),_0x3a1bcc['message'],_0x575734);_0x390a7a(_0x14ce5a['error'](0x1f4,_0x3a1bcc[_0xef45('0x16')]));});});}; \ No newline at end of file +var _0xab40=['Trigger,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','Trigger','findAll','options','limit','include','model','map','attributes','GetTrigger','ShowTrigger','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','Trigger,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x223c43,_0x4e8534){var _0x29ad06=function(_0x3af61a){while(--_0x3af61a){_0x223c43['push'](_0x223c43['shift']());}};_0x29ad06(++_0x4e8534);}(_0xab40,0xcd));var _0x0ab4=function(_0x4d9d9f,_0x2fd082){_0x4d9d9f=_0x4d9d9f-0x0;var _0x129bb5=_0xab40[_0x4d9d9f];return _0x129bb5;};'use strict';var _=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ab4('0x2'));var db=require(_0x0ab4('0x3'))['db'];var utils=require(_0x0ab4('0x4'));var logger=require(_0x0ab4('0x5'))(_0x0ab4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0ab4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10d92b,_0x46d16a,_0x11e99f){return new BPromise(function(_0x6d135d,_0x4cf8de){return client['request'](_0x10d92b,_0x11e99f)['then'](function(_0x24271e){logger[_0x0ab4('0x8')](_0x0ab4('0x9'),_0x46d16a,_0x0ab4('0xa'));logger[_0x0ab4('0xb')](_0x0ab4('0xc'),_0x46d16a,_0x0ab4('0xa'),JSON[_0x0ab4('0xd')](_0x24271e));if(_0x24271e['error']){if(_0x24271e['error'][_0x0ab4('0xe')]===0x1f4){logger['error'](_0x0ab4('0x9'),_0x46d16a,_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);return _0x4cf8de(_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);}logger[_0x0ab4('0xf')](_0x0ab4('0x9'),_0x46d16a,_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);return _0x6d135d(_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);}else{logger[_0x0ab4('0x8')](_0x0ab4('0x9'),_0x46d16a,_0x0ab4('0xa'));_0x6d135d(_0x24271e[_0x0ab4('0x11')][_0x0ab4('0x10')]);}})[_0x0ab4('0x12')](function(_0x2bdda7){logger['error']('Trigger,\x20%s,\x20%s',_0x46d16a,_0x2bdda7);_0x4cf8de(_0x2bdda7);});});}exports['GetTrigger']=function(_0x17422f){var _0x30d5df=this;return new Promise(function(_0x2f50d2,_0x53723c){return db[_0x0ab4('0x13')][_0x0ab4('0x14')]({'raw':_0x17422f[_0x0ab4('0x15')]?_0x17422f[_0x0ab4('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x17422f['options']?_0x17422f[_0x0ab4('0x15')]['where']||null:null,'attributes':_0x17422f[_0x0ab4('0x15')]?_0x17422f[_0x0ab4('0x15')]['attributes']||null:null,'limit':_0x17422f[_0x0ab4('0x15')]?_0x17422f[_0x0ab4('0x15')][_0x0ab4('0x16')]||null:null,'include':_0x17422f[_0x0ab4('0x15')]?_0x17422f[_0x0ab4('0x15')]['include']?_['map'](_0x17422f[_0x0ab4('0x15')][_0x0ab4('0x17')],function(_0x392afe){return{'model':db[_0x392afe[_0x0ab4('0x18')]],'as':_0x392afe['as'],'attributes':_0x392afe['attributes'],'include':_0x392afe[_0x0ab4('0x17')]?_[_0x0ab4('0x19')](_0x392afe[_0x0ab4('0x17')],function(_0x4ea9aa){return{'model':db[_0x4ea9aa['model']],'as':_0x4ea9aa['as'],'attributes':_0x4ea9aa[_0x0ab4('0x1a')],'include':_0x4ea9aa[_0x0ab4('0x17')]?_[_0x0ab4('0x19')](_0x4ea9aa['include'],function(_0x519b23){return{'model':db[_0x519b23['model']],'as':_0x519b23['as'],'attributes':_0x519b23[_0x0ab4('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bf844){logger[_0x0ab4('0x8')]('GetTrigger',_0x17422f);logger['debug']('GetTrigger',_0x17422f,JSON[_0x0ab4('0xd')](_0x3bf844));_0x2f50d2(_0x3bf844);})[_0x0ab4('0x12')](function(_0x1cfdad){logger[_0x0ab4('0xf')](_0x0ab4('0x1b'),_0x1cfdad['message'],_0x17422f);_0x53723c(_0x30d5df['error'](0x1f4,_0x1cfdad['message']));});});};exports[_0x0ab4('0x1c')]=function(_0x2b66d5){var _0x155d96=this;return new Promise(function(_0x182bbe,_0x46eda7){return db['Trigger']['find']({'raw':_0x2b66d5[_0x0ab4('0x15')]?_0x2b66d5[_0x0ab4('0x15')][_0x0ab4('0x1d')]===undefined?!![]:![]:!![],'where':_0x2b66d5['options']?_0x2b66d5['options'][_0x0ab4('0x1e')]||null:null,'attributes':_0x2b66d5['options']?_0x2b66d5[_0x0ab4('0x15')][_0x0ab4('0x1a')]||null:null,'include':_0x2b66d5[_0x0ab4('0x15')]?_0x2b66d5[_0x0ab4('0x15')][_0x0ab4('0x17')]?_[_0x0ab4('0x19')](_0x2b66d5['options'][_0x0ab4('0x17')],function(_0x4696fc){return{'model':db[_0x4696fc[_0x0ab4('0x18')]],'as':_0x4696fc['as'],'attributes':_0x4696fc[_0x0ab4('0x1a')],'include':_0x4696fc['include']?_['map'](_0x4696fc[_0x0ab4('0x17')],function(_0x3e65a1){return{'model':db[_0x3e65a1[_0x0ab4('0x18')]],'as':_0x3e65a1['as'],'attributes':_0x3e65a1['attributes'],'include':_0x3e65a1['include']?_['map'](_0x3e65a1[_0x0ab4('0x17')],function(_0x35eab3){return{'model':db[_0x35eab3[_0x0ab4('0x18')]],'as':_0x35eab3['as'],'attributes':_0x35eab3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x492943){logger[_0x0ab4('0x8')](_0x0ab4('0x1c'),_0x2b66d5);logger[_0x0ab4('0xb')](_0x0ab4('0x1c'),_0x2b66d5,JSON[_0x0ab4('0xd')](_0x492943));_0x182bbe(_0x492943);})[_0x0ab4('0x12')](function(_0x52d9bf){logger[_0x0ab4('0xf')](_0x0ab4('0x1c'),_0x52d9bf[_0x0ab4('0x10')],_0x2b66d5);_0x46eda7(_0x155d96['error'](0x1f4,_0x52d9bf[_0x0ab4('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 5f59eaa..6fb4211 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 _0x7217=['./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2bdf2a,_0x55222b){var _0x2b2761=function(_0x23bdfa){while(--_0x23bdfa){_0x2bdf2a['push'](_0x2bdf2a['shift']());}};_0x2b2761(++_0x55222b);}(_0x7217,0x19e));var _0x7721=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x7217[_0xf71120];return _0xbe2fd3;};'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('0xc')](_0x7721('0xd'),auth[_0x7721('0x8')](),controller[_0x7721('0xe')]);router[_0x7721('0xc')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0xf')]);router['put'](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x10')]);router[_0x7721('0x11')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x12')]);module[_0x7721('0x13')]=router; \ No newline at end of file +var _0x7bae=['index','/:id','show','post','/:id/clone','clone','create','put','update','delete','exports','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated'];(function(_0x492519,_0x360b07){var _0x4c1f23=function(_0x406783){while(--_0x406783){_0x492519['push'](_0x492519['shift']());}};_0x4c1f23(++_0x360b07);}(_0x7bae,0x13b));var _0xe7ba=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x7bae[_0x166742];return _0xb7814a;};'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('0xb')](_0xe7ba('0xc'),auth[_0xe7ba('0x7')](),controller[_0xe7ba('0xd')]);router['post']('/',auth[_0xe7ba('0x7')](),controller[_0xe7ba('0xe')]);router[_0xe7ba('0xf')](_0xe7ba('0x9'),auth[_0xe7ba('0x7')](),controller[_0xe7ba('0x10')]);router[_0xe7ba('0x11')](_0xe7ba('0x9'),auth[_0xe7ba('0x7')](),controller['destroy']);module[_0xe7ba('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index c533fcc..419058c 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 _0x447a=['yes','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','ulaw;alaw;gsm','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','INTEGER','originate','uas','pai','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','user','peer','friend','ALLOWED_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','rfc2833','info','shortinfo','inband','auto','nonat','update','outgoing'];(function(_0x8f551b,_0x2d76eb){var _0x285bfb=function(_0x4b75c6){while(--_0x4b75c6){_0x8f551b['push'](_0x8f551b['shift']());}};_0x285bfb(++_0x2d76eb);}(_0x447a,0x1be));var _0xa447=function(_0x1188a8,_0xc1498d){_0x1188a8=_0x1188a8-0x0;var _0x50c1c1=_0x447a[_0x1188a8];return _0x50c1c1;};'use strict';var Sequelize=require(_0xa447('0x0'));module[_0xa447('0x1')]={'name':{'type':Sequelize[_0xa447('0x2')],'allowNull':![],'unique':_0xa447('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xa447('0x4')]('friend',_0xa447('0x5'),_0xa447('0x6')),'allowNull':![],'defaultValue':_0xa447('0x7')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xa447('0x4')](_0xa447('0x8'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED',_0xa447('0x9'),'PROHIB_FAILED_SCREEN',_0xa447('0xa'))},'deny':{'type':Sequelize[_0xa447('0x2')]},'permit':{'type':Sequelize[_0xa447('0x2')]},'secret':{'type':Sequelize[_0xa447('0x2')]},'md5secret':{'type':Sequelize[_0xa447('0x2')]},'remotesecret':{'type':Sequelize[_0xa447('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xa447('0xb'),'set':function(_0x3e6ec8){this[_0xa447('0xc')](_0xa447('0xd'),_0x3e6ec8?_0x3e6ec8[_0xa447('0xe')](','):null);},'get':function(){return this[_0xa447('0xf')](_0xa447('0xd'))?this[_0xa447('0xf')](_0xa447('0xd'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xa447('0x4')](_0xa447('0x10'),_0xa447('0x11'),_0xa447('0x12'),_0xa447('0x13'),_0xa447('0x14')),'defaultValue':_0xa447('0x10')},'directmedia':{'type':Sequelize[_0xa447('0x4')]('yes','no',_0xa447('0x15'),_0xa447('0x16'),_0xa447('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xa447('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa447('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x47c7bf){this[_0xa447('0xc')]('nat',_0x47c7bf?_0x47c7bf[_0xa447('0xe')](','):null);},'get':function(){return this[_0xa447('0xf')](_0xa447('0x19'))?this[_0xa447('0xf')](_0xa447('0x19'))[_0xa447('0x1a')](','):null;},'comment':_0xa447('0x1b')},'callgroup':{'type':Sequelize[_0xa447('0x2')]},'namedcallgroup':{'type':Sequelize[_0xa447('0x2')]},'pickupgroup':{'type':Sequelize[_0xa447('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xa447('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xa447('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x551639){this['setDataValue'](_0xa447('0x1c'),_0x551639?_0x551639['join'](';'):_0xa447('0x1d'));},'get':function(){return this[_0xa447('0xf')](_0xa447('0x1c'))?this[_0xa447('0xf')]('allow')[_0xa447('0x1a')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xa447('0x4')](_0xa447('0x18'),'no')},'insecure':{'type':Sequelize[_0xa447('0x2')],'defaultValue':_0xa447('0x1e'),'set':function(_0x3e5578){this[_0xa447('0xc')](_0xa447('0x1f'),_0x3e5578?_0x3e5578['join'](','):null);},'get':function(){return this['getDataValue'](_0xa447('0x1f'))?this[_0xa447('0xf')](_0xa447('0x1f'))[_0xa447('0x1a')](','):null;},'comment':_0xa447('0x20')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xa447('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa447('0x4')]('yes','no',_0xa447('0x21'))},'promiscredir':{'type':Sequelize[_0xa447('0x4')](_0xa447('0x18'),'no')},'useclientcode':{'type':Sequelize[_0xa447('0x4')](_0xa447('0x18'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xa447('0x2')]},'callerid':{'type':Sequelize[_0xa447('0x2')],'defaultValue':_0xa447('0x22')},'amaflags':{'type':Sequelize[_0xa447('0x2')]},'callcounter':{'type':Sequelize[_0xa447('0x4')](_0xa447('0x18'),'no'),'defaultValue':_0xa447('0x18')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xa447('0x4')](_0xa447('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0xa447('0x4')](_0xa447('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0xa447('0x4')](_0xa447('0x18'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xa447('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0xa447('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize['ENUM'](_0xa447('0x18'),'no',_0xa447('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa447('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xa447('0x4')](_0xa447('0x18'),'no')},'mailbox':{'type':Sequelize[_0xa447('0x2')]},'session_timers':{'type':Sequelize[_0xa447('0x4')]('accept','refuse',_0xa447('0x25'))},'session_expires':{'type':Sequelize[_0xa447('0x24')](0xb)},'session_minse':{'type':Sequelize[_0xa447('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0xa447('0x4')]('uac',_0xa447('0x26')),'defaultValue':_0xa447('0x26')},'t38pt_usertpsource':{'type':Sequelize[_0xa447('0x2')]},'regexten':{'type':Sequelize[_0xa447('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xa447('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xa447('0x4')](_0xa447('0x18'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xa447('0x24')](0xb)},'defaultip':{'type':Sequelize[_0xa447('0x2')]},'defaultuser':{'type':Sequelize[_0xa447('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xa447('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xa447('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0xa447('0x4')](_0xa447('0x18'),'no',_0xa447('0x27')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa447('0x2')]},'callbackextension':{'type':Sequelize[_0xa447('0x2')]},'timert1':{'type':Sequelize[_0xa447('0x24')](0xb)},'timerb':{'type':Sequelize[_0xa447('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0xa447('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0xa447('0x2')]},'contactdeny':{'type':Sequelize[_0xa447('0x2')]},'contactacl':{'type':Sequelize[_0xa447('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xa447('0x2')]},'use_q850_reason':{'type':Sequelize[_0xa447('0x2')]},'maxforwards':{'type':Sequelize[_0xa447('0x24')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xa447('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa447('0x4')]('yes','no')},'force_avp':{'type':Sequelize[_0xa447('0x4')](_0xa447('0x18'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xa447('0x18'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize[_0xa447('0x4')](_0xa447('0x18'),'no','fingerprint',_0xa447('0x28'))},'dtlsrekey':{'type':Sequelize[_0xa447('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0xa447('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xa447('0x2')]},'dtlscipher':{'type':Sequelize[_0xa447('0x2')]},'dtlscafile':{'type':Sequelize[_0xa447('0x2')]},'dtlscapath':{'type':Sequelize[_0xa447('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xa447('0x29'),_0xa447('0x2a'),_0xa447('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa447('0x2')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa447('0x2')]},'recordofffeature':{'type':Sequelize[_0xa447('0x2')]},'call_limit':{'type':Sequelize[_0xa447('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xa447('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0xa447('0x4')](_0xa447('0x18'),'no')},'vmexten':{'type':Sequelize[_0xa447('0x2')]},'mohinterpret':{'type':Sequelize[_0xa447('0x2')]},'mohsuggest':{'type':Sequelize[_0xa447('0x2')]},'parkinglot':{'type':Sequelize[_0xa447('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xa447('0x2')],'defaultValue':_0xa447('0x2c')},'canreinvite':{'type':Sequelize[_0xa447('0x4')](_0xa447('0x18'),'no','nonat','update',_0xa447('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xa447('0x2')]},'otherFields':{'type':Sequelize[_0xa447('0x2')]},'active':{'type':Sequelize[_0xa447('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xa447('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0xd6d4=['ENUM','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','nonat','update','outgoing','yes','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\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','uac','uas','fingerprint','certificate','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','STRING','name'];(function(_0x3cdcf0,_0x119e86){var _0x53fd35=function(_0x50f2cf){while(--_0x50f2cf){_0x3cdcf0['push'](_0x3cdcf0['shift']());}};_0x53fd35(++_0x119e86);}(_0xd6d4,0x65));var _0x4d6d=function(_0x3a54a5,_0xa8d4a8){_0x3a54a5=_0x3a54a5-0x0;var _0x7fa0d8=_0xd6d4[_0x3a54a5];return _0x7fa0d8;};'use strict';var Sequelize=require(_0x4d6d('0x0'));module['exports']={'name':{'type':Sequelize[_0x4d6d('0x1')],'allowNull':![],'unique':_0x4d6d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4d6d('0x3')](_0x4d6d('0x4'),_0x4d6d('0x5'),_0x4d6d('0x6')),'allowNull':![],'defaultValue':_0x4d6d('0x4')},'context':{'type':Sequelize[_0x4d6d('0x1')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x4d6d('0x3')](_0x4d6d('0x7'),_0x4d6d('0x8'),'ALLOWED_FAILED_SCREEN',_0x4d6d('0x9'),_0x4d6d('0xa'),_0x4d6d('0xb'),_0x4d6d('0xc'),_0x4d6d('0xd'))},'deny':{'type':Sequelize[_0x4d6d('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x4d6d('0x1')]},'remotesecret':{'type':Sequelize[_0x4d6d('0x1')]},'transport':{'type':Sequelize[_0x4d6d('0x1')],'defaultValue':_0x4d6d('0xe'),'set':function(_0x55f354){this[_0x4d6d('0xf')](_0x4d6d('0x10'),_0x55f354?_0x55f354[_0x4d6d('0x11')](','):null);},'get':function(){return this[_0x4d6d('0x12')](_0x4d6d('0x10'))?this[_0x4d6d('0x12')]('transport')[_0x4d6d('0x13')](','):null;},'comment':_0x4d6d('0x14')},'dtmfmode':{'type':Sequelize[_0x4d6d('0x3')](_0x4d6d('0x15'),_0x4d6d('0x16'),'shortinfo',_0x4d6d('0x17'),'auto'),'defaultValue':_0x4d6d('0x15')},'directmedia':{'type':Sequelize[_0x4d6d('0x3')]('yes','no',_0x4d6d('0x18'),_0x4d6d('0x19'),_0x4d6d('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x4d6d('0x3')](_0x4d6d('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x4d6d('0x1')],'defaultValue':_0x4d6d('0x1c'),'set':function(_0x48b879){this[_0x4d6d('0xf')](_0x4d6d('0x1d'),_0x48b879?_0x48b879[_0x4d6d('0x11')](','):null);},'get':function(){return this[_0x4d6d('0x12')](_0x4d6d('0x1d'))?this['getDataValue'](_0x4d6d('0x1d'))[_0x4d6d('0x13')](','):null;},'comment':_0x4d6d('0x1e')},'callgroup':{'type':Sequelize[_0x4d6d('0x1')]},'namedcallgroup':{'type':Sequelize[_0x4d6d('0x1')]},'pickupgroup':{'type':Sequelize[_0x4d6d('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x4d6d('0x1')]},'language':{'type':Sequelize[_0x4d6d('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x4d6d('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x4d6d('0x1f')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4d6d('0x20'),'set':function(_0x335c3f){this[_0x4d6d('0xf')]('allow',_0x335c3f?_0x335c3f[_0x4d6d('0x11')](';'):_0x4d6d('0x20'));},'get':function(){return this[_0x4d6d('0x12')](_0x4d6d('0x21'))?this[_0x4d6d('0x12')](_0x4d6d('0x21'))['split'](';'):null;},'comment':_0x4d6d('0x22')},'autoframing':{'type':Sequelize[_0x4d6d('0x3')](_0x4d6d('0x1b'),'no')},'insecure':{'type':Sequelize[_0x4d6d('0x1')],'defaultValue':_0x4d6d('0x23'),'set':function(_0x21964b){this[_0x4d6d('0xf')](_0x4d6d('0x24'),_0x21964b?_0x21964b[_0x4d6d('0x11')](','):null);},'get':function(){return this[_0x4d6d('0x12')](_0x4d6d('0x24'))?this['getDataValue'](_0x4d6d('0x24'))[_0x4d6d('0x13')](','):null;},'comment':_0x4d6d('0x25')},'trustrpid':{'type':Sequelize['ENUM'](_0x4d6d('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x4d6d('0x3')](_0x4d6d('0x1b'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x4d6d('0x3')]('yes','no',_0x4d6d('0x26'))},'promiscredir':{'type':Sequelize[_0x4d6d('0x3')](_0x4d6d('0x1b'),'no')},'useclientcode':{'type':Sequelize[_0x4d6d('0x3')]('yes','no')},'accountcode':{'type':Sequelize[_0x4d6d('0x27')](0xb)},'setvar':{'type':Sequelize[_0x4d6d('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x4d6d('0x28')},'amaflags':{'type':Sequelize[_0x4d6d('0x1')]},'callcounter':{'type':Sequelize[_0x4d6d('0x3')](_0x4d6d('0x1b'),'no'),'defaultValue':_0x4d6d('0x1b')},'busylevel':{'type':Sequelize[_0x4d6d('0x27')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x4d6d('0x1b'),'no')},'allowsubscribe':{'type':Sequelize[_0x4d6d('0x3')](_0x4d6d('0x1b'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x4d6d('0x1b'),'no')},'ignoresdpversion':{'type':Sequelize[_0x4d6d('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x4d6d('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0x4d6d('0x1b'),'no',_0x4d6d('0x29')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x4d6d('0x3')](_0x4d6d('0x1b'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x4d6d('0x3')](_0x4d6d('0x2a'),'refuse','originate')},'session_expires':{'type':Sequelize[_0x4d6d('0x27')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x4d6d('0x3')](_0x4d6d('0x2b'),'uas'),'defaultValue':_0x4d6d('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0x4d6d('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x4d6d('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x4d6d('0x3')](_0x4d6d('0x1b'),'no'),'defaultValue':_0x4d6d('0x1b')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x4d6d('0x1')]},'defaultuser':{'type':Sequelize[_0x4d6d('0x1')]},'rtptimeout':{'type':Sequelize[_0x4d6d('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x4d6d('0x27')](0xb)},'sendrpid':{'type':Sequelize[_0x4d6d('0x3')](_0x4d6d('0x1b'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x4d6d('0x1')]},'callbackextension':{'type':Sequelize[_0x4d6d('0x1')]},'timert1':{'type':Sequelize[_0x4d6d('0x27')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x4d6d('0x27')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x4d6d('0x1')]},'contactacl':{'type':Sequelize[_0x4d6d('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x4d6d('0x1')]},'use_q850_reason':{'type':Sequelize[_0x4d6d('0x1')]},'maxforwards':{'type':Sequelize[_0x4d6d('0x27')](0xb)},'encryption':{'type':Sequelize[_0x4d6d('0x3')](_0x4d6d('0x1b'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x4d6d('0x3')](_0x4d6d('0x1b'),'no')},'force_avp':{'type':Sequelize[_0x4d6d('0x3')](_0x4d6d('0x1b'),'no')},'icesupport':{'type':Sequelize[_0x4d6d('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x4d6d('0x3')](_0x4d6d('0x1b'),'no')},'dtlsverify':{'type':Sequelize[_0x4d6d('0x3')]('yes','no',_0x4d6d('0x2d'),_0x4d6d('0x2e'))},'dtlsrekey':{'type':Sequelize[_0x4d6d('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0x4d6d('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x4d6d('0x1')]},'dtlscipher':{'type':Sequelize[_0x4d6d('0x1')]},'dtlscafile':{'type':Sequelize[_0x4d6d('0x1')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x4d6d('0x3')]('active',_0x4d6d('0x2f'),_0x4d6d('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x4d6d('0x1')]},'usereqphone':{'type':Sequelize['ENUM'](_0x4d6d('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x4d6d('0x1')]},'recordofffeature':{'type':Sequelize[_0x4d6d('0x1')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x4d6d('0x1b'),'no')},'vmexten':{'type':Sequelize[_0x4d6d('0x1')]},'mohinterpret':{'type':Sequelize[_0x4d6d('0x1')]},'mohsuggest':{'type':Sequelize[_0x4d6d('0x1')]},'parkinglot':{'type':Sequelize[_0x4d6d('0x1')]},'description':{'type':Sequelize[_0x4d6d('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x4d6d('0x31')},'canreinvite':{'type':Sequelize[_0x4d6d('0x3')](_0x4d6d('0x1b'),'no','nonat',_0x4d6d('0x19'),_0x4d6d('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x4d6d('0x1')]},'otherFields':{'type':Sequelize[_0x4d6d('0x1')]},'active':{'type':Sequelize[_0x4d6d('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index a1bfa6c..48e7a5f 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 _0x34ab=['omit','createdAt','updatedAt','body','create','get','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','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','user','UserProfileSection','Trunks','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','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','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','destroy','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','model','query','filters','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Trunk','includeAll','include','findAll','show','params','keys','intersection','find','clone'];(function(_0x499b58,_0x3af450){var _0x28b93b=function(_0x573dc9){while(--_0x573dc9){_0x499b58['push'](_0x499b58['shift']());}};_0x28b93b(++_0x3af450);}(_0x34ab,0x169));var _0xb34a=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0x34ab[_0x54b283];return _0x2462b3;};'use strict';var pdf=require(_0xb34a('0x0'));var emlformat=require(_0xb34a('0x1'));var rimraf=require(_0xb34a('0x2'));var zipdir=require(_0xb34a('0x3'));var jsonpatch=require(_0xb34a('0x4'));var rp=require(_0xb34a('0x5'));var moment=require(_0xb34a('0x6'));var BPromise=require(_0xb34a('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb34a('0x8'));var sox=require(_0xb34a('0x9'));var csv=require(_0xb34a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb34a('0xb'));var squel=require(_0xb34a('0xc'));var crypto=require(_0xb34a('0xd'));var jsforce=require(_0xb34a('0xe'));var deskjs=require(_0xb34a('0xf'));var toCsv=require(_0xb34a('0xa'));var querystring=require(_0xb34a('0x10'));var Papa=require(_0xb34a('0x11'));var Redis=require(_0xb34a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb34a('0x13'));var as=require(_0xb34a('0x14'));var hardwareService=require(_0xb34a('0x15'));var logger=require('../../config/logger')(_0xb34a('0x16'));var utils=require(_0xb34a('0x17'));var config=require(_0xb34a('0x18'));var db=require(_0xb34a('0x19'))['db'];var jayson=require(_0xb34a('0x1a'));var client=jayson[_0xb34a('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x51e8c5,_0x4ef244,_0x5dddc4){if(_0x5dddc4){var _0x474d70=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x474d70['test'](_0x4ef244)){return _0x51e8c5;}else{throw new db['Sequelize'][(_0xb34a('0x1c'))](_0xb34a('0x1d'));}}else{return _0x51e8c5;}}function respondWithRpcPromise(_0x442d44,_0x54ad68,_0x1483f1,_0x24c0b9){return new BPromise(function(_0x1381dc,_0x5373aa){var _0xd2eb2b=_0x24c0b9||client;return _0xd2eb2b['request'](_0x442d44,_0x1483f1)[_0xb34a('0x1e')](function(_0x611744){logger[_0xb34a('0x1f')](_0xb34a('0x20'),_0x54ad68,_0xb34a('0x21'));logger[_0xb34a('0x22')]('Trunk,\x20%s,\x20%s,\x20%s',_0x54ad68,_0xb34a('0x21'),JSON[_0xb34a('0x23')](_0x611744));if(_0x611744[_0xb34a('0x24')]){if(_0x611744[_0xb34a('0x24')]['code']===0x1f4){logger[_0xb34a('0x24')](_0xb34a('0x20'),_0x54ad68,_0x611744[_0xb34a('0x24')][_0xb34a('0x25')]);return _0x5373aa(_0x611744[_0xb34a('0x24')][_0xb34a('0x25')]);}logger[_0xb34a('0x24')](_0xb34a('0x20'),_0x54ad68,_0x611744[_0xb34a('0x24')]['message']);return _0x1381dc(_0x611744[_0xb34a('0x24')][_0xb34a('0x25')]);}else{logger['info'](_0xb34a('0x20'),_0x54ad68,_0xb34a('0x21'));_0x1381dc(_0x611744['result'][_0xb34a('0x25')]);}})[_0xb34a('0x26')](function(_0x30c701){logger[_0xb34a('0x24')](_0xb34a('0x20'),_0x54ad68,_0x30c701);_0x5373aa(_0x30c701);});});}function respondWithStatusCode(_0x1b2a2f,_0x3fda4d){_0x3fda4d=_0x3fda4d||0xcc;return function(_0x39edda){if(_0x39edda){return _0x1b2a2f[_0xb34a('0x27')](_0x3fda4d);}return _0x1b2a2f[_0xb34a('0x28')](_0x3fda4d)[_0xb34a('0x29')]();};}function respondWithResult(_0x153ef2,_0x338fdd){_0x338fdd=_0x338fdd||0xc8;return function(_0x55b142){if(_0x55b142){return _0x153ef2['status'](_0x338fdd)[_0xb34a('0x2a')](_0x55b142);}};}function respondWithFilteredResult(_0x4025d1,_0x1b3115){return function(_0x2fee89){if(_0x2fee89){var _0x4cd44d=_0x2fee89[_0xb34a('0x2b')],_0x56f2ae=_0x1b3115[_0xb34a('0x2c')],_0x54d098=_0x1b3115[_0xb34a('0x2c')]+_0x1b3115[_0xb34a('0x2d')],_0x21aafe;if(_0x54d098>=_0x4cd44d){_0x54d098=_0x4cd44d;_0x21aafe=0xc8;}else{_0x21aafe=0xce;}_0x4025d1[_0xb34a('0x28')](_0x21aafe);return _0x4025d1[_0xb34a('0x2e')]('Content-Range',_0x56f2ae+'-'+_0x54d098+'/'+_0x4cd44d)[_0xb34a('0x2a')](_0x2fee89);}return null;};}function patchUpdates(_0x1d6b6e){return function(_0x201915){try{jsonpatch[_0xb34a('0x2f')](_0x201915,_0x1d6b6e,!![]);}catch(_0x1dedf5){return BPromise[_0xb34a('0x30')](_0x1dedf5);}return _0x201915['save']();};}function saveUpdates(_0x5b821d,_0x55dd18){return function(_0x97ccb1){if(_0x97ccb1){return _0x97ccb1['update'](_0x5b821d)[_0xb34a('0x1e')](function(_0x444def){return _0x444def;});}return null;};}function removeEntity(_0x1e3275,_0x572e5e){return function(_0x581f76){if(_0x581f76){return _0x581f76[_0xb34a('0x31')]()[_0xb34a('0x1e')](function(){var _0x73d61e=_0x581f76['get']({'plain':!![]});var _0x4c0687='Trunks';return db[_0xb34a('0x32')][_0xb34a('0x31')]({'where':{'type':_0x4c0687,'resourceId':_0x73d61e['id']}})[_0xb34a('0x1e')](function(){return _0x581f76;});})['then'](function(){_0x1e3275[_0xb34a('0x28')](0xcc)[_0xb34a('0x29')]();});}};}function handleEntityNotFound(_0x19cdf1,_0x212924){return function(_0x4f7fdc){if(!_0x4f7fdc){_0x19cdf1[_0xb34a('0x27')](0x194);}return _0x4f7fdc;};}function handleError(_0x8e3109,_0x3281c0){_0x3281c0=_0x3281c0||0x1f4;return function(_0x423a08){logger[_0xb34a('0x24')](_0x423a08[_0xb34a('0x33')]);if(_0x423a08['name']){delete _0x423a08[_0xb34a('0x34')];}_0x8e3109['status'](_0x3281c0)[_0xb34a('0x35')](_0x423a08);};}exports[_0xb34a('0x36')]=function(_0x47b3c0,_0x53d2ce){var _0x3b437d={},_0x5c7bdb={},_0x2587e1={'count':0x0,'rows':[]};var _0x148a89=_[_0xb34a('0x37')](db['Trunk'][_0xb34a('0x38')],function(_0x59c209){return{'name':_0x59c209[_0xb34a('0x39')],'type':_0x59c209['type']['key']};});_0x5c7bdb[_0xb34a('0x3a')]=_['map'](_0x148a89,'name');_0x5c7bdb['query']=_['keys'](_0x47b3c0[_0xb34a('0x3b')]);_0x5c7bdb[_0xb34a('0x3c')]=_['intersection'](_0x5c7bdb['model'],_0x5c7bdb[_0xb34a('0x3b')]);_0x3b437d[_0xb34a('0x3d')]=_['intersection'](_0x5c7bdb[_0xb34a('0x3a')],qs[_0xb34a('0x3e')](_0x47b3c0[_0xb34a('0x3b')][_0xb34a('0x3e')]));_0x3b437d[_0xb34a('0x3d')]=_0x3b437d[_0xb34a('0x3d')][_0xb34a('0x3f')]?_0x3b437d[_0xb34a('0x3d')]:_0x5c7bdb['model'];if(!_0x47b3c0[_0xb34a('0x3b')]['hasOwnProperty'](_0xb34a('0x40'))){_0x3b437d[_0xb34a('0x2d')]=qs[_0xb34a('0x2d')](_0x47b3c0['query'][_0xb34a('0x2d')]);_0x3b437d[_0xb34a('0x2c')]=qs['offset'](_0x47b3c0[_0xb34a('0x3b')]['offset']);}_0x3b437d[_0xb34a('0x41')]=qs[_0xb34a('0x42')](_0x47b3c0['query']['sort']);_0x3b437d['where']=qs[_0xb34a('0x3c')](_[_0xb34a('0x43')](_0x47b3c0[_0xb34a('0x3b')],_0x5c7bdb[_0xb34a('0x3c')]),_0x148a89);if(_0x47b3c0[_0xb34a('0x3b')][_0xb34a('0x44')]){_0x3b437d[_0xb34a('0x45')]=_[_0xb34a('0x46')](_0x3b437d[_0xb34a('0x45')],{'$or':_[_0xb34a('0x37')](_0x148a89,function(_0x5ab08c){if(_0x5ab08c['type']!==_0xb34a('0x47')){var _0x5ee933={};_0x5ee933[_0x5ab08c[_0xb34a('0x34')]]={'$like':'%'+_0x47b3c0[_0xb34a('0x3b')]['filter']+'%'};return _0x5ee933;}})});}_0x3b437d=_[_0xb34a('0x46')]({},_0x3b437d,_0x47b3c0[_0xb34a('0x48')]);var _0x162e44={'where':_0x3b437d[_0xb34a('0x45')]};return db[_0xb34a('0x49')][_0xb34a('0x2b')](_0x162e44)[_0xb34a('0x1e')](function(_0xbb1951){_0x2587e1['count']=_0xbb1951;if(_0x47b3c0[_0xb34a('0x3b')][_0xb34a('0x4a')]){_0x3b437d[_0xb34a('0x4b')]=[{'all':!![]}];}return db[_0xb34a('0x49')][_0xb34a('0x4c')](_0x3b437d);})[_0xb34a('0x1e')](function(_0x4a6bd1){_0x2587e1['rows']=_0x4a6bd1;return _0x2587e1;})[_0xb34a('0x1e')](respondWithFilteredResult(_0x53d2ce,_0x3b437d))['catch'](handleError(_0x53d2ce,null));};exports[_0xb34a('0x4d')]=function(_0x2b1337,_0x26fcc9){var _0x38e8eb={'raw':![],'where':{'id':_0x2b1337[_0xb34a('0x4e')]['id']}},_0x3962d4={};_0x3962d4[_0xb34a('0x3a')]=_[_0xb34a('0x4f')](db[_0xb34a('0x49')][_0xb34a('0x38')]);_0x3962d4[_0xb34a('0x3b')]=_['keys'](_0x2b1337['query']);_0x3962d4[_0xb34a('0x3c')]=_['intersection'](_0x3962d4[_0xb34a('0x3a')],_0x3962d4[_0xb34a('0x3b')]);_0x38e8eb[_0xb34a('0x3d')]=_[_0xb34a('0x50')](_0x3962d4['model'],qs['fields'](_0x2b1337['query']['fields']));_0x38e8eb[_0xb34a('0x3d')]=_0x38e8eb[_0xb34a('0x3d')][_0xb34a('0x3f')]?_0x38e8eb[_0xb34a('0x3d')]:_0x3962d4[_0xb34a('0x3a')];if(_0x2b1337[_0xb34a('0x3b')][_0xb34a('0x4a')]){_0x38e8eb[_0xb34a('0x4b')]=[{'all':!![]}];}_0x38e8eb=_[_0xb34a('0x46')]({},_0x38e8eb,_0x2b1337[_0xb34a('0x48')]);return db[_0xb34a('0x49')][_0xb34a('0x51')](_0x38e8eb)[_0xb34a('0x1e')](handleEntityNotFound(_0x26fcc9,null))['then'](respondWithResult(_0x26fcc9,null))['catch'](handleError(_0x26fcc9,null));};exports[_0xb34a('0x52')]=function(_0x215cdf,_0x356b46){var _0x5c302b={'where':{'id':_0x215cdf[_0xb34a('0x4e')]['id']}},_0x2a8e07={};_0x2a8e07[_0xb34a('0x3a')]=_[_0xb34a('0x4f')](db[_0xb34a('0x49')]['rawAttributes']);_0x5c302b['attributes']=_['intersection'](_0x2a8e07[_0xb34a('0x3a')],qs[_0xb34a('0x3e')](_0x215cdf['query'][_0xb34a('0x3e')]));_0x5c302b[_0xb34a('0x3d')]=_0x5c302b[_0xb34a('0x3d')][_0xb34a('0x3f')]?_0x5c302b[_0xb34a('0x3d')]:_0x2a8e07[_0xb34a('0x3a')];if(_0x215cdf[_0xb34a('0x3b')][_0xb34a('0x4a')]){_0x5c302b[_0xb34a('0x4b')]=[{'all':!![]}];}_0x5c302b=_['merge']({},_0x5c302b,_0x215cdf[_0xb34a('0x48')]);return db['Trunk'][_0xb34a('0x51')](_0x5c302b)[_0xb34a('0x1e')](handleEntityNotFound(_0x356b46,null))[_0xb34a('0x1e')](function(_0x1b0bbe){if(_0x1b0bbe){var _0x20718f=_0x1b0bbe['get']({'plain':!![]});_0x20718f=qs[_0xb34a('0x53')](_0x20718f,['id',_0xb34a('0x54'),_0xb34a('0x55')]);_0x215cdf[_0xb34a('0x56')]=_[_0xb34a('0x53')](_0x215cdf[_0xb34a('0x56')],['id','createdAt',_0xb34a('0x55')]);return db[_0xb34a('0x49')][_0xb34a('0x57')](_['merge'](_0x20718f,_0x215cdf[_0xb34a('0x56')]),{'include':_0x215cdf[_0xb34a('0x3b')][_0xb34a('0x4a')]?[{'all':!![]}]:undefined})[_0xb34a('0x1e')](function(_0x2f1057){var _0x3e399c=_0x215cdf['user'][_0xb34a('0x58')]({'plain':!![]});if(!_0x3e399c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e399c[_0xb34a('0x59')]==='user'){var _0x2e2f8a=_0x2f1057[_0xb34a('0x58')]({'plain':!![]});var _0x5e3393='Trunks';return db['UserProfileSection'][_0xb34a('0x51')]({'where':{'name':_0x5e3393,'userProfileId':_0x3e399c[_0xb34a('0x5a')]},'raw':!![]})[_0xb34a('0x1e')](function(_0xe9075b){if(_0xe9075b&&_0xe9075b[_0xb34a('0x5b')]===0x0){return db['UserProfileResource'][_0xb34a('0x57')]({'name':_0x2e2f8a[_0xb34a('0x34')],'resourceId':_0x2e2f8a['id'],'type':_0xe9075b[_0xb34a('0x34')],'sectionId':_0xe9075b['id']},{})[_0xb34a('0x1e')](function(){return _0x2f1057;});}else{return _0x2f1057;}})[_0xb34a('0x26')](function(_0x1dd63){logger['error'](_0xb34a('0x5c'),_0x1dd63);throw _0x1dd63;});}return _0x2f1057;});}})['then'](respondWithResult(_0x356b46,0xc9))['catch'](handleError(_0x356b46,null));};exports['create']=function(_0x127553,_0x587664,_0x412ab4){var _0x44c205;return db[_0xb34a('0x49')][_0xb34a('0x57')](_0x127553['body'],{'raw':!![]})[_0xb34a('0x1e')](function(_0x5dbe0f){_0x44c205=_0x5dbe0f;return db[_0xb34a('0x49')][_0xb34a('0x4c')]({'raw':!![]});})[_0xb34a('0x1e')](function(_0x558ef1){var _0x5b68e8=fs[_0xb34a('0x5d')](path[_0xb34a('0x5e')](config[_0xb34a('0x5f')],_0xb34a('0x60')),_0xb34a('0x61'));var _0x2da606=fs['readFileSync'](path[_0xb34a('0x5e')](config['root'],_0xb34a('0x62')),'utf8');var _0xffe30d=ejs[_0xb34a('0x63')](_0x5b68e8,{'trunks':_0x558ef1||[]});fs[_0xb34a('0x64')](_0xb34a('0x65'),_0xffe30d);if(_0x44c205[_0xb34a('0x66')]){var _0x4c0aee=ejs[_0xb34a('0x63')](_0x2da606,{'trunks':_0x558ef1||[]});fs[_0xb34a('0x64')](_0xb34a('0x67'),_0x4c0aee);}})[_0xb34a('0x1e')](function(){return respondWithRpcPromise(_0xb34a('0x68'),'create',{'module':_0xb34a('0x69')});})[_0xb34a('0x1e')](function(){var _0x52de9b=_0x127553['user'][_0xb34a('0x58')]({'plain':!![]});if(!_0x52de9b)throw new Error(_0xb34a('0x6a'));if(_0x52de9b[_0xb34a('0x59')]===_0xb34a('0x6b')){var _0x100c02=_0x44c205[_0xb34a('0x58')]({'plain':!![]});return db[_0xb34a('0x6c')][_0xb34a('0x51')]({'where':{'name':_0xb34a('0x6d'),'userProfileId':_0x52de9b[_0xb34a('0x5a')]},'raw':!![]})[_0xb34a('0x1e')](function(_0xd4636c){if(_0xd4636c&&_0xd4636c[_0xb34a('0x5b')]===0x0){return db[_0xb34a('0x32')][_0xb34a('0x57')]({'name':_0x100c02[_0xb34a('0x34')],'resourceId':_0x100c02['id'],'type':_0xd4636c[_0xb34a('0x34')],'sectionId':_0xd4636c['id']},{})[_0xb34a('0x1e')](function(){return _0x44c205;});}else{return _0x44c205;}})[_0xb34a('0x26')](function(_0x515266){logger[_0xb34a('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x515266);throw _0x515266;});}return _0x44c205;})[_0xb34a('0x1e')](respondWithResult(_0x587664,0xc9))[_0xb34a('0x26')](handleError(_0x587664,null));};exports[_0xb34a('0x6e')]=function(_0x5eb244,_0x19b761,_0x54277f){var _0x401dc7;return db[_0xb34a('0x49')][_0xb34a('0x51')]({'where':{'id':_0x5eb244['params']['id']}})[_0xb34a('0x1e')](handleEntityNotFound(_0x19b761,null))[_0xb34a('0x1e')](saveUpdates(_0x5eb244[_0xb34a('0x56')],null))[_0xb34a('0x1e')](function(_0x1b9b6f){if(_0x1b9b6f){_0x401dc7=_0x1b9b6f;return db[_0xb34a('0x49')]['findAll']({'raw':!![]});}})[_0xb34a('0x1e')](function(_0x268b78){if(_0x268b78){var _0x1c4a03=fs[_0xb34a('0x5d')](path[_0xb34a('0x5e')](config[_0xb34a('0x5f')],'server/files/templates/trunk.ejs'),_0xb34a('0x61'));var _0x5acad7=fs[_0xb34a('0x5d')](path['join'](config['root'],_0xb34a('0x62')),_0xb34a('0x61'));var _0x1b11d0=ejs['render'](_0x1c4a03,{'trunks':_0x268b78||[]});fs['writeFileSync'](_0xb34a('0x65'),_0x1b11d0);var _0x2be08d=ejs['render'](_0x5acad7,{'trunks':_0x268b78||[]});fs[_0xb34a('0x64')]('/etc/asterisk/sip_xcally_registers.conf',_0x2be08d);return respondWithRpcPromise('Reload',_0xb34a('0x6e'),{'module':'chan_sip.so'});}return null;})[_0xb34a('0x1e')](function(_0x33aed7){if(_0x33aed7){return _0x401dc7;}})[_0xb34a('0x1e')](respondWithResult(_0x19b761,null))['catch'](handleError(_0x19b761,null));};exports['destroy']=function(_0x580876,_0x178988,_0x165e6b){var _0x5de101;return db[_0xb34a('0x49')][_0xb34a('0x51')]({'where':{'id':_0x580876['params']['id']}})['then'](handleEntityNotFound(_0x178988,null))[_0xb34a('0x1e')](removeEntity(_0x178988,null))[_0xb34a('0x1e')](function(){return db[_0xb34a('0x49')]['findAll']({'raw':!![]});})[_0xb34a('0x1e')](function(_0x32dc19){var _0x34eae2=fs['readFileSync'](path[_0xb34a('0x5e')](config[_0xb34a('0x5f')],_0xb34a('0x60')),_0xb34a('0x61'));var _0x232fc7=fs[_0xb34a('0x5d')](path[_0xb34a('0x5e')](config[_0xb34a('0x5f')],_0xb34a('0x62')),'utf8');var _0x4cb385=ejs[_0xb34a('0x63')](_0x34eae2,{'trunks':_0x32dc19});var _0x11c933=ejs[_0xb34a('0x63')](_0x232fc7,{'trunks':_0x32dc19});fs[_0xb34a('0x64')](_0xb34a('0x65'),_0x4cb385);fs[_0xb34a('0x64')](_0xb34a('0x67'),_0x11c933);return respondWithRpcPromise(_0xb34a('0x68'),_0xb34a('0x31'),{'module':'chan_sip.so'});})[_0xb34a('0x26')](handleError(_0x178988,null));}; \ No newline at end of file +var _0x43c8=['reject','save','update','then','destroy','get','UserProfileResource','name','send','index','map','Trunk','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','omit','updatedAt','body','createdAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','chan_sip.so','UserProfileSection','/etc/asterisk/sip_xcally_registers.conf','Reload','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','count','offset','limit','set','json','apply'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x43c8,0xaf));var _0x843c=function(_0x225f34,_0x236ba3){_0x225f34=_0x225f34-0x0;var _0x5b2aca=_0x43c8[_0x225f34];return _0x5b2aca;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x843c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x843c('0x1'));var jsonpatch=require(_0x843c('0x2'));var rp=require(_0x843c('0x3'));var moment=require(_0x843c('0x4'));var BPromise=require(_0x843c('0x5'));var Mustache=require(_0x843c('0x6'));var util=require(_0x843c('0x7'));var path=require('path');var sox=require(_0x843c('0x8'));var csv=require(_0x843c('0x9'));var ejs=require(_0x843c('0xa'));var fs=require('fs');var _=require(_0x843c('0xb'));var squel=require(_0x843c('0xc'));var crypto=require('crypto');var jsforce=require(_0x843c('0xd'));var deskjs=require(_0x843c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x843c('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x843c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x843c('0x11'));var hardwareService=require(_0x843c('0x12'));var logger=require(_0x843c('0x13'))(_0x843c('0x14'));var utils=require('../../config/utils');var config=require(_0x843c('0x15'));var db=require(_0x843c('0x16'))['db'];var jayson=require(_0x843c('0x17'));var client=jayson[_0x843c('0x18')][_0x843c('0x19')]({'port':0x232a});function checkPasswordPattern(_0x34e297,_0x33ff2c,_0x1037bd){if(_0x1037bd){var _0x1c1fa0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1c1fa0[_0x843c('0x1a')](_0x33ff2c)){return _0x34e297;}else{throw new db[(_0x843c('0x1b'))][(_0x843c('0x1c'))](_0x843c('0x1d'));}}else{return _0x34e297;}}function respondWithRpcPromise(_0x1c7bc6,_0x3c67eb,_0x5577ff,_0x3dc50d){return new BPromise(function(_0x2c013c,_0x1d92cf){var _0x42558b=_0x3dc50d||client;return _0x42558b[_0x843c('0x1e')](_0x1c7bc6,_0x5577ff)['then'](function(_0x37c476){logger[_0x843c('0x1f')](_0x843c('0x20'),_0x3c67eb,_0x843c('0x21'));logger['debug'](_0x843c('0x22'),_0x3c67eb,_0x843c('0x21'),JSON[_0x843c('0x23')](_0x37c476));if(_0x37c476[_0x843c('0x24')]){if(_0x37c476[_0x843c('0x24')]['code']===0x1f4){logger[_0x843c('0x24')]('Trunk,\x20%s,\x20%s',_0x3c67eb,_0x37c476[_0x843c('0x24')]['message']);return _0x1d92cf(_0x37c476[_0x843c('0x24')][_0x843c('0x25')]);}logger['error'](_0x843c('0x20'),_0x3c67eb,_0x37c476[_0x843c('0x24')][_0x843c('0x25')]);return _0x2c013c(_0x37c476[_0x843c('0x24')]['message']);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x3c67eb,_0x843c('0x21'));_0x2c013c(_0x37c476[_0x843c('0x26')][_0x843c('0x25')]);}})[_0x843c('0x27')](function(_0x714f6){logger[_0x843c('0x24')](_0x843c('0x20'),_0x3c67eb,_0x714f6);_0x1d92cf(_0x714f6);});});}function respondWithStatusCode(_0x51f75b,_0x4584be){_0x4584be=_0x4584be||0xcc;return function(_0x2a8c56){if(_0x2a8c56){return _0x51f75b[_0x843c('0x28')](_0x4584be);}return _0x51f75b['status'](_0x4584be)[_0x843c('0x29')]();};}function respondWithResult(_0x5caa13,_0x15863a){_0x15863a=_0x15863a||0xc8;return function(_0x1ee7e3){if(_0x1ee7e3){return _0x5caa13[_0x843c('0x2a')](_0x15863a)['json'](_0x1ee7e3);}};}function respondWithFilteredResult(_0x28f0ea,_0x2a3c64){return function(_0x177db5){if(_0x177db5){var _0x3bf6a6=_0x177db5[_0x843c('0x2b')],_0x8473bb=_0x2a3c64['offset'],_0xb8b544=_0x2a3c64[_0x843c('0x2c')]+_0x2a3c64[_0x843c('0x2d')],_0x4e2a13;if(_0xb8b544>=_0x3bf6a6){_0xb8b544=_0x3bf6a6;_0x4e2a13=0xc8;}else{_0x4e2a13=0xce;}_0x28f0ea[_0x843c('0x2a')](_0x4e2a13);return _0x28f0ea[_0x843c('0x2e')]('Content-Range',_0x8473bb+'-'+_0xb8b544+'/'+_0x3bf6a6)[_0x843c('0x2f')](_0x177db5);}return null;};}function patchUpdates(_0x46b64a){return function(_0x230e22){try{jsonpatch[_0x843c('0x30')](_0x230e22,_0x46b64a,!![]);}catch(_0x335df8){return BPromise[_0x843c('0x31')](_0x335df8);}return _0x230e22[_0x843c('0x32')]();};}function saveUpdates(_0x8c0bf,_0x451298){return function(_0x2682b9){if(_0x2682b9){return _0x2682b9[_0x843c('0x33')](_0x8c0bf)[_0x843c('0x34')](function(_0x59c027){return _0x59c027;});}return null;};}function removeEntity(_0x137daa,_0x532b8c){return function(_0x326979){if(_0x326979){return _0x326979[_0x843c('0x35')]()['then'](function(){var _0x2cb970=_0x326979[_0x843c('0x36')]({'plain':!![]});var _0x163053='Trunks';return db[_0x843c('0x37')][_0x843c('0x35')]({'where':{'type':_0x163053,'resourceId':_0x2cb970['id']}})['then'](function(){return _0x326979;});})[_0x843c('0x34')](function(){_0x137daa['status'](0xcc)[_0x843c('0x29')]();});}};}function handleEntityNotFound(_0x28d9b8,_0x5676ad){return function(_0x53f0e5){if(!_0x53f0e5){_0x28d9b8[_0x843c('0x28')](0x194);}return _0x53f0e5;};}function handleError(_0x3c2992,_0x176827){_0x176827=_0x176827||0x1f4;return function(_0x44b091){logger[_0x843c('0x24')](_0x44b091['stack']);if(_0x44b091[_0x843c('0x38')]){delete _0x44b091[_0x843c('0x38')];}_0x3c2992[_0x843c('0x2a')](_0x176827)[_0x843c('0x39')](_0x44b091);};}exports[_0x843c('0x3a')]=function(_0x2a5f73,_0x4e7676){var _0x313cfb={},_0x2b6e4c={},_0x256f02={'count':0x0,'rows':[]};var _0x112a10=_[_0x843c('0x3b')](db[_0x843c('0x3c')][_0x843c('0x3d')],function(_0x56b8bf){return{'name':_0x56b8bf['fieldName'],'type':_0x56b8bf[_0x843c('0x3e')][_0x843c('0x3f')]};});_0x2b6e4c[_0x843c('0x40')]=_['map'](_0x112a10,_0x843c('0x38'));_0x2b6e4c[_0x843c('0x41')]=_[_0x843c('0x42')](_0x2a5f73[_0x843c('0x41')]);_0x2b6e4c[_0x843c('0x43')]=_['intersection'](_0x2b6e4c[_0x843c('0x40')],_0x2b6e4c[_0x843c('0x41')]);_0x313cfb[_0x843c('0x44')]=_[_0x843c('0x45')](_0x2b6e4c[_0x843c('0x40')],qs[_0x843c('0x46')](_0x2a5f73[_0x843c('0x41')][_0x843c('0x46')]));_0x313cfb[_0x843c('0x44')]=_0x313cfb[_0x843c('0x44')][_0x843c('0x47')]?_0x313cfb[_0x843c('0x44')]:_0x2b6e4c[_0x843c('0x40')];if(!_0x2a5f73[_0x843c('0x41')][_0x843c('0x48')]('nolimit')){_0x313cfb['limit']=qs['limit'](_0x2a5f73[_0x843c('0x41')]['limit']);_0x313cfb[_0x843c('0x2c')]=qs[_0x843c('0x2c')](_0x2a5f73['query'][_0x843c('0x2c')]);}_0x313cfb['order']=qs['sort'](_0x2a5f73['query'][_0x843c('0x49')]);_0x313cfb['where']=qs[_0x843c('0x43')](_[_0x843c('0x4a')](_0x2a5f73['query'],_0x2b6e4c['filters']),_0x112a10);if(_0x2a5f73[_0x843c('0x41')][_0x843c('0x4b')]){_0x313cfb[_0x843c('0x4c')]=_[_0x843c('0x4d')](_0x313cfb[_0x843c('0x4c')],{'$or':_['map'](_0x112a10,function(_0x34f061){if(_0x34f061['type']!==_0x843c('0x4e')){var _0x2551e3={};_0x2551e3[_0x34f061[_0x843c('0x38')]]={'$like':'%'+_0x2a5f73[_0x843c('0x41')][_0x843c('0x4b')]+'%'};return _0x2551e3;}})});}_0x313cfb=_[_0x843c('0x4d')]({},_0x313cfb,_0x2a5f73[_0x843c('0x4f')]);var _0x173af7={'where':_0x313cfb[_0x843c('0x4c')]};return db[_0x843c('0x3c')][_0x843c('0x2b')](_0x173af7)[_0x843c('0x34')](function(_0x306394){_0x256f02[_0x843c('0x2b')]=_0x306394;if(_0x2a5f73[_0x843c('0x41')][_0x843c('0x50')]){_0x313cfb[_0x843c('0x51')]=[{'all':!![]}];}return db['Trunk'][_0x843c('0x52')](_0x313cfb);})[_0x843c('0x34')](function(_0x11bb2d){_0x256f02[_0x843c('0x53')]=_0x11bb2d;return _0x256f02;})[_0x843c('0x34')](respondWithFilteredResult(_0x4e7676,_0x313cfb))['catch'](handleError(_0x4e7676,null));};exports[_0x843c('0x54')]=function(_0x4a27b7,_0x456572){var _0x5e4a38={'raw':![],'where':{'id':_0x4a27b7[_0x843c('0x55')]['id']}},_0x565a18={};_0x565a18[_0x843c('0x40')]=_[_0x843c('0x42')](db[_0x843c('0x3c')][_0x843c('0x3d')]);_0x565a18[_0x843c('0x41')]=_[_0x843c('0x42')](_0x4a27b7[_0x843c('0x41')]);_0x565a18[_0x843c('0x43')]=_['intersection'](_0x565a18[_0x843c('0x40')],_0x565a18[_0x843c('0x41')]);_0x5e4a38[_0x843c('0x44')]=_[_0x843c('0x45')](_0x565a18[_0x843c('0x40')],qs[_0x843c('0x46')](_0x4a27b7[_0x843c('0x41')][_0x843c('0x46')]));_0x5e4a38[_0x843c('0x44')]=_0x5e4a38[_0x843c('0x44')]['length']?_0x5e4a38[_0x843c('0x44')]:_0x565a18[_0x843c('0x40')];if(_0x4a27b7[_0x843c('0x41')]['includeAll']){_0x5e4a38[_0x843c('0x51')]=[{'all':!![]}];}_0x5e4a38=_[_0x843c('0x4d')]({},_0x5e4a38,_0x4a27b7[_0x843c('0x4f')]);return db[_0x843c('0x3c')][_0x843c('0x56')](_0x5e4a38)[_0x843c('0x34')](handleEntityNotFound(_0x456572,null))[_0x843c('0x34')](respondWithResult(_0x456572,null))[_0x843c('0x27')](handleError(_0x456572,null));};exports['clone']=function(_0x5a3d3d,_0x3463ec){var _0x124c96={'where':{'id':_0x5a3d3d['params']['id']}},_0x33cbd5={};_0x33cbd5[_0x843c('0x40')]=_[_0x843c('0x42')](db[_0x843c('0x3c')][_0x843c('0x3d')]);_0x124c96[_0x843c('0x44')]=_['intersection'](_0x33cbd5[_0x843c('0x40')],qs['fields'](_0x5a3d3d[_0x843c('0x41')][_0x843c('0x46')]));_0x124c96[_0x843c('0x44')]=_0x124c96[_0x843c('0x44')][_0x843c('0x47')]?_0x124c96['attributes']:_0x33cbd5[_0x843c('0x40')];if(_0x5a3d3d['query'][_0x843c('0x50')]){_0x124c96[_0x843c('0x51')]=[{'all':!![]}];}_0x124c96=_['merge']({},_0x124c96,_0x5a3d3d[_0x843c('0x4f')]);return db[_0x843c('0x3c')][_0x843c('0x56')](_0x124c96)[_0x843c('0x34')](handleEntityNotFound(_0x3463ec,null))[_0x843c('0x34')](function(_0xcb8c8){if(_0xcb8c8){var _0x1e4073=_0xcb8c8[_0x843c('0x36')]({'plain':!![]});_0x1e4073=qs[_0x843c('0x57')](_0x1e4073,['id','createdAt',_0x843c('0x58')]);_0x5a3d3d[_0x843c('0x59')]=_['omit'](_0x5a3d3d[_0x843c('0x59')],['id',_0x843c('0x5a'),'updatedAt']);return db[_0x843c('0x3c')][_0x843c('0x5b')](_[_0x843c('0x4d')](_0x1e4073,_0x5a3d3d['body']),{'include':_0x5a3d3d['query'][_0x843c('0x50')]?[{'all':!![]}]:undefined})['then'](function(_0x33e730){var _0xa249b6=_0x5a3d3d[_0x843c('0x5c')][_0x843c('0x36')]({'plain':!![]});if(!_0xa249b6)throw new Error(_0x843c('0x5d'));if(_0xa249b6[_0x843c('0x5e')]===_0x843c('0x5c')){var _0x3a348d=_0x33e730[_0x843c('0x36')]({'plain':!![]});var _0x5e43bf=_0x843c('0x5f');return db['UserProfileSection'][_0x843c('0x56')]({'where':{'name':_0x5e43bf,'userProfileId':_0xa249b6['userProfileId']},'raw':!![]})[_0x843c('0x34')](function(_0x1a0f8d){if(_0x1a0f8d&&_0x1a0f8d[_0x843c('0x60')]===0x0){return db[_0x843c('0x37')]['create']({'name':_0x3a348d[_0x843c('0x38')],'resourceId':_0x3a348d['id'],'type':_0x1a0f8d[_0x843c('0x38')],'sectionId':_0x1a0f8d['id']},{})[_0x843c('0x34')](function(){return _0x33e730;});}else{return _0x33e730;}})['catch'](function(_0x15b36e){logger[_0x843c('0x24')](_0x843c('0x61'),_0x15b36e);throw _0x15b36e;});}return _0x33e730;});}})[_0x843c('0x34')](respondWithResult(_0x3463ec,0xc9))['catch'](handleError(_0x3463ec,null));};exports[_0x843c('0x5b')]=function(_0x3d3fb9,_0x50db50,_0x1e1e04){var _0x56629d;return db[_0x843c('0x3c')][_0x843c('0x5b')](_0x3d3fb9[_0x843c('0x59')],{'raw':!![]})['then'](function(_0x4770da){_0x56629d=_0x4770da;return db['Trunk'][_0x843c('0x52')]({'raw':!![]});})[_0x843c('0x34')](function(_0x2bb034){var _0x152b63=fs[_0x843c('0x62')](path[_0x843c('0x63')](config[_0x843c('0x64')],_0x843c('0x65')),_0x843c('0x66'));var _0x6779d1=fs[_0x843c('0x62')](path[_0x843c('0x63')](config[_0x843c('0x64')],_0x843c('0x67')),_0x843c('0x66'));var _0x1c397b=ejs[_0x843c('0x68')](_0x152b63,{'trunks':_0x2bb034||[]});fs[_0x843c('0x69')](_0x843c('0x6a'),_0x1c397b);if(_0x56629d[_0x843c('0x6b')]){var _0x3add11=ejs[_0x843c('0x68')](_0x6779d1,{'trunks':_0x2bb034||[]});fs[_0x843c('0x69')]('/etc/asterisk/sip_xcally_registers.conf',_0x3add11);}})[_0x843c('0x34')](function(){return respondWithRpcPromise('Reload',_0x843c('0x5b'),{'module':_0x843c('0x6c')});})['then'](function(){var _0x4fa08b=_0x3d3fb9['user'][_0x843c('0x36')]({'plain':!![]});if(!_0x4fa08b)throw new Error(_0x843c('0x5d'));if(_0x4fa08b[_0x843c('0x5e')]==='user'){var _0x1f8400=_0x56629d[_0x843c('0x36')]({'plain':!![]});return db[_0x843c('0x6d')][_0x843c('0x56')]({'where':{'name':_0x843c('0x5f'),'userProfileId':_0x4fa08b['userProfileId']},'raw':!![]})[_0x843c('0x34')](function(_0x2846b2){if(_0x2846b2&&_0x2846b2[_0x843c('0x60')]===0x0){return db[_0x843c('0x37')]['create']({'name':_0x1f8400[_0x843c('0x38')],'resourceId':_0x1f8400['id'],'type':_0x2846b2['name'],'sectionId':_0x2846b2['id']},{})['then'](function(){return _0x56629d;});}else{return _0x56629d;}})[_0x843c('0x27')](function(_0x124db5){logger[_0x843c('0x24')](_0x843c('0x61'),_0x124db5);throw _0x124db5;});}return _0x56629d;})['then'](respondWithResult(_0x50db50,0xc9))['catch'](handleError(_0x50db50,null));};exports[_0x843c('0x33')]=function(_0x3624d5,_0x36078b,_0x303d7e){var _0x17a1b9;return db[_0x843c('0x3c')][_0x843c('0x56')]({'where':{'id':_0x3624d5[_0x843c('0x55')]['id']}})[_0x843c('0x34')](handleEntityNotFound(_0x36078b,null))[_0x843c('0x34')](saveUpdates(_0x3624d5[_0x843c('0x59')],null))[_0x843c('0x34')](function(_0x3722a6){if(_0x3722a6){_0x17a1b9=_0x3722a6;return db[_0x843c('0x3c')][_0x843c('0x52')]({'raw':!![]});}})[_0x843c('0x34')](function(_0x159b57){if(_0x159b57){var _0x1c5177=fs[_0x843c('0x62')](path['join'](config['root'],_0x843c('0x65')),_0x843c('0x66'));var _0x3fc7fa=fs['readFileSync'](path['join'](config['root'],_0x843c('0x67')),_0x843c('0x66'));var _0x306c7c=ejs[_0x843c('0x68')](_0x1c5177,{'trunks':_0x159b57||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x306c7c);var _0x3c908d=ejs[_0x843c('0x68')](_0x3fc7fa,{'trunks':_0x159b57||[]});fs[_0x843c('0x69')](_0x843c('0x6e'),_0x3c908d);return respondWithRpcPromise(_0x843c('0x6f'),'update',{'module':_0x843c('0x6c')});}return null;})[_0x843c('0x34')](function(_0x5ef0e8){if(_0x5ef0e8){return _0x17a1b9;}})[_0x843c('0x34')](respondWithResult(_0x36078b,null))[_0x843c('0x27')](handleError(_0x36078b,null));};exports[_0x843c('0x35')]=function(_0x38d6cc,_0x4ba2b7,_0x12c8b9){var _0x366198;return db['Trunk']['find']({'where':{'id':_0x38d6cc[_0x843c('0x55')]['id']}})[_0x843c('0x34')](handleEntityNotFound(_0x4ba2b7,null))[_0x843c('0x34')](removeEntity(_0x4ba2b7,null))['then'](function(){return db[_0x843c('0x3c')][_0x843c('0x52')]({'raw':!![]});})['then'](function(_0x519914){var _0x3d9d34=fs['readFileSync'](path[_0x843c('0x63')](config[_0x843c('0x64')],_0x843c('0x65')),_0x843c('0x66'));var _0x72f77=fs[_0x843c('0x62')](path[_0x843c('0x63')](config['root'],_0x843c('0x67')),'utf8');var _0x2948ad=ejs[_0x843c('0x68')](_0x3d9d34,{'trunks':_0x519914});var _0x2829cd=ejs[_0x843c('0x68')](_0x72f77,{'trunks':_0x519914});fs[_0x843c('0x69')](_0x843c('0x6a'),_0x2948ad);fs['writeFileSync'](_0x843c('0x6e'),_0x2829cd);return respondWithRpcPromise('Reload',_0x843c('0x35'),{'module':_0x843c('0x6c')});})[_0x843c('0x27')](handleError(_0x4ba2b7,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 1793487..f641a6f 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 _0xf3aa=['../../config/environment','./trunk.attributes','exports','define','tools_trunks','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x18f790,_0x2685ac){var _0x10488c=function(_0x590177){while(--_0x590177){_0x18f790['push'](_0x18f790['shift']());}};_0x10488c(++_0x2685ac);}(_0xf3aa,0xf7));var _0xaf3a=function(_0x3044e3,_0x255336){_0x3044e3=_0x3044e3-0x0;var _0x389181=_0xf3aa[_0x3044e3];return _0x389181;};'use strict';var _=require(_0xaf3a('0x0'));var util=require(_0xaf3a('0x1'));var logger=require(_0xaf3a('0x2'))(_0xaf3a('0x3'));var moment=require(_0xaf3a('0x4'));var BPromise=require('bluebird');var rp=require(_0xaf3a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaf3a('0x6'));var attributes=require(_0xaf3a('0x7'));module[_0xaf3a('0x8')]=function(_0x4101cb,_0x1475ef){return _0x4101cb[_0xaf3a('0x9')]('Trunk',attributes,{'tableName':_0xaf3a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6098=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','Trunk'];(function(_0x2f5fcb,_0x2f0314){var _0x27b7cd=function(_0x4b4902){while(--_0x4b4902){_0x2f5fcb['push'](_0x2f5fcb['shift']());}};_0x27b7cd(++_0x2f0314);}(_0x6098,0x1cc));var _0x8609=function(_0x3642e7,_0x16358e){_0x3642e7=_0x3642e7-0x0;var _0x31e3dd=_0x6098[_0x3642e7];return _0x31e3dd;};'use strict';var _=require(_0x8609('0x0'));var util=require(_0x8609('0x1'));var logger=require(_0x8609('0x2'))(_0x8609('0x3'));var moment=require(_0x8609('0x4'));var BPromise=require(_0x8609('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8609('0x6'));var config=require(_0x8609('0x7'));var attributes=require('./trunk.attributes');module[_0x8609('0x8')]=function(_0x199620,_0x5b34fa){return _0x199620['define'](_0x8609('0x9'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 0a52cd8..f0bbb39 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(_0xf10840,_0xad3916){var _0x1fdf7e=function(_0x463be3){while(--_0x463be3){_0xf10840['push'](_0xf10840['shift']());}};_0x1fdf7e(++_0xad3916);}(_0x4fc2,0x111));var _0x24fc=function(_0x121c59,_0x583b72){_0x121c59=_0x121c59-0x0;var _0x1c1b78=_0x4fc2[_0x121c59];return _0x1c1b78;};'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 _0x2032=['error','code','message','info','result','catch','GetTrunk','Trunk','options','raw','where','map','model','attributes','include','stringify','ShowTrunk','find','then','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1c2deb,_0x47a2a9){var _0x336693=function(_0x577720){while(--_0x577720){_0x1c2deb['push'](_0x1c2deb['shift']());}};_0x336693(++_0x47a2a9);}(_0x2032,0xd9));var _0x2203=function(_0x299048,_0x33152f){_0x299048=_0x299048-0x0;var _0x599177=_0x2032[_0x299048];return _0x599177;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('Trunk,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('Trunk,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});}exports[_0x2203('0x14')]=function(_0x4893ff){var _0x3f9ef6=this;return new Promise(function(_0x8906e1,_0x4aeb9f){return db[_0x2203('0x15')]['findAll']({'raw':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')][_0x2203('0x17')]===undefined?!![]:![]:!![],'where':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')][_0x2203('0x18')]||null:null,'attributes':_0x4893ff['options']?_0x4893ff[_0x2203('0x16')]['attributes']||null:null,'limit':_0x4893ff['options']?_0x4893ff[_0x2203('0x16')]['limit']||null:null,'include':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')]['include']?_[_0x2203('0x19')](_0x4893ff['options']['include'],function(_0x226374){return{'model':db[_0x226374[_0x2203('0x1a')]],'as':_0x226374['as'],'attributes':_0x226374[_0x2203('0x1b')],'include':_0x226374[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x226374[_0x2203('0x1c')],function(_0x49c12){return{'model':db[_0x49c12[_0x2203('0x1a')]],'as':_0x49c12['as'],'attributes':_0x49c12['attributes'],'include':_0x49c12[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x49c12[_0x2203('0x1c')],function(_0x5f11bf){return{'model':db[_0x5f11bf[_0x2203('0x1a')]],'as':_0x5f11bf['as'],'attributes':_0x5f11bf[_0x2203('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd6e109){logger[_0x2203('0x11')](_0x2203('0x14'),_0x4893ff);logger[_0x2203('0xd')](_0x2203('0x14'),_0x4893ff,JSON[_0x2203('0x1d')](_0xd6e109));_0x8906e1(_0xd6e109);})[_0x2203('0x13')](function(_0x5a95c1){logger[_0x2203('0xe')](_0x2203('0x14'),_0x5a95c1[_0x2203('0x10')],_0x4893ff);_0x4aeb9f(_0x3f9ef6[_0x2203('0xe')](0x1f4,_0x5a95c1['message']));});});};exports[_0x2203('0x1e')]=function(_0x21ff0d){var _0x287c95=this;return new Promise(function(_0xf59954,_0x520602){return db[_0x2203('0x15')][_0x2203('0x1f')]({'raw':_0x21ff0d['options']?_0x21ff0d['options'][_0x2203('0x17')]===undefined?!![]:![]:!![],'where':_0x21ff0d['options']?_0x21ff0d['options'][_0x2203('0x18')]||null:null,'attributes':_0x21ff0d[_0x2203('0x16')]?_0x21ff0d[_0x2203('0x16')][_0x2203('0x1b')]||null:null,'include':_0x21ff0d[_0x2203('0x16')]?_0x21ff0d['options'][_0x2203('0x1c')]?_[_0x2203('0x19')](_0x21ff0d['options'][_0x2203('0x1c')],function(_0x20fbe1){return{'model':db[_0x20fbe1[_0x2203('0x1a')]],'as':_0x20fbe1['as'],'attributes':_0x20fbe1[_0x2203('0x1b')],'include':_0x20fbe1[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x20fbe1[_0x2203('0x1c')],function(_0x44228e){return{'model':db[_0x44228e[_0x2203('0x1a')]],'as':_0x44228e['as'],'attributes':_0x44228e['attributes'],'include':_0x44228e[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x44228e['include'],function(_0x54b90b){return{'model':db[_0x54b90b[_0x2203('0x1a')]],'as':_0x54b90b['as'],'attributes':_0x54b90b['attributes']};}):[]};}):[]};}):[]:[]})[_0x2203('0x20')](function(_0x3b1eeb){logger[_0x2203('0x11')]('ShowTrunk',_0x21ff0d);logger['debug'](_0x2203('0x1e'),_0x21ff0d,JSON['stringify'](_0x3b1eeb));_0xf59954(_0x3b1eeb);})[_0x2203('0x13')](function(_0x5cfe5e){logger[_0x2203('0xe')]('ShowTrunk',_0x5cfe5e[_0x2203('0x10')],_0x21ff0d);_0x520602(_0x287c95[_0x2203('0xe')](0x1f4,_0x5cfe5e[_0x2203('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index b20f219..a84e5fe 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 _0xca7c=['getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','/:id/chat/interactions','/:id/openchannel/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','post','/create_many','addQueues','diskStorage','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','pause','/:id/unpause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addOpenchannelAccounts','addSmsAccounts','addWhatsappAccounts','/:id/square_projects','addSquareProjects','/:id/api_key','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','/:id','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','index','/describe','isAuthenticated','get','/whoami','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues'];(function(_0x52a9d1,_0x59e1a2){var _0x1d063c=function(_0x855eea){while(--_0x855eea){_0x52a9d1['push'](_0x52a9d1['shift']());}};_0x1d063c(++_0x59e1a2);}(_0xca7c,0x1a5));var _0xcca7=function(_0x3b1523,_0xa32606){_0x3b1523=_0x3b1523-0x0;var _0x45ee67=_0xca7c[_0x3b1523];return _0x45ee67;};'use strict';var multer=require(_0xcca7('0x0'));var util=require('util');var path=require(_0xcca7('0x1'));var timeout=require(_0xcca7('0x2'));var express=require(_0xcca7('0x3'));var router=express[_0xcca7('0x4')]();var auth=require(_0xcca7('0x5'));var interaction=require(_0xcca7('0x6'));var config=require(_0xcca7('0x7'));var controller=require(_0xcca7('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xcca7('0x9')]);router['get'](_0xcca7('0xa'),auth[_0xcca7('0xb')](),controller['describe']);router[_0xcca7('0xc')](_0xcca7('0xd'),auth[_0xcca7('0xb')](),controller['whoami']);router[_0xcca7('0xc')]('/:id',auth[_0xcca7('0xb')](),controller['show']);router['get'](_0xcca7('0xe'),controller[_0xcca7('0xf')]);router[_0xcca7('0xc')](_0xcca7('0x10'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x11')]);router['get'](_0xcca7('0x12'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x13')]);router[_0xcca7('0xc')](_0xcca7('0x14'),auth[_0xcca7('0xb')](),controller['getVoiceQueuesRt']);router[_0xcca7('0xc')](_0xcca7('0x15'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x16')]);router[_0xcca7('0xc')](_0xcca7('0x17'),auth[_0xcca7('0xb')](),controller['getRecordings']);router[_0xcca7('0xc')](_0xcca7('0x18'),auth[_0xcca7('0xb')](),controller['getScreenRecordings']);router[_0xcca7('0xc')](_0xcca7('0x19'),auth[_0xcca7('0xb')](),controller['getChatInteractions']);router[_0xcca7('0xc')](_0xcca7('0x1a'),auth[_0xcca7('0xb')](),controller['getOpenchannelInteractions']);router['get']('/:id/mail/interactions',auth[_0xcca7('0xb')](),controller[_0xcca7('0x1b')]);router[_0xcca7('0xc')](_0xcca7('0x1c'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x1d')]);router['get']('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0xcca7('0x1e')]);router[_0xcca7('0xc')]('/:id/whatsapp/interactions',auth[_0xcca7('0xb')](),controller[_0xcca7('0x1f')]);router[_0xcca7('0xc')](_0xcca7('0x20'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x21')]);router[_0xcca7('0xc')](_0xcca7('0x22'),auth['isAuthenticated'](),controller[_0xcca7('0x23')]);router['get'](_0xcca7('0x24'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x25')]);router['get'](_0xcca7('0x26'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x27')]);router['get'](_0xcca7('0x28'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x29')]);router[_0xcca7('0xc')](_0xcca7('0x2a'),auth['isAuthenticated'](),controller['getMailAccounts']);router[_0xcca7('0xc')](_0xcca7('0x2b'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x2c')]);router['get'](_0xcca7('0x2d'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x2e')]);router[_0xcca7('0xc')](_0xcca7('0x2f'),auth[_0xcca7('0xb')](),controller['getChatWebsites']);router['get'](_0xcca7('0x30'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x31')]);router[_0xcca7('0xc')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0xcca7('0x32')]);router[_0xcca7('0xc')](_0xcca7('0x33'),auth[_0xcca7('0xb')](),controller['getScheduledCalls']);router[_0xcca7('0xc')]('/:id/api_key',auth[_0xcca7('0xb')](),controller['getApiKey']);router[_0xcca7('0x34')](_0xcca7('0x35'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0xcca7('0x34')](_0xcca7('0x10'),auth[_0xcca7('0xb')](),controller['addContacts']);router[_0xcca7('0x34')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcca7('0x34')]('/:id/queues',auth[_0xcca7('0xb')](),controller[_0xcca7('0x36')]);var upload=multer({'storage':multer[_0xcca7('0x37')]({'destination':function(_0x23c5ba,_0x4eb23c,_0x42dd0b){_0x42dd0b(null,path['join'](config[_0xcca7('0x38')],_0xcca7('0x39')));},'filename':function(_0x5c21ec,_0x2792cd,_0xdae94c){_0xdae94c(null,util[_0xcca7('0x3a')](_0xcca7('0x3b'),Date[_0xcca7('0x3c')](),_0x2792cd[_0xcca7('0x3d')]));}})});router[_0xcca7('0x34')](_0xcca7('0xe'),upload[_0xcca7('0x3e')](_0xcca7('0x3f')),controller[_0xcca7('0x40')]);router[_0xcca7('0x34')](_0xcca7('0x41'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x42')]);router['post'](_0xcca7('0x43'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x44')]);router[_0xcca7('0x34')]('/:id/pause',auth[_0xcca7('0xb')](),controller[_0xcca7('0x45')]);router[_0xcca7('0x34')](_0xcca7('0x46'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x47')]);router[_0xcca7('0x34')](_0xcca7('0x20'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x48')]);router[_0xcca7('0x34')]('/:id/chat_interactions',auth[_0xcca7('0xb')](),controller[_0xcca7('0x49')]);router[_0xcca7('0x34')](_0xcca7('0x4a'),auth['isAuthenticated'](),controller['addMailInteractions']);router['post'](_0xcca7('0x4b'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x4c')]);router['post'](_0xcca7('0x4d'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x4e')]);router[_0xcca7('0x34')](_0xcca7('0x4f'),auth[_0xcca7('0xb')](),controller['addOpenchannelInteractions']);router['post'](_0xcca7('0x50'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x51')]);router[_0xcca7('0x34')](_0xcca7('0x28'),auth['isAuthenticated'](),controller['addFaxAccounts']);router['post']('/:id/mail_accounts',auth[_0xcca7('0xb')](),controller['addMailAccounts']);router[_0xcca7('0x34')](_0xcca7('0x2b'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x52')]);router['post']('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xcca7('0x53')]);router['post'](_0xcca7('0x2f'),auth[_0xcca7('0xb')](),controller['addChatWebsites']);router[_0xcca7('0x34')](_0xcca7('0x30'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x54')]);router[_0xcca7('0x34')](_0xcca7('0x55'),auth['isAuthenticated'](),controller[_0xcca7('0x56')]);router[_0xcca7('0x34')](_0xcca7('0x57'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x58')]);router[_0xcca7('0x59')]('/:id',auth[_0xcca7('0xb')](),controller[_0xcca7('0x5a')]);router['put'](_0xcca7('0x5b'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x5c')]);router[_0xcca7('0x5d')]('/:id/queues',auth[_0xcca7('0xb')](),controller[_0xcca7('0x5e')]);router[_0xcca7('0x5d')](_0xcca7('0x20'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x5f')]);router[_0xcca7('0x5d')](_0xcca7('0x60'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x61')]);router[_0xcca7('0x5d')]('/:id/chat_interactions',auth[_0xcca7('0xb')](),controller[_0xcca7('0x62')]);router[_0xcca7('0x5d')](_0xcca7('0x4a'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x63')]);router[_0xcca7('0x5d')](_0xcca7('0x4b'),auth['isAuthenticated'](),controller[_0xcca7('0x64')]);router['delete']('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0xcca7('0x65')]);router['delete'](_0xcca7('0x4f'),auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router[_0xcca7('0x5d')](_0xcca7('0x50'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x66')]);router[_0xcca7('0x5d')](_0xcca7('0x28'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x67')]);router[_0xcca7('0x5d')](_0xcca7('0x2a'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x68')]);router[_0xcca7('0x5d')](_0xcca7('0x2b'),auth['isAuthenticated'](),controller[_0xcca7('0x69')]);router[_0xcca7('0x5d')]('/:id/sms_accounts',auth[_0xcca7('0xb')](),controller['removeSmsAccounts']);router['delete'](_0xcca7('0x2f'),auth['isAuthenticated'](),controller[_0xcca7('0x6a')]);router[_0xcca7('0x5d')](_0xcca7('0x30'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x6b')]);router[_0xcca7('0x5d')](_0xcca7('0x55'),auth[_0xcca7('0xb')](),controller[_0xcca7('0x6c')]);router[_0xcca7('0x5d')](_0xcca7('0x57'),auth[_0xcca7('0xb')](),controller['removeApiKey']);module[_0xcca7('0x6d')]=router; \ No newline at end of file +var _0x39f1=['file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/whatsapp_interactions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','/:id/square_projects','addSquareProjects','put','update','delete','removeQueues','removeTeams','/:id/fax_interactions','removeSmsInteractions','/:id/openchannel_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/whoami','/:id','/:id/avatar','getAvatar','/:id/contacts','getContacts','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','/create_many','bulkCreate','post','addContacts','create','/:id/queues','diskStorage','join','root','server/files/images/','format','now','originalname'];(function(_0x8426a0,_0x183ad8){var _0x4f71e3=function(_0x3df1bb){while(--_0x3df1bb){_0x8426a0['push'](_0x8426a0['shift']());}};_0x4f71e3(++_0x183ad8);}(_0x39f1,0x10e));var _0x139f=function(_0x403e73,_0x43a5df){_0x403e73=_0x403e73-0x0;var _0x5d59e2=_0x39f1[_0x403e73];return _0x5d59e2;};'use strict';var multer=require('multer');var util=require(_0x139f('0x0'));var path=require(_0x139f('0x1'));var timeout=require(_0x139f('0x2'));var express=require(_0x139f('0x3'));var router=express[_0x139f('0x4')]();var auth=require(_0x139f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x139f('0x6'));var controller=require('./user.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x139f('0x7')]);router[_0x139f('0x8')](_0x139f('0x9'),auth[_0x139f('0xa')](),controller[_0x139f('0xb')]);router[_0x139f('0x8')](_0x139f('0xc'),auth[_0x139f('0xa')](),controller['whoami']);router['get'](_0x139f('0xd'),auth[_0x139f('0xa')](),controller['show']);router[_0x139f('0x8')](_0x139f('0xe'),controller[_0x139f('0xf')]);router['get'](_0x139f('0x10'),auth[_0x139f('0xa')](),controller[_0x139f('0x11')]);router[_0x139f('0x8')]('/:id/queues',auth[_0x139f('0xa')](),controller[_0x139f('0x12')]);router[_0x139f('0x8')]('/:id/queues_rt',auth[_0x139f('0xa')](),controller[_0x139f('0x13')]);router[_0x139f('0x8')](_0x139f('0x14'),auth['isAuthenticated'](),controller[_0x139f('0x15')]);router[_0x139f('0x8')](_0x139f('0x16'),auth['isAuthenticated'](),controller[_0x139f('0x17')]);router[_0x139f('0x8')](_0x139f('0x18'),auth[_0x139f('0xa')](),controller[_0x139f('0x19')]);router[_0x139f('0x8')](_0x139f('0x1a'),auth[_0x139f('0xa')](),controller[_0x139f('0x1b')]);router[_0x139f('0x8')](_0x139f('0x1c'),auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router[_0x139f('0x8')](_0x139f('0x1d'),auth[_0x139f('0xa')](),controller[_0x139f('0x1e')]);router[_0x139f('0x8')](_0x139f('0x1f'),auth[_0x139f('0xa')](),controller['getSmsInteractions']);router[_0x139f('0x8')](_0x139f('0x20'),auth['isAuthenticated'](),controller['getFaxInteractions']);router['get'](_0x139f('0x21'),auth[_0x139f('0xa')](),controller[_0x139f('0x22')]);router['get'](_0x139f('0x23'),auth[_0x139f('0xa')](),controller[_0x139f('0x24')]);router[_0x139f('0x8')](_0x139f('0x25'),auth[_0x139f('0xa')](),controller[_0x139f('0x26')]);router[_0x139f('0x8')](_0x139f('0x27'),auth[_0x139f('0xa')](),controller[_0x139f('0x28')]);router[_0x139f('0x8')](_0x139f('0x29'),auth['isAuthenticated'](),controller[_0x139f('0x2a')]);router[_0x139f('0x8')](_0x139f('0x2b'),auth[_0x139f('0xa')](),controller[_0x139f('0x2c')]);router[_0x139f('0x8')](_0x139f('0x2d'),auth[_0x139f('0xa')](),controller['getMailAccounts']);router[_0x139f('0x8')](_0x139f('0x2e'),auth[_0x139f('0xa')](),controller[_0x139f('0x2f')]);router[_0x139f('0x8')](_0x139f('0x30'),auth['isAuthenticated'](),controller[_0x139f('0x31')]);router['get']('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x139f('0x32')]);router[_0x139f('0x8')](_0x139f('0x33'),auth[_0x139f('0xa')](),controller['getWhatsappAccounts']);router[_0x139f('0x8')]('/:id/square_projects',auth['isAuthenticated'](),controller['getSquareProjects']);router[_0x139f('0x8')](_0x139f('0x34'),auth[_0x139f('0xa')](),controller[_0x139f('0x35')]);router['get'](_0x139f('0x36'),auth[_0x139f('0xa')](),controller[_0x139f('0x37')]);router['post'](_0x139f('0x38'),auth['isAuthenticated'](),controller[_0x139f('0x39')]);router[_0x139f('0x3a')](_0x139f('0x10'),auth['isAuthenticated'](),controller[_0x139f('0x3b')]);router['post']('/',auth[_0x139f('0xa')](),controller[_0x139f('0x3c')]);router[_0x139f('0x3a')](_0x139f('0x3d'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0x139f('0x3e')]({'destination':function(_0x45ed0d,_0x4948e1,_0x26af3e){_0x26af3e(null,path[_0x139f('0x3f')](config[_0x139f('0x40')],_0x139f('0x41')));},'filename':function(_0x33d63f,_0x345009,_0x4b9af1){_0x4b9af1(null,util[_0x139f('0x42')]('%s-%s',Date[_0x139f('0x43')](),_0x345009[_0x139f('0x44')]));}})});router[_0x139f('0x3a')](_0x139f('0xe'),upload['single'](_0x139f('0x45')),controller[_0x139f('0x46')]);router[_0x139f('0x3a')](_0x139f('0x47'),auth['isAuthenticated'](),controller[_0x139f('0x48')]);router['post'](_0x139f('0x49'),auth[_0x139f('0xa')](),controller[_0x139f('0x4a')]);router[_0x139f('0x3a')](_0x139f('0x4b'),auth[_0x139f('0xa')](),controller[_0x139f('0x4c')]);router[_0x139f('0x3a')](_0x139f('0x4d'),auth[_0x139f('0xa')](),controller[_0x139f('0x4e')]);router[_0x139f('0x3a')]('/:id/teams',auth[_0x139f('0xa')](),controller[_0x139f('0x4f')]);router[_0x139f('0x3a')](_0x139f('0x50'),auth[_0x139f('0xa')](),controller[_0x139f('0x51')]);router['post'](_0x139f('0x52'),auth['isAuthenticated'](),controller[_0x139f('0x53')]);router['post']('/:id/fax_interactions',auth[_0x139f('0xa')](),controller[_0x139f('0x54')]);router[_0x139f('0x3a')](_0x139f('0x55'),auth[_0x139f('0xa')](),controller[_0x139f('0x56')]);router[_0x139f('0x3a')]('/:id/openchannel_interactions',auth[_0x139f('0xa')](),controller['addOpenchannelInteractions']);router[_0x139f('0x3a')](_0x139f('0x57'),auth['isAuthenticated'](),controller['addWhatsappInteractions']);router[_0x139f('0x3a')]('/:id/fax_accounts',auth[_0x139f('0xa')](),controller['addFaxAccounts']);router['post'](_0x139f('0x2d'),auth[_0x139f('0xa')](),controller[_0x139f('0x58')]);router[_0x139f('0x3a')](_0x139f('0x2e'),auth[_0x139f('0xa')](),controller[_0x139f('0x59')]);router[_0x139f('0x3a')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x139f('0x5a')]);router[_0x139f('0x3a')](_0x139f('0x5b'),auth['isAuthenticated'](),controller[_0x139f('0x5c')]);router[_0x139f('0x3a')](_0x139f('0x33'),auth[_0x139f('0xa')](),controller[_0x139f('0x5d')]);router[_0x139f('0x3a')](_0x139f('0x5e'),auth[_0x139f('0xa')](),controller[_0x139f('0x5f')]);router[_0x139f('0x3a')](_0x139f('0x36'),auth['isAuthenticated'](),controller['createApiKey']);router[_0x139f('0x60')](_0x139f('0xd'),auth[_0x139f('0xa')](),controller[_0x139f('0x61')]);router[_0x139f('0x60')]('/:id/password',auth[_0x139f('0xa')](),controller['changePassword']);router[_0x139f('0x62')]('/:id/queues',auth[_0x139f('0xa')](),controller[_0x139f('0x63')]);router[_0x139f('0x62')](_0x139f('0x23'),auth[_0x139f('0xa')](),controller[_0x139f('0x64')]);router[_0x139f('0x62')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x139f('0x62')](_0x139f('0x50'),auth[_0x139f('0xa')](),controller['removeChatInteractions']);router['delete'](_0x139f('0x52'),auth[_0x139f('0xa')](),controller['removeMailInteractions']);router['delete'](_0x139f('0x65'),auth[_0x139f('0xa')](),controller['removeFaxInteractions']);router[_0x139f('0x62')](_0x139f('0x55'),auth[_0x139f('0xa')](),controller[_0x139f('0x66')]);router[_0x139f('0x62')](_0x139f('0x67'),auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router[_0x139f('0x62')](_0x139f('0x57'),auth['isAuthenticated'](),controller[_0x139f('0x68')]);router[_0x139f('0x62')](_0x139f('0x2b'),auth[_0x139f('0xa')](),controller[_0x139f('0x69')]);router['delete'](_0x139f('0x2d'),auth[_0x139f('0xa')](),controller[_0x139f('0x6a')]);router[_0x139f('0x62')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x139f('0x6b')]);router[_0x139f('0x62')](_0x139f('0x30'),auth[_0x139f('0xa')](),controller['removeSmsAccounts']);router[_0x139f('0x62')](_0x139f('0x5b'),auth[_0x139f('0xa')](),controller[_0x139f('0x6c')]);router[_0x139f('0x62')](_0x139f('0x33'),auth['isAuthenticated'](),controller[_0x139f('0x6d')]);router[_0x139f('0x62')](_0x139f('0x5e'),auth[_0x139f('0xa')](),controller[_0x139f('0x6e')]);router[_0x139f('0x62')](_0x139f('0x36'),auth[_0x139f('0xa')](),controller[_0x139f('0x6f')]);module[_0x139f('0x70')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 4ff9983..94359be 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 _0xc9e6=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','force_rport,comedia','nat','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','uac','uas','fingerprint','certificate','active','passive','actpass','nonat','showWebBar','get','isArray','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','wss','force_avp','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','rtcp_mux','TEXT','permissions','phoneBarEnableScreenRecordingByAgent','string','true','false','blocked','blockedAt','loginAttempts','util','lodash','STRING','setDataValue','name','defaultuser','The\x20name\x20of\x20the\x20user','fullname','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','local','INTEGER','accountcode','callerid','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB','udp','join','transport','split'];(function(_0x4ce14e,_0x4c1e37){var _0x5a42a1=function(_0x10371e){while(--_0x10371e){_0x4ce14e['push'](_0x4ce14e['shift']());}};_0x5a42a1(++_0x4c1e37);}(_0xc9e6,0xe6));var _0x6c9e=function(_0x1aca8e,_0x114212){_0x1aca8e=_0x1aca8e-0x0;var _0x1b91f5=_0xc9e6[_0x1aca8e];return _0x1b91f5;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x6c9e('0x0'));var _=require(_0x6c9e('0x1'));module['exports']={'name':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x267c1b){this[_0x6c9e('0x3')](_0x6c9e('0x4'),_0x267c1b);this[_0x6c9e('0x3')](_0x6c9e('0x5'),_0x267c1b);},'comment':_0x6c9e('0x6')},'fullname':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':![],'set':function(_0x3adf76){this[_0x6c9e('0x3')](_0x6c9e('0x7'),_0x3adf76);this['setDataValue']('callerid',util[_0x6c9e('0x8')](_0x6c9e('0x9'),_0x3adf76,this['getDataValue'](_0x6c9e('0xa'))));}},'alias':{'type':Sequelize[_0x6c9e('0x2')]},'email':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':![],'unique':_0x6c9e('0xb'),'validate':{'isEmail':!![]},'set':function(_0x43bc4f){if(_0x43bc4f){this[_0x6c9e('0x3')]('email',_0x43bc4f[_0x6c9e('0xc')]());}}},'role':{'type':Sequelize[_0x6c9e('0xd')](_0x6c9e('0xe'),_0x6c9e('0xf'),_0x6c9e('0x10'),_0x6c9e('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x6c9e('0x12')},'internal':{'type':Sequelize[_0x6c9e('0x13')](0xb),'allowNull':![],'unique':_0x6c9e('0xa'),'set':function(_0x124565){this[_0x6c9e('0x3')]('internal',_0x124565);this[_0x6c9e('0x3')](_0x6c9e('0x14'),_0x124565);this[_0x6c9e('0x3')](_0x6c9e('0x15'),util[_0x6c9e('0x8')](_0x6c9e('0x9'),this[_0x6c9e('0x16')]('fullname'),_0x124565));}},'salt':{'type':Sequelize[_0x6c9e('0x2')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x6c9e('0x2')]},'address':{'type':Sequelize[_0x6c9e('0x2')]},'zipcode':{'type':Sequelize[_0x6c9e('0x2')]},'userpic':{'type':Sequelize[_0x6c9e('0x2')]},'city':{'type':Sequelize[_0x6c9e('0x2')]},'country':{'type':Sequelize[_0x6c9e('0x2')]},'online':{'type':Sequelize[_0x6c9e('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x6c9e('0x18')]},'voicePause':{'type':Sequelize[_0x6c9e('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x6c9e('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x6c9e('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x6c9e('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x6c9e('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x6c9e('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x6c9e('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x6c9e('0x19')},'lastPauseAt':{'type':Sequelize[_0x6c9e('0x18')]},'chatCapacity':{'type':Sequelize[_0x6c9e('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x6c9e('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x6c9e('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x6c9e('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x6c9e('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x6c9e('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x6c9e('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x6c9e('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x6c9e('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x6c9e('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x6c9e('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'host':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'port':{'type':Sequelize[_0x6c9e('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x6c9e('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x6c9e('0xd')](_0x6c9e('0x1a'),_0x6c9e('0xf'),'peer'),'allowNull':!![],'defaultValue':_0x6c9e('0x1a')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x6c9e('0xd')](_0x6c9e('0x1b'),_0x6c9e('0x1c'),'ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0x6c9e('0x1d')),'allowNull':!![]},'deny':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'permit':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'secret':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![],'defaultValue':_0x6c9e('0x1e'),'set':function(_0x12adf9){this[_0x6c9e('0x3')]('transport',_0x12adf9?_0x12adf9[_0x6c9e('0x1f')](','):null);},'get':function(){return this['getDataValue'](_0x6c9e('0x20'))?this[_0x6c9e('0x16')](_0x6c9e('0x20'))[_0x6c9e('0x21')](','):null;},'comment':_0x6c9e('0x22')},'dtmfmode':{'type':Sequelize['ENUM'](_0x6c9e('0x23'),_0x6c9e('0x24'),_0x6c9e('0x25'),_0x6c9e('0x26'),_0x6c9e('0x27')),'allowNull':!![],'defaultValue':_0x6c9e('0x23')},'directmedia':{'type':Sequelize[_0x6c9e('0xd')](_0x6c9e('0x28'),'no','nonat',_0x6c9e('0x29'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6c9e('0xd')](_0x6c9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'nat':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![],'defaultValue':_0x6c9e('0x2a'),'set':function(_0x26ad40){this[_0x6c9e('0x3')](_0x6c9e('0x2b'),_0x26ad40?_0x26ad40[_0x6c9e('0x1f')](','):null);},'get':function(){return this['getDataValue'](_0x6c9e('0x2b'))?this[_0x6c9e('0x16')]('nat')[_0x6c9e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x6c9e('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x6c9e('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x6c9e('0x2')]},'language':{'type':Sequelize[_0x6c9e('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6c9e('0x2')]},'disallow':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':![],'defaultValue':_0x6c9e('0x2c')},'allow':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':![],'defaultValue':_0x6c9e('0x2d'),'set':function(_0x207a85){this[_0x6c9e('0x3')](_0x6c9e('0x2e'),_0x207a85?_0x207a85['join'](';'):_0x6c9e('0x2d'));},'get':function(){return this[_0x6c9e('0x16')](_0x6c9e('0x2e'))?this['getDataValue']('allow')[_0x6c9e('0x21')](';'):null;},'comment':_0x6c9e('0x2f')},'autoframing':{'type':Sequelize[_0x6c9e('0xd')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x1603fc){this[_0x6c9e('0x3')](_0x6c9e('0x30'),_0x1603fc?_0x1603fc['join'](','):null);},'get':function(){return this[_0x6c9e('0x16')]('insecure')?this[_0x6c9e('0x16')](_0x6c9e('0x30'))[_0x6c9e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x6c9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6c9e('0xd')](_0x6c9e('0x28'),'no',_0x6c9e('0x31')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x6c9e('0xd')](_0x6c9e('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x6c9e('0xd')](_0x6c9e('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![],'defaultValue':_0x6c9e('0x32')},'amaflags':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x6c9e('0xd')]('yes','no'),'allowNull':!![],'defaultValue':_0x6c9e('0x28')},'busylevel':{'type':Sequelize[_0x6c9e('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x6c9e('0xd')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x6c9e('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x6c9e('0xd')](_0x6c9e('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x6c9e('0xd')](_0x6c9e('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x6c9e('0xd')](_0x6c9e('0x28'),'no',_0x6c9e('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x6c9e('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x6c9e('0xd')](_0x6c9e('0x34'),_0x6c9e('0x35'),_0x6c9e('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x6c9e('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x6c9e('0xd')](_0x6c9e('0x37'),_0x6c9e('0x38')),'allowNull':!![],'defaultValue':_0x6c9e('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x6c9e('0xd')]('yes','no'),'allowNull':!![],'defaultValue':_0x6c9e('0x28')},'keepalive':{'type':Sequelize[_0x6c9e('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x6c9e('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x6c9e('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x6c9e('0xd')](_0x6c9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x6c9e('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x6c9e('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x6c9e('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6c9e('0xd')](_0x6c9e('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x6c9e('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x6c9e('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x6c9e('0xd')](_0x6c9e('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x6c9e('0xd')]('yes','no',_0x6c9e('0x39'),_0x6c9e('0x3a')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x6c9e('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x6c9e('0xd')](_0x6c9e('0x3b'),_0x6c9e('0x3c'),_0x6c9e('0x3d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x6c9e('0xd')](_0x6c9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x6c9e('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x6c9e('0xd')](_0x6c9e('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x6c9e('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x6c9e('0x28'),'no',_0x6c9e('0x3e'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x6c9e('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x6c9e('0x2')]},'resetPasswordExpires':{'type':Sequelize[_0x6c9e('0x18')]},'showWebBar':{'type':Sequelize[_0x6c9e('0x13')],'defaultValue':0x0,'set':function(_0x1a2cd8){this[_0x6c9e('0x3')](_0x6c9e('0x3f'),_0x1a2cd8);var _0xe1b9ca=this[_0x6c9e('0x40')]({'plain':!![]});switch(_0x1a2cd8){case 0x0:case 0x1:var _0x80a7cf=_0xe1b9ca[_0x6c9e('0x20')]?_[_0x6c9e('0x41')](_0xe1b9ca[_0x6c9e('0x20')])?_0xe1b9ca[_0x6c9e('0x20')][_0x6c9e('0x1f')]():_0xe1b9ca[_0x6c9e('0x20')]:_0x6c9e('0x1e');if(_0x80a7cf==='wss'){_0x80a7cf=_0x6c9e('0x1e');}this[_0x6c9e('0x3')](_0x6c9e('0x20'),_0x80a7cf);this[_0x6c9e('0x3')](_0x6c9e('0x42'),'no');this[_0x6c9e('0x3')](_0x6c9e('0x43'),null);this['setDataValue']('force_avp',null);this[_0x6c9e('0x3')](_0x6c9e('0x44'),null);this[_0x6c9e('0x3')](_0x6c9e('0x45'),null);this['setDataValue'](_0x6c9e('0x46'),null);this['setDataValue'](_0x6c9e('0x47'),null);this[_0x6c9e('0x3')](_0x6c9e('0x48'),null);this[_0x6c9e('0x3')]('dtlsprivatekey',null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0x6c9e('0x3')](_0x6c9e('0x20'),_0x6c9e('0x49'));this[_0x6c9e('0x3')](_0x6c9e('0x42'),_0x6c9e('0x28'));this['setDataValue'](_0x6c9e('0x43'),'yes');this[_0x6c9e('0x3')](_0x6c9e('0x4a'),_0x6c9e('0x28'));this[_0x6c9e('0x3')]('icesupport',_0x6c9e('0x28'));this[_0x6c9e('0x3')](_0x6c9e('0x45'),_0x6c9e('0x28'));this[_0x6c9e('0x3')](_0x6c9e('0x46'),'no');this['setDataValue'](_0x6c9e('0x47'),_0x6c9e('0x3d'));this[_0x6c9e('0x3')]('dtlscertfile',_0xe1b9ca['dtlscertfile']||_0x6c9e('0x4b'));this[_0x6c9e('0x3')](_0x6c9e('0x4c'),_0xe1b9ca[_0x6c9e('0x4c')]||_0x6c9e('0x4d'));this[_0x6c9e('0x3')](_0x6c9e('0x4e'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x6c9e('0x4f')],'set':function(_0x4804f3){this[_0x6c9e('0x3')](_0x6c9e('0x50'),_0x4804f3?_0x4804f3[_0x6c9e('0x1f')](','):[]);},'get':function(){return this[_0x6c9e('0x16')]('permissions')?_['map'](this[_0x6c9e('0x16')](_0x6c9e('0x50'))[_0x6c9e('0x21')](','),function(_0x2e3431){return parseInt(_0x2e3431,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x6c9e('0x2')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x6c9e('0x2')]},'phoneBarBusyNumber':{'type':Sequelize[_0x6c9e('0x2')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x6c9e('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x6c9e('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x6c9e('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x6c9e('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x6c9e('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x6c9e('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x6c9e('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x6c9e('0xd')](_0x6c9e('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x6c9e('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x6c9e('0x2')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x6c9e('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x6c9e('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x6c9e('0x16')](_0x6c9e('0x51'))?this[_0x6c9e('0x16')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x6c9e('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x6c9e('0x17')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x6c9e('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x6c9e('0x17')],'defaultValue':![],'set':function(_0x4143ed){if(typeof _0x4143ed===_0x6c9e('0x52')){var _0x3155d7=_0x4143ed==='1'?!![]:_0x4143ed==='0'?![]:_0x4143ed===_0x6c9e('0x53')?!![]:_0x4143ed===_0x6c9e('0x54')?![]:![];this['setDataValue']('screenrecording',_0x3155d7);}else{this[_0x6c9e('0x3')]('screenrecording',_0x4143ed);}}},'blocked':{'type':Sequelize[_0x6c9e('0x17')],'defaultValue':![],'set':function(_0x2d9953){this[_0x6c9e('0x3')](_0x6c9e('0x55'),_0x2d9953);if(_0x2d9953===!![]){this['setDataValue'](_0x6c9e('0x56'),moment());this[_0x6c9e('0x3')](_0x6c9e('0x57'),0x0);}else{this[_0x6c9e('0x3')](_0x6c9e('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x6c9e('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x6c9e('0x17')],'defaultValue':![]}}; \ No newline at end of file +var _0x8b2b=['PROHIB','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','accept','refuse','originate','uac','fingerprint','certificate','active','actpass','update,nonat','showWebBar','get','isArray','udp','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','dtlsverify','/etc/pki/tls/certs/motion.crt','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','fullname','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','agent','telephone','local','INTEGER','format','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','ENUM','friend','user','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8b2b,0x148));var _0xb8b2=function(_0x7bde64,_0x4f3fc5){_0x7bde64=_0x7bde64-0x0;var _0x14bb79=_0x8b2b[_0x7bde64];return _0x14bb79;};'use strict';var Sequelize=require(_0xb8b2('0x0'));var moment=require(_0xb8b2('0x1'));var util=require(_0xb8b2('0x2'));var _=require(_0xb8b2('0x3'));module[_0xb8b2('0x4')]={'name':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':![],'unique':_0xb8b2('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0xa17591){this[_0xb8b2('0x7')]('name',_0xa17591);this['setDataValue'](_0xb8b2('0x8'),_0xa17591);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x4560f2){this[_0xb8b2('0x7')](_0xb8b2('0x9'),_0x4560f2);this['setDataValue']('callerid',util['format'](_0xb8b2('0xa'),_0x4560f2,this[_0xb8b2('0xb')](_0xb8b2('0xc'))));}},'alias':{'type':Sequelize[_0xb8b2('0x5')]},'email':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x429047){if(_0x429047){this['setDataValue'](_0xb8b2('0xd'),_0x429047[_0xb8b2('0xe')]());}}},'role':{'type':Sequelize['ENUM']('admin','user',_0xb8b2('0xf'),_0xb8b2('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xb8b2('0x5')],'defaultValue':_0xb8b2('0x11')},'internal':{'type':Sequelize[_0xb8b2('0x12')](0xb),'allowNull':![],'unique':'internal','set':function(_0x30fd19){this[_0xb8b2('0x7')](_0xb8b2('0xc'),_0x30fd19);this[_0xb8b2('0x7')]('accountcode',_0x30fd19);this[_0xb8b2('0x7')]('callerid',util[_0xb8b2('0x13')](_0xb8b2('0xa'),this[_0xb8b2('0xb')](_0xb8b2('0x9')),_0x30fd19));}},'salt':{'type':Sequelize[_0xb8b2('0x5')]},'phone':{'type':Sequelize[_0xb8b2('0x5')]},'mobile':{'type':Sequelize[_0xb8b2('0x5')]},'address':{'type':Sequelize[_0xb8b2('0x5')]},'zipcode':{'type':Sequelize[_0xb8b2('0x5')]},'userpic':{'type':Sequelize[_0xb8b2('0x5')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xb8b2('0x5')]},'online':{'type':Sequelize[_0xb8b2('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xb8b2('0x15')]},'voicePause':{'type':Sequelize[_0xb8b2('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xb8b2('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xb8b2('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xb8b2('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xb8b2('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xb8b2('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xb8b2('0x5')],'defaultValue':_0xb8b2('0x16')},'lastPauseAt':{'type':Sequelize[_0xb8b2('0x15')]},'chatCapacity':{'type':Sequelize[_0xb8b2('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xb8b2('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xb8b2('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xb8b2('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xb8b2('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xb8b2('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xb8b2('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xb8b2('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xb8b2('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xb8b2('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xb8b2('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xb8b2('0x14')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![],'defaultValue':_0xb8b2('0x17')},'ipaddr':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0xb8b2('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xb8b2('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xb8b2('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xb8b2('0x18')](_0xb8b2('0x19'),_0xb8b2('0x1a'),'peer'),'allowNull':!![],'defaultValue':_0xb8b2('0x19')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xb8b2('0x18')]('ALLOWED_NOT_SCREENED',_0xb8b2('0x1b'),_0xb8b2('0x1c'),'ALLOWED',_0xb8b2('0x1d'),_0xb8b2('0x1e'),_0xb8b2('0x1f'),_0xb8b2('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![],'defaultValue':'udp','set':function(_0x986505){this['setDataValue'](_0xb8b2('0x21'),_0x986505?_0x986505[_0xb8b2('0x22')](','):null);},'get':function(){return this['getDataValue'](_0xb8b2('0x21'))?this[_0xb8b2('0xb')](_0xb8b2('0x21'))['split'](','):null;},'comment':_0xb8b2('0x23')},'dtmfmode':{'type':Sequelize['ENUM'](_0xb8b2('0x24'),_0xb8b2('0x25'),_0xb8b2('0x26'),_0xb8b2('0x27'),_0xb8b2('0x28')),'allowNull':!![],'defaultValue':_0xb8b2('0x24')},'directmedia':{'type':Sequelize[_0xb8b2('0x18')](_0xb8b2('0x29'),'no',_0xb8b2('0x2a'),_0xb8b2('0x2b'),_0xb8b2('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xb8b2('0x18')](_0xb8b2('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x2ce091){this[_0xb8b2('0x7')]('nat',_0x2ce091?_0x2ce091[_0xb8b2('0x22')](','):null);},'get':function(){return this[_0xb8b2('0xb')](_0xb8b2('0x2d'))?this[_0xb8b2('0xb')]('nat')[_0xb8b2('0x2e')](','):null;},'comment':_0xb8b2('0x2f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xb8b2('0x5')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xb8b2('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xb8b2('0x5')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb8b2('0x30')},'allow':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':![],'defaultValue':_0xb8b2('0x31'),'set':function(_0x40425e){this[_0xb8b2('0x7')](_0xb8b2('0x32'),_0x40425e?_0x40425e[_0xb8b2('0x22')](';'):_0xb8b2('0x31'));},'get':function(){return this[_0xb8b2('0xb')](_0xb8b2('0x32'))?this[_0xb8b2('0xb')](_0xb8b2('0x32'))[_0xb8b2('0x2e')](';'):null;},'comment':_0xb8b2('0x33')},'autoframing':{'type':Sequelize[_0xb8b2('0x18')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![],'set':function(_0x384637){this[_0xb8b2('0x7')](_0xb8b2('0x34'),_0x384637?_0x384637[_0xb8b2('0x22')](','):null);},'get':function(){return this[_0xb8b2('0xb')](_0xb8b2('0x34'))?this[_0xb8b2('0xb')](_0xb8b2('0x34'))[_0xb8b2('0x2e')](','):null;},'comment':_0xb8b2('0x35')},'trustrpid':{'type':Sequelize[_0xb8b2('0x18')](_0xb8b2('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xb8b2('0x18')](_0xb8b2('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0xb8b2('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xb8b2('0x18')](_0xb8b2('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xb8b2('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xb8b2('0x18')](_0xb8b2('0x29'),'no'),'allowNull':!![],'defaultValue':_0xb8b2('0x29')},'busylevel':{'type':Sequelize[_0xb8b2('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xb8b2('0x18')](_0xb8b2('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xb8b2('0x18')](_0xb8b2('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xb8b2('0x18')](_0xb8b2('0x29'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xb8b2('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xb8b2('0x18')](_0xb8b2('0x37'),_0xb8b2('0x38'),_0xb8b2('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xb8b2('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xb8b2('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0xb8b2('0x3a'),'uas'),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xb8b2('0x29'),'no'),'allowNull':!![],'defaultValue':_0xb8b2('0x29')},'keepalive':{'type':Sequelize[_0xb8b2('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xb8b2('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xb8b2('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xb8b2('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xb8b2('0x18')](_0xb8b2('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xb8b2('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xb8b2('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xb8b2('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xb8b2('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xb8b2('0x18')](_0xb8b2('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xb8b2('0x18')](_0xb8b2('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xb8b2('0x18')](_0xb8b2('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xb8b2('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xb8b2('0x18')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xb8b2('0x29'),'no',_0xb8b2('0x3b'),_0xb8b2('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xb8b2('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xb8b2('0x18')](_0xb8b2('0x3d'),'passive',_0xb8b2('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xb8b2('0x18')](_0xb8b2('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xb8b2('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xb8b2('0x18')](_0xb8b2('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xb8b2('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xb8b2('0x18')]('yes','no',_0xb8b2('0x2a'),_0xb8b2('0x2b'),_0xb8b2('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xb8b2('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0xb8b2('0x15')]},'showWebBar':{'type':Sequelize[_0xb8b2('0x12')],'defaultValue':0x0,'set':function(_0x35c8bb){this[_0xb8b2('0x7')](_0xb8b2('0x40'),_0x35c8bb);var _0x34fa16=this[_0xb8b2('0x41')]({'plain':!![]});switch(_0x35c8bb){case 0x0:case 0x1:var _0x4c2cae=_0x34fa16[_0xb8b2('0x21')]?_[_0xb8b2('0x42')](_0x34fa16[_0xb8b2('0x21')])?_0x34fa16[_0xb8b2('0x21')][_0xb8b2('0x22')]():_0x34fa16[_0xb8b2('0x21')]:_0xb8b2('0x43');if(_0x4c2cae===_0xb8b2('0x44')){_0x4c2cae=_0xb8b2('0x43');}this['setDataValue'](_0xb8b2('0x21'),_0x4c2cae);this[_0xb8b2('0x7')](_0xb8b2('0x45'),'no');this[_0xb8b2('0x7')](_0xb8b2('0x46'),null);this[_0xb8b2('0x7')](_0xb8b2('0x47'),null);this['setDataValue'](_0xb8b2('0x48'),null);this[_0xb8b2('0x7')](_0xb8b2('0x49'),null);this[_0xb8b2('0x7')]('dtlsverify',null);this[_0xb8b2('0x7')](_0xb8b2('0x4a'),null);this['setDataValue'](_0xb8b2('0x4b'),null);this[_0xb8b2('0x7')](_0xb8b2('0x4c'),null);this[_0xb8b2('0x7')](_0xb8b2('0x4d'),'no');break;case 0x2:this['setDataValue'](_0xb8b2('0x21'),_0xb8b2('0x44'));this['setDataValue'](_0xb8b2('0x45'),_0xb8b2('0x29'));this['setDataValue']('avpf',_0xb8b2('0x29'));this[_0xb8b2('0x7')]('force_avp',_0xb8b2('0x29'));this[_0xb8b2('0x7')](_0xb8b2('0x48'),_0xb8b2('0x29'));this[_0xb8b2('0x7')](_0xb8b2('0x49'),_0xb8b2('0x29'));this['setDataValue'](_0xb8b2('0x4e'),'no');this[_0xb8b2('0x7')](_0xb8b2('0x4a'),_0xb8b2('0x3e'));this[_0xb8b2('0x7')](_0xb8b2('0x4b'),_0x34fa16[_0xb8b2('0x4b')]||_0xb8b2('0x4f'));this['setDataValue'](_0xb8b2('0x4c'),_0x34fa16[_0xb8b2('0x4c')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0xb8b2('0x4d'),_0xb8b2('0x29'));break;default:}}},'permissions':{'type':Sequelize[_0xb8b2('0x50')],'set':function(_0x16de6e){this['setDataValue'](_0xb8b2('0x51'),_0x16de6e?_0x16de6e['join'](','):[]);},'get':function(){return this[_0xb8b2('0xb')](_0xb8b2('0x51'))?_[_0xb8b2('0x52')](this['getDataValue'](_0xb8b2('0x51'))['split'](','),function(_0x368ff9){return parseInt(_0x368ff9,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0xb8b2('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0xb8b2('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0xb8b2('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xb8b2('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xb8b2('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xb8b2('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xb8b2('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xb8b2('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0xb8b2('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xb8b2('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xb8b2('0x5')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0xb8b2('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xb8b2('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xb8b2('0x53')],'get':function(){return this['getDataValue'](_0xb8b2('0x54'))?this[_0xb8b2('0xb')](_0xb8b2('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xb8b2('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xb8b2('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xb8b2('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xb8b2('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xb8b2('0x14')],'defaultValue':![],'set':function(_0x265ade){if(typeof _0x265ade==='string'){var _0x585c2c=_0x265ade==='1'?!![]:_0x265ade==='0'?![]:_0x265ade===_0xb8b2('0x55')?!![]:_0x265ade===_0xb8b2('0x56')?![]:![];this[_0xb8b2('0x7')]('screenrecording',_0x585c2c);}else{this[_0xb8b2('0x7')](_0xb8b2('0x57'),_0x265ade);}}},'blocked':{'type':Sequelize[_0xb8b2('0x14')],'defaultValue':![],'set':function(_0x16d9c4){this[_0xb8b2('0x7')](_0xb8b2('0x58'),_0x16d9c4);if(_0x16d9c4===!![]){this['setDataValue']('blockedAt',moment());this[_0xb8b2('0x7')]('loginAttempts',0x0);}else{this['setDataValue'](_0xb8b2('0x59'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xb8b2('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 64dacc3..3fb3434 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 _0x84cb=['YYYY-MM-DD\x20HH:mm:ss','all','getChannels','PAUSE','LOGININPAUSE','isMiddleware','logout','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','openchannelPause','smsPause','whatsapppause','QueuePause','manual','chat','fax','sms','whatsapp','openchannel','%s%s','getTeams','Team','addTeams','getChatQueues','setDataValue','Chat','Mail','Sms','getWhatsappQueues','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','removeTeams','getSmsQueues','Whatsapp','removeAgent','Voice','Queue:remove','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','isArray','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$in','$notIn','$notLike','$notILike','$like','$overlap','$contains','$any','firstName','lastName','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','apiKeyIat','API\x20key\x20not\x20available','whoami','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./user.socket','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','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','end','status','json','limit','set','Content-Range','reject','save','update','destroy','Users','agent','Telephones','telephone','filter','map','value','includes','role','UserProfileResource','sendStatus','stack','name','send','index','User','rawAttributes','fieldName','type','model','differenceBy','query','filters','attributes','intersection','fields','length','offset','sort','where','pick','merge','VIRTUAL','sequelize','lower','col','options','count','includeAll','include','findAll','rows','show','params','password','salt','bulkCreate','body','find','describe','addContacts','ids','omit','agent\x20role','admin','user','../../config/license/util','getLicense','telephones','isNil','License\x20limit\x20reached','format','count\x20%s:\x20%s','create','internal','Setting','max','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','VoiceMail','email','permissions','102','103','113','104','107','108','109','100','111','114','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','Agents','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','securePassword','oldPassword','newPassword','authenticate','ValidationError','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','channel','interface','isValidChannel','Unknown\x20channel','capitalize','Queues','penalty','spread','emit','toLowerCase','voice','VoiceQueue','online','push','SIP/%s','voicePause','each','UserVoiceQueueRt','removeQueues','remove','QueueId','userpic','file','filename','getAvatar','join','root','server/files/images/','download','keys','CmContact','order','getContacts','hasOwnProperty','CmList','List','Tag','Tags','color','tag','nolimit','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','getScreenRecordings','ScreenRecording','UserId','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','login','phone','mobile','loginInPause','LOCAL/%s@from-sip/n','intrf','headers','x-forwarded-for','remoteAddress','socket','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','upsert','MemberReport','forEach'];(function(_0x2391ec,_0x4446ca){var _0xf93182=function(_0x2c825c){while(--_0x2c825c){_0x2391ec['push'](_0x2391ec['shift']());}};_0xf93182(++_0x4446ca);}(_0x84cb,0x88));var _0xb84c=function(_0x431d03,_0x171e9b){_0x431d03=_0x431d03-0x0;var _0x1941e7=_0x84cb[_0x431d03];return _0x1941e7;};'use strict';var pdf=require(_0xb84c('0x0'));var emlformat=require(_0xb84c('0x1'));var rimraf=require(_0xb84c('0x2'));var zipdir=require(_0xb84c('0x3'));var jsonpatch=require(_0xb84c('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb84c('0x5'));var Mustache=require(_0xb84c('0x6'));var util=require(_0xb84c('0x7'));var path=require(_0xb84c('0x8'));var sox=require(_0xb84c('0x9'));var csv=require('to-csv');var ejs=require(_0xb84c('0xa'));var fs=require('fs');var _=require(_0xb84c('0xb'));var squel=require(_0xb84c('0xc'));var crypto=require(_0xb84c('0xd'));var jsforce=require(_0xb84c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb84c('0xf'));var querystring=require(_0xb84c('0x10'));var Papa=require(_0xb84c('0x11'));var Redis=require(_0xb84c('0x12'));var authService=require(_0xb84c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb84c('0x14'));var hardwareService=require(_0xb84c('0x15'));var logger=require(_0xb84c('0x16'))('api');var utils=require(_0xb84c('0x17'));var config=require(_0xb84c('0x18'));var db=require(_0xb84c('0x19'))['db'];config[_0xb84c('0x1a')]=_[_0xb84c('0x1b')](config['redis'],{'host':_0xb84c('0x1c'),'port':0x18eb});var socket=require(_0xb84c('0x1d'))(new Redis(config[_0xb84c('0x1a')]));require(_0xb84c('0x1e'))['register'](socket);var jayson=require(_0xb84c('0x1f'));var client=jayson['client'][_0xb84c('0x20')]({'port':0x232a});function checkPasswordPattern(_0x3fa659,_0xc77fcf,_0x5f0a79){if(_0x5f0a79){var _0x3eedf9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3eedf9[_0xb84c('0x21')](_0xc77fcf)){return _0x3fa659;}else{throw new db[(_0xb84c('0x22'))]['ValidationError'](_0xb84c('0x23'));}}else{return _0x3fa659;}}function respondWithRpcPromise(_0x5aa795,_0x3adc3c,_0x4f0a6d,_0xf158b5){return new BPromise(function(_0x38e5fb,_0x4f8bdf){var _0x409d6c=_0xf158b5||client;return _0x409d6c['request'](_0x5aa795,_0x4f0a6d)[_0xb84c('0x24')](function(_0x3e89f3){logger[_0xb84c('0x25')](_0xb84c('0x26'),_0x3adc3c,_0xb84c('0x27'));logger[_0xb84c('0x28')](_0xb84c('0x29'),_0x3adc3c,_0xb84c('0x27'),JSON['stringify'](_0x3e89f3));if(_0x3e89f3[_0xb84c('0x2a')]){if(_0x3e89f3['error'][_0xb84c('0x2b')]===0x1f4){logger[_0xb84c('0x2a')]('User,\x20%s,\x20%s',_0x3adc3c,_0x3e89f3['error'][_0xb84c('0x2c')]);return _0x4f8bdf(_0x3e89f3[_0xb84c('0x2a')][_0xb84c('0x2c')]);}logger[_0xb84c('0x2a')](_0xb84c('0x26'),_0x3adc3c,_0x3e89f3[_0xb84c('0x2a')][_0xb84c('0x2c')]);return _0x38e5fb(_0x3e89f3['error'][_0xb84c('0x2c')]);}else{logger[_0xb84c('0x25')](_0xb84c('0x26'),_0x3adc3c,'request\x20sent');_0x38e5fb(_0x3e89f3[_0xb84c('0x2d')][_0xb84c('0x2c')]);}})[_0xb84c('0x2e')](function(_0xa9c064){logger[_0xb84c('0x2a')](_0xb84c('0x26'),_0x3adc3c,_0xa9c064);_0x4f8bdf(_0xa9c064);});});}function respondWithStatusCode(_0x4087b1,_0x4f92af){_0x4f92af=_0x4f92af||0xcc;return function(_0x4ad4b3){if(_0x4ad4b3){return _0x4087b1['sendStatus'](_0x4f92af);}return _0x4087b1['status'](_0x4f92af)[_0xb84c('0x2f')]();};}function respondWithResult(_0x3149c3,_0x17d218){_0x17d218=_0x17d218||0xc8;return function(_0x4bac30){if(_0x4bac30){return _0x3149c3[_0xb84c('0x30')](_0x17d218)[_0xb84c('0x31')](_0x4bac30);}};}function respondWithFilteredResult(_0x309d1a,_0x56821b){return function(_0x12b82d){if(_0x12b82d){var _0x46f1fe=_0x12b82d['count'],_0x29ec6b=_0x56821b['offset'],_0xc8341e=_0x56821b['offset']+_0x56821b[_0xb84c('0x32')],_0x34f7a8;if(_0xc8341e>=_0x46f1fe){_0xc8341e=_0x46f1fe;_0x34f7a8=0xc8;}else{_0x34f7a8=0xce;}_0x309d1a[_0xb84c('0x30')](_0x34f7a8);return _0x309d1a[_0xb84c('0x33')](_0xb84c('0x34'),_0x29ec6b+'-'+_0xc8341e+'/'+_0x46f1fe)[_0xb84c('0x31')](_0x12b82d);}return null;};}function patchUpdates(_0x33a641){return function(_0x1d1374){try{jsonpatch['apply'](_0x1d1374,_0x33a641,!![]);}catch(_0x191f98){return BPromise[_0xb84c('0x35')](_0x191f98);}return _0x1d1374[_0xb84c('0x36')]();};}function saveUpdates(_0x1783e3,_0xaf0a37){return function(_0x37f22f){if(_0x37f22f){return _0x37f22f[_0xb84c('0x37')](_0x1783e3)[_0xb84c('0x24')](function(_0x2d41b2){return _0x2d41b2;});}return null;};}function removeEntity(_0x4d4426,_0x5ae653){return function(_0x255dfc){if(_0x255dfc){return _0x255dfc[_0xb84c('0x38')]()[_0xb84c('0x24')](function(){var _0x18d813=_0x255dfc['get']({'plain':!![]});var _0x4515aa=[{'name':_0xb84c('0x39'),'value':'user','ignore':!![]},{'name':'Agents','value':_0xb84c('0x3a'),'ignore':![]},{'name':_0xb84c('0x3b'),'value':_0xb84c('0x3c'),'ignore':![]}];var _0x2f8d43=_(_0x4515aa)[_0xb84c('0x3d')]('ignore')[_0xb84c('0x3e')](_0xb84c('0x3f'))[_0xb84c('0x3f')]();if(_[_0xb84c('0x40')](_0x2f8d43,_0x18d813[_0xb84c('0x41')])){return;}var _0x3bf897=_['find'](_0x4515aa,[_0xb84c('0x3f'),_0x18d813[_0xb84c('0x41')]])['name'];return db[_0xb84c('0x42')][_0xb84c('0x38')]({'where':{'type':_0x3bf897,'resourceId':_0x18d813['id']}})[_0xb84c('0x24')](function(){return _0x255dfc;});})[_0xb84c('0x24')](function(){_0x4d4426['status'](0xcc)[_0xb84c('0x2f')]();});}};}function handleEntityNotFound(_0x3db862,_0x207774){return function(_0x483a5c){if(!_0x483a5c){_0x3db862[_0xb84c('0x43')](0x194);}return _0x483a5c;};}function handleError(_0x50f852,_0x2bb960){_0x2bb960=_0x2bb960||0x1f4;return function(_0x573193){logger['error'](_0x573193[_0xb84c('0x44')]);if(_0x573193[_0xb84c('0x45')]){delete _0x573193[_0xb84c('0x45')];}_0x50f852[_0xb84c('0x30')](_0x2bb960)[_0xb84c('0x46')](_0x573193);};}exports[_0xb84c('0x47')]=function(_0x1778f6,_0xb51e1b){var _0x459294={},_0x57d5ad={},_0x48260d={'count':0x0,'rows':[]};var _0x595d28=_[_0xb84c('0x3e')](db[_0xb84c('0x48')][_0xb84c('0x49')],function(_0x12fc29){return{'name':_0x12fc29[_0xb84c('0x4a')],'type':_0x12fc29[_0xb84c('0x4b')]['key']};});_0x57d5ad[_0xb84c('0x4c')]=_[_0xb84c('0x4d')](_[_0xb84c('0x3e')](_0x595d28,'name'),['password','salt']);_0x57d5ad['query']=_['keys'](_0x1778f6[_0xb84c('0x4e')]);_0x57d5ad[_0xb84c('0x4f')]=_['intersection'](_0x57d5ad[_0xb84c('0x4c')],_0x57d5ad[_0xb84c('0x4e')]);_0x459294[_0xb84c('0x50')]=_[_0xb84c('0x51')](_0x57d5ad[_0xb84c('0x4c')],qs[_0xb84c('0x52')](_0x1778f6[_0xb84c('0x4e')]['fields']));_0x459294[_0xb84c('0x50')]=_0x459294[_0xb84c('0x50')][_0xb84c('0x53')]?_0x459294['attributes']:_0x57d5ad[_0xb84c('0x4c')];if(!_0x1778f6[_0xb84c('0x4e')]['hasOwnProperty']('nolimit')){_0x459294['limit']=qs[_0xb84c('0x32')](_0x1778f6[_0xb84c('0x4e')][_0xb84c('0x32')]);_0x459294[_0xb84c('0x54')]=qs['offset'](_0x1778f6[_0xb84c('0x4e')][_0xb84c('0x54')]);}_0x459294['order']=qs[_0xb84c('0x55')](_0x1778f6[_0xb84c('0x4e')][_0xb84c('0x55')]);_0x459294[_0xb84c('0x56')]=qs['filters'](_[_0xb84c('0x57')](_0x1778f6[_0xb84c('0x4e')],_0x57d5ad['filters']),_0x595d28);if(_0x1778f6[_0xb84c('0x4e')]['filter']){_0x459294[_0xb84c('0x56')]=_[_0xb84c('0x58')](_0x459294[_0xb84c('0x56')],{'$or':_[_0xb84c('0x3e')](_0x595d28,function(_0x4bc3db){if(_0x4bc3db['type']!==_0xb84c('0x59')){return db[_0xb84c('0x5a')]['where'](db[_0xb84c('0x5a')]['fn'](_0xb84c('0x5b'),db[_0xb84c('0x5a')][_0xb84c('0x5c')](_0x4bc3db[_0xb84c('0x45')])),{'$like':db['sequelize']['fn'](_0xb84c('0x5b'),'%'+_0x1778f6['query'][_0xb84c('0x3d')]+'%')});}})});}_0x459294=_[_0xb84c('0x58')]({},_0x459294,_0x1778f6[_0xb84c('0x5d')]);var _0x35da31={'where':_0x459294[_0xb84c('0x56')]};return db[_0xb84c('0x48')]['count'](_0x35da31)[_0xb84c('0x24')](function(_0x3f0c9a){_0x48260d[_0xb84c('0x5e')]=_0x3f0c9a;if(_0x1778f6['query'][_0xb84c('0x5f')]){_0x459294[_0xb84c('0x60')]=[{'all':!![]}];}return db['User'][_0xb84c('0x61')](_0x459294);})['then'](function(_0x54ac85){_0x48260d[_0xb84c('0x62')]=_0x54ac85;return _0x48260d;})['then'](respondWithFilteredResult(_0xb51e1b,_0x459294))[_0xb84c('0x2e')](handleError(_0xb51e1b,null));};exports[_0xb84c('0x63')]=function(_0x136fd2,_0x97b788){var _0x1792f2={'raw':![],'where':{'id':_0x136fd2[_0xb84c('0x64')]['id']}},_0x1f6357={};_0x1f6357[_0xb84c('0x4c')]=_[_0xb84c('0x4d')](_['keys'](db['User'][_0xb84c('0x49')]),[_0xb84c('0x65'),_0xb84c('0x66')]);_0x1f6357['query']=_['keys'](_0x136fd2[_0xb84c('0x4e')]);_0x1f6357[_0xb84c('0x4f')]=_[_0xb84c('0x51')](_0x1f6357['model'],_0x1f6357[_0xb84c('0x4e')]);_0x1792f2[_0xb84c('0x50')]=_[_0xb84c('0x51')](_0x1f6357[_0xb84c('0x4c')],qs[_0xb84c('0x52')](_0x136fd2[_0xb84c('0x4e')][_0xb84c('0x52')]));_0x1792f2[_0xb84c('0x50')]=_0x1792f2[_0xb84c('0x50')][_0xb84c('0x53')]?_0x1792f2[_0xb84c('0x50')]:_0x1f6357['model'];if(_0x136fd2[_0xb84c('0x4e')][_0xb84c('0x5f')]){_0x1792f2['include']=[{'all':!![]}];}_0x1792f2=_[_0xb84c('0x58')]({},_0x1792f2,_0x136fd2[_0xb84c('0x5d')]);return db[_0xb84c('0x48')]['find'](_0x1792f2)[_0xb84c('0x24')](handleEntityNotFound(_0x97b788,null))[_0xb84c('0x24')](respondWithResult(_0x97b788,null))['catch'](handleError(_0x97b788,null));};exports[_0xb84c('0x67')]=function(_0x1d583f,_0x2e1de8){return db[_0xb84c('0x48')][_0xb84c('0x67')](_0x1d583f[_0xb84c('0x68')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2e1de8,0xc9))['catch'](handleError(_0x2e1de8,null));};exports[_0xb84c('0x37')]=function(_0x40ad07,_0x384891){if(_0x40ad07[_0xb84c('0x68')]['id']){delete _0x40ad07[_0xb84c('0x68')]['id'];}delete _0x40ad07[_0xb84c('0x68')][_0xb84c('0x41')];return db[_0xb84c('0x48')][_0xb84c('0x69')]({'where':{'id':_0x40ad07[_0xb84c('0x64')]['id']}})[_0xb84c('0x24')](handleEntityNotFound(_0x384891,null))[_0xb84c('0x24')](saveUpdates(_0x40ad07[_0xb84c('0x68')],null))[_0xb84c('0x24')](respondWithResult(_0x384891,null))[_0xb84c('0x2e')](handleError(_0x384891,null));};exports[_0xb84c('0x6a')]=function(_0x1e3cac,_0x9cbc69){return db[_0xb84c('0x48')][_0xb84c('0x6a')]()[_0xb84c('0x24')](respondWithResult(_0x9cbc69,null))[_0xb84c('0x2e')](handleError(_0x9cbc69,null));};exports['addContacts']=function(_0x2c53bd,_0x11b630,_0x5c988e){return db[_0xb84c('0x48')][_0xb84c('0x69')]({'where':{'id':_0x2c53bd['params']['id']}})[_0xb84c('0x24')](handleEntityNotFound(_0x11b630,null))[_0xb84c('0x24')](function(_0x3ef7e9){if(_0x3ef7e9){return _0x3ef7e9[_0xb84c('0x6b')](_0x2c53bd['body'][_0xb84c('0x6c')],_[_0xb84c('0x6d')](_0x2c53bd[_0xb84c('0x68')],[_0xb84c('0x6c'),'id'])||{});}})[_0xb84c('0x24')](respondWithResult(_0x11b630,null))[_0xb84c('0x2e')](handleError(_0x11b630,null));};var getLicense=function(_0xc27cd1){return new BPromise(function(_0x50a4cd,_0x373def){var _0x1c085a=0x0;_0xc27cd1[_0xb84c('0x68')]['role']==='agent'&&_0x50a4cd(_0xb84c('0x6e'));return db[_0xb84c('0x48')][_0xb84c('0x5e')]({'where':{'$or':[{'role':_0xc27cd1[_0xb84c('0x68')]['role']===_0xb84c('0x3c')?'telephone':[_0xb84c('0x6f'),_0xb84c('0x70')]}]}})[_0xb84c('0x24')](function(_0x418531){_0x1c085a=_0x418531;return require(_0xb84c('0x71'))[_0xb84c('0x72')]();})[_0xb84c('0x24')](function(_0x1aaeee){var _0x26cc92=_0xc27cd1[_0xb84c('0x68')]['role']===_0xb84c('0x3c')?_0xb84c('0x73'):'users';if(!_[_0xb84c('0x74')](_0x1aaeee[_0x26cc92])&&_0x1c085a>=_0x1aaeee[_0x26cc92]){return _0x373def({'message':_0xb84c('0x75')});}return _0x50a4cd(util[_0xb84c('0x76')](_0xb84c('0x77'),_0x26cc92,_0x1c085a));})[_0xb84c('0x2e')](function(_0x5927e1){return _0x373def(_0x5927e1);});});};exports[_0xb84c('0x78')]=function(_0xac562e,_0x1e5034){return getLicense(_0xac562e)[_0xb84c('0x24')](function(_0x410ce0){if(!_0xac562e[_0xb84c('0x68')][_0xb84c('0x79')]){var _0x5a47ea;return db[_0xb84c('0x7a')]['findById'](0x1)['then'](function(_0x128c0e){return checkPasswordPattern(_0x128c0e,_0xac562e[_0xb84c('0x68')]['password'],_0x128c0e['securePassword']);})[_0xb84c('0x24')](function(_0x470622){_0x5a47ea=_0x470622['min_internal'];return db[_0xb84c('0x48')][_0xb84c('0x7b')](_0xb84c('0x79'));})[_0xb84c('0x24')](function(_0x2ffda1){if(_['isNil'](_0x2ffda1)){if(_0x5a47ea){_0xac562e[_0xb84c('0x68')][_0xb84c('0x79')]=_0x5a47ea;}else{_0xac562e[_0xb84c('0x68')][_0xb84c('0x79')]=0x1;}}else{if(_[_0xb84c('0x74')](_0x5a47ea)||_0x5a47ea==_0x2ffda1){_0xac562e[_0xb84c('0x68')][_0xb84c('0x79')]=_0x2ffda1+0x1;}else if(_0x5a47ea>_0x2ffda1){_0xac562e[_0xb84c('0x68')][_0xb84c('0x79')]=_0x5a47ea;}else{return db['sequelize'][_0xb84c('0x4e')](_0xb84c('0x7c'),{'type':db[_0xb84c('0x5a')][_0xb84c('0x7d')][_0xb84c('0x7e')]})[_0xb84c('0x24')](function(_0x563d2e){if(_0x563d2e&&_0x563d2e['length']){for(var _0x2994d1=0x0,_0x3c028d=_0x563d2e[_0xb84c('0x53')];_0x2994d1<_0x3c028d&&_[_0xb84c('0x74')](_0xac562e[_0xb84c('0x68')]['internal']);_0x2994d1++){if(_0x5a47ea<=_0x563d2e[_0x2994d1][_0xb84c('0x7f')]){_0xac562e[_0xb84c('0x68')][_0xb84c('0x79')]=_0x563d2e[_0x2994d1][_0xb84c('0x7f')];}else if(_0x5a47ea>_0x563d2e[_0x2994d1][_0xb84c('0x7f')]&&_0x5a47ea<=_0x563d2e[_0x2994d1]['to']){_0xac562e[_0xb84c('0x68')][_0xb84c('0x79')]=_0x5a47ea;}}}if(_[_0xb84c('0x74')](_0xac562e[_0xb84c('0x68')][_0xb84c('0x79')])){_0xac562e['body']['internal']=_0x2ffda1+0x1;}});}}});}})['then'](function(){if(_0xac562e[_0xb84c('0x68')][_0xb84c('0x80')]){_0xac562e['body']['mailbox']=_0xac562e[_0xb84c('0x68')][_0xb84c('0x79')];_0xac562e[_0xb84c('0x68')][_0xb84c('0x81')]={'mailbox':_0xac562e[_0xb84c('0x68')][_0xb84c('0x79')],'password':_0xac562e[_0xb84c('0x68')][_0xb84c('0x65')],'fullname':_0xac562e[_0xb84c('0x68')]['fullname'],'email':_0xac562e['body'][_0xb84c('0x82')]};}if(_0xac562e[_0xb84c('0x68')]&&_0xac562e[_0xb84c('0x68')][_0xb84c('0x41')]===_0xb84c('0x3a')){if(!_0xac562e['body'][_0xb84c('0x83')]){_0xac562e['body'][_0xb84c('0x83')]=['101',_0xb84c('0x84'),_0xb84c('0x85'),_0xb84c('0x86'),'110',_0xb84c('0x87'),'105','106',_0xb84c('0x88'),_0xb84c('0x89'),_0xb84c('0x8a'),_0xb84c('0x8b'),_0xb84c('0x8c'),_0xb84c('0x8d')];}}return db['User'][_0xb84c('0x78')](_0xac562e[_0xb84c('0x68')],{'include':[{'model':db[_0xb84c('0x81')],'as':'VoiceMail'}]});})[_0xb84c('0x24')](function(_0x2aba5a){if(_0xac562e['body'][_0xb84c('0x41')]===_0xb84c('0x70'))return _0x2aba5a;var _0x3c2a4b=_0xac562e['user']['get']({'plain':!![]});if(!_0x3c2a4b)throw new Error(_0xb84c('0x8e'));if(_0x3c2a4b['role']===_0xb84c('0x70')){var _0x4b8193=_0x2aba5a[_0xb84c('0x8f')]({'plain':!![]});var _0x4ee694=[{'name':_0xb84c('0x90'),'value':_0xb84c('0x3a')},{'name':_0xb84c('0x3b'),'value':'telephone'}];var _0x3559c5=_[_0xb84c('0x69')](_0x4ee694,['value',_0x4b8193[_0xb84c('0x41')]])['name'];return db[_0xb84c('0x91')][_0xb84c('0x69')]({'where':{'name':_0x3559c5,'userProfileId':_0x3c2a4b[_0xb84c('0x92')]},'raw':!![]})[_0xb84c('0x24')](function(_0x42d69b){if(_0x42d69b&&_0x42d69b[_0xb84c('0x93')]===0x0){return db['UserProfileResource'][_0xb84c('0x78')]({'name':_0x4b8193[_0xb84c('0x45')],'resourceId':_0x4b8193['id'],'type':_0x42d69b[_0xb84c('0x45')],'sectionId':_0x42d69b['id']},{})[_0xb84c('0x24')](function(){return _0x2aba5a;});}else{return _0x2aba5a;}})[_0xb84c('0x2e')](function(_0x2b66dd){logger[_0xb84c('0x2a')](_0xb84c('0x94'),_0x2b66dd);throw _0x2b66dd;});}return _0x2aba5a;})[_0xb84c('0x24')](respondWithResult(_0x1e5034,0xc9))['catch'](handleError(_0x1e5034,null));};exports['changePassword']=function(_0x3fbace,_0xd4a41c,_0x5311cd){var _0x3c593f=![];if(_0x3fbace[_0xb84c('0x68')]['id']){delete _0x3fbace['body']['id'];}return db[_0xb84c('0x7a')][_0xb84c('0x95')]({'attributes':['id',_0xb84c('0x96')]})[_0xb84c('0x24')](function(_0x4facc7){_0x3c593f=_0x4facc7['securePassword'];return db['User'][_0xb84c('0x69')]({'where':{'id':_0x3fbace[_0xb84c('0x64')]['id']}});})[_0xb84c('0x24')](function(_0x338745){if(_0x338745){if(_0x338745['id']==_0x3fbace[_0xb84c('0x70')]['id']){if(!_0x3fbace[_0xb84c('0x68')][_0xb84c('0x97')]||!_0x3fbace[_0xb84c('0x68')][_0xb84c('0x98')]){throw new db[(_0xb84c('0x22'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword');}if(!_0x338745[_0xb84c('0x99')](_0x3fbace[_0xb84c('0x68')]['oldPassword'])){throw new db['Sequelize'][(_0xb84c('0x9a'))](_0xb84c('0x9b'));}if(_0x3fbace[_0xb84c('0x68')][_0xb84c('0x97')]==_0x3fbace[_0xb84c('0x68')][_0xb84c('0x98')]){throw new db['Sequelize']['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}return _0x338745;}else if(_0x3fbace[_0xb84c('0x70')][_0xb84c('0x41')]==_0xb84c('0x6f')){if(!_0x3fbace[_0xb84c('0x68')][_0xb84c('0x98')]){throw new db[(_0xb84c('0x22'))]['ValidationError'](_0xb84c('0x9c'));}return _0x338745;}else if(_0x3fbace[_0xb84c('0x70')][_0xb84c('0x41')]==_0xb84c('0x70')){if(!_0x3fbace[_0xb84c('0x68')]['newPassword']){throw new db[(_0xb84c('0x22'))][(_0xb84c('0x9a'))](_0xb84c('0x9c'));}if(_0x338745['role']!=_0xb84c('0x3a')){throw new db[(_0xb84c('0x22'))][(_0xb84c('0x9a'))](_0xb84c('0x9d'));}return _0x338745;}else{throw new db['Sequelize']['ValidationError']('Unauthorized');}}return null;})[_0xb84c('0x24')](handleEntityNotFound(_0xd4a41c,null))[_0xb84c('0x24')](function(_0x4682cb){return checkPasswordPattern(_0x4682cb,_0x3fbace[_0xb84c('0x68')][_0xb84c('0x98')],_0x3c593f);})[_0xb84c('0x24')](saveUpdates({'password':_0x3fbace[_0xb84c('0x68')]['newPassword'],'passwordResetAt':_0x3fbace[_0xb84c('0x70')]['id']==_0x3fbace['params']['id']?moment():null},null))[_0xb84c('0x24')](respondWithResult(_0xd4a41c,null))[_0xb84c('0x2e')](handleError(_0xd4a41c,null));};exports['addQueues']=function(_0x1b4365,_0x4544c9,_0x1b5185){var _0x14d24e=_0x1b4365[_0xb84c('0x68')][_0xb84c('0x9e')];return db['User'][_0xb84c('0x69')]({'where':{'id':_0x1b4365[_0xb84c('0x64')]['id']},'attributes':['id',_0xb84c('0x45'),_0xb84c('0x41'),'online','loginInPause','voicePause',_0xb84c('0x9f')]})['then'](handleEntityNotFound(_0x4544c9,null))['then'](function(_0x53a16d){if(_0x53a16d){if(!utils[_0xb84c('0xa0')](_0x14d24e)){throw new db['Sequelize'][(_0xb84c('0x9a'))](_0xb84c('0xa1'));}return _0x53a16d['add'+_[_0xb84c('0xa2')](_0x14d24e['toLowerCase']())+_0xb84c('0xa3')](_0x1b4365[_0xb84c('0x68')][_0xb84c('0x6c')],{'penalty':_0x1b4365[_0xb84c('0x68')][_0xb84c('0xa4')]||0x0})[_0xb84c('0xa5')](function(_0xb563c3){for(var _0x103e1e=0x0;_0x103e1e<_0x1b4365[_0xb84c('0x68')][_0xb84c('0x6c')]['length'];_0x103e1e+=0x1){var _0x19820f={'UserId':_0x1b4365['params']['id']};_0x19820f[_[_0xb84c('0xa2')](_0x14d24e['toLowerCase']())+'QueueId']=_0x1b4365[_0xb84c('0x68')][_0xb84c('0x6c')][_0x103e1e];socket[_0xb84c('0xa6')](_0xb84c('0x70')+_['capitalize'](_0x14d24e[_0xb84c('0xa7')]())+'Queue:save',_0x19820f);}return _0xb563c3;})[_0xb84c('0x24')](function(){if(_0x14d24e===_0xb84c('0xa8')){return db[_0xb84c('0xa9')][_0xb84c('0x61')]({'where':{'id':_0x1b4365['body'][_0xb84c('0x6c')]||[]},'raw':!![],'attributes':['id',_0xb84c('0x45')]});}})[_0xb84c('0x24')](function(_0x143ff1){var _0x596a97=_0x53a16d[_0xb84c('0x8f')]({'plain':!![]});var _0x3c9b11=[];if(_0x14d24e===_0xb84c('0xa8')&&_0x596a97[_0xb84c('0x41')]===_0xb84c('0x3a')&&_0x596a97[_0xb84c('0xaa')]){for(var _0x289f25=0x0;_0x289f25<_0x143ff1[_0xb84c('0x53')];_0x289f25+=0x1){_0x3c9b11[_0xb84c('0xab')]({'membername':_0x596a97[_0xb84c('0x45')],'UserId':_0x596a97['id'],'queue_name':_0x143ff1[_0x289f25][_0xb84c('0x45')],'VoiceQueueId':_0x143ff1[_0x289f25]['id'],'interface':_[_0xb84c('0x74')](_0x596a97[_0xb84c('0x9f')])?util[_0xb84c('0x76')](_0xb84c('0xac'),_0x596a97[_0xb84c('0x45')]):_0x596a97['interface'],'paused':_0x596a97[_0xb84c('0xad')]||![],'penalty':_0x1b4365[_0xb84c('0x68')][_0xb84c('0xa4')]||0x0});}return BPromise[_0xb84c('0xae')](_0x3c9b11,function(_0x2e06e3){return db[_0xb84c('0xaf')]['upsert'](_0x2e06e3);});}return _0x53a16d;});}})[_0xb84c('0x24')](respondWithStatusCode(_0x4544c9,null))['catch'](handleError(_0x4544c9,null));};exports[_0xb84c('0xb0')]=function(_0x2b9ec1,_0xdda659,_0x510e73){var _0x2ac583;return db['User'][_0xb84c('0x69')]({'where':{'id':_0x2b9ec1[_0xb84c('0x64')]['id']},'attributes':['id',_0xb84c('0x45'),_0xb84c('0x41')]})['then'](handleEntityNotFound(_0xdda659,null))[_0xb84c('0x24')](function(_0x5998d0){if(_0x5998d0){_0x2ac583=_0x5998d0;if(!_0x2b9ec1['query'][_0xb84c('0x9e')]||!utils[_0xb84c('0xa0')](_0x2b9ec1[_0xb84c('0x4e')][_0xb84c('0x9e')])){throw new db[(_0xb84c('0x22'))][(_0xb84c('0x9a'))](_0xb84c('0xa1'));}return _0x5998d0[_0xb84c('0xb1')+_[_0xb84c('0xa2')](_0x2b9ec1['query'][_0xb84c('0x9e')][_0xb84c('0xa7')]())+_0xb84c('0xa3')](_0x2b9ec1['query'][_0xb84c('0x6c')]);}})[_0xb84c('0x24')](function(_0x1595c8){for(var _0xb835c9=0x0;_0xb835c9<_0x2b9ec1[_0xb84c('0x4e')][_0xb84c('0x6c')][_0xb84c('0x53')];_0xb835c9+=0x1){var _0x4c8289={'UserId':_0x2b9ec1[_0xb84c('0x64')]['id']};_0x4c8289[_[_0xb84c('0xa2')](_0x2b9ec1[_0xb84c('0x4e')]['channel'][_0xb84c('0xa7')]())+_0xb84c('0xb2')]=_0x2b9ec1[_0xb84c('0x4e')][_0xb84c('0x6c')][_0xb835c9];socket[_0xb84c('0xa6')](_0xb84c('0x70')+_[_0xb84c('0xa2')](_0x2b9ec1['query'][_0xb84c('0x9e')][_0xb84c('0xa7')]())+'Queue:remove',_0x4c8289);}return _0x1595c8;})[_0xb84c('0x24')](function(){if(_0x2b9ec1[_0xb84c('0x4e')][_0xb84c('0x9e')]===_0xb84c('0xa8')){return db['UserVoiceQueueRt'][_0xb84c('0x38')]({'where':{'UserId':_0x2b9ec1['params']['id'],'VoiceQueueId':_0x2b9ec1[_0xb84c('0x4e')][_0xb84c('0x6c')]},'individualHooks':!![]})[_0xb84c('0x24')](function(){return _0x2ac583;});}return _0x2ac583;})[_0xb84c('0x24')](respondWithStatusCode(_0xdda659,null))['catch'](handleError(_0xdda659,null));};exports['addAvatar']=function(_0x16f2e0,_0x3f6457,_0x39be2e){_0x16f2e0[_0xb84c('0x68')][_0xb84c('0xb3')]=_0x16f2e0[_0xb84c('0xb4')][_0xb84c('0xb5')];return db[_0xb84c('0x48')][_0xb84c('0x69')]({'where':{'id':_0x16f2e0[_0xb84c('0x64')]['id']}})[_0xb84c('0x24')](handleEntityNotFound(_0x3f6457,null))[_0xb84c('0x24')](saveUpdates(_0x16f2e0['body'],null))[_0xb84c('0x24')](respondWithResult(_0x3f6457,null))[_0xb84c('0x2e')](handleError(_0x3f6457,null));};exports[_0xb84c('0xb6')]=function(_0x578ad7,_0x582755,_0x31b8a8){var _0x29f69b=path[_0xb84c('0xb7')](config[_0xb84c('0xb8')],'server/files/images/logos/default_profile.png');return db[_0xb84c('0x48')][_0xb84c('0x69')]({'where':{'id':_0x578ad7['params']['id']},'attributes':['id',_0xb84c('0xb3')],'raw':!![]})[_0xb84c('0x24')](handleEntityNotFound(_0x582755,null))['then'](function(_0x5acd2d){if(_0x5acd2d){if(_[_0xb84c('0x74')](_0x5acd2d[_0xb84c('0xb3')])){return _0x582755['download'](_0x29f69b);}else{if(!fs['existsSync'](path['join'](config[_0xb84c('0xb8')],_0xb84c('0xb9'),_0x5acd2d[_0xb84c('0xb3')]))){return _0x582755['download'](_0x29f69b);}return _0x582755[_0xb84c('0xba')](path[_0xb84c('0xb7')](config[_0xb84c('0xb8')],_0xb84c('0xb9'),_0x5acd2d[_0xb84c('0xb3')]));}}})['catch'](handleError(_0x582755,null));};exports['getContacts']=function(_0x34fad1,_0x3fd484,_0x61d2b3){var _0x2d19c6={};var _0x4eefaa={};var _0xc3bcf8;var _0x9f6f03;return db[_0xb84c('0x48')][_0xb84c('0x95')]({'where':{'id':_0x34fad1[_0xb84c('0x64')]['id']}})['then'](handleEntityNotFound(_0x3fd484,null))['then'](function(_0x3e4e42){if(_0x3e4e42){_0xc3bcf8=_0x3e4e42;_0x4eefaa[_0xb84c('0x4c')]=_[_0xb84c('0xbb')](db[_0xb84c('0xbc')][_0xb84c('0x49')]);_0x4eefaa[_0xb84c('0x4e')]=_[_0xb84c('0xbb')](_0x34fad1['query']);_0x4eefaa[_0xb84c('0x4f')]=_[_0xb84c('0x51')](_0x4eefaa[_0xb84c('0x4c')],_0x4eefaa[_0xb84c('0x4e')]);_0x2d19c6[_0xb84c('0x50')]=_['intersection'](_0x4eefaa[_0xb84c('0x4c')],qs[_0xb84c('0x52')](_0x34fad1[_0xb84c('0x4e')][_0xb84c('0x52')]));_0x2d19c6[_0xb84c('0x50')]=_0x2d19c6[_0xb84c('0x50')][_0xb84c('0x53')]?_0x2d19c6[_0xb84c('0x50')]:_0x4eefaa[_0xb84c('0x4c')];_0x2d19c6[_0xb84c('0xbd')]=qs[_0xb84c('0x55')](_0x34fad1['query']['sort']);_0x2d19c6['where']=qs[_0xb84c('0x4f')](_[_0xb84c('0x57')](_0x34fad1[_0xb84c('0x4e')],_0x4eefaa[_0xb84c('0x4f')]));if(_0x34fad1[_0xb84c('0x4e')][_0xb84c('0x3d')]){_0x2d19c6[_0xb84c('0x56')]=_[_0xb84c('0x58')](_0x2d19c6[_0xb84c('0x56')],{'$or':_['map'](_0x2d19c6[_0xb84c('0x50')],function(_0x24ac6b){var _0x671065={};_0x671065[_0x24ac6b]={'$like':'%'+_0x34fad1[_0xb84c('0x4e')]['filter']+'%'};return _0x671065;})});}_0x2d19c6=_['merge']({},_0x2d19c6,_0x34fad1[_0xb84c('0x5d')]);return _0xc3bcf8[_0xb84c('0xbe')](_0x2d19c6);}})[_0xb84c('0x24')](function(_0xfafffe){if(_0xfafffe){_0x9f6f03=_0xfafffe[_0xb84c('0x53')];if(_0x34fad1[_0xb84c('0x4e')][_0xb84c('0xbf')](_0xb84c('0x5f'))){_0x2d19c6['include']=[{'model':db[_0xb84c('0xc0')],'as':_0xb84c('0xc1'),'required':![]},{'model':db[_0xb84c('0xc2')],'as':_0xb84c('0xc3'),'attributes':['id',_0xb84c('0x45'),_0xb84c('0xc4')],'where':_0x34fad1[_0xb84c('0x4e')]['tag']?{'id':_0x34fad1['query'][_0xb84c('0xc5')]}:undefined,'required':_0x34fad1[_0xb84c('0x4e')][_0xb84c('0xc5')]?!![]:![]}];}if(!_0x34fad1[_0xb84c('0x4e')][_0xb84c('0xbf')](_0xb84c('0xc6'))){_0x2d19c6['limit']=qs[_0xb84c('0x32')](_0x34fad1['query'][_0xb84c('0x32')]);_0x2d19c6[_0xb84c('0x54')]=qs[_0xb84c('0x54')](_0x34fad1[_0xb84c('0x4e')][_0xb84c('0x54')]);}return _0xc3bcf8[_0xb84c('0xbe')](_0x2d19c6);}})[_0xb84c('0x24')](function(_0x3e4512){if(_0x3e4512){return _0x3e4512?{'count':_0x9f6f03,'rows':_0x3e4512}:null;}})[_0xb84c('0x24')](respondWithResult(_0x3fd484,null))[_0xb84c('0x2e')](handleError(_0x3fd484,null));};exports[_0xb84c('0xc7')]=function(_0x40ce93,_0x29702e,_0x2d7649){var _0x55a457;var _0x255024;var _0x1172b4={};var _0x1dfd1d;return db[_0xb84c('0x48')]['findOne']({'where':{'id':_0x40ce93['params']['id']},'attributes':['id',_0xb84c('0x45'),_0xb84c('0x41')]})[_0xb84c('0x24')](handleEntityNotFound(_0x29702e,null))['then'](function(_0x378b11){if(!utils[_0xb84c('0xa0')](_0x40ce93[_0xb84c('0x4e')]['channel'])){throw new db[(_0xb84c('0x22'))][(_0xb84c('0x9a'))](_0xb84c('0xa1'));}_0x55a457=_0x378b11;var _0x2153c3={};_0x2153c3['model']=_[_0xb84c('0xbb')](db[_[_0xb84c('0xa2')](_0x40ce93[_0xb84c('0x4e')][_0xb84c('0x9e')])+'Queue'][_0xb84c('0x49')]);_0x2153c3[_0xb84c('0x4e')]=_[_0xb84c('0xbb')](_0x40ce93[_0xb84c('0x4e')]);_0x2153c3['filters']=_[_0xb84c('0x51')](_0x2153c3[_0xb84c('0x4c')],_0x2153c3['query']);_0x1172b4[_0xb84c('0x50')]=_['intersection'](_0x2153c3['model'],qs[_0xb84c('0x52')](_0x40ce93[_0xb84c('0x4e')][_0xb84c('0x52')]));_0x1172b4[_0xb84c('0x50')]=_0x1172b4[_0xb84c('0x50')][_0xb84c('0x53')]?_0x1172b4[_0xb84c('0x50')]:_0x2153c3[_0xb84c('0x4c')];_0x1172b4[_0xb84c('0xbd')]=qs[_0xb84c('0x55')](_0x40ce93[_0xb84c('0x4e')][_0xb84c('0x55')]);_0x1172b4[_0xb84c('0x56')]=qs[_0xb84c('0x4f')](_[_0xb84c('0x57')](_0x40ce93['query'],_0x2153c3[_0xb84c('0x4f')]));if(_0x40ce93[_0xb84c('0x4e')]['filter']){_0x1172b4[_0xb84c('0x56')]=_[_0xb84c('0x58')](_0x1172b4[_0xb84c('0x56')],{'$or':_[_0xb84c('0x3e')](_0x1172b4['attributes'],function(_0x111c9e){var _0x71b037={};_0x71b037[_0x111c9e]={'$like':'%'+_0x40ce93[_0xb84c('0x4e')]['filter']+'%'};return _0x71b037;})});}_0x1172b4=_[_0xb84c('0x58')]({},_0x1172b4,_0x40ce93['options']);switch(_0x55a457['role']){case _0xb84c('0x6f'):return db[_['capitalize'](_0x40ce93['query']['channel'])+_0xb84c('0xc8')][_0xb84c('0x61')](_0x1172b4);case _0xb84c('0x70'):case _0xb84c('0x3a'):return _0x55a457[_0xb84c('0x8f')+_[_0xb84c('0xa2')](_0x40ce93[_0xb84c('0x4e')][_0xb84c('0x9e')])+'Queues'](_0x1172b4);default:throw new db['Sequelize'][(_0xb84c('0x9a'))](_0xb84c('0xc9'));}})[_0xb84c('0x24')](function(_0x53f7ff){_0x1dfd1d=_0x53f7ff[_0xb84c('0x53')];if(!_0x40ce93['query'][_0xb84c('0xbf')](_0xb84c('0xc6'))){_0x1172b4[_0xb84c('0x32')]=qs[_0xb84c('0x32')](_0x40ce93[_0xb84c('0x4e')][_0xb84c('0x32')]);_0x1172b4[_0xb84c('0x54')]=qs['offset'](_0x40ce93['query'][_0xb84c('0x54')]);}switch(_0x55a457[_0xb84c('0x41')]){case _0xb84c('0x6f'):return db[_['capitalize'](_0x40ce93[_0xb84c('0x4e')][_0xb84c('0x9e')])+_0xb84c('0xc8')]['findAll'](_0x1172b4);case'user':case _0xb84c('0x3a'):return _0x55a457[_0xb84c('0x8f')+_[_0xb84c('0xa2')](_0x40ce93[_0xb84c('0x4e')][_0xb84c('0x9e')])+_0xb84c('0xa3')](_0x1172b4);}})['then'](function(_0x4f2d79){return{'count':_0x1dfd1d,'rows':_0x4f2d79};})[_0xb84c('0x24')](respondWithResult(_0x29702e,null))[_0xb84c('0x2e')](handleError(_0x29702e,null));};exports[_0xb84c('0xca')]=function(_0x10e219,_0x2fb857,_0x290180){var _0xcd4d26={};var _0x5db081={};var _0xa4e845;var _0x33baba;return db[_0xb84c('0x48')][_0xb84c('0x95')]({'where':{'id':_0x10e219['params']['id']}})[_0xb84c('0x24')](handleEntityNotFound(_0x2fb857,null))[_0xb84c('0x24')](function(_0x53fd5c){if(_0x53fd5c){_0xa4e845=_0x53fd5c;_0x5db081[_0xb84c('0x4c')]=_[_0xb84c('0xbb')](db[_0xb84c('0xaf')]['rawAttributes']);_0x5db081[_0xb84c('0x4e')]=_[_0xb84c('0xbb')](_0x10e219['query']);_0x5db081['filters']=_[_0xb84c('0x51')](_0x5db081['model'],_0x5db081[_0xb84c('0x4e')]);_0xcd4d26[_0xb84c('0x50')]=_[_0xb84c('0x51')](_0x5db081[_0xb84c('0x4c')],qs[_0xb84c('0x52')](_0x10e219['query'][_0xb84c('0x52')]));_0xcd4d26['attributes']=_0xcd4d26['attributes'][_0xb84c('0x53')]?_0xcd4d26[_0xb84c('0x50')]:_0x5db081[_0xb84c('0x4c')];_0xcd4d26[_0xb84c('0xbd')]=qs[_0xb84c('0x55')](_0x10e219[_0xb84c('0x4e')]['sort']);_0xcd4d26[_0xb84c('0x56')]=qs[_0xb84c('0x4f')](_[_0xb84c('0x57')](_0x10e219[_0xb84c('0x4e')],_0x5db081[_0xb84c('0x4f')]));if(_0x10e219['query']['filter']){_0xcd4d26['where']=_[_0xb84c('0x58')](_0xcd4d26[_0xb84c('0x56')],{'$or':_[_0xb84c('0x3e')](_0xcd4d26['attributes'],function(_0x9e2109){var _0x1686c5={};_0x1686c5[_0x9e2109]={'$like':'%'+_0x10e219[_0xb84c('0x4e')][_0xb84c('0x3d')]+'%'};return _0x1686c5;})});}_0xcd4d26=_[_0xb84c('0x58')]({},_0xcd4d26,_0x10e219[_0xb84c('0x5d')]);return _0xa4e845[_0xb84c('0xca')](_0xcd4d26);}})[_0xb84c('0x24')](function(_0x3e10a6){if(_0x3e10a6){_0x33baba=_0x3e10a6[_0xb84c('0x53')];if(!_0x10e219[_0xb84c('0x4e')][_0xb84c('0xbf')](_0xb84c('0xc6'))){_0xcd4d26[_0xb84c('0x32')]=qs[_0xb84c('0x32')](_0x10e219[_0xb84c('0x4e')]['limit']);_0xcd4d26[_0xb84c('0x54')]=qs['offset'](_0x10e219[_0xb84c('0x4e')]['offset']);}return _0xa4e845[_0xb84c('0xca')](_0xcd4d26);}})['then'](function(_0x3898c6){if(_0x3898c6){return _0x3898c6?{'count':_0x33baba,'rows':_0x3898c6}:null;}})[_0xb84c('0x24')](respondWithResult(_0x2fb857,null))['catch'](handleError(_0x2fb857,null));};exports[_0xb84c('0xcb')]=function(_0x343577,_0x16fb99,_0x20c969){var _0x4e7292={};var _0xdca215={};var _0x46a49f;var _0x3c8bc0;return db[_0xb84c('0x48')][_0xb84c('0x95')]({'where':{'id':_0x343577[_0xb84c('0x64')]['id']}})['then'](handleEntityNotFound(_0x16fb99,null))[_0xb84c('0x24')](function(_0x43bf6c){if(_0x43bf6c){_0x46a49f=_0x43bf6c;_0xdca215[_0xb84c('0x4c')]=_['keys'](db[_0xb84c('0xcc')][_0xb84c('0x49')]);_0xdca215[_0xb84c('0x4e')]=_[_0xb84c('0xbb')](_0x343577[_0xb84c('0x4e')]);_0xdca215[_0xb84c('0x4f')]=_[_0xb84c('0x51')](_0xdca215[_0xb84c('0x4c')],_0xdca215['query']);_0x4e7292[_0xb84c('0x50')]=_[_0xb84c('0x51')](_0xdca215[_0xb84c('0x4c')],qs[_0xb84c('0x52')](_0x343577[_0xb84c('0x4e')][_0xb84c('0x52')]));_0x4e7292[_0xb84c('0x50')]=_0x4e7292[_0xb84c('0x50')]['length']?_0x4e7292[_0xb84c('0x50')]:_0xdca215[_0xb84c('0x4c')];_0x4e7292[_0xb84c('0xbd')]=qs[_0xb84c('0x55')](_0x343577[_0xb84c('0x4e')][_0xb84c('0x55')]);_0x4e7292['where']=qs[_0xb84c('0x4f')](_[_0xb84c('0x57')](_0x343577[_0xb84c('0x4e')],_0xdca215[_0xb84c('0x4f')]));if(_0x343577[_0xb84c('0x4e')][_0xb84c('0x3d')]){_0x4e7292[_0xb84c('0x56')]=_[_0xb84c('0x58')](_0x4e7292[_0xb84c('0x56')],{'$or':_[_0xb84c('0x3e')](_0x4e7292[_0xb84c('0x50')],function(_0x22fa35){var _0x559240={};_0x559240[_0x22fa35]={'$like':'%'+_0x343577['query'][_0xb84c('0x3d')]+'%'};return _0x559240;})});}_0x4e7292=_[_0xb84c('0x58')]({},_0x4e7292,_0x343577[_0xb84c('0x5d')]);return _0x46a49f[_0xb84c('0xcb')](_0x4e7292);}})[_0xb84c('0x24')](function(_0x52be64){if(_0x52be64){_0x3c8bc0=_0x52be64[_0xb84c('0x53')];if(!_0x343577[_0xb84c('0x4e')][_0xb84c('0xbf')](_0xb84c('0xc6'))){_0x4e7292['limit']=qs[_0xb84c('0x32')](_0x343577[_0xb84c('0x4e')]['limit']);_0x4e7292['offset']=qs[_0xb84c('0x54')](_0x343577[_0xb84c('0x4e')][_0xb84c('0x54')]);}return _0x46a49f['getGroups'](_0x4e7292);}})[_0xb84c('0x24')](function(_0x48fa4e){if(_0x48fa4e){return _0x48fa4e?{'count':_0x3c8bc0,'rows':_0x48fa4e}:null;}})[_0xb84c('0x24')](respondWithResult(_0x16fb99,null))[_0xb84c('0x2e')](handleError(_0x16fb99,null));};exports[_0xb84c('0xcd')]=function(_0x3f3103,_0x78302a,_0x5e6753){var _0x29bdda={'raw':!![],'where':{}};var _0x253496={};var _0x1d3a3c={'count':0x0,'rows':[]};return db[_0xb84c('0x48')][_0xb84c('0x95')]({'where':{'id':_0x3f3103[_0xb84c('0x64')]['id']}})[_0xb84c('0x24')](handleEntityNotFound(_0x78302a,null))[_0xb84c('0x24')](function(_0xdabe1e){if(_0xdabe1e){_0x253496[_0xb84c('0x4c')]=_[_0xb84c('0xbb')](db[_0xb84c('0xce')][_0xb84c('0x49')]);_0x253496['query']=_[_0xb84c('0xbb')](_0x3f3103[_0xb84c('0x4e')]);_0x253496[_0xb84c('0x4f')]=_[_0xb84c('0x51')](_0x253496[_0xb84c('0x4c')],_0x253496[_0xb84c('0x4e')]);_0x29bdda['attributes']=_['intersection'](_0x253496[_0xb84c('0x4c')],qs[_0xb84c('0x52')](_0x3f3103[_0xb84c('0x4e')][_0xb84c('0x52')]));_0x29bdda[_0xb84c('0x50')]=_0x29bdda['attributes']['length']?_0x29bdda[_0xb84c('0x50')]:_0x253496[_0xb84c('0x4c')];if(!_0x3f3103['query'][_0xb84c('0xbf')](_0xb84c('0xc6'))){_0x29bdda[_0xb84c('0x32')]=qs[_0xb84c('0x32')](_0x3f3103[_0xb84c('0x4e')][_0xb84c('0x32')]);_0x29bdda['offset']=qs[_0xb84c('0x54')](_0x3f3103[_0xb84c('0x4e')][_0xb84c('0x54')]);}_0x29bdda[_0xb84c('0xbd')]=qs[_0xb84c('0x55')](_0x3f3103[_0xb84c('0x4e')][_0xb84c('0x55')]);_0x29bdda[_0xb84c('0x56')]=qs[_0xb84c('0x4f')](_[_0xb84c('0x57')](_0x3f3103[_0xb84c('0x4e')],_0x253496[_0xb84c('0x4f')]));_0x29bdda[_0xb84c('0x56')]['UserId']=_0xdabe1e['id'];if(_0x3f3103['query'][_0xb84c('0x3d')]){_0x29bdda[_0xb84c('0x56')]=_['merge'](_0x29bdda[_0xb84c('0x56')],{'$or':_['map'](_0x29bdda['attributes'],function(_0x2b8860){var _0x17c94b={};_0x17c94b[_0x2b8860]={'$like':'%'+_0x3f3103[_0xb84c('0x4e')][_0xb84c('0x3d')]+'%'};return _0x17c94b;})});}_0x29bdda=_[_0xb84c('0x58')]({},_0x29bdda,_0x3f3103[_0xb84c('0x5d')]);return db[_0xb84c('0xce')]['count']({'where':_0x29bdda[_0xb84c('0x56')]})[_0xb84c('0x24')](function(_0x5759eb){_0x1d3a3c[_0xb84c('0x5e')]=_0x5759eb;if(_0x3f3103[_0xb84c('0x4e')][_0xb84c('0x5f')]){_0x29bdda[_0xb84c('0x60')]=[{'all':!![]}];}return db['VoiceRecording'][_0xb84c('0x61')](_0x29bdda);})[_0xb84c('0x24')](function(_0x9917ef){_0x1d3a3c[_0xb84c('0x62')]=_0x9917ef;return _0x1d3a3c;});}})[_0xb84c('0x24')](respondWithFilteredResult(_0x78302a,_0x29bdda))['catch'](handleError(_0x78302a,null));};exports[_0xb84c('0xcf')]=function(_0x190f5c,_0x18979e,_0x1bb980){var _0x130232={'raw':!![],'where':{}};var _0x2b14ad={};var _0x3f8664={'count':0x0,'rows':[]};return db[_0xb84c('0x48')][_0xb84c('0x95')]({'where':{'id':_0x190f5c['params']['id']}})[_0xb84c('0x24')](handleEntityNotFound(_0x18979e,null))[_0xb84c('0x24')](function(_0x138e00){if(_0x138e00){_0x2b14ad[_0xb84c('0x4c')]=_[_0xb84c('0xbb')](db[_0xb84c('0xd0')][_0xb84c('0x49')]);_0x2b14ad['query']=_['keys'](_0x190f5c[_0xb84c('0x4e')]);_0x2b14ad[_0xb84c('0x4f')]=_[_0xb84c('0x51')](_0x2b14ad[_0xb84c('0x4c')],_0x2b14ad[_0xb84c('0x4e')]);_0x130232[_0xb84c('0x50')]=_['intersection'](_0x2b14ad[_0xb84c('0x4c')],qs[_0xb84c('0x52')](_0x190f5c['query'][_0xb84c('0x52')]));_0x130232[_0xb84c('0x50')]=_0x130232[_0xb84c('0x50')][_0xb84c('0x53')]?_0x130232[_0xb84c('0x50')]:_0x2b14ad[_0xb84c('0x4c')];if(!_0x190f5c[_0xb84c('0x4e')][_0xb84c('0xbf')](_0xb84c('0xc6'))){_0x130232[_0xb84c('0x32')]=qs[_0xb84c('0x32')](_0x190f5c[_0xb84c('0x4e')]['limit']);_0x130232['offset']=qs['offset'](_0x190f5c[_0xb84c('0x4e')]['offset']);}_0x130232[_0xb84c('0xbd')]=qs['sort'](_0x190f5c['query']['sort']);_0x130232['where']=qs['filters'](_['pick'](_0x190f5c[_0xb84c('0x4e')],_0x2b14ad[_0xb84c('0x4f')]));_0x130232[_0xb84c('0x56')][_0xb84c('0xd1')]=_0x138e00['id'];if(_0x190f5c[_0xb84c('0x4e')][_0xb84c('0x3d')]){_0x130232[_0xb84c('0x56')]=_['merge'](_0x130232[_0xb84c('0x56')],{'$or':_[_0xb84c('0x3e')](_0x130232['attributes'],function(_0x58a927){var _0x2f67a4={};_0x2f67a4[_0x58a927]={'$like':'%'+_0x190f5c[_0xb84c('0x4e')]['filter']+'%'};return _0x2f67a4;})});}_0x130232=_[_0xb84c('0x58')]({},_0x130232,_0x190f5c[_0xb84c('0x5d')]);return db[_0xb84c('0xd0')][_0xb84c('0x5e')]({'where':_0x130232[_0xb84c('0x56')]})['then'](function(_0x403388){_0x3f8664[_0xb84c('0x5e')]=_0x403388;if(_0x190f5c[_0xb84c('0x4e')]['includeAll']){_0x130232[_0xb84c('0x60')]=[{'all':!![]}];}return db[_0xb84c('0xd0')][_0xb84c('0x61')](_0x130232);})[_0xb84c('0x24')](function(_0x3a9fcc){_0x3f8664['rows']=_0x3a9fcc;return _0x3f8664;});}})[_0xb84c('0x24')](respondWithFilteredResult(_0x18979e,_0x130232))[_0xb84c('0x2e')](handleError(_0x18979e,null));};exports[_0xb84c('0xd2')]=function(_0x4fca25,_0x1bf535,_0x3b5d8e){var _0x3f0fa4={};var _0x424f07={};var _0x31875f;var _0x566c54;return db['User'][_0xb84c('0x95')]({'where':{'id':_0x4fca25[_0xb84c('0x64')]['id']}})[_0xb84c('0x24')](handleEntityNotFound(_0x1bf535,null))[_0xb84c('0x24')](function(_0x409bd8){if(_0x409bd8){_0x31875f=_0x409bd8;_0x424f07[_0xb84c('0x4c')]=_['keys'](db[_0xb84c('0xd3')][_0xb84c('0x49')]);_0x424f07[_0xb84c('0x4e')]=_[_0xb84c('0xbb')](_0x4fca25[_0xb84c('0x4e')]);_0x424f07[_0xb84c('0x4f')]=_[_0xb84c('0x51')](_0x424f07[_0xb84c('0x4c')],_0x424f07[_0xb84c('0x4e')]);_0x3f0fa4['attributes']=_['intersection'](_0x424f07[_0xb84c('0x4c')],qs[_0xb84c('0x52')](_0x4fca25[_0xb84c('0x4e')][_0xb84c('0x52')]));_0x3f0fa4[_0xb84c('0x50')]=_0x3f0fa4['attributes'][_0xb84c('0x53')]?_0x3f0fa4[_0xb84c('0x50')]:_0x424f07[_0xb84c('0x4c')];_0x3f0fa4['order']=qs[_0xb84c('0x55')](_0x4fca25['query'][_0xb84c('0x55')]);_0x3f0fa4['where']=qs[_0xb84c('0x4f')](_['pick'](_0x4fca25[_0xb84c('0x4e')],_0x424f07[_0xb84c('0x4f')]));if(_0x4fca25[_0xb84c('0x4e')][_0xb84c('0x3d')]){_0x3f0fa4[_0xb84c('0x56')]=_[_0xb84c('0x58')](_0x3f0fa4['where'],{'$or':_['map'](_0x3f0fa4[_0xb84c('0x50')],function(_0x5b5982){var _0x347c71={};_0x347c71[_0x5b5982]={'$like':'%'+_0x4fca25[_0xb84c('0x4e')]['filter']+'%'};return _0x347c71;})});}_0x3f0fa4=_[_0xb84c('0x58')]({},_0x3f0fa4,_0x4fca25[_0xb84c('0x5d')]);return _0x31875f['getChatInteractions'](_0x3f0fa4);}})[_0xb84c('0x24')](function(_0x55ede3){if(_0x55ede3){_0x566c54=_0x55ede3[_0xb84c('0x53')];if(!_0x4fca25[_0xb84c('0x4e')]['hasOwnProperty'](_0xb84c('0xc6'))){_0x3f0fa4[_0xb84c('0x32')]=qs[_0xb84c('0x32')](_0x4fca25['query'][_0xb84c('0x32')]);_0x3f0fa4['offset']=qs[_0xb84c('0x54')](_0x4fca25[_0xb84c('0x4e')][_0xb84c('0x54')]);}return _0x31875f[_0xb84c('0xd2')](_0x3f0fa4);}})[_0xb84c('0x24')](function(_0x2e255f){if(_0x2e255f){return _0x2e255f?{'count':_0x566c54,'rows':_0x2e255f}:null;}})['then'](respondWithResult(_0x1bf535,null))['catch'](handleError(_0x1bf535,null));};exports[_0xb84c('0xd4')]=function(_0x2d1834,_0x31ab8d,_0x138bf4){var _0x26d6e4={};var _0xa80644={};var _0x5785d8;var _0x36bddb;return db[_0xb84c('0x48')]['findOne']({'where':{'id':_0x2d1834['params']['id']}})['then'](handleEntityNotFound(_0x31ab8d,null))['then'](function(_0x3b3b7f){if(_0x3b3b7f){_0x5785d8=_0x3b3b7f;_0xa80644['model']=_['keys'](db[_0xb84c('0xd5')][_0xb84c('0x49')]);_0xa80644[_0xb84c('0x4e')]=_[_0xb84c('0xbb')](_0x2d1834[_0xb84c('0x4e')]);_0xa80644[_0xb84c('0x4f')]=_[_0xb84c('0x51')](_0xa80644[_0xb84c('0x4c')],_0xa80644['query']);_0x26d6e4['attributes']=_['intersection'](_0xa80644[_0xb84c('0x4c')],qs[_0xb84c('0x52')](_0x2d1834[_0xb84c('0x4e')]['fields']));_0x26d6e4[_0xb84c('0x50')]=_0x26d6e4[_0xb84c('0x50')][_0xb84c('0x53')]?_0x26d6e4[_0xb84c('0x50')]:_0xa80644[_0xb84c('0x4c')];_0x26d6e4[_0xb84c('0xbd')]=qs[_0xb84c('0x55')](_0x2d1834[_0xb84c('0x4e')]['sort']);_0x26d6e4[_0xb84c('0x56')]=qs[_0xb84c('0x4f')](_['pick'](_0x2d1834['query'],_0xa80644[_0xb84c('0x4f')]));if(_0x2d1834[_0xb84c('0x4e')][_0xb84c('0x3d')]){_0x26d6e4[_0xb84c('0x56')]=_[_0xb84c('0x58')](_0x26d6e4['where'],{'$or':_[_0xb84c('0x3e')](_0x26d6e4['attributes'],function(_0x17e5ed){var _0xfb35b2={};_0xfb35b2[_0x17e5ed]={'$like':'%'+_0x2d1834[_0xb84c('0x4e')][_0xb84c('0x3d')]+'%'};return _0xfb35b2;})});}_0x26d6e4=_[_0xb84c('0x58')]({},_0x26d6e4,_0x2d1834['options']);return _0x5785d8[_0xb84c('0xd4')](_0x26d6e4);}})[_0xb84c('0x24')](function(_0xd00caa){if(_0xd00caa){_0x36bddb=_0xd00caa[_0xb84c('0x53')];if(!_0x2d1834[_0xb84c('0x4e')][_0xb84c('0xbf')](_0xb84c('0xc6'))){_0x26d6e4[_0xb84c('0x32')]=qs['limit'](_0x2d1834[_0xb84c('0x4e')][_0xb84c('0x32')]);_0x26d6e4[_0xb84c('0x54')]=qs[_0xb84c('0x54')](_0x2d1834[_0xb84c('0x4e')]['offset']);}return _0x5785d8[_0xb84c('0xd4')](_0x26d6e4);}})['then'](function(_0x37e9ae){if(_0x37e9ae){return _0x37e9ae?{'count':_0x36bddb,'rows':_0x37e9ae}:null;}})[_0xb84c('0x24')](respondWithResult(_0x31ab8d,null))[_0xb84c('0x2e')](handleError(_0x31ab8d,null));};exports['getMailInteractions']=function(_0x3295cd,_0xe46e94,_0x694750){var _0x48e0e4={'raw':!![],'where':{}};var _0x59149a={};var _0xa7a3cf={'count':0x0,'rows':[]};return db[_0xb84c('0x48')]['findOne']({'where':{'id':_0x3295cd[_0xb84c('0x64')]['id']}})['then'](handleEntityNotFound(_0xe46e94,null))[_0xb84c('0x24')](function(_0x4dc9c1){if(_0x4dc9c1){_0x59149a['model']=_['keys'](db[_0xb84c('0xd6')][_0xb84c('0x49')]);_0x59149a['query']=_[_0xb84c('0xbb')](_0x3295cd[_0xb84c('0x4e')]);_0x59149a[_0xb84c('0x4f')]=_[_0xb84c('0x51')](_0x59149a[_0xb84c('0x4c')],_0x59149a[_0xb84c('0x4e')]);_0x48e0e4[_0xb84c('0x50')]=_[_0xb84c('0x51')](_0x59149a[_0xb84c('0x4c')],qs[_0xb84c('0x52')](_0x3295cd[_0xb84c('0x4e')]['fields']));_0x48e0e4[_0xb84c('0x50')]=_0x48e0e4[_0xb84c('0x50')][_0xb84c('0x53')]?_0x48e0e4['attributes']:_0x59149a['model'];if(!_0x3295cd[_0xb84c('0x4e')]['hasOwnProperty'](_0xb84c('0xc6'))){_0x48e0e4[_0xb84c('0x32')]=qs[_0xb84c('0x32')](_0x3295cd['query'][_0xb84c('0x32')]);_0x48e0e4[_0xb84c('0x54')]=qs[_0xb84c('0x54')](_0x3295cd[_0xb84c('0x4e')][_0xb84c('0x54')]);}_0x48e0e4[_0xb84c('0xbd')]=qs[_0xb84c('0x55')](_0x3295cd['query'][_0xb84c('0x55')]);_0x48e0e4[_0xb84c('0x56')]=qs[_0xb84c('0x4f')](_[_0xb84c('0x57')](_0x3295cd[_0xb84c('0x4e')],_0x59149a[_0xb84c('0x4f')]));_0x48e0e4[_0xb84c('0x56')][_0xb84c('0xd1')]=_0x4dc9c1['id'];if(_0x3295cd[_0xb84c('0x4e')]['filter']){_0x48e0e4['where']=_['merge'](_0x48e0e4[_0xb84c('0x56')],{'$or':_[_0xb84c('0x3e')](_0x48e0e4[_0xb84c('0x50')],function(_0x348bda){var _0x4abf25={};_0x4abf25[_0x348bda]={'$like':'%'+_0x3295cd[_0xb84c('0x4e')][_0xb84c('0x3d')]+'%'};return _0x4abf25;})});}_0x48e0e4=_[_0xb84c('0x58')]({},_0x48e0e4,_0x3295cd[_0xb84c('0x5d')]);return db[_0xb84c('0xd6')][_0xb84c('0x5e')]({'where':_0x48e0e4[_0xb84c('0x56')]})[_0xb84c('0x24')](function(_0x53c991){_0xa7a3cf[_0xb84c('0x5e')]=_0x53c991;if(_0x3295cd[_0xb84c('0x4e')][_0xb84c('0x5f')]){_0x48e0e4[_0xb84c('0x60')]=[{'all':!![]}];}return db[_0xb84c('0xd6')][_0xb84c('0x61')](_0x48e0e4);})[_0xb84c('0x24')](function(_0x801d9d){_0xa7a3cf[_0xb84c('0x62')]=_0x801d9d;return _0xa7a3cf;});}})[_0xb84c('0x24')](respondWithFilteredResult(_0xe46e94,_0x48e0e4))['catch'](handleError(_0xe46e94,null));};exports[_0xb84c('0xd7')]=function(_0x265c54,_0x2aef80,_0x1bc7b0){var _0x52128a={};var _0x469bfb={};var _0x55eea4;var _0x1c3b44;return db[_0xb84c('0x48')][_0xb84c('0x95')]({'where':{'id':_0x265c54[_0xb84c('0x64')]['id']}})[_0xb84c('0x24')](handleEntityNotFound(_0x2aef80,null))[_0xb84c('0x24')](function(_0x21cfc3){if(_0x21cfc3){_0x55eea4=_0x21cfc3;_0x469bfb[_0xb84c('0x4c')]=_[_0xb84c('0xbb')](db['SmsInteraction'][_0xb84c('0x49')]);_0x469bfb[_0xb84c('0x4e')]=_['keys'](_0x265c54[_0xb84c('0x4e')]);_0x469bfb[_0xb84c('0x4f')]=_[_0xb84c('0x51')](_0x469bfb['model'],_0x469bfb['query']);_0x52128a[_0xb84c('0x50')]=_[_0xb84c('0x51')](_0x469bfb[_0xb84c('0x4c')],qs[_0xb84c('0x52')](_0x265c54['query'][_0xb84c('0x52')]));_0x52128a[_0xb84c('0x50')]=_0x52128a[_0xb84c('0x50')][_0xb84c('0x53')]?_0x52128a[_0xb84c('0x50')]:_0x469bfb[_0xb84c('0x4c')];_0x52128a['order']=qs[_0xb84c('0x55')](_0x265c54[_0xb84c('0x4e')][_0xb84c('0x55')]);_0x52128a['where']=qs['filters'](_[_0xb84c('0x57')](_0x265c54[_0xb84c('0x4e')],_0x469bfb[_0xb84c('0x4f')]));if(_0x265c54[_0xb84c('0x4e')][_0xb84c('0x3d')]){_0x52128a[_0xb84c('0x56')]=_[_0xb84c('0x58')](_0x52128a[_0xb84c('0x56')],{'$or':_[_0xb84c('0x3e')](_0x52128a[_0xb84c('0x50')],function(_0x1da94f){var _0x56ad0c={};_0x56ad0c[_0x1da94f]={'$like':'%'+_0x265c54['query'][_0xb84c('0x3d')]+'%'};return _0x56ad0c;})});}_0x52128a=_['merge']({},_0x52128a,_0x265c54[_0xb84c('0x5d')]);return _0x55eea4[_0xb84c('0xd7')](_0x52128a);}})[_0xb84c('0x24')](function(_0x1f3c8f){if(_0x1f3c8f){_0x1c3b44=_0x1f3c8f[_0xb84c('0x53')];if(!_0x265c54[_0xb84c('0x4e')][_0xb84c('0xbf')](_0xb84c('0xc6'))){_0x52128a[_0xb84c('0x32')]=qs[_0xb84c('0x32')](_0x265c54[_0xb84c('0x4e')][_0xb84c('0x32')]);_0x52128a[_0xb84c('0x54')]=qs[_0xb84c('0x54')](_0x265c54[_0xb84c('0x4e')][_0xb84c('0x54')]);}return _0x55eea4[_0xb84c('0xd7')](_0x52128a);}})[_0xb84c('0x24')](function(_0x159551){if(_0x159551){return _0x159551?{'count':_0x1c3b44,'rows':_0x159551}:null;}})[_0xb84c('0x24')](respondWithResult(_0x2aef80,null))['catch'](handleError(_0x2aef80,null));};exports[_0xb84c('0xd8')]=function(_0x1b3fb9,_0x18280f,_0x3d3268){var _0x216f13={};var _0x2f1a64={};var _0x264493;var _0x3a7d24;return db['User'][_0xb84c('0x95')]({'where':{'id':_0x1b3fb9[_0xb84c('0x64')]['id']}})[_0xb84c('0x24')](handleEntityNotFound(_0x18280f,null))[_0xb84c('0x24')](function(_0x26c8ef){if(_0x26c8ef){_0x264493=_0x26c8ef;_0x2f1a64[_0xb84c('0x4c')]=_['keys'](db[_0xb84c('0xd9')]['rawAttributes']);_0x2f1a64[_0xb84c('0x4e')]=_[_0xb84c('0xbb')](_0x1b3fb9[_0xb84c('0x4e')]);_0x2f1a64[_0xb84c('0x4f')]=_[_0xb84c('0x51')](_0x2f1a64[_0xb84c('0x4c')],_0x2f1a64[_0xb84c('0x4e')]);_0x216f13[_0xb84c('0x50')]=_[_0xb84c('0x51')](_0x2f1a64['model'],qs['fields'](_0x1b3fb9[_0xb84c('0x4e')][_0xb84c('0x52')]));_0x216f13['attributes']=_0x216f13[_0xb84c('0x50')][_0xb84c('0x53')]?_0x216f13['attributes']:_0x2f1a64[_0xb84c('0x4c')];_0x216f13['order']=qs[_0xb84c('0x55')](_0x1b3fb9[_0xb84c('0x4e')]['sort']);_0x216f13['where']=qs[_0xb84c('0x4f')](_[_0xb84c('0x57')](_0x1b3fb9[_0xb84c('0x4e')],_0x2f1a64[_0xb84c('0x4f')]));if(_0x1b3fb9[_0xb84c('0x4e')][_0xb84c('0x3d')]){_0x216f13[_0xb84c('0x56')]=_[_0xb84c('0x58')](_0x216f13[_0xb84c('0x56')],{'$or':_[_0xb84c('0x3e')](_0x216f13[_0xb84c('0x50')],function(_0x221f3a){var _0x3502ee={};_0x3502ee[_0x221f3a]={'$like':'%'+_0x1b3fb9['query']['filter']+'%'};return _0x3502ee;})});}_0x216f13=_[_0xb84c('0x58')]({},_0x216f13,_0x1b3fb9[_0xb84c('0x5d')]);return _0x264493[_0xb84c('0xd8')](_0x216f13);}})[_0xb84c('0x24')](function(_0x1b63f5){if(_0x1b63f5){_0x3a7d24=_0x1b63f5[_0xb84c('0x53')];if(!_0x1b3fb9['query']['hasOwnProperty'](_0xb84c('0xc6'))){_0x216f13[_0xb84c('0x32')]=qs['limit'](_0x1b3fb9[_0xb84c('0x4e')][_0xb84c('0x32')]);_0x216f13['offset']=qs[_0xb84c('0x54')](_0x1b3fb9[_0xb84c('0x4e')][_0xb84c('0x54')]);}return _0x264493[_0xb84c('0xd8')](_0x216f13);}})['then'](function(_0x42d3be){if(_0x42d3be){return _0x42d3be?{'count':_0x3a7d24,'rows':_0x42d3be}:null;}})['then'](respondWithResult(_0x18280f,null))['catch'](handleError(_0x18280f,null));};exports['getWhatsappInteractions']=function(_0x1e34b1,_0x370356,_0x292dce){var _0x3ec800={};var _0x4c7b7c={};var _0x28acea;var _0x39709a;return db[_0xb84c('0x48')]['findOne']({'where':{'id':_0x1e34b1['params']['id']}})[_0xb84c('0x24')](handleEntityNotFound(_0x370356,null))[_0xb84c('0x24')](function(_0x384d03){if(_0x384d03){_0x28acea=_0x384d03;_0x4c7b7c['model']=_[_0xb84c('0xbb')](db['WhatsappInteraction'][_0xb84c('0x49')]);_0x4c7b7c[_0xb84c('0x4e')]=_['keys'](_0x1e34b1[_0xb84c('0x4e')]);_0x4c7b7c[_0xb84c('0x4f')]=_[_0xb84c('0x51')](_0x4c7b7c[_0xb84c('0x4c')],_0x4c7b7c['query']);_0x3ec800[_0xb84c('0x50')]=_['intersection'](_0x4c7b7c[_0xb84c('0x4c')],qs[_0xb84c('0x52')](_0x1e34b1[_0xb84c('0x4e')][_0xb84c('0x52')]));_0x3ec800[_0xb84c('0x50')]=_0x3ec800[_0xb84c('0x50')][_0xb84c('0x53')]?_0x3ec800[_0xb84c('0x50')]:_0x4c7b7c[_0xb84c('0x4c')];_0x3ec800[_0xb84c('0xbd')]=qs['sort'](_0x1e34b1['query'][_0xb84c('0x55')]);_0x3ec800[_0xb84c('0x56')]=qs[_0xb84c('0x4f')](_[_0xb84c('0x57')](_0x1e34b1[_0xb84c('0x4e')],_0x4c7b7c[_0xb84c('0x4f')]));if(_0x1e34b1[_0xb84c('0x4e')][_0xb84c('0x3d')]){_0x3ec800[_0xb84c('0x56')]=_['merge'](_0x3ec800[_0xb84c('0x56')],{'$or':_[_0xb84c('0x3e')](_0x3ec800[_0xb84c('0x50')],function(_0x472619){var _0x1adae1={};_0x1adae1[_0x472619]={'$like':'%'+_0x1e34b1[_0xb84c('0x4e')]['filter']+'%'};return _0x1adae1;})});}_0x3ec800=_[_0xb84c('0x58')]({},_0x3ec800,_0x1e34b1[_0xb84c('0x5d')]);return _0x28acea[_0xb84c('0xda')](_0x3ec800);}})[_0xb84c('0x24')](function(_0x6e3100){if(_0x6e3100){_0x39709a=_0x6e3100[_0xb84c('0x53')];if(!_0x1e34b1[_0xb84c('0x4e')][_0xb84c('0xbf')](_0xb84c('0xc6'))){_0x3ec800[_0xb84c('0x32')]=qs[_0xb84c('0x32')](_0x1e34b1[_0xb84c('0x4e')][_0xb84c('0x32')]);_0x3ec800['offset']=qs[_0xb84c('0x54')](_0x1e34b1[_0xb84c('0x4e')][_0xb84c('0x54')]);}return _0x28acea[_0xb84c('0xda')](_0x3ec800);}})[_0xb84c('0x24')](function(_0x56675a){if(_0x56675a){return _0x56675a?{'count':_0x39709a,'rows':_0x56675a}:null;}})[_0xb84c('0x24')](respondWithResult(_0x370356,null))[_0xb84c('0x2e')](handleError(_0x370356,null));};exports[_0xb84c('0xdb')]=function(_0x326f80,_0x211166,_0x34b1de){var _0xd8a0bc;var _0x5a0cbc;var _0x2b93dc;var _0x1173b1=!_[_0xb84c('0x74')](_0x326f80[_0xb84c('0x64')]['id'])?_0x326f80[_0xb84c('0x64')]['id']:!_[_0xb84c('0x74')](_0x326f80[_0xb84c('0x70')]['id'])?_0x326f80[_0xb84c('0x70')]['id']:null;return db[_0xb84c('0x48')][_0xb84c('0x69')]({'where':{'id':_0x1173b1,'role':{'$or':[_0xb84c('0x6f'),_0xb84c('0x70'),_0xb84c('0x3a')]}},'attributes':['id',_0xb84c('0x45'),_0xb84c('0xdc'),_0xb84c('0xdd'),'role','internal',_0xb84c('0xde')]})[_0xb84c('0x24')](function(_0x58721a){if(_0x58721a){if(_0x58721a[_0xb84c('0x41')]===_0xb84c('0x3a')){_0xd8a0bc=_0x58721a;if(_0x326f80[_0xb84c('0x68')][_0xb84c('0x9f')]){_0x2b93dc=util[_0xb84c('0x76')](_0xb84c('0xdf'),_0xd8a0bc[_0x326f80['body'][_0xb84c('0x9f')]]);}else if(_0x326f80[_0xb84c('0x68')][_0xb84c('0xe0')]){_0x2b93dc=util['format'](_0xb84c('0xac'),_0x326f80[_0xb84c('0x68')][_0xb84c('0xe0')]);}else{_0x2b93dc=util[_0xb84c('0x76')](_0xb84c('0xac'),_0xd8a0bc[_0xb84c('0x45')]);}socket['to'](util[_0xb84c('0x76')]('user:%s',_0xd8a0bc[_0xb84c('0x45')]))[_0xb84c('0xa6')]('user:forcelogout',{'ip':_0x326f80[_0xb84c('0xe1')][_0xb84c('0xe2')]||_0x326f80['connection'][_0xb84c('0xe3')]||_0x326f80[_0xb84c('0xe4')]['remoteAddress']||_0x326f80[_0xb84c('0xe5')][_0xb84c('0xe4')][_0xb84c('0xe3')]});return db[_0xb84c('0xaf')][_0xb84c('0x38')]({'where':{'membername':_0xd8a0bc[_0xb84c('0x45')]},'individualHooks':!![]});}}else{throw new db[(_0xb84c('0x22'))][(_0xb84c('0x9a'))](_0xb84c('0xe6'));}})[_0xb84c('0x24')](function(){if(_0xd8a0bc){return _0xd8a0bc[_0xb84c('0xe7')]({'raw':!![]});}})[_0xb84c('0x24')](function(_0x4e1355){if(_0xd8a0bc){var _0x292694=[];if(_0x4e1355){_0x5a0cbc=_0x4e1355;if(_0x5a0cbc[_0xb84c('0x53')]){for(var _0x5ee070=0x0;_0x5ee070<_0x5a0cbc[_0xb84c('0x53')];_0x5ee070++){_0x292694[_0xb84c('0xab')]({'membername':_0xd8a0bc[_0xb84c('0x45')],'UserId':_0xd8a0bc['id'],'queue_name':_0x5a0cbc[_0x5ee070][_0xb84c('0x45')],'VoiceQueueId':_0x5a0cbc[_0x5ee070]['id'],'interface':_0x2b93dc,'paused':_0xd8a0bc[_0xb84c('0xde')]||![],'penalty':_0x5a0cbc[_0x5ee070][_0xb84c('0xe8')]||0x0});}return BPromise[_0xb84c('0xae')](_0x292694,function(_0x428ce9){return db[_0xb84c('0xaf')][_0xb84c('0xe9')](_0x428ce9);});}}}})[_0xb84c('0x24')](function(){if(_0xd8a0bc){return db[_0xb84c('0xea')][_0xb84c('0x61')]({'where':{'membername':_0xd8a0bc[_0xb84c('0x45')],'exitAt':null}});}})[_0xb84c('0x24')](function(_0x478640){if(_0xd8a0bc){var _0x56a268=[];_0x478640[_0xb84c('0xeb')](function(_0x34d303){_0x56a268[_0xb84c('0xab')](_0x34d303['update']({'exitAt':moment()[_0xb84c('0x76')](_0xb84c('0xec'))}));});return BPromise[_0xb84c('0xed')](_0x56a268);}})[_0xb84c('0x24')](function(){if(_0xd8a0bc){var _0x1fad4d=[];var _0x574cf2=[];var _0x5258a7=utils[_0xb84c('0xee')]();var _0x218aab={'membername':_0xd8a0bc[_0xb84c('0x45')],'interface':_0x2b93dc,'enterAt':moment()['format'](_0xb84c('0xec')),'role':_0xd8a0bc[_0xb84c('0x41')],'internal':_0xd8a0bc['internal']};_0x5258a7[_0xb84c('0xeb')](function(_0x5beccd){_0x1fad4d[_0xb84c('0xab')](_[_0xb84c('0x58')]({'channel':_0x5beccd,'type':'LOGIN','data1':_0x326f80[_0xb84c('0x68')]['device'],'data2':_0x2b93dc},_0x218aab));if(_0xd8a0bc[_0xb84c('0xde')]){_0x574cf2[_0xb84c('0xab')](_[_0xb84c('0x58')]({'channel':_0x5beccd,'type':_0xb84c('0xef'),'data1':_0xb84c('0xf0')},_0x218aab));}});return db[_0xb84c('0xea')]['bulkCreate'](_0x1fad4d['concat'](_0x574cf2),{'individualHooks':!![]});}})[_0xb84c('0x24')](function(){if(_0xd8a0bc){return _0xd8a0bc[_0xb84c('0x37')]({'online':!![],'lastLoginAt':moment()[_0xb84c('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0xd8a0bc[_0xb84c('0xde')]||![],'mailPause':_0xd8a0bc['loginInPause']||![],'chatPause':_0xd8a0bc['loginInPause']||![],'faxPause':_0xd8a0bc['loginInPause']||![],'smsPause':_0xd8a0bc[_0xb84c('0xde')]||![],'openchannelPause':_0xd8a0bc[_0xb84c('0xde')]||![],'whatsappPause':_0xd8a0bc['loginInPause']||![],'pauseType':_0xd8a0bc[_0xb84c('0xde')]?_0xb84c('0xf0'):null,'interface':_0x2b93dc,'lastPauseAt':moment()[_0xb84c('0x76')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xb84c('0x24')](function(_0x1eb647){if(_0x326f80[_0xb84c('0xf1')]){return _0x34b1de();}else{return BPromise['resolve'](_0x1eb647)[_0xb84c('0x24')](respondWithResult(_0x211166,null));}})[_0xb84c('0x2e')](handleError(_0x211166,null));};exports[_0xb84c('0xf2')]=function(_0xa6ba3f,_0x1b8de7,_0x992b38){var _0x3561c0;return db[_0xb84c('0x48')][_0xb84c('0x69')]({'where':{'id':_0xa6ba3f[_0xb84c('0x64')]['id'],'role':_0xb84c('0x3a')},'attributes':['id',_0xb84c('0x45'),'role']})[_0xb84c('0x24')](handleEntityNotFound(_0x1b8de7,null))[_0xb84c('0x24')](function(_0x3ac477){if(_0x3ac477){_0x3561c0=_0x3ac477;return db[_0xb84c('0xaf')][_0xb84c('0x38')]({'where':{'membername':_0x3561c0['name']},'individualHooks':!![]});}})[_0xb84c('0x24')](function(){return db[_0xb84c('0xea')][_0xb84c('0x61')]({'where':{'membername':_0x3561c0[_0xb84c('0x45')],'exitAt':null}});})[_0xb84c('0x24')](function(_0x7539a5){var _0x246c68=[];_0x7539a5[_0xb84c('0xeb')](function(_0x54a320){_0x246c68[_0xb84c('0xab')](_0x54a320[_0xb84c('0x37')]({'exitAt':moment()[_0xb84c('0x76')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xb84c('0xed')](_0x246c68);})[_0xb84c('0x24')](function(){return _0x3561c0[_0xb84c('0x37')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xb84c('0x24')](respondWithResult(_0x1b8de7,null))[_0xb84c('0x2e')](handleError(_0x1b8de7,null));};exports['pause']=function(_0x1d2ec4,_0x151ca1,_0x2e2dfa){var _0x2cb8af;return db['UserVoiceQueueRt'][_0xb84c('0x37')]({'paused':0x1},{'where':{'UserId':_0x1d2ec4[_0xb84c('0x64')]['id']},'individualHooks':!![]})[_0xb84c('0x24')](function(){return db[_0xb84c('0x48')]['find']({'where':{'id':_0x1d2ec4[_0xb84c('0x64')]['id'],'role':_0xb84c('0x3a')},'attributes':['id','name',_0xb84c('0x41'),_0xb84c('0x79'),'interface']});})['then'](handleEntityNotFound(_0x151ca1,null))['then'](function(_0x6910b3){if(_0x6910b3){_0x2cb8af=_0x6910b3;return respondWithRpcPromise('QueuePause',_0xb84c('0xf3'),{'id':_0x2cb8af['id'],'name':_0x2cb8af[_0xb84c('0x45')],'pause':!![]});}})[_0xb84c('0x24')](function(){if(_0x2cb8af){return db['MemberReport'][_0xb84c('0x61')]({'where':{'membername':_0x2cb8af[_0xb84c('0x45')],'type':_0xb84c('0xef'),'exitAt':null}});}})['then'](function(_0x1d6ccc){if(_0x1d6ccc[_0xb84c('0x53')]){var _0xfc4987=moment()[_0xb84c('0x76')](_0xb84c('0xec'));for(var _0xee9522=0x0,_0x1e765b=_0x1d6ccc[_0xb84c('0x53')];_0xee9522<_0x1e765b;_0xee9522++){_0x1d6ccc[_0xee9522][_0xb84c('0xf4')]({'exitAt':_0xfc4987});}}})[_0xb84c('0x24')](function(){var _0x5d0b4b=[];var _0x56c55d=utils[_0xb84c('0xee')]();_0x56c55d['forEach'](function(_0x3be59a){_0x5d0b4b[_0xb84c('0xab')]({'channel':_0x3be59a,'membername':_0x2cb8af[_0xb84c('0x45')],'interface':_[_0xb84c('0x74')](_0x2cb8af['interface'])?util[_0xb84c('0x76')](_0xb84c('0xac'),_0x2cb8af[_0xb84c('0x45')]):_0x2cb8af[_0xb84c('0x9f')],'type':_0xb84c('0xef'),'enterAt':moment()[_0xb84c('0x76')](_0xb84c('0xec')),'data1':_0x1d2ec4['body'][_0xb84c('0x4b')]||'DEFAULT\x20PAUSE','role':_0x2cb8af['role'],'internal':_0x2cb8af[_0xb84c('0x79')]});});return db[_0xb84c('0xea')]['bulkCreate'](_0x5d0b4b,{'individualHooks':!![]});})[_0xb84c('0x24')](function(){return _0x2cb8af[_0xb84c('0x37')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1d2ec4['body']['type']||_0xb84c('0xf5'),'lastPauseAt':moment()[_0xb84c('0x76')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x151ca1,null))[_0xb84c('0x2e')](handleError(_0x151ca1,null));};exports[_0xb84c('0xf6')]=function(_0x4e6654,_0x38e884,_0x5dca17){var _0x5291f3;return db[_0xb84c('0x48')][_0xb84c('0x69')]({'where':{'id':_0x4e6654[_0xb84c('0x64')]['id']},'attributes':['id',_0xb84c('0x45'),_0xb84c('0x41'),_0xb84c('0xad'),_0xb84c('0xf7'),'chatPause',_0xb84c('0xf8'),_0xb84c('0xf9'),_0xb84c('0xfa'),_0xb84c('0xfb'),'pauseType','lastPauseAt']})[_0xb84c('0x24')](handleEntityNotFound(_0x38e884,null))[_0xb84c('0x24')](function(_0x47e18c){if(_0x47e18c){_0x5291f3=_0x47e18c;if(_0x4e6654['body'][_0xb84c('0x9e')]&&!utils['isValidChannel'](_0x4e6654[_0xb84c('0x68')][_0xb84c('0x9e')])){throw new db[(_0xb84c('0x22'))][(_0xb84c('0x9a'))]('Unknown\x20channel');}switch(_0x4e6654['body'][_0xb84c('0x9e')]){case'voice':return respondWithRpcPromise(_0xb84c('0xfc'),'unpause',{'id':_0x5291f3['id'],'name':_0x5291f3['name'],'pause':![]})[_0xb84c('0x24')](function(){return db[_0xb84c('0xaf')][_0xb84c('0x37')]({'paused':0x0},{'where':{'UserId':_0x5291f3['id']},'individualHooks':!![]});})[_0xb84c('0x24')](function(){return db[_0xb84c('0xea')][_0xb84c('0x69')]({'where':{'channel':_0x4e6654[_0xb84c('0x68')][_0xb84c('0x9e')],'membername':_0x5291f3[_0xb84c('0x45')],'type':'PAUSE','exitAt':null}});})[_0xb84c('0x24')](function(_0x127572){if(_0x127572){return _0x127572[_0xb84c('0x37')]({'exitAt':moment()['format'](_0xb84c('0xec')),'data2':_0xb84c('0xfd')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x5291f3['update']({'voicePause':![]});});case'mail':case _0xb84c('0xfe'):case _0xb84c('0xff'):case _0xb84c('0x100'):case _0xb84c('0x101'):case _0xb84c('0x102'):return db[_0xb84c('0xea')][_0xb84c('0x69')]({'where':{'channel':_0x4e6654['body'][_0xb84c('0x9e')],'membername':_0x5291f3[_0xb84c('0x45')],'type':_0xb84c('0xef'),'exitAt':null}})[_0xb84c('0x24')](function(_0xad7703){if(_0xad7703){return _0xad7703[_0xb84c('0x37')]({'exitAt':moment()[_0xb84c('0x76')](_0xb84c('0xec')),'data2':_0xb84c('0xfd')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x46d25e={};_[_0xb84c('0x33')](_0x46d25e,util[_0xb84c('0x76')](_0xb84c('0x103'),_0x4e6654[_0xb84c('0x68')][_0xb84c('0x9e')],'Pause'),![]);return _0x5291f3[_0xb84c('0x37')](_0x46d25e);});default:return respondWithRpcPromise(_0xb84c('0xfc'),'unpause',{'id':_0x5291f3['id'],'name':_0x5291f3['name'],'pause':![]})[_0xb84c('0x24')](function(){return db[_0xb84c('0xaf')][_0xb84c('0x37')]({'paused':0x0},{'where':{'UserId':_0x5291f3['id']}});})['then'](function(){return db['MemberReport'][_0xb84c('0x61')]({'where':{'membername':_0x5291f3[_0xb84c('0x45')],'type':'PAUSE','exitAt':null}});})[_0xb84c('0x24')](function(_0x47db78){var _0x2186a1=[];_0x47db78[_0xb84c('0xeb')](function(_0x27d329){_0x2186a1[_0xb84c('0xab')](_0x27d329[_0xb84c('0x37')]({'exitAt':moment()[_0xb84c('0x76')](_0xb84c('0xec')),'data2':'manual'}));});return BPromise['all'](_0x2186a1);})[_0xb84c('0x24')](function(){return _0x5291f3['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x38e884,null))[_0xb84c('0x2e')](handleError(_0x38e884,null));};exports[_0xb84c('0x104')]=function(_0x45b747,_0x58b319,_0x1103a7){var _0x3873e7={};var _0x35efd4={};var _0x20c746;var _0x2ea845;return db['User'][_0xb84c('0x95')]({'where':{'id':_0x45b747[_0xb84c('0x64')]['id']}})[_0xb84c('0x24')](handleEntityNotFound(_0x58b319,null))[_0xb84c('0x24')](function(_0x2e2077){if(_0x2e2077){_0x20c746=_0x2e2077;_0x35efd4['model']=_['keys'](db[_0xb84c('0x105')][_0xb84c('0x49')]);_0x35efd4[_0xb84c('0x4e')]=_[_0xb84c('0xbb')](_0x45b747[_0xb84c('0x4e')]);_0x35efd4['filters']=_[_0xb84c('0x51')](_0x35efd4['model'],_0x35efd4['query']);_0x3873e7['attributes']=_[_0xb84c('0x51')](_0x35efd4[_0xb84c('0x4c')],qs[_0xb84c('0x52')](_0x45b747['query'][_0xb84c('0x52')]));_0x3873e7[_0xb84c('0x50')]=_0x3873e7['attributes'][_0xb84c('0x53')]?_0x3873e7[_0xb84c('0x50')]:_0x35efd4[_0xb84c('0x4c')];_0x3873e7[_0xb84c('0xbd')]=qs['sort'](_0x45b747[_0xb84c('0x4e')]['sort']);_0x3873e7['where']=qs['filters'](_['pick'](_0x45b747[_0xb84c('0x4e')],_0x35efd4['filters']));if(_0x45b747[_0xb84c('0x4e')][_0xb84c('0x3d')]){_0x3873e7[_0xb84c('0x56')]=_['merge'](_0x3873e7[_0xb84c('0x56')],{'$or':_[_0xb84c('0x3e')](_0x3873e7[_0xb84c('0x50')],function(_0xbd369f){var _0x25e96={};_0x25e96[_0xbd369f]={'$like':'%'+_0x45b747['query'][_0xb84c('0x3d')]+'%'};return _0x25e96;})});}_0x3873e7=_[_0xb84c('0x58')]({},_0x3873e7,_0x45b747['options']);return _0x20c746[_0xb84c('0x104')](_0x3873e7);}})[_0xb84c('0x24')](function(_0x349d47){if(_0x349d47){_0x2ea845=_0x349d47[_0xb84c('0x53')];if(!_0x45b747[_0xb84c('0x4e')][_0xb84c('0xbf')](_0xb84c('0xc6'))){_0x3873e7[_0xb84c('0x32')]=qs['limit'](_0x45b747['query']['limit']);_0x3873e7[_0xb84c('0x54')]=qs[_0xb84c('0x54')](_0x45b747[_0xb84c('0x4e')][_0xb84c('0x54')]);}return _0x20c746[_0xb84c('0x104')](_0x3873e7);}})[_0xb84c('0x24')](function(_0x5be95e){if(_0x5be95e){return _0x5be95e?{'count':_0x2ea845,'rows':_0x5be95e}:null;}})[_0xb84c('0x24')](respondWithResult(_0x58b319,null))[_0xb84c('0x2e')](handleError(_0x58b319,null));};exports['addTeams']=function(_0x199acb,_0xfec9c){return db[_0xb84c('0x48')][_0xb84c('0x69')]({'where':{'id':_0x199acb[_0xb84c('0x64')]['id']}})[_0xb84c('0x24')](handleEntityNotFound(_0xfec9c,null))[_0xb84c('0x24')](function(_0x1773ad){if(_0x1773ad){var _0x163d99=_0x1773ad[_0xb84c('0x8f')]({'plain':!![]});return _0x1773ad[_0xb84c('0x106')](_0x199acb[_0xb84c('0x68')][_0xb84c('0x6c')],_[_0xb84c('0x6d')](_0x199acb[_0xb84c('0x68')],[_0xb84c('0x6c'),'id'])||{})['then'](function(){for(var _0x466fc2=0x0;_0x466fc2<_0x199acb[_0xb84c('0x68')][_0xb84c('0x6c')][_0xb84c('0x53')];_0x466fc2++){var _0x3d0f68=[];db[_0xb84c('0x105')][_0xb84c('0x95')]({'where':{'id':_0x199acb[_0xb84c('0x68')]['ids'][_0x466fc2]}})[_0xb84c('0x24')](function(_0xebec61){_0x3d0f68[_0xb84c('0xab')](_0xebec61[_0xb84c('0xe7')]()[_0xb84c('0x24')](function(_0x3ffb3b){for(var _0x1de1e8=0x0;_0x1de1e8<_0x3ffb3b[_0xb84c('0x53')];_0x1de1e8++){_0x3ffb3b[_0x1de1e8]['setDataValue'](_0xb84c('0x9e'),'Voice');}return _0x3ffb3b;}));_0x3d0f68['push'](_0xebec61[_0xb84c('0x107')]()[_0xb84c('0x24')](function(_0x18fd3a){for(var _0x517059=0x0;_0x517059<_0x18fd3a['length'];_0x517059++){_0x18fd3a[_0x517059][_0xb84c('0x108')](_0xb84c('0x9e'),_0xb84c('0x109'));}return _0x18fd3a;}));_0x3d0f68[_0xb84c('0xab')](_0xebec61['getMailQueues']()[_0xb84c('0x24')](function(_0x51cd7f){for(var _0x441da4=0x0;_0x441da4<_0x51cd7f[_0xb84c('0x53')];_0x441da4++){_0x51cd7f[_0x441da4][_0xb84c('0x108')](_0xb84c('0x9e'),_0xb84c('0x10a'));}return _0x51cd7f;}));_0x3d0f68[_0xb84c('0xab')](_0xebec61['getSmsQueues']()[_0xb84c('0x24')](function(_0x4f0c59){for(var _0x147942=0x0;_0x147942<_0x4f0c59['length'];_0x147942++){_0x4f0c59[_0x147942]['setDataValue'](_0xb84c('0x9e'),_0xb84c('0x10b'));}return _0x4f0c59;}));_0x3d0f68[_0xb84c('0xab')](_0xebec61[_0xb84c('0x10c')]()['then'](function(_0x30f924){for(var _0x32267b=0x0;_0x32267b<_0x30f924[_0xb84c('0x53')];_0x32267b++){_0x30f924[_0x32267b][_0xb84c('0x108')](_0xb84c('0x9e'),'Whatsapp');}return _0x30f924;}));_0x3d0f68[_0xb84c('0xab')](_0xebec61[_0xb84c('0x10d')]()[_0xb84c('0x24')](function(_0x3c156f){for(var _0x516dd3=0x0;_0x516dd3<_0x3c156f[_0xb84c('0x53')];_0x516dd3++){_0x3c156f[_0x516dd3][_0xb84c('0x108')](_0xb84c('0x9e'),_0xb84c('0x10e'));}return _0x3c156f;}));_0x3d0f68['push'](_0xebec61[_0xb84c('0x10f')]()['then'](function(_0x5cf70f){for(var _0x2c994c=0x0;_0x2c994c<_0x5cf70f[_0xb84c('0x53')];_0x2c994c++){_0x5cf70f[_0x2c994c][_0xb84c('0x108')](_0xb84c('0x9e'),_0xb84c('0x110'));}return _0x5cf70f;}));return BPromise[_0xb84c('0xed')](_0x3d0f68);})[_0xb84c('0x24')](function(_0x20e9d9){var _0x327f8f=_[_0xb84c('0x111')](_0x20e9d9);_0x3d0f68=[];return db[_0xb84c('0x5a')][_0xb84c('0x112')](function(_0x1056f7){for(var _0x1fceac=0x0;_0x1fceac<_0x327f8f['length'];_0x1fceac++){_0x3d0f68[_0xb84c('0xab')](_0x327f8f[_0x1fceac][_0xb84c('0x113')](_0x163d99['id']),{'transaction':_0x1056f7});}return BPromise[_0xb84c('0xed')](_0x3d0f68)[_0xb84c('0x24')](function(){if(_0x163d99[_0xb84c('0xaa')]){return BPromise[_0xb84c('0xae')](_[_0xb84c('0x3d')](_0x327f8f,function(_0x1f397a){return _0x1f397a[_0xb84c('0x114')](_0xb84c('0x9e'))==='Voice';}),function(_0x371727){return db[_0xb84c('0xaf')][_0xb84c('0xe9')]({'membername':_0x163d99[_0xb84c('0x45')],'UserId':_0x163d99['id'],'queue_name':_0x371727[_0xb84c('0x45')],'VoiceQueueId':_0x371727['id'],'interface':_[_0xb84c('0x74')](_0x163d99['interface'])?util[_0xb84c('0x76')](_0xb84c('0xac'),_0x163d99[_0xb84c('0x45')]):_0x163d99[_0xb84c('0x9f')],'paused':_0x163d99['voicePause']||![],'penalty':_0x163d99[_0xb84c('0xa4')]},{'transaction':_0x1056f7});});}else{return;}})[_0xb84c('0x24')](function(){for(var _0x3673b1=0x0;_0x3673b1<_0x327f8f[_0xb84c('0x53')];_0x3673b1++){var _0xb7952f=_0x327f8f[_0x3673b1][_0xb84c('0x114')](_0xb84c('0x9e'));var _0x2cccce=_0xb7952f+_0xb84c('0xb2');socket['emit'](_0xb84c('0x70')+_0xb7952f+'Queue:save',{'UserId':_0x163d99['id'],['queueField']:_0x327f8f[_0x3673b1]['id']});}});});});}});}})[_0xb84c('0x24')](respondWithStatusCode(_0xfec9c,null))[_0xb84c('0x2e')](handleError(_0xfec9c,null));};exports[_0xb84c('0x115')]=function(_0x4a2922,_0x32b1af){return db['User'][_0xb84c('0x95')]({'where':{'id':_0x4a2922[_0xb84c('0x64')]['id']}})[_0xb84c('0x24')](handleEntityNotFound(_0x32b1af,null))['then'](function(_0x4d4f4a){if(_0x4d4f4a){var _0x2af222=_0x4d4f4a['get']({'plain':!![]});var _0x530b3d=_0x4a2922[_0xb84c('0x4e')]['ids'];return _0x4d4f4a[_0xb84c('0x115')](_0x530b3d)['then'](function(){for(var _0x57478d=0x0;_0x57478d<_0x530b3d[_0xb84c('0x53')];_0x57478d++){var _0x5be411=[];db[_0xb84c('0x105')][_0xb84c('0x95')]({'where':{'id':_0x530b3d[_0x57478d]}})[_0xb84c('0x24')](function(_0x42b089){_0x5be411['push'](_0x42b089[_0xb84c('0xe7')]()[_0xb84c('0x24')](function(_0x16c65d){for(var _0xfc72db=0x0;_0xfc72db<_0x16c65d['length'];_0xfc72db++){_0x16c65d[_0xfc72db][_0xb84c('0x108')](_0xb84c('0x9e'),'Voice');}return _0x16c65d;}));_0x5be411[_0xb84c('0xab')](_0x42b089[_0xb84c('0x107')]()[_0xb84c('0x24')](function(_0x3b9bd9){for(var _0x3932c4=0x0;_0x3932c4<_0x3b9bd9[_0xb84c('0x53')];_0x3932c4++){_0x3b9bd9[_0x3932c4][_0xb84c('0x108')](_0xb84c('0x9e'),_0xb84c('0x109'));}return _0x3b9bd9;}));_0x5be411[_0xb84c('0xab')](_0x42b089['getMailQueues']()[_0xb84c('0x24')](function(_0x2d9005){for(var _0x57647e=0x0;_0x57647e<_0x2d9005[_0xb84c('0x53')];_0x57647e++){_0x2d9005[_0x57647e][_0xb84c('0x108')](_0xb84c('0x9e'),_0xb84c('0x10a'));}return _0x2d9005;}));_0x5be411['push'](_0x42b089[_0xb84c('0x116')]()[_0xb84c('0x24')](function(_0x1df5ae){for(var _0xbc5518=0x0;_0xbc5518<_0x1df5ae['length'];_0xbc5518++){_0x1df5ae[_0xbc5518][_0xb84c('0x108')](_0xb84c('0x9e'),_0xb84c('0x10b'));}return _0x1df5ae;}));_0x5be411[_0xb84c('0xab')](_0x42b089['getWhatsappQueues']()['then'](function(_0x8d8215){for(var _0x34c1fd=0x0;_0x34c1fd<_0x8d8215[_0xb84c('0x53')];_0x34c1fd++){_0x8d8215[_0x34c1fd][_0xb84c('0x108')](_0xb84c('0x9e'),_0xb84c('0x117'));}return _0x8d8215;}));_0x5be411[_0xb84c('0xab')](_0x42b089[_0xb84c('0x10d')]()['then'](function(_0x3e3d58){for(var _0x18543a=0x0;_0x18543a<_0x3e3d58[_0xb84c('0x53')];_0x18543a++){_0x3e3d58[_0x18543a][_0xb84c('0x108')](_0xb84c('0x9e'),_0xb84c('0x10e'));}return _0x3e3d58;}));_0x5be411[_0xb84c('0xab')](_0x42b089['getOpenchannelQueues']()['then'](function(_0x4102cd){for(var _0x5d0b23=0x0;_0x5d0b23<_0x4102cd['length'];_0x5d0b23++){_0x4102cd[_0x5d0b23][_0xb84c('0x108')](_0xb84c('0x9e'),'Openchannel');}return _0x4102cd;}));return BPromise['all'](_0x5be411);})[_0xb84c('0x24')](function(_0x5ce719){var _0x3e2694=_[_0xb84c('0x111')](_0x5ce719);_0x5be411=[];return db[_0xb84c('0x5a')]['transaction'](function(_0x102474){for(var _0x1e6c48=0x0;_0x1e6c48<_0x3e2694[_0xb84c('0x53')];_0x1e6c48++){_0x5be411[_0xb84c('0xab')](_0x3e2694[_0x1e6c48][_0xb84c('0x118')](_0x2af222['id']),{'transaction':_0x102474});}return BPromise['all'](_0x5be411)[_0xb84c('0x24')](function(){if(_0x2af222[_0xb84c('0xaa')]){return BPromise['each'](_[_0xb84c('0x3d')](_0x3e2694,function(_0x5d5b86){return _0x5d5b86[_0xb84c('0x114')](_0xb84c('0x9e'))===_0xb84c('0x119');}),function(_0x3b0e4f){return db[_0xb84c('0xaf')][_0xb84c('0x38')]({'where':{'VoiceQueueId':_0x3b0e4f['id'],'UserId':_0x2af222['id']},'transaction':_0x102474});});}else{return;}})[_0xb84c('0x24')](function(){for(var _0x59562a=0x0;_0x59562a<_0x3e2694[_0xb84c('0x53')];_0x59562a++){var _0x1a27cc=_0x3e2694[_0x59562a][_0xb84c('0x114')]('channel');var _0x26504f=_0x1a27cc+'QueueId';socket[_0xb84c('0xa6')](_0xb84c('0x70')+_0x1a27cc+_0xb84c('0x11a'),{'UserId':_0x2af222['id'],['queueField']:_0x3e2694[_0x59562a]['id']});}});});});}});}})[_0xb84c('0x24')](respondWithStatusCode(_0x32b1af,null))[_0xb84c('0x2e')](handleError(_0x32b1af,null));};exports[_0xb84c('0x11b')]=function(_0x1c11d4,_0x4a6798,_0x3f7fec){var _0x2d7382={};var _0x522234={};var _0x48b13d;var _0x28cbd2;return db[_0xb84c('0x48')]['findOne']({'where':{'id':_0x1c11d4[_0xb84c('0x64')]['id']}})[_0xb84c('0x24')](handleEntityNotFound(_0x4a6798,null))[_0xb84c('0x24')](function(_0x545c23){if(_0x545c23){_0x48b13d=_0x545c23;_0x522234['model']=_['keys'](db[_0xb84c('0xc0')][_0xb84c('0x49')]);_0x522234[_0xb84c('0x4e')]=_[_0xb84c('0xbb')](_0x1c11d4[_0xb84c('0x4e')]);_0x522234[_0xb84c('0x4f')]=_['intersection'](_0x522234[_0xb84c('0x4c')],_0x522234['query']);_0x2d7382[_0xb84c('0x50')]=_['intersection'](_0x522234[_0xb84c('0x4c')],qs[_0xb84c('0x52')](_0x1c11d4[_0xb84c('0x4e')][_0xb84c('0x52')]));_0x2d7382[_0xb84c('0x50')]=_0x2d7382[_0xb84c('0x50')][_0xb84c('0x53')]?_0x2d7382[_0xb84c('0x50')]:_0x522234[_0xb84c('0x4c')];_0x2d7382[_0xb84c('0xbd')]=qs[_0xb84c('0x55')](_0x1c11d4[_0xb84c('0x4e')][_0xb84c('0x55')]);_0x2d7382[_0xb84c('0x56')]=qs['filters'](_['pick'](_0x1c11d4[_0xb84c('0x4e')],_0x522234[_0xb84c('0x4f')]));if(_0x1c11d4[_0xb84c('0x4e')][_0xb84c('0x3d')]){_0x2d7382[_0xb84c('0x56')]=_['merge'](_0x2d7382[_0xb84c('0x56')],{'$or':_[_0xb84c('0x3e')](_0x2d7382['attributes'],function(_0x382b8a){var _0x1e8d21={};_0x1e8d21[_0x382b8a]={'$like':'%'+_0x1c11d4['query'][_0xb84c('0x3d')]+'%'};return _0x1e8d21;})});}_0x2d7382=_[_0xb84c('0x58')]({},_0x2d7382,_0x1c11d4[_0xb84c('0x5d')]);return _0x48b13d[_0xb84c('0x11b')](_0x2d7382);}})[_0xb84c('0x24')](function(_0x5dce79){if(_0x5dce79){_0x28cbd2=_0x5dce79[_0xb84c('0x53')];if(!_0x1c11d4[_0xb84c('0x4e')]['hasOwnProperty'](_0xb84c('0xc6'))){_0x2d7382[_0xb84c('0x32')]=qs[_0xb84c('0x32')](_0x1c11d4[_0xb84c('0x4e')][_0xb84c('0x32')]);_0x2d7382[_0xb84c('0x54')]=qs[_0xb84c('0x54')](_0x1c11d4['query'][_0xb84c('0x54')]);}return _0x48b13d['getLists'](_0x2d7382);}})['then'](function(_0x18aae8){if(_0x18aae8){return _0x18aae8?{'count':_0x28cbd2,'rows':_0x18aae8}:null;}})['then'](respondWithResult(_0x4a6798,null))[_0xb84c('0x2e')](handleError(_0x4a6798,null));};exports[_0xb84c('0x11c')]=function(_0x55f9a5,_0x2a5c3c,_0xb34c5a){var _0xe2d08a={};var _0x4bd7a0={};var _0x4d7cff;var _0x50f241;return db[_0xb84c('0x48')][_0xb84c('0x95')]({'where':{'id':_0x55f9a5[_0xb84c('0x64')]['id']}})[_0xb84c('0x24')](handleEntityNotFound(_0x2a5c3c,null))[_0xb84c('0x24')](function(_0x52d940){if(_0x52d940){_0x4d7cff=_0x52d940;_0x4bd7a0[_0xb84c('0x4c')]=_[_0xb84c('0xbb')](db[_0xb84c('0x48')]['rawAttributes']);_0x4bd7a0[_0xb84c('0x4e')]=_[_0xb84c('0xbb')](_0x55f9a5[_0xb84c('0x4e')]);_0x4bd7a0['filters']=_['intersection'](_0x4bd7a0[_0xb84c('0x4c')],_0x4bd7a0['query']);_0xe2d08a[_0xb84c('0x50')]=_[_0xb84c('0x51')](_0x4bd7a0[_0xb84c('0x4c')],qs['fields'](_0x55f9a5[_0xb84c('0x4e')][_0xb84c('0x52')]));_0xe2d08a[_0xb84c('0x50')]=_0xe2d08a[_0xb84c('0x50')][_0xb84c('0x53')]?_0xe2d08a[_0xb84c('0x50')]:_0x4bd7a0['model'];_0xe2d08a[_0xb84c('0xbd')]=qs[_0xb84c('0x55')](_0x55f9a5['query'][_0xb84c('0x55')]);_0xe2d08a[_0xb84c('0x56')]=qs[_0xb84c('0x4f')](_['pick'](_0x55f9a5['query'],_0x4bd7a0[_0xb84c('0x4f')]));if(_0x55f9a5[_0xb84c('0x4e')][_0xb84c('0x3d')]){_0xe2d08a['where']=_['merge'](_0xe2d08a[_0xb84c('0x56')],{'$or':_[_0xb84c('0x3e')](_0xe2d08a[_0xb84c('0x50')],function(_0x45ab6b){var _0xf722e6={};_0xf722e6[_0x45ab6b]={'$like':'%'+_0x55f9a5[_0xb84c('0x4e')]['filter']+'%'};return _0xf722e6;})});}_0xe2d08a[_0xb84c('0x4c')]=db[_0xb84c('0x48')];_0xe2d08a['as']=_0xb84c('0x90');_0xe2d08a=_[_0xb84c('0x58')]({},_0xe2d08a,_0x55f9a5[_0xb84c('0x5d')]);return _0x4d7cff[_0xb84c('0xe7')]({'include':[_0xe2d08a]});}})[_0xb84c('0x24')](function(_0x4239e6){if(_0x4239e6){var _0x4cd889={},_0x2e5456=[],_0x1c9afd=0x0;for(var _0x2f911f=0x0;_0x2f911f<_0x4239e6['length'];_0x2f911f+=0x1){for(var _0x1e823f=0x0,_0x5555d6;_0x1e823f<_0x4239e6[_0x2f911f][_0xb84c('0x90')][_0xb84c('0x53')];_0x1e823f+=0x1){_0x5555d6=_0x4239e6[_0x2f911f][_0xb84c('0x90')][_0x1e823f]['get']({'plain':!![]});_0x4cd889[_0x5555d6['id']]=_0x5555d6;}}_0x4cd889=_[_0xb84c('0x11d')](_0x4cd889);for(var _0x12573b=qs[_0xb84c('0x54')](_0x55f9a5[_0xb84c('0x4e')]['offset']);_0x12573b<_0x4cd889['length']&&_0x2e5456[_0xb84c('0x53')]=_0x5951fb){_0x10392b=_0x5951fb;_0x4a8343=0xc8;}else{_0x4a8343=0xce;}_0x16dff3[_0x7ca3('0x31')](_0x4a8343);return _0x16dff3[_0x7ca3('0x36')]('Content-Range',_0x474928+'-'+_0x10392b+'/'+_0x5951fb)[_0x7ca3('0x32')](_0x5ddb8f);}return null;};}function patchUpdates(_0x4f7aec){return function(_0x212154){try{jsonpatch[_0x7ca3('0x37')](_0x212154,_0x4f7aec,!![]);}catch(_0x8e1674){return BPromise['reject'](_0x8e1674);}return _0x212154['save']();};}function saveUpdates(_0x5cc9d8,_0x208ea7){return function(_0x59d6){if(_0x59d6){return _0x59d6[_0x7ca3('0x38')](_0x5cc9d8)[_0x7ca3('0x24')](function(_0x13bed1){return _0x13bed1;});}return null;};}function removeEntity(_0x5a3e99,_0x400f96){return function(_0x1684ac){if(_0x1684ac){return _0x1684ac[_0x7ca3('0x39')]()['then'](function(){var _0xc3912b=_0x1684ac[_0x7ca3('0x3a')]({'plain':!![]});var _0x51fbaa=[{'name':_0x7ca3('0x3b'),'value':_0x7ca3('0x3c'),'ignore':!![]},{'name':_0x7ca3('0x3d'),'value':_0x7ca3('0x3e'),'ignore':![]},{'name':'Telephones','value':_0x7ca3('0x3f'),'ignore':![]}];var _0x95d38c=_(_0x51fbaa)[_0x7ca3('0x40')](_0x7ca3('0x41'))[_0x7ca3('0x42')](_0x7ca3('0x43'))[_0x7ca3('0x43')]();if(_[_0x7ca3('0x44')](_0x95d38c,_0xc3912b[_0x7ca3('0x45')])){return;}var _0x17cc32=_[_0x7ca3('0x46')](_0x51fbaa,[_0x7ca3('0x43'),_0xc3912b[_0x7ca3('0x45')]])[_0x7ca3('0x47')];return db[_0x7ca3('0x48')][_0x7ca3('0x39')]({'where':{'type':_0x17cc32,'resourceId':_0xc3912b['id']}})[_0x7ca3('0x24')](function(){return _0x1684ac;});})['then'](function(){_0x5a3e99['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x26bbc4,_0x351cfe){return function(_0x3bae41){if(!_0x3bae41){_0x26bbc4[_0x7ca3('0x30')](0x194);}return _0x3bae41;};}function handleError(_0x4ff735,_0x177d57){_0x177d57=_0x177d57||0x1f4;return function(_0x536c9e){logger[_0x7ca3('0x2b')](_0x536c9e[_0x7ca3('0x49')]);if(_0x536c9e['name']){delete _0x536c9e[_0x7ca3('0x47')];}_0x4ff735[_0x7ca3('0x31')](_0x177d57)[_0x7ca3('0x4a')](_0x536c9e);};}exports[_0x7ca3('0x4b')]=function(_0x5b9810,_0xfebb36){var _0xeb3fb9={},_0x356ae5={},_0x1393de={'count':0x0,'rows':[]};var _0x11ccf9=_[_0x7ca3('0x42')](db['User'][_0x7ca3('0x4c')],function(_0x26a817){return{'name':_0x26a817[_0x7ca3('0x4d')],'type':_0x26a817[_0x7ca3('0x4e')][_0x7ca3('0x4f')]};});_0x356ae5[_0x7ca3('0x50')]=_[_0x7ca3('0x51')](_[_0x7ca3('0x42')](_0x11ccf9,'name'),[_0x7ca3('0x52'),_0x7ca3('0x53')]);_0x356ae5[_0x7ca3('0x54')]=_[_0x7ca3('0x55')](_0x5b9810[_0x7ca3('0x54')]);_0x356ae5[_0x7ca3('0x56')]=_[_0x7ca3('0x57')](_0x356ae5[_0x7ca3('0x50')],_0x356ae5[_0x7ca3('0x54')]);_0xeb3fb9[_0x7ca3('0x58')]=_[_0x7ca3('0x57')](_0x356ae5['model'],qs[_0x7ca3('0x59')](_0x5b9810[_0x7ca3('0x54')][_0x7ca3('0x59')]));_0xeb3fb9[_0x7ca3('0x58')]=_0xeb3fb9[_0x7ca3('0x58')]['length']?_0xeb3fb9[_0x7ca3('0x58')]:_0x356ae5['model'];if(!_0x5b9810['query'][_0x7ca3('0x5a')](_0x7ca3('0x5b'))){_0xeb3fb9[_0x7ca3('0x35')]=qs['limit'](_0x5b9810[_0x7ca3('0x54')][_0x7ca3('0x35')]);_0xeb3fb9[_0x7ca3('0x34')]=qs[_0x7ca3('0x34')](_0x5b9810[_0x7ca3('0x54')][_0x7ca3('0x34')]);}_0xeb3fb9[_0x7ca3('0x5c')]=qs[_0x7ca3('0x5d')](_0x5b9810[_0x7ca3('0x54')][_0x7ca3('0x5d')]);_0xeb3fb9[_0x7ca3('0x5e')]=qs[_0x7ca3('0x56')](_[_0x7ca3('0x5f')](_0x5b9810[_0x7ca3('0x54')],_0x356ae5['filters']),_0x11ccf9);if(_0x5b9810[_0x7ca3('0x54')][_0x7ca3('0x40')]){_0xeb3fb9[_0x7ca3('0x5e')]=_[_0x7ca3('0x60')](_0xeb3fb9[_0x7ca3('0x5e')],{'$or':_[_0x7ca3('0x42')](_0x11ccf9,function(_0x2163f6){if(_0x2163f6[_0x7ca3('0x4e')]!==_0x7ca3('0x61')){return db['sequelize'][_0x7ca3('0x5e')](db['sequelize']['fn'](_0x7ca3('0x62'),db[_0x7ca3('0x63')][_0x7ca3('0x64')](_0x2163f6[_0x7ca3('0x47')])),{'$like':db[_0x7ca3('0x63')]['fn'](_0x7ca3('0x62'),'%'+_0x5b9810['query']['filter']+'%')});}})});}_0xeb3fb9=_[_0x7ca3('0x60')]({},_0xeb3fb9,_0x5b9810[_0x7ca3('0x65')]);var _0x376d3b={'where':_0xeb3fb9[_0x7ca3('0x5e')]};return db[_0x7ca3('0x66')][_0x7ca3('0x33')](_0x376d3b)[_0x7ca3('0x24')](function(_0x5d5c32){_0x1393de['count']=_0x5d5c32;if(_0x5b9810[_0x7ca3('0x54')][_0x7ca3('0x67')]){_0xeb3fb9[_0x7ca3('0x68')]=[{'all':!![]}];}return db[_0x7ca3('0x66')][_0x7ca3('0x69')](_0xeb3fb9);})[_0x7ca3('0x24')](function(_0x563427){_0x1393de[_0x7ca3('0x6a')]=_0x563427;return _0x1393de;})[_0x7ca3('0x24')](respondWithFilteredResult(_0xfebb36,_0xeb3fb9))[_0x7ca3('0x2f')](handleError(_0xfebb36,null));};exports['show']=function(_0x49c868,_0x515e1d){var _0x3ce2b5={'raw':![],'where':{'id':_0x49c868[_0x7ca3('0x6b')]['id']}},_0x52548a={};_0x52548a['model']=_[_0x7ca3('0x51')](_['keys'](db[_0x7ca3('0x66')]['rawAttributes']),[_0x7ca3('0x52'),_0x7ca3('0x53')]);_0x52548a['query']=_[_0x7ca3('0x55')](_0x49c868[_0x7ca3('0x54')]);_0x52548a[_0x7ca3('0x56')]=_[_0x7ca3('0x57')](_0x52548a[_0x7ca3('0x50')],_0x52548a[_0x7ca3('0x54')]);_0x3ce2b5[_0x7ca3('0x58')]=_['intersection'](_0x52548a['model'],qs[_0x7ca3('0x59')](_0x49c868['query']['fields']));_0x3ce2b5[_0x7ca3('0x58')]=_0x3ce2b5[_0x7ca3('0x58')][_0x7ca3('0x6c')]?_0x3ce2b5['attributes']:_0x52548a[_0x7ca3('0x50')];if(_0x49c868[_0x7ca3('0x54')][_0x7ca3('0x67')]){_0x3ce2b5[_0x7ca3('0x68')]=[{'all':!![]}];}_0x3ce2b5=_[_0x7ca3('0x60')]({},_0x3ce2b5,_0x49c868[_0x7ca3('0x65')]);return db['User'][_0x7ca3('0x46')](_0x3ce2b5)['then'](handleEntityNotFound(_0x515e1d,null))[_0x7ca3('0x24')](respondWithResult(_0x515e1d,null))[_0x7ca3('0x2f')](handleError(_0x515e1d,null));};exports[_0x7ca3('0x6d')]=function(_0x9f2a5c,_0x34ba7){return db[_0x7ca3('0x66')]['bulkCreate'](_0x9f2a5c[_0x7ca3('0x6e')],{'raw':![],'individualHooks':!![]})[_0x7ca3('0x24')](respondWithResult(_0x34ba7,0xc9))[_0x7ca3('0x2f')](handleError(_0x34ba7,null));};exports[_0x7ca3('0x38')]=function(_0x13ce13,_0x42b7e6){if(_0x13ce13[_0x7ca3('0x6e')]['id']){delete _0x13ce13['body']['id'];}delete _0x13ce13['body'][_0x7ca3('0x45')];return db['User'][_0x7ca3('0x46')]({'where':{'id':_0x13ce13[_0x7ca3('0x6b')]['id']}})[_0x7ca3('0x24')](handleEntityNotFound(_0x42b7e6,null))[_0x7ca3('0x24')](saveUpdates(_0x13ce13[_0x7ca3('0x6e')],null))[_0x7ca3('0x24')](respondWithResult(_0x42b7e6,null))[_0x7ca3('0x2f')](handleError(_0x42b7e6,null));};exports[_0x7ca3('0x6f')]=function(_0x1cd858,_0x19be70){return db['User']['describe']()[_0x7ca3('0x24')](respondWithResult(_0x19be70,null))[_0x7ca3('0x2f')](handleError(_0x19be70,null));};exports[_0x7ca3('0x70')]=function(_0x57113f,_0x460123,_0x4816b1){return db[_0x7ca3('0x66')][_0x7ca3('0x46')]({'where':{'id':_0x57113f[_0x7ca3('0x6b')]['id']}})[_0x7ca3('0x24')](handleEntityNotFound(_0x460123,null))[_0x7ca3('0x24')](function(_0x579cdd){if(_0x579cdd){return _0x579cdd[_0x7ca3('0x70')](_0x57113f[_0x7ca3('0x6e')]['ids'],_[_0x7ca3('0x71')](_0x57113f[_0x7ca3('0x6e')],[_0x7ca3('0x72'),'id'])||{});}})['then'](respondWithResult(_0x460123,null))['catch'](handleError(_0x460123,null));};var getLicense=function(_0x2cf38a){return new BPromise(function(_0x12aef9,_0xfecbae){var _0x56a18a=0x0;_0x2cf38a[_0x7ca3('0x6e')][_0x7ca3('0x45')]==='agent'&&_0x12aef9('agent\x20role');return db[_0x7ca3('0x66')][_0x7ca3('0x33')]({'where':{'$or':[{'role':_0x2cf38a[_0x7ca3('0x6e')][_0x7ca3('0x45')]===_0x7ca3('0x3f')?_0x7ca3('0x3f'):[_0x7ca3('0x73'),_0x7ca3('0x3c')]}]}})['then'](function(_0x5294cd){_0x56a18a=_0x5294cd;return require(_0x7ca3('0x74'))[_0x7ca3('0x75')]();})[_0x7ca3('0x24')](function(_0xabfd80){var _0x5d103b=_0x2cf38a[_0x7ca3('0x6e')][_0x7ca3('0x45')]===_0x7ca3('0x3f')?'telephones':_0x7ca3('0x76');if(!_['isNil'](_0xabfd80[_0x5d103b])&&_0x56a18a>=_0xabfd80[_0x5d103b]){return _0xfecbae({'message':_0x7ca3('0x77')});}return _0x12aef9(util[_0x7ca3('0x78')](_0x7ca3('0x79'),_0x5d103b,_0x56a18a));})[_0x7ca3('0x2f')](function(_0x5d31b6){return _0xfecbae(_0x5d31b6);});});};exports['create']=function(_0xf8107b,_0x22475d){return getLicense(_0xf8107b)['then'](function(_0x2f4933){if(!_0xf8107b[_0x7ca3('0x6e')][_0x7ca3('0x7a')]){var _0x463d84;return db['Setting'][_0x7ca3('0x7b')](0x1)['then'](function(_0xc71967){return checkPasswordPattern(_0xc71967,_0xf8107b[_0x7ca3('0x6e')]['password'],_0xc71967[_0x7ca3('0x7c')]);})[_0x7ca3('0x24')](function(_0x5f5ccb){_0x463d84=_0x5f5ccb[_0x7ca3('0x7d')];return db[_0x7ca3('0x66')]['max'](_0x7ca3('0x7a'));})[_0x7ca3('0x24')](function(_0x584e53){if(_[_0x7ca3('0x7e')](_0x584e53)){if(_0x463d84){_0xf8107b['body'][_0x7ca3('0x7a')]=_0x463d84;}else{_0xf8107b[_0x7ca3('0x6e')][_0x7ca3('0x7a')]=0x1;}}else{if(_[_0x7ca3('0x7e')](_0x463d84)||_0x463d84==_0x584e53){_0xf8107b['body']['internal']=_0x584e53+0x1;}else if(_0x463d84>_0x584e53){_0xf8107b[_0x7ca3('0x6e')][_0x7ca3('0x7a')]=_0x463d84;}else{return db[_0x7ca3('0x63')][_0x7ca3('0x54')](_0x7ca3('0x7f'),{'type':db[_0x7ca3('0x63')]['QueryTypes'][_0x7ca3('0x80')]})[_0x7ca3('0x24')](function(_0x285561){if(_0x285561&&_0x285561[_0x7ca3('0x6c')]){for(var _0x3c0d43=0x0,_0x202c84=_0x285561[_0x7ca3('0x6c')];_0x3c0d43<_0x202c84&&_[_0x7ca3('0x7e')](_0xf8107b[_0x7ca3('0x6e')][_0x7ca3('0x7a')]);_0x3c0d43++){if(_0x463d84<=_0x285561[_0x3c0d43][_0x7ca3('0x81')]){_0xf8107b[_0x7ca3('0x6e')][_0x7ca3('0x7a')]=_0x285561[_0x3c0d43]['from'];}else if(_0x463d84>_0x285561[_0x3c0d43]['from']&&_0x463d84<=_0x285561[_0x3c0d43]['to']){_0xf8107b[_0x7ca3('0x6e')][_0x7ca3('0x7a')]=_0x463d84;}}}if(_[_0x7ca3('0x7e')](_0xf8107b[_0x7ca3('0x6e')][_0x7ca3('0x7a')])){_0xf8107b[_0x7ca3('0x6e')][_0x7ca3('0x7a')]=_0x584e53+0x1;}});}}});}})[_0x7ca3('0x24')](function(){if(_0xf8107b[_0x7ca3('0x6e')]['voicemail']){_0xf8107b[_0x7ca3('0x6e')]['mailbox']=_0xf8107b[_0x7ca3('0x6e')][_0x7ca3('0x7a')];_0xf8107b['body'][_0x7ca3('0x82')]={'mailbox':_0xf8107b[_0x7ca3('0x6e')]['internal'],'password':_0xf8107b[_0x7ca3('0x6e')][_0x7ca3('0x52')],'fullname':_0xf8107b[_0x7ca3('0x6e')]['fullname'],'email':_0xf8107b['body'][_0x7ca3('0x83')]};}if(_0xf8107b[_0x7ca3('0x6e')]&&_0xf8107b[_0x7ca3('0x6e')][_0x7ca3('0x45')]===_0x7ca3('0x3e')){if(!_0xf8107b['body'][_0x7ca3('0x84')]){_0xf8107b[_0x7ca3('0x6e')][_0x7ca3('0x84')]=['101',_0x7ca3('0x85'),_0x7ca3('0x86'),_0x7ca3('0x87'),'110',_0x7ca3('0x88'),_0x7ca3('0x89'),_0x7ca3('0x8a'),'107',_0x7ca3('0x8b'),_0x7ca3('0x8c'),_0x7ca3('0x8d'),_0x7ca3('0x8e'),_0x7ca3('0x8f')];}}return db[_0x7ca3('0x66')][_0x7ca3('0x90')](_0xf8107b[_0x7ca3('0x6e')],{'include':[{'model':db[_0x7ca3('0x82')],'as':_0x7ca3('0x82')}]});})[_0x7ca3('0x24')](function(_0x3a28b1){if(_0xf8107b['body']['role']==='user')return _0x3a28b1;var _0x826783=_0xf8107b[_0x7ca3('0x3c')][_0x7ca3('0x3a')]({'plain':!![]});if(!_0x826783)throw new Error(_0x7ca3('0x91'));if(_0x826783[_0x7ca3('0x45')]===_0x7ca3('0x3c')){var _0x2fa332=_0x3a28b1[_0x7ca3('0x3a')]({'plain':!![]});var _0x52fc25=[{'name':'Agents','value':_0x7ca3('0x3e')},{'name':_0x7ca3('0x92'),'value':_0x7ca3('0x3f')}];var _0x307486=_[_0x7ca3('0x46')](_0x52fc25,[_0x7ca3('0x43'),_0x2fa332['role']])[_0x7ca3('0x47')];return db[_0x7ca3('0x93')][_0x7ca3('0x46')]({'where':{'name':_0x307486,'userProfileId':_0x826783[_0x7ca3('0x94')]},'raw':!![]})['then'](function(_0x516329){if(_0x516329&&_0x516329['autoAssociation']===0x0){return db[_0x7ca3('0x48')]['create']({'name':_0x2fa332[_0x7ca3('0x47')],'resourceId':_0x2fa332['id'],'type':_0x516329[_0x7ca3('0x47')],'sectionId':_0x516329['id']},{})['then'](function(){return _0x3a28b1;});}else{return _0x3a28b1;}})[_0x7ca3('0x2f')](function(_0x479d3c){logger[_0x7ca3('0x2b')](_0x7ca3('0x95'),_0x479d3c);throw _0x479d3c;});}return _0x3a28b1;})[_0x7ca3('0x24')](respondWithResult(_0x22475d,0xc9))[_0x7ca3('0x2f')](handleError(_0x22475d,null));};exports[_0x7ca3('0x96')]=function(_0x4139b7,_0x14ffda,_0x42dcf9){var _0x2e8a44=![];if(_0x4139b7[_0x7ca3('0x6e')]['id']){delete _0x4139b7[_0x7ca3('0x6e')]['id'];}return db[_0x7ca3('0x97')][_0x7ca3('0x98')]({'attributes':['id',_0x7ca3('0x7c')]})[_0x7ca3('0x24')](function(_0x40d6e1){_0x2e8a44=_0x40d6e1[_0x7ca3('0x7c')];return db[_0x7ca3('0x66')][_0x7ca3('0x46')]({'where':{'id':_0x4139b7[_0x7ca3('0x6b')]['id']}});})['then'](function(_0xcb616d){if(_0xcb616d){if(_0xcb616d['id']==_0x4139b7['user']['id']){if(!_0x4139b7['body']['oldPassword']||!_0x4139b7[_0x7ca3('0x6e')][_0x7ca3('0x99')]){throw new db[(_0x7ca3('0x20'))][(_0x7ca3('0x21'))](_0x7ca3('0x9a'));}if(!_0xcb616d[_0x7ca3('0x9b')](_0x4139b7[_0x7ca3('0x6e')][_0x7ca3('0x9c')])){throw new db['Sequelize'][(_0x7ca3('0x21'))](_0x7ca3('0x9d'));}if(_0x4139b7[_0x7ca3('0x6e')][_0x7ca3('0x9c')]==_0x4139b7[_0x7ca3('0x6e')][_0x7ca3('0x99')]){throw new db['Sequelize']['ValidationError'](_0x7ca3('0x9e'));}return _0xcb616d;}else if(_0x4139b7[_0x7ca3('0x3c')][_0x7ca3('0x45')]=='admin'){if(!_0x4139b7[_0x7ca3('0x6e')]['newPassword']){throw new db[(_0x7ca3('0x20'))][(_0x7ca3('0x21'))](_0x7ca3('0x9f'));}return _0xcb616d;}else if(_0x4139b7[_0x7ca3('0x3c')][_0x7ca3('0x45')]==_0x7ca3('0x3c')){if(!_0x4139b7['body']['newPassword']){throw new db[(_0x7ca3('0x20'))][(_0x7ca3('0x21'))](_0x7ca3('0x9f'));}if(_0xcb616d['role']!=_0x7ca3('0x3e')){throw new db['Sequelize'][(_0x7ca3('0x21'))]('Unauthorized');}return _0xcb616d;}else{throw new db[(_0x7ca3('0x20'))][(_0x7ca3('0x21'))](_0x7ca3('0xa0'));}}return null;})[_0x7ca3('0x24')](handleEntityNotFound(_0x14ffda,null))[_0x7ca3('0x24')](function(_0x421763){return checkPasswordPattern(_0x421763,_0x4139b7['body'][_0x7ca3('0x99')],_0x2e8a44);})[_0x7ca3('0x24')](saveUpdates({'password':_0x4139b7[_0x7ca3('0x6e')][_0x7ca3('0x99')],'passwordResetAt':_0x4139b7[_0x7ca3('0x3c')]['id']==_0x4139b7[_0x7ca3('0x6b')]['id']?moment():null},null))[_0x7ca3('0x24')](respondWithResult(_0x14ffda,null))[_0x7ca3('0x2f')](handleError(_0x14ffda,null));};exports[_0x7ca3('0xa1')]=function(_0x2dba49,_0x4c03c6,_0x55d19c){var _0x5ad592=_0x2dba49[_0x7ca3('0x6e')]['channel'];return db[_0x7ca3('0x66')][_0x7ca3('0x46')]({'where':{'id':_0x2dba49[_0x7ca3('0x6b')]['id']},'attributes':['id',_0x7ca3('0x47'),_0x7ca3('0x45'),'online','loginInPause','voicePause','interface']})[_0x7ca3('0x24')](handleEntityNotFound(_0x4c03c6,null))[_0x7ca3('0x24')](function(_0x59d700){if(_0x59d700){if(!utils['isValidChannel'](_0x5ad592)){throw new db[(_0x7ca3('0x20'))][(_0x7ca3('0x21'))](_0x7ca3('0xa2'));}return _0x59d700[_0x7ca3('0xa3')+_[_0x7ca3('0xa4')](_0x5ad592[_0x7ca3('0xa5')]())+'Queues'](_0x2dba49[_0x7ca3('0x6e')]['ids'],{'penalty':_0x2dba49[_0x7ca3('0x6e')][_0x7ca3('0xa6')]||0x0})[_0x7ca3('0xa7')](function(_0x52a504){for(var _0x1be87a=0x0;_0x1be87a<_0x2dba49['body'][_0x7ca3('0x72')][_0x7ca3('0x6c')];_0x1be87a+=0x1){var _0x17530d={'UserId':_0x2dba49[_0x7ca3('0x6b')]['id']};_0x17530d[_['capitalize'](_0x5ad592[_0x7ca3('0xa5')]())+'QueueId']=_0x2dba49[_0x7ca3('0x6e')]['ids'][_0x1be87a];socket[_0x7ca3('0xa8')](_0x7ca3('0x3c')+_[_0x7ca3('0xa4')](_0x5ad592[_0x7ca3('0xa5')]())+_0x7ca3('0xa9'),_0x17530d);}return _0x52a504;})['then'](function(){if(_0x5ad592==='voice'){return db['VoiceQueue'][_0x7ca3('0x69')]({'where':{'id':_0x2dba49[_0x7ca3('0x6e')][_0x7ca3('0x72')]||[]},'raw':!![],'attributes':['id',_0x7ca3('0x47')]});}})[_0x7ca3('0x24')](function(_0x493cff){var _0x19ca4f=_0x59d700[_0x7ca3('0x3a')]({'plain':!![]});var _0x4932a5=[];if(_0x5ad592===_0x7ca3('0xaa')&&_0x19ca4f[_0x7ca3('0x45')]===_0x7ca3('0x3e')&&_0x19ca4f[_0x7ca3('0xab')]){for(var _0x55cbfc=0x0;_0x55cbfc<_0x493cff[_0x7ca3('0x6c')];_0x55cbfc+=0x1){_0x4932a5[_0x7ca3('0xac')]({'membername':_0x19ca4f[_0x7ca3('0x47')],'UserId':_0x19ca4f['id'],'queue_name':_0x493cff[_0x55cbfc][_0x7ca3('0x47')],'VoiceQueueId':_0x493cff[_0x55cbfc]['id'],'interface':_[_0x7ca3('0x7e')](_0x19ca4f['interface'])?util['format'](_0x7ca3('0xad'),_0x19ca4f[_0x7ca3('0x47')]):_0x19ca4f[_0x7ca3('0xae')],'paused':_0x19ca4f['voicePause']||![],'penalty':_0x2dba49[_0x7ca3('0x6e')][_0x7ca3('0xa6')]||0x0});}return BPromise[_0x7ca3('0xaf')](_0x4932a5,function(_0x21e35d){return db[_0x7ca3('0xb0')][_0x7ca3('0xb1')](_0x21e35d);});}return _0x59d700;});}})[_0x7ca3('0x24')](respondWithStatusCode(_0x4c03c6,null))[_0x7ca3('0x2f')](handleError(_0x4c03c6,null));};exports[_0x7ca3('0xb2')]=function(_0x6f5fc4,_0x1bb419,_0x1c9644){var _0x229b24;return db[_0x7ca3('0x66')][_0x7ca3('0x46')]({'where':{'id':_0x6f5fc4[_0x7ca3('0x6b')]['id']},'attributes':['id',_0x7ca3('0x47'),'role']})[_0x7ca3('0x24')](handleEntityNotFound(_0x1bb419,null))[_0x7ca3('0x24')](function(_0x1cc69f){if(_0x1cc69f){_0x229b24=_0x1cc69f;if(!_0x6f5fc4[_0x7ca3('0x54')]['channel']||!utils['isValidChannel'](_0x6f5fc4[_0x7ca3('0x54')][_0x7ca3('0xb3')])){throw new db[(_0x7ca3('0x20'))][(_0x7ca3('0x21'))](_0x7ca3('0xa2'));}return _0x1cc69f[_0x7ca3('0xb4')+_[_0x7ca3('0xa4')](_0x6f5fc4[_0x7ca3('0x54')]['channel']['toLowerCase']())+_0x7ca3('0xb5')](_0x6f5fc4[_0x7ca3('0x54')]['ids']);}})[_0x7ca3('0x24')](function(_0xcd0638){for(var _0x1a349f=0x0;_0x1a349f<_0x6f5fc4['query'][_0x7ca3('0x72')][_0x7ca3('0x6c')];_0x1a349f+=0x1){var _0x4f388f={'UserId':_0x6f5fc4['params']['id']};_0x4f388f[_[_0x7ca3('0xa4')](_0x6f5fc4[_0x7ca3('0x54')][_0x7ca3('0xb3')]['toLowerCase']())+'QueueId']=_0x6f5fc4[_0x7ca3('0x54')][_0x7ca3('0x72')][_0x1a349f];socket['emit']('user'+_[_0x7ca3('0xa4')](_0x6f5fc4[_0x7ca3('0x54')][_0x7ca3('0xb3')]['toLowerCase']())+_0x7ca3('0xb6'),_0x4f388f);}return _0xcd0638;})['then'](function(){if(_0x6f5fc4[_0x7ca3('0x54')][_0x7ca3('0xb3')]==='voice'){return db[_0x7ca3('0xb0')]['destroy']({'where':{'UserId':_0x6f5fc4['params']['id'],'VoiceQueueId':_0x6f5fc4['query'][_0x7ca3('0x72')]},'individualHooks':!![]})['then'](function(){return _0x229b24;});}return _0x229b24;})[_0x7ca3('0x24')](respondWithStatusCode(_0x1bb419,null))['catch'](handleError(_0x1bb419,null));};exports['addAvatar']=function(_0x163be7,_0x33f52e,_0x45f83c){_0x163be7[_0x7ca3('0x6e')]['userpic']=_0x163be7[_0x7ca3('0xb7')][_0x7ca3('0xb8')];return db[_0x7ca3('0x66')][_0x7ca3('0x46')]({'where':{'id':_0x163be7[_0x7ca3('0x6b')]['id']}})['then'](handleEntityNotFound(_0x33f52e,null))['then'](saveUpdates(_0x163be7[_0x7ca3('0x6e')],null))['then'](respondWithResult(_0x33f52e,null))[_0x7ca3('0x2f')](handleError(_0x33f52e,null));};exports[_0x7ca3('0xb9')]=function(_0x485abd,_0x223b5b,_0x503f87){var _0x47800f=path['join'](config[_0x7ca3('0xba')],_0x7ca3('0xbb'));return db[_0x7ca3('0x66')][_0x7ca3('0x46')]({'where':{'id':_0x485abd[_0x7ca3('0x6b')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x7ca3('0x24')](handleEntityNotFound(_0x223b5b,null))[_0x7ca3('0x24')](function(_0x2faa8c){if(_0x2faa8c){if(_['isNil'](_0x2faa8c['userpic'])){return _0x223b5b[_0x7ca3('0xbc')](_0x47800f);}else{if(!fs[_0x7ca3('0xbd')](path['join'](config[_0x7ca3('0xba')],_0x7ca3('0xbe'),_0x2faa8c[_0x7ca3('0xbf')]))){return _0x223b5b['download'](_0x47800f);}return _0x223b5b[_0x7ca3('0xbc')](path[_0x7ca3('0xc0')](config[_0x7ca3('0xba')],_0x7ca3('0xbe'),_0x2faa8c[_0x7ca3('0xbf')]));}}})['catch'](handleError(_0x223b5b,null));};exports[_0x7ca3('0xc1')]=function(_0x573285,_0x221512,_0x29dc68){var _0x4e66c5={};var _0x5e15ef={};var _0x47b81e;var _0x245473;return db[_0x7ca3('0x66')][_0x7ca3('0x98')]({'where':{'id':_0x573285[_0x7ca3('0x6b')]['id']}})[_0x7ca3('0x24')](handleEntityNotFound(_0x221512,null))[_0x7ca3('0x24')](function(_0x5ee2dd){if(_0x5ee2dd){_0x47b81e=_0x5ee2dd;_0x5e15ef['model']=_['keys'](db[_0x7ca3('0xc2')][_0x7ca3('0x4c')]);_0x5e15ef['query']=_[_0x7ca3('0x55')](_0x573285[_0x7ca3('0x54')]);_0x5e15ef['filters']=_[_0x7ca3('0x57')](_0x5e15ef[_0x7ca3('0x50')],_0x5e15ef['query']);_0x4e66c5['attributes']=_[_0x7ca3('0x57')](_0x5e15ef[_0x7ca3('0x50')],qs[_0x7ca3('0x59')](_0x573285[_0x7ca3('0x54')][_0x7ca3('0x59')]));_0x4e66c5[_0x7ca3('0x58')]=_0x4e66c5[_0x7ca3('0x58')][_0x7ca3('0x6c')]?_0x4e66c5['attributes']:_0x5e15ef[_0x7ca3('0x50')];_0x4e66c5[_0x7ca3('0x5c')]=qs[_0x7ca3('0x5d')](_0x573285[_0x7ca3('0x54')]['sort']);_0x4e66c5[_0x7ca3('0x5e')]=qs[_0x7ca3('0x56')](_[_0x7ca3('0x5f')](_0x573285['query'],_0x5e15ef[_0x7ca3('0x56')]));if(_0x573285[_0x7ca3('0x54')][_0x7ca3('0x40')]){_0x4e66c5[_0x7ca3('0x5e')]=_[_0x7ca3('0x60')](_0x4e66c5['where'],{'$or':_['map'](_0x4e66c5['attributes'],function(_0x34e5c1){var _0x156f85={};_0x156f85[_0x34e5c1]={'$like':'%'+_0x573285['query']['filter']+'%'};return _0x156f85;})});}_0x4e66c5=_[_0x7ca3('0x60')]({},_0x4e66c5,_0x573285[_0x7ca3('0x65')]);return _0x47b81e[_0x7ca3('0xc1')](_0x4e66c5);}})[_0x7ca3('0x24')](function(_0x5c7e5c){if(_0x5c7e5c){_0x245473=_0x5c7e5c[_0x7ca3('0x6c')];if(_0x573285['query'][_0x7ca3('0x5a')](_0x7ca3('0x67'))){_0x4e66c5[_0x7ca3('0x68')]=[{'model':db[_0x7ca3('0xc3')],'as':'List','required':![]},{'model':db[_0x7ca3('0xc4')],'as':_0x7ca3('0xc5'),'attributes':['id','name',_0x7ca3('0xc6')],'where':_0x573285[_0x7ca3('0x54')]['tag']?{'id':_0x573285[_0x7ca3('0x54')]['tag']}:undefined,'required':_0x573285[_0x7ca3('0x54')]['tag']?!![]:![]}];}if(!_0x573285[_0x7ca3('0x54')][_0x7ca3('0x5a')]('nolimit')){_0x4e66c5[_0x7ca3('0x35')]=qs[_0x7ca3('0x35')](_0x573285['query'][_0x7ca3('0x35')]);_0x4e66c5[_0x7ca3('0x34')]=qs[_0x7ca3('0x34')](_0x573285['query'][_0x7ca3('0x34')]);}return _0x47b81e[_0x7ca3('0xc1')](_0x4e66c5);}})[_0x7ca3('0x24')](function(_0x15b423){if(_0x15b423){return _0x15b423?{'count':_0x245473,'rows':_0x15b423}:null;}})[_0x7ca3('0x24')](respondWithResult(_0x221512,null))['catch'](handleError(_0x221512,null));};exports[_0x7ca3('0xc7')]=function(_0x131caa,_0x331a14,_0x20a384){var _0xfae183;var _0x5ea358;var _0xc2b560={};var _0x4ddfc2;return db[_0x7ca3('0x66')][_0x7ca3('0x98')]({'where':{'id':_0x131caa[_0x7ca3('0x6b')]['id']},'attributes':['id','name',_0x7ca3('0x45')]})[_0x7ca3('0x24')](handleEntityNotFound(_0x331a14,null))[_0x7ca3('0x24')](function(_0x46b254){if(!utils[_0x7ca3('0xc8')](_0x131caa['query']['channel'])){throw new db[(_0x7ca3('0x20'))]['ValidationError'](_0x7ca3('0xa2'));}_0xfae183=_0x46b254;var _0x4ceb6e={};_0x4ceb6e[_0x7ca3('0x50')]=_[_0x7ca3('0x55')](db[_[_0x7ca3('0xa4')](_0x131caa[_0x7ca3('0x54')][_0x7ca3('0xb3')])+_0x7ca3('0xc9')]['rawAttributes']);_0x4ceb6e[_0x7ca3('0x54')]=_[_0x7ca3('0x55')](_0x131caa['query']);_0x4ceb6e[_0x7ca3('0x56')]=_[_0x7ca3('0x57')](_0x4ceb6e[_0x7ca3('0x50')],_0x4ceb6e[_0x7ca3('0x54')]);_0xc2b560['attributes']=_[_0x7ca3('0x57')](_0x4ceb6e[_0x7ca3('0x50')],qs['fields'](_0x131caa['query'][_0x7ca3('0x59')]));_0xc2b560[_0x7ca3('0x58')]=_0xc2b560[_0x7ca3('0x58')][_0x7ca3('0x6c')]?_0xc2b560['attributes']:_0x4ceb6e[_0x7ca3('0x50')];_0xc2b560[_0x7ca3('0x5c')]=qs[_0x7ca3('0x5d')](_0x131caa[_0x7ca3('0x54')][_0x7ca3('0x5d')]);_0xc2b560[_0x7ca3('0x5e')]=qs[_0x7ca3('0x56')](_[_0x7ca3('0x5f')](_0x131caa[_0x7ca3('0x54')],_0x4ceb6e['filters']));if(_0x131caa[_0x7ca3('0x54')][_0x7ca3('0x40')]){_0xc2b560[_0x7ca3('0x5e')]=_[_0x7ca3('0x60')](_0xc2b560[_0x7ca3('0x5e')],{'$or':_[_0x7ca3('0x42')](_0xc2b560[_0x7ca3('0x58')],function(_0x35316b){var _0x2df5c9={};_0x2df5c9[_0x35316b]={'$like':'%'+_0x131caa[_0x7ca3('0x54')][_0x7ca3('0x40')]+'%'};return _0x2df5c9;})});}_0xc2b560=_[_0x7ca3('0x60')]({},_0xc2b560,_0x131caa[_0x7ca3('0x65')]);switch(_0xfae183['role']){case'admin':return db[_[_0x7ca3('0xa4')](_0x131caa['query'][_0x7ca3('0xb3')])+_0x7ca3('0xc9')][_0x7ca3('0x69')](_0xc2b560);case'user':case _0x7ca3('0x3e'):return _0xfae183['get'+_[_0x7ca3('0xa4')](_0x131caa[_0x7ca3('0x54')][_0x7ca3('0xb3')])+_0x7ca3('0xb5')](_0xc2b560);default:throw new db[(_0x7ca3('0x20'))][(_0x7ca3('0x21'))]('Unknown\x20role');}})[_0x7ca3('0x24')](function(_0x266521){_0x4ddfc2=_0x266521[_0x7ca3('0x6c')];if(!_0x131caa[_0x7ca3('0x54')][_0x7ca3('0x5a')](_0x7ca3('0x5b'))){_0xc2b560[_0x7ca3('0x35')]=qs[_0x7ca3('0x35')](_0x131caa[_0x7ca3('0x54')][_0x7ca3('0x35')]);_0xc2b560[_0x7ca3('0x34')]=qs['offset'](_0x131caa[_0x7ca3('0x54')][_0x7ca3('0x34')]);}switch(_0xfae183[_0x7ca3('0x45')]){case'admin':return db[_['capitalize'](_0x131caa[_0x7ca3('0x54')]['channel'])+'Queue'][_0x7ca3('0x69')](_0xc2b560);case _0x7ca3('0x3c'):case _0x7ca3('0x3e'):return _0xfae183['get'+_['capitalize'](_0x131caa[_0x7ca3('0x54')][_0x7ca3('0xb3')])+_0x7ca3('0xb5')](_0xc2b560);}})[_0x7ca3('0x24')](function(_0x4ca089){return{'count':_0x4ddfc2,'rows':_0x4ca089};})['then'](respondWithResult(_0x331a14,null))[_0x7ca3('0x2f')](handleError(_0x331a14,null));};exports[_0x7ca3('0xca')]=function(_0x5a0834,_0x2dfb62,_0x3789d4){var _0xe70892={};var _0x5ed45f={};var _0x4e4236;var _0xecdde6;return db[_0x7ca3('0x66')][_0x7ca3('0x98')]({'where':{'id':_0x5a0834['params']['id']}})[_0x7ca3('0x24')](handleEntityNotFound(_0x2dfb62,null))[_0x7ca3('0x24')](function(_0x4ee88a){if(_0x4ee88a){_0x4e4236=_0x4ee88a;_0x5ed45f['model']=_[_0x7ca3('0x55')](db[_0x7ca3('0xb0')]['rawAttributes']);_0x5ed45f['query']=_[_0x7ca3('0x55')](_0x5a0834[_0x7ca3('0x54')]);_0x5ed45f[_0x7ca3('0x56')]=_[_0x7ca3('0x57')](_0x5ed45f[_0x7ca3('0x50')],_0x5ed45f['query']);_0xe70892[_0x7ca3('0x58')]=_[_0x7ca3('0x57')](_0x5ed45f[_0x7ca3('0x50')],qs[_0x7ca3('0x59')](_0x5a0834[_0x7ca3('0x54')]['fields']));_0xe70892[_0x7ca3('0x58')]=_0xe70892[_0x7ca3('0x58')][_0x7ca3('0x6c')]?_0xe70892[_0x7ca3('0x58')]:_0x5ed45f['model'];_0xe70892['order']=qs['sort'](_0x5a0834['query'][_0x7ca3('0x5d')]);_0xe70892[_0x7ca3('0x5e')]=qs[_0x7ca3('0x56')](_[_0x7ca3('0x5f')](_0x5a0834[_0x7ca3('0x54')],_0x5ed45f[_0x7ca3('0x56')]));if(_0x5a0834['query']['filter']){_0xe70892[_0x7ca3('0x5e')]=_[_0x7ca3('0x60')](_0xe70892[_0x7ca3('0x5e')],{'$or':_[_0x7ca3('0x42')](_0xe70892[_0x7ca3('0x58')],function(_0x1e8e3e){var _0x4089fe={};_0x4089fe[_0x1e8e3e]={'$like':'%'+_0x5a0834[_0x7ca3('0x54')][_0x7ca3('0x40')]+'%'};return _0x4089fe;})});}_0xe70892=_[_0x7ca3('0x60')]({},_0xe70892,_0x5a0834[_0x7ca3('0x65')]);return _0x4e4236['getVoiceQueuesRt'](_0xe70892);}})['then'](function(_0x118cb6){if(_0x118cb6){_0xecdde6=_0x118cb6[_0x7ca3('0x6c')];if(!_0x5a0834[_0x7ca3('0x54')][_0x7ca3('0x5a')](_0x7ca3('0x5b'))){_0xe70892[_0x7ca3('0x35')]=qs[_0x7ca3('0x35')](_0x5a0834[_0x7ca3('0x54')][_0x7ca3('0x35')]);_0xe70892['offset']=qs[_0x7ca3('0x34')](_0x5a0834['query'][_0x7ca3('0x34')]);}return _0x4e4236['getVoiceQueuesRt'](_0xe70892);}})[_0x7ca3('0x24')](function(_0x26dcd8){if(_0x26dcd8){return _0x26dcd8?{'count':_0xecdde6,'rows':_0x26dcd8}:null;}})[_0x7ca3('0x24')](respondWithResult(_0x2dfb62,null))[_0x7ca3('0x2f')](handleError(_0x2dfb62,null));};exports[_0x7ca3('0xcb')]=function(_0x21895f,_0x590f3f,_0x440906){var _0x3c313f={};var _0x59478a={};var _0x4a67c2;var _0x321efc;return db[_0x7ca3('0x66')][_0x7ca3('0x98')]({'where':{'id':_0x21895f['params']['id']}})[_0x7ca3('0x24')](handleEntityNotFound(_0x590f3f,null))[_0x7ca3('0x24')](function(_0x5f1ee5){if(_0x5f1ee5){_0x4a67c2=_0x5f1ee5;_0x59478a[_0x7ca3('0x50')]=_[_0x7ca3('0x55')](db[_0x7ca3('0xcc')][_0x7ca3('0x4c')]);_0x59478a[_0x7ca3('0x54')]=_[_0x7ca3('0x55')](_0x21895f['query']);_0x59478a[_0x7ca3('0x56')]=_[_0x7ca3('0x57')](_0x59478a[_0x7ca3('0x50')],_0x59478a[_0x7ca3('0x54')]);_0x3c313f[_0x7ca3('0x58')]=_[_0x7ca3('0x57')](_0x59478a['model'],qs[_0x7ca3('0x59')](_0x21895f[_0x7ca3('0x54')][_0x7ca3('0x59')]));_0x3c313f[_0x7ca3('0x58')]=_0x3c313f[_0x7ca3('0x58')][_0x7ca3('0x6c')]?_0x3c313f['attributes']:_0x59478a[_0x7ca3('0x50')];_0x3c313f[_0x7ca3('0x5c')]=qs[_0x7ca3('0x5d')](_0x21895f[_0x7ca3('0x54')][_0x7ca3('0x5d')]);_0x3c313f['where']=qs['filters'](_[_0x7ca3('0x5f')](_0x21895f[_0x7ca3('0x54')],_0x59478a[_0x7ca3('0x56')]));if(_0x21895f[_0x7ca3('0x54')]['filter']){_0x3c313f['where']=_['merge'](_0x3c313f['where'],{'$or':_[_0x7ca3('0x42')](_0x3c313f['attributes'],function(_0xb2ffc9){var _0x44450d={};_0x44450d[_0xb2ffc9]={'$like':'%'+_0x21895f['query']['filter']+'%'};return _0x44450d;})});}_0x3c313f=_['merge']({},_0x3c313f,_0x21895f[_0x7ca3('0x65')]);return _0x4a67c2[_0x7ca3('0xcb')](_0x3c313f);}})[_0x7ca3('0x24')](function(_0x53ac3a){if(_0x53ac3a){_0x321efc=_0x53ac3a['length'];if(!_0x21895f[_0x7ca3('0x54')][_0x7ca3('0x5a')](_0x7ca3('0x5b'))){_0x3c313f[_0x7ca3('0x35')]=qs[_0x7ca3('0x35')](_0x21895f[_0x7ca3('0x54')][_0x7ca3('0x35')]);_0x3c313f[_0x7ca3('0x34')]=qs[_0x7ca3('0x34')](_0x21895f['query'][_0x7ca3('0x34')]);}return _0x4a67c2[_0x7ca3('0xcb')](_0x3c313f);}})[_0x7ca3('0x24')](function(_0x3d953f){if(_0x3d953f){return _0x3d953f?{'count':_0x321efc,'rows':_0x3d953f}:null;}})['then'](respondWithResult(_0x590f3f,null))[_0x7ca3('0x2f')](handleError(_0x590f3f,null));};exports[_0x7ca3('0xcd')]=function(_0x32334f,_0x1f6962,_0x4c8c53){var _0x429b61={'raw':!![],'where':{}};var _0x111486={};var _0x3e41c3={'count':0x0,'rows':[]};return db['User'][_0x7ca3('0x98')]({'where':{'id':_0x32334f[_0x7ca3('0x6b')]['id']}})[_0x7ca3('0x24')](handleEntityNotFound(_0x1f6962,null))[_0x7ca3('0x24')](function(_0x127d10){if(_0x127d10){_0x111486[_0x7ca3('0x50')]=_[_0x7ca3('0x55')](db[_0x7ca3('0xce')][_0x7ca3('0x4c')]);_0x111486[_0x7ca3('0x54')]=_[_0x7ca3('0x55')](_0x32334f['query']);_0x111486[_0x7ca3('0x56')]=_[_0x7ca3('0x57')](_0x111486[_0x7ca3('0x50')],_0x111486[_0x7ca3('0x54')]);_0x429b61[_0x7ca3('0x58')]=_[_0x7ca3('0x57')](_0x111486[_0x7ca3('0x50')],qs['fields'](_0x32334f[_0x7ca3('0x54')]['fields']));_0x429b61['attributes']=_0x429b61[_0x7ca3('0x58')][_0x7ca3('0x6c')]?_0x429b61[_0x7ca3('0x58')]:_0x111486[_0x7ca3('0x50')];if(!_0x32334f[_0x7ca3('0x54')][_0x7ca3('0x5a')](_0x7ca3('0x5b'))){_0x429b61[_0x7ca3('0x35')]=qs[_0x7ca3('0x35')](_0x32334f[_0x7ca3('0x54')][_0x7ca3('0x35')]);_0x429b61[_0x7ca3('0x34')]=qs[_0x7ca3('0x34')](_0x32334f[_0x7ca3('0x54')][_0x7ca3('0x34')]);}_0x429b61['order']=qs[_0x7ca3('0x5d')](_0x32334f[_0x7ca3('0x54')]['sort']);_0x429b61[_0x7ca3('0x5e')]=qs[_0x7ca3('0x56')](_['pick'](_0x32334f['query'],_0x111486[_0x7ca3('0x56')]));_0x429b61[_0x7ca3('0x5e')][_0x7ca3('0xcf')]=_0x127d10['id'];if(_0x32334f[_0x7ca3('0x54')][_0x7ca3('0x40')]){_0x429b61[_0x7ca3('0x5e')]=_[_0x7ca3('0x60')](_0x429b61[_0x7ca3('0x5e')],{'$or':_[_0x7ca3('0x42')](_0x429b61[_0x7ca3('0x58')],function(_0x43ec7f){var _0x4c72b9={};_0x4c72b9[_0x43ec7f]={'$like':'%'+_0x32334f[_0x7ca3('0x54')][_0x7ca3('0x40')]+'%'};return _0x4c72b9;})});}_0x429b61=_[_0x7ca3('0x60')]({},_0x429b61,_0x32334f['options']);return db[_0x7ca3('0xce')][_0x7ca3('0x33')]({'where':_0x429b61[_0x7ca3('0x5e')]})[_0x7ca3('0x24')](function(_0x38ad16){_0x3e41c3[_0x7ca3('0x33')]=_0x38ad16;if(_0x32334f[_0x7ca3('0x54')][_0x7ca3('0x67')]){_0x429b61[_0x7ca3('0x68')]=[{'all':!![]}];}return db['VoiceRecording'][_0x7ca3('0x69')](_0x429b61);})[_0x7ca3('0x24')](function(_0x5247f1){_0x3e41c3[_0x7ca3('0x6a')]=_0x5247f1;return _0x3e41c3;});}})[_0x7ca3('0x24')](respondWithFilteredResult(_0x1f6962,_0x429b61))[_0x7ca3('0x2f')](handleError(_0x1f6962,null));};exports[_0x7ca3('0xd0')]=function(_0x79b33e,_0x42b993,_0x291583){var _0xef5415={'raw':!![],'where':{}};var _0x341331={};var _0x1f1906={'count':0x0,'rows':[]};return db[_0x7ca3('0x66')][_0x7ca3('0x98')]({'where':{'id':_0x79b33e['params']['id']}})[_0x7ca3('0x24')](handleEntityNotFound(_0x42b993,null))[_0x7ca3('0x24')](function(_0x14a2e0){if(_0x14a2e0){_0x341331[_0x7ca3('0x50')]=_[_0x7ca3('0x55')](db[_0x7ca3('0xd1')]['rawAttributes']);_0x341331[_0x7ca3('0x54')]=_[_0x7ca3('0x55')](_0x79b33e[_0x7ca3('0x54')]);_0x341331[_0x7ca3('0x56')]=_[_0x7ca3('0x57')](_0x341331['model'],_0x341331[_0x7ca3('0x54')]);_0xef5415['attributes']=_['intersection'](_0x341331[_0x7ca3('0x50')],qs['fields'](_0x79b33e[_0x7ca3('0x54')][_0x7ca3('0x59')]));_0xef5415[_0x7ca3('0x58')]=_0xef5415[_0x7ca3('0x58')][_0x7ca3('0x6c')]?_0xef5415[_0x7ca3('0x58')]:_0x341331[_0x7ca3('0x50')];if(!_0x79b33e[_0x7ca3('0x54')][_0x7ca3('0x5a')](_0x7ca3('0x5b'))){_0xef5415[_0x7ca3('0x35')]=qs[_0x7ca3('0x35')](_0x79b33e[_0x7ca3('0x54')][_0x7ca3('0x35')]);_0xef5415['offset']=qs['offset'](_0x79b33e[_0x7ca3('0x54')]['offset']);}_0xef5415[_0x7ca3('0x5c')]=qs['sort'](_0x79b33e[_0x7ca3('0x54')][_0x7ca3('0x5d')]);_0xef5415[_0x7ca3('0x5e')]=qs[_0x7ca3('0x56')](_[_0x7ca3('0x5f')](_0x79b33e[_0x7ca3('0x54')],_0x341331[_0x7ca3('0x56')]));_0xef5415[_0x7ca3('0x5e')]['UserId']=_0x14a2e0['id'];if(_0x79b33e[_0x7ca3('0x54')]['filter']){_0xef5415['where']=_['merge'](_0xef5415[_0x7ca3('0x5e')],{'$or':_[_0x7ca3('0x42')](_0xef5415[_0x7ca3('0x58')],function(_0x54aa14){var _0x2f28a2={};_0x2f28a2[_0x54aa14]={'$like':'%'+_0x79b33e[_0x7ca3('0x54')]['filter']+'%'};return _0x2f28a2;})});}_0xef5415=_['merge']({},_0xef5415,_0x79b33e[_0x7ca3('0x65')]);return db[_0x7ca3('0xd1')][_0x7ca3('0x33')]({'where':_0xef5415[_0x7ca3('0x5e')]})['then'](function(_0x40af54){_0x1f1906[_0x7ca3('0x33')]=_0x40af54;if(_0x79b33e['query'][_0x7ca3('0x67')]){_0xef5415['include']=[{'all':!![]}];}return db[_0x7ca3('0xd1')][_0x7ca3('0x69')](_0xef5415);})[_0x7ca3('0x24')](function(_0x279ccf){_0x1f1906[_0x7ca3('0x6a')]=_0x279ccf;return _0x1f1906;});}})[_0x7ca3('0x24')](respondWithFilteredResult(_0x42b993,_0xef5415))['catch'](handleError(_0x42b993,null));};exports[_0x7ca3('0xd2')]=function(_0x55240d,_0x2f236e,_0x2c9d13){var _0x330aa0={};var _0x11f8ce={};var _0x4ebfb0;var _0x5d7807;return db['User'][_0x7ca3('0x98')]({'where':{'id':_0x55240d[_0x7ca3('0x6b')]['id']}})[_0x7ca3('0x24')](handleEntityNotFound(_0x2f236e,null))[_0x7ca3('0x24')](function(_0x2a2dd1){if(_0x2a2dd1){_0x4ebfb0=_0x2a2dd1;_0x11f8ce['model']=_[_0x7ca3('0x55')](db[_0x7ca3('0xd3')][_0x7ca3('0x4c')]);_0x11f8ce[_0x7ca3('0x54')]=_[_0x7ca3('0x55')](_0x55240d[_0x7ca3('0x54')]);_0x11f8ce[_0x7ca3('0x56')]=_[_0x7ca3('0x57')](_0x11f8ce[_0x7ca3('0x50')],_0x11f8ce[_0x7ca3('0x54')]);_0x330aa0[_0x7ca3('0x58')]=_['intersection'](_0x11f8ce[_0x7ca3('0x50')],qs[_0x7ca3('0x59')](_0x55240d[_0x7ca3('0x54')][_0x7ca3('0x59')]));_0x330aa0[_0x7ca3('0x58')]=_0x330aa0[_0x7ca3('0x58')][_0x7ca3('0x6c')]?_0x330aa0[_0x7ca3('0x58')]:_0x11f8ce[_0x7ca3('0x50')];_0x330aa0[_0x7ca3('0x5c')]=qs[_0x7ca3('0x5d')](_0x55240d[_0x7ca3('0x54')][_0x7ca3('0x5d')]);_0x330aa0[_0x7ca3('0x5e')]=qs['filters'](_['pick'](_0x55240d[_0x7ca3('0x54')],_0x11f8ce[_0x7ca3('0x56')]));if(_0x55240d['query']['filter']){_0x330aa0[_0x7ca3('0x5e')]=_[_0x7ca3('0x60')](_0x330aa0[_0x7ca3('0x5e')],{'$or':_[_0x7ca3('0x42')](_0x330aa0[_0x7ca3('0x58')],function(_0x328aa0){var _0x3789b0={};_0x3789b0[_0x328aa0]={'$like':'%'+_0x55240d[_0x7ca3('0x54')][_0x7ca3('0x40')]+'%'};return _0x3789b0;})});}_0x330aa0=_['merge']({},_0x330aa0,_0x55240d['options']);return _0x4ebfb0[_0x7ca3('0xd2')](_0x330aa0);}})[_0x7ca3('0x24')](function(_0x37fddb){if(_0x37fddb){_0x5d7807=_0x37fddb[_0x7ca3('0x6c')];if(!_0x55240d[_0x7ca3('0x54')][_0x7ca3('0x5a')](_0x7ca3('0x5b'))){_0x330aa0[_0x7ca3('0x35')]=qs[_0x7ca3('0x35')](_0x55240d[_0x7ca3('0x54')][_0x7ca3('0x35')]);_0x330aa0['offset']=qs[_0x7ca3('0x34')](_0x55240d[_0x7ca3('0x54')][_0x7ca3('0x34')]);}return _0x4ebfb0[_0x7ca3('0xd2')](_0x330aa0);}})['then'](function(_0x1493fd){if(_0x1493fd){return _0x1493fd?{'count':_0x5d7807,'rows':_0x1493fd}:null;}})['then'](respondWithResult(_0x2f236e,null))['catch'](handleError(_0x2f236e,null));};exports[_0x7ca3('0xd4')]=function(_0x2a2f83,_0x50cfe0,_0x2b8799){var _0x2a3756={};var _0x587e12={};var _0x425cbb;var _0x3f84e1;return db[_0x7ca3('0x66')][_0x7ca3('0x98')]({'where':{'id':_0x2a2f83[_0x7ca3('0x6b')]['id']}})[_0x7ca3('0x24')](handleEntityNotFound(_0x50cfe0,null))[_0x7ca3('0x24')](function(_0x8d82b0){if(_0x8d82b0){_0x425cbb=_0x8d82b0;_0x587e12[_0x7ca3('0x50')]=_[_0x7ca3('0x55')](db[_0x7ca3('0xd5')][_0x7ca3('0x4c')]);_0x587e12[_0x7ca3('0x54')]=_[_0x7ca3('0x55')](_0x2a2f83[_0x7ca3('0x54')]);_0x587e12[_0x7ca3('0x56')]=_[_0x7ca3('0x57')](_0x587e12[_0x7ca3('0x50')],_0x587e12[_0x7ca3('0x54')]);_0x2a3756[_0x7ca3('0x58')]=_['intersection'](_0x587e12[_0x7ca3('0x50')],qs[_0x7ca3('0x59')](_0x2a2f83['query'][_0x7ca3('0x59')]));_0x2a3756[_0x7ca3('0x58')]=_0x2a3756['attributes'][_0x7ca3('0x6c')]?_0x2a3756[_0x7ca3('0x58')]:_0x587e12['model'];_0x2a3756[_0x7ca3('0x5c')]=qs[_0x7ca3('0x5d')](_0x2a2f83[_0x7ca3('0x54')][_0x7ca3('0x5d')]);_0x2a3756[_0x7ca3('0x5e')]=qs[_0x7ca3('0x56')](_['pick'](_0x2a2f83[_0x7ca3('0x54')],_0x587e12['filters']));if(_0x2a2f83[_0x7ca3('0x54')][_0x7ca3('0x40')]){_0x2a3756[_0x7ca3('0x5e')]=_[_0x7ca3('0x60')](_0x2a3756[_0x7ca3('0x5e')],{'$or':_[_0x7ca3('0x42')](_0x2a3756[_0x7ca3('0x58')],function(_0x36dd92){var _0xbedd4={};_0xbedd4[_0x36dd92]={'$like':'%'+_0x2a2f83[_0x7ca3('0x54')]['filter']+'%'};return _0xbedd4;})});}_0x2a3756=_[_0x7ca3('0x60')]({},_0x2a3756,_0x2a2f83[_0x7ca3('0x65')]);return _0x425cbb[_0x7ca3('0xd4')](_0x2a3756);}})[_0x7ca3('0x24')](function(_0x3a640b){if(_0x3a640b){_0x3f84e1=_0x3a640b[_0x7ca3('0x6c')];if(!_0x2a2f83[_0x7ca3('0x54')][_0x7ca3('0x5a')](_0x7ca3('0x5b'))){_0x2a3756[_0x7ca3('0x35')]=qs[_0x7ca3('0x35')](_0x2a2f83[_0x7ca3('0x54')]['limit']);_0x2a3756['offset']=qs[_0x7ca3('0x34')](_0x2a2f83[_0x7ca3('0x54')][_0x7ca3('0x34')]);}return _0x425cbb['getOpenchannelInteractions'](_0x2a3756);}})[_0x7ca3('0x24')](function(_0x441d4d){if(_0x441d4d){return _0x441d4d?{'count':_0x3f84e1,'rows':_0x441d4d}:null;}})[_0x7ca3('0x24')](respondWithResult(_0x50cfe0,null))['catch'](handleError(_0x50cfe0,null));};exports[_0x7ca3('0xd6')]=function(_0x4129b5,_0x307c58,_0x3dd488){var _0x27e10f={'raw':!![],'where':{}};var _0x223d7a={};var _0x16b37a={'count':0x0,'rows':[]};return db[_0x7ca3('0x66')][_0x7ca3('0x98')]({'where':{'id':_0x4129b5[_0x7ca3('0x6b')]['id']}})[_0x7ca3('0x24')](handleEntityNotFound(_0x307c58,null))['then'](function(_0x14e205){if(_0x14e205){_0x223d7a[_0x7ca3('0x50')]=_[_0x7ca3('0x55')](db[_0x7ca3('0xd7')][_0x7ca3('0x4c')]);_0x223d7a[_0x7ca3('0x54')]=_[_0x7ca3('0x55')](_0x4129b5[_0x7ca3('0x54')]);_0x223d7a[_0x7ca3('0x56')]=_[_0x7ca3('0x57')](_0x223d7a['model'],_0x223d7a['query']);_0x27e10f['attributes']=_['intersection'](_0x223d7a[_0x7ca3('0x50')],qs['fields'](_0x4129b5['query']['fields']));_0x27e10f['attributes']=_0x27e10f[_0x7ca3('0x58')][_0x7ca3('0x6c')]?_0x27e10f[_0x7ca3('0x58')]:_0x223d7a[_0x7ca3('0x50')];if(!_0x4129b5[_0x7ca3('0x54')][_0x7ca3('0x5a')](_0x7ca3('0x5b'))){_0x27e10f[_0x7ca3('0x35')]=qs[_0x7ca3('0x35')](_0x4129b5[_0x7ca3('0x54')][_0x7ca3('0x35')]);_0x27e10f['offset']=qs[_0x7ca3('0x34')](_0x4129b5[_0x7ca3('0x54')][_0x7ca3('0x34')]);}_0x27e10f[_0x7ca3('0x5c')]=qs[_0x7ca3('0x5d')](_0x4129b5[_0x7ca3('0x54')][_0x7ca3('0x5d')]);_0x27e10f['where']=qs[_0x7ca3('0x56')](_[_0x7ca3('0x5f')](_0x4129b5[_0x7ca3('0x54')],_0x223d7a[_0x7ca3('0x56')]));_0x27e10f['where']['UserId']=_0x14e205['id'];if(_0x4129b5[_0x7ca3('0x54')][_0x7ca3('0x40')]){_0x27e10f[_0x7ca3('0x5e')]=_[_0x7ca3('0x60')](_0x27e10f['where'],{'$or':_[_0x7ca3('0x42')](_0x27e10f[_0x7ca3('0x58')],function(_0x159bb3){var _0x1174b4={};_0x1174b4[_0x159bb3]={'$like':'%'+_0x4129b5[_0x7ca3('0x54')][_0x7ca3('0x40')]+'%'};return _0x1174b4;})});}_0x27e10f=_[_0x7ca3('0x60')]({},_0x27e10f,_0x4129b5[_0x7ca3('0x65')]);return db[_0x7ca3('0xd7')][_0x7ca3('0x33')]({'where':_0x27e10f['where']})[_0x7ca3('0x24')](function(_0x34ba72){_0x16b37a[_0x7ca3('0x33')]=_0x34ba72;if(_0x4129b5[_0x7ca3('0x54')][_0x7ca3('0x67')]){_0x27e10f[_0x7ca3('0x68')]=[{'all':!![]}];}return db[_0x7ca3('0xd7')]['findAll'](_0x27e10f);})['then'](function(_0x5ae62d){_0x16b37a[_0x7ca3('0x6a')]=_0x5ae62d;return _0x16b37a;});}})[_0x7ca3('0x24')](respondWithFilteredResult(_0x307c58,_0x27e10f))[_0x7ca3('0x2f')](handleError(_0x307c58,null));};exports[_0x7ca3('0xd8')]=function(_0x444e21,_0x1d52b5,_0x2d8ad7){var _0x2a4cf3={};var _0x53557f={};var _0x11e489;var _0x10537d;return db[_0x7ca3('0x66')][_0x7ca3('0x98')]({'where':{'id':_0x444e21[_0x7ca3('0x6b')]['id']}})[_0x7ca3('0x24')](handleEntityNotFound(_0x1d52b5,null))[_0x7ca3('0x24')](function(_0x1981d6){if(_0x1981d6){_0x11e489=_0x1981d6;_0x53557f[_0x7ca3('0x50')]=_[_0x7ca3('0x55')](db[_0x7ca3('0xd9')][_0x7ca3('0x4c')]);_0x53557f[_0x7ca3('0x54')]=_[_0x7ca3('0x55')](_0x444e21[_0x7ca3('0x54')]);_0x53557f[_0x7ca3('0x56')]=_[_0x7ca3('0x57')](_0x53557f['model'],_0x53557f[_0x7ca3('0x54')]);_0x2a4cf3[_0x7ca3('0x58')]=_[_0x7ca3('0x57')](_0x53557f[_0x7ca3('0x50')],qs['fields'](_0x444e21[_0x7ca3('0x54')][_0x7ca3('0x59')]));_0x2a4cf3[_0x7ca3('0x58')]=_0x2a4cf3[_0x7ca3('0x58')][_0x7ca3('0x6c')]?_0x2a4cf3[_0x7ca3('0x58')]:_0x53557f[_0x7ca3('0x50')];_0x2a4cf3[_0x7ca3('0x5c')]=qs['sort'](_0x444e21[_0x7ca3('0x54')][_0x7ca3('0x5d')]);_0x2a4cf3['where']=qs[_0x7ca3('0x56')](_[_0x7ca3('0x5f')](_0x444e21[_0x7ca3('0x54')],_0x53557f[_0x7ca3('0x56')]));if(_0x444e21[_0x7ca3('0x54')][_0x7ca3('0x40')]){_0x2a4cf3[_0x7ca3('0x5e')]=_[_0x7ca3('0x60')](_0x2a4cf3[_0x7ca3('0x5e')],{'$or':_[_0x7ca3('0x42')](_0x2a4cf3[_0x7ca3('0x58')],function(_0x35d04e){var _0x3ccd15={};_0x3ccd15[_0x35d04e]={'$like':'%'+_0x444e21[_0x7ca3('0x54')]['filter']+'%'};return _0x3ccd15;})});}_0x2a4cf3=_[_0x7ca3('0x60')]({},_0x2a4cf3,_0x444e21[_0x7ca3('0x65')]);return _0x11e489['getSmsInteractions'](_0x2a4cf3);}})[_0x7ca3('0x24')](function(_0xba6f74){if(_0xba6f74){_0x10537d=_0xba6f74[_0x7ca3('0x6c')];if(!_0x444e21[_0x7ca3('0x54')]['hasOwnProperty'](_0x7ca3('0x5b'))){_0x2a4cf3[_0x7ca3('0x35')]=qs[_0x7ca3('0x35')](_0x444e21[_0x7ca3('0x54')]['limit']);_0x2a4cf3[_0x7ca3('0x34')]=qs[_0x7ca3('0x34')](_0x444e21[_0x7ca3('0x54')][_0x7ca3('0x34')]);}return _0x11e489[_0x7ca3('0xd8')](_0x2a4cf3);}})[_0x7ca3('0x24')](function(_0x451185){if(_0x451185){return _0x451185?{'count':_0x10537d,'rows':_0x451185}:null;}})[_0x7ca3('0x24')](respondWithResult(_0x1d52b5,null))['catch'](handleError(_0x1d52b5,null));};exports[_0x7ca3('0xda')]=function(_0x1d7690,_0x246197,_0x4aea03){var _0x3a2101={};var _0x117909={};var _0x3c30bc;var _0x438da7;return db[_0x7ca3('0x66')]['findOne']({'where':{'id':_0x1d7690[_0x7ca3('0x6b')]['id']}})[_0x7ca3('0x24')](handleEntityNotFound(_0x246197,null))[_0x7ca3('0x24')](function(_0x4b24eb){if(_0x4b24eb){_0x3c30bc=_0x4b24eb;_0x117909[_0x7ca3('0x50')]=_[_0x7ca3('0x55')](db[_0x7ca3('0xdb')][_0x7ca3('0x4c')]);_0x117909[_0x7ca3('0x54')]=_[_0x7ca3('0x55')](_0x1d7690[_0x7ca3('0x54')]);_0x117909[_0x7ca3('0x56')]=_[_0x7ca3('0x57')](_0x117909['model'],_0x117909[_0x7ca3('0x54')]);_0x3a2101[_0x7ca3('0x58')]=_[_0x7ca3('0x57')](_0x117909[_0x7ca3('0x50')],qs[_0x7ca3('0x59')](_0x1d7690['query']['fields']));_0x3a2101[_0x7ca3('0x58')]=_0x3a2101[_0x7ca3('0x58')][_0x7ca3('0x6c')]?_0x3a2101[_0x7ca3('0x58')]:_0x117909[_0x7ca3('0x50')];_0x3a2101['order']=qs[_0x7ca3('0x5d')](_0x1d7690['query'][_0x7ca3('0x5d')]);_0x3a2101[_0x7ca3('0x5e')]=qs[_0x7ca3('0x56')](_['pick'](_0x1d7690[_0x7ca3('0x54')],_0x117909[_0x7ca3('0x56')]));if(_0x1d7690[_0x7ca3('0x54')]['filter']){_0x3a2101[_0x7ca3('0x5e')]=_[_0x7ca3('0x60')](_0x3a2101[_0x7ca3('0x5e')],{'$or':_[_0x7ca3('0x42')](_0x3a2101[_0x7ca3('0x58')],function(_0x49c2fe){var _0x263ed5={};_0x263ed5[_0x49c2fe]={'$like':'%'+_0x1d7690[_0x7ca3('0x54')][_0x7ca3('0x40')]+'%'};return _0x263ed5;})});}_0x3a2101=_[_0x7ca3('0x60')]({},_0x3a2101,_0x1d7690[_0x7ca3('0x65')]);return _0x3c30bc[_0x7ca3('0xda')](_0x3a2101);}})[_0x7ca3('0x24')](function(_0x493813){if(_0x493813){_0x438da7=_0x493813[_0x7ca3('0x6c')];if(!_0x1d7690['query'][_0x7ca3('0x5a')]('nolimit')){_0x3a2101[_0x7ca3('0x35')]=qs[_0x7ca3('0x35')](_0x1d7690[_0x7ca3('0x54')][_0x7ca3('0x35')]);_0x3a2101[_0x7ca3('0x34')]=qs['offset'](_0x1d7690[_0x7ca3('0x54')][_0x7ca3('0x34')]);}return _0x3c30bc[_0x7ca3('0xda')](_0x3a2101);}})[_0x7ca3('0x24')](function(_0x3679fe){if(_0x3679fe){return _0x3679fe?{'count':_0x438da7,'rows':_0x3679fe}:null;}})[_0x7ca3('0x24')](respondWithResult(_0x246197,null))[_0x7ca3('0x2f')](handleError(_0x246197,null));};exports[_0x7ca3('0xdc')]=function(_0x3aa883,_0x3d8caa,_0x2c6c4e){var _0x181149={};var _0x1cb69a={};var _0x1dcdee;var _0x3ccebe;return db[_0x7ca3('0x66')][_0x7ca3('0x98')]({'where':{'id':_0x3aa883[_0x7ca3('0x6b')]['id']}})[_0x7ca3('0x24')](handleEntityNotFound(_0x3d8caa,null))[_0x7ca3('0x24')](function(_0x1e3dfa){if(_0x1e3dfa){_0x1dcdee=_0x1e3dfa;_0x1cb69a[_0x7ca3('0x50')]=_['keys'](db['WhatsappInteraction'][_0x7ca3('0x4c')]);_0x1cb69a[_0x7ca3('0x54')]=_[_0x7ca3('0x55')](_0x3aa883[_0x7ca3('0x54')]);_0x1cb69a['filters']=_[_0x7ca3('0x57')](_0x1cb69a[_0x7ca3('0x50')],_0x1cb69a[_0x7ca3('0x54')]);_0x181149[_0x7ca3('0x58')]=_[_0x7ca3('0x57')](_0x1cb69a['model'],qs[_0x7ca3('0x59')](_0x3aa883[_0x7ca3('0x54')]['fields']));_0x181149[_0x7ca3('0x58')]=_0x181149['attributes'][_0x7ca3('0x6c')]?_0x181149['attributes']:_0x1cb69a[_0x7ca3('0x50')];_0x181149[_0x7ca3('0x5c')]=qs[_0x7ca3('0x5d')](_0x3aa883[_0x7ca3('0x54')][_0x7ca3('0x5d')]);_0x181149['where']=qs[_0x7ca3('0x56')](_[_0x7ca3('0x5f')](_0x3aa883[_0x7ca3('0x54')],_0x1cb69a[_0x7ca3('0x56')]));if(_0x3aa883[_0x7ca3('0x54')][_0x7ca3('0x40')]){_0x181149[_0x7ca3('0x5e')]=_[_0x7ca3('0x60')](_0x181149[_0x7ca3('0x5e')],{'$or':_[_0x7ca3('0x42')](_0x181149[_0x7ca3('0x58')],function(_0x3b6e38){var _0x1416cb={};_0x1416cb[_0x3b6e38]={'$like':'%'+_0x3aa883[_0x7ca3('0x54')][_0x7ca3('0x40')]+'%'};return _0x1416cb;})});}_0x181149=_[_0x7ca3('0x60')]({},_0x181149,_0x3aa883[_0x7ca3('0x65')]);return _0x1dcdee[_0x7ca3('0xdc')](_0x181149);}})[_0x7ca3('0x24')](function(_0x4a3dbd){if(_0x4a3dbd){_0x3ccebe=_0x4a3dbd[_0x7ca3('0x6c')];if(!_0x3aa883[_0x7ca3('0x54')][_0x7ca3('0x5a')](_0x7ca3('0x5b'))){_0x181149[_0x7ca3('0x35')]=qs[_0x7ca3('0x35')](_0x3aa883[_0x7ca3('0x54')]['limit']);_0x181149[_0x7ca3('0x34')]=qs[_0x7ca3('0x34')](_0x3aa883[_0x7ca3('0x54')][_0x7ca3('0x34')]);}return _0x1dcdee[_0x7ca3('0xdc')](_0x181149);}})['then'](function(_0x49a92){if(_0x49a92){return _0x49a92?{'count':_0x3ccebe,'rows':_0x49a92}:null;}})[_0x7ca3('0x24')](respondWithResult(_0x3d8caa,null))[_0x7ca3('0x2f')](handleError(_0x3d8caa,null));};exports[_0x7ca3('0xdd')]=function(_0x15c657,_0x3a893a,_0x297558){var _0x49731f;var _0x5cb79a;var _0xc1624f;var _0x345087=!_[_0x7ca3('0x7e')](_0x15c657[_0x7ca3('0x6b')]['id'])?_0x15c657[_0x7ca3('0x6b')]['id']:!_['isNil'](_0x15c657[_0x7ca3('0x3c')]['id'])?_0x15c657[_0x7ca3('0x3c')]['id']:null;return db[_0x7ca3('0x66')][_0x7ca3('0x46')]({'where':{'id':_0x345087,'role':{'$or':[_0x7ca3('0x73'),_0x7ca3('0x3c'),_0x7ca3('0x3e')]}},'attributes':['id',_0x7ca3('0x47'),_0x7ca3('0xde'),'mobile','role','internal',_0x7ca3('0xdf')]})[_0x7ca3('0x24')](function(_0x2fd489){if(_0x2fd489){if(_0x2fd489[_0x7ca3('0x45')]===_0x7ca3('0x3e')){_0x49731f=_0x2fd489;if(_0x15c657['body']['interface']){_0xc1624f=util[_0x7ca3('0x78')]('LOCAL/%s@from-sip/n',_0x49731f[_0x15c657['body'][_0x7ca3('0xae')]]);}else if(_0x15c657[_0x7ca3('0x6e')]['intrf']){_0xc1624f=util[_0x7ca3('0x78')](_0x7ca3('0xad'),_0x15c657[_0x7ca3('0x6e')]['intrf']);}else{_0xc1624f=util[_0x7ca3('0x78')](_0x7ca3('0xad'),_0x49731f['name']);}socket['to'](util[_0x7ca3('0x78')](_0x7ca3('0xe0'),_0x49731f['name']))['emit'](_0x7ca3('0xe1'),{'ip':_0x15c657[_0x7ca3('0xe2')]['x-forwarded-for']||_0x15c657[_0x7ca3('0xe3')][_0x7ca3('0xe4')]||_0x15c657[_0x7ca3('0xe5')]['remoteAddress']||_0x15c657[_0x7ca3('0xe3')]['socket']['remoteAddress']});return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x49731f[_0x7ca3('0x47')]},'individualHooks':!![]});}}else{throw new db[(_0x7ca3('0x20'))]['ValidationError'](_0x7ca3('0xe6'));}})['then'](function(){if(_0x49731f){return _0x49731f[_0x7ca3('0xe7')]({'raw':!![]});}})[_0x7ca3('0x24')](function(_0x26f80e){if(_0x49731f){var _0x337e6a=[];if(_0x26f80e){_0x5cb79a=_0x26f80e;if(_0x5cb79a[_0x7ca3('0x6c')]){for(var _0x1e8d87=0x0;_0x1e8d87<_0x5cb79a[_0x7ca3('0x6c')];_0x1e8d87++){_0x337e6a[_0x7ca3('0xac')]({'membername':_0x49731f[_0x7ca3('0x47')],'UserId':_0x49731f['id'],'queue_name':_0x5cb79a[_0x1e8d87]['name'],'VoiceQueueId':_0x5cb79a[_0x1e8d87]['id'],'interface':_0xc1624f,'paused':_0x49731f[_0x7ca3('0xdf')]||![],'penalty':_0x5cb79a[_0x1e8d87][_0x7ca3('0xe8')]||0x0});}return BPromise['each'](_0x337e6a,function(_0x9d97b9){return db[_0x7ca3('0xb0')][_0x7ca3('0xb1')](_0x9d97b9);});}}}})[_0x7ca3('0x24')](function(){if(_0x49731f){return db[_0x7ca3('0xe9')]['findAll']({'where':{'membername':_0x49731f[_0x7ca3('0x47')],'exitAt':null}});}})[_0x7ca3('0x24')](function(_0xbf9b19){if(_0x49731f){var _0x5a5dd6=[];_0xbf9b19['forEach'](function(_0x4e3db4){_0x5a5dd6[_0x7ca3('0xac')](_0x4e3db4[_0x7ca3('0x38')]({'exitAt':moment()[_0x7ca3('0x78')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x7ca3('0xea')](_0x5a5dd6);}})[_0x7ca3('0x24')](function(){if(_0x49731f){var _0x352014=[];var _0x5eae8c=[];var _0x567113=utils['getChannels']();var _0x2b2e9e={'membername':_0x49731f['name'],'interface':_0xc1624f,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x49731f[_0x7ca3('0x45')],'internal':_0x49731f[_0x7ca3('0x7a')]};_0x567113[_0x7ca3('0xeb')](function(_0x4ad4db){_0x352014[_0x7ca3('0xac')](_[_0x7ca3('0x60')]({'channel':_0x4ad4db,'type':_0x7ca3('0xec'),'data1':_0x15c657[_0x7ca3('0x6e')]['device'],'data2':_0xc1624f},_0x2b2e9e));if(_0x49731f[_0x7ca3('0xdf')]){_0x5eae8c[_0x7ca3('0xac')](_[_0x7ca3('0x60')]({'channel':_0x4ad4db,'type':'PAUSE','data1':_0x7ca3('0xed')},_0x2b2e9e));}});return db[_0x7ca3('0xe9')][_0x7ca3('0x6d')](_0x352014[_0x7ca3('0xee')](_0x5eae8c),{'individualHooks':!![]});}})['then'](function(){if(_0x49731f){return _0x49731f['update']({'online':!![],'lastLoginAt':moment()[_0x7ca3('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x49731f[_0x7ca3('0xdf')]||![],'mailPause':_0x49731f[_0x7ca3('0xdf')]||![],'chatPause':_0x49731f[_0x7ca3('0xdf')]||![],'faxPause':_0x49731f[_0x7ca3('0xdf')]||![],'smsPause':_0x49731f[_0x7ca3('0xdf')]||![],'openchannelPause':_0x49731f[_0x7ca3('0xdf')]||![],'whatsappPause':_0x49731f[_0x7ca3('0xdf')]||![],'pauseType':_0x49731f[_0x7ca3('0xdf')]?'LOGININPAUSE':null,'interface':_0xc1624f,'lastPauseAt':moment()[_0x7ca3('0x78')](_0x7ca3('0xef'))});}})[_0x7ca3('0x24')](function(_0x55a950){if(_0x15c657[_0x7ca3('0xf0')]){return _0x297558();}else{return BPromise[_0x7ca3('0xf1')](_0x55a950)['then'](respondWithResult(_0x3a893a,null));}})[_0x7ca3('0x2f')](handleError(_0x3a893a,null));};exports[_0x7ca3('0xf2')]=function(_0x54c4eb,_0x5a7367,_0x4b7ce6){var _0x584a2b;return db[_0x7ca3('0x66')][_0x7ca3('0x46')]({'where':{'id':_0x54c4eb['params']['id'],'role':_0x7ca3('0x3e')},'attributes':['id','name','role']})[_0x7ca3('0x24')](handleEntityNotFound(_0x5a7367,null))['then'](function(_0x529604){if(_0x529604){_0x584a2b=_0x529604;return db['UserVoiceQueueRt'][_0x7ca3('0x39')]({'where':{'membername':_0x584a2b[_0x7ca3('0x47')]},'individualHooks':!![]});}})[_0x7ca3('0x24')](function(){return db[_0x7ca3('0xe9')][_0x7ca3('0x69')]({'where':{'membername':_0x584a2b[_0x7ca3('0x47')],'exitAt':null}});})[_0x7ca3('0x24')](function(_0x21121e){var _0x12b515=[];_0x21121e[_0x7ca3('0xeb')](function(_0x1398d7){_0x12b515[_0x7ca3('0xac')](_0x1398d7[_0x7ca3('0x38')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x7ca3('0xea')](_0x12b515);})[_0x7ca3('0x24')](function(){return _0x584a2b[_0x7ca3('0x38')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x7ca3('0x24')](respondWithResult(_0x5a7367,null))['catch'](handleError(_0x5a7367,null));};exports[_0x7ca3('0xf3')]=function(_0x3708dd,_0x1c04a3,_0x158398){var _0x2475b3;return db['UserVoiceQueueRt'][_0x7ca3('0x38')]({'paused':0x1},{'where':{'UserId':_0x3708dd['params']['id']},'individualHooks':!![]})[_0x7ca3('0x24')](function(){return db[_0x7ca3('0x66')][_0x7ca3('0x46')]({'where':{'id':_0x3708dd[_0x7ca3('0x6b')]['id'],'role':_0x7ca3('0x3e')},'attributes':['id',_0x7ca3('0x47'),_0x7ca3('0x45'),_0x7ca3('0x7a'),'interface']});})[_0x7ca3('0x24')](handleEntityNotFound(_0x1c04a3,null))[_0x7ca3('0x24')](function(_0x5b2d55){if(_0x5b2d55){_0x2475b3=_0x5b2d55;return respondWithRpcPromise('QueuePause',_0x7ca3('0xf3'),{'id':_0x2475b3['id'],'name':_0x2475b3[_0x7ca3('0x47')],'pause':!![]});}})[_0x7ca3('0x24')](function(){if(_0x2475b3){return db[_0x7ca3('0xe9')][_0x7ca3('0x69')]({'where':{'membername':_0x2475b3['name'],'type':_0x7ca3('0xf4'),'exitAt':null}});}})[_0x7ca3('0x24')](function(_0x196ed4){if(_0x196ed4[_0x7ca3('0x6c')]){var _0x4b8565=moment()[_0x7ca3('0x78')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x9b8eeb=0x0,_0x3923c2=_0x196ed4[_0x7ca3('0x6c')];_0x9b8eeb<_0x3923c2;_0x9b8eeb++){_0x196ed4[_0x9b8eeb][_0x7ca3('0xf5')]({'exitAt':_0x4b8565});}}})['then'](function(){var _0x1e381a=[];var _0x1eb2ec=utils['getChannels']();_0x1eb2ec['forEach'](function(_0x4b59ea){_0x1e381a[_0x7ca3('0xac')]({'channel':_0x4b59ea,'membername':_0x2475b3[_0x7ca3('0x47')],'interface':_['isNil'](_0x2475b3[_0x7ca3('0xae')])?util[_0x7ca3('0x78')](_0x7ca3('0xad'),_0x2475b3['name']):_0x2475b3[_0x7ca3('0xae')],'type':'PAUSE','enterAt':moment()[_0x7ca3('0x78')](_0x7ca3('0xef')),'data1':_0x3708dd['body']['type']||_0x7ca3('0xf6'),'role':_0x2475b3[_0x7ca3('0x45')],'internal':_0x2475b3[_0x7ca3('0x7a')]});});return db['MemberReport'][_0x7ca3('0x6d')](_0x1e381a,{'individualHooks':!![]});})['then'](function(){return _0x2475b3[_0x7ca3('0x38')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x3708dd[_0x7ca3('0x6e')][_0x7ca3('0x4e')]||_0x7ca3('0xf6'),'lastPauseAt':moment()[_0x7ca3('0x78')](_0x7ca3('0xef'))});})[_0x7ca3('0x24')](respondWithResult(_0x1c04a3,null))['catch'](handleError(_0x1c04a3,null));};exports[_0x7ca3('0xf7')]=function(_0x2ddd30,_0x294319,_0x420bc3){var _0x11023d;return db[_0x7ca3('0x66')][_0x7ca3('0x46')]({'where':{'id':_0x2ddd30['params']['id']},'attributes':['id',_0x7ca3('0x47'),'role',_0x7ca3('0xf8'),_0x7ca3('0xf9'),_0x7ca3('0xfa'),'faxPause',_0x7ca3('0xfb'),'smsPause','whatsapppause',_0x7ca3('0xfc'),'lastPauseAt']})['then'](handleEntityNotFound(_0x294319,null))[_0x7ca3('0x24')](function(_0x38a8f6){if(_0x38a8f6){_0x11023d=_0x38a8f6;if(_0x2ddd30[_0x7ca3('0x6e')][_0x7ca3('0xb3')]&&!utils[_0x7ca3('0xc8')](_0x2ddd30[_0x7ca3('0x6e')][_0x7ca3('0xb3')])){throw new db[(_0x7ca3('0x20'))][(_0x7ca3('0x21'))](_0x7ca3('0xa2'));}switch(_0x2ddd30[_0x7ca3('0x6e')][_0x7ca3('0xb3')]){case'voice':return respondWithRpcPromise(_0x7ca3('0xfd'),_0x7ca3('0xf7'),{'id':_0x11023d['id'],'name':_0x11023d[_0x7ca3('0x47')],'pause':![]})[_0x7ca3('0x24')](function(){return db[_0x7ca3('0xb0')][_0x7ca3('0x38')]({'paused':0x0},{'where':{'UserId':_0x11023d['id']},'individualHooks':!![]});})[_0x7ca3('0x24')](function(){return db[_0x7ca3('0xe9')]['find']({'where':{'channel':_0x2ddd30['body']['channel'],'membername':_0x11023d['name'],'type':_0x7ca3('0xf4'),'exitAt':null}});})[_0x7ca3('0x24')](function(_0x307f31){if(_0x307f31){return _0x307f31[_0x7ca3('0x38')]({'exitAt':moment()[_0x7ca3('0x78')](_0x7ca3('0xef')),'data2':_0x7ca3('0xfe')},{'individualHooks':!![]});}return null;})[_0x7ca3('0x24')](function(){return _0x11023d[_0x7ca3('0x38')]({'voicePause':![]});});case _0x7ca3('0xff'):case _0x7ca3('0x100'):case'fax':case _0x7ca3('0x101'):case'whatsapp':case _0x7ca3('0x102'):return db[_0x7ca3('0xe9')][_0x7ca3('0x46')]({'where':{'channel':_0x2ddd30[_0x7ca3('0x6e')][_0x7ca3('0xb3')],'membername':_0x11023d[_0x7ca3('0x47')],'type':_0x7ca3('0xf4'),'exitAt':null}})[_0x7ca3('0x24')](function(_0x4c6ea9){if(_0x4c6ea9){return _0x4c6ea9['update']({'exitAt':moment()[_0x7ca3('0x78')](_0x7ca3('0xef')),'data2':_0x7ca3('0xfe')},{'individualHooks':!![]});}return null;})[_0x7ca3('0x24')](function(){var _0x54faaf={};_[_0x7ca3('0x36')](_0x54faaf,util[_0x7ca3('0x78')](_0x7ca3('0x103'),_0x2ddd30[_0x7ca3('0x6e')][_0x7ca3('0xb3')],_0x7ca3('0x104')),![]);return _0x11023d['update'](_0x54faaf);});default:return respondWithRpcPromise(_0x7ca3('0xfd'),_0x7ca3('0xf7'),{'id':_0x11023d['id'],'name':_0x11023d[_0x7ca3('0x47')],'pause':![]})[_0x7ca3('0x24')](function(){return db['UserVoiceQueueRt'][_0x7ca3('0x38')]({'paused':0x0},{'where':{'UserId':_0x11023d['id']}});})['then'](function(){return db[_0x7ca3('0xe9')]['findAll']({'where':{'membername':_0x11023d[_0x7ca3('0x47')],'type':_0x7ca3('0xf4'),'exitAt':null}});})['then'](function(_0x34e465){var _0xb80381=[];_0x34e465[_0x7ca3('0xeb')](function(_0x46a5a4){_0xb80381['push'](_0x46a5a4['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x7ca3('0xfe')}));});return BPromise[_0x7ca3('0xea')](_0xb80381);})[_0x7ca3('0x24')](function(){return _0x11023d[_0x7ca3('0x38')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x7ca3('0x24')](respondWithResult(_0x294319,null))[_0x7ca3('0x2f')](handleError(_0x294319,null));};exports[_0x7ca3('0x105')]=function(_0xe16b07,_0x5ef35c,_0x2bf999){var _0x456c94={};var _0x7c1e3f={};var _0x38cf95;var _0xee68e6;return db[_0x7ca3('0x66')]['findOne']({'where':{'id':_0xe16b07['params']['id']}})[_0x7ca3('0x24')](handleEntityNotFound(_0x5ef35c,null))[_0x7ca3('0x24')](function(_0x25e047){if(_0x25e047){_0x38cf95=_0x25e047;_0x7c1e3f[_0x7ca3('0x50')]=_[_0x7ca3('0x55')](db[_0x7ca3('0x106')][_0x7ca3('0x4c')]);_0x7c1e3f[_0x7ca3('0x54')]=_[_0x7ca3('0x55')](_0xe16b07[_0x7ca3('0x54')]);_0x7c1e3f[_0x7ca3('0x56')]=_[_0x7ca3('0x57')](_0x7c1e3f[_0x7ca3('0x50')],_0x7c1e3f['query']);_0x456c94[_0x7ca3('0x58')]=_[_0x7ca3('0x57')](_0x7c1e3f['model'],qs[_0x7ca3('0x59')](_0xe16b07[_0x7ca3('0x54')][_0x7ca3('0x59')]));_0x456c94['attributes']=_0x456c94[_0x7ca3('0x58')]['length']?_0x456c94[_0x7ca3('0x58')]:_0x7c1e3f['model'];_0x456c94[_0x7ca3('0x5c')]=qs[_0x7ca3('0x5d')](_0xe16b07[_0x7ca3('0x54')][_0x7ca3('0x5d')]);_0x456c94[_0x7ca3('0x5e')]=qs[_0x7ca3('0x56')](_[_0x7ca3('0x5f')](_0xe16b07[_0x7ca3('0x54')],_0x7c1e3f['filters']));if(_0xe16b07[_0x7ca3('0x54')]['filter']){_0x456c94['where']=_[_0x7ca3('0x60')](_0x456c94['where'],{'$or':_['map'](_0x456c94[_0x7ca3('0x58')],function(_0x52f77c){var _0x24a081={};_0x24a081[_0x52f77c]={'$like':'%'+_0xe16b07['query'][_0x7ca3('0x40')]+'%'};return _0x24a081;})});}_0x456c94=_[_0x7ca3('0x60')]({},_0x456c94,_0xe16b07[_0x7ca3('0x65')]);return _0x38cf95[_0x7ca3('0x105')](_0x456c94);}})[_0x7ca3('0x24')](function(_0x3cb222){if(_0x3cb222){_0xee68e6=_0x3cb222[_0x7ca3('0x6c')];if(!_0xe16b07[_0x7ca3('0x54')][_0x7ca3('0x5a')](_0x7ca3('0x5b'))){_0x456c94[_0x7ca3('0x35')]=qs[_0x7ca3('0x35')](_0xe16b07[_0x7ca3('0x54')]['limit']);_0x456c94['offset']=qs['offset'](_0xe16b07[_0x7ca3('0x54')][_0x7ca3('0x34')]);}return _0x38cf95[_0x7ca3('0x105')](_0x456c94);}})[_0x7ca3('0x24')](function(_0x1584bb){if(_0x1584bb){return _0x1584bb?{'count':_0xee68e6,'rows':_0x1584bb}:null;}})[_0x7ca3('0x24')](respondWithResult(_0x5ef35c,null))[_0x7ca3('0x2f')](handleError(_0x5ef35c,null));};exports[_0x7ca3('0x107')]=function(_0x1bd417,_0x571fe4){return db[_0x7ca3('0x66')][_0x7ca3('0x46')]({'where':{'id':_0x1bd417[_0x7ca3('0x6b')]['id']}})[_0x7ca3('0x24')](handleEntityNotFound(_0x571fe4,null))[_0x7ca3('0x24')](function(_0x8734ba){if(_0x8734ba){var _0x58dc18=_0x8734ba['get']({'plain':!![]});return _0x8734ba[_0x7ca3('0x107')](_0x1bd417[_0x7ca3('0x6e')]['ids'],_['omit'](_0x1bd417['body'],[_0x7ca3('0x72'),'id'])||{})['then'](function(){for(var _0x49ab3a=0x0;_0x49ab3a<_0x1bd417[_0x7ca3('0x6e')][_0x7ca3('0x72')][_0x7ca3('0x6c')];_0x49ab3a++){var _0x5b3cb6=[];db[_0x7ca3('0x106')][_0x7ca3('0x98')]({'where':{'id':_0x1bd417[_0x7ca3('0x6e')]['ids'][_0x49ab3a]}})['then'](function(_0x22bce8){_0x5b3cb6[_0x7ca3('0xac')](_0x22bce8[_0x7ca3('0xe7')]()[_0x7ca3('0x24')](function(_0x3800d9){for(var _0x45194a=0x0;_0x45194a<_0x3800d9[_0x7ca3('0x6c')];_0x45194a++){_0x3800d9[_0x45194a][_0x7ca3('0x108')]('channel',_0x7ca3('0x109'));}return _0x3800d9;}));_0x5b3cb6['push'](_0x22bce8[_0x7ca3('0x10a')]()[_0x7ca3('0x24')](function(_0x1f9d75){for(var _0x38a027=0x0;_0x38a027<_0x1f9d75[_0x7ca3('0x6c')];_0x38a027++){_0x1f9d75[_0x38a027][_0x7ca3('0x108')](_0x7ca3('0xb3'),_0x7ca3('0x10b'));}return _0x1f9d75;}));_0x5b3cb6['push'](_0x22bce8['getMailQueues']()[_0x7ca3('0x24')](function(_0x16ccb1){for(var _0x19dc05=0x0;_0x19dc05<_0x16ccb1[_0x7ca3('0x6c')];_0x19dc05++){_0x16ccb1[_0x19dc05][_0x7ca3('0x108')](_0x7ca3('0xb3'),'Mail');}return _0x16ccb1;}));_0x5b3cb6['push'](_0x22bce8[_0x7ca3('0x10c')]()[_0x7ca3('0x24')](function(_0x3fbdf8){for(var _0x4a2075=0x0;_0x4a2075<_0x3fbdf8[_0x7ca3('0x6c')];_0x4a2075++){_0x3fbdf8[_0x4a2075][_0x7ca3('0x108')](_0x7ca3('0xb3'),'Sms');}return _0x3fbdf8;}));_0x5b3cb6[_0x7ca3('0xac')](_0x22bce8['getWhatsappQueues']()[_0x7ca3('0x24')](function(_0x393d0b){for(var _0x4c5331=0x0;_0x4c5331<_0x393d0b['length'];_0x4c5331++){_0x393d0b[_0x4c5331][_0x7ca3('0x108')](_0x7ca3('0xb3'),_0x7ca3('0x10d'));}return _0x393d0b;}));_0x5b3cb6['push'](_0x22bce8[_0x7ca3('0x10e')]()['then'](function(_0x542530){for(var _0x2fb1b4=0x0;_0x2fb1b4<_0x542530['length'];_0x2fb1b4++){_0x542530[_0x2fb1b4]['setDataValue'](_0x7ca3('0xb3'),_0x7ca3('0x10f'));}return _0x542530;}));_0x5b3cb6[_0x7ca3('0xac')](_0x22bce8['getOpenchannelQueues']()[_0x7ca3('0x24')](function(_0x3cfcca){for(var _0x575182=0x0;_0x575182<_0x3cfcca['length'];_0x575182++){_0x3cfcca[_0x575182][_0x7ca3('0x108')]('channel','Openchannel');}return _0x3cfcca;}));return BPromise[_0x7ca3('0xea')](_0x5b3cb6);})[_0x7ca3('0x24')](function(_0x2e51a3){var _0x1a21ac=_[_0x7ca3('0x110')](_0x2e51a3);_0x5b3cb6=[];return db[_0x7ca3('0x63')][_0x7ca3('0x111')](function(_0x1296e3){for(var _0x4d0940=0x0;_0x4d0940<_0x1a21ac['length'];_0x4d0940++){_0x5b3cb6[_0x7ca3('0xac')](_0x1a21ac[_0x4d0940][_0x7ca3('0x112')](_0x58dc18['id']),{'transaction':_0x1296e3});}return BPromise[_0x7ca3('0xea')](_0x5b3cb6)[_0x7ca3('0x24')](function(){if(_0x58dc18[_0x7ca3('0xab')]){return BPromise[_0x7ca3('0xaf')](_['filter'](_0x1a21ac,function(_0x135939){return _0x135939[_0x7ca3('0x113')](_0x7ca3('0xb3'))==='Voice';}),function(_0x12bf30){return db['UserVoiceQueueRt'][_0x7ca3('0xb1')]({'membername':_0x58dc18[_0x7ca3('0x47')],'UserId':_0x58dc18['id'],'queue_name':_0x12bf30[_0x7ca3('0x47')],'VoiceQueueId':_0x12bf30['id'],'interface':_['isNil'](_0x58dc18[_0x7ca3('0xae')])?util[_0x7ca3('0x78')]('SIP/%s',_0x58dc18[_0x7ca3('0x47')]):_0x58dc18[_0x7ca3('0xae')],'paused':_0x58dc18['voicePause']||![],'penalty':_0x58dc18['penalty']},{'transaction':_0x1296e3});});}else{return;}})[_0x7ca3('0x24')](function(){for(var _0x44f1fe=0x0;_0x44f1fe<_0x1a21ac[_0x7ca3('0x6c')];_0x44f1fe++){var _0x1c0bdd=_0x1a21ac[_0x44f1fe][_0x7ca3('0x113')](_0x7ca3('0xb3'));var _0xbea935=_0x1c0bdd+'QueueId';socket[_0x7ca3('0xa8')](_0x7ca3('0x3c')+_0x1c0bdd+_0x7ca3('0xa9'),{'UserId':_0x58dc18['id'],['queueField']:_0x1a21ac[_0x44f1fe]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x571fe4,null))[_0x7ca3('0x2f')](handleError(_0x571fe4,null));};exports['removeTeams']=function(_0x4ad7a1,_0x1a4279){return db[_0x7ca3('0x66')][_0x7ca3('0x98')]({'where':{'id':_0x4ad7a1[_0x7ca3('0x6b')]['id']}})['then'](handleEntityNotFound(_0x1a4279,null))[_0x7ca3('0x24')](function(_0x49e020){if(_0x49e020){var _0x5862a4=_0x49e020[_0x7ca3('0x3a')]({'plain':!![]});var _0xccc77f=_0x4ad7a1[_0x7ca3('0x54')][_0x7ca3('0x72')];return _0x49e020['removeTeams'](_0xccc77f)[_0x7ca3('0x24')](function(){for(var _0x18df83=0x0;_0x18df83<_0xccc77f[_0x7ca3('0x6c')];_0x18df83++){var _0x5091a5=[];db[_0x7ca3('0x106')][_0x7ca3('0x98')]({'where':{'id':_0xccc77f[_0x18df83]}})[_0x7ca3('0x24')](function(_0x2d45f7){_0x5091a5[_0x7ca3('0xac')](_0x2d45f7['getVoiceQueues']()[_0x7ca3('0x24')](function(_0xce183f){for(var _0x961446=0x0;_0x961446<_0xce183f['length'];_0x961446++){_0xce183f[_0x961446][_0x7ca3('0x108')](_0x7ca3('0xb3'),'Voice');}return _0xce183f;}));_0x5091a5[_0x7ca3('0xac')](_0x2d45f7[_0x7ca3('0x10a')]()[_0x7ca3('0x24')](function(_0x188870){for(var _0x301883=0x0;_0x301883<_0x188870[_0x7ca3('0x6c')];_0x301883++){_0x188870[_0x301883][_0x7ca3('0x108')](_0x7ca3('0xb3'),_0x7ca3('0x10b'));}return _0x188870;}));_0x5091a5[_0x7ca3('0xac')](_0x2d45f7['getMailQueues']()[_0x7ca3('0x24')](function(_0x102281){for(var _0x496a5c=0x0;_0x496a5c<_0x102281[_0x7ca3('0x6c')];_0x496a5c++){_0x102281[_0x496a5c][_0x7ca3('0x108')](_0x7ca3('0xb3'),_0x7ca3('0x114'));}return _0x102281;}));_0x5091a5[_0x7ca3('0xac')](_0x2d45f7[_0x7ca3('0x10c')]()[_0x7ca3('0x24')](function(_0x22d70e){for(var _0x2a2cf3=0x0;_0x2a2cf3<_0x22d70e['length'];_0x2a2cf3++){_0x22d70e[_0x2a2cf3][_0x7ca3('0x108')]('channel',_0x7ca3('0x115'));}return _0x22d70e;}));_0x5091a5['push'](_0x2d45f7[_0x7ca3('0x116')]()[_0x7ca3('0x24')](function(_0x37a0ca){for(var _0x22954b=0x0;_0x22954b<_0x37a0ca[_0x7ca3('0x6c')];_0x22954b++){_0x37a0ca[_0x22954b][_0x7ca3('0x108')](_0x7ca3('0xb3'),_0x7ca3('0x10d'));}return _0x37a0ca;}));_0x5091a5[_0x7ca3('0xac')](_0x2d45f7[_0x7ca3('0x10e')]()[_0x7ca3('0x24')](function(_0x424bc9){for(var _0x5216f7=0x0;_0x5216f7<_0x424bc9['length'];_0x5216f7++){_0x424bc9[_0x5216f7][_0x7ca3('0x108')](_0x7ca3('0xb3'),_0x7ca3('0x10f'));}return _0x424bc9;}));_0x5091a5[_0x7ca3('0xac')](_0x2d45f7['getOpenchannelQueues']()[_0x7ca3('0x24')](function(_0x263766){for(var _0xd077a=0x0;_0xd077a<_0x263766[_0x7ca3('0x6c')];_0xd077a++){_0x263766[_0xd077a][_0x7ca3('0x108')](_0x7ca3('0xb3'),_0x7ca3('0x117'));}return _0x263766;}));return BPromise[_0x7ca3('0xea')](_0x5091a5);})[_0x7ca3('0x24')](function(_0x2dd556){var _0xf243d2=_[_0x7ca3('0x110')](_0x2dd556);_0x5091a5=[];return db[_0x7ca3('0x63')][_0x7ca3('0x111')](function(_0x1536d4){for(var _0x41433f=0x0;_0x41433f<_0xf243d2[_0x7ca3('0x6c')];_0x41433f++){_0x5091a5['push'](_0xf243d2[_0x41433f]['removeAgent'](_0x5862a4['id']),{'transaction':_0x1536d4});}return BPromise[_0x7ca3('0xea')](_0x5091a5)[_0x7ca3('0x24')](function(){if(_0x5862a4[_0x7ca3('0xab')]){return BPromise[_0x7ca3('0xaf')](_[_0x7ca3('0x40')](_0xf243d2,function(_0x280a14){return _0x280a14[_0x7ca3('0x113')]('channel')===_0x7ca3('0x109');}),function(_0x259df6){return db[_0x7ca3('0xb0')]['destroy']({'where':{'VoiceQueueId':_0x259df6['id'],'UserId':_0x5862a4['id']},'transaction':_0x1536d4});});}else{return;}})['then'](function(){for(var _0x178129=0x0;_0x178129<_0xf243d2[_0x7ca3('0x6c')];_0x178129++){var _0x90b151=_0xf243d2[_0x178129]['getDataValue']('channel');var _0x2ea69c=_0x90b151+'QueueId';socket[_0x7ca3('0xa8')]('user'+_0x90b151+_0x7ca3('0xb6'),{'UserId':_0x5862a4['id'],['queueField']:_0xf243d2[_0x178129]['id']});}});});});}});}})[_0x7ca3('0x24')](respondWithStatusCode(_0x1a4279,null))['catch'](handleError(_0x1a4279,null));};exports['getLists']=function(_0x21ec76,_0x1be9bc,_0x5c5163){var _0x31566e={};var _0x241560={};var _0x2a8780;var _0x6d7711;return db[_0x7ca3('0x66')][_0x7ca3('0x98')]({'where':{'id':_0x21ec76['params']['id']}})[_0x7ca3('0x24')](handleEntityNotFound(_0x1be9bc,null))[_0x7ca3('0x24')](function(_0x53c4c8){if(_0x53c4c8){_0x2a8780=_0x53c4c8;_0x241560[_0x7ca3('0x50')]=_[_0x7ca3('0x55')](db[_0x7ca3('0xc3')][_0x7ca3('0x4c')]);_0x241560['query']=_[_0x7ca3('0x55')](_0x21ec76[_0x7ca3('0x54')]);_0x241560[_0x7ca3('0x56')]=_['intersection'](_0x241560[_0x7ca3('0x50')],_0x241560[_0x7ca3('0x54')]);_0x31566e['attributes']=_[_0x7ca3('0x57')](_0x241560[_0x7ca3('0x50')],qs[_0x7ca3('0x59')](_0x21ec76[_0x7ca3('0x54')][_0x7ca3('0x59')]));_0x31566e[_0x7ca3('0x58')]=_0x31566e[_0x7ca3('0x58')][_0x7ca3('0x6c')]?_0x31566e[_0x7ca3('0x58')]:_0x241560[_0x7ca3('0x50')];_0x31566e['order']=qs[_0x7ca3('0x5d')](_0x21ec76['query'][_0x7ca3('0x5d')]);_0x31566e[_0x7ca3('0x5e')]=qs[_0x7ca3('0x56')](_[_0x7ca3('0x5f')](_0x21ec76['query'],_0x241560[_0x7ca3('0x56')]));if(_0x21ec76[_0x7ca3('0x54')][_0x7ca3('0x40')]){_0x31566e[_0x7ca3('0x5e')]=_[_0x7ca3('0x60')](_0x31566e['where'],{'$or':_[_0x7ca3('0x42')](_0x31566e[_0x7ca3('0x58')],function(_0x1ed144){var _0x411e2f={};_0x411e2f[_0x1ed144]={'$like':'%'+_0x21ec76[_0x7ca3('0x54')][_0x7ca3('0x40')]+'%'};return _0x411e2f;})});}_0x31566e=_[_0x7ca3('0x60')]({},_0x31566e,_0x21ec76[_0x7ca3('0x65')]);return _0x2a8780[_0x7ca3('0x118')](_0x31566e);}})['then'](function(_0x545467){if(_0x545467){_0x6d7711=_0x545467[_0x7ca3('0x6c')];if(!_0x21ec76['query'][_0x7ca3('0x5a')]('nolimit')){_0x31566e[_0x7ca3('0x35')]=qs[_0x7ca3('0x35')](_0x21ec76[_0x7ca3('0x54')][_0x7ca3('0x35')]);_0x31566e[_0x7ca3('0x34')]=qs[_0x7ca3('0x34')](_0x21ec76[_0x7ca3('0x54')][_0x7ca3('0x34')]);}return _0x2a8780[_0x7ca3('0x118')](_0x31566e);}})['then'](function(_0x40aa3b){if(_0x40aa3b){return _0x40aa3b?{'count':_0x6d7711,'rows':_0x40aa3b}:null;}})[_0x7ca3('0x24')](respondWithResult(_0x1be9bc,null))['catch'](handleError(_0x1be9bc,null));};exports[_0x7ca3('0x119')]=function(_0x1ff62d,_0x26b7d8,_0x2ee8b8){var _0x2f9ab0={};var _0x51a0f8={};var _0x4278d3;var _0x4b8abb;return db[_0x7ca3('0x66')][_0x7ca3('0x98')]({'where':{'id':_0x1ff62d[_0x7ca3('0x6b')]['id']}})[_0x7ca3('0x24')](handleEntityNotFound(_0x26b7d8,null))[_0x7ca3('0x24')](function(_0x27ffe9){if(_0x27ffe9){_0x4278d3=_0x27ffe9;_0x51a0f8[_0x7ca3('0x50')]=_[_0x7ca3('0x55')](db[_0x7ca3('0x66')]['rawAttributes']);_0x51a0f8[_0x7ca3('0x54')]=_[_0x7ca3('0x55')](_0x1ff62d[_0x7ca3('0x54')]);_0x51a0f8[_0x7ca3('0x56')]=_[_0x7ca3('0x57')](_0x51a0f8[_0x7ca3('0x50')],_0x51a0f8[_0x7ca3('0x54')]);_0x2f9ab0[_0x7ca3('0x58')]=_[_0x7ca3('0x57')](_0x51a0f8[_0x7ca3('0x50')],qs['fields'](_0x1ff62d[_0x7ca3('0x54')][_0x7ca3('0x59')]));_0x2f9ab0[_0x7ca3('0x58')]=_0x2f9ab0[_0x7ca3('0x58')][_0x7ca3('0x6c')]?_0x2f9ab0['attributes']:_0x51a0f8[_0x7ca3('0x50')];_0x2f9ab0[_0x7ca3('0x5c')]=qs[_0x7ca3('0x5d')](_0x1ff62d[_0x7ca3('0x54')][_0x7ca3('0x5d')]);_0x2f9ab0[_0x7ca3('0x5e')]=qs['filters'](_[_0x7ca3('0x5f')](_0x1ff62d[_0x7ca3('0x54')],_0x51a0f8['filters']));if(_0x1ff62d[_0x7ca3('0x54')][_0x7ca3('0x40')]){_0x2f9ab0['where']=_[_0x7ca3('0x60')](_0x2f9ab0[_0x7ca3('0x5e')],{'$or':_[_0x7ca3('0x42')](_0x2f9ab0[_0x7ca3('0x58')],function(_0x4dd316){var _0x5438c6={};_0x5438c6[_0x4dd316]={'$like':'%'+_0x1ff62d[_0x7ca3('0x54')][_0x7ca3('0x40')]+'%'};return _0x5438c6;})});}_0x2f9ab0[_0x7ca3('0x50')]=db[_0x7ca3('0x66')];_0x2f9ab0['as']=_0x7ca3('0x3d');_0x2f9ab0=_[_0x7ca3('0x60')]({},_0x2f9ab0,_0x1ff62d[_0x7ca3('0x65')]);return _0x4278d3[_0x7ca3('0xe7')]({'include':[_0x2f9ab0]});}})[_0x7ca3('0x24')](function(_0x413863){if(_0x413863){var _0x5d328b={},_0x41716c=[],_0x5598be=0x0;for(var _0x38a029=0x0;_0x38a029<_0x413863[_0x7ca3('0x6c')];_0x38a029+=0x1){for(var _0x22e8c3=0x0,_0x2c64b3;_0x22e8c3<_0x413863[_0x38a029]['Agents'][_0x7ca3('0x6c')];_0x22e8c3+=0x1){_0x2c64b3=_0x413863[_0x38a029][_0x7ca3('0x3d')][_0x22e8c3][_0x7ca3('0x3a')]({'plain':!![]});_0x5d328b[_0x2c64b3['id']]=_0x2c64b3;}}_0x5d328b=_['values'](_0x5d328b);for(var _0x5d5089=qs[_0x7ca3('0x34')](_0x1ff62d[_0x7ca3('0x54')][_0x7ca3('0x34')]);_0x5d5089<_0x5d328b[_0x7ca3('0x6c')]&&_0x41716c['length']=_0x54d83f['agents']){throw new Error(_0x5aa7('0x57'));}})[_0x5aa7('0x24')](function(){if(_0x141b6e){return db[_0x5aa7('0x29')][_0x5aa7('0x4d')]({'where':{'membername':_0x141b6e[_0x5aa7('0x26')]},'individualHooks':!![]});}})['then'](function(){if(_0x141b6e){return _0x141b6e[_0x5aa7('0x58')]({'raw':!![]});}})['then'](function(_0x17cb85){if(_0x141b6e){if(_0x17cb85){var _0x4e002d=[];_0x3d3384=_0x17cb85;if(_0x3d3384[_0x5aa7('0x2e')]){for(var _0x745e6d=0x0;_0x745e6d<_0x3d3384[_0x5aa7('0x2e')];_0x745e6d++){_0x4e002d[_0x5aa7('0x32')](db['UserVoiceQueueRt']['upsert']({'membername':_0x141b6e[_0x5aa7('0x26')],'UserId':_0x141b6e['id'],'queue_name':_0x3d3384[_0x745e6d][_0x5aa7('0x26')],'VoiceQueueId':_0x3d3384[_0x745e6d]['id'],'interface':_0x4dcc14,'paused':_0x141b6e[_0x5aa7('0x51')]||![],'penalty':_0x3d3384[_0x745e6d]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x5aa7('0x4b')](_0x4e002d);}}}})[_0x5aa7('0x24')](function(){if(_0x141b6e){return db[_0x5aa7('0x2b')][_0x5aa7('0x2c')]({'where':{'membername':_0x141b6e[_0x5aa7('0x26')],'exitAt':null}});}})[_0x5aa7('0x24')](function(_0x2d2e30){if(_0x141b6e){if(_0x2d2e30&&_0x2d2e30[_0x5aa7('0x2e')]){var _0x54008a=[];_0x2d2e30[_0x5aa7('0x4a')](function(_0x29c1d7){_0x54008a[_0x5aa7('0x32')](_0x29c1d7[_0x5aa7('0x2a')]({'exitAt':moment()[_0x5aa7('0x2f')](_0x5aa7('0x3b'))}));});return BPromise[_0x5aa7('0x4b')](_0x54008a);}}})[_0x5aa7('0x24')](function(_0x269a7b){if(_0x141b6e){var _0x277129=[];var _0x2cf417=[];var _0x27d5c4=utils[_0x5aa7('0x31')]();var _0x126207={'membername':_0x141b6e[_0x5aa7('0x26')],'interface':_0x4dcc14,'enterAt':moment()[_0x5aa7('0x2f')](_0x5aa7('0x3b')),'role':_0x141b6e['role'],'internal':_0x141b6e['internal']};_0x27d5c4[_0x5aa7('0x4a')](function(_0x3abf0f){_0x277129[_0x5aa7('0x32')](_[_0x5aa7('0x59')]({'channel':_0x3abf0f,'type':'LOGIN','data1':_0x5aa7('0x5a'),'data2':_0x4dcc14},_0x126207));if(_0x141b6e[_0x5aa7('0x51')]){_0x2cf417['push'](_[_0x5aa7('0x59')]({'channel':_0x3abf0f,'type':_0x5aa7('0x2d'),'data1':_0x5aa7('0x5b')},_0x126207));}});return db[_0x5aa7('0x2b')][_0x5aa7('0x3a')](_0x277129[_0x5aa7('0x5c')](_0x2cf417),{'individualHooks':!![]});}})['then'](function(){if(_0x141b6e){return _0x141b6e[_0x5aa7('0x2a')]({'online':!![],'lastLoginAt':moment()['format'](_0x5aa7('0x3b')),'voicePause':_0x141b6e[_0x5aa7('0x51')]||![],'mailPause':_0x141b6e[_0x5aa7('0x51')]||![],'chatPause':_0x141b6e[_0x5aa7('0x51')]||![],'faxPause':_0x141b6e[_0x5aa7('0x51')]||![],'smsPause':_0x141b6e[_0x5aa7('0x51')]||![],'openchannelPause':_0x141b6e['loginInPause']||![],'pauseType':_0x141b6e['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x4dcc14});}})[_0x5aa7('0x24')](function(_0x49bc96){_0x1497f7(_0x49bc96);})['catch'](function(_0x3bf825){_0x258f70(_0xa67413[_0x5aa7('0x13')](0x1f4,_0x3bf825[_0x5aa7('0x15')]));});});}; \ No newline at end of file +var _0x14e1=['merge','LOGIN','callysquare','LOGININPAUSE','concat','util','moment','bluebird','ioredis','../../config/utils','jayson/promise','defaults','redis','./user.socket','then','info','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','User,\x20%s,\x20%s','message','result','User','findAll','options','raw','where','limit','include','map','model','attributes','GetUser','catch','ShowUser','find','PauseUser','name','role','internal','interface','UserVoiceQueueRt','update','MemberReport','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','format','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','UnpauseUser','findOne','isValidChannel','channel','PAUSE','system','chat','fax','sms','openchannel','set','%s%s','Pause','all','mobile','phone','loginInPause','count','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','upsert','UserVoiceQueue.penalty'];(function(_0x26ec78,_0x516c4b){var _0x44019e=function(_0x1571a5){while(--_0x1571a5){_0x26ec78['push'](_0x26ec78['shift']());}};_0x44019e(++_0x516c4b);}(_0x14e1,0x1ae));var _0x114e=function(_0x6b06bb,_0x44c5c0){_0x6b06bb=_0x6b06bb-0x0;var _0x479f2f=_0x14e1[_0x6b06bb];return _0x479f2f;};'use strict';var _=require('lodash');var util=require(_0x114e('0x0'));var moment=require(_0x114e('0x1'));var BPromise=require(_0x114e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x114e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x114e('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x114e('0x5'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x114e('0x6')](config[_0x114e('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x114e('0x7')]));require(_0x114e('0x8'))['register'](socket);function respondWithRpcPromise(_0x31c97c,_0x292708,_0x363ae3){return new BPromise(function(_0x3dcbc7,_0x235835){return client['request'](_0x31c97c,_0x363ae3)[_0x114e('0x9')](function(_0x1aa852){logger[_0x114e('0xa')]('User,\x20%s,\x20%s',_0x292708,_0x114e('0xb'));logger[_0x114e('0xc')](_0x114e('0xd'),_0x292708,_0x114e('0xb'),JSON[_0x114e('0xe')](_0x1aa852));if(_0x1aa852[_0x114e('0xf')]){if(_0x1aa852[_0x114e('0xf')]['code']===0x1f4){logger[_0x114e('0xf')](_0x114e('0x10'),_0x292708,_0x1aa852[_0x114e('0xf')]['message']);return _0x235835(_0x1aa852[_0x114e('0xf')][_0x114e('0x11')]);}logger['error'](_0x114e('0x10'),_0x292708,_0x1aa852[_0x114e('0xf')][_0x114e('0x11')]);return _0x3dcbc7(_0x1aa852[_0x114e('0xf')][_0x114e('0x11')]);}else{logger[_0x114e('0xa')](_0x114e('0x10'),_0x292708,'request\x20sent');_0x3dcbc7(_0x1aa852[_0x114e('0x12')][_0x114e('0x11')]);}})['catch'](function(_0x2d28c8){logger[_0x114e('0xf')]('User,\x20%s,\x20%s',_0x292708,_0x2d28c8);_0x235835(_0x2d28c8);});});}exports['GetUser']=function(_0x489347){var _0x658385=this;return new Promise(function(_0x342eeb,_0x286442){return db[_0x114e('0x13')][_0x114e('0x14')]({'raw':_0x489347[_0x114e('0x15')]?_0x489347[_0x114e('0x15')][_0x114e('0x16')]===undefined?!![]:![]:!![],'where':_0x489347[_0x114e('0x15')]?_0x489347[_0x114e('0x15')][_0x114e('0x17')]||null:null,'attributes':_0x489347['options']?_0x489347[_0x114e('0x15')]['attributes']||null:null,'limit':_0x489347[_0x114e('0x15')]?_0x489347['options'][_0x114e('0x18')]||null:null,'include':_0x489347[_0x114e('0x15')]?_0x489347['options'][_0x114e('0x19')]?_[_0x114e('0x1a')](_0x489347[_0x114e('0x15')][_0x114e('0x19')],function(_0x1e881d){return{'model':db[_0x1e881d[_0x114e('0x1b')]],'as':_0x1e881d['as'],'attributes':_0x1e881d[_0x114e('0x1c')],'include':_0x1e881d[_0x114e('0x19')]?_['map'](_0x1e881d['include'],function(_0x4a025d){return{'model':db[_0x4a025d[_0x114e('0x1b')]],'as':_0x4a025d['as'],'attributes':_0x4a025d[_0x114e('0x1c')],'include':_0x4a025d[_0x114e('0x19')]?_['map'](_0x4a025d['include'],function(_0x3ccc9f){return{'model':db[_0x3ccc9f[_0x114e('0x1b')]],'as':_0x3ccc9f['as'],'attributes':_0x3ccc9f[_0x114e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a05a7){logger[_0x114e('0xa')](_0x114e('0x1d'),_0x489347);logger['debug']('GetUser',_0x489347,JSON['stringify'](_0x5a05a7));_0x342eeb(_0x5a05a7);})[_0x114e('0x1e')](function(_0x262470){logger[_0x114e('0xf')](_0x114e('0x1d'),_0x262470['message'],_0x489347);_0x286442(_0x658385[_0x114e('0xf')](0x1f4,_0x262470[_0x114e('0x11')]));});});};exports[_0x114e('0x1f')]=function(_0x48a280){var _0x227b71=this;return new Promise(function(_0x100093,_0x41d699){return db[_0x114e('0x13')][_0x114e('0x20')]({'raw':_0x48a280[_0x114e('0x15')]?_0x48a280['options'][_0x114e('0x16')]===undefined?!![]:![]:!![],'where':_0x48a280[_0x114e('0x15')]?_0x48a280[_0x114e('0x15')][_0x114e('0x17')]||null:null,'attributes':_0x48a280[_0x114e('0x15')]?_0x48a280[_0x114e('0x15')]['attributes']||null:null,'include':_0x48a280[_0x114e('0x15')]?_0x48a280[_0x114e('0x15')][_0x114e('0x19')]?_['map'](_0x48a280['options']['include'],function(_0x20e47c){return{'model':db[_0x20e47c['model']],'as':_0x20e47c['as'],'attributes':_0x20e47c['attributes'],'include':_0x20e47c[_0x114e('0x19')]?_[_0x114e('0x1a')](_0x20e47c['include'],function(_0x59dcdd){return{'model':db[_0x59dcdd[_0x114e('0x1b')]],'as':_0x59dcdd['as'],'attributes':_0x59dcdd['attributes'],'include':_0x59dcdd['include']?_['map'](_0x59dcdd[_0x114e('0x19')],function(_0x542ff4){return{'model':db[_0x542ff4[_0x114e('0x1b')]],'as':_0x542ff4['as'],'attributes':_0x542ff4[_0x114e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x114e('0x9')](function(_0x8bd6a4){logger[_0x114e('0xa')](_0x114e('0x1f'),_0x48a280);logger[_0x114e('0xc')](_0x114e('0x1f'),_0x48a280,JSON['stringify'](_0x8bd6a4));_0x100093(_0x8bd6a4);})[_0x114e('0x1e')](function(_0x36ed0f){logger['error'](_0x114e('0x1f'),_0x36ed0f[_0x114e('0x11')],_0x48a280);_0x41d699(_0x227b71[_0x114e('0xf')](0x1f4,_0x36ed0f[_0x114e('0x11')]));});});};exports[_0x114e('0x21')]=function(_0x41c959){var _0x4a47f8=this;return new Promise(function(_0x3d9847,_0x233e5c){var _0x7b537e;return db['User'][_0x114e('0x20')]({'where':_0x41c959['options']['where']||{},'attributes':['id',_0x114e('0x22'),_0x114e('0x23'),_0x114e('0x24'),_0x114e('0x25')]})['then'](function(_0x4f96c0){if(_0x4f96c0){_0x7b537e=_0x4f96c0;return db[_0x114e('0x26')][_0x114e('0x27')]({'paused':0x1},{'where':{'UserId':_0x7b537e['id']},'individualHooks':!![]});}})[_0x114e('0x9')](function(){if(_0x7b537e){return db[_0x114e('0x28')]['findAll']({'where':{'membername':_0x7b537e[_0x114e('0x22')],'type':'PAUSE','exitAt':null}});}})[_0x114e('0x9')](function(_0x480b59){if(_0x7b537e){if(_0x480b59&&_0x480b59[_0x114e('0x29')]){var _0x21a0da=moment()['format'](_0x114e('0x2a'));for(var _0xfffb9f=0x0,_0x47df34=_0x480b59[_0x114e('0x29')];_0xfffb9f<_0x47df34;_0xfffb9f++){_0x480b59[_0xfffb9f][_0x114e('0x2b')]({'exitAt':_0x21a0da});}}}})[_0x114e('0x9')](function(){if(_0x7b537e){var _0x3e6d02=[];var _0x22cb07=utils[_0x114e('0x2c')]();_0x22cb07[_0x114e('0x2d')](function(_0xf2bb42){_0x3e6d02[_0x114e('0x2e')]({'channel':_0xf2bb42,'membername':_0x7b537e['name'],'interface':_[_0x114e('0x2f')](_0x7b537e[_0x114e('0x25')])?util[_0x114e('0x30')](_0x114e('0x31'),_0x7b537e[_0x114e('0x22')]):_0x7b537e[_0x114e('0x25')],'type':'PAUSE','enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x41c959[_0x114e('0x32')][_0x114e('0x33')]||_0x114e('0x34'),'role':_0x7b537e['role'],'internal':_0x7b537e['internal'],'uniqueid':_0x41c959[_0x114e('0x32')][_0x114e('0x35')]||null});});return db[_0x114e('0x28')][_0x114e('0x36')](_0x3e6d02,{'individualHooks':!![]});}})[_0x114e('0x9')](function(){if(_0x7b537e){return _0x7b537e['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x41c959['body']['type']||_0x114e('0x34'),'lastPauseAt':moment()['format'](_0x114e('0x2a'))});}})[_0x114e('0x9')](function(_0x5f1755){_0x3d9847(_0x5f1755);})['catch'](function(_0x27a955){_0x233e5c(_0x4a47f8['error'](0x1f4,_0x27a955[_0x114e('0x11')]));});});};exports[_0x114e('0x37')]=function(_0x1e8fe7){var _0x438322=this;return new Promise(function(_0x4d3d11,_0x378269){var _0x2f40c7;return db[_0x114e('0x13')][_0x114e('0x38')]({'where':_0x1e8fe7[_0x114e('0x15')][_0x114e('0x17')]||{},'attributes':['id',_0x114e('0x22')]})[_0x114e('0x9')](function(_0x21bb61){if(_0x21bb61){_0x2f40c7=_0x21bb61;if(_0x1e8fe7[_0x114e('0x32')]['channel']&&!utils[_0x114e('0x39')](_0x1e8fe7[_0x114e('0x32')][_0x114e('0x3a')])){throw new Error('Unknown\x20channel');}switch(_0x1e8fe7[_0x114e('0x32')][_0x114e('0x3a')]){case'voice':return db[_0x114e('0x26')]['update']({'paused':0x0},{'where':{'UserId':_0x2f40c7['id']}})[_0x114e('0x9')](function(){return db[_0x114e('0x28')][_0x114e('0x20')]({'where':{'channel':_0x1e8fe7['body'][_0x114e('0x3a')],'membername':_0x2f40c7[_0x114e('0x22')],'type':_0x114e('0x3b'),'exitAt':null}});})[_0x114e('0x9')](function(_0x346aa1){if(_0x346aa1){return _0x346aa1[_0x114e('0x27')]({'exitAt':moment()['format'](_0x114e('0x2a')),'data2':_0x114e('0x3c')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x2f40c7[_0x114e('0x27')]({'voicePause':![]});});case'mail':case _0x114e('0x3d'):case _0x114e('0x3e'):case _0x114e('0x3f'):case _0x114e('0x40'):return db[_0x114e('0x28')][_0x114e('0x20')]({'where':{'channel':_0x1e8fe7[_0x114e('0x32')][_0x114e('0x3a')],'membername':_0x2f40c7['name'],'type':_0x114e('0x3b'),'exitAt':null}})[_0x114e('0x9')](function(_0x3098a2){return _0x3098a2['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x114e('0x3c')},{'individualHooks':!![]});})[_0x114e('0x9')](function(){var _0x1dfae9={};_[_0x114e('0x41')](_0x1dfae9,util[_0x114e('0x30')](_0x114e('0x42'),_0x1e8fe7[_0x114e('0x32')][_0x114e('0x3a')],_0x114e('0x43')),![]);return _0x2f40c7[_0x114e('0x27')](_0x1dfae9);});default:return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x2f40c7['id']}})[_0x114e('0x9')](function(){return db[_0x114e('0x28')][_0x114e('0x14')]({'where':{'membername':_0x2f40c7[_0x114e('0x22')],'type':'PAUSE','exitAt':null}});})['then'](function(_0xd6afd0){var _0x468f34=[];_0xd6afd0[_0x114e('0x2d')](function(_0x1cdd38){_0x468f34[_0x114e('0x2e')](_0x1cdd38[_0x114e('0x27')]({'exitAt':moment()[_0x114e('0x30')](_0x114e('0x2a')),'data2':_0x114e('0x3c')}));});return BPromise[_0x114e('0x44')](_0x468f34);})['then'](function(){return _0x2f40c7[_0x114e('0x27')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0x114e('0x9')](function(_0x464b35){_0x4d3d11(_0x464b35);})[_0x114e('0x1e')](function(_0x297575){_0x378269(_0x438322[_0x114e('0xf')](0x1f4,_0x297575['message']));});});};exports['LogoutUser']=function(_0x404810){var _0x18a955=this;return new Promise(function(_0x32da51,_0x47a5e9){var _0x489ecf;return db[_0x114e('0x13')][_0x114e('0x38')]({'where':_0x404810[_0x114e('0x15')][_0x114e('0x17')]||{},'attributes':['id','name']})[_0x114e('0x9')](function(_0x3b7ea5){if(_0x3b7ea5){_0x489ecf=_0x3b7ea5;return db[_0x114e('0x26')]['destroy']({'where':{'membername':_0x489ecf[_0x114e('0x22')]},'individualHooks':!![]});}})[_0x114e('0x9')](function(){if(_0x489ecf){return db[_0x114e('0x28')][_0x114e('0x14')]({'where':{'membername':_0x489ecf[_0x114e('0x22')],'exitAt':null}});}})[_0x114e('0x9')](function(_0x35760c){if(_0x489ecf){if(_0x35760c&&_0x35760c[_0x114e('0x29')]){var _0x362b5b=[];_0x35760c[_0x114e('0x2d')](function(_0x46ae1e){_0x362b5b['push'](_0x46ae1e[_0x114e('0x27')]({'exitAt':moment()[_0x114e('0x30')](_0x114e('0x2a'))}));});return BPromise[_0x114e('0x44')](_0x362b5b);}}})[_0x114e('0x9')](function(){if(_0x489ecf){return _0x489ecf['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x114e('0x9')](function(_0xd91ecd){_0x32da51(_0xd91ecd);})['catch'](function(_0x482ca){_0x47a5e9(_0x18a955['error'](0x1f4,_0x482ca[_0x114e('0x11')]));});});};exports['LoginUser']=function(_0x1f0569){var _0x33bb25=this;return new Promise(function(_0x248142,_0x5e58b9){var _0x5cd680;var _0x4c5224;var _0xeec3c4;var _0x4253f9;return db[_0x114e('0x13')][_0x114e('0x38')]({'where':_0x1f0569['options'][_0x114e('0x17')]||{},'attributes':['id',_0x114e('0x22'),_0x114e('0x23'),_0x114e('0x45'),_0x114e('0x46'),_0x114e('0x24'),_0x114e('0x47'),'interface']})[_0x114e('0x9')](function(_0x1a181e){if(_0x1a181e){_0x5cd680=_0x1a181e;_0x4253f9=_0x1f0569[_0x114e('0x32')][_0x114e('0x25')]?_0x1f0569[_0x114e('0x32')][_0x114e('0x25')]:util['format'](_0x114e('0x31'),_0x5cd680[_0x114e('0x22')]);return db['User'][_0x114e('0x48')]({'where':{'role':_0x114e('0x49'),'online':!![],'id':{'$ne':_0x5cd680['id']}}});}})[_0x114e('0x9')](function(_0x1c1e18){if(_0x1c1e18){_0xeec3c4=_0x1c1e18;return require('../../config/license/util')[_0x114e('0x4a')]();}})[_0x114e('0x9')](function(_0x31361c){if(_0x31361c&&_0x31361c[_0x114e('0x4b')]&&_0xeec3c4>=_0x31361c['agents']){throw new Error(_0x114e('0x4c'));}})['then'](function(){if(_0x5cd680){return db[_0x114e('0x26')][_0x114e('0x4d')]({'where':{'membername':_0x5cd680[_0x114e('0x22')]},'individualHooks':!![]});}})[_0x114e('0x9')](function(){if(_0x5cd680){return _0x5cd680['getVoiceQueues']({'raw':!![]});}})[_0x114e('0x9')](function(_0xf62d8f){if(_0x5cd680){if(_0xf62d8f){var _0x12d5c2=[];_0x4c5224=_0xf62d8f;if(_0x4c5224[_0x114e('0x29')]){for(var _0x36534b=0x0;_0x36534b<_0x4c5224[_0x114e('0x29')];_0x36534b++){_0x12d5c2[_0x114e('0x2e')](db['UserVoiceQueueRt'][_0x114e('0x4e')]({'membername':_0x5cd680[_0x114e('0x22')],'UserId':_0x5cd680['id'],'queue_name':_0x4c5224[_0x36534b][_0x114e('0x22')],'VoiceQueueId':_0x4c5224[_0x36534b]['id'],'interface':_0x4253f9,'paused':_0x5cd680[_0x114e('0x47')]||![],'penalty':_0x4c5224[_0x36534b][_0x114e('0x4f')]||0x0}));}return BPromise['all'](_0x12d5c2);}}}})[_0x114e('0x9')](function(){if(_0x5cd680){return db[_0x114e('0x28')][_0x114e('0x14')]({'where':{'membername':_0x5cd680[_0x114e('0x22')],'exitAt':null}});}})['then'](function(_0x30ccf7){if(_0x5cd680){if(_0x30ccf7&&_0x30ccf7[_0x114e('0x29')]){var _0x30d917=[];_0x30ccf7[_0x114e('0x2d')](function(_0x220600){_0x30d917[_0x114e('0x2e')](_0x220600['update']({'exitAt':moment()['format'](_0x114e('0x2a'))}));});return BPromise[_0x114e('0x44')](_0x30d917);}}})[_0x114e('0x9')](function(_0x3c7afb){if(_0x5cd680){var _0x17cdb8=[];var _0x391a24=[];var _0x70bf39=utils[_0x114e('0x2c')]();var _0xd9d34f={'membername':_0x5cd680[_0x114e('0x22')],'interface':_0x4253f9,'enterAt':moment()[_0x114e('0x30')](_0x114e('0x2a')),'role':_0x5cd680['role'],'internal':_0x5cd680[_0x114e('0x24')]};_0x70bf39[_0x114e('0x2d')](function(_0x21d2fc){_0x17cdb8[_0x114e('0x2e')](_[_0x114e('0x50')]({'channel':_0x21d2fc,'type':_0x114e('0x51'),'data1':_0x114e('0x52'),'data2':_0x4253f9},_0xd9d34f));if(_0x5cd680[_0x114e('0x47')]){_0x391a24[_0x114e('0x2e')](_[_0x114e('0x50')]({'channel':_0x21d2fc,'type':'PAUSE','data1':_0x114e('0x53')},_0xd9d34f));}});return db['MemberReport'][_0x114e('0x36')](_0x17cdb8[_0x114e('0x54')](_0x391a24),{'individualHooks':!![]});}})['then'](function(){if(_0x5cd680){return _0x5cd680[_0x114e('0x27')]({'online':!![],'lastLoginAt':moment()[_0x114e('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x5cd680[_0x114e('0x47')]||![],'mailPause':_0x5cd680[_0x114e('0x47')]||![],'chatPause':_0x5cd680[_0x114e('0x47')]||![],'faxPause':_0x5cd680[_0x114e('0x47')]||![],'smsPause':_0x5cd680[_0x114e('0x47')]||![],'openchannelPause':_0x5cd680[_0x114e('0x47')]||![],'pauseType':_0x5cd680['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x114e('0x30')](_0x114e('0x2a')),'interface':_0x4253f9});}})['then'](function(_0x322f32){_0x248142(_0x322f32);})['catch'](function(_0x354ddf){_0x5e58b9(_0x33bb25[_0x114e('0xf')](0x1f4,_0x354ddf[_0x114e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 4228649..a17a1f5 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 _0x95c4=['remove','removeListener','length','./user.events','save'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x95c4,0x1ca));var _0x495c=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x95c4[_0x4e9d3c];return _0x2d0825;};'use strict';var UserEvents=require(_0x495c('0x0'));var events=[_0x495c('0x1'),_0x495c('0x2'),'update'];function createListener(_0x19a6cc,_0xa98668){return function(_0x3eee13){_0xa98668['emit'](_0x19a6cc,_0x3eee13);};}function removeListener(_0x1ac8ae,_0x116fcc){return function(){UserEvents[_0x495c('0x3')](_0x1ac8ae,_0x116fcc);};}exports['register']=function(_0x50fdb2){for(var _0x21d92f=0x0,_0x1ffdd9=events[_0x495c('0x4')];_0x21d92f<_0x1ffdd9;_0x21d92f++){var _0x3a1384=events[_0x21d92f];var _0x20b68c=createListener('user:'+_0x3a1384,_0x50fdb2);UserEvents['on'](_0x3a1384,_0x20b68c);}}; \ No newline at end of file +var _0xd875=['user:','./user.events','remove','update','emit','length'];(function(_0x59f5a2,_0x1a15eb){var _0x1038a8=function(_0x5b70){while(--_0x5b70){_0x59f5a2['push'](_0x59f5a2['shift']());}};_0x1038a8(++_0x1a15eb);}(_0xd875,0x115));var _0x5d87=function(_0x4f2654,_0xddb1ad){_0x4f2654=_0x4f2654-0x0;var _0x3858b6=_0xd875[_0x4f2654];return _0x3858b6;};'use strict';var UserEvents=require(_0x5d87('0x0'));var events=['save',_0x5d87('0x1'),_0x5d87('0x2')];function createListener(_0x4dcb6f,_0x4a49ac){return function(_0x4afbec){_0x4a49ac[_0x5d87('0x3')](_0x4dcb6f,_0x4afbec);};}function removeListener(_0x14d507,_0x36d7fd){return function(){UserEvents['removeListener'](_0x14d507,_0x36d7fd);};}exports['register']=function(_0x2a428f){for(var _0x2281ea=0x0,_0x503cf8=events[_0x5d87('0x4')];_0x2281ea<_0x503cf8;_0x2281ea++){var _0x3a3670=events[_0x2281ea];var _0x28b7ed=createListener(_0x5d87('0x5')+_0x3a3670,_0x2a428f);UserEvents['on'](_0x3a3670,_0x28b7ed);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 70e0311..2d435b4 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 _0x9923=['../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0xe1b96a,_0x5d155d){var _0x4cf6b3=function(_0x25fbfb){while(--_0x25fbfb){_0xe1b96a['push'](_0xe1b96a['shift']());}};_0x4cf6b3(++_0x5d155d);}(_0x9923,0x1a9));var _0x3992=function(_0x314115,_0x22f606){_0x314115=_0x314115-0x0;var _0x1347df=_0x9923[_0x314115];return _0x1347df;};'use strict';var multer=require(_0x3992('0x0'));var util=require(_0x3992('0x1'));var path=require(_0x3992('0x2'));var timeout=require(_0x3992('0x3'));var express=require(_0x3992('0x4'));var router=express[_0x3992('0x5')]();var auth=require(_0x3992('0x6'));var interaction=require(_0x3992('0x7'));var config=require(_0x3992('0x8'));module['exports']=router; \ No newline at end of file +var _0xd08e=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x3f1142,_0x57733b){var _0x4a28fe=function(_0x3c91b2){while(--_0x3c91b2){_0x3f1142['push'](_0x3f1142['shift']());}};_0x4a28fe(++_0x57733b);}(_0xd08e,0x120));var _0xed08=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd08e[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xed08('0x0'));var util=require(_0xed08('0x1'));var path=require(_0xed08('0x2'));var timeout=require(_0xed08('0x3'));var express=require(_0xed08('0x4'));var router=express[_0xed08('0x5')]();var auth=require(_0xed08('0x6'));var interaction=require(_0xed08('0x7'));var config=require(_0xed08('0x8'));module[_0xed08('0x9')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 6971152..503134a 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x3cdd31,_0x353422){var _0x5f3b7c=function(_0x3a6235){while(--_0x3a6235){_0x3cdd31['push'](_0x3cdd31['shift']());}};_0x5f3b7c(++_0x353422);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x1832a0,_0x4ac21c){var _0x4fed96=function(_0x4df10b){while(--_0x4df10b){_0x1832a0['push'](_0x1832a0['shift']());}};_0x4fed96(++_0x4ac21c);}(_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/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 7eccdf6..d9791ed 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 _0xeda8=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','UserChatQueue','lodash'];(function(_0xb2b102,_0x158925){var _0x20f6b2=function(_0x4fa720){while(--_0x4fa720){_0xb2b102['push'](_0xb2b102['shift']());}};_0x20f6b2(++_0x158925);}(_0xeda8,0xaf));var _0x8eda=function(_0x1a1fcc,_0x32d090){_0x1a1fcc=_0x1a1fcc-0x0;var _0x2f5ff9=_0xeda8[_0x1a1fcc];return _0x2f5ff9;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var logger=require(_0x8eda('0x2'))('api');var moment=require(_0x8eda('0x3'));var BPromise=require(_0x8eda('0x4'));var rp=require(_0x8eda('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8eda('0x6'));var config=require(_0x8eda('0x7'));var attributes=require('./userChatQueue.attributes');module[_0x8eda('0x8')]=function(_0x55098f,_0x14f30b){return _0x55098f[_0x8eda('0x9')](_0x8eda('0xa'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac2f=['request-promise','path','rimraf','exports','define','user_has_chat_queues','lodash','../../config/logger','api','moment'];(function(_0x5954d2,_0x15db93){var _0x316928=function(_0x278bd3){while(--_0x278bd3){_0x5954d2['push'](_0x5954d2['shift']());}};_0x316928(++_0x15db93);}(_0xac2f,0xc4));var _0xfac2=function(_0x2aadbe,_0x4a43e8){_0x2aadbe=_0x2aadbe-0x0;var _0x2a9be6=_0xac2f[_0x2aadbe];return _0x2a9be6;};'use strict';var _=require(_0xfac2('0x0'));var util=require('util');var logger=require(_0xfac2('0x1'))(_0xfac2('0x2'));var moment=require(_0xfac2('0x3'));var BPromise=require('bluebird');var rp=require(_0xfac2('0x4'));var fs=require('fs');var path=require(_0xfac2('0x5'));var rimraf=require(_0xfac2('0x6'));var config=require('../../config/environment');var attributes=require('./userChatQueue.attributes');module[_0xfac2('0x7')]=function(_0x454100,_0x49d1a2){return _0x454100[_0xfac2('0x8')]('UserChatQueue',attributes,{'tableName':_0xfac2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 6efae64..adae7d9 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 _0xabcb=['../../config/logger','rpc','../../config/environment','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment','randomstring','../../mysqldb'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xabcb,0xba));var _0xbabc=function(_0x459376,_0xc3e439){_0x459376=_0x459376-0x0;var _0x589d16=_0xabcb[_0x459376];return _0x589d16;};'use strict';var _=require('lodash');var util=require(_0xbabc('0x0'));var moment=require(_0xbabc('0x1'));var BPromise=require('bluebird');var rs=require(_0xbabc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbabc('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbabc('0x4'))(_0xbabc('0x5'));var config=require(_0xbabc('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbabc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x32cfbf,_0x254881,_0x1f81e9){return new BPromise(function(_0x1a6bc4,_0x9706f3){return client[_0xbabc('0x8')](_0x32cfbf,_0x1f81e9)[_0xbabc('0x9')](function(_0x5be235){logger['info'](_0xbabc('0xa'),_0x254881,_0xbabc('0xb'));logger[_0xbabc('0xc')](_0xbabc('0xd'),_0x254881,_0xbabc('0xb'),JSON[_0xbabc('0xe')](_0x5be235));if(_0x5be235[_0xbabc('0xf')]){if(_0x5be235[_0xbabc('0xf')]['code']===0x1f4){logger['error'](_0xbabc('0xa'),_0x254881,_0x5be235[_0xbabc('0xf')][_0xbabc('0x10')]);return _0x9706f3(_0x5be235[_0xbabc('0xf')][_0xbabc('0x10')]);}logger[_0xbabc('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x254881,_0x5be235['error'][_0xbabc('0x10')]);return _0x1a6bc4(_0x5be235[_0xbabc('0xf')][_0xbabc('0x10')]);}else{logger[_0xbabc('0x11')](_0xbabc('0xa'),_0x254881,'request\x20sent');_0x1a6bc4(_0x5be235[_0xbabc('0x12')][_0xbabc('0x10')]);}})['catch'](function(_0x35f568){logger[_0xbabc('0xf')](_0xbabc('0xa'),_0x254881,_0x35f568);_0x9706f3(_0x35f568);});});} \ No newline at end of file +var _0x5594=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','then','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','info'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x5594,0x8c));var _0x4559=function(_0x54bb5e,_0x95b2e0){_0x54bb5e=_0x54bb5e-0x0;var _0x2f115c=_0x5594[_0x54bb5e];return _0x2f115c;};'use strict';var _=require(_0x4559('0x0'));var util=require(_0x4559('0x1'));var moment=require(_0x4559('0x2'));var BPromise=require(_0x4559('0x3'));var rs=require(_0x4559('0x4'));var fs=require('fs');var Redis=require(_0x4559('0x5'));var db=require(_0x4559('0x6'))['db'];var utils=require(_0x4559('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4559('0x8'));var client=jayson['client'][_0x4559('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf3caf7,_0x5eab7a,_0x474fa3){return new BPromise(function(_0x499ab3,_0x3313b2){return client[_0x4559('0xa')](_0xf3caf7,_0x474fa3)[_0x4559('0xb')](function(_0x3e0e7b){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x5eab7a,_0x4559('0xc'));logger[_0x4559('0xd')](_0x4559('0xe'),_0x5eab7a,'request\x20sent',JSON[_0x4559('0xf')](_0x3e0e7b));if(_0x3e0e7b[_0x4559('0x10')]){if(_0x3e0e7b['error'][_0x4559('0x11')]===0x1f4){logger[_0x4559('0x10')](_0x4559('0x12'),_0x5eab7a,_0x3e0e7b[_0x4559('0x10')][_0x4559('0x13')]);return _0x3313b2(_0x3e0e7b[_0x4559('0x10')][_0x4559('0x13')]);}logger['error'](_0x4559('0x12'),_0x5eab7a,_0x3e0e7b[_0x4559('0x10')][_0x4559('0x13')]);return _0x499ab3(_0x3e0e7b['error'][_0x4559('0x13')]);}else{logger[_0x4559('0x14')]('UserChatQueue,\x20%s,\x20%s',_0x5eab7a,_0x4559('0xc'));_0x499ab3(_0x3e0e7b[_0x4559('0x15')][_0x4559('0x13')]);}})[_0x4559('0x16')](function(_0xafc512){logger[_0x4559('0x10')](_0x4559('0x12'),_0x5eab7a,_0xafc512);_0x3313b2(_0xafc512);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index d41a643..8f24fe0 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 _0xa120=['express','Router','../../components/auth/service','exports','multer','util','path','connect-timeout'];(function(_0x70bf1e,_0x5ad93d){var _0x1b10a6=function(_0xed4f62){while(--_0xed4f62){_0x70bf1e['push'](_0x70bf1e['shift']());}};_0x1b10a6(++_0x5ad93d);}(_0xa120,0x64));var _0x0a12=function(_0xa3fa84,_0x5afa5f){_0xa3fa84=_0xa3fa84-0x0;var _0xfe226a=_0xa120[_0xa3fa84];return _0xfe226a;};'use strict';var multer=require(_0x0a12('0x0'));var util=require(_0x0a12('0x1'));var path=require(_0x0a12('0x2'));var timeout=require(_0x0a12('0x3'));var express=require(_0x0a12('0x4'));var router=express[_0x0a12('0x5')]();var auth=require(_0x0a12('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x0a12('0x7')]=router; \ No newline at end of file +var _0x9a6e=['../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','connect-timeout','express','Router'];(function(_0x45afc4,_0xeaa0e3){var _0x43e32b=function(_0x4fa1b0){while(--_0x4fa1b0){_0x45afc4['push'](_0x45afc4['shift']());}};_0x43e32b(++_0xeaa0e3);}(_0x9a6e,0xdb));var _0xe9a6=function(_0x40b66c,_0x5c1d58){_0x40b66c=_0x40b66c-0x0;var _0x159671=_0x9a6e[_0x40b66c];return _0x159671;};'use strict';var multer=require(_0xe9a6('0x0'));var util=require(_0xe9a6('0x1'));var path=require('path');var timeout=require(_0xe9a6('0x2'));var express=require(_0xe9a6('0x3'));var router=express[_0xe9a6('0x4')]();var auth=require(_0xe9a6('0x5'));var interaction=require(_0xe9a6('0x6'));var config=require(_0xe9a6('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 066821f..ec4e29c 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 _0x2547=['INTEGER','STRING','exports'];(function(_0x543a8e,_0x416b83){var _0x22d02b=function(_0x54ff4d){while(--_0x54ff4d){_0x543a8e['push'](_0x543a8e['shift']());}};_0x22d02b(++_0x416b83);}(_0x2547,0x1cd));var _0x7254=function(_0x525253,_0x27bb8a){_0x525253=_0x525253-0x0;var _0xe076ce=_0x2547[_0x525253];return _0xe076ce;};'use strict';var Sequelize=require('sequelize');module[_0x7254('0x0')]={'penalty':{'type':Sequelize[_0x7254('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7254('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x7254('0x2')]}}; \ No newline at end of file +var _0xe605=['INTEGER','STRING','sequelize','exports'];(function(_0x37937e,_0x51118c){var _0x460fe6=function(_0x518df3){while(--_0x518df3){_0x37937e['push'](_0x37937e['shift']());}};_0x460fe6(++_0x51118c);}(_0xe605,0x92));var _0x5e60=function(_0x24151f,_0x1519d1){_0x24151f=_0x24151f-0x0;var _0x46a971=_0xe605[_0x24151f];return _0x46a971;};'use strict';var Sequelize=require(_0x5e60('0x0'));module[_0x5e60('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5e60('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x5e60('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 9695503..4dd1364 100644 --- a/server/api/userFaxQueue/userFaxQueue.model.js +++ b/server/api/userFaxQueue/userFaxQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','../../config/logger'];(function(_0x2b49bc,_0x47b636){var _0x43cc65=function(_0x236ec3){while(--_0x236ec3){_0x2b49bc['push'](_0x2b49bc['shift']());}};_0x43cc65(++_0x47b636);}(_0xb10b,0x12a));var _0xbb10=function(_0x49b0bf,_0x2c50e9){_0x49b0bf=_0x49b0bf-0x0;var _0x4e6b5c=_0xb10b[_0x49b0bf];return _0x4e6b5c;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserFaxQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','../../config/logger'];(function(_0x7b68cc,_0x3f522e){var _0x36470e=function(_0x3b80ad){while(--_0x3b80ad){_0x7b68cc['push'](_0x7b68cc['shift']());}};_0x36470e(++_0x3f522e);}(_0xb10b,0x12a));var _0xbb10=function(_0x44540d,_0x361ed2){_0x44540d=_0x44540d-0x0;var _0x3cb1e3=_0xb10b[_0x44540d];return _0x3cb1e3;};'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 0042eab..2e43b34 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 _0xeff4=['util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0xb5be71,_0x402295){var _0x538c0a=function(_0x51db3d){while(--_0x51db3d){_0xb5be71['push'](_0xb5be71['shift']());}};_0x538c0a(++_0x402295);}(_0xeff4,0xe5));var _0x4eff=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xeff4[_0x4c440b];return _0x2d48cf;};'use strict';var _=require(_0x4eff('0x0'));var util=require(_0x4eff('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4eff('0x2'));var fs=require('fs');var Redis=require(_0x4eff('0x3'));var db=require(_0x4eff('0x4'))['db'];var utils=require(_0x4eff('0x5'));var logger=require('../../config/logger')(_0x4eff('0x6'));var config=require(_0x4eff('0x7'));var jayson=require(_0x4eff('0x8'));var client=jayson[_0x4eff('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b5657,_0x3bde8e,_0x5a8c5a){return new BPromise(function(_0x5bf1e8,_0x760afd){return client[_0x4eff('0xa')](_0x3b5657,_0x5a8c5a)[_0x4eff('0xb')](function(_0x1fa28e){logger[_0x4eff('0xc')](_0x4eff('0xd'),_0x3bde8e,'request\x20sent');logger[_0x4eff('0xe')](_0x4eff('0xf'),_0x3bde8e,_0x4eff('0x10'),JSON[_0x4eff('0x11')](_0x1fa28e));if(_0x1fa28e[_0x4eff('0x12')]){if(_0x1fa28e[_0x4eff('0x12')][_0x4eff('0x13')]===0x1f4){logger[_0x4eff('0x12')](_0x4eff('0xd'),_0x3bde8e,_0x1fa28e['error']['message']);return _0x760afd(_0x1fa28e[_0x4eff('0x12')][_0x4eff('0x14')]);}logger[_0x4eff('0x12')](_0x4eff('0xd'),_0x3bde8e,_0x1fa28e[_0x4eff('0x12')]['message']);return _0x5bf1e8(_0x1fa28e[_0x4eff('0x12')][_0x4eff('0x14')]);}else{logger['info'](_0x4eff('0xd'),_0x3bde8e,_0x4eff('0x10'));_0x5bf1e8(_0x1fa28e[_0x4eff('0x15')][_0x4eff('0x14')]);}})[_0x4eff('0x16')](function(_0x597e0e){logger[_0x4eff('0x12')](_0x4eff('0xd'),_0x3bde8e,_0x597e0e);_0x760afd(_0x597e0e);});});} \ No newline at end of file +var _0xfcae=['UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x5c9b89,_0x3d7af1){var _0x51790a=function(_0x5900e2){while(--_0x5900e2){_0x5c9b89['push'](_0x5c9b89['shift']());}};_0x51790a(++_0x3d7af1);}(_0xfcae,0x141));var _0xefca=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xfcae[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0xefca('0x0'));var util=require(_0xefca('0x1'));var moment=require(_0xefca('0x2'));var BPromise=require(_0xefca('0x3'));var rs=require(_0xefca('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xefca('0x5'))['db'];var utils=require(_0xefca('0x6'));var logger=require(_0xefca('0x7'))(_0xefca('0x8'));var config=require('../../config/environment');var jayson=require(_0xefca('0x9'));var client=jayson[_0xefca('0xa')][_0xefca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e868d,_0x410f06,_0x1f6034){return new BPromise(function(_0x2ce88e,_0x5542fd){return client[_0xefca('0xc')](_0x4e868d,_0x1f6034)[_0xefca('0xd')](function(_0x1fcf8f){logger[_0xefca('0xe')](_0xefca('0xf'),_0x410f06,_0xefca('0x10'));logger['debug'](_0xefca('0x11'),_0x410f06,_0xefca('0x10'),JSON[_0xefca('0x12')](_0x1fcf8f));if(_0x1fcf8f[_0xefca('0x13')]){if(_0x1fcf8f['error'][_0xefca('0x14')]===0x1f4){logger[_0xefca('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x410f06,_0x1fcf8f[_0xefca('0x13')][_0xefca('0x15')]);return _0x5542fd(_0x1fcf8f['error']['message']);}logger[_0xefca('0x13')](_0xefca('0xf'),_0x410f06,_0x1fcf8f['error'][_0xefca('0x15')]);return _0x2ce88e(_0x1fcf8f[_0xefca('0x13')][_0xefca('0x15')]);}else{logger[_0xefca('0xe')](_0xefca('0xf'),_0x410f06,'request\x20sent');_0x2ce88e(_0x1fcf8f[_0xefca('0x16')][_0xefca('0x15')]);}})[_0xefca('0x17')](function(_0x15abaa){logger[_0xefca('0x13')](_0xefca('0xf'),_0x410f06,_0x15abaa);_0x5542fd(_0x15abaa);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 92c8728..de568ca 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 _0xf3db=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports','multer'];(function(_0x217a3f,_0x25c079){var _0x58228f=function(_0x386e46){while(--_0x386e46){_0x217a3f['push'](_0x217a3f['shift']());}};_0x58228f(++_0x25c079);}(_0xf3db,0x195));var _0xbf3d=function(_0x38e170,_0x5b98b4){_0x38e170=_0x38e170-0x0;var _0x291be0=_0xf3db[_0x38e170];return _0x291be0;};'use strict';var multer=require(_0xbf3d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbf3d('0x1'));var express=require(_0xbf3d('0x2'));var router=express[_0xbf3d('0x3')]();var auth=require(_0xbf3d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbf3d('0x5'));module[_0xbf3d('0x6')]=router; \ No newline at end of file +var _0x7c1f=['../../config/environment','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c1f,0x65));var _0xf7c1=function(_0x5a2fda,_0x420b87){_0x5a2fda=_0x5a2fda-0x0;var _0x54b895=_0x7c1f[_0x5a2fda];return _0x54b895;};'use strict';var multer=require(_0xf7c1('0x0'));var util=require(_0xf7c1('0x1'));var path=require(_0xf7c1('0x2'));var timeout=require('connect-timeout');var express=require(_0xf7c1('0x3'));var router=express[_0xf7c1('0x4')]();var auth=require(_0xf7c1('0x5'));var interaction=require(_0xf7c1('0x6'));var config=require(_0xf7c1('0x7'));module[_0xf7c1('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 182f583..7a8a234 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(_0x31826c,_0x1995c5){var _0x20bbd7=function(_0x2a98ab){while(--_0x2a98ab){_0x31826c['push'](_0x31826c['shift']());}};_0x20bbd7(++_0x1995c5);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x14da4b,_0x54790c){var _0x4661e6=function(_0x816adb){while(--_0x816adb){_0x14da4b['push'](_0x14da4b['shift']());}};_0x4661e6(++_0x54790c);}(_0xe706,0xa3));var _0x6e70=function(_0x3357b8,_0xeb406){_0x3357b8=_0x3357b8-0x0;var _0x50737a=_0xe706[_0x3357b8];return _0x50737a;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 009a1f0..2c58ffc 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(_0x5c4bf5,_0x28b32a){var _0x3625eb=function(_0xb5a66a){while(--_0xb5a66a){_0x5c4bf5['push'](_0x5c4bf5['shift']());}};_0x3625eb(++_0x28b32a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x1e6490,_0x59aa56){var _0x59b614=function(_0x4061c7){while(--_0x4061c7){_0x1e6490['push'](_0x1e6490['shift']());}};_0x59b614(++_0x59aa56);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 2c3a042..6782009 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 _0xc4f5=['debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x54517c,_0x248d46){var _0x3e519a=function(_0x330326){while(--_0x330326){_0x54517c['push'](_0x54517c['shift']());}};_0x3e519a(++_0x248d46);}(_0xc4f5,0xa5));var _0x5c4f=function(_0x1eb3f6,_0x3f8dc7){_0x1eb3f6=_0x1eb3f6-0x0;var _0x511f68=_0xc4f5[_0x1eb3f6];return _0x511f68;};'use strict';var _=require('lodash');var util=require(_0x5c4f('0x0'));var moment=require(_0x5c4f('0x1'));var BPromise=require(_0x5c4f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c4f('0x3'));var db=require(_0x5c4f('0x4'))['db'];var utils=require(_0x5c4f('0x5'));var logger=require(_0x5c4f('0x6'))(_0x5c4f('0x7'));var config=require('../../config/environment');var jayson=require(_0x5c4f('0x8'));var client=jayson[_0x5c4f('0x9')][_0x5c4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x123651,_0x51be50,_0x48f095){return new BPromise(function(_0x1ec0c8,_0x4a7bd4){return client[_0x5c4f('0xb')](_0x123651,_0x48f095)['then'](function(_0x381d46){logger[_0x5c4f('0xc')](_0x5c4f('0xd'),_0x51be50,_0x5c4f('0xe'));logger[_0x5c4f('0xf')](_0x5c4f('0x10'),_0x51be50,_0x5c4f('0xe'),JSON['stringify'](_0x381d46));if(_0x381d46[_0x5c4f('0x11')]){if(_0x381d46[_0x5c4f('0x11')]['code']===0x1f4){logger[_0x5c4f('0x11')](_0x5c4f('0xd'),_0x51be50,_0x381d46[_0x5c4f('0x11')][_0x5c4f('0x12')]);return _0x4a7bd4(_0x381d46[_0x5c4f('0x11')]['message']);}logger['error'](_0x5c4f('0xd'),_0x51be50,_0x381d46[_0x5c4f('0x11')][_0x5c4f('0x12')]);return _0x1ec0c8(_0x381d46[_0x5c4f('0x11')][_0x5c4f('0x12')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0x51be50,_0x5c4f('0xe'));_0x1ec0c8(_0x381d46['result']['message']);}})[_0x5c4f('0x13')](function(_0x5154eb){logger[_0x5c4f('0x11')](_0x5c4f('0xd'),_0x51be50,_0x5154eb);_0x4a7bd4(_0x5154eb);});});} \ No newline at end of file +var _0xbecd=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserMailQueue,\x20%s,\x20%s','message','info'];(function(_0x520e81,_0x405618){var _0x8792a8=function(_0x535d08){while(--_0x535d08){_0x520e81['push'](_0x520e81['shift']());}};_0x8792a8(++_0x405618);}(_0xbecd,0x6a));var _0xdbec=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbecd[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xdbec('0x0'));var util=require('util');var moment=require(_0xdbec('0x1'));var BPromise=require(_0xdbec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdbec('0x3'));var db=require(_0xdbec('0x4'))['db'];var utils=require(_0xdbec('0x5'));var logger=require(_0xdbec('0x6'))(_0xdbec('0x7'));var config=require(_0xdbec('0x8'));var jayson=require(_0xdbec('0x9'));var client=jayson[_0xdbec('0xa')][_0xdbec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38cac4,_0x13dfff,_0x380bf8){return new BPromise(function(_0x406cd3,_0x242b59){return client[_0xdbec('0xc')](_0x38cac4,_0x380bf8)['then'](function(_0x299d84){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x13dfff,'request\x20sent');logger['debug'](_0xdbec('0xd'),_0x13dfff,_0xdbec('0xe'),JSON['stringify'](_0x299d84));if(_0x299d84[_0xdbec('0xf')]){if(_0x299d84[_0xdbec('0xf')][_0xdbec('0x10')]===0x1f4){logger[_0xdbec('0xf')](_0xdbec('0x11'),_0x13dfff,_0x299d84[_0xdbec('0xf')]['message']);return _0x242b59(_0x299d84[_0xdbec('0xf')][_0xdbec('0x12')]);}logger['error'](_0xdbec('0x11'),_0x13dfff,_0x299d84[_0xdbec('0xf')]['message']);return _0x406cd3(_0x299d84[_0xdbec('0xf')]['message']);}else{logger[_0xdbec('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x13dfff,_0xdbec('0xe'));_0x406cd3(_0x299d84['result']['message']);}})[_0xdbec('0x14')](function(_0x1c9054){logger[_0xdbec('0xf')](_0xdbec('0x11'),_0x13dfff,_0x1c9054);_0x242b59(_0x1c9054);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index e272920..6eaf6cc 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 _0xb276=['../../config/environment','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x488600,_0x1589f8){var _0x2df9cc=function(_0x129557){while(--_0x129557){_0x488600['push'](_0x488600['shift']());}};_0x2df9cc(++_0x1589f8);}(_0xb276,0x1bb));var _0x6b27=function(_0x4e1a49,_0x4da738){_0x4e1a49=_0x4e1a49-0x0;var _0x136aae=_0xb276[_0x4e1a49];return _0x136aae;};'use strict';var multer=require('multer');var util=require(_0x6b27('0x0'));var path=require(_0x6b27('0x1'));var timeout=require(_0x6b27('0x2'));var express=require(_0x6b27('0x3'));var router=express[_0x6b27('0x4')]();var auth=require(_0x6b27('0x5'));var interaction=require(_0x6b27('0x6'));var config=require(_0x6b27('0x7'));module[_0x6b27('0x8')]=router; \ No newline at end of file +var _0xf483=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','util','connect-timeout','express'];(function(_0x3b7923,_0x42fbad){var _0x51e235=function(_0x26d6f8){while(--_0x26d6f8){_0x3b7923['push'](_0x3b7923['shift']());}};_0x51e235(++_0x42fbad);}(_0xf483,0xf2));var _0x3f48=function(_0x3d5cd9,_0x2c8ebc){_0x3d5cd9=_0x3d5cd9-0x0;var _0x204a53=_0xf483[_0x3d5cd9];return _0x204a53;};'use strict';var multer=require('multer');var util=require(_0x3f48('0x0'));var path=require('path');var timeout=require(_0x3f48('0x1'));var express=require(_0x3f48('0x2'));var router=express[_0x3f48('0x3')]();var auth=require(_0x3f48('0x4'));var interaction=require(_0x3f48('0x5'));var config=require(_0x3f48('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 7a22d92..9b6c8f5 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x1bba0f,_0x580616){var _0x4ae9d2=function(_0x47cf55){while(--_0x47cf55){_0x1bba0f['push'](_0x1bba0f['shift']());}};_0x4ae9d2(++_0x580616);}(_0xe706,0xa3));var _0x6e70=function(_0x1d1fdf,_0x33ba5a){_0x1d1fdf=_0x1d1fdf-0x0;var _0x3521d6=_0xe706[_0x1d1fdf];return _0x3521d6;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb10b=['sequelize','INTEGER'];(function(_0x3e330f,_0x3423c3){var _0x15c9e1=function(_0x248d12){while(--_0x248d12){_0x3e330f['push'](_0x3e330f['shift']());}};_0x15c9e1(++_0x3423c3);}(_0xb10b,0x12a));var _0xbb10=function(_0x1ce92b,_0x12fe42){_0x1ce92b=_0x1ce92b-0x0;var _0x3ff61a=_0xb10b[_0x1ce92b];return _0x3ff61a;};'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 6af9d9e..bdd5a54 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 _0x1ead=['request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','user_has_openchannel_queues','moment','bluebird'];(function(_0x29c77f,_0x24834e){var _0x574e4b=function(_0x2a7f51){while(--_0x2a7f51){_0x29c77f['push'](_0x29c77f['shift']());}};_0x574e4b(++_0x24834e);}(_0x1ead,0x76));var _0xd1ea=function(_0x145b6a,_0x61816){_0x145b6a=_0x145b6a-0x0;var _0x5010d6=_0x1ead[_0x145b6a];return _0x5010d6;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd1ea('0x0'));var BPromise=require(_0xd1ea('0x1'));var rp=require(_0xd1ea('0x2'));var fs=require('fs');var path=require(_0xd1ea('0x3'));var rimraf=require(_0xd1ea('0x4'));var config=require(_0xd1ea('0x5'));var attributes=require(_0xd1ea('0x6'));module[_0xd1ea('0x7')]=function(_0x4ea48f,_0x3e35c6){return _0x4ea48f['define'](_0xd1ea('0x8'),attributes,{'tableName':_0xd1ea('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb1a3=['moment','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','user_has_openchannel_queues','api'];(function(_0x3eb658,_0x3187fb){var _0x52d6a0=function(_0x40acd1){while(--_0x40acd1){_0x3eb658['push'](_0x3eb658['shift']());}};_0x52d6a0(++_0x3187fb);}(_0xb1a3,0x117));var _0x3b1a=function(_0x286726,_0x20a337){_0x286726=_0x286726-0x0;var _0xcd4fe9=_0xb1a3[_0x286726];return _0xcd4fe9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3b1a('0x0'));var moment=require(_0x3b1a('0x1'));var BPromise=require('bluebird');var rp=require(_0x3b1a('0x2'));var fs=require('fs');var path=require(_0x3b1a('0x3'));var rimraf=require(_0x3b1a('0x4'));var config=require(_0x3b1a('0x5'));var attributes=require(_0x3b1a('0x6'));module['exports']=function(_0xe19ce0,_0x92730d){return _0xe19ce0['define']('UserOpenchannelQueue',attributes,{'tableName':_0x3b1a('0x7'),'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 b441ed4..5b0bbd2 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 _0xfea1=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug'];(function(_0x1d7feb,_0x4bf95e){var _0x275c84=function(_0x546cd1){while(--_0x546cd1){_0x1d7feb['push'](_0x1d7feb['shift']());}};_0x275c84(++_0x4bf95e);}(_0xfea1,0xaf));var _0x1fea=function(_0x4bb145,_0x3e7d33){_0x4bb145=_0x4bb145-0x0;var _0x4db596=_0xfea1[_0x4bb145];return _0x4db596;};'use strict';var _=require(_0x1fea('0x0'));var util=require(_0x1fea('0x1'));var moment=require(_0x1fea('0x2'));var BPromise=require(_0x1fea('0x3'));var rs=require(_0x1fea('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1fea('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1fea('0x6'))('rpc');var config=require(_0x1fea('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1fea('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cb522,_0x23a167,_0x2f94ca){return new BPromise(function(_0x1a6ea4,_0xaff416){return client[_0x1fea('0x9')](_0x1cb522,_0x2f94ca)[_0x1fea('0xa')](function(_0x187586){logger[_0x1fea('0xb')](_0x1fea('0xc'),_0x23a167,'request\x20sent');logger[_0x1fea('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x23a167,_0x1fea('0xe'),JSON[_0x1fea('0xf')](_0x187586));if(_0x187586[_0x1fea('0x10')]){if(_0x187586[_0x1fea('0x10')][_0x1fea('0x11')]===0x1f4){logger[_0x1fea('0x10')](_0x1fea('0xc'),_0x23a167,_0x187586[_0x1fea('0x10')][_0x1fea('0x12')]);return _0xaff416(_0x187586[_0x1fea('0x10')]['message']);}logger[_0x1fea('0x10')](_0x1fea('0xc'),_0x23a167,_0x187586[_0x1fea('0x10')][_0x1fea('0x12')]);return _0x1a6ea4(_0x187586['error'][_0x1fea('0x12')]);}else{logger[_0x1fea('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x23a167,'request\x20sent');_0x1a6ea4(_0x187586[_0x1fea('0x13')][_0x1fea('0x12')]);}})[_0x1fea('0x14')](function(_0x49496d){logger[_0x1fea('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x23a167,_0x49496d);_0xaff416(_0x49496d);});});} \ No newline at end of file +var _0x3d74=['rpc','../../config/environment','jayson/promise','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4344a2,_0x4798ee){var _0x3dc2cb=function(_0x1a127d){while(--_0x1a127d){_0x4344a2['push'](_0x4344a2['shift']());}};_0x3dc2cb(++_0x4798ee);}(_0x3d74,0x10c));var _0x43d7=function(_0x25dc44,_0x26a963){_0x25dc44=_0x25dc44-0x0;var _0x75d3f2=_0x3d74[_0x25dc44];return _0x75d3f2;};'use strict';var _=require(_0x43d7('0x0'));var util=require(_0x43d7('0x1'));var moment=require(_0x43d7('0x2'));var BPromise=require(_0x43d7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43d7('0x4'));var db=require(_0x43d7('0x5'))['db'];var utils=require(_0x43d7('0x6'));var logger=require(_0x43d7('0x7'))(_0x43d7('0x8'));var config=require(_0x43d7('0x9'));var jayson=require(_0x43d7('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39d858,_0x1bf221,_0x8c9e0d){return new BPromise(function(_0x67f916,_0x5f4f1f){return client[_0x43d7('0xb')](_0x39d858,_0x8c9e0d)[_0x43d7('0xc')](function(_0x58833a){logger[_0x43d7('0xd')](_0x43d7('0xe'),_0x1bf221,_0x43d7('0xf'));logger[_0x43d7('0x10')](_0x43d7('0x11'),_0x1bf221,_0x43d7('0xf'),JSON[_0x43d7('0x12')](_0x58833a));if(_0x58833a['error']){if(_0x58833a[_0x43d7('0x13')][_0x43d7('0x14')]===0x1f4){logger[_0x43d7('0x13')](_0x43d7('0xe'),_0x1bf221,_0x58833a[_0x43d7('0x13')]['message']);return _0x5f4f1f(_0x58833a[_0x43d7('0x13')]['message']);}logger[_0x43d7('0x13')](_0x43d7('0xe'),_0x1bf221,_0x58833a['error']['message']);return _0x67f916(_0x58833a['error'][_0x43d7('0x15')]);}else{logger[_0x43d7('0xd')](_0x43d7('0xe'),_0x1bf221,_0x43d7('0xf'));_0x67f916(_0x58833a[_0x43d7('0x16')][_0x43d7('0x15')]);}})['catch'](function(_0x569649){logger['error'](_0x43d7('0xe'),_0x1bf221,_0x569649);_0x5f4f1f(_0x569649);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 8cceb1e..e69d1b1 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 _0x5ff1=['/:id/sections','getSections','/:id/resources','getResources','post','/:id/clone','clone','addSections','addResources','put','destroy','delete','removeSections','removeResources','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x3452a8,_0x4bfaa4){var _0x233814=function(_0x40b537){while(--_0x40b537){_0x3452a8['push'](_0x3452a8['shift']());}};_0x233814(++_0x4bfaa4);}(_0x5ff1,0xa0));var _0x15ff=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0x5ff1[_0x256d6a];return _0x460058;};'use strict';var multer=require(_0x15ff('0x0'));var util=require(_0x15ff('0x1'));var path=require(_0x15ff('0x2'));var timeout=require('connect-timeout');var express=require(_0x15ff('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x15ff('0x4'));var config=require(_0x15ff('0x5'));var controller=require(_0x15ff('0x6'));router[_0x15ff('0x7')]('/',auth[_0x15ff('0x8')](),controller[_0x15ff('0x9')]);router['get'](_0x15ff('0xa'),auth['isAuthenticated'](),controller[_0x15ff('0xb')]);router[_0x15ff('0x7')](_0x15ff('0xc'),auth['isAuthenticated'](),controller[_0x15ff('0xd')]);router[_0x15ff('0x7')](_0x15ff('0xe'),auth[_0x15ff('0x8')](),controller[_0x15ff('0xf')]);router[_0x15ff('0x7')](_0x15ff('0x10'),auth['isAuthenticated'](),controller[_0x15ff('0x11')]);router[_0x15ff('0x12')]('/',auth[_0x15ff('0x8')](),controller['create']);router[_0x15ff('0x12')](_0x15ff('0x13'),auth[_0x15ff('0x8')](),controller[_0x15ff('0x14')]);router[_0x15ff('0x12')]('/:id/sections',auth[_0x15ff('0x8')](),controller[_0x15ff('0x15')]);router['post'](_0x15ff('0x10'),auth[_0x15ff('0x8')](),controller[_0x15ff('0x16')]);router[_0x15ff('0x17')]('/:id',auth[_0x15ff('0x8')](),controller['update']);router['delete']('/:id',auth[_0x15ff('0x8')](),controller[_0x15ff('0x18')]);router[_0x15ff('0x19')](_0x15ff('0xe'),auth[_0x15ff('0x8')](),controller[_0x15ff('0x1a')]);router[_0x15ff('0x19')](_0x15ff('0x10'),auth['isAuthenticated'](),controller[_0x15ff('0x1b')]);module[_0x15ff('0x1c')]=router; \ No newline at end of file +var _0x0497=['post','/:id/clone','clone','/:id/sections','addSections','addResources','put','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','../../components/auth/service','isAuthenticated','get','/describe','describe','/:id','getSections','/:id/resources'];(function(_0x576e35,_0x36fbe4){var _0x2c870c=function(_0x792cdb){while(--_0x792cdb){_0x576e35['push'](_0x576e35['shift']());}};_0x2c870c(++_0x36fbe4);}(_0x0497,0xc3));var _0x7049=function(_0x2bd261,_0x1f445d){_0x2bd261=_0x2bd261-0x0;var _0x327157=_0x0497[_0x2bd261];return _0x327157;};'use strict';var multer=require(_0x7049('0x0'));var util=require(_0x7049('0x1'));var path=require(_0x7049('0x2'));var timeout=require(_0x7049('0x3'));var express=require(_0x7049('0x4'));var router=express['Router']();var auth=require(_0x7049('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfile.controller');router['get']('/',auth[_0x7049('0x6')](),controller['index']);router[_0x7049('0x7')](_0x7049('0x8'),auth['isAuthenticated'](),controller[_0x7049('0x9')]);router['get'](_0x7049('0xa'),auth[_0x7049('0x6')](),controller['show']);router[_0x7049('0x7')]('/:id/sections',auth[_0x7049('0x6')](),controller[_0x7049('0xb')]);router['get'](_0x7049('0xc'),auth[_0x7049('0x6')](),controller['getResources']);router['post']('/',auth[_0x7049('0x6')](),controller['create']);router[_0x7049('0xd')](_0x7049('0xe'),auth['isAuthenticated'](),controller[_0x7049('0xf')]);router['post'](_0x7049('0x10'),auth[_0x7049('0x6')](),controller[_0x7049('0x11')]);router[_0x7049('0xd')](_0x7049('0xc'),auth['isAuthenticated'](),controller[_0x7049('0x12')]);router[_0x7049('0x13')]('/:id',auth[_0x7049('0x6')](),controller[_0x7049('0x14')]);router[_0x7049('0x15')](_0x7049('0xa'),auth['isAuthenticated'](),controller[_0x7049('0x16')]);router[_0x7049('0x15')](_0x7049('0x10'),auth['isAuthenticated'](),controller[_0x7049('0x17')]);router['delete']('/:id/resources',auth[_0x7049('0x6')](),controller[_0x7049('0x18')]);module[_0x7049('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index e48b444..5796cdb 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 _0x4df5=['STRING','name','setDataValue','join','getDataValue','sequelize','exports'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x4df5,0x140));var _0x54df=function(_0x39ecb8,_0x2b23e8){_0x39ecb8=_0x39ecb8-0x0;var _0x310c8b=_0x4df5[_0x39ecb8];return _0x310c8b;};'use strict';var Sequelize=require(_0x54df('0x0'));module[_0x54df('0x1')]={'name':{'type':Sequelize[_0x54df('0x2')],'allowNull':![],'unique':_0x54df('0x3')},'crudPermissions':{'type':Sequelize[_0x54df('0x2')],'set':function(_0x2a7a45){this[_0x54df('0x4')]('crudPermissions',_0x2a7a45?_0x2a7a45[_0x54df('0x5')](''):[]);},'get':function(){return this[_0x54df('0x6')]('crudPermissions')?this[_0x54df('0x6')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x54df('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xf5fd=['sequelize','exports','STRING','name','crudPermissions','join','getDataValue','split'];(function(_0x2ce6c4,_0x1493e0){var _0x3fa5ef=function(_0x462a6a){while(--_0x462a6a){_0x2ce6c4['push'](_0x2ce6c4['shift']());}};_0x3fa5ef(++_0x1493e0);}(_0xf5fd,0xc8));var _0xdf5f=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xf5fd[_0x2c7618];return _0x5ce3f0;};'use strict';var Sequelize=require(_0xdf5f('0x0'));module[_0xdf5f('0x1')]={'name':{'type':Sequelize[_0xdf5f('0x2')],'allowNull':![],'unique':_0xdf5f('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x503595){this['setDataValue'](_0xdf5f('0x4'),_0x503595?_0x503595[_0xdf5f('0x5')](''):[]);},'get':function(){return this[_0xdf5f('0x6')](_0xdf5f('0x4'))?this['getDataValue'](_0xdf5f('0x4'))[_0xdf5f('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xdf5f('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 28281ed..256bac2 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 _0x0669=['find','create','body','clone','get','omit','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','params','each','autoAssociation','UserProfileResource','createdAt','sectionId','userProfileId','Resources','describe','push','removeSections','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','ids','section','undefined','Sequelize','ValidationError','mergeResources','childModel','parentSections','all','ignore','field','foreignKey','associatedResources','AnalyticExtractedReport','default','reportId','DefaultReports','CustomReports','CmContact','Tag','Tags','color','tag','ThroughTags','value','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','contacts','ListId','lists','companies','globalcustomfields','CmCustomField','chatqueues','chatwebsites','ChatWebsite','faxaccounts','FaxAccount','inboundroutes','VoiceExtension','contexts','voicemails','VoiceMail','VoiceRecording','Agents','User','Telephones','membername','role','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','SmsAccount','WhatsappQueue','whatsappaccounts','Team','voicequeues','queuecampaigns','Users','user','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','Schedule','sounds','Sound','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','Plugin','extractedreports','Reports','AnalyticMetric','WhatsappAccount','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','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','./userProfile.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','update','then','destroy','error','stack','name','map','UserProfile','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','keys','includeAll'];(function(_0x81e39d,_0x4c3934){var _0x548fbb=function(_0x1adda5){while(--_0x1adda5){_0x81e39d['push'](_0x81e39d['shift']());}};_0x548fbb(++_0x4c3934);}(_0x0669,0x181));var _0x9066=function(_0x11f4b5,_0x279f0d){_0x11f4b5=_0x11f4b5-0x0;var _0x59d5e0=_0x0669[_0x11f4b5];return _0x59d5e0;};'use strict';var pdf=require(_0x9066('0x0'));var emlformat=require(_0x9066('0x1'));var rimraf=require(_0x9066('0x2'));var zipdir=require(_0x9066('0x3'));var jsonpatch=require(_0x9066('0x4'));var rp=require(_0x9066('0x5'));var moment=require(_0x9066('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x9066('0x7'));var util=require('util');var path=require(_0x9066('0x8'));var sox=require(_0x9066('0x9'));var csv=require(_0x9066('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x9066('0xb'));var crypto=require(_0x9066('0xc'));var jsforce=require(_0x9066('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9066('0xa'));var querystring=require(_0x9066('0xe'));var Papa=require(_0x9066('0xf'));var Redis=require(_0x9066('0x10'));var authService=require(_0x9066('0x11'));var qs=require(_0x9066('0x12'));var as=require(_0x9066('0x13'));var hardwareService=require(_0x9066('0x14'));var logger=require(_0x9066('0x15'))('api');var utils=require(_0x9066('0x16'));var config=require('../../config/environment');var db=require(_0x9066('0x17'))['db'];config[_0x9066('0x18')]=_[_0x9066('0x19')](config['redis'],{'host':_0x9066('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9066('0x18')]));require(_0x9066('0x1b'))[_0x9066('0x1c')](socket);function respondWithStatusCode(_0x27de3b,_0xe41b2e){_0xe41b2e=_0xe41b2e||0xcc;return function(_0x1f4ad1){if(_0x1f4ad1){return _0x27de3b[_0x9066('0x1d')](_0xe41b2e);}return _0x27de3b[_0x9066('0x1e')](_0xe41b2e)[_0x9066('0x1f')]();};}function respondWithResult(_0x26a35d,_0x259ea2){_0x259ea2=_0x259ea2||0xc8;return function(_0x215a3d){if(_0x215a3d){return _0x26a35d[_0x9066('0x1e')](_0x259ea2)['json'](_0x215a3d);}};}function respondWithFilteredResult(_0x5a7640,_0x58e819){return function(_0x6e284f){if(_0x6e284f){var _0x259c7b=_0x6e284f[_0x9066('0x20')],_0x548aa7=_0x58e819[_0x9066('0x21')],_0x58237d=_0x58e819[_0x9066('0x21')]+_0x58e819[_0x9066('0x22')],_0xb721a5;if(_0x58237d>=_0x259c7b){_0x58237d=_0x259c7b;_0xb721a5=0xc8;}else{_0xb721a5=0xce;}_0x5a7640[_0x9066('0x1e')](_0xb721a5);return _0x5a7640[_0x9066('0x23')](_0x9066('0x24'),_0x548aa7+'-'+_0x58237d+'/'+_0x259c7b)[_0x9066('0x25')](_0x6e284f);}return null;};}function patchUpdates(_0xbfbf4c){return function(_0x5873b2){try{jsonpatch[_0x9066('0x26')](_0x5873b2,_0xbfbf4c,!![]);}catch(_0x351a7b){return BPromise['reject'](_0x351a7b);}return _0x5873b2['save']();};}function saveUpdates(_0x4baa22,_0xb35417){return function(_0x3d3b97){if(_0x3d3b97){return _0x3d3b97[_0x9066('0x27')](_0x4baa22)[_0x9066('0x28')](function(_0x1ff554){return _0x1ff554;});}return null;};}function removeEntity(_0xb45901,_0x1ec7d6){return function(_0x419084){if(_0x419084){return _0x419084[_0x9066('0x29')]()[_0x9066('0x28')](function(){_0xb45901[_0x9066('0x1e')](0xcc)[_0x9066('0x1f')]();});}};}function handleEntityNotFound(_0x193a8c,_0x3a74fb){return function(_0x56dbe3){if(!_0x56dbe3){_0x193a8c['sendStatus'](0x194);}return _0x56dbe3;};}function handleError(_0x266642,_0x3ecbce){_0x3ecbce=_0x3ecbce||0x1f4;return function(_0x29e0a9){logger[_0x9066('0x2a')](_0x29e0a9[_0x9066('0x2b')]);if(_0x29e0a9['name']){delete _0x29e0a9[_0x9066('0x2c')];}_0x266642[_0x9066('0x1e')](_0x3ecbce)['send'](_0x29e0a9);};}exports['index']=function(_0x375b3e,_0x1159ec){var _0xf05cd1={},_0x328b6a={},_0x352774={'count':0x0,'rows':[]};var _0x479dd0=_[_0x9066('0x2d')](db[_0x9066('0x2e')][_0x9066('0x2f')],function(_0x3b1241){return{'name':_0x3b1241['fieldName'],'type':_0x3b1241[_0x9066('0x30')][_0x9066('0x31')]};});_0x328b6a[_0x9066('0x32')]=_[_0x9066('0x2d')](_0x479dd0,_0x9066('0x2c'));_0x328b6a[_0x9066('0x33')]=_['keys'](_0x375b3e[_0x9066('0x33')]);_0x328b6a[_0x9066('0x34')]=_[_0x9066('0x35')](_0x328b6a[_0x9066('0x32')],_0x328b6a[_0x9066('0x33')]);_0xf05cd1[_0x9066('0x36')]=_['intersection'](_0x328b6a[_0x9066('0x32')],qs[_0x9066('0x37')](_0x375b3e[_0x9066('0x33')][_0x9066('0x37')]));_0xf05cd1[_0x9066('0x36')]=_0xf05cd1[_0x9066('0x36')][_0x9066('0x38')]?_0xf05cd1[_0x9066('0x36')]:_0x328b6a[_0x9066('0x32')];if(!_0x375b3e[_0x9066('0x33')]['hasOwnProperty'](_0x9066('0x39'))){_0xf05cd1[_0x9066('0x22')]=qs[_0x9066('0x22')](_0x375b3e['query']['limit']);_0xf05cd1['offset']=qs['offset'](_0x375b3e[_0x9066('0x33')]['offset']);}_0xf05cd1[_0x9066('0x3a')]=qs['sort'](_0x375b3e[_0x9066('0x33')][_0x9066('0x3b')]);_0xf05cd1[_0x9066('0x3c')]=qs[_0x9066('0x34')](_[_0x9066('0x3d')](_0x375b3e[_0x9066('0x33')],_0x328b6a[_0x9066('0x34')]),_0x479dd0);if(_0x375b3e[_0x9066('0x33')][_0x9066('0x3e')]){_0xf05cd1[_0x9066('0x3c')]=_[_0x9066('0x3f')](_0xf05cd1[_0x9066('0x3c')],{'$or':_[_0x9066('0x2d')](_0x479dd0,function(_0x21b22e){if(_0x21b22e[_0x9066('0x30')]!==_0x9066('0x40')){var _0x9c93a3={};_0x9c93a3[_0x21b22e['name']]={'$like':'%'+_0x375b3e[_0x9066('0x33')][_0x9066('0x3e')]+'%'};return _0x9c93a3;}})});}_0xf05cd1=_[_0x9066('0x3f')]({},_0xf05cd1,_0x375b3e[_0x9066('0x41')]);var _0x532f6b={'where':_0xf05cd1[_0x9066('0x3c')]};return db[_0x9066('0x2e')][_0x9066('0x20')](_0x532f6b)[_0x9066('0x28')](function(_0x1f392e){_0x352774['count']=_0x1f392e;if(_0x375b3e[_0x9066('0x33')]['includeAll']){_0xf05cd1[_0x9066('0x42')]=[{'all':!![]}];}return db[_0x9066('0x2e')][_0x9066('0x43')](_0xf05cd1);})['then'](function(_0x249ca9){_0x352774[_0x9066('0x44')]=_0x249ca9;return _0x352774;})[_0x9066('0x28')](respondWithFilteredResult(_0x1159ec,_0xf05cd1))[_0x9066('0x45')](handleError(_0x1159ec,null));};exports[_0x9066('0x46')]=function(_0x449a7c,_0x530e8f){var _0x4c1b76={'raw':![],'where':{'id':_0x449a7c['params']['id']}},_0x2f8c80={};_0x2f8c80[_0x9066('0x32')]=_[_0x9066('0x47')](db[_0x9066('0x2e')][_0x9066('0x2f')]);_0x2f8c80[_0x9066('0x33')]=_[_0x9066('0x47')](_0x449a7c[_0x9066('0x33')]);_0x2f8c80[_0x9066('0x34')]=_[_0x9066('0x35')](_0x2f8c80[_0x9066('0x32')],_0x2f8c80['query']);_0x4c1b76[_0x9066('0x36')]=_[_0x9066('0x35')](_0x2f8c80[_0x9066('0x32')],qs[_0x9066('0x37')](_0x449a7c['query'][_0x9066('0x37')]));_0x4c1b76['attributes']=_0x4c1b76[_0x9066('0x36')][_0x9066('0x38')]?_0x4c1b76[_0x9066('0x36')]:_0x2f8c80[_0x9066('0x32')];if(_0x449a7c['query'][_0x9066('0x48')]){_0x4c1b76[_0x9066('0x42')]=[{'all':!![]}];}_0x4c1b76=_['merge']({},_0x4c1b76,_0x449a7c['options']);return db[_0x9066('0x2e')][_0x9066('0x49')](_0x4c1b76)['then'](handleEntityNotFound(_0x530e8f,null))[_0x9066('0x28')](respondWithResult(_0x530e8f,null))['catch'](handleError(_0x530e8f,null));};exports[_0x9066('0x4a')]=function(_0x565530,_0xb95df8){return db['UserProfile']['create'](_0x565530[_0x9066('0x4b')],{})[_0x9066('0x28')](respondWithResult(_0xb95df8,0xc9))[_0x9066('0x45')](handleError(_0xb95df8,null));};exports[_0x9066('0x4c')]=function(_0x30c0d2,_0x296bca){var _0x306460={'where':{'id':_0x30c0d2['params']['id']}},_0x47a3c={};_0x47a3c[_0x9066('0x32')]=_['keys'](db['UserProfile'][_0x9066('0x2f')]);_0x306460[_0x9066('0x36')]=_[_0x9066('0x35')](_0x47a3c[_0x9066('0x32')],qs[_0x9066('0x37')](_0x30c0d2[_0x9066('0x33')][_0x9066('0x37')]));_0x306460['attributes']=_0x306460[_0x9066('0x36')][_0x9066('0x38')]?_0x306460[_0x9066('0x36')]:_0x47a3c[_0x9066('0x32')];if(_0x30c0d2[_0x9066('0x33')][_0x9066('0x48')]){_0x306460[_0x9066('0x42')]=[{'all':!![]}];}_0x306460=_[_0x9066('0x3f')]({},_0x306460,_0x30c0d2[_0x9066('0x41')]);return db['UserProfile'][_0x9066('0x49')](_0x306460)[_0x9066('0x28')](handleEntityNotFound(_0x296bca,null))[_0x9066('0x28')](function(_0x1d6c46){if(_0x1d6c46){var _0x1b9760=_0x1d6c46[_0x9066('0x4d')]({'plain':!![]});_0x1b9760=qs[_0x9066('0x4e')](_0x1b9760,['id','createdAt',_0x9066('0x4f'),_0x9066('0x50')]);_0x30c0d2[_0x9066('0x4b')]=_['omit'](_0x30c0d2[_0x9066('0x4b')],['id','createdAt',_0x9066('0x4f')]);return db[_0x9066('0x51')][_0x9066('0x52')](function(_0x298234){return db[_0x9066('0x2e')][_0x9066('0x4a')](_[_0x9066('0x3f')](_0x1b9760,_0x30c0d2['body']),{'include':_0x30c0d2[_0x9066('0x33')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x298234})['then'](function(_0x27884e){var _0x546745=_0x27884e[_0x9066('0x4d')]({'plain':!![]});return db[_0x9066('0x53')][_0x9066('0x43')]({'where':{'userProfileId':_0x30c0d2[_0x9066('0x54')]['id']},'raw':!![]})[_0x9066('0x28')](function(_0x265202){if(_0x265202){return BPromise[_0x9066('0x55')](_0x265202,function(_0x33a28f){return new BPromise(function(_0x31e7c3,_0x4836ca){if(_0x33a28f['autoAssociation']===null||_0x33a28f[_0x9066('0x56')]===0x1)_0x31e7c3(null);return db[_0x9066('0x57')][_0x9066('0x43')]({'where':{'sectionId':_0x33a28f['id']},'raw':!![]})[_0x9066('0x28')](function(_0x542eab){var _0x5074b0=_[_0x9066('0x2d')](_0x542eab,function(_0x1e18f3){return qs[_0x9066('0x4e')](_0x1e18f3,['id',_0x9066('0x58'),_0x9066('0x4f'),_0x9066('0x59')]);});_0x31e7c3(_0x5074b0);})[_0x9066('0x45')](function(_0x5a2894){_0x4836ca(_0x5a2894);});})[_0x9066('0x28')](function(_0x1872d9){var _0x58aa6d=qs[_0x9066('0x4e')](_0x33a28f,['id',_0x9066('0x58'),_0x9066('0x4f')]);_0x58aa6d[_0x9066('0x5a')]=_0x546745['id'];if(_0x1872d9)_0x58aa6d[_0x9066('0x5b')]=_0x1872d9;return _0x58aa6d;})[_0x9066('0x28')](function(_0x2db951){return db[_0x9066('0x53')][_0x9066('0x4a')](_0x2db951,{'include':[{'model':db[_0x9066('0x57')],'as':_0x9066('0x5b')}],'raw':!![],'transaction':_0x298234});});})['then'](function(){return _0x546745;});}});});});}})[_0x9066('0x28')](respondWithResult(_0x296bca,0xc9))['catch'](handleError(_0x296bca,null));};exports['update']=function(_0x936551,_0x11b59c){if(_0x936551[_0x9066('0x4b')]['id']){delete _0x936551[_0x9066('0x4b')]['id'];}return db[_0x9066('0x2e')]['find']({'where':{'id':_0x936551[_0x9066('0x54')]['id']}})[_0x9066('0x28')](handleEntityNotFound(_0x11b59c,null))[_0x9066('0x28')](saveUpdates(_0x936551[_0x9066('0x4b')],null))[_0x9066('0x28')](respondWithResult(_0x11b59c,null))[_0x9066('0x45')](handleError(_0x11b59c,null));};exports[_0x9066('0x29')]=function(_0x45cea3,_0x25c4c7){return db[_0x9066('0x2e')][_0x9066('0x49')]({'where':{'id':_0x45cea3['params']['id']}})[_0x9066('0x28')](handleEntityNotFound(_0x25c4c7,null))[_0x9066('0x28')](removeEntity(_0x25c4c7,null))['catch'](handleError(_0x25c4c7,null));};exports[_0x9066('0x5c')]=function(_0x5dd8a9,_0x18ff98){return db[_0x9066('0x2e')][_0x9066('0x5c')]()[_0x9066('0x28')](respondWithResult(_0x18ff98,null))[_0x9066('0x45')](handleError(_0x18ff98,null));};exports['addSections']=function(_0x3a0ba8,_0x1c01a5){var _0x57a541=_0x3a0ba8[_0x9066('0x4b')];return db[_0x9066('0x2e')][_0x9066('0x49')]({'where':{'id':_0x3a0ba8[_0x9066('0x54')]['id']}})['then'](handleEntityNotFound(_0x1c01a5,null))[_0x9066('0x28')](function(_0x12dbdc){if(_0x12dbdc){return db[_0x9066('0x51')]['transaction'](function(_0xc72416){return db[_0x9066('0x53')]['destroy']({'where':{'userProfileId':_0x3a0ba8['params']['id'],'sectionId':_[_0x9066('0x2d')](_0x57a541,function(_0x5cd105){return _0x5cd105[_0x9066('0x59')];})},'transaction':_0xc72416})[_0x9066('0x28')](function(){var _0x336dac=_[_0x9066('0x2d')](_0x57a541,function(_0x243b67){_0x243b67[_0x9066('0x5a')]=_0x3a0ba8[_0x9066('0x54')]['id'];return _0x243b67;});var _0x3348b0=[];return BPromise[_0x9066('0x55')](_0x336dac,function(_0x42ef47){return db[_0x9066('0x53')][_0x9066('0x4a')](_0x42ef47,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0xc72416})[_0x9066('0x28')](function(_0x578b64){_0x3348b0[_0x9066('0x5d')](_0x578b64[_0x9066('0x4d')]({'plain':!![]}));});})['then'](function(){return _0x3348b0;});});});}})['then'](function(_0x281713){return _0x281713;})['then'](respondWithResult(_0x1c01a5,null))[_0x9066('0x45')](handleError(_0x1c01a5,null));};exports[_0x9066('0x5e')]=function(_0x88a677,_0x355b2e){var _0x31b46b;return db['UserProfile'][_0x9066('0x49')]({'where':{'id':_0x88a677[_0x9066('0x54')]['id']},'attributes':['id',_0x9066('0x2c')]})[_0x9066('0x28')](handleEntityNotFound(_0x355b2e,null))[_0x9066('0x28')](function(_0xc3d624){if(_0xc3d624){_0x31b46b=_0xc3d624;return db['UserProfileSection'][_0x9066('0x29')]({'where':{'userProfileId':_0x88a677[_0x9066('0x54')]['id'],'sectionId':_0x88a677[_0x9066('0x33')]['ids']}});}})[_0x9066('0x28')](function(){return _0x31b46b;})[_0x9066('0x28')](respondWithStatusCode(_0x355b2e,null))[_0x9066('0x45')](handleError(_0x355b2e,null));};exports[_0x9066('0x5f')]=function(_0x576635,_0x19c1ba){var _0x5f2f05=[];var _0x2d6c20=[];return db[_0x9066('0x53')][_0x9066('0x43')]({'where':{'userProfileId':_0x576635[_0x9066('0x54')]['id']},'raw':!![]})['then'](function(_0x3081a3){_0x5f2f05=_['filter'](_0x3081a3,function(_0x546e49){return _0x546e49[_0x9066('0x60')]===0x1||_[_0x9066('0x61')]([0x3eb,0x709],_0x546e49['sectionId']);});if(!_[_0x9066('0x62')](_0x5f2f05)){return _[_0x9066('0x2d')](_0x5f2f05,function(_0x58d415){return _0x58d415[_0x9066('0x59')];});}else{return;}})['then'](function(_0x2e7bea){if(_0x2e7bea)_0x2d6c20=_0x2e7bea;if(_[_0x9066('0x61')](_0x2d6c20,0x64)){var _0x558411=_[_0x9066('0x49')](_0x5f2f05,{'sectionId':0x64});return hasDefaultDashboard(_0x558411)[_0x9066('0x28')](function(_0x272853){return _[_0x9066('0x2d')](_0x5f2f05,function(_0x1319a5){if(_0x1319a5[_0x9066('0x59')]===0x64){_0x1319a5[_0x9066('0x63')]=_0x272853;}return _0x1319a5;});});}else{return;}})[_0x9066('0x28')](function(_0x3ffe0d){if(_0x3ffe0d)_0x5f2f05=_0x3ffe0d;if(_[_0x9066('0x61')](_0x2d6c20,0x3eb)){var _0x3c5d11=_[_0x9066('0x49')](_0x5f2f05,{'sectionId':0x3eb});return getCustomDashboards(_0x3c5d11)[_0x9066('0x28')](function(_0x4d50bd){return _[_0x9066('0x2d')](_0x5f2f05,function(_0x43b0ad){if(_0x3c5d11['enabled']){if(_0x43b0ad[_0x9066('0x59')]===0x3eb){_0x43b0ad[_0x9066('0x63')]=_0x4d50bd;}}else{if(_0x43b0ad['sectionId']===0x64){_0x43b0ad[_0x9066('0x63')]=_0x4d50bd;}}return _0x43b0ad;});});}else{return;}})['then'](function(_0x57f23b){if(_0x57f23b)_0x5f2f05=_0x57f23b;if(_[_0x9066('0x61')](_0x2d6c20,0x709)){var _0x4a6a74=_['find'](_0x5f2f05,{'sectionId':0x709});return getPlugins(_0x4a6a74)['then'](function(_0x55536f){if(_0x4a6a74[_0x9066('0x60')]){return _[_0x9066('0x2d')](_0x5f2f05,function(_0x392f93){if(_0x392f93[_0x9066('0x59')]===0x709){_0x392f93[_0x9066('0x63')]=_0x55536f;}return _0x392f93;});}else{var _0x54de3f={'sectionId':0x76c,'enabled':0x1,'subsections':_0x55536f};var _0x42e638=_[_0x9066('0x2d')](_0x5f2f05);_0x42e638['push'](_0x54de3f);return _0x42e638;}});}else{return;}})[_0x9066('0x28')](function(_0x492972){if(_0x492972)_0x5f2f05=_0x492972;return _[_0x9066('0x3e')](_0x5f2f05,[_0x9066('0x60'),0x1]);})[_0x9066('0x28')](respondWithResult(_0x19c1ba,null))[_0x9066('0x45')](handleError(_0x19c1ba,null));};function hasDefaultDashboard(_0x28f2c7){var _0x156568=[0x65];return new BPromise(function(_0x18ef2b,_0x433083){try{if(_0x28f2c7['autoAssociation']){_0x18ef2b(_0x156568);}else{return db[_0x9066('0x57')][_0x9066('0x64')]({'where':{'sectionId':_0x28f2c7['id']},'raw':!![]})[_0x9066('0x28')](function(_0x5c4169){_0x5c4169?_0x18ef2b(_0x156568):_0x18ef2b();});}}catch(_0x238b84){_0x433083(_0x238b84);}});}function getCustomDashboards(_0x1f0734){var _0x417d35=[];return new BPromise(function(_0x5e2e19,_0x287e4c){try{if(_0x1f0734[_0x9066('0x56')]){return db[_0x9066('0x65')][_0x9066('0x43')]({'raw':!![]})['then'](function(_0x38dfae){_0x38dfae[_0x9066('0x66')](function(_0xf85d3d){_0x417d35[_0x9066('0x5d')](_0xf85d3d['id']+0x1869f);});_0x5e2e19(_0x417d35);});}else{return db[_0x9066('0x57')][_0x9066('0x43')]({'where':{'sectionId':_0x1f0734['id']},'raw':!![]})[_0x9066('0x28')](function(_0x735631){_0x735631[_0x9066('0x66')](function(_0x59cc0e){_0x417d35['push'](_0x59cc0e['resourceId']+0x1869f);});_0x5e2e19(_0x417d35);});}}catch(_0x4e16e4){_0x287e4c(_0x4e16e4);}});}function getPlugins(_0x2569e2){var _0x4b82cd=[];return new BPromise(function(_0x56c38f,_0x1df987){try{if(_0x2569e2[_0x9066('0x56')]){return db['Plugin'][_0x9066('0x43')]({'raw':!![]})[_0x9066('0x28')](function(_0x56c029){_0x56c029[_0x9066('0x66')](function(_0xd64127){_0x4b82cd['push'](_0xd64127['id']+0x15b38);});_0x56c38f(_0x4b82cd);});}else{return db[_0x9066('0x57')][_0x9066('0x43')]({'where':{'sectionId':_0x2569e2['id']},'raw':!![]})[_0x9066('0x28')](function(_0x12918f){_0x12918f[_0x9066('0x66')](function(_0x4b9e3a){_0x4b82cd[_0x9066('0x5d')](_0x4b9e3a[_0x9066('0x67')]+0x15b38);});_0x56c38f(_0x4b82cd);});}}catch(_0x1a20be){_0x1df987(_0x1a20be);}});}exports[_0x9066('0x68')]=function(_0x43b9be,_0xe5a794){return db[_0x9066('0x2e')]['find']({'where':{'id':_0x43b9be['params']['id']}})[_0x9066('0x28')](handleEntityNotFound(_0xe5a794,null))[_0x9066('0x28')](function(_0x4f7602){if(_0x4f7602){return db[_0x9066('0x51')][_0x9066('0x52')](function(_0x655f9c){return db[_0x9066('0x53')][_0x9066('0x43')]({'where':{'userProfileId':_0x43b9be['params']['id']},'attributes':['id'],'raw':!![]})[_0x9066('0x28')](function(_0x221f9b){if(_0x221f9b){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x43b9be[_0x9066('0x54')]['id'],'id':_[_0x9066('0x2d')](_0x221f9b,function(_0x1da6fa){return _0x1da6fa['id'];})},'transaction':_0x655f9c});}})[_0x9066('0x28')](function(_0xe9740){var _0x450089=_[_0x9066('0x2d')](_0x43b9be['body'],function(_0x2f227a){_0x2f227a['userProfileId']=_0x43b9be[_0x9066('0x54')]['id'];return _0x2f227a;});return db[_0x9066('0x53')][_0x9066('0x69')](_0x450089,{'raw':!![],'transaction':_0x655f9c});})[_0x9066('0x28')](function(_0x20a322){var _0x3f5064=_[_0x9066('0x3e')](_[_0x9066('0x2d')](_0x20a322,function(_0x1604dd){return _0x1604dd[_0x9066('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x3f5064){return db[_0x9066('0x53')]['findAll']({'where':{'userProfileId':_0x43b9be[_0x9066('0x54')]['id'],'sectionId':_['map'](_0x3f5064,function(_0x24d64c){return _0x24d64c[_0x9066('0x59')];})},'attributes':['id',_0x9066('0x59')],'raw':!![]})[_0x9066('0x28')](function(_0x1dafa4){var _0x494df2=_[_0x9066('0x2d')](_0x43b9be['body'],function(_0x38898a){_0x38898a[_0x9066('0x5a')]=_0x43b9be['params']['id'];return _0x38898a;});return db[_0x9066('0x57')]['bulkCreate'](_0x494df2,{'raw':!![],'transaction':_0x655f9c});});}})[_0x9066('0x45')](handleError(_0xe5a794,null));});}})[_0x9066('0x28')](function(_0x33409d){var _0x1e962a=_[_0x9066('0x2d')](_0x33409d,function(_0x10a70f){return _0x10a70f['get']({'plain':!![]});});})['then'](respondWithResult(_0xe5a794,null))[_0x9066('0x45')](handleError(_0xe5a794,null));};exports[_0x9066('0x6a')]=function(_0x5a2246,_0x15d843,_0x35f7c8){return db['UserProfile'][_0x9066('0x49')]({'where':{'id':_0x5a2246[_0x9066('0x54')]['id']}})[_0x9066('0x28')](handleEntityNotFound(_0x15d843,null))['then'](function(_0x4bd9b2){if(_0x4bd9b2){return _0x4bd9b2[_0x9066('0x6a')](_0x5a2246[_0x9066('0x33')][_0x9066('0x6b')]);}})[_0x9066('0x28')](respondWithStatusCode(_0x15d843,null))[_0x9066('0x45')](handleError(_0x15d843,null));};exports['getResources']=function(_0x3feaff,_0x5aa9da){var _0x1ff462={'raw':![],'where':{}};var _0x528e9a={};var _0x4c2a29={'count':0x0,'rows':[]};var _0x37bd35=_0x3feaff[_0x9066('0x33')][_0x9066('0x6c')];if(typeof _0x37bd35===_0x9066('0x6d')){throw new db[(_0x9066('0x6e'))][(_0x9066('0x6f'))]('Unknown\x20section');}var _0x1339bd=_0x3feaff[_0x9066('0x33')][_0x9066('0x70')]||![];var _0x46ee4a=getQueryModels(_0x37bd35,_0x1339bd);if(typeof _0x46ee4a[_0x9066('0x71')]===_0x9066('0x6d')){throw new db['Sequelize'][(_0x9066('0x6f'))]('Invalid\x20section\x20\x27'+_0x37bd35+'\x27');}var _0x47e931=[];if(!_[_0x9066('0x62')](_0x46ee4a[_0x9066('0x72')])){_0x47e931=_0x46ee4a[_0x9066('0x72')];}else{_0x47e931=[{'name':_0x37bd35}];}return db[_0x9066('0x2e')]['findOne']({'where':{'id':_0x3feaff['params']['id']}})[_0x9066('0x28')](handleEntityNotFound(_0x5aa9da,null))['then'](function(_0x54dc11){if(_0x54dc11){var _0x490147=[];for(var _0x29e338=0x0;_0x29e338<_0x47e931[_0x9066('0x38')];_0x29e338++){_0x490147[_0x9066('0x5d')](db['UserProfileSection'][_0x9066('0x64')]({'where':{'userProfileId':_0x54dc11['id'],'name':_0x47e931[_0x29e338][_0x9066('0x2c')]},'raw':!![]}));}return BPromise[_0x9066('0x73')](_0x490147);}})['then'](function(_0x1689a8){var _0xbd7512=_['filter'](_0x1689a8,function(_0x30edc7){return _0x30edc7?_0x30edc7:undefined;});var _0x277a50=_[_0x9066('0x3e')](_0x47e931,[_0x9066('0x74'),!![]]);var _0x17d11c=_['isEmpty'](_0xbd7512)&&_[_0x9066('0x62')](_0x277a50)?null:_['union'](_0x277a50,_0xbd7512);if(_0x17d11c){var _0x544b08=[];for(var _0x47afc0=0x0;_0x47afc0<_0x17d11c[_0x9066('0x38')];_0x47afc0++){var _0x55b7ea=_['find'](_0x47e931,function(_0x43263c){return _0x17d11c[_0x47afc0]?_0x43263c['name']===_0x17d11c[_0x47afc0]['name']:null;});if(_0x55b7ea){if(_0x17d11c[_0x47afc0][_0x9066('0x74')]){_0x544b08[_0x9066('0x5d')](getAllResources(_0x46ee4a[_0x9066('0x71')],_0x17d11c[_0x47afc0]));}else{if(!_0x17d11c[_0x47afc0][_0x9066('0x56')]){_0x544b08[_0x9066('0x5d')](getAllowedResources(_0x55b7ea,_0x17d11c[_0x47afc0],_0x46ee4a[_0x9066('0x71')]));}else{if(_0x55b7ea['model']){_0x544b08['push'](getAllFilteredResources(_0x55b7ea,_0x17d11c[_0x47afc0]));}}}}}return BPromise[_0x9066('0x73')](_0x544b08);}else{return null;}})[_0x9066('0x28')](function(_0xbb307d){var _0x44a13e=_0xbb307d;var _0x30fef2=null;if(_0x44a13e){_0x30fef2=_0x44a13e['length']===0x1?_0x44a13e[0x0]:null;}if(_0x30fef2||_0x44a13e){var _0xc5b823=db[_0x46ee4a[_0x9066('0x71')]][_0x9066('0x2f')];_0x528e9a[_0x9066('0x32')]=_[_0x9066('0x47')](_0xc5b823);_0x528e9a[_0x9066('0x33')]=_['keys'](_0x3feaff[_0x9066('0x33')]);_0x528e9a[_0x9066('0x34')]=_[_0x9066('0x35')](_0x528e9a['model'],_0x528e9a[_0x9066('0x33')]);_0x1ff462[_0x9066('0x36')]=_[_0x9066('0x35')](_0x528e9a['model'],qs[_0x9066('0x37')](_0x3feaff[_0x9066('0x33')]['fields']));_0x1ff462[_0x9066('0x36')]=_0x1ff462[_0x9066('0x36')][_0x9066('0x38')]?_0x1ff462[_0x9066('0x36')]:_0x528e9a[_0x9066('0x32')];if(!_0x3feaff[_0x9066('0x33')]['hasOwnProperty'](_0x9066('0x39'))){_0x1ff462['limit']=qs[_0x9066('0x22')](_0x3feaff['query'][_0x9066('0x22')]);_0x1ff462[_0x9066('0x21')]=qs['offset'](_0x3feaff[_0x9066('0x33')][_0x9066('0x21')]);}_0x1ff462['order']=qs['sort'](_0x3feaff[_0x9066('0x33')][_0x9066('0x3b')]);_0x1ff462[_0x9066('0x3c')]=qs[_0x9066('0x34')](_[_0x9066('0x3d')](_0x3feaff[_0x9066('0x33')],_0x528e9a['filters']));if(_0x3feaff[_0x9066('0x33')][_0x9066('0x3e')]){_0x1ff462[_0x9066('0x3c')]=_[_0x9066('0x3f')](_0x1ff462['where'],{'$or':_['map'](_0xc5b823,function(_0x2d7c51){if(_0x2d7c51[_0x9066('0x30')][_0x9066('0x31')]!==_0x9066('0x40')){var _0x54cfdb={};_0x54cfdb[_0x2d7c51[_0x9066('0x75')]]={'$like':'%'+_0x3feaff[_0x9066('0x33')][_0x9066('0x3e')]+'%'};return _0x54cfdb;}})});}var _0x1e9de9=[];if(_0x30fef2){var _0x2b579d=_[_0x9066('0x49')](_0x47e931,[_0x9066('0x2c'),_0x30fef2['name']]);if(_0x2b579d[_0x9066('0x75')]){var _0x579126={};if(_0x46ee4a[_0x9066('0x71')]==='AnalyticExtractedReport'){_0x579126[_0x2b579d[_0x9066('0x76')]]=_[_0x9066('0x2d')](_0x30fef2['associatedResources'],'id');}else{_0x579126[_0x2b579d[_0x9066('0x76')]]=_0x30fef2['associatedResources'];}_0x1e9de9['push'](_0x579126);}else{_0x1ff462[_0x9066('0x3c')]['id']=_0x30fef2['associatedResources'];}}else{for(var _0xd0138b=0x0;_0xd0138b<_0x44a13e[_0x9066('0x38')];_0xd0138b++){var _0x2b579d=_['find'](_0x47e931,[_0x9066('0x2c'),_0x44a13e[_0xd0138b][_0x9066('0x2c')]]);if(_0x2b579d[_0x9066('0x75')]){var _0x579126={};_0x579126[_0x2b579d[_0x9066('0x76')]]=_0x44a13e[_0xd0138b][_0x9066('0x77')];_0x1e9de9['push'](_0x579126);}else{if(!_0x1ff462[_0x9066('0x3c')]['id'])_0x1ff462[_0x9066('0x3c')]['id']=[];_0x44a13e[_0xd0138b][_0x9066('0x77')][_0x9066('0x66')](function(_0x29264b){_0x1ff462[_0x9066('0x3c')]['id'][_0x9066('0x5d')](_0x29264b);});}}}if(!_[_0x9066('0x62')](_0x1e9de9)){_0x1ff462['where']=_[_0x9066('0x3f')](_0x1ff462[_0x9066('0x3c')],{'$and':{'$or':_0x1e9de9}});}_0x1ff462=_['merge']({},_0x1ff462,_0x3feaff[_0x9066('0x41')]);if(_0x30fef2&&!_0x30fef2['autoAssociation']&&_0x46ee4a['childModel']===_0x9066('0x78')){if(_0x3feaff['query'][_0x9066('0x48')]){_0x1ff462['include']=[{'all':!![]}];}return db[_0x46ee4a[_0x9066('0x71')]][_0x9066('0x43')](_0x1ff462)[_0x9066('0x28')](function(_0x1fb5e1){var _0x59519a=[];_0x1fb5e1[_0x9066('0x66')](function(_0x4108d7){var _0x1041d1;switch(_0x4108d7['reportType']){case _0x9066('0x79'):_0x1041d1=_['find'](_0x30fef2[_0x9066('0x77')],function(_0x422a58){return _0x422a58['id']===_0x4108d7[_0x9066('0x7a')]&&_0x422a58[_0x9066('0x30')]===_0x9066('0x7b');});break;case'custom':_0x1041d1=_[_0x9066('0x49')](_0x30fef2[_0x9066('0x77')],function(_0xd20044){return _0xd20044['id']===_0x4108d7[_0x9066('0x7a')]&&_0xd20044['type']===_0x9066('0x7c');});break;}if(_0x1041d1)_0x59519a[_0x9066('0x5d')](_0x4108d7);});_0x4c2a29[_0x9066('0x20')]=_0x59519a[_0x9066('0x38')];_0x4c2a29[_0x9066('0x44')]=_0x59519a;return _0x4c2a29;});}else{return db[_0x46ee4a[_0x9066('0x71')]][_0x9066('0x20')]({'where':_0x1ff462[_0x9066('0x3c')]})[_0x9066('0x28')](function(_0x3496cd){_0x4c2a29['count']=_0x3496cd;if(_0x3feaff[_0x9066('0x33')]['includeAll']){if(_0x46ee4a[_0x9066('0x71')]===_0x9066('0x7d')){_0x1ff462[_0x9066('0x42')]=[{'model':db[_0x9066('0x7e')],'as':_0x9066('0x7f'),'attributes':['id',_0x9066('0x2c'),_0x9066('0x80')],'required':_0x3feaff['query'][_0x9066('0x81')]?!![]:![]},{'model':db['Tag'],'as':_0x9066('0x82'),'attributes':['id',_0x9066('0x2c'),_0x9066('0x80')],'through':_0x3feaff[_0x9066('0x33')]['tag']?{'attributes':[],'where':{'TagId':_0x3feaff[_0x9066('0x33')]['tag']||undefined}}:{},'required':_0x3feaff[_0x9066('0x33')]['tag']?!![]:![]}];}else{_0x1ff462['include']=[{'all':!![]}];}}return db[_0x46ee4a[_0x9066('0x71')]][_0x9066('0x43')](_0x1ff462);})['then'](function(_0x5a2a2a){_0x4c2a29[_0x9066('0x44')]=_0x5a2a2a;return _0x4c2a29;});}}else{return _0x4c2a29;}})[_0x9066('0x28')](respondWithFilteredResult(_0x5aa9da,_0x1ff462))[_0x9066('0x45')](handleError(_0x5aa9da,null));};function getAllResources(_0x3d8e4f,_0x327ecd){return new BPromise(function(_0x207b18,_0x3aa2f7){if(_0x327ecd){var _0xe37d3e=_0x327ecd[_0x9066('0x3e')]?{[_0x327ecd[_0x9066('0x3e')]['field']]:_0x327ecd[_0x9066('0x3e')][_0x9066('0x83')]}:undefined;return db[_0x3d8e4f]['findAll']({'where':_0xe37d3e,'raw':!![]})[_0x9066('0x28')](function(_0x5e07c3){_0x327ecd[_0x9066('0x77')]=_[_0x9066('0x2d')](_0x5e07c3,'id');_0x207b18(_0x327ecd);})[_0x9066('0x45')](function(_0x4e123e){_0x3aa2f7(_0x4e123e);});}else{_0x207b18(null);}});}function getAllFilteredResources(_0xd2852,_0x3f96f2){return new BPromise(function(_0x42cc4b,_0x4d85a0){var _0x2f145b=_0xd2852[_0x9066('0x3e')]?{[_0xd2852[_0x9066('0x3e')][_0x9066('0x75')]]:_0xd2852[_0x9066('0x3e')][_0x9066('0x83')]}:undefined;return db[_0xd2852[_0x9066('0x32')]][_0x9066('0x43')]({'where':_0x2f145b,'raw':!![]})[_0x9066('0x28')](function(_0x740dab){_0x3f96f2[_0x9066('0x77')]=_[_0x9066('0x2d')](_0x740dab,function(_0x23587d){return _0x23587d['name'];});_0x42cc4b(_0x3f96f2);})['catch'](function(_0x57a735){_0x4d85a0(_0x57a735);});});}function getAllowedResources(_0x27ad16,_0x5018e0,_0x5597bf){return new BPromise(function(_0x4a1253,_0x16353e){if(_0x5018e0){return db[_0x9066('0x57')]['findAll']({'where':{'sectionId':_0x5018e0['id']},'raw':!![]})['then'](function(_0x61d4dd){if(_0x27ad16[_0x9066('0x75')]&&_0x27ad16['field']!=='id'){_0x5018e0[_0x9066('0x77')]=_[_0x9066('0x2d')](_0x61d4dd,function(_0x39a5d2){return _0x39a5d2[_0x27ad16[_0x9066('0x75')]];});}else{if(_0x5597bf==='AnalyticExtractedReport'){_0x5018e0[_0x9066('0x77')]=_['map'](_0x61d4dd,function(_0x4d2b9a){return{'id':_0x4d2b9a['resourceId'],'type':_0x4d2b9a[_0x9066('0x30')]};});}else{_0x5018e0['associatedResources']=_[_0x9066('0x2d')](_0x61d4dd,function(_0x566028){return _0x566028[_0x9066('0x67')];});}}_0x4a1253(_0x5018e0);})[_0x9066('0x45')](function(_0x5242ea){_0x16353e(_0x5242ea);});}else{_0x4a1253(null);}});}function getQueryModels(_0x596681,_0x33ab87){var _0x5861a9=_0x596681[_0x9066('0x84')]();var _0x379ef0={'childModel':undefined,'parentSections':[]};switch(_0x5861a9){case _0x9066('0x85'):_0x379ef0[_0x9066('0x71')]=_0x9066('0x86');break;case _0x9066('0x87'):_0x379ef0[_0x9066('0x71')]=_0x9066('0x88');break;case _0x9066('0x89'):_0x379ef0['childModel']=_0x9066('0x8a');_0x379ef0[_0x9066('0x72')]=[{'name':_0x9066('0x8b'),'field':_0x9066('0x2c'),'foreignKey':_0x9066('0x8c')}];break;case _0x9066('0x8d'):_0x379ef0[_0x9066('0x71')]='JscriptyProject';break;case _0x9066('0x8e'):_0x379ef0[_0x9066('0x71')]=_0x9066('0x7d');_0x379ef0[_0x9066('0x72')]=[{'name':'Lists','field':'id','foreignKey':_0x9066('0x8f')}];break;case _0x9066('0x90'):_0x379ef0['childModel']='CmList';break;case _0x9066('0x91'):_0x379ef0['childModel']='CmCompany';break;case _0x9066('0x92'):_0x379ef0[_0x9066('0x71')]=_0x9066('0x93');break;case _0x9066('0x94'):_0x379ef0[_0x9066('0x71')]='ChatQueue';break;case _0x9066('0x95'):_0x379ef0[_0x9066('0x71')]=_0x9066('0x96');break;case'faxqueues':_0x379ef0['childModel']='FaxQueue';break;case _0x9066('0x97'):_0x379ef0[_0x9066('0x71')]=_0x9066('0x98');break;case _0x9066('0x99'):case'internalroutes':case'outboundroutes':_0x379ef0[_0x9066('0x71')]=_0x9066('0x9a');break;case _0x9066('0x9b'):_0x379ef0[_0x9066('0x71')]='VoiceContext';break;case _0x9066('0x9c'):_0x379ef0['childModel']=_0x9066('0x9d');break;case'voicerecordings':_0x379ef0[_0x9066('0x71')]=_0x9066('0x9e');_0x379ef0[_0x9066('0x72')]=[{'name':_0x9066('0x9f'),'field':'name','foreignKey':'membername','model':_0x9066('0xa0'),'filter':{'field':'role','value':['agent']}},{'name':_0x9066('0xa1'),'field':'name','foreignKey':_0x9066('0xa2'),'model':_0x9066('0xa0'),'filter':{'field':_0x9066('0xa3'),'value':['telephone']}},{'name':_0x9066('0xa4'),'field':'name','foreignKey':'queue','model':_0x9066('0xa5'),'filter':{'field':_0x9066('0x30'),'value':[_0x9066('0xa6')]}},{'name':_0x9066('0xa7'),'field':_0x9066('0x2c'),'foreignKey':'queue','model':_0x9066('0xa5'),'filter':{'field':_0x9066('0x30'),'value':[_0x9066('0xa8')]}}];break;case _0x9066('0xa9'):_0x379ef0[_0x9066('0x71')]=_0x9066('0xaa');break;case _0x9066('0xab'):_0x379ef0['childModel']='VoiceChanSpy';break;case _0x9066('0xac'):_0x379ef0[_0x9066('0x71')]='VoicePrefix';break;case _0x9066('0xad'):_0x379ef0[_0x9066('0x71')]=_0x9066('0xae');break;case _0x9066('0xaf'):_0x379ef0[_0x9066('0x71')]=_0x9066('0xb0');break;case _0x9066('0xb1'):_0x379ef0[_0x9066('0x71')]=_0x9066('0xb2');break;case _0x9066('0xb3'):_0x379ef0[_0x9066('0x71')]=_0x9066('0xb4');break;case _0x9066('0xb5'):_0x379ef0[_0x9066('0x71')]=_0x9066('0xb6');break;case _0x9066('0xb7'):_0x379ef0[_0x9066('0x71')]='OpenchannelAccount';break;case _0x9066('0xb8'):_0x379ef0[_0x9066('0x71')]=_0x9066('0xb9');break;case'smsaccounts':_0x379ef0[_0x9066('0x71')]=_0x9066('0xba');break;case'whatsappqueues':_0x379ef0[_0x9066('0x71')]=_0x9066('0xbb');break;case _0x9066('0xbc'):_0x379ef0['childModel']='WhatsappAccount';break;case'teams':_0x379ef0[_0x9066('0x71')]=_0x9066('0xbd');break;case _0x9066('0xbe'):case _0x9066('0xbf'):_0x379ef0['childModel']=_0x9066('0xa5');if(_0x33ab87){_0x379ef0[_0x9066('0x72')]=[{'name':_0x9066('0xa4')},{'name':_0x9066('0xa7')}];}break;case'users':case'agents':case'telephones':_0x379ef0['childModel']=_0x9066('0xa0');if(_0x33ab87){_0x379ef0[_0x9066('0x72')]=[{'name':_0x9066('0xc0'),'filter':{'field':_0x9066('0xa3'),'value':['admin',_0x9066('0xc1')]},'ignore':!![]},{'name':_0x9066('0x9f')},{'name':'Telephones'}];}break;case _0x9066('0xc2'):_0x379ef0[_0x9066('0x71')]=_0x9066('0xc3');break;case'salesforceaccounts':_0x379ef0[_0x9066('0x71')]=_0x9066('0xc4');break;case _0x9066('0xc5'):_0x379ef0['childModel']=_0x9066('0xc6');break;case _0x9066('0xc7'):_0x379ef0[_0x9066('0x71')]=_0x9066('0xc8');break;case'deskaccounts':_0x379ef0[_0x9066('0x71')]=_0x9066('0xc9');break;case _0x9066('0xca'):_0x379ef0['childModel']=_0x9066('0xcb');break;case _0x9066('0xcc'):_0x379ef0[_0x9066('0x71')]=_0x9066('0xa0');break;case'cannedanswers':_0x379ef0[_0x9066('0x71')]=_0x9066('0xcd');break;case _0x9066('0xce'):_0x379ef0[_0x9066('0x71')]=_0x9066('0xcf');break;case _0x9066('0xd0'):_0x379ef0[_0x9066('0x71')]=_0x9066('0x65');break;case _0x9066('0xd1'):_0x379ef0['childModel']=_0x9066('0xd2');break;case _0x9066('0xd3'):_0x379ef0['childModel']=_0x9066('0xd4');break;case'scheduler':_0x379ef0[_0x9066('0x71')]=_0x9066('0xd5');break;case _0x9066('0xd6'):_0x379ef0['childModel']=_0x9066('0xd7');break;case'tags':_0x379ef0['childModel']=_0x9066('0x7e');break;case _0x9066('0xd8'):_0x379ef0[_0x9066('0x71')]=_0x9066('0xd9');break;case _0x9066('0xda'):_0x379ef0[_0x9066('0x71')]=_0x9066('0xdb');break;case _0x9066('0xdc'):_0x379ef0[_0x9066('0x71')]=_0x9066('0xdd');break;case _0x9066('0xde'):_0x379ef0[_0x9066('0x71')]=_0x9066('0xdf');break;case'plugins':_0x379ef0['childModel']=_0x9066('0xe0');break;case _0x9066('0xe1'):_0x379ef0[_0x9066('0x71')]=_0x9066('0x78');_0x379ef0[_0x9066('0x72')]=[{'name':_0x9066('0xe2'),'field':'id','foreignKey':_0x9066('0x7a')}];break;case'metrics':_0x379ef0[_0x9066('0x71')]=_0x9066('0xe3');break;case _0x9066('0xbc'):_0x379ef0[_0x9066('0x71')]=_0x9066('0xe4');break;default:return _0x379ef0;}return _0x379ef0;} \ No newline at end of file +var _0xb76a=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','findAll','show','params','includeAll','include','find','catch','create','body','get','omit','createdAt','updatedAt','sequelize','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','Resources','update','describe','addSections','userProfileId','push','ids','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','getResources','undefined','ValidationError','Unknown\x20section','mergeResources','childModel','Sequelize','parentSections','ignore','all','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','custom','CustomReports','rows','CmContact','Tags','color','tag','Tag','value','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','companies','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','User','agent','membername','telephone','queue','VoiceQueue','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','voiceprefixes','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','VoiceQueues','role','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','intervals','Interval','pauses','scheduler','Schedule','sounds','Sound','tags','templates','Template','triggers','Trigger','trunks','Trunk','variables','plugins','Reports','AnalyticMetric','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb76a,0x19b));var _0xab76=function(_0x4586b7,_0x11e879){_0x4586b7=_0x4586b7-0x0;var _0x3821c2=_0xb76a[_0x4586b7];return _0x3821c2;};'use strict';var pdf=require(_0xab76('0x0'));var emlformat=require(_0xab76('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xab76('0x2'));var jsonpatch=require(_0xab76('0x3'));var rp=require(_0xab76('0x4'));var moment=require(_0xab76('0x5'));var BPromise=require(_0xab76('0x6'));var Mustache=require('mustache');var util=require(_0xab76('0x7'));var path=require('path');var sox=require(_0xab76('0x8'));var csv=require('to-csv');var ejs=require(_0xab76('0x9'));var fs=require('fs');var _=require(_0xab76('0xa'));var squel=require('squel');var crypto=require(_0xab76('0xb'));var jsforce=require(_0xab76('0xc'));var deskjs=require(_0xab76('0xd'));var toCsv=require(_0xab76('0xe'));var querystring=require(_0xab76('0xf'));var Papa=require('papaparse');var Redis=require(_0xab76('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xab76('0x11'));var as=require(_0xab76('0x12'));var hardwareService=require(_0xab76('0x13'));var logger=require('../../config/logger')(_0xab76('0x14'));var utils=require(_0xab76('0x15'));var config=require(_0xab76('0x16'));var db=require('../../mysqldb')['db'];config[_0xab76('0x17')]=_[_0xab76('0x18')](config[_0xab76('0x17')],{'host':_0xab76('0x19'),'port':0x18eb});var socket=require(_0xab76('0x1a'))(new Redis(config[_0xab76('0x17')]));require(_0xab76('0x1b'))[_0xab76('0x1c')](socket);function respondWithStatusCode(_0x2dd301,_0x5d1b37){_0x5d1b37=_0x5d1b37||0xcc;return function(_0x4e0abd){if(_0x4e0abd){return _0x2dd301[_0xab76('0x1d')](_0x5d1b37);}return _0x2dd301[_0xab76('0x1e')](_0x5d1b37)[_0xab76('0x1f')]();};}function respondWithResult(_0x5f4a8a,_0x15e3a9){_0x15e3a9=_0x15e3a9||0xc8;return function(_0x85af8f){if(_0x85af8f){return _0x5f4a8a[_0xab76('0x1e')](_0x15e3a9)[_0xab76('0x20')](_0x85af8f);}};}function respondWithFilteredResult(_0xe1bcb9,_0x25c7d6){return function(_0x431072){if(_0x431072){var _0x5a174e=_0x431072['count'],_0x3b58a7=_0x25c7d6[_0xab76('0x21')],_0x52569f=_0x25c7d6['offset']+_0x25c7d6[_0xab76('0x22')],_0xf1bc24;if(_0x52569f>=_0x5a174e){_0x52569f=_0x5a174e;_0xf1bc24=0xc8;}else{_0xf1bc24=0xce;}_0xe1bcb9[_0xab76('0x1e')](_0xf1bc24);return _0xe1bcb9['set'](_0xab76('0x23'),_0x3b58a7+'-'+_0x52569f+'/'+_0x5a174e)[_0xab76('0x20')](_0x431072);}return null;};}function patchUpdates(_0x5ad377){return function(_0x56e3ba){try{jsonpatch[_0xab76('0x24')](_0x56e3ba,_0x5ad377,!![]);}catch(_0xe30c69){return BPromise[_0xab76('0x25')](_0xe30c69);}return _0x56e3ba[_0xab76('0x26')]();};}function saveUpdates(_0x1776f0,_0x2558d3){return function(_0x1497fa){if(_0x1497fa){return _0x1497fa['update'](_0x1776f0)[_0xab76('0x27')](function(_0x1f1779){return _0x1f1779;});}return null;};}function removeEntity(_0x4b3d5b,_0x488b4f){return function(_0x2ebc35){if(_0x2ebc35){return _0x2ebc35[_0xab76('0x28')]()[_0xab76('0x27')](function(){_0x4b3d5b['status'](0xcc)[_0xab76('0x1f')]();});}};}function handleEntityNotFound(_0x4cde1c,_0x229e3c){return function(_0x435011){if(!_0x435011){_0x4cde1c[_0xab76('0x1d')](0x194);}return _0x435011;};}function handleError(_0x1c65a1,_0x4a41b5){_0x4a41b5=_0x4a41b5||0x1f4;return function(_0x339a2b){logger[_0xab76('0x29')](_0x339a2b[_0xab76('0x2a')]);if(_0x339a2b['name']){delete _0x339a2b[_0xab76('0x2b')];}_0x1c65a1[_0xab76('0x1e')](_0x4a41b5)[_0xab76('0x2c')](_0x339a2b);};}exports['index']=function(_0x87772d,_0x4701c2){var _0x46fe35={},_0xa103a9={},_0x4ba6b3={'count':0x0,'rows':[]};var _0x40960e=_[_0xab76('0x2d')](db[_0xab76('0x2e')][_0xab76('0x2f')],function(_0x1651ba){return{'name':_0x1651ba[_0xab76('0x30')],'type':_0x1651ba[_0xab76('0x31')][_0xab76('0x32')]};});_0xa103a9[_0xab76('0x33')]=_[_0xab76('0x2d')](_0x40960e,_0xab76('0x2b'));_0xa103a9[_0xab76('0x34')]=_[_0xab76('0x35')](_0x87772d[_0xab76('0x34')]);_0xa103a9[_0xab76('0x36')]=_[_0xab76('0x37')](_0xa103a9[_0xab76('0x33')],_0xa103a9['query']);_0x46fe35[_0xab76('0x38')]=_[_0xab76('0x37')](_0xa103a9[_0xab76('0x33')],qs[_0xab76('0x39')](_0x87772d[_0xab76('0x34')][_0xab76('0x39')]));_0x46fe35[_0xab76('0x38')]=_0x46fe35[_0xab76('0x38')][_0xab76('0x3a')]?_0x46fe35[_0xab76('0x38')]:_0xa103a9[_0xab76('0x33')];if(!_0x87772d[_0xab76('0x34')][_0xab76('0x3b')](_0xab76('0x3c'))){_0x46fe35[_0xab76('0x22')]=qs['limit'](_0x87772d[_0xab76('0x34')][_0xab76('0x22')]);_0x46fe35[_0xab76('0x21')]=qs[_0xab76('0x21')](_0x87772d[_0xab76('0x34')][_0xab76('0x21')]);}_0x46fe35[_0xab76('0x3d')]=qs['sort'](_0x87772d[_0xab76('0x34')][_0xab76('0x3e')]);_0x46fe35[_0xab76('0x3f')]=qs[_0xab76('0x36')](_[_0xab76('0x40')](_0x87772d['query'],_0xa103a9[_0xab76('0x36')]),_0x40960e);if(_0x87772d[_0xab76('0x34')][_0xab76('0x41')]){_0x46fe35[_0xab76('0x3f')]=_[_0xab76('0x42')](_0x46fe35[_0xab76('0x3f')],{'$or':_[_0xab76('0x2d')](_0x40960e,function(_0x1f828a){if(_0x1f828a[_0xab76('0x31')]!==_0xab76('0x43')){var _0x1b7fdc={};_0x1b7fdc[_0x1f828a['name']]={'$like':'%'+_0x87772d[_0xab76('0x34')]['filter']+'%'};return _0x1b7fdc;}})});}_0x46fe35=_[_0xab76('0x42')]({},_0x46fe35,_0x87772d[_0xab76('0x44')]);var _0x565b1c={'where':_0x46fe35[_0xab76('0x3f')]};return db[_0xab76('0x2e')][_0xab76('0x45')](_0x565b1c)[_0xab76('0x27')](function(_0xe7ada3){_0x4ba6b3['count']=_0xe7ada3;if(_0x87772d[_0xab76('0x34')]['includeAll']){_0x46fe35['include']=[{'all':!![]}];}return db[_0xab76('0x2e')][_0xab76('0x46')](_0x46fe35);})[_0xab76('0x27')](function(_0x49b11a){_0x4ba6b3['rows']=_0x49b11a;return _0x4ba6b3;})[_0xab76('0x27')](respondWithFilteredResult(_0x4701c2,_0x46fe35))['catch'](handleError(_0x4701c2,null));};exports[_0xab76('0x47')]=function(_0x481d42,_0x22753e){var _0x470f2c={'raw':![],'where':{'id':_0x481d42[_0xab76('0x48')]['id']}},_0x8a6958={};_0x8a6958[_0xab76('0x33')]=_[_0xab76('0x35')](db[_0xab76('0x2e')][_0xab76('0x2f')]);_0x8a6958[_0xab76('0x34')]=_[_0xab76('0x35')](_0x481d42[_0xab76('0x34')]);_0x8a6958['filters']=_[_0xab76('0x37')](_0x8a6958[_0xab76('0x33')],_0x8a6958[_0xab76('0x34')]);_0x470f2c[_0xab76('0x38')]=_[_0xab76('0x37')](_0x8a6958[_0xab76('0x33')],qs[_0xab76('0x39')](_0x481d42[_0xab76('0x34')][_0xab76('0x39')]));_0x470f2c[_0xab76('0x38')]=_0x470f2c['attributes']['length']?_0x470f2c[_0xab76('0x38')]:_0x8a6958[_0xab76('0x33')];if(_0x481d42['query'][_0xab76('0x49')]){_0x470f2c[_0xab76('0x4a')]=[{'all':!![]}];}_0x470f2c=_['merge']({},_0x470f2c,_0x481d42[_0xab76('0x44')]);return db[_0xab76('0x2e')][_0xab76('0x4b')](_0x470f2c)[_0xab76('0x27')](handleEntityNotFound(_0x22753e,null))[_0xab76('0x27')](respondWithResult(_0x22753e,null))[_0xab76('0x4c')](handleError(_0x22753e,null));};exports[_0xab76('0x4d')]=function(_0x7e3049,_0x39562c){return db[_0xab76('0x2e')]['create'](_0x7e3049[_0xab76('0x4e')],{})['then'](respondWithResult(_0x39562c,0xc9))[_0xab76('0x4c')](handleError(_0x39562c,null));};exports['clone']=function(_0x924e58,_0x50b4ee){var _0x2e7bfa={'where':{'id':_0x924e58[_0xab76('0x48')]['id']}},_0x39447a={};_0x39447a[_0xab76('0x33')]=_[_0xab76('0x35')](db[_0xab76('0x2e')][_0xab76('0x2f')]);_0x2e7bfa[_0xab76('0x38')]=_[_0xab76('0x37')](_0x39447a[_0xab76('0x33')],qs[_0xab76('0x39')](_0x924e58[_0xab76('0x34')]['fields']));_0x2e7bfa[_0xab76('0x38')]=_0x2e7bfa[_0xab76('0x38')][_0xab76('0x3a')]?_0x2e7bfa['attributes']:_0x39447a['model'];if(_0x924e58[_0xab76('0x34')]['includeAll']){_0x2e7bfa[_0xab76('0x4a')]=[{'all':!![]}];}_0x2e7bfa=_[_0xab76('0x42')]({},_0x2e7bfa,_0x924e58[_0xab76('0x44')]);return db[_0xab76('0x2e')][_0xab76('0x4b')](_0x2e7bfa)['then'](handleEntityNotFound(_0x50b4ee,null))[_0xab76('0x27')](function(_0x358981){if(_0x358981){var _0x2d2de4=_0x358981[_0xab76('0x4f')]({'plain':!![]});_0x2d2de4=qs[_0xab76('0x50')](_0x2d2de4,['id',_0xab76('0x51'),_0xab76('0x52'),'crudPermissions']);_0x924e58[_0xab76('0x4e')]=_[_0xab76('0x50')](_0x924e58['body'],['id','createdAt',_0xab76('0x52')]);return db[_0xab76('0x53')]['transaction'](function(_0x41148a){return db['UserProfile'][_0xab76('0x4d')](_[_0xab76('0x42')](_0x2d2de4,_0x924e58[_0xab76('0x4e')]),{'include':_0x924e58[_0xab76('0x34')][_0xab76('0x49')]?[{'all':!![]}]:undefined,'transaction':_0x41148a})[_0xab76('0x27')](function(_0x72fdbb){var _0x8dcd37=_0x72fdbb[_0xab76('0x4f')]({'plain':!![]});return db[_0xab76('0x54')][_0xab76('0x46')]({'where':{'userProfileId':_0x924e58[_0xab76('0x48')]['id']},'raw':!![]})[_0xab76('0x27')](function(_0x4e6c5d){if(_0x4e6c5d){return BPromise[_0xab76('0x55')](_0x4e6c5d,function(_0x327a18){return new BPromise(function(_0x5b7fc7,_0x18b9c5){if(_0x327a18[_0xab76('0x56')]===null||_0x327a18[_0xab76('0x56')]===0x1)_0x5b7fc7(null);return db[_0xab76('0x57')][_0xab76('0x46')]({'where':{'sectionId':_0x327a18['id']},'raw':!![]})[_0xab76('0x27')](function(_0x291f26){var _0x706136=_[_0xab76('0x2d')](_0x291f26,function(_0x5073cd){return qs['omit'](_0x5073cd,['id',_0xab76('0x51'),_0xab76('0x52'),_0xab76('0x58')]);});_0x5b7fc7(_0x706136);})[_0xab76('0x4c')](function(_0x35e919){_0x18b9c5(_0x35e919);});})['then'](function(_0x1bf355){var _0x256759=qs[_0xab76('0x50')](_0x327a18,['id','createdAt',_0xab76('0x52')]);_0x256759['userProfileId']=_0x8dcd37['id'];if(_0x1bf355)_0x256759['Resources']=_0x1bf355;return _0x256759;})['then'](function(_0x17a249){return db['UserProfileSection'][_0xab76('0x4d')](_0x17a249,{'include':[{'model':db[_0xab76('0x57')],'as':_0xab76('0x59')}],'raw':!![],'transaction':_0x41148a});});})[_0xab76('0x27')](function(){return _0x8dcd37;});}});});});}})[_0xab76('0x27')](respondWithResult(_0x50b4ee,0xc9))[_0xab76('0x4c')](handleError(_0x50b4ee,null));};exports[_0xab76('0x5a')]=function(_0x559be8,_0x1205bf){if(_0x559be8[_0xab76('0x4e')]['id']){delete _0x559be8[_0xab76('0x4e')]['id'];}return db[_0xab76('0x2e')]['find']({'where':{'id':_0x559be8[_0xab76('0x48')]['id']}})[_0xab76('0x27')](handleEntityNotFound(_0x1205bf,null))[_0xab76('0x27')](saveUpdates(_0x559be8['body'],null))[_0xab76('0x27')](respondWithResult(_0x1205bf,null))[_0xab76('0x4c')](handleError(_0x1205bf,null));};exports['destroy']=function(_0x4c2041,_0x4ba1a6){return db[_0xab76('0x2e')][_0xab76('0x4b')]({'where':{'id':_0x4c2041['params']['id']}})[_0xab76('0x27')](handleEntityNotFound(_0x4ba1a6,null))[_0xab76('0x27')](removeEntity(_0x4ba1a6,null))[_0xab76('0x4c')](handleError(_0x4ba1a6,null));};exports[_0xab76('0x5b')]=function(_0x3ca64b,_0x163091){return db[_0xab76('0x2e')][_0xab76('0x5b')]()[_0xab76('0x27')](respondWithResult(_0x163091,null))[_0xab76('0x4c')](handleError(_0x163091,null));};exports[_0xab76('0x5c')]=function(_0x4d028a,_0x25658a){var _0x31d372=_0x4d028a[_0xab76('0x4e')];return db[_0xab76('0x2e')]['find']({'where':{'id':_0x4d028a[_0xab76('0x48')]['id']}})['then'](handleEntityNotFound(_0x25658a,null))[_0xab76('0x27')](function(_0x426554){if(_0x426554){return db[_0xab76('0x53')]['transaction'](function(_0x5b1049){return db['UserProfileSection'][_0xab76('0x28')]({'where':{'userProfileId':_0x4d028a['params']['id'],'sectionId':_[_0xab76('0x2d')](_0x31d372,function(_0x35bafd){return _0x35bafd['sectionId'];})},'transaction':_0x5b1049})[_0xab76('0x27')](function(){var _0x111eeb=_[_0xab76('0x2d')](_0x31d372,function(_0x3b9ee0){_0x3b9ee0[_0xab76('0x5d')]=_0x4d028a['params']['id'];return _0x3b9ee0;});var _0x4fe6ed=[];return BPromise[_0xab76('0x55')](_0x111eeb,function(_0x1df337){return db[_0xab76('0x54')][_0xab76('0x4d')](_0x1df337,{'include':[{'model':db[_0xab76('0x57')],'as':'Resources'}],'raw':!![],'transaction':_0x5b1049})['then'](function(_0x5f3e14){_0x4fe6ed[_0xab76('0x5e')](_0x5f3e14[_0xab76('0x4f')]({'plain':!![]}));});})[_0xab76('0x27')](function(){return _0x4fe6ed;});});});}})['then'](function(_0x5d747a){return _0x5d747a;})['then'](respondWithResult(_0x25658a,null))[_0xab76('0x4c')](handleError(_0x25658a,null));};exports['removeSections']=function(_0x333b9a,_0x26a36c){var _0x3b0186;return db[_0xab76('0x2e')][_0xab76('0x4b')]({'where':{'id':_0x333b9a[_0xab76('0x48')]['id']},'attributes':['id',_0xab76('0x2b')]})[_0xab76('0x27')](handleEntityNotFound(_0x26a36c,null))[_0xab76('0x27')](function(_0x34cd85){if(_0x34cd85){_0x3b0186=_0x34cd85;return db[_0xab76('0x54')][_0xab76('0x28')]({'where':{'userProfileId':_0x333b9a['params']['id'],'sectionId':_0x333b9a[_0xab76('0x34')][_0xab76('0x5f')]}});}})[_0xab76('0x27')](function(){return _0x3b0186;})[_0xab76('0x27')](respondWithStatusCode(_0x26a36c,null))[_0xab76('0x4c')](handleError(_0x26a36c,null));};exports[_0xab76('0x60')]=function(_0x9ae934,_0x5613b6){var _0x1b1334=[];var _0x27ffc4=[];return db[_0xab76('0x54')]['findAll']({'where':{'userProfileId':_0x9ae934['params']['id']},'raw':!![]})[_0xab76('0x27')](function(_0x42f678){_0x1b1334=_[_0xab76('0x41')](_0x42f678,function(_0x577a52){return _0x577a52[_0xab76('0x61')]===0x1||_[_0xab76('0x62')]([0x3eb,0x709],_0x577a52['sectionId']);});if(!_[_0xab76('0x63')](_0x1b1334)){return _['map'](_0x1b1334,function(_0x323f12){return _0x323f12['sectionId'];});}else{return;}})['then'](function(_0x32a851){if(_0x32a851)_0x27ffc4=_0x32a851;if(_['includes'](_0x27ffc4,0x64)){var _0x294b74=_[_0xab76('0x4b')](_0x1b1334,{'sectionId':0x64});return hasDefaultDashboard(_0x294b74)[_0xab76('0x27')](function(_0x483ee3){return _[_0xab76('0x2d')](_0x1b1334,function(_0x9b513f){if(_0x9b513f[_0xab76('0x58')]===0x64){_0x9b513f['subsections']=_0x483ee3;}return _0x9b513f;});});}else{return;}})[_0xab76('0x27')](function(_0x43cb94){if(_0x43cb94)_0x1b1334=_0x43cb94;if(_[_0xab76('0x62')](_0x27ffc4,0x3eb)){var _0x1b5db0=_[_0xab76('0x4b')](_0x1b1334,{'sectionId':0x3eb});return getCustomDashboards(_0x1b5db0)[_0xab76('0x27')](function(_0x2ec956){return _[_0xab76('0x2d')](_0x1b1334,function(_0x5e119b){if(_0x1b5db0[_0xab76('0x61')]){if(_0x5e119b['sectionId']===0x3eb){_0x5e119b[_0xab76('0x64')]=_0x2ec956;}}else{if(_0x5e119b[_0xab76('0x58')]===0x64){_0x5e119b[_0xab76('0x64')]=_0x2ec956;}}return _0x5e119b;});});}else{return;}})[_0xab76('0x27')](function(_0x4c445b){if(_0x4c445b)_0x1b1334=_0x4c445b;if(_['includes'](_0x27ffc4,0x709)){var _0x264dcc=_['find'](_0x1b1334,{'sectionId':0x709});return getPlugins(_0x264dcc)[_0xab76('0x27')](function(_0x4af79c){if(_0x264dcc[_0xab76('0x61')]){return _['map'](_0x1b1334,function(_0x577720){if(_0x577720[_0xab76('0x58')]===0x709){_0x577720['subsections']=_0x4af79c;}return _0x577720;});}else{var _0x55eee9={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4af79c};var _0x4ea263=_[_0xab76('0x2d')](_0x1b1334);_0x4ea263['push'](_0x55eee9);return _0x4ea263;}});}else{return;}})[_0xab76('0x27')](function(_0x5af4d5){if(_0x5af4d5)_0x1b1334=_0x5af4d5;return _[_0xab76('0x41')](_0x1b1334,[_0xab76('0x61'),0x1]);})['then'](respondWithResult(_0x5613b6,null))[_0xab76('0x4c')](handleError(_0x5613b6,null));};function hasDefaultDashboard(_0x26500d){var _0x51e465=[0x65];return new BPromise(function(_0x3164e1,_0x43dad5){try{if(_0x26500d[_0xab76('0x56')]){_0x3164e1(_0x51e465);}else{return db['UserProfileResource'][_0xab76('0x65')]({'where':{'sectionId':_0x26500d['id']},'raw':!![]})[_0xab76('0x27')](function(_0x2de0a3){_0x2de0a3?_0x3164e1(_0x51e465):_0x3164e1();});}}catch(_0x4f33d4){_0x43dad5(_0x4f33d4);}});}function getCustomDashboards(_0xc0fde7){var _0x3d5f55=[];return new BPromise(function(_0x5d4d9c,_0x184bc9){try{if(_0xc0fde7[_0xab76('0x56')]){return db[_0xab76('0x66')][_0xab76('0x46')]({'raw':!![]})[_0xab76('0x27')](function(_0x146388){_0x146388[_0xab76('0x67')](function(_0x38b97c){_0x3d5f55[_0xab76('0x5e')](_0x38b97c['id']+0x1869f);});_0x5d4d9c(_0x3d5f55);});}else{return db[_0xab76('0x57')][_0xab76('0x46')]({'where':{'sectionId':_0xc0fde7['id']},'raw':!![]})[_0xab76('0x27')](function(_0x382907){_0x382907['forEach'](function(_0x83e732){_0x3d5f55[_0xab76('0x5e')](_0x83e732[_0xab76('0x68')]+0x1869f);});_0x5d4d9c(_0x3d5f55);});}}catch(_0x5abe3a){_0x184bc9(_0x5abe3a);}});}function getPlugins(_0x20e9a0){var _0x2b9ddc=[];return new BPromise(function(_0xc12a7f,_0x498b5d){try{if(_0x20e9a0[_0xab76('0x56')]){return db[_0xab76('0x69')][_0xab76('0x46')]({'raw':!![]})[_0xab76('0x27')](function(_0x1010e4){_0x1010e4[_0xab76('0x67')](function(_0x3f5781){_0x2b9ddc[_0xab76('0x5e')](_0x3f5781['id']+0x15b38);});_0xc12a7f(_0x2b9ddc);});}else{return db[_0xab76('0x57')][_0xab76('0x46')]({'where':{'sectionId':_0x20e9a0['id']},'raw':!![]})[_0xab76('0x27')](function(_0x50fbc6){_0x50fbc6['forEach'](function(_0x5add70){_0x2b9ddc[_0xab76('0x5e')](_0x5add70[_0xab76('0x68')]+0x15b38);});_0xc12a7f(_0x2b9ddc);});}}catch(_0x464f15){_0x498b5d(_0x464f15);}});}exports['addResources']=function(_0x2d8a1e,_0x3a0b6a){return db[_0xab76('0x2e')][_0xab76('0x4b')]({'where':{'id':_0x2d8a1e[_0xab76('0x48')]['id']}})['then'](handleEntityNotFound(_0x3a0b6a,null))['then'](function(_0x21bcef){if(_0x21bcef){return db[_0xab76('0x53')]['transaction'](function(_0x28d4f6){return db[_0xab76('0x54')]['findAll']({'where':{'userProfileId':_0x2d8a1e[_0xab76('0x48')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x429efa){if(_0x429efa){return db[_0xab76('0x54')][_0xab76('0x28')]({'where':{'userProfileId':_0x2d8a1e[_0xab76('0x48')]['id'],'id':_[_0xab76('0x2d')](_0x429efa,function(_0x26df3b){return _0x26df3b['id'];})},'transaction':_0x28d4f6});}})[_0xab76('0x27')](function(_0x1192ce){var _0x6a44d1=_[_0xab76('0x2d')](_0x2d8a1e[_0xab76('0x4e')],function(_0x3ce7d8){_0x3ce7d8[_0xab76('0x5d')]=_0x2d8a1e['params']['id'];return _0x3ce7d8;});return db[_0xab76('0x54')]['bulkCreate'](_0x6a44d1,{'raw':!![],'transaction':_0x28d4f6});})[_0xab76('0x27')](function(_0x2fc36d){var _0x3ee901=_[_0xab76('0x41')](_[_0xab76('0x2d')](_0x2fc36d,function(_0x174822){return _0x174822[_0xab76('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x3ee901){return db[_0xab76('0x54')][_0xab76('0x46')]({'where':{'userProfileId':_0x2d8a1e['params']['id'],'sectionId':_[_0xab76('0x2d')](_0x3ee901,function(_0xf77d70){return _0xf77d70[_0xab76('0x58')];})},'attributes':['id',_0xab76('0x58')],'raw':!![]})[_0xab76('0x27')](function(_0x194bb7){var _0x3449ea=_['map'](_0x2d8a1e[_0xab76('0x4e')],function(_0x49bfd2){_0x49bfd2[_0xab76('0x5d')]=_0x2d8a1e['params']['id'];return _0x49bfd2;});return db['UserProfileResource'][_0xab76('0x6a')](_0x3449ea,{'raw':!![],'transaction':_0x28d4f6});});}})['catch'](handleError(_0x3a0b6a,null));});}})[_0xab76('0x27')](function(_0x31ef04){var _0xeef3a8=_[_0xab76('0x2d')](_0x31ef04,function(_0xc4fff2){return _0xc4fff2[_0xab76('0x4f')]({'plain':!![]});});})[_0xab76('0x27')](respondWithResult(_0x3a0b6a,null))[_0xab76('0x4c')](handleError(_0x3a0b6a,null));};exports[_0xab76('0x6b')]=function(_0x49c48a,_0x58f88f,_0x224b2b){return db[_0xab76('0x2e')]['find']({'where':{'id':_0x49c48a[_0xab76('0x48')]['id']}})[_0xab76('0x27')](handleEntityNotFound(_0x58f88f,null))[_0xab76('0x27')](function(_0x5f913b){if(_0x5f913b){return _0x5f913b[_0xab76('0x6b')](_0x49c48a[_0xab76('0x34')][_0xab76('0x5f')]);}})[_0xab76('0x27')](respondWithStatusCode(_0x58f88f,null))[_0xab76('0x4c')](handleError(_0x58f88f,null));};exports[_0xab76('0x6c')]=function(_0x1515fc,_0x497b02){var _0x20a5c4={'raw':![],'where':{}};var _0x13a1a9={};var _0xaf8499={'count':0x0,'rows':[]};var _0x5a86c3=_0x1515fc[_0xab76('0x34')]['section'];if(typeof _0x5a86c3===_0xab76('0x6d')){throw new db['Sequelize'][(_0xab76('0x6e'))](_0xab76('0x6f'));}var _0x4554ae=_0x1515fc['query'][_0xab76('0x70')]||![];var _0x367b08=getQueryModels(_0x5a86c3,_0x4554ae);if(typeof _0x367b08[_0xab76('0x71')]===_0xab76('0x6d')){throw new db[(_0xab76('0x72'))][(_0xab76('0x6e'))]('Invalid\x20section\x20\x27'+_0x5a86c3+'\x27');}var _0x2b6770=[];if(!_[_0xab76('0x63')](_0x367b08['parentSections'])){_0x2b6770=_0x367b08[_0xab76('0x73')];}else{_0x2b6770=[{'name':_0x5a86c3}];}return db[_0xab76('0x2e')]['findOne']({'where':{'id':_0x1515fc['params']['id']}})[_0xab76('0x27')](handleEntityNotFound(_0x497b02,null))[_0xab76('0x27')](function(_0x3d7e80){if(_0x3d7e80){var _0x4946a6=[];for(var _0x153448=0x0;_0x153448<_0x2b6770['length'];_0x153448++){_0x4946a6[_0xab76('0x5e')](db['UserProfileSection']['findOne']({'where':{'userProfileId':_0x3d7e80['id'],'name':_0x2b6770[_0x153448]['name']},'raw':!![]}));}return BPromise['all'](_0x4946a6);}})[_0xab76('0x27')](function(_0x1b40e6){var _0xb25769=_['filter'](_0x1b40e6,function(_0x2068eb){return _0x2068eb?_0x2068eb:undefined;});var _0x1d34d9=_[_0xab76('0x41')](_0x2b6770,[_0xab76('0x74'),!![]]);var _0x210a1f=_[_0xab76('0x63')](_0xb25769)&&_[_0xab76('0x63')](_0x1d34d9)?null:_['union'](_0x1d34d9,_0xb25769);if(_0x210a1f){var _0x5dfea6=[];for(var _0x1a67fa=0x0;_0x1a67fa<_0x210a1f['length'];_0x1a67fa++){var _0x59e7a7=_['find'](_0x2b6770,function(_0x67a09e){return _0x210a1f[_0x1a67fa]?_0x67a09e[_0xab76('0x2b')]===_0x210a1f[_0x1a67fa][_0xab76('0x2b')]:null;});if(_0x59e7a7){if(_0x210a1f[_0x1a67fa][_0xab76('0x74')]){_0x5dfea6[_0xab76('0x5e')](getAllResources(_0x367b08[_0xab76('0x71')],_0x210a1f[_0x1a67fa]));}else{if(!_0x210a1f[_0x1a67fa]['autoAssociation']){_0x5dfea6[_0xab76('0x5e')](getAllowedResources(_0x59e7a7,_0x210a1f[_0x1a67fa],_0x367b08[_0xab76('0x71')]));}else{if(_0x59e7a7['model']){_0x5dfea6[_0xab76('0x5e')](getAllFilteredResources(_0x59e7a7,_0x210a1f[_0x1a67fa]));}}}}}return BPromise[_0xab76('0x75')](_0x5dfea6);}else{return null;}})[_0xab76('0x27')](function(_0x130524){var _0x2123ef=_0x130524;var _0x5d2e30=null;if(_0x2123ef){_0x5d2e30=_0x2123ef[_0xab76('0x3a')]===0x1?_0x2123ef[0x0]:null;}if(_0x5d2e30||_0x2123ef){var _0x4e9679=db[_0x367b08[_0xab76('0x71')]][_0xab76('0x2f')];_0x13a1a9[_0xab76('0x33')]=_[_0xab76('0x35')](_0x4e9679);_0x13a1a9[_0xab76('0x34')]=_[_0xab76('0x35')](_0x1515fc[_0xab76('0x34')]);_0x13a1a9[_0xab76('0x36')]=_[_0xab76('0x37')](_0x13a1a9['model'],_0x13a1a9['query']);_0x20a5c4['attributes']=_['intersection'](_0x13a1a9[_0xab76('0x33')],qs[_0xab76('0x39')](_0x1515fc[_0xab76('0x34')][_0xab76('0x39')]));_0x20a5c4['attributes']=_0x20a5c4[_0xab76('0x38')]['length']?_0x20a5c4['attributes']:_0x13a1a9['model'];if(!_0x1515fc[_0xab76('0x34')]['hasOwnProperty'](_0xab76('0x3c'))){_0x20a5c4[_0xab76('0x22')]=qs['limit'](_0x1515fc[_0xab76('0x34')]['limit']);_0x20a5c4[_0xab76('0x21')]=qs[_0xab76('0x21')](_0x1515fc[_0xab76('0x34')]['offset']);}_0x20a5c4[_0xab76('0x3d')]=qs['sort'](_0x1515fc[_0xab76('0x34')][_0xab76('0x3e')]);_0x20a5c4[_0xab76('0x3f')]=qs[_0xab76('0x36')](_[_0xab76('0x40')](_0x1515fc[_0xab76('0x34')],_0x13a1a9['filters']));if(_0x1515fc['query'][_0xab76('0x41')]){_0x20a5c4[_0xab76('0x3f')]=_['merge'](_0x20a5c4[_0xab76('0x3f')],{'$or':_[_0xab76('0x2d')](_0x4e9679,function(_0x2f07ad){if(_0x2f07ad['type'][_0xab76('0x32')]!=='VIRTUAL'){var _0x29760d={};_0x29760d[_0x2f07ad[_0xab76('0x76')]]={'$like':'%'+_0x1515fc[_0xab76('0x34')]['filter']+'%'};return _0x29760d;}})});}var _0x207c16=[];if(_0x5d2e30){var _0x3c2863=_[_0xab76('0x4b')](_0x2b6770,[_0xab76('0x2b'),_0x5d2e30[_0xab76('0x2b')]]);if(_0x3c2863['field']){var _0x52c81b={};if(_0x367b08[_0xab76('0x71')]===_0xab76('0x77')){_0x52c81b[_0x3c2863[_0xab76('0x78')]]=_[_0xab76('0x2d')](_0x5d2e30[_0xab76('0x79')],'id');}else{_0x52c81b[_0x3c2863[_0xab76('0x78')]]=_0x5d2e30[_0xab76('0x79')];}_0x207c16[_0xab76('0x5e')](_0x52c81b);}else{_0x20a5c4['where']['id']=_0x5d2e30[_0xab76('0x79')];}}else{for(var _0x38adbe=0x0;_0x38adbe<_0x2123ef[_0xab76('0x3a')];_0x38adbe++){var _0x3c2863=_[_0xab76('0x4b')](_0x2b6770,[_0xab76('0x2b'),_0x2123ef[_0x38adbe][_0xab76('0x2b')]]);if(_0x3c2863[_0xab76('0x76')]){var _0x52c81b={};_0x52c81b[_0x3c2863[_0xab76('0x78')]]=_0x2123ef[_0x38adbe]['associatedResources'];_0x207c16[_0xab76('0x5e')](_0x52c81b);}else{if(!_0x20a5c4['where']['id'])_0x20a5c4[_0xab76('0x3f')]['id']=[];_0x2123ef[_0x38adbe]['associatedResources'][_0xab76('0x67')](function(_0x2e9c3c){_0x20a5c4[_0xab76('0x3f')]['id'][_0xab76('0x5e')](_0x2e9c3c);});}}}if(!_[_0xab76('0x63')](_0x207c16)){_0x20a5c4[_0xab76('0x3f')]=_[_0xab76('0x42')](_0x20a5c4['where'],{'$and':{'$or':_0x207c16}});}_0x20a5c4=_[_0xab76('0x42')]({},_0x20a5c4,_0x1515fc[_0xab76('0x44')]);if(_0x5d2e30&&!_0x5d2e30['autoAssociation']&&_0x367b08['childModel']===_0xab76('0x77')){if(_0x1515fc[_0xab76('0x34')][_0xab76('0x49')]){_0x20a5c4[_0xab76('0x4a')]=[{'all':!![]}];}return db[_0x367b08[_0xab76('0x71')]][_0xab76('0x46')](_0x20a5c4)['then'](function(_0x4d71db){var _0x3384e3=[];_0x4d71db[_0xab76('0x67')](function(_0x2d9c88){var _0x9f50d9;switch(_0x2d9c88[_0xab76('0x7a')]){case _0xab76('0x7b'):_0x9f50d9=_[_0xab76('0x4b')](_0x5d2e30[_0xab76('0x79')],function(_0x6f5b9a){return _0x6f5b9a['id']===_0x2d9c88[_0xab76('0x7c')]&&_0x6f5b9a[_0xab76('0x31')]==='DefaultReports';});break;case _0xab76('0x7d'):_0x9f50d9=_[_0xab76('0x4b')](_0x5d2e30['associatedResources'],function(_0x5f3d61){return _0x5f3d61['id']===_0x2d9c88['reportId']&&_0x5f3d61['type']===_0xab76('0x7e');});break;}if(_0x9f50d9)_0x3384e3[_0xab76('0x5e')](_0x2d9c88);});_0xaf8499[_0xab76('0x45')]=_0x3384e3['length'];_0xaf8499[_0xab76('0x7f')]=_0x3384e3;return _0xaf8499;});}else{return db[_0x367b08[_0xab76('0x71')]]['count']({'where':_0x20a5c4[_0xab76('0x3f')]})[_0xab76('0x27')](function(_0x1145bb){_0xaf8499['count']=_0x1145bb;if(_0x1515fc[_0xab76('0x34')][_0xab76('0x49')]){if(_0x367b08[_0xab76('0x71')]===_0xab76('0x80')){_0x20a5c4['include']=[{'model':db['Tag'],'as':_0xab76('0x81'),'attributes':['id',_0xab76('0x2b'),_0xab76('0x82')],'required':_0x1515fc['query'][_0xab76('0x83')]?!![]:![]},{'model':db[_0xab76('0x84')],'as':'ThroughTags','attributes':['id','name',_0xab76('0x82')],'through':_0x1515fc['query']['tag']?{'attributes':[],'where':{'TagId':_0x1515fc[_0xab76('0x34')][_0xab76('0x83')]||undefined}}:{},'required':_0x1515fc[_0xab76('0x34')][_0xab76('0x83')]?!![]:![]}];}else{_0x20a5c4[_0xab76('0x4a')]=[{'all':!![]}];}}return db[_0x367b08['childModel']][_0xab76('0x46')](_0x20a5c4);})[_0xab76('0x27')](function(_0x5bfc5e){_0xaf8499[_0xab76('0x7f')]=_0x5bfc5e;return _0xaf8499;});}}else{return _0xaf8499;}})[_0xab76('0x27')](respondWithFilteredResult(_0x497b02,_0x20a5c4))[_0xab76('0x4c')](handleError(_0x497b02,null));};function getAllResources(_0x5c8174,_0x100b73){return new BPromise(function(_0x4c1ccb,_0x51f671){if(_0x100b73){var _0x54883d=_0x100b73[_0xab76('0x41')]?{[_0x100b73[_0xab76('0x41')][_0xab76('0x76')]]:_0x100b73[_0xab76('0x41')][_0xab76('0x85')]}:undefined;return db[_0x5c8174][_0xab76('0x46')]({'where':_0x54883d,'raw':!![]})[_0xab76('0x27')](function(_0x1d6926){_0x100b73['associatedResources']=_[_0xab76('0x2d')](_0x1d6926,'id');_0x4c1ccb(_0x100b73);})['catch'](function(_0x474568){_0x51f671(_0x474568);});}else{_0x4c1ccb(null);}});}function getAllFilteredResources(_0x165761,_0x4cd403){return new BPromise(function(_0xa3aa89,_0x46a6ab){var _0x85df7b=_0x165761[_0xab76('0x41')]?{[_0x165761['filter'][_0xab76('0x76')]]:_0x165761[_0xab76('0x41')][_0xab76('0x85')]}:undefined;return db[_0x165761[_0xab76('0x33')]]['findAll']({'where':_0x85df7b,'raw':!![]})[_0xab76('0x27')](function(_0x3f9339){_0x4cd403[_0xab76('0x79')]=_['map'](_0x3f9339,function(_0x4f0555){return _0x4f0555[_0xab76('0x2b')];});_0xa3aa89(_0x4cd403);})['catch'](function(_0x41d121){_0x46a6ab(_0x41d121);});});}function getAllowedResources(_0x3b11ab,_0x2a5b2d,_0x22b41e){return new BPromise(function(_0x5115cf,_0x56a02e){if(_0x2a5b2d){return db[_0xab76('0x57')][_0xab76('0x46')]({'where':{'sectionId':_0x2a5b2d['id']},'raw':!![]})[_0xab76('0x27')](function(_0x147de0){if(_0x3b11ab[_0xab76('0x76')]&&_0x3b11ab[_0xab76('0x76')]!=='id'){_0x2a5b2d['associatedResources']=_['map'](_0x147de0,function(_0x1c7fa1){return _0x1c7fa1[_0x3b11ab[_0xab76('0x76')]];});}else{if(_0x22b41e===_0xab76('0x77')){_0x2a5b2d[_0xab76('0x79')]=_[_0xab76('0x2d')](_0x147de0,function(_0x1f0744){return{'id':_0x1f0744['resourceId'],'type':_0x1f0744['type']};});}else{_0x2a5b2d['associatedResources']=_[_0xab76('0x2d')](_0x147de0,function(_0x32441b){return _0x32441b[_0xab76('0x68')];});}}_0x5115cf(_0x2a5b2d);})[_0xab76('0x4c')](function(_0x5641ad){_0x56a02e(_0x5641ad);});}else{_0x5115cf(null);}});}function getQueryModels(_0x49f913,_0x246c45){var _0x2fbbf2=_0x49f913[_0xab76('0x86')]();var _0x4086b3={'childModel':undefined,'parentSections':[]};switch(_0x2fbbf2){case _0xab76('0x87'):_0x4086b3[_0xab76('0x71')]=_0xab76('0x88');break;case _0xab76('0x89'):_0x4086b3[_0xab76('0x71')]=_0xab76('0x8a');break;case _0xab76('0x8b'):_0x4086b3[_0xab76('0x71')]=_0xab76('0x8c');_0x4086b3[_0xab76('0x73')]=[{'name':_0xab76('0x8d'),'field':_0xab76('0x2b'),'foreignKey':'projectName'}];break;case _0xab76('0x8e'):_0x4086b3[_0xab76('0x71')]=_0xab76('0x8f');break;case _0xab76('0x90'):_0x4086b3[_0xab76('0x71')]=_0xab76('0x80');_0x4086b3[_0xab76('0x73')]=[{'name':_0xab76('0x91'),'field':'id','foreignKey':_0xab76('0x92')}];break;case _0xab76('0x93'):_0x4086b3[_0xab76('0x71')]=_0xab76('0x94');break;case _0xab76('0x95'):_0x4086b3['childModel']='CmCompany';break;case'globalcustomfields':_0x4086b3[_0xab76('0x71')]=_0xab76('0x96');break;case _0xab76('0x97'):_0x4086b3[_0xab76('0x71')]=_0xab76('0x98');break;case _0xab76('0x99'):_0x4086b3[_0xab76('0x71')]=_0xab76('0x9a');break;case _0xab76('0x9b'):_0x4086b3[_0xab76('0x71')]=_0xab76('0x9c');break;case _0xab76('0x9d'):_0x4086b3[_0xab76('0x71')]=_0xab76('0x9e');break;case'inboundroutes':case _0xab76('0x9f'):case _0xab76('0xa0'):_0x4086b3['childModel']=_0xab76('0xa1');break;case _0xab76('0xa2'):_0x4086b3['childModel']=_0xab76('0xa3');break;case _0xab76('0xa4'):_0x4086b3[_0xab76('0x71')]=_0xab76('0xa5');break;case _0xab76('0xa6'):_0x4086b3[_0xab76('0x71')]='VoiceRecording';_0x4086b3[_0xab76('0x73')]=[{'name':_0xab76('0xa7'),'field':_0xab76('0x2b'),'foreignKey':'membername','model':_0xab76('0xa8'),'filter':{'field':'role','value':[_0xab76('0xa9')]}},{'name':'Telephones','field':_0xab76('0x2b'),'foreignKey':_0xab76('0xaa'),'model':'User','filter':{'field':'role','value':[_0xab76('0xab')]}},{'name':'VoiceQueues','field':_0xab76('0x2b'),'foreignKey':_0xab76('0xac'),'model':_0xab76('0xad'),'filter':{'field':_0xab76('0x31'),'value':['inbound']}},{'name':_0xab76('0xae'),'field':_0xab76('0x2b'),'foreignKey':_0xab76('0xac'),'model':_0xab76('0xad'),'filter':{'field':'type','value':[_0xab76('0xaf')]}}];break;case'musiconholds':_0x4086b3[_0xab76('0x71')]=_0xab76('0xb0');break;case _0xab76('0xb1'):_0x4086b3[_0xab76('0x71')]='VoiceChanSpy';break;case _0xab76('0xb2'):_0x4086b3['childModel']='VoicePrefix';break;case'ivrcampaigns':_0x4086b3['childModel']='Campaign';break;case _0xab76('0xb3'):_0x4086b3[_0xab76('0x71')]=_0xab76('0xb4');break;case _0xab76('0xb5'):_0x4086b3[_0xab76('0x71')]=_0xab76('0xb6');break;case _0xab76('0xb7'):_0x4086b3['childModel']=_0xab76('0xb8');break;case _0xab76('0xb9'):_0x4086b3['childModel']=_0xab76('0xba');break;case'openchannelaccounts':_0x4086b3[_0xab76('0x71')]=_0xab76('0xbb');break;case'smsqueues':_0x4086b3[_0xab76('0x71')]='SmsQueue';break;case _0xab76('0xbc'):_0x4086b3[_0xab76('0x71')]=_0xab76('0xbd');break;case _0xab76('0xbe'):_0x4086b3[_0xab76('0x71')]=_0xab76('0xbf');break;case _0xab76('0xc0'):_0x4086b3['childModel']=_0xab76('0xc1');break;case _0xab76('0xc2'):_0x4086b3[_0xab76('0x71')]=_0xab76('0xc3');break;case'voicequeues':case _0xab76('0xc4'):_0x4086b3['childModel']='VoiceQueue';if(_0x246c45){_0x4086b3[_0xab76('0x73')]=[{'name':_0xab76('0xc5')},{'name':'QueueCampaigns'}];}break;case'users':case'agents':case'telephones':_0x4086b3['childModel']=_0xab76('0xa8');if(_0x246c45){_0x4086b3[_0xab76('0x73')]=[{'name':'Users','filter':{'field':_0xab76('0xc6'),'value':['admin',_0xab76('0xc7')]},'ignore':!![]},{'name':_0xab76('0xa7')},{'name':_0xab76('0xc8')}];}break;case _0xab76('0xc9'):_0x4086b3[_0xab76('0x71')]=_0xab76('0xca');break;case _0xab76('0xcb'):_0x4086b3[_0xab76('0x71')]=_0xab76('0xcc');break;case _0xab76('0xcd'):_0x4086b3[_0xab76('0x71')]=_0xab76('0xce');break;case'sugarcrmaccounts':_0x4086b3['childModel']=_0xab76('0xcf');break;case _0xab76('0xd0'):_0x4086b3['childModel']=_0xab76('0xd1');break;case _0xab76('0xd2'):_0x4086b3[_0xab76('0x71')]=_0xab76('0xd3');break;case _0xab76('0xd4'):_0x4086b3[_0xab76('0x71')]=_0xab76('0xa8');break;case _0xab76('0xd5'):_0x4086b3[_0xab76('0x71')]=_0xab76('0xd6');break;case _0xab76('0xd7'):_0x4086b3[_0xab76('0x71')]=_0xab76('0xd8');break;case'customdashboards':_0x4086b3[_0xab76('0x71')]='Dashboard';break;case _0xab76('0xd9'):_0x4086b3[_0xab76('0x71')]=_0xab76('0xda');break;case _0xab76('0xdb'):_0x4086b3[_0xab76('0x71')]='Pause';break;case _0xab76('0xdc'):_0x4086b3[_0xab76('0x71')]=_0xab76('0xdd');break;case _0xab76('0xde'):_0x4086b3['childModel']=_0xab76('0xdf');break;case _0xab76('0xe0'):_0x4086b3[_0xab76('0x71')]=_0xab76('0x84');break;case _0xab76('0xe1'):_0x4086b3[_0xab76('0x71')]=_0xab76('0xe2');break;case _0xab76('0xe3'):_0x4086b3[_0xab76('0x71')]=_0xab76('0xe4');break;case _0xab76('0xe5'):_0x4086b3[_0xab76('0x71')]=_0xab76('0xe6');break;case _0xab76('0xe7'):_0x4086b3[_0xab76('0x71')]='Variable';break;case _0xab76('0xe8'):_0x4086b3['childModel']=_0xab76('0x69');break;case'extractedreports':_0x4086b3['childModel']=_0xab76('0x77');_0x4086b3[_0xab76('0x73')]=[{'name':_0xab76('0xe9'),'field':'id','foreignKey':_0xab76('0x7c')}];break;case'metrics':_0x4086b3[_0xab76('0x71')]=_0xab76('0xea');break;case'whatsappaccounts':_0x4086b3[_0xab76('0x71')]=_0xab76('0xc1');break;default:return _0x4086b3;}return _0x4086b3;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 3b52dc9..77e3494 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 _0xd58c=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','UserProfile'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xd58c,0x15b));var _0xcd58=function(_0x290578,_0x2d4981){_0x290578=_0x290578-0x0;var _0x387494=_0xd58c[_0x290578];return _0x387494;};'use strict';var EventEmitter=require(_0xcd58('0x0'));var UserProfile=require(_0xcd58('0x1'))['db'][_0xcd58('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xcd58('0x3')](0x0);var events={'afterCreate':_0xcd58('0x4'),'afterUpdate':_0xcd58('0x5'),'afterDestroy':_0xcd58('0x6')};function emitEvent(_0x3a22fe){return function(_0x489fa7,_0x425891,_0x29fb73){UserProfileEvents[_0xcd58('0x7')](_0x3a22fe+':'+_0x489fa7['id'],_0x489fa7);UserProfileEvents[_0xcd58('0x7')](_0x3a22fe,_0x489fa7);_0x29fb73(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xcd58('0x8')](e,emitEvent(event));}}module[_0xcd58('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x0217=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0x0217,0x101));var _0x7021=function(_0x1f50b6,_0x4d2954){_0x1f50b6=_0x1f50b6-0x0;var _0x576a97=_0x0217[_0x1f50b6];return _0x576a97;};'use strict';var EventEmitter=require(_0x7021('0x0'));var UserProfile=require(_0x7021('0x1'))['db'][_0x7021('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x7021('0x3')](0x0);var events={'afterCreate':_0x7021('0x4'),'afterUpdate':_0x7021('0x5'),'afterDestroy':_0x7021('0x6')};function emitEvent(_0x3d086b){return function(_0x49a39a,_0x4df115,_0x244695){UserProfileEvents[_0x7021('0x7')](_0x3d086b+':'+_0x49a39a['id'],_0x49a39a);UserProfileEvents[_0x7021('0x7')](_0x3d086b,_0x49a39a);_0x244695(null);};}for(var e in events){if(events[_0x7021('0x8')](e)){var event=events[e];UserProfile[_0x7021('0x9')](e,emitEvent(event));}}module[_0x7021('0xa')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index a987fca..d96828a 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 _0x1adc=['./userProfile.attributes','define','user_profiles','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x357ee9,_0x283b33){var _0x14ede1=function(_0x312d54){while(--_0x312d54){_0x357ee9['push'](_0x357ee9['shift']());}};_0x14ede1(++_0x283b33);}(_0x1adc,0x1d7));var _0xc1ad=function(_0x4da78a,_0x3792b9){_0x4da78a=_0x4da78a-0x0;var _0xe4165b=_0x1adc[_0x4da78a];return _0xe4165b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc1ad('0x0'))(_0xc1ad('0x1'));var moment=require(_0xc1ad('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc1ad('0x3'));var rimraf=require(_0xc1ad('0x4'));var config=require(_0xc1ad('0x5'));var attributes=require(_0xc1ad('0x6'));module['exports']=function(_0xa3ac17,_0x538e8d){return _0xa3ac17[_0xc1ad('0x7')]('UserProfile',attributes,{'tableName':_0xc1ad('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa7f=['UserProfile','user_profiles','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userProfile.attributes','define'];(function(_0x51ba39,_0x10e8d3){var _0x2bdd79=function(_0x17b2aa){while(--_0x17b2aa){_0x51ba39['push'](_0x51ba39['shift']());}};_0x2bdd79(++_0x10e8d3);}(_0xfa7f,0xec));var _0xffa7=function(_0x3011d1,_0x43f846){_0x3011d1=_0x3011d1-0x0;var _0x190f5f=_0xfa7f[_0x3011d1];return _0x190f5f;};'use strict';var _=require(_0xffa7('0x0'));var util=require(_0xffa7('0x1'));var logger=require(_0xffa7('0x2'))(_0xffa7('0x3'));var moment=require(_0xffa7('0x4'));var BPromise=require('bluebird');var rp=require(_0xffa7('0x5'));var fs=require('fs');var path=require(_0xffa7('0x6'));var rimraf=require(_0xffa7('0x7'));var config=require(_0xffa7('0x8'));var attributes=require(_0xffa7('0x9'));module['exports']=function(_0x3b7e86,_0xf5f866){return _0x3b7e86[_0xffa7('0xa')](_0xffa7('0xb'),attributes,{'tableName':_0xffa7('0xc'),'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 5614c06..995dcb3 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 _0x687b=['request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register'];(function(_0x313ef7,_0x1b574e){var _0x2c8417=function(_0x2860b0){while(--_0x2860b0){_0x313ef7['push'](_0x313ef7['shift']());}};_0x2c8417(++_0x1b574e);}(_0x687b,0x14a));var _0xb687=function(_0x1c8fb1,_0xb39e81){_0x1c8fb1=_0x1c8fb1-0x0;var _0x57f8e8=_0x687b[_0x1c8fb1];return _0x57f8e8;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});config[_0xb687('0xc')]=_[_0xb687('0xd')](config['redis'],{'host':_0xb687('0xe'),'port':0x18eb});var socket=require(_0xb687('0xf'))(new Redis(config['redis']));require(_0xb687('0x10'))[_0xb687('0x11')](socket);function respondWithRpcPromise(_0x825ad,_0x15dc9a,_0x404fdb){return new BPromise(function(_0x309d84,_0x3e6271){return client[_0xb687('0x12')](_0x825ad,_0x404fdb)[_0xb687('0x13')](function(_0x5103b9){logger[_0xb687('0x14')](_0xb687('0x15'),_0x15dc9a,_0xb687('0x16'));logger[_0xb687('0x17')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x15dc9a,'request\x20sent',JSON[_0xb687('0x18')](_0x5103b9));if(_0x5103b9[_0xb687('0x19')]){if(_0x5103b9['error'][_0xb687('0x1a')]===0x1f4){logger[_0xb687('0x19')](_0xb687('0x15'),_0x15dc9a,_0x5103b9[_0xb687('0x19')][_0xb687('0x1b')]);return _0x3e6271(_0x5103b9[_0xb687('0x19')][_0xb687('0x1b')]);}logger[_0xb687('0x19')](_0xb687('0x15'),_0x15dc9a,_0x5103b9[_0xb687('0x19')][_0xb687('0x1b')]);return _0x309d84(_0x5103b9[_0xb687('0x19')]['message']);}else{logger[_0xb687('0x14')](_0xb687('0x15'),_0x15dc9a,_0xb687('0x16'));_0x309d84(_0x5103b9['result']['message']);}})[_0xb687('0x1c')](function(_0x3a10ef){logger[_0xb687('0x19')]('UserProfile,\x20%s,\x20%s',_0x15dc9a,_0x3a10ef);_0x3e6271(_0x3a10ef);});});} \ No newline at end of file +var _0x2bd8=['../../config/environment','jayson/promise','client','redis','defaults','localhost','info','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4e453d,_0xc690a9){var _0x3a6ece=function(_0x73b10){while(--_0x73b10){_0x4e453d['push'](_0x4e453d['shift']());}};_0x3a6ece(++_0xc690a9);}(_0x2bd8,0x130));var _0x82bd=function(_0x37a098,_0x3dd63b){_0x37a098=_0x37a098-0x0;var _0x30b365=_0x2bd8[_0x37a098];return _0x30b365;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var moment=require(_0x82bd('0x1'));var BPromise=require(_0x82bd('0x2'));var rs=require(_0x82bd('0x3'));var fs=require('fs');var Redis=require(_0x82bd('0x4'));var db=require(_0x82bd('0x5'))['db'];var utils=require(_0x82bd('0x6'));var logger=require(_0x82bd('0x7'))('rpc');var config=require(_0x82bd('0x8'));var jayson=require(_0x82bd('0x9'));var client=jayson[_0x82bd('0xa')]['http']({'port':0x232a});config[_0x82bd('0xb')]=_[_0x82bd('0xc')](config[_0x82bd('0xb')],{'host':_0x82bd('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x82bd('0xb')]));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x51c6ea,_0x5bb22c,_0x5f0434){return new BPromise(function(_0x4c9430,_0x36abe3){return client['request'](_0x51c6ea,_0x5f0434)['then'](function(_0x32821a){logger[_0x82bd('0xe')]('UserProfile,\x20%s,\x20%s',_0x5bb22c,_0x82bd('0xf'));logger['debug'](_0x82bd('0x10'),_0x5bb22c,'request\x20sent',JSON[_0x82bd('0x11')](_0x32821a));if(_0x32821a[_0x82bd('0x12')]){if(_0x32821a[_0x82bd('0x12')][_0x82bd('0x13')]===0x1f4){logger['error'](_0x82bd('0x14'),_0x5bb22c,_0x32821a[_0x82bd('0x12')]['message']);return _0x36abe3(_0x32821a[_0x82bd('0x12')]['message']);}logger[_0x82bd('0x12')](_0x82bd('0x14'),_0x5bb22c,_0x32821a[_0x82bd('0x12')][_0x82bd('0x15')]);return _0x4c9430(_0x32821a[_0x82bd('0x12')][_0x82bd('0x15')]);}else{logger[_0x82bd('0xe')](_0x82bd('0x14'),_0x5bb22c,_0x82bd('0xf'));_0x4c9430(_0x32821a[_0x82bd('0x16')][_0x82bd('0x15')]);}})[_0x82bd('0x17')](function(_0x1c3779){logger[_0x82bd('0x12')]('UserProfile,\x20%s,\x20%s',_0x5bb22c,_0x1c3779);_0x36abe3(_0x1c3779);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 7386044..d0173fa 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 _0xd1ad=['removeListener','register','length','userProfile:','./userProfile.events','remove','update'];(function(_0x5e2152,_0x172f3d){var _0x5ddcf6=function(_0x30a5cc){while(--_0x30a5cc){_0x5e2152['push'](_0x5e2152['shift']());}};_0x5ddcf6(++_0x172f3d);}(_0xd1ad,0x170));var _0xdd1a=function(_0x3987a1,_0x447793){_0x3987a1=_0x3987a1-0x0;var _0xe2596e=_0xd1ad[_0x3987a1];return _0xe2596e;};'use strict';var UserProfileEvents=require(_0xdd1a('0x0'));var events=['save',_0xdd1a('0x1'),_0xdd1a('0x2')];function createListener(_0x46aff6,_0x308bee){return function(_0x5f4e97){_0x308bee['emit'](_0x46aff6,_0x5f4e97);};}function removeListener(_0x5a0556,_0x4b6453){return function(){UserProfileEvents[_0xdd1a('0x3')](_0x5a0556,_0x4b6453);};}exports[_0xdd1a('0x4')]=function(_0x1c411f){for(var _0x5ec268=0x0,_0x5b4395=events[_0xdd1a('0x5')];_0x5ec268<_0x5b4395;_0x5ec268++){var _0x49bb26=events[_0x5ec268];var _0x48a60a=createListener(_0xdd1a('0x6')+_0x49bb26,_0x1c411f);UserProfileEvents['on'](_0x49bb26,_0x48a60a);}}; \ No newline at end of file +var _0xd60c=['userProfile:','./userProfile.events','save','remove','update','emit','removeListener','register'];(function(_0x3ca115,_0x286520){var _0x1538bc=function(_0x2f891b){while(--_0x2f891b){_0x3ca115['push'](_0x3ca115['shift']());}};_0x1538bc(++_0x286520);}(_0xd60c,0x111));var _0xcd60=function(_0x3cca02,_0x4a7674){_0x3cca02=_0x3cca02-0x0;var _0x236b68=_0xd60c[_0x3cca02];return _0x236b68;};'use strict';var UserProfileEvents=require(_0xcd60('0x0'));var events=[_0xcd60('0x1'),_0xcd60('0x2'),_0xcd60('0x3')];function createListener(_0x51e6d8,_0x141994){return function(_0x55c037){_0x141994[_0xcd60('0x4')](_0x51e6d8,_0x55c037);};}function removeListener(_0x47aff3,_0x36dcf3){return function(){UserProfileEvents[_0xcd60('0x5')](_0x47aff3,_0x36dcf3);};}exports[_0xcd60('0x6')]=function(_0x525c29){for(var _0x36d225=0x0,_0x41ef60=events['length'];_0x36d225<_0x41ef60;_0x36d225++){var _0x596ff=events[_0x36d225];var _0x251370=createListener(_0xcd60('0x7')+_0x596ff,_0x525c29);UserProfileEvents['on'](_0x596ff,_0x251370);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index bcea467..05e6252 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 _0xd01c=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','post','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x382afa,_0x8d527){var _0x507337=function(_0x318b5e){while(--_0x318b5e){_0x382afa['push'](_0x382afa['shift']());}};_0x507337(++_0x8d527);}(_0xd01c,0xfb));var _0xcd01=function(_0x3b4da5,_0x472d48){_0x3b4da5=_0x3b4da5-0x0;var _0x122b22=_0xd01c[_0x3b4da5];return _0x122b22;};'use strict';var multer=require(_0xcd01('0x0'));var util=require(_0xcd01('0x1'));var path=require(_0xcd01('0x2'));var timeout=require(_0xcd01('0x3'));var express=require(_0xcd01('0x4'));var router=express['Router']();var auth=require(_0xcd01('0x5'));var interaction=require(_0xcd01('0x6'));var config=require(_0xcd01('0x7'));var controller=require('./userProfileResource.controller');router[_0xcd01('0x8')]('/',auth[_0xcd01('0x9')](),controller[_0xcd01('0xa')]);router[_0xcd01('0x8')]('/describe',auth[_0xcd01('0x9')](),controller[_0xcd01('0xb')]);router[_0xcd01('0x8')](_0xcd01('0xc'),auth[_0xcd01('0x9')](),controller['show']);router[_0xcd01('0xd')]('/',auth[_0xcd01('0x9')](),controller['create']);router['put'](_0xcd01('0xc'),auth[_0xcd01('0x9')](),controller[_0xcd01('0xe')]);router['delete'](_0xcd01('0xc'),auth[_0xcd01('0x9')](),controller[_0xcd01('0xf')]);module[_0xcd01('0x10')]=router; \ No newline at end of file +var _0x5b2a=['/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x5b2a,0x1bd));var _0xa5b2=function(_0x547ff4,_0x416fa1){_0x547ff4=_0x547ff4-0x0;var _0xe41057=_0x5b2a[_0x547ff4];return _0xe41057;};'use strict';var multer=require(_0xa5b2('0x0'));var util=require(_0xa5b2('0x1'));var path=require(_0xa5b2('0x2'));var timeout=require(_0xa5b2('0x3'));var express=require(_0xa5b2('0x4'));var router=express[_0xa5b2('0x5')]();var auth=require(_0xa5b2('0x6'));var interaction=require(_0xa5b2('0x7'));var config=require(_0xa5b2('0x8'));var controller=require(_0xa5b2('0x9'));router[_0xa5b2('0xa')]('/',auth[_0xa5b2('0xb')](),controller[_0xa5b2('0xc')]);router[_0xa5b2('0xa')](_0xa5b2('0xd'),auth['isAuthenticated'](),controller[_0xa5b2('0xe')]);router['get'](_0xa5b2('0xf'),auth[_0xa5b2('0xb')](),controller['show']);router[_0xa5b2('0x10')]('/',auth[_0xa5b2('0xb')](),controller[_0xa5b2('0x11')]);router[_0xa5b2('0x12')](_0xa5b2('0xf'),auth[_0xa5b2('0xb')](),controller[_0xa5b2('0x13')]);router[_0xa5b2('0x14')](_0xa5b2('0xf'),auth[_0xa5b2('0xb')](),controller[_0xa5b2('0x15')]);module[_0xa5b2('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index e9cf9da..bc9271b 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 _0x47f3=['INTEGER','exports','STRING'];(function(_0x794294,_0x38fece){var _0x3f17cc=function(_0x4a87c5){while(--_0x4a87c5){_0x794294['push'](_0x794294['shift']());}};_0x3f17cc(++_0x38fece);}(_0x47f3,0x1c9));var _0x347f=function(_0x25c26c,_0x28f284){_0x25c26c=_0x25c26c-0x0;var _0x1f214d=_0x47f3[_0x25c26c];return _0x1f214d;};'use strict';var Sequelize=require('sequelize');module[_0x347f('0x0')]={'name':{'type':Sequelize[_0x347f('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x347f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x347f('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x4959=['STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4959,0x101));var _0x9495=function(_0x1c421b,_0x51fb4f){_0x1c421b=_0x1c421b-0x0;var _0x30f7f2=_0x4959[_0x1c421b];return _0x30f7f2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x9495('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index a27073a..b1dd104 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 _0xa630=['../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','params','keys','length','find','create','body','describe','html-pdf','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x56a290,_0x245e01){var _0x3842a2=function(_0x575513){while(--_0x575513){_0x56a290['push'](_0x56a290['shift']());}};_0x3842a2(++_0x245e01);}(_0xa630,0xbe));var _0x0a63=function(_0x4720d3,_0x522829){_0x4720d3=_0x4720d3-0x0;var _0xf202fd=_0xa630[_0x4720d3];return _0xf202fd;};'use strict';var pdf=require(_0x0a63('0x0'));var emlformat=require(_0x0a63('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0a63('0x2'));var rp=require('request-promise');var moment=require(_0x0a63('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a63('0x4'));var util=require(_0x0a63('0x5'));var path=require(_0x0a63('0x6'));var sox=require(_0x0a63('0x7'));var csv=require(_0x0a63('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0a63('0x9'));var squel=require(_0x0a63('0xa'));var crypto=require(_0x0a63('0xb'));var jsforce=require(_0x0a63('0xc'));var deskjs=require(_0x0a63('0xd'));var toCsv=require(_0x0a63('0x8'));var querystring=require('querystring');var Papa=require(_0x0a63('0xe'));var Redis=require(_0x0a63('0xf'));var authService=require(_0x0a63('0x10'));var qs=require(_0x0a63('0x11'));var as=require(_0x0a63('0x12'));var hardwareService=require(_0x0a63('0x13'));var logger=require(_0x0a63('0x14'))(_0x0a63('0x15'));var utils=require(_0x0a63('0x16'));var config=require(_0x0a63('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x345f56,_0x420043){_0x420043=_0x420043||0xcc;return function(_0x2fce86){if(_0x2fce86){return _0x345f56[_0x0a63('0x18')](_0x420043);}return _0x345f56['status'](_0x420043)[_0x0a63('0x19')]();};}function respondWithResult(_0x4d68c0,_0x331e99){_0x331e99=_0x331e99||0xc8;return function(_0x19e922){if(_0x19e922){return _0x4d68c0[_0x0a63('0x1a')](_0x331e99)[_0x0a63('0x1b')](_0x19e922);}};}function respondWithFilteredResult(_0x3ea3bb,_0x23b49d){return function(_0x552b1f){if(_0x552b1f){var _0x1e3251=_0x552b1f[_0x0a63('0x1c')],_0x524a98=_0x23b49d[_0x0a63('0x1d')],_0x47788e=_0x23b49d[_0x0a63('0x1d')]+_0x23b49d[_0x0a63('0x1e')],_0x56b314;if(_0x47788e>=_0x1e3251){_0x47788e=_0x1e3251;_0x56b314=0xc8;}else{_0x56b314=0xce;}_0x3ea3bb[_0x0a63('0x1a')](_0x56b314);return _0x3ea3bb[_0x0a63('0x1f')](_0x0a63('0x20'),_0x524a98+'-'+_0x47788e+'/'+_0x1e3251)[_0x0a63('0x1b')](_0x552b1f);}return null;};}function patchUpdates(_0x2fd06c){return function(_0x3cc74d){try{jsonpatch[_0x0a63('0x21')](_0x3cc74d,_0x2fd06c,!![]);}catch(_0x4ea56f){return BPromise['reject'](_0x4ea56f);}return _0x3cc74d[_0x0a63('0x22')]();};}function saveUpdates(_0x586190,_0x2fc87c){return function(_0x5937df){if(_0x5937df){return _0x5937df[_0x0a63('0x23')](_0x586190)[_0x0a63('0x24')](function(_0x145625){return _0x145625;});}return null;};}function removeEntity(_0x46b968,_0x5da46b){return function(_0x398a16){if(_0x398a16){return _0x398a16['destroy']()[_0x0a63('0x24')](function(){_0x46b968[_0x0a63('0x1a')](0xcc)[_0x0a63('0x19')]();});}};}function handleEntityNotFound(_0x20c114,_0x343273){return function(_0x1f929f){if(!_0x1f929f){_0x20c114[_0x0a63('0x18')](0x194);}return _0x1f929f;};}function handleError(_0x53c6e3,_0x567017){_0x567017=_0x567017||0x1f4;return function(_0x5e5987){logger['error'](_0x5e5987['stack']);if(_0x5e5987[_0x0a63('0x25')]){delete _0x5e5987['name'];}_0x53c6e3['status'](_0x567017)[_0x0a63('0x26')](_0x5e5987);};}exports[_0x0a63('0x27')]=function(_0x362d6a,_0x2e2526){var _0x52e7ef={},_0x402692={},_0x498371={'count':0x0,'rows':[]};var _0x25ab82=_['map'](db[_0x0a63('0x28')][_0x0a63('0x29')],function(_0x1b7bdb){return{'name':_0x1b7bdb[_0x0a63('0x2a')],'type':_0x1b7bdb[_0x0a63('0x2b')][_0x0a63('0x2c')]};});_0x402692[_0x0a63('0x2d')]=_[_0x0a63('0x2e')](_0x25ab82,'name');_0x402692[_0x0a63('0x2f')]=_['keys'](_0x362d6a[_0x0a63('0x2f')]);_0x402692[_0x0a63('0x30')]=_[_0x0a63('0x31')](_0x402692[_0x0a63('0x2d')],_0x402692[_0x0a63('0x2f')]);_0x52e7ef['attributes']=_[_0x0a63('0x31')](_0x402692[_0x0a63('0x2d')],qs[_0x0a63('0x32')](_0x362d6a[_0x0a63('0x2f')]['fields']));_0x52e7ef[_0x0a63('0x33')]=_0x52e7ef[_0x0a63('0x33')]['length']?_0x52e7ef['attributes']:_0x402692[_0x0a63('0x2d')];if(!_0x362d6a['query']['hasOwnProperty'](_0x0a63('0x34'))){_0x52e7ef[_0x0a63('0x1e')]=qs['limit'](_0x362d6a[_0x0a63('0x2f')][_0x0a63('0x1e')]);_0x52e7ef[_0x0a63('0x1d')]=qs[_0x0a63('0x1d')](_0x362d6a[_0x0a63('0x2f')]['offset']);}_0x52e7ef['order']=qs[_0x0a63('0x35')](_0x362d6a[_0x0a63('0x2f')][_0x0a63('0x35')]);_0x52e7ef[_0x0a63('0x36')]=qs[_0x0a63('0x30')](_[_0x0a63('0x37')](_0x362d6a['query'],_0x402692[_0x0a63('0x30')]),_0x25ab82);if(_0x362d6a[_0x0a63('0x2f')]['filter']){_0x52e7ef[_0x0a63('0x36')]=_['merge'](_0x52e7ef['where'],{'$or':_[_0x0a63('0x2e')](_0x25ab82,function(_0x232388){if(_0x232388[_0x0a63('0x2b')]!=='VIRTUAL'){var _0x209447={};_0x209447[_0x232388[_0x0a63('0x25')]]={'$like':'%'+_0x362d6a[_0x0a63('0x2f')][_0x0a63('0x38')]+'%'};return _0x209447;}})});}_0x52e7ef=_[_0x0a63('0x39')]({},_0x52e7ef,_0x362d6a[_0x0a63('0x3a')]);var _0x604a45={'where':_0x52e7ef['where']};return db[_0x0a63('0x28')][_0x0a63('0x1c')](_0x604a45)[_0x0a63('0x24')](function(_0x53d034){_0x498371['count']=_0x53d034;if(_0x362d6a[_0x0a63('0x2f')]['includeAll']){_0x52e7ef[_0x0a63('0x3b')]=[{'all':!![]}];}return db[_0x0a63('0x28')][_0x0a63('0x3c')](_0x52e7ef);})['then'](function(_0x2af987){_0x498371[_0x0a63('0x3d')]=_0x2af987;return _0x498371;})[_0x0a63('0x24')](respondWithFilteredResult(_0x2e2526,_0x52e7ef))[_0x0a63('0x3e')](handleError(_0x2e2526,null));};exports['show']=function(_0x1e3b70,_0x236617){var _0x4234cd={'raw':![],'where':{'id':_0x1e3b70[_0x0a63('0x3f')]['id']}},_0x2ccd99={};_0x2ccd99[_0x0a63('0x2d')]=_['keys'](db[_0x0a63('0x28')][_0x0a63('0x29')]);_0x2ccd99[_0x0a63('0x2f')]=_[_0x0a63('0x40')](_0x1e3b70[_0x0a63('0x2f')]);_0x2ccd99[_0x0a63('0x30')]=_[_0x0a63('0x31')](_0x2ccd99[_0x0a63('0x2d')],_0x2ccd99[_0x0a63('0x2f')]);_0x4234cd[_0x0a63('0x33')]=_[_0x0a63('0x31')](_0x2ccd99[_0x0a63('0x2d')],qs[_0x0a63('0x32')](_0x1e3b70[_0x0a63('0x2f')][_0x0a63('0x32')]));_0x4234cd[_0x0a63('0x33')]=_0x4234cd[_0x0a63('0x33')][_0x0a63('0x41')]?_0x4234cd['attributes']:_0x2ccd99[_0x0a63('0x2d')];if(_0x1e3b70['query']['includeAll']){_0x4234cd[_0x0a63('0x3b')]=[{'all':!![]}];}_0x4234cd=_[_0x0a63('0x39')]({},_0x4234cd,_0x1e3b70[_0x0a63('0x3a')]);return db[_0x0a63('0x28')][_0x0a63('0x42')](_0x4234cd)[_0x0a63('0x24')](handleEntityNotFound(_0x236617,null))[_0x0a63('0x24')](respondWithResult(_0x236617,null))[_0x0a63('0x3e')](handleError(_0x236617,null));};exports[_0x0a63('0x43')]=function(_0xf00c9a,_0x9e5009){return db[_0x0a63('0x28')][_0x0a63('0x43')](_0xf00c9a[_0x0a63('0x44')],{})[_0x0a63('0x24')](respondWithResult(_0x9e5009,0xc9))[_0x0a63('0x3e')](handleError(_0x9e5009,null));};exports[_0x0a63('0x23')]=function(_0x20b864,_0x366887){if(_0x20b864[_0x0a63('0x44')]['id']){delete _0x20b864['body']['id'];}return db[_0x0a63('0x28')][_0x0a63('0x42')]({'where':{'id':_0x20b864['params']['id']}})['then'](handleEntityNotFound(_0x366887,null))['then'](saveUpdates(_0x20b864['body'],null))[_0x0a63('0x24')](respondWithResult(_0x366887,null))[_0x0a63('0x3e')](handleError(_0x366887,null));};exports['destroy']=function(_0x1abf0b,_0x59c367){return db[_0x0a63('0x28')][_0x0a63('0x42')]({'where':{'id':_0x1abf0b['params']['id']}})['then'](handleEntityNotFound(_0x59c367,null))['then'](removeEntity(_0x59c367,null))[_0x0a63('0x3e')](handleError(_0x59c367,null));};exports[_0x0a63('0x45')]=function(_0x246d03,_0xfa1083){return db[_0x0a63('0x28')]['describe']()[_0x0a63('0x24')](respondWithResult(_0xfa1083,null))[_0x0a63('0x3e')](handleError(_0xfa1083,null));}; \ No newline at end of file +var _0xcb66=['error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','key','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','options','then','includeAll','include','findAll','rows','show','params','keys','merge','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','save','update','destroy'];(function(_0x52784f,_0x45df37){var _0x28d1f6=function(_0x37f0a0){while(--_0x37f0a0){_0x52784f['push'](_0x52784f['shift']());}};_0x28d1f6(++_0x45df37);}(_0xcb66,0x19f));var _0x6cb6=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0xcb66[_0x39e84d];return _0x1991bc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6cb6('0x0'));var rimraf=require(_0x6cb6('0x1'));var zipdir=require(_0x6cb6('0x2'));var jsonpatch=require(_0x6cb6('0x3'));var rp=require(_0x6cb6('0x4'));var moment=require('moment');var BPromise=require(_0x6cb6('0x5'));var Mustache=require(_0x6cb6('0x6'));var util=require(_0x6cb6('0x7'));var path=require(_0x6cb6('0x8'));var sox=require(_0x6cb6('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6cb6('0xa'));var squel=require(_0x6cb6('0xb'));var crypto=require(_0x6cb6('0xc'));var jsforce=require(_0x6cb6('0xd'));var deskjs=require(_0x6cb6('0xe'));var toCsv=require(_0x6cb6('0xf'));var querystring=require(_0x6cb6('0x10'));var Papa=require(_0x6cb6('0x11'));var Redis=require(_0x6cb6('0x12'));var authService=require(_0x6cb6('0x13'));var qs=require(_0x6cb6('0x14'));var as=require(_0x6cb6('0x15'));var hardwareService=require(_0x6cb6('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x6cb6('0x17'))['db'];function respondWithStatusCode(_0x2b49d9,_0xad49d9){_0xad49d9=_0xad49d9||0xcc;return function(_0x2604e7){if(_0x2604e7){return _0x2b49d9['sendStatus'](_0xad49d9);}return _0x2b49d9[_0x6cb6('0x18')](_0xad49d9)[_0x6cb6('0x19')]();};}function respondWithResult(_0x57ee3b,_0x1e5468){_0x1e5468=_0x1e5468||0xc8;return function(_0x14a581){if(_0x14a581){return _0x57ee3b['status'](_0x1e5468)[_0x6cb6('0x1a')](_0x14a581);}};}function respondWithFilteredResult(_0x26b46b,_0x492629){return function(_0x5ab865){if(_0x5ab865){var _0x505b4d=_0x5ab865[_0x6cb6('0x1b')],_0x5dd4cd=_0x492629[_0x6cb6('0x1c')],_0x380edc=_0x492629[_0x6cb6('0x1c')]+_0x492629[_0x6cb6('0x1d')],_0x298daa;if(_0x380edc>=_0x505b4d){_0x380edc=_0x505b4d;_0x298daa=0xc8;}else{_0x298daa=0xce;}_0x26b46b['status'](_0x298daa);return _0x26b46b[_0x6cb6('0x1e')](_0x6cb6('0x1f'),_0x5dd4cd+'-'+_0x380edc+'/'+_0x505b4d)['json'](_0x5ab865);}return null;};}function patchUpdates(_0x4b9da5){return function(_0x5ef3d2){try{jsonpatch['apply'](_0x5ef3d2,_0x4b9da5,!![]);}catch(_0x57157f){return BPromise['reject'](_0x57157f);}return _0x5ef3d2[_0x6cb6('0x20')]();};}function saveUpdates(_0xcd1afa,_0x407455){return function(_0x2d41c4){if(_0x2d41c4){return _0x2d41c4[_0x6cb6('0x21')](_0xcd1afa)['then'](function(_0x520c9e){return _0x520c9e;});}return null;};}function removeEntity(_0x2dffa4,_0x1d35d1){return function(_0x1c4bcd){if(_0x1c4bcd){return _0x1c4bcd[_0x6cb6('0x22')]()['then'](function(){_0x2dffa4[_0x6cb6('0x18')](0xcc)[_0x6cb6('0x19')]();});}};}function handleEntityNotFound(_0x58a6ed,_0x5ad4f2){return function(_0xea5ee5){if(!_0xea5ee5){_0x58a6ed['sendStatus'](0x194);}return _0xea5ee5;};}function handleError(_0x5c91a2,_0x457865){_0x457865=_0x457865||0x1f4;return function(_0x90bac1){logger[_0x6cb6('0x23')](_0x90bac1[_0x6cb6('0x24')]);if(_0x90bac1[_0x6cb6('0x25')]){delete _0x90bac1[_0x6cb6('0x25')];}_0x5c91a2[_0x6cb6('0x18')](_0x457865)[_0x6cb6('0x26')](_0x90bac1);};}exports[_0x6cb6('0x27')]=function(_0x47a81b,_0x5c525b){var _0x4ea573={},_0x2dc6c9={},_0x462dbf={'count':0x0,'rows':[]};var _0xf07150=_[_0x6cb6('0x28')](db[_0x6cb6('0x29')][_0x6cb6('0x2a')],function(_0x57cd74){return{'name':_0x57cd74[_0x6cb6('0x2b')],'type':_0x57cd74['type'][_0x6cb6('0x2c')]};});_0x2dc6c9['model']=_[_0x6cb6('0x28')](_0xf07150,_0x6cb6('0x25'));_0x2dc6c9[_0x6cb6('0x2d')]=_['keys'](_0x47a81b[_0x6cb6('0x2d')]);_0x2dc6c9[_0x6cb6('0x2e')]=_[_0x6cb6('0x2f')](_0x2dc6c9['model'],_0x2dc6c9[_0x6cb6('0x2d')]);_0x4ea573[_0x6cb6('0x30')]=_[_0x6cb6('0x2f')](_0x2dc6c9['model'],qs[_0x6cb6('0x31')](_0x47a81b[_0x6cb6('0x2d')]['fields']));_0x4ea573[_0x6cb6('0x30')]=_0x4ea573[_0x6cb6('0x30')][_0x6cb6('0x32')]?_0x4ea573[_0x6cb6('0x30')]:_0x2dc6c9[_0x6cb6('0x33')];if(!_0x47a81b[_0x6cb6('0x2d')][_0x6cb6('0x34')](_0x6cb6('0x35'))){_0x4ea573[_0x6cb6('0x1d')]=qs[_0x6cb6('0x1d')](_0x47a81b['query'][_0x6cb6('0x1d')]);_0x4ea573[_0x6cb6('0x1c')]=qs[_0x6cb6('0x1c')](_0x47a81b[_0x6cb6('0x2d')]['offset']);}_0x4ea573['order']=qs['sort'](_0x47a81b[_0x6cb6('0x2d')][_0x6cb6('0x36')]);_0x4ea573[_0x6cb6('0x37')]=qs[_0x6cb6('0x2e')](_[_0x6cb6('0x38')](_0x47a81b[_0x6cb6('0x2d')],_0x2dc6c9[_0x6cb6('0x2e')]),_0xf07150);if(_0x47a81b[_0x6cb6('0x2d')]['filter']){_0x4ea573[_0x6cb6('0x37')]=_['merge'](_0x4ea573[_0x6cb6('0x37')],{'$or':_[_0x6cb6('0x28')](_0xf07150,function(_0x240935){if(_0x240935[_0x6cb6('0x39')]!==_0x6cb6('0x3a')){var _0x3bd60c={};_0x3bd60c[_0x240935[_0x6cb6('0x25')]]={'$like':'%'+_0x47a81b['query'][_0x6cb6('0x3b')]+'%'};return _0x3bd60c;}})});}_0x4ea573=_['merge']({},_0x4ea573,_0x47a81b[_0x6cb6('0x3c')]);var _0x18a4a1={'where':_0x4ea573[_0x6cb6('0x37')]};return db['UserProfileResource']['count'](_0x18a4a1)[_0x6cb6('0x3d')](function(_0x55c9c4){_0x462dbf[_0x6cb6('0x1b')]=_0x55c9c4;if(_0x47a81b[_0x6cb6('0x2d')][_0x6cb6('0x3e')]){_0x4ea573[_0x6cb6('0x3f')]=[{'all':!![]}];}return db[_0x6cb6('0x29')][_0x6cb6('0x40')](_0x4ea573);})[_0x6cb6('0x3d')](function(_0x4ef633){_0x462dbf[_0x6cb6('0x41')]=_0x4ef633;return _0x462dbf;})[_0x6cb6('0x3d')](respondWithFilteredResult(_0x5c525b,_0x4ea573))['catch'](handleError(_0x5c525b,null));};exports[_0x6cb6('0x42')]=function(_0x4c6b9f,_0x81b536){var _0x31a391={'raw':![],'where':{'id':_0x4c6b9f[_0x6cb6('0x43')]['id']}},_0x15a0a8={};_0x15a0a8['model']=_['keys'](db[_0x6cb6('0x29')]['rawAttributes']);_0x15a0a8['query']=_[_0x6cb6('0x44')](_0x4c6b9f['query']);_0x15a0a8[_0x6cb6('0x2e')]=_[_0x6cb6('0x2f')](_0x15a0a8['model'],_0x15a0a8['query']);_0x31a391[_0x6cb6('0x30')]=_['intersection'](_0x15a0a8[_0x6cb6('0x33')],qs[_0x6cb6('0x31')](_0x4c6b9f['query'][_0x6cb6('0x31')]));_0x31a391[_0x6cb6('0x30')]=_0x31a391['attributes'][_0x6cb6('0x32')]?_0x31a391['attributes']:_0x15a0a8[_0x6cb6('0x33')];if(_0x4c6b9f[_0x6cb6('0x2d')]['includeAll']){_0x31a391[_0x6cb6('0x3f')]=[{'all':!![]}];}_0x31a391=_[_0x6cb6('0x45')]({},_0x31a391,_0x4c6b9f['options']);return db['UserProfileResource'][_0x6cb6('0x46')](_0x31a391)[_0x6cb6('0x3d')](handleEntityNotFound(_0x81b536,null))[_0x6cb6('0x3d')](respondWithResult(_0x81b536,null))['catch'](handleError(_0x81b536,null));};exports[_0x6cb6('0x47')]=function(_0x331bc8,_0x4f4d59){return db[_0x6cb6('0x29')][_0x6cb6('0x47')](_0x331bc8[_0x6cb6('0x48')],{})['then'](respondWithResult(_0x4f4d59,0xc9))[_0x6cb6('0x49')](handleError(_0x4f4d59,null));};exports[_0x6cb6('0x21')]=function(_0x42dc72,_0x12bd7f){if(_0x42dc72[_0x6cb6('0x48')]['id']){delete _0x42dc72[_0x6cb6('0x48')]['id'];}return db['UserProfileResource'][_0x6cb6('0x46')]({'where':{'id':_0x42dc72['params']['id']}})['then'](handleEntityNotFound(_0x12bd7f,null))[_0x6cb6('0x3d')](saveUpdates(_0x42dc72[_0x6cb6('0x48')],null))['then'](respondWithResult(_0x12bd7f,null))[_0x6cb6('0x49')](handleError(_0x12bd7f,null));};exports['destroy']=function(_0x17b229,_0x2ae4ed){return db[_0x6cb6('0x29')]['find']({'where':{'id':_0x17b229[_0x6cb6('0x43')]['id']}})[_0x6cb6('0x3d')](handleEntityNotFound(_0x2ae4ed,null))[_0x6cb6('0x3d')](removeEntity(_0x2ae4ed,null))['catch'](handleError(_0x2ae4ed,null));};exports[_0x6cb6('0x4a')]=function(_0x5b9a06,_0x7e4104){return db[_0x6cb6('0x29')][_0x6cb6('0x4a')]()['then'](respondWithResult(_0x7e4104,null))['catch'](handleError(_0x7e4104,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 37726cd..4534554 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 _0xee5b=['request-promise','path','rimraf','exports','define','lodash','../../config/logger','api','bluebird'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xee5b,0x1f4));var _0xbee5=function(_0x338e9d,_0x29ac4c){_0x338e9d=_0x338e9d-0x0;var _0x22d3d7=_0xee5b[_0x338e9d];return _0x22d3d7;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');var logger=require(_0xbee5('0x1'))(_0xbee5('0x2'));var moment=require('moment');var BPromise=require(_0xbee5('0x3'));var rp=require(_0xbee5('0x4'));var fs=require('fs');var path=require(_0xbee5('0x5'));var rimraf=require(_0xbee5('0x6'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0xbee5('0x7')]=function(_0x2c0bde,_0xab6e4d){return _0x2c0bde[_0xbee5('0x8')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['request-promise','path','rimraf','../../config/environment','define','user_profile_has_resources','compositeIndex','sectionId','lodash','util','bluebird'];(function(_0x290492,_0x18cfad){var _0x52b5bf=function(_0x3c3c63){while(--_0x3c3c63){_0x290492['push'](_0x290492['shift']());}};_0x52b5bf(++_0x18cfad);}(_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('./userProfileResource.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('UserProfileResource',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['resourceId',_0x0d8b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 4843f7d..1c4e5f9 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 _0xed30=['rpc','../../config/environment','client','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x27f314,_0x48ee4f){var _0x5dcd67=function(_0x48884){while(--_0x48884){_0x27f314['push'](_0x27f314['shift']());}};_0x5dcd67(++_0x48ee4f);}(_0xed30,0xaf));var _0x0ed3=function(_0x3863f1,_0x3fdb93){_0x3863f1=_0x3863f1-0x0;var _0x1ba38f=_0xed30[_0x3863f1];return _0x1ba38f;};'use strict';var _=require(_0x0ed3('0x0'));var util=require(_0x0ed3('0x1'));var moment=require(_0x0ed3('0x2'));var BPromise=require(_0x0ed3('0x3'));var rs=require(_0x0ed3('0x4'));var fs=require('fs');var Redis=require(_0x0ed3('0x5'));var db=require(_0x0ed3('0x6'))['db'];var utils=require(_0x0ed3('0x7'));var logger=require(_0x0ed3('0x8'))(_0x0ed3('0x9'));var config=require(_0x0ed3('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x0ed3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1731b8,_0x187633,_0x380720){return new BPromise(function(_0x1fff19,_0x471cf1){return client[_0x0ed3('0xc')](_0x1731b8,_0x380720)['then'](function(_0x4ef02f){logger[_0x0ed3('0xd')](_0x0ed3('0xe'),_0x187633,_0x0ed3('0xf'));logger[_0x0ed3('0x10')](_0x0ed3('0x11'),_0x187633,_0x0ed3('0xf'),JSON[_0x0ed3('0x12')](_0x4ef02f));if(_0x4ef02f[_0x0ed3('0x13')]){if(_0x4ef02f[_0x0ed3('0x13')][_0x0ed3('0x14')]===0x1f4){logger[_0x0ed3('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x187633,_0x4ef02f[_0x0ed3('0x13')][_0x0ed3('0x15')]);return _0x471cf1(_0x4ef02f[_0x0ed3('0x13')][_0x0ed3('0x15')]);}logger['error'](_0x0ed3('0xe'),_0x187633,_0x4ef02f[_0x0ed3('0x13')][_0x0ed3('0x15')]);return _0x1fff19(_0x4ef02f[_0x0ed3('0x13')][_0x0ed3('0x15')]);}else{logger['info'](_0x0ed3('0xe'),_0x187633,'request\x20sent');_0x1fff19(_0x4ef02f[_0x0ed3('0x16')][_0x0ed3('0x15')]);}})['catch'](function(_0x2dd5b8){logger[_0x0ed3('0x13')](_0x0ed3('0xe'),_0x187633,_0x2dd5b8);_0x471cf1(_0x2dd5b8);});});} \ No newline at end of file +var _0x0ccb=['UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','UserProfileResource,\x20%s,\x20%s','message','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent'];(function(_0x1fdcaf,_0x544006){var _0x21ced9=function(_0xfd35f0){while(--_0xfd35f0){_0x1fdcaf['push'](_0x1fdcaf['shift']());}};_0x21ced9(++_0x544006);}(_0x0ccb,0x77));var _0xb0cc=function(_0x22348c,_0x1cf717){_0x22348c=_0x22348c-0x0;var _0x5df6cf=_0x0ccb[_0x22348c];return _0x5df6cf;};'use strict';var _=require(_0xb0cc('0x0'));var util=require(_0xb0cc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb0cc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb0cc('0x3'))['db'];var utils=require(_0xb0cc('0x4'));var logger=require(_0xb0cc('0x5'))(_0xb0cc('0x6'));var config=require(_0xb0cc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb0cc('0x8')][_0xb0cc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11357b,_0x1b1bae,_0x1a4517){return new BPromise(function(_0x40a23a,_0x260fd2){return client[_0xb0cc('0xa')](_0x11357b,_0x1a4517)[_0xb0cc('0xb')](function(_0x5228f2){logger[_0xb0cc('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x1b1bae,_0xb0cc('0xd'));logger['debug'](_0xb0cc('0xe'),_0x1b1bae,'request\x20sent',JSON['stringify'](_0x5228f2));if(_0x5228f2[_0xb0cc('0xf')]){if(_0x5228f2[_0xb0cc('0xf')][_0xb0cc('0x10')]===0x1f4){logger[_0xb0cc('0xf')](_0xb0cc('0x11'),_0x1b1bae,_0x5228f2['error'][_0xb0cc('0x12')]);return _0x260fd2(_0x5228f2['error'][_0xb0cc('0x12')]);}logger['error'](_0xb0cc('0x11'),_0x1b1bae,_0x5228f2['error'][_0xb0cc('0x12')]);return _0x40a23a(_0x5228f2[_0xb0cc('0xf')][_0xb0cc('0x12')]);}else{logger[_0xb0cc('0xc')](_0xb0cc('0x11'),_0x1b1bae,'request\x20sent');_0x40a23a(_0x5228f2['result'][_0xb0cc('0x12')]);}})['catch'](function(_0x6afa5b){logger[_0xb0cc('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x1b1bae,_0x6afa5b);_0x260fd2(_0x6afa5b);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 962d673..12b5169 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 _0x1fd2=['Router','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','/describe','isAuthenticated','/:id','show','post','create','update','destroy','exports','util','path','express'];(function(_0x43f155,_0x2057b1){var _0x21bc11=function(_0x6ebe70){while(--_0x6ebe70){_0x43f155['push'](_0x43f155['shift']());}};_0x21bc11(++_0x2057b1);}(_0x1fd2,0x184));var _0x21fd=function(_0x1339dd,_0xafc6f8){_0x1339dd=_0x1339dd-0x0;var _0x5e14a4=_0x1fd2[_0x1339dd];return _0x5e14a4;};'use strict';var multer=require('multer');var util=require(_0x21fd('0x0'));var path=require(_0x21fd('0x1'));var timeout=require('connect-timeout');var express=require(_0x21fd('0x2'));var router=express[_0x21fd('0x3')]();var auth=require(_0x21fd('0x4'));var interaction=require(_0x21fd('0x5'));var config=require('../../config/environment');var controller=require(_0x21fd('0x6'));router[_0x21fd('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x21fd('0x7')](_0x21fd('0x8'),auth[_0x21fd('0x9')](),controller['describe']);router[_0x21fd('0x7')](_0x21fd('0xa'),auth[_0x21fd('0x9')](),controller[_0x21fd('0xb')]);router[_0x21fd('0xc')]('/',auth[_0x21fd('0x9')](),controller[_0x21fd('0xd')]);router['put'](_0x21fd('0xa'),auth[_0x21fd('0x9')](),controller[_0x21fd('0xe')]);router['delete'](_0x21fd('0xa'),auth[_0x21fd('0x9')](),controller[_0x21fd('0xf')]);module[_0x21fd('0x10')]=router; \ No newline at end of file +var _0xcbef=['exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index','/describe','isAuthenticated','/:id','create','update','destroy'];(function(_0x265904,_0x4beb20){var _0x418d45=function(_0x4f5465){while(--_0x4f5465){_0x265904['push'](_0x265904['shift']());}};_0x418d45(++_0x4beb20);}(_0xcbef,0x78));var _0xfcbe=function(_0x385f81,_0x394333){_0x385f81=_0x385f81-0x0;var _0x390b9e=_0xcbef[_0x385f81];return _0x390b9e;};'use strict';var multer=require('multer');var util=require(_0xfcbe('0x0'));var path=require(_0xfcbe('0x1'));var timeout=require(_0xfcbe('0x2'));var express=require(_0xfcbe('0x3'));var router=express[_0xfcbe('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xfcbe('0x5'));var config=require(_0xfcbe('0x6'));var controller=require(_0xfcbe('0x7'));router[_0xfcbe('0x8')]('/',auth['isAuthenticated'](),controller[_0xfcbe('0x9')]);router['get'](_0xfcbe('0xa'),auth[_0xfcbe('0xb')](),controller['describe']);router['get'](_0xfcbe('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xfcbe('0xb')](),controller[_0xfcbe('0xd')]);router['put'](_0xfcbe('0xc'),auth[_0xfcbe('0xb')](),controller[_0xfcbe('0xe')]);router['delete'](_0xfcbe('0xc'),auth[_0xfcbe('0xb')](),controller[_0xfcbe('0xf')]);module[_0xfcbe('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 8e6acd4..3bea013 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 _0xa4de=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize'];(function(_0x29276c,_0x19512a){var _0x190a06=function(_0x55ea07){while(--_0x55ea07){_0x29276c['push'](_0x29276c['shift']());}};_0x190a06(++_0x19512a);}(_0xa4de,0x10d));var _0xea4d=function(_0x526168,_0x414b29){_0x526168=_0x526168-0x0;var _0x2b5b60=_0xa4de[_0x526168];return _0x2b5b60;};'use strict';var Sequelize=require(_0xea4d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xea4d('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xea4d('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xea4d('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xea4d('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xea4d('0x1')],'set':function(_0x111a9e){this[_0xea4d('0x4')](_0xea4d('0x5'),_0x111a9e?_0x111a9e[_0xea4d('0x6')](''):[]);},'get':function(){return this[_0xea4d('0x7')](_0xea4d('0x5'))?this[_0xea4d('0x7')]('crudPermissions')[_0xea4d('0x8')](''):[];}}}; \ No newline at end of file +var _0xa98d=['split','sequelize','exports','STRING','BOOLEAN','crudPermissions','join','getDataValue'];(function(_0xdcbc08,_0x354c59){var _0x468da5=function(_0x1b21de){while(--_0x1b21de){_0xdcbc08['push'](_0xdcbc08['shift']());}};_0x468da5(++_0x354c59);}(_0xa98d,0x171));var _0xda98=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa98d[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xda98('0x0'));module[_0xda98('0x1')]={'name':{'type':Sequelize[_0xda98('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xda98('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xda98('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xda98('0x2')],'set':function(_0x3f2a11){this['setDataValue'](_0xda98('0x4'),_0x3f2a11?_0x3f2a11[_0xda98('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0xda98('0x4'))?this[_0xda98('0x6')](_0xda98('0x4'))[_0xda98('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index b512973..c43a59b 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 _0xf1c9=['VIRTUAL','options','count','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','apply','reject','save','update','then','destroy','stack','name','send','map','UserProfileSection','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge'];(function(_0x467cb0,_0x303070){var _0x2153f7=function(_0x51775a){while(--_0x51775a){_0x467cb0['push'](_0x467cb0['shift']());}};_0x2153f7(++_0x303070);}(_0xf1c9,0xa0));var _0x9f1c=function(_0x50c0ea,_0x2210e6){_0x50c0ea=_0x50c0ea-0x0;var _0x1e1168=_0xf1c9[_0x50c0ea];return _0x1e1168;};'use strict';var pdf=require(_0x9f1c('0x0'));var emlformat=require(_0x9f1c('0x1'));var rimraf=require(_0x9f1c('0x2'));var zipdir=require(_0x9f1c('0x3'));var jsonpatch=require(_0x9f1c('0x4'));var rp=require(_0x9f1c('0x5'));var moment=require(_0x9f1c('0x6'));var BPromise=require(_0x9f1c('0x7'));var Mustache=require(_0x9f1c('0x8'));var util=require(_0x9f1c('0x9'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9f1c('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9f1c('0xb'));var crypto=require(_0x9f1c('0xc'));var jsforce=require(_0x9f1c('0xd'));var deskjs=require(_0x9f1c('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9f1c('0xf'));var authService=require(_0x9f1c('0x10'));var qs=require(_0x9f1c('0x11'));var as=require(_0x9f1c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f1c('0x13'))(_0x9f1c('0x14'));var utils=require(_0x9f1c('0x15'));var config=require(_0x9f1c('0x16'));var db=require(_0x9f1c('0x17'))['db'];function respondWithStatusCode(_0xc9e7da,_0x11cd89){_0x11cd89=_0x11cd89||0xcc;return function(_0x158f79){if(_0x158f79){return _0xc9e7da[_0x9f1c('0x18')](_0x11cd89);}return _0xc9e7da[_0x9f1c('0x19')](_0x11cd89)[_0x9f1c('0x1a')]();};}function respondWithResult(_0x5dedd2,_0x5b203b){_0x5b203b=_0x5b203b||0xc8;return function(_0x11c04d){if(_0x11c04d){return _0x5dedd2[_0x9f1c('0x19')](_0x5b203b)[_0x9f1c('0x1b')](_0x11c04d);}};}function respondWithFilteredResult(_0x2b4cf9,_0x5a467c){return function(_0x429b4e){if(_0x429b4e){var _0x57cd97=_0x429b4e['count'],_0x5b47a4=_0x5a467c[_0x9f1c('0x1c')],_0xdd816e=_0x5a467c[_0x9f1c('0x1c')]+_0x5a467c['limit'],_0x2f5f7a;if(_0xdd816e>=_0x57cd97){_0xdd816e=_0x57cd97;_0x2f5f7a=0xc8;}else{_0x2f5f7a=0xce;}_0x2b4cf9['status'](_0x2f5f7a);return _0x2b4cf9[_0x9f1c('0x1d')]('Content-Range',_0x5b47a4+'-'+_0xdd816e+'/'+_0x57cd97)[_0x9f1c('0x1b')](_0x429b4e);}return null;};}function patchUpdates(_0x43060c){return function(_0x4b6e6e){try{jsonpatch[_0x9f1c('0x1e')](_0x4b6e6e,_0x43060c,!![]);}catch(_0x1c07f2){return BPromise[_0x9f1c('0x1f')](_0x1c07f2);}return _0x4b6e6e[_0x9f1c('0x20')]();};}function saveUpdates(_0x3288f7,_0x5037d5){return function(_0x43bd97){if(_0x43bd97){return _0x43bd97[_0x9f1c('0x21')](_0x3288f7)[_0x9f1c('0x22')](function(_0x10eb8f){return _0x10eb8f;});}return null;};}function removeEntity(_0x4d6eb1,_0x553d01){return function(_0x18c474){if(_0x18c474){return _0x18c474[_0x9f1c('0x23')]()[_0x9f1c('0x22')](function(){_0x4d6eb1[_0x9f1c('0x19')](0xcc)[_0x9f1c('0x1a')]();});}};}function handleEntityNotFound(_0x15c584,_0x464f3d){return function(_0x486771){if(!_0x486771){_0x15c584[_0x9f1c('0x18')](0x194);}return _0x486771;};}function handleError(_0x3423c1,_0x26943a){_0x26943a=_0x26943a||0x1f4;return function(_0x5a63ef){logger['error'](_0x5a63ef[_0x9f1c('0x24')]);if(_0x5a63ef[_0x9f1c('0x25')]){delete _0x5a63ef['name'];}_0x3423c1[_0x9f1c('0x19')](_0x26943a)[_0x9f1c('0x26')](_0x5a63ef);};}exports['index']=function(_0x358543,_0x5c411c){var _0x335df5={},_0x59fec5={},_0x686f10={'count':0x0,'rows':[]};var _0x26c3c3=_[_0x9f1c('0x27')](db[_0x9f1c('0x28')]['rawAttributes'],function(_0x4d5d89){return{'name':_0x4d5d89[_0x9f1c('0x29')],'type':_0x4d5d89[_0x9f1c('0x2a')][_0x9f1c('0x2b')]};});_0x59fec5[_0x9f1c('0x2c')]=_[_0x9f1c('0x27')](_0x26c3c3,'name');_0x59fec5[_0x9f1c('0x2d')]=_[_0x9f1c('0x2e')](_0x358543['query']);_0x59fec5[_0x9f1c('0x2f')]=_['intersection'](_0x59fec5[_0x9f1c('0x2c')],_0x59fec5[_0x9f1c('0x2d')]);_0x335df5['attributes']=_[_0x9f1c('0x30')](_0x59fec5[_0x9f1c('0x2c')],qs[_0x9f1c('0x31')](_0x358543[_0x9f1c('0x2d')]['fields']));_0x335df5[_0x9f1c('0x32')]=_0x335df5['attributes'][_0x9f1c('0x33')]?_0x335df5['attributes']:_0x59fec5['model'];if(!_0x358543[_0x9f1c('0x2d')][_0x9f1c('0x34')](_0x9f1c('0x35'))){_0x335df5[_0x9f1c('0x36')]=qs[_0x9f1c('0x36')](_0x358543[_0x9f1c('0x2d')][_0x9f1c('0x36')]);_0x335df5['offset']=qs[_0x9f1c('0x1c')](_0x358543['query']['offset']);}_0x335df5['order']=qs['sort'](_0x358543[_0x9f1c('0x2d')][_0x9f1c('0x37')]);_0x335df5[_0x9f1c('0x38')]=qs[_0x9f1c('0x2f')](_['pick'](_0x358543[_0x9f1c('0x2d')],_0x59fec5[_0x9f1c('0x2f')]),_0x26c3c3);if(_0x358543[_0x9f1c('0x2d')][_0x9f1c('0x39')]){_0x335df5[_0x9f1c('0x38')]=_[_0x9f1c('0x3a')](_0x335df5[_0x9f1c('0x38')],{'$or':_[_0x9f1c('0x27')](_0x26c3c3,function(_0x674a1f){if(_0x674a1f[_0x9f1c('0x2a')]!==_0x9f1c('0x3b')){var _0x88048a={};_0x88048a[_0x674a1f[_0x9f1c('0x25')]]={'$like':'%'+_0x358543[_0x9f1c('0x2d')][_0x9f1c('0x39')]+'%'};return _0x88048a;}})});}_0x335df5=_['merge']({},_0x335df5,_0x358543[_0x9f1c('0x3c')]);var _0x96c34e={'where':_0x335df5[_0x9f1c('0x38')]};return db[_0x9f1c('0x28')][_0x9f1c('0x3d')](_0x96c34e)[_0x9f1c('0x22')](function(_0x3593e3){_0x686f10[_0x9f1c('0x3d')]=_0x3593e3;if(_0x358543[_0x9f1c('0x2d')][_0x9f1c('0x3e')]){_0x335df5[_0x9f1c('0x3f')]=[{'all':!![]}];}return db['UserProfileSection'][_0x9f1c('0x40')](_0x335df5);})['then'](function(_0x477699){_0x686f10[_0x9f1c('0x41')]=_0x477699;return _0x686f10;})['then'](respondWithFilteredResult(_0x5c411c,_0x335df5))[_0x9f1c('0x42')](handleError(_0x5c411c,null));};exports['show']=function(_0x27a504,_0x5f0334){var _0x2be2fc={'raw':![],'where':{'id':_0x27a504['params']['id']}},_0x54b94f={};_0x54b94f[_0x9f1c('0x2c')]=_[_0x9f1c('0x2e')](db[_0x9f1c('0x28')][_0x9f1c('0x43')]);_0x54b94f['query']=_['keys'](_0x27a504[_0x9f1c('0x2d')]);_0x54b94f[_0x9f1c('0x2f')]=_[_0x9f1c('0x30')](_0x54b94f[_0x9f1c('0x2c')],_0x54b94f[_0x9f1c('0x2d')]);_0x2be2fc['attributes']=_[_0x9f1c('0x30')](_0x54b94f['model'],qs['fields'](_0x27a504[_0x9f1c('0x2d')][_0x9f1c('0x31')]));_0x2be2fc[_0x9f1c('0x32')]=_0x2be2fc[_0x9f1c('0x32')][_0x9f1c('0x33')]?_0x2be2fc[_0x9f1c('0x32')]:_0x54b94f[_0x9f1c('0x2c')];if(_0x27a504[_0x9f1c('0x2d')][_0x9f1c('0x3e')]){_0x2be2fc['include']=[{'all':!![]}];}_0x2be2fc=_[_0x9f1c('0x3a')]({},_0x2be2fc,_0x27a504[_0x9f1c('0x3c')]);return db[_0x9f1c('0x28')][_0x9f1c('0x44')](_0x2be2fc)['then'](handleEntityNotFound(_0x5f0334,null))['then'](respondWithResult(_0x5f0334,null))[_0x9f1c('0x42')](handleError(_0x5f0334,null));};exports['create']=function(_0x454e14,_0x1b0597){return db['UserProfileSection'][_0x9f1c('0x45')](_0x454e14[_0x9f1c('0x46')],{})[_0x9f1c('0x22')](respondWithResult(_0x1b0597,0xc9))[_0x9f1c('0x42')](handleError(_0x1b0597,null));};exports[_0x9f1c('0x21')]=function(_0x507cea,_0x2249d3){if(_0x507cea[_0x9f1c('0x46')]['id']){delete _0x507cea[_0x9f1c('0x46')]['id'];}return db['UserProfileSection'][_0x9f1c('0x44')]({'where':{'id':_0x507cea[_0x9f1c('0x47')]['id']}})[_0x9f1c('0x22')](handleEntityNotFound(_0x2249d3,null))[_0x9f1c('0x22')](saveUpdates(_0x507cea[_0x9f1c('0x46')],null))[_0x9f1c('0x22')](respondWithResult(_0x2249d3,null))[_0x9f1c('0x42')](handleError(_0x2249d3,null));};exports[_0x9f1c('0x23')]=function(_0x108741,_0x44138a){return db[_0x9f1c('0x28')][_0x9f1c('0x44')]({'where':{'id':_0x108741[_0x9f1c('0x47')]['id']}})[_0x9f1c('0x22')](handleEntityNotFound(_0x44138a,null))['then'](removeEntity(_0x44138a,null))[_0x9f1c('0x42')](handleError(_0x44138a,null));};exports[_0x9f1c('0x48')]=function(_0x462778,_0x1a151c){return db[_0x9f1c('0x28')]['describe']()[_0x9f1c('0x22')](respondWithResult(_0x1a151c,null))[_0x9f1c('0x42')](handleError(_0x1a151c,null));}; \ No newline at end of file +var _0x5a80=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','set','Content-Range','apply','save','then','destroy','end','name','send','index','map','UserProfileSection','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','rows','params','length','options','find','catch','create','body','update','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x193461,_0x42ce71){var _0x4c237c=function(_0x544492){while(--_0x544492){_0x193461['push'](_0x193461['shift']());}};_0x4c237c(++_0x42ce71);}(_0x5a80,0x15b));var _0x05a8=function(_0x1a212f,_0x5bed4e){_0x1a212f=_0x1a212f-0x0;var _0x2b22bd=_0x5a80[_0x1a212f];return _0x2b22bd;};'use strict';var pdf=require(_0x05a8('0x0'));var emlformat=require(_0x05a8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x05a8('0x2'));var jsonpatch=require(_0x05a8('0x3'));var rp=require(_0x05a8('0x4'));var moment=require(_0x05a8('0x5'));var BPromise=require(_0x05a8('0x6'));var Mustache=require('mustache');var util=require(_0x05a8('0x7'));var path=require(_0x05a8('0x8'));var sox=require(_0x05a8('0x9'));var csv=require(_0x05a8('0xa'));var ejs=require(_0x05a8('0xb'));var fs=require('fs');var _=require(_0x05a8('0xc'));var squel=require(_0x05a8('0xd'));var crypto=require(_0x05a8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x05a8('0xf'));var toCsv=require(_0x05a8('0xa'));var querystring=require('querystring');var Papa=require(_0x05a8('0x10'));var Redis=require(_0x05a8('0x11'));var authService=require(_0x05a8('0x12'));var qs=require(_0x05a8('0x13'));var as=require(_0x05a8('0x14'));var hardwareService=require(_0x05a8('0x15'));var logger=require('../../config/logger')(_0x05a8('0x16'));var utils=require(_0x05a8('0x17'));var config=require(_0x05a8('0x18'));var db=require(_0x05a8('0x19'))['db'];function respondWithStatusCode(_0x2e1414,_0x40b367){_0x40b367=_0x40b367||0xcc;return function(_0x93f9bf){if(_0x93f9bf){return _0x2e1414[_0x05a8('0x1a')](_0x40b367);}return _0x2e1414[_0x05a8('0x1b')](_0x40b367)['end']();};}function respondWithResult(_0x432ea3,_0x11edce){_0x11edce=_0x11edce||0xc8;return function(_0x3e248c){if(_0x3e248c){return _0x432ea3['status'](_0x11edce)[_0x05a8('0x1c')](_0x3e248c);}};}function respondWithFilteredResult(_0x4230cd,_0x398fee){return function(_0x4355e0){if(_0x4355e0){var _0x24eda7=_0x4355e0['count'],_0x5c583f=_0x398fee['offset'],_0x5f0965=_0x398fee['offset']+_0x398fee[_0x05a8('0x1d')],_0x1d3012;if(_0x5f0965>=_0x24eda7){_0x5f0965=_0x24eda7;_0x1d3012=0xc8;}else{_0x1d3012=0xce;}_0x4230cd[_0x05a8('0x1b')](_0x1d3012);return _0x4230cd[_0x05a8('0x1e')](_0x05a8('0x1f'),_0x5c583f+'-'+_0x5f0965+'/'+_0x24eda7)[_0x05a8('0x1c')](_0x4355e0);}return null;};}function patchUpdates(_0x39e5c9){return function(_0x2f8379){try{jsonpatch[_0x05a8('0x20')](_0x2f8379,_0x39e5c9,!![]);}catch(_0xf81e79){return BPromise['reject'](_0xf81e79);}return _0x2f8379[_0x05a8('0x21')]();};}function saveUpdates(_0x3b9671,_0x2cb960){return function(_0x5d03aa){if(_0x5d03aa){return _0x5d03aa['update'](_0x3b9671)[_0x05a8('0x22')](function(_0x27617f){return _0x27617f;});}return null;};}function removeEntity(_0x32cea2,_0x59769f){return function(_0x3be7b3){if(_0x3be7b3){return _0x3be7b3[_0x05a8('0x23')]()[_0x05a8('0x22')](function(){_0x32cea2[_0x05a8('0x1b')](0xcc)[_0x05a8('0x24')]();});}};}function handleEntityNotFound(_0x5d781d,_0x35f175){return function(_0x8778d1){if(!_0x8778d1){_0x5d781d[_0x05a8('0x1a')](0x194);}return _0x8778d1;};}function handleError(_0x5f3ebb,_0x2a4298){_0x2a4298=_0x2a4298||0x1f4;return function(_0x4b163f){logger['error'](_0x4b163f['stack']);if(_0x4b163f[_0x05a8('0x25')]){delete _0x4b163f['name'];}_0x5f3ebb['status'](_0x2a4298)[_0x05a8('0x26')](_0x4b163f);};}exports[_0x05a8('0x27')]=function(_0x41c57d,_0x2e72b2){var _0x341261={},_0x12949c={},_0x46ca2e={'count':0x0,'rows':[]};var _0x57db75=_[_0x05a8('0x28')](db[_0x05a8('0x29')][_0x05a8('0x2a')],function(_0x36b58b){return{'name':_0x36b58b['fieldName'],'type':_0x36b58b[_0x05a8('0x2b')][_0x05a8('0x2c')]};});_0x12949c[_0x05a8('0x2d')]=_[_0x05a8('0x28')](_0x57db75,_0x05a8('0x25'));_0x12949c[_0x05a8('0x2e')]=_[_0x05a8('0x2f')](_0x41c57d[_0x05a8('0x2e')]);_0x12949c[_0x05a8('0x30')]=_[_0x05a8('0x31')](_0x12949c[_0x05a8('0x2d')],_0x12949c[_0x05a8('0x2e')]);_0x341261['attributes']=_[_0x05a8('0x31')](_0x12949c[_0x05a8('0x2d')],qs['fields'](_0x41c57d[_0x05a8('0x2e')][_0x05a8('0x32')]));_0x341261[_0x05a8('0x33')]=_0x341261[_0x05a8('0x33')]['length']?_0x341261[_0x05a8('0x33')]:_0x12949c[_0x05a8('0x2d')];if(!_0x41c57d['query']['hasOwnProperty'](_0x05a8('0x34'))){_0x341261[_0x05a8('0x1d')]=qs['limit'](_0x41c57d['query'][_0x05a8('0x1d')]);_0x341261[_0x05a8('0x35')]=qs[_0x05a8('0x35')](_0x41c57d[_0x05a8('0x2e')][_0x05a8('0x35')]);}_0x341261[_0x05a8('0x36')]=qs[_0x05a8('0x37')](_0x41c57d['query'][_0x05a8('0x37')]);_0x341261[_0x05a8('0x38')]=qs[_0x05a8('0x30')](_[_0x05a8('0x39')](_0x41c57d['query'],_0x12949c['filters']),_0x57db75);if(_0x41c57d[_0x05a8('0x2e')][_0x05a8('0x3a')]){_0x341261['where']=_[_0x05a8('0x3b')](_0x341261[_0x05a8('0x38')],{'$or':_[_0x05a8('0x28')](_0x57db75,function(_0x53e681){if(_0x53e681[_0x05a8('0x2b')]!==_0x05a8('0x3c')){var _0x17bb80={};_0x17bb80[_0x53e681[_0x05a8('0x25')]]={'$like':'%'+_0x41c57d[_0x05a8('0x2e')][_0x05a8('0x3a')]+'%'};return _0x17bb80;}})});}_0x341261=_[_0x05a8('0x3b')]({},_0x341261,_0x41c57d['options']);var _0x31ce40={'where':_0x341261[_0x05a8('0x38')]};return db[_0x05a8('0x29')]['count'](_0x31ce40)[_0x05a8('0x22')](function(_0x13fee0){_0x46ca2e[_0x05a8('0x3d')]=_0x13fee0;if(_0x41c57d[_0x05a8('0x2e')][_0x05a8('0x3e')]){_0x341261[_0x05a8('0x3f')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x341261);})[_0x05a8('0x22')](function(_0x3a7a78){_0x46ca2e[_0x05a8('0x40')]=_0x3a7a78;return _0x46ca2e;})[_0x05a8('0x22')](respondWithFilteredResult(_0x2e72b2,_0x341261))['catch'](handleError(_0x2e72b2,null));};exports['show']=function(_0x4f583a,_0x517867){var _0x2371ce={'raw':![],'where':{'id':_0x4f583a[_0x05a8('0x41')]['id']}},_0x658224={};_0x658224['model']=_['keys'](db['UserProfileSection'][_0x05a8('0x2a')]);_0x658224[_0x05a8('0x2e')]=_[_0x05a8('0x2f')](_0x4f583a[_0x05a8('0x2e')]);_0x658224[_0x05a8('0x30')]=_[_0x05a8('0x31')](_0x658224[_0x05a8('0x2d')],_0x658224[_0x05a8('0x2e')]);_0x2371ce[_0x05a8('0x33')]=_[_0x05a8('0x31')](_0x658224[_0x05a8('0x2d')],qs[_0x05a8('0x32')](_0x4f583a['query'][_0x05a8('0x32')]));_0x2371ce[_0x05a8('0x33')]=_0x2371ce[_0x05a8('0x33')][_0x05a8('0x42')]?_0x2371ce['attributes']:_0x658224[_0x05a8('0x2d')];if(_0x4f583a[_0x05a8('0x2e')][_0x05a8('0x3e')]){_0x2371ce[_0x05a8('0x3f')]=[{'all':!![]}];}_0x2371ce=_[_0x05a8('0x3b')]({},_0x2371ce,_0x4f583a[_0x05a8('0x43')]);return db['UserProfileSection'][_0x05a8('0x44')](_0x2371ce)[_0x05a8('0x22')](handleEntityNotFound(_0x517867,null))['then'](respondWithResult(_0x517867,null))[_0x05a8('0x45')](handleError(_0x517867,null));};exports['create']=function(_0x24db31,_0x1d6015){return db[_0x05a8('0x29')][_0x05a8('0x46')](_0x24db31[_0x05a8('0x47')],{})['then'](respondWithResult(_0x1d6015,0xc9))['catch'](handleError(_0x1d6015,null));};exports[_0x05a8('0x48')]=function(_0x3f17c5,_0x89b694){if(_0x3f17c5['body']['id']){delete _0x3f17c5['body']['id'];}return db[_0x05a8('0x29')][_0x05a8('0x44')]({'where':{'id':_0x3f17c5[_0x05a8('0x41')]['id']}})['then'](handleEntityNotFound(_0x89b694,null))[_0x05a8('0x22')](saveUpdates(_0x3f17c5['body'],null))[_0x05a8('0x22')](respondWithResult(_0x89b694,null))['catch'](handleError(_0x89b694,null));};exports[_0x05a8('0x23')]=function(_0x348814,_0xeccfb9){return db[_0x05a8('0x29')][_0x05a8('0x44')]({'where':{'id':_0x348814[_0x05a8('0x41')]['id']}})[_0x05a8('0x22')](handleEntityNotFound(_0xeccfb9,null))[_0x05a8('0x22')](removeEntity(_0xeccfb9,null))[_0x05a8('0x45')](handleError(_0xeccfb9,null));};exports[_0x05a8('0x49')]=function(_0x1e0260,_0x5a3349){return db[_0x05a8('0x29')][_0x05a8('0x49')]()[_0x05a8('0x22')](respondWithResult(_0x5a3349,null))[_0x05a8('0x45')](handleError(_0x5a3349,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 41d8e05..b8f7d80 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 _0x9fe3=['UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','util','../../config/logger','api','path','rimraf','../../config/environment','exports','define'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9fe3,0x1a5));var _0x39fe=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9fe3[_0x5f09c5];return _0x426ad9;};'use strict';var _=require('lodash');var util=require(_0x39fe('0x0'));var logger=require(_0x39fe('0x1'))(_0x39fe('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x39fe('0x3'));var rimraf=require(_0x39fe('0x4'));var config=require(_0x39fe('0x5'));var attributes=require('./userProfileSection.attributes');module[_0x39fe('0x6')]=function(_0x21a5af,_0x39cd8f){return _0x21a5af[_0x39fe('0x7')](_0x39fe('0x8'),attributes,{'tableName':_0x39fe('0x9'),'paranoid':![],'indexes':[{'name':_0x39fe('0xa'),'fields':[_0x39fe('0xb'),_0x39fe('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x85f5=['userProfileId','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId'];(function(_0x2de59e,_0x24b766){var _0x534d4b=function(_0x30617b){while(--_0x30617b){_0x2de59e['push'](_0x2de59e['shift']());}};_0x534d4b(++_0x24b766);}(_0x85f5,0x153));var _0x585f=function(_0xf7b88a,_0x12c26c){_0xf7b88a=_0xf7b88a-0x0;var _0x286494=_0x85f5[_0xf7b88a];return _0x286494;};'use strict';var _=require('lodash');var util=require(_0x585f('0x0'));var logger=require(_0x585f('0x1'))('api');var moment=require(_0x585f('0x2'));var BPromise=require(_0x585f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x585f('0x4'));var rimraf=require(_0x585f('0x5'));var config=require(_0x585f('0x6'));var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x22a4cb,_0x57b87a){return _0x22a4cb[_0x585f('0x7')](_0x585f('0x8'),attributes,{'tableName':_0x585f('0x9'),'paranoid':![],'indexes':[{'name':_0x585f('0xa'),'fields':[_0x585f('0xb'),_0x585f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 0db8465..9078a3f 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 _0x590e=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x334f31,_0x11fa0a){var _0x18222f=function(_0x53cfc7){while(--_0x53cfc7){_0x334f31['push'](_0x334f31['shift']());}};_0x18222f(++_0x11fa0a);}(_0x590e,0x17c));var _0xe590=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x590e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe590('0x0'));var util=require(_0xe590('0x1'));var moment=require(_0xe590('0x2'));var BPromise=require(_0xe590('0x3'));var rs=require(_0xe590('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe590('0x5'))['db'];var utils=require(_0xe590('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe590('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe590('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3fc81f,_0x3e2adb,_0x15779a){return new BPromise(function(_0x52df73,_0x5807b6){return client['request'](_0x3fc81f,_0x15779a)['then'](function(_0x5680de){logger[_0xe590('0x9')](_0xe590('0xa'),_0x3e2adb,_0xe590('0xb'));logger[_0xe590('0xc')](_0xe590('0xd'),_0x3e2adb,_0xe590('0xb'),JSON[_0xe590('0xe')](_0x5680de));if(_0x5680de[_0xe590('0xf')]){if(_0x5680de[_0xe590('0xf')][_0xe590('0x10')]===0x1f4){logger['error'](_0xe590('0xa'),_0x3e2adb,_0x5680de['error'][_0xe590('0x11')]);return _0x5807b6(_0x5680de['error'][_0xe590('0x11')]);}logger[_0xe590('0xf')](_0xe590('0xa'),_0x3e2adb,_0x5680de[_0xe590('0xf')][_0xe590('0x11')]);return _0x52df73(_0x5680de['error'][_0xe590('0x11')]);}else{logger[_0xe590('0x9')]('UserProfileSection,\x20%s,\x20%s',_0x3e2adb,_0xe590('0xb'));_0x52df73(_0x5680de[_0xe590('0x12')][_0xe590('0x11')]);}})[_0xe590('0x13')](function(_0x315e47){logger[_0xe590('0xf')](_0xe590('0xa'),_0x3e2adb,_0x315e47);_0x5807b6(_0x315e47);});});} \ No newline at end of file +var _0xb278=['jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x9f295b,_0x5d274d){var _0x36d06d=function(_0x33b3e8){while(--_0x33b3e8){_0x9f295b['push'](_0x9f295b['shift']());}};_0x36d06d(++_0x5d274d);}(_0xb278,0x15e));var _0x8b27=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0xb278[_0x599e60];return _0x468e19;};'use strict';var _=require(_0x8b27('0x0'));var util=require(_0x8b27('0x1'));var moment=require(_0x8b27('0x2'));var BPromise=require(_0x8b27('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b27('0x4'));var db=require(_0x8b27('0x5'))['db'];var utils=require(_0x8b27('0x6'));var logger=require(_0x8b27('0x7'))(_0x8b27('0x8'));var config=require(_0x8b27('0x9'));var jayson=require(_0x8b27('0xa'));var client=jayson[_0x8b27('0xb')][_0x8b27('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5d2566,_0x22d8ca,_0x35b1df){return new BPromise(function(_0x3f7b45,_0x2850f7){return client[_0x8b27('0xd')](_0x5d2566,_0x35b1df)[_0x8b27('0xe')](function(_0x5e8a5c){logger[_0x8b27('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x22d8ca,_0x8b27('0x10'));logger[_0x8b27('0x11')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x22d8ca,_0x8b27('0x10'),JSON['stringify'](_0x5e8a5c));if(_0x5e8a5c[_0x8b27('0x12')]){if(_0x5e8a5c[_0x8b27('0x12')][_0x8b27('0x13')]===0x1f4){logger[_0x8b27('0x12')](_0x8b27('0x14'),_0x22d8ca,_0x5e8a5c['error']['message']);return _0x2850f7(_0x5e8a5c[_0x8b27('0x12')][_0x8b27('0x15')]);}logger[_0x8b27('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x22d8ca,_0x5e8a5c[_0x8b27('0x12')][_0x8b27('0x15')]);return _0x3f7b45(_0x5e8a5c[_0x8b27('0x12')][_0x8b27('0x15')]);}else{logger[_0x8b27('0xf')](_0x8b27('0x14'),_0x22d8ca,'request\x20sent');_0x3f7b45(_0x5e8a5c[_0x8b27('0x16')][_0x8b27('0x15')]);}})[_0x8b27('0x17')](function(_0x502c7f){logger[_0x8b27('0x12')](_0x8b27('0x14'),_0x22d8ca,_0x502c7f);_0x2850f7(_0x502c7f);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 5e78763..d610d10 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 _0x12ba=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x4a957e,_0x4391eb){var _0x24da15=function(_0x2c837f){while(--_0x2c837f){_0x4a957e['push'](_0x4a957e['shift']());}};_0x24da15(++_0x4391eb);}(_0x12ba,0xbf));var _0xa12b=function(_0x1316e6,_0x3b02de){_0x1316e6=_0x1316e6-0x0;var _0x53c041=_0x12ba[_0x1316e6];return _0x53c041;};'use strict';var multer=require(_0xa12b('0x0'));var util=require(_0xa12b('0x1'));var path=require(_0xa12b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa12b('0x3')]();var auth=require(_0xa12b('0x4'));var interaction=require(_0xa12b('0x5'));var config=require(_0xa12b('0x6'));module[_0xa12b('0x7')]=router; \ No newline at end of file +var _0x4901=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x4901,0x1ae));var _0x1490=function(_0x1c8954,_0x2f9f67){_0x1c8954=_0x1c8954-0x0;var _0x539033=_0x4901[_0x1c8954];return _0x539033;};'use strict';var multer=require(_0x1490('0x0'));var util=require(_0x1490('0x1'));var path=require(_0x1490('0x2'));var timeout=require(_0x1490('0x3'));var express=require(_0x1490('0x4'));var router=express[_0x1490('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x1490('0x6'));var config=require(_0x1490('0x7'));module[_0x1490('0x8')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 73a237b..08b9506 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x1389ae,_0x1caf91){var _0x1514d4=function(_0x41bb97){while(--_0x41bb97){_0x1389ae['push'](_0x1389ae['shift']());}};_0x1514d4(++_0x1caf91);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x4b6b39,_0x547f83){var _0x5145df=function(_0x31e37b){while(--_0x31e37b){_0x4b6b39['push'](_0x4b6b39['shift']());}};_0x5145df(++_0x547f83);}(_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/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index cf71228..4390f59 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 _0xa1e8=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xa1e8,0x1af));var _0x8a1e=function(_0x4552e7,_0x308c21){_0x4552e7=_0x4552e7-0x0;var _0x442e02=_0xa1e8[_0x4552e7];return _0x442e02;};'use strict';var _=require(_0x8a1e('0x0'));var util=require('util');var logger=require(_0x8a1e('0x1'))(_0x8a1e('0x2'));var moment=require(_0x8a1e('0x3'));var BPromise=require('bluebird');var rp=require(_0x8a1e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8a1e('0x5'));var config=require(_0x8a1e('0x6'));var attributes=require(_0x8a1e('0x7'));module[_0x8a1e('0x8')]=function(_0x5730e0,_0x2ddb27){return _0x5730e0[_0x8a1e('0x9')](_0x8a1e('0xa'),attributes,{'tableName':_0x8a1e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c81=['moment','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','lodash','util','api'];(function(_0x404e69,_0x387477){var _0x10e022=function(_0x2ea259){while(--_0x2ea259){_0x404e69['push'](_0x404e69['shift']());}};_0x10e022(++_0x387477);}(_0x3c81,0x102));var _0x13c8=function(_0x56383a,_0x516065){_0x56383a=_0x56383a-0x0;var _0x342b20=_0x3c81[_0x56383a];return _0x342b20;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var logger=require('../../config/logger')(_0x13c8('0x2'));var moment=require(_0x13c8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x13c8('0x4'));var attributes=require(_0x13c8('0x5'));module[_0x13c8('0x6')]=function(_0x1c16f1,_0x2a4d66){return _0x1c16f1[_0x13c8('0x7')](_0x13c8('0x8'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 474192c..f0fe39c 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 _0x9fdf=['util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x9fdf,0xdb));var _0xf9fd=function(_0x2b0063,_0x570d40){_0x2b0063=_0x2b0063-0x0;var _0x3eea72=_0x9fdf[_0x2b0063];return _0x3eea72;};'use strict';var _=require(_0xf9fd('0x0'));var util=require(_0xf9fd('0x1'));var moment=require('moment');var BPromise=require(_0xf9fd('0x2'));var rs=require(_0xf9fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf9fd('0x4'));var logger=require(_0xf9fd('0x5'))(_0xf9fd('0x6'));var config=require(_0xf9fd('0x7'));var jayson=require(_0xf9fd('0x8'));var client=jayson[_0xf9fd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41704c,_0x2e7062,_0x41d4fd){return new BPromise(function(_0x49d221,_0x1aa1f0){return client['request'](_0x41704c,_0x41d4fd)[_0xf9fd('0xa')](function(_0x10164f){logger['info'](_0xf9fd('0xb'),_0x2e7062,_0xf9fd('0xc'));logger[_0xf9fd('0xd')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x2e7062,_0xf9fd('0xc'),JSON[_0xf9fd('0xe')](_0x10164f));if(_0x10164f[_0xf9fd('0xf')]){if(_0x10164f['error'][_0xf9fd('0x10')]===0x1f4){logger[_0xf9fd('0xf')](_0xf9fd('0xb'),_0x2e7062,_0x10164f[_0xf9fd('0xf')][_0xf9fd('0x11')]);return _0x1aa1f0(_0x10164f['error'][_0xf9fd('0x11')]);}logger[_0xf9fd('0xf')](_0xf9fd('0xb'),_0x2e7062,_0x10164f['error'][_0xf9fd('0x11')]);return _0x49d221(_0x10164f['error'][_0xf9fd('0x11')]);}else{logger['info'](_0xf9fd('0xb'),_0x2e7062,_0xf9fd('0xc'));_0x49d221(_0x10164f[_0xf9fd('0x12')][_0xf9fd('0x11')]);}})[_0xf9fd('0x13')](function(_0x2576fb){logger[_0xf9fd('0xf')](_0xf9fd('0xb'),_0x2e7062,_0x2576fb);_0x1aa1f0(_0x2576fb);});});} \ No newline at end of file +var _0xf69d=['request\x20sent','debug','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','info','UserSmsQueue,\x20%s,\x20%s'];(function(_0x186205,_0x32f582){var _0x47b044=function(_0x2ace04){while(--_0x2ace04){_0x186205['push'](_0x186205['shift']());}};_0x47b044(++_0x32f582);}(_0xf69d,0x15d));var _0xdf69=function(_0x29fe95,_0xdfa9a4){_0x29fe95=_0x29fe95-0x0;var _0x286877=_0xf69d[_0x29fe95];return _0x286877;};'use strict';var _=require('lodash');var util=require(_0xdf69('0x0'));var moment=require(_0xdf69('0x1'));var BPromise=require('bluebird');var rs=require(_0xdf69('0x2'));var fs=require('fs');var Redis=require(_0xdf69('0x3'));var db=require(_0xdf69('0x4'))['db'];var utils=require(_0xdf69('0x5'));var logger=require(_0xdf69('0x6'))(_0xdf69('0x7'));var config=require(_0xdf69('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a8ff0,_0x2f23b6,_0x58677f){return new BPromise(function(_0x3d62b3,_0x4d774c){return client['request'](_0x4a8ff0,_0x58677f)['then'](function(_0xf397c1){logger[_0xdf69('0x9')](_0xdf69('0xa'),_0x2f23b6,_0xdf69('0xb'));logger[_0xdf69('0xc')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x2f23b6,_0xdf69('0xb'),JSON['stringify'](_0xf397c1));if(_0xf397c1[_0xdf69('0xd')]){if(_0xf397c1[_0xdf69('0xd')][_0xdf69('0xe')]===0x1f4){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x2f23b6,_0xf397c1[_0xdf69('0xd')]['message']);return _0x4d774c(_0xf397c1[_0xdf69('0xd')]['message']);}logger[_0xdf69('0xd')](_0xdf69('0xa'),_0x2f23b6,_0xf397c1['error']['message']);return _0x3d62b3(_0xf397c1[_0xdf69('0xd')][_0xdf69('0xf')]);}else{logger[_0xdf69('0x9')](_0xdf69('0xa'),_0x2f23b6,_0xdf69('0xb'));_0x3d62b3(_0xf397c1[_0xdf69('0x10')][_0xdf69('0xf')]);}})[_0xdf69('0x11')](function(_0xfb7bab){logger[_0xdf69('0xd')](_0xdf69('0xa'),_0x2f23b6,_0xfb7bab);_0x4d774c(_0xfb7bab);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 76c0e22..951138e 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 _0x3d99=['exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x3b7a6e,_0x202afe){var _0x1412d2=function(_0x227435){while(--_0x227435){_0x3b7a6e['push'](_0x3b7a6e['shift']());}};_0x1412d2(++_0x202afe);}(_0x3d99,0xa1));var _0x93d9=function(_0x2589c0,_0x1ba4c4){_0x2589c0=_0x2589c0-0x0;var _0x46f640=_0x3d99[_0x2589c0];return _0x46f640;};'use strict';var multer=require(_0x93d9('0x0'));var util=require('util');var path=require(_0x93d9('0x1'));var timeout=require(_0x93d9('0x2'));var express=require(_0x93d9('0x3'));var router=express[_0x93d9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x93d9('0x5'));var config=require(_0x93d9('0x6'));module[_0x93d9('0x7')]=router; \ No newline at end of file +var _0x7acc=['exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x54b570,_0x5130e1){var _0x509fc2=function(_0x2d3e97){while(--_0x2d3e97){_0x54b570['push'](_0x54b570['shift']());}};_0x509fc2(++_0x5130e1);}(_0x7acc,0xda));var _0xc7ac=function(_0x2f68e2,_0x5ea29a){_0x2f68e2=_0x2f68e2-0x0;var _0x67545a=_0x7acc[_0x2f68e2];return _0x67545a;};'use strict';var multer=require(_0xc7ac('0x0'));var util=require(_0xc7ac('0x1'));var path=require(_0xc7ac('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xc7ac('0x3'));var interaction=require(_0xc7ac('0x4'));var config=require(_0xc7ac('0x5'));module[_0xc7ac('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 2c627cb..6f35d10 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x56ea6f,_0x15535a){var _0x43ac31=function(_0x1b6d99){while(--_0x1b6d99){_0x56ea6f['push'](_0x56ea6f['shift']());}};_0x43ac31(++_0x15535a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb10b=['sequelize','INTEGER'];(function(_0x1da223,_0x5c560f){var _0xe29879=function(_0x262ba0){while(--_0x262ba0){_0x1da223['push'](_0x1da223['shift']());}};_0xe29879(++_0x5c560f);}(_0xb10b,0x12a));var _0xbb10=function(_0x224f30,_0x4483c7){_0x224f30=_0x224f30-0x0;var _0x2a67ad=_0xb10b[_0x224f30];return _0x2a67ad;};'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/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index cd3b1b6..efe04e7 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 _0x4ef9=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes','define','UserVoiceQueue','lodash','util'];(function(_0x10305f,_0x1c287e){var _0x4edc66=function(_0x577dde){while(--_0x577dde){_0x10305f['push'](_0x10305f['shift']());}};_0x4edc66(++_0x1c287e);}(_0x4ef9,0x11c));var _0x94ef=function(_0xfd3d87,_0x10aa44){_0xfd3d87=_0xfd3d87-0x0;var _0x21fc4a=_0x4ef9[_0xfd3d87];return _0x21fc4a;};'use strict';var _=require(_0x94ef('0x0'));var util=require(_0x94ef('0x1'));var logger=require(_0x94ef('0x2'))(_0x94ef('0x3'));var moment=require('moment');var BPromise=require(_0x94ef('0x4'));var rp=require(_0x94ef('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x94ef('0x6'));var config=require(_0x94ef('0x7'));var attributes=require(_0x94ef('0x8'));module['exports']=function(_0x26e63b,_0x5aaf0b){return _0x26e63b[_0x94ef('0x9')](_0x94ef('0xa'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x849f=['api','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger'];(function(_0x609988,_0x507944){var _0x159984=function(_0x39d9ce){while(--_0x39d9ce){_0x609988['push'](_0x609988['shift']());}};_0x159984(++_0x507944);}(_0x849f,0xdb));var _0xf849=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x849f[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0xf849('0x0'));var util=require('util');var logger=require(_0xf849('0x1'))(_0xf849('0x2'));var moment=require(_0xf849('0x3'));var BPromise=require('bluebird');var rp=require(_0xf849('0x4'));var fs=require('fs');var path=require(_0xf849('0x5'));var rimraf=require(_0xf849('0x6'));var config=require(_0xf849('0x7'));var attributes=require(_0xf849('0x8'));module[_0xf849('0x9')]=function(_0x1bae1c,_0xd3647f){return _0x1bae1c[_0xf849('0xa')](_0xf849('0xb'),attributes,{'tableName':_0xf849('0xc'),'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 fe03df2..4eadcf2 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 _0x2b4b=['catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2b4b,0x131));var _0xb2b4=function(_0x41dd60,_0x550220){_0x41dd60=_0x41dd60-0x0;var _0x1622b8=_0x2b4b[_0x41dd60];return _0x1622b8;};'use strict';var _=require(_0xb2b4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb2b4('0x1'));var rs=require(_0xb2b4('0x2'));var fs=require('fs');var Redis=require(_0xb2b4('0x3'));var db=require(_0xb2b4('0x4'))['db'];var utils=require(_0xb2b4('0x5'));var logger=require('../../config/logger')(_0xb2b4('0x6'));var config=require(_0xb2b4('0x7'));var jayson=require(_0xb2b4('0x8'));var client=jayson['client'][_0xb2b4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a402c,_0x2017dc,_0x3e4675){return new BPromise(function(_0x32fe8b,_0xea1e82){return client['request'](_0x3a402c,_0x3e4675)['then'](function(_0x3345a2){logger[_0xb2b4('0xa')](_0xb2b4('0xb'),_0x2017dc,_0xb2b4('0xc'));logger[_0xb2b4('0xd')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2017dc,_0xb2b4('0xc'),JSON[_0xb2b4('0xe')](_0x3345a2));if(_0x3345a2[_0xb2b4('0xf')]){if(_0x3345a2[_0xb2b4('0xf')][_0xb2b4('0x10')]===0x1f4){logger[_0xb2b4('0xf')](_0xb2b4('0xb'),_0x2017dc,_0x3345a2['error'][_0xb2b4('0x11')]);return _0xea1e82(_0x3345a2[_0xb2b4('0xf')][_0xb2b4('0x11')]);}logger[_0xb2b4('0xf')](_0xb2b4('0xb'),_0x2017dc,_0x3345a2[_0xb2b4('0xf')][_0xb2b4('0x11')]);return _0x32fe8b(_0x3345a2[_0xb2b4('0xf')][_0xb2b4('0x11')]);}else{logger[_0xb2b4('0xa')]('UserVoiceQueue,\x20%s,\x20%s',_0x2017dc,_0xb2b4('0xc'));_0x32fe8b(_0x3345a2['result']['message']);}})[_0xb2b4('0x12')](function(_0x421650){logger[_0xb2b4('0xf')](_0xb2b4('0xb'),_0x2017dc,_0x421650);_0xea1e82(_0x421650);});});} \ No newline at end of file +var _0xfa6c=['client','http','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x1773b5,_0x140254){var _0x1f5d73=function(_0x5825c1){while(--_0x5825c1){_0x1773b5['push'](_0x1773b5['shift']());}};_0x1f5d73(++_0x140254);}(_0xfa6c,0x19a));var _0xcfa6=function(_0x45dea6,_0x3fcb33){_0x45dea6=_0x45dea6-0x0;var _0xd9f484=_0xfa6c[_0x45dea6];return _0xd9f484;};'use strict';var _=require(_0xcfa6('0x0'));var util=require(_0xcfa6('0x1'));var moment=require('moment');var BPromise=require(_0xcfa6('0x2'));var rs=require(_0xcfa6('0x3'));var fs=require('fs');var Redis=require(_0xcfa6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcfa6('0x5'));var logger=require(_0xcfa6('0x6'))(_0xcfa6('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcfa6('0x8')][_0xcfa6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a433d,_0x2b8866,_0x8f5e23){return new BPromise(function(_0x56c5ea,_0x23fe91){return client['request'](_0x4a433d,_0x8f5e23)[_0xcfa6('0xa')](function(_0x33c552){logger[_0xcfa6('0xb')](_0xcfa6('0xc'),_0x2b8866,_0xcfa6('0xd'));logger[_0xcfa6('0xe')](_0xcfa6('0xf'),_0x2b8866,_0xcfa6('0xd'),JSON[_0xcfa6('0x10')](_0x33c552));if(_0x33c552[_0xcfa6('0x11')]){if(_0x33c552['error'][_0xcfa6('0x12')]===0x1f4){logger[_0xcfa6('0x11')](_0xcfa6('0xc'),_0x2b8866,_0x33c552[_0xcfa6('0x11')]['message']);return _0x23fe91(_0x33c552[_0xcfa6('0x11')][_0xcfa6('0x13')]);}logger[_0xcfa6('0x11')](_0xcfa6('0xc'),_0x2b8866,_0x33c552[_0xcfa6('0x11')][_0xcfa6('0x13')]);return _0x56c5ea(_0x33c552[_0xcfa6('0x11')][_0xcfa6('0x13')]);}else{logger[_0xcfa6('0xb')](_0xcfa6('0xc'),_0x2b8866,_0xcfa6('0xd'));_0x56c5ea(_0x33c552[_0xcfa6('0x14')][_0xcfa6('0x13')]);}})[_0xcfa6('0x15')](function(_0x5b78c2){logger['error'](_0xcfa6('0xc'),_0x2b8866,_0x5b78c2);_0x23fe91(_0x5b78c2);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 6da39b6..b7e86cf 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 _0xd05b=['../../config/environment','exports','multer','util','path','Router','../../components/interaction/service'];(function(_0x1806a4,_0xa32e1d){var _0x73f8b=function(_0x4ceaa2){while(--_0x4ceaa2){_0x1806a4['push'](_0x1806a4['shift']());}};_0x73f8b(++_0xa32e1d);}(_0xd05b,0xa3));var _0xbd05=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xd05b[_0xefd519];return _0x4bb882;};'use strict';var multer=require(_0xbd05('0x0'));var util=require(_0xbd05('0x1'));var path=require(_0xbd05('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbd05('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbd05('0x4'));var config=require(_0xbd05('0x5'));module[_0xbd05('0x6')]=router; \ No newline at end of file +var _0x6c03=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0xe9bfbc,_0x488cd1){var _0x237482=function(_0x1303ef){while(--_0x1303ef){_0xe9bfbc['push'](_0xe9bfbc['shift']());}};_0x237482(++_0x488cd1);}(_0x6c03,0x98));var _0x36c0=function(_0x304ea1,_0x37ed77){_0x304ea1=_0x304ea1-0x0;var _0x550ae0=_0x6c03[_0x304ea1];return _0x550ae0;};'use strict';var multer=require(_0x36c0('0x0'));var util=require(_0x36c0('0x1'));var path=require(_0x36c0('0x2'));var timeout=require(_0x36c0('0x3'));var express=require(_0x36c0('0x4'));var router=express['Router']();var auth=require(_0x36c0('0x5'));var interaction=require(_0x36c0('0x6'));var config=require(_0x36c0('0x7'));module[_0x36c0('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index a4a66db..93d4576 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 _0xaa55=['sequelize','exports','INTEGER','Required\x20by\x20Asterisk','queue_interface','STRING'];(function(_0xa5536c,_0x4cd48d){var _0x5f0121=function(_0x2f7aa1){while(--_0x2f7aa1){_0xa5536c['push'](_0xa5536c['shift']());}};_0x5f0121(++_0x4cd48d);}(_0xaa55,0x174));var _0x5aa5=function(_0x1722b2,_0x324080){_0x1722b2=_0x1722b2-0x0;var _0x5b098b=_0xaa55[_0x1722b2];return _0x5b098b;};'use strict';var Sequelize=require(_0x5aa5('0x0'));module[_0x5aa5('0x1')]={'uniqueid':{'type':Sequelize[_0x5aa5('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x5aa5('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x5aa5('0x3')},'UserId':{'type':Sequelize[_0x5aa5('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5aa5('0x4'),'comment':_0x5aa5('0x3')},'VoiceQueueId':{'type':Sequelize[_0x5aa5('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x5aa5('0x5')],'allowNull':![],'unique':_0x5aa5('0x4'),'comment':_0x5aa5('0x3')},'penalty':{'type':Sequelize[_0x5aa5('0x2')](0xb),'defaultValue':0x0,'comment':_0x5aa5('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x5aa5('0x3')}}; \ No newline at end of file +var _0x0a4f=['queue_interface','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x5319c7,_0x36339d){var _0x21cf07=function(_0x351246){while(--_0x351246){_0x5319c7['push'](_0x5319c7['shift']());}};_0x21cf07(++_0x36339d);}(_0x0a4f,0x16d));var _0xf0a4=function(_0x4b45e6,_0x2df1c1){_0x4b45e6=_0x4b45e6-0x0;var _0x450719=_0x0a4f[_0x4b45e6];return _0x450719;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xf0a4('0x0')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0xf0a4('0x1')},'UserId':{'type':Sequelize[_0xf0a4('0x0')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xf0a4('0x2')],'allowNull':![],'unique':_0xf0a4('0x3'),'comment':_0xf0a4('0x1')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xf0a4('0x2')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xf0a4('0x0')](0xb),'defaultValue':0x0,'comment':_0xf0a4('0x1')},'paused':{'type':Sequelize[_0xf0a4('0x0')](0xb),'defaultValue':0x0,'comment':_0xf0a4('0x1')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 38491b2..8c11494 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 _0x06e0=['setMaxListeners','remove','emit','hook','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x06e0,0xb3));var _0x006e=function(_0x4aba0e,_0x3cca89){_0x4aba0e=_0x4aba0e-0x0;var _0x240301=_0x06e0[_0x4aba0e];return _0x240301;};'use strict';var EventEmitter=require(_0x006e('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x006e('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x006e('0x2')};function emitEvent(_0x314016){return function(_0x562e4e,_0x141a3b,_0x55e11f){UserVoiceQueueRtEvents[_0x006e('0x3')](_0x314016+':'+_0x562e4e['id'],_0x562e4e);UserVoiceQueueRtEvents['emit'](_0x314016,_0x562e4e);_0x55e11f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x006e('0x4')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xe7ff=['hook','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x271060,_0x3f86b1){var _0x40540b=function(_0x1735a7){while(--_0x1735a7){_0x271060['push'](_0x271060['shift']());}};_0x40540b(++_0x3f86b1);}(_0xe7ff,0x1d7));var _0xfe7f=function(_0x5c768b,_0x5e88a6){_0x5c768b=_0x5c768b-0x0;var _0x335af8=_0xe7ff[_0x5c768b];return _0x335af8;};'use strict';var EventEmitter=require(_0xfe7f('0x0'));var UserVoiceQueueRt=require(_0xfe7f('0x1'))['db'][_0xfe7f('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xfe7f('0x3')](0x0);var events={'afterCreate':_0xfe7f('0x4'),'afterUpdate':_0xfe7f('0x5'),'afterDestroy':_0xfe7f('0x6')};function emitEvent(_0x4afc8a){return function(_0x245cb8,_0x51ba6d,_0x5b512f){UserVoiceQueueRtEvents[_0xfe7f('0x7')](_0x4afc8a+':'+_0x245cb8['id'],_0x245cb8);UserVoiceQueueRtEvents[_0xfe7f('0x7')](_0x4afc8a,_0x245cb8);_0x5b512f(null);};}for(var e in events){if(events[_0xfe7f('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0xfe7f('0x9')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 214a571..4f97509 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 _0x6361=['user_has_voice_queues_rt','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6361,0xa1));var _0x1636=function(_0x15efe1,_0x8a621e){_0x15efe1=_0x15efe1-0x0;var _0x2daae8=_0x6361[_0x15efe1];return _0x2daae8;};'use strict';var _=require(_0x1636('0x0'));var util=require(_0x1636('0x1'));var logger=require(_0x1636('0x2'))('api');var moment=require(_0x1636('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1636('0x4'));var rimraf=require(_0x1636('0x5'));var config=require(_0x1636('0x6'));var attributes=require(_0x1636('0x7'));module['exports']=function(_0x83a2c7,_0x71884f){return _0x83a2c7[_0x1636('0x8')]('UserVoiceQueueRt',attributes,{'tableName':_0x1636('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x189b=['request-promise','path','rimraf','../../config/environment','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','util','../../config/logger','api'];(function(_0x2e0f2d,_0x1fabce){var _0x327e80=function(_0x5e0a77){while(--_0x5e0a77){_0x2e0f2d['push'](_0x2e0f2d['shift']());}};_0x327e80(++_0x1fabce);}(_0x189b,0x1b5));var _0xb189=function(_0x3c97e3,_0x321677){_0x3c97e3=_0x3c97e3-0x0;var _0x9bb0ed=_0x189b[_0x3c97e3];return _0x9bb0ed;};'use strict';var _=require('lodash');var util=require(_0xb189('0x0'));var logger=require(_0xb189('0x1'))(_0xb189('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb189('0x3'));var fs=require('fs');var path=require(_0xb189('0x4'));var rimraf=require(_0xb189('0x5'));var config=require(_0xb189('0x6'));var attributes=require('./userVoiceQueueRt.attributes');module[_0xb189('0x7')]=function(_0x23ae12,_0x1f54c4){return _0x23ae12[_0xb189('0x8')](_0xb189('0x9'),attributes,{'tableName':_0xb189('0xa'),'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 609122a..b69713b 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 _0xf1ec=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserVoiceQueueRt,\x20%s,\x20%s','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','COUNT','sequelize','literal','outboundQueuePauses','catch','lodash','moment','randomstring','../../mysqldb','../../config/environment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf1ec,0x1db));var _0xcf1e=function(_0x2dac3f,_0x2408d7){_0x2dac3f=_0x2dac3f-0x0;var _0x3d20ba=_0xf1ec[_0x2dac3f];return _0x3d20ba;};'use strict';var _=require(_0xcf1e('0x0'));var util=require('util');var moment=require(_0xcf1e('0x1'));var BPromise=require('bluebird');var rs=require(_0xcf1e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf1e('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xcf1e('0x4'));var jayson=require(_0xcf1e('0x5'));var client=jayson[_0xcf1e('0x6')][_0xcf1e('0x7')]({'port':0x232a});config[_0xcf1e('0x8')]=_[_0xcf1e('0x9')](config['redis'],{'host':_0xcf1e('0xa'),'port':0x18eb});var socket=require(_0xcf1e('0xb'))(new Redis(config['redis']));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x3c730d,_0x33a638,_0x1c625e){return new BPromise(function(_0x25a181,_0x2fbd4d){return client[_0xcf1e('0xc')](_0x3c730d,_0x1c625e)[_0xcf1e('0xd')](function(_0xd3b829){logger[_0xcf1e('0xe')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x33a638,_0xcf1e('0xf'));logger[_0xcf1e('0x10')](_0xcf1e('0x11'),_0x33a638,'request\x20sent',JSON[_0xcf1e('0x12')](_0xd3b829));if(_0xd3b829['error']){if(_0xd3b829[_0xcf1e('0x13')][_0xcf1e('0x14')]===0x1f4){logger[_0xcf1e('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x33a638,_0xd3b829[_0xcf1e('0x13')][_0xcf1e('0x15')]);return _0x2fbd4d(_0xd3b829[_0xcf1e('0x13')]['message']);}logger[_0xcf1e('0x13')](_0xcf1e('0x16'),_0x33a638,_0xd3b829[_0xcf1e('0x13')][_0xcf1e('0x15')]);return _0x25a181(_0xd3b829[_0xcf1e('0x13')][_0xcf1e('0x15')]);}else{logger['info'](_0xcf1e('0x16'),_0x33a638,'request\x20sent');_0x25a181(_0xd3b829['result'][_0xcf1e('0x15')]);}})['catch'](function(_0x5f1b2e){logger['error'](_0xcf1e('0x16'),_0x33a638,_0x5f1b2e);_0x2fbd4d(_0x5f1b2e);});});}exports[_0xcf1e('0x17')]=function(_0x3d7d49){var _0xe5f2b0=this;return new Promise(function(_0x419f4e,_0x58271f){return db[_0xcf1e('0x18')]['findAll']({'raw':_0x3d7d49[_0xcf1e('0x19')]?_0x3d7d49[_0xcf1e('0x19')][_0xcf1e('0x1a')]===undefined?!![]:![]:!![],'where':_0x3d7d49[_0xcf1e('0x19')]?_0x3d7d49[_0xcf1e('0x19')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xcf1e('0x1b'),db[_0xcf1e('0x1c')]['fn']('IF',db[_0xcf1e('0x1c')][_0xcf1e('0x1d')]('`paused`\x20=\x201,\x201,\x20null'))),_0xcf1e('0x1e')]]})[_0xcf1e('0xd')](function(_0x3a6927){logger[_0xcf1e('0xe')](_0xcf1e('0x17'),_0x3d7d49);logger[_0xcf1e('0x10')](_0xcf1e('0x17'),_0x3d7d49,JSON[_0xcf1e('0x12')](_0x3a6927));_0x419f4e(_0x3a6927);})[_0xcf1e('0x1f')](function(_0x1ec513){logger[_0xcf1e('0x13')](_0xcf1e('0x17'),_0x1ec513['message'],_0x3d7d49);_0x58271f(_0xe5f2b0[_0xcf1e('0x13')](0x1f4,_0x1ec513[_0xcf1e('0x15')]));});});}; \ No newline at end of file +var _0xae57=['jayson/promise','client','http','redis','localhost','./userVoiceQueueRt.socket','request','then','info','request\x20sent','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x47938b,_0x2668b9){var _0x125ffa=function(_0x53161f){while(--_0x53161f){_0x47938b['push'](_0x47938b['shift']());}};_0x125ffa(++_0x2668b9);}(_0xae57,0x118));var _0x7ae5=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xae57[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require(_0x7ae5('0x0'));var util=require(_0x7ae5('0x1'));var moment=require(_0x7ae5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ae5('0x3'));var db=require(_0x7ae5('0x4'))['db'];var utils=require(_0x7ae5('0x5'));var logger=require(_0x7ae5('0x6'))('rpc');var config=require(_0x7ae5('0x7'));var jayson=require(_0x7ae5('0x8'));var client=jayson[_0x7ae5('0x9')][_0x7ae5('0xa')]({'port':0x232a});config[_0x7ae5('0xb')]=_['defaults'](config[_0x7ae5('0xb')],{'host':_0x7ae5('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ae5('0xb')]));require(_0x7ae5('0xd'))['register'](socket);function respondWithRpcPromise(_0x58449f,_0xee6f90,_0x4852e0){return new BPromise(function(_0x352139,_0x298344){return client[_0x7ae5('0xe')](_0x58449f,_0x4852e0)[_0x7ae5('0xf')](function(_0x4b4b46){logger[_0x7ae5('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xee6f90,_0x7ae5('0x11'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0xee6f90,_0x7ae5('0x11'),JSON[_0x7ae5('0x12')](_0x4b4b46));if(_0x4b4b46[_0x7ae5('0x13')]){if(_0x4b4b46[_0x7ae5('0x13')][_0x7ae5('0x14')]===0x1f4){logger['error'](_0x7ae5('0x15'),_0xee6f90,_0x4b4b46[_0x7ae5('0x13')]['message']);return _0x298344(_0x4b4b46[_0x7ae5('0x13')][_0x7ae5('0x16')]);}logger[_0x7ae5('0x13')](_0x7ae5('0x15'),_0xee6f90,_0x4b4b46['error']['message']);return _0x352139(_0x4b4b46[_0x7ae5('0x13')][_0x7ae5('0x16')]);}else{logger[_0x7ae5('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xee6f90,_0x7ae5('0x11'));_0x352139(_0x4b4b46[_0x7ae5('0x17')]['message']);}})['catch'](function(_0x36aaeb){logger[_0x7ae5('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xee6f90,_0x36aaeb);_0x298344(_0x36aaeb);});});}exports[_0x7ae5('0x18')]=function(_0x56f067){var _0x34732a=this;return new Promise(function(_0x247042,_0x35a78e){return db[_0x7ae5('0x19')][_0x7ae5('0x1a')]({'raw':_0x56f067['options']?_0x56f067[_0x7ae5('0x1b')][_0x7ae5('0x1c')]===undefined?!![]:![]:!![],'where':_0x56f067[_0x7ae5('0x1b')]?_0x56f067['options'][_0x7ae5('0x1d')]||null:null,'attributes':[[db[_0x7ae5('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x7ae5('0x1e')][_0x7ae5('0x1f')](_0x7ae5('0x20')))),_0x7ae5('0x21')]]})[_0x7ae5('0xf')](function(_0x256702){logger[_0x7ae5('0x10')](_0x7ae5('0x18'),_0x56f067);logger[_0x7ae5('0x22')](_0x7ae5('0x18'),_0x56f067,JSON['stringify'](_0x256702));_0x247042(_0x256702);})[_0x7ae5('0x23')](function(_0x3f1260){logger[_0x7ae5('0x13')](_0x7ae5('0x18'),_0x3f1260[_0x7ae5('0x16')],_0x56f067);_0x35a78e(_0x34732a['error'](0x1f4,_0x3f1260[_0x7ae5('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index ec5129a..1454cdb 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 _0x990b=['save','remove','update','register','length','userVoiceQueueRt:'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x990b,0x11a));var _0xb990=function(_0x9c69ab,_0x1feadd){_0x9c69ab=_0x9c69ab-0x0;var _0x85dfc5=_0x990b[_0x9c69ab];return _0x85dfc5;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xb990('0x0'),_0xb990('0x1'),_0xb990('0x2')];function createListener(_0x2fb21a,_0x1f6e66){return function(_0x376b2c){_0x1f6e66['emit'](_0x2fb21a,_0x376b2c);};}function removeListener(_0x17e4b3,_0x57dc5f){return function(){UserVoiceQueueRtEvents['removeListener'](_0x17e4b3,_0x57dc5f);};}exports[_0xb990('0x3')]=function(_0x5e4377){for(var _0x3d7363=0x0,_0x52ff70=events[_0xb990('0x4')];_0x3d7363<_0x52ff70;_0x3d7363++){var _0x54a827=events[_0x3d7363];var _0x13acff=createListener(_0xb990('0x5')+_0x54a827,_0x5e4377);UserVoiceQueueRtEvents['on'](_0x54a827,_0x13acff);}}; \ No newline at end of file +var _0x0f97=['save','remove','update','emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f97,0x1d3));var _0x70f9=function(_0x161e88,_0x49ce5e){_0x161e88=_0x161e88-0x0;var _0x40ee62=_0x0f97[_0x161e88];return _0x40ee62;};'use strict';var UserVoiceQueueRtEvents=require(_0x70f9('0x0'));var events=[_0x70f9('0x1'),_0x70f9('0x2'),_0x70f9('0x3')];function createListener(_0x4629af,_0x2347f1){return function(_0x56ceda){_0x2347f1[_0x70f9('0x4')](_0x4629af,_0x56ceda);};}function removeListener(_0x4a9f4f,_0x370822){return function(){UserVoiceQueueRtEvents[_0x70f9('0x5')](_0x4a9f4f,_0x370822);};}exports[_0x70f9('0x6')]=function(_0x3c89e7){for(var _0x41dca9=0x0,_0x120046=events[_0x70f9('0x7')];_0x41dca9<_0x120046;_0x41dca9++){var _0x5dbb2e=events[_0x41dca9];var _0x34fde3=createListener(_0x70f9('0x8')+_0x5dbb2e,_0x3c89e7);UserVoiceQueueRtEvents['on'](_0x5dbb2e,_0x34fde3);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 446d5a6..d435ec0 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 _0xd314=['util','express','exports','multer'];(function(_0x4545fb,_0xdb9183){var _0x474cb4=function(_0x2fc4df){while(--_0x2fc4df){_0x4545fb['push'](_0x4545fb['shift']());}};_0x474cb4(++_0xdb9183);}(_0xd314,0xcb));var _0x4d31=function(_0x4fa1c1,_0x31626e){_0x4fa1c1=_0x4fa1c1-0x0;var _0x2e060f=_0xd314[_0x4fa1c1];return _0x2e060f;};'use strict';var multer=require(_0x4d31('0x0'));var util=require(_0x4d31('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4d31('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x4d31('0x3')]=router; \ No newline at end of file +var _0x9999=['exports','util','path','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x26ea2b,_0x542e2a){var _0xa15878=function(_0x3b3125){while(--_0x3b3125){_0x26ea2b['push'](_0x26ea2b['shift']());}};_0xa15878(++_0x542e2a);}(_0x9999,0x166));var _0x9999=function(_0x3ecf6f,_0x15da15){_0x3ecf6f=_0x3ecf6f-0x0;var _0xde6d0b=_0x9999[_0x3ecf6f];return _0xde6d0b;};'use strict';var multer=require('multer');var util=require(_0x9999('0x0'));var path=require(_0x9999('0x1'));var timeout=require('connect-timeout');var express=require(_0x9999('0x2'));var router=express[_0x9999('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x9999('0x4'));var config=require(_0x9999('0x5'));module[_0x9999('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 8bf34e1..6aff842 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x29a2be,_0x595b42){var _0x82e874=function(_0x3312d6){while(--_0x3312d6){_0x29a2be['push'](_0x29a2be['shift']());}};_0x82e874(++_0x595b42);}(_0xe706,0xa3));var _0x6e70=function(_0x4f485f,_0x1db0f7){_0x4f485f=_0x4f485f-0x0;var _0x1e998e=_0xe706[_0x4f485f];return _0x1e998e;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb10b=['sequelize','INTEGER'];(function(_0x695efd,_0x5b2c6f){var _0x456d7a=function(_0x396334){while(--_0x396334){_0x695efd['push'](_0x695efd['shift']());}};_0x456d7a(++_0x5b2c6f);}(_0xb10b,0x12a));var _0xbb10=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xb10b[_0x88cd7b];return _0x56fcc8;};'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/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index de73036..7724a7e 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 _0xf0b4=['bluebird','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment'];(function(_0x51d303,_0x488aeb){var _0x1e259e=function(_0x2ef928){while(--_0x2ef928){_0x51d303['push'](_0x51d303['shift']());}};_0x1e259e(++_0x488aeb);}(_0xf0b4,0x14b));var _0x4f0b=function(_0x16b11d,_0x3688ca){_0x16b11d=_0x16b11d-0x0;var _0x564a5c=_0xf0b4[_0x16b11d];return _0x564a5c;};'use strict';var _=require(_0x4f0b('0x0'));var util=require(_0x4f0b('0x1'));var logger=require(_0x4f0b('0x2'))(_0x4f0b('0x3'));var moment=require(_0x4f0b('0x4'));var BPromise=require(_0x4f0b('0x5'));var rp=require(_0x4f0b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f0b('0x7'));var config=require(_0x4f0b('0x8'));var attributes=require(_0x4f0b('0x9'));module[_0x4f0b('0xa')]=function(_0x4e0e19,_0x27583e){return _0x4e0e19['define']('UserWhatsappQueue',attributes,{'tableName':_0x4f0b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cd0=['lodash','util','moment','bluebird','request-promise','path','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x30af92,_0x141330){var _0xd06c94=function(_0x4b42e9){while(--_0x4b42e9){_0x30af92['push'](_0x30af92['shift']());}};_0xd06c94(++_0x141330);}(_0x8cd0,0x1e0));var _0x08cd=function(_0x2cb716,_0x2f083e){_0x2cb716=_0x2cb716-0x0;var _0x50182d=_0x8cd0[_0x2cb716];return _0x50182d;};'use strict';var _=require(_0x08cd('0x0'));var util=require(_0x08cd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x08cd('0x2'));var BPromise=require(_0x08cd('0x3'));var rp=require(_0x08cd('0x4'));var fs=require('fs');var path=require(_0x08cd('0x5'));var rimraf=require('rimraf');var config=require(_0x08cd('0x6'));var attributes=require(_0x08cd('0x7'));module[_0x08cd('0x8')]=function(_0x2d6b78,_0x3ab814){return _0x2d6b78[_0x08cd('0x9')](_0x08cd('0xa'),attributes,{'tableName':_0x08cd('0xb'),'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 3865ece..8a512f9 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(_0x18355b,_0x1b72b2){var _0x3b7722=function(_0x3fe689){while(--_0x3fe689){_0x18355b['push'](_0x18355b['shift']());}};_0x3b7722(++_0x1b72b2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x4369c8,_0x499350){var _0x5c0791=function(_0x11c846){while(--_0x11c846){_0x4369c8['push'](_0x4369c8['shift']());}};_0x5c0791(++_0x499350);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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 c4786e2..861c44f 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 _0x1d3c=['index','/:id','post','create','put','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x833662,_0xe60bd){var _0x20e544=function(_0x471aee){while(--_0x471aee){_0x833662['push'](_0x833662['shift']());}};_0x20e544(++_0xe60bd);}(_0x1d3c,0xca));var _0xc1d3=function(_0x21353c,_0x2ea587){_0x21353c=_0x21353c-0x0;var _0xa99120=_0x1d3c[_0x21353c];return _0xa99120;};'use strict';var multer=require(_0xc1d3('0x0'));var util=require(_0xc1d3('0x1'));var path=require('path');var timeout=require(_0xc1d3('0x2'));var express=require('express');var router=express[_0xc1d3('0x3')]();var auth=require(_0xc1d3('0x4'));var interaction=require(_0xc1d3('0x5'));var config=require('../../config/environment');var controller=require('./variable.controller');router[_0xc1d3('0x6')]('/',auth[_0xc1d3('0x7')](),controller[_0xc1d3('0x8')]);router[_0xc1d3('0x6')](_0xc1d3('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xc1d3('0xa')]('/',auth[_0xc1d3('0x7')](),controller[_0xc1d3('0xb')]);router[_0xc1d3('0xc')]('/:id',auth[_0xc1d3('0x7')](),controller['update']);router['delete']('/:id',auth[_0xc1d3('0x7')](),controller[_0xc1d3('0xd')]);module['exports']=router; \ No newline at end of file +var _0x465a=['show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id'];(function(_0x3c560d,_0x284d14){var _0x1bf398=function(_0x4debc4){while(--_0x4debc4){_0x3c560d['push'](_0x3c560d['shift']());}};_0x1bf398(++_0x284d14);}(_0x465a,0xce));var _0xa465=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x465a[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xa465('0x0'));var util=require(_0xa465('0x1'));var path=require(_0xa465('0x2'));var timeout=require(_0xa465('0x3'));var express=require(_0xa465('0x4'));var router=express[_0xa465('0x5')]();var auth=require(_0xa465('0x6'));var interaction=require(_0xa465('0x7'));var config=require(_0xa465('0x8'));var controller=require(_0xa465('0x9'));router[_0xa465('0xa')]('/',auth[_0xa465('0xb')](),controller[_0xa465('0xc')]);router['get'](_0xa465('0xd'),auth[_0xa465('0xb')](),controller[_0xa465('0xe')]);router[_0xa465('0xf')]('/',auth[_0xa465('0xb')](),controller[_0xa465('0x10')]);router[_0xa465('0x11')](_0xa465('0xd'),auth[_0xa465('0xb')](),controller[_0xa465('0x12')]);router['delete'](_0xa465('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xa465('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 6cd7f02..c3833ac 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 _0x278e=['STRING','sequelize','name'];(function(_0x33c01d,_0x563c97){var _0x4c7422=function(_0x2f81cd){while(--_0x2f81cd){_0x33c01d['push'](_0x33c01d['shift']());}};_0x4c7422(++_0x563c97);}(_0x278e,0x133));var _0xe278=function(_0x17ad39,_0x4c230a){_0x17ad39=_0x17ad39-0x0;var _0x6e67bf=_0x278e[_0x17ad39];return _0x6e67bf;};'use strict';var Sequelize=require(_0xe278('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xe278('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe278('0x2')]}}; \ No newline at end of file +var _0xb2a0=['STRING','name','sequelize'];(function(_0x2e2e59,_0x3ad513){var _0x1457d3=function(_0x185028){while(--_0x185028){_0x2e2e59['push'](_0x2e2e59['shift']());}};_0x1457d3(++_0x3ad513);}(_0xb2a0,0x16d));var _0x0b2a=function(_0x2ff372,_0x4e31fd){_0x2ff372=_0x2ff372-0x0;var _0xca42f3=_0xb2a0[_0x2ff372];return _0xca42f3;};'use strict';var Sequelize=require(_0x0b2a('0x0'));module['exports']={'name':{'type':Sequelize[_0x0b2a('0x1')],'unique':_0x0b2a('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0b2a('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 2a23ad5..c4d58e2 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 _0x5238=['limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','includeAll','include','rows','params','rawAttributes','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','destroy','get','Variables','UserProfileResource','then','error','stack','name','send','index','Variable','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty'];(function(_0x168ca2,_0x3ffbf7){var _0x21d2dc=function(_0x30495b){while(--_0x30495b){_0x168ca2['push'](_0x168ca2['shift']());}};_0x21d2dc(++_0x3ffbf7);}(_0x5238,0x6e));var _0x8523=function(_0x328058,_0x47ea36){_0x328058=_0x328058-0x0;var _0xe2ae19=_0x5238[_0x328058];return _0xe2ae19;};'use strict';var pdf=require(_0x8523('0x0'));var emlformat=require(_0x8523('0x1'));var rimraf=require(_0x8523('0x2'));var zipdir=require(_0x8523('0x3'));var jsonpatch=require(_0x8523('0x4'));var rp=require(_0x8523('0x5'));var moment=require(_0x8523('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x8523('0x7'));var util=require(_0x8523('0x8'));var path=require('path');var sox=require(_0x8523('0x9'));var csv=require(_0x8523('0xa'));var ejs=require(_0x8523('0xb'));var fs=require('fs');var _=require(_0x8523('0xc'));var squel=require(_0x8523('0xd'));var crypto=require(_0x8523('0xe'));var jsforce=require(_0x8523('0xf'));var deskjs=require(_0x8523('0x10'));var toCsv=require(_0x8523('0xa'));var querystring=require(_0x8523('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8523('0x12'));var qs=require(_0x8523('0x13'));var as=require(_0x8523('0x14'));var hardwareService=require(_0x8523('0x15'));var logger=require(_0x8523('0x16'))(_0x8523('0x17'));var utils=require('../../config/utils');var config=require(_0x8523('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x304afc,_0x4ea529){_0x4ea529=_0x4ea529||0xcc;return function(_0x3885d0){if(_0x3885d0){return _0x304afc[_0x8523('0x19')](_0x4ea529);}return _0x304afc[_0x8523('0x1a')](_0x4ea529)['end']();};}function respondWithResult(_0x2d90e2,_0x4e0219){_0x4e0219=_0x4e0219||0xc8;return function(_0x5d5291){if(_0x5d5291){return _0x2d90e2[_0x8523('0x1a')](_0x4e0219)[_0x8523('0x1b')](_0x5d5291);}};}function respondWithFilteredResult(_0x4d092d,_0x40eb82){return function(_0x31b975){if(_0x31b975){var _0x16aee1=_0x31b975['count'],_0x24f54e=_0x40eb82[_0x8523('0x1c')],_0x209f96=_0x40eb82[_0x8523('0x1c')]+_0x40eb82['limit'],_0x121a3a;if(_0x209f96>=_0x16aee1){_0x209f96=_0x16aee1;_0x121a3a=0xc8;}else{_0x121a3a=0xce;}_0x4d092d[_0x8523('0x1a')](_0x121a3a);return _0x4d092d[_0x8523('0x1d')](_0x8523('0x1e'),_0x24f54e+'-'+_0x209f96+'/'+_0x16aee1)[_0x8523('0x1b')](_0x31b975);}return null;};}function patchUpdates(_0x3207bd){return function(_0x15b900){try{jsonpatch[_0x8523('0x1f')](_0x15b900,_0x3207bd,!![]);}catch(_0x2db212){return BPromise[_0x8523('0x20')](_0x2db212);}return _0x15b900[_0x8523('0x21')]();};}function saveUpdates(_0x327fa9,_0x231e3e){return function(_0x3449a5){if(_0x3449a5){return _0x3449a5['update'](_0x327fa9)['then'](function(_0x370505){return _0x370505;});}return null;};}function removeEntity(_0x428c82,_0x2d0886){return function(_0x4c0d40){if(_0x4c0d40){return _0x4c0d40[_0x8523('0x22')]()['then'](function(){var _0x374eca=_0x4c0d40[_0x8523('0x23')]({'plain':!![]});var _0x5f25b8=_0x8523('0x24');return db[_0x8523('0x25')][_0x8523('0x22')]({'where':{'type':_0x5f25b8,'resourceId':_0x374eca['id']}})['then'](function(){return _0x4c0d40;});})[_0x8523('0x26')](function(){_0x428c82['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17413c,_0x4e4d82){return function(_0x2dcc8f){if(!_0x2dcc8f){_0x17413c[_0x8523('0x19')](0x194);}return _0x2dcc8f;};}function handleError(_0x4ab56d,_0x378848){_0x378848=_0x378848||0x1f4;return function(_0x46ea80){logger[_0x8523('0x27')](_0x46ea80[_0x8523('0x28')]);if(_0x46ea80[_0x8523('0x29')]){delete _0x46ea80[_0x8523('0x29')];}_0x4ab56d[_0x8523('0x1a')](_0x378848)[_0x8523('0x2a')](_0x46ea80);};}exports[_0x8523('0x2b')]=function(_0x2a9e8d,_0x2781bd){var _0x1e3286={},_0x421b6a={},_0xf6c8bc={'count':0x0,'rows':[]};var _0xe41c2c=_['map'](db[_0x8523('0x2c')]['rawAttributes'],function(_0x774444){return{'name':_0x774444[_0x8523('0x2d')],'type':_0x774444[_0x8523('0x2e')][_0x8523('0x2f')]};});_0x421b6a[_0x8523('0x30')]=_[_0x8523('0x31')](_0xe41c2c,_0x8523('0x29'));_0x421b6a[_0x8523('0x32')]=_[_0x8523('0x33')](_0x2a9e8d[_0x8523('0x32')]);_0x421b6a['filters']=_[_0x8523('0x34')](_0x421b6a[_0x8523('0x30')],_0x421b6a['query']);_0x1e3286[_0x8523('0x35')]=_[_0x8523('0x34')](_0x421b6a[_0x8523('0x30')],qs[_0x8523('0x36')](_0x2a9e8d['query'][_0x8523('0x36')]));_0x1e3286[_0x8523('0x35')]=_0x1e3286[_0x8523('0x35')]['length']?_0x1e3286['attributes']:_0x421b6a[_0x8523('0x30')];if(!_0x2a9e8d['query'][_0x8523('0x37')]('nolimit')){_0x1e3286[_0x8523('0x38')]=qs[_0x8523('0x38')](_0x2a9e8d[_0x8523('0x32')][_0x8523('0x38')]);_0x1e3286['offset']=qs[_0x8523('0x1c')](_0x2a9e8d[_0x8523('0x32')][_0x8523('0x1c')]);}_0x1e3286[_0x8523('0x39')]=qs['sort'](_0x2a9e8d[_0x8523('0x32')][_0x8523('0x3a')]);_0x1e3286[_0x8523('0x3b')]=qs[_0x8523('0x3c')](_[_0x8523('0x3d')](_0x2a9e8d[_0x8523('0x32')],_0x421b6a[_0x8523('0x3c')]),_0xe41c2c);if(_0x2a9e8d[_0x8523('0x32')]['filter']){_0x1e3286[_0x8523('0x3b')]=_[_0x8523('0x3e')](_0x1e3286[_0x8523('0x3b')],{'$or':_[_0x8523('0x31')](_0xe41c2c,function(_0x1ac0c4){if(_0x1ac0c4[_0x8523('0x2e')]!==_0x8523('0x3f')){var _0x3305b4={};_0x3305b4[_0x1ac0c4[_0x8523('0x29')]]={'$like':'%'+_0x2a9e8d[_0x8523('0x32')][_0x8523('0x40')]+'%'};return _0x3305b4;}})});}_0x1e3286=_[_0x8523('0x3e')]({},_0x1e3286,_0x2a9e8d[_0x8523('0x41')]);var _0x2f4b1a={'where':_0x1e3286['where']};return db['Variable'][_0x8523('0x42')](_0x2f4b1a)[_0x8523('0x26')](function(_0x175453){_0xf6c8bc[_0x8523('0x42')]=_0x175453;if(_0x2a9e8d[_0x8523('0x32')][_0x8523('0x43')]){_0x1e3286[_0x8523('0x44')]=[{'all':!![]}];}return db[_0x8523('0x2c')]['findAll'](_0x1e3286);})[_0x8523('0x26')](function(_0x5a85d6){_0xf6c8bc[_0x8523('0x45')]=_0x5a85d6;return _0xf6c8bc;})['then'](respondWithFilteredResult(_0x2781bd,_0x1e3286))['catch'](handleError(_0x2781bd,null));};exports['show']=function(_0x5def51,_0x34e0a8){var _0x43b718={'raw':!![],'where':{'id':_0x5def51[_0x8523('0x46')]['id']}},_0x3c05b5={};_0x3c05b5[_0x8523('0x30')]=_['keys'](db[_0x8523('0x2c')][_0x8523('0x47')]);_0x3c05b5['query']=_[_0x8523('0x33')](_0x5def51[_0x8523('0x32')]);_0x3c05b5[_0x8523('0x3c')]=_[_0x8523('0x34')](_0x3c05b5[_0x8523('0x30')],_0x3c05b5[_0x8523('0x32')]);_0x43b718[_0x8523('0x35')]=_[_0x8523('0x34')](_0x3c05b5[_0x8523('0x30')],qs[_0x8523('0x36')](_0x5def51[_0x8523('0x32')][_0x8523('0x36')]));_0x43b718[_0x8523('0x35')]=_0x43b718['attributes'][_0x8523('0x48')]?_0x43b718[_0x8523('0x35')]:_0x3c05b5[_0x8523('0x30')];if(_0x5def51[_0x8523('0x32')][_0x8523('0x43')]){_0x43b718[_0x8523('0x44')]=[{'all':!![]}];}_0x43b718=_[_0x8523('0x3e')]({},_0x43b718,_0x5def51[_0x8523('0x41')]);return db[_0x8523('0x2c')][_0x8523('0x49')](_0x43b718)[_0x8523('0x26')](handleEntityNotFound(_0x34e0a8,null))[_0x8523('0x26')](respondWithResult(_0x34e0a8,null))[_0x8523('0x4a')](handleError(_0x34e0a8,null));};exports['create']=function(_0x32cbd1,_0x5eb6e5){return db[_0x8523('0x2c')][_0x8523('0x4b')](_0x32cbd1[_0x8523('0x4c')],{})[_0x8523('0x26')](function(_0x35d688){var _0x51ce83=_0x32cbd1[_0x8523('0x4d')][_0x8523('0x23')]({'plain':!![]});if(!_0x51ce83)throw new Error(_0x8523('0x4e'));if(_0x51ce83['role']===_0x8523('0x4d')){var _0x4ce329=_0x35d688[_0x8523('0x23')]({'plain':!![]});var _0x22c160=_0x8523('0x24');return db[_0x8523('0x4f')]['find']({'where':{'name':_0x22c160,'userProfileId':_0x51ce83[_0x8523('0x50')]},'raw':!![]})[_0x8523('0x26')](function(_0x1db42b){if(_0x1db42b&&_0x1db42b['autoAssociation']===0x0){return db['UserProfileResource'][_0x8523('0x4b')]({'name':_0x4ce329[_0x8523('0x29')],'resourceId':_0x4ce329['id'],'type':_0x1db42b[_0x8523('0x29')],'sectionId':_0x1db42b['id']},{})[_0x8523('0x26')](function(){return _0x35d688;});}else{return _0x35d688;}})[_0x8523('0x4a')](function(_0x4c2478){logger['error'](_0x8523('0x51'),_0x4c2478);throw _0x4c2478;});}return _0x35d688;})[_0x8523('0x26')](respondWithResult(_0x5eb6e5,0xc9))[_0x8523('0x4a')](handleError(_0x5eb6e5,null));};exports[_0x8523('0x52')]=function(_0x50f7f5,_0x4708df){if(_0x50f7f5[_0x8523('0x4c')]['id']){delete _0x50f7f5[_0x8523('0x4c')]['id'];}return db[_0x8523('0x2c')][_0x8523('0x49')]({'where':{'id':_0x50f7f5['params']['id']}})[_0x8523('0x26')](handleEntityNotFound(_0x4708df,null))[_0x8523('0x26')](saveUpdates(_0x50f7f5[_0x8523('0x4c')],null))[_0x8523('0x26')](respondWithResult(_0x4708df,null))['catch'](handleError(_0x4708df,null));};exports['destroy']=function(_0x339b19,_0x329a60){return db[_0x8523('0x2c')]['find']({'where':{'id':_0x339b19[_0x8523('0x46')]['id']}})[_0x8523('0x26')](handleEntityNotFound(_0x329a60,null))[_0x8523('0x26')](removeEntity(_0x329a60,null))[_0x8523('0x4a')](handleError(_0x329a60,null));}; \ No newline at end of file +var _0x8c59=['UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','reject','save','update','destroy','then','get','Variables','end','error','stack','name','Variable','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x442483,_0x545a67){var _0x5e369f=function(_0x487087){while(--_0x487087){_0x442483['push'](_0x442483['shift']());}};_0x5e369f(++_0x545a67);}(_0x8c59,0x194));var _0x98c5=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x8c59[_0x422905];return _0x33dc6c;};'use strict';var pdf=require(_0x98c5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x98c5('0x1'));var zipdir=require(_0x98c5('0x2'));var jsonpatch=require(_0x98c5('0x3'));var rp=require(_0x98c5('0x4'));var moment=require(_0x98c5('0x5'));var BPromise=require(_0x98c5('0x6'));var Mustache=require('mustache');var util=require(_0x98c5('0x7'));var path=require(_0x98c5('0x8'));var sox=require(_0x98c5('0x9'));var csv=require(_0x98c5('0xa'));var ejs=require(_0x98c5('0xb'));var fs=require('fs');var _=require(_0x98c5('0xc'));var squel=require(_0x98c5('0xd'));var crypto=require(_0x98c5('0xe'));var jsforce=require(_0x98c5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x98c5('0xa'));var querystring=require('querystring');var Papa=require(_0x98c5('0x10'));var Redis=require(_0x98c5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x98c5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98c5('0x13'));var logger=require(_0x98c5('0x14'))('api');var utils=require(_0x98c5('0x15'));var config=require(_0x98c5('0x16'));var db=require(_0x98c5('0x17'))['db'];function respondWithStatusCode(_0x2516ef,_0x2ebe2f){_0x2ebe2f=_0x2ebe2f||0xcc;return function(_0x1b72ed){if(_0x1b72ed){return _0x2516ef[_0x98c5('0x18')](_0x2ebe2f);}return _0x2516ef[_0x98c5('0x19')](_0x2ebe2f)['end']();};}function respondWithResult(_0x450035,_0x470976){_0x470976=_0x470976||0xc8;return function(_0x4da41f){if(_0x4da41f){return _0x450035[_0x98c5('0x19')](_0x470976)[_0x98c5('0x1a')](_0x4da41f);}};}function respondWithFilteredResult(_0x44e796,_0x17c5b0){return function(_0x8b2d4a){if(_0x8b2d4a){var _0x389f70=_0x8b2d4a['count'],_0x41110d=_0x17c5b0[_0x98c5('0x1b')],_0x1120f4=_0x17c5b0[_0x98c5('0x1b')]+_0x17c5b0[_0x98c5('0x1c')],_0x58d176;if(_0x1120f4>=_0x389f70){_0x1120f4=_0x389f70;_0x58d176=0xc8;}else{_0x58d176=0xce;}_0x44e796[_0x98c5('0x19')](_0x58d176);return _0x44e796[_0x98c5('0x1d')]('Content-Range',_0x41110d+'-'+_0x1120f4+'/'+_0x389f70)['json'](_0x8b2d4a);}return null;};}function patchUpdates(_0x3e838a){return function(_0x2a81a3){try{jsonpatch['apply'](_0x2a81a3,_0x3e838a,!![]);}catch(_0x196843){return BPromise[_0x98c5('0x1e')](_0x196843);}return _0x2a81a3[_0x98c5('0x1f')]();};}function saveUpdates(_0x266f85,_0x49c6ed){return function(_0x2e4f9b){if(_0x2e4f9b){return _0x2e4f9b[_0x98c5('0x20')](_0x266f85)['then'](function(_0x5b5345){return _0x5b5345;});}return null;};}function removeEntity(_0xfbe916,_0x4533b2){return function(_0x2f648c){if(_0x2f648c){return _0x2f648c[_0x98c5('0x21')]()[_0x98c5('0x22')](function(){var _0x38974b=_0x2f648c[_0x98c5('0x23')]({'plain':!![]});var _0x4b5081=_0x98c5('0x24');return db['UserProfileResource'][_0x98c5('0x21')]({'where':{'type':_0x4b5081,'resourceId':_0x38974b['id']}})[_0x98c5('0x22')](function(){return _0x2f648c;});})[_0x98c5('0x22')](function(){_0xfbe916['status'](0xcc)[_0x98c5('0x25')]();});}};}function handleEntityNotFound(_0x5f3ffd,_0x2eb90b){return function(_0xcf05aa){if(!_0xcf05aa){_0x5f3ffd[_0x98c5('0x18')](0x194);}return _0xcf05aa;};}function handleError(_0x140d9e,_0x5643d2){_0x5643d2=_0x5643d2||0x1f4;return function(_0x44c48c){logger[_0x98c5('0x26')](_0x44c48c[_0x98c5('0x27')]);if(_0x44c48c[_0x98c5('0x28')]){delete _0x44c48c[_0x98c5('0x28')];}_0x140d9e['status'](_0x5643d2)['send'](_0x44c48c);};}exports['index']=function(_0x5aa799,_0x12cc05){var _0x5b6d02={},_0x2f1c6e={},_0x224018={'count':0x0,'rows':[]};var _0x3af6a6=_['map'](db[_0x98c5('0x29')][_0x98c5('0x2a')],function(_0x3d3eea){return{'name':_0x3d3eea[_0x98c5('0x2b')],'type':_0x3d3eea[_0x98c5('0x2c')][_0x98c5('0x2d')]};});_0x2f1c6e['model']=_[_0x98c5('0x2e')](_0x3af6a6,_0x98c5('0x28'));_0x2f1c6e[_0x98c5('0x2f')]=_[_0x98c5('0x30')](_0x5aa799['query']);_0x2f1c6e[_0x98c5('0x31')]=_['intersection'](_0x2f1c6e[_0x98c5('0x32')],_0x2f1c6e['query']);_0x5b6d02[_0x98c5('0x33')]=_[_0x98c5('0x34')](_0x2f1c6e[_0x98c5('0x32')],qs[_0x98c5('0x35')](_0x5aa799['query'][_0x98c5('0x35')]));_0x5b6d02['attributes']=_0x5b6d02[_0x98c5('0x33')][_0x98c5('0x36')]?_0x5b6d02[_0x98c5('0x33')]:_0x2f1c6e[_0x98c5('0x32')];if(!_0x5aa799['query']['hasOwnProperty'](_0x98c5('0x37'))){_0x5b6d02[_0x98c5('0x1c')]=qs[_0x98c5('0x1c')](_0x5aa799['query'][_0x98c5('0x1c')]);_0x5b6d02[_0x98c5('0x1b')]=qs['offset'](_0x5aa799[_0x98c5('0x2f')][_0x98c5('0x1b')]);}_0x5b6d02[_0x98c5('0x38')]=qs[_0x98c5('0x39')](_0x5aa799[_0x98c5('0x2f')][_0x98c5('0x39')]);_0x5b6d02[_0x98c5('0x3a')]=qs[_0x98c5('0x31')](_[_0x98c5('0x3b')](_0x5aa799[_0x98c5('0x2f')],_0x2f1c6e[_0x98c5('0x31')]),_0x3af6a6);if(_0x5aa799['query'][_0x98c5('0x3c')]){_0x5b6d02[_0x98c5('0x3a')]=_[_0x98c5('0x3d')](_0x5b6d02[_0x98c5('0x3a')],{'$or':_['map'](_0x3af6a6,function(_0x579af9){if(_0x579af9[_0x98c5('0x2c')]!==_0x98c5('0x3e')){var _0x4d1edc={};_0x4d1edc[_0x579af9['name']]={'$like':'%'+_0x5aa799[_0x98c5('0x2f')][_0x98c5('0x3c')]+'%'};return _0x4d1edc;}})});}_0x5b6d02=_[_0x98c5('0x3d')]({},_0x5b6d02,_0x5aa799['options']);var _0x846885={'where':_0x5b6d02[_0x98c5('0x3a')]};return db[_0x98c5('0x29')][_0x98c5('0x3f')](_0x846885)[_0x98c5('0x22')](function(_0x21ff6c){_0x224018['count']=_0x21ff6c;if(_0x5aa799[_0x98c5('0x2f')][_0x98c5('0x40')]){_0x5b6d02[_0x98c5('0x41')]=[{'all':!![]}];}return db[_0x98c5('0x29')][_0x98c5('0x42')](_0x5b6d02);})[_0x98c5('0x22')](function(_0x106b06){_0x224018[_0x98c5('0x43')]=_0x106b06;return _0x224018;})[_0x98c5('0x22')](respondWithFilteredResult(_0x12cc05,_0x5b6d02))[_0x98c5('0x44')](handleError(_0x12cc05,null));};exports[_0x98c5('0x45')]=function(_0x4e7d11,_0x252de6){var _0x4717cd={'raw':!![],'where':{'id':_0x4e7d11['params']['id']}},_0x345265={};_0x345265['model']=_[_0x98c5('0x30')](db['Variable'][_0x98c5('0x2a')]);_0x345265[_0x98c5('0x2f')]=_[_0x98c5('0x30')](_0x4e7d11['query']);_0x345265[_0x98c5('0x31')]=_[_0x98c5('0x34')](_0x345265[_0x98c5('0x32')],_0x345265['query']);_0x4717cd[_0x98c5('0x33')]=_[_0x98c5('0x34')](_0x345265[_0x98c5('0x32')],qs[_0x98c5('0x35')](_0x4e7d11[_0x98c5('0x2f')][_0x98c5('0x35')]));_0x4717cd[_0x98c5('0x33')]=_0x4717cd[_0x98c5('0x33')]['length']?_0x4717cd['attributes']:_0x345265['model'];if(_0x4e7d11[_0x98c5('0x2f')][_0x98c5('0x40')]){_0x4717cd[_0x98c5('0x41')]=[{'all':!![]}];}_0x4717cd=_[_0x98c5('0x3d')]({},_0x4717cd,_0x4e7d11['options']);return db['Variable'][_0x98c5('0x46')](_0x4717cd)['then'](handleEntityNotFound(_0x252de6,null))[_0x98c5('0x22')](respondWithResult(_0x252de6,null))[_0x98c5('0x44')](handleError(_0x252de6,null));};exports[_0x98c5('0x47')]=function(_0x3218d3,_0x2263db){return db[_0x98c5('0x29')][_0x98c5('0x47')](_0x3218d3[_0x98c5('0x48')],{})[_0x98c5('0x22')](function(_0xe42ba3){var _0x2c10a4=_0x3218d3[_0x98c5('0x49')]['get']({'plain':!![]});if(!_0x2c10a4)throw new Error(_0x98c5('0x4a'));if(_0x2c10a4[_0x98c5('0x4b')]==='user'){var _0x3110bc=_0xe42ba3[_0x98c5('0x23')]({'plain':!![]});var _0x37fe81=_0x98c5('0x24');return db[_0x98c5('0x4c')][_0x98c5('0x46')]({'where':{'name':_0x37fe81,'userProfileId':_0x2c10a4[_0x98c5('0x4d')]},'raw':!![]})[_0x98c5('0x22')](function(_0x1d9a43){if(_0x1d9a43&&_0x1d9a43['autoAssociation']===0x0){return db['UserProfileResource'][_0x98c5('0x47')]({'name':_0x3110bc[_0x98c5('0x28')],'resourceId':_0x3110bc['id'],'type':_0x1d9a43[_0x98c5('0x28')],'sectionId':_0x1d9a43['id']},{})[_0x98c5('0x22')](function(){return _0xe42ba3;});}else{return _0xe42ba3;}})['catch'](function(_0x3ff1d8){logger[_0x98c5('0x26')](_0x98c5('0x4e'),_0x3ff1d8);throw _0x3ff1d8;});}return _0xe42ba3;})[_0x98c5('0x22')](respondWithResult(_0x2263db,0xc9))['catch'](handleError(_0x2263db,null));};exports[_0x98c5('0x20')]=function(_0x248cf7,_0x31e8a7){if(_0x248cf7[_0x98c5('0x48')]['id']){delete _0x248cf7[_0x98c5('0x48')]['id'];}return db[_0x98c5('0x29')][_0x98c5('0x46')]({'where':{'id':_0x248cf7['params']['id']}})[_0x98c5('0x22')](handleEntityNotFound(_0x31e8a7,null))['then'](saveUpdates(_0x248cf7[_0x98c5('0x48')],null))[_0x98c5('0x22')](respondWithResult(_0x31e8a7,null))[_0x98c5('0x44')](handleError(_0x31e8a7,null));};exports[_0x98c5('0x21')]=function(_0xc35b96,_0x5c87e8){return db['Variable'][_0x98c5('0x46')]({'where':{'id':_0xc35b96[_0x98c5('0x4f')]['id']}})[_0x98c5('0x22')](handleEntityNotFound(_0x5c87e8,null))[_0x98c5('0x22')](removeEntity(_0x5c87e8,null))[_0x98c5('0x44')](handleError(_0x5c87e8,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index a8065b0..fb9fd6e 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 _0x1a43=['lodash','util','api','bluebird','request-promise','../../config/environment','exports','Variable'];(function(_0xe2276e,_0xab7ea4){var _0x4332c5=function(_0x4b9fca){while(--_0x4b9fca){_0xe2276e['push'](_0xe2276e['shift']());}};_0x4332c5(++_0xab7ea4);}(_0x1a43,0xa8));var _0x31a4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a43[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x31a4('0x0'));var util=require(_0x31a4('0x1'));var logger=require('../../config/logger')(_0x31a4('0x2'));var moment=require('moment');var BPromise=require(_0x31a4('0x3'));var rp=require(_0x31a4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x31a4('0x5'));var attributes=require('./variable.attributes');module[_0x31a4('0x6')]=function(_0x3e6680,_0x19a420){return _0x3e6680['define'](_0x31a4('0x7'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12ca=['./variable.attributes','exports','define','Variable','tools_variables','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x12ca,0x18b));var _0xa12c=function(_0x1224d7,_0x20b876){_0x1224d7=_0x1224d7-0x0;var _0x3441c3=_0x12ca[_0x1224d7];return _0x3441c3;};'use strict';var _=require(_0xa12c('0x0'));var util=require(_0xa12c('0x1'));var logger=require('../../config/logger')(_0xa12c('0x2'));var moment=require('moment');var BPromise=require(_0xa12c('0x3'));var rp=require(_0xa12c('0x4'));var fs=require('fs');var path=require(_0xa12c('0x5'));var rimraf=require(_0xa12c('0x6'));var config=require(_0xa12c('0x7'));var attributes=require(_0xa12c('0x8'));module[_0xa12c('0x9')]=function(_0x3795f9,_0x18ee5c){return _0x3795f9[_0xa12c('0xa')](_0xa12c('0xb'),attributes,{'tableName':_0xa12c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index ed588fb..81ff62b 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 _0xd5d8=['attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','ShowVariable','find','options','raw','where'];(function(_0x5306fc,_0x2b7040){var _0x461e18=function(_0x40db01){while(--_0x40db01){_0x5306fc['push'](_0x5306fc['shift']());}};_0x461e18(++_0x2b7040);}(_0xd5d8,0x143));var _0x8d5d=function(_0x1a6d31,_0x2a5af9){_0x1a6d31=_0x1a6d31-0x0;var _0x1576fd=_0xd5d8[_0x1a6d31];return _0x1576fd;};'use strict';var _=require(_0x8d5d('0x0'));var util=require(_0x8d5d('0x1'));var moment=require(_0x8d5d('0x2'));var BPromise=require(_0x8d5d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d5d('0x4'));var db=require(_0x8d5d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8d5d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8d5d('0x7')][_0x8d5d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1721c8,_0x4b3610,_0x1df2d6){return new BPromise(function(_0x233846,_0x36bd36){return client[_0x8d5d('0x9')](_0x1721c8,_0x1df2d6)[_0x8d5d('0xa')](function(_0x697c50){logger['info'](_0x8d5d('0xb'),_0x4b3610,_0x8d5d('0xc'));logger[_0x8d5d('0xd')](_0x8d5d('0xe'),_0x4b3610,_0x8d5d('0xc'),JSON['stringify'](_0x697c50));if(_0x697c50[_0x8d5d('0xf')]){if(_0x697c50[_0x8d5d('0xf')][_0x8d5d('0x10')]===0x1f4){logger['error'](_0x8d5d('0xb'),_0x4b3610,_0x697c50[_0x8d5d('0xf')][_0x8d5d('0x11')]);return _0x36bd36(_0x697c50['error'][_0x8d5d('0x11')]);}logger['error']('Variable,\x20%s,\x20%s',_0x4b3610,_0x697c50[_0x8d5d('0xf')][_0x8d5d('0x11')]);return _0x233846(_0x697c50[_0x8d5d('0xf')][_0x8d5d('0x11')]);}else{logger[_0x8d5d('0x12')]('Variable,\x20%s,\x20%s',_0x4b3610,_0x8d5d('0xc'));_0x233846(_0x697c50['result'][_0x8d5d('0x11')]);}})[_0x8d5d('0x13')](function(_0x440518){logger[_0x8d5d('0xf')](_0x8d5d('0xb'),_0x4b3610,_0x440518);_0x36bd36(_0x440518);});});}exports[_0x8d5d('0x14')]=function(_0x268b9c){var _0x2669cb=this;return new Promise(function(_0x3bf1a9,_0x2665dc){return db['Variable'][_0x8d5d('0x15')]({'raw':_0x268b9c[_0x8d5d('0x16')]?_0x268b9c['options'][_0x8d5d('0x17')]===undefined?!![]:![]:!![],'where':_0x268b9c[_0x8d5d('0x16')]?_0x268b9c['options'][_0x8d5d('0x18')]||null:null,'attributes':_0x268b9c[_0x8d5d('0x16')]?_0x268b9c[_0x8d5d('0x16')][_0x8d5d('0x19')]||null:null,'include':_0x268b9c['options']?_0x268b9c[_0x8d5d('0x16')][_0x8d5d('0x1a')]?_[_0x8d5d('0x1b')](_0x268b9c['options']['include'],function(_0x1e7db9){return{'model':db[_0x1e7db9['model']],'as':_0x1e7db9['as'],'attributes':_0x1e7db9[_0x8d5d('0x19')],'include':_0x1e7db9[_0x8d5d('0x1a')]?_[_0x8d5d('0x1b')](_0x1e7db9[_0x8d5d('0x1a')],function(_0x3c9609){return{'model':db[_0x3c9609[_0x8d5d('0x1c')]],'as':_0x3c9609['as'],'attributes':_0x3c9609['attributes'],'include':_0x3c9609[_0x8d5d('0x1a')]?_[_0x8d5d('0x1b')](_0x3c9609[_0x8d5d('0x1a')],function(_0x284cdf){return{'model':db[_0x284cdf[_0x8d5d('0x1c')]],'as':_0x284cdf['as'],'attributes':_0x284cdf[_0x8d5d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8d5d('0xa')](function(_0x45d176){logger[_0x8d5d('0x12')](_0x8d5d('0x14'),_0x268b9c);logger[_0x8d5d('0xd')](_0x8d5d('0x14'),_0x268b9c,JSON['stringify'](_0x45d176));_0x3bf1a9(_0x45d176);})[_0x8d5d('0x13')](function(_0x559889){logger[_0x8d5d('0xf')]('ShowVariable',_0x559889[_0x8d5d('0x11')],_0x268b9c);_0x2665dc(_0x2669cb[_0x8d5d('0xf')](0x1f4,_0x559889[_0x8d5d('0x11')]));});});}; \ No newline at end of file +var _0x949c=['include','model','then','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','attributes','map'];(function(_0x360c92,_0x5ed443){var _0x429495=function(_0x11feaf){while(--_0x11feaf){_0x360c92['push'](_0x360c92['shift']());}};_0x429495(++_0x5ed443);}(_0x949c,0x18a));var _0xc949=function(_0x512720,_0x1639ba){_0x512720=_0x512720-0x0;var _0x39fb20=_0x949c[_0x512720];return _0x39fb20;};'use strict';var _=require('lodash');var util=require(_0xc949('0x0'));var moment=require(_0xc949('0x1'));var BPromise=require(_0xc949('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc949('0x3'));var db=require(_0xc949('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc949('0x5'))('rpc');var config=require(_0xc949('0x6'));var jayson=require(_0xc949('0x7'));var client=jayson[_0xc949('0x8')][_0xc949('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f123f,_0x883938,_0x2f21ad){return new BPromise(function(_0x28514d,_0x2c2801){return client['request'](_0x5f123f,_0x2f21ad)['then'](function(_0x3949ae){logger[_0xc949('0xa')](_0xc949('0xb'),_0x883938,_0xc949('0xc'));logger[_0xc949('0xd')](_0xc949('0xe'),_0x883938,_0xc949('0xc'),JSON[_0xc949('0xf')](_0x3949ae));if(_0x3949ae[_0xc949('0x10')]){if(_0x3949ae[_0xc949('0x10')][_0xc949('0x11')]===0x1f4){logger['error'](_0xc949('0xb'),_0x883938,_0x3949ae[_0xc949('0x10')][_0xc949('0x12')]);return _0x2c2801(_0x3949ae[_0xc949('0x10')][_0xc949('0x12')]);}logger[_0xc949('0x10')](_0xc949('0xb'),_0x883938,_0x3949ae['error'][_0xc949('0x12')]);return _0x28514d(_0x3949ae[_0xc949('0x10')][_0xc949('0x12')]);}else{logger[_0xc949('0xa')](_0xc949('0xb'),_0x883938,_0xc949('0xc'));_0x28514d(_0x3949ae[_0xc949('0x13')][_0xc949('0x12')]);}})['catch'](function(_0x3fed43){logger[_0xc949('0x10')](_0xc949('0xb'),_0x883938,_0x3fed43);_0x2c2801(_0x3fed43);});});}exports[_0xc949('0x14')]=function(_0x279361){var _0x4e5b62=this;return new Promise(function(_0x1ee686,_0x10157){return db[_0xc949('0x15')][_0xc949('0x16')]({'raw':_0x279361[_0xc949('0x17')]?_0x279361[_0xc949('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x279361[_0xc949('0x17')]?_0x279361['options']['where']||null:null,'attributes':_0x279361[_0xc949('0x17')]?_0x279361['options'][_0xc949('0x18')]||null:null,'include':_0x279361[_0xc949('0x17')]?_0x279361[_0xc949('0x17')]['include']?_[_0xc949('0x19')](_0x279361[_0xc949('0x17')][_0xc949('0x1a')],function(_0x3daedd){return{'model':db[_0x3daedd[_0xc949('0x1b')]],'as':_0x3daedd['as'],'attributes':_0x3daedd[_0xc949('0x18')],'include':_0x3daedd[_0xc949('0x1a')]?_[_0xc949('0x19')](_0x3daedd[_0xc949('0x1a')],function(_0x4bff5c){return{'model':db[_0x4bff5c[_0xc949('0x1b')]],'as':_0x4bff5c['as'],'attributes':_0x4bff5c[_0xc949('0x18')],'include':_0x4bff5c[_0xc949('0x1a')]?_[_0xc949('0x19')](_0x4bff5c[_0xc949('0x1a')],function(_0x2482e3){return{'model':db[_0x2482e3[_0xc949('0x1b')]],'as':_0x2482e3['as'],'attributes':_0x2482e3[_0xc949('0x18')]};}):[]};}):[]};}):[]:[]})[_0xc949('0x1c')](function(_0x2ec163){logger[_0xc949('0xa')](_0xc949('0x14'),_0x279361);logger[_0xc949('0xd')](_0xc949('0x14'),_0x279361,JSON['stringify'](_0x2ec163));_0x1ee686(_0x2ec163);})[_0xc949('0x1d')](function(_0x3c3712){logger[_0xc949('0x10')]('ShowVariable',_0x3c3712[_0xc949('0x12')],_0x279361);_0x10157(_0x4e5b62[_0xc949('0x10')](0x1f4,_0x3c3712['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 2d0b063..7c83f17 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 _0xd95b=['Router','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','fetch','canUpdate','reset','/pull','pull','/restart','restart','migrations'];(function(_0x5c0c74,_0x44a20c){var _0x1bd22c=function(_0x5a6f3e){while(--_0x5a6f3e){_0x5c0c74['push'](_0x5c0c74['shift']());}};_0x1bd22c(++_0x44a20c);}(_0xd95b,0x126));var _0xbd95=function(_0x22e6d3,_0x5c863d){_0x22e6d3=_0x22e6d3-0x0;var _0x30782c=_0xd95b[_0x22e6d3];return _0x30782c;};'use strict';var express=require('express');var router=express[_0xbd95('0x0')]();var auth=require(_0xbd95('0x1'));var controller=require(_0xbd95('0x2'));router[_0xbd95('0x3')]('/',controller['index']);router[_0xbd95('0x3')](_0xbd95('0x4'),auth[_0xbd95('0x5')](),auth['canUpdate'](),controller[_0xbd95('0x6')]);router[_0xbd95('0x3')]('/reset',auth[_0xbd95('0x5')](),auth[_0xbd95('0x7')](),controller[_0xbd95('0x8')]);router['get'](_0xbd95('0x9'),auth['isAuthenticated'](),auth[_0xbd95('0x7')](),controller[_0xbd95('0xa')]);router['get'](_0xbd95('0xb'),auth['isAuthenticated'](),controller[_0xbd95('0xc')]);router[_0xbd95('0x3')]('/migrations',controller[_0xbd95('0xd')]);module['exports']=router; \ No newline at end of file +var _0x48fb=['fetch','isAuthenticated','reset','pull','/restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch'];(function(_0xc01ffc,_0x3ee154){var _0x162b27=function(_0x4d5d2b){while(--_0x4d5d2b){_0xc01ffc['push'](_0xc01ffc['shift']());}};_0x162b27(++_0x3ee154);}(_0x48fb,0xad));var _0xb48f=function(_0x3d90d3,_0x4fa646){_0x3d90d3=_0x3d90d3-0x0;var _0x4f6197=_0x48fb[_0x3d90d3];return _0x4f6197;};'use strict';var express=require(_0xb48f('0x0'));var router=express[_0xb48f('0x1')]();var auth=require(_0xb48f('0x2'));var controller=require(_0xb48f('0x3'));router[_0xb48f('0x4')]('/',controller[_0xb48f('0x5')]);router[_0xb48f('0x4')](_0xb48f('0x6'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xb48f('0x7')]);router[_0xb48f('0x4')]('/reset',auth[_0xb48f('0x8')](),auth['canUpdate'](),controller[_0xb48f('0x9')]);router[_0xb48f('0x4')]('/pull',auth[_0xb48f('0x8')](),auth['canUpdate'](),controller[_0xb48f('0xa')]);router['get'](_0xb48f('0xb'),auth[_0xb48f('0x8')](),controller['restart']);router[_0xb48f('0x4')](_0xb48f('0xc'),controller[_0xb48f('0xd')]);module[_0xb48f('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 8537bab..6bed951 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 _0x5324=['sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','exports','version','query','latest','fetch','tags','2.0.0','status','json','origin','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','server','replace','.js','push','length'];(function(_0x5d7583,_0x48a446){var _0x1e615c=function(_0x145946){while(--_0x145946){_0x5d7583['push'](_0x5d7583['shift']());}};_0x1e615c(++_0x48a446);}(_0x5324,0x154));var _0x4532=function(_0x1cc1b2,_0x33fe5d){_0x1cc1b2=_0x1cc1b2-0x0;var _0x48adf6=_0x5324[_0x1cc1b2];return _0x48adf6;};'use strict';var Umzug=require(_0x4532('0x0'));var path=require(_0x4532('0x1'));var fs=require('fs');var _=require(_0x4532('0x2'));var pkginfo=require(_0x4532('0x3'))(module,'version');var compareVersions=require(_0x4532('0x4'));var exec=require('child_process')[_0x4532('0x5')];var db=require(_0x4532('0x6'))['db'];var config=require(_0x4532('0x7'));var pm2=require(_0x4532('0x8'));var logger=require(_0x4532('0x9'))(_0x4532('0xa'));var git=require(_0x4532('0xb'))(config[_0x4532('0xc')]);exports['index']=function(_0x3b9865,_0x455819){var _0x138aac={'current':module[_0x4532('0xd')][_0x4532('0xe')],'phonebar':0x2};if(_0x3b9865[_0x4532('0xf')]&&_0x3b9865[_0x4532('0xf')][_0x4532('0x10')]){return git[_0x4532('0x11')]()[_0x4532('0x12')](function(_0x314e97,_0xfabd65){_0x138aac['latest']=(_0x314e97?module['exports'][_0x4532('0xe')]:_0xfabd65['latest'])||_0x4532('0x13');return _0x455819[_0x4532('0x14')](0xc8)[_0x4532('0x15')](_0x138aac);});}else{return _0x455819[_0x4532('0x14')](0xc8)['json'](_0x138aac);}};exports[_0x4532('0x11')]=function(_0x167859,_0x39acf3){return git[_0x4532('0x11')]([_0x4532('0x16'),'master'],function(_0x59075c){if(_0x59075c){logger['error'](_0x59075c);return _0x39acf3[_0x4532('0x14')](0x1f4)[_0x4532('0x15')](_0x59075c);}logger[_0x4532('0x17')](_0x4532('0x18'));return _0x39acf3[_0x4532('0x14')](0xc8)[_0x4532('0x15')]({'output':_0x4532('0x19')});});};exports[_0x4532('0x1a')]=function(_0xd479a9,_0x4db2a1){return git[_0x4532('0x1a')]([_0x4532('0x1b'),_0x4532('0x1c')],function(_0x530ce0){if(_0x530ce0){logger[_0x4532('0x1d')](_0x530ce0);return _0x4db2a1[_0x4532('0x14')](0x1f4)['json'](_0x530ce0);}logger[_0x4532('0x17')](_0x4532('0x1e'));return _0x4db2a1[_0x4532('0x14')](0xc8)[_0x4532('0x15')]({'output':_0x4532('0x1f')});});};exports[_0x4532('0x20')]=function(_0x6a669f,_0x53127c){exec('npm\x20install\x20--production',function(_0x94b670,_0x46dc73,_0x481c26){logger[_0x4532('0x17')](_0x46dc73);logger[_0x4532('0x17')](_0x481c26);if(_0x94b670){logger[_0x4532('0x1d')](_0x94b670);return _0x53127c[_0x4532('0x14')](0x1f4)['json'](_0x94b670);}return _0x53127c[_0x4532('0x14')](0xc8)['json']({'output':_0x46dc73});});};exports[_0x4532('0x21')]=function(_0x9353c0,_0x16e2c4){return pm2[_0x4532('0x21')](_0x4532('0x22'))[_0x4532('0x23')](function(_0x105338){logger[_0x4532('0x17')]('pm2\x20restart\x20motion\x20%s',_0x105338);return _0x16e2c4['status'](0xc8)[_0x4532('0x15')]({'output':_0x4532('0x24')});})[_0x4532('0x25')](function(_0x19f85c){logger[_0x4532('0x1d')](_0x19f85c);return _0x16e2c4[_0x4532('0x14')](0x1f4)['json'](_0x19f85c);});};exports[_0x4532('0x26')]=function(_0x239e85,_0x11d163){var _0x16836c=fs[_0x4532('0x27')](path['join'](config[_0x4532('0xc')],_0x4532('0x28'),_0x4532('0x26')));var _0x523f96=[];for(var _0x58602d=0x0;_0x58602d<_0x16836c['length'];_0x58602d++){var _0x3e4c89=_0x16836c[_0x58602d][_0x4532('0x29')](_0x4532('0x2a'),'');if(compareVersions(module[_0x4532('0xd')][_0x4532('0xe')],_0x3e4c89)===-0x1){_0x523f96[_0x4532('0x2b')](_0x3e4c89);}}if(_0x523f96[_0x4532('0x2c')]){var _0x4a119b=_0x523f96['sort'](compareVersions);var _0xb7b6d2=new Umzug({'storage':_0x4532('0x2d'),'storageOptions':{'model':db['Migration'],'modelName':_0x4532('0x2e'),'columnName':_0x4532('0xe')},'migrations':{'params':[db[_0x4532('0x2d')][_0x4532('0x2f')](),db[_0x4532('0x2d')][_0x4532('0x30')],function(){throw new Error(_0x4532('0x31'));}],'path':path[_0x4532('0x32')](config['root'],'server',_0x4532('0x26')),'pattern':/\.js$/}});_0xb7b6d2['up']({'migrations':_[_0x4532('0x33')](_0x4a119b,function(_0x53e03e){return _0x53e03e+_0x4532('0x2a');})})[_0x4532('0x23')](function(){return _0x11d163[_0x4532('0x14')](0xc8)[_0x4532('0x15')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x4532('0xd')]['version']+_0x4532('0x34')+_['last'](_0x4a119b),'migrations':_[_0x4532('0x32')](_0x4a119b)});})[_0x4532('0x25')](function(_0x32597a){if(_0x32597a instanceof db[_0x4532('0x2d')][_0x4532('0x35')]){return _0x11d163[_0x4532('0x14')](0xc8)[_0x4532('0x15')]({'output':_0x4532('0x36')});}else{return _0x11d163[_0x4532('0x14')](0x1f4)[_0x4532('0x15')](_0x32597a);}});}else{return _0x11d163[_0x4532('0x14')](0xc8)['json']({'output':_0x4532('0x36')});}}; \ No newline at end of file +var _0x095b=['Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','2.0.0','json','status','fetch','master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace','.js','push','Migration','sequelize','getQueryInterface','constructor'];(function(_0x3214c7,_0xdbe6b5){var _0x3cf4e2=function(_0x23c0d2){while(--_0x23c0d2){_0x3214c7['push'](_0x3214c7['shift']());}};_0x3cf4e2(++_0xdbe6b5);}(_0x095b,0x6e));var _0xb095=function(_0x23bee2,_0x5be0c6){_0x23bee2=_0x23bee2-0x0;var _0x193494=_0x095b[_0x23bee2];return _0x193494;};'use strict';var Umzug=require(_0xb095('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xb095('0x1'));var pkginfo=require(_0xb095('0x2'))(module,_0xb095('0x3'));var compareVersions=require(_0xb095('0x4'));var exec=require(_0xb095('0x5'))['exec'];var db=require(_0xb095('0x6'))['db'];var config=require(_0xb095('0x7'));var pm2=require(_0xb095('0x8'));var logger=require(_0xb095('0x9'))(_0xb095('0xa'));var git=require(_0xb095('0xb'))(config[_0xb095('0xc')]);exports[_0xb095('0xd')]=function(_0x39fc96,_0x47a5eb){var _0x357e98={'current':module[_0xb095('0xe')][_0xb095('0x3')],'phonebar':0x2};if(_0x39fc96[_0xb095('0xf')]&&_0x39fc96[_0xb095('0xf')][_0xb095('0x10')]){return git['fetch']()['tags'](function(_0x2e510a,_0x3c30b7){_0x357e98['latest']=(_0x2e510a?module[_0xb095('0xe')][_0xb095('0x3')]:_0x3c30b7['latest'])||_0xb095('0x11');return _0x47a5eb['status'](0xc8)[_0xb095('0x12')](_0x357e98);});}else{return _0x47a5eb[_0xb095('0x13')](0xc8)[_0xb095('0x12')](_0x357e98);}};exports[_0xb095('0x14')]=function(_0x1c5e84,_0x394df0){return git[_0xb095('0x14')](['origin',_0xb095('0x15')],function(_0x3a77f1){if(_0x3a77f1){logger[_0xb095('0x16')](_0x3a77f1);return _0x394df0[_0xb095('0x13')](0x1f4)[_0xb095('0x12')](_0x3a77f1);}logger[_0xb095('0x17')]('git\x20fetch');return _0x394df0['status'](0xc8)['json']({'output':_0xb095('0x18')});});};exports[_0xb095('0x19')]=function(_0x1c509b,_0x54d06){return git[_0xb095('0x19')]([_0xb095('0x1a'),'FETCH_HEAD'],function(_0x7f9045){if(_0x7f9045){logger[_0xb095('0x16')](_0x7f9045);return _0x54d06[_0xb095('0x13')](0x1f4)[_0xb095('0x12')](_0x7f9045);}logger['info'](_0xb095('0x1b'));return _0x54d06[_0xb095('0x13')](0xc8)[_0xb095('0x12')]({'output':_0xb095('0x1c')});});};exports[_0xb095('0x1d')]=function(_0x2af120,_0x59ea56){exec(_0xb095('0x1e'),function(_0x525a1a,_0x51750f,_0x4ef4a9){logger[_0xb095('0x17')](_0x51750f);logger['info'](_0x4ef4a9);if(_0x525a1a){logger[_0xb095('0x16')](_0x525a1a);return _0x59ea56[_0xb095('0x13')](0x1f4)[_0xb095('0x12')](_0x525a1a);}return _0x59ea56[_0xb095('0x13')](0xc8)['json']({'output':_0x51750f});});};exports['restart']=function(_0x371365,_0x4d242f){return pm2[_0xb095('0x1f')](_0xb095('0x20'))[_0xb095('0x21')](function(_0x5a35db){logger[_0xb095('0x17')](_0xb095('0x22'),_0x5a35db);return _0x4d242f[_0xb095('0x13')](0xc8)[_0xb095('0x12')]({'output':_0xb095('0x23')});})[_0xb095('0x24')](function(_0x183815){logger[_0xb095('0x16')](_0x183815);return _0x4d242f['status'](0x1f4)['json'](_0x183815);});};exports[_0xb095('0x25')]=function(_0x1d82a5,_0x53803f){var _0x2f273f=fs[_0xb095('0x26')](path[_0xb095('0x27')](config[_0xb095('0xc')],_0xb095('0x28'),_0xb095('0x25')));var _0xafd194=[];for(var _0x4d5a6d=0x0;_0x4d5a6d<_0x2f273f[_0xb095('0x29')];_0x4d5a6d++){var _0x37aa68=_0x2f273f[_0x4d5a6d][_0xb095('0x2a')](_0xb095('0x2b'),'');if(compareVersions(module[_0xb095('0xe')][_0xb095('0x3')],_0x37aa68)===-0x1){_0xafd194[_0xb095('0x2c')](_0x37aa68);}}if(_0xafd194['length']){var _0x54379c=_0xafd194['sort'](compareVersions);var _0x59a547=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xb095('0x2d')],'modelName':_0xb095('0x2d'),'columnName':_0xb095('0x3')},'migrations':{'params':[db[_0xb095('0x2e')][_0xb095('0x2f')](),db[_0xb095('0x2e')][_0xb095('0x30')],function(){throw new Error(_0xb095('0x31'));}],'path':path[_0xb095('0x27')](config[_0xb095('0xc')],_0xb095('0x28'),'migrations'),'pattern':/\.js$/}});_0x59a547['up']({'migrations':_[_0xb095('0x32')](_0x54379c,function(_0x37def0){return _0x37def0+_0xb095('0x2b');})})['then'](function(){return _0x53803f['status'](0xc8)[_0xb095('0x12')]({'output':_0xb095('0x33')+module[_0xb095('0xe')][_0xb095('0x3')]+'\x20to\x20'+_['last'](_0x54379c),'migrations':_[_0xb095('0x27')](_0x54379c)});})['catch'](function(_0x4709fe){if(_0x4709fe instanceof db[_0xb095('0x2e')]['UniqueConstraintError']){return _0x53803f[_0xb095('0x13')](0xc8)[_0xb095('0x12')]({'output':_0xb095('0x34')});}else{return _0x53803f['status'](0x1f4)[_0xb095('0x12')](_0x4709fe);}});}else{return _0x53803f[_0xb095('0x13')](0xc8)['json']({'output':_0xb095('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 5cdd662..a02164d 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 _0xa221=['../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','/describe','isAuthenticated','describe','show','post','create','update','delete','/:id','destroy','multer','connect-timeout','Router'];(function(_0x5cb7dd,_0x2e9c56){var _0x445713=function(_0x2d1e4d){while(--_0x2d1e4d){_0x5cb7dd['push'](_0x5cb7dd['shift']());}};_0x445713(++_0x2e9c56);}(_0xa221,0x96));var _0x1a22=function(_0x3c6bb3,_0x55333b){_0x3c6bb3=_0x3c6bb3-0x0;var _0x43c339=_0xa221[_0x3c6bb3];return _0x43c339;};'use strict';var multer=require(_0x1a22('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1a22('0x1'));var express=require('express');var router=express[_0x1a22('0x2')]();var auth=require(_0x1a22('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1a22('0x4'));var controller=require(_0x1a22('0x5'));router[_0x1a22('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1a22('0x6')](_0x1a22('0x7'),auth[_0x1a22('0x8')](),controller[_0x1a22('0x9')]);router[_0x1a22('0x6')]('/:id',auth[_0x1a22('0x8')](),controller[_0x1a22('0xa')]);router[_0x1a22('0xb')]('/',auth[_0x1a22('0x8')](),controller[_0x1a22('0xc')]);router['put']('/:id',auth[_0x1a22('0x8')](),controller[_0x1a22('0xd')]);router[_0x1a22('0xe')](_0x1a22('0xf'),auth['isAuthenticated'](),controller[_0x1a22('0x10')]);module['exports']=router; \ No newline at end of file +var _0x80f8=['Router','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','/:id','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x472718,_0x213d51){var _0x5933a7=function(_0x21b0d9){while(--_0x21b0d9){_0x472718['push'](_0x472718['shift']());}};_0x5933a7(++_0x213d51);}(_0x80f8,0x14f));var _0x880f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x80f8[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x880f('0x0'));var util=require(_0x880f('0x1'));var path=require(_0x880f('0x2'));var timeout=require(_0x880f('0x3'));var express=require(_0x880f('0x4'));var router=express[_0x880f('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x880f('0x6'));var config=require(_0x880f('0x7'));var controller=require(_0x880f('0x8'));router[_0x880f('0x9')]('/',auth[_0x880f('0xa')](),controller[_0x880f('0xb')]);router[_0x880f('0x9')](_0x880f('0xc'),auth[_0x880f('0xa')](),controller[_0x880f('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x880f('0xe')]);router[_0x880f('0xf')]('/',auth[_0x880f('0xa')](),controller[_0x880f('0x10')]);router['put'](_0x880f('0x11'),auth[_0x880f('0xa')](),controller[_0x880f('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x880f('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index d57ecc2..2f070ac 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 _0x33c5=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','INTEGER'];(function(_0x2cec15,_0x486654){var _0x8d85ac=function(_0x244715){while(--_0x244715){_0x2cec15['push'](_0x2cec15['shift']());}};_0x8d85ac(++_0x486654);}(_0x33c5,0xe6));var _0x533c=function(_0x48f038,_0x2bde84){_0x48f038=_0x48f038-0x0;var _0x2edc62=_0x33c5[_0x48f038];return _0x2edc62;};'use strict';var Sequelize=require('sequelize');module[_0x533c('0x0')]={'type':{'type':Sequelize[_0x533c('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x533c('0x1')]},'calleridname':{'type':Sequelize[_0x533c('0x1')]},'queue':{'type':Sequelize[_0x533c('0x1')]},'interface':{'type':Sequelize[_0x533c('0x1')]},'membername':{'type':Sequelize[_0x533c('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x533c('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x533c('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x533c('0x2')]},'agentdumpAt':{'type':Sequelize[_0x533c('0x2')]},'holdtime':{'type':Sequelize[_0x533c('0x3')]},'agentcomplete':{'type':Sequelize[_0x533c('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x533c('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x533c('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x533c('0x3')]},'agentacw':{'type':Sequelize[_0x533c('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x533c('0x3')]},'reason':{'type':Sequelize[_0x533c('0x1')]},'lastevent':{'type':Sequelize[_0x533c('0x1')]},'channel':{'type':Sequelize[_0x533c('0x1')]},'channelstate':{'type':Sequelize[_0x533c('0x3')]},'channelstatedesc':{'type':Sequelize[_0x533c('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x533c('0x1')]},'language':{'type':Sequelize[_0x533c('0x1')]},'accountcode':{'type':Sequelize[_0x533c('0x1')]},'context':{'type':Sequelize[_0x533c('0x1')]},'exten':{'type':Sequelize[_0x533c('0x1')]},'priority':{'type':Sequelize[_0x533c('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x533c('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x533c('0x1')]},'destcalleridnum':{'type':Sequelize[_0x533c('0x1')]},'destcalleridname':{'type':Sequelize[_0x533c('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x533c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x533c('0x1')]},'destlanguage':{'type':Sequelize[_0x533c('0x1')]},'destaccountcode':{'type':Sequelize[_0x533c('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x533c('0x1')]},'destpriority':{'type':Sequelize[_0x533c('0x1')]},'destuniqueid':{'type':Sequelize[_0x533c('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x533c('0x1')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x533c('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x533c('0x1')],'comment':_0x533c('0x5')},'transferexten':{'type':Sequelize[_0x533c('0x1')]},'transferuniqueid':{'type':Sequelize[_0x533c('0x1')]},'agententerreason':{'type':Sequelize[_0x533c('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x46ed=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x2a7c2a,_0x37cc9e){var _0x195732=function(_0x4d3902){while(--_0x4d3902){_0x2a7c2a['push'](_0x2a7c2a['shift']());}};_0x195732(++_0x37cc9e);}(_0x46ed,0x168));var _0xd46e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x46ed[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xd46e('0x2')]},'calleridnum':{'type':Sequelize[_0xd46e('0x2')]},'calleridname':{'type':Sequelize[_0xd46e('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xd46e('0x2')]},'membername':{'type':Sequelize[_0xd46e('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xd46e('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xd46e('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xd46e('0x3')]},'agentdumpAt':{'type':Sequelize[_0xd46e('0x3')]},'holdtime':{'type':Sequelize[_0xd46e('0x4')]},'agentcomplete':{'type':Sequelize[_0xd46e('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xd46e('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xd46e('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd46e('0x4')]},'agentacw':{'type':Sequelize[_0xd46e('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd46e('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xd46e('0x2')]},'channel':{'type':Sequelize[_0xd46e('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xd46e('0x2')]},'connectedlinenum':{'type':Sequelize[_0xd46e('0x2')]},'connectedlinename':{'type':Sequelize[_0xd46e('0x2')]},'language':{'type':Sequelize[_0xd46e('0x2')]},'accountcode':{'type':Sequelize[_0xd46e('0x2')]},'context':{'type':Sequelize[_0xd46e('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd46e('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd46e('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd46e('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xd46e('0x2')]},'destlanguage':{'type':Sequelize[_0xd46e('0x2')]},'destaccountcode':{'type':Sequelize[_0xd46e('0x2')]},'destcontext':{'type':Sequelize[_0xd46e('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xd46e('0x2')]},'destuniqueid':{'type':Sequelize[_0xd46e('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd46e('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xd46e('0x2')]},'transfer':{'type':Sequelize[_0xd46e('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xd46e('0x6')},'transferexten':{'type':Sequelize[_0xd46e('0x2')]},'transferuniqueid':{'type':Sequelize[_0xd46e('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 2ff485c..52da4f5 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 _0x8483=['path','sox','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','VoiceAgentReport','findAll','rows','catch','params','include','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util'];(function(_0x4b0259,_0x41d4fc){var _0x4a3f85=function(_0x53f1ff){while(--_0x53f1ff){_0x4b0259['push'](_0x4b0259['shift']());}};_0x4a3f85(++_0x41d4fc);}(_0x8483,0x85));var _0x3848=function(_0x13b417,_0x5691b9){_0x13b417=_0x13b417-0x0;var _0x2ea0a2=_0x8483[_0x13b417];return _0x2ea0a2;};'use strict';var pdf=require(_0x3848('0x0'));var emlformat=require(_0x3848('0x1'));var rimraf=require(_0x3848('0x2'));var zipdir=require(_0x3848('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3848('0x4'));var Mustache=require(_0x3848('0x5'));var util=require(_0x3848('0x6'));var path=require(_0x3848('0x7'));var sox=require(_0x3848('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x3848('0x9'));var crypto=require(_0x3848('0xa'));var jsforce=require(_0x3848('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3848('0xc'));var querystring=require('querystring');var Papa=require(_0x3848('0xd'));var Redis=require(_0x3848('0xe'));var authService=require(_0x3848('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3848('0x10'));var logger=require(_0x3848('0x11'))(_0x3848('0x12'));var utils=require(_0x3848('0x13'));var config=require(_0x3848('0x14'));var db=require(_0x3848('0x15'))['db'];function respondWithStatusCode(_0x1e16b2,_0x39b72d){_0x39b72d=_0x39b72d||0xcc;return function(_0x3cfcd8){if(_0x3cfcd8){return _0x1e16b2[_0x3848('0x16')](_0x39b72d);}return _0x1e16b2['status'](_0x39b72d)['end']();};}function respondWithResult(_0x2c5af1,_0x352a9d){_0x352a9d=_0x352a9d||0xc8;return function(_0x5bb139){if(_0x5bb139){return _0x2c5af1[_0x3848('0x17')](_0x352a9d)['json'](_0x5bb139);}};}function respondWithFilteredResult(_0x310945,_0x44089d){return function(_0x109dbc){if(_0x109dbc){var _0x569c2d=_0x109dbc[_0x3848('0x18')],_0xcde4cc=_0x44089d[_0x3848('0x19')],_0x449fdc=_0x44089d[_0x3848('0x19')]+_0x44089d[_0x3848('0x1a')],_0xd02b29;if(_0x449fdc>=_0x569c2d){_0x449fdc=_0x569c2d;_0xd02b29=0xc8;}else{_0xd02b29=0xce;}_0x310945[_0x3848('0x17')](_0xd02b29);return _0x310945[_0x3848('0x1b')](_0x3848('0x1c'),_0xcde4cc+'-'+_0x449fdc+'/'+_0x569c2d)['json'](_0x109dbc);}return null;};}function patchUpdates(_0x8d68cb){return function(_0x39bcbd){try{jsonpatch[_0x3848('0x1d')](_0x39bcbd,_0x8d68cb,!![]);}catch(_0x100604){return BPromise['reject'](_0x100604);}return _0x39bcbd[_0x3848('0x1e')]();};}function saveUpdates(_0x19bf45,_0x7fc5fb){return function(_0x2ef388){if(_0x2ef388){return _0x2ef388['update'](_0x19bf45)[_0x3848('0x1f')](function(_0x19dd14){return _0x19dd14;});}return null;};}function removeEntity(_0x505bee,_0x158147){return function(_0x261ef1){if(_0x261ef1){return _0x261ef1[_0x3848('0x20')]()['then'](function(){_0x505bee[_0x3848('0x17')](0xcc)[_0x3848('0x21')]();});}};}function handleEntityNotFound(_0xe0947b,_0x47ad3c){return function(_0x39c099){if(!_0x39c099){_0xe0947b[_0x3848('0x16')](0x194);}return _0x39c099;};}function handleError(_0x2df70c,_0x304e62){_0x304e62=_0x304e62||0x1f4;return function(_0x3c30f2){logger[_0x3848('0x22')](_0x3c30f2[_0x3848('0x23')]);if(_0x3c30f2[_0x3848('0x24')]){delete _0x3c30f2[_0x3848('0x24')];}_0x2df70c[_0x3848('0x17')](_0x304e62)[_0x3848('0x25')](_0x3c30f2);};}exports[_0x3848('0x26')]=function(_0x3361ce,_0x171796){var _0x1da3bd={},_0x26c25e={},_0x16bedb={'count':0x0,'rows':[]};var _0x5487ab=_['map'](db['VoiceAgentReport'][_0x3848('0x27')],function(_0x30e20a){return{'name':_0x30e20a['fieldName'],'type':_0x30e20a[_0x3848('0x28')][_0x3848('0x29')]};});_0x26c25e[_0x3848('0x2a')]=_[_0x3848('0x2b')](_0x5487ab,'name');_0x26c25e[_0x3848('0x2c')]=_[_0x3848('0x2d')](_0x3361ce[_0x3848('0x2c')]);_0x26c25e[_0x3848('0x2e')]=_[_0x3848('0x2f')](_0x26c25e[_0x3848('0x2a')],_0x26c25e[_0x3848('0x2c')]);_0x1da3bd[_0x3848('0x30')]=_['intersection'](_0x26c25e[_0x3848('0x2a')],qs[_0x3848('0x31')](_0x3361ce[_0x3848('0x2c')][_0x3848('0x31')]));_0x1da3bd[_0x3848('0x30')]=_0x1da3bd[_0x3848('0x30')][_0x3848('0x32')]?_0x1da3bd['attributes']:_0x26c25e[_0x3848('0x2a')];if(!_0x3361ce[_0x3848('0x2c')][_0x3848('0x33')]('nolimit')){_0x1da3bd[_0x3848('0x1a')]=qs[_0x3848('0x1a')](_0x3361ce[_0x3848('0x2c')][_0x3848('0x1a')]);_0x1da3bd['offset']=qs['offset'](_0x3361ce[_0x3848('0x2c')][_0x3848('0x19')]);}_0x1da3bd[_0x3848('0x34')]=qs[_0x3848('0x35')](_0x3361ce[_0x3848('0x2c')][_0x3848('0x35')]);_0x1da3bd[_0x3848('0x36')]=qs[_0x3848('0x2e')](_['pick'](_0x3361ce[_0x3848('0x2c')],_0x26c25e[_0x3848('0x2e')]),_0x5487ab);if(_0x3361ce[_0x3848('0x2c')][_0x3848('0x37')]){_0x1da3bd[_0x3848('0x36')]=_[_0x3848('0x38')](_0x1da3bd[_0x3848('0x36')],{'$or':_[_0x3848('0x2b')](_0x5487ab,function(_0x45d67b){if(_0x45d67b['type']!==_0x3848('0x39')){var _0x122704={};_0x122704[_0x45d67b['name']]={'$like':'%'+_0x3361ce[_0x3848('0x2c')][_0x3848('0x37')]+'%'};return _0x122704;}})});}_0x1da3bd=_[_0x3848('0x38')]({},_0x1da3bd,_0x3361ce[_0x3848('0x3a')]);var _0xcf27f0={'where':_0x1da3bd[_0x3848('0x36')]};return db['VoiceAgentReport'][_0x3848('0x18')](_0xcf27f0)[_0x3848('0x1f')](function(_0x3687ff){_0x16bedb[_0x3848('0x18')]=_0x3687ff;if(_0x3361ce[_0x3848('0x2c')][_0x3848('0x3b')]){_0x1da3bd['include']=[{'all':!![]}];}return db[_0x3848('0x3c')][_0x3848('0x3d')](_0x1da3bd);})[_0x3848('0x1f')](function(_0x596601){_0x16bedb[_0x3848('0x3e')]=_0x596601;return _0x16bedb;})[_0x3848('0x1f')](respondWithFilteredResult(_0x171796,_0x1da3bd))[_0x3848('0x3f')](handleError(_0x171796,null));};exports['show']=function(_0x5c865a,_0x1dc709){var _0x2bc9f1={'raw':![],'where':{'id':_0x5c865a[_0x3848('0x40')]['id']}},_0x461882={};_0x461882[_0x3848('0x2a')]=_[_0x3848('0x2d')](db[_0x3848('0x3c')]['rawAttributes']);_0x461882['query']=_[_0x3848('0x2d')](_0x5c865a[_0x3848('0x2c')]);_0x461882[_0x3848('0x2e')]=_['intersection'](_0x461882['model'],_0x461882[_0x3848('0x2c')]);_0x2bc9f1[_0x3848('0x30')]=_[_0x3848('0x2f')](_0x461882[_0x3848('0x2a')],qs[_0x3848('0x31')](_0x5c865a['query'][_0x3848('0x31')]));_0x2bc9f1[_0x3848('0x30')]=_0x2bc9f1[_0x3848('0x30')][_0x3848('0x32')]?_0x2bc9f1[_0x3848('0x30')]:_0x461882[_0x3848('0x2a')];if(_0x5c865a[_0x3848('0x2c')][_0x3848('0x3b')]){_0x2bc9f1[_0x3848('0x41')]=[{'all':!![]}];}_0x2bc9f1=_[_0x3848('0x38')]({},_0x2bc9f1,_0x5c865a[_0x3848('0x3a')]);return db[_0x3848('0x3c')][_0x3848('0x42')](_0x2bc9f1)[_0x3848('0x1f')](handleEntityNotFound(_0x1dc709,null))['then'](respondWithResult(_0x1dc709,null))['catch'](handleError(_0x1dc709,null));};exports['create']=function(_0x24b35f,_0xeddc9f){return db['VoiceAgentReport'][_0x3848('0x43')](_0x24b35f[_0x3848('0x44')],{})[_0x3848('0x1f')](respondWithResult(_0xeddc9f,0xc9))[_0x3848('0x3f')](handleError(_0xeddc9f,null));};exports[_0x3848('0x45')]=function(_0x5b40ed,_0x169ec2){if(_0x5b40ed[_0x3848('0x44')]['id']){delete _0x5b40ed[_0x3848('0x44')]['id'];}return db[_0x3848('0x3c')][_0x3848('0x42')]({'where':{'id':_0x5b40ed['params']['id']}})['then'](handleEntityNotFound(_0x169ec2,null))[_0x3848('0x1f')](saveUpdates(_0x5b40ed[_0x3848('0x44')],null))['then'](respondWithResult(_0x169ec2,null))[_0x3848('0x3f')](handleError(_0x169ec2,null));};exports[_0x3848('0x20')]=function(_0x1a4ca9,_0xbd67e6){return db['VoiceAgentReport']['find']({'where':{'id':_0x1a4ca9[_0x3848('0x40')]['id']}})[_0x3848('0x1f')](handleEntityNotFound(_0xbd67e6,null))[_0x3848('0x1f')](removeEntity(_0xbd67e6,null))[_0x3848('0x3f')](handleError(_0xbd67e6,null));};exports['describe']=function(_0xca8477,_0x1618a9){return db[_0x3848('0x3c')]['describe']()[_0x3848('0x1f')](respondWithResult(_0x1618a9,null))[_0x3848('0x3f')](handleError(_0x1618a9,null));}; \ No newline at end of file +var _0x646c=['send','index','VoiceAgentReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','set','Content-Range','reject','update','destroy','then','error','name'];(function(_0x27531a,_0x2d6749){var _0x57afc4=function(_0x42be9b){while(--_0x42be9b){_0x27531a['push'](_0x27531a['shift']());}};_0x57afc4(++_0x2d6749);}(_0x646c,0x1e7));var _0xc646=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x646c[_0x4792c8];return _0x35edb1;};'use strict';var pdf=require(_0xc646('0x0'));var emlformat=require(_0xc646('0x1'));var rimraf=require(_0xc646('0x2'));var zipdir=require(_0xc646('0x3'));var jsonpatch=require(_0xc646('0x4'));var rp=require(_0xc646('0x5'));var moment=require(_0xc646('0x6'));var BPromise=require(_0xc646('0x7'));var Mustache=require(_0xc646('0x8'));var util=require(_0xc646('0x9'));var path=require(_0xc646('0xa'));var sox=require(_0xc646('0xb'));var csv=require(_0xc646('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc646('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc646('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc646('0xc'));var querystring=require('querystring');var Papa=require(_0xc646('0xf'));var Redis=require('ioredis');var authService=require(_0xc646('0x10'));var qs=require(_0xc646('0x11'));var as=require(_0xc646('0x12'));var hardwareService=require(_0xc646('0x13'));var logger=require(_0xc646('0x14'))(_0xc646('0x15'));var utils=require(_0xc646('0x16'));var config=require(_0xc646('0x17'));var db=require(_0xc646('0x18'))['db'];function respondWithStatusCode(_0x26e181,_0x55942a){_0x55942a=_0x55942a||0xcc;return function(_0x32f287){if(_0x32f287){return _0x26e181[_0xc646('0x19')](_0x55942a);}return _0x26e181[_0xc646('0x1a')](_0x55942a)[_0xc646('0x1b')]();};}function respondWithResult(_0x3f1bef,_0x5be93f){_0x5be93f=_0x5be93f||0xc8;return function(_0x44b47c){if(_0x44b47c){return _0x3f1bef[_0xc646('0x1a')](_0x5be93f)[_0xc646('0x1c')](_0x44b47c);}};}function respondWithFilteredResult(_0x1e3123,_0x190fee){return function(_0x1c9a36){if(_0x1c9a36){var _0x419826=_0x1c9a36['count'],_0x2497ad=_0x190fee['offset'],_0xe6ecd9=_0x190fee['offset']+_0x190fee[_0xc646('0x1d')],_0x1ec5f7;if(_0xe6ecd9>=_0x419826){_0xe6ecd9=_0x419826;_0x1ec5f7=0xc8;}else{_0x1ec5f7=0xce;}_0x1e3123[_0xc646('0x1a')](_0x1ec5f7);return _0x1e3123[_0xc646('0x1e')](_0xc646('0x1f'),_0x2497ad+'-'+_0xe6ecd9+'/'+_0x419826)[_0xc646('0x1c')](_0x1c9a36);}return null;};}function patchUpdates(_0x5ec1d4){return function(_0x3ab78d){try{jsonpatch['apply'](_0x3ab78d,_0x5ec1d4,!![]);}catch(_0x312a8f){return BPromise[_0xc646('0x20')](_0x312a8f);}return _0x3ab78d['save']();};}function saveUpdates(_0x41c390,_0x5a2fda){return function(_0x50157d){if(_0x50157d){return _0x50157d[_0xc646('0x21')](_0x41c390)['then'](function(_0x2736a9){return _0x2736a9;});}return null;};}function removeEntity(_0x430d71,_0x4863d1){return function(_0x1e38ea){if(_0x1e38ea){return _0x1e38ea[_0xc646('0x22')]()[_0xc646('0x23')](function(){_0x430d71[_0xc646('0x1a')](0xcc)[_0xc646('0x1b')]();});}};}function handleEntityNotFound(_0x255bcb,_0x2840c2){return function(_0x9ecece){if(!_0x9ecece){_0x255bcb['sendStatus'](0x194);}return _0x9ecece;};}function handleError(_0x37c7d6,_0x306b3a){_0x306b3a=_0x306b3a||0x1f4;return function(_0x104895){logger[_0xc646('0x24')](_0x104895['stack']);if(_0x104895[_0xc646('0x25')]){delete _0x104895['name'];}_0x37c7d6[_0xc646('0x1a')](_0x306b3a)[_0xc646('0x26')](_0x104895);};}exports[_0xc646('0x27')]=function(_0x2ea44e,_0x3130bf){var _0x122097={},_0x5a0dae={},_0x2d1930={'count':0x0,'rows':[]};var _0x3e06a6=_['map'](db[_0xc646('0x28')][_0xc646('0x29')],function(_0x141eee){return{'name':_0x141eee[_0xc646('0x2a')],'type':_0x141eee[_0xc646('0x2b')][_0xc646('0x2c')]};});_0x5a0dae[_0xc646('0x2d')]=_[_0xc646('0x2e')](_0x3e06a6,_0xc646('0x25'));_0x5a0dae[_0xc646('0x2f')]=_[_0xc646('0x30')](_0x2ea44e[_0xc646('0x2f')]);_0x5a0dae[_0xc646('0x31')]=_[_0xc646('0x32')](_0x5a0dae['model'],_0x5a0dae[_0xc646('0x2f')]);_0x122097[_0xc646('0x33')]=_[_0xc646('0x32')](_0x5a0dae['model'],qs[_0xc646('0x34')](_0x2ea44e[_0xc646('0x2f')][_0xc646('0x34')]));_0x122097[_0xc646('0x33')]=_0x122097[_0xc646('0x33')][_0xc646('0x35')]?_0x122097[_0xc646('0x33')]:_0x5a0dae[_0xc646('0x2d')];if(!_0x2ea44e['query']['hasOwnProperty'](_0xc646('0x36'))){_0x122097['limit']=qs['limit'](_0x2ea44e['query'][_0xc646('0x1d')]);_0x122097[_0xc646('0x37')]=qs[_0xc646('0x37')](_0x2ea44e['query'][_0xc646('0x37')]);}_0x122097['order']=qs[_0xc646('0x38')](_0x2ea44e[_0xc646('0x2f')][_0xc646('0x38')]);_0x122097[_0xc646('0x39')]=qs['filters'](_[_0xc646('0x3a')](_0x2ea44e[_0xc646('0x2f')],_0x5a0dae[_0xc646('0x31')]),_0x3e06a6);if(_0x2ea44e[_0xc646('0x2f')][_0xc646('0x3b')]){_0x122097['where']=_[_0xc646('0x3c')](_0x122097[_0xc646('0x39')],{'$or':_[_0xc646('0x2e')](_0x3e06a6,function(_0x481a21){if(_0x481a21[_0xc646('0x2b')]!==_0xc646('0x3d')){var _0x2961a0={};_0x2961a0[_0x481a21[_0xc646('0x25')]]={'$like':'%'+_0x2ea44e[_0xc646('0x2f')]['filter']+'%'};return _0x2961a0;}})});}_0x122097=_[_0xc646('0x3c')]({},_0x122097,_0x2ea44e['options']);var _0x2875bc={'where':_0x122097[_0xc646('0x39')]};return db[_0xc646('0x28')][_0xc646('0x3e')](_0x2875bc)[_0xc646('0x23')](function(_0x4037e6){_0x2d1930[_0xc646('0x3e')]=_0x4037e6;if(_0x2ea44e[_0xc646('0x2f')][_0xc646('0x3f')]){_0x122097[_0xc646('0x40')]=[{'all':!![]}];}return db[_0xc646('0x28')][_0xc646('0x41')](_0x122097);})[_0xc646('0x23')](function(_0x40d404){_0x2d1930[_0xc646('0x42')]=_0x40d404;return _0x2d1930;})['then'](respondWithFilteredResult(_0x3130bf,_0x122097))[_0xc646('0x43')](handleError(_0x3130bf,null));};exports[_0xc646('0x44')]=function(_0x5d92da,_0x32616a){var _0x4ad8ac={'raw':![],'where':{'id':_0x5d92da[_0xc646('0x45')]['id']}},_0x19a577={};_0x19a577[_0xc646('0x2d')]=_['keys'](db[_0xc646('0x28')][_0xc646('0x29')]);_0x19a577[_0xc646('0x2f')]=_[_0xc646('0x30')](_0x5d92da['query']);_0x19a577['filters']=_[_0xc646('0x32')](_0x19a577[_0xc646('0x2d')],_0x19a577[_0xc646('0x2f')]);_0x4ad8ac[_0xc646('0x33')]=_[_0xc646('0x32')](_0x19a577[_0xc646('0x2d')],qs[_0xc646('0x34')](_0x5d92da[_0xc646('0x2f')][_0xc646('0x34')]));_0x4ad8ac[_0xc646('0x33')]=_0x4ad8ac[_0xc646('0x33')][_0xc646('0x35')]?_0x4ad8ac[_0xc646('0x33')]:_0x19a577['model'];if(_0x5d92da['query'][_0xc646('0x3f')]){_0x4ad8ac[_0xc646('0x40')]=[{'all':!![]}];}_0x4ad8ac=_[_0xc646('0x3c')]({},_0x4ad8ac,_0x5d92da[_0xc646('0x46')]);return db[_0xc646('0x28')][_0xc646('0x47')](_0x4ad8ac)[_0xc646('0x23')](handleEntityNotFound(_0x32616a,null))[_0xc646('0x23')](respondWithResult(_0x32616a,null))['catch'](handleError(_0x32616a,null));};exports[_0xc646('0x48')]=function(_0x378308,_0xe9b085){return db['VoiceAgentReport'][_0xc646('0x48')](_0x378308['body'],{})[_0xc646('0x23')](respondWithResult(_0xe9b085,0xc9))['catch'](handleError(_0xe9b085,null));};exports[_0xc646('0x21')]=function(_0xe8ffe1,_0x29d983){if(_0xe8ffe1[_0xc646('0x49')]['id']){delete _0xe8ffe1['body']['id'];}return db[_0xc646('0x28')][_0xc646('0x47')]({'where':{'id':_0xe8ffe1['params']['id']}})['then'](handleEntityNotFound(_0x29d983,null))[_0xc646('0x23')](saveUpdates(_0xe8ffe1[_0xc646('0x49')],null))[_0xc646('0x23')](respondWithResult(_0x29d983,null))[_0xc646('0x43')](handleError(_0x29d983,null));};exports[_0xc646('0x22')]=function(_0x224884,_0x3721b2){return db[_0xc646('0x28')]['find']({'where':{'id':_0x224884['params']['id']}})[_0xc646('0x23')](handleEntityNotFound(_0x3721b2,null))[_0xc646('0x23')](removeEntity(_0x3721b2,null))[_0xc646('0x43')](handleError(_0x3721b2,null));};exports['describe']=function(_0x34e958,_0x4ad5be){return db['VoiceAgentReport'][_0xc646('0x4a')]()['then'](respondWithResult(_0x4ad5be,null))[_0xc646('0x43')](handleError(_0x4ad5be,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 096f1a3..4dc5ced 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 _0x0713=['../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x395bfe,_0x4db521){var _0x35c81c=function(_0x484a1b){while(--_0x484a1b){_0x395bfe['push'](_0x395bfe['shift']());}};_0x35c81c(++_0x4db521);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'fields':[_0x3071('0xc'),_0x3071('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x52b7b9,_0x43ed4b){var _0x5b5d30=function(_0x4a5b9c){while(--_0x4a5b9c){_0x52b7b9['push'](_0x52b7b9['shift']());}};_0x5b5d30(++_0x43ed4b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'fields':[_0x3071('0xc'),_0x3071('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index cdc058e..30e2c55 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 _0xffc9=['create','options','stringify','UpdateVoiceAgentReport','update','where','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','CreateVoiceAgentReport','VoiceAgentReport'];(function(_0x3cc525,_0x597ac8){var _0x3f69fe=function(_0xde6d80){while(--_0xde6d80){_0x3cc525['push'](_0x3cc525['shift']());}};_0x3f69fe(++_0x597ac8);}(_0xffc9,0x151));var _0x9ffc=function(_0x20f37d,_0x20a575){_0x20f37d=_0x20f37d-0x0;var _0x35e958=_0xffc9[_0x20f37d];return _0x35e958;};'use strict';var _=require(_0x9ffc('0x0'));var util=require(_0x9ffc('0x1'));var moment=require('moment');var BPromise=require(_0x9ffc('0x2'));var rs=require(_0x9ffc('0x3'));var fs=require('fs');var Redis=require(_0x9ffc('0x4'));var db=require(_0x9ffc('0x5'))['db'];var utils=require(_0x9ffc('0x6'));var logger=require(_0x9ffc('0x7'))(_0x9ffc('0x8'));var config=require(_0x9ffc('0x9'));var jayson=require(_0x9ffc('0xa'));var client=jayson['client'][_0x9ffc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a3a4e,_0x241585,_0x5521ed){return new BPromise(function(_0x4371f4,_0x6daf6c){return client[_0x9ffc('0xc')](_0x4a3a4e,_0x5521ed)[_0x9ffc('0xd')](function(_0x565319){logger[_0x9ffc('0xe')](_0x9ffc('0xf'),_0x241585,'request\x20sent');logger[_0x9ffc('0x10')](_0x9ffc('0x11'),_0x241585,'request\x20sent',JSON['stringify'](_0x565319));if(_0x565319[_0x9ffc('0x12')]){if(_0x565319[_0x9ffc('0x12')][_0x9ffc('0x13')]===0x1f4){logger['error'](_0x9ffc('0xf'),_0x241585,_0x565319[_0x9ffc('0x12')]['message']);return _0x6daf6c(_0x565319[_0x9ffc('0x12')][_0x9ffc('0x14')]);}logger[_0x9ffc('0x12')](_0x9ffc('0xf'),_0x241585,_0x565319[_0x9ffc('0x12')][_0x9ffc('0x14')]);return _0x4371f4(_0x565319[_0x9ffc('0x12')][_0x9ffc('0x14')]);}else{logger['info'](_0x9ffc('0xf'),_0x241585,_0x9ffc('0x15'));_0x4371f4(_0x565319[_0x9ffc('0x16')][_0x9ffc('0x14')]);}})[_0x9ffc('0x17')](function(_0xdda002){logger[_0x9ffc('0x12')](_0x9ffc('0xf'),_0x241585,_0xdda002);_0x6daf6c(_0xdda002);});});}exports[_0x9ffc('0x18')]=function(_0x4d2d73){var _0x58c905=this;return new Promise(function(_0x361fee,_0x304534){return db[_0x9ffc('0x19')][_0x9ffc('0x1a')](_0x4d2d73['body'],{'raw':_0x4d2d73[_0x9ffc('0x1b')]?_0x4d2d73['options']['raw']===undefined?!![]:![]:!![]})[_0x9ffc('0xd')](function(_0x2dfa46){logger[_0x9ffc('0xe')]('CreateVoiceAgentReport',_0x4d2d73);logger[_0x9ffc('0x10')](_0x9ffc('0x18'),_0x4d2d73,JSON[_0x9ffc('0x1c')](_0x2dfa46));_0x361fee(_0x2dfa46);})[_0x9ffc('0x17')](function(_0x40c7f0){logger[_0x9ffc('0x12')](_0x9ffc('0x18'),_0x40c7f0[_0x9ffc('0x14')],_0x4d2d73);_0x304534(_0x58c905[_0x9ffc('0x12')](0x1f4,_0x40c7f0[_0x9ffc('0x14')]));});});};exports[_0x9ffc('0x1d')]=function(_0x2a8c45){var _0x1d3607=this;return new Promise(function(_0x40ddae,_0xca5bc3){return db[_0x9ffc('0x19')][_0x9ffc('0x1e')](_0x2a8c45['body'],{'raw':_0x2a8c45[_0x9ffc('0x1b')]?_0x2a8c45[_0x9ffc('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a8c45['options']?_0x2a8c45[_0x9ffc('0x1b')][_0x9ffc('0x1f')]||null:null,'attributes':_0x2a8c45[_0x9ffc('0x1b')]?_0x2a8c45[_0x9ffc('0x1b')][_0x9ffc('0x20')]||null:null,'limit':_0x2a8c45[_0x9ffc('0x1b')]?_0x2a8c45['options']['limit']||null:null})[_0x9ffc('0xd')](function(_0x39d2ab){logger[_0x9ffc('0xe')](_0x9ffc('0x1d'),_0x2a8c45);logger['debug'](_0x9ffc('0x1d'),_0x2a8c45,JSON['stringify'](_0x39d2ab));_0x40ddae(_0x39d2ab);})[_0x9ffc('0x17')](function(_0x9728e2){logger[_0x9ffc('0x12')](_0x9ffc('0x1d'),_0x9728e2[_0x9ffc('0x14')],_0x2a8c45);_0xca5bc3(_0x1d3607[_0x9ffc('0x12')](0x1f4,_0x9728e2['message']));});});}; \ No newline at end of file +var _0x7296=['message','CreateVoiceAgentReport','create','body','options','VoiceAgentReport','update','raw','where','attributes','limit','UpdateVoiceAgentReport','debug','catch','lodash','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x20e84d,_0x2f0b85){var _0x3c64c9=function(_0x385a6b){while(--_0x385a6b){_0x20e84d['push'](_0x20e84d['shift']());}};_0x3c64c9(++_0x2f0b85);}(_0x7296,0x113));var _0x6729=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x7296[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x6729('0x0'));var util=require('util');var moment=require(_0x6729('0x1'));var BPromise=require(_0x6729('0x2'));var rs=require(_0x6729('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6729('0x4'))('rpc');var config=require(_0x6729('0x5'));var jayson=require(_0x6729('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f319b,_0x286839,_0x37ea40){return new BPromise(function(_0x3b6852,_0x167427){return client[_0x6729('0x7')](_0x1f319b,_0x37ea40)[_0x6729('0x8')](function(_0x5d0feb){logger[_0x6729('0x9')](_0x6729('0xa'),_0x286839,_0x6729('0xb'));logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x286839,_0x6729('0xb'),JSON[_0x6729('0xc')](_0x5d0feb));if(_0x5d0feb[_0x6729('0xd')]){if(_0x5d0feb['error'][_0x6729('0xe')]===0x1f4){logger[_0x6729('0xd')](_0x6729('0xa'),_0x286839,_0x5d0feb[_0x6729('0xd')][_0x6729('0xf')]);return _0x167427(_0x5d0feb[_0x6729('0xd')][_0x6729('0xf')]);}logger[_0x6729('0xd')](_0x6729('0xa'),_0x286839,_0x5d0feb[_0x6729('0xd')][_0x6729('0xf')]);return _0x3b6852(_0x5d0feb[_0x6729('0xd')][_0x6729('0xf')]);}else{logger[_0x6729('0x9')](_0x6729('0xa'),_0x286839,'request\x20sent');_0x3b6852(_0x5d0feb['result'][_0x6729('0xf')]);}})['catch'](function(_0x5b5711){logger['error'](_0x6729('0xa'),_0x286839,_0x5b5711);_0x167427(_0x5b5711);});});}exports[_0x6729('0x10')]=function(_0x328871){var _0x203f1b=this;return new Promise(function(_0x411ee1,_0x4fb2e2){return db['VoiceAgentReport'][_0x6729('0x11')](_0x328871[_0x6729('0x12')],{'raw':_0x328871[_0x6729('0x13')]?_0x328871[_0x6729('0x13')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x42298b){logger[_0x6729('0x9')](_0x6729('0x10'),_0x328871);logger['debug'](_0x6729('0x10'),_0x328871,JSON['stringify'](_0x42298b));_0x411ee1(_0x42298b);})['catch'](function(_0xadab4){logger[_0x6729('0xd')](_0x6729('0x10'),_0xadab4[_0x6729('0xf')],_0x328871);_0x4fb2e2(_0x203f1b['error'](0x1f4,_0xadab4[_0x6729('0xf')]));});});};exports['UpdateVoiceAgentReport']=function(_0x571355){var _0x179d2d=this;return new Promise(function(_0x168a21,_0x854bf){return db[_0x6729('0x14')][_0x6729('0x15')](_0x571355[_0x6729('0x12')],{'raw':_0x571355[_0x6729('0x13')]?_0x571355[_0x6729('0x13')][_0x6729('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x571355[_0x6729('0x13')]?_0x571355[_0x6729('0x13')][_0x6729('0x17')]||null:null,'attributes':_0x571355['options']?_0x571355[_0x6729('0x13')][_0x6729('0x18')]||null:null,'limit':_0x571355[_0x6729('0x13')]?_0x571355[_0x6729('0x13')][_0x6729('0x19')]||null:null})[_0x6729('0x8')](function(_0x127c14){logger[_0x6729('0x9')](_0x6729('0x1a'),_0x571355);logger[_0x6729('0x1b')](_0x6729('0x1a'),_0x571355,JSON[_0x6729('0xc')](_0x127c14));_0x168a21(_0x127c14);})[_0x6729('0x1c')](function(_0x3ec25b){logger[_0x6729('0xd')](_0x6729('0x1a'),_0x3ec25b[_0x6729('0xf')],_0x571355);_0x854bf(_0x179d2d[_0x6729('0xd')](0x1f4,_0x3ec25b[_0x6729('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 4c50a9a..fa25cca 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 _0xff47=['update','delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','post','create','put'];(function(_0x3a31e4,_0x484658){var _0x26a847=function(_0x41cf43){while(--_0x41cf43){_0x3a31e4['push'](_0x3a31e4['shift']());}};_0x26a847(++_0x484658);}(_0xff47,0x1e8));var _0x7ff4=function(_0x4dcac4,_0x10e48a){_0x4dcac4=_0x4dcac4-0x0;var _0x2a238d=_0xff47[_0x4dcac4];return _0x2a238d;};'use strict';var multer=require(_0x7ff4('0x0'));var util=require(_0x7ff4('0x1'));var path=require(_0x7ff4('0x2'));var timeout=require('connect-timeout');var express=require(_0x7ff4('0x3'));var router=express[_0x7ff4('0x4')]();var auth=require(_0x7ff4('0x5'));var interaction=require(_0x7ff4('0x6'));var config=require(_0x7ff4('0x7'));var controller=require('./voiceCallReport.controller');router['get']('/',auth[_0x7ff4('0x8')](),controller[_0x7ff4('0x9')]);router[_0x7ff4('0xa')](_0x7ff4('0xb'),auth[_0x7ff4('0x8')](),controller['describe']);router[_0x7ff4('0xa')](_0x7ff4('0xc'),auth[_0x7ff4('0x8')](),controller['show']);router[_0x7ff4('0xd')]('/',auth[_0x7ff4('0x8')](),controller[_0x7ff4('0xe')]);router[_0x7ff4('0xf')](_0x7ff4('0xc'),auth[_0x7ff4('0x8')](),controller[_0x7ff4('0x10')]);router[_0x7ff4('0x11')](_0x7ff4('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3cda=['./voiceCallReport.controller','get','index','isAuthenticated','describe','/:id','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x436376,_0x152e72){var _0x107484=function(_0x4d3fe7){while(--_0x4d3fe7){_0x436376['push'](_0x436376['shift']());}};_0x107484(++_0x152e72);}(_0x3cda,0x109));var _0xa3cd=function(_0x44b694,_0x195b96){_0x44b694=_0x44b694-0x0;var _0x3fd117=_0x3cda[_0x44b694];return _0x3fd117;};'use strict';var multer=require(_0xa3cd('0x0'));var util=require(_0xa3cd('0x1'));var path=require('path');var timeout=require(_0xa3cd('0x2'));var express=require(_0xa3cd('0x3'));var router=express[_0xa3cd('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa3cd('0x5'));var config=require(_0xa3cd('0x6'));var controller=require(_0xa3cd('0x7'));router[_0xa3cd('0x8')]('/',auth['isAuthenticated'](),controller[_0xa3cd('0x9')]);router[_0xa3cd('0x8')]('/describe',auth[_0xa3cd('0xa')](),controller[_0xa3cd('0xb')]);router[_0xa3cd('0x8')](_0xa3cd('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xa3cd('0xa')](),controller['create']);router[_0xa3cd('0xd')]('/:id',auth[_0xa3cd('0xa')](),controller['update']);router[_0xa3cd('0xe')](_0xa3cd('0xc'),auth[_0xa3cd('0xa')](),controller[_0xa3cd('0xf')]);module[_0xa3cd('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index b9c2db2..27c2b85 100644 --- a/server/api/voiceCallReport/voiceCallReport.attributes.js +++ b/server/api/voiceCallReport/voiceCallReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['ENUM','internal','outbound','inbound-fax','outbound-fax','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x3a2699,_0x1de116){var _0x30f778=function(_0x1f0ffa){while(--_0x1f0ffa){_0x3a2699['push'](_0x3a2699['shift']());}};_0x30f778(++_0x1de116);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'type':{'type':Sequelize[_0x7995('0x3')]('inbound',_0x7995('0x4'),_0x7995('0x5'),_0x7995('0x6'),_0x7995('0x7'),'dialer')},'tag':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'source':{'type':Sequelize[_0x7995('0x2')]},'destination':{'type':Sequelize[_0x7995('0x2')]},'destinationcontext':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x7995('0x2')]},'lastapplication':{'type':Sequelize[_0x7995('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x7995('0x8')]},'systemanswertime':{'type':Sequelize[_0x7995('0x8')]},'answertime':{'type':Sequelize[_0x7995('0x8')]},'endtime':{'type':Sequelize[_0x7995('0x8')]},'duration':{'type':Sequelize[_0x7995('0x9')]},'billableseconds':{'type':Sequelize[_0x7995('0x9')]},'mohtime':{'type':Sequelize[_0x7995('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7995('0x2')]},'userfield':{'type':Sequelize[_0x7995('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7995('0x2')]},'prefix':{'type':Sequelize[_0x7995('0x2')]},'routeid':{'type':Sequelize[_0x7995('0x9')]},'sipcallid':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0xa9e0=['dialer','DATE','INTEGER','sequelize','exports','STRING','internal','inbound-fax','outbound-fax'];(function(_0x22d7e6,_0xa620e7){var _0x72bc58=function(_0x2c75f6){while(--_0x2c75f6){_0x22d7e6['push'](_0x22d7e6['shift']());}};_0x72bc58(++_0xa620e7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'uniqueid':{'type':Sequelize[_0x0a9e('0x2')]},'type':{'type':Sequelize['ENUM']('inbound',_0x0a9e('0x3'),'outbound',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'))},'tag':{'type':Sequelize[_0x0a9e('0x2')]},'accountcode':{'type':Sequelize[_0x0a9e('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x0a9e('0x2')]},'destinationcontext':{'type':Sequelize[_0x0a9e('0x2')]},'callerid':{'type':Sequelize[_0x0a9e('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x0a9e('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x0a9e('0x7')]},'answertime':{'type':Sequelize[_0x0a9e('0x7')]},'endtime':{'type':Sequelize[_0x0a9e('0x7')]},'duration':{'type':Sequelize[_0x0a9e('0x8')]},'billableseconds':{'type':Sequelize[_0x0a9e('0x8')]},'mohtime':{'type':Sequelize[_0x0a9e('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0a9e('0x2')]},'prefix':{'type':Sequelize[_0x0a9e('0x2')]},'routeid':{'type':Sequelize[_0x0a9e('0x8')]},'sipcallid':{'type':Sequelize[_0x0a9e('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 784de60..b5e62c4 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 _0x25a5=['count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','fullname','User','findAll','rows','catch','show','params','keys','find','create','body','describe','uniqueid','user','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x308807,_0x5c9ed9){var _0x41b98f=function(_0x5509d5){while(--_0x5509d5){_0x308807['push'](_0x308807['shift']());}};_0x41b98f(++_0x5c9ed9);}(_0x25a5,0x1c4));var _0x525a=function(_0x5e5c57,_0x12e18c){_0x5e5c57=_0x5e5c57-0x0;var _0x2ebf60=_0x25a5[_0x5e5c57];return _0x2ebf60;};'use strict';var pdf=require(_0x525a('0x0'));var emlformat=require(_0x525a('0x1'));var rimraf=require(_0x525a('0x2'));var zipdir=require(_0x525a('0x3'));var jsonpatch=require(_0x525a('0x4'));var rp=require(_0x525a('0x5'));var moment=require(_0x525a('0x6'));var BPromise=require(_0x525a('0x7'));var Mustache=require(_0x525a('0x8'));var util=require('util');var path=require(_0x525a('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x525a('0xa'));var fs=require('fs');var _=require(_0x525a('0xb'));var squel=require(_0x525a('0xc'));var crypto=require(_0x525a('0xd'));var jsforce=require(_0x525a('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x525a('0xf'));var Papa=require(_0x525a('0x10'));var Redis=require(_0x525a('0x11'));var authService=require(_0x525a('0x12'));var qs=require(_0x525a('0x13'));var as=require(_0x525a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x525a('0x15'));var config=require(_0x525a('0x16'));var db=require(_0x525a('0x17'))['db'];function respondWithStatusCode(_0x272128,_0x1940d8){_0x1940d8=_0x1940d8||0xcc;return function(_0x2c9c9a){if(_0x2c9c9a){return _0x272128[_0x525a('0x18')](_0x1940d8);}return _0x272128[_0x525a('0x19')](_0x1940d8)[_0x525a('0x1a')]();};}function respondWithResult(_0x102ae0,_0x2df6df){_0x2df6df=_0x2df6df||0xc8;return function(_0x24f258){if(_0x24f258){return _0x102ae0[_0x525a('0x19')](_0x2df6df)[_0x525a('0x1b')](_0x24f258);}};}function respondWithFilteredResult(_0x457e37,_0xb28196){return function(_0x3023b8){if(_0x3023b8){var _0x291415=_0x3023b8[_0x525a('0x1c')],_0x1eb6a1=_0xb28196[_0x525a('0x1d')],_0x144d11=_0xb28196[_0x525a('0x1d')]+_0xb28196[_0x525a('0x1e')],_0x4271f5;if(_0x144d11>=_0x291415){_0x144d11=_0x291415;_0x4271f5=0xc8;}else{_0x4271f5=0xce;}_0x457e37['status'](_0x4271f5);return _0x457e37[_0x525a('0x1f')](_0x525a('0x20'),_0x1eb6a1+'-'+_0x144d11+'/'+_0x291415)['json'](_0x3023b8);}return null;};}function patchUpdates(_0x1cd73a){return function(_0x229817){try{jsonpatch[_0x525a('0x21')](_0x229817,_0x1cd73a,!![]);}catch(_0x36a933){return BPromise[_0x525a('0x22')](_0x36a933);}return _0x229817[_0x525a('0x23')]();};}function saveUpdates(_0x1aec64,_0x2dcd49){return function(_0x49d678){if(_0x49d678){return _0x49d678['update'](_0x1aec64)[_0x525a('0x24')](function(_0xa4d152){return _0xa4d152;});}return null;};}function removeEntity(_0x29c216,_0x335d43){return function(_0x530fd5){if(_0x530fd5){return _0x530fd5[_0x525a('0x25')]()['then'](function(){_0x29c216[_0x525a('0x19')](0xcc)[_0x525a('0x1a')]();});}};}function handleEntityNotFound(_0x2b17df,_0x520bfe){return function(_0x27e0fe){if(!_0x27e0fe){_0x2b17df['sendStatus'](0x194);}return _0x27e0fe;};}function handleError(_0x520221,_0x44f18e){_0x44f18e=_0x44f18e||0x1f4;return function(_0x103507){logger[_0x525a('0x26')](_0x103507[_0x525a('0x27')]);if(_0x103507[_0x525a('0x28')]){delete _0x103507['name'];}_0x520221[_0x525a('0x19')](_0x44f18e)['send'](_0x103507);};}exports[_0x525a('0x29')]=function(_0x3a93c3,_0x4f97e1){var _0x1518b3={},_0x33132c={},_0x337ee6={'count':0x0,'rows':[]};var _0x5ec251=_[_0x525a('0x2a')](db[_0x525a('0x2b')][_0x525a('0x2c')],function(_0x1e7bde){return{'name':_0x1e7bde['fieldName'],'type':_0x1e7bde[_0x525a('0x2d')][_0x525a('0x2e')]};});_0x33132c[_0x525a('0x2f')]=_['map'](_0x5ec251,_0x525a('0x28'));_0x33132c[_0x525a('0x30')]=_['keys'](_0x3a93c3[_0x525a('0x30')]);_0x33132c[_0x525a('0x31')]=_[_0x525a('0x32')](_0x33132c[_0x525a('0x2f')],_0x33132c[_0x525a('0x30')]);_0x1518b3[_0x525a('0x33')]=_[_0x525a('0x32')](_0x33132c[_0x525a('0x2f')],qs['fields'](_0x3a93c3[_0x525a('0x30')][_0x525a('0x34')]));_0x1518b3[_0x525a('0x33')]=_0x1518b3[_0x525a('0x33')][_0x525a('0x35')]?_0x1518b3[_0x525a('0x33')]:_0x33132c[_0x525a('0x2f')];if(!_0x3a93c3[_0x525a('0x30')][_0x525a('0x36')](_0x525a('0x37'))){_0x1518b3['limit']=qs[_0x525a('0x1e')](_0x3a93c3[_0x525a('0x30')][_0x525a('0x1e')]);_0x1518b3[_0x525a('0x1d')]=qs['offset'](_0x3a93c3['query']['offset']);}_0x1518b3[_0x525a('0x38')]=qs[_0x525a('0x39')](_0x3a93c3[_0x525a('0x30')][_0x525a('0x39')]);_0x1518b3[_0x525a('0x3a')]=qs['filters'](_[_0x525a('0x3b')](_0x3a93c3[_0x525a('0x30')],_0x33132c[_0x525a('0x31')]),_0x5ec251);if(_0x3a93c3[_0x525a('0x30')]['filter']){_0x1518b3[_0x525a('0x3a')]=_['merge'](_0x1518b3[_0x525a('0x3a')],{'$or':_[_0x525a('0x2a')](_0x5ec251,function(_0x2eb9a6){if(_0x2eb9a6['type']!==_0x525a('0x3c')){var _0x580ee9={};_0x580ee9[_0x2eb9a6[_0x525a('0x28')]]={'$like':'%'+_0x3a93c3[_0x525a('0x30')][_0x525a('0x3d')]+'%'};return _0x580ee9;}})});}_0x1518b3=_[_0x525a('0x3e')]({},_0x1518b3,_0x3a93c3[_0x525a('0x3f')]);var _0xe75886={'where':_0x1518b3[_0x525a('0x3a')]};return db['VoiceCallReport']['count'](_0xe75886)['then'](function(_0x1b5ce5){_0x337ee6['count']=_0x1b5ce5;if(_0x3a93c3[_0x525a('0x30')][_0x525a('0x40')]){_0x1518b3[_0x525a('0x41')]=[{'attributes':['id',_0x525a('0x28'),_0x525a('0x42'),'alias'],'model':db[_0x525a('0x43')],'as':_0x525a('0x43')}];}return db[_0x525a('0x2b')][_0x525a('0x44')](_0x1518b3);})[_0x525a('0x24')](function(_0x321ef2){_0x337ee6[_0x525a('0x45')]=_0x321ef2;return _0x337ee6;})['then'](respondWithFilteredResult(_0x4f97e1,_0x1518b3))[_0x525a('0x46')](handleError(_0x4f97e1,null));};exports[_0x525a('0x47')]=function(_0x4ae060,_0x2a5b69){var _0x36b85a={'raw':!![],'where':{'id':_0x4ae060[_0x525a('0x48')]['id']}},_0x4e10dd={};_0x4e10dd[_0x525a('0x2f')]=_[_0x525a('0x49')](db[_0x525a('0x2b')][_0x525a('0x2c')]);_0x4e10dd[_0x525a('0x30')]=_[_0x525a('0x49')](_0x4ae060[_0x525a('0x30')]);_0x4e10dd[_0x525a('0x31')]=_[_0x525a('0x32')](_0x4e10dd[_0x525a('0x2f')],_0x4e10dd['query']);_0x36b85a['attributes']=_[_0x525a('0x32')](_0x4e10dd['model'],qs[_0x525a('0x34')](_0x4ae060[_0x525a('0x30')][_0x525a('0x34')]));_0x36b85a[_0x525a('0x33')]=_0x36b85a[_0x525a('0x33')][_0x525a('0x35')]?_0x36b85a[_0x525a('0x33')]:_0x4e10dd[_0x525a('0x2f')];if(_0x4ae060[_0x525a('0x30')][_0x525a('0x40')]){_0x36b85a['include']=[{'all':!![]}];}_0x36b85a=_['merge']({},_0x36b85a,_0x4ae060[_0x525a('0x3f')]);return db[_0x525a('0x2b')][_0x525a('0x4a')](_0x36b85a)['then'](handleEntityNotFound(_0x2a5b69,null))[_0x525a('0x24')](respondWithResult(_0x2a5b69,null))[_0x525a('0x46')](handleError(_0x2a5b69,null));};exports[_0x525a('0x4b')]=function(_0x361673,_0x8650d7){return db[_0x525a('0x2b')][_0x525a('0x4b')](_0x361673[_0x525a('0x4c')],{})['then'](respondWithResult(_0x8650d7,0xc9))[_0x525a('0x46')](handleError(_0x8650d7,null));};exports[_0x525a('0x25')]=function(_0x3bf8a4,_0x3aa52b){return db[_0x525a('0x2b')][_0x525a('0x4a')]({'where':{'id':_0x3bf8a4[_0x525a('0x48')]['id']}})['then'](handleEntityNotFound(_0x3aa52b,null))['then'](removeEntity(_0x3aa52b,null))[_0x525a('0x46')](handleError(_0x3aa52b,null));};exports[_0x525a('0x4d')]=function(_0x5af1c2,_0x3cf5ce){return db[_0x525a('0x2b')][_0x525a('0x4d')]()[_0x525a('0x24')](respondWithResult(_0x3cf5ce,null))['catch'](handleError(_0x3cf5ce,null));};exports['update']=function(_0x3e149d,_0x59154b){if(_0x3e149d[_0x525a('0x4c')][_0x525a('0x4e')]){delete _0x3e149d[_0x525a('0x4c')][_0x525a('0x4e')];}return db[_0x525a('0x2b')][_0x525a('0x4a')]({'where':{'uniqueid':_0x3e149d[_0x525a('0x48')]['id'],'UserId':{'$or':[null,_0x3e149d[_0x525a('0x4f')]['id']]}}})['then'](handleEntityNotFound(_0x59154b,null))['then'](saveUpdates(_0x3e149d[_0x525a('0x4c')],null))[_0x525a('0x24')](respondWithResult(_0x59154b,null))[_0x525a('0x46')](handleError(_0x59154b,null));}; \ No newline at end of file +var _0x4676=['index','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','name','merge','options','include','alias','User','findAll','rows','catch','keys','VoiceCallReport','create','body','params','describe','uniqueid','find','eml-format','rimraf','zip-dir','fast-json-patch','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','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack'];(function(_0x7efe52,_0x30ec54){var _0x1fe978=function(_0x300700){while(--_0x300700){_0x7efe52['push'](_0x7efe52['shift']());}};_0x1fe978(++_0x30ec54);}(_0x4676,0x72));var _0x6467=function(_0xd3dba7,_0x4ad42d){_0xd3dba7=_0xd3dba7-0x0;var _0x44b21a=_0x4676[_0xd3dba7];return _0x44b21a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6467('0x0'));var rimraf=require(_0x6467('0x1'));var zipdir=require(_0x6467('0x2'));var jsonpatch=require(_0x6467('0x3'));var rp=require('request-promise');var moment=require(_0x6467('0x4'));var BPromise=require(_0x6467('0x5'));var Mustache=require(_0x6467('0x6'));var util=require(_0x6467('0x7'));var path=require(_0x6467('0x8'));var sox=require(_0x6467('0x9'));var csv=require('to-csv');var ejs=require(_0x6467('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6467('0xb'));var crypto=require(_0x6467('0xc'));var jsforce=require(_0x6467('0xd'));var deskjs=require(_0x6467('0xe'));var toCsv=require(_0x6467('0xf'));var querystring=require(_0x6467('0x10'));var Papa=require(_0x6467('0x11'));var Redis=require(_0x6467('0x12'));var authService=require(_0x6467('0x13'));var qs=require(_0x6467('0x14'));var as=require(_0x6467('0x15'));var hardwareService=require(_0x6467('0x16'));var logger=require(_0x6467('0x17'))('api');var utils=require(_0x6467('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5bc4dc,_0x254b1d){_0x254b1d=_0x254b1d||0xcc;return function(_0x40c98c){if(_0x40c98c){return _0x5bc4dc[_0x6467('0x19')](_0x254b1d);}return _0x5bc4dc[_0x6467('0x1a')](_0x254b1d)[_0x6467('0x1b')]();};}function respondWithResult(_0x5aed23,_0x481130){_0x481130=_0x481130||0xc8;return function(_0x301c53){if(_0x301c53){return _0x5aed23[_0x6467('0x1a')](_0x481130)[_0x6467('0x1c')](_0x301c53);}};}function respondWithFilteredResult(_0x37401a,_0x4bdc40){return function(_0x1c0586){if(_0x1c0586){var _0x7d9fea=_0x1c0586[_0x6467('0x1d')],_0x48a109=_0x4bdc40[_0x6467('0x1e')],_0xf3efe4=_0x4bdc40[_0x6467('0x1e')]+_0x4bdc40[_0x6467('0x1f')],_0x471694;if(_0xf3efe4>=_0x7d9fea){_0xf3efe4=_0x7d9fea;_0x471694=0xc8;}else{_0x471694=0xce;}_0x37401a[_0x6467('0x1a')](_0x471694);return _0x37401a[_0x6467('0x20')](_0x6467('0x21'),_0x48a109+'-'+_0xf3efe4+'/'+_0x7d9fea)[_0x6467('0x1c')](_0x1c0586);}return null;};}function patchUpdates(_0x2e8c15){return function(_0x4c7c64){try{jsonpatch[_0x6467('0x22')](_0x4c7c64,_0x2e8c15,!![]);}catch(_0x42670b){return BPromise[_0x6467('0x23')](_0x42670b);}return _0x4c7c64[_0x6467('0x24')]();};}function saveUpdates(_0x377e5d,_0x510409){return function(_0x551834){if(_0x551834){return _0x551834[_0x6467('0x25')](_0x377e5d)[_0x6467('0x26')](function(_0x12f05e){return _0x12f05e;});}return null;};}function removeEntity(_0x4a3edd,_0x4021fe){return function(_0x7d4c59){if(_0x7d4c59){return _0x7d4c59[_0x6467('0x27')]()['then'](function(){_0x4a3edd[_0x6467('0x1a')](0xcc)[_0x6467('0x1b')]();});}};}function handleEntityNotFound(_0x59d840,_0x25b312){return function(_0x28781b){if(!_0x28781b){_0x59d840[_0x6467('0x19')](0x194);}return _0x28781b;};}function handleError(_0x94068e,_0x418ece){_0x418ece=_0x418ece||0x1f4;return function(_0x24a293){logger[_0x6467('0x28')](_0x24a293[_0x6467('0x29')]);if(_0x24a293['name']){delete _0x24a293['name'];}_0x94068e['status'](_0x418ece)['send'](_0x24a293);};}exports[_0x6467('0x2a')]=function(_0x4e9555,_0x30721f){var _0x390b12={},_0x30f6d1={},_0x2963f7={'count':0x0,'rows':[]};var _0x56b4b7=_['map'](db['VoiceCallReport'][_0x6467('0x2b')],function(_0x46fcb6){return{'name':_0x46fcb6['fieldName'],'type':_0x46fcb6[_0x6467('0x2c')][_0x6467('0x2d')]};});_0x30f6d1[_0x6467('0x2e')]=_['map'](_0x56b4b7,'name');_0x30f6d1['query']=_['keys'](_0x4e9555[_0x6467('0x2f')]);_0x30f6d1[_0x6467('0x30')]=_['intersection'](_0x30f6d1['model'],_0x30f6d1['query']);_0x390b12[_0x6467('0x31')]=_[_0x6467('0x32')](_0x30f6d1[_0x6467('0x2e')],qs['fields'](_0x4e9555[_0x6467('0x2f')][_0x6467('0x33')]));_0x390b12['attributes']=_0x390b12[_0x6467('0x31')][_0x6467('0x34')]?_0x390b12[_0x6467('0x31')]:_0x30f6d1[_0x6467('0x2e')];if(!_0x4e9555[_0x6467('0x2f')][_0x6467('0x35')](_0x6467('0x36'))){_0x390b12[_0x6467('0x1f')]=qs['limit'](_0x4e9555[_0x6467('0x2f')][_0x6467('0x1f')]);_0x390b12[_0x6467('0x1e')]=qs['offset'](_0x4e9555[_0x6467('0x2f')][_0x6467('0x1e')]);}_0x390b12[_0x6467('0x37')]=qs[_0x6467('0x38')](_0x4e9555[_0x6467('0x2f')][_0x6467('0x38')]);_0x390b12[_0x6467('0x39')]=qs[_0x6467('0x30')](_[_0x6467('0x3a')](_0x4e9555[_0x6467('0x2f')],_0x30f6d1[_0x6467('0x30')]),_0x56b4b7);if(_0x4e9555[_0x6467('0x2f')][_0x6467('0x3b')]){_0x390b12['where']=_['merge'](_0x390b12[_0x6467('0x39')],{'$or':_['map'](_0x56b4b7,function(_0x406fbf){if(_0x406fbf['type']!==_0x6467('0x3c')){var _0x3b2a9f={};_0x3b2a9f[_0x406fbf[_0x6467('0x3d')]]={'$like':'%'+_0x4e9555['query']['filter']+'%'};return _0x3b2a9f;}})});}_0x390b12=_[_0x6467('0x3e')]({},_0x390b12,_0x4e9555[_0x6467('0x3f')]);var _0x30e96f={'where':_0x390b12['where']};return db['VoiceCallReport'][_0x6467('0x1d')](_0x30e96f)['then'](function(_0x3a86ae){_0x2963f7['count']=_0x3a86ae;if(_0x4e9555['query']['includeAll']){_0x390b12[_0x6467('0x40')]=[{'attributes':['id',_0x6467('0x3d'),'fullname',_0x6467('0x41')],'model':db[_0x6467('0x42')],'as':_0x6467('0x42')}];}return db['VoiceCallReport'][_0x6467('0x43')](_0x390b12);})[_0x6467('0x26')](function(_0x59e076){_0x2963f7[_0x6467('0x44')]=_0x59e076;return _0x2963f7;})['then'](respondWithFilteredResult(_0x30721f,_0x390b12))[_0x6467('0x45')](handleError(_0x30721f,null));};exports['show']=function(_0x22e398,_0x167e69){var _0x24766e={'raw':!![],'where':{'id':_0x22e398['params']['id']}},_0x42e48a={};_0x42e48a['model']=_[_0x6467('0x46')](db['VoiceCallReport'][_0x6467('0x2b')]);_0x42e48a[_0x6467('0x2f')]=_[_0x6467('0x46')](_0x22e398[_0x6467('0x2f')]);_0x42e48a['filters']=_[_0x6467('0x32')](_0x42e48a[_0x6467('0x2e')],_0x42e48a[_0x6467('0x2f')]);_0x24766e[_0x6467('0x31')]=_[_0x6467('0x32')](_0x42e48a['model'],qs[_0x6467('0x33')](_0x22e398['query'][_0x6467('0x33')]));_0x24766e[_0x6467('0x31')]=_0x24766e[_0x6467('0x31')][_0x6467('0x34')]?_0x24766e[_0x6467('0x31')]:_0x42e48a['model'];if(_0x22e398[_0x6467('0x2f')]['includeAll']){_0x24766e[_0x6467('0x40')]=[{'all':!![]}];}_0x24766e=_[_0x6467('0x3e')]({},_0x24766e,_0x22e398[_0x6467('0x3f')]);return db[_0x6467('0x47')]['find'](_0x24766e)[_0x6467('0x26')](handleEntityNotFound(_0x167e69,null))[_0x6467('0x26')](respondWithResult(_0x167e69,null))['catch'](handleError(_0x167e69,null));};exports[_0x6467('0x48')]=function(_0x3eff69,_0x583854){return db[_0x6467('0x47')][_0x6467('0x48')](_0x3eff69[_0x6467('0x49')],{})['then'](respondWithResult(_0x583854,0xc9))['catch'](handleError(_0x583854,null));};exports[_0x6467('0x27')]=function(_0xdb6b12,_0x3f7fe6){return db['VoiceCallReport']['find']({'where':{'id':_0xdb6b12[_0x6467('0x4a')]['id']}})[_0x6467('0x26')](handleEntityNotFound(_0x3f7fe6,null))[_0x6467('0x26')](removeEntity(_0x3f7fe6,null))[_0x6467('0x45')](handleError(_0x3f7fe6,null));};exports[_0x6467('0x4b')]=function(_0x10c688,_0xc72406){return db['VoiceCallReport']['describe']()[_0x6467('0x26')](respondWithResult(_0xc72406,null))[_0x6467('0x45')](handleError(_0xc72406,null));};exports[_0x6467('0x25')]=function(_0x205ba8,_0x1adbbc){if(_0x205ba8[_0x6467('0x49')][_0x6467('0x4c')]){delete _0x205ba8[_0x6467('0x49')][_0x6467('0x4c')];}return db[_0x6467('0x47')][_0x6467('0x4d')]({'where':{'uniqueid':_0x205ba8[_0x6467('0x4a')]['id'],'UserId':{'$or':[null,_0x205ba8['user']['id']]}}})[_0x6467('0x26')](handleEntityNotFound(_0x1adbbc,null))[_0x6467('0x26')](saveUpdates(_0x205ba8[_0x6467('0x49')],null))[_0x6467('0x26')](respondWithResult(_0x1adbbc,null))[_0x6467('0x45')](handleError(_0x1adbbc,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index d5bb859..b1d8574 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 _0xef87=['../../config/environment','./voiceCallReport.attributes','exports','VoiceCallReport','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef87,0xd5));var _0x7ef8=function(_0x9bc2ac,_0x20cc1b){_0x9bc2ac=_0x9bc2ac-0x0;var _0x141550=_0xef87[_0x9bc2ac];return _0x141550;};'use strict';var _=require('lodash');var util=require(_0x7ef8('0x0'));var logger=require(_0x7ef8('0x1'))(_0x7ef8('0x2'));var moment=require(_0x7ef8('0x3'));var BPromise=require('bluebird');var rp=require(_0x7ef8('0x4'));var fs=require('fs');var path=require(_0x7ef8('0x5'));var rimraf=require(_0x7ef8('0x6'));var config=require(_0x7ef8('0x7'));var attributes=require(_0x7ef8('0x8'));module[_0x7ef8('0x9')]=function(_0x4d9669,_0x58459c){return _0x4d9669['define'](_0x7ef8('0xa'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0284=['VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports'];(function(_0x3c55b3,_0x34dc98){var _0x22d0b6=function(_0x3d16f9){while(--_0x3d16f9){_0x3c55b3['push'](_0x3c55b3['shift']());}};_0x22d0b6(++_0x34dc98);}(_0x0284,0x1a3));var _0x4028=function(_0x40b3f2,_0x2c4f5f){_0x40b3f2=_0x40b3f2-0x0;var _0x4ce90c=_0x0284[_0x40b3f2];return _0x4ce90c;};'use strict';var _=require(_0x4028('0x0'));var util=require(_0x4028('0x1'));var logger=require(_0x4028('0x2'))(_0x4028('0x3'));var moment=require('moment');var BPromise=require(_0x4028('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4028('0x5'));var rimraf=require(_0x4028('0x6'));var config=require(_0x4028('0x7'));var attributes=require(_0x4028('0x8'));module[_0x4028('0x9')]=function(_0x389c89,_0x1c0027){return _0x389c89['define'](_0x4028('0xa'),attributes,{'tableName':_0x4028('0xb'),'paranoid':![],'indexes':[{'fields':[_0x4028('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index f98f977..b50fe57 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 _0xa66c=['body','UpdateVoiceCallReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','include','map','model','stringify','CreateVoiceCallReport','create'];(function(_0x39d024,_0x5c5797){var _0x311bdd=function(_0x4d644c){while(--_0x4d644c){_0x39d024['push'](_0x39d024['shift']());}};_0x311bdd(++_0x5c5797);}(_0xa66c,0x1ba));var _0xca66=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa66c[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xca66('0x0'));var util=require(_0xca66('0x1'));var moment=require(_0xca66('0x2'));var BPromise=require('bluebird');var rs=require(_0xca66('0x3'));var fs=require('fs');var Redis=require(_0xca66('0x4'));var db=require(_0xca66('0x5'))['db'];var utils=require(_0xca66('0x6'));var logger=require(_0xca66('0x7'))(_0xca66('0x8'));var config=require(_0xca66('0x9'));var jayson=require(_0xca66('0xa'));var client=jayson[_0xca66('0xb')][_0xca66('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5eb366,_0x114f42,_0x39be17){return new BPromise(function(_0x3cc7d4,_0x2fc33b){return client[_0xca66('0xd')](_0x5eb366,_0x39be17)[_0xca66('0xe')](function(_0x5704a4){logger[_0xca66('0xf')](_0xca66('0x10'),_0x114f42,_0xca66('0x11'));logger[_0xca66('0x12')](_0xca66('0x13'),_0x114f42,_0xca66('0x11'),JSON['stringify'](_0x5704a4));if(_0x5704a4[_0xca66('0x14')]){if(_0x5704a4[_0xca66('0x14')][_0xca66('0x15')]===0x1f4){logger[_0xca66('0x14')]('VoiceCallReport,\x20%s,\x20%s',_0x114f42,_0x5704a4['error'][_0xca66('0x16')]);return _0x2fc33b(_0x5704a4['error']['message']);}logger[_0xca66('0x14')](_0xca66('0x10'),_0x114f42,_0x5704a4[_0xca66('0x14')][_0xca66('0x16')]);return _0x3cc7d4(_0x5704a4[_0xca66('0x14')]['message']);}else{logger[_0xca66('0xf')](_0xca66('0x10'),_0x114f42,_0xca66('0x11'));_0x3cc7d4(_0x5704a4[_0xca66('0x17')][_0xca66('0x16')]);}})[_0xca66('0x18')](function(_0xf49967){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x114f42,_0xf49967);_0x2fc33b(_0xf49967);});});}exports[_0xca66('0x19')]=function(_0x45857b){var _0x1215e1=this;return new Promise(function(_0x318eb9,_0x3863b0){return db[_0xca66('0x1a')]['findAll']({'raw':_0x45857b[_0xca66('0x1b')]?_0x45857b[_0xca66('0x1b')][_0xca66('0x1c')]===undefined?!![]:![]:!![],'where':_0x45857b[_0xca66('0x1b')]?_0x45857b[_0xca66('0x1b')][_0xca66('0x1d')]||null:null,'attributes':_0x45857b[_0xca66('0x1b')]?_0x45857b[_0xca66('0x1b')][_0xca66('0x1e')]||null:null,'limit':_0x45857b[_0xca66('0x1b')]?_0x45857b['options'][_0xca66('0x1f')]||null:null,'include':_0x45857b[_0xca66('0x1b')]?_0x45857b[_0xca66('0x1b')][_0xca66('0x20')]?_[_0xca66('0x21')](_0x45857b[_0xca66('0x1b')][_0xca66('0x20')],function(_0x3dc20f){return{'model':db[_0x3dc20f[_0xca66('0x22')]],'as':_0x3dc20f['as'],'attributes':_0x3dc20f[_0xca66('0x1e')],'include':_0x3dc20f[_0xca66('0x20')]?_[_0xca66('0x21')](_0x3dc20f[_0xca66('0x20')],function(_0x46a0de){return{'model':db[_0x46a0de[_0xca66('0x22')]],'as':_0x46a0de['as'],'attributes':_0x46a0de[_0xca66('0x1e')],'include':_0x46a0de[_0xca66('0x20')]?_[_0xca66('0x21')](_0x46a0de[_0xca66('0x20')],function(_0x162ceb){return{'model':db[_0x162ceb[_0xca66('0x22')]],'as':_0x162ceb['as'],'attributes':_0x162ceb[_0xca66('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x28e25c){logger[_0xca66('0xf')](_0xca66('0x19'),_0x45857b);logger['debug'](_0xca66('0x19'),_0x45857b,JSON[_0xca66('0x23')](_0x28e25c));_0x318eb9(_0x28e25c);})['catch'](function(_0x3160f0){logger['error'](_0xca66('0x19'),_0x3160f0['message'],_0x45857b);_0x3863b0(_0x1215e1['error'](0x1f4,_0x3160f0[_0xca66('0x16')]));});});};exports[_0xca66('0x24')]=function(_0x2d4c0f){var _0x5a696f=this;return new Promise(function(_0x4d6662,_0x5f5d64){return db['VoiceCallReport'][_0xca66('0x25')](_0x2d4c0f[_0xca66('0x26')],{'raw':_0x2d4c0f['options']?_0x2d4c0f[_0xca66('0x1b')][_0xca66('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x55cd59){logger[_0xca66('0xf')](_0xca66('0x24'),_0x2d4c0f);logger['debug']('CreateVoiceCallReport',_0x2d4c0f,JSON[_0xca66('0x23')](_0x55cd59));_0x4d6662(_0x55cd59);})[_0xca66('0x18')](function(_0x55780c){logger[_0xca66('0x14')](_0xca66('0x24'),_0x55780c['message'],_0x2d4c0f);_0x5f5d64(_0x5a696f[_0xca66('0x14')](0x1f4,_0x55780c[_0xca66('0x16')]));});});};exports[_0xca66('0x27')]=function(_0x13d1b9){var _0x527384=this;return new Promise(function(_0x50c099,_0x12b7ff){return db['VoiceCallReport']['update'](_0x13d1b9[_0xca66('0x26')],{'raw':_0x13d1b9[_0xca66('0x1b')]?_0x13d1b9[_0xca66('0x1b')][_0xca66('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13d1b9[_0xca66('0x1b')]?_0x13d1b9[_0xca66('0x1b')]['where']||null:null,'attributes':_0x13d1b9[_0xca66('0x1b')]?_0x13d1b9[_0xca66('0x1b')][_0xca66('0x1e')]||null:null,'limit':_0x13d1b9['options']?_0x13d1b9[_0xca66('0x1b')][_0xca66('0x1f')]||null:null})[_0xca66('0xe')](function(_0x582442){logger[_0xca66('0xf')]('UpdateVoiceCallReport',_0x13d1b9);logger[_0xca66('0x12')](_0xca66('0x27'),_0x13d1b9,JSON[_0xca66('0x23')](_0x582442));_0x50c099(_0x582442);})[_0xca66('0x18')](function(_0x395237){logger[_0xca66('0x14')]('UpdateVoiceCallReport',_0x395237[_0xca66('0x16')],_0x13d1b9);_0x12b7ff(_0x527384[_0xca66('0x14')](0x1f4,_0x395237['message']));});});}; \ No newline at end of file +var _0xffb7=['attributes','limit','include','map','model','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw'];(function(_0x2e812d,_0x5c69fa){var _0x173ec0=function(_0x16808d){while(--_0x16808d){_0x2e812d['push'](_0x2e812d['shift']());}};_0x173ec0(++_0x5c69fa);}(_0xffb7,0x1a5));var _0x7ffb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xffb7[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7ffb('0x0'));var util=require(_0x7ffb('0x1'));var moment=require(_0x7ffb('0x2'));var BPromise=require(_0x7ffb('0x3'));var rs=require(_0x7ffb('0x4'));var fs=require('fs');var Redis=require(_0x7ffb('0x5'));var db=require(_0x7ffb('0x6'))['db'];var utils=require(_0x7ffb('0x7'));var logger=require(_0x7ffb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7ffb('0x9'));var client=jayson[_0x7ffb('0xa')][_0x7ffb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4830d8,_0x54563b,_0x2590f6){return new BPromise(function(_0x520848,_0x182d52){return client[_0x7ffb('0xc')](_0x4830d8,_0x2590f6)[_0x7ffb('0xd')](function(_0x5cc848){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x54563b,'request\x20sent');logger[_0x7ffb('0xe')](_0x7ffb('0xf'),_0x54563b,'request\x20sent',JSON[_0x7ffb('0x10')](_0x5cc848));if(_0x5cc848[_0x7ffb('0x11')]){if(_0x5cc848[_0x7ffb('0x11')][_0x7ffb('0x12')]===0x1f4){logger[_0x7ffb('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x54563b,_0x5cc848[_0x7ffb('0x11')][_0x7ffb('0x13')]);return _0x182d52(_0x5cc848[_0x7ffb('0x11')]['message']);}logger[_0x7ffb('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x54563b,_0x5cc848[_0x7ffb('0x11')][_0x7ffb('0x13')]);return _0x520848(_0x5cc848[_0x7ffb('0x11')]['message']);}else{logger[_0x7ffb('0x14')](_0x7ffb('0x15'),_0x54563b,_0x7ffb('0x16'));_0x520848(_0x5cc848[_0x7ffb('0x17')]['message']);}})[_0x7ffb('0x18')](function(_0x947b9c){logger[_0x7ffb('0x11')](_0x7ffb('0x15'),_0x54563b,_0x947b9c);_0x182d52(_0x947b9c);});});}exports[_0x7ffb('0x19')]=function(_0x411e1a){var _0x13b849=this;return new Promise(function(_0x461df5,_0x1ce69d){return db[_0x7ffb('0x1a')][_0x7ffb('0x1b')]({'raw':_0x411e1a[_0x7ffb('0x1c')]?_0x411e1a[_0x7ffb('0x1c')][_0x7ffb('0x1d')]===undefined?!![]:![]:!![],'where':_0x411e1a[_0x7ffb('0x1c')]?_0x411e1a[_0x7ffb('0x1c')]['where']||null:null,'attributes':_0x411e1a[_0x7ffb('0x1c')]?_0x411e1a[_0x7ffb('0x1c')][_0x7ffb('0x1e')]||null:null,'limit':_0x411e1a[_0x7ffb('0x1c')]?_0x411e1a[_0x7ffb('0x1c')][_0x7ffb('0x1f')]||null:null,'include':_0x411e1a[_0x7ffb('0x1c')]?_0x411e1a[_0x7ffb('0x1c')][_0x7ffb('0x20')]?_[_0x7ffb('0x21')](_0x411e1a[_0x7ffb('0x1c')][_0x7ffb('0x20')],function(_0x4c2d46){return{'model':db[_0x4c2d46[_0x7ffb('0x22')]],'as':_0x4c2d46['as'],'attributes':_0x4c2d46[_0x7ffb('0x1e')],'include':_0x4c2d46[_0x7ffb('0x20')]?_[_0x7ffb('0x21')](_0x4c2d46[_0x7ffb('0x20')],function(_0x3c06f5){return{'model':db[_0x3c06f5[_0x7ffb('0x22')]],'as':_0x3c06f5['as'],'attributes':_0x3c06f5[_0x7ffb('0x1e')],'include':_0x3c06f5[_0x7ffb('0x20')]?_['map'](_0x3c06f5[_0x7ffb('0x20')],function(_0x453610){return{'model':db[_0x453610[_0x7ffb('0x22')]],'as':_0x453610['as'],'attributes':_0x453610[_0x7ffb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7ffb('0xd')](function(_0x36cf38){logger[_0x7ffb('0x14')](_0x7ffb('0x19'),_0x411e1a);logger['debug'](_0x7ffb('0x19'),_0x411e1a,JSON[_0x7ffb('0x10')](_0x36cf38));_0x461df5(_0x36cf38);})[_0x7ffb('0x18')](function(_0x14b620){logger[_0x7ffb('0x11')](_0x7ffb('0x19'),_0x14b620[_0x7ffb('0x13')],_0x411e1a);_0x1ce69d(_0x13b849[_0x7ffb('0x11')](0x1f4,_0x14b620[_0x7ffb('0x13')]));});});};exports[_0x7ffb('0x23')]=function(_0x15dc8a){var _0xe3c9a0=this;return new Promise(function(_0x12a91f,_0xb52748){return db['VoiceCallReport'][_0x7ffb('0x24')](_0x15dc8a[_0x7ffb('0x25')],{'raw':_0x15dc8a[_0x7ffb('0x1c')]?_0x15dc8a[_0x7ffb('0x1c')][_0x7ffb('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x2ff5eb){logger[_0x7ffb('0x14')](_0x7ffb('0x23'),_0x15dc8a);logger[_0x7ffb('0xe')](_0x7ffb('0x23'),_0x15dc8a,JSON[_0x7ffb('0x10')](_0x2ff5eb));_0x12a91f(_0x2ff5eb);})['catch'](function(_0x778837){logger[_0x7ffb('0x11')]('CreateVoiceCallReport',_0x778837[_0x7ffb('0x13')],_0x15dc8a);_0xb52748(_0xe3c9a0[_0x7ffb('0x11')](0x1f4,_0x778837['message']));});});};exports[_0x7ffb('0x26')]=function(_0x3ff130){var _0x50de8e=this;return new Promise(function(_0x302fc9,_0x20b352){return db[_0x7ffb('0x1a')][_0x7ffb('0x27')](_0x3ff130[_0x7ffb('0x25')],{'raw':_0x3ff130['options']?_0x3ff130['options'][_0x7ffb('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ff130['options']?_0x3ff130['options'][_0x7ffb('0x28')]||null:null,'attributes':_0x3ff130[_0x7ffb('0x1c')]?_0x3ff130['options'][_0x7ffb('0x1e')]||null:null,'limit':_0x3ff130[_0x7ffb('0x1c')]?_0x3ff130['options']['limit']||null:null})[_0x7ffb('0xd')](function(_0x2ac94d){logger[_0x7ffb('0x14')](_0x7ffb('0x26'),_0x3ff130);logger[_0x7ffb('0xe')](_0x7ffb('0x26'),_0x3ff130,JSON['stringify'](_0x2ac94d));_0x302fc9(_0x2ac94d);})['catch'](function(_0x414274){logger[_0x7ffb('0x11')](_0x7ffb('0x26'),_0x414274[_0x7ffb('0x13')],_0x3ff130);_0x20b352(_0x50de8e['error'](0x1f4,_0x414274['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index fa4aac5..86cd7ea 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 _0x5569=['update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','/:id','create','put'];(function(_0x426c6f,_0x3821bf){var _0x2ca544=function(_0x405ad2){while(--_0x405ad2){_0x426c6f['push'](_0x426c6f['shift']());}};_0x2ca544(++_0x3821bf);}(_0x5569,0x143));var _0x9556=function(_0x5d1044,_0x18f656){_0x5d1044=_0x5d1044-0x0;var _0x3cd90e=_0x5569[_0x5d1044];return _0x3cd90e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9556('0x0'));var timeout=require(_0x9556('0x1'));var express=require(_0x9556('0x2'));var router=express[_0x9556('0x3')]();var auth=require(_0x9556('0x4'));var interaction=require(_0x9556('0x5'));var config=require(_0x9556('0x6'));var controller=require(_0x9556('0x7'));router[_0x9556('0x8')]('/',auth[_0x9556('0x9')](),controller['index']);router[_0x9556('0x8')](_0x9556('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x9556('0xb')]);router[_0x9556('0xc')](_0x9556('0xa'),auth[_0x9556('0x9')](),controller[_0x9556('0xd')]);router[_0x9556('0xe')](_0x9556('0xa'),auth[_0x9556('0x9')](),controller[_0x9556('0xf')]);module['exports']=router; \ No newline at end of file +var _0x9a22=['path','connect-timeout','express','Router','../../components/auth/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','create','delete','destroy','exports','multer','util'];(function(_0x3e91a9,_0x53c466){var _0x25c9ad=function(_0x69ee2d){while(--_0x69ee2d){_0x3e91a9['push'](_0x3e91a9['shift']());}};_0x25c9ad(++_0x53c466);}(_0x9a22,0x75));var _0x29a2=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x9a22[_0x5037ab];return _0x512adb;};'use strict';var multer=require(_0x29a2('0x0'));var util=require(_0x29a2('0x1'));var path=require(_0x29a2('0x2'));var timeout=require(_0x29a2('0x3'));var express=require(_0x29a2('0x4'));var router=express[_0x29a2('0x5')]();var auth=require(_0x29a2('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x29a2('0x7'));router[_0x29a2('0x8')]('/',auth[_0x29a2('0x9')](),controller[_0x29a2('0xa')]);router[_0x29a2('0x8')](_0x29a2('0xb'),auth[_0x29a2('0x9')](),controller[_0x29a2('0xc')]);router['post']('/',auth[_0x29a2('0x9')](),controller[_0x29a2('0xd')]);router['put'](_0x29a2('0xb'),auth[_0x29a2('0x9')](),controller['update']);router[_0x29a2('0xe')](_0x29a2('0xb'),auth['isAuthenticated'](),controller[_0x29a2('0xf')]);module[_0x29a2('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 299143c..ec9c03e 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 _0x604c=['STRING','BOOLEAN','sequelize','exports','name','setDataValue','options','getDataValue','split'];(function(_0x20aadb,_0x5a607a){var _0x520018=function(_0x1d258a){while(--_0x1d258a){_0x20aadb['push'](_0x20aadb['shift']());}};_0x520018(++_0x5a607a);}(_0x604c,0x65));var _0xc604=function(_0x3cb059,_0x10adac){_0x3cb059=_0x3cb059-0x0;var _0x264dd2=_0x604c[_0x3cb059];return _0x264dd2;};'use strict';var Sequelize=require(_0xc604('0x0'));module[_0xc604('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0xc604('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x5dd2fe){this[_0xc604('0x3')](_0xc604('0x4'),_0x5dd2fe?_0x5dd2fe['join'](''):[]);},'get':function(){return this[_0xc604('0x5')](_0xc604('0x4'))?this[_0xc604('0x5')]('options')[_0xc604('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xc604('0x7')]},'record':{'type':Sequelize[_0xc604('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xc604('0x7')]},'description':{'type':Sequelize[_0xc604('0x7')]}}; \ No newline at end of file +var _0x4b28=['options','getDataValue','BOOLEAN','sequelize','STRING','setDataValue'];(function(_0x20a12c,_0x15a6a4){var _0x3c9b03=function(_0x545c09){while(--_0x545c09){_0x20a12c['push'](_0x20a12c['shift']());}};_0x3c9b03(++_0x15a6a4);}(_0x4b28,0x1b3));var _0x84b2=function(_0x56ec6f,_0x21d3a8){_0x56ec6f=_0x56ec6f-0x0;var _0x2e47ff=_0x4b28[_0x56ec6f];return _0x2e47ff;};'use strict';var Sequelize=require(_0x84b2('0x0'));module['exports']={'name':{'type':Sequelize[_0x84b2('0x1')]},'prefix':{'type':Sequelize[_0x84b2('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x5405ec){this[_0x84b2('0x2')](_0x84b2('0x3'),_0x5405ec?_0x5405ec['join'](''):[]);},'get':function(){return this[_0x84b2('0x4')](_0x84b2('0x3'))?this[_0x84b2('0x4')]('options')['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x84b2('0x1')]},'record':{'type':Sequelize[_0x84b2('0x5')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x84b2('0x1')]},'description':{'type':Sequelize[_0x84b2('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 6030339..c0d5121 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 _0x94ae=['error','name','send','index','map','VoiceChanSpy','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','apply','reject','update','then','destroy','get','ChanSpies','UserProfileResource','end'];(function(_0x20508a,_0x3dac2c){var _0x5846fd=function(_0x2371bf){while(--_0x2371bf){_0x20508a['push'](_0x20508a['shift']());}};_0x5846fd(++_0x3dac2c);}(_0x94ae,0x11f));var _0xe94a=function(_0x13ce6d,_0x5984bf){_0x13ce6d=_0x13ce6d-0x0;var _0x397a06=_0x94ae[_0x13ce6d];return _0x397a06;};'use strict';var pdf=require(_0xe94a('0x0'));var emlformat=require(_0xe94a('0x1'));var rimraf=require(_0xe94a('0x2'));var zipdir=require(_0xe94a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe94a('0x4'));var BPromise=require(_0xe94a('0x5'));var Mustache=require(_0xe94a('0x6'));var util=require(_0xe94a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xe94a('0x8'));var ejs=require(_0xe94a('0x9'));var fs=require('fs');var _=require(_0xe94a('0xa'));var squel=require('squel');var crypto=require(_0xe94a('0xb'));var jsforce=require(_0xe94a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe94a('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe94a('0xd'));var authService=require(_0xe94a('0xe'));var qs=require(_0xe94a('0xf'));var as=require(_0xe94a('0x10'));var hardwareService=require(_0xe94a('0x11'));var logger=require(_0xe94a('0x12'))(_0xe94a('0x13'));var utils=require(_0xe94a('0x14'));var config=require('../../config/environment');var db=require(_0xe94a('0x15'))['db'];function respondWithStatusCode(_0x587fd9,_0x133258){_0x133258=_0x133258||0xcc;return function(_0x4c4b3c){if(_0x4c4b3c){return _0x587fd9[_0xe94a('0x16')](_0x133258);}return _0x587fd9[_0xe94a('0x17')](_0x133258)['end']();};}function respondWithResult(_0x3d5f2d,_0x42bf13){_0x42bf13=_0x42bf13||0xc8;return function(_0x20f1e2){if(_0x20f1e2){return _0x3d5f2d[_0xe94a('0x17')](_0x42bf13)[_0xe94a('0x18')](_0x20f1e2);}};}function respondWithFilteredResult(_0x263ab7,_0x5299ad){return function(_0x3c84e6){if(_0x3c84e6){var _0xc8c42f=_0x3c84e6[_0xe94a('0x19')],_0x43cc9b=_0x5299ad[_0xe94a('0x1a')],_0x4eecbf=_0x5299ad[_0xe94a('0x1a')]+_0x5299ad['limit'],_0x5590ce;if(_0x4eecbf>=_0xc8c42f){_0x4eecbf=_0xc8c42f;_0x5590ce=0xc8;}else{_0x5590ce=0xce;}_0x263ab7[_0xe94a('0x17')](_0x5590ce);return _0x263ab7['set'](_0xe94a('0x1b'),_0x43cc9b+'-'+_0x4eecbf+'/'+_0xc8c42f)[_0xe94a('0x18')](_0x3c84e6);}return null;};}function patchUpdates(_0x19aa49){return function(_0x529da5){try{jsonpatch[_0xe94a('0x1c')](_0x529da5,_0x19aa49,!![]);}catch(_0x5aedd0){return BPromise[_0xe94a('0x1d')](_0x5aedd0);}return _0x529da5['save']();};}function saveUpdates(_0xa3f5d2,_0x495316){return function(_0x136e6f){if(_0x136e6f){return _0x136e6f[_0xe94a('0x1e')](_0xa3f5d2)[_0xe94a('0x1f')](function(_0x5dad35){return _0x5dad35;});}return null;};}function removeEntity(_0x340805,_0x2db001){return function(_0x6f809b){if(_0x6f809b){return _0x6f809b[_0xe94a('0x20')]()[_0xe94a('0x1f')](function(){var _0x480ba7=_0x6f809b[_0xe94a('0x21')]({'plain':!![]});var _0x51e9bd=_0xe94a('0x22');return db[_0xe94a('0x23')][_0xe94a('0x20')]({'where':{'type':_0x51e9bd,'resourceId':_0x480ba7['id']}})[_0xe94a('0x1f')](function(){return _0x6f809b;});})['then'](function(){_0x340805[_0xe94a('0x17')](0xcc)[_0xe94a('0x24')]();});}};}function handleEntityNotFound(_0x543438,_0x2018e0){return function(_0x110c06){if(!_0x110c06){_0x543438['sendStatus'](0x194);}return _0x110c06;};}function handleError(_0x21aa20,_0x4524de){_0x4524de=_0x4524de||0x1f4;return function(_0x55fe35){logger[_0xe94a('0x25')](_0x55fe35['stack']);if(_0x55fe35[_0xe94a('0x26')]){delete _0x55fe35[_0xe94a('0x26')];}_0x21aa20[_0xe94a('0x17')](_0x4524de)[_0xe94a('0x27')](_0x55fe35);};}exports[_0xe94a('0x28')]=function(_0x159a89,_0x56c26c){var _0xdf04c8={},_0x4200ae={},_0x2c0644={'count':0x0,'rows':[]};var _0x502870=_[_0xe94a('0x29')](db[_0xe94a('0x2a')]['rawAttributes'],function(_0x3b9d7a){return{'name':_0x3b9d7a[_0xe94a('0x2b')],'type':_0x3b9d7a['type'][_0xe94a('0x2c')]};});_0x4200ae[_0xe94a('0x2d')]=_['map'](_0x502870,_0xe94a('0x26'));_0x4200ae[_0xe94a('0x2e')]=_[_0xe94a('0x2f')](_0x159a89['query']);_0x4200ae[_0xe94a('0x30')]=_[_0xe94a('0x31')](_0x4200ae[_0xe94a('0x2d')],_0x4200ae[_0xe94a('0x2e')]);_0xdf04c8['attributes']=_[_0xe94a('0x31')](_0x4200ae['model'],qs[_0xe94a('0x32')](_0x159a89[_0xe94a('0x2e')][_0xe94a('0x32')]));_0xdf04c8[_0xe94a('0x33')]=_0xdf04c8['attributes'][_0xe94a('0x34')]?_0xdf04c8[_0xe94a('0x33')]:_0x4200ae['model'];if(!_0x159a89[_0xe94a('0x2e')][_0xe94a('0x35')](_0xe94a('0x36'))){_0xdf04c8[_0xe94a('0x37')]=qs[_0xe94a('0x37')](_0x159a89['query'][_0xe94a('0x37')]);_0xdf04c8[_0xe94a('0x1a')]=qs['offset'](_0x159a89[_0xe94a('0x2e')][_0xe94a('0x1a')]);}_0xdf04c8[_0xe94a('0x38')]=qs['sort'](_0x159a89[_0xe94a('0x2e')][_0xe94a('0x39')]);_0xdf04c8['where']=qs['filters'](_[_0xe94a('0x3a')](_0x159a89[_0xe94a('0x2e')],_0x4200ae[_0xe94a('0x30')]),_0x502870);if(_0x159a89[_0xe94a('0x2e')]['filter']){_0xdf04c8[_0xe94a('0x3b')]=_[_0xe94a('0x3c')](_0xdf04c8[_0xe94a('0x3b')],{'$or':_['map'](_0x502870,function(_0x21fb74){if(_0x21fb74[_0xe94a('0x3d')]!==_0xe94a('0x3e')){var _0x3fe580={};_0x3fe580[_0x21fb74[_0xe94a('0x26')]]={'$like':'%'+_0x159a89[_0xe94a('0x2e')]['filter']+'%'};return _0x3fe580;}})});}_0xdf04c8=_[_0xe94a('0x3c')]({},_0xdf04c8,_0x159a89['options']);var _0x2bab3a={'where':_0xdf04c8['where']};return db[_0xe94a('0x2a')][_0xe94a('0x19')](_0x2bab3a)['then'](function(_0x51acdb){_0x2c0644['count']=_0x51acdb;if(_0x159a89[_0xe94a('0x2e')][_0xe94a('0x3f')]){_0xdf04c8[_0xe94a('0x40')]=[{'all':!![]}];}return db[_0xe94a('0x2a')][_0xe94a('0x41')](_0xdf04c8);})[_0xe94a('0x1f')](function(_0x885576){_0x2c0644[_0xe94a('0x42')]=_0x885576;return _0x2c0644;})[_0xe94a('0x1f')](respondWithFilteredResult(_0x56c26c,_0xdf04c8))['catch'](handleError(_0x56c26c,null));};exports[_0xe94a('0x43')]=function(_0x57fef2,_0x5a3b53){var _0x27ea9d={'raw':![],'where':{'id':_0x57fef2[_0xe94a('0x44')]['id']}},_0x4ec268={};_0x4ec268[_0xe94a('0x2d')]=_[_0xe94a('0x2f')](db[_0xe94a('0x2a')][_0xe94a('0x45')]);_0x4ec268['query']=_[_0xe94a('0x2f')](_0x57fef2[_0xe94a('0x2e')]);_0x4ec268[_0xe94a('0x30')]=_[_0xe94a('0x31')](_0x4ec268[_0xe94a('0x2d')],_0x4ec268[_0xe94a('0x2e')]);_0x27ea9d['attributes']=_[_0xe94a('0x31')](_0x4ec268['model'],qs[_0xe94a('0x32')](_0x57fef2[_0xe94a('0x2e')][_0xe94a('0x32')]));_0x27ea9d[_0xe94a('0x33')]=_0x27ea9d[_0xe94a('0x33')][_0xe94a('0x34')]?_0x27ea9d[_0xe94a('0x33')]:_0x4ec268['model'];if(_0x57fef2[_0xe94a('0x2e')][_0xe94a('0x3f')]){_0x27ea9d[_0xe94a('0x40')]=[{'all':!![]}];}_0x27ea9d=_[_0xe94a('0x3c')]({},_0x27ea9d,_0x57fef2[_0xe94a('0x46')]);return db[_0xe94a('0x2a')][_0xe94a('0x47')](_0x27ea9d)[_0xe94a('0x1f')](handleEntityNotFound(_0x5a3b53,null))[_0xe94a('0x1f')](respondWithResult(_0x5a3b53,null))[_0xe94a('0x48')](handleError(_0x5a3b53,null));};exports['create']=function(_0x53d7e7,_0x2635df){return db[_0xe94a('0x2a')][_0xe94a('0x49')](_0x53d7e7[_0xe94a('0x4a')],{})['then'](function(_0x5917ee){var _0x37195a=_0x53d7e7['user'][_0xe94a('0x21')]({'plain':!![]});if(!_0x37195a)throw new Error(_0xe94a('0x4b'));if(_0x37195a[_0xe94a('0x4c')]===_0xe94a('0x4d')){var _0x492754=_0x5917ee[_0xe94a('0x21')]({'plain':!![]});var _0x583aae=_0xe94a('0x22');return db[_0xe94a('0x4e')][_0xe94a('0x47')]({'where':{'name':_0x583aae,'userProfileId':_0x37195a['userProfileId']},'raw':!![]})['then'](function(_0x2738a0){if(_0x2738a0&&_0x2738a0[_0xe94a('0x4f')]===0x0){return db[_0xe94a('0x23')][_0xe94a('0x49')]({'name':_0x492754[_0xe94a('0x26')],'resourceId':_0x492754['id'],'type':_0x2738a0[_0xe94a('0x26')],'sectionId':_0x2738a0['id']},{})['then'](function(){return _0x5917ee;});}else{return _0x5917ee;}})[_0xe94a('0x48')](function(_0x534a62){logger[_0xe94a('0x25')](_0xe94a('0x50'),_0x534a62);throw _0x534a62;});}return _0x5917ee;})[_0xe94a('0x1f')](respondWithResult(_0x2635df,0xc9))['catch'](handleError(_0x2635df,null));};exports[_0xe94a('0x1e')]=function(_0xb26b42,_0x8bf36){if(_0xb26b42[_0xe94a('0x4a')]['id']){delete _0xb26b42[_0xe94a('0x4a')]['id'];}return db[_0xe94a('0x2a')]['find']({'where':{'id':_0xb26b42['params']['id']}})['then'](handleEntityNotFound(_0x8bf36,null))[_0xe94a('0x1f')](saveUpdates(_0xb26b42[_0xe94a('0x4a')],null))[_0xe94a('0x1f')](respondWithResult(_0x8bf36,null))[_0xe94a('0x48')](handleError(_0x8bf36,null));};exports[_0xe94a('0x20')]=function(_0x7bfb68,_0x19af63){return db[_0xe94a('0x2a')][_0xe94a('0x47')]({'where':{'id':_0x7bfb68[_0xe94a('0x44')]['id']}})[_0xe94a('0x1f')](handleEntityNotFound(_0x19af63,null))[_0xe94a('0x1f')](removeEntity(_0x19af63,null))[_0xe94a('0x48')](handleError(_0x19af63,null));}; \ No newline at end of file +var _0xdca5=['querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','reject','then','get','ChanSpies','destroy','end','stack','name','send','index','map','VoiceChanSpy','rawAttributes','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','count','includeAll','include','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x1accf6,_0x4a9854){var _0x24e446=function(_0x487f51){while(--_0x487f51){_0x1accf6['push'](_0x1accf6['shift']());}};_0x24e446(++_0x4a9854);}(_0xdca5,0x92));var _0x5dca=function(_0x36247f,_0x303eaa){_0x36247f=_0x36247f-0x0;var _0x5cfa66=_0xdca5[_0x36247f];return _0x5cfa66;};'use strict';var pdf=require(_0x5dca('0x0'));var emlformat=require(_0x5dca('0x1'));var rimraf=require(_0x5dca('0x2'));var zipdir=require(_0x5dca('0x3'));var jsonpatch=require(_0x5dca('0x4'));var rp=require('request-promise');var moment=require(_0x5dca('0x5'));var BPromise=require(_0x5dca('0x6'));var Mustache=require(_0x5dca('0x7'));var util=require(_0x5dca('0x8'));var path=require(_0x5dca('0x9'));var sox=require(_0x5dca('0xa'));var csv=require(_0x5dca('0xb'));var ejs=require(_0x5dca('0xc'));var fs=require('fs');var _=require(_0x5dca('0xd'));var squel=require(_0x5dca('0xe'));var crypto=require(_0x5dca('0xf'));var jsforce=require(_0x5dca('0x10'));var deskjs=require(_0x5dca('0x11'));var toCsv=require(_0x5dca('0xb'));var querystring=require(_0x5dca('0x12'));var Papa=require(_0x5dca('0x13'));var Redis=require(_0x5dca('0x14'));var authService=require(_0x5dca('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5dca('0x16'));var logger=require(_0x5dca('0x17'))(_0x5dca('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5dca('0x19'))['db'];function respondWithStatusCode(_0x3a7c90,_0x26bfe1){_0x26bfe1=_0x26bfe1||0xcc;return function(_0x4a7a50){if(_0x4a7a50){return _0x3a7c90[_0x5dca('0x1a')](_0x26bfe1);}return _0x3a7c90[_0x5dca('0x1b')](_0x26bfe1)['end']();};}function respondWithResult(_0x88ffcd,_0x4c6f34){_0x4c6f34=_0x4c6f34||0xc8;return function(_0x39cf2d){if(_0x39cf2d){return _0x88ffcd[_0x5dca('0x1b')](_0x4c6f34)[_0x5dca('0x1c')](_0x39cf2d);}};}function respondWithFilteredResult(_0x21f01d,_0x4cdec6){return function(_0x1cdb1a){if(_0x1cdb1a){var _0x369589=_0x1cdb1a['count'],_0x195320=_0x4cdec6[_0x5dca('0x1d')],_0x358c5a=_0x4cdec6[_0x5dca('0x1d')]+_0x4cdec6['limit'],_0x36d9b7;if(_0x358c5a>=_0x369589){_0x358c5a=_0x369589;_0x36d9b7=0xc8;}else{_0x36d9b7=0xce;}_0x21f01d[_0x5dca('0x1b')](_0x36d9b7);return _0x21f01d[_0x5dca('0x1e')](_0x5dca('0x1f'),_0x195320+'-'+_0x358c5a+'/'+_0x369589)[_0x5dca('0x1c')](_0x1cdb1a);}return null;};}function patchUpdates(_0x397c11){return function(_0x19aaaf){try{jsonpatch[_0x5dca('0x20')](_0x19aaaf,_0x397c11,!![]);}catch(_0x31e2bf){return BPromise[_0x5dca('0x21')](_0x31e2bf);}return _0x19aaaf['save']();};}function saveUpdates(_0x203fb7,_0x5ed812){return function(_0x5387cb){if(_0x5387cb){return _0x5387cb['update'](_0x203fb7)[_0x5dca('0x22')](function(_0x3a5c2b){return _0x3a5c2b;});}return null;};}function removeEntity(_0x9c0ebc,_0x4e02a1){return function(_0x2e2fc8){if(_0x2e2fc8){return _0x2e2fc8['destroy']()[_0x5dca('0x22')](function(){var _0x2aa52d=_0x2e2fc8[_0x5dca('0x23')]({'plain':!![]});var _0x4a5f8b=_0x5dca('0x24');return db['UserProfileResource'][_0x5dca('0x25')]({'where':{'type':_0x4a5f8b,'resourceId':_0x2aa52d['id']}})[_0x5dca('0x22')](function(){return _0x2e2fc8;});})[_0x5dca('0x22')](function(){_0x9c0ebc[_0x5dca('0x1b')](0xcc)[_0x5dca('0x26')]();});}};}function handleEntityNotFound(_0x475a17,_0x58d4c2){return function(_0x1b8d25){if(!_0x1b8d25){_0x475a17[_0x5dca('0x1a')](0x194);}return _0x1b8d25;};}function handleError(_0x40cdc5,_0x1b94d5){_0x1b94d5=_0x1b94d5||0x1f4;return function(_0x29468a){logger['error'](_0x29468a[_0x5dca('0x27')]);if(_0x29468a[_0x5dca('0x28')]){delete _0x29468a[_0x5dca('0x28')];}_0x40cdc5[_0x5dca('0x1b')](_0x1b94d5)[_0x5dca('0x29')](_0x29468a);};}exports[_0x5dca('0x2a')]=function(_0x55c2d0,_0x329dca){var _0x51ad33={},_0x60e6df={},_0x5d6195={'count':0x0,'rows':[]};var _0x28abde=_[_0x5dca('0x2b')](db[_0x5dca('0x2c')][_0x5dca('0x2d')],function(_0x52168a){return{'name':_0x52168a['fieldName'],'type':_0x52168a[_0x5dca('0x2e')]['key']};});_0x60e6df['model']=_[_0x5dca('0x2b')](_0x28abde,_0x5dca('0x28'));_0x60e6df[_0x5dca('0x2f')]=_[_0x5dca('0x30')](_0x55c2d0[_0x5dca('0x2f')]);_0x60e6df[_0x5dca('0x31')]=_['intersection'](_0x60e6df[_0x5dca('0x32')],_0x60e6df['query']);_0x51ad33[_0x5dca('0x33')]=_[_0x5dca('0x34')](_0x60e6df[_0x5dca('0x32')],qs['fields'](_0x55c2d0[_0x5dca('0x2f')][_0x5dca('0x35')]));_0x51ad33[_0x5dca('0x33')]=_0x51ad33[_0x5dca('0x33')][_0x5dca('0x36')]?_0x51ad33['attributes']:_0x60e6df[_0x5dca('0x32')];if(!_0x55c2d0[_0x5dca('0x2f')][_0x5dca('0x37')](_0x5dca('0x38'))){_0x51ad33['limit']=qs[_0x5dca('0x39')](_0x55c2d0[_0x5dca('0x2f')][_0x5dca('0x39')]);_0x51ad33[_0x5dca('0x1d')]=qs[_0x5dca('0x1d')](_0x55c2d0[_0x5dca('0x2f')][_0x5dca('0x1d')]);}_0x51ad33[_0x5dca('0x3a')]=qs['sort'](_0x55c2d0[_0x5dca('0x2f')][_0x5dca('0x3b')]);_0x51ad33[_0x5dca('0x3c')]=qs['filters'](_[_0x5dca('0x3d')](_0x55c2d0[_0x5dca('0x2f')],_0x60e6df[_0x5dca('0x31')]),_0x28abde);if(_0x55c2d0['query'][_0x5dca('0x3e')]){_0x51ad33[_0x5dca('0x3c')]=_['merge'](_0x51ad33['where'],{'$or':_[_0x5dca('0x2b')](_0x28abde,function(_0x28f5f8){if(_0x28f5f8[_0x5dca('0x2e')]!=='VIRTUAL'){var _0x15415f={};_0x15415f[_0x28f5f8[_0x5dca('0x28')]]={'$like':'%'+_0x55c2d0[_0x5dca('0x2f')]['filter']+'%'};return _0x15415f;}})});}_0x51ad33=_[_0x5dca('0x3f')]({},_0x51ad33,_0x55c2d0[_0x5dca('0x40')]);var _0x5a6fbc={'where':_0x51ad33['where']};return db[_0x5dca('0x2c')][_0x5dca('0x41')](_0x5a6fbc)[_0x5dca('0x22')](function(_0x4cd6c8){_0x5d6195['count']=_0x4cd6c8;if(_0x55c2d0[_0x5dca('0x2f')][_0x5dca('0x42')]){_0x51ad33[_0x5dca('0x43')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x51ad33);})['then'](function(_0x464b69){_0x5d6195['rows']=_0x464b69;return _0x5d6195;})[_0x5dca('0x22')](respondWithFilteredResult(_0x329dca,_0x51ad33))[_0x5dca('0x44')](handleError(_0x329dca,null));};exports[_0x5dca('0x45')]=function(_0x1a616f,_0x589b09){var _0x56eee7={'raw':![],'where':{'id':_0x1a616f['params']['id']}},_0x4e90fc={};_0x4e90fc[_0x5dca('0x32')]=_[_0x5dca('0x30')](db['VoiceChanSpy']['rawAttributes']);_0x4e90fc[_0x5dca('0x2f')]=_[_0x5dca('0x30')](_0x1a616f['query']);_0x4e90fc[_0x5dca('0x31')]=_['intersection'](_0x4e90fc[_0x5dca('0x32')],_0x4e90fc[_0x5dca('0x2f')]);_0x56eee7[_0x5dca('0x33')]=_[_0x5dca('0x34')](_0x4e90fc['model'],qs['fields'](_0x1a616f[_0x5dca('0x2f')][_0x5dca('0x35')]));_0x56eee7[_0x5dca('0x33')]=_0x56eee7[_0x5dca('0x33')][_0x5dca('0x36')]?_0x56eee7[_0x5dca('0x33')]:_0x4e90fc[_0x5dca('0x32')];if(_0x1a616f[_0x5dca('0x2f')]['includeAll']){_0x56eee7[_0x5dca('0x43')]=[{'all':!![]}];}_0x56eee7=_[_0x5dca('0x3f')]({},_0x56eee7,_0x1a616f[_0x5dca('0x40')]);return db[_0x5dca('0x2c')][_0x5dca('0x46')](_0x56eee7)['then'](handleEntityNotFound(_0x589b09,null))[_0x5dca('0x22')](respondWithResult(_0x589b09,null))[_0x5dca('0x44')](handleError(_0x589b09,null));};exports[_0x5dca('0x47')]=function(_0x385e50,_0x4ab85b){return db['VoiceChanSpy'][_0x5dca('0x47')](_0x385e50[_0x5dca('0x48')],{})[_0x5dca('0x22')](function(_0x43128b){var _0x2c4929=_0x385e50['user'][_0x5dca('0x23')]({'plain':!![]});if(!_0x2c4929)throw new Error(_0x5dca('0x49'));if(_0x2c4929[_0x5dca('0x4a')]===_0x5dca('0x4b')){var _0x516306=_0x43128b[_0x5dca('0x23')]({'plain':!![]});var _0xd39c87=_0x5dca('0x24');return db[_0x5dca('0x4c')][_0x5dca('0x46')]({'where':{'name':_0xd39c87,'userProfileId':_0x2c4929[_0x5dca('0x4d')]},'raw':!![]})[_0x5dca('0x22')](function(_0x36992f){if(_0x36992f&&_0x36992f[_0x5dca('0x4e')]===0x0){return db['UserProfileResource'][_0x5dca('0x47')]({'name':_0x516306[_0x5dca('0x28')],'resourceId':_0x516306['id'],'type':_0x36992f[_0x5dca('0x28')],'sectionId':_0x36992f['id']},{})[_0x5dca('0x22')](function(){return _0x43128b;});}else{return _0x43128b;}})[_0x5dca('0x44')](function(_0x5820f7){logger[_0x5dca('0x4f')](_0x5dca('0x50'),_0x5820f7);throw _0x5820f7;});}return _0x43128b;})['then'](respondWithResult(_0x4ab85b,0xc9))[_0x5dca('0x44')](handleError(_0x4ab85b,null));};exports['update']=function(_0x899315,_0x221b44){if(_0x899315['body']['id']){delete _0x899315['body']['id'];}return db['VoiceChanSpy'][_0x5dca('0x46')]({'where':{'id':_0x899315['params']['id']}})[_0x5dca('0x22')](handleEntityNotFound(_0x221b44,null))[_0x5dca('0x22')](saveUpdates(_0x899315[_0x5dca('0x48')],null))[_0x5dca('0x22')](respondWithResult(_0x221b44,null))['catch'](handleError(_0x221b44,null));};exports[_0x5dca('0x25')]=function(_0x4ef272,_0xa570ee){return db[_0x5dca('0x2c')][_0x5dca('0x46')]({'where':{'id':_0x4ef272[_0x5dca('0x51')]['id']}})[_0x5dca('0x22')](handleEntityNotFound(_0xa570ee,null))[_0x5dca('0x22')](removeEntity(_0xa570ee,null))['catch'](handleError(_0xa570ee,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 9828577..c07e380 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 _0x7aa2=['findAll','agent','exports','models','define','VoiceChanSpy','bulkCreate','then','catch','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','format','%s%s','prefix','system','push','merge','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x7aa2,0x132));var _0x27aa=function(_0x2ad3fd,_0x24c202){_0x2ad3fd=_0x2ad3fd-0x0;var _0x30fe82=_0x7aa2[_0x2ad3fd];return _0x30fe82;};'use strict';var _=require(_0x27aa('0x0'));var util=require(_0x27aa('0x1'));var BPromise=require(_0x27aa('0x2'));var attributes=require(_0x27aa('0x3'));var getUserApplications=function(_0x314105,_0x12f901,_0x1b9507){var _0x544908=0x1;var _0x1c3b4d=[];var _0x18f9ec={'context':_0x12f901[_0x27aa('0x4')]||'from-sip','exten':util[_0x27aa('0x5')](_0x27aa('0x6'),_0x314105[_0x27aa('0x7')],_0x1b9507),'type':_0x27aa('0x8'),'isApp':![],'ChanSpyId':_0x314105['id'],'UserId':_0x12f901['id']};_0x1c3b4d[_0x27aa('0x9')](_[_0x27aa('0xa')]({'app':'Set','appdata':util[_0x27aa('0x5')](_0x27aa('0xb'),_0x27aa('0xc')),'priority':_0x544908++},_0x18f9ec));if(_0x314105[_0x27aa('0xd')]){_0x1c3b4d[_0x27aa('0x9')](_[_0x27aa('0xa')]({'app':_0x27aa('0xe'),'appdata':util['format'](_0x27aa('0xf'),_0x314105[_0x27aa('0x10')]),'priority':_0x544908++},_0x18f9ec));}if(_0x314105['auth']){_0x1c3b4d[_0x27aa('0x9')](_[_0x27aa('0xa')]({'app':'Authenticate','appdata':_0x314105[_0x27aa('0x11')],'priority':_0x544908++},_0x18f9ec));}_0x1c3b4d[_0x27aa('0x9')](_[_0x27aa('0xa')]({'app':_0x27aa('0x12'),'appdata':util[_0x27aa('0x5')](_0x27aa('0x13'),_0x12f901[_0x27aa('0x14')],_0x314105[_0x27aa('0x15')]?_0x314105[_0x27aa('0x15')][_0x27aa('0x16')](''):''),'priority':_0x544908++},_0x18f9ec));if(_0x314105[_0x27aa('0xd')]){_0x1c3b4d[_0x27aa('0x9')](_[_0x27aa('0xa')]({'app':_0x27aa('0x17'),'priority':_0x544908++},_0x18f9ec));}return _0x1c3b4d;};var getChanSpyApplications=function(_0x4ed3fb,_0x1b949a){var _0xeb2090=[];for(var _0x40a7a7=0x0,_0x4bcfe1=0x1;_0x40a7a7<_0x1b949a[_0x27aa('0x18')];_0x40a7a7++,_0x4bcfe1=0x1){_0xeb2090=_0xeb2090[_0x27aa('0x19')](getUserApplications(_0x4ed3fb,_0x1b949a[_0x40a7a7],_0x1b949a[_0x40a7a7][_0x27aa('0x1a')]));if(_0x1b949a[_0x40a7a7][_0x27aa('0x1a')]!=_0x1b949a[_0x40a7a7][_0x27aa('0x14')]){_0xeb2090=_0xeb2090['concat'](getUserApplications(_0x4ed3fb,_0x1b949a[_0x40a7a7],_0x1b949a[_0x40a7a7][_0x27aa('0x14')]));}}return _0xeb2090;};var getChanSpyPromise=function(_0x3519ea,_0x344e9e){return new BPromise(function(_0x2abe7b,_0x2788c7){return _0x3519ea['User'][_0x27aa('0x1b')]({'attributes':['id','name',_0x27aa('0x1a')],'where':{'role':_0x27aa('0x1c'),'chanspy':!![]},'raw':!![]})['then'](function(_0x251e60){if(_0x251e60){return _0x2abe7b(getChanSpyApplications(_0x344e9e,_0x251e60));}return _0x2abe7b([]);})['catch'](function(_0x3a119f){_0x2788c7(_0x3a119f);});});};module[_0x27aa('0x1d')]=function(_0x216160,_0x19076a){var _0x466a69=_0x216160[_0x27aa('0x1e')];return _0x216160[_0x27aa('0x1f')](_0x27aa('0x20'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4bd438,_0x27782b,_0x49a75d){return getChanSpyPromise(_0x466a69,_0x4bd438)['then'](function(_0x171ac2){if(_0x171ac2&&_0x171ac2[_0x27aa('0x18')]){return _0x466a69['VoiceExtension'][_0x27aa('0x21')](_0x171ac2);}})[_0x27aa('0x22')](function(){_0x49a75d();})[_0x27aa('0x23')](function(_0x3909a4){_0x49a75d(_0x3909a4);});},'afterUpdate':function(_0x6bd317,_0x429586,_0x56d2b3){return _0x466a69['VoiceExtension'][_0x27aa('0x24')]({'where':{'ChanSpyId':_0x6bd317['id']}})[_0x27aa('0x22')](function(){return getChanSpyPromise(_0x466a69,_0x6bd317);})[_0x27aa('0x22')](function(_0x4f4ced){if(_0x4f4ced&&_0x4f4ced[_0x27aa('0x18')]){return _0x466a69['VoiceExtension'][_0x27aa('0x21')](_0x4f4ced);}})[_0x27aa('0x22')](function(){_0x56d2b3();})[_0x27aa('0x23')](function(_0x4296d9){_0x56d2b3(_0x4296d9);});},'afterDestroy':function(_0x308b44,_0x91a913,_0xcc83ae){return _0x466a69['VoiceExtension'][_0x27aa('0x24')]({'where':{'ChanSpyId':_0x308b44['id']}})[_0x27aa('0x22')](function(){_0xcc83ae();})[_0x27aa('0x23')](function(_0x1bf4c6){_0xcc83ae(_0x1bf4c6);});}}});}; \ No newline at end of file +var _0xd882=['chanspy','record','MixMonitor','${UNIQUEID}.%s,a','Authenticate','password','ChanSpy','SIP/%s,%s','options','StopMixMonitor','internal','name','concat','User','findAll','then','catch','exports','define','voice_chanspy','length','bulkCreate','VoiceExtension','destroy','lodash','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s'];(function(_0x36294d,_0x1dd287){var _0x3c9bf2=function(_0x3d54ee){while(--_0x3d54ee){_0x36294d['push'](_0x36294d['shift']());}};_0x3c9bf2(++_0x1dd287);}(_0xd882,0xd1));var _0x2d88=function(_0x54496d,_0x5b8572){_0x54496d=_0x54496d-0x0;var _0x40e626=_0xd882[_0x54496d];return _0x40e626;};'use strict';var _=require(_0x2d88('0x0'));var util=require('util');var BPromise=require(_0x2d88('0x1'));var attributes=require(_0x2d88('0x2'));var getUserApplications=function(_0x108505,_0x4e41f8,_0x57a5fc){var _0x5d30b1=0x1;var _0x5b8f54=[];var _0x3b10a2={'context':_0x4e41f8[_0x2d88('0x3')]||_0x2d88('0x4'),'exten':util[_0x2d88('0x5')](_0x2d88('0x6'),_0x108505[_0x2d88('0x7')],_0x57a5fc),'type':_0x2d88('0x8'),'isApp':![],'ChanSpyId':_0x108505['id'],'UserId':_0x4e41f8['id']};_0x5b8f54[_0x2d88('0x9')](_[_0x2d88('0xa')]({'app':_0x2d88('0xb'),'appdata':util[_0x2d88('0x5')](_0x2d88('0xc'),_0x2d88('0xd')),'priority':_0x5d30b1++},_0x3b10a2));if(_0x108505[_0x2d88('0xe')]){_0x5b8f54[_0x2d88('0x9')](_[_0x2d88('0xa')]({'app':_0x2d88('0xf'),'appdata':util[_0x2d88('0x5')](_0x2d88('0x10'),_0x108505['recordingFormat']),'priority':_0x5d30b1++},_0x3b10a2));}if(_0x108505['auth']){_0x5b8f54[_0x2d88('0x9')](_[_0x2d88('0xa')]({'app':_0x2d88('0x11'),'appdata':_0x108505[_0x2d88('0x12')],'priority':_0x5d30b1++},_0x3b10a2));}_0x5b8f54[_0x2d88('0x9')](_[_0x2d88('0xa')]({'app':_0x2d88('0x13'),'appdata':util[_0x2d88('0x5')](_0x2d88('0x14'),_0x4e41f8['name'],_0x108505[_0x2d88('0x15')]?_0x108505[_0x2d88('0x15')]['join'](''):''),'priority':_0x5d30b1++},_0x3b10a2));if(_0x108505[_0x2d88('0xe')]){_0x5b8f54[_0x2d88('0x9')](_[_0x2d88('0xa')]({'app':_0x2d88('0x16'),'priority':_0x5d30b1++},_0x3b10a2));}return _0x5b8f54;};var getChanSpyApplications=function(_0x396ddd,_0x1c30e1){var _0x4b4149=[];for(var _0x50061f=0x0,_0x551ef8=0x1;_0x50061f<_0x1c30e1['length'];_0x50061f++,_0x551ef8=0x1){_0x4b4149=_0x4b4149['concat'](getUserApplications(_0x396ddd,_0x1c30e1[_0x50061f],_0x1c30e1[_0x50061f][_0x2d88('0x17')]));if(_0x1c30e1[_0x50061f][_0x2d88('0x17')]!=_0x1c30e1[_0x50061f][_0x2d88('0x18')]){_0x4b4149=_0x4b4149[_0x2d88('0x19')](getUserApplications(_0x396ddd,_0x1c30e1[_0x50061f],_0x1c30e1[_0x50061f][_0x2d88('0x18')]));}}return _0x4b4149;};var getChanSpyPromise=function(_0x28bc12,_0x4561a9){return new BPromise(function(_0x2c47b4,_0x1cbd89){return _0x28bc12[_0x2d88('0x1a')][_0x2d88('0x1b')]({'attributes':['id',_0x2d88('0x18'),_0x2d88('0x17')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x2d88('0x1c')](function(_0x4e332a){if(_0x4e332a){return _0x2c47b4(getChanSpyApplications(_0x4561a9,_0x4e332a));}return _0x2c47b4([]);})[_0x2d88('0x1d')](function(_0x30e73b){_0x1cbd89(_0x30e73b);});});};module[_0x2d88('0x1e')]=function(_0x6f9339,_0x301c11){var _0x1933df=_0x6f9339['models'];return _0x6f9339[_0x2d88('0x1f')]('VoiceChanSpy',attributes,{'tableName':_0x2d88('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4ac48f,_0x5cd286,_0x3ac68c){return getChanSpyPromise(_0x1933df,_0x4ac48f)[_0x2d88('0x1c')](function(_0x12689c){if(_0x12689c&&_0x12689c[_0x2d88('0x21')]){return _0x1933df['VoiceExtension'][_0x2d88('0x22')](_0x12689c);}})['then'](function(){_0x3ac68c();})[_0x2d88('0x1d')](function(_0x4681ab){_0x3ac68c(_0x4681ab);});},'afterUpdate':function(_0x41db87,_0x55e657,_0x480bdf){return _0x1933df[_0x2d88('0x23')][_0x2d88('0x24')]({'where':{'ChanSpyId':_0x41db87['id']}})[_0x2d88('0x1c')](function(){return getChanSpyPromise(_0x1933df,_0x41db87);})[_0x2d88('0x1c')](function(_0x1ef089){if(_0x1ef089&&_0x1ef089[_0x2d88('0x21')]){return _0x1933df[_0x2d88('0x23')]['bulkCreate'](_0x1ef089);}})[_0x2d88('0x1c')](function(){_0x480bdf();})[_0x2d88('0x1d')](function(_0x2545a3){_0x480bdf(_0x2545a3);});},'afterDestroy':function(_0x56eae6,_0x19be73,_0x27fe54){return _0x1933df[_0x2d88('0x23')][_0x2d88('0x24')]({'where':{'ChanSpyId':_0x56eae6['id']}})[_0x2d88('0x1c')](function(){_0x27fe54();})[_0x2d88('0x1d')](function(_0x9e5986){_0x27fe54(_0x9e5986);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index edfb442..8cd2edb 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 _0x33e1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','then','info','debug','request\x20sent','error','code','VoiceChanSpy,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring'];(function(_0x10fe13,_0x3942a5){var _0x13d436=function(_0x2af9e8){while(--_0x2af9e8){_0x10fe13['push'](_0x10fe13['shift']());}};_0x13d436(++_0x3942a5);}(_0x33e1,0x1b1));var _0x133e=function(_0xe83481,_0x44f914){_0xe83481=_0xe83481-0x0;var _0x99576d=_0x33e1[_0xe83481];return _0x99576d;};'use strict';var _=require('lodash');var util=require(_0x133e('0x0'));var moment=require(_0x133e('0x1'));var BPromise=require(_0x133e('0x2'));var rs=require(_0x133e('0x3'));var fs=require('fs');var Redis=require(_0x133e('0x4'));var db=require(_0x133e('0x5'))['db'];var utils=require(_0x133e('0x6'));var logger=require(_0x133e('0x7'))(_0x133e('0x8'));var config=require('../../config/environment');var jayson=require(_0x133e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1dd918,_0x599007,_0x378c10){return new BPromise(function(_0x489e00,_0x23be06){return client['request'](_0x1dd918,_0x378c10)[_0x133e('0xa')](function(_0x20f525){logger[_0x133e('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x599007,'request\x20sent');logger[_0x133e('0xc')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x599007,_0x133e('0xd'),JSON['stringify'](_0x20f525));if(_0x20f525[_0x133e('0xe')]){if(_0x20f525[_0x133e('0xe')][_0x133e('0xf')]===0x1f4){logger['error'](_0x133e('0x10'),_0x599007,_0x20f525['error']['message']);return _0x23be06(_0x20f525[_0x133e('0xe')][_0x133e('0x11')]);}logger['error'](_0x133e('0x10'),_0x599007,_0x20f525[_0x133e('0xe')][_0x133e('0x11')]);return _0x489e00(_0x20f525[_0x133e('0xe')][_0x133e('0x11')]);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x599007,_0x133e('0xd'));_0x489e00(_0x20f525['result'][_0x133e('0x11')]);}})[_0x133e('0x12')](function(_0x56430a){logger['error'](_0x133e('0x10'),_0x599007,_0x56430a);_0x23be06(_0x56430a);});});} \ No newline at end of file +var _0xea20=['../../config/environment','jayson/promise','client','http','info','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','VoiceChanSpy,\x20%s,\x20%s','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2eda32,_0x1c314d){var _0x1c1c01=function(_0x310dc1){while(--_0x310dc1){_0x2eda32['push'](_0x2eda32['shift']());}};_0x1c1c01(++_0x1c314d);}(_0xea20,0x198));var _0x0ea2=function(_0x110d5b,_0x394692){_0x110d5b=_0x110d5b-0x0;var _0x485f6c=_0xea20[_0x110d5b];return _0x485f6c;};'use strict';var _=require(_0x0ea2('0x0'));var util=require(_0x0ea2('0x1'));var moment=require(_0x0ea2('0x2'));var BPromise=require(_0x0ea2('0x3'));var rs=require(_0x0ea2('0x4'));var fs=require('fs');var Redis=require(_0x0ea2('0x5'));var db=require(_0x0ea2('0x6'))['db'];var utils=require(_0x0ea2('0x7'));var logger=require(_0x0ea2('0x8'))(_0x0ea2('0x9'));var config=require(_0x0ea2('0xa'));var jayson=require(_0x0ea2('0xb'));var client=jayson[_0x0ea2('0xc')][_0x0ea2('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x65a3fb,_0x433f2c,_0x5c422f){return new BPromise(function(_0x48d9e2,_0x4c0a34){return client['request'](_0x65a3fb,_0x5c422f)['then'](function(_0x366b23){logger[_0x0ea2('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x433f2c,'request\x20sent');logger['debug'](_0x0ea2('0xf'),_0x433f2c,'request\x20sent',JSON['stringify'](_0x366b23));if(_0x366b23[_0x0ea2('0x10')]){if(_0x366b23[_0x0ea2('0x10')][_0x0ea2('0x11')]===0x1f4){logger[_0x0ea2('0x10')](_0x0ea2('0x12'),_0x433f2c,_0x366b23[_0x0ea2('0x10')][_0x0ea2('0x13')]);return _0x4c0a34(_0x366b23[_0x0ea2('0x10')][_0x0ea2('0x13')]);}logger[_0x0ea2('0x10')](_0x0ea2('0x12'),_0x433f2c,_0x366b23[_0x0ea2('0x10')][_0x0ea2('0x13')]);return _0x48d9e2(_0x366b23[_0x0ea2('0x10')][_0x0ea2('0x13')]);}else{logger[_0x0ea2('0xe')](_0x0ea2('0x12'),_0x433f2c,_0x0ea2('0x14'));_0x48d9e2(_0x366b23['result'][_0x0ea2('0x13')]);}})[_0x0ea2('0x15')](function(_0x75d8b3){logger[_0x0ea2('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x433f2c,_0x75d8b3);_0x4c0a34(_0x75d8b3);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 88c57a7..c072013 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 _0x1b14=['post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x660afc,_0x361712){var _0x51d99f=function(_0x213048){while(--_0x213048){_0x660afc['push'](_0x660afc['shift']());}};_0x51d99f(++_0x361712);}(_0x1b14,0x15c));var _0x41b1=function(_0xabd4c3,_0x25d6f0){_0xabd4c3=_0xabd4c3-0x0;var _0x1a71fe=_0x1b14[_0xabd4c3];return _0x1a71fe;};'use strict';var multer=require(_0x41b1('0x0'));var util=require('util');var path=require(_0x41b1('0x1'));var timeout=require(_0x41b1('0x2'));var express=require(_0x41b1('0x3'));var router=express[_0x41b1('0x4')]();var auth=require(_0x41b1('0x5'));var interaction=require(_0x41b1('0x6'));var config=require(_0x41b1('0x7'));var controller=require('./voiceContext.controller');router['get']('/',auth[_0x41b1('0x8')](),controller[_0x41b1('0x9')]);router[_0x41b1('0xa')](_0x41b1('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x41b1('0xc')]('/',auth['isAuthenticated'](),controller[_0x41b1('0xd')]);router['put'](_0x41b1('0xb'),auth['isAuthenticated'](),controller[_0x41b1('0xe')]);router[_0x41b1('0xf')](_0x41b1('0xb'),auth[_0x41b1('0x8')](),controller[_0x41b1('0x10')]);module[_0x41b1('0x11')]=router; \ No newline at end of file +var _0x2665=['index','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated'];(function(_0x55e1d1,_0x3c9376){var _0x1165db=function(_0x5b0120){while(--_0x5b0120){_0x55e1d1['push'](_0x55e1d1['shift']());}};_0x1165db(++_0x3c9376);}(_0x2665,0x1d1));var _0x5266=function(_0x190050,_0x5c9b8e){_0x190050=_0x190050-0x0;var _0x3f063d=_0x2665[_0x190050];return _0x3f063d;};'use strict';var multer=require(_0x5266('0x0'));var util=require('util');var path=require(_0x5266('0x1'));var timeout=require(_0x5266('0x2'));var express=require(_0x5266('0x3'));var router=express[_0x5266('0x4')]();var auth=require(_0x5266('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5266('0x6'));var controller=require(_0x5266('0x7'));router[_0x5266('0x8')]('/',auth[_0x5266('0x9')](),controller[_0x5266('0xa')]);router['get'](_0x5266('0xb'),auth['isAuthenticated'](),controller[_0x5266('0xc')]);router[_0x5266('0xd')]('/',auth['isAuthenticated'](),controller[_0x5266('0xe')]);router[_0x5266('0xf')](_0x5266('0xb'),auth[_0x5266('0x9')](),controller[_0x5266('0x10')]);router['delete'](_0x5266('0xb'),auth[_0x5266('0x9')](),controller[_0x5266('0x11')]);module[_0x5266('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 3644809..1f2653c 100644 --- a/server/api/voiceContext/voiceContext.attributes.js +++ b/server/api/voiceContext/voiceContext.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x51de81,_0x4d20ea){var _0x2703e2=function(_0x8929a8){while(--_0x8929a8){_0x51de81['push'](_0x51de81['shift']());}};_0x2703e2(++_0x4d20ea);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7995('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x661e1,_0x1055a3){var _0x26fb28=function(_0x40741a){while(--_0x40741a){_0x661e1['push'](_0x661e1['shift']());}};_0x26fb28(++_0x1055a3);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7995('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 6eb6cf6..7615da1 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 _0x34e8=['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','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','get','Contexts','sendStatus','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','VoiceContext','includeAll','include','findAll','rows','show','length','create','body','join','root','utf8','render','writeFileSync','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','server/files/templates/context.ejs','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','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','client'];(function(_0x585259,_0x16f49a){var _0x385a36=function(_0x10cb5f){while(--_0x10cb5f){_0x585259['push'](_0x585259['shift']());}};_0x385a36(++_0x16f49a);}(_0x34e8,0x12c));var _0x834e=function(_0x17f774,_0x37393d){_0x17f774=_0x17f774-0x0;var _0x145a36=_0x34e8[_0x17f774];return _0x145a36;};'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'];var jayson=require('jayson/promise');var client=jayson[_0x834e('0x1d')][_0x834e('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x58a27e,_0x23848e,_0x2d95f2){if(_0x2d95f2){var _0x28e659=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x28e659[_0x834e('0x1f')](_0x23848e)){return _0x58a27e;}else{throw new db['Sequelize'][(_0x834e('0x20'))](_0x834e('0x21'));}}else{return _0x58a27e;}}function respondWithRpcPromise(_0x57274a,_0x316205,_0x4a9cdc,_0x38a8cd){return new BPromise(function(_0x36d443,_0x478afe){var _0x43ac41=_0x38a8cd||client;return _0x43ac41[_0x834e('0x22')](_0x57274a,_0x4a9cdc)[_0x834e('0x23')](function(_0x50b3f6){logger[_0x834e('0x24')](_0x834e('0x25'),_0x316205,_0x834e('0x26'));logger[_0x834e('0x27')](_0x834e('0x28'),_0x316205,_0x834e('0x26'),JSON[_0x834e('0x29')](_0x50b3f6));if(_0x50b3f6['error']){if(_0x50b3f6[_0x834e('0x2a')][_0x834e('0x2b')]===0x1f4){logger[_0x834e('0x2a')](_0x834e('0x25'),_0x316205,_0x50b3f6['error'][_0x834e('0x2c')]);return _0x478afe(_0x50b3f6[_0x834e('0x2a')]['message']);}logger[_0x834e('0x2a')](_0x834e('0x25'),_0x316205,_0x50b3f6[_0x834e('0x2a')]['message']);return _0x36d443(_0x50b3f6['error'][_0x834e('0x2c')]);}else{logger[_0x834e('0x24')]('VoiceContext,\x20%s,\x20%s',_0x316205,_0x834e('0x26'));_0x36d443(_0x50b3f6[_0x834e('0x2d')]['message']);}})[_0x834e('0x2e')](function(_0x2e1983){logger[_0x834e('0x2a')]('VoiceContext,\x20%s,\x20%s',_0x316205,_0x2e1983);_0x478afe(_0x2e1983);});});}function respondWithStatusCode(_0x24fcf7,_0x3e310f){_0x3e310f=_0x3e310f||0xcc;return function(_0x5e1cc5){if(_0x5e1cc5){return _0x24fcf7['sendStatus'](_0x3e310f);}return _0x24fcf7[_0x834e('0x2f')](_0x3e310f)['end']();};}function respondWithResult(_0x2826ec,_0x3f1b0b){_0x3f1b0b=_0x3f1b0b||0xc8;return function(_0x3db026){if(_0x3db026){return _0x2826ec[_0x834e('0x2f')](_0x3f1b0b)[_0x834e('0x30')](_0x3db026);}};}function respondWithFilteredResult(_0x130cc5,_0x491919){return function(_0x510780){if(_0x510780){var _0x4dc64a=_0x510780[_0x834e('0x31')],_0x58c1d7=_0x491919['offset'],_0x2c7a8d=_0x491919[_0x834e('0x32')]+_0x491919[_0x834e('0x33')],_0x567cea;if(_0x2c7a8d>=_0x4dc64a){_0x2c7a8d=_0x4dc64a;_0x567cea=0xc8;}else{_0x567cea=0xce;}_0x130cc5[_0x834e('0x2f')](_0x567cea);return _0x130cc5[_0x834e('0x34')](_0x834e('0x35'),_0x58c1d7+'-'+_0x2c7a8d+'/'+_0x4dc64a)[_0x834e('0x30')](_0x510780);}return null;};}function patchUpdates(_0x3d149d){return function(_0xfaf716){try{jsonpatch[_0x834e('0x36')](_0xfaf716,_0x3d149d,!![]);}catch(_0x493289){return BPromise[_0x834e('0x37')](_0x493289);}return _0xfaf716['save']();};}function saveUpdates(_0x2c75c2,_0x3787b0){return function(_0x9ab921){if(_0x9ab921){return _0x9ab921[_0x834e('0x38')](_0x2c75c2)[_0x834e('0x23')](function(_0x4689c2){return _0x4689c2;});}return null;};}function removeEntity(_0x4696a1,_0x38cd29){return function(_0x358c31){if(_0x358c31){return _0x358c31[_0x834e('0x39')]()['then'](function(){var _0x2a3c7f=_0x358c31[_0x834e('0x3a')]({'plain':!![]});var _0x24a9df=_0x834e('0x3b');return db['UserProfileResource'][_0x834e('0x39')]({'where':{'type':_0x24a9df,'resourceId':_0x2a3c7f['id']}})[_0x834e('0x23')](function(){return _0x358c31;});})['then'](function(){_0x4696a1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e58fa,_0x41bf4d){return function(_0x20c6ae){if(!_0x20c6ae){_0x3e58fa[_0x834e('0x3c')](0x194);}return _0x20c6ae;};}function handleError(_0x339e28,_0x1b76dd){_0x1b76dd=_0x1b76dd||0x1f4;return function(_0x4c2ef6){logger[_0x834e('0x2a')](_0x4c2ef6['stack']);if(_0x4c2ef6[_0x834e('0x3d')]){delete _0x4c2ef6[_0x834e('0x3d')];}_0x339e28['status'](_0x1b76dd)[_0x834e('0x3e')](_0x4c2ef6);};}exports[_0x834e('0x3f')]=function(_0x491c28,_0x481f70){var _0x388711={},_0xd0d43a={},_0x2e9383={'count':0x0,'rows':[]};var _0x130c23=_[_0x834e('0x40')](db['VoiceContext'][_0x834e('0x41')],function(_0x548d1d){return{'name':_0x548d1d['fieldName'],'type':_0x548d1d[_0x834e('0x42')]['key']};});_0xd0d43a[_0x834e('0x43')]=_[_0x834e('0x40')](_0x130c23,_0x834e('0x3d'));_0xd0d43a[_0x834e('0x44')]=_[_0x834e('0x45')](_0x491c28['query']);_0xd0d43a[_0x834e('0x46')]=_[_0x834e('0x47')](_0xd0d43a[_0x834e('0x43')],_0xd0d43a['query']);_0x388711[_0x834e('0x48')]=_[_0x834e('0x47')](_0xd0d43a['model'],qs[_0x834e('0x49')](_0x491c28['query'][_0x834e('0x49')]));_0x388711[_0x834e('0x48')]=_0x388711['attributes']['length']?_0x388711[_0x834e('0x48')]:_0xd0d43a[_0x834e('0x43')];if(!_0x491c28[_0x834e('0x44')][_0x834e('0x4a')](_0x834e('0x4b'))){_0x388711[_0x834e('0x33')]=qs[_0x834e('0x33')](_0x491c28['query'][_0x834e('0x33')]);_0x388711['offset']=qs[_0x834e('0x32')](_0x491c28['query'][_0x834e('0x32')]);}_0x388711['order']=qs[_0x834e('0x4c')](_0x491c28[_0x834e('0x44')]['sort']);_0x388711[_0x834e('0x4d')]=qs[_0x834e('0x46')](_[_0x834e('0x4e')](_0x491c28[_0x834e('0x44')],_0xd0d43a[_0x834e('0x46')]),_0x130c23);if(_0x491c28[_0x834e('0x44')][_0x834e('0x4f')]){_0x388711[_0x834e('0x4d')]=_[_0x834e('0x50')](_0x388711[_0x834e('0x4d')],{'$or':_['map'](_0x130c23,function(_0x3124be){if(_0x3124be[_0x834e('0x42')]!=='VIRTUAL'){var _0x112306={};_0x112306[_0x3124be[_0x834e('0x3d')]]={'$like':'%'+_0x491c28[_0x834e('0x44')][_0x834e('0x4f')]+'%'};return _0x112306;}})});}_0x388711=_[_0x834e('0x50')]({},_0x388711,_0x491c28[_0x834e('0x51')]);var _0x4eab06={'where':_0x388711['where']};return db[_0x834e('0x52')][_0x834e('0x31')](_0x4eab06)[_0x834e('0x23')](function(_0x40ff5a){_0x2e9383[_0x834e('0x31')]=_0x40ff5a;if(_0x491c28[_0x834e('0x44')][_0x834e('0x53')]){_0x388711[_0x834e('0x54')]=[{'all':!![]}];}return db[_0x834e('0x52')][_0x834e('0x55')](_0x388711);})[_0x834e('0x23')](function(_0x385435){_0x2e9383[_0x834e('0x56')]=_0x385435;return _0x2e9383;})[_0x834e('0x23')](respondWithFilteredResult(_0x481f70,_0x388711))[_0x834e('0x2e')](handleError(_0x481f70,null));};exports[_0x834e('0x57')]=function(_0x3df078,_0x32b8f7){var _0x420841={'raw':![],'where':{'id':_0x3df078['params']['id']}},_0x1adf86={};_0x1adf86[_0x834e('0x43')]=_[_0x834e('0x45')](db['VoiceContext'][_0x834e('0x41')]);_0x1adf86[_0x834e('0x44')]=_['keys'](_0x3df078[_0x834e('0x44')]);_0x1adf86[_0x834e('0x46')]=_[_0x834e('0x47')](_0x1adf86[_0x834e('0x43')],_0x1adf86[_0x834e('0x44')]);_0x420841[_0x834e('0x48')]=_[_0x834e('0x47')](_0x1adf86['model'],qs[_0x834e('0x49')](_0x3df078[_0x834e('0x44')][_0x834e('0x49')]));_0x420841[_0x834e('0x48')]=_0x420841[_0x834e('0x48')][_0x834e('0x58')]?_0x420841[_0x834e('0x48')]:_0x1adf86[_0x834e('0x43')];if(_0x3df078['query'][_0x834e('0x53')]){_0x420841['include']=[{'all':!![]}];}_0x420841=_[_0x834e('0x50')]({},_0x420841,_0x3df078['options']);return db[_0x834e('0x52')]['find'](_0x420841)['then'](handleEntityNotFound(_0x32b8f7,null))[_0x834e('0x23')](respondWithResult(_0x32b8f7,null))[_0x834e('0x2e')](handleError(_0x32b8f7,null));};exports['create']=function(_0x5be43d,_0x2c8155,_0x2452b4){var _0x138ed2;return db[_0x834e('0x52')][_0x834e('0x59')](_0x5be43d[_0x834e('0x5a')],{'raw':!![]})[_0x834e('0x23')](function(_0x4273f1){_0x138ed2=_0x4273f1;return db['VoiceContext'][_0x834e('0x55')]({'raw':!![]});})[_0x834e('0x23')](function(_0x5d5ac2){var _0x281342=fs['readFileSync'](path[_0x834e('0x5b')](config[_0x834e('0x5c')],'server/files/templates/context.ejs'),_0x834e('0x5d'));var _0x37ee0e=ejs[_0x834e('0x5e')](_0x281342,{'contexts':_0x5d5ac2||[]});fs[_0x834e('0x5f')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x37ee0e);})[_0x834e('0x23')](function(){return respondWithRpcPromise(_0x834e('0x60'),_0x834e('0x59'),{'module':'chan_sip.so'});})[_0x834e('0x23')](function(){var _0x1fcae9=_0x5be43d[_0x834e('0x61')][_0x834e('0x3a')]({'plain':!![]});if(!_0x1fcae9)throw new Error(_0x834e('0x62'));if(_0x1fcae9[_0x834e('0x63')]===_0x834e('0x61')){var _0x1def00=_0x138ed2[_0x834e('0x3a')]({'plain':!![]});return db[_0x834e('0x64')][_0x834e('0x65')]({'where':{'name':_0x834e('0x3b'),'userProfileId':_0x1fcae9[_0x834e('0x66')]},'raw':!![]})[_0x834e('0x23')](function(_0x460a7a){if(_0x460a7a&&_0x460a7a[_0x834e('0x67')]===0x0){return db[_0x834e('0x68')][_0x834e('0x59')]({'name':_0x1def00[_0x834e('0x3d')],'resourceId':_0x1def00['id'],'type':_0x460a7a[_0x834e('0x3d')],'sectionId':_0x460a7a['id']},{})[_0x834e('0x23')](function(){return _0x138ed2;});}else{return _0x138ed2;}})[_0x834e('0x2e')](function(_0x5c83eb){logger[_0x834e('0x2a')](_0x834e('0x69'),_0x5c83eb);throw _0x5c83eb;});}return _0x138ed2;})[_0x834e('0x23')](respondWithResult(_0x2c8155,0xc9))[_0x834e('0x2e')](handleError(_0x2c8155,null));};exports['update']=function(_0x30faa8,_0x5a9c70,_0x56a152){var _0x2fdb1b;return db[_0x834e('0x52')][_0x834e('0x65')]({'where':{'id':_0x30faa8[_0x834e('0x6a')]['id']}})[_0x834e('0x23')](handleEntityNotFound(_0x5a9c70,null))[_0x834e('0x23')](saveUpdates(_0x30faa8[_0x834e('0x5a')],null))[_0x834e('0x23')](function(_0x525ed3){if(_0x525ed3){_0x2fdb1b=_0x525ed3;return db[_0x834e('0x52')]['findAll']({'raw':!![]});}})[_0x834e('0x23')](function(_0xd35dda){var _0x514fe5=fs['readFileSync'](path[_0x834e('0x5b')](config[_0x834e('0x5c')],_0x834e('0x6b')),_0x834e('0x5d'));var _0x2c41bd=ejs['render'](_0x514fe5,{'contexts':_0xd35dda||[]});fs[_0x834e('0x5f')](_0x834e('0x6c'),_0x2c41bd);})[_0x834e('0x23')](function(){return respondWithRpcPromise(_0x834e('0x60'),_0x834e('0x38'),{'module':_0x834e('0x6d')});})[_0x834e('0x23')](function(){return _0x2fdb1b;})[_0x834e('0x23')](respondWithResult(_0x5a9c70,null))[_0x834e('0x2e')](handleError(_0x5a9c70,null));};exports[_0x834e('0x39')]=function(_0x5b2bf6,_0x1b158b,_0x2e4d80){var _0x42fc96;return db[_0x834e('0x52')]['find']({'where':{'id':_0x5b2bf6[_0x834e('0x6a')]['id']}})['then'](handleEntityNotFound(_0x1b158b,null))['then'](removeEntity(_0x1b158b,null))['then'](function(){return db[_0x834e('0x52')][_0x834e('0x55')]({'raw':!![]});})['then'](function(_0x2645df){var _0x1b200d=fs['readFileSync'](path[_0x834e('0x5b')](config[_0x834e('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x346be5=ejs[_0x834e('0x5e')](_0x1b200d,{'contexts':_0x2645df});fs[_0x834e('0x5f')](_0x834e('0x6c'),_0x346be5);return respondWithRpcPromise(_0x834e('0x60'),'destroy',{'module':_0x834e('0x6d')});})['catch'](handleError(_0x1b158b,null));}; \ No newline at end of file +var _0xedd9=['VoiceContext','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','readFileSync','join','server/files/templates/context.ejs','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','create','update','params','root','utf8','writeFileSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','VoiceContext,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','Contexts','UserProfileResource','stack','name','send','index'];(function(_0x106d5f,_0x346a53){var _0x5b4c2f=function(_0xe43797){while(--_0xe43797){_0x106d5f['push'](_0x106d5f['shift']());}};_0x5b4c2f(++_0x346a53);}(_0xedd9,0xfc));var _0x9edd=function(_0x102596,_0x274409){_0x102596=_0x102596-0x0;var _0x38c687=_0xedd9[_0x102596];return _0x38c687;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9edd('0x0'));var rimraf=require(_0x9edd('0x1'));var zipdir=require(_0x9edd('0x2'));var jsonpatch=require(_0x9edd('0x3'));var rp=require(_0x9edd('0x4'));var moment=require(_0x9edd('0x5'));var BPromise=require(_0x9edd('0x6'));var Mustache=require(_0x9edd('0x7'));var util=require('util');var path=require(_0x9edd('0x8'));var sox=require(_0x9edd('0x9'));var csv=require(_0x9edd('0xa'));var ejs=require(_0x9edd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0xa'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var db=require(_0x9edd('0x16'))['db'];var jayson=require(_0x9edd('0x17'));var client=jayson[_0x9edd('0x18')][_0x9edd('0x19')]({'port':0x232a});function checkPasswordPattern(_0x3a7b84,_0xfca576,_0xef5498){if(_0xef5498){var _0x47eb64=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x47eb64[_0x9edd('0x1a')](_0xfca576)){return _0x3a7b84;}else{throw new db[(_0x9edd('0x1b'))][(_0x9edd('0x1c'))](_0x9edd('0x1d'));}}else{return _0x3a7b84;}}function respondWithRpcPromise(_0x13b6b6,_0x338f3c,_0x1042aa,_0x75a4ab){return new BPromise(function(_0x4ea60f,_0x5f5bf4){var _0x448996=_0x75a4ab||client;return _0x448996[_0x9edd('0x1e')](_0x13b6b6,_0x1042aa)['then'](function(_0x1b54c0){logger[_0x9edd('0x1f')](_0x9edd('0x20'),_0x338f3c,'request\x20sent');logger[_0x9edd('0x21')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x338f3c,_0x9edd('0x22'),JSON[_0x9edd('0x23')](_0x1b54c0));if(_0x1b54c0['error']){if(_0x1b54c0['error'][_0x9edd('0x24')]===0x1f4){logger['error'](_0x9edd('0x20'),_0x338f3c,_0x1b54c0['error']['message']);return _0x5f5bf4(_0x1b54c0[_0x9edd('0x25')][_0x9edd('0x26')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x338f3c,_0x1b54c0[_0x9edd('0x25')][_0x9edd('0x26')]);return _0x4ea60f(_0x1b54c0[_0x9edd('0x25')]['message']);}else{logger[_0x9edd('0x1f')](_0x9edd('0x20'),_0x338f3c,_0x9edd('0x22'));_0x4ea60f(_0x1b54c0[_0x9edd('0x27')][_0x9edd('0x26')]);}})['catch'](function(_0x46c383){logger[_0x9edd('0x25')](_0x9edd('0x20'),_0x338f3c,_0x46c383);_0x5f5bf4(_0x46c383);});});}function respondWithStatusCode(_0x2f9f86,_0x310a4d){_0x310a4d=_0x310a4d||0xcc;return function(_0x4d507f){if(_0x4d507f){return _0x2f9f86['sendStatus'](_0x310a4d);}return _0x2f9f86[_0x9edd('0x28')](_0x310a4d)[_0x9edd('0x29')]();};}function respondWithResult(_0x8d67aa,_0x25e135){_0x25e135=_0x25e135||0xc8;return function(_0x3c2227){if(_0x3c2227){return _0x8d67aa['status'](_0x25e135)['json'](_0x3c2227);}};}function respondWithFilteredResult(_0x214d0a,_0x257a26){return function(_0x1c762c){if(_0x1c762c){var _0x52746a=_0x1c762c[_0x9edd('0x2a')],_0x238b22=_0x257a26['offset'],_0x28cfae=_0x257a26[_0x9edd('0x2b')]+_0x257a26[_0x9edd('0x2c')],_0x2ae8dd;if(_0x28cfae>=_0x52746a){_0x28cfae=_0x52746a;_0x2ae8dd=0xc8;}else{_0x2ae8dd=0xce;}_0x214d0a[_0x9edd('0x28')](_0x2ae8dd);return _0x214d0a[_0x9edd('0x2d')](_0x9edd('0x2e'),_0x238b22+'-'+_0x28cfae+'/'+_0x52746a)[_0x9edd('0x2f')](_0x1c762c);}return null;};}function patchUpdates(_0x209aba){return function(_0x1fba7b){try{jsonpatch[_0x9edd('0x30')](_0x1fba7b,_0x209aba,!![]);}catch(_0x1c2e2b){return BPromise[_0x9edd('0x31')](_0x1c2e2b);}return _0x1fba7b[_0x9edd('0x32')]();};}function saveUpdates(_0x6907a5,_0xa55906){return function(_0x1a6c23){if(_0x1a6c23){return _0x1a6c23['update'](_0x6907a5)[_0x9edd('0x33')](function(_0x259259){return _0x259259;});}return null;};}function removeEntity(_0x267c74,_0x5d1707){return function(_0x2d2f88){if(_0x2d2f88){return _0x2d2f88[_0x9edd('0x34')]()[_0x9edd('0x33')](function(){var _0x38a7be=_0x2d2f88[_0x9edd('0x35')]({'plain':!![]});var _0x2bc4ed=_0x9edd('0x36');return db[_0x9edd('0x37')][_0x9edd('0x34')]({'where':{'type':_0x2bc4ed,'resourceId':_0x38a7be['id']}})[_0x9edd('0x33')](function(){return _0x2d2f88;});})[_0x9edd('0x33')](function(){_0x267c74[_0x9edd('0x28')](0xcc)[_0x9edd('0x29')]();});}};}function handleEntityNotFound(_0x14f780,_0x5757fc){return function(_0x37fcb2){if(!_0x37fcb2){_0x14f780['sendStatus'](0x194);}return _0x37fcb2;};}function handleError(_0x968303,_0x148630){_0x148630=_0x148630||0x1f4;return function(_0x10d6fd){logger[_0x9edd('0x25')](_0x10d6fd[_0x9edd('0x38')]);if(_0x10d6fd['name']){delete _0x10d6fd[_0x9edd('0x39')];}_0x968303[_0x9edd('0x28')](_0x148630)[_0x9edd('0x3a')](_0x10d6fd);};}exports[_0x9edd('0x3b')]=function(_0x1be77f,_0x337e6c){var _0x5c0627={},_0x1cbbac={},_0x1ccee8={'count':0x0,'rows':[]};var _0x35c16f=_['map'](db[_0x9edd('0x3c')]['rawAttributes'],function(_0x3ef1d5){return{'name':_0x3ef1d5['fieldName'],'type':_0x3ef1d5[_0x9edd('0x3d')][_0x9edd('0x3e')]};});_0x1cbbac[_0x9edd('0x3f')]=_['map'](_0x35c16f,_0x9edd('0x39'));_0x1cbbac[_0x9edd('0x40')]=_[_0x9edd('0x41')](_0x1be77f['query']);_0x1cbbac[_0x9edd('0x42')]=_['intersection'](_0x1cbbac[_0x9edd('0x3f')],_0x1cbbac[_0x9edd('0x40')]);_0x5c0627['attributes']=_[_0x9edd('0x43')](_0x1cbbac[_0x9edd('0x3f')],qs[_0x9edd('0x44')](_0x1be77f[_0x9edd('0x40')]['fields']));_0x5c0627[_0x9edd('0x45')]=_0x5c0627['attributes'][_0x9edd('0x46')]?_0x5c0627[_0x9edd('0x45')]:_0x1cbbac['model'];if(!_0x1be77f[_0x9edd('0x40')]['hasOwnProperty']('nolimit')){_0x5c0627[_0x9edd('0x2c')]=qs[_0x9edd('0x2c')](_0x1be77f[_0x9edd('0x40')][_0x9edd('0x2c')]);_0x5c0627[_0x9edd('0x2b')]=qs[_0x9edd('0x2b')](_0x1be77f[_0x9edd('0x40')][_0x9edd('0x2b')]);}_0x5c0627[_0x9edd('0x47')]=qs[_0x9edd('0x48')](_0x1be77f[_0x9edd('0x40')][_0x9edd('0x48')]);_0x5c0627[_0x9edd('0x49')]=qs[_0x9edd('0x42')](_[_0x9edd('0x4a')](_0x1be77f['query'],_0x1cbbac[_0x9edd('0x42')]),_0x35c16f);if(_0x1be77f[_0x9edd('0x40')][_0x9edd('0x4b')]){_0x5c0627[_0x9edd('0x49')]=_[_0x9edd('0x4c')](_0x5c0627[_0x9edd('0x49')],{'$or':_[_0x9edd('0x4d')](_0x35c16f,function(_0x4e9ad1){if(_0x4e9ad1['type']!=='VIRTUAL'){var _0x4a7dc9={};_0x4a7dc9[_0x4e9ad1['name']]={'$like':'%'+_0x1be77f[_0x9edd('0x40')][_0x9edd('0x4b')]+'%'};return _0x4a7dc9;}})});}_0x5c0627=_[_0x9edd('0x4c')]({},_0x5c0627,_0x1be77f[_0x9edd('0x4e')]);var _0x367791={'where':_0x5c0627['where']};return db[_0x9edd('0x3c')][_0x9edd('0x2a')](_0x367791)[_0x9edd('0x33')](function(_0x4a89ae){_0x1ccee8[_0x9edd('0x2a')]=_0x4a89ae;if(_0x1be77f[_0x9edd('0x40')][_0x9edd('0x4f')]){_0x5c0627[_0x9edd('0x50')]=[{'all':!![]}];}return db[_0x9edd('0x3c')][_0x9edd('0x51')](_0x5c0627);})['then'](function(_0x441e4a){_0x1ccee8[_0x9edd('0x52')]=_0x441e4a;return _0x1ccee8;})['then'](respondWithFilteredResult(_0x337e6c,_0x5c0627))[_0x9edd('0x53')](handleError(_0x337e6c,null));};exports[_0x9edd('0x54')]=function(_0x4bb324,_0x2bd089){var _0x8134cd={'raw':![],'where':{'id':_0x4bb324['params']['id']}},_0x468239={};_0x468239[_0x9edd('0x3f')]=_[_0x9edd('0x41')](db[_0x9edd('0x3c')][_0x9edd('0x55')]);_0x468239['query']=_[_0x9edd('0x41')](_0x4bb324[_0x9edd('0x40')]);_0x468239[_0x9edd('0x42')]=_['intersection'](_0x468239[_0x9edd('0x3f')],_0x468239[_0x9edd('0x40')]);_0x8134cd['attributes']=_[_0x9edd('0x43')](_0x468239['model'],qs[_0x9edd('0x44')](_0x4bb324[_0x9edd('0x40')][_0x9edd('0x44')]));_0x8134cd[_0x9edd('0x45')]=_0x8134cd[_0x9edd('0x45')][_0x9edd('0x46')]?_0x8134cd[_0x9edd('0x45')]:_0x468239[_0x9edd('0x3f')];if(_0x4bb324[_0x9edd('0x40')][_0x9edd('0x4f')]){_0x8134cd[_0x9edd('0x50')]=[{'all':!![]}];}_0x8134cd=_['merge']({},_0x8134cd,_0x4bb324[_0x9edd('0x4e')]);return db[_0x9edd('0x3c')][_0x9edd('0x56')](_0x8134cd)['then'](handleEntityNotFound(_0x2bd089,null))[_0x9edd('0x33')](respondWithResult(_0x2bd089,null))['catch'](handleError(_0x2bd089,null));};exports['create']=function(_0x54ecfa,_0x1348a7,_0x45f47c){var _0x366316;return db[_0x9edd('0x3c')]['create'](_0x54ecfa['body'],{'raw':!![]})['then'](function(_0x71820f){_0x366316=_0x71820f;return db[_0x9edd('0x3c')][_0x9edd('0x51')]({'raw':!![]});})[_0x9edd('0x33')](function(_0x2e2920){var _0x41ec97=fs[_0x9edd('0x57')](path[_0x9edd('0x58')](config['root'],_0x9edd('0x59')),'utf8');var _0x421e82=ejs[_0x9edd('0x5a')](_0x41ec97,{'contexts':_0x2e2920||[]});fs['writeFileSync'](_0x9edd('0x5b'),_0x421e82);})[_0x9edd('0x33')](function(){return respondWithRpcPromise(_0x9edd('0x5c'),'create',{'module':_0x9edd('0x5d')});})[_0x9edd('0x33')](function(){var _0x430eb4=_0x54ecfa[_0x9edd('0x5e')][_0x9edd('0x35')]({'plain':!![]});if(!_0x430eb4)throw new Error(_0x9edd('0x5f'));if(_0x430eb4['role']==='user'){var _0x452ca5=_0x366316['get']({'plain':!![]});return db[_0x9edd('0x60')][_0x9edd('0x56')]({'where':{'name':_0x9edd('0x36'),'userProfileId':_0x430eb4[_0x9edd('0x61')]},'raw':!![]})['then'](function(_0x21ead2){if(_0x21ead2&&_0x21ead2['autoAssociation']===0x0){return db[_0x9edd('0x37')][_0x9edd('0x62')]({'name':_0x452ca5[_0x9edd('0x39')],'resourceId':_0x452ca5['id'],'type':_0x21ead2['name'],'sectionId':_0x21ead2['id']},{})[_0x9edd('0x33')](function(){return _0x366316;});}else{return _0x366316;}})['catch'](function(_0x37e603){logger[_0x9edd('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37e603);throw _0x37e603;});}return _0x366316;})[_0x9edd('0x33')](respondWithResult(_0x1348a7,0xc9))['catch'](handleError(_0x1348a7,null));};exports[_0x9edd('0x63')]=function(_0x134c9c,_0x307a61,_0x50f4fc){var _0x4181b9;return db[_0x9edd('0x3c')][_0x9edd('0x56')]({'where':{'id':_0x134c9c[_0x9edd('0x64')]['id']}})[_0x9edd('0x33')](handleEntityNotFound(_0x307a61,null))['then'](saveUpdates(_0x134c9c['body'],null))[_0x9edd('0x33')](function(_0x211526){if(_0x211526){_0x4181b9=_0x211526;return db['VoiceContext']['findAll']({'raw':!![]});}})['then'](function(_0x1bc89b){var _0x4e003a=fs['readFileSync'](path[_0x9edd('0x58')](config[_0x9edd('0x65')],'server/files/templates/context.ejs'),_0x9edd('0x66'));var _0x11e082=ejs[_0x9edd('0x5a')](_0x4e003a,{'contexts':_0x1bc89b||[]});fs['writeFileSync'](_0x9edd('0x5b'),_0x11e082);})['then'](function(){return respondWithRpcPromise(_0x9edd('0x5c'),_0x9edd('0x63'),{'module':'chan_sip.so'});})[_0x9edd('0x33')](function(){return _0x4181b9;})[_0x9edd('0x33')](respondWithResult(_0x307a61,null))['catch'](handleError(_0x307a61,null));};exports[_0x9edd('0x34')]=function(_0x475dc3,_0x460a92,_0x1d9536){var _0x5ce70b;return db[_0x9edd('0x3c')]['find']({'where':{'id':_0x475dc3[_0x9edd('0x64')]['id']}})[_0x9edd('0x33')](handleEntityNotFound(_0x460a92,null))[_0x9edd('0x33')](removeEntity(_0x460a92,null))['then'](function(){return db[_0x9edd('0x3c')][_0x9edd('0x51')]({'raw':!![]});})[_0x9edd('0x33')](function(_0x383cb9){var _0x25626a=fs[_0x9edd('0x57')](path[_0x9edd('0x58')](config['root'],'server/files/templates/context.ejs'),_0x9edd('0x66'));var _0x3c7874=ejs[_0x9edd('0x5a')](_0x25626a,{'contexts':_0x383cb9});fs[_0x9edd('0x67')](_0x9edd('0x5b'),_0x3c7874);return respondWithRpcPromise('Reload',_0x9edd('0x34'),{'module':_0x9edd('0x5d')});})[_0x9edd('0x53')](handleError(_0x460a92,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 513ebc9..7349160 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 _0xa9e0=['../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1624c5,_0x5c3a0d){var _0x18c17a=function(_0x51aa70){while(--_0x51aa70){_0x1624c5['push'](_0x1624c5['shift']());}};_0x18c17a(++_0x5c3a0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 +var _0x9957=['exports','define','VoiceContext','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceContext.attributes'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index f5e58f2..923e714 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 _0xf27b=['code','error','VoiceContext,\x20%s,\x20%s','message','info','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x54fb92,_0x5b0c8a){var _0x25e5c2=function(_0x5840a1){while(--_0x5840a1){_0x54fb92['push'](_0x54fb92['shift']());}};_0x25e5c2(++_0x5b0c8a);}(_0xf27b,0xf9));var _0xbf27=function(_0x58ceb9,_0x5601df){_0x58ceb9=_0x58ceb9-0x0;var _0x3d0ff5=_0xf27b[_0x58ceb9];return _0x3d0ff5;};'use strict';var _=require(_0xbf27('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbf27('0x1'));var rs=require(_0xbf27('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf27('0x3'))['db'];var utils=require(_0xbf27('0x4'));var logger=require(_0xbf27('0x5'))(_0xbf27('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbf27('0x7')][_0xbf27('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x164d8f,_0xcd5c16,_0x129b46){return new BPromise(function(_0x205d55,_0x8fc4f9){return client[_0xbf27('0x9')](_0x164d8f,_0x129b46)[_0xbf27('0xa')](function(_0x4bb77b){logger['info']('VoiceContext,\x20%s,\x20%s',_0xcd5c16,_0xbf27('0xb'));logger[_0xbf27('0xc')](_0xbf27('0xd'),_0xcd5c16,_0xbf27('0xb'),JSON[_0xbf27('0xe')](_0x4bb77b));if(_0x4bb77b['error']){if(_0x4bb77b['error'][_0xbf27('0xf')]===0x1f4){logger[_0xbf27('0x10')](_0xbf27('0x11'),_0xcd5c16,_0x4bb77b[_0xbf27('0x10')][_0xbf27('0x12')]);return _0x8fc4f9(_0x4bb77b[_0xbf27('0x10')][_0xbf27('0x12')]);}logger[_0xbf27('0x10')](_0xbf27('0x11'),_0xcd5c16,_0x4bb77b[_0xbf27('0x10')][_0xbf27('0x12')]);return _0x205d55(_0x4bb77b[_0xbf27('0x10')][_0xbf27('0x12')]);}else{logger[_0xbf27('0x13')]('VoiceContext,\x20%s,\x20%s',_0xcd5c16,_0xbf27('0xb'));_0x205d55(_0x4bb77b[_0xbf27('0x14')][_0xbf27('0x12')]);}})[_0xbf27('0x15')](function(_0x57b519){logger[_0xbf27('0x10')](_0xbf27('0x11'),_0xcd5c16,_0x57b519);_0x8fc4f9(_0x57b519);});});} \ No newline at end of file +var _0x2c5f=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','lodash','util'];(function(_0x37fbdb,_0x1398be){var _0x961251=function(_0x3135c2){while(--_0x3135c2){_0x37fbdb['push'](_0x37fbdb['shift']());}};_0x961251(++_0x1398be);}(_0x2c5f,0x139));var _0xf2c5=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x2c5f[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0xf2c5('0x0'));var util=require(_0xf2c5('0x1'));var moment=require('moment');var BPromise=require(_0xf2c5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf2c5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf2c5('0x4'));var logger=require(_0xf2c5('0x5'))(_0xf2c5('0x6'));var config=require(_0xf2c5('0x7'));var jayson=require(_0xf2c5('0x8'));var client=jayson[_0xf2c5('0x9')][_0xf2c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46aa37,_0x878714,_0x31996c){return new BPromise(function(_0xc382fb,_0x3bdbde){return client[_0xf2c5('0xb')](_0x46aa37,_0x31996c)[_0xf2c5('0xc')](function(_0x439993){logger[_0xf2c5('0xd')](_0xf2c5('0xe'),_0x878714,_0xf2c5('0xf'));logger[_0xf2c5('0x10')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x878714,'request\x20sent',JSON['stringify'](_0x439993));if(_0x439993['error']){if(_0x439993['error'][_0xf2c5('0x11')]===0x1f4){logger[_0xf2c5('0x12')](_0xf2c5('0xe'),_0x878714,_0x439993['error'][_0xf2c5('0x13')]);return _0x3bdbde(_0x439993[_0xf2c5('0x12')][_0xf2c5('0x13')]);}logger[_0xf2c5('0x12')]('VoiceContext,\x20%s,\x20%s',_0x878714,_0x439993['error'][_0xf2c5('0x13')]);return _0xc382fb(_0x439993[_0xf2c5('0x12')][_0xf2c5('0x13')]);}else{logger[_0xf2c5('0xd')](_0xf2c5('0xe'),_0x878714,_0xf2c5('0xf'));_0xc382fb(_0x439993[_0xf2c5('0x14')]['message']);}})['catch'](function(_0xa62afc){logger[_0xf2c5('0x12')](_0xf2c5('0xe'),_0x878714,_0xa62afc);_0x3bdbde(_0xa62afc);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 7655f04..7e528e9 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 _0x7670=['./voiceDialReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x5dcfdd,_0x433346){var _0x101ff2=function(_0x23ec19){while(--_0x23ec19){_0x5dcfdd['push'](_0x5dcfdd['shift']());}};_0x101ff2(++_0x433346);}(_0x7670,0xad));var _0x0767=function(_0x500649,_0x669569){_0x500649=_0x500649-0x0;var _0xec40d8=_0x7670[_0x500649];return _0xec40d8;};'use strict';var multer=require(_0x0767('0x0'));var util=require(_0x0767('0x1'));var path=require(_0x0767('0x2'));var timeout=require(_0x0767('0x3'));var express=require(_0x0767('0x4'));var router=express[_0x0767('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0767('0x6'));var config=require('../../config/environment');var controller=require(_0x0767('0x7'));router[_0x0767('0x8')]('/',auth[_0x0767('0x9')](),controller['index']);router[_0x0767('0x8')](_0x0767('0xa'),auth['isAuthenticated'](),controller[_0x0767('0xb')]);router[_0x0767('0x8')](_0x0767('0xc'),auth[_0x0767('0x9')](),controller[_0x0767('0xd')]);router[_0x0767('0xe')]('/',auth[_0x0767('0x9')](),controller[_0x0767('0xf')]);router['put'](_0x0767('0xc'),auth[_0x0767('0x9')](),controller[_0x0767('0x10')]);router[_0x0767('0x11')](_0x0767('0xc'),auth[_0x0767('0x9')](),controller[_0x0767('0x12')]);module[_0x0767('0x13')]=router; \ No newline at end of file +var _0x00a7=['isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','get','index','/describe'];(function(_0x55d0fd,_0x1b1bdd){var _0x40ce6f=function(_0x282df9){while(--_0x282df9){_0x55d0fd['push'](_0x55d0fd['shift']());}};_0x40ce6f(++_0x1b1bdd);}(_0x00a7,0xaa));var _0x700a=function(_0x4a094b,_0x44ce3e){_0x4a094b=_0x4a094b-0x0;var _0x594b90=_0x00a7[_0x4a094b];return _0x594b90;};'use strict';var multer=require(_0x700a('0x0'));var util=require(_0x700a('0x1'));var path=require(_0x700a('0x2'));var timeout=require('connect-timeout');var express=require(_0x700a('0x3'));var router=express[_0x700a('0x4')]();var auth=require(_0x700a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x700a('0x6'));var controller=require('./voiceDialReport.controller');router[_0x700a('0x7')]('/',auth['isAuthenticated'](),controller[_0x700a('0x8')]);router[_0x700a('0x7')](_0x700a('0x9'),auth[_0x700a('0xa')](),controller[_0x700a('0xb')]);router[_0x700a('0x7')](_0x700a('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x700a('0xd')]('/',auth[_0x700a('0xa')](),controller[_0x700a('0xe')]);router[_0x700a('0xf')](_0x700a('0xc'),auth[_0x700a('0xa')](),controller[_0x700a('0x10')]);router[_0x700a('0x11')]('/:id',auth[_0x700a('0xa')](),controller[_0x700a('0x12')]);module[_0x700a('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 8cf5272..e5e2f00 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 _0xb054=['sequelize','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x3685be,_0x5f43db){var _0x2a26ae=function(_0x1bf6f6){while(--_0x1bf6f6){_0x3685be['push'](_0x3685be['shift']());}};_0x2a26ae(++_0x5f43db);}(_0xb054,0x1b3));var _0x4b05=function(_0x254d93,_0x250b89){_0x254d93=_0x254d93-0x0;var _0x467a51=_0xb054[_0x254d93];return _0x467a51;};'use strict';var Sequelize=require(_0x4b05('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x4b05('0x1')]},'channel':{'type':Sequelize[_0x4b05('0x1')]},'channelstate':{'type':Sequelize[_0x4b05('0x2')]},'channelstatedesc':{'type':Sequelize[_0x4b05('0x1')]},'calleridnum':{'type':Sequelize[_0x4b05('0x1')]},'calleridname':{'type':Sequelize[_0x4b05('0x1')]},'connectedlinenum':{'type':Sequelize[_0x4b05('0x1')]},'connectedlinename':{'type':Sequelize[_0x4b05('0x1')]},'language':{'type':Sequelize[_0x4b05('0x1')]},'accountcode':{'type':Sequelize[_0x4b05('0x1')]},'context':{'type':Sequelize[_0x4b05('0x1')]},'exten':{'type':Sequelize[_0x4b05('0x1')]},'priority':{'type':Sequelize[_0x4b05('0x2')]},'uniqueid':{'type':Sequelize[_0x4b05('0x1')]},'linkedid':{'type':Sequelize[_0x4b05('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x4b05('0x1')]},'destcalleridname':{'type':Sequelize[_0x4b05('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x4b05('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x4b05('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x4b05('0x1')]},'destcontext':{'type':Sequelize[_0x4b05('0x1')]},'destexten':{'type':Sequelize[_0x4b05('0x1')]},'destpriority':{'type':Sequelize[_0x4b05('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x4b05('0x1')]},'dialstring':{'type':Sequelize[_0x4b05('0x1')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x4b05('0x3')]},'answertime':{'type':Sequelize[_0x4b05('0x3')]},'endtime':{'type':Sequelize[_0x4b05('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x4b05('0x4')},'routeId':{'type':Sequelize[_0x4b05('0x2')]},'duration':{'type':Sequelize[_0x4b05('0x2')]},'holdtime':{'type':Sequelize[_0x4b05('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x35ec=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x1afcb1,_0x1395ac){var _0x277bd6=function(_0x1866e2){while(--_0x1866e2){_0x1afcb1['push'](_0x1afcb1['shift']());}};_0x277bd6(++_0x1395ac);}(_0x35ec,0xb2));var _0xc35e=function(_0x3aeb07,_0x5a7cbb){_0x3aeb07=_0x3aeb07-0x0;var _0x3c0ef5=_0x35ec[_0x3aeb07];return _0x3c0ef5;};'use strict';var Sequelize=require(_0xc35e('0x0'));module[_0xc35e('0x1')]={'privilege':{'type':Sequelize[_0xc35e('0x2')]},'channel':{'type':Sequelize[_0xc35e('0x2')]},'channelstate':{'type':Sequelize[_0xc35e('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xc35e('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc35e('0x2')]},'connectedlinename':{'type':Sequelize[_0xc35e('0x2')]},'language':{'type':Sequelize[_0xc35e('0x2')]},'accountcode':{'type':Sequelize[_0xc35e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xc35e('0x2')]},'priority':{'type':Sequelize[_0xc35e('0x3')]},'uniqueid':{'type':Sequelize[_0xc35e('0x2')]},'linkedid':{'type':Sequelize[_0xc35e('0x2')]},'destchannel':{'type':Sequelize[_0xc35e('0x2')]},'destchannelstate':{'type':Sequelize[_0xc35e('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xc35e('0x2')]},'destcalleridnum':{'type':Sequelize[_0xc35e('0x2')]},'destcalleridname':{'type':Sequelize[_0xc35e('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xc35e('0x2')]},'destlanguage':{'type':Sequelize[_0xc35e('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xc35e('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xc35e('0x3')]},'destuniqueid':{'type':Sequelize[_0xc35e('0x2')]},'destlinkedid':{'type':Sequelize[_0xc35e('0x2')]},'dialstring':{'type':Sequelize[_0xc35e('0x2')]},'dialstatus':{'type':Sequelize[_0xc35e('0x2')]},'starttime':{'type':Sequelize[_0xc35e('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xc35e('0x4')]},'lastevent':{'type':Sequelize[_0xc35e('0x2')],'comment':_0xc35e('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xc35e('0x3')]},'holdtime':{'type':Sequelize[_0xc35e('0x3')]},'billableseconds':{'type':Sequelize[_0xc35e('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 3235713..87c1deb 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 _0xf5f8=['mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','index','rawAttributes','fieldName','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','VoiceDialReport','include','findAll','rows','show','keys','includeAll','find','catch','create','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x2d4661,_0x2da65c){var _0x42ed1e=function(_0x263c50){while(--_0x263c50){_0x2d4661['push'](_0x2d4661['shift']());}};_0x42ed1e(++_0x2da65c);}(_0xf5f8,0x1bb));var _0x8f5f=function(_0x5ba4da,_0x3cb35c){_0x5ba4da=_0x5ba4da-0x0;var _0x269e6b=_0xf5f8[_0x5ba4da];return _0x269e6b;};'use strict';var pdf=require(_0x8f5f('0x0'));var emlformat=require(_0x8f5f('0x1'));var rimraf=require(_0x8f5f('0x2'));var zipdir=require(_0x8f5f('0x3'));var jsonpatch=require(_0x8f5f('0x4'));var rp=require(_0x8f5f('0x5'));var moment=require(_0x8f5f('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x8f5f('0x7'));var util=require(_0x8f5f('0x8'));var path=require(_0x8f5f('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8f5f('0xa'));var fs=require('fs');var _=require(_0x8f5f('0xb'));var squel=require(_0x8f5f('0xc'));var crypto=require(_0x8f5f('0xd'));var jsforce=require(_0x8f5f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8f5f('0xf'));var querystring=require(_0x8f5f('0x10'));var Papa=require(_0x8f5f('0x11'));var Redis=require(_0x8f5f('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8f5f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8f5f('0x14'))(_0x8f5f('0x15'));var utils=require(_0x8f5f('0x16'));var config=require(_0x8f5f('0x17'));var db=require(_0x8f5f('0x18'))['db'];function respondWithStatusCode(_0x121865,_0x57b983){_0x57b983=_0x57b983||0xcc;return function(_0x2991a4){if(_0x2991a4){return _0x121865[_0x8f5f('0x19')](_0x57b983);}return _0x121865['status'](_0x57b983)['end']();};}function respondWithResult(_0x172b52,_0x4ec807){_0x4ec807=_0x4ec807||0xc8;return function(_0x50fdc0){if(_0x50fdc0){return _0x172b52[_0x8f5f('0x1a')](_0x4ec807)[_0x8f5f('0x1b')](_0x50fdc0);}};}function respondWithFilteredResult(_0x2861f3,_0x325d3c){return function(_0x378933){if(_0x378933){var _0x2beb54=_0x378933[_0x8f5f('0x1c')],_0x470e83=_0x325d3c['offset'],_0x3077f9=_0x325d3c[_0x8f5f('0x1d')]+_0x325d3c[_0x8f5f('0x1e')],_0x1afcb9;if(_0x3077f9>=_0x2beb54){_0x3077f9=_0x2beb54;_0x1afcb9=0xc8;}else{_0x1afcb9=0xce;}_0x2861f3[_0x8f5f('0x1a')](_0x1afcb9);return _0x2861f3[_0x8f5f('0x1f')](_0x8f5f('0x20'),_0x470e83+'-'+_0x3077f9+'/'+_0x2beb54)[_0x8f5f('0x1b')](_0x378933);}return null;};}function patchUpdates(_0x4250d5){return function(_0x47581d){try{jsonpatch[_0x8f5f('0x21')](_0x47581d,_0x4250d5,!![]);}catch(_0x3ebc13){return BPromise[_0x8f5f('0x22')](_0x3ebc13);}return _0x47581d[_0x8f5f('0x23')]();};}function saveUpdates(_0x3f8dd6,_0x3e8c2d){return function(_0x1c97a8){if(_0x1c97a8){return _0x1c97a8[_0x8f5f('0x24')](_0x3f8dd6)['then'](function(_0x12ed25){return _0x12ed25;});}return null;};}function removeEntity(_0x5e5007,_0xc0f360){return function(_0x49ea67){if(_0x49ea67){return _0x49ea67['destroy']()[_0x8f5f('0x25')](function(){_0x5e5007[_0x8f5f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2007e8,_0x56c6b5){return function(_0x426191){if(!_0x426191){_0x2007e8[_0x8f5f('0x19')](0x194);}return _0x426191;};}function handleError(_0xcf935f,_0x160736){_0x160736=_0x160736||0x1f4;return function(_0x29b34a){logger[_0x8f5f('0x26')](_0x29b34a['stack']);if(_0x29b34a[_0x8f5f('0x27')]){delete _0x29b34a[_0x8f5f('0x27')];}_0xcf935f['status'](_0x160736)[_0x8f5f('0x28')](_0x29b34a);};}exports[_0x8f5f('0x29')]=function(_0x512b9b,_0x230f79){var _0x464d83={},_0x2f9e06={},_0x1dfe9d={'count':0x0,'rows':[]};var _0x5356d7=_['map'](db['VoiceDialReport'][_0x8f5f('0x2a')],function(_0x49e817){return{'name':_0x49e817[_0x8f5f('0x2b')],'type':_0x49e817['type']['key']};});_0x2f9e06[_0x8f5f('0x2c')]=_[_0x8f5f('0x2d')](_0x5356d7,_0x8f5f('0x27'));_0x2f9e06['query']=_['keys'](_0x512b9b[_0x8f5f('0x2e')]);_0x2f9e06[_0x8f5f('0x2f')]=_[_0x8f5f('0x30')](_0x2f9e06[_0x8f5f('0x2c')],_0x2f9e06['query']);_0x464d83['attributes']=_[_0x8f5f('0x30')](_0x2f9e06[_0x8f5f('0x2c')],qs[_0x8f5f('0x31')](_0x512b9b[_0x8f5f('0x2e')][_0x8f5f('0x31')]));_0x464d83[_0x8f5f('0x32')]=_0x464d83[_0x8f5f('0x32')][_0x8f5f('0x33')]?_0x464d83[_0x8f5f('0x32')]:_0x2f9e06['model'];if(!_0x512b9b[_0x8f5f('0x2e')][_0x8f5f('0x34')](_0x8f5f('0x35'))){_0x464d83['limit']=qs[_0x8f5f('0x1e')](_0x512b9b[_0x8f5f('0x2e')][_0x8f5f('0x1e')]);_0x464d83[_0x8f5f('0x1d')]=qs[_0x8f5f('0x1d')](_0x512b9b['query']['offset']);}_0x464d83[_0x8f5f('0x36')]=qs[_0x8f5f('0x37')](_0x512b9b[_0x8f5f('0x2e')][_0x8f5f('0x37')]);_0x464d83['where']=qs['filters'](_['pick'](_0x512b9b[_0x8f5f('0x2e')],_0x2f9e06[_0x8f5f('0x2f')]),_0x5356d7);if(_0x512b9b[_0x8f5f('0x2e')][_0x8f5f('0x38')]){_0x464d83[_0x8f5f('0x39')]=_[_0x8f5f('0x3a')](_0x464d83['where'],{'$or':_[_0x8f5f('0x2d')](_0x5356d7,function(_0x5630ac){if(_0x5630ac['type']!==_0x8f5f('0x3b')){var _0x2f1506={};_0x2f1506[_0x5630ac[_0x8f5f('0x27')]]={'$like':'%'+_0x512b9b[_0x8f5f('0x2e')][_0x8f5f('0x38')]+'%'};return _0x2f1506;}})});}_0x464d83=_[_0x8f5f('0x3a')]({},_0x464d83,_0x512b9b[_0x8f5f('0x3c')]);var _0x472f65={'where':_0x464d83[_0x8f5f('0x39')]};return db[_0x8f5f('0x3d')][_0x8f5f('0x1c')](_0x472f65)[_0x8f5f('0x25')](function(_0x50c4d2){_0x1dfe9d['count']=_0x50c4d2;if(_0x512b9b['query']['includeAll']){_0x464d83[_0x8f5f('0x3e')]=[{'all':!![]}];}return db[_0x8f5f('0x3d')][_0x8f5f('0x3f')](_0x464d83);})['then'](function(_0x2f71fb){_0x1dfe9d[_0x8f5f('0x40')]=_0x2f71fb;return _0x1dfe9d;})[_0x8f5f('0x25')](respondWithFilteredResult(_0x230f79,_0x464d83))['catch'](handleError(_0x230f79,null));};exports[_0x8f5f('0x41')]=function(_0x2c059a,_0xe51254){var _0x462912={'raw':!![],'where':{'id':_0x2c059a['params']['id']}},_0x390fe8={};_0x390fe8[_0x8f5f('0x2c')]=_[_0x8f5f('0x42')](db[_0x8f5f('0x3d')][_0x8f5f('0x2a')]);_0x390fe8[_0x8f5f('0x2e')]=_[_0x8f5f('0x42')](_0x2c059a['query']);_0x390fe8['filters']=_['intersection'](_0x390fe8[_0x8f5f('0x2c')],_0x390fe8[_0x8f5f('0x2e')]);_0x462912['attributes']=_[_0x8f5f('0x30')](_0x390fe8[_0x8f5f('0x2c')],qs[_0x8f5f('0x31')](_0x2c059a[_0x8f5f('0x2e')][_0x8f5f('0x31')]));_0x462912[_0x8f5f('0x32')]=_0x462912[_0x8f5f('0x32')]['length']?_0x462912[_0x8f5f('0x32')]:_0x390fe8['model'];if(_0x2c059a[_0x8f5f('0x2e')][_0x8f5f('0x43')]){_0x462912[_0x8f5f('0x3e')]=[{'all':!![]}];}_0x462912=_[_0x8f5f('0x3a')]({},_0x462912,_0x2c059a[_0x8f5f('0x3c')]);return db['VoiceDialReport'][_0x8f5f('0x44')](_0x462912)['then'](handleEntityNotFound(_0xe51254,null))[_0x8f5f('0x25')](respondWithResult(_0xe51254,null))[_0x8f5f('0x45')](handleError(_0xe51254,null));};exports[_0x8f5f('0x46')]=function(_0x44b071,_0x15af41){return db[_0x8f5f('0x3d')][_0x8f5f('0x46')](_0x44b071[_0x8f5f('0x47')],{})[_0x8f5f('0x25')](respondWithResult(_0x15af41,0xc9))[_0x8f5f('0x45')](handleError(_0x15af41,null));};exports[_0x8f5f('0x24')]=function(_0x523806,_0x4ee2d2){if(_0x523806[_0x8f5f('0x47')]['id']){delete _0x523806['body']['id'];}return db['VoiceDialReport'][_0x8f5f('0x44')]({'where':{'id':_0x523806[_0x8f5f('0x48')]['id']}})[_0x8f5f('0x25')](handleEntityNotFound(_0x4ee2d2,null))[_0x8f5f('0x25')](saveUpdates(_0x523806[_0x8f5f('0x47')],null))['then'](respondWithResult(_0x4ee2d2,null))[_0x8f5f('0x45')](handleError(_0x4ee2d2,null));};exports[_0x8f5f('0x49')]=function(_0x2e264b,_0x55d788){return db[_0x8f5f('0x3d')]['find']({'where':{'id':_0x2e264b['params']['id']}})['then'](handleEntityNotFound(_0x55d788,null))['then'](removeEntity(_0x55d788,null))['catch'](handleError(_0x55d788,null));};exports['describe']=function(_0x13d72b,_0x47f2bd){return db[_0x8f5f('0x3d')][_0x8f5f('0x4a')]()[_0x8f5f('0x25')](respondWithResult(_0x47f2bd,null))[_0x8f5f('0x45')](handleError(_0x47f2bd,null));}; \ No newline at end of file +var _0x180b=['rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','name','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','filter','merge','VoiceDialReport','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','html-pdf','eml-format'];(function(_0x594119,_0x50e4ac){var _0x4a5238=function(_0x13f2b0){while(--_0x13f2b0){_0x594119['push'](_0x594119['shift']());}};_0x4a5238(++_0x50e4ac);}(_0x180b,0xdc));var _0xb180=function(_0x3477a8,_0x340d4e){_0x3477a8=_0x3477a8-0x0;var _0x40b0d8=_0x180b[_0x3477a8];return _0x40b0d8;};'use strict';var pdf=require(_0xb180('0x0'));var emlformat=require(_0xb180('0x1'));var rimraf=require(_0xb180('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb180('0x3'));var rp=require(_0xb180('0x4'));var moment=require(_0xb180('0x5'));var BPromise=require(_0xb180('0x6'));var Mustache=require(_0xb180('0x7'));var util=require(_0xb180('0x8'));var path=require(_0xb180('0x9'));var sox=require(_0xb180('0xa'));var csv=require(_0xb180('0xb'));var ejs=require(_0xb180('0xc'));var fs=require('fs');var _=require(_0xb180('0xd'));var squel=require(_0xb180('0xe'));var crypto=require(_0xb180('0xf'));var jsforce=require(_0xb180('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb180('0x11'));var Papa=require(_0xb180('0x12'));var Redis=require(_0xb180('0x13'));var authService=require(_0xb180('0x14'));var qs=require(_0xb180('0x15'));var as=require(_0xb180('0x16'));var hardwareService=require(_0xb180('0x17'));var logger=require(_0xb180('0x18'))(_0xb180('0x19'));var utils=require(_0xb180('0x1a'));var config=require(_0xb180('0x1b'));var db=require(_0xb180('0x1c'))['db'];function respondWithStatusCode(_0x169832,_0x2a5ac4){_0x2a5ac4=_0x2a5ac4||0xcc;return function(_0x130f55){if(_0x130f55){return _0x169832['sendStatus'](_0x2a5ac4);}return _0x169832[_0xb180('0x1d')](_0x2a5ac4)['end']();};}function respondWithResult(_0xea455b,_0x576be9){_0x576be9=_0x576be9||0xc8;return function(_0x356511){if(_0x356511){return _0xea455b[_0xb180('0x1d')](_0x576be9)[_0xb180('0x1e')](_0x356511);}};}function respondWithFilteredResult(_0x5aa0ff,_0x233df0){return function(_0x1f5e08){if(_0x1f5e08){var _0x28fa22=_0x1f5e08[_0xb180('0x1f')],_0x1edee6=_0x233df0[_0xb180('0x20')],_0x3cbe74=_0x233df0['offset']+_0x233df0[_0xb180('0x21')],_0x3441ac;if(_0x3cbe74>=_0x28fa22){_0x3cbe74=_0x28fa22;_0x3441ac=0xc8;}else{_0x3441ac=0xce;}_0x5aa0ff[_0xb180('0x1d')](_0x3441ac);return _0x5aa0ff[_0xb180('0x22')](_0xb180('0x23'),_0x1edee6+'-'+_0x3cbe74+'/'+_0x28fa22)['json'](_0x1f5e08);}return null;};}function patchUpdates(_0x24cc3f){return function(_0x1c72f9){try{jsonpatch['apply'](_0x1c72f9,_0x24cc3f,!![]);}catch(_0x1a4454){return BPromise[_0xb180('0x24')](_0x1a4454);}return _0x1c72f9[_0xb180('0x25')]();};}function saveUpdates(_0x30d6a4,_0x161f3b){return function(_0x38f920){if(_0x38f920){return _0x38f920[_0xb180('0x26')](_0x30d6a4)[_0xb180('0x27')](function(_0x198209){return _0x198209;});}return null;};}function removeEntity(_0x10a025,_0x4db30d){return function(_0x5c8193){if(_0x5c8193){return _0x5c8193[_0xb180('0x28')]()['then'](function(){_0x10a025['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x295d47,_0x11b0ab){return function(_0xe7b6ba){if(!_0xe7b6ba){_0x295d47[_0xb180('0x29')](0x194);}return _0xe7b6ba;};}function handleError(_0x3a6eef,_0x2a2b25){_0x2a2b25=_0x2a2b25||0x1f4;return function(_0x3f9e11){logger['error'](_0x3f9e11['stack']);if(_0x3f9e11['name']){delete _0x3f9e11[_0xb180('0x2a')];}_0x3a6eef[_0xb180('0x1d')](_0x2a2b25)['send'](_0x3f9e11);};}exports['index']=function(_0x2af889,_0x5af1c6){var _0x262c63={},_0x4a3c68={},_0x57a94a={'count':0x0,'rows':[]};var _0x112132=_['map'](db['VoiceDialReport'][_0xb180('0x2b')],function(_0x3f0bea){return{'name':_0x3f0bea[_0xb180('0x2c')],'type':_0x3f0bea[_0xb180('0x2d')][_0xb180('0x2e')]};});_0x4a3c68[_0xb180('0x2f')]=_[_0xb180('0x30')](_0x112132,_0xb180('0x2a'));_0x4a3c68['query']=_[_0xb180('0x31')](_0x2af889['query']);_0x4a3c68[_0xb180('0x32')]=_[_0xb180('0x33')](_0x4a3c68[_0xb180('0x2f')],_0x4a3c68[_0xb180('0x34')]);_0x262c63[_0xb180('0x35')]=_[_0xb180('0x33')](_0x4a3c68[_0xb180('0x2f')],qs[_0xb180('0x36')](_0x2af889[_0xb180('0x34')][_0xb180('0x36')]));_0x262c63['attributes']=_0x262c63['attributes'][_0xb180('0x37')]?_0x262c63[_0xb180('0x35')]:_0x4a3c68[_0xb180('0x2f')];if(!_0x2af889[_0xb180('0x34')]['hasOwnProperty'](_0xb180('0x38'))){_0x262c63['limit']=qs[_0xb180('0x21')](_0x2af889[_0xb180('0x34')][_0xb180('0x21')]);_0x262c63[_0xb180('0x20')]=qs[_0xb180('0x20')](_0x2af889[_0xb180('0x34')][_0xb180('0x20')]);}_0x262c63[_0xb180('0x39')]=qs['sort'](_0x2af889[_0xb180('0x34')][_0xb180('0x3a')]);_0x262c63[_0xb180('0x3b')]=qs[_0xb180('0x32')](_['pick'](_0x2af889['query'],_0x4a3c68[_0xb180('0x32')]),_0x112132);if(_0x2af889[_0xb180('0x34')][_0xb180('0x3c')]){_0x262c63[_0xb180('0x3b')]=_['merge'](_0x262c63[_0xb180('0x3b')],{'$or':_[_0xb180('0x30')](_0x112132,function(_0x3367a6){if(_0x3367a6[_0xb180('0x2d')]!=='VIRTUAL'){var _0x22888a={};_0x22888a[_0x3367a6[_0xb180('0x2a')]]={'$like':'%'+_0x2af889[_0xb180('0x34')][_0xb180('0x3c')]+'%'};return _0x22888a;}})});}_0x262c63=_[_0xb180('0x3d')]({},_0x262c63,_0x2af889['options']);var _0x41b2e0={'where':_0x262c63[_0xb180('0x3b')]};return db[_0xb180('0x3e')][_0xb180('0x1f')](_0x41b2e0)[_0xb180('0x27')](function(_0xc636a6){_0x57a94a[_0xb180('0x1f')]=_0xc636a6;if(_0x2af889[_0xb180('0x34')][_0xb180('0x3f')]){_0x262c63[_0xb180('0x40')]=[{'all':!![]}];}return db[_0xb180('0x3e')][_0xb180('0x41')](_0x262c63);})[_0xb180('0x27')](function(_0x3ff19c){_0x57a94a[_0xb180('0x42')]=_0x3ff19c;return _0x57a94a;})[_0xb180('0x27')](respondWithFilteredResult(_0x5af1c6,_0x262c63))[_0xb180('0x43')](handleError(_0x5af1c6,null));};exports[_0xb180('0x44')]=function(_0x215de0,_0x36f6ed){var _0x2c613d={'raw':!![],'where':{'id':_0x215de0[_0xb180('0x45')]['id']}},_0x149712={};_0x149712[_0xb180('0x2f')]=_['keys'](db['VoiceDialReport'][_0xb180('0x2b')]);_0x149712['query']=_[_0xb180('0x31')](_0x215de0['query']);_0x149712[_0xb180('0x32')]=_[_0xb180('0x33')](_0x149712[_0xb180('0x2f')],_0x149712[_0xb180('0x34')]);_0x2c613d[_0xb180('0x35')]=_[_0xb180('0x33')](_0x149712['model'],qs[_0xb180('0x36')](_0x215de0[_0xb180('0x34')][_0xb180('0x36')]));_0x2c613d[_0xb180('0x35')]=_0x2c613d[_0xb180('0x35')]['length']?_0x2c613d[_0xb180('0x35')]:_0x149712[_0xb180('0x2f')];if(_0x215de0[_0xb180('0x34')][_0xb180('0x3f')]){_0x2c613d[_0xb180('0x40')]=[{'all':!![]}];}_0x2c613d=_[_0xb180('0x3d')]({},_0x2c613d,_0x215de0[_0xb180('0x46')]);return db[_0xb180('0x3e')][_0xb180('0x47')](_0x2c613d)[_0xb180('0x27')](handleEntityNotFound(_0x36f6ed,null))[_0xb180('0x27')](respondWithResult(_0x36f6ed,null))['catch'](handleError(_0x36f6ed,null));};exports[_0xb180('0x48')]=function(_0x4dc90f,_0x187cb7){return db[_0xb180('0x3e')]['create'](_0x4dc90f[_0xb180('0x49')],{})[_0xb180('0x27')](respondWithResult(_0x187cb7,0xc9))[_0xb180('0x43')](handleError(_0x187cb7,null));};exports[_0xb180('0x26')]=function(_0x2103bb,_0x3c404d){if(_0x2103bb['body']['id']){delete _0x2103bb['body']['id'];}return db[_0xb180('0x3e')][_0xb180('0x47')]({'where':{'id':_0x2103bb[_0xb180('0x45')]['id']}})[_0xb180('0x27')](handleEntityNotFound(_0x3c404d,null))[_0xb180('0x27')](saveUpdates(_0x2103bb[_0xb180('0x49')],null))[_0xb180('0x27')](respondWithResult(_0x3c404d,null))['catch'](handleError(_0x3c404d,null));};exports['destroy']=function(_0x26d180,_0x46e9f0){return db['VoiceDialReport'][_0xb180('0x47')]({'where':{'id':_0x26d180[_0xb180('0x45')]['id']}})[_0xb180('0x27')](handleEntityNotFound(_0x46e9f0,null))[_0xb180('0x27')](removeEntity(_0x46e9f0,null))[_0xb180('0x43')](handleError(_0x46e9f0,null));};exports['describe']=function(_0x3e35d2,_0x17a0df){return db['VoiceDialReport']['describe']()['then'](respondWithResult(_0x17a0df,null))['catch'](handleError(_0x17a0df,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index e027a7d..26aec7b 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 _0xf82b=['moment','bluebird','request-promise','path','define','report_dial','uniqueid','lodash','util','../../config/logger'];(function(_0x28902f,_0x2a8dbf){var _0x4a4f6d=function(_0x21ece8){while(--_0x21ece8){_0x28902f['push'](_0x28902f['shift']());}};_0x4a4f6d(++_0x2a8dbf);}(_0xf82b,0xf7));var _0xbf82=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf82b[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xbf82('0x0'));var util=require(_0xbf82('0x1'));var logger=require(_0xbf82('0x2'))('api');var moment=require(_0xbf82('0x3'));var BPromise=require(_0xbf82('0x4'));var rp=require(_0xbf82('0x5'));var fs=require('fs');var path=require(_0xbf82('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x3db96c,_0x112b6d){return _0x3db96c[_0xbf82('0x7')]('VoiceDialReport',attributes,{'tableName':_0xbf82('0x8'),'paranoid':![],'indexes':[{'fields':[_0xbf82('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x56e4=['./voiceDialReport.attributes','exports','define','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5dc625,_0x543807){var _0x41d611=function(_0x43dcb4){while(--_0x43dcb4){_0x5dc625['push'](_0x5dc625['shift']());}};_0x41d611(++_0x543807);}(_0x56e4,0x16d));var _0x456e=function(_0x311a26,_0x3af2bf){_0x311a26=_0x311a26-0x0;var _0x258269=_0x56e4[_0x311a26];return _0x258269;};'use strict';var _=require(_0x456e('0x0'));var util=require(_0x456e('0x1'));var logger=require(_0x456e('0x2'))(_0x456e('0x3'));var moment=require(_0x456e('0x4'));var BPromise=require(_0x456e('0x5'));var rp=require(_0x456e('0x6'));var fs=require('fs');var path=require(_0x456e('0x7'));var rimraf=require(_0x456e('0x8'));var config=require(_0x456e('0x9'));var attributes=require(_0x456e('0xa'));module[_0x456e('0xb')]=function(_0x60a11b,_0x2c7dd8){return _0x60a11b[_0x456e('0xc')]('VoiceDialReport',attributes,{'tableName':_0x456e('0xd'),'paranoid':![],'indexes':[{'fields':[_0x456e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 8d87df4..c7fcc91 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 _0xd0b5=['catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','update','attributes','limit','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result'];(function(_0x4c687a,_0x227569){var _0x43b6e0=function(_0x157013){while(--_0x157013){_0x4c687a['push'](_0x4c687a['shift']());}};_0x43b6e0(++_0x227569);}(_0xd0b5,0x1b8));var _0x5d0b=function(_0x51136c,_0x2161c9){_0x51136c=_0x51136c-0x0;var _0x588202=_0xd0b5[_0x51136c];return _0x588202;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5d0b('0x0'));var BPromise=require(_0x5d0b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d0b('0x2'));var db=require(_0x5d0b('0x3'))['db'];var utils=require(_0x5d0b('0x4'));var logger=require(_0x5d0b('0x5'))(_0x5d0b('0x6'));var config=require(_0x5d0b('0x7'));var jayson=require(_0x5d0b('0x8'));var client=jayson[_0x5d0b('0x9')][_0x5d0b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1db3b1,_0x2582f3,_0x1407d6){return new BPromise(function(_0x226be8,_0x59be08){return client[_0x5d0b('0xb')](_0x1db3b1,_0x1407d6)['then'](function(_0x5550fa){logger[_0x5d0b('0xc')](_0x5d0b('0xd'),_0x2582f3,'request\x20sent');logger[_0x5d0b('0xe')](_0x5d0b('0xf'),_0x2582f3,'request\x20sent',JSON[_0x5d0b('0x10')](_0x5550fa));if(_0x5550fa[_0x5d0b('0x11')]){if(_0x5550fa[_0x5d0b('0x11')][_0x5d0b('0x12')]===0x1f4){logger[_0x5d0b('0x11')](_0x5d0b('0xd'),_0x2582f3,_0x5550fa['error'][_0x5d0b('0x13')]);return _0x59be08(_0x5550fa[_0x5d0b('0x11')][_0x5d0b('0x13')]);}logger[_0x5d0b('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x2582f3,_0x5550fa[_0x5d0b('0x11')][_0x5d0b('0x13')]);return _0x226be8(_0x5550fa['error'][_0x5d0b('0x13')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x2582f3,_0x5d0b('0x14'));_0x226be8(_0x5550fa[_0x5d0b('0x15')][_0x5d0b('0x13')]);}})[_0x5d0b('0x16')](function(_0x4892a4){logger[_0x5d0b('0x11')](_0x5d0b('0xd'),_0x2582f3,_0x4892a4);_0x59be08(_0x4892a4);});});}exports[_0x5d0b('0x17')]=function(_0x32f522){var _0x292b30=this;return new Promise(function(_0x2299ad,_0x1aaed9){return db[_0x5d0b('0x18')][_0x5d0b('0x19')](_0x32f522[_0x5d0b('0x1a')],{'raw':_0x32f522[_0x5d0b('0x1b')]?_0x32f522[_0x5d0b('0x1b')][_0x5d0b('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4c6fb2){logger[_0x5d0b('0xc')](_0x5d0b('0x17'),_0x32f522);logger[_0x5d0b('0xe')](_0x5d0b('0x17'),_0x32f522,JSON[_0x5d0b('0x10')](_0x4c6fb2));_0x2299ad(_0x4c6fb2);})['catch'](function(_0xd710a9){logger[_0x5d0b('0x11')]('CreateVoiceDialReport',_0xd710a9[_0x5d0b('0x13')],_0x32f522);_0x1aaed9(_0x292b30[_0x5d0b('0x11')](0x1f4,_0xd710a9[_0x5d0b('0x13')]));});});};exports[_0x5d0b('0x1d')]=function(_0x49a5bb){var _0x4a6f66=this;return new Promise(function(_0x2c0928,_0x24c044){return db[_0x5d0b('0x18')][_0x5d0b('0x1e')](_0x49a5bb[_0x5d0b('0x1a')],{'raw':_0x49a5bb[_0x5d0b('0x1b')]?_0x49a5bb[_0x5d0b('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49a5bb[_0x5d0b('0x1b')]?_0x49a5bb['options']['where']||null:null,'attributes':_0x49a5bb[_0x5d0b('0x1b')]?_0x49a5bb[_0x5d0b('0x1b')][_0x5d0b('0x1f')]||null:null,'limit':_0x49a5bb['options']?_0x49a5bb[_0x5d0b('0x1b')][_0x5d0b('0x20')]||null:null})['then'](function(_0x20e28b){logger[_0x5d0b('0xc')](_0x5d0b('0x1d'),_0x49a5bb);logger['debug'](_0x5d0b('0x1d'),_0x49a5bb,JSON[_0x5d0b('0x10')](_0x20e28b));_0x2c0928(_0x20e28b);})[_0x5d0b('0x16')](function(_0x15e1b1){logger[_0x5d0b('0x11')](_0x5d0b('0x1d'),_0x15e1b1['message'],_0x49a5bb);_0x24c044(_0x4a6f66[_0x5d0b('0x11')](0x1f4,_0x15e1b1[_0x5d0b('0x13')]));});});}; \ No newline at end of file +var _0xa477=['VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','catch','UpdateVoiceDialReport','update','where','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x3d9581,_0x52383f){var _0x29c6aa=function(_0x536dac){while(--_0x536dac){_0x3d9581['push'](_0x3d9581['shift']());}};_0x29c6aa(++_0x52383f);}(_0xa477,0xe6));var _0x7a47=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xa477[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x7a47('0x0'));var util=require(_0x7a47('0x1'));var moment=require('moment');var BPromise=require(_0x7a47('0x2'));var rs=require(_0x7a47('0x3'));var fs=require('fs');var Redis=require(_0x7a47('0x4'));var db=require(_0x7a47('0x5'))['db'];var utils=require(_0x7a47('0x6'));var logger=require(_0x7a47('0x7'))(_0x7a47('0x8'));var config=require('../../config/environment');var jayson=require(_0x7a47('0x9'));var client=jayson[_0x7a47('0xa')][_0x7a47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c6e0e,_0x54e9aa,_0x47f594){return new BPromise(function(_0x4276ed,_0x49db4c){return client[_0x7a47('0xc')](_0x4c6e0e,_0x47f594)[_0x7a47('0xd')](function(_0x52eb49){logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,_0x7a47('0x10'));logger[_0x7a47('0x11')](_0x7a47('0x12'),_0x54e9aa,'request\x20sent',JSON[_0x7a47('0x13')](_0x52eb49));if(_0x52eb49[_0x7a47('0x14')]){if(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x15')]===0x1f4){logger['error'](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);return _0x49db4c(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')]['message']);return _0x4276ed(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}else{logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,'request\x20sent');_0x4276ed(_0x52eb49[_0x7a47('0x17')][_0x7a47('0x16')]);}})['catch'](function(_0x4a81fb){logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x4a81fb);_0x49db4c(_0x4a81fb);});});}exports[_0x7a47('0x18')]=function(_0x5a4e79){var _0x444c48=this;return new Promise(function(_0x4a24b6,_0x203ab4){return db[_0x7a47('0x19')][_0x7a47('0x1a')](_0x5a4e79[_0x7a47('0x1b')],{'raw':_0x5a4e79[_0x7a47('0x1c')]?_0x5a4e79[_0x7a47('0x1c')][_0x7a47('0x1d')]===undefined?!![]:![]:!![]})[_0x7a47('0xd')](function(_0x46e58d){logger['info'](_0x7a47('0x18'),_0x5a4e79);logger[_0x7a47('0x11')](_0x7a47('0x18'),_0x5a4e79,JSON[_0x7a47('0x13')](_0x46e58d));_0x4a24b6(_0x46e58d);})[_0x7a47('0x1e')](function(_0x322426){logger[_0x7a47('0x14')](_0x7a47('0x18'),_0x322426[_0x7a47('0x16')],_0x5a4e79);_0x203ab4(_0x444c48[_0x7a47('0x14')](0x1f4,_0x322426[_0x7a47('0x16')]));});});};exports[_0x7a47('0x1f')]=function(_0x4ec7ff){var _0x4ef642=this;return new Promise(function(_0xcc1c6a,_0x2c2c43){return db[_0x7a47('0x19')][_0x7a47('0x20')](_0x4ec7ff['body'],{'raw':_0x4ec7ff[_0x7a47('0x1c')]?_0x4ec7ff[_0x7a47('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ec7ff[_0x7a47('0x1c')]?_0x4ec7ff[_0x7a47('0x1c')][_0x7a47('0x21')]||null:null,'attributes':_0x4ec7ff[_0x7a47('0x1c')]?_0x4ec7ff[_0x7a47('0x1c')]['attributes']||null:null,'limit':_0x4ec7ff[_0x7a47('0x1c')]?_0x4ec7ff[_0x7a47('0x1c')][_0x7a47('0x22')]||null:null})[_0x7a47('0xd')](function(_0x5e99ab){logger['info']('UpdateVoiceDialReport',_0x4ec7ff);logger[_0x7a47('0x11')](_0x7a47('0x1f'),_0x4ec7ff,JSON[_0x7a47('0x13')](_0x5e99ab));_0xcc1c6a(_0x5e99ab);})[_0x7a47('0x1e')](function(_0x1b6ea6){logger[_0x7a47('0x14')](_0x7a47('0x1f'),_0x1b6ea6[_0x7a47('0x16')],_0x4ec7ff);_0x2c2c43(_0x4ef642[_0x7a47('0x14')](0x1f4,_0x1b6ea6[_0x7a47('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index bb740fe..afeec9c 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 _0x67b0=['post','create','/:id/applications','addApplications','put','update','delete','/:id','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated'];(function(_0x1081a3,_0x2ac784){var _0x5696a2=function(_0x23d2f6){while(--_0x23d2f6){_0x1081a3['push'](_0x1081a3['shift']());}};_0x5696a2(++_0x2ac784);}(_0x67b0,0xda));var _0x067b=function(_0x31219a,_0x45bf6c){_0x31219a=_0x31219a-0x0;var _0x16f25c=_0x67b0[_0x31219a];return _0x16f25c;};'use strict';var multer=require(_0x067b('0x0'));var util=require(_0x067b('0x1'));var path=require('path');var timeout=require(_0x067b('0x2'));var express=require(_0x067b('0x3'));var router=express[_0x067b('0x4')]();var auth=require(_0x067b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x067b('0x6'));var controller=require(_0x067b('0x7'));router[_0x067b('0x8')]('/',auth[_0x067b('0x9')](),controller['index']);router[_0x067b('0x8')]('/:id',auth[_0x067b('0x9')](),controller['show']);router[_0x067b('0xa')]('/',auth['isAuthenticated'](),controller[_0x067b('0xb')]);router[_0x067b('0xa')](_0x067b('0xc'),auth['isAuthenticated'](),controller[_0x067b('0xd')]);router[_0x067b('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x067b('0xf')]);router[_0x067b('0x10')](_0x067b('0x11'),auth[_0x067b('0x9')](),controller['destroy']);module[_0x067b('0x12')]=router; \ No newline at end of file +var _0x32b1=['delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./voiceExtension.controller','isAuthenticated','get','/:id','show','post','create','/:id/applications','put','update'];(function(_0x173316,_0x3f700e){var _0x568fb6=function(_0x456b79){while(--_0x456b79){_0x173316['push'](_0x173316['shift']());}};_0x568fb6(++_0x3f700e);}(_0x32b1,0x146));var _0x132b=function(_0x2207a0,_0xa4fea6){_0x2207a0=_0x2207a0-0x0;var _0x2d002b=_0x32b1[_0x2207a0];return _0x2d002b;};'use strict';var multer=require(_0x132b('0x0'));var util=require(_0x132b('0x1'));var path=require(_0x132b('0x2'));var timeout=require(_0x132b('0x3'));var express=require('express');var router=express[_0x132b('0x4')]();var auth=require(_0x132b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x132b('0x6'));router['get']('/',auth[_0x132b('0x7')](),controller['index']);router[_0x132b('0x8')](_0x132b('0x9'),auth['isAuthenticated'](),controller[_0x132b('0xa')]);router[_0x132b('0xb')]('/',auth[_0x132b('0x7')](),controller[_0x132b('0xc')]);router[_0x132b('0xb')](_0x132b('0xd'),auth['isAuthenticated'](),controller['addApplications']);router[_0x132b('0xe')](_0x132b('0x9'),auth[_0x132b('0x7')](),controller[_0x132b('0xf')]);router[_0x132b('0x10')](_0x132b('0x9'),auth[_0x132b('0x7')](),controller['destroy']);module[_0x132b('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index a4a8e68..c93f260 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(_0x596c13,_0x145337){var _0x24873f=function(_0x5d5ed3){while(--_0x5d5ed3){_0x596c13['push'](_0x596c13['shift']());}};_0x24873f(++_0x145337);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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(_0x4c23a3,_0x52e5f8){var _0x4113fa=function(_0x13ef8b){while(--_0x13ef8b){_0x4c23a3['push'](_0x4c23a3['shift']());}};_0x4113fa(++_0x52e5f8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 b3401f7..e638141 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 _0x0295=['where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','params','body','startsWith','exten','create','role','user','internal','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','context','recordingFormat','mandatoryDisposition','addApplications','sequelize','bulkCreate','cast(priority\x20as\x20unsigned)','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','./voiceExtension.socket','register','sendStatus','status','end','json','count','offset','Content-Range','reject','update','then','get','OutboundRoutes','outbound','InternalRoutes','filter','map','value','type','find','name','destroy','stack','index','VoiceExtension','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort'];(function(_0x2d7367,_0x202384){var _0x1584da=function(_0x506fd2){while(--_0x506fd2){_0x2d7367['push'](_0x2d7367['shift']());}};_0x1584da(++_0x202384);}(_0x0295,0x1f0));var _0x5029=function(_0x5a26db,_0x2c5ccd){_0x5a26db=_0x5a26db-0x0;var _0x4619dd=_0x0295[_0x5a26db];return _0x4619dd;};'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);function respondWithStatusCode(_0x12c237,_0x434630){_0x434630=_0x434630||0xcc;return function(_0x2c0b33){if(_0x2c0b33){return _0x12c237[_0x5029('0x18')](_0x434630);}return _0x12c237[_0x5029('0x19')](_0x434630)[_0x5029('0x1a')]();};}function respondWithResult(_0x10bf55,_0x326923){_0x326923=_0x326923||0xc8;return function(_0x457c73){if(_0x457c73){return _0x10bf55[_0x5029('0x19')](_0x326923)[_0x5029('0x1b')](_0x457c73);}};}function respondWithFilteredResult(_0x2c273c,_0x343918){return function(_0x4f7ab4){if(_0x4f7ab4){var _0x1ed567=_0x4f7ab4[_0x5029('0x1c')],_0x31a155=_0x343918[_0x5029('0x1d')],_0x35de81=_0x343918[_0x5029('0x1d')]+_0x343918['limit'],_0x4902f3;if(_0x35de81>=_0x1ed567){_0x35de81=_0x1ed567;_0x4902f3=0xc8;}else{_0x4902f3=0xce;}_0x2c273c[_0x5029('0x19')](_0x4902f3);return _0x2c273c['set'](_0x5029('0x1e'),_0x31a155+'-'+_0x35de81+'/'+_0x1ed567)[_0x5029('0x1b')](_0x4f7ab4);}return null;};}function patchUpdates(_0x2710aa){return function(_0x3cf0fb){try{jsonpatch['apply'](_0x3cf0fb,_0x2710aa,!![]);}catch(_0x47ecca){return BPromise[_0x5029('0x1f')](_0x47ecca);}return _0x3cf0fb['save']();};}function saveUpdates(_0x3f657d,_0x853a34){return function(_0x1eb228){if(_0x1eb228){return _0x1eb228[_0x5029('0x20')](_0x3f657d)[_0x5029('0x21')](function(_0x3a3e52){return _0x3a3e52;});}return null;};}function removeEntity(_0x125c26,_0x356dac){return function(_0x3e857d){if(_0x3e857d){return _0x3e857d['destroy']()['then'](function(){var _0x49f347=_0x3e857d[_0x5029('0x22')]({'plain':!![]});var _0x45666c=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x5029('0x23'),'value':_0x5029('0x24'),'ignore':![]},{'name':_0x5029('0x25'),'value':'internal','ignore':![]}];var _0x2c501f=_(_0x45666c)[_0x5029('0x26')]('ignore')[_0x5029('0x27')](_0x5029('0x28'))[_0x5029('0x28')]();if(_['includes'](_0x2c501f,_0x49f347[_0x5029('0x29')])){return;}var _0x251f99=_[_0x5029('0x2a')](_0x45666c,['value',_0x49f347[_0x5029('0x29')]])[_0x5029('0x2b')];return db['UserProfileResource'][_0x5029('0x2c')]({'where':{'type':_0x251f99,'resourceId':_0x49f347['id']}})[_0x5029('0x21')](function(){return _0x3e857d;});})[_0x5029('0x21')](function(){_0x125c26[_0x5029('0x19')](0xcc)[_0x5029('0x1a')]();});}};}function handleEntityNotFound(_0x2a1ed6,_0x44255a){return function(_0x465153){if(!_0x465153){_0x2a1ed6[_0x5029('0x18')](0x194);}return _0x465153;};}function handleError(_0x22559a,_0x358a2b){_0x358a2b=_0x358a2b||0x1f4;return function(_0x4519c8){logger['error'](_0x4519c8[_0x5029('0x2d')]);if(_0x4519c8['name']){delete _0x4519c8[_0x5029('0x2b')];}_0x22559a['status'](_0x358a2b)['send'](_0x4519c8);};}exports[_0x5029('0x2e')]=function(_0x447680,_0x1f9173){var _0x4b7330={},_0x2a1535={},_0x15d882={'count':0x0,'rows':[]};var _0x3f20fb=_[_0x5029('0x27')](db[_0x5029('0x2f')][_0x5029('0x30')],function(_0x46ec59){return{'name':_0x46ec59[_0x5029('0x31')],'type':_0x46ec59[_0x5029('0x29')]['key']};});_0x2a1535[_0x5029('0x32')]=_[_0x5029('0x27')](_0x3f20fb,_0x5029('0x2b'));_0x2a1535[_0x5029('0x33')]=_['keys'](_0x447680[_0x5029('0x33')]);_0x2a1535[_0x5029('0x34')]=_[_0x5029('0x35')](_0x2a1535['model'],_0x2a1535['query']);_0x4b7330[_0x5029('0x36')]=_[_0x5029('0x35')](_0x2a1535['model'],qs['fields'](_0x447680[_0x5029('0x33')][_0x5029('0x37')]));_0x4b7330[_0x5029('0x36')]=_0x4b7330[_0x5029('0x36')][_0x5029('0x38')]?_0x4b7330[_0x5029('0x36')]:_0x2a1535[_0x5029('0x32')];if(!_0x447680[_0x5029('0x33')][_0x5029('0x39')](_0x5029('0x3a'))){_0x4b7330[_0x5029('0x3b')]=qs[_0x5029('0x3b')](_0x447680[_0x5029('0x33')][_0x5029('0x3b')]);_0x4b7330['offset']=qs['offset'](_0x447680[_0x5029('0x33')][_0x5029('0x1d')]);}_0x4b7330[_0x5029('0x3c')]=qs['sort'](_0x447680[_0x5029('0x33')][_0x5029('0x3d')]);_0x4b7330['where']=qs[_0x5029('0x34')](_['pick'](_0x447680[_0x5029('0x33')],_0x2a1535['filters']),_0x3f20fb);if(_0x447680[_0x5029('0x33')][_0x5029('0x26')]){_0x4b7330[_0x5029('0x3e')]=_[_0x5029('0x3f')](_0x4b7330[_0x5029('0x3e')],{'$or':_[_0x5029('0x27')](_0x3f20fb,function(_0x4b2219){if(_0x4b2219[_0x5029('0x29')]!==_0x5029('0x40')){var _0x5a3e4d={};_0x5a3e4d[_0x4b2219[_0x5029('0x2b')]]={'$like':'%'+_0x447680[_0x5029('0x33')][_0x5029('0x26')]+'%'};return _0x5a3e4d;}})});}_0x4b7330=_[_0x5029('0x3f')]({},_0x4b7330,_0x447680[_0x5029('0x41')]);var _0x11ac2e={'where':_0x4b7330['where']};return db[_0x5029('0x2f')][_0x5029('0x1c')](_0x11ac2e)[_0x5029('0x21')](function(_0x1d6c1f){_0x15d882[_0x5029('0x1c')]=_0x1d6c1f;if(_0x447680['query'][_0x5029('0x42')]){_0x4b7330[_0x5029('0x43')]=[{'all':!![]}];}return db[_0x5029('0x2f')][_0x5029('0x44')](_0x4b7330);})[_0x5029('0x21')](function(_0x128aff){_0x15d882[_0x5029('0x45')]=_0x128aff;return _0x15d882;})[_0x5029('0x21')](respondWithFilteredResult(_0x1f9173,_0x4b7330))[_0x5029('0x46')](handleError(_0x1f9173,null));};exports['show']=function(_0x32d0fa,_0x27d2ad){var _0x3e64cf={'raw':![],'where':{'id':_0x32d0fa['params']['id']}},_0xdb3e78={};_0xdb3e78['model']=_[_0x5029('0x47')](db[_0x5029('0x2f')][_0x5029('0x30')]);_0xdb3e78[_0x5029('0x33')]=_[_0x5029('0x47')](_0x32d0fa[_0x5029('0x33')]);_0xdb3e78[_0x5029('0x34')]=_[_0x5029('0x35')](_0xdb3e78[_0x5029('0x32')],_0xdb3e78[_0x5029('0x33')]);_0x3e64cf[_0x5029('0x36')]=_[_0x5029('0x35')](_0xdb3e78[_0x5029('0x32')],qs[_0x5029('0x37')](_0x32d0fa[_0x5029('0x33')][_0x5029('0x37')]));_0x3e64cf[_0x5029('0x36')]=_0x3e64cf[_0x5029('0x36')][_0x5029('0x38')]?_0x3e64cf[_0x5029('0x36')]:_0xdb3e78[_0x5029('0x32')];if(_0x32d0fa['query'][_0x5029('0x42')]){_0x3e64cf['include']=[{'all':!![]}];}_0x3e64cf=_[_0x5029('0x3f')]({},_0x3e64cf,_0x32d0fa[_0x5029('0x41')]);return db['VoiceExtension']['find'](_0x3e64cf)[_0x5029('0x21')](handleEntityNotFound(_0x27d2ad,null))['then'](respondWithResult(_0x27d2ad,null))['catch'](handleError(_0x27d2ad,null));};exports[_0x5029('0x2c')]=function(_0x8d2eed,_0x2e4c4e){return db['VoiceExtension']['find']({'where':{'id':_0x8d2eed[_0x5029('0x48')]['id']}})[_0x5029('0x21')](handleEntityNotFound(_0x2e4c4e,null))['then'](removeEntity(_0x2e4c4e,null))[_0x5029('0x46')](handleError(_0x2e4c4e,null));};exports['create']=function(_0xacd94e,_0x5f1e4f){if(_0xacd94e[_0x5029('0x49')][_0x5029('0x29')]===_0x5029('0x24')&&!_[_0x5029('0x4a')](_0xacd94e[_0x5029('0x49')][_0x5029('0x4b')],'_')){_0xacd94e[_0x5029('0x49')][_0x5029('0x4b')]='_'['concat'](_0xacd94e[_0x5029('0x49')]['exten']);}return db[_0x5029('0x2f')][_0x5029('0x4c')](_0xacd94e['body'],{'raw':![]})[_0x5029('0x21')](function(_0x4e51b5){var _0x58928f=_0xacd94e['user'][_0x5029('0x22')]({'plain':!![]});if(!_0x58928f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58928f[_0x5029('0x4d')]===_0x5029('0x4e')){var _0x21d747=_0x4e51b5['get']({'plain':!![]});var _0xb43232=[{'name':'InboundRoutes','value':'inbound'},{'name':_0x5029('0x23'),'value':_0x5029('0x24')},{'name':_0x5029('0x25'),'value':_0x5029('0x4f')}];var _0x164179=_['find'](_0xb43232,[_0x5029('0x28'),_0x21d747[_0x5029('0x29')]])[_0x5029('0x2b')];return db[_0x5029('0x50')]['find']({'where':{'name':_0x164179,'userProfileId':_0x58928f[_0x5029('0x51')]},'raw':!![]})[_0x5029('0x21')](function(_0x4d4a2d){if(_0x4d4a2d&&_0x4d4a2d['autoAssociation']===0x0){return db[_0x5029('0x52')][_0x5029('0x4c')]({'name':_0x21d747[_0x5029('0x2b')],'resourceId':_0x21d747['id'],'type':_0x4d4a2d[_0x5029('0x2b')],'sectionId':_0x4d4a2d['id']},{})['then'](function(){return _0x4e51b5;});}else{return _0x4e51b5;}})[_0x5029('0x46')](function(_0xb43d95){logger[_0x5029('0x53')](_0x5029('0x54'),_0xb43d95);throw _0xb43d95;});}return _0x4e51b5;})[_0x5029('0x21')](respondWithResult(_0x5f1e4f,0xc9))[_0x5029('0x46')](handleError(_0x5f1e4f,null));};exports['update']=function(_0x560324,_0x4314c0){if(_0x560324[_0x5029('0x49')]['id']){delete _0x560324[_0x5029('0x49')]['id'];}return db['VoiceExtension'][_0x5029('0x2a')]({'where':{'id':_0x560324[_0x5029('0x48')]['id']}})[_0x5029('0x21')](handleEntityNotFound(_0x4314c0,null))[_0x5029('0x21')](function(_0x151663){if(_0x151663){return db['VoiceExtension'][_0x5029('0x20')](_[_0x5029('0x55')](_0x560324[_0x5029('0x49')],['exten',_0x5029('0x56'),'description',_0x5029('0x57'),'cutdigits',_0x5029('0x58')]),{'where':{'context':_0x151663[_0x5029('0x56')],'exten':_0x151663[_0x5029('0x4b')]},'individualHooks':!![]})[_0x5029('0x21')](function(_0x1d2a67){return _0x1d2a67;});}return null;})[_0x5029('0x21')](respondWithStatusCode(_0x4314c0,null))['catch'](handleError(_0x4314c0,null));};exports[_0x5029('0x59')]=function(_0x19220d,_0x1ff8df,_0x151562){return db[_0x5029('0x2f')]['findOne']({'where':{'id':_0x19220d[_0x5029('0x48')]['id']}})['then'](handleEntityNotFound(_0x1ff8df,null))[_0x5029('0x21')](function(_0x539f80){if(_0x539f80){return db[_0x5029('0x5a')]['transaction'](function(_0x1c339e){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x19220d[_0x5029('0x48')]['id']},'transaction':_0x1c339e})['then'](function(_0x2d2a40){var _0xd0175d=_[_0x5029('0x27')](_0x19220d['body'],function(_0x234831){_0x234831['VoiceExtensionId']=_0x19220d[_0x5029('0x48')]['id'];return _0x234831;});return db[_0x5029('0x2f')][_0x5029('0x5b')](_0xd0175d,{'transaction':_0x1c339e});});})[_0x5029('0x21')](function(){return db[_0x5029('0x2f')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x19220d[_0x5029('0x48')]['id']},'order':_0x5029('0x5c')});});}})['then'](respondWithResult(_0x1ff8df,null))[_0x5029('0x46')](handleError(_0x1ff8df,null));}; \ No newline at end of file +var _0x6d38=['eml-format','rimraf','zip-dir','moment','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','count','offset','apply','reject','then','destroy','get','InboundRoutes','outbound','InternalRoutes','ignore','map','value','includes','type','find','name','UserProfileResource','stack','send','index','VoiceExtension','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','nolimit','limit','order','sort','pick','where','VIRTUAL','filter','merge','includeAll','include','findAll','catch','params','length','create','startsWith','body','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','OutboundRoutes','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','recordingFormat','cutdigits','mandatoryDisposition','context','addApplications','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','cast(priority\x20as\x20unsigned)'];(function(_0x308944,_0x1c462e){var _0x2bf805=function(_0x1e6564){while(--_0x1e6564){_0x308944['push'](_0x308944['shift']());}};_0x2bf805(++_0x1c462e);}(_0x6d38,0x1ef));var _0x86d3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6d38[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x86d3('0x0'));var rimraf=require(_0x86d3('0x1'));var zipdir=require(_0x86d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x86d3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x86d3('0x4'));var util=require(_0x86d3('0x5'));var path=require(_0x86d3('0x6'));var sox=require('sox');var csv=require(_0x86d3('0x7'));var ejs=require(_0x86d3('0x8'));var fs=require('fs');var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0x7'));var querystring=require(_0x86d3('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xd'));var qs=require(_0x86d3('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0xf'))(_0x86d3('0x10'));var utils=require('../../config/utils');var config=require(_0x86d3('0x11'));var db=require('../../mysqldb')['db'];config[_0x86d3('0x12')]=_[_0x86d3('0x13')](config[_0x86d3('0x12')],{'host':_0x86d3('0x14'),'port':0x18eb});var socket=require(_0x86d3('0x15'))(new Redis(config[_0x86d3('0x12')]));require(_0x86d3('0x16'))[_0x86d3('0x17')](socket);function respondWithStatusCode(_0x5ce2ff,_0x1c1ba8){_0x1c1ba8=_0x1c1ba8||0xcc;return function(_0x1f35cf){if(_0x1f35cf){return _0x5ce2ff[_0x86d3('0x18')](_0x1c1ba8);}return _0x5ce2ff[_0x86d3('0x19')](_0x1c1ba8)[_0x86d3('0x1a')]();};}function respondWithResult(_0x34fb3b,_0x1ff008){_0x1ff008=_0x1ff008||0xc8;return function(_0x44436d){if(_0x44436d){return _0x34fb3b['status'](_0x1ff008)[_0x86d3('0x1b')](_0x44436d);}};}function respondWithFilteredResult(_0x281da0,_0x431b3f){return function(_0xa26ea2){if(_0xa26ea2){var _0x46feec=_0xa26ea2[_0x86d3('0x1c')],_0x120ef3=_0x431b3f['offset'],_0x33e459=_0x431b3f[_0x86d3('0x1d')]+_0x431b3f['limit'],_0x32dee7;if(_0x33e459>=_0x46feec){_0x33e459=_0x46feec;_0x32dee7=0xc8;}else{_0x32dee7=0xce;}_0x281da0[_0x86d3('0x19')](_0x32dee7);return _0x281da0['set']('Content-Range',_0x120ef3+'-'+_0x33e459+'/'+_0x46feec)[_0x86d3('0x1b')](_0xa26ea2);}return null;};}function patchUpdates(_0x1edb6d){return function(_0x988066){try{jsonpatch[_0x86d3('0x1e')](_0x988066,_0x1edb6d,!![]);}catch(_0x5654ab){return BPromise[_0x86d3('0x1f')](_0x5654ab);}return _0x988066['save']();};}function saveUpdates(_0x36e0fa,_0x3fdf67){return function(_0x1ce849){if(_0x1ce849){return _0x1ce849['update'](_0x36e0fa)[_0x86d3('0x20')](function(_0x72b3d4){return _0x72b3d4;});}return null;};}function removeEntity(_0x1fa4ac,_0x4bf5b8){return function(_0x58ba51){if(_0x58ba51){return _0x58ba51[_0x86d3('0x21')]()['then'](function(){var _0x3c93d3=_0x58ba51[_0x86d3('0x22')]({'plain':!![]});var _0x3dfecd=[{'name':_0x86d3('0x23'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0x86d3('0x24'),'ignore':![]},{'name':_0x86d3('0x25'),'value':'internal','ignore':![]}];var _0x14e325=_(_0x3dfecd)['filter'](_0x86d3('0x26'))[_0x86d3('0x27')](_0x86d3('0x28'))[_0x86d3('0x28')]();if(_[_0x86d3('0x29')](_0x14e325,_0x3c93d3[_0x86d3('0x2a')])){return;}var _0x1f203e=_[_0x86d3('0x2b')](_0x3dfecd,[_0x86d3('0x28'),_0x3c93d3[_0x86d3('0x2a')]])[_0x86d3('0x2c')];return db[_0x86d3('0x2d')][_0x86d3('0x21')]({'where':{'type':_0x1f203e,'resourceId':_0x3c93d3['id']}})[_0x86d3('0x20')](function(){return _0x58ba51;});})['then'](function(){_0x1fa4ac[_0x86d3('0x19')](0xcc)[_0x86d3('0x1a')]();});}};}function handleEntityNotFound(_0x2bda35,_0x31cefe){return function(_0x7709f0){if(!_0x7709f0){_0x2bda35[_0x86d3('0x18')](0x194);}return _0x7709f0;};}function handleError(_0x4a5ff0,_0xba2f49){_0xba2f49=_0xba2f49||0x1f4;return function(_0x5c71df){logger['error'](_0x5c71df[_0x86d3('0x2e')]);if(_0x5c71df[_0x86d3('0x2c')]){delete _0x5c71df[_0x86d3('0x2c')];}_0x4a5ff0['status'](_0xba2f49)[_0x86d3('0x2f')](_0x5c71df);};}exports[_0x86d3('0x30')]=function(_0x5b8fdd,_0x5505b6){var _0x375264={},_0x414f34={},_0x476eb3={'count':0x0,'rows':[]};var _0x1196b6=_[_0x86d3('0x27')](db[_0x86d3('0x31')][_0x86d3('0x32')],function(_0x541309){return{'name':_0x541309['fieldName'],'type':_0x541309['type'][_0x86d3('0x33')]};});_0x414f34['model']=_[_0x86d3('0x27')](_0x1196b6,'name');_0x414f34[_0x86d3('0x34')]=_[_0x86d3('0x35')](_0x5b8fdd[_0x86d3('0x34')]);_0x414f34[_0x86d3('0x36')]=_[_0x86d3('0x37')](_0x414f34[_0x86d3('0x38')],_0x414f34[_0x86d3('0x34')]);_0x375264['attributes']=_[_0x86d3('0x37')](_0x414f34[_0x86d3('0x38')],qs['fields'](_0x5b8fdd[_0x86d3('0x34')][_0x86d3('0x39')]));_0x375264[_0x86d3('0x3a')]=_0x375264[_0x86d3('0x3a')]['length']?_0x375264[_0x86d3('0x3a')]:_0x414f34[_0x86d3('0x38')];if(!_0x5b8fdd[_0x86d3('0x34')]['hasOwnProperty'](_0x86d3('0x3b'))){_0x375264[_0x86d3('0x3c')]=qs[_0x86d3('0x3c')](_0x5b8fdd[_0x86d3('0x34')][_0x86d3('0x3c')]);_0x375264[_0x86d3('0x1d')]=qs[_0x86d3('0x1d')](_0x5b8fdd[_0x86d3('0x34')]['offset']);}_0x375264[_0x86d3('0x3d')]=qs[_0x86d3('0x3e')](_0x5b8fdd[_0x86d3('0x34')][_0x86d3('0x3e')]);_0x375264['where']=qs[_0x86d3('0x36')](_[_0x86d3('0x3f')](_0x5b8fdd[_0x86d3('0x34')],_0x414f34[_0x86d3('0x36')]),_0x1196b6);if(_0x5b8fdd['query']['filter']){_0x375264[_0x86d3('0x40')]=_['merge'](_0x375264['where'],{'$or':_[_0x86d3('0x27')](_0x1196b6,function(_0x1385fc){if(_0x1385fc[_0x86d3('0x2a')]!==_0x86d3('0x41')){var _0x23ef72={};_0x23ef72[_0x1385fc['name']]={'$like':'%'+_0x5b8fdd[_0x86d3('0x34')][_0x86d3('0x42')]+'%'};return _0x23ef72;}})});}_0x375264=_[_0x86d3('0x43')]({},_0x375264,_0x5b8fdd['options']);var _0x39d6cd={'where':_0x375264[_0x86d3('0x40')]};return db['VoiceExtension'][_0x86d3('0x1c')](_0x39d6cd)[_0x86d3('0x20')](function(_0x5d9c61){_0x476eb3['count']=_0x5d9c61;if(_0x5b8fdd['query'][_0x86d3('0x44')]){_0x375264[_0x86d3('0x45')]=[{'all':!![]}];}return db[_0x86d3('0x31')][_0x86d3('0x46')](_0x375264);})[_0x86d3('0x20')](function(_0x447bf2){_0x476eb3['rows']=_0x447bf2;return _0x476eb3;})[_0x86d3('0x20')](respondWithFilteredResult(_0x5505b6,_0x375264))[_0x86d3('0x47')](handleError(_0x5505b6,null));};exports['show']=function(_0x2f0bf6,_0x432133){var _0xb2c80e={'raw':![],'where':{'id':_0x2f0bf6[_0x86d3('0x48')]['id']}},_0xf3619={};_0xf3619[_0x86d3('0x38')]=_['keys'](db[_0x86d3('0x31')][_0x86d3('0x32')]);_0xf3619['query']=_[_0x86d3('0x35')](_0x2f0bf6[_0x86d3('0x34')]);_0xf3619[_0x86d3('0x36')]=_[_0x86d3('0x37')](_0xf3619[_0x86d3('0x38')],_0xf3619['query']);_0xb2c80e[_0x86d3('0x3a')]=_[_0x86d3('0x37')](_0xf3619[_0x86d3('0x38')],qs[_0x86d3('0x39')](_0x2f0bf6[_0x86d3('0x34')][_0x86d3('0x39')]));_0xb2c80e[_0x86d3('0x3a')]=_0xb2c80e[_0x86d3('0x3a')][_0x86d3('0x49')]?_0xb2c80e[_0x86d3('0x3a')]:_0xf3619[_0x86d3('0x38')];if(_0x2f0bf6[_0x86d3('0x34')]['includeAll']){_0xb2c80e[_0x86d3('0x45')]=[{'all':!![]}];}_0xb2c80e=_[_0x86d3('0x43')]({},_0xb2c80e,_0x2f0bf6['options']);return db[_0x86d3('0x31')][_0x86d3('0x2b')](_0xb2c80e)[_0x86d3('0x20')](handleEntityNotFound(_0x432133,null))[_0x86d3('0x20')](respondWithResult(_0x432133,null))[_0x86d3('0x47')](handleError(_0x432133,null));};exports[_0x86d3('0x21')]=function(_0x5f20d9,_0x4cd179){return db['VoiceExtension']['find']({'where':{'id':_0x5f20d9[_0x86d3('0x48')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x4cd179,null))[_0x86d3('0x20')](removeEntity(_0x4cd179,null))[_0x86d3('0x47')](handleError(_0x4cd179,null));};exports[_0x86d3('0x4a')]=function(_0xbfe9eb,_0x24d59e){if(_0xbfe9eb['body'][_0x86d3('0x2a')]===_0x86d3('0x24')&&!_[_0x86d3('0x4b')](_0xbfe9eb[_0x86d3('0x4c')][_0x86d3('0x4d')],'_')){_0xbfe9eb[_0x86d3('0x4c')][_0x86d3('0x4d')]='_'['concat'](_0xbfe9eb[_0x86d3('0x4c')]['exten']);}return db[_0x86d3('0x31')][_0x86d3('0x4a')](_0xbfe9eb[_0x86d3('0x4c')],{'raw':![]})[_0x86d3('0x20')](function(_0x357e1d){var _0x55e345=_0xbfe9eb[_0x86d3('0x4e')][_0x86d3('0x22')]({'plain':!![]});if(!_0x55e345)throw new Error(_0x86d3('0x4f'));if(_0x55e345['role']==='user'){var _0x5f5d52=_0x357e1d[_0x86d3('0x22')]({'plain':!![]});var _0x54ea9c=[{'name':_0x86d3('0x23'),'value':_0x86d3('0x50')},{'name':_0x86d3('0x51'),'value':_0x86d3('0x24')},{'name':'InternalRoutes','value':'internal'}];var _0x551806=_[_0x86d3('0x2b')](_0x54ea9c,[_0x86d3('0x28'),_0x5f5d52['type']])[_0x86d3('0x2c')];return db[_0x86d3('0x52')][_0x86d3('0x2b')]({'where':{'name':_0x551806,'userProfileId':_0x55e345[_0x86d3('0x53')]},'raw':!![]})[_0x86d3('0x20')](function(_0x5123fd){if(_0x5123fd&&_0x5123fd[_0x86d3('0x54')]===0x0){return db[_0x86d3('0x2d')][_0x86d3('0x4a')]({'name':_0x5f5d52[_0x86d3('0x2c')],'resourceId':_0x5f5d52['id'],'type':_0x5123fd['name'],'sectionId':_0x5123fd['id']},{})[_0x86d3('0x20')](function(){return _0x357e1d;});}else{return _0x357e1d;}})[_0x86d3('0x47')](function(_0x58a96a){logger[_0x86d3('0x55')](_0x86d3('0x56'),_0x58a96a);throw _0x58a96a;});}return _0x357e1d;})[_0x86d3('0x20')](respondWithResult(_0x24d59e,0xc9))[_0x86d3('0x47')](handleError(_0x24d59e,null));};exports[_0x86d3('0x57')]=function(_0x4029a4,_0x37c5b5){if(_0x4029a4['body']['id']){delete _0x4029a4['body']['id'];}return db[_0x86d3('0x31')]['find']({'where':{'id':_0x4029a4['params']['id']}})['then'](handleEntityNotFound(_0x37c5b5,null))[_0x86d3('0x20')](function(_0x53ad5b){if(_0x53ad5b){return db[_0x86d3('0x31')]['update'](_[_0x86d3('0x3f')](_0x4029a4[_0x86d3('0x4c')],[_0x86d3('0x4d'),'context','description',_0x86d3('0x58'),_0x86d3('0x59'),_0x86d3('0x5a')]),{'where':{'context':_0x53ad5b[_0x86d3('0x5b')],'exten':_0x53ad5b[_0x86d3('0x4d')]},'individualHooks':!![]})[_0x86d3('0x20')](function(_0x24daf3){return _0x24daf3;});}return null;})[_0x86d3('0x20')](respondWithStatusCode(_0x37c5b5,null))[_0x86d3('0x47')](handleError(_0x37c5b5,null));};exports[_0x86d3('0x5c')]=function(_0x1e3479,_0x265beb,_0xfaf168){return db[_0x86d3('0x31')][_0x86d3('0x5d')]({'where':{'id':_0x1e3479[_0x86d3('0x48')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x265beb,null))[_0x86d3('0x20')](function(_0x5b99f9){if(_0x5b99f9){return db[_0x86d3('0x5e')][_0x86d3('0x5f')](function(_0x42a09b){return db['VoiceExtension'][_0x86d3('0x21')]({'where':{'VoiceExtensionId':_0x1e3479[_0x86d3('0x48')]['id']},'transaction':_0x42a09b})[_0x86d3('0x20')](function(_0x90ca60){var _0x48f9d4=_[_0x86d3('0x27')](_0x1e3479['body'],function(_0x1e11bd){_0x1e11bd[_0x86d3('0x60')]=_0x1e3479[_0x86d3('0x48')]['id'];return _0x1e11bd;});return db[_0x86d3('0x31')][_0x86d3('0x61')](_0x48f9d4,{'transaction':_0x42a09b});});})['then'](function(){return db[_0x86d3('0x31')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x1e3479[_0x86d3('0x48')]['id']},'order':_0x86d3('0x62')});});}})['then'](respondWithResult(_0x265beb,null))[_0x86d3('0x47')](handleError(_0x265beb,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 53cc1e0..0ee0603 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 _0x3a89=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x546c7d,_0x5e7bee){var _0x33bf10=function(_0x5eeae4){while(--_0x5eeae4){_0x546c7d['push'](_0x546c7d['shift']());}};_0x33bf10(++_0x5e7bee);}(_0x3a89,0x114));var _0x93a8=function(_0x59a68a,_0x91057b){_0x59a68a=_0x59a68a-0x0;var _0x4a3077=_0x3a89[_0x59a68a];return _0x4a3077;};'use strict';var EventEmitter=require(_0x93a8('0x0'));var VoiceExtension=require(_0x93a8('0x1'))['db'][_0x93a8('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x93a8('0x3')](0x0);var events={'afterCreate':_0x93a8('0x4'),'afterUpdate':'update','afterDestroy':_0x93a8('0x5')};function emitEvent(_0x2317f5){return function(_0x13d481,_0x5116f1,_0x1947cd){VoiceExtensionEvents[_0x93a8('0x6')](_0x2317f5+':'+_0x13d481['id'],_0x13d481);VoiceExtensionEvents[_0x93a8('0x6')](_0x2317f5,_0x13d481);_0x1947cd(null);};}for(var e in events){if(events[_0x93a8('0x7')](e)){var event=events[e];VoiceExtension[_0x93a8('0x8')](e,emitEvent(event));}}module[_0x93a8('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0xff73=['remove','emit','hasOwnProperty','hook','events','VoiceExtension','save'];(function(_0x2786a5,_0x2e4af3){var _0x115a1f=function(_0x2becad){while(--_0x2becad){_0x2786a5['push'](_0x2786a5['shift']());}};_0x115a1f(++_0x2e4af3);}(_0xff73,0xac));var _0x3ff7=function(_0xfeb39,_0x1d20b7){_0xfeb39=_0xfeb39-0x0;var _0x167aa8=_0xff73[_0xfeb39];return _0x167aa8;};'use strict';var EventEmitter=require(_0x3ff7('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x3ff7('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3ff7('0x2'),'afterUpdate':'update','afterDestroy':_0x3ff7('0x3')};function emitEvent(_0x2625d7){return function(_0x4a6de9,_0xb84e2a,_0x22e655){VoiceExtensionEvents[_0x3ff7('0x4')](_0x2625d7+':'+_0x4a6de9['id'],_0x4a6de9);VoiceExtensionEvents[_0x3ff7('0x4')](_0x2625d7,_0x4a6de9);_0x22e655(null);};}for(var e in events){if(events[_0x3ff7('0x5')](e)){var event=events[e];VoiceExtension[_0x3ff7('0x6')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index aa3e6dc..7aba782 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 _0x5fab=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceExtension.attributes','exports','VoiceExtension','voice_extensions','lodash','util'];(function(_0x4e427d,_0x5c4aab){var _0x5a6b41=function(_0x12f76f){while(--_0x12f76f){_0x4e427d['push'](_0x4e427d['shift']());}};_0x5a6b41(++_0x5c4aab);}(_0x5fab,0x177));var _0xb5fa=function(_0x114c1c,_0x5bfd6d){_0x114c1c=_0x114c1c-0x0;var _0x50a0a6=_0x5fab[_0x114c1c];return _0x50a0a6;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1967=['path','rimraf','../../config/environment','./voiceExtension.attributes','define','VoiceExtension','voice_extensions','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5ae8f1,_0x58098e){var _0x4ac982=function(_0x469656){while(--_0x469656){_0x5ae8f1['push'](_0x5ae8f1['shift']());}};_0x4ac982(++_0x58098e);}(_0x1967,0x173));var _0x7196=function(_0x5358a8,_0x3658de){_0x5358a8=_0x5358a8-0x0;var _0x1b4b3d=_0x1967[_0x5358a8];return _0x1b4b3d;};'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/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 6e7e28f..707f188 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 _0xf0c1=['attributes','include','model','map','GetVoiceExtension','debug','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','code','error','message','VoiceExtension,\x20%s,\x20%s','result','catch','VoiceExtension','options','raw'];(function(_0x23da4d,_0x63498c){var _0x4ae55=function(_0x323d75){while(--_0x323d75){_0x23da4d['push'](_0x23da4d['shift']());}};_0x4ae55(++_0x63498c);}(_0xf0c1,0x1a8));var _0x1f0c=function(_0x1406ae,_0x292395){_0x1406ae=_0x1406ae-0x0;var _0x23a076=_0xf0c1[_0x1406ae];return _0x23a076;};'use strict';var _=require(_0x1f0c('0x0'));var util=require(_0x1f0c('0x1'));var moment=require('moment');var BPromise=require(_0x1f0c('0x2'));var rs=require(_0x1f0c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f0c('0x4'))['db'];var utils=require(_0x1f0c('0x5'));var logger=require(_0x1f0c('0x6'))('rpc');var config=require(_0x1f0c('0x7'));var jayson=require(_0x1f0c('0x8'));var client=jayson[_0x1f0c('0x9')][_0x1f0c('0xa')]({'port':0x232a});config[_0x1f0c('0xb')]=_[_0x1f0c('0xc')](config[_0x1f0c('0xb')],{'host':_0x1f0c('0xd'),'port':0x18eb});var socket=require(_0x1f0c('0xe'))(new Redis(config[_0x1f0c('0xb')]));require(_0x1f0c('0xf'))[_0x1f0c('0x10')](socket);function respondWithRpcPromise(_0xd6babc,_0x285b70,_0x13ba10){return new BPromise(function(_0x1fa771,_0x5f004a){return client[_0x1f0c('0x11')](_0xd6babc,_0x13ba10)[_0x1f0c('0x12')](function(_0x385093){logger[_0x1f0c('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x285b70,_0x1f0c('0x14'));logger['debug'](_0x1f0c('0x15'),_0x285b70,_0x1f0c('0x14'),JSON[_0x1f0c('0x16')](_0x385093));if(_0x385093['error']){if(_0x385093['error'][_0x1f0c('0x17')]===0x1f4){logger[_0x1f0c('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x285b70,_0x385093[_0x1f0c('0x18')][_0x1f0c('0x19')]);return _0x5f004a(_0x385093['error']['message']);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x285b70,_0x385093[_0x1f0c('0x18')][_0x1f0c('0x19')]);return _0x1fa771(_0x385093['error'][_0x1f0c('0x19')]);}else{logger[_0x1f0c('0x13')](_0x1f0c('0x1a'),_0x285b70,_0x1f0c('0x14'));_0x1fa771(_0x385093[_0x1f0c('0x1b')][_0x1f0c('0x19')]);}})[_0x1f0c('0x1c')](function(_0xae25b5){logger['error'](_0x1f0c('0x1a'),_0x285b70,_0xae25b5);_0x5f004a(_0xae25b5);});});}exports['GetVoiceExtension']=function(_0x1ab2d6){var _0x18e461=this;return new Promise(function(_0xe42ccb,_0x1bc68b){return db[_0x1f0c('0x1d')]['findAll']({'raw':_0x1ab2d6[_0x1f0c('0x1e')]?_0x1ab2d6[_0x1f0c('0x1e')][_0x1f0c('0x1f')]===undefined?!![]:![]:!![],'where':_0x1ab2d6[_0x1f0c('0x1e')]?_0x1ab2d6[_0x1f0c('0x1e')]['where']||null:null,'attributes':_0x1ab2d6[_0x1f0c('0x1e')]?_0x1ab2d6['options'][_0x1f0c('0x20')]||null:null,'limit':_0x1ab2d6[_0x1f0c('0x1e')]?_0x1ab2d6[_0x1f0c('0x1e')]['limit']||null:null,'include':_0x1ab2d6['options']?_0x1ab2d6[_0x1f0c('0x1e')][_0x1f0c('0x21')]?_['map'](_0x1ab2d6[_0x1f0c('0x1e')]['include'],function(_0x100423){return{'model':db[_0x100423[_0x1f0c('0x22')]],'as':_0x100423['as'],'attributes':_0x100423[_0x1f0c('0x20')],'include':_0x100423['include']?_[_0x1f0c('0x23')](_0x100423[_0x1f0c('0x21')],function(_0x14103f){return{'model':db[_0x14103f[_0x1f0c('0x22')]],'as':_0x14103f['as'],'attributes':_0x14103f[_0x1f0c('0x20')],'include':_0x14103f[_0x1f0c('0x21')]?_[_0x1f0c('0x23')](_0x14103f[_0x1f0c('0x21')],function(_0xb9c49){return{'model':db[_0xb9c49[_0x1f0c('0x22')]],'as':_0xb9c49['as'],'attributes':_0xb9c49[_0x1f0c('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1f0c('0x12')](function(_0xddb8f1){logger[_0x1f0c('0x13')](_0x1f0c('0x24'),_0x1ab2d6);logger[_0x1f0c('0x25')](_0x1f0c('0x24'),_0x1ab2d6,JSON[_0x1f0c('0x16')](_0xddb8f1));_0xe42ccb(_0xddb8f1);})['catch'](function(_0x367f22){logger[_0x1f0c('0x18')]('GetVoiceExtension',_0x367f22[_0x1f0c('0x19')],_0x1ab2d6);_0x1bc68b(_0x18e461[_0x1f0c('0x18')](0x1f4,_0x367f22[_0x1f0c('0x19')]));});});}; \ No newline at end of file +var _0xa96c=['defaults','localhost','socket.io-emitter','register','info','VoiceExtension,\x20%s,\x20%s','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VoiceExtension','findAll','options','limit','include','map','model','attributes','then','GetVoiceExtension','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa96c,0x1ec));var _0xca96=function(_0x3f12a2,_0x533cf0){_0x3f12a2=_0x3f12a2-0x0;var _0x33569f=_0xa96c[_0x3f12a2];return _0x33569f;};'use strict';var _=require(_0xca96('0x0'));var util=require(_0xca96('0x1'));var moment=require(_0xca96('0x2'));var BPromise=require(_0xca96('0x3'));var rs=require(_0xca96('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xca96('0x5'));var logger=require('../../config/logger')(_0xca96('0x6'));var config=require(_0xca96('0x7'));var jayson=require(_0xca96('0x8'));var client=jayson[_0xca96('0x9')][_0xca96('0xa')]({'port':0x232a});config[_0xca96('0xb')]=_[_0xca96('0xc')](config[_0xca96('0xb')],{'host':_0xca96('0xd'),'port':0x18eb});var socket=require(_0xca96('0xe'))(new Redis(config[_0xca96('0xb')]));require('./voiceExtension.socket')[_0xca96('0xf')](socket);function respondWithRpcPromise(_0x5d7d05,_0x709ad4,_0x345262){return new BPromise(function(_0x1250c6,_0x1e83d4){return client['request'](_0x5d7d05,_0x345262)['then'](function(_0x2b254f){logger[_0xca96('0x10')](_0xca96('0x11'),_0x709ad4,'request\x20sent');logger['debug'](_0xca96('0x12'),_0x709ad4,_0xca96('0x13'),JSON[_0xca96('0x14')](_0x2b254f));if(_0x2b254f['error']){if(_0x2b254f[_0xca96('0x15')][_0xca96('0x16')]===0x1f4){logger[_0xca96('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x709ad4,_0x2b254f[_0xca96('0x15')][_0xca96('0x17')]);return _0x1e83d4(_0x2b254f[_0xca96('0x15')][_0xca96('0x17')]);}logger[_0xca96('0x15')](_0xca96('0x11'),_0x709ad4,_0x2b254f[_0xca96('0x15')][_0xca96('0x17')]);return _0x1250c6(_0x2b254f[_0xca96('0x15')][_0xca96('0x17')]);}else{logger[_0xca96('0x10')](_0xca96('0x11'),_0x709ad4,_0xca96('0x13'));_0x1250c6(_0x2b254f[_0xca96('0x18')][_0xca96('0x17')]);}})[_0xca96('0x19')](function(_0x3aea49){logger['error'](_0xca96('0x11'),_0x709ad4,_0x3aea49);_0x1e83d4(_0x3aea49);});});}exports['GetVoiceExtension']=function(_0x346fc6){var _0x3bbd8e=this;return new Promise(function(_0x5e0fa5,_0x6ceffb){return db[_0xca96('0x1a')][_0xca96('0x1b')]({'raw':_0x346fc6[_0xca96('0x1c')]?_0x346fc6[_0xca96('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x346fc6[_0xca96('0x1c')]?_0x346fc6[_0xca96('0x1c')]['where']||null:null,'attributes':_0x346fc6['options']?_0x346fc6[_0xca96('0x1c')]['attributes']||null:null,'limit':_0x346fc6[_0xca96('0x1c')]?_0x346fc6[_0xca96('0x1c')][_0xca96('0x1d')]||null:null,'include':_0x346fc6[_0xca96('0x1c')]?_0x346fc6[_0xca96('0x1c')][_0xca96('0x1e')]?_[_0xca96('0x1f')](_0x346fc6[_0xca96('0x1c')][_0xca96('0x1e')],function(_0x2b16d1){return{'model':db[_0x2b16d1[_0xca96('0x20')]],'as':_0x2b16d1['as'],'attributes':_0x2b16d1[_0xca96('0x21')],'include':_0x2b16d1[_0xca96('0x1e')]?_[_0xca96('0x1f')](_0x2b16d1[_0xca96('0x1e')],function(_0xef168c){return{'model':db[_0xef168c['model']],'as':_0xef168c['as'],'attributes':_0xef168c[_0xca96('0x21')],'include':_0xef168c[_0xca96('0x1e')]?_[_0xca96('0x1f')](_0xef168c[_0xca96('0x1e')],function(_0x17a954){return{'model':db[_0x17a954[_0xca96('0x20')]],'as':_0x17a954['as'],'attributes':_0x17a954[_0xca96('0x21')]};}):[]};}):[]};}):[]:[]})[_0xca96('0x22')](function(_0x575341){logger[_0xca96('0x10')](_0xca96('0x23'),_0x346fc6);logger['debug'](_0xca96('0x23'),_0x346fc6,JSON['stringify'](_0x575341));_0x5e0fa5(_0x575341);})[_0xca96('0x19')](function(_0x4baa7b){logger[_0xca96('0x15')](_0xca96('0x23'),_0x4baa7b[_0xca96('0x17')],_0x346fc6);_0x6ceffb(_0x3bbd8e[_0xca96('0x15')](0x1f4,_0x4baa7b[_0xca96('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index fb5e59c..52f4959 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 _0x2b46=['voiceExtension:','./voiceExtension.events','remove','update','emit','removeListener'];(function(_0x321021,_0x18cb40){var _0x22222f=function(_0x4644ee){while(--_0x4644ee){_0x321021['push'](_0x321021['shift']());}};_0x22222f(++_0x18cb40);}(_0x2b46,0x199));var _0x62b4=function(_0x3061f2,_0x11837b){_0x3061f2=_0x3061f2-0x0;var _0x2a7ba0=_0x2b46[_0x3061f2];return _0x2a7ba0;};'use strict';var VoiceExtensionEvents=require(_0x62b4('0x0'));var events=['save',_0x62b4('0x1'),_0x62b4('0x2')];function createListener(_0x297c65,_0x587411){return function(_0x3965a3){_0x587411[_0x62b4('0x3')](_0x297c65,_0x3965a3);};}function removeListener(_0x49bfa7,_0x2143c6){return function(){VoiceExtensionEvents[_0x62b4('0x4')](_0x49bfa7,_0x2143c6);};}exports['register']=function(_0x1dd294){for(var _0x3b4d43=0x0,_0x5aa803=events['length'];_0x3b4d43<_0x5aa803;_0x3b4d43++){var _0xf31571=events[_0x3b4d43];var _0x123408=createListener(_0x62b4('0x5')+_0xf31571,_0x1dd294);VoiceExtensionEvents['on'](_0xf31571,_0x123408);}}; \ No newline at end of file +var _0x6505=['removeListener','register','length','./voiceExtension.events','save','remove','update','emit'];(function(_0x19ca04,_0x40f30c){var _0x344cb5=function(_0x3b1d42){while(--_0x3b1d42){_0x19ca04['push'](_0x19ca04['shift']());}};_0x344cb5(++_0x40f30c);}(_0x6505,0xdb));var _0x5650=function(_0x456b10,_0x5b0a3b){_0x456b10=_0x456b10-0x0;var _0x55551b=_0x6505[_0x456b10];return _0x55551b;};'use strict';var VoiceExtensionEvents=require(_0x5650('0x0'));var events=[_0x5650('0x1'),_0x5650('0x2'),_0x5650('0x3')];function createListener(_0x3cc850,_0x505e6b){return function(_0x20ca0c){_0x505e6b[_0x5650('0x4')](_0x3cc850,_0x20ca0c);};}function removeListener(_0x48682b,_0x36c452){return function(){VoiceExtensionEvents[_0x5650('0x5')](_0x48682b,_0x36c452);};}exports[_0x5650('0x6')]=function(_0x24b417){for(var _0x215342=0x0,_0x5cb209=events[_0x5650('0x7')];_0x215342<_0x5cb209;_0x215342++){var _0x2a35e2=events[_0x215342];var _0x2d48f6=createListener('voiceExtension:'+_0x2a35e2,_0x24b417);VoiceExtensionEvents['on'](_0x2a35e2,_0x2d48f6);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 3b4f2df..4f3a2d5 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 _0xf853=['isAuthenticated','index','show','get','getMessages','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMail.controller'];(function(_0x5aaaeb,_0x3ae52c){var _0x3c6401=function(_0xcc0899){while(--_0xcc0899){_0x5aaaeb['push'](_0x5aaaeb['shift']());}};_0x3c6401(++_0x3ae52c);}(_0xf853,0x19c));var _0x3f85=function(_0x4f0c2b,_0x2c9d14){_0x4f0c2b=_0x4f0c2b-0x0;var _0x526436=_0xf853[_0x4f0c2b];return _0x526436;};'use strict';var multer=require('multer');var util=require(_0x3f85('0x0'));var path=require(_0x3f85('0x1'));var timeout=require(_0x3f85('0x2'));var express=require(_0x3f85('0x3'));var router=express[_0x3f85('0x4')]();var auth=require(_0x3f85('0x5'));var interaction=require(_0x3f85('0x6'));var config=require('../../config/environment');var controller=require(_0x3f85('0x7'));router['get']('/',auth[_0x3f85('0x8')](),controller[_0x3f85('0x9')]);router['get']('/:id',auth[_0x3f85('0x8')](),controller[_0x3f85('0xa')]);router[_0x3f85('0xb')]('/:id/messages',auth['isAuthenticated'](),controller[_0x3f85('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3f85('0xd')]);router[_0x3f85('0xe')](_0x3f85('0xf'),auth['isAuthenticated'](),controller[_0x3f85('0x10')]);router[_0x3f85('0x11')](_0x3f85('0xf'),auth[_0x3f85('0x8')](),controller[_0x3f85('0x12')]);module[_0x3f85('0x13')]=router; \ No newline at end of file +var _0x4136=['delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceMail.controller','get','index','/:id','isAuthenticated','show','/:id/messages','getMessages','post','create','update'];(function(_0x3ad265,_0x3483dd){var _0x3ef8e2=function(_0x3a8fc1){while(--_0x3a8fc1){_0x3ad265['push'](_0x3ad265['shift']());}};_0x3ef8e2(++_0x3483dd);}(_0x4136,0x1e1));var _0x6413=function(_0x2d552b,_0x459d39){_0x2d552b=_0x2d552b-0x0;var _0x51e0bd=_0x4136[_0x2d552b];return _0x51e0bd;};'use strict';var multer=require(_0x6413('0x0'));var util=require(_0x6413('0x1'));var path=require(_0x6413('0x2'));var timeout=require(_0x6413('0x3'));var express=require(_0x6413('0x4'));var router=express[_0x6413('0x5')]();var auth=require(_0x6413('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6413('0x7'));var controller=require(_0x6413('0x8'));router[_0x6413('0x9')]('/',auth['isAuthenticated'](),controller[_0x6413('0xa')]);router[_0x6413('0x9')](_0x6413('0xb'),auth[_0x6413('0xc')](),controller[_0x6413('0xd')]);router['get'](_0x6413('0xe'),auth[_0x6413('0xc')](),controller[_0x6413('0xf')]);router[_0x6413('0x10')]('/',auth[_0x6413('0xc')](),controller[_0x6413('0x11')]);router['put'](_0x6413('0xb'),auth['isAuthenticated'](),controller[_0x6413('0x12')]);router[_0x6413('0x13')]('/:id',auth[_0x6413('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index dadb178..8ccb3a5 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 _0x4cf8=['mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue'];(function(_0x3841de,_0x559542){var _0x5f3bd8=function(_0x5a2dca){while(--_0x5a2dca){_0x3841de['push'](_0x3841de['shift']());}};_0x5f3bd8(++_0x559542);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x4cf8[_0x411017];return _0x2adeea;};'use strict';var Sequelize=require(_0x84cf('0x0'));module[_0x84cf('0x1')]={'customer_id':{'type':Sequelize[_0x84cf('0x2')]},'context':{'type':Sequelize[_0x84cf('0x2')],'defaultValue':_0x84cf('0x3'),'unique':_0x84cf('0x4')},'mailbox':{'type':Sequelize[_0x84cf('0x2')],'defaultValue':'','allowNull':![],'unique':_0x84cf('0x4')},'password':{'type':Sequelize[_0x84cf('0x2')]},'fullname':{'type':Sequelize[_0x84cf('0x2')]},'email':{'type':Sequelize[_0x84cf('0x2')],'validate':{'isEmail':!![]},'set':function(_0x2c613d){this['setDataValue']('email',typeof _0x2c613d===_0x84cf('0x5')&&_0x2c613d['trim']()?_0x2c613d[_0x84cf('0x6')]():null);}},'pager':{'type':Sequelize[_0x84cf('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x84cf('0x7')},'attach':{'type':Sequelize[_0x84cf('0x8')]('yes','no'),'defaultValue':_0x84cf('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':_0x84cf('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x84cf('0x2')]},'review':{'type':Sequelize[_0x84cf('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x84cf('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':_0x84cf('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x84cf('0xb')},'emailsubject':{'type':Sequelize[_0x84cf('0x2')]},'emailbody':{'type':Sequelize[_0x84cf('0x2')]},'maxsecs':{'type':Sequelize[_0x84cf('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x84cf('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x84cf('0xd')],'get':function(){return this[_0x84cf('0xe')]('fullname')+'\x20-\x20'+this[_0x84cf('0xe')](_0x84cf('0xf'));}}}; \ No newline at end of file +var _0xb10b=['ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','email','string','trim','central'];(function(_0x59a549,_0x2fe2bb){var _0x12adbe=function(_0x2ccd1e){while(--_0x2ccd1e){_0x59a549['push'](_0x59a549['shift']());}};_0x12adbe(++_0x2fe2bb);}(_0xb10b,0x12a));var _0xbb10=function(_0x3cb83f,_0x2bc6dd){_0x3cb83f=_0x3cb83f-0x0;var _0x105d68=_0xb10b[_0x3cb83f];return _0x105d68;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0xbb10('0x1')]},'context':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':_0xbb10('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':'','allowNull':![],'unique':_0xbb10('0x3')},'password':{'type':Sequelize[_0xbb10('0x1')]},'fullname':{'type':Sequelize[_0xbb10('0x1')]},'email':{'type':Sequelize[_0xbb10('0x1')],'validate':{'isEmail':!![]},'set':function(_0x312b72){this['setDataValue'](_0xbb10('0x4'),typeof _0x312b72===_0xbb10('0x5')&&_0x312b72['trim']()?_0x312b72[_0xbb10('0x6')]():null);}},'pager':{'type':Sequelize[_0xbb10('0x1')]},'tz':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':_0xbb10('0x7')},'attach':{'type':Sequelize[_0xbb10('0x8')](_0xbb10('0x9'),'no'),'defaultValue':_0xbb10('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xbb10('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xbb10('0x1')]},'callback':{'type':Sequelize[_0xbb10('0x1')]},'review':{'type':Sequelize[_0xbb10('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xbb10('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xbb10('0x8')](_0xbb10('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xbb10('0x8')](_0xbb10('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xbb10('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xbb10('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xbb10('0x8')](_0xbb10('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xbb10('0x8')](_0xbb10('0x9'),'no'),'defaultValue':_0xbb10('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xbb10('0x8')](_0xbb10('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xbb10('0x8')](_0xbb10('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xbb10('0x8')]('yes','no'),'defaultValue':_0xbb10('0x9'),'allowNull':![]},'stamp':{'type':_0xbb10('0xb')},'emailsubject':{'type':Sequelize[_0xbb10('0x1')]},'emailbody':{'type':Sequelize[_0xbb10('0x1')]},'maxsecs':{'type':Sequelize[_0xbb10('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xbb10('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xbb10('0xd')],'get':function(){return this[_0xbb10('0xe')](_0xbb10('0xf'))+_0xbb10('0x10')+this['getDataValue'](_0xbb10('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index f66d736..5773c73 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 _0x9bd4=['fieldName','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','type','options','includeAll','include','findAll','rows','params','length','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','update','getMessages','findOne','hasOwnProperty','pick','mailbox','VoiceMailMessage','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','reject','save','then','destroy','get','Voicemails','UserProfileResource','error','name','index','map','VoiceMail','rawAttributes'];(function(_0x5ab43c,_0xfa83ac){var _0x3b8f13=function(_0x10e59a){while(--_0x10e59a){_0x5ab43c['push'](_0x5ab43c['shift']());}};_0x3b8f13(++_0xfa83ac);}(_0x9bd4,0x1d0));var _0x49bd=function(_0x245ea9,_0x213f0f){_0x245ea9=_0x245ea9-0x0;var _0x407dbe=_0x9bd4[_0x245ea9];return _0x407dbe;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x49bd('0x0'));var rimraf=require(_0x49bd('0x1'));var zipdir=require(_0x49bd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x49bd('0x3'));var Mustache=require(_0x49bd('0x4'));var util=require(_0x49bd('0x5'));var path=require(_0x49bd('0x6'));var sox=require(_0x49bd('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x49bd('0x8'));var squel=require(_0x49bd('0x9'));var crypto=require(_0x49bd('0xa'));var jsforce=require(_0x49bd('0xb'));var deskjs=require(_0x49bd('0xc'));var toCsv=require(_0x49bd('0xd'));var querystring=require(_0x49bd('0xe'));var Papa=require(_0x49bd('0xf'));var Redis=require(_0x49bd('0x10'));var authService=require(_0x49bd('0x11'));var qs=require(_0x49bd('0x12'));var as=require(_0x49bd('0x13'));var hardwareService=require(_0x49bd('0x14'));var logger=require(_0x49bd('0x15'))(_0x49bd('0x16'));var utils=require('../../config/utils');var config=require(_0x49bd('0x17'));var db=require(_0x49bd('0x18'))['db'];function respondWithStatusCode(_0x152237,_0x348f9c){_0x348f9c=_0x348f9c||0xcc;return function(_0x11bee0){if(_0x11bee0){return _0x152237[_0x49bd('0x19')](_0x348f9c);}return _0x152237[_0x49bd('0x1a')](_0x348f9c)[_0x49bd('0x1b')]();};}function respondWithResult(_0x59edb6,_0x31b727){_0x31b727=_0x31b727||0xc8;return function(_0x4b1d37){if(_0x4b1d37){return _0x59edb6['status'](_0x31b727)['json'](_0x4b1d37);}};}function respondWithFilteredResult(_0x3c74df,_0x58e593){return function(_0x37d60c){if(_0x37d60c){var _0x4d4401=_0x37d60c[_0x49bd('0x1c')],_0x453b95=_0x58e593['offset'],_0x509908=_0x58e593[_0x49bd('0x1d')]+_0x58e593[_0x49bd('0x1e')],_0x3364ba;if(_0x509908>=_0x4d4401){_0x509908=_0x4d4401;_0x3364ba=0xc8;}else{_0x3364ba=0xce;}_0x3c74df[_0x49bd('0x1a')](_0x3364ba);return _0x3c74df['set'](_0x49bd('0x1f'),_0x453b95+'-'+_0x509908+'/'+_0x4d4401)[_0x49bd('0x20')](_0x37d60c);}return null;};}function patchUpdates(_0x22f3c4){return function(_0x7c04e1){try{jsonpatch['apply'](_0x7c04e1,_0x22f3c4,!![]);}catch(_0x1b9b46){return BPromise[_0x49bd('0x21')](_0x1b9b46);}return _0x7c04e1[_0x49bd('0x22')]();};}function saveUpdates(_0x521286,_0x4482c0){return function(_0x2014ec){if(_0x2014ec){return _0x2014ec['update'](_0x521286)[_0x49bd('0x23')](function(_0x221f98){return _0x221f98;});}return null;};}function removeEntity(_0x431583,_0x360abd){return function(_0x3eb903){if(_0x3eb903){return _0x3eb903[_0x49bd('0x24')]()[_0x49bd('0x23')](function(){var _0x106823=_0x3eb903[_0x49bd('0x25')]({'plain':!![]});var _0x22a2ac=_0x49bd('0x26');return db[_0x49bd('0x27')][_0x49bd('0x24')]({'where':{'type':_0x22a2ac,'resourceId':_0x106823['id']}})[_0x49bd('0x23')](function(){return _0x3eb903;});})[_0x49bd('0x23')](function(){_0x431583[_0x49bd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa1319c,_0x304c33){return function(_0x56ed67){if(!_0x56ed67){_0xa1319c[_0x49bd('0x19')](0x194);}return _0x56ed67;};}function handleError(_0x12593f,_0x564461){_0x564461=_0x564461||0x1f4;return function(_0x43c5db){logger[_0x49bd('0x28')](_0x43c5db['stack']);if(_0x43c5db[_0x49bd('0x29')]){delete _0x43c5db[_0x49bd('0x29')];}_0x12593f['status'](_0x564461)['send'](_0x43c5db);};}exports[_0x49bd('0x2a')]=function(_0x421b96,_0x59ee96){var _0x155d13={},_0x394016={},_0x4b14c8={'count':0x0,'rows':[]};var _0x57d3e6=_[_0x49bd('0x2b')](db[_0x49bd('0x2c')][_0x49bd('0x2d')],function(_0x45b90f){return{'name':_0x45b90f[_0x49bd('0x2e')],'type':_0x45b90f['type'][_0x49bd('0x2f')]};});_0x394016[_0x49bd('0x30')]=_[_0x49bd('0x2b')](_0x57d3e6,_0x49bd('0x29'));_0x394016[_0x49bd('0x31')]=_[_0x49bd('0x32')](_0x421b96[_0x49bd('0x31')]);_0x394016[_0x49bd('0x33')]=_[_0x49bd('0x34')](_0x394016['model'],_0x394016[_0x49bd('0x31')]);_0x155d13['attributes']=_[_0x49bd('0x34')](_0x394016['model'],qs[_0x49bd('0x35')](_0x421b96['query'][_0x49bd('0x35')]));_0x155d13['attributes']=_0x155d13['attributes']['length']?_0x155d13[_0x49bd('0x36')]:_0x394016[_0x49bd('0x30')];if(!_0x421b96[_0x49bd('0x31')]['hasOwnProperty'](_0x49bd('0x37'))){_0x155d13['limit']=qs['limit'](_0x421b96[_0x49bd('0x31')][_0x49bd('0x1e')]);_0x155d13['offset']=qs[_0x49bd('0x1d')](_0x421b96[_0x49bd('0x31')]['offset']);}_0x155d13[_0x49bd('0x38')]=qs[_0x49bd('0x39')](_0x421b96[_0x49bd('0x31')][_0x49bd('0x39')]);_0x155d13[_0x49bd('0x3a')]=qs[_0x49bd('0x33')](_['pick'](_0x421b96['query'],_0x394016['filters']),_0x57d3e6);if(_0x421b96['query'][_0x49bd('0x3b')]){_0x155d13[_0x49bd('0x3a')]=_[_0x49bd('0x3c')](_0x155d13[_0x49bd('0x3a')],{'$or':_['map'](_0x57d3e6,function(_0x3b3091){if(_0x3b3091[_0x49bd('0x3d')]!=='VIRTUAL'){var _0x2d6390={};_0x2d6390[_0x3b3091[_0x49bd('0x29')]]={'$like':'%'+_0x421b96['query'][_0x49bd('0x3b')]+'%'};return _0x2d6390;}})});}_0x155d13=_['merge']({},_0x155d13,_0x421b96[_0x49bd('0x3e')]);var _0x4fa785={'where':_0x155d13[_0x49bd('0x3a')]};return db[_0x49bd('0x2c')][_0x49bd('0x1c')](_0x4fa785)[_0x49bd('0x23')](function(_0x38c9f7){_0x4b14c8[_0x49bd('0x1c')]=_0x38c9f7;if(_0x421b96['query'][_0x49bd('0x3f')]){_0x155d13[_0x49bd('0x40')]=[{'all':!![]}];}return db[_0x49bd('0x2c')][_0x49bd('0x41')](_0x155d13);})[_0x49bd('0x23')](function(_0x146d6f){_0x4b14c8[_0x49bd('0x42')]=_0x146d6f;return _0x4b14c8;})[_0x49bd('0x23')](respondWithFilteredResult(_0x59ee96,_0x155d13))['catch'](handleError(_0x59ee96,null));};exports['show']=function(_0x2f53a0,_0x19fcce){var _0x1bef2d={'raw':!![],'where':{'id':_0x2f53a0[_0x49bd('0x43')]['id']}},_0x523657={};_0x523657[_0x49bd('0x30')]=_['keys'](db[_0x49bd('0x2c')][_0x49bd('0x2d')]);_0x523657[_0x49bd('0x31')]=_[_0x49bd('0x32')](_0x2f53a0[_0x49bd('0x31')]);_0x523657[_0x49bd('0x33')]=_[_0x49bd('0x34')](_0x523657['model'],_0x523657['query']);_0x1bef2d[_0x49bd('0x36')]=_[_0x49bd('0x34')](_0x523657['model'],qs[_0x49bd('0x35')](_0x2f53a0[_0x49bd('0x31')][_0x49bd('0x35')]));_0x1bef2d[_0x49bd('0x36')]=_0x1bef2d['attributes'][_0x49bd('0x44')]?_0x1bef2d[_0x49bd('0x36')]:_0x523657['model'];if(_0x2f53a0[_0x49bd('0x31')]['includeAll']){_0x1bef2d['include']=[{'all':!![]}];}_0x1bef2d=_[_0x49bd('0x3c')]({},_0x1bef2d,_0x2f53a0['options']);return db[_0x49bd('0x2c')]['find'](_0x1bef2d)['then'](handleEntityNotFound(_0x19fcce,null))[_0x49bd('0x23')](respondWithResult(_0x19fcce,null))[_0x49bd('0x45')](handleError(_0x19fcce,null));};exports[_0x49bd('0x46')]=function(_0x508eaf,_0x389189){return db[_0x49bd('0x2c')][_0x49bd('0x46')](_0x508eaf[_0x49bd('0x47')],{})[_0x49bd('0x23')](function(_0x110d67){var _0xd4501e=_0x508eaf[_0x49bd('0x48')]['get']({'plain':!![]});if(!_0xd4501e)throw new Error(_0x49bd('0x49'));if(_0xd4501e[_0x49bd('0x4a')]===_0x49bd('0x48')){var _0x5759a0=_0x110d67[_0x49bd('0x25')]({'plain':!![]});var _0x4471b1=_0x49bd('0x26');return db['UserProfileSection'][_0x49bd('0x4b')]({'where':{'name':_0x4471b1,'userProfileId':_0xd4501e[_0x49bd('0x4c')]},'raw':!![]})[_0x49bd('0x23')](function(_0x349015){if(_0x349015&&_0x349015[_0x49bd('0x4d')]===0x0){return db[_0x49bd('0x27')][_0x49bd('0x46')]({'name':_0x5759a0[_0x49bd('0x29')],'resourceId':_0x5759a0['id'],'type':_0x349015['name'],'sectionId':_0x349015['id']},{})[_0x49bd('0x23')](function(){return _0x110d67;});}else{return _0x110d67;}})[_0x49bd('0x45')](function(_0x1b4d8e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b4d8e);throw _0x1b4d8e;});}return _0x110d67;})[_0x49bd('0x23')](respondWithResult(_0x389189,0xc9))[_0x49bd('0x45')](handleError(_0x389189,null));};exports[_0x49bd('0x4e')]=function(_0xef5d98,_0x238e14){if(_0xef5d98[_0x49bd('0x47')]['id']){delete _0xef5d98[_0x49bd('0x47')]['id'];}return db[_0x49bd('0x2c')][_0x49bd('0x4b')]({'where':{'id':_0xef5d98[_0x49bd('0x43')]['id']}})[_0x49bd('0x23')](handleEntityNotFound(_0x238e14,null))[_0x49bd('0x23')](saveUpdates(_0xef5d98[_0x49bd('0x47')],null))['then'](respondWithResult(_0x238e14,null))[_0x49bd('0x45')](handleError(_0x238e14,null));};exports[_0x49bd('0x24')]=function(_0x33aedd,_0x585b54){return db[_0x49bd('0x2c')][_0x49bd('0x4b')]({'where':{'id':_0x33aedd['params']['id']}})[_0x49bd('0x23')](handleEntityNotFound(_0x585b54,null))['then'](removeEntity(_0x585b54,null))[_0x49bd('0x45')](handleError(_0x585b54,null));};exports[_0x49bd('0x4f')]=function(_0x36774d,_0x2ff8f3,_0x432237){return db['VoiceMail'][_0x49bd('0x50')]({'where':{'id':_0x36774d[_0x49bd('0x43')]['id']}})[_0x49bd('0x23')](handleEntityNotFound(_0x2ff8f3,null))[_0x49bd('0x23')](function(_0x273aaa){var _0x3d97e8;var _0x22e44e={},_0x31c8d6={};_0x31c8d6[_0x49bd('0x30')]=_[_0x49bd('0x32')](db['VoiceMailMessage'][_0x49bd('0x2d')]);_0x31c8d6[_0x49bd('0x31')]=_[_0x49bd('0x32')](_0x36774d[_0x49bd('0x31')]);_0x31c8d6[_0x49bd('0x33')]=_['intersection'](_0x31c8d6[_0x49bd('0x30')],_0x31c8d6[_0x49bd('0x31')]);_0x22e44e[_0x49bd('0x36')]=_[_0x49bd('0x34')](_0x31c8d6['model'],qs[_0x49bd('0x35')](_0x36774d[_0x49bd('0x31')][_0x49bd('0x35')]));_0x22e44e['attributes']=_0x22e44e[_0x49bd('0x36')]['length']?_0x22e44e['attributes']:_0x31c8d6[_0x49bd('0x30')];if(!_0x36774d['query'][_0x49bd('0x51')](_0x49bd('0x37'))){_0x22e44e[_0x49bd('0x1e')]=qs[_0x49bd('0x1e')](_0x36774d['query']['limit']);_0x22e44e['offset']=qs[_0x49bd('0x1d')](_0x36774d[_0x49bd('0x31')]['offset']);}_0x22e44e[_0x49bd('0x38')]=qs['sort'](_0x36774d['query'][_0x49bd('0x39')]);_0x22e44e[_0x49bd('0x3a')]=qs[_0x49bd('0x33')](_[_0x49bd('0x52')](_0x36774d['query'],_0x31c8d6['filters']));if(_0x36774d[_0x49bd('0x31')]['filter']){_0x22e44e[_0x49bd('0x3a')]=_[_0x49bd('0x3c')](_0x22e44e[_0x49bd('0x3a')],{'$or':_[_0x49bd('0x2b')](_0x22e44e[_0x49bd('0x36')],function(_0x80c398){var _0x384ec3={};_0x384ec3[_0x80c398]={'$like':'%'+_0x36774d[_0x49bd('0x31')][_0x49bd('0x3b')]+'%'};return _0x384ec3;})});}_0x22e44e[_0x49bd('0x3a')]=_['merge'](_0x22e44e[_0x49bd('0x3a')],{'mailboxuser':_0x273aaa[_0x49bd('0x53')]});_0x22e44e=_[_0x49bd('0x3c')]({},_0x22e44e,_0x36774d[_0x49bd('0x3e')]);return db[_0x49bd('0x54')]['findAndCountAll'](_0x22e44e)[_0x49bd('0x23')](respondWithFilteredResult(_0x2ff8f3,_0x22e44e));})['catch'](handleError(_0x2ff8f3,null));}; \ No newline at end of file +var _0xe231=['mailbox','findAndCountAll','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','status','end','sendStatus','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMail','includeAll','include','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','VoiceMailMessage','nolimit'];(function(_0x53b133,_0x176261){var _0x5647e0=function(_0x4c62b0){while(--_0x4c62b0){_0x53b133['push'](_0x53b133['shift']());}};_0x5647e0(++_0x176261);}(_0xe231,0x152));var _0x1e23=function(_0x2e1389,_0x1f4433){_0x2e1389=_0x2e1389-0x0;var _0x53acb3=_0xe231[_0x2e1389];return _0x53acb3;};'use strict';var pdf=require(_0x1e23('0x0'));var emlformat=require(_0x1e23('0x1'));var rimraf=require(_0x1e23('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e23('0x3'));var rp=require('request-promise');var moment=require(_0x1e23('0x4'));var BPromise=require(_0x1e23('0x5'));var Mustache=require(_0x1e23('0x6'));var util=require(_0x1e23('0x7'));var path=require(_0x1e23('0x8'));var sox=require(_0x1e23('0x9'));var csv=require(_0x1e23('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1e23('0xb'));var jsforce=require(_0x1e23('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1e23('0xa'));var querystring=require(_0x1e23('0xd'));var Papa=require('papaparse');var Redis=require(_0x1e23('0xe'));var authService=require(_0x1e23('0xf'));var qs=require(_0x1e23('0x10'));var as=require(_0x1e23('0x11'));var hardwareService=require(_0x1e23('0x12'));var logger=require('../../config/logger')(_0x1e23('0x13'));var utils=require(_0x1e23('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4acdad,_0x54184f){_0x54184f=_0x54184f||0xcc;return function(_0x287982){if(_0x287982){return _0x4acdad['sendStatus'](_0x54184f);}return _0x4acdad['status'](_0x54184f)['end']();};}function respondWithResult(_0x49608f,_0x1383e4){_0x1383e4=_0x1383e4||0xc8;return function(_0x4b08b5){if(_0x4b08b5){return _0x49608f['status'](_0x1383e4)[_0x1e23('0x15')](_0x4b08b5);}};}function respondWithFilteredResult(_0x254f6b,_0x5456a4){return function(_0x305e8b){if(_0x305e8b){var _0x126162=_0x305e8b[_0x1e23('0x16')],_0x2509f3=_0x5456a4['offset'],_0x5d84a1=_0x5456a4[_0x1e23('0x17')]+_0x5456a4[_0x1e23('0x18')],_0x180ff2;if(_0x5d84a1>=_0x126162){_0x5d84a1=_0x126162;_0x180ff2=0xc8;}else{_0x180ff2=0xce;}_0x254f6b['status'](_0x180ff2);return _0x254f6b[_0x1e23('0x19')](_0x1e23('0x1a'),_0x2509f3+'-'+_0x5d84a1+'/'+_0x126162)[_0x1e23('0x15')](_0x305e8b);}return null;};}function patchUpdates(_0x4dc76d){return function(_0x318186){try{jsonpatch[_0x1e23('0x1b')](_0x318186,_0x4dc76d,!![]);}catch(_0x1f65ec){return BPromise[_0x1e23('0x1c')](_0x1f65ec);}return _0x318186[_0x1e23('0x1d')]();};}function saveUpdates(_0x32ab33,_0xb02de5){return function(_0x649e40){if(_0x649e40){return _0x649e40[_0x1e23('0x1e')](_0x32ab33)[_0x1e23('0x1f')](function(_0x51164a){return _0x51164a;});}return null;};}function removeEntity(_0x25a6ca,_0x15af2c){return function(_0x52884e){if(_0x52884e){return _0x52884e[_0x1e23('0x20')]()['then'](function(){var _0x3e909f=_0x52884e[_0x1e23('0x21')]({'plain':!![]});var _0x15559e=_0x1e23('0x22');return db[_0x1e23('0x23')][_0x1e23('0x20')]({'where':{'type':_0x15559e,'resourceId':_0x3e909f['id']}})[_0x1e23('0x1f')](function(){return _0x52884e;});})['then'](function(){_0x25a6ca[_0x1e23('0x24')](0xcc)[_0x1e23('0x25')]();});}};}function handleEntityNotFound(_0x1774ad,_0xa9f01f){return function(_0x386079){if(!_0x386079){_0x1774ad[_0x1e23('0x26')](0x194);}return _0x386079;};}function handleError(_0x30bbee,_0x5b57d1){_0x5b57d1=_0x5b57d1||0x1f4;return function(_0x4569d9){logger['error'](_0x4569d9['stack']);if(_0x4569d9[_0x1e23('0x27')]){delete _0x4569d9[_0x1e23('0x27')];}_0x30bbee['status'](_0x5b57d1)['send'](_0x4569d9);};}exports[_0x1e23('0x28')]=function(_0x2e7fc5,_0x4577db){var _0x5413b9={},_0x23df82={},_0x315abe={'count':0x0,'rows':[]};var _0x65a3d5=_[_0x1e23('0x29')](db['VoiceMail'][_0x1e23('0x2a')],function(_0x5d9615){return{'name':_0x5d9615[_0x1e23('0x2b')],'type':_0x5d9615[_0x1e23('0x2c')][_0x1e23('0x2d')]};});_0x23df82[_0x1e23('0x2e')]=_[_0x1e23('0x29')](_0x65a3d5,_0x1e23('0x27'));_0x23df82[_0x1e23('0x2f')]=_['keys'](_0x2e7fc5[_0x1e23('0x2f')]);_0x23df82[_0x1e23('0x30')]=_[_0x1e23('0x31')](_0x23df82[_0x1e23('0x2e')],_0x23df82[_0x1e23('0x2f')]);_0x5413b9[_0x1e23('0x32')]=_[_0x1e23('0x31')](_0x23df82[_0x1e23('0x2e')],qs[_0x1e23('0x33')](_0x2e7fc5[_0x1e23('0x2f')][_0x1e23('0x33')]));_0x5413b9[_0x1e23('0x32')]=_0x5413b9[_0x1e23('0x32')][_0x1e23('0x34')]?_0x5413b9[_0x1e23('0x32')]:_0x23df82[_0x1e23('0x2e')];if(!_0x2e7fc5[_0x1e23('0x2f')][_0x1e23('0x35')]('nolimit')){_0x5413b9[_0x1e23('0x18')]=qs[_0x1e23('0x18')](_0x2e7fc5['query'][_0x1e23('0x18')]);_0x5413b9['offset']=qs[_0x1e23('0x17')](_0x2e7fc5[_0x1e23('0x2f')]['offset']);}_0x5413b9[_0x1e23('0x36')]=qs[_0x1e23('0x37')](_0x2e7fc5['query'][_0x1e23('0x37')]);_0x5413b9[_0x1e23('0x38')]=qs[_0x1e23('0x30')](_[_0x1e23('0x39')](_0x2e7fc5[_0x1e23('0x2f')],_0x23df82[_0x1e23('0x30')]),_0x65a3d5);if(_0x2e7fc5[_0x1e23('0x2f')][_0x1e23('0x3a')]){_0x5413b9[_0x1e23('0x38')]=_[_0x1e23('0x3b')](_0x5413b9[_0x1e23('0x38')],{'$or':_[_0x1e23('0x29')](_0x65a3d5,function(_0x5d10f0){if(_0x5d10f0[_0x1e23('0x2c')]!==_0x1e23('0x3c')){var _0x353841={};_0x353841[_0x5d10f0['name']]={'$like':'%'+_0x2e7fc5[_0x1e23('0x2f')]['filter']+'%'};return _0x353841;}})});}_0x5413b9=_[_0x1e23('0x3b')]({},_0x5413b9,_0x2e7fc5[_0x1e23('0x3d')]);var _0x2933d4={'where':_0x5413b9[_0x1e23('0x38')]};return db[_0x1e23('0x3e')][_0x1e23('0x16')](_0x2933d4)['then'](function(_0xe144d2){_0x315abe[_0x1e23('0x16')]=_0xe144d2;if(_0x2e7fc5[_0x1e23('0x2f')][_0x1e23('0x3f')]){_0x5413b9[_0x1e23('0x40')]=[{'all':!![]}];}return db[_0x1e23('0x3e')]['findAll'](_0x5413b9);})[_0x1e23('0x1f')](function(_0x4e85f3){_0x315abe['rows']=_0x4e85f3;return _0x315abe;})['then'](respondWithFilteredResult(_0x4577db,_0x5413b9))[_0x1e23('0x41')](handleError(_0x4577db,null));};exports[_0x1e23('0x42')]=function(_0x2054a8,_0xe84c42){var _0x42f9fd={'raw':!![],'where':{'id':_0x2054a8[_0x1e23('0x43')]['id']}},_0x593e6d={};_0x593e6d[_0x1e23('0x2e')]=_[_0x1e23('0x44')](db[_0x1e23('0x3e')][_0x1e23('0x2a')]);_0x593e6d['query']=_[_0x1e23('0x44')](_0x2054a8[_0x1e23('0x2f')]);_0x593e6d[_0x1e23('0x30')]=_['intersection'](_0x593e6d['model'],_0x593e6d[_0x1e23('0x2f')]);_0x42f9fd[_0x1e23('0x32')]=_[_0x1e23('0x31')](_0x593e6d[_0x1e23('0x2e')],qs[_0x1e23('0x33')](_0x2054a8[_0x1e23('0x2f')][_0x1e23('0x33')]));_0x42f9fd[_0x1e23('0x32')]=_0x42f9fd[_0x1e23('0x32')]['length']?_0x42f9fd[_0x1e23('0x32')]:_0x593e6d[_0x1e23('0x2e')];if(_0x2054a8[_0x1e23('0x2f')][_0x1e23('0x3f')]){_0x42f9fd['include']=[{'all':!![]}];}_0x42f9fd=_['merge']({},_0x42f9fd,_0x2054a8[_0x1e23('0x3d')]);return db[_0x1e23('0x3e')]['find'](_0x42f9fd)[_0x1e23('0x1f')](handleEntityNotFound(_0xe84c42,null))[_0x1e23('0x1f')](respondWithResult(_0xe84c42,null))[_0x1e23('0x41')](handleError(_0xe84c42,null));};exports[_0x1e23('0x45')]=function(_0x1bf843,_0x24e128){return db[_0x1e23('0x3e')]['create'](_0x1bf843[_0x1e23('0x46')],{})['then'](function(_0x37f43e){var _0x2959c2=_0x1bf843[_0x1e23('0x47')][_0x1e23('0x21')]({'plain':!![]});if(!_0x2959c2)throw new Error(_0x1e23('0x48'));if(_0x2959c2[_0x1e23('0x49')]===_0x1e23('0x47')){var _0x4be950=_0x37f43e[_0x1e23('0x21')]({'plain':!![]});var _0x32af7b=_0x1e23('0x22');return db['UserProfileSection'][_0x1e23('0x4a')]({'where':{'name':_0x32af7b,'userProfileId':_0x2959c2[_0x1e23('0x4b')]},'raw':!![]})[_0x1e23('0x1f')](function(_0x122bac){if(_0x122bac&&_0x122bac[_0x1e23('0x4c')]===0x0){return db[_0x1e23('0x23')][_0x1e23('0x45')]({'name':_0x4be950[_0x1e23('0x27')],'resourceId':_0x4be950['id'],'type':_0x122bac[_0x1e23('0x27')],'sectionId':_0x122bac['id']},{})['then'](function(){return _0x37f43e;});}else{return _0x37f43e;}})[_0x1e23('0x41')](function(_0x3f05e3){logger[_0x1e23('0x4d')](_0x1e23('0x4e'),_0x3f05e3);throw _0x3f05e3;});}return _0x37f43e;})[_0x1e23('0x1f')](respondWithResult(_0x24e128,0xc9))['catch'](handleError(_0x24e128,null));};exports[_0x1e23('0x1e')]=function(_0x238a0b,_0x112134){if(_0x238a0b[_0x1e23('0x46')]['id']){delete _0x238a0b[_0x1e23('0x46')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0x238a0b[_0x1e23('0x43')]['id']}})[_0x1e23('0x1f')](handleEntityNotFound(_0x112134,null))['then'](saveUpdates(_0x238a0b[_0x1e23('0x46')],null))[_0x1e23('0x1f')](respondWithResult(_0x112134,null))[_0x1e23('0x41')](handleError(_0x112134,null));};exports['destroy']=function(_0x4f256b,_0x5833f8){return db[_0x1e23('0x3e')][_0x1e23('0x4a')]({'where':{'id':_0x4f256b[_0x1e23('0x43')]['id']}})[_0x1e23('0x1f')](handleEntityNotFound(_0x5833f8,null))['then'](removeEntity(_0x5833f8,null))[_0x1e23('0x41')](handleError(_0x5833f8,null));};exports[_0x1e23('0x4f')]=function(_0x40d40e,_0x19582a,_0x3ad3fb){return db[_0x1e23('0x3e')]['findOne']({'where':{'id':_0x40d40e[_0x1e23('0x43')]['id']}})[_0x1e23('0x1f')](handleEntityNotFound(_0x19582a,null))[_0x1e23('0x1f')](function(_0x239579){var _0x424303;var _0x4f6561={},_0x140dac={};_0x140dac[_0x1e23('0x2e')]=_['keys'](db[_0x1e23('0x50')][_0x1e23('0x2a')]);_0x140dac[_0x1e23('0x2f')]=_['keys'](_0x40d40e[_0x1e23('0x2f')]);_0x140dac[_0x1e23('0x30')]=_[_0x1e23('0x31')](_0x140dac[_0x1e23('0x2e')],_0x140dac[_0x1e23('0x2f')]);_0x4f6561[_0x1e23('0x32')]=_[_0x1e23('0x31')](_0x140dac[_0x1e23('0x2e')],qs['fields'](_0x40d40e[_0x1e23('0x2f')]['fields']));_0x4f6561[_0x1e23('0x32')]=_0x4f6561['attributes']['length']?_0x4f6561[_0x1e23('0x32')]:_0x140dac[_0x1e23('0x2e')];if(!_0x40d40e[_0x1e23('0x2f')][_0x1e23('0x35')](_0x1e23('0x51'))){_0x4f6561[_0x1e23('0x18')]=qs[_0x1e23('0x18')](_0x40d40e['query'][_0x1e23('0x18')]);_0x4f6561[_0x1e23('0x17')]=qs[_0x1e23('0x17')](_0x40d40e[_0x1e23('0x2f')][_0x1e23('0x17')]);}_0x4f6561[_0x1e23('0x36')]=qs[_0x1e23('0x37')](_0x40d40e[_0x1e23('0x2f')]['sort']);_0x4f6561['where']=qs[_0x1e23('0x30')](_[_0x1e23('0x39')](_0x40d40e[_0x1e23('0x2f')],_0x140dac[_0x1e23('0x30')]));if(_0x40d40e[_0x1e23('0x2f')][_0x1e23('0x3a')]){_0x4f6561[_0x1e23('0x38')]=_[_0x1e23('0x3b')](_0x4f6561[_0x1e23('0x38')],{'$or':_['map'](_0x4f6561[_0x1e23('0x32')],function(_0x5e14f7){var _0xb2f118={};_0xb2f118[_0x5e14f7]={'$like':'%'+_0x40d40e[_0x1e23('0x2f')][_0x1e23('0x3a')]+'%'};return _0xb2f118;})});}_0x4f6561['where']=_[_0x1e23('0x3b')](_0x4f6561[_0x1e23('0x38')],{'mailboxuser':_0x239579[_0x1e23('0x52')]});_0x4f6561=_[_0x1e23('0x3b')]({},_0x4f6561,_0x40d40e[_0x1e23('0x3d')]);return db['VoiceMailMessage'][_0x1e23('0x53')](_0x4f6561)[_0x1e23('0x1f')](respondWithFilteredResult(_0x19582a,_0x4f6561));})['catch'](handleError(_0x19582a,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 36d5111..b9d2105 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 _0x68f4=['mailbox','context','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context'];(function(_0x439065,_0x46f77f){var _0x489ee8=function(_0x11fdd7){while(--_0x11fdd7){_0x439065['push'](_0x439065['shift']());}};_0x489ee8(++_0x46f77f);}(_0x68f4,0x1de));var _0x468f=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x68f4[_0x1d1779];return _0x2377e9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x468f('0x0'))('api');var moment=require(_0x468f('0x1'));var BPromise=require(_0x468f('0x2'));var rp=require(_0x468f('0x3'));var fs=require('fs');var path=require(_0x468f('0x4'));var rimraf=require('rimraf');var config=require(_0x468f('0x5'));var attributes=require(_0x468f('0x6'));module[_0x468f('0x7')]=function(_0x25b839,_0x5f15f3){return _0x25b839[_0x468f('0x8')](_0x468f('0x9'),attributes,{'tableName':_0x468f('0xa'),'paranoid':![],'indexes':[{'name':_0x468f('0xb'),'fields':[_0x468f('0xc'),_0x468f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0266=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','context','util'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x0266,0x1a3));var _0x6026=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0266[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x6026('0x0'));var logger=require(_0x6026('0x1'))(_0x6026('0x2'));var moment=require(_0x6026('0x3'));var BPromise=require(_0x6026('0x4'));var rp=require(_0x6026('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6026('0x6'));var config=require(_0x6026('0x7'));var attributes=require(_0x6026('0x8'));module[_0x6026('0x9')]=function(_0x4bfd14,_0x3feda5){return _0x4bfd14[_0x6026('0xa')](_0x6026('0xb'),attributes,{'tableName':_0x6026('0xc'),'paranoid':![],'indexes':[{'name':_0x6026('0xd'),'fields':['mailbox',_0x6026('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 893c784..bfeb298 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 _0x09b9=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','message','VoiceMail,\x20%s,\x20%s','result'];(function(_0xe30cce,_0x50db7d){var _0x495fd5=function(_0x726fbf){while(--_0x726fbf){_0xe30cce['push'](_0xe30cce['shift']());}};_0x495fd5(++_0x50db7d);}(_0x09b9,0x171));var _0x909b=function(_0x2ab1a7,_0x3bf265){_0x2ab1a7=_0x2ab1a7-0x0;var _0x4934e3=_0x09b9[_0x2ab1a7];return _0x4934e3;};'use strict';var _=require(_0x909b('0x0'));var util=require(_0x909b('0x1'));var moment=require(_0x909b('0x2'));var BPromise=require(_0x909b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x909b('0x4'));var db=require(_0x909b('0x5'))['db'];var utils=require(_0x909b('0x6'));var logger=require(_0x909b('0x7'))(_0x909b('0x8'));var config=require('../../config/environment');var jayson=require(_0x909b('0x9'));var client=jayson[_0x909b('0xa')][_0x909b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9c1d02,_0x27e931,_0x3b9296){return new BPromise(function(_0x19afe9,_0x5b1fba){return client[_0x909b('0xc')](_0x9c1d02,_0x3b9296)['then'](function(_0x1056d3){logger[_0x909b('0xd')]('VoiceMail,\x20%s,\x20%s',_0x27e931,_0x909b('0xe'));logger[_0x909b('0xf')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x27e931,_0x909b('0xe'),JSON[_0x909b('0x10')](_0x1056d3));if(_0x1056d3[_0x909b('0x11')]){if(_0x1056d3[_0x909b('0x11')][_0x909b('0x12')]===0x1f4){logger[_0x909b('0x11')]('VoiceMail,\x20%s,\x20%s',_0x27e931,_0x1056d3['error'][_0x909b('0x13')]);return _0x5b1fba(_0x1056d3['error'][_0x909b('0x13')]);}logger[_0x909b('0x11')](_0x909b('0x14'),_0x27e931,_0x1056d3[_0x909b('0x11')]['message']);return _0x19afe9(_0x1056d3[_0x909b('0x11')][_0x909b('0x13')]);}else{logger['info'](_0x909b('0x14'),_0x27e931,_0x909b('0xe'));_0x19afe9(_0x1056d3[_0x909b('0x15')][_0x909b('0x13')]);}})[_0x909b('0x16')](function(_0x1a9efa){logger[_0x909b('0x11')](_0x909b('0x14'),_0x27e931,_0x1a9efa);_0x5b1fba(_0x1a9efa);});});} \ No newline at end of file +var _0xd42f=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','request','then','info','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','VoiceMail,\x20%s,\x20%s','message','result','util','moment','bluebird'];(function(_0x1304fa,_0x548949){var _0x19299d=function(_0xb50120){while(--_0xb50120){_0x1304fa['push'](_0x1304fa['shift']());}};_0x19299d(++_0x548949);}(_0xd42f,0x1a1));var _0xfd42=function(_0x2547be,_0x302d8f){_0x2547be=_0x2547be-0x0;var _0x5109d8=_0xd42f[_0x2547be];return _0x5109d8;};'use strict';var _=require('lodash');var util=require(_0xfd42('0x0'));var moment=require(_0xfd42('0x1'));var BPromise=require(_0xfd42('0x2'));var rs=require(_0xfd42('0x3'));var fs=require('fs');var Redis=require(_0xfd42('0x4'));var db=require(_0xfd42('0x5'))['db'];var utils=require(_0xfd42('0x6'));var logger=require(_0xfd42('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfd42('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b43f,_0x222acb,_0x146cd6){return new BPromise(function(_0x26d8b2,_0xdc76c1){return client[_0xfd42('0x9')](_0x10b43f,_0x146cd6)[_0xfd42('0xa')](function(_0x644316){logger[_0xfd42('0xb')]('VoiceMail,\x20%s,\x20%s',_0x222acb,'request\x20sent');logger[_0xfd42('0xc')](_0xfd42('0xd'),_0x222acb,_0xfd42('0xe'),JSON[_0xfd42('0xf')](_0x644316));if(_0x644316['error']){if(_0x644316['error'][_0xfd42('0x10')]===0x1f4){logger[_0xfd42('0x11')](_0xfd42('0x12'),_0x222acb,_0x644316[_0xfd42('0x11')][_0xfd42('0x13')]);return _0xdc76c1(_0x644316[_0xfd42('0x11')]['message']);}logger[_0xfd42('0x11')](_0xfd42('0x12'),_0x222acb,_0x644316[_0xfd42('0x11')][_0xfd42('0x13')]);return _0x26d8b2(_0x644316[_0xfd42('0x11')]['message']);}else{logger[_0xfd42('0xb')]('VoiceMail,\x20%s,\x20%s',_0x222acb,'request\x20sent');_0x26d8b2(_0x644316[_0xfd42('0x14')][_0xfd42('0x13')]);}})['catch'](function(_0x118aad){logger[_0xfd42('0x11')](_0xfd42('0x12'),_0x222acb,_0x118aad);_0xdc76c1(_0x118aad);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 2f84c47..911cdb6 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 _0x4819=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','index','isAuthenticated','show','/:id/download','post','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x3cc90b,_0x1b69d9){var _0x34051b=function(_0x1f01f7){while(--_0x1f01f7){_0x3cc90b['push'](_0x3cc90b['shift']());}};_0x34051b(++_0x1b69d9);}(_0x4819,0xcd));var _0x9481=function(_0x5b0bc8,_0x3f86b0){_0x5b0bc8=_0x5b0bc8-0x0;var _0x1626a5=_0x4819[_0x5b0bc8];return _0x1626a5;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var auth=require(_0x9481('0x5'));var interaction=require(_0x9481('0x6'));var config=require(_0x9481('0x7'));var controller=require(_0x9481('0x8'));router[_0x9481('0x9')]('/',auth['isAuthenticated'](),controller[_0x9481('0xa')]);router['get']('/:id',auth[_0x9481('0xb')](),controller[_0x9481('0xc')]);router[_0x9481('0x9')](_0x9481('0xd'),auth[_0x9481('0xb')](),controller['download']);router[_0x9481('0xe')]('/',auth['isAuthenticated'](),controller[_0x9481('0xf')]);router['put'](_0x9481('0x10'),auth[_0x9481('0xb')](),controller[_0x9481('0x11')]);router[_0x9481('0x12')](_0x9481('0x10'),auth[_0x9481('0xb')](),controller[_0x9481('0x13')]);module[_0x9481('0x14')]=router; \ No newline at end of file +var _0xc6ac=['show','download','post','create','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index'];(function(_0x45635d,_0x1c49e1){var _0x1f3165=function(_0x1165d9){while(--_0x1165d9){_0x45635d['push'](_0x45635d['shift']());}};_0x1f3165(++_0x1c49e1);}(_0xc6ac,0x15b));var _0xcc6a=function(_0xe9f758,_0x232155){_0xe9f758=_0xe9f758-0x0;var _0x10cede=_0xc6ac[_0xe9f758];return _0x10cede;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var auth=require(_0xcc6a('0x6'));var interaction=require(_0xcc6a('0x7'));var config=require(_0xcc6a('0x8'));var controller=require(_0xcc6a('0x9'));router[_0xcc6a('0xa')]('/',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xc')]);router[_0xcc6a('0xa')]('/:id',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xd')]);router[_0xcc6a('0xa')]('/:id/download',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xe')]);router[_0xcc6a('0xf')]('/',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x10')]);router['put'](_0xcc6a('0x11'),auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x12')]);router['delete'](_0xcc6a('0x11'),auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 34359bf..9d6f6d6 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 _0x2db6=['VIRTUAL','getDataValue','STRING','BLOB','long','sequelize'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x2db6,0xa1));var _0x62db=function(_0x238827,_0x3f265d){_0x238827=_0x238827-0x0;var _0x2f3eda=_0x2db6[_0x238827];return _0x2f3eda;};'use strict';var Sequelize=require(_0x62db('0x0'));module['exports']={'name':{'type':Sequelize[_0x62db('0x1')],'get':function(_0x588609){return this[_0x62db('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x62db('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x62db('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x62db('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x62db('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x62db('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x62db('0x4')](_0x62db('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x62db('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file +var _0xd1aa=['getDataValue','STRING','sequelize','exports','VIRTUAL'];(function(_0x11c4a0,_0x16e123){var _0x467b6e=function(_0x2e0bc0){while(--_0x2e0bc0){_0x11c4a0['push'](_0x11c4a0['shift']());}};_0x467b6e(++_0x16e123);}(_0xd1aa,0xf2));var _0xad1a=function(_0x3452eb,_0x44035e){_0x3452eb=_0x3452eb-0x0;var _0x4244fd=_0xd1aa[_0x3452eb];return _0x4244fd;};'use strict';var Sequelize=require(_0xad1a('0x0'));module[_0xad1a('0x1')]={'name':{'type':Sequelize[_0xad1a('0x2')],'get':function(_0x479a41){return this[_0xad1a('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xad1a('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xad1a('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xad1a('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xad1a('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xad1a('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xad1a('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xad1a('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xad1a('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 514ce04..a332893 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 _0x263f=['fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','VoiceMailMessage','rawAttributes','type','key','model','differenceBy','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','count','includeAll','findAll','catch','show','params','keys','include','find','create','update','body','download','recording','msg_id','Sequelize','ValidationError','.wav\x22','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x263f,0x182));var _0xf263=function(_0x4ffc42,_0x2facd6){_0x4ffc42=_0x4ffc42-0x0;var _0x5882f9=_0x263f[_0x4ffc42];return _0x5882f9;};'use strict';var pdf=require(_0xf263('0x0'));var emlformat=require(_0xf263('0x1'));var rimraf=require(_0xf263('0x2'));var zipdir=require(_0xf263('0x3'));var jsonpatch=require(_0xf263('0x4'));var rp=require(_0xf263('0x5'));var moment=require('moment');var BPromise=require(_0xf263('0x6'));var Mustache=require(_0xf263('0x7'));var util=require(_0xf263('0x8'));var path=require('path');var sox=require(_0xf263('0x9'));var csv=require(_0xf263('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf263('0xb'));var crypto=require(_0xf263('0xc'));var jsforce=require(_0xf263('0xd'));var deskjs=require(_0xf263('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf263('0xf'));var Papa=require(_0xf263('0x10'));var Redis=require(_0xf263('0x11'));var authService=require(_0xf263('0x12'));var qs=require(_0xf263('0x13'));var as=require(_0xf263('0x14'));var hardwareService=require(_0xf263('0x15'));var logger=require('../../config/logger')(_0xf263('0x16'));var utils=require('../../config/utils');var config=require(_0xf263('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e46a6,_0x2fc9f0){_0x2fc9f0=_0x2fc9f0||0xcc;return function(_0x2b1145){if(_0x2b1145){return _0x5e46a6[_0xf263('0x18')](_0x2fc9f0);}return _0x5e46a6[_0xf263('0x19')](_0x2fc9f0)[_0xf263('0x1a')]();};}function respondWithResult(_0xc6a733,_0xc75366){_0xc75366=_0xc75366||0xc8;return function(_0x559c6c){if(_0x559c6c){return _0xc6a733[_0xf263('0x19')](_0xc75366)['json'](_0x559c6c);}};}function respondWithFilteredResult(_0x2a79aa,_0x27b16a){return function(_0x3ac432){if(_0x3ac432){var _0x402739=_0x3ac432['count'],_0x16b4dd=_0x27b16a['offset'],_0xf45ebe=_0x27b16a[_0xf263('0x1b')]+_0x27b16a[_0xf263('0x1c')],_0x506789;if(_0xf45ebe>=_0x402739){_0xf45ebe=_0x402739;_0x506789=0xc8;}else{_0x506789=0xce;}_0x2a79aa[_0xf263('0x19')](_0x506789);return _0x2a79aa[_0xf263('0x1d')](_0xf263('0x1e'),_0x16b4dd+'-'+_0xf45ebe+'/'+_0x402739)['json'](_0x3ac432);}return null;};}function patchUpdates(_0x1adb66){return function(_0x523061){try{jsonpatch[_0xf263('0x1f')](_0x523061,_0x1adb66,!![]);}catch(_0x22e399){return BPromise[_0xf263('0x20')](_0x22e399);}return _0x523061['save']();};}function saveUpdates(_0x4c44ea,_0x169328){return function(_0x127135){if(_0x127135){return _0x127135['update'](_0x4c44ea)[_0xf263('0x21')](function(_0x4202d1){return _0x4202d1;});}return null;};}function removeEntity(_0x431c10,_0x426667){return function(_0xa0695){if(_0xa0695){return _0xa0695[_0xf263('0x22')]()[_0xf263('0x21')](function(){_0x431c10[_0xf263('0x19')](0xcc)[_0xf263('0x1a')]();});}};}function handleEntityNotFound(_0xe32b07,_0x29eb45){return function(_0x4de045){if(!_0x4de045){_0xe32b07['sendStatus'](0x194);}return _0x4de045;};}function handleError(_0x5dc48f,_0x2de7aa){_0x2de7aa=_0x2de7aa||0x1f4;return function(_0x4175a6){logger[_0xf263('0x23')](_0x4175a6[_0xf263('0x24')]);if(_0x4175a6[_0xf263('0x25')]){delete _0x4175a6[_0xf263('0x25')];}_0x5dc48f[_0xf263('0x19')](_0x2de7aa)[_0xf263('0x26')](_0x4175a6);};}exports[_0xf263('0x27')]=function(_0xbeabe5,_0x2411a2){var _0x5e9ba3={},_0x2046d9={},_0x4ea2c4={'count':0x0,'rows':[]};var _0x3f74ed=_['map'](db[_0xf263('0x28')][_0xf263('0x29')],function(_0x5a11bf){return{'name':_0x5a11bf['fieldName'],'type':_0x5a11bf[_0xf263('0x2a')][_0xf263('0x2b')]};});_0x2046d9[_0xf263('0x2c')]=_[_0xf263('0x2d')](_[_0xf263('0x2e')](_0x3f74ed,_0xf263('0x25')),[_0xf263('0x25')]);_0x2046d9[_0xf263('0x2f')]=_['keys'](_0xbeabe5[_0xf263('0x2f')]);_0x2046d9[_0xf263('0x30')]=_[_0xf263('0x31')](_0x2046d9[_0xf263('0x2c')],_0x2046d9[_0xf263('0x2f')]);_0x5e9ba3[_0xf263('0x32')]=_[_0xf263('0x31')](_0x2046d9[_0xf263('0x2c')],qs[_0xf263('0x33')](_0xbeabe5['query'][_0xf263('0x33')]));_0x5e9ba3['attributes']=_0x5e9ba3['attributes'][_0xf263('0x34')]?_0x5e9ba3[_0xf263('0x32')]:_0x2046d9['model'];if(!_0xbeabe5[_0xf263('0x2f')][_0xf263('0x35')]('nolimit')){_0x5e9ba3[_0xf263('0x1c')]=qs[_0xf263('0x1c')](_0xbeabe5[_0xf263('0x2f')][_0xf263('0x1c')]);_0x5e9ba3[_0xf263('0x1b')]=qs[_0xf263('0x1b')](_0xbeabe5['query'][_0xf263('0x1b')]);}_0x5e9ba3[_0xf263('0x36')]=qs['sort'](_0xbeabe5['query'][_0xf263('0x37')]);_0x5e9ba3[_0xf263('0x38')]=qs[_0xf263('0x30')](_[_0xf263('0x39')](_0xbeabe5['query'],_0x2046d9[_0xf263('0x30')]),_0x3f74ed);if(_0xbeabe5[_0xf263('0x2f')][_0xf263('0x3a')]){_0x5e9ba3[_0xf263('0x38')]=_[_0xf263('0x3b')](_0x5e9ba3['where'],{'$or':_[_0xf263('0x2e')](_0x3f74ed,function(_0x3a6834){if(_0x3a6834[_0xf263('0x2a')]!=='VIRTUAL'){var _0x1ece85={};_0x1ece85[_0x3a6834[_0xf263('0x25')]]={'$like':'%'+_0xbeabe5[_0xf263('0x2f')][_0xf263('0x3a')]+'%'};return _0x1ece85;}})});}_0x5e9ba3=_[_0xf263('0x3b')]({},_0x5e9ba3,_0xbeabe5['options']);var _0x288c61={'where':_0x5e9ba3[_0xf263('0x38')]};return db[_0xf263('0x28')]['count'](_0x288c61)[_0xf263('0x21')](function(_0x2d20a5){_0x4ea2c4[_0xf263('0x3c')]=_0x2d20a5;if(_0xbeabe5['query'][_0xf263('0x3d')]){_0x5e9ba3['include']=[{'all':!![]}];}return db[_0xf263('0x28')][_0xf263('0x3e')](_0x5e9ba3);})[_0xf263('0x21')](function(_0x56fa52){_0x4ea2c4['rows']=_0x56fa52;return _0x4ea2c4;})['then'](respondWithFilteredResult(_0x2411a2,_0x5e9ba3))[_0xf263('0x3f')](handleError(_0x2411a2,null));};exports[_0xf263('0x40')]=function(_0x56303f,_0x5e33ba){var _0x188faa={'raw':!![],'where':{'id':_0x56303f[_0xf263('0x41')]['id']}},_0x1e1dbf={};_0x1e1dbf[_0xf263('0x2c')]=_[_0xf263('0x42')](db['VoiceMailMessage'][_0xf263('0x29')]);_0x1e1dbf[_0xf263('0x2f')]=_[_0xf263('0x42')](_0x56303f[_0xf263('0x2f')]);_0x1e1dbf[_0xf263('0x30')]=_['intersection'](_0x1e1dbf[_0xf263('0x2c')],_0x1e1dbf[_0xf263('0x2f')]);_0x188faa[_0xf263('0x32')]=_['intersection'](_0x1e1dbf['model'],qs[_0xf263('0x33')](_0x56303f['query']['fields']));_0x188faa[_0xf263('0x32')]=_0x188faa[_0xf263('0x32')][_0xf263('0x34')]?_0x188faa['attributes']:_0x1e1dbf[_0xf263('0x2c')];if(_0x56303f[_0xf263('0x2f')]['includeAll']){_0x188faa[_0xf263('0x43')]=[{'all':!![]}];}_0x188faa=_[_0xf263('0x3b')]({},_0x188faa,_0x56303f['options']);return db[_0xf263('0x28')][_0xf263('0x44')](_0x188faa)['then'](handleEntityNotFound(_0x5e33ba,null))[_0xf263('0x21')](respondWithResult(_0x5e33ba,null))[_0xf263('0x3f')](handleError(_0x5e33ba,null));};exports[_0xf263('0x45')]=function(_0x175db0,_0x291f7f){return db[_0xf263('0x28')][_0xf263('0x45')](_0x175db0['body'],{})[_0xf263('0x21')](respondWithResult(_0x291f7f,0xc9))[_0xf263('0x3f')](handleError(_0x291f7f,null));};exports[_0xf263('0x46')]=function(_0x146a90,_0x1a312d){if(_0x146a90[_0xf263('0x47')]['id']){delete _0x146a90[_0xf263('0x47')]['id'];}return db[_0xf263('0x28')]['find']({'where':{'id':_0x146a90[_0xf263('0x41')]['id']}})[_0xf263('0x21')](handleEntityNotFound(_0x1a312d,null))[_0xf263('0x21')](saveUpdates(_0x146a90[_0xf263('0x47')],null))['then'](respondWithResult(_0x1a312d,null))[_0xf263('0x3f')](handleError(_0x1a312d,null));};exports['destroy']=function(_0x773a03,_0x159852){return db[_0xf263('0x28')]['find']({'where':{'id':_0x773a03['params']['id']}})['then'](handleEntityNotFound(_0x159852,null))['then'](removeEntity(_0x159852,null))['catch'](handleError(_0x159852,null));};exports[_0xf263('0x48')]=function(_0x4105f2,_0x4dad15,_0x27e15d){return db[_0xf263('0x28')][_0xf263('0x44')]({'where':{'id':_0x4105f2[_0xf263('0x41')]['id']},'attributes':['id',_0xf263('0x49'),_0xf263('0x4a')]})[_0xf263('0x21')](handleEntityNotFound(_0x4dad15,null))[_0xf263('0x21')](function(_0x34afc5){if(_0x34afc5){if(!_0x34afc5[_0xf263('0x49')]){throw new db[(_0xf263('0x4b'))][(_0xf263('0x4c'))]('VoiceMailMessage\x20not\x20found');}var _0x2d8e12={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x34afc5[_0xf263('0x4a')]){_0x2d8e12['Content-Disposition']='attachment;\x20filename=\x22'+_0x34afc5[_0xf263('0x4a')]+_0xf263('0x4d');}_0x4dad15['set'](_0x2d8e12);return _0x4dad15[_0xf263('0x26')](new Buffer(_0x34afc5['recording']));}})[_0xf263('0x3f')](handleError(_0x4dad15,null));}; \ No newline at end of file +var _0xbf6e=['ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','send','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','index','map','VoiceMailMessage','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','download','msg_id','recording','Sequelize'];(function(_0x5428a7,_0x1089f3){var _0x3900ec=function(_0x817ab7){while(--_0x817ab7){_0x5428a7['push'](_0x5428a7['shift']());}};_0x3900ec(++_0x1089f3);}(_0xbf6e,0x149));var _0xebf6=function(_0x1163a0,_0xfed5f4){_0x1163a0=_0x1163a0-0x0;var _0x1af53e=_0xbf6e[_0x1163a0];return _0x1af53e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xebf6('0x0'));var zipdir=require(_0xebf6('0x1'));var jsonpatch=require(_0xebf6('0x2'));var rp=require(_0xebf6('0x3'));var moment=require(_0xebf6('0x4'));var BPromise=require(_0xebf6('0x5'));var Mustache=require(_0xebf6('0x6'));var util=require('util');var path=require(_0xebf6('0x7'));var sox=require(_0xebf6('0x8'));var csv=require(_0xebf6('0x9'));var ejs=require(_0xebf6('0xa'));var fs=require('fs');var _=require(_0xebf6('0xb'));var squel=require(_0xebf6('0xc'));var crypto=require(_0xebf6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xebf6('0xe'));var toCsv=require(_0xebf6('0x9'));var querystring=require(_0xebf6('0xf'));var Papa=require('papaparse');var Redis=require(_0xebf6('0x10'));var authService=require(_0xebf6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xebf6('0x12'));var hardwareService=require(_0xebf6('0x13'));var logger=require(_0xebf6('0x14'))(_0xebf6('0x15'));var utils=require(_0xebf6('0x16'));var config=require(_0xebf6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26fe9c,_0xedc361){_0xedc361=_0xedc361||0xcc;return function(_0x4919f1){if(_0x4919f1){return _0x26fe9c[_0xebf6('0x18')](_0xedc361);}return _0x26fe9c[_0xebf6('0x19')](_0xedc361)[_0xebf6('0x1a')]();};}function respondWithResult(_0x165b56,_0x3f69e6){_0x3f69e6=_0x3f69e6||0xc8;return function(_0x4dbf51){if(_0x4dbf51){return _0x165b56['status'](_0x3f69e6)['json'](_0x4dbf51);}};}function respondWithFilteredResult(_0x4cecbc,_0x1ae2f7){return function(_0x50d80f){if(_0x50d80f){var _0x35570e=_0x50d80f[_0xebf6('0x1b')],_0x2c980f=_0x1ae2f7[_0xebf6('0x1c')],_0xb164a1=_0x1ae2f7[_0xebf6('0x1c')]+_0x1ae2f7[_0xebf6('0x1d')],_0x642167;if(_0xb164a1>=_0x35570e){_0xb164a1=_0x35570e;_0x642167=0xc8;}else{_0x642167=0xce;}_0x4cecbc[_0xebf6('0x19')](_0x642167);return _0x4cecbc[_0xebf6('0x1e')]('Content-Range',_0x2c980f+'-'+_0xb164a1+'/'+_0x35570e)['json'](_0x50d80f);}return null;};}function patchUpdates(_0xe03844){return function(_0x38c9e3){try{jsonpatch[_0xebf6('0x1f')](_0x38c9e3,_0xe03844,!![]);}catch(_0x410f06){return BPromise[_0xebf6('0x20')](_0x410f06);}return _0x38c9e3[_0xebf6('0x21')]();};}function saveUpdates(_0x35f739,_0x80f523){return function(_0x4fb497){if(_0x4fb497){return _0x4fb497[_0xebf6('0x22')](_0x35f739)[_0xebf6('0x23')](function(_0x377934){return _0x377934;});}return null;};}function removeEntity(_0x23d487,_0x6303ac){return function(_0x14c8ac){if(_0x14c8ac){return _0x14c8ac[_0xebf6('0x24')]()[_0xebf6('0x23')](function(){_0x23d487[_0xebf6('0x19')](0xcc)[_0xebf6('0x1a')]();});}};}function handleEntityNotFound(_0x232074,_0x2dd2ed){return function(_0x43c4e2){if(!_0x43c4e2){_0x232074[_0xebf6('0x18')](0x194);}return _0x43c4e2;};}function handleError(_0x2f6e5d,_0x1d0078){_0x1d0078=_0x1d0078||0x1f4;return function(_0x3b2b64){logger[_0xebf6('0x25')](_0x3b2b64[_0xebf6('0x26')]);if(_0x3b2b64['name']){delete _0x3b2b64['name'];}_0x2f6e5d[_0xebf6('0x19')](_0x1d0078)['send'](_0x3b2b64);};}exports[_0xebf6('0x27')]=function(_0x430eb7,_0x5a01ea){var _0x4f39eb={},_0x37950c={},_0x40ae57={'count':0x0,'rows':[]};var _0x3c3d5c=_[_0xebf6('0x28')](db[_0xebf6('0x29')][_0xebf6('0x2a')],function(_0x7976d){return{'name':_0x7976d[_0xebf6('0x2b')],'type':_0x7976d['type'][_0xebf6('0x2c')]};});_0x37950c[_0xebf6('0x2d')]=_['differenceBy'](_[_0xebf6('0x28')](_0x3c3d5c,_0xebf6('0x2e')),['name']);_0x37950c[_0xebf6('0x2f')]=_[_0xebf6('0x30')](_0x430eb7[_0xebf6('0x2f')]);_0x37950c[_0xebf6('0x31')]=_[_0xebf6('0x32')](_0x37950c[_0xebf6('0x2d')],_0x37950c['query']);_0x4f39eb[_0xebf6('0x33')]=_[_0xebf6('0x32')](_0x37950c['model'],qs['fields'](_0x430eb7[_0xebf6('0x2f')][_0xebf6('0x34')]));_0x4f39eb['attributes']=_0x4f39eb[_0xebf6('0x33')][_0xebf6('0x35')]?_0x4f39eb['attributes']:_0x37950c[_0xebf6('0x2d')];if(!_0x430eb7[_0xebf6('0x2f')][_0xebf6('0x36')]('nolimit')){_0x4f39eb[_0xebf6('0x1d')]=qs[_0xebf6('0x1d')](_0x430eb7[_0xebf6('0x2f')][_0xebf6('0x1d')]);_0x4f39eb['offset']=qs['offset'](_0x430eb7[_0xebf6('0x2f')][_0xebf6('0x1c')]);}_0x4f39eb['order']=qs[_0xebf6('0x37')](_0x430eb7[_0xebf6('0x2f')]['sort']);_0x4f39eb[_0xebf6('0x38')]=qs[_0xebf6('0x31')](_[_0xebf6('0x39')](_0x430eb7[_0xebf6('0x2f')],_0x37950c[_0xebf6('0x31')]),_0x3c3d5c);if(_0x430eb7['query'][_0xebf6('0x3a')]){_0x4f39eb['where']=_[_0xebf6('0x3b')](_0x4f39eb['where'],{'$or':_[_0xebf6('0x28')](_0x3c3d5c,function(_0x3893cf){if(_0x3893cf[_0xebf6('0x3c')]!==_0xebf6('0x3d')){var _0x2f1236={};_0x2f1236[_0x3893cf[_0xebf6('0x2e')]]={'$like':'%'+_0x430eb7['query'][_0xebf6('0x3a')]+'%'};return _0x2f1236;}})});}_0x4f39eb=_[_0xebf6('0x3b')]({},_0x4f39eb,_0x430eb7[_0xebf6('0x3e')]);var _0x144b41={'where':_0x4f39eb[_0xebf6('0x38')]};return db[_0xebf6('0x29')]['count'](_0x144b41)[_0xebf6('0x23')](function(_0x2782a5){_0x40ae57[_0xebf6('0x1b')]=_0x2782a5;if(_0x430eb7[_0xebf6('0x2f')][_0xebf6('0x3f')]){_0x4f39eb[_0xebf6('0x40')]=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x4f39eb);})['then'](function(_0xd4d5f4){_0x40ae57[_0xebf6('0x41')]=_0xd4d5f4;return _0x40ae57;})[_0xebf6('0x23')](respondWithFilteredResult(_0x5a01ea,_0x4f39eb))['catch'](handleError(_0x5a01ea,null));};exports[_0xebf6('0x42')]=function(_0x1c3809,_0x36c270){var _0x5ca582={'raw':!![],'where':{'id':_0x1c3809[_0xebf6('0x43')]['id']}},_0x8cca55={};_0x8cca55['model']=_[_0xebf6('0x30')](db[_0xebf6('0x29')][_0xebf6('0x2a')]);_0x8cca55['query']=_[_0xebf6('0x30')](_0x1c3809['query']);_0x8cca55['filters']=_[_0xebf6('0x32')](_0x8cca55[_0xebf6('0x2d')],_0x8cca55[_0xebf6('0x2f')]);_0x5ca582[_0xebf6('0x33')]=_['intersection'](_0x8cca55[_0xebf6('0x2d')],qs['fields'](_0x1c3809[_0xebf6('0x2f')][_0xebf6('0x34')]));_0x5ca582[_0xebf6('0x33')]=_0x5ca582[_0xebf6('0x33')][_0xebf6('0x35')]?_0x5ca582['attributes']:_0x8cca55['model'];if(_0x1c3809[_0xebf6('0x2f')][_0xebf6('0x3f')]){_0x5ca582[_0xebf6('0x40')]=[{'all':!![]}];}_0x5ca582=_[_0xebf6('0x3b')]({},_0x5ca582,_0x1c3809['options']);return db[_0xebf6('0x29')][_0xebf6('0x44')](_0x5ca582)[_0xebf6('0x23')](handleEntityNotFound(_0x36c270,null))[_0xebf6('0x23')](respondWithResult(_0x36c270,null))[_0xebf6('0x45')](handleError(_0x36c270,null));};exports[_0xebf6('0x46')]=function(_0x45e0f1,_0x550bd8){return db[_0xebf6('0x29')][_0xebf6('0x46')](_0x45e0f1[_0xebf6('0x47')],{})[_0xebf6('0x23')](respondWithResult(_0x550bd8,0xc9))[_0xebf6('0x45')](handleError(_0x550bd8,null));};exports[_0xebf6('0x22')]=function(_0x250cf4,_0x56b26b){if(_0x250cf4[_0xebf6('0x47')]['id']){delete _0x250cf4['body']['id'];}return db[_0xebf6('0x29')][_0xebf6('0x44')]({'where':{'id':_0x250cf4['params']['id']}})[_0xebf6('0x23')](handleEntityNotFound(_0x56b26b,null))['then'](saveUpdates(_0x250cf4[_0xebf6('0x47')],null))[_0xebf6('0x23')](respondWithResult(_0x56b26b,null))[_0xebf6('0x45')](handleError(_0x56b26b,null));};exports[_0xebf6('0x24')]=function(_0x82f1aa,_0x53e3ff){return db[_0xebf6('0x29')][_0xebf6('0x44')]({'where':{'id':_0x82f1aa['params']['id']}})[_0xebf6('0x23')](handleEntityNotFound(_0x53e3ff,null))[_0xebf6('0x23')](removeEntity(_0x53e3ff,null))[_0xebf6('0x45')](handleError(_0x53e3ff,null));};exports[_0xebf6('0x48')]=function(_0x44c62e,_0x549892,_0xe6361b){return db[_0xebf6('0x29')][_0xebf6('0x44')]({'where':{'id':_0x44c62e[_0xebf6('0x43')]['id']},'attributes':['id','recording',_0xebf6('0x49')]})[_0xebf6('0x23')](handleEntityNotFound(_0x549892,null))[_0xebf6('0x23')](function(_0x303997){if(_0x303997){if(!_0x303997[_0xebf6('0x4a')]){throw new db[(_0xebf6('0x4b'))][(_0xebf6('0x4c'))](_0xebf6('0x4d'));}var _0x426cf0={'Content-Type':'audio/wav','Content-Disposition':_0xebf6('0x4e')};if(_0x303997[_0xebf6('0x49')]){_0x426cf0[_0xebf6('0x4f')]='attachment;\x20filename=\x22'+_0x303997[_0xebf6('0x49')]+'.wav\x22';}_0x549892['set'](_0x426cf0);return _0x549892[_0xebf6('0x50')](new Buffer(_0x303997[_0xebf6('0x4a')]));}})[_0xebf6('0x45')](handleError(_0x549892,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index c0d6583..54625f5 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 _0x6947=['exports','define','voice_voicemail_messages','dir','util','api','moment','bluebird','request-promise','../../config/environment','./voiceMailMessage.attributes'];(function(_0x1790c1,_0x35b48b){var _0x1adb23=function(_0x5df873){while(--_0x5df873){_0x1790c1['push'](_0x1790c1['shift']());}};_0x1adb23(++_0x35b48b);}(_0x6947,0x72));var _0x7694=function(_0x28d2f3,_0x430638){_0x28d2f3=_0x28d2f3-0x0;var _0x15c841=_0x6947[_0x28d2f3];return _0x15c841;};'use strict';var _=require('lodash');var util=require(_0x7694('0x0'));var logger=require('../../config/logger')(_0x7694('0x1'));var moment=require(_0x7694('0x2'));var BPromise=require(_0x7694('0x3'));var rp=require(_0x7694('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7694('0x5'));var attributes=require(_0x7694('0x6'));module[_0x7694('0x7')]=function(_0x5730,_0x36776b){return _0x5730[_0x7694('0x8')]('VoiceMailMessage',attributes,{'tableName':_0x7694('0x9'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x7694('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x6582=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','define','VoiceMailMessage','voice_voicemail_messages','dir'];(function(_0x57fa33,_0x2b8222){var _0x12e724=function(_0x481a33){while(--_0x481a33){_0x57fa33['push'](_0x57fa33['shift']());}};_0x12e724(++_0x2b8222);}(_0x6582,0x108));var _0x2658=function(_0x28ac84,_0x2a75fa){_0x28ac84=_0x28ac84-0x0;var _0x10c42a=_0x6582[_0x28ac84];return _0x10c42a;};'use strict';var _=require(_0x2658('0x0'));var util=require(_0x2658('0x1'));var logger=require(_0x2658('0x2'))(_0x2658('0x3'));var moment=require(_0x2658('0x4'));var BPromise=require('bluebird');var rp=require(_0x2658('0x5'));var fs=require('fs');var path=require(_0x2658('0x6'));var rimraf=require(_0x2658('0x7'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module['exports']=function(_0x2ef520,_0x1702bd){return _0x2ef520[_0x2658('0x8')](_0x2658('0x9'),attributes,{'tableName':_0x2658('0xa'),'paranoid':![],'indexes':[{'name':_0x2658('0xb'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 67e8f9f..936af1f 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x1d3248,_0x4f4a38){var _0xa929ef=function(_0x5dd646){while(--_0x5dd646){_0x1d3248['push'](_0x1d3248['shift']());}};_0xa929ef(++_0x4f4a38);}(_0xdb28,0x106));var _0x8db2=function(_0x320eb5,_0x2f994a){_0x320eb5=_0x320eb5-0x0;var _0x5365eb=_0xdb28[_0x320eb5];return _0x5365eb;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceMailMessage,\x20%s,\x20%s','message','catch','lodash'];(function(_0x28aae5,_0x4ecdb8){var _0x7f9d7a=function(_0x175023){while(--_0x175023){_0x28aae5['push'](_0x28aae5['shift']());}};_0x7f9d7a(++_0x4ecdb8);}(_0x66fa,0x117));var _0xa66f=function(_0x2d7c8e,_0x40de91){_0x2d7c8e=_0x2d7c8e-0x0;var _0x4df2ad=_0x66fa[_0x2d7c8e];return _0x4df2ad;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index fb2eb0a..b4c2934 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 _0x7e18=['multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','get','/:id','/:id/sounds','post','addSound','put','update','destroy','/:id/sounds/:id2','exports'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x7e18,0x64));var _0x87e1=function(_0x3b07e3,_0x1ea03f){_0x3b07e3=_0x3b07e3-0x0;var _0x312c15=_0x7e18[_0x3b07e3];return _0x312c15;};'use strict';var multer=require(_0x87e1('0x0'));var util=require('util');var path=require(_0x87e1('0x1'));var timeout=require(_0x87e1('0x2'));var express=require(_0x87e1('0x3'));var router=express['Router']();var auth=require(_0x87e1('0x4'));var interaction=require(_0x87e1('0x5'));var config=require(_0x87e1('0x6'));var controller=require(_0x87e1('0x7'));router['get']('/',auth[_0x87e1('0x8')](),controller[_0x87e1('0x9')]);router[_0x87e1('0xa')](_0x87e1('0xb'),auth[_0x87e1('0x8')](),controller['show']);router[_0x87e1('0xa')](_0x87e1('0xc'),auth['isAuthenticated'](),controller['getSounds']);router[_0x87e1('0xd')]('/',auth[_0x87e1('0x8')](),controller['create']);router[_0x87e1('0xd')]('/:id/sounds',auth[_0x87e1('0x8')](),controller[_0x87e1('0xe')]);router[_0x87e1('0xf')](_0x87e1('0xb'),auth['isAuthenticated'](),controller[_0x87e1('0x10')]);router['delete'](_0x87e1('0xb'),auth[_0x87e1('0x8')](),controller[_0x87e1('0x11')]);router['delete'](_0x87e1('0x12'),auth[_0x87e1('0x8')](),controller['removeSound']);module[_0x87e1('0x13')]=router; \ No newline at end of file +var _0x7879=['put','/:id','update','destroy','delete','/:id/sounds/:id2','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','getSounds','post','/:id/sounds','addSound'];(function(_0x2891e5,_0x55f263){var _0x527d61=function(_0x4eb96f){while(--_0x4eb96f){_0x2891e5['push'](_0x2891e5['shift']());}};_0x527d61(++_0x55f263);}(_0x7879,0xe3));var _0x9787=function(_0x4b61aa,_0x2808a3){_0x4b61aa=_0x4b61aa-0x0;var _0x4de5ab=_0x7879[_0x4b61aa];return _0x4de5ab;};'use strict';var multer=require(_0x9787('0x0'));var util=require(_0x9787('0x1'));var path=require('path');var timeout=require(_0x9787('0x2'));var express=require('express');var router=express[_0x9787('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x9787('0x4'));var config=require(_0x9787('0x5'));var controller=require('./voiceMusicOnHold.controller');router[_0x9787('0x6')]('/',auth[_0x9787('0x7')](),controller['index']);router[_0x9787('0x6')]('/:id',auth[_0x9787('0x7')](),controller[_0x9787('0x8')]);router[_0x9787('0x6')]('/:id/sounds',auth[_0x9787('0x7')](),controller[_0x9787('0x9')]);router[_0x9787('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9787('0xa')](_0x9787('0xb'),auth['isAuthenticated'](),controller[_0x9787('0xc')]);router[_0x9787('0xd')](_0x9787('0xe'),auth[_0x9787('0x7')](),controller[_0x9787('0xf')]);router['delete'](_0x9787('0xe'),auth[_0x9787('0x7')](),controller[_0x9787('0x10')]);router[_0x9787('0x11')](_0x9787('0x12'),auth[_0x9787('0x7')](),controller['removeSound']);module[_0x9787('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index c136641..45c7fc9 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 _0x19b1=['exports','name','ENUM','files','mp3nb','quietmp3nb','mp3','STRING','alpha','sequelize'];(function(_0x847328,_0x3e2306){var _0x3ebe2d=function(_0x3b9a50){while(--_0x3b9a50){_0x847328['push'](_0x847328['shift']());}};_0x3ebe2d(++_0x3e2306);}(_0x19b1,0x117));var _0x119b=function(_0x3747ae,_0x408e61){_0x3747ae=_0x3747ae-0x0;var _0x339035=_0x19b1[_0x3747ae];return _0x339035;};'use strict';var Sequelize=require(_0x119b('0x0'));module[_0x119b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x119b('0x2')},'mode':{'type':Sequelize[_0x119b('0x3')]('custom',_0x119b('0x4'),_0x119b('0x5'),_0x119b('0x6'),'quietmp3',_0x119b('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x119b('0x8')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x119b('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0x119b('0x8')],'allowNull':!![],'defaultValue':_0x119b('0x9')},'format':{'type':Sequelize[_0x119b('0x8')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xeff9=['quietmp3nb','quietmp3','mp3','STRING','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','name','ENUM','files'];(function(_0x30a8df,_0x4fbb31){var _0xf190a4=function(_0x129df9){while(--_0x129df9){_0x30a8df['push'](_0x30a8df['shift']());}};_0xf190a4(++_0x4fbb31);}(_0xeff9,0xa3));var _0x9eff=function(_0x242020,_0x2e7398){_0x242020=_0x242020-0x0;var _0x355637=_0xeff9[_0x242020];return _0x355637;};'use strict';var Sequelize=require(_0x9eff('0x0'));module[_0x9eff('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9eff('0x2')},'mode':{'type':Sequelize[_0x9eff('0x3')]('custom',_0x9eff('0x4'),'mp3nb',_0x9eff('0x5'),_0x9eff('0x6'),_0x9eff('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x9eff('0x8')],'allowNull':!![]},'application':{'type':Sequelize[_0x9eff('0x8')],'allowNull':!![]},'digit':{'type':Sequelize[_0x9eff('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0x9eff('0x8')],'allowNull':!![],'defaultValue':_0x9eff('0x9')},'format':{'type':Sequelize[_0x9eff('0x8')],'allowNull':!![]},'stamp':{'type':_0x9eff('0xa')},'defaultEntry':{'type':Sequelize[_0x9eff('0xb')],'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 d9611ca..95827e7 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 _0xd8b0=['map','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','VoiceMusicOnHold','count','includeAll','include','findAll','rows','catch','params','keys','find','body','create','transaction','mode','directory','join','root','server/files/moh','files','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','error','sequelize','forEach','unlinkSync','rmdirSync','Sequelize','addSound','Sound','findOne','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','extname','save_name','symlinkSync','ValidationError','removeSound','id2','message','getSounds','options','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','MusicOnHolds','UserProfileResource','destroy','name','send'];(function(_0xbf87ec,_0xd3eb68){var _0x20ec70=function(_0x50ca2e){while(--_0x50ca2e){_0xbf87ec['push'](_0xbf87ec['shift']());}};_0x20ec70(++_0xd3eb68);}(_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'];function respondWithStatusCode(_0x340cc4,_0x92cdd8){_0x92cdd8=_0x92cdd8||0xcc;return function(_0x35a07b){if(_0x35a07b){return _0x340cc4[_0x0d8b('0x16')](_0x92cdd8);}return _0x340cc4[_0x0d8b('0x17')](_0x92cdd8)[_0x0d8b('0x18')]();};}function respondWithResult(_0x1d4bbc,_0x2ce75e){_0x2ce75e=_0x2ce75e||0xc8;return function(_0x5ad086){if(_0x5ad086){return _0x1d4bbc[_0x0d8b('0x17')](_0x2ce75e)[_0x0d8b('0x19')](_0x5ad086);}};}function respondWithFilteredResult(_0x2d4e1c,_0x4f6f21){return function(_0x23eb7b){if(_0x23eb7b){var _0xa86349=_0x23eb7b['count'],_0x17f7df=_0x4f6f21[_0x0d8b('0x1a')],_0xe2e167=_0x4f6f21[_0x0d8b('0x1a')]+_0x4f6f21[_0x0d8b('0x1b')],_0x2cb03c;if(_0xe2e167>=_0xa86349){_0xe2e167=_0xa86349;_0x2cb03c=0xc8;}else{_0x2cb03c=0xce;}_0x2d4e1c[_0x0d8b('0x17')](_0x2cb03c);return _0x2d4e1c[_0x0d8b('0x1c')](_0x0d8b('0x1d'),_0x17f7df+'-'+_0xe2e167+'/'+_0xa86349)[_0x0d8b('0x19')](_0x23eb7b);}return null;};}function patchUpdates(_0xa3612a){return function(_0x4a15bf){try{jsonpatch[_0x0d8b('0x1e')](_0x4a15bf,_0xa3612a,!![]);}catch(_0x23d58f){return BPromise[_0x0d8b('0x1f')](_0x23d58f);}return _0x4a15bf[_0x0d8b('0x20')]();};}function saveUpdates(_0x24e8ed,_0x5b709c){return function(_0x393beb){if(_0x393beb){return _0x393beb[_0x0d8b('0x21')](_0x24e8ed)['then'](function(_0x4f0a1a){return _0x4f0a1a;});}return null;};}function removeEntity(_0x33fb87,_0x54a9a7){return function(_0x56c729){if(_0x56c729){return _0x56c729['destroy']()[_0x0d8b('0x22')](function(){var _0x2b924f=_0x56c729[_0x0d8b('0x23')]({'plain':!![]});var _0x38efc8=_0x0d8b('0x24');return db[_0x0d8b('0x25')][_0x0d8b('0x26')]({'where':{'type':_0x38efc8,'resourceId':_0x2b924f['id']}})[_0x0d8b('0x22')](function(){return _0x56c729;});})[_0x0d8b('0x22')](function(){_0x33fb87['status'](0xcc)[_0x0d8b('0x18')]();});}};}function handleEntityNotFound(_0x4463ee,_0x5363e3){return function(_0xe1ef20){if(!_0xe1ef20){_0x4463ee['sendStatus'](0x194);}return _0xe1ef20;};}function handleError(_0x3dd149,_0x234bdd){_0x234bdd=_0x234bdd||0x1f4;return function(_0xa2af02){logger['error'](_0xa2af02['stack']);if(_0xa2af02[_0x0d8b('0x27')]){delete _0xa2af02[_0x0d8b('0x27')];}_0x3dd149['status'](_0x234bdd)[_0x0d8b('0x28')](_0xa2af02);};}exports['index']=function(_0x1b2b59,_0x4b59e5){var _0x97050a={},_0x48f24f={},_0x2ab00d={'count':0x0,'rows':[]};var _0x546bf6=_[_0x0d8b('0x29')](db['VoiceMusicOnHold'][_0x0d8b('0x2a')],function(_0x106e4c){return{'name':_0x106e4c[_0x0d8b('0x2b')],'type':_0x106e4c['type']['key']};});_0x48f24f['model']=_[_0x0d8b('0x29')](_0x546bf6,'name');_0x48f24f[_0x0d8b('0x2c')]=_['keys'](_0x1b2b59['query']);_0x48f24f[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x48f24f[_0x0d8b('0x2f')],_0x48f24f[_0x0d8b('0x2c')]);_0x97050a[_0x0d8b('0x30')]=_[_0x0d8b('0x2e')](_0x48f24f[_0x0d8b('0x2f')],qs[_0x0d8b('0x31')](_0x1b2b59['query'][_0x0d8b('0x31')]));_0x97050a[_0x0d8b('0x30')]=_0x97050a['attributes'][_0x0d8b('0x32')]?_0x97050a[_0x0d8b('0x30')]:_0x48f24f[_0x0d8b('0x2f')];if(!_0x1b2b59['query'][_0x0d8b('0x33')](_0x0d8b('0x34'))){_0x97050a[_0x0d8b('0x1b')]=qs[_0x0d8b('0x1b')](_0x1b2b59[_0x0d8b('0x2c')]['limit']);_0x97050a[_0x0d8b('0x1a')]=qs[_0x0d8b('0x1a')](_0x1b2b59['query'][_0x0d8b('0x1a')]);}_0x97050a[_0x0d8b('0x35')]=qs[_0x0d8b('0x36')](_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x36')]);_0x97050a['where']=qs['filters'](_[_0x0d8b('0x37')](_0x1b2b59['query'],_0x48f24f['filters']),_0x546bf6);if(_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x97050a[_0x0d8b('0x39')]=_[_0x0d8b('0x3a')](_0x97050a[_0x0d8b('0x39')],{'$or':_[_0x0d8b('0x29')](_0x546bf6,function(_0x579324){if(_0x579324[_0x0d8b('0x3b')]!==_0x0d8b('0x3c')){var _0x28fd82={};_0x28fd82[_0x579324[_0x0d8b('0x27')]]={'$like':'%'+_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x28fd82;}})});}_0x97050a=_[_0x0d8b('0x3a')]({},_0x97050a,_0x1b2b59['options']);var _0x1d06b6={'where':_0x97050a[_0x0d8b('0x39')]};return db[_0x0d8b('0x3d')][_0x0d8b('0x3e')](_0x1d06b6)['then'](function(_0xe0bf42){_0x2ab00d['count']=_0xe0bf42;if(_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x3f')]){_0x97050a[_0x0d8b('0x40')]=[{'all':!![]}];}return db[_0x0d8b('0x3d')][_0x0d8b('0x41')](_0x97050a);})[_0x0d8b('0x22')](function(_0x1ff17d){_0x2ab00d[_0x0d8b('0x42')]=_0x1ff17d;return _0x2ab00d;})[_0x0d8b('0x22')](respondWithFilteredResult(_0x4b59e5,_0x97050a))[_0x0d8b('0x43')](handleError(_0x4b59e5,null));};exports['show']=function(_0x571acf,_0x576050){var _0x4d0811={'raw':![],'where':{'id':_0x571acf[_0x0d8b('0x44')]['id']}},_0x524d79={};_0x524d79[_0x0d8b('0x2f')]=_[_0x0d8b('0x45')](db['VoiceMusicOnHold']['rawAttributes']);_0x524d79[_0x0d8b('0x2c')]=_[_0x0d8b('0x45')](_0x571acf[_0x0d8b('0x2c')]);_0x524d79['filters']=_[_0x0d8b('0x2e')](_0x524d79[_0x0d8b('0x2f')],_0x524d79['query']);_0x4d0811['attributes']=_[_0x0d8b('0x2e')](_0x524d79['model'],qs[_0x0d8b('0x31')](_0x571acf['query']['fields']));_0x4d0811[_0x0d8b('0x30')]=_0x4d0811[_0x0d8b('0x30')]['length']?_0x4d0811['attributes']:_0x524d79['model'];if(_0x571acf['query'][_0x0d8b('0x3f')]){_0x4d0811[_0x0d8b('0x40')]=[{'all':!![]}];}_0x4d0811=_[_0x0d8b('0x3a')]({},_0x4d0811,_0x571acf['options']);return db[_0x0d8b('0x3d')][_0x0d8b('0x46')](_0x4d0811)[_0x0d8b('0x22')](handleEntityNotFound(_0x576050,null))[_0x0d8b('0x22')](respondWithResult(_0x576050,null))[_0x0d8b('0x43')](handleError(_0x576050,null));};exports[_0x0d8b('0x21')]=function(_0x11d22b,_0x1d5067){if(_0x11d22b[_0x0d8b('0x47')]['id']){delete _0x11d22b[_0x0d8b('0x47')]['id'];}return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0x11d22b[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x1d5067,null))[_0x0d8b('0x22')](saveUpdates(_0x11d22b[_0x0d8b('0x47')],null))[_0x0d8b('0x22')](respondWithResult(_0x1d5067,null))[_0x0d8b('0x43')](handleError(_0x1d5067,null));};exports[_0x0d8b('0x48')]=function(_0x574b90,_0x371fa0,_0x4d8850){return db['sequelize'][_0x0d8b('0x49')](function(_0x113fb7){if(_0x574b90[_0x0d8b('0x47')][_0x0d8b('0x4a')]==='files'){_0x574b90[_0x0d8b('0x47')][_0x0d8b('0x4b')]=path[_0x0d8b('0x4c')](config[_0x0d8b('0x4d')],_0x0d8b('0x4e'),_0x574b90['body']['name']);}return db['VoiceMusicOnHold']['create'](_0x574b90[_0x0d8b('0x47')],{'transaction':_0x113fb7})[_0x0d8b('0x22')](function(_0x5e3bb4){if(_0x574b90['body'][_0x0d8b('0x4a')]===_0x0d8b('0x4f')){fs['mkdirSync'](_0x5e3bb4['directory'],parseInt(_0x0d8b('0x50'),0x8));}var _0xeeefd4=_0x574b90[_0x0d8b('0x51')][_0x0d8b('0x23')]({'plain':!![]});if(!_0xeeefd4)throw new Error(_0x0d8b('0x52'));if(_0xeeefd4['role']===_0x0d8b('0x51')){var _0x2afe34=_0x5e3bb4['get']({'plain':!![]});return db['UserProfileSection'][_0x0d8b('0x46')]({'where':{'name':_0x0d8b('0x24'),'userProfileId':_0xeeefd4['userProfileId']},'raw':!![]})['then'](function(_0xb8be3b){if(_0xb8be3b&&_0xb8be3b[_0x0d8b('0x53')]===0x0){return db[_0x0d8b('0x25')][_0x0d8b('0x48')]({'name':_0x2afe34['name'],'resourceId':_0x2afe34['id'],'type':_0xb8be3b[_0x0d8b('0x27')],'sectionId':_0xb8be3b['id']},{})['then'](function(){return _0x5e3bb4;});}else{return _0x5e3bb4;}})['catch'](function(_0x38c24e){logger[_0x0d8b('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38c24e);});}return _0x5e3bb4;});})['then'](respondWithResult(_0x371fa0,0xc9))[_0x0d8b('0x43')](handleError(_0x371fa0,null));};exports[_0x0d8b('0x26')]=function(_0xccc2a9,_0x2c1eb0,_0x3afc3a){var _0xb66e76;return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0xccc2a9['params']['id']}})[_0x0d8b('0x22')](function(_0x37dc9f){if(_0x37dc9f){return db[_0x0d8b('0x55')][_0x0d8b('0x49')](function(_0x3fb9ea){return _0x37dc9f[_0x0d8b('0x26')]({'transaction':_0x3fb9ea,'raw':!![]})[_0x0d8b('0x22')](function(_0x1c78b6){if(_0x1c78b6[_0x0d8b('0x4b')]){fs['readdirSync'](_0x1c78b6[_0x0d8b('0x4b')])[_0x0d8b('0x56')](function(_0x180b7b){fs[_0x0d8b('0x57')](path[_0x0d8b('0x4c')](_0x1c78b6['directory'],_0x180b7b));});fs[_0x0d8b('0x58')](_0x1c78b6[_0x0d8b('0x4b')]);}return _0x1c78b6;});})[_0x0d8b('0x43')](function(_0x17a87f){throw new db[(_0x0d8b('0x59'))]['ValidationError'](_0x17a87f['message']);});}})[_0x0d8b('0x22')](handleEntityNotFound(_0x2c1eb0,null))[_0x0d8b('0x22')](removeEntity(_0x2c1eb0,null))[_0x0d8b('0x43')](handleError(_0x2c1eb0,null));};exports[_0x0d8b('0x5a')]=function(_0x5a70bd,_0x199122,_0x12aef7){return db[_0x0d8b('0x55')]['transaction'](function(_0x2f19f4){var _0x532a85;return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0x5a70bd[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](function(_0x2b6eb6){if(_0x2b6eb6){_0x532a85=_0x2b6eb6;return _0x2b6eb6[_0x0d8b('0x5a')](_0x5a70bd['body']['id'],{'transaction':_0x2f19f4});}})[_0x0d8b('0x22')](function(_0x4c074d){if(_0x4c074d){return db[_0x0d8b('0x5b')][_0x0d8b('0x5c')]({'where':{'id':_0x5a70bd[_0x0d8b('0x47')]['id']},'attributes':['id',_0x0d8b('0x27'),'save_name',_0x0d8b('0x5d'),_0x0d8b('0x5e')],'raw':!![]});}})[_0x0d8b('0x22')](function(_0x2332fc){if(_0x2332fc){var _0x2ccdae=path[_0x0d8b('0x4c')](config[_0x0d8b('0x4d')],_0x0d8b('0x5f'),util[_0x0d8b('0x60')](_0x0d8b('0x61'),path['basename'](_0x2332fc['save_name'],path[_0x0d8b('0x62')](_0x2332fc[_0x0d8b('0x63')])),_0x2332fc['converted_format']));var _0xb1aa96=path['join'](config['root'],_0x0d8b('0x4e'),_0x532a85[_0x0d8b('0x27')],util['format']('%s.%s',_0x2332fc[_0x0d8b('0x27')],_0x2332fc[_0x0d8b('0x5d')]));fs[_0x0d8b('0x64')](_0x2ccdae,_0xb1aa96);return _0x2332fc;}})[_0x0d8b('0x43')](function(_0x2ab72b){throw new db[(_0x0d8b('0x59'))][(_0x0d8b('0x65'))](_0x2ab72b['message']);});})[_0x0d8b('0x22')](handleEntityNotFound(_0x199122,null))['then'](respondWithResult(_0x199122,0xc9))[_0x0d8b('0x43')](handleError(_0x199122,null));};exports[_0x0d8b('0x66')]=function(_0x2bb690,_0x14a34b,_0x49f610){return db[_0x0d8b('0x55')]['transaction'](function(_0x3a356b){var _0x2c6c5f;return db[_0x0d8b('0x3d')][_0x0d8b('0x5c')]({'where':{'id':_0x2bb690[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x14a34b,null))[_0x0d8b('0x22')](function(_0x91aa89){if(_0x91aa89){_0x2c6c5f=_0x91aa89;return _0x91aa89[_0x0d8b('0x66')](_0x2bb690[_0x0d8b('0x44')]['id2']);}})[_0x0d8b('0x22')](function(_0x54c28b){if(_0x54c28b){return db[_0x0d8b('0x5b')][_0x0d8b('0x5c')]({'where':{'id':_0x2bb690['params'][_0x0d8b('0x67')]},'attributes':['id','name',_0x0d8b('0x63'),_0x0d8b('0x5d'),_0x0d8b('0x5e')],'raw':!![]});}})[_0x0d8b('0x22')](function(_0x2242cd){if(_0x2242cd){fs[_0x0d8b('0x57')](path[_0x0d8b('0x4c')](_0x2c6c5f[_0x0d8b('0x4b')],util['format'](_0x0d8b('0x61'),_0x2242cd[_0x0d8b('0x27')],_0x2242cd['converted_format'])));return _0x2242cd;}})[_0x0d8b('0x43')](function(_0x105df9){throw new db[(_0x0d8b('0x59'))][(_0x0d8b('0x65'))](_0x105df9[_0x0d8b('0x68')]);});})[_0x0d8b('0x22')](handleEntityNotFound(_0x14a34b,null))[_0x0d8b('0x22')](respondWithStatusCode(_0x14a34b,0xcc))[_0x0d8b('0x43')](handleError(_0x14a34b,null));};exports[_0x0d8b('0x69')]=function(_0x5007c0,_0xe35028,_0x16df83){var _0x50c0ff={};var _0x1ece98={};var _0x93fc55;var _0x3acffa;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x5007c0[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0xe35028,null))[_0x0d8b('0x22')](function(_0x5b76af){if(_0x5b76af){_0x93fc55=_0x5b76af;_0x1ece98['model']=_[_0x0d8b('0x45')](db[_0x0d8b('0x5b')][_0x0d8b('0x2a')]);_0x1ece98[_0x0d8b('0x2c')]=_[_0x0d8b('0x45')](_0x5007c0[_0x0d8b('0x2c')]);_0x1ece98[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x1ece98[_0x0d8b('0x2f')],_0x1ece98[_0x0d8b('0x2c')]);_0x50c0ff[_0x0d8b('0x30')]=_[_0x0d8b('0x2e')](_0x1ece98[_0x0d8b('0x2f')],qs['fields'](_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x31')]));_0x50c0ff['attributes']=_0x50c0ff['attributes'][_0x0d8b('0x32')]?_0x50c0ff[_0x0d8b('0x30')]:_0x1ece98[_0x0d8b('0x2f')];_0x50c0ff[_0x0d8b('0x35')]=qs[_0x0d8b('0x36')](_0x5007c0[_0x0d8b('0x2c')]['sort']);_0x50c0ff['where']=qs['filters'](_[_0x0d8b('0x37')](_0x5007c0[_0x0d8b('0x2c')],_0x1ece98[_0x0d8b('0x2d')]));if(_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x50c0ff[_0x0d8b('0x39')]=_['merge'](_0x50c0ff[_0x0d8b('0x39')],{'$or':_[_0x0d8b('0x29')](_0x50c0ff['attributes'],function(_0x30a69d){var _0x57e3c2={};_0x57e3c2[_0x30a69d]={'$like':'%'+_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x57e3c2;})});}_0x50c0ff=_[_0x0d8b('0x3a')]({},_0x50c0ff,_0x5007c0[_0x0d8b('0x6a')]);return _0x93fc55[_0x0d8b('0x69')](_0x50c0ff);}})[_0x0d8b('0x22')](function(_0x424f9d){if(_0x424f9d){_0x3acffa=_0x424f9d[_0x0d8b('0x32')];if(!_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x33')](_0x0d8b('0x34'))){_0x50c0ff[_0x0d8b('0x1b')]=qs['limit'](_0x5007c0['query'][_0x0d8b('0x1b')]);_0x50c0ff[_0x0d8b('0x1a')]=qs[_0x0d8b('0x1a')](_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x1a')]);}return _0x93fc55[_0x0d8b('0x69')](_0x50c0ff);}})[_0x0d8b('0x22')](function(_0x54674f){if(_0x54674f){return _0x54674f?{'count':_0x3acffa,'rows':_0x54674f}:null;}})[_0x0d8b('0x22')](respondWithResult(_0xe35028,null))['catch'](handleError(_0xe35028,null));}; \ No newline at end of file +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(_0x152bbc,_0x3816c2){var _0xe0ea3e=function(_0x346c4e){while(--_0x346c4e){_0x152bbc['push'](_0x152bbc['shift']());}};_0xe0ea3e(++_0x3816c2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2067e3,_0x19bcb2){_0x2067e3=_0x2067e3-0x0;var _0x180c44=_0x5f2f[_0x2067e3];return _0x180c44;};'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 diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 59bae51..f254887 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 _0xc8a6=['bluebird','request-promise','path','../../config/environment','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','lodash','util','../../config/logger','api','moment'];(function(_0x5f3365,_0x438954){var _0x3280d8=function(_0xccfcde){while(--_0xccfcde){_0x5f3365['push'](_0x5f3365['shift']());}};_0x3280d8(++_0x438954);}(_0xc8a6,0x181));var _0x6c8a=function(_0x37eda3,_0x51a6d3){_0x37eda3=_0x37eda3-0x0;var _0x358d48=_0xc8a6[_0x37eda3];return _0x358d48;};'use strict';var _=require(_0x6c8a('0x0'));var util=require(_0x6c8a('0x1'));var logger=require(_0x6c8a('0x2'))(_0x6c8a('0x3'));var moment=require(_0x6c8a('0x4'));var BPromise=require(_0x6c8a('0x5'));var rp=require(_0x6c8a('0x6'));var fs=require('fs');var path=require(_0x6c8a('0x7'));var rimraf=require('rimraf');var config=require(_0x6c8a('0x8'));var attributes=require(_0x6c8a('0x9'));module[_0x6c8a('0xa')]=function(_0x1e159e,_0x380728){return _0x1e159e[_0x6c8a('0xb')]('VoiceMusicOnHold',attributes,{'tableName':_0x6c8a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae7b=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0xae7b,0x75));var _0xbae7=function(_0x3997be,_0x3e8a1d){_0x3997be=_0x3997be-0x0;var _0x1c4093=_0xae7b[_0x3997be];return _0x1c4093;};'use strict';var _=require(_0xbae7('0x0'));var util=require('util');var logger=require(_0xbae7('0x1'))(_0xbae7('0x2'));var moment=require(_0xbae7('0x3'));var BPromise=require(_0xbae7('0x4'));var rp=require(_0xbae7('0x5'));var fs=require('fs');var path=require(_0xbae7('0x6'));var rimraf=require('rimraf');var config=require(_0xbae7('0x7'));var attributes=require(_0xbae7('0x8'));module[_0xbae7('0x9')]=function(_0x1b2d8a,_0x30252f){return _0x1b2d8a[_0xbae7('0xa')](_0xbae7('0xb'),attributes,{'tableName':_0xbae7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 1900ce6..e1f0856 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 _0x0dd3=['client','http','request','VoiceMusicOnHold,\x20%s,\x20%s','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x26c919,_0x344ee0){var _0x5d90f3=function(_0x18157a){while(--_0x18157a){_0x26c919['push'](_0x26c919['shift']());}};_0x5d90f3(++_0x344ee0);}(_0x0dd3,0x15e));var _0x30dd=function(_0x5d03c0,_0x28fe68){_0x5d03c0=_0x5d03c0-0x0;var _0x40d8d6=_0x0dd3[_0x5d03c0];return _0x40d8d6;};'use strict';var _=require(_0x30dd('0x0'));var util=require(_0x30dd('0x1'));var moment=require(_0x30dd('0x2'));var BPromise=require(_0x30dd('0x3'));var rs=require(_0x30dd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x30dd('0x5'))['db'];var utils=require(_0x30dd('0x6'));var logger=require(_0x30dd('0x7'))('rpc');var config=require(_0x30dd('0x8'));var jayson=require(_0x30dd('0x9'));var client=jayson[_0x30dd('0xa')][_0x30dd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5937fd,_0x251b16,_0x51c0ae){return new BPromise(function(_0x287bd3,_0x291aa8){return client[_0x30dd('0xc')](_0x5937fd,_0x51c0ae)['then'](function(_0x5ec6ed){logger['info'](_0x30dd('0xd'),_0x251b16,'request\x20sent');logger[_0x30dd('0xe')](_0x30dd('0xf'),_0x251b16,_0x30dd('0x10'),JSON[_0x30dd('0x11')](_0x5ec6ed));if(_0x5ec6ed[_0x30dd('0x12')]){if(_0x5ec6ed[_0x30dd('0x12')][_0x30dd('0x13')]===0x1f4){logger[_0x30dd('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x251b16,_0x5ec6ed['error'][_0x30dd('0x14')]);return _0x291aa8(_0x5ec6ed[_0x30dd('0x12')][_0x30dd('0x14')]);}logger['error'](_0x30dd('0xd'),_0x251b16,_0x5ec6ed[_0x30dd('0x12')][_0x30dd('0x14')]);return _0x287bd3(_0x5ec6ed[_0x30dd('0x12')]['message']);}else{logger[_0x30dd('0x15')](_0x30dd('0xd'),_0x251b16,_0x30dd('0x10'));_0x287bd3(_0x5ec6ed[_0x30dd('0x16')][_0x30dd('0x14')]);}})[_0x30dd('0x17')](function(_0x2a6726){logger[_0x30dd('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x251b16,_0x2a6726);_0x291aa8(_0x2a6726);});});} \ No newline at end of file +var _0x2a34=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','VoiceMusicOnHold,\x20%s,\x20%s','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x255305,_0x25941c){var _0x37fe8a=function(_0x20574a){while(--_0x20574a){_0x255305['push'](_0x255305['shift']());}};_0x37fe8a(++_0x25941c);}(_0x2a34,0x182));var _0x42a3=function(_0x1838e1,_0x791615){_0x1838e1=_0x1838e1-0x0;var _0x49a5bb=_0x2a34[_0x1838e1];return _0x49a5bb;};'use strict';var _=require(_0x42a3('0x0'));var util=require(_0x42a3('0x1'));var moment=require('moment');var BPromise=require(_0x42a3('0x2'));var rs=require(_0x42a3('0x3'));var fs=require('fs');var Redis=require(_0x42a3('0x4'));var db=require(_0x42a3('0x5'))['db'];var utils=require(_0x42a3('0x6'));var logger=require(_0x42a3('0x7'))(_0x42a3('0x8'));var config=require(_0x42a3('0x9'));var jayson=require(_0x42a3('0xa'));var client=jayson[_0x42a3('0xb')][_0x42a3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x214793,_0x20f0e3,_0x237eee){return new BPromise(function(_0x54e45c,_0x5e9e08){return client['request'](_0x214793,_0x237eee)['then'](function(_0x246ae0){logger['info'](_0x42a3('0xd'),_0x20f0e3,'request\x20sent');logger[_0x42a3('0xe')](_0x42a3('0xf'),_0x20f0e3,_0x42a3('0x10'),JSON[_0x42a3('0x11')](_0x246ae0));if(_0x246ae0[_0x42a3('0x12')]){if(_0x246ae0[_0x42a3('0x12')][_0x42a3('0x13')]===0x1f4){logger[_0x42a3('0x12')](_0x42a3('0xd'),_0x20f0e3,_0x246ae0[_0x42a3('0x12')][_0x42a3('0x14')]);return _0x5e9e08(_0x246ae0[_0x42a3('0x12')]['message']);}logger[_0x42a3('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x20f0e3,_0x246ae0[_0x42a3('0x12')]['message']);return _0x54e45c(_0x246ae0[_0x42a3('0x12')]['message']);}else{logger[_0x42a3('0x15')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x20f0e3,_0x42a3('0x10'));_0x54e45c(_0x246ae0['result'][_0x42a3('0x14')]);}})[_0x42a3('0x16')](function(_0x2dc002){logger[_0x42a3('0x12')](_0x42a3('0xd'),_0x20f0e3,_0x2dc002);_0x5e9e08(_0x2dc002);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 2829440..f547b0f 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 _0xe8d1=['isAuthenticated','index','describe','/:id','getAgents','post','/:id/users','put','update','delete','removeAgents','exports','multer','util','connect-timeout','Router','../../config/environment','get'];(function(_0x4c0dd,_0x72eeba){var _0x1134a9=function(_0x5ed1ef){while(--_0x5ed1ef){_0x4c0dd['push'](_0x4c0dd['shift']());}};_0x1134a9(++_0x72eeba);}(_0xe8d1,0x66));var _0x1e8d=function(_0x1e9604,_0x5de613){_0x1e9604=_0x1e9604-0x0;var _0x522053=_0xe8d1[_0x1e9604];return _0x522053;};'use strict';var multer=require(_0x1e8d('0x0'));var util=require(_0x1e8d('0x1'));var path=require('path');var timeout=require(_0x1e8d('0x2'));var express=require('express');var router=express[_0x1e8d('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1e8d('0x4'));var controller=require('./voicePrefix.controller');router[_0x1e8d('0x5')]('/',auth[_0x1e8d('0x6')](),controller[_0x1e8d('0x7')]);router[_0x1e8d('0x5')]('/describe',auth[_0x1e8d('0x6')](),controller[_0x1e8d('0x8')]);router['get'](_0x1e8d('0x9'),auth[_0x1e8d('0x6')](),controller['show']);router[_0x1e8d('0x5')]('/:id/users',auth[_0x1e8d('0x6')](),controller[_0x1e8d('0xa')]);router['post']('/',auth[_0x1e8d('0x6')](),controller['create']);router[_0x1e8d('0xb')](_0x1e8d('0xc'),auth[_0x1e8d('0x6')](),controller['addAgents']);router[_0x1e8d('0xd')](_0x1e8d('0x9'),auth[_0x1e8d('0x6')](),controller[_0x1e8d('0xe')]);router[_0x1e8d('0xf')]('/:id',auth[_0x1e8d('0x6')](),controller['destroy']);router[_0x1e8d('0xf')]('/:id/users',auth[_0x1e8d('0x6')](),controller[_0x1e8d('0x10')]);module[_0x1e8d('0x11')]=router; \ No newline at end of file +var _0x568d=['removeAgents','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/users','getAgents','post','update','destroy','delete'];(function(_0x59cd82,_0x74f860){var _0x438a07=function(_0x463e6c){while(--_0x463e6c){_0x59cd82['push'](_0x59cd82['shift']());}};_0x438a07(++_0x74f860);}(_0x568d,0x191));var _0xd568=function(_0x41273e,_0x1a8d3f){_0x41273e=_0x41273e-0x0;var _0x340241=_0x568d[_0x41273e];return _0x340241;};'use strict';var multer=require(_0xd568('0x0'));var util=require(_0xd568('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd568('0x2')]();var auth=require(_0xd568('0x3'));var interaction=require(_0xd568('0x4'));var config=require(_0xd568('0x5'));var controller=require(_0xd568('0x6'));router['get']('/',auth[_0xd568('0x7')](),controller[_0xd568('0x8')]);router[_0xd568('0x9')](_0xd568('0xa'),auth['isAuthenticated'](),controller[_0xd568('0xb')]);router['get'](_0xd568('0xc'),auth[_0xd568('0x7')](),controller['show']);router[_0xd568('0x9')](_0xd568('0xd'),auth[_0xd568('0x7')](),controller[_0xd568('0xe')]);router[_0xd568('0xf')]('/',auth[_0xd568('0x7')](),controller['create']);router[_0xd568('0xf')](_0xd568('0xd'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xd568('0xc'),auth[_0xd568('0x7')](),controller[_0xd568('0x10')]);router['delete']('/:id',auth[_0xd568('0x7')](),controller[_0xd568('0x11')]);router[_0xd568('0x12')](_0xd568('0xd'),auth[_0xd568('0x7')](),controller[_0xd568('0x13')]);module[_0xd568('0x14')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index b7a6e7c..558c9d9 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 _0x49d1=['VIRTUAL','system-','INTEGER','exports','STRING','name'];(function(_0x2b3bfc,_0x5186fa){var _0xa80f46=function(_0xcc1f86){while(--_0xcc1f86){_0x2b3bfc['push'](_0x2b3bfc['shift']());}};_0xa80f46(++_0x5186fa);}(_0x49d1,0xb7));var _0x149d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x49d1[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module[_0x149d('0x0')]={'name':{'type':Sequelize[_0x149d('0x1')],'allowNull':![],'unique':_0x149d('0x2')},'prefix':{'type':Sequelize[_0x149d('0x3')],'get':function(_0x4a7d48){return _0x149d('0x4')+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0x149d('0x1')]},'callerIdAll':{'type':Sequelize[_0x149d('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x149d('0x5')]}}; \ No newline at end of file +var _0xc149=['name','VIRTUAL','system-','getDataValue','INTEGER','sequelize','exports','STRING'];(function(_0x1378fc,_0x23dec0){var _0x57edaf=function(_0x230439){while(--_0x230439){_0x1378fc['push'](_0x1378fc['shift']());}};_0x57edaf(++_0x23dec0);}(_0xc149,0xa5));var _0x9c14=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xc149[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x9c14('0x0'));module[_0x9c14('0x1')]={'name':{'type':Sequelize[_0x9c14('0x2')],'allowNull':![],'unique':_0x9c14('0x3')},'prefix':{'type':Sequelize[_0x9c14('0x4')],'get':function(_0x47890d){return _0x9c14('0x5')+this[_0x9c14('0x6')](_0x9c14('0x3'))+'-';}},'description':{'type':Sequelize[_0x9c14('0x2')]},'callerIdAll':{'type':Sequelize[_0x9c14('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x9c14('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 7b0cdaa..7af4d0a 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 _0x369d=['lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','VoicePrefixes','UserProfileResource','error','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','VoicePrefix','length','find','catch','describe','create','transaction','body','get','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','userProfileId','autoAssociation','exten','app','description','appdata','prefix','VoicePrefixId','bulkCreate','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','NoOp','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','sequelize','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','getAgents','findOne','User','rawAttributes','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x2623b2,_0x3a74f9){var _0x556fb0=function(_0x2beb2d){while(--_0x2beb2d){_0x2623b2['push'](_0x2623b2['shift']());}};_0x556fb0(++_0x3a74f9);}(_0x369d,0x1d1));var _0xd369=function(_0x10ed05,_0x422d32){_0x10ed05=_0x10ed05-0x0;var _0x23c7b8=_0x369d[_0x10ed05];return _0x23c7b8;};'use strict';var pdf=require(_0xd369('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd369('0x1'));var zipdir=require(_0xd369('0x2'));var jsonpatch=require(_0xd369('0x3'));var rp=require(_0xd369('0x4'));var moment=require(_0xd369('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd369('0x6'));var util=require(_0xd369('0x7'));var path=require(_0xd369('0x8'));var sox=require(_0xd369('0x9'));var csv=require(_0xd369('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd369('0xb'));var squel=require(_0xd369('0xc'));var crypto=require(_0xd369('0xd'));var jsforce=require(_0xd369('0xe'));var deskjs=require(_0xd369('0xf'));var toCsv=require(_0xd369('0xa'));var querystring=require('querystring');var Papa=require(_0xd369('0x10'));var Redis=require('ioredis');var authService=require(_0xd369('0x11'));var qs=require(_0xd369('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd369('0x13'))(_0xd369('0x14'));var utils=require(_0xd369('0x15'));var config=require('../../config/environment');var db=require(_0xd369('0x16'))['db'];config[_0xd369('0x17')]=_[_0xd369('0x18')](config[_0xd369('0x17')],{'host':_0xd369('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0x4f6afd,_0x2b712){_0x2b712=_0x2b712||0xcc;return function(_0xc85839){if(_0xc85839){return _0x4f6afd[_0xd369('0x1a')](_0x2b712);}return _0x4f6afd[_0xd369('0x1b')](_0x2b712)[_0xd369('0x1c')]();};}function respondWithResult(_0x4cb063,_0x4acf75){_0x4acf75=_0x4acf75||0xc8;return function(_0x2e01dd){if(_0x2e01dd){return _0x4cb063[_0xd369('0x1b')](_0x4acf75)[_0xd369('0x1d')](_0x2e01dd);}};}function respondWithFilteredResult(_0x11b13f,_0x3536e4){return function(_0x2fe8c8){if(_0x2fe8c8){var _0x151ba4=_0x2fe8c8[_0xd369('0x1e')],_0x2b9af5=_0x3536e4[_0xd369('0x1f')],_0x1f9cb3=_0x3536e4[_0xd369('0x1f')]+_0x3536e4[_0xd369('0x20')],_0xbbfa03;if(_0x1f9cb3>=_0x151ba4){_0x1f9cb3=_0x151ba4;_0xbbfa03=0xc8;}else{_0xbbfa03=0xce;}_0x11b13f[_0xd369('0x1b')](_0xbbfa03);return _0x11b13f['set'](_0xd369('0x21'),_0x2b9af5+'-'+_0x1f9cb3+'/'+_0x151ba4)[_0xd369('0x1d')](_0x2fe8c8);}return null;};}function patchUpdates(_0x934d9b){return function(_0x5821b8){try{jsonpatch['apply'](_0x5821b8,_0x934d9b,!![]);}catch(_0x46ea74){return BPromise[_0xd369('0x22')](_0x46ea74);}return _0x5821b8[_0xd369('0x23')]();};}function saveUpdates(_0x503820,_0x5ab6c7){return function(_0x37d966){if(_0x37d966){return _0x37d966[_0xd369('0x24')](_0x503820)[_0xd369('0x25')](function(_0x30a936){return _0x30a936;});}return null;};}function removeEntity(_0x15f582,_0x39d85d){return function(_0x3438eb){if(_0x3438eb){return _0x3438eb[_0xd369('0x26')]()[_0xd369('0x25')](function(){var _0x185afe=_0x3438eb['get']({'plain':!![]});var _0x4864e5=_0xd369('0x27');return db[_0xd369('0x28')]['destroy']({'where':{'type':_0x4864e5,'resourceId':_0x185afe['id']}})[_0xd369('0x25')](function(){return _0x3438eb;});})['then'](function(){_0x15f582[_0xd369('0x1b')](0xcc)[_0xd369('0x1c')]();});}};}function handleEntityNotFound(_0x268702,_0x21d72b){return function(_0x16a337){if(!_0x16a337){_0x268702['sendStatus'](0x194);}return _0x16a337;};}function handleError(_0x39e024,_0x154fbf){_0x154fbf=_0x154fbf||0x1f4;return function(_0x19ac8f){logger[_0xd369('0x29')](_0x19ac8f['stack']);if(_0x19ac8f[_0xd369('0x2a')]){delete _0x19ac8f['name'];}_0x39e024['status'](_0x154fbf)[_0xd369('0x2b')](_0x19ac8f);};}exports[_0xd369('0x2c')]=function(_0x4cccc9,_0x24a69e){var _0x52314c={},_0x200b0d={},_0x53ac1c={'count':0x0,'rows':[]};var _0x1052f6=_[_0xd369('0x2d')](db['VoicePrefix']['rawAttributes'],function(_0x340bb7){return{'name':_0x340bb7[_0xd369('0x2e')],'type':_0x340bb7[_0xd369('0x2f')][_0xd369('0x30')]};});_0x200b0d[_0xd369('0x31')]=_[_0xd369('0x2d')](_0x1052f6,'name');_0x200b0d['query']=_[_0xd369('0x32')](_0x4cccc9[_0xd369('0x33')]);_0x200b0d[_0xd369('0x34')]=_[_0xd369('0x35')](_0x200b0d[_0xd369('0x31')],_0x200b0d['query']);_0x52314c[_0xd369('0x36')]=_[_0xd369('0x35')](_0x200b0d['model'],qs[_0xd369('0x37')](_0x4cccc9[_0xd369('0x33')][_0xd369('0x37')]));_0x52314c[_0xd369('0x36')]=_0x52314c[_0xd369('0x36')]['length']?_0x52314c['attributes']:_0x200b0d[_0xd369('0x31')];if(!_0x4cccc9[_0xd369('0x33')][_0xd369('0x38')](_0xd369('0x39'))){_0x52314c[_0xd369('0x20')]=qs[_0xd369('0x20')](_0x4cccc9[_0xd369('0x33')][_0xd369('0x20')]);_0x52314c['offset']=qs[_0xd369('0x1f')](_0x4cccc9[_0xd369('0x33')][_0xd369('0x1f')]);}_0x52314c['order']=qs[_0xd369('0x3a')](_0x4cccc9['query'][_0xd369('0x3a')]);_0x52314c[_0xd369('0x3b')]=qs['filters'](_[_0xd369('0x3c')](_0x4cccc9[_0xd369('0x33')],_0x200b0d[_0xd369('0x34')]),_0x1052f6);if(_0x4cccc9['query'][_0xd369('0x3d')]){_0x52314c['where']=_[_0xd369('0x3e')](_0x52314c[_0xd369('0x3b')],{'$or':_[_0xd369('0x2d')](_0x1052f6,function(_0x1472cf){if(_0x1472cf['type']!==_0xd369('0x3f')){var _0x6a39fb={};_0x6a39fb[_0x1472cf[_0xd369('0x2a')]]={'$like':'%'+_0x4cccc9[_0xd369('0x33')][_0xd369('0x3d')]+'%'};return _0x6a39fb;}})});}_0x52314c=_[_0xd369('0x3e')]({},_0x52314c,_0x4cccc9[_0xd369('0x40')]);var _0xc5e426={'where':_0x52314c[_0xd369('0x3b')]};return db['VoicePrefix'][_0xd369('0x1e')](_0xc5e426)[_0xd369('0x25')](function(_0xf1cbc4){_0x53ac1c[_0xd369('0x1e')]=_0xf1cbc4;if(_0x4cccc9[_0xd369('0x33')][_0xd369('0x41')]){_0x52314c[_0xd369('0x42')]=[{'all':!![]}];}return db['VoicePrefix'][_0xd369('0x43')](_0x52314c);})['then'](function(_0x5aff8a){_0x53ac1c[_0xd369('0x44')]=_0x5aff8a;return _0x53ac1c;})['then'](respondWithFilteredResult(_0x24a69e,_0x52314c))['catch'](handleError(_0x24a69e,null));};exports[_0xd369('0x45')]=function(_0x3acb47,_0x27cd3f){var _0x24a532={'raw':![],'where':{'id':_0x3acb47[_0xd369('0x46')]['id']}},_0x18c631={};_0x18c631[_0xd369('0x31')]=_[_0xd369('0x32')](db[_0xd369('0x47')]['rawAttributes']);_0x18c631['query']=_[_0xd369('0x32')](_0x3acb47[_0xd369('0x33')]);_0x18c631['filters']=_['intersection'](_0x18c631[_0xd369('0x31')],_0x18c631[_0xd369('0x33')]);_0x24a532[_0xd369('0x36')]=_[_0xd369('0x35')](_0x18c631[_0xd369('0x31')],qs['fields'](_0x3acb47[_0xd369('0x33')][_0xd369('0x37')]));_0x24a532['attributes']=_0x24a532['attributes'][_0xd369('0x48')]?_0x24a532[_0xd369('0x36')]:_0x18c631['model'];if(_0x3acb47[_0xd369('0x33')][_0xd369('0x41')]){_0x24a532[_0xd369('0x42')]=[{'all':!![]}];}_0x24a532=_[_0xd369('0x3e')]({},_0x24a532,_0x3acb47['options']);return db[_0xd369('0x47')][_0xd369('0x49')](_0x24a532)[_0xd369('0x25')](handleEntityNotFound(_0x27cd3f,null))[_0xd369('0x25')](respondWithResult(_0x27cd3f,null))[_0xd369('0x4a')](handleError(_0x27cd3f,null));};exports[_0xd369('0x26')]=function(_0x30fa9f,_0x17628d){return db['VoicePrefix'][_0xd369('0x49')]({'where':{'id':_0x30fa9f[_0xd369('0x46')]['id']}})['then'](handleEntityNotFound(_0x17628d,null))[_0xd369('0x25')](removeEntity(_0x17628d,null))[_0xd369('0x4a')](handleError(_0x17628d,null));};exports[_0xd369('0x4b')]=function(_0x4c8bae,_0x4978d5){return db[_0xd369('0x47')][_0xd369('0x4b')]()[_0xd369('0x25')](respondWithResult(_0x4978d5,null))['catch'](handleError(_0x4978d5,null));};exports[_0xd369('0x4c')]=function(_0x43785b,_0x385d28){var _0x208adb;return db['sequelize'][_0xd369('0x4d')](function(_0x21c228){return db[_0xd369('0x47')][_0xd369('0x4c')](_0x43785b[_0xd369('0x4e')],{'transaction':_0x21c228})[_0xd369('0x25')](function(_0x32b55e){_0x208adb=_0x32b55e[_0xd369('0x4f')]({'plain':!![]});return db[_0xd369('0x50')][_0xd369('0x49')]({'where':{'id':_0x208adb[_0xd369('0x51')]},'raw':!![]})[_0xd369('0x25')](function(_0x336880){return createVoicePrefixExtensions(_0x208adb,_0x336880,_0x21c228);});});})[_0xd369('0x25')](function(){var _0xf61c1b=_0x43785b[_0xd369('0x52')][_0xd369('0x4f')]({'plain':!![]});if(!_0xf61c1b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf61c1b[_0xd369('0x53')]===_0xd369('0x52')){var _0x3e9fb1=_0x208adb;return db[_0xd369('0x54')][_0xd369('0x49')]({'where':{'name':_0xd369('0x27'),'userProfileId':_0xf61c1b[_0xd369('0x55')]},'raw':!![]})[_0xd369('0x25')](function(_0x16d8ac){if(_0x16d8ac&&_0x16d8ac[_0xd369('0x56')]===0x0){return db['UserProfileResource'][_0xd369('0x4c')]({'name':_0x3e9fb1[_0xd369('0x2a')],'resourceId':_0x3e9fb1['id'],'type':_0x16d8ac[_0xd369('0x2a')],'sectionId':_0x16d8ac['id']},{})[_0xd369('0x25')](function(){return _0x208adb;});}else{return _0x208adb;}})[_0xd369('0x4a')](function(_0x37e428){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37e428);throw _0x37e428;});}return _0x208adb;})['then'](respondWithResult(_0x385d28,null))[_0xd369('0x4a')](handleError(_0x385d28,null));};function Extension(_0x37d8fd,_0x18b326,_0x3c9795,_0x208fee){this['context']='from-sip';this[_0xd369('0x57')]=_0x37d8fd;this[_0xd369('0x58')]=_0x3c9795;this[_0xd369('0x2f')]='system';this[_0xd369('0x59')]='Voice\x20Prefix\x20Extension';this['priority']=_0x18b326;this[_0xd369('0x5a')]=_0x208fee;}function createVoicePrefixExtensions(_0x3a84fe,_0x54bae0,_0x28fabd){return new BPromise(function(_0x5b07cd,_0x2f92b4){var _0xde0b54=new Extension(formatPrefixName(_0x3a84fe[_0xd369('0x5b')]),0x1,'NoOp','Voice\x20Prefix');_0xde0b54[_0xd369('0x5c')]=_0x3a84fe['id'];return db[_0xd369('0x50')][_0xd369('0x4c')](_0xde0b54,{'transaction':_0x28fabd})[_0xd369('0x25')](function(_0x192fa6){var _0x2f383b=_0x192fa6['get']({'plain':!![]});var _0x5327c1=_[_0xd369('0x2d')](addVoicePrefixExtensions(_0x3a84fe,_0x54bae0),function(_0x17e7d9){_0x17e7d9['VoiceExtensionId']=_0x2f383b['id'];_0x17e7d9[_0xd369('0x5c')]=_0x3a84fe['id'];return _0x17e7d9;});return db[_0xd369('0x50')][_0xd369('0x5d')](_0x5327c1,{'transaction':_0x28fabd})['then'](function(_0x14a730){if(!_0x14a730){return _0x2f92b4('Extensions\x20creation\x20failed');}else{return _0x5b07cd(_0x14a730);}})[_0xd369('0x4a')](function(_0x44b18d){return _0x2f92b4(_0x44b18d);});});;});};function addVoicePrefixExtensions(_0xbcecd6,_0x5cb4c2){var _0x14c44f=[];var _0x17819e=formatPrefixName(_0xbcecd6[_0xd369('0x5b')]);_0x14c44f['push'](new Extension(_0x17819e,0x2,_0xd369('0x5e'),_0xd369('0x5f')+_0xbcecd6[_0xd369('0x2a')]));if(_0xbcecd6[_0xd369('0x60')]){_0x14c44f[_0xd369('0x61')](new Extension(_0x17819e,0x3,_0xd369('0x5e'),_0xd369('0x62')+_0xbcecd6[_0xd369('0x60')]));}else{_0x14c44f[_0xd369('0x61')](new Extension(_0x17819e,0x3,_0xd369('0x63'),_0xd369('0x64')));}_0x14c44f[_0xd369('0x61')](new Extension(_0x17819e,0x4,_0xd369('0x65'),_0x5cb4c2['context']+','+_0xd369('0x66')+(0x8+_0xbcecd6[_0xd369('0x2a')][_0xd369('0x48')])+'}'+','+0x1));return _0x14c44f;}function formatPrefixName(_0x51889b){var _0x55d0f1='_';for(var _0x222336=0x0;_0x222336<_0x51889b['length'];_0x222336++){if(_0x51889b['charAt'](_0x222336)=='-'){_0x55d0f1+=_0x51889b[_0xd369('0x67')](_0x222336);}else{_0x55d0f1+='['+_0x51889b[_0xd369('0x67')](_0x222336)+']';}}_0x55d0f1+='.';return _0x55d0f1;}exports['update']=function(_0x2e18db,_0x3b60b1,_0x1b2ac6){var _0x138f8f=_0x2e18db[_0xd369('0x4e')];_0x138f8f[_0xd369('0x5b')]=_0xd369('0x68')+_0x138f8f['name']+'-';return db[_0xd369('0x69')][_0xd369('0x4d')](function(_0x5ce775){return db['VoicePrefix'][_0xd369('0x24')](_0x138f8f,{'where':{'id':_0x138f8f['id']},'transaction':_0x5ce775})['then'](function(){return db[_0xd369('0x50')][_0xd369('0x26')]({'where':{'VoicePrefixId':_0x138f8f['id']},'transaction':_0x5ce775})[_0xd369('0x25')](function(){return db[_0xd369('0x50')][_0xd369('0x49')]({'where':{'id':_0x138f8f[_0xd369('0x51')]},'raw':!![]})['then'](function(_0x383625){return createVoicePrefixExtensions(_0x138f8f,_0x383625,_0x5ce775);});});});})[_0xd369('0x25')](function(){return db['VoicePrefix'][_0xd369('0x6a')](_0x138f8f['id']);})[_0xd369('0x25')](respondWithResult(_0x3b60b1,null))[_0xd369('0x4a')](handleError(_0x3b60b1,null));};exports[_0xd369('0x6b')]=function(_0xa5690d,_0x573a0f,_0x392e46){return db['VoicePrefix']['find']({'where':{'id':_0xa5690d[_0xd369('0x46')]['id']}})[_0xd369('0x25')](handleEntityNotFound(_0x573a0f,null))[_0xd369('0x25')](function(_0x3666fb){if(_0x3666fb){return _0x3666fb[_0xd369('0x6b')](_0xa5690d['body'][_0xd369('0x6c')],_[_0xd369('0x6d')](_0xa5690d[_0xd369('0x4e')],['ids','id'])||{})[_0xd369('0x6e')](function(_0x1d0ae8){for(var _0x276d6a=0x0;_0x276d6a<_0xa5690d[_0xd369('0x4e')][_0xd369('0x6c')][_0xd369('0x48')];_0x276d6a+=0x1){socket[_0xd369('0x6f')](_0xd369('0x70'),{'UserId':_0xa5690d['body'][_0xd369('0x6c')][_0x276d6a],'VoicePrefixId':_0xa5690d[_0xd369('0x46')]['id']});}return _0x1d0ae8;});}})['then'](respondWithResult(_0x573a0f,null))[_0xd369('0x4a')](handleError(_0x573a0f,null));};exports[_0xd369('0x71')]=function(_0x28a700,_0x45f2a7,_0x2a14e2){return db['VoicePrefix']['find']({'where':{'id':_0x28a700[_0xd369('0x46')]['id']}})[_0xd369('0x25')](handleEntityNotFound(_0x45f2a7,null))[_0xd369('0x25')](function(_0x1eee0d){if(_0x1eee0d){return _0x1eee0d['removeAgents'](_0x28a700[_0xd369('0x33')]['ids'])['then'](function(){if(_[_0xd369('0x72')](_0x28a700[_0xd369('0x33')][_0xd369('0x6c')])){for(var _0x487a88=0x0;_0x487a88<_0x28a700[_0xd369('0x33')][_0xd369('0x6c')][_0xd369('0x48')];_0x487a88+=0x1){socket[_0xd369('0x6f')]('userVoicePrefix:remove',{'UserId':Number(_0x28a700['query'][_0xd369('0x6c')][_0x487a88]),'VoicePrefixId':Number(_0x28a700[_0xd369('0x46')]['id'])});}}else{socket[_0xd369('0x6f')]('userVoicePrefix:remove',{'UserId':Number(_0x28a700['query']['ids']),'VoicePrefixId':Number(_0x28a700[_0xd369('0x46')]['id'])});}});}})[_0xd369('0x25')](respondWithStatusCode(_0x45f2a7,null))[_0xd369('0x4a')](handleError(_0x45f2a7,null));};exports[_0xd369('0x73')]=function(_0xd1a501,_0x17b23e,_0x548012){var _0x228043={};var _0x1defee={};var _0x116bd6;var _0x2a516b;return db[_0xd369('0x47')][_0xd369('0x74')]({'where':{'id':_0xd1a501[_0xd369('0x46')]['id']}})[_0xd369('0x25')](handleEntityNotFound(_0x17b23e,null))[_0xd369('0x25')](function(_0x1f67ae){if(_0x1f67ae){_0x116bd6=_0x1f67ae;_0x1defee['model']=_['keys'](db[_0xd369('0x75')][_0xd369('0x76')]);_0x1defee[_0xd369('0x33')]=_[_0xd369('0x32')](_0xd1a501['query']);_0x1defee[_0xd369('0x34')]=_[_0xd369('0x35')](_0x1defee['model'],_0x1defee['query']);_0x228043[_0xd369('0x36')]=_[_0xd369('0x35')](_0x1defee[_0xd369('0x31')],qs[_0xd369('0x37')](_0xd1a501[_0xd369('0x33')][_0xd369('0x37')]));_0x228043[_0xd369('0x36')]=_0x228043[_0xd369('0x36')][_0xd369('0x48')]?_0x228043[_0xd369('0x36')]:_0x1defee[_0xd369('0x31')];_0x228043['order']=qs[_0xd369('0x3a')](_0xd1a501['query'][_0xd369('0x3a')]);_0x228043[_0xd369('0x3b')]=qs[_0xd369('0x34')](_['pick'](_0xd1a501['query'],_0x1defee[_0xd369('0x34')]));if(_0xd1a501[_0xd369('0x33')]['filter']){_0x228043[_0xd369('0x3b')]=_[_0xd369('0x3e')](_0x228043[_0xd369('0x3b')],{'$or':_['map'](_0x228043[_0xd369('0x36')],function(_0x607d76){var _0x6c25f5={};_0x6c25f5[_0x607d76]={'$like':'%'+_0xd1a501[_0xd369('0x33')][_0xd369('0x3d')]+'%'};return _0x6c25f5;})});}_0x228043=_[_0xd369('0x3e')]({},_0x228043,_0xd1a501[_0xd369('0x40')]);return _0x116bd6[_0xd369('0x73')](_0x228043);}})[_0xd369('0x25')](function(_0x384beb){if(_0x384beb){_0x2a516b=_0x384beb['length'];if(!_0xd1a501[_0xd369('0x33')][_0xd369('0x38')]('nolimit')){_0x228043['limit']=qs[_0xd369('0x20')](_0xd1a501[_0xd369('0x33')][_0xd369('0x20')]);_0x228043[_0xd369('0x1f')]=qs[_0xd369('0x1f')](_0xd1a501['query'][_0xd369('0x1f')]);}return _0x116bd6[_0xd369('0x73')](_0x228043);}})['then'](function(_0x1bc4ab){if(_0x1bc4ab){return _0x1bc4ab?{'count':_0x2a516b,'rows':_0x1bc4ab}:null;}})[_0xd369('0x25')](respondWithResult(_0x17b23e,null))[_0xd369('0x4a')](handleError(_0x17b23e,null));}; \ No newline at end of file +var _0x2029=['includeAll','include','findAll','catch','show','params','find','describe','sequelize','create','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','No\x20callerid\x20available','context','${EXTEN:','charAt','body','transaction','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','status','end','json','limit','apply','reject','update','then','destroy','get','VoicePrefixes','sendStatus','error','stack','name','index','VoicePrefix','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','sort','where','filter','merge','VIRTUAL','options','count'];(function(_0x4733d3,_0x454290){var _0x1b9a44=function(_0x1a93bb){while(--_0x1a93bb){_0x4733d3['push'](_0x4733d3['shift']());}};_0x1b9a44(++_0x454290);}(_0x2029,0x1a0));var _0x9202=function(_0x3e25ee,_0x1acbe7){_0x3e25ee=_0x3e25ee-0x0;var _0x49f8ec=_0x2029[_0x3e25ee];return _0x49f8ec;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9202('0x0'));var rimraf=require(_0x9202('0x1'));var zipdir=require(_0x9202('0x2'));var jsonpatch=require(_0x9202('0x3'));var rp=require(_0x9202('0x4'));var moment=require('moment');var BPromise=require(_0x9202('0x5'));var Mustache=require(_0x9202('0x6'));var util=require(_0x9202('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x9202('0x8'));var ejs=require(_0x9202('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9202('0xa'));var deskjs=require(_0x9202('0xb'));var toCsv=require(_0x9202('0x8'));var querystring=require(_0x9202('0xc'));var Papa=require(_0x9202('0xd'));var Redis=require(_0x9202('0xe'));var authService=require(_0x9202('0xf'));var qs=require(_0x9202('0x10'));var as=require(_0x9202('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9202('0x12'))(_0x9202('0x13'));var utils=require(_0x9202('0x14'));var config=require(_0x9202('0x15'));var db=require(_0x9202('0x16'))['db'];config[_0x9202('0x17')]=_[_0x9202('0x18')](config['redis'],{'host':_0x9202('0x19'),'port':0x18eb});var socket=require(_0x9202('0x1a'))(new Redis(config[_0x9202('0x17')]));require(_0x9202('0x1b'))[_0x9202('0x1c')](socket);function respondWithStatusCode(_0x122fcd,_0x2e6597){_0x2e6597=_0x2e6597||0xcc;return function(_0x6f93b){if(_0x6f93b){return _0x122fcd['sendStatus'](_0x2e6597);}return _0x122fcd[_0x9202('0x1d')](_0x2e6597)[_0x9202('0x1e')]();};}function respondWithResult(_0x59fb6b,_0x57268e){_0x57268e=_0x57268e||0xc8;return function(_0x2338a7){if(_0x2338a7){return _0x59fb6b[_0x9202('0x1d')](_0x57268e)[_0x9202('0x1f')](_0x2338a7);}};}function respondWithFilteredResult(_0x1c55de,_0x45dc53){return function(_0x2e0c02){if(_0x2e0c02){var _0x1b2f44=_0x2e0c02['count'],_0x24946c=_0x45dc53['offset'],_0x34288f=_0x45dc53['offset']+_0x45dc53[_0x9202('0x20')],_0x64b5d4;if(_0x34288f>=_0x1b2f44){_0x34288f=_0x1b2f44;_0x64b5d4=0xc8;}else{_0x64b5d4=0xce;}_0x1c55de['status'](_0x64b5d4);return _0x1c55de['set']('Content-Range',_0x24946c+'-'+_0x34288f+'/'+_0x1b2f44)[_0x9202('0x1f')](_0x2e0c02);}return null;};}function patchUpdates(_0x51f89a){return function(_0x4d575e){try{jsonpatch[_0x9202('0x21')](_0x4d575e,_0x51f89a,!![]);}catch(_0xd0226c){return BPromise[_0x9202('0x22')](_0xd0226c);}return _0x4d575e['save']();};}function saveUpdates(_0x514e86,_0xe20143){return function(_0x1217d2){if(_0x1217d2){return _0x1217d2[_0x9202('0x23')](_0x514e86)[_0x9202('0x24')](function(_0x17ae46){return _0x17ae46;});}return null;};}function removeEntity(_0x954ea0,_0x22f10c){return function(_0x3ae361){if(_0x3ae361){return _0x3ae361[_0x9202('0x25')]()[_0x9202('0x24')](function(){var _0x420313=_0x3ae361[_0x9202('0x26')]({'plain':!![]});var _0x3d2cc7=_0x9202('0x27');return db['UserProfileResource'][_0x9202('0x25')]({'where':{'type':_0x3d2cc7,'resourceId':_0x420313['id']}})[_0x9202('0x24')](function(){return _0x3ae361;});})['then'](function(){_0x954ea0['status'](0xcc)[_0x9202('0x1e')]();});}};}function handleEntityNotFound(_0x3ad5d6,_0x27f54e){return function(_0x322e66){if(!_0x322e66){_0x3ad5d6[_0x9202('0x28')](0x194);}return _0x322e66;};}function handleError(_0x551d24,_0x3169ae){_0x3169ae=_0x3169ae||0x1f4;return function(_0x3f24eb){logger[_0x9202('0x29')](_0x3f24eb[_0x9202('0x2a')]);if(_0x3f24eb[_0x9202('0x2b')]){delete _0x3f24eb[_0x9202('0x2b')];}_0x551d24['status'](_0x3169ae)['send'](_0x3f24eb);};}exports[_0x9202('0x2c')]=function(_0x1bfa84,_0x5c293c){var _0x5cebeb={},_0x2e093e={},_0x54fbc7={'count':0x0,'rows':[]};var _0xeba106=_['map'](db[_0x9202('0x2d')][_0x9202('0x2e')],function(_0x3d0ccd){return{'name':_0x3d0ccd[_0x9202('0x2f')],'type':_0x3d0ccd[_0x9202('0x30')][_0x9202('0x31')]};});_0x2e093e[_0x9202('0x32')]=_[_0x9202('0x33')](_0xeba106,'name');_0x2e093e[_0x9202('0x34')]=_[_0x9202('0x35')](_0x1bfa84['query']);_0x2e093e[_0x9202('0x36')]=_[_0x9202('0x37')](_0x2e093e[_0x9202('0x32')],_0x2e093e[_0x9202('0x34')]);_0x5cebeb[_0x9202('0x38')]=_[_0x9202('0x37')](_0x2e093e[_0x9202('0x32')],qs[_0x9202('0x39')](_0x1bfa84['query']['fields']));_0x5cebeb[_0x9202('0x38')]=_0x5cebeb[_0x9202('0x38')][_0x9202('0x3a')]?_0x5cebeb[_0x9202('0x38')]:_0x2e093e[_0x9202('0x32')];if(!_0x1bfa84[_0x9202('0x34')][_0x9202('0x3b')]('nolimit')){_0x5cebeb[_0x9202('0x20')]=qs[_0x9202('0x20')](_0x1bfa84[_0x9202('0x34')][_0x9202('0x20')]);_0x5cebeb[_0x9202('0x3c')]=qs[_0x9202('0x3c')](_0x1bfa84[_0x9202('0x34')][_0x9202('0x3c')]);}_0x5cebeb['order']=qs[_0x9202('0x3d')](_0x1bfa84[_0x9202('0x34')][_0x9202('0x3d')]);_0x5cebeb[_0x9202('0x3e')]=qs[_0x9202('0x36')](_['pick'](_0x1bfa84[_0x9202('0x34')],_0x2e093e[_0x9202('0x36')]),_0xeba106);if(_0x1bfa84['query'][_0x9202('0x3f')]){_0x5cebeb[_0x9202('0x3e')]=_[_0x9202('0x40')](_0x5cebeb[_0x9202('0x3e')],{'$or':_['map'](_0xeba106,function(_0x329b69){if(_0x329b69[_0x9202('0x30')]!==_0x9202('0x41')){var _0x5701a9={};_0x5701a9[_0x329b69['name']]={'$like':'%'+_0x1bfa84[_0x9202('0x34')][_0x9202('0x3f')]+'%'};return _0x5701a9;}})});}_0x5cebeb=_[_0x9202('0x40')]({},_0x5cebeb,_0x1bfa84[_0x9202('0x42')]);var _0x2ea6c8={'where':_0x5cebeb[_0x9202('0x3e')]};return db[_0x9202('0x2d')][_0x9202('0x43')](_0x2ea6c8)[_0x9202('0x24')](function(_0x4de00a){_0x54fbc7[_0x9202('0x43')]=_0x4de00a;if(_0x1bfa84[_0x9202('0x34')][_0x9202('0x44')]){_0x5cebeb[_0x9202('0x45')]=[{'all':!![]}];}return db[_0x9202('0x2d')][_0x9202('0x46')](_0x5cebeb);})[_0x9202('0x24')](function(_0x4214d5){_0x54fbc7['rows']=_0x4214d5;return _0x54fbc7;})['then'](respondWithFilteredResult(_0x5c293c,_0x5cebeb))[_0x9202('0x47')](handleError(_0x5c293c,null));};exports[_0x9202('0x48')]=function(_0x4becae,_0x505c1c){var _0x14d731={'raw':![],'where':{'id':_0x4becae[_0x9202('0x49')]['id']}},_0x57d7ed={};_0x57d7ed[_0x9202('0x32')]=_[_0x9202('0x35')](db[_0x9202('0x2d')][_0x9202('0x2e')]);_0x57d7ed[_0x9202('0x34')]=_[_0x9202('0x35')](_0x4becae[_0x9202('0x34')]);_0x57d7ed[_0x9202('0x36')]=_[_0x9202('0x37')](_0x57d7ed[_0x9202('0x32')],_0x57d7ed[_0x9202('0x34')]);_0x14d731[_0x9202('0x38')]=_[_0x9202('0x37')](_0x57d7ed[_0x9202('0x32')],qs[_0x9202('0x39')](_0x4becae[_0x9202('0x34')]['fields']));_0x14d731[_0x9202('0x38')]=_0x14d731[_0x9202('0x38')][_0x9202('0x3a')]?_0x14d731[_0x9202('0x38')]:_0x57d7ed[_0x9202('0x32')];if(_0x4becae[_0x9202('0x34')][_0x9202('0x44')]){_0x14d731[_0x9202('0x45')]=[{'all':!![]}];}_0x14d731=_['merge']({},_0x14d731,_0x4becae[_0x9202('0x42')]);return db[_0x9202('0x2d')][_0x9202('0x4a')](_0x14d731)[_0x9202('0x24')](handleEntityNotFound(_0x505c1c,null))['then'](respondWithResult(_0x505c1c,null))['catch'](handleError(_0x505c1c,null));};exports[_0x9202('0x25')]=function(_0x57d413,_0x506715){return db['VoicePrefix'][_0x9202('0x4a')]({'where':{'id':_0x57d413[_0x9202('0x49')]['id']}})[_0x9202('0x24')](handleEntityNotFound(_0x506715,null))[_0x9202('0x24')](removeEntity(_0x506715,null))[_0x9202('0x47')](handleError(_0x506715,null));};exports[_0x9202('0x4b')]=function(_0x24ca0e,_0x26facd){return db['VoicePrefix'][_0x9202('0x4b')]()[_0x9202('0x24')](respondWithResult(_0x26facd,null))['catch'](handleError(_0x26facd,null));};exports['create']=function(_0x19a377,_0x486a68){var _0xe3001f;return db[_0x9202('0x4c')]['transaction'](function(_0x2ae657){return db[_0x9202('0x2d')][_0x9202('0x4d')](_0x19a377['body'],{'transaction':_0x2ae657})[_0x9202('0x24')](function(_0x1682f3){_0xe3001f=_0x1682f3['get']({'plain':!![]});return db['VoiceExtension'][_0x9202('0x4a')]({'where':{'id':_0xe3001f[_0x9202('0x4e')]},'raw':!![]})[_0x9202('0x24')](function(_0x4cade8){return createVoicePrefixExtensions(_0xe3001f,_0x4cade8,_0x2ae657);});});})[_0x9202('0x24')](function(){var _0x18517c=_0x19a377[_0x9202('0x4f')][_0x9202('0x26')]({'plain':!![]});if(!_0x18517c)throw new Error(_0x9202('0x50'));if(_0x18517c[_0x9202('0x51')]===_0x9202('0x4f')){var _0x3dafe5=_0xe3001f;return db[_0x9202('0x52')][_0x9202('0x4a')]({'where':{'name':_0x9202('0x27'),'userProfileId':_0x18517c['userProfileId']},'raw':!![]})[_0x9202('0x24')](function(_0x5011a7){if(_0x5011a7&&_0x5011a7[_0x9202('0x53')]===0x0){return db[_0x9202('0x54')]['create']({'name':_0x3dafe5[_0x9202('0x2b')],'resourceId':_0x3dafe5['id'],'type':_0x5011a7[_0x9202('0x2b')],'sectionId':_0x5011a7['id']},{})[_0x9202('0x24')](function(){return _0xe3001f;});}else{return _0xe3001f;}})[_0x9202('0x47')](function(_0x52d854){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52d854);throw _0x52d854;});}return _0xe3001f;})[_0x9202('0x24')](respondWithResult(_0x486a68,null))[_0x9202('0x47')](handleError(_0x486a68,null));};function Extension(_0x57e3c3,_0x1f1794,_0x61e2a7,_0x2395f3){this['context']=_0x9202('0x55');this[_0x9202('0x56')]=_0x57e3c3;this[_0x9202('0x57')]=_0x61e2a7;this[_0x9202('0x30')]='system';this[_0x9202('0x58')]=_0x9202('0x59');this[_0x9202('0x5a')]=_0x1f1794;this['appdata']=_0x2395f3;}function createVoicePrefixExtensions(_0x347039,_0x539c87,_0x142e94){return new BPromise(function(_0x19c630,_0x1950f3){var _0x577876=new Extension(formatPrefixName(_0x347039[_0x9202('0x5b')]),0x1,_0x9202('0x5c'),_0x9202('0x5d'));_0x577876[_0x9202('0x5e')]=_0x347039['id'];return db[_0x9202('0x5f')][_0x9202('0x4d')](_0x577876,{'transaction':_0x142e94})[_0x9202('0x24')](function(_0x52c3f9){var _0x589e3c=_0x52c3f9[_0x9202('0x26')]({'plain':!![]});var _0x145719=_[_0x9202('0x33')](addVoicePrefixExtensions(_0x347039,_0x539c87),function(_0x21cc13){_0x21cc13['VoiceExtensionId']=_0x589e3c['id'];_0x21cc13[_0x9202('0x5e')]=_0x347039['id'];return _0x21cc13;});return db[_0x9202('0x5f')][_0x9202('0x60')](_0x145719,{'transaction':_0x142e94})['then'](function(_0x5c60f0){if(!_0x5c60f0){return _0x1950f3('Extensions\x20creation\x20failed');}else{return _0x19c630(_0x5c60f0);}})[_0x9202('0x47')](function(_0x430fcd){return _0x1950f3(_0x430fcd);});});;});};function addVoicePrefixExtensions(_0x177659,_0x9b1d2){var _0x114f1e=[];var _0x22c206=formatPrefixName(_0x177659['prefix']);_0x114f1e['push'](new Extension(_0x22c206,0x2,_0x9202('0x61'),_0x9202('0x62')+_0x177659[_0x9202('0x2b')]));if(_0x177659[_0x9202('0x63')]){_0x114f1e[_0x9202('0x64')](new Extension(_0x22c206,0x3,'Set',_0x9202('0x65')+_0x177659[_0x9202('0x63')]));}else{_0x114f1e['push'](new Extension(_0x22c206,0x3,_0x9202('0x5c'),_0x9202('0x66')));}_0x114f1e[_0x9202('0x64')](new Extension(_0x22c206,0x4,'goto',_0x9b1d2[_0x9202('0x67')]+','+_0x9202('0x68')+(0x8+_0x177659[_0x9202('0x2b')][_0x9202('0x3a')])+'}'+','+0x1));return _0x114f1e;}function formatPrefixName(_0x33da2c){var _0xee0f3a='_';for(var _0x1b5a95=0x0;_0x1b5a95<_0x33da2c['length'];_0x1b5a95++){if(_0x33da2c['charAt'](_0x1b5a95)=='-'){_0xee0f3a+=_0x33da2c[_0x9202('0x69')](_0x1b5a95);}else{_0xee0f3a+='['+_0x33da2c[_0x9202('0x69')](_0x1b5a95)+']';}}_0xee0f3a+='.';return _0xee0f3a;}exports[_0x9202('0x23')]=function(_0x33c6b0,_0x11b630,_0x5809d5){var _0xe617f4=_0x33c6b0[_0x9202('0x6a')];_0xe617f4['prefix']='system-'+_0xe617f4[_0x9202('0x2b')]+'-';return db[_0x9202('0x4c')][_0x9202('0x6b')](function(_0x584f11){return db[_0x9202('0x2d')]['update'](_0xe617f4,{'where':{'id':_0xe617f4['id']},'transaction':_0x584f11})[_0x9202('0x24')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0xe617f4['id']},'transaction':_0x584f11})['then'](function(){return db['VoiceExtension']['find']({'where':{'id':_0xe617f4[_0x9202('0x4e')]},'raw':!![]})[_0x9202('0x24')](function(_0x48e5f8){return createVoicePrefixExtensions(_0xe617f4,_0x48e5f8,_0x584f11);});});});})['then'](function(){return db['VoicePrefix'][_0x9202('0x6c')](_0xe617f4['id']);})[_0x9202('0x24')](respondWithResult(_0x11b630,null))[_0x9202('0x47')](handleError(_0x11b630,null));};exports[_0x9202('0x6d')]=function(_0x53923f,_0x4fc401,_0x517a6f){return db[_0x9202('0x2d')]['find']({'where':{'id':_0x53923f[_0x9202('0x49')]['id']}})[_0x9202('0x24')](handleEntityNotFound(_0x4fc401,null))['then'](function(_0xce9f51){if(_0xce9f51){return _0xce9f51[_0x9202('0x6d')](_0x53923f[_0x9202('0x6a')][_0x9202('0x6e')],_['omit'](_0x53923f['body'],[_0x9202('0x6e'),'id'])||{})[_0x9202('0x6f')](function(_0x59af3e){for(var _0x4fcc94=0x0;_0x4fcc94<_0x53923f['body'][_0x9202('0x6e')]['length'];_0x4fcc94+=0x1){socket[_0x9202('0x70')](_0x9202('0x71'),{'UserId':_0x53923f[_0x9202('0x6a')][_0x9202('0x6e')][_0x4fcc94],'VoicePrefixId':_0x53923f['params']['id']});}return _0x59af3e;});}})[_0x9202('0x24')](respondWithResult(_0x4fc401,null))[_0x9202('0x47')](handleError(_0x4fc401,null));};exports[_0x9202('0x72')]=function(_0xc48a52,_0x329c43,_0x21e44a){return db[_0x9202('0x2d')][_0x9202('0x4a')]({'where':{'id':_0xc48a52[_0x9202('0x49')]['id']}})['then'](handleEntityNotFound(_0x329c43,null))[_0x9202('0x24')](function(_0x1a189b){if(_0x1a189b){return _0x1a189b['removeAgents'](_0xc48a52[_0x9202('0x34')][_0x9202('0x6e')])[_0x9202('0x24')](function(){if(_[_0x9202('0x73')](_0xc48a52[_0x9202('0x34')]['ids'])){for(var _0x23cd80=0x0;_0x23cd80<_0xc48a52[_0x9202('0x34')][_0x9202('0x6e')]['length'];_0x23cd80+=0x1){socket[_0x9202('0x70')]('userVoicePrefix:remove',{'UserId':Number(_0xc48a52[_0x9202('0x34')]['ids'][_0x23cd80]),'VoicePrefixId':Number(_0xc48a52[_0x9202('0x49')]['id'])});}}else{socket['emit'](_0x9202('0x74'),{'UserId':Number(_0xc48a52['query'][_0x9202('0x6e')]),'VoicePrefixId':Number(_0xc48a52['params']['id'])});}});}})[_0x9202('0x24')](respondWithStatusCode(_0x329c43,null))[_0x9202('0x47')](handleError(_0x329c43,null));};exports[_0x9202('0x75')]=function(_0x41fbd7,_0x4a0db8,_0x503770){var _0x440fb3={};var _0x1f69a0={};var _0x512ddb;var _0x29a8c7;return db['VoicePrefix'][_0x9202('0x76')]({'where':{'id':_0x41fbd7[_0x9202('0x49')]['id']}})[_0x9202('0x24')](handleEntityNotFound(_0x4a0db8,null))[_0x9202('0x24')](function(_0x3c0f96){if(_0x3c0f96){_0x512ddb=_0x3c0f96;_0x1f69a0[_0x9202('0x32')]=_[_0x9202('0x35')](db[_0x9202('0x77')][_0x9202('0x2e')]);_0x1f69a0[_0x9202('0x34')]=_['keys'](_0x41fbd7[_0x9202('0x34')]);_0x1f69a0[_0x9202('0x36')]=_[_0x9202('0x37')](_0x1f69a0['model'],_0x1f69a0[_0x9202('0x34')]);_0x440fb3[_0x9202('0x38')]=_[_0x9202('0x37')](_0x1f69a0[_0x9202('0x32')],qs[_0x9202('0x39')](_0x41fbd7['query'][_0x9202('0x39')]));_0x440fb3[_0x9202('0x38')]=_0x440fb3[_0x9202('0x38')][_0x9202('0x3a')]?_0x440fb3['attributes']:_0x1f69a0['model'];_0x440fb3['order']=qs['sort'](_0x41fbd7[_0x9202('0x34')][_0x9202('0x3d')]);_0x440fb3['where']=qs[_0x9202('0x36')](_[_0x9202('0x78')](_0x41fbd7[_0x9202('0x34')],_0x1f69a0[_0x9202('0x36')]));if(_0x41fbd7[_0x9202('0x34')][_0x9202('0x3f')]){_0x440fb3[_0x9202('0x3e')]=_[_0x9202('0x40')](_0x440fb3[_0x9202('0x3e')],{'$or':_[_0x9202('0x33')](_0x440fb3[_0x9202('0x38')],function(_0x24a461){var _0xd8486={};_0xd8486[_0x24a461]={'$like':'%'+_0x41fbd7[_0x9202('0x34')][_0x9202('0x3f')]+'%'};return _0xd8486;})});}_0x440fb3=_[_0x9202('0x40')]({},_0x440fb3,_0x41fbd7[_0x9202('0x42')]);return _0x512ddb[_0x9202('0x75')](_0x440fb3);}})[_0x9202('0x24')](function(_0x5eb941){if(_0x5eb941){_0x29a8c7=_0x5eb941['length'];if(!_0x41fbd7[_0x9202('0x34')]['hasOwnProperty']('nolimit')){_0x440fb3[_0x9202('0x20')]=qs[_0x9202('0x20')](_0x41fbd7[_0x9202('0x34')][_0x9202('0x20')]);_0x440fb3['offset']=qs[_0x9202('0x3c')](_0x41fbd7[_0x9202('0x34')][_0x9202('0x3c')]);}return _0x512ddb['getAgents'](_0x440fb3);}})[_0x9202('0x24')](function(_0x6c7110){if(_0x6c7110){return _0x6c7110?{'count':_0x29a8c7,'rows':_0x6c7110}:null;}})[_0x9202('0x24')](respondWithResult(_0x4a0db8,null))['catch'](handleError(_0x4a0db8,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 5feb696..5f026dc 100644 --- a/server/api/voicePrefix/voicePrefix.events.js +++ b/server/api/voicePrefix/voicePrefix.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['emit','events','../../mysqldb','VoicePrefix','update','remove'];(function(_0x3acc9c,_0x5697a4){var _0x11df29=function(_0x42b0a6){while(--_0x42b0a6){_0x3acc9c['push'](_0x3acc9c['shift']());}};_0x11df29(++_0x5697a4);}(_0x70e0,0x17b));var _0x070e=function(_0x3bd4bc,_0x1f7767){_0x3bd4bc=_0x3bd4bc-0x0;var _0x52ec25=_0x70e0[_0x3bd4bc];return _0x52ec25;};'use strict';var EventEmitter=require(_0x070e('0x0'));var VoicePrefix=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){VoicePrefixEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);VoicePrefixEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x41c846,_0x560b84){var _0x3eba85=function(_0x1d2f7c){while(--_0x1d2f7c){_0x41c846['push'](_0x41c846['shift']());}};_0x3eba85(++_0x560b84);}(_0x008c,0x188));var _0xc008=function(_0x373059,_0x17b09c){_0x373059=_0x373059-0x0;var _0x368f67=_0x008c[_0x373059];return _0x368f67;};'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 bb5744b..2c2b018 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 _0x9a7e=['exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x20ee9b,_0x1e40a7){var _0x4b9e3b=function(_0x1d8c60){while(--_0x1d8c60){_0x20ee9b['push'](_0x20ee9b['shift']());}};_0x4b9e3b(++_0x1e40a7);}(_0x9a7e,0x12f));var _0xe9a7=function(_0x53413e,_0xf3c222){_0x53413e=_0x53413e-0x0;var _0x168e93=_0x9a7e[_0x53413e];return _0x168e93;};'use strict';var _=require(_0xe9a7('0x0'));var util=require(_0xe9a7('0x1'));var logger=require(_0xe9a7('0x2'))(_0xe9a7('0x3'));var moment=require(_0xe9a7('0x4'));var BPromise=require(_0xe9a7('0x5'));var rp=require(_0xe9a7('0x6'));var fs=require('fs');var path=require(_0xe9a7('0x7'));var rimraf=require('rimraf');var config=require(_0xe9a7('0x8'));var attributes=require('./voicePrefix.attributes');module[_0xe9a7('0x9')]=function(_0x1890a8,_0x1d1cee){return _0x1890a8[_0xe9a7('0xa')](_0xe9a7('0xb'),attributes,{'tableName':_0xe9a7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd27=['./voicePrefix.attributes','exports','define','VoicePrefix','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xfd27,0x93));var _0x7fd2=function(_0xe57392,_0x1a69a9){_0xe57392=_0xe57392-0x0;var _0x35bbd1=_0xfd27[_0xe57392];return _0x35bbd1;};'use strict';var _=require(_0x7fd2('0x0'));var util=require(_0x7fd2('0x1'));var logger=require(_0x7fd2('0x2'))(_0x7fd2('0x3'));var moment=require(_0x7fd2('0x4'));var BPromise=require(_0x7fd2('0x5'));var rp=require(_0x7fd2('0x6'));var fs=require('fs');var path=require(_0x7fd2('0x7'));var rimraf=require(_0x7fd2('0x8'));var config=require('../../config/environment');var attributes=require(_0x7fd2('0x9'));module[_0x7fd2('0xa')]=function(_0x42e09a,_0x2b0f2f){return _0x42e09a[_0x7fd2('0xb')](_0x7fd2('0xc'),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 3268ba8..73034d2 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 _0x548f=['http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0xc6f348,_0x114617){var _0x3f6341=function(_0x194b16){while(--_0x194b16){_0xc6f348['push'](_0xc6f348['shift']());}};_0x3f6341(++_0x114617);}(_0x548f,0x104));var _0xf548=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x548f[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xf548('0x0'));var util=require(_0xf548('0x1'));var moment=require(_0xf548('0x2'));var BPromise=require('bluebird');var rs=require(_0xf548('0x3'));var fs=require('fs');var Redis=require(_0xf548('0x4'));var db=require(_0xf548('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf548('0x6'));var config=require(_0xf548('0x7'));var jayson=require(_0xf548('0x8'));var client=jayson[_0xf548('0x9')][_0xf548('0xa')]({'port':0x232a});config[_0xf548('0xb')]=_[_0xf548('0xc')](config['redis'],{'host':_0xf548('0xd'),'port':0x18eb});var socket=require(_0xf548('0xe'))(new Redis(config[_0xf548('0xb')]));require(_0xf548('0xf'))[_0xf548('0x10')](socket);function respondWithRpcPromise(_0x3fb518,_0x4dfe48,_0x433cb9){return new BPromise(function(_0x16e487,_0x485d27){return client[_0xf548('0x11')](_0x3fb518,_0x433cb9)[_0xf548('0x12')](function(_0x41207e){logger[_0xf548('0x13')](_0xf548('0x14'),_0x4dfe48,_0xf548('0x15'));logger[_0xf548('0x16')](_0xf548('0x17'),_0x4dfe48,'request\x20sent',JSON[_0xf548('0x18')](_0x41207e));if(_0x41207e[_0xf548('0x19')]){if(_0x41207e[_0xf548('0x19')][_0xf548('0x1a')]===0x1f4){logger[_0xf548('0x19')](_0xf548('0x14'),_0x4dfe48,_0x41207e[_0xf548('0x19')][_0xf548('0x1b')]);return _0x485d27(_0x41207e['error'][_0xf548('0x1b')]);}logger['error'](_0xf548('0x14'),_0x4dfe48,_0x41207e[_0xf548('0x19')][_0xf548('0x1b')]);return _0x16e487(_0x41207e[_0xf548('0x19')][_0xf548('0x1b')]);}else{logger[_0xf548('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x4dfe48,_0xf548('0x15'));_0x16e487(_0x41207e[_0xf548('0x1c')][_0xf548('0x1b')]);}})[_0xf548('0x1d')](function(_0x3a9446){logger[_0xf548('0x19')](_0xf548('0x14'),_0x4dfe48,_0x3a9446);_0x485d27(_0x3a9446);});});} \ No newline at end of file +var _0xa7c2=['localhost','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xa7c2,0x8f));var _0x2a7c=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0xa7c2[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0x2a7c('0x0'));var util=require('util');var moment=require(_0x2a7c('0x1'));var BPromise=require(_0x2a7c('0x2'));var rs=require(_0x2a7c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a7c('0x4'))['db'];var utils=require(_0x2a7c('0x5'));var logger=require(_0x2a7c('0x6'))(_0x2a7c('0x7'));var config=require(_0x2a7c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2a7c('0x9')][_0x2a7c('0xa')]({'port':0x232a});config[_0x2a7c('0xb')]=_[_0x2a7c('0xc')](config[_0x2a7c('0xb')],{'host':_0x2a7c('0xd'),'port':0x18eb});var socket=require(_0x2a7c('0xe'))(new Redis(config[_0x2a7c('0xb')]));require('./voicePrefix.socket')[_0x2a7c('0xf')](socket);function respondWithRpcPromise(_0x3ad09e,_0x132aff,_0x5a78cb){return new BPromise(function(_0x234978,_0x3dd584){return client[_0x2a7c('0x10')](_0x3ad09e,_0x5a78cb)[_0x2a7c('0x11')](function(_0x104847){logger[_0x2a7c('0x12')](_0x2a7c('0x13'),_0x132aff,_0x2a7c('0x14'));logger[_0x2a7c('0x15')](_0x2a7c('0x16'),_0x132aff,_0x2a7c('0x14'),JSON['stringify'](_0x104847));if(_0x104847[_0x2a7c('0x17')]){if(_0x104847[_0x2a7c('0x17')]['code']===0x1f4){logger[_0x2a7c('0x17')](_0x2a7c('0x13'),_0x132aff,_0x104847[_0x2a7c('0x17')][_0x2a7c('0x18')]);return _0x3dd584(_0x104847[_0x2a7c('0x17')][_0x2a7c('0x18')]);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x132aff,_0x104847['error'][_0x2a7c('0x18')]);return _0x234978(_0x104847['error'][_0x2a7c('0x18')]);}else{logger['info'](_0x2a7c('0x13'),_0x132aff,_0x2a7c('0x14'));_0x234978(_0x104847[_0x2a7c('0x19')]['message']);}})['catch'](function(_0x5b078f){logger[_0x2a7c('0x17')](_0x2a7c('0x13'),_0x132aff,_0x5b078f);_0x3dd584(_0x5b078f);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 4e62412..ea88203 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 _0x756d=['remove','update','emit','removeListener','length','voicePrefix:','./voicePrefix.events','save'];(function(_0x9d7b5,_0x4bf586){var _0x1a4fc7=function(_0x4e5106){while(--_0x4e5106){_0x9d7b5['push'](_0x9d7b5['shift']());}};_0x1a4fc7(++_0x4bf586);}(_0x756d,0x14e));var _0xd756=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x756d[_0x57b54c];return _0x59cc19;};'use strict';var VoicePrefixEvents=require(_0xd756('0x0'));var events=[_0xd756('0x1'),_0xd756('0x2'),_0xd756('0x3')];function createListener(_0x25eda1,_0x19a0a0){return function(_0x1d59c5){_0x19a0a0[_0xd756('0x4')](_0x25eda1,_0x1d59c5);};}function removeListener(_0xfe787,_0x4683d8){return function(){VoicePrefixEvents[_0xd756('0x5')](_0xfe787,_0x4683d8);};}exports['register']=function(_0x373666){for(var _0x5acaab=0x0,_0x3eca1c=events[_0xd756('0x6')];_0x5acaab<_0x3eca1c;_0x5acaab++){var _0xb67e70=events[_0x5acaab];var _0x562155=createListener(_0xd756('0x7')+_0xb67e70,_0x373666);VoicePrefixEvents['on'](_0xb67e70,_0x562155);}}; \ No newline at end of file +var _0x8205=['./voicePrefix.events','remove','emit','removeListener','register','length'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0x8205,0x1e0));var _0x5820=function(_0x4616cf,_0x3eacda){_0x4616cf=_0x4616cf-0x0;var _0x1d9abd=_0x8205[_0x4616cf];return _0x1d9abd;};'use strict';var VoicePrefixEvents=require(_0x5820('0x0'));var events=['save',_0x5820('0x1'),'update'];function createListener(_0x3ccdc5,_0x54e0c0){return function(_0xde7deb){_0x54e0c0[_0x5820('0x2')](_0x3ccdc5,_0xde7deb);};}function removeListener(_0xdc209b,_0x8815d5){return function(){VoicePrefixEvents[_0x5820('0x3')](_0xdc209b,_0x8815d5);};}exports[_0x5820('0x4')]=function(_0xbfbcdf){for(var _0x53879c=0x0,_0x1b7b35=events[_0x5820('0x5')];_0x53879c<_0x1b7b35;_0x53879c++){var _0x12f95d=events[_0x53879c];var _0x277592=createListener('voicePrefix:'+_0x12f95d,_0xbfbcdf);VoicePrefixEvents['on'](_0x12f95d,_0x277592);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 9ed91b1..d0ce711 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 _0xcf3c=['put','update','destroy','removeTeams','delete','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addAgents','/:id/lists','addLists'];(function(_0x835f74,_0x123452){var _0x46a4d6=function(_0x5b7adc){while(--_0x5b7adc){_0x835f74['push'](_0x835f74['shift']());}};_0x46a4d6(++_0x123452);}(_0xcf3c,0x150));var _0xccf3=function(_0x51c975,_0x3084b7){_0x51c975=_0x51c975-0x0;var _0x4580ab=_0xcf3c[_0x51c975];return _0x4580ab;};'use strict';var multer=require(_0xccf3('0x0'));var util=require(_0xccf3('0x1'));var path=require(_0xccf3('0x2'));var timeout=require(_0xccf3('0x3'));var express=require(_0xccf3('0x4'));var router=express['Router']();var auth=require(_0xccf3('0x5'));var interaction=require(_0xccf3('0x6'));var config=require(_0xccf3('0x7'));var controller=require('./voiceQueue.controller');router[_0xccf3('0x8')]('/',auth[_0xccf3('0x9')](),controller['index']);router[_0xccf3('0x8')](_0xccf3('0xa'),auth[_0xccf3('0x9')](),controller[_0xccf3('0xb')]);router[_0xccf3('0x8')](_0xccf3('0xc'),auth['isAuthenticated'](),controller[_0xccf3('0xd')]);router['get'](_0xccf3('0xe'),auth[_0xccf3('0x9')](),controller[_0xccf3('0xf')]);router[_0xccf3('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0xccf3('0x10')]);router[_0xccf3('0x8')]('/:id/hopper_black',auth[_0xccf3('0x9')](),controller[_0xccf3('0x11')]);router['get'](_0xccf3('0x12'),auth[_0xccf3('0x9')](),controller[_0xccf3('0x13')]);router[_0xccf3('0x8')](_0xccf3('0x14'),auth[_0xccf3('0x9')](),controller[_0xccf3('0x15')]);router[_0xccf3('0x8')](_0xccf3('0x16'),auth['isAuthenticated'](),controller[_0xccf3('0x17')]);router['get']('/:id/lists',auth[_0xccf3('0x9')](),controller[_0xccf3('0x18')]);router['get'](_0xccf3('0x19'),auth[_0xccf3('0x9')](),controller[_0xccf3('0x1a')]);router[_0xccf3('0x1b')]('/',auth[_0xccf3('0x9')](),controller[_0xccf3('0x1c')]);router['post'](_0xccf3('0x1d'),auth[_0xccf3('0x9')](),controller['clone']);router['post'](_0xccf3('0x12'),auth[_0xccf3('0x9')](),controller['addTeams']);router['post'](_0xccf3('0x14'),auth[_0xccf3('0x9')](),controller[_0xccf3('0x1e')]);router[_0xccf3('0x1b')](_0xccf3('0x1f'),auth['isAuthenticated'](),controller[_0xccf3('0x20')]);router[_0xccf3('0x1b')]('/:id/blacklists',auth['isAuthenticated'](),controller['addBlackLists']);router[_0xccf3('0x21')]('/:id',auth['isAuthenticated'](),controller[_0xccf3('0x22')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xccf3('0x23')]);router['delete'](_0xccf3('0x12'),auth['isAuthenticated'](),controller[_0xccf3('0x24')]);router[_0xccf3('0x25')](_0xccf3('0x14'),auth[_0xccf3('0x9')](),controller['removeAgents']);router['delete'](_0xccf3('0x1f'),auth[_0xccf3('0x9')](),controller[_0xccf3('0x26')]);router[_0xccf3('0x25')]('/:id/blacklists',auth[_0xccf3('0x9')](),controller[_0xccf3('0x27')]);module[_0xccf3('0x28')]=router; \ No newline at end of file +var _0x220f=['destroy','removeTeams','removeAgents','removeBlackLists','exports','multer','path','express','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','getHoppers','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','/:id/lists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addAgents','addLists','addBlackLists','put','delete'];(function(_0x1b2cb8,_0x50c774){var _0x150856=function(_0x15b4c3){while(--_0x15b4c3){_0x1b2cb8['push'](_0x1b2cb8['shift']());}};_0x150856(++_0x50c774);}(_0x220f,0x125));var _0xf220=function(_0x3a0e31,_0x455234){_0x3a0e31=_0x3a0e31-0x0;var _0x258a3e=_0x220f[_0x3a0e31];return _0x258a3e;};'use strict';var multer=require(_0xf220('0x0'));var util=require('util');var path=require(_0xf220('0x1'));var timeout=require('connect-timeout');var express=require(_0xf220('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xf220('0x3'));var config=require(_0xf220('0x4'));var controller=require('./voiceQueue.controller');router[_0xf220('0x5')]('/',auth['isAuthenticated'](),controller[_0xf220('0x6')]);router[_0xf220('0x5')](_0xf220('0x7'),auth[_0xf220('0x8')](),controller[_0xf220('0x9')]);router[_0xf220('0x5')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0xf220('0xa')]);router['get']('/:id/hopper_histories',auth[_0xf220('0x8')](),controller[_0xf220('0xb')]);router[_0xf220('0x5')](_0xf220('0xc'),auth[_0xf220('0x8')](),controller['getHopperFinals']);router[_0xf220('0x5')](_0xf220('0xd'),auth['isAuthenticated'](),controller[_0xf220('0xe')]);router[_0xf220('0x5')](_0xf220('0xf'),auth[_0xf220('0x8')](),controller[_0xf220('0x10')]);router['get'](_0xf220('0x11'),auth[_0xf220('0x8')](),controller[_0xf220('0x12')]);router[_0xf220('0x5')](_0xf220('0x13'),auth[_0xf220('0x8')](),controller['getMembers']);router[_0xf220('0x5')](_0xf220('0x14'),auth[_0xf220('0x8')](),controller['getLists']);router[_0xf220('0x5')](_0xf220('0x15'),auth[_0xf220('0x8')](),controller[_0xf220('0x16')]);router[_0xf220('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf220('0x17')](_0xf220('0x18'),auth[_0xf220('0x8')](),controller[_0xf220('0x19')]);router[_0xf220('0x17')]('/:id/teams',auth[_0xf220('0x8')](),controller['addTeams']);router[_0xf220('0x17')](_0xf220('0x11'),auth[_0xf220('0x8')](),controller[_0xf220('0x1a')]);router[_0xf220('0x17')](_0xf220('0x14'),auth[_0xf220('0x8')](),controller[_0xf220('0x1b')]);router[_0xf220('0x17')](_0xf220('0x15'),auth[_0xf220('0x8')](),controller[_0xf220('0x1c')]);router[_0xf220('0x1d')](_0xf220('0x7'),auth[_0xf220('0x8')](),controller['update']);router[_0xf220('0x1e')](_0xf220('0x7'),auth[_0xf220('0x8')](),controller[_0xf220('0x1f')]);router[_0xf220('0x1e')](_0xf220('0xf'),auth[_0xf220('0x8')](),controller[_0xf220('0x20')]);router['delete'](_0xf220('0x11'),auth[_0xf220('0x8')](),controller[_0xf220('0x21')]);router[_0xf220('0x1e')](_0xf220('0x14'),auth['isAuthenticated'](),controller['removeLists']);router[_0xf220('0x1e')](_0xf220('0x15'),auth[_0xf220('0x8')](),controller[_0xf220('0x22')]);module[_0xf220('0x23')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 3a473f9..2e48a93 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(_0x4afe3b,_0x255e0d){var _0x2c22d1=function(_0x313847){while(--_0x313847){_0x4afe3b['push'](_0x4afe3b['shift']());}};_0x2c22d1(++_0x255e0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x262c6d,_0x422ff9){var _0x4c5d85=function(_0x5de3ad){while(--_0x5de3ad){_0x262c6d['push'](_0x262c6d['shift']());}};_0x4c5d85(++_0x422ff9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 79425c9..667cd42 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 _0xc758=['COALESCE(phone,\x27\x27)','removeLists','getBlackLists','addBlackLists','cm_hopper_black','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','count','offset','Content-Range','apply','save','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','map','value','type','name','UserProfileResource','destroy','error','stack','send','index','VoiceQueue','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','options','includeAll','rows','show','params','catch','create','body','user','find','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rawAttributes','length','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','getHoppers','order','VoiceQueueId','CmHopper','include','findAll','getHopperHistories','findOne','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','interface','flatMap','penalty','sequelize','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','voicePause','forEach','emit','ids','select','field','tq.TeamId','from','join','user_has_teams','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','upsert','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','fromQuery','scheduledAt','ContactId','ListId','phone','NOW()','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20NOT\x20IN\x20(?)','cm_hopper','onlyIfOpen','cm_contacts','phone\x20IS\x20NOT\x20NULL'];(function(_0x19d8be,_0x2e4c8d){var _0x1b75bc=function(_0x1225bd){while(--_0x1225bd){_0x19d8be['push'](_0x19d8be['shift']());}};_0x1b75bc(++_0x2e4c8d);}(_0xc758,0xb9));var _0x8c75=function(_0x4d8343,_0x58919b){_0x4d8343=_0x4d8343-0x0;var _0xbf813c=_0xc758[_0x4d8343];return _0xbf813c;};'use strict';var pdf=require(_0x8c75('0x0'));var emlformat=require(_0x8c75('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8c75('0x2'));var jsonpatch=require(_0x8c75('0x3'));var rp=require('request-promise');var moment=require(_0x8c75('0x4'));var BPromise=require(_0x8c75('0x5'));var Mustache=require(_0x8c75('0x6'));var util=require(_0x8c75('0x7'));var path=require(_0x8c75('0x8'));var sox=require(_0x8c75('0x9'));var csv=require(_0x8c75('0xa'));var ejs=require(_0x8c75('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8c75('0xc'));var crypto=require(_0x8c75('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8c75('0xe'));var toCsv=require(_0x8c75('0xa'));var querystring=require(_0x8c75('0xf'));var Papa=require(_0x8c75('0x10'));var Redis=require('ioredis');var authService=require(_0x8c75('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8c75('0x12'));var hardwareService=require(_0x8c75('0x13'));var logger=require('../../config/logger')(_0x8c75('0x14'));var utils=require(_0x8c75('0x15'));var config=require(_0x8c75('0x16'));var db=require(_0x8c75('0x17'))['db'];config[_0x8c75('0x18')]=_[_0x8c75('0x19')](config[_0x8c75('0x18')],{'host':_0x8c75('0x1a'),'port':0x18eb});var socket=require(_0x8c75('0x1b'))(new Redis(config[_0x8c75('0x18')]));require(_0x8c75('0x1c'))[_0x8c75('0x1d')](socket);function respondWithStatusCode(_0x43e43d,_0x2f6446){_0x2f6446=_0x2f6446||0xcc;return function(_0x5edc73){if(_0x5edc73){return _0x43e43d[_0x8c75('0x1e')](_0x2f6446);}return _0x43e43d[_0x8c75('0x1f')](_0x2f6446)[_0x8c75('0x20')]();};}function respondWithResult(_0xa3b20,_0x5b2ef4){_0x5b2ef4=_0x5b2ef4||0xc8;return function(_0x216d26){if(_0x216d26){return _0xa3b20[_0x8c75('0x1f')](_0x5b2ef4)[_0x8c75('0x21')](_0x216d26);}};}function respondWithFilteredResult(_0x50176b,_0x3d20a7){return function(_0x31ddf9){if(_0x31ddf9){var _0x534410=_0x31ddf9[_0x8c75('0x22')],_0x2a452e=_0x3d20a7['offset'],_0x235274=_0x3d20a7[_0x8c75('0x23')]+_0x3d20a7['limit'],_0x67ee41;if(_0x235274>=_0x534410){_0x235274=_0x534410;_0x67ee41=0xc8;}else{_0x67ee41=0xce;}_0x50176b[_0x8c75('0x1f')](_0x67ee41);return _0x50176b['set'](_0x8c75('0x24'),_0x2a452e+'-'+_0x235274+'/'+_0x534410)[_0x8c75('0x21')](_0x31ddf9);}return null;};}function patchUpdates(_0x52027e){return function(_0x4d9b97){try{jsonpatch[_0x8c75('0x25')](_0x4d9b97,_0x52027e,!![]);}catch(_0x24101b){return BPromise['reject'](_0x24101b);}return _0x4d9b97[_0x8c75('0x26')]();};}function saveUpdates(_0x298f13,_0x2bd9ee){return function(_0x43b5ae){if(_0x43b5ae){return _0x43b5ae[_0x8c75('0x27')](_0x298f13)[_0x8c75('0x28')](function(_0x390eee){return _0x390eee;});}return null;};}function removeEntity(_0x4f6a93,_0x5d5c51){return function(_0x227ca3){if(_0x227ca3){return _0x227ca3['destroy']()[_0x8c75('0x28')](function(){var _0xb76ab6=_0x227ca3[_0x8c75('0x29')]({'plain':!![]});var _0x2360e6=[{'name':_0x8c75('0x2a'),'value':_0x8c75('0x2b'),'ignore':![]},{'name':_0x8c75('0x2c'),'value':_0x8c75('0x2d'),'ignore':![]}];var _0x117053=_(_0x2360e6)[_0x8c75('0x2e')]('ignore')[_0x8c75('0x2f')]('value')[_0x8c75('0x30')]();if(_['includes'](_0x117053,_0xb76ab6['type'])){return;}var _0x3faf17=_['find'](_0x2360e6,[_0x8c75('0x30'),_0xb76ab6[_0x8c75('0x31')]])[_0x8c75('0x32')];return db[_0x8c75('0x33')][_0x8c75('0x34')]({'where':{'type':_0x3faf17,'resourceId':_0xb76ab6['id']}})['then'](function(){return _0x227ca3;});})[_0x8c75('0x28')](function(){_0x4f6a93[_0x8c75('0x1f')](0xcc)[_0x8c75('0x20')]();});}};}function handleEntityNotFound(_0x4e4f9d,_0xde1164){return function(_0x44b290){if(!_0x44b290){_0x4e4f9d['sendStatus'](0x194);}return _0x44b290;};}function handleError(_0x440195,_0x266791){_0x266791=_0x266791||0x1f4;return function(_0x137685){logger[_0x8c75('0x35')](_0x137685[_0x8c75('0x36')]);if(_0x137685['name']){delete _0x137685[_0x8c75('0x32')];}_0x440195['status'](_0x266791)[_0x8c75('0x37')](_0x137685);};}exports[_0x8c75('0x38')]=function(_0x209b0c,_0x4cd795){var _0x36b93b={},_0x3bcec6={},_0x1db6d0={'count':0x0,'rows':[]};var _0x58f9cf=_[_0x8c75('0x2f')](db[_0x8c75('0x39')]['rawAttributes'],function(_0x3ab696){return{'name':_0x3ab696[_0x8c75('0x3a')],'type':_0x3ab696['type'][_0x8c75('0x3b')]};});_0x3bcec6[_0x8c75('0x3c')]=_[_0x8c75('0x2f')](_0x58f9cf,_0x8c75('0x32'));_0x3bcec6[_0x8c75('0x3d')]=_[_0x8c75('0x3e')](_0x209b0c['query']);_0x3bcec6[_0x8c75('0x3f')]=_[_0x8c75('0x40')](_0x3bcec6[_0x8c75('0x3c')],_0x3bcec6[_0x8c75('0x3d')]);_0x36b93b['attributes']=_[_0x8c75('0x40')](_0x3bcec6[_0x8c75('0x3c')],qs[_0x8c75('0x41')](_0x209b0c[_0x8c75('0x3d')][_0x8c75('0x41')]));_0x36b93b['attributes']=_0x36b93b[_0x8c75('0x42')]['length']?_0x36b93b['attributes']:_0x3bcec6['model'];if(!_0x209b0c[_0x8c75('0x3d')][_0x8c75('0x43')](_0x8c75('0x44'))){_0x36b93b[_0x8c75('0x45')]=qs[_0x8c75('0x45')](_0x209b0c[_0x8c75('0x3d')]['limit']);_0x36b93b[_0x8c75('0x23')]=qs['offset'](_0x209b0c[_0x8c75('0x3d')]['offset']);}_0x36b93b['order']=qs[_0x8c75('0x46')](_0x209b0c[_0x8c75('0x3d')][_0x8c75('0x46')]);_0x36b93b[_0x8c75('0x47')]=qs[_0x8c75('0x3f')](_[_0x8c75('0x48')](_0x209b0c[_0x8c75('0x3d')],_0x3bcec6[_0x8c75('0x3f')]),_0x58f9cf);if(_0x209b0c[_0x8c75('0x3d')]['filter']){_0x36b93b[_0x8c75('0x47')]=_[_0x8c75('0x49')](_0x36b93b[_0x8c75('0x47')],{'$or':_[_0x8c75('0x2f')](_0x58f9cf,function(_0x4d21af){if(_0x4d21af[_0x8c75('0x31')]!==_0x8c75('0x4a')){var _0x7c3b82={};_0x7c3b82[_0x4d21af[_0x8c75('0x32')]]={'$like':'%'+_0x209b0c['query'][_0x8c75('0x2e')]+'%'};return _0x7c3b82;}})});}_0x36b93b=_['merge']({},_0x36b93b,_0x209b0c[_0x8c75('0x4b')]);var _0x27d674={'where':_0x36b93b[_0x8c75('0x47')]};return db[_0x8c75('0x39')][_0x8c75('0x22')](_0x27d674)[_0x8c75('0x28')](function(_0xf3201d){_0x1db6d0[_0x8c75('0x22')]=_0xf3201d;if(_0x209b0c['query'][_0x8c75('0x4c')]){_0x36b93b['include']=[{'all':!![]}];}return db[_0x8c75('0x39')]['findAll'](_0x36b93b);})[_0x8c75('0x28')](function(_0x45ac96){_0x1db6d0[_0x8c75('0x4d')]=_0x45ac96;return _0x1db6d0;})['then'](respondWithFilteredResult(_0x4cd795,_0x36b93b))['catch'](handleError(_0x4cd795,null));};exports[_0x8c75('0x4e')]=function(_0x1ba1a4,_0x41ae51){var _0x286619={'raw':![],'where':{'id':_0x1ba1a4[_0x8c75('0x4f')]['id']}},_0x58c3d5={};_0x58c3d5['model']=_['keys'](db['VoiceQueue']['rawAttributes']);_0x58c3d5['query']=_['keys'](_0x1ba1a4['query']);_0x58c3d5[_0x8c75('0x3f')]=_[_0x8c75('0x40')](_0x58c3d5[_0x8c75('0x3c')],_0x58c3d5['query']);_0x286619[_0x8c75('0x42')]=_[_0x8c75('0x40')](_0x58c3d5[_0x8c75('0x3c')],qs['fields'](_0x1ba1a4[_0x8c75('0x3d')][_0x8c75('0x41')]));_0x286619[_0x8c75('0x42')]=_0x286619[_0x8c75('0x42')]['length']?_0x286619[_0x8c75('0x42')]:_0x58c3d5['model'];if(_0x1ba1a4[_0x8c75('0x3d')][_0x8c75('0x4c')]){_0x286619['include']=[{'all':!![]}];}_0x286619=_[_0x8c75('0x49')]({},_0x286619,_0x1ba1a4[_0x8c75('0x4b')]);return db['VoiceQueue']['find'](_0x286619)[_0x8c75('0x28')](handleEntityNotFound(_0x41ae51,null))[_0x8c75('0x28')](respondWithResult(_0x41ae51,null))[_0x8c75('0x50')](handleError(_0x41ae51,null));};exports['create']=function(_0x4d2b0f,_0x4ab00e){return db['VoiceQueue'][_0x8c75('0x51')](_0x4d2b0f[_0x8c75('0x52')],{})[_0x8c75('0x28')](function(_0x5096bb){var _0x2abefd=_0x4d2b0f['user'][_0x8c75('0x29')]({'plain':!![]});if(!_0x2abefd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2abefd['role']===_0x8c75('0x53')){var _0x4a7bf4=_0x5096bb[_0x8c75('0x29')]({'plain':!![]});var _0x1c1e34=[{'name':_0x8c75('0x2a'),'value':'inbound'},{'name':_0x8c75('0x2c'),'value':_0x8c75('0x2d')}];var _0x4ee870=_[_0x8c75('0x54')](_0x1c1e34,[_0x8c75('0x30'),_0x4a7bf4[_0x8c75('0x31')]])['name'];return db[_0x8c75('0x55')]['find']({'where':{'name':_0x4ee870,'userProfileId':_0x2abefd['userProfileId']},'raw':!![]})['then'](function(_0x15ecc9){if(_0x15ecc9&&_0x15ecc9[_0x8c75('0x56')]===0x0){return db[_0x8c75('0x33')]['create']({'name':_0x4a7bf4[_0x8c75('0x32')],'resourceId':_0x4a7bf4['id'],'type':_0x15ecc9[_0x8c75('0x32')],'sectionId':_0x15ecc9['id']},{})['then'](function(){return _0x5096bb;});}else{return _0x5096bb;}})['catch'](function(_0x2a5f34){logger['error'](_0x8c75('0x57'),_0x2a5f34);throw _0x2a5f34;});}return _0x5096bb;})['then'](respondWithResult(_0x4ab00e,0xc9))[_0x8c75('0x50')](handleError(_0x4ab00e,null));};exports['clone']=function(_0x559185,_0x5130be){var _0x142895={'where':{'id':_0x559185['params']['id']}},_0x1d1d4c={};_0x1d1d4c[_0x8c75('0x3c')]=_[_0x8c75('0x3e')](db[_0x8c75('0x39')][_0x8c75('0x58')]);_0x142895['attributes']=_[_0x8c75('0x40')](_0x1d1d4c['model'],qs[_0x8c75('0x41')](_0x559185[_0x8c75('0x3d')][_0x8c75('0x41')]));_0x142895[_0x8c75('0x42')]=_0x142895[_0x8c75('0x42')][_0x8c75('0x59')]?_0x142895[_0x8c75('0x42')]:_0x1d1d4c[_0x8c75('0x3c')];if(_0x559185[_0x8c75('0x3d')]['includeAll']){_0x142895['include']=[{'all':!![]}];}_0x142895=_['merge']({},_0x142895,_0x559185[_0x8c75('0x4b')]);return db['VoiceQueue'][_0x8c75('0x54')](_0x142895)[_0x8c75('0x28')](handleEntityNotFound(_0x5130be,null))[_0x8c75('0x28')](function(_0x181af1){if(_0x181af1){var _0x59762e=_0x181af1[_0x8c75('0x29')]({'plain':!![]});_0x59762e=qs[_0x8c75('0x5a')](_0x59762e,['id',_0x8c75('0x5b'),_0x8c75('0x5c')]);_0x559185['body']=_[_0x8c75('0x5a')](_0x559185['body'],['id',_0x8c75('0x5b'),'updatedAt']);return db['VoiceQueue']['create'](_['merge'](_0x59762e,_0x559185[_0x8c75('0x52')]),{'include':_0x559185[_0x8c75('0x3d')][_0x8c75('0x4c')]?[{'all':!![]}]:undefined})[_0x8c75('0x28')](function(_0x224a79){var _0x4adc8a=_0x559185[_0x8c75('0x53')][_0x8c75('0x29')]({'plain':!![]});if(!_0x4adc8a)throw new Error(_0x8c75('0x5d'));if(_0x4adc8a[_0x8c75('0x5e')]===_0x8c75('0x53')){var _0x376af8=_0x224a79[_0x8c75('0x29')]({'plain':!![]});var _0x1d3082=[{'name':_0x8c75('0x2a'),'value':_0x8c75('0x2b')},{'name':'QueueCampaigns','value':_0x8c75('0x2d')}];var _0x50562f=_[_0x8c75('0x54')](_0x1d3082,[_0x8c75('0x30'),_0x376af8['type']])[_0x8c75('0x32')];return db[_0x8c75('0x55')][_0x8c75('0x54')]({'where':{'name':_0x50562f,'userProfileId':_0x4adc8a[_0x8c75('0x5f')]},'raw':!![]})[_0x8c75('0x28')](function(_0x391dc4){if(_0x391dc4&&_0x391dc4[_0x8c75('0x56')]===0x0){return db[_0x8c75('0x33')][_0x8c75('0x51')]({'name':_0x376af8[_0x8c75('0x32')],'resourceId':_0x376af8['id'],'type':_0x391dc4['name'],'sectionId':_0x391dc4['id']},{})[_0x8c75('0x28')](function(){return _0x224a79;});}else{return _0x224a79;}})['catch'](function(_0xa6f8a5){logger[_0x8c75('0x35')](_0x8c75('0x57'),_0xa6f8a5);throw _0xa6f8a5;});}return _0x224a79;});}})['then'](respondWithResult(_0x5130be,0xc9))[_0x8c75('0x50')](handleError(_0x5130be,null));};exports[_0x8c75('0x27')]=function(_0x5e9c5e,_0x1b975c){if(_0x5e9c5e[_0x8c75('0x52')]['id']){delete _0x5e9c5e[_0x8c75('0x52')]['id'];}return db[_0x8c75('0x39')][_0x8c75('0x54')]({'where':{'id':_0x5e9c5e[_0x8c75('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1b975c,null))[_0x8c75('0x28')](saveUpdates(_0x5e9c5e[_0x8c75('0x52')],null))['then'](respondWithResult(_0x1b975c,null))[_0x8c75('0x50')](handleError(_0x1b975c,null));};exports['destroy']=function(_0x56b1af,_0x20ac0e){return db[_0x8c75('0x39')][_0x8c75('0x54')]({'where':{'id':_0x56b1af[_0x8c75('0x4f')]['id']}})[_0x8c75('0x28')](handleEntityNotFound(_0x20ac0e,null))[_0x8c75('0x28')](removeEntity(_0x20ac0e,null))[_0x8c75('0x50')](handleError(_0x20ac0e,null));};exports[_0x8c75('0x60')]=function(_0x4e1d3f,_0x3f4273,_0x3a853e){var _0x3a8e43={'raw':![],'where':{}};var _0x197f7b={};var _0xfb1901={'count':0x0,'rows':[]};return db[_0x8c75('0x39')]['findOne']({'where':{'id':_0x4e1d3f[_0x8c75('0x4f')]['id']}})[_0x8c75('0x28')](handleEntityNotFound(_0x3f4273,null))[_0x8c75('0x28')](function(_0x84d162){if(_0x84d162){_0x197f7b[_0x8c75('0x3c')]=_['keys'](db['CmHopper']['rawAttributes']);_0x197f7b[_0x8c75('0x3d')]=_[_0x8c75('0x3e')](_0x4e1d3f[_0x8c75('0x3d')]);_0x197f7b[_0x8c75('0x3f')]=_[_0x8c75('0x40')](_0x197f7b[_0x8c75('0x3c')],_0x197f7b['query']);_0x3a8e43['attributes']=_[_0x8c75('0x40')](_0x197f7b[_0x8c75('0x3c')],qs[_0x8c75('0x41')](_0x4e1d3f[_0x8c75('0x3d')][_0x8c75('0x41')]));_0x3a8e43['attributes']=_0x3a8e43[_0x8c75('0x42')][_0x8c75('0x59')]?_0x3a8e43['attributes']:_0x197f7b[_0x8c75('0x3c')];if(!_0x4e1d3f[_0x8c75('0x3d')][_0x8c75('0x43')](_0x8c75('0x44'))){_0x3a8e43['limit']=qs[_0x8c75('0x45')](_0x4e1d3f[_0x8c75('0x3d')][_0x8c75('0x45')]);_0x3a8e43[_0x8c75('0x23')]=qs['offset'](_0x4e1d3f[_0x8c75('0x3d')][_0x8c75('0x23')]);}_0x3a8e43[_0x8c75('0x61')]=qs['sort'](_0x4e1d3f['query'][_0x8c75('0x46')]);_0x3a8e43[_0x8c75('0x47')]=qs[_0x8c75('0x3f')](_[_0x8c75('0x48')](_0x4e1d3f[_0x8c75('0x3d')],_0x197f7b[_0x8c75('0x3f')]));_0x3a8e43[_0x8c75('0x47')][_0x8c75('0x62')]=_0x84d162['id'];if(_0x4e1d3f[_0x8c75('0x3d')][_0x8c75('0x2e')]){_0x3a8e43['where']=_[_0x8c75('0x49')](_0x3a8e43[_0x8c75('0x47')],{'$or':_[_0x8c75('0x2f')](_0x3a8e43[_0x8c75('0x42')],function(_0x15adf2){var _0x58bd13={};_0x58bd13[_0x15adf2]={'$like':'%'+_0x4e1d3f['query'][_0x8c75('0x2e')]+'%'};return _0x58bd13;})});}_0x3a8e43=_[_0x8c75('0x49')]({},_0x3a8e43,_0x4e1d3f[_0x8c75('0x4b')]);return db[_0x8c75('0x63')][_0x8c75('0x22')]({'where':_0x3a8e43[_0x8c75('0x47')]})[_0x8c75('0x28')](function(_0x4ec81c){_0xfb1901[_0x8c75('0x22')]=_0x4ec81c;if(_0x4e1d3f[_0x8c75('0x3d')][_0x8c75('0x4c')]){_0x3a8e43[_0x8c75('0x64')]=[{'all':!![]}];}return db[_0x8c75('0x63')][_0x8c75('0x65')](_0x3a8e43);})[_0x8c75('0x28')](function(_0xcfca17){_0xfb1901[_0x8c75('0x4d')]=_0xcfca17;return _0xfb1901;});}})[_0x8c75('0x28')](respondWithFilteredResult(_0x3f4273,_0x3a8e43))[_0x8c75('0x50')](handleError(_0x3f4273,null));};exports[_0x8c75('0x66')]=function(_0x2d5ba9,_0x6803bd,_0x22df63){var _0x4daff2={'raw':!![],'where':{}};var _0x14baf5={};var _0x4cb142={'count':0x0,'rows':[]};return db[_0x8c75('0x39')][_0x8c75('0x67')]({'where':{'id':_0x2d5ba9[_0x8c75('0x4f')]['id']}})[_0x8c75('0x28')](handleEntityNotFound(_0x6803bd,null))[_0x8c75('0x28')](function(_0x138f09){if(_0x138f09){_0x14baf5[_0x8c75('0x3c')]=_['keys'](db[_0x8c75('0x68')][_0x8c75('0x58')]);_0x14baf5[_0x8c75('0x3d')]=_[_0x8c75('0x3e')](_0x2d5ba9[_0x8c75('0x3d')]);_0x14baf5[_0x8c75('0x3f')]=_[_0x8c75('0x40')](_0x14baf5[_0x8c75('0x3c')],_0x14baf5[_0x8c75('0x3d')]);_0x4daff2[_0x8c75('0x42')]=_['intersection'](_0x14baf5[_0x8c75('0x3c')],qs[_0x8c75('0x41')](_0x2d5ba9['query'][_0x8c75('0x41')]));_0x4daff2[_0x8c75('0x42')]=_0x4daff2['attributes'][_0x8c75('0x59')]?_0x4daff2[_0x8c75('0x42')]:_0x14baf5[_0x8c75('0x3c')];if(!_0x2d5ba9['query'][_0x8c75('0x43')]('nolimit')){_0x4daff2[_0x8c75('0x45')]=qs[_0x8c75('0x45')](_0x2d5ba9['query'][_0x8c75('0x45')]);_0x4daff2[_0x8c75('0x23')]=qs[_0x8c75('0x23')](_0x2d5ba9[_0x8c75('0x3d')][_0x8c75('0x23')]);}_0x4daff2[_0x8c75('0x61')]=qs[_0x8c75('0x46')](_0x2d5ba9['query'][_0x8c75('0x46')]);_0x4daff2[_0x8c75('0x47')]=qs[_0x8c75('0x3f')](_[_0x8c75('0x48')](_0x2d5ba9[_0x8c75('0x3d')],_0x14baf5[_0x8c75('0x3f')]));_0x4daff2[_0x8c75('0x47')][_0x8c75('0x62')]=_0x138f09['id'];if(_0x2d5ba9['query'][_0x8c75('0x2e')]){_0x4daff2['where']=_[_0x8c75('0x49')](_0x4daff2[_0x8c75('0x47')],{'$or':_[_0x8c75('0x2f')](_0x4daff2[_0x8c75('0x42')],function(_0x212ec1){var _0x218a0a={};_0x218a0a[_0x212ec1]={'$like':'%'+_0x2d5ba9[_0x8c75('0x3d')][_0x8c75('0x2e')]+'%'};return _0x218a0a;})});}_0x4daff2=_[_0x8c75('0x49')]({},_0x4daff2,_0x2d5ba9[_0x8c75('0x4b')]);return db[_0x8c75('0x68')][_0x8c75('0x22')]({'where':_0x4daff2[_0x8c75('0x47')]})[_0x8c75('0x28')](function(_0x2a6e3d){_0x4cb142[_0x8c75('0x22')]=_0x2a6e3d;if(_0x2d5ba9[_0x8c75('0x3d')][_0x8c75('0x4c')]){_0x4daff2['include']=[{'all':!![]}];}return db[_0x8c75('0x68')][_0x8c75('0x65')](_0x4daff2);})[_0x8c75('0x28')](function(_0x14a5b5){_0x4cb142[_0x8c75('0x4d')]=_0x14a5b5;return _0x4cb142;});}})[_0x8c75('0x28')](respondWithFilteredResult(_0x6803bd,_0x4daff2))[_0x8c75('0x50')](handleError(_0x6803bd,null));};exports['getHopperFinals']=function(_0x2879cb,_0x3050ea,_0x465e35){var _0x3747ea={'raw':!![],'where':{}};var _0x59f7ec={};var _0x3b32fd={'count':0x0,'rows':[]};return db[_0x8c75('0x39')][_0x8c75('0x67')]({'where':{'id':_0x2879cb['params']['id']}})['then'](handleEntityNotFound(_0x3050ea,null))['then'](function(_0x219ddf){if(_0x219ddf){_0x59f7ec[_0x8c75('0x3c')]=_[_0x8c75('0x3e')](db[_0x8c75('0x69')][_0x8c75('0x58')]);_0x59f7ec[_0x8c75('0x3d')]=_[_0x8c75('0x3e')](_0x2879cb[_0x8c75('0x3d')]);_0x59f7ec[_0x8c75('0x3f')]=_[_0x8c75('0x40')](_0x59f7ec[_0x8c75('0x3c')],_0x59f7ec[_0x8c75('0x3d')]);_0x3747ea[_0x8c75('0x42')]=_[_0x8c75('0x40')](_0x59f7ec[_0x8c75('0x3c')],qs[_0x8c75('0x41')](_0x2879cb[_0x8c75('0x3d')][_0x8c75('0x41')]));_0x3747ea[_0x8c75('0x42')]=_0x3747ea['attributes'][_0x8c75('0x59')]?_0x3747ea['attributes']:_0x59f7ec['model'];if(!_0x2879cb[_0x8c75('0x3d')]['hasOwnProperty'](_0x8c75('0x44'))){_0x3747ea[_0x8c75('0x45')]=qs['limit'](_0x2879cb[_0x8c75('0x3d')]['limit']);_0x3747ea[_0x8c75('0x23')]=qs[_0x8c75('0x23')](_0x2879cb['query'][_0x8c75('0x23')]);}_0x3747ea['order']=qs[_0x8c75('0x46')](_0x2879cb[_0x8c75('0x3d')][_0x8c75('0x46')]);_0x3747ea[_0x8c75('0x47')]=qs[_0x8c75('0x3f')](_[_0x8c75('0x48')](_0x2879cb['query'],_0x59f7ec[_0x8c75('0x3f')]));_0x3747ea[_0x8c75('0x47')][_0x8c75('0x62')]=_0x219ddf['id'];if(_0x2879cb[_0x8c75('0x3d')][_0x8c75('0x2e')]){_0x3747ea[_0x8c75('0x47')]=_[_0x8c75('0x49')](_0x3747ea['where'],{'$or':_[_0x8c75('0x2f')](_0x3747ea[_0x8c75('0x42')],function(_0x23c194){var _0x402438={};_0x402438[_0x23c194]={'$like':'%'+_0x2879cb['query']['filter']+'%'};return _0x402438;})});}_0x3747ea=_[_0x8c75('0x49')]({},_0x3747ea,_0x2879cb[_0x8c75('0x4b')]);return db[_0x8c75('0x69')]['count']({'where':_0x3747ea['where']})[_0x8c75('0x28')](function(_0x18cfae){_0x3b32fd[_0x8c75('0x22')]=_0x18cfae;if(_0x2879cb[_0x8c75('0x3d')][_0x8c75('0x4c')]){_0x3747ea[_0x8c75('0x64')]=[{'all':!![]}];}return db[_0x8c75('0x69')][_0x8c75('0x65')](_0x3747ea);})[_0x8c75('0x28')](function(_0x29ecfe){_0x3b32fd['rows']=_0x29ecfe;return _0x3b32fd;});}})['then'](respondWithFilteredResult(_0x3050ea,_0x3747ea))[_0x8c75('0x50')](handleError(_0x3050ea,null));};exports['getHopperBlacks']=function(_0x5a54d8,_0x347baf,_0x34c202){var _0x304ead={'raw':!![],'where':{}};var _0x1a7479={};var _0xaf1fe9={'count':0x0,'rows':[]};return db[_0x8c75('0x39')][_0x8c75('0x67')]({'where':{'id':_0x5a54d8['params']['id']}})[_0x8c75('0x28')](handleEntityNotFound(_0x347baf,null))[_0x8c75('0x28')](function(_0x1bbd6b){if(_0x1bbd6b){_0x1a7479['model']=_[_0x8c75('0x3e')](db[_0x8c75('0x6a')][_0x8c75('0x58')]);_0x1a7479['query']=_[_0x8c75('0x3e')](_0x5a54d8[_0x8c75('0x3d')]);_0x1a7479['filters']=_[_0x8c75('0x40')](_0x1a7479[_0x8c75('0x3c')],_0x1a7479[_0x8c75('0x3d')]);_0x304ead[_0x8c75('0x42')]=_[_0x8c75('0x40')](_0x1a7479['model'],qs[_0x8c75('0x41')](_0x5a54d8[_0x8c75('0x3d')][_0x8c75('0x41')]));_0x304ead[_0x8c75('0x42')]=_0x304ead[_0x8c75('0x42')][_0x8c75('0x59')]?_0x304ead[_0x8c75('0x42')]:_0x1a7479[_0x8c75('0x3c')];if(!_0x5a54d8[_0x8c75('0x3d')][_0x8c75('0x43')](_0x8c75('0x44'))){_0x304ead[_0x8c75('0x45')]=qs[_0x8c75('0x45')](_0x5a54d8[_0x8c75('0x3d')][_0x8c75('0x45')]);_0x304ead[_0x8c75('0x23')]=qs['offset'](_0x5a54d8[_0x8c75('0x3d')]['offset']);}_0x304ead[_0x8c75('0x61')]=qs[_0x8c75('0x46')](_0x5a54d8[_0x8c75('0x3d')][_0x8c75('0x46')]);_0x304ead[_0x8c75('0x47')]=qs[_0x8c75('0x3f')](_['pick'](_0x5a54d8[_0x8c75('0x3d')],_0x1a7479[_0x8c75('0x3f')]));_0x304ead['where'][_0x8c75('0x62')]=_0x1bbd6b['id'];if(_0x5a54d8['query'][_0x8c75('0x2e')]){_0x304ead['where']=_[_0x8c75('0x49')](_0x304ead[_0x8c75('0x47')],{'$or':_['map'](_0x304ead[_0x8c75('0x42')],function(_0x2fb576){var _0x4a4ad2={};_0x4a4ad2[_0x2fb576]={'$like':'%'+_0x5a54d8[_0x8c75('0x3d')]['filter']+'%'};return _0x4a4ad2;})});}_0x304ead=_[_0x8c75('0x49')]({},_0x304ead,_0x5a54d8[_0x8c75('0x4b')]);return db[_0x8c75('0x6a')][_0x8c75('0x22')]({'where':_0x304ead['where']})['then'](function(_0x31161a){_0xaf1fe9[_0x8c75('0x22')]=_0x31161a;if(_0x5a54d8['query'][_0x8c75('0x4c')]){_0x304ead[_0x8c75('0x64')]=[{'all':!![]}];}return db[_0x8c75('0x6a')][_0x8c75('0x65')](_0x304ead);})[_0x8c75('0x28')](function(_0x41520a){_0xaf1fe9[_0x8c75('0x4d')]=_0x41520a;return _0xaf1fe9;});}})['then'](respondWithFilteredResult(_0x347baf,_0x304ead))['catch'](handleError(_0x347baf,null));};exports[_0x8c75('0x6b')]=function(_0x41168a,_0x100371,_0x2c5f3b){var _0x145ece={};var _0x4c7f56={};var _0x255ec7;var _0x51c56f;return db[_0x8c75('0x39')][_0x8c75('0x67')]({'where':{'id':_0x41168a['params']['id']}})[_0x8c75('0x28')](handleEntityNotFound(_0x100371,null))[_0x8c75('0x28')](function(_0x15f10f){if(_0x15f10f){_0x255ec7=_0x15f10f;_0x4c7f56[_0x8c75('0x3c')]=_[_0x8c75('0x3e')](db[_0x8c75('0x6c')][_0x8c75('0x58')]);_0x4c7f56[_0x8c75('0x3d')]=_[_0x8c75('0x3e')](_0x41168a[_0x8c75('0x3d')]);_0x4c7f56[_0x8c75('0x3f')]=_[_0x8c75('0x40')](_0x4c7f56[_0x8c75('0x3c')],_0x4c7f56[_0x8c75('0x3d')]);_0x145ece[_0x8c75('0x42')]=_[_0x8c75('0x40')](_0x4c7f56[_0x8c75('0x3c')],qs[_0x8c75('0x41')](_0x41168a[_0x8c75('0x3d')]['fields']));_0x145ece[_0x8c75('0x42')]=_0x145ece['attributes'][_0x8c75('0x59')]?_0x145ece['attributes']:_0x4c7f56['model'];_0x145ece[_0x8c75('0x61')]=qs[_0x8c75('0x46')](_0x41168a[_0x8c75('0x3d')][_0x8c75('0x46')]);_0x145ece[_0x8c75('0x47')]=qs['filters'](_[_0x8c75('0x48')](_0x41168a[_0x8c75('0x3d')],_0x4c7f56[_0x8c75('0x3f')]));if(_0x41168a['query'][_0x8c75('0x2e')]){_0x145ece['where']=_[_0x8c75('0x49')](_0x145ece[_0x8c75('0x47')],{'$or':_[_0x8c75('0x2f')](_0x145ece[_0x8c75('0x42')],function(_0x176871){var _0x16c203={};_0x16c203[_0x176871]={'$like':'%'+_0x41168a[_0x8c75('0x3d')]['filter']+'%'};return _0x16c203;})});}_0x145ece=_[_0x8c75('0x49')]({},_0x145ece,_0x41168a['options']);return _0x255ec7[_0x8c75('0x6b')](_0x145ece);}})[_0x8c75('0x28')](function(_0x5bf9d8){if(_0x5bf9d8){_0x51c56f=_0x5bf9d8[_0x8c75('0x59')];if(!_0x41168a['query'][_0x8c75('0x43')]('nolimit')){_0x145ece['limit']=qs[_0x8c75('0x45')](_0x41168a[_0x8c75('0x3d')]['limit']);_0x145ece[_0x8c75('0x23')]=qs[_0x8c75('0x23')](_0x41168a[_0x8c75('0x3d')][_0x8c75('0x23')]);}return _0x255ec7['getTeams'](_0x145ece);}})[_0x8c75('0x28')](function(_0x107b62){if(_0x107b62){return _0x107b62?{'count':_0x51c56f,'rows':_0x107b62}:null;}})[_0x8c75('0x28')](respondWithResult(_0x100371,null))[_0x8c75('0x50')](handleError(_0x100371,null));};exports[_0x8c75('0x6d')]=function(_0x12ef65,_0x2127f9,_0x16e3e8){var _0x25f6bb=_0x12ef65[_0x8c75('0x52')][_0x8c75('0x6e')];var _0x5c5edb=_['map'](_0x25f6bb,'id');return db[_0x8c75('0x6c')][_0x8c75('0x65')]({'where':{'id':_0x5c5edb},'attributes':['id'],'include':[{'model':db[_0x8c75('0x6f')],'as':_0x8c75('0x70'),'attributes':['id',_0x8c75('0x32'),_0x8c75('0x71'),'voicePause',_0x8c75('0x72')],'raw':!![]}]})[_0x8c75('0x28')](function(_0x1a03af){if(_0x1a03af){var _0x24b3f4=_[_0x8c75('0x73')](_0x1a03af,function(_0x2fe7da){var _0x52fc5d=_0x2fe7da[_0x8c75('0x29')]({'plain':!![]});_0x52fc5d[_0x8c75('0x70')]['forEach'](function(_0x51496e){_0x51496e[_0x8c75('0x74')]=_[_0x8c75('0x54')](_0x25f6bb,{'id':_0x52fc5d['id']})[_0x8c75('0x74')];});return _0x52fc5d['Agents'];});return db[_0x8c75('0x39')][_0x8c75('0x54')]({'where':{'id':_0x12ef65[_0x8c75('0x4f')]['id']}})[_0x8c75('0x28')](function(_0x4d1130){return db[_0x8c75('0x75')]['transaction'](function(_0x5c8ef1){return _0x4d1130['addTeams'](_0x5c5edb,{'transaction':_0x5c8ef1})['then'](function(){return BPromise[_0x8c75('0x76')](_0x24b3f4,function(_0x297e0d){return db[_0x8c75('0x77')][_0x8c75('0x78')]({'where':{'UserId':_0x297e0d['id'],'VoiceQueueId':_0x12ef65[_0x8c75('0x4f')]['id']},'defaults':{'penalty':_0x297e0d[_0x8c75('0x74')]},'transaction':_0x5c8ef1});});})['then'](function(){return BPromise[_0x8c75('0x76')](_[_0x8c75('0x2e')](_0x24b3f4,{'online':!![]}),function(_0x31223e){return db[_0x8c75('0x79')]['upsert']({'membername':_0x31223e[_0x8c75('0x32')],'UserId':_0x31223e['id'],'queue_name':_0x4d1130[_0x8c75('0x32')],'VoiceQueueId':_0x4d1130['id'],'interface':_[_0x8c75('0x7a')](_0x31223e['interface'])?util[_0x8c75('0x7b')]('SIP/%s',_0x31223e[_0x8c75('0x32')]):_0x31223e[_0x8c75('0x72')],'paused':_0x31223e[_0x8c75('0x7c')]||![],'penalty':_0x31223e[_0x8c75('0x74')]},{'transaction':_0x5c8ef1});});})[_0x8c75('0x28')](function(){_0x24b3f4[_0x8c75('0x7d')](function(_0x533b4a){socket[_0x8c75('0x7e')]('userVoiceQueue:save',{'UserId':_0x533b4a['id'],'VoiceQueueId':_0x4d1130['id']});});});});});}})[_0x8c75('0x28')](respondWithStatusCode(_0x2127f9,null))[_0x8c75('0x50')](handleError(_0x2127f9,null));};exports['removeTeams']=function(_0xef4cf,_0x229130,_0x31cc79){return db['Team'][_0x8c75('0x65')]({'where':{'id':_0xef4cf['query'][_0x8c75('0x7f')]},'attributes':['id'],'include':[{'model':db[_0x8c75('0x6f')],'as':_0x8c75('0x70'),'attributes':['id'],'raw':!![]}]})[_0x8c75('0x28')](handleEntityNotFound(_0x229130,null))[_0x8c75('0x28')](function(_0x1bda24){var _0x53d686=_['map'](_0x1bda24,'id');var _0x56eaa9=[];var _0x1eb98b=[];var _0x3f02b0=squel[_0x8c75('0x80')]();_0x3f02b0[_0x8c75('0x81')](_0x8c75('0x82'))[_0x8c75('0x83')]('team_has_voice_queues','tq')[_0x8c75('0x84')](_0x8c75('0x85'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8c75('0x47')](_0x8c75('0x86'),_0xef4cf['params']['id']);for(var _0x2ec5e2=0x0;_0x2ec5e2<_0x1bda24[_0x8c75('0x59')];_0x2ec5e2+=0x1){let _0x5052d9=_0x1bda24[_0x2ec5e2];for(var _0x145e15=0x0;_0x145e15<_0x5052d9[_0x8c75('0x70')][_0x8c75('0x59')];_0x145e15+=0x1){let _0x223df4=_0x5052d9['Agents'][_0x145e15];var _0x1b7426=_0x3f02b0[_0x8c75('0x87')]();_0x1b7426[_0x8c75('0x47')](_0x8c75('0x88'),_0x223df4['id']);_0x1eb98b[_0x8c75('0x89')](db[_0x8c75('0x75')][_0x8c75('0x3d')](_0x1b7426[_0x8c75('0x8a')](),{'type':db[_0x8c75('0x75')][_0x8c75('0x8b')][_0x8c75('0x8c')]})[_0x8c75('0x28')](function(_0x4a87df){if(_0x4a87df[_0x8c75('0x59')]===0x1){return _0x223df4['id'];}else{var _0x38e984=_['every'](_[_0x8c75('0x2f')](_0x4a87df,_0x8c75('0x8d')),function(_0x2c4d16){return _[_0x8c75('0x8e')](_0x53d686,_0x2c4d16);});if(_0x38e984){return _0x223df4['id'];}}}));}}return BPromise[_0x8c75('0x8f')](_0x1eb98b)[_0x8c75('0x28')](function(_0x277ba8){_0x56eaa9=_(_0x56eaa9)[_0x8c75('0x90')](_0x277ba8)[_0x8c75('0x91')]()['value']();return db[_0x8c75('0x39')][_0x8c75('0x54')]({'where':{'id':_0xef4cf[_0x8c75('0x4f')]['id']}})[_0x8c75('0x28')](function(_0x5b449c){return db[_0x8c75('0x75')]['transaction'](function(_0x48ade8){return _0x5b449c[_0x8c75('0x92')](_0xef4cf['query'][_0x8c75('0x7f')],{'transaction':_0x48ade8})[_0x8c75('0x28')](function(){if(!_[_0x8c75('0x93')](_0x56eaa9)){return _0x5b449c[_0x8c75('0x94')](_0x56eaa9,{'transaction':_0x48ade8})[_0x8c75('0x28')](function(){return db['UserVoiceQueueRt'][_0x8c75('0x34')]({'where':{'VoiceQueueId':_0xef4cf[_0x8c75('0x4f')]['id'],'UserId':_0x56eaa9},'transaction':_0x48ade8});});}})[_0x8c75('0x28')](function(){_0x56eaa9[_0x8c75('0x7d')](function(_0x587539){socket[_0x8c75('0x7e')](_0x8c75('0x95'),{'UserId':_0x587539,'VoiceQueueId':_0x5b449c['id']});});});});});});})[_0x8c75('0x28')](respondWithStatusCode(_0x229130,null))[_0x8c75('0x50')](handleError(_0x229130,null));};exports[_0x8c75('0x96')]=function(_0x2a13c3,_0x1ea6f8,_0x449fec){var _0x291994,_0x3746d1;return db[_0x8c75('0x39')][_0x8c75('0x54')]({'where':{'id':_0x2a13c3['params']['id']}})[_0x8c75('0x28')](handleEntityNotFound(_0x1ea6f8,null))[_0x8c75('0x28')](function(_0x5b2c11){if(_0x5b2c11){_0x3746d1=_0x5b2c11;return _0x5b2c11[_0x8c75('0x96')](_0x2a13c3['body'][_0x8c75('0x7f')],_[_0x8c75('0x5a')](_0x2a13c3['body'],[_0x8c75('0x7f'),'id'])||{})['spread'](function(_0x1100c3){for(var _0x542409=0x0;_0x542409<_0x2a13c3[_0x8c75('0x52')]['ids'][_0x8c75('0x59')];_0x542409+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':_0x2a13c3[_0x8c75('0x52')][_0x8c75('0x7f')][_0x542409],'VoiceQueueId':_0x2a13c3[_0x8c75('0x4f')]['id']});}return _0x1100c3;});}})['then'](function(_0x260dfe){_0x291994=_0x260dfe||[];if(_0x3746d1){return db[_0x8c75('0x6f')][_0x8c75('0x65')]({'where':{'id':_0x2a13c3[_0x8c75('0x52')][_0x8c75('0x7f')]},'attributes':['id',_0x8c75('0x32'),_0x8c75('0x71'),_0x8c75('0x7c'),_0x8c75('0x72')],'raw':!![]});}})['then'](function(_0x5c52ef){if(!_[_0x8c75('0x93')](_0x5c52ef)){var _0x49a37e=[];for(var _0x284bd9=0x0;_0x284bd9<_0x5c52ef[_0x8c75('0x59')];_0x284bd9++){if(_0x5c52ef[_0x284bd9][_0x8c75('0x71')]){_0x49a37e[_0x8c75('0x89')](db[_0x8c75('0x79')][_0x8c75('0x97')]({'membername':_0x5c52ef[_0x284bd9][_0x8c75('0x32')],'UserId':_0x5c52ef[_0x284bd9]['id'],'queue_name':_0x3746d1[_0x8c75('0x32')],'VoiceQueueId':_0x3746d1['id'],'interface':_[_0x8c75('0x7a')](_0x5c52ef[_0x284bd9][_0x8c75('0x72')])?util[_0x8c75('0x7b')]('SIP/%s',_0x5c52ef[_0x284bd9][_0x8c75('0x32')]):_0x5c52ef[_0x284bd9][_0x8c75('0x72')],'paused':_0x5c52ef[_0x284bd9][_0x8c75('0x7c')]||![],'penalty':_0x2a13c3[_0x8c75('0x52')][_0x8c75('0x74')]||0x0}));}}return BPromise[_0x8c75('0x8f')](_0x49a37e);}})[_0x8c75('0x28')](function(){return _0x291994;})[_0x8c75('0x28')](respondWithResult(_0x1ea6f8,null))[_0x8c75('0x50')](handleError(_0x1ea6f8,null));};exports['removeAgents']=function(_0x4bb11c,_0x1d9ef5,_0x3c7bb6){return db['VoiceQueue'][_0x8c75('0x54')]({'where':{'id':_0x4bb11c['params']['id']}})[_0x8c75('0x28')](handleEntityNotFound(_0x1d9ef5,null))['then'](function(_0x2aa103){if(_0x2aa103){return _0x2aa103[_0x8c75('0x94')](_0x4bb11c[_0x8c75('0x3d')][_0x8c75('0x7f')])[_0x8c75('0x28')](function(){if(_['isArray'](_0x4bb11c['query'][_0x8c75('0x7f')])){for(var _0x1dec22=0x0;_0x1dec22<_0x4bb11c[_0x8c75('0x3d')][_0x8c75('0x7f')][_0x8c75('0x59')];_0x1dec22+=0x1){socket[_0x8c75('0x7e')](_0x8c75('0x95'),{'UserId':Number(_0x4bb11c[_0x8c75('0x3d')][_0x8c75('0x7f')][_0x1dec22]),'VoiceQueueId':Number(_0x4bb11c[_0x8c75('0x4f')]['id'])});}}else{socket[_0x8c75('0x7e')](_0x8c75('0x95'),{'UserId':Number(_0x4bb11c[_0x8c75('0x3d')]['ids']),'VoiceQueueId':Number(_0x4bb11c[_0x8c75('0x4f')]['id'])});}});}})[_0x8c75('0x28')](function(_0x33fc46){return db['UserVoiceQueueRt'][_0x8c75('0x34')]({'where':{'VoiceQueueId':_0x4bb11c['params']['id'],'UserId':_0x4bb11c['query'][_0x8c75('0x7f')]}})['then'](function(){return _0x33fc46;});})[_0x8c75('0x28')](respondWithStatusCode(_0x1d9ef5,null))['catch'](handleError(_0x1d9ef5,null));};exports[_0x8c75('0x98')]=function(_0x5aa3d9,_0xe95bbb,_0x1b82da){var _0x2d3d4c={};var _0x1a4a50={};var _0x335414;var _0x2efc5c;return db[_0x8c75('0x39')][_0x8c75('0x67')]({'where':{'id':_0x5aa3d9[_0x8c75('0x4f')]['id']}})['then'](handleEntityNotFound(_0xe95bbb,null))[_0x8c75('0x28')](function(_0x3b37f0){if(_0x3b37f0){_0x335414=_0x3b37f0;_0x1a4a50[_0x8c75('0x3c')]=_['keys'](db[_0x8c75('0x6f')][_0x8c75('0x58')]);_0x1a4a50[_0x8c75('0x3d')]=_[_0x8c75('0x3e')](_0x5aa3d9[_0x8c75('0x3d')]);_0x1a4a50[_0x8c75('0x3f')]=_[_0x8c75('0x40')](_0x1a4a50[_0x8c75('0x3c')],_0x1a4a50[_0x8c75('0x3d')]);_0x2d3d4c[_0x8c75('0x42')]=_[_0x8c75('0x40')](_0x1a4a50[_0x8c75('0x3c')],qs[_0x8c75('0x41')](_0x5aa3d9[_0x8c75('0x3d')][_0x8c75('0x41')]));_0x2d3d4c[_0x8c75('0x42')]=_0x2d3d4c[_0x8c75('0x42')][_0x8c75('0x59')]?_0x2d3d4c[_0x8c75('0x42')]:_0x1a4a50['model'];_0x2d3d4c[_0x8c75('0x61')]=qs['sort'](_0x5aa3d9[_0x8c75('0x3d')][_0x8c75('0x46')]);_0x2d3d4c[_0x8c75('0x47')]=qs['filters'](_[_0x8c75('0x48')](_0x5aa3d9[_0x8c75('0x3d')],_0x1a4a50[_0x8c75('0x3f')]));if(_0x5aa3d9[_0x8c75('0x3d')][_0x8c75('0x2e')]){_0x2d3d4c[_0x8c75('0x47')]=_[_0x8c75('0x49')](_0x2d3d4c['where'],{'$or':_[_0x8c75('0x2f')](_0x2d3d4c[_0x8c75('0x42')],function(_0x3f4b47){var _0x213ac9={};_0x213ac9[_0x3f4b47]={'$like':'%'+_0x5aa3d9[_0x8c75('0x3d')][_0x8c75('0x2e')]+'%'};return _0x213ac9;})});}_0x2d3d4c=_['merge']({},_0x2d3d4c,_0x5aa3d9[_0x8c75('0x4b')]);return _0x335414[_0x8c75('0x98')](_0x2d3d4c);}})[_0x8c75('0x28')](function(_0x5b4b0c){if(_0x5b4b0c){_0x2efc5c=_0x5b4b0c[_0x8c75('0x59')];if(!_0x5aa3d9[_0x8c75('0x3d')]['hasOwnProperty'](_0x8c75('0x44'))){_0x2d3d4c[_0x8c75('0x45')]=qs[_0x8c75('0x45')](_0x5aa3d9[_0x8c75('0x3d')][_0x8c75('0x45')]);_0x2d3d4c[_0x8c75('0x23')]=qs[_0x8c75('0x23')](_0x5aa3d9[_0x8c75('0x3d')][_0x8c75('0x23')]);}return _0x335414[_0x8c75('0x98')](_0x2d3d4c);}})[_0x8c75('0x28')](function(_0xa67e9f){if(_0xa67e9f){return _0xa67e9f?{'count':_0x2efc5c,'rows':_0xa67e9f}:null;}})['then'](respondWithResult(_0xe95bbb,null))[_0x8c75('0x50')](handleError(_0xe95bbb,null));};exports['getMembers']=function(_0x296885,_0x1ebd32,_0x4e568d){var _0xbf2b2e={};var _0x347c71={};var _0x1af246;var _0x309163;return db[_0x8c75('0x39')][_0x8c75('0x67')]({'where':{'id':_0x296885['params']['id']}})[_0x8c75('0x28')](handleEntityNotFound(_0x1ebd32,null))[_0x8c75('0x28')](function(_0x4549a3){if(_0x4549a3){_0x1af246=_0x4549a3;_0x347c71[_0x8c75('0x3c')]=_['keys'](db[_0x8c75('0x79')]['rawAttributes']);_0x347c71[_0x8c75('0x3d')]=_[_0x8c75('0x3e')](_0x296885[_0x8c75('0x3d')]);_0x347c71[_0x8c75('0x3f')]=_['intersection'](_0x347c71[_0x8c75('0x3c')],_0x347c71['query']);_0xbf2b2e['attributes']=_[_0x8c75('0x40')](_0x347c71[_0x8c75('0x3c')],qs[_0x8c75('0x41')](_0x296885[_0x8c75('0x3d')][_0x8c75('0x41')]));_0xbf2b2e['attributes']=_0xbf2b2e[_0x8c75('0x42')][_0x8c75('0x59')]?_0xbf2b2e[_0x8c75('0x42')]:_0x347c71[_0x8c75('0x3c')];_0xbf2b2e[_0x8c75('0x61')]=qs['sort'](_0x296885[_0x8c75('0x3d')]['sort']);_0xbf2b2e[_0x8c75('0x47')]=qs[_0x8c75('0x3f')](_['pick'](_0x296885[_0x8c75('0x3d')],_0x347c71[_0x8c75('0x3f')]));if(_0x296885[_0x8c75('0x3d')][_0x8c75('0x2e')]){_0xbf2b2e[_0x8c75('0x47')]=_['merge'](_0xbf2b2e[_0x8c75('0x47')],{'$or':_['map'](_0xbf2b2e[_0x8c75('0x42')],function(_0xb2f440){var _0x4db2c8={};_0x4db2c8[_0xb2f440]={'$like':'%'+_0x296885[_0x8c75('0x3d')]['filter']+'%'};return _0x4db2c8;})});}_0xbf2b2e=_['merge']({},_0xbf2b2e,_0x296885['options']);return _0x1af246[_0x8c75('0x99')](_0xbf2b2e);}})['then'](function(_0x46bf2d){if(_0x46bf2d){_0x309163=_0x46bf2d[_0x8c75('0x59')];if(!_0x296885[_0x8c75('0x3d')]['hasOwnProperty']('nolimit')){_0xbf2b2e[_0x8c75('0x45')]=qs[_0x8c75('0x45')](_0x296885['query'][_0x8c75('0x45')]);_0xbf2b2e[_0x8c75('0x23')]=qs[_0x8c75('0x23')](_0x296885[_0x8c75('0x3d')][_0x8c75('0x23')]);}return _0x1af246[_0x8c75('0x99')](_0xbf2b2e);}})[_0x8c75('0x28')](function(_0x15a67a){return _0x15a67a?{'count':_0x309163,'rows':_0x15a67a}:null;})['then'](respondWithResult(_0x1ebd32,null))[_0x8c75('0x50')](handleError(_0x1ebd32,null));};exports[_0x8c75('0x9a')]=function(_0x3c4ede,_0x17281d,_0x582aa1){var _0x31429f={};var _0x1dad62={};var _0x45b8db;var _0x566ef4;return db['VoiceQueue'][_0x8c75('0x67')]({'where':{'id':_0x3c4ede[_0x8c75('0x4f')]['id']}})['then'](handleEntityNotFound(_0x17281d,null))[_0x8c75('0x28')](function(_0x512349){if(_0x512349){_0x45b8db=_0x512349;_0x1dad62[_0x8c75('0x3c')]=_['keys'](db[_0x8c75('0x9b')][_0x8c75('0x58')]);_0x1dad62[_0x8c75('0x3d')]=_[_0x8c75('0x3e')](_0x3c4ede['query']);_0x1dad62[_0x8c75('0x3f')]=_[_0x8c75('0x40')](_0x1dad62['model'],_0x1dad62[_0x8c75('0x3d')]);_0x31429f[_0x8c75('0x42')]=_['intersection'](_0x1dad62[_0x8c75('0x3c')],qs['fields'](_0x3c4ede['query']['fields']));_0x31429f[_0x8c75('0x42')]=_0x31429f[_0x8c75('0x42')]['length']?_0x31429f['attributes']:_0x1dad62[_0x8c75('0x3c')];_0x31429f[_0x8c75('0x61')]=qs[_0x8c75('0x46')](_0x3c4ede['query'][_0x8c75('0x46')]);_0x31429f[_0x8c75('0x47')]=qs['filters'](_[_0x8c75('0x48')](_0x3c4ede[_0x8c75('0x3d')],_0x1dad62['filters']));if(_0x3c4ede[_0x8c75('0x3d')]['filter']){_0x31429f['where']=_[_0x8c75('0x49')](_0x31429f[_0x8c75('0x47')],{'$or':_['map'](_0x31429f[_0x8c75('0x42')],function(_0x1e130b){var _0x60f18c={};_0x60f18c[_0x1e130b]={'$like':'%'+_0x3c4ede[_0x8c75('0x3d')][_0x8c75('0x2e')]+'%'};return _0x60f18c;})});}_0x31429f=_[_0x8c75('0x49')]({},_0x31429f,_0x3c4ede[_0x8c75('0x4b')]);return _0x45b8db[_0x8c75('0x9a')](_0x31429f);}})[_0x8c75('0x28')](function(_0x55d1fa){if(_0x55d1fa){_0x566ef4=_0x55d1fa[_0x8c75('0x59')];if(!_0x3c4ede[_0x8c75('0x3d')]['hasOwnProperty'](_0x8c75('0x44'))){_0x31429f[_0x8c75('0x45')]=qs[_0x8c75('0x45')](_0x3c4ede[_0x8c75('0x3d')][_0x8c75('0x45')]);_0x31429f[_0x8c75('0x23')]=qs[_0x8c75('0x23')](_0x3c4ede['query']['offset']);}return _0x45b8db[_0x8c75('0x9a')](_0x31429f);}})['then'](function(_0x2a7955){if(_0x2a7955){return _0x2a7955?{'count':_0x566ef4,'rows':_0x2a7955}:null;}})[_0x8c75('0x28')](respondWithResult(_0x17281d,null))[_0x8c75('0x50')](handleError(_0x17281d,null));};exports[_0x8c75('0x9c')]=function(_0x1d65c3,_0x27555e,_0xdc1aa8){var _0x3ecfd1,_0x21f0ee;return db[_0x8c75('0x39')][_0x8c75('0x54')]({'where':{'id':_0x1d65c3['params']['id']}})[_0x8c75('0x28')](handleEntityNotFound(_0x27555e,null))['then'](function(_0x5dde29){if(_0x5dde29){_0x21f0ee=_0x5dde29;return _0x5dde29[_0x8c75('0x9c')](_0x1d65c3[_0x8c75('0x52')][_0x8c75('0x7f')],_[_0x8c75('0x5a')](_0x1d65c3[_0x8c75('0x52')],[_0x8c75('0x7f'),'id'])||{});}return null;})['spread'](function(_0x3795ee){var _0x2206b1;_0x3ecfd1=_0x3795ee||[];var _0x59d945=[];if(_0x3795ee){for(var _0x49d7f3=0x0;_0x49d7f3<_0x3795ee[_0x8c75('0x59')];_0x49d7f3+=0x1){var _0x1793a1=_0x3795ee[_0x49d7f3]['get']({'plain':!![]});_0x21f0ee[_0x8c75('0x9d')]=_0x1d65c3[_0x8c75('0x52')][_0x8c75('0x9d')]?_0x1d65c3['body'][_0x8c75('0x9d')]:_0x21f0ee[_0x8c75('0x9d')];switch(_0x21f0ee[_0x8c75('0x9d')]){case _0x8c75('0x9e'):_0x2206b1=squel[_0x8c75('0x9f')]()[_0x8c75('0xa0')]('cm_hopper')[_0x8c75('0xa1')](['phone',_0x8c75('0xa2'),_0x8c75('0xa3'),_0x8c75('0xa4'),_0x8c75('0x62'),'createdAt','updatedAt'],squel[_0x8c75('0x80')]()['field']('phone',_0x8c75('0xa5'))['field'](_0x8c75('0xa6'),'scheduledAt')[_0x8c75('0x81')]('id',_0x8c75('0xa3'))['field'](_0x1793a1['CmListId']['toString'](),'ListId')[_0x8c75('0x81')](_0x1d65c3[_0x8c75('0x4f')]['id'][_0x8c75('0x8a')](),_0x8c75('0x62'))[_0x8c75('0x81')](_0x8c75('0xa6'),_0x8c75('0x5b'))[_0x8c75('0x81')](_0x8c75('0xa6'),_0x8c75('0x5c'))[_0x8c75('0x83')]('cm_contacts')['where'](_0x8c75('0xa7'))[_0x8c75('0x47')](_0x8c75('0xa8'),_0x1793a1[_0x8c75('0xa9')][_0x8c75('0x8a')]())[_0x8c75('0x47')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x8c75('0xaa'),squel[_0x8c75('0x80')]()[_0x8c75('0x81')]('COALESCE(calleridnum,\x27\x27)')[_0x8c75('0x83')]('cm_hopper_final')[_0x8c75('0x47')]('VoiceQueueId\x20=\x20?',_0x1d65c3[_0x8c75('0x4f')]['id']['toString']()))[_0x8c75('0x47')](_0x8c75('0xaa'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0x8c75('0x83')](_0x8c75('0xab'))['where'](_0x8c75('0x86'),_0x1d65c3[_0x8c75('0x4f')]['id'][_0x8c75('0x8a')]())))[_0x8c75('0x8a')]();break;case _0x8c75('0xac'):_0x2206b1=squel['insert']()['into'](_0x8c75('0xab'))['fromQuery']([_0x8c75('0xa5'),_0x8c75('0xa2'),'ContactId',_0x8c75('0xa4'),'VoiceQueueId',_0x8c75('0x5b'),_0x8c75('0x5c')],squel[_0x8c75('0x80')]()['field'](_0x8c75('0xa5'),_0x8c75('0xa5'))[_0x8c75('0x81')]('NOW()','scheduledAt')[_0x8c75('0x81')]('id',_0x8c75('0xa3'))[_0x8c75('0x81')](_0x1793a1['CmListId'][_0x8c75('0x8a')](),_0x8c75('0xa4'))['field'](_0x1d65c3[_0x8c75('0x4f')]['id']['toString'](),_0x8c75('0x62'))['field']('NOW()',_0x8c75('0x5b'))['field'](_0x8c75('0xa6'),_0x8c75('0x5c'))['from'](_0x8c75('0xad'))[_0x8c75('0x47')]('deletedAt\x20IS\x20NULL')[_0x8c75('0x47')](_0x8c75('0xa8'),_0x1793a1['CmListId'][_0x8c75('0x8a')]())[_0x8c75('0x47')](_0x8c75('0xae'))[_0x8c75('0x47')](_0x8c75('0xaa'),squel['select']()[_0x8c75('0x81')](_0x8c75('0xaf'))[_0x8c75('0x83')](_0x8c75('0xab'))['where'](_0x8c75('0x86'),_0x1d65c3[_0x8c75('0x4f')]['id']['toString']())))[_0x8c75('0x8a')]();break;default:_0x2206b1=squel[_0x8c75('0x9f')]()[_0x8c75('0xa0')]('cm_hopper')[_0x8c75('0xa1')]([_0x8c75('0xa5'),_0x8c75('0xa2'),_0x8c75('0xa3'),'ListId',_0x8c75('0x62'),_0x8c75('0x5b'),'updatedAt'],squel['select']()[_0x8c75('0x81')](_0x8c75('0xa5'),_0x8c75('0xa5'))[_0x8c75('0x81')](_0x8c75('0xa6'),'scheduledAt')[_0x8c75('0x81')]('id',_0x8c75('0xa3'))[_0x8c75('0x81')](_0x1793a1[_0x8c75('0xa9')][_0x8c75('0x8a')](),_0x8c75('0xa4'))['field'](_0x1d65c3[_0x8c75('0x4f')]['id'][_0x8c75('0x8a')](),_0x8c75('0x62'))[_0x8c75('0x81')](_0x8c75('0xa6'),_0x8c75('0x5b'))[_0x8c75('0x81')](_0x8c75('0xa6'),_0x8c75('0x5c'))['from'](_0x8c75('0xad'))['where'](_0x8c75('0xa7'))[_0x8c75('0x47')](_0x8c75('0xa8'),_0x1793a1[_0x8c75('0xa9')][_0x8c75('0x8a')]())[_0x8c75('0x47')](_0x8c75('0xae')))[_0x8c75('0x8a')]();}_0x59d945['push'](db['sequelize'][_0x8c75('0x3d')](_0x2206b1));}return BPromise[_0x8c75('0x8f')](_0x59d945);}})['then'](function(){return _0x3ecfd1;})[_0x8c75('0x28')](respondWithResult(_0x27555e,null))[_0x8c75('0x50')](handleError(_0x27555e,null));};exports[_0x8c75('0xb0')]=function(_0x248049,_0x4bcabf,_0x5042b7){return db['VoiceQueue'][_0x8c75('0x54')]({'where':{'id':_0x248049[_0x8c75('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4bcabf,null))[_0x8c75('0x28')](function(_0x907ce8){if(_0x907ce8){return _0x907ce8[_0x8c75('0xb0')](_0x248049[_0x8c75('0x3d')][_0x8c75('0x7f')]);}})[_0x8c75('0x28')](function(_0x435b58){if(_0x435b58){return db[_0x8c75('0x63')]['destroy']({'where':{'ListId':_0x248049[_0x8c75('0x3d')][_0x8c75('0x7f')],'VoiceQueueId':_0x248049['params']['id']}})['then'](function(){return _0x435b58;});}})['then'](respondWithStatusCode(_0x4bcabf,null))[_0x8c75('0x50')](handleError(_0x4bcabf,null));};exports[_0x8c75('0xb1')]=function(_0x564dbb,_0xdc863b,_0x2fa4a9){var _0x187728={};var _0x4f6af1={};var _0x128108;var _0x2ba3d0;return db[_0x8c75('0x39')]['findOne']({'where':{'id':_0x564dbb['params']['id']}})[_0x8c75('0x28')](handleEntityNotFound(_0xdc863b,null))[_0x8c75('0x28')](function(_0x1337b4){if(_0x1337b4){_0x128108=_0x1337b4;_0x4f6af1['model']=_[_0x8c75('0x3e')](db[_0x8c75('0x9b')][_0x8c75('0x58')]);_0x4f6af1[_0x8c75('0x3d')]=_[_0x8c75('0x3e')](_0x564dbb[_0x8c75('0x3d')]);_0x4f6af1[_0x8c75('0x3f')]=_[_0x8c75('0x40')](_0x4f6af1['model'],_0x4f6af1[_0x8c75('0x3d')]);_0x187728['attributes']=_[_0x8c75('0x40')](_0x4f6af1[_0x8c75('0x3c')],qs['fields'](_0x564dbb[_0x8c75('0x3d')][_0x8c75('0x41')]));_0x187728['attributes']=_0x187728[_0x8c75('0x42')][_0x8c75('0x59')]?_0x187728[_0x8c75('0x42')]:_0x4f6af1[_0x8c75('0x3c')];_0x187728['order']=qs['sort'](_0x564dbb['query']['sort']);_0x187728[_0x8c75('0x47')]=qs['filters'](_[_0x8c75('0x48')](_0x564dbb[_0x8c75('0x3d')],_0x4f6af1[_0x8c75('0x3f')]));if(_0x564dbb[_0x8c75('0x3d')]['filter']){_0x187728[_0x8c75('0x47')]=_[_0x8c75('0x49')](_0x187728[_0x8c75('0x47')],{'$or':_['map'](_0x187728[_0x8c75('0x42')],function(_0x8bf939){var _0x33fc67={};_0x33fc67[_0x8bf939]={'$like':'%'+_0x564dbb['query']['filter']+'%'};return _0x33fc67;})});}_0x187728=_[_0x8c75('0x49')]({},_0x187728,_0x564dbb[_0x8c75('0x4b')]);return _0x128108[_0x8c75('0xb1')](_0x187728);}})[_0x8c75('0x28')](function(_0x409f36){if(_0x409f36){_0x2ba3d0=_0x409f36[_0x8c75('0x59')];if(!_0x564dbb[_0x8c75('0x3d')]['hasOwnProperty'](_0x8c75('0x44'))){_0x187728['limit']=qs[_0x8c75('0x45')](_0x564dbb[_0x8c75('0x3d')][_0x8c75('0x45')]);_0x187728[_0x8c75('0x23')]=qs[_0x8c75('0x23')](_0x564dbb['query']['offset']);}return _0x128108[_0x8c75('0xb1')](_0x187728);}})[_0x8c75('0x28')](function(_0x148d6b){if(_0x148d6b){return _0x148d6b?{'count':_0x2ba3d0,'rows':_0x148d6b}:null;}})[_0x8c75('0x28')](respondWithResult(_0xdc863b,null))[_0x8c75('0x50')](handleError(_0xdc863b,null));};exports['addBlackLists']=function(_0x4d7625,_0x5a5021,_0x4024bf){var _0x5e03d1,_0x1f380b;return db['VoiceQueue'][_0x8c75('0x54')]({'where':{'id':_0x4d7625[_0x8c75('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5a5021,null))[_0x8c75('0x28')](function(_0x517344){if(_0x517344){_0x1f380b=_0x517344;return _0x517344[_0x8c75('0xb2')](_0x4d7625[_0x8c75('0x52')]['ids'],_[_0x8c75('0x5a')](_0x4d7625[_0x8c75('0x52')],[_0x8c75('0x7f'),'id'])||{});}return null;})['spread'](function(_0x27ffaf){var _0x1a73b8;_0x5e03d1=_0x27ffaf||[];var _0x52789c=[];if(_0x27ffaf){for(var _0x1ffa4d=0x0;_0x1ffa4d<_0x27ffaf['length'];_0x1ffa4d+=0x1){var _0xf87f1d=_0x27ffaf[_0x1ffa4d]['get']({'plain':!![]});_0x1a73b8=squel[_0x8c75('0x9f')]()[_0x8c75('0xa0')](_0x8c75('0xb3'))[_0x8c75('0xa1')]([_0x8c75('0xa5'),_0x8c75('0xa3'),_0x8c75('0xa4'),'VoiceQueueId',_0x8c75('0x5b'),_0x8c75('0x5c')],squel[_0x8c75('0x80')]()['field'](_0x8c75('0xa5'),'phone')[_0x8c75('0x81')]('id',_0x8c75('0xa3'))[_0x8c75('0x81')](_0xf87f1d[_0x8c75('0xa9')][_0x8c75('0x8a')](),_0x8c75('0xa4'))[_0x8c75('0x81')](_0x4d7625[_0x8c75('0x4f')]['id'][_0x8c75('0x8a')](),_0x8c75('0x62'))[_0x8c75('0x81')]('NOW()',_0x8c75('0x5b'))['field'](_0x8c75('0xa6'),_0x8c75('0x5c'))['from'](_0x8c75('0xad'))[_0x8c75('0x47')](_0x8c75('0xa7'))[_0x8c75('0x47')](_0x8c75('0xa8'),_0xf87f1d[_0x8c75('0xa9')]['toString']())[_0x8c75('0x47')](_0x8c75('0xae')))[_0x8c75('0x8a')]();_0x52789c['push'](db[_0x8c75('0x75')][_0x8c75('0x3d')](_0x1a73b8));}return BPromise[_0x8c75('0x8f')](_0x52789c);}})[_0x8c75('0x28')](function(){return _0x5e03d1;})[_0x8c75('0x28')](respondWithResult(_0x5a5021,null))[_0x8c75('0x50')](handleError(_0x5a5021,null));};exports['removeBlackLists']=function(_0xf047ba,_0xebc7bd,_0x5b50ef){return db['VoiceQueue']['find']({'where':{'id':_0xf047ba[_0x8c75('0x4f')]['id']}})[_0x8c75('0x28')](handleEntityNotFound(_0xebc7bd,null))[_0x8c75('0x28')](function(_0x471bba){if(_0x471bba){return _0x471bba['removeBlackLists'](_0xf047ba[_0x8c75('0x3d')][_0x8c75('0x7f')]);}})[_0x8c75('0x28')](function(_0x36172b){if(_0x36172b){return db['CmHopperBlack'][_0x8c75('0x34')]({'where':{'ListId':_0xf047ba['query'][_0x8c75('0x7f')],'VoiceQueueId':_0xf047ba[_0x8c75('0x4f')]['id']}})['then'](function(){return _0x36172b;});}})[_0x8c75('0x28')](respondWithStatusCode(_0xebc7bd,null))['catch'](handleError(_0xebc7bd,null));}; \ No newline at end of file +var _0x95a1=['pick','where','merge','VIRTUAL','options','VoiceQueue','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','destroy','getHoppers','findOne','CmHopper','nolimit','getHopperHistories','CmHopperHistory','getHopperFinals','VoiceQueueId','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','penalty','sequelize','UserVoiceQueue','each','UserVoiceQueueRt','upsert','isNil','SIP/%s','forEach','emit','removeTeams','ids','select','field','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','union','compact','transaction','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','isArray','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','NOW()','CmListId','ListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','cm_hopper','onlyIfOpen','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','end','status','json','count','offset','set','Content-Range','apply','reject','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','map','value','includes','type','find','UserProfileResource','sendStatus','error','name','send','index','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort'];(function(_0x5535fb,_0x185c3d){var _0x3bee3c=function(_0x194863){while(--_0x194863){_0x5535fb['push'](_0x5535fb['shift']());}};_0x3bee3c(++_0x185c3d);}(_0x95a1,0x129));var _0x195a=function(_0x531ecf,_0x3d927f){_0x531ecf=_0x531ecf-0x0;var _0x34ae40=_0x95a1[_0x531ecf];return _0x34ae40;};'use strict';var pdf=require(_0x195a('0x0'));var emlformat=require(_0x195a('0x1'));var rimraf=require(_0x195a('0x2'));var zipdir=require(_0x195a('0x3'));var jsonpatch=require(_0x195a('0x4'));var rp=require(_0x195a('0x5'));var moment=require('moment');var BPromise=require(_0x195a('0x6'));var Mustache=require(_0x195a('0x7'));var util=require(_0x195a('0x8'));var path=require(_0x195a('0x9'));var sox=require(_0x195a('0xa'));var csv=require(_0x195a('0xb'));var ejs=require(_0x195a('0xc'));var fs=require('fs');var _=require(_0x195a('0xd'));var squel=require(_0x195a('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x195a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x195a('0x10'));var Papa=require('papaparse');var Redis=require(_0x195a('0x11'));var authService=require(_0x195a('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x195a('0x13'));var logger=require(_0x195a('0x14'))(_0x195a('0x15'));var utils=require(_0x195a('0x16'));var config=require(_0x195a('0x17'));var db=require(_0x195a('0x18'))['db'];config[_0x195a('0x19')]=_[_0x195a('0x1a')](config[_0x195a('0x19')],{'host':_0x195a('0x1b'),'port':0x18eb});var socket=require(_0x195a('0x1c'))(new Redis(config[_0x195a('0x19')]));require(_0x195a('0x1d'))[_0x195a('0x1e')](socket);function respondWithStatusCode(_0x4e34a8,_0x532598){_0x532598=_0x532598||0xcc;return function(_0x151490){if(_0x151490){return _0x4e34a8['sendStatus'](_0x532598);}return _0x4e34a8['status'](_0x532598)[_0x195a('0x1f')]();};}function respondWithResult(_0x384c8a,_0x2f0b63){_0x2f0b63=_0x2f0b63||0xc8;return function(_0x55835f){if(_0x55835f){return _0x384c8a[_0x195a('0x20')](_0x2f0b63)[_0x195a('0x21')](_0x55835f);}};}function respondWithFilteredResult(_0x2d20fd,_0x8a51bc){return function(_0x59444d){if(_0x59444d){var _0xf6a432=_0x59444d[_0x195a('0x22')],_0x8a6743=_0x8a51bc[_0x195a('0x23')],_0x22761a=_0x8a51bc[_0x195a('0x23')]+_0x8a51bc['limit'],_0x11cb36;if(_0x22761a>=_0xf6a432){_0x22761a=_0xf6a432;_0x11cb36=0xc8;}else{_0x11cb36=0xce;}_0x2d20fd['status'](_0x11cb36);return _0x2d20fd[_0x195a('0x24')](_0x195a('0x25'),_0x8a6743+'-'+_0x22761a+'/'+_0xf6a432)[_0x195a('0x21')](_0x59444d);}return null;};}function patchUpdates(_0x74c9db){return function(_0x82e9e2){try{jsonpatch[_0x195a('0x26')](_0x82e9e2,_0x74c9db,!![]);}catch(_0x5dc183){return BPromise[_0x195a('0x27')](_0x5dc183);}return _0x82e9e2['save']();};}function saveUpdates(_0xef6d6,_0x548b0f){return function(_0x282e1b){if(_0x282e1b){return _0x282e1b[_0x195a('0x28')](_0xef6d6)['then'](function(_0x1149c1){return _0x1149c1;});}return null;};}function removeEntity(_0x7c8498,_0x5b5c53){return function(_0x3226f7){if(_0x3226f7){return _0x3226f7['destroy']()[_0x195a('0x29')](function(){var _0x3bce99=_0x3226f7[_0x195a('0x2a')]({'plain':!![]});var _0x850e8=[{'name':_0x195a('0x2b'),'value':_0x195a('0x2c'),'ignore':![]},{'name':_0x195a('0x2d'),'value':_0x195a('0x2e'),'ignore':![]}];var _0x6076c8=_(_0x850e8)[_0x195a('0x2f')]('ignore')[_0x195a('0x30')](_0x195a('0x31'))[_0x195a('0x31')]();if(_[_0x195a('0x32')](_0x6076c8,_0x3bce99[_0x195a('0x33')])){return;}var _0xc25838=_[_0x195a('0x34')](_0x850e8,[_0x195a('0x31'),_0x3bce99['type']])['name'];return db[_0x195a('0x35')]['destroy']({'where':{'type':_0xc25838,'resourceId':_0x3bce99['id']}})[_0x195a('0x29')](function(){return _0x3226f7;});})['then'](function(){_0x7c8498[_0x195a('0x20')](0xcc)[_0x195a('0x1f')]();});}};}function handleEntityNotFound(_0x4bf330,_0x3c7704){return function(_0x55839e){if(!_0x55839e){_0x4bf330[_0x195a('0x36')](0x194);}return _0x55839e;};}function handleError(_0x4eb7a3,_0x5ddb9e){_0x5ddb9e=_0x5ddb9e||0x1f4;return function(_0x34cf5a){logger[_0x195a('0x37')](_0x34cf5a['stack']);if(_0x34cf5a['name']){delete _0x34cf5a[_0x195a('0x38')];}_0x4eb7a3[_0x195a('0x20')](_0x5ddb9e)[_0x195a('0x39')](_0x34cf5a);};}exports[_0x195a('0x3a')]=function(_0x16a829,_0x456999){var _0x2a38b0={},_0x592a8a={},_0x5d6ef9={'count':0x0,'rows':[]};var _0x14248a=_[_0x195a('0x30')](db['VoiceQueue']['rawAttributes'],function(_0x39356d){return{'name':_0x39356d[_0x195a('0x3b')],'type':_0x39356d[_0x195a('0x33')][_0x195a('0x3c')]};});_0x592a8a[_0x195a('0x3d')]=_[_0x195a('0x30')](_0x14248a,'name');_0x592a8a[_0x195a('0x3e')]=_[_0x195a('0x3f')](_0x16a829['query']);_0x592a8a[_0x195a('0x40')]=_['intersection'](_0x592a8a[_0x195a('0x3d')],_0x592a8a[_0x195a('0x3e')]);_0x2a38b0[_0x195a('0x41')]=_[_0x195a('0x42')](_0x592a8a[_0x195a('0x3d')],qs[_0x195a('0x43')](_0x16a829['query']['fields']));_0x2a38b0[_0x195a('0x41')]=_0x2a38b0[_0x195a('0x41')][_0x195a('0x44')]?_0x2a38b0[_0x195a('0x41')]:_0x592a8a['model'];if(!_0x16a829[_0x195a('0x3e')][_0x195a('0x45')]('nolimit')){_0x2a38b0[_0x195a('0x46')]=qs[_0x195a('0x46')](_0x16a829[_0x195a('0x3e')]['limit']);_0x2a38b0['offset']=qs['offset'](_0x16a829[_0x195a('0x3e')][_0x195a('0x23')]);}_0x2a38b0[_0x195a('0x47')]=qs[_0x195a('0x48')](_0x16a829[_0x195a('0x3e')][_0x195a('0x48')]);_0x2a38b0['where']=qs[_0x195a('0x40')](_[_0x195a('0x49')](_0x16a829[_0x195a('0x3e')],_0x592a8a[_0x195a('0x40')]),_0x14248a);if(_0x16a829[_0x195a('0x3e')]['filter']){_0x2a38b0[_0x195a('0x4a')]=_[_0x195a('0x4b')](_0x2a38b0[_0x195a('0x4a')],{'$or':_[_0x195a('0x30')](_0x14248a,function(_0x3d8aca){if(_0x3d8aca[_0x195a('0x33')]!==_0x195a('0x4c')){var _0x11f081={};_0x11f081[_0x3d8aca[_0x195a('0x38')]]={'$like':'%'+_0x16a829[_0x195a('0x3e')][_0x195a('0x2f')]+'%'};return _0x11f081;}})});}_0x2a38b0=_['merge']({},_0x2a38b0,_0x16a829[_0x195a('0x4d')]);var _0x1f2e21={'where':_0x2a38b0[_0x195a('0x4a')]};return db[_0x195a('0x4e')][_0x195a('0x22')](_0x1f2e21)[_0x195a('0x29')](function(_0x51d665){_0x5d6ef9[_0x195a('0x22')]=_0x51d665;if(_0x16a829['query'][_0x195a('0x4f')]){_0x2a38b0[_0x195a('0x50')]=[{'all':!![]}];}return db['VoiceQueue'][_0x195a('0x51')](_0x2a38b0);})[_0x195a('0x29')](function(_0x4d3260){_0x5d6ef9[_0x195a('0x52')]=_0x4d3260;return _0x5d6ef9;})[_0x195a('0x29')](respondWithFilteredResult(_0x456999,_0x2a38b0))[_0x195a('0x53')](handleError(_0x456999,null));};exports[_0x195a('0x54')]=function(_0x1b6684,_0x262da7){var _0x5b48dc={'raw':![],'where':{'id':_0x1b6684[_0x195a('0x55')]['id']}},_0xdfc8f8={};_0xdfc8f8[_0x195a('0x3d')]=_['keys'](db[_0x195a('0x4e')][_0x195a('0x56')]);_0xdfc8f8[_0x195a('0x3e')]=_['keys'](_0x1b6684['query']);_0xdfc8f8[_0x195a('0x40')]=_['intersection'](_0xdfc8f8['model'],_0xdfc8f8[_0x195a('0x3e')]);_0x5b48dc[_0x195a('0x41')]=_[_0x195a('0x42')](_0xdfc8f8[_0x195a('0x3d')],qs['fields'](_0x1b6684['query'][_0x195a('0x43')]));_0x5b48dc[_0x195a('0x41')]=_0x5b48dc[_0x195a('0x41')][_0x195a('0x44')]?_0x5b48dc['attributes']:_0xdfc8f8[_0x195a('0x3d')];if(_0x1b6684['query']['includeAll']){_0x5b48dc[_0x195a('0x50')]=[{'all':!![]}];}_0x5b48dc=_[_0x195a('0x4b')]({},_0x5b48dc,_0x1b6684[_0x195a('0x4d')]);return db[_0x195a('0x4e')]['find'](_0x5b48dc)[_0x195a('0x29')](handleEntityNotFound(_0x262da7,null))[_0x195a('0x29')](respondWithResult(_0x262da7,null))[_0x195a('0x53')](handleError(_0x262da7,null));};exports[_0x195a('0x57')]=function(_0x1c314c,_0xb3a96e){return db[_0x195a('0x4e')]['create'](_0x1c314c['body'],{})[_0x195a('0x29')](function(_0x8fea5){var _0x1eb3b7=_0x1c314c['user']['get']({'plain':!![]});if(!_0x1eb3b7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1eb3b7[_0x195a('0x58')]==='user'){var _0x4397d5=_0x8fea5[_0x195a('0x2a')]({'plain':!![]});var _0x1ee12f=[{'name':_0x195a('0x2b'),'value':'inbound'},{'name':_0x195a('0x2d'),'value':_0x195a('0x2e')}];var _0x57647a=_[_0x195a('0x34')](_0x1ee12f,['value',_0x4397d5[_0x195a('0x33')]])['name'];return db['UserProfileSection'][_0x195a('0x34')]({'where':{'name':_0x57647a,'userProfileId':_0x1eb3b7[_0x195a('0x59')]},'raw':!![]})[_0x195a('0x29')](function(_0x1bade1){if(_0x1bade1&&_0x1bade1[_0x195a('0x5a')]===0x0){return db[_0x195a('0x35')][_0x195a('0x57')]({'name':_0x4397d5[_0x195a('0x38')],'resourceId':_0x4397d5['id'],'type':_0x1bade1['name'],'sectionId':_0x1bade1['id']},{})[_0x195a('0x29')](function(){return _0x8fea5;});}else{return _0x8fea5;}})[_0x195a('0x53')](function(_0x38a831){logger[_0x195a('0x37')](_0x195a('0x5b'),_0x38a831);throw _0x38a831;});}return _0x8fea5;})[_0x195a('0x29')](respondWithResult(_0xb3a96e,0xc9))['catch'](handleError(_0xb3a96e,null));};exports[_0x195a('0x5c')]=function(_0x29eb21,_0x1c7f5c){var _0x5c4d4d={'where':{'id':_0x29eb21[_0x195a('0x55')]['id']}},_0x50ddaf={};_0x50ddaf['model']=_[_0x195a('0x3f')](db[_0x195a('0x4e')][_0x195a('0x56')]);_0x5c4d4d['attributes']=_[_0x195a('0x42')](_0x50ddaf[_0x195a('0x3d')],qs['fields'](_0x29eb21[_0x195a('0x3e')]['fields']));_0x5c4d4d[_0x195a('0x41')]=_0x5c4d4d['attributes'][_0x195a('0x44')]?_0x5c4d4d['attributes']:_0x50ddaf['model'];if(_0x29eb21[_0x195a('0x3e')]['includeAll']){_0x5c4d4d[_0x195a('0x50')]=[{'all':!![]}];}_0x5c4d4d=_['merge']({},_0x5c4d4d,_0x29eb21[_0x195a('0x4d')]);return db['VoiceQueue']['find'](_0x5c4d4d)[_0x195a('0x29')](handleEntityNotFound(_0x1c7f5c,null))[_0x195a('0x29')](function(_0x2794ce){if(_0x2794ce){var _0x2d3b44=_0x2794ce[_0x195a('0x2a')]({'plain':!![]});_0x2d3b44=qs['omit'](_0x2d3b44,['id',_0x195a('0x5d'),_0x195a('0x5e')]);_0x29eb21['body']=_[_0x195a('0x5f')](_0x29eb21[_0x195a('0x60')],['id',_0x195a('0x5d'),_0x195a('0x5e')]);return db[_0x195a('0x4e')]['create'](_[_0x195a('0x4b')](_0x2d3b44,_0x29eb21[_0x195a('0x60')]),{'include':_0x29eb21[_0x195a('0x3e')][_0x195a('0x4f')]?[{'all':!![]}]:undefined})[_0x195a('0x29')](function(_0x69cba9){var _0x369a08=_0x29eb21[_0x195a('0x61')][_0x195a('0x2a')]({'plain':!![]});if(!_0x369a08)throw new Error(_0x195a('0x62'));if(_0x369a08[_0x195a('0x58')]===_0x195a('0x61')){var _0x48bbfe=_0x69cba9[_0x195a('0x2a')]({'plain':!![]});var _0x2cfb00=[{'name':_0x195a('0x2b'),'value':'inbound'},{'name':'QueueCampaigns','value':'outbound'}];var _0x3cf43d=_[_0x195a('0x34')](_0x2cfb00,[_0x195a('0x31'),_0x48bbfe['type']])['name'];return db['UserProfileSection']['find']({'where':{'name':_0x3cf43d,'userProfileId':_0x369a08[_0x195a('0x59')]},'raw':!![]})['then'](function(_0x236957){if(_0x236957&&_0x236957[_0x195a('0x5a')]===0x0){return db[_0x195a('0x35')][_0x195a('0x57')]({'name':_0x48bbfe[_0x195a('0x38')],'resourceId':_0x48bbfe['id'],'type':_0x236957[_0x195a('0x38')],'sectionId':_0x236957['id']},{})['then'](function(){return _0x69cba9;});}else{return _0x69cba9;}})['catch'](function(_0x4e2520){logger[_0x195a('0x37')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e2520);throw _0x4e2520;});}return _0x69cba9;});}})[_0x195a('0x29')](respondWithResult(_0x1c7f5c,0xc9))['catch'](handleError(_0x1c7f5c,null));};exports[_0x195a('0x28')]=function(_0x5c0349,_0x210e63){if(_0x5c0349[_0x195a('0x60')]['id']){delete _0x5c0349['body']['id'];}return db[_0x195a('0x4e')][_0x195a('0x34')]({'where':{'id':_0x5c0349[_0x195a('0x55')]['id']}})[_0x195a('0x29')](handleEntityNotFound(_0x210e63,null))['then'](saveUpdates(_0x5c0349['body'],null))[_0x195a('0x29')](respondWithResult(_0x210e63,null))[_0x195a('0x53')](handleError(_0x210e63,null));};exports[_0x195a('0x63')]=function(_0x2d80a9,_0x18d010){return db['VoiceQueue'][_0x195a('0x34')]({'where':{'id':_0x2d80a9['params']['id']}})['then'](handleEntityNotFound(_0x18d010,null))[_0x195a('0x29')](removeEntity(_0x18d010,null))[_0x195a('0x53')](handleError(_0x18d010,null));};exports[_0x195a('0x64')]=function(_0x31fe01,_0x11746b,_0x19833c){var _0x347681={'raw':![],'where':{}};var _0x18234d={};var _0xbaff1c={'count':0x0,'rows':[]};return db[_0x195a('0x4e')][_0x195a('0x65')]({'where':{'id':_0x31fe01[_0x195a('0x55')]['id']}})[_0x195a('0x29')](handleEntityNotFound(_0x11746b,null))[_0x195a('0x29')](function(_0x5f4853){if(_0x5f4853){_0x18234d[_0x195a('0x3d')]=_[_0x195a('0x3f')](db[_0x195a('0x66')]['rawAttributes']);_0x18234d[_0x195a('0x3e')]=_[_0x195a('0x3f')](_0x31fe01[_0x195a('0x3e')]);_0x18234d['filters']=_[_0x195a('0x42')](_0x18234d['model'],_0x18234d[_0x195a('0x3e')]);_0x347681['attributes']=_[_0x195a('0x42')](_0x18234d[_0x195a('0x3d')],qs[_0x195a('0x43')](_0x31fe01[_0x195a('0x3e')][_0x195a('0x43')]));_0x347681[_0x195a('0x41')]=_0x347681[_0x195a('0x41')][_0x195a('0x44')]?_0x347681[_0x195a('0x41')]:_0x18234d[_0x195a('0x3d')];if(!_0x31fe01['query']['hasOwnProperty'](_0x195a('0x67'))){_0x347681['limit']=qs['limit'](_0x31fe01[_0x195a('0x3e')][_0x195a('0x46')]);_0x347681[_0x195a('0x23')]=qs['offset'](_0x31fe01[_0x195a('0x3e')]['offset']);}_0x347681[_0x195a('0x47')]=qs[_0x195a('0x48')](_0x31fe01['query'][_0x195a('0x48')]);_0x347681[_0x195a('0x4a')]=qs['filters'](_[_0x195a('0x49')](_0x31fe01[_0x195a('0x3e')],_0x18234d['filters']));_0x347681['where']['VoiceQueueId']=_0x5f4853['id'];if(_0x31fe01[_0x195a('0x3e')][_0x195a('0x2f')]){_0x347681[_0x195a('0x4a')]=_[_0x195a('0x4b')](_0x347681['where'],{'$or':_[_0x195a('0x30')](_0x347681[_0x195a('0x41')],function(_0x3a12a6){var _0x407dfe={};_0x407dfe[_0x3a12a6]={'$like':'%'+_0x31fe01[_0x195a('0x3e')][_0x195a('0x2f')]+'%'};return _0x407dfe;})});}_0x347681=_['merge']({},_0x347681,_0x31fe01[_0x195a('0x4d')]);return db[_0x195a('0x66')][_0x195a('0x22')]({'where':_0x347681[_0x195a('0x4a')]})['then'](function(_0x5eaf5d){_0xbaff1c['count']=_0x5eaf5d;if(_0x31fe01[_0x195a('0x3e')][_0x195a('0x4f')]){_0x347681[_0x195a('0x50')]=[{'all':!![]}];}return db['CmHopper'][_0x195a('0x51')](_0x347681);})[_0x195a('0x29')](function(_0x1e2428){_0xbaff1c[_0x195a('0x52')]=_0x1e2428;return _0xbaff1c;});}})[_0x195a('0x29')](respondWithFilteredResult(_0x11746b,_0x347681))[_0x195a('0x53')](handleError(_0x11746b,null));};exports[_0x195a('0x68')]=function(_0x3977b0,_0x1d078f,_0x374a4b){var _0x1a57e5={'raw':!![],'where':{}};var _0x14567a={};var _0x671294={'count':0x0,'rows':[]};return db[_0x195a('0x4e')][_0x195a('0x65')]({'where':{'id':_0x3977b0[_0x195a('0x55')]['id']}})[_0x195a('0x29')](handleEntityNotFound(_0x1d078f,null))[_0x195a('0x29')](function(_0x45440f){if(_0x45440f){_0x14567a['model']=_[_0x195a('0x3f')](db[_0x195a('0x69')][_0x195a('0x56')]);_0x14567a[_0x195a('0x3e')]=_['keys'](_0x3977b0[_0x195a('0x3e')]);_0x14567a[_0x195a('0x40')]=_[_0x195a('0x42')](_0x14567a['model'],_0x14567a[_0x195a('0x3e')]);_0x1a57e5[_0x195a('0x41')]=_['intersection'](_0x14567a['model'],qs[_0x195a('0x43')](_0x3977b0[_0x195a('0x3e')][_0x195a('0x43')]));_0x1a57e5[_0x195a('0x41')]=_0x1a57e5[_0x195a('0x41')]['length']?_0x1a57e5['attributes']:_0x14567a[_0x195a('0x3d')];if(!_0x3977b0[_0x195a('0x3e')]['hasOwnProperty'](_0x195a('0x67'))){_0x1a57e5[_0x195a('0x46')]=qs[_0x195a('0x46')](_0x3977b0[_0x195a('0x3e')][_0x195a('0x46')]);_0x1a57e5[_0x195a('0x23')]=qs[_0x195a('0x23')](_0x3977b0[_0x195a('0x3e')][_0x195a('0x23')]);}_0x1a57e5['order']=qs['sort'](_0x3977b0[_0x195a('0x3e')]['sort']);_0x1a57e5[_0x195a('0x4a')]=qs[_0x195a('0x40')](_[_0x195a('0x49')](_0x3977b0['query'],_0x14567a[_0x195a('0x40')]));_0x1a57e5[_0x195a('0x4a')]['VoiceQueueId']=_0x45440f['id'];if(_0x3977b0[_0x195a('0x3e')][_0x195a('0x2f')]){_0x1a57e5['where']=_['merge'](_0x1a57e5[_0x195a('0x4a')],{'$or':_[_0x195a('0x30')](_0x1a57e5[_0x195a('0x41')],function(_0x3c05aa){var _0x92e8a8={};_0x92e8a8[_0x3c05aa]={'$like':'%'+_0x3977b0[_0x195a('0x3e')][_0x195a('0x2f')]+'%'};return _0x92e8a8;})});}_0x1a57e5=_[_0x195a('0x4b')]({},_0x1a57e5,_0x3977b0[_0x195a('0x4d')]);return db['CmHopperHistory'][_0x195a('0x22')]({'where':_0x1a57e5[_0x195a('0x4a')]})[_0x195a('0x29')](function(_0x292e94){_0x671294[_0x195a('0x22')]=_0x292e94;if(_0x3977b0[_0x195a('0x3e')][_0x195a('0x4f')]){_0x1a57e5[_0x195a('0x50')]=[{'all':!![]}];}return db[_0x195a('0x69')][_0x195a('0x51')](_0x1a57e5);})['then'](function(_0xddc613){_0x671294['rows']=_0xddc613;return _0x671294;});}})[_0x195a('0x29')](respondWithFilteredResult(_0x1d078f,_0x1a57e5))[_0x195a('0x53')](handleError(_0x1d078f,null));};exports[_0x195a('0x6a')]=function(_0x2741a2,_0x4ff597,_0xaf0f39){var _0x4e3565={'raw':!![],'where':{}};var _0x39f73b={};var _0x263ee4={'count':0x0,'rows':[]};return db[_0x195a('0x4e')][_0x195a('0x65')]({'where':{'id':_0x2741a2[_0x195a('0x55')]['id']}})[_0x195a('0x29')](handleEntityNotFound(_0x4ff597,null))[_0x195a('0x29')](function(_0x3e2d6a){if(_0x3e2d6a){_0x39f73b['model']=_[_0x195a('0x3f')](db['CmHopperFinal'][_0x195a('0x56')]);_0x39f73b['query']=_[_0x195a('0x3f')](_0x2741a2[_0x195a('0x3e')]);_0x39f73b[_0x195a('0x40')]=_['intersection'](_0x39f73b[_0x195a('0x3d')],_0x39f73b['query']);_0x4e3565[_0x195a('0x41')]=_[_0x195a('0x42')](_0x39f73b[_0x195a('0x3d')],qs[_0x195a('0x43')](_0x2741a2[_0x195a('0x3e')][_0x195a('0x43')]));_0x4e3565[_0x195a('0x41')]=_0x4e3565[_0x195a('0x41')][_0x195a('0x44')]?_0x4e3565['attributes']:_0x39f73b[_0x195a('0x3d')];if(!_0x2741a2[_0x195a('0x3e')][_0x195a('0x45')](_0x195a('0x67'))){_0x4e3565[_0x195a('0x46')]=qs['limit'](_0x2741a2['query'][_0x195a('0x46')]);_0x4e3565[_0x195a('0x23')]=qs[_0x195a('0x23')](_0x2741a2[_0x195a('0x3e')][_0x195a('0x23')]);}_0x4e3565[_0x195a('0x47')]=qs[_0x195a('0x48')](_0x2741a2[_0x195a('0x3e')]['sort']);_0x4e3565['where']=qs[_0x195a('0x40')](_['pick'](_0x2741a2[_0x195a('0x3e')],_0x39f73b[_0x195a('0x40')]));_0x4e3565[_0x195a('0x4a')][_0x195a('0x6b')]=_0x3e2d6a['id'];if(_0x2741a2[_0x195a('0x3e')][_0x195a('0x2f')]){_0x4e3565[_0x195a('0x4a')]=_['merge'](_0x4e3565[_0x195a('0x4a')],{'$or':_[_0x195a('0x30')](_0x4e3565[_0x195a('0x41')],function(_0x1b9d1){var _0x282fc4={};_0x282fc4[_0x1b9d1]={'$like':'%'+_0x2741a2[_0x195a('0x3e')][_0x195a('0x2f')]+'%'};return _0x282fc4;})});}_0x4e3565=_[_0x195a('0x4b')]({},_0x4e3565,_0x2741a2['options']);return db[_0x195a('0x6c')][_0x195a('0x22')]({'where':_0x4e3565[_0x195a('0x4a')]})[_0x195a('0x29')](function(_0x4cc2d3){_0x263ee4['count']=_0x4cc2d3;if(_0x2741a2[_0x195a('0x3e')][_0x195a('0x4f')]){_0x4e3565[_0x195a('0x50')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x195a('0x51')](_0x4e3565);})['then'](function(_0x230470){_0x263ee4[_0x195a('0x52')]=_0x230470;return _0x263ee4;});}})['then'](respondWithFilteredResult(_0x4ff597,_0x4e3565))['catch'](handleError(_0x4ff597,null));};exports['getHopperBlacks']=function(_0x3eb20b,_0x39d8ba,_0x968ff0){var _0x24574e={'raw':!![],'where':{}};var _0x5cdc45={};var _0x5f0e42={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x3eb20b[_0x195a('0x55')]['id']}})[_0x195a('0x29')](handleEntityNotFound(_0x39d8ba,null))['then'](function(_0x5ec927){if(_0x5ec927){_0x5cdc45[_0x195a('0x3d')]=_[_0x195a('0x3f')](db['CmHopperBlack'][_0x195a('0x56')]);_0x5cdc45[_0x195a('0x3e')]=_['keys'](_0x3eb20b[_0x195a('0x3e')]);_0x5cdc45[_0x195a('0x40')]=_[_0x195a('0x42')](_0x5cdc45[_0x195a('0x3d')],_0x5cdc45[_0x195a('0x3e')]);_0x24574e[_0x195a('0x41')]=_[_0x195a('0x42')](_0x5cdc45[_0x195a('0x3d')],qs[_0x195a('0x43')](_0x3eb20b[_0x195a('0x3e')][_0x195a('0x43')]));_0x24574e[_0x195a('0x41')]=_0x24574e['attributes'][_0x195a('0x44')]?_0x24574e[_0x195a('0x41')]:_0x5cdc45[_0x195a('0x3d')];if(!_0x3eb20b[_0x195a('0x3e')]['hasOwnProperty'](_0x195a('0x67'))){_0x24574e[_0x195a('0x46')]=qs['limit'](_0x3eb20b[_0x195a('0x3e')][_0x195a('0x46')]);_0x24574e[_0x195a('0x23')]=qs[_0x195a('0x23')](_0x3eb20b[_0x195a('0x3e')][_0x195a('0x23')]);}_0x24574e[_0x195a('0x47')]=qs[_0x195a('0x48')](_0x3eb20b[_0x195a('0x3e')][_0x195a('0x48')]);_0x24574e[_0x195a('0x4a')]=qs['filters'](_['pick'](_0x3eb20b[_0x195a('0x3e')],_0x5cdc45[_0x195a('0x40')]));_0x24574e[_0x195a('0x4a')]['VoiceQueueId']=_0x5ec927['id'];if(_0x3eb20b[_0x195a('0x3e')][_0x195a('0x2f')]){_0x24574e[_0x195a('0x4a')]=_['merge'](_0x24574e['where'],{'$or':_['map'](_0x24574e[_0x195a('0x41')],function(_0x10c2a5){var _0x5c4773={};_0x5c4773[_0x10c2a5]={'$like':'%'+_0x3eb20b['query'][_0x195a('0x2f')]+'%'};return _0x5c4773;})});}_0x24574e=_['merge']({},_0x24574e,_0x3eb20b['options']);return db[_0x195a('0x6d')][_0x195a('0x22')]({'where':_0x24574e[_0x195a('0x4a')]})[_0x195a('0x29')](function(_0x4e5c31){_0x5f0e42[_0x195a('0x22')]=_0x4e5c31;if(_0x3eb20b['query'][_0x195a('0x4f')]){_0x24574e['include']=[{'all':!![]}];}return db[_0x195a('0x6d')][_0x195a('0x51')](_0x24574e);})[_0x195a('0x29')](function(_0x35686e){_0x5f0e42[_0x195a('0x52')]=_0x35686e;return _0x5f0e42;});}})[_0x195a('0x29')](respondWithFilteredResult(_0x39d8ba,_0x24574e))[_0x195a('0x53')](handleError(_0x39d8ba,null));};exports[_0x195a('0x6e')]=function(_0x480b2d,_0x48114d,_0x52113c){var _0x56e8f3={};var _0x479092={};var _0x16060a;var _0x38f892;return db[_0x195a('0x4e')][_0x195a('0x65')]({'where':{'id':_0x480b2d['params']['id']}})['then'](handleEntityNotFound(_0x48114d,null))[_0x195a('0x29')](function(_0x4510c8){if(_0x4510c8){_0x16060a=_0x4510c8;_0x479092[_0x195a('0x3d')]=_[_0x195a('0x3f')](db[_0x195a('0x6f')][_0x195a('0x56')]);_0x479092[_0x195a('0x3e')]=_['keys'](_0x480b2d[_0x195a('0x3e')]);_0x479092[_0x195a('0x40')]=_['intersection'](_0x479092[_0x195a('0x3d')],_0x479092['query']);_0x56e8f3[_0x195a('0x41')]=_[_0x195a('0x42')](_0x479092[_0x195a('0x3d')],qs['fields'](_0x480b2d[_0x195a('0x3e')][_0x195a('0x43')]));_0x56e8f3[_0x195a('0x41')]=_0x56e8f3['attributes'][_0x195a('0x44')]?_0x56e8f3[_0x195a('0x41')]:_0x479092[_0x195a('0x3d')];_0x56e8f3[_0x195a('0x47')]=qs[_0x195a('0x48')](_0x480b2d[_0x195a('0x3e')][_0x195a('0x48')]);_0x56e8f3['where']=qs[_0x195a('0x40')](_['pick'](_0x480b2d[_0x195a('0x3e')],_0x479092[_0x195a('0x40')]));if(_0x480b2d[_0x195a('0x3e')][_0x195a('0x2f')]){_0x56e8f3['where']=_[_0x195a('0x4b')](_0x56e8f3[_0x195a('0x4a')],{'$or':_[_0x195a('0x30')](_0x56e8f3[_0x195a('0x41')],function(_0x2d8e92){var _0x6ec0ba={};_0x6ec0ba[_0x2d8e92]={'$like':'%'+_0x480b2d[_0x195a('0x3e')][_0x195a('0x2f')]+'%'};return _0x6ec0ba;})});}_0x56e8f3=_[_0x195a('0x4b')]({},_0x56e8f3,_0x480b2d['options']);return _0x16060a[_0x195a('0x6e')](_0x56e8f3);}})['then'](function(_0x12213b){if(_0x12213b){_0x38f892=_0x12213b[_0x195a('0x44')];if(!_0x480b2d[_0x195a('0x3e')][_0x195a('0x45')]('nolimit')){_0x56e8f3[_0x195a('0x46')]=qs[_0x195a('0x46')](_0x480b2d[_0x195a('0x3e')][_0x195a('0x46')]);_0x56e8f3[_0x195a('0x23')]=qs[_0x195a('0x23')](_0x480b2d['query'][_0x195a('0x23')]);}return _0x16060a[_0x195a('0x6e')](_0x56e8f3);}})[_0x195a('0x29')](function(_0x44f961){if(_0x44f961){return _0x44f961?{'count':_0x38f892,'rows':_0x44f961}:null;}})[_0x195a('0x29')](respondWithResult(_0x48114d,null))[_0x195a('0x53')](handleError(_0x48114d,null));};exports[_0x195a('0x70')]=function(_0x56b0ad,_0x5a2410,_0x45cea9){var _0x2c2506=_0x56b0ad[_0x195a('0x60')][_0x195a('0x71')];var _0x14378b=_['map'](_0x2c2506,'id');return db[_0x195a('0x6f')][_0x195a('0x51')]({'where':{'id':_0x14378b},'attributes':['id'],'include':[{'model':db[_0x195a('0x72')],'as':_0x195a('0x73'),'attributes':['id',_0x195a('0x38'),_0x195a('0x74'),_0x195a('0x75'),_0x195a('0x76')],'raw':!![]}]})['then'](function(_0x300ce5){if(_0x300ce5){var _0x94bcae=_['flatMap'](_0x300ce5,function(_0x1cf6b2){var _0xb4c2d1=_0x1cf6b2['get']({'plain':!![]});_0xb4c2d1[_0x195a('0x73')]['forEach'](function(_0x4369a4){_0x4369a4['penalty']=_[_0x195a('0x34')](_0x2c2506,{'id':_0xb4c2d1['id']})[_0x195a('0x77')];});return _0xb4c2d1[_0x195a('0x73')];});return db['VoiceQueue'][_0x195a('0x34')]({'where':{'id':_0x56b0ad['params']['id']}})[_0x195a('0x29')](function(_0xac0b13){return db[_0x195a('0x78')]['transaction'](function(_0x4eb0f6){return _0xac0b13[_0x195a('0x70')](_0x14378b,{'transaction':_0x4eb0f6})['then'](function(){return BPromise['each'](_0x94bcae,function(_0x5dc12e){return db[_0x195a('0x79')]['findOrCreate']({'where':{'UserId':_0x5dc12e['id'],'VoiceQueueId':_0x56b0ad['params']['id']},'defaults':{'penalty':_0x5dc12e[_0x195a('0x77')]},'transaction':_0x4eb0f6});});})['then'](function(){return BPromise[_0x195a('0x7a')](_[_0x195a('0x2f')](_0x94bcae,{'online':!![]}),function(_0x5dc82e){return db[_0x195a('0x7b')][_0x195a('0x7c')]({'membername':_0x5dc82e[_0x195a('0x38')],'UserId':_0x5dc82e['id'],'queue_name':_0xac0b13[_0x195a('0x38')],'VoiceQueueId':_0xac0b13['id'],'interface':_[_0x195a('0x7d')](_0x5dc82e['interface'])?util['format'](_0x195a('0x7e'),_0x5dc82e[_0x195a('0x38')]):_0x5dc82e[_0x195a('0x76')],'paused':_0x5dc82e[_0x195a('0x75')]||![],'penalty':_0x5dc82e['penalty']},{'transaction':_0x4eb0f6});});})[_0x195a('0x29')](function(){_0x94bcae[_0x195a('0x7f')](function(_0xe49059){socket[_0x195a('0x80')]('userVoiceQueue:save',{'UserId':_0xe49059['id'],'VoiceQueueId':_0xac0b13['id']});});});});});}})[_0x195a('0x29')](respondWithStatusCode(_0x5a2410,null))[_0x195a('0x53')](handleError(_0x5a2410,null));};exports[_0x195a('0x81')]=function(_0x1e14a3,_0x29ec6d,_0x122296){return db['Team'][_0x195a('0x51')]({'where':{'id':_0x1e14a3[_0x195a('0x3e')][_0x195a('0x82')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x195a('0x73'),'attributes':['id'],'raw':!![]}]})[_0x195a('0x29')](handleEntityNotFound(_0x29ec6d,null))['then'](function(_0x362242){var _0x504ef5=_[_0x195a('0x30')](_0x362242,'id');var _0xa9f93a=[];var _0x2f3b10=[];var _0x5b301b=squel[_0x195a('0x83')]();_0x5b301b[_0x195a('0x84')]('tq.TeamId')[_0x195a('0x85')](_0x195a('0x86'),'tq')[_0x195a('0x87')](_0x195a('0x88'),'ut',_0x195a('0x89'))['where']('VoiceQueueId\x20=\x20?',_0x1e14a3[_0x195a('0x55')]['id']);for(var _0xd49e1e=0x0;_0xd49e1e<_0x362242['length'];_0xd49e1e+=0x1){let _0x347c12=_0x362242[_0xd49e1e];for(var _0x23696f=0x0;_0x23696f<_0x347c12[_0x195a('0x73')][_0x195a('0x44')];_0x23696f+=0x1){let _0x561d63=_0x347c12[_0x195a('0x73')][_0x23696f];var _0x56a816=_0x5b301b[_0x195a('0x5c')]();_0x56a816[_0x195a('0x4a')](_0x195a('0x8a'),_0x561d63['id']);_0x2f3b10[_0x195a('0x8b')](db[_0x195a('0x78')][_0x195a('0x3e')](_0x56a816[_0x195a('0x8c')](),{'type':db['sequelize'][_0x195a('0x8d')][_0x195a('0x8e')]})[_0x195a('0x29')](function(_0x56ba8e){if(_0x56ba8e[_0x195a('0x44')]===0x1){return _0x561d63['id'];}else{var _0x52479e=_['every'](_[_0x195a('0x30')](_0x56ba8e,_0x195a('0x8f')),function(_0x78fd19){return _['includes'](_0x504ef5,_0x78fd19);});if(_0x52479e){return _0x561d63['id'];}}}));}}return BPromise[_0x195a('0x90')](_0x2f3b10)[_0x195a('0x29')](function(_0x3f1616){_0xa9f93a=_(_0xa9f93a)[_0x195a('0x91')](_0x3f1616)[_0x195a('0x92')]()['value']();return db[_0x195a('0x4e')][_0x195a('0x34')]({'where':{'id':_0x1e14a3[_0x195a('0x55')]['id']}})['then'](function(_0x26f1c9){return db['sequelize'][_0x195a('0x93')](function(_0x5255c6){return _0x26f1c9[_0x195a('0x81')](_0x1e14a3[_0x195a('0x3e')][_0x195a('0x82')],{'transaction':_0x5255c6})[_0x195a('0x29')](function(){if(!_[_0x195a('0x94')](_0xa9f93a)){return _0x26f1c9[_0x195a('0x95')](_0xa9f93a,{'transaction':_0x5255c6})[_0x195a('0x29')](function(){return db[_0x195a('0x7b')]['destroy']({'where':{'VoiceQueueId':_0x1e14a3[_0x195a('0x55')]['id'],'UserId':_0xa9f93a},'transaction':_0x5255c6});});}})['then'](function(){_0xa9f93a['forEach'](function(_0x103915){socket[_0x195a('0x80')](_0x195a('0x96'),{'UserId':_0x103915,'VoiceQueueId':_0x26f1c9['id']});});});});});});})['then'](respondWithStatusCode(_0x29ec6d,null))['catch'](handleError(_0x29ec6d,null));};exports[_0x195a('0x97')]=function(_0x19cc47,_0x137fde,_0x1e7af2){var _0x396a6a,_0x69c9ac;return db[_0x195a('0x4e')][_0x195a('0x34')]({'where':{'id':_0x19cc47[_0x195a('0x55')]['id']}})[_0x195a('0x29')](handleEntityNotFound(_0x137fde,null))['then'](function(_0x42737e){if(_0x42737e){_0x69c9ac=_0x42737e;return _0x42737e[_0x195a('0x97')](_0x19cc47[_0x195a('0x60')]['ids'],_[_0x195a('0x5f')](_0x19cc47[_0x195a('0x60')],[_0x195a('0x82'),'id'])||{})[_0x195a('0x98')](function(_0x5aeb5d){for(var _0x53d4dc=0x0;_0x53d4dc<_0x19cc47[_0x195a('0x60')][_0x195a('0x82')][_0x195a('0x44')];_0x53d4dc+=0x1){socket[_0x195a('0x80')](_0x195a('0x99'),{'UserId':_0x19cc47[_0x195a('0x60')][_0x195a('0x82')][_0x53d4dc],'VoiceQueueId':_0x19cc47[_0x195a('0x55')]['id']});}return _0x5aeb5d;});}})['then'](function(_0x4dc9f2){_0x396a6a=_0x4dc9f2||[];if(_0x69c9ac){return db[_0x195a('0x72')][_0x195a('0x51')]({'where':{'id':_0x19cc47[_0x195a('0x60')]['ids']},'attributes':['id',_0x195a('0x38'),_0x195a('0x74'),'voicePause',_0x195a('0x76')],'raw':!![]});}})[_0x195a('0x29')](function(_0x4badf0){if(!_['isEmpty'](_0x4badf0)){var _0x82dcbc=[];for(var _0x3ce4ab=0x0;_0x3ce4ab<_0x4badf0['length'];_0x3ce4ab++){if(_0x4badf0[_0x3ce4ab][_0x195a('0x74')]){_0x82dcbc['push'](db[_0x195a('0x7b')][_0x195a('0x7c')]({'membername':_0x4badf0[_0x3ce4ab][_0x195a('0x38')],'UserId':_0x4badf0[_0x3ce4ab]['id'],'queue_name':_0x69c9ac['name'],'VoiceQueueId':_0x69c9ac['id'],'interface':_[_0x195a('0x7d')](_0x4badf0[_0x3ce4ab][_0x195a('0x76')])?util['format'](_0x195a('0x7e'),_0x4badf0[_0x3ce4ab][_0x195a('0x38')]):_0x4badf0[_0x3ce4ab][_0x195a('0x76')],'paused':_0x4badf0[_0x3ce4ab]['voicePause']||![],'penalty':_0x19cc47['body'][_0x195a('0x77')]||0x0}));}}return BPromise['all'](_0x82dcbc);}})[_0x195a('0x29')](function(){return _0x396a6a;})['then'](respondWithResult(_0x137fde,null))[_0x195a('0x53')](handleError(_0x137fde,null));};exports[_0x195a('0x95')]=function(_0x519dd6,_0x41443b,_0x326c20){return db[_0x195a('0x4e')][_0x195a('0x34')]({'where':{'id':_0x519dd6[_0x195a('0x55')]['id']}})[_0x195a('0x29')](handleEntityNotFound(_0x41443b,null))[_0x195a('0x29')](function(_0x1c6703){if(_0x1c6703){return _0x1c6703[_0x195a('0x95')](_0x519dd6['query'][_0x195a('0x82')])[_0x195a('0x29')](function(){if(_[_0x195a('0x9a')](_0x519dd6[_0x195a('0x3e')][_0x195a('0x82')])){for(var _0x5a7f77=0x0;_0x5a7f77<_0x519dd6[_0x195a('0x3e')][_0x195a('0x82')][_0x195a('0x44')];_0x5a7f77+=0x1){socket[_0x195a('0x80')]('userVoiceQueue:remove',{'UserId':Number(_0x519dd6['query'][_0x195a('0x82')][_0x5a7f77]),'VoiceQueueId':Number(_0x519dd6['params']['id'])});}}else{socket[_0x195a('0x80')]('userVoiceQueue:remove',{'UserId':Number(_0x519dd6[_0x195a('0x3e')]['ids']),'VoiceQueueId':Number(_0x519dd6['params']['id'])});}});}})[_0x195a('0x29')](function(_0x14deb4){return db['UserVoiceQueueRt'][_0x195a('0x63')]({'where':{'VoiceQueueId':_0x519dd6[_0x195a('0x55')]['id'],'UserId':_0x519dd6['query']['ids']}})[_0x195a('0x29')](function(){return _0x14deb4;});})['then'](respondWithStatusCode(_0x41443b,null))['catch'](handleError(_0x41443b,null));};exports[_0x195a('0x9b')]=function(_0x409f49,_0x3b4ce9,_0x1dae87){var _0x36fd4c={};var _0xa9e39b={};var _0x6ed658;var _0x3e1c00;return db['VoiceQueue'][_0x195a('0x65')]({'where':{'id':_0x409f49[_0x195a('0x55')]['id']}})[_0x195a('0x29')](handleEntityNotFound(_0x3b4ce9,null))[_0x195a('0x29')](function(_0x4fbf7a){if(_0x4fbf7a){_0x6ed658=_0x4fbf7a;_0xa9e39b[_0x195a('0x3d')]=_[_0x195a('0x3f')](db[_0x195a('0x72')]['rawAttributes']);_0xa9e39b[_0x195a('0x3e')]=_[_0x195a('0x3f')](_0x409f49[_0x195a('0x3e')]);_0xa9e39b[_0x195a('0x40')]=_[_0x195a('0x42')](_0xa9e39b[_0x195a('0x3d')],_0xa9e39b[_0x195a('0x3e')]);_0x36fd4c[_0x195a('0x41')]=_[_0x195a('0x42')](_0xa9e39b[_0x195a('0x3d')],qs['fields'](_0x409f49[_0x195a('0x3e')][_0x195a('0x43')]));_0x36fd4c[_0x195a('0x41')]=_0x36fd4c['attributes']['length']?_0x36fd4c[_0x195a('0x41')]:_0xa9e39b['model'];_0x36fd4c[_0x195a('0x47')]=qs[_0x195a('0x48')](_0x409f49[_0x195a('0x3e')][_0x195a('0x48')]);_0x36fd4c['where']=qs[_0x195a('0x40')](_[_0x195a('0x49')](_0x409f49[_0x195a('0x3e')],_0xa9e39b[_0x195a('0x40')]));if(_0x409f49['query'][_0x195a('0x2f')]){_0x36fd4c[_0x195a('0x4a')]=_['merge'](_0x36fd4c[_0x195a('0x4a')],{'$or':_[_0x195a('0x30')](_0x36fd4c[_0x195a('0x41')],function(_0x4c614c){var _0x1da058={};_0x1da058[_0x4c614c]={'$like':'%'+_0x409f49['query'][_0x195a('0x2f')]+'%'};return _0x1da058;})});}_0x36fd4c=_['merge']({},_0x36fd4c,_0x409f49['options']);return _0x6ed658[_0x195a('0x9b')](_0x36fd4c);}})['then'](function(_0x75885e){if(_0x75885e){_0x3e1c00=_0x75885e[_0x195a('0x44')];if(!_0x409f49['query'][_0x195a('0x45')]('nolimit')){_0x36fd4c[_0x195a('0x46')]=qs[_0x195a('0x46')](_0x409f49[_0x195a('0x3e')][_0x195a('0x46')]);_0x36fd4c[_0x195a('0x23')]=qs['offset'](_0x409f49[_0x195a('0x3e')][_0x195a('0x23')]);}return _0x6ed658['getAgents'](_0x36fd4c);}})['then'](function(_0x2291e0){if(_0x2291e0){return _0x2291e0?{'count':_0x3e1c00,'rows':_0x2291e0}:null;}})[_0x195a('0x29')](respondWithResult(_0x3b4ce9,null))[_0x195a('0x53')](handleError(_0x3b4ce9,null));};exports[_0x195a('0x9c')]=function(_0x1b55cf,_0x1bcf89,_0x1f7fd8){var _0x59fd15={};var _0x36dec5={};var _0x6056c;var _0x75498;return db[_0x195a('0x4e')][_0x195a('0x65')]({'where':{'id':_0x1b55cf[_0x195a('0x55')]['id']}})[_0x195a('0x29')](handleEntityNotFound(_0x1bcf89,null))['then'](function(_0x1df4bf){if(_0x1df4bf){_0x6056c=_0x1df4bf;_0x36dec5[_0x195a('0x3d')]=_[_0x195a('0x3f')](db[_0x195a('0x7b')]['rawAttributes']);_0x36dec5[_0x195a('0x3e')]=_[_0x195a('0x3f')](_0x1b55cf[_0x195a('0x3e')]);_0x36dec5['filters']=_[_0x195a('0x42')](_0x36dec5[_0x195a('0x3d')],_0x36dec5[_0x195a('0x3e')]);_0x59fd15['attributes']=_[_0x195a('0x42')](_0x36dec5[_0x195a('0x3d')],qs[_0x195a('0x43')](_0x1b55cf[_0x195a('0x3e')][_0x195a('0x43')]));_0x59fd15[_0x195a('0x41')]=_0x59fd15[_0x195a('0x41')]['length']?_0x59fd15['attributes']:_0x36dec5[_0x195a('0x3d')];_0x59fd15[_0x195a('0x47')]=qs[_0x195a('0x48')](_0x1b55cf[_0x195a('0x3e')][_0x195a('0x48')]);_0x59fd15[_0x195a('0x4a')]=qs[_0x195a('0x40')](_[_0x195a('0x49')](_0x1b55cf[_0x195a('0x3e')],_0x36dec5[_0x195a('0x40')]));if(_0x1b55cf[_0x195a('0x3e')]['filter']){_0x59fd15['where']=_[_0x195a('0x4b')](_0x59fd15[_0x195a('0x4a')],{'$or':_[_0x195a('0x30')](_0x59fd15[_0x195a('0x41')],function(_0x1dbac1){var _0x2376b6={};_0x2376b6[_0x1dbac1]={'$like':'%'+_0x1b55cf[_0x195a('0x3e')]['filter']+'%'};return _0x2376b6;})});}_0x59fd15=_[_0x195a('0x4b')]({},_0x59fd15,_0x1b55cf[_0x195a('0x4d')]);return _0x6056c['getMembers'](_0x59fd15);}})['then'](function(_0x10a2d2){if(_0x10a2d2){_0x75498=_0x10a2d2[_0x195a('0x44')];if(!_0x1b55cf[_0x195a('0x3e')][_0x195a('0x45')](_0x195a('0x67'))){_0x59fd15[_0x195a('0x46')]=qs[_0x195a('0x46')](_0x1b55cf[_0x195a('0x3e')][_0x195a('0x46')]);_0x59fd15[_0x195a('0x23')]=qs[_0x195a('0x23')](_0x1b55cf[_0x195a('0x3e')][_0x195a('0x23')]);}return _0x6056c[_0x195a('0x9c')](_0x59fd15);}})[_0x195a('0x29')](function(_0x5313da){return _0x5313da?{'count':_0x75498,'rows':_0x5313da}:null;})[_0x195a('0x29')](respondWithResult(_0x1bcf89,null))[_0x195a('0x53')](handleError(_0x1bcf89,null));};exports['getLists']=function(_0x3d4516,_0x35ad43,_0x566d65){var _0x183375={};var _0x50f7fc={};var _0x316d13;var _0x326dcb;return db[_0x195a('0x4e')][_0x195a('0x65')]({'where':{'id':_0x3d4516[_0x195a('0x55')]['id']}})['then'](handleEntityNotFound(_0x35ad43,null))[_0x195a('0x29')](function(_0x5cc0ae){if(_0x5cc0ae){_0x316d13=_0x5cc0ae;_0x50f7fc['model']=_[_0x195a('0x3f')](db[_0x195a('0x9d')][_0x195a('0x56')]);_0x50f7fc[_0x195a('0x3e')]=_[_0x195a('0x3f')](_0x3d4516['query']);_0x50f7fc[_0x195a('0x40')]=_[_0x195a('0x42')](_0x50f7fc['model'],_0x50f7fc[_0x195a('0x3e')]);_0x183375['attributes']=_[_0x195a('0x42')](_0x50f7fc[_0x195a('0x3d')],qs[_0x195a('0x43')](_0x3d4516[_0x195a('0x3e')][_0x195a('0x43')]));_0x183375[_0x195a('0x41')]=_0x183375[_0x195a('0x41')][_0x195a('0x44')]?_0x183375[_0x195a('0x41')]:_0x50f7fc['model'];_0x183375[_0x195a('0x47')]=qs[_0x195a('0x48')](_0x3d4516[_0x195a('0x3e')][_0x195a('0x48')]);_0x183375[_0x195a('0x4a')]=qs[_0x195a('0x40')](_[_0x195a('0x49')](_0x3d4516[_0x195a('0x3e')],_0x50f7fc['filters']));if(_0x3d4516['query']['filter']){_0x183375[_0x195a('0x4a')]=_['merge'](_0x183375[_0x195a('0x4a')],{'$or':_[_0x195a('0x30')](_0x183375[_0x195a('0x41')],function(_0x33490e){var _0x382330={};_0x382330[_0x33490e]={'$like':'%'+_0x3d4516[_0x195a('0x3e')][_0x195a('0x2f')]+'%'};return _0x382330;})});}_0x183375=_['merge']({},_0x183375,_0x3d4516[_0x195a('0x4d')]);return _0x316d13[_0x195a('0x9e')](_0x183375);}})[_0x195a('0x29')](function(_0x22890a){if(_0x22890a){_0x326dcb=_0x22890a[_0x195a('0x44')];if(!_0x3d4516[_0x195a('0x3e')][_0x195a('0x45')]('nolimit')){_0x183375[_0x195a('0x46')]=qs[_0x195a('0x46')](_0x3d4516[_0x195a('0x3e')]['limit']);_0x183375[_0x195a('0x23')]=qs[_0x195a('0x23')](_0x3d4516[_0x195a('0x3e')]['offset']);}return _0x316d13[_0x195a('0x9e')](_0x183375);}})[_0x195a('0x29')](function(_0x27491b){if(_0x27491b){return _0x27491b?{'count':_0x326dcb,'rows':_0x27491b}:null;}})[_0x195a('0x29')](respondWithResult(_0x35ad43,null))[_0x195a('0x53')](handleError(_0x35ad43,null));};exports[_0x195a('0x9f')]=function(_0xc621c9,_0x33d808,_0x505468){var _0x2de00f,_0x5ba89d;return db[_0x195a('0x4e')]['find']({'where':{'id':_0xc621c9[_0x195a('0x55')]['id']}})[_0x195a('0x29')](handleEntityNotFound(_0x33d808,null))['then'](function(_0x1e71c2){if(_0x1e71c2){_0x5ba89d=_0x1e71c2;return _0x1e71c2[_0x195a('0x9f')](_0xc621c9[_0x195a('0x60')][_0x195a('0x82')],_['omit'](_0xc621c9[_0x195a('0x60')],[_0x195a('0x82'),'id'])||{});}return null;})[_0x195a('0x98')](function(_0x476a26){var _0x520c30;_0x2de00f=_0x476a26||[];var _0x100ed9=[];if(_0x476a26){for(var _0xbf23f8=0x0;_0xbf23f8<_0x476a26[_0x195a('0x44')];_0xbf23f8+=0x1){var _0x314eb8=_0x476a26[_0xbf23f8][_0x195a('0x2a')]({'plain':!![]});_0x5ba89d['dialCheckDuplicateType']=_0xc621c9[_0x195a('0x60')]['dialCheckDuplicateType']?_0xc621c9[_0x195a('0x60')]['dialCheckDuplicateType']:_0x5ba89d[_0x195a('0xa0')];switch(_0x5ba89d['dialCheckDuplicateType']){case _0x195a('0xa1'):_0x520c30=squel[_0x195a('0xa2')]()[_0x195a('0xa3')]('cm_hopper')[_0x195a('0xa4')]([_0x195a('0xa5'),_0x195a('0xa6'),_0x195a('0xa7'),'ListId',_0x195a('0x6b'),_0x195a('0x5d'),_0x195a('0x5e')],squel[_0x195a('0x83')]()[_0x195a('0x84')](_0x195a('0xa5'),_0x195a('0xa5'))[_0x195a('0x84')](_0x195a('0xa8'),_0x195a('0xa6'))[_0x195a('0x84')]('id',_0x195a('0xa7'))[_0x195a('0x84')](_0x314eb8[_0x195a('0xa9')][_0x195a('0x8c')](),_0x195a('0xaa'))[_0x195a('0x84')](_0xc621c9['params']['id']['toString'](),'VoiceQueueId')[_0x195a('0x84')](_0x195a('0xa8'),_0x195a('0x5d'))['field'](_0x195a('0xa8'),_0x195a('0x5e'))[_0x195a('0x85')](_0x195a('0xab'))[_0x195a('0x4a')](_0x195a('0xac'))[_0x195a('0x4a')](_0x195a('0xad'),_0x314eb8[_0x195a('0xa9')][_0x195a('0x8c')]())[_0x195a('0x4a')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x195a('0xae'),squel['select']()['field'](_0x195a('0xaf'))['from'](_0x195a('0xb0'))[_0x195a('0x4a')](_0x195a('0xb1'),_0xc621c9[_0x195a('0x55')]['id'][_0x195a('0x8c')]()))['where'](_0x195a('0xae'),squel['select']()[_0x195a('0x84')]('COALESCE(phone,\x27\x27)')[_0x195a('0x85')](_0x195a('0xb2'))[_0x195a('0x4a')](_0x195a('0xb1'),_0xc621c9[_0x195a('0x55')]['id'][_0x195a('0x8c')]())))[_0x195a('0x8c')]();break;case _0x195a('0xb3'):_0x520c30=squel['insert']()[_0x195a('0xa3')]('cm_hopper')[_0x195a('0xa4')]([_0x195a('0xa5'),_0x195a('0xa6'),_0x195a('0xa7'),'ListId',_0x195a('0x6b'),_0x195a('0x5d'),_0x195a('0x5e')],squel[_0x195a('0x83')]()['field'](_0x195a('0xa5'),_0x195a('0xa5'))['field'](_0x195a('0xa8'),'scheduledAt')[_0x195a('0x84')]('id',_0x195a('0xa7'))['field'](_0x314eb8[_0x195a('0xa9')][_0x195a('0x8c')](),_0x195a('0xaa'))[_0x195a('0x84')](_0xc621c9['params']['id'][_0x195a('0x8c')](),_0x195a('0x6b'))[_0x195a('0x84')](_0x195a('0xa8'),_0x195a('0x5d'))[_0x195a('0x84')]('NOW()','updatedAt')[_0x195a('0x85')](_0x195a('0xab'))[_0x195a('0x4a')](_0x195a('0xac'))[_0x195a('0x4a')]('ListId\x20=\x20?',_0x314eb8[_0x195a('0xa9')][_0x195a('0x8c')]())['where'](_0x195a('0xb4'))['where'](_0x195a('0xae'),squel[_0x195a('0x83')]()[_0x195a('0x84')]('COALESCE(phone,\x27\x27)')[_0x195a('0x85')](_0x195a('0xb2'))[_0x195a('0x4a')](_0x195a('0xb1'),_0xc621c9[_0x195a('0x55')]['id'][_0x195a('0x8c')]())))[_0x195a('0x8c')]();break;default:_0x520c30=squel[_0x195a('0xa2')]()[_0x195a('0xa3')](_0x195a('0xb2'))[_0x195a('0xa4')]([_0x195a('0xa5'),_0x195a('0xa6'),_0x195a('0xa7'),_0x195a('0xaa'),_0x195a('0x6b'),_0x195a('0x5d'),_0x195a('0x5e')],squel[_0x195a('0x83')]()[_0x195a('0x84')](_0x195a('0xa5'),_0x195a('0xa5'))[_0x195a('0x84')](_0x195a('0xa8'),_0x195a('0xa6'))[_0x195a('0x84')]('id',_0x195a('0xa7'))['field'](_0x314eb8[_0x195a('0xa9')][_0x195a('0x8c')](),'ListId')[_0x195a('0x84')](_0xc621c9[_0x195a('0x55')]['id']['toString'](),'VoiceQueueId')[_0x195a('0x84')](_0x195a('0xa8'),_0x195a('0x5d'))[_0x195a('0x84')](_0x195a('0xa8'),'updatedAt')[_0x195a('0x85')]('cm_contacts')['where'](_0x195a('0xac'))['where']('ListId\x20=\x20?',_0x314eb8['CmListId'][_0x195a('0x8c')]())[_0x195a('0x4a')](_0x195a('0xb4')))[_0x195a('0x8c')]();}_0x100ed9[_0x195a('0x8b')](db[_0x195a('0x78')][_0x195a('0x3e')](_0x520c30));}return BPromise[_0x195a('0x90')](_0x100ed9);}})[_0x195a('0x29')](function(){return _0x2de00f;})['then'](respondWithResult(_0x33d808,null))[_0x195a('0x53')](handleError(_0x33d808,null));};exports['removeLists']=function(_0x47d343,_0xbd2766,_0x5419ea){return db[_0x195a('0x4e')]['find']({'where':{'id':_0x47d343[_0x195a('0x55')]['id']}})[_0x195a('0x29')](handleEntityNotFound(_0xbd2766,null))[_0x195a('0x29')](function(_0x3411b4){if(_0x3411b4){return _0x3411b4[_0x195a('0xb5')](_0x47d343[_0x195a('0x3e')][_0x195a('0x82')]);}})[_0x195a('0x29')](function(_0x5099b5){if(_0x5099b5){return db[_0x195a('0x66')][_0x195a('0x63')]({'where':{'ListId':_0x47d343[_0x195a('0x3e')][_0x195a('0x82')],'VoiceQueueId':_0x47d343[_0x195a('0x55')]['id']}})['then'](function(){return _0x5099b5;});}})[_0x195a('0x29')](respondWithStatusCode(_0xbd2766,null))[_0x195a('0x53')](handleError(_0xbd2766,null));};exports[_0x195a('0xb6')]=function(_0x2d60ab,_0x2b27f0,_0x1c95c9){var _0x1b009f={};var _0xaa8604={};var _0x13545b;var _0x1dfb8f;return db[_0x195a('0x4e')][_0x195a('0x65')]({'where':{'id':_0x2d60ab[_0x195a('0x55')]['id']}})[_0x195a('0x29')](handleEntityNotFound(_0x2b27f0,null))[_0x195a('0x29')](function(_0xa227c0){if(_0xa227c0){_0x13545b=_0xa227c0;_0xaa8604[_0x195a('0x3d')]=_[_0x195a('0x3f')](db[_0x195a('0x9d')][_0x195a('0x56')]);_0xaa8604[_0x195a('0x3e')]=_[_0x195a('0x3f')](_0x2d60ab[_0x195a('0x3e')]);_0xaa8604[_0x195a('0x40')]=_[_0x195a('0x42')](_0xaa8604['model'],_0xaa8604['query']);_0x1b009f[_0x195a('0x41')]=_[_0x195a('0x42')](_0xaa8604['model'],qs['fields'](_0x2d60ab[_0x195a('0x3e')]['fields']));_0x1b009f[_0x195a('0x41')]=_0x1b009f[_0x195a('0x41')]['length']?_0x1b009f[_0x195a('0x41')]:_0xaa8604[_0x195a('0x3d')];_0x1b009f[_0x195a('0x47')]=qs[_0x195a('0x48')](_0x2d60ab[_0x195a('0x3e')][_0x195a('0x48')]);_0x1b009f[_0x195a('0x4a')]=qs[_0x195a('0x40')](_[_0x195a('0x49')](_0x2d60ab[_0x195a('0x3e')],_0xaa8604[_0x195a('0x40')]));if(_0x2d60ab[_0x195a('0x3e')][_0x195a('0x2f')]){_0x1b009f[_0x195a('0x4a')]=_[_0x195a('0x4b')](_0x1b009f[_0x195a('0x4a')],{'$or':_[_0x195a('0x30')](_0x1b009f[_0x195a('0x41')],function(_0x140ecc){var _0x5ceca8={};_0x5ceca8[_0x140ecc]={'$like':'%'+_0x2d60ab[_0x195a('0x3e')][_0x195a('0x2f')]+'%'};return _0x5ceca8;})});}_0x1b009f=_[_0x195a('0x4b')]({},_0x1b009f,_0x2d60ab['options']);return _0x13545b[_0x195a('0xb6')](_0x1b009f);}})['then'](function(_0x27a9f7){if(_0x27a9f7){_0x1dfb8f=_0x27a9f7[_0x195a('0x44')];if(!_0x2d60ab['query'][_0x195a('0x45')](_0x195a('0x67'))){_0x1b009f[_0x195a('0x46')]=qs[_0x195a('0x46')](_0x2d60ab[_0x195a('0x3e')][_0x195a('0x46')]);_0x1b009f[_0x195a('0x23')]=qs['offset'](_0x2d60ab[_0x195a('0x3e')][_0x195a('0x23')]);}return _0x13545b['getBlackLists'](_0x1b009f);}})[_0x195a('0x29')](function(_0x574db5){if(_0x574db5){return _0x574db5?{'count':_0x1dfb8f,'rows':_0x574db5}:null;}})[_0x195a('0x29')](respondWithResult(_0x2b27f0,null))[_0x195a('0x53')](handleError(_0x2b27f0,null));};exports['addBlackLists']=function(_0x103d0d,_0x58af30,_0x27f2b9){var _0x377d75,_0x3fc53a;return db['VoiceQueue']['find']({'where':{'id':_0x103d0d[_0x195a('0x55')]['id']}})['then'](handleEntityNotFound(_0x58af30,null))['then'](function(_0x38d4c2){if(_0x38d4c2){_0x3fc53a=_0x38d4c2;return _0x38d4c2['addBlackLists'](_0x103d0d['body'][_0x195a('0x82')],_[_0x195a('0x5f')](_0x103d0d[_0x195a('0x60')],[_0x195a('0x82'),'id'])||{});}return null;})[_0x195a('0x98')](function(_0x51abdd){var _0x2615a3;_0x377d75=_0x51abdd||[];var _0x284fed=[];if(_0x51abdd){for(var _0x4b1ce5=0x0;_0x4b1ce5<_0x51abdd[_0x195a('0x44')];_0x4b1ce5+=0x1){var _0x422eb4=_0x51abdd[_0x4b1ce5][_0x195a('0x2a')]({'plain':!![]});_0x2615a3=squel[_0x195a('0xa2')]()['into'](_0x195a('0xb7'))[_0x195a('0xa4')]([_0x195a('0xa5'),_0x195a('0xa7'),_0x195a('0xaa'),_0x195a('0x6b'),_0x195a('0x5d'),_0x195a('0x5e')],squel['select']()[_0x195a('0x84')]('phone',_0x195a('0xa5'))['field']('id',_0x195a('0xa7'))['field'](_0x422eb4[_0x195a('0xa9')][_0x195a('0x8c')](),_0x195a('0xaa'))[_0x195a('0x84')](_0x103d0d[_0x195a('0x55')]['id'][_0x195a('0x8c')](),_0x195a('0x6b'))[_0x195a('0x84')](_0x195a('0xa8'),_0x195a('0x5d'))['field'](_0x195a('0xa8'),_0x195a('0x5e'))[_0x195a('0x85')](_0x195a('0xab'))[_0x195a('0x4a')](_0x195a('0xac'))['where']('ListId\x20=\x20?',_0x422eb4[_0x195a('0xa9')][_0x195a('0x8c')]())['where'](_0x195a('0xb4')))[_0x195a('0x8c')]();_0x284fed['push'](db['sequelize']['query'](_0x2615a3));}return BPromise['all'](_0x284fed);}})['then'](function(){return _0x377d75;})[_0x195a('0x29')](respondWithResult(_0x58af30,null))[_0x195a('0x53')](handleError(_0x58af30,null));};exports[_0x195a('0xb8')]=function(_0x52021b,_0x583836,_0x74da4b){return db['VoiceQueue'][_0x195a('0x34')]({'where':{'id':_0x52021b[_0x195a('0x55')]['id']}})['then'](handleEntityNotFound(_0x583836,null))[_0x195a('0x29')](function(_0x25899b){if(_0x25899b){return _0x25899b[_0x195a('0xb8')](_0x52021b['query']['ids']);}})[_0x195a('0x29')](function(_0x13a96a){if(_0x13a96a){return db['CmHopperBlack'][_0x195a('0x63')]({'where':{'ListId':_0x52021b[_0x195a('0x3e')]['ids'],'VoiceQueueId':_0x52021b[_0x195a('0x55')]['id']}})[_0x195a('0x29')](function(){return _0x13a96a;});}})[_0x195a('0x29')](respondWithStatusCode(_0x583836,null))[_0x195a('0x53')](handleError(_0x583836,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index e1dacba..88c1467 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 _0x2957=['hook','events','save','update','remove','emit'];(function(_0x1849fe,_0x568b96){var _0x3ab401=function(_0x95d462){while(--_0x95d462){_0x1849fe['push'](_0x1849fe['shift']());}};_0x3ab401(++_0x568b96);}(_0x2957,0xe5));var _0x7295=function(_0x23ad11,_0x3e7ad4){_0x23ad11=_0x23ad11-0x0;var _0x56128d=_0x2957[_0x23ad11];return _0x56128d;};'use strict';var EventEmitter=require(_0x7295('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7295('0x1'),'afterUpdate':_0x7295('0x2'),'afterDestroy':_0x7295('0x3')};function emitEvent(_0x8d3d8d){return function(_0x19f6a7,_0x3c1e09,_0x5d7897){VoiceQueueEvents[_0x7295('0x4')](_0x8d3d8d+':'+_0x19f6a7['id'],_0x19f6a7);VoiceQueueEvents[_0x7295('0x4')](_0x8d3d8d,_0x19f6a7);_0x5d7897(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x7295('0x5')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x94f6=['events','VoiceQueue','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x57bda6,_0x1c5b9e){var _0x55f7f0=function(_0x29c085){while(--_0x29c085){_0x57bda6['push'](_0x57bda6['shift']());}};_0x55f7f0(++_0x1c5b9e);}(_0x94f6,0xb0));var _0x694f=function(_0x4e123b,_0x14841d){_0x4e123b=_0x4e123b-0x0;var _0x24534e=_0x94f6[_0x4e123b];return _0x24534e;};'use strict';var EventEmitter=require(_0x694f('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x694f('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x694f('0x2')](0x0);var events={'afterCreate':_0x694f('0x3'),'afterUpdate':'update','afterDestroy':_0x694f('0x4')};function emitEvent(_0x4c9b09){return function(_0x56bd47,_0x45d499,_0xdf3472){VoiceQueueEvents[_0x694f('0x5')](_0x4c9b09+':'+_0x56bd47['id'],_0x56bd47);VoiceQueueEvents[_0x694f('0x5')](_0x4c9b09,_0x56bd47);_0xdf3472(null);};}for(var e in events){if(events[_0x694f('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x694f('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 7e140d6..1d120c7 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 _0x7f62=['request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue','lodash','util','../../config/logger','moment','bluebird'];(function(_0x556477,_0x1b7214){var _0x552276=function(_0xf0e2ef){while(--_0xf0e2ef){_0x556477['push'](_0x556477['shift']());}};_0x552276(++_0x1b7214);}(_0x7f62,0xc7));var _0x27f6=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0x7f62[_0x3cea78];return _0x33b66b;};'use strict';var _=require(_0x27f6('0x0'));var util=require(_0x27f6('0x1'));var logger=require(_0x27f6('0x2'))('api');var moment=require(_0x27f6('0x3'));var BPromise=require(_0x27f6('0x4'));var rp=require(_0x27f6('0x5'));var fs=require('fs');var path=require(_0x27f6('0x6'));var rimraf=require(_0x27f6('0x7'));var config=require(_0x27f6('0x8'));var attributes=require(_0x27f6('0x9'));module[_0x27f6('0xa')]=function(_0xdd8cb4,_0x280810){return _0xdd8cb4['define'](_0x27f6('0xb'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3660=['request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','voice_queues','lodash','util','../../config/logger','bluebird'];(function(_0x36436d,_0x20292c){var _0x34615d=function(_0x5447af){while(--_0x5447af){_0x36436d['push'](_0x36436d['shift']());}};_0x34615d(++_0x20292c);}(_0x3660,0x8b));var _0x0366=function(_0x1cd2be,_0x357160){_0x1cd2be=_0x1cd2be-0x0;var _0x1e33e0=_0x3660[_0x1cd2be];return _0x1e33e0;};'use strict';var _=require(_0x0366('0x0'));var util=require(_0x0366('0x1'));var logger=require(_0x0366('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0366('0x3'));var rp=require(_0x0366('0x4'));var fs=require('fs');var path=require(_0x0366('0x5'));var rimraf=require(_0x0366('0x6'));var config=require(_0x0366('0x7'));var attributes=require(_0x0366('0x8'));module[_0x0366('0x9')]=function(_0x3e2d46,_0x27d2da){return _0x3e2d46[_0x0366('0xa')](_0x0366('0xb'),attributes,{'tableName':_0x0366('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index e70e7b4..a012438 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 _0x7e05=['./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueue','VoiceQueue','options','raw','limit','map','attributes','include','model','debug','ShowVoiceQueue','where','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost'];(function(_0x499194,_0x43eb12){var _0xeea9f4=function(_0x18eb4b){while(--_0x18eb4b){_0x499194['push'](_0x499194['shift']());}};_0xeea9f4(++_0x43eb12);}(_0x7e05,0x166));var _0x57e0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x7e05[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x57e0('0x0'));var util=require(_0x57e0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x57e0('0x2'));var fs=require('fs');var Redis=require(_0x57e0('0x3'));var db=require(_0x57e0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x57e0('0x5'))(_0x57e0('0x6'));var config=require(_0x57e0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x57e0('0x8')][_0x57e0('0x9')]({'port':0x232a});config[_0x57e0('0xa')]=_['defaults'](config[_0x57e0('0xa')],{'host':_0x57e0('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x57e0('0xa')]));require(_0x57e0('0xc'))[_0x57e0('0xd')](socket);function respondWithRpcPromise(_0x3a0569,_0xe4bed1,_0x1adf9f){return new BPromise(function(_0x5db29e,_0x47943a){return client[_0x57e0('0xe')](_0x3a0569,_0x1adf9f)[_0x57e0('0xf')](function(_0x419f8d){logger[_0x57e0('0x10')](_0x57e0('0x11'),_0xe4bed1,_0x57e0('0x12'));logger['debug'](_0x57e0('0x13'),_0xe4bed1,_0x57e0('0x12'),JSON[_0x57e0('0x14')](_0x419f8d));if(_0x419f8d[_0x57e0('0x15')]){if(_0x419f8d['error'][_0x57e0('0x16')]===0x1f4){logger['error'](_0x57e0('0x11'),_0xe4bed1,_0x419f8d['error'][_0x57e0('0x17')]);return _0x47943a(_0x419f8d[_0x57e0('0x15')][_0x57e0('0x17')]);}logger['error'](_0x57e0('0x11'),_0xe4bed1,_0x419f8d[_0x57e0('0x15')][_0x57e0('0x17')]);return _0x5db29e(_0x419f8d[_0x57e0('0x15')][_0x57e0('0x17')]);}else{logger[_0x57e0('0x10')]('VoiceQueue,\x20%s,\x20%s',_0xe4bed1,'request\x20sent');_0x5db29e(_0x419f8d['result'][_0x57e0('0x17')]);}})[_0x57e0('0x18')](function(_0xf81b28){logger[_0x57e0('0x15')](_0x57e0('0x11'),_0xe4bed1,_0xf81b28);_0x47943a(_0xf81b28);});});}exports[_0x57e0('0x19')]=function(_0x3f3db5){var _0x2bd6e2=this;return new Promise(function(_0x481abc,_0x7b2fc8){return db[_0x57e0('0x1a')]['findAll']({'raw':_0x3f3db5[_0x57e0('0x1b')]?_0x3f3db5[_0x57e0('0x1b')][_0x57e0('0x1c')]===undefined?!![]:![]:!![],'where':_0x3f3db5[_0x57e0('0x1b')]?_0x3f3db5['options']['where']||null:null,'attributes':_0x3f3db5[_0x57e0('0x1b')]?_0x3f3db5[_0x57e0('0x1b')]['attributes']||null:null,'limit':_0x3f3db5[_0x57e0('0x1b')]?_0x3f3db5[_0x57e0('0x1b')][_0x57e0('0x1d')]||null:null,'include':_0x3f3db5[_0x57e0('0x1b')]?_0x3f3db5[_0x57e0('0x1b')]['include']?_[_0x57e0('0x1e')](_0x3f3db5[_0x57e0('0x1b')]['include'],function(_0x3d3a7b){return{'model':db[_0x3d3a7b['model']],'as':_0x3d3a7b['as'],'attributes':_0x3d3a7b[_0x57e0('0x1f')],'include':_0x3d3a7b[_0x57e0('0x20')]?_[_0x57e0('0x1e')](_0x3d3a7b[_0x57e0('0x20')],function(_0x299205){return{'model':db[_0x299205[_0x57e0('0x21')]],'as':_0x299205['as'],'attributes':_0x299205[_0x57e0('0x1f')],'include':_0x299205[_0x57e0('0x20')]?_[_0x57e0('0x1e')](_0x299205['include'],function(_0xd2b71b){return{'model':db[_0xd2b71b['model']],'as':_0xd2b71b['as'],'attributes':_0xd2b71b[_0x57e0('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x181fd6){logger[_0x57e0('0x10')](_0x57e0('0x19'),_0x3f3db5);logger[_0x57e0('0x22')](_0x57e0('0x19'),_0x3f3db5,JSON['stringify'](_0x181fd6));_0x481abc(_0x181fd6);})[_0x57e0('0x18')](function(_0x2f92cd){logger[_0x57e0('0x15')](_0x57e0('0x19'),_0x2f92cd[_0x57e0('0x17')],_0x3f3db5);_0x7b2fc8(_0x2bd6e2['error'](0x1f4,_0x2f92cd[_0x57e0('0x17')]));});});};exports[_0x57e0('0x23')]=function(_0x11db5d){var _0x1ff278=this;return new Promise(function(_0x831646,_0x5db704){return db[_0x57e0('0x1a')]['find']({'raw':_0x11db5d[_0x57e0('0x1b')]?_0x11db5d[_0x57e0('0x1b')][_0x57e0('0x1c')]===undefined?!![]:![]:!![],'where':_0x11db5d[_0x57e0('0x1b')]?_0x11db5d[_0x57e0('0x1b')][_0x57e0('0x24')]||null:null,'attributes':_0x11db5d[_0x57e0('0x1b')]?_0x11db5d[_0x57e0('0x1b')]['attributes']||null:null,'include':_0x11db5d[_0x57e0('0x1b')]?_0x11db5d[_0x57e0('0x1b')]['include']?_[_0x57e0('0x1e')](_0x11db5d[_0x57e0('0x1b')][_0x57e0('0x20')],function(_0x58651c){return{'model':db[_0x58651c[_0x57e0('0x21')]],'as':_0x58651c['as'],'attributes':_0x58651c[_0x57e0('0x1f')],'include':_0x58651c[_0x57e0('0x20')]?_['map'](_0x58651c[_0x57e0('0x20')],function(_0x126331){return{'model':db[_0x126331['model']],'as':_0x126331['as'],'attributes':_0x126331[_0x57e0('0x1f')],'include':_0x126331['include']?_[_0x57e0('0x1e')](_0x126331['include'],function(_0x4f620e){return{'model':db[_0x4f620e[_0x57e0('0x21')]],'as':_0x4f620e['as'],'attributes':_0x4f620e[_0x57e0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x57e0('0xf')](function(_0x389ee4){logger[_0x57e0('0x10')]('ShowVoiceQueue',_0x11db5d);logger['debug'](_0x57e0('0x23'),_0x11db5d,JSON[_0x57e0('0x14')](_0x389ee4));_0x831646(_0x389ee4);})[_0x57e0('0x18')](function(_0x49154f){logger[_0x57e0('0x15')](_0x57e0('0x23'),_0x49154f[_0x57e0('0x17')],_0x11db5d);_0x5db704(_0x1ff278[_0x57e0('0x15')](0x1f4,_0x49154f['message']));});});}; \ No newline at end of file +var _0xea6b=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','limit','include','map','model','ShowVoiceQueue','find'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xea6b,0x15f));var _0xbea6=function(_0x2a532e,_0x58c1d4){_0x2a532e=_0x2a532e-0x0;var _0x8fd800=_0xea6b[_0x2a532e];return _0x8fd800;};'use strict';var _=require(_0xbea6('0x0'));var util=require(_0xbea6('0x1'));var moment=require(_0xbea6('0x2'));var BPromise=require('bluebird');var rs=require(_0xbea6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbea6('0x4'))['db'];var utils=require(_0xbea6('0x5'));var logger=require(_0xbea6('0x6'))(_0xbea6('0x7'));var config=require('../../config/environment');var jayson=require(_0xbea6('0x8'));var client=jayson[_0xbea6('0x9')]['http']({'port':0x232a});config[_0xbea6('0xa')]=_[_0xbea6('0xb')](config[_0xbea6('0xa')],{'host':_0xbea6('0xc'),'port':0x18eb});var socket=require(_0xbea6('0xd'))(new Redis(config[_0xbea6('0xa')]));require(_0xbea6('0xe'))[_0xbea6('0xf')](socket);function respondWithRpcPromise(_0x2c2436,_0x3044d0,_0x1a9d1b){return new BPromise(function(_0xd803e8,_0x5e6c0f){return client[_0xbea6('0x10')](_0x2c2436,_0x1a9d1b)[_0xbea6('0x11')](function(_0x6f62d6){logger[_0xbea6('0x12')](_0xbea6('0x13'),_0x3044d0,'request\x20sent');logger[_0xbea6('0x14')](_0xbea6('0x15'),_0x3044d0,_0xbea6('0x16'),JSON[_0xbea6('0x17')](_0x6f62d6));if(_0x6f62d6[_0xbea6('0x18')]){if(_0x6f62d6['error']['code']===0x1f4){logger[_0xbea6('0x18')](_0xbea6('0x13'),_0x3044d0,_0x6f62d6[_0xbea6('0x18')][_0xbea6('0x19')]);return _0x5e6c0f(_0x6f62d6[_0xbea6('0x18')][_0xbea6('0x19')]);}logger[_0xbea6('0x18')](_0xbea6('0x13'),_0x3044d0,_0x6f62d6[_0xbea6('0x18')][_0xbea6('0x19')]);return _0xd803e8(_0x6f62d6[_0xbea6('0x18')]['message']);}else{logger[_0xbea6('0x12')](_0xbea6('0x13'),_0x3044d0,_0xbea6('0x16'));_0xd803e8(_0x6f62d6['result']['message']);}})[_0xbea6('0x1a')](function(_0x383179){logger[_0xbea6('0x18')](_0xbea6('0x13'),_0x3044d0,_0x383179);_0x5e6c0f(_0x383179);});});}exports[_0xbea6('0x1b')]=function(_0x5372a9){var _0x186973=this;return new Promise(function(_0xcc3898,_0xe97bf2){return db[_0xbea6('0x1c')][_0xbea6('0x1d')]({'raw':_0x5372a9[_0xbea6('0x1e')]?_0x5372a9['options'][_0xbea6('0x1f')]===undefined?!![]:![]:!![],'where':_0x5372a9[_0xbea6('0x1e')]?_0x5372a9[_0xbea6('0x1e')]['where']||null:null,'attributes':_0x5372a9[_0xbea6('0x1e')]?_0x5372a9['options'][_0xbea6('0x20')]||null:null,'limit':_0x5372a9[_0xbea6('0x1e')]?_0x5372a9[_0xbea6('0x1e')][_0xbea6('0x21')]||null:null,'include':_0x5372a9[_0xbea6('0x1e')]?_0x5372a9[_0xbea6('0x1e')][_0xbea6('0x22')]?_[_0xbea6('0x23')](_0x5372a9['options']['include'],function(_0x4f6e5c){return{'model':db[_0x4f6e5c['model']],'as':_0x4f6e5c['as'],'attributes':_0x4f6e5c['attributes'],'include':_0x4f6e5c[_0xbea6('0x22')]?_[_0xbea6('0x23')](_0x4f6e5c['include'],function(_0x4fb264){return{'model':db[_0x4fb264[_0xbea6('0x24')]],'as':_0x4fb264['as'],'attributes':_0x4fb264['attributes'],'include':_0x4fb264['include']?_['map'](_0x4fb264[_0xbea6('0x22')],function(_0x4c893a){return{'model':db[_0x4c893a[_0xbea6('0x24')]],'as':_0x4c893a['as'],'attributes':_0x4c893a[_0xbea6('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbea6('0x11')](function(_0x52bb77){logger['info'](_0xbea6('0x1b'),_0x5372a9);logger[_0xbea6('0x14')](_0xbea6('0x1b'),_0x5372a9,JSON[_0xbea6('0x17')](_0x52bb77));_0xcc3898(_0x52bb77);})[_0xbea6('0x1a')](function(_0x3c41e8){logger[_0xbea6('0x18')]('GetVoiceQueue',_0x3c41e8[_0xbea6('0x19')],_0x5372a9);_0xe97bf2(_0x186973[_0xbea6('0x18')](0x1f4,_0x3c41e8[_0xbea6('0x19')]));});});};exports[_0xbea6('0x25')]=function(_0x443885){var _0x42dfc6=this;return new Promise(function(_0x17d3ba,_0x170f20){return db['VoiceQueue'][_0xbea6('0x26')]({'raw':_0x443885['options']?_0x443885[_0xbea6('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x443885['options']?_0x443885[_0xbea6('0x1e')]['where']||null:null,'attributes':_0x443885[_0xbea6('0x1e')]?_0x443885['options'][_0xbea6('0x20')]||null:null,'include':_0x443885[_0xbea6('0x1e')]?_0x443885[_0xbea6('0x1e')][_0xbea6('0x22')]?_[_0xbea6('0x23')](_0x443885['options'][_0xbea6('0x22')],function(_0x23d6b1){return{'model':db[_0x23d6b1[_0xbea6('0x24')]],'as':_0x23d6b1['as'],'attributes':_0x23d6b1['attributes'],'include':_0x23d6b1[_0xbea6('0x22')]?_['map'](_0x23d6b1[_0xbea6('0x22')],function(_0x6f57ef){return{'model':db[_0x6f57ef[_0xbea6('0x24')]],'as':_0x6f57ef['as'],'attributes':_0x6f57ef[_0xbea6('0x20')],'include':_0x6f57ef[_0xbea6('0x22')]?_[_0xbea6('0x23')](_0x6f57ef[_0xbea6('0x22')],function(_0x2df462){return{'model':db[_0x2df462[_0xbea6('0x24')]],'as':_0x2df462['as'],'attributes':_0x2df462['attributes']};}):[]};}):[]};}):[]:[]})[_0xbea6('0x11')](function(_0x407284){logger['info'](_0xbea6('0x25'),_0x443885);logger[_0xbea6('0x14')](_0xbea6('0x25'),_0x443885,JSON[_0xbea6('0x17')](_0x407284));_0x17d3ba(_0x407284);})[_0xbea6('0x1a')](function(_0x4c0173){logger[_0xbea6('0x18')](_0xbea6('0x25'),_0x4c0173[_0xbea6('0x19')],_0x443885);_0x170f20(_0x42dfc6[_0xbea6('0x18')](0x1f4,_0x4c0173['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 85cbc77..bac6a55 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 _0x976b=['removeListener','length','voiceQueue:','./voiceQueue.events','remove','update','emit'];(function(_0x43c7a0,_0x302a63){var _0x56ac52=function(_0x26930b){while(--_0x26930b){_0x43c7a0['push'](_0x43c7a0['shift']());}};_0x56ac52(++_0x302a63);}(_0x976b,0x10d));var _0xb976=function(_0x39de09,_0x3e99a7){_0x39de09=_0x39de09-0x0;var _0x4c268b=_0x976b[_0x39de09];return _0x4c268b;};'use strict';var VoiceQueueEvents=require(_0xb976('0x0'));var events=['save',_0xb976('0x1'),_0xb976('0x2')];function createListener(_0x5cb335,_0x56b80e){return function(_0xfa1754){_0x56b80e[_0xb976('0x3')](_0x5cb335,_0xfa1754);};}function removeListener(_0x133816,_0x1665a4){return function(){VoiceQueueEvents[_0xb976('0x4')](_0x133816,_0x1665a4);};}exports['register']=function(_0x391c51){for(var _0xaa4036=0x0,_0x58dbf6=events[_0xb976('0x5')];_0xaa4036<_0x58dbf6;_0xaa4036++){var _0xa61774=events[_0xaa4036];var _0x2703ea=createListener(_0xb976('0x6')+_0xa61774,_0x391c51);VoiceQueueEvents['on'](_0xa61774,_0x2703ea);}}; \ No newline at end of file +var _0x31ec=['removeListener','length','./voiceQueue.events','save','update','emit'];(function(_0x95411e,_0x38b4c3){var _0x2c8718=function(_0x35c672){while(--_0x35c672){_0x95411e['push'](_0x95411e['shift']());}};_0x2c8718(++_0x38b4c3);}(_0x31ec,0x110));var _0xc31e=function(_0x29874a,_0x134554){_0x29874a=_0x29874a-0x0;var _0x56ea85=_0x31ec[_0x29874a];return _0x56ea85;};'use strict';var VoiceQueueEvents=require(_0xc31e('0x0'));var events=[_0xc31e('0x1'),'remove',_0xc31e('0x2')];function createListener(_0x3210e9,_0x198cc9){return function(_0x53a9e7){_0x198cc9[_0xc31e('0x3')](_0x3210e9,_0x53a9e7);};}function removeListener(_0x231fd4,_0x3ca301){return function(){VoiceQueueEvents[_0xc31e('0x4')](_0x231fd4,_0x3ca301);};}exports['register']=function(_0x47ce5c){for(var _0x392369=0x0,_0x5efd84=events[_0xc31e('0x5')];_0x392369<_0x5efd84;_0x392369++){var _0x53043f=events[_0x392369];var _0x399ce7=createListener('voiceQueue:'+_0x53043f,_0x47ce5c);VoiceQueueEvents['on'](_0x53043f,_0x399ce7);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index cae01b9..2a89ceb 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 _0xdb8b=['update','destroy','util','path','connect-timeout','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0xfcf1b3,_0x27ceb5){_0xfcf1b3=_0xfcf1b3-0x0;var _0x4abcde=_0xdb8b[_0xfcf1b3];return _0x4abcde;};'use strict';var multer=require('multer');var util=require(_0xbdb8('0x0'));var path=require(_0xbdb8('0x1'));var timeout=require(_0xbdb8('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xbdb8('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xbdb8('0x4'));var controller=require(_0xbdb8('0x5'));router[_0xbdb8('0x6')]('/',auth[_0xbdb8('0x7')](),controller['index']);router[_0xbdb8('0x6')]('/describe',auth[_0xbdb8('0x7')](),controller[_0xbdb8('0x8')]);router[_0xbdb8('0x6')](_0xbdb8('0x9'),auth[_0xbdb8('0x7')](),controller[_0xbdb8('0xa')]);router['get'](_0xbdb8('0xb'),auth[_0xbdb8('0x7')](),controller[_0xbdb8('0xc')]);router[_0xbdb8('0xd')]('/',auth[_0xbdb8('0x7')](),controller[_0xbdb8('0xe')]);router[_0xbdb8('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xbdb8('0x10')]);router['delete'](_0xbdb8('0xb'),auth['isAuthenticated'](),controller[_0xbdb8('0x11')]);module['exports']=router; \ No newline at end of file +var _0xf562=['../../config/environment','get','index','/describe','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x20cc29,_0x30a46d){var _0x28d513=function(_0x179b06){while(--_0x179b06){_0x20cc29['push'](_0x20cc29['shift']());}};_0x28d513(++_0x30a46d);}(_0xf562,0x100));var _0x2f56=function(_0x35c030,_0x4d1d94){_0x35c030=_0x35c030-0x0;var _0x3c829a=_0xf562[_0x35c030];return _0x3c829a;};'use strict';var multer=require(_0x2f56('0x0'));var util=require(_0x2f56('0x1'));var path=require(_0x2f56('0x2'));var timeout=require(_0x2f56('0x3'));var express=require(_0x2f56('0x4'));var router=express[_0x2f56('0x5')]();var auth=require(_0x2f56('0x6'));var interaction=require(_0x2f56('0x7'));var config=require(_0x2f56('0x8'));var controller=require('./voiceQueueReport.controller');router[_0x2f56('0x9')]('/',auth['isAuthenticated'](),controller[_0x2f56('0xa')]);router['get'](_0x2f56('0xb'),auth[_0x2f56('0xc')](),controller[_0x2f56('0xd')]);router[_0x2f56('0x9')](_0x2f56('0xe'),auth[_0x2f56('0xc')](),controller[_0x2f56('0xf')]);router[_0x2f56('0x9')](_0x2f56('0x10'),auth['isAuthenticated'](),controller[_0x2f56('0x11')]);router[_0x2f56('0x12')]('/',auth['isAuthenticated'](),controller[_0x2f56('0x13')]);router[_0x2f56('0x14')]('/:id',auth[_0x2f56('0xc')](),controller['update']);router[_0x2f56('0x15')]('/:id',auth[_0x2f56('0xc')](),controller[_0x2f56('0x16')]);module[_0x2f56('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index d921cd9..a196261 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 _0xeb3b=['setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds'];(function(_0x5f3f76,_0x307789){var _0x6e992c=function(_0x526049){while(--_0x526049){_0x5f3f76['push'](_0x5f3f76['shift']());}};_0x6e992c(++_0x307789);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x1ca890,_0x21d0d3){_0x1ca890=_0x1ca890-0x0;var _0x3f8e01=_0xeb3b[_0x1ca890];return _0x3f8e01;};'use strict';var Sequelize=require(_0xbeb3('0x0'));var moment=require(_0xbeb3('0x1'));module[_0xbeb3('0x2')]={'type':{'type':Sequelize[_0xbeb3('0x3')]},'uniqueid':{'type':Sequelize[_0xbeb3('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xbeb3('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0xbeb3('0x4')],'set':function(_0x4852ca){var _0x2e8a69=moment(_0x4852ca);var _0x5ae6f9=moment(this[_0xbeb3('0x5')](_0xbeb3('0x6')))[_0xbeb3('0x7')](_0xbeb3('0x8'));var _0x5a6a06=_0x2e8a69[_0xbeb3('0x9')](_0x5ae6f9,_0xbeb3('0xa'));this[_0xbeb3('0xb')](_0xbeb3('0xc'),_0x4852ca);this[_0xbeb3('0xb')](_0xbeb3('0xd'),_0x5a6a06||null);}},'position':{'type':Sequelize[_0xbeb3('0xe')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xbeb3('0xf')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xbeb3('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xbeb3('0x4')]},'queuecallerexit':{'type':Sequelize[_0xbeb3('0xf')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xbeb3('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0xbeb3('0x3')],'comment':_0xbeb3('0x10')},'originalposition':{'type':Sequelize[_0xbeb3('0xe')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xbeb3('0x3')]},'accountcode':{'type':Sequelize[_0xbeb3('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xbeb3('0x3')]},'holdtime':{'type':Sequelize[_0xbeb3('0xe')]},'mohtime':{'type':Sequelize[_0xbeb3('0xe')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xbeb3('0xf')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xbeb3('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xbeb3('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xbeb3('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5ceb=['sequelize','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x2bcd1f,_0x4f1972){var _0x2381ca=function(_0x51f935){while(--_0x51f935){_0x2bcd1f['push'](_0x2bcd1f['shift']());}};_0x2381ca(++_0x4f1972);}(_0x5ceb,0x90));var _0xb5ce=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x5ceb[_0x1573ea];return _0x51c0e2;};'use strict';var Sequelize=require(_0xb5ce('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0xb5ce('0x1')]},'uniqueid':{'type':Sequelize[_0xb5ce('0x1')]},'calleridnum':{'type':Sequelize[_0xb5ce('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xb5ce('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0xb5ce('0x2')],'set':function(_0x204119){var _0xe4ff5e=moment(_0x204119);var _0x4d672d=moment(this[_0xb5ce('0x3')](_0xb5ce('0x4')))[_0xb5ce('0x5')](_0xb5ce('0x6'));var _0x19ef94=_0xe4ff5e[_0xb5ce('0x7')](_0x4d672d,_0xb5ce('0x8'));this[_0xb5ce('0x9')](_0xb5ce('0xa'),_0x204119);this['setDataValue'](_0xb5ce('0xb'),_0x19ef94||null);}},'position':{'type':Sequelize[_0xb5ce('0xc')]},'count':{'type':Sequelize[_0xb5ce('0xc')]},'queuecallerabandon':{'type':Sequelize[_0xb5ce('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xb5ce('0x2')]},'queuecallercomplete':{'type':Sequelize[_0xb5ce('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xb5ce('0x2')]},'queuecallerexit':{'type':Sequelize[_0xb5ce('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xb5ce('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0xb5ce('0x1')],'comment':_0xb5ce('0xe')},'originalposition':{'type':Sequelize[_0xb5ce('0xc')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xb5ce('0x1')]},'connectedlinename':{'type':Sequelize[_0xb5ce('0x1')]},'accountcode':{'type':Sequelize[_0xb5ce('0x1')]},'context':{'type':Sequelize[_0xb5ce('0x1')]},'exten':{'type':Sequelize[_0xb5ce('0x1')]},'priority':{'type':Sequelize[_0xb5ce('0x1')]},'holdtime':{'type':Sequelize[_0xb5ce('0xc')]},'mohtime':{'type':Sequelize[_0xb5ce('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xb5ce('0x1')]},'transfer':{'type':Sequelize[_0xb5ce('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xb5ce('0x1')],'comment':_0xb5ce('0xf')},'transferexten':{'type':Sequelize[_0xb5ce('0x1')]},'transferuniqueid':{'type':Sequelize[_0xb5ce('0x1')]},'disposition':{'type':Sequelize[_0xb5ce('0x1')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 99c56e1..744cc5b 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(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x7a54,0x106));var _0x47a5=function(_0x1a734d,_0x4a0571){_0x1a734d=_0x1a734d-0x0;var _0x3efa8d=_0x7a54[_0x1a734d];return _0x3efa8d;};'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 _0x9957=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','set','json','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','VoiceQueueReport','count','include','catch','show','params','keys','length','includeAll','find','create','body','describe','getVoiceQueuesReport','fields','limit','rows','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x2b4e94,_0x2233dd){_0x2233dd=_0x2233dd||0xcc;return function(_0x24b5bb){if(_0x24b5bb){return _0x2b4e94[_0x7995('0x1e')](_0x2233dd);}return _0x2b4e94[_0x7995('0x1f')](_0x2233dd)[_0x7995('0x20')]();};}function respondWithResult(_0x2202ce,_0x41cbf0){_0x41cbf0=_0x41cbf0||0xc8;return function(_0x5377e5){if(_0x5377e5){return _0x2202ce[_0x7995('0x1f')](_0x41cbf0)['json'](_0x5377e5);}};}function respondWithFilteredResult(_0x2f832e,_0x37f297){return function(_0x43d4b8){if(_0x43d4b8){var _0x291317=_0x43d4b8['count'],_0x1e1415=_0x37f297[_0x7995('0x21')],_0x37a7d4=_0x37f297['offset']+_0x37f297['limit'],_0x4faa60;if(_0x37a7d4>=_0x291317){_0x37a7d4=_0x291317;_0x4faa60=0xc8;}else{_0x4faa60=0xce;}_0x2f832e[_0x7995('0x1f')](_0x4faa60);return _0x2f832e[_0x7995('0x22')]('Content-Range',_0x1e1415+'-'+_0x37a7d4+'/'+_0x291317)[_0x7995('0x23')](_0x43d4b8);}return null;};}function patchUpdates(_0x51f276){return function(_0x4b1a8e){try{jsonpatch[_0x7995('0x24')](_0x4b1a8e,_0x51f276,!![]);}catch(_0x327b1f){return BPromise[_0x7995('0x25')](_0x327b1f);}return _0x4b1a8e[_0x7995('0x26')]();};}function saveUpdates(_0x460924,_0x1c278a){return function(_0x5d40ae){if(_0x5d40ae){return _0x5d40ae[_0x7995('0x27')](_0x460924)[_0x7995('0x28')](function(_0x204507){return _0x204507;});}return null;};}function removeEntity(_0x285437,_0x563799){return function(_0x13bc35){if(_0x13bc35){return _0x13bc35[_0x7995('0x29')]()[_0x7995('0x28')](function(){_0x285437['status'](0xcc)[_0x7995('0x20')]();});}};}function handleEntityNotFound(_0x34e70c,_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x34e70c[_0x7995('0x1e')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x2a')]);if(_0x47625f[_0x7995('0x2b')]){delete _0x47625f[_0x7995('0x2b')];}_0x2a307e[_0x7995('0x1f')](_0x56691a)[_0x7995('0x2c')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={},_0x3250e0={},_0x4253e5={'count':0x0,'rows':[]};var _0x574574=_['map'](db['VoiceQueueReport'][_0x7995('0x2d')],function(_0xe6b0b3){return{'name':_0xe6b0b3[_0x7995('0x2e')],'type':_0xe6b0b3[_0x7995('0x2f')][_0x7995('0x30')]};});_0x3250e0[_0x7995('0x31')]=_['map'](_0x574574,'name');_0x3250e0[_0x7995('0x32')]=_['keys'](_0x9b2a15[_0x7995('0x32')]);_0x3250e0[_0x7995('0x33')]=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],_0x3250e0[_0x7995('0x32')]);_0x456a28['attributes']=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],qs['fields'](_0x9b2a15['query']['fields']));_0x456a28[_0x7995('0x35')]=_0x456a28[_0x7995('0x35')]['length']?_0x456a28[_0x7995('0x35')]:_0x3250e0['model'];if(!_0x9b2a15[_0x7995('0x32')][_0x7995('0x36')](_0x7995('0x37'))){_0x456a28['limit']=qs['limit'](_0x9b2a15[_0x7995('0x32')]['limit']);_0x456a28['offset']=qs[_0x7995('0x21')](_0x9b2a15[_0x7995('0x32')]['offset']);}_0x456a28[_0x7995('0x38')]=qs[_0x7995('0x39')](_0x9b2a15[_0x7995('0x32')][_0x7995('0x39')]);_0x456a28[_0x7995('0x3a')]=qs['filters'](_[_0x7995('0x3b')](_0x9b2a15[_0x7995('0x32')],_0x3250e0[_0x7995('0x33')]),_0x574574);if(_0x9b2a15[_0x7995('0x32')]['filter']){_0x456a28[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x456a28[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x574574,function(_0x1f5bee){if(_0x1f5bee[_0x7995('0x2f')]!=='VIRTUAL'){var _0x183a68={};_0x183a68[_0x1f5bee[_0x7995('0x2b')]]={'$like':'%'+_0x9b2a15[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x183a68;}})});}_0x456a28=_[_0x7995('0x3c')]({},_0x456a28,_0x9b2a15[_0x7995('0x3f')]);var _0x14d638={'where':_0x456a28[_0x7995('0x3a')]};return db[_0x7995('0x40')][_0x7995('0x41')](_0x14d638)[_0x7995('0x28')](function(_0x270d52){_0x4253e5[_0x7995('0x41')]=_0x270d52;if(_0x9b2a15['query']['includeAll']){_0x456a28[_0x7995('0x42')]=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x456a28);})['then'](function(_0x3f8522){_0x4253e5['rows']=_0x3f8522;return _0x4253e5;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x43')](handleError(_0x514445,null));};exports[_0x7995('0x44')]=function(_0x35c8ff,_0x576b96){var _0x46ac4f={'raw':![],'where':{'id':_0x35c8ff[_0x7995('0x45')]['id']}},_0x5e85b9={};_0x5e85b9['model']=_['keys'](db[_0x7995('0x40')][_0x7995('0x2d')]);_0x5e85b9[_0x7995('0x32')]=_[_0x7995('0x46')](_0x35c8ff['query']);_0x5e85b9[_0x7995('0x33')]=_[_0x7995('0x34')](_0x5e85b9[_0x7995('0x31')],_0x5e85b9[_0x7995('0x32')]);_0x46ac4f['attributes']=_['intersection'](_0x5e85b9[_0x7995('0x31')],qs['fields'](_0x35c8ff[_0x7995('0x32')]['fields']));_0x46ac4f[_0x7995('0x35')]=_0x46ac4f['attributes'][_0x7995('0x47')]?_0x46ac4f[_0x7995('0x35')]:_0x5e85b9['model'];if(_0x35c8ff[_0x7995('0x32')][_0x7995('0x48')]){_0x46ac4f[_0x7995('0x42')]=[{'all':!![]}];}_0x46ac4f=_[_0x7995('0x3c')]({},_0x46ac4f,_0x35c8ff['options']);return db[_0x7995('0x40')][_0x7995('0x49')](_0x46ac4f)[_0x7995('0x28')](handleEntityNotFound(_0x576b96,null))['then'](respondWithResult(_0x576b96,null))[_0x7995('0x43')](handleError(_0x576b96,null));};exports[_0x7995('0x4a')]=function(_0x511567,_0x3d8ae3){return db[_0x7995('0x40')]['create'](_0x511567[_0x7995('0x4b')],{})[_0x7995('0x28')](respondWithResult(_0x3d8ae3,0xc9))['catch'](handleError(_0x3d8ae3,null));};exports[_0x7995('0x27')]=function(_0x5843ba,_0x1d87f9){if(_0x5843ba[_0x7995('0x4b')]['id']){delete _0x5843ba[_0x7995('0x4b')]['id'];}return db[_0x7995('0x40')][_0x7995('0x49')]({'where':{'id':_0x5843ba[_0x7995('0x45')]['id']}})[_0x7995('0x28')](handleEntityNotFound(_0x1d87f9,null))['then'](saveUpdates(_0x5843ba[_0x7995('0x4b')],null))[_0x7995('0x28')](respondWithResult(_0x1d87f9,null))[_0x7995('0x43')](handleError(_0x1d87f9,null));};exports['destroy']=function(_0x19da63,_0x1fe77e){return db[_0x7995('0x40')]['find']({'where':{'id':_0x19da63['params']['id']}})['then'](handleEntityNotFound(_0x1fe77e,null))[_0x7995('0x28')](removeEntity(_0x1fe77e,null))[_0x7995('0x43')](handleError(_0x1fe77e,null));};exports['describe']=function(_0x1cd85,_0x29f300){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x28')](respondWithResult(_0x29f300,null))['catch'](handleError(_0x29f300,null));};exports[_0x7995('0x4d')]=function(_0x4ab09f,_0x14fe7f){var _0x33c801={},_0x206d2a={},_0x50c7b5={'count':0x0,'rows':[]};_0x206d2a['model']=_['keys'](db['VoiceQueueReport'][_0x7995('0x2d')]);_0x206d2a[_0x7995('0x32')]=_[_0x7995('0x46')](_0x4ab09f[_0x7995('0x32')]);_0x206d2a[_0x7995('0x33')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],_0x206d2a[_0x7995('0x32')]);_0x33c801[_0x7995('0x35')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],qs[_0x7995('0x4e')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x4e')]));_0x33c801[_0x7995('0x35')]=_0x33c801[_0x7995('0x35')][_0x7995('0x47')]?_0x33c801[_0x7995('0x35')]:_0x206d2a[_0x7995('0x31')];if(!_0x4ab09f['query'][_0x7995('0x36')](_0x7995('0x37'))){_0x33c801[_0x7995('0x4f')]=qs[_0x7995('0x4f')](_0x4ab09f['query']['limit']);_0x33c801[_0x7995('0x21')]=qs[_0x7995('0x21')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x21')]);}_0x33c801['order']=qs[_0x7995('0x39')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x39')]);_0x33c801[_0x7995('0x3a')]=qs['filters'](_['pick'](_0x4ab09f[_0x7995('0x32')],_0x206d2a[_0x7995('0x33')]));if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]){_0x33c801[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x33c801[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x33c801[_0x7995('0x35')],function(_0x50caf5){var _0x18f230={};_0x18f230[_0x50caf5]={'$like':'%'+_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x18f230;})});}_0x33c801=_[_0x7995('0x3c')]({},_0x33c801,_0x4ab09f['options']);var _0x51bf6a={'where':_0x33c801[_0x7995('0x3a')]};return db[_0x7995('0x40')]['count'](_0x51bf6a)[_0x7995('0x28')](function(_0x375fc9){_0x50c7b5[_0x7995('0x41')]=_0x375fc9;if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x48')]){_0x33c801['include']=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x33c801);})[_0x7995('0x28')](function(_0xe31dcb){_0x50c7b5[_0x7995('0x50')]=_0xe31dcb;return _0x50c7b5;})[_0x7995('0x28')](respondWithFilteredResult(_0x14fe7f,_0x33c801,_0x7995('0x4d')))[_0x7995('0x43')](handleError(_0x14fe7f,null,_0x7995('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index a8586a0..e3ce424 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 _0xb9d6=['hook','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit'];(function(_0x45a1bf,_0x3b43ae){var _0x17a06e=function(_0x188dfc){while(--_0x188dfc){_0x45a1bf['push'](_0x45a1bf['shift']());}};_0x17a06e(++_0x3b43ae);}(_0xb9d6,0x1d5));var _0x6b9d=function(_0x1c7377,_0x8a8698){_0x1c7377=_0x1c7377-0x0;var _0x5d03e3=_0xb9d6[_0x1c7377];return _0x5d03e3;};'use strict';var EventEmitter=require(_0x6b9d('0x0'));var VoiceQueueReport=require(_0x6b9d('0x1'))['db'][_0x6b9d('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x6b9d('0x3')](0x0);var events={'afterCreate':_0x6b9d('0x4'),'afterUpdate':_0x6b9d('0x5'),'afterDestroy':_0x6b9d('0x6')};function emitEvent(_0x3ef192){return function(_0x1872ed,_0x451f15,_0x46e0f0){VoiceQueueReportEvents[_0x6b9d('0x7')](_0x3ef192+':'+_0x1872ed['id'],_0x1872ed);VoiceQueueReportEvents[_0x6b9d('0x7')](_0x3ef192,_0x1872ed);_0x46e0f0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x6b9d('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x3aa4=['VoiceQueueReport','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3aa4,0x181));var _0x43aa=function(_0x3ca737,_0x2dff66){_0x3ca737=_0x3ca737-0x0;var _0x7ac339=_0x3aa4[_0x3ca737];return _0x7ac339;};'use strict';var EventEmitter=require(_0x43aa('0x0'));var VoiceQueueReport=require(_0x43aa('0x1'))['db'][_0x43aa('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x43aa('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x43aa('0x4'),'afterDestroy':_0x43aa('0x5')};function emitEvent(_0x2cb9f7){return function(_0x2f06e8,_0x42f0fd,_0x498f40){VoiceQueueReportEvents['emit'](_0x2cb9f7+':'+_0x2f06e8['id'],_0x2f06e8);VoiceQueueReportEvents[_0x43aa('0x6')](_0x2cb9f7,_0x2f06e8);_0x498f40(null);};}for(var e in events){if(events[_0x43aa('0x7')](e)){var event=events[e];VoiceQueueReport[_0x43aa('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 3f9f64b..014c20e 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 _0x0fb2=['report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceQueueReport'];(function(_0x285db,_0x4f4926){var _0x2ebec6=function(_0x3a08c3){while(--_0x3a08c3){_0x285db['push'](_0x285db['shift']());}};_0x2ebec6(++_0x4f4926);}(_0x0fb2,0xa3));var _0x20fb=function(_0x13843f,_0x50422d){_0x13843f=_0x13843f-0x0;var _0x1063ae=_0x0fb2[_0x13843f];return _0x1063ae;};'use strict';var _=require(_0x20fb('0x0'));var util=require(_0x20fb('0x1'));var logger=require(_0x20fb('0x2'))(_0x20fb('0x3'));var moment=require(_0x20fb('0x4'));var BPromise=require(_0x20fb('0x5'));var rp=require(_0x20fb('0x6'));var fs=require('fs');var path=require(_0x20fb('0x7'));var rimraf=require(_0x20fb('0x8'));var config=require(_0x20fb('0x9'));var attributes=require('./voiceQueueReport.attributes');module[_0x20fb('0xa')]=function(_0x123250,_0x2770b0){return _0x123250[_0x20fb('0xb')](_0x20fb('0xc'),attributes,{'tableName':_0x20fb('0xd'),'paranoid':![],'indexes':[{'fields':[_0x20fb('0xe')]},{'fields':[_0x20fb('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7710=['define','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x525813,_0x704d1a){var _0x1683f7=function(_0x3ef2b6){while(--_0x3ef2b6){_0x525813['push'](_0x525813['shift']());}};_0x1683f7(++_0x704d1a);}(_0x7710,0x15e));var _0x0771=function(_0x140931,_0x2ffeba){_0x140931=_0x140931-0x0;var _0x4718ab=_0x7710[_0x140931];return _0x4718ab;};'use strict';var _=require('lodash');var util=require(_0x0771('0x0'));var logger=require(_0x0771('0x1'))(_0x0771('0x2'));var moment=require(_0x0771('0x3'));var BPromise=require('bluebird');var rp=require(_0x0771('0x4'));var fs=require('fs');var path=require(_0x0771('0x5'));var rimraf=require(_0x0771('0x6'));var config=require(_0x0771('0x7'));var attributes=require(_0x0771('0x8'));module[_0x0771('0x9')]=function(_0x39342c,_0x3b2ef1){return _0x39342c[_0x0771('0xa')](_0x0771('0xb'),attributes,{'tableName':_0x0771('0xc'),'paranoid':![],'indexes':[{'fields':[_0x0771('0xd')]},{'fields':[_0x0771('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index bece04f..19b6a35 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 _0x6b19=['catch','create','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x1a7395,_0x24cd8b){var _0x16d4ee=function(_0x4fa5d4){while(--_0x4fa5d4){_0x1a7395['push'](_0x1a7395['shift']());}};_0x16d4ee(++_0x24cd8b);}(_0x6b19,0x165));var _0x96b1=function(_0x55d533,_0x71409e){_0x55d533=_0x55d533-0x0;var _0x31c425=_0x6b19[_0x55d533];return _0x31c425;};'use strict';var _=require(_0x96b1('0x0'));var util=require(_0x96b1('0x1'));var moment=require(_0x96b1('0x2'));var BPromise=require(_0x96b1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96b1('0x4'));var db=require(_0x96b1('0x5'))['db'];var utils=require(_0x96b1('0x6'));var logger=require(_0x96b1('0x7'))(_0x96b1('0x8'));var config=require(_0x96b1('0x9'));var jayson=require(_0x96b1('0xa'));var client=jayson[_0x96b1('0xb')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x96b1('0xc')],{'host':_0x96b1('0xd'),'port':0x18eb});var socket=require(_0x96b1('0xe'))(new Redis(config[_0x96b1('0xc')]));require(_0x96b1('0xf'))[_0x96b1('0x10')](socket);function respondWithRpcPromise(_0x160458,_0xa66fc6,_0x4161bb){return new BPromise(function(_0x2b3b48,_0xf4473f){return client[_0x96b1('0x11')](_0x160458,_0x4161bb)[_0x96b1('0x12')](function(_0x53c3d1){logger[_0x96b1('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0xa66fc6,_0x96b1('0x14'));logger[_0x96b1('0x15')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0xa66fc6,_0x96b1('0x14'),JSON[_0x96b1('0x16')](_0x53c3d1));if(_0x53c3d1[_0x96b1('0x17')]){if(_0x53c3d1['error'][_0x96b1('0x18')]===0x1f4){logger['error'](_0x96b1('0x19'),_0xa66fc6,_0x53c3d1[_0x96b1('0x17')]['message']);return _0xf4473f(_0x53c3d1[_0x96b1('0x17')]['message']);}logger[_0x96b1('0x17')](_0x96b1('0x19'),_0xa66fc6,_0x53c3d1[_0x96b1('0x17')][_0x96b1('0x1a')]);return _0x2b3b48(_0x53c3d1[_0x96b1('0x17')][_0x96b1('0x1a')]);}else{logger[_0x96b1('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0xa66fc6,_0x96b1('0x14'));_0x2b3b48(_0x53c3d1[_0x96b1('0x1b')]['message']);}})['catch'](function(_0x232fd9){logger[_0x96b1('0x17')](_0x96b1('0x19'),_0xa66fc6,_0x232fd9);_0xf4473f(_0x232fd9);});});}exports[_0x96b1('0x1c')]=function(_0x24f8f7){var _0xb5d073=this;return new Promise(function(_0x18193e,_0x1a9849){return db[_0x96b1('0x1d')][_0x96b1('0x1e')]({'raw':_0x24f8f7[_0x96b1('0x1f')]?_0x24f8f7[_0x96b1('0x1f')][_0x96b1('0x20')]===undefined?!![]:![]:!![],'where':_0x24f8f7[_0x96b1('0x1f')]?_0x24f8f7[_0x96b1('0x1f')][_0x96b1('0x21')]||null:null,'attributes':_0x24f8f7[_0x96b1('0x1f')]?_0x24f8f7[_0x96b1('0x1f')][_0x96b1('0x22')]||null:null,'limit':_0x24f8f7[_0x96b1('0x1f')]?_0x24f8f7[_0x96b1('0x1f')][_0x96b1('0x23')]||null:null,'include':_0x24f8f7[_0x96b1('0x1f')]?_0x24f8f7[_0x96b1('0x1f')][_0x96b1('0x24')]?_[_0x96b1('0x25')](_0x24f8f7[_0x96b1('0x1f')][_0x96b1('0x24')],function(_0x57027b){return{'model':db[_0x57027b[_0x96b1('0x26')]],'as':_0x57027b['as'],'attributes':_0x57027b[_0x96b1('0x22')],'include':_0x57027b['include']?_[_0x96b1('0x25')](_0x57027b[_0x96b1('0x24')],function(_0x54b1ff){return{'model':db[_0x54b1ff[_0x96b1('0x26')]],'as':_0x54b1ff['as'],'attributes':_0x54b1ff[_0x96b1('0x22')],'include':_0x54b1ff['include']?_[_0x96b1('0x25')](_0x54b1ff[_0x96b1('0x24')],function(_0x2fc1d3){return{'model':db[_0x2fc1d3[_0x96b1('0x26')]],'as':_0x2fc1d3['as'],'attributes':_0x2fc1d3[_0x96b1('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36569f){logger[_0x96b1('0x13')]('GetVoiceQueueReport',_0x24f8f7);logger[_0x96b1('0x15')](_0x96b1('0x1c'),_0x24f8f7,JSON[_0x96b1('0x16')](_0x36569f));_0x18193e(_0x36569f);})[_0x96b1('0x27')](function(_0x4b49ca){logger[_0x96b1('0x17')](_0x96b1('0x1c'),_0x4b49ca[_0x96b1('0x1a')],_0x24f8f7);_0x1a9849(_0xb5d073[_0x96b1('0x17')](0x1f4,_0x4b49ca[_0x96b1('0x1a')]));});});};exports['CreateVoiceQueueReport']=function(_0x12b860){var _0xe4991f=this;return new Promise(function(_0x14339d,_0x5d3edd){return db['VoiceQueueReport'][_0x96b1('0x28')](_0x12b860[_0x96b1('0x29')],{'raw':_0x12b860[_0x96b1('0x1f')]?_0x12b860['options'][_0x96b1('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x57b758){logger[_0x96b1('0x13')](_0x96b1('0x2a'),_0x12b860);logger[_0x96b1('0x15')](_0x96b1('0x2a'),_0x12b860,JSON[_0x96b1('0x16')](_0x57b758));_0x14339d(_0x57b758);})[_0x96b1('0x27')](function(_0x8d0f6a){logger['error']('CreateVoiceQueueReport',_0x8d0f6a[_0x96b1('0x1a')],_0x12b860);_0x5d3edd(_0xe4991f[_0x96b1('0x17')](0x1f4,_0x8d0f6a[_0x96b1('0x1a')]));});});};exports[_0x96b1('0x2b')]=function(_0x365842){var _0x49fd56=this;return new Promise(function(_0x533147,_0x1f989f){return db[_0x96b1('0x1d')]['update'](_0x365842[_0x96b1('0x29')],{'raw':_0x365842[_0x96b1('0x1f')]?_0x365842[_0x96b1('0x1f')][_0x96b1('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x365842['options']?_0x365842[_0x96b1('0x1f')]['where']||null:null,'attributes':_0x365842[_0x96b1('0x1f')]?_0x365842[_0x96b1('0x1f')][_0x96b1('0x22')]||null:null,'limit':_0x365842[_0x96b1('0x1f')]?_0x365842[_0x96b1('0x1f')][_0x96b1('0x23')]||null:null})[_0x96b1('0x12')](function(_0x2f0acb){logger['info'](_0x96b1('0x2b'),_0x365842);logger[_0x96b1('0x15')](_0x96b1('0x2b'),_0x365842,JSON['stringify'](_0x2f0acb));_0x533147(_0x2f0acb);})['catch'](function(_0x2eb699){logger[_0x96b1('0x17')](_0x96b1('0x2b'),_0x2eb699[_0x96b1('0x1a')],_0x365842);_0x1f989f(_0x49fd56['error'](0x1f4,_0x2eb699[_0x96b1('0x1a')]));});});}; \ No newline at end of file +var _0x4a59=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','include','map','model','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','update','limit'];(function(_0x4997b0,_0x593ebd){var _0x566238=function(_0x40231b){while(--_0x40231b){_0x4997b0['push'](_0x4997b0['shift']());}};_0x566238(++_0x593ebd);}(_0x4a59,0x10e));var _0x94a5=function(_0x4e7c5e,_0x369004){_0x4e7c5e=_0x4e7c5e-0x0;var _0x1ec6fa=_0x4a59[_0x4e7c5e];return _0x1ec6fa;};'use strict';var _=require(_0x94a5('0x0'));var util=require(_0x94a5('0x1'));var moment=require(_0x94a5('0x2'));var BPromise=require(_0x94a5('0x3'));var rs=require(_0x94a5('0x4'));var fs=require('fs');var Redis=require(_0x94a5('0x5'));var db=require(_0x94a5('0x6'))['db'];var utils=require(_0x94a5('0x7'));var logger=require(_0x94a5('0x8'))(_0x94a5('0x9'));var config=require(_0x94a5('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x94a5('0xb')][_0x94a5('0xc')]({'port':0x232a});config['redis']=_[_0x94a5('0xd')](config[_0x94a5('0xe')],{'host':_0x94a5('0xf'),'port':0x18eb});var socket=require(_0x94a5('0x10'))(new Redis(config[_0x94a5('0xe')]));require(_0x94a5('0x11'))['register'](socket);function respondWithRpcPromise(_0x576476,_0x331a54,_0x483898){return new BPromise(function(_0x5b5fc7,_0x128ea7){return client[_0x94a5('0x12')](_0x576476,_0x483898)[_0x94a5('0x13')](function(_0x24d850){logger[_0x94a5('0x14')](_0x94a5('0x15'),_0x331a54,_0x94a5('0x16'));logger[_0x94a5('0x17')](_0x94a5('0x18'),_0x331a54,_0x94a5('0x16'),JSON[_0x94a5('0x19')](_0x24d850));if(_0x24d850[_0x94a5('0x1a')]){if(_0x24d850[_0x94a5('0x1a')]['code']===0x1f4){logger[_0x94a5('0x1a')]('VoiceQueueReport,\x20%s,\x20%s',_0x331a54,_0x24d850[_0x94a5('0x1a')][_0x94a5('0x1b')]);return _0x128ea7(_0x24d850['error'][_0x94a5('0x1b')]);}logger[_0x94a5('0x1a')](_0x94a5('0x15'),_0x331a54,_0x24d850[_0x94a5('0x1a')][_0x94a5('0x1b')]);return _0x5b5fc7(_0x24d850[_0x94a5('0x1a')][_0x94a5('0x1b')]);}else{logger[_0x94a5('0x14')](_0x94a5('0x15'),_0x331a54,'request\x20sent');_0x5b5fc7(_0x24d850[_0x94a5('0x1c')]['message']);}})[_0x94a5('0x1d')](function(_0x17a0e3){logger[_0x94a5('0x1a')]('VoiceQueueReport,\x20%s,\x20%s',_0x331a54,_0x17a0e3);_0x128ea7(_0x17a0e3);});});}exports[_0x94a5('0x1e')]=function(_0x53737d){var _0x38202d=this;return new Promise(function(_0x1db45f,_0x4054bd){return db[_0x94a5('0x1f')][_0x94a5('0x20')]({'raw':_0x53737d[_0x94a5('0x21')]?_0x53737d['options'][_0x94a5('0x22')]===undefined?!![]:![]:!![],'where':_0x53737d[_0x94a5('0x21')]?_0x53737d[_0x94a5('0x21')][_0x94a5('0x23')]||null:null,'attributes':_0x53737d['options']?_0x53737d[_0x94a5('0x21')][_0x94a5('0x24')]||null:null,'limit':_0x53737d[_0x94a5('0x21')]?_0x53737d[_0x94a5('0x21')]['limit']||null:null,'include':_0x53737d[_0x94a5('0x21')]?_0x53737d[_0x94a5('0x21')]['include']?_['map'](_0x53737d[_0x94a5('0x21')][_0x94a5('0x25')],function(_0x180be6){return{'model':db[_0x180be6['model']],'as':_0x180be6['as'],'attributes':_0x180be6['attributes'],'include':_0x180be6[_0x94a5('0x25')]?_[_0x94a5('0x26')](_0x180be6[_0x94a5('0x25')],function(_0x5e3097){return{'model':db[_0x5e3097['model']],'as':_0x5e3097['as'],'attributes':_0x5e3097[_0x94a5('0x24')],'include':_0x5e3097[_0x94a5('0x25')]?_['map'](_0x5e3097[_0x94a5('0x25')],function(_0x438830){return{'model':db[_0x438830[_0x94a5('0x27')]],'as':_0x438830['as'],'attributes':_0x438830[_0x94a5('0x24')]};}):[]};}):[]};}):[]:[]})[_0x94a5('0x13')](function(_0x5148bd){logger[_0x94a5('0x14')](_0x94a5('0x1e'),_0x53737d);logger[_0x94a5('0x17')]('GetVoiceQueueReport',_0x53737d,JSON[_0x94a5('0x19')](_0x5148bd));_0x1db45f(_0x5148bd);})[_0x94a5('0x1d')](function(_0x132c58){logger[_0x94a5('0x1a')](_0x94a5('0x1e'),_0x132c58['message'],_0x53737d);_0x4054bd(_0x38202d[_0x94a5('0x1a')](0x1f4,_0x132c58[_0x94a5('0x1b')]));});});};exports[_0x94a5('0x28')]=function(_0x231a96){var _0x115390=this;return new Promise(function(_0x259213,_0xcfdc1f){return db[_0x94a5('0x1f')]['create'](_0x231a96[_0x94a5('0x29')],{'raw':_0x231a96[_0x94a5('0x21')]?_0x231a96['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x9e699b){logger[_0x94a5('0x14')](_0x94a5('0x28'),_0x231a96);logger[_0x94a5('0x17')](_0x94a5('0x28'),_0x231a96,JSON[_0x94a5('0x19')](_0x9e699b));_0x259213(_0x9e699b);})[_0x94a5('0x1d')](function(_0x4a650d){logger['error'](_0x94a5('0x28'),_0x4a650d['message'],_0x231a96);_0xcfdc1f(_0x115390[_0x94a5('0x1a')](0x1f4,_0x4a650d[_0x94a5('0x1b')]));});});};exports[_0x94a5('0x2a')]=function(_0x2b13b6){var _0x358430=this;return new Promise(function(_0x373567,_0xc7ac2d){return db[_0x94a5('0x1f')][_0x94a5('0x2b')](_0x2b13b6[_0x94a5('0x29')],{'raw':_0x2b13b6[_0x94a5('0x21')]?_0x2b13b6['options'][_0x94a5('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b13b6[_0x94a5('0x21')]?_0x2b13b6['options'][_0x94a5('0x23')]||null:null,'attributes':_0x2b13b6[_0x94a5('0x21')]?_0x2b13b6[_0x94a5('0x21')][_0x94a5('0x24')]||null:null,'limit':_0x2b13b6[_0x94a5('0x21')]?_0x2b13b6[_0x94a5('0x21')][_0x94a5('0x2c')]||null:null})[_0x94a5('0x13')](function(_0x3c589a){logger[_0x94a5('0x14')](_0x94a5('0x2a'),_0x2b13b6);logger[_0x94a5('0x17')](_0x94a5('0x2a'),_0x2b13b6,JSON[_0x94a5('0x19')](_0x3c589a));_0x373567(_0x3c589a);})[_0x94a5('0x1d')](function(_0x346f5f){logger[_0x94a5('0x1a')]('UpdateVoiceQueueReport',_0x346f5f[_0x94a5('0x1b')],_0x2b13b6);_0xc7ac2d(_0x358430[_0x94a5('0x1a')](0x1f4,_0x346f5f['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 6c8333e..5004ae2 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 _0x7aa2=['update','removeListener','voiceQueueReport:','./voiceQueueReport.events','remove'];(function(_0x31247b,_0xede9e1){var _0x99045=function(_0x4a11cb){while(--_0x4a11cb){_0x31247b['push'](_0x31247b['shift']());}};_0x99045(++_0xede9e1);}(_0x7aa2,0xee));var _0x27aa=function(_0x571461,_0x6f7b6b){_0x571461=_0x571461-0x0;var _0x15abf5=_0x7aa2[_0x571461];return _0x15abf5;};'use strict';var VoiceQueueReportEvents=require(_0x27aa('0x0'));var events=['save',_0x27aa('0x1'),_0x27aa('0x2')];function createListener(_0x46e869,_0x1fb746){return function(_0xd0133f){_0x1fb746['emit'](_0x46e869,_0xd0133f);};}function removeListener(_0xe2143d,_0x43980a){return function(){VoiceQueueReportEvents[_0x27aa('0x3')](_0xe2143d,_0x43980a);};}exports['register']=function(_0x55ecb9){for(var _0x572780=0x0,_0x20d17b=events['length'];_0x572780<_0x20d17b;_0x572780++){var _0x391b3f=events[_0x572780];var _0xf16b20=createListener(_0x27aa('0x4')+_0x391b3f,_0x55ecb9);VoiceQueueReportEvents['on'](_0x391b3f,_0xf16b20);}}; \ No newline at end of file +var _0xaa3d=['removeListener','length','voiceQueueReport:','./voiceQueueReport.events','remove','update','emit'];(function(_0x188b3a,_0x4d2348){var _0x37bce4=function(_0x109ec3){while(--_0x109ec3){_0x188b3a['push'](_0x188b3a['shift']());}};_0x37bce4(++_0x4d2348);}(_0xaa3d,0x1c3));var _0xdaa3=function(_0xed0aa,_0x2de297){_0xed0aa=_0xed0aa-0x0;var _0x16d7da=_0xaa3d[_0xed0aa];return _0x16d7da;};'use strict';var VoiceQueueReportEvents=require(_0xdaa3('0x0'));var events=['save',_0xdaa3('0x1'),_0xdaa3('0x2')];function createListener(_0x3c4628,_0x39e9c9){return function(_0x400d94){_0x39e9c9[_0xdaa3('0x3')](_0x3c4628,_0x400d94);};}function removeListener(_0x3de239,_0x6f140c){return function(){VoiceQueueReportEvents[_0xdaa3('0x4')](_0x3de239,_0x6f140c);};}exports['register']=function(_0x596efd){for(var _0x5d8572=0x0,_0x30f622=events[_0xdaa3('0x5')];_0x5d8572<_0x30f622;_0x5d8572++){var _0x5169e3=events[_0x5d8572];var _0x17f1b2=createListener(_0xdaa3('0x6')+_0x5169e3,_0x596efd);VoiceQueueReportEvents['on'](_0x5169e3,_0x17f1b2);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index ebd45fb..f7a7f88 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 _0xd965=['get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd965,0xe7));var _0x5d96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd965[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5d96('0x0'));var util=require('util');var path=require(_0x5d96('0x1'));var timeout=require(_0x5d96('0x2'));var express=require(_0x5d96('0x3'));var router=express['Router']();var auth=require(_0x5d96('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5d96('0x5'));var controller=require(_0x5d96('0x6'));router[_0x5d96('0x7')]('/',auth[_0x5d96('0x8')](),controller[_0x5d96('0x9')]);router[_0x5d96('0x7')](_0x5d96('0xa'),auth['isAuthenticated'](),controller[_0x5d96('0xb')]);router[_0x5d96('0xc')]('/',auth[_0x5d96('0x8')](),controller[_0x5d96('0xd')]);router[_0x5d96('0xe')](_0x5d96('0xa'),auth[_0x5d96('0x8')](),controller[_0x5d96('0xf')]);router['delete'](_0x5d96('0xa'),auth[_0x5d96('0x8')](),controller[_0x5d96('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb368=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x3160da,_0x184cb0){var _0x3fa1b4=function(_0x565b0c){while(--_0x565b0c){_0x3160da['push'](_0x3160da['shift']());}};_0x3fa1b4(++_0x184cb0);}(_0xb368,0x165));var _0x8b36=function(_0x1d8c56,_0x3fd9dd){_0x1d8c56=_0x1d8c56-0x0;var _0x46617f=_0xb368[_0x1d8c56];return _0x46617f;};'use strict';var multer=require(_0x8b36('0x0'));var util=require(_0x8b36('0x1'));var path=require(_0x8b36('0x2'));var timeout=require(_0x8b36('0x3'));var express=require(_0x8b36('0x4'));var router=express[_0x8b36('0x5')]();var auth=require(_0x8b36('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8b36('0x7'));var controller=require(_0x8b36('0x8'));router[_0x8b36('0x9')]('/',auth[_0x8b36('0xa')](),controller[_0x8b36('0xb')]);router[_0x8b36('0x9')](_0x8b36('0xc'),auth['isAuthenticated'](),controller[_0x8b36('0xd')]);router[_0x8b36('0xe')]('/',auth[_0x8b36('0xa')](),controller[_0x8b36('0xf')]);router[_0x8b36('0x10')](_0x8b36('0xc'),auth[_0x8b36('0xa')](),controller[_0x8b36('0x11')]);router['delete'](_0x8b36('0xc'),auth[_0x8b36('0xa')](),controller[_0x8b36('0x12')]);module[_0x8b36('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 c4ebb16..9c709ab 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 _0x56aa=['YYYY-MM-DD\x20HH:mm:ss','moment','exports','STRING'];(function(_0x3c6ae2,_0x5c52d8){var _0x4edda=function(_0x5593eb){while(--_0x5593eb){_0x3c6ae2['push'](_0x3c6ae2['shift']());}};_0x4edda(++_0x5c52d8);}(_0x56aa,0xb5));var _0xa56a=function(_0x271474,_0x248441){_0x271474=_0x271474-0x0;var _0x72f117=_0x56aa[_0x271474];return _0x72f117;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa56a('0x0'));module[_0xa56a('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xa56a('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xa56a('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa56a('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa56a('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa56a('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa56a('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xa56a('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()['format'](_0xa56a('0x3'))}}; \ No newline at end of file +var _0xe0c2=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x54a39b,_0x4efe54){var _0x40d679=function(_0x5bb097){while(--_0x5bb097){_0x54a39b['push'](_0x54a39b['shift']());}};_0x40d679(++_0x4efe54);}(_0xe0c2,0xa0));var _0x2e0c=function(_0x2f8b3d,_0x408d44){_0x2f8b3d=_0x2f8b3d-0x0;var _0xfe9e29=_0xe0c2[_0x2f8b3d];return _0xfe9e29;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0x2e0c('0x0')]},'callid':{'type':Sequelize[_0x2e0c('0x0')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x2e0c('0x0')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x2e0c('0x0')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x2e0c('0x0')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x2e0c('0x0')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x2e0c('0x0')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x2e0c('0x0')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x2e0c('0x1')],'allowNull':![],'defaultValue':moment()[_0x2e0c('0x2')](_0x2e0c('0x3'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 0e918a0..e2612a7 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 _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(_0x17a39b,_0x255da4){var _0x4e6603=function(_0x1c46c5){while(--_0x1c46c5){_0x17a39b['push'](_0x17a39b['shift']());}};_0x4e6603(++_0x255da4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 _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(_0x37dc85,_0x3a93c3){var _0x20fc39=function(_0x2dbd74){while(--_0x2dbd74){_0x37dc85['push'](_0x37dc85['shift']());}};_0x20fc39(++_0x3a93c3);}(_0xb10b,0x12a));var _0xbb10=function(_0x543a4e,_0x544f2e){_0x543a4e=_0x543a4e-0x0;var _0x27a3a9=_0xb10b[_0x543a4e];return _0x27a3a9;};'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 diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index bd20227..327cae4 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 _0xfb65=['VoiceQueuesLog','voice_queues_log','event_dtm','dtm','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define'];(function(_0x419546,_0x4656d5){var _0x516f66=function(_0x30c0f8){while(--_0x30c0f8){_0x419546['push'](_0x419546['shift']());}};_0x516f66(++_0x4656d5);}(_0xfb65,0x82));var _0x5fb6=function(_0x19f000,_0x39ac54){_0x19f000=_0x19f000-0x0;var _0x81cee0=_0xfb65[_0x19f000];return _0x81cee0;};'use strict';var _=require('lodash');var util=require(_0x5fb6('0x0'));var logger=require(_0x5fb6('0x1'))('api');var moment=require(_0x5fb6('0x2'));var BPromise=require('bluebird');var rp=require(_0x5fb6('0x3'));var fs=require('fs');var path=require(_0x5fb6('0x4'));var rimraf=require(_0x5fb6('0x5'));var config=require(_0x5fb6('0x6'));var attributes=require(_0x5fb6('0x7'));module[_0x5fb6('0x8')]=function(_0x4dec8f,_0x50782b){return _0x4dec8f[_0x5fb6('0x9')](_0x5fb6('0xa'),attributes,{'tableName':_0x5fb6('0xb'),'paranoid':![],'indexes':[{'name':_0x5fb6('0xc'),'fields':['event',_0x5fb6('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x8ca9=['define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports'];(function(_0x499b13,_0x3ad768){var _0x414aad=function(_0x538b16){while(--_0x538b16){_0x499b13['push'](_0x499b13['shift']());}};_0x414aad(++_0x3ad768);}(_0x8ca9,0x9c));var _0x98ca=function(_0x3246b4,_0x401153){_0x3246b4=_0x3246b4-0x0;var _0x34b3d7=_0x8ca9[_0x3246b4];return _0x34b3d7;};'use strict';var _=require(_0x98ca('0x0'));var util=require(_0x98ca('0x1'));var logger=require(_0x98ca('0x2'))(_0x98ca('0x3'));var moment=require(_0x98ca('0x4'));var BPromise=require(_0x98ca('0x5'));var rp=require(_0x98ca('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x98ca('0x7'));var attributes=require('./voiceQueuesLog.attributes');module[_0x98ca('0x8')]=function(_0x48415d,_0x219619){return _0x48415d[_0x98ca('0x9')](_0x98ca('0xa'),attributes,{'tableName':_0x98ca('0xb'),'paranoid':![],'indexes':[{'name':_0x98ca('0xc'),'fields':[_0x98ca('0xd'),_0x98ca('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index a79d7c2..48c4ab5 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 _0x0db9=['code','message','catch','lodash','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x20a9c9,_0x56f7db){var _0x5949c6=function(_0x2ed372){while(--_0x2ed372){_0x20a9c9['push'](_0x20a9c9['shift']());}};_0x5949c6(++_0x56f7db);}(_0x0db9,0xa3));var _0x90db=function(_0x15cdcb,_0x4340e9){_0x15cdcb=_0x15cdcb-0x0;var _0x37b069=_0x0db9[_0x15cdcb];return _0x37b069;};'use strict';var _=require(_0x90db('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x90db('0x1'));var fs=require('fs');var Redis=require(_0x90db('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x90db('0x3'));var logger=require('../../config/logger')(_0x90db('0x4'));var config=require(_0x90db('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x90db('0x6')][_0x90db('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x476491,_0xee21f8,_0x915ca){return new BPromise(function(_0x9b6d0d,_0x4b0c1d){return client[_0x90db('0x8')](_0x476491,_0x915ca)[_0x90db('0x9')](function(_0x39512e){logger[_0x90db('0xa')](_0x90db('0xb'),_0xee21f8,_0x90db('0xc'));logger[_0x90db('0xd')](_0x90db('0xe'),_0xee21f8,_0x90db('0xc'),JSON[_0x90db('0xf')](_0x39512e));if(_0x39512e[_0x90db('0x10')]){if(_0x39512e['error'][_0x90db('0x11')]===0x1f4){logger[_0x90db('0x10')](_0x90db('0xb'),_0xee21f8,_0x39512e[_0x90db('0x10')][_0x90db('0x12')]);return _0x4b0c1d(_0x39512e[_0x90db('0x10')][_0x90db('0x12')]);}logger[_0x90db('0x10')](_0x90db('0xb'),_0xee21f8,_0x39512e[_0x90db('0x10')][_0x90db('0x12')]);return _0x9b6d0d(_0x39512e[_0x90db('0x10')][_0x90db('0x12')]);}else{logger[_0x90db('0xa')]('VoiceQueuesLog,\x20%s,\x20%s',_0xee21f8,_0x90db('0xc'));_0x9b6d0d(_0x39512e['result'][_0x90db('0x12')]);}})[_0x90db('0x13')](function(_0x3de860){logger[_0x90db('0x10')](_0x90db('0xb'),_0xee21f8,_0x3de860);_0x4b0c1d(_0x3de860);});});} \ No newline at end of file +var _0x4bde=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','info','result'];(function(_0x3c8bf4,_0x1cd8c9){var _0x1767c0=function(_0x35b617){while(--_0x35b617){_0x3c8bf4['push'](_0x3c8bf4['shift']());}};_0x1767c0(++_0x1cd8c9);}(_0x4bde,0x1b1));var _0xe4bd=function(_0x2cd068,_0x7a0a83){_0x2cd068=_0x2cd068-0x0;var _0x1f2d00=_0x4bde[_0x2cd068];return _0x1f2d00;};'use strict';var _=require(_0xe4bd('0x0'));var util=require(_0xe4bd('0x1'));var moment=require(_0xe4bd('0x2'));var BPromise=require('bluebird');var rs=require(_0xe4bd('0x3'));var fs=require('fs');var Redis=require(_0xe4bd('0x4'));var db=require(_0xe4bd('0x5'))['db'];var utils=require(_0xe4bd('0x6'));var logger=require('../../config/logger')(_0xe4bd('0x7'));var config=require(_0xe4bd('0x8'));var jayson=require(_0xe4bd('0x9'));var client=jayson[_0xe4bd('0xa')][_0xe4bd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4008eb,_0x4c933b,_0x2cf33d){return new BPromise(function(_0xbd04ce,_0x262295){return client[_0xe4bd('0xc')](_0x4008eb,_0x2cf33d)[_0xe4bd('0xd')](function(_0x3ef7e7){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x4c933b,'request\x20sent');logger[_0xe4bd('0xe')](_0xe4bd('0xf'),_0x4c933b,_0xe4bd('0x10'),JSON['stringify'](_0x3ef7e7));if(_0x3ef7e7[_0xe4bd('0x11')]){if(_0x3ef7e7[_0xe4bd('0x11')][_0xe4bd('0x12')]===0x1f4){logger[_0xe4bd('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4c933b,_0x3ef7e7[_0xe4bd('0x11')]['message']);return _0x262295(_0x3ef7e7[_0xe4bd('0x11')]['message']);}logger[_0xe4bd('0x11')](_0xe4bd('0x13'),_0x4c933b,_0x3ef7e7[_0xe4bd('0x11')][_0xe4bd('0x14')]);return _0xbd04ce(_0x3ef7e7[_0xe4bd('0x11')][_0xe4bd('0x14')]);}else{logger[_0xe4bd('0x15')](_0xe4bd('0x13'),_0x4c933b,_0xe4bd('0x10'));_0xbd04ce(_0x3ef7e7[_0xe4bd('0x16')][_0xe4bd('0x14')]);}})[_0xe4bd('0x17')](function(_0x470cd1){logger['error'](_0xe4bd('0x13'),_0x4c933b,_0x470cd1);_0x262295(_0x470cd1);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 679d056..cb82e8c 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(_0x36ec2b,_0x183c5a){var _0x51a5f9=function(_0x420731){while(--_0x420731){_0x36ec2b['push'](_0x36ec2b['shift']());}};_0x51a5f9(++_0x183c5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x2e84f6,_0x5354c8){var _0x59d210=function(_0x494b6e){while(--_0x494b6e){_0x2e84f6['push'](_0x2e84f6['shift']());}};_0x59d210(++_0x5354c8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 4a09dd2..e990a9e 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 _0x7094=['membername','split','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','moment','path','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue'];(function(_0x3c447d,_0x3e72f2){var _0x45f75f=function(_0x3d5665){while(--_0x3d5665){_0x3c447d['push'](_0x3c447d['shift']());}};_0x45f75f(++_0x3e72f2);}(_0x7094,0x157));var _0x4709=function(_0x41d5dd,_0x29cb1a){_0x41d5dd=_0x41d5dd-0x0;var _0x52b2e9=_0x7094[_0x41d5dd];return _0x52b2e9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4709('0x0'));var path=require(_0x4709('0x1'));module[_0x4709('0x2')]={'format':{'type':Sequelize[_0x4709('0x3')],'get':function(){return this[_0x4709('0x4')](_0x4709('0x5'))?path[_0x4709('0x6')](this[_0x4709('0x4')](_0x4709('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x4709('0x7')]},'channel':{'type':Sequelize['STRING'],'set':function(_0x592614){if(_0x592614){this[_0x4709('0x8')]('channel',_0x592614);this['setDataValue'](_0x4709('0x9'),_0x592614[_0x4709('0xa')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x4709('0x7')]},'calleridnum':{'type':Sequelize[_0x4709('0x7')]},'calleridname':{'type':Sequelize[_0x4709('0x7')]},'connectedlinenum':{'type':Sequelize[_0x4709('0x7')]},'connectedlinename':{'type':Sequelize[_0x4709('0x7')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4709('0x7')]},'exten':{'type':Sequelize[_0x4709('0x7')]},'value':{'type':Sequelize[_0x4709('0x7')]},'type':{'type':Sequelize[_0x4709('0x7')]},'rating':{'type':Sequelize[_0x4709('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x4709('0x7')]},'userDisposition':{'type':Sequelize[_0x4709('0x7')]},'location':{'type':Sequelize[_0x4709('0xc')]},'transcribeName':{'type':Sequelize[_0x4709('0x7')]},'transcribeStatus':{'type':Sequelize[_0x4709('0x7')],'defaultValue':_0x4709('0xd')},'fileUri':{'type':Sequelize[_0x4709('0xc')]},'fileText':{'type':Sequelize[_0x4709('0xc')]},'failureReason':{'type':Sequelize[_0x4709('0xc')]},'sentiment':{'type':Sequelize[_0x4709('0x7')]},'sPositive':{'type':Sequelize[_0x4709('0xe')]},'sNegative':{'type':Sequelize[_0x4709('0xe')]},'sNeutral':{'type':Sequelize[_0x4709('0xe')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x4709('0xf')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x4709('0x10')],'get':function(){return moment(this[_0x4709('0x4')](_0x4709('0x11')))[_0x4709('0x12')](_0x4709('0x13'))[_0x4709('0x14')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x4709('0x4')](_0x4709('0x15')))['format'](_0x4709('0x13'))['toString']();}}}; \ No newline at end of file +var _0x3def=['DATE','getDataValue','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','exports','VIRTUAL','value','STRING','setDataValue','channel','membername','NEW','TEXT','FLOAT'];(function(_0x1385f0,_0x5550bb){var _0x36ca00=function(_0x1bc769){while(--_0x1bc769){_0x1385f0['push'](_0x1385f0['shift']());}};_0x36ca00(++_0x5550bb);}(_0x3def,0x183));var _0xf3de=function(_0x1f56e0,_0x3b4673){_0x1f56e0=_0x1f56e0-0x0;var _0x11c70f=_0x3def[_0x1f56e0];return _0x11c70f;};'use strict';var Sequelize=require(_0xf3de('0x0'));var moment=require(_0xf3de('0x1'));var path=require(_0xf3de('0x2'));module[_0xf3de('0x3')]={'format':{'type':Sequelize[_0xf3de('0x4')],'get':function(){return this['getDataValue'](_0xf3de('0x5'))?path['extname'](this['getDataValue'](_0xf3de('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0xf3de('0x6')]},'channel':{'type':Sequelize[_0xf3de('0x6')],'set':function(_0x3295f9){if(_0x3295f9){this[_0xf3de('0x7')](_0xf3de('0x8'),_0x3295f9);this[_0xf3de('0x7')](_0xf3de('0x9'),_0x3295f9['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xf3de('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf3de('0x6')]},'connectedlinenum':{'type':Sequelize[_0xf3de('0x6')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf3de('0x6')]},'value':{'type':Sequelize[_0xf3de('0x6')]},'type':{'type':Sequelize[_0xf3de('0x6')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xf3de('0x6')]},'location':{'type':Sequelize['TEXT']},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize[_0xf3de('0x6')],'defaultValue':_0xf3de('0xa')},'fileUri':{'type':Sequelize[_0xf3de('0xb')]},'fileText':{'type':Sequelize[_0xf3de('0xb')]},'failureReason':{'type':Sequelize[_0xf3de('0xb')]},'sentiment':{'type':Sequelize[_0xf3de('0x6')]},'sPositive':{'type':Sequelize[_0xf3de('0xc')]},'sNegative':{'type':Sequelize[_0xf3de('0xc')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0xf3de('0xc')]},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xf3de('0xd')],'get':function(){return moment(this[_0xf3de('0xe')](_0xf3de('0xf')))[_0xf3de('0x10')](_0xf3de('0x11'))[_0xf3de('0x12')]();}},'updatedAt':{'type':Sequelize[_0xf3de('0xd')],'get':function(){return moment(this[_0xf3de('0xe')](_0xf3de('0x13')))[_0xf3de('0x10')](_0xf3de('0x11'))[_0xf3de('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index b501119..f038fa6 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 _0x1b83=['/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','VoiceRecording','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','download','../../components/encryptor','type','uniqueid','value','existsSync','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','extname','unlink','message','downloads','sequelize','MD5','token','$and','push','format','%s.cypher','decryptFile','filename','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','ValidationError','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeRegion','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','fileText','root'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x1b83,0x1cb));var _0x31b8=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x1b83[_0x4cf98e];return _0x1623ac;};'use strict';var pdf=require(_0x31b8('0x0'));var emlformat=require(_0x31b8('0x1'));var rimraf=require(_0x31b8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x31b8('0x3'));var rp=require(_0x31b8('0x4'));var moment=require(_0x31b8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x31b8('0x6'));var util=require(_0x31b8('0x7'));var path=require('path');var sox=require(_0x31b8('0x8'));var csv=require('to-csv');var ejs=require(_0x31b8('0x9'));var fs=require('fs');var _=require(_0x31b8('0xa'));var squel=require(_0x31b8('0xb'));var crypto=require(_0x31b8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x31b8('0xd'));var toCsv=require(_0x31b8('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0x31b8('0xf'));var Redis=require(_0x31b8('0x10'));var authService=require(_0x31b8('0x11'));var qs=require(_0x31b8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x31b8('0x13'))('api');var utils=require(_0x31b8('0x14'));var config=require('../../config/environment');var db=require(_0x31b8('0x15'))['db'];function respondWithStatusCode(_0x355aab,_0x402960){_0x402960=_0x402960||0xcc;return function(_0x45b55b){if(_0x45b55b){return _0x355aab['sendStatus'](_0x402960);}return _0x355aab[_0x31b8('0x16')](_0x402960)[_0x31b8('0x17')]();};}function respondWithResult(_0x59f68d,_0x37e0ec){_0x37e0ec=_0x37e0ec||0xc8;return function(_0x5584b0){if(_0x5584b0){return _0x59f68d['status'](_0x37e0ec)['json'](_0x5584b0);}};}function respondWithFilteredResult(_0x3bebda,_0x3768d9){return function(_0x475fd1){if(_0x475fd1){var _0x203131=_0x475fd1[_0x31b8('0x18')],_0x4e9885=_0x3768d9['offset'],_0xff53ec=_0x3768d9[_0x31b8('0x19')]+_0x3768d9[_0x31b8('0x1a')],_0x39c533;if(_0xff53ec>=_0x203131){_0xff53ec=_0x203131;_0x39c533=0xc8;}else{_0x39c533=0xce;}_0x3bebda[_0x31b8('0x16')](_0x39c533);return _0x3bebda[_0x31b8('0x1b')](_0x31b8('0x1c'),_0x4e9885+'-'+_0xff53ec+'/'+_0x203131)[_0x31b8('0x1d')](_0x475fd1);}return null;};}function patchUpdates(_0x5812ef){return function(_0x1bef65){try{jsonpatch[_0x31b8('0x1e')](_0x1bef65,_0x5812ef,!![]);}catch(_0x3a5afc){return BPromise[_0x31b8('0x1f')](_0x3a5afc);}return _0x1bef65[_0x31b8('0x20')]();};}function saveUpdates(_0x19302e,_0x55cff0){return function(_0x2c0529){if(_0x2c0529){return _0x2c0529[_0x31b8('0x21')](_0x19302e)[_0x31b8('0x22')](function(_0x2e1002){return _0x2e1002;});}return null;};}function removeEntity(_0x776d4d,_0x29f998){return function(_0xa66caa){if(_0xa66caa){return _0xa66caa['destroy']()[_0x31b8('0x22')](function(){_0x776d4d[_0x31b8('0x16')](0xcc)[_0x31b8('0x17')]();});}};}function handleEntityNotFound(_0xb19b81,_0xe362){return function(_0x30879d){if(!_0x30879d){_0xb19b81[_0x31b8('0x23')](0x194);}return _0x30879d;};}function handleError(_0x382c16,_0x47105c){_0x47105c=_0x47105c||0x1f4;return function(_0x532d1c){logger[_0x31b8('0x24')](_0x532d1c[_0x31b8('0x25')]);if(_0x532d1c[_0x31b8('0x26')]){delete _0x532d1c[_0x31b8('0x26')];}_0x382c16[_0x31b8('0x16')](_0x47105c)[_0x31b8('0x27')](_0x532d1c);};}exports['index']=function(_0xc0be48,_0x44f77e){var _0x4e4761={},_0x5f3657={},_0x31879e={'count':0x0,'rows':[]};var _0x3b06e5=_[_0x31b8('0x28')](db['VoiceRecording'][_0x31b8('0x29')],function(_0x548944){return{'name':_0x548944[_0x31b8('0x2a')],'type':_0x548944['type'][_0x31b8('0x2b')]};});_0x5f3657[_0x31b8('0x2c')]=_[_0x31b8('0x2d')](_['map'](_0x3b06e5,'name'),['format']);_0x5f3657[_0x31b8('0x2e')]=_[_0x31b8('0x2f')](_0xc0be48['query']);_0x5f3657[_0x31b8('0x30')]=_[_0x31b8('0x31')](_0x5f3657[_0x31b8('0x2c')],_0x5f3657['query']);_0x4e4761[_0x31b8('0x32')]=_['intersection'](_0x5f3657[_0x31b8('0x2c')],qs[_0x31b8('0x33')](_0xc0be48[_0x31b8('0x2e')][_0x31b8('0x33')]));_0x4e4761[_0x31b8('0x32')]=_0x4e4761[_0x31b8('0x32')][_0x31b8('0x34')]?_0x4e4761[_0x31b8('0x32')]:_0x5f3657['model'];if(!_0xc0be48['query'][_0x31b8('0x35')](_0x31b8('0x36'))){_0x4e4761[_0x31b8('0x1a')]=qs[_0x31b8('0x1a')](_0xc0be48[_0x31b8('0x2e')][_0x31b8('0x1a')]);_0x4e4761[_0x31b8('0x19')]=qs[_0x31b8('0x19')](_0xc0be48[_0x31b8('0x2e')][_0x31b8('0x19')]);}_0x4e4761[_0x31b8('0x37')]=qs['sort'](_0xc0be48[_0x31b8('0x2e')]['sort']);_0x4e4761[_0x31b8('0x38')]=qs[_0x31b8('0x30')](_[_0x31b8('0x39')](_0xc0be48['query'],_0x5f3657[_0x31b8('0x30')]),_0x3b06e5);if(_0xc0be48[_0x31b8('0x2e')][_0x31b8('0x3a')]){_0x4e4761['where']=_[_0x31b8('0x3b')](_0x4e4761[_0x31b8('0x38')],{'$or':_[_0x31b8('0x28')](_0x3b06e5,function(_0x26f2ce){if(_0x26f2ce['type']!==_0x31b8('0x3c')){var _0x4bd2bd={};_0x4bd2bd[_0x26f2ce[_0x31b8('0x26')]]={'$like':'%'+_0xc0be48[_0x31b8('0x2e')][_0x31b8('0x3a')]+'%'};return _0x4bd2bd;}})});}_0x4e4761=_[_0x31b8('0x3b')]({},_0x4e4761,_0xc0be48['options']);var _0x12f0f5={'where':_0x4e4761[_0x31b8('0x38')]};return db[_0x31b8('0x3d')][_0x31b8('0x18')](_0x12f0f5)[_0x31b8('0x22')](function(_0x5049fd){_0x31879e['count']=_0x5049fd;if(_0xc0be48['query'][_0x31b8('0x3e')]){_0x4e4761[_0x31b8('0x3f')]=[{'all':!![]}];}return db[_0x31b8('0x3d')][_0x31b8('0x40')](_0x4e4761);})['then'](function(_0x4d5419){_0x31879e[_0x31b8('0x41')]=_0x4d5419;return _0x31879e;})['then'](respondWithFilteredResult(_0x44f77e,_0x4e4761))[_0x31b8('0x42')](handleError(_0x44f77e,null));};exports[_0x31b8('0x43')]=function(_0x8d8bf,_0x3676b6){var _0x57e851={'raw':![],'where':{'id':_0x8d8bf[_0x31b8('0x44')]['id']}},_0x2e9c27={};_0x2e9c27[_0x31b8('0x2c')]=_[_0x31b8('0x2f')](db[_0x31b8('0x3d')][_0x31b8('0x29')]);_0x2e9c27['query']=_[_0x31b8('0x2f')](_0x8d8bf[_0x31b8('0x2e')]);_0x2e9c27['filters']=_[_0x31b8('0x31')](_0x2e9c27['model'],_0x2e9c27['query']);_0x57e851[_0x31b8('0x32')]=_[_0x31b8('0x31')](_0x2e9c27[_0x31b8('0x2c')],qs[_0x31b8('0x33')](_0x8d8bf[_0x31b8('0x2e')][_0x31b8('0x33')]));_0x57e851['attributes']=_0x57e851[_0x31b8('0x32')][_0x31b8('0x34')]?_0x57e851['attributes']:_0x2e9c27[_0x31b8('0x2c')];if(_0x8d8bf[_0x31b8('0x2e')]['includeAll']){_0x57e851[_0x31b8('0x3f')]=[{'all':!![]}];}_0x57e851=_['merge']({},_0x57e851,_0x8d8bf['options']);return db[_0x31b8('0x3d')][_0x31b8('0x45')](_0x57e851)[_0x31b8('0x22')](handleEntityNotFound(_0x3676b6,null))['then'](respondWithResult(_0x3676b6,null))[_0x31b8('0x42')](handleError(_0x3676b6,null));};exports[_0x31b8('0x46')]=function(_0x17cc5e,_0x19b8a6){return db[_0x31b8('0x3d')][_0x31b8('0x46')](_0x17cc5e[_0x31b8('0x47')],{})[_0x31b8('0x22')](respondWithResult(_0x19b8a6,0xc9))[_0x31b8('0x42')](handleError(_0x19b8a6,null));};exports[_0x31b8('0x21')]=function(_0x27ba9c,_0xf652eb){if(_0x27ba9c['body']['id']){delete _0x27ba9c[_0x31b8('0x47')]['id'];}return db[_0x31b8('0x3d')][_0x31b8('0x45')]({'where':{'id':_0x27ba9c['params']['id']}})[_0x31b8('0x22')](handleEntityNotFound(_0xf652eb,null))[_0x31b8('0x22')](saveUpdates(_0x27ba9c[_0x31b8('0x47')],null))[_0x31b8('0x22')](respondWithResult(_0xf652eb,null))['catch'](handleError(_0xf652eb,null));};exports[_0x31b8('0x48')]=function(_0x41abef,_0x2c38f2){return db[_0x31b8('0x3d')][_0x31b8('0x48')]()[_0x31b8('0x22')](respondWithResult(_0x2c38f2,null))[_0x31b8('0x42')](handleError(_0x2c38f2,null));};exports[_0x31b8('0x49')]=function(_0x5966ba,_0x10d10c,_0x4003c5){var _0x489465=require(_0x31b8('0x4a'));var _0x419417=![];var _0x4456cf={};if(_0x5966ba[_0x31b8('0x2e')]['type']&&_0x5966ba['query'][_0x31b8('0x4b')]===_0x31b8('0x4c')){_0x4456cf[_0x31b8('0x4c')]=_0x5966ba['params']['id'];}else{_0x4456cf['id']=_0x5966ba[_0x31b8('0x44')]['id'];}return db[_0x31b8('0x3d')][_0x31b8('0x45')]({'where':_0x4456cf,'attributes':['id',_0x31b8('0x4d')],'raw':!![]})[_0x31b8('0x22')](handleEntityNotFound(_0x10d10c,null))[_0x31b8('0x22')](function(_0x1577ea){if(_0x1577ea){var _0x5c2090=_0x1577ea[_0x31b8('0x4d')];var _0x353eaf=util['format']('%s.cypher',_0x5c2090);if(fs[_0x31b8('0x4e')](_0x353eaf)){_0x419417=!![];return _0x489465['decryptFile'](_0x353eaf,_0x5c2090,config[_0x31b8('0x4f')][_0x31b8('0x50')])[_0x31b8('0x22')](function(){return _0x1577ea;});}return _0x1577ea;}})[_0x31b8('0x22')](function(_0x211664){if(_0x211664){var _0x115ef9=_0x211664[_0x31b8('0x4d')];if(!fs[_0x31b8('0x4e')](_0x115ef9)){throw new db[(_0x31b8('0x51'))]['ValidationError'](_0x31b8('0x52'));}if(_0x211664['filename']){return _0x10d10c['download'](_0x115ef9,_0x211664['filename']+path[_0x31b8('0x53')](_0x115ef9),function(){if(_0x419417){fs[_0x31b8('0x54')](_0x115ef9);}});}else{return _0x10d10c[_0x31b8('0x49')](_0x115ef9,function(_0x365cca){if(_0x419417){fs[_0x31b8('0x54')](_0x115ef9);}});}}})[_0x31b8('0x42')](function(_0x5c8306){if(_0x5c8306[_0x31b8('0x55')]===_0x31b8('0x52')){_0x10d10c[_0x31b8('0x16')](0x194)[_0x31b8('0x27')]('Not\x20found');}else{return handleError(_0x10d10c,null);}});};exports[_0x31b8('0x56')]=function(_0x21f492,_0x3b267d,_0x4c60ec){var _0x7c6777=require(_0x31b8('0x4a'));var _0x411e5f=![];var _0x4e3ce2={'$and':[db['sequelize'][_0x31b8('0x38')](db[_0x31b8('0x57')]['fn'](_0x31b8('0x58'),db[_0x31b8('0x57')]['col']('uniqueid')),_0x21f492[_0x31b8('0x2e')][_0x31b8('0x59')])]};if(_0x21f492[_0x31b8('0x2e')][_0x31b8('0x4b')]&&_0x21f492[_0x31b8('0x2e')][_0x31b8('0x4b')]==='uniqueid'){_0x4e3ce2[_0x31b8('0x5a')][_0x31b8('0x5b')]({'uniqueid':_0x21f492['params']['id']});}else{_0x4e3ce2[_0x31b8('0x5a')][_0x31b8('0x5b')]({'id':_0x21f492[_0x31b8('0x44')]['id']});}return db[_0x31b8('0x3d')][_0x31b8('0x45')]({'where':_0x4e3ce2,'attributes':['id',_0x31b8('0x4d')],'raw':!![]})[_0x31b8('0x22')](handleEntityNotFound(_0x3b267d,null))[_0x31b8('0x22')](function(_0x4e87e1){if(_0x4e87e1){var _0x296944=util[_0x31b8('0x5c')](_0x31b8('0x5d'),_0x4e87e1[_0x31b8('0x4d')]);if(fs[_0x31b8('0x4e')](_0x296944)){_0x411e5f=!![];return _0x7c6777[_0x31b8('0x5e')](_0x296944,_0x4e87e1[_0x31b8('0x4d')],config[_0x31b8('0x4f')][_0x31b8('0x50')])[_0x31b8('0x22')](function(){return _0x4e87e1;});}return _0x4e87e1;}})[_0x31b8('0x22')](function(_0x348e06){if(_0x348e06){if(!fs['existsSync'](_0x348e06[_0x31b8('0x4d')])){throw new db[(_0x31b8('0x51'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x348e06[_0x31b8('0x5f')]){return _0x3b267d[_0x31b8('0x49')](_0x348e06['value'],_0x348e06['filename']+path[_0x31b8('0x53')](_0x348e06[_0x31b8('0x4d')]),function(){if(_0x411e5f){fs[_0x31b8('0x54')](_0x348e06[_0x31b8('0x4d')]);}});}else{return _0x3b267d[_0x31b8('0x49')](_0x348e06[_0x31b8('0x4d')],function(_0x357d7a){if(_0x411e5f){fs[_0x31b8('0x54')](_0x348e06['value']);}});}}})[_0x31b8('0x42')](handleError(_0x3b267d,null));};exports[_0x31b8('0x60')]=function(_0x336cc5,_0x2bb138){return db[_0x31b8('0x3d')]['find']({'where':{'id':_0x336cc5[_0x31b8('0x44')]['id']}})[_0x31b8('0x22')](function(_0x57125c){if(!_0x57125c)throw new ReferenceError(_0x31b8('0x61'));return _0x57125c;})['then'](function(_0x5bf5ab){var _0x34dd3d=_0x5bf5ab[_0x31b8('0x4d')];logger[_0x31b8('0x62')](_0x31b8('0x63'),_0x34dd3d);if(!_[_0x31b8('0x64')](_0x5bf5ab['value'])&&fs['existsSync'](_0x34dd3d)){logger[_0x31b8('0x62')](_0x31b8('0x65')+_0x34dd3d+_0x31b8('0x66'));fs[_0x31b8('0x67')](_0x34dd3d);}_0x34dd3d=_0x34dd3d+_0x31b8('0x68');if(!_['isNil'](_0x5bf5ab[_0x31b8('0x4d')])&&fs['existsSync'](_0x34dd3d)){logger[_0x31b8('0x62')](_0x31b8('0x65')+_0x34dd3d+_0x31b8('0x66'));fs[_0x31b8('0x67')](_0x34dd3d);}return _0x5bf5ab;})['then'](function(_0x24d9f5){if(!_0x24d9f5)throw new InternalError();return _0x24d9f5[_0x31b8('0x60')]();})[_0x31b8('0x22')](function(){_0x2bb138[_0x31b8('0x16')](0xcc)[_0x31b8('0x17')]();})[_0x31b8('0x42')](handleError(_0x2bb138,null));};function getBucketslist(_0x43ebaa,_0x3c258c,_0x41455b){return new Promise(function(_0x1d13c1,_0x5cdf0f){var _0x540fa6=new AWS['S3']({'accessKeyId':_0x3c258c,'secretAccessKey':_0x43ebaa,'region':_0x41455b});_0x540fa6[_0x31b8('0x69')]({},function(_0x15f932,_0x45cde7){if(_0x15f932){return _0x5cdf0f(_0x15f932);}else{return _0x1d13c1(_0x45cde7);}});});}function createBucket(_0x2e0b44,_0x1bcb61,_0x419ffc,_0x4efc4f){return new Promise(function(_0x378ccf,_0x3db6ee){var _0x3a7865=new AWS['S3']({'accessKeyId':_0x1bcb61,'secretAccessKey':_0x2e0b44,'region':_0x419ffc});_0x3a7865[_0x31b8('0x6a')]({'Bucket':_0x4efc4f},function(_0x396c52,_0x7a7942){if(_0x396c52){return _0x3db6ee(_0x396c52);}else{return _0x378ccf(_0x7a7942);}});});}function uploadFile(_0x3f2486,_0x5606f4,_0x21f7cf,_0x5f15a7,_0x286e33,_0x1f7130){return new Promise(function(_0x23d519,_0x5d9cd4){var _0x4d5892=new AWS['S3']({'accessKeyId':_0x5606f4,'secretAccessKey':_0x3f2486,'region':_0x21f7cf});_0x4d5892['upload']({'Bucket':_0x5f15a7,'Key':_0x286e33,'Body':_0x1f7130},function(_0x27c67e,_0x4b3437){if(_0x27c67e){return _0x5d9cd4(_0x27c67e);}else{return _0x23d519(_0x4b3437);}});});}function startTranscribe(_0x3eb2ff,_0x9dd0d,_0x2245ec,_0x44240b,_0x2d9390,_0x331557){return new Promise(function(_0x31f928,_0x533df2){var _0x127f24=new AWS['TranscribeService']({'accessKeyId':_0x9dd0d,'secretAccessKey':_0x3eb2ff,'region':_0x2245ec});_0x127f24[_0x31b8('0x6b')]({'TranscriptionJobName':_0x44240b,'LanguageCode':_0x2d9390,'Media':{'MediaFileUri':_0x331557}},function(_0x438b2a,_0x496f81){if(_0x438b2a){return _0x533df2(_0x438b2a);}else{return _0x31f928(_0x496f81);}});});}function transcribe(_0x183fd3,_0x46d0bd,_0x2557f4,_0x423bd,_0x5bf2be,_0x45c362,_0x402d15){return new Promise(function(_0x48f457,_0x420d23){var _0x83b37a={};logger['info'](util[_0x31b8('0x5c')](_0x31b8('0x6c'),_0x183fd3,_0x5bf2be));return uploadFile(_0x46d0bd,_0x2557f4,_0x423bd,_0x5bf2be,path[_0x31b8('0x6d')](_0x45c362),fs[_0x31b8('0x6e')](_0x45c362))['then'](function(_0x56c4bd){logger[_0x31b8('0x62')](util[_0x31b8('0x5c')](_0x31b8('0x6f'),_0x183fd3,_0x5bf2be,_0x56c4bd[_0x31b8('0x70')]));_0x83b37a[_0x31b8('0x71')]=_0x56c4bd[_0x31b8('0x72')];_0x83b37a['location']=_0x56c4bd[_0x31b8('0x70')];logger[_0x31b8('0x62')](util[_0x31b8('0x5c')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x183fd3));return startTranscribe(_0x46d0bd,_0x2557f4,_0x423bd,uuidv4(),_0x402d15,_0x56c4bd['Location']);})[_0x31b8('0x22')](function(_0xd09871){logger[_0x31b8('0x62')](util['format'](_0x31b8('0x73'),_0x183fd3,_0xd09871[_0x31b8('0x74')][_0x31b8('0x75')]));_0x83b37a[_0x31b8('0x76')]=_0xd09871['TranscriptionJob']['TranscriptionJobName'];_0x83b37a[_0x31b8('0x77')]=_0xd09871['TranscriptionJob'][_0x31b8('0x78')];return _0x48f457(_0x83b37a);})[_0x31b8('0x42')](function(_0x344f68){return _0x420d23(_0x344f68);});});}exports[_0x31b8('0x79')]=function(_0xe2532b,_0x238132,_0x2d77b5){var _0xafd005;var _0x1f6b57;var _0x4edd6b;var _0x261dc0=require('../../components/encryptor');return db[_0x31b8('0x3d')][_0x31b8('0x7a')]({'where':{'id':_0xe2532b[_0x31b8('0x44')]['id']}})[_0x31b8('0x22')](function(_0x6c0d1a){if(_0x6c0d1a){var _0x339ef2=util['format'](_0x31b8('0x5d'),_0x6c0d1a[_0x31b8('0x4d')]);if(fs[_0x31b8('0x4e')](_0x339ef2)){cypher=!![];return _0x261dc0[_0x31b8('0x5e')](_0x339ef2,_0x6c0d1a[_0x31b8('0x4d')],config['secrets'][_0x31b8('0x50')])[_0x31b8('0x22')](function(){return _0x6c0d1a;});}return _0x6c0d1a;}})[_0x31b8('0x22')](function(_0x5cb61){if(!_0x5cb61){throw new db[(_0x31b8('0x51'))][(_0x31b8('0x7b'))](_0x31b8('0x7c'));}_0x1f6b57=_0x5cb61;return db['Setting'][_0x31b8('0x7a')]({'where':{'id':0x1}});})[_0x31b8('0x22')](handleEntityNotFound(_0x238132,null))[_0x31b8('0x22')](function(_0x2905b7){if(_0x2905b7){_0xafd005=_0x2905b7;if(!_0xafd005[_0x31b8('0x7d')]||!_0xafd005[_0x31b8('0x7e')]||!_0xafd005['transcribeRegion']||!_0xafd005[_0x31b8('0x7f')]||!_0xafd005[_0x31b8('0x71')]){throw new db[(_0x31b8('0x51'))]['ValidationError'](_0x31b8('0x80'));}if(_0xe2532b[_0x31b8('0x47')][_0x31b8('0x81')]&&(!_0xafd005[_0x31b8('0x82')]||!_0xafd005[_0x31b8('0x83')]||!_0xafd005[_0x31b8('0x84')]||!_0xafd005[_0x31b8('0x7f')]||!_0xafd005[_0x31b8('0x71')])){throw new db[(_0x31b8('0x51'))][(_0x31b8('0x7b'))](_0x31b8('0x85'));}return db[_0x31b8('0x86')]['findOne']({'where':{'id':_0xafd005[_0x31b8('0x7e')]}});}})['then'](function(_0xb7c57e){if(!_0xb7c57e){throw new db[(_0x31b8('0x51'))]['ValidationError'](_0x31b8('0x87'));}if(!_0xb7c57e[_0x31b8('0x88')]||!_0xb7c57e[_0x31b8('0x89')]){throw new db[(_0x31b8('0x51'))][(_0x31b8('0x7b'))](_0x31b8('0x8a'));}_0x4edd6b=_0xb7c57e;return getBucketslist(_0x4edd6b['data1'],_0x4edd6b['data2'],_0xafd005['transcribeRegion']);})[_0x31b8('0x22')](function(_0x3e16a3){if(_0x3e16a3&&_0x3e16a3[_0x31b8('0x8b')]){var _0x3a52c2=_[_0x31b8('0x45')](_0x3e16a3[_0x31b8('0x8b')],function(_0x240b6d){return _0x240b6d[_0x31b8('0x8c')]===_0xafd005[_0x31b8('0x71')];});if(!_0x3a52c2){logger[_0x31b8('0x62')](util[_0x31b8('0x5c')](_0x31b8('0x8d'),_0xe2532b[_0x31b8('0x44')]['id'],_0xafd005[_0x31b8('0x71')]));return createBucket(_0x4edd6b[_0x31b8('0x88')],_0x4edd6b[_0x31b8('0x89')],_0xafd005[_0x31b8('0x8e')],_0xafd005[_0x31b8('0x71')]);}logger['info'](util[_0x31b8('0x5c')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0xe2532b[_0x31b8('0x44')]['id'],_0xafd005[_0x31b8('0x71')]));return;}})[_0x31b8('0x22')](function(_0x5ef55e){if(_0x1f6b57[_0x31b8('0x77')]===_0x31b8('0x8f')){return transcribe(_0xe2532b['params']['id'],_0x4edd6b[_0x31b8('0x88')],_0x4edd6b['data2'],_0xafd005[_0x31b8('0x8e')],_0xafd005[_0x31b8('0x71')],_0x1f6b57[_0x31b8('0x4d')],_0xafd005[_0x31b8('0x7f')]);}else{logger[_0x31b8('0x62')](util['format'](_0x31b8('0x90'),_0xe2532b[_0x31b8('0x44')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x31b8('0x22')](function(_0x5d775e){if(_0x5d775e){_0x5d775e[_0x31b8('0x91')]=_0xe2532b[_0x31b8('0x47')][_0x31b8('0x81')];return _0x1f6b57[_0x31b8('0x92')](_0x5d775e);}})[_0x31b8('0x22')](respondWithResult(_0x238132,null))[_0x31b8('0x42')](handleError(_0x238132,null));};function writeFile(_0x59081,_0x5d5486){return new Promise(function(_0x335da0,_0x280295){fs['writeFile'](_0x5d5486,_0x59081,function(_0x34370c,_0x202568){if(_0x34370c){return _0x280295(_0x34370c);}else{return _0x335da0(_0x202568);}});});}exports['downloadTranscribe']=function(_0x43db2f,_0x261403,_0x23071e){return db[_0x31b8('0x3d')][_0x31b8('0x7a')]({'where':{'id':_0x43db2f[_0x31b8('0x44')]['id']}})[_0x31b8('0x22')](handleEntityNotFound(_0x261403))[_0x31b8('0x22')](function(_0x40e652){if(_0x40e652&&_0x40e652[_0x31b8('0x93')]){var _0x249756=_0x40e652[_0x31b8('0x93')];var _0x23e4e2=config[_0x31b8('0x94')]+_0x31b8('0x95')+_0x40e652['id']+_0x31b8('0x96');if(fs[_0x31b8('0x4e')](_0x23e4e2)){return _0x23e4e2;}return writeFile(_0x249756,_0x23e4e2)[_0x31b8('0x22')](function(){return _0x23e4e2;});}else{throw new db[(_0x31b8('0x51'))][(_0x31b8('0x7b'))](_0x31b8('0x97'));}})['then'](function(_0x1d7559){return _0x261403[_0x31b8('0x49')](_0x1d7559);})[_0x31b8('0x42')](handleError(_0x261403));}; \ No newline at end of file +var _0x02e1=['Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','data1','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','runSentiment','updateAttributes','downloadTranscribe','findOne','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','html-pdf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','set','Content-Range','apply','update','sendStatus','error','name','send','index','map','fieldName','key','model','differenceBy','query','keys','intersection','attributes','fields','length','nolimit','limit','sort','where','filters','pick','merge','VIRTUAL','filter','then','includeAll','VoiceRecording','catch','show','params','rawAttributes','include','create','body','find','describe','../../components/encryptor','type','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','download','extname','message','sequelize','MD5','token','push','$and','format','unlink','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','sentiment','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider'];(function(_0x39b388,_0x282cf8){var _0x6f6ad2=function(_0x1a659c){while(--_0x1a659c){_0x39b388['push'](_0x39b388['shift']());}};_0x6f6ad2(++_0x282cf8);}(_0x02e1,0xa8));var _0x102e=function(_0x34a958,_0x38d1dc){_0x34a958=_0x34a958-0x0;var _0x5968f4=_0x02e1[_0x34a958];return _0x5968f4;};'use strict';var pdf=require(_0x102e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x102e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x102e('0x2'));var BPromise=require(_0x102e('0x3'));var Mustache=require(_0x102e('0x4'));var util=require('util');var path=require(_0x102e('0x5'));var sox=require(_0x102e('0x6'));var csv=require(_0x102e('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x102e('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x102e('0x9'));var deskjs=require(_0x102e('0xa'));var toCsv=require(_0x102e('0x7'));var querystring=require(_0x102e('0xb'));var Papa=require(_0x102e('0xc'));var AWS=require(_0x102e('0xd'));var uuidv4=require(_0x102e('0xe'));var Redis=require(_0x102e('0xf'));var authService=require(_0x102e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x102e('0x11'));var hardwareService=require(_0x102e('0x12'));var logger=require(_0x102e('0x13'))(_0x102e('0x14'));var utils=require(_0x102e('0x15'));var config=require(_0x102e('0x16'));var db=require(_0x102e('0x17'))['db'];function respondWithStatusCode(_0x4fdc12,_0x5d40c8){_0x5d40c8=_0x5d40c8||0xcc;return function(_0x17710e){if(_0x17710e){return _0x4fdc12['sendStatus'](_0x5d40c8);}return _0x4fdc12['status'](_0x5d40c8)[_0x102e('0x18')]();};}function respondWithResult(_0x4401a6,_0x321446){_0x321446=_0x321446||0xc8;return function(_0x2bd04f){if(_0x2bd04f){return _0x4401a6[_0x102e('0x19')](_0x321446)[_0x102e('0x1a')](_0x2bd04f);}};}function respondWithFilteredResult(_0x581dc6,_0x420286){return function(_0x454bab){if(_0x454bab){var _0x4dd324=_0x454bab[_0x102e('0x1b')],_0x21a357=_0x420286[_0x102e('0x1c')],_0x3c19d0=_0x420286[_0x102e('0x1c')]+_0x420286['limit'],_0x964e6a;if(_0x3c19d0>=_0x4dd324){_0x3c19d0=_0x4dd324;_0x964e6a=0xc8;}else{_0x964e6a=0xce;}_0x581dc6[_0x102e('0x19')](_0x964e6a);return _0x581dc6[_0x102e('0x1d')](_0x102e('0x1e'),_0x21a357+'-'+_0x3c19d0+'/'+_0x4dd324)[_0x102e('0x1a')](_0x454bab);}return null;};}function patchUpdates(_0x283fb5){return function(_0x3b1b95){try{jsonpatch[_0x102e('0x1f')](_0x3b1b95,_0x283fb5,!![]);}catch(_0x4f381b){return BPromise['reject'](_0x4f381b);}return _0x3b1b95['save']();};}function saveUpdates(_0x3b31c1,_0x21418a){return function(_0xb5b7f1){if(_0xb5b7f1){return _0xb5b7f1[_0x102e('0x20')](_0x3b31c1)['then'](function(_0x5b4b0a){return _0x5b4b0a;});}return null;};}function removeEntity(_0x3aa3df,_0x4a1be4){return function(_0x3f9879){if(_0x3f9879){return _0x3f9879['destroy']()['then'](function(){_0x3aa3df['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x8b1796,_0x5ca81f){return function(_0x1acda6){if(!_0x1acda6){_0x8b1796[_0x102e('0x21')](0x194);}return _0x1acda6;};}function handleError(_0x414409,_0x19f7c5){_0x19f7c5=_0x19f7c5||0x1f4;return function(_0x2803d9){logger[_0x102e('0x22')](_0x2803d9['stack']);if(_0x2803d9[_0x102e('0x23')]){delete _0x2803d9[_0x102e('0x23')];}_0x414409['status'](_0x19f7c5)[_0x102e('0x24')](_0x2803d9);};}exports[_0x102e('0x25')]=function(_0x3e0c75,_0x586938){var _0x5afcbb={},_0x4fa36e={},_0x3b4514={'count':0x0,'rows':[]};var _0x5c2dab=_[_0x102e('0x26')](db['VoiceRecording']['rawAttributes'],function(_0x58d648){return{'name':_0x58d648[_0x102e('0x27')],'type':_0x58d648['type'][_0x102e('0x28')]};});_0x4fa36e[_0x102e('0x29')]=_[_0x102e('0x2a')](_[_0x102e('0x26')](_0x5c2dab,_0x102e('0x23')),['format']);_0x4fa36e[_0x102e('0x2b')]=_[_0x102e('0x2c')](_0x3e0c75['query']);_0x4fa36e['filters']=_[_0x102e('0x2d')](_0x4fa36e['model'],_0x4fa36e[_0x102e('0x2b')]);_0x5afcbb[_0x102e('0x2e')]=_[_0x102e('0x2d')](_0x4fa36e[_0x102e('0x29')],qs[_0x102e('0x2f')](_0x3e0c75[_0x102e('0x2b')][_0x102e('0x2f')]));_0x5afcbb['attributes']=_0x5afcbb[_0x102e('0x2e')][_0x102e('0x30')]?_0x5afcbb['attributes']:_0x4fa36e[_0x102e('0x29')];if(!_0x3e0c75[_0x102e('0x2b')]['hasOwnProperty'](_0x102e('0x31'))){_0x5afcbb[_0x102e('0x32')]=qs[_0x102e('0x32')](_0x3e0c75['query'][_0x102e('0x32')]);_0x5afcbb['offset']=qs[_0x102e('0x1c')](_0x3e0c75['query'][_0x102e('0x1c')]);}_0x5afcbb['order']=qs[_0x102e('0x33')](_0x3e0c75[_0x102e('0x2b')][_0x102e('0x33')]);_0x5afcbb[_0x102e('0x34')]=qs[_0x102e('0x35')](_[_0x102e('0x36')](_0x3e0c75[_0x102e('0x2b')],_0x4fa36e[_0x102e('0x35')]),_0x5c2dab);if(_0x3e0c75[_0x102e('0x2b')]['filter']){_0x5afcbb['where']=_[_0x102e('0x37')](_0x5afcbb[_0x102e('0x34')],{'$or':_[_0x102e('0x26')](_0x5c2dab,function(_0x6e7352){if(_0x6e7352['type']!==_0x102e('0x38')){var _0x27d929={};_0x27d929[_0x6e7352['name']]={'$like':'%'+_0x3e0c75[_0x102e('0x2b')][_0x102e('0x39')]+'%'};return _0x27d929;}})});}_0x5afcbb=_['merge']({},_0x5afcbb,_0x3e0c75['options']);var _0xd5d271={'where':_0x5afcbb['where']};return db['VoiceRecording']['count'](_0xd5d271)[_0x102e('0x3a')](function(_0x55cbb6){_0x3b4514['count']=_0x55cbb6;if(_0x3e0c75[_0x102e('0x2b')][_0x102e('0x3b')]){_0x5afcbb['include']=[{'all':!![]}];}return db[_0x102e('0x3c')]['findAll'](_0x5afcbb);})[_0x102e('0x3a')](function(_0x39b8dc){_0x3b4514['rows']=_0x39b8dc;return _0x3b4514;})[_0x102e('0x3a')](respondWithFilteredResult(_0x586938,_0x5afcbb))[_0x102e('0x3d')](handleError(_0x586938,null));};exports[_0x102e('0x3e')]=function(_0x101290,_0x25de9f){var _0x3eb916={'raw':![],'where':{'id':_0x101290[_0x102e('0x3f')]['id']}},_0x2878fe={};_0x2878fe[_0x102e('0x29')]=_[_0x102e('0x2c')](db[_0x102e('0x3c')][_0x102e('0x40')]);_0x2878fe[_0x102e('0x2b')]=_[_0x102e('0x2c')](_0x101290['query']);_0x2878fe[_0x102e('0x35')]=_[_0x102e('0x2d')](_0x2878fe[_0x102e('0x29')],_0x2878fe[_0x102e('0x2b')]);_0x3eb916[_0x102e('0x2e')]=_[_0x102e('0x2d')](_0x2878fe[_0x102e('0x29')],qs['fields'](_0x101290[_0x102e('0x2b')]['fields']));_0x3eb916[_0x102e('0x2e')]=_0x3eb916['attributes']['length']?_0x3eb916[_0x102e('0x2e')]:_0x2878fe[_0x102e('0x29')];if(_0x101290[_0x102e('0x2b')][_0x102e('0x3b')]){_0x3eb916[_0x102e('0x41')]=[{'all':!![]}];}_0x3eb916=_[_0x102e('0x37')]({},_0x3eb916,_0x101290['options']);return db[_0x102e('0x3c')]['find'](_0x3eb916)['then'](handleEntityNotFound(_0x25de9f,null))[_0x102e('0x3a')](respondWithResult(_0x25de9f,null))[_0x102e('0x3d')](handleError(_0x25de9f,null));};exports[_0x102e('0x42')]=function(_0x28159e,_0x3672f3){return db[_0x102e('0x3c')]['create'](_0x28159e['body'],{})[_0x102e('0x3a')](respondWithResult(_0x3672f3,0xc9))[_0x102e('0x3d')](handleError(_0x3672f3,null));};exports[_0x102e('0x20')]=function(_0x5b8e52,_0x836edf){if(_0x5b8e52[_0x102e('0x43')]['id']){delete _0x5b8e52[_0x102e('0x43')]['id'];}return db[_0x102e('0x3c')][_0x102e('0x44')]({'where':{'id':_0x5b8e52[_0x102e('0x3f')]['id']}})[_0x102e('0x3a')](handleEntityNotFound(_0x836edf,null))[_0x102e('0x3a')](saveUpdates(_0x5b8e52[_0x102e('0x43')],null))[_0x102e('0x3a')](respondWithResult(_0x836edf,null))[_0x102e('0x3d')](handleError(_0x836edf,null));};exports[_0x102e('0x45')]=function(_0x5f3fea,_0x3e3e27){return db[_0x102e('0x3c')][_0x102e('0x45')]()[_0x102e('0x3a')](respondWithResult(_0x3e3e27,null))['catch'](handleError(_0x3e3e27,null));};exports['download']=function(_0x421875,_0x39da4b,_0x3a7500){var _0x3157b7=require(_0x102e('0x46'));var _0x226c0d=![];var _0x2db047={};if(_0x421875[_0x102e('0x2b')][_0x102e('0x47')]&&_0x421875['query']['type']===_0x102e('0x48')){_0x2db047[_0x102e('0x48')]=_0x421875[_0x102e('0x3f')]['id'];}else{_0x2db047['id']=_0x421875[_0x102e('0x3f')]['id'];}return db['VoiceRecording'][_0x102e('0x44')]({'where':_0x2db047,'attributes':['id',_0x102e('0x49')],'raw':!![]})[_0x102e('0x3a')](handleEntityNotFound(_0x39da4b,null))[_0x102e('0x3a')](function(_0xbbf9ad){if(_0xbbf9ad){var _0x5f48e4=_0xbbf9ad['value'];var _0x44651a=util['format'](_0x102e('0x4a'),_0x5f48e4);if(fs[_0x102e('0x4b')](_0x44651a)){_0x226c0d=!![];return _0x3157b7[_0x102e('0x4c')](_0x44651a,_0x5f48e4,config[_0x102e('0x4d')][_0x102e('0x4e')])['then'](function(){return _0xbbf9ad;});}return _0xbbf9ad;}})[_0x102e('0x3a')](function(_0x1625d3){if(_0x1625d3){var _0x212de3=_0x1625d3[_0x102e('0x49')];if(!fs[_0x102e('0x4b')](_0x212de3)){throw new db[(_0x102e('0x4f'))][(_0x102e('0x50'))](_0x102e('0x51'));}if(_0x1625d3[_0x102e('0x52')]){return _0x39da4b[_0x102e('0x53')](_0x212de3,_0x1625d3[_0x102e('0x52')]+path[_0x102e('0x54')](_0x212de3),function(){if(_0x226c0d){fs['unlink'](_0x212de3);}});}else{return _0x39da4b[_0x102e('0x53')](_0x212de3,function(_0x2a2e72){if(_0x226c0d){fs['unlink'](_0x212de3);}});}}})[_0x102e('0x3d')](function(_0x17e0e9){if(_0x17e0e9[_0x102e('0x55')]===_0x102e('0x51')){_0x39da4b[_0x102e('0x19')](0x194)[_0x102e('0x24')]('Not\x20found');}else{return handleError(_0x39da4b,null);}});};exports['downloads']=function(_0x443f53,_0x4e4dd7,_0x269121){var _0x149e37=require(_0x102e('0x46'));var _0x12de73=![];var _0x29634b={'$and':[db[_0x102e('0x56')]['where'](db[_0x102e('0x56')]['fn'](_0x102e('0x57'),db[_0x102e('0x56')]['col']('uniqueid')),_0x443f53[_0x102e('0x2b')][_0x102e('0x58')])]};if(_0x443f53['query'][_0x102e('0x47')]&&_0x443f53[_0x102e('0x2b')][_0x102e('0x47')]===_0x102e('0x48')){_0x29634b['$and'][_0x102e('0x59')]({'uniqueid':_0x443f53[_0x102e('0x3f')]['id']});}else{_0x29634b[_0x102e('0x5a')][_0x102e('0x59')]({'id':_0x443f53[_0x102e('0x3f')]['id']});}return db[_0x102e('0x3c')]['find']({'where':_0x29634b,'attributes':['id','value'],'raw':!![]})[_0x102e('0x3a')](handleEntityNotFound(_0x4e4dd7,null))[_0x102e('0x3a')](function(_0x5ed6d0){if(_0x5ed6d0){var _0x10e9b9=util[_0x102e('0x5b')](_0x102e('0x4a'),_0x5ed6d0['value']);if(fs[_0x102e('0x4b')](_0x10e9b9)){_0x12de73=!![];return _0x149e37['decryptFile'](_0x10e9b9,_0x5ed6d0[_0x102e('0x49')],config[_0x102e('0x4d')][_0x102e('0x4e')])[_0x102e('0x3a')](function(){return _0x5ed6d0;});}return _0x5ed6d0;}})[_0x102e('0x3a')](function(_0x483f14){if(_0x483f14){if(!fs['existsSync'](_0x483f14[_0x102e('0x49')])){throw new db[(_0x102e('0x4f'))][(_0x102e('0x50'))]('VoiceRecording\x20not\x20found');}if(_0x483f14[_0x102e('0x52')]){return _0x4e4dd7[_0x102e('0x53')](_0x483f14[_0x102e('0x49')],_0x483f14[_0x102e('0x52')]+path[_0x102e('0x54')](_0x483f14[_0x102e('0x49')]),function(){if(_0x12de73){fs[_0x102e('0x5c')](_0x483f14[_0x102e('0x49')]);}});}else{return _0x4e4dd7[_0x102e('0x53')](_0x483f14[_0x102e('0x49')],function(_0xa3b224){if(_0x12de73){fs[_0x102e('0x5c')](_0x483f14['value']);}});}}})[_0x102e('0x3d')](handleError(_0x4e4dd7,null));};exports[_0x102e('0x5d')]=function(_0x3d22c0,_0x28e816){return db[_0x102e('0x3c')][_0x102e('0x44')]({'where':{'id':_0x3d22c0[_0x102e('0x3f')]['id']}})[_0x102e('0x3a')](function(_0x67696c){if(!_0x67696c)throw new ReferenceError(_0x102e('0x5e'));return _0x67696c;})['then'](function(_0x543567){var _0x4305cf=_0x543567[_0x102e('0x49')];logger[_0x102e('0x5f')](_0x102e('0x60'),_0x4305cf);if(!_[_0x102e('0x61')](_0x543567[_0x102e('0x49')])&&fs[_0x102e('0x4b')](_0x4305cf)){logger[_0x102e('0x5f')]('File:\x20\x22'+_0x4305cf+_0x102e('0x62'));fs[_0x102e('0x63')](_0x4305cf);}_0x4305cf=_0x4305cf+'.cypher';if(!_['isNil'](_0x543567[_0x102e('0x49')])&&fs['existsSync'](_0x4305cf)){logger['info'](_0x102e('0x64')+_0x4305cf+_0x102e('0x62'));fs[_0x102e('0x63')](_0x4305cf);}return _0x543567;})[_0x102e('0x3a')](function(_0xbc8ae3){if(!_0xbc8ae3)throw new InternalError();return _0xbc8ae3[_0x102e('0x5d')]();})[_0x102e('0x3a')](function(){_0x28e816[_0x102e('0x19')](0xcc)[_0x102e('0x18')]();})[_0x102e('0x3d')](handleError(_0x28e816,null));};function getBucketslist(_0x2bded6,_0x3cd008,_0x2502d6){return new Promise(function(_0x29ed7a,_0x186237){var _0x58fd7f=new AWS['S3']({'accessKeyId':_0x3cd008,'secretAccessKey':_0x2bded6,'region':_0x2502d6});_0x58fd7f[_0x102e('0x65')]({},function(_0x4b5282,_0x1e433f){if(_0x4b5282){return _0x186237(_0x4b5282);}else{return _0x29ed7a(_0x1e433f);}});});}function createBucket(_0x2fbdca,_0x4b2762,_0x316fff,_0x1ac39c){return new Promise(function(_0x4f170f,_0x9d3136){var _0x1988b1=new AWS['S3']({'accessKeyId':_0x4b2762,'secretAccessKey':_0x2fbdca,'region':_0x316fff});_0x1988b1[_0x102e('0x66')]({'Bucket':_0x1ac39c},function(_0x22816a,_0x2d6eb0){if(_0x22816a){return _0x9d3136(_0x22816a);}else{return _0x4f170f(_0x2d6eb0);}});});}function uploadFile(_0x5138a3,_0x47ddfe,_0x5bfe65,_0x2e18a1,_0x184a01,_0x19be4c){return new Promise(function(_0x399629,_0x51a7d0){var _0x1da918=new AWS['S3']({'accessKeyId':_0x47ddfe,'secretAccessKey':_0x5138a3,'region':_0x5bfe65});_0x1da918[_0x102e('0x67')]({'Bucket':_0x2e18a1,'Key':_0x184a01,'Body':_0x19be4c},function(_0x10a34c,_0x1501fd){if(_0x10a34c){return _0x51a7d0(_0x10a34c);}else{return _0x399629(_0x1501fd);}});});}function startTranscribe(_0x1b6d26,_0x10964d,_0x35e2a2,_0x4cb989,_0x505902,_0x2b366a){return new Promise(function(_0x40c66b,_0x42cef6){var _0x307432=new AWS[(_0x102e('0x68'))]({'accessKeyId':_0x10964d,'secretAccessKey':_0x1b6d26,'region':_0x35e2a2});_0x307432[_0x102e('0x69')]({'TranscriptionJobName':_0x4cb989,'LanguageCode':_0x505902,'Media':{'MediaFileUri':_0x2b366a}},function(_0x5e732a,_0x101b87){if(_0x5e732a){return _0x42cef6(_0x5e732a);}else{return _0x40c66b(_0x101b87);}});});}function transcribe(_0x5d2c70,_0x5633ea,_0x29b1d7,_0x4e9769,_0x573d1a,_0x19abdb,_0x3593bb){return new Promise(function(_0x32a654,_0x3af937){var _0x4aad47={};logger[_0x102e('0x5f')](util[_0x102e('0x5b')](_0x102e('0x6a'),_0x5d2c70,_0x573d1a));return uploadFile(_0x5633ea,_0x29b1d7,_0x4e9769,_0x573d1a,path[_0x102e('0x6b')](_0x19abdb),fs[_0x102e('0x6c')](_0x19abdb))[_0x102e('0x3a')](function(_0x35931b){logger[_0x102e('0x5f')](util[_0x102e('0x5b')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x5d2c70,_0x573d1a,_0x35931b[_0x102e('0x6d')]));_0x4aad47[_0x102e('0x6e')]=_0x35931b[_0x102e('0x6f')];_0x4aad47[_0x102e('0x70')]=_0x35931b[_0x102e('0x6d')];logger[_0x102e('0x5f')](util[_0x102e('0x5b')](_0x102e('0x71'),_0x5d2c70));return startTranscribe(_0x5633ea,_0x29b1d7,_0x4e9769,uuidv4(),_0x3593bb,_0x35931b['Location']);})[_0x102e('0x3a')](function(_0x451454){logger[_0x102e('0x5f')](util[_0x102e('0x5b')](_0x102e('0x72'),_0x5d2c70,_0x451454[_0x102e('0x73')][_0x102e('0x74')]));_0x4aad47[_0x102e('0x75')]=_0x451454[_0x102e('0x73')][_0x102e('0x74')];_0x4aad47['transcribeStatus']=_0x451454['TranscriptionJob'][_0x102e('0x76')];return _0x32a654(_0x4aad47);})['catch'](function(_0x36e91d){return _0x3af937(_0x36e91d);});});}exports[_0x102e('0x77')]=function(_0x2e6408,_0x1b5f14,_0x2e40b6){var _0x510db5;var _0x372b8e;var _0x217684;var _0x38b105=require(_0x102e('0x46'));return db[_0x102e('0x3c')]['findOne']({'where':{'id':_0x2e6408[_0x102e('0x3f')]['id']}})[_0x102e('0x3a')](function(_0x1ffbe7){if(_0x1ffbe7){var _0x1bbf3b=util[_0x102e('0x5b')](_0x102e('0x4a'),_0x1ffbe7[_0x102e('0x49')]);if(fs[_0x102e('0x4b')](_0x1bbf3b)){cypher=!![];return _0x38b105[_0x102e('0x4c')](_0x1bbf3b,_0x1ffbe7[_0x102e('0x49')],config['secrets'][_0x102e('0x4e')])[_0x102e('0x3a')](function(){return _0x1ffbe7;});}return _0x1ffbe7;}})[_0x102e('0x3a')](function(_0xad3094){if(!_0xad3094){throw new db['Sequelize']['ValidationError'](_0x102e('0x78'));}_0x372b8e=_0xad3094;return db[_0x102e('0x79')]['findOne']({'where':{'id':0x1}});})[_0x102e('0x3a')](handleEntityNotFound(_0x1b5f14,null))['then'](function(_0x35682a){if(_0x35682a){_0x510db5=_0x35682a;if(!_0x510db5[_0x102e('0x7a')]||!_0x510db5[_0x102e('0x7b')]||!_0x510db5[_0x102e('0x7c')]||!_0x510db5['language']||!_0x510db5['bucket']){throw new db[(_0x102e('0x4f'))][(_0x102e('0x50'))](_0x102e('0x7d'));}if(_0x2e6408[_0x102e('0x43')]['runSentiment']&&(!_0x510db5[_0x102e('0x7e')]||!_0x510db5['sentimentAccountId']||!_0x510db5['sentimentRegion']||!_0x510db5[_0x102e('0x7f')]||!_0x510db5[_0x102e('0x6e')])){throw new db[(_0x102e('0x4f'))][(_0x102e('0x50'))](_0x102e('0x80'));}return db[_0x102e('0x81')]['findOne']({'where':{'id':_0x510db5[_0x102e('0x7b')]}});}})[_0x102e('0x3a')](function(_0x218bc5){if(!_0x218bc5){throw new db[(_0x102e('0x4f'))][(_0x102e('0x50'))](_0x102e('0x82'));}if(!_0x218bc5['data1']||!_0x218bc5[_0x102e('0x83')]){throw new db[(_0x102e('0x4f'))]['ValidationError'](_0x102e('0x84'));}_0x217684=_0x218bc5;return getBucketslist(_0x217684[_0x102e('0x85')],_0x217684[_0x102e('0x83')],_0x510db5[_0x102e('0x7c')]);})['then'](function(_0x57c7a0){if(_0x57c7a0&&_0x57c7a0[_0x102e('0x86')]){var _0x1ce0dc=_['find'](_0x57c7a0['Buckets'],function(_0x1a9a34){return _0x1a9a34[_0x102e('0x87')]===_0x510db5[_0x102e('0x6e')];});if(!_0x1ce0dc){logger[_0x102e('0x5f')](util[_0x102e('0x5b')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x2e6408[_0x102e('0x3f')]['id'],_0x510db5[_0x102e('0x6e')]));return createBucket(_0x217684[_0x102e('0x85')],_0x217684[_0x102e('0x83')],_0x510db5[_0x102e('0x7c')],_0x510db5['bucket']);}logger[_0x102e('0x5f')](util[_0x102e('0x5b')](_0x102e('0x88'),_0x2e6408['params']['id'],_0x510db5[_0x102e('0x6e')]));return;}})['then'](function(_0x3406e4){if(_0x372b8e[_0x102e('0x89')]==='NEW'){return transcribe(_0x2e6408['params']['id'],_0x217684[_0x102e('0x85')],_0x217684[_0x102e('0x83')],_0x510db5[_0x102e('0x7c')],_0x510db5['bucket'],_0x372b8e[_0x102e('0x49')],_0x510db5['language']);}else{logger['info'](util[_0x102e('0x5b')](_0x102e('0x8a'),_0x2e6408[_0x102e('0x3f')]['id']));return{'transcribeStatus':_0x102e('0x8b')};}})[_0x102e('0x3a')](function(_0x46a0ea){if(_0x46a0ea){_0x46a0ea['tempSentiment']=_0x2e6408['body'][_0x102e('0x8c')];return _0x372b8e[_0x102e('0x8d')](_0x46a0ea);}})[_0x102e('0x3a')](respondWithResult(_0x1b5f14,null))[_0x102e('0x3d')](handleError(_0x1b5f14,null));};function writeFile(_0x578d74,_0x4b5749){return new Promise(function(_0x442e0c,_0x4c5885){fs['writeFile'](_0x4b5749,_0x578d74,function(_0x3bd694,_0x41921a){if(_0x3bd694){return _0x4c5885(_0x3bd694);}else{return _0x442e0c(_0x41921a);}});});}exports[_0x102e('0x8e')]=function(_0x61e619,_0x5e3351,_0x3bd447){return db[_0x102e('0x3c')][_0x102e('0x8f')]({'where':{'id':_0x61e619[_0x102e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5e3351))['then'](function(_0x33f9ca){if(_0x33f9ca&&_0x33f9ca['fileText']){var _0x489715=_0x33f9ca[_0x102e('0x90')];var _0x4c8169=config[_0x102e('0x91')]+_0x102e('0x92')+_0x33f9ca['id']+_0x102e('0x93');if(fs[_0x102e('0x4b')](_0x4c8169)){return _0x4c8169;}return writeFile(_0x489715,_0x4c8169)[_0x102e('0x3a')](function(){return _0x4c8169;});}else{throw new db[(_0x102e('0x4f'))][(_0x102e('0x50'))](_0x102e('0x94'));}})[_0x102e('0x3a')](function(_0xbf0505){return _0x5e3351['download'](_0xbf0505);})[_0x102e('0x3d')](handleError(_0x5e3351));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 90a847f..989f7c1 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 _0xd8fb=['exports','VoiceRecording','uniqueid','lodash','util','../../config/logger','api','path','rimraf','./voiceRecording.attributes'];(function(_0x7c6154,_0x820b95){var _0x16a6b3=function(_0x2f3651){while(--_0x2f3651){_0x7c6154['push'](_0x7c6154['shift']());}};_0x16a6b3(++_0x820b95);}(_0xd8fb,0x99));var _0xbd8f=function(_0x2e449f,_0x2eb0a0){_0x2e449f=_0x2e449f-0x0;var _0x3ddbb2=_0xd8fb[_0x2e449f];return _0x3ddbb2;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));module[_0xbd8f('0x7')]=function(_0x5543b2,_0x33d541){return _0x5543b2['define'](_0xbd8f('0x8'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xbd8f('0x9'),'fields':[_0xbd8f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfcbe=['../../config/environment','voice_recordings','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x31dd7d,_0x41e269){var _0x3f8100=function(_0x93301b){while(--_0x93301b){_0x31dd7d['push'](_0x31dd7d['shift']());}};_0x3f8100(++_0x41e269);}(_0xfcbe,0x1b1));var _0xefcb=function(_0x3091c3,_0xdedd50){_0x3091c3=_0x3091c3-0x0;var _0x5c6cd7=_0xfcbe[_0x3091c3];return _0x5c6cd7;};'use strict';var _=require('lodash');var util=require(_0xefcb('0x0'));var logger=require(_0xefcb('0x1'))(_0xefcb('0x2'));var moment=require(_0xefcb('0x3'));var BPromise=require(_0xefcb('0x4'));var rp=require(_0xefcb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xefcb('0x6'));var config=require(_0xefcb('0x7'));var attributes=require('./voiceRecording.attributes');module['exports']=function(_0x50dcde,_0x3f322c){return _0x50dcde['define']('VoiceRecording',attributes,{'tableName':_0xefcb('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xefcb('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 1259cdd..6974107 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(_0x2e4a84,_0x3de6e1){var _0x16ffe8=function(_0x43382f){while(--_0x43382f){_0x2e4a84['push'](_0x2e4a84['shift']());}};_0x16ffe8(++_0x3de6e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['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(_0x2edb9f,_0x36fad0){var _0x4e5979=function(_0x425f9f){while(--_0x425f9f){_0x2edb9f['push'](_0x2edb9f['shift']());}};_0x4e5979(++_0x36fad0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 671623b..f781d46 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 _0x038b=['update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create','put'];(function(_0x4f1e52,_0x3f2100){var _0x213a54=function(_0x91aaf2){while(--_0x91aaf2){_0x4f1e52['push'](_0x4f1e52['shift']());}};_0x213a54(++_0x3f2100);}(_0x038b,0x114));var _0xb038=function(_0x4d5f5a,_0x121ef8){_0x4d5f5a=_0x4d5f5a-0x0;var _0x4adbab=_0x038b[_0x4d5f5a];return _0x4adbab;};'use strict';var multer=require('multer');var util=require(_0xb038('0x0'));var path=require(_0xb038('0x1'));var timeout=require(_0xb038('0x2'));var express=require('express');var router=express[_0xb038('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb038('0x4'));var config=require(_0xb038('0x5'));var controller=require('./voiceTransferReport.controller');router[_0xb038('0x6')]('/',auth[_0xb038('0x7')](),controller['index']);router['get'](_0xb038('0x8'),auth[_0xb038('0x7')](),controller[_0xb038('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb038('0xa')]);router[_0xb038('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xb038('0xc')]);router[_0xb038('0xd')]('/:id',auth[_0xb038('0x7')](),controller[_0xb038('0xe')]);module[_0xb038('0xf')]=router; \ No newline at end of file +var _0xfdbd=['isAuthenticated','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','post'];(function(_0x340ddd,_0x1a3958){var _0x38aaa7=function(_0x26ee2f){while(--_0x26ee2f){_0x340ddd['push'](_0x340ddd['shift']());}};_0x38aaa7(++_0x1a3958);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x1cbcf1,_0x3f9fd9){_0x1cbcf1=_0x1cbcf1-0x0;var _0x3a06f0=_0xfdbd[_0x1cbcf1];return _0x3a06f0;};'use strict';var multer=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var path=require(_0xdfdb('0x2'));var timeout=require(_0xdfdb('0x3'));var express=require(_0xdfdb('0x4'));var router=express[_0xdfdb('0x5')]();var auth=require(_0xdfdb('0x6'));var interaction=require(_0xdfdb('0x7'));var config=require(_0xdfdb('0x8'));var controller=require('./voiceTransferReport.controller');router[_0xdfdb('0x9')]('/',auth['isAuthenticated'](),controller[_0xdfdb('0xa')]);router[_0xdfdb('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xdfdb('0xb')]('/',auth[_0xdfdb('0xc')](),controller['create']);router[_0xdfdb('0xd')](_0xdfdb('0xe'),auth[_0xdfdb('0xc')](),controller[_0xdfdb('0xf')]);router[_0xdfdb('0x10')](_0xdfdb('0xe'),auth[_0xdfdb('0xc')](),controller['destroy']);module[_0xdfdb('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 6a22c60..7b680cb 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 _0xe1b7=['ENUM','blind','STRING','Yes','sequelize','moment','exports'];(function(_0x4511a6,_0xc66ccb){var _0x445a13=function(_0x2e8859){while(--_0x2e8859){_0x4511a6['push'](_0x4511a6['shift']());}};_0x445a13(++_0xc66ccb);}(_0xe1b7,0x146));var _0x7e1b=function(_0xbf946a,_0x2a48f2){_0xbf946a=_0xbf946a-0x0;var _0x4d18ec=_0xe1b7[_0xbf946a];return _0x4d18ec;};'use strict';var Sequelize=require(_0x7e1b('0x0'));var moment=require(_0x7e1b('0x1'));module[_0x7e1b('0x2')]={'type':{'type':Sequelize[_0x7e1b('0x3')](_0x7e1b('0x4'),'attended')},'result':{'type':Sequelize[_0x7e1b('0x5')]},'transfererchannel':{'type':Sequelize[_0x7e1b('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x7e1b('0x5')]},'transferercalleridname':{'type':Sequelize[_0x7e1b('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x7e1b('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x7e1b('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x7e1b('0x5')]},'transferercontext':{'type':Sequelize[_0x7e1b('0x5')]},'transfererexten':{'type':Sequelize[_0x7e1b('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x7e1b('0x5')]},'transfereechannel':{'type':Sequelize[_0x7e1b('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x7e1b('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x7e1b('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x7e1b('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x7e1b('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0x7e1b('0x6'),'No')},'context':{'type':Sequelize[_0x7e1b('0x5')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xda14=['Yes','sequelize','ENUM','blind','attended','STRING'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xda14,0xf1));var _0x4da1=function(_0x286bfb,_0x46ac3c){_0x286bfb=_0x286bfb-0x0;var _0x52b683=_0xda14[_0x286bfb];return _0x52b683;};'use strict';var Sequelize=require(_0x4da1('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x4da1('0x1')](_0x4da1('0x2'),_0x4da1('0x3'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x4da1('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x4da1('0x4')]},'transferercalleridname':{'type':Sequelize[_0x4da1('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x4da1('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x4da1('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x4da1('0x4')]},'transferercontext':{'type':Sequelize[_0x4da1('0x4')]},'transfererexten':{'type':Sequelize[_0x4da1('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x4da1('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x4da1('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x4da1('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x4da1('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x4da1('0x4')]},'transfereecontext':{'type':Sequelize[_0x4da1('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x4da1('0x4')]},'isexternal':{'type':Sequelize[_0x4da1('0x1')](_0x4da1('0x5'),'No')},'context':{'type':Sequelize[_0x4da1('0x4')]},'extension':{'type':Sequelize[_0x4da1('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 9c6db9a..1a330c7 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 _0xa8c1=['../../mysqldb','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','stack','name','index','VoiceTransferReport','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','filters','length','include','find','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils'];(function(_0x27866b,_0xeebabe){var _0x52960b=function(_0x43dfd5){while(--_0x43dfd5){_0x27866b['push'](_0x27866b['shift']());}};_0x52960b(++_0xeebabe);}(_0xa8c1,0x1d4));var _0x1a8c=function(_0xa3c06b,_0x490f99){_0xa3c06b=_0xa3c06b-0x0;var _0x33aa1d=_0xa8c1[_0xa3c06b];return _0x33aa1d;};'use strict';var pdf=require(_0x1a8c('0x0'));var emlformat=require(_0x1a8c('0x1'));var rimraf=require(_0x1a8c('0x2'));var zipdir=require(_0x1a8c('0x3'));var jsonpatch=require(_0x1a8c('0x4'));var rp=require(_0x1a8c('0x5'));var moment=require(_0x1a8c('0x6'));var BPromise=require(_0x1a8c('0x7'));var Mustache=require(_0x1a8c('0x8'));var util=require(_0x1a8c('0x9'));var path=require(_0x1a8c('0xa'));var sox=require(_0x1a8c('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1a8c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1a8c('0xd'));var toCsv=require(_0x1a8c('0xe'));var querystring=require('querystring');var Papa=require(_0x1a8c('0xf'));var Redis=require(_0x1a8c('0x10'));var authService=require(_0x1a8c('0x11'));var qs=require(_0x1a8c('0x12'));var as=require(_0x1a8c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1a8c('0x14'))('api');var utils=require(_0x1a8c('0x15'));var config=require('../../config/environment');var db=require(_0x1a8c('0x16'))['db'];function respondWithStatusCode(_0x3125da,_0x403f45){_0x403f45=_0x403f45||0xcc;return function(_0x40dbc4){if(_0x40dbc4){return _0x3125da['sendStatus'](_0x403f45);}return _0x3125da[_0x1a8c('0x17')](_0x403f45)['end']();};}function respondWithResult(_0x3fc495,_0x53c81f){_0x53c81f=_0x53c81f||0xc8;return function(_0x12f500){if(_0x12f500){return _0x3fc495['status'](_0x53c81f)[_0x1a8c('0x18')](_0x12f500);}};}function respondWithFilteredResult(_0x2f341b,_0x3477c7){return function(_0x4cce1a){if(_0x4cce1a){var _0xb314b7=_0x4cce1a[_0x1a8c('0x19')],_0x31e049=_0x3477c7['offset'],_0x735182=_0x3477c7[_0x1a8c('0x1a')]+_0x3477c7[_0x1a8c('0x1b')],_0x3e7af9;if(_0x735182>=_0xb314b7){_0x735182=_0xb314b7;_0x3e7af9=0xc8;}else{_0x3e7af9=0xce;}_0x2f341b[_0x1a8c('0x17')](_0x3e7af9);return _0x2f341b[_0x1a8c('0x1c')](_0x1a8c('0x1d'),_0x31e049+'-'+_0x735182+'/'+_0xb314b7)[_0x1a8c('0x18')](_0x4cce1a);}return null;};}function patchUpdates(_0x3b90ef){return function(_0x3f788e){try{jsonpatch['apply'](_0x3f788e,_0x3b90ef,!![]);}catch(_0x431b5f){return BPromise[_0x1a8c('0x1e')](_0x431b5f);}return _0x3f788e[_0x1a8c('0x1f')]();};}function saveUpdates(_0x5f2b36,_0x36bb03){return function(_0x21ff76){if(_0x21ff76){return _0x21ff76[_0x1a8c('0x20')](_0x5f2b36)[_0x1a8c('0x21')](function(_0x1a05ea){return _0x1a05ea;});}return null;};}function removeEntity(_0x2fe122,_0x2dc99c){return function(_0x3db32b){if(_0x3db32b){return _0x3db32b[_0x1a8c('0x22')]()['then'](function(){_0x2fe122[_0x1a8c('0x17')](0xcc)[_0x1a8c('0x23')]();});}};}function handleEntityNotFound(_0x3c7321,_0x3ff03e){return function(_0x3dae08){if(!_0x3dae08){_0x3c7321['sendStatus'](0x194);}return _0x3dae08;};}function handleError(_0x4c2777,_0x239c76){_0x239c76=_0x239c76||0x1f4;return function(_0x1b81ec){logger['error'](_0x1b81ec[_0x1a8c('0x24')]);if(_0x1b81ec[_0x1a8c('0x25')]){delete _0x1b81ec[_0x1a8c('0x25')];}_0x4c2777[_0x1a8c('0x17')](_0x239c76)['send'](_0x1b81ec);};}exports[_0x1a8c('0x26')]=function(_0x5c5b78,_0x1cc9a7){var _0x15181f={},_0x163ff7={},_0x10502b={'count':0x0,'rows':[]};var _0x1e2cad=_['map'](db[_0x1a8c('0x27')][_0x1a8c('0x28')],function(_0x45ff3b){return{'name':_0x45ff3b[_0x1a8c('0x29')],'type':_0x45ff3b['type'][_0x1a8c('0x2a')]};});_0x163ff7[_0x1a8c('0x2b')]=_[_0x1a8c('0x2c')](_0x1e2cad,'name');_0x163ff7[_0x1a8c('0x2d')]=_[_0x1a8c('0x2e')](_0x5c5b78[_0x1a8c('0x2d')]);_0x163ff7['filters']=_[_0x1a8c('0x2f')](_0x163ff7['model'],_0x163ff7[_0x1a8c('0x2d')]);_0x15181f['attributes']=_['intersection'](_0x163ff7[_0x1a8c('0x2b')],qs['fields'](_0x5c5b78[_0x1a8c('0x2d')][_0x1a8c('0x30')]));_0x15181f[_0x1a8c('0x31')]=_0x15181f[_0x1a8c('0x31')]['length']?_0x15181f['attributes']:_0x163ff7['model'];if(!_0x5c5b78[_0x1a8c('0x2d')][_0x1a8c('0x32')]('nolimit')){_0x15181f[_0x1a8c('0x1b')]=qs[_0x1a8c('0x1b')](_0x5c5b78[_0x1a8c('0x2d')][_0x1a8c('0x1b')]);_0x15181f[_0x1a8c('0x1a')]=qs[_0x1a8c('0x1a')](_0x5c5b78[_0x1a8c('0x2d')][_0x1a8c('0x1a')]);}_0x15181f[_0x1a8c('0x33')]=qs[_0x1a8c('0x34')](_0x5c5b78[_0x1a8c('0x2d')][_0x1a8c('0x34')]);_0x15181f[_0x1a8c('0x35')]=qs['filters'](_['pick'](_0x5c5b78[_0x1a8c('0x2d')],_0x163ff7['filters']),_0x1e2cad);if(_0x5c5b78[_0x1a8c('0x2d')][_0x1a8c('0x36')]){_0x15181f[_0x1a8c('0x35')]=_[_0x1a8c('0x37')](_0x15181f[_0x1a8c('0x35')],{'$or':_[_0x1a8c('0x2c')](_0x1e2cad,function(_0x4fc3d2){if(_0x4fc3d2[_0x1a8c('0x38')]!==_0x1a8c('0x39')){var _0x208e2d={};_0x208e2d[_0x4fc3d2['name']]={'$like':'%'+_0x5c5b78['query'][_0x1a8c('0x36')]+'%'};return _0x208e2d;}})});}_0x15181f=_[_0x1a8c('0x37')]({},_0x15181f,_0x5c5b78[_0x1a8c('0x3a')]);var _0x399ebe={'where':_0x15181f[_0x1a8c('0x35')]};return db[_0x1a8c('0x27')]['count'](_0x399ebe)[_0x1a8c('0x21')](function(_0x432e66){_0x10502b[_0x1a8c('0x19')]=_0x432e66;if(_0x5c5b78['query'][_0x1a8c('0x3b')]){_0x15181f['include']=[{'all':!![]}];}return db[_0x1a8c('0x27')][_0x1a8c('0x3c')](_0x15181f);})[_0x1a8c('0x21')](function(_0x489260){_0x10502b[_0x1a8c('0x3d')]=_0x489260;return _0x10502b;})[_0x1a8c('0x21')](respondWithFilteredResult(_0x1cc9a7,_0x15181f))[_0x1a8c('0x3e')](handleError(_0x1cc9a7,null));};exports[_0x1a8c('0x3f')]=function(_0x1fc65c,_0x5b3fa1){var _0x517c63={'raw':!![],'where':{'id':_0x1fc65c['params']['id']}},_0x2eaf2d={};_0x2eaf2d[_0x1a8c('0x2b')]=_[_0x1a8c('0x2e')](db[_0x1a8c('0x27')][_0x1a8c('0x28')]);_0x2eaf2d[_0x1a8c('0x2d')]=_[_0x1a8c('0x2e')](_0x1fc65c[_0x1a8c('0x2d')]);_0x2eaf2d[_0x1a8c('0x40')]=_[_0x1a8c('0x2f')](_0x2eaf2d[_0x1a8c('0x2b')],_0x2eaf2d[_0x1a8c('0x2d')]);_0x517c63['attributes']=_[_0x1a8c('0x2f')](_0x2eaf2d[_0x1a8c('0x2b')],qs['fields'](_0x1fc65c[_0x1a8c('0x2d')][_0x1a8c('0x30')]));_0x517c63[_0x1a8c('0x31')]=_0x517c63[_0x1a8c('0x31')][_0x1a8c('0x41')]?_0x517c63[_0x1a8c('0x31')]:_0x2eaf2d[_0x1a8c('0x2b')];if(_0x1fc65c['query'][_0x1a8c('0x3b')]){_0x517c63[_0x1a8c('0x42')]=[{'all':!![]}];}_0x517c63=_[_0x1a8c('0x37')]({},_0x517c63,_0x1fc65c[_0x1a8c('0x3a')]);return db[_0x1a8c('0x27')][_0x1a8c('0x43')](_0x517c63)[_0x1a8c('0x21')](handleEntityNotFound(_0x5b3fa1,null))[_0x1a8c('0x21')](respondWithResult(_0x5b3fa1,null))[_0x1a8c('0x3e')](handleError(_0x5b3fa1,null));};exports['create']=function(_0x16b96a,_0x7b8438){return db[_0x1a8c('0x27')]['create'](_0x16b96a['body'],{})['then'](respondWithResult(_0x7b8438,0xc9))[_0x1a8c('0x3e')](handleError(_0x7b8438,null));};exports[_0x1a8c('0x20')]=function(_0x5ade96,_0x30a030){if(_0x5ade96[_0x1a8c('0x44')]['id']){delete _0x5ade96[_0x1a8c('0x44')]['id'];}return db['VoiceTransferReport'][_0x1a8c('0x43')]({'where':{'id':_0x5ade96[_0x1a8c('0x45')]['id']}})[_0x1a8c('0x21')](handleEntityNotFound(_0x30a030,null))[_0x1a8c('0x21')](saveUpdates(_0x5ade96[_0x1a8c('0x44')],null))[_0x1a8c('0x21')](respondWithResult(_0x30a030,null))[_0x1a8c('0x3e')](handleError(_0x30a030,null));};exports[_0x1a8c('0x22')]=function(_0x1d4516,_0x55548e){return db[_0x1a8c('0x27')][_0x1a8c('0x43')]({'where':{'id':_0x1d4516['params']['id']}})[_0x1a8c('0x21')](handleEntityNotFound(_0x55548e,null))[_0x1a8c('0x21')](removeEntity(_0x55548e,null))[_0x1a8c('0x3e')](handleError(_0x55548e,null));}; \ No newline at end of file +var _0xf0fd=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','VoiceTransferReport','rawAttributes','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js'];(function(_0x35a132,_0x1ed009){var _0xc05663=function(_0x3f9f4e){while(--_0x3f9f4e){_0x35a132['push'](_0x35a132['shift']());}};_0xc05663(++_0x1ed009);}(_0xf0fd,0x88));var _0xdf0f=function(_0x2474d1,_0x3d18a0){_0x2474d1=_0x2474d1-0x0;var _0x1dd70f=_0xf0fd[_0x2474d1];return _0x1dd70f;};'use strict';var pdf=require(_0xdf0f('0x0'));var emlformat=require(_0xdf0f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdf0f('0x2'));var jsonpatch=require(_0xdf0f('0x3'));var rp=require(_0xdf0f('0x4'));var moment=require('moment');var BPromise=require(_0xdf0f('0x5'));var Mustache=require(_0xdf0f('0x6'));var util=require(_0xdf0f('0x7'));var path=require(_0xdf0f('0x8'));var sox=require('sox');var csv=require(_0xdf0f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdf0f('0xa'));var squel=require('squel');var crypto=require(_0xdf0f('0xb'));var jsforce=require(_0xdf0f('0xc'));var deskjs=require(_0xdf0f('0xd'));var toCsv=require(_0xdf0f('0x9'));var querystring=require(_0xdf0f('0xe'));var Papa=require('papaparse');var Redis=require(_0xdf0f('0xf'));var authService=require(_0xdf0f('0x10'));var qs=require(_0xdf0f('0x11'));var as=require(_0xdf0f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdf0f('0x13'))(_0xdf0f('0x14'));var utils=require(_0xdf0f('0x15'));var config=require(_0xdf0f('0x16'));var db=require(_0xdf0f('0x17'))['db'];function respondWithStatusCode(_0xa7fcbc,_0x11fc04){_0x11fc04=_0x11fc04||0xcc;return function(_0x5827b2){if(_0x5827b2){return _0xa7fcbc[_0xdf0f('0x18')](_0x11fc04);}return _0xa7fcbc[_0xdf0f('0x19')](_0x11fc04)[_0xdf0f('0x1a')]();};}function respondWithResult(_0x1d084d,_0x3bcf31){_0x3bcf31=_0x3bcf31||0xc8;return function(_0x4eef88){if(_0x4eef88){return _0x1d084d[_0xdf0f('0x19')](_0x3bcf31)[_0xdf0f('0x1b')](_0x4eef88);}};}function respondWithFilteredResult(_0x4a20bb,_0x316984){return function(_0x2f7d1a){if(_0x2f7d1a){var _0xd52d82=_0x2f7d1a[_0xdf0f('0x1c')],_0x5a841c=_0x316984[_0xdf0f('0x1d')],_0x9a5ac9=_0x316984[_0xdf0f('0x1d')]+_0x316984[_0xdf0f('0x1e')],_0x4bb6bb;if(_0x9a5ac9>=_0xd52d82){_0x9a5ac9=_0xd52d82;_0x4bb6bb=0xc8;}else{_0x4bb6bb=0xce;}_0x4a20bb[_0xdf0f('0x19')](_0x4bb6bb);return _0x4a20bb[_0xdf0f('0x1f')](_0xdf0f('0x20'),_0x5a841c+'-'+_0x9a5ac9+'/'+_0xd52d82)[_0xdf0f('0x1b')](_0x2f7d1a);}return null;};}function patchUpdates(_0x38c2e1){return function(_0x5bf18c){try{jsonpatch[_0xdf0f('0x21')](_0x5bf18c,_0x38c2e1,!![]);}catch(_0x3b6b74){return BPromise[_0xdf0f('0x22')](_0x3b6b74);}return _0x5bf18c[_0xdf0f('0x23')]();};}function saveUpdates(_0x18c67c,_0x55b5c9){return function(_0x12de4f){if(_0x12de4f){return _0x12de4f[_0xdf0f('0x24')](_0x18c67c)[_0xdf0f('0x25')](function(_0x240f74){return _0x240f74;});}return null;};}function removeEntity(_0x3a8ea1,_0x5f4264){return function(_0x5e9dc1){if(_0x5e9dc1){return _0x5e9dc1[_0xdf0f('0x26')]()[_0xdf0f('0x25')](function(){_0x3a8ea1['status'](0xcc)[_0xdf0f('0x1a')]();});}};}function handleEntityNotFound(_0x3e0a59,_0x80ea2e){return function(_0x4303da){if(!_0x4303da){_0x3e0a59[_0xdf0f('0x18')](0x194);}return _0x4303da;};}function handleError(_0x76cf6f,_0x481772){_0x481772=_0x481772||0x1f4;return function(_0x1982d9){logger[_0xdf0f('0x27')](_0x1982d9[_0xdf0f('0x28')]);if(_0x1982d9['name']){delete _0x1982d9[_0xdf0f('0x29')];}_0x76cf6f[_0xdf0f('0x19')](_0x481772)[_0xdf0f('0x2a')](_0x1982d9);};}exports[_0xdf0f('0x2b')]=function(_0x3ba18c,_0x5b2f9e){var _0x31fe1c={},_0x43553d={},_0x19d1fa={'count':0x0,'rows':[]};var _0x33a63a=_['map'](db[_0xdf0f('0x2c')][_0xdf0f('0x2d')],function(_0x5c3767){return{'name':_0x5c3767['fieldName'],'type':_0x5c3767[_0xdf0f('0x2e')][_0xdf0f('0x2f')]};});_0x43553d[_0xdf0f('0x30')]=_[_0xdf0f('0x31')](_0x33a63a,_0xdf0f('0x29'));_0x43553d['query']=_[_0xdf0f('0x32')](_0x3ba18c['query']);_0x43553d[_0xdf0f('0x33')]=_[_0xdf0f('0x34')](_0x43553d[_0xdf0f('0x30')],_0x43553d[_0xdf0f('0x35')]);_0x31fe1c[_0xdf0f('0x36')]=_[_0xdf0f('0x34')](_0x43553d[_0xdf0f('0x30')],qs[_0xdf0f('0x37')](_0x3ba18c['query'][_0xdf0f('0x37')]));_0x31fe1c[_0xdf0f('0x36')]=_0x31fe1c[_0xdf0f('0x36')][_0xdf0f('0x38')]?_0x31fe1c['attributes']:_0x43553d[_0xdf0f('0x30')];if(!_0x3ba18c['query']['hasOwnProperty']('nolimit')){_0x31fe1c[_0xdf0f('0x1e')]=qs[_0xdf0f('0x1e')](_0x3ba18c[_0xdf0f('0x35')]['limit']);_0x31fe1c[_0xdf0f('0x1d')]=qs[_0xdf0f('0x1d')](_0x3ba18c[_0xdf0f('0x35')][_0xdf0f('0x1d')]);}_0x31fe1c[_0xdf0f('0x39')]=qs['sort'](_0x3ba18c[_0xdf0f('0x35')][_0xdf0f('0x3a')]);_0x31fe1c[_0xdf0f('0x3b')]=qs[_0xdf0f('0x33')](_[_0xdf0f('0x3c')](_0x3ba18c[_0xdf0f('0x35')],_0x43553d[_0xdf0f('0x33')]),_0x33a63a);if(_0x3ba18c[_0xdf0f('0x35')][_0xdf0f('0x3d')]){_0x31fe1c[_0xdf0f('0x3b')]=_[_0xdf0f('0x3e')](_0x31fe1c['where'],{'$or':_[_0xdf0f('0x31')](_0x33a63a,function(_0x3c2bcb){if(_0x3c2bcb[_0xdf0f('0x2e')]!==_0xdf0f('0x3f')){var _0x233bec={};_0x233bec[_0x3c2bcb[_0xdf0f('0x29')]]={'$like':'%'+_0x3ba18c[_0xdf0f('0x35')][_0xdf0f('0x3d')]+'%'};return _0x233bec;}})});}_0x31fe1c=_[_0xdf0f('0x3e')]({},_0x31fe1c,_0x3ba18c[_0xdf0f('0x40')]);var _0x108ba1={'where':_0x31fe1c['where']};return db[_0xdf0f('0x2c')]['count'](_0x108ba1)[_0xdf0f('0x25')](function(_0xa219f8){_0x19d1fa[_0xdf0f('0x1c')]=_0xa219f8;if(_0x3ba18c[_0xdf0f('0x35')][_0xdf0f('0x41')]){_0x31fe1c[_0xdf0f('0x42')]=[{'all':!![]}];}return db[_0xdf0f('0x2c')][_0xdf0f('0x43')](_0x31fe1c);})[_0xdf0f('0x25')](function(_0x451a27){_0x19d1fa[_0xdf0f('0x44')]=_0x451a27;return _0x19d1fa;})[_0xdf0f('0x25')](respondWithFilteredResult(_0x5b2f9e,_0x31fe1c))[_0xdf0f('0x45')](handleError(_0x5b2f9e,null));};exports[_0xdf0f('0x46')]=function(_0x45139c,_0x1666db){var _0x31c589={'raw':!![],'where':{'id':_0x45139c['params']['id']}},_0x3ec827={};_0x3ec827[_0xdf0f('0x30')]=_['keys'](db[_0xdf0f('0x2c')]['rawAttributes']);_0x3ec827['query']=_['keys'](_0x45139c['query']);_0x3ec827['filters']=_['intersection'](_0x3ec827[_0xdf0f('0x30')],_0x3ec827[_0xdf0f('0x35')]);_0x31c589['attributes']=_[_0xdf0f('0x34')](_0x3ec827['model'],qs[_0xdf0f('0x37')](_0x45139c['query']['fields']));_0x31c589[_0xdf0f('0x36')]=_0x31c589[_0xdf0f('0x36')][_0xdf0f('0x38')]?_0x31c589['attributes']:_0x3ec827[_0xdf0f('0x30')];if(_0x45139c[_0xdf0f('0x35')]['includeAll']){_0x31c589['include']=[{'all':!![]}];}_0x31c589=_[_0xdf0f('0x3e')]({},_0x31c589,_0x45139c['options']);return db[_0xdf0f('0x2c')][_0xdf0f('0x47')](_0x31c589)[_0xdf0f('0x25')](handleEntityNotFound(_0x1666db,null))[_0xdf0f('0x25')](respondWithResult(_0x1666db,null))[_0xdf0f('0x45')](handleError(_0x1666db,null));};exports[_0xdf0f('0x48')]=function(_0x57aff3,_0x580d34){return db[_0xdf0f('0x2c')][_0xdf0f('0x48')](_0x57aff3[_0xdf0f('0x49')],{})[_0xdf0f('0x25')](respondWithResult(_0x580d34,0xc9))[_0xdf0f('0x45')](handleError(_0x580d34,null));};exports[_0xdf0f('0x24')]=function(_0x2cfcc8,_0x457c1e){if(_0x2cfcc8[_0xdf0f('0x49')]['id']){delete _0x2cfcc8[_0xdf0f('0x49')]['id'];}return db['VoiceTransferReport'][_0xdf0f('0x47')]({'where':{'id':_0x2cfcc8[_0xdf0f('0x4a')]['id']}})[_0xdf0f('0x25')](handleEntityNotFound(_0x457c1e,null))[_0xdf0f('0x25')](saveUpdates(_0x2cfcc8[_0xdf0f('0x49')],null))[_0xdf0f('0x25')](respondWithResult(_0x457c1e,null))['catch'](handleError(_0x457c1e,null));};exports[_0xdf0f('0x26')]=function(_0x3a5cba,_0x3d612d){return db[_0xdf0f('0x2c')][_0xdf0f('0x47')]({'where':{'id':_0x3a5cba[_0xdf0f('0x4a')]['id']}})[_0xdf0f('0x25')](handleEntityNotFound(_0x3d612d,null))[_0xdf0f('0x25')](removeEntity(_0x3d612d,null))[_0xdf0f('0x45')](handleError(_0x3d612d,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 8d443a7..98988bf 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 _0xfd35=['./voiceTransferReport.attributes','exports','report_call_transfer','lodash','../../config/logger','bluebird','request-promise','../../config/environment'];(function(_0x14a513,_0x3239f){var _0x47236c=function(_0x394191){while(--_0x394191){_0x14a513['push'](_0x14a513['shift']());}};_0x47236c(++_0x3239f);}(_0xfd35,0x173));var _0x5fd3=function(_0x5a66e6,_0x296d7d){_0x5a66e6=_0x5a66e6-0x0;var _0x5502bd=_0xfd35[_0x5a66e6];return _0x5502bd;};'use strict';var _=require(_0x5fd3('0x0'));var util=require('util');var logger=require(_0x5fd3('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5fd3('0x2'));var rp=require(_0x5fd3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5fd3('0x4'));var attributes=require(_0x5fd3('0x5'));module[_0x5fd3('0x6')]=function(_0x4ff57c,_0x345233){return _0x4ff57c['define']('VoiceTransferReport',attributes,{'tableName':_0x5fd3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb5c=['report_call_transfer','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport'];(function(_0x1caac8,_0x31fc77){var _0x2aa7cf=function(_0x2c424c){while(--_0x2c424c){_0x1caac8['push'](_0x1caac8['shift']());}};_0x2aa7cf(++_0x31fc77);}(_0xeb5c,0x139));var _0xceb5=function(_0x21862c,_0x11b362){_0x21862c=_0x21862c-0x0;var _0x45c4bc=_0xeb5c[_0x21862c];return _0x45c4bc;};'use strict';var _=require(_0xceb5('0x0'));var util=require(_0xceb5('0x1'));var logger=require(_0xceb5('0x2'))(_0xceb5('0x3'));var moment=require('moment');var BPromise=require(_0xceb5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xceb5('0x5'));var rimraf=require('rimraf');var config=require(_0xceb5('0x6'));var attributes=require(_0xceb5('0x7'));module[_0xceb5('0x8')]=function(_0x44314e,_0x25f1c0){return _0x44314e[_0xceb5('0x9')](_0xceb5('0xa'),attributes,{'tableName':_0xceb5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 48a9abd..60cbcff 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 _0x9c19=['../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','lodash','util','randomstring','../../mysqldb'];(function(_0x5855aa,_0x4c9518){var _0x218fee=function(_0x5b2ff1){while(--_0x5b2ff1){_0x5855aa['push'](_0x5855aa['shift']());}};_0x218fee(++_0x4c9518);}(_0x9c19,0x1f4));var _0x99c1=function(_0x5d860f,_0x467498){_0x5d860f=_0x5d860f-0x0;var _0x236490=_0x9c19[_0x5d860f];return _0x236490;};'use strict';var _=require(_0x99c1('0x0'));var util=require(_0x99c1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x99c1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x99c1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x99c1('0x4'))(_0x99c1('0x5'));var config=require(_0x99c1('0x6'));var jayson=require(_0x99c1('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x18c779,_0x3193f8,_0x418644){return new BPromise(function(_0x173225,_0x20a233){return client[_0x99c1('0x8')](_0x18c779,_0x418644)[_0x99c1('0x9')](function(_0x3f56f6){logger[_0x99c1('0xa')](_0x99c1('0xb'),_0x3193f8,_0x99c1('0xc'));logger[_0x99c1('0xd')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x3193f8,_0x99c1('0xc'),JSON[_0x99c1('0xe')](_0x3f56f6));if(_0x3f56f6[_0x99c1('0xf')]){if(_0x3f56f6[_0x99c1('0xf')][_0x99c1('0x10')]===0x1f4){logger[_0x99c1('0xf')](_0x99c1('0xb'),_0x3193f8,_0x3f56f6[_0x99c1('0xf')][_0x99c1('0x11')]);return _0x20a233(_0x3f56f6[_0x99c1('0xf')][_0x99c1('0x11')]);}logger[_0x99c1('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x3193f8,_0x3f56f6['error'][_0x99c1('0x11')]);return _0x173225(_0x3f56f6[_0x99c1('0xf')][_0x99c1('0x11')]);}else{logger[_0x99c1('0xa')](_0x99c1('0xb'),_0x3193f8,'request\x20sent');_0x173225(_0x3f56f6['result'][_0x99c1('0x11')]);}})[_0x99c1('0x12')](function(_0x205c0b){logger[_0x99c1('0xf')](_0x99c1('0xb'),_0x3193f8,_0x205c0b);_0x20a233(_0x205c0b);});});}exports[_0x99c1('0x13')]=function(_0x1ac371){var _0x1006d7=this;return new Promise(function(_0xa74372,_0xe067bd){return db[_0x99c1('0x14')][_0x99c1('0x15')](_0x1ac371[_0x99c1('0x16')],{'raw':_0x1ac371['options']?_0x1ac371[_0x99c1('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x99c1('0x9')](function(_0x24c7d7){logger[_0x99c1('0xa')](_0x99c1('0x13'),_0x1ac371);logger['debug']('CreateVoiceTransferReport',_0x1ac371,JSON[_0x99c1('0xe')](_0x24c7d7));_0xa74372(_0x24c7d7);})[_0x99c1('0x12')](function(_0xe18b59){logger['error'](_0x99c1('0x13'),_0xe18b59[_0x99c1('0x11')],_0x1ac371);_0xe067bd(_0x1006d7[_0x99c1('0xf')](0x1f4,_0xe18b59['message']));});});}; \ No newline at end of file +var _0x4d34=['stringify','code','error','message','body','options','raw','then','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4d34,0x16e));var _0x44d3=function(_0x1b5de6,_0x5dd31a){_0x1b5de6=_0x1b5de6-0x0;var _0x348cac=_0x4d34[_0x1b5de6];return _0x348cac;};'use strict';var _=require(_0x44d3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44d3('0x1'));var fs=require('fs');var Redis=require(_0x44d3('0x2'));var db=require(_0x44d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x44d3('0x4'))('rpc');var config=require(_0x44d3('0x5'));var jayson=require(_0x44d3('0x6'));var client=jayson['client'][_0x44d3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e63f5,_0x48944d,_0x52a60e){return new BPromise(function(_0x1869cf,_0x3709a3){return client['request'](_0x5e63f5,_0x52a60e)['then'](function(_0x6f4d33){logger[_0x44d3('0x8')](_0x44d3('0x9'),_0x48944d,_0x44d3('0xa'));logger[_0x44d3('0xb')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x48944d,'request\x20sent',JSON[_0x44d3('0xc')](_0x6f4d33));if(_0x6f4d33['error']){if(_0x6f4d33['error'][_0x44d3('0xd')]===0x1f4){logger['error'](_0x44d3('0x9'),_0x48944d,_0x6f4d33[_0x44d3('0xe')][_0x44d3('0xf')]);return _0x3709a3(_0x6f4d33[_0x44d3('0xe')]['message']);}logger[_0x44d3('0xe')](_0x44d3('0x9'),_0x48944d,_0x6f4d33['error']['message']);return _0x1869cf(_0x6f4d33[_0x44d3('0xe')][_0x44d3('0xf')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x48944d,'request\x20sent');_0x1869cf(_0x6f4d33['result'][_0x44d3('0xf')]);}})['catch'](function(_0x4ba566){logger[_0x44d3('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x48944d,_0x4ba566);_0x3709a3(_0x4ba566);});});}exports['CreateVoiceTransferReport']=function(_0x2b3ded){var _0xb69de6=this;return new Promise(function(_0x25f6f1,_0x38502a){return db['VoiceTransferReport']['create'](_0x2b3ded[_0x44d3('0x10')],{'raw':_0x2b3ded['options']?_0x2b3ded[_0x44d3('0x11')][_0x44d3('0x12')]===undefined?!![]:![]:!![]})[_0x44d3('0x13')](function(_0x15a626){logger[_0x44d3('0x8')]('CreateVoiceTransferReport',_0x2b3ded);logger[_0x44d3('0xb')]('CreateVoiceTransferReport',_0x2b3ded,JSON[_0x44d3('0xc')](_0x15a626));_0x25f6f1(_0x15a626);})[_0x44d3('0x14')](function(_0x15e3d6){logger['error']('CreateVoiceTransferReport',_0x15e3d6[_0x44d3('0xf')],_0x2b3ded);_0x38502a(_0xb69de6[_0x44d3('0xe')](0x1f4,_0x15e3d6[_0x44d3('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 82927c1..4692c2b 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 _0x8ebf=['answer','/hold','hold','unhold','/calls','calls','/transfer','transfer','express','Router','../../components/auth/service','post','/originate','canUpdate','originate','isAuthenticated','/answer'];(function(_0xfcebe9,_0x30867d){var _0x52a587=function(_0x4eaece){while(--_0x4eaece){_0xfcebe9['push'](_0xfcebe9['shift']());}};_0x52a587(++_0x30867d);}(_0x8ebf,0x15c));var _0xf8eb=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x8ebf[_0x2be8c2];return _0x97f531;};'use strict';var express=require(_0xf8eb('0x0'));var router=express[_0xf8eb('0x1')]();var auth=require(_0xf8eb('0x2'));var controller=require('./webbar.controller');router[_0xf8eb('0x3')](_0xf8eb('0x4'),auth['isAuthenticated'](),auth[_0xf8eb('0x5')](),controller[_0xf8eb('0x6')]);router[_0xf8eb('0x3')]('/hangup',auth[_0xf8eb('0x7')](),auth[_0xf8eb('0x5')](),controller['hangup']);router[_0xf8eb('0x3')](_0xf8eb('0x8'),auth[_0xf8eb('0x7')](),auth['canUpdate'](),controller[_0xf8eb('0x9')]);router['post'](_0xf8eb('0xa'),auth['isAuthenticated'](),auth[_0xf8eb('0x5')](),controller[_0xf8eb('0xb')]);router[_0xf8eb('0x3')]('/unhold',auth[_0xf8eb('0x7')](),auth[_0xf8eb('0x5')](),controller[_0xf8eb('0xc')]);router[_0xf8eb('0x3')](_0xf8eb('0xd'),auth[_0xf8eb('0x7')](),auth[_0xf8eb('0x5')](),controller[_0xf8eb('0xe')]);router['post'](_0xf8eb('0xf'),auth[_0xf8eb('0x7')](),auth[_0xf8eb('0x5')](),controller[_0xf8eb('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2821=['./webbar.controller','post','/originate','canUpdate','originate','/hangup','isAuthenticated','hangup','/answer','answer','hold','/calls','/transfer','transfer','exports','express','Router','../../components/auth/service'];(function(_0x22c407,_0x475425){var _0x9d7aeb=function(_0x5549fd){while(--_0x5549fd){_0x22c407['push'](_0x22c407['shift']());}};_0x9d7aeb(++_0x475425);}(_0x2821,0xc3));var _0x1282=function(_0x35625f,_0x2e7374){_0x35625f=_0x35625f-0x0;var _0x358909=_0x2821[_0x35625f];return _0x358909;};'use strict';var express=require(_0x1282('0x0'));var router=express[_0x1282('0x1')]();var auth=require(_0x1282('0x2'));var controller=require(_0x1282('0x3'));router[_0x1282('0x4')](_0x1282('0x5'),auth['isAuthenticated'](),auth[_0x1282('0x6')](),controller[_0x1282('0x7')]);router['post'](_0x1282('0x8'),auth[_0x1282('0x9')](),auth[_0x1282('0x6')](),controller[_0x1282('0xa')]);router[_0x1282('0x4')](_0x1282('0xb'),auth[_0x1282('0x9')](),auth['canUpdate'](),controller[_0x1282('0xc')]);router['post']('/hold',auth['isAuthenticated'](),auth[_0x1282('0x6')](),controller[_0x1282('0xd')]);router[_0x1282('0x4')]('/unhold',auth[_0x1282('0x9')](),auth[_0x1282('0x6')](),controller['unhold']);router['post'](_0x1282('0xe'),auth[_0x1282('0x9')](),auth[_0x1282('0x6')](),controller['calls']);router['post'](_0x1282('0xf'),auth[_0x1282('0x9')](),auth['canUpdate'](),controller[_0x1282('0x10')]);module[_0x1282('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 10fc18a..d481e22 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 _0x6b61=['name','status','NotFound','request','then','message','result','findOne','agent','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','info','originate\x20fired:','body','json','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','userId','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','all','filter','conference','conference\x20fired:','webbar:conference','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','ioredis','redis','localhost','validate','callNumber\x20is\x20required','string','number','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','log','handleError:','error','stack'];(function(_0x314916,_0x112f3d){var _0x4edc73=function(_0x12d3ce){while(--_0x12d3ce){_0x314916['push'](_0x314916['shift']());}};_0x4edc73(++_0x112f3d);}(_0x6b61,0x16a));var _0x16b6=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x6b61[_0x373dee];return _0x46798f;};'use strict';var path=require(_0x16b6('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x16b6('0x1'))['db'];var config=require(_0x16b6('0x2'));var util=require(_0x16b6('0x3'));var BPromise=require(_0x16b6('0x4'));var jayson=require(_0x16b6('0x5'));var amiClient=jayson[_0x16b6('0x6')][_0x16b6('0x7')]({'port':0x232a});var logger=require(_0x16b6('0x8'))('webbarapi');var Redis=require(_0x16b6('0x9'));config[_0x16b6('0xa')]=_['defaults'](config[_0x16b6('0xa')],{'host':_0x16b6('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x16b6('0xa')]));var Schema=require(_0x16b6('0xc'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x16b6('0xd')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x16b6('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x16b6('0xf'),'required':[!![],_0x16b6('0x10')]},'sessionId':{'type':_0x16b6('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x16b6('0xf'),'required':[!![],_0x16b6('0x10')]},'sessionId':{'type':_0x16b6('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':[!![],_0x16b6('0x11')]},'transferNumber':{'type':_0x16b6('0xe'),'required':[!![],_0x16b6('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x16b6('0xf'),'required':[!![],_0x16b6('0x10')]},'sessionId':{'type':_0x16b6('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x16b6('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x16b6('0xe'),'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(_0x5f42bc,_0x4833a0,_0xf6ec42){logger['info'](_0x5f42bc,_0x4833a0,JSON['stringify'](_0xf6ec42));io['to'](_0x5f42bc)['emit'](_0x4833a0,_0xf6ec42);}function handleError(_0x367edd){return function(_0x2d6cb9){console[_0x16b6('0x13')](_0x16b6('0x14'),_0x2d6cb9,_0x2d6cb9 instanceof RangeError);logger[_0x16b6('0x15')](_0x2d6cb9[_0x16b6('0x16')]);if(_0x2d6cb9 instanceof RangeError){if(_0x2d6cb9[_0x16b6('0x17')]){delete _0x2d6cb9[_0x16b6('0x17')];}_0x367edd[_0x16b6('0x18')](0x194)['send'](_0x2d6cb9);}else{if(_0x2d6cb9[_0x16b6('0x17')]){delete _0x2d6cb9['name'];}_0x367edd[_0x16b6('0x18')](0x1f4)['send'](_0x2d6cb9);}};}function checkError(){return function(_0x52e86c){if(!_0x52e86c){throw new RangeError(_0x16b6('0x19'));}return _0x52e86c;};}function respondWithRpcPromise(_0x375f2c,_0x1b5424){return new BPromise(function(_0x360d4a,_0x22d2f7){var _0x32f4f7=amiClient;return _0x32f4f7[_0x16b6('0x1a')](_0x375f2c,_0x1b5424)[_0x16b6('0x1b')](function(_0x4a3dc4){if(_0x4a3dc4[_0x16b6('0x15')]){if(_0x4a3dc4[_0x16b6('0x15')]['code']===0x1f4){return _0x22d2f7(_0x4a3dc4[_0x16b6('0x15')][_0x16b6('0x1c')]);}return _0x360d4a(_0x4a3dc4['error'][_0x16b6('0x1c')]);}else{_0x360d4a(_0x4a3dc4[_0x16b6('0x1d')]);}})['catch'](function(_0x22012e){_0x22d2f7(_0x22012e);});});}function getAgent(_0x385855){return db['User'][_0x16b6('0x1e')]({'where':{'id':_0x385855,'role':_0x16b6('0x1f')}})[_0x16b6('0x1b')](checkError());}function getAgentCheckSession(_0x35b127,_0x599aa0){return new BPromise(function(_0x44fa79,_0x499618){var _0x372843=respondWithRpcPromise('VoiceChannels');var _0x43c77a=getAgent(_0x35b127);Promise['all']([_0x372843,_0x43c77a])[_0x16b6('0x1b')](function(_0x416244){var _0x19e669=_0x416244[0x0];var _0x2c1e63=_0x416244[0x1];var _0x4e3191=_['filter'](_0x19e669[_0x16b6('0x20')],function(_0x45b632){return _0x45b632[_0x16b6('0x21')]==_0x2c1e63['id']&&_0x45b632[_0x16b6('0x22')]==_0x599aa0;});if(_0x4e3191[_0x16b6('0x23')]==0x1){_0x44fa79(_0x2c1e63);}else{_0x499618(new RangeError(_0x16b6('0x24')+_0x599aa0+_0x16b6('0x25')));}});});}exports[_0x16b6('0x26')]=function(_0x1c870e,_0x4fa98e){logger[_0x16b6('0x27')](_0x16b6('0x28'),_0x1c870e[_0x16b6('0x29')]);var _0x1224b8=originateValidation[_0x16b6('0xc')](_0x1c870e[_0x16b6('0x29')]);if(_0x1224b8['length']>0x0){return _0x4fa98e[_0x16b6('0x18')](0x190)[_0x16b6('0x2a')](_0x1224b8);}var _0x5c04d9=_0x1c870e[_0x16b6('0x29')]['userId'];var _0x14f4e1=_0x1c870e[_0x16b6('0x29')][_0x16b6('0x2b')];var _0x13af30=_0x1c870e[_0x16b6('0x29')][_0x16b6('0x2c')];var _0x3950ed=_0x1c870e[_0x16b6('0x29')][_0x16b6('0x2d')];return getAgent(_0x5c04d9)[_0x16b6('0x1b')](function(_0x12de4b){logger[_0x16b6('0x27')](_0x16b6('0x2e'),_0x12de4b[_0x16b6('0x17')]);emit(util[_0x16b6('0x2f')](_0x16b6('0x30'),_0x12de4b[_0x16b6('0x17')]),_0x16b6('0x31'),{'callNumber':_0x14f4e1,'callerId':_0x13af30,'callbackUrl':_0x3950ed});return _0x4fa98e['status'](0xc8)['json']({'error':![],'message':_0x16b6('0x32')});})[_0x16b6('0x33')](handleError(_0x4fa98e));};exports[_0x16b6('0x34')]=function(_0x44d567,_0x4eef72){logger[_0x16b6('0x27')](_0x16b6('0x35'),_0x44d567['body']);var _0x386f9d=hangupValidation[_0x16b6('0xc')](_0x44d567[_0x16b6('0x29')]);if(_0x386f9d['length']>0x0){return _0x4eef72[_0x16b6('0x18')](0x190)['json'](_0x386f9d);}var _0x1989d8=_0x44d567['body'][_0x16b6('0x36')];var _0x2be4e5=_0x44d567[_0x16b6('0x29')][_0x16b6('0x22')];return getAgent(_0x1989d8)['then'](function(_0x5d2ba0){logger[_0x16b6('0x27')](_0x16b6('0x2e'),_0x5d2ba0['name']);emit(util[_0x16b6('0x2f')]('user:%s',_0x5d2ba0[_0x16b6('0x17')]),'webbar:hangup',{'sessionId':_0x2be4e5});return _0x4eef72['status'](0xc8)[_0x16b6('0x2a')]({'error':![],'message':'hangup\x20executed!'});})[_0x16b6('0x33')](handleError(_0x4eef72));};exports[_0x16b6('0x37')]=function(_0x2997c9,_0x1be8cd){logger[_0x16b6('0x27')](_0x16b6('0x38'),_0x2997c9[_0x16b6('0x29')]);var _0x3b8476=answerValidation[_0x16b6('0xc')](_0x2997c9[_0x16b6('0x29')]);if(_0x3b8476[_0x16b6('0x23')]>0x0){return _0x1be8cd[_0x16b6('0x18')](0x190)[_0x16b6('0x2a')](_0x3b8476);}var _0x2a2fe2=_0x2997c9[_0x16b6('0x29')][_0x16b6('0x36')];var _0x9c8e8=_0x2997c9[_0x16b6('0x29')]['sessionId'];return getAgent(_0x2a2fe2)['then'](function(_0x4ae2e5){logger[_0x16b6('0x27')]('entityFound:',_0x4ae2e5['name']);emit(util[_0x16b6('0x2f')](_0x16b6('0x30'),_0x4ae2e5['name']),_0x16b6('0x39'),{'sessionId':_0x9c8e8});return _0x1be8cd[_0x16b6('0x18')](0xc8)['json']({'error':![],'message':_0x16b6('0x3a')});})[_0x16b6('0x33')](handleError(_0x1be8cd));};exports[_0x16b6('0x3b')]=function(_0x58ee76,_0x41938e){logger[_0x16b6('0x27')](_0x16b6('0x3c'),_0x58ee76['body']);var _0x269f94=holdValidation['validate'](_0x58ee76[_0x16b6('0x29')]);if(_0x269f94[_0x16b6('0x23')]>0x0){return _0x41938e[_0x16b6('0x18')](0x190)[_0x16b6('0x2a')](_0x269f94);}var _0x1b3dc3=_0x58ee76['body'][_0x16b6('0x36')];var _0x36ab91=_0x58ee76[_0x16b6('0x29')]['sessionId'];return getAgent(_0x1b3dc3)[_0x16b6('0x1b')](function(_0x24b9f3){logger['info'](_0x16b6('0x2e'),_0x24b9f3[_0x16b6('0x17')]);emit(util['format']('user:%s',_0x24b9f3[_0x16b6('0x17')]),_0x16b6('0x3d'),{'sessionId':_0x36ab91});return _0x41938e[_0x16b6('0x18')](0xc8)[_0x16b6('0x2a')]({'error':![],'message':_0x16b6('0x3e')});})[_0x16b6('0x33')](handleError(_0x41938e));};exports[_0x16b6('0x3f')]=function(_0x5c06e9,_0x2fd5a2){logger[_0x16b6('0x27')]('unhold\x20fired:',_0x5c06e9[_0x16b6('0x29')]);var _0x401192=unholdValidation[_0x16b6('0xc')](_0x5c06e9[_0x16b6('0x29')]);if(_0x401192['length']>0x0){return _0x2fd5a2['status'](0x190)[_0x16b6('0x2a')](_0x401192);}var _0x286e71=_0x5c06e9[_0x16b6('0x29')][_0x16b6('0x36')];var _0x1a6248=_0x5c06e9[_0x16b6('0x29')][_0x16b6('0x22')];return getAgent(_0x286e71)[_0x16b6('0x1b')](function(_0x39ac08){logger['info'](_0x16b6('0x2e'),_0x39ac08[_0x16b6('0x17')]);emit(util[_0x16b6('0x2f')](_0x16b6('0x30'),_0x39ac08[_0x16b6('0x17')]),'webbar:unhold',{'sessionId':_0x1a6248});return _0x2fd5a2[_0x16b6('0x18')](0xc8)['json']({'error':![],'message':_0x16b6('0x40')});})[_0x16b6('0x33')](handleError(_0x2fd5a2));};exports[_0x16b6('0x41')]=function(_0x404501,_0x43894e){logger['info'](_0x16b6('0x42'),_0x43894e[_0x16b6('0x29')]);var _0x1e00b3=callsValidation[_0x16b6('0xc')](_0x404501[_0x16b6('0x29')]);if(_0x1e00b3[_0x16b6('0x23')]>0x0){return _0x43894e[_0x16b6('0x18')](0x190)[_0x16b6('0x2a')](_0x1e00b3);}var _0x31c6b6=_0x404501[_0x16b6('0x29')][_0x16b6('0x36')];var _0x1465e8=respondWithRpcPromise(_0x16b6('0x43'));var _0x42c5ea=getAgent(_0x31c6b6);return Promise[_0x16b6('0x44')]([_0x1465e8,_0x42c5ea])[_0x16b6('0x1b')](function(_0x52275c){var _0x2e88eb=_0x52275c[0x0];var _0x3c4492=_0x52275c[0x1];var _0x4e61d8=_[_0x16b6('0x45')](_0x2e88eb[_0x16b6('0x20')],function(_0x4c72df){return _0x4c72df[_0x16b6('0x21')]==_0x3c4492['id'];});return _0x43894e[_0x16b6('0x18')](0xc8)['json']({'count':_0x4e61d8[_0x16b6('0x23')],'rows':_0x4e61d8});})[_0x16b6('0x33')](handleError(_0x43894e));};exports[_0x16b6('0x46')]=function(_0x150514,_0x4bc42b){logger[_0x16b6('0x27')](_0x16b6('0x47'),_0x150514[_0x16b6('0x29')]);var _0x1a47ba=conferenceValidation[_0x16b6('0xc')](_0x150514[_0x16b6('0x29')]);if(_0x1a47ba['length']>0x0){return _0x4bc42b[_0x16b6('0x18')](0x190)[_0x16b6('0x2a')](_0x1a47ba);}var _0x3f26a0=_0x150514[_0x16b6('0x29')][_0x16b6('0x36')];return getAgent(_0x3f26a0)[_0x16b6('0x1b')](function(_0x1673b1){logger[_0x16b6('0x27')]('entityFound:',_0x1673b1[_0x16b6('0x17')]);emit(util[_0x16b6('0x2f')](_0x16b6('0x30'),_0x1673b1[_0x16b6('0x17')]),_0x16b6('0x48'));return _0x4bc42b[_0x16b6('0x18')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0x16b6('0x33')](handleError(_0x4bc42b));};exports['transfer']=function(_0x150607,_0x348046){logger[_0x16b6('0x27')](_0x16b6('0x49'),_0x150607[_0x16b6('0x29')]);var _0x348fa8=transferValidation[_0x16b6('0xc')](_0x150607[_0x16b6('0x29')]);if(_0x348fa8[_0x16b6('0x23')]>0x0){return _0x348046[_0x16b6('0x18')](0x190)[_0x16b6('0x2a')](_0x348fa8);}var _0x3e099a=_0x150607[_0x16b6('0x29')]['userId'];var _0x5a53c7=_0x150607['body']['sessionId'];var _0x494dc8=_0x150607[_0x16b6('0x29')][_0x16b6('0x4a')];return getAgent(_0x3e099a)['then'](function(_0x43909e){logger['info']('entityFound:',_0x43909e[_0x16b6('0x17')]);emit(util[_0x16b6('0x2f')](_0x16b6('0x30'),_0x43909e[_0x16b6('0x17')]),_0x16b6('0x4b'),{'sessionId':_0x5a53c7,'transferNumber':_0x494dc8});return _0x348046[_0x16b6('0x18')](0xc8)[_0x16b6('0x2a')]({'error':![],'message':_0x16b6('0x4c')});})['catch'](handleError(_0x348046));}; \ No newline at end of file +var _0xc252=['log','error','stack','name','send','status','NotFound','request','then','message','result','catch','User','findOne','agent','VoiceChannels','filter','rows','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup\x20fired:','length','webbar:hangup','answer','answer\x20fired:','answer\x20executed!','hold','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','webbarapi','redis','defaults','localhost','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','info','emit'];(function(_0x40822a,_0x582b60){var _0x357420=function(_0x6cee0b){while(--_0x6cee0b){_0x40822a['push'](_0x40822a['shift']());}};_0x357420(++_0x582b60);}(_0xc252,0x118));var _0x2c25=function(_0x4ba904,_0x3fcd22){_0x4ba904=_0x4ba904-0x0;var _0x540d8e=_0xc252[_0x4ba904];return _0x540d8e;};'use strict';var path=require(_0x2c25('0x0'));var fs=require('fs');var _=require(_0x2c25('0x1'));var db=require(_0x2c25('0x2'))['db'];var config=require(_0x2c25('0x3'));var util=require(_0x2c25('0x4'));var BPromise=require(_0x2c25('0x5'));var jayson=require(_0x2c25('0x6'));var amiClient=jayson[_0x2c25('0x7')]['http']({'port':0x232a});var logger=require('../../config/logger')(_0x2c25('0x8'));var Redis=require('ioredis');config[_0x2c25('0x9')]=_[_0x2c25('0xa')](config[_0x2c25('0x9')],{'host':_0x2c25('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0x2c25('0xc'));var originateValidation=new Schema({'userId':{'type':_0x2c25('0xd'),'required':[!![],_0x2c25('0xe')]},'callNumber':{'type':_0x2c25('0xf'),'required':[!![],_0x2c25('0x10')]},'callerId':{'type':_0x2c25('0xf')},'callbackUrl':{'type':_0x2c25('0xf')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x2c25('0xe')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x2c25('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x2c25('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x2c25('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x2c25('0xf'),'required':[!![],_0x2c25('0x11')]},'transferNumber':{'type':'string','required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x2c25('0xd'),'required':[!![],_0x2c25('0xe')]},'sessionId':{'type':_0x2c25('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x2c25('0xd'),'required':[!![],_0x2c25('0xe')]},'sessionId':{'type':_0x2c25('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x2c25('0xd'),'required':[!![],_0x2c25('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x2c25('0xd'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x48aed8,_0x207fdb,_0x1277db){logger[_0x2c25('0x12')](_0x48aed8,_0x207fdb,JSON['stringify'](_0x1277db));io['to'](_0x48aed8)[_0x2c25('0x13')](_0x207fdb,_0x1277db);}function handleError(_0x7372cf){return function(_0x28093a){console[_0x2c25('0x14')]('handleError:',_0x28093a,_0x28093a instanceof RangeError);logger[_0x2c25('0x15')](_0x28093a[_0x2c25('0x16')]);if(_0x28093a instanceof RangeError){if(_0x28093a[_0x2c25('0x17')]){delete _0x28093a[_0x2c25('0x17')];}_0x7372cf['status'](0x194)[_0x2c25('0x18')](_0x28093a);}else{if(_0x28093a['name']){delete _0x28093a['name'];}_0x7372cf[_0x2c25('0x19')](0x1f4)['send'](_0x28093a);}};}function checkError(){return function(_0x18bee0){if(!_0x18bee0){throw new RangeError(_0x2c25('0x1a'));}return _0x18bee0;};}function respondWithRpcPromise(_0x39f32e,_0x3f8adb){return new BPromise(function(_0xaadc19,_0x372887){var _0x32b1ee=amiClient;return _0x32b1ee[_0x2c25('0x1b')](_0x39f32e,_0x3f8adb)[_0x2c25('0x1c')](function(_0x6c42fe){if(_0x6c42fe[_0x2c25('0x15')]){if(_0x6c42fe['error']['code']===0x1f4){return _0x372887(_0x6c42fe[_0x2c25('0x15')]['message']);}return _0xaadc19(_0x6c42fe[_0x2c25('0x15')][_0x2c25('0x1d')]);}else{_0xaadc19(_0x6c42fe[_0x2c25('0x1e')]);}})[_0x2c25('0x1f')](function(_0x1bb20c){_0x372887(_0x1bb20c);});});}function getAgent(_0x5d6b6b){return db[_0x2c25('0x20')][_0x2c25('0x21')]({'where':{'id':_0x5d6b6b,'role':_0x2c25('0x22')}})['then'](checkError());}function getAgentCheckSession(_0x38cebc,_0x531aee){return new BPromise(function(_0xa7cbb6,_0x43c621){var _0x54e0c2=respondWithRpcPromise(_0x2c25('0x23'));var _0x41b722=getAgent(_0x38cebc);Promise['all']([_0x54e0c2,_0x41b722])[_0x2c25('0x1c')](function(_0x4a8193){var _0x553f0a=_0x4a8193[0x0];var _0xc56104=_0x4a8193[0x1];var _0x9c12b1=_[_0x2c25('0x24')](_0x553f0a[_0x2c25('0x25')],function(_0x6e97f6){return _0x6e97f6[_0x2c25('0x26')]==_0xc56104['id']&&_0x6e97f6[_0x2c25('0x27')]==_0x531aee;});if(_0x9c12b1['length']==0x1){_0xa7cbb6(_0xc56104);}else{_0x43c621(new RangeError(_0x2c25('0x28')+_0x531aee+_0x2c25('0x29')));}});});}exports[_0x2c25('0x2a')]=function(_0x55a623,_0xf1dfae){logger[_0x2c25('0x12')](_0x2c25('0x2b'),_0x55a623[_0x2c25('0x2c')]);var _0x4bc6c9=originateValidation[_0x2c25('0xc')](_0x55a623['body']);if(_0x4bc6c9['length']>0x0){return _0xf1dfae[_0x2c25('0x19')](0x190)[_0x2c25('0x2d')](_0x4bc6c9);}var _0x48d68c=_0x55a623[_0x2c25('0x2c')][_0x2c25('0x2e')];var _0x8f2f7f=_0x55a623[_0x2c25('0x2c')]['callNumber'];var _0x516f06=_0x55a623[_0x2c25('0x2c')][_0x2c25('0x2f')];var _0x3c6665=_0x55a623[_0x2c25('0x2c')][_0x2c25('0x30')];return getAgent(_0x48d68c)[_0x2c25('0x1c')](function(_0x2b2871){logger[_0x2c25('0x12')](_0x2c25('0x31'),_0x2b2871['name']);emit(util[_0x2c25('0x32')](_0x2c25('0x33'),_0x2b2871[_0x2c25('0x17')]),_0x2c25('0x34'),{'callNumber':_0x8f2f7f,'callerId':_0x516f06,'callbackUrl':_0x3c6665});return _0xf1dfae[_0x2c25('0x19')](0xc8)[_0x2c25('0x2d')]({'error':![],'message':_0x2c25('0x35')});})[_0x2c25('0x1f')](handleError(_0xf1dfae));};exports['hangup']=function(_0x489c5b,_0xb8c96b){logger['info'](_0x2c25('0x36'),_0x489c5b[_0x2c25('0x2c')]);var _0x49e26b=hangupValidation[_0x2c25('0xc')](_0x489c5b[_0x2c25('0x2c')]);if(_0x49e26b[_0x2c25('0x37')]>0x0){return _0xb8c96b[_0x2c25('0x19')](0x190)[_0x2c25('0x2d')](_0x49e26b);}var _0x35f620=_0x489c5b[_0x2c25('0x2c')][_0x2c25('0x2e')];var _0x377da9=_0x489c5b[_0x2c25('0x2c')]['sessionId'];return getAgent(_0x35f620)[_0x2c25('0x1c')](function(_0x129fbd){logger[_0x2c25('0x12')]('entityFound:',_0x129fbd['name']);emit(util['format'](_0x2c25('0x33'),_0x129fbd[_0x2c25('0x17')]),_0x2c25('0x38'),{'sessionId':_0x377da9});return _0xb8c96b[_0x2c25('0x19')](0xc8)[_0x2c25('0x2d')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0xb8c96b));};exports[_0x2c25('0x39')]=function(_0x55bd8c,_0x5280e1){logger[_0x2c25('0x12')](_0x2c25('0x3a'),_0x55bd8c[_0x2c25('0x2c')]);var _0x5ebcfd=answerValidation[_0x2c25('0xc')](_0x55bd8c[_0x2c25('0x2c')]);if(_0x5ebcfd[_0x2c25('0x37')]>0x0){return _0x5280e1[_0x2c25('0x19')](0x190)['json'](_0x5ebcfd);}var _0x29560d=_0x55bd8c[_0x2c25('0x2c')][_0x2c25('0x2e')];var _0x571d7b=_0x55bd8c[_0x2c25('0x2c')][_0x2c25('0x27')];return getAgent(_0x29560d)[_0x2c25('0x1c')](function(_0x2716ef){logger[_0x2c25('0x12')](_0x2c25('0x31'),_0x2716ef['name']);emit(util[_0x2c25('0x32')]('user:%s',_0x2716ef['name']),'webbar:answer',{'sessionId':_0x571d7b});return _0x5280e1[_0x2c25('0x19')](0xc8)[_0x2c25('0x2d')]({'error':![],'message':_0x2c25('0x3b')});})[_0x2c25('0x1f')](handleError(_0x5280e1));};exports[_0x2c25('0x3c')]=function(_0x21c0eb,_0x24945c){logger['info']('hold\x20fired:',_0x21c0eb[_0x2c25('0x2c')]);var _0x27f2f8=holdValidation['validate'](_0x21c0eb['body']);if(_0x27f2f8[_0x2c25('0x37')]>0x0){return _0x24945c[_0x2c25('0x19')](0x190)[_0x2c25('0x2d')](_0x27f2f8);}var _0x158113=_0x21c0eb['body'][_0x2c25('0x2e')];var _0x3c1fa4=_0x21c0eb[_0x2c25('0x2c')][_0x2c25('0x27')];return getAgent(_0x158113)[_0x2c25('0x1c')](function(_0x1b7966){logger[_0x2c25('0x12')](_0x2c25('0x31'),_0x1b7966['name']);emit(util[_0x2c25('0x32')]('user:%s',_0x1b7966[_0x2c25('0x17')]),_0x2c25('0x3d'),{'sessionId':_0x3c1fa4});return _0x24945c[_0x2c25('0x19')](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})[_0x2c25('0x1f')](handleError(_0x24945c));};exports[_0x2c25('0x3e')]=function(_0x2310b0,_0xe7656d){logger[_0x2c25('0x12')](_0x2c25('0x3f'),_0x2310b0[_0x2c25('0x2c')]);var _0x11d627=unholdValidation[_0x2c25('0xc')](_0x2310b0[_0x2c25('0x2c')]);if(_0x11d627['length']>0x0){return _0xe7656d[_0x2c25('0x19')](0x190)[_0x2c25('0x2d')](_0x11d627);}var _0x4bad15=_0x2310b0[_0x2c25('0x2c')]['userId'];var _0x489b18=_0x2310b0[_0x2c25('0x2c')][_0x2c25('0x27')];return getAgent(_0x4bad15)[_0x2c25('0x1c')](function(_0x3c36b6){logger['info'](_0x2c25('0x31'),_0x3c36b6[_0x2c25('0x17')]);emit(util[_0x2c25('0x32')](_0x2c25('0x33'),_0x3c36b6['name']),_0x2c25('0x40'),{'sessionId':_0x489b18});return _0xe7656d[_0x2c25('0x19')](0xc8)[_0x2c25('0x2d')]({'error':![],'message':_0x2c25('0x41')});})[_0x2c25('0x1f')](handleError(_0xe7656d));};exports[_0x2c25('0x42')]=function(_0x2b791d,_0x36d739){logger[_0x2c25('0x12')](_0x2c25('0x43'),_0x36d739['body']);var _0xea0ccd=callsValidation[_0x2c25('0xc')](_0x2b791d['body']);if(_0xea0ccd[_0x2c25('0x37')]>0x0){return _0x36d739[_0x2c25('0x19')](0x190)[_0x2c25('0x2d')](_0xea0ccd);}var _0x1faf75=_0x2b791d['body'][_0x2c25('0x2e')];var _0x5d3158=respondWithRpcPromise('VoiceChannels');var _0x172ccd=getAgent(_0x1faf75);return Promise['all']([_0x5d3158,_0x172ccd])['then'](function(_0x3b28ae){var _0x2fe225=_0x3b28ae[0x0];var _0x26fb4c=_0x3b28ae[0x1];var _0x3accb8=_[_0x2c25('0x24')](_0x2fe225[_0x2c25('0x25')],function(_0x1ae2de){return _0x1ae2de[_0x2c25('0x26')]==_0x26fb4c['id'];});return _0x36d739[_0x2c25('0x19')](0xc8)[_0x2c25('0x2d')]({'count':_0x3accb8[_0x2c25('0x37')],'rows':_0x3accb8});})[_0x2c25('0x1f')](handleError(_0x36d739));};exports[_0x2c25('0x44')]=function(_0x29990b,_0x1e2348){logger[_0x2c25('0x12')](_0x2c25('0x45'),_0x29990b[_0x2c25('0x2c')]);var _0x24bc9e=conferenceValidation[_0x2c25('0xc')](_0x29990b[_0x2c25('0x2c')]);if(_0x24bc9e['length']>0x0){return _0x1e2348[_0x2c25('0x19')](0x190)[_0x2c25('0x2d')](_0x24bc9e);}var _0x55358c=_0x29990b[_0x2c25('0x2c')][_0x2c25('0x2e')];return getAgent(_0x55358c)['then'](function(_0x21498f){logger[_0x2c25('0x12')](_0x2c25('0x31'),_0x21498f[_0x2c25('0x17')]);emit(util['format'](_0x2c25('0x33'),_0x21498f['name']),'webbar:conference');return _0x1e2348[_0x2c25('0x19')](0xc8)['json']({'error':![],'message':_0x2c25('0x46')});})[_0x2c25('0x1f')](handleError(_0x1e2348));};exports[_0x2c25('0x47')]=function(_0x485711,_0x30b003){logger[_0x2c25('0x12')]('transfer\x20fired:',_0x485711['body']);var _0x3b53f3=transferValidation[_0x2c25('0xc')](_0x485711['body']);if(_0x3b53f3[_0x2c25('0x37')]>0x0){return _0x30b003[_0x2c25('0x19')](0x190)[_0x2c25('0x2d')](_0x3b53f3);}var _0x292f24=_0x485711['body'][_0x2c25('0x2e')];var _0x241335=_0x485711['body'][_0x2c25('0x27')];var _0x3675fd=_0x485711[_0x2c25('0x2c')][_0x2c25('0x48')];return getAgent(_0x292f24)[_0x2c25('0x1c')](function(_0x404478){logger[_0x2c25('0x12')](_0x2c25('0x31'),_0x404478[_0x2c25('0x17')]);emit(util[_0x2c25('0x32')]('user:%s',_0x404478[_0x2c25('0x17')]),_0x2c25('0x49'),{'sessionId':_0x241335,'transferNumber':_0x3675fd});return _0x30b003[_0x2c25('0x19')](0xc8)[_0x2c25('0x2d')]({'error':![],'message':_0x2c25('0x4a')});})[_0x2c25('0x1f')](handleError(_0x30b003));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 0e3d0e2..6f9d4d7 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 _0xfd8f=['/:id/canned_answers','getAnswers','/:id/users','getApplications','post','create','/:id/dispositions','addDisposition','addAnswer','addAgents','/:id/applications','addApplications','/:id/notify','notify','send','put','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','getDispositions'];(function(_0x4506c8,_0x2939ba){var _0x45b90f=function(_0x2cd7ef){while(--_0x2cd7ef){_0x4506c8['push'](_0x4506c8['shift']());}};_0x45b90f(++_0x2939ba);}(_0xfd8f,0xae));var _0xffd8=function(_0x2e1091,_0x3eeec8){_0x2e1091=_0x2e1091-0x0;var _0x2040cd=_0xfd8f[_0x2e1091];return _0x2040cd;};'use strict';var multer=require(_0xffd8('0x0'));var util=require(_0xffd8('0x1'));var path=require('path');var timeout=require(_0xffd8('0x2'));var express=require(_0xffd8('0x3'));var router=express[_0xffd8('0x4')]();var auth=require(_0xffd8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xffd8('0x6'));var controller=require(_0xffd8('0x7'));router['get']('/',auth[_0xffd8('0x8')](),controller[_0xffd8('0x9')]);router[_0xffd8('0xa')](_0xffd8('0xb'),auth[_0xffd8('0x8')](),controller[_0xffd8('0xc')]);router['get'](_0xffd8('0xd'),auth[_0xffd8('0x8')](),controller[_0xffd8('0xe')]);router[_0xffd8('0xa')]('/:id/dispositions',auth[_0xffd8('0x8')](),controller[_0xffd8('0xf')]);router[_0xffd8('0xa')](_0xffd8('0x10'),auth[_0xffd8('0x8')](),controller[_0xffd8('0x11')]);router[_0xffd8('0xa')](_0xffd8('0x12'),auth[_0xffd8('0x8')](),controller['getAgents']);router['get']('/:id/applications',auth[_0xffd8('0x8')](),controller[_0xffd8('0x13')]);router[_0xffd8('0x14')]('/',auth[_0xffd8('0x8')](),controller[_0xffd8('0x15')]);router['post'](_0xffd8('0x16'),auth[_0xffd8('0x8')](),controller[_0xffd8('0x17')]);router[_0xffd8('0x14')](_0xffd8('0x10'),auth['isAuthenticated'](),controller[_0xffd8('0x18')]);router[_0xffd8('0x14')]('/:id/users',auth[_0xffd8('0x8')](),controller[_0xffd8('0x19')]);router[_0xffd8('0x14')](_0xffd8('0x1a'),auth[_0xffd8('0x8')](),controller[_0xffd8('0x1b')]);router['post'](_0xffd8('0x1c'),controller[_0xffd8('0x1d')]);router[_0xffd8('0x14')]('/:id/send',auth['isAuthenticated'](),controller[_0xffd8('0x1e')]);router[_0xffd8('0x1f')](_0xffd8('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xffd8('0xd'),auth[_0xffd8('0x8')](),controller[_0xffd8('0x20')]);router[_0xffd8('0x21')]('/:id/dispositions',auth[_0xffd8('0x8')](),controller[_0xffd8('0x22')]);router[_0xffd8('0x21')](_0xffd8('0x10'),auth['isAuthenticated'](),controller[_0xffd8('0x23')]);router[_0xffd8('0x21')](_0xffd8('0x12'),auth['isAuthenticated'](),controller[_0xffd8('0x24')]);module[_0xffd8('0x25')]=router; \ No newline at end of file +var _0x125c=['/:id/applications','getApplications','create','post','addDisposition','/:id/canned_answers','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','update','delete','destroy','removeAnswers','removeAgents','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/dispositions','/:id/users','getAgents'];(function(_0x4b26d3,_0x214da6){var _0x26c719=function(_0x1951be){while(--_0x1951be){_0x4b26d3['push'](_0x4b26d3['shift']());}};_0x26c719(++_0x214da6);}(_0x125c,0xda));var _0xc125=function(_0x17731d,_0x5662b5){_0x17731d=_0x17731d-0x0;var _0x2e73d5=_0x125c[_0x17731d];return _0x2e73d5;};'use strict';var multer=require('multer');var util=require(_0xc125('0x0'));var path=require(_0xc125('0x1'));var timeout=require(_0xc125('0x2'));var express=require('express');var router=express[_0xc125('0x3')]();var auth=require(_0xc125('0x4'));var interaction=require(_0xc125('0x5'));var config=require(_0xc125('0x6'));var controller=require('./whatsappAccount.controller');router[_0xc125('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xc125('0x7')]('/:id',auth[_0xc125('0x8')](),controller[_0xc125('0x9')]);router['get'](_0xc125('0xa'),auth[_0xc125('0x8')](),controller['getDispositions']);router[_0xc125('0x7')]('/:id/canned_answers',auth[_0xc125('0x8')](),controller['getAnswers']);router['get'](_0xc125('0xb'),auth[_0xc125('0x8')](),controller[_0xc125('0xc')]);router[_0xc125('0x7')](_0xc125('0xd'),auth[_0xc125('0x8')](),controller[_0xc125('0xe')]);router['post']('/',auth[_0xc125('0x8')](),controller[_0xc125('0xf')]);router[_0xc125('0x10')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc125('0x11')]);router[_0xc125('0x10')](_0xc125('0x12'),auth['isAuthenticated'](),controller[_0xc125('0x13')]);router[_0xc125('0x10')](_0xc125('0xb'),auth['isAuthenticated'](),controller[_0xc125('0x14')]);router['post'](_0xc125('0xd'),auth[_0xc125('0x8')](),controller[_0xc125('0x15')]);router[_0xc125('0x10')](_0xc125('0x16'),controller[_0xc125('0x17')]);router[_0xc125('0x10')](_0xc125('0x18'),auth['isAuthenticated'](),controller[_0xc125('0x19')]);router[_0xc125('0x1a')](_0xc125('0x1b'),auth[_0xc125('0x8')](),controller[_0xc125('0x1c')]);router[_0xc125('0x1d')](_0xc125('0x1b'),auth[_0xc125('0x8')](),controller[_0xc125('0x1e')]);router[_0xc125('0x1d')](_0xc125('0xa'),auth[_0xc125('0x8')](),controller['removeDispositions']);router['delete'](_0xc125('0x12'),auth[_0xc125('0x8')](),controller[_0xc125('0x1f')]);router[_0xc125('0x1d')](_0xc125('0xb'),auth[_0xc125('0x8')](),controller[_0xc125('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index ec914cb..18cd1c2 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 _0x1eeb=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','STRING','generate','ENUM','twilio'];(function(_0x47b7c9,_0x3848b2){var _0x435aaf=function(_0x3befc4){while(--_0x3befc4){_0x47b7c9['push'](_0x47b7c9['shift']());}};_0x435aaf(++_0x3848b2);}(_0x1eeb,0x1cf));var _0xb1ee=function(_0xafedec,_0x32ac5d){_0xafedec=_0xafedec-0x0;var _0xdefa7=_0x1eeb[_0xafedec];return _0xdefa7;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xb1ee('0x0'));module['exports']={'name':{'type':Sequelize[_0xb1ee('0x1')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xb1ee('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xb1ee('0x1')],'defaultValue':function(){return rs[_0xb1ee('0x2')]();}},'phone':{'type':Sequelize[_0xb1ee('0x1')]},'type':{'type':Sequelize[_0xb1ee('0x3')](_0xb1ee('0x4'))},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xb1ee('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xb1ee('0x5');}},'notificationSound':{'type':Sequelize[_0xb1ee('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xb1ee('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb1ee('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb1ee('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb1ee('0x7')],'comment':_0xb1ee('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xb1ee('0x6')],'defaultValue':![],'comment':_0xb1ee('0x9'),'set':function(_0x1dd75a){if(!_0x1dd75a){this[_0xb1ee('0xa')](_0xb1ee('0xb'),null);}this['setDataValue'](_0xb1ee('0xc'),_0x1dd75a);}},'description':{'type':Sequelize[_0xb1ee('0x1')]}}; \ No newline at end of file +var _0xaab6=['mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','name','STRING','generate','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xaab6,0x13d));var _0x6aab=function(_0x1d0948,_0x29a5ad){_0x1d0948=_0x1d0948-0x0;var _0x405614=_0xaab6[_0x1d0948];return _0x405614;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x6aab('0x0'));module[_0x6aab('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6aab('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x6aab('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x6aab('0x3')],'defaultValue':function(){return rs[_0x6aab('0x4')]();}},'phone':{'type':Sequelize[_0x6aab('0x3')]},'type':{'type':Sequelize[_0x6aab('0x5')]('twilio')},'accountSid':{'type':Sequelize[_0x6aab('0x3')]},'authToken':{'type':Sequelize[_0x6aab('0x3')]},'notificationTemplate':{'type':Sequelize[_0x6aab('0x6')],'defaultValue':function(){return _0x6aab('0x7');}},'notificationSound':{'type':Sequelize[_0x6aab('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x6aab('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6aab('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6aab('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6aab('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6aab('0x9')],'comment':_0x6aab('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x6aab('0x8')],'defaultValue':![],'comment':_0x6aab('0xb'),'set':function(_0x4d8cdf){if(!_0x4d8cdf){this[_0x6aab('0xc')](_0x6aab('0xd'),null);}this['setDataValue'](_0x6aab('0xe'),_0x4d8cdf);}},'description':{'type':Sequelize[_0x6aab('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 5d570b9..7376287 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 _0xd8b0=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','code','message','error','sendStatus','end','status','limit','set','apply','reject','save','update','then','get','WhatsappAccounts','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','offset','sort','filter','merge','where','type','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','fields','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','params','describe','addDisposition','getDispositions','findOne','Disposition','order','pick','WhatsappAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','removeAgents','emit','getAgents','User','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','Applications','applications','orderBy','account','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','from','replace','whatsapp:','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmContact','Contacts','DESC','contact','interaction','created','autoclose','push','close','*,*,*,*','WhatsappMessage','ContactId','UserId','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','json','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','WhatsappInteraction','out','Messages','dataValues','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse'];(function(_0xe770ee,_0x537d4b){var _0x14979b=function(_0x2ae936){while(--_0x2ae936){_0xe770ee['push'](_0xe770ee['shift']());}};_0x14979b(++_0x537d4b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var db=require(_0x0d8b('0x15'))['db'];config[_0x0d8b('0x16')]=_[_0x0d8b('0x17')](config[_0x0d8b('0x16')],{'host':_0x0d8b('0x18'),'port':0x18eb});var socket=require(_0x0d8b('0x19'))(new Redis(config[_0x0d8b('0x16')]));require(_0x0d8b('0x1a'))[_0x0d8b('0x1b')](socket);var jayson=require(_0x0d8b('0x1c'));var client=jayson[_0x0d8b('0x1d')][_0x0d8b('0x1e')]({'port':0x232c});function checkPasswordPattern(_0x2d4e1c,_0x4f6f21,_0x23eb7b){if(_0x23eb7b){var _0xa86349=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa86349[_0x0d8b('0x1f')](_0x4f6f21)){return _0x2d4e1c;}else{throw new db[(_0x0d8b('0x20'))][(_0x0d8b('0x21'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2d4e1c;}}function respondWithRpcPromise(_0x106a01,_0x4586c2,_0x2fd0fc,_0x5fecbd){return new BPromise(function(_0x333674,_0x18dd2d){var _0x264b39=_0x5fecbd||client;return _0x264b39[_0x0d8b('0x22')](_0x106a01,_0x2fd0fc)['then'](function(_0x27512e){logger[_0x0d8b('0x23')](_0x0d8b('0x24'),_0x4586c2,_0x0d8b('0x25'));logger[_0x0d8b('0x26')](_0x0d8b('0x27'),_0x4586c2,_0x0d8b('0x25'),JSON[_0x0d8b('0x28')](_0x27512e));if(_0x27512e['error']){if(_0x27512e['error'][_0x0d8b('0x29')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x4586c2,_0x27512e['error'][_0x0d8b('0x2a')]);return _0x18dd2d(_0x27512e[_0x0d8b('0x2b')][_0x0d8b('0x2a')]);}logger[_0x0d8b('0x2b')](_0x0d8b('0x24'),_0x4586c2,_0x27512e[_0x0d8b('0x2b')][_0x0d8b('0x2a')]);return _0x333674(_0x27512e[_0x0d8b('0x2b')][_0x0d8b('0x2a')]);}else{logger['info'](_0x0d8b('0x24'),_0x4586c2,_0x0d8b('0x25'));_0x333674(_0x27512e['result'][_0x0d8b('0x2a')]);}})['catch'](function(_0x3dd149){logger[_0x0d8b('0x2b')](_0x0d8b('0x24'),_0x4586c2,_0x3dd149);_0x18dd2d(_0x3dd149);});});}function respondWithStatusCode(_0x4fe6f9,_0x59a905){_0x59a905=_0x59a905||0xcc;return function(_0x28f639){if(_0x28f639){return _0x4fe6f9[_0x0d8b('0x2c')](_0x59a905);}return _0x4fe6f9['status'](_0x59a905)[_0x0d8b('0x2d')]();};}function respondWithResult(_0x59aa83,_0x1b2b59){_0x1b2b59=_0x1b2b59||0xc8;return function(_0x4b59e5){if(_0x4b59e5){return _0x59aa83[_0x0d8b('0x2e')](_0x1b2b59)['json'](_0x4b59e5);}};}function respondWithFilteredResult(_0x2ab00d,_0x546bf6){return function(_0x3829c6){if(_0x3829c6){var _0x544735=_0x3829c6['count'],_0x3c8887=_0x546bf6['offset'],_0x106e4c=_0x546bf6['offset']+_0x546bf6[_0x0d8b('0x2f')],_0x2c058d;if(_0x106e4c>=_0x544735){_0x106e4c=_0x544735;_0x2c058d=0xc8;}else{_0x2c058d=0xce;}_0x2ab00d['status'](_0x2c058d);return _0x2ab00d[_0x0d8b('0x30')]('Content-Range',_0x3c8887+'-'+_0x106e4c+'/'+_0x544735)['json'](_0x3829c6);}return null;};}function patchUpdates(_0x36017a){return function(_0x1b6920){try{jsonpatch[_0x0d8b('0x31')](_0x1b6920,_0x36017a,!![]);}catch(_0xdeee5d){return BPromise[_0x0d8b('0x32')](_0xdeee5d);}return _0x1b6920[_0x0d8b('0x33')]();};}function saveUpdates(_0x4a99d3,_0x6f93c7){return function(_0x553e03){if(_0x553e03){return _0x553e03[_0x0d8b('0x34')](_0x4a99d3)[_0x0d8b('0x35')](function(_0x4b3ea0){return _0x4b3ea0;});}return null;};}function removeEntity(_0xb18586,_0x23f7f6){return function(_0x18a905){if(_0x18a905){return _0x18a905['destroy']()[_0x0d8b('0x35')](function(){var _0x2c507e=_0x18a905[_0x0d8b('0x36')]({'plain':!![]});var _0x31ceba=_0x0d8b('0x37');return db['UserProfileResource'][_0x0d8b('0x38')]({'where':{'type':_0x31ceba,'resourceId':_0x2c507e['id']}})[_0x0d8b('0x35')](function(){return _0x18a905;});})['then'](function(){_0xb18586[_0x0d8b('0x2e')](0xcc)[_0x0d8b('0x2d')]();});}};}function handleEntityNotFound(_0x188af2,_0x974b9b){return function(_0x373544){if(!_0x373544){_0x188af2['sendStatus'](0x194);}return _0x373544;};}function handleError(_0x497a71,_0x41b4f9){_0x41b4f9=_0x41b4f9||0x1f4;return function(_0x5c2c04){logger['error'](_0x5c2c04[_0x0d8b('0x39')]);if(_0x5c2c04[_0x0d8b('0x3a')]){delete _0x5c2c04[_0x0d8b('0x3a')];}_0x497a71[_0x0d8b('0x2e')](_0x41b4f9)[_0x0d8b('0x3b')](_0x5c2c04);};}exports[_0x0d8b('0x3c')]=function(_0x579324,_0x6e5bab){var _0x6a02ad={'include':[{'model':db[_0x0d8b('0x3d')],'as':_0x0d8b('0x3e')}]},_0x28fd82={},_0xe8fad={'count':0x0,'rows':[]};var _0xf1680e=_['map'](db[_0x0d8b('0x3f')][_0x0d8b('0x40')],function(_0x3fa955){return{'name':_0x3fa955[_0x0d8b('0x41')],'type':_0x3fa955['type'][_0x0d8b('0x42')]};});_0x28fd82['model']=_[_0x0d8b('0x43')](_0xf1680e,_0x0d8b('0x3a'));_0x28fd82[_0x0d8b('0x44')]=_[_0x0d8b('0x45')](_0x579324[_0x0d8b('0x44')]);_0x28fd82[_0x0d8b('0x46')]=_[_0x0d8b('0x47')](_0x28fd82[_0x0d8b('0x48')],_0x28fd82[_0x0d8b('0x44')]);_0x6a02ad[_0x0d8b('0x49')]=_['intersection'](_0x28fd82['model'],qs['fields'](_0x579324['query']['fields']));_0x6a02ad[_0x0d8b('0x49')]=_0x6a02ad[_0x0d8b('0x49')][_0x0d8b('0x4a')]?_0x6a02ad['attributes']:_0x28fd82['model'];if(!_0x579324[_0x0d8b('0x44')][_0x0d8b('0x4b')](_0x0d8b('0x4c'))){_0x6a02ad['limit']=qs[_0x0d8b('0x2f')](_0x579324[_0x0d8b('0x44')]['limit']);_0x6a02ad['offset']=qs[_0x0d8b('0x4d')](_0x579324['query'][_0x0d8b('0x4d')]);}_0x6a02ad['order']=qs['sort'](_0x579324[_0x0d8b('0x44')][_0x0d8b('0x4e')]);_0x6a02ad['where']=qs['filters'](_['pick'](_0x579324['query'],_0x28fd82[_0x0d8b('0x46')]),_0xf1680e);if(_0x579324[_0x0d8b('0x44')][_0x0d8b('0x4f')]){_0x6a02ad['where']=_[_0x0d8b('0x50')](_0x6a02ad[_0x0d8b('0x51')],{'$or':_[_0x0d8b('0x43')](_0xf1680e,function(_0x98a67a){if(_0x98a67a[_0x0d8b('0x52')]!==_0x0d8b('0x53')){var _0x11d22b={};_0x11d22b[_0x98a67a[_0x0d8b('0x3a')]]={'$like':'%'+_0x579324[_0x0d8b('0x44')][_0x0d8b('0x4f')]+'%'};return _0x11d22b;}})});}_0x6a02ad=_[_0x0d8b('0x50')]({},_0x6a02ad,_0x579324[_0x0d8b('0x54')]);var _0x84ef1c={'where':_0x6a02ad[_0x0d8b('0x51')]};return db[_0x0d8b('0x3f')][_0x0d8b('0x55')](_0x84ef1c)[_0x0d8b('0x35')](function(_0x1e162c){_0xe8fad[_0x0d8b('0x55')]=_0x1e162c;if(_0x579324['query'][_0x0d8b('0x56')]){_0x6a02ad['include']=[{'all':!![]}];}return db['WhatsappAccount'][_0x0d8b('0x57')](_0x6a02ad);})[_0x0d8b('0x35')](function(_0x3f943a){_0xe8fad[_0x0d8b('0x58')]=_0x3f943a;return _0xe8fad;})['then'](respondWithFilteredResult(_0x6e5bab,_0x6a02ad))[_0x0d8b('0x59')](handleError(_0x6e5bab,null));};exports[_0x0d8b('0x5a')]=function(_0x386074,_0x241587){var _0x45cd22={'raw':![],'where':{'id':_0x386074['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4cd85a={};_0x4cd85a[_0x0d8b('0x48')]=_[_0x0d8b('0x45')](db['WhatsappAccount']['rawAttributes']);_0x4cd85a[_0x0d8b('0x44')]=_[_0x0d8b('0x45')](_0x386074['query']);_0x4cd85a['filters']=_[_0x0d8b('0x47')](_0x4cd85a[_0x0d8b('0x48')],_0x4cd85a[_0x0d8b('0x44')]);_0x45cd22[_0x0d8b('0x49')]=_[_0x0d8b('0x47')](_0x4cd85a['model'],qs[_0x0d8b('0x5b')](_0x386074[_0x0d8b('0x44')]['fields']));_0x45cd22['attributes']=_0x45cd22[_0x0d8b('0x49')][_0x0d8b('0x4a')]?_0x45cd22['attributes']:_0x4cd85a['model'];if(_0x386074[_0x0d8b('0x44')][_0x0d8b('0x56')]){_0x45cd22[_0x0d8b('0x5c')]=[{'all':!![]}];}_0x45cd22=_[_0x0d8b('0x50')]({},_0x45cd22,_0x386074['options']);return db[_0x0d8b('0x3f')]['find'](_0x45cd22)['then'](handleEntityNotFound(_0x241587,null))[_0x0d8b('0x35')](respondWithResult(_0x241587,null))[_0x0d8b('0x59')](handleError(_0x241587,null));};exports['create']=function(_0x4a8f33,_0x44ed23){return db[_0x0d8b('0x3f')][_0x0d8b('0x5d')](_0x4a8f33[_0x0d8b('0x5e')],{})[_0x0d8b('0x35')](function(_0xb66e76){var _0x3978e5=_0x4a8f33[_0x0d8b('0x5f')]['get']({'plain':!![]});if(!_0x3978e5)throw new Error(_0x0d8b('0x60'));if(_0x3978e5[_0x0d8b('0x61')]===_0x0d8b('0x5f')){var _0x3c7efb=_0xb66e76[_0x0d8b('0x36')]({'plain':!![]});var _0x47104e=_0x0d8b('0x37');return db[_0x0d8b('0x62')][_0x0d8b('0x63')]({'where':{'name':_0x47104e,'userProfileId':_0x3978e5['userProfileId']},'raw':!![]})[_0x0d8b('0x35')](function(_0x451940){if(_0x451940&&_0x451940[_0x0d8b('0x64')]===0x0){return db[_0x0d8b('0x65')][_0x0d8b('0x5d')]({'name':_0x3c7efb['name'],'resourceId':_0x3c7efb['id'],'type':_0x451940[_0x0d8b('0x3a')],'sectionId':_0x451940['id']},{})[_0x0d8b('0x35')](function(){return _0xb66e76;});}else{return _0xb66e76;}})[_0x0d8b('0x59')](function(_0x17a87f){logger[_0x0d8b('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17a87f);throw _0x17a87f;});}return _0xb66e76;})['then'](respondWithResult(_0x44ed23,0xc9))[_0x0d8b('0x59')](handleError(_0x44ed23,null));};exports[_0x0d8b('0x34')]=function(_0x3e4a41,_0xbbb520){if(_0x3e4a41['body']['id']){delete _0x3e4a41[_0x0d8b('0x5e')]['id'];}return db[_0x0d8b('0x3f')][_0x0d8b('0x63')]({'where':{'id':_0x3e4a41['params']['id']},'include':[{'model':db[_0x0d8b('0x3d')],'as':'mandatoryDispositionPause'}]})[_0x0d8b('0x35')](handleEntityNotFound(_0xbbb520,null))[_0x0d8b('0x35')](saveUpdates(_0x3e4a41[_0x0d8b('0x5e')],null))[_0x0d8b('0x35')](respondWithResult(_0xbbb520,null))[_0x0d8b('0x59')](handleError(_0xbbb520,null));};exports[_0x0d8b('0x38')]=function(_0x5b5fdb,_0x382d2e){return db['WhatsappAccount'][_0x0d8b('0x63')]({'where':{'id':_0x5b5fdb[_0x0d8b('0x66')]['id']}})[_0x0d8b('0x35')](handleEntityNotFound(_0x382d2e,null))[_0x0d8b('0x35')](removeEntity(_0x382d2e,null))['catch'](handleError(_0x382d2e,null));};exports[_0x0d8b('0x67')]=function(_0x34d01f,_0x1a1ba7){return db[_0x0d8b('0x3f')][_0x0d8b('0x67')]()[_0x0d8b('0x35')](respondWithResult(_0x1a1ba7,null))[_0x0d8b('0x59')](handleError(_0x1a1ba7,null));};exports[_0x0d8b('0x68')]=function(_0x2ce282,_0x34affb,_0x57e39a){if(_0x2ce282['body']['id']){delete _0x2ce282[_0x0d8b('0x5e')]['id'];}return db[_0x0d8b('0x3f')]['find']({'where':{'id':_0x2ce282[_0x0d8b('0x66')]['id']}})['then'](handleEntityNotFound(_0x34affb,null))['then'](function(_0x22ee20){if(_0x22ee20){_0x2ce282[_0x0d8b('0x5e')]['WhatsappAccountId']=_0x22ee20['id'];return db['Disposition'][_0x0d8b('0x5d')](_0x2ce282[_0x0d8b('0x5e')]);}})[_0x0d8b('0x35')](respondWithResult(_0x34affb,null))[_0x0d8b('0x59')](handleError(_0x34affb,null));};exports[_0x0d8b('0x69')]=function(_0x156859,_0x40d265,_0x5b4402){var _0x1ca60c={'raw':![],'where':{}};var _0x5878c2={};var _0x1a203e={'count':0x0,'rows':[]};return db[_0x0d8b('0x3f')][_0x0d8b('0x6a')]({'where':{'id':_0x156859[_0x0d8b('0x66')]['id']}})['then'](handleEntityNotFound(_0x40d265,null))[_0x0d8b('0x35')](function(_0x4a1c4a){if(_0x4a1c4a){_0x5878c2[_0x0d8b('0x48')]=_[_0x0d8b('0x45')](db[_0x0d8b('0x6b')][_0x0d8b('0x40')]);_0x5878c2[_0x0d8b('0x44')]=_[_0x0d8b('0x45')](_0x156859[_0x0d8b('0x44')]);_0x5878c2[_0x0d8b('0x46')]=_[_0x0d8b('0x47')](_0x5878c2[_0x0d8b('0x48')],_0x5878c2['query']);_0x1ca60c[_0x0d8b('0x49')]=_['intersection'](_0x5878c2[_0x0d8b('0x48')],qs[_0x0d8b('0x5b')](_0x156859['query'][_0x0d8b('0x5b')]));_0x1ca60c['attributes']=_0x1ca60c[_0x0d8b('0x49')][_0x0d8b('0x4a')]?_0x1ca60c[_0x0d8b('0x49')]:_0x5878c2[_0x0d8b('0x48')];if(!_0x156859[_0x0d8b('0x44')][_0x0d8b('0x4b')](_0x0d8b('0x4c'))){_0x1ca60c[_0x0d8b('0x2f')]=qs['limit'](_0x156859[_0x0d8b('0x44')][_0x0d8b('0x2f')]);_0x1ca60c['offset']=qs[_0x0d8b('0x4d')](_0x156859[_0x0d8b('0x44')][_0x0d8b('0x4d')]);}_0x1ca60c[_0x0d8b('0x6c')]=qs[_0x0d8b('0x4e')](_0x156859[_0x0d8b('0x44')][_0x0d8b('0x4e')]);_0x1ca60c[_0x0d8b('0x51')]=qs[_0x0d8b('0x46')](_[_0x0d8b('0x6d')](_0x156859[_0x0d8b('0x44')],_0x5878c2[_0x0d8b('0x46')]));_0x1ca60c['where'][_0x0d8b('0x6e')]=_0x4a1c4a['id'];if(_0x156859[_0x0d8b('0x44')][_0x0d8b('0x4f')]){_0x1ca60c['where']=_['merge'](_0x1ca60c[_0x0d8b('0x51')],{'$or':_[_0x0d8b('0x43')](_0x1ca60c[_0x0d8b('0x49')],function(_0x5b76af){var _0x5bd5c8={};_0x5bd5c8[_0x5b76af]={'$like':'%'+_0x156859[_0x0d8b('0x44')][_0x0d8b('0x4f')]+'%'};return _0x5bd5c8;})});}_0x1ca60c=_[_0x0d8b('0x50')]({},_0x1ca60c,_0x156859[_0x0d8b('0x54')]);return db[_0x0d8b('0x6b')][_0x0d8b('0x55')]({'where':_0x1ca60c[_0x0d8b('0x51')]})[_0x0d8b('0x35')](function(_0x20a3dd){_0x1a203e[_0x0d8b('0x55')]=_0x20a3dd;if(_0x156859[_0x0d8b('0x44')][_0x0d8b('0x56')]){_0x1ca60c[_0x0d8b('0x5c')]=[{'all':!![]}];}return db['Disposition'][_0x0d8b('0x57')](_0x1ca60c);})[_0x0d8b('0x35')](function(_0x48c965){_0x1a203e['rows']=_0x48c965;return _0x1a203e;});}})[_0x0d8b('0x35')](respondWithFilteredResult(_0x40d265,_0x1ca60c))[_0x0d8b('0x59')](handleError(_0x40d265,null));};exports[_0x0d8b('0x6f')]=function(_0x14b1b8,_0x23e2e0,_0x354208){return db['WhatsappAccount']['find']({'where':{'id':_0x14b1b8['params']['id']}})[_0x0d8b('0x35')](handleEntityNotFound(_0x23e2e0,null))[_0x0d8b('0x35')](function(_0x466442){if(_0x466442){return _0x466442[_0x0d8b('0x6f')](_0x14b1b8[_0x0d8b('0x44')][_0x0d8b('0x70')]);}})['then'](respondWithStatusCode(_0x23e2e0,null))[_0x0d8b('0x59')](handleError(_0x23e2e0,null));};exports[_0x0d8b('0x71')]=function(_0x4b3363,_0x30a69d,_0x57e3c2){if(_0x4b3363[_0x0d8b('0x5e')]['id']){delete _0x4b3363[_0x0d8b('0x5e')]['id'];}return db[_0x0d8b('0x3f')][_0x0d8b('0x63')]({'where':{'id':_0x4b3363[_0x0d8b('0x66')]['id']}})[_0x0d8b('0x35')](handleEntityNotFound(_0x30a69d,null))[_0x0d8b('0x35')](function(_0xb73e32){if(_0xb73e32){_0x4b3363[_0x0d8b('0x5e')][_0x0d8b('0x6e')]=_0xb73e32['id'];return db[_0x0d8b('0x72')][_0x0d8b('0x5d')](_0x4b3363['body']);}})['then'](respondWithResult(_0x30a69d,null))[_0x0d8b('0x59')](handleError(_0x30a69d,null));};exports[_0x0d8b('0x73')]=function(_0xb4cb89,_0x165ca6,_0xf91ecd){var _0x3c659e={'raw':![],'where':{}};var _0xeadc0c={};var _0x54674f={'count':0x0,'rows':[]};return db[_0x0d8b('0x3f')]['findOne']({'where':{'id':_0xb4cb89[_0x0d8b('0x66')]['id']}})['then'](handleEntityNotFound(_0x165ca6,null))['then'](function(_0x21a914){if(_0x21a914){_0xeadc0c[_0x0d8b('0x48')]=_[_0x0d8b('0x45')](db[_0x0d8b('0x72')][_0x0d8b('0x40')]);_0xeadc0c[_0x0d8b('0x44')]=_[_0x0d8b('0x45')](_0xb4cb89[_0x0d8b('0x44')]);_0xeadc0c[_0x0d8b('0x46')]=_[_0x0d8b('0x47')](_0xeadc0c[_0x0d8b('0x48')],_0xeadc0c[_0x0d8b('0x44')]);_0x3c659e['attributes']=_[_0x0d8b('0x47')](_0xeadc0c[_0x0d8b('0x48')],qs[_0x0d8b('0x5b')](_0xb4cb89['query']['fields']));_0x3c659e[_0x0d8b('0x49')]=_0x3c659e[_0x0d8b('0x49')][_0x0d8b('0x4a')]?_0x3c659e[_0x0d8b('0x49')]:_0xeadc0c[_0x0d8b('0x48')];if(!_0xb4cb89[_0x0d8b('0x44')]['hasOwnProperty'](_0x0d8b('0x4c'))){_0x3c659e[_0x0d8b('0x2f')]=qs[_0x0d8b('0x2f')](_0xb4cb89[_0x0d8b('0x44')][_0x0d8b('0x2f')]);_0x3c659e['offset']=qs['offset'](_0xb4cb89[_0x0d8b('0x44')][_0x0d8b('0x4d')]);}_0x3c659e[_0x0d8b('0x6c')]=qs['sort'](_0xb4cb89[_0x0d8b('0x44')][_0x0d8b('0x4e')]);_0x3c659e[_0x0d8b('0x51')]=qs['filters'](_[_0x0d8b('0x6d')](_0xb4cb89[_0x0d8b('0x44')],_0xeadc0c[_0x0d8b('0x46')]));_0x3c659e[_0x0d8b('0x51')][_0x0d8b('0x6e')]=_0x21a914['id'];if(_0xb4cb89[_0x0d8b('0x44')][_0x0d8b('0x4f')]){_0x3c659e[_0x0d8b('0x51')]=_[_0x0d8b('0x50')](_0x3c659e['where'],{'$or':_[_0x0d8b('0x43')](_0x3c659e[_0x0d8b('0x49')],function(_0x499e9f){var _0x455a08={};_0x455a08[_0x499e9f]={'$like':'%'+_0xb4cb89[_0x0d8b('0x44')][_0x0d8b('0x4f')]+'%'};return _0x455a08;})});}_0x3c659e=_[_0x0d8b('0x50')]({},_0x3c659e,_0xb4cb89[_0x0d8b('0x54')]);return db[_0x0d8b('0x72')]['count']({'where':_0x3c659e['where']})[_0x0d8b('0x35')](function(_0x3c6ae1){_0x54674f[_0x0d8b('0x55')]=_0x3c6ae1;if(_0xb4cb89[_0x0d8b('0x44')]['includeAll']){_0x3c659e[_0x0d8b('0x5c')]=[{'all':!![]}];}return db[_0x0d8b('0x72')]['findAll'](_0x3c659e);})[_0x0d8b('0x35')](function(_0x4e1b5b){_0x54674f[_0x0d8b('0x58')]=_0x4e1b5b;return _0x54674f;});}})[_0x0d8b('0x35')](respondWithFilteredResult(_0x165ca6,_0x3c659e))[_0x0d8b('0x59')](handleError(_0x165ca6,null));};exports[_0x0d8b('0x74')]=function(_0x36a82f,_0x12c39a,_0x242e6c){return db[_0x0d8b('0x3f')]['find']({'where':{'id':_0x36a82f[_0x0d8b('0x66')]['id']}})['then'](handleEntityNotFound(_0x12c39a,null))['then'](function(_0x35bd36){if(_0x35bd36){return _0x35bd36['removeAnswers'](_0x36a82f[_0x0d8b('0x44')][_0x0d8b('0x70')]);}})['then'](respondWithStatusCode(_0x12c39a,null))[_0x0d8b('0x59')](handleError(_0x12c39a,null));};exports['addAgents']=function(_0x5f3f6f,_0x456642,_0x52c895){return db[_0x0d8b('0x3f')][_0x0d8b('0x63')]({'where':{'id':_0x5f3f6f[_0x0d8b('0x66')]['id']}})['then'](handleEntityNotFound(_0x456642,null))['then'](function(_0x32a60d){if(_0x32a60d){return _0x32a60d[_0x0d8b('0x75')](_0x5f3f6f[_0x0d8b('0x5e')][_0x0d8b('0x70')],_[_0x0d8b('0x76')](_0x5f3f6f[_0x0d8b('0x5e')],[_0x0d8b('0x70'),'id'])||{})[_0x0d8b('0x77')](function(_0x4e3dd1){for(var _0x5ab046=0x0;_0x5ab046<_0x5f3f6f[_0x0d8b('0x5e')][_0x0d8b('0x70')]['length'];_0x5ab046+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':_0x5f3f6f[_0x0d8b('0x5e')][_0x0d8b('0x70')][_0x5ab046],'WhatsappAccountId':_0x5f3f6f[_0x0d8b('0x66')]['id']});}return _0x4e3dd1;});}})['then'](respondWithResult(_0x456642,null))[_0x0d8b('0x59')](handleError(_0x456642,null));};exports[_0x0d8b('0x78')]=function(_0x16afb8,_0x4e428d,_0x3c7f16){return db['WhatsappAccount'][_0x0d8b('0x63')]({'where':{'id':_0x16afb8['params']['id']}})[_0x0d8b('0x35')](handleEntityNotFound(_0x4e428d,null))[_0x0d8b('0x35')](function(_0x43be3c){if(_0x43be3c){return _0x43be3c[_0x0d8b('0x78')](_0x16afb8[_0x0d8b('0x44')]['ids'])[_0x0d8b('0x35')](function(){if(_['isArray'](_0x16afb8[_0x0d8b('0x44')]['ids'])){for(var _0x165baa=0x0;_0x165baa<_0x16afb8['query']['ids'][_0x0d8b('0x4a')];_0x165baa+=0x1){socket[_0x0d8b('0x79')]('userWhatsappAccount:remove',{'UserId':Number(_0x16afb8[_0x0d8b('0x44')][_0x0d8b('0x70')][_0x165baa]),'WhatsappAccountId':Number(_0x16afb8[_0x0d8b('0x66')]['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x16afb8['query'][_0x0d8b('0x70')]),'WhatsappAccountId':Number(_0x16afb8[_0x0d8b('0x66')]['id'])});}});}})[_0x0d8b('0x35')](respondWithStatusCode(_0x4e428d,null))[_0x0d8b('0x59')](handleError(_0x4e428d,null));};exports[_0x0d8b('0x7a')]=function(_0x2a8e14,_0x1d3817,_0x123b77){var _0xa17410={};var _0xba602f={};var _0x4dc5bd;var _0x2e7343;return db[_0x0d8b('0x3f')][_0x0d8b('0x6a')]({'where':{'id':_0x2a8e14['params']['id']}})[_0x0d8b('0x35')](handleEntityNotFound(_0x1d3817,null))[_0x0d8b('0x35')](function(_0x13bce2){if(_0x13bce2){_0x4dc5bd=_0x13bce2;_0xba602f[_0x0d8b('0x48')]=_[_0x0d8b('0x45')](db[_0x0d8b('0x7b')][_0x0d8b('0x40')]);_0xba602f[_0x0d8b('0x44')]=_[_0x0d8b('0x45')](_0x2a8e14[_0x0d8b('0x44')]);_0xba602f[_0x0d8b('0x46')]=_[_0x0d8b('0x47')](_0xba602f['model'],_0xba602f[_0x0d8b('0x44')]);_0xa17410[_0x0d8b('0x49')]=_[_0x0d8b('0x47')](_0xba602f[_0x0d8b('0x48')],qs['fields'](_0x2a8e14['query'][_0x0d8b('0x5b')]));_0xa17410[_0x0d8b('0x49')]=_0xa17410[_0x0d8b('0x49')]['length']?_0xa17410['attributes']:_0xba602f['model'];_0xa17410[_0x0d8b('0x6c')]=qs['sort'](_0x2a8e14[_0x0d8b('0x44')][_0x0d8b('0x4e')]);_0xa17410[_0x0d8b('0x51')]=qs[_0x0d8b('0x46')](_[_0x0d8b('0x6d')](_0x2a8e14[_0x0d8b('0x44')],_0xba602f[_0x0d8b('0x46')]));if(_0x2a8e14[_0x0d8b('0x44')]['filter']){_0xa17410[_0x0d8b('0x51')]=_[_0x0d8b('0x50')](_0xa17410[_0x0d8b('0x51')],{'$or':_[_0x0d8b('0x43')](_0xa17410['attributes'],function(_0x3b4a92){var _0x62fedf={};_0x62fedf[_0x3b4a92]={'$like':'%'+_0x2a8e14[_0x0d8b('0x44')][_0x0d8b('0x4f')]+'%'};return _0x62fedf;})});}_0xa17410=_['merge']({},_0xa17410,_0x2a8e14[_0x0d8b('0x54')]);return _0x4dc5bd[_0x0d8b('0x7a')](_0xa17410);}})[_0x0d8b('0x35')](function(_0x127d6b){if(_0x127d6b){_0x2e7343=_0x127d6b['length'];if(!_0x2a8e14[_0x0d8b('0x44')]['hasOwnProperty'](_0x0d8b('0x4c'))){_0xa17410['limit']=qs[_0x0d8b('0x2f')](_0x2a8e14['query'][_0x0d8b('0x2f')]);_0xa17410['offset']=qs[_0x0d8b('0x4d')](_0x2a8e14['query'][_0x0d8b('0x4d')]);}return _0x4dc5bd['getAgents'](_0xa17410);}})[_0x0d8b('0x35')](function(_0x5ebfe0){if(_0x5ebfe0){return _0x5ebfe0?{'count':_0x2e7343,'rows':_0x5ebfe0}:null;}})[_0x0d8b('0x35')](respondWithResult(_0x1d3817,null))[_0x0d8b('0x59')](handleError(_0x1d3817,null));};exports['addApplications']=function(_0x4ea6fb,_0x4cff45,_0x42b956){return db['WhatsappAccount'][_0x0d8b('0x6a')]({'where':{'id':_0x4ea6fb['params']['id']}})[_0x0d8b('0x35')](handleEntityNotFound(_0x4cff45,null))[_0x0d8b('0x35')](function(_0x120350){if(_0x120350){return db[_0x0d8b('0x7c')][_0x0d8b('0x7d')](function(_0x3d5e21){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0x4ea6fb[_0x0d8b('0x66')]['id']},'transaction':_0x3d5e21})['then'](function(_0xf3c16a){var _0x28393f=_[_0x0d8b('0x43')](_0x4ea6fb['body'],function(_0x47251c){_0x47251c['WhatsappAccountId']=_0x4ea6fb[_0x0d8b('0x66')]['id'];return _0x47251c;});return db[_0x0d8b('0x7e')][_0x0d8b('0x7f')](_0x28393f,{'transaction':_0x3d5e21});});})[_0x0d8b('0x35')](function(){return db['WhatsappApplication'][_0x0d8b('0x80')]({'where':{'WhatsappAccountId':_0x4ea6fb[_0x0d8b('0x66')]['id']},'order':_0x0d8b('0x81')});});}})['then'](respondWithResult(_0x4cff45,null))[_0x0d8b('0x59')](handleError(_0x4cff45,null));};exports['getApplications']=function(_0x3a2d0e,_0x28868a,_0x2c00b6){var _0xfc414a={};var _0x19f64c={};var _0x2f4cfd;var _0x278b23;return db[_0x0d8b('0x3f')][_0x0d8b('0x6a')]({'where':{'id':_0x3a2d0e[_0x0d8b('0x66')]['id']}})[_0x0d8b('0x35')](handleEntityNotFound(_0x28868a,null))[_0x0d8b('0x35')](function(_0x50b987){if(_0x50b987){_0x2f4cfd=_0x50b987;_0x19f64c[_0x0d8b('0x48')]=_[_0x0d8b('0x45')](db['WhatsappApplication'][_0x0d8b('0x40')]);_0x19f64c['query']=_[_0x0d8b('0x45')](_0x3a2d0e['query']);_0x19f64c[_0x0d8b('0x46')]=_['intersection'](_0x19f64c['model'],_0x19f64c[_0x0d8b('0x44')]);_0xfc414a[_0x0d8b('0x49')]=_['intersection'](_0x19f64c['model'],qs['fields'](_0x3a2d0e['query'][_0x0d8b('0x5b')]));_0xfc414a[_0x0d8b('0x49')]=_0xfc414a[_0x0d8b('0x49')][_0x0d8b('0x4a')]?_0xfc414a[_0x0d8b('0x49')]:_0x19f64c[_0x0d8b('0x48')];_0xfc414a[_0x0d8b('0x6c')]=qs[_0x0d8b('0x4e')](_0x3a2d0e['query'][_0x0d8b('0x4e')]);_0xfc414a['where']=qs[_0x0d8b('0x46')](_['pick'](_0x3a2d0e[_0x0d8b('0x44')],_0x19f64c[_0x0d8b('0x46')]));if(_0x3a2d0e[_0x0d8b('0x44')][_0x0d8b('0x4f')]){_0xfc414a[_0x0d8b('0x51')]=_[_0x0d8b('0x50')](_0xfc414a[_0x0d8b('0x51')],{'$or':_[_0x0d8b('0x43')](_0xfc414a[_0x0d8b('0x49')],function(_0x2f63fe){var _0x44dac0={};_0x44dac0[_0x2f63fe]={'$like':'%'+_0x3a2d0e[_0x0d8b('0x44')][_0x0d8b('0x4f')]+'%'};return _0x44dac0;})});}_0xfc414a=_['merge']({},_0xfc414a,_0x3a2d0e[_0x0d8b('0x54')]);return _0x2f4cfd['getApplications'](_0xfc414a);}})[_0x0d8b('0x35')](function(_0xd682dc){if(_0xd682dc){_0x278b23=_0xd682dc['length'];if(!_0x3a2d0e[_0x0d8b('0x44')]['hasOwnProperty'](_0x0d8b('0x4c'))){_0xfc414a['limit']=qs[_0x0d8b('0x2f')](_0x3a2d0e[_0x0d8b('0x44')][_0x0d8b('0x2f')]);_0xfc414a[_0x0d8b('0x4d')]=qs[_0x0d8b('0x4d')](_0x3a2d0e[_0x0d8b('0x44')]['offset']);}return _0x2f4cfd[_0x0d8b('0x82')](_0xfc414a);}})['then'](function(_0x4402a0){if(_0x4402a0){return _0x4402a0?{'count':_0x278b23,'rows':_0x4402a0}:null;}})[_0x0d8b('0x35')](respondWithResult(_0x28868a,null))[_0x0d8b('0x59')](handleError(_0x28868a,null));};exports[_0x0d8b('0x83')]=function(_0x831064,_0x5cfca3,_0x15e78b){var _0x22ca75={'channel':'whatsapp'};var _0x1f6044=[];var _0x2edc22=[];var _0x29f6c0={};return db[_0x0d8b('0x3f')]['find']({'where':{'id':_0x831064[_0x0d8b('0x66')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x0d8b('0x84')}]})['then'](handleEntityNotFound(_0x5cfca3,null))[_0x0d8b('0x35')](function(_0x34f234){_0x22ca75['account']=_0x34f234;_0x22ca75[_0x0d8b('0x85')]=_[_0x0d8b('0x86')](_0x34f234[_0x0d8b('0x84')],[_0x0d8b('0x81')],['asc']);if(_0x22ca75[_0x0d8b('0x87')]['Applications']){delete _0x22ca75[_0x0d8b('0x87')][_0x0d8b('0x84')];}return db['CmContact'][_0x0d8b('0x67')]();})[_0x0d8b('0x35')](function(_0x3e8e3c){if(!_0x3e8e3c){throw new db[(_0x0d8b('0x20'))][(_0x0d8b('0x21'))](_0x0d8b('0x88'));}_0x1f6044=_[_0x0d8b('0x89')](_[_0x0d8b('0x45')](_0x3e8e3c),['createdAt',_0x0d8b('0x8a')]);_0x2edc22=_['difference'](_[_0x0d8b('0x45')](_0x3e8e3c),[_0x0d8b('0x8b'),_0x0d8b('0x8a'),_0x0d8b('0x8c'),_0x0d8b('0x8d')]);_0x22ca75[_0x0d8b('0x5e')]={'mapKey':_0x0d8b('0x8e')};if(_0x22ca75[_0x0d8b('0x87')][_0x0d8b('0x52')]&&_0x22ca75['account'][_0x0d8b('0x52')]===_0x0d8b('0x8f')){_0x22ca75['body'][_0x0d8b('0x90')]=_0x831064[_0x0d8b('0x5e')]['From'][_0x0d8b('0x91')](_0x0d8b('0x92'),'');_0x22ca75[_0x0d8b('0x5e')][_0x0d8b('0x5e')]=_0x831064[_0x0d8b('0x5e')][_0x0d8b('0x93')];_0x22ca75[_0x0d8b('0x5e')][_0x0d8b('0x94')]=_0x831064['body'][_0x0d8b('0x95')];}if(_0x22ca75[_0x0d8b('0x5e')]['id']){delete _0x22ca75[_0x0d8b('0x5e')]['id'];}if(_[_0x0d8b('0x96')](_0x22ca75[_0x0d8b('0x5e')][_0x0d8b('0x90')])){throw new db[(_0x0d8b('0x20'))][(_0x0d8b('0x21'))](_0x0d8b('0x97'));}if(_[_0x0d8b('0x96')](_0x22ca75[_0x0d8b('0x5e')]['body'])||_0x22ca75['body']['body']===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0d8b('0x96')](_0x22ca75['body'][_0x0d8b('0x98')])){throw new db[(_0x0d8b('0x20'))][(_0x0d8b('0x21'))](_0x0d8b('0x99')+_0x2edc22);}if(!_[_0x0d8b('0x9a')](_0x2edc22,_0x22ca75[_0x0d8b('0x5e')][_0x0d8b('0x98')])){throw new db[(_0x0d8b('0x20'))][(_0x0d8b('0x21'))](_0x0d8b('0x9b')+_0x2edc22);}_0x29f6c0[_0x22ca75[_0x0d8b('0x5e')][_0x0d8b('0x98')]]=_0x22ca75['body'][_0x0d8b('0x90')];return db['CmList'][_0x0d8b('0x63')]({'where':{'id':_0x22ca75['account'][_0x0d8b('0x8d')]},'include':[{'model':db[_0x0d8b('0x9c')],'as':_0x0d8b('0x9d'),'where':_0x29f6c0,'limit':0x1,'order':[[_0x0d8b('0x8a'),_0x0d8b('0x9e')]]}]});})['then'](handleEntityNotFound(_0x5cfca3,null))[_0x0d8b('0x35')](function(_0x363518){if(_0x363518){_0x22ca75['list']=_[_0x0d8b('0x76')](_0x363518,['Contacts']);if(_0x363518['Contacts'][_0x0d8b('0x4a')]){return _0x363518[_0x0d8b('0x9d')][0x0];}var _0x427369=_[_0x0d8b('0x17')](_0x22ca75[_0x0d8b('0x5e')],{'firstName':_0x22ca75['body']['from'],'ListId':_0x363518['id']});_0x427369[_0x22ca75['body'][_0x0d8b('0x98')]]=_0x22ca75[_0x0d8b('0x5e')][_0x0d8b('0x90')];return db[_0x0d8b('0x9c')][_0x0d8b('0x5d')](_0x427369,{'fields':_0x1f6044,'raw':!![]});}})[_0x0d8b('0x35')](handleEntityNotFound(_0x5cfca3,null))['then'](function(_0x20becd){if(_0x20becd){_0x22ca75[_0x0d8b('0x9f')]=_0x20becd;var _0x591816={'ContactId':_0x20becd['id'],'phone':_0x22ca75[_0x0d8b('0x5e')][_0x0d8b('0x90')],'WhatsappAccountId':_0x831064[_0x0d8b('0x66')]['id']};var _0xfe53a={'ContactId':_0x20becd['id'],'WhatsappAccountId':_0x831064[_0x0d8b('0x66')]['id'],'closed':![]};return db['WhatsappInteraction']['find']({'where':_0xfe53a})[_0x0d8b('0x35')](function(_0xaf1c9c){if(_0xaf1c9c){return[_0xaf1c9c,![]];}return db['WhatsappInteraction'][_0x0d8b('0x5d')](_0x591816)[_0x0d8b('0x35')](function(_0x3a8bee){return[_0x3a8bee,!![]];});});}})['spread'](function(_0x52f5cc,_0x367c57){_0x22ca75[_0x0d8b('0xa0')]=_0x52f5cc['get']({'plain':!![]});_0x22ca75['interaction'][_0x0d8b('0xa1')]=![];if(_0x367c57){if(_0x22ca75['account'][_0x0d8b('0xa2')]){_0x22ca75['applications'][_0x0d8b('0xa3')]({'id':0x0,'priority':_0x22ca75[_0x0d8b('0x85')]['length']+0x1,'app':_0x0d8b('0xa4'),'appdata':'unmanaged','interval':_0x0d8b('0xa5')});}_0x22ca75[_0x0d8b('0xa0')][_0x0d8b('0xa1')]=!![];}return db[_0x0d8b('0xa6')][_0x0d8b('0x5d')]({'phone':_0x22ca75['body'][_0x0d8b('0x90')],'messageId':_0x22ca75[_0x0d8b('0x5e')][_0x0d8b('0x94')],'body':_0x22ca75['body'][_0x0d8b('0x5e')],'WhatsappAccountId':_0x831064['params']['id'],'WhatsappInteractionId':_0x52f5cc['id'],'direction':'in','ContactId':_0x52f5cc[_0x0d8b('0xa7')],'AttachmentId':_0x22ca75[_0x0d8b('0x5e')]['AttachmentId']});})['then'](function(_0x4b69b6){_0x22ca75[_0x0d8b('0x2a')]=_0x4b69b6;if(_0x22ca75[_0x0d8b('0xa0')]['UserId']){return db[_0x0d8b('0x7b')]['find']({'attributes':['id',_0x0d8b('0x3a')],'where':{'id':_0x22ca75[_0x0d8b('0xa0')][_0x0d8b('0xa8')]}})[_0x0d8b('0x35')](function(_0x2c6aed){if(_0x2c6aed){_0x22ca75[_0x0d8b('0x85')][_0x0d8b('0xa9')]({'id':0x0,'priority':0x0,'app':_0x0d8b('0xaa'),'appdata':_0x2c6aed['name']+','+(_0x22ca75[_0x0d8b('0x87')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x0d8b('0xab'),_0x0d8b('0xac'),_0x22ca75);});}return respondWithRpcPromise(_0x0d8b('0xab'),_0x0d8b('0xac'),_0x22ca75);})[_0x0d8b('0x35')](function(_0x25ec9d){if(_0x25ec9d){var _0x2098ed=0xc8;var _0x567b75=_0x0d8b('0xad');logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x567b75,_0x2098ed,_0x0d8b('0xae'));logger['debug'](_0x0d8b('0xaf'),_0x567b75,_0x2098ed,'entity\x20found',JSON['stringify'](_0x25ec9d));if(_0x22ca75[_0x0d8b('0x87')][_0x0d8b('0x52')]===_0x0d8b('0x8f')){return _0x5cfca3[_0x0d8b('0x2e')](_0x2098ed)[_0x0d8b('0x30')](_0x0d8b('0xb0'),'text/xml')['send'](_0x0d8b('0xb1'));}else{return _0x5cfca3[_0x0d8b('0x2e')](_0x2098ed)[_0x0d8b('0xb2')](_0x25ec9d);}}})[_0x0d8b('0x59')](handleError(_0x5cfca3,null));};exports[_0x0d8b('0x3b')]=function(_0x206dfd,_0x12816b,_0x474bca){var _0x13d965,_0x228e6c,_0x26fb03;if(_[_0x0d8b('0x96')](_0x206dfd[_0x0d8b('0x5e')]['body'])||_0x206dfd['body']['body']===''){throw new db[(_0x0d8b('0x20'))][(_0x0d8b('0x21'))](_0x0d8b('0xb3'));}if(_[_0x0d8b('0x96')](_0x206dfd[_0x0d8b('0x5e')]['to'])){throw new db[(_0x0d8b('0x20'))][(_0x0d8b('0x21'))](_0x0d8b('0xb4'));}_0x13d965=_0x206dfd[_0x0d8b('0x5e')]['to'];return db[_0x0d8b('0x3f')][_0x0d8b('0x63')]({'where':{'id':_0x206dfd[_0x0d8b('0x66')]['id']},'include':[{'model':db[_0x0d8b('0xb5')],'as':_0x0d8b('0xb6'),'include':[{'model':db[_0x0d8b('0x9c')],'as':_0x0d8b('0x9d'),'where':{'mobile':_0x13d965},'limit':0x1,'order':[[_0x0d8b('0x8a'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x12816b,null))[_0x0d8b('0x35')](function(_0x4d41ea){if(_0x4d41ea&&_0x4d41ea['List']){_0x228e6c=_0x4d41ea['get']({'plain':!![]});if(_0x228e6c[_0x0d8b('0xb6')]&&_0x228e6c[_0x0d8b('0xb6')][_0x0d8b('0x9d')][_0x0d8b('0x4a')]){return _0x228e6c[_0x0d8b('0xb6')]['Contacts'][0x0];}return db[_0x0d8b('0x9c')][_0x0d8b('0x5d')](_[_0x0d8b('0x17')](_0x206dfd[_0x0d8b('0x5e')],{'firstName':_0x13d965,'mobile':_0x13d965,'phone':_0x13d965,'ListId':_0x228e6c['ListId']}));}})['then'](handleEntityNotFound(_0x12816b,null))[_0x0d8b('0x35')](function(_0x593e46){if(_0x593e46){_0x26fb03=_0x593e46;return db[_0x0d8b('0xb7')][_0x0d8b('0x63')]({'where':{'ContactId':_0x26fb03['id'],'closed':![],'WhatsappAccountId':_0x228e6c['id']}})[_0x0d8b('0x35')](function(_0x32237b){if(_0x32237b){return[_0x32237b,![]];}return db[_0x0d8b('0xb7')][_0x0d8b('0x5d')]({'UserId':_0x206dfd['user']['id'],'ContactId':_0x26fb03['id'],'WhatsappAccountId':_0x228e6c['id'],'phone':_0x13d965,'firstMsgDirection':_0x0d8b('0xb8'),'Messages':[_['merge'](_0x206dfd[_0x0d8b('0x5e')],{'read':![],'body':_0x206dfd[_0x0d8b('0x5e')][_0x0d8b('0x5e')],'phone':_0x13d965,'WhatsappAccountId':_0x228e6c['id'],'UserId':_0x206dfd[_0x0d8b('0x5f')]['id'],'ContactId':_0x26fb03['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})['then'](function(_0x58e346){return[_0x58e346,!![]];});});}})[_0x0d8b('0x77')](function(_0x2f4067,_0x3c4315){if(_0x3c4315){return _0x2f4067;}return db[_0x0d8b('0xa6')][_0x0d8b('0x5d')](_[_0x0d8b('0x50')](_0x206dfd['body'],{'read':![],'body':_0x206dfd['body']['body'],'phone':_0x13d965,'WhatsappAccountId':_0x228e6c['id'],'WhatsappInteractionId':_0x2f4067['id'],'UserId':_0x206dfd['user']['id'],'ContactId':_0x26fb03['id']}))[_0x0d8b('0x35')](function(_0x100c54){_0x2f4067['dataValues'][_0x0d8b('0xb9')]=[];_0x2f4067[_0x0d8b('0xba')][_0x0d8b('0xb9')][_0x0d8b('0xa3')](_0x100c54[_0x0d8b('0xba')]);return _0x2f4067;});})[_0x0d8b('0x35')](respondWithResult(_0x12816b,null))[_0x0d8b('0x59')](handleError(_0x12816b,null));}; \ No newline at end of file +var _0xbb53=['params','Pause','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addDisposition','findOne','Disposition','WhatsappAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','pick','findAll','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','emit','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','whatsapp','Applications','account','priority','CmContact','describe','ValidationError','createdAt','updatedAt','difference','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','Contacts','contact','WhatsappInteraction','interaction','push','applications','close','created','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','send','to\x20is\x20mandatory','List','defaults','out','dataValues','Messages','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','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~!@#$%^&-_=+[{]}.','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','WhatsappAccounts','UserProfileResource','stack','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','VIRTUAL','filter','options','includeAll','include','rows'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbb53,0x121));var _0x3bb5=function(_0x533f48,_0x56eefb){_0x533f48=_0x533f48-0x0;var _0xff4c80=_0xbb53[_0x533f48];return _0xff4c80;};'use strict';var pdf=require(_0x3bb5('0x0'));var emlformat=require(_0x3bb5('0x1'));var rimraf=require(_0x3bb5('0x2'));var zipdir=require(_0x3bb5('0x3'));var jsonpatch=require(_0x3bb5('0x4'));var rp=require(_0x3bb5('0x5'));var moment=require(_0x3bb5('0x6'));var BPromise=require(_0x3bb5('0x7'));var Mustache=require(_0x3bb5('0x8'));var util=require(_0x3bb5('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x3bb5('0xa'));var ejs=require(_0x3bb5('0xb'));var fs=require('fs');var _=require(_0x3bb5('0xc'));var squel=require(_0x3bb5('0xd'));var crypto=require(_0x3bb5('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3bb5('0xf'));var Papa=require(_0x3bb5('0x10'));var Redis=require(_0x3bb5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3bb5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3bb5('0x13'))(_0x3bb5('0x14'));var utils=require('../../config/utils');var config=require(_0x3bb5('0x15'));var db=require('../../mysqldb')['db'];config[_0x3bb5('0x16')]=_['defaults'](config['redis'],{'host':_0x3bb5('0x17'),'port':0x18eb});var socket=require(_0x3bb5('0x18'))(new Redis(config[_0x3bb5('0x16')]));require('./whatsappAccount.socket')[_0x3bb5('0x19')](socket);var jayson=require(_0x3bb5('0x1a'));var client=jayson['client'][_0x3bb5('0x1b')]({'port':0x232c});function checkPasswordPattern(_0x15c369,_0x5cec77,_0x5ca99f){if(_0x5ca99f){var _0x50617f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x50617f[_0x3bb5('0x1c')](_0x5cec77)){return _0x15c369;}else{throw new db[(_0x3bb5('0x1d'))]['ValidationError'](_0x3bb5('0x1e'));}}else{return _0x15c369;}}function respondWithRpcPromise(_0x476463,_0x4656c4,_0x262059,_0x48bc25){return new BPromise(function(_0x13cb3a,_0x1109d0){var _0x289177=_0x48bc25||client;return _0x289177['request'](_0x476463,_0x262059)['then'](function(_0x19b177){logger[_0x3bb5('0x1f')](_0x3bb5('0x20'),_0x4656c4,'request\x20sent');logger[_0x3bb5('0x21')](_0x3bb5('0x22'),_0x4656c4,_0x3bb5('0x23'),JSON[_0x3bb5('0x24')](_0x19b177));if(_0x19b177[_0x3bb5('0x25')]){if(_0x19b177[_0x3bb5('0x25')]['code']===0x1f4){logger[_0x3bb5('0x25')](_0x3bb5('0x20'),_0x4656c4,_0x19b177[_0x3bb5('0x25')][_0x3bb5('0x26')]);return _0x1109d0(_0x19b177[_0x3bb5('0x25')][_0x3bb5('0x26')]);}logger[_0x3bb5('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x4656c4,_0x19b177[_0x3bb5('0x25')][_0x3bb5('0x26')]);return _0x13cb3a(_0x19b177['error']['message']);}else{logger[_0x3bb5('0x1f')](_0x3bb5('0x20'),_0x4656c4,'request\x20sent');_0x13cb3a(_0x19b177['result'][_0x3bb5('0x26')]);}})[_0x3bb5('0x27')](function(_0x2fc543){logger[_0x3bb5('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x4656c4,_0x2fc543);_0x1109d0(_0x2fc543);});});}function respondWithStatusCode(_0x5baf9a,_0x33e943){_0x33e943=_0x33e943||0xcc;return function(_0x4e8c65){if(_0x4e8c65){return _0x5baf9a[_0x3bb5('0x28')](_0x33e943);}return _0x5baf9a[_0x3bb5('0x29')](_0x33e943)[_0x3bb5('0x2a')]();};}function respondWithResult(_0x534b15,_0x5f40ac){_0x5f40ac=_0x5f40ac||0xc8;return function(_0x19e61d){if(_0x19e61d){return _0x534b15[_0x3bb5('0x29')](_0x5f40ac)[_0x3bb5('0x2b')](_0x19e61d);}};}function respondWithFilteredResult(_0x18304c,_0x311680){return function(_0x33571b){if(_0x33571b){var _0x3ed2cc=_0x33571b[_0x3bb5('0x2c')],_0x5ce225=_0x311680[_0x3bb5('0x2d')],_0x1b429e=_0x311680[_0x3bb5('0x2d')]+_0x311680[_0x3bb5('0x2e')],_0xa643c9;if(_0x1b429e>=_0x3ed2cc){_0x1b429e=_0x3ed2cc;_0xa643c9=0xc8;}else{_0xa643c9=0xce;}_0x18304c[_0x3bb5('0x29')](_0xa643c9);return _0x18304c['set'](_0x3bb5('0x2f'),_0x5ce225+'-'+_0x1b429e+'/'+_0x3ed2cc)[_0x3bb5('0x2b')](_0x33571b);}return null;};}function patchUpdates(_0x53654b){return function(_0x396345){try{jsonpatch[_0x3bb5('0x30')](_0x396345,_0x53654b,!![]);}catch(_0x280ed6){return BPromise[_0x3bb5('0x31')](_0x280ed6);}return _0x396345[_0x3bb5('0x32')]();};}function saveUpdates(_0x50fb44,_0x31a1f9){return function(_0x1df4c6){if(_0x1df4c6){return _0x1df4c6[_0x3bb5('0x33')](_0x50fb44)[_0x3bb5('0x34')](function(_0x5c95d1){return _0x5c95d1;});}return null;};}function removeEntity(_0x57aed6,_0x125820){return function(_0xeeb452){if(_0xeeb452){return _0xeeb452[_0x3bb5('0x35')]()[_0x3bb5('0x34')](function(){var _0x350ed7=_0xeeb452[_0x3bb5('0x36')]({'plain':!![]});var _0x2a2419=_0x3bb5('0x37');return db[_0x3bb5('0x38')]['destroy']({'where':{'type':_0x2a2419,'resourceId':_0x350ed7['id']}})[_0x3bb5('0x34')](function(){return _0xeeb452;});})[_0x3bb5('0x34')](function(){_0x57aed6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fad67,_0x30d6f1){return function(_0x2757cb){if(!_0x2757cb){_0x2fad67[_0x3bb5('0x28')](0x194);}return _0x2757cb;};}function handleError(_0x4c9085,_0x5cd349){_0x5cd349=_0x5cd349||0x1f4;return function(_0x1fd27b){logger['error'](_0x1fd27b[_0x3bb5('0x39')]);if(_0x1fd27b['name']){delete _0x1fd27b['name'];}_0x4c9085[_0x3bb5('0x29')](_0x5cd349)['send'](_0x1fd27b);};}exports['index']=function(_0x1cdba2,_0x102a8d){var _0x1384cd={'include':[{'model':db['Pause'],'as':_0x3bb5('0x3a')}]},_0x53aead={},_0x273f2b={'count':0x0,'rows':[]};var _0x47c663=_[_0x3bb5('0x3b')](db[_0x3bb5('0x3c')][_0x3bb5('0x3d')],function(_0x103804){return{'name':_0x103804[_0x3bb5('0x3e')],'type':_0x103804[_0x3bb5('0x3f')]['key']};});_0x53aead[_0x3bb5('0x40')]=_[_0x3bb5('0x3b')](_0x47c663,'name');_0x53aead[_0x3bb5('0x41')]=_[_0x3bb5('0x42')](_0x1cdba2[_0x3bb5('0x41')]);_0x53aead['filters']=_[_0x3bb5('0x43')](_0x53aead[_0x3bb5('0x40')],_0x53aead['query']);_0x1384cd[_0x3bb5('0x44')]=_[_0x3bb5('0x43')](_0x53aead[_0x3bb5('0x40')],qs[_0x3bb5('0x45')](_0x1cdba2[_0x3bb5('0x41')][_0x3bb5('0x45')]));_0x1384cd[_0x3bb5('0x44')]=_0x1384cd[_0x3bb5('0x44')][_0x3bb5('0x46')]?_0x1384cd[_0x3bb5('0x44')]:_0x53aead[_0x3bb5('0x40')];if(!_0x1cdba2[_0x3bb5('0x41')][_0x3bb5('0x47')](_0x3bb5('0x48'))){_0x1384cd['limit']=qs[_0x3bb5('0x2e')](_0x1cdba2[_0x3bb5('0x41')]['limit']);_0x1384cd['offset']=qs[_0x3bb5('0x2d')](_0x1cdba2[_0x3bb5('0x41')][_0x3bb5('0x2d')]);}_0x1384cd[_0x3bb5('0x49')]=qs[_0x3bb5('0x4a')](_0x1cdba2[_0x3bb5('0x41')][_0x3bb5('0x4a')]);_0x1384cd[_0x3bb5('0x4b')]=qs['filters'](_['pick'](_0x1cdba2[_0x3bb5('0x41')],_0x53aead[_0x3bb5('0x4c')]),_0x47c663);if(_0x1cdba2[_0x3bb5('0x41')]['filter']){_0x1384cd[_0x3bb5('0x4b')]=_['merge'](_0x1384cd[_0x3bb5('0x4b')],{'$or':_[_0x3bb5('0x3b')](_0x47c663,function(_0x240be8){if(_0x240be8[_0x3bb5('0x3f')]!==_0x3bb5('0x4d')){var _0x2b7c68={};_0x2b7c68[_0x240be8['name']]={'$like':'%'+_0x1cdba2[_0x3bb5('0x41')][_0x3bb5('0x4e')]+'%'};return _0x2b7c68;}})});}_0x1384cd=_['merge']({},_0x1384cd,_0x1cdba2[_0x3bb5('0x4f')]);var _0x13860a={'where':_0x1384cd['where']};return db[_0x3bb5('0x3c')][_0x3bb5('0x2c')](_0x13860a)[_0x3bb5('0x34')](function(_0x3eae04){_0x273f2b[_0x3bb5('0x2c')]=_0x3eae04;if(_0x1cdba2['query'][_0x3bb5('0x50')]){_0x1384cd[_0x3bb5('0x51')]=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x1384cd);})[_0x3bb5('0x34')](function(_0x3e3cf8){_0x273f2b[_0x3bb5('0x52')]=_0x3e3cf8;return _0x273f2b;})[_0x3bb5('0x34')](respondWithFilteredResult(_0x102a8d,_0x1384cd))[_0x3bb5('0x27')](handleError(_0x102a8d,null));};exports['show']=function(_0xcc9e39,_0x2c342c){var _0xedc6d={'raw':![],'where':{'id':_0xcc9e39[_0x3bb5('0x53')]['id']},'include':[{'model':db[_0x3bb5('0x54')],'as':_0x3bb5('0x3a')}]},_0x3c76c9={};_0x3c76c9['model']=_[_0x3bb5('0x42')](db[_0x3bb5('0x3c')][_0x3bb5('0x3d')]);_0x3c76c9[_0x3bb5('0x41')]=_[_0x3bb5('0x42')](_0xcc9e39['query']);_0x3c76c9[_0x3bb5('0x4c')]=_[_0x3bb5('0x43')](_0x3c76c9[_0x3bb5('0x40')],_0x3c76c9[_0x3bb5('0x41')]);_0xedc6d[_0x3bb5('0x44')]=_[_0x3bb5('0x43')](_0x3c76c9[_0x3bb5('0x40')],qs[_0x3bb5('0x45')](_0xcc9e39['query'][_0x3bb5('0x45')]));_0xedc6d[_0x3bb5('0x44')]=_0xedc6d[_0x3bb5('0x44')][_0x3bb5('0x46')]?_0xedc6d['attributes']:_0x3c76c9[_0x3bb5('0x40')];if(_0xcc9e39['query'][_0x3bb5('0x50')]){_0xedc6d[_0x3bb5('0x51')]=[{'all':!![]}];}_0xedc6d=_[_0x3bb5('0x55')]({},_0xedc6d,_0xcc9e39[_0x3bb5('0x4f')]);return db[_0x3bb5('0x3c')]['find'](_0xedc6d)[_0x3bb5('0x34')](handleEntityNotFound(_0x2c342c,null))[_0x3bb5('0x34')](respondWithResult(_0x2c342c,null))[_0x3bb5('0x27')](handleError(_0x2c342c,null));};exports[_0x3bb5('0x56')]=function(_0x4fc8a4,_0xe88e97){return db[_0x3bb5('0x3c')][_0x3bb5('0x56')](_0x4fc8a4[_0x3bb5('0x57')],{})[_0x3bb5('0x34')](function(_0xe5b850){var _0x1b1b09=_0x4fc8a4[_0x3bb5('0x58')]['get']({'plain':!![]});if(!_0x1b1b09)throw new Error(_0x3bb5('0x59'));if(_0x1b1b09[_0x3bb5('0x5a')]===_0x3bb5('0x58')){var _0x5a98cf=_0xe5b850['get']({'plain':!![]});var _0x27d764=_0x3bb5('0x37');return db[_0x3bb5('0x5b')]['find']({'where':{'name':_0x27d764,'userProfileId':_0x1b1b09[_0x3bb5('0x5c')]},'raw':!![]})[_0x3bb5('0x34')](function(_0x45b661){if(_0x45b661&&_0x45b661[_0x3bb5('0x5d')]===0x0){return db[_0x3bb5('0x38')][_0x3bb5('0x56')]({'name':_0x5a98cf[_0x3bb5('0x5e')],'resourceId':_0x5a98cf['id'],'type':_0x45b661['name'],'sectionId':_0x45b661['id']},{})['then'](function(){return _0xe5b850;});}else{return _0xe5b850;}})[_0x3bb5('0x27')](function(_0x4f2a61){logger[_0x3bb5('0x25')](_0x3bb5('0x5f'),_0x4f2a61);throw _0x4f2a61;});}return _0xe5b850;})[_0x3bb5('0x34')](respondWithResult(_0xe88e97,0xc9))[_0x3bb5('0x27')](handleError(_0xe88e97,null));};exports['update']=function(_0x790047,_0x37ee49){if(_0x790047[_0x3bb5('0x57')]['id']){delete _0x790047[_0x3bb5('0x57')]['id'];}return db['WhatsappAccount'][_0x3bb5('0x60')]({'where':{'id':_0x790047[_0x3bb5('0x53')]['id']},'include':[{'model':db[_0x3bb5('0x54')],'as':_0x3bb5('0x3a')}]})[_0x3bb5('0x34')](handleEntityNotFound(_0x37ee49,null))[_0x3bb5('0x34')](saveUpdates(_0x790047[_0x3bb5('0x57')],null))[_0x3bb5('0x34')](respondWithResult(_0x37ee49,null))['catch'](handleError(_0x37ee49,null));};exports[_0x3bb5('0x35')]=function(_0x3c30ac,_0x1f89ee){return db[_0x3bb5('0x3c')][_0x3bb5('0x60')]({'where':{'id':_0x3c30ac['params']['id']}})[_0x3bb5('0x34')](handleEntityNotFound(_0x1f89ee,null))['then'](removeEntity(_0x1f89ee,null))[_0x3bb5('0x27')](handleError(_0x1f89ee,null));};exports['describe']=function(_0x256269,_0x3407d){return db[_0x3bb5('0x3c')]['describe']()[_0x3bb5('0x34')](respondWithResult(_0x3407d,null))[_0x3bb5('0x27')](handleError(_0x3407d,null));};exports[_0x3bb5('0x61')]=function(_0x4b00d7,_0x10d058,_0x14cf65){if(_0x4b00d7[_0x3bb5('0x57')]['id']){delete _0x4b00d7['body']['id'];}return db[_0x3bb5('0x3c')][_0x3bb5('0x60')]({'where':{'id':_0x4b00d7[_0x3bb5('0x53')]['id']}})[_0x3bb5('0x34')](handleEntityNotFound(_0x10d058,null))[_0x3bb5('0x34')](function(_0x396b23){if(_0x396b23){_0x4b00d7[_0x3bb5('0x57')]['WhatsappAccountId']=_0x396b23['id'];return db['Disposition'][_0x3bb5('0x56')](_0x4b00d7[_0x3bb5('0x57')]);}})['then'](respondWithResult(_0x10d058,null))[_0x3bb5('0x27')](handleError(_0x10d058,null));};exports['getDispositions']=function(_0x15265c,_0x1599ad,_0x215a60){var _0x380dcb={'raw':![],'where':{}};var _0x4c0dc9={};var _0x28cc70={'count':0x0,'rows':[]};return db[_0x3bb5('0x3c')][_0x3bb5('0x62')]({'where':{'id':_0x15265c['params']['id']}})[_0x3bb5('0x34')](handleEntityNotFound(_0x1599ad,null))[_0x3bb5('0x34')](function(_0x5005d5){if(_0x5005d5){_0x4c0dc9[_0x3bb5('0x40')]=_[_0x3bb5('0x42')](db[_0x3bb5('0x63')][_0x3bb5('0x3d')]);_0x4c0dc9[_0x3bb5('0x41')]=_[_0x3bb5('0x42')](_0x15265c[_0x3bb5('0x41')]);_0x4c0dc9['filters']=_['intersection'](_0x4c0dc9['model'],_0x4c0dc9['query']);_0x380dcb['attributes']=_[_0x3bb5('0x43')](_0x4c0dc9[_0x3bb5('0x40')],qs[_0x3bb5('0x45')](_0x15265c[_0x3bb5('0x41')][_0x3bb5('0x45')]));_0x380dcb[_0x3bb5('0x44')]=_0x380dcb[_0x3bb5('0x44')][_0x3bb5('0x46')]?_0x380dcb['attributes']:_0x4c0dc9[_0x3bb5('0x40')];if(!_0x15265c[_0x3bb5('0x41')][_0x3bb5('0x47')](_0x3bb5('0x48'))){_0x380dcb[_0x3bb5('0x2e')]=qs[_0x3bb5('0x2e')](_0x15265c[_0x3bb5('0x41')]['limit']);_0x380dcb[_0x3bb5('0x2d')]=qs['offset'](_0x15265c[_0x3bb5('0x41')][_0x3bb5('0x2d')]);}_0x380dcb[_0x3bb5('0x49')]=qs['sort'](_0x15265c[_0x3bb5('0x41')][_0x3bb5('0x4a')]);_0x380dcb[_0x3bb5('0x4b')]=qs[_0x3bb5('0x4c')](_['pick'](_0x15265c[_0x3bb5('0x41')],_0x4c0dc9['filters']));_0x380dcb['where'][_0x3bb5('0x64')]=_0x5005d5['id'];if(_0x15265c[_0x3bb5('0x41')][_0x3bb5('0x4e')]){_0x380dcb[_0x3bb5('0x4b')]=_['merge'](_0x380dcb[_0x3bb5('0x4b')],{'$or':_['map'](_0x380dcb[_0x3bb5('0x44')],function(_0x282857){var _0xabde1b={};_0xabde1b[_0x282857]={'$like':'%'+_0x15265c[_0x3bb5('0x41')][_0x3bb5('0x4e')]+'%'};return _0xabde1b;})});}_0x380dcb=_['merge']({},_0x380dcb,_0x15265c[_0x3bb5('0x4f')]);return db['Disposition'][_0x3bb5('0x2c')]({'where':_0x380dcb['where']})[_0x3bb5('0x34')](function(_0x7ea45c){_0x28cc70[_0x3bb5('0x2c')]=_0x7ea45c;if(_0x15265c[_0x3bb5('0x41')][_0x3bb5('0x50')]){_0x380dcb[_0x3bb5('0x51')]=[{'all':!![]}];}return db[_0x3bb5('0x63')]['findAll'](_0x380dcb);})['then'](function(_0x4cfb81){_0x28cc70['rows']=_0x4cfb81;return _0x28cc70;});}})[_0x3bb5('0x34')](respondWithFilteredResult(_0x1599ad,_0x380dcb))[_0x3bb5('0x27')](handleError(_0x1599ad,null));};exports[_0x3bb5('0x65')]=function(_0x12ad9d,_0x5bb63e,_0x18aff9){return db['WhatsappAccount'][_0x3bb5('0x60')]({'where':{'id':_0x12ad9d[_0x3bb5('0x53')]['id']}})[_0x3bb5('0x34')](handleEntityNotFound(_0x5bb63e,null))[_0x3bb5('0x34')](function(_0x33bc04){if(_0x33bc04){return _0x33bc04[_0x3bb5('0x65')](_0x12ad9d[_0x3bb5('0x41')][_0x3bb5('0x66')]);}})[_0x3bb5('0x34')](respondWithStatusCode(_0x5bb63e,null))['catch'](handleError(_0x5bb63e,null));};exports[_0x3bb5('0x67')]=function(_0x7d0b52,_0x41cc6a,_0x13b230){if(_0x7d0b52[_0x3bb5('0x57')]['id']){delete _0x7d0b52[_0x3bb5('0x57')]['id'];}return db[_0x3bb5('0x3c')][_0x3bb5('0x60')]({'where':{'id':_0x7d0b52[_0x3bb5('0x53')]['id']}})['then'](handleEntityNotFound(_0x41cc6a,null))['then'](function(_0x329f02){if(_0x329f02){_0x7d0b52[_0x3bb5('0x57')][_0x3bb5('0x64')]=_0x329f02['id'];return db[_0x3bb5('0x68')][_0x3bb5('0x56')](_0x7d0b52[_0x3bb5('0x57')]);}})['then'](respondWithResult(_0x41cc6a,null))[_0x3bb5('0x27')](handleError(_0x41cc6a,null));};exports[_0x3bb5('0x69')]=function(_0x1f2ea8,_0x207b1f,_0x3601c3){var _0x56de25={'raw':![],'where':{}};var _0x1e835c={};var _0x1635ee={'count':0x0,'rows':[]};return db[_0x3bb5('0x3c')][_0x3bb5('0x62')]({'where':{'id':_0x1f2ea8[_0x3bb5('0x53')]['id']}})[_0x3bb5('0x34')](handleEntityNotFound(_0x207b1f,null))['then'](function(_0x1724d9){if(_0x1724d9){_0x1e835c[_0x3bb5('0x40')]=_[_0x3bb5('0x42')](db[_0x3bb5('0x68')]['rawAttributes']);_0x1e835c[_0x3bb5('0x41')]=_[_0x3bb5('0x42')](_0x1f2ea8['query']);_0x1e835c[_0x3bb5('0x4c')]=_['intersection'](_0x1e835c[_0x3bb5('0x40')],_0x1e835c[_0x3bb5('0x41')]);_0x56de25[_0x3bb5('0x44')]=_[_0x3bb5('0x43')](_0x1e835c[_0x3bb5('0x40')],qs[_0x3bb5('0x45')](_0x1f2ea8[_0x3bb5('0x41')][_0x3bb5('0x45')]));_0x56de25[_0x3bb5('0x44')]=_0x56de25['attributes'][_0x3bb5('0x46')]?_0x56de25[_0x3bb5('0x44')]:_0x1e835c[_0x3bb5('0x40')];if(!_0x1f2ea8[_0x3bb5('0x41')]['hasOwnProperty'](_0x3bb5('0x48'))){_0x56de25['limit']=qs['limit'](_0x1f2ea8[_0x3bb5('0x41')][_0x3bb5('0x2e')]);_0x56de25['offset']=qs[_0x3bb5('0x2d')](_0x1f2ea8[_0x3bb5('0x41')][_0x3bb5('0x2d')]);}_0x56de25[_0x3bb5('0x49')]=qs[_0x3bb5('0x4a')](_0x1f2ea8['query'][_0x3bb5('0x4a')]);_0x56de25[_0x3bb5('0x4b')]=qs[_0x3bb5('0x4c')](_[_0x3bb5('0x6a')](_0x1f2ea8['query'],_0x1e835c['filters']));_0x56de25[_0x3bb5('0x4b')][_0x3bb5('0x64')]=_0x1724d9['id'];if(_0x1f2ea8['query']['filter']){_0x56de25[_0x3bb5('0x4b')]=_[_0x3bb5('0x55')](_0x56de25[_0x3bb5('0x4b')],{'$or':_[_0x3bb5('0x3b')](_0x56de25[_0x3bb5('0x44')],function(_0x416667){var _0xf39ca4={};_0xf39ca4[_0x416667]={'$like':'%'+_0x1f2ea8[_0x3bb5('0x41')][_0x3bb5('0x4e')]+'%'};return _0xf39ca4;})});}_0x56de25=_[_0x3bb5('0x55')]({},_0x56de25,_0x1f2ea8[_0x3bb5('0x4f')]);return db['CannedAnswer'][_0x3bb5('0x2c')]({'where':_0x56de25[_0x3bb5('0x4b')]})['then'](function(_0x494102){_0x1635ee[_0x3bb5('0x2c')]=_0x494102;if(_0x1f2ea8[_0x3bb5('0x41')][_0x3bb5('0x50')]){_0x56de25[_0x3bb5('0x51')]=[{'all':!![]}];}return db['CannedAnswer'][_0x3bb5('0x6b')](_0x56de25);})[_0x3bb5('0x34')](function(_0x1e03a2){_0x1635ee['rows']=_0x1e03a2;return _0x1635ee;});}})[_0x3bb5('0x34')](respondWithFilteredResult(_0x207b1f,_0x56de25))['catch'](handleError(_0x207b1f,null));};exports[_0x3bb5('0x6c')]=function(_0x2318c7,_0xa098fc,_0x4ae3c4){return db['WhatsappAccount'][_0x3bb5('0x60')]({'where':{'id':_0x2318c7['params']['id']}})['then'](handleEntityNotFound(_0xa098fc,null))['then'](function(_0x1b1e00){if(_0x1b1e00){return _0x1b1e00['removeAnswers'](_0x2318c7[_0x3bb5('0x41')]['ids']);}})[_0x3bb5('0x34')](respondWithStatusCode(_0xa098fc,null))[_0x3bb5('0x27')](handleError(_0xa098fc,null));};exports[_0x3bb5('0x6d')]=function(_0x56490e,_0x2fe96c,_0x25164b){return db[_0x3bb5('0x3c')]['find']({'where':{'id':_0x56490e[_0x3bb5('0x53')]['id']}})[_0x3bb5('0x34')](handleEntityNotFound(_0x2fe96c,null))[_0x3bb5('0x34')](function(_0x351318){if(_0x351318){return _0x351318[_0x3bb5('0x6d')](_0x56490e[_0x3bb5('0x57')][_0x3bb5('0x66')],_[_0x3bb5('0x6e')](_0x56490e[_0x3bb5('0x57')],[_0x3bb5('0x66'),'id'])||{})[_0x3bb5('0x6f')](function(_0x1de262){for(var _0x2165d6=0x0;_0x2165d6<_0x56490e['body']['ids'][_0x3bb5('0x46')];_0x2165d6+=0x1){socket['emit'](_0x3bb5('0x70'),{'UserId':_0x56490e[_0x3bb5('0x57')][_0x3bb5('0x66')][_0x2165d6],'WhatsappAccountId':_0x56490e[_0x3bb5('0x53')]['id']});}return _0x1de262;});}})[_0x3bb5('0x34')](respondWithResult(_0x2fe96c,null))[_0x3bb5('0x27')](handleError(_0x2fe96c,null));};exports['removeAgents']=function(_0x2f261f,_0x1ddef5,_0x3ac2f0){return db[_0x3bb5('0x3c')][_0x3bb5('0x60')]({'where':{'id':_0x2f261f[_0x3bb5('0x53')]['id']}})[_0x3bb5('0x34')](handleEntityNotFound(_0x1ddef5,null))[_0x3bb5('0x34')](function(_0x4e11e0){if(_0x4e11e0){return _0x4e11e0[_0x3bb5('0x71')](_0x2f261f[_0x3bb5('0x41')][_0x3bb5('0x66')])['then'](function(){if(_[_0x3bb5('0x72')](_0x2f261f[_0x3bb5('0x41')]['ids'])){for(var _0x15c9ed=0x0;_0x15c9ed<_0x2f261f[_0x3bb5('0x41')][_0x3bb5('0x66')]['length'];_0x15c9ed+=0x1){socket['emit'](_0x3bb5('0x73'),{'UserId':Number(_0x2f261f[_0x3bb5('0x41')]['ids'][_0x15c9ed]),'WhatsappAccountId':Number(_0x2f261f['params']['id'])});}}else{socket[_0x3bb5('0x74')](_0x3bb5('0x73'),{'UserId':Number(_0x2f261f[_0x3bb5('0x41')][_0x3bb5('0x66')]),'WhatsappAccountId':Number(_0x2f261f[_0x3bb5('0x53')]['id'])});}});}})[_0x3bb5('0x34')](respondWithStatusCode(_0x1ddef5,null))[_0x3bb5('0x27')](handleError(_0x1ddef5,null));};exports[_0x3bb5('0x75')]=function(_0x2be900,_0x4d6248,_0x41fe10){var _0x8d75c9={};var _0x4588e8={};var _0xb36b20;var _0x9ee1a3;return db[_0x3bb5('0x3c')]['findOne']({'where':{'id':_0x2be900[_0x3bb5('0x53')]['id']}})[_0x3bb5('0x34')](handleEntityNotFound(_0x4d6248,null))[_0x3bb5('0x34')](function(_0x2c3742){if(_0x2c3742){_0xb36b20=_0x2c3742;_0x4588e8[_0x3bb5('0x40')]=_[_0x3bb5('0x42')](db[_0x3bb5('0x76')][_0x3bb5('0x3d')]);_0x4588e8[_0x3bb5('0x41')]=_[_0x3bb5('0x42')](_0x2be900[_0x3bb5('0x41')]);_0x4588e8[_0x3bb5('0x4c')]=_[_0x3bb5('0x43')](_0x4588e8[_0x3bb5('0x40')],_0x4588e8[_0x3bb5('0x41')]);_0x8d75c9[_0x3bb5('0x44')]=_[_0x3bb5('0x43')](_0x4588e8[_0x3bb5('0x40')],qs[_0x3bb5('0x45')](_0x2be900[_0x3bb5('0x41')][_0x3bb5('0x45')]));_0x8d75c9['attributes']=_0x8d75c9[_0x3bb5('0x44')]['length']?_0x8d75c9[_0x3bb5('0x44')]:_0x4588e8[_0x3bb5('0x40')];_0x8d75c9['order']=qs[_0x3bb5('0x4a')](_0x2be900['query'][_0x3bb5('0x4a')]);_0x8d75c9[_0x3bb5('0x4b')]=qs[_0x3bb5('0x4c')](_[_0x3bb5('0x6a')](_0x2be900[_0x3bb5('0x41')],_0x4588e8[_0x3bb5('0x4c')]));if(_0x2be900[_0x3bb5('0x41')][_0x3bb5('0x4e')]){_0x8d75c9[_0x3bb5('0x4b')]=_[_0x3bb5('0x55')](_0x8d75c9[_0x3bb5('0x4b')],{'$or':_['map'](_0x8d75c9[_0x3bb5('0x44')],function(_0x59ce4c){var _0x27a28c={};_0x27a28c[_0x59ce4c]={'$like':'%'+_0x2be900[_0x3bb5('0x41')][_0x3bb5('0x4e')]+'%'};return _0x27a28c;})});}_0x8d75c9=_[_0x3bb5('0x55')]({},_0x8d75c9,_0x2be900[_0x3bb5('0x4f')]);return _0xb36b20[_0x3bb5('0x75')](_0x8d75c9);}})[_0x3bb5('0x34')](function(_0x5e059b){if(_0x5e059b){_0x9ee1a3=_0x5e059b['length'];if(!_0x2be900[_0x3bb5('0x41')][_0x3bb5('0x47')]('nolimit')){_0x8d75c9[_0x3bb5('0x2e')]=qs[_0x3bb5('0x2e')](_0x2be900['query'][_0x3bb5('0x2e')]);_0x8d75c9[_0x3bb5('0x2d')]=qs[_0x3bb5('0x2d')](_0x2be900['query']['offset']);}return _0xb36b20[_0x3bb5('0x75')](_0x8d75c9);}})['then'](function(_0x316567){if(_0x316567){return _0x316567?{'count':_0x9ee1a3,'rows':_0x316567}:null;}})[_0x3bb5('0x34')](respondWithResult(_0x4d6248,null))[_0x3bb5('0x27')](handleError(_0x4d6248,null));};exports[_0x3bb5('0x77')]=function(_0x34e5ac,_0x2b7912,_0x1c4106){return db[_0x3bb5('0x3c')]['findOne']({'where':{'id':_0x34e5ac['params']['id']}})[_0x3bb5('0x34')](handleEntityNotFound(_0x2b7912,null))[_0x3bb5('0x34')](function(_0x2f8791){if(_0x2f8791){return db[_0x3bb5('0x78')][_0x3bb5('0x79')](function(_0xbdc805){return db[_0x3bb5('0x7a')]['destroy']({'where':{'WhatsappAccountId':_0x34e5ac[_0x3bb5('0x53')]['id']},'transaction':_0xbdc805})[_0x3bb5('0x34')](function(_0x2347f4){var _0x43ce2a=_[_0x3bb5('0x3b')](_0x34e5ac['body'],function(_0x52272b){_0x52272b[_0x3bb5('0x64')]=_0x34e5ac[_0x3bb5('0x53')]['id'];return _0x52272b;});return db[_0x3bb5('0x7a')][_0x3bb5('0x7b')](_0x43ce2a,{'transaction':_0xbdc805});});})['then'](function(){return db[_0x3bb5('0x7a')][_0x3bb5('0x7c')]({'where':{'WhatsappAccountId':_0x34e5ac[_0x3bb5('0x53')]['id']},'order':'priority'});});}})[_0x3bb5('0x34')](respondWithResult(_0x2b7912,null))['catch'](handleError(_0x2b7912,null));};exports[_0x3bb5('0x7d')]=function(_0x36079c,_0x4d29a6,_0x52bbcb){var _0x55d05a={};var _0x5872df={};var _0x5a0dcd;var _0x3822b5;return db['WhatsappAccount'][_0x3bb5('0x62')]({'where':{'id':_0x36079c[_0x3bb5('0x53')]['id']}})['then'](handleEntityNotFound(_0x4d29a6,null))[_0x3bb5('0x34')](function(_0x4099fa){if(_0x4099fa){_0x5a0dcd=_0x4099fa;_0x5872df[_0x3bb5('0x40')]=_['keys'](db[_0x3bb5('0x7a')][_0x3bb5('0x3d')]);_0x5872df[_0x3bb5('0x41')]=_[_0x3bb5('0x42')](_0x36079c[_0x3bb5('0x41')]);_0x5872df[_0x3bb5('0x4c')]=_[_0x3bb5('0x43')](_0x5872df[_0x3bb5('0x40')],_0x5872df['query']);_0x55d05a[_0x3bb5('0x44')]=_[_0x3bb5('0x43')](_0x5872df['model'],qs[_0x3bb5('0x45')](_0x36079c[_0x3bb5('0x41')][_0x3bb5('0x45')]));_0x55d05a['attributes']=_0x55d05a[_0x3bb5('0x44')][_0x3bb5('0x46')]?_0x55d05a[_0x3bb5('0x44')]:_0x5872df['model'];_0x55d05a[_0x3bb5('0x49')]=qs[_0x3bb5('0x4a')](_0x36079c[_0x3bb5('0x41')][_0x3bb5('0x4a')]);_0x55d05a['where']=qs[_0x3bb5('0x4c')](_[_0x3bb5('0x6a')](_0x36079c['query'],_0x5872df[_0x3bb5('0x4c')]));if(_0x36079c['query'][_0x3bb5('0x4e')]){_0x55d05a['where']=_['merge'](_0x55d05a[_0x3bb5('0x4b')],{'$or':_[_0x3bb5('0x3b')](_0x55d05a['attributes'],function(_0x37f431){var _0x16c322={};_0x16c322[_0x37f431]={'$like':'%'+_0x36079c[_0x3bb5('0x41')]['filter']+'%'};return _0x16c322;})});}_0x55d05a=_['merge']({},_0x55d05a,_0x36079c[_0x3bb5('0x4f')]);return _0x5a0dcd[_0x3bb5('0x7d')](_0x55d05a);}})[_0x3bb5('0x34')](function(_0xb20fdf){if(_0xb20fdf){_0x3822b5=_0xb20fdf[_0x3bb5('0x46')];if(!_0x36079c[_0x3bb5('0x41')][_0x3bb5('0x47')]('nolimit')){_0x55d05a['limit']=qs['limit'](_0x36079c['query'][_0x3bb5('0x2e')]);_0x55d05a[_0x3bb5('0x2d')]=qs[_0x3bb5('0x2d')](_0x36079c[_0x3bb5('0x41')]['offset']);}return _0x5a0dcd[_0x3bb5('0x7d')](_0x55d05a);}})[_0x3bb5('0x34')](function(_0x24f318){if(_0x24f318){return _0x24f318?{'count':_0x3822b5,'rows':_0x24f318}:null;}})[_0x3bb5('0x34')](respondWithResult(_0x4d29a6,null))[_0x3bb5('0x27')](handleError(_0x4d29a6,null));};exports['notify']=function(_0x58e4c5,_0x569937,_0x1fa710){var _0x370a3c={'channel':_0x3bb5('0x7e')};var _0x1fc3fa=[];var _0x55b52f=[];var _0x21a573={};return db[_0x3bb5('0x3c')][_0x3bb5('0x60')]({'where':{'id':_0x58e4c5['params']['id']},'include':[{'model':db[_0x3bb5('0x7a')],'as':_0x3bb5('0x7f')}]})['then'](handleEntityNotFound(_0x569937,null))[_0x3bb5('0x34')](function(_0x3d21d5){_0x370a3c[_0x3bb5('0x80')]=_0x3d21d5;_0x370a3c['applications']=_['orderBy'](_0x3d21d5[_0x3bb5('0x7f')],[_0x3bb5('0x81')],['asc']);if(_0x370a3c['account'][_0x3bb5('0x7f')]){delete _0x370a3c['account'][_0x3bb5('0x7f')];}return db[_0x3bb5('0x82')][_0x3bb5('0x83')]();})[_0x3bb5('0x34')](function(_0x13785a){if(!_0x13785a){throw new db[(_0x3bb5('0x1d'))][(_0x3bb5('0x84'))]('no\x20available\x20attributes');}_0x1fc3fa=_['difference'](_['keys'](_0x13785a),[_0x3bb5('0x85'),_0x3bb5('0x86')]);_0x55b52f=_[_0x3bb5('0x87')](_[_0x3bb5('0x42')](_0x13785a),[_0x3bb5('0x85'),_0x3bb5('0x86'),_0x3bb5('0x88'),_0x3bb5('0x89')]);_0x370a3c[_0x3bb5('0x57')]={'mapKey':_0x3bb5('0x8a')};if(_0x370a3c[_0x3bb5('0x80')][_0x3bb5('0x3f')]&&_0x370a3c['account'][_0x3bb5('0x3f')]===_0x3bb5('0x8b')){_0x370a3c['body'][_0x3bb5('0x8c')]=_0x58e4c5[_0x3bb5('0x57')][_0x3bb5('0x8d')][_0x3bb5('0x8e')](_0x3bb5('0x8f'),'');_0x370a3c[_0x3bb5('0x57')][_0x3bb5('0x57')]=_0x58e4c5[_0x3bb5('0x57')][_0x3bb5('0x90')];_0x370a3c[_0x3bb5('0x57')][_0x3bb5('0x91')]=_0x58e4c5[_0x3bb5('0x57')][_0x3bb5('0x92')];}if(_0x370a3c[_0x3bb5('0x57')]['id']){delete _0x370a3c[_0x3bb5('0x57')]['id'];}if(_['isNil'](_0x370a3c[_0x3bb5('0x57')]['from'])){throw new db[(_0x3bb5('0x1d'))][(_0x3bb5('0x84'))](_0x3bb5('0x93'));}if(_['isNil'](_0x370a3c[_0x3bb5('0x57')][_0x3bb5('0x57')])||_0x370a3c[_0x3bb5('0x57')][_0x3bb5('0x57')]===''){throw new db[(_0x3bb5('0x1d'))][(_0x3bb5('0x84'))](_0x3bb5('0x94'));}if(_[_0x3bb5('0x95')](_0x370a3c[_0x3bb5('0x57')][_0x3bb5('0x96')])){throw new db[(_0x3bb5('0x1d'))][(_0x3bb5('0x84'))](_0x3bb5('0x97')+_0x55b52f);}if(!_['includes'](_0x55b52f,_0x370a3c[_0x3bb5('0x57')][_0x3bb5('0x96')])){throw new db['Sequelize'][(_0x3bb5('0x84'))](_0x3bb5('0x98')+_0x55b52f);}_0x21a573[_0x370a3c['body'][_0x3bb5('0x96')]]=_0x370a3c[_0x3bb5('0x57')][_0x3bb5('0x8c')];return db[_0x3bb5('0x99')][_0x3bb5('0x60')]({'where':{'id':_0x370a3c[_0x3bb5('0x80')]['ListId']},'include':[{'model':db[_0x3bb5('0x82')],'as':'Contacts','where':_0x21a573,'limit':0x1,'order':[[_0x3bb5('0x86'),_0x3bb5('0x9a')]]}]});})[_0x3bb5('0x34')](handleEntityNotFound(_0x569937,null))[_0x3bb5('0x34')](function(_0x83438e){if(_0x83438e){_0x370a3c[_0x3bb5('0x9b')]=_[_0x3bb5('0x6e')](_0x83438e,[_0x3bb5('0x9c')]);if(_0x83438e[_0x3bb5('0x9c')][_0x3bb5('0x46')]){return _0x83438e['Contacts'][0x0];}var _0x36e881=_['defaults'](_0x370a3c[_0x3bb5('0x57')],{'firstName':_0x370a3c[_0x3bb5('0x57')][_0x3bb5('0x8c')],'ListId':_0x83438e['id']});_0x36e881[_0x370a3c['body'][_0x3bb5('0x96')]]=_0x370a3c[_0x3bb5('0x57')][_0x3bb5('0x8c')];return db[_0x3bb5('0x82')][_0x3bb5('0x56')](_0x36e881,{'fields':_0x1fc3fa,'raw':!![]});}})[_0x3bb5('0x34')](handleEntityNotFound(_0x569937,null))[_0x3bb5('0x34')](function(_0x305d9b){if(_0x305d9b){_0x370a3c[_0x3bb5('0x9d')]=_0x305d9b;var _0x3c85a6={'ContactId':_0x305d9b['id'],'phone':_0x370a3c['body'][_0x3bb5('0x8c')],'WhatsappAccountId':_0x58e4c5[_0x3bb5('0x53')]['id']};var _0x22e8be={'ContactId':_0x305d9b['id'],'WhatsappAccountId':_0x58e4c5['params']['id'],'closed':![]};return db['WhatsappInteraction'][_0x3bb5('0x60')]({'where':_0x22e8be})[_0x3bb5('0x34')](function(_0x1983e7){if(_0x1983e7){return[_0x1983e7,![]];}return db[_0x3bb5('0x9e')]['create'](_0x3c85a6)['then'](function(_0xbae0c2){return[_0xbae0c2,!![]];});});}})['spread'](function(_0x20fd9b,_0x3fc517){_0x370a3c[_0x3bb5('0x9f')]=_0x20fd9b[_0x3bb5('0x36')]({'plain':!![]});_0x370a3c[_0x3bb5('0x9f')]['created']=![];if(_0x3fc517){if(_0x370a3c[_0x3bb5('0x80')]['autoclose']){_0x370a3c['applications'][_0x3bb5('0xa0')]({'id':0x0,'priority':_0x370a3c[_0x3bb5('0xa1')][_0x3bb5('0x46')]+0x1,'app':_0x3bb5('0xa2'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x370a3c[_0x3bb5('0x9f')][_0x3bb5('0xa3')]=!![];}return db[_0x3bb5('0xa4')][_0x3bb5('0x56')]({'phone':_0x370a3c['body']['from'],'messageId':_0x370a3c[_0x3bb5('0x57')]['messageId'],'body':_0x370a3c[_0x3bb5('0x57')][_0x3bb5('0x57')],'WhatsappAccountId':_0x58e4c5[_0x3bb5('0x53')]['id'],'WhatsappInteractionId':_0x20fd9b['id'],'direction':'in','ContactId':_0x20fd9b[_0x3bb5('0xa5')],'AttachmentId':_0x370a3c[_0x3bb5('0x57')][_0x3bb5('0xa6')]});})[_0x3bb5('0x34')](function(_0x24358f){_0x370a3c[_0x3bb5('0x26')]=_0x24358f;if(_0x370a3c[_0x3bb5('0x9f')][_0x3bb5('0xa7')]){return db[_0x3bb5('0x76')][_0x3bb5('0x60')]({'attributes':['id','name'],'where':{'id':_0x370a3c['interaction'][_0x3bb5('0xa7')]}})[_0x3bb5('0x34')](function(_0x3460c7){if(_0x3460c7){_0x370a3c[_0x3bb5('0xa1')][_0x3bb5('0xa8')]({'id':0x0,'priority':0x0,'app':_0x3bb5('0xa9'),'appdata':_0x3460c7[_0x3bb5('0x5e')]+','+(_0x370a3c[_0x3bb5('0x80')][_0x3bb5('0xaa')]||0xa),'interval':_0x3bb5('0xab')});}return respondWithRpcPromise(_0x3bb5('0xac'),_0x3bb5('0xad'),_0x370a3c);});}return respondWithRpcPromise(_0x3bb5('0xac'),'startRouting',_0x370a3c);})['then'](function(_0x27feff){if(_0x27feff){var _0x4708c7=0xc8;var _0x4d5f74='receiveMessage';logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4d5f74,_0x4708c7,_0x3bb5('0xae'));logger[_0x3bb5('0x21')](_0x3bb5('0xaf'),_0x4d5f74,_0x4708c7,_0x3bb5('0xae'),JSON['stringify'](_0x27feff));if(_0x370a3c[_0x3bb5('0x80')]['type']==='twilio'){return _0x569937[_0x3bb5('0x29')](_0x4708c7)[_0x3bb5('0xb0')](_0x3bb5('0xb1'),_0x3bb5('0xb2'))[_0x3bb5('0xb3')]('\x0a');}else{return _0x569937[_0x3bb5('0x29')](_0x4708c7)[_0x3bb5('0x2b')](_0x27feff);}}})[_0x3bb5('0x27')](handleError(_0x569937,null));};exports[_0x3bb5('0xb3')]=function(_0x546345,_0x2e1f3e,_0x362ac5){var _0xc575c3,_0x6b248,_0x5a0b6e;if(_[_0x3bb5('0x95')](_0x546345['body']['body'])||_0x546345[_0x3bb5('0x57')]['body']===''){throw new db['Sequelize'][(_0x3bb5('0x84'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x3bb5('0x95')](_0x546345['body']['to'])){throw new db[(_0x3bb5('0x1d'))][(_0x3bb5('0x84'))](_0x3bb5('0xb4'));}_0xc575c3=_0x546345[_0x3bb5('0x57')]['to'];return db['WhatsappAccount'][_0x3bb5('0x60')]({'where':{'id':_0x546345[_0x3bb5('0x53')]['id']},'include':[{'model':db[_0x3bb5('0x99')],'as':_0x3bb5('0xb5'),'include':[{'model':db[_0x3bb5('0x82')],'as':_0x3bb5('0x9c'),'where':{'mobile':_0xc575c3},'limit':0x1,'order':[[_0x3bb5('0x86'),_0x3bb5('0x9a')]]}]}]})[_0x3bb5('0x34')](handleEntityNotFound(_0x2e1f3e,null))['then'](function(_0x5d12d4){if(_0x5d12d4&&_0x5d12d4['List']){_0x6b248=_0x5d12d4[_0x3bb5('0x36')]({'plain':!![]});if(_0x6b248[_0x3bb5('0xb5')]&&_0x6b248[_0x3bb5('0xb5')][_0x3bb5('0x9c')]['length']){return _0x6b248[_0x3bb5('0xb5')]['Contacts'][0x0];}return db[_0x3bb5('0x82')][_0x3bb5('0x56')](_[_0x3bb5('0xb6')](_0x546345['body'],{'firstName':_0xc575c3,'mobile':_0xc575c3,'phone':_0xc575c3,'ListId':_0x6b248[_0x3bb5('0x89')]}));}})[_0x3bb5('0x34')](handleEntityNotFound(_0x2e1f3e,null))[_0x3bb5('0x34')](function(_0x4207cc){if(_0x4207cc){_0x5a0b6e=_0x4207cc;return db[_0x3bb5('0x9e')][_0x3bb5('0x60')]({'where':{'ContactId':_0x5a0b6e['id'],'closed':![],'WhatsappAccountId':_0x6b248['id']}})[_0x3bb5('0x34')](function(_0x2615a1){if(_0x2615a1){return[_0x2615a1,![]];}return db[_0x3bb5('0x9e')][_0x3bb5('0x56')]({'UserId':_0x546345[_0x3bb5('0x58')]['id'],'ContactId':_0x5a0b6e['id'],'WhatsappAccountId':_0x6b248['id'],'phone':_0xc575c3,'firstMsgDirection':_0x3bb5('0xb7'),'Messages':[_[_0x3bb5('0x55')](_0x546345[_0x3bb5('0x57')],{'read':![],'body':_0x546345['body'][_0x3bb5('0x57')],'phone':_0xc575c3,'WhatsappAccountId':_0x6b248['id'],'UserId':_0x546345['user']['id'],'ContactId':_0x5a0b6e['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})[_0x3bb5('0x34')](function(_0x4b7b86){return[_0x4b7b86,!![]];});});}})[_0x3bb5('0x6f')](function(_0x3ff53e,_0x320702){if(_0x320702){return _0x3ff53e;}return db[_0x3bb5('0xa4')][_0x3bb5('0x56')](_['merge'](_0x546345['body'],{'read':![],'body':_0x546345[_0x3bb5('0x57')][_0x3bb5('0x57')],'phone':_0xc575c3,'WhatsappAccountId':_0x6b248['id'],'WhatsappInteractionId':_0x3ff53e['id'],'UserId':_0x546345[_0x3bb5('0x58')]['id'],'ContactId':_0x5a0b6e['id']}))[_0x3bb5('0x34')](function(_0x3af8bb){_0x3ff53e[_0x3bb5('0xb8')][_0x3bb5('0xb9')]=[];_0x3ff53e[_0x3bb5('0xb8')][_0x3bb5('0xb9')][_0x3bb5('0xa0')](_0x3af8bb[_0x3bb5('0xb8')]);return _0x3ff53e;});})[_0x3bb5('0x34')](respondWithResult(_0x2e1f3e,null))[_0x3bb5('0x27')](handleError(_0x2e1f3e,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index ff50dfb..482549f 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 _0xb934=['hasOwnProperty','hook','events','../../mysqldb','WhatsappAccount','save','update','remove','emit'];(function(_0x5eb78d,_0x326f9b){var _0x2b827b=function(_0x5d1076){while(--_0x5d1076){_0x5eb78d['push'](_0x5eb78d['shift']());}};_0x2b827b(++_0x326f9b);}(_0xb934,0x92));var _0x4b93=function(_0x97e133,_0x4e5180){_0x97e133=_0x97e133-0x0;var _0x45dd44=_0xb934[_0x97e133];return _0x45dd44;};'use strict';var EventEmitter=require(_0x4b93('0x0'));var WhatsappAccount=require(_0x4b93('0x1'))['db'][_0x4b93('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4b93('0x3'),'afterUpdate':_0x4b93('0x4'),'afterDestroy':_0x4b93('0x5')};function emitEvent(_0x2b2930){return function(_0x17c638,_0x50c02e,_0x5e6389){WhatsappAccountEvents[_0x4b93('0x6')](_0x2b2930+':'+_0x17c638['id'],_0x17c638);WhatsappAccountEvents[_0x4b93('0x6')](_0x2b2930,_0x17c638);_0x5e6389(null);};}for(var e in events){if(events[_0x4b93('0x7')](e)){var event=events[e];WhatsappAccount[_0x4b93('0x8')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0xaa37=['../../mysqldb','WhatsappAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0xcf22a8,_0x35d51c){var _0x1137eb=function(_0x22bdf6){while(--_0x22bdf6){_0xcf22a8['push'](_0xcf22a8['shift']());}};_0x1137eb(++_0x35d51c);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xaa37[_0x279d37];return _0x530173;};'use strict';var EventEmitter=require(_0x7aa3('0x0'));var WhatsappAccount=require(_0x7aa3('0x1'))['db'][_0x7aa3('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x7aa3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7aa3('0x4'),'afterDestroy':_0x7aa3('0x5')};function emitEvent(_0x27333d){return function(_0x11e64c,_0x334919,_0x2801a2){WhatsappAccountEvents[_0x7aa3('0x6')](_0x27333d+':'+_0x11e64c['id'],_0x11e64c);WhatsappAccountEvents['emit'](_0x27333d,_0x11e64c);_0x2801a2(null);};}for(var e in events){if(events[_0x7aa3('0x7')](e)){var event=events[e];WhatsappAccount[_0x7aa3('0x8')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 734cba6..24f6518 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 _0x4de9=['util','moment','bluebird','request-promise','rimraf','exports','WhatsappAccount','whatsapp_accounts','lodash'];(function(_0x8542b4,_0x59a73f){var _0xea4fc1=function(_0x33d176){while(--_0x33d176){_0x8542b4['push'](_0x8542b4['shift']());}};_0xea4fc1(++_0x59a73f);}(_0x4de9,0x15e));var _0x94de=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x4de9[_0x710815];return _0x5b3b89;};'use strict';var _=require(_0x94de('0x0'));var util=require(_0x94de('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x94de('0x2'));var BPromise=require(_0x94de('0x3'));var rp=require(_0x94de('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x94de('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module[_0x94de('0x6')]=function(_0x5f49b6,_0x520ccd){return _0x5f49b6['define'](_0x94de('0x7'),attributes,{'tableName':_0x94de('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8de=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts'];(function(_0x1a2182,_0x461302){var _0x15d8fa=function(_0x3b6b3d){while(--_0x3b6b3d){_0x1a2182['push'](_0x1a2182['shift']());}};_0x15d8fa(++_0x461302);}(_0xb8de,0x186));var _0xeb8d=function(_0x170633,_0x1e36ef){_0x170633=_0x170633-0x0;var _0x4a31ac=_0xb8de[_0x170633];return _0x4a31ac;};'use strict';var _=require(_0xeb8d('0x0'));var util=require(_0xeb8d('0x1'));var logger=require('../../config/logger')(_0xeb8d('0x2'));var moment=require('moment');var BPromise=require(_0xeb8d('0x3'));var rp=require(_0xeb8d('0x4'));var fs=require('fs');var path=require(_0xeb8d('0x5'));var rimraf=require(_0xeb8d('0x6'));var config=require(_0xeb8d('0x7'));var attributes=require(_0xeb8d('0x8'));module[_0xeb8d('0x9')]=function(_0x75ec6c,_0x4edd04){return _0x75ec6c[_0xeb8d('0xa')](_0xeb8d('0xb'),attributes,{'tableName':_0xeb8d('0xc'),'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 0e36f8b..41122a2 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 _0x93c1=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowWhatsappAccount','find','options','raw','where','attributes','include','map','model'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x93c1,0x181));var _0x193c=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x93c1[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x193c('0x0'));var moment=require(_0x193c('0x1'));var BPromise=require(_0x193c('0x2'));var rs=require(_0x193c('0x3'));var fs=require('fs');var Redis=require(_0x193c('0x4'));var db=require(_0x193c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x193c('0x6'))(_0x193c('0x7'));var config=require(_0x193c('0x8'));var jayson=require(_0x193c('0x9'));var client=jayson[_0x193c('0xa')]['http']({'port':0x232a});config[_0x193c('0xb')]=_[_0x193c('0xc')](config['redis'],{'host':_0x193c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x27c7ca,_0x1795c5,_0x48b16b){return new BPromise(function(_0x12ca80,_0x4091af){return client[_0x193c('0xe')](_0x27c7ca,_0x48b16b)[_0x193c('0xf')](function(_0x17b37f){logger[_0x193c('0x10')](_0x193c('0x11'),_0x1795c5,_0x193c('0x12'));logger[_0x193c('0x13')](_0x193c('0x14'),_0x1795c5,'request\x20sent',JSON[_0x193c('0x15')](_0x17b37f));if(_0x17b37f[_0x193c('0x16')]){if(_0x17b37f['error']['code']===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x1795c5,_0x17b37f[_0x193c('0x16')]['message']);return _0x4091af(_0x17b37f[_0x193c('0x16')][_0x193c('0x17')]);}logger[_0x193c('0x16')](_0x193c('0x11'),_0x1795c5,_0x17b37f[_0x193c('0x16')][_0x193c('0x17')]);return _0x12ca80(_0x17b37f['error'][_0x193c('0x17')]);}else{logger[_0x193c('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x1795c5,_0x193c('0x12'));_0x12ca80(_0x17b37f[_0x193c('0x18')][_0x193c('0x17')]);}})[_0x193c('0x19')](function(_0xf76ea1){logger[_0x193c('0x16')](_0x193c('0x11'),_0x1795c5,_0xf76ea1);_0x4091af(_0xf76ea1);});});}exports[_0x193c('0x1a')]=function(_0x5eb6fc){var _0x59ee7b=this;return new Promise(function(_0xe62a56,_0x1e2ab7){return db['WhatsappAccount'][_0x193c('0x1b')]({'raw':_0x5eb6fc[_0x193c('0x1c')]?_0x5eb6fc[_0x193c('0x1c')][_0x193c('0x1d')]===undefined?!![]:![]:!![],'where':_0x5eb6fc[_0x193c('0x1c')]?_0x5eb6fc['options'][_0x193c('0x1e')]||null:null,'attributes':_0x5eb6fc['options']?_0x5eb6fc[_0x193c('0x1c')][_0x193c('0x1f')]||null:null,'include':_0x5eb6fc[_0x193c('0x1c')]?_0x5eb6fc[_0x193c('0x1c')][_0x193c('0x20')]?_[_0x193c('0x21')](_0x5eb6fc['options'][_0x193c('0x20')],function(_0x43cf2c){return{'model':db[_0x43cf2c[_0x193c('0x22')]],'as':_0x43cf2c['as'],'attributes':_0x43cf2c[_0x193c('0x1f')],'include':_0x43cf2c[_0x193c('0x20')]?_[_0x193c('0x21')](_0x43cf2c[_0x193c('0x20')],function(_0x44869b){return{'model':db[_0x44869b['model']],'as':_0x44869b['as'],'attributes':_0x44869b['attributes'],'include':_0x44869b[_0x193c('0x20')]?_[_0x193c('0x21')](_0x44869b['include'],function(_0x30dcdd){return{'model':db[_0x30dcdd['model']],'as':_0x30dcdd['as'],'attributes':_0x30dcdd[_0x193c('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11cf2a){logger[_0x193c('0x10')](_0x193c('0x1a'),_0x5eb6fc);logger[_0x193c('0x13')](_0x193c('0x1a'),_0x5eb6fc,JSON[_0x193c('0x15')](_0x11cf2a));_0xe62a56(_0x11cf2a);})[_0x193c('0x19')](function(_0x363878){logger[_0x193c('0x16')]('ShowWhatsappAccount',_0x363878['message'],_0x5eb6fc);_0x1e2ab7(_0x59ee7b[_0x193c('0x16')](0x1f4,_0x363878[_0x193c('0x17')]));});});}; \ No newline at end of file +var _0xe7a3=['client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','map','include','model','attributes','then','stringify','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xe7a3,0x1bf));var _0x3e7a=function(_0x3b7cde,_0x10540f){_0x3b7cde=_0x3b7cde-0x0;var _0x237019=_0xe7a3[_0x3b7cde];return _0x237019;};'use strict';var _=require('lodash');var util=require(_0x3e7a('0x0'));var moment=require('moment');var BPromise=require(_0x3e7a('0x1'));var rs=require(_0x3e7a('0x2'));var fs=require('fs');var Redis=require(_0x3e7a('0x3'));var db=require(_0x3e7a('0x4'))['db'];var utils=require(_0x3e7a('0x5'));var logger=require(_0x3e7a('0x6'))(_0x3e7a('0x7'));var config=require(_0x3e7a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3e7a('0x9')][_0x3e7a('0xa')]({'port':0x232a});config[_0x3e7a('0xb')]=_[_0x3e7a('0xc')](config[_0x3e7a('0xb')],{'host':_0x3e7a('0xd'),'port':0x18eb});var socket=require(_0x3e7a('0xe'))(new Redis(config[_0x3e7a('0xb')]));require(_0x3e7a('0xf'))[_0x3e7a('0x10')](socket);function respondWithRpcPromise(_0xa41db9,_0x753e89,_0x328777){return new BPromise(function(_0x301664,_0x977729){return client['request'](_0xa41db9,_0x328777)['then'](function(_0x1a39b7){logger[_0x3e7a('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x753e89,'request\x20sent');logger[_0x3e7a('0x12')](_0x3e7a('0x13'),_0x753e89,_0x3e7a('0x14'),JSON['stringify'](_0x1a39b7));if(_0x1a39b7[_0x3e7a('0x15')]){if(_0x1a39b7[_0x3e7a('0x15')][_0x3e7a('0x16')]===0x1f4){logger[_0x3e7a('0x15')](_0x3e7a('0x17'),_0x753e89,_0x1a39b7[_0x3e7a('0x15')][_0x3e7a('0x18')]);return _0x977729(_0x1a39b7['error'][_0x3e7a('0x18')]);}logger[_0x3e7a('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x753e89,_0x1a39b7[_0x3e7a('0x15')][_0x3e7a('0x18')]);return _0x301664(_0x1a39b7['error'][_0x3e7a('0x18')]);}else{logger['info'](_0x3e7a('0x17'),_0x753e89,_0x3e7a('0x14'));_0x301664(_0x1a39b7[_0x3e7a('0x19')][_0x3e7a('0x18')]);}})[_0x3e7a('0x1a')](function(_0x49889c){logger[_0x3e7a('0x15')](_0x3e7a('0x17'),_0x753e89,_0x49889c);_0x977729(_0x49889c);});});}exports[_0x3e7a('0x1b')]=function(_0x41e5a8){var _0x2d386a=this;return new Promise(function(_0x20209b,_0xed25ba){return db[_0x3e7a('0x1c')][_0x3e7a('0x1d')]({'raw':_0x41e5a8[_0x3e7a('0x1e')]?_0x41e5a8[_0x3e7a('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x41e5a8[_0x3e7a('0x1e')]?_0x41e5a8[_0x3e7a('0x1e')][_0x3e7a('0x1f')]||null:null,'attributes':_0x41e5a8[_0x3e7a('0x1e')]?_0x41e5a8[_0x3e7a('0x1e')]['attributes']||null:null,'include':_0x41e5a8[_0x3e7a('0x1e')]?_0x41e5a8[_0x3e7a('0x1e')]['include']?_[_0x3e7a('0x20')](_0x41e5a8[_0x3e7a('0x1e')][_0x3e7a('0x21')],function(_0x5796f6){return{'model':db[_0x5796f6[_0x3e7a('0x22')]],'as':_0x5796f6['as'],'attributes':_0x5796f6['attributes'],'include':_0x5796f6[_0x3e7a('0x21')]?_[_0x3e7a('0x20')](_0x5796f6['include'],function(_0x2310b3){return{'model':db[_0x2310b3[_0x3e7a('0x22')]],'as':_0x2310b3['as'],'attributes':_0x2310b3[_0x3e7a('0x23')],'include':_0x2310b3[_0x3e7a('0x21')]?_[_0x3e7a('0x20')](_0x2310b3[_0x3e7a('0x21')],function(_0x4f8ed1){return{'model':db[_0x4f8ed1[_0x3e7a('0x22')]],'as':_0x4f8ed1['as'],'attributes':_0x4f8ed1[_0x3e7a('0x23')]};}):[]};}):[]};}):[]:[]})[_0x3e7a('0x24')](function(_0x40193c){logger[_0x3e7a('0x11')](_0x3e7a('0x1b'),_0x41e5a8);logger[_0x3e7a('0x12')](_0x3e7a('0x1b'),_0x41e5a8,JSON[_0x3e7a('0x25')](_0x40193c));_0x20209b(_0x40193c);})[_0x3e7a('0x1a')](function(_0x5229b2){logger[_0x3e7a('0x15')](_0x3e7a('0x1b'),_0x5229b2[_0x3e7a('0x18')],_0x41e5a8);_0xed25ba(_0x2d386a[_0x3e7a('0x15')](0x1f4,_0x5229b2[_0x3e7a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 63543a2..5c84a2a 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 _0x0f1e=['length','./whatsappAccount.events','emit','removeListener','register'];(function(_0x4475a8,_0x51d1f4){var _0x4cc5b2=function(_0x1fd375){while(--_0x1fd375){_0x4475a8['push'](_0x4475a8['shift']());}};_0x4cc5b2(++_0x51d1f4);}(_0x0f1e,0x1dc));var _0xe0f1=function(_0x538ae7,_0x2defb1){_0x538ae7=_0x538ae7-0x0;var _0x70f194=_0x0f1e[_0x538ae7];return _0x70f194;};'use strict';var WhatsappAccountEvents=require(_0xe0f1('0x0'));var events=['save','remove','update'];function createListener(_0x330482,_0x196dc5){return function(_0x4bfa23){_0x196dc5[_0xe0f1('0x1')](_0x330482,_0x4bfa23);};}function removeListener(_0xeb99f3,_0x21bccf){return function(){WhatsappAccountEvents[_0xe0f1('0x2')](_0xeb99f3,_0x21bccf);};}exports[_0xe0f1('0x3')]=function(_0x8f0576){for(var _0x35d8ec=0x0,_0x1bdfbb=events[_0xe0f1('0x4')];_0x35d8ec<_0x1bdfbb;_0x35d8ec++){var _0x54dcbe=events[_0x35d8ec];var _0x3cc936=createListener('whatsappAccount:'+_0x54dcbe,_0x8f0576);WhatsappAccountEvents['on'](_0x54dcbe,_0x3cc936);}}; \ No newline at end of file +var _0x952a=['whatsappAccount:','./whatsappAccount.events','save','update','emit','removeListener','register','length'];(function(_0x1c5117,_0x23df29){var _0xcd4108=function(_0x3f2030){while(--_0x3f2030){_0x1c5117['push'](_0x1c5117['shift']());}};_0xcd4108(++_0x23df29);}(_0x952a,0xe9));var _0xa952=function(_0x4528fa,_0x1dec7e){_0x4528fa=_0x4528fa-0x0;var _0xc3a18c=_0x952a[_0x4528fa];return _0xc3a18c;};'use strict';var WhatsappAccountEvents=require(_0xa952('0x0'));var events=[_0xa952('0x1'),'remove',_0xa952('0x2')];function createListener(_0x1515a4,_0x5a64e9){return function(_0x46815a){_0x5a64e9[_0xa952('0x3')](_0x1515a4,_0x46815a);};}function removeListener(_0x5b69a9,_0x22bbc5){return function(){WhatsappAccountEvents[_0xa952('0x4')](_0x5b69a9,_0x22bbc5);};}exports[_0xa952('0x5')]=function(_0x28177c){for(var _0x72aea8=0x0,_0x114809=events[_0xa952('0x6')];_0x72aea8<_0x114809;_0x72aea8++){var _0x2c7ce0=events[_0x72aea8];var _0x1fd5fe=createListener(_0xa952('0x7')+_0x2c7ce0,_0x28177c);WhatsappAccountEvents['on'](_0x2c7ce0,_0x1fd5fe);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 138ab04..56c7bf4 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 _0x12fe=['../../config/environment','./whatsappApplication.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy','multer','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x12fe,0x1b5));var _0xe12f=function(_0x4c48f4,_0x5885ae){_0x4c48f4=_0x4c48f4-0x0;var _0x303490=_0x12fe[_0x4c48f4];return _0x303490;};'use strict';var multer=require(_0xe12f('0x0'));var util=require('util');var path=require(_0xe12f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe12f('0x2')]();var auth=require(_0xe12f('0x3'));var interaction=require(_0xe12f('0x4'));var config=require(_0xe12f('0x5'));var controller=require(_0xe12f('0x6'));router['get']('/',auth[_0xe12f('0x7')](),controller[_0xe12f('0x8')]);router[_0xe12f('0x9')](_0xe12f('0xa'),auth['isAuthenticated'](),controller[_0xe12f('0xb')]);router['post']('/',auth[_0xe12f('0x7')](),controller[_0xe12f('0xc')]);router[_0xe12f('0xd')](_0xe12f('0xa'),auth[_0xe12f('0x7')](),controller[_0xe12f('0xe')]);router[_0xe12f('0xf')](_0xe12f('0xa'),auth['isAuthenticated'](),controller[_0xe12f('0x10')]);module['exports']=router; \ No newline at end of file +var _0xa679=['delete','/:id','destroy','multer','path','express','../../components/auth/service','../../config/environment','./whatsappApplication.controller','get','index','isAuthenticated','show','post','create','put','update'];(function(_0x2b4c7f,_0xd3a731){var _0xaa17cd=function(_0x516f23){while(--_0x516f23){_0x2b4c7f['push'](_0x2b4c7f['shift']());}};_0xaa17cd(++_0xd3a731);}(_0xa679,0x124));var _0x9a67=function(_0x224532,_0x440273){_0x224532=_0x224532-0x0;var _0x3a6b95=_0xa679[_0x224532];return _0x3a6b95;};'use strict';var multer=require(_0x9a67('0x0'));var util=require('util');var path=require(_0x9a67('0x1'));var timeout=require('connect-timeout');var express=require(_0x9a67('0x2'));var router=express['Router']();var auth=require(_0x9a67('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9a67('0x4'));var controller=require(_0x9a67('0x5'));router[_0x9a67('0x6')]('/',auth['isAuthenticated'](),controller[_0x9a67('0x7')]);router[_0x9a67('0x6')]('/:id',auth[_0x9a67('0x8')](),controller[_0x9a67('0x9')]);router[_0x9a67('0xa')]('/',auth['isAuthenticated'](),controller[_0x9a67('0xb')]);router[_0x9a67('0xc')]('/:id',auth[_0x9a67('0x8')](),controller[_0x9a67('0xd')]);router[_0x9a67('0xe')](_0x9a67('0xf'),auth[_0x9a67('0x8')](),controller[_0x9a67('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 76c4b7c..cf53d25 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 _0xdf48=['STRING','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x49f384,_0x354853){var _0x1acaac=function(_0x56a7b1){while(--_0x56a7b1){_0x49f384['push'](_0x49f384['shift']());}};_0x1acaac(++_0x354853);}(_0xdf48,0x75));var _0x8df4=function(_0x46e15f,_0x551aec){_0x46e15f=_0x46e15f-0x0;var _0x522f15=_0xdf48[_0x46e15f];return _0x522f15;};'use strict';var Sequelize=require(_0x8df4('0x0'));module[_0x8df4('0x1')]={'priority':{'type':Sequelize[_0x8df4('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8df4('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x8df4('0x4')]()},'description':{'type':Sequelize[_0x8df4('0x3')]},'interval':{'type':Sequelize[_0x8df4('0x3')],'defaultValue':_0x8df4('0x5')}}; \ No newline at end of file +var _0xd8e9=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x67a906,_0x4d9da8){var _0x286f95=function(_0x2b2fd6){while(--_0x2b2fd6){_0x67a906['push'](_0x67a906['shift']());}};_0x286f95(++_0x4d9da8);}(_0xd8e9,0x1a2));var _0x9d8e=function(_0x373421,_0x7db219){_0x373421=_0x373421-0x0;var _0x2b2e26=_0xd8e9[_0x373421];return _0x2b2e26;};'use strict';var Sequelize=require(_0x9d8e('0x0'));module[_0x9d8e('0x1')]={'priority':{'type':Sequelize[_0x9d8e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9d8e('0x3')],'allowNull':![],'defaultValue':_0x9d8e('0x4')},'appdata':{'type':Sequelize[_0x9d8e('0x5')]()},'description':{'type':Sequelize[_0x9d8e('0x3')]},'interval':{'type':Sequelize[_0x9d8e('0x3')],'defaultValue':_0x9d8e('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index aeb57de..0931021 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 _0x51f2=['attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','keys','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','WhatsappApplication','rawAttributes','type','key','model','query','filters','intersection'];(function(_0x804eb7,_0x4833e2){var _0x2810b1=function(_0x1ea012){while(--_0x1ea012){_0x804eb7['push'](_0x804eb7['shift']());}};_0x2810b1(++_0x4833e2);}(_0x51f2,0x130));var _0x251f=function(_0x3ae9a0,_0x5e87d6){_0x3ae9a0=_0x3ae9a0-0x0;var _0x58bd36=_0x51f2[_0x3ae9a0];return _0x58bd36;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x251f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x251f('0x1'));var jsonpatch=require(_0x251f('0x2'));var rp=require(_0x251f('0x3'));var moment=require(_0x251f('0x4'));var BPromise=require(_0x251f('0x5'));var Mustache=require('mustache');var util=require(_0x251f('0x6'));var path=require(_0x251f('0x7'));var sox=require(_0x251f('0x8'));var csv=require(_0x251f('0x9'));var ejs=require(_0x251f('0xa'));var fs=require('fs');var _=require(_0x251f('0xb'));var squel=require(_0x251f('0xc'));var crypto=require(_0x251f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x251f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x251f('0xf'));var Papa=require(_0x251f('0x10'));var Redis=require(_0x251f('0x11'));var authService=require(_0x251f('0x12'));var qs=require(_0x251f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x251f('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x251f('0x15'));var config=require(_0x251f('0x16'));var db=require(_0x251f('0x17'))['db'];function respondWithStatusCode(_0x1d44aa,_0x4dc2f1){_0x4dc2f1=_0x4dc2f1||0xcc;return function(_0x447cbc){if(_0x447cbc){return _0x1d44aa[_0x251f('0x18')](_0x4dc2f1);}return _0x1d44aa[_0x251f('0x19')](_0x4dc2f1)[_0x251f('0x1a')]();};}function respondWithResult(_0x216dd7,_0x53bf99){_0x53bf99=_0x53bf99||0xc8;return function(_0x2b27af){if(_0x2b27af){return _0x216dd7['status'](_0x53bf99)[_0x251f('0x1b')](_0x2b27af);}};}function respondWithFilteredResult(_0x5bc2a7,_0x4af0de){return function(_0x391b86){if(_0x391b86){var _0x10eff8=_0x391b86[_0x251f('0x1c')],_0x3a6573=_0x4af0de[_0x251f('0x1d')],_0x34d16e=_0x4af0de['offset']+_0x4af0de[_0x251f('0x1e')],_0x468f4a;if(_0x34d16e>=_0x10eff8){_0x34d16e=_0x10eff8;_0x468f4a=0xc8;}else{_0x468f4a=0xce;}_0x5bc2a7[_0x251f('0x19')](_0x468f4a);return _0x5bc2a7[_0x251f('0x1f')](_0x251f('0x20'),_0x3a6573+'-'+_0x34d16e+'/'+_0x10eff8)[_0x251f('0x1b')](_0x391b86);}return null;};}function patchUpdates(_0x5a2857){return function(_0x150443){try{jsonpatch[_0x251f('0x21')](_0x150443,_0x5a2857,!![]);}catch(_0x4c3fb1){return BPromise[_0x251f('0x22')](_0x4c3fb1);}return _0x150443[_0x251f('0x23')]();};}function saveUpdates(_0x57f79f,_0x433014){return function(_0x5c78c6){if(_0x5c78c6){return _0x5c78c6[_0x251f('0x24')](_0x57f79f)[_0x251f('0x25')](function(_0x4e527c){return _0x4e527c;});}return null;};}function removeEntity(_0x31e8c6,_0x1ddc10){return function(_0xe5c984){if(_0xe5c984){return _0xe5c984[_0x251f('0x26')]()[_0x251f('0x25')](function(){_0x31e8c6[_0x251f('0x19')](0xcc)[_0x251f('0x1a')]();});}};}function handleEntityNotFound(_0x5ee8e9,_0x561ecb){return function(_0x5ea26b){if(!_0x5ea26b){_0x5ee8e9['sendStatus'](0x194);}return _0x5ea26b;};}function handleError(_0x1221b1,_0x36d241){_0x36d241=_0x36d241||0x1f4;return function(_0xb0a7b6){logger[_0x251f('0x27')](_0xb0a7b6[_0x251f('0x28')]);if(_0xb0a7b6[_0x251f('0x29')]){delete _0xb0a7b6[_0x251f('0x29')];}_0x1221b1[_0x251f('0x19')](_0x36d241)['send'](_0xb0a7b6);};}exports['index']=function(_0x16e1b6,_0x417ebb){var _0x16f1a9={},_0x4de712={},_0x41b448={'count':0x0,'rows':[]};var _0x28d6c1=_[_0x251f('0x2a')](db[_0x251f('0x2b')][_0x251f('0x2c')],function(_0x5581a3){return{'name':_0x5581a3['fieldName'],'type':_0x5581a3[_0x251f('0x2d')][_0x251f('0x2e')]};});_0x4de712[_0x251f('0x2f')]=_['map'](_0x28d6c1,_0x251f('0x29'));_0x4de712[_0x251f('0x30')]=_['keys'](_0x16e1b6[_0x251f('0x30')]);_0x4de712[_0x251f('0x31')]=_[_0x251f('0x32')](_0x4de712['model'],_0x4de712[_0x251f('0x30')]);_0x16f1a9[_0x251f('0x33')]=_[_0x251f('0x32')](_0x4de712[_0x251f('0x2f')],qs[_0x251f('0x34')](_0x16e1b6['query'][_0x251f('0x34')]));_0x16f1a9[_0x251f('0x33')]=_0x16f1a9[_0x251f('0x33')]['length']?_0x16f1a9[_0x251f('0x33')]:_0x4de712['model'];if(!_0x16e1b6[_0x251f('0x30')][_0x251f('0x35')]('nolimit')){_0x16f1a9[_0x251f('0x1e')]=qs[_0x251f('0x1e')](_0x16e1b6[_0x251f('0x30')][_0x251f('0x1e')]);_0x16f1a9[_0x251f('0x1d')]=qs[_0x251f('0x1d')](_0x16e1b6[_0x251f('0x30')][_0x251f('0x1d')]);}_0x16f1a9[_0x251f('0x36')]=qs[_0x251f('0x37')](_0x16e1b6[_0x251f('0x30')][_0x251f('0x37')]);_0x16f1a9[_0x251f('0x38')]=qs[_0x251f('0x31')](_[_0x251f('0x39')](_0x16e1b6['query'],_0x4de712[_0x251f('0x31')]),_0x28d6c1);if(_0x16e1b6[_0x251f('0x30')][_0x251f('0x3a')]){_0x16f1a9[_0x251f('0x38')]=_['merge'](_0x16f1a9[_0x251f('0x38')],{'$or':_[_0x251f('0x2a')](_0x28d6c1,function(_0x4c93d3){if(_0x4c93d3['type']!==_0x251f('0x3b')){var _0x5bf157={};_0x5bf157[_0x4c93d3[_0x251f('0x29')]]={'$like':'%'+_0x16e1b6[_0x251f('0x30')][_0x251f('0x3a')]+'%'};return _0x5bf157;}})});}_0x16f1a9=_[_0x251f('0x3c')]({},_0x16f1a9,_0x16e1b6[_0x251f('0x3d')]);var _0x4cb737={'where':_0x16f1a9['where']};return db[_0x251f('0x2b')][_0x251f('0x1c')](_0x4cb737)[_0x251f('0x25')](function(_0x2b0884){_0x41b448[_0x251f('0x1c')]=_0x2b0884;if(_0x16e1b6[_0x251f('0x30')][_0x251f('0x3e')]){_0x16f1a9[_0x251f('0x3f')]=[{'all':!![]}];}return db[_0x251f('0x2b')]['findAll'](_0x16f1a9);})[_0x251f('0x25')](function(_0x1da952){_0x41b448[_0x251f('0x40')]=_0x1da952;return _0x41b448;})[_0x251f('0x25')](respondWithFilteredResult(_0x417ebb,_0x16f1a9))[_0x251f('0x41')](handleError(_0x417ebb,null));};exports['show']=function(_0x13a7ed,_0x451b60){var _0x5dc686={'raw':!![],'where':{'id':_0x13a7ed[_0x251f('0x42')]['id']}},_0x8f8df4={};_0x8f8df4[_0x251f('0x2f')]=_[_0x251f('0x43')](db[_0x251f('0x2b')][_0x251f('0x2c')]);_0x8f8df4['query']=_[_0x251f('0x43')](_0x13a7ed[_0x251f('0x30')]);_0x8f8df4['filters']=_[_0x251f('0x32')](_0x8f8df4['model'],_0x8f8df4[_0x251f('0x30')]);_0x5dc686[_0x251f('0x33')]=_[_0x251f('0x32')](_0x8f8df4['model'],qs['fields'](_0x13a7ed[_0x251f('0x30')][_0x251f('0x34')]));_0x5dc686['attributes']=_0x5dc686[_0x251f('0x33')]['length']?_0x5dc686['attributes']:_0x8f8df4[_0x251f('0x2f')];if(_0x13a7ed['query'][_0x251f('0x3e')]){_0x5dc686[_0x251f('0x3f')]=[{'all':!![]}];}_0x5dc686=_[_0x251f('0x3c')]({},_0x5dc686,_0x13a7ed[_0x251f('0x3d')]);return db[_0x251f('0x2b')][_0x251f('0x44')](_0x5dc686)[_0x251f('0x25')](handleEntityNotFound(_0x451b60,null))[_0x251f('0x25')](respondWithResult(_0x451b60,null))['catch'](handleError(_0x451b60,null));};exports[_0x251f('0x45')]=function(_0x309b5b,_0x1590bc){return db[_0x251f('0x2b')][_0x251f('0x45')](_0x309b5b[_0x251f('0x46')],{})['then'](respondWithResult(_0x1590bc,0xc9))[_0x251f('0x41')](handleError(_0x1590bc,null));};exports[_0x251f('0x24')]=function(_0x3c2d37,_0x153d5d){if(_0x3c2d37[_0x251f('0x46')]['id']){delete _0x3c2d37[_0x251f('0x46')]['id'];}return db['WhatsappApplication'][_0x251f('0x44')]({'where':{'id':_0x3c2d37['params']['id']}})[_0x251f('0x25')](handleEntityNotFound(_0x153d5d,null))[_0x251f('0x25')](saveUpdates(_0x3c2d37['body'],null))['then'](respondWithResult(_0x153d5d,null))[_0x251f('0x41')](handleError(_0x153d5d,null));};exports[_0x251f('0x26')]=function(_0x4a9faa,_0x81e838){return db['WhatsappApplication']['find']({'where':{'id':_0x4a9faa['params']['id']}})[_0x251f('0x25')](handleEntityNotFound(_0x81e838,null))['then'](removeEntity(_0x81e838,null))[_0x251f('0x41')](handleError(_0x81e838,null));}; \ No newline at end of file +var _0xde48=['set','Content-Range','json','reject','update','then','destroy','end','error','stack','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','length','find','catch','create','body','params','html-pdf','eml-format','fast-json-patch','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit'];(function(_0x1e92b7,_0x741298){var _0x5a80aa=function(_0x412976){while(--_0x412976){_0x1e92b7['push'](_0x1e92b7['shift']());}};_0x5a80aa(++_0x741298);}(_0xde48,0xfb));var _0x8de4=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xde48[_0x4fc9e6];return _0x551d28;};'use strict';var pdf=require(_0x8de4('0x0'));var emlformat=require(_0x8de4('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8de4('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8de4('0x3'));var util=require(_0x8de4('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x8de4('0x5'));var ejs=require(_0x8de4('0x6'));var fs=require('fs');var _=require(_0x8de4('0x7'));var squel=require('squel');var crypto=require(_0x8de4('0x8'));var jsforce=require(_0x8de4('0x9'));var deskjs=require(_0x8de4('0xa'));var toCsv=require('to-csv');var querystring=require(_0x8de4('0xb'));var Papa=require('papaparse');var Redis=require(_0x8de4('0xc'));var authService=require(_0x8de4('0xd'));var qs=require(_0x8de4('0xe'));var as=require(_0x8de4('0xf'));var hardwareService=require(_0x8de4('0x10'));var logger=require(_0x8de4('0x11'))('api');var utils=require(_0x8de4('0x12'));var config=require('../../config/environment');var db=require(_0x8de4('0x13'))['db'];function respondWithStatusCode(_0x34f0ef,_0x514cb8){_0x514cb8=_0x514cb8||0xcc;return function(_0x50e5a8){if(_0x50e5a8){return _0x34f0ef[_0x8de4('0x14')](_0x514cb8);}return _0x34f0ef[_0x8de4('0x15')](_0x514cb8)['end']();};}function respondWithResult(_0x1510f7,_0x854c7e){_0x854c7e=_0x854c7e||0xc8;return function(_0xacbdf5){if(_0xacbdf5){return _0x1510f7[_0x8de4('0x15')](_0x854c7e)['json'](_0xacbdf5);}};}function respondWithFilteredResult(_0x5b8661,_0x7239a4){return function(_0x9e9520){if(_0x9e9520){var _0x433151=_0x9e9520[_0x8de4('0x16')],_0x324c0d=_0x7239a4[_0x8de4('0x17')],_0x2c0dfd=_0x7239a4[_0x8de4('0x17')]+_0x7239a4[_0x8de4('0x18')],_0x1bb269;if(_0x2c0dfd>=_0x433151){_0x2c0dfd=_0x433151;_0x1bb269=0xc8;}else{_0x1bb269=0xce;}_0x5b8661[_0x8de4('0x15')](_0x1bb269);return _0x5b8661[_0x8de4('0x19')](_0x8de4('0x1a'),_0x324c0d+'-'+_0x2c0dfd+'/'+_0x433151)[_0x8de4('0x1b')](_0x9e9520);}return null;};}function patchUpdates(_0x4a689d){return function(_0x1a7ef4){try{jsonpatch['apply'](_0x1a7ef4,_0x4a689d,!![]);}catch(_0x519b57){return BPromise[_0x8de4('0x1c')](_0x519b57);}return _0x1a7ef4['save']();};}function saveUpdates(_0x6a0cd4,_0x43fab3){return function(_0x40329a){if(_0x40329a){return _0x40329a[_0x8de4('0x1d')](_0x6a0cd4)[_0x8de4('0x1e')](function(_0x398f27){return _0x398f27;});}return null;};}function removeEntity(_0x42ecbb,_0x1a23c8){return function(_0x236cf3){if(_0x236cf3){return _0x236cf3[_0x8de4('0x1f')]()[_0x8de4('0x1e')](function(){_0x42ecbb[_0x8de4('0x15')](0xcc)[_0x8de4('0x20')]();});}};}function handleEntityNotFound(_0x2c6108,_0x23a886){return function(_0x28fc37){if(!_0x28fc37){_0x2c6108[_0x8de4('0x14')](0x194);}return _0x28fc37;};}function handleError(_0x503711,_0x7117ac){_0x7117ac=_0x7117ac||0x1f4;return function(_0x251ec5){logger[_0x8de4('0x21')](_0x251ec5[_0x8de4('0x22')]);if(_0x251ec5['name']){delete _0x251ec5['name'];}_0x503711[_0x8de4('0x15')](_0x7117ac)[_0x8de4('0x23')](_0x251ec5);};}exports[_0x8de4('0x24')]=function(_0x520b43,_0x2c10c1){var _0x3212c4={},_0x543636={},_0x502d3e={'count':0x0,'rows':[]};var _0x342ebb=_[_0x8de4('0x25')](db[_0x8de4('0x26')][_0x8de4('0x27')],function(_0x14e000){return{'name':_0x14e000[_0x8de4('0x28')],'type':_0x14e000[_0x8de4('0x29')][_0x8de4('0x2a')]};});_0x543636[_0x8de4('0x2b')]=_[_0x8de4('0x25')](_0x342ebb,_0x8de4('0x2c'));_0x543636[_0x8de4('0x2d')]=_[_0x8de4('0x2e')](_0x520b43['query']);_0x543636[_0x8de4('0x2f')]=_['intersection'](_0x543636[_0x8de4('0x2b')],_0x543636['query']);_0x3212c4[_0x8de4('0x30')]=_[_0x8de4('0x31')](_0x543636[_0x8de4('0x2b')],qs[_0x8de4('0x32')](_0x520b43[_0x8de4('0x2d')]['fields']));_0x3212c4[_0x8de4('0x30')]=_0x3212c4['attributes']['length']?_0x3212c4[_0x8de4('0x30')]:_0x543636[_0x8de4('0x2b')];if(!_0x520b43[_0x8de4('0x2d')][_0x8de4('0x33')](_0x8de4('0x34'))){_0x3212c4['limit']=qs['limit'](_0x520b43[_0x8de4('0x2d')]['limit']);_0x3212c4[_0x8de4('0x17')]=qs[_0x8de4('0x17')](_0x520b43[_0x8de4('0x2d')]['offset']);}_0x3212c4['order']=qs[_0x8de4('0x35')](_0x520b43['query'][_0x8de4('0x35')]);_0x3212c4[_0x8de4('0x36')]=qs[_0x8de4('0x2f')](_['pick'](_0x520b43[_0x8de4('0x2d')],_0x543636[_0x8de4('0x2f')]),_0x342ebb);if(_0x520b43[_0x8de4('0x2d')][_0x8de4('0x37')]){_0x3212c4['where']=_[_0x8de4('0x38')](_0x3212c4[_0x8de4('0x36')],{'$or':_[_0x8de4('0x25')](_0x342ebb,function(_0xe39652){if(_0xe39652[_0x8de4('0x29')]!==_0x8de4('0x39')){var _0x6803df={};_0x6803df[_0xe39652[_0x8de4('0x2c')]]={'$like':'%'+_0x520b43[_0x8de4('0x2d')]['filter']+'%'};return _0x6803df;}})});}_0x3212c4=_[_0x8de4('0x38')]({},_0x3212c4,_0x520b43[_0x8de4('0x3a')]);var _0x179a0b={'where':_0x3212c4['where']};return db['WhatsappApplication'][_0x8de4('0x16')](_0x179a0b)[_0x8de4('0x1e')](function(_0x42fadf){_0x502d3e['count']=_0x42fadf;if(_0x520b43[_0x8de4('0x2d')][_0x8de4('0x3b')]){_0x3212c4[_0x8de4('0x3c')]=[{'all':!![]}];}return db[_0x8de4('0x26')][_0x8de4('0x3d')](_0x3212c4);})[_0x8de4('0x1e')](function(_0x47dce7){_0x502d3e['rows']=_0x47dce7;return _0x502d3e;})['then'](respondWithFilteredResult(_0x2c10c1,_0x3212c4))['catch'](handleError(_0x2c10c1,null));};exports[_0x8de4('0x3e')]=function(_0x38b7de,_0x597e0a){var _0x23002f={'raw':!![],'where':{'id':_0x38b7de['params']['id']}},_0xd10683={};_0xd10683[_0x8de4('0x2b')]=_['keys'](db[_0x8de4('0x26')][_0x8de4('0x27')]);_0xd10683[_0x8de4('0x2d')]=_[_0x8de4('0x2e')](_0x38b7de['query']);_0xd10683[_0x8de4('0x2f')]=_[_0x8de4('0x31')](_0xd10683[_0x8de4('0x2b')],_0xd10683[_0x8de4('0x2d')]);_0x23002f[_0x8de4('0x30')]=_['intersection'](_0xd10683[_0x8de4('0x2b')],qs[_0x8de4('0x32')](_0x38b7de[_0x8de4('0x2d')][_0x8de4('0x32')]));_0x23002f['attributes']=_0x23002f[_0x8de4('0x30')][_0x8de4('0x3f')]?_0x23002f[_0x8de4('0x30')]:_0xd10683['model'];if(_0x38b7de[_0x8de4('0x2d')]['includeAll']){_0x23002f['include']=[{'all':!![]}];}_0x23002f=_[_0x8de4('0x38')]({},_0x23002f,_0x38b7de[_0x8de4('0x3a')]);return db[_0x8de4('0x26')][_0x8de4('0x40')](_0x23002f)[_0x8de4('0x1e')](handleEntityNotFound(_0x597e0a,null))[_0x8de4('0x1e')](respondWithResult(_0x597e0a,null))[_0x8de4('0x41')](handleError(_0x597e0a,null));};exports[_0x8de4('0x42')]=function(_0x2004ec,_0x1de198){return db[_0x8de4('0x26')][_0x8de4('0x42')](_0x2004ec[_0x8de4('0x43')],{})[_0x8de4('0x1e')](respondWithResult(_0x1de198,0xc9))[_0x8de4('0x41')](handleError(_0x1de198,null));};exports['update']=function(_0x25de54,_0x3adc7d){if(_0x25de54['body']['id']){delete _0x25de54[_0x8de4('0x43')]['id'];}return db[_0x8de4('0x26')][_0x8de4('0x40')]({'where':{'id':_0x25de54['params']['id']}})[_0x8de4('0x1e')](handleEntityNotFound(_0x3adc7d,null))['then'](saveUpdates(_0x25de54[_0x8de4('0x43')],null))[_0x8de4('0x1e')](respondWithResult(_0x3adc7d,null))[_0x8de4('0x41')](handleError(_0x3adc7d,null));};exports['destroy']=function(_0x53e960,_0x40f3ff){return db['WhatsappApplication'][_0x8de4('0x40')]({'where':{'id':_0x53e960[_0x8de4('0x44')]['id']}})[_0x8de4('0x1e')](handleEntityNotFound(_0x40f3ff,null))[_0x8de4('0x1e')](removeEntity(_0x40f3ff,null))['catch'](handleError(_0x40f3ff,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 4d02e58..0c8d408 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 _0x0565=['exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xee2163,_0x45c470){var _0x3e3ba3=function(_0x1f0a9c){while(--_0x1f0a9c){_0xee2163['push'](_0xee2163['shift']());}};_0x3e3ba3(++_0x45c470);}(_0x0565,0xf2));var _0x5056=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x0565[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0x5056('0x0'));var util=require(_0x5056('0x1'));var logger=require(_0x5056('0x2'))(_0x5056('0x3'));var moment=require(_0x5056('0x4'));var BPromise=require(_0x5056('0x5'));var rp=require(_0x5056('0x6'));var fs=require('fs');var path=require(_0x5056('0x7'));var rimraf=require(_0x5056('0x8'));var config=require(_0x5056('0x9'));var attributes=require('./whatsappApplication.attributes');module[_0x5056('0xa')]=function(_0x105ea8,_0x1143df){return _0x105ea8[_0x5056('0xb')]('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5056('0xc'),'collate':_0x5056('0xd')});}; \ No newline at end of file +var _0x05e3=['WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x2196a0,_0x2e7f7b){var _0x24025a=function(_0x49aae2){while(--_0x49aae2){_0x2196a0['push'](_0x2196a0['shift']());}};_0x24025a(++_0x2e7f7b);}(_0x05e3,0x86));var _0x305e=function(_0x34967e,_0x11f483){_0x34967e=_0x34967e-0x0;var _0x406971=_0x05e3[_0x34967e];return _0x406971;};'use strict';var _=require(_0x305e('0x0'));var util=require(_0x305e('0x1'));var logger=require(_0x305e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x305e('0x3'));var rp=require(_0x305e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x305e('0x5'));var config=require(_0x305e('0x6'));var attributes=require('./whatsappApplication.attributes');module[_0x305e('0x7')]=function(_0x404744,_0xfadd27){return _0x404744[_0x305e('0x8')](_0x305e('0x9'),attributes,{'tableName':_0x305e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x305e('0xb'),'collate':_0x305e('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 1454e58..89d1f69 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 _0xc1c6=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch'];(function(_0x31f9be,_0x11e505){var _0x19e7cd=function(_0x3f8af5){while(--_0x3f8af5){_0x31f9be['push'](_0x31f9be['shift']());}};_0x19e7cd(++_0x11e505);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x46a0bf,_0x52e7ed){_0x46a0bf=_0x46a0bf-0x0;var _0x40e456=_0xc1c6[_0x46a0bf];return _0x40e456;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var moment=require(_0x6c1c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c1c('0x4'))['db'];var utils=require(_0x6c1c('0x5'));var logger=require(_0x6c1c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c1c('0x7'));var client=jayson['client'][_0x6c1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x582bec,_0xe510ca,_0x2eb1ba){return new BPromise(function(_0x38369d,_0x2cec58){return client['request'](_0x582bec,_0x2eb1ba)[_0x6c1c('0x9')](function(_0x3ca985){logger['info'](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));logger[_0x6c1c('0xc')](_0x6c1c('0xd'),_0xe510ca,'request\x20sent',JSON[_0x6c1c('0xe')](_0x3ca985));if(_0x3ca985[_0x6c1c('0xf')]){if(_0x3ca985[_0x6c1c('0xf')]['code']===0x1f4){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')]['message']);return _0x2cec58(_0x3ca985[_0x6c1c('0xf')]['message']);}logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);return _0x38369d(_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);}else{logger[_0x6c1c('0x11')](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));_0x38369d(_0x3ca985['result'][_0x6c1c('0x10')]);}})[_0x6c1c('0x12')](function(_0x5214ee){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x5214ee);_0x2cec58(_0x5214ee);});});} \ No newline at end of file +var _0xbd10=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis'];(function(_0x5e6b10,_0x109d89){var _0x3a92d3=function(_0x1cd9c6){while(--_0x1cd9c6){_0x5e6b10['push'](_0x5e6b10['shift']());}};_0x3a92d3(++_0x109d89);}(_0xbd10,0x85));var _0x0bd1=function(_0x4ecce1,_0x5717e9){_0x4ecce1=_0x4ecce1-0x0;var _0x229117=_0xbd10[_0x4ecce1];return _0x229117;};'use strict';var _=require(_0x0bd1('0x0'));var util=require(_0x0bd1('0x1'));var moment=require(_0x0bd1('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bd1('0x3'));var fs=require('fs');var Redis=require(_0x0bd1('0x4'));var db=require(_0x0bd1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0bd1('0x6'))(_0x0bd1('0x7'));var config=require(_0x0bd1('0x8'));var jayson=require(_0x0bd1('0x9'));var client=jayson[_0x0bd1('0xa')][_0x0bd1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c129c,_0x143a85,_0x4dbb43){return new BPromise(function(_0x639350,_0x32a37b){return client[_0x0bd1('0xc')](_0x4c129c,_0x4dbb43)[_0x0bd1('0xd')](function(_0x540a32){logger[_0x0bd1('0xe')](_0x0bd1('0xf'),_0x143a85,_0x0bd1('0x10'));logger[_0x0bd1('0x11')](_0x0bd1('0x12'),_0x143a85,_0x0bd1('0x10'),JSON['stringify'](_0x540a32));if(_0x540a32[_0x0bd1('0x13')]){if(_0x540a32[_0x0bd1('0x13')][_0x0bd1('0x14')]===0x1f4){logger[_0x0bd1('0x13')](_0x0bd1('0xf'),_0x143a85,_0x540a32[_0x0bd1('0x13')]['message']);return _0x32a37b(_0x540a32[_0x0bd1('0x13')][_0x0bd1('0x15')]);}logger[_0x0bd1('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x143a85,_0x540a32['error'][_0x0bd1('0x15')]);return _0x639350(_0x540a32[_0x0bd1('0x13')][_0x0bd1('0x15')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x143a85,_0x0bd1('0x10'));_0x639350(_0x540a32[_0x0bd1('0x16')][_0x0bd1('0x15')]);}})['catch'](function(_0x1876fb){logger[_0x0bd1('0x13')](_0x0bd1('0xf'),_0x143a85,_0x1876fb);_0x32a37b(_0x1876fb);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index e1d927a..dd6b355 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 _0x6071=['tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','delete','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags'];(function(_0x347966,_0x5b4df0){var _0xf1c8cc=function(_0x484f3e){while(--_0x484f3e){_0x347966['push'](_0x347966['shift']());}};_0xf1c8cc(++_0x5b4df0);}(_0x6071,0x10e));var _0x1607=function(_0x4b11a8,_0x3e9d1f){_0x4b11a8=_0x4b11a8-0x0;var _0x115e6d=_0x6071[_0x4b11a8];return _0x115e6d;};'use strict';var multer=require(_0x1607('0x0'));var util=require('util');var path=require(_0x1607('0x1'));var timeout=require(_0x1607('0x2'));var express=require(_0x1607('0x3'));var router=express[_0x1607('0x4')]();var auth=require(_0x1607('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router['get']('/',auth[_0x1607('0x6')](),controller[_0x1607('0x7')]);router[_0x1607('0x8')](_0x1607('0x9'),auth[_0x1607('0x6')](),controller[_0x1607('0xa')]);router[_0x1607('0x8')](_0x1607('0xb'),auth[_0x1607('0x6')](),controller[_0x1607('0xc')]);router[_0x1607('0x8')](_0x1607('0xd'),auth[_0x1607('0x6')](),controller[_0x1607('0xe')]);router[_0x1607('0x8')](_0x1607('0xf'),auth[_0x1607('0x6')](),controller['download']);router[_0x1607('0x10')]('/',auth[_0x1607('0x6')](),controller[_0x1607('0x11')]);router[_0x1607('0x10')](_0x1607('0xd'),auth['isAuthenticated'](),controller[_0x1607('0x12')]);router[_0x1607('0x10')](_0x1607('0x13'),auth[_0x1607('0x6')](),interaction[_0x1607('0x14')](_0x1607('0x15'),_0x1607('0x16')),controller[_0x1607('0x17')]);router[_0x1607('0x18')](_0x1607('0xb'),auth[_0x1607('0x6')](),interaction[_0x1607('0x14')]('whatsapp',_0x1607('0x19')),controller['update']);router[_0x1607('0x1a')]('/:id',auth[_0x1607('0x6')](),interaction['tracked']('whatsapp','whatsappinteraction:destroy'),controller['destroy']);router[_0x1607('0x1a')]('/:id/tags',auth[_0x1607('0x6')](),controller[_0x1607('0x1b')]);module[_0x1607('0x1c')]=router; \ No newline at end of file +var _0xa25a=['whatsappinteraction:update','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','/:id','get','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put','whatsapp'];(function(_0x338f73,_0x1945c8){var _0x163fdf=function(_0x4cd033){while(--_0x4cd033){_0x338f73['push'](_0x338f73['shift']());}};_0x163fdf(++_0x1945c8);}(_0xa25a,0x160));var _0xaa25=function(_0xda38b1,_0x3c0fce){_0xda38b1=_0xda38b1-0x0;var _0x404918=_0xa25a[_0xda38b1];return _0x404918;};'use strict';var multer=require(_0xaa25('0x0'));var util=require(_0xaa25('0x1'));var path=require(_0xaa25('0x2'));var timeout=require(_0xaa25('0x3'));var express=require(_0xaa25('0x4'));var router=express[_0xaa25('0x5')]();var auth=require(_0xaa25('0x6'));var interaction=require(_0xaa25('0x7'));var config=require(_0xaa25('0x8'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth[_0xaa25('0x9')](),controller[_0xaa25('0xa')]);router['get'](_0xaa25('0xb'),auth[_0xaa25('0x9')](),controller['describe']);router['get'](_0xaa25('0xc'),auth[_0xaa25('0x9')](),controller['show']);router[_0xaa25('0xd')]('/:id/messages',auth[_0xaa25('0x9')](),controller['getMessages']);router[_0xaa25('0xd')](_0xaa25('0xe'),auth['isAuthenticated'](),controller[_0xaa25('0xf')]);router[_0xaa25('0x10')]('/',auth['isAuthenticated'](),controller[_0xaa25('0x11')]);router['post']('/:id/messages',auth[_0xaa25('0x9')](),controller[_0xaa25('0x12')]);router['post'](_0xaa25('0x13'),auth['isAuthenticated'](),interaction[_0xaa25('0x14')]('whatsapp',_0xaa25('0x15')),controller[_0xaa25('0x16')]);router[_0xaa25('0x17')](_0xaa25('0xc'),auth[_0xaa25('0x9')](),interaction['tracked'](_0xaa25('0x18'),_0xaa25('0x19')),controller[_0xaa25('0x1a')]);router[_0xaa25('0x1b')](_0xaa25('0xc'),auth[_0xaa25('0x9')](),interaction[_0xaa25('0x14')](_0xaa25('0x18'),'whatsappinteraction:destroy'),controller[_0xaa25('0x1c')]);router['delete'](_0xaa25('0x13'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 422aa1a..098c4cf 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 _0xa40c=['exports','BOOLEAN','DATE','STRING','out','ENUM','sequelize'];(function(_0x1f95eb,_0x42244b){var _0x291849=function(_0x1d796b){while(--_0x1d796b){_0x1f95eb['push'](_0x1f95eb['shift']());}};_0x291849(++_0x42244b);}(_0xa40c,0x16b));var _0xca40=function(_0x324640,_0x654697){_0x324640=_0x324640-0x0;var _0x10f89=_0xa40c[_0x324640];return _0x10f89;};'use strict';var Sequelize=require(_0xca40('0x0'));var moment=require('moment');module[_0xca40('0x1')]={'closed':{'type':Sequelize[_0xca40('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xca40('0x3')]},'disposition':{'type':Sequelize[_0xca40('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xca40('0x4')]},'read1stAt':{'type':Sequelize[_0xca40('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xca40('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xca40('0x6')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x5d9d=['exports','DATE','STRING','ENUM','out','sequelize'];(function(_0x15e414,_0x20e5d0){var _0x5da898=function(_0x461042){while(--_0x461042){_0x15e414['push'](_0x15e414['shift']());}};_0x5da898(++_0x20e5d0);}(_0x5d9d,0x1b5));var _0xd5d9=function(_0x4c50c6,_0x2b1348){_0x4c50c6=_0x4c50c6-0x0;var _0x5a15e1=_0x5d9d[_0x4c50c6];return _0x5a15e1;};'use strict';var Sequelize=require(_0xd5d9('0x0'));var moment=require('moment');module[_0xd5d9('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd5d9('0x2')]},'disposition':{'type':Sequelize[_0xd5d9('0x3')]},'note':{'type':Sequelize[_0xd5d9('0x3')]},'phone':{'type':Sequelize[_0xd5d9('0x3')]},'read1stAt':{'type':Sequelize[_0xd5d9('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xd5d9('0x4')]('in',_0xd5d9('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd5d9('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xd5d9('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 1ab3e36..ded970c 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 _0x814b=['index','rawAttributes','type','key','model','query','intersection','attributes','length','nolimit','limit','order','sort','filters','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','body','keys','some','compact','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$lte','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','t.id\x20IN\x20?','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','toString','count','sequelize','fields','a.key','Account.key','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','all','rows','show','params','WhatsappInteraction','includeAll','merge','options','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','hasOwnProperty','WhatsappInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','User','fullname','Contact','firstName','lastName','Attachment','Messages','direction','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Whatsapp','YYYY-MM-DD','closedAt','disposition','existsSync','basename','out','System','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','map','TagIds','split','forEach','push','catch'];(function(_0x20ff9b,_0x50df75){var _0x5f49cf=function(_0x490def){while(--_0x490def){_0x20ff9b['push'](_0x20ff9b['shift']());}};_0x5f49cf(++_0x50df75);}(_0x814b,0x1a2));var _0xb814=function(_0x545fe3,_0x3b191f){_0x545fe3=_0x545fe3-0x0;var _0x480702=_0x814b[_0x545fe3];return _0x480702;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var db=require(_0xb814('0x19'))['db'];config[_0xb814('0x1a')]=_[_0xb814('0x1b')](config[_0xb814('0x1a')],{'host':_0xb814('0x1c'),'port':0x18eb});var socket=require(_0xb814('0x1d'))(new Redis(config[_0xb814('0x1a')]));require(_0xb814('0x1e'))[_0xb814('0x1f')](socket);function respondWithStatusCode(_0x2ab627,_0x3f4881){_0x3f4881=_0x3f4881||0xcc;return function(_0x44fb96){if(_0x44fb96){return _0x2ab627[_0xb814('0x20')](_0x3f4881);}return _0x2ab627[_0xb814('0x21')](_0x3f4881)[_0xb814('0x22')]();};}function respondWithResult(_0x3a71d6,_0x45e0d0){_0x45e0d0=_0x45e0d0||0xc8;return function(_0x265a83){if(_0x265a83){return _0x3a71d6[_0xb814('0x21')](_0x45e0d0)[_0xb814('0x23')](_0x265a83);}};}function respondWithFilteredResult(_0x7a21ef,_0x48c9df){return function(_0x168a48){if(_0x168a48){var _0x55ba16=_0x168a48['count'],_0x270598=_0x48c9df['offset'],_0xfac75b=_0x48c9df[_0xb814('0x24')]+_0x48c9df['limit'],_0x4c3007;if(_0xfac75b>=_0x55ba16){_0xfac75b=_0x55ba16;_0x4c3007=0xc8;}else{_0x4c3007=0xce;}_0x7a21ef['status'](_0x4c3007);return _0x7a21ef[_0xb814('0x25')](_0xb814('0x26'),_0x270598+'-'+_0xfac75b+'/'+_0x55ba16)[_0xb814('0x23')](_0x168a48);}return null;};}function patchUpdates(_0x4e139e){return function(_0xf5b8aa){try{jsonpatch['apply'](_0xf5b8aa,_0x4e139e,!![]);}catch(_0x1e6393){return BPromise[_0xb814('0x27')](_0x1e6393);}return _0xf5b8aa[_0xb814('0x28')]();};}function saveUpdates(_0x470e81,_0x27352e){return function(_0x2bd039){if(_0x2bd039){return _0x2bd039[_0xb814('0x29')](_0x470e81)['then'](function(_0x2ead86){return _0x2ead86;});}return null;};}function removeEntity(_0x52b7a3,_0x3f81d0){return function(_0x457dac){if(_0x457dac){return _0x457dac[_0xb814('0x2a')]()[_0xb814('0x2b')](function(){_0x52b7a3[_0xb814('0x21')](0xcc)[_0xb814('0x22')]();});}};}function handleEntityNotFound(_0x3d836c,_0x5755ea){return function(_0x392222){if(!_0x392222){_0x3d836c[_0xb814('0x20')](0x194);}return _0x392222;};}function handleError(_0x1c2625,_0x349394){_0x349394=_0x349394||0x1f4;return function(_0x32ed56){logger[_0xb814('0x2c')](_0x32ed56[_0xb814('0x2d')]);if(_0x32ed56[_0xb814('0x2e')]){delete _0x32ed56['name'];}_0x1c2625[_0xb814('0x21')](_0x349394)[_0xb814('0x2f')](_0x32ed56);};}function getInteractionUsers(_0x52ed64,_0x9008b2){return new BPromise(function(_0x37d24d,_0x530744){try{if(_0x9008b2[_0x52ed64['id']]){_0x52ed64['Users']=_[_0xb814('0x30')](_0x9008b2[_0x52ed64['id']],function(_0x2051d0){return{'id':_0x2051d0['id'],'fullname':_0x2051d0['fullname']};});}}catch(_0x338a28){_0x530744(_0x338a28);}_0x37d24d(_0x52ed64);});}function getInteractionTags(_0x526610,_0x6efe9a){return new BPromise(function(_0x5f3e9b,_0x4cfc58){try{if(_0x526610[_0xb814('0x31')]){_0x526610['Tags']=[];_0x526610[_0xb814('0x31')][_0xb814('0x32')](',')[_0xb814('0x33')](function(_0x599f9f){_0x526610['Tags'][_0xb814('0x34')](_0x6efe9a[_0x599f9f]);});}delete _0x526610[_0xb814('0x31')];}catch(_0x523566){_0x4cfc58(_0x523566);}_0x5f3e9b(_0x526610);});}function updateWhatsappInteraction(_0x2c8943,_0xe558d5,_0x692c72){return new BPromise(function(_0x217b7e,_0x1b78de){return getInteractionUsers(_0x2c8943,_0x692c72)[_0xb814('0x2b')](function(_0x3672f3){return getInteractionTags(_0x3672f3,_0xe558d5);})['then'](function(_0x3207ec){_0x217b7e(_0x3207ec);})[_0xb814('0x35')](function(_0x30de5a){_0x1b78de(_0x30de5a);});});}exports[_0xb814('0x36')]=function(_0x14100d,_0x4ff31a){var _0x16ef82={},_0x57e6e6={},_0x43db67={'count':0x0,'rows':[]};var _0x16e21c=_[_0xb814('0x30')](db['WhatsappInteraction'][_0xb814('0x37')],function(_0xbdb3e9){return{'name':_0xbdb3e9['fieldName'],'type':_0xbdb3e9[_0xb814('0x38')][_0xb814('0x39')]};});_0x57e6e6[_0xb814('0x3a')]=_[_0xb814('0x30')](_0x16e21c,_0xb814('0x2e'));_0x57e6e6[_0xb814('0x3b')]=_['keys'](_0x14100d[_0xb814('0x3b')]);_0x57e6e6['filters']=_[_0xb814('0x3c')](_0x57e6e6['model'],_0x57e6e6[_0xb814('0x3b')]);_0x16ef82['attributes']=_[_0xb814('0x3c')](_0x57e6e6[_0xb814('0x3a')],qs['fields'](_0x14100d['query']['fields']));_0x16ef82['attributes']=_0x16ef82[_0xb814('0x3d')][_0xb814('0x3e')]?_0x16ef82[_0xb814('0x3d')]:_0x57e6e6[_0xb814('0x3a')];if(!_0x14100d['query']['hasOwnProperty'](_0xb814('0x3f'))){_0x16ef82['limit']=qs[_0xb814('0x40')](_0x14100d[_0xb814('0x3b')][_0xb814('0x40')]);_0x16ef82[_0xb814('0x24')]=qs[_0xb814('0x24')](_0x14100d[_0xb814('0x3b')][_0xb814('0x24')]);}_0x16ef82[_0xb814('0x41')]=qs[_0xb814('0x42')](_0x14100d['query']['sort']);_0x16ef82['where']=qs[_0xb814('0x43')](_['pick'](_0x14100d[_0xb814('0x3b')],_0x57e6e6['filters']),_0x16e21c);var _0x411723=[];var _0x44ff56=squel[_0xb814('0x44')]()[_0xb814('0x45')]('id')['field'](_0xb814('0x2e'))[_0xb814('0x45')](_0xb814('0x46'))[_0xb814('0x47')](_0xb814('0x48'));var _0x450a08=squel['select']()[_0xb814('0x45')](_0xb814('0x49'))[_0xb814('0x45')](_0xb814('0x4a'))[_0xb814('0x45')](_0xb814('0x4b'))[_0xb814('0x47')]('user_has_whatsapp_interactions','ui')['left_join'](_0xb814('0x4c'),'u',_0xb814('0x4d'));var _0x4c08d6=squel[_0xb814('0x44')]()[_0xb814('0x47')](_0xb814('0x4e'),'i')[_0xb814('0x4f')](_0xb814('0x50'),'c',_0xb814('0x51'))[_0xb814('0x4f')](_0xb814('0x4c'),'o','o.id\x20=\x20i.UserId')[_0xb814('0x4f')](_0xb814('0x52'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0xb814('0x4f')]('whatsapp_messages','me',_0xb814('0x53'))[_0xb814('0x4f')](_0xb814('0x54'),'it',_0xb814('0x55'))[_0xb814('0x4f')](_0xb814('0x48'),'t',_0xb814('0x56'));var _0x45480e=squel[_0xb814('0x57')]();var _0x2a422a=[];var _0x5e6df7=squel['expr']();var _0x32eca6;if(_0x14100d[_0xb814('0x3b')][_0xb814('0x58')]){_0x32eca6=as[_0xb814('0x59')](_0x14100d[_0xb814('0x3b')][_0xb814('0x58')]);var _0x135208=_0x32eca6['sqlOperator'];for(var _0x26fd0b=0x0;_0x26fd0b<_0x32eca6[_0xb814('0x5a')][_0xb814('0x3e')];_0x26fd0b++){var _0x5a916d=_0x32eca6[_0xb814('0x5a')][_0x26fd0b];var _0x4e6f3c='i';var _0x252293=_['find'](_0x16e21c,[_0xb814('0x2e'),_0x5a916d[_0xb814('0x45')]]);if(!_0x252293){switch(_0x5a916d['field']){case _0xb814('0x5b'):if(_0x5a916d[_0xb814('0x5c')]==0x1){_0x4c08d6[_0xb814('0x5d')]('`'+_0x5a916d['field']+_0xb814('0x5e'));}else{_0x4c08d6['having']('`'+_0x5a916d[_0xb814('0x45')]+_0xb814('0x5f'));}break;case'Contact':if(_0x5a916d[_0xb814('0x60')]==='$substring'){if(_0x5a916d['value'][_0xb814('0x32')]('\x20')[_0xb814('0x3e')]>0x1){_0x45480e[_0x135208](_0xb814('0x61'),qs['getFullTextValue'](_0x5a916d[_0xb814('0x5c')]),null);}else{var _0x538b0f='%'+_0x5a916d[_0xb814('0x5c')]+'%';_0x45480e[_0x135208](_0xb814('0x62'),_0x538b0f,_0x538b0f,_0x538b0f);}}else{_0x252293=_['find'](_0x16e21c,[_0xb814('0x2e'),'ContactId']);_0x5a916d[_0xb814('0x45')]=_0xb814('0x63');_0x135e13=as[_0xb814('0x64')](_0x4e6f3c,_0x252293[_0xb814('0x38')],_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')][_0xb814('0x66')],_0x135e13[_0xb814('0x5c')]['end']);}break;case _0xb814('0x67'):var _0x5441c5=_0x5a916d['value'][_0xb814('0x32')](',')[_0xb814('0x30')](function(_0x4d13db){return Number(_0x4d13db);});_0x5441c5[_0xb814('0x33')](function(_0x58b9a6){_0x5e6df7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x58b9a6+',%');});_0x2a422a=_[_0xb814('0x68')](_0x2a422a,_0x5441c5);break;case'User':if(_0x5a916d[_0xb814('0x60')]===_0xb814('0x69')){_0x45480e[_0x135208](_0xb814('0x6a'),'%'+_0x5a916d['value']+'%',null);}else{_0x252293=_[_0xb814('0x6b')](_0x16e21c,['name',_0xb814('0x6c')]);_0x5a916d[_0xb814('0x45')]=_0xb814('0x6c');_0x135e13=as[_0xb814('0x64')](_0x4e6f3c,_0x252293[_0xb814('0x38')],_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')][_0xb814('0x66')],_0x135e13[_0xb814('0x5c')]['end']);}break;case _0xb814('0x6d'):_0x135e13=as[_0xb814('0x64')]('me',null,_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')][_0xb814('0x66')],_0x135e13[_0xb814('0x5c')]['end']);break;}}else{var _0x135e13=as['buildExpression'](_0x4e6f3c,_0x252293[_0xb814('0x38')],_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')]['start'],_0x135e13[_0xb814('0x5c')]['end']);}}}else{var _0x37e9c5=_(_0x14100d['query'])[_0xb814('0x6e')]()[_0xb814('0x30')](function(_0xa03cd2){return _[_0xb814('0x6f')](_0x16e21c,[_0xb814('0x2e'),_0xa03cd2])?_0xa03cd2:undefined;})[_0xb814('0x70')]()[_0xb814('0x5c')]();if(!_['isEmpty'](_0x37e9c5)){_0x37e9c5[_0xb814('0x33')](function(_0x51ca51){if(_0x51ca51===_0xb814('0x71')){_0x4c08d6[_0xb814('0x72')](_0xb814('0x73'),[][_0xb814('0x74')](_0x14100d[_0xb814('0x3b')][_0x51ca51]));}else if(_0x51ca51===_0xb814('0x75')){var _0x514dab=JSON[_0xb814('0x76')](_0x14100d[_0xb814('0x3b')][_0x51ca51])['$gte'];var _0x3bb2b4=JSON[_0xb814('0x76')](_0x14100d[_0xb814('0x3b')][_0x51ca51])[_0xb814('0x77')];_0x4c08d6[_0xb814('0x72')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x514dab,_0x3bb2b4);}else{if(_0x14100d[_0xb814('0x3b')][_0x51ca51]==='null'){_0x4c08d6[_0xb814('0x72')]('i.'+_0x51ca51+_0xb814('0x78'));}else{_0x4c08d6[_0xb814('0x72')]('i.'+_0x51ca51+_0xb814('0x79'),_0x14100d[_0xb814('0x3b')][_0x51ca51]);}}});}if(_0x14100d[_0xb814('0x3b')]['read']){if(_0x14100d['query']['read']==0x1){_0x4c08d6[_0xb814('0x5d')]('`unreadMessages`\x20=\x200');}else{_0x4c08d6[_0xb814('0x5d')](_0xb814('0x7a'));}}if(_0x14100d[_0xb814('0x3b')]['tag']){_0x2a422a=_[_0xb814('0x7b')](_0x14100d[_0xb814('0x3b')][_0xb814('0x7c')])?_0x14100d['query'][_0xb814('0x7c')]:new Array(_0x14100d[_0xb814('0x3b')][_0xb814('0x7c')]);_0x2a422a[_0xb814('0x33')](function(_0x555be0){_0x5e6df7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x555be0+',%');});}if(_0x14100d[_0xb814('0x3b')][_0xb814('0x7d')]){var _0x39863d=_0x14100d[_0xb814('0x3b')][_0xb814('0x7d')][_0xb814('0x7e')]('\x5c','\x5c\x5c')[_0xb814('0x7e')]('\x27\x27',_0xb814('0x7f'));if(qs[_0xb814('0x80')](_0x39863d)){_0x45480e['or'](_0xb814('0x81'),_0x39863d+'%')['or'](_0xb814('0x82'),_0x39863d+'%');}else{_0x45480e['or'](_0xb814('0x83'),qs[_0xb814('0x84')](_0x39863d))['or'](_0xb814('0x85'),_0x39863d+'%');}}}_0x4c08d6[_0xb814('0x72')](_0x45480e);_0x4c08d6['group'](_0xb814('0x86'));var _0x33cfc4={'type':db[_0xb814('0x87')][_0xb814('0x88')][_0xb814('0x89')],'raw':!![]};var _0x283b0f=_0x4c08d6['clone']();_0x283b0f[_0xb814('0x45')]('i.id');_0x283b0f[_0xb814('0x45')](_0xb814('0x8a'),_0xb814('0x5b'));if(_0x16ef82[_0xb814('0x41')]){_0x16ef82[_0xb814('0x41')]['forEach'](function(_0x4c44ee){_0x4c08d6[_0xb814('0x41')]('i.'+_0x4c44ee[0x0],_0x4c44ee[0x1]===_0xb814('0x8b')?![]:!![]);});}if(!_[_0xb814('0x8c')](_0x2a422a)){_0x4c08d6[_0xb814('0x5d')](_0x5e6df7);_0x283b0f['where'](_0xb814('0x8d'),_0x2a422a);}BPromise['resolve']()[_0xb814('0x2b')](function(){if(!_0x32eca6){if(_0x14100d[_0xb814('0x3b')]['WhatsappAccountId']||_0x14100d['query'][_0xb814('0x8e')])return;_0x283b0f['where'](_0xb814('0x8f'));_0x4c08d6[_0xb814('0x72')](_0xb814('0x8f'));return;}return _0x14100d[_0xb814('0x90')][_0xb814('0x91')]({'attributes':['id'],'raw':!![]})[_0xb814('0x2b')](function(_0x40fe4a){if(_['isEmpty'](_0x40fe4a)){_0x283b0f[_0xb814('0x72')]('i.WhatsappAccountId\x20IS\x20NULL');_0x4c08d6[_0xb814('0x72')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x283b0f[_0xb814('0x72')](_0xb814('0x73'),_['map'](_0x40fe4a,'id'));_0x4c08d6[_0xb814('0x72')]('i.WhatsappAccountId\x20IN\x20?',_[_0xb814('0x30')](_0x40fe4a,'id'));}});})[_0xb814('0x2b')](function(){db['sequelize']['query'](_0x283b0f[_0xb814('0x92')](),_0x33cfc4)[_0xb814('0x2b')](function(_0x3309c5){_0x43db67[_0xb814('0x93')]=_0x3309c5[_0xb814('0x3e')];if(_0x43db67[_0xb814('0x93')]===0x0)return[];return db[_0xb814('0x94')][_0xb814('0x3b')](_0x44ff56[_0xb814('0x92')](),_0x33cfc4)[_0xb814('0x2b')](function(_0x53e705){_0x411723=_['keyBy'](_0x53e705,'id');_0x33cfc4=_['merge'](_0x33cfc4,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x14100d['query'][_0xb814('0x95')]){_0x16ef82[_0xb814('0x3d')][_0xb814('0x33')](function(_0x59f3ff){_0x4c08d6[_0xb814('0x45')]('i.'+_0x59f3ff);});}else{_0x4c08d6[_0xb814('0x45')](_0xb814('0x8a'),_0xb814('0x5b'));_0x4c08d6[_0xb814('0x45')](_0xb814('0x96'),_0xb814('0x97'));_0x4c08d6[_0xb814('0x45')]('a.mandatoryDisposition',_0xb814('0x98'));_0x4c08d6[_0xb814('0x45')](_0xb814('0x99'));_0x4c08d6[_0xb814('0x45')]('c.firstName',_0xb814('0x9a'));_0x4c08d6[_0xb814('0x45')](_0xb814('0x9b'),_0xb814('0x9c'));_0x4c08d6[_0xb814('0x45')]('c.email','Contact.email');_0x4c08d6[_0xb814('0x45')]('c.phone',_0xb814('0x9d'));_0x4c08d6[_0xb814('0x45')]('c.mobile',_0xb814('0x9e'));_0x4c08d6['field'](_0xb814('0x9f'),'Contact.fax');_0x4c08d6[_0xb814('0x45')](_0xb814('0xa0'),_0xb814('0xa1'));_0x4c08d6[_0xb814('0x45')](_0xb814('0xa2'),_0xb814('0xa3'));_0x4c08d6[_0xb814('0x45')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x16ef82[_0xb814('0x40')])_0x4c08d6['limit'](_0x16ef82['limit']);if(_0x16ef82[_0xb814('0x24')])_0x4c08d6[_0xb814('0x24')](_0x16ef82[_0xb814('0x24')]);return db['sequelize'][_0xb814('0x3b')](_0x4c08d6['toString'](),_0x33cfc4);})[_0xb814('0x2b')](function(_0x19d508){_0x450a08[_0xb814('0x72')](_0xb814('0xa4'),_['map'](_0x19d508,'id'));return db[_0xb814('0x94')][_0xb814('0x3b')](_0x450a08[_0xb814('0x92')](),_0x33cfc4)['then'](function(_0x1ebbf6){var _0x3fc77d=_[_0xb814('0xa5')](_0x1ebbf6,'WhatsappInteractionId');var _0x5d8626=[];_0x19d508[_0xb814('0x33')](function(_0x9dc06b){_0x5d8626[_0xb814('0x34')](updateWhatsappInteraction(_0x9dc06b,_0x411723,_0x3fc77d));});return BPromise[_0xb814('0xa6')](_0x5d8626);});});})[_0xb814('0x2b')](function(_0x37a7ab){_0x43db67[_0xb814('0xa7')]=_0x37a7ab;return _0x43db67;})[_0xb814('0x2b')](respondWithFilteredResult(_0x4ff31a,_0x16ef82));})[_0xb814('0x35')](handleError(_0x4ff31a,null));};exports[_0xb814('0xa8')]=function(_0x2569a5,_0x2a13fb){var _0x5b8d2e={'raw':![],'where':{'id':_0x2569a5[_0xb814('0xa9')]['id']}},_0x5416dc={};_0x5416dc['model']=_[_0xb814('0x6e')](db[_0xb814('0xaa')][_0xb814('0x37')]);_0x5416dc[_0xb814('0x3b')]=_[_0xb814('0x6e')](_0x2569a5[_0xb814('0x3b')]);_0x5416dc[_0xb814('0x43')]=_['intersection'](_0x5416dc['model'],_0x5416dc[_0xb814('0x3b')]);_0x5b8d2e['attributes']=_[_0xb814('0x3c')](_0x5416dc[_0xb814('0x3a')],qs[_0xb814('0x95')](_0x2569a5['query'][_0xb814('0x95')]));_0x5b8d2e[_0xb814('0x3d')]=_0x5b8d2e[_0xb814('0x3d')][_0xb814('0x3e')]?_0x5b8d2e[_0xb814('0x3d')]:_0x5416dc['model'];if(_0x2569a5[_0xb814('0x3b')][_0xb814('0xab')]){_0x5b8d2e['include']=[{'all':!![]}];}_0x5b8d2e=_[_0xb814('0xac')]({},_0x5b8d2e,_0x2569a5[_0xb814('0xad')]);return db[_0xb814('0xaa')]['find'](_0x5b8d2e)[_0xb814('0x2b')](handleEntityNotFound(_0x2a13fb,null))[_0xb814('0x2b')](respondWithResult(_0x2a13fb,null))['catch'](handleError(_0x2a13fb,null));};exports[_0xb814('0xae')]=function(_0x171f83,_0x5b5634){return db[_0xb814('0xaa')][_0xb814('0xae')](_0x171f83[_0xb814('0x6d')],{})[_0xb814('0x2b')](respondWithResult(_0x5b5634,0xc9))[_0xb814('0x35')](handleError(_0x5b5634,null));};exports[_0xb814('0x29')]=function(_0x40ae0b,_0x336a8f){if(_0x40ae0b[_0xb814('0x6d')]['id']){delete _0x40ae0b[_0xb814('0x6d')]['id'];}return db[_0xb814('0xaa')][_0xb814('0x6b')]({'where':{'id':_0x40ae0b['params']['id']}})['then'](handleEntityNotFound(_0x336a8f,null))[_0xb814('0x2b')](saveUpdates(_0x40ae0b['body'],null))['then'](respondWithResult(_0x336a8f,null))[_0xb814('0x35')](handleError(_0x336a8f,null));};exports['destroy']=function(_0x4f0427,_0x50cb34){return db[_0xb814('0xaa')][_0xb814('0x6b')]({'where':{'id':_0x4f0427[_0xb814('0xa9')]['id']}})['then'](handleEntityNotFound(_0x50cb34,null))[_0xb814('0x2b')](removeEntity(_0x50cb34,null))['catch'](handleError(_0x50cb34,null));};exports[_0xb814('0xaf')]=function(_0x2e6660,_0x49a8de){return db[_0xb814('0xaa')]['describe']()[_0xb814('0x2b')](respondWithResult(_0x49a8de,null))[_0xb814('0x35')](handleError(_0x49a8de,null));};exports[_0xb814('0xb0')]=function(_0x39ce17,_0x11efb8,_0xaf705d){return db[_0xb814('0xb1')][_0xb814('0x6b')]({'where':{'id':_0x39ce17[_0xb814('0xa9')]['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x11efb8,null))[_0xb814('0x2b')](function(_0x3e7a9a){if(_0x3e7a9a){return _0x3e7a9a[_0xb814('0xb0')](_0x39ce17[_0xb814('0x6d')][_0xb814('0xb2')],_['omit'](_0x39ce17[_0xb814('0x6d')],[_0xb814('0xb2'),'id'])||{});}})['then'](respondWithResult(_0x11efb8,null))[_0xb814('0x35')](handleError(_0x11efb8,null));};exports[_0xb814('0xb3')]=function(_0x1868d9,_0x570191,_0x56b2aa){var _0x473b30={'raw':![],'where':{}};var _0x4af71e={};var _0x2d40e6={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xb814('0xb4')]({'where':{'id':_0x1868d9['params']['id']}})['then'](handleEntityNotFound(_0x570191,null))[_0xb814('0x2b')](function(_0x32c956){if(_0x32c956){_0x4af71e[_0xb814('0x3a')]=_[_0xb814('0x6e')](db[_0xb814('0xb1')][_0xb814('0x37')]);_0x4af71e[_0xb814('0x3b')]=_[_0xb814('0x6e')](_0x1868d9[_0xb814('0x3b')]);_0x4af71e[_0xb814('0x43')]=_[_0xb814('0x3c')](_0x4af71e['model'],_0x4af71e[_0xb814('0x3b')]);_0x473b30['attributes']=_[_0xb814('0x3c')](_0x4af71e[_0xb814('0x3a')],qs[_0xb814('0x95')](_0x1868d9['query'][_0xb814('0x95')]));_0x473b30[_0xb814('0x3d')]=_0x473b30[_0xb814('0x3d')][_0xb814('0x3e')]?_0x473b30[_0xb814('0x3d')]:_0x4af71e[_0xb814('0x3a')];if(!_0x1868d9[_0xb814('0x3b')][_0xb814('0xb5')](_0xb814('0x3f'))){_0x473b30[_0xb814('0x40')]=qs[_0xb814('0x40')](_0x1868d9[_0xb814('0x3b')][_0xb814('0x40')]);_0x473b30[_0xb814('0x24')]=qs[_0xb814('0x24')](_0x1868d9['query'][_0xb814('0x24')]);}_0x473b30[_0xb814('0x41')]=qs[_0xb814('0x42')](_0x1868d9['query']['sort']);_0x473b30[_0xb814('0x72')]=qs['filters'](_['pick'](_0x1868d9['query'],_0x4af71e['filters']));_0x473b30[_0xb814('0x72')][_0xb814('0xb6')]=_0x32c956['id'];if(_0x1868d9['query'][_0xb814('0x7d')]){_0x473b30[_0xb814('0x72')]=_[_0xb814('0xac')](_0x473b30[_0xb814('0x72')],{'$or':_[_0xb814('0x30')](_0x473b30[_0xb814('0x3d')],function(_0x20e608){var _0x7b9948={};_0x7b9948[_0x20e608]={'$like':'%'+_0x1868d9[_0xb814('0x3b')][_0xb814('0x7d')]+'%'};return _0x7b9948;})});}if(_0x1868d9[_0xb814('0x3b')]['$gte']){var _0x2a5dff=_0x1868d9['query'][_0xb814('0xb7')][_0xb814('0x32')](',');var _0x35e8f7={};_0x35e8f7[_0x2a5dff[0x0]]={'$gte':moment(_0x2a5dff[0x1])[_0xb814('0xb8')](_0xb814('0xb9'))};_0x473b30[_0xb814('0x72')]=_[_0xb814('0xac')](_0x473b30[_0xb814('0x72')],_0x35e8f7);}_0x473b30=_['merge']({},_0x473b30,_0x1868d9['options']);return db['WhatsappMessage'][_0xb814('0x93')]({'where':_0x473b30[_0xb814('0x72')]})[_0xb814('0x2b')](function(_0x3b7bee){_0x2d40e6[_0xb814('0x93')]=_0x3b7bee;if(_0x1868d9[_0xb814('0x3b')][_0xb814('0xab')]){_0x473b30[_0xb814('0xba')]=[{'all':!![]}];}return db[_0xb814('0xb1')][_0xb814('0xbb')](_0x473b30);})['then'](function(_0x5c989a){_0x2d40e6[_0xb814('0xa7')]=_0x5c989a;return _0x2d40e6;});}})[_0xb814('0x2b')](respondWithFilteredResult(_0x570191,_0x473b30))[_0xb814('0x35')](handleError(_0x570191,null));};exports[_0xb814('0xbc')]=function(_0x3f0c9c,_0x2642ab,_0x48358c){return db[_0xb814('0xaa')]['find']({'where':{'id':_0x3f0c9c[_0xb814('0xa9')]['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x2642ab,null))[_0xb814('0x2b')](function(_0x94aa05){if(_0x94aa05){return _0x94aa05[_0xb814('0xbd')](_0x3f0c9c[_0xb814('0x6d')][_0xb814('0xb2')],_['omit'](_0x3f0c9c[_0xb814('0x6d')],[_0xb814('0xb2'),'id'])||{})[_0xb814('0xbe')](function(){return db[_0xb814('0x67')]['findAll']({'attributes':['id',_0xb814('0x2e'),_0xb814('0x46')],'where':{'id':_0x3f0c9c[_0xb814('0x6d')][_0xb814('0xb2')]}});})[_0xb814('0x2b')](function(_0x4a2aa5){socket[_0xb814('0xbf')](_0xb814('0xc0'),{'id':Number(_0x3f0c9c[_0xb814('0xa9')]['id']),'tags':_0x4a2aa5||[]});return{'id':Number(_0x3f0c9c['params']['id']),'tags':_0x4a2aa5||[]};});}})[_0xb814('0x2b')](respondWithResult(_0x2642ab,null))['catch'](handleError(_0x2642ab,null));};exports[_0xb814('0xc1')]=function(_0x5b4315,_0x22f6f1,_0x3467bd){return db[_0xb814('0xaa')][_0xb814('0x6b')]({'where':{'id':_0x5b4315['params']['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x22f6f1,null))[_0xb814('0x2b')](function(_0x3fda0d){if(_0x3fda0d){return _0x3fda0d[_0xb814('0xc1')](_0x5b4315[_0xb814('0x3b')][_0xb814('0xb2')]);}})[_0xb814('0x2b')](respondWithStatusCode(_0x22f6f1,null))[_0xb814('0x35')](handleError(_0x22f6f1,null));};exports[_0xb814('0xc2')]=function(_0x152260,_0x3bc03a){var _0x368696=moment()[_0xb814('0xc3')]()[_0xb814('0x92')]();var _0x8e882a=path['join'](config[_0xb814('0xc4')],_0xb814('0xc5'),_0xb814('0xc6'),_0xb814('0xc7'));var _0x4017b6=path[_0xb814('0xc8')](config['root'],_0xb814('0xc5'),_0xb814('0xc6'),_0xb814('0xc9'));var _0x31b4f5=path['join'](_0x8e882a,_0x368696);var _0x5b5a26=util[_0xb814('0xb8')](_0xb814('0xca'),_0x152260[_0xb814('0xa9')]['id'],_0x368696);var _0x667ca1=path[_0xb814('0xc8')](_0x8e882a,_0x5b5a26);var _0x2c510a=[];_0x2c510a['push']({'model':db[_0xb814('0xcb')],'as':_0xb814('0xcb'),'attributes':['id',_0xb814('0xcc')],'raw':!![]});_0x2c510a[_0xb814('0x34')]({'model':db['CmContact'],'as':_0xb814('0xcd'),'attributes':['id',_0xb814('0xce'),_0xb814('0xcf')],'raw':!![]});if(_0x152260[_0xb814('0x3b')][_0xb814('0xc9')]){_0x2c510a['push']({'model':db[_0xb814('0xd0')],'as':_0xb814('0xd0'),'raw':!![]});}var _0x371dd7=[{'model':db[_0xb814('0xb1')],'as':_0xb814('0xd1'),'attributes':['id',_0xb814('0x6d'),_0xb814('0x75'),_0xb814('0xd2'),_0xb814('0xd3'),_0xb814('0xd4')],'include':_0x2c510a}];_0x371dd7[_0xb814('0x34')]({'model':db[_0xb814('0xd5')],'as':_0xb814('0xd6'),'attributes':['id','name']});_0x371dd7['push']({'model':db[_0xb814('0xcb')],'as':_0xb814('0xd7'),'attributes':['id',_0xb814('0xcc')]});return db['WhatsappInteraction'][_0xb814('0x6b')]({'where':{'id':_0x152260[_0xb814('0xa9')]['id']},'include':_0x371dd7})[_0xb814('0x2b')](handleEntityNotFound(_0x3bc03a,null))['then'](function(_0x10537d){if(_0x10537d){var _0xa651a=_0x10537d[_0xb814('0xd8')]({'plain':!![]});fs[_0xb814('0xd9')](_0x31b4f5);var _0x6ec0f5={'format':'A4','border':_0xb814('0xda'),'header':{'height':'40px','contents':{'first':_0xb814('0xdb')}},'footer':{'height':'30px','contents':{'default':util[_0xb814('0xb8')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xb814('0xb8')](_0xb814('0xdc'),_0xb814('0xdd'),_0xa651a['id']),moment()['format'](_0xb814('0xde'))[_0xb814('0x92')]())}}};var _0x164304={'channel':'Whatsapp','account':_0xa651a[_0xb814('0xd6')]['name'],'agent':_0xa651a[_0xb814('0xd7')]?_0xa651a[_0xb814('0xd7')][_0xb814('0xcc')]:'N.A.','createdAt':moment(_0xa651a[_0xb814('0x75')])[_0xb814('0xb8')](_0xb814('0xb9'))[_0xb814('0x92')](),'closedAt':_0xa651a['closed']?moment(_0xa651a[_0xb814('0xdf')])[_0xb814('0xb8')](_0xb814('0xb9'))[_0xb814('0x92')]():'','disposition':_0xa651a[_0xb814('0xe0')],'messages':_(_0xa651a[_0xb814('0xd1')])[_0xb814('0x7d')]({'secret':![]})[_0xb814('0x30')](function(_0x9a33d0){if(_0x9a33d0['Attachment']){var _0x2fe47b=path[_0xb814('0xc8')](_0x4017b6,_0x9a33d0[_0xb814('0xd0')]['basename']);if(fs[_0xb814('0xe1')](_0x2fe47b)){fs['createReadStream'](_0x2fe47b)['pipe'](fs['createWriteStream'](path[_0xb814('0xc8')](_0x31b4f5,_0x9a33d0['Attachment'][_0xb814('0xe2')])));}}return{'date':moment(_0x9a33d0[_0xb814('0x75')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xb814('0x92')](),'sender':_0x9a33d0['direction']===_0xb814('0xe3')?_0x9a33d0['User']?_0x9a33d0[_0xb814('0xcb')][_0xb814('0xcc')]:_0xb814('0xe4'):_0x9a33d0['Contact']['firstName']+(_0x9a33d0['Contact'][_0xb814('0xcf')]?'\x20'+_0x9a33d0['Contact']['lastName']:''),'body':_0x9a33d0[_0xb814('0xd0')]?_0x9a33d0['Attachment']['basename']:_0x9a33d0['body'],'direction':_0x9a33d0[_0xb814('0xd2')]===_0xb814('0xe3')?'A':'C','secret':_0x9a33d0[_0xb814('0xd3')],'read':_0x9a33d0['read'],'attachment':_0x9a33d0[_0xb814('0xd0')]};})[_0xb814('0x5c')]()};return ejs[_0xb814('0xe5')](path[_0xb814('0xc8')](config[_0xb814('0xc4')],_0xb814('0xc5'),'views',_0xb814('0xe6')),{'interaction':_0x164304})[_0xb814('0x2b')](function(_0x28b818){return new BPromise(function(_0x171845,_0x4f2db2){pdf[_0xb814('0xae')](_0x28b818,_0x6ec0f5)[_0xb814('0xe7')](path[_0xb814('0xc8')](_0x31b4f5,_0xb814('0xe8')+_0xa651a['id']+'-'+_0x368696+_0xb814('0xe9')),function(_0x2cb01d,_0x1f4540){if(_0x2cb01d)return _0x4f2db2(_0x2cb01d);_0x171845(_0x1f4540);});});})[_0xb814('0x2b')](function(){return new BPromise(function(_0x81ebc0,_0x2e7959){zipdir(_0x31b4f5,{'saveTo':_0x667ca1},function(_0x47f054,_0x1aa70b){if(_0x47f054)return _0x2e7959(_0x47f054);return _0x81ebc0(_0x1aa70b);});})[_0xb814('0x2b')](function(){return new BPromise(function(_0x5706ad,_0x3b8438){rimraf(_0x31b4f5,function(_0x56e231){if(_0x56e231)_0x3b8438(_0x56e231);return _0x5706ad();});});})[_0xb814('0x2b')](function(){return _0x3bc03a[_0xb814('0xc2')](_0x667ca1,_0x5b5a26,function(_0x5e2273){if(_0x5e2273){console[_0xb814('0xea')]('err',_0x5e2273);}else{fs[_0xb814('0xeb')](_0x667ca1);}});});});}else{return _0x3bc03a[_0xb814('0x20')](0xc8);}})[_0xb814('0x35')](handleError(_0x3bc03a,null));}; \ No newline at end of file +var _0x7a54=['attachments','Attachment','direction','secret','WhatsappAccount','Account','Owner','mkdirSync','30px','%s\x20#%d','Whatsapp','YYYY-MM-DD','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','System','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','download','log','err','unlinkSync','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','./whatsappInteraction.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','select','color','tools_tags','u.id','field','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','whatsapp_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','buildExpression','start','body','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','forEach','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','rows','show','params','includeAll','include','WhatsappInteraction','create','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','format','options','findAll','emit','removeTags','unix','root','files','tmp','server','join','transcript-%d-%s.zip','User','firstName','lastName'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x7a54,0x106));var _0x47a5=function(_0x639943,_0x503a08){_0x639943=_0x639943-0x0;var _0x190865=_0x7a54[_0x639943];return _0x190865;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}function getInteractionUsers(_0x136b14,_0x16631f){return new BPromise(function(_0x361bfa,_0x1127f8){try{if(_0x16631f[_0x136b14['id']]){_0x136b14[_0x47a5('0x2b')]=_[_0x47a5('0x2c')](_0x16631f[_0x136b14['id']],function(_0x528582){return{'id':_0x528582['id'],'fullname':_0x528582[_0x47a5('0x2d')]};});}}catch(_0x51833b){_0x1127f8(_0x51833b);}_0x361bfa(_0x136b14);});}function getInteractionTags(_0x2ef875,_0x9ac908){return new BPromise(function(_0x16901f,_0x4d6b57){try{if(_0x2ef875[_0x47a5('0x2e')]){_0x2ef875[_0x47a5('0x2f')]=[];_0x2ef875[_0x47a5('0x2e')][_0x47a5('0x30')](',')['forEach'](function(_0x50d875){_0x2ef875[_0x47a5('0x2f')][_0x47a5('0x31')](_0x9ac908[_0x50d875]);});}delete _0x2ef875['TagIds'];}catch(_0x4e1006){_0x4d6b57(_0x4e1006);}_0x16901f(_0x2ef875);});}function updateWhatsappInteraction(_0x836303,_0x51544e,_0x57bff6){return new BPromise(function(_0x42f70c,_0x53119b){return getInteractionUsers(_0x836303,_0x57bff6)[_0x47a5('0x26')](function(_0xd972c){return getInteractionTags(_0xd972c,_0x51544e);})['then'](function(_0x4843c0){_0x42f70c(_0x4843c0);})[_0x47a5('0x32')](function(_0x5910bb){_0x53119b(_0x5910bb);});});}exports[_0x47a5('0x33')]=function(_0x87e4c9,_0xf269a8){var _0x52749b={},_0x18f7e9={},_0x50c086={'count':0x0,'rows':[]};var _0x53c754=_[_0x47a5('0x2c')](db['WhatsappInteraction'][_0x47a5('0x34')],function(_0x5ef577){return{'name':_0x5ef577[_0x47a5('0x35')],'type':_0x5ef577[_0x47a5('0x36')][_0x47a5('0x37')]};});_0x18f7e9[_0x47a5('0x38')]=_[_0x47a5('0x2c')](_0x53c754,_0x47a5('0x29'));_0x18f7e9[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x87e4c9[_0x47a5('0x39')]);_0x18f7e9['filters']=_[_0x47a5('0x3b')](_0x18f7e9[_0x47a5('0x38')],_0x18f7e9['query']);_0x52749b[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x18f7e9[_0x47a5('0x38')],qs['fields'](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x3d')]));_0x52749b['attributes']=_0x52749b[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x52749b['attributes']:_0x18f7e9['model'];if(!_0x87e4c9['query'][_0x47a5('0x3f')]('nolimit')){_0x52749b[_0x47a5('0x1f')]=qs[_0x47a5('0x1f')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x1f')]);_0x52749b[_0x47a5('0x1e')]=qs[_0x47a5('0x1e')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x1e')]);}_0x52749b[_0x47a5('0x40')]=qs[_0x47a5('0x41')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x41')]);_0x52749b[_0x47a5('0x42')]=qs['filters'](_[_0x47a5('0x43')](_0x87e4c9[_0x47a5('0x39')],_0x18f7e9[_0x47a5('0x44')]),_0x53c754);var _0x23bd8d=[];var _0x586f4f=squel[_0x47a5('0x45')]()['field']('id')['field']('name')['field'](_0x47a5('0x46'))['from'](_0x47a5('0x47'));var _0x3a740b=squel[_0x47a5('0x45')]()['field'](_0x47a5('0x48'))[_0x47a5('0x49')]('u.fullname')['field'](_0x47a5('0x4a'))['from'](_0x47a5('0x4b'),'ui')[_0x47a5('0x4c')](_0x47a5('0x4d'),'u',_0x47a5('0x4e'));var _0x34a9ae=squel[_0x47a5('0x45')]()[_0x47a5('0x4f')](_0x47a5('0x50'),'i')[_0x47a5('0x4c')](_0x47a5('0x51'),'c',_0x47a5('0x52'))[_0x47a5('0x4c')](_0x47a5('0x4d'),'o',_0x47a5('0x53'))[_0x47a5('0x4c')](_0x47a5('0x54'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0x47a5('0x4c')](_0x47a5('0x55'),'me','me.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x47a5('0x56'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x47a5('0x4c')](_0x47a5('0x47'),'t','t.id\x20=\x20it.TagId');var _0x4f62d3=squel[_0x47a5('0x57')]();var _0x52d409=[];var _0x2d147c=squel[_0x47a5('0x57')]();var _0x3548bc;if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x58')]){_0x3548bc=as[_0x47a5('0x59')](_0x87e4c9[_0x47a5('0x39')]['search']);var _0x48a0ef=_0x3548bc[_0x47a5('0x5a')];for(var _0x411230=0x0;_0x411230<_0x3548bc[_0x47a5('0x5b')][_0x47a5('0x3e')];_0x411230++){var _0x2c7020=_0x3548bc[_0x47a5('0x5b')][_0x411230];var _0x249de5='i';var _0x492cf7=_[_0x47a5('0x5c')](_0x53c754,[_0x47a5('0x29'),_0x2c7020[_0x47a5('0x49')]]);if(!_0x492cf7){switch(_0x2c7020['field']){case _0x47a5('0x5d'):if(_0x2c7020['value']==0x1){_0x34a9ae[_0x47a5('0x5e')]('`'+_0x2c7020[_0x47a5('0x49')]+_0x47a5('0x5f'));}else{_0x34a9ae[_0x47a5('0x5e')]('`'+_0x2c7020['field']+_0x47a5('0x60'));}break;case _0x47a5('0x61'):if(_0x2c7020[_0x47a5('0x62')]===_0x47a5('0x63')){if(_0x2c7020[_0x47a5('0x64')][_0x47a5('0x30')]('\x20')[_0x47a5('0x3e')]>0x1){_0x4f62d3[_0x48a0ef]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x47a5('0x65')](_0x2c7020[_0x47a5('0x64')]),null);}else{var _0x187d7e='%'+_0x2c7020[_0x47a5('0x64')]+'%';_0x4f62d3[_0x48a0ef](_0x47a5('0x66'),_0x187d7e,_0x187d7e,_0x187d7e);}}else{_0x492cf7=_[_0x47a5('0x5c')](_0x53c754,['name',_0x47a5('0x67')]);_0x2c7020[_0x47a5('0x49')]=_0x47a5('0x67');_0x5cbe97=as['buildExpression'](_0x249de5,_0x492cf7[_0x47a5('0x36')],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')]['start'],_0x5cbe97['value'][_0x47a5('0x1b')]);}break;case _0x47a5('0x69'):var _0x4fa1da=_0x2c7020['value'][_0x47a5('0x30')](',')['map'](function(_0x16bb8a){return Number(_0x16bb8a);});_0x4fa1da['forEach'](function(_0x482de6){_0x2d147c['or'](_0x47a5('0x6a'),'%,'+_0x482de6+',%');});_0x52d409=_[_0x47a5('0x6b')](_0x52d409,_0x4fa1da);break;case'User':if(_0x2c7020[_0x47a5('0x62')]===_0x47a5('0x63')){_0x4f62d3[_0x48a0ef]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2c7020['value']+'%',null);}else{_0x492cf7=_[_0x47a5('0x5c')](_0x53c754,[_0x47a5('0x29'),_0x47a5('0x6c')]);_0x2c7020[_0x47a5('0x49')]='UserId';_0x5cbe97=as[_0x47a5('0x6d')](_0x249de5,_0x492cf7[_0x47a5('0x36')],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97['value'][_0x47a5('0x6e')],_0x5cbe97['value'][_0x47a5('0x1b')]);}break;case _0x47a5('0x6f'):_0x5cbe97=as[_0x47a5('0x6d')]('me',null,_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')]['start'],_0x5cbe97[_0x47a5('0x64')]['end']);break;}}else{var _0x5cbe97=as['buildExpression'](_0x249de5,_0x492cf7['type'],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')][_0x47a5('0x6e')],_0x5cbe97['value']['end']);}}}else{var _0x139229=_(_0x87e4c9[_0x47a5('0x39')])[_0x47a5('0x3a')]()[_0x47a5('0x2c')](function(_0xc45e25){return _['some'](_0x53c754,[_0x47a5('0x29'),_0xc45e25])?_0xc45e25:undefined;})['compact']()[_0x47a5('0x64')]();if(!_[_0x47a5('0x70')](_0x139229)){_0x139229['forEach'](function(_0x32b4de){if(_0x32b4de===_0x47a5('0x71')){_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x72'),[][_0x47a5('0x73')](_0x87e4c9[_0x47a5('0x39')][_0x32b4de]));}else if(_0x32b4de===_0x47a5('0x74')){var _0x3ac38c=JSON['parse'](_0x87e4c9[_0x47a5('0x39')][_0x32b4de])[_0x47a5('0x75')];var _0x3c75c6=JSON[_0x47a5('0x76')](_0x87e4c9[_0x47a5('0x39')][_0x32b4de])['$lte'];_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x77'),_0x3ac38c,_0x3c75c6);}else{if(_0x87e4c9[_0x47a5('0x39')][_0x32b4de]===_0x47a5('0x78')){_0x34a9ae[_0x47a5('0x42')]('i.'+_0x32b4de+_0x47a5('0x79'));}else{_0x34a9ae[_0x47a5('0x42')]('i.'+_0x32b4de+_0x47a5('0x7a'),_0x87e4c9[_0x47a5('0x39')][_0x32b4de]);}}});}if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7b')]){if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7b')]==0x1){_0x34a9ae[_0x47a5('0x5e')](_0x47a5('0x7c'));}else{_0x34a9ae['having'](_0x47a5('0x7d'));}}if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')]){_0x52d409=_['isArray'](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')])?_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')]:new Array(_0x87e4c9['query'][_0x47a5('0x7e')]);_0x52d409['forEach'](function(_0x2d5ee6){_0x2d147c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2d5ee6+',%');});}if(_0x87e4c9[_0x47a5('0x39')]['filter']){var _0x7c1190=_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7f')]['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0x47a5('0x80')](_0x7c1190)){_0x4f62d3['or'](_0x47a5('0x81'),_0x7c1190+'%')['or'](_0x47a5('0x82'),_0x7c1190+'%');}else{_0x4f62d3['or'](_0x47a5('0x83'),qs['getFullTextValue'](_0x7c1190))['or'](_0x47a5('0x84'),_0x7c1190+'%');}}}_0x34a9ae[_0x47a5('0x42')](_0x4f62d3);_0x34a9ae[_0x47a5('0x85')](_0x47a5('0x86'));var _0x308c9a={'type':db[_0x47a5('0x87')][_0x47a5('0x88')][_0x47a5('0x89')],'raw':!![]};var _0x4618a0=_0x34a9ae[_0x47a5('0x8a')]();_0x4618a0[_0x47a5('0x49')](_0x47a5('0x86'));_0x4618a0['field'](_0x47a5('0x8b'),'unreadMessages');if(_0x52749b[_0x47a5('0x40')]){_0x52749b[_0x47a5('0x40')][_0x47a5('0x8c')](function(_0x12fec9){_0x34a9ae[_0x47a5('0x40')]('i.'+_0x12fec9[0x0],_0x12fec9[0x1]===_0x47a5('0x8d')?![]:!![]);});}if(!_[_0x47a5('0x70')](_0x52d409)){_0x34a9ae[_0x47a5('0x5e')](_0x2d147c);_0x4618a0[_0x47a5('0x42')](_0x47a5('0x8e'),_0x52d409);}BPromise[_0x47a5('0x8f')]()[_0x47a5('0x26')](function(){if(!_0x3548bc){if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x71')]||_0x87e4c9[_0x47a5('0x39')]['journey'])return;_0x4618a0['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x34a9ae['where'](_0x47a5('0x90'));return;}return _0x87e4c9[_0x47a5('0x91')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x47a5('0x26')](function(_0x44dda2){if(_[_0x47a5('0x70')](_0x44dda2)){_0x4618a0[_0x47a5('0x42')](_0x47a5('0x92'));_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x92'));}else{_0x4618a0[_0x47a5('0x42')](_0x47a5('0x72'),_[_0x47a5('0x2c')](_0x44dda2,'id'));_0x34a9ae[_0x47a5('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0x47a5('0x2c')](_0x44dda2,'id'));}});})[_0x47a5('0x26')](function(){db[_0x47a5('0x93')]['query'](_0x4618a0[_0x47a5('0x94')](),_0x308c9a)[_0x47a5('0x26')](function(_0x17b61d){_0x50c086['count']=_0x17b61d[_0x47a5('0x3e')];if(_0x50c086['count']===0x0)return[];return db['sequelize'][_0x47a5('0x39')](_0x586f4f[_0x47a5('0x94')](),_0x308c9a)[_0x47a5('0x26')](function(_0x27333e){_0x23bd8d=_[_0x47a5('0x95')](_0x27333e,'id');_0x308c9a=_[_0x47a5('0x96')](_0x308c9a,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x87e4c9['query'][_0x47a5('0x3d')]){_0x52749b['attributes'][_0x47a5('0x8c')](function(_0x3fffd1){_0x34a9ae[_0x47a5('0x49')]('i.'+_0x3fffd1);});}else{_0x34a9ae[_0x47a5('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x47a5('0x5d'));_0x34a9ae['field']('a.key',_0x47a5('0x97'));_0x34a9ae[_0x47a5('0x49')]('a.mandatoryDisposition',_0x47a5('0x98'));_0x34a9ae[_0x47a5('0x49')](_0x47a5('0x99'));_0x34a9ae['field'](_0x47a5('0x9a'),'Contact.firstName');_0x34a9ae[_0x47a5('0x49')](_0x47a5('0x9b'),_0x47a5('0x9c'));_0x34a9ae['field'](_0x47a5('0x9d'),_0x47a5('0x9e'));_0x34a9ae[_0x47a5('0x49')]('c.phone',_0x47a5('0x9f'));_0x34a9ae['field'](_0x47a5('0xa0'),'Contact.mobile');_0x34a9ae[_0x47a5('0x49')](_0x47a5('0xa1'),_0x47a5('0xa2'));_0x34a9ae[_0x47a5('0x49')]('o.fullname',_0x47a5('0xa3'));_0x34a9ae[_0x47a5('0x49')](_0x47a5('0xa4'),_0x47a5('0xa5'));_0x34a9ae[_0x47a5('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x52749b[_0x47a5('0x1f')])_0x34a9ae['limit'](_0x52749b[_0x47a5('0x1f')]);if(_0x52749b[_0x47a5('0x1e')])_0x34a9ae[_0x47a5('0x1e')](_0x52749b['offset']);return db[_0x47a5('0x93')][_0x47a5('0x39')](_0x34a9ae['toString'](),_0x308c9a);})[_0x47a5('0x26')](function(_0x8a9dea){_0x3a740b[_0x47a5('0x42')](_0x47a5('0xa6'),_['map'](_0x8a9dea,'id'));return db['sequelize'][_0x47a5('0x39')](_0x3a740b[_0x47a5('0x94')](),_0x308c9a)['then'](function(_0x27d422){var _0x23f055=_['groupBy'](_0x27d422,_0x47a5('0xa7'));var _0x2a02cd=[];_0x8a9dea[_0x47a5('0x8c')](function(_0x59f010){_0x2a02cd[_0x47a5('0x31')](updateWhatsappInteraction(_0x59f010,_0x23bd8d,_0x23f055));});return BPromise['all'](_0x2a02cd);});});})[_0x47a5('0x26')](function(_0x5e2946){_0x50c086[_0x47a5('0xa8')]=_0x5e2946;return _0x50c086;})[_0x47a5('0x26')](respondWithFilteredResult(_0xf269a8,_0x52749b));})['catch'](handleError(_0xf269a8,null));};exports[_0x47a5('0xa9')]=function(_0x597cb2,_0x1eabef){var _0x36f619={'raw':![],'where':{'id':_0x597cb2[_0x47a5('0xaa')]['id']}},_0x37e045={};_0x37e045['model']=_[_0x47a5('0x3a')](db['WhatsappInteraction']['rawAttributes']);_0x37e045[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x597cb2[_0x47a5('0x39')]);_0x37e045[_0x47a5('0x44')]=_[_0x47a5('0x3b')](_0x37e045['model'],_0x37e045[_0x47a5('0x39')]);_0x36f619[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x37e045[_0x47a5('0x38')],qs['fields'](_0x597cb2[_0x47a5('0x39')]['fields']));_0x36f619[_0x47a5('0x3c')]=_0x36f619[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x36f619[_0x47a5('0x3c')]:_0x37e045[_0x47a5('0x38')];if(_0x597cb2[_0x47a5('0x39')][_0x47a5('0xab')]){_0x36f619[_0x47a5('0xac')]=[{'all':!![]}];}_0x36f619=_[_0x47a5('0x96')]({},_0x36f619,_0x597cb2['options']);return db[_0x47a5('0xad')][_0x47a5('0x5c')](_0x36f619)['then'](handleEntityNotFound(_0x1eabef,null))[_0x47a5('0x26')](respondWithResult(_0x1eabef,null))[_0x47a5('0x32')](handleError(_0x1eabef,null));};exports[_0x47a5('0xae')]=function(_0x5b85cd,_0x4bf1f5){return db[_0x47a5('0xad')][_0x47a5('0xae')](_0x5b85cd['body'],{})['then'](respondWithResult(_0x4bf1f5,0xc9))[_0x47a5('0x32')](handleError(_0x4bf1f5,null));};exports[_0x47a5('0x24')]=function(_0x54eab1,_0x29e384){if(_0x54eab1[_0x47a5('0x6f')]['id']){delete _0x54eab1['body']['id'];}return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x54eab1[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x29e384,null))[_0x47a5('0x26')](saveUpdates(_0x54eab1[_0x47a5('0x6f')],null))['then'](respondWithResult(_0x29e384,null))['catch'](handleError(_0x29e384,null));};exports['destroy']=function(_0x133b7a,_0xce5ada){return db['WhatsappInteraction'][_0x47a5('0x5c')]({'where':{'id':_0x133b7a[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0xce5ada,null))[_0x47a5('0x26')](removeEntity(_0xce5ada,null))[_0x47a5('0x32')](handleError(_0xce5ada,null));};exports['describe']=function(_0x3e7750,_0x548a06){return db['WhatsappInteraction']['describe']()[_0x47a5('0x26')](respondWithResult(_0x548a06,null))['catch'](handleError(_0x548a06,null));};exports[_0x47a5('0xaf')]=function(_0xf3edc8,_0x5a316e,_0x49f791){return db[_0x47a5('0xb0')][_0x47a5('0x5c')]({'where':{'id':_0xf3edc8[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x5a316e,null))[_0x47a5('0x26')](function(_0x581a87){if(_0x581a87){return _0x581a87[_0x47a5('0xaf')](_0xf3edc8[_0x47a5('0x6f')]['ids'],_[_0x47a5('0xb1')](_0xf3edc8[_0x47a5('0x6f')],[_0x47a5('0xb2'),'id'])||{});}})[_0x47a5('0x26')](respondWithResult(_0x5a316e,null))[_0x47a5('0x32')](handleError(_0x5a316e,null));};exports[_0x47a5('0xb3')]=function(_0x5112d7,_0x6a8174,_0x2e418d){var _0x50b236={'raw':![],'where':{}};var _0x263521={};var _0x9769b5={'count':0x0,'rows':[]};return db[_0x47a5('0xad')][_0x47a5('0xb4')]({'where':{'id':_0x5112d7['params']['id']}})['then'](handleEntityNotFound(_0x6a8174,null))['then'](function(_0x4eee99){if(_0x4eee99){_0x263521[_0x47a5('0x38')]=_[_0x47a5('0x3a')](db[_0x47a5('0xb0')][_0x47a5('0x34')]);_0x263521[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x5112d7[_0x47a5('0x39')]);_0x263521[_0x47a5('0x44')]=_['intersection'](_0x263521[_0x47a5('0x38')],_0x263521[_0x47a5('0x39')]);_0x50b236[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x263521['model'],qs['fields'](_0x5112d7[_0x47a5('0x39')]['fields']));_0x50b236['attributes']=_0x50b236[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x50b236['attributes']:_0x263521[_0x47a5('0x38')];if(!_0x5112d7[_0x47a5('0x39')][_0x47a5('0x3f')]('nolimit')){_0x50b236[_0x47a5('0x1f')]=qs[_0x47a5('0x1f')](_0x5112d7['query'][_0x47a5('0x1f')]);_0x50b236[_0x47a5('0x1e')]=qs[_0x47a5('0x1e')](_0x5112d7[_0x47a5('0x39')][_0x47a5('0x1e')]);}_0x50b236[_0x47a5('0x40')]=qs['sort'](_0x5112d7[_0x47a5('0x39')]['sort']);_0x50b236[_0x47a5('0x42')]=qs[_0x47a5('0x44')](_[_0x47a5('0x43')](_0x5112d7[_0x47a5('0x39')],_0x263521['filters']));_0x50b236[_0x47a5('0x42')][_0x47a5('0xa7')]=_0x4eee99['id'];if(_0x5112d7[_0x47a5('0x39')][_0x47a5('0x7f')]){_0x50b236[_0x47a5('0x42')]=_[_0x47a5('0x96')](_0x50b236[_0x47a5('0x42')],{'$or':_[_0x47a5('0x2c')](_0x50b236[_0x47a5('0x3c')],function(_0xa2045c){var _0x109738={};_0x109738[_0xa2045c]={'$like':'%'+_0x5112d7[_0x47a5('0x39')]['filter']+'%'};return _0x109738;})});}if(_0x5112d7[_0x47a5('0x39')][_0x47a5('0x75')]){var _0x591bde=_0x5112d7[_0x47a5('0x39')][_0x47a5('0x75')][_0x47a5('0x30')](',');var _0x2ccf21={};_0x2ccf21[_0x591bde[0x0]]={'$gte':moment(_0x591bde[0x1])[_0x47a5('0xb5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x50b236[_0x47a5('0x42')]=_[_0x47a5('0x96')](_0x50b236[_0x47a5('0x42')],_0x2ccf21);}_0x50b236=_[_0x47a5('0x96')]({},_0x50b236,_0x5112d7[_0x47a5('0xb6')]);return db[_0x47a5('0xb0')][_0x47a5('0x1d')]({'where':_0x50b236['where']})['then'](function(_0xa3d578){_0x9769b5['count']=_0xa3d578;if(_0x5112d7[_0x47a5('0x39')]['includeAll']){_0x50b236[_0x47a5('0xac')]=[{'all':!![]}];}return db[_0x47a5('0xb0')][_0x47a5('0xb7')](_0x50b236);})[_0x47a5('0x26')](function(_0x49cb8c){_0x9769b5[_0x47a5('0xa8')]=_0x49cb8c;return _0x9769b5;});}})[_0x47a5('0x26')](respondWithFilteredResult(_0x6a8174,_0x50b236))[_0x47a5('0x32')](handleError(_0x6a8174,null));};exports['addTags']=function(_0x581759,_0x30375f,_0x29015a){return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x581759[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x30375f,null))[_0x47a5('0x26')](function(_0xe662d7){if(_0xe662d7){return _0xe662d7['setTags'](_0x581759[_0x47a5('0x6f')]['ids'],_[_0x47a5('0xb1')](_0x581759[_0x47a5('0x6f')],['ids','id'])||{})['spread'](function(){return db[_0x47a5('0x69')][_0x47a5('0xb7')]({'attributes':['id','name',_0x47a5('0x46')],'where':{'id':_0x581759[_0x47a5('0x6f')][_0x47a5('0xb2')]}});})[_0x47a5('0x26')](function(_0x5a7f32){socket[_0x47a5('0xb8')]('whatsappInteractionTags:save',{'id':Number(_0x581759['params']['id']),'tags':_0x5a7f32||[]});return{'id':Number(_0x581759['params']['id']),'tags':_0x5a7f32||[]};});}})[_0x47a5('0x26')](respondWithResult(_0x30375f,null))['catch'](handleError(_0x30375f,null));};exports[_0x47a5('0xb9')]=function(_0x156d51,_0x401139,_0x2005d5){return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x156d51[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x401139,null))[_0x47a5('0x26')](function(_0x2200f9){if(_0x2200f9){return _0x2200f9[_0x47a5('0xb9')](_0x156d51[_0x47a5('0x39')][_0x47a5('0xb2')]);}})[_0x47a5('0x26')](respondWithStatusCode(_0x401139,null))[_0x47a5('0x32')](handleError(_0x401139,null));};exports['download']=function(_0xdd95c8,_0x40aee5){var _0x322cee=moment()[_0x47a5('0xba')]()['toString']();var _0x367662=path['join'](config[_0x47a5('0xbb')],'server',_0x47a5('0xbc'),_0x47a5('0xbd'));var _0x3b894d=path['join'](config[_0x47a5('0xbb')],_0x47a5('0xbe'),_0x47a5('0xbc'),'attachments');var _0x52798d=path[_0x47a5('0xbf')](_0x367662,_0x322cee);var _0x1a5e07=util[_0x47a5('0xb5')](_0x47a5('0xc0'),_0xdd95c8[_0x47a5('0xaa')]['id'],_0x322cee);var _0x579e5c=path[_0x47a5('0xbf')](_0x367662,_0x1a5e07);var _0x4b3ae4=[];_0x4b3ae4[_0x47a5('0x31')]({'model':db[_0x47a5('0xc1')],'as':_0x47a5('0xc1'),'attributes':['id',_0x47a5('0x2d')],'raw':!![]});_0x4b3ae4['push']({'model':db['CmContact'],'as':_0x47a5('0x61'),'attributes':['id',_0x47a5('0xc2'),_0x47a5('0xc3')],'raw':!![]});if(_0xdd95c8[_0x47a5('0x39')][_0x47a5('0xc4')]){_0x4b3ae4[_0x47a5('0x31')]({'model':db[_0x47a5('0xc5')],'as':_0x47a5('0xc5'),'raw':!![]});}var _0x2c2245=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0x47a5('0x6f'),'createdAt',_0x47a5('0xc6'),_0x47a5('0xc7'),_0x47a5('0x7b')],'include':_0x4b3ae4}];_0x2c2245['push']({'model':db[_0x47a5('0xc8')],'as':_0x47a5('0xc9'),'attributes':['id','name']});_0x2c2245[_0x47a5('0x31')]({'model':db['User'],'as':_0x47a5('0xca'),'attributes':['id',_0x47a5('0x2d')]});return db[_0x47a5('0xad')]['find']({'where':{'id':_0xdd95c8['params']['id']},'include':_0x2c2245})['then'](handleEntityNotFound(_0x40aee5,null))['then'](function(_0x5075a6){if(_0x5075a6){var _0x1ba5b6=_0x5075a6['get']({'plain':!![]});fs[_0x47a5('0xcb')](_0x52798d);var _0x2287b0={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x47a5('0xcc'),'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['format'](_0x47a5('0xcd'),_0x47a5('0xce'),_0x1ba5b6['id']),moment()[_0x47a5('0xb5')](_0x47a5('0xcf'))['toString']())}}};var _0xdda046={'channel':'Whatsapp','account':_0x1ba5b6[_0x47a5('0xc9')]['name'],'agent':_0x1ba5b6[_0x47a5('0xca')]?_0x1ba5b6[_0x47a5('0xca')][_0x47a5('0x2d')]:'N.A.','createdAt':moment(_0x1ba5b6[_0x47a5('0x74')])[_0x47a5('0xb5')](_0x47a5('0xd0'))[_0x47a5('0x94')](),'closedAt':_0x1ba5b6['closed']?moment(_0x1ba5b6[_0x47a5('0xd1')])[_0x47a5('0xb5')](_0x47a5('0xd0'))[_0x47a5('0x94')]():'','disposition':_0x1ba5b6[_0x47a5('0xd2')],'messages':_(_0x1ba5b6[_0x47a5('0xd3')])['filter']({'secret':![]})[_0x47a5('0x2c')](function(_0xe245ca){if(_0xe245ca[_0x47a5('0xc5')]){var _0xac8d4f=path[_0x47a5('0xbf')](_0x3b894d,_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')]);if(fs[_0x47a5('0xd5')](_0xac8d4f)){fs[_0x47a5('0xd6')](_0xac8d4f)[_0x47a5('0xd7')](fs[_0x47a5('0xd8')](path[_0x47a5('0xbf')](_0x52798d,_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')])));}}return{'date':moment(_0xe245ca[_0x47a5('0x74')])[_0x47a5('0xb5')](_0x47a5('0xd0'))['toString'](),'sender':_0xe245ca[_0x47a5('0xc6')]==='out'?_0xe245ca['User']?_0xe245ca[_0x47a5('0xc1')][_0x47a5('0x2d')]:_0x47a5('0xd9'):_0xe245ca['Contact'][_0x47a5('0xc2')]+(_0xe245ca[_0x47a5('0x61')][_0x47a5('0xc3')]?'\x20'+_0xe245ca[_0x47a5('0x61')][_0x47a5('0xc3')]:''),'body':_0xe245ca[_0x47a5('0xc5')]?_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')]:_0xe245ca[_0x47a5('0x6f')],'direction':_0xe245ca[_0x47a5('0xc6')]===_0x47a5('0xda')?'A':'C','secret':_0xe245ca[_0x47a5('0xc7')],'read':_0xe245ca[_0x47a5('0x7b')],'attachment':_0xe245ca['Attachment']};})['value']()};return ejs[_0x47a5('0xdb')](path['join'](config[_0x47a5('0xbb')],_0x47a5('0xbe'),_0x47a5('0xdc'),_0x47a5('0xdd')),{'interaction':_0xdda046})[_0x47a5('0x26')](function(_0x3708ea){return new BPromise(function(_0x583b37,_0x2b4039){pdf[_0x47a5('0xae')](_0x3708ea,_0x2287b0)[_0x47a5('0xde')](path['join'](_0x52798d,_0x47a5('0xdf')+_0x1ba5b6['id']+'-'+_0x322cee+_0x47a5('0xe0')),function(_0x3ecc41,_0x3e4148){if(_0x3ecc41)return _0x2b4039(_0x3ecc41);_0x583b37(_0x3e4148);});});})[_0x47a5('0x26')](function(){return new BPromise(function(_0x23e649,_0x35e20f){zipdir(_0x52798d,{'saveTo':_0x579e5c},function(_0x46615a,_0xd6e255){if(_0x46615a)return _0x35e20f(_0x46615a);return _0x23e649(_0xd6e255);});})[_0x47a5('0x26')](function(){return new BPromise(function(_0x1b91ad,_0x40b7a5){rimraf(_0x52798d,function(_0x28e998){if(_0x28e998)_0x40b7a5(_0x28e998);return _0x1b91ad();});});})[_0x47a5('0x26')](function(){return _0x40aee5[_0x47a5('0xe1')](_0x579e5c,_0x1a5e07,function(_0x3f7fdc){if(_0x3f7fdc){console[_0x47a5('0xe2')](_0x47a5('0xe3'),_0x3f7fdc);}else{fs[_0x47a5('0xe4')](_0x579e5c);}});});});}else{return _0x40aee5[_0x47a5('0x1a')](0xc8);}})[_0x47a5('0x32')](handleError(_0x40aee5,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index aa66da4..62e0e17 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 _0xc759=['WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','events','WhatsappInteraction','../../mysqldb'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0xc759,0x1d8));var _0x9c75=function(_0x281b36,_0xbe7388){_0x281b36=_0x281b36-0x0;var _0x3fa722=_0xc759[_0x281b36];return _0x3fa722;};'use strict';var EventEmitter=require(_0x9c75('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x9c75('0x1')];var WhatsappMessage=require(_0x9c75('0x2'))['db'][_0x9c75('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x9c75('0x4')](0x0);var events={'afterCreate':_0x9c75('0x5'),'afterUpdate':_0x9c75('0x6'),'afterDestroy':_0x9c75('0x7')};function emitEvent(_0x39a2ec){return function(_0x5ab19f,_0x5451b7,_0x2e3a99){_0x5ab19f[_0x9c75('0x8')]({'attributes':['id'],'raw':!![]})[_0x9c75('0x9')](function(_0x2db3db){_0x5ab19f[_0x9c75('0xa')](_0x9c75('0xb'),_0x2db3db[_0x9c75('0xc')](function(_0x42d6b0){return{'id':_0x42d6b0['id']};}));return WhatsappMessage[_0x9c75('0xd')]({'where':{'WhatsappInteractionId':_0x5ab19f['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x93935c){_0x5ab19f[_0x9c75('0xa')](_0x9c75('0xe'),_0x93935c[_0x9c75('0xf')]);WhatsappInteractionEvents['emit'](_0x39a2ec+':'+_0x5ab19f['id'],_0x5ab19f);WhatsappInteractionEvents[_0x9c75('0x10')](_0x39a2ec,_0x5ab19f);_0x2e3a99(null);})[_0x9c75('0x11')](_0x2e3a99(null));};}for(var e in events){if(events[_0x9c75('0x12')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x8b4c=['map','then','length','emit','catch','hasOwnProperty','exports','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users'];(function(_0x5396a1,_0x191c86){var _0x487a1e=function(_0x493835){while(--_0x493835){_0x5396a1['push'](_0x5396a1['shift']());}};_0x487a1e(++_0x191c86);}(_0x8b4c,0xb1));var _0xc8b4=function(_0x6dc069,_0x3c9b94){_0x6dc069=_0x6dc069-0x0;var _0x68396b=_0x8b4c[_0x6dc069];return _0x68396b;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xc8b4('0x0'))['db'][_0xc8b4('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0xc8b4('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xc8b4('0x3')](0x0);var events={'afterCreate':_0xc8b4('0x4'),'afterUpdate':_0xc8b4('0x5'),'afterDestroy':_0xc8b4('0x6')};function emitEvent(_0x19f5f6){return function(_0x2b5e13,_0xc9150e,_0x21c5d8){_0x2b5e13[_0xc8b4('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2172be){_0x2b5e13[_0xc8b4('0x8')](_0xc8b4('0x9'),_0x2172be[_0xc8b4('0xa')](function(_0x34b32d){return{'id':_0x34b32d['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x2b5e13['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc8b4('0xb')](function(_0x7a02ff){_0x2b5e13[_0xc8b4('0x8')]('unreadMessages',_0x7a02ff[_0xc8b4('0xc')]);WhatsappInteractionEvents[_0xc8b4('0xd')](_0x19f5f6+':'+_0x2b5e13['id'],_0x2b5e13);WhatsappInteractionEvents[_0xc8b4('0xd')](_0x19f5f6,_0x2b5e13);_0x21c5d8(null);})[_0xc8b4('0xe')](_0x21c5d8(null));};}for(var e in events){if(events[_0xc8b4('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xc8b4('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 76394fc..1f7da42 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(_0x218495,_0x386c45){var _0x4c33fb=function(_0x29febe){while(--_0x29febe){_0x218495['push'](_0x218495['shift']());}};_0x4c33fb(++_0x386c45);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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(_0x241308,_0x24f9dc){var _0x31ff91=function(_0x5598bf){while(--_0x5598bf){_0x241308['push'](_0x241308['shift']());}};_0x31ff91(++_0x24f9dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 b1d56d4..a4d99be 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 _0xd0d0=['WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','attributes','AddTagsToWhatsappInteraction','find','where','addTags','omit','spread','AddTags','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x23c2c3,_0x27ecc8){var _0x41e09f=function(_0x5e6873){while(--_0x5e6873){_0x23c2c3['push'](_0x23c2c3['shift']());}};_0x41e09f(++_0x27ecc8);}(_0xd0d0,0xe1));var _0x0d0d=function(_0x84f908,_0x425a60){_0x84f908=_0x84f908-0x0;var _0x5def0f=_0xd0d0[_0x84f908];return _0x5def0f;};'use strict';var _=require(_0x0d0d('0x0'));var util=require(_0x0d0d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d0d('0x2'));var db=require(_0x0d0d('0x3'))['db'];var utils=require(_0x0d0d('0x4'));var logger=require(_0x0d0d('0x5'))(_0x0d0d('0x6'));var config=require(_0x0d0d('0x7'));var jayson=require(_0x0d0d('0x8'));var client=jayson[_0x0d0d('0x9')][_0x0d0d('0xa')]({'port':0x232a});config[_0x0d0d('0xb')]=_['defaults'](config[_0x0d0d('0xb')],{'host':_0x0d0d('0xc'),'port':0x18eb});var socket=require(_0x0d0d('0xd'))(new Redis(config[_0x0d0d('0xb')]));require(_0x0d0d('0xe'))[_0x0d0d('0xf')](socket);function respondWithRpcPromise(_0x73f82,_0x3b0c63,_0x4da9cd){return new BPromise(function(_0x97a2b9,_0x32fff6){return client['request'](_0x73f82,_0x4da9cd)[_0x0d0d('0x10')](function(_0xd6c677){logger[_0x0d0d('0x11')](_0x0d0d('0x12'),_0x3b0c63,_0x0d0d('0x13'));logger[_0x0d0d('0x14')](_0x0d0d('0x15'),_0x3b0c63,'request\x20sent',JSON[_0x0d0d('0x16')](_0xd6c677));if(_0xd6c677[_0x0d0d('0x17')]){if(_0xd6c677[_0x0d0d('0x17')][_0x0d0d('0x18')]===0x1f4){logger[_0x0d0d('0x17')](_0x0d0d('0x12'),_0x3b0c63,_0xd6c677['error'][_0x0d0d('0x19')]);return _0x32fff6(_0xd6c677[_0x0d0d('0x17')][_0x0d0d('0x19')]);}logger[_0x0d0d('0x17')](_0x0d0d('0x12'),_0x3b0c63,_0xd6c677['error']['message']);return _0x97a2b9(_0xd6c677[_0x0d0d('0x17')][_0x0d0d('0x19')]);}else{logger[_0x0d0d('0x11')](_0x0d0d('0x12'),_0x3b0c63,_0x0d0d('0x13'));_0x97a2b9(_0xd6c677[_0x0d0d('0x1a')]['message']);}})[_0x0d0d('0x1b')](function(_0x3a7d54){logger[_0x0d0d('0x17')](_0x0d0d('0x12'),_0x3b0c63,_0x3a7d54);_0x32fff6(_0x3a7d54);});});}exports[_0x0d0d('0x1c')]=function(_0xcc5a7c){var _0x4cfa71=this;return new Promise(function(_0x3cada3,_0x5efd08){return db[_0x0d0d('0x1d')][_0x0d0d('0x1e')](_0xcc5a7c[_0x0d0d('0x1f')],{'raw':_0xcc5a7c['options']?_0xcc5a7c[_0x0d0d('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcc5a7c[_0x0d0d('0x20')]?_0xcc5a7c[_0x0d0d('0x20')]['where']||null:null,'attributes':_0xcc5a7c[_0x0d0d('0x20')]?_0xcc5a7c[_0x0d0d('0x20')][_0x0d0d('0x21')]||null:null,'limit':_0xcc5a7c[_0x0d0d('0x20')]?_0xcc5a7c[_0x0d0d('0x20')]['limit']||null:null})[_0x0d0d('0x10')](function(_0x51f06d){logger[_0x0d0d('0x11')]('UpdateWhatsappInteraction',_0xcc5a7c);logger[_0x0d0d('0x14')](_0x0d0d('0x1c'),_0xcc5a7c,JSON['stringify'](_0x51f06d));_0x3cada3(_0x51f06d);})[_0x0d0d('0x1b')](function(_0x16e0a0){logger[_0x0d0d('0x17')]('UpdateWhatsappInteraction',_0x16e0a0[_0x0d0d('0x19')],_0xcc5a7c);_0x5efd08(_0x4cfa71[_0x0d0d('0x17')](0x1f4,_0x16e0a0[_0x0d0d('0x19')]));});});};exports[_0x0d0d('0x22')]=function(_0x1b3177){return new Promise(function(_0xe25b0f,_0x34ea20){return db['WhatsappInteraction'][_0x0d0d('0x23')]({'where':_0x1b3177[_0x0d0d('0x20')]?_0x1b3177[_0x0d0d('0x20')][_0x0d0d('0x24')]||null:null})['then'](function(_0x18cabd){if(_0x18cabd){return _0x18cabd[_0x0d0d('0x25')](_0x1b3177[_0x0d0d('0x1f')]['ids'],_[_0x0d0d('0x26')](_0x1b3177['body'],['ids','id'])||{});}})[_0x0d0d('0x27')](function(_0x25a7f6){logger[_0x0d0d('0x11')]('AddTags',_0x1b3177);logger[_0x0d0d('0x14')](_0x0d0d('0x28'),_0x1b3177,JSON[_0x0d0d('0x16')](_0x25a7f6));_0xe25b0f(_0x25a7f6);})[_0x0d0d('0x1b')](function(_0x4e62d3){logger['error'](_0x0d0d('0x28'),_0x4e62d3[_0x0d0d('0x19')],_0x1b3177);_0x34ea20(_this[_0x0d0d('0x17')](0x1f4,_0x4e62d3['message']));});});}; \ No newline at end of file +var _0xbba4=['UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','then','AddTagsToWhatsappInteraction','find','addTags','omit','spread','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','./whatsappInteraction.socket','register','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x536dab,_0x2adec2){var _0xa97fdb=function(_0x28c79a){while(--_0x28c79a){_0x536dab['push'](_0x536dab['shift']());}};_0xa97fdb(++_0x2adec2);}(_0xbba4,0xa9));var _0x4bba=function(_0x383508,_0x4b6b97){_0x383508=_0x383508-0x0;var _0x5eddf5=_0xbba4[_0x383508];return _0x5eddf5;};'use strict';var _=require('lodash');var util=require(_0x4bba('0x0'));var moment=require('moment');var BPromise=require(_0x4bba('0x1'));var rs=require(_0x4bba('0x2'));var fs=require('fs');var Redis=require(_0x4bba('0x3'));var db=require(_0x4bba('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4bba('0x5'))(_0x4bba('0x6'));var config=require('../../config/environment');var jayson=require(_0x4bba('0x7'));var client=jayson[_0x4bba('0x8')][_0x4bba('0x9')]({'port':0x232a});config['redis']=_[_0x4bba('0xa')](config[_0x4bba('0xb')],{'host':_0x4bba('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4bba('0xd'))[_0x4bba('0xe')](socket);function respondWithRpcPromise(_0x449979,_0x960f30,_0x31469f){return new BPromise(function(_0x5cc00d,_0x837556){return client['request'](_0x449979,_0x31469f)['then'](function(_0x36b365){logger[_0x4bba('0xf')](_0x4bba('0x10'),_0x960f30,_0x4bba('0x11'));logger[_0x4bba('0x12')](_0x4bba('0x13'),_0x960f30,'request\x20sent',JSON[_0x4bba('0x14')](_0x36b365));if(_0x36b365[_0x4bba('0x15')]){if(_0x36b365[_0x4bba('0x15')][_0x4bba('0x16')]===0x1f4){logger[_0x4bba('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x960f30,_0x36b365[_0x4bba('0x15')][_0x4bba('0x17')]);return _0x837556(_0x36b365['error']['message']);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x960f30,_0x36b365[_0x4bba('0x15')]['message']);return _0x5cc00d(_0x36b365[_0x4bba('0x15')][_0x4bba('0x17')]);}else{logger['info'](_0x4bba('0x10'),_0x960f30,_0x4bba('0x11'));_0x5cc00d(_0x36b365[_0x4bba('0x18')][_0x4bba('0x17')]);}})[_0x4bba('0x19')](function(_0x7e4b10){logger['error'](_0x4bba('0x10'),_0x960f30,_0x7e4b10);_0x837556(_0x7e4b10);});});}exports[_0x4bba('0x1a')]=function(_0x3722d5){var _0x59745d=this;return new Promise(function(_0x5e8070,_0x159726){return db[_0x4bba('0x1b')][_0x4bba('0x1c')](_0x3722d5[_0x4bba('0x1d')],{'raw':_0x3722d5['options']?_0x3722d5[_0x4bba('0x1e')][_0x4bba('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3722d5[_0x4bba('0x1e')]?_0x3722d5['options']['where']||null:null,'attributes':_0x3722d5[_0x4bba('0x1e')]?_0x3722d5[_0x4bba('0x1e')]['attributes']||null:null,'limit':_0x3722d5[_0x4bba('0x1e')]?_0x3722d5['options']['limit']||null:null})[_0x4bba('0x20')](function(_0x42f5f8){logger[_0x4bba('0xf')](_0x4bba('0x1a'),_0x3722d5);logger[_0x4bba('0x12')]('UpdateWhatsappInteraction',_0x3722d5,JSON['stringify'](_0x42f5f8));_0x5e8070(_0x42f5f8);})[_0x4bba('0x19')](function(_0x28e608){logger[_0x4bba('0x15')](_0x4bba('0x1a'),_0x28e608[_0x4bba('0x17')],_0x3722d5);_0x159726(_0x59745d[_0x4bba('0x15')](0x1f4,_0x28e608[_0x4bba('0x17')]));});});};exports[_0x4bba('0x21')]=function(_0x5e1d0c){return new Promise(function(_0x342d6d,_0x4fcd8f){return db['WhatsappInteraction'][_0x4bba('0x22')]({'where':_0x5e1d0c[_0x4bba('0x1e')]?_0x5e1d0c[_0x4bba('0x1e')]['where']||null:null})[_0x4bba('0x20')](function(_0x66c9d1){if(_0x66c9d1){return _0x66c9d1[_0x4bba('0x23')](_0x5e1d0c[_0x4bba('0x1d')]['ids'],_[_0x4bba('0x24')](_0x5e1d0c[_0x4bba('0x1d')],['ids','id'])||{});}})[_0x4bba('0x25')](function(_0xfa44b8){logger['info'](_0x4bba('0x26'),_0x5e1d0c);logger['debug']('AddTags',_0x5e1d0c,JSON[_0x4bba('0x14')](_0xfa44b8));_0x342d6d(_0xfa44b8);})[_0x4bba('0x19')](function(_0x4c7390){logger['error'](_0x4bba('0x26'),_0x4c7390[_0x4bba('0x17')],_0x5e1d0c);_0x4fcd8f(_this[_0x4bba('0x15')](0x1f4,_0x4c7390['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index c1fb2c4..8c2947c 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 _0x8e6e=['./whatsappInteraction.events','save','remove','removeListener','register','length','whatsappInteraction:'];(function(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0x8e6e,0x165));var _0xe8e6=function(_0x3a23c1,_0x495d49){_0x3a23c1=_0x3a23c1-0x0;var _0x286863=_0x8e6e[_0x3a23c1];return _0x286863;};'use strict';var WhatsappInteractionEvents=require(_0xe8e6('0x0'));var events=[_0xe8e6('0x1'),_0xe8e6('0x2'),'update'];function createListener(_0x52c349,_0x287bd6){return function(_0x11cd90){_0x287bd6['emit'](_0x52c349,_0x11cd90);};}function removeListener(_0xa2cde2,_0x4050da){return function(){WhatsappInteractionEvents[_0xe8e6('0x3')](_0xa2cde2,_0x4050da);};}exports[_0xe8e6('0x4')]=function(_0x7401b){for(var _0x3a746a=0x0,_0xe931c9=events[_0xe8e6('0x5')];_0x3a746a<_0xe931c9;_0x3a746a++){var _0x361c5a=events[_0x3a746a];var _0x2aa759=createListener(_0xe8e6('0x6')+_0x361c5a,_0x7401b);WhatsappInteractionEvents['on'](_0x361c5a,_0x2aa759);}}; \ No newline at end of file +var _0x1b0b=['emit','removeListener','register','length','whatsappInteraction:','update'];(function(_0x4ce82e,_0x1ee3d4){var _0x52476e=function(_0x37d908){while(--_0x37d908){_0x4ce82e['push'](_0x4ce82e['shift']());}};_0x52476e(++_0x1ee3d4);}(_0x1b0b,0x179));var _0xb1b0=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x1b0b[_0x5f1391];return _0x50ebe3;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save','remove',_0xb1b0('0x0')];function createListener(_0x16b208,_0x39c142){return function(_0x54783d){_0x39c142[_0xb1b0('0x1')](_0x16b208,_0x54783d);};}function removeListener(_0x18f1e6,_0x16ab80){return function(){WhatsappInteractionEvents[_0xb1b0('0x2')](_0x18f1e6,_0x16ab80);};}exports[_0xb1b0('0x3')]=function(_0x8e46c3){for(var _0x4357bb=0x0,_0xb3822=events[_0xb1b0('0x4')];_0x4357bb<_0xb3822;_0x4357bb++){var _0x38de46=events[_0x4357bb];var _0xee58c8=createListener(_0xb1b0('0x5')+_0x38de46,_0x8e46c3);WhatsappInteractionEvents['on'](_0x38de46,_0xee58c8);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index d233206..c200630 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 _0x3949=['/:id/status','status','put','update','/:id/accept','accept','reject','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','whatsapp','whatsappmessage:create'];(function(_0x3f4098,_0x3365b2){var _0x3d5d0c=function(_0x3a7cdb){while(--_0x3a7cdb){_0x3f4098['push'](_0x3f4098['shift']());}};_0x3d5d0c(++_0x3365b2);}(_0x3949,0x6d));var _0x9394=function(_0x37eb5c,_0x477cc0){_0x37eb5c=_0x37eb5c-0x0;var _0x243e31=_0x3949[_0x37eb5c];return _0x243e31;};'use strict';var multer=require(_0x9394('0x0'));var util=require(_0x9394('0x1'));var path=require(_0x9394('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9394('0x3')]();var auth=require(_0x9394('0x4'));var interaction=require(_0x9394('0x5'));var config=require(_0x9394('0x6'));var controller=require('./whatsappMessage.controller');router[_0x9394('0x7')]('/',auth[_0x9394('0x8')](),controller['index']);router[_0x9394('0x7')](_0x9394('0x9'),auth[_0x9394('0x8')](),controller[_0x9394('0xa')]);router[_0x9394('0x7')](_0x9394('0xb'),auth['isAuthenticated'](),controller[_0x9394('0xc')]);router[_0x9394('0xd')]('/',auth[_0x9394('0x8')](),interaction['tracked'](_0x9394('0xe'),_0x9394('0xf')),controller['create']);router[_0x9394('0xd')](_0x9394('0x10'),controller[_0x9394('0x11')]);router[_0x9394('0x12')](_0x9394('0xb'),auth[_0x9394('0x8')](),controller[_0x9394('0x13')]);router[_0x9394('0x12')](_0x9394('0x14'),auth[_0x9394('0x8')](),controller[_0x9394('0x15')]);router['put']('/:id/reject',auth[_0x9394('0x8')](),controller[_0x9394('0x16')]);router[_0x9394('0x17')](_0x9394('0xb'),auth['isAuthenticated'](),controller[_0x9394('0x18')]);module['exports']=router; \ No newline at end of file +var _0xaea1=['../../components/interaction/service','index','get','/describe','isAuthenticated','describe','/:id','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','/:id/accept','accept','reject','delete','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x314c68,_0x30f2f1){var _0x289247=function(_0x3bb1a7){while(--_0x3bb1a7){_0x314c68['push'](_0x314c68['shift']());}};_0x289247(++_0x30f2f1);}(_0xaea1,0x194));var _0x1aea=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaea1[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x1aea('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1aea('0x1'));var express=require(_0x1aea('0x2'));var router=express[_0x1aea('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1aea('0x4'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1aea('0x5')]);router[_0x1aea('0x6')](_0x1aea('0x7'),auth[_0x1aea('0x8')](),controller[_0x1aea('0x9')]);router[_0x1aea('0x6')](_0x1aea('0xa'),auth[_0x1aea('0x8')](),controller['show']);router[_0x1aea('0xb')]('/',auth['isAuthenticated'](),interaction[_0x1aea('0xc')](_0x1aea('0xd'),_0x1aea('0xe')),controller[_0x1aea('0xf')]);router['post'](_0x1aea('0x10'),controller['status']);router[_0x1aea('0x11')](_0x1aea('0xa'),auth[_0x1aea('0x8')](),controller['update']);router[_0x1aea('0x11')](_0x1aea('0x12'),auth[_0x1aea('0x8')](),controller[_0x1aea('0x13')]);router[_0x1aea('0x11')]('/:id/reject',auth[_0x1aea('0x8')](),controller[_0x1aea('0x14')]);router[_0x1aea('0x15')](_0x1aea('0xa'),auth['isAuthenticated'](),controller[_0x1aea('0x16')]);module[_0x1aea('0x17')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index a7a0bf7..e47186b 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 _0x02b3=['ENUM','out','STRING','sequelize','medium','BOOLEAN'];(function(_0x1c452f,_0x49dbb8){var _0x40db4e=function(_0x177108){while(--_0x177108){_0x1c452f['push'](_0x1c452f['shift']());}};_0x40db4e(++_0x49dbb8);}(_0x02b3,0x171));var _0x302b=function(_0x4ce028,_0x526d4b){_0x4ce028=_0x4ce028-0x0;var _0x583d0c=_0x02b3[_0x4ce028];return _0x583d0c;};'use strict';var Sequelize=require(_0x302b('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x302b('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x302b('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x302b('0x3')]('in',_0x302b('0x4')),'defaultValue':_0x302b('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x302b('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x302b('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xa61c=['out','STRING','DATE','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x2ddd62,_0x1dfc4d){var _0x3404f8=function(_0x50dd64){while(--_0x50dd64){_0x2ddd62['push'](_0x2ddd62['shift']());}};_0x3404f8(++_0x1dfc4d);}(_0xa61c,0x1ab));var _0xca61=function(_0xec0191,_0x553734){_0xec0191=_0xec0191-0x0;var _0x5cb1db=_0xa61c[_0xec0191];return _0x5cb1db;};'use strict';var Sequelize=require('sequelize');module[_0xca61('0x0')]={'body':{'type':Sequelize[_0xca61('0x1')](_0xca61('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xca61('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xca61('0x4')]('in',_0xca61('0x5')),'defaultValue':_0xca61('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xca61('0x6')](0xbe)},'phone':{'type':Sequelize[_0xca61('0x6')]},'readAt':{'type':Sequelize[_0xca61('0x7')]},'secret':{'type':Sequelize[_0xca61('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index e4d91db..5a18737 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 _0x136d=['rejectMessage','SIP/%s','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','type','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','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','defaults','redis','./whatsappMessage.socket','register','jayson/promise','http','client','test','ValidationError','request','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','Content-Range','apply','save','update','then','stack','name','send','map','rawAttributes','keys','filters','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','WhatsappMessage','count','includeAll','include','findAll','rows','show','params','options','create','body','destroy','find','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','CmContact','Contact','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','interaction','user','AcceptMessage','manual','interface','channel','event','EventManager','acceptmessage','reject','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null'];(function(_0x112236,_0x2d9819){var _0x19bfea=function(_0x51819e){while(--_0x51819e){_0x112236['push'](_0x112236['shift']());}};_0x19bfea(++_0x2d9819);}(_0x136d,0x92));var _0xd136=function(_0x310eb9,_0x1aed15){_0x310eb9=_0x310eb9-0x0;var _0x28915c=_0x136d[_0x310eb9];return _0x28915c;};'use strict';var pdf=require(_0xd136('0x0'));var emlformat=require(_0xd136('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd136('0x2'));var rp=require(_0xd136('0x3'));var moment=require(_0xd136('0x4'));var BPromise=require(_0xd136('0x5'));var Mustache=require(_0xd136('0x6'));var util=require('util');var path=require(_0xd136('0x7'));var sox=require(_0xd136('0x8'));var csv=require(_0xd136('0x9'));var ejs=require(_0xd136('0xa'));var fs=require('fs');var _=require(_0xd136('0xb'));var squel=require(_0xd136('0xc'));var crypto=require(_0xd136('0xd'));var jsforce=require(_0xd136('0xe'));var deskjs=require(_0xd136('0xf'));var toCsv=require(_0xd136('0x9'));var querystring=require(_0xd136('0x10'));var Papa=require(_0xd136('0x11'));var Redis=require(_0xd136('0x12'));var authService=require(_0xd136('0x13'));var qs=require(_0xd136('0x14'));var as=require(_0xd136('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd136('0x16'))(_0xd136('0x17'));var utils=require(_0xd136('0x18'));var config=require(_0xd136('0x19'));var db=require(_0xd136('0x1a'))['db'];config['redis']=_[_0xd136('0x1b')](config[_0xd136('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd136('0x1d'))[_0xd136('0x1e')](socket);var jayson=require(_0xd136('0x1f'));var client=jayson['client'][_0xd136('0x20')]({'port':0x232c});var client9002=jayson[_0xd136('0x21')][_0xd136('0x20')]({'port':0x232a});function checkPasswordPattern(_0x43bcd3,_0x418c7a,_0x1abbe9){if(_0x1abbe9){var _0x2271bd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2271bd[_0xd136('0x22')](_0x418c7a)){return _0x43bcd3;}else{throw new db['Sequelize'][(_0xd136('0x23'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x43bcd3;}}function respondWithRpcPromise(_0x341a49,_0x13bd96,_0xaefaa,_0x876e36){return new BPromise(function(_0x5a3fa3,_0x5d4ce9){var _0x159b88=_0x876e36||client;return _0x159b88[_0xd136('0x24')](_0x341a49,_0xaefaa)['then'](function(_0x3c1b02){logger['info'](_0xd136('0x25'),_0x13bd96,_0xd136('0x26'));logger[_0xd136('0x27')](_0xd136('0x28'),_0x13bd96,_0xd136('0x26'),JSON[_0xd136('0x29')](_0x3c1b02));if(_0x3c1b02[_0xd136('0x2a')]){if(_0x3c1b02['error'][_0xd136('0x2b')]===0x1f4){logger[_0xd136('0x2a')](_0xd136('0x25'),_0x13bd96,_0x3c1b02[_0xd136('0x2a')][_0xd136('0x2c')]);return _0x5d4ce9(_0x3c1b02[_0xd136('0x2a')][_0xd136('0x2c')]);}logger[_0xd136('0x2a')](_0xd136('0x25'),_0x13bd96,_0x3c1b02[_0xd136('0x2a')][_0xd136('0x2c')]);return _0x5a3fa3(_0x3c1b02['error'][_0xd136('0x2c')]);}else{logger[_0xd136('0x2d')](_0xd136('0x25'),_0x13bd96,'request\x20sent');_0x5a3fa3(_0x3c1b02[_0xd136('0x2e')][_0xd136('0x2c')]);}})[_0xd136('0x2f')](function(_0x253e89){logger[_0xd136('0x2a')](_0xd136('0x25'),_0x13bd96,_0x253e89);_0x5d4ce9(_0x253e89);});});}function respondWithStatusCode(_0x23f103,_0x2c52f4){_0x2c52f4=_0x2c52f4||0xcc;return function(_0x5d74c2){if(_0x5d74c2){return _0x23f103[_0xd136('0x30')](_0x2c52f4);}return _0x23f103[_0xd136('0x31')](_0x2c52f4)[_0xd136('0x32')]();};}function respondWithResult(_0x3ab10d,_0xba0454){_0xba0454=_0xba0454||0xc8;return function(_0x320f8f){if(_0x320f8f){return _0x3ab10d[_0xd136('0x31')](_0xba0454)[_0xd136('0x33')](_0x320f8f);}};}function respondWithFilteredResult(_0x15cffb,_0x3917dc){return function(_0x5e5d69){if(_0x5e5d69){var _0x35b306=_0x5e5d69['count'],_0x555313=_0x3917dc[_0xd136('0x34')],_0x17d7ea=_0x3917dc['offset']+_0x3917dc['limit'],_0x3d58db;if(_0x17d7ea>=_0x35b306){_0x17d7ea=_0x35b306;_0x3d58db=0xc8;}else{_0x3d58db=0xce;}_0x15cffb[_0xd136('0x31')](_0x3d58db);return _0x15cffb['set'](_0xd136('0x35'),_0x555313+'-'+_0x17d7ea+'/'+_0x35b306)[_0xd136('0x33')](_0x5e5d69);}return null;};}function patchUpdates(_0xf995d8){return function(_0x107a9c){try{jsonpatch[_0xd136('0x36')](_0x107a9c,_0xf995d8,!![]);}catch(_0x147d29){return BPromise['reject'](_0x147d29);}return _0x107a9c[_0xd136('0x37')]();};}function saveUpdates(_0x331e44,_0xa6278d){return function(_0x3d618d){if(_0x3d618d){return _0x3d618d[_0xd136('0x38')](_0x331e44)[_0xd136('0x39')](function(_0xa716e){return _0xa716e;});}return null;};}function removeEntity(_0x525382,_0x2b7da4){return function(_0x222848){if(_0x222848){return _0x222848['destroy']()[_0xd136('0x39')](function(){_0x525382[_0xd136('0x31')](0xcc)[_0xd136('0x32')]();});}};}function handleEntityNotFound(_0x32c209,_0x3c74e3){return function(_0x35fd35){if(!_0x35fd35){_0x32c209[_0xd136('0x30')](0x194);}return _0x35fd35;};}function handleError(_0x4dbf1a,_0x1b6421){_0x1b6421=_0x1b6421||0x1f4;return function(_0x1c568c){logger['error'](_0x1c568c[_0xd136('0x3a')]);if(_0x1c568c['name']){delete _0x1c568c[_0xd136('0x3b')];}_0x4dbf1a[_0xd136('0x31')](_0x1b6421)[_0xd136('0x3c')](_0x1c568c);};}exports['index']=function(_0x333431,_0x22c464){var _0x55a761={},_0x1b6ee7={},_0x2caa39={'count':0x0,'rows':[]};var _0x52d3e9=_[_0xd136('0x3d')](db['WhatsappMessage'][_0xd136('0x3e')],function(_0x4c2331){return{'name':_0x4c2331['fieldName'],'type':_0x4c2331['type']['key']};});_0x1b6ee7['model']=_[_0xd136('0x3d')](_0x52d3e9,'name');_0x1b6ee7['query']=_[_0xd136('0x3f')](_0x333431['query']);_0x1b6ee7[_0xd136('0x40')]=_['intersection'](_0x1b6ee7[_0xd136('0x41')],_0x1b6ee7[_0xd136('0x42')]);_0x55a761['attributes']=_[_0xd136('0x43')](_0x1b6ee7['model'],qs[_0xd136('0x44')](_0x333431[_0xd136('0x42')][_0xd136('0x44')]));_0x55a761[_0xd136('0x45')]=_0x55a761['attributes'][_0xd136('0x46')]?_0x55a761[_0xd136('0x45')]:_0x1b6ee7[_0xd136('0x41')];if(!_0x333431[_0xd136('0x42')][_0xd136('0x47')](_0xd136('0x48'))){_0x55a761[_0xd136('0x49')]=qs[_0xd136('0x49')](_0x333431['query'][_0xd136('0x49')]);_0x55a761[_0xd136('0x34')]=qs['offset'](_0x333431['query']['offset']);}_0x55a761[_0xd136('0x4a')]=qs[_0xd136('0x4b')](_0x333431[_0xd136('0x42')][_0xd136('0x4b')]);_0x55a761['where']=qs[_0xd136('0x40')](_[_0xd136('0x4c')](_0x333431[_0xd136('0x42')],_0x1b6ee7['filters']),_0x52d3e9);if(_0x333431['query'][_0xd136('0x4d')]){_0x55a761[_0xd136('0x4e')]=_['merge'](_0x55a761[_0xd136('0x4e')],{'$or':_[_0xd136('0x3d')](_0x52d3e9,function(_0x4f341b){if(_0x4f341b['type']!==_0xd136('0x4f')){var _0x21cf74={};_0x21cf74[_0x4f341b[_0xd136('0x3b')]]={'$like':'%'+_0x333431[_0xd136('0x42')][_0xd136('0x4d')]+'%'};return _0x21cf74;}})});}_0x55a761=_['merge']({},_0x55a761,_0x333431['options']);var _0x23e248={'where':_0x55a761[_0xd136('0x4e')]};return db[_0xd136('0x50')][_0xd136('0x51')](_0x23e248)[_0xd136('0x39')](function(_0x150c38){_0x2caa39[_0xd136('0x51')]=_0x150c38;if(_0x333431['query'][_0xd136('0x52')]){_0x55a761[_0xd136('0x53')]=[{'all':!![]}];}return db[_0xd136('0x50')][_0xd136('0x54')](_0x55a761);})['then'](function(_0x500ab1){_0x2caa39[_0xd136('0x55')]=_0x500ab1;return _0x2caa39;})[_0xd136('0x39')](respondWithFilteredResult(_0x22c464,_0x55a761))[_0xd136('0x2f')](handleError(_0x22c464,null));};exports[_0xd136('0x56')]=function(_0x2b425b,_0x571358){var _0x10b75f={'raw':!![],'where':{'id':_0x2b425b[_0xd136('0x57')]['id']}},_0x17a796={};_0x17a796[_0xd136('0x41')]=_[_0xd136('0x3f')](db[_0xd136('0x50')][_0xd136('0x3e')]);_0x17a796['query']=_[_0xd136('0x3f')](_0x2b425b['query']);_0x17a796[_0xd136('0x40')]=_['intersection'](_0x17a796[_0xd136('0x41')],_0x17a796[_0xd136('0x42')]);_0x10b75f['attributes']=_['intersection'](_0x17a796[_0xd136('0x41')],qs[_0xd136('0x44')](_0x2b425b[_0xd136('0x42')][_0xd136('0x44')]));_0x10b75f[_0xd136('0x45')]=_0x10b75f[_0xd136('0x45')]['length']?_0x10b75f[_0xd136('0x45')]:_0x17a796['model'];if(_0x2b425b[_0xd136('0x42')]['includeAll']){_0x10b75f['include']=[{'all':!![]}];}_0x10b75f=_['merge']({},_0x10b75f,_0x2b425b[_0xd136('0x58')]);return db[_0xd136('0x50')]['find'](_0x10b75f)[_0xd136('0x39')](handleEntityNotFound(_0x571358,null))['then'](respondWithResult(_0x571358,null))[_0xd136('0x2f')](handleError(_0x571358,null));};exports[_0xd136('0x59')]=function(_0x404f70,_0x1e96f2){return db['WhatsappMessage'][_0xd136('0x59')](_0x404f70[_0xd136('0x5a')],{})[_0xd136('0x39')](respondWithResult(_0x1e96f2,0xc9))[_0xd136('0x2f')](handleError(_0x1e96f2,null));};exports[_0xd136('0x38')]=function(_0x5ece0d,_0x2eaca4){if(_0x5ece0d[_0xd136('0x5a')]['id']){delete _0x5ece0d[_0xd136('0x5a')]['id'];}return db[_0xd136('0x50')]['find']({'where':{'id':_0x5ece0d[_0xd136('0x57')]['id']}})[_0xd136('0x39')](handleEntityNotFound(_0x2eaca4,null))[_0xd136('0x39')](saveUpdates(_0x5ece0d[_0xd136('0x5a')],null))[_0xd136('0x39')](respondWithResult(_0x2eaca4,null))[_0xd136('0x2f')](handleError(_0x2eaca4,null));};exports[_0xd136('0x5b')]=function(_0x3c3254,_0x3c7493){return db[_0xd136('0x50')][_0xd136('0x5c')]({'where':{'id':_0x3c3254[_0xd136('0x57')]['id']}})['then'](handleEntityNotFound(_0x3c7493,null))['then'](removeEntity(_0x3c7493,null))[_0xd136('0x2f')](handleError(_0x3c7493,null));};exports['describe']=function(_0x1a3e94,_0x232b5b){return db['WhatsappMessage']['describe']()[_0xd136('0x39')](respondWithResult(_0x232b5b,null))[_0xd136('0x2f')](handleError(_0x232b5b,null));};var interaction_log=require(_0xd136('0x16'))(_0xd136('0x5d'));exports[_0xd136('0x5e')]=function(_0x2360d2,_0x28df57,_0x47d649){var _0x16e534={'channel':_0xd136('0x5f')};if(_0x2360d2[_0xd136('0x5a')]['id']){delete _0x2360d2[_0xd136('0x5a')]['id'];}_0x2360d2[_0xd136('0x5a')][_0xd136('0x60')]=!![];_0x2360d2[_0xd136('0x5a')][_0xd136('0x61')]=moment()[_0xd136('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x2360d2[_0xd136('0x5a')][_0xd136('0x63')]=_0x2360d2['body'][_0xd136('0x63')]||_0x2360d2['user']['id'];return db['WhatsappMessage'][_0xd136('0x5c')]({'where':{'id':_0x2360d2['params']['id'],'UserId':null},'include':[{'model':db[_0xd136('0x64')],'as':_0xd136('0x65')}]})[_0xd136('0x39')](handleEntityNotFound(_0x28df57,null))[_0xd136('0x39')](saveUpdates(_0x2360d2['body'],null))[_0xd136('0x39')](function(_0x1ec983){if(_0x1ec983){_0x16e534[_0xd136('0x2c')]=_0x1ec983[_0xd136('0x66')]({'plain':!![]});return db[_0xd136('0x67')][_0xd136('0x5c')]({'where':{'id':_0x1ec983[_0xd136('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x28df57,null))[_0xd136('0x39')](function(_0x1399e0){if(_0x1399e0){return _0x1399e0[_0xd136('0x38')]({'UserId':_0x2360d2['body'][_0xd136('0x63')],'read1stAt':_['isNil'](_0x1399e0[_0xd136('0x69')])?moment()[_0xd136('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xd136('0x39')](function(_0x164c31){if(_0x164c31){_0x16e534[_0xd136('0x6a')]=_0x164c31['get']({'plain':!![]});interaction_log[_0xd136('0x2d')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2360d2['user']['id'],_0x2360d2[_0xd136('0x6b')][_0xd136('0x3b')],_0x2360d2[_0xd136('0x6b')]['role'],_0x16e534[_0xd136('0x6a')]['id'],_0x2360d2[_0xd136('0x5a')]?JSON[_0xd136('0x29')](_0x2360d2[_0xd136('0x5a')]):'null');return respondWithRpcPromise(_0xd136('0x6c'),'acceptMessage',_0x16e534);}return null;})['then'](function(_0x5f3c28){if(_0x5f3c28){if(_0x2360d2[_0xd136('0x5a')][_0xd136('0x6d')]){_0x16e534['message'][_0xd136('0x6e')]=util[_0xd136('0x62')]('SIP/%s',_0x2360d2['user']['name']);_0x16e534[_0xd136('0x2c')][_0xd136('0x6f')]=_0x16e534['channel'];_0x16e534[_0xd136('0x2c')][_0xd136('0x70')]='accept';return respondWithRpcPromise(_0xd136('0x71'),'EventManager',{'event':_0xd136('0x72'),'message':_0x16e534[_0xd136('0x2c')]},client9002)[_0xd136('0x39')](function(){return _0x16e534;});}return _0x16e534;}return null;})[_0xd136('0x39')](respondWithResult(_0x28df57,null))[_0xd136('0x2f')](handleError(_0x28df57,null));};var interaction_log=require(_0xd136('0x16'))(_0xd136('0x5d'));exports[_0xd136('0x73')]=function(_0x5c76c5,_0x307298,_0x2b631a){var _0x348c01={'agent':{},'channel':_0xd136('0x5f')};if(_0x5c76c5[_0xd136('0x5a')]['id']){delete _0x5c76c5[_0xd136('0x5a')]['id'];}_0x5c76c5[_0xd136('0x5a')]['UserId']=_0x5c76c5[_0xd136('0x5a')][_0xd136('0x63')]||_0x5c76c5[_0xd136('0x6b')]['id'];_0x348c01[_0xd136('0x74')]['id']=_0x5c76c5[_0xd136('0x5a')][_0xd136('0x63')];return db[_0xd136('0x50')][_0xd136('0x5c')]({'where':{'id':_0x5c76c5[_0xd136('0x57')]['id'],'UserId':null}})[_0xd136('0x39')](handleEntityNotFound(_0x307298,null))[_0xd136('0x39')](function(_0x1d65fb){if(_0x1d65fb){_0x348c01[_0xd136('0x2c')]=_0x1d65fb['get']({'plain':!![]});return db[_0xd136('0x67')][_0xd136('0x5c')]({'where':{'id':_0x1d65fb[_0xd136('0x68')]}});}return null;})[_0xd136('0x39')](handleEntityNotFound(_0x307298,null))['then'](function(_0x76c2da){if(_0x76c2da){_0x348c01[_0xd136('0x6a')]=_0x76c2da[_0xd136('0x66')]({'plain':!![]});interaction_log['info'](_0xd136('0x75'),_0x5c76c5[_0xd136('0x6b')]['id'],_0x5c76c5['user'][_0xd136('0x3b')],_0x5c76c5[_0xd136('0x6b')][_0xd136('0x76')],_0x348c01[_0xd136('0x6a')]['id'],_0x5c76c5['body']?JSON['stringify'](_0x5c76c5[_0xd136('0x5a')]):_0xd136('0x77'));return respondWithRpcPromise('RejectMessage',_0xd136('0x78'),_0x348c01);}return null;})[_0xd136('0x39')](function(_0x3d43ef){if(_0x3d43ef){_0x3d43ef[_0xd136('0x2c')][_0xd136('0x6e')]=util['format'](_0xd136('0x79'),_0x5c76c5['user'][_0xd136('0x3b')]);_0x3d43ef['message']['channel']=_0x348c01[_0xd136('0x6f')];_0x3d43ef[_0xd136('0x2c')][_0xd136('0x70')]=_0xd136('0x73');respondWithRpcPromise(_0xd136('0x71'),_0xd136('0x71'),{'event':_0xd136('0x7a'),'message':_0x3d43ef[_0xd136('0x2c')]},client9002);return _0x348c01;}return null;})[_0xd136('0x39')](respondWithResult(_0x307298,null))[_0xd136('0x2f')](handleError(_0x307298,null));};exports['status']=function(_0x1a4313,_0x56d6a6,_0x4279b3){if(_0x1a4313[_0xd136('0x5a')]['id']){delete _0x1a4313['body']['id'];}var _0x3d41eb;return db[_0xd136('0x50')][_0xd136('0x5c')]({'where':{'id':_0x1a4313[_0xd136('0x57')]['id']}})[_0xd136('0x39')](handleEntityNotFound(_0x56d6a6,null))['then'](function(_0x6fd613){if(_0x6fd613){_0x3d41eb=_0x6fd613;return db['WhatsappAccount'][_0xd136('0x5c')]({'where':{'id':_0x6fd613[_0xd136('0x7b')]}});}})[_0xd136('0x39')](handleEntityNotFound(_0x56d6a6,null))[_0xd136('0x39')](function(_0x321922){if(_0x321922){logger[_0xd136('0x27')](_0xd136('0x7c'),_0xd136('0x31'),_0xd136('0x7d'),_0x321922[_0xd136('0x7e')],util[_0xd136('0x7f')](_0x1a4313[_0xd136('0x5a')],{'showHidden':![],'depth':null}));switch(_0x321922[_0xd136('0x7e')]){case _0xd136('0x80'):if(_0x1a4313[_0xd136('0x5a')][_0xd136('0x81')]&&_0x1a4313[_0xd136('0x5a')][_0xd136('0x81')]===_0x3d41eb[_0xd136('0x82')]&&_0x1a4313['body'][_0xd136('0x83')]&&_0x1a4313[_0xd136('0x5a')][_0xd136('0x83')]==='read'){return _0x3d41eb[_0xd136('0x38')]({'read':!![]});}else{logger[_0xd136('0x2a')](_0xd136('0x84'),_0xd136('0x31'),'twilio',util[_0xd136('0x7f')](_0x1a4313[_0xd136('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x3d41eb;}})[_0xd136('0x39')](respondWithResult(_0x56d6a6,null))[_0xd136('0x2f')](handleError(_0x56d6a6,null));}; \ No newline at end of file +var _0x236c=['rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','merge','options','WhatsappMessage','includeAll','include','findAll','rows','show','params','create','body','find','destroy','describe','whatsapp-interactions','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','WhatsappInteractionId','isNil','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','interface','channel','accept','EventManager','acceptmessage','agent','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','event','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','html-pdf','eml-format','fast-json-patch','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','end','status','json','count','offset','set','Content-Range','reject','save','update','then','sendStatus','name','send','index'];(function(_0x19d24c,_0x62bc50){var _0x2fae8d=function(_0x419856){while(--_0x419856){_0x19d24c['push'](_0x19d24c['shift']());}};_0x2fae8d(++_0x62bc50);}(_0x236c,0x1d9));var _0xc236=function(_0xe196e5,_0x29a7a6){_0xe196e5=_0xe196e5-0x0;var _0xffdcb4=_0x236c[_0xe196e5];return _0xffdcb4;};'use strict';var pdf=require(_0xc236('0x0'));var emlformat=require(_0xc236('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc236('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc236('0x3'));var util=require(_0xc236('0x4'));var path=require(_0xc236('0x5'));var sox=require('sox');var csv=require(_0xc236('0x6'));var ejs=require(_0xc236('0x7'));var fs=require('fs');var _=require(_0xc236('0x8'));var squel=require(_0xc236('0x9'));var crypto=require(_0xc236('0xa'));var jsforce=require(_0xc236('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc236('0x6'));var querystring=require(_0xc236('0xc'));var Papa=require('papaparse');var Redis=require(_0xc236('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc236('0xe'));var as=require(_0xc236('0xf'));var hardwareService=require(_0xc236('0x10'));var logger=require(_0xc236('0x11'))(_0xc236('0x12'));var utils=require(_0xc236('0x13'));var config=require(_0xc236('0x14'));var db=require(_0xc236('0x15'))['db'];config['redis']=_[_0xc236('0x16')](config[_0xc236('0x17')],{'host':_0xc236('0x18'),'port':0x18eb});var socket=require(_0xc236('0x19'))(new Redis(config[_0xc236('0x17')]));require('./whatsappMessage.socket')[_0xc236('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc236('0x1b')][_0xc236('0x1c')]({'port':0x232c});var client9002=jayson[_0xc236('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x649475,_0x28dbd3,_0x54172e){if(_0x54172e){var _0xed5191=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xed5191[_0xc236('0x1d')](_0x28dbd3)){return _0x649475;}else{throw new db[(_0xc236('0x1e'))][(_0xc236('0x1f'))](_0xc236('0x20'));}}else{return _0x649475;}}function respondWithRpcPromise(_0x472f35,_0x482679,_0x4e3715,_0x1b1a83){return new BPromise(function(_0x36d2c5,_0x2e9076){var _0x110b5e=_0x1b1a83||client;return _0x110b5e[_0xc236('0x21')](_0x472f35,_0x4e3715)['then'](function(_0x4cb38a){logger['info'](_0xc236('0x22'),_0x482679,_0xc236('0x23'));logger[_0xc236('0x24')](_0xc236('0x25'),_0x482679,'request\x20sent',JSON[_0xc236('0x26')](_0x4cb38a));if(_0x4cb38a[_0xc236('0x27')]){if(_0x4cb38a[_0xc236('0x27')][_0xc236('0x28')]===0x1f4){logger[_0xc236('0x27')](_0xc236('0x22'),_0x482679,_0x4cb38a['error'][_0xc236('0x29')]);return _0x2e9076(_0x4cb38a[_0xc236('0x27')]['message']);}logger[_0xc236('0x27')](_0xc236('0x22'),_0x482679,_0x4cb38a[_0xc236('0x27')]['message']);return _0x36d2c5(_0x4cb38a[_0xc236('0x27')][_0xc236('0x29')]);}else{logger[_0xc236('0x2a')](_0xc236('0x22'),_0x482679,_0xc236('0x23'));_0x36d2c5(_0x4cb38a['result'][_0xc236('0x29')]);}})[_0xc236('0x2b')](function(_0x216551){logger[_0xc236('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x482679,_0x216551);_0x2e9076(_0x216551);});});}function respondWithStatusCode(_0x351332,_0x37b230){_0x37b230=_0x37b230||0xcc;return function(_0x477f69){if(_0x477f69){return _0x351332['sendStatus'](_0x37b230);}return _0x351332['status'](_0x37b230)[_0xc236('0x2c')]();};}function respondWithResult(_0x110021,_0xda881b){_0xda881b=_0xda881b||0xc8;return function(_0x7ee754){if(_0x7ee754){return _0x110021[_0xc236('0x2d')](_0xda881b)[_0xc236('0x2e')](_0x7ee754);}};}function respondWithFilteredResult(_0x2f66ef,_0x863d55){return function(_0x421766){if(_0x421766){var _0x5954da=_0x421766[_0xc236('0x2f')],_0x4d57cb=_0x863d55[_0xc236('0x30')],_0x203016=_0x863d55[_0xc236('0x30')]+_0x863d55['limit'],_0x5401ae;if(_0x203016>=_0x5954da){_0x203016=_0x5954da;_0x5401ae=0xc8;}else{_0x5401ae=0xce;}_0x2f66ef['status'](_0x5401ae);return _0x2f66ef[_0xc236('0x31')](_0xc236('0x32'),_0x4d57cb+'-'+_0x203016+'/'+_0x5954da)['json'](_0x421766);}return null;};}function patchUpdates(_0x26215b){return function(_0x155df0){try{jsonpatch['apply'](_0x155df0,_0x26215b,!![]);}catch(_0x48bbad){return BPromise[_0xc236('0x33')](_0x48bbad);}return _0x155df0[_0xc236('0x34')]();};}function saveUpdates(_0x5c9dba,_0x33f2bd){return function(_0x49178f){if(_0x49178f){return _0x49178f[_0xc236('0x35')](_0x5c9dba)[_0xc236('0x36')](function(_0x21607d){return _0x21607d;});}return null;};}function removeEntity(_0x3ef607,_0xc49178){return function(_0x212a7a){if(_0x212a7a){return _0x212a7a['destroy']()['then'](function(){_0x3ef607['status'](0xcc)[_0xc236('0x2c')]();});}};}function handleEntityNotFound(_0x3cb831,_0x146ed1){return function(_0x290370){if(!_0x290370){_0x3cb831[_0xc236('0x37')](0x194);}return _0x290370;};}function handleError(_0x3fd4a0,_0x45a221){_0x45a221=_0x45a221||0x1f4;return function(_0xd6d2cb){logger['error'](_0xd6d2cb['stack']);if(_0xd6d2cb[_0xc236('0x38')]){delete _0xd6d2cb['name'];}_0x3fd4a0[_0xc236('0x2d')](_0x45a221)[_0xc236('0x39')](_0xd6d2cb);};}exports[_0xc236('0x3a')]=function(_0x4d6655,_0x2e9339){var _0x18a303={},_0x1fca54={},_0x139997={'count':0x0,'rows':[]};var _0x2d353d=_['map'](db['WhatsappMessage'][_0xc236('0x3b')],function(_0x4a1627){return{'name':_0x4a1627[_0xc236('0x3c')],'type':_0x4a1627['type'][_0xc236('0x3d')]};});_0x1fca54[_0xc236('0x3e')]=_[_0xc236('0x3f')](_0x2d353d,_0xc236('0x38'));_0x1fca54[_0xc236('0x40')]=_[_0xc236('0x41')](_0x4d6655[_0xc236('0x40')]);_0x1fca54[_0xc236('0x42')]=_[_0xc236('0x43')](_0x1fca54[_0xc236('0x3e')],_0x1fca54['query']);_0x18a303[_0xc236('0x44')]=_[_0xc236('0x43')](_0x1fca54[_0xc236('0x3e')],qs['fields'](_0x4d6655[_0xc236('0x40')][_0xc236('0x45')]));_0x18a303[_0xc236('0x44')]=_0x18a303[_0xc236('0x44')][_0xc236('0x46')]?_0x18a303[_0xc236('0x44')]:_0x1fca54[_0xc236('0x3e')];if(!_0x4d6655['query'][_0xc236('0x47')](_0xc236('0x48'))){_0x18a303[_0xc236('0x49')]=qs[_0xc236('0x49')](_0x4d6655[_0xc236('0x40')][_0xc236('0x49')]);_0x18a303[_0xc236('0x30')]=qs[_0xc236('0x30')](_0x4d6655[_0xc236('0x40')]['offset']);}_0x18a303[_0xc236('0x4a')]=qs[_0xc236('0x4b')](_0x4d6655['query'][_0xc236('0x4b')]);_0x18a303[_0xc236('0x4c')]=qs['filters'](_[_0xc236('0x4d')](_0x4d6655['query'],_0x1fca54[_0xc236('0x42')]),_0x2d353d);if(_0x4d6655[_0xc236('0x40')][_0xc236('0x4e')]){_0x18a303[_0xc236('0x4c')]=_['merge'](_0x18a303['where'],{'$or':_[_0xc236('0x3f')](_0x2d353d,function(_0x43076e){if(_0x43076e[_0xc236('0x4f')]!=='VIRTUAL'){var _0x5ea02d={};_0x5ea02d[_0x43076e[_0xc236('0x38')]]={'$like':'%'+_0x4d6655[_0xc236('0x40')][_0xc236('0x4e')]+'%'};return _0x5ea02d;}})});}_0x18a303=_[_0xc236('0x50')]({},_0x18a303,_0x4d6655[_0xc236('0x51')]);var _0x388819={'where':_0x18a303[_0xc236('0x4c')]};return db[_0xc236('0x52')][_0xc236('0x2f')](_0x388819)[_0xc236('0x36')](function(_0x2e42e2){_0x139997[_0xc236('0x2f')]=_0x2e42e2;if(_0x4d6655[_0xc236('0x40')][_0xc236('0x53')]){_0x18a303[_0xc236('0x54')]=[{'all':!![]}];}return db[_0xc236('0x52')][_0xc236('0x55')](_0x18a303);})[_0xc236('0x36')](function(_0x32cdff){_0x139997[_0xc236('0x56')]=_0x32cdff;return _0x139997;})[_0xc236('0x36')](respondWithFilteredResult(_0x2e9339,_0x18a303))['catch'](handleError(_0x2e9339,null));};exports[_0xc236('0x57')]=function(_0x2ef43e,_0x323e20){var _0x23f4c1={'raw':!![],'where':{'id':_0x2ef43e[_0xc236('0x58')]['id']}},_0xad139d={};_0xad139d[_0xc236('0x3e')]=_[_0xc236('0x41')](db['WhatsappMessage'][_0xc236('0x3b')]);_0xad139d[_0xc236('0x40')]=_[_0xc236('0x41')](_0x2ef43e[_0xc236('0x40')]);_0xad139d[_0xc236('0x42')]=_[_0xc236('0x43')](_0xad139d[_0xc236('0x3e')],_0xad139d[_0xc236('0x40')]);_0x23f4c1['attributes']=_[_0xc236('0x43')](_0xad139d['model'],qs[_0xc236('0x45')](_0x2ef43e['query']['fields']));_0x23f4c1[_0xc236('0x44')]=_0x23f4c1[_0xc236('0x44')][_0xc236('0x46')]?_0x23f4c1[_0xc236('0x44')]:_0xad139d[_0xc236('0x3e')];if(_0x2ef43e[_0xc236('0x40')][_0xc236('0x53')]){_0x23f4c1['include']=[{'all':!![]}];}_0x23f4c1=_['merge']({},_0x23f4c1,_0x2ef43e['options']);return db[_0xc236('0x52')]['find'](_0x23f4c1)[_0xc236('0x36')](handleEntityNotFound(_0x323e20,null))['then'](respondWithResult(_0x323e20,null))[_0xc236('0x2b')](handleError(_0x323e20,null));};exports[_0xc236('0x59')]=function(_0x21c611,_0x45af16){return db['WhatsappMessage'][_0xc236('0x59')](_0x21c611[_0xc236('0x5a')],{})[_0xc236('0x36')](respondWithResult(_0x45af16,0xc9))[_0xc236('0x2b')](handleError(_0x45af16,null));};exports[_0xc236('0x35')]=function(_0x1e7c7b,_0x59864f){if(_0x1e7c7b[_0xc236('0x5a')]['id']){delete _0x1e7c7b[_0xc236('0x5a')]['id'];}return db['WhatsappMessage'][_0xc236('0x5b')]({'where':{'id':_0x1e7c7b['params']['id']}})['then'](handleEntityNotFound(_0x59864f,null))[_0xc236('0x36')](saveUpdates(_0x1e7c7b[_0xc236('0x5a')],null))[_0xc236('0x36')](respondWithResult(_0x59864f,null))[_0xc236('0x2b')](handleError(_0x59864f,null));};exports[_0xc236('0x5c')]=function(_0x5aaad1,_0x4d246e){return db[_0xc236('0x52')][_0xc236('0x5b')]({'where':{'id':_0x5aaad1['params']['id']}})[_0xc236('0x36')](handleEntityNotFound(_0x4d246e,null))[_0xc236('0x36')](removeEntity(_0x4d246e,null))['catch'](handleError(_0x4d246e,null));};exports[_0xc236('0x5d')]=function(_0x173281,_0x2d5c81){return db[_0xc236('0x52')][_0xc236('0x5d')]()[_0xc236('0x36')](respondWithResult(_0x2d5c81,null))['catch'](handleError(_0x2d5c81,null));};var interaction_log=require('../../config/logger')(_0xc236('0x5e'));exports['accept']=function(_0x377920,_0x2224a1,_0x3c2032){var _0xe39d9a={'channel':_0xc236('0x5f')};if(_0x377920[_0xc236('0x5a')]['id']){delete _0x377920['body']['id'];}_0x377920[_0xc236('0x5a')]['read']=!![];_0x377920['body'][_0xc236('0x60')]=moment()[_0xc236('0x61')](_0xc236('0x62'));_0x377920[_0xc236('0x5a')][_0xc236('0x63')]=_0x377920[_0xc236('0x5a')][_0xc236('0x63')]||_0x377920[_0xc236('0x64')]['id'];return db[_0xc236('0x52')][_0xc236('0x5b')]({'where':{'id':_0x377920[_0xc236('0x58')]['id'],'UserId':null},'include':[{'model':db[_0xc236('0x65')],'as':'Contact'}]})[_0xc236('0x36')](handleEntityNotFound(_0x2224a1,null))[_0xc236('0x36')](saveUpdates(_0x377920[_0xc236('0x5a')],null))[_0xc236('0x36')](function(_0x2869af){if(_0x2869af){_0xe39d9a[_0xc236('0x29')]=_0x2869af[_0xc236('0x66')]({'plain':!![]});return db['WhatsappInteraction'][_0xc236('0x5b')]({'where':{'id':_0x2869af[_0xc236('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x2224a1,null))[_0xc236('0x36')](function(_0x2686f1){if(_0x2686f1){return _0x2686f1[_0xc236('0x35')]({'UserId':_0x377920[_0xc236('0x5a')]['UserId'],'read1stAt':_[_0xc236('0x68')](_0x2686f1['read1stAt'])?moment()[_0xc236('0x61')](_0xc236('0x62')):undefined});}return null;})[_0xc236('0x36')](function(_0x362828){if(_0x362828){_0xe39d9a[_0xc236('0x69')]=_0x362828[_0xc236('0x66')]({'plain':!![]});interaction_log[_0xc236('0x2a')](_0xc236('0x6a'),_0x377920[_0xc236('0x64')]['id'],_0x377920[_0xc236('0x64')]['name'],_0x377920['user']['role'],_0xe39d9a[_0xc236('0x69')]['id'],_0x377920[_0xc236('0x5a')]?JSON[_0xc236('0x26')](_0x377920[_0xc236('0x5a')]):_0xc236('0x6b'));return respondWithRpcPromise(_0xc236('0x6c'),_0xc236('0x6d'),_0xe39d9a);}return null;})[_0xc236('0x36')](function(_0x36ef9){if(_0x36ef9){if(_0x377920['body'][_0xc236('0x6e')]){_0xe39d9a['message'][_0xc236('0x6f')]=util[_0xc236('0x61')]('SIP/%s',_0x377920[_0xc236('0x64')][_0xc236('0x38')]);_0xe39d9a[_0xc236('0x29')]['channel']=_0xe39d9a[_0xc236('0x70')];_0xe39d9a[_0xc236('0x29')]['event']=_0xc236('0x71');return respondWithRpcPromise(_0xc236('0x72'),_0xc236('0x72'),{'event':_0xc236('0x73'),'message':_0xe39d9a[_0xc236('0x29')]},client9002)[_0xc236('0x36')](function(){return _0xe39d9a;});}return _0xe39d9a;}return null;})['then'](respondWithResult(_0x2224a1,null))[_0xc236('0x2b')](handleError(_0x2224a1,null));};var interaction_log=require(_0xc236('0x11'))(_0xc236('0x5e'));exports[_0xc236('0x33')]=function(_0x5d0375,_0x3862b4,_0x5798d0){var _0x3850a9={'agent':{},'channel':_0xc236('0x5f')};if(_0x5d0375[_0xc236('0x5a')]['id']){delete _0x5d0375[_0xc236('0x5a')]['id'];}_0x5d0375[_0xc236('0x5a')]['UserId']=_0x5d0375[_0xc236('0x5a')][_0xc236('0x63')]||_0x5d0375[_0xc236('0x64')]['id'];_0x3850a9[_0xc236('0x74')]['id']=_0x5d0375['body']['UserId'];return db['WhatsappMessage'][_0xc236('0x5b')]({'where':{'id':_0x5d0375[_0xc236('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3862b4,null))['then'](function(_0x39557a){if(_0x39557a){_0x3850a9[_0xc236('0x29')]=_0x39557a[_0xc236('0x66')]({'plain':!![]});return db[_0xc236('0x75')][_0xc236('0x5b')]({'where':{'id':_0x39557a[_0xc236('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x3862b4,null))[_0xc236('0x36')](function(_0x3e373e){if(_0x3e373e){_0x3850a9[_0xc236('0x69')]=_0x3e373e[_0xc236('0x66')]({'plain':!![]});interaction_log[_0xc236('0x2a')](_0xc236('0x76'),_0x5d0375[_0xc236('0x64')]['id'],_0x5d0375['user'][_0xc236('0x38')],_0x5d0375[_0xc236('0x64')][_0xc236('0x77')],_0x3850a9[_0xc236('0x69')]['id'],_0x5d0375[_0xc236('0x5a')]?JSON['stringify'](_0x5d0375['body']):_0xc236('0x6b'));return respondWithRpcPromise(_0xc236('0x78'),'rejectMessage',_0x3850a9);}return null;})[_0xc236('0x36')](function(_0x48f429){if(_0x48f429){_0x48f429[_0xc236('0x29')][_0xc236('0x6f')]=util[_0xc236('0x61')]('SIP/%s',_0x5d0375[_0xc236('0x64')]['name']);_0x48f429[_0xc236('0x29')][_0xc236('0x70')]=_0x3850a9[_0xc236('0x70')];_0x48f429[_0xc236('0x29')][_0xc236('0x79')]=_0xc236('0x33');respondWithRpcPromise(_0xc236('0x72'),_0xc236('0x72'),{'event':_0xc236('0x7a'),'message':_0x48f429[_0xc236('0x29')]},client9002);return _0x3850a9;}return null;})[_0xc236('0x36')](respondWithResult(_0x3862b4,null))['catch'](handleError(_0x3862b4,null));};exports[_0xc236('0x2d')]=function(_0x3f48c5,_0x6a9066,_0x395c7b){if(_0x3f48c5[_0xc236('0x5a')]['id']){delete _0x3f48c5['body']['id'];}var _0x1ef49e;return db[_0xc236('0x52')][_0xc236('0x5b')]({'where':{'id':_0x3f48c5[_0xc236('0x58')]['id']}})[_0xc236('0x36')](handleEntityNotFound(_0x6a9066,null))['then'](function(_0x3f9174){if(_0x3f9174){_0x1ef49e=_0x3f9174;return db[_0xc236('0x7b')][_0xc236('0x5b')]({'where':{'id':_0x3f9174[_0xc236('0x7c')]}});}})[_0xc236('0x36')](handleEntityNotFound(_0x6a9066,null))[_0xc236('0x36')](function(_0x4071f5){if(_0x4071f5){logger[_0xc236('0x24')](_0xc236('0x7d'),'status',_0xc236('0x7e'),_0x4071f5[_0xc236('0x4f')],util[_0xc236('0x7f')](_0x3f48c5[_0xc236('0x5a')],{'showHidden':![],'depth':null}));switch(_0x4071f5[_0xc236('0x4f')]){case _0xc236('0x80'):if(_0x3f48c5['body'][_0xc236('0x81')]&&_0x3f48c5[_0xc236('0x5a')][_0xc236('0x81')]===_0x1ef49e[_0xc236('0x82')]&&_0x3f48c5['body'][_0xc236('0x83')]&&_0x3f48c5[_0xc236('0x5a')]['MessageStatus']===_0xc236('0x84')){return _0x1ef49e['update']({'read':!![]});}else{logger[_0xc236('0x27')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xc236('0x2d'),_0xc236('0x80'),util[_0xc236('0x7f')](_0x3f48c5[_0xc236('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x1ef49e;}})['then'](respondWithResult(_0x6a9066,null))['catch'](handleError(_0x6a9066,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index b38c34a..540061a 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(_0x4ab75f,_0x6c6da1){var _0x810c30=function(_0x315f7c){while(--_0x315f7c){_0x4ab75f['push'](_0x4ab75f['shift']());}};_0x810c30(++_0x6c6da1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1b423b,_0x48afc1){_0x1b423b=_0x1b423b-0x0;var _0x482b03=_0x5f2f[_0x1b423b];return _0x482b03;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x2c41bf,_0x312036){var _0xc64c99=function(_0x4a8c0e){while(--_0x4a8c0e){_0x2c41bf['push'](_0x2c41bf['shift']());}};_0xc64c99(++_0x312036);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4733f4,_0x3091ac){_0x4733f4=_0x4733f4-0x0;var _0x442663=_0x5f2f[_0x4733f4];return _0x442663;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index d8a3104..de317c1 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 _0x0fb5=['WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','findOne','WhatsappInteractionId','update','createdAt','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','body','whatsapp:','/status?token=','token','then','sid','catch','error'];(function(_0x39165e,_0x1585ef){var _0x5b5d83=function(_0x2488c1){while(--_0x2488c1){_0x39165e['push'](_0x39165e['shift']());}};_0x5b5d83(++_0x1585ef);}(_0x0fb5,0x1c8));var _0x50fb=function(_0x1979a5,_0x480949){_0x1979a5=_0x1979a5-0x0;var _0xe50855=_0x0fb5[_0x1979a5];return _0xe50855;};'use strict';var _=require(_0x50fb('0x0'));var util=require(_0x50fb('0x1'));var logger=require(_0x50fb('0x2'))(_0x50fb('0x3'));var moment=require(_0x50fb('0x4'));var BPromise=require(_0x50fb('0x5'));var rp=require(_0x50fb('0x6'));var fs=require('fs');var path=require(_0x50fb('0x7'));var rimraf=require(_0x50fb('0x8'));var config=require(_0x50fb('0x9'));var attributes=require('./whatsappMessage.attributes');module[_0x50fb('0xa')]=function(_0x2ed5de,_0x112f0f){return _0x2ed5de[_0x50fb('0xb')]('WhatsappMessage',attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x50fb('0xc')]},{'name':_0x50fb('0xd'),'fields':['body'],'type':_0x50fb('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x40d8ef,_0x27cfed,_0xf15456){var _0x472aa6=_0x2ed5de[_0x50fb('0xf')];var _0x47fbc2=_0x40d8ef[_0x50fb('0x10')]({'plain':!![]});if(_0x47fbc2[_0x50fb('0x11')][_0x50fb('0x12')]()==='in'||_0x47fbc2['direction'][_0x50fb('0x12')]()===_0x50fb('0x13')&&!_0x47fbc2[_0x50fb('0x14')]&&!_[_0x50fb('0x15')](_0x47fbc2['UserId'])){_0x472aa6['WhatsappInteraction'][_0x50fb('0x16')]({'where':{'id':_0x47fbc2[_0x50fb('0x17')]}})['then'](function(_0x4c13ce){if(_0x4c13ce){_0x4c13ce[_0x50fb('0x18')]({'lastMsgAt':_0x47fbc2[_0x50fb('0x19')],'lastMsgDirection':_0x47fbc2[_0x50fb('0x11')]['toLowerCase']()});}})['catch'](function(_0x3a3ddb){console['error'](_0x3a3ddb);});}if(_0x47fbc2[_0x50fb('0x11')]===_0x50fb('0x13')&&!_0x47fbc2[_0x50fb('0x14')]){var _0x10ed81;_0x472aa6[_0x50fb('0x1a')][_0x50fb('0x1b')]({'where':{'id':_0x47fbc2[_0x50fb('0x1c')]},'raw':!![]})['then'](function(_0x57d23a){_0x10ed81=_0x57d23a;if(_0x10ed81&&_0x10ed81[_0x50fb('0x1d')]){switch(_0x10ed81[_0x50fb('0x1d')]){case _0x50fb('0x1e'):var _0x53cf19=require(_0x50fb('0x1e'));if(_0x10ed81[_0x50fb('0x1f')]&&_0x10ed81[_0x50fb('0x20')]&&_0x10ed81[_0x50fb('0x21')]){var _0x319a0e=new _0x53cf19(_0x10ed81[_0x50fb('0x1f')],_0x10ed81[_0x50fb('0x20')]);_0x319a0e[_0x50fb('0x22')][_0x50fb('0x23')]({'body':_0x47fbc2[_0x50fb('0x24')],'to':_0x50fb('0x25')+_0x47fbc2['phone'],'from':_0x50fb('0x25')+_0x10ed81[_0x50fb('0x21')],'statusCallback':_0x10ed81['remote']+'/api/whatsapp/messages/'+_0x47fbc2['id']+_0x50fb('0x26')+_0x10ed81[_0x50fb('0x27')]})[_0x50fb('0x28')](function(_0x11fc1f){if(_0x11fc1f[_0x50fb('0x29')]){return _0x40d8ef[_0x50fb('0x18')]({'messageId':_0x11fc1f[_0x50fb('0x29')]});}})[_0x50fb('0x2a')](function(_0x8838c8){logger[_0x50fb('0x2b')](_0x50fb('0x2c'),_0x50fb('0x2d'),_0x50fb('0x1e'),util['inspect'](_0x8838c8,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x50fb('0x2c'),_0x50fb('0x2d'),'twilio',_0x50fb('0x2e'));}break;}}})[_0x50fb('0x2f')](function(){_0xf15456();});}else{_0xf15456();}}},'charset':_0x50fb('0x30'),'collate':_0x50fb('0x31')});}; \ No newline at end of file +var _0x2506=['secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','error','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch'];(function(_0x34865d,_0x229214){var _0x57b088=function(_0x46b949){while(--_0x46b949){_0x34865d['push'](_0x34865d['shift']());}};_0x57b088(++_0x229214);}(_0x2506,0x110));var _0x6250=function(_0x4ec466,_0x434ea0){_0x4ec466=_0x4ec466-0x0;var _0x44fdcf=_0x2506[_0x4ec466];return _0x44fdcf;};'use strict';var _=require(_0x6250('0x0'));var util=require(_0x6250('0x1'));var logger=require('../../config/logger')(_0x6250('0x2'));var moment=require(_0x6250('0x3'));var BPromise=require(_0x6250('0x4'));var rp=require(_0x6250('0x5'));var fs=require('fs');var path=require(_0x6250('0x6'));var rimraf=require('rimraf');var config=require(_0x6250('0x7'));var attributes=require('./whatsappMessage.attributes');module[_0x6250('0x8')]=function(_0x4480bf,_0x516b81){return _0x4480bf['define'](_0x6250('0x9'),attributes,{'tableName':_0x6250('0xa'),'paranoid':![],'indexes':[{'name':_0x6250('0xb'),'fields':[_0x6250('0xb')]},{'name':_0x6250('0xc'),'fields':[_0x6250('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x57744c,_0x38508f,_0x31275f){var _0x5cabab=_0x4480bf[_0x6250('0xe')];var _0x3c91bc=_0x57744c[_0x6250('0xf')]({'plain':!![]});if(_0x3c91bc[_0x6250('0x10')][_0x6250('0x11')]()==='in'||_0x3c91bc[_0x6250('0x10')][_0x6250('0x11')]()===_0x6250('0x12')&&!_0x3c91bc['secret']&&!_[_0x6250('0x13')](_0x3c91bc[_0x6250('0x14')])){_0x5cabab[_0x6250('0x15')][_0x6250('0x16')]({'where':{'id':_0x3c91bc[_0x6250('0x17')]}})[_0x6250('0x18')](function(_0x7365fc){if(_0x7365fc){_0x7365fc[_0x6250('0x19')]({'lastMsgAt':_0x3c91bc[_0x6250('0x1a')],'lastMsgDirection':_0x3c91bc[_0x6250('0x10')][_0x6250('0x11')]()});}})[_0x6250('0x1b')](function(_0x17a549){console['error'](_0x17a549);});}if(_0x3c91bc[_0x6250('0x10')]===_0x6250('0x12')&&!_0x3c91bc[_0x6250('0x1c')]){var _0x4b3aae;_0x5cabab[_0x6250('0x1d')][_0x6250('0x1e')]({'where':{'id':_0x3c91bc[_0x6250('0x1f')]},'raw':!![]})[_0x6250('0x18')](function(_0x3a9e59){_0x4b3aae=_0x3a9e59;if(_0x4b3aae&&_0x4b3aae[_0x6250('0x20')]){switch(_0x4b3aae[_0x6250('0x20')]){case _0x6250('0x21'):var _0x1c997e=require(_0x6250('0x21'));if(_0x4b3aae[_0x6250('0x22')]&&_0x4b3aae[_0x6250('0x23')]&&_0x4b3aae[_0x6250('0x24')]){var _0x5da7fc=new _0x1c997e(_0x4b3aae['accountSid'],_0x4b3aae['authToken']);_0x5da7fc[_0x6250('0x25')]['create']({'body':_0x3c91bc[_0x6250('0xd')],'to':_0x6250('0x26')+_0x3c91bc['phone'],'from':'whatsapp:'+_0x4b3aae[_0x6250('0x24')],'statusCallback':_0x4b3aae[_0x6250('0x27')]+_0x6250('0x28')+_0x3c91bc['id']+_0x6250('0x29')+_0x4b3aae[_0x6250('0x2a')]})[_0x6250('0x18')](function(_0x27f820){if(_0x27f820[_0x6250('0x2b')]){return _0x57744c['update']({'messageId':_0x27f820[_0x6250('0x2b')]});}})[_0x6250('0x1b')](function(_0x431772){logger[_0x6250('0x2c')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6250('0x21'),util[_0x6250('0x2d')](_0x431772,{'showHidden':![],'depth':null}));});}else{logger[_0x6250('0x2c')](_0x6250('0x2e'),'afterCreate',_0x6250('0x21'),_0x6250('0x2f'));}break;}}})[_0x6250('0x30')](function(){_0x31275f();});}else{_0x31275f();}}},'charset':_0x6250('0x31'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 935f034..38d6ba9 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 _0xeb3e=['localhost','socket.io-emitter','./whatsappMessage.socket','register','request','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','result','catch','CreateWhatsappMessage','WhatsappMessage','body','options','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0xb8bc2a,_0x1a8f96){var _0x3511cd=function(_0x2275fd){while(--_0x2275fd){_0xb8bc2a['push'](_0xb8bc2a['shift']());}};_0x3511cd(++_0x1a8f96);}(_0xeb3e,0x17d));var _0xeeb3=function(_0x3dbe69,_0x16677e){_0x3dbe69=_0x3dbe69-0x0;var _0x1ec686=_0xeb3e[_0x3dbe69];return _0x1ec686;};'use strict';var _=require(_0xeeb3('0x0'));var util=require(_0xeeb3('0x1'));var moment=require(_0xeeb3('0x2'));var BPromise=require(_0xeeb3('0x3'));var rs=require(_0xeeb3('0x4'));var fs=require('fs');var Redis=require(_0xeeb3('0x5'));var db=require(_0xeeb3('0x6'))['db'];var utils=require(_0xeeb3('0x7'));var logger=require(_0xeeb3('0x8'))('rpc');var config=require(_0xeeb3('0x9'));var jayson=require(_0xeeb3('0xa'));var client=jayson[_0xeeb3('0xb')][_0xeeb3('0xc')]({'port':0x232a});config[_0xeeb3('0xd')]=_[_0xeeb3('0xe')](config[_0xeeb3('0xd')],{'host':_0xeeb3('0xf'),'port':0x18eb});var socket=require(_0xeeb3('0x10'))(new Redis(config[_0xeeb3('0xd')]));require(_0xeeb3('0x11'))[_0xeeb3('0x12')](socket);function respondWithRpcPromise(_0xd890cf,_0xd3c8f,_0x188289){return new BPromise(function(_0x14c265,_0x366bc5){return client[_0xeeb3('0x13')](_0xd890cf,_0x188289)['then'](function(_0x678686){logger[_0xeeb3('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0xd3c8f,_0xeeb3('0x15'));logger[_0xeeb3('0x16')](_0xeeb3('0x17'),_0xd3c8f,_0xeeb3('0x15'),JSON[_0xeeb3('0x18')](_0x678686));if(_0x678686[_0xeeb3('0x19')]){if(_0x678686[_0xeeb3('0x19')][_0xeeb3('0x1a')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0xd3c8f,_0x678686['error'][_0xeeb3('0x1b')]);return _0x366bc5(_0x678686['error'][_0xeeb3('0x1b')]);}logger['error'](_0xeeb3('0x1c'),_0xd3c8f,_0x678686['error']['message']);return _0x14c265(_0x678686[_0xeeb3('0x19')][_0xeeb3('0x1b')]);}else{logger[_0xeeb3('0x14')](_0xeeb3('0x1c'),_0xd3c8f,_0xeeb3('0x15'));_0x14c265(_0x678686[_0xeeb3('0x1d')][_0xeeb3('0x1b')]);}})[_0xeeb3('0x1e')](function(_0x3a7111){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0xd3c8f,_0x3a7111);_0x366bc5(_0x3a7111);});});}exports[_0xeeb3('0x1f')]=function(_0x418e93){var _0x1fd488=this;return new Promise(function(_0x26743e,_0x5b00fe){return db[_0xeeb3('0x20')]['create'](_0x418e93[_0xeeb3('0x21')],{'raw':_0x418e93[_0xeeb3('0x22')]?_0x418e93[_0xeeb3('0x22')]['raw']===undefined?!![]:![]:!![]})[_0xeeb3('0x23')](function(_0x51add4){logger[_0xeeb3('0x14')](_0xeeb3('0x1f'),_0x418e93);logger['debug'](_0xeeb3('0x1f'),_0x418e93,JSON[_0xeeb3('0x18')](_0x51add4));_0x26743e(_0x51add4);})['catch'](function(_0x2b2fcd){logger[_0xeeb3('0x19')]('CreateWhatsappMessage',_0x2b2fcd[_0xeeb3('0x1b')],_0x418e93);_0x5b00fe(_0x1fd488['error'](0x1f4,_0x2b2fcd[_0xeeb3('0x1b')]));});});}; \ No newline at end of file +var _0xbb5b=['result','catch','WhatsappMessage','body','options','raw','info','CreateWhatsappMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','request','then','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x2f60ce,_0x4630cd){var _0x2ab511=function(_0x2bbd90){while(--_0x2bbd90){_0x2f60ce['push'](_0x2f60ce['shift']());}};_0x2ab511(++_0x4630cd);}(_0xbb5b,0xad));var _0xbbb5=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0xbb5b[_0x4e9d3c];return _0x2d0825;};'use strict';var _=require(_0xbbb5('0x0'));var util=require(_0xbbb5('0x1'));var moment=require(_0xbbb5('0x2'));var BPromise=require(_0xbbb5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbbb5('0x4'));var db=require(_0xbbb5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbbb5('0x6'))(_0xbbb5('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbbb5('0x8')][_0xbbb5('0x9')]({'port':0x232a});config[_0xbbb5('0xa')]=_[_0xbbb5('0xb')](config[_0xbbb5('0xa')],{'host':_0xbbb5('0xc'),'port':0x18eb});var socket=require(_0xbbb5('0xd'))(new Redis(config[_0xbbb5('0xa')]));require(_0xbbb5('0xe'))['register'](socket);function respondWithRpcPromise(_0x28790f,_0x320986,_0x5c368e){return new BPromise(function(_0x21e95d,_0x35867d){return client[_0xbbb5('0xf')](_0x28790f,_0x5c368e)[_0xbbb5('0x10')](function(_0x89c007){logger['info'](_0xbbb5('0x11'),_0x320986,'request\x20sent');logger[_0xbbb5('0x12')](_0xbbb5('0x13'),_0x320986,_0xbbb5('0x14'),JSON[_0xbbb5('0x15')](_0x89c007));if(_0x89c007['error']){if(_0x89c007[_0xbbb5('0x16')][_0xbbb5('0x17')]===0x1f4){logger[_0xbbb5('0x16')](_0xbbb5('0x11'),_0x320986,_0x89c007[_0xbbb5('0x16')][_0xbbb5('0x18')]);return _0x35867d(_0x89c007[_0xbbb5('0x16')][_0xbbb5('0x18')]);}logger[_0xbbb5('0x16')](_0xbbb5('0x11'),_0x320986,_0x89c007[_0xbbb5('0x16')]['message']);return _0x21e95d(_0x89c007[_0xbbb5('0x16')][_0xbbb5('0x18')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x320986,_0xbbb5('0x14'));_0x21e95d(_0x89c007[_0xbbb5('0x19')][_0xbbb5('0x18')]);}})[_0xbbb5('0x1a')](function(_0x203d2b){logger[_0xbbb5('0x16')](_0xbbb5('0x11'),_0x320986,_0x203d2b);_0x35867d(_0x203d2b);});});}exports['CreateWhatsappMessage']=function(_0x5c9ef5){var _0x1288b0=this;return new Promise(function(_0xaf1c02,_0x5b78a1){return db[_0xbbb5('0x1b')]['create'](_0x5c9ef5[_0xbbb5('0x1c')],{'raw':_0x5c9ef5[_0xbbb5('0x1d')]?_0x5c9ef5[_0xbbb5('0x1d')][_0xbbb5('0x1e')]===undefined?!![]:![]:!![]})[_0xbbb5('0x10')](function(_0x13e992){logger[_0xbbb5('0x1f')](_0xbbb5('0x20'),_0x5c9ef5);logger[_0xbbb5('0x12')](_0xbbb5('0x20'),_0x5c9ef5,JSON[_0xbbb5('0x15')](_0x13e992));_0xaf1c02(_0x13e992);})[_0xbbb5('0x1a')](function(_0x663922){logger[_0xbbb5('0x16')](_0xbbb5('0x20'),_0x663922['message'],_0x5c9ef5);_0x5b78a1(_0x1288b0[_0xbbb5('0x16')](0x1f4,_0x663922[_0xbbb5('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index f993627..0e58dc8 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 _0x9b39=['save','remove','update','register','whatsappMessage:','./whatsappMessage.events'];(function(_0x4add67,_0x5a57c3){var _0x336e8d=function(_0x111030){while(--_0x111030){_0x4add67['push'](_0x4add67['shift']());}};_0x336e8d(++_0x5a57c3);}(_0x9b39,0x161));var _0x99b3=function(_0x21c271,_0x547b3e){_0x21c271=_0x21c271-0x0;var _0x2c6694=_0x9b39[_0x21c271];return _0x2c6694;};'use strict';var WhatsappMessageEvents=require(_0x99b3('0x0'));var events=[_0x99b3('0x1'),_0x99b3('0x2'),_0x99b3('0x3')];function createListener(_0x33a110,_0x1bd3dd){return function(_0xa40151){_0x1bd3dd['emit'](_0x33a110,_0xa40151);};}function removeListener(_0x441de7,_0x33e734){return function(){WhatsappMessageEvents['removeListener'](_0x441de7,_0x33e734);};}exports[_0x99b3('0x4')]=function(_0xc11fb0){for(var _0x24f491=0x0,_0x51ca52=events['length'];_0x24f491<_0x51ca52;_0x24f491++){var _0x23d2ab=events[_0x24f491];var _0x22f26d=createListener(_0x99b3('0x5')+_0x23d2ab,_0xc11fb0);WhatsappMessageEvents['on'](_0x23d2ab,_0x22f26d);}}; \ No newline at end of file +var _0x8bce=['update','removeListener','whatsappMessage:','./whatsappMessage.events','save','remove'];(function(_0x2b6f60,_0x27e3a8){var _0x47430f=function(_0x98ef75){while(--_0x98ef75){_0x2b6f60['push'](_0x2b6f60['shift']());}};_0x47430f(++_0x27e3a8);}(_0x8bce,0x1d1));var _0xe8bc=function(_0x187bf3,_0x4c2bd2){_0x187bf3=_0x187bf3-0x0;var _0xb8110=_0x8bce[_0x187bf3];return _0xb8110;};'use strict';var WhatsappMessageEvents=require(_0xe8bc('0x0'));var events=[_0xe8bc('0x1'),_0xe8bc('0x2'),_0xe8bc('0x3')];function createListener(_0x16feec,_0xae9a32){return function(_0x533556){_0xae9a32['emit'](_0x16feec,_0x533556);};}function removeListener(_0x1daf77,_0x263994){return function(){WhatsappMessageEvents[_0xe8bc('0x4')](_0x1daf77,_0x263994);};}exports['register']=function(_0x9140f4){for(var _0x4ac05d=0x0,_0x535f46=events['length'];_0x4ac05d<_0x535f46;_0x4ac05d++){var _0x17e7a9=events[_0x4ac05d];var _0xfbe4d0=createListener(_0xe8bc('0x5')+_0x17e7a9,_0x9140f4);WhatsappMessageEvents['on'](_0x17e7a9,_0xfbe4d0);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index ee3cdb2..f2205f4 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 _0x06f7=['getAgents','post','/:id/teams','addTeams','update','destroy','removeTeams','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getTeams','/:id/users'];(function(_0x582d0b,_0x28f609){var _0x2e93e1=function(_0xb6a81c){while(--_0xb6a81c){_0x582d0b['push'](_0x582d0b['shift']());}};_0x2e93e1(++_0x28f609);}(_0x06f7,0x14e));var _0x706f=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x06f7[_0x433a86];return _0x23000c;};'use strict';var multer=require('multer');var util=require(_0x706f('0x0'));var path=require(_0x706f('0x1'));var timeout=require(_0x706f('0x2'));var express=require(_0x706f('0x3'));var router=express[_0x706f('0x4')]();var auth=require(_0x706f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x706f('0x6'));var controller=require('./whatsappQueue.controller');router[_0x706f('0x7')]('/',auth[_0x706f('0x8')](),controller['index']);router['get'](_0x706f('0x9'),auth[_0x706f('0x8')](),controller[_0x706f('0xa')]);router[_0x706f('0x7')](_0x706f('0xb'),auth[_0x706f('0x8')](),controller[_0x706f('0xc')]);router[_0x706f('0x7')](_0x706f('0xd'),auth['isAuthenticated'](),controller['getMembers']);router[_0x706f('0x7')]('/:id/teams',auth[_0x706f('0x8')](),controller[_0x706f('0xe')]);router['get'](_0x706f('0xf'),auth['isAuthenticated'](),controller[_0x706f('0x10')]);router[_0x706f('0x11')]('/',auth[_0x706f('0x8')](),controller['create']);router[_0x706f('0x11')](_0x706f('0x12'),auth[_0x706f('0x8')](),controller[_0x706f('0x13')]);router[_0x706f('0x11')](_0x706f('0xf'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x706f('0xb'),auth[_0x706f('0x8')](),controller[_0x706f('0x14')]);router['delete']('/:id',auth[_0x706f('0x8')](),controller[_0x706f('0x15')]);router['delete']('/:id/teams',auth[_0x706f('0x8')](),controller[_0x706f('0x16')]);router[_0x706f('0x17')](_0x706f('0xf'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x706f('0x18')]=router; \ No newline at end of file +var _0x6ac8=['create','addAgents','put','update','delete','destroy','/:id/teams','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post'];(function(_0x6cb0ca,_0x5f1ed2){var _0x2c980e=function(_0x1ca889){while(--_0x1ca889){_0x6cb0ca['push'](_0x6cb0ca['shift']());}};_0x2c980e(++_0x5f1ed2);}(_0x6ac8,0x154));var _0x86ac=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x6ac8[_0x481bf7];return _0x461787;};'use strict';var multer=require(_0x86ac('0x0'));var util=require(_0x86ac('0x1'));var path=require('path');var timeout=require(_0x86ac('0x2'));var express=require(_0x86ac('0x3'));var router=express[_0x86ac('0x4')]();var auth=require(_0x86ac('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x86ac('0x6'));var controller=require(_0x86ac('0x7'));router[_0x86ac('0x8')]('/',auth[_0x86ac('0x9')](),controller['index']);router[_0x86ac('0x8')](_0x86ac('0xa'),auth['isAuthenticated'](),controller[_0x86ac('0xb')]);router['get'](_0x86ac('0xc'),auth[_0x86ac('0x9')](),controller[_0x86ac('0xd')]);router[_0x86ac('0x8')](_0x86ac('0xe'),auth['isAuthenticated'](),controller[_0x86ac('0xf')]);router[_0x86ac('0x8')]('/:id/teams',auth[_0x86ac('0x9')](),controller[_0x86ac('0x10')]);router[_0x86ac('0x8')](_0x86ac('0x11'),auth[_0x86ac('0x9')](),controller[_0x86ac('0x12')]);router[_0x86ac('0x13')]('/',auth[_0x86ac('0x9')](),controller[_0x86ac('0x14')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x86ac('0x13')](_0x86ac('0x11'),auth[_0x86ac('0x9')](),controller[_0x86ac('0x15')]);router[_0x86ac('0x16')]('/:id',auth[_0x86ac('0x9')](),controller[_0x86ac('0x17')]);router[_0x86ac('0x18')](_0x86ac('0xc'),auth[_0x86ac('0x9')](),controller[_0x86ac('0x19')]);router[_0x86ac('0x18')](_0x86ac('0x1a'),auth['isAuthenticated'](),controller[_0x86ac('0x1b')]);router[_0x86ac('0x18')]('/:id/users',auth[_0x86ac('0x9')](),controller[_0x86ac('0x1c')]);module[_0x86ac('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 380c80c..928e8b8 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 _0x116f=['roundrobin','sequelize','STRING','name','INTEGER','ENUM','beepall'];(function(_0x458401,_0x16016e){var _0x336984=function(_0x1c2a8f){while(--_0x1c2a8f){_0x458401['push'](_0x458401['shift']());}};_0x336984(++_0x16016e);}(_0x116f,0x94));var _0xf116=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x116f[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xf116('0x0'));module['exports']={'name':{'type':Sequelize[_0xf116('0x1')],'unique':_0xf116('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xf116('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf116('0x4')]('rrmemory',_0xf116('0x5'),_0xf116('0x6'))},'description':{'type':Sequelize[_0xf116('0x1')]}}; \ No newline at end of file +var _0x3e3d=['roundrobin','sequelize','exports','INTEGER','ENUM','rrmemory','beepall'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x3e3d,0x78));var _0xd3e3=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3e3d[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xd3e3('0x0'));module[_0xd3e3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xd3e3('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd3e3('0x3')](_0xd3e3('0x4'),_0xd3e3('0x5'),_0xd3e3('0x6'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index c6c7292..8e44008 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 _0xd81b=['options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','describe','UserWhatsappQueue','order','WhatsappQueueId','User','findAndCountAll','UserId','whatsappPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','findOne','Team','nolimit','addTeams','ids','Agents','online','interface','flatMap','transaction','forEach','emit','userWhatsappQueue:save','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','includes','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','redis','defaults','./whatsappQueue.socket','register','status','end','json','offset','limit','Content-Range','reject','save','update','destroy','then','get','WhatsappQueues','sendStatus','error','stack','name','index','map','WhatsappQueue','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filters','filter','merge','VIRTUAL'];(function(_0x71c2ac,_0x32eb1f){var _0x47582e=function(_0x2365f8){while(--_0x2365f8){_0x71c2ac['push'](_0x71c2ac['shift']());}};_0x47582e(++_0x32eb1f);}(_0xd81b,0x152));var _0xbd81=function(_0x58e87c,_0x471d93){_0x58e87c=_0x58e87c-0x0;var _0x3a8bb5=_0xd81b[_0x58e87c];return _0x3a8bb5;};'use strict';var pdf=require(_0xbd81('0x0'));var emlformat=require(_0xbd81('0x1'));var rimraf=require(_0xbd81('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbd81('0x3'));var moment=require(_0xbd81('0x4'));var BPromise=require(_0xbd81('0x5'));var Mustache=require(_0xbd81('0x6'));var util=require(_0xbd81('0x7'));var path=require('path');var sox=require(_0xbd81('0x8'));var csv=require(_0xbd81('0x9'));var ejs=require(_0xbd81('0xa'));var fs=require('fs');var _=require(_0xbd81('0xb'));var squel=require(_0xbd81('0xc'));var crypto=require(_0xbd81('0xd'));var jsforce=require(_0xbd81('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xbd81('0x9'));var querystring=require(_0xbd81('0xf'));var Papa=require(_0xbd81('0x10'));var Redis=require('ioredis');var authService=require(_0xbd81('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbd81('0x12'));var hardwareService=require(_0xbd81('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xbd81('0x14'));var db=require(_0xbd81('0x15'))['db'];config[_0xbd81('0x16')]=_[_0xbd81('0x17')](config[_0xbd81('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbd81('0x16')]));require(_0xbd81('0x18'))[_0xbd81('0x19')](socket);function respondWithStatusCode(_0x1ed37f,_0x16210e){_0x16210e=_0x16210e||0xcc;return function(_0x4ffbae){if(_0x4ffbae){return _0x1ed37f['sendStatus'](_0x16210e);}return _0x1ed37f[_0xbd81('0x1a')](_0x16210e)[_0xbd81('0x1b')]();};}function respondWithResult(_0x22cdef,_0x267a8d){_0x267a8d=_0x267a8d||0xc8;return function(_0x3095e6){if(_0x3095e6){return _0x22cdef[_0xbd81('0x1a')](_0x267a8d)[_0xbd81('0x1c')](_0x3095e6);}};}function respondWithFilteredResult(_0x52e0bd,_0x333b90){return function(_0x156c25){if(_0x156c25){var _0x3e527c=_0x156c25['count'],_0x5b7d89=_0x333b90[_0xbd81('0x1d')],_0x26b96d=_0x333b90[_0xbd81('0x1d')]+_0x333b90[_0xbd81('0x1e')],_0x2022d6;if(_0x26b96d>=_0x3e527c){_0x26b96d=_0x3e527c;_0x2022d6=0xc8;}else{_0x2022d6=0xce;}_0x52e0bd[_0xbd81('0x1a')](_0x2022d6);return _0x52e0bd['set'](_0xbd81('0x1f'),_0x5b7d89+'-'+_0x26b96d+'/'+_0x3e527c)[_0xbd81('0x1c')](_0x156c25);}return null;};}function patchUpdates(_0x356ca1){return function(_0x53c3b0){try{jsonpatch['apply'](_0x53c3b0,_0x356ca1,!![]);}catch(_0x28c0d1){return BPromise[_0xbd81('0x20')](_0x28c0d1);}return _0x53c3b0[_0xbd81('0x21')]();};}function saveUpdates(_0x56187d,_0x4a4bcf){return function(_0x24198c){if(_0x24198c){return _0x24198c[_0xbd81('0x22')](_0x56187d)['then'](function(_0x351c84){return _0x351c84;});}return null;};}function removeEntity(_0x33b14b,_0x1653c1){return function(_0xc9d31f){if(_0xc9d31f){return _0xc9d31f[_0xbd81('0x23')]()[_0xbd81('0x24')](function(){var _0x54bf6a=_0xc9d31f[_0xbd81('0x25')]({'plain':!![]});var _0x5b51f4=_0xbd81('0x26');return db['UserProfileResource'][_0xbd81('0x23')]({'where':{'type':_0x5b51f4,'resourceId':_0x54bf6a['id']}})[_0xbd81('0x24')](function(){return _0xc9d31f;});})[_0xbd81('0x24')](function(){_0x33b14b[_0xbd81('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b022a,_0x50c578){return function(_0x359c9f){if(!_0x359c9f){_0x2b022a[_0xbd81('0x27')](0x194);}return _0x359c9f;};}function handleError(_0x39d7af,_0x44576a){_0x44576a=_0x44576a||0x1f4;return function(_0x3fb5ef){logger[_0xbd81('0x28')](_0x3fb5ef[_0xbd81('0x29')]);if(_0x3fb5ef[_0xbd81('0x2a')]){delete _0x3fb5ef[_0xbd81('0x2a')];}_0x39d7af['status'](_0x44576a)['send'](_0x3fb5ef);};}exports[_0xbd81('0x2b')]=function(_0x5c3496,_0x162af0){var _0x21368a={},_0x364826={},_0x591f4f={'count':0x0,'rows':[]};var _0x2e2c1c=_[_0xbd81('0x2c')](db[_0xbd81('0x2d')]['rawAttributes'],function(_0x51fb0d){return{'name':_0x51fb0d[_0xbd81('0x2e')],'type':_0x51fb0d[_0xbd81('0x2f')][_0xbd81('0x30')]};});_0x364826['model']=_[_0xbd81('0x2c')](_0x2e2c1c,_0xbd81('0x2a'));_0x364826[_0xbd81('0x31')]=_[_0xbd81('0x32')](_0x5c3496[_0xbd81('0x31')]);_0x364826['filters']=_[_0xbd81('0x33')](_0x364826[_0xbd81('0x34')],_0x364826[_0xbd81('0x31')]);_0x21368a[_0xbd81('0x35')]=_[_0xbd81('0x33')](_0x364826[_0xbd81('0x34')],qs[_0xbd81('0x36')](_0x5c3496['query'][_0xbd81('0x36')]));_0x21368a[_0xbd81('0x35')]=_0x21368a[_0xbd81('0x35')][_0xbd81('0x37')]?_0x21368a[_0xbd81('0x35')]:_0x364826[_0xbd81('0x34')];if(!_0x5c3496[_0xbd81('0x31')][_0xbd81('0x38')]('nolimit')){_0x21368a[_0xbd81('0x1e')]=qs[_0xbd81('0x1e')](_0x5c3496[_0xbd81('0x31')][_0xbd81('0x1e')]);_0x21368a[_0xbd81('0x1d')]=qs[_0xbd81('0x1d')](_0x5c3496[_0xbd81('0x31')][_0xbd81('0x1d')]);}_0x21368a['order']=qs[_0xbd81('0x39')](_0x5c3496[_0xbd81('0x31')][_0xbd81('0x39')]);_0x21368a[_0xbd81('0x3a')]=qs['filters'](_[_0xbd81('0x3b')](_0x5c3496[_0xbd81('0x31')],_0x364826[_0xbd81('0x3c')]),_0x2e2c1c);if(_0x5c3496[_0xbd81('0x31')][_0xbd81('0x3d')]){_0x21368a[_0xbd81('0x3a')]=_[_0xbd81('0x3e')](_0x21368a[_0xbd81('0x3a')],{'$or':_[_0xbd81('0x2c')](_0x2e2c1c,function(_0x308158){if(_0x308158[_0xbd81('0x2f')]!==_0xbd81('0x3f')){var _0x15c503={};_0x15c503[_0x308158['name']]={'$like':'%'+_0x5c3496[_0xbd81('0x31')][_0xbd81('0x3d')]+'%'};return _0x15c503;}})});}_0x21368a=_[_0xbd81('0x3e')]({},_0x21368a,_0x5c3496[_0xbd81('0x40')]);var _0x48e1b3={'where':_0x21368a['where']};return db[_0xbd81('0x2d')]['count'](_0x48e1b3)[_0xbd81('0x24')](function(_0x3a5b34){_0x591f4f[_0xbd81('0x41')]=_0x3a5b34;if(_0x5c3496['query'][_0xbd81('0x42')]){_0x21368a[_0xbd81('0x43')]=[{'all':!![]}];}return db[_0xbd81('0x2d')][_0xbd81('0x44')](_0x21368a);})[_0xbd81('0x24')](function(_0xdfa3f8){_0x591f4f[_0xbd81('0x45')]=_0xdfa3f8;return _0x591f4f;})[_0xbd81('0x24')](respondWithFilteredResult(_0x162af0,_0x21368a))[_0xbd81('0x46')](handleError(_0x162af0,null));};exports[_0xbd81('0x47')]=function(_0x20f570,_0x136dcb){var _0x227768={'raw':!![],'where':{'id':_0x20f570[_0xbd81('0x48')]['id']}},_0xf1f350={};_0xf1f350['model']=_[_0xbd81('0x32')](db[_0xbd81('0x2d')][_0xbd81('0x49')]);_0xf1f350[_0xbd81('0x31')]=_[_0xbd81('0x32')](_0x20f570[_0xbd81('0x31')]);_0xf1f350[_0xbd81('0x3c')]=_['intersection'](_0xf1f350[_0xbd81('0x34')],_0xf1f350[_0xbd81('0x31')]);_0x227768[_0xbd81('0x35')]=_['intersection'](_0xf1f350['model'],qs[_0xbd81('0x36')](_0x20f570[_0xbd81('0x31')][_0xbd81('0x36')]));_0x227768[_0xbd81('0x35')]=_0x227768[_0xbd81('0x35')][_0xbd81('0x37')]?_0x227768[_0xbd81('0x35')]:_0xf1f350[_0xbd81('0x34')];if(_0x20f570[_0xbd81('0x31')]['includeAll']){_0x227768['include']=[{'all':!![]}];}_0x227768=_[_0xbd81('0x3e')]({},_0x227768,_0x20f570[_0xbd81('0x40')]);return db[_0xbd81('0x2d')][_0xbd81('0x4a')](_0x227768)[_0xbd81('0x24')](handleEntityNotFound(_0x136dcb,null))[_0xbd81('0x24')](respondWithResult(_0x136dcb,null))[_0xbd81('0x46')](handleError(_0x136dcb,null));};exports[_0xbd81('0x4b')]=function(_0x82032a,_0x102164){return db['WhatsappQueue'][_0xbd81('0x4b')](_0x82032a[_0xbd81('0x4c')],{})[_0xbd81('0x24')](function(_0xb7b197){var _0x42a9b3=_0x82032a['user'][_0xbd81('0x25')]({'plain':!![]});if(!_0x42a9b3)throw new Error(_0xbd81('0x4d'));if(_0x42a9b3[_0xbd81('0x4e')]==='user'){var _0x503549=_0xb7b197['get']({'plain':!![]});var _0x3d35ff=_0xbd81('0x26');return db['UserProfileSection'][_0xbd81('0x4a')]({'where':{'name':_0x3d35ff,'userProfileId':_0x42a9b3[_0xbd81('0x4f')]},'raw':!![]})[_0xbd81('0x24')](function(_0x50b9bf){if(_0x50b9bf&&_0x50b9bf['autoAssociation']===0x0){return db[_0xbd81('0x50')][_0xbd81('0x4b')]({'name':_0x503549['name'],'resourceId':_0x503549['id'],'type':_0x50b9bf['name'],'sectionId':_0x50b9bf['id']},{})[_0xbd81('0x24')](function(){return _0xb7b197;});}else{return _0xb7b197;}})[_0xbd81('0x46')](function(_0x41d8ea){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41d8ea);throw _0x41d8ea;});}return _0xb7b197;})[_0xbd81('0x24')](respondWithResult(_0x102164,0xc9))['catch'](handleError(_0x102164,null));};exports[_0xbd81('0x22')]=function(_0x24c2de,_0x57336f){if(_0x24c2de[_0xbd81('0x4c')]['id']){delete _0x24c2de[_0xbd81('0x4c')]['id'];}return db[_0xbd81('0x2d')]['find']({'where':{'id':_0x24c2de['params']['id']}})[_0xbd81('0x24')](handleEntityNotFound(_0x57336f,null))[_0xbd81('0x24')](saveUpdates(_0x24c2de[_0xbd81('0x4c')],null))[_0xbd81('0x24')](respondWithResult(_0x57336f,null))['catch'](handleError(_0x57336f,null));};exports[_0xbd81('0x23')]=function(_0x4ea22d,_0x92a555){return db[_0xbd81('0x2d')][_0xbd81('0x4a')]({'where':{'id':_0x4ea22d[_0xbd81('0x48')]['id']}})[_0xbd81('0x24')](handleEntityNotFound(_0x92a555,null))[_0xbd81('0x24')](removeEntity(_0x92a555,null))['catch'](handleError(_0x92a555,null));};exports[_0xbd81('0x51')]=function(_0x1c6e88,_0x46ad50){return db[_0xbd81('0x2d')][_0xbd81('0x51')]()[_0xbd81('0x24')](respondWithResult(_0x46ad50,null))['catch'](handleError(_0x46ad50,null));};exports['getMembers']=function(_0x5d55a8,_0x45fb3e,_0x4fd6fa){var _0xce1941={'raw':!![],'where':{}},_0x2d98f3={},_0x5ed11d;return db[_0xbd81('0x2d')]['findOne']({'where':{'id':_0x5d55a8[_0xbd81('0x48')]['id']}})[_0xbd81('0x24')](handleEntityNotFound(_0x45fb3e,null))[_0xbd81('0x24')](function(_0xc6a9dd){if(_0xc6a9dd){_0x5ed11d=_0xc6a9dd[_0xbd81('0x25')]({'plain':!![]});_0x2d98f3[_0xbd81('0x34')]=_['keys'](db[_0xbd81('0x52')][_0xbd81('0x49')]);_0x2d98f3['query']=_[_0xbd81('0x32')](_0x5d55a8[_0xbd81('0x31')]);_0x2d98f3[_0xbd81('0x3c')]=_['intersection'](_0x2d98f3[_0xbd81('0x34')],_0x2d98f3['query']);_0xce1941[_0xbd81('0x35')]=_[_0xbd81('0x33')](_0x2d98f3[_0xbd81('0x34')],qs['fields'](_0x5d55a8[_0xbd81('0x31')][_0xbd81('0x36')]));_0xce1941[_0xbd81('0x35')]=_0xce1941[_0xbd81('0x35')][_0xbd81('0x37')]?_0xce1941[_0xbd81('0x35')]:_0x2d98f3[_0xbd81('0x34')];if(!_0x5d55a8['query'][_0xbd81('0x38')]('nolimit')){_0xce1941[_0xbd81('0x1e')]=qs[_0xbd81('0x1e')](_0x5d55a8[_0xbd81('0x31')][_0xbd81('0x1e')]);_0xce1941['offset']=qs['offset'](_0x5d55a8['query'][_0xbd81('0x1d')]);}_0xce1941[_0xbd81('0x53')]=qs['sort'](_0x5d55a8['query']['sort']);_0xce1941['where']=qs[_0xbd81('0x3c')](_[_0xbd81('0x3b')](_0x5d55a8['query'],_0x2d98f3[_0xbd81('0x3c')]));_0xce1941[_0xbd81('0x3a')][_0xbd81('0x54')]=_0xc6a9dd['id'];if(_0x5d55a8[_0xbd81('0x31')][_0xbd81('0x3d')]){_0xce1941[_0xbd81('0x3a')]=_['merge'](_0xce1941['where'],{'$or':_[_0xbd81('0x2c')](_0xce1941[_0xbd81('0x35')],function(_0x204dc0){var _0x3040d1={};_0x3040d1[_0x204dc0]={'$like':'%'+_0x5d55a8[_0xbd81('0x31')]['filter']+'%'};return _0x3040d1;})});}_0xce1941=_[_0xbd81('0x3e')]({},_0xce1941,_0x5d55a8[_0xbd81('0x40')]);return db[_0xbd81('0x52')][_0xbd81('0x44')](_0xce1941);}})[_0xbd81('0x24')](function(_0x53f511){if(_0x53f511){return db[_0xbd81('0x55')][_0xbd81('0x56')]({'where':{'id':_[_0xbd81('0x2c')](_0x53f511,_0xbd81('0x57')),'role':'agent'},'attributes':['id',_0xbd81('0x2a'),_0xbd81('0x58'),_0xbd81('0x59'),'createdAt']});}})[_0xbd81('0x24')](function(_0x1dfbcb){if(_0x1dfbcb){return{'count':_0x1dfbcb[_0xbd81('0x41')],'rows':_[_0xbd81('0x2c')](_0x1dfbcb[_0xbd81('0x45')],function(_0xf87a64){return{'membername':_0xf87a64['name'],'UserId':_0xf87a64['id'],'queue_name':_0x5ed11d[_0xbd81('0x2a')],'WhatsappQueueId':_0x5ed11d['id'],'interface':util[_0xbd81('0x5a')](_0xbd81('0x5b'),_0xbd81('0x5c'),_0xf87a64[_0xbd81('0x2a')]),'penalty':0x0,'paused':_0xf87a64['whatsappPause'],'createdAt':_0xf87a64[_0xbd81('0x5d')],'updatedAt':_0xf87a64[_0xbd81('0x59')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbd81('0x24')](respondWithFilteredResult(_0x45fb3e,_0xce1941))[_0xbd81('0x46')](handleError(_0x45fb3e,null));};exports[_0xbd81('0x5e')]=function(_0x47fb86,_0x17c001,_0x2e5a63){var _0x521595={};var _0x4ea3c5={};var _0x5aaeab;var _0xafb9e0;return db[_0xbd81('0x2d')][_0xbd81('0x5f')]({'where':{'id':_0x47fb86[_0xbd81('0x48')]['id']}})[_0xbd81('0x24')](handleEntityNotFound(_0x17c001,null))[_0xbd81('0x24')](function(_0x4b338c){if(_0x4b338c){_0x5aaeab=_0x4b338c;_0x4ea3c5[_0xbd81('0x34')]=_[_0xbd81('0x32')](db[_0xbd81('0x60')]['rawAttributes']);_0x4ea3c5[_0xbd81('0x31')]=_[_0xbd81('0x32')](_0x47fb86[_0xbd81('0x31')]);_0x4ea3c5[_0xbd81('0x3c')]=_['intersection'](_0x4ea3c5[_0xbd81('0x34')],_0x4ea3c5['query']);_0x521595[_0xbd81('0x35')]=_['intersection'](_0x4ea3c5[_0xbd81('0x34')],qs['fields'](_0x47fb86[_0xbd81('0x31')][_0xbd81('0x36')]));_0x521595[_0xbd81('0x35')]=_0x521595[_0xbd81('0x35')][_0xbd81('0x37')]?_0x521595[_0xbd81('0x35')]:_0x4ea3c5[_0xbd81('0x34')];_0x521595[_0xbd81('0x53')]=qs['sort'](_0x47fb86['query'][_0xbd81('0x39')]);_0x521595[_0xbd81('0x3a')]=qs[_0xbd81('0x3c')](_['pick'](_0x47fb86[_0xbd81('0x31')],_0x4ea3c5[_0xbd81('0x3c')]));if(_0x47fb86['query'][_0xbd81('0x3d')]){_0x521595[_0xbd81('0x3a')]=_[_0xbd81('0x3e')](_0x521595[_0xbd81('0x3a')],{'$or':_[_0xbd81('0x2c')](_0x521595['attributes'],function(_0x3584ff){var _0x5eae4f={};_0x5eae4f[_0x3584ff]={'$like':'%'+_0x47fb86[_0xbd81('0x31')][_0xbd81('0x3d')]+'%'};return _0x5eae4f;})});}_0x521595=_[_0xbd81('0x3e')]({},_0x521595,_0x47fb86[_0xbd81('0x40')]);return _0x5aaeab[_0xbd81('0x5e')](_0x521595);}})[_0xbd81('0x24')](function(_0x34310c){if(_0x34310c){_0xafb9e0=_0x34310c[_0xbd81('0x37')];if(!_0x47fb86[_0xbd81('0x31')]['hasOwnProperty'](_0xbd81('0x61'))){_0x521595[_0xbd81('0x1e')]=qs[_0xbd81('0x1e')](_0x47fb86[_0xbd81('0x31')]['limit']);_0x521595[_0xbd81('0x1d')]=qs[_0xbd81('0x1d')](_0x47fb86[_0xbd81('0x31')][_0xbd81('0x1d')]);}return _0x5aaeab[_0xbd81('0x5e')](_0x521595);}})[_0xbd81('0x24')](function(_0x4ec232){if(_0x4ec232){return _0x4ec232?{'count':_0xafb9e0,'rows':_0x4ec232}:null;}})[_0xbd81('0x24')](respondWithResult(_0x17c001,null))['catch'](handleError(_0x17c001,null));};exports[_0xbd81('0x62')]=function(_0x54abc3,_0x1490c4,_0x253e7b){var _0xb0221=_0x54abc3[_0xbd81('0x4c')][_0xbd81('0x63')];return db[_0xbd81('0x60')]['findAll']({'where':{'id':_0xb0221},'attributes':['id'],'include':[{'model':db[_0xbd81('0x55')],'as':_0xbd81('0x64'),'attributes':['id',_0xbd81('0x2a'),_0xbd81('0x65'),'voicePause',_0xbd81('0x66')],'raw':!![]}]})[_0xbd81('0x24')](function(_0x44b5fa){if(_0x44b5fa){var _0x509051=_[_0xbd81('0x67')](_0x44b5fa,function(_0x439fb4){var _0x9c2ca=_0x439fb4[_0xbd81('0x25')]({'plain':!![]});return _0x9c2ca[_0xbd81('0x64')];});return db[_0xbd81('0x2d')]['find']({'where':{'id':_0x54abc3[_0xbd81('0x48')]['id']}})[_0xbd81('0x24')](function(_0x19043e){return db['sequelize'][_0xbd81('0x68')](function(_0x133731){return _0x19043e[_0xbd81('0x62')](_0xb0221,{'transaction':_0x133731})[_0xbd81('0x24')](function(){return BPromise['each'](_0x509051,function(_0x39b3d0){return db[_0xbd81('0x52')]['findOrCreate']({'where':{'UserId':_0x39b3d0['id'],'WhatsappQueueId':_0x54abc3['params']['id']},'transaction':_0x133731});});})['then'](function(){_0x509051[_0xbd81('0x69')](function(_0x1e9b46){socket[_0xbd81('0x6a')](_0xbd81('0x6b'),{'UserId':_0x1e9b46['id'],'WhatsappQueueId':_0x19043e['id']});});});});});}})['then'](respondWithStatusCode(_0x1490c4,null))[_0xbd81('0x46')](handleError(_0x1490c4,null));};exports['removeTeams']=function(_0x55da9c,_0x5132e7,_0x58ddc9){return db[_0xbd81('0x60')][_0xbd81('0x44')]({'where':{'id':_0x55da9c['query'][_0xbd81('0x63')]},'attributes':['id'],'include':[{'model':db[_0xbd81('0x55')],'as':_0xbd81('0x64'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5132e7,null))[_0xbd81('0x24')](function(_0x135ad1){var _0x94d50d=_[_0xbd81('0x2c')](_0x135ad1,'id');var _0x10087c=[];var _0x52f9b2=[];var _0x46ee9e=squel[_0xbd81('0x6c')]();_0x46ee9e[_0xbd81('0x6d')](_0xbd81('0x6e'))[_0xbd81('0x6f')](_0xbd81('0x70'),'tq')[_0xbd81('0x71')](_0xbd81('0x72'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xbd81('0x3a')]('WhatsappQueueId\x20=\x20?',_0x55da9c[_0xbd81('0x48')]['id']);for(var _0x83faf1=0x0;_0x83faf1<_0x135ad1[_0xbd81('0x37')];_0x83faf1+=0x1){let _0x2c7a0e=_0x135ad1[_0x83faf1];for(var _0x5bb6dd=0x0;_0x5bb6dd<_0x2c7a0e['Agents'][_0xbd81('0x37')];_0x5bb6dd+=0x1){let _0x156253=_0x2c7a0e[_0xbd81('0x64')][_0x5bb6dd];var _0xef4d64=_0x46ee9e[_0xbd81('0x73')]();_0xef4d64[_0xbd81('0x3a')](_0xbd81('0x74'),_0x156253['id']);_0x52f9b2[_0xbd81('0x75')](db[_0xbd81('0x76')][_0xbd81('0x31')](_0xef4d64[_0xbd81('0x77')](),{'type':db['sequelize'][_0xbd81('0x78')]['SELECT']})[_0xbd81('0x24')](function(_0xae74a8){if(_0xae74a8['length']===0x1){return _0x156253['id'];}else{var _0xb02690=_['every'](_[_0xbd81('0x2c')](_0xae74a8,'TeamId'),function(_0x4f2578){return _[_0xbd81('0x79')](_0x94d50d,_0x4f2578);});if(_0xb02690){return _0x156253['id'];}}}));}}return BPromise[_0xbd81('0x7a')](_0x52f9b2)[_0xbd81('0x24')](function(_0x1f6701){_0x10087c=_(_0x10087c)[_0xbd81('0x7b')](_0x1f6701)[_0xbd81('0x7c')]()[_0xbd81('0x7d')]();return db['WhatsappQueue'][_0xbd81('0x4a')]({'where':{'id':_0x55da9c[_0xbd81('0x48')]['id']}})['then'](function(_0x58d53f){return db[_0xbd81('0x76')][_0xbd81('0x68')](function(_0x58a288){return _0x58d53f['removeTeams'](_0x55da9c[_0xbd81('0x31')]['ids'],{'transaction':_0x58a288})['then'](function(){if(!_[_0xbd81('0x7e')](_0x10087c)){return _0x58d53f[_0xbd81('0x7f')](_0x10087c,{'transaction':_0x58a288});}})[_0xbd81('0x24')](function(){_0x10087c[_0xbd81('0x69')](function(_0xce9b0c){socket[_0xbd81('0x6a')](_0xbd81('0x80'),{'UserId':_0xce9b0c,'WhatsappQueueId':_0x58d53f['id']});});});});});});})[_0xbd81('0x24')](respondWithStatusCode(_0x5132e7,null))[_0xbd81('0x46')](handleError(_0x5132e7,null));};exports['addAgents']=function(_0x18ab83,_0x1c9708,_0x42aaf6){return db[_0xbd81('0x2d')]['find']({'where':{'id':_0x18ab83[_0xbd81('0x48')]['id']}})[_0xbd81('0x24')](handleEntityNotFound(_0x1c9708,null))[_0xbd81('0x24')](function(_0x53f0c7){if(_0x53f0c7){return _0x53f0c7[_0xbd81('0x81')](_0x18ab83[_0xbd81('0x4c')][_0xbd81('0x63')],_[_0xbd81('0x82')](_0x18ab83['body'],['ids','id'])||{})[_0xbd81('0x83')](function(_0x3322f1){for(var _0x1555fb=0x0;_0x1555fb<_0x18ab83['body'][_0xbd81('0x63')][_0xbd81('0x37')];_0x1555fb+=0x1){socket[_0xbd81('0x6a')](_0xbd81('0x6b'),{'UserId':_0x18ab83[_0xbd81('0x4c')][_0xbd81('0x63')][_0x1555fb],'WhatsappQueueId':_0x18ab83[_0xbd81('0x48')]['id']});}return _0x3322f1;});}})[_0xbd81('0x24')](respondWithResult(_0x1c9708,null))[_0xbd81('0x46')](handleError(_0x1c9708,null));};exports['removeAgents']=function(_0x2a2a6a,_0x35eb0e,_0x16f5ea){return db[_0xbd81('0x2d')][_0xbd81('0x4a')]({'where':{'id':_0x2a2a6a['params']['id']}})['then'](handleEntityNotFound(_0x35eb0e,null))[_0xbd81('0x24')](function(_0xc2bedb){if(_0xc2bedb){return _0xc2bedb[_0xbd81('0x7f')](_0x2a2a6a[_0xbd81('0x31')]['ids'])[_0xbd81('0x24')](function(){if(_[_0xbd81('0x84')](_0x2a2a6a[_0xbd81('0x31')]['ids'])){for(var _0x54a5e0=0x0;_0x54a5e0<_0x2a2a6a[_0xbd81('0x31')][_0xbd81('0x63')]['length'];_0x54a5e0+=0x1){socket[_0xbd81('0x6a')]('userWhatsappQueue:remove',{'UserId':Number(_0x2a2a6a[_0xbd81('0x31')][_0xbd81('0x63')][_0x54a5e0]),'WhatsappQueueId':Number(_0x2a2a6a[_0xbd81('0x48')]['id'])});}}else{socket['emit'](_0xbd81('0x80'),{'UserId':Number(_0x2a2a6a[_0xbd81('0x31')][_0xbd81('0x63')]),'WhatsappQueueId':Number(_0x2a2a6a['params']['id'])});}});}})[_0xbd81('0x24')](respondWithStatusCode(_0x35eb0e,null))['catch'](handleError(_0x35eb0e,null));};exports[_0xbd81('0x85')]=function(_0x4d3521,_0x4332a5,_0x11b8f2){var _0x4c7557={};var _0x498a9e={};var _0x3de2ab;var _0xc675b2;return db[_0xbd81('0x2d')]['findOne']({'where':{'id':_0x4d3521[_0xbd81('0x48')]['id']}})[_0xbd81('0x24')](handleEntityNotFound(_0x4332a5,null))[_0xbd81('0x24')](function(_0x17548b){if(_0x17548b){_0x3de2ab=_0x17548b;_0x498a9e[_0xbd81('0x34')]=_['keys'](db[_0xbd81('0x55')]['rawAttributes']);_0x498a9e[_0xbd81('0x31')]=_[_0xbd81('0x32')](_0x4d3521['query']);_0x498a9e[_0xbd81('0x3c')]=_['intersection'](_0x498a9e[_0xbd81('0x34')],_0x498a9e[_0xbd81('0x31')]);_0x4c7557[_0xbd81('0x35')]=_[_0xbd81('0x33')](_0x498a9e['model'],qs[_0xbd81('0x36')](_0x4d3521[_0xbd81('0x31')][_0xbd81('0x36')]));_0x4c7557[_0xbd81('0x35')]=_0x4c7557[_0xbd81('0x35')][_0xbd81('0x37')]?_0x4c7557[_0xbd81('0x35')]:_0x498a9e[_0xbd81('0x34')];_0x4c7557['order']=qs['sort'](_0x4d3521['query'][_0xbd81('0x39')]);_0x4c7557[_0xbd81('0x3a')]=qs[_0xbd81('0x3c')](_[_0xbd81('0x3b')](_0x4d3521[_0xbd81('0x31')],_0x498a9e[_0xbd81('0x3c')]));if(_0x4d3521['query'][_0xbd81('0x3d')]){_0x4c7557['where']=_[_0xbd81('0x3e')](_0x4c7557[_0xbd81('0x3a')],{'$or':_[_0xbd81('0x2c')](_0x4c7557[_0xbd81('0x35')],function(_0x30bfdc){var _0x954e3e={};_0x954e3e[_0x30bfdc]={'$like':'%'+_0x4d3521[_0xbd81('0x31')][_0xbd81('0x3d')]+'%'};return _0x954e3e;})});}_0x4c7557=_[_0xbd81('0x3e')]({},_0x4c7557,_0x4d3521[_0xbd81('0x40')]);return _0x3de2ab[_0xbd81('0x85')](_0x4c7557);}})[_0xbd81('0x24')](function(_0x342712){if(_0x342712){_0xc675b2=_0x342712[_0xbd81('0x37')];if(!_0x4d3521[_0xbd81('0x31')]['hasOwnProperty'](_0xbd81('0x61'))){_0x4c7557[_0xbd81('0x1e')]=qs[_0xbd81('0x1e')](_0x4d3521[_0xbd81('0x31')][_0xbd81('0x1e')]);_0x4c7557[_0xbd81('0x1d')]=qs['offset'](_0x4d3521[_0xbd81('0x31')][_0xbd81('0x1d')]);}return _0x3de2ab[_0xbd81('0x85')](_0x4c7557);}})[_0xbd81('0x24')](function(_0x22978e){if(_0x22978e){return _0x22978e?{'count':_0xc675b2,'rows':_0x22978e}:null;}})[_0xbd81('0x24')](respondWithResult(_0x4332a5,null))[_0xbd81('0x46')](handleError(_0x4332a5,null));}; \ No newline at end of file +var _0x7d6f=['addAgents','spread','isArray','getAgents','order','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','count','offset','set','json','apply','save','destroy','get','WhatsappQueues','then','end','error','stack','name','send','map','WhatsappQueue','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','show','params','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','UserWhatsappQueue','WhatsappQueueId','filter','findAndCountAll','agent','updatedAt','createdAt','format','%s/%s','SIP','whatsappPause','findOne','Team','getTeams','ids','User','Agents','flatMap','transaction','addTeams','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','team_has_whatsapp_queues','user_has_teams','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','value','isEmpty','removeAgents','emit','userWhatsappQueue:remove'];(function(_0x47f0f9,_0x353559){var _0x4df844=function(_0x192309){while(--_0x192309){_0x47f0f9['push'](_0x47f0f9['shift']());}};_0x4df844(++_0x353559);}(_0x7d6f,0x194));var _0xf7d6=function(_0x122d73,_0x510c10){_0x122d73=_0x122d73-0x0;var _0x448099=_0x7d6f[_0x122d73];return _0x448099;};'use strict';var pdf=require(_0xf7d6('0x0'));var emlformat=require(_0xf7d6('0x1'));var rimraf=require(_0xf7d6('0x2'));var zipdir=require(_0xf7d6('0x3'));var jsonpatch=require(_0xf7d6('0x4'));var rp=require(_0xf7d6('0x5'));var moment=require(_0xf7d6('0x6'));var BPromise=require(_0xf7d6('0x7'));var Mustache=require(_0xf7d6('0x8'));var util=require('util');var path=require('path');var sox=require(_0xf7d6('0x9'));var csv=require('to-csv');var ejs=require(_0xf7d6('0xa'));var fs=require('fs');var _=require(_0xf7d6('0xb'));var squel=require(_0xf7d6('0xc'));var crypto=require('crypto');var jsforce=require(_0xf7d6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf7d6('0xe'));var querystring=require(_0xf7d6('0xf'));var Papa=require(_0xf7d6('0x10'));var Redis=require('ioredis');var authService=require(_0xf7d6('0x11'));var qs=require(_0xf7d6('0x12'));var as=require(_0xf7d6('0x13'));var hardwareService=require(_0xf7d6('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf7d6('0x15'));var db=require(_0xf7d6('0x16'))['db'];config[_0xf7d6('0x17')]=_[_0xf7d6('0x18')](config[_0xf7d6('0x17')],{'host':_0xf7d6('0x19'),'port':0x18eb});var socket=require(_0xf7d6('0x1a'))(new Redis(config[_0xf7d6('0x17')]));require(_0xf7d6('0x1b'))[_0xf7d6('0x1c')](socket);function respondWithStatusCode(_0x1f04a2,_0x80776){_0x80776=_0x80776||0xcc;return function(_0x38afcc){if(_0x38afcc){return _0x1f04a2[_0xf7d6('0x1d')](_0x80776);}return _0x1f04a2[_0xf7d6('0x1e')](_0x80776)['end']();};}function respondWithResult(_0x11fd0c,_0x1da791){_0x1da791=_0x1da791||0xc8;return function(_0x58c50b){if(_0x58c50b){return _0x11fd0c[_0xf7d6('0x1e')](_0x1da791)['json'](_0x58c50b);}};}function respondWithFilteredResult(_0x14a07c,_0x49d2a2){return function(_0x4cb1e8){if(_0x4cb1e8){var _0x241d2=_0x4cb1e8[_0xf7d6('0x1f')],_0x56f459=_0x49d2a2[_0xf7d6('0x20')],_0x11f1b8=_0x49d2a2[_0xf7d6('0x20')]+_0x49d2a2['limit'],_0x26614a;if(_0x11f1b8>=_0x241d2){_0x11f1b8=_0x241d2;_0x26614a=0xc8;}else{_0x26614a=0xce;}_0x14a07c[_0xf7d6('0x1e')](_0x26614a);return _0x14a07c[_0xf7d6('0x21')]('Content-Range',_0x56f459+'-'+_0x11f1b8+'/'+_0x241d2)[_0xf7d6('0x22')](_0x4cb1e8);}return null;};}function patchUpdates(_0x3e828d){return function(_0x45c85b){try{jsonpatch[_0xf7d6('0x23')](_0x45c85b,_0x3e828d,!![]);}catch(_0x1af152){return BPromise['reject'](_0x1af152);}return _0x45c85b[_0xf7d6('0x24')]();};}function saveUpdates(_0x4ce841,_0x54ce16){return function(_0x3fdda8){if(_0x3fdda8){return _0x3fdda8['update'](_0x4ce841)['then'](function(_0x5494da){return _0x5494da;});}return null;};}function removeEntity(_0x39bd9c,_0x19fc0f){return function(_0x14552a){if(_0x14552a){return _0x14552a[_0xf7d6('0x25')]()['then'](function(){var _0x5a248a=_0x14552a[_0xf7d6('0x26')]({'plain':!![]});var _0x518a65=_0xf7d6('0x27');return db['UserProfileResource'][_0xf7d6('0x25')]({'where':{'type':_0x518a65,'resourceId':_0x5a248a['id']}})[_0xf7d6('0x28')](function(){return _0x14552a;});})[_0xf7d6('0x28')](function(){_0x39bd9c[_0xf7d6('0x1e')](0xcc)[_0xf7d6('0x29')]();});}};}function handleEntityNotFound(_0x508990,_0x314d38){return function(_0x47f2bf){if(!_0x47f2bf){_0x508990['sendStatus'](0x194);}return _0x47f2bf;};}function handleError(_0x4c156a,_0x180696){_0x180696=_0x180696||0x1f4;return function(_0x13538b){logger[_0xf7d6('0x2a')](_0x13538b[_0xf7d6('0x2b')]);if(_0x13538b[_0xf7d6('0x2c')]){delete _0x13538b[_0xf7d6('0x2c')];}_0x4c156a[_0xf7d6('0x1e')](_0x180696)[_0xf7d6('0x2d')](_0x13538b);};}exports['index']=function(_0x56368d,_0x2901e8){var _0x187afb={},_0x4e5f7c={},_0x429982={'count':0x0,'rows':[]};var _0x2fab81=_[_0xf7d6('0x2e')](db[_0xf7d6('0x2f')][_0xf7d6('0x30')],function(_0x324fbf){return{'name':_0x324fbf[_0xf7d6('0x31')],'type':_0x324fbf[_0xf7d6('0x32')]['key']};});_0x4e5f7c[_0xf7d6('0x33')]=_[_0xf7d6('0x2e')](_0x2fab81,'name');_0x4e5f7c[_0xf7d6('0x34')]=_[_0xf7d6('0x35')](_0x56368d[_0xf7d6('0x34')]);_0x4e5f7c[_0xf7d6('0x36')]=_[_0xf7d6('0x37')](_0x4e5f7c[_0xf7d6('0x33')],_0x4e5f7c[_0xf7d6('0x34')]);_0x187afb[_0xf7d6('0x38')]=_[_0xf7d6('0x37')](_0x4e5f7c[_0xf7d6('0x33')],qs[_0xf7d6('0x39')](_0x56368d[_0xf7d6('0x34')][_0xf7d6('0x39')]));_0x187afb['attributes']=_0x187afb['attributes'][_0xf7d6('0x3a')]?_0x187afb[_0xf7d6('0x38')]:_0x4e5f7c['model'];if(!_0x56368d[_0xf7d6('0x34')][_0xf7d6('0x3b')](_0xf7d6('0x3c'))){_0x187afb[_0xf7d6('0x3d')]=qs[_0xf7d6('0x3d')](_0x56368d[_0xf7d6('0x34')][_0xf7d6('0x3d')]);_0x187afb['offset']=qs[_0xf7d6('0x20')](_0x56368d[_0xf7d6('0x34')]['offset']);}_0x187afb['order']=qs[_0xf7d6('0x3e')](_0x56368d[_0xf7d6('0x34')]['sort']);_0x187afb[_0xf7d6('0x3f')]=qs['filters'](_[_0xf7d6('0x40')](_0x56368d['query'],_0x4e5f7c['filters']),_0x2fab81);if(_0x56368d[_0xf7d6('0x34')]['filter']){_0x187afb[_0xf7d6('0x3f')]=_[_0xf7d6('0x41')](_0x187afb[_0xf7d6('0x3f')],{'$or':_['map'](_0x2fab81,function(_0x5269f9){if(_0x5269f9['type']!=='VIRTUAL'){var _0x51529b={};_0x51529b[_0x5269f9[_0xf7d6('0x2c')]]={'$like':'%'+_0x56368d[_0xf7d6('0x34')]['filter']+'%'};return _0x51529b;}})});}_0x187afb=_[_0xf7d6('0x41')]({},_0x187afb,_0x56368d[_0xf7d6('0x42')]);var _0x1c8a36={'where':_0x187afb[_0xf7d6('0x3f')]};return db['WhatsappQueue'][_0xf7d6('0x1f')](_0x1c8a36)['then'](function(_0x43f897){_0x429982[_0xf7d6('0x1f')]=_0x43f897;if(_0x56368d[_0xf7d6('0x34')][_0xf7d6('0x43')]){_0x187afb[_0xf7d6('0x44')]=[{'all':!![]}];}return db[_0xf7d6('0x2f')][_0xf7d6('0x45')](_0x187afb);})[_0xf7d6('0x28')](function(_0x4c8893){_0x429982[_0xf7d6('0x46')]=_0x4c8893;return _0x429982;})[_0xf7d6('0x28')](respondWithFilteredResult(_0x2901e8,_0x187afb))[_0xf7d6('0x47')](handleError(_0x2901e8,null));};exports[_0xf7d6('0x48')]=function(_0x380e80,_0x4e872e){var _0x3eb33d={'raw':!![],'where':{'id':_0x380e80[_0xf7d6('0x49')]['id']}},_0x256e00={};_0x256e00[_0xf7d6('0x33')]=_[_0xf7d6('0x35')](db['WhatsappQueue']['rawAttributes']);_0x256e00['query']=_[_0xf7d6('0x35')](_0x380e80[_0xf7d6('0x34')]);_0x256e00[_0xf7d6('0x36')]=_['intersection'](_0x256e00[_0xf7d6('0x33')],_0x256e00[_0xf7d6('0x34')]);_0x3eb33d[_0xf7d6('0x38')]=_[_0xf7d6('0x37')](_0x256e00['model'],qs[_0xf7d6('0x39')](_0x380e80[_0xf7d6('0x34')][_0xf7d6('0x39')]));_0x3eb33d[_0xf7d6('0x38')]=_0x3eb33d[_0xf7d6('0x38')]['length']?_0x3eb33d[_0xf7d6('0x38')]:_0x256e00['model'];if(_0x380e80[_0xf7d6('0x34')][_0xf7d6('0x43')]){_0x3eb33d['include']=[{'all':!![]}];}_0x3eb33d=_['merge']({},_0x3eb33d,_0x380e80['options']);return db[_0xf7d6('0x2f')]['find'](_0x3eb33d)['then'](handleEntityNotFound(_0x4e872e,null))[_0xf7d6('0x28')](respondWithResult(_0x4e872e,null))['catch'](handleError(_0x4e872e,null));};exports['create']=function(_0x4426bc,_0x4e4c64){return db['WhatsappQueue']['create'](_0x4426bc['body'],{})[_0xf7d6('0x28')](function(_0x2931d8){var _0x576f65=_0x4426bc[_0xf7d6('0x4a')][_0xf7d6('0x26')]({'plain':!![]});if(!_0x576f65)throw new Error(_0xf7d6('0x4b'));if(_0x576f65[_0xf7d6('0x4c')]==='user'){var _0xac0352=_0x2931d8[_0xf7d6('0x26')]({'plain':!![]});var _0xf4954c=_0xf7d6('0x27');return db[_0xf7d6('0x4d')][_0xf7d6('0x4e')]({'where':{'name':_0xf4954c,'userProfileId':_0x576f65[_0xf7d6('0x4f')]},'raw':!![]})[_0xf7d6('0x28')](function(_0x5da31c){if(_0x5da31c&&_0x5da31c['autoAssociation']===0x0){return db['UserProfileResource'][_0xf7d6('0x50')]({'name':_0xac0352['name'],'resourceId':_0xac0352['id'],'type':_0x5da31c[_0xf7d6('0x2c')],'sectionId':_0x5da31c['id']},{})[_0xf7d6('0x28')](function(){return _0x2931d8;});}else{return _0x2931d8;}})[_0xf7d6('0x47')](function(_0x4f7bc6){logger[_0xf7d6('0x2a')](_0xf7d6('0x51'),_0x4f7bc6);throw _0x4f7bc6;});}return _0x2931d8;})[_0xf7d6('0x28')](respondWithResult(_0x4e4c64,0xc9))[_0xf7d6('0x47')](handleError(_0x4e4c64,null));};exports[_0xf7d6('0x52')]=function(_0x5bf352,_0x22253e){if(_0x5bf352[_0xf7d6('0x53')]['id']){delete _0x5bf352['body']['id'];}return db[_0xf7d6('0x2f')][_0xf7d6('0x4e')]({'where':{'id':_0x5bf352[_0xf7d6('0x49')]['id']}})[_0xf7d6('0x28')](handleEntityNotFound(_0x22253e,null))[_0xf7d6('0x28')](saveUpdates(_0x5bf352[_0xf7d6('0x53')],null))[_0xf7d6('0x28')](respondWithResult(_0x22253e,null))[_0xf7d6('0x47')](handleError(_0x22253e,null));};exports['destroy']=function(_0x44ed0a,_0x44a19d){return db['WhatsappQueue']['find']({'where':{'id':_0x44ed0a[_0xf7d6('0x49')]['id']}})[_0xf7d6('0x28')](handleEntityNotFound(_0x44a19d,null))[_0xf7d6('0x28')](removeEntity(_0x44a19d,null))[_0xf7d6('0x47')](handleError(_0x44a19d,null));};exports[_0xf7d6('0x54')]=function(_0x3d3385,_0x1e4a73){return db[_0xf7d6('0x2f')][_0xf7d6('0x54')]()[_0xf7d6('0x28')](respondWithResult(_0x1e4a73,null))[_0xf7d6('0x47')](handleError(_0x1e4a73,null));};exports[_0xf7d6('0x55')]=function(_0x339557,_0x52c9f0,_0x343e11){var _0x4431ec={'raw':!![],'where':{}},_0x35b4c3={},_0x464738;return db['WhatsappQueue']['findOne']({'where':{'id':_0x339557[_0xf7d6('0x49')]['id']}})[_0xf7d6('0x28')](handleEntityNotFound(_0x52c9f0,null))[_0xf7d6('0x28')](function(_0x551509){if(_0x551509){_0x464738=_0x551509[_0xf7d6('0x26')]({'plain':!![]});_0x35b4c3[_0xf7d6('0x33')]=_['keys'](db[_0xf7d6('0x56')]['rawAttributes']);_0x35b4c3['query']=_['keys'](_0x339557[_0xf7d6('0x34')]);_0x35b4c3['filters']=_[_0xf7d6('0x37')](_0x35b4c3[_0xf7d6('0x33')],_0x35b4c3[_0xf7d6('0x34')]);_0x4431ec['attributes']=_[_0xf7d6('0x37')](_0x35b4c3[_0xf7d6('0x33')],qs[_0xf7d6('0x39')](_0x339557[_0xf7d6('0x34')]['fields']));_0x4431ec[_0xf7d6('0x38')]=_0x4431ec[_0xf7d6('0x38')]['length']?_0x4431ec[_0xf7d6('0x38')]:_0x35b4c3[_0xf7d6('0x33')];if(!_0x339557['query'][_0xf7d6('0x3b')](_0xf7d6('0x3c'))){_0x4431ec[_0xf7d6('0x3d')]=qs[_0xf7d6('0x3d')](_0x339557['query'][_0xf7d6('0x3d')]);_0x4431ec[_0xf7d6('0x20')]=qs[_0xf7d6('0x20')](_0x339557[_0xf7d6('0x34')][_0xf7d6('0x20')]);}_0x4431ec['order']=qs[_0xf7d6('0x3e')](_0x339557[_0xf7d6('0x34')][_0xf7d6('0x3e')]);_0x4431ec[_0xf7d6('0x3f')]=qs[_0xf7d6('0x36')](_[_0xf7d6('0x40')](_0x339557['query'],_0x35b4c3[_0xf7d6('0x36')]));_0x4431ec[_0xf7d6('0x3f')][_0xf7d6('0x57')]=_0x551509['id'];if(_0x339557[_0xf7d6('0x34')][_0xf7d6('0x58')]){_0x4431ec['where']=_[_0xf7d6('0x41')](_0x4431ec[_0xf7d6('0x3f')],{'$or':_[_0xf7d6('0x2e')](_0x4431ec[_0xf7d6('0x38')],function(_0x30d5e5){var _0x241e73={};_0x241e73[_0x30d5e5]={'$like':'%'+_0x339557[_0xf7d6('0x34')][_0xf7d6('0x58')]+'%'};return _0x241e73;})});}_0x4431ec=_['merge']({},_0x4431ec,_0x339557[_0xf7d6('0x42')]);return db[_0xf7d6('0x56')][_0xf7d6('0x45')](_0x4431ec);}})[_0xf7d6('0x28')](function(_0x20ac1f){if(_0x20ac1f){return db['User'][_0xf7d6('0x59')]({'where':{'id':_[_0xf7d6('0x2e')](_0x20ac1f,'UserId'),'role':_0xf7d6('0x5a')},'attributes':['id',_0xf7d6('0x2c'),'whatsappPause',_0xf7d6('0x5b'),_0xf7d6('0x5c')]});}})['then'](function(_0x3da982){if(_0x3da982){return{'count':_0x3da982[_0xf7d6('0x1f')],'rows':_[_0xf7d6('0x2e')](_0x3da982[_0xf7d6('0x46')],function(_0x94e22e){return{'membername':_0x94e22e[_0xf7d6('0x2c')],'UserId':_0x94e22e['id'],'queue_name':_0x464738[_0xf7d6('0x2c')],'WhatsappQueueId':_0x464738['id'],'interface':util[_0xf7d6('0x5d')](_0xf7d6('0x5e'),_0xf7d6('0x5f'),_0x94e22e[_0xf7d6('0x2c')]),'penalty':0x0,'paused':_0x94e22e[_0xf7d6('0x60')],'createdAt':_0x94e22e[_0xf7d6('0x5c')],'updatedAt':_0x94e22e[_0xf7d6('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf7d6('0x28')](respondWithFilteredResult(_0x52c9f0,_0x4431ec))['catch'](handleError(_0x52c9f0,null));};exports['getTeams']=function(_0xf38fad,_0x4378e3,_0x3fa3c8){var _0x2610c2={};var _0x5b3550={};var _0x3a36b4;var _0x3528e3;return db[_0xf7d6('0x2f')][_0xf7d6('0x61')]({'where':{'id':_0xf38fad[_0xf7d6('0x49')]['id']}})['then'](handleEntityNotFound(_0x4378e3,null))['then'](function(_0x25db92){if(_0x25db92){_0x3a36b4=_0x25db92;_0x5b3550[_0xf7d6('0x33')]=_[_0xf7d6('0x35')](db[_0xf7d6('0x62')][_0xf7d6('0x30')]);_0x5b3550[_0xf7d6('0x34')]=_['keys'](_0xf38fad[_0xf7d6('0x34')]);_0x5b3550['filters']=_['intersection'](_0x5b3550[_0xf7d6('0x33')],_0x5b3550[_0xf7d6('0x34')]);_0x2610c2['attributes']=_[_0xf7d6('0x37')](_0x5b3550[_0xf7d6('0x33')],qs[_0xf7d6('0x39')](_0xf38fad['query'][_0xf7d6('0x39')]));_0x2610c2[_0xf7d6('0x38')]=_0x2610c2[_0xf7d6('0x38')][_0xf7d6('0x3a')]?_0x2610c2[_0xf7d6('0x38')]:_0x5b3550['model'];_0x2610c2['order']=qs[_0xf7d6('0x3e')](_0xf38fad[_0xf7d6('0x34')][_0xf7d6('0x3e')]);_0x2610c2[_0xf7d6('0x3f')]=qs['filters'](_[_0xf7d6('0x40')](_0xf38fad[_0xf7d6('0x34')],_0x5b3550[_0xf7d6('0x36')]));if(_0xf38fad[_0xf7d6('0x34')][_0xf7d6('0x58')]){_0x2610c2[_0xf7d6('0x3f')]=_[_0xf7d6('0x41')](_0x2610c2['where'],{'$or':_[_0xf7d6('0x2e')](_0x2610c2[_0xf7d6('0x38')],function(_0x2e5ced){var _0x226f75={};_0x226f75[_0x2e5ced]={'$like':'%'+_0xf38fad[_0xf7d6('0x34')][_0xf7d6('0x58')]+'%'};return _0x226f75;})});}_0x2610c2=_[_0xf7d6('0x41')]({},_0x2610c2,_0xf38fad[_0xf7d6('0x42')]);return _0x3a36b4['getTeams'](_0x2610c2);}})[_0xf7d6('0x28')](function(_0x6f04f5){if(_0x6f04f5){_0x3528e3=_0x6f04f5['length'];if(!_0xf38fad[_0xf7d6('0x34')][_0xf7d6('0x3b')](_0xf7d6('0x3c'))){_0x2610c2['limit']=qs[_0xf7d6('0x3d')](_0xf38fad[_0xf7d6('0x34')][_0xf7d6('0x3d')]);_0x2610c2['offset']=qs['offset'](_0xf38fad['query'][_0xf7d6('0x20')]);}return _0x3a36b4[_0xf7d6('0x63')](_0x2610c2);}})[_0xf7d6('0x28')](function(_0x3f2aaa){if(_0x3f2aaa){return _0x3f2aaa?{'count':_0x3528e3,'rows':_0x3f2aaa}:null;}})[_0xf7d6('0x28')](respondWithResult(_0x4378e3,null))[_0xf7d6('0x47')](handleError(_0x4378e3,null));};exports['addTeams']=function(_0x487324,_0x29dbc3,_0x4348e7){var _0x2e4af2=_0x487324[_0xf7d6('0x53')][_0xf7d6('0x64')];return db[_0xf7d6('0x62')][_0xf7d6('0x45')]({'where':{'id':_0x2e4af2},'attributes':['id'],'include':[{'model':db[_0xf7d6('0x65')],'as':_0xf7d6('0x66'),'attributes':['id',_0xf7d6('0x2c'),'online','voicePause','interface'],'raw':!![]}]})[_0xf7d6('0x28')](function(_0xcb7758){if(_0xcb7758){var _0x11cc71=_[_0xf7d6('0x67')](_0xcb7758,function(_0x335d5f){var _0x8d1db6=_0x335d5f['get']({'plain':!![]});return _0x8d1db6[_0xf7d6('0x66')];});return db[_0xf7d6('0x2f')][_0xf7d6('0x4e')]({'where':{'id':_0x487324['params']['id']}})[_0xf7d6('0x28')](function(_0x21c8e6){return db['sequelize'][_0xf7d6('0x68')](function(_0x3d5f47){return _0x21c8e6[_0xf7d6('0x69')](_0x2e4af2,{'transaction':_0x3d5f47})[_0xf7d6('0x28')](function(){return BPromise[_0xf7d6('0x6a')](_0x11cc71,function(_0x567d0d){return db[_0xf7d6('0x56')][_0xf7d6('0x6b')]({'where':{'UserId':_0x567d0d['id'],'WhatsappQueueId':_0x487324[_0xf7d6('0x49')]['id']},'transaction':_0x3d5f47});});})['then'](function(){_0x11cc71[_0xf7d6('0x6c')](function(_0x525043){socket['emit'](_0xf7d6('0x6d'),{'UserId':_0x525043['id'],'WhatsappQueueId':_0x21c8e6['id']});});});});});}})[_0xf7d6('0x28')](respondWithStatusCode(_0x29dbc3,null))[_0xf7d6('0x47')](handleError(_0x29dbc3,null));};exports[_0xf7d6('0x6e')]=function(_0x474e5f,_0x4cd3b7,_0x591b42){return db[_0xf7d6('0x62')][_0xf7d6('0x45')]({'where':{'id':_0x474e5f[_0xf7d6('0x34')][_0xf7d6('0x64')]},'attributes':['id'],'include':[{'model':db[_0xf7d6('0x65')],'as':_0xf7d6('0x66'),'attributes':['id'],'raw':!![]}]})[_0xf7d6('0x28')](handleEntityNotFound(_0x4cd3b7,null))[_0xf7d6('0x28')](function(_0x24f6e6){var _0x11efbf=_[_0xf7d6('0x2e')](_0x24f6e6,'id');var _0x5e2386=[];var _0x54da8f=[];var _0x49bf4c=squel[_0xf7d6('0x6f')]();_0x49bf4c['field']('tq.TeamId')['from'](_0xf7d6('0x70'),'tq')['join'](_0xf7d6('0x71'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('WhatsappQueueId\x20=\x20?',_0x474e5f['params']['id']);for(var _0x4de955=0x0;_0x4de955<_0x24f6e6['length'];_0x4de955+=0x1){let _0x2ae356=_0x24f6e6[_0x4de955];for(var _0x433cd4=0x0;_0x433cd4<_0x2ae356[_0xf7d6('0x66')][_0xf7d6('0x3a')];_0x433cd4+=0x1){let _0x1c8a0d=_0x2ae356['Agents'][_0x433cd4];var _0x5ccc8c=_0x49bf4c['clone']();_0x5ccc8c[_0xf7d6('0x3f')]('ut.UserId\x20=\x20?',_0x1c8a0d['id']);_0x54da8f[_0xf7d6('0x72')](db[_0xf7d6('0x73')][_0xf7d6('0x34')](_0x5ccc8c[_0xf7d6('0x74')](),{'type':db[_0xf7d6('0x73')][_0xf7d6('0x75')][_0xf7d6('0x76')]})[_0xf7d6('0x28')](function(_0x55ce00){if(_0x55ce00['length']===0x1){return _0x1c8a0d['id'];}else{var _0x1b9fa4=_[_0xf7d6('0x77')](_['map'](_0x55ce00,_0xf7d6('0x78')),function(_0x49f8cf){return _[_0xf7d6('0x79')](_0x11efbf,_0x49f8cf);});if(_0x1b9fa4){return _0x1c8a0d['id'];}}}));}}return BPromise[_0xf7d6('0x7a')](_0x54da8f)['then'](function(_0x4a482f){_0x5e2386=_(_0x5e2386)['union'](_0x4a482f)['compact']()[_0xf7d6('0x7b')]();return db['WhatsappQueue']['find']({'where':{'id':_0x474e5f[_0xf7d6('0x49')]['id']}})[_0xf7d6('0x28')](function(_0x5e8ea8){return db['sequelize'][_0xf7d6('0x68')](function(_0x2e3e74){return _0x5e8ea8['removeTeams'](_0x474e5f['query']['ids'],{'transaction':_0x2e3e74})['then'](function(){if(!_[_0xf7d6('0x7c')](_0x5e2386)){return _0x5e8ea8[_0xf7d6('0x7d')](_0x5e2386,{'transaction':_0x2e3e74});}})[_0xf7d6('0x28')](function(){_0x5e2386[_0xf7d6('0x6c')](function(_0x5bf8bf){socket[_0xf7d6('0x7e')](_0xf7d6('0x7f'),{'UserId':_0x5bf8bf,'WhatsappQueueId':_0x5e8ea8['id']});});});});});});})[_0xf7d6('0x28')](respondWithStatusCode(_0x4cd3b7,null))[_0xf7d6('0x47')](handleError(_0x4cd3b7,null));};exports[_0xf7d6('0x80')]=function(_0x252714,_0x364005,_0xd6153){return db[_0xf7d6('0x2f')][_0xf7d6('0x4e')]({'where':{'id':_0x252714['params']['id']}})[_0xf7d6('0x28')](handleEntityNotFound(_0x364005,null))[_0xf7d6('0x28')](function(_0x2f7c5c){if(_0x2f7c5c){return _0x2f7c5c[_0xf7d6('0x80')](_0x252714[_0xf7d6('0x53')]['ids'],_['omit'](_0x252714[_0xf7d6('0x53')],[_0xf7d6('0x64'),'id'])||{})[_0xf7d6('0x81')](function(_0x30d7d2){for(var _0x211204=0x0;_0x211204<_0x252714[_0xf7d6('0x53')][_0xf7d6('0x64')][_0xf7d6('0x3a')];_0x211204+=0x1){socket[_0xf7d6('0x7e')](_0xf7d6('0x6d'),{'UserId':_0x252714[_0xf7d6('0x53')][_0xf7d6('0x64')][_0x211204],'WhatsappQueueId':_0x252714[_0xf7d6('0x49')]['id']});}return _0x30d7d2;});}})[_0xf7d6('0x28')](respondWithResult(_0x364005,null))[_0xf7d6('0x47')](handleError(_0x364005,null));};exports[_0xf7d6('0x7d')]=function(_0xa0f0d,_0x34f7bf,_0x1377ff){return db[_0xf7d6('0x2f')][_0xf7d6('0x4e')]({'where':{'id':_0xa0f0d[_0xf7d6('0x49')]['id']}})[_0xf7d6('0x28')](handleEntityNotFound(_0x34f7bf,null))[_0xf7d6('0x28')](function(_0x36d57d){if(_0x36d57d){return _0x36d57d[_0xf7d6('0x7d')](_0xa0f0d[_0xf7d6('0x34')][_0xf7d6('0x64')])[_0xf7d6('0x28')](function(){if(_[_0xf7d6('0x82')](_0xa0f0d['query'][_0xf7d6('0x64')])){for(var _0x1c8ca0=0x0;_0x1c8ca0<_0xa0f0d[_0xf7d6('0x34')][_0xf7d6('0x64')][_0xf7d6('0x3a')];_0x1c8ca0+=0x1){socket[_0xf7d6('0x7e')]('userWhatsappQueue:remove',{'UserId':Number(_0xa0f0d[_0xf7d6('0x34')][_0xf7d6('0x64')][_0x1c8ca0]),'WhatsappQueueId':Number(_0xa0f0d['params']['id'])});}}else{socket[_0xf7d6('0x7e')](_0xf7d6('0x7f'),{'UserId':Number(_0xa0f0d[_0xf7d6('0x34')][_0xf7d6('0x64')]),'WhatsappQueueId':Number(_0xa0f0d[_0xf7d6('0x49')]['id'])});}});}})[_0xf7d6('0x28')](respondWithStatusCode(_0x34f7bf,null))[_0xf7d6('0x47')](handleError(_0x34f7bf,null));};exports[_0xf7d6('0x83')]=function(_0x221e16,_0x45a46c,_0x47f9d4){var _0x24aa6a={};var _0xf71157={};var _0x13d2ce;var _0x20c2e1;return db[_0xf7d6('0x2f')][_0xf7d6('0x61')]({'where':{'id':_0x221e16[_0xf7d6('0x49')]['id']}})['then'](handleEntityNotFound(_0x45a46c,null))[_0xf7d6('0x28')](function(_0x30fb3e){if(_0x30fb3e){_0x13d2ce=_0x30fb3e;_0xf71157[_0xf7d6('0x33')]=_['keys'](db[_0xf7d6('0x65')][_0xf7d6('0x30')]);_0xf71157[_0xf7d6('0x34')]=_[_0xf7d6('0x35')](_0x221e16['query']);_0xf71157[_0xf7d6('0x36')]=_['intersection'](_0xf71157['model'],_0xf71157[_0xf7d6('0x34')]);_0x24aa6a[_0xf7d6('0x38')]=_[_0xf7d6('0x37')](_0xf71157[_0xf7d6('0x33')],qs[_0xf7d6('0x39')](_0x221e16['query']['fields']));_0x24aa6a[_0xf7d6('0x38')]=_0x24aa6a[_0xf7d6('0x38')][_0xf7d6('0x3a')]?_0x24aa6a[_0xf7d6('0x38')]:_0xf71157[_0xf7d6('0x33')];_0x24aa6a[_0xf7d6('0x84')]=qs[_0xf7d6('0x3e')](_0x221e16[_0xf7d6('0x34')]['sort']);_0x24aa6a[_0xf7d6('0x3f')]=qs[_0xf7d6('0x36')](_[_0xf7d6('0x40')](_0x221e16[_0xf7d6('0x34')],_0xf71157[_0xf7d6('0x36')]));if(_0x221e16[_0xf7d6('0x34')][_0xf7d6('0x58')]){_0x24aa6a['where']=_[_0xf7d6('0x41')](_0x24aa6a[_0xf7d6('0x3f')],{'$or':_[_0xf7d6('0x2e')](_0x24aa6a[_0xf7d6('0x38')],function(_0x378d35){var _0x4fe056={};_0x4fe056[_0x378d35]={'$like':'%'+_0x221e16[_0xf7d6('0x34')]['filter']+'%'};return _0x4fe056;})});}_0x24aa6a=_[_0xf7d6('0x41')]({},_0x24aa6a,_0x221e16[_0xf7d6('0x42')]);return _0x13d2ce[_0xf7d6('0x83')](_0x24aa6a);}})[_0xf7d6('0x28')](function(_0x5291eb){if(_0x5291eb){_0x20c2e1=_0x5291eb[_0xf7d6('0x3a')];if(!_0x221e16[_0xf7d6('0x34')]['hasOwnProperty']('nolimit')){_0x24aa6a[_0xf7d6('0x3d')]=qs[_0xf7d6('0x3d')](_0x221e16[_0xf7d6('0x34')][_0xf7d6('0x3d')]);_0x24aa6a[_0xf7d6('0x20')]=qs['offset'](_0x221e16[_0xf7d6('0x34')][_0xf7d6('0x20')]);}return _0x13d2ce[_0xf7d6('0x83')](_0x24aa6a);}})[_0xf7d6('0x28')](function(_0x244803){if(_0x244803){return _0x244803?{'count':_0x20c2e1,'rows':_0x244803}:null;}})[_0xf7d6('0x28')](respondWithResult(_0x45a46c,null))[_0xf7d6('0x47')](handleError(_0x45a46c,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 997a9ec..84c5012 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 _0x108f=['setMaxListeners','update','remove','emit','hook','exports','events','../../mysqldb','WhatsappQueue'];(function(_0x33cd9b,_0xfa877d){var _0x33be3d=function(_0xb1a8e9){while(--_0xb1a8e9){_0x33cd9b['push'](_0x33cd9b['shift']());}};_0x33be3d(++_0xfa877d);}(_0x108f,0xd5));var _0xf108=function(_0xcfca7e,_0x2e86aa){_0xcfca7e=_0xcfca7e-0x0;var _0x5a7672=_0x108f[_0xcfca7e];return _0x5a7672;};'use strict';var EventEmitter=require(_0xf108('0x0'));var WhatsappQueue=require(_0xf108('0x1'))['db'][_0xf108('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xf108('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf108('0x4'),'afterDestroy':_0xf108('0x5')};function emitEvent(_0x20ff1b){return function(_0x1feba5,_0x21344b,_0x1f009d){WhatsappQueueEvents[_0xf108('0x6')](_0x20ff1b+':'+_0x1feba5['id'],_0x1feba5);WhatsappQueueEvents['emit'](_0x20ff1b,_0x1feba5);_0x1f009d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xf108('0x7')](e,emitEvent(event));}}module[_0xf108('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x7f35=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappQueue','setMaxListeners','update'];(function(_0x2f5087,_0x338805){var _0x38f3a9=function(_0x1af80a){while(--_0x1af80a){_0x2f5087['push'](_0x2f5087['shift']());}};_0x38f3a9(++_0x338805);}(_0x7f35,0x101));var _0x57f3=function(_0x2b3078,_0x21933b){_0x2b3078=_0x2b3078-0x0;var _0x474db3=_0x7f35[_0x2b3078];return _0x474db3;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x57f3('0x0'))['db'][_0x57f3('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x57f3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x57f3('0x3'),'afterDestroy':_0x57f3('0x4')};function emitEvent(_0x21b188){return function(_0x117440,_0x1d4a1d,_0x1b3d2f){WhatsappQueueEvents[_0x57f3('0x5')](_0x21b188+':'+_0x117440['id'],_0x117440);WhatsappQueueEvents[_0x57f3('0x5')](_0x21b188,_0x117440);_0x1b3d2f(null);};}for(var e in events){if(events[_0x57f3('0x6')](e)){var event=events[e];WhatsappQueue[_0x57f3('0x7')](e,emitEvent(event));}}module[_0x57f3('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 59164e7..89c2938 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 _0xf757=['define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','path','rimraf','./whatsappQueue.attributes','exports'];(function(_0x5a84c7,_0x10c10f){var _0x3f2015=function(_0xbb3f5b){while(--_0xbb3f5b){_0x5a84c7['push'](_0x5a84c7['shift']());}};_0x3f2015(++_0x10c10f);}(_0xf757,0x18f));var _0x7f75=function(_0x2ab76b,_0x176579){_0x2ab76b=_0x2ab76b-0x0;var _0x201126=_0xf757[_0x2ab76b];return _0x201126;};'use strict';var _=require(_0x7f75('0x0'));var util=require(_0x7f75('0x1'));var logger=require(_0x7f75('0x2'))(_0x7f75('0x3'));var moment=require(_0x7f75('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f75('0x5'));var rimraf=require(_0x7f75('0x6'));var config=require('../../config/environment');var attributes=require(_0x7f75('0x7'));module[_0x7f75('0x8')]=function(_0x8e8268,_0x4aa736){return _0x8e8268[_0x7f75('0x9')](_0x7f75('0xa'),attributes,{'tableName':_0x7f75('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa93e=['whatsapp_queues','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x4af0a7,_0x49afdd){var _0x2d7cc9=function(_0x3b3089){while(--_0x3b3089){_0x4af0a7['push'](_0x4af0a7['shift']());}};_0x2d7cc9(++_0x49afdd);}(_0xa93e,0xfd));var _0xea93=function(_0x5657fe,_0x5db525){_0x5657fe=_0x5657fe-0x0;var _0x1ebbbc=_0xa93e[_0x5657fe];return _0x1ebbbc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xea93('0x0'))(_0xea93('0x1'));var moment=require(_0xea93('0x2'));var BPromise=require(_0xea93('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea93('0x4'));var rimraf=require(_0xea93('0x5'));var config=require(_0xea93('0x6'));var attributes=require('./whatsappQueue.attributes');module[_0xea93('0x7')]=function(_0x5472de,_0x17f3cd){return _0x5472de['define']('WhatsappQueue',attributes,{'tableName':_0xea93('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index c2ad54e..04292a2 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 _0x72b0=['socket.io-emitter','./whatsappQueue.socket','register','request','then','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowWhatsappQueue','lodash','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults'];(function(_0x244f6c,_0x20f81b){var _0x5bdfb3=function(_0x2997a9){while(--_0x2997a9){_0x244f6c['push'](_0x244f6c['shift']());}};_0x5bdfb3(++_0x20f81b);}(_0x72b0,0x135));var _0x072b=function(_0x4a807c,_0x475779){_0x4a807c=_0x4a807c-0x0;var _0x5284ba=_0x72b0[_0x4a807c];return _0x5284ba;};'use strict';var _=require(_0x072b('0x0'));var util=require(_0x072b('0x1'));var moment=require('moment');var BPromise=require(_0x072b('0x2'));var rs=require(_0x072b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x072b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x072b('0x5'));var config=require(_0x072b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x072b('0x7')][_0x072b('0x8')]({'port':0x232a});config[_0x072b('0x9')]=_[_0x072b('0xa')](config[_0x072b('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x072b('0xb'))(new Redis(config[_0x072b('0x9')]));require(_0x072b('0xc'))[_0x072b('0xd')](socket);function respondWithRpcPromise(_0x33feb7,_0x45503b,_0x5c7233){return new BPromise(function(_0x27cd5b,_0x4a1c48){return client[_0x072b('0xe')](_0x33feb7,_0x5c7233)[_0x072b('0xf')](function(_0x483874){logger[_0x072b('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0x45503b,_0x072b('0x11'));logger[_0x072b('0x12')](_0x072b('0x13'),_0x45503b,_0x072b('0x11'),JSON[_0x072b('0x14')](_0x483874));if(_0x483874[_0x072b('0x15')]){if(_0x483874[_0x072b('0x15')][_0x072b('0x16')]===0x1f4){logger[_0x072b('0x15')](_0x072b('0x17'),_0x45503b,_0x483874['error'][_0x072b('0x18')]);return _0x4a1c48(_0x483874['error'][_0x072b('0x18')]);}logger['error'](_0x072b('0x17'),_0x45503b,_0x483874[_0x072b('0x15')][_0x072b('0x18')]);return _0x27cd5b(_0x483874[_0x072b('0x15')][_0x072b('0x18')]);}else{logger[_0x072b('0x10')](_0x072b('0x17'),_0x45503b,_0x072b('0x11'));_0x27cd5b(_0x483874[_0x072b('0x19')][_0x072b('0x18')]);}})[_0x072b('0x1a')](function(_0x22adbb){logger[_0x072b('0x15')](_0x072b('0x17'),_0x45503b,_0x22adbb);_0x4a1c48(_0x22adbb);});});}exports[_0x072b('0x1b')]=function(_0x5ec50e){var _0x1bf00c=this;return new Promise(function(_0x5d0a8f,_0xa7708c){return db[_0x072b('0x1c')][_0x072b('0x1d')]({'raw':_0x5ec50e[_0x072b('0x1e')]?_0x5ec50e[_0x072b('0x1e')][_0x072b('0x1f')]===undefined?!![]:![]:!![],'where':_0x5ec50e['options']?_0x5ec50e[_0x072b('0x1e')][_0x072b('0x20')]||null:null,'attributes':_0x5ec50e[_0x072b('0x1e')]?_0x5ec50e[_0x072b('0x1e')][_0x072b('0x21')]||null:null,'limit':_0x5ec50e[_0x072b('0x1e')]?_0x5ec50e['options'][_0x072b('0x22')]||null:null,'include':_0x5ec50e[_0x072b('0x1e')]?_0x5ec50e[_0x072b('0x1e')][_0x072b('0x23')]?_[_0x072b('0x24')](_0x5ec50e[_0x072b('0x1e')][_0x072b('0x23')],function(_0x3bf776){return{'model':db[_0x3bf776[_0x072b('0x25')]],'as':_0x3bf776['as'],'attributes':_0x3bf776[_0x072b('0x21')],'include':_0x3bf776[_0x072b('0x23')]?_[_0x072b('0x24')](_0x3bf776['include'],function(_0xe6b38){return{'model':db[_0xe6b38[_0x072b('0x25')]],'as':_0xe6b38['as'],'attributes':_0xe6b38['attributes'],'include':_0xe6b38['include']?_[_0x072b('0x24')](_0xe6b38['include'],function(_0x4d7c66){return{'model':db[_0x4d7c66[_0x072b('0x25')]],'as':_0x4d7c66['as'],'attributes':_0x4d7c66[_0x072b('0x21')]};}):[]};}):[]};}):[]:[]})[_0x072b('0xf')](function(_0xf2d58){logger['info'](_0x072b('0x1b'),_0x5ec50e);logger['debug'](_0x072b('0x1b'),_0x5ec50e,JSON[_0x072b('0x14')](_0xf2d58));_0x5d0a8f(_0xf2d58);})[_0x072b('0x1a')](function(_0x283754){logger['error']('GetWhatsappQueue',_0x283754[_0x072b('0x18')],_0x5ec50e);_0xa7708c(_0x1bf00c['error'](0x1f4,_0x283754[_0x072b('0x18')]));});});};exports['ShowWhatsappQueue']=function(_0x5bb629){var _0x40cbfd=this;return new Promise(function(_0x25b420,_0x30d57e){return db[_0x072b('0x1c')][_0x072b('0x26')]({'raw':_0x5bb629[_0x072b('0x1e')]?_0x5bb629['options'][_0x072b('0x1f')]===undefined?!![]:![]:!![],'where':_0x5bb629['options']?_0x5bb629[_0x072b('0x1e')][_0x072b('0x20')]||null:null,'attributes':_0x5bb629[_0x072b('0x1e')]?_0x5bb629[_0x072b('0x1e')][_0x072b('0x21')]||null:null,'include':_0x5bb629[_0x072b('0x1e')]?_0x5bb629[_0x072b('0x1e')][_0x072b('0x23')]?_[_0x072b('0x24')](_0x5bb629[_0x072b('0x1e')]['include'],function(_0x283b94){return{'model':db[_0x283b94['model']],'as':_0x283b94['as'],'attributes':_0x283b94[_0x072b('0x21')],'include':_0x283b94[_0x072b('0x23')]?_[_0x072b('0x24')](_0x283b94[_0x072b('0x23')],function(_0x30348f){return{'model':db[_0x30348f['model']],'as':_0x30348f['as'],'attributes':_0x30348f[_0x072b('0x21')],'include':_0x30348f[_0x072b('0x23')]?_[_0x072b('0x24')](_0x30348f[_0x072b('0x23')],function(_0x596da6){return{'model':db[_0x596da6[_0x072b('0x25')]],'as':_0x596da6['as'],'attributes':_0x596da6[_0x072b('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2afba6){logger[_0x072b('0x10')](_0x072b('0x27'),_0x5bb629);logger[_0x072b('0x12')]('ShowWhatsappQueue',_0x5bb629,JSON['stringify'](_0x2afba6));_0x25b420(_0x2afba6);})[_0x072b('0x1a')](function(_0xc91b79){logger[_0x072b('0x15')](_0x072b('0x27'),_0xc91b79[_0x072b('0x18')],_0x5bb629);_0x30d57e(_0x40cbfd[_0x072b('0x15')](0x1f4,_0xc91b79[_0x072b('0x18')]));});});}; \ No newline at end of file +var _0xd7cc=['WhatsappQueue','findAll','raw','options','where','attributes','limit','include','map','model','stringify','catch','ShowWhatsappQueue','find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','code','message','error','info','result','GetWhatsappQueue'];(function(_0x297b74,_0x178ef7){var _0x5158ba=function(_0x2efcbf){while(--_0x2efcbf){_0x297b74['push'](_0x297b74['shift']());}};_0x5158ba(++_0x178ef7);}(_0xd7cc,0x8c));var _0xcd7c=function(_0x2737cc,_0x412f5f){_0x2737cc=_0x2737cc-0x0;var _0x9ccf20=_0xd7cc[_0x2737cc];return _0x9ccf20;};'use strict';var _=require(_0xcd7c('0x0'));var util=require(_0xcd7c('0x1'));var moment=require(_0xcd7c('0x2'));var BPromise=require('bluebird');var rs=require(_0xcd7c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd7c('0x4'))['db'];var utils=require(_0xcd7c('0x5'));var logger=require(_0xcd7c('0x6'))('rpc');var config=require(_0xcd7c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcd7c('0x8')][_0xcd7c('0x9')]({'port':0x232a});config['redis']=_[_0xcd7c('0xa')](config[_0xcd7c('0xb')],{'host':_0xcd7c('0xc'),'port':0x18eb});var socket=require(_0xcd7c('0xd'))(new Redis(config[_0xcd7c('0xb')]));require(_0xcd7c('0xe'))[_0xcd7c('0xf')](socket);function respondWithRpcPromise(_0x3f67c4,_0x2db2ec,_0x113766){return new BPromise(function(_0x75b765,_0xb3bd87){return client[_0xcd7c('0x10')](_0x3f67c4,_0x113766)[_0xcd7c('0x11')](function(_0x449117){logger['info'](_0xcd7c('0x12'),_0x2db2ec,_0xcd7c('0x13'));logger[_0xcd7c('0x14')](_0xcd7c('0x15'),_0x2db2ec,_0xcd7c('0x13'),JSON['stringify'](_0x449117));if(_0x449117['error']){if(_0x449117['error'][_0xcd7c('0x16')]===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x2db2ec,_0x449117['error'][_0xcd7c('0x17')]);return _0xb3bd87(_0x449117[_0xcd7c('0x18')][_0xcd7c('0x17')]);}logger[_0xcd7c('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x2db2ec,_0x449117[_0xcd7c('0x18')][_0xcd7c('0x17')]);return _0x75b765(_0x449117[_0xcd7c('0x18')]['message']);}else{logger[_0xcd7c('0x19')](_0xcd7c('0x12'),_0x2db2ec,'request\x20sent');_0x75b765(_0x449117[_0xcd7c('0x1a')][_0xcd7c('0x17')]);}})['catch'](function(_0x562035){logger['error'](_0xcd7c('0x12'),_0x2db2ec,_0x562035);_0xb3bd87(_0x562035);});});}exports[_0xcd7c('0x1b')]=function(_0x1a37e9){var _0x180ce7=this;return new Promise(function(_0xd3bbb1,_0x5f1b62){return db[_0xcd7c('0x1c')][_0xcd7c('0x1d')]({'raw':_0x1a37e9['options']?_0x1a37e9['options'][_0xcd7c('0x1e')]===undefined?!![]:![]:!![],'where':_0x1a37e9['options']?_0x1a37e9[_0xcd7c('0x1f')][_0xcd7c('0x20')]||null:null,'attributes':_0x1a37e9[_0xcd7c('0x1f')]?_0x1a37e9[_0xcd7c('0x1f')][_0xcd7c('0x21')]||null:null,'limit':_0x1a37e9[_0xcd7c('0x1f')]?_0x1a37e9[_0xcd7c('0x1f')][_0xcd7c('0x22')]||null:null,'include':_0x1a37e9[_0xcd7c('0x1f')]?_0x1a37e9[_0xcd7c('0x1f')][_0xcd7c('0x23')]?_[_0xcd7c('0x24')](_0x1a37e9[_0xcd7c('0x1f')][_0xcd7c('0x23')],function(_0x4306eb){return{'model':db[_0x4306eb[_0xcd7c('0x25')]],'as':_0x4306eb['as'],'attributes':_0x4306eb[_0xcd7c('0x21')],'include':_0x4306eb[_0xcd7c('0x23')]?_[_0xcd7c('0x24')](_0x4306eb[_0xcd7c('0x23')],function(_0x1c450a){return{'model':db[_0x1c450a[_0xcd7c('0x25')]],'as':_0x1c450a['as'],'attributes':_0x1c450a[_0xcd7c('0x21')],'include':_0x1c450a[_0xcd7c('0x23')]?_['map'](_0x1c450a[_0xcd7c('0x23')],function(_0x9290cc){return{'model':db[_0x9290cc['model']],'as':_0x9290cc['as'],'attributes':_0x9290cc[_0xcd7c('0x21')]};}):[]};}):[]};}):[]:[]})[_0xcd7c('0x11')](function(_0x10e2ef){logger[_0xcd7c('0x19')](_0xcd7c('0x1b'),_0x1a37e9);logger[_0xcd7c('0x14')](_0xcd7c('0x1b'),_0x1a37e9,JSON[_0xcd7c('0x26')](_0x10e2ef));_0xd3bbb1(_0x10e2ef);})[_0xcd7c('0x27')](function(_0x322616){logger['error']('GetWhatsappQueue',_0x322616[_0xcd7c('0x17')],_0x1a37e9);_0x5f1b62(_0x180ce7['error'](0x1f4,_0x322616['message']));});});};exports[_0xcd7c('0x28')]=function(_0x2f71e2){var _0x11b2a4=this;return new Promise(function(_0x142d1c,_0x4043c3){return db[_0xcd7c('0x1c')][_0xcd7c('0x29')]({'raw':_0x2f71e2['options']?_0x2f71e2[_0xcd7c('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x2f71e2[_0xcd7c('0x1f')]?_0x2f71e2[_0xcd7c('0x1f')][_0xcd7c('0x20')]||null:null,'attributes':_0x2f71e2[_0xcd7c('0x1f')]?_0x2f71e2[_0xcd7c('0x1f')][_0xcd7c('0x21')]||null:null,'include':_0x2f71e2[_0xcd7c('0x1f')]?_0x2f71e2[_0xcd7c('0x1f')]['include']?_['map'](_0x2f71e2['options'][_0xcd7c('0x23')],function(_0x51d916){return{'model':db[_0x51d916[_0xcd7c('0x25')]],'as':_0x51d916['as'],'attributes':_0x51d916['attributes'],'include':_0x51d916['include']?_['map'](_0x51d916[_0xcd7c('0x23')],function(_0x62173c){return{'model':db[_0x62173c[_0xcd7c('0x25')]],'as':_0x62173c['as'],'attributes':_0x62173c['attributes'],'include':_0x62173c['include']?_[_0xcd7c('0x24')](_0x62173c[_0xcd7c('0x23')],function(_0x3a8503){return{'model':db[_0x3a8503[_0xcd7c('0x25')]],'as':_0x3a8503['as'],'attributes':_0x3a8503['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5babab){logger[_0xcd7c('0x19')](_0xcd7c('0x28'),_0x2f71e2);logger['debug'](_0xcd7c('0x28'),_0x2f71e2,JSON[_0xcd7c('0x26')](_0x5babab));_0x142d1c(_0x5babab);})[_0xcd7c('0x27')](function(_0x2af601){logger[_0xcd7c('0x18')](_0xcd7c('0x28'),_0x2af601['message'],_0x2f71e2);_0x4043c3(_0x11b2a4['error'](0x1f4,_0x2af601['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 80238d6..b697bfe 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 _0x2dac=['removeListener','register','length','save','remove','update','emit'];(function(_0x7dd57,_0x265605){var _0x544e10=function(_0x39274c){while(--_0x39274c){_0x7dd57['push'](_0x7dd57['shift']());}};_0x544e10(++_0x265605);}(_0x2dac,0x14c));var _0xc2da=function(_0x483965,_0x140c6d){_0x483965=_0x483965-0x0;var _0x24c2c3=_0x2dac[_0x483965];return _0x24c2c3;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0xc2da('0x0'),_0xc2da('0x1'),_0xc2da('0x2')];function createListener(_0x2e68a2,_0x1236f3){return function(_0x3a77e5){_0x1236f3[_0xc2da('0x3')](_0x2e68a2,_0x3a77e5);};}function removeListener(_0x576fcc,_0x16164d){return function(){WhatsappQueueEvents[_0xc2da('0x4')](_0x576fcc,_0x16164d);};}exports[_0xc2da('0x5')]=function(_0x23998c){for(var _0x59c95f=0x0,_0x3f7f0f=events[_0xc2da('0x6')];_0x59c95f<_0x3f7f0f;_0x59c95f++){var _0xd7b830=events[_0x59c95f];var _0x5c55d1=createListener('whatsappQueue:'+_0xd7b830,_0x23998c);WhatsappQueueEvents['on'](_0xd7b830,_0x5c55d1);}}; \ No newline at end of file +var _0xa71e=['update','length','whatsappQueue:','./whatsappQueue.events','save','remove'];(function(_0x5be6c9,_0x48cef1){var _0x1378ac=function(_0x142c89){while(--_0x142c89){_0x5be6c9['push'](_0x5be6c9['shift']());}};_0x1378ac(++_0x48cef1);}(_0xa71e,0x1dd));var _0xea71=function(_0x531cb8,_0x8ef36f){_0x531cb8=_0x531cb8-0x0;var _0x5cf297=_0xa71e[_0x531cb8];return _0x5cf297;};'use strict';var WhatsappQueueEvents=require(_0xea71('0x0'));var events=[_0xea71('0x1'),_0xea71('0x2'),_0xea71('0x3')];function createListener(_0x1dc06c,_0x1a1a0f){return function(_0x441bef){_0x1a1a0f['emit'](_0x1dc06c,_0x441bef);};}function removeListener(_0x3fc061,_0x22869b){return function(){WhatsappQueueEvents['removeListener'](_0x3fc061,_0x22869b);};}exports['register']=function(_0x3820f9){for(var _0x246c19=0x0,_0x13be24=events[_0xea71('0x4')];_0x246c19<_0x13be24;_0x246c19++){var _0x399e94=events[_0x246c19];var _0x2746bd=createListener(_0xea71('0x5')+_0x399e94,_0x3820f9);WhatsappQueueEvents['on'](_0x399e94,_0x2746bd);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 96409a6..36fea5a 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 _0x44e8=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','post','create','put','exports'];(function(_0x2afbb7,_0x81941d){var _0x4a258a=function(_0x1b78fa){while(--_0x1b78fa){_0x2afbb7['push'](_0x2afbb7['shift']());}};_0x4a258a(++_0x81941d);}(_0x44e8,0x10e));var _0x844e=function(_0x5f53e1,_0x5498d5){_0x5f53e1=_0x5f53e1-0x0;var _0xa5727e=_0x44e8[_0x5f53e1];return _0xa5727e;};'use strict';var multer=require(_0x844e('0x0'));var util=require('util');var path=require(_0x844e('0x1'));var timeout=require('connect-timeout');var express=require(_0x844e('0x2'));var router=express[_0x844e('0x3')]();var auth=require(_0x844e('0x4'));var interaction=require(_0x844e('0x5'));var config=require(_0x844e('0x6'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x844e('0x7')](),controller['index']);router[_0x844e('0x8')](_0x844e('0x9'),auth[_0x844e('0x7')](),controller[_0x844e('0xa')]);router['get']('/:id',auth[_0x844e('0x7')](),controller['show']);router[_0x844e('0xb')]('/',auth[_0x844e('0x7')](),controller[_0x844e('0xc')]);router[_0x844e('0xd')]('/:id',auth[_0x844e('0x7')](),controller['update']);router['delete']('/:id',auth[_0x844e('0x7')](),controller['destroy']);module[_0x844e('0xe')]=router; \ No newline at end of file +var _0xe3a5=['index','show','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated'];(function(_0x1bd14a,_0x56ecba){var _0x24aa6c=function(_0x35c088){while(--_0x35c088){_0x1bd14a['push'](_0x1bd14a['shift']());}};_0x24aa6c(++_0x56ecba);}(_0xe3a5,0x127));var _0x5e3a=function(_0x2722b7,_0x414b97){_0x2722b7=_0x2722b7-0x0;var _0x3816d1=_0xe3a5[_0x2722b7];return _0x3816d1;};'use strict';var multer=require(_0x5e3a('0x0'));var util=require(_0x5e3a('0x1'));var path=require(_0x5e3a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5e3a('0x3')]();var auth=require(_0x5e3a('0x4'));var interaction=require(_0x5e3a('0x5'));var config=require('../../config/environment');var controller=require(_0x5e3a('0x6'));router[_0x5e3a('0x7')]('/',auth[_0x5e3a('0x8')](),controller[_0x5e3a('0x9')]);router[_0x5e3a('0x7')]('/describe',auth[_0x5e3a('0x8')](),controller['describe']);router[_0x5e3a('0x7')]('/:id',auth[_0x5e3a('0x8')](),controller[_0x5e3a('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5e3a('0xb')]);router[_0x5e3a('0xc')](_0x5e3a('0xd'),auth[_0x5e3a('0x8')](),controller['update']);router['delete'](_0x5e3a('0xd'),auth[_0x5e3a('0x8')](),controller[_0x5e3a('0xe')]);module[_0x5e3a('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index a7d12b8..c18cb12 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 _0x7217=['sequelize','STRING','DATE'];(function(_0x14496b,_0x35d4bd){var _0x40d862=function(_0x41d087){while(--_0x41d087){_0x14496b['push'](_0x14496b['shift']());}};_0x40d862(++_0x35d4bd);}(_0x7217,0x19e));var _0x7721=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x7217[_0x5c3c0b];return _0x52ecd2;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7721('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x7721('0x1')]},'joinAt':{'type':Sequelize[_0x7721('0x2')]},'leaveAt':{'type':Sequelize[_0x7721('0x2')]},'acceptAt':{'type':Sequelize[_0x7721('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1cb9=['DATE','sequelize','STRING'];(function(_0x435ba5,_0x55875f){var _0x5af51d=function(_0x35b1ed){while(--_0x35b1ed){_0x435ba5['push'](_0x435ba5['shift']());}};_0x5af51d(++_0x55875f);}(_0x1cb9,0x14e));var _0x91cb=function(_0x5e09f7,_0x652edb){_0x5e09f7=_0x5e09f7-0x0;var _0x30e695=_0x1cb9[_0x5e09f7];return _0x30e695;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x91cb('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x91cb('0x1')]},'joinAt':{'type':Sequelize[_0x91cb('0x2')]},'leaveAt':{'type':Sequelize[_0x91cb('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x91cb('0x2')]},'reason':{'type':Sequelize[_0x91cb('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 5596830..148b87d 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 _0xd0f5=['body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','limit','Content-Range','apply','reject','save','update','then','end','sendStatus','stack','name','send','index','WhatsappQueueReport','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','merge','find','create'];(function(_0x155fcf,_0x2e41b0){var _0x2cdfa4=function(_0x166dcd){while(--_0x166dcd){_0x155fcf['push'](_0x155fcf['shift']());}};_0x2cdfa4(++_0x2e41b0);}(_0xd0f5,0xda));var _0x5d0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0f5[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x5d0f('0x0'));var emlformat=require(_0x5d0f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5d0f('0x2'));var jsonpatch=require(_0x5d0f('0x3'));var rp=require(_0x5d0f('0x4'));var moment=require(_0x5d0f('0x5'));var BPromise=require(_0x5d0f('0x6'));var Mustache=require(_0x5d0f('0x7'));var util=require(_0x5d0f('0x8'));var path=require(_0x5d0f('0x9'));var sox=require('sox');var csv=require(_0x5d0f('0xa'));var ejs=require(_0x5d0f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5d0f('0xc'));var crypto=require(_0x5d0f('0xd'));var jsforce=require(_0x5d0f('0xe'));var deskjs=require(_0x5d0f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5d0f('0x10'));var Papa=require(_0x5d0f('0x11'));var Redis=require(_0x5d0f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5d0f('0x13'));var as=require(_0x5d0f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d0f('0x15'))(_0x5d0f('0x16'));var utils=require('../../config/utils');var config=require(_0x5d0f('0x17'));var db=require(_0x5d0f('0x18'))['db'];function respondWithStatusCode(_0x2a1efd,_0x434684){_0x434684=_0x434684||0xcc;return function(_0x4e59fa){if(_0x4e59fa){return _0x2a1efd['sendStatus'](_0x434684);}return _0x2a1efd[_0x5d0f('0x19')](_0x434684)['end']();};}function respondWithResult(_0x3e5f38,_0x39dca4){_0x39dca4=_0x39dca4||0xc8;return function(_0x229ff7){if(_0x229ff7){return _0x3e5f38[_0x5d0f('0x19')](_0x39dca4)[_0x5d0f('0x1a')](_0x229ff7);}};}function respondWithFilteredResult(_0x3fda79,_0x91a3a){return function(_0x16821a){if(_0x16821a){var _0x2ba72a=_0x16821a['count'],_0x1d7fda=_0x91a3a[_0x5d0f('0x1b')],_0x100b97=_0x91a3a[_0x5d0f('0x1b')]+_0x91a3a[_0x5d0f('0x1c')],_0x5cb37a;if(_0x100b97>=_0x2ba72a){_0x100b97=_0x2ba72a;_0x5cb37a=0xc8;}else{_0x5cb37a=0xce;}_0x3fda79[_0x5d0f('0x19')](_0x5cb37a);return _0x3fda79['set'](_0x5d0f('0x1d'),_0x1d7fda+'-'+_0x100b97+'/'+_0x2ba72a)[_0x5d0f('0x1a')](_0x16821a);}return null;};}function patchUpdates(_0x1c3976){return function(_0x44646b){try{jsonpatch[_0x5d0f('0x1e')](_0x44646b,_0x1c3976,!![]);}catch(_0x1fb791){return BPromise[_0x5d0f('0x1f')](_0x1fb791);}return _0x44646b[_0x5d0f('0x20')]();};}function saveUpdates(_0x4a8fdb,_0x1679e2){return function(_0x204e5e){if(_0x204e5e){return _0x204e5e[_0x5d0f('0x21')](_0x4a8fdb)[_0x5d0f('0x22')](function(_0x4550d9){return _0x4550d9;});}return null;};}function removeEntity(_0x44e38a,_0xc07658){return function(_0x2f65ab){if(_0x2f65ab){return _0x2f65ab['destroy']()['then'](function(){_0x44e38a[_0x5d0f('0x19')](0xcc)[_0x5d0f('0x23')]();});}};}function handleEntityNotFound(_0x5e0c01,_0x43fd14){return function(_0x2abe2){if(!_0x2abe2){_0x5e0c01[_0x5d0f('0x24')](0x194);}return _0x2abe2;};}function handleError(_0x5ceb62,_0x7304a){_0x7304a=_0x7304a||0x1f4;return function(_0x2d283c){logger['error'](_0x2d283c[_0x5d0f('0x25')]);if(_0x2d283c[_0x5d0f('0x26')]){delete _0x2d283c[_0x5d0f('0x26')];}_0x5ceb62[_0x5d0f('0x19')](_0x7304a)[_0x5d0f('0x27')](_0x2d283c);};}exports[_0x5d0f('0x28')]=function(_0x1ed738,_0x2a35eb){var _0x16fcf8={},_0x1facaf={},_0x107612={'count':0x0,'rows':[]};var _0x372a6f=_['map'](db[_0x5d0f('0x29')]['rawAttributes'],function(_0x2a2c0e){return{'name':_0x2a2c0e[_0x5d0f('0x2a')],'type':_0x2a2c0e['type'][_0x5d0f('0x2b')]};});_0x1facaf[_0x5d0f('0x2c')]=_[_0x5d0f('0x2d')](_0x372a6f,'name');_0x1facaf[_0x5d0f('0x2e')]=_[_0x5d0f('0x2f')](_0x1ed738['query']);_0x1facaf[_0x5d0f('0x30')]=_[_0x5d0f('0x31')](_0x1facaf[_0x5d0f('0x2c')],_0x1facaf[_0x5d0f('0x2e')]);_0x16fcf8[_0x5d0f('0x32')]=_['intersection'](_0x1facaf['model'],qs[_0x5d0f('0x33')](_0x1ed738[_0x5d0f('0x2e')][_0x5d0f('0x33')]));_0x16fcf8[_0x5d0f('0x32')]=_0x16fcf8[_0x5d0f('0x32')]['length']?_0x16fcf8['attributes']:_0x1facaf[_0x5d0f('0x2c')];if(!_0x1ed738[_0x5d0f('0x2e')][_0x5d0f('0x34')]('nolimit')){_0x16fcf8[_0x5d0f('0x1c')]=qs[_0x5d0f('0x1c')](_0x1ed738[_0x5d0f('0x2e')][_0x5d0f('0x1c')]);_0x16fcf8['offset']=qs[_0x5d0f('0x1b')](_0x1ed738[_0x5d0f('0x2e')][_0x5d0f('0x1b')]);}_0x16fcf8[_0x5d0f('0x35')]=qs[_0x5d0f('0x36')](_0x1ed738[_0x5d0f('0x2e')][_0x5d0f('0x36')]);_0x16fcf8[_0x5d0f('0x37')]=qs[_0x5d0f('0x30')](_[_0x5d0f('0x38')](_0x1ed738[_0x5d0f('0x2e')],_0x1facaf['filters']),_0x372a6f);if(_0x1ed738[_0x5d0f('0x2e')][_0x5d0f('0x39')]){_0x16fcf8[_0x5d0f('0x37')]=_['merge'](_0x16fcf8['where'],{'$or':_[_0x5d0f('0x2d')](_0x372a6f,function(_0x52555b){if(_0x52555b['type']!==_0x5d0f('0x3a')){var _0x1f1441={};_0x1f1441[_0x52555b['name']]={'$like':'%'+_0x1ed738[_0x5d0f('0x2e')][_0x5d0f('0x39')]+'%'};return _0x1f1441;}})});}_0x16fcf8=_['merge']({},_0x16fcf8,_0x1ed738[_0x5d0f('0x3b')]);var _0x2b5c15={'where':_0x16fcf8[_0x5d0f('0x37')]};return db[_0x5d0f('0x29')][_0x5d0f('0x3c')](_0x2b5c15)[_0x5d0f('0x22')](function(_0x4c064e){_0x107612[_0x5d0f('0x3c')]=_0x4c064e;if(_0x1ed738[_0x5d0f('0x2e')][_0x5d0f('0x3d')]){_0x16fcf8[_0x5d0f('0x3e')]=[{'all':!![]}];}return db[_0x5d0f('0x29')]['findAll'](_0x16fcf8);})[_0x5d0f('0x22')](function(_0x222cf3){_0x107612[_0x5d0f('0x3f')]=_0x222cf3;return _0x107612;})[_0x5d0f('0x22')](respondWithFilteredResult(_0x2a35eb,_0x16fcf8))[_0x5d0f('0x40')](handleError(_0x2a35eb,null));};exports[_0x5d0f('0x41')]=function(_0x533c77,_0x5aab82){var _0x332ee3={'raw':!![],'where':{'id':_0x533c77[_0x5d0f('0x42')]['id']}},_0x1ae9a5={};_0x1ae9a5[_0x5d0f('0x2c')]=_[_0x5d0f('0x2f')](db['WhatsappQueueReport']['rawAttributes']);_0x1ae9a5[_0x5d0f('0x2e')]=_['keys'](_0x533c77[_0x5d0f('0x2e')]);_0x1ae9a5[_0x5d0f('0x30')]=_[_0x5d0f('0x31')](_0x1ae9a5[_0x5d0f('0x2c')],_0x1ae9a5[_0x5d0f('0x2e')]);_0x332ee3['attributes']=_[_0x5d0f('0x31')](_0x1ae9a5[_0x5d0f('0x2c')],qs[_0x5d0f('0x33')](_0x533c77[_0x5d0f('0x2e')][_0x5d0f('0x33')]));_0x332ee3['attributes']=_0x332ee3[_0x5d0f('0x32')]['length']?_0x332ee3[_0x5d0f('0x32')]:_0x1ae9a5['model'];if(_0x533c77['query']['includeAll']){_0x332ee3[_0x5d0f('0x3e')]=[{'all':!![]}];}_0x332ee3=_[_0x5d0f('0x43')]({},_0x332ee3,_0x533c77[_0x5d0f('0x3b')]);return db['WhatsappQueueReport'][_0x5d0f('0x44')](_0x332ee3)[_0x5d0f('0x22')](handleEntityNotFound(_0x5aab82,null))[_0x5d0f('0x22')](respondWithResult(_0x5aab82,null))[_0x5d0f('0x40')](handleError(_0x5aab82,null));};exports[_0x5d0f('0x45')]=function(_0x599308,_0x4a5d61){return db['WhatsappQueueReport'][_0x5d0f('0x45')](_0x599308[_0x5d0f('0x46')],{})[_0x5d0f('0x22')](respondWithResult(_0x4a5d61,0xc9))['catch'](handleError(_0x4a5d61,null));};exports[_0x5d0f('0x21')]=function(_0x1c358f,_0x1a2de5){if(_0x1c358f[_0x5d0f('0x46')]['id']){delete _0x1c358f[_0x5d0f('0x46')]['id'];}return db[_0x5d0f('0x29')][_0x5d0f('0x44')]({'where':{'id':_0x1c358f[_0x5d0f('0x42')]['id']}})[_0x5d0f('0x22')](handleEntityNotFound(_0x1a2de5,null))[_0x5d0f('0x22')](saveUpdates(_0x1c358f[_0x5d0f('0x46')],null))['then'](respondWithResult(_0x1a2de5,null))['catch'](handleError(_0x1a2de5,null));};exports['destroy']=function(_0x376f6c,_0x5a4b66){return db[_0x5d0f('0x29')][_0x5d0f('0x44')]({'where':{'id':_0x376f6c['params']['id']}})[_0x5d0f('0x22')](handleEntityNotFound(_0x5a4b66,null))['then'](removeEntity(_0x5a4b66,null))[_0x5d0f('0x40')](handleError(_0x5a4b66,null));};exports[_0x5d0f('0x47')]=function(_0x41f9c2,_0x5e6cb7){return db[_0x5d0f('0x29')][_0x5d0f('0x47')]()[_0x5d0f('0x22')](respondWithResult(_0x5e6cb7,null))['catch'](handleError(_0x5e6cb7,null));}; \ No newline at end of file +var _0xed83=['params','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','limit','set','Content-Range','reject','save','then','end','sendStatus','error','stack','index','map','WhatsappQueueReport','rawAttributes','type','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','catch','show'];(function(_0x533168,_0x970817){var _0x11ab90=function(_0x57d59c){while(--_0x57d59c){_0x533168['push'](_0x533168['shift']());}};_0x11ab90(++_0x970817);}(_0xed83,0x160));var _0x3ed8=function(_0x18bb67,_0x5eff3d){_0x18bb67=_0x18bb67-0x0;var _0x149f9a=_0xed83[_0x18bb67];return _0x149f9a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3ed8('0x0'));var rimraf=require(_0x3ed8('0x1'));var zipdir=require(_0x3ed8('0x2'));var jsonpatch=require(_0x3ed8('0x3'));var rp=require(_0x3ed8('0x4'));var moment=require(_0x3ed8('0x5'));var BPromise=require(_0x3ed8('0x6'));var Mustache=require(_0x3ed8('0x7'));var util=require(_0x3ed8('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x3ed8('0x9'));var ejs=require(_0x3ed8('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3ed8('0xb'));var crypto=require(_0x3ed8('0xc'));var jsforce=require(_0x3ed8('0xd'));var deskjs=require(_0x3ed8('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3ed8('0xf'));var Redis=require('ioredis');var authService=require(_0x3ed8('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3ed8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ed8('0x12'))(_0x3ed8('0x13'));var utils=require(_0x3ed8('0x14'));var config=require('../../config/environment');var db=require(_0x3ed8('0x15'))['db'];function respondWithStatusCode(_0x373939,_0x829a8b){_0x829a8b=_0x829a8b||0xcc;return function(_0xfb5582){if(_0xfb5582){return _0x373939['sendStatus'](_0x829a8b);}return _0x373939[_0x3ed8('0x16')](_0x829a8b)['end']();};}function respondWithResult(_0x39a265,_0x579fdd){_0x579fdd=_0x579fdd||0xc8;return function(_0x4d55db){if(_0x4d55db){return _0x39a265[_0x3ed8('0x16')](_0x579fdd)[_0x3ed8('0x17')](_0x4d55db);}};}function respondWithFilteredResult(_0x3039c8,_0x18b79a){return function(_0x405344){if(_0x405344){var _0x211045=_0x405344['count'],_0x9861b2=_0x18b79a[_0x3ed8('0x18')],_0x1aad6f=_0x18b79a[_0x3ed8('0x18')]+_0x18b79a[_0x3ed8('0x19')],_0xec3388;if(_0x1aad6f>=_0x211045){_0x1aad6f=_0x211045;_0xec3388=0xc8;}else{_0xec3388=0xce;}_0x3039c8[_0x3ed8('0x16')](_0xec3388);return _0x3039c8[_0x3ed8('0x1a')](_0x3ed8('0x1b'),_0x9861b2+'-'+_0x1aad6f+'/'+_0x211045)[_0x3ed8('0x17')](_0x405344);}return null;};}function patchUpdates(_0x3d8a61){return function(_0xe546c8){try{jsonpatch['apply'](_0xe546c8,_0x3d8a61,!![]);}catch(_0x3208db){return BPromise[_0x3ed8('0x1c')](_0x3208db);}return _0xe546c8[_0x3ed8('0x1d')]();};}function saveUpdates(_0x586634,_0x78ef01){return function(_0x3d6344){if(_0x3d6344){return _0x3d6344['update'](_0x586634)[_0x3ed8('0x1e')](function(_0x1da079){return _0x1da079;});}return null;};}function removeEntity(_0x11bedd,_0x31e062){return function(_0x233906){if(_0x233906){return _0x233906['destroy']()[_0x3ed8('0x1e')](function(){_0x11bedd[_0x3ed8('0x16')](0xcc)[_0x3ed8('0x1f')]();});}};}function handleEntityNotFound(_0x5e3262,_0x4f7bbd){return function(_0x1d15da){if(!_0x1d15da){_0x5e3262[_0x3ed8('0x20')](0x194);}return _0x1d15da;};}function handleError(_0x4c679d,_0xe57ecf){_0xe57ecf=_0xe57ecf||0x1f4;return function(_0x515977){logger[_0x3ed8('0x21')](_0x515977[_0x3ed8('0x22')]);if(_0x515977['name']){delete _0x515977['name'];}_0x4c679d[_0x3ed8('0x16')](_0xe57ecf)['send'](_0x515977);};}exports[_0x3ed8('0x23')]=function(_0x2fad5d,_0x43e08f){var _0x81ee76={},_0x2b0a6f={},_0x1fb7da={'count':0x0,'rows':[]};var _0x49cd70=_[_0x3ed8('0x24')](db[_0x3ed8('0x25')][_0x3ed8('0x26')],function(_0xbe10e6){return{'name':_0xbe10e6['fieldName'],'type':_0xbe10e6[_0x3ed8('0x27')]['key']};});_0x2b0a6f['model']=_[_0x3ed8('0x24')](_0x49cd70,_0x3ed8('0x28'));_0x2b0a6f[_0x3ed8('0x29')]=_[_0x3ed8('0x2a')](_0x2fad5d[_0x3ed8('0x29')]);_0x2b0a6f[_0x3ed8('0x2b')]=_[_0x3ed8('0x2c')](_0x2b0a6f[_0x3ed8('0x2d')],_0x2b0a6f['query']);_0x81ee76['attributes']=_[_0x3ed8('0x2c')](_0x2b0a6f[_0x3ed8('0x2d')],qs[_0x3ed8('0x2e')](_0x2fad5d['query'][_0x3ed8('0x2e')]));_0x81ee76['attributes']=_0x81ee76[_0x3ed8('0x2f')][_0x3ed8('0x30')]?_0x81ee76['attributes']:_0x2b0a6f[_0x3ed8('0x2d')];if(!_0x2fad5d['query'][_0x3ed8('0x31')](_0x3ed8('0x32'))){_0x81ee76[_0x3ed8('0x19')]=qs[_0x3ed8('0x19')](_0x2fad5d[_0x3ed8('0x29')]['limit']);_0x81ee76['offset']=qs[_0x3ed8('0x18')](_0x2fad5d['query']['offset']);}_0x81ee76['order']=qs[_0x3ed8('0x33')](_0x2fad5d['query']['sort']);_0x81ee76['where']=qs[_0x3ed8('0x2b')](_[_0x3ed8('0x34')](_0x2fad5d[_0x3ed8('0x29')],_0x2b0a6f[_0x3ed8('0x2b')]),_0x49cd70);if(_0x2fad5d['query']['filter']){_0x81ee76[_0x3ed8('0x35')]=_[_0x3ed8('0x36')](_0x81ee76['where'],{'$or':_['map'](_0x49cd70,function(_0x18b363){if(_0x18b363[_0x3ed8('0x27')]!==_0x3ed8('0x37')){var _0x4477dc={};_0x4477dc[_0x18b363[_0x3ed8('0x28')]]={'$like':'%'+_0x2fad5d[_0x3ed8('0x29')][_0x3ed8('0x38')]+'%'};return _0x4477dc;}})});}_0x81ee76=_[_0x3ed8('0x36')]({},_0x81ee76,_0x2fad5d[_0x3ed8('0x39')]);var _0xcb5670={'where':_0x81ee76[_0x3ed8('0x35')]};return db['WhatsappQueueReport']['count'](_0xcb5670)[_0x3ed8('0x1e')](function(_0x46b2e1){_0x1fb7da['count']=_0x46b2e1;if(_0x2fad5d[_0x3ed8('0x29')][_0x3ed8('0x3a')]){_0x81ee76[_0x3ed8('0x3b')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x81ee76);})[_0x3ed8('0x1e')](function(_0x3bd1c8){_0x1fb7da['rows']=_0x3bd1c8;return _0x1fb7da;})[_0x3ed8('0x1e')](respondWithFilteredResult(_0x43e08f,_0x81ee76))[_0x3ed8('0x3c')](handleError(_0x43e08f,null));};exports[_0x3ed8('0x3d')]=function(_0x1f1350,_0x5d13d0){var _0x5b18f7={'raw':!![],'where':{'id':_0x1f1350[_0x3ed8('0x3e')]['id']}},_0x5f5da5={};_0x5f5da5[_0x3ed8('0x2d')]=_['keys'](db[_0x3ed8('0x25')]['rawAttributes']);_0x5f5da5[_0x3ed8('0x29')]=_[_0x3ed8('0x2a')](_0x1f1350['query']);_0x5f5da5[_0x3ed8('0x2b')]=_['intersection'](_0x5f5da5['model'],_0x5f5da5[_0x3ed8('0x29')]);_0x5b18f7['attributes']=_['intersection'](_0x5f5da5[_0x3ed8('0x2d')],qs[_0x3ed8('0x2e')](_0x1f1350[_0x3ed8('0x29')][_0x3ed8('0x2e')]));_0x5b18f7['attributes']=_0x5b18f7['attributes'][_0x3ed8('0x30')]?_0x5b18f7[_0x3ed8('0x2f')]:_0x5f5da5[_0x3ed8('0x2d')];if(_0x1f1350[_0x3ed8('0x29')][_0x3ed8('0x3a')]){_0x5b18f7['include']=[{'all':!![]}];}_0x5b18f7=_['merge']({},_0x5b18f7,_0x1f1350[_0x3ed8('0x39')]);return db[_0x3ed8('0x25')][_0x3ed8('0x3f')](_0x5b18f7)['then'](handleEntityNotFound(_0x5d13d0,null))['then'](respondWithResult(_0x5d13d0,null))['catch'](handleError(_0x5d13d0,null));};exports[_0x3ed8('0x40')]=function(_0x300b35,_0x47d534){return db['WhatsappQueueReport'][_0x3ed8('0x40')](_0x300b35[_0x3ed8('0x41')],{})['then'](respondWithResult(_0x47d534,0xc9))['catch'](handleError(_0x47d534,null));};exports[_0x3ed8('0x42')]=function(_0x55defd,_0x101fad){if(_0x55defd[_0x3ed8('0x41')]['id']){delete _0x55defd[_0x3ed8('0x41')]['id'];}return db[_0x3ed8('0x25')][_0x3ed8('0x3f')]({'where':{'id':_0x55defd['params']['id']}})[_0x3ed8('0x1e')](handleEntityNotFound(_0x101fad,null))[_0x3ed8('0x1e')](saveUpdates(_0x55defd['body'],null))[_0x3ed8('0x1e')](respondWithResult(_0x101fad,null))[_0x3ed8('0x3c')](handleError(_0x101fad,null));};exports[_0x3ed8('0x43')]=function(_0x867df2,_0x5a6e1f){return db[_0x3ed8('0x25')][_0x3ed8('0x3f')]({'where':{'id':_0x867df2[_0x3ed8('0x3e')]['id']}})[_0x3ed8('0x1e')](handleEntityNotFound(_0x5a6e1f,null))[_0x3ed8('0x1e')](removeEntity(_0x5a6e1f,null))[_0x3ed8('0x3c')](handleError(_0x5a6e1f,null));};exports[_0x3ed8('0x44')]=function(_0xd3f339,_0x49d594){return db[_0x3ed8('0x25')]['describe']()[_0x3ed8('0x1e')](respondWithResult(_0x49d594,null))['catch'](handleError(_0x49d594,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 401f0df..7bd01f2 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 _0x47f2=['api','request-promise','path','rimraf','define','uniqueid','lodash','util'];(function(_0x2e96e5,_0xc15aab){var _0xce741d=function(_0x431e04){while(--_0x431e04){_0x2e96e5['push'](_0x2e96e5['shift']());}};_0xce741d(++_0xc15aab);}(_0x47f2,0xb6));var _0x247f=function(_0x59bc74,_0xfe861b){_0x59bc74=_0x59bc74-0x0;var _0xe44f33=_0x47f2[_0x59bc74];return _0xe44f33;};'use strict';var _=require(_0x247f('0x0'));var util=require(_0x247f('0x1'));var logger=require('../../config/logger')(_0x247f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x247f('0x3'));var fs=require('fs');var path=require(_0x247f('0x4'));var rimraf=require(_0x247f('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x2d4d31,_0x51e7b9){return _0x2d4d31[_0x247f('0x6')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x247f('0x7'),'fields':[_0x247f('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeff4=['uniqueid','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport'];(function(_0x48f425,_0x8616ba){var _0x110a77=function(_0x357b34){while(--_0x357b34){_0x48f425['push'](_0x48f425['shift']());}};_0x110a77(++_0x8616ba);}(_0xeff4,0xe5));var _0x4eff=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xeff4[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0x4eff('0x0'));var util=require(_0x4eff('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4eff('0x2'));var BPromise=require(_0x4eff('0x3'));var rp=require(_0x4eff('0x4'));var fs=require('fs');var path=require(_0x4eff('0x5'));var rimraf=require('rimraf');var config=require(_0x4eff('0x6'));var attributes=require(_0x4eff('0x7'));module[_0x4eff('0x8')]=function(_0x28d29f,_0x566f95){return _0x28d29f[_0x4eff('0x9')](_0x4eff('0xa'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4eff('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 7066f31..d82fa97 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 _0xad67=['request\x20sent','result','CreateWhatsappQueueReport','create','body','options','raw','catch','UpdateWhatsappQueueReport','update','where','attributes','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1c6b4b,_0x17ca80){var _0x1b16ae=function(_0x3f31f1){while(--_0x3f31f1){_0x1c6b4b['push'](_0x1c6b4b['shift']());}};_0x1b16ae(++_0x17ca80);}(_0xad67,0xd2));var _0x7ad6=function(_0x4f8886,_0x9be826){_0x4f8886=_0x4f8886-0x0;var _0x3c49e4=_0xad67[_0x4f8886];return _0x3c49e4;};'use strict';var _=require(_0x7ad6('0x0'));var util=require(_0x7ad6('0x1'));var moment=require(_0x7ad6('0x2'));var BPromise=require(_0x7ad6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ad6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7ad6('0x5'));var logger=require('../../config/logger')(_0x7ad6('0x6'));var config=require(_0x7ad6('0x7'));var jayson=require(_0x7ad6('0x8'));var client=jayson[_0x7ad6('0x9')][_0x7ad6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x105889,_0x1c4ebb,_0x307fbd){return new BPromise(function(_0x285bd2,_0x180d7a){return client[_0x7ad6('0xb')](_0x105889,_0x307fbd)[_0x7ad6('0xc')](function(_0x1e8aec){logger[_0x7ad6('0xd')](_0x7ad6('0xe'),_0x1c4ebb,'request\x20sent');logger[_0x7ad6('0xf')](_0x7ad6('0x10'),_0x1c4ebb,'request\x20sent',JSON[_0x7ad6('0x11')](_0x1e8aec));if(_0x1e8aec[_0x7ad6('0x12')]){if(_0x1e8aec['error'][_0x7ad6('0x13')]===0x1f4){logger[_0x7ad6('0x12')](_0x7ad6('0xe'),_0x1c4ebb,_0x1e8aec[_0x7ad6('0x12')][_0x7ad6('0x14')]);return _0x180d7a(_0x1e8aec['error'][_0x7ad6('0x14')]);}logger[_0x7ad6('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1c4ebb,_0x1e8aec[_0x7ad6('0x12')][_0x7ad6('0x14')]);return _0x285bd2(_0x1e8aec[_0x7ad6('0x12')]['message']);}else{logger[_0x7ad6('0xd')](_0x7ad6('0xe'),_0x1c4ebb,_0x7ad6('0x15'));_0x285bd2(_0x1e8aec[_0x7ad6('0x16')]['message']);}})['catch'](function(_0x2c13ae){logger['error'](_0x7ad6('0xe'),_0x1c4ebb,_0x2c13ae);_0x180d7a(_0x2c13ae);});});}exports[_0x7ad6('0x17')]=function(_0x49e28a){var _0x5a375a=this;return new Promise(function(_0x9e5db1,_0x5dc4c8){return db['WhatsappQueueReport'][_0x7ad6('0x18')](_0x49e28a[_0x7ad6('0x19')],{'raw':_0x49e28a[_0x7ad6('0x1a')]?_0x49e28a[_0x7ad6('0x1a')][_0x7ad6('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x1c336b){logger[_0x7ad6('0xd')](_0x7ad6('0x17'),_0x49e28a);logger[_0x7ad6('0xf')](_0x7ad6('0x17'),_0x49e28a,JSON[_0x7ad6('0x11')](_0x1c336b));_0x9e5db1(_0x1c336b);})[_0x7ad6('0x1c')](function(_0x3c7828){logger['error'](_0x7ad6('0x17'),_0x3c7828[_0x7ad6('0x14')],_0x49e28a);_0x5dc4c8(_0x5a375a[_0x7ad6('0x12')](0x1f4,_0x3c7828[_0x7ad6('0x14')]));});});};exports[_0x7ad6('0x1d')]=function(_0x5c0fc2){var _0xee1556=this;return new Promise(function(_0x10338f,_0x24de26){return db['WhatsappQueueReport'][_0x7ad6('0x1e')](_0x5c0fc2[_0x7ad6('0x19')],{'raw':_0x5c0fc2[_0x7ad6('0x1a')]?_0x5c0fc2[_0x7ad6('0x1a')][_0x7ad6('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c0fc2[_0x7ad6('0x1a')]?_0x5c0fc2[_0x7ad6('0x1a')][_0x7ad6('0x1f')]||null:null,'attributes':_0x5c0fc2[_0x7ad6('0x1a')]?_0x5c0fc2['options'][_0x7ad6('0x20')]||null:null,'limit':_0x5c0fc2[_0x7ad6('0x1a')]?_0x5c0fc2[_0x7ad6('0x1a')]['limit']||null:null})['then'](function(_0x2dfc67){logger[_0x7ad6('0xd')]('UpdateWhatsappQueueReport',_0x5c0fc2);logger[_0x7ad6('0xf')](_0x7ad6('0x1d'),_0x5c0fc2,JSON[_0x7ad6('0x11')](_0x2dfc67));_0x10338f(_0x2dfc67);})['catch'](function(_0x53b6d4){logger[_0x7ad6('0x12')](_0x7ad6('0x1d'),_0x53b6d4['message'],_0x5c0fc2);_0x24de26(_0xee1556[_0x7ad6('0x12')](0x1f4,_0x53b6d4[_0x7ad6('0x14')]));});});}; \ No newline at end of file +var _0x21a1=['UpdateWhatsappQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','debug','stringify','update','where'];(function(_0x1d2ef2,_0x1a7599){var _0x345183=function(_0x21384d){while(--_0x21384d){_0x1d2ef2['push'](_0x1d2ef2['shift']());}};_0x345183(++_0x1a7599);}(_0x21a1,0x18d));var _0x121a=function(_0x511a5a,_0x4a687c){_0x511a5a=_0x511a5a-0x0;var _0x2a840c=_0x21a1[_0x511a5a];return _0x2a840c;};'use strict';var _=require(_0x121a('0x0'));var util=require('util');var moment=require(_0x121a('0x1'));var BPromise=require(_0x121a('0x2'));var rs=require(_0x121a('0x3'));var fs=require('fs');var Redis=require(_0x121a('0x4'));var db=require(_0x121a('0x5'))['db'];var utils=require(_0x121a('0x6'));var logger=require(_0x121a('0x7'))('rpc');var config=require(_0x121a('0x8'));var jayson=require(_0x121a('0x9'));var client=jayson[_0x121a('0xa')][_0x121a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b6902,_0x3c81bc,_0x140b56){return new BPromise(function(_0x4c2418,_0x1d8302){return client[_0x121a('0xc')](_0x2b6902,_0x140b56)[_0x121a('0xd')](function(_0x15b498){logger[_0x121a('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3c81bc,_0x121a('0xf'));logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x3c81bc,_0x121a('0xf'),JSON['stringify'](_0x15b498));if(_0x15b498[_0x121a('0x10')]){if(_0x15b498[_0x121a('0x10')][_0x121a('0x11')]===0x1f4){logger[_0x121a('0x10')](_0x121a('0x12'),_0x3c81bc,_0x15b498[_0x121a('0x10')][_0x121a('0x13')]);return _0x1d8302(_0x15b498['error'][_0x121a('0x13')]);}logger[_0x121a('0x10')](_0x121a('0x12'),_0x3c81bc,_0x15b498[_0x121a('0x10')][_0x121a('0x13')]);return _0x4c2418(_0x15b498[_0x121a('0x10')][_0x121a('0x13')]);}else{logger[_0x121a('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3c81bc,'request\x20sent');_0x4c2418(_0x15b498[_0x121a('0x14')][_0x121a('0x13')]);}})[_0x121a('0x15')](function(_0x23f123){logger[_0x121a('0x10')](_0x121a('0x12'),_0x3c81bc,_0x23f123);_0x1d8302(_0x23f123);});});}exports[_0x121a('0x16')]=function(_0x4dc29e){var _0x1a34ed=this;return new Promise(function(_0x41b928,_0x34ea81){return db[_0x121a('0x17')][_0x121a('0x18')](_0x4dc29e[_0x121a('0x19')],{'raw':_0x4dc29e[_0x121a('0x1a')]?_0x4dc29e[_0x121a('0x1a')][_0x121a('0x1b')]===undefined?!![]:![]:!![]})[_0x121a('0xd')](function(_0x109ada){logger['info'](_0x121a('0x16'),_0x4dc29e);logger[_0x121a('0x1c')](_0x121a('0x16'),_0x4dc29e,JSON[_0x121a('0x1d')](_0x109ada));_0x41b928(_0x109ada);})[_0x121a('0x15')](function(_0x5e7506){logger[_0x121a('0x10')](_0x121a('0x16'),_0x5e7506[_0x121a('0x13')],_0x4dc29e);_0x34ea81(_0x1a34ed['error'](0x1f4,_0x5e7506['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x1769f5){var _0x12771f=this;return new Promise(function(_0x541c8f,_0x377600){return db[_0x121a('0x17')][_0x121a('0x1e')](_0x1769f5[_0x121a('0x19')],{'raw':_0x1769f5[_0x121a('0x1a')]?_0x1769f5[_0x121a('0x1a')][_0x121a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1769f5[_0x121a('0x1a')]?_0x1769f5['options'][_0x121a('0x1f')]||null:null,'attributes':_0x1769f5['options']?_0x1769f5['options']['attributes']||null:null,'limit':_0x1769f5[_0x121a('0x1a')]?_0x1769f5[_0x121a('0x1a')]['limit']||null:null})[_0x121a('0xd')](function(_0x497162){logger['info'](_0x121a('0x20'),_0x1769f5);logger['debug'](_0x121a('0x20'),_0x1769f5,JSON['stringify'](_0x497162));_0x541c8f(_0x497162);})[_0x121a('0x15')](function(_0x55f948){logger['error'](_0x121a('0x20'),_0x55f948[_0x121a('0x13')],_0x1769f5);_0x377600(_0x12771f['error'](0x1f4,_0x55f948[_0x121a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index af078ff..d156b47 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 _0x221c=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','show','create','put','update','delete','/:id','destroy','exports'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x221c,0x17c));var _0xc221=function(_0x347a52,_0x40b38f){_0x347a52=_0x347a52-0x0;var _0xfb8a6e=_0x221c[_0x347a52];return _0xfb8a6e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc221('0x0'));var timeout=require(_0xc221('0x1'));var express=require(_0xc221('0x2'));var router=express[_0xc221('0x3')]();var auth=require(_0xc221('0x4'));var interaction=require(_0xc221('0x5'));var config=require(_0xc221('0x6'));var controller=require(_0xc221('0x7'));router[_0xc221('0x8')]('/',auth[_0xc221('0x9')](),controller[_0xc221('0xa')]);router[_0xc221('0x8')]('/describe',auth[_0xc221('0x9')](),controller[_0xc221('0xb')]);router['get']('/:id',auth[_0xc221('0x9')](),controller[_0xc221('0xc')]);router['post']('/',auth[_0xc221('0x9')](),controller[_0xc221('0xd')]);router[_0xc221('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xc221('0xf')]);router[_0xc221('0x10')](_0xc221('0x11'),auth['isAuthenticated'](),controller[_0xc221('0x12')]);module[_0xc221('0x13')]=router; \ No newline at end of file +var _0x7299=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','get','describe','/:id','show','post','put','update','delete','exports','multer','util','connect-timeout','express'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7299,0x1ac));var _0x9729=function(_0x3cae70,_0x3bc1dd){_0x3cae70=_0x3cae70-0x0;var _0x5d29dc=_0x7299[_0x3cae70];return _0x5d29dc;};'use strict';var multer=require(_0x9729('0x0'));var util=require(_0x9729('0x1'));var path=require('path');var timeout=require(_0x9729('0x2'));var express=require(_0x9729('0x3'));var router=express['Router']();var auth=require(_0x9729('0x4'));var interaction=require(_0x9729('0x5'));var config=require(_0x9729('0x6'));var controller=require(_0x9729('0x7'));router['get']('/',auth[_0x9729('0x8')](),controller['index']);router[_0x9729('0x9')]('/describe',auth[_0x9729('0x8')](),controller[_0x9729('0xa')]);router['get'](_0x9729('0xb'),auth[_0x9729('0x8')](),controller[_0x9729('0xc')]);router[_0x9729('0xd')]('/',auth[_0x9729('0x8')](),controller['create']);router[_0x9729('0xe')](_0x9729('0xb'),auth['isAuthenticated'](),controller[_0x9729('0xf')]);router[_0x9729('0x10')](_0x9729('0xb'),auth[_0x9729('0x8')](),controller['destroy']);module[_0x9729('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 740d802..af5fdde 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 _0xb10b=['ENUM','account','queue','DATE','sequelize','STRING'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xb10b,0x12a));var _0xbb10=function(_0x24ccd7,_0x2eeca9){_0x24ccd7=_0x24ccd7-0x0;var _0x26aa79=_0xb10b[_0x24ccd7];return _0x26aa79;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xbb10('0x2')](_0xbb10('0x3'),'agent',_0xbb10('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xbb10('0x5')]}}; \ No newline at end of file +var _0x5f66=['queue','DATE','exports','ENUM','account','agent'];(function(_0x215e65,_0x183f97){var _0xa85842=function(_0x43bf45){while(--_0x43bf45){_0x215e65['push'](_0x215e65['shift']());}};_0xa85842(++_0x183f97);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x65f6('0x1')](_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x65f6('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index a628b86..e729f64 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 _0xdf4c=['squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','WhatsappTransferReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','options','find','create','body','destroy','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash'];(function(_0x10f2f8,_0x3c763a){var _0x19266a=function(_0x4bf56b){while(--_0x4bf56b){_0x10f2f8['push'](_0x10f2f8['shift']());}};_0x19266a(++_0x3c763a);}(_0xdf4c,0x8e));var _0xcdf4=function(_0x133851,_0x4d6780){_0x133851=_0x133851-0x0;var _0x188215=_0xdf4c[_0x133851];return _0x188215;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcdf4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcdf4('0x1'));var rp=require(_0xcdf4('0x2'));var moment=require(_0xcdf4('0x3'));var BPromise=require(_0xcdf4('0x4'));var Mustache=require(_0xcdf4('0x5'));var util=require(_0xcdf4('0x6'));var path=require(_0xcdf4('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcdf4('0x8'));var fs=require('fs');var _=require(_0xcdf4('0x9'));var squel=require(_0xcdf4('0xa'));var crypto=require(_0xcdf4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xcdf4('0xc'));var toCsv=require(_0xcdf4('0xd'));var querystring=require('querystring');var Papa=require(_0xcdf4('0xe'));var Redis=require(_0xcdf4('0xf'));var authService=require(_0xcdf4('0x10'));var qs=require(_0xcdf4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcdf4('0x12'));var logger=require(_0xcdf4('0x13'))(_0xcdf4('0x14'));var utils=require('../../config/utils');var config=require(_0xcdf4('0x15'));var db=require(_0xcdf4('0x16'))['db'];function respondWithStatusCode(_0x5457fa,_0x3e36b2){_0x3e36b2=_0x3e36b2||0xcc;return function(_0x4e8a3b){if(_0x4e8a3b){return _0x5457fa[_0xcdf4('0x17')](_0x3e36b2);}return _0x5457fa[_0xcdf4('0x18')](_0x3e36b2)[_0xcdf4('0x19')]();};}function respondWithResult(_0x494811,_0x2a7898){_0x2a7898=_0x2a7898||0xc8;return function(_0xd6b3eb){if(_0xd6b3eb){return _0x494811[_0xcdf4('0x18')](_0x2a7898)[_0xcdf4('0x1a')](_0xd6b3eb);}};}function respondWithFilteredResult(_0x2017cb,_0x35d774){return function(_0x4d5cff){if(_0x4d5cff){var _0x4684a9=_0x4d5cff[_0xcdf4('0x1b')],_0x4a6fa0=_0x35d774[_0xcdf4('0x1c')],_0x40238d=_0x35d774[_0xcdf4('0x1c')]+_0x35d774[_0xcdf4('0x1d')],_0x5c728c;if(_0x40238d>=_0x4684a9){_0x40238d=_0x4684a9;_0x5c728c=0xc8;}else{_0x5c728c=0xce;}_0x2017cb['status'](_0x5c728c);return _0x2017cb['set'](_0xcdf4('0x1e'),_0x4a6fa0+'-'+_0x40238d+'/'+_0x4684a9)[_0xcdf4('0x1a')](_0x4d5cff);}return null;};}function patchUpdates(_0x4232f1){return function(_0x15cc77){try{jsonpatch[_0xcdf4('0x1f')](_0x15cc77,_0x4232f1,!![]);}catch(_0x27482c){return BPromise[_0xcdf4('0x20')](_0x27482c);}return _0x15cc77[_0xcdf4('0x21')]();};}function saveUpdates(_0x5777b9,_0xc09437){return function(_0x5746e4){if(_0x5746e4){return _0x5746e4[_0xcdf4('0x22')](_0x5777b9)[_0xcdf4('0x23')](function(_0x526623){return _0x526623;});}return null;};}function removeEntity(_0x2090d7,_0x52e566){return function(_0x4de1b3){if(_0x4de1b3){return _0x4de1b3['destroy']()[_0xcdf4('0x23')](function(){_0x2090d7[_0xcdf4('0x18')](0xcc)[_0xcdf4('0x19')]();});}};}function handleEntityNotFound(_0xd4034,_0x32a0c1){return function(_0x50994e){if(!_0x50994e){_0xd4034[_0xcdf4('0x17')](0x194);}return _0x50994e;};}function handleError(_0x512f09,_0x502f5d){_0x502f5d=_0x502f5d||0x1f4;return function(_0x3b6828){logger[_0xcdf4('0x24')](_0x3b6828[_0xcdf4('0x25')]);if(_0x3b6828[_0xcdf4('0x26')]){delete _0x3b6828[_0xcdf4('0x26')];}_0x512f09[_0xcdf4('0x18')](_0x502f5d)[_0xcdf4('0x27')](_0x3b6828);};}exports['index']=function(_0x8fc8a5,_0x250427){var _0x1879e2={},_0x3fa2d6={},_0x382e40={'count':0x0,'rows':[]};var _0x4fdbf6=_[_0xcdf4('0x28')](db[_0xcdf4('0x29')]['rawAttributes'],function(_0x288769){return{'name':_0x288769[_0xcdf4('0x2a')],'type':_0x288769[_0xcdf4('0x2b')][_0xcdf4('0x2c')]};});_0x3fa2d6[_0xcdf4('0x2d')]=_[_0xcdf4('0x28')](_0x4fdbf6,_0xcdf4('0x26'));_0x3fa2d6[_0xcdf4('0x2e')]=_['keys'](_0x8fc8a5[_0xcdf4('0x2e')]);_0x3fa2d6[_0xcdf4('0x2f')]=_[_0xcdf4('0x30')](_0x3fa2d6[_0xcdf4('0x2d')],_0x3fa2d6[_0xcdf4('0x2e')]);_0x1879e2[_0xcdf4('0x31')]=_['intersection'](_0x3fa2d6[_0xcdf4('0x2d')],qs[_0xcdf4('0x32')](_0x8fc8a5[_0xcdf4('0x2e')][_0xcdf4('0x32')]));_0x1879e2[_0xcdf4('0x31')]=_0x1879e2[_0xcdf4('0x31')][_0xcdf4('0x33')]?_0x1879e2['attributes']:_0x3fa2d6[_0xcdf4('0x2d')];if(!_0x8fc8a5[_0xcdf4('0x2e')][_0xcdf4('0x34')](_0xcdf4('0x35'))){_0x1879e2[_0xcdf4('0x1d')]=qs[_0xcdf4('0x1d')](_0x8fc8a5[_0xcdf4('0x2e')]['limit']);_0x1879e2[_0xcdf4('0x1c')]=qs[_0xcdf4('0x1c')](_0x8fc8a5[_0xcdf4('0x2e')][_0xcdf4('0x1c')]);}_0x1879e2[_0xcdf4('0x36')]=qs[_0xcdf4('0x37')](_0x8fc8a5[_0xcdf4('0x2e')]['sort']);_0x1879e2[_0xcdf4('0x38')]=qs[_0xcdf4('0x2f')](_[_0xcdf4('0x39')](_0x8fc8a5['query'],_0x3fa2d6[_0xcdf4('0x2f')]),_0x4fdbf6);if(_0x8fc8a5[_0xcdf4('0x2e')]['filter']){_0x1879e2[_0xcdf4('0x38')]=_[_0xcdf4('0x3a')](_0x1879e2[_0xcdf4('0x38')],{'$or':_[_0xcdf4('0x28')](_0x4fdbf6,function(_0x21ebc4){if(_0x21ebc4['type']!==_0xcdf4('0x3b')){var _0x30aaf={};_0x30aaf[_0x21ebc4[_0xcdf4('0x26')]]={'$like':'%'+_0x8fc8a5[_0xcdf4('0x2e')][_0xcdf4('0x3c')]+'%'};return _0x30aaf;}})});}_0x1879e2=_[_0xcdf4('0x3a')]({},_0x1879e2,_0x8fc8a5['options']);var _0x5df352={'where':_0x1879e2[_0xcdf4('0x38')]};return db[_0xcdf4('0x29')][_0xcdf4('0x1b')](_0x5df352)[_0xcdf4('0x23')](function(_0xe7efb7){_0x382e40[_0xcdf4('0x1b')]=_0xe7efb7;if(_0x8fc8a5['query'][_0xcdf4('0x3d')]){_0x1879e2[_0xcdf4('0x3e')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xcdf4('0x3f')](_0x1879e2);})[_0xcdf4('0x23')](function(_0x502c6f){_0x382e40[_0xcdf4('0x40')]=_0x502c6f;return _0x382e40;})[_0xcdf4('0x23')](respondWithFilteredResult(_0x250427,_0x1879e2))[_0xcdf4('0x41')](handleError(_0x250427,null));};exports[_0xcdf4('0x42')]=function(_0x177aa9,_0x417779){var _0xcfe538={'raw':!![],'where':{'id':_0x177aa9[_0xcdf4('0x43')]['id']}},_0x37c2bb={};_0x37c2bb[_0xcdf4('0x2d')]=_['keys'](db[_0xcdf4('0x29')][_0xcdf4('0x44')]);_0x37c2bb[_0xcdf4('0x2e')]=_[_0xcdf4('0x45')](_0x177aa9[_0xcdf4('0x2e')]);_0x37c2bb[_0xcdf4('0x2f')]=_[_0xcdf4('0x30')](_0x37c2bb['model'],_0x37c2bb[_0xcdf4('0x2e')]);_0xcfe538[_0xcdf4('0x31')]=_['intersection'](_0x37c2bb[_0xcdf4('0x2d')],qs['fields'](_0x177aa9[_0xcdf4('0x2e')][_0xcdf4('0x32')]));_0xcfe538['attributes']=_0xcfe538[_0xcdf4('0x31')][_0xcdf4('0x33')]?_0xcfe538[_0xcdf4('0x31')]:_0x37c2bb[_0xcdf4('0x2d')];if(_0x177aa9[_0xcdf4('0x2e')][_0xcdf4('0x3d')]){_0xcfe538[_0xcdf4('0x3e')]=[{'all':!![]}];}_0xcfe538=_[_0xcdf4('0x3a')]({},_0xcfe538,_0x177aa9[_0xcdf4('0x46')]);return db[_0xcdf4('0x29')][_0xcdf4('0x47')](_0xcfe538)[_0xcdf4('0x23')](handleEntityNotFound(_0x417779,null))[_0xcdf4('0x23')](respondWithResult(_0x417779,null))[_0xcdf4('0x41')](handleError(_0x417779,null));};exports[_0xcdf4('0x48')]=function(_0x2b14d7,_0x4a1f1b){return db['WhatsappTransferReport'][_0xcdf4('0x48')](_0x2b14d7[_0xcdf4('0x49')],{})[_0xcdf4('0x23')](respondWithResult(_0x4a1f1b,0xc9))['catch'](handleError(_0x4a1f1b,null));};exports[_0xcdf4('0x22')]=function(_0x3e66cb,_0x3a6ccd){if(_0x3e66cb['body']['id']){delete _0x3e66cb[_0xcdf4('0x49')]['id'];}return db[_0xcdf4('0x29')][_0xcdf4('0x47')]({'where':{'id':_0x3e66cb['params']['id']}})[_0xcdf4('0x23')](handleEntityNotFound(_0x3a6ccd,null))['then'](saveUpdates(_0x3e66cb[_0xcdf4('0x49')],null))[_0xcdf4('0x23')](respondWithResult(_0x3a6ccd,null))[_0xcdf4('0x41')](handleError(_0x3a6ccd,null));};exports[_0xcdf4('0x4a')]=function(_0x3ca55d,_0x42366){return db[_0xcdf4('0x29')]['find']({'where':{'id':_0x3ca55d[_0xcdf4('0x43')]['id']}})[_0xcdf4('0x23')](handleEntityNotFound(_0x42366,null))[_0xcdf4('0x23')](removeEntity(_0x42366,null))[_0xcdf4('0x41')](handleError(_0x42366,null));};exports['describe']=function(_0x2d493a,_0x1dbd1c){return db[_0xcdf4('0x29')][_0xcdf4('0x4b')]()[_0xcdf4('0x23')](respondWithResult(_0x1dbd1c,null))['catch'](handleError(_0x1dbd1c,null));}; \ No newline at end of file +var _0xa98d=['hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','WhatsappTransferReport','includeAll','rows','catch','show','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length'];(function(_0x134571,_0x16f388){var _0x1be654=function(_0xc3ac20){while(--_0xc3ac20){_0x134571['push'](_0x134571['shift']());}};_0x1be654(++_0x16f388);}(_0xa98d,0x141));var _0xda98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa98d[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xda98('0x0'));var emlformat=require(_0xda98('0x1'));var rimraf=require(_0xda98('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda98('0x3'));var rp=require(_0xda98('0x4'));var moment=require(_0xda98('0x5'));var BPromise=require(_0xda98('0x6'));var Mustache=require(_0xda98('0x7'));var util=require(_0xda98('0x8'));var path=require(_0xda98('0x9'));var sox=require(_0xda98('0xa'));var csv=require(_0xda98('0xb'));var ejs=require(_0xda98('0xc'));var fs=require('fs');var _=require(_0xda98('0xd'));var squel=require(_0xda98('0xe'));var crypto=require(_0xda98('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xda98('0x10'));var toCsv=require(_0xda98('0xb'));var querystring=require(_0xda98('0x11'));var Papa=require(_0xda98('0x12'));var Redis=require(_0xda98('0x13'));var authService=require(_0xda98('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xda98('0x15'));var hardwareService=require(_0xda98('0x16'));var logger=require(_0xda98('0x17'))('api');var utils=require(_0xda98('0x18'));var config=require(_0xda98('0x19'));var db=require(_0xda98('0x1a'))['db'];function respondWithStatusCode(_0x401e28,_0x5ddb69){_0x5ddb69=_0x5ddb69||0xcc;return function(_0x544e53){if(_0x544e53){return _0x401e28[_0xda98('0x1b')](_0x5ddb69);}return _0x401e28[_0xda98('0x1c')](_0x5ddb69)['end']();};}function respondWithResult(_0x4b648d,_0x38e7a1){_0x38e7a1=_0x38e7a1||0xc8;return function(_0xfa7d4f){if(_0xfa7d4f){return _0x4b648d[_0xda98('0x1c')](_0x38e7a1)[_0xda98('0x1d')](_0xfa7d4f);}};}function respondWithFilteredResult(_0x4a3d32,_0x1406a5){return function(_0x5d3b14){if(_0x5d3b14){var _0x174cd7=_0x5d3b14[_0xda98('0x1e')],_0x565ccf=_0x1406a5[_0xda98('0x1f')],_0x4dbae4=_0x1406a5['offset']+_0x1406a5['limit'],_0x13034e;if(_0x4dbae4>=_0x174cd7){_0x4dbae4=_0x174cd7;_0x13034e=0xc8;}else{_0x13034e=0xce;}_0x4a3d32[_0xda98('0x1c')](_0x13034e);return _0x4a3d32[_0xda98('0x20')](_0xda98('0x21'),_0x565ccf+'-'+_0x4dbae4+'/'+_0x174cd7)[_0xda98('0x1d')](_0x5d3b14);}return null;};}function patchUpdates(_0x27969c){return function(_0xdd403a){try{jsonpatch['apply'](_0xdd403a,_0x27969c,!![]);}catch(_0x331523){return BPromise[_0xda98('0x22')](_0x331523);}return _0xdd403a[_0xda98('0x23')]();};}function saveUpdates(_0x670dc3,_0x5343d3){return function(_0x285976){if(_0x285976){return _0x285976[_0xda98('0x24')](_0x670dc3)[_0xda98('0x25')](function(_0x34ec67){return _0x34ec67;});}return null;};}function removeEntity(_0x44f1f0,_0x30cc9b){return function(_0x52b8ef){if(_0x52b8ef){return _0x52b8ef[_0xda98('0x26')]()[_0xda98('0x25')](function(){_0x44f1f0['status'](0xcc)[_0xda98('0x27')]();});}};}function handleEntityNotFound(_0x2c484e,_0x3f011e){return function(_0x3b40fa){if(!_0x3b40fa){_0x2c484e[_0xda98('0x1b')](0x194);}return _0x3b40fa;};}function handleError(_0x357b0a,_0x29d081){_0x29d081=_0x29d081||0x1f4;return function(_0x455904){logger['error'](_0x455904[_0xda98('0x28')]);if(_0x455904[_0xda98('0x29')]){delete _0x455904[_0xda98('0x29')];}_0x357b0a[_0xda98('0x1c')](_0x29d081)[_0xda98('0x2a')](_0x455904);};}exports[_0xda98('0x2b')]=function(_0x320f2e,_0xaa4507){var _0x4fc607={},_0x598a53={},_0xb5516c={'count':0x0,'rows':[]};var _0x148179=_[_0xda98('0x2c')](db['WhatsappTransferReport'][_0xda98('0x2d')],function(_0x49ca9f){return{'name':_0x49ca9f[_0xda98('0x2e')],'type':_0x49ca9f['type']['key']};});_0x598a53[_0xda98('0x2f')]=_['map'](_0x148179,_0xda98('0x29'));_0x598a53[_0xda98('0x30')]=_[_0xda98('0x31')](_0x320f2e[_0xda98('0x30')]);_0x598a53['filters']=_[_0xda98('0x32')](_0x598a53[_0xda98('0x2f')],_0x598a53[_0xda98('0x30')]);_0x4fc607[_0xda98('0x33')]=_[_0xda98('0x32')](_0x598a53[_0xda98('0x2f')],qs[_0xda98('0x34')](_0x320f2e[_0xda98('0x30')][_0xda98('0x34')]));_0x4fc607[_0xda98('0x33')]=_0x4fc607[_0xda98('0x33')][_0xda98('0x35')]?_0x4fc607['attributes']:_0x598a53[_0xda98('0x2f')];if(!_0x320f2e[_0xda98('0x30')][_0xda98('0x36')](_0xda98('0x37'))){_0x4fc607['limit']=qs['limit'](_0x320f2e[_0xda98('0x30')]['limit']);_0x4fc607[_0xda98('0x1f')]=qs[_0xda98('0x1f')](_0x320f2e[_0xda98('0x30')][_0xda98('0x1f')]);}_0x4fc607[_0xda98('0x38')]=qs[_0xda98('0x39')](_0x320f2e[_0xda98('0x30')][_0xda98('0x39')]);_0x4fc607[_0xda98('0x3a')]=qs[_0xda98('0x3b')](_[_0xda98('0x3c')](_0x320f2e[_0xda98('0x30')],_0x598a53[_0xda98('0x3b')]),_0x148179);if(_0x320f2e[_0xda98('0x30')][_0xda98('0x3d')]){_0x4fc607[_0xda98('0x3a')]=_['merge'](_0x4fc607[_0xda98('0x3a')],{'$or':_['map'](_0x148179,function(_0xff0a62){if(_0xff0a62['type']!==_0xda98('0x3e')){var _0x50e860={};_0x50e860[_0xff0a62[_0xda98('0x29')]]={'$like':'%'+_0x320f2e[_0xda98('0x30')][_0xda98('0x3d')]+'%'};return _0x50e860;}})});}_0x4fc607=_[_0xda98('0x3f')]({},_0x4fc607,_0x320f2e['options']);var _0x1fce39={'where':_0x4fc607[_0xda98('0x3a')]};return db[_0xda98('0x40')][_0xda98('0x1e')](_0x1fce39)['then'](function(_0x1f8130){_0xb5516c[_0xda98('0x1e')]=_0x1f8130;if(_0x320f2e['query'][_0xda98('0x41')]){_0x4fc607['include']=[{'all':!![]}];}return db[_0xda98('0x40')]['findAll'](_0x4fc607);})[_0xda98('0x25')](function(_0x3ccc1e){_0xb5516c[_0xda98('0x42')]=_0x3ccc1e;return _0xb5516c;})['then'](respondWithFilteredResult(_0xaa4507,_0x4fc607))[_0xda98('0x43')](handleError(_0xaa4507,null));};exports[_0xda98('0x44')]=function(_0x2e9309,_0x5c8cb3){var _0x353e95={'raw':!![],'where':{'id':_0x2e9309['params']['id']}},_0x2f426b={};_0x2f426b['model']=_['keys'](db[_0xda98('0x40')][_0xda98('0x2d')]);_0x2f426b[_0xda98('0x30')]=_[_0xda98('0x31')](_0x2e9309[_0xda98('0x30')]);_0x2f426b['filters']=_['intersection'](_0x2f426b[_0xda98('0x2f')],_0x2f426b[_0xda98('0x30')]);_0x353e95[_0xda98('0x33')]=_[_0xda98('0x32')](_0x2f426b['model'],qs[_0xda98('0x34')](_0x2e9309['query'][_0xda98('0x34')]));_0x353e95[_0xda98('0x33')]=_0x353e95[_0xda98('0x33')][_0xda98('0x35')]?_0x353e95['attributes']:_0x2f426b['model'];if(_0x2e9309[_0xda98('0x30')][_0xda98('0x41')]){_0x353e95['include']=[{'all':!![]}];}_0x353e95=_[_0xda98('0x3f')]({},_0x353e95,_0x2e9309[_0xda98('0x45')]);return db['WhatsappTransferReport'][_0xda98('0x46')](_0x353e95)[_0xda98('0x25')](handleEntityNotFound(_0x5c8cb3,null))['then'](respondWithResult(_0x5c8cb3,null))['catch'](handleError(_0x5c8cb3,null));};exports[_0xda98('0x47')]=function(_0x4f7f53,_0x3806c7){return db[_0xda98('0x40')]['create'](_0x4f7f53['body'],{})[_0xda98('0x25')](respondWithResult(_0x3806c7,0xc9))[_0xda98('0x43')](handleError(_0x3806c7,null));};exports[_0xda98('0x24')]=function(_0xd8de42,_0x5325ef){if(_0xd8de42[_0xda98('0x48')]['id']){delete _0xd8de42[_0xda98('0x48')]['id'];}return db['WhatsappTransferReport'][_0xda98('0x46')]({'where':{'id':_0xd8de42[_0xda98('0x49')]['id']}})['then'](handleEntityNotFound(_0x5325ef,null))[_0xda98('0x25')](saveUpdates(_0xd8de42[_0xda98('0x48')],null))[_0xda98('0x25')](respondWithResult(_0x5325ef,null))[_0xda98('0x43')](handleError(_0x5325ef,null));};exports['destroy']=function(_0x3cfd6c,_0x56ba8d){return db[_0xda98('0x40')][_0xda98('0x46')]({'where':{'id':_0x3cfd6c[_0xda98('0x49')]['id']}})['then'](handleEntityNotFound(_0x56ba8d,null))[_0xda98('0x25')](removeEntity(_0x56ba8d,null))[_0xda98('0x43')](handleError(_0x56ba8d,null));};exports[_0xda98('0x4a')]=function(_0x296ab0,_0x5d1313){return db[_0xda98('0x40')][_0xda98('0x4a')]()['then'](respondWithResult(_0x5d1313,null))[_0xda98('0x43')](handleError(_0x5d1313,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 95fac3e..9ee4be0 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 _0x58c5=['path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x6c8f5b,_0x16c8f3){var _0x7cd9cc=function(_0x6e0e1f){while(--_0x6e0e1f){_0x6c8f5b['push'](_0x6c8f5b['shift']());}};_0x7cd9cc(++_0x16c8f3);}(_0x58c5,0xe7));var _0x558c=function(_0x2cfc00,_0x1e5154){_0x2cfc00=_0x2cfc00-0x0;var _0x5eaee2=_0x58c5[_0x2cfc00];return _0x5eaee2;};'use strict';var _=require(_0x558c('0x0'));var util=require(_0x558c('0x1'));var logger=require(_0x558c('0x2'))(_0x558c('0x3'));var moment=require(_0x558c('0x4'));var BPromise=require(_0x558c('0x5'));var rp=require(_0x558c('0x6'));var fs=require('fs');var path=require(_0x558c('0x7'));var rimraf=require(_0x558c('0x8'));var config=require(_0x558c('0x9'));var attributes=require(_0x558c('0xa'));module[_0x558c('0xb')]=function(_0x49e456,_0x81e715){return _0x49e456['define'](_0x558c('0xc'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x558c('0xd'),'fields':[_0x558c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3725=['uniqueid','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x3725,0x1d5));var _0x5372=function(_0x54073a,_0xd989bb){_0x54073a=_0x54073a-0x0;var _0x213f12=_0x3725[_0x54073a];return _0x213f12;};'use strict';var _=require(_0x5372('0x0'));var util=require(_0x5372('0x1'));var logger=require(_0x5372('0x2'))('api');var moment=require(_0x5372('0x3'));var BPromise=require(_0x5372('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5372('0x5'));var rimraf=require('rimraf');var config=require(_0x5372('0x6'));var attributes=require(_0x5372('0x7'));module[_0x5372('0x8')]=function(_0x14d39d,_0x102216){return _0x14d39d[_0x5372('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0x5372('0xa'),'paranoid':![],'indexes':[{'name':_0x5372('0xb'),'fields':[_0x5372('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 68b117b..f49a128 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(_0x20341a,_0x233f23){var _0x4eb449=function(_0x1403bb){while(--_0x1403bb){_0x20341a['push'](_0x20341a['shift']());}};_0x4eb449(++_0x233f23);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','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(_0x58e9c3,_0x515356){var _0x31e460=function(_0x1c290b){while(--_0x1c290b){_0x58e9c3['push'](_0x58e9c3['shift']());}};_0x31e460(++_0x515356);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 0d40ea3..a940940 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa674=['./config/pm2/config','./config/schedule','./config/schedule/chat','sequelize','sync','then','info','start','Online\x20apps:','map','online','name','join','status','None','seedDB','./config/seedDB','default','./config/license','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','./config/pm2'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa674,0x13f));var _0x4a67=function(_0x7a6289,_0x34365e){_0x7a6289=_0x7a6289-0x0;var _0x139c92=_0xa674[_0x7a6289];return _0x139c92;};'use strict';var _=require(_0x4a67('0x0'));var mysqldb=require(_0x4a67('0x1'));var rpc=require(_0x4a67('0x2'));var config=require(_0x4a67('0x3'));var logger=require('./config/logger')('app');var pm2=require(_0x4a67('0x4'));var pm2Config=require(_0x4a67('0x5'));var schedule=require(_0x4a67('0x6'));var chat=require(_0x4a67('0x7'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x4a67('0x8')][_0x4a67('0x9')]()[_0x4a67('0xa')](function(){return rpc['listen']();})[_0x4a67('0xa')](function(_0x286033){logger[_0x4a67('0xb')](_0x286033);return chat[_0x4a67('0xc')]();})[_0x4a67('0xa')](function(){return schedule['start']();})[_0x4a67('0xa')](function(){return transcribe[_0x4a67('0xc')]();})['then'](function(_0x2d7798){logger['info'](_0x2d7798);return pm2['start'](pm2Config);})[_0x4a67('0xa')](function(_0x5ebc78){logger[_0x4a67('0xb')](_0x4a67('0xd'),_[_0x4a67('0xe')](_['filter'](_0x5ebc78,{'status':_0x4a67('0xf')}),_0x4a67('0x10'))[_0x4a67('0x11')]());logger['info']('Offline\x20apps:',_['map'](_['filter'](_0x5ebc78,function(_0x364197){return _0x364197[_0x4a67('0x12')]!=='online';}),_0x4a67('0x10'))[_0x4a67('0x11')]()||_0x4a67('0x13'));config[_0x4a67('0x14')]&&require(_0x4a67('0x15'))[_0x4a67('0x16')]();require(_0x4a67('0x17'))['default']();})[_0x4a67('0x18')](function(_0x3ad577){logger['error'](_0x4a67('0x19'),_0x3ad577);process[_0x4a67('0x1a')](0x1);});}main(); \ No newline at end of file +var _0x4609=['start','Online\x20apps:','map','online','name','join','Offline\x20apps:','filter','status','None','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./rpc','./config/environment','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/transcribe','sequelize','sync','then','listen','info'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x4609,0x1d4));var _0x9460=function(_0x401a5b,_0x4ad48d){_0x401a5b=_0x401a5b-0x0;var _0x2ca0f2=_0x4609[_0x401a5b];return _0x2ca0f2;};'use strict';var _=require('lodash');var mysqldb=require(_0x9460('0x0'));var rpc=require(_0x9460('0x1'));var config=require(_0x9460('0x2'));var logger=require('./config/logger')('app');var pm2=require(_0x9460('0x3'));var pm2Config=require(_0x9460('0x4'));var schedule=require(_0x9460('0x5'));var chat=require('./config/schedule/chat');var transcribe=require(_0x9460('0x6'));function main(){return mysqldb['db'][_0x9460('0x7')][_0x9460('0x8')]()[_0x9460('0x9')](function(){return rpc[_0x9460('0xa')]();})['then'](function(_0x18923b){logger[_0x9460('0xb')](_0x18923b);return chat['start']();})[_0x9460('0x9')](function(){return schedule[_0x9460('0xc')]();})['then'](function(){return transcribe['start']();})[_0x9460('0x9')](function(_0xedf9f0){logger[_0x9460('0xb')](_0xedf9f0);return pm2[_0x9460('0xc')](pm2Config);})[_0x9460('0x9')](function(_0x284139){logger[_0x9460('0xb')](_0x9460('0xd'),_[_0x9460('0xe')](_['filter'](_0x284139,{'status':_0x9460('0xf')}),_0x9460('0x10'))[_0x9460('0x11')]());logger[_0x9460('0xb')](_0x9460('0x12'),_[_0x9460('0xe')](_[_0x9460('0x13')](_0x284139,function(_0x518603){return _0x518603[_0x9460('0x14')]!==_0x9460('0xf');}),'name')[_0x9460('0x11')]()||_0x9460('0x15'));config[_0x9460('0x16')]&&require(_0x9460('0x17'))[_0x9460('0x18')]();require(_0x9460('0x19'))[_0x9460('0x18')]();})[_0x9460('0x1a')](function(_0xe918ad){logger[_0x9460('0x1b')](_0x9460('0x1c'),_0xe918ad);process[_0x9460('0x1d')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 240e19c..377fa5b 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 _0xe747=['phoneBarPrefixRequired','hotdesk','interface','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','user','findOne','params','disposition','then','closed','status','unmanaged','json','Unmanaged.','Forbidden.','catch','startsWith','headers','authorization','Basic','User','find','authenticate','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','/dashboards/general','send','retrieveApiKey','apiKeyNonce','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','secret','secrets','session','payload','options','verify','randomBytes','toString','hex','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','role','fullname','name','internal','userpic','md5secret','mailPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires'];(function(_0x8bd147,_0x1064b3){var _0x424e20=function(_0x5c9e2c){while(--_0x5c9e2c){_0x8bd147['push'](_0x8bd147['shift']());}};_0x424e20(++_0x1064b3);}(_0xe747,0x1d0));var _0x7e74=function(_0x5e2157,_0x126007){_0x5e2157=_0x5e2157-0x0;var _0x4a3ac0=_0xe747[_0x5e2157];return _0x4a3ac0;};'use strict';var db=require(_0x7e74('0x0'))['db'];var config=require(_0x7e74('0x1'));var hardwareConf=require(_0x7e74('0x2'));var _=require('lodash');var jwt=require(_0x7e74('0x3'));var expressJwt=require(_0x7e74('0x4'));var compose=require(_0x7e74('0x5'));var basicAuth=require(_0x7e74('0x6'));var crypto=require(_0x7e74('0x7'));var BPromise=require(_0x7e74('0x8'));var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0x7e74('0x9'),_0x7e74('0xa'),_0x7e74('0xb'),_0x7e74('0xc'),'email',_0x7e74('0xd'),'permissions',_0x7e74('0xe'),'voicePause','chatPause',_0x7e74('0xf'),_0x7e74('0x10'),'smsPause',_0x7e74('0x11'),_0x7e74('0x12'),_0x7e74('0x13'),_0x7e74('0x14'),_0x7e74('0x15'),_0x7e74('0x16'),'allowmessenger',_0x7e74('0x17'),_0x7e74('0x18'),_0x7e74('0x19'),_0x7e74('0x1a'),_0x7e74('0x1b'),_0x7e74('0x1c'),'phoneBarEnableDtmfTone',_0x7e74('0x1d'),_0x7e74('0x1e'),_0x7e74('0x1f'),'phoneBarRemoteControl','phoneBarRemoteControlPort',_0x7e74('0x20'),_0x7e74('0x21'),_0x7e74('0x22')];exports[_0x7e74('0x23')]=function(){return this[_0x7e74('0x24')](!![])[_0x7e74('0x25')](function(_0x46c356,_0x36b173,_0x2f1998){if(_0x46c356[_0x7e74('0x26')]){_0x2f1998();}else{return db['ChatInteraction'][_0x7e74('0x27')]({'where':{'id':_0x46c356[_0x7e74('0x28')]['id']},'attributes':['id','closed',_0x7e74('0x29')],'raw':!![]})[_0x7e74('0x2a')](function(_0x2511e9){if(_0x2511e9&&_0x2511e9[_0x7e74('0x2b')]){return _0x36b173[_0x7e74('0x2c')](_0x2511e9[_0x7e74('0x29')]===_0x7e74('0x2d')?0x195:0x193)[_0x7e74('0x2e')]({'message':_0x2511e9[_0x7e74('0x29')]===_0x7e74('0x2d')?_0x7e74('0x2f'):_0x7e74('0x30')});}else{_0x2f1998();}})[_0x7e74('0x31')](function(_0x52e5a7){_0x2f1998(_0x52e5a7);});}});};exports[_0x7e74('0x24')]=function isAuthenticated(_0x526583){return compose()[_0x7e74('0x25')](function(_0x5aa32c,_0x195fee,_0x5e216){if(_0x5aa32c['headers']['authorization']){if(_[_0x7e74('0x32')](_0x5aa32c[_0x7e74('0x33')][_0x7e74('0x34')],_0x7e74('0x35'))){var _0x22aee8=basicAuth(_0x5aa32c);db[_0x7e74('0x36')][_0x7e74('0x37')]({'where':{'name':_0x22aee8['name']}})[_0x7e74('0x2a')](function(_0x1b2829){if(!_0x1b2829||!_0x1b2829[_0x7e74('0x38')](_0x22aee8['pass'])){return _0x195fee['status'](0x191)['json']({'message':_0x7e74('0x39')});}_0x5aa32c[_0x7e74('0x26')]={'id':_0x1b2829['id']};_0x5e216();})[_0x7e74('0x31')](function(_0x1796c2){_0x5e216(_0x1796c2);});}else if(_['startsWith'](_0x5aa32c[_0x7e74('0x33')][_0x7e74('0x34')],_0x7e74('0x3a'))){validateJwt(_0x5aa32c,_0x195fee,_0x5e216);}else{if(_0x526583){_0x5e216();}else{return _0x195fee[_0x7e74('0x2c')](0x193)[_0x7e74('0x2e')]({'message':_0x7e74('0x3b')});}}}else if(_0x5aa32c[_0x7e74('0x3c')][_0x7e74('0x3d')]){try{var _0x274f5a={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x7e74('0x3e')]()};verifyJwt(_0x5aa32c[_0x7e74('0x3c')][_0x7e74('0x3d')],_0x274f5a)[_0x7e74('0x2a')](function(_0x387eb6){return db[_0x7e74('0x36')]['find']({'where':{'id':_0x387eb6['sub']}})['then'](function(_0x1d63bd){if(!_0x1d63bd||!_[_0x7e74('0x3f')](_0x1d63bd['apiKeyNonce'],_0x387eb6[_0x7e74('0x40')])){return _0x195fee[_0x7e74('0x2c')](0x191)[_0x7e74('0x2e')]({'message':_0x7e74('0x41')});}_0x5aa32c[_0x7e74('0x26')]={'id':_0x1d63bd['id']};_0x5e216();});})['catch'](function(){return _0x195fee['status'](0x191)[_0x7e74('0x2e')]({'message':_0x7e74('0x42')});});}catch(_0x5c2015){_0x5e216(_0x5c2015);}}else if(_0x526583){_0x5e216();}else{return _0x195fee[_0x7e74('0x2c')](0x193)[_0x7e74('0x2e')]({'message':_0x7e74('0x3b')});}})['use'](function(_0x526929,_0x447293,_0x573a16){if(_0x526929[_0x7e74('0x26')]){db[_0x7e74('0x36')][_0x7e74('0x37')]({'where':{'id':_0x526929[_0x7e74('0x26')]['id']},'attributes':userAttributes})[_0x7e74('0x2a')](function(_0x429d5a){if(!_0x429d5a){return _0x447293[_0x7e74('0x2c')](0x194)[_0x7e74('0x2e')]({'message':'User\x20not\x20found.'});}_0x526929[_0x7e74('0x26')]=_0x429d5a;_0x573a16();})[_0x7e74('0x31')](function(_0x333b09){_0x573a16(_0x333b09);});}else if(_0x526583){_0x573a16();}else{return _0x447293['status'](0x194)['json']({'message':_0x7e74('0x43')});}});};exports[_0x7e74('0x44')]=function canUpdate(){return compose()[_0x7e74('0x25')](function(_0x36a272,_0x24ac12,_0x2edbb9){return require(_0x7e74('0x45'))[_0x7e74('0x46')]()[_0x7e74('0x2a')](function(_0x2e26d1){if(_0x2e26d1[_0x7e74('0x47')]){_0x2edbb9();}else{return _0x24ac12[_0x7e74('0x2c')](0x193)['json']({'message':_0x7e74('0x48')});}})[_0x7e74('0x31')](function(_0x1bc1d2){_0x2edbb9(_0x1bc1d2);});});};exports[_0x7e74('0x49')]=function(_0x12074d,_0x6da2e9,_0x51bb1b){_0x12074d[_0x7e74('0x49')]=!![];return _0x51bb1b();};exports[_0x7e74('0x4a')]=function signToken(_0x220532){return signJwt(_0x220532);};exports[_0x7e74('0x4b')]=function(_0x425389,_0x524ef9){if(!_0x425389[_0x7e74('0x26')]){return _0x524ef9['status'](0x194)[_0x7e74('0x2e')]({'message':_0x7e74('0x4c')});}var _0x2f62a2={'payload':{'id':_0x425389[_0x7e74('0x26')]['id'],'role':_0x425389[_0x7e74('0x26')][_0x7e74('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x2f62a2)['then'](function(_0x437abd){_0x524ef9[_0x7e74('0x4d')]('motion.token',_0x437abd);_0x524ef9['redirect'](_0x7e74('0x4e'));})['catch'](function(_0x4f8816){return _0x524ef9[_0x7e74('0x2c')](0x1f4)[_0x7e74('0x4f')](_0x4f8816);});};exports[_0x7e74('0x50')]=function(_0x109e5a){if(_['isNil'](_0x109e5a[_0x7e74('0x51')])||_[_0x7e74('0x52')](_0x109e5a['apiKeyIat'])){return null;}else{return createJwt(_0x109e5a);}};exports[_0x7e74('0x53')]=function(_0x51f142){_0x51f142[_0x7e74('0x51')]=generateNonce();_0x51f142[_0x7e74('0x54')]=generateIssuedAt();return createJwt(_0x51f142);};exports[_0x7e74('0x55')]=function(_0x1de83a,_0xa46e92){var _0x56b7c8=_0x1de83a[_0x7e74('0x3c')][_0x7e74('0x3d')];if(_0x56b7c8){var _0x33de78={'nonce':_0xa46e92[_0x7e74('0x51')],'iat':_0xa46e92[_0x7e74('0x54')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x7e74('0x3e')]()};return verifyJwt(_0x56b7c8,_0x33de78)['then'](function(){return generateApiKey(_0xa46e92);});}else{throw{'message':_0x7e74('0x56')};}};function signJwt(_0x48dfed){var _0x431370=BPromise[_0x7e74('0x57')](jwt[_0x7e74('0x58')],{'context':jwt});var _0x13fa0b=_0x48dfed[_0x7e74('0x59')]||config[_0x7e74('0x5a')][_0x7e74('0x5b')];return new BPromise(function(_0x594781,_0x305e9a){_0x431370(_0x48dfed[_0x7e74('0x5c')],_0x13fa0b,_0x48dfed[_0x7e74('0x5d')])['then'](function(_0x16df8c){_0x594781(_0x16df8c);})[_0x7e74('0x31')](function(_0x4aacf8){_0x305e9a(_0x4aacf8);});});}function verifyJwt(_0x10a719,_0x42aa6a,_0x220729){var _0x520593=BPromise[_0x7e74('0x57')](jwt[_0x7e74('0x5e')],{'context':jwt});var _0x243340=_0x220729||config[_0x7e74('0x5a')][_0x7e74('0x5b')];return new BPromise(function(_0x2c227c,_0x2701fa){_0x520593(_0x10a719,_0x243340,_0x42aa6a)[_0x7e74('0x2a')](function(_0x5be784){_0x2c227c(_0x5be784);})[_0x7e74('0x31')](function(_0x38ee81){_0x2701fa(_0x38ee81);});});}function generateNonce(){return crypto[_0x7e74('0x5f')](0x10)[_0x7e74('0x60')](_0x7e74('0x61'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x7e74('0x60')]();}function createJwt(_0x5eaba0){var _0x5de36c={'payload':{'iat':_0x5eaba0[_0x7e74('0x54')],'nonce':_0x5eaba0[_0x7e74('0x51')]},'options':{'algorithm':_0x7e74('0x62'),'subject':_0x5eaba0['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x7e74('0x3e')]()}};return signJwt(_0x5de36c)[_0x7e74('0x2a')](function(_0x57a430){return{'iat':_0x5eaba0[_0x7e74('0x54')],'nonce':_0x5eaba0[_0x7e74('0x51')],'token':_0x57a430};});} \ No newline at end of file +var _0x6a0f=['phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','status','unmanaged','json','Forbidden.','catch','headers','authorization','startsWith','Basic','User','find','name','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','then','isEqual','nonce','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','promisify','sign','session','verify','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','express-jwt','composable-middleware','crypto','secrets','role','fullname','email','userpic','md5secret','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer'];(function(_0x18033b,_0x342cbd){var _0x3b12e5=function(_0x39dd33){while(--_0x39dd33){_0x18033b['push'](_0x18033b['shift']());}};_0x3b12e5(++_0x342cbd);}(_0x6a0f,0x1bc));var _0xf6a0=function(_0x1ca10e,_0x3c572b){_0x1ca10e=_0x1ca10e-0x0;var _0x42aee0=_0x6a0f[_0x1ca10e];return _0x42aee0;};'use strict';var db=require(_0xf6a0('0x0'))['db'];var config=require(_0xf6a0('0x1'));var hardwareConf=require(_0xf6a0('0x2'));var _=require(_0xf6a0('0x3'));var jwt=require(_0xf6a0('0x4'));var expressJwt=require(_0xf6a0('0x5'));var compose=require(_0xf6a0('0x6'));var basicAuth=require('basic-auth');var crypto=require(_0xf6a0('0x7'));var BPromise=require('bluebird');var validateJwt=expressJwt({'secret':config[_0xf6a0('0x8')]['session']});var userAttributes=['id',_0xf6a0('0x9'),_0xf6a0('0xa'),'name','internal',_0xf6a0('0xb'),_0xf6a0('0xc'),'permissions',_0xf6a0('0xd'),'voicePause','chatPause',_0xf6a0('0xe'),_0xf6a0('0xf'),_0xf6a0('0x10'),_0xf6a0('0x11'),_0xf6a0('0x12'),_0xf6a0('0x13'),_0xf6a0('0x14'),_0xf6a0('0x15'),_0xf6a0('0x16'),_0xf6a0('0x17'),_0xf6a0('0x18'),'alias',_0xf6a0('0x19'),_0xf6a0('0x1a'),'phoneBarDnd',_0xf6a0('0x1b'),_0xf6a0('0x1c'),_0xf6a0('0x1d'),'phoneBarExpires',_0xf6a0('0x1e'),'phoneBarRemoteControl',_0xf6a0('0x1f'),_0xf6a0('0x20'),_0xf6a0('0x21'),_0xf6a0('0x22')];exports[_0xf6a0('0x23')]=function(){return this[_0xf6a0('0x24')](!![])[_0xf6a0('0x25')](function(_0x14bcac,_0xc9f1c8,_0x187ed0){if(_0x14bcac[_0xf6a0('0x26')]){_0x187ed0();}else{return db[_0xf6a0('0x27')][_0xf6a0('0x28')]({'where':{'id':_0x14bcac[_0xf6a0('0x29')]['id']},'attributes':['id',_0xf6a0('0x2a'),_0xf6a0('0x2b')],'raw':!![]})['then'](function(_0x87ea0f){if(_0x87ea0f&&_0x87ea0f[_0xf6a0('0x2a')]){return _0xc9f1c8[_0xf6a0('0x2c')](_0x87ea0f[_0xf6a0('0x2b')]===_0xf6a0('0x2d')?0x195:0x193)[_0xf6a0('0x2e')]({'message':_0x87ea0f[_0xf6a0('0x2b')]===_0xf6a0('0x2d')?'Unmanaged.':_0xf6a0('0x2f')});}else{_0x187ed0();}})[_0xf6a0('0x30')](function(_0x1052ea){_0x187ed0(_0x1052ea);});}});};exports[_0xf6a0('0x24')]=function isAuthenticated(_0x35fef0){return compose()['use'](function(_0x3e311d,_0x1b6ebe,_0x4a61ae){if(_0x3e311d[_0xf6a0('0x31')][_0xf6a0('0x32')]){if(_[_0xf6a0('0x33')](_0x3e311d[_0xf6a0('0x31')][_0xf6a0('0x32')],_0xf6a0('0x34'))){var _0x2c7ce9=basicAuth(_0x3e311d);db[_0xf6a0('0x35')][_0xf6a0('0x36')]({'where':{'name':_0x2c7ce9[_0xf6a0('0x37')]}})['then'](function(_0x2e1606){if(!_0x2e1606||!_0x2e1606['authenticate'](_0x2c7ce9[_0xf6a0('0x38')])){return _0x1b6ebe[_0xf6a0('0x2c')](0x191)[_0xf6a0('0x2e')]({'message':_0xf6a0('0x39')});}_0x3e311d[_0xf6a0('0x26')]={'id':_0x2e1606['id']};_0x4a61ae();})[_0xf6a0('0x30')](function(_0x46edc3){_0x4a61ae(_0x46edc3);});}else if(_[_0xf6a0('0x33')](_0x3e311d[_0xf6a0('0x31')][_0xf6a0('0x32')],_0xf6a0('0x3a'))){validateJwt(_0x3e311d,_0x1b6ebe,_0x4a61ae);}else{if(_0x35fef0){_0x4a61ae();}else{return _0x1b6ebe['status'](0x193)[_0xf6a0('0x2e')]({'message':_0xf6a0('0x3b')});}}}else if(_0x3e311d[_0xf6a0('0x3c')][_0xf6a0('0x3d')]){try{var _0x4db9e5={'audience':hardwareConf[_0xf6a0('0x3e')](),'issuer':hardwareConf[_0xf6a0('0x3e')]()};verifyJwt(_0x3e311d[_0xf6a0('0x3c')]['apikey'],_0x4db9e5)['then'](function(_0x533ae7){return db[_0xf6a0('0x35')][_0xf6a0('0x36')]({'where':{'id':_0x533ae7['sub']}})[_0xf6a0('0x3f')](function(_0x49f182){if(!_0x49f182||!_[_0xf6a0('0x40')](_0x49f182['apiKeyNonce'],_0x533ae7[_0xf6a0('0x41')])){return _0x1b6ebe[_0xf6a0('0x2c')](0x191)[_0xf6a0('0x2e')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0x3e311d['user']={'id':_0x49f182['id']};_0x4a61ae();});})[_0xf6a0('0x30')](function(){return _0x1b6ebe[_0xf6a0('0x2c')](0x191)[_0xf6a0('0x2e')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x224c4b){_0x4a61ae(_0x224c4b);}}else if(_0x35fef0){_0x4a61ae();}else{return _0x1b6ebe['status'](0x193)[_0xf6a0('0x2e')]({'message':_0xf6a0('0x3b')});}})[_0xf6a0('0x25')](function(_0x5237f6,_0x4bc515,_0x3e23a8){if(_0x5237f6[_0xf6a0('0x26')]){db[_0xf6a0('0x35')][_0xf6a0('0x36')]({'where':{'id':_0x5237f6[_0xf6a0('0x26')]['id']},'attributes':userAttributes})[_0xf6a0('0x3f')](function(_0xb76cce){if(!_0xb76cce){return _0x4bc515[_0xf6a0('0x2c')](0x194)[_0xf6a0('0x2e')]({'message':'User\x20not\x20found.'});}_0x5237f6[_0xf6a0('0x26')]=_0xb76cce;_0x3e23a8();})[_0xf6a0('0x30')](function(_0xbfc80e){_0x3e23a8(_0xbfc80e);});}else if(_0x35fef0){_0x3e23a8();}else{return _0x4bc515[_0xf6a0('0x2c')](0x194)[_0xf6a0('0x2e')]({'message':_0xf6a0('0x42')});}});};exports[_0xf6a0('0x43')]=function canUpdate(){return compose()[_0xf6a0('0x25')](function(_0x115e06,_0x4e9e60,_0x2bb0a0){return require(_0xf6a0('0x44'))[_0xf6a0('0x45')]()[_0xf6a0('0x3f')](function(_0x51613c){if(_0x51613c[_0xf6a0('0x46')]){_0x2bb0a0();}else{return _0x4e9e60[_0xf6a0('0x2c')](0x193)['json']({'message':_0xf6a0('0x47')});}})[_0xf6a0('0x30')](function(_0x14c025){_0x2bb0a0(_0x14c025);});});};exports[_0xf6a0('0x48')]=function(_0x36938a,_0x419c1d,_0x388398){_0x36938a[_0xf6a0('0x48')]=!![];return _0x388398();};exports[_0xf6a0('0x49')]=function signToken(_0x173be2){return signJwt(_0x173be2);};exports[_0xf6a0('0x4a')]=function(_0x2a5131,_0x3cdc27){if(!_0x2a5131[_0xf6a0('0x26')]){return _0x3cdc27['status'](0x194)[_0xf6a0('0x2e')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x4a849d={'payload':{'id':_0x2a5131[_0xf6a0('0x26')]['id'],'role':_0x2a5131['user'][_0xf6a0('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4a849d)['then'](function(_0x54bfb8){_0x3cdc27[_0xf6a0('0x4b')](_0xf6a0('0x4c'),_0x54bfb8);_0x3cdc27[_0xf6a0('0x4d')](_0xf6a0('0x4e'));})[_0xf6a0('0x30')](function(_0xa6dc05){return _0x3cdc27['status'](0x1f4)['send'](_0xa6dc05);});};exports[_0xf6a0('0x4f')]=function(_0xea2987){if(_[_0xf6a0('0x50')](_0xea2987[_0xf6a0('0x51')])||_[_0xf6a0('0x50')](_0xea2987[_0xf6a0('0x52')])){return null;}else{return createJwt(_0xea2987);}};exports[_0xf6a0('0x53')]=function(_0x31f03b){_0x31f03b[_0xf6a0('0x51')]=generateNonce();_0x31f03b['apiKeyIat']=generateIssuedAt();return createJwt(_0x31f03b);};exports[_0xf6a0('0x54')]=function(_0x2cc50a,_0x352240){var _0x474e00=_0x2cc50a[_0xf6a0('0x3c')][_0xf6a0('0x3d')];if(_0x474e00){var _0x501d28={'nonce':_0x352240[_0xf6a0('0x51')],'iat':_0x352240[_0xf6a0('0x52')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x474e00,_0x501d28)['then'](function(){return generateApiKey(_0x352240);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};function signJwt(_0x15feb8){var _0x3bc72d=BPromise[_0xf6a0('0x55')](jwt[_0xf6a0('0x56')],{'context':jwt});var _0x34d333=_0x15feb8['secret']||config[_0xf6a0('0x8')][_0xf6a0('0x57')];return new BPromise(function(_0x3e49a9,_0x1f309c){_0x3bc72d(_0x15feb8['payload'],_0x34d333,_0x15feb8['options'])[_0xf6a0('0x3f')](function(_0x11d710){_0x3e49a9(_0x11d710);})[_0xf6a0('0x30')](function(_0x1af5d4){_0x1f309c(_0x1af5d4);});});}function verifyJwt(_0x1ddd9c,_0xaea069,_0x7b2b81){var _0x2d5b32=BPromise['promisify'](jwt[_0xf6a0('0x58')],{'context':jwt});var _0x372d43=_0x7b2b81||config[_0xf6a0('0x8')][_0xf6a0('0x57')];return new BPromise(function(_0x1f6846,_0x250572){_0x2d5b32(_0x1ddd9c,_0x372d43,_0xaea069)[_0xf6a0('0x3f')](function(_0x53927a){_0x1f6846(_0x53927a);})[_0xf6a0('0x30')](function(_0x3f639c){_0x250572(_0x3f639c);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xf6a0('0x59')](_0xf6a0('0x5a'));}function generateIssuedAt(){return Math[_0xf6a0('0x5b')](Date[_0xf6a0('0x5c')]()/0x3e8)[_0xf6a0('0x59')]();}function createJwt(_0x1e32ea){var _0x35f634={'payload':{'iat':_0x1e32ea[_0xf6a0('0x52')],'nonce':_0x1e32ea[_0xf6a0('0x51')]},'options':{'algorithm':_0xf6a0('0x5d'),'subject':_0x1e32ea['id']['toString'](),'issuer':hardwareConf[_0xf6a0('0x3e')](),'audience':hardwareConf[_0xf6a0('0x3e')]()}};return signJwt(_0x35f634)['then'](function(_0x2e5383){return{'iat':_0x1e32ea[_0xf6a0('0x52')],'nonce':_0x1e32ea[_0xf6a0('0x51')],'token':_0x2e5383};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index c9c4c8c..8310ca6 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 _0xe706=['unlink','crypto','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','update','end','final','binary','write','close','createDecipher'];(function(_0x4cad64,_0x13a1d1){var _0x1ebb2d=function(_0x564d94){while(--_0x564d94){_0x4cad64['push'](_0x4cad64['shift']());}};_0x1ebb2d(++_0x13a1d1);}(_0xe706,0xa3));var _0x6e70=function(_0x2706f2,_0x9a058){_0x2706f2=_0x2706f2-0x0;var _0x595bab=_0xe706[_0x2706f2];return _0x595bab;};'use strict';var crypto=require(_0x6e70('0x0'));var fs=require('fs');var BPromise=require(_0x6e70('0x1'));var defaultOptions={'algorithm':_0x6e70('0x2')};function combineOptions(_0x5e8446){var _0x2cae77={};for(var _0x315629 in defaultOptions){if(defaultOptions[_0x6e70('0x3')](_0x315629)){_0x2cae77[_0x315629]=defaultOptions[_0x315629];}}if(_0x5e8446){for(var _0x7dfbc3 in _0x5e8446){if(_0x5e8446[_0x6e70('0x3')](_0x7dfbc3)){_0x2cae77[_0x7dfbc3]=_0x5e8446[_0x7dfbc3];}}}return _0x2cae77;}exports[_0x6e70('0x4')]=function(_0x376a8d,_0x506db9,_0x1b0389,_0x4381d1){return new BPromise(function(_0x36357b,_0x293ce7){_0x4381d1=combineOptions(_0x4381d1);var _0x45a2d4=new Buffer(_0x1b0389);var _0x188ed3=fs[_0x6e70('0x5')](_0x376a8d);var _0x449b48=fs[_0x6e70('0x6')](_0x506db9);var _0x25e61c=crypto[_0x6e70('0x7')](_0x4381d1[_0x6e70('0x8')],_0x45a2d4);_0x188ed3['on'](_0x6e70('0x9'),function(_0x3f474a){var _0x37b3e0=new Buffer(_0x25e61c[_0x6e70('0xa')](_0x3f474a),'binary');_0x449b48['write'](_0x37b3e0);});_0x188ed3['on'](_0x6e70('0xb'),function(){try{var _0x15a1a5=new Buffer(_0x25e61c[_0x6e70('0xc')](_0x6e70('0xd')),_0x6e70('0xd'));_0x449b48[_0x6e70('0xe')](_0x15a1a5);_0x449b48[_0x6e70('0xb')]();_0x449b48['on'](_0x6e70('0xf'),function(){return _0x36357b(_0x506db9);});}catch(_0x5dfbaa){fs['unlink'](_0x506db9);return _0x293ce7(_0x5dfbaa);}});});};exports['decryptFile']=function(_0x257e81,_0x5a37a6,_0x53aed0,_0x304716){return new BPromise(function(_0x22c50c,_0x5d9263){_0x304716=combineOptions(_0x304716);var _0x24f3ac=new Buffer(_0x53aed0);var _0x5c3fe7=fs[_0x6e70('0x5')](_0x257e81);var _0x161f23=fs['createWriteStream'](_0x5a37a6);var _0x49029f=crypto[_0x6e70('0x10')](_0x304716['algorithm'],_0x24f3ac);_0x5c3fe7['on'](_0x6e70('0x9'),function(_0x173afe){var _0x53acdc=new Buffer(_0x49029f['update'](_0x173afe),_0x6e70('0xd'));_0x161f23[_0x6e70('0xe')](_0x53acdc);});_0x5c3fe7['on'](_0x6e70('0xb'),function(){try{var _0x3a9978=new Buffer(_0x49029f[_0x6e70('0xc')](_0x6e70('0xd')),_0x6e70('0xd'));_0x161f23[_0x6e70('0xe')](_0x3a9978);_0x161f23[_0x6e70('0xb')]();_0x161f23['on'](_0x6e70('0xf'),function(){return _0x22c50c(_0x5a37a6);});}catch(_0x4a0cfe){fs[_0x6e70('0x11')](_0x5a37a6);return _0x5d9263(_0x4a0cfe);}});});}; \ No newline at end of file +var _0xd8b0=['data','binary','end','final','write','close','unlink','decryptFile','createReadStream','createDecipher','update','crypto','bluebird','hasOwnProperty','encryptFile','createWriteStream','createCipher','algorithm'];(function(_0x404e18,_0x16738f){var _0x2dff47=function(_0xddd612){while(--_0xddd612){_0x404e18['push'](_0x404e18['shift']());}};_0x2dff47(++_0x16738f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var crypto=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var defaultOptions={'algorithm':'aes192'};function combineOptions(_0x585166){var _0x4b72b0={};for(var _0x3ff8df in defaultOptions){if(defaultOptions[_0x0d8b('0x2')](_0x3ff8df)){_0x4b72b0[_0x3ff8df]=defaultOptions[_0x3ff8df];}}if(_0x585166){for(var _0x43bca1 in _0x585166){if(_0x585166[_0x0d8b('0x2')](_0x43bca1)){_0x4b72b0[_0x43bca1]=_0x585166[_0x43bca1];}}}return _0x4b72b0;}exports[_0x0d8b('0x3')]=function(_0x577834,_0x5e15e6,_0x3f8b6f,_0x227c63){return new BPromise(function(_0x39f43a,_0x4a4470){_0x227c63=combineOptions(_0x227c63);var _0x413284=new Buffer(_0x3f8b6f);var _0x284169=fs['createReadStream'](_0x577834);var _0x129310=fs[_0x0d8b('0x4')](_0x5e15e6);var _0x3b027f=crypto[_0x0d8b('0x5')](_0x227c63[_0x0d8b('0x6')],_0x413284);_0x284169['on'](_0x0d8b('0x7'),function(_0x2c5e9e){var _0x28f87c=new Buffer(_0x3b027f['update'](_0x2c5e9e),_0x0d8b('0x8'));_0x129310['write'](_0x28f87c);});_0x284169['on'](_0x0d8b('0x9'),function(){try{var _0xc574a3=new Buffer(_0x3b027f[_0x0d8b('0xa')](_0x0d8b('0x8')),_0x0d8b('0x8'));_0x129310[_0x0d8b('0xb')](_0xc574a3);_0x129310[_0x0d8b('0x9')]();_0x129310['on'](_0x0d8b('0xc'),function(){return _0x39f43a(_0x5e15e6);});}catch(_0x1d4bbc){fs[_0x0d8b('0xd')](_0x5e15e6);return _0x4a4470(_0x1d4bbc);}});});};exports[_0x0d8b('0xe')]=function(_0xe65334,_0x1567ce,_0x2d4e1c,_0x4f6f21){return new BPromise(function(_0x23eb7b,_0xa86349){_0x4f6f21=combineOptions(_0x4f6f21);var _0x17f7df=new Buffer(_0x2d4e1c);var _0xe2e167=fs[_0x0d8b('0xf')](_0xe65334);var _0x5cd485=fs[_0x0d8b('0x4')](_0x1567ce);var _0x4586c2=crypto[_0x0d8b('0x10')](_0x4f6f21[_0x0d8b('0x6')],_0x17f7df);_0xe2e167['on'](_0x0d8b('0x7'),function(_0x18dd2d){var _0x264b39=new Buffer(_0x4586c2[_0x0d8b('0x11')](_0x18dd2d),'binary');_0x5cd485[_0x0d8b('0xb')](_0x264b39);});_0xe2e167['on'](_0x0d8b('0x9'),function(){try{var _0x196c0a=new Buffer(_0x4586c2[_0x0d8b('0xa')](_0x0d8b('0x8')),_0x0d8b('0x8'));_0x5cd485[_0x0d8b('0xb')](_0x196c0a);_0x5cd485[_0x0d8b('0x9')]();_0x5cd485['on']('close',function(){return _0x23eb7b(_0x1567ce);});}catch(_0x4f0a1a){fs[_0x0d8b('0xd')](_0x1567ce);return _0xa86349(_0x4f0a1a);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index dffceb8..4745da2 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 _0xb43b=['basename','.csv','existsSync','join','length','%s%d.%s','csv','%s.%s','writeFileSync','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','to-csv','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv','then','sequelize','QueryTypes','num','Empty','split','push','query','SELECT','dirname'];(function(_0x44400c,_0x4469e7){var _0x5d3d53=function(_0x2a4102){while(--_0x2a4102){_0x44400c['push'](_0x44400c['shift']());}};_0x5d3d53(++_0x4469e7);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1c8cde,_0x299c5a){_0x1c8cde=_0x1c8cde-0x0;var _0x55b330=_0xb43b[_0x1c8cde];return _0x55b330;};'use strict';var util=require(_0xbb43('0x0'));var path=require(_0xbb43('0x1'));var _=require('lodash');var csv=require(_0xbb43('0x2'));var fs=require('fs');var BPromise=require(_0xbb43('0x3'));var zipdir=require(_0xbb43('0x4'));var rimraf=require('rimraf');var db=require(_0xbb43('0x5'))['db'];var dbH=require(_0xbb43('0x5'))[_0xbb43('0x6')];var logger=require(_0xbb43('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xbb43('0x8')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x80fe61,_0x1ccd49){var _0x2a2f11={'status':_0x80fe61};var _0x29ae1a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1ccd49){_0x2a2f11[_0xbb43('0x9')]=_0x1ccd49;}return db['AnalyticExtractedReport'][_0xbb43('0xa')](_0x2a2f11,_0x29ae1a);}function main(){var _0xf54ac5=0x1388;var _0x5d5b11;logger[_0xbb43('0xb')](util[_0xbb43('0xc')](_0xbb43('0xd'),EXTRACTED_REPORT_ID,_0xbb43('0xe')));return db[_0xbb43('0xf')][_0xbb43('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xbb43('0x11')]})[_0xbb43('0x12')](function(_0x50e2c0){if(_0x50e2c0){_0x5d5b11=_0x50e2c0;_0xf54ac5=_0x5d5b11['splitSizeCsv']||0x1388;}})[_0xbb43('0x12')](function(){return dbH['sequelize']['query'](util[_0xbb43('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xbb43('0x13')][_0xbb43('0x14')]['SELECT']});})['then'](function(_0x4d5bcf){if(!_0x4d5bcf[0x0][_0xbb43('0x15')]){return analyticExtractedReport(_0xbb43('0x16'));}var _0x57bd1d=[];var _0x526330=0x0;var _0x202980=!![];if(_0x4d5bcf&&_0x4d5bcf['length']){var _0x5923dc=_0x4d5bcf[0x0][_0xbb43('0x15')]%(_0x526330+_0xf54ac5);if(_0x5d5b11[_0xbb43('0x17')]){for(;_0x202980;_0x526330+=_0xf54ac5,_0x5923dc=_0x4d5bcf[0x0][_0xbb43('0x15')]%(_0x526330+_0xf54ac5)){if(_0x5923dc==0x0||_0x5923dc==_0x4d5bcf[0x0]['num']){_0x202980=![];}_0x57bd1d[_0xbb43('0x18')](dbH['sequelize'][_0xbb43('0x19')](util[_0xbb43('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xf54ac5,_0x526330),{'type':dbH['sequelize'][_0xbb43('0x14')][_0xbb43('0x1a')]}));}}else{_0x57bd1d[_0xbb43('0x18')](dbH[_0xbb43('0x13')]['query'](QUERY,{'type':dbH[_0xbb43('0x13')]['QueryTypes'][_0xbb43('0x1a')]}));}}var _0x4bfaca=path[_0xbb43('0x1b')](PATH);var _0x565256=path[_0xbb43('0x1c')](PATH,_0xbb43('0x1d'));var _0x577ddd=_0x5d5b11[_0xbb43('0x17')]&&_0x57bd1d['length']>0x1;var _0xf24e60=[];if(!fs[_0xbb43('0x1e')](path[_0xbb43('0x1f')](_0x4bfaca,_0x565256))&&_0x577ddd){fs['mkdirSync'](path['join'](_0x4bfaca,_0x565256));}return BPromise['each'](_0x57bd1d,function(_0x269ca5){_0xf24e60[_0xbb43('0x18')](_0x269ca5);})['then'](function(){for(var _0x3b3083=0x0;_0x3b3083<_0xf24e60[_0xbb43('0x20')];_0x3b3083+=0x1){var _0x226827;var _0x3874fb=_0xf24e60[_0x3b3083];if(_0x577ddd){_0x226827=path['join'](_0x4bfaca,_0x565256,util['format'](_0xbb43('0x21'),_0x565256,_0x3b3083,_0xbb43('0x22')));}else{_0x226827=path[_0xbb43('0x1f')](_0x4bfaca,util[_0xbb43('0xc')](_0xbb43('0x23'),_0x565256,_0xbb43('0x22')));}fs[_0xbb43('0x24')](_0x226827,csv(_0x3874fb));}})[_0xbb43('0x12')](function(){if(_0x577ddd){zipdir(path['join'](_0x4bfaca,_0x565256),{'saveTo':path[_0xbb43('0x1f')](_0x4bfaca,util['format'](_0xbb43('0x23'),_0x565256,_0xbb43('0x25')))},function(_0x34f5b2,_0x1880cd){});rimraf(path['join'](_0x4bfaca,_0x565256),function(){});}})[_0xbb43('0x12')](function(){logger['info'](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xbb43('0xe')));return analyticExtractedReport('Completed',_0x577ddd?util[_0xbb43('0xc')](_0xbb43('0x23'),_0x565256,_0x577ddd?_0xbb43('0x25'):'csv'):null);});})[_0xbb43('0x26')](function(_0x1bdf91){logger[_0xbb43('0xb')](util[_0xbb43('0xc')](_0xbb43('0x27'),EXTRACTED_REPORT_ID,_0xbb43('0xe')),util[_0xbb43('0x28')](_0x1bdf91,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb43('0x29'));});}main(); \ No newline at end of file +var _0x668b=['SELECT','num','Empty','push','dirname','.csv','existsSync','join','mkdirSync','each','csv','writeFileSync','%s.%s','zip','CSV','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','util','path','to-csv','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes'];(function(_0x7e93b5,_0x10d378){var _0x3fb8b6=function(_0x3b94ea){while(--_0x3b94ea){_0x7e93b5['push'](_0x7e93b5['shift']());}};_0x3fb8b6(++_0x10d378);}(_0x668b,0x140));var _0xb668=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x668b[_0x297fd3];return _0x2af381;};'use strict';var util=require(_0xb668('0x0'));var path=require(_0xb668('0x1'));var _=require('lodash');var csv=require(_0xb668('0x2'));var fs=require('fs');var BPromise=require(_0xb668('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xb668('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0xb668('0x5'))[_0xb668('0x6')];var logger=require(_0xb668('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xb668('0x8')][0x2]);var QUERY=process[_0xb668('0x8')][0x3];var PATH=process[_0xb668('0x8')][0x4];function analyticExtractedReport(_0x2778e9,_0x20b749){var _0x3f01bc={'status':_0x2778e9};var _0x517fc5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x20b749){_0x3f01bc[_0xb668('0x9')]=_0x20b749;}return db[_0xb668('0xa')][_0xb668('0xb')](_0x3f01bc,_0x517fc5);}function main(){var _0x16d50d=0x1388;var _0x39b79c;logger[_0xb668('0xc')](util[_0xb668('0xd')](_0xb668('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xb668('0xf')][_0xb668('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb668('0x11'),_0xb668('0x12')]})[_0xb668('0x13')](function(_0x167057){if(_0x167057){_0x39b79c=_0x167057;_0x16d50d=_0x39b79c[_0xb668('0x12')]||0x1388;}})[_0xb668('0x13')](function(){return dbH[_0xb668('0x14')][_0xb668('0x15')](util[_0xb668('0xd')](_0xb668('0x16'),QUERY),{'type':dbH[_0xb668('0x14')][_0xb668('0x17')][_0xb668('0x18')]});})[_0xb668('0x13')](function(_0x1ca6e7){if(!_0x1ca6e7[0x0][_0xb668('0x19')]){return analyticExtractedReport(_0xb668('0x1a'));}var _0x4a755b=[];var _0xd3e39f=0x0;var _0x27bbfa=!![];if(_0x1ca6e7&&_0x1ca6e7['length']){var _0x13ee71=_0x1ca6e7[0x0]['num']%(_0xd3e39f+_0x16d50d);if(_0x39b79c[_0xb668('0x11')]){for(;_0x27bbfa;_0xd3e39f+=_0x16d50d,_0x13ee71=_0x1ca6e7[0x0][_0xb668('0x19')]%(_0xd3e39f+_0x16d50d)){if(_0x13ee71==0x0||_0x13ee71==_0x1ca6e7[0x0]['num']){_0x27bbfa=![];}_0x4a755b[_0xb668('0x1b')](dbH[_0xb668('0x14')]['query'](util[_0xb668('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x16d50d,_0xd3e39f),{'type':dbH[_0xb668('0x14')][_0xb668('0x17')][_0xb668('0x18')]}));}}else{_0x4a755b[_0xb668('0x1b')](dbH['sequelize'][_0xb668('0x15')](QUERY,{'type':dbH[_0xb668('0x14')][_0xb668('0x17')]['SELECT']}));}}var _0x5a2f74=path[_0xb668('0x1c')](PATH);var _0x1e5620=path['basename'](PATH,_0xb668('0x1d'));var _0x4bf863=_0x39b79c[_0xb668('0x11')]&&_0x4a755b['length']>0x1;var _0x3f4745=[];if(!fs[_0xb668('0x1e')](path[_0xb668('0x1f')](_0x5a2f74,_0x1e5620))&&_0x4bf863){fs[_0xb668('0x20')](path[_0xb668('0x1f')](_0x5a2f74,_0x1e5620));}return BPromise[_0xb668('0x21')](_0x4a755b,function(_0x4d4bf8){_0x3f4745[_0xb668('0x1b')](_0x4d4bf8);})[_0xb668('0x13')](function(){for(var _0x2ab8c2=0x0;_0x2ab8c2<_0x3f4745['length'];_0x2ab8c2+=0x1){var _0x5e0cee;var _0xe62fce=_0x3f4745[_0x2ab8c2];if(_0x4bf863){_0x5e0cee=path[_0xb668('0x1f')](_0x5a2f74,_0x1e5620,util[_0xb668('0xd')]('%s%d.%s',_0x1e5620,_0x2ab8c2,_0xb668('0x22')));}else{_0x5e0cee=path[_0xb668('0x1f')](_0x5a2f74,util[_0xb668('0xd')]('%s.%s',_0x1e5620,'csv'));}fs[_0xb668('0x23')](_0x5e0cee,csv(_0xe62fce));}})[_0xb668('0x13')](function(){if(_0x4bf863){zipdir(path['join'](_0x5a2f74,_0x1e5620),{'saveTo':path[_0xb668('0x1f')](_0x5a2f74,util[_0xb668('0xd')](_0xb668('0x24'),_0x1e5620,_0xb668('0x25')))},function(_0x256a8,_0x5f36b5){});rimraf(path[_0xb668('0x1f')](_0x5a2f74,_0x1e5620),function(){});}})[_0xb668('0x13')](function(){logger['info'](util[_0xb668('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xb668('0x26')));return analyticExtractedReport(_0xb668('0x27'),_0x4bf863?util[_0xb668('0xd')](_0xb668('0x24'),_0x1e5620,_0x4bf863?_0xb668('0x25'):_0xb668('0x22')):null);});})[_0xb668('0x28')](function(_0x3d4bd8){logger[_0xb668('0xc')](util['format'](_0xb668('0x29'),EXTRACTED_REPORT_ID,_0xb668('0x26')),util[_0xb668('0x2a')](_0x3d4bd8,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index a23e663..621ca8f 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['hasOwnProperty','push','num','Empty','dirname','basename','Setting','find','split','splitSizePdf','then','length','query','format','QueryTypes','SELECT','sequelize','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','landscape','body','toString','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','%s.%s','createWriteStream','finish','err','end','info','CSV','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','lodash','bluebird','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport'];(function(_0x139bce,_0x135eaa){var _0x4c291d=function(_0x239962){while(--_0x239962){_0x139bce['push'](_0x139bce['shift']());}};_0x4c291d(++_0x135eaa);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5d7dc8,_0x14a0fc){_0x5d7dc8=_0x5d7dc8-0x0;var _0x4b99bb=_0x5f2f[_0x5d7dc8];return _0x4b99bb;};'use strict';var _=require(_0xf5f2('0x0'));var fs=require('fs');var BPromise=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var path=require(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var PdfPrinter=require(_0xf5f2('0x5'));var zipdir=require(_0xf5f2('0x6'));var rimraf=require(_0xf5f2('0x7'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xf5f2('0x8')];var logger=require(_0xf5f2('0x9'))(_0xf5f2('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xf5f2('0xb')][0x2]);var QUERY=process[_0xf5f2('0xb')][0x3];var PATH=process[_0xf5f2('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xf5f2('0xc');var _extractedReport;function analyticExtractedReport(_0x46cd9c,_0x2ec345){var _0x56a69f={'status':_0x46cd9c};var _0x375da4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ec345){_0x56a69f[_0xf5f2('0xd')]=_0x2ec345;}return db[_0xf5f2('0xe')]['update'](_0x56a69f,_0x375da4);}function getHeader(_0x977a59){var _0x4ebbbe=[];for(var _0x53fb33 in _0x977a59){if(_0x977a59[_0xf5f2('0xf')](_0x53fb33)){_0x4ebbbe[_0xf5f2('0x10')]({'text':_0x53fb33,'style':'tableHeader'});}}return _0x4ebbbe;}function extractReport(_0x336f6b){var _0x14b51f=0x1388;var _0x331482;if(!_0x336f6b[0x0][_0xf5f2('0x11')]){return analyticExtractedReport(_0xf5f2('0x12'));}var _0x3e5956=[];var _0x5c01b8=0x0;var _0x5850f4=!![];var _0xea612c=path[_0xf5f2('0x13')](PATH);var _0x1c1a5c=path[_0xf5f2('0x14')](PATH,'.pdf');var _0xafe430=![];var _0x286197=[];return db[_0xf5f2('0x15')][_0xf5f2('0x16')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf5f2('0x17'),_0xf5f2('0x18')]})[_0xf5f2('0x19')](function(_0x395a5a){if(_0x395a5a){_0x331482=_0x395a5a;_0x14b51f=_0x331482[_0xf5f2('0x18')]||0x3e8;}})[_0xf5f2('0x19')](function(){if(_0x336f6b&&_0x336f6b[_0xf5f2('0x1a')]){var _0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f);if(_0x331482[_0xf5f2('0x17')]){for(;_0x5850f4;_0x5c01b8+=_0x14b51f,_0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f)){if(_0x28e097==0x0||_0x28e097==_0x336f6b[0x0][_0xf5f2('0x11')]){_0x5850f4=![];}_0x3e5956[_0xf5f2('0x10')](dbH['sequelize'][_0xf5f2('0x1b')](util[_0xf5f2('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x14b51f,_0x5c01b8),{'type':dbH['sequelize'][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}else{_0x3e5956['push'](dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](QUERY,{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}_0xafe430=_0x331482['split']&&_0x3e5956[_0xf5f2('0x1a')]>0x1;if(!fs[_0xf5f2('0x20')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c))&&_0xafe430){fs[_0xf5f2('0x22')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c));}return BPromise['each'](_0x3e5956,function(_0x529f07){_0x286197[_0xf5f2('0x10')](_0x529f07);});})[_0xf5f2('0x19')](function(){return BPromise[_0xf5f2('0x23')](_0x3e5956,function(_0x1a5bb3,_0xf6c58d){var _0x788a8d;var _0x13a3be=util[_0xf5f2('0x1c')](_0xf5f2('0x24'),NAME,_extractedReport['name'],moment(_extractedReport[_0xf5f2('0x25')])[_0xf5f2('0x1c')](FORMAT),moment(_extractedReport[_0xf5f2('0x26')])[_0xf5f2('0x1c')](FORMAT));var _0x198c73={'pageSize':'A4','pageOrientation':_0xf5f2('0x27'),'content':[{'text':_0x13a3be,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'}}};var _0x22c826={'headerRows':0x1,'body':[]};_0x22c826[_0xf5f2('0x28')][_0xf5f2('0x10')](getHeader(_0x1a5bb3[0x0]));var _0x5027ab;for(var _0x5a2c7e=0x0;_0x5a2c7e<_0x1a5bb3[_0xf5f2('0x1a')];_0x5a2c7e+=0x1){_0x5027ab=[];for(var _0x50b8a2 in _0x1a5bb3[_0x5a2c7e]){if(_0x1a5bb3[_0x5a2c7e][_0xf5f2('0xf')](_0x50b8a2)){_0x5027ab[_0xf5f2('0x10')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]?_[_0xf5f2('0x29')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]):'');}}_0x22c826['body']['push'](_0x5027ab);}_0x198c73[_0xf5f2('0x2a')]['push']({'table':_0x22c826});return new BPromise(function(_0xb744b9,_0x58a4df){var _0x45b643=new PdfPrinter({'Roboto':{'normal':__dirname+_0xf5f2('0x2b'),'bold':__dirname+_0xf5f2('0x2c'),'italics':__dirname+_0xf5f2('0x2d'),'bolditalics':__dirname+_0xf5f2('0x2e')}});var _0x277eee=_0x45b643[_0xf5f2('0x2f')](_0x198c73);if(_0xafe430){_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c,util['format'](_0xf5f2('0x30'),_0x1c1a5c,_0xf6c58d,_0xf5f2('0x31')));}else{_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xf5f2('0x31')));}var _0x297c0c=_0x277eee['pipe'](fs[_0xf5f2('0x33')](_0x788a8d));_0x297c0c['on'](_0xf5f2('0x34'),function(){_0xb744b9();});_0x297c0c['on']('error',function(_0x3fc168){console['log'](_0xf5f2('0x35'),_0x3fc168);_0x58a4df(_0x3fc168);});_0x277eee[_0xf5f2('0x36')]();});});})[_0xf5f2('0x19')](function(){if(_0xafe430){return new BPromise(function(_0x2e3cca,_0x59a6dd){zipdir(path['join'](_0xea612c,_0x1c1a5c),{'saveTo':path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,'zip'))},function(_0x41447f){if(_0x41447f){_0x59a6dd(_0x41447f);}else{_0x2e3cca();}});});}})['then'](function(){if(_0xafe430){rimraf(path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c),function(){});}})['then'](function(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xf5f2('0x38')));return analyticExtractedReport(_0xf5f2('0x39'),_0xafe430?util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xafe430?'zip':'pdf'):null);});}function main(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')](_0xf5f2('0x3a'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')));return db[_0xf5f2('0xe')][_0xf5f2('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf5f2('0x19')](function(_0x4c0ac7){_extractedReport=_0x4c0ac7;return dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](util['format'](_0xf5f2('0x3d'),QUERY),{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]});})[_0xf5f2('0x19')](extractReport)[_0xf5f2('0x3e')](function(_0x462ea3){logger[_0xf5f2('0x37')](util['format'](_0xf5f2('0x3f'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')),util[_0xf5f2('0x40')](_0x462ea3,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x14bb05,_0x1676df){var _0x5a1bdb=function(_0xc3d98f){while(--_0xc3d98f){_0x14bb05['push'](_0x14bb05['shift']());}};_0x5a1bdb(++_0x1676df);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index f90efe2..dadd1db 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 _0xc5c6=['%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','path','lodash','json2xls','bluebird','../../mysqldb','dbH','../../config/logger','argv','savename','update','info','XLSX','Setting','find','split','splitSizeXlsx','then','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','length','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','push'];(function(_0x14490c,_0x50e8ab){var _0x2f6825=function(_0x477b03){while(--_0x477b03){_0x14490c['push'](_0x14490c['shift']());}};_0x2f6825(++_0x50e8ab);}(_0xc5c6,0x184));var _0x6c5c=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xc5c6[_0x29d915];return _0x160f86;};'use strict';var util=require('util');var path=require(_0x6c5c('0x0'));var _=require(_0x6c5c('0x1'));var fs=require('fs');var json2xls=require(_0x6c5c('0x2'));var BPromise=require(_0x6c5c('0x3'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0x6c5c('0x4'))['db'];var dbH=require(_0x6c5c('0x4'))[_0x6c5c('0x5')];var logger=require(_0x6c5c('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x6c5c('0x7')][0x2]);var QUERY=process[_0x6c5c('0x7')][0x3];var PATH=process[_0x6c5c('0x7')][0x4];function analyticExtractedReport(_0x5e7603,_0x21ecfc){var _0x2d3b3f={'status':_0x5e7603};var _0x1266fc={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x21ecfc){_0x2d3b3f[_0x6c5c('0x8')]=_0x21ecfc;}return db['AnalyticExtractedReport'][_0x6c5c('0x9')](_0x2d3b3f,_0x1266fc);}function main(){var _0x5a690d=0x1388;var _0xdf41bb;logger[_0x6c5c('0xa')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6c5c('0xb')));return db[_0x6c5c('0xc')][_0x6c5c('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6c5c('0xe'),_0x6c5c('0xf')]})[_0x6c5c('0x10')](function(_0x3d3c7b){if(_0x3d3c7b){_0xdf41bb=_0x3d3c7b;_0x5a690d=_0xdf41bb[_0x6c5c('0xf')]||0x1388;}})[_0x6c5c('0x10')](function(){return dbH['sequelize']['query'](util[_0x6c5c('0x11')](_0x6c5c('0x12'),QUERY),{'type':dbH[_0x6c5c('0x13')][_0x6c5c('0x14')][_0x6c5c('0x15')]});})[_0x6c5c('0x10')](function(_0x509e08){if(!_0x509e08[0x0][_0x6c5c('0x16')]){return analyticExtractedReport(_0x6c5c('0x17'));}var _0x197586=[];var _0x1af7ce=0x0;var _0x3dbc91=!![];if(_0xdf41bb[_0x6c5c('0xe')]){if(_0x509e08&&_0x509e08[_0x6c5c('0x18')]){var _0x3b50dd=_0x509e08[0x0][_0x6c5c('0x16')]%(_0x1af7ce+_0x5a690d);for(;_0x3dbc91;_0x1af7ce+=_0x5a690d,_0x3b50dd=_0x509e08[0x0][_0x6c5c('0x16')]%(_0x1af7ce+_0x5a690d)){if(_0x3b50dd==0x0||_0x3b50dd==_0x509e08[0x0][_0x6c5c('0x16')]){_0x3dbc91=![];}_0x197586['push'](dbH[_0x6c5c('0x13')][_0x6c5c('0x19')](util['format'](_0x6c5c('0x1a'),QUERY,_0x5a690d,_0x1af7ce),{'type':dbH[_0x6c5c('0x13')]['QueryTypes'][_0x6c5c('0x15')]}));}}}else{_0x197586['push'](dbH[_0x6c5c('0x13')][_0x6c5c('0x19')](QUERY,{'type':dbH[_0x6c5c('0x13')][_0x6c5c('0x14')][_0x6c5c('0x15')]}));}var _0x2bce16=path[_0x6c5c('0x1b')](PATH);var _0x3d48f4=path[_0x6c5c('0x1c')](PATH,_0x6c5c('0x1d'));var _0x47b142=_0xdf41bb[_0x6c5c('0xe')]&&_0x197586[_0x6c5c('0x18')]>0x1;var _0x2de33c=[];if(!fs[_0x6c5c('0x1e')](path[_0x6c5c('0x1f')](_0x2bce16,_0x3d48f4))&&_0x47b142){fs[_0x6c5c('0x20')](path[_0x6c5c('0x1f')](_0x2bce16,_0x3d48f4));}return BPromise[_0x6c5c('0x21')](_0x197586,function(_0x37fd9){_0x2de33c[_0x6c5c('0x22')](_0x37fd9);})[_0x6c5c('0x10')](function(){for(var _0x1846fe=0x0;_0x1846fe<_0x2de33c[_0x6c5c('0x18')];_0x1846fe+=0x1){var _0x2b62c5;var _0x2e9022=_0x2de33c[_0x1846fe];if(_0x47b142){_0x2b62c5=path[_0x6c5c('0x1f')](_0x2bce16,_0x3d48f4,util[_0x6c5c('0x11')](_0x6c5c('0x23'),_0x3d48f4,_0x1846fe,_0x6c5c('0x24')));}else{_0x2b62c5=path[_0x6c5c('0x1f')](_0x2bce16,util[_0x6c5c('0x11')]('%s.%s',_0x3d48f4,_0x6c5c('0x24')));}fs[_0x6c5c('0x25')](_0x2b62c5,json2xls(_0x2e9022),_0x6c5c('0x26'));}})['then'](function(){if(_0x47b142){zipdir(path[_0x6c5c('0x1f')](_0x2bce16,_0x3d48f4),{'saveTo':path['join'](_0x2bce16,util['format'](_0x6c5c('0x27'),_0x3d48f4,_0x6c5c('0x28')))},function(_0x4bcb62,_0x379433){});rimraf(path[_0x6c5c('0x1f')](_0x2bce16,_0x3d48f4),function(){});}})[_0x6c5c('0x10')](function(){logger[_0x6c5c('0xa')](util[_0x6c5c('0x11')](_0x6c5c('0x29'),EXTRACTED_REPORT_ID,_0x6c5c('0xb')));return analyticExtractedReport(_0x6c5c('0x2a'),_0x47b142?util[_0x6c5c('0x11')](_0x6c5c('0x27'),_0x3d48f4,_0x47b142?_0x6c5c('0x28'):_0x6c5c('0x24')):null);});})[_0x6c5c('0x2b')](function(_0x1b44fa){logger[_0x6c5c('0xa')](util[_0x6c5c('0x11')](_0x6c5c('0x2c'),EXTRACTED_REPORT_ID,_0x6c5c('0xb')),util[_0x6c5c('0x2d')](_0x1b44fa,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x6c5c('0x2e'));});}main(); \ No newline at end of file +var _0x0eee=['split','length','num','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','.xlsx','join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','splitSizeXlsx','then','sequelize','query','SELECT'];(function(_0x285d34,_0x42dd2d){var _0x59e21d=function(_0x386777){while(--_0x386777){_0x285d34['push'](_0x285d34['shift']());}};_0x59e21d(++_0x42dd2d);}(_0x0eee,0xb3));var _0xe0ee=function(_0x365be9,_0x3c88b9){_0x365be9=_0x365be9-0x0;var _0x185c12=_0x0eee[_0x365be9];return _0x185c12;};'use strict';var util=require(_0xe0ee('0x0'));var path=require(_0xe0ee('0x1'));var _=require(_0xe0ee('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xe0ee('0x3'));var zipdir=require(_0xe0ee('0x4'));var rimraf=require(_0xe0ee('0x5'));var db=require(_0xe0ee('0x6'))['db'];var dbH=require(_0xe0ee('0x6'))[_0xe0ee('0x7')];var logger=require(_0xe0ee('0x8'))(_0xe0ee('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xe0ee('0xa')][0x3];var PATH=process[_0xe0ee('0xa')][0x4];function analyticExtractedReport(_0xd491e2,_0x216704){var _0x5191e5={'status':_0xd491e2};var _0x538cf8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x216704){_0x5191e5['savename']=_0x216704;}return db['AnalyticExtractedReport'][_0xe0ee('0xb')](_0x5191e5,_0x538cf8);}function main(){var _0x41524d=0x1388;var _0x1f1cc7;logger[_0xe0ee('0xc')](util[_0xe0ee('0xd')](_0xe0ee('0xe'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting'][_0xe0ee('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xe0ee('0x10')]})[_0xe0ee('0x11')](function(_0x48085d){if(_0x48085d){_0x1f1cc7=_0x48085d;_0x41524d=_0x1f1cc7[_0xe0ee('0x10')]||0x1388;}})[_0xe0ee('0x11')](function(){return dbH[_0xe0ee('0x12')][_0xe0ee('0x13')](util[_0xe0ee('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xe0ee('0x12')]['QueryTypes'][_0xe0ee('0x14')]});})[_0xe0ee('0x11')](function(_0xdc082c){if(!_0xdc082c[0x0]['num']){return analyticExtractedReport('Empty');}var _0x32e0f5=[];var _0x480e8e=0x0;var _0x57f83d=!![];if(_0x1f1cc7[_0xe0ee('0x15')]){if(_0xdc082c&&_0xdc082c[_0xe0ee('0x16')]){var _0x5e46d8=_0xdc082c[0x0][_0xe0ee('0x17')]%(_0x480e8e+_0x41524d);for(;_0x57f83d;_0x480e8e+=_0x41524d,_0x5e46d8=_0xdc082c[0x0]['num']%(_0x480e8e+_0x41524d)){if(_0x5e46d8==0x0||_0x5e46d8==_0xdc082c[0x0][_0xe0ee('0x17')]){_0x57f83d=![];}_0x32e0f5['push'](dbH[_0xe0ee('0x12')][_0xe0ee('0x13')](util[_0xe0ee('0xd')](_0xe0ee('0x18'),QUERY,_0x41524d,_0x480e8e),{'type':dbH[_0xe0ee('0x12')]['QueryTypes']['SELECT']}));}}}else{_0x32e0f5[_0xe0ee('0x19')](dbH[_0xe0ee('0x12')][_0xe0ee('0x13')](QUERY,{'type':dbH[_0xe0ee('0x12')]['QueryTypes'][_0xe0ee('0x14')]}));}var _0x5955cd=path[_0xe0ee('0x1a')](PATH);var _0x6f58f4=path['basename'](PATH,_0xe0ee('0x1b'));var _0xc54218=_0x1f1cc7['split']&&_0x32e0f5['length']>0x1;var _0x493429=[];if(!fs['existsSync'](path[_0xe0ee('0x1c')](_0x5955cd,_0x6f58f4))&&_0xc54218){fs[_0xe0ee('0x1d')](path[_0xe0ee('0x1c')](_0x5955cd,_0x6f58f4));}return BPromise[_0xe0ee('0x1e')](_0x32e0f5,function(_0x1a762c){_0x493429[_0xe0ee('0x19')](_0x1a762c);})['then'](function(){for(var _0x312e99=0x0;_0x312e99<_0x493429['length'];_0x312e99+=0x1){var _0x31d8eb;var _0x5b942d=_0x493429[_0x312e99];if(_0xc54218){_0x31d8eb=path['join'](_0x5955cd,_0x6f58f4,util[_0xe0ee('0xd')](_0xe0ee('0x1f'),_0x6f58f4,_0x312e99,_0xe0ee('0x20')));}else{_0x31d8eb=path[_0xe0ee('0x1c')](_0x5955cd,util[_0xe0ee('0xd')]('%s.%s',_0x6f58f4,'xlsx'));}fs[_0xe0ee('0x21')](_0x31d8eb,json2xls(_0x5b942d),_0xe0ee('0x22'));}})['then'](function(){if(_0xc54218){zipdir(path[_0xe0ee('0x1c')](_0x5955cd,_0x6f58f4),{'saveTo':path[_0xe0ee('0x1c')](_0x5955cd,util[_0xe0ee('0xd')](_0xe0ee('0x23'),_0x6f58f4,'zip'))},function(_0x53b338,_0x1f7d3f){});rimraf(path[_0xe0ee('0x1c')](_0x5955cd,_0x6f58f4),function(){});}})[_0xe0ee('0x11')](function(){logger['info'](util[_0xe0ee('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport('Completed',_0xc54218?util[_0xe0ee('0xd')](_0xe0ee('0x23'),_0x6f58f4,_0xc54218?_0xe0ee('0x24'):'xlsx'):null);});})[_0xe0ee('0x25')](function(_0x44da99){logger[_0xe0ee('0xc')](util[_0xe0ee('0xd')](_0xe0ee('0x26'),EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x44da99,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xe0ee('0x27'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 9efc21c..b1733c7 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 _0xd030=['recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','IntervalId','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','Hangup','transaction','destroy','bulkCreate','catch','error','util','models','Interval','findAll','then','intervals','VoiceExtension','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','playback','hasOwnProperty','priority','extension','find','extensions','type','Set','format','context','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN}','push','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:'];(function(_0x105896,_0x2b1b8e){var _0x397ad0=function(_0xa176ec){while(--_0xa176ec){_0x105896['push'](_0x105896['shift']());}};_0x397ad0(++_0x2b1b8e);}(_0xd030,0x16c));var _0x0d03=function(_0x5e495f,_0x21fd3e){_0x5e495f=_0x5e495f-0x0;var _0x3e2d26=_0xd030[_0x5e495f];return _0x3e2d26;};'use strict';var _=require('lodash');var util=require(_0x0d03('0x0'));function rewrite(_0x575392,_0x3407ef){var _0x16403d=this;return _0x575392[_0x0d03('0x1')][_0x0d03('0x2')][_0x0d03('0x3')]({'raw':!![]})[_0x0d03('0x4')](function(_0x2aba51){_0x16403d[_0x0d03('0x5')]=_0x2aba51;return _0x575392['models'][_0x0d03('0x6')][_0x0d03('0x3')]({'where':{'IntervalId':_0x3407ef['IntervalId']},'raw':!![]});})[_0x0d03('0x4')](function(_0x522f3c){return _0x575392[_0x0d03('0x1')][_0x0d03('0x6')][_0x0d03('0x3')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x522f3c,'exten'))}},'order':[{'raw':_0x0d03('0x7')}],'raw':!![]});})[_0x0d03('0x4')](function(_0x290817){var _0x20fdb3=_[_0x0d03('0x8')](_0x290817,{'priority':'1'});var _0x1ddd6f=_[_0x0d03('0x8')](_0x290817,{'isApp':0x1});var _0x370096=_[_0x0d03('0x9')](_0x1ddd6f,_0x0d03('0xa'));var _0x59adf5=[_0x0d03('0xb'),_0x0d03('0xc')];var _0x298b00=[];var _0x485370=[];for(var _0x292863 in _0x370096){if(_0x370096[_0x0d03('0xd')](_0x292863)){_0x16403d[_0x0d03('0xe')]=0x2;_0x16403d['extensions']=[];_0x16403d[_0x0d03('0xf')]=_[_0x0d03('0x10')](_0x20fdb3,{'exten':_0x370096[_0x292863][0x0][_0x0d03('0xa')]});_0x16403d[_0x0d03('0x11')]['push']({'type':_0x370096[_0x292863][0x0][_0x0d03('0x12')],'app':_0x0d03('0x13'),'appdata':util[_0x0d03('0x14')]('CDR(type)=%s',_0x370096[_0x292863][0x0][_0x0d03('0x12')]),'context':_0x370096[_0x292863][0x0][_0x0d03('0x15')],'exten':_0x370096[_0x292863][0x0][_0x0d03('0xa')],'priority':_0x16403d[_0x0d03('0xe')]++,'VoiceExtensionId':_0x370096[_0x292863][0x0][_0x0d03('0x16')]});if(_0x370096[_0x292863][0x0][_0x0d03('0x12')]===_0x0d03('0x17')){if(_0x16403d[_0x0d03('0xf')]){_0x16403d[_0x0d03('0x11')]['push']({'type':_0x370096[_0x292863][0x0][_0x0d03('0x12')],'app':_0x0d03('0x13'),'appdata':_0x0d03('0x18')+(_0x16403d['extension'][_0x0d03('0x19')]?'${EXTEN:'+_0x16403d[_0x0d03('0xf')][_0x0d03('0x19')]+'}':_0x0d03('0x1a')),'context':_0x370096[_0x292863][0x0][_0x0d03('0x15')],'exten':_0x370096[_0x292863][0x0][_0x0d03('0xa')],'priority':_0x16403d[_0x0d03('0xe')]++,'VoiceExtensionId':_0x370096[_0x292863][0x0][_0x0d03('0x16')]});}_0x16403d[_0x0d03('0x11')][_0x0d03('0x1b')]({'type':_0x370096[_0x292863][0x0][_0x0d03('0x12')],'app':'Set','appdata':_0x0d03('0x1c')+_0x370096[_0x292863][0x0]['VoiceExtensionId'],'context':_0x370096[_0x292863][0x0][_0x0d03('0x15')],'exten':_0x370096[_0x292863][0x0]['exten'],'priority':_0x16403d[_0x0d03('0xe')]++,'VoiceExtensionId':_0x370096[_0x292863][0x0]['VoiceExtensionId']});var _0x507ef7=_0x16403d[_0x0d03('0xe')]++;_0x16403d['extensions'][_0x0d03('0x1b')]({'type':_0x370096[_0x292863][0x0][_0x0d03('0x12')],'app':'ExecIf','appdata':_0x0d03('0x1d')+(_0x507ef7+0x2)+_0x0d03('0x1e')+(_0x507ef7+0x1)+')','context':_0x370096[_0x292863][0x0]['context'],'exten':_0x370096[_0x292863][0x0][_0x0d03('0xa')],'priority':_0x507ef7,'VoiceExtensionId':_0x370096[_0x292863][0x0][_0x0d03('0x16')]});if(_0x16403d[_0x0d03('0xf')]){_0x16403d[_0x0d03('0x11')][_0x0d03('0x1b')]({'type':_0x370096[_0x292863][0x0][_0x0d03('0x12')],'app':'Set','appdata':_0x16403d[_0x0d03('0xf')][_0x0d03('0x19')]?_0x0d03('0x1f')+_0x16403d[_0x0d03('0xf')][_0x0d03('0x19')]+'}':'CDR(prefix)=noprefix','context':_0x370096[_0x292863][0x0]['context'],'exten':_0x370096[_0x292863][0x0]['exten'],'priority':_0x16403d[_0x0d03('0xe')]++,'VoiceExtensionId':_0x370096[_0x292863][0x0][_0x0d03('0x16')]});}_0x16403d[_0x0d03('0x11')][_0x0d03('0x1b')]({'type':_0x370096[_0x292863][0x0]['type'],'app':_0x0d03('0x13'),'appdata':'outboundrouteid='+_0x370096[_0x292863][0x0][_0x0d03('0x16')],'context':_0x370096[_0x292863][0x0][_0x0d03('0x15')],'exten':_0x370096[_0x292863][0x0]['exten'],'priority':_0x16403d[_0x0d03('0xe')]++,'VoiceExtensionId':_0x370096[_0x292863][0x0][_0x0d03('0x16')]});if(_0x16403d['extension']&&_0x16403d['extension'][_0x0d03('0xd')](_0x0d03('0x20'))&&_0x16403d[_0x0d03('0xf')]['recordingFormat']!=='none'){_0x16403d[_0x0d03('0x11')][_0x0d03('0x1b')]({'type':_0x370096[_0x292863][0x0]['type'],'app':'Set','appdata':_0x0d03('0x21'),'context':_0x370096[_0x292863][0x0][_0x0d03('0x15')],'exten':_0x370096[_0x292863][0x0][_0x0d03('0xa')],'priority':_0x16403d[_0x0d03('0xe')]++,'VoiceExtensionId':_0x370096[_0x292863][0x0]['VoiceExtensionId']});_0x16403d[_0x0d03('0x11')][_0x0d03('0x1b')]({'type':_0x370096[_0x292863][0x0]['type'],'app':_0x0d03('0x13'),'appdata':_0x0d03('0x22')+_0x16403d[_0x0d03('0xf')][_0x0d03('0x20')]||_0x0d03('0x23'),'context':_0x370096[_0x292863][0x0][_0x0d03('0x15')],'exten':_0x370096[_0x292863][0x0][_0x0d03('0xa')],'priority':_0x16403d['priority']++,'VoiceExtensionId':_0x370096[_0x292863][0x0][_0x0d03('0x16')]});}}_0x16403d[_0x0d03('0x11')][_0x0d03('0x1b')]({'type':_0x370096[_0x292863][0x0][_0x0d03('0x12')],'app':_0x0d03('0x13'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x370096[_0x292863][0x0][_0x0d03('0x15')],'exten':_0x370096[_0x292863][0x0]['exten'],'priority':_0x16403d['priority']++,'VoiceExtensionId':_0x370096[_0x292863][0x0]['VoiceExtensionId']});_0x16403d[_0x0d03('0x11')]['push']({'type':_0x370096[_0x292863][0x0][_0x0d03('0x12')],'app':'Set','appdata':_0x0d03('0x24'),'context':_0x370096[_0x292863][0x0][_0x0d03('0x15')],'exten':_0x370096[_0x292863][0x0]['exten'],'priority':_0x16403d[_0x0d03('0xe')]++,'VoiceExtensionId':_0x370096[_0x292863][0x0]['VoiceExtensionId']});_0x16403d[_0x0d03('0x11')][_0x0d03('0x1b')]({'type':_0x370096[_0x292863][0x0]['type'],'app':_0x0d03('0x13'),'appdata':_0x0d03('0x25'),'context':_0x370096[_0x292863][0x0][_0x0d03('0x15')],'exten':_0x370096[_0x292863][0x0][_0x0d03('0xa')],'priority':_0x16403d[_0x0d03('0xe')]++,'VoiceExtensionId':_0x370096[_0x292863][0x0][_0x0d03('0x16')]});for(var _0x5eae8e=0x0,_0xe38f06=0x0;_0x5eae8e<_0x370096[_0x292863][_0x0d03('0x26')];_0x5eae8e+=0x1,_0xe38f06=0x0){var _0x44407e=_0x370096[_0x292863][_0x5eae8e];if(_0x44407e[_0x0d03('0x12')]){_0x44407e[_0x0d03('0x12')]=_0x44407e[_0x0d03('0x12')][_0x0d03('0x27')]();}var _0x47dc85=[];var _0x33be48=[];delete _0x44407e['id'];delete _0x44407e[_0x0d03('0x28')];delete _0x44407e[_0x0d03('0x29')];var _0x2806eb=_0x44407e['interval']!=='*,*,*,*'?[_0x44407e[_0x0d03('0x2a')]]:_0x44407e[_0x0d03('0x2b')]?_['map'](_[_0x0d03('0x8')](_0x16403d[_0x0d03('0x5')],{'IntervalId':_0x44407e[_0x0d03('0x2b')]}),_0x0d03('0x2a')):[];if(_0x44407e[_0x0d03('0xd')](_0x0d03('0x2c'))){if(_0x44407e[_0x0d03('0x2c')]&&_0x44407e[_0x0d03('0x2c')]!=='--'){_0x47dc85[_0x0d03('0x1b')]({'type':_0x44407e[_0x0d03('0x12')],'app':_0x0d03('0x13'),'appdata':_0x0d03('0x2d')+_0x44407e[_0x0d03('0x2c')],'context':_0x44407e[_0x0d03('0x15')],'exten':_0x44407e[_0x0d03('0xa')],'priority':_0x2806eb[_0x0d03('0x26')]+_0x16403d['priority']+_0xe38f06++,'VoiceExtensionId':_0x44407e[_0x0d03('0x16')]});}}if(_0x44407e[_0x0d03('0x12')]===_0x0d03('0x17')&&_0x44407e['hasOwnProperty']('callerID')){if(_0x44407e[_0x0d03('0x2e')]){_0x47dc85[_0x0d03('0x1b')]({'type':_0x44407e[_0x0d03('0x12')],'app':'ExecIf','appdata':_0x0d03('0x2f')+_0x44407e[_0x0d03('0x2e')]+')','context':_0x44407e[_0x0d03('0x15')],'exten':_0x44407e[_0x0d03('0xa')],'priority':_0x2806eb[_0x0d03('0x26')]+_0x16403d[_0x0d03('0xe')]+_0xe38f06++,'VoiceExtensionId':_0x44407e[_0x0d03('0x16')]});}else{_0x47dc85[_0x0d03('0x1b')]({'type':_0x44407e[_0x0d03('0x12')],'app':_0x0d03('0x30'),'appdata':_0x0d03('0x31'),'context':_0x44407e[_0x0d03('0x15')],'exten':_0x44407e['exten'],'priority':_0x2806eb[_0x0d03('0x26')]+_0x16403d[_0x0d03('0xe')]+_0xe38f06++,'VoiceExtensionId':_0x44407e[_0x0d03('0x16')]});}}if(_0x44407e[_0x0d03('0xd')]('answer')){if(_0x59adf5[_0x0d03('0x32')](_0x44407e['app'][_0x0d03('0x27')]())>=0x0&&_0x44407e[_0x0d03('0x33')]!==_0x0d03('0x34')){if(_0x44407e['answer']){_0x47dc85[_0x0d03('0x1b')]({'type':_0x44407e['type'],'app':_0x0d03('0x30'),'appdata':_0x0d03('0x35'),'context':_0x44407e['context'],'exten':_0x44407e[_0x0d03('0xa')],'priority':_0x2806eb[_0x0d03('0x26')]+_0x16403d[_0x0d03('0xe')]+_0xe38f06++,'VoiceExtensionId':_0x44407e[_0x0d03('0x16')]});_0x47dc85['push']({'type':_0x44407e[_0x0d03('0x12')],'app':_0x0d03('0x13'),'appdata':_0x0d03('0x36'),'context':_0x44407e[_0x0d03('0x15')],'exten':_0x44407e[_0x0d03('0xa')],'priority':_0x2806eb['length']+_0x16403d[_0x0d03('0xe')]+_0xe38f06++,'VoiceExtensionId':_0x44407e[_0x0d03('0x16')]});}else{_0x47dc85[_0x0d03('0x1b')]({'type':_0x44407e['type'],'app':_0x0d03('0x30'),'appdata':_0x0d03('0x37'),'context':_0x44407e[_0x0d03('0x15')],'exten':_0x44407e['exten'],'priority':_0x2806eb[_0x0d03('0x26')]+_0x16403d[_0x0d03('0xe')]+_0xe38f06++,'VoiceExtensionId':_0x44407e[_0x0d03('0x16')]});_0x47dc85[_0x0d03('0x1b')]({'type':_0x44407e[_0x0d03('0x12')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x44407e[_0x0d03('0x15')],'exten':_0x44407e[_0x0d03('0xa')],'priority':_0x2806eb['length']+_0x16403d['priority']+_0xe38f06++,'VoiceExtensionId':_0x44407e[_0x0d03('0x16')]});}}}for(var _0x3d78a5=0x0;_0x3d78a5<_0x2806eb[_0x0d03('0x26')];_0x3d78a5+=0x1){var _0x238a1c=_0x16403d[_0x0d03('0xe')]+_0x2806eb[_0x0d03('0x26')];var _0x35c4f4=_0x3d78a5===_0x2806eb[_0x0d03('0x26')]-0x1?_0x16403d[_0x0d03('0xe')]+_0x47dc85[_0x0d03('0x26')]+_0x33be48[_0x0d03('0x26')]+0x2:_0x16403d[_0x0d03('0xe')]+_0x3d78a5+0x1;_0x47dc85[_0x0d03('0x38')](_0x3d78a5,0x0,{'type':_0x44407e[_0x0d03('0x12')],'app':_0x0d03('0x39'),'appdata':_0x2806eb[_0x3d78a5]+'?'+_0x44407e['context']+_0x0d03('0x3a')+_0x238a1c+':'+_0x44407e[_0x0d03('0x15')]+_0x0d03('0x3a')+_0x35c4f4,'exten':_0x44407e[_0x0d03('0xa')],'context':_0x44407e[_0x0d03('0x15')],'priority':_0x16403d['priority']+_0x3d78a5,'VoiceExtensionId':_0x370096[_0x292863][0x0]['VoiceExtensionId']});}_0x44407e['priority']=_0x47dc85[_0x0d03('0x26')]?_[_0x0d03('0x3b')](_0x47dc85)[_0x0d03('0xe')]+0x1:_0x16403d[_0x0d03('0xe')];_0x16403d[_0x0d03('0xe')]=(_0x33be48[_0x0d03('0x26')]?_['last'](_0x33be48)[_0x0d03('0xe')]:_0x44407e[_0x0d03('0xe')])+0x1;_0x16403d[_0x0d03('0x11')]=_['concat'](_0x16403d['extensions'],_0x47dc85,[_0x44407e],_0x33be48);}_0x16403d[_0x0d03('0x11')]['push']({'type':_0x370096[_0x292863][0x0][_0x0d03('0x12')],'app':_0x0d03('0x3c'),'exten':_0x370096[_0x292863][0x0][_0x0d03('0xa')],'context':_0x370096[_0x292863][0x0][_0x0d03('0x15')],'priority':_0x16403d['priority'],'VoiceExtensionId':_0x370096[_0x292863][0x0][_0x0d03('0x16')]});_0x298b00[_0x0d03('0x1b')](_0x370096[_0x292863][0x0]['VoiceExtensionId']);_0x485370=_['concat'](_0x485370,_0x16403d[_0x0d03('0x11')]);}}return _0x575392[_0x0d03('0x3d')](function(_0xd51a3a){return _0x575392[_0x0d03('0x1')][_0x0d03('0x6')][_0x0d03('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x298b00}},'transaction':_0xd51a3a})[_0x0d03('0x4')](function(_0x4f0bb9){return _0x575392['models'][_0x0d03('0x6')][_0x0d03('0x3f')](_['sortBy'](_0x485370,_0x0d03('0xe')),{'transaction':_0xd51a3a});});});})[_0x0d03('0x40')](function(_0x5d5821){console[_0x0d03('0x41')](_0x5d5821);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0xd561=['IntervalId','uniq','exten','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','format','CDR(type)=%s','type','context','outbound','Set','CDR(destination)=','cutdigits','VoiceExtensionId','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','Hangup','transaction','destroy','VoiceExtension','sortBy','catch','error','Interval','findAll','then','intervals','models'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd561,0xc7));var _0x1d56=function(_0x58d689,_0x27e9a3){_0x58d689=_0x58d689-0x0;var _0x226c77=_0xd561[_0x58d689];return _0x226c77;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x4dd77f,_0x5cf740){var _0x2aad12=this;return _0x4dd77f['models'][_0x1d56('0x0')][_0x1d56('0x1')]({'raw':!![]})[_0x1d56('0x2')](function(_0x58dce5){_0x2aad12[_0x1d56('0x3')]=_0x58dce5;return _0x4dd77f[_0x1d56('0x4')]['VoiceExtension'][_0x1d56('0x1')]({'where':{'IntervalId':_0x5cf740[_0x1d56('0x5')]},'raw':!![]});})[_0x1d56('0x2')](function(_0xafe63c){return _0x4dd77f[_0x1d56('0x4')]['VoiceExtension'][_0x1d56('0x1')]({'where':{'exten':{'$in':_[_0x1d56('0x6')](_['map'](_0xafe63c,_0x1d56('0x7')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x1d56('0x2')](function(_0x516e7c){var _0x24a9aa=_[_0x1d56('0x8')](_0x516e7c,{'priority':'1'});var _0x177533=_['filter'](_0x516e7c,{'isApp':0x1});var _0xa68806=_[_0x1d56('0x9')](_0x177533,_0x1d56('0x7'));var _0x11c5b7=[_0x1d56('0xa'),_0x1d56('0xb')];var _0x226616=[];var _0x392d92=[];for(var _0x1c4f87 in _0xa68806){if(_0xa68806[_0x1d56('0xc')](_0x1c4f87)){_0x2aad12[_0x1d56('0xd')]=0x2;_0x2aad12[_0x1d56('0xe')]=[];_0x2aad12[_0x1d56('0xf')]=_[_0x1d56('0x10')](_0x24a9aa,{'exten':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x7')]});_0x2aad12['extensions'][_0x1d56('0x11')]({'type':_0xa68806[_0x1c4f87][0x0]['type'],'app':'Set','appdata':util[_0x1d56('0x12')](_0x1d56('0x13'),_0xa68806[_0x1c4f87][0x0][_0x1d56('0x14')]),'context':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x15')],'exten':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x7')],'priority':_0x2aad12[_0x1d56('0xd')]++,'VoiceExtensionId':_0xa68806[_0x1c4f87][0x0]['VoiceExtensionId']});if(_0xa68806[_0x1c4f87][0x0][_0x1d56('0x14')]===_0x1d56('0x16')){if(_0x2aad12[_0x1d56('0xf')]){_0x2aad12['extensions'][_0x1d56('0x11')]({'type':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x14')],'app':_0x1d56('0x17'),'appdata':_0x1d56('0x18')+(_0x2aad12[_0x1d56('0xf')][_0x1d56('0x19')]?'${EXTEN:'+_0x2aad12[_0x1d56('0xf')][_0x1d56('0x19')]+'}':'${EXTEN}'),'context':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x15')],'exten':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x7')],'priority':_0x2aad12[_0x1d56('0xd')]++,'VoiceExtensionId':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x1a')]});}_0x2aad12['extensions'][_0x1d56('0x11')]({'type':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x14')],'app':_0x1d56('0x17'),'appdata':_0x1d56('0x1b')+_0xa68806[_0x1c4f87][0x0]['VoiceExtensionId'],'context':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x15')],'exten':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x7')],'priority':_0x2aad12[_0x1d56('0xd')]++,'VoiceExtensionId':_0xa68806[_0x1c4f87][0x0]['VoiceExtensionId']});var _0x17b1d0=_0x2aad12[_0x1d56('0xd')]++;_0x2aad12[_0x1d56('0xe')][_0x1d56('0x11')]({'type':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x14')],'app':_0x1d56('0x1c'),'appdata':_0x1d56('0x1d')+(_0x17b1d0+0x2)+_0x1d56('0x1e')+(_0x17b1d0+0x1)+')','context':_0xa68806[_0x1c4f87][0x0]['context'],'exten':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x7')],'priority':_0x17b1d0,'VoiceExtensionId':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x1a')]});if(_0x2aad12[_0x1d56('0xf')]){_0x2aad12['extensions'][_0x1d56('0x11')]({'type':_0xa68806[_0x1c4f87][0x0]['type'],'app':_0x1d56('0x17'),'appdata':_0x2aad12[_0x1d56('0xf')]['cutdigits']?_0x1d56('0x1f')+_0x2aad12[_0x1d56('0xf')][_0x1d56('0x19')]+'}':'CDR(prefix)=noprefix','context':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x15')],'exten':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x7')],'priority':_0x2aad12[_0x1d56('0xd')]++,'VoiceExtensionId':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x1a')]});}_0x2aad12[_0x1d56('0xe')][_0x1d56('0x11')]({'type':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x14')],'app':_0x1d56('0x17'),'appdata':_0x1d56('0x20')+_0xa68806[_0x1c4f87][0x0][_0x1d56('0x1a')],'context':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x15')],'exten':_0xa68806[_0x1c4f87][0x0]['exten'],'priority':_0x2aad12[_0x1d56('0xd')]++,'VoiceExtensionId':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x1a')]});if(_0x2aad12[_0x1d56('0xf')]&&_0x2aad12[_0x1d56('0xf')][_0x1d56('0xc')](_0x1d56('0x21'))&&_0x2aad12['extension'][_0x1d56('0x21')]!=='none'){_0x2aad12['extensions'][_0x1d56('0x11')]({'type':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x14')],'app':_0x1d56('0x17'),'appdata':_0x1d56('0x22'),'context':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x15')],'exten':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x7')],'priority':_0x2aad12[_0x1d56('0xd')]++,'VoiceExtensionId':_0xa68806[_0x1c4f87][0x0]['VoiceExtensionId']});_0x2aad12[_0x1d56('0xe')][_0x1d56('0x11')]({'type':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x14')],'app':_0x1d56('0x17'),'appdata':_0x1d56('0x23')+_0x2aad12[_0x1d56('0xf')][_0x1d56('0x21')]||_0x1d56('0x24'),'context':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x15')],'exten':_0xa68806[_0x1c4f87][0x0]['exten'],'priority':_0x2aad12[_0x1d56('0xd')]++,'VoiceExtensionId':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x1a')]});}}_0x2aad12['extensions']['push']({'type':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x14')],'app':_0x1d56('0x17'),'appdata':_0x1d56('0x25'),'context':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x15')],'exten':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x7')],'priority':_0x2aad12[_0x1d56('0xd')]++,'VoiceExtensionId':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x1a')]});_0x2aad12[_0x1d56('0xe')][_0x1d56('0x11')]({'type':_0xa68806[_0x1c4f87][0x0]['type'],'app':_0x1d56('0x17'),'appdata':_0x1d56('0x26'),'context':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x15')],'exten':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x7')],'priority':_0x2aad12['priority']++,'VoiceExtensionId':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x1a')]});_0x2aad12[_0x1d56('0xe')][_0x1d56('0x11')]({'type':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x14')],'app':_0x1d56('0x17'),'appdata':_0x1d56('0x27'),'context':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x15')],'exten':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x7')],'priority':_0x2aad12[_0x1d56('0xd')]++,'VoiceExtensionId':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x1a')]});for(var _0x41336f=0x0,_0x2a0a09=0x0;_0x41336f<_0xa68806[_0x1c4f87][_0x1d56('0x28')];_0x41336f+=0x1,_0x2a0a09=0x0){var _0x4031ff=_0xa68806[_0x1c4f87][_0x41336f];if(_0x4031ff[_0x1d56('0x14')]){_0x4031ff[_0x1d56('0x14')]=_0x4031ff['type'][_0x1d56('0x29')]();}var _0x394008=[];var _0x15c734=[];delete _0x4031ff['id'];delete _0x4031ff[_0x1d56('0x2a')];delete _0x4031ff[_0x1d56('0x2b')];var _0x53b0d3=_0x4031ff[_0x1d56('0x2c')]!==_0x1d56('0x2d')?[_0x4031ff[_0x1d56('0x2c')]]:_0x4031ff[_0x1d56('0x5')]?_['map'](_['filter'](_0x2aad12['intervals'],{'IntervalId':_0x4031ff['IntervalId']}),_0x1d56('0x2c')):[];if(_0x4031ff['hasOwnProperty'](_0x1d56('0x2e'))){if(_0x4031ff[_0x1d56('0x2e')]&&_0x4031ff[_0x1d56('0x2e')]!=='--'){_0x394008[_0x1d56('0x11')]({'type':_0x4031ff[_0x1d56('0x14')],'app':'Set','appdata':_0x1d56('0x2f')+_0x4031ff['tag'],'context':_0x4031ff[_0x1d56('0x15')],'exten':_0x4031ff[_0x1d56('0x7')],'priority':_0x53b0d3[_0x1d56('0x28')]+_0x2aad12[_0x1d56('0xd')]+_0x2a0a09++,'VoiceExtensionId':_0x4031ff['VoiceExtensionId']});}}if(_0x4031ff['type']===_0x1d56('0x16')&&_0x4031ff['hasOwnProperty'](_0x1d56('0x30'))){if(_0x4031ff['callerID']){_0x394008[_0x1d56('0x11')]({'type':_0x4031ff[_0x1d56('0x14')],'app':_0x1d56('0x1c'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x4031ff[_0x1d56('0x30')]+')','context':_0x4031ff[_0x1d56('0x15')],'exten':_0x4031ff[_0x1d56('0x7')],'priority':_0x53b0d3[_0x1d56('0x28')]+_0x2aad12[_0x1d56('0xd')]+_0x2a0a09++,'VoiceExtensionId':_0x4031ff[_0x1d56('0x1a')]});}else{_0x394008[_0x1d56('0x11')]({'type':_0x4031ff['type'],'app':_0x1d56('0x1c'),'appdata':_0x1d56('0x31'),'context':_0x4031ff[_0x1d56('0x15')],'exten':_0x4031ff['exten'],'priority':_0x53b0d3['length']+_0x2aad12['priority']+_0x2a0a09++,'VoiceExtensionId':_0x4031ff[_0x1d56('0x1a')]});}}if(_0x4031ff[_0x1d56('0xc')](_0x1d56('0x32'))){if(_0x11c5b7['indexOf'](_0x4031ff[_0x1d56('0x33')][_0x1d56('0x29')]())>=0x0&&_0x4031ff[_0x1d56('0x34')]!==_0x1d56('0x35')){if(_0x4031ff[_0x1d56('0x32')]){_0x394008[_0x1d56('0x11')]({'type':_0x4031ff[_0x1d56('0x14')],'app':_0x1d56('0x1c'),'appdata':_0x1d56('0x36'),'context':_0x4031ff[_0x1d56('0x15')],'exten':_0x4031ff[_0x1d56('0x7')],'priority':_0x53b0d3[_0x1d56('0x28')]+_0x2aad12['priority']+_0x2a0a09++,'VoiceExtensionId':_0x4031ff[_0x1d56('0x1a')]});_0x394008['push']({'type':_0x4031ff[_0x1d56('0x14')],'app':_0x1d56('0x17'),'appdata':_0x1d56('0x37'),'context':_0x4031ff[_0x1d56('0x15')],'exten':_0x4031ff[_0x1d56('0x7')],'priority':_0x53b0d3[_0x1d56('0x28')]+_0x2aad12['priority']+_0x2a0a09++,'VoiceExtensionId':_0x4031ff['VoiceExtensionId']});}else{_0x394008[_0x1d56('0x11')]({'type':_0x4031ff[_0x1d56('0x14')],'app':_0x1d56('0x1c'),'appdata':_0x1d56('0x38'),'context':_0x4031ff[_0x1d56('0x15')],'exten':_0x4031ff[_0x1d56('0x7')],'priority':_0x53b0d3[_0x1d56('0x28')]+_0x2aad12[_0x1d56('0xd')]+_0x2a0a09++,'VoiceExtensionId':_0x4031ff[_0x1d56('0x1a')]});_0x394008['push']({'type':_0x4031ff[_0x1d56('0x14')],'app':'Set','appdata':_0x1d56('0x39'),'context':_0x4031ff[_0x1d56('0x15')],'exten':_0x4031ff[_0x1d56('0x7')],'priority':_0x53b0d3[_0x1d56('0x28')]+_0x2aad12[_0x1d56('0xd')]+_0x2a0a09++,'VoiceExtensionId':_0x4031ff['VoiceExtensionId']});}}}for(var _0xe78ce1=0x0;_0xe78ce1<_0x53b0d3[_0x1d56('0x28')];_0xe78ce1+=0x1){var _0x3a2ad8=_0x2aad12[_0x1d56('0xd')]+_0x53b0d3[_0x1d56('0x28')];var _0x303959=_0xe78ce1===_0x53b0d3[_0x1d56('0x28')]-0x1?_0x2aad12[_0x1d56('0xd')]+_0x394008['length']+_0x15c734['length']+0x2:_0x2aad12[_0x1d56('0xd')]+_0xe78ce1+0x1;_0x394008['splice'](_0xe78ce1,0x0,{'type':_0x4031ff[_0x1d56('0x14')],'app':'GotoIfTime','appdata':_0x53b0d3[_0xe78ce1]+'?'+_0x4031ff[_0x1d56('0x15')]+_0x1d56('0x3a')+_0x3a2ad8+':'+_0x4031ff[_0x1d56('0x15')]+_0x1d56('0x3a')+_0x303959,'exten':_0x4031ff['exten'],'context':_0x4031ff['context'],'priority':_0x2aad12['priority']+_0xe78ce1,'VoiceExtensionId':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x1a')]});}_0x4031ff[_0x1d56('0xd')]=_0x394008[_0x1d56('0x28')]?_[_0x1d56('0x3b')](_0x394008)[_0x1d56('0xd')]+0x1:_0x2aad12[_0x1d56('0xd')];_0x2aad12[_0x1d56('0xd')]=(_0x15c734['length']?_[_0x1d56('0x3b')](_0x15c734)[_0x1d56('0xd')]:_0x4031ff['priority'])+0x1;_0x2aad12[_0x1d56('0xe')]=_[_0x1d56('0x3c')](_0x2aad12[_0x1d56('0xe')],_0x394008,[_0x4031ff],_0x15c734);}_0x2aad12[_0x1d56('0xe')][_0x1d56('0x11')]({'type':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x14')],'app':_0x1d56('0x3d'),'exten':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x7')],'context':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x15')],'priority':_0x2aad12[_0x1d56('0xd')],'VoiceExtensionId':_0xa68806[_0x1c4f87][0x0][_0x1d56('0x1a')]});_0x226616[_0x1d56('0x11')](_0xa68806[_0x1c4f87][0x0]['VoiceExtensionId']);_0x392d92=_[_0x1d56('0x3c')](_0x392d92,_0x2aad12[_0x1d56('0xe')]);}}return _0x4dd77f[_0x1d56('0x3e')](function(_0x2ba066){return _0x4dd77f[_0x1d56('0x4')]['VoiceExtension'][_0x1d56('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x226616}},'transaction':_0x2ba066})[_0x1d56('0x2')](function(_0x1840bd){return _0x4dd77f['models'][_0x1d56('0x40')]['bulkCreate'](_[_0x1d56('0x41')](_0x392d92,'priority'),{'transaction':_0x2ba066});});});})[_0x1d56('0x42')](function(_0x245540){console[_0x1d56('0x43')](_0x245540);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index d4a6bcf..9543c56 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','fromQuery','phone','scheduledAt','updatedAt','field','NOW()','ContactId','toString','createdAt','from','ListId\x20=\x20?','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','\x20=\x20?','into','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','cm_contacts','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','sequelize','query','VoiceQueueId','onlyIfOpen','push','all','CmList','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x3071('0x0'));var fs=require('fs');var squel=require(_0x3071('0x1'));var Papa=require(_0x3071('0x2'));var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));config[_0x3071('0x7')]=_[_0x3071('0x8')](config[_0x3071('0x7')],{'host':_0x3071('0x9'),'port':0x18eb});var socket=require(_0x3071('0xa'))(new Redis(config[_0x3071('0x7')]));require(_0x3071('0xb'))[_0x3071('0xc')](socket);try{if(!process[_0x3071('0xd')][0x2]||process[_0x3071('0xd')][0x2]===_0x3071('0xe')||process['argv'][0x2]===_0x3071('0xf')){throw new Error(_0x3071('0x10'));}var FILEPATH=process[_0x3071('0xd')][0x2];if(!process[_0x3071('0xd')][0x3]||process[_0x3071('0xd')][0x3]==='undefined'||process[_0x3071('0xd')][0x3]===_0x3071('0xf')||!process[_0x3071('0xd')][0x4]||process[_0x3071('0xd')][0x4]===_0x3071('0xe')||process['argv'][0x4]==='null'){throw new Error(_0x3071('0x11'));}var FIELDS=_['zipObject'](process[_0x3071('0xd')][0x3][_0x3071('0x12')](','),process['argv'][0x4][_0x3071('0x12')](','));if(!process['argv'][0x5]||process[_0x3071('0xd')][0x5]===_0x3071('0xe')||process[_0x3071('0xd')][0x5]===_0x3071('0xf')){throw new Error(_0x3071('0x13'));}var LISTID=process[_0x3071('0xd')][0x5];var COMPANYID=process[_0x3071('0xd')][0x6]&&process[_0x3071('0xd')][0x6]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x6]!=='null'?process[_0x3071('0xd')][0x6]:null;var DUPLICATES=process[_0x3071('0xd')][0x7]&&process[_0x3071('0xd')][0x7]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x7]!==_0x3071('0xf')?process[_0x3071('0xd')][0x7]:null;if(!process[_0x3071('0xd')][0x8]||process['argv'][0x8]===_0x3071('0xe')||process[_0x3071('0xd')][0x8]===_0x3071('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x3071('0xd')][0x8];}catch(_0x5cd80d){logger[_0x3071('0x14')](_0x5cd80d);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x43128c,_0x3762d8,_0x457b57,_0x33090c){var _0x34c50e={'message':_0x3762d8};_0x34c50e[_0x43128c]=!![];if(_0x457b57){_0x34c50e[_0x3071('0x15')]=_0x457b57;}if(_0x33090c){_0x34c50e[_0x3071('0x16')]=_0x33090c;}return _0x34c50e;}function isEmail(_0x542646){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x542646);}function checkRow(_0x2ce48a,_0xb05b1d,_0x412652){return new BPromise(function(_0x13df9f,_0x2793ef){if(_[_0x3071('0x17')](_0x2ce48a)){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x18'),null,_0x412652));}if(_0x2ce48a[_0x3071('0x19')]&&_0x2ce48a['errors'][_0x3071('0x1a')]){var _0x3f1e6e=_[_0x3071('0x1b')](_0x2ce48a['errors'],_0x3071('0x1c'))[_0x3071('0x1d')](';');return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3f1e6e,null,_0x412652));}var _0x950fde={};for(var _0x3fa3b8 in FIELDS){if(FIELDS[_0x3071('0x1e')](_0x3fa3b8)&&FIELDS[_0x3fa3b8]){_0x950fde[_0x3fa3b8]=_0x2ce48a[_0x3071('0x1f')][0x0][FIELDS[_0x3fa3b8]]||_0x2ce48a[_0x3071('0x1f')][0x0]['\ufeff'+FIELDS[_0x3fa3b8]];}}if(!_0x950fde[_0x3071('0x20')]){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x21'),null,_0x412652));}if(!_0x950fde['phone']){return _0x2793ef(handleCheckRowError('error',_0x3071('0x22'),null,_0x412652));}if(_0x950fde[_0x3071('0x23')]){var _0x6ddf96=moment(_0x950fde[_0x3071('0x23')],_0x3071('0x24'));if(!_0x6ddf96[_0x3071('0x25')]()){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x26'),null,_0x412652));}}if(_0x950fde['email']){if(!isEmail(_0x950fde['email'])){return _0x2793ef(handleCheckRowError('error',_0x3071('0x27'),null,_0x412652));}}_0x950fde[_0x3071('0x28')]=LISTID;_0x950fde['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){var _0x28747d={};for(var _0x25250e=0x0,_0x13ae2c=DUPLICATES['length'];_0x25250e<_0x13ae2c;_0x25250e+=0x1){_0x28747d[DUPLICATES[_0x25250e]]=_0x950fde[DUPLICATES[_0x25250e]];}var _0x218a82=_[_0x3071('0x29')](_0xb05b1d,_0x28747d);if(_0x218a82){return _0x2793ef(handleCheckRowError(_0x3071('0x2a'),_0x3071('0x2b'),_0x218a82,_0x412652));}}return db[_0x3071('0x2c')][_0x3071('0x2d')](_0x950fde,{'raw':!![],'hooks':![],'fields':_[_0x3071('0x2e')](_0x950fde)})[_0x3071('0x2f')](function(_0x596cc3){if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){_0xb05b1d['push'](_['pick'](_0x950fde,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x596cc3['id'];return _0x13df9f();})[_0x3071('0x30')](function(_0xa3a7ae){return _0x2793ef(handleCheckRowError('error',_0x3071('0x31')+(_0xa3a7ae[_0x3071('0x1c')]||JSON[_0x3071('0x32')](_0xa3a7ae)),null,_0x412652));});});}function checkHopper(){function _0x14ac42(){return function(_0xc60572){logger[_0x3071('0x14')]('cmContact',_0x3071('0x33'),util[_0x3071('0x34')](_0xc60572,{'showHidden':![],'depth':null}));};}var _0x4ce6d4=function(_0x44ad05,_0x5b1392){var _0x28f855=squel[_0x3071('0x35')]()['into']('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),'ContactId',_0x3071('0x28'),_0x5b1392,'createdAt',_0x3071('0x39')],squel['select']()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x44ad05['id'][_0x3071('0x3d')](),_0x5b1392)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),'updatedAt')[_0x3071('0x3f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x3071('0x40'),LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x5b1392+_0x3071('0x46'),_0x44ad05['id'][_0x3071('0x3d')]())))['toString']();return _0x28f855;};var _0x5c93c7=function(_0x1721d0,_0x3c2f5e){var _0x1fe5e0=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')](['phone',_0x3071('0x38'),'ContactId','ListId',_0x3c2f5e,_0x3071('0x3e'),'updatedAt'],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')[_0x3071('0x3a')]('id','ContactId')[_0x3071('0x3a')](LISTID['toString'](),_0x3071('0x28'))[_0x3071('0x3a')](_0x1721d0['id']['toString'](),_0x3c2f5e)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')](_0x3071('0x40'),LISTID['toString']())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x4b'))[_0x3071('0x3f')](_0x3071('0x4c'))[_0x3071('0x41')](_0x3c2f5e+_0x3071('0x46'),_0x1721d0['id'][_0x3071('0x3d')]()))[_0x3071('0x41')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x3c2f5e+'\x20=\x20?',_0x1721d0['id'][_0x3071('0x3d')]())))[_0x3071('0x3d')]();return _0x1fe5e0;};function _0x5bc69e(_0x4b8ec0,_0x1b89ea){var _0x15abc4=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),_0x3071('0x3c'),_0x3071('0x28'),_0x1b89ea,'createdAt',_0x3071('0x39')],squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))['field'](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x4b8ec0['id'][_0x3071('0x3d')](),_0x1b89ea)[_0x3071('0x3a')]('NOW()',_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')]('ListId\x20=\x20?',LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))[_0x3071('0x3d')]();return _0x15abc4;}function _0x2e39ff(_0x3b47e8,_0x5cb3b3){var _0x5d1316=squel[_0x3071('0x35')]()[_0x3071('0x47')](_0x3071('0x4d'))[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x3c'),_0x3071('0x28'),_0x5cb3b3,_0x3071('0x3e'),_0x3071('0x39')],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')]('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))[_0x3071('0x3a')](_0x3b47e8['id']['toString'](),_0x5cb3b3)[_0x3071('0x3a')](_0x3071('0x3b'),'createdAt')['field'](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')](_0x3071('0x4e'))['where']('deletedAt\x20IS\x20NULL')[_0x3071('0x41')]('ListId\x20=\x20?',LISTID['toString']())['where']('id\x20IN\x20?',squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))['toString']();return _0x5d1316;}return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id',_0x3071('0x52')],'include':[{'model':db['CmList'],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x588406){var _0x1b35d3=[];if(_0x588406){var _0x29ee70;for(var _0x388cd1=0x0,_0x40c258;_0x388cd1<_0x588406[_0x3071('0x1a')];_0x388cd1+=0x1){_0x40c258=_0x588406[_0x388cd1][_0x3071('0x54')]({'plain':!![]});switch(_0x40c258[_0x3071('0x52')]){case'always':_0x1b35d3['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x40c258,_0x3071('0x57')))['then'](function(){})['catch'](_0x14ac42()));break;case _0x3071('0x58'):_0x1b35d3[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x40c258,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x1b35d3[_0x3071('0x59')](db['sequelize'][_0x3071('0x56')](_0x5bc69e(_0x40c258,'VoiceQueueId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x1b35d3;})[_0x3071('0x5a')]()[_0x3071('0x2f')](function(){return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x138a94){var _0x1da477=[];if(_0x138a94){var _0x4f06c0;for(var _0x2a2e7a=0x0,_0x22ec7b;_0x2a2e7a<_0x138a94[_0x3071('0x1a')];_0x2a2e7a+=0x1){_0x22ec7b=_0x138a94[_0x2a2e7a]['get']({'plain':!![]});_0x1da477['push'](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x22ec7b,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}return _0x1da477;})[_0x3071('0x5a')]();})[_0x3071('0x2f')](function(){return db[_0x3071('0x5c')][_0x3071('0x50')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x3cc937){var _0x98d0fb=[];if(_0x3cc937){for(var _0x1fea60=0x0,_0x435dcb;_0x1fea60<_0x3cc937[_0x3071('0x1a')];_0x1fea60+=0x1){_0x435dcb=_0x3cc937[_0x1fea60]['get']({'plain':!![]});switch(_0x435dcb[_0x3071('0x52')]){case'always':_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;case _0x3071('0x58'):_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x435dcb,'CampaignId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x98d0fb['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5bc69e(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x98d0fb;})['all']();})['then'](function(){return db[_0x3071('0x5c')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x5e'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x136278){var _0x22783b=[];if(_0x136278){for(var _0x2f31b7=0x0,_0x568386;_0x2f31b7<_0x136278[_0x3071('0x1a')];_0x2f31b7+=0x1){_0x568386=_0x136278[_0x2f31b7][_0x3071('0x54')]({'plain':!![]});_0x22783b[_0x3071('0x59')](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x568386,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})['catch'](_0x14ac42()));}}return _0x22783b;})[_0x3071('0x5a')]();})[_0x3071('0x30')](function(_0x391887){logger[_0x3071('0x14')](_0x3071('0x5f'),'generalCheckHopper',_0x391887[_0x3071('0x1c')]);});}var processPromises=function(_0x479fe7){return BPromise[_0x3071('0x5a')](promises)[_0x3071('0x2f')](function(_0x39060f){})[_0x3071('0x30')](function(_0x1120ec){logger[_0x3071('0x14')](_0x3071('0x60'),JSON[_0x3071('0x32')](_0x1120ec));})['finally'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x479fe7){return _0x479fe7[_0x3071('0x63')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x3071('0x2f')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3071('0x64')](FILEPATH);}catch(_0x5e0cbd){logger[_0x3071('0x14')](_0x3071('0x65'),JSON[_0x3071('0x32')](_0x5e0cbd));}finally{process[_0x3071('0x66')](0x0);}});};process['on'](_0x3071('0x67'),function(){logger[_0x3071('0x68')](_0x3071('0x69'));endCsv();});function main(){return BPromise[_0x3071('0x6a')]()[_0x3071('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x3071('0x2c')][_0x3071('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3071('0x2f')](function(_0x5b2830){var _0x561030=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x561030,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4eb9e2,_0x8c77b7){total+=0x1;var _0x44b4c9=total;promises['push'](checkRow(_0x4eb9e2,_0x5b2830,_0x44b4c9)[_0x3071('0x2f')](function(){success+=0x1;})[_0x3071('0x30')](function(_0x1f61df){if(_0x1f61df['error']){errors+=0x1;delete _0x1f61df['error'];}else if(_0x1f61df[_0x3071('0x2a')]){duplicates+=0x1;delete _0x1f61df[_0x3071('0x2a')];}rows[_0x3071('0x59')](_0x1f61df);}));if(total%0xc8===0x0){_0x8c77b7[_0x3071('0x6b')]();return processPromises(_0x8c77b7);}},'complete':function(){return processPromises()[_0x3071('0x2f')](function(){logger[_0x3071('0x68')](_0x3071('0x6c'));endCsv();});},'error':function(_0x5eb60d,_0x58b62c){logger[_0x3071('0x68')](_0x3071('0x6d'),JSON[_0x3071('0x32')](_0x5eb60d));endCsv();}});})[_0x3071('0x30')](function(_0x5a3b64){logger[_0x3071('0x14')](_0x3071('0x6e'),JSON[_0x3071('0x32')](_0x5a3b64));});}main(); \ No newline at end of file +var _0x70e0=['insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','updatedAt','select','field','toString','NOW()','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','from','createdAt','ListId\x20=\x20?','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','catch','query','BlackLists','all','Campaign','Lists','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','CmContact','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','length','map','errors','message','hasOwnProperty','data','firstName','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','duplicate','Duplicate\x20Contact','keys','then','push','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect'];(function(_0x4ac9d5,_0x45c0b7){var _0x567d0c=function(_0x344763){while(--_0x344763){_0x4ac9d5['push'](_0x4ac9d5['shift']());}};_0x567d0c(++_0x45c0b7);}(_0x70e0,0x17b));var _0x070e=function(_0x2e55a4,_0x4228ea){_0x2e55a4=_0x2e55a4-0x0;var _0x3c05ec=_0x70e0[_0x2e55a4];return _0x3c05ec;};'use strict';var BPromise=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var _=require(_0x070e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var config=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('api');config[_0x070e('0x7')]=_['defaults'](config[_0x070e('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x070e('0x8'))[_0x070e('0x9')](socket);try{if(!process[_0x070e('0xa')][0x2]||process[_0x070e('0xa')][0x2]===_0x070e('0xb')||process[_0x070e('0xa')][0x2]===_0x070e('0xc')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process[_0x070e('0xa')][0x3]||process[_0x070e('0xa')][0x3]===_0x070e('0xb')||process[_0x070e('0xa')][0x3]===_0x070e('0xc')||!process[_0x070e('0xa')][0x4]||process[_0x070e('0xa')][0x4]===_0x070e('0xb')||process[_0x070e('0xa')][0x4]===_0x070e('0xc')){throw new Error(_0x070e('0xd'));}var FIELDS=_['zipObject'](process['argv'][0x3][_0x070e('0xe')](','),process['argv'][0x4]['split'](','));if(!process['argv'][0x5]||process[_0x070e('0xa')][0x5]===_0x070e('0xb')||process['argv'][0x5]==='null'){throw new Error(_0x070e('0xf'));}var LISTID=process[_0x070e('0xa')][0x5];var COMPANYID=process[_0x070e('0xa')][0x6]&&process[_0x070e('0xa')][0x6]!=='undefined'&&process['argv'][0x6]!==_0x070e('0xc')?process[_0x070e('0xa')][0x6]:null;var DUPLICATES=process[_0x070e('0xa')][0x7]&&process[_0x070e('0xa')][0x7]!==_0x070e('0xb')&&process['argv'][0x7]!==_0x070e('0xc')?process[_0x070e('0xa')][0x7]:null;if(!process[_0x070e('0xa')][0x8]||process[_0x070e('0xa')][0x8]===_0x070e('0xb')||process['argv'][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x070e('0xa')][0x8];}catch(_0x3004f0){logger[_0x070e('0x10')](_0x3004f0);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(_0x4be0d7,_0x5b184,_0x5dc5d2,_0xf8dd5d){var _0x3f6985={'message':_0x5b184};_0x3f6985[_0x4be0d7]=!![];if(_0x5dc5d2){_0x3f6985[_0x070e('0x11')]=_0x5dc5d2;}if(_0xf8dd5d){_0x3f6985[_0x070e('0x12')]=_0xf8dd5d;}return _0x3f6985;}function isEmail(_0x28a1c3){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))*$/[_0x070e('0x13')](_0x28a1c3);}function checkRow(_0xe405e,_0x164cdf,_0x595c7e){return new BPromise(function(_0x2f8055,_0x270061){if(_[_0x070e('0x14')](_0xe405e)){return _0x270061(handleCheckRowError('error',_0x070e('0x15'),null,_0x595c7e));}if(_0xe405e['errors']&&_0xe405e['errors'][_0x070e('0x16')]){var _0x25f6e=_[_0x070e('0x17')](_0xe405e[_0x070e('0x18')],_0x070e('0x19'))['join'](';');return _0x270061(handleCheckRowError(_0x070e('0x10'),_0x25f6e,null,_0x595c7e));}var _0x219e48={};for(var _0x1d72d6 in FIELDS){if(FIELDS[_0x070e('0x1a')](_0x1d72d6)&&FIELDS[_0x1d72d6]){_0x219e48[_0x1d72d6]=_0xe405e[_0x070e('0x1b')][0x0][FIELDS[_0x1d72d6]]||_0xe405e[_0x070e('0x1b')][0x0]['\ufeff'+FIELDS[_0x1d72d6]];}}if(!_0x219e48[_0x070e('0x1c')]){return _0x270061(handleCheckRowError(_0x070e('0x10'),'firstName\x20not\x20specified!',null,_0x595c7e));}if(!_0x219e48[_0x070e('0x1d')]){return _0x270061(handleCheckRowError(_0x070e('0x10'),_0x070e('0x1e'),null,_0x595c7e));}if(_0x219e48['birthDate']){var _0x5c5f0d=moment(_0x219e48[_0x070e('0x1f')],_0x070e('0x20'));if(!_0x5c5f0d[_0x070e('0x21')]()){return _0x270061(handleCheckRowError('error',_0x070e('0x22'),null,_0x595c7e));}}if(_0x219e48[_0x070e('0x23')]){if(!isEmail(_0x219e48[_0x070e('0x23')])){return _0x270061(handleCheckRowError(_0x070e('0x10'),'email\x20format\x20is\x20not\x20valid!',null,_0x595c7e));}}_0x219e48['ListId']=LISTID;_0x219e48['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x164cdf){var _0xdf8945={};for(var _0x4e0a7d=0x0,_0x1dff97=DUPLICATES[_0x070e('0x16')];_0x4e0a7d<_0x1dff97;_0x4e0a7d+=0x1){_0xdf8945[DUPLICATES[_0x4e0a7d]]=_0x219e48[DUPLICATES[_0x4e0a7d]];}var _0x4f8130=_['find'](_0x164cdf,_0xdf8945);if(_0x4f8130){return _0x270061(handleCheckRowError(_0x070e('0x24'),_0x070e('0x25'),_0x4f8130,_0x595c7e));}}return db['CmContact']['create'](_0x219e48,{'raw':!![],'hooks':![],'fields':_[_0x070e('0x26')](_0x219e48)})[_0x070e('0x27')](function(_0x444d02){if(DUPLICATES&&DUPLICATES[_0x070e('0x16')]&&_0x164cdf){_0x164cdf[_0x070e('0x28')](_['pick'](_0x219e48,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x444d02['id'];return _0x2f8055();})['catch'](function(_0x24d17d){return _0x270061(handleCheckRowError(_0x070e('0x10'),_0x070e('0x29')+(_0x24d17d[_0x070e('0x19')]||JSON[_0x070e('0x2a')](_0x24d17d)),null,_0x595c7e));});});}function checkHopper(){function _0x4deaf8(){return function(_0x22f3a9){logger[_0x070e('0x10')]('cmContact',_0x070e('0x2b'),util[_0x070e('0x2c')](_0x22f3a9,{'showHidden':![],'depth':null}));};}var _0x4ba6f0=function(_0x4d4ee8,_0x5ddbe9){var _0x363bff=squel[_0x070e('0x2d')]()[_0x070e('0x2e')](_0x070e('0x2f'))[_0x070e('0x30')](['phone',_0x070e('0x31'),_0x070e('0x32'),_0x070e('0x33'),_0x5ddbe9,'createdAt',_0x070e('0x34')],squel[_0x070e('0x35')]()[_0x070e('0x36')]('phone',_0x070e('0x1d'))[_0x070e('0x36')]('NOW()',_0x070e('0x31'))['field']('id',_0x070e('0x32'))[_0x070e('0x36')](LISTID[_0x070e('0x37')](),_0x070e('0x33'))[_0x070e('0x36')](_0x4d4ee8['id']['toString'](),_0x5ddbe9)[_0x070e('0x36')]('NOW()','createdAt')[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x34'))['from'](_0x070e('0x39'))[_0x070e('0x3a')](_0x070e('0x3b'))[_0x070e('0x3a')]('ListId\x20=\x20?',LISTID[_0x070e('0x37')]())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0x070e('0x3c'),squel[_0x070e('0x35')]()[_0x070e('0x36')](_0x070e('0x1d'))[_0x070e('0x3d')]('cm_hopper')[_0x070e('0x3a')](_0x5ddbe9+'\x20=\x20?',_0x4d4ee8['id'][_0x070e('0x37')]())))[_0x070e('0x37')]();return _0x363bff;};var _0xff760c=function(_0x52fcea,_0x54285a){var _0x261a27=squel['insert']()[_0x070e('0x2e')](_0x070e('0x2f'))[_0x070e('0x30')](['phone',_0x070e('0x31'),_0x070e('0x32'),'ListId',_0x54285a,'createdAt',_0x070e('0x34')],squel[_0x070e('0x35')]()[_0x070e('0x36')](_0x070e('0x1d'),_0x070e('0x1d'))['field'](_0x070e('0x38'),_0x070e('0x31'))[_0x070e('0x36')]('id',_0x070e('0x32'))[_0x070e('0x36')](LISTID[_0x070e('0x37')](),_0x070e('0x33'))[_0x070e('0x36')](_0x52fcea['id'][_0x070e('0x37')](),_0x54285a)[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x3e'))[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x34'))['from'](_0x070e('0x39'))[_0x070e('0x3a')](_0x070e('0x3b'))[_0x070e('0x3a')](_0x070e('0x3f'),LISTID[_0x070e('0x37')]())[_0x070e('0x3a')](_0x070e('0x40'),squel[_0x070e('0x41')](hopperContacts))['where'](_0x070e('0x42'))['where'](_0x070e('0x3c'),squel[_0x070e('0x35')]()['field'](_0x070e('0x43'))[_0x070e('0x3d')](_0x070e('0x44'))[_0x070e('0x3a')](_0x54285a+_0x070e('0x45'),_0x52fcea['id'][_0x070e('0x37')]()))[_0x070e('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x070e('0x35')]()['field']('phone')[_0x070e('0x3d')](_0x070e('0x2f'))[_0x070e('0x3a')](_0x54285a+_0x070e('0x45'),_0x52fcea['id'][_0x070e('0x37')]())))[_0x070e('0x37')]();return _0x261a27;};function _0x440fa1(_0x343785,_0x53bea1){var _0x477e69=squel['insert']()['into'](_0x070e('0x2f'))[_0x070e('0x30')](['phone',_0x070e('0x31'),_0x070e('0x32'),_0x070e('0x33'),_0x53bea1,_0x070e('0x3e'),_0x070e('0x34')],squel[_0x070e('0x35')]()[_0x070e('0x36')]('phone','phone')['field'](_0x070e('0x38'),_0x070e('0x31'))[_0x070e('0x36')]('id',_0x070e('0x32'))['field'](LISTID[_0x070e('0x37')](),'ListId')[_0x070e('0x36')](_0x343785['id'][_0x070e('0x37')](),_0x53bea1)[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x3e'))[_0x070e('0x36')]('NOW()',_0x070e('0x34'))[_0x070e('0x3d')](_0x070e('0x39'))['where'](_0x070e('0x3b'))[_0x070e('0x3a')]('ListId\x20=\x20?',LISTID[_0x070e('0x37')]())['where'](_0x070e('0x40'),squel['str'](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x070e('0x37')]();return _0x477e69;}function _0x1ae5cb(_0x1100d8,_0x122198){var _0x3cb9ee=squel[_0x070e('0x2d')]()['into'](_0x070e('0x46'))['fromQuery']([_0x070e('0x1d'),'ContactId',_0x070e('0x33'),_0x122198,_0x070e('0x3e'),'updatedAt'],squel[_0x070e('0x35')]()['field'](_0x070e('0x1d'),_0x070e('0x1d'))[_0x070e('0x36')]('id',_0x070e('0x32'))[_0x070e('0x36')](LISTID[_0x070e('0x37')](),_0x070e('0x33'))[_0x070e('0x36')](_0x1100d8['id'][_0x070e('0x37')](),_0x122198)[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x3e'))[_0x070e('0x36')](_0x070e('0x38'),'updatedAt')[_0x070e('0x3d')](_0x070e('0x39'))[_0x070e('0x3a')](_0x070e('0x3b'))['where'](_0x070e('0x3f'),LISTID[_0x070e('0x37')]())[_0x070e('0x3a')](_0x070e('0x40'),squel[_0x070e('0x41')](hopperContacts))[_0x070e('0x3a')]('phone\x20IS\x20NOT\x20NULL'))[_0x070e('0x37')]();return _0x3cb9ee;}return db[_0x070e('0x47')][_0x070e('0x48')]({'where':{'type':_0x070e('0x49')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x070e('0x4a')],'as':'Lists','where':{'id':LISTID}}]})[_0x070e('0x27')](function(_0x36373d){var _0x3a1ad2=[];if(_0x36373d){var _0x150bf6;for(var _0x2a20d4=0x0,_0x50ef9f;_0x2a20d4<_0x36373d[_0x070e('0x16')];_0x2a20d4+=0x1){_0x50ef9f=_0x36373d[_0x2a20d4][_0x070e('0x4b')]({'plain':!![]});switch(_0x50ef9f[_0x070e('0x4c')]){case _0x070e('0x4d'):_0x3a1ad2['push'](db[_0x070e('0x4e')]['query'](_0xff760c(_0x50ef9f,_0x070e('0x4f')))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));break;case'onlyIfOpen':_0x3a1ad2[_0x070e('0x28')](db['sequelize'][_0x070e('0x51')](_0x4ba6f0(_0x50ef9f,'VoiceQueueId'))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));break;default:_0x3a1ad2['push'](db[_0x070e('0x4e')]['query'](_0x440fa1(_0x50ef9f,_0x070e('0x4f')))[_0x070e('0x27')](function(){})['catch'](_0x4deaf8()));}}}return _0x3a1ad2;})['all']()[_0x070e('0x27')](function(){return db[_0x070e('0x47')][_0x070e('0x48')]({'where':{'type':_0x070e('0x49')},'attributes':['id'],'include':[{'model':db[_0x070e('0x4a')],'as':_0x070e('0x52'),'where':{'id':LISTID}}]})[_0x070e('0x27')](function(_0x332c8a){var _0x25b599=[];if(_0x332c8a){var _0x1d1f44;for(var _0x72077d=0x0,_0x25670e;_0x72077d<_0x332c8a[_0x070e('0x16')];_0x72077d+=0x1){_0x25670e=_0x332c8a[_0x72077d]['get']({'plain':!![]});_0x25b599[_0x070e('0x28')](db[_0x070e('0x4e')]['query'](_0x1ae5cb(_0x25670e,'VoiceQueueId'))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));}}return _0x25b599;})[_0x070e('0x53')]();})[_0x070e('0x27')](function(){return db[_0x070e('0x54')][_0x070e('0x48')]({'attributes':['id',_0x070e('0x4c')],'include':[{'model':db[_0x070e('0x4a')],'as':_0x070e('0x55'),'where':{'id':LISTID}}]})[_0x070e('0x27')](function(_0x62800d){var _0x2084a1=[];if(_0x62800d){for(var _0x46ec49=0x0,_0x595e2e;_0x46ec49<_0x62800d['length'];_0x46ec49+=0x1){_0x595e2e=_0x62800d[_0x46ec49]['get']({'plain':!![]});switch(_0x595e2e[_0x070e('0x4c')]){case _0x070e('0x4d'):_0x2084a1[_0x070e('0x28')](db[_0x070e('0x4e')]['query'](_0xff760c(_0x595e2e,_0x070e('0x56')))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));break;case _0x070e('0x57'):_0x2084a1[_0x070e('0x28')](db[_0x070e('0x4e')]['query'](_0x4ba6f0(_0x595e2e,_0x070e('0x56')))['then'](function(){})[_0x070e('0x50')](_0x4deaf8()));break;default:_0x2084a1[_0x070e('0x28')](db[_0x070e('0x4e')][_0x070e('0x51')](_0x440fa1(_0x595e2e,_0x070e('0x56')))['then'](function(){})[_0x070e('0x50')](_0x4deaf8()));}}}return _0x2084a1;})[_0x070e('0x53')]();})['then'](function(){return db[_0x070e('0x54')][_0x070e('0x48')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x070e('0x52'),'where':{'id':LISTID}}]})[_0x070e('0x27')](function(_0xf0aef8){var _0x4da906=[];if(_0xf0aef8){for(var _0x40d7e6=0x0,_0xe8c476;_0x40d7e6<_0xf0aef8[_0x070e('0x16')];_0x40d7e6+=0x1){_0xe8c476=_0xf0aef8[_0x40d7e6][_0x070e('0x4b')]({'plain':!![]});_0x4da906[_0x070e('0x28')](db[_0x070e('0x4e')][_0x070e('0x51')](_0x1ae5cb(_0xe8c476,_0x070e('0x56')))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));}}return _0x4da906;})[_0x070e('0x53')]();})[_0x070e('0x50')](function(_0x18c27a){logger['error'](_0x070e('0x58'),_0x070e('0x59'),_0x18c27a[_0x070e('0x19')]);});}var processPromises=function(_0x1b71dd){return BPromise[_0x070e('0x53')](promises)[_0x070e('0x27')](function(_0x5c4352){})['catch'](function(_0x4a8563){logger[_0x070e('0x10')](_0x070e('0x5a'),JSON[_0x070e('0x2a')](_0x4a8563));})[_0x070e('0x5b')](function(){socket['emit'](_0x070e('0x5c')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1b71dd){return _0x1b71dd[_0x070e('0x5d')]();}});};var endCsv=function(){return BPromise[_0x070e('0x5e')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x070e('0x27')](function(){socket['emit'](_0x070e('0x5c')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x070e('0x5f')](FILEPATH);}catch(_0x59e6e5){logger['error'](_0x070e('0x60'),JSON[_0x070e('0x2a')](_0x59e6e5));}finally{process['exit'](0x0);}});};process['on'](_0x070e('0x61'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x070e('0x27')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x070e('0xe')](',');return db[_0x070e('0x62')][_0x070e('0x48')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x070e('0x27')](function(_0x341756){var _0x2a12a1=fs[_0x070e('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x070e('0x64')](_0x2a12a1,{'header':!![],'skipEmptyLines':!![],'step':function(_0xdcc60a,_0x4e0f6e){total+=0x1;var _0x1306e6=total;promises[_0x070e('0x28')](checkRow(_0xdcc60a,_0x341756,_0x1306e6)[_0x070e('0x27')](function(){success+=0x1;})[_0x070e('0x50')](function(_0x3f2bb5){if(_0x3f2bb5[_0x070e('0x10')]){errors+=0x1;delete _0x3f2bb5[_0x070e('0x10')];}else if(_0x3f2bb5[_0x070e('0x24')]){duplicates+=0x1;delete _0x3f2bb5[_0x070e('0x24')];}rows[_0x070e('0x28')](_0x3f2bb5);}));if(total%0xc8===0x0){_0x4e0f6e[_0x070e('0x65')]();return processPromises(_0x4e0f6e);}},'complete':function(){return processPromises()['then'](function(){logger[_0x070e('0x66')](_0x070e('0x67'));endCsv();});},'error':function(_0x449337,_0xe50b1b){logger['info'](_0x070e('0x68'),JSON[_0x070e('0x2a')](_0x449337));endCsv();}});})[_0x070e('0x50')](function(_0x2bad43){logger[_0x070e('0x10')](_0x070e('0x69'),JSON['stringify'](_0x2bad43));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index be07ced..b24dcad 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(_0x3a0ebd,_0x47f368){var _0x51a660=function(_0x4023e6){while(--_0x4023e6){_0x3a0ebd['push'](_0x3a0ebd['shift']());}};_0x51a660(++_0x47f368);}(_0x7a54,0x106));var _0x47a5=function(_0x33569c,_0x36896e){_0x33569c=_0x33569c-0x0;var _0x4900d5=_0x7a54[_0x33569c];return _0x4900d5;};'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(_0x5f25b3,_0x35481a){var _0x4ab9bf=function(_0x49baf7){while(--_0x49baf7){_0x5f25b3['push'](_0x5f25b3['shift']());}};_0x4ab9bf(++_0x35481a);}(_0x7a54,0x106));var _0x47a5=function(_0x166342,_0x5d0381){_0x166342=_0x166342-0x0;var _0x56e80d=_0x7a54[_0x166342];return _0x56e80d;};'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 548691e..3122cca 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 _0xbb95=['file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','cm_contacts_temp_','select','field','phone','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','join','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','catch','error','message','split','filter','findOne','CmContactHasItem','update','updated','create','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','cm_contacts','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.updatedAt','insert','cm_hopper_black','fromQuery','fields','.CmListId','from','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','code','stringify','send','start','binding','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','header','parse','createReadStream','rows','errors','data','find','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','Abort\x20parser','SystemError','step','CREATE\x20TABLE\x20',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','affectedRows','exit','argv','arguments\x20\x20\x20','existsSync'];(function(_0x5443ca,_0x5ad082){var _0x505ade=function(_0x24b1b7){while(--_0x24b1b7){_0x5443ca['push'](_0x5443ca['shift']());}};_0x505ade(++_0x5ad082);}(_0xbb95,0x1d8));var _0x5bb9=function(_0x2625ee,_0x44821d){_0x2625ee=_0x2625ee-0x0;var _0x5db885=_0xbb95[_0x2625ee];return _0x5db885;};'use strict';var fs=require('fs');var path=require(_0x5bb9('0x0'));var _=require(_0x5bb9('0x1'));var Papa=require(_0x5bb9('0x2'));var util=require(_0x5bb9('0x3'));var BPromise=require(_0x5bb9('0x4'));var moment=require(_0x5bb9('0x5'));var squel=require(_0x5bb9('0x6'));var Redis=require(_0x5bb9('0x7'));var db=require(_0x5bb9('0x8'))['db'];var config=require(_0x5bb9('0x9'));var logger=require(_0x5bb9('0xa'))(_0x5bb9('0xb'));config[_0x5bb9('0xc')]=_[_0x5bb9('0xd')](config['redis'],{'host':_0x5bb9('0xe'),'port':0x18eb});var socket=require(_0x5bb9('0xf'))(new Redis(config['redis']));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()[_0x5bb9('0x10')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x5bb9('0x11')+moment()[_0x5bb9('0x10')]('YYYYMMDDHHmmss');var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x562055){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'](_0x562055);}function selectNotIn(_0xb5ad59,_0x221d84,_0x27d542,_0x5b1e55,_0x3c93b2){return squel[_0x5bb9('0x12')]()[_0x5bb9('0x13')](_0x5bb9('0x14'))['from'](_0x5b1e55)['join'](_0x221d84,null,_0x221d84+_0x5bb9('0x15')+_0x5b1e55+'.'+_0x27d542)['where'](_0x5b1e55+'.'+_0x27d542+_0x5bb9('0x16')+_0xb5ad59+'.'+_0x27d542)[_0x5bb9('0x17')](_0x221d84+_0x5bb9('0x18')+_0x3c93b2[_0x5bb9('0x19')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5b7274,_0x32f2ee){promisesAdditionalPhones=[];promisesContact=[];return db[_0x5bb9('0x1a')][_0x5bb9('0x1b')](_0x5bb9('0x1c')+tempTableName)[_0x5bb9('0x1d')](function(_0x35c808){if(_0x35c808!==null){var _0x5bd733=[];for(var _0x2073e7=0x0;_0x2073e7<_0x35c808[_0x5bb9('0x1e')];_0x2073e7++){var _0x11d47e=_0x35c808[_0x2073e7];if(!_[_0x5bb9('0x1f')](_0x11d47e[_0x5bb9('0x14')])){if(!_['isNil'](_0x11d47e[_0x5bb9('0x20')]))_0x5bd733[_0x5bb9('0x21')](insertAdditionalPhones(_0x11d47e));promisesContact['push']({'contact':_0x11d47e});}}}Promise[_0x5bb9('0x22')](_0x5bd733)[_0x5bb9('0x23')](function(){_0x5b7274({'val':0x1});});})[_0x5bb9('0x24')](function(_0x307386){logger[_0x5bb9('0x25')](_0x307386[_0x5bb9('0x26')]);});});}function insertAdditionalPhones(_0x5a1d78){return new Promise(function(_0x83e79f,_0x30dbd3){var _0x4242bc=_0x5a1d78[_0x5bb9('0x20')];if(_[_0x5bb9('0x1f')](_0x4242bc))_0x30dbd3({'val':0x0});else{var _0x51de9a=_0x4242bc['split'](';');var _0x47907f=[];orderBy=0x0;for(var _0x217ff7=0x0;_0x217ff7<_0x51de9a[_0x5bb9('0x1e')];_0x217ff7++){_0x47907f[_0x5bb9('0x21')](splitAdditionalPhone(_0x5a1d78['id'],_0x51de9a[_0x217ff7]));}Promise[_0x5bb9('0x22')](_0x47907f)[_0x5bb9('0x23')](function(){_0x83e79f({'val':_0x51de9a['length']});});}});}function splitAdditionalPhone(_0x1566eb,_0x4c87c5){return new Promise(function(_0x4d9858,_0x4ac4d2){var _0x532af1=_0x4c87c5['split'](':');var _0x56933a=_0x532af1[0x0];var _0x257224=_0x532af1[0x1];if(_0x257224!==''){var _0x3e9dcb=_0x257224[_0x5bb9('0x27')]('|');var _0x5f4153=[];for(var _0x51d477=0x0;_0x51d477<_0x3e9dcb[_0x5bb9('0x1e')];_0x51d477++){if(_0x3e9dcb[_0x51d477]!==''){var _0x3941ec=_[_0x5bb9('0x28')](promisesAdditionalPhones,{'contactId':_0x1566eb,'phone':_0x3e9dcb[_0x51d477]});if(_0x3941ec['length']==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x1566eb,'contactTypeId':_0x56933a,'phone':_0x3e9dcb[_0x51d477],'orderBy':orderBy});}}}_0x4d9858({'ok':0x1});}else _0x4d9858({'res':0x0});});}function createAdditionalPhone(_0xb5e8f9,_0x549fac,_0x4e1041,_0x41bc6b){return new Promise(function(_0x3b64b6,_0x569af0){return db['CmContactHasItem'][_0x5bb9('0x29')]({'where':{'CmContactId':_0xb5e8f9,'item':_0x4e1041}})[_0x5bb9('0x23')](function(_0x58a6c7){if(_0x58a6c7){return db[_0x5bb9('0x2a')][_0x5bb9('0x2b')]({'ItemTypeId':_0x549fac,'OrderBy':_0x41bc6b},{'where':{'CmContactId':_0xb5e8f9,'item':_0x4e1041}})['then'](function(_0x43360e){_0x3b64b6({'res':_0x5bb9('0x2c')});});}else{return db['CmContactHasItem'][_0x5bb9('0x2d')]({'CmContactId':_0xb5e8f9,'item':_0x4e1041,'ItemTypeId':_0x549fac,'OrderBy':_0x41bc6b,'ItemClass':'PHONE'})[_0x5bb9('0x23')](function(_0x540e1e){_0x3b64b6({'res':_0x5bb9('0x2e')});});}});});}function updateContact(_0x5d9f9c){return new Promise(function(_0x33015a,_0x434953){var _0x4062cc=_0x5d9f9c['id'];delete _0x5d9f9c['id'];return db[_0x5bb9('0x2f')][_0x5bb9('0x2b')](_0x5d9f9c,{'where':{'id':_0x4062cc}})[_0x5bb9('0x23')](function(_0x1bdb4f){updatedRows+=0x1;return db[_0x5bb9('0x30')]['update']({'phone':_0x5d9f9c['phone']},{'where':{'ContactId':_0x4062cc}})[_0x5bb9('0x23')](function(_0x47fb8e){_0x33015a({'ret':'OK'});});});});}function insertCmHopper(_0x5b864a,_0xc22745,_0x3987dd,_0x32aa39,_0x296624){var _0x300a7a=[_0x5bb9('0x31'),_0x5bb9('0x32'),_0x5bb9('0x33'),_0x5bb9('0x34'),_0xc22745+'.'+_0x32aa39,_0x5bb9('0x35'),'cm_contacts.updatedAt',_0x5bb9('0x36'),_0x5bb9('0x37'),'\x22'+_0x296624+'\x22'];return squel['insert']()[_0x5bb9('0x38')](_0x5bb9('0x39'))['fromQuery']([_0x5bb9('0x14'),_0x5bb9('0x3a'),_0x5bb9('0x3b'),_0x5bb9('0x3c'),_0x32aa39,_0x5bb9('0x3d'),_0x5bb9('0x3e'),_0x5bb9('0x3f'),_0x5bb9('0x40'),_0x5bb9('0x41')],squel['select']()['fields'](_0x300a7a)['from'](_0xc22745)[_0x5bb9('0x19')](_0x5bb9('0x42'),null,'cm_contacts.ListId\x20=\x20'+_0xc22745+'.CmListId')[_0x5bb9('0x19')](_0x3987dd,null,_0x3987dd+_0x5bb9('0x15')+_0xc22745+'.'+_0x32aa39)['where'](_0xc22745+_0x5bb9('0x43'),_0x5b864a)['where'](_0x5bb9('0x44'),NOW)[_0x5bb9('0x17')](_0x5bb9('0x45'),selectNotIn(_0xc22745,_0x3987dd,_0x32aa39,_0x5bb9('0x39'),[_0x5bb9('0x46'),_0x5bb9('0x47')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xc22745,_0x3987dd,_0x32aa39,_0x5bb9('0x39'),[_0x5bb9('0x46')])))[_0x5bb9('0x48')]();}function insertCmHopperBlack(_0x4617a3,_0x6504ab,_0x5a6102,_0x483520){var _0x1c209c=[_0x5bb9('0x31'),_0x5bb9('0x33'),_0x5bb9('0x34'),_0x6504ab+'.'+_0x483520,'cm_contacts.createdAt',_0x5bb9('0x49')];return squel[_0x5bb9('0x4a')]()[_0x5bb9('0x38')](_0x5bb9('0x4b'))[_0x5bb9('0x4c')](['phone',_0x5bb9('0x3b'),_0x5bb9('0x3c'),_0x483520,_0x5bb9('0x3d'),_0x5bb9('0x3e')],squel[_0x5bb9('0x12')]()[_0x5bb9('0x4d')](_0x1c209c)['from'](_0x6504ab)[_0x5bb9('0x19')](_0x5bb9('0x42'),null,'cm_contacts.ListId\x20=\x20'+_0x6504ab+_0x5bb9('0x4e'))[_0x5bb9('0x19')](_0x5a6102,null,_0x5a6102+_0x5bb9('0x15')+_0x6504ab+'.'+_0x483520)[_0x5bb9('0x17')](_0x6504ab+_0x5bb9('0x43'),_0x4617a3)[_0x5bb9('0x17')](_0x5bb9('0x44'),NOW)[_0x5bb9('0x17')](_0x5bb9('0x45'),squel['select']()[_0x5bb9('0x13')]('phone')[_0x5bb9('0x4f')](_0x5bb9('0x4b'))[_0x5bb9('0x17')](_0x5bb9('0x50'),_0x4617a3)[_0x5bb9('0x17')](_0x483520+_0x5bb9('0x51'),_0x6504ab+'.'+_0x483520)))[_0x5bb9('0x48')]();}function insertCmHopperAdditionalPhones(_0x294404){var _0x290c68=[_0x5bb9('0x52'),_0x5bb9('0x53'),_0x5bb9('0x54'),'cm_contact_has_items.createdAt',_0x5bb9('0x55')];return squel[_0x5bb9('0x4a')]()[_0x5bb9('0x38')](_0x5bb9('0x56'))['fromQuery'](['CmHopperId',_0x5bb9('0x14'),'OrderBy',_0x5bb9('0x3d'),_0x5bb9('0x3e')],squel[_0x5bb9('0x12')]()[_0x5bb9('0x4d')](_0x290c68)[_0x5bb9('0x4f')]('cm_hopper')[_0x5bb9('0x19')]('cm_contacts',null,_0x5bb9('0x57'))[_0x5bb9('0x19')]('cm_contact_has_items',null,_0x5bb9('0x58'))[_0x5bb9('0x17')](_0x5bb9('0x59'),_0x294404)[_0x5bb9('0x17')](_0x5bb9('0x44'),NOW))['toString']();}function insertCmContact(_0xef0166,_0x39aab5,_0x307ebf,_0x47c1d0){var _0x253e47=_[_0x5bb9('0x5a')](_[_0x5bb9('0x5b')](_0x47c1d0),['ListId',_0x5bb9('0x5c'),_0x5bb9('0x3d'),'updatedAt']);return squel[_0x5bb9('0x4a')]()[_0x5bb9('0x38')](_0x5bb9('0x42'))[_0x5bb9('0x4c')](_0x253e47,squel[_0x5bb9('0x12')]()[_0x5bb9('0x4d')](_0x253e47)[_0x5bb9('0x4f')](_0x39aab5)['where']('('+_0x307ebf[_0x5bb9('0x19')](',')+_0x5bb9('0x5d'),squel[_0x5bb9('0x12')]()[_0x5bb9('0x4d')](_0x307ebf)[_0x5bb9('0x4f')](_0x5bb9('0x42'))[_0x5bb9('0x17')]('ListId\x20=\x20?',_0xef0166))['where'](_0x5bb9('0x5e'),squel[_0x5bb9('0x12')]()[_0x5bb9('0x13')](_0x5bb9('0x5f'),_0x5bb9('0x60'))[_0x5bb9('0x4f')](_0x39aab5)[_0x5bb9('0x61')](_0x307ebf[_0x5bb9('0x19')](','))))['toString']();}function handleStop(){logger[_0x5bb9('0x62')](_0x5bb9('0x63'));stopped=!![];}function handleUncaughtException(_0x54f5b1){logger['error'](_0x54f5b1['message']);process['exit'](0x1);}function handleError(_0x42c2a0,_0x1d1fa1){stats['errors'][_0x5bb9('0x21')]({'name':_0x1d1fa1[_0x5bb9('0x64')],'message':_0x1d1fa1[_0x5bb9('0x26')],'row':_0x42c2a0});}function handleQuery(_0x41a7fe){logger[_0x5bb9('0x62')](_0x41a7fe);return db[_0x5bb9('0x1a')][_0x5bb9('0x1b')](_0x41a7fe)['spread'](function(_0x3c86a3){results[_0x5bb9('0x21')](_0x3c86a3);})['catch'](function(_0x8c0c7c){logger[_0x5bb9('0x25')](_0x8c0c7c[_0x5bb9('0x26')]);});}function main(_0x10200b,_0x48f006,_0x4b9b6e,_0x1986eb){logger[_0x5bb9('0x62')]('main',_0x10200b,JSON[_0x5bb9('0x65')](_0x48f006));process[_0x5bb9('0x66')](_0x5bb9('0x67'));var _0x273643=_0x48f006[_0x5bb9('0x68')];var _0x2c6c93=_['clone'](_0x273643);var _0x4237d5=_0x48f006['socket_timestamp'];var _0x4c1eee=path[_0x5bb9('0x19')](config[_0x5bb9('0x69')],_0x5bb9('0x6a'),_0x4237d5+_0x5bb9('0x6b'));logger[_0x5bb9('0x62')](_0x5bb9('0x6c'),_0x48f006);db[_0x5bb9('0x6d')][_0x5bb9('0x6e')]({'raw':!![],'attributes':['id','name']})[_0x5bb9('0x23')](function(_0x1dbf4a){for(var _0x24d99b=0x0;_0x24d99b<_0x1dbf4a['length'];_0x24d99b++){if(_0x1dbf4a[_0x24d99b][_0x5bb9('0x6f')]in _0x273643){contactItemTypes[_0x5bb9('0x21')](_0x1dbf4a[_0x24d99b]);delete _0x2c6c93[_0x1dbf4a[_0x24d99b][_0x5bb9('0x6f')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x2c6c93[_0x5bb9('0x20')]='';var _0x2ee1b4=_[_0x5bb9('0x5b')](_0x2c6c93)[_0x5bb9('0x19')]();logger[_0x5bb9('0x62')](_0x5bb9('0x70'),_0x2ee1b4);fs['writeFileSync'](_0x4c1eee,_0x2ee1b4+'\x0a');Papa[_0x5bb9('0x71')](fs[_0x5bb9('0x72')](_0x10200b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1b8cbf,_0x48d269){try{for(var _0x516dcc=0x0,_0x31b83e=[];_0x516dcc<_0x1b8cbf['data'][_0x5bb9('0x1e')];_0x516dcc++){stats[_0x5bb9('0x73')]+=0x1;if(_0x1b8cbf[_0x5bb9('0x74')][_0x516dcc]){handleError(_0x1b8cbf[_0x5bb9('0x75')][_0x516dcc],_0x1b8cbf[_0x5bb9('0x74')][_0x516dcc]);}else{var _0x4e4bf2=[];var _0x28fc39=[];for(var _0x15c739 in _0x273643){let _0x514f6e=contactItemTypes[_0x5bb9('0x76')](_0x1ac97e=>_0x1ac97e['name']===_0x15c739);if(_[_0x5bb9('0x1f')](_0x514f6e)){if(_0x273643['hasOwnProperty'](_0x15c739)){if(_0x1b8cbf[_0x5bb9('0x75')][_0x516dcc][_0x273643[_0x15c739]]){var _0x3943a6=_[_0x5bb9('0x77')](_0x1b8cbf[_0x5bb9('0x75')][_0x516dcc][_0x273643[_0x15c739]][_0x5bb9('0x78')](/"/g,'\x27'));switch(_0x15c739){case _0x5bb9('0x3a'):var _0x54dc8b=moment(_0x3943a6,_0x5bb9('0x79'),!![]);if(_0x54dc8b[_0x5bb9('0x7a')]()){_0x31b83e[_0x5bb9('0x21')]('\x22'+_0x3943a6+'\x22');}else{_0x4e4bf2['push'](_0x5bb9('0x7b'));}break;case'priority':var _0x372883=parseInt(_0x3943a6);_0x3943a6=_[_0x5bb9('0x7c')](_0x372883)||_0x372883<0x0||_0x372883>0x4?_0x1986eb?0x3:0x2:_0x372883;_0x31b83e[_0x5bb9('0x21')]('\x22'+_0x3943a6+'\x22');break;case'UserId':var _0x557efc=parseInt(_0x3943a6);if(_['isNumber'](_0x557efc)&&_['includes'](_0x4b9b6e,_0x557efc)){_0x31b83e[_0x5bb9('0x21')]('\x22'+_0x557efc+'\x22');}else{_0x4e4bf2[_0x5bb9('0x21')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x3943a6)){_0x31b83e[_0x5bb9('0x21')]('\x22'+_0x3943a6+'\x22');}else{_0x4e4bf2[_0x5bb9('0x21')](_0x5bb9('0x7d'));}break;case'dateOfBirth':var _0x364bcf=moment(_0x3943a6,_0x5bb9('0x7e'),!![]);if(_0x364bcf[_0x5bb9('0x7a')]()){_0x31b83e[_0x5bb9('0x21')]('\x22'+_0x3943a6+'\x22');}else{_0x4e4bf2[_0x5bb9('0x21')](_0x5bb9('0x7f'));}break;default:_0x31b83e['push']('\x22'+_0x3943a6+'\x22');}}else{switch(_0x15c739){case _0x5bb9('0x80'):case'phone':_0x4e4bf2[_0x5bb9('0x21')](_0x15c739+_0x5bb9('0x81'));break;default:_0x31b83e[_0x5bb9('0x21')]('\x22\x22');}}}}else{var _0x2ad967='';for(var _0x4f37cd=0x0;_0x4f37cd<_0x273643[_0x15c739][_0x5bb9('0x1e')];_0x4f37cd++){var _0x3943a6=_[_0x5bb9('0x77')](_0x1b8cbf['data'][_0x516dcc][_0x273643[_0x15c739][_0x4f37cd]][_0x5bb9('0x78')](/"/g,'\x27'));if(_0x2ad967=='')_0x2ad967=_0x3943a6;else _0x2ad967+='|'+_0x3943a6;}_0x28fc39['push'](_0x514f6e['id']+':'+_0x2ad967);}}if(hasAdditionalPhones){_0x31b83e[_0x5bb9('0x21')]('\x22'+_0x28fc39[_0x5bb9('0x19')](';')+'\x22');}if(_0x4e4bf2['length']){handleError(_0x1b8cbf[_0x5bb9('0x75')][_0x516dcc],{'code':_0x5bb9('0x82'),'message':_0x4e4bf2[_0x5bb9('0x19')]()});}else{fs[_0x5bb9('0x83')](_0x4c1eee,_0x31b83e[_0x5bb9('0x19')]()+'\x0a');}_0x31b83e=[];}if(!(stats[_0x5bb9('0x73')]%0xc8)){socket['emit']('contact:import:'+_0x4237d5,stats);stats[_0x5bb9('0x74')]=[];}}if(stopped){logger[_0x5bb9('0x62')](_0x5bb9('0x84'));_0x48d269['abort']();}}catch(_0x11fe4d){handleError(_0x1b8cbf[_0x5bb9('0x75')][_0x516dcc],{'code':_0x5bb9('0x85'),'message':_0x11fe4d[_0x5bb9('0x26')]});logger[_0x5bb9('0x25')](_0x5bb9('0x86'),_0x11fe4d[_0x5bb9('0x26')]);}},'complete':function(){try{var _0x3c46f4=[];var _0x46fbec=tempTableName;_0x3c46f4[_0x5bb9('0x21')](_0x5bb9('0x87')+_0x46fbec+'\x20LIKE\x20cm_contacts;');logger[_0x5bb9('0x62')]('CIS\x20len',contactItemTypes[_0x5bb9('0x1e')]);var _0x1df321=util[_0x5bb9('0x10')]('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',_0x4c1eee,_0x46fbec,_0x2ee1b4,_0x48f006[_0x5bb9('0x3c')],_0x48f006[_0x5bb9('0x5c')]||null,NOW,NOW);if(_['isNil'](_0x273643['scheduledat'])){_0x1df321+=_0x5bb9('0x88');}_0x3c46f4['push'](_0x1df321);BPromise[_0x5bb9('0x89')](_0x3c46f4,handleQuery)['then'](function(_0x198ac4){BPromise[_0x5bb9('0x22')]([handleAdditionalPhones()])[_0x5bb9('0x23')](function(){_0x3c46f4=[];for(var _0x3c616e=0x0;_0x3c616e\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','moment','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','\x20=\x20','where','join','sequelize','query','select\x20*\x20from\x20','isNil','AdditionalPhones','push','all','then','catch','error','message','length','split','findOne','CmContactHasItem','update','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.UserId','insert','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','into','cm_hopper_black','.CmListId','cm_contacts.phone\x20NOT\x20IN\x20(?)','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_hopper_additional_phones','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?','toString','keys','CompanyId',')\x20NOT\x20IN\x20?','min_id','group','Received\x20SIGINT','errors','code','info','main','stringify','start','binding','clone','socket_timestamp','server/files/tmp','body','ContactItemType','findAll','name','writeFileSync','parse','createReadStream','rows','data','find','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','replace','appendFileSync','Abort\x20parser','abort','SystemError','step','\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()','each','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','affectedRows','emit','contact:import:','unlink','exit','complete','argv'];(function(_0x143ce6,_0x46e089){var _0x33ed64=function(_0x5a6856){while(--_0x5a6856){_0x143ce6['push'](_0x143ce6['shift']());}};_0x33ed64(++_0x46e089);}(_0x2854,0x1d7));var _0x4285=function(_0x27d41d,_0x1959aa){_0x27d41d=_0x27d41d-0x0;var _0x58ac6d=_0x2854[_0x27d41d];return _0x58ac6d;};'use strict';var fs=require('fs');var path=require(_0x4285('0x0'));var _=require(_0x4285('0x1'));var Papa=require(_0x4285('0x2'));var util=require(_0x4285('0x3'));var BPromise=require('bluebird');var moment=require(_0x4285('0x4'));var squel=require('squel');var Redis=require('ioredis');var db=require(_0x4285('0x5'))['db'];var config=require(_0x4285('0x6'));var logger=require(_0x4285('0x7'))(_0x4285('0x8'));config[_0x4285('0x9')]=_[_0x4285('0xa')](config[_0x4285('0x9')],{'host':_0x4285('0xb'),'port':0x18eb});var socket=require(_0x4285('0xc'))(new Redis(config[_0x4285('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()['format'](_0x4285('0xd'));var tempTableName='cm_contacts_temp_'+moment()['format']('YYYYMMDDHHmmss');var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x217d66){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))*$/[_0x4285('0xe')](_0x217d66);}function selectNotIn(_0x566b36,_0xe25368,_0xb3e1bb,_0x21048b,_0x5c899c){return squel[_0x4285('0xf')]()[_0x4285('0x10')](_0x4285('0x11'))[_0x4285('0x12')](_0x21048b)['join'](_0xe25368,null,_0xe25368+'.id\x20=\x20'+_0x21048b+'.'+_0xb3e1bb)['where'](_0x21048b+'.'+_0xb3e1bb+_0x4285('0x13')+_0x566b36+'.'+_0xb3e1bb)[_0x4285('0x14')](_0xe25368+'.dialCheckDuplicateType\x20IN\x20('+_0x5c899c[_0x4285('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x52f37a,_0x4b343b){promisesAdditionalPhones=[];promisesContact=[];return db[_0x4285('0x16')][_0x4285('0x17')](_0x4285('0x18')+tempTableName)['spread'](function(_0x553c18){if(_0x553c18!==null){var _0x40de3c=[];for(var _0x4b6846=0x0;_0x4b6846<_0x553c18['length'];_0x4b6846++){var _0x2f79ab=_0x553c18[_0x4b6846];if(!_[_0x4285('0x19')](_0x2f79ab[_0x4285('0x11')])){if(!_[_0x4285('0x19')](_0x2f79ab[_0x4285('0x1a')]))_0x40de3c[_0x4285('0x1b')](insertAdditionalPhones(_0x2f79ab));promisesContact[_0x4285('0x1b')]({'contact':_0x2f79ab});}}}Promise[_0x4285('0x1c')](_0x40de3c)[_0x4285('0x1d')](function(){_0x52f37a({'val':0x1});});})[_0x4285('0x1e')](function(_0x3d8437){logger[_0x4285('0x1f')](_0x3d8437[_0x4285('0x20')]);});});}function insertAdditionalPhones(_0x3a0a60){return new Promise(function(_0x5648dd,_0xa5041e){var _0x13463d=_0x3a0a60[_0x4285('0x1a')];if(_['isNil'](_0x13463d))_0xa5041e({'val':0x0});else{var _0x248606=_0x13463d['split'](';');var _0x535713=[];orderBy=0x0;for(var _0x264d25=0x0;_0x264d25<_0x248606[_0x4285('0x21')];_0x264d25++){_0x535713[_0x4285('0x1b')](splitAdditionalPhone(_0x3a0a60['id'],_0x248606[_0x264d25]));}Promise['all'](_0x535713)[_0x4285('0x1d')](function(){_0x5648dd({'val':_0x248606['length']});});}});}function splitAdditionalPhone(_0x1ea5e3,_0x3be92f){return new Promise(function(_0x3162b4,_0x4b240e){var _0x48385e=_0x3be92f[_0x4285('0x22')](':');var _0x376187=_0x48385e[0x0];var _0x4585a0=_0x48385e[0x1];if(_0x4585a0!==''){var _0x255366=_0x4585a0[_0x4285('0x22')]('|');var _0x46c6e0=[];for(var _0x43eb2b=0x0;_0x43eb2b<_0x255366[_0x4285('0x21')];_0x43eb2b++){if(_0x255366[_0x43eb2b]!==''){var _0x2336dc=_['filter'](promisesAdditionalPhones,{'contactId':_0x1ea5e3,'phone':_0x255366[_0x43eb2b]});if(_0x2336dc[_0x4285('0x21')]==0x0){orderBy++;promisesAdditionalPhones[_0x4285('0x1b')]({'contactId':_0x1ea5e3,'contactTypeId':_0x376187,'phone':_0x255366[_0x43eb2b],'orderBy':orderBy});}}}_0x3162b4({'ok':0x1});}else _0x3162b4({'res':0x0});});}function createAdditionalPhone(_0x158f3f,_0x48a44c,_0x56f743,_0xc5663){return new Promise(function(_0x48ffcc,_0x1e18c9){return db['CmContactHasItem'][_0x4285('0x23')]({'where':{'CmContactId':_0x158f3f,'item':_0x56f743}})[_0x4285('0x1d')](function(_0x40369f){if(_0x40369f){return db[_0x4285('0x24')][_0x4285('0x25')]({'ItemTypeId':_0x48a44c,'OrderBy':_0xc5663},{'where':{'CmContactId':_0x158f3f,'item':_0x56f743}})['then'](function(_0x11e1cc){_0x48ffcc({'res':'updated'});});}else{return db[_0x4285('0x24')][_0x4285('0x26')]({'CmContactId':_0x158f3f,'item':_0x56f743,'ItemTypeId':_0x48a44c,'OrderBy':_0xc5663,'ItemClass':_0x4285('0x27')})['then'](function(_0x25ee03){_0x48ffcc({'res':_0x4285('0x28')});});}});});}function updateContact(_0x100c5c){return new Promise(function(_0x2e1679,_0x861d46){var _0x5c8d66=_0x100c5c['id'];delete _0x100c5c['id'];return db[_0x4285('0x29')]['update'](_0x100c5c,{'where':{'id':_0x5c8d66}})['then'](function(_0x123830){updatedRows+=0x1;return db[_0x4285('0x2a')][_0x4285('0x25')]({'phone':_0x100c5c[_0x4285('0x11')]},{'where':{'ContactId':_0x5c8d66}})[_0x4285('0x1d')](function(_0xae08a9){_0x2e1679({'ret':'OK'});});});});}function insertCmHopper(_0x403a35,_0x17c289,_0x45eecd,_0x419b6c,_0x2dae0c){var _0x2d301f=[_0x4285('0x2b'),_0x4285('0x2c'),_0x4285('0x2d'),_0x4285('0x2e'),_0x17c289+'.'+_0x419b6c,'cm_contacts.createdAt',_0x4285('0x2f'),'cm_contacts.priority',_0x4285('0x30'),'\x22'+_0x2dae0c+'\x22'];return squel[_0x4285('0x31')]()['into'](_0x4285('0x32'))[_0x4285('0x33')]([_0x4285('0x11'),_0x4285('0x34'),_0x4285('0x35'),_0x4285('0x36'),_0x419b6c,_0x4285('0x37'),_0x4285('0x38'),_0x4285('0x39'),_0x4285('0x3a'),'recallme'],squel[_0x4285('0xf')]()[_0x4285('0x3b')](_0x2d301f)[_0x4285('0x12')](_0x17c289)[_0x4285('0x15')](_0x4285('0x3c'),null,_0x4285('0x3d')+_0x17c289+'.CmListId')[_0x4285('0x15')](_0x45eecd,null,_0x45eecd+_0x4285('0x3e')+_0x17c289+'.'+_0x419b6c)[_0x4285('0x14')](_0x17c289+_0x4285('0x3f'),_0x403a35)[_0x4285('0x14')](_0x4285('0x40'),NOW)[_0x4285('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x17c289,_0x45eecd,_0x419b6c,_0x4285('0x32'),[_0x4285('0x41'),_0x4285('0x42')]))[_0x4285('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x17c289,_0x45eecd,_0x419b6c,_0x4285('0x32'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0xa66869,_0x6a4c2d,_0x47fc37,_0x5c6df7){var _0x12695c=[_0x4285('0x2b'),_0x4285('0x2d'),_0x4285('0x2e'),_0x6a4c2d+'.'+_0x5c6df7,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x4285('0x31')]()[_0x4285('0x43')](_0x4285('0x44'))['fromQuery'](['phone','ContactId','ListId',_0x5c6df7,_0x4285('0x37'),_0x4285('0x38')],squel[_0x4285('0xf')]()[_0x4285('0x3b')](_0x12695c)[_0x4285('0x12')](_0x6a4c2d)[_0x4285('0x15')](_0x4285('0x3c'),null,_0x4285('0x3d')+_0x6a4c2d+_0x4285('0x45'))['join'](_0x47fc37,null,_0x47fc37+_0x4285('0x3e')+_0x6a4c2d+'.'+_0x5c6df7)[_0x4285('0x14')](_0x6a4c2d+_0x4285('0x3f'),_0xa66869)[_0x4285('0x14')](_0x4285('0x40'),NOW)[_0x4285('0x14')](_0x4285('0x46'),squel[_0x4285('0xf')]()[_0x4285('0x10')](_0x4285('0x11'))[_0x4285('0x12')]('cm_hopper_black')[_0x4285('0x14')](_0x4285('0x47'),_0xa66869)[_0x4285('0x14')](_0x5c6df7+_0x4285('0x48'),_0x6a4c2d+'.'+_0x5c6df7)))['toString']();}function insertCmHopperAdditionalPhones(_0x2bd89b){var _0x6febb0=[_0x4285('0x49'),_0x4285('0x4a'),_0x4285('0x4b'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel['insert']()[_0x4285('0x43')](_0x4285('0x4c'))['fromQuery'](['CmHopperId',_0x4285('0x11'),'OrderBy',_0x4285('0x37'),_0x4285('0x38')],squel[_0x4285('0xf')]()['fields'](_0x6febb0)[_0x4285('0x12')](_0x4285('0x32'))[_0x4285('0x15')](_0x4285('0x3c'),null,_0x4285('0x4d'))[_0x4285('0x15')](_0x4285('0x4e'),null,_0x4285('0x4f'))['where'](_0x4285('0x50'),_0x2bd89b)[_0x4285('0x14')](_0x4285('0x40'),NOW))[_0x4285('0x51')]();}function insertCmContact(_0x4393bd,_0x521f3c,_0x444a33,_0x2011ba){var _0x1eeb3b=_['concat'](_[_0x4285('0x52')](_0x2011ba),['ListId',_0x4285('0x53'),'createdAt','updatedAt']);return squel[_0x4285('0x31')]()[_0x4285('0x43')](_0x4285('0x3c'))[_0x4285('0x33')](_0x1eeb3b,squel[_0x4285('0xf')]()[_0x4285('0x3b')](_0x1eeb3b)[_0x4285('0x12')](_0x521f3c)[_0x4285('0x14')]('('+_0x444a33[_0x4285('0x15')](',')+_0x4285('0x54'),squel[_0x4285('0xf')]()['fields'](_0x444a33)['from'](_0x4285('0x3c'))[_0x4285('0x14')](_0x4285('0x47'),_0x4393bd))[_0x4285('0x14')]('id\x20IN\x20?',squel[_0x4285('0xf')]()['field']('MIN(id)',_0x4285('0x55'))[_0x4285('0x12')](_0x521f3c)[_0x4285('0x56')](_0x444a33[_0x4285('0x15')](','))))[_0x4285('0x51')]();}function handleStop(){logger['info'](_0x4285('0x57'));stopped=!![];}function handleUncaughtException(_0x18c861){logger[_0x4285('0x1f')](_0x18c861['message']);process['exit'](0x1);}function handleError(_0x5a41a4,_0x27ac38){stats[_0x4285('0x58')][_0x4285('0x1b')]({'name':_0x27ac38[_0x4285('0x59')],'message':_0x27ac38[_0x4285('0x20')],'row':_0x5a41a4});}function handleQuery(_0x10c621){logger[_0x4285('0x5a')](_0x10c621);return db[_0x4285('0x16')][_0x4285('0x17')](_0x10c621)['spread'](function(_0xdd4ff3){results[_0x4285('0x1b')](_0xdd4ff3);})[_0x4285('0x1e')](function(_0x17d807){logger[_0x4285('0x1f')](_0x17d807['message']);});}function main(_0x51b781,_0x2f4b55,_0x19bebd,_0x38e3b0){logger[_0x4285('0x5a')](_0x4285('0x5b'),_0x51b781,JSON[_0x4285('0x5c')](_0x2f4b55));process['send'](_0x4285('0x5d'));var _0xc56e11=_0x2f4b55[_0x4285('0x5e')];var _0x5e4bdb=_[_0x4285('0x5f')](_0xc56e11);var _0x2fc5be=_0x2f4b55[_0x4285('0x60')];var _0x53929b=path['join'](config['root'],_0x4285('0x61'),_0x2fc5be+'.csv');logger[_0x4285('0x5a')](_0x4285('0x62'),_0x2f4b55);db[_0x4285('0x63')][_0x4285('0x64')]({'raw':!![],'attributes':['id',_0x4285('0x65')]})[_0x4285('0x1d')](function(_0x48b270){for(var _0x3f2521=0x0;_0x3f2521<_0x48b270['length'];_0x3f2521++){if(_0x48b270[_0x3f2521][_0x4285('0x65')]in _0xc56e11){contactItemTypes[_0x4285('0x1b')](_0x48b270[_0x3f2521]);delete _0x5e4bdb[_0x48b270[_0x3f2521][_0x4285('0x65')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x5e4bdb[_0x4285('0x1a')]='';var _0x3bde62=_[_0x4285('0x52')](_0x5e4bdb)[_0x4285('0x15')]();logger[_0x4285('0x5a')]('header',_0x3bde62);fs[_0x4285('0x66')](_0x53929b,_0x3bde62+'\x0a');Papa[_0x4285('0x67')](fs[_0x4285('0x68')](_0x51b781),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1a1754,_0x46fe41){try{for(var _0x6a6c65=0x0,_0x3a9901=[];_0x6a6c65<_0x1a1754['data'][_0x4285('0x21')];_0x6a6c65++){stats[_0x4285('0x69')]+=0x1;if(_0x1a1754['errors'][_0x6a6c65]){handleError(_0x1a1754[_0x4285('0x6a')][_0x6a6c65],_0x1a1754[_0x4285('0x58')][_0x6a6c65]);}else{var _0xb6383=[];var _0x36cf0d=[];for(var _0x2bfd9e in _0xc56e11){let _0x51546c=contactItemTypes[_0x4285('0x6b')](_0x384c12=>_0x384c12[_0x4285('0x65')]===_0x2bfd9e);if(_[_0x4285('0x19')](_0x51546c)){if(_0xc56e11[_0x4285('0x6c')](_0x2bfd9e)){if(_0x1a1754[_0x4285('0x6a')][_0x6a6c65][_0xc56e11[_0x2bfd9e]]){var _0xb2a9db=_[_0x4285('0x6d')](_0x1a1754[_0x4285('0x6a')][_0x6a6c65][_0xc56e11[_0x2bfd9e]]['replace'](/"/g,'\x27'));switch(_0x2bfd9e){case _0x4285('0x34'):var _0x942bc1=moment(_0xb2a9db,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x942bc1[_0x4285('0x6e')]()){_0x3a9901['push']('\x22'+_0xb2a9db+'\x22');}else{_0xb6383[_0x4285('0x1b')](_0x4285('0x6f'));}break;case'priority':var _0x336741=parseInt(_0xb2a9db);_0xb2a9db=_[_0x4285('0x70')](_0x336741)||_0x336741<0x0||_0x336741>0x4?_0x38e3b0?0x3:0x2:_0x336741;_0x3a9901[_0x4285('0x1b')]('\x22'+_0xb2a9db+'\x22');break;case'UserId':var _0x4676de=parseInt(_0xb2a9db);if(_[_0x4285('0x71')](_0x4676de)&&_[_0x4285('0x72')](_0x19bebd,_0x4676de)){_0x3a9901['push']('\x22'+_0x4676de+'\x22');}else{_0xb6383[_0x4285('0x1b')](_0x4285('0x73'));}break;case _0x4285('0x74'):if(isEmail(_0xb2a9db)){_0x3a9901[_0x4285('0x1b')]('\x22'+_0xb2a9db+'\x22');}else{_0xb6383[_0x4285('0x1b')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x2af330=moment(_0xb2a9db,_0x4285('0x75'),!![]);if(_0x2af330[_0x4285('0x6e')]()){_0x3a9901[_0x4285('0x1b')]('\x22'+_0xb2a9db+'\x22');}else{_0xb6383[_0x4285('0x1b')](_0x4285('0x76'));}break;default:_0x3a9901[_0x4285('0x1b')]('\x22'+_0xb2a9db+'\x22');}}else{switch(_0x2bfd9e){case _0x4285('0x77'):case'phone':_0xb6383[_0x4285('0x1b')](_0x2bfd9e+_0x4285('0x78'));break;default:_0x3a9901[_0x4285('0x1b')]('\x22\x22');}}}}else{var _0x2f4657='';for(var _0x274424=0x0;_0x274424<_0xc56e11[_0x2bfd9e][_0x4285('0x21')];_0x274424++){var _0xb2a9db=_['trim'](_0x1a1754[_0x4285('0x6a')][_0x6a6c65][_0xc56e11[_0x2bfd9e][_0x274424]][_0x4285('0x79')](/"/g,'\x27'));if(_0x2f4657=='')_0x2f4657=_0xb2a9db;else _0x2f4657+='|'+_0xb2a9db;}_0x36cf0d['push'](_0x51546c['id']+':'+_0x2f4657);}}if(hasAdditionalPhones){_0x3a9901[_0x4285('0x1b')]('\x22'+_0x36cf0d[_0x4285('0x15')](';')+'\x22');}if(_0xb6383[_0x4285('0x21')]){handleError(_0x1a1754[_0x4285('0x6a')][_0x6a6c65],{'code':'SystemRow','message':_0xb6383[_0x4285('0x15')]()});}else{fs[_0x4285('0x7a')](_0x53929b,_0x3a9901[_0x4285('0x15')]()+'\x0a');}_0x3a9901=[];}if(!(stats[_0x4285('0x69')]%0xc8)){socket['emit']('contact:import:'+_0x2fc5be,stats);stats[_0x4285('0x58')]=[];}}if(stopped){logger[_0x4285('0x5a')](_0x4285('0x7b'));_0x46fe41[_0x4285('0x7c')]();}}catch(_0x5bce08){handleError(_0x1a1754[_0x4285('0x6a')][_0x6a6c65],{'code':_0x4285('0x7d'),'message':_0x5bce08['message']});logger[_0x4285('0x1f')](_0x4285('0x7e'),_0x5bce08['message']);}},'complete':function(){try{var _0x4ca5dc=[];var _0x5eb346=tempTableName;_0x4ca5dc[_0x4285('0x1b')]('CREATE\x20TABLE\x20'+_0x5eb346+_0x4285('0x7f'));logger['info'](_0x4285('0x80'),contactItemTypes['length']);var _0xbe9fe1=util['format'](_0x4285('0x81'),_0x53929b,_0x5eb346,_0x3bde62,_0x2f4b55[_0x4285('0x36')],_0x2f4b55[_0x4285('0x53')]||null,NOW,NOW);if(_[_0x4285('0x19')](_0xc56e11[_0x4285('0x34')])){_0xbe9fe1+=_0x4285('0x82');}_0x4ca5dc[_0x4285('0x1b')](_0xbe9fe1);BPromise[_0x4285('0x83')](_0x4ca5dc,handleQuery)[_0x4285('0x1d')](function(_0x86b658){BPromise[_0x4285('0x1c')]([handleAdditionalPhones()])['then'](function(){_0x4ca5dc=[];for(var _0x13b983=0x0;_0x13b983=_0x1e3bab){return _0x4ea9f4[_0x67d3('0x15')](0x193)[_0x67d3('0x16')]({'message':util[_0x67d3('0x9')](_0x67d3('0x17'),_0x2d94f3)});}_0x21035a();})[_0x67d3('0x18')](function(_0x155527){_0x21035a(_0x155527);});});}function isUserLimit(){return isLimit(_0x67d3('0x19'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0x67d3('0x1a')}]}});}exports[_0x67d3('0x1b')]=isUserLimit; \ No newline at end of file +var _0x9367=['then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','utf8','parse','use','License','findOne'];(function(_0x279476,_0x192f97){var _0x3fe8c4=function(_0x419e6e){while(--_0x419e6e){_0x279476['push'](_0x279476['shift']());}};_0x3fe8c4(++_0x192f97);}(_0x9367,0x106));var _0x7936=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9367[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require(_0x7936('0x0'));var util=require(_0x7936('0x1'));var compose=require(_0x7936('0x2'));var db=require(_0x7936('0x3'))['db'];var config=require(_0x7936('0x4'));function getValueFromLicense(_0x2e8e5d,_0x4f6e38){if(_0x2e8e5d&&_0x4f6e38){if(_0x4f6e38[_0x7936('0x5')]&&_0x4f6e38[_0x7936('0x6')]){var _0x2a6034=_0x4f6e38[_0x7936('0x5')];var _0x176221=_0x4f6e38['license'];var _0x4c91a8=_0x2a6034[_0x7936('0x7')]('-')[0x4];var _0x473914=_0x2a6034[_0x7936('0x7')]('-')[0x0];var _0x175af1=crypto[_0x7936('0x8')](_0x7936('0x9'),util[_0x7936('0xa')](_0x7936('0xb'),_0x4c91a8,_0x2a6034,_0x473914));var _0x2770f9=_0x175af1[_0x7936('0xc')](_0x176221,'base64',_0x7936('0xd'));_0x2770f9+=_0x175af1['final'](_0x7936('0xd'));var _0xf407e6=JSON[_0x7936('0xe')](_0x2770f9);return _0xf407e6['hasOwnProperty'](_0x2e8e5d)?_0xf407e6[_0x2e8e5d]:null;}}return null;}function isLimit(_0x2a2b48,_0x299eef,_0x400e9a,_0xd8b7a6){var _0xe44276=_0x299eef;return compose()[_0x7936('0xf')](function(_0x31840d,_0x7a157c,_0x36db3f){return db[_0x7936('0x10')][_0x7936('0x11')]({'where':{'id':0x1},'raw':!![]})[_0x7936('0x12')](function(_0x39fd26){var _0x574045=getValueFromLicense(_0x2a2b48,_0x39fd26);return _0x574045?_0x574045:_0xe44276;})[_0x7936('0x12')](function(_0x26c684){_0xe44276=_0x26c684;return _0x400e9a[_0x7936('0x13')](_0xd8b7a6);})[_0x7936('0x12')](function(_0x2db2d5){if(_0x2db2d5>=_0xe44276){return _0x7a157c[_0x7936('0x14')](0x193)['json']({'message':util['format'](_0x7936('0x15'),_0x2a2b48)});}_0x36db3f();})[_0x7936('0x16')](function(_0x2c3ec7){_0x36db3f(_0x2c3ec7);});});}function isUserLimit(){return isLimit(_0x7936('0x17'),0x1,db[_0x7936('0x18')],{'where':{'$or':[{'role':_0x7936('0x19')},{'role':_0x7936('0x1a')}]}});}exports[_0x7936('0x1b')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 960b961..11f1de1 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 _0xbb11=['>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith','pop','utcOffset','hours','minutes','lodash','parseSearch','sqlOperator','and','replace','[$and]','[$or]','split','forEach','shift','match','filter','indexOf','map','conditions','DATE','operator','$between','value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$eq','=\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte'];(function(_0x1d80be,_0x3a60ff){var _0xf9a4f3=function(_0x5b8a08){while(--_0x5b8a08){_0x1d80be['push'](_0x1d80be['shift']());}};_0xf9a4f3(++_0x3a60ff);}(_0xbb11,0x78));var _0x1bb1=function(_0x1b2ed6,_0x306609){_0x1b2ed6=_0x1b2ed6-0x0;var _0x426956=_0xbb11[_0x1b2ed6];return _0x426956;};'use strict';var _=require(_0x1bb1('0x0'));var moment=require('moment');exports[_0x1bb1('0x1')]=function(_0x239017){var _0x4aa90c={'conditions':[]};_0x4aa90c[_0x1bb1('0x2')]=_['startsWith'](_0x239017,'[$or]')?'or':_0x1bb1('0x3');var _0x337a40=_0x239017[_0x1bb1('0x4')](_0x1bb1('0x5'),'')[_0x1bb1('0x4')](_0x1bb1('0x6'),'')['split']('||');for(var _0x41f701=0x0;_0x41f701<_0x337a40['length'];_0x41f701++){var _0x3fad40=_0x337a40[_0x41f701][_0x1bb1('0x7')](':=');var _0x59b3f0=_0x3fad40[0x0];var _0x58be07=_0x3fad40['slice'](0x1);_0x58be07[_0x1bb1('0x8')](function(_0x51b406){var _0x24b42e=_0x51b406[_0x1bb1('0x7')]('[')[_0x1bb1('0x9')]();var _0x2eae5f=_0x51b406[_0x1bb1('0xa')](/\[(.*?)\]/g);_0x2eae5f['forEach'](function(_0x50bcd4){var _0x3060f5=_0x50bcd4[_0x1bb1('0x7')]('[')[_0x1bb1('0xb')](function(_0x181479){return _0x181479[_0x1bb1('0xc')](']')>-0x1;})[_0x1bb1('0xd')](function(_0x8c8cae){return _0x8c8cae[_0x1bb1('0x7')](']')[0x0];})[0x0];_0x4aa90c[_0x1bb1('0xe')]['push']({'field':_0x59b3f0,'operator':_0x24b42e,'value':_0x3060f5});});});}return _0x4aa90c;};exports['buildExpression']=function(_0x237fa4,_0x1dbd3a,_0xb48418){var _0x31e218={};if(_0x1dbd3a===_0x1bb1('0xf')){if(_0xb48418[_0x1bb1('0x10')]==='$eq'){_0xb48418[_0x1bb1('0x10')]=_0x1bb1('0x11');_0xb48418[_0x1bb1('0x12')]+=','+_0xb48418[_0x1bb1('0x12')];}else if(_['includes']([_0x1bb1('0x13'),_0x1bb1('0x14')],_0xb48418['operator'])){_0xb48418[_0x1bb1('0x12')]=moment(_0xb48418['value'])[_0x1bb1('0x15')](0x1,_0x1bb1('0x16'))[_0x1bb1('0x17')](_0x1bb1('0x18'));}}if(_0xb48418[_0x1bb1('0x19')]){_0x1dbd3a=_0xb48418[_0x1bb1('0x19')];_0x31e218[_0x1bb1('0x1a')]=_0x1bb1('0x1b')+_0x237fa4+'.'+_0xb48418[_0x1bb1('0x1c')]+_0x1bb1('0x1d')+_0xb48418['castTo']+')\x20'+parseOperator(_0xb48418['operator']);}else{_0x31e218[_0x1bb1('0x1a')]=_0x237fa4+'.'+_0xb48418['field']+'\x20'+parseOperator(_0xb48418[_0x1bb1('0x10')]);}if(_[_0x1bb1('0x1e')]([_0x1bb1('0x1f'),_0x1bb1('0x20')],_0xb48418[_0x1bb1('0x10')]))_0x31e218[_0x1bb1('0x1a')]='('+_0x31e218['text']+_0x1bb1('0x21')+_0x237fa4+'.'+_0xb48418['field']+_0x1bb1('0x22');_0x31e218[_0x1bb1('0x12')]=parseValue(_0x1dbd3a,_0xb48418['operator'],_0xb48418[_0x1bb1('0x12')]);return _0x31e218;};function parseOperator(_0xb21b70){var _0x226508;switch(_0xb21b70){case _0x1bb1('0x23'):_0x226508=_0x1bb1('0x24');break;case _0x1bb1('0x20'):_0x226508='NOT\x20IN\x20?';break;case _0x1bb1('0x25'):_0x226508=_0x1bb1('0x26');break;case _0x1bb1('0x1f'):_0x226508=_0x1bb1('0x27');break;case _0x1bb1('0x28'):case _0x1bb1('0x29'):case'$endsWith':_0x226508=_0x1bb1('0x2a');break;case _0x1bb1('0x2b'):_0x226508=_0x1bb1('0x2c');break;case _0x1bb1('0x13'):_0x226508=_0x1bb1('0x2d');break;case _0x1bb1('0x14'):_0x226508=_0x1bb1('0x2e');break;case _0x1bb1('0x2f'):_0x226508=_0x1bb1('0x30');break;case _0x1bb1('0x11'):_0x226508=_0x1bb1('0x31');break;}return _0x226508;}function parseValue(_0xc1fb90,_0x1a0cf9,_0x8a1d65){var _0x5f4d3b={'start':undefined,'end':undefined};switch(_0x1a0cf9){case _0x1bb1('0x23'):case _0x1bb1('0x20'):_0x5f4d3b[_0x1bb1('0x32')]=_0x8a1d65[_0x1bb1('0x7')](',');break;case _0x1bb1('0x28'):_0x5f4d3b[_0x1bb1('0x32')]='%'+_0x8a1d65+'%';break;case _0x1bb1('0x29'):_0x5f4d3b[_0x1bb1('0x32')]=_0x8a1d65+'%';break;case _0x1bb1('0x33'):_0x5f4d3b[_0x1bb1('0x32')]='%'+_0x8a1d65;break;case'$between':var _0x32bde2=_0x8a1d65[_0x1bb1('0x7')](',');var _0x8a1d65=_0x32bde2[_0x1bb1('0x9')]();var _0x107bbe=_0x32bde2[_0x1bb1('0x34')]();if(_0xc1fb90===_0x1bb1('0xf')){_0x8a1d65=moment(_0x8a1d65)[_0x1bb1('0x35')](0x0,!![])[_0x1bb1('0x17')]();_0x107bbe=moment(_0x107bbe)[_0x1bb1('0x35')](0x0,!![])[_0x1bb1('0x15')](0x17,_0x1bb1('0x36'))[_0x1bb1('0x15')](0x3b,_0x1bb1('0x37'))[_0x1bb1('0x15')](0x3b,'seconds')[_0x1bb1('0x17')]();}_0x5f4d3b={'start':_0x8a1d65,'end':_0x107bbe};break;default:_0x5f4d3b[_0x1bb1('0x32')]=_0x8a1d65;break;}return _0x5f4d3b;} \ No newline at end of file +var _0x2309=['includes','$gt','add','days','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$eq','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','minutes','seconds','format','lodash','moment','parseSearch','startsWith','[$or]','[$and]','replace','split','length','slice','shift','match','forEach','indexOf','map','conditions','push','DATE','operator','value'];(function(_0x152fe3,_0x12b0c8){var _0xc5bb39=function(_0x1fde42){while(--_0x1fde42){_0x152fe3['push'](_0x152fe3['shift']());}};_0xc5bb39(++_0x12b0c8);}(_0x2309,0x174));var _0x9230=function(_0x30d994,_0x4ed410){_0x30d994=_0x30d994-0x0;var _0x17e704=_0x2309[_0x30d994];return _0x17e704;};'use strict';var _=require(_0x9230('0x0'));var moment=require(_0x9230('0x1'));exports[_0x9230('0x2')]=function(_0x181586){var _0x90bace={'conditions':[]};_0x90bace['sqlOperator']=_[_0x9230('0x3')](_0x181586,_0x9230('0x4'))?'or':'and';var _0x57cd4b=_0x181586['replace'](_0x9230('0x5'),'')[_0x9230('0x6')](_0x9230('0x4'),'')[_0x9230('0x7')]('||');for(var _0x30e86c=0x0;_0x30e86c<_0x57cd4b[_0x9230('0x8')];_0x30e86c++){var _0x1ec9db=_0x57cd4b[_0x30e86c][_0x9230('0x7')](':=');var _0x3d8eaa=_0x1ec9db[0x0];var _0x4042cf=_0x1ec9db[_0x9230('0x9')](0x1);_0x4042cf['forEach'](function(_0x25cb81){var _0x3532a2=_0x25cb81[_0x9230('0x7')]('[')[_0x9230('0xa')]();var _0x4cf871=_0x25cb81[_0x9230('0xb')](/\[(.*?)\]/g);_0x4cf871[_0x9230('0xc')](function(_0xf0ffa5){var _0x149ee6=_0xf0ffa5[_0x9230('0x7')]('[')['filter'](function(_0x185969){return _0x185969[_0x9230('0xd')](']')>-0x1;})[_0x9230('0xe')](function(_0x3f6c58){return _0x3f6c58[_0x9230('0x7')](']')[0x0];})[0x0];_0x90bace[_0x9230('0xf')][_0x9230('0x10')]({'field':_0x3d8eaa,'operator':_0x3532a2,'value':_0x149ee6});});});}return _0x90bace;};exports['buildExpression']=function(_0xf6202e,_0x1f2ad0,_0x39b50a){var _0x437625={};if(_0x1f2ad0===_0x9230('0x11')){if(_0x39b50a['operator']==='$eq'){_0x39b50a[_0x9230('0x12')]='$between';_0x39b50a['value']+=','+_0x39b50a[_0x9230('0x13')];}else if(_[_0x9230('0x14')]([_0x9230('0x15'),'$lte'],_0x39b50a[_0x9230('0x12')])){_0x39b50a[_0x9230('0x13')]=moment(_0x39b50a[_0x9230('0x13')])[_0x9230('0x16')](0x1,_0x9230('0x17'))['format'](_0x9230('0x18'));}}if(_0x39b50a[_0x9230('0x19')]){_0x1f2ad0=_0x39b50a[_0x9230('0x19')];_0x437625[_0x9230('0x1a')]=_0x9230('0x1b')+_0xf6202e+'.'+_0x39b50a[_0x9230('0x1c')]+_0x9230('0x1d')+_0x39b50a[_0x9230('0x19')]+')\x20'+parseOperator(_0x39b50a[_0x9230('0x12')]);}else{_0x437625['text']=_0xf6202e+'.'+_0x39b50a['field']+'\x20'+parseOperator(_0x39b50a[_0x9230('0x12')]);}if(_[_0x9230('0x14')]([_0x9230('0x1e'),_0x9230('0x1f')],_0x39b50a['operator']))_0x437625[_0x9230('0x1a')]='('+_0x437625[_0x9230('0x1a')]+_0x9230('0x20')+_0xf6202e+'.'+_0x39b50a[_0x9230('0x1c')]+_0x9230('0x21');_0x437625[_0x9230('0x13')]=parseValue(_0x1f2ad0,_0x39b50a[_0x9230('0x12')],_0x39b50a['value']);return _0x437625;};function parseOperator(_0x30b2f6){var _0x40d5ec;switch(_0x30b2f6){case _0x9230('0x22'):_0x40d5ec=_0x9230('0x23');break;case _0x9230('0x1f'):_0x40d5ec='NOT\x20IN\x20?';break;case _0x9230('0x24'):_0x40d5ec='=\x20?';break;case _0x9230('0x1e'):_0x40d5ec=_0x9230('0x25');break;case _0x9230('0x26'):case _0x9230('0x27'):case _0x9230('0x28'):_0x40d5ec=_0x9230('0x29');break;case _0x9230('0x2a'):_0x40d5ec=_0x9230('0x2b');break;case'$gt':_0x40d5ec='>\x20?';break;case'$lte':_0x40d5ec=_0x9230('0x2c');break;case _0x9230('0x2d'):_0x40d5ec=_0x9230('0x2e');break;case _0x9230('0x2f'):_0x40d5ec=_0x9230('0x30');break;}return _0x40d5ec;}function parseValue(_0x39d256,_0x355e3d,_0x354ba6){var _0x4dab9c={'start':undefined,'end':undefined};switch(_0x355e3d){case'$in':case'$notIn':_0x4dab9c[_0x9230('0x31')]=_0x354ba6['split'](',');break;case _0x9230('0x26'):_0x4dab9c[_0x9230('0x31')]='%'+_0x354ba6+'%';break;case _0x9230('0x27'):_0x4dab9c['start']=_0x354ba6+'%';break;case _0x9230('0x28'):_0x4dab9c[_0x9230('0x31')]='%'+_0x354ba6;break;case _0x9230('0x2f'):var _0x52ab55=_0x354ba6[_0x9230('0x7')](',');var _0x354ba6=_0x52ab55[_0x9230('0xa')]();var _0x51c198=_0x52ab55[_0x9230('0x32')]();if(_0x39d256===_0x9230('0x11')){_0x354ba6=moment(_0x354ba6)['utcOffset'](0x0,!![])['format']();_0x51c198=moment(_0x51c198)[_0x9230('0x33')](0x0,!![])[_0x9230('0x16')](0x17,_0x9230('0x34'))[_0x9230('0x16')](0x3b,_0x9230('0x35'))['add'](0x3b,_0x9230('0x36'))[_0x9230('0x37')]();}_0x4dab9c={'start':_0x354ba6,'end':_0x51c198};break;default:_0x4dab9c[_0x9230('0x31')]=_0x354ba6;break;}return _0x4dab9c;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 4099e63..89bd95d 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 _0x89ba=['isArray','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','isObject','unset','hasOwnProperty','isNumeric','match','^[0-9]*$','isEmail','getFullTextValue','push','toString','join','lodash','sequelize','moment','split','filters','isEmpty','forOwn','find','type','isPlainObject','parse','$gte','YYYY-MM-DD','format','$lte','utc','subtract'];(function(_0x3d0f05,_0x1e245c){var _0x25f316=function(_0x533969){while(--_0x533969){_0x3d0f05['push'](_0x3d0f05['shift']());}};_0x25f316(++_0x1e245c);}(_0x89ba,0x107));var _0xa89b=function(_0x1e6f1a,_0x598c23){_0x1e6f1a=_0x1e6f1a-0x0;var _0x1240a3=_0x89ba[_0x1e6f1a];return _0x1240a3;};'use strict';var _=require(_0xa89b('0x0'));var sequelize=require(_0xa89b('0x1'));var moment=require(_0xa89b('0x2'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x5bdec9){var _0x4ced8f=null;if(_0x5bdec9){_0x4ced8f=_0x5bdec9[_0xa89b('0x3')](',');}return _0x4ced8f;};exports[_0xa89b('0x4')]=function(_0xcfc567,_0x2323f4){var _0x300202={};if(!_[_0xa89b('0x5')](_0xcfc567)){_[_0xa89b('0x6')](_0xcfc567,function(_0x3fd293,_0x4c2deb){try{if(_0x2323f4){var _0xc5804c=_[_0xa89b('0x7')](_0x2323f4,{'name':_0x4c2deb})||{};if(_0xc5804c[_0xa89b('0x8')]==='DATE'&&_[_0xa89b('0x9')](_0x3fd293)){var _0x50a774=JSON[_0xa89b('0xa')](_0x3fd293);var _0x2ca65b={'$gte':moment(moment(_0x50a774[_0xa89b('0xb')])['format'](_0xa89b('0xc')))['utc']()[_0xa89b('0xd')](),'$lte':moment(moment(_0x50a774[_0xa89b('0xe')])['format'](_0xa89b('0xc')))[_0xa89b('0xf')]()[_0xa89b('0x10')](0x1,'s')[_0xa89b('0xd')]()};_0x300202[_0x4c2deb]=_0x2ca65b;}else{_0x300202[_0x4c2deb]=_[_0xa89b('0x11')](_0x3fd293)?_0x3fd293:JSON[_0xa89b('0xa')](_0x3fd293);}}else{_0x300202[_0x4c2deb]=_['isArray'](_0x3fd293)?_0x3fd293:JSON['parse'](_0x3fd293);}}catch(_0x2dd35){_0x300202[_0x4c2deb]=_0x3fd293[_0xa89b('0x3')](',');}});}return _0x300202;};exports['limit']=function(_0x1e6ba4){_0x1e6ba4=parseInt(_0x1e6ba4,0xa);if(!_0x1e6ba4||_0x1e6ba4<0x0){_0x1e6ba4=LIMIT_VALUE;}return _0x1e6ba4;};exports['offset']=function(_0x5d96ef){_0x5d96ef=parseInt(_0x5d96ef,0xa);if(!_0x5d96ef||_0x5d96ef<0x0){_0x5d96ef=0x0;}return _0x5d96ef;};exports[_0xa89b('0x12')]=function(_0x2d2db0){var _0x207119,_0x38c68e=null;if(_0x2d2db0){_0x207119=_0x2d2db0[_0xa89b('0x3')](',');_0x38c68e=_[_0xa89b('0x13')](_0x207119,function(_0x2594c0){if(_0x2594c0[_0xa89b('0x14')]('-')===0x0){return[_0x2594c0===_0xa89b('0x15')?sequelize[_0xa89b('0x16')](sequelize[_0xa89b('0x17')]('priority'),_0xa89b('0x18')):_0x2594c0[_0xa89b('0x19')](0x1),_0xa89b('0x1a')];}else{return[_0x2594c0===_0xa89b('0x15')?sequelize[_0xa89b('0x16')](sequelize[_0xa89b('0x17')](_0xa89b('0x15')),_0xa89b('0x18')):_0x2594c0,_0xa89b('0x1b')];}});}return _0x38c68e;};exports['omit']=function(_0x4a0b91,_0x16f55c){if(_[_0xa89b('0x5')](_0x4a0b91)){return _0x4a0b91;}if(_[_0xa89b('0x11')](_0x4a0b91)){for(var _0x4774c9=0x0;_0x4774c9<_0x4a0b91['length'];_0x4774c9+=0x1){_0x4a0b91[_0x4774c9]=this[_0xa89b('0x1c')](_0x4a0b91[_0x4774c9],_0x16f55c);}return _0x4a0b91;}if(!_[_0xa89b('0x1d')](_0x4a0b91)){return _0x4a0b91;}if(_['isString'](_0x16f55c)){_0x16f55c=[_0x16f55c];}if(!_[_0xa89b('0x11')](_0x16f55c)){return _0x4a0b91;}for(var _0x51a702=0x0;_0x51a702<_0x16f55c['length'];_0x51a702+=0x1){_[_0xa89b('0x1e')](_0x4a0b91,_0x16f55c[_0x51a702]);}for(var _0x70278d in _0x4a0b91){if(_0x4a0b91[_0xa89b('0x1f')](_0x70278d)){_0x4a0b91[_0x70278d]=this[_0xa89b('0x1c')](_0x4a0b91[_0x70278d],_0x16f55c);}}return _0x4a0b91;};exports[_0xa89b('0x20')]=function(_0x3e4211){return _0x3e4211[_0xa89b('0x21')](RegExp(_0xa89b('0x22')))?!![]:![];};exports[_0xa89b('0x23')]=function(_0x4cd284){return _0x4cd284['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xa89b('0x24')]=function(_0x420022){var _0x545469=[];_0x420022[_0xa89b('0x3')]('\x20')['forEach'](function(_0x2623b1){_0x545469[_0xa89b('0x25')]('+'+_0x2623b1[_0xa89b('0x26')]()+'*');});return _0x545469[_0xa89b('0x27')]('\x20');}; \ No newline at end of file +var _0x1b3e=['isObject','unset','isNumeric','match','^[0-9]*$','isEmail','push','toString','fields','filters','find','type','DATE','isPlainObject','parse','$gte','YYYY-MM-DD','utc','format','$lte','subtract','isArray','limit','offset','split','map','indexOf','priority','cast','col','unsigned','substr','DESC','omit','isEmpty','length'];(function(_0x11f192,_0x5b258d){var _0x17814d=function(_0xe58a42){while(--_0xe58a42){_0x11f192['push'](_0x11f192['shift']());}};_0x17814d(++_0x5b258d);}(_0x1b3e,0x128));var _0xe1b3=function(_0x172945,_0x5d3549){_0x172945=_0x172945-0x0;var _0x2dd917=_0x1b3e[_0x172945];return _0x2dd917;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require('moment');var LIMIT_VALUE=0xfa;exports[_0xe1b3('0x0')]=function(_0x59a0ad){var _0x451f75=null;if(_0x59a0ad){_0x451f75=_0x59a0ad['split'](',');}return _0x451f75;};exports[_0xe1b3('0x1')]=function(_0x2a334a,_0xcb92e0){var _0x324877={};if(!_['isEmpty'](_0x2a334a)){_['forOwn'](_0x2a334a,function(_0x163170,_0x2d2b89){try{if(_0xcb92e0){var _0x50f3f8=_[_0xe1b3('0x2')](_0xcb92e0,{'name':_0x2d2b89})||{};if(_0x50f3f8[_0xe1b3('0x3')]===_0xe1b3('0x4')&&_[_0xe1b3('0x5')](_0x163170)){var _0x3b6dad=JSON[_0xe1b3('0x6')](_0x163170);var _0x4e3664={'$gte':moment(moment(_0x3b6dad[_0xe1b3('0x7')])['format'](_0xe1b3('0x8')))[_0xe1b3('0x9')]()[_0xe1b3('0xa')](),'$lte':moment(moment(_0x3b6dad[_0xe1b3('0xb')])[_0xe1b3('0xa')](_0xe1b3('0x8')))[_0xe1b3('0x9')]()[_0xe1b3('0xc')](0x1,'s')[_0xe1b3('0xa')]()};_0x324877[_0x2d2b89]=_0x4e3664;}else{_0x324877[_0x2d2b89]=_[_0xe1b3('0xd')](_0x163170)?_0x163170:JSON['parse'](_0x163170);}}else{_0x324877[_0x2d2b89]=_[_0xe1b3('0xd')](_0x163170)?_0x163170:JSON[_0xe1b3('0x6')](_0x163170);}}catch(_0x509441){_0x324877[_0x2d2b89]=_0x163170['split'](',');}});}return _0x324877;};exports[_0xe1b3('0xe')]=function(_0x212976){_0x212976=parseInt(_0x212976,0xa);if(!_0x212976||_0x212976<0x0){_0x212976=LIMIT_VALUE;}return _0x212976;};exports[_0xe1b3('0xf')]=function(_0x2bebb3){_0x2bebb3=parseInt(_0x2bebb3,0xa);if(!_0x2bebb3||_0x2bebb3<0x0){_0x2bebb3=0x0;}return _0x2bebb3;};exports['sort']=function(_0x4403ca){var _0x3ecd12,_0x5097b6=null;if(_0x4403ca){_0x3ecd12=_0x4403ca[_0xe1b3('0x10')](',');_0x5097b6=_[_0xe1b3('0x11')](_0x3ecd12,function(_0x25a2a3){if(_0x25a2a3[_0xe1b3('0x12')]('-')===0x0){return[_0x25a2a3===_0xe1b3('0x13')?sequelize[_0xe1b3('0x14')](sequelize[_0xe1b3('0x15')](_0xe1b3('0x13')),_0xe1b3('0x16')):_0x25a2a3[_0xe1b3('0x17')](0x1),_0xe1b3('0x18')];}else{return[_0x25a2a3===_0xe1b3('0x13')?sequelize[_0xe1b3('0x14')](sequelize[_0xe1b3('0x15')](_0xe1b3('0x13')),_0xe1b3('0x16')):_0x25a2a3,'ASC'];}});}return _0x5097b6;};exports[_0xe1b3('0x19')]=function(_0x1e6fb9,_0x2bae47){if(_[_0xe1b3('0x1a')](_0x1e6fb9)){return _0x1e6fb9;}if(_[_0xe1b3('0xd')](_0x1e6fb9)){for(var _0x594872=0x0;_0x594872<_0x1e6fb9[_0xe1b3('0x1b')];_0x594872+=0x1){_0x1e6fb9[_0x594872]=this['omit'](_0x1e6fb9[_0x594872],_0x2bae47);}return _0x1e6fb9;}if(!_[_0xe1b3('0x1c')](_0x1e6fb9)){return _0x1e6fb9;}if(_['isString'](_0x2bae47)){_0x2bae47=[_0x2bae47];}if(!_[_0xe1b3('0xd')](_0x2bae47)){return _0x1e6fb9;}for(var _0x162969=0x0;_0x162969<_0x2bae47[_0xe1b3('0x1b')];_0x162969+=0x1){_[_0xe1b3('0x1d')](_0x1e6fb9,_0x2bae47[_0x162969]);}for(var _0x2966eb in _0x1e6fb9){if(_0x1e6fb9['hasOwnProperty'](_0x2966eb)){_0x1e6fb9[_0x2966eb]=this[_0xe1b3('0x19')](_0x1e6fb9[_0x2966eb],_0x2bae47);}}return _0x1e6fb9;};exports[_0xe1b3('0x1e')]=function(_0x4a258e){return _0x4a258e[_0xe1b3('0x1f')](RegExp(_0xe1b3('0x20')))?!![]:![];};exports[_0xe1b3('0x21')]=function(_0x3d0f2d){return _0x3d0f2d[_0xe1b3('0x1f')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x8d8eea){var _0x233de1=[];_0x8d8eea[_0xe1b3('0x10')]('\x20')['forEach'](function(_0xba30ab){_0x233de1[_0xe1b3('0x22')]('+'+_0xba30ab[_0xe1b3('0x23')]()+'*');});return _0x233de1['join']('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 4678bee..cb92341 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf49c=['client','use','json\x20replacer','toISOString','split','static','appPath','/server/views','html','ejs','renderFile','view\x20engine','urlencoded','50mb','json','initialize','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path','cors','moment','./environment','default','get','env','production','set','join','root','public','development','test'];(function(_0xc4e894,_0x427134){var _0x3b864e=function(_0x285e61){while(--_0x285e61){_0xc4e894['push'](_0xc4e894['shift']());}};_0x3b864e(++_0x427134);}(_0xf49c,0x16e));var _0xcf49=function(_0xe463ab,_0x406be7){_0xe463ab=_0xe463ab-0x0;var _0xdebb2a=_0xf49c[_0xe463ab];return _0xdebb2a;};'use strict';var express=require('express');var favicon=require(_0xcf49('0x0'));var bodyParser=require(_0xcf49('0x1'));var methodOverride=require(_0xcf49('0x2'));var cookieParser=require(_0xcf49('0x3'));var errorHandler=require(_0xcf49('0x4'));var path=require(_0xcf49('0x5'));var passport=require('passport');var cors=require(_0xcf49('0x6'));var moment=require(_0xcf49('0x7'));var config=require(_0xcf49('0x8'));var db=require('../mysqldb')['db'];exports[_0xcf49('0x9')]=function(_0x50e802){var _0x3cece4=_0x50e802[_0xcf49('0xa')](_0xcf49('0xb'));if(_0x3cece4===_0xcf49('0xc')){_0x50e802[_0xcf49('0xd')]('appPath',path[_0xcf49('0xe')](config[_0xcf49('0xf')],_0xcf49('0x10')));}if(_0x3cece4===_0xcf49('0x11')||_0x3cece4===_0xcf49('0x12')){_0x50e802[_0xcf49('0xd')]('appPath',path[_0xcf49('0xe')](config[_0xcf49('0xf')],_0xcf49('0x13')));_0x50e802[_0xcf49('0x14')](errorHandler());}_0x50e802[_0xcf49('0xd')](_0xcf49('0x15'),function(_0x3d10f1,_0x438a8f){if(this[_0x3d10f1]instanceof Date){_0x438a8f=this[_0x3d10f1][_0xcf49('0x16')]()[_0xcf49('0x17')]('.')[0x0]+'Z';}return _0x438a8f;});_0x50e802[_0xcf49('0x14')](express[_0xcf49('0x18')](_0x50e802['get'](_0xcf49('0x19'))));_0x50e802[_0xcf49('0xd')]('views',config[_0xcf49('0xf')]+_0xcf49('0x1a'));_0x50e802['engine'](_0xcf49('0x1b'),require(_0xcf49('0x1c'))[_0xcf49('0x1d')]);_0x50e802[_0xcf49('0xd')](_0xcf49('0x1e'),_0xcf49('0x1b'));_0x50e802[_0xcf49('0x14')](bodyParser[_0xcf49('0x1f')]({'limit':_0xcf49('0x20'),'extended':!![]}));_0x50e802[_0xcf49('0x14')](bodyParser[_0xcf49('0x21')]({'limit':_0xcf49('0x20')}));_0x50e802[_0xcf49('0x14')](cors());_0x50e802[_0xcf49('0x14')](methodOverride());_0x50e802[_0xcf49('0x14')](cookieParser());_0x50e802[_0xcf49('0x14')](passport[_0xcf49('0x22')]());}; \ No newline at end of file +var _0x6790=['views','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','express','serve-favicon','errorhandler','path','passport','cors','moment','./environment','../mysqldb','default','get','env','production','set','appPath','root','test','join','client','use','json\x20replacer','toISOString','split','static'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x6790,0x168));var _0x0679=function(_0x47e48e,_0x1c2b59){_0x47e48e=_0x47e48e-0x0;var _0x402632=_0x6790[_0x47e48e];return _0x402632;};'use strict';var express=require(_0x0679('0x0'));var favicon=require(_0x0679('0x1'));var bodyParser=require('body-parser');var methodOverride=require('method-override');var cookieParser=require('cookie-parser');var errorHandler=require(_0x0679('0x2'));var path=require(_0x0679('0x3'));var passport=require(_0x0679('0x4'));var cors=require(_0x0679('0x5'));var moment=require(_0x0679('0x6'));var config=require(_0x0679('0x7'));var db=require(_0x0679('0x8'))['db'];exports[_0x0679('0x9')]=function(_0xfd17b){var _0x5c2d94=_0xfd17b[_0x0679('0xa')](_0x0679('0xb'));if(_0x5c2d94===_0x0679('0xc')){_0xfd17b[_0x0679('0xd')](_0x0679('0xe'),path['join'](config[_0x0679('0xf')],'public'));}if(_0x5c2d94==='development'||_0x5c2d94===_0x0679('0x10')){_0xfd17b['set'](_0x0679('0xe'),path[_0x0679('0x11')](config['root'],_0x0679('0x12')));_0xfd17b[_0x0679('0x13')](errorHandler());}_0xfd17b['set'](_0x0679('0x14'),function(_0x5a2644,_0x2c09dc){if(this[_0x5a2644]instanceof Date){_0x2c09dc=this[_0x5a2644][_0x0679('0x15')]()[_0x0679('0x16')]('.')[0x0]+'Z';}return _0x2c09dc;});_0xfd17b[_0x0679('0x13')](express[_0x0679('0x17')](_0xfd17b[_0x0679('0xa')](_0x0679('0xe'))));_0xfd17b[_0x0679('0xd')](_0x0679('0x18'),config[_0x0679('0xf')]+'/server/views');_0xfd17b[_0x0679('0x19')](_0x0679('0x1a'),require(_0x0679('0x1b'))[_0x0679('0x1c')]);_0xfd17b[_0x0679('0xd')](_0x0679('0x1d'),_0x0679('0x1a'));_0xfd17b[_0x0679('0x13')](bodyParser[_0x0679('0x1e')]({'limit':_0x0679('0x1f'),'extended':!![]}));_0xfd17b[_0x0679('0x13')](bodyParser['json']({'limit':_0x0679('0x1f')}));_0xfd17b['use'](cors());_0xfd17b[_0x0679('0x13')](methodOverride());_0xfd17b[_0x0679('0x13')](cookieParser());_0xfd17b['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index d913f12..7d79786 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 _0x17c4=['child_process','execSync','networkInterfaces','orderBy','keys','length','filter','family','concat','head','mac','address','127.0.0.1','getFirstInterface','md5','digest','hex','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','ipAddress','createHash','update','substring','lodash','crypto','bimedia-machine-uuid'];(function(_0x5b4c5d,_0x10026d){var _0x194ef4=function(_0x10fbdd){while(--_0x10fbdd){_0x5b4c5d['push'](_0x5b4c5d['shift']());}};_0x194ef4(++_0x10026d);}(_0x17c4,0x102));var _0x417c=function(_0x4fef08,_0x4c98c7){_0x4fef08=_0x4fef08-0x0;var _0x1bde5d=_0x17c4[_0x4fef08];return _0x1bde5d;};'use strict';var _=require(_0x417c('0x0'));var os=require('os');var crypto=require(_0x417c('0x1'));var machine=require(_0x417c('0x2'));var exec=require(_0x417c('0x3'))[_0x417c('0x4')];function getInterfaces(){var _0x2e9ccf=[];var _0x6579e5=os[_0x417c('0x5')]();var _0x212ac0=_[_0x417c('0x6')](_[_0x417c('0x7')](_0x6579e5));for(var _0x5d1971=0x0;_0x5d1971<_0x212ac0[_0x417c('0x8')];_0x5d1971++){var _0x117c5d=_0x6579e5[_0x212ac0[_0x5d1971]][_0x417c('0x9')](function(_0xc418d9){return _0xc418d9[_0x417c('0xa')]==='IPv4'&&_0xc418d9['internal']===![];});_0x2e9ccf=_0x2e9ccf[_0x417c('0xb')](_0x117c5d);}return _0x2e9ccf;}function getFirstInterface(){var _0x3d5db1=_[_0x417c('0xc')](getInterfaces());return{'macAddress':_0x3d5db1&&_0x3d5db1[_0x417c('0xd')]?_0x3d5db1[_0x417c('0xd')]:'00:00:00:00:00:00','ipAddress':_0x3d5db1&&_0x3d5db1[_0x417c('0xe')]?_0x3d5db1['address']:_0x417c('0xf')};}exports[_0x417c('0x10')]=getFirstInterface;function getCPUhash(){var _0x413a4b=_[_0x417c('0x6')](os['cpus']()['map'](function(_0x23b22f){return _0x23b22f['model'];}))['join'](':');return crypto['createHash'](_0x417c('0x11'))['update'](_0x413a4b)[_0x417c('0x12')](_0x417c('0x13'));}exports['getUuid']=function(){switch(os[_0x417c('0x14')]()){case _0x417c('0x15'):return exec(_0x417c('0x16'),{'encoding':_0x417c('0x17')})['replace']('\x0d\x0a','');default:var _0x56d121=getFirstInterface();var _0x28bd1d=getCPUhash();var _0x467999=_0x28bd1d+'|'+os[_0x417c('0x18')]()+'|'+_0x56d121['macAddress']+'|'+_0x56d121[_0x417c('0x19')];var _0x1f4824=crypto[_0x417c('0x1a')](_0x417c('0x11'))[_0x417c('0x1b')](_0x467999)[_0x417c('0x12')](_0x417c('0x13'));return _0x1f4824[_0x417c('0x1c')](0x0,0x8)+'-'+_0x1f4824[_0x417c('0x1c')](0x8,0xc)+'-'+_0x1f4824[_0x417c('0x1c')](0xc,0x10)+'-'+_0x1f4824[_0x417c('0x1c')](0x10,0x14)+'-'+_0x1f4824[_0x417c('0x1c')](0x14);}}; \ No newline at end of file +var _0x326f=['utf8','replace','hostname','macAddress','hex','substring','lodash','child_process','execSync','networkInterfaces','orderBy','keys','length','filter','family','IPv4','head','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','model','createHash','md5','update','digest','getUuid','dmidecode\x20--string\x20system-uuid'];(function(_0x4a1b18,_0x58a4c0){var _0x4ccb41=function(_0x102c33){while(--_0x102c33){_0x4a1b18['push'](_0x4a1b18['shift']());}};_0x4ccb41(++_0x58a4c0);}(_0x326f,0xd1));var _0xf326=function(_0x52f9d1,_0x34e05f){_0x52f9d1=_0x52f9d1-0x0;var _0x292fac=_0x326f[_0x52f9d1];return _0x292fac;};'use strict';var _=require(_0xf326('0x0'));var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require(_0xf326('0x1'))[_0xf326('0x2')];function getInterfaces(){var _0x22aabf=[];var _0x408257=os[_0xf326('0x3')]();var _0x120a26=_[_0xf326('0x4')](_[_0xf326('0x5')](_0x408257));for(var _0x1b5a56=0x0;_0x1b5a56<_0x120a26[_0xf326('0x6')];_0x1b5a56++){var _0x4c2249=_0x408257[_0x120a26[_0x1b5a56]][_0xf326('0x7')](function(_0x3851eb){return _0x3851eb[_0xf326('0x8')]===_0xf326('0x9')&&_0x3851eb['internal']===![];});_0x22aabf=_0x22aabf['concat'](_0x4c2249);}return _0x22aabf;}function getFirstInterface(){var _0x592975=_[_0xf326('0xa')](getInterfaces());return{'macAddress':_0x592975&&_0x592975[_0xf326('0xb')]?_0x592975[_0xf326('0xb')]:_0xf326('0xc'),'ipAddress':_0x592975&&_0x592975[_0xf326('0xd')]?_0x592975['address']:_0xf326('0xe')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x1cf441=_['orderBy'](os[_0xf326('0xf')]()['map'](function(_0x3162f9){return _0x3162f9[_0xf326('0x10')];}))['join'](':');return crypto[_0xf326('0x11')](_0xf326('0x12'))[_0xf326('0x13')](_0x1cf441)[_0xf326('0x14')]('hex');}exports[_0xf326('0x15')]=function(){switch(os['platform']()){case'win32':return exec(_0xf326('0x16'),{'encoding':_0xf326('0x17')})[_0xf326('0x18')]('\x0d\x0a','');default:var _0xa63d1a=getFirstInterface();var _0x292f4b=getCPUhash();var _0x287a2a=_0x292f4b+'|'+os[_0xf326('0x19')]()+'|'+_0xa63d1a[_0xf326('0x1a')]+'|'+_0xa63d1a['ipAddress'];var _0x3ad7da=crypto[_0xf326('0x11')](_0xf326('0x12'))[_0xf326('0x13')](_0x287a2a)[_0xf326('0x14')](_0xf326('0x1b'));return _0x3ad7da['substring'](0x0,0x8)+'-'+_0x3ad7da['substring'](0x8,0xc)+'-'+_0x3ad7da['substring'](0xc,0x10)+'-'+_0x3ad7da[_0xf326('0x1c')](0x10,0x14)+'-'+_0x3ad7da[_0xf326('0x1c')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 3fc6090..9f69187 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 _0x341c=['THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','DEMO\x20START\x20AT\x20%s','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','bluebird','pkginfo','version','../../mysqldb','../environment','./hardware','../logger','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','createCipher','aes-256-ctr','secrets','session','utf8','base64','final','createDecipher','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','|reason|','|uuid|','|machineUuid|','|name|','email','ipAddress','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','data1'];(function(_0xba655c,_0xfcde9c){var _0x1c6573=function(_0x25dbbe){while(--_0x25dbbe){_0xba655c['push'](_0xba655c['shift']());}};_0x1c6573(++_0xfcde9c);}(_0x341c,0xcc));var _0xc341=function(_0xdd2348,_0x5d3232){_0xdd2348=_0xdd2348-0x0;var _0x2e0a02=_0x341c[_0xdd2348];return _0x2e0a02;};'use strict';var util=require(_0xc341('0x0'));var crypto=require('crypto');var moment=require(_0xc341('0x1'));var rp=require('request-promise');var BPromise=require(_0xc341('0x2'));var pkginfo=require(_0xc341('0x3'))(module,_0xc341('0x4'));var db=require(_0xc341('0x5'))['db'];var config=require(_0xc341('0x6'));var hardware=require(_0xc341('0x7'));var logger=require(_0xc341('0x8'))(_0xc341('0x9'));var jira=require('../../api/jira/jira.controller');var HOST=_0xc341('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x13c5b4){return new BPromise(function(_0x296387,_0x31ce96){var _0x3e83c9=util['format'](_0xc341('0xb'),HOST,_0x13c5b4,module[_0xc341('0xc')][_0xc341('0x4')]);if(oldToken){_0x3e83c9=util[_0xc341('0xd')](_0xc341('0xe'),HOST,_0x13c5b4,module[_0xc341('0xc')]['version'],oldToken);}var _0x2d08da={'uri':_0x3e83c9,'method':_0xc341('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x2d08da)[_0xc341('0x10')](function(_0xa0ae63){_0x296387(_0xa0ae63);})[_0xc341('0x11')](function(_0x47591d){_0x31ce96(_0x47591d);});});}function encryptDate(_0x5dd1f8){var _0x551f9d=crypto[_0xc341('0x12')](_0xc341('0x13'),config[_0xc341('0x14')][_0xc341('0x15')]);var _0x245595=_0x551f9d['update'](_0x5dd1f8,_0xc341('0x16'),_0xc341('0x17'));_0x245595+=_0x551f9d[_0xc341('0x18')](_0xc341('0x17'));return _0x245595;}function decryptDate(_0x989024){var _0x2bd235=crypto[_0xc341('0x19')](_0xc341('0x13'),config[_0xc341('0x14')][_0xc341('0x15')]);var _0x1d499c=_0x2bd235['update'](_0x989024,'base64',_0xc341('0x16'));_0x1d499c+=_0x2bd235[_0xc341('0x18')](_0xc341('0x16'));return _0x1d499c;}function sendJiraAlert(_0x31f1ae,_0x1017fc,_0x3555c1){var _0x40242a=_0xc341('0x1a');return db[_0xc341('0x1b')][_0xc341('0x1c')]({'where':{'role':_0xc341('0x1d')},'attributes':[_0xc341('0x1e'),'email'],'raw':!![]})['then'](function(_0x13ae28){ADMIN=_0x13ae28;_0x40242a+=_0xc341('0x1f')+_0x3555c1+'|\x0a';_0x40242a+=_0xc341('0x20')+_0x31f1ae+'|\x0a';_0x40242a+=_0xc341('0x21')+_0x1017fc+'|\x0a';_0x40242a+=_0xc341('0x22')+ADMIN[_0xc341('0x1e')]+'|\x0a';_0x40242a+='|email|'+ADMIN[_0xc341('0x23')]+'|\x0a';return _0x40242a;})[_0xc341('0x10')](function(_0x190599){var _0x5a4912=hardware['getFirstInterface']()[_0xc341('0x24')];return jira['openIssue']({'key':_0xc341('0x25'),'summary':_0xc341('0x26'),'description':_0x190599,'issuetype':_0xc341('0x27'),'oldToken':_0x31f1ae,'newToken':_0x1017fc,'email':ADMIN[_0xc341('0x23')],'name':ADMIN[_0xc341('0x1e')],'reason':GRAY_PERIOD_REASON,'ip':_0x5a4912});});}function manageLicense(_0x56831d,_0x929c58){var _0x3cd7ba=_0x929c58[_0xc341('0x28')]({'plain':!![]});httpRequest(_0x56831d)[_0xc341('0x10')](function(_0x3446b3){if(oldToken){oldToken=undefined;}if(_0x3446b3[_0xc341('0x29')]){if(!_0x3cd7ba[_0xc341('0x9')]&&_0x3cd7ba['license']!=_0x3446b3[_0xc341('0x9')]||_0x3cd7ba[_0xc341('0x9')]&&_0x3cd7ba[_0xc341('0x2a')]){logger[_0xc341('0x2b')](_0xc341('0x2c'));}if(_0x3cd7ba[_0xc341('0x9')]&&!_0x3cd7ba[_0xc341('0x2a')]&&_0x3cd7ba[_0xc341('0x9')]!=_0x3446b3[_0xc341('0x9')]){logger['info'](_0xc341('0x2d'));}if(_0x3cd7ba[_0xc341('0x9')]&&!_0x3cd7ba[_0xc341('0x2a')]&&_0x3cd7ba[_0xc341('0x9')]==_0x3446b3[_0xc341('0x9')]){return _0x929c58;}return _0x929c58[_0xc341('0x2e')]({'data1':_0x56831d,'data2':null,'license':_0x3446b3[_0xc341('0x9')]});}else{if(_0x3446b3[_0xc341('0x9')]||_0x3cd7ba[_0xc341('0x9')]){if(!_0x3cd7ba[_0xc341('0x2a')]){if(_0x3cd7ba[_0xc341('0x2f')]==_0x56831d){GRAY_PERIOD_REASON='Disabled';logger['info'](_0xc341('0x30'));}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x3cd7ba[_0xc341('0x2f')];logger[_0xc341('0x2b')](_0xc341('0x31'),_0x3cd7ba[_0xc341('0x2f')],_0x56831d);}sendJiraAlert(_0x3cd7ba[_0xc341('0x2f')],_0x3446b3[_0xc341('0x32')],GRAY_PERIOD_REASON);logger[_0xc341('0x2b')](_0xc341('0x33'),GRAY_PERIOD_REASON[_0xc341('0x34')](),moment()['format'](_0xc341('0x35')));return _0x929c58[_0xc341('0x2e')]({'data2':encryptDate(moment()[_0xc341('0xd')](_0xc341('0x35')))});}else{if(moment()[_0xc341('0x36')](decryptDate(_0x3cd7ba['data2']),'days')>DAYS){logger['info'](_0xc341('0x37'),moment()[_0xc341('0xd')](_0xc341('0x35')));return _0x929c58[_0xc341('0x2e')]({'data1':_0x56831d,'data2':null,'license':null});}}}else{if(_0x3cd7ba['data1']!=_0x56831d){logger['info'](_0xc341('0x31'),_0x3cd7ba[_0xc341('0x2f')],_0x56831d);return _0x929c58[_0xc341('0x2e')]({'data1':_0x56831d,'data2':null,'license':null});}}}return _0x929c58;})[_0xc341('0x10')](function(_0x546c73){_0x929c58=_0x546c73;})[_0xc341('0x11')](function(_0x3030df){logger['error'](_0x3030df[_0xc341('0x38')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xc341('0x39')](),_0x929c58);},TIME);});}function defaultLicense(){var _0x2a0cbd=hardware[_0xc341('0x39')]();if(_0x2a0cbd){return db[_0xc341('0x3a')][_0xc341('0x3b')]({'where':{'id':0x1},'defaults':{'data1':_0x2a0cbd}})[_0xc341('0x3c')](function(_0x3aac1a,_0x28a962){logger[_0xc341('0x2b')](_0xc341('0x3d'),_0x2a0cbd);manageLicense(_0x2a0cbd,_0x3aac1a);})[_0xc341('0x11')](function(_0xaf5a3b){logger['error'](_0xaf5a3b[_0xc341('0x38')]);});}}exports[_0xc341('0x3e')]=defaultLicense; \ No newline at end of file +var _0xf108=['license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','createCipher','session','update','utf8','base64','final','aes-256-ctr','secrets','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','email','|reason|','|uuid|','|machineUuid|','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','toUpperCase','YYYY-MM-DD\x20HH:mm','DEMO\x20START\x20AT\x20%s','message','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','moment','request-promise','bluebird','../environment','./hardware','../logger'];(function(_0x3166e6,_0x2c5451){var _0x48a110=function(_0x55c317){while(--_0x55c317){_0x3166e6['push'](_0x3166e6['shift']());}};_0x48a110(++_0x2c5451);}(_0xf108,0x1d9));var _0x8f10=function(_0x1c317d,_0x2d6081){_0x1c317d=_0x1c317d-0x0;var _0x486b30=_0xf108[_0x1c317d];return _0x486b30;};'use strict';var util=require(_0x8f10('0x0'));var crypto=require('crypto');var moment=require(_0x8f10('0x1'));var rp=require(_0x8f10('0x2'));var BPromise=require(_0x8f10('0x3'));var pkginfo=require('pkginfo')(module,'version');var db=require('../../mysqldb')['db'];var config=require(_0x8f10('0x4'));var hardware=require(_0x8f10('0x5'));var logger=require(_0x8f10('0x6'))(_0x8f10('0x7'));var jira=require(_0x8f10('0x8'));var HOST=_0x8f10('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x212efc){return new BPromise(function(_0x38b45f,_0x9cf8af){var _0x22e5df=util[_0x8f10('0xa')]('%s/api/servers/%s/check?version=%s',HOST,_0x212efc,module[_0x8f10('0xb')][_0x8f10('0xc')]);if(oldToken){_0x22e5df=util[_0x8f10('0xa')](_0x8f10('0xd'),HOST,_0x212efc,module[_0x8f10('0xb')][_0x8f10('0xc')],oldToken);}var _0x2e00f7={'uri':_0x22e5df,'method':_0x8f10('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x2e00f7)[_0x8f10('0xf')](function(_0x23c485){_0x38b45f(_0x23c485);})[_0x8f10('0x10')](function(_0x25930b){_0x9cf8af(_0x25930b);});});}function encryptDate(_0x236b4b){var _0x170036=crypto[_0x8f10('0x11')]('aes-256-ctr',config['secrets'][_0x8f10('0x12')]);var _0x455d66=_0x170036[_0x8f10('0x13')](_0x236b4b,_0x8f10('0x14'),_0x8f10('0x15'));_0x455d66+=_0x170036[_0x8f10('0x16')](_0x8f10('0x15'));return _0x455d66;}function decryptDate(_0x15bae4){var _0x295dfc=crypto['createDecipher'](_0x8f10('0x17'),config[_0x8f10('0x18')][_0x8f10('0x12')]);var _0x52aafc=_0x295dfc[_0x8f10('0x13')](_0x15bae4,_0x8f10('0x15'),'utf8');_0x52aafc+=_0x295dfc[_0x8f10('0x16')](_0x8f10('0x14'));return _0x52aafc;}function sendJiraAlert(_0x255e75,_0x3003ea,_0x48eb4f){var _0x56aa3f=_0x8f10('0x19');return db[_0x8f10('0x1a')][_0x8f10('0x1b')]({'where':{'role':_0x8f10('0x1c')},'attributes':[_0x8f10('0x1d'),_0x8f10('0x1e')],'raw':!![]})[_0x8f10('0xf')](function(_0x3fc95d){ADMIN=_0x3fc95d;_0x56aa3f+=_0x8f10('0x1f')+_0x48eb4f+'|\x0a';_0x56aa3f+=_0x8f10('0x20')+_0x255e75+'|\x0a';_0x56aa3f+=_0x8f10('0x21')+_0x3003ea+'|\x0a';_0x56aa3f+='|name|'+ADMIN[_0x8f10('0x1d')]+'|\x0a';_0x56aa3f+='|email|'+ADMIN['email']+'|\x0a';return _0x56aa3f;})['then'](function(_0x24dacc){var _0x4cc92f=hardware[_0x8f10('0x22')]()[_0x8f10('0x23')];return jira[_0x8f10('0x24')]({'key':_0x8f10('0x25'),'summary':_0x8f10('0x26'),'description':_0x24dacc,'issuetype':_0x8f10('0x27'),'oldToken':_0x255e75,'newToken':_0x3003ea,'email':ADMIN[_0x8f10('0x1e')],'name':ADMIN[_0x8f10('0x1d')],'reason':GRAY_PERIOD_REASON,'ip':_0x4cc92f});});}function manageLicense(_0x20bdfa,_0x44dd23){var _0x3458a8=_0x44dd23[_0x8f10('0x28')]({'plain':!![]});httpRequest(_0x20bdfa)[_0x8f10('0xf')](function(_0x3b085d){if(oldToken){oldToken=undefined;}if(_0x3b085d['active']){if(!_0x3458a8[_0x8f10('0x7')]&&_0x3458a8[_0x8f10('0x7')]!=_0x3b085d['license']||_0x3458a8['license']&&_0x3458a8['data2']){logger[_0x8f10('0x29')](_0x8f10('0x2a'));}if(_0x3458a8[_0x8f10('0x7')]&&!_0x3458a8[_0x8f10('0x2b')]&&_0x3458a8[_0x8f10('0x7')]!=_0x3b085d['license']){logger[_0x8f10('0x29')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x3458a8[_0x8f10('0x7')]&&!_0x3458a8[_0x8f10('0x2b')]&&_0x3458a8[_0x8f10('0x7')]==_0x3b085d['license']){return _0x44dd23;}return _0x44dd23[_0x8f10('0x13')]({'data1':_0x20bdfa,'data2':null,'license':_0x3b085d['license']});}else{if(_0x3b085d['license']||_0x3458a8[_0x8f10('0x7')]){if(!_0x3458a8[_0x8f10('0x2b')]){if(_0x3458a8[_0x8f10('0x2c')]==_0x20bdfa){GRAY_PERIOD_REASON=_0x8f10('0x2d');logger[_0x8f10('0x29')](_0x8f10('0x2e'));}else{GRAY_PERIOD_REASON=_0x8f10('0x2f');oldToken=_0x3458a8['data1'];logger['info'](_0x8f10('0x30'),_0x3458a8['data1'],_0x20bdfa);}sendJiraAlert(_0x3458a8[_0x8f10('0x2c')],_0x3b085d[_0x8f10('0x31')],GRAY_PERIOD_REASON);logger['info']('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x8f10('0x32')](),moment()['format'](_0x8f10('0x33')));return _0x44dd23['update']({'data2':encryptDate(moment()[_0x8f10('0xa')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](decryptDate(_0x3458a8[_0x8f10('0x2b')]),'days')>DAYS){logger[_0x8f10('0x29')](_0x8f10('0x34'),moment()[_0x8f10('0xa')](_0x8f10('0x33')));return _0x44dd23[_0x8f10('0x13')]({'data1':_0x20bdfa,'data2':null,'license':null});}}}else{if(_0x3458a8['data1']!=_0x20bdfa){logger[_0x8f10('0x29')](_0x8f10('0x30'),_0x3458a8['data1'],_0x20bdfa);return _0x44dd23[_0x8f10('0x13')]({'data1':_0x20bdfa,'data2':null,'license':null});}}}return _0x44dd23;})['then'](function(_0x21d584){_0x44dd23=_0x21d584;})['catch'](function(_0x28ac6a){logger['error'](_0x28ac6a[_0x8f10('0x35')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x44dd23);},TIME);});}function defaultLicense(){var _0x18168a=hardware['getUuid']();if(_0x18168a){return db[_0x8f10('0x36')][_0x8f10('0x37')]({'where':{'id':0x1},'defaults':{'data1':_0x18168a}})[_0x8f10('0x38')](function(_0x556fb9,_0x3df580){logger[_0x8f10('0x29')](_0x8f10('0x39'),_0x18168a);manageLicense(_0x18168a,_0x556fb9);})[_0x8f10('0x10')](function(_0x444d3a){logger[_0x8f10('0x3a')](_0x444d3a[_0x8f10('0x35')]);});}}exports[_0x8f10('0x3b')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index e8a8098..05489c4 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 _0xf1b6=['gray','deadline','add','days','grayReason','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','message','Demo\x20license','getLicense','find','checkLicense','util','moment','./hardware','../environment','../../mysqldb','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','aes-256-ctr','format','%s:%s:%s','update','base64','final','utf8','parse','demo','uuid','machineUuid','getUuid','createDecipher','secrets','session'];(function(_0x517b6b,_0xb51ef0){var _0x597207=function(_0x502b69){while(--_0x502b69){_0x517b6b['push'](_0x517b6b['shift']());}};_0x597207(++_0xb51ef0);}(_0xf1b6,0xd1));var _0x6f1b=function(_0x3626e7,_0x249e28){_0x3626e7=_0x3626e7-0x0;var _0x527270=_0xf1b6[_0x3626e7];return _0x527270;};'use strict';var crypto=require('crypto');var util=require(_0x6f1b('0x0'));var _=require('lodash');var moment=require(_0x6f1b('0x1'));var hardware=require(_0x6f1b('0x2'));var config=require(_0x6f1b('0x3'));var db=require(_0x6f1b('0x4'))['db'];function checkLicense(_0x34b6ec,_0x50602d){if(_0x34b6ec){try{var _0x269ff3=_0x50602d||_0x34b6ec[_0x6f1b('0x5')];if(_[_0x6f1b('0x6')](_0x269ff3)){throw new Error(_0x6f1b('0x7'));}var _0x29734c=_0x34b6ec[_0x6f1b('0x8')];var _0x1449d6=_0x34b6ec[_0x6f1b('0x9')];var _0x23945f=_0x29734c['split']('-')[0x4];var _0x2ca186=_0x29734c['split']('-')[0x0];var _0x400a4c=crypto['createDecipher'](_0x6f1b('0xa'),util[_0x6f1b('0xb')](_0x6f1b('0xc'),_0x23945f,_0x29734c,_0x2ca186));var _0x2b2da4=_0x400a4c[_0x6f1b('0xd')](_0x269ff3,_0x6f1b('0xe'),'utf8');_0x2b2da4+=_0x400a4c[_0x6f1b('0xf')](_0x6f1b('0x10'));var _0x5dc825=JSON[_0x6f1b('0x11')](_0x2b2da4);_0x5dc825[_0x6f1b('0x12')]=![];_0x5dc825[_0x6f1b('0x13')]=_0x29734c;_0x5dc825[_0x6f1b('0x14')]=hardware[_0x6f1b('0x15')]();if(_0x1449d6){var _0x3a6329=crypto[_0x6f1b('0x16')](_0x6f1b('0xa'),config[_0x6f1b('0x17')][_0x6f1b('0x18')]);var _0x52c662=_0x3a6329[_0x6f1b('0xd')](_0x1449d6,_0x6f1b('0xe'),_0x6f1b('0x10'));_0x52c662+=_0x3a6329['final'](_0x6f1b('0x10'));_0x5dc825[_0x6f1b('0x19')]=_0x52c662;_0x5dc825[_0x6f1b('0x1a')]=moment(_0x52c662)[_0x6f1b('0x1b')](0x7,_0x6f1b('0x1c'))[_0x6f1b('0xb')]();_0x5dc825[_0x6f1b('0x1d')]=_0x5dc825[_0x6f1b('0x13')]!=_0x5dc825[_0x6f1b('0x14')]?_0x6f1b('0x1e'):_0x6f1b('0x1f');}return _0x5dc825;}catch(_0x17d535){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6f1b('0x20'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x6f1b('0x21'),'uuid':_0x34b6ec[_0x6f1b('0x8')],'machineUuid':hardware[_0x6f1b('0x15')](),'message':_0x17d535[_0x6f1b('0x22')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6f1b('0x20'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x6f1b('0x23'),'uuid':_0x34b6ec['data1'],'machineUuid':hardware[_0x6f1b('0x15')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0x6f1b('0x24')]=function(_0x26b3c1){return db['License'][_0x6f1b('0x25')](_['defaults'](_0x26b3c1,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x2be32e){return checkLicense(_0x2be32e,null);});};exports[_0x6f1b('0x26')]=checkLicense; \ No newline at end of file +var _0x2fda=['disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','message','Demo\x20license','getLicense','License','find','then','checkLicense','crypto','moment','./hardware','../environment','../../mysqldb','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','aes-256-ctr','update','utf8','final','parse','demo','uuid','machineUuid','getUuid','secrets','base64','deadline','add','days','format','grayReason','changed'];(function(_0xee04d8,_0x468de5){var _0x210d3d=function(_0x463fd9){while(--_0x463fd9){_0xee04d8['push'](_0xee04d8['shift']());}};_0x210d3d(++_0x468de5);}(_0x2fda,0x186));var _0xa2fd=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x2fda[_0x28947d];return _0x12d2ee;};'use strict';var crypto=require(_0xa2fd('0x0'));var util=require('util');var _=require('lodash');var moment=require(_0xa2fd('0x1'));var hardware=require(_0xa2fd('0x2'));var config=require(_0xa2fd('0x3'));var db=require(_0xa2fd('0x4'))['db'];function checkLicense(_0x34cafb,_0x5a36d9){if(_0x34cafb){try{var _0x497c5f=_0x5a36d9||_0x34cafb['license'];if(_[_0xa2fd('0x5')](_0x497c5f)){throw new Error(_0xa2fd('0x6'));}var _0x4c6b0b=_0x34cafb[_0xa2fd('0x7')];var _0x2058d3=_0x34cafb[_0xa2fd('0x8')];var _0x4abb3a=_0x4c6b0b[_0xa2fd('0x9')]('-')[0x4];var _0x334761=_0x4c6b0b[_0xa2fd('0x9')]('-')[0x0];var _0x2683fc=crypto[_0xa2fd('0xa')](_0xa2fd('0xb'),util['format']('%s:%s:%s',_0x4abb3a,_0x4c6b0b,_0x334761));var _0x505cce=_0x2683fc[_0xa2fd('0xc')](_0x497c5f,'base64',_0xa2fd('0xd'));_0x505cce+=_0x2683fc[_0xa2fd('0xe')]('utf8');var _0x52de07=JSON[_0xa2fd('0xf')](_0x505cce);_0x52de07[_0xa2fd('0x10')]=![];_0x52de07[_0xa2fd('0x11')]=_0x4c6b0b;_0x52de07[_0xa2fd('0x12')]=hardware[_0xa2fd('0x13')]();if(_0x2058d3){var _0x3cff47=crypto['createDecipher']('aes-256-ctr',config[_0xa2fd('0x14')]['session']);var _0x133db2=_0x3cff47['update'](_0x2058d3,_0xa2fd('0x15'),_0xa2fd('0xd'));_0x133db2+=_0x3cff47[_0xa2fd('0xe')](_0xa2fd('0xd'));_0x52de07['gray']=_0x133db2;_0x52de07[_0xa2fd('0x16')]=moment(_0x133db2)[_0xa2fd('0x17')](0x7,_0xa2fd('0x18'))[_0xa2fd('0x19')]();_0x52de07[_0xa2fd('0x1a')]=_0x52de07['uuid']!=_0x52de07[_0xa2fd('0x12')]?_0xa2fd('0x1b'):_0xa2fd('0x1c');}return _0x52de07;}catch(_0x1ce604){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xa2fd('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xa2fd('0x1e'),'uuid':_0x34cafb[_0xa2fd('0x7')],'machineUuid':hardware[_0xa2fd('0x13')](),'message':_0x1ce604[_0xa2fd('0x1f')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xa2fd('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xa2fd('0x20'),'uuid':_0x34cafb['data1'],'machineUuid':hardware[_0xa2fd('0x13')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0xa2fd('0x21')]=function(_0x295f04){return db[_0xa2fd('0x22')][_0xa2fd('0x23')](_['defaults'](_0x295f04,{'raw':!![],'where':{'id':0x1}}))[_0xa2fd('0x24')](function(_0x12d3ed){return checkLicense(_0x12d3ed,null);});};exports[_0xa2fd('0x25')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 62c9d68..1bf0d90 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 _0x0f6c=['secret','exports','myappanuglar-secret','app-id'];(function(_0x2b863a,_0x48a65e){var _0x2781c8=function(_0x1b2f41){while(--_0x1b2f41){_0x2b863a['push'](_0x2b863a['shift']());}};_0x2781c8(++_0x48a65e);}(_0x0f6c,0xe1));var _0xc0f6=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x0f6c[_0x5b644e];return _0x49c6bf;};'use strict';module[_0xc0f6('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xc0f6('0x1'),'GOOGLE_ID':_0xc0f6('0x2'),'GOOGLE_SECRET':_0xc0f6('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x2c02=['exports','app-id'];(function(_0x1f808f,_0x172b10){var _0x282348=function(_0xfa8c2){while(--_0xfa8c2){_0x1f808f['push'](_0x1f808f['shift']());}};_0x282348(++_0x172b10);}(_0x2c02,0x18e));var _0x22c0=function(_0x2c6545,_0x1e4fdf){_0x2c6545=_0x2c6545-0x0;var _0x440533=_0x2c02[_0x2c6545];return _0x440533;};'use strict';module[_0x22c0('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x22c0('0x1'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index f98333f..61813b1 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x056f=['format','%s-%s.log','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','message','exports','Logger','File','error','transports','info','moment','winston','util','path','INFO','/var','xcally'];(function(_0x368587,_0x1b6554){var _0x42d33c=function(_0xfdccf){while(--_0xfdccf){_0x368587['push'](_0x368587['shift']());}};_0x42d33c(++_0x1b6554);}(_0x056f,0x185));var _0xf056=function(_0xcbbfc2,_0x14ffd2){_0xcbbfc2=_0xcbbfc2-0x0;var _0x499cea=_0x056f[_0xcbbfc2];return _0x499cea;};'use strict';var moment=require(_0xf056('0x0'));var winston=require(_0xf056('0x1'));var util=require(_0xf056('0x2'));var path=require(_0xf056('0x3'));var debugLevel=_0xf056('0x4');function filename(_0x171d5d,_0x2e2120){return path['join'](_0xf056('0x5'),'log',_0xf056('0x6'),util[_0xf056('0x7')](_0xf056('0x8'),_0x171d5d,_0x2e2120));}function formatter(_0x4b2d73,_0x225728){return util[_0xf056('0x7')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xf056('0x7')](_0xf056('0x9')),_0x225728['level'][_0xf056('0xa')](),_0x4b2d73,_0x225728[_0xf056('0xb')]);}module[_0xf056('0xc')]=function(_0x19c83a){return new winston[(_0xf056('0xd'))]({'transports':[new winston['transports'][(_0xf056('0xe'))]({'name':util[_0xf056('0x7')]('%s-%s',_0x19c83a,_0xf056('0xf')),'filename':filename(_0x19c83a,_0xf056('0xf')),'level':_0xf056('0xf'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x50500e){return formatter(_0x19c83a,_0x50500e);}}),new winston[(_0xf056('0x10'))]['File']({'name':util[_0xf056('0x7')]('%s-%s',_0x19c83a,'info'),'filename':filename(_0x19c83a,_0xf056('0x11')),'level':_0xf056('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x6b7ad3){return formatter(_0x19c83a,_0x6b7ad3);}}),new winston['transports']['Console']({'level':process['env']['debugLevel']||debugLevel,'json':![],'formatter':function(_0x4313de){return formatter(_0x19c83a,_0x4313de);}})]});}; \ No newline at end of file +var _0x0286=['transports','File','%s-%s','error','info','Console','debugLevel','moment','util','path','join','format','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','message','exports','Logger'];(function(_0x582c18,_0x147e2d){var _0x3bac37=function(_0x157cea){while(--_0x157cea){_0x582c18['push'](_0x582c18['shift']());}};_0x3bac37(++_0x147e2d);}(_0x0286,0xdf));var _0x6028=function(_0x49cc18,_0x35d438){_0x49cc18=_0x49cc18-0x0;var _0x4f9ff0=_0x0286[_0x49cc18];return _0x4f9ff0;};'use strict';var moment=require(_0x6028('0x0'));var winston=require('winston');var util=require(_0x6028('0x1'));var path=require(_0x6028('0x2'));var debugLevel='INFO';function filename(_0x2117bb,_0x28951c){return path[_0x6028('0x3')]('/var','log','xcally',util[_0x6028('0x4')]('%s-%s.log',_0x2117bb,_0x28951c));}function formatter(_0x1b44c1,_0x779f9){return util[_0x6028('0x4')](_0x6028('0x5'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x779f9[_0x6028('0x6')][_0x6028('0x7')](),_0x1b44c1,_0x779f9[_0x6028('0x8')]);}module[_0x6028('0x9')]=function(_0x7857d9){return new winston[(_0x6028('0xa'))]({'transports':[new winston[(_0x6028('0xb'))][(_0x6028('0xc'))]({'name':util['format'](_0x6028('0xd'),_0x7857d9,_0x6028('0xe')),'filename':filename(_0x7857d9,_0x6028('0xe')),'level':_0x6028('0xe'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x190e5d){return formatter(_0x7857d9,_0x190e5d);}}),new winston[(_0x6028('0xb'))][(_0x6028('0xc'))]({'name':util['format']('%s-%s',_0x7857d9,_0x6028('0xf')),'filename':filename(_0x7857d9,_0x6028('0xf')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1bef5b){return formatter(_0x7857d9,_0x1bef5b);}}),new winston[(_0x6028('0xb'))][(_0x6028('0x10'))]({'level':process['env'][_0x6028('0x11')]||debugLevel,'json':![],'formatter':function(_0x26b5c1){return formatter(_0x7857d9,_0x26b5c1);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 197721f..6862b7e 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 _0x32f6=['join','../../services/express/index.js','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports'];(function(_0x24390a,_0x2d6784){var _0xb4e146=function(_0x17e0a6){while(--_0x17e0a6){_0x24390a['push'](_0x24390a['shift']());}};_0xb4e146(++_0x2d6784);}(_0x32f6,0xbd));var _0x632f=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x32f6[_0x88cd7b];return _0x56fcc8;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':'express','script':path[_0x632f('0x0')](__dirname,_0x632f('0x1'))},{'name':'ami','script':path[_0x632f('0x0')](__dirname,_0x632f('0x2'))},{'name':_0x632f('0x3'),'script':path[_0x632f('0x0')](__dirname,_0x632f('0x4'))},{'name':'email','script':path['join'](__dirname,'../../services/email/index.js')},{'name':'routing','script':path[_0x632f('0x0')](__dirname,_0x632f('0x5'))},{'name':_0x632f('0x6'),'script':path[_0x632f('0x0')](__dirname,_0x632f('0x7'))}]};module[_0x632f('0x8')]=config; \ No newline at end of file +var _0x8286=['express','ami','join','../../services/ami/index.js','email','../../services/email/index.js','routing','xdr','../../services/xdr/index.js'];(function(_0x847473,_0x18a0b0){var _0x8cf675=function(_0x549e5d){while(--_0x549e5d){_0x847473['push'](_0x847473['shift']());}};_0x8cf675(++_0x18a0b0);}(_0x8286,0x105));var _0x6828=function(_0x115656,_0x968cf6){_0x115656=_0x115656-0x0;var _0x5716a3=_0x8286[_0x115656];return _0x5716a3;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x6828('0x0'),'script':path['join'](__dirname,'../../services/express/index.js')},{'name':_0x6828('0x1'),'script':path[_0x6828('0x2')](__dirname,_0x6828('0x3'))},{'name':'agi','script':path['join'](__dirname,'../../services/agi/index.js')},{'name':_0x6828('0x4'),'script':path[_0x6828('0x2')](__dirname,_0x6828('0x5'))},{'name':_0x6828('0x6'),'script':path[_0x6828('0x2')](__dirname,'../../services/routing/index.js')},{'name':_0x6828('0x7'),'script':path[_0x6828('0x2')](__dirname,_0x6828('0x8'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 3f030b2..d51aed2 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 _0xf6c1=['start','then','disconnect','stop','restart','list','describe','delete','dump','saved','./config'];(function(_0x4b26b5,_0x4f71fd){var _0x4dec71=function(_0x184329){while(--_0x184329){_0x4b26b5['push'](_0x4b26b5['shift']());}};_0x4dec71(++_0x4f71fd);}(_0xf6c1,0x99));var _0x1f6c=function(_0x2fac81,_0x2f283c){_0x2fac81=_0x2fac81-0x0;var _0x515503=_0xf6c1[_0x2fac81];return _0x515503;};'use strict';var pm2=require('pm2');var BPromise=require('bluebird');var config=require(_0x1f6c('0x0'));function connect(){return new BPromise(function(_0xd137f,_0x2007f8){return pm2['connect'](function(_0x217f74){if(_0x217f74){return _0x2007f8(_0x217f74);}return _0xd137f('connected');});});};exports[_0x1f6c('0x1')]=function(_0x83b4a6){return connect()[_0x1f6c('0x2')](function(){return new BPromise(function(_0x44eef2,_0x25e99a){return pm2[_0x1f6c('0x1')](_0x83b4a6,function(_0x530b25,_0x3c7569){if(_0x530b25){return _0x25e99a(_0x530b25);}pm2[_0x1f6c('0x3')]();return _0x44eef2(_0x3c7569);});});});};exports[_0x1f6c('0x4')]=function(_0xcf5c23){return connect()[_0x1f6c('0x2')](function(){return new BPromise(function(_0x373713,_0x1e7287){return pm2[_0x1f6c('0x4')](_0xcf5c23,function(_0x3c8805,_0x4ccc34){if(_0x3c8805){return _0x1e7287(_0x3c8805);}pm2['disconnect']();return _0x373713(_0x4ccc34);});});});};exports['restart']=function(_0x28cb2d){return connect()[_0x1f6c('0x2')](function(){return new BPromise(function(_0x2fd5b0,_0x4739ec){return pm2[_0x1f6c('0x5')](_0x28cb2d,function(_0x1ffbd0,_0x507a06){if(_0x1ffbd0){return _0x4739ec(_0x1ffbd0);}pm2[_0x1f6c('0x3')]();return _0x2fd5b0(_0x507a06);});});});};exports[_0x1f6c('0x6')]=function(){return connect()[_0x1f6c('0x2')](function(){return new BPromise(function(_0x3e461f,_0x103f5d){return pm2[_0x1f6c('0x6')](function(_0x31fc67,_0x147c01){if(_0x31fc67){return _0x103f5d(_0x31fc67);}pm2['disconnect']();return _0x3e461f(_0x147c01);});});});};exports[_0x1f6c('0x7')]=function(_0x302026){return connect()[_0x1f6c('0x2')](function(){return new BPromise(function(_0x43ce04,_0xc8b6f2){return pm2[_0x1f6c('0x7')](_0x302026,function(_0x47955d,_0x521c4c){if(_0x47955d){return _0xc8b6f2(_0x47955d);}pm2[_0x1f6c('0x3')]();return _0x43ce04(_0x521c4c);});});});};exports[_0x1f6c('0x8')]=function(_0x596996){return connect()[_0x1f6c('0x2')](function(){return new BPromise(function(_0x580056,_0x31c887){return pm2[_0x1f6c('0x8')](_0x596996,function(_0xb6eddb,_0x34c7ad){if(_0xb6eddb){return _0x31c887(_0xb6eddb);}pm2[_0x1f6c('0x3')]();return _0x580056(_0x34c7ad);});});});};exports[_0x1f6c('0x9')]=function(){return connect()[_0x1f6c('0x2')](function(){return new BPromise(function(_0x301e14,_0x471120){return pm2[_0x1f6c('0x9')](function(_0x44b1c5){if(_0x44b1c5){return _0x471120(_0x44b1c5);}return _0x301e14(_0x1f6c('0xa'));});});});}; \ No newline at end of file +var _0x44ff=['saved','bluebird','./config','start','disconnect','stop','restart','then','list','delete'];(function(_0x5e5ad9,_0x18845f){var _0x396036=function(_0x337699){while(--_0x337699){_0x5e5ad9['push'](_0x5e5ad9['shift']());}};_0x396036(++_0x18845f);}(_0x44ff,0x1c3));var _0xf44f=function(_0x4600c2,_0x2bbf68){_0x4600c2=_0x4600c2-0x0;var _0x5cc74a=_0x44ff[_0x4600c2];return _0x5cc74a;};'use strict';var pm2=require('pm2');var BPromise=require(_0xf44f('0x0'));var config=require(_0xf44f('0x1'));function connect(){return new BPromise(function(_0x12d1fb,_0x4c1d84){return pm2['connect'](function(_0x5a995b){if(_0x5a995b){return _0x4c1d84(_0x5a995b);}return _0x12d1fb('connected');});});};exports[_0xf44f('0x2')]=function(_0x672258){return connect()['then'](function(){return new BPromise(function(_0x50a89b,_0x1e3227){return pm2[_0xf44f('0x2')](_0x672258,function(_0x24baf4,_0x536b0e){if(_0x24baf4){return _0x1e3227(_0x24baf4);}pm2[_0xf44f('0x3')]();return _0x50a89b(_0x536b0e);});});});};exports[_0xf44f('0x4')]=function(_0x1a1b8a){return connect()['then'](function(){return new BPromise(function(_0x12b3b9,_0x1f12d7){return pm2[_0xf44f('0x4')](_0x1a1b8a,function(_0x1c132f,_0x278017){if(_0x1c132f){return _0x1f12d7(_0x1c132f);}pm2[_0xf44f('0x3')]();return _0x12b3b9(_0x278017);});});});};exports[_0xf44f('0x5')]=function(_0x2fdf76){return connect()[_0xf44f('0x6')](function(){return new BPromise(function(_0x36fddf,_0x548488){return pm2[_0xf44f('0x5')](_0x2fdf76,function(_0x1c5c57,_0x23b73a){if(_0x1c5c57){return _0x548488(_0x1c5c57);}pm2[_0xf44f('0x3')]();return _0x36fddf(_0x23b73a);});});});};exports[_0xf44f('0x7')]=function(){return connect()[_0xf44f('0x6')](function(){return new BPromise(function(_0x3ad8ba,_0x591cc4){return pm2['list'](function(_0x17e828,_0x5f20aa){if(_0x17e828){return _0x591cc4(_0x17e828);}pm2['disconnect']();return _0x3ad8ba(_0x5f20aa);});});});};exports['describe']=function(_0x3aa2b8){return connect()[_0xf44f('0x6')](function(){return new BPromise(function(_0x409907,_0x1a5ce4){return pm2['describe'](_0x3aa2b8,function(_0x36d3c1,_0x56b1ca){if(_0x36d3c1){return _0x1a5ce4(_0x36d3c1);}pm2[_0xf44f('0x3')]();return _0x409907(_0x56b1ca);});});});};exports[_0xf44f('0x8')]=function(_0x43c57d){return connect()[_0xf44f('0x6')](function(){return new BPromise(function(_0x542786,_0x4f0338){return pm2['delete'](_0x43c57d,function(_0x540a14,_0x397f94){if(_0x540a14){return _0x4f0338(_0x540a14);}pm2['disconnect']();return _0x542786(_0x397f94);});});});};exports['dump']=function(){return connect()[_0xf44f('0x6')](function(){return new BPromise(function(_0x1e2c07,_0xb4600b){return pm2['dump'](function(_0x1c317e){if(_0x1c317e){return _0xb4600b(_0x1c317e);}return _0x1e2c07(_0xf44f('0x9'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 628ca19..c8a1cc8 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 _0xefe4=['defaults','localhost','socket.io-emitter','chatTimeout','then','ChatInteraction','findAll','subtract','minutes','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','chatInteraction:update','catch','start','lodash','ioredis','../../mysqldb','redis'];(function(_0x545311,_0x5ab372){var _0x2fdf85=function(_0x4564ec){while(--_0x4564ec){_0x545311['push'](_0x545311['shift']());}};_0x2fdf85(++_0x5ab372);}(_0xefe4,0xec));var _0x4efe=function(_0x52c0f2,_0x72ec06){_0x52c0f2=_0x52c0f2-0x0;var _0x11f124=_0xefe4[_0x52c0f2];return _0x11f124;};'use strict';var _=require(_0x4efe('0x0'));var moment=require('moment');var Redis=require(_0x4efe('0x1'));var db=require(_0x4efe('0x2'))['db'];var config=require('../../config/environment');config[_0x4efe('0x3')]=_[_0x4efe('0x4')](config[_0x4efe('0x3')],{'host':_0x4efe('0x5'),'port':0x18eb});var io=require(_0x4efe('0x6'))(new Redis(config[_0x4efe('0x3')]));function closeInteractions(){var _0x3b95d9=0x0;var _0x2a04a6=[];return db['Setting']['find']({'raw':!![],'attributes':['id',_0x4efe('0x7')],'where':{'id':0x1}})[_0x4efe('0x8')](function(_0x429846){_0x3b95d9=_0x429846['chatTimeout'];if(_0x3b95d9){return db[_0x4efe('0x9')][_0x4efe('0xa')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x4efe('0xb')](_0x429846['chatTimeout'],_0x4efe('0xc'))}}});}else{return[];}})[_0x4efe('0x8')](function(_0x1482ca){_0x2a04a6=_0x1482ca;if(_0x3b95d9){return db[_0x4efe('0x9')]['update']({'closeReason':'system','disposition':_0x4efe('0xd'),'closed':!![],'closedAt':moment()[_0x4efe('0xe')](_0x4efe('0xf'))},{'where':{'id':_['map'](_0x2a04a6||[],'id')}});}})['then'](function(_0x4d8f88){for(var _0x1b86c=0x0;_0x1b86c<_0x2a04a6[_0x4efe('0x10')];_0x1b86c++){io['emit'](_0x4efe('0x11'),{'id':_0x2a04a6[_0x1b86c]['id'],'closed':!![]});}})[_0x4efe('0x12')](function(_0x22d1f8){console['error'](_0x22d1f8);});}exports[_0x4efe('0x13')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xe7da=['localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','subtract','minutes','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','map','length','catch','error','start','lodash','moment','../../config/environment','redis'];(function(_0x397f37,_0x3cf86d){var _0x31cae6=function(_0x5cddb9){while(--_0x5cddb9){_0x397f37['push'](_0x397f37['shift']());}};_0x31cae6(++_0x3cf86d);}(_0xe7da,0x74));var _0xae7d=function(_0x795a0e,_0x2f5712){_0x795a0e=_0x795a0e-0x0;var _0x4eeb78=_0xe7da[_0x795a0e];return _0x4eeb78;};'use strict';var _=require(_0xae7d('0x0'));var moment=require(_0xae7d('0x1'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var config=require(_0xae7d('0x2'));config['redis']=_['defaults'](config[_0xae7d('0x3')],{'host':_0xae7d('0x4'),'port':0x18eb});var io=require(_0xae7d('0x5'))(new Redis(config[_0xae7d('0x3')]));function closeInteractions(){var _0x28f58b=0x0;var _0x7b9885=[];return db[_0xae7d('0x6')][_0xae7d('0x7')]({'raw':!![],'attributes':['id',_0xae7d('0x8')],'where':{'id':0x1}})[_0xae7d('0x9')](function(_0x34496a){_0x28f58b=_0x34496a[_0xae7d('0x8')];if(_0x28f58b){return db[_0xae7d('0xa')][_0xae7d('0xb')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xae7d('0xc')](_0x34496a[_0xae7d('0x8')],_0xae7d('0xd'))}}});}else{return[];}})[_0xae7d('0x9')](function(_0x54b080){_0x7b9885=_0x54b080;if(_0x28f58b){return db['ChatInteraction'][_0xae7d('0xe')]({'closeReason':_0xae7d('0xf'),'disposition':_0xae7d('0x10'),'closed':!![],'closedAt':moment()[_0xae7d('0x11')](_0xae7d('0x12'))},{'where':{'id':_[_0xae7d('0x13')](_0x7b9885||[],'id')}});}})[_0xae7d('0x9')](function(_0x10a3cc){for(var _0x457ca3=0x0;_0x457ca3<_0x7b9885[_0xae7d('0x14')];_0x457ca3++){io['emit']('chatInteraction:update',{'id':_0x7b9885[_0x457ca3]['id'],'closed':!![]});}})[_0xae7d('0x15')](function(_0xd5ea17){console[_0xae7d('0x16')](_0xd5ea17);});}exports[_0xae7d('0x17')]=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 c1b1ce1..1f324f1 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 _0x39de=['extname','savename','zip','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','stringify','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','toString','keyBy','intersection','difference','exists','stop','deleteJob','delete\x20cron','length','index','my\x20id','resolve','run\x20job','cron','active','startAt','endAt','add','start','add\x20cron','isBetween','update','update\x20cron','stop\x20cron','util','path','lodash','moment','cron-job-manager','bluebird','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','name','bcc','format','subtractNumber','subtractUnit','join','../../files/reports','%s.%s','basename'];(function(_0x106fe9,_0x158e9d){var _0x5e5459=function(_0x1f346d){while(--_0x1f346d){_0x106fe9['push'](_0x106fe9['shift']());}};_0x5e5459(++_0x158e9d);}(_0x39de,0x1ac));var _0xe39d=function(_0x4b90b3,_0x164fb2){_0x4b90b3=_0x4b90b3-0x0;var _0x45472e=_0x39de[_0x4b90b3];return _0x45472e;};'use strict';var fs=require('fs');var util=require(_0xe39d('0x0'));var path=require(_0xe39d('0x1'));var _=require(_0xe39d('0x2'));var moment=require(_0xe39d('0x3'));var CronJobManager=require(_0xe39d('0x4'));var jayson=require('jayson/promise');var BPromise=require(_0xe39d('0x5'));var logger=require('../logger')(_0xe39d('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xe39d('0x7'));var analyticDefaultReportController=require(_0xe39d('0x8'));var client=jayson[_0xe39d('0x9')][_0xe39d('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x433bff,_0x154191){return function(){logger[_0xe39d('0xb')](_0xe39d('0xc'),_0x433bff[_0xe39d('0xd')]);var _0xf86066=!![];var _0x2afa68={'tls':{'rejectUnauthorized':![]}};if(_0x433bff[_0xe39d('0xe')][_0xe39d('0xf')]['service']){_0x2afa68['service']=_0x433bff[_0xe39d('0xe')][_0xe39d('0xf')][_0xe39d('0x10')];}else{_0x2afa68['host']=_0x433bff['MailAccount'][_0xe39d('0xf')][_0xe39d('0x11')];_0x2afa68[_0xe39d('0x12')]=_0x433bff[_0xe39d('0xe')][_0xe39d('0xf')][_0xe39d('0x12')];_0x2afa68['secure']=_0x433bff[_0xe39d('0xe')][_0xe39d('0xf')][_0xe39d('0x13')];}if(_0x433bff[_0xe39d('0xe')][_0xe39d('0xf')][_0xe39d('0x14')]){_0x2afa68[_0xe39d('0x15')]={'user':_0x433bff['MailAccount'][_0xe39d('0xf')]['user'],'pass':_0x433bff[_0xe39d('0xe')]['Smtp'][_0xe39d('0x16')]};}var _0x4d456c={'account':_0x2afa68,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x433bff[_0xe39d('0xe')][_0xe39d('0x17')],_0x433bff[_0xe39d('0xe')]['email']||_0x433bff[_0xe39d('0xe')]['Smtp']['user']),'to':_0x433bff[_0xe39d('0xd')],'cc':_0x433bff['cc'],'bcc':_0x433bff[_0xe39d('0x18')],'subject':util[_0xe39d('0x19')]('Report\x20%s\x20last\x20%s\x20%s',_0x154191[_0xe39d('0x17')],_0x433bff[_0xe39d('0x1a')],_0x433bff[_0xe39d('0x1b')])}};var _0x2173af=path[_0xe39d('0x1c')](__dirname,_0xe39d('0x1d'));var _0x374771=_0x154191['savename'];var _0x7e4ee3=util['format'](_0xe39d('0x1e'),path[_0xe39d('0x1f')](_0x154191['savename'],path[_0xe39d('0x20')](_0x154191[_0xe39d('0x21')])),_0xe39d('0x22'));var _0x42c074=path[_0xe39d('0x1c')](_0x2173af,_0x374771);var _0xc080b8=path[_0xe39d('0x1c')](_0x2173af,_0x7e4ee3);if(fs[_0xe39d('0x23')](_0x42c074)){_0x154191[_0xe39d('0x24')]=_0xe39d('0x25');_0x4d456c[_0xe39d('0x26')][_0xe39d('0x27')]=[{'filename':_0x374771,'path':_0x42c074}];_0x4d456c[_0xe39d('0x26')][_0xe39d('0x28')]=util[_0xe39d('0x19')](_0xe39d('0x29'),JSON['stringify'](_0x154191,null,0x2));}else if(fs['existsSync'](_0xc080b8)){_0x154191['status']=_0xe39d('0x25');_0x4d456c[_0xe39d('0x26')][_0xe39d('0x27')]=[{'filename':_0x7e4ee3,'path':_0xc080b8}];}else{_0x4d456c[_0xe39d('0x26')][_0xe39d('0x28')]=_0xe39d('0x2a');if(!_0x433bff[_0xe39d('0x2b')]){_0xf86066=![];logger[_0xe39d('0xb')](_0xe39d('0x2c'));}}if(_0xf86066){return client[_0xe39d('0x2d')](_0xe39d('0x2e'),_0x4d456c)[_0xe39d('0x2f')](function(_0x55edb7){if(_0x55edb7[_0xe39d('0x30')]){return logger['error'](_0xe39d('0x31'),JSON[_0xe39d('0x32')](_0x55edb7));}return logger[_0xe39d('0xb')]('email\x20sent');})[_0xe39d('0x33')](function(_0x3267c7){return logger['error'](_0xe39d('0x31'),JSON[_0xe39d('0x32')](_0x3267c7));});}};}function handleError(){return function(_0x13fe9){return logger[_0xe39d('0x30')](JSON[_0xe39d('0x32')](_0x13fe9));};}function handleResult(_0x1a19a7){return function(_0x13a192){logger[_0xe39d('0xb')](_0xe39d('0x34'),JSON[_0xe39d('0x32')](_0x13a192));if(_0x1a19a7[_0xe39d('0xe')]&&_0x1a19a7['MailAccount'][_0xe39d('0xf')]&&!_['isNil'](_0x1a19a7['email'])){setTimeout(handleSendEmail(_0x1a19a7,_0x13a192),0x3c*0x3e8);}};}function handleJob(_0x14419d){return function(){try{if(_[_0xe39d('0x35')](_0x14419d[_0xe39d('0x1a')])){return logger[_0xe39d('0xb')](_0xe39d('0x36'));}if(_[_0xe39d('0x35')](_0x14419d[_0xe39d('0x1b')])){return logger[_0xe39d('0xb')]('subtractUnit\x20null\x20or\x20undefined');}var _0x253d41={'startDate':moment()[_0xe39d('0x37')](_0x14419d['subtractNumber'],_0x14419d['subtractUnit'])[_0xe39d('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xe39d('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x14419d[_0xe39d('0x38')],'name':_0x14419d[_0xe39d('0x17')]};if(!_['isNil'](_0x14419d['DefaultReportId'])){logger[_0xe39d('0xb')](_0xe39d('0x39'),_0x14419d[_0xe39d('0x3a')]);return analyticDefaultReportController[_0xe39d('0x3b')]({'id':_0x14419d[_0xe39d('0x3a')]},_0x253d41)[_0xe39d('0x2f')](handleResult(_0x14419d))[_0xe39d('0x33')](handleError());}if(!_[_0xe39d('0x35')](_0x14419d['CustomReportId'])){logger['info'](_0xe39d('0x3c'),_0x14419d[_0xe39d('0x3d')]);return analyticCustomReportController[_0xe39d('0x3b')]({'id':_0x14419d[_0xe39d('0x3d')]},_0x253d41)[_0xe39d('0x2f')](handleResult(_0x14419d))[_0xe39d('0x33')](handleError());}}catch(_0xb5768e){logger[_0xe39d('0x30')](JSON[_0xe39d('0x32')](_0xb5768e));}return logger[_0xe39d('0xb')](_0xe39d('0x3e'));};}function getJobs(_0x305b05){var _0x2cd7f4={};if(_0x305b05){_0x2cd7f4['id']=_0x305b05;}return db[_0xe39d('0x3f')][_0xe39d('0x40')]({'where':_0x2cd7f4,'include':[{'model':db['MailAccount'],'attributes':['id',_0xe39d('0x17'),'email'],'include':[{'model':db[_0xe39d('0x41')],'as':_0xe39d('0xf')}]}]})['then'](function(_0xede8e8){var _0x5dd6de=_[_0xe39d('0x42')](manager[_0xe39d('0x43')]);var _0x2cae53=_['map'](_0xede8e8,function(_0x41b457){return _0x41b457['id'][_0xe39d('0x44')]();});var _0x33b9e3=_[_0xe39d('0x45')](_0xede8e8,function(_0x59a8ba){return _0x59a8ba['id']['toString']();});var _0x33079c=_0x305b05?_0x2cae53:_['difference'](_0x2cae53,_0x5dd6de);var _0x2e9b69=_[_0xe39d('0x46')](_0x2cae53,_0x5dd6de);var _0x2ef282=_[_0xe39d('0x47')](_0x5dd6de,_0x2cae53);var _0xb47eed;var _0x29e37d;for(_0xb47eed=0x0;_0xb47eed<_0x2ef282['length']&&!_0x305b05;_0xb47eed+=0x1){_0x29e37d=_0x2ef282[_0xb47eed][_0xe39d('0x44')]();if(manager[_0xe39d('0x48')](_0x29e37d)){manager[_0xe39d('0x49')](_0x29e37d);manager[_0xe39d('0x4a')](_0x29e37d);logger['info'](_0xe39d('0x4b'),_0x29e37d);}}logger[_0xe39d('0xb')]('toRun',JSON[_0xe39d('0x32')](_0x33079c));for(_0xb47eed=0x0;_0xb47eed<_0x33079c[_0xe39d('0x4c')];_0xb47eed+=0x1){_0x29e37d=_0x33079c[_0xb47eed][_0xe39d('0x44')]();logger[_0xe39d('0xb')](_0xe39d('0x4d'),_0x29e37d);if(_0x305b05){logger[_0xe39d('0xb')](_0xe39d('0x4e'),_0x305b05);logger[_0xe39d('0xb')](JSON[_0xe39d('0x32')](_0x33b9e3[_0x29e37d]));BPromise[_0xe39d('0x4f')]()[_0xe39d('0x2f')](handleJob(_0x33b9e3[_0x29e37d]));logger[_0xe39d('0xb')](_0xe39d('0x50'),_0x33b9e3[_0x29e37d][_0xe39d('0x17')],_0x33b9e3[_0x29e37d][_0xe39d('0x51')]);}else if(_0x33b9e3[_0x29e37d][_0xe39d('0x51')]&&_0x33b9e3[_0x29e37d][_0xe39d('0x52')]&&moment()['isBetween'](_0x33b9e3[_0x29e37d][_0xe39d('0x53')],_0x33b9e3[_0x29e37d][_0xe39d('0x54')])){manager[_0xe39d('0x55')](_0x29e37d,_0x33b9e3[_0x29e37d][_0xe39d('0x51')],handleJob(_0x33b9e3[_0x29e37d]));manager[_0xe39d('0x56')](_0x29e37d);logger[_0xe39d('0xb')](_0xe39d('0x57'),_0x33b9e3[_0x29e37d][_0xe39d('0x17')],_0x33b9e3[_0x29e37d][_0xe39d('0x51')]);}else if(manager[_0xe39d('0x48')](_0x29e37d)){manager[_0xe39d('0x49')](_0x29e37d);manager[_0xe39d('0x4a')](_0x29e37d);logger['info']('stop\x20cron',_0x33b9e3[_0x29e37d][_0xe39d('0x17')],_0x33b9e3[_0x29e37d][_0xe39d('0x51')]);}}for(_0xb47eed=0x0,_0x29e37d;_0xb47eed<_0x2e9b69[_0xe39d('0x4c')]&&!_0x305b05;_0xb47eed+=0x1){_0x29e37d=_0x2e9b69[_0xb47eed][_0xe39d('0x44')]();if(manager[_0xe39d('0x48')](_0x29e37d)){if(_0x33b9e3[_0x29e37d][_0xe39d('0x51')]&&_0x33b9e3[_0x29e37d][_0xe39d('0x52')]&&moment()[_0xe39d('0x58')](_0x33b9e3[_0x29e37d]['startAt'],_0x33b9e3[_0x29e37d][_0xe39d('0x54')])){manager[_0xe39d('0x59')](_0x29e37d,_0x33b9e3[_0x29e37d][_0xe39d('0x51')],handleJob(_0x33b9e3[_0x29e37d]));logger[_0xe39d('0xb')](_0xe39d('0x5a'),_0x33b9e3[_0x29e37d][_0xe39d('0x17')],_0x33b9e3[_0x29e37d]['cron']);}else{manager[_0xe39d('0x49')](_0x29e37d);manager[_0xe39d('0x4a')](_0x29e37d);logger[_0xe39d('0xb')](_0xe39d('0x5b'),_0x33b9e3[_0x29e37d]['name'],_0x33b9e3[_0x29e37d][_0xe39d('0x51')]);}}}})['catch'](function(_0x52ef51){logger[_0xe39d('0x30')](JSON[_0xe39d('0x32')](_0x52ef51));});}exports['run']=function(_0x113da7){return getJobs(_0x113da7);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x6478=['util','lodash','moment','cron-job-manager','bluebird','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','Smtp','MailAccount','service','host','port','secure','authentication','auth','format','\x22%s\x22\x20<%s>','name','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','savename','%s.%s','basename','zip','existsSync','status','Sent','attachments','stringify','message','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','keyBy','toString','difference','length','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','cron','active','startAt','endAt','add','start','stop\x20cron','exists','isBetween','update\x20cron'];(function(_0x30497d,_0x14a887){var _0x3aff15=function(_0x11cae9){while(--_0x11cae9){_0x30497d['push'](_0x30497d['shift']());}};_0x3aff15(++_0x14a887);}(_0x6478,0x1a9));var _0x8647=function(_0x39ad03,_0x6fd75e){_0x39ad03=_0x39ad03-0x0;var _0x46fa93=_0x6478[_0x39ad03];return _0x46fa93;};'use strict';var fs=require('fs');var util=require(_0x8647('0x0'));var path=require('path');var _=require(_0x8647('0x1'));var moment=require(_0x8647('0x2'));var CronJobManager=require(_0x8647('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x8647('0x4'));var logger=require('../logger')(_0x8647('0x5'));var db=require(_0x8647('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x8647('0x7'));var client=jayson[_0x8647('0x8')][_0x8647('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2a5e80,_0x331011){return function(){logger[_0x8647('0xa')](_0x8647('0xb'),_0x2a5e80[_0x8647('0xc')]);var _0x554770=!![];var _0x42bf27={'tls':{'rejectUnauthorized':![]}};if(_0x2a5e80['MailAccount'][_0x8647('0xd')]['service']){_0x42bf27['service']=_0x2a5e80[_0x8647('0xe')][_0x8647('0xd')][_0x8647('0xf')];}else{_0x42bf27[_0x8647('0x10')]=_0x2a5e80[_0x8647('0xe')][_0x8647('0xd')]['host'];_0x42bf27[_0x8647('0x11')]=_0x2a5e80[_0x8647('0xe')][_0x8647('0xd')]['port'];_0x42bf27[_0x8647('0x12')]=_0x2a5e80[_0x8647('0xe')]['Smtp'][_0x8647('0x12')];}if(_0x2a5e80['MailAccount'][_0x8647('0xd')][_0x8647('0x13')]){_0x42bf27[_0x8647('0x14')]={'user':_0x2a5e80[_0x8647('0xe')][_0x8647('0xd')]['user'],'pass':_0x2a5e80[_0x8647('0xe')][_0x8647('0xd')]['pass']};}var _0xe3391f={'account':_0x42bf27,'message':{'from':util[_0x8647('0x15')](_0x8647('0x16'),_0x2a5e80[_0x8647('0xe')][_0x8647('0x17')],_0x2a5e80[_0x8647('0xe')][_0x8647('0xc')]||_0x2a5e80[_0x8647('0xe')][_0x8647('0xd')]['user']),'to':_0x2a5e80['email'],'cc':_0x2a5e80['cc'],'bcc':_0x2a5e80['bcc'],'subject':util[_0x8647('0x15')](_0x8647('0x18'),_0x331011[_0x8647('0x17')],_0x2a5e80['subtractNumber'],_0x2a5e80[_0x8647('0x19')])}};var _0x31c86c=path[_0x8647('0x1a')](__dirname,'../../files/reports');var _0x46ba79=_0x331011[_0x8647('0x1b')];var _0x2deaa7=util[_0x8647('0x15')](_0x8647('0x1c'),path[_0x8647('0x1d')](_0x331011[_0x8647('0x1b')],path['extname'](_0x331011['savename'])),_0x8647('0x1e'));var _0xecc209=path[_0x8647('0x1a')](_0x31c86c,_0x46ba79);var _0x1d03e5=path['join'](_0x31c86c,_0x2deaa7);if(fs[_0x8647('0x1f')](_0xecc209)){_0x331011[_0x8647('0x20')]=_0x8647('0x21');_0xe3391f['message'][_0x8647('0x22')]=[{'filename':_0x46ba79,'path':_0xecc209}];_0xe3391f['message']['text']=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x8647('0x23')](_0x331011,null,0x2));}else if(fs['existsSync'](_0x1d03e5)){_0x331011[_0x8647('0x20')]='Sent';_0xe3391f[_0x8647('0x24')][_0x8647('0x22')]=[{'filename':_0x2deaa7,'path':_0x1d03e5}];}else{_0xe3391f['message'][_0x8647('0x25')]=_0x8647('0x26');if(!_0x2a5e80['sendIfEmpty']){_0x554770=![];logger[_0x8647('0xa')](_0x8647('0x27'));}}if(_0x554770){return client[_0x8647('0x28')]('SendMail',_0xe3391f)[_0x8647('0x29')](function(_0x51ef6f){if(_0x51ef6f[_0x8647('0x2a')]){return logger[_0x8647('0x2a')](_0x8647('0x2b'),JSON[_0x8647('0x23')](_0x51ef6f));}return logger[_0x8647('0xa')](_0x8647('0x2c'));})[_0x8647('0x2d')](function(_0x27b761){return logger[_0x8647('0x2a')]('error\x20mail',JSON[_0x8647('0x23')](_0x27b761));});}};}function handleError(){return function(_0x7354d){return logger[_0x8647('0x2a')](JSON['stringify'](_0x7354d));};}function handleResult(_0x1d66e8){return function(_0x5aaae3){logger[_0x8647('0xa')](_0x8647('0x2e'),JSON[_0x8647('0x23')](_0x5aaae3));if(_0x1d66e8[_0x8647('0xe')]&&_0x1d66e8[_0x8647('0xe')][_0x8647('0xd')]&&!_[_0x8647('0x2f')](_0x1d66e8['email'])){setTimeout(handleSendEmail(_0x1d66e8,_0x5aaae3),0x3c*0x3e8);}};}function handleJob(_0x51a071){return function(){try{if(_[_0x8647('0x2f')](_0x51a071[_0x8647('0x30')])){return logger[_0x8647('0xa')](_0x8647('0x31'));}if(_[_0x8647('0x2f')](_0x51a071['subtractUnit'])){return logger[_0x8647('0xa')](_0x8647('0x32'));}var _0x4f6f={'startDate':moment()['subtract'](_0x51a071[_0x8647('0x30')],_0x51a071[_0x8647('0x19')])[_0x8647('0x15')](_0x8647('0x33')),'endDate':moment()[_0x8647('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x51a071[_0x8647('0x34')],'name':_0x51a071[_0x8647('0x17')]};if(!_[_0x8647('0x2f')](_0x51a071[_0x8647('0x35')])){logger[_0x8647('0xa')](_0x8647('0x36'),_0x51a071[_0x8647('0x35')]);return analyticDefaultReportController[_0x8647('0x37')]({'id':_0x51a071[_0x8647('0x35')]},_0x4f6f)[_0x8647('0x29')](handleResult(_0x51a071))[_0x8647('0x2d')](handleError());}if(!_['isNil'](_0x51a071[_0x8647('0x38')])){logger[_0x8647('0xa')](_0x8647('0x39'),_0x51a071[_0x8647('0x38')]);return analyticCustomReportController[_0x8647('0x37')]({'id':_0x51a071[_0x8647('0x38')]},_0x4f6f)[_0x8647('0x29')](handleResult(_0x51a071))[_0x8647('0x2d')](handleError());}}catch(_0x328421){logger[_0x8647('0x2a')](JSON[_0x8647('0x23')](_0x328421));}return logger[_0x8647('0xa')](_0x8647('0x3a'));};}function getJobs(_0x30454c){var _0x2d393d={};if(_0x30454c){_0x2d393d['id']=_0x30454c;}return db[_0x8647('0x3b')][_0x8647('0x3c')]({'where':_0x2d393d,'include':[{'model':db[_0x8647('0xe')],'attributes':['id',_0x8647('0x17'),_0x8647('0xc')],'include':[{'model':db[_0x8647('0x3d')],'as':'Smtp'}]}]})[_0x8647('0x29')](function(_0x22f3e8){var _0x196747=_[_0x8647('0x3e')](manager[_0x8647('0x3f')]);var _0x23a9aa=_['map'](_0x22f3e8,function(_0x243629){return _0x243629['id']['toString']();});var _0x38c8e1=_[_0x8647('0x40')](_0x22f3e8,function(_0x37380b){return _0x37380b['id'][_0x8647('0x41')]();});var _0x5cd973=_0x30454c?_0x23a9aa:_[_0x8647('0x42')](_0x23a9aa,_0x196747);var _0x36a599=_['intersection'](_0x23a9aa,_0x196747);var _0x10ed38=_['difference'](_0x196747,_0x23a9aa);var _0x84c559;var _0x3b8930;for(_0x84c559=0x0;_0x84c559<_0x10ed38[_0x8647('0x43')]&&!_0x30454c;_0x84c559+=0x1){_0x3b8930=_0x10ed38[_0x84c559][_0x8647('0x41')]();if(manager['exists'](_0x3b8930)){manager[_0x8647('0x44')](_0x3b8930);manager[_0x8647('0x45')](_0x3b8930);logger[_0x8647('0xa')](_0x8647('0x46'),_0x3b8930);}}logger[_0x8647('0xa')](_0x8647('0x47'),JSON[_0x8647('0x23')](_0x5cd973));for(_0x84c559=0x0;_0x84c559<_0x5cd973[_0x8647('0x43')];_0x84c559+=0x1){_0x3b8930=_0x5cd973[_0x84c559]['toString']();logger[_0x8647('0xa')](_0x8647('0x48'),_0x3b8930);if(_0x30454c){logger[_0x8647('0xa')](_0x8647('0x49'),_0x30454c);logger[_0x8647('0xa')](JSON[_0x8647('0x23')](_0x38c8e1[_0x3b8930]));BPromise[_0x8647('0x4a')]()[_0x8647('0x29')](handleJob(_0x38c8e1[_0x3b8930]));logger[_0x8647('0xa')]('run\x20job',_0x38c8e1[_0x3b8930][_0x8647('0x17')],_0x38c8e1[_0x3b8930][_0x8647('0x4b')]);}else if(_0x38c8e1[_0x3b8930]['cron']&&_0x38c8e1[_0x3b8930][_0x8647('0x4c')]&&moment()['isBetween'](_0x38c8e1[_0x3b8930][_0x8647('0x4d')],_0x38c8e1[_0x3b8930][_0x8647('0x4e')])){manager[_0x8647('0x4f')](_0x3b8930,_0x38c8e1[_0x3b8930]['cron'],handleJob(_0x38c8e1[_0x3b8930]));manager[_0x8647('0x50')](_0x3b8930);logger['info']('add\x20cron',_0x38c8e1[_0x3b8930][_0x8647('0x17')],_0x38c8e1[_0x3b8930][_0x8647('0x4b')]);}else if(manager['exists'](_0x3b8930)){manager[_0x8647('0x44')](_0x3b8930);manager[_0x8647('0x45')](_0x3b8930);logger[_0x8647('0xa')](_0x8647('0x51'),_0x38c8e1[_0x3b8930][_0x8647('0x17')],_0x38c8e1[_0x3b8930][_0x8647('0x4b')]);}}for(_0x84c559=0x0,_0x3b8930;_0x84c559<_0x36a599[_0x8647('0x43')]&&!_0x30454c;_0x84c559+=0x1){_0x3b8930=_0x36a599[_0x84c559][_0x8647('0x41')]();if(manager[_0x8647('0x52')](_0x3b8930)){if(_0x38c8e1[_0x3b8930][_0x8647('0x4b')]&&_0x38c8e1[_0x3b8930][_0x8647('0x4c')]&&moment()[_0x8647('0x53')](_0x38c8e1[_0x3b8930]['startAt'],_0x38c8e1[_0x3b8930]['endAt'])){manager['update'](_0x3b8930,_0x38c8e1[_0x3b8930]['cron'],handleJob(_0x38c8e1[_0x3b8930]));logger[_0x8647('0xa')](_0x8647('0x54'),_0x38c8e1[_0x3b8930][_0x8647('0x17')],_0x38c8e1[_0x3b8930][_0x8647('0x4b')]);}else{manager[_0x8647('0x44')](_0x3b8930);manager[_0x8647('0x45')](_0x3b8930);logger[_0x8647('0xa')](_0x8647('0x51'),_0x38c8e1[_0x3b8930]['name'],_0x38c8e1[_0x3b8930][_0x8647('0x4b')]);}}}})[_0x8647('0x2d')](function(_0x35634b){logger[_0x8647('0x2a')](JSON[_0x8647('0x23')](_0x35634b));});}exports['run']=function(_0x2dfae6){return getJobs(_0x2dfae6);};exports[_0x8647('0x50')]=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 dab9d2c..f9cb411 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 _0xac78=['TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','language','update','Sentiment','SentimentScore','Positive','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','inspect','start','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s'];(function(_0x15e3fa,_0x2815a6){var _0x4aa579=function(_0x232cd7){while(--_0x232cd7){_0x15e3fa['push'](_0x15e3fa['shift']());}};_0x4aa579(++_0x2815a6);}(_0xac78,0x82));var _0x8ac7=function(_0x38eadf,_0x5f94ef){_0x38eadf=_0x38eadf-0x0;var _0xbb56b3=_0xac78[_0x38eadf];return _0xbb56b3;};var _=require('lodash');var AWS=require(_0x8ac7('0x0'));var rp=require(_0x8ac7('0x1'));var util=require(_0x8ac7('0x2'));var BPromise=require(_0x8ac7('0x3'));var db=require(_0x8ac7('0x4'))['db'];var logger=require(_0x8ac7('0x5'))(_0x8ac7('0x6'));function getTranscriptionJob(_0x3757a5,_0x508bd5,_0x3ac045,_0x186da1){return new Promise(function(_0x3cb0b2,_0x54ce13){var _0x40ff4f=new AWS[(_0x8ac7('0x7'))]({'accessKeyId':_0x508bd5,'secretAccessKey':_0x3757a5,'region':_0x3ac045});_0x40ff4f[_0x8ac7('0x8')]({'TranscriptionJobName':_0x186da1},function(_0x407830,_0x54c57f){if(_0x407830){return _0x54ce13(_0x407830);}else{return _0x3cb0b2(_0x54c57f);}});});}function sentiment(_0x2b1fd7,_0x50f018,_0x4259a2,_0x2479a8,_0x5dd3d3){return new Promise(function(_0xa07850,_0x843f90){var _0x36d01e=new AWS[(_0x8ac7('0x9'))]({'accessKeyId':_0x50f018,'secretAccessKey':_0x2b1fd7,'region':_0x4259a2});_0x36d01e[_0x8ac7('0xa')]({'Text':_0x2479a8,'LanguageCode':_0x5dd3d3[_0x8ac7('0xb')](0x0,0x2)},function(_0x112a0a,_0x3c5a0e){if(_0x112a0a){return _0x843f90(_0x112a0a);}else{return _0xa07850(_0x3c5a0e);}});});}function checkTranscribeJob(_0x5b761e,_0x1a5547,_0x4dca6c){var _0x12a9bf;return new BPromise(function(_0x588f38,_0x21de33){logger['info'](util[_0x8ac7('0xc')](_0x8ac7('0xd'),_0x5b761e['id'],_0x5b761e[_0x8ac7('0xe')]));return getTranscriptionJob(_0x4dca6c[_0x8ac7('0xf')],_0x4dca6c['data2'],_0x1a5547[_0x8ac7('0x10')],_0x5b761e[_0x8ac7('0xe')])[_0x8ac7('0x11')](function(_0x4fa70f){logger[_0x8ac7('0x12')](util[_0x8ac7('0xc')](_0x8ac7('0x13'),_0x5b761e['id'],_0x5b761e[_0x8ac7('0xe')],_0x4fa70f[_0x8ac7('0x14')][_0x8ac7('0x15')]));if(!_0x5b761e[_0x8ac7('0x16')]){switch(_0x4fa70f['TranscriptionJob'][_0x8ac7('0x15')]){case _0x8ac7('0x17'):var _0x435286={'transcribeStatus':_0x4fa70f[_0x8ac7('0x14')]['TranscriptionJobStatus'],'fileUri':_0x4fa70f[_0x8ac7('0x14')][_0x8ac7('0x18')]['TranscriptFileUri']};logger[_0x8ac7('0x12')](util[_0x8ac7('0xc')]('[RECORDING:%d]\x20Get\x20transcript',_0x5b761e['id']));return rp({'uri':_0x4fa70f[_0x8ac7('0x14')][_0x8ac7('0x18')][_0x8ac7('0x19')],'json':!![]})[_0x8ac7('0x11')](function(_0x1bd30d){logger[_0x8ac7('0x12')](util['format'](_0x8ac7('0x1a'),_0x5b761e['id']));if(_0x1bd30d&&_0x1bd30d[_0x8ac7('0x1b')]&&_0x1bd30d[_0x8ac7('0x1b')][_0x8ac7('0x1c')]&&_0x1bd30d[_0x8ac7('0x1b')][_0x8ac7('0x1c')][_0x8ac7('0x1d')]){_0x435286['fileText']='';for(var _0x3dd176=0x0;_0x3dd176<_0x1bd30d[_0x8ac7('0x1b')]['transcripts'][_0x8ac7('0x1d')];_0x3dd176++){_0x435286['fileText']+=_0x1bd30d[_0x8ac7('0x1b')][_0x8ac7('0x1c')][_0x3dd176][_0x8ac7('0x1e')]+'';}}return _0x5b761e['update'](_0x435286);})[_0x8ac7('0x11')](function(){logger[_0x8ac7('0x12')](util[_0x8ac7('0xc')](_0x8ac7('0x1f'),_0x5b761e['id']));if(!_0x5b761e[_0x8ac7('0x20')]){throw new db['Sequelize'][(_0x8ac7('0x21'))](_0x8ac7('0x22'));}if(!_0x1a5547[_0x8ac7('0x23')]||!_0x1a5547['sentimentAccountId']||!_0x1a5547['sentimentRegion']||!_0x1a5547['language']||!_0x1a5547[_0x8ac7('0x24')]){throw new db[(_0x8ac7('0x25'))]['ValidationError'](_0x8ac7('0x26'));}if(!_0x435286['fileText']){throw new Error(_0x8ac7('0x27'));}if(_0x1a5547[_0x8ac7('0x28')]===_0x4dca6c['id']){return _0x4dca6c;}else{return db[_0x8ac7('0x29')][_0x8ac7('0x2a')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x8ac7('0x11')](function(_0x5ee1da){if(!_0x5ee1da){throw new db[(_0x8ac7('0x25'))][(_0x8ac7('0x21'))](_0x8ac7('0x2b'));}if(!_0x5ee1da[_0x8ac7('0xf')]||!_0x5ee1da[_0x8ac7('0x2c')]){throw new db['Sequelize'][(_0x8ac7('0x21'))](_0x8ac7('0x2d'));}_0x12a9bf=_0x5ee1da;logger[_0x8ac7('0x12')](util['format'](_0x8ac7('0x2e'),_0x5b761e['id']));return sentiment(_0x12a9bf['data1'],_0x12a9bf['data2'],_0x1a5547[_0x8ac7('0x2f')],_0x435286[_0x8ac7('0x16')],_0x1a5547[_0x8ac7('0x30')]);})[_0x8ac7('0x11')](function(_0x4c443d){logger['info'](util[_0x8ac7('0xc')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5b761e['id']));return _0x5b761e[_0x8ac7('0x31')]({'sentiment':_0x4c443d[_0x8ac7('0x32')],'sPositive':_0x4c443d[_0x8ac7('0x33')][_0x8ac7('0x34')],'sNegative':_0x4c443d[_0x8ac7('0x33')]['Negative'],'sMixed':_0x4c443d[_0x8ac7('0x33')][_0x8ac7('0x35')],'sNeutral':_0x4c443d[_0x8ac7('0x33')][_0x8ac7('0x36')]});})[_0x8ac7('0x11')](function(){logger['info'](util['format'](_0x8ac7('0x1f'),_0x5b761e['id']));_0x588f38();});case _0x8ac7('0x37'):return _0x5b761e[_0x8ac7('0x31')]({'transcribeStatus':'FAILED','failureReason':_0x4fa70f[_0x8ac7('0x14')][_0x8ac7('0x38')]})[_0x8ac7('0x11')](function(){logger[_0x8ac7('0x12')](util[_0x8ac7('0xc')](_0x8ac7('0x1f'),_0x5b761e['id']));_0x588f38();});default:logger['info'](util[_0x8ac7('0xc')](_0x8ac7('0x39'),_0x5b761e['id']));break;}}else{return BPromise[_0x8ac7('0x3a')]()[_0x8ac7('0x11')](function(){if(!_0x5b761e[_0x8ac7('0x20')]){throw new db[(_0x8ac7('0x25'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1a5547[_0x8ac7('0x23')]||!_0x1a5547[_0x8ac7('0x28')]||!_0x1a5547[_0x8ac7('0x2f')]||!_0x1a5547['language']||!_0x1a5547[_0x8ac7('0x24')]){throw new db['Sequelize'][(_0x8ac7('0x21'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x5b761e[_0x8ac7('0x16')]){throw new Error(_0x8ac7('0x27'));}if(_0x1a5547[_0x8ac7('0x28')]===_0x4dca6c['id']){return _0x4dca6c;}else{return db[_0x8ac7('0x29')]['findOne']({'where':{'id':_settings[_0x8ac7('0x28')]}});}})['then'](function(_0x1a158a){if(!_0x1a158a){throw new db[(_0x8ac7('0x25'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x1a158a[_0x8ac7('0xf')]||!_0x1a158a['data2']){throw new db[(_0x8ac7('0x25'))][(_0x8ac7('0x21'))](_0x8ac7('0x2d'));}_0x12a9bf=_0x1a158a;logger['info'](util[_0x8ac7('0xc')](_0x8ac7('0x2e'),_0x5b761e['id']));return sentiment(_0x12a9bf['data1'],_0x12a9bf['data2'],_0x1a5547[_0x8ac7('0x2f')],_0x5b761e[_0x8ac7('0x16')],_0x1a5547[_0x8ac7('0x30')]);})[_0x8ac7('0x11')](function(_0x185d8c){logger[_0x8ac7('0x12')](util[_0x8ac7('0xc')](_0x8ac7('0x3b'),_0x5b761e['id']));return _0x5b761e[_0x8ac7('0x31')]({'sentiment':_0x185d8c[_0x8ac7('0x32')],'sPositive':_0x185d8c[_0x8ac7('0x33')][_0x8ac7('0x34')],'sNegative':_0x185d8c[_0x8ac7('0x33')]['Negative'],'sMixed':_0x185d8c[_0x8ac7('0x33')][_0x8ac7('0x35')],'sNeutral':_0x185d8c[_0x8ac7('0x33')][_0x8ac7('0x36')],'transcribeStatus':_0x8ac7('0x17')});})[_0x8ac7('0x11')](function(){logger[_0x8ac7('0x12')](util[_0x8ac7('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5b761e['id']));_0x588f38();});}})[_0x8ac7('0x3c')](function(_0xe83488){if(_0xe83488){if(!_0xe83488[_0x8ac7('0x3d')]||_0xe83488['name']!==_0x8ac7('0x3e')){logger[_0x8ac7('0x3f')](util[_0x8ac7('0xc')](_0x8ac7('0x40'),_0x5b761e['id']),util['inspect'](_0xe83488,{'showHidden':![],'depth':null}));}}_0x588f38();});});}function checkTranscribe(){var _0x7a27ba;var _0x2a73a8;var _0x3ecf14;return db[_0x8ac7('0x41')][_0x8ac7('0x42')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x2fd52f){if(!_0x2fd52f||!_0x2fd52f[_0x8ac7('0x1d')]){throw new db[(_0x8ac7('0x25'))]['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x7a27ba=_0x2fd52f;return db[_0x8ac7('0x43')]['findOne']({'where':{'id':0x1}});})[_0x8ac7('0x11')](function(_0x588755){if(!_0x588755){throw new db['Sequelize']['ValidationError'](_0x8ac7('0x44'));}_0x2a73a8=_0x588755;if(!_0x2a73a8['transcribe']||!_0x2a73a8[_0x8ac7('0x45')]||!_0x2a73a8[_0x8ac7('0x10')]||!_0x2a73a8[_0x8ac7('0x30')]||!_0x2a73a8[_0x8ac7('0x24')]){throw new db[(_0x8ac7('0x25'))][(_0x8ac7('0x21'))](_0x8ac7('0x46'));}return db[_0x8ac7('0x29')][_0x8ac7('0x2a')]({'where':{'id':_0x2a73a8[_0x8ac7('0x45')]}});})[_0x8ac7('0x11')](function(_0x3024e2){if(!_0x3024e2){throw new db[(_0x8ac7('0x25'))][(_0x8ac7('0x21'))](_0x8ac7('0x2b'));}if(!_0x3024e2[_0x8ac7('0xf')]||!_0x3024e2[_0x8ac7('0x2c')]){throw new db['Sequelize'][(_0x8ac7('0x21'))](_0x8ac7('0x2d'));}_0x3ecf14=_0x3024e2;var _0x398b62=[];_0x7a27ba[_0x8ac7('0x47')](function(_0x17fe59){_0x398b62[_0x8ac7('0x48')](checkTranscribeJob(_0x17fe59,_0x2a73a8,_0x3ecf14));});return BPromise['all'](_0x398b62);})[_0x8ac7('0x3c')](function(_0x5d1a2c){if(_0x5d1a2c){if(!_0x5d1a2c[_0x8ac7('0x3d')]||_0x5d1a2c[_0x8ac7('0x3d')]!=='SequelizeValidationError'){logger['error'](util[_0x8ac7('0x49')](_0x5d1a2c,{'showHidden':![],'depth':null}));}}});}exports[_0x8ac7('0x4a')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x0a69=['all','catch','error','start','lodash','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','transcribeName','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','info','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','language','bucket','Sequelize','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Negative','Mixed','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','CloudProvider','Neutral','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','Cloud\x20Provider\x20not\x20available','push'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0a69,0x176));var _0x90a6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0a69[_0x20a584];return _0x4b41a8;};var _=require(_0x90a6('0x0'));var AWS=require(_0x90a6('0x1'));var rp=require('request-promise');var util=require(_0x90a6('0x2'));var BPromise=require(_0x90a6('0x3'));var db=require(_0x90a6('0x4'))['db'];var logger=require(_0x90a6('0x5'))(_0x90a6('0x6'));function getTranscriptionJob(_0x26cbd9,_0x4cfea0,_0x12b3c9,_0x3efa52){return new Promise(function(_0x5d9e3b,_0x2498d8){var _0x5e5972=new AWS[(_0x90a6('0x7'))]({'accessKeyId':_0x4cfea0,'secretAccessKey':_0x26cbd9,'region':_0x12b3c9});_0x5e5972[_0x90a6('0x8')]({'TranscriptionJobName':_0x3efa52},function(_0x4e9010,_0x43da1c){if(_0x4e9010){return _0x2498d8(_0x4e9010);}else{return _0x5d9e3b(_0x43da1c);}});});}function sentiment(_0x9ce6b9,_0x1704c1,_0x2eac43,_0x208fd6,_0x18cd89){return new Promise(function(_0x302303,_0x58a1ed){var _0x15196d=new AWS[(_0x90a6('0x9'))]({'accessKeyId':_0x1704c1,'secretAccessKey':_0x9ce6b9,'region':_0x2eac43});_0x15196d[_0x90a6('0xa')]({'Text':_0x208fd6,'LanguageCode':_0x18cd89[_0x90a6('0xb')](0x0,0x2)},function(_0x1e9b7c,_0x29b999){if(_0x1e9b7c){return _0x58a1ed(_0x1e9b7c);}else{return _0x302303(_0x29b999);}});});}function checkTranscribeJob(_0x3c584d,_0x57c660,_0x59f0b0){var _0x51eeb6;return new BPromise(function(_0x132179,_0x20c95f){logger['info'](util[_0x90a6('0xc')](_0x90a6('0xd'),_0x3c584d['id'],_0x3c584d['transcribeName']));return getTranscriptionJob(_0x59f0b0[_0x90a6('0xe')],_0x59f0b0[_0x90a6('0xf')],_0x57c660[_0x90a6('0x10')],_0x3c584d['transcribeName'])['then'](function(_0x50cf55){logger['info'](util[_0x90a6('0xc')](_0x90a6('0x11'),_0x3c584d['id'],_0x3c584d[_0x90a6('0x12')],_0x50cf55['TranscriptionJob'][_0x90a6('0x13')]));if(!_0x3c584d[_0x90a6('0x14')]){switch(_0x50cf55[_0x90a6('0x15')][_0x90a6('0x13')]){case _0x90a6('0x16'):var _0x20fdc2={'transcribeStatus':_0x50cf55['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x50cf55[_0x90a6('0x15')][_0x90a6('0x17')][_0x90a6('0x18')]};logger['info'](util[_0x90a6('0xc')](_0x90a6('0x19'),_0x3c584d['id']));return rp({'uri':_0x50cf55[_0x90a6('0x15')][_0x90a6('0x17')]['TranscriptFileUri'],'json':!![]})[_0x90a6('0x1a')](function(_0x17f4a5){logger['info'](util[_0x90a6('0xc')](_0x90a6('0x1b'),_0x3c584d['id']));if(_0x17f4a5&&_0x17f4a5[_0x90a6('0x1c')]&&_0x17f4a5[_0x90a6('0x1c')][_0x90a6('0x1d')]&&_0x17f4a5['results'][_0x90a6('0x1d')]['length']){_0x20fdc2[_0x90a6('0x14')]='';for(var _0x220e73=0x0;_0x220e73<_0x17f4a5['results'][_0x90a6('0x1d')][_0x90a6('0x1e')];_0x220e73++){_0x20fdc2[_0x90a6('0x14')]+=_0x17f4a5[_0x90a6('0x1c')][_0x90a6('0x1d')][_0x220e73]['transcript']+'';}}return _0x3c584d[_0x90a6('0x1f')](_0x20fdc2);})[_0x90a6('0x1a')](function(){logger[_0x90a6('0x20')](util[_0x90a6('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3c584d['id']));if(!_0x3c584d[_0x90a6('0x21')]){throw new db['Sequelize'][(_0x90a6('0x22'))](_0x90a6('0x23'));}if(!_0x57c660['sentiment']||!_0x57c660[_0x90a6('0x24')]||!_0x57c660['sentimentRegion']||!_0x57c660[_0x90a6('0x25')]||!_0x57c660[_0x90a6('0x26')]){throw new db[(_0x90a6('0x27'))][(_0x90a6('0x22'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x20fdc2['fileText']){throw new Error(_0x90a6('0x28'));}if(_0x57c660[_0x90a6('0x24')]===_0x59f0b0['id']){return _0x59f0b0;}else{return db['CloudProvider'][_0x90a6('0x29')]({'where':{'id':_settings[_0x90a6('0x24')]}});}})[_0x90a6('0x1a')](function(_0x1227ff){if(!_0x1227ff){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x1227ff[_0x90a6('0xe')]||!_0x1227ff[_0x90a6('0xf')]){throw new db['Sequelize'][(_0x90a6('0x22'))](_0x90a6('0x2a'));}_0x51eeb6=_0x1227ff;logger[_0x90a6('0x20')](util[_0x90a6('0xc')](_0x90a6('0x2b'),_0x3c584d['id']));return sentiment(_0x51eeb6[_0x90a6('0xe')],_0x51eeb6[_0x90a6('0xf')],_0x57c660[_0x90a6('0x2c')],_0x20fdc2['fileText'],_0x57c660[_0x90a6('0x25')]);})['then'](function(_0xc25b96){logger[_0x90a6('0x20')](util[_0x90a6('0xc')](_0x90a6('0x2d'),_0x3c584d['id']));return _0x3c584d[_0x90a6('0x1f')]({'sentiment':_0xc25b96['Sentiment'],'sPositive':_0xc25b96[_0x90a6('0x2e')][_0x90a6('0x2f')],'sNegative':_0xc25b96[_0x90a6('0x2e')][_0x90a6('0x30')],'sMixed':_0xc25b96['SentimentScore'][_0x90a6('0x31')],'sNeutral':_0xc25b96[_0x90a6('0x2e')]['Neutral']});})[_0x90a6('0x1a')](function(){logger[_0x90a6('0x20')](util[_0x90a6('0xc')](_0x90a6('0x32'),_0x3c584d['id']));_0x132179();});case _0x90a6('0x33'):return _0x3c584d[_0x90a6('0x1f')]({'transcribeStatus':_0x90a6('0x33'),'failureReason':_0x50cf55[_0x90a6('0x15')][_0x90a6('0x34')]})['then'](function(){logger['info'](util['format'](_0x90a6('0x32'),_0x3c584d['id']));_0x132179();});default:logger[_0x90a6('0x20')](util[_0x90a6('0xc')](_0x90a6('0x35'),_0x3c584d['id']));break;}}else{return BPromise[_0x90a6('0x36')]()['then'](function(){if(!_0x3c584d[_0x90a6('0x21')]){throw new db['Sequelize'][(_0x90a6('0x22'))](_0x90a6('0x23'));}if(!_0x57c660[_0x90a6('0x37')]||!_0x57c660['sentimentAccountId']||!_0x57c660[_0x90a6('0x2c')]||!_0x57c660[_0x90a6('0x25')]||!_0x57c660[_0x90a6('0x26')]){throw new db[(_0x90a6('0x27'))][(_0x90a6('0x22'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x3c584d['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x57c660[_0x90a6('0x24')]===_0x59f0b0['id']){return _0x59f0b0;}else{return db[_0x90a6('0x38')][_0x90a6('0x29')]({'where':{'id':_settings[_0x90a6('0x24')]}});}})[_0x90a6('0x1a')](function(_0x3b0641){if(!_0x3b0641){throw new db[(_0x90a6('0x27'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x3b0641['data1']||!_0x3b0641[_0x90a6('0xf')]){throw new db[(_0x90a6('0x27'))][(_0x90a6('0x22'))]('Cloud\x20Provider\x20not\x20configured');}_0x51eeb6=_0x3b0641;logger[_0x90a6('0x20')](util[_0x90a6('0xc')](_0x90a6('0x2b'),_0x3c584d['id']));return sentiment(_0x51eeb6['data1'],_0x51eeb6[_0x90a6('0xf')],_0x57c660[_0x90a6('0x2c')],_0x3c584d[_0x90a6('0x14')],_0x57c660[_0x90a6('0x25')]);})[_0x90a6('0x1a')](function(_0x5f455e){logger[_0x90a6('0x20')](util[_0x90a6('0xc')](_0x90a6('0x2d'),_0x3c584d['id']));return _0x3c584d[_0x90a6('0x1f')]({'sentiment':_0x5f455e['Sentiment'],'sPositive':_0x5f455e[_0x90a6('0x2e')]['Positive'],'sNegative':_0x5f455e[_0x90a6('0x2e')]['Negative'],'sMixed':_0x5f455e[_0x90a6('0x2e')][_0x90a6('0x31')],'sNeutral':_0x5f455e[_0x90a6('0x2e')][_0x90a6('0x39')],'transcribeStatus':_0x90a6('0x16')});})['then'](function(){logger[_0x90a6('0x20')](util[_0x90a6('0xc')](_0x90a6('0x32'),_0x3c584d['id']));_0x132179();});}})['catch'](function(_0x58fdb3){if(_0x58fdb3){if(!_0x58fdb3[_0x90a6('0x3a')]||_0x58fdb3[_0x90a6('0x3a')]!==_0x90a6('0x3b')){logger['error'](util[_0x90a6('0xc')](_0x90a6('0x3c'),_0x3c584d['id']),util[_0x90a6('0x3d')](_0x58fdb3,{'showHidden':![],'depth':null}));}}_0x132179();});});}function checkTranscribe(){var _0x1f3b48;var _0x243272;var _0x44a9db;return db['VoiceRecording'][_0x90a6('0x3e')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x90a6('0x1a')](function(_0x236576){if(!_0x236576||!_0x236576[_0x90a6('0x1e')]){throw new db['Sequelize']['ValidationError'](_0x90a6('0x3f'));}_0x1f3b48=_0x236576;return db[_0x90a6('0x40')][_0x90a6('0x29')]({'where':{'id':0x1}});})[_0x90a6('0x1a')](function(_0x11eb34){if(!_0x11eb34){throw new db[(_0x90a6('0x27'))][(_0x90a6('0x22'))](_0x90a6('0x41'));}_0x243272=_0x11eb34;if(!_0x243272[_0x90a6('0x6')]||!_0x243272['transcribeAccountId']||!_0x243272['transcribeRegion']||!_0x243272[_0x90a6('0x25')]||!_0x243272[_0x90a6('0x26')]){throw new db[(_0x90a6('0x27'))][(_0x90a6('0x22'))](_0x90a6('0x42'));}return db[_0x90a6('0x38')]['findOne']({'where':{'id':_0x243272[_0x90a6('0x43')]}});})[_0x90a6('0x1a')](function(_0x26f399){if(!_0x26f399){throw new db[(_0x90a6('0x27'))]['ValidationError'](_0x90a6('0x44'));}if(!_0x26f399[_0x90a6('0xe')]||!_0x26f399[_0x90a6('0xf')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x44a9db=_0x26f399;var _0x5cd47c=[];_0x1f3b48['forEach'](function(_0x10c45b){_0x5cd47c[_0x90a6('0x45')](checkTranscribeJob(_0x10c45b,_0x243272,_0x44a9db));});return BPromise[_0x90a6('0x46')](_0x5cd47c);})[_0x90a6('0x47')](function(_0x3bc3f5){if(_0x3bc3f5){if(!_0x3bc3f5[_0x90a6('0x3a')]||_0x3bc3f5[_0x90a6('0x3a')]!==_0x90a6('0x3b')){logger[_0x90a6('0x48')](util['inspect'](_0x3bc3f5,{'showHidden':![],'depth':null}));}}});}exports[_0x90a6('0x49')]=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 f1a5fb0..5b492a7 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0cd7=['contacts1','CmHopper','hopper1','catch','util','../mysqldb','innocenzo.biondo','@xcally.com','push','now','Innocenzo','Biondo','CmContact','destroy','then','bulkCreate','log','finished\x20populating'];(function(_0x185cfe,_0x2edf62){var _0x37b8f0=function(_0x571a5e){while(--_0x571a5e){_0x185cfe['push'](_0x185cfe['shift']());}};_0x37b8f0(++_0x2edf62);}(_0x0cd7,0x1ea));var _0x70cd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0cd7[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x70cd('0x0'));var db=require(_0x70cd('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x70cd('0x2')+i+_0x70cd('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x70cd('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x70cd('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x70cd('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x70cd('0x6')+i,'lastName':_0x70cd('0x7')+i,'phone':0xf879fb460+i,'email':_0x70cd('0x2')+i+_0x70cd('0x3')});}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[_0x70cd('0x5')](),'updatedAt':Date['now']()});}db[_0x70cd('0x8')][_0x70cd('0x9')]({'where':{}})[_0x70cd('0xa')](function(){return db[_0x70cd('0x8')][_0x70cd('0xb')](contacts);})[_0x70cd('0xa')](function(){console[_0x70cd('0xc')](_0x70cd('0xd'),_0x70cd('0xe'));return db[_0x70cd('0xf')][_0x70cd('0x9')]({'where':{}});})[_0x70cd('0xa')](function(){return db[_0x70cd('0xf')][_0x70cd('0xb')](hopper);})[_0x70cd('0xa')](function(){console[_0x70cd('0xc')](_0x70cd('0xd'),_0x70cd('0x10'));return db['CmContact'][_0x70cd('0xb')](contacts2);})[_0x70cd('0xa')](function(){console['log']('finished\x20populating','contacts2');return db[_0x70cd('0xf')][_0x70cd('0xb')](hopper2);})[_0x70cd('0xa')](function(){console[_0x70cd('0xc')](_0x70cd('0xd'),'hopper2');})[_0x70cd('0x11')](function(_0x1a9e67){console['log'](_0x1a9e67);}); \ No newline at end of file +var _0xc482=['push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','destroy','then','CmContact','bulkCreate','finished\x20populating','contacts1','CmHopper','log','hopper1','contacts2','catch','util','../mysqldb'];(function(_0x4dfb1e,_0x1a90aa){var _0x1bc968=function(_0x5c82ab){while(--_0x5c82ab){_0x4dfb1e['push'](_0x4dfb1e['shift']());}};_0x1bc968(++_0x1a90aa);}(_0xc482,0x83));var _0x2c48=function(_0x1cc46d,_0x4ec74d){_0x1cc46d=_0x1cc46d-0x0;var _0x312723=_0xc482[_0x1cc46d];return _0x312723;};'use strict';var util=require(_0x2c48('0x0'));var db=require(_0x2c48('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x2c48('0x2')]({'id':i,'firstName':_0x2c48('0x3')+i,'lastName':_0x2c48('0x4')+i,'phone':0xf879fb460+i,'email':_0x2c48('0x5')+i+_0x2c48('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x2c48('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x2c48('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2c48('0x7')](),'updatedAt':Date[_0x2c48('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x2c48('0x2')]({'id':i,'firstName':_0x2c48('0x3')+i,'lastName':_0x2c48('0x4')+i,'phone':0xf879fb460+i,'email':_0x2c48('0x5')+i+_0x2c48('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x2c48('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x2c48('0x7')]()});}db['CmContact'][_0x2c48('0x8')]({'where':{}})[_0x2c48('0x9')](function(){return db[_0x2c48('0xa')][_0x2c48('0xb')](contacts);})[_0x2c48('0x9')](function(){console['log'](_0x2c48('0xc'),_0x2c48('0xd'));return db[_0x2c48('0xe')][_0x2c48('0x8')]({'where':{}});})[_0x2c48('0x9')](function(){return db[_0x2c48('0xe')]['bulkCreate'](hopper);})[_0x2c48('0x9')](function(){console[_0x2c48('0xf')](_0x2c48('0xc'),_0x2c48('0x10'));return db['CmContact']['bulkCreate'](contacts2);})[_0x2c48('0x9')](function(){console[_0x2c48('0xf')](_0x2c48('0xc'),_0x2c48('0x11'));return db['CmHopper'][_0x2c48('0xb')](hopper2);})['then'](function(){console[_0x2c48('0xf')](_0x2c48('0xc'),'hopper2');})[_0x2c48('0x12')](function(_0x21848f){console['log'](_0x21848f);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 166335e..72ba244 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf867=['/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch','../mysqldb','push','%s%s','agent','format','%s%s@xcally.com','friend','udp','wss','ulaw','yes'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xf867,0x95));var _0x7f86=function(_0x359708,_0x199a31){_0x359708=_0x359708-0x0;var _0x17000a=_0xf867[_0x359708];return _0x17000a;};'use strict';var util=require('util');var db=require(_0x7f86('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x7f86('0x1')]({'name':util['format'](_0x7f86('0x2'),_0x7f86('0x3'),i),'fullname':util[_0x7f86('0x4')](_0x7f86('0x2'),'agent',i),'email':util[_0x7f86('0x4')](_0x7f86('0x5'),_0x7f86('0x3'),i),'role':_0x7f86('0x3'),'password':'password','internal':0xfa0+i,'type':_0x7f86('0x6'),'transport':[_0x7f86('0x7'),'ws',_0x7f86('0x8')],'disallow':['all'],'allow':[_0x7f86('0x9')],'defaultuser':util['format'](_0x7f86('0x2'),'agent',i),'encryption':_0x7f86('0xa'),'avpf':_0x7f86('0xa'),'force_avp':_0x7f86('0xa'),'icesupport':_0x7f86('0xa'),'dtlsenable':_0x7f86('0xa'),'dtlsverify':'no','dtlscertfile':_0x7f86('0xb'),'dtlsprivatekey':_0x7f86('0xc'),'dtlssetup':_0x7f86('0xd'),'callerid':util[_0x7f86('0x4')](_0x7f86('0xe'),util[_0x7f86('0x4')](_0x7f86('0x2'),_0x7f86('0x3'),i),0xfa0+i)});}db[_0x7f86('0xf')]['bulkCreate'](users)[_0x7f86('0x10')](function(){console[_0x7f86('0x11')](_0x7f86('0x12'));})[_0x7f86('0x13')](function(_0x173e5c){console['log'](_0x173e5c);}); \ No newline at end of file +var _0xf93f=['actpass','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch','util','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key'];(function(_0x1056f6,_0x8d5e19){var _0x1a2f5a=function(_0x538420){while(--_0x538420){_0x1056f6['push'](_0x1056f6['shift']());}};_0x1a2f5a(++_0x8d5e19);}(_0xf93f,0xaf));var _0xff93=function(_0xa9fdc9,_0x425bcb){_0xa9fdc9=_0xa9fdc9-0x0;var _0x572442=_0xf93f[_0xa9fdc9];return _0x572442;};'use strict';var util=require(_0xff93('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xff93('0x1')]({'name':util[_0xff93('0x2')](_0xff93('0x3'),'agent',i),'fullname':util[_0xff93('0x2')](_0xff93('0x3'),_0xff93('0x4'),i),'email':util[_0xff93('0x2')](_0xff93('0x5'),_0xff93('0x4'),i),'role':_0xff93('0x4'),'password':_0xff93('0x6'),'internal':0xfa0+i,'type':_0xff93('0x7'),'transport':[_0xff93('0x8'),'ws',_0xff93('0x9')],'disallow':[_0xff93('0xa')],'allow':['ulaw'],'defaultuser':util[_0xff93('0x2')](_0xff93('0x3'),_0xff93('0x4'),i),'encryption':_0xff93('0xb'),'avpf':_0xff93('0xb'),'force_avp':'yes','icesupport':_0xff93('0xb'),'dtlsenable':_0xff93('0xb'),'dtlsverify':'no','dtlscertfile':_0xff93('0xc'),'dtlsprivatekey':_0xff93('0xd'),'dtlssetup':_0xff93('0xe'),'callerid':util[_0xff93('0x2')](_0xff93('0xf'),util['format']('%s%s',_0xff93('0x4'),i),0xfa0+i)});}db[_0xff93('0x10')]['bulkCreate'](users)[_0xff93('0x11')](function(){console[_0xff93('0x12')](_0xff93('0x13'));})[_0xff93('0x14')](function(_0x421a66){console[_0xff93('0x12')](_0x421a66);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index ecc3bc9..209bbc7 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x252b=['telephone','Campaign','where','format','%s:queue:%s','Agents','length','user:%s','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','voice:outbound','MailQueues','WhatsappQueues','Telephones','voice:inbound','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','chat','mail','openchannel','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','remoteAddress','request','remotePort','connectedAt','nsp','disconnect','CONNECTED','lodash','util','bluebird','./environment','name','User','role','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','OpenchannelQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map'];(function(_0x11fcdf,_0x5d6088){var _0x144bfe=function(_0x4678ab){while(--_0x4678ab){_0x11fcdf['push'](_0x11fcdf['shift']());}};_0x144bfe(++_0x5d6088);}(_0x252b,0x117));var _0xb252=function(_0x178f9c,_0x9dc87a){_0x178f9c=_0x178f9c-0x0;var _0x413f4a=_0x252b[_0x178f9c];return _0x413f4a;};'use strict';var _=require(_0xb252('0x0'));var util=require(_0xb252('0x1'));var BPromise=require(_0xb252('0x2'));var db=require('../mysqldb')['db'];var config=require(_0xb252('0x3'));var queryQueues={'attributes':['id',_0xb252('0x4')],'include':[{'as':'Agents','model':db[_0xb252('0x5')],'attributes':['id',_0xb252('0x4'),_0xb252('0x6')],'raw':!![],'where':{'role':_0xb252('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xb252('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xb252('0x4')],'where':{'role':_0xb252('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xb252('0x4'),_0xb252('0x8')],'where':{'type':_0xb252('0x9')}};function getAssociatedResources(_0x3be9c0,_0x17a963,_0x444cf4){return db[_0xb252('0xa')][_0xb252('0xb')]({'where':{'name':_0x3be9c0,'userProfileId':_0x17a963},'raw':!![]})[_0xb252('0xc')](function(_0x395414){if(_0x395414){if(_0x395414[_0xb252('0xd')]){switch(_0x3be9c0){case _0xb252('0xe'):case'ChatQueues':case _0xb252('0xf'):case _0xb252('0x10'):case'MailQueues':case _0xb252('0x11'):case'WhatsappQueues':return db[_0x444cf4][_0xb252('0x12')](queryQueues);case'Telephones':return db[_0x444cf4][_0xb252('0x12')](queryTelephones);case _0xb252('0x13'):return db[_0x444cf4][_0xb252('0x12')](queryTrunks);case _0xb252('0x14'):return db[_0x444cf4][_0xb252('0x12')](queryCampaigns);}}else{return db[_0xb252('0x15')][_0xb252('0x12')]({'attributes':[_0xb252('0x16')],'where':{'sectionId':_0x395414['id']},'raw':!![]})[_0xb252('0xc')](function(_0x3c09f7){if(_0x3c09f7){var _0x424c66={'where':{'id':_[_0xb252('0x17')](_0x3c09f7,_0xb252('0x16'))},'raw':!![]};switch(_0x444cf4){case _0xb252('0x5'):_0x424c66['where'][_0xb252('0x6')]=_0xb252('0x18');break;case _0xb252('0x19'):_0x424c66[_0xb252('0x1a')][_0xb252('0x8')]='ivr';break;}return db[_0x444cf4][_0xb252('0x12')](_0x424c66);}else{return[];}});}}else{return[];}})['then'](function(_0x5defed){return _0x5defed;});}function joinOrLeaveQueues(_0x4c493b,_0x566558,_0x40cfc2,_0x2c1421){_0x4c493b[_0x566558](util[_0xb252('0x1b')](_0xb252('0x1c'),_0x40cfc2,_0x2c1421[_0xb252('0x4')]));if(_0x2c1421['Agents']){for(var _0x436df6=0x0;_0x436df6<_0x2c1421[_0xb252('0x1d')][_0xb252('0x1e')];_0x436df6+=0x1){_0x4c493b[_0x566558](util['format'](_0xb252('0x1f'),_0x2c1421[_0xb252('0x1d')][_0x436df6][_0xb252('0x4')]));}}}function joinOrLeave(_0x3d6bd7,_0x1badc6,_0xf87fd2){var _0x2eb0d6;if(_0x3d6bd7['handshake']['query']['id']){db[_0xb252('0x5')]['find']({'attributes':['id','name',_0xb252('0x6'),_0xb252('0x20')],'where':{'id':_0x3d6bd7[_0xb252('0x21')]['query']['id']},'include':[{'model':db[_0xb252('0x22')],'as':_0xb252('0x23'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xb252('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xb252('0x25')],'as':_0xb252('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xb252('0x27')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb252('0x28')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb252('0x29')],'as':_0xb252('0x2a'),'attributes':['id'],'raw':!![]}]})[_0xb252('0xc')](function(_0xfc44af){if(_0xfc44af){_0x2eb0d6=_0xfc44af;_0x3d6bd7[_0x1badc6](util[_0xb252('0x1b')]('user:%s',_0xfc44af[_0xb252('0x4')]));var _0x50bd3e=[];switch(_0xfc44af[_0xb252('0x6')]){case _0xb252('0x2b'):_0x3d6bd7[_0x1badc6]('voice:inbound');_0x3d6bd7[_0x1badc6]('voice:outbound');if(queryQueues[_0xb252('0x2c')](_0xb252('0x2d'))){delete queryQueues['include'];}_0x50bd3e[_0xb252('0x2e')](db[_0xb252('0x2f')][_0xb252('0x12')](queryQueues));_0x50bd3e['push'](db[_0xb252('0x30')][_0xb252('0x12')](queryQueues));_0x50bd3e[_0xb252('0x2e')](db[_0xb252('0x31')][_0xb252('0x12')](queryQueues));_0x50bd3e[_0xb252('0x2e')](db[_0xb252('0x32')][_0xb252('0x12')](queryQueues));_0x50bd3e['push'](db[_0xb252('0x33')][_0xb252('0x12')](queryQueues));_0x50bd3e[_0xb252('0x2e')](db[_0xb252('0x34')]['findAll'](queryQueues));_0x50bd3e['push'](db[_0xb252('0x35')][_0xb252('0x12')](queryQueues));_0x50bd3e['push'](db[_0xb252('0x5')][_0xb252('0x12')](queryTelephones));_0x50bd3e[_0xb252('0x2e')](db[_0xb252('0x36')]['findAll'](queryTrunks));_0x50bd3e[_0xb252('0x2e')](db['Campaign'][_0xb252('0x12')](queryCampaigns));_0x50bd3e[_0xb252('0x2e')](db[_0xb252('0x5')][_0xb252('0x12')](queryAgents));break;case'user':_0x3d6bd7[_0x1badc6]('voice:inbound');_0x3d6bd7[_0x1badc6](_0xb252('0x37'));_0x50bd3e[_0xb252('0x2e')](getAssociatedResources(_0xb252('0xe'),_0xfc44af[_0xb252('0x20')],_0xb252('0x2f')));_0x50bd3e[_0xb252('0x2e')](getAssociatedResources('ChatQueues',_0xfc44af['userProfileId'],'ChatQueue'));_0x50bd3e[_0xb252('0x2e')](getAssociatedResources('FaxQueues',_0xfc44af[_0xb252('0x20')],_0xb252('0x31')));_0x50bd3e[_0xb252('0x2e')](getAssociatedResources(_0xb252('0x10'),_0xfc44af[_0xb252('0x20')],'SmsQueue'));_0x50bd3e[_0xb252('0x2e')](getAssociatedResources(_0xb252('0x38'),_0xfc44af[_0xb252('0x20')],_0xb252('0x33')));_0x50bd3e[_0xb252('0x2e')](getAssociatedResources(_0xb252('0x11'),_0xfc44af['userProfileId'],'OpenchannelQueue'));_0x50bd3e[_0xb252('0x2e')](getAssociatedResources(_0xb252('0x39'),_0xfc44af['userProfileId'],_0xb252('0x35')));_0x50bd3e[_0xb252('0x2e')](getAssociatedResources(_0xb252('0x3a'),_0xfc44af[_0xb252('0x20')],_0xb252('0x5')));_0x50bd3e[_0xb252('0x2e')](getAssociatedResources(_0xb252('0x13'),_0xfc44af[_0xb252('0x20')],_0xb252('0x36')));_0x50bd3e['push'](getAssociatedResources('IvrCampaigns',_0xfc44af[_0xb252('0x20')],'Campaign'));_0x50bd3e[_0xb252('0x2e')](db[_0xb252('0x5')][_0xb252('0x12')](queryAgents));break;case _0xb252('0x7'):_0x3d6bd7[_0x1badc6](_0xb252('0x3b'));_0x3d6bd7[_0x1badc6](_0xb252('0x37'));_0x50bd3e['push'](_0xfc44af[_0xb252('0x3c')]({'attributes':['id',_0xb252('0x4')]}));_0x50bd3e['push'](_0xfc44af[_0xb252('0x3d')]({'attributes':['id',_0xb252('0x4')]}));_0x50bd3e[_0xb252('0x2e')](_0xfc44af[_0xb252('0x3e')]({'attributes':['id','name']}));_0x50bd3e[_0xb252('0x2e')](_0xfc44af[_0xb252('0x3f')]({'attributes':['id',_0xb252('0x4')]}));_0x50bd3e['push'](_0xfc44af[_0xb252('0x40')]({'attributes':['id','name']}));_0x50bd3e[_0xb252('0x2e')](_0xfc44af[_0xb252('0x41')]({'attributes':['id',_0xb252('0x4')]}));_0x50bd3e[_0xb252('0x2e')](_0xfc44af[_0xb252('0x42')]({'attributes':['id',_0xb252('0x4')]}));break;}return BPromise[_0xb252('0x43')](_0x50bd3e);}})[_0xb252('0xc')](function(_0x18cd40){if(_0x18cd40&&_0x18cd40[_0xb252('0x1e')]){for(var _0x267af9=0x0;_0x267af9<_0x18cd40[_0xb252('0x1e')];_0x267af9+=0x1){for(var _0x5f4a77=0x0;_0x5f4a77<_0x18cd40[_0x267af9][_0xb252('0x1e')];_0x5f4a77+=0x1){switch(_0x267af9){case 0x0:joinOrLeaveQueues(_0x3d6bd7,_0x1badc6,'voice',_0x18cd40[_0x267af9][_0x5f4a77]);break;case 0x1:joinOrLeaveQueues(_0x3d6bd7,_0x1badc6,_0xb252('0x44'),_0x18cd40[_0x267af9][_0x5f4a77]);break;case 0x2:joinOrLeaveQueues(_0x3d6bd7,_0x1badc6,'fax',_0x18cd40[_0x267af9][_0x5f4a77]);break;case 0x3:joinOrLeaveQueues(_0x3d6bd7,_0x1badc6,'sms',_0x18cd40[_0x267af9][_0x5f4a77]);break;case 0x4:joinOrLeaveQueues(_0x3d6bd7,_0x1badc6,_0xb252('0x45'),_0x18cd40[_0x267af9][_0x5f4a77]);break;case 0x5:joinOrLeaveQueues(_0x3d6bd7,_0x1badc6,_0xb252('0x46'),_0x18cd40[_0x267af9][_0x5f4a77]);break;case 0x6:joinOrLeaveQueues(_0x3d6bd7,_0x1badc6,'whatsapp',_0x18cd40[_0x267af9][_0x5f4a77]);break;case 0x7:_0x3d6bd7[_0x1badc6](util[_0xb252('0x1b')]('telephone:%s',_0x18cd40[_0x267af9][_0x5f4a77][_0xb252('0x4')]));break;case 0x8:_0x3d6bd7[_0x1badc6](util[_0xb252('0x1b')](_0xb252('0x47'),_0x18cd40[_0x267af9][_0x5f4a77]['name']));break;case 0x9:_0x3d6bd7[_0x1badc6](util[_0xb252('0x1b')](_0xb252('0x48'),_0x18cd40[_0x267af9][_0x5f4a77][_0xb252('0x8')],_0x18cd40[_0x267af9][_0x5f4a77]['name']));break;case 0xa:_0x3d6bd7[_0x1badc6](util[_0xb252('0x1b')](_0xb252('0x1f'),_0x18cd40[_0x267af9][_0x5f4a77]['name']));break;}}}}})['then'](function(){if(_0x1badc6===_0xb252('0x49')){var _0x3d5c35=_[_0xb252('0x17')](_0x2eb0d6[_0xb252('0x23')],'id');return _0x2eb0d6[_0xb252('0x4a')](_0x3d5c35)['then'](function(){for(var _0x2ce313=0x0;_0x2ce313<_0x3d5c35[_0xb252('0x1e')];_0x2ce313+=0x1){_0xf87fd2[_0xb252('0x4b')](_0xb252('0x4c'),{'ChatInteractionId':Number(_0x3d5c35[_0x2ce313]),'UserId':Number(_0x2eb0d6['id'])});}});}})[_0xb252('0xc')](function(){if(_0x1badc6===_0xb252('0x49')){var _0x1b79f4=_[_0xb252('0x17')](_0x2eb0d6[_0xb252('0x24')],'id');return _0x2eb0d6[_0xb252('0x4d')](_0x1b79f4)[_0xb252('0xc')](function(){for(var _0x5d92c8=0x0;_0x5d92c8<_0x1b79f4[_0xb252('0x1e')];_0x5d92c8+=0x1){_0xf87fd2[_0xb252('0x4b')](_0xb252('0x4e'),{'MailInteractionId':Number(_0x1b79f4[_0x5d92c8]),'UserId':Number(_0x2eb0d6['id'])});}});}})[_0xb252('0xc')](function(){if(_0x1badc6===_0xb252('0x49')){var _0x5767b=_['map'](_0x2eb0d6['FaxInteractions'],'id');return _0x2eb0d6['removeFaxInteractions'](_0x5767b)[_0xb252('0xc')](function(){for(var _0x257895=0x0;_0x257895<_0x5767b[_0xb252('0x1e')];_0x257895+=0x1){_0xf87fd2['emit'](_0xb252('0x4f'),{'FaxInteractionId':Number(_0x5767b[_0x257895]),'UserId':Number(_0x2eb0d6['id'])});}});}})[_0xb252('0xc')](function(){if(_0x1badc6===_0xb252('0x49')){var _0x1a89ee=_[_0xb252('0x17')](_0x2eb0d6[_0xb252('0x50')],'id');return _0x2eb0d6[_0xb252('0x51')](_0x1a89ee)[_0xb252('0xc')](function(){for(var _0x1896af=0x0;_0x1896af<_0x1a89ee['length'];_0x1896af+=0x1){_0xf87fd2[_0xb252('0x4b')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x1a89ee[_0x1896af]),'UserId':Number(_0x2eb0d6['id'])});}});}})[_0xb252('0xc')](function(){if(_0x1badc6===_0xb252('0x49')){var _0x30c6fd=_[_0xb252('0x17')](_0x2eb0d6[_0xb252('0x52')],'id');return _0x2eb0d6[_0xb252('0x53')](_0x30c6fd)[_0xb252('0xc')](function(){for(var _0x41e28e=0x0;_0x41e28e<_0x30c6fd['length'];_0x41e28e+=0x1){_0xf87fd2[_0xb252('0x4b')](_0xb252('0x54'),{'OpenchannelInteractionId':Number(_0x30c6fd[_0x41e28e]),'UserId':Number(_0x2eb0d6['id'])});}});}})[_0xb252('0xc')](function(){if(_0x1badc6===_0xb252('0x49')){var _0x2c8382=_[_0xb252('0x17')](_0x2eb0d6['WhatsappInteractions'],'id');return _0x2eb0d6[_0xb252('0x55')](_0x2c8382)[_0xb252('0xc')](function(){for(var _0x40d656=0x0;_0x40d656<_0x2c8382[_0xb252('0x1e')];_0x40d656+=0x1){_0xf87fd2[_0xb252('0x4b')](_0xb252('0x56'),{'WhatsappInteractionId':Number(_0x2c8382[_0x40d656]),'UserId':Number(_0x2eb0d6['id'])});}});}})[_0xb252('0x57')](function(_0x19ade7){_0x3d6bd7[_0xb252('0x58')](_0x19ade7);});}}function onDisconnect(_0xd688a7,_0x1f9313){joinOrLeave(_0xd688a7,_0xb252('0x49'),_0x1f9313);}function onConnect(_0x39fae1){joinOrLeave(_0x39fae1,_0xb252('0x59'));}exports[_0xb252('0x5a')]=function(_0x51e5cb){_0x51e5cb['on'](_0xb252('0x5b'),function(_0x4e1828){_0x4e1828[_0xb252('0x5c')](0x0);_0x4e1828[_0xb252('0x5d')]=_0x4e1828['request'][_0xb252('0x5b')][_0xb252('0x5e')]+':'+_0x4e1828[_0xb252('0x5f')][_0xb252('0x5b')][_0xb252('0x60')];_0x4e1828[_0xb252('0x61')]=new Date();_0x4e1828[_0xb252('0x58')]=function(_0x35cf4f){console['log']('SocketIO\x20'+_0x4e1828[_0xb252('0x62')][_0xb252('0x4')]+'['+_0x4e1828[_0xb252('0x5d')]+']',_0x35cf4f);};_0x4e1828['on'](_0xb252('0x63'),function(){onDisconnect(_0x4e1828,_0x51e5cb);_0x4e1828[_0xb252('0x58')]('DISCONNECTED');});onConnect(_0x4e1828);_0x4e1828[_0xb252('0x58')](_0xb252('0x64'));});}; \ No newline at end of file +var _0xbaa9=['type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','map','where','Campaign','format','%s:queue:%s','user:%s','handshake','query','userProfileId','ChatInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','ChatQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','length','voice','chat','fax','sms','mail','openchannel','whatsapp','leave','ChatInteractions','removeChatInteractions','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','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','log','DISCONNECTED','CONNECTED','lodash','bluebird','name','Agents','User','role','agent','telephone'];(function(_0x3119ca,_0x2ef61c){var _0x3098cc=function(_0x3b242e){while(--_0x3b242e){_0x3119ca['push'](_0x3119ca['shift']());}};_0x3098cc(++_0x2ef61c);}(_0xbaa9,0x188));var _0x9baa=function(_0x1fa575,_0x34f85c){_0x1fa575=_0x1fa575-0x0;var _0x7c39d=_0xbaa9[_0x1fa575];return _0x7c39d;};'use strict';var _=require(_0x9baa('0x0'));var util=require('util');var BPromise=require(_0x9baa('0x1'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x9baa('0x2')],'include':[{'as':_0x9baa('0x3'),'model':db[_0x9baa('0x4')],'attributes':['id',_0x9baa('0x2'),_0x9baa('0x5')],'raw':!![],'where':{'role':_0x9baa('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x9baa('0x7')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x9baa('0x2')],'where':{'role':_0x9baa('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x9baa('0x2'),_0x9baa('0x8')],'where':{'type':_0x9baa('0x9')}};function getAssociatedResources(_0x588cf1,_0x25681c,_0x292612){return db[_0x9baa('0xa')][_0x9baa('0xb')]({'where':{'name':_0x588cf1,'userProfileId':_0x25681c},'raw':!![]})[_0x9baa('0xc')](function(_0x38f7c4){if(_0x38f7c4){if(_0x38f7c4[_0x9baa('0xd')]){switch(_0x588cf1){case _0x9baa('0xe'):case'ChatQueues':case _0x9baa('0xf'):case _0x9baa('0x10'):case _0x9baa('0x11'):case _0x9baa('0x12'):case _0x9baa('0x13'):return db[_0x292612][_0x9baa('0x14')](queryQueues);case _0x9baa('0x15'):return db[_0x292612][_0x9baa('0x14')](queryTelephones);case _0x9baa('0x16'):return db[_0x292612][_0x9baa('0x14')](queryTrunks);case _0x9baa('0x17'):return db[_0x292612][_0x9baa('0x14')](queryCampaigns);}}else{return db['UserProfileResource'][_0x9baa('0x14')]({'attributes':[_0x9baa('0x18')],'where':{'sectionId':_0x38f7c4['id']},'raw':!![]})[_0x9baa('0xc')](function(_0x42e0c6){if(_0x42e0c6){var _0x37b43d={'where':{'id':_[_0x9baa('0x19')](_0x42e0c6,'resourceId')},'raw':!![]};switch(_0x292612){case'User':_0x37b43d[_0x9baa('0x1a')][_0x9baa('0x5')]=_0x9baa('0x7');break;case _0x9baa('0x1b'):_0x37b43d[_0x9baa('0x1a')]['type']='ivr';break;}return db[_0x292612][_0x9baa('0x14')](_0x37b43d);}else{return[];}});}}else{return[];}})[_0x9baa('0xc')](function(_0x3b1f86){return _0x3b1f86;});}function joinOrLeaveQueues(_0x119d80,_0x1f087a,_0x1e6d49,_0x293781){_0x119d80[_0x1f087a](util[_0x9baa('0x1c')](_0x9baa('0x1d'),_0x1e6d49,_0x293781[_0x9baa('0x2')]));if(_0x293781[_0x9baa('0x3')]){for(var _0x570ca8=0x0;_0x570ca8<_0x293781['Agents']['length'];_0x570ca8+=0x1){_0x119d80[_0x1f087a](util['format'](_0x9baa('0x1e'),_0x293781['Agents'][_0x570ca8][_0x9baa('0x2')]));}}}function joinOrLeave(_0x119729,_0x193108,_0x12772f){var _0x1478ac;if(_0x119729[_0x9baa('0x1f')][_0x9baa('0x20')]['id']){db[_0x9baa('0x4')]['find']({'attributes':['id',_0x9baa('0x2'),'role',_0x9baa('0x21')],'where':{'id':_0x119729['handshake'][_0x9baa('0x20')]['id']},'include':[{'model':db[_0x9baa('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x9baa('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x9baa('0x24')],'as':_0x9baa('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x9baa('0x26')],'as':_0x9baa('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x9baa('0x28')],'as':_0x9baa('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x9baa('0x2a')],'as':_0x9baa('0x2b'),'attributes':['id'],'raw':!![]}]})[_0x9baa('0xc')](function(_0x5923d7){if(_0x5923d7){_0x1478ac=_0x5923d7;_0x119729[_0x193108](util[_0x9baa('0x1c')]('user:%s',_0x5923d7['name']));var _0x2a0302=[];switch(_0x5923d7[_0x9baa('0x5')]){case _0x9baa('0x2c'):_0x119729[_0x193108](_0x9baa('0x2d'));_0x119729[_0x193108](_0x9baa('0x2e'));if(queryQueues[_0x9baa('0x2f')](_0x9baa('0x30'))){delete queryQueues[_0x9baa('0x30')];}_0x2a0302[_0x9baa('0x31')](db[_0x9baa('0x32')][_0x9baa('0x14')](queryQueues));_0x2a0302['push'](db[_0x9baa('0x33')][_0x9baa('0x14')](queryQueues));_0x2a0302[_0x9baa('0x31')](db[_0x9baa('0x34')][_0x9baa('0x14')](queryQueues));_0x2a0302['push'](db[_0x9baa('0x35')][_0x9baa('0x14')](queryQueues));_0x2a0302[_0x9baa('0x31')](db['MailQueue'][_0x9baa('0x14')](queryQueues));_0x2a0302[_0x9baa('0x31')](db[_0x9baa('0x36')][_0x9baa('0x14')](queryQueues));_0x2a0302['push'](db[_0x9baa('0x37')]['findAll'](queryQueues));_0x2a0302[_0x9baa('0x31')](db[_0x9baa('0x4')]['findAll'](queryTelephones));_0x2a0302[_0x9baa('0x31')](db[_0x9baa('0x38')][_0x9baa('0x14')](queryTrunks));_0x2a0302[_0x9baa('0x31')](db['Campaign'][_0x9baa('0x14')](queryCampaigns));_0x2a0302[_0x9baa('0x31')](db['User'][_0x9baa('0x14')](queryAgents));break;case _0x9baa('0x39'):_0x119729[_0x193108](_0x9baa('0x2d'));_0x119729[_0x193108]('voice:outbound');_0x2a0302['push'](getAssociatedResources(_0x9baa('0xe'),_0x5923d7[_0x9baa('0x21')],_0x9baa('0x32')));_0x2a0302[_0x9baa('0x31')](getAssociatedResources(_0x9baa('0x3a'),_0x5923d7[_0x9baa('0x21')],_0x9baa('0x33')));_0x2a0302[_0x9baa('0x31')](getAssociatedResources('FaxQueues',_0x5923d7[_0x9baa('0x21')],_0x9baa('0x34')));_0x2a0302[_0x9baa('0x31')](getAssociatedResources(_0x9baa('0x10'),_0x5923d7[_0x9baa('0x21')],_0x9baa('0x35')));_0x2a0302[_0x9baa('0x31')](getAssociatedResources(_0x9baa('0x11'),_0x5923d7[_0x9baa('0x21')],'MailQueue'));_0x2a0302[_0x9baa('0x31')](getAssociatedResources(_0x9baa('0x12'),_0x5923d7[_0x9baa('0x21')],_0x9baa('0x36')));_0x2a0302[_0x9baa('0x31')](getAssociatedResources('WhatsappQueues',_0x5923d7[_0x9baa('0x21')],'WhatsappQueue'));_0x2a0302['push'](getAssociatedResources('Telephones',_0x5923d7[_0x9baa('0x21')],_0x9baa('0x4')));_0x2a0302[_0x9baa('0x31')](getAssociatedResources(_0x9baa('0x16'),_0x5923d7[_0x9baa('0x21')],'Trunk'));_0x2a0302[_0x9baa('0x31')](getAssociatedResources(_0x9baa('0x17'),_0x5923d7['userProfileId'],'Campaign'));_0x2a0302['push'](db[_0x9baa('0x4')][_0x9baa('0x14')](queryAgents));break;case'agent':_0x119729[_0x193108](_0x9baa('0x2d'));_0x119729[_0x193108]('voice:outbound');_0x2a0302['push'](_0x5923d7[_0x9baa('0x3b')]({'attributes':['id',_0x9baa('0x2')]}));_0x2a0302['push'](_0x5923d7[_0x9baa('0x3c')]({'attributes':['id',_0x9baa('0x2')]}));_0x2a0302['push'](_0x5923d7[_0x9baa('0x3d')]({'attributes':['id',_0x9baa('0x2')]}));_0x2a0302[_0x9baa('0x31')](_0x5923d7[_0x9baa('0x3e')]({'attributes':['id',_0x9baa('0x2')]}));_0x2a0302[_0x9baa('0x31')](_0x5923d7[_0x9baa('0x3f')]({'attributes':['id',_0x9baa('0x2')]}));_0x2a0302[_0x9baa('0x31')](_0x5923d7[_0x9baa('0x40')]({'attributes':['id',_0x9baa('0x2')]}));_0x2a0302[_0x9baa('0x31')](_0x5923d7[_0x9baa('0x41')]({'attributes':['id',_0x9baa('0x2')]}));break;}return BPromise['all'](_0x2a0302);}})[_0x9baa('0xc')](function(_0x30ca09){if(_0x30ca09&&_0x30ca09[_0x9baa('0x42')]){for(var _0x2bd543=0x0;_0x2bd543<_0x30ca09[_0x9baa('0x42')];_0x2bd543+=0x1){for(var _0x124ae8=0x0;_0x124ae8<_0x30ca09[_0x2bd543][_0x9baa('0x42')];_0x124ae8+=0x1){switch(_0x2bd543){case 0x0:joinOrLeaveQueues(_0x119729,_0x193108,_0x9baa('0x43'),_0x30ca09[_0x2bd543][_0x124ae8]);break;case 0x1:joinOrLeaveQueues(_0x119729,_0x193108,_0x9baa('0x44'),_0x30ca09[_0x2bd543][_0x124ae8]);break;case 0x2:joinOrLeaveQueues(_0x119729,_0x193108,_0x9baa('0x45'),_0x30ca09[_0x2bd543][_0x124ae8]);break;case 0x3:joinOrLeaveQueues(_0x119729,_0x193108,_0x9baa('0x46'),_0x30ca09[_0x2bd543][_0x124ae8]);break;case 0x4:joinOrLeaveQueues(_0x119729,_0x193108,_0x9baa('0x47'),_0x30ca09[_0x2bd543][_0x124ae8]);break;case 0x5:joinOrLeaveQueues(_0x119729,_0x193108,_0x9baa('0x48'),_0x30ca09[_0x2bd543][_0x124ae8]);break;case 0x6:joinOrLeaveQueues(_0x119729,_0x193108,_0x9baa('0x49'),_0x30ca09[_0x2bd543][_0x124ae8]);break;case 0x7:_0x119729[_0x193108](util[_0x9baa('0x1c')]('telephone:%s',_0x30ca09[_0x2bd543][_0x124ae8][_0x9baa('0x2')]));break;case 0x8:_0x119729[_0x193108](util[_0x9baa('0x1c')]('trunk:%s',_0x30ca09[_0x2bd543][_0x124ae8][_0x9baa('0x2')]));break;case 0x9:_0x119729[_0x193108](util['format']('campaign:%s:%s',_0x30ca09[_0x2bd543][_0x124ae8][_0x9baa('0x8')],_0x30ca09[_0x2bd543][_0x124ae8][_0x9baa('0x2')]));break;case 0xa:_0x119729[_0x193108](util[_0x9baa('0x1c')](_0x9baa('0x1e'),_0x30ca09[_0x2bd543][_0x124ae8][_0x9baa('0x2')]));break;}}}}})[_0x9baa('0xc')](function(){if(_0x193108===_0x9baa('0x4a')){var _0x47bb41=_[_0x9baa('0x19')](_0x1478ac[_0x9baa('0x4b')],'id');return _0x1478ac[_0x9baa('0x4c')](_0x47bb41)[_0x9baa('0xc')](function(){for(var _0x2af77d=0x0;_0x2af77d<_0x47bb41['length'];_0x2af77d+=0x1){_0x12772f[_0x9baa('0x4d')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x47bb41[_0x2af77d]),'UserId':Number(_0x1478ac['id'])});}});}})[_0x9baa('0xc')](function(){if(_0x193108===_0x9baa('0x4a')){var _0xc3e5e8=_['map'](_0x1478ac[_0x9baa('0x23')],'id');return _0x1478ac['removeMailInteractions'](_0xc3e5e8)[_0x9baa('0xc')](function(){for(var _0x495cb9=0x0;_0x495cb9<_0xc3e5e8[_0x9baa('0x42')];_0x495cb9+=0x1){_0x12772f['emit'](_0x9baa('0x4e'),{'MailInteractionId':Number(_0xc3e5e8[_0x495cb9]),'UserId':Number(_0x1478ac['id'])});}});}})['then'](function(){if(_0x193108===_0x9baa('0x4a')){var _0x8df0f4=_[_0x9baa('0x19')](_0x1478ac[_0x9baa('0x25')],'id');return _0x1478ac[_0x9baa('0x4f')](_0x8df0f4)[_0x9baa('0xc')](function(){for(var _0x420fd1=0x0;_0x420fd1<_0x8df0f4[_0x9baa('0x42')];_0x420fd1+=0x1){_0x12772f['emit'](_0x9baa('0x50'),{'FaxInteractionId':Number(_0x8df0f4[_0x420fd1]),'UserId':Number(_0x1478ac['id'])});}});}})[_0x9baa('0xc')](function(){if(_0x193108===_0x9baa('0x4a')){var _0x413670=_[_0x9baa('0x19')](_0x1478ac['SmsInteractions'],'id');return _0x1478ac[_0x9baa('0x51')](_0x413670)['then'](function(){for(var _0x4b67ea=0x0;_0x4b67ea<_0x413670[_0x9baa('0x42')];_0x4b67ea+=0x1){_0x12772f[_0x9baa('0x4d')](_0x9baa('0x52'),{'SmsInteractionId':Number(_0x413670[_0x4b67ea]),'UserId':Number(_0x1478ac['id'])});}});}})['then'](function(){if(_0x193108===_0x9baa('0x4a')){var _0x6eaea6=_['map'](_0x1478ac[_0x9baa('0x29')],'id');return _0x1478ac[_0x9baa('0x53')](_0x6eaea6)['then'](function(){for(var _0xef8e72=0x0;_0xef8e72<_0x6eaea6[_0x9baa('0x42')];_0xef8e72+=0x1){_0x12772f[_0x9baa('0x4d')](_0x9baa('0x54'),{'OpenchannelInteractionId':Number(_0x6eaea6[_0xef8e72]),'UserId':Number(_0x1478ac['id'])});}});}})[_0x9baa('0xc')](function(){if(_0x193108===_0x9baa('0x4a')){var _0x31a8a9=_[_0x9baa('0x19')](_0x1478ac[_0x9baa('0x2b')],'id');return _0x1478ac[_0x9baa('0x55')](_0x31a8a9)[_0x9baa('0xc')](function(){for(var _0x17e2dc=0x0;_0x17e2dc<_0x31a8a9[_0x9baa('0x42')];_0x17e2dc+=0x1){_0x12772f['emit'](_0x9baa('0x56'),{'WhatsappInteractionId':Number(_0x31a8a9[_0x17e2dc]),'UserId':Number(_0x1478ac['id'])});}});}})[_0x9baa('0x57')](function(_0x16d7a6){_0x119729['log'](_0x16d7a6);});}}function onDisconnect(_0x13b387,_0x3776ba){joinOrLeave(_0x13b387,_0x9baa('0x4a'),_0x3776ba);}function onConnect(_0x10e1c4){joinOrLeave(_0x10e1c4,_0x9baa('0x58'));}exports[_0x9baa('0x59')]=function(_0x2c9b34){_0x2c9b34['on'](_0x9baa('0x5a'),function(_0xaf0f52){_0xaf0f52[_0x9baa('0x5b')](0x0);_0xaf0f52[_0x9baa('0x5c')]=_0xaf0f52[_0x9baa('0x5d')][_0x9baa('0x5a')][_0x9baa('0x5e')]+':'+_0xaf0f52[_0x9baa('0x5d')]['connection'][_0x9baa('0x5f')];_0xaf0f52[_0x9baa('0x60')]=new Date();_0xaf0f52[_0x9baa('0x61')]=function(_0x375b87){console[_0x9baa('0x61')]('SocketIO\x20'+_0xaf0f52['nsp'][_0x9baa('0x2')]+'['+_0xaf0f52[_0x9baa('0x5c')]+']',_0x375b87);};_0xaf0f52['on']('disconnect',function(){onDisconnect(_0xaf0f52,_0x2c9b34);_0xaf0f52['log'](_0x9baa('0x62'));});onConnect(_0xaf0f52);_0xaf0f52[_0x9baa('0x61')](_0x9baa('0x63'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 01cdc4e..197c797 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 _0x5121=['newmessage','Sms','SmsInteraction','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','request','EventManager','then','info','error','code','Trigger,\x20%s','catch','get','event','direction','UserId','User','find','name','format','SIP/%s','incomingmessage','outgoingmessage','opened','changed','closed','channel','default','length','hasOwnProperty','hook','callback','toLowerCase','condition','util','../../mysqldb','../logger','triggers','client','http','ChatInteraction','afterCreate','newinteraction','Chat','afterUpdate','closedinteraction','ChatMessage'];(function(_0x349204,_0xd65f54){var _0x5ec406=function(_0x4b7eeb){while(--_0x4b7eeb){_0x349204['push'](_0x349204['shift']());}};_0x5ec406(++_0xd65f54);}(_0x5121,0x110));var _0x1512=function(_0x1a6007,_0x350755){_0x1a6007=_0x1a6007-0x0;var _0x120665=_0x5121[_0x1a6007];return _0x120665;};'use strict';var util=require(_0x1512('0x0'));var db=require(_0x1512('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0x1512('0x2'))(_0x1512('0x3'));var client=jayson[_0x1512('0x4')][_0x1512('0x5')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x1512('0x6'),'event':_0x1512('0x7'),'condition':_0x1512('0x8'),'callback':afterCreate},{'channel':_0x1512('0x9'),'model':_0x1512('0x6'),'event':_0x1512('0xa'),'condition':_0x1512('0xb'),'callback':afterUpdate},{'channel':_0x1512('0x9'),'model':_0x1512('0xc'),'event':_0x1512('0x7'),'condition':_0x1512('0xd'),'callback':afterCreateMessage},{'channel':_0x1512('0xe'),'model':'SmsInteraction','event':_0x1512('0x7'),'condition':_0x1512('0x8'),'callback':afterCreate},{'channel':'Sms','model':_0x1512('0xf'),'event':_0x1512('0xa'),'condition':_0x1512('0xb'),'callback':afterUpdate},{'channel':_0x1512('0xe'),'model':'SmsMessage','event':_0x1512('0x7'),'condition':_0x1512('0xd'),'callback':afterCreateMessage},{'channel':_0x1512('0x10'),'model':_0x1512('0x11'),'event':_0x1512('0x7'),'condition':_0x1512('0x8'),'callback':afterCreate},{'channel':_0x1512('0x10'),'model':_0x1512('0x11'),'event':_0x1512('0xa'),'condition':_0x1512('0xb'),'callback':afterUpdate},{'channel':_0x1512('0x10'),'model':_0x1512('0x12'),'event':_0x1512('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x1512('0x13'),'model':_0x1512('0x14'),'event':_0x1512('0x7'),'condition':_0x1512('0x8'),'callback':afterCreate},{'channel':_0x1512('0x13'),'model':_0x1512('0x14'),'event':_0x1512('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x1512('0x13'),'model':_0x1512('0x15'),'event':_0x1512('0x7'),'condition':_0x1512('0xd'),'callback':afterCreateMessage},{'channel':_0x1512('0x16'),'model':_0x1512('0x17'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Mail','model':'MailInteraction','event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x1512('0x16'),'model':_0x1512('0x18'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x1512('0x19'),'model':_0x1512('0x1a'),'event':_0x1512('0x7'),'condition':_0x1512('0x8'),'callback':afterCreate},{'channel':_0x1512('0x19'),'model':'OpenchannelInteraction','event':'afterUpdate','condition':_0x1512('0xb'),'callback':afterUpdate},{'channel':_0x1512('0x19'),'model':'OpenchannelMessage','event':'afterCreate','condition':_0x1512('0xd'),'callback':afterCreateMessage}];function request(_0x5dbd86){return client[_0x1512('0x1b')](_0x1512('0x1c'),_0x5dbd86)[_0x1512('0x1d')](function(_0xa3c2cc){logger[_0x1512('0x1e')]('Trigger,\x20%s',_0x1512('0x1c'),_0xa3c2cc);if(_0xa3c2cc[_0x1512('0x1f')]){if(_0xa3c2cc[_0x1512('0x1f')][_0x1512('0x20')]===0x1f4){logger[_0x1512('0x1f')](_0x1512('0x21'),'EventManager',_0xa3c2cc[_0x1512('0x1f')]);}}})[_0x1512('0x22')](function(_0x4050b5){logger['error']('Trigger,\x20%s',_0x1512('0x1c'),_0x4050b5);});}function afterCreateMessage(_0x55f208,_0x54ac91){return function(_0x856917,_0x5b8166){_0x856917=_0x856917[_0x1512('0x23')]({'plain':!![]});_0x856917['channel']=_0x55f208;_0x856917[_0x1512('0x24')]=_0x856917[_0x1512('0x25')];if(_0x856917[_0x1512('0x26')]){return db[_0x1512('0x27')][_0x1512('0x28')]({'where':{'id':_0x856917[_0x1512('0x26')]},'attributes':['id',_0x1512('0x29')],'raw':!![]})[_0x1512('0x1d')](function(_0x39e616){_0x856917['interface']=util[_0x1512('0x2a')](_0x1512('0x2b'),_0x39e616[_0x1512('0x29')]);_0x856917['channel']=_0x55f208;return request({'event':_0x1512('0x2c'),'message':_0x856917});})[_0x1512('0x22')](function(_0x5640a6){console[_0x1512('0x1f')](_0x5640a6);});}else{return request({'event':_0x1512('0x2d'),'message':_0x856917});}};}function afterCreate(_0x3ab71a,_0x2ac5ee){return function(_0x337437,_0x5c0c39){_0x337437=_0x337437[_0x1512('0x23')]({'plain':!![]});_0x337437['channel']=_0x3ab71a;_0x337437[_0x1512('0x24')]=_0x1512('0x2e');return request({'event':_0x2ac5ee,'message':_0x337437});};}function afterUpdate(_0x3ffa0f,_0x1f85f0){return function(_0x14e8d2,_0x4bb80b){if(_0x14e8d2[_0x1512('0x2f')](_0x1512('0x30'))&&_0x14e8d2[_0x1512('0x30')]){_0x14e8d2=_0x14e8d2['get']({'plain':!![]});_0x14e8d2[_0x1512('0x31')]=_0x3ffa0f;_0x14e8d2[_0x1512('0x24')]=_0x1512('0x30');if(_0x14e8d2[_0x1512('0x26')]){return db['User']['find']({'where':{'id':_0x14e8d2['UserId']},'attributes':['id','name'],'raw':!![]})[_0x1512('0x1d')](function(_0xcbf3e9){_0x14e8d2['interface']=util[_0x1512('0x2a')](_0x1512('0x2b'),_0xcbf3e9['name']);return request({'event':_0x1f85f0,'message':_0x14e8d2});})[_0x1512('0x22')](function(_0x314ecc){console[_0x1512('0x1f')](_0x314ecc);});}else{return request({'event':_0x1f85f0,'message':_0x14e8d2});}}};}exports[_0x1512('0x32')]=function(){for(var _0x18bae5=0x0;_0x18bae5=_0x2c718e['agents']){throw Error(_0xb9dd('0x12'));}_0x1c2ce3(_0x31c8fa);})[_0xb9dd('0x13')](function(_0x796725){_0x445503(_0x796725);});});}; \ No newline at end of file +var _0xf5b9=['isUndefined','blockedAt','getLicense','User','count','agent','then','agents','catch','lodash','bluebird','../mysqldb','./license/util','mail','chat','sms','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser'];(function(_0x107399,_0xcc8fdc){var _0x1df8bc=function(_0x4ec355){while(--_0x4ec355){_0x107399['push'](_0x107399['shift']());}};_0x1df8bc(++_0xcc8fdc);}(_0xf5b9,0x13d));var _0x9f5b=function(_0x76c25f,_0x28cc79){_0x76c25f=_0x76c25f-0x0;var _0x17c0b4=_0xf5b9[_0x76c25f];return _0x17c0b4;};'use strict';var _=require(_0x9f5b('0x0'));var BPromise=require(_0x9f5b('0x1'));var db=require(_0x9f5b('0x2'))['db'];var util=require(_0x9f5b('0x3'));var channels=['voice',_0x9f5b('0x4'),_0x9f5b('0x5'),'fax',_0x9f5b('0x6'),'whatsapp',_0x9f5b('0x7')];exports[_0x9f5b('0x8')]=function(){return channels;};exports[_0x9f5b('0x9')]=function(_0x327ee7){_0x327ee7=_0x327ee7[_0x9f5b('0xa')]();return _[_0x9f5b('0xb')](channels,_0x327ee7);};exports[_0x9f5b('0xc')]=function(_0x6b94a2,_0xb46be5,_0x2f82ff,_0x128174){var _0xbfb965={'loginAttempts':_0xb46be5,'blocked':_0x2f82ff};if(!_[_0x9f5b('0xd')](_0x128174)){_0xbfb965[_0x9f5b('0xe')]=_0x128174;}return _0x6b94a2['updateAttributes'](_0xbfb965);};exports[_0x9f5b('0xf')]=function(_0x53b44f){return new BPromise(function(_0x32cd50,_0x579697){var _0xbac201=0x0;if(_0x53b44f['role']!=='agent'){_0x32cd50(_0x53b44f);}db[_0x9f5b('0x10')][_0x9f5b('0x11')]({'where':{'role':_0x9f5b('0x12'),'online':!![],'id':{'$ne':_0x53b44f['id']}}})[_0x9f5b('0x13')](function(_0x5671ff){_0xbac201=_0x5671ff;return util[_0x9f5b('0xf')]();})[_0x9f5b('0x13')](function(_0x1bacbb){if(_0x1bacbb&&_0x1bacbb[_0x9f5b('0x14')]&&_0xbac201>=_0x1bacbb['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x32cd50(_0x53b44f);})[_0x9f5b('0x15')](function(_0xf548ee){_0x579697(_0xf548ee);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 9a19066..d60c259 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f21=['send','exports','404','status'];(function(_0x111e51,_0x586666){var _0x51f35c=function(_0x3b29ae){while(--_0x3b29ae){_0x111e51['push'](_0x111e51['shift']());}};_0x51f35c(++_0x586666);}(_0x0f21,0x185));var _0x10f2=function(_0xb4b557,_0x3c7c8b){_0xb4b557=_0xb4b557-0x0;var _0x21068c=_0x0f21[_0xb4b557];return _0x21068c;};'use strict';module[_0x10f2('0x0')][0x194]=function pageNotFound(_0x4eb2af,_0x40d52b){var _0x118ddf=_0x10f2('0x1');var _0x394067=0x194;var _0x26e68f={'status':_0x394067};_0x40d52b[_0x10f2('0x2')](_0x26e68f[_0x10f2('0x2')]);_0x40d52b['render'](_0x118ddf,{},function(_0x4ef0d9,_0x15dd8b){if(_0x4ef0d9){return _0x40d52b[_0x10f2('0x2')](_0x26e68f['status'])['json'](_0x26e68f);}_0x40d52b[_0x10f2('0x3')](_0x15dd8b);});}; \ No newline at end of file +var _0xfed5=['exports','status','render','json'];(function(_0x56158d,_0x496299){var _0x4b8f0f=function(_0x1f9e16){while(--_0x1f9e16){_0x56158d['push'](_0x56158d['shift']());}};_0x4b8f0f(++_0x496299);}(_0xfed5,0x64));var _0x5fed=function(_0x15a3d7,_0x4571ce){_0x15a3d7=_0x15a3d7-0x0;var _0x299b50=_0xfed5[_0x15a3d7];return _0x299b50;};'use strict';module[_0x5fed('0x0')][0x194]=function pageNotFound(_0xa36f5e,_0x85a6f9){var _0x4d6514='404';var _0xafab82=0x194;var _0xeb33bc={'status':_0xafab82};_0x85a6f9[_0x5fed('0x1')](_0xeb33bc[_0x5fed('0x1')]);_0x85a6f9[_0x5fed('0x2')](_0x4d6514,{},function(_0xb7391d,_0x546920){if(_0xb7391d){return _0x85a6f9['status'](_0xeb33bc[_0x5fed('0x1')])[_0x5fed('0x3')](_0xeb33bc);}_0x85a6f9['send'](_0x546920);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index d46a104..9fe6f56 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8958=['Teams','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','MailInteractionId','Attachment','Attachments','Interaction','restrict','Interval','List','Items','FaxAccountId','Exntensions','user_has_fax_accounts','TagId','FaxInteractionId','fax_interaction_has_tags','Users','AttachmentId','UserFaxQueue','team_has_fax_queues','SmsAccountId','Applications','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelMessage','OpenchannelApplication','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ChatWebsiteId','ChatProactiveAction','ProactiveActions','ChatMessage','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatGroup','ChatInternalMessage','ChatGroupId','CmCompany','CompanyId','HopperHistories','Company','cm_contact_has_tags','OwnerId','CampaignId','Automation','All','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','CustomReportId','AnalyticMetric','MetricId','SalesforceConfiguration','Configurations','Subjects','SubjectId','DescriptionId','Fields','FieldId','AccountId','Subject','Description','Field','Variable','VariableId','Descriptions','DeskAccount','DeskField','int_desk_configuration_has_tags','ZohoConfiguration','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskAccount','VtigerAccount','ServicenowField','Dynamics365Configuration','Dynamics365Field','FreshsalesField','ToId','JscriptyProject','ProjectId','user_has_square_projects','team_has_voice_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','FromUserId','ToUserId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToAccount','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','CmCustomField','voice_queues_has_cm_lists','user_has_voice_prefixes','userProfileId','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','motion2','xcall','127.0.0.1','mysql','utf8mb4','name','utf8','sequelizeHistory','defaultsDeep','xC@LL1234','utf8_general_ci','database','username','options','password','User','../api/user/user.model','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailQueueReport','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopperBlack/cmHopperBlack.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','Action','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','../api/template/template.model','Trigger','../api/trigger/trigger.model','Integration','../api/integration/integration.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','VoicePrefix','../api/userProfile/userProfile.model','UserProfileResource','../api/notification/notification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','cascade','UserId','Recordings','UserVoiceQueueRt','hasMany','Extensions','HopperHistory','OpenchannelInteractions','SmsInteraction','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','Notification','Notifications','SenderId','belongsTo','UserProfile','chat_group_has_users','belongsToMany','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueue','MailQueues','ChatQueues','UserChatQueue','FaxQueues','UserOpenchannelQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccount','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProjects','SpiedAgents','VoiceMusicOnHold','Sounds','Members','Hoppers','CmHopperFinal','HopperFinals','VoiceQueueId','CmHopperBlack','HopperBlacks','JscriptySessionReport','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','Agents','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceQueueReport','AgentReports','uniqueid','Contact','ContactId','MailAccountId','MailServerOut','hasOne','Imap','Dispositions','Answers','Interactions','MailApplication','ListId','Template','TemplateId','mandatoryDispositionPauseId','user_has_mail_accounts','team_has_mail_queues'];(function(_0x2c1799,_0x5c2d41){var _0x343a49=function(_0x354b87){while(--_0x354b87){_0x2c1799['push'](_0x2c1799['shift']());}};_0x343a49(++_0x5c2d41);}(_0x8958,0x93));var _0x8895=function(_0x421cbc,_0x7c2f9c){_0x421cbc=_0x421cbc-0x0;var _0x15fe7c=_0x8958[_0x421cbc];return _0x15fe7c;};'use strict';var path=require('path');var config=require(_0x8895('0x0'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require('jstz');var timezone=jstz['determine']();config[_0x8895('0x1')]=_['defaultsDeep'](config[_0x8895('0x1')],{'database':_0x8895('0x2'),'username':_0x8895('0x3'),'password':'xC@LL1234','options':{'host':_0x8895('0x4'),'port':0xcea,'dialect':_0x8895('0x5'),'dialectOptions':{'charset':_0x8895('0x6')},'logging':![],'timezone':timezone[_0x8895('0x7')](),'define':{'charset':_0x8895('0x8'),'collate':'utf8_general_ci'}}});config[_0x8895('0x9')]=_[_0x8895('0xa')](config[_0x8895('0x9')],{'database':_0x8895('0x2'),'username':_0x8895('0x3'),'password':_0x8895('0xb'),'options':{'host':_0x8895('0x4'),'port':0xcea,'dialect':_0x8895('0x5'),'dialectOptions':{'charset':_0x8895('0x6')},'logging':![],'timezone':timezone[_0x8895('0x7')](),'define':{'charset':'utf8','collate':_0x8895('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8895('0x1')][_0x8895('0xd')],config[_0x8895('0x1')][_0x8895('0xe')],config[_0x8895('0x1')]['password'],config[_0x8895('0x1')][_0x8895('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8895('0x9')]['database'],config['sequelizeHistory'][_0x8895('0xe')],config['sequelizeHistory'][_0x8895('0x10')],config[_0x8895('0x9')][_0x8895('0xf')])};db[_0x8895('0x11')]=db[_0x8895('0x1')]['import'](_0x8895('0x12'));db[_0x8895('0x13')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x15'));db[_0x8895('0x16')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x17'));db[_0x8895('0x18')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x19'));db['VoiceMusicOnHold']=db['sequelize']['import'](_0x8895('0x1a'));db[_0x8895('0x1b')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x1c'));db[_0x8895('0x1d')]=db[_0x8895('0x1')][_0x8895('0x14')]('../api/voiceRecording/voiceRecording.model');db[_0x8895('0x1e')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x1f'));db[_0x8895('0x20')]=db['sequelize']['import'](_0x8895('0x21'));db[_0x8895('0x22')]=db[_0x8895('0x1')][_0x8895('0x14')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x8895('0x23')]=db[_0x8895('0x1')][_0x8895('0x14')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db[_0x8895('0x1')]['import'](_0x8895('0x24'));db[_0x8895('0x25')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x26'));db['VoiceQueueReport']=db['sequelize'][_0x8895('0x14')](_0x8895('0x27'));db[_0x8895('0x28')]=db[_0x8895('0x1')][_0x8895('0x14')]('../api/memberReport/memberReport.model');db['Trunk']=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x29'));db[_0x8895('0x2a')]=db[_0x8895('0x1')]['import'](_0x8895('0x2b'));db['UserVoiceQueueRt']=db[_0x8895('0x1')]['import'](_0x8895('0x2c'));db[_0x8895('0x2d')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x2e'));db['UserChatQueue']=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x2f'));db[_0x8895('0x30')]=db[_0x8895('0x1')]['import'](_0x8895('0x31'));db['UserFaxQueue']=db[_0x8895('0x1')]['import'](_0x8895('0x32'));db[_0x8895('0x33')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x34'));db['UserOpenchannelQueue']=db[_0x8895('0x1')]['import'](_0x8895('0x35'));db[_0x8895('0x36')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x37'));db[_0x8895('0x38')]=db['sequelize'][_0x8895('0x14')](_0x8895('0x39'));db['MailServerOut']=db[_0x8895('0x1')]['import'](_0x8895('0x3a'));db[_0x8895('0x3b')]=db['sequelize'][_0x8895('0x14')](_0x8895('0x3c'));db['MailQueue']=db['sequelize'][_0x8895('0x14')](_0x8895('0x3d'));db[_0x8895('0x3e')]=db[_0x8895('0x1')][_0x8895('0x14')]('../api/mailSubstatus/mailSubstatus.model');db[_0x8895('0x3f')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x40'));db[_0x8895('0x41')]=db[_0x8895('0x1')]['import'](_0x8895('0x42'));db['MailApplication']=db[_0x8895('0x1')][_0x8895('0x14')]('../api/mailApplication/mailApplication.model');db[_0x8895('0x43')]=db['sequelize'][_0x8895('0x14')]('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db['sequelize']['import']('../api/dashboard/dashboard.model');db['DashboardItem']=db[_0x8895('0x1')][_0x8895('0x14')]('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db[_0x8895('0x1')][_0x8895('0x14')]('../api/faxAccount/faxAccount.model');db[_0x8895('0x44')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x45'));db[_0x8895('0x46')]=db['sequelize']['import']('../api/faxInteraction/faxInteraction.model');db[_0x8895('0x47')]=db['sequelize'][_0x8895('0x14')](_0x8895('0x48'));db[_0x8895('0x49')]=db[_0x8895('0x1')]['import'](_0x8895('0x4a'));db[_0x8895('0x4b')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x4c'));db[_0x8895('0x4d')]=db[_0x8895('0x1')][_0x8895('0x14')]('../api/smsAccount/smsAccount.model');db[_0x8895('0x4e')]=db[_0x8895('0x1')]['import'](_0x8895('0x4f'));db['SmsInteraction']=db['sequelize'][_0x8895('0x14')](_0x8895('0x50'));db[_0x8895('0x51')]=db['sequelize'][_0x8895('0x14')]('../api/smsMessage/smsMessage.model');db[_0x8895('0x52')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x53'));db[_0x8895('0x54')]=db[_0x8895('0x1')][_0x8895('0x14')]('../api/openchannelAccount/openchannelAccount.model');db['OpenchannelApplication']=db[_0x8895('0x1')][_0x8895('0x14')]('../api/openchannelApplication/openchannelApplication.model');db[_0x8895('0x55')]=db['sequelize']['import'](_0x8895('0x56'));db['OpenchannelMessage']=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x57'));db[_0x8895('0x58')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x59'));db[_0x8895('0x5a')]=db['sequelize'][_0x8895('0x14')](_0x8895('0x5b'));db[_0x8895('0x5c')]=db['sequelize'][_0x8895('0x14')](_0x8895('0x5d'));db[_0x8895('0x5e')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x5f'));db[_0x8895('0x60')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x61'));db['ChatMessage']=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x62'));db[_0x8895('0x63')]=db[_0x8895('0x1')]['import'](_0x8895('0x64'));db[_0x8895('0x65')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x66'));db['ChatGroup']=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x67'));db['ChatProactiveAction']=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x68'));db['CmCompany']=db[_0x8895('0x1')][_0x8895('0x14')]('../api/cmCompany/cmCompany.model');db[_0x8895('0x69')]=db[_0x8895('0x1')]['import'](_0x8895('0x6a'));db[_0x8895('0x6b')]=db[_0x8895('0x1')][_0x8895('0x14')]('../api/cmHopper/cmHopper.model');db['CmHopperBlack']=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x6c'));db['CmHopperFinal']=db[_0x8895('0x1')][_0x8895('0x14')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x8895('0x6d')]=db['sequelize'][_0x8895('0x14')](_0x8895('0x6e'));db[_0x8895('0x6f')]=db[_0x8895('0x1')][_0x8895('0x14')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db[_0x8895('0x1')][_0x8895('0x14')]('../api/cmCustomField/cmCustomField.model');db[_0x8895('0x70')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x71'));db['Automation']=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x72'));db[_0x8895('0x73')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x74'));db[_0x8895('0x75')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x76'));db[_0x8895('0x77')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x78'));db['Interval']=db['sequelize']['import'](_0x8895('0x79'));db[_0x8895('0x7a')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x7b'));db['Cdr']=db[_0x8895('0x1')][_0x8895('0x14')]('../api/cdr/cdr.model');db[_0x8895('0x7c')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x7d'));db[_0x8895('0x7e')]=db['sequelize'][_0x8895('0x14')](_0x8895('0x7f'));db[_0x8895('0x80')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x81'));db[_0x8895('0x82')]=db['sequelize'][_0x8895('0x14')](_0x8895('0x83'));db['Template']=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x84'));db[_0x8895('0x85')]=db[_0x8895('0x1')]['import'](_0x8895('0x86'));db['Variable']=db[_0x8895('0x1')][_0x8895('0x14')]('../api/variable/variable.model');db[_0x8895('0x87')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x88'));db['IntegrationReport']=db[_0x8895('0x1')]['import']('../api/integrationReport/integrationReport.model');db[_0x8895('0x89')]=db[_0x8895('0x1')][_0x8895('0x14')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x8895('0x8a')]=db['sequelize'][_0x8895('0x14')](_0x8895('0x8b'));db[_0x8895('0x8c')]=db[_0x8895('0x1')][_0x8895('0x14')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db[_0x8895('0x1')]['import'](_0x8895('0x8d'));db[_0x8895('0x8e')]=db['sequelize'][_0x8895('0x14')](_0x8895('0x8f'));db[_0x8895('0x90')]=db[_0x8895('0x1')][_0x8895('0x14')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x8895('0x91')]=db['sequelize']['import'](_0x8895('0x92'));db['SalesforceConfiguration']=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x93'));db[_0x8895('0x94')]=db['sequelize']['import']('../api/intSalesforceField/intSalesforceField.model');db[_0x8895('0x95')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x96'));db[_0x8895('0x97')]=db[_0x8895('0x1')]['import'](_0x8895('0x98'));db[_0x8895('0x99')]=db[_0x8895('0x1')]['import'](_0x8895('0x9a'));db['DeskAccount']=db[_0x8895('0x1')]['import'](_0x8895('0x9b'));db[_0x8895('0x9c')]=db['sequelize'][_0x8895('0x14')](_0x8895('0x9d'));db['DeskField']=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x9e'));db[_0x8895('0x9f')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xa0'));db['ZohoConfiguration']=db[_0x8895('0x1')]['import'](_0x8895('0xa1'));db[_0x8895('0xa2')]=db[_0x8895('0x1')][_0x8895('0x14')]('../api/intZohoField/intZohoField.model');db[_0x8895('0xa3')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xa4'));db[_0x8895('0xa5')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xa6'));db['ZendeskField']=db[_0x8895('0x1')][_0x8895('0x14')]('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xa7'));db[_0x8895('0xa8')]=db['sequelize']['import'](_0x8895('0xa9'));db[_0x8895('0xaa')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xab'));db['VtigerAccount']=db[_0x8895('0x1')][_0x8895('0x14')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x8895('0xac')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xad'));db[_0x8895('0xae')]=db[_0x8895('0x1')]['import'](_0x8895('0xaf'));db[_0x8895('0xb0')]=db['sequelize']['import']('../api/intServicenowAccount/intServicenowAccount.model');db[_0x8895('0xb1')]=db[_0x8895('0x1')]['import'](_0x8895('0xb2'));db['ServicenowField']=db['sequelize']['import'](_0x8895('0xb3'));db[_0x8895('0xb4')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xb5'));db['Dynamics365Configuration']=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xb6'));db['Dynamics365Field']=db['sequelize']['import'](_0x8895('0xb7'));db[_0x8895('0xb8')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xb9'));db[_0x8895('0xba')]=db[_0x8895('0x1')]['import'](_0x8895('0xbb'));db['FreshsalesField']=db[_0x8895('0x1')]['import'](_0x8895('0xbc'));db[_0x8895('0x87')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0x88'));db[_0x8895('0xbd')]=db[_0x8895('0x1')]['import'](_0x8895('0xbe'));db[_0x8895('0xbf')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xc0'));db['ChatInternalMessage']=db[_0x8895('0x1')]['import'](_0x8895('0xc1'));db[_0x8895('0xc2')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xc3'));db[_0x8895('0xc4')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xc5'));db['JscriptySessionReport']=db[_0x8895('0x1')]['import'](_0x8895('0xc6'));db[_0x8895('0xc7')]=db[_0x8895('0x1')]['import'](_0x8895('0xc8'));db['SquareReport']=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xc9'));db[_0x8895('0xca')]=db['sequelize']['import'](_0x8895('0xcb'));db['JscriptyProject']=db['sequelize'][_0x8895('0x14')]('../api/jscriptyProject/jscriptyProject.model');db[_0x8895('0xcc')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xcd'));db[_0x8895('0xce')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xcf'));db[_0x8895('0xd0')]=db['sequelize'][_0x8895('0x14')](_0x8895('0xd1'));db[_0x8895('0xd2')]=db['sequelize'][_0x8895('0x14')](_0x8895('0xd3'));db[_0x8895('0xd4')]=db['sequelize'][_0x8895('0x14')](_0x8895('0xd5'));db[_0x8895('0xd6')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xd7'));db[_0x8895('0xd8')]=db['sequelize'][_0x8895('0x14')](_0x8895('0xd9'));db[_0x8895('0xda')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xdb'));db['Migration']=db[_0x8895('0x1')][_0x8895('0x14')]('../api/migration/migration.model');db['Attachment']=db[_0x8895('0x1')][_0x8895('0x14')]('../api/attachment/attachment.model');db[_0x8895('0xdc')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xdd'));db[_0x8895('0xde')]=db['sequelize'][_0x8895('0x14')](_0x8895('0xdf'));db[_0x8895('0xe0')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xe1'));db[_0x8895('0xe2')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xe3'));db[_0x8895('0xe4')]=db[_0x8895('0x1')]['import'](_0x8895('0xe5'));db[_0x8895('0xe6')]=db[_0x8895('0x1')][_0x8895('0x14')]('../api/smsTransferReport/smsTransferReport.model');db[_0x8895('0xe7')]=db[_0x8895('0x1')]['import']('../api/cmList/cmList.model');db[_0x8895('0xe8')]=db['sequelize'][_0x8895('0x14')]('../api/voicePrefix/voicePrefix.model');db['UserProfile']=db[_0x8895('0x1')]['import'](_0x8895('0xe9'));db['UserProfileSection']=db[_0x8895('0x1')][_0x8895('0x14')]('../api/userProfileSection/userProfileSection.model');db[_0x8895('0xea')]=db[_0x8895('0x1')][_0x8895('0x14')]('../api/userProfileResource/userProfileResource.model');db['Notification']=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xeb'));db[_0x8895('0xec')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xed'));db[_0x8895('0xee')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xef'));db[_0x8895('0xf0')]=db[_0x8895('0x1')][_0x8895('0x14')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x8895('0xf1')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xf2'));db['WhatsappQueueReport']=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xf3'));db[_0x8895('0xf4')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xf5'));db[_0x8895('0xf6')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xf7'));db[_0x8895('0xf8')]=db[_0x8895('0x1')][_0x8895('0x14')](_0x8895('0xf9'));db[_0x8895('0x11')]['hasOne'](db[_0x8895('0x20')],{'as':'VoiceMail','onDelete':_0x8895('0xfa'),'foreignKey':_0x8895('0xfb')});db[_0x8895('0x11')]['hasMany'](db[_0x8895('0x1d')],{'as':_0x8895('0xfc'),'foreignKey':'UserId'});db[_0x8895('0x11')]['hasMany'](db[_0x8895('0xfd')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0x8895('0x11')][_0x8895('0xfe')](db[_0x8895('0x18')],{'as':_0x8895('0xff'),'onDelete':_0x8895('0xfa'),'hooks':!![]});db['User'][_0x8895('0xfe')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x8895('0xfb')});db[_0x8895('0x11')]['hasMany'](db[_0x8895('0x6d')],{'as':_0x8895('0x100'),'foreignKey':_0x8895('0xfb')});db['User'][_0x8895('0xfe')](db[_0x8895('0x6f')],{'as':_0x8895('0x6f'),'foreignKey':'UserId'});db[_0x8895('0x11')][_0x8895('0xfe')](db[_0x8895('0x55')],{'as':_0x8895('0x101'),'foreignKey':_0x8895('0xfb')});db[_0x8895('0x11')][_0x8895('0xfe')](db[_0x8895('0x60')],{'as':'ChatInteractions','foreignKey':'UserId'});db[_0x8895('0x11')]['hasMany'](db[_0x8895('0x102')],{'as':_0x8895('0x103'),'foreignKey':_0x8895('0xfb')});db[_0x8895('0x11')][_0x8895('0xfe')](db[_0x8895('0x46')],{'as':_0x8895('0x104'),'foreignKey':_0x8895('0xfb')});db[_0x8895('0x11')][_0x8895('0xfe')](db[_0x8895('0x3f')],{'as':_0x8895('0x105'),'foreignKey':'UserId'});db[_0x8895('0x11')][_0x8895('0xfe')](db[_0x8895('0xf0')],{'as':_0x8895('0x106'),'foreignKey':_0x8895('0xfb')});db[_0x8895('0x11')][_0x8895('0xfe')](db[_0x8895('0x107')],{'as':_0x8895('0x108'),'foreignKey':_0x8895('0x109')});db[_0x8895('0x11')][_0x8895('0x10a')](db[_0x8895('0x10b')],{'as':_0x8895('0x10b'),'foreignKey':'userProfileId'});db[_0x8895('0x11')]['belongsToMany'](db['ChatGroup'],{'as':'Groups','through':_0x8895('0x10c')});db[_0x8895('0x11')][_0x8895('0x10d')](db['CmContact'],{'as':_0x8895('0x10e'),'through':_0x8895('0x10f')});db[_0x8895('0x11')]['belongsToMany'](db[_0x8895('0xe7')],{'as':_0x8895('0x110'),'through':_0x8895('0x111')});db['User'][_0x8895('0x10d')](db[_0x8895('0xd6')],{'through':_0x8895('0x112')});db[_0x8895('0x11')][_0x8895('0x10d')](db[_0x8895('0x3f')],{'as':'MailInteractions','through':_0x8895('0x113')});db[_0x8895('0x11')]['belongsToMany'](db[_0x8895('0x60')],{'as':_0x8895('0x114'),'through':_0x8895('0x115')});db[_0x8895('0x11')][_0x8895('0x10d')](db[_0x8895('0x46')],{'as':_0x8895('0x104'),'through':_0x8895('0x116')});db[_0x8895('0x11')][_0x8895('0x10d')](db[_0x8895('0x102')],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db[_0x8895('0x11')][_0x8895('0x10d')](db[_0x8895('0x55')],{'as':_0x8895('0x101'),'through':_0x8895('0x117')});db[_0x8895('0x11')][_0x8895('0x10d')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':_0x8895('0x118')});db[_0x8895('0x11')][_0x8895('0x10d')](db[_0x8895('0x1b')],{'as':_0x8895('0x119'),'through':_0x8895('0x2d'),'required':![]});db[_0x8895('0x11')][_0x8895('0x10d')](db[_0x8895('0x11a')],{'as':_0x8895('0x11b'),'through':'UserMailQueue','required':![]});db[_0x8895('0x11')]['belongsToMany'](db[_0x8895('0x65')],{'as':_0x8895('0x11c'),'through':_0x8895('0x11d'),'required':![],'hooks':!![]});db['User']['belongsToMany'](db['FaxQueue'],{'as':_0x8895('0x11e'),'through':'UserFaxQueue','required':![]});db[_0x8895('0x11')][_0x8895('0x10d')](db[_0x8895('0x52')],{'as':'SmsQueues','through':_0x8895('0x33'),'required':![]});db[_0x8895('0x11')]['belongsToMany'](db[_0x8895('0x58')],{'as':'OpenchannelQueues','through':_0x8895('0x11f'),'required':![]});db[_0x8895('0x11')][_0x8895('0x10d')](db[_0x8895('0xf6')],{'as':_0x8895('0x120'),'through':'UserWhatsappQueue','required':![]});db['User'][_0x8895('0x10d')](db[_0x8895('0xe7')],{'through':_0x8895('0x111')});db[_0x8895('0x11')][_0x8895('0x10d')](db[_0x8895('0xe8')],{'as':'VoicePrefixes','through':'user_has_voice_prefixes','required':![]});db[_0x8895('0x11')][_0x8895('0x10d')](db[_0x8895('0x5a')],{'as':_0x8895('0x121'),'through':_0x8895('0x122')});db['User']['belongsToMany'](db[_0x8895('0x123')],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db[_0x8895('0x11')][_0x8895('0x10d')](db['MailAccount'],{'as':_0x8895('0x124'),'through':'user_has_mail_accounts'});db[_0x8895('0x11')][_0x8895('0x10d')](db[_0x8895('0x54')],{'as':_0x8895('0x125'),'through':_0x8895('0x126')});db[_0x8895('0x11')]['belongsToMany'](db[_0x8895('0x4d')],{'as':_0x8895('0x127'),'through':_0x8895('0x128')});db[_0x8895('0x11')][_0x8895('0x10d')](db[_0x8895('0xec')],{'as':'WhatsappAccounts','through':_0x8895('0x129')});db[_0x8895('0x11')][_0x8895('0x10d')](db[_0x8895('0xd0')],{'as':_0x8895('0x12a'),'through':'user_has_square_projects'});db['VoiceChanSpy']['hasMany'](db[_0x8895('0x18')],{'as':_0x8895('0x12b'),'onDelete':_0x8895('0xfa'),'foreignKey':'ChanSpyId'});db['VoiceContext'][_0x8895('0xfe')](db[_0x8895('0x18')],{'onDelete':_0x8895('0xfa')});db[_0x8895('0x18')][_0x8895('0xfe')](db[_0x8895('0x18')],{'as':'Applications','onDelete':'cascade'});db[_0x8895('0x12c')][_0x8895('0x10d')](db['Sound'],{'as':_0x8895('0x12d'),'through':'moh_has_sounds'});db['VoiceQueue'][_0x8895('0xfe')](db[_0x8895('0xfd')],{'as':_0x8895('0x12e'),'foreignKey':'VoiceQueueId'});db[_0x8895('0x1b')]['hasMany'](db[_0x8895('0x6b')],{'as':_0x8895('0x12f'),'foreignKey':'VoiceQueueId'});db[_0x8895('0x1b')]['hasMany'](db[_0x8895('0x130')],{'as':_0x8895('0x131'),'foreignKey':_0x8895('0x132')});db[_0x8895('0x1b')]['hasMany'](db[_0x8895('0x6d')],{'as':'HopperHistories','foreignKey':_0x8895('0x132')});db[_0x8895('0x1b')][_0x8895('0xfe')](db[_0x8895('0x6f')],{'as':_0x8895('0x6f'),'foreignKey':_0x8895('0x132')});db[_0x8895('0x1b')][_0x8895('0xfe')](db[_0x8895('0x133')],{'as':_0x8895('0x134'),'foreignKey':_0x8895('0x132')});db['VoiceQueue'][_0x8895('0xfe')](db[_0x8895('0x135')],{'as':_0x8895('0x136'),'foreignKey':'VoiceQueueId'});db[_0x8895('0x1b')][_0x8895('0x10a')](db['Trunk'],{'as':_0x8895('0x137'),'foreignKey':_0x8895('0x138')});db[_0x8895('0x1b')][_0x8895('0x10a')](db[_0x8895('0x137')],{'as':_0x8895('0x139'),'foreignKey':_0x8895('0x13a')});db[_0x8895('0x1b')][_0x8895('0x10a')](db['Interval'],{'as':'Interval','foreignKey':_0x8895('0x13b')});db['VoiceQueue'][_0x8895('0x10a')](db[_0x8895('0x7a')],{'as':_0x8895('0x13c'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x8895('0x1b')]['belongsToMany'](db[_0x8895('0xe7')],{'as':_0x8895('0x110'),'through':'voice_queues_has_cm_lists'});db[_0x8895('0x1b')][_0x8895('0x10d')](db[_0x8895('0x11')],{'as':_0x8895('0x13d'),'through':_0x8895('0x2d')});db['VoiceQueue'][_0x8895('0x10d')](db[_0x8895('0xd6')],{'as':'Teams','through':'team_has_voice_queues'});db[_0x8895('0x1b')]['belongsToMany'](db[_0x8895('0xe7')],{'as':_0x8895('0x13e'),'through':_0x8895('0x13f')});db[_0x8895('0x1d')][_0x8895('0x10a')](db[_0x8895('0x11')],{'as':'User','foreignKey':_0x8895('0xfb')});db[_0x8895('0x1e')][_0x8895('0x10a')](db[_0x8895('0x11')],{'as':_0x8895('0x11'),'foreignKey':_0x8895('0xfb')});db[_0x8895('0x20')]['hasMany'](db['VoiceMailMessage'],{'as':_0x8895('0x140'),'onDelete':_0x8895('0xfa'),'foreignKey':_0x8895('0x141'),'sourceKey':_0x8895('0x142')});db['VoiceMailMessage']['belongsTo'](db[_0x8895('0x20')],{'foreignKey':_0x8895('0x141'),'targetKey':_0x8895('0x142')});db[_0x8895('0x23')][_0x8895('0xfe')](db[_0x8895('0x143')],{'as':'QueueCalls','foreignKey':'uniqueid','constraints':![]});db[_0x8895('0x23')][_0x8895('0xfe')](db[_0x8895('0x25')],{'as':_0x8895('0x144'),'foreignKey':_0x8895('0x145'),'constraints':![]});db[_0x8895('0x23')][_0x8895('0x10a')](db[_0x8895('0x11')],{'as':_0x8895('0x11'),'foreignKey':'UserId'});db[_0x8895('0x23')][_0x8895('0x10a')](db['CmContact'],{'as':_0x8895('0x146'),'foreignKey':_0x8895('0x147')});db[_0x8895('0x38')][_0x8895('0x10a')](db[_0x8895('0x3b')],{'as':_0x8895('0x3b'),'foreignKey':_0x8895('0x148')});db[_0x8895('0x149')]['belongsTo'](db['MailAccount'],{'as':_0x8895('0x3b'),'foreignKey':_0x8895('0x148')});db[_0x8895('0x3b')][_0x8895('0x14a')](db[_0x8895('0x38')],{'as':_0x8895('0x14b'),'onDelete':'cascade'});db[_0x8895('0x3b')][_0x8895('0x14a')](db[_0x8895('0x149')],{'as':'Smtp','onDelete':_0x8895('0xfa')});db[_0x8895('0x3b')][_0x8895('0xfe')](db['Disposition'],{'as':_0x8895('0x14c'),'foreignKey':'MailAccountId'});db[_0x8895('0x3b')][_0x8895('0xfe')](db[_0x8895('0x73')],{'as':_0x8895('0x14d'),'foreignKey':_0x8895('0x148')});db['MailAccount']['hasMany'](db[_0x8895('0x41')],{'as':'Messages','foreignKey':_0x8895('0x148')});db[_0x8895('0x3b')][_0x8895('0xfe')](db[_0x8895('0x3f')],{'as':_0x8895('0x14e')});db[_0x8895('0x3b')][_0x8895('0xfe')](db[_0x8895('0x14f')],{'as':'Applications'});db[_0x8895('0x3b')][_0x8895('0x10a')](db[_0x8895('0xe7')],{'as':'List','foreignKey':_0x8895('0x150')});db['MailAccount'][_0x8895('0x10a')](db[_0x8895('0x151')],{'as':_0x8895('0x151'),'foreignKey':_0x8895('0x152')});db[_0x8895('0x3b')][_0x8895('0x10a')](db['Pause'],{'as':_0x8895('0x13c'),'foreignKey':_0x8895('0x153')});db[_0x8895('0x3b')]['belongsToMany'](db[_0x8895('0x11')],{'as':'Agents','through':_0x8895('0x154')});db[_0x8895('0x11a')][_0x8895('0x10d')](db[_0x8895('0x11')],{'as':_0x8895('0x13d'),'through':_0x8895('0x30')});db[_0x8895('0x11a')][_0x8895('0x10d')](db[_0x8895('0xd6')],{'through':_0x8895('0x155'),'as':_0x8895('0x156')});db['MailInteraction']['hasMany'](db[_0x8895('0x41')],{'as':_0x8895('0x140'),'onDelete':_0x8895('0xfa'),'foreignKey':'MailInteractionId'});db[_0x8895('0x3f')][_0x8895('0x10a')](db['MailAccount'],{'as':_0x8895('0x157'),'foreignKey':'MailAccountId'});db[_0x8895('0x3f')][_0x8895('0x10a')](db[_0x8895('0x69')],{'as':_0x8895('0x146'),'foreignKey':_0x8895('0x147')});db[_0x8895('0x3f')]['belongsTo'](db[_0x8895('0x11')],{'as':_0x8895('0x158'),'foreignKey':_0x8895('0xfb')});db[_0x8895('0x3f')][_0x8895('0x10d')](db[_0x8895('0x82')],{'through':_0x8895('0x159'),'as':_0x8895('0x15a')});db['MailInteraction'][_0x8895('0x10d')](db[_0x8895('0x82')],{'through':_0x8895('0x159'),'as':_0x8895('0x15b')});db[_0x8895('0x3f')][_0x8895('0x10d')](db['User'],{'as':'Users','through':_0x8895('0x113'),'foreignKey':_0x8895('0x15c')});db[_0x8895('0x41')][_0x8895('0xfe')](db[_0x8895('0x15d')],{'as':_0x8895('0x15e'),'onDelete':_0x8895('0xfa')});db['MailMessage']['belongsTo'](db[_0x8895('0x11')],{'as':'User'});db[_0x8895('0x41')][_0x8895('0x10a')](db[_0x8895('0x69')],{'onDelete':_0x8895('0xfa'),'as':'Contact'});db[_0x8895('0x41')][_0x8895('0x10a')](db[_0x8895('0x3f')],{'as':_0x8895('0x15f'),'foreignKey':'MailInteractionId'});db[_0x8895('0x41')][_0x8895('0x10a')](db['MailAccount'],{'as':_0x8895('0x157'),'foreignKey':_0x8895('0x148')});db[_0x8895('0x14f')][_0x8895('0x10a')](db[_0x8895('0x11')],{'onDelete':_0x8895('0x160')});db[_0x8895('0x14f')]['belongsTo'](db[_0x8895('0x11a')],{'onDelete':_0x8895('0x160')});db['MailApplication'][_0x8895('0x10a')](db[_0x8895('0x3b')],{'onDelete':'restrict'});db['MailApplication'][_0x8895('0x10a')](db[_0x8895('0x161')],{'onDelete':_0x8895('0x160'),'foreignKey':_0x8895('0x13b')});db[_0x8895('0x14f')][_0x8895('0x10a')](db[_0x8895('0x82')],{'onDelete':_0x8895('0x160'),'foreignKey':'TagId'});db[_0x8895('0x43')]['belongsTo'](db[_0x8895('0x3b')],{});db[_0x8895('0x43')][_0x8895('0x10a')](db[_0x8895('0xe7')],{'as':_0x8895('0x162'),'foreignKey':'ListId'});db[_0x8895('0x43')][_0x8895('0x10a')](db[_0x8895('0x69')],{'as':_0x8895('0x146'),'foreignKey':_0x8895('0x147')});db['MailQueueReport'][_0x8895('0x10a')](db[_0x8895('0x3f')],{});db['MailQueueReport']['belongsTo'](db[_0x8895('0x41')],{});db[_0x8895('0x43')][_0x8895('0x10a')](db[_0x8895('0x11')],{});db[_0x8895('0x43')][_0x8895('0x10a')](db[_0x8895('0x11a')],{});db['Dashboard'][_0x8895('0xfe')](db['DashboardItem'],{'as':_0x8895('0x163'),'onDelete':_0x8895('0xfa')});db['FaxAccount']['hasMany'](db[_0x8895('0x75')],{'as':_0x8895('0x14c'),'foreignKey':_0x8895('0x164')});db['FaxAccount'][_0x8895('0xfe')](db[_0x8895('0x73')],{'as':'Answers','foreignKey':_0x8895('0x164')});db[_0x8895('0x123')][_0x8895('0xfe')](db[_0x8895('0x46')],{'as':'Interactions'});db[_0x8895('0x123')]['hasMany'](db[_0x8895('0x44')],{'as':'Applications'});db[_0x8895('0x123')]['hasMany'](db['VoiceExtension'],{'as':_0x8895('0x165'),'onDelete':_0x8895('0xfa')});db[_0x8895('0x123')][_0x8895('0xfe')](db[_0x8895('0x47')],{'as':_0x8895('0x140')});db[_0x8895('0x123')]['belongsTo'](db['Trunk'],{'as':_0x8895('0x137')});db[_0x8895('0x123')][_0x8895('0x10a')](db[_0x8895('0xe7')],{'as':_0x8895('0x162'),'foreignKey':_0x8895('0x150')});db['FaxAccount'][_0x8895('0x10a')](db[_0x8895('0x7a')],{'as':_0x8895('0x13c'),'foreignKey':_0x8895('0x153')});db[_0x8895('0x123')][_0x8895('0x10d')](db[_0x8895('0x11')],{'as':'Agents','through':_0x8895('0x166')});db[_0x8895('0x44')][_0x8895('0x10a')](db[_0x8895('0x11')],{'onDelete':_0x8895('0x160')});db[_0x8895('0x44')][_0x8895('0x10a')](db[_0x8895('0x49')],{'onDelete':_0x8895('0x160')});db['FaxApplication'][_0x8895('0x10a')](db[_0x8895('0x123')],{'onDelete':_0x8895('0x160')});db[_0x8895('0x44')][_0x8895('0x10a')](db[_0x8895('0x82')],{'onDelete':_0x8895('0x160'),'foreignKey':_0x8895('0x167')});db[_0x8895('0x46')]['hasMany'](db[_0x8895('0x47')],{'as':_0x8895('0x140'),'onDelete':_0x8895('0xfa'),'foreignKey':_0x8895('0x168')});db[_0x8895('0x46')][_0x8895('0x10a')](db[_0x8895('0x123')],{'as':_0x8895('0x157'),'foreignKey':_0x8895('0x164')});db[_0x8895('0x46')][_0x8895('0x10a')](db[_0x8895('0x69')],{'as':_0x8895('0x146'),'foreignKey':'ContactId'});db[_0x8895('0x46')][_0x8895('0x10a')](db[_0x8895('0x11')],{'as':_0x8895('0x158'),'foreignKey':_0x8895('0xfb')});db[_0x8895('0x46')]['belongsToMany'](db[_0x8895('0x82')],{'through':'fax_interaction_has_tags','as':_0x8895('0x15a')});db[_0x8895('0x46')][_0x8895('0x10d')](db[_0x8895('0x82')],{'through':_0x8895('0x169'),'as':_0x8895('0x15b')});db[_0x8895('0x46')][_0x8895('0x10d')](db[_0x8895('0x11')],{'as':_0x8895('0x16a'),'through':_0x8895('0x116'),'foreignKey':_0x8895('0x168')});db[_0x8895('0x47')][_0x8895('0x10a')](db['User'],{'onDelete':'cascade','as':_0x8895('0x11')});db[_0x8895('0x47')]['belongsTo'](db[_0x8895('0x46')],{'as':_0x8895('0x15f'),'foreignKey':_0x8895('0x168')});db[_0x8895('0x47')][_0x8895('0x10a')](db[_0x8895('0x69')],{'onDelete':_0x8895('0xfa'),'as':_0x8895('0x146')});db[_0x8895('0x47')][_0x8895('0x10a')](db[_0x8895('0x15d')],{'as':_0x8895('0x15d'),'foreignKey':_0x8895('0x16b')});db[_0x8895('0x47')][_0x8895('0x10a')](db[_0x8895('0x123')],{'as':'Account','foreignKey':_0x8895('0x164')});db['FaxQueue'][_0x8895('0x10d')](db[_0x8895('0x11')],{'as':_0x8895('0x13d'),'through':_0x8895('0x16c')});db['FaxQueue'][_0x8895('0x10d')](db['Team'],{'through':_0x8895('0x16d'),'as':'Teams'});db['FaxQueueReport']['belongsTo'](db[_0x8895('0x123')],{});db[_0x8895('0x4b')][_0x8895('0x10a')](db[_0x8895('0xe7')],{'as':'List','foreignKey':_0x8895('0x150')});db['FaxQueueReport'][_0x8895('0x10a')](db[_0x8895('0x69')],{'as':_0x8895('0x146'),'foreignKey':'ContactId'});db['FaxQueueReport']['belongsTo'](db[_0x8895('0x46')],{});db[_0x8895('0x4b')][_0x8895('0x10a')](db['FaxMessage'],{});db[_0x8895('0x4b')][_0x8895('0x10a')](db[_0x8895('0x11')],{});db[_0x8895('0x4b')][_0x8895('0x10a')](db['FaxQueue'],{});db[_0x8895('0x4d')]['hasMany'](db[_0x8895('0x75')],{'as':_0x8895('0x14c'),'foreignKey':'SmsAccountId'});db[_0x8895('0x4d')]['hasMany'](db[_0x8895('0x73')],{'as':_0x8895('0x14d'),'foreignKey':_0x8895('0x16e')});db[_0x8895('0x4d')]['hasMany'](db['SmsMessage'],{'as':_0x8895('0x140'),'foreignKey':_0x8895('0x16e')});db[_0x8895('0x4d')]['hasMany'](db['SmsInteraction'],{'as':_0x8895('0x14e')});db[_0x8895('0x4d')]['hasMany'](db[_0x8895('0x4e')],{'as':_0x8895('0x16f')});db['SmsAccount'][_0x8895('0x10a')](db[_0x8895('0xe7')],{'as':_0x8895('0x162'),'foreignKey':_0x8895('0x150')});db['SmsAccount'][_0x8895('0x10a')](db['Pause'],{'as':_0x8895('0x13c'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x8895('0x4d')]['belongsToMany'](db[_0x8895('0x11')],{'as':_0x8895('0x13d'),'through':_0x8895('0x128')});db[_0x8895('0x4e')][_0x8895('0x10a')](db[_0x8895('0x11')],{'onDelete':_0x8895('0x160')});db[_0x8895('0x4e')][_0x8895('0x10a')](db[_0x8895('0x52')],{'onDelete':_0x8895('0x160')});db[_0x8895('0x4e')][_0x8895('0x10a')](db['SmsAccount'],{'onDelete':'restrict'});db[_0x8895('0x4e')]['belongsTo'](db[_0x8895('0x161')],{'onDelete':_0x8895('0x160'),'foreignKey':'IntervalId'});db[_0x8895('0x4e')]['belongsTo'](db[_0x8895('0x82')],{'onDelete':'restrict','foreignKey':_0x8895('0x167')});db[_0x8895('0x102')][_0x8895('0xfe')](db[_0x8895('0x51')],{'as':_0x8895('0x140'),'onDelete':'cascade','foreignKey':_0x8895('0x170')});db['SmsInteraction'][_0x8895('0x10a')](db['SmsAccount'],{'as':_0x8895('0x157'),'foreignKey':_0x8895('0x16e')});db[_0x8895('0x102')][_0x8895('0x10a')](db[_0x8895('0x69')],{'as':'Contact','foreignKey':_0x8895('0x147')});db[_0x8895('0x102')][_0x8895('0x10a')](db[_0x8895('0x11')],{'as':_0x8895('0x158'),'foreignKey':_0x8895('0xfb')});db[_0x8895('0x102')][_0x8895('0x10d')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x8895('0x15a')});db[_0x8895('0x102')]['belongsToMany'](db['Tag'],{'through':_0x8895('0x171'),'as':_0x8895('0x15b')});db[_0x8895('0x102')][_0x8895('0x10d')](db[_0x8895('0x11')],{'as':_0x8895('0x16a'),'through':'user_has_sms_interactions','foreignKey':_0x8895('0x170')});db[_0x8895('0x51')]['belongsTo'](db[_0x8895('0x11')],{'as':_0x8895('0x11')});db['SmsMessage'][_0x8895('0x10a')](db['CmContact'],{'onDelete':'cascade','as':_0x8895('0x146')});db['SmsMessage'][_0x8895('0x10a')](db[_0x8895('0x102')],{'onDelete':'cascade','as':_0x8895('0x15f'),'foreignKey':_0x8895('0x170')});db[_0x8895('0x51')][_0x8895('0x10a')](db[_0x8895('0x4d')],{'as':'Account','foreignKey':_0x8895('0x16e')});db[_0x8895('0x52')]['belongsToMany'](db[_0x8895('0x11')],{'as':_0x8895('0x13d'),'through':'UserSmsQueue','foreignKey':_0x8895('0x172')});db[_0x8895('0x52')][_0x8895('0x10d')](db[_0x8895('0xd6')],{'through':'team_has_sms_queues','as':_0x8895('0x156')});db[_0x8895('0x54')][_0x8895('0xfe')](db[_0x8895('0x75')],{'as':_0x8895('0x14c'),'foreignKey':'OpenchannelAccountId'});db[_0x8895('0x54')][_0x8895('0xfe')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x8895('0x173')});db[_0x8895('0x54')][_0x8895('0xfe')](db[_0x8895('0x55')],{'as':_0x8895('0x14e'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x8895('0xfe')](db[_0x8895('0x174')],{'as':_0x8895('0x140'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['hasMany'](db[_0x8895('0x175')],{'as':'Applications','foreignKey':_0x8895('0x173')});db[_0x8895('0x54')][_0x8895('0x10a')](db[_0x8895('0xe7')],{'as':_0x8895('0x162'),'foreignKey':_0x8895('0x150')});db[_0x8895('0x54')]['belongsTo'](db[_0x8895('0x7a')],{'as':_0x8895('0x13c'),'foreignKey':_0x8895('0x153')});db[_0x8895('0x54')][_0x8895('0x10d')](db[_0x8895('0x11')],{'as':_0x8895('0x13d'),'through':'user_has_openchannel_accounts'});db[_0x8895('0x175')][_0x8895('0x10a')](db['User'],{'onDelete':_0x8895('0x160')});db[_0x8895('0x175')][_0x8895('0x10a')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x8895('0x176')});db[_0x8895('0x175')]['belongsTo'](db[_0x8895('0x54')],{'onDelete':_0x8895('0x160'),'foreignKey':_0x8895('0x173')});db[_0x8895('0x175')][_0x8895('0x10a')](db[_0x8895('0x161')],{'onDelete':_0x8895('0x160'),'foreignKey':_0x8895('0x13b')});db[_0x8895('0x175')][_0x8895('0x10a')](db[_0x8895('0x82')],{'onDelete':'restrict','foreignKey':_0x8895('0x167')});db[_0x8895('0x55')][_0x8895('0xfe')](db[_0x8895('0x174')],{'as':_0x8895('0x140'),'onDelete':_0x8895('0xfa'),'foreignKey':'OpenchannelInteractionId'});db[_0x8895('0x55')]['belongsTo'](db['OpenchannelAccount'],{'as':_0x8895('0x157'),'foreignKey':_0x8895('0x173')});db[_0x8895('0x55')][_0x8895('0x10a')](db['CmContact'],{'as':_0x8895('0x146'),'foreignKey':_0x8895('0x147')});db[_0x8895('0x55')][_0x8895('0x10a')](db[_0x8895('0x11')],{'as':_0x8895('0x158'),'foreignKey':_0x8895('0xfb')});db[_0x8895('0x55')][_0x8895('0x10d')](db[_0x8895('0x82')],{'through':_0x8895('0x177'),'as':'Tags'});db[_0x8895('0x55')][_0x8895('0x10d')](db[_0x8895('0x82')],{'through':_0x8895('0x177'),'as':_0x8895('0x15b')});db[_0x8895('0x55')][_0x8895('0x10d')](db['User'],{'as':_0x8895('0x16a'),'through':_0x8895('0x117'),'foreignKey':_0x8895('0x178')});db[_0x8895('0x174')][_0x8895('0x10a')](db['User'],{'onDelete':_0x8895('0xfa'),'as':_0x8895('0x11')});db['OpenchannelMessage'][_0x8895('0x10a')](db[_0x8895('0x69')],{'onDelete':_0x8895('0xfa'),'as':_0x8895('0x146')});db[_0x8895('0x174')][_0x8895('0x10a')](db[_0x8895('0x55')],{'onDelete':'cascade','as':_0x8895('0x15f'),'foreignKey':_0x8895('0x178')});db[_0x8895('0x174')][_0x8895('0x10a')](db[_0x8895('0x15d')],{'as':_0x8895('0x15d'),'foreignKey':_0x8895('0x16b')});db['OpenchannelMessage']['belongsTo'](db[_0x8895('0x54')],{'as':_0x8895('0x157'),'foreignKey':'OpenchannelAccountId'});db[_0x8895('0x58')][_0x8895('0x10d')](db[_0x8895('0x11')],{'as':_0x8895('0x13d'),'through':'UserOpenchannelQueue','foreignKey':_0x8895('0x176')});db[_0x8895('0x58')]['belongsToMany'](db['Team'],{'through':_0x8895('0x179'),'as':_0x8895('0x156')});db['ChatWebsite']['hasMany'](db[_0x8895('0x75')],{'as':'Dispositions','foreignKey':_0x8895('0x17a')});db['ChatWebsite']['hasMany'](db[_0x8895('0x73')],{'as':_0x8895('0x14d'),'foreignKey':_0x8895('0x17a')});db[_0x8895('0x5a')]['hasMany'](db[_0x8895('0x17b')],{'as':_0x8895('0x17c')});db['ChatWebsite'][_0x8895('0xfe')](db['ChatInteraction'],{'as':_0x8895('0x14e')});db[_0x8895('0x5a')][_0x8895('0xfe')](db[_0x8895('0x5e')],{'as':_0x8895('0x16f')});db[_0x8895('0x5a')][_0x8895('0xfe')](db[_0x8895('0x17d')],{'as':_0x8895('0x140')});db['ChatWebsite']['belongsTo'](db[_0x8895('0xe7')],{'as':_0x8895('0x162'),'foreignKey':_0x8895('0x150')});db[_0x8895('0x5a')][_0x8895('0x10a')](db[_0x8895('0x161')],{'as':_0x8895('0x161'),'foreignKey':'IntervalId'});db['ChatWebsite']['belongsTo'](db[_0x8895('0x7a')],{'as':'mandatoryDispositionPause','foreignKey':_0x8895('0x153')});db[_0x8895('0x5a')][_0x8895('0x10d')](db['User'],{'as':_0x8895('0x13d'),'through':_0x8895('0x122')});db['OpenchannelQueueReport'][_0x8895('0x10a')](db[_0x8895('0x54')],{});db['OpenchannelQueueReport']['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x8895('0x150')});db['OpenchannelQueueReport'][_0x8895('0x10a')](db[_0x8895('0x69')],{'as':'Contact','foreignKey':_0x8895('0x147')});db['OpenchannelQueueReport'][_0x8895('0x10a')](db[_0x8895('0x55')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x8895('0x174')],{});db[_0x8895('0x5c')][_0x8895('0x10a')](db[_0x8895('0x11')],{});db[_0x8895('0x5c')][_0x8895('0x10a')](db[_0x8895('0x58')],{});db['ChatApplication'][_0x8895('0x10a')](db['User'],{'as':_0x8895('0x17e'),'foreignKey':_0x8895('0xfb'),'onDelete':'restrict'});db[_0x8895('0x5e')][_0x8895('0x10a')](db[_0x8895('0x65')],{'as':_0x8895('0x17f'),'foreignKey':_0x8895('0x180'),'onDelete':'restrict'});db[_0x8895('0x5e')]['belongsTo'](db['ChatWebsite'],{'as':_0x8895('0x181'),'foreignKey':'ChatWebsiteId','onDelete':_0x8895('0x160')});db['ChatApplication'][_0x8895('0x10a')](db[_0x8895('0x82')],{'onDelete':_0x8895('0x160'),'foreignKey':_0x8895('0x167')});db[_0x8895('0x60')][_0x8895('0xfe')](db[_0x8895('0x17d')],{'as':_0x8895('0x140'),'onDelete':_0x8895('0xfa'),'foreignKey':_0x8895('0x182')});db[_0x8895('0x60')][_0x8895('0x10a')](db[_0x8895('0x5a')],{'as':_0x8895('0x157'),'foreignKey':'ChatWebsiteId'});db['ChatInteraction'][_0x8895('0x10a')](db[_0x8895('0x69')],{'as':'Contact','foreignKey':_0x8895('0x147')});db[_0x8895('0x60')][_0x8895('0x10a')](db[_0x8895('0x11')],{'as':_0x8895('0x158'),'foreignKey':_0x8895('0xfb')});db[_0x8895('0x60')][_0x8895('0x10d')](db[_0x8895('0x82')],{'through':_0x8895('0x183'),'as':'Tags'});db['ChatInteraction']['belongsToMany'](db[_0x8895('0x82')],{'through':_0x8895('0x183'),'as':_0x8895('0x15b')});db['ChatInteraction'][_0x8895('0x10d')](db[_0x8895('0x11')],{'as':'Users','through':_0x8895('0x115'),'foreignKey':_0x8895('0x182')});db[_0x8895('0x17d')][_0x8895('0x10a')](db['User'],{'onDelete':_0x8895('0xfa'),'as':'User'});db[_0x8895('0x17d')][_0x8895('0x10a')](db[_0x8895('0x69')],{'onDelete':_0x8895('0xfa'),'as':_0x8895('0x146'),'foreignKey':_0x8895('0x147')});db[_0x8895('0x17d')][_0x8895('0x10a')](db[_0x8895('0x60')],{'onDelete':_0x8895('0xfa'),'as':_0x8895('0x15f'),'foreignKey':_0x8895('0x182')});db[_0x8895('0x17d')]['belongsTo'](db[_0x8895('0x15d')],{'as':'Attachment','foreignKey':_0x8895('0x16b')});db[_0x8895('0x17d')][_0x8895('0x10a')](db[_0x8895('0x5a')],{'as':_0x8895('0x157'),'foreignKey':_0x8895('0x17a')});db[_0x8895('0x63')]['belongsTo'](db[_0x8895('0x69')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x8895('0x147')});db[_0x8895('0x63')][_0x8895('0x10a')](db[_0x8895('0x5a')],{'as':_0x8895('0x157'),'foreignKey':_0x8895('0x17a')});db[_0x8895('0x65')]['belongsToMany'](db[_0x8895('0x11')],{'as':_0x8895('0x13d'),'through':_0x8895('0x11d'),'hooks':!![]});db[_0x8895('0x65')][_0x8895('0x10d')](db[_0x8895('0xd6')],{'through':'team_has_chat_queues','as':_0x8895('0x156')});db[_0x8895('0x184')][_0x8895('0xfe')](db[_0x8895('0x185')],{'as':_0x8895('0x140'),'foreignKey':_0x8895('0x186'),'onDelete':'cascade'});db['ChatGroup'][_0x8895('0x10d')](db[_0x8895('0x11')],{'as':_0x8895('0x12e'),'through':_0x8895('0x10c')});db[_0x8895('0x17b')][_0x8895('0x10a')](db[_0x8895('0x5a')],{'as':_0x8895('0x181'),'foreignKey':_0x8895('0x17a')});db[_0x8895('0x187')][_0x8895('0xfe')](db['CmContact'],{'as':_0x8895('0x10e'),'foreignKey':_0x8895('0x188')});db['CmContact'][_0x8895('0xfe')](db[_0x8895('0x6b')],{'as':_0x8895('0x12f'),'foreignKey':'ContactId'});db[_0x8895('0x69')][_0x8895('0xfe')](db['CmHopperFinal'],{'as':_0x8895('0x131'),'foreignKey':'ContactId'});db[_0x8895('0x69')][_0x8895('0xfe')](db['CmHopperHistory'],{'as':_0x8895('0x189'),'foreignKey':_0x8895('0x147')});db[_0x8895('0x69')][_0x8895('0xfe')](db[_0x8895('0x6f')],{'as':_0x8895('0x6f'),'foreignKey':_0x8895('0x147')});db[_0x8895('0x69')][_0x8895('0xfe')](db[_0x8895('0x135')],{'as':_0x8895('0x136'),'foreignKey':_0x8895('0x147')});db['CmContact']['hasMany'](db[_0x8895('0x55')],{'as':_0x8895('0x101'),'foreignKey':_0x8895('0x147'),'onDelete':_0x8895('0x160')});db[_0x8895('0x69')][_0x8895('0xfe')](db[_0x8895('0x60')],{'as':_0x8895('0x114'),'foreignKey':_0x8895('0x147'),'onDelete':_0x8895('0x160')});db[_0x8895('0x69')]['hasMany'](db[_0x8895('0x102')],{'as':_0x8895('0x103'),'foreignKey':_0x8895('0x147'),'onDelete':_0x8895('0x160')});db[_0x8895('0x69')][_0x8895('0xfe')](db[_0x8895('0x46')],{'as':_0x8895('0x104'),'foreignKey':_0x8895('0x147'),'onDelete':'restrict'});db[_0x8895('0x69')][_0x8895('0xfe')](db[_0x8895('0x3f')],{'as':_0x8895('0x105'),'foreignKey':_0x8895('0x147'),'onDelete':'restrict'});db[_0x8895('0x69')][_0x8895('0x10a')](db[_0x8895('0x187')],{'as':_0x8895('0x18a'),'foreignKey':_0x8895('0x188')});db[_0x8895('0x69')][_0x8895('0x10a')](db['CmList'],{'as':_0x8895('0x162'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x8895('0x69')][_0x8895('0x10d')](db[_0x8895('0x11')],{'as':_0x8895('0x16a'),'through':_0x8895('0x10f')});db[_0x8895('0x69')]['belongsToMany'](db[_0x8895('0x82')],{'as':_0x8895('0x15a'),'through':_0x8895('0x18b')});db[_0x8895('0x69')][_0x8895('0x10d')](db[_0x8895('0x82')],{'through':_0x8895('0x18b'),'as':_0x8895('0x15b')});db[_0x8895('0x6b')][_0x8895('0x10a')](db[_0x8895('0x69')],{'as':_0x8895('0x146'),'foreignKey':_0x8895('0x147'),'onDelete':_0x8895('0xfa')});db[_0x8895('0x6b')][_0x8895('0x10a')](db[_0x8895('0xe7')],{'as':_0x8895('0x162'),'foreignKey':_0x8895('0x150'),'onDelete':_0x8895('0xfa')});db[_0x8895('0x6b')][_0x8895('0x10a')](db[_0x8895('0x11')],{'as':_0x8895('0x17e'),'foreignKey':_0x8895('0xfb')});db['CmHopper']['belongsTo'](db[_0x8895('0x1b')],{'as':_0x8895('0x17f'),'foreignKey':_0x8895('0x132'),'onDelete':_0x8895('0xfa')});db[_0x8895('0x6b')][_0x8895('0x10a')](db[_0x8895('0xda')],{'as':_0x8895('0xda'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0x8895('0x6b')][_0x8895('0x10a')](db[_0x8895('0x11')],{'as':'Owner','foreignKey':_0x8895('0x18c')});db[_0x8895('0x133')]['belongsTo'](db[_0x8895('0x69')],{'as':_0x8895('0x146'),'foreignKey':_0x8895('0x147'),'onDelete':_0x8895('0xfa')});db[_0x8895('0x133')][_0x8895('0x10a')](db[_0x8895('0xe7')],{'as':'List','foreignKey':_0x8895('0x150'),'onDelete':_0x8895('0xfa')});db['CmHopperBlack'][_0x8895('0x10a')](db['VoiceQueue'],{'as':_0x8895('0x17f'),'foreignKey':_0x8895('0x132'),'onDelete':_0x8895('0xfa')});db[_0x8895('0x133')][_0x8895('0x10a')](db[_0x8895('0xda')],{'as':_0x8895('0xda'),'foreignKey':_0x8895('0x18d'),'onDelete':'cascade'});db[_0x8895('0x18e')]['hasMany'](db['Condition'],{'as':{'plural':_0x8895('0x18f'),'singular':'OneAll'},'foreignKey':_0x8895('0x190'),'onDelete':_0x8895('0xfa'),'hooks':!![]});db[_0x8895('0x18e')][_0x8895('0xfe')](db[_0x8895('0x77')],{'as':{'plural':_0x8895('0x191'),'singular':_0x8895('0x192')},'foreignKey':_0x8895('0x193'),'onDelete':_0x8895('0xfa'),'hooks':!![]});db['Automation'][_0x8895('0xfe')](db[_0x8895('0x70')],{'as':_0x8895('0x194'),'foreignKey':'AutomationId','onDelete':_0x8895('0xfa'),'hooks':!![]});db[_0x8895('0x161')]['hasMany'](db[_0x8895('0x161')],{'as':'Intervals','foreignKey':'IntervalId','onDelete':_0x8895('0xfa'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db['VoiceExtension'],{'as':_0x8895('0xff'),'foreignKey':_0x8895('0x13b'),'onDelete':_0x8895('0x160')});db[_0x8895('0x161')][_0x8895('0xfe')](db[_0x8895('0x14f')],{'as':_0x8895('0x195'),'foreignKey':_0x8895('0x13b')});db['Interval'][_0x8895('0xfe')](db['ChatApplication'],{'as':_0x8895('0x196'),'foreignKey':_0x8895('0x13b')});db[_0x8895('0x161')][_0x8895('0xfe')](db[_0x8895('0x44')],{'as':_0x8895('0x197'),'foreignKey':'IntervalId'});db[_0x8895('0x161')][_0x8895('0xfe')](db['SmsApplication'],{'as':_0x8895('0x198'),'foreignKey':_0x8895('0x13b')});db[_0x8895('0x7e')][_0x8895('0x10a')](db['MailAccount'],{});db[_0x8895('0x7e')][_0x8895('0x10a')](db[_0x8895('0x8a')],{'foreignKey':_0x8895('0x199')});db[_0x8895('0x7e')][_0x8895('0x10a')](db['AnalyticCustomReport'],{'foreignKey':'CustomReportId'});db['Sound'][_0x8895('0x10d')](db['VoiceMusicOnHold'],{'as':_0x8895('0x19a'),'through':_0x8895('0x19b'),'onDelete':_0x8895('0x160')});db['Tag']['belongsToMany'](db[_0x8895('0x69')],{'through':_0x8895('0x18b')});db[_0x8895('0x82')][_0x8895('0x10d')](db[_0x8895('0x60')],{'through':_0x8895('0x183')});db['Tag'][_0x8895('0x10d')](db[_0x8895('0x3f')],{'through':_0x8895('0x159')});db[_0x8895('0x82')][_0x8895('0x10d')](db[_0x8895('0x102')],{'through':_0x8895('0x171')});db['Tag'][_0x8895('0x10d')](db[_0x8895('0x46')],{'through':'fax_interaction_has_tags'});db[_0x8895('0x82')][_0x8895('0x10d')](db[_0x8895('0x55')],{'through':_0x8895('0x177')});db[_0x8895('0x82')][_0x8895('0x10d')](db[_0x8895('0xf0')],{'through':_0x8895('0x19c')});db[_0x8895('0x85')][_0x8895('0xfe')](db[_0x8895('0x77')],{'as':{'plural':'AllConditions','singular':_0x8895('0x19d')},'foreignKey':_0x8895('0x19e'),'onDelete':_0x8895('0xfa'),'hooks':!![]});db['Trigger'][_0x8895('0xfe')](db[_0x8895('0x77')],{'as':{'plural':_0x8895('0x19f'),'singular':_0x8895('0x1a0')},'foreignKey':_0x8895('0x1a1'),'onDelete':_0x8895('0xfa'),'hooks':!![]});db[_0x8895('0x85')][_0x8895('0xfe')](db[_0x8895('0x70')],{'as':_0x8895('0x194'),'foreignKey':_0x8895('0x1a2'),'onDelete':_0x8895('0xfa'),'hooks':!![]});db[_0x8895('0x89')][_0x8895('0xfe')](db[_0x8895('0x8e')],{'as':'Fields','onDelete':_0x8895('0xfa'),'foreignKey':_0x8895('0x1a3'),'hooks':!![]});db[_0x8895('0x8a')]['hasMany'](db[_0x8895('0x8e')],{'as':'Fields','onDelete':_0x8895('0xfa'),'foreignKey':_0x8895('0x199')});db[_0x8895('0x1a4')][_0x8895('0xfe')](db[_0x8895('0x8e')],{'as':'Fields','onDelete':_0x8895('0xfa'),'foreignKey':_0x8895('0x1a5')});db[_0x8895('0x8e')][_0x8895('0x10a')](db[_0x8895('0x1a4')],{'foreignKey':_0x8895('0x1a5')});db[_0x8895('0x91')][_0x8895('0xfe')](db[_0x8895('0x1a6')],{'as':_0x8895('0x1a7'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x8895('0x1a6')]['hasMany'](db['SalesforceField'],{'as':_0x8895('0x1a8'),'onDelete':_0x8895('0xfa'),'foreignKey':_0x8895('0x1a9')});db[_0x8895('0x1a6')]['hasMany'](db[_0x8895('0x94')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x8895('0x1aa')});db[_0x8895('0x1a6')]['hasMany'](db[_0x8895('0x94')],{'as':_0x8895('0x1ab'),'onDelete':_0x8895('0xfa'),'foreignKey':_0x8895('0x1ac')});db[_0x8895('0x1a6')][_0x8895('0x10a')](db[_0x8895('0x91')],{'as':'Account','foreignKey':_0x8895('0x1ad')});db['SalesforceField']['hasMany'](db[_0x8895('0x94')],{'as':_0x8895('0x1ae'),'foreignKey':_0x8895('0x1a9')});db[_0x8895('0x94')]['hasMany'](db['SalesforceField'],{'as':_0x8895('0x1af'),'foreignKey':'DescriptionId'});db[_0x8895('0x94')]['hasMany'](db[_0x8895('0x94')],{'as':_0x8895('0x1b0'),'foreignKey':_0x8895('0x1ac')});db[_0x8895('0x94')][_0x8895('0x10a')](db[_0x8895('0x1b1')],{'as':_0x8895('0x1b1'),'foreignKey':_0x8895('0x1b2')});db[_0x8895('0x95')][_0x8895('0xfe')](db[_0x8895('0x97')],{'as':'Configurations','onDelete':_0x8895('0xfa'),'foreignKey':_0x8895('0x1ad')});db[_0x8895('0x97')][_0x8895('0xfe')](db[_0x8895('0x99')],{'as':_0x8895('0x1a8'),'onDelete':_0x8895('0xfa'),'foreignKey':'SubjectId'});db['SugarcrmConfiguration']['hasMany'](db['SugarcrmField'],{'as':_0x8895('0x1b3'),'onDelete':_0x8895('0xfa'),'foreignKey':_0x8895('0x1aa')});db['SugarcrmConfiguration'][_0x8895('0xfe')](db[_0x8895('0x99')],{'as':_0x8895('0x1ab'),'onDelete':_0x8895('0xfa'),'foreignKey':'FieldId'});db[_0x8895('0x97')]['belongsTo'](db['SugarcrmAccount'],{'as':'Account','foreignKey':_0x8895('0x1ad')});db[_0x8895('0x99')][_0x8895('0xfe')](db[_0x8895('0x99')],{'as':_0x8895('0x1ae'),'foreignKey':_0x8895('0x1a9')});db['SugarcrmField'][_0x8895('0xfe')](db['SugarcrmField'],{'as':_0x8895('0x1af'),'foreignKey':_0x8895('0x1aa')});db[_0x8895('0x99')][_0x8895('0xfe')](db[_0x8895('0x99')],{'as':_0x8895('0x1b0'),'foreignKey':'FieldId'});db['SugarcrmField'][_0x8895('0x10a')](db['Variable'],{'as':_0x8895('0x1b1'),'foreignKey':_0x8895('0x1b2')});db[_0x8895('0x1b4')]['hasMany'](db[_0x8895('0x9c')],{'as':_0x8895('0x1a7'),'onDelete':'cascade','foreignKey':'AccountId'});db['DeskConfiguration']['hasMany'](db[_0x8895('0x1b5')],{'as':'Subjects','onDelete':_0x8895('0xfa'),'foreignKey':_0x8895('0x1a9')});db['DeskConfiguration'][_0x8895('0xfe')](db[_0x8895('0x1b5')],{'as':'Descriptions','onDelete':_0x8895('0xfa'),'foreignKey':_0x8895('0x1aa')});db[_0x8895('0x9c')]['hasMany'](db[_0x8895('0x1b5')],{'as':_0x8895('0x1ab'),'onDelete':_0x8895('0xfa'),'foreignKey':_0x8895('0x1ac')});db['DeskConfiguration']['belongsTo'](db[_0x8895('0x1b4')],{'as':_0x8895('0x157'),'foreignKey':_0x8895('0x1ad')});db['DeskConfiguration']['belongsToMany'](db['Tag'],{'through':_0x8895('0x1b6')});db[_0x8895('0x1b5')]['hasMany'](db[_0x8895('0x1b5')],{'as':_0x8895('0x1ae'),'foreignKey':_0x8895('0x1a9')});db[_0x8895('0x1b5')][_0x8895('0xfe')](db[_0x8895('0x1b5')],{'as':_0x8895('0x1af'),'foreignKey':_0x8895('0x1aa')});db['DeskField'][_0x8895('0xfe')](db[_0x8895('0x1b5')],{'as':_0x8895('0x1b0'),'foreignKey':_0x8895('0x1ac')});db[_0x8895('0x1b5')][_0x8895('0x10a')](db['Variable'],{'as':_0x8895('0x1b1'),'foreignKey':_0x8895('0x1b2')});db[_0x8895('0x9f')][_0x8895('0xfe')](db[_0x8895('0x1b7')],{'as':_0x8895('0x1a7'),'onDelete':_0x8895('0xfa'),'foreignKey':'AccountId'});db[_0x8895('0x1b7')][_0x8895('0xfe')](db[_0x8895('0xa2')],{'as':_0x8895('0x1a8'),'onDelete':'cascade','foreignKey':'SubjectId'});db['ZohoConfiguration'][_0x8895('0xfe')](db['ZohoField'],{'as':_0x8895('0x1b3'),'onDelete':_0x8895('0xfa'),'foreignKey':_0x8895('0x1aa')});db[_0x8895('0x1b7')][_0x8895('0xfe')](db['ZohoField'],{'as':_0x8895('0x1ab'),'onDelete':_0x8895('0xfa'),'foreignKey':_0x8895('0x1ac')});db[_0x8895('0x1b7')]['belongsTo'](db['ZohoAccount'],{'as':'Account','foreignKey':_0x8895('0x1ad')});db[_0x8895('0xa2')][_0x8895('0xfe')](db[_0x8895('0xa2')],{'as':_0x8895('0x1ae'),'foreignKey':_0x8895('0x1a9')});db[_0x8895('0xa2')][_0x8895('0xfe')](db[_0x8895('0xa2')],{'as':_0x8895('0x1af'),'foreignKey':_0x8895('0x1aa')});db['ZohoField'][_0x8895('0xfe')](db[_0x8895('0xa2')],{'as':'Field','foreignKey':_0x8895('0x1ac')});db[_0x8895('0xa2')][_0x8895('0x10a')](db[_0x8895('0x1b1')],{'as':'Variable','foreignKey':_0x8895('0x1b2')});db[_0x8895('0xa3')][_0x8895('0xfe')](db[_0x8895('0xa5')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x8895('0x1ad')});db[_0x8895('0xa5')][_0x8895('0xfe')](db[_0x8895('0x1b8')],{'as':_0x8895('0x1a8'),'foreignKey':_0x8895('0x1a9')});db[_0x8895('0xa5')][_0x8895('0xfe')](db[_0x8895('0x1b8')],{'as':_0x8895('0x1b3'),'foreignKey':_0x8895('0x1aa')});db[_0x8895('0xa5')][_0x8895('0xfe')](db[_0x8895('0x1b8')],{'as':_0x8895('0x1ab'),'foreignKey':_0x8895('0x1ac')});db[_0x8895('0xa5')][_0x8895('0x10a')](db[_0x8895('0xa3')],{'as':_0x8895('0x157'),'foreignKey':_0x8895('0x1ad')});db[_0x8895('0xa5')]['belongsToMany'](db[_0x8895('0x82')],{'through':_0x8895('0x1b9')});db[_0x8895('0x1b8')]['hasMany'](db[_0x8895('0x1b8')],{'as':_0x8895('0x1ae'),'foreignKey':_0x8895('0x1a9')});db[_0x8895('0x1b8')][_0x8895('0xfe')](db[_0x8895('0x1b8')],{'as':_0x8895('0x1af'),'foreignKey':_0x8895('0x1aa')});db[_0x8895('0x1b8')][_0x8895('0xfe')](db[_0x8895('0x1b8')],{'as':_0x8895('0x1b0'),'foreignKey':'FieldId'});db[_0x8895('0x1b8')][_0x8895('0x10a')](db[_0x8895('0x1b1')],{'as':'Variable','foreignKey':'VariableId'});db['FreshdeskAccount'][_0x8895('0xfe')](db[_0x8895('0xa8')],{'as':_0x8895('0x1a7'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x8895('0xa8')]['hasMany'](db[_0x8895('0xaa')],{'as':_0x8895('0x1a8'),'onDelete':'cascade','foreignKey':_0x8895('0x1a9')});db[_0x8895('0xa8')][_0x8895('0xfe')](db[_0x8895('0xaa')],{'as':_0x8895('0x1b3'),'onDelete':_0x8895('0xfa'),'foreignKey':_0x8895('0x1aa')});db[_0x8895('0xa8')][_0x8895('0xfe')](db[_0x8895('0xaa')],{'as':'Fields','onDelete':_0x8895('0xfa'),'foreignKey':_0x8895('0x1ac')});db[_0x8895('0xa8')]['belongsTo'](db[_0x8895('0x1ba')],{'as':'Account','foreignKey':_0x8895('0x1ad')});db[_0x8895('0xa8')][_0x8895('0x10d')](db[_0x8895('0x82')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x8895('0xaa')]['hasMany'](db['FreshdeskField'],{'as':'Subject','foreignKey':_0x8895('0x1a9')});db[_0x8895('0xaa')]['hasMany'](db[_0x8895('0xaa')],{'as':'Description','foreignKey':_0x8895('0x1aa')});db[_0x8895('0xaa')][_0x8895('0xfe')](db['FreshdeskField'],{'as':_0x8895('0x1b0'),'foreignKey':_0x8895('0x1ac')});db[_0x8895('0xaa')][_0x8895('0x10a')](db[_0x8895('0x1b1')],{'as':_0x8895('0x1b1'),'foreignKey':'VariableId'});db[_0x8895('0x1bb')][_0x8895('0xfe')](db[_0x8895('0xac')],{'as':_0x8895('0x1a7'),'onDelete':_0x8895('0xfa'),'foreignKey':_0x8895('0x1ad')});db[_0x8895('0xac')][_0x8895('0xfe')](db[_0x8895('0xae')],{'as':_0x8895('0x1a8'),'foreignKey':'SubjectId'});db[_0x8895('0xac')][_0x8895('0xfe')](db['VtigerField'],{'as':_0x8895('0x1b3'),'foreignKey':_0x8895('0x1aa')});db[_0x8895('0xac')]['hasMany'](db['VtigerField'],{'as':'Fields','foreignKey':'FieldId'});db['VtigerConfiguration'][_0x8895('0x10a')](db[_0x8895('0x1bb')],{'as':'Account','foreignKey':_0x8895('0x1ad')});db[_0x8895('0xae')][_0x8895('0xfe')](db['VtigerField'],{'as':_0x8895('0x1ae'),'foreignKey':'SubjectId'});db['VtigerField']['hasMany'](db[_0x8895('0xae')],{'as':_0x8895('0x1af'),'foreignKey':_0x8895('0x1aa')});db[_0x8895('0xae')][_0x8895('0xfe')](db[_0x8895('0xae')],{'as':_0x8895('0x1b0'),'foreignKey':_0x8895('0x1ac')});db[_0x8895('0xae')][_0x8895('0x10a')](db[_0x8895('0x1b1')],{'as':'Variable','foreignKey':_0x8895('0x1b2')});db[_0x8895('0xb0')][_0x8895('0xfe')](db[_0x8895('0xb1')],{'as':_0x8895('0x1a7'),'onDelete':_0x8895('0xfa'),'foreignKey':_0x8895('0x1ad')});db[_0x8895('0xb1')][_0x8895('0xfe')](db[_0x8895('0x1bc')],{'as':_0x8895('0x1a8'),'foreignKey':_0x8895('0x1a9')});db['ServicenowConfiguration'][_0x8895('0xfe')](db[_0x8895('0x1bc')],{'as':_0x8895('0x1b3'),'foreignKey':_0x8895('0x1aa')});db[_0x8895('0xb1')]['hasMany'](db[_0x8895('0x1bc')],{'as':_0x8895('0x1ab'),'foreignKey':_0x8895('0x1ac')});db[_0x8895('0xb1')][_0x8895('0x10a')](db[_0x8895('0xb0')],{'as':_0x8895('0x157'),'foreignKey':_0x8895('0x1ad')});db[_0x8895('0x1bc')][_0x8895('0xfe')](db[_0x8895('0x1bc')],{'as':'Subject','foreignKey':_0x8895('0x1a9')});db['ServicenowField'][_0x8895('0xfe')](db[_0x8895('0x1bc')],{'as':_0x8895('0x1af'),'foreignKey':_0x8895('0x1aa')});db[_0x8895('0x1bc')]['hasMany'](db[_0x8895('0x1bc')],{'as':_0x8895('0x1b0'),'foreignKey':_0x8895('0x1ac')});db['ServicenowField'][_0x8895('0x10a')](db[_0x8895('0x1b1')],{'as':_0x8895('0x1b1'),'foreignKey':'VariableId'});db[_0x8895('0xb4')][_0x8895('0xfe')](db[_0x8895('0x1bd')],{'as':_0x8895('0x1a7'),'onDelete':_0x8895('0xfa'),'foreignKey':_0x8895('0x1ad')});db[_0x8895('0x1bd')][_0x8895('0xfe')](db['Dynamics365Field'],{'as':_0x8895('0x1a8'),'onDelete':'cascade','foreignKey':_0x8895('0x1a9')});db['Dynamics365Configuration'][_0x8895('0xfe')](db[_0x8895('0x1be')],{'as':_0x8895('0x1b3'),'onDelete':_0x8895('0xfa'),'foreignKey':_0x8895('0x1aa')});db[_0x8895('0x1bd')][_0x8895('0xfe')](db[_0x8895('0x1be')],{'as':_0x8895('0x1ab'),'onDelete':_0x8895('0xfa'),'foreignKey':_0x8895('0x1ac')});db[_0x8895('0x1bd')][_0x8895('0x10a')](db['Dynamics365Account'],{'as':_0x8895('0x157'),'foreignKey':'AccountId'});db[_0x8895('0x1be')]['hasMany'](db[_0x8895('0x1be')],{'as':_0x8895('0x1ae'),'foreignKey':_0x8895('0x1a9')});db['Dynamics365Field'][_0x8895('0xfe')](db[_0x8895('0x1be')],{'as':'Description','foreignKey':_0x8895('0x1aa')});db[_0x8895('0x1be')][_0x8895('0xfe')](db[_0x8895('0x1be')],{'as':_0x8895('0x1b0'),'foreignKey':_0x8895('0x1ac')});db[_0x8895('0x1be')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x8895('0xb8')][_0x8895('0xfe')](db[_0x8895('0xba')],{'as':_0x8895('0x1a7'),'onDelete':'cascade','foreignKey':_0x8895('0x1ad')});db[_0x8895('0xba')][_0x8895('0xfe')](db['FreshsalesField'],{'as':_0x8895('0x1a8'),'foreignKey':'SubjectId'});db[_0x8895('0xba')][_0x8895('0xfe')](db['FreshsalesField'],{'as':'Descriptions','foreignKey':_0x8895('0x1aa')});db[_0x8895('0xba')][_0x8895('0xfe')](db['FreshsalesField'],{'as':'Fields','foreignKey':_0x8895('0x1ac')});db[_0x8895('0xba')]['belongsTo'](db[_0x8895('0xb8')],{'as':'Account','foreignKey':_0x8895('0x1ad')});db['FreshsalesField'][_0x8895('0xfe')](db['FreshsalesField'],{'as':_0x8895('0x1ae'),'foreignKey':_0x8895('0x1a9')});db['FreshsalesField']['hasMany'](db[_0x8895('0x1bf')],{'as':_0x8895('0x1af'),'foreignKey':_0x8895('0x1aa')});db['FreshsalesField'][_0x8895('0xfe')](db[_0x8895('0x1bf')],{'as':_0x8895('0x1b0'),'foreignKey':_0x8895('0x1ac')});db[_0x8895('0x1bf')][_0x8895('0x10a')](db[_0x8895('0x1b1')],{'as':_0x8895('0x1b1'),'foreignKey':_0x8895('0x1b2')});db['ChatQueueReport'][_0x8895('0x10a')](db[_0x8895('0x5a')],{});db['ChatQueueReport'][_0x8895('0x10a')](db[_0x8895('0xe7')],{'as':_0x8895('0x162'),'foreignKey':_0x8895('0x150')});db[_0x8895('0xbf')][_0x8895('0x10a')](db['CmContact'],{'as':_0x8895('0x146'),'foreignKey':_0x8895('0x147')});db[_0x8895('0xbf')][_0x8895('0x10a')](db['ChatInteraction'],{});db[_0x8895('0xbf')][_0x8895('0x10a')](db[_0x8895('0x17d')],{});db['ChatQueueReport'][_0x8895('0x10a')](db[_0x8895('0x11')],{});db[_0x8895('0xbf')]['belongsTo'](db['ChatQueue'],{});db[_0x8895('0x185')][_0x8895('0x10a')](db['User'],{'onDelete':_0x8895('0xfa'),'foreignKey':'FromId'});db[_0x8895('0x185')][_0x8895('0x10a')](db[_0x8895('0x11')],{'onDelete':'cascade','foreignKey':_0x8895('0x1c0')});db['JscriptySessionReport'][_0x8895('0xfe')](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':_0x8895('0xfa')});db[_0x8895('0x135')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x8895('0xc7')]['belongsTo'](db[_0x8895('0x4d')],{});db[_0x8895('0xc7')][_0x8895('0x10a')](db['CmList'],{'as':_0x8895('0x162'),'foreignKey':_0x8895('0x150')});db[_0x8895('0xc7')][_0x8895('0x10a')](db[_0x8895('0x69')],{'as':_0x8895('0x146'),'foreignKey':_0x8895('0x147')});db[_0x8895('0xc7')]['belongsTo'](db[_0x8895('0x102')],{});db[_0x8895('0xc7')][_0x8895('0x10a')](db[_0x8895('0x51')],{});db[_0x8895('0xc7')][_0x8895('0x10a')](db[_0x8895('0x11')],{});db['SmsQueueReport']['belongsTo'](db['SmsQueue'],{});db[_0x8895('0x1c1')][_0x8895('0xfe')](db['JscriptySessionReport'],{'foreignKey':_0x8895('0x1c2')});db[_0x8895('0x1c1')][_0x8895('0xfe')](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x8895('0xfe')](db['JscriptyAnswerReport'],{'foreignKey':_0x8895('0x1c2')});db['SquareProject'][_0x8895('0x10d')](db['User'],{'as':_0x8895('0x16a'),'through':_0x8895('0x1c3')});db[_0x8895('0xd6')][_0x8895('0x10d')](db[_0x8895('0x11')],{'as':'Agents','through':_0x8895('0x112')});db[_0x8895('0xd6')][_0x8895('0x10d')](db[_0x8895('0x1b')],{'through':_0x8895('0x1c4'),'as':'VoiceQueues'});db['Team']['belongsToMany'](db['MailQueue'],{'through':_0x8895('0x155'),'as':_0x8895('0x11b')});db[_0x8895('0xd6')][_0x8895('0x10d')](db[_0x8895('0x65')],{'through':'team_has_chat_queues','as':_0x8895('0x11c')});db['Team'][_0x8895('0x10d')](db[_0x8895('0x49')],{'through':_0x8895('0x16d'),'as':'FaxQueues'});db[_0x8895('0xd6')][_0x8895('0x10d')](db['SmsQueue'],{'through':'team_has_sms_queues','as':'SmsQueues'});db['Team'][_0x8895('0x10d')](db['OpenchannelQueue'],{'through':_0x8895('0x179'),'as':'OpenchannelQueues'});db[_0x8895('0xd6')]['belongsToMany'](db['WhatsappQueue'],{'through':_0x8895('0x1c5'),'as':_0x8895('0x120')});db[_0x8895('0xda')][_0x8895('0xfe')](db[_0x8895('0x6b')],{'as':'Hoppers','foreignKey':_0x8895('0x18d')});db[_0x8895('0xda')][_0x8895('0xfe')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x8895('0x18d')});db[_0x8895('0xda')][_0x8895('0xfe')](db[_0x8895('0x6d')],{'as':'HopperHistories','foreignKey':_0x8895('0x18d')});db[_0x8895('0xda')][_0x8895('0xfe')](db[_0x8895('0x133')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x8895('0xda')][_0x8895('0x10a')](db[_0x8895('0x137')],{'as':_0x8895('0x137'),'foreignKey':_0x8895('0x138')});db['Campaign'][_0x8895('0x10a')](db[_0x8895('0x137')],{'as':_0x8895('0x139'),'foreignKey':_0x8895('0x13a')});db[_0x8895('0xda')][_0x8895('0x10a')](db[_0x8895('0x161')],{'as':'Interval','foreignKey':_0x8895('0x13b')});db[_0x8895('0xda')][_0x8895('0x10a')](db['SquareProject'],{'as':_0x8895('0xd0'),'foreignKey':_0x8895('0x1c6')});db[_0x8895('0xda')][_0x8895('0x10d')](db['CmList'],{'as':_0x8895('0x110'),'through':_0x8895('0x1c7')});db['Campaign'][_0x8895('0x10d')](db[_0x8895('0xe7')],{'as':_0x8895('0x13e'),'through':_0x8895('0x1c8')});db[_0x8895('0xde')][_0x8895('0x10a')](db['MailMessage'],{});db['MailTransferReport'][_0x8895('0x10a')](db[_0x8895('0x3f')],{});db['MailTransferReport'][_0x8895('0x10a')](db[_0x8895('0x3b')],{'foreignKey':_0x8895('0x1c9'),'as':_0x8895('0x1ca')});db[_0x8895('0xde')][_0x8895('0x10a')](db[_0x8895('0x11')],{'foreignKey':'FromUserId','as':_0x8895('0x1cb')});db[_0x8895('0xde')][_0x8895('0x10a')](db[_0x8895('0x11')],{'foreignKey':'ToUserId','as':_0x8895('0x1cc')});db[_0x8895('0xde')]['belongsTo'](db['MailQueue'],{'foreignKey':_0x8895('0x1cd'),'as':_0x8895('0x1ce')});db[_0x8895('0xde')][_0x8895('0x10a')](db['MailAccount'],{'foreignKey':_0x8895('0x1cf'),'as':'ToAccount'});db[_0x8895('0xe0')][_0x8895('0x10a')](db['ChatMessage'],{});db[_0x8895('0xe0')][_0x8895('0x10a')](db[_0x8895('0x60')],{});db[_0x8895('0xe0')][_0x8895('0x10a')](db[_0x8895('0x5a')],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db[_0x8895('0xe0')]['belongsTo'](db['User'],{'foreignKey':_0x8895('0x1d0'),'as':_0x8895('0x1cb')});db[_0x8895('0xe0')]['belongsTo'](db[_0x8895('0x11')],{'foreignKey':_0x8895('0x1d1'),'as':'ToAgent'});db['ChatTransferReport']['belongsTo'](db[_0x8895('0x65')],{'foreignKey':'ToChatQueueId','as':_0x8895('0x1ce')});db['ChatTransferReport'][_0x8895('0x10a')](db[_0x8895('0x5a')],{'foreignKey':'ToChatWebsiteId','as':'ToAccount'});db['FaxTransferReport'][_0x8895('0x10a')](db[_0x8895('0x47')],{});db['FaxTransferReport']['belongsTo'](db[_0x8895('0x46')],{});db[_0x8895('0xe2')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x8895('0x1d2'),'as':'FromAccount'});db[_0x8895('0xe2')][_0x8895('0x10a')](db[_0x8895('0x11')],{'foreignKey':_0x8895('0x1d0'),'as':_0x8895('0x1cb')});db['FaxTransferReport'][_0x8895('0x10a')](db[_0x8895('0x11')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x8895('0xe2')][_0x8895('0x10a')](db['FaxQueue'],{'foreignKey':_0x8895('0x1d3'),'as':'ToQueue'});db['FaxTransferReport'][_0x8895('0x10a')](db[_0x8895('0x123')],{'foreignKey':_0x8895('0x1d4'),'as':_0x8895('0x1d5')});db[_0x8895('0xe4')]['belongsTo'](db[_0x8895('0x174')],{});db[_0x8895('0xe4')][_0x8895('0x10a')](db[_0x8895('0x55')],{});db[_0x8895('0xe4')][_0x8895('0x10a')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x8895('0x1ca')});db[_0x8895('0xe4')][_0x8895('0x10a')](db[_0x8895('0x11')],{'foreignKey':_0x8895('0x1d0'),'as':'FromAgent'});db['OpenchannelTransferReport'][_0x8895('0x10a')](db[_0x8895('0x11')],{'foreignKey':'ToUserId','as':_0x8895('0x1cc')});db['OpenchannelTransferReport'][_0x8895('0x10a')](db[_0x8895('0x58')],{'foreignKey':_0x8895('0x1d6'),'as':_0x8895('0x1ce')});db[_0x8895('0xe4')]['belongsTo'](db[_0x8895('0x54')],{'foreignKey':_0x8895('0x1d7'),'as':_0x8895('0x1d5')});db[_0x8895('0xe6')][_0x8895('0x10a')](db['SmsMessage'],{});db[_0x8895('0xe6')][_0x8895('0x10a')](db['SmsInteraction'],{});db[_0x8895('0xe6')][_0x8895('0x10a')](db[_0x8895('0x4d')],{'foreignKey':_0x8895('0x1d8'),'as':_0x8895('0x1ca')});db['SmsTransferReport'][_0x8895('0x10a')](db[_0x8895('0x11')],{'foreignKey':'FromUserId','as':_0x8895('0x1cb')});db['SmsTransferReport']['belongsTo'](db[_0x8895('0x11')],{'foreignKey':_0x8895('0x1d1'),'as':_0x8895('0x1cc')});db[_0x8895('0xe6')]['belongsTo'](db[_0x8895('0x52')],{'foreignKey':'ToSmsQueueId','as':_0x8895('0x1ce')});db[_0x8895('0xe6')][_0x8895('0x10a')](db[_0x8895('0x4d')],{'foreignKey':'ToSmsAccountId','as':_0x8895('0x1d5')});db[_0x8895('0xe7')][_0x8895('0xfe')](db[_0x8895('0x75')],{'as':'Dispositions','foreignKey':_0x8895('0x150')});db[_0x8895('0xe7')][_0x8895('0xfe')](db[_0x8895('0x1d9')],{'as':'CustomFields','foreignKey':_0x8895('0x150')});db[_0x8895('0xe7')][_0x8895('0xfe')](db[_0x8895('0x69')],{'as':'Contacts','onDelete':'cascade','foreignKey':'ListId'});db['CmList'][_0x8895('0xfe')](db[_0x8895('0x130')],{'as':_0x8895('0x131'),'foreignKey':'ListId'});db[_0x8895('0xe7')][_0x8895('0xfe')](db[_0x8895('0x6d')],{'as':_0x8895('0x100'),'foreignKey':_0x8895('0x150')});db[_0x8895('0xe7')][_0x8895('0xfe')](db[_0x8895('0x6f')],{'as':_0x8895('0x6f'),'foreignKey':'ListId'});db[_0x8895('0xe7')][_0x8895('0x10d')](db[_0x8895('0x1b')],{'as':'Queues','through':_0x8895('0x1da')});db[_0x8895('0xe7')][_0x8895('0x10d')](db['User'],{'as':_0x8895('0x13d'),'through':_0x8895('0x111')});db[_0x8895('0xe8')][_0x8895('0xfe')](db[_0x8895('0x18')],{'as':_0x8895('0xff'),'onDelete':_0x8895('0xfa')});db[_0x8895('0xe8')][_0x8895('0x10d')](db[_0x8895('0x11')],{'as':_0x8895('0x13d'),'through':_0x8895('0x1db')});db[_0x8895('0x10b')][_0x8895('0xfe')](db[_0x8895('0x11')],{'as':_0x8895('0x16a'),'foreignKey':_0x8895('0x1dc')});db['UserProfile'][_0x8895('0xfe')](db[_0x8895('0x1dd')],{'as':_0x8895('0x1de'),'foreignKey':_0x8895('0x1dc'),'onDelete':_0x8895('0xfa')});db['UserProfileSection']['hasMany'](db[_0x8895('0xea')],{'as':_0x8895('0x1df'),'foreignKey':_0x8895('0x1e0'),'onDelete':_0x8895('0xfa')});db[_0x8895('0xec')]['hasMany'](db['Disposition'],{'as':_0x8895('0x14c'),'foreignKey':_0x8895('0x1e1')});db[_0x8895('0xec')][_0x8895('0xfe')](db[_0x8895('0x73')],{'as':_0x8895('0x14d'),'foreignKey':'WhatsappAccountId'});db[_0x8895('0xec')][_0x8895('0xfe')](db[_0x8895('0xf1')],{'as':_0x8895('0x140'),'foreignKey':_0x8895('0x1e1')});db['WhatsappAccount'][_0x8895('0xfe')](db[_0x8895('0xf0')],{'as':_0x8895('0x14e')});db[_0x8895('0xec')][_0x8895('0xfe')](db[_0x8895('0xee')],{'as':_0x8895('0x16f')});db[_0x8895('0xec')]['belongsTo'](db['CmList'],{'as':_0x8895('0x162'),'foreignKey':_0x8895('0x150')});db[_0x8895('0xec')][_0x8895('0x10a')](db[_0x8895('0x7a')],{'as':_0x8895('0x13c'),'foreignKey':_0x8895('0x153')});db[_0x8895('0xec')]['belongsToMany'](db['User'],{'as':_0x8895('0x13d'),'through':_0x8895('0x129')});db[_0x8895('0xee')][_0x8895('0x10a')](db[_0x8895('0x11')],{'onDelete':_0x8895('0x160')});db[_0x8895('0xee')]['belongsTo'](db['WhatsappQueue'],{'onDelete':_0x8895('0x160')});db[_0x8895('0xee')][_0x8895('0x10a')](db[_0x8895('0xec')],{'onDelete':_0x8895('0x160')});db[_0x8895('0xee')][_0x8895('0x10a')](db['Interval'],{'onDelete':_0x8895('0x160'),'foreignKey':_0x8895('0x13b')});db[_0x8895('0xee')][_0x8895('0x10a')](db[_0x8895('0x82')],{'onDelete':_0x8895('0x160'),'foreignKey':_0x8895('0x167')});db['WhatsappInteraction'][_0x8895('0xfe')](db['WhatsappMessage'],{'as':'Messages','onDelete':_0x8895('0xfa'),'foreignKey':'WhatsappInteractionId'});db[_0x8895('0xf0')]['belongsTo'](db[_0x8895('0xec')],{'as':_0x8895('0x157'),'foreignKey':'WhatsappAccountId'});db[_0x8895('0xf0')][_0x8895('0x10a')](db[_0x8895('0x69')],{'as':'Contact','foreignKey':_0x8895('0x147')});db['WhatsappInteraction'][_0x8895('0x10a')](db[_0x8895('0x11')],{'as':_0x8895('0x158'),'foreignKey':_0x8895('0xfb')});db[_0x8895('0xf0')]['belongsToMany'](db[_0x8895('0x82')],{'through':_0x8895('0x19c'),'as':_0x8895('0x15a')});db[_0x8895('0xf0')]['belongsToMany'](db[_0x8895('0x82')],{'through':'whatsapp_interaction_has_tags','as':_0x8895('0x15b')});db[_0x8895('0xf0')][_0x8895('0x10d')](db[_0x8895('0x11')],{'as':_0x8895('0x16a'),'through':_0x8895('0x118'),'foreignKey':_0x8895('0x1e2')});db['WhatsappMessage'][_0x8895('0x10a')](db[_0x8895('0x11')],{'as':'User'});db[_0x8895('0xf1')]['belongsTo'](db[_0x8895('0x69')],{'onDelete':_0x8895('0xfa'),'as':_0x8895('0x146')});db[_0x8895('0xf1')]['belongsTo'](db[_0x8895('0xf0')],{'onDelete':_0x8895('0xfa'),'as':'Interaction','foreignKey':_0x8895('0x1e2')});db[_0x8895('0xf1')][_0x8895('0x10a')](db[_0x8895('0xec')],{'as':'Account','foreignKey':_0x8895('0x1e1')});db['WhatsappQueueReport'][_0x8895('0x10a')](db['WhatsappAccount'],{});db[_0x8895('0x1e3')][_0x8895('0x10a')](db[_0x8895('0xe7')],{'as':_0x8895('0x162'),'foreignKey':'ListId'});db[_0x8895('0x1e3')][_0x8895('0x10a')](db[_0x8895('0x69')],{'as':_0x8895('0x146'),'foreignKey':'ContactId'});db[_0x8895('0x1e3')][_0x8895('0x10a')](db[_0x8895('0xf0')],{});db[_0x8895('0x1e3')]['belongsTo'](db[_0x8895('0xf6')],{});db[_0x8895('0x1e3')][_0x8895('0x10a')](db['WhatsappMessage'],{});db['WhatsappQueueReport'][_0x8895('0x10a')](db[_0x8895('0x11')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x8895('0xf1')],{});db[_0x8895('0xf4')][_0x8895('0x10a')](db['WhatsappInteraction'],{});db[_0x8895('0xf4')][_0x8895('0x10a')](db[_0x8895('0xec')],{'foreignKey':_0x8895('0x1e4'),'as':'FromAccount'});db['WhatsappTransferReport']['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x8895('0x1e5'),'as':_0x8895('0x1d5')});db[_0x8895('0xf4')][_0x8895('0x10a')](db[_0x8895('0xf6')],{'foreignKey':_0x8895('0x1e6'),'as':_0x8895('0x1ce')});db['WhatsappTransferReport'][_0x8895('0x10a')](db[_0x8895('0x11')],{'foreignKey':_0x8895('0x1d0'),'as':_0x8895('0x1cb')});db[_0x8895('0xf4')][_0x8895('0x10a')](db[_0x8895('0x11')],{'foreignKey':_0x8895('0x1d1'),'as':_0x8895('0x1cc')});db[_0x8895('0xf6')]['belongsToMany'](db[_0x8895('0x11')],{'as':'Agents','through':_0x8895('0x36'),'foreignKey':_0x8895('0x1e7')});db[_0x8895('0xf6')][_0x8895('0x10d')](db[_0x8895('0xd6')],{'through':'team_has_whatsapp_queues','as':_0x8895('0x156')});module[_0x8895('0x1e8')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x00e0=['utf8','utf8_general_ci','defaultsDeep','motion2','xcall','mysql','username','password','options','sequelizeHistory','database','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/pause/pause.model','../api/cdr/cdr.model','Schedule','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../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','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','Notification','../api/notification/notification.model','WhatsappAccount','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','cascade','UserId','hasMany','VoiceQueuesRt','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteractions','SenderId','belongsTo','UserProfile','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Team','user_has_teams','user_has_chat_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','MailQueues','ChatQueues','SmsQueue','UserWhatsappQueue','cm_user_has_lists','VoicePrefixes','user_has_voice_prefixes','FaxAccounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','VoiceMusicOnHold','Sounds','moh_has_sounds','VoiceQueueId','CmHopper','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','Trunk','TrunkBackupId','Interval','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','mailboxuser','mailbox','VoiceCallReport','uniqueid','Contact','ContactId','MailAccountId','Imap','Smtp','Dispositions','Messages','Interactions','Applications','List','ListId','TemplateId','Pause','MailInteractionId','Account','Owner','Tags','mail_interaction_has_tags','ThroughTags','Users','user_has_mail_interactions','Attachments','Interaction','MailApplication','restrict','IntervalId','TagId','Dashboard','Items','Answers','FaxAccountId','Exntensions','user_has_fax_accounts','fax_interaction_has_tags','user_has_fax_interactions','FaxInteractionId','AttachmentId','team_has_fax_queues','SmsAccountId','SmsMessage','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','ChatWebsiteId','ProactiveActions','ChatApplication','user_has_chat_websites','Agent','Queue','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessage','team_has_chat_queues','ChatGroupId','CmCompany','CompanyId','cm_contact_has_tags','Campaign','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','AutomationAnyId','Actions','Intervals','Extensions','FaxApplications','DefaultReportId','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','CustomReportId','MetricId','Configurations','AccountId','SubjectId','Descriptions','DescriptionId','FieldId','VariableId','SugarcrmAccount','Subjects','Subject','Description','int_desk_configuration_has_tags','Field','ZendeskAccount','ZendeskConfiguration','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerConfiguration','Dynamics365Field','FreshsalesAccount','ChatQueueReport','FromId','JscriptyQuestionReport','SessionId','JscriptyAnswerReport','ProjectId','team_has_mail_queues','FaxQueues','team_has_openchannel_queues','team_has_whatsapp_queues','WhatsappQueues','TrunkBackup','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToUserId','ToFaxQueueId','ToOpenchannelQueueId','ToSmsAccountId','CustomFields','Queues','UserProfileSections','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','whatsapp_interaction_has_tags','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','../config/environment','sequelize','jstz','xC@LL1234','127.0.0.1','utf8mb4','name'];(function(_0x1800a5,_0x10f33e){var _0x304387=function(_0x31d76d){while(--_0x31d76d){_0x1800a5['push'](_0x1800a5['shift']());}};_0x304387(++_0x10f33e);}(_0x00e0,0x1e3));var _0x000e=function(_0x56cacb,_0x516463){_0x56cacb=_0x56cacb-0x0;var _0x3a3300=_0x00e0[_0x56cacb];return _0x3a3300;};'use strict';var path=require(_0x000e('0x0'));var config=require(_0x000e('0x1'));var Sequelize=require(_0x000e('0x2'));var _=require('lodash');var jstz=require(_0x000e('0x3'));var timezone=jstz['determine']();config[_0x000e('0x2')]=_['defaultsDeep'](config['sequelize'],{'database':'motion2','username':'xcall','password':_0x000e('0x4'),'options':{'host':_0x000e('0x5'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x000e('0x6')},'logging':![],'timezone':timezone[_0x000e('0x7')](),'define':{'charset':_0x000e('0x8'),'collate':_0x000e('0x9')}}});config['sequelizeHistory']=_[_0x000e('0xa')](config['sequelizeHistory'],{'database':_0x000e('0xb'),'username':_0x000e('0xc'),'password':_0x000e('0x4'),'options':{'host':_0x000e('0x5'),'port':0xcea,'dialect':_0x000e('0xd'),'dialectOptions':{'charset':_0x000e('0x6')},'logging':![],'timezone':timezone[_0x000e('0x7')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config['sequelize'][_0x000e('0xe')],config[_0x000e('0x2')][_0x000e('0xf')],config[_0x000e('0x2')][_0x000e('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x000e('0x11')][_0x000e('0x12')],config[_0x000e('0x11')][_0x000e('0xe')],config[_0x000e('0x11')][_0x000e('0xf')],config[_0x000e('0x11')][_0x000e('0x10')])};db[_0x000e('0x13')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x15'));db[_0x000e('0x16')]=db['sequelize'][_0x000e('0x14')](_0x000e('0x17'));db[_0x000e('0x18')]=db['sequelize']['import'](_0x000e('0x19'));db[_0x000e('0x1a')]=db[_0x000e('0x2')]['import']('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x1b'));db[_0x000e('0x1c')]=db['sequelize']['import']('../api/voiceQueue/voiceQueue.model');db[_0x000e('0x1d')]=db[_0x000e('0x2')][_0x000e('0x14')]('../api/voiceRecording/voiceRecording.model');db['ScreenRecording']=db['sequelize'][_0x000e('0x14')]('../api/screenRecording/screenRecording.model');db[_0x000e('0x1e')]=db[_0x000e('0x2')][_0x000e('0x14')]('../api/voiceMail/voiceMail.model');db[_0x000e('0x1f')]=db[_0x000e('0x2')]['import'](_0x000e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x000e('0x14')](_0x000e('0x21'));db['VoiceDialReport']=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x22'));db[_0x000e('0x23')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x24'));db['VoiceQueueReport']=db['sequelize']['import'](_0x000e('0x25'));db[_0x000e('0x26')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x27'));db['Trunk']=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x28'));db[_0x000e('0x29')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x2a'));db[_0x000e('0x2b')]=db['sequelize']['import']('../api/userVoiceQueueRt/userVoiceQueueRt.model');db['UserVoiceQueue']=db['sequelize'][_0x000e('0x14')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x000e('0x2c')]=db[_0x000e('0x2')]['import'](_0x000e('0x2d'));db[_0x000e('0x2e')]=db[_0x000e('0x2')]['import'](_0x000e('0x2f'));db[_0x000e('0x30')]=db['sequelize']['import']('../api/userFaxQueue/userFaxQueue.model');db[_0x000e('0x31')]=db[_0x000e('0x2')]['import'](_0x000e('0x32'));db[_0x000e('0x33')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x34'));db['UserWhatsappQueue']=db[_0x000e('0x2')][_0x000e('0x14')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x000e('0x35')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x36'));db[_0x000e('0x37')]=db[_0x000e('0x2')][_0x000e('0x14')]('../api/mailServerOut/mailServerOut.model');db[_0x000e('0x38')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x39'));db[_0x000e('0x3a')]=db[_0x000e('0x2')]['import'](_0x000e('0x3b'));db[_0x000e('0x3c')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x3d'));db['MailInteraction']=db[_0x000e('0x2')]['import'](_0x000e('0x3e'));db[_0x000e('0x3f')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x40'));db['MailApplication']=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x41'));db[_0x000e('0x42')]=db[_0x000e('0x2')][_0x000e('0x14')]('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x43'));db[_0x000e('0x44')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x45'));db[_0x000e('0x46')]=db[_0x000e('0x2')]['import']('../api/faxAccount/faxAccount.model');db[_0x000e('0x47')]=db[_0x000e('0x2')]['import'](_0x000e('0x48'));db['FaxInteraction']=db[_0x000e('0x2')][_0x000e('0x14')]('../api/faxInteraction/faxInteraction.model');db[_0x000e('0x49')]=db[_0x000e('0x2')]['import'](_0x000e('0x4a'));db[_0x000e('0x4b')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x4c'));db[_0x000e('0x4d')]=db['sequelize']['import'](_0x000e('0x4e'));db[_0x000e('0x4f')]=db['sequelize']['import'](_0x000e('0x50'));db[_0x000e('0x51')]=db[_0x000e('0x2')]['import'](_0x000e('0x52'));db[_0x000e('0x53')]=db['sequelize']['import'](_0x000e('0x54'));db['SmsMessage']=db['sequelize'][_0x000e('0x14')](_0x000e('0x55'));db['SmsQueue']=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x56'));db[_0x000e('0x57')]=db['sequelize']['import'](_0x000e('0x58'));db[_0x000e('0x59')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x5a'));db[_0x000e('0x5b')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x5c'));db[_0x000e('0x5d')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x5e'));db[_0x000e('0x5f')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x60'));db[_0x000e('0x61')]=db['sequelize'][_0x000e('0x14')]('../api/chatWebsite/chatWebsite.model');db[_0x000e('0x62')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x63'));db['ChatApplication']=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x64'));db[_0x000e('0x65')]=db[_0x000e('0x2')][_0x000e('0x14')]('../api/chatInteraction/chatInteraction.model');db[_0x000e('0x66')]=db[_0x000e('0x2')]['import'](_0x000e('0x67'));db['ChatOfflineMessage']=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x68'));db[_0x000e('0x69')]=db['sequelize']['import'](_0x000e('0x6a'));db[_0x000e('0x6b')]=db[_0x000e('0x2')][_0x000e('0x14')]('../api/chatGroup/chatGroup.model');db[_0x000e('0x6c')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x6d'));db['CmCompany']=db[_0x000e('0x2')][_0x000e('0x14')]('../api/cmCompany/cmCompany.model');db[_0x000e('0x6e')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x6f'));db['CmHopper']=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x70'));db[_0x000e('0x71')]=db[_0x000e('0x2')]['import'](_0x000e('0x72'));db[_0x000e('0x73')]=db[_0x000e('0x2')][_0x000e('0x14')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x000e('0x74')]=db['sequelize'][_0x000e('0x14')](_0x000e('0x75'));db[_0x000e('0x76')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x77'));db[_0x000e('0x78')]=db[_0x000e('0x2')]['import']('../api/cmCustomField/cmCustomField.model');db[_0x000e('0x79')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x7a'));db[_0x000e('0x7b')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x7c'));db[_0x000e('0x7d')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x7e'));db[_0x000e('0x7f')]=db['sequelize'][_0x000e('0x14')](_0x000e('0x80'));db[_0x000e('0x81')]=db[_0x000e('0x2')]['import'](_0x000e('0x82'));db['Interval']=db['sequelize'][_0x000e('0x14')]('../api/interval/interval.model');db['Pause']=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x83'));db['Cdr']=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x84'));db['VoiceQueuesLog']=db[_0x000e('0x2')][_0x000e('0x14')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x000e('0x85')]=db[_0x000e('0x2')][_0x000e('0x14')]('../api/schedule/schedule.model');db[_0x000e('0x86')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x87'));db[_0x000e('0x88')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x89'));db[_0x000e('0x8a')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x8b'));db[_0x000e('0x8c')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x8d'));db[_0x000e('0x8e')]=db[_0x000e('0x2')]['import'](_0x000e('0x8f'));db['Integration']=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x90'));db[_0x000e('0x91')]=db['sequelize'][_0x000e('0x14')]('../api/integrationReport/integrationReport.model');db[_0x000e('0x92')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x93'));db[_0x000e('0x94')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x95'));db[_0x000e('0x96')]=db[_0x000e('0x2')]['import'](_0x000e('0x97'));db[_0x000e('0x98')]=db['sequelize'][_0x000e('0x14')](_0x000e('0x99'));db[_0x000e('0x9a')]=db[_0x000e('0x2')][_0x000e('0x14')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x000e('0x9b')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x9c'));db[_0x000e('0x9d')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x9e'));db[_0x000e('0x9f')]=db[_0x000e('0x2')]['import']('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x000e('0xa0')]=db['sequelize'][_0x000e('0x14')]('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0xa1'));db[_0x000e('0xa2')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0xa3'));db[_0x000e('0xa4')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0xa5'));db[_0x000e('0xa6')]=db['sequelize'][_0x000e('0x14')](_0x000e('0xa7'));db[_0x000e('0xa8')]=db[_0x000e('0x2')]['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x000e('0xa9')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0xaa'));db[_0x000e('0xab')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0xac'));db[_0x000e('0xad')]=db['sequelize'][_0x000e('0x14')](_0x000e('0xae'));db[_0x000e('0xaf')]=db['sequelize'][_0x000e('0x14')](_0x000e('0xb0'));db['ZendeskAccount']=db[_0x000e('0x2')][_0x000e('0x14')]('../api/intZendeskAccount/intZendeskAccount.model');db['ZendeskConfiguration']=db[_0x000e('0x2')]['import'](_0x000e('0xb1'));db[_0x000e('0xb2')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0xb3'));db['FreshdeskAccount']=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0xb4'));db[_0x000e('0xb5')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0xb6'));db[_0x000e('0xb7')]=db[_0x000e('0x2')][_0x000e('0x14')]('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db['sequelize']['import'](_0x000e('0xb8'));db['VtigerConfiguration']=db[_0x000e('0x2')]['import'](_0x000e('0xb9'));db[_0x000e('0xba')]=db[_0x000e('0x2')]['import'](_0x000e('0xbb'));db[_0x000e('0xbc')]=db[_0x000e('0x2')]['import'](_0x000e('0xbd'));db[_0x000e('0xbe')]=db['sequelize'][_0x000e('0x14')](_0x000e('0xbf'));db[_0x000e('0xc0')]=db[_0x000e('0x2')][_0x000e('0x14')]('../api/intServicenowField/intServicenowField.model');db[_0x000e('0xc1')]=db[_0x000e('0x2')][_0x000e('0x14')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x000e('0xc2')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0xc3'));db['Dynamics365Field']=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0xc4'));db['FreshsalesAccount']=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0xc5'));db[_0x000e('0xc6')]=db['sequelize'][_0x000e('0x14')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x000e('0xc7')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0xc8'));db[_0x000e('0xc9')]=db['sequelize'][_0x000e('0x14')](_0x000e('0x90'));db[_0x000e('0xca')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0xcb'));db['ChatQueueReport']=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0xcc'));db[_0x000e('0xcd')]=db['sequelize']['import']('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0xce'));db['JscriptyQuestionReport']=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0xcf'));db[_0x000e('0xd0')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0xd1'));db[_0x000e('0xd2')]=db[_0x000e('0x2')]['import'](_0x000e('0xd3'));db[_0x000e('0xd4')]=db[_0x000e('0x2')]['import'](_0x000e('0xd5'));db[_0x000e('0xd6')]=db['sequelize'][_0x000e('0x14')](_0x000e('0xd7'));db[_0x000e('0xd8')]=db[_0x000e('0x2')][_0x000e('0x14')]('../api/jscriptyProject/jscriptyProject.model');db[_0x000e('0xd9')]=db[_0x000e('0x2')]['import'](_0x000e('0xda'));db[_0x000e('0xdb')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0xdc'));db[_0x000e('0xdd')]=db['sequelize'][_0x000e('0x14')](_0x000e('0xde'));db[_0x000e('0xdf')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0xe0'));db[_0x000e('0xe1')]=db[_0x000e('0x2')]['import'](_0x000e('0xe2'));db['Team']=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0xe3'));db[_0x000e('0xe4')]=db[_0x000e('0x2')][_0x000e('0x14')]('../api/license/license.model');db['Campaign']=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0xe5'));db[_0x000e('0xe6')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0xe7'));db[_0x000e('0xe8')]=db['sequelize'][_0x000e('0x14')](_0x000e('0xe9'));db[_0x000e('0xea')]=db['sequelize'][_0x000e('0x14')]('../api/plugin/plugin.model');db[_0x000e('0xeb')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0xec'));db[_0x000e('0xed')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0xee'));db['FaxTransferReport']=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0xef'));db[_0x000e('0xf0')]=db[_0x000e('0x2')]['import'](_0x000e('0xf1'));db[_0x000e('0xf2')]=db['sequelize'][_0x000e('0x14')](_0x000e('0xf3'));db[_0x000e('0xf4')]=db['sequelize'][_0x000e('0x14')]('../api/cmList/cmList.model');db[_0x000e('0xf5')]=db[_0x000e('0x2')][_0x000e('0x14')]('../api/voicePrefix/voicePrefix.model');db['UserProfile']=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0xf6'));db[_0x000e('0xf7')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0xf8'));db[_0x000e('0xf9')]=db[_0x000e('0x2')]['import']('../api/userProfileResource/userProfileResource.model');db[_0x000e('0xfa')]=db[_0x000e('0x2')]['import'](_0x000e('0xfb'));db[_0x000e('0xfc')]=db[_0x000e('0x2')][_0x000e('0x14')]('../api/whatsappAccount/whatsappAccount.model');db[_0x000e('0xfd')]=db[_0x000e('0x2')]['import']('../api/whatsappApplication/whatsappApplication.model');db[_0x000e('0xfe')]=db[_0x000e('0x2')]['import'](_0x000e('0xff'));db['WhatsappMessage']=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x100'));db['WhatsappQueueReport']=db[_0x000e('0x2')][_0x000e('0x14')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x000e('0x101')]=db['sequelize']['import'](_0x000e('0x102'));db[_0x000e('0x103')]=db['sequelize'][_0x000e('0x14')](_0x000e('0x104'));db[_0x000e('0x105')]=db[_0x000e('0x2')][_0x000e('0x14')](_0x000e('0x106'));db[_0x000e('0x13')][_0x000e('0x107')](db[_0x000e('0x1e')],{'as':_0x000e('0x1e'),'onDelete':_0x000e('0x108'),'foreignKey':_0x000e('0x109')});db[_0x000e('0x13')][_0x000e('0x10a')](db[_0x000e('0x1d')],{'as':'Recordings','foreignKey':_0x000e('0x109')});db['User']['hasMany'](db[_0x000e('0x2b')],{'as':_0x000e('0x10b'),'foreignKey':'UserId'});db[_0x000e('0x13')][_0x000e('0x10a')](db[_0x000e('0x1a')],{'as':'Extensions','onDelete':_0x000e('0x108'),'hooks':!![]});db['User'][_0x000e('0x10a')](db['CmHopperFinal'],{'as':_0x000e('0x10c'),'foreignKey':_0x000e('0x109')});db['User'][_0x000e('0x10a')](db[_0x000e('0x74')],{'as':_0x000e('0x10d'),'foreignKey':_0x000e('0x109')});db['User']['hasMany'](db[_0x000e('0x76')],{'as':'ReportAgentPreview','foreignKey':'UserId'});db[_0x000e('0x13')][_0x000e('0x10a')](db[_0x000e('0x5b')],{'as':_0x000e('0x10e'),'foreignKey':_0x000e('0x109')});db['User'][_0x000e('0x10a')](db[_0x000e('0x65')],{'as':_0x000e('0x10f'),'foreignKey':_0x000e('0x109')});db[_0x000e('0x13')]['hasMany'](db[_0x000e('0x53')],{'as':_0x000e('0x110'),'foreignKey':_0x000e('0x109')});db[_0x000e('0x13')][_0x000e('0x10a')](db[_0x000e('0x111')],{'as':_0x000e('0x112'),'foreignKey':_0x000e('0x109')});db[_0x000e('0x13')][_0x000e('0x10a')](db[_0x000e('0x113')],{'as':_0x000e('0x114'),'foreignKey':_0x000e('0x109')});db[_0x000e('0x13')][_0x000e('0x10a')](db[_0x000e('0xfe')],{'as':_0x000e('0x115'),'foreignKey':_0x000e('0x109')});db[_0x000e('0x13')]['hasMany'](db['Notification'],{'as':'Notifications','foreignKey':_0x000e('0x116')});db['User'][_0x000e('0x117')](db[_0x000e('0x118')],{'as':'UserProfile','foreignKey':_0x000e('0x119')});db[_0x000e('0x13')][_0x000e('0x11a')](db['ChatGroup'],{'as':_0x000e('0x11b'),'through':_0x000e('0x11c')});db[_0x000e('0x13')][_0x000e('0x11a')](db['CmContact'],{'as':_0x000e('0x11d'),'through':_0x000e('0x11e')});db[_0x000e('0x13')][_0x000e('0x11a')](db[_0x000e('0xf4')],{'as':'Lists','through':'cm_user_has_lists'});db['User'][_0x000e('0x11a')](db[_0x000e('0x11f')],{'through':_0x000e('0x120')});db[_0x000e('0x13')][_0x000e('0x11a')](db[_0x000e('0x113')],{'as':_0x000e('0x114'),'through':'user_has_mail_interactions'});db[_0x000e('0x13')][_0x000e('0x11a')](db['ChatInteraction'],{'as':'ChatInteractions','through':_0x000e('0x121')});db[_0x000e('0x13')]['belongsToMany'](db['FaxInteraction'],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db['User'][_0x000e('0x11a')](db['SmsInteraction'],{'as':'SmsInteractions','through':_0x000e('0x122')});db[_0x000e('0x13')][_0x000e('0x11a')](db[_0x000e('0x5b')],{'as':_0x000e('0x10e'),'through':_0x000e('0x123')});db[_0x000e('0x13')][_0x000e('0x11a')](db[_0x000e('0xfe')],{'as':'WhatsappInteractions','through':_0x000e('0x124')});db[_0x000e('0x13')]['belongsToMany'](db[_0x000e('0x1c')],{'as':_0x000e('0x125'),'through':_0x000e('0x126'),'required':![]});db['User'][_0x000e('0x11a')](db[_0x000e('0x3a')],{'as':_0x000e('0x127'),'through':_0x000e('0x2e'),'required':![]});db[_0x000e('0x13')]['belongsToMany'](db[_0x000e('0x69')],{'as':_0x000e('0x128'),'through':_0x000e('0x2c'),'required':![],'hooks':!![]});db[_0x000e('0x13')][_0x000e('0x11a')](db['FaxQueue'],{'as':'FaxQueues','through':_0x000e('0x30'),'required':![]});db['User'][_0x000e('0x11a')](db[_0x000e('0x129')],{'as':'SmsQueues','through':'UserSmsQueue','required':![]});db['User'][_0x000e('0x11a')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0x000e('0x13')]['belongsToMany'](db[_0x000e('0x103')],{'as':'WhatsappQueues','through':_0x000e('0x12a'),'required':![]});db[_0x000e('0x13')]['belongsToMany'](db['CmList'],{'through':_0x000e('0x12b')});db[_0x000e('0x13')][_0x000e('0x11a')](db[_0x000e('0xf5')],{'as':_0x000e('0x12c'),'through':_0x000e('0x12d'),'required':![]});db[_0x000e('0x13')][_0x000e('0x11a')](db[_0x000e('0x61')],{'as':'ChatWebsites','through':'user_has_chat_websites'});db[_0x000e('0x13')][_0x000e('0x11a')](db[_0x000e('0x46')],{'as':_0x000e('0x12e'),'through':'user_has_fax_accounts'});db[_0x000e('0x13')]['belongsToMany'](db[_0x000e('0x38')],{'as':_0x000e('0x12f'),'through':_0x000e('0x130')});db['User'][_0x000e('0x11a')](db['OpenchannelAccount'],{'as':_0x000e('0x131'),'through':_0x000e('0x132')});db['User'][_0x000e('0x11a')](db['SmsAccount'],{'as':_0x000e('0x133'),'through':_0x000e('0x134')});db[_0x000e('0x13')][_0x000e('0x11a')](db[_0x000e('0xfc')],{'as':_0x000e('0x135'),'through':_0x000e('0x136')});db['User'][_0x000e('0x11a')](db[_0x000e('0xdd')],{'as':_0x000e('0x137'),'through':_0x000e('0x138')});db[_0x000e('0x16')][_0x000e('0x10a')](db[_0x000e('0x1a')],{'as':_0x000e('0x139'),'onDelete':'cascade','foreignKey':_0x000e('0x13a')});db[_0x000e('0x18')]['hasMany'](db[_0x000e('0x1a')],{'onDelete':_0x000e('0x108')});db[_0x000e('0x1a')][_0x000e('0x10a')](db[_0x000e('0x1a')],{'as':'Applications','onDelete':_0x000e('0x108')});db[_0x000e('0x13b')][_0x000e('0x11a')](db[_0x000e('0x86')],{'as':_0x000e('0x13c'),'through':_0x000e('0x13d')});db[_0x000e('0x1c')]['hasMany'](db[_0x000e('0x2b')],{'as':'Members','foreignKey':_0x000e('0x13e')});db[_0x000e('0x1c')]['hasMany'](db[_0x000e('0x13f')],{'as':_0x000e('0x140'),'foreignKey':'VoiceQueueId'});db[_0x000e('0x1c')][_0x000e('0x10a')](db['CmHopperFinal'],{'as':_0x000e('0x10c'),'foreignKey':'VoiceQueueId'});db[_0x000e('0x1c')][_0x000e('0x10a')](db[_0x000e('0x74')],{'as':_0x000e('0x141'),'foreignKey':_0x000e('0x13e')});db[_0x000e('0x1c')]['hasMany'](db[_0x000e('0x76')],{'as':'ReportAgentPreview','foreignKey':_0x000e('0x13e')});db[_0x000e('0x1c')][_0x000e('0x10a')](db['CmHopperBlack'],{'as':_0x000e('0x142'),'foreignKey':_0x000e('0x13e')});db[_0x000e('0x1c')][_0x000e('0x10a')](db[_0x000e('0xd0')],{'as':_0x000e('0x143'),'foreignKey':_0x000e('0x13e')});db[_0x000e('0x1c')][_0x000e('0x117')](db[_0x000e('0x144')],{'as':_0x000e('0x144'),'foreignKey':'TrunkId'});db[_0x000e('0x1c')]['belongsTo'](db[_0x000e('0x144')],{'as':'TrunkBackup','foreignKey':_0x000e('0x145')});db[_0x000e('0x1c')][_0x000e('0x117')](db[_0x000e('0x146')],{'as':'Interval','foreignKey':'IntervalId'});db[_0x000e('0x1c')][_0x000e('0x117')](db['Pause'],{'as':_0x000e('0x147'),'foreignKey':_0x000e('0x148')});db[_0x000e('0x1c')]['belongsToMany'](db[_0x000e('0xf4')],{'as':_0x000e('0x149'),'through':_0x000e('0x14a')});db[_0x000e('0x1c')][_0x000e('0x11a')](db[_0x000e('0x13')],{'as':_0x000e('0x14b'),'through':_0x000e('0x126')});db[_0x000e('0x1c')][_0x000e('0x11a')](db[_0x000e('0x11f')],{'as':_0x000e('0x14c'),'through':_0x000e('0x14d')});db[_0x000e('0x1c')][_0x000e('0x11a')](db[_0x000e('0xf4')],{'as':_0x000e('0x14e'),'through':_0x000e('0x14f')});db['VoiceRecording'][_0x000e('0x117')](db['User'],{'as':_0x000e('0x13'),'foreignKey':_0x000e('0x109')});db[_0x000e('0x150')][_0x000e('0x117')](db[_0x000e('0x13')],{'as':'User','foreignKey':_0x000e('0x109')});db[_0x000e('0x1e')][_0x000e('0x10a')](db[_0x000e('0x1f')],{'as':'Messages','onDelete':_0x000e('0x108'),'foreignKey':_0x000e('0x151'),'sourceKey':_0x000e('0x152')});db[_0x000e('0x1f')][_0x000e('0x117')](db['VoiceMail'],{'foreignKey':_0x000e('0x151'),'targetKey':'mailbox'});db['VoiceCallReport'][_0x000e('0x10a')](db['VoiceQueueReport'],{'as':'QueueCalls','foreignKey':'uniqueid','constraints':![]});db[_0x000e('0x153')]['hasMany'](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':_0x000e('0x154'),'constraints':![]});db[_0x000e('0x153')]['belongsTo'](db[_0x000e('0x13')],{'as':_0x000e('0x13'),'foreignKey':'UserId'});db[_0x000e('0x153')][_0x000e('0x117')](db['CmContact'],{'as':_0x000e('0x155'),'foreignKey':_0x000e('0x156')});db[_0x000e('0x35')][_0x000e('0x117')](db[_0x000e('0x38')],{'as':'MailAccount','foreignKey':_0x000e('0x157')});db[_0x000e('0x37')]['belongsTo'](db[_0x000e('0x38')],{'as':'MailAccount','foreignKey':_0x000e('0x157')});db[_0x000e('0x38')][_0x000e('0x107')](db[_0x000e('0x35')],{'as':_0x000e('0x158'),'onDelete':_0x000e('0x108')});db[_0x000e('0x38')][_0x000e('0x107')](db[_0x000e('0x37')],{'as':_0x000e('0x159'),'onDelete':_0x000e('0x108')});db[_0x000e('0x38')][_0x000e('0x10a')](db['Disposition'],{'as':_0x000e('0x15a'),'foreignKey':'MailAccountId'});db[_0x000e('0x38')]['hasMany'](db[_0x000e('0x7d')],{'as':'Answers','foreignKey':'MailAccountId'});db[_0x000e('0x38')][_0x000e('0x10a')](db['MailMessage'],{'as':_0x000e('0x15b'),'foreignKey':_0x000e('0x157')});db['MailAccount']['hasMany'](db[_0x000e('0x113')],{'as':_0x000e('0x15c')});db[_0x000e('0x38')][_0x000e('0x10a')](db['MailApplication'],{'as':_0x000e('0x15d')});db[_0x000e('0x38')][_0x000e('0x117')](db['CmList'],{'as':_0x000e('0x15e'),'foreignKey':_0x000e('0x15f')});db['MailAccount']['belongsTo'](db[_0x000e('0x8a')],{'as':'Template','foreignKey':_0x000e('0x160')});db['MailAccount']['belongsTo'](db[_0x000e('0x161')],{'as':_0x000e('0x147'),'foreignKey':_0x000e('0x148')});db[_0x000e('0x38')]['belongsToMany'](db[_0x000e('0x13')],{'as':_0x000e('0x14b'),'through':_0x000e('0x130')});db['MailQueue'][_0x000e('0x11a')](db[_0x000e('0x13')],{'as':_0x000e('0x14b'),'through':_0x000e('0x2e')});db[_0x000e('0x3a')][_0x000e('0x11a')](db[_0x000e('0x11f')],{'through':'team_has_mail_queues','as':_0x000e('0x14c')});db[_0x000e('0x113')][_0x000e('0x10a')](db['MailMessage'],{'as':'Messages','onDelete':_0x000e('0x108'),'foreignKey':_0x000e('0x162')});db[_0x000e('0x113')][_0x000e('0x117')](db[_0x000e('0x38')],{'as':_0x000e('0x163'),'foreignKey':_0x000e('0x157')});db[_0x000e('0x113')][_0x000e('0x117')](db[_0x000e('0x6e')],{'as':_0x000e('0x155'),'foreignKey':_0x000e('0x156')});db[_0x000e('0x113')][_0x000e('0x117')](db[_0x000e('0x13')],{'as':_0x000e('0x164'),'foreignKey':_0x000e('0x109')});db[_0x000e('0x113')][_0x000e('0x11a')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x000e('0x165')});db[_0x000e('0x113')][_0x000e('0x11a')](db['Tag'],{'through':_0x000e('0x166'),'as':_0x000e('0x167')});db['MailInteraction'][_0x000e('0x11a')](db[_0x000e('0x13')],{'as':_0x000e('0x168'),'through':_0x000e('0x169'),'foreignKey':_0x000e('0x162')});db[_0x000e('0x3f')]['hasMany'](db['Attachment'],{'as':_0x000e('0x16a'),'onDelete':_0x000e('0x108')});db['MailMessage'][_0x000e('0x117')](db[_0x000e('0x13')],{'as':_0x000e('0x13')});db['MailMessage'][_0x000e('0x117')](db[_0x000e('0x6e')],{'onDelete':_0x000e('0x108'),'as':_0x000e('0x155')});db[_0x000e('0x3f')][_0x000e('0x117')](db[_0x000e('0x113')],{'as':_0x000e('0x16b'),'foreignKey':_0x000e('0x162')});db[_0x000e('0x3f')][_0x000e('0x117')](db[_0x000e('0x38')],{'as':'Account','foreignKey':_0x000e('0x157')});db[_0x000e('0x16c')][_0x000e('0x117')](db['User'],{'onDelete':_0x000e('0x16d')});db[_0x000e('0x16c')][_0x000e('0x117')](db[_0x000e('0x3a')],{'onDelete':'restrict'});db[_0x000e('0x16c')]['belongsTo'](db[_0x000e('0x38')],{'onDelete':'restrict'});db[_0x000e('0x16c')][_0x000e('0x117')](db[_0x000e('0x146')],{'onDelete':_0x000e('0x16d'),'foreignKey':_0x000e('0x16e')});db['MailApplication']['belongsTo'](db['Tag'],{'onDelete':_0x000e('0x16d'),'foreignKey':_0x000e('0x16f')});db[_0x000e('0x42')][_0x000e('0x117')](db[_0x000e('0x38')],{});db[_0x000e('0x42')][_0x000e('0x117')](db[_0x000e('0xf4')],{'as':_0x000e('0x15e'),'foreignKey':_0x000e('0x15f')});db[_0x000e('0x42')]['belongsTo'](db[_0x000e('0x6e')],{'as':_0x000e('0x155'),'foreignKey':_0x000e('0x156')});db[_0x000e('0x42')][_0x000e('0x117')](db[_0x000e('0x113')],{});db['MailQueueReport'][_0x000e('0x117')](db[_0x000e('0x3f')],{});db['MailQueueReport'][_0x000e('0x117')](db[_0x000e('0x13')],{});db[_0x000e('0x42')]['belongsTo'](db[_0x000e('0x3a')],{});db[_0x000e('0x170')][_0x000e('0x10a')](db[_0x000e('0x44')],{'as':_0x000e('0x171'),'onDelete':_0x000e('0x108')});db['FaxAccount'][_0x000e('0x10a')](db[_0x000e('0x7f')],{'as':'Dispositions','foreignKey':'FaxAccountId'});db[_0x000e('0x46')][_0x000e('0x10a')](db[_0x000e('0x7d')],{'as':_0x000e('0x172'),'foreignKey':_0x000e('0x173')});db[_0x000e('0x46')][_0x000e('0x10a')](db[_0x000e('0x111')],{'as':_0x000e('0x15c')});db['FaxAccount'][_0x000e('0x10a')](db[_0x000e('0x47')],{'as':_0x000e('0x15d')});db[_0x000e('0x46')][_0x000e('0x10a')](db[_0x000e('0x1a')],{'as':_0x000e('0x174'),'onDelete':_0x000e('0x108')});db[_0x000e('0x46')]['hasMany'](db[_0x000e('0x49')],{'as':_0x000e('0x15b')});db[_0x000e('0x46')][_0x000e('0x117')](db[_0x000e('0x144')],{'as':_0x000e('0x144')});db[_0x000e('0x46')][_0x000e('0x117')](db['CmList'],{'as':_0x000e('0x15e'),'foreignKey':_0x000e('0x15f')});db[_0x000e('0x46')][_0x000e('0x117')](db[_0x000e('0x161')],{'as':_0x000e('0x147'),'foreignKey':_0x000e('0x148')});db[_0x000e('0x46')][_0x000e('0x11a')](db[_0x000e('0x13')],{'as':_0x000e('0x14b'),'through':_0x000e('0x175')});db[_0x000e('0x47')][_0x000e('0x117')](db[_0x000e('0x13')],{'onDelete':_0x000e('0x16d')});db[_0x000e('0x47')]['belongsTo'](db['FaxQueue'],{'onDelete':_0x000e('0x16d')});db[_0x000e('0x47')]['belongsTo'](db[_0x000e('0x46')],{'onDelete':_0x000e('0x16d')});db[_0x000e('0x47')][_0x000e('0x117')](db['Tag'],{'onDelete':_0x000e('0x16d'),'foreignKey':_0x000e('0x16f')});db[_0x000e('0x111')][_0x000e('0x10a')](db[_0x000e('0x49')],{'as':_0x000e('0x15b'),'onDelete':_0x000e('0x108'),'foreignKey':'FaxInteractionId'});db[_0x000e('0x111')][_0x000e('0x117')](db[_0x000e('0x46')],{'as':_0x000e('0x163'),'foreignKey':_0x000e('0x173')});db[_0x000e('0x111')][_0x000e('0x117')](db[_0x000e('0x6e')],{'as':_0x000e('0x155'),'foreignKey':_0x000e('0x156')});db['FaxInteraction'][_0x000e('0x117')](db[_0x000e('0x13')],{'as':_0x000e('0x164'),'foreignKey':_0x000e('0x109')});db[_0x000e('0x111')][_0x000e('0x11a')](db['Tag'],{'through':_0x000e('0x176'),'as':_0x000e('0x165')});db[_0x000e('0x111')][_0x000e('0x11a')](db[_0x000e('0x88')],{'through':_0x000e('0x176'),'as':_0x000e('0x167')});db[_0x000e('0x111')][_0x000e('0x11a')](db[_0x000e('0x13')],{'as':_0x000e('0x168'),'through':_0x000e('0x177'),'foreignKey':_0x000e('0x178')});db[_0x000e('0x49')]['belongsTo'](db[_0x000e('0x13')],{'onDelete':_0x000e('0x108'),'as':_0x000e('0x13')});db['FaxMessage'][_0x000e('0x117')](db[_0x000e('0x111')],{'as':_0x000e('0x16b'),'foreignKey':_0x000e('0x178')});db[_0x000e('0x49')][_0x000e('0x117')](db[_0x000e('0x6e')],{'onDelete':_0x000e('0x108'),'as':_0x000e('0x155')});db['FaxMessage'][_0x000e('0x117')](db[_0x000e('0xe8')],{'as':_0x000e('0xe8'),'foreignKey':_0x000e('0x179')});db[_0x000e('0x49')][_0x000e('0x117')](db['FaxAccount'],{'as':_0x000e('0x163'),'foreignKey':_0x000e('0x173')});db[_0x000e('0x4b')][_0x000e('0x11a')](db[_0x000e('0x13')],{'as':_0x000e('0x14b'),'through':'UserFaxQueue'});db['FaxQueue'][_0x000e('0x11a')](db[_0x000e('0x11f')],{'through':_0x000e('0x17a'),'as':'Teams'});db[_0x000e('0x4d')]['belongsTo'](db['FaxAccount'],{});db[_0x000e('0x4d')][_0x000e('0x117')](db[_0x000e('0xf4')],{'as':_0x000e('0x15e'),'foreignKey':_0x000e('0x15f')});db[_0x000e('0x4d')][_0x000e('0x117')](db[_0x000e('0x6e')],{'as':_0x000e('0x155'),'foreignKey':'ContactId'});db[_0x000e('0x4d')][_0x000e('0x117')](db['FaxInteraction'],{});db['FaxQueueReport']['belongsTo'](db['FaxMessage'],{});db['FaxQueueReport'][_0x000e('0x117')](db['User'],{});db[_0x000e('0x4d')][_0x000e('0x117')](db[_0x000e('0x4b')],{});db[_0x000e('0x4f')][_0x000e('0x10a')](db['Disposition'],{'as':_0x000e('0x15a'),'foreignKey':'SmsAccountId'});db['SmsAccount']['hasMany'](db[_0x000e('0x7d')],{'as':_0x000e('0x172'),'foreignKey':_0x000e('0x17b')});db[_0x000e('0x4f')][_0x000e('0x10a')](db[_0x000e('0x17c')],{'as':_0x000e('0x15b'),'foreignKey':'SmsAccountId'});db[_0x000e('0x4f')][_0x000e('0x10a')](db['SmsInteraction'],{'as':_0x000e('0x15c')});db[_0x000e('0x4f')][_0x000e('0x10a')](db['SmsApplication'],{'as':_0x000e('0x15d')});db['SmsAccount']['belongsTo'](db[_0x000e('0xf4')],{'as':_0x000e('0x15e'),'foreignKey':_0x000e('0x15f')});db[_0x000e('0x4f')][_0x000e('0x117')](db[_0x000e('0x161')],{'as':_0x000e('0x147'),'foreignKey':_0x000e('0x148')});db[_0x000e('0x4f')]['belongsToMany'](db[_0x000e('0x13')],{'as':_0x000e('0x14b'),'through':_0x000e('0x134')});db[_0x000e('0x51')][_0x000e('0x117')](db[_0x000e('0x13')],{'onDelete':_0x000e('0x16d')});db[_0x000e('0x51')][_0x000e('0x117')](db[_0x000e('0x129')],{'onDelete':_0x000e('0x16d')});db[_0x000e('0x51')][_0x000e('0x117')](db['SmsAccount'],{'onDelete':'restrict'});db[_0x000e('0x51')][_0x000e('0x117')](db['Interval'],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x000e('0x51')][_0x000e('0x117')](db[_0x000e('0x88')],{'onDelete':_0x000e('0x16d'),'foreignKey':'TagId'});db['SmsInteraction'][_0x000e('0x10a')](db['SmsMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x000e('0x17d')});db[_0x000e('0x53')][_0x000e('0x117')](db['SmsAccount'],{'as':_0x000e('0x163'),'foreignKey':'SmsAccountId'});db['SmsInteraction']['belongsTo'](db['CmContact'],{'as':_0x000e('0x155'),'foreignKey':'ContactId'});db[_0x000e('0x53')][_0x000e('0x117')](db[_0x000e('0x13')],{'as':_0x000e('0x164'),'foreignKey':_0x000e('0x109')});db[_0x000e('0x53')]['belongsToMany'](db[_0x000e('0x88')],{'through':_0x000e('0x17e'),'as':'Tags'});db[_0x000e('0x53')][_0x000e('0x11a')](db[_0x000e('0x88')],{'through':_0x000e('0x17e'),'as':'ThroughTags'});db[_0x000e('0x53')][_0x000e('0x11a')](db['User'],{'as':_0x000e('0x168'),'through':_0x000e('0x122'),'foreignKey':_0x000e('0x17d')});db['SmsMessage'][_0x000e('0x117')](db[_0x000e('0x13')],{'as':_0x000e('0x13')});db['SmsMessage'][_0x000e('0x117')](db['CmContact'],{'onDelete':_0x000e('0x108'),'as':_0x000e('0x155')});db[_0x000e('0x17c')]['belongsTo'](db[_0x000e('0x53')],{'onDelete':_0x000e('0x108'),'as':_0x000e('0x16b'),'foreignKey':_0x000e('0x17d')});db[_0x000e('0x17c')]['belongsTo'](db[_0x000e('0x4f')],{'as':_0x000e('0x163'),'foreignKey':_0x000e('0x17b')});db[_0x000e('0x129')][_0x000e('0x11a')](db['User'],{'as':'Agents','through':_0x000e('0x31'),'foreignKey':_0x000e('0x17f')});db[_0x000e('0x129')][_0x000e('0x11a')](db[_0x000e('0x11f')],{'through':_0x000e('0x180'),'as':_0x000e('0x14c')});db[_0x000e('0x57')]['hasMany'](db[_0x000e('0x7f')],{'as':_0x000e('0x15a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x000e('0x10a')](db[_0x000e('0x7d')],{'as':_0x000e('0x172'),'foreignKey':_0x000e('0x181')});db[_0x000e('0x57')][_0x000e('0x10a')](db['OpenchannelInteraction'],{'as':_0x000e('0x15c'),'foreignKey':_0x000e('0x181')});db[_0x000e('0x57')][_0x000e('0x10a')](db[_0x000e('0x5d')],{'as':_0x000e('0x15b'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x000e('0x10a')](db[_0x000e('0x59')],{'as':'Applications','foreignKey':_0x000e('0x181')});db['OpenchannelAccount'][_0x000e('0x117')](db[_0x000e('0xf4')],{'as':_0x000e('0x15e'),'foreignKey':'ListId'});db[_0x000e('0x57')][_0x000e('0x117')](db[_0x000e('0x161')],{'as':_0x000e('0x147'),'foreignKey':_0x000e('0x148')});db[_0x000e('0x57')][_0x000e('0x11a')](db[_0x000e('0x13')],{'as':_0x000e('0x14b'),'through':_0x000e('0x132')});db['OpenchannelApplication'][_0x000e('0x117')](db[_0x000e('0x13')],{'onDelete':_0x000e('0x16d')});db[_0x000e('0x59')]['belongsTo'](db[_0x000e('0x5f')],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db[_0x000e('0x59')][_0x000e('0x117')](db[_0x000e('0x57')],{'onDelete':'restrict','foreignKey':_0x000e('0x181')});db[_0x000e('0x59')][_0x000e('0x117')](db[_0x000e('0x146')],{'onDelete':_0x000e('0x16d'),'foreignKey':_0x000e('0x16e')});db[_0x000e('0x59')][_0x000e('0x117')](db[_0x000e('0x88')],{'onDelete':_0x000e('0x16d'),'foreignKey':_0x000e('0x16f')});db[_0x000e('0x5b')]['hasMany'](db[_0x000e('0x5d')],{'as':_0x000e('0x15b'),'onDelete':'cascade','foreignKey':_0x000e('0x182')});db['OpenchannelInteraction']['belongsTo'](db[_0x000e('0x57')],{'as':_0x000e('0x163'),'foreignKey':_0x000e('0x181')});db[_0x000e('0x5b')]['belongsTo'](db[_0x000e('0x6e')],{'as':_0x000e('0x155'),'foreignKey':_0x000e('0x156')});db[_0x000e('0x5b')][_0x000e('0x117')](db['User'],{'as':'Owner','foreignKey':_0x000e('0x109')});db[_0x000e('0x5b')][_0x000e('0x11a')](db[_0x000e('0x88')],{'through':'openchannel_interaction_has_tags','as':_0x000e('0x165')});db[_0x000e('0x5b')]['belongsToMany'](db[_0x000e('0x88')],{'through':_0x000e('0x183'),'as':_0x000e('0x167')});db[_0x000e('0x5b')][_0x000e('0x11a')](db[_0x000e('0x13')],{'as':'Users','through':'user_has_openchannel_interactions','foreignKey':_0x000e('0x182')});db[_0x000e('0x5d')]['belongsTo'](db[_0x000e('0x13')],{'onDelete':_0x000e('0x108'),'as':_0x000e('0x13')});db[_0x000e('0x5d')][_0x000e('0x117')](db['CmContact'],{'onDelete':_0x000e('0x108'),'as':_0x000e('0x155')});db['OpenchannelMessage'][_0x000e('0x117')](db['OpenchannelInteraction'],{'onDelete':_0x000e('0x108'),'as':_0x000e('0x16b'),'foreignKey':_0x000e('0x182')});db[_0x000e('0x5d')][_0x000e('0x117')](db[_0x000e('0xe8')],{'as':_0x000e('0xe8'),'foreignKey':_0x000e('0x179')});db['OpenchannelMessage'][_0x000e('0x117')](db['OpenchannelAccount'],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0x000e('0x5f')][_0x000e('0x11a')](db['User'],{'as':_0x000e('0x14b'),'through':_0x000e('0x33'),'foreignKey':'OpenchannelQueueId'});db[_0x000e('0x5f')][_0x000e('0x11a')](db[_0x000e('0x11f')],{'through':'team_has_openchannel_queues','as':_0x000e('0x14c')});db[_0x000e('0x61')]['hasMany'](db[_0x000e('0x7f')],{'as':_0x000e('0x15a'),'foreignKey':_0x000e('0x184')});db[_0x000e('0x61')][_0x000e('0x10a')](db[_0x000e('0x7d')],{'as':_0x000e('0x172'),'foreignKey':'ChatWebsiteId'});db[_0x000e('0x61')]['hasMany'](db['ChatProactiveAction'],{'as':_0x000e('0x185')});db[_0x000e('0x61')][_0x000e('0x10a')](db[_0x000e('0x65')],{'as':_0x000e('0x15c')});db['ChatWebsite'][_0x000e('0x10a')](db[_0x000e('0x186')],{'as':_0x000e('0x15d')});db[_0x000e('0x61')]['hasMany'](db[_0x000e('0x66')],{'as':'Messages'});db[_0x000e('0x61')][_0x000e('0x117')](db[_0x000e('0xf4')],{'as':_0x000e('0x15e'),'foreignKey':'ListId'});db[_0x000e('0x61')]['belongsTo'](db[_0x000e('0x146')],{'as':_0x000e('0x146'),'foreignKey':_0x000e('0x16e')});db[_0x000e('0x61')][_0x000e('0x117')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x000e('0x148')});db[_0x000e('0x61')]['belongsToMany'](db[_0x000e('0x13')],{'as':_0x000e('0x14b'),'through':_0x000e('0x187')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x000e('0x62')][_0x000e('0x117')](db[_0x000e('0xf4')],{'as':_0x000e('0x15e'),'foreignKey':'ListId'});db[_0x000e('0x62')][_0x000e('0x117')](db['CmContact'],{'as':_0x000e('0x155'),'foreignKey':_0x000e('0x156')});db['OpenchannelQueueReport'][_0x000e('0x117')](db['OpenchannelInteraction'],{});db[_0x000e('0x62')][_0x000e('0x117')](db[_0x000e('0x5d')],{});db[_0x000e('0x62')][_0x000e('0x117')](db[_0x000e('0x13')],{});db[_0x000e('0x62')][_0x000e('0x117')](db[_0x000e('0x5f')],{});db['ChatApplication'][_0x000e('0x117')](db[_0x000e('0x13')],{'as':_0x000e('0x188'),'foreignKey':_0x000e('0x109'),'onDelete':'restrict'});db[_0x000e('0x186')]['belongsTo'](db['ChatQueue'],{'as':_0x000e('0x189'),'foreignKey':'ChatQueueId','onDelete':_0x000e('0x16d')});db['ChatApplication'][_0x000e('0x117')](db[_0x000e('0x61')],{'as':_0x000e('0x18a'),'foreignKey':'ChatWebsiteId','onDelete':'restrict'});db[_0x000e('0x186')][_0x000e('0x117')](db[_0x000e('0x88')],{'onDelete':_0x000e('0x16d'),'foreignKey':_0x000e('0x16f')});db['ChatInteraction'][_0x000e('0x10a')](db['ChatMessage'],{'as':_0x000e('0x15b'),'onDelete':_0x000e('0x108'),'foreignKey':_0x000e('0x18b')});db[_0x000e('0x65')]['belongsTo'](db[_0x000e('0x61')],{'as':_0x000e('0x163'),'foreignKey':_0x000e('0x184')});db['ChatInteraction'][_0x000e('0x117')](db[_0x000e('0x6e')],{'as':'Contact','foreignKey':_0x000e('0x156')});db[_0x000e('0x65')]['belongsTo'](db[_0x000e('0x13')],{'as':_0x000e('0x164'),'foreignKey':'UserId'});db[_0x000e('0x65')][_0x000e('0x11a')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x000e('0x165')});db[_0x000e('0x65')][_0x000e('0x11a')](db[_0x000e('0x88')],{'through':_0x000e('0x18c'),'as':_0x000e('0x167')});db['ChatInteraction']['belongsToMany'](db['User'],{'as':_0x000e('0x168'),'through':_0x000e('0x121'),'foreignKey':'ChatInteractionId'});db[_0x000e('0x66')][_0x000e('0x117')](db[_0x000e('0x13')],{'onDelete':_0x000e('0x108'),'as':_0x000e('0x13')});db['ChatMessage']['belongsTo'](db[_0x000e('0x6e')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x000e('0x156')});db[_0x000e('0x66')]['belongsTo'](db[_0x000e('0x65')],{'onDelete':_0x000e('0x108'),'as':'Interaction','foreignKey':_0x000e('0x18b')});db[_0x000e('0x66')]['belongsTo'](db[_0x000e('0xe8')],{'as':'Attachment','foreignKey':'AttachmentId'});db['ChatMessage']['belongsTo'](db[_0x000e('0x61')],{'as':_0x000e('0x163'),'foreignKey':_0x000e('0x184')});db[_0x000e('0x18d')][_0x000e('0x117')](db[_0x000e('0x6e')],{'onDelete':'cascade','as':_0x000e('0x155'),'foreignKey':_0x000e('0x156')});db['ChatOfflineMessage'][_0x000e('0x117')](db[_0x000e('0x61')],{'as':_0x000e('0x163'),'foreignKey':_0x000e('0x184')});db[_0x000e('0x69')][_0x000e('0x11a')](db[_0x000e('0x13')],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0x000e('0x69')]['belongsToMany'](db['Team'],{'through':_0x000e('0x18e'),'as':_0x000e('0x14c')});db[_0x000e('0x6b')][_0x000e('0x10a')](db[_0x000e('0xcd')],{'as':_0x000e('0x15b'),'foreignKey':_0x000e('0x18f'),'onDelete':_0x000e('0x108')});db[_0x000e('0x6b')][_0x000e('0x11a')](db[_0x000e('0x13')],{'as':'Members','through':_0x000e('0x11c')});db[_0x000e('0x6c')][_0x000e('0x117')](db[_0x000e('0x61')],{'as':_0x000e('0x18a'),'foreignKey':'ChatWebsiteId'});db[_0x000e('0x190')][_0x000e('0x10a')](db[_0x000e('0x6e')],{'as':_0x000e('0x11d'),'foreignKey':_0x000e('0x191')});db[_0x000e('0x6e')]['hasMany'](db[_0x000e('0x13f')],{'as':_0x000e('0x140'),'foreignKey':'ContactId'});db[_0x000e('0x6e')]['hasMany'](db[_0x000e('0x73')],{'as':_0x000e('0x10c'),'foreignKey':_0x000e('0x156')});db['CmContact']['hasMany'](db[_0x000e('0x74')],{'as':'HopperHistories','foreignKey':_0x000e('0x156')});db[_0x000e('0x6e')][_0x000e('0x10a')](db[_0x000e('0x76')],{'as':_0x000e('0x76'),'foreignKey':_0x000e('0x156')});db['CmContact'][_0x000e('0x10a')](db[_0x000e('0xd0')],{'as':_0x000e('0x143'),'foreignKey':'ContactId'});db['CmContact']['hasMany'](db['OpenchannelInteraction'],{'as':_0x000e('0x10e'),'foreignKey':_0x000e('0x156'),'onDelete':_0x000e('0x16d')});db[_0x000e('0x6e')][_0x000e('0x10a')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0x000e('0x10a')](db[_0x000e('0x53')],{'as':_0x000e('0x110'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x000e('0x6e')][_0x000e('0x10a')](db[_0x000e('0x111')],{'as':_0x000e('0x112'),'foreignKey':_0x000e('0x156'),'onDelete':'restrict'});db[_0x000e('0x6e')][_0x000e('0x10a')](db[_0x000e('0x113')],{'as':_0x000e('0x114'),'foreignKey':_0x000e('0x156'),'onDelete':_0x000e('0x16d')});db[_0x000e('0x6e')]['belongsTo'](db[_0x000e('0x190')],{'as':'Company','foreignKey':_0x000e('0x191')});db['CmContact'][_0x000e('0x117')](db[_0x000e('0xf4')],{'as':'List','foreignKey':_0x000e('0x15f'),'onDelete':'cascade'});db[_0x000e('0x6e')]['belongsToMany'](db[_0x000e('0x13')],{'as':_0x000e('0x168'),'through':_0x000e('0x11e')});db[_0x000e('0x6e')][_0x000e('0x11a')](db[_0x000e('0x88')],{'as':_0x000e('0x165'),'through':_0x000e('0x192')});db[_0x000e('0x6e')][_0x000e('0x11a')](db[_0x000e('0x88')],{'through':_0x000e('0x192'),'as':_0x000e('0x167')});db[_0x000e('0x13f')][_0x000e('0x117')](db[_0x000e('0x6e')],{'as':_0x000e('0x155'),'foreignKey':_0x000e('0x156'),'onDelete':_0x000e('0x108')});db['CmHopper']['belongsTo'](db[_0x000e('0xf4')],{'as':_0x000e('0x15e'),'foreignKey':_0x000e('0x15f'),'onDelete':_0x000e('0x108')});db[_0x000e('0x13f')]['belongsTo'](db[_0x000e('0x13')],{'as':_0x000e('0x188'),'foreignKey':'UserId'});db['CmHopper'][_0x000e('0x117')](db['VoiceQueue'],{'as':_0x000e('0x189'),'foreignKey':_0x000e('0x13e'),'onDelete':_0x000e('0x108')});db[_0x000e('0x13f')]['belongsTo'](db[_0x000e('0x193')],{'as':'Campaign','foreignKey':_0x000e('0x194'),'onDelete':'cascade'});db[_0x000e('0x13f')]['belongsTo'](db[_0x000e('0x13')],{'as':_0x000e('0x164'),'foreignKey':_0x000e('0x195')});db['CmHopperBlack'][_0x000e('0x117')](db[_0x000e('0x6e')],{'as':_0x000e('0x155'),'foreignKey':_0x000e('0x156'),'onDelete':_0x000e('0x108')});db[_0x000e('0x71')]['belongsTo'](db[_0x000e('0xf4')],{'as':_0x000e('0x15e'),'foreignKey':_0x000e('0x15f'),'onDelete':_0x000e('0x108')});db[_0x000e('0x71')][_0x000e('0x117')](db['VoiceQueue'],{'as':_0x000e('0x189'),'foreignKey':_0x000e('0x13e'),'onDelete':_0x000e('0x108')});db[_0x000e('0x71')]['belongsTo'](db['Campaign'],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0x000e('0x108')});db[_0x000e('0x7b')][_0x000e('0x10a')](db[_0x000e('0x81')],{'as':{'plural':_0x000e('0x196'),'singular':_0x000e('0x197')},'foreignKey':_0x000e('0x198'),'onDelete':'cascade','hooks':!![]});db[_0x000e('0x7b')][_0x000e('0x10a')](db[_0x000e('0x81')],{'as':{'plural':_0x000e('0x199'),'singular':'OneAny'},'foreignKey':_0x000e('0x19a'),'onDelete':_0x000e('0x108'),'hooks':!![]});db['Automation'][_0x000e('0x10a')](db[_0x000e('0x79')],{'as':_0x000e('0x19b'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x000e('0x146')][_0x000e('0x10a')](db[_0x000e('0x146')],{'as':_0x000e('0x19c'),'foreignKey':_0x000e('0x16e'),'onDelete':_0x000e('0x108'),'hooks':!![],'required':![]});db[_0x000e('0x146')]['hasMany'](db[_0x000e('0x1a')],{'as':_0x000e('0x19d'),'foreignKey':'IntervalId','onDelete':_0x000e('0x16d')});db[_0x000e('0x146')]['hasMany'](db['MailApplication'],{'as':'MailApplications','foreignKey':'IntervalId'});db[_0x000e('0x146')]['hasMany'](db[_0x000e('0x186')],{'as':'ChatApplications','foreignKey':_0x000e('0x16e')});db[_0x000e('0x146')][_0x000e('0x10a')](db['FaxApplication'],{'as':_0x000e('0x19e'),'foreignKey':'IntervalId'});db[_0x000e('0x146')][_0x000e('0x10a')](db[_0x000e('0x51')],{'as':'SmsApplications','foreignKey':_0x000e('0x16e')});db[_0x000e('0x85')][_0x000e('0x117')](db[_0x000e('0x38')],{});db[_0x000e('0x85')][_0x000e('0x117')](db[_0x000e('0x94')],{'foreignKey':_0x000e('0x19f')});db[_0x000e('0x85')]['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':'CustomReportId'});db[_0x000e('0x86')][_0x000e('0x11a')](db[_0x000e('0x13b')],{'as':'Mohs','through':_0x000e('0x13d'),'onDelete':'restrict'});db[_0x000e('0x88')][_0x000e('0x11a')](db['CmContact'],{'through':_0x000e('0x192')});db['Tag']['belongsToMany'](db[_0x000e('0x65')],{'through':_0x000e('0x18c')});db[_0x000e('0x88')][_0x000e('0x11a')](db['MailInteraction'],{'through':_0x000e('0x166')});db[_0x000e('0x88')][_0x000e('0x11a')](db[_0x000e('0x53')],{'through':_0x000e('0x17e')});db[_0x000e('0x88')][_0x000e('0x11a')](db[_0x000e('0x111')],{'through':'fax_interaction_has_tags'});db[_0x000e('0x88')][_0x000e('0x11a')](db['OpenchannelInteraction'],{'through':_0x000e('0x183')});db[_0x000e('0x88')][_0x000e('0x11a')](db[_0x000e('0xfe')],{'through':'whatsapp_interaction_has_tags'});db[_0x000e('0x8c')][_0x000e('0x10a')](db['Condition'],{'as':{'plural':'AllConditions','singular':_0x000e('0x1a0')},'foreignKey':'TriggerAllId','onDelete':'cascade','hooks':!![]});db['Trigger']['hasMany'](db[_0x000e('0x81')],{'as':{'plural':_0x000e('0x1a1'),'singular':_0x000e('0x1a2')},'foreignKey':_0x000e('0x1a3'),'onDelete':_0x000e('0x108'),'hooks':!![]});db[_0x000e('0x8c')][_0x000e('0x10a')](db[_0x000e('0x79')],{'as':'Actions','foreignKey':_0x000e('0x1a4'),'onDelete':_0x000e('0x108'),'hooks':!![]});db[_0x000e('0x92')]['hasMany'](db[_0x000e('0x9a')],{'as':_0x000e('0x1a5'),'onDelete':_0x000e('0x108'),'foreignKey':_0x000e('0x1a6'),'hooks':!![]});db[_0x000e('0x94')][_0x000e('0x10a')](db[_0x000e('0x9a')],{'as':_0x000e('0x1a5'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x000e('0x98')][_0x000e('0x10a')](db[_0x000e('0x9a')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x000e('0x1a7')});db[_0x000e('0x9a')]['belongsTo'](db[_0x000e('0x98')],{'foreignKey':_0x000e('0x1a7')});db['SalesforceAccount']['hasMany'](db[_0x000e('0x9f')],{'as':_0x000e('0x1a8'),'onDelete':'cascade','foreignKey':_0x000e('0x1a9')});db[_0x000e('0x9f')]['hasMany'](db[_0x000e('0xa0')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x000e('0x1aa')});db['SalesforceConfiguration']['hasMany'](db[_0x000e('0xa0')],{'as':_0x000e('0x1ab'),'onDelete':_0x000e('0x108'),'foreignKey':_0x000e('0x1ac')});db[_0x000e('0x9f')]['hasMany'](db['SalesforceField'],{'as':'Fields','onDelete':_0x000e('0x108'),'foreignKey':_0x000e('0x1ad')});db[_0x000e('0x9f')]['belongsTo'](db[_0x000e('0x9d')],{'as':_0x000e('0x163'),'foreignKey':_0x000e('0x1a9')});db[_0x000e('0xa0')][_0x000e('0x10a')](db[_0x000e('0xa0')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x000e('0xa0')]['hasMany'](db[_0x000e('0xa0')],{'as':'Description','foreignKey':_0x000e('0x1ac')});db['SalesforceField']['hasMany'](db[_0x000e('0xa0')],{'as':'Field','foreignKey':_0x000e('0x1ad')});db[_0x000e('0xa0')][_0x000e('0x117')](db[_0x000e('0x8e')],{'as':_0x000e('0x8e'),'foreignKey':_0x000e('0x1ae')});db[_0x000e('0x1af')][_0x000e('0x10a')](db[_0x000e('0xa2')],{'as':_0x000e('0x1a8'),'onDelete':_0x000e('0x108'),'foreignKey':_0x000e('0x1a9')});db[_0x000e('0xa2')][_0x000e('0x10a')](db[_0x000e('0xa4')],{'as':_0x000e('0x1b0'),'onDelete':'cascade','foreignKey':_0x000e('0x1aa')});db['SugarcrmConfiguration'][_0x000e('0x10a')](db[_0x000e('0xa4')],{'as':_0x000e('0x1ab'),'onDelete':_0x000e('0x108'),'foreignKey':_0x000e('0x1ac')});db[_0x000e('0xa2')][_0x000e('0x10a')](db[_0x000e('0xa4')],{'as':_0x000e('0x1a5'),'onDelete':_0x000e('0x108'),'foreignKey':_0x000e('0x1ad')});db['SugarcrmConfiguration'][_0x000e('0x117')](db[_0x000e('0x1af')],{'as':_0x000e('0x163'),'foreignKey':_0x000e('0x1a9')});db[_0x000e('0xa4')][_0x000e('0x10a')](db['SugarcrmField'],{'as':_0x000e('0x1b1'),'foreignKey':'SubjectId'});db['SugarcrmField']['hasMany'](db[_0x000e('0xa4')],{'as':_0x000e('0x1b2'),'foreignKey':_0x000e('0x1ac')});db[_0x000e('0xa4')][_0x000e('0x10a')](db[_0x000e('0xa4')],{'as':'Field','foreignKey':_0x000e('0x1ad')});db[_0x000e('0xa4')][_0x000e('0x117')](db[_0x000e('0x8e')],{'as':_0x000e('0x8e'),'foreignKey':_0x000e('0x1ae')});db[_0x000e('0xa6')]['hasMany'](db[_0x000e('0xa8')],{'as':_0x000e('0x1a8'),'onDelete':_0x000e('0x108'),'foreignKey':_0x000e('0x1a9')});db[_0x000e('0xa8')][_0x000e('0x10a')](db['DeskField'],{'as':_0x000e('0x1b0'),'onDelete':_0x000e('0x108'),'foreignKey':'SubjectId'});db['DeskConfiguration'][_0x000e('0x10a')](db[_0x000e('0xa9')],{'as':_0x000e('0x1ab'),'onDelete':_0x000e('0x108'),'foreignKey':_0x000e('0x1ac')});db[_0x000e('0xa8')][_0x000e('0x10a')](db[_0x000e('0xa9')],{'as':_0x000e('0x1a5'),'onDelete':'cascade','foreignKey':_0x000e('0x1ad')});db[_0x000e('0xa8')][_0x000e('0x117')](db['DeskAccount'],{'as':_0x000e('0x163'),'foreignKey':_0x000e('0x1a9')});db['DeskConfiguration'][_0x000e('0x11a')](db['Tag'],{'through':_0x000e('0x1b3')});db[_0x000e('0xa9')][_0x000e('0x10a')](db[_0x000e('0xa9')],{'as':_0x000e('0x1b1'),'foreignKey':_0x000e('0x1aa')});db[_0x000e('0xa9')][_0x000e('0x10a')](db[_0x000e('0xa9')],{'as':_0x000e('0x1b2'),'foreignKey':_0x000e('0x1ac')});db['DeskField'][_0x000e('0x10a')](db[_0x000e('0xa9')],{'as':_0x000e('0x1b4'),'foreignKey':'FieldId'});db[_0x000e('0xa9')][_0x000e('0x117')](db[_0x000e('0x8e')],{'as':_0x000e('0x8e'),'foreignKey':_0x000e('0x1ae')});db[_0x000e('0xab')]['hasMany'](db[_0x000e('0xad')],{'as':_0x000e('0x1a8'),'onDelete':_0x000e('0x108'),'foreignKey':_0x000e('0x1a9')});db[_0x000e('0xad')][_0x000e('0x10a')](db[_0x000e('0xaf')],{'as':_0x000e('0x1b0'),'onDelete':'cascade','foreignKey':_0x000e('0x1aa')});db[_0x000e('0xad')][_0x000e('0x10a')](db['ZohoField'],{'as':'Descriptions','onDelete':_0x000e('0x108'),'foreignKey':_0x000e('0x1ac')});db[_0x000e('0xad')]['hasMany'](db[_0x000e('0xaf')],{'as':_0x000e('0x1a5'),'onDelete':_0x000e('0x108'),'foreignKey':_0x000e('0x1ad')});db[_0x000e('0xad')][_0x000e('0x117')](db[_0x000e('0xab')],{'as':_0x000e('0x163'),'foreignKey':_0x000e('0x1a9')});db[_0x000e('0xaf')]['hasMany'](db[_0x000e('0xaf')],{'as':'Subject','foreignKey':_0x000e('0x1aa')});db[_0x000e('0xaf')][_0x000e('0x10a')](db[_0x000e('0xaf')],{'as':_0x000e('0x1b2'),'foreignKey':_0x000e('0x1ac')});db['ZohoField'][_0x000e('0x10a')](db[_0x000e('0xaf')],{'as':_0x000e('0x1b4'),'foreignKey':_0x000e('0x1ad')});db[_0x000e('0xaf')][_0x000e('0x117')](db[_0x000e('0x8e')],{'as':_0x000e('0x8e'),'foreignKey':_0x000e('0x1ae')});db[_0x000e('0x1b5')]['hasMany'](db[_0x000e('0x1b6')],{'as':_0x000e('0x1a8'),'onDelete':_0x000e('0x108'),'foreignKey':'AccountId'});db[_0x000e('0x1b6')][_0x000e('0x10a')](db[_0x000e('0xb2')],{'as':_0x000e('0x1b0'),'foreignKey':'SubjectId'});db[_0x000e('0x1b6')]['hasMany'](db[_0x000e('0xb2')],{'as':_0x000e('0x1ab'),'foreignKey':_0x000e('0x1ac')});db[_0x000e('0x1b6')][_0x000e('0x10a')](db[_0x000e('0xb2')],{'as':_0x000e('0x1a5'),'foreignKey':_0x000e('0x1ad')});db[_0x000e('0x1b6')][_0x000e('0x117')](db[_0x000e('0x1b5')],{'as':'Account','foreignKey':'AccountId'});db[_0x000e('0x1b6')][_0x000e('0x11a')](db[_0x000e('0x88')],{'through':'int_zendesk_configuration_has_tags'});db[_0x000e('0xb2')][_0x000e('0x10a')](db[_0x000e('0xb2')],{'as':_0x000e('0x1b1'),'foreignKey':_0x000e('0x1aa')});db[_0x000e('0xb2')][_0x000e('0x10a')](db[_0x000e('0xb2')],{'as':_0x000e('0x1b2'),'foreignKey':_0x000e('0x1ac')});db[_0x000e('0xb2')][_0x000e('0x10a')](db['ZendeskField'],{'as':'Field','foreignKey':_0x000e('0x1ad')});db[_0x000e('0xb2')][_0x000e('0x117')](db['Variable'],{'as':'Variable','foreignKey':_0x000e('0x1ae')});db['FreshdeskAccount'][_0x000e('0x10a')](db[_0x000e('0xb5')],{'as':_0x000e('0x1a8'),'onDelete':'cascade','foreignKey':_0x000e('0x1a9')});db['FreshdeskConfiguration'][_0x000e('0x10a')](db[_0x000e('0xb7')],{'as':_0x000e('0x1b0'),'onDelete':_0x000e('0x108'),'foreignKey':_0x000e('0x1aa')});db[_0x000e('0xb5')][_0x000e('0x10a')](db[_0x000e('0xb7')],{'as':'Descriptions','onDelete':_0x000e('0x108'),'foreignKey':'DescriptionId'});db['FreshdeskConfiguration'][_0x000e('0x10a')](db['FreshdeskField'],{'as':_0x000e('0x1a5'),'onDelete':_0x000e('0x108'),'foreignKey':_0x000e('0x1ad')});db[_0x000e('0xb5')][_0x000e('0x117')](db[_0x000e('0x1b7')],{'as':_0x000e('0x163'),'foreignKey':'AccountId'});db[_0x000e('0xb5')][_0x000e('0x11a')](db['Tag'],{'through':_0x000e('0x1b8')});db[_0x000e('0xb7')][_0x000e('0x10a')](db[_0x000e('0xb7')],{'as':_0x000e('0x1b1'),'foreignKey':_0x000e('0x1aa')});db[_0x000e('0xb7')]['hasMany'](db[_0x000e('0xb7')],{'as':_0x000e('0x1b2'),'foreignKey':_0x000e('0x1ac')});db['FreshdeskField']['hasMany'](db[_0x000e('0xb7')],{'as':_0x000e('0x1b4'),'foreignKey':_0x000e('0x1ad')});db[_0x000e('0xb7')][_0x000e('0x117')](db[_0x000e('0x8e')],{'as':_0x000e('0x8e'),'foreignKey':_0x000e('0x1ae')});db[_0x000e('0x1b9')]['hasMany'](db[_0x000e('0x1ba')],{'as':_0x000e('0x1a8'),'onDelete':_0x000e('0x108'),'foreignKey':_0x000e('0x1a9')});db[_0x000e('0x1ba')]['hasMany'](db[_0x000e('0xba')],{'as':'Subjects','foreignKey':_0x000e('0x1aa')});db[_0x000e('0x1ba')][_0x000e('0x10a')](db['VtigerField'],{'as':_0x000e('0x1ab'),'foreignKey':_0x000e('0x1ac')});db[_0x000e('0x1ba')][_0x000e('0x10a')](db[_0x000e('0xba')],{'as':_0x000e('0x1a5'),'foreignKey':_0x000e('0x1ad')});db['VtigerConfiguration']['belongsTo'](db['VtigerAccount'],{'as':_0x000e('0x163'),'foreignKey':'AccountId'});db[_0x000e('0xba')]['hasMany'](db[_0x000e('0xba')],{'as':'Subject','foreignKey':_0x000e('0x1aa')});db[_0x000e('0xba')][_0x000e('0x10a')](db[_0x000e('0xba')],{'as':_0x000e('0x1b2'),'foreignKey':_0x000e('0x1ac')});db['VtigerField'][_0x000e('0x10a')](db[_0x000e('0xba')],{'as':_0x000e('0x1b4'),'foreignKey':'FieldId'});db[_0x000e('0xba')]['belongsTo'](db['Variable'],{'as':_0x000e('0x8e'),'foreignKey':_0x000e('0x1ae')});db[_0x000e('0xbc')][_0x000e('0x10a')](db[_0x000e('0xbe')],{'as':_0x000e('0x1a8'),'onDelete':_0x000e('0x108'),'foreignKey':_0x000e('0x1a9')});db[_0x000e('0xbe')][_0x000e('0x10a')](db[_0x000e('0xc0')],{'as':_0x000e('0x1b0'),'foreignKey':_0x000e('0x1aa')});db[_0x000e('0xbe')][_0x000e('0x10a')](db[_0x000e('0xc0')],{'as':_0x000e('0x1ab'),'foreignKey':_0x000e('0x1ac')});db['ServicenowConfiguration'][_0x000e('0x10a')](db[_0x000e('0xc0')],{'as':'Fields','foreignKey':_0x000e('0x1ad')});db[_0x000e('0xbe')][_0x000e('0x117')](db['ServicenowAccount'],{'as':_0x000e('0x163'),'foreignKey':_0x000e('0x1a9')});db[_0x000e('0xc0')][_0x000e('0x10a')](db[_0x000e('0xc0')],{'as':_0x000e('0x1b1'),'foreignKey':'SubjectId'});db[_0x000e('0xc0')][_0x000e('0x10a')](db[_0x000e('0xc0')],{'as':_0x000e('0x1b2'),'foreignKey':_0x000e('0x1ac')});db[_0x000e('0xc0')]['hasMany'](db[_0x000e('0xc0')],{'as':_0x000e('0x1b4'),'foreignKey':_0x000e('0x1ad')});db[_0x000e('0xc0')][_0x000e('0x117')](db[_0x000e('0x8e')],{'as':_0x000e('0x8e'),'foreignKey':_0x000e('0x1ae')});db['Dynamics365Account'][_0x000e('0x10a')](db[_0x000e('0xc2')],{'as':_0x000e('0x1a8'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x000e('0xc2')][_0x000e('0x10a')](db['Dynamics365Field'],{'as':_0x000e('0x1b0'),'onDelete':_0x000e('0x108'),'foreignKey':_0x000e('0x1aa')});db[_0x000e('0xc2')][_0x000e('0x10a')](db[_0x000e('0x1bb')],{'as':_0x000e('0x1ab'),'onDelete':_0x000e('0x108'),'foreignKey':_0x000e('0x1ac')});db[_0x000e('0xc2')][_0x000e('0x10a')](db[_0x000e('0x1bb')],{'as':'Fields','onDelete':_0x000e('0x108'),'foreignKey':_0x000e('0x1ad')});db[_0x000e('0xc2')]['belongsTo'](db['Dynamics365Account'],{'as':_0x000e('0x163'),'foreignKey':_0x000e('0x1a9')});db['Dynamics365Field'][_0x000e('0x10a')](db[_0x000e('0x1bb')],{'as':_0x000e('0x1b1'),'foreignKey':_0x000e('0x1aa')});db[_0x000e('0x1bb')]['hasMany'](db[_0x000e('0x1bb')],{'as':_0x000e('0x1b2'),'foreignKey':_0x000e('0x1ac')});db['Dynamics365Field'][_0x000e('0x10a')](db[_0x000e('0x1bb')],{'as':_0x000e('0x1b4'),'foreignKey':'FieldId'});db[_0x000e('0x1bb')][_0x000e('0x117')](db[_0x000e('0x8e')],{'as':_0x000e('0x8e'),'foreignKey':_0x000e('0x1ae')});db['FreshsalesAccount'][_0x000e('0x10a')](db[_0x000e('0xc6')],{'as':_0x000e('0x1a8'),'onDelete':_0x000e('0x108'),'foreignKey':_0x000e('0x1a9')});db[_0x000e('0xc6')][_0x000e('0x10a')](db[_0x000e('0xc7')],{'as':_0x000e('0x1b0'),'foreignKey':_0x000e('0x1aa')});db['FreshsalesConfiguration'][_0x000e('0x10a')](db[_0x000e('0xc7')],{'as':_0x000e('0x1ab'),'foreignKey':'DescriptionId'});db[_0x000e('0xc6')][_0x000e('0x10a')](db['FreshsalesField'],{'as':'Fields','foreignKey':_0x000e('0x1ad')});db['FreshsalesConfiguration']['belongsTo'](db[_0x000e('0x1bc')],{'as':_0x000e('0x163'),'foreignKey':'AccountId'});db[_0x000e('0xc7')][_0x000e('0x10a')](db[_0x000e('0xc7')],{'as':_0x000e('0x1b1'),'foreignKey':'SubjectId'});db[_0x000e('0xc7')]['hasMany'](db['FreshsalesField'],{'as':_0x000e('0x1b2'),'foreignKey':_0x000e('0x1ac')});db[_0x000e('0xc7')][_0x000e('0x10a')](db['FreshsalesField'],{'as':_0x000e('0x1b4'),'foreignKey':_0x000e('0x1ad')});db[_0x000e('0xc7')][_0x000e('0x117')](db[_0x000e('0x8e')],{'as':'Variable','foreignKey':_0x000e('0x1ae')});db[_0x000e('0x1bd')][_0x000e('0x117')](db[_0x000e('0x61')],{});db[_0x000e('0x1bd')]['belongsTo'](db[_0x000e('0xf4')],{'as':_0x000e('0x15e'),'foreignKey':_0x000e('0x15f')});db[_0x000e('0x1bd')]['belongsTo'](db[_0x000e('0x6e')],{'as':_0x000e('0x155'),'foreignKey':_0x000e('0x156')});db['ChatQueueReport'][_0x000e('0x117')](db[_0x000e('0x65')],{});db[_0x000e('0x1bd')][_0x000e('0x117')](db[_0x000e('0x66')],{});db[_0x000e('0x1bd')][_0x000e('0x117')](db[_0x000e('0x13')],{});db['ChatQueueReport']['belongsTo'](db[_0x000e('0x69')],{});db[_0x000e('0xcd')][_0x000e('0x117')](db[_0x000e('0x13')],{'onDelete':_0x000e('0x108'),'foreignKey':_0x000e('0x1be')});db[_0x000e('0xcd')][_0x000e('0x117')](db[_0x000e('0x13')],{'onDelete':_0x000e('0x108'),'foreignKey':'ToId'});db[_0x000e('0xd0')][_0x000e('0x10a')](db[_0x000e('0x1bf')],{'foreignKey':_0x000e('0x1c0'),'onDelete':_0x000e('0x108')});db['JscriptySessionReport'][_0x000e('0x10a')](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':_0x000e('0x108')});db[_0x000e('0xd2')][_0x000e('0x117')](db['SmsAccount'],{});db[_0x000e('0xd2')][_0x000e('0x117')](db['CmList'],{'as':_0x000e('0x15e'),'foreignKey':_0x000e('0x15f')});db[_0x000e('0xd2')][_0x000e('0x117')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x000e('0xd2')][_0x000e('0x117')](db[_0x000e('0x53')],{});db[_0x000e('0xd2')][_0x000e('0x117')](db[_0x000e('0x17c')],{});db[_0x000e('0xd2')][_0x000e('0x117')](db[_0x000e('0x13')],{});db[_0x000e('0xd2')][_0x000e('0x117')](db[_0x000e('0x129')],{});db[_0x000e('0xd8')][_0x000e('0x10a')](db[_0x000e('0xd0')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x000e('0x10a')](db[_0x000e('0x1bf')],{'foreignKey':'ProjectId'});db[_0x000e('0xd8')][_0x000e('0x10a')](db[_0x000e('0x1c1')],{'foreignKey':_0x000e('0x1c2')});db[_0x000e('0xdd')]['belongsToMany'](db[_0x000e('0x13')],{'as':_0x000e('0x168'),'through':'user_has_square_projects'});db[_0x000e('0x11f')][_0x000e('0x11a')](db['User'],{'as':_0x000e('0x14b'),'through':'user_has_teams'});db[_0x000e('0x11f')][_0x000e('0x11a')](db[_0x000e('0x1c')],{'through':_0x000e('0x14d'),'as':_0x000e('0x125')});db[_0x000e('0x11f')][_0x000e('0x11a')](db[_0x000e('0x3a')],{'through':_0x000e('0x1c3'),'as':_0x000e('0x127')});db[_0x000e('0x11f')][_0x000e('0x11a')](db[_0x000e('0x69')],{'through':'team_has_chat_queues','as':_0x000e('0x128')});db[_0x000e('0x11f')][_0x000e('0x11a')](db[_0x000e('0x4b')],{'through':_0x000e('0x17a'),'as':_0x000e('0x1c4')});db[_0x000e('0x11f')][_0x000e('0x11a')](db['SmsQueue'],{'through':_0x000e('0x180'),'as':'SmsQueues'});db[_0x000e('0x11f')][_0x000e('0x11a')](db[_0x000e('0x5f')],{'through':_0x000e('0x1c5'),'as':'OpenchannelQueues'});db[_0x000e('0x11f')][_0x000e('0x11a')](db[_0x000e('0x103')],{'through':_0x000e('0x1c6'),'as':_0x000e('0x1c7')});db[_0x000e('0x193')][_0x000e('0x10a')](db[_0x000e('0x13f')],{'as':_0x000e('0x140'),'foreignKey':_0x000e('0x194')});db['Campaign'][_0x000e('0x10a')](db[_0x000e('0x73')],{'as':_0x000e('0x10c'),'foreignKey':_0x000e('0x194')});db['Campaign'][_0x000e('0x10a')](db[_0x000e('0x74')],{'as':'HopperHistories','foreignKey':_0x000e('0x194')});db[_0x000e('0x193')][_0x000e('0x10a')](db[_0x000e('0x71')],{'as':_0x000e('0x142'),'foreignKey':_0x000e('0x194')});db['Campaign']['belongsTo'](db[_0x000e('0x144')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x000e('0x193')][_0x000e('0x117')](db[_0x000e('0x144')],{'as':_0x000e('0x1c8'),'foreignKey':'TrunkBackupId'});db[_0x000e('0x193')][_0x000e('0x117')](db['Interval'],{'as':'Interval','foreignKey':_0x000e('0x16e')});db['Campaign']['belongsTo'](db[_0x000e('0xdd')],{'as':_0x000e('0xdd'),'foreignKey':_0x000e('0x1c9')});db['Campaign'][_0x000e('0x11a')](db[_0x000e('0xf4')],{'as':_0x000e('0x149'),'through':'campaigns_has_cm_lists'});db[_0x000e('0x193')][_0x000e('0x11a')](db['CmList'],{'as':'BlackLists','through':_0x000e('0x1ca')});db[_0x000e('0xeb')][_0x000e('0x117')](db[_0x000e('0x3f')],{});db[_0x000e('0xeb')][_0x000e('0x117')](db[_0x000e('0x113')],{});db[_0x000e('0xeb')][_0x000e('0x117')](db['MailAccount'],{'foreignKey':_0x000e('0x1cb'),'as':_0x000e('0x1cc')});db[_0x000e('0xeb')][_0x000e('0x117')](db['User'],{'foreignKey':_0x000e('0x1cd'),'as':_0x000e('0x1ce')});db[_0x000e('0xeb')][_0x000e('0x117')](db[_0x000e('0x13')],{'foreignKey':'ToUserId','as':_0x000e('0x1cf')});db[_0x000e('0xeb')][_0x000e('0x117')](db[_0x000e('0x3a')],{'foreignKey':_0x000e('0x1d0'),'as':_0x000e('0x1d1')});db[_0x000e('0xeb')][_0x000e('0x117')](db[_0x000e('0x38')],{'foreignKey':_0x000e('0x1d2'),'as':_0x000e('0x1d3')});db[_0x000e('0xed')][_0x000e('0x117')](db[_0x000e('0x66')],{});db[_0x000e('0xed')][_0x000e('0x117')](db['ChatInteraction'],{});db[_0x000e('0xed')]['belongsTo'](db[_0x000e('0x61')],{'foreignKey':_0x000e('0x1d4'),'as':_0x000e('0x1cc')});db['ChatTransferReport'][_0x000e('0x117')](db['User'],{'foreignKey':'FromUserId','as':_0x000e('0x1ce')});db['ChatTransferReport'][_0x000e('0x117')](db['User'],{'foreignKey':'ToUserId','as':_0x000e('0x1cf')});db[_0x000e('0xed')][_0x000e('0x117')](db['ChatQueue'],{'foreignKey':_0x000e('0x1d5'),'as':_0x000e('0x1d1')});db['ChatTransferReport'][_0x000e('0x117')](db['ChatWebsite'],{'foreignKey':_0x000e('0x1d6'),'as':_0x000e('0x1d3')});db[_0x000e('0x1d7')]['belongsTo'](db[_0x000e('0x49')],{});db[_0x000e('0x1d7')][_0x000e('0x117')](db['FaxInteraction'],{});db[_0x000e('0x1d7')][_0x000e('0x117')](db[_0x000e('0x46')],{'foreignKey':_0x000e('0x1d8'),'as':_0x000e('0x1cc')});db[_0x000e('0x1d7')][_0x000e('0x117')](db[_0x000e('0x13')],{'foreignKey':'FromUserId','as':_0x000e('0x1ce')});db[_0x000e('0x1d7')][_0x000e('0x117')](db[_0x000e('0x13')],{'foreignKey':_0x000e('0x1d9'),'as':'ToAgent'});db[_0x000e('0x1d7')][_0x000e('0x117')](db[_0x000e('0x4b')],{'foreignKey':_0x000e('0x1da'),'as':_0x000e('0x1d1')});db[_0x000e('0x1d7')][_0x000e('0x117')](db[_0x000e('0x46')],{'foreignKey':'ToFaxAccountId','as':_0x000e('0x1d3')});db[_0x000e('0xf0')][_0x000e('0x117')](db[_0x000e('0x5d')],{});db[_0x000e('0xf0')][_0x000e('0x117')](db[_0x000e('0x5b')],{});db[_0x000e('0xf0')][_0x000e('0x117')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x000e('0x1cc')});db[_0x000e('0xf0')][_0x000e('0x117')](db[_0x000e('0x13')],{'foreignKey':_0x000e('0x1cd'),'as':_0x000e('0x1ce')});db[_0x000e('0xf0')][_0x000e('0x117')](db[_0x000e('0x13')],{'foreignKey':'ToUserId','as':_0x000e('0x1cf')});db[_0x000e('0xf0')][_0x000e('0x117')](db[_0x000e('0x5f')],{'foreignKey':_0x000e('0x1db'),'as':_0x000e('0x1d1')});db['OpenchannelTransferReport'][_0x000e('0x117')](db[_0x000e('0x57')],{'foreignKey':'ToOpenchannelAccountId','as':_0x000e('0x1d3')});db[_0x000e('0xf2')][_0x000e('0x117')](db[_0x000e('0x17c')],{});db[_0x000e('0xf2')]['belongsTo'](db['SmsInteraction'],{});db['SmsTransferReport'][_0x000e('0x117')](db[_0x000e('0x4f')],{'foreignKey':'FromSmsAccountId','as':_0x000e('0x1cc')});db[_0x000e('0xf2')][_0x000e('0x117')](db[_0x000e('0x13')],{'foreignKey':_0x000e('0x1cd'),'as':_0x000e('0x1ce')});db[_0x000e('0xf2')]['belongsTo'](db[_0x000e('0x13')],{'foreignKey':_0x000e('0x1d9'),'as':_0x000e('0x1cf')});db[_0x000e('0xf2')][_0x000e('0x117')](db[_0x000e('0x129')],{'foreignKey':'ToSmsQueueId','as':_0x000e('0x1d1')});db[_0x000e('0xf2')][_0x000e('0x117')](db['SmsAccount'],{'foreignKey':_0x000e('0x1dc'),'as':_0x000e('0x1d3')});db[_0x000e('0xf4')]['hasMany'](db['Disposition'],{'as':_0x000e('0x15a'),'foreignKey':_0x000e('0x15f')});db[_0x000e('0xf4')][_0x000e('0x10a')](db[_0x000e('0x78')],{'as':_0x000e('0x1dd'),'foreignKey':'ListId'});db[_0x000e('0xf4')]['hasMany'](db['CmContact'],{'as':_0x000e('0x11d'),'onDelete':_0x000e('0x108'),'foreignKey':_0x000e('0x15f')});db['CmList'][_0x000e('0x10a')](db[_0x000e('0x73')],{'as':_0x000e('0x10c'),'foreignKey':_0x000e('0x15f')});db['CmList'][_0x000e('0x10a')](db[_0x000e('0x74')],{'as':_0x000e('0x10d'),'foreignKey':'ListId'});db[_0x000e('0xf4')][_0x000e('0x10a')](db[_0x000e('0x76')],{'as':_0x000e('0x76'),'foreignKey':'ListId'});db[_0x000e('0xf4')][_0x000e('0x11a')](db[_0x000e('0x1c')],{'as':_0x000e('0x1de'),'through':_0x000e('0x14a')});db['CmList']['belongsToMany'](db['User'],{'as':_0x000e('0x14b'),'through':_0x000e('0x12b')});db['VoicePrefix']['hasMany'](db[_0x000e('0x1a')],{'as':_0x000e('0x19d'),'onDelete':_0x000e('0x108')});db[_0x000e('0xf5')][_0x000e('0x11a')](db[_0x000e('0x13')],{'as':'Agents','through':_0x000e('0x12d')});db[_0x000e('0x118')][_0x000e('0x10a')](db[_0x000e('0x13')],{'as':_0x000e('0x168'),'foreignKey':_0x000e('0x119')});db[_0x000e('0x118')][_0x000e('0x10a')](db[_0x000e('0xf7')],{'as':_0x000e('0x1df'),'foreignKey':_0x000e('0x119'),'onDelete':_0x000e('0x108')});db[_0x000e('0xf7')][_0x000e('0x10a')](db[_0x000e('0xf9')],{'as':'Resources','foreignKey':_0x000e('0x1e0'),'onDelete':_0x000e('0x108')});db[_0x000e('0xfc')]['hasMany'](db[_0x000e('0x7f')],{'as':_0x000e('0x15a'),'foreignKey':_0x000e('0x1e1')});db[_0x000e('0xfc')][_0x000e('0x10a')](db[_0x000e('0x7d')],{'as':_0x000e('0x172'),'foreignKey':'WhatsappAccountId'});db[_0x000e('0xfc')][_0x000e('0x10a')](db[_0x000e('0x1e2')],{'as':'Messages','foreignKey':'WhatsappAccountId'});db[_0x000e('0xfc')][_0x000e('0x10a')](db[_0x000e('0xfe')],{'as':_0x000e('0x15c')});db[_0x000e('0xfc')][_0x000e('0x10a')](db[_0x000e('0xfd')],{'as':_0x000e('0x15d')});db[_0x000e('0xfc')][_0x000e('0x117')](db[_0x000e('0xf4')],{'as':_0x000e('0x15e'),'foreignKey':_0x000e('0x15f')});db[_0x000e('0xfc')][_0x000e('0x117')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x000e('0xfc')][_0x000e('0x11a')](db['User'],{'as':_0x000e('0x14b'),'through':_0x000e('0x136')});db[_0x000e('0xfd')][_0x000e('0x117')](db[_0x000e('0x13')],{'onDelete':'restrict'});db['WhatsappApplication']['belongsTo'](db[_0x000e('0x103')],{'onDelete':_0x000e('0x16d')});db[_0x000e('0xfd')]['belongsTo'](db[_0x000e('0xfc')],{'onDelete':_0x000e('0x16d')});db[_0x000e('0xfd')][_0x000e('0x117')](db[_0x000e('0x146')],{'onDelete':_0x000e('0x16d'),'foreignKey':_0x000e('0x16e')});db['WhatsappApplication']['belongsTo'](db[_0x000e('0x88')],{'onDelete':_0x000e('0x16d'),'foreignKey':'TagId'});db[_0x000e('0xfe')][_0x000e('0x10a')](db[_0x000e('0x1e2')],{'as':'Messages','onDelete':_0x000e('0x108'),'foreignKey':_0x000e('0x1e3')});db[_0x000e('0xfe')][_0x000e('0x117')](db[_0x000e('0xfc')],{'as':_0x000e('0x163'),'foreignKey':_0x000e('0x1e1')});db[_0x000e('0xfe')][_0x000e('0x117')](db['CmContact'],{'as':_0x000e('0x155'),'foreignKey':_0x000e('0x156')});db['WhatsappInteraction'][_0x000e('0x117')](db[_0x000e('0x13')],{'as':'Owner','foreignKey':_0x000e('0x109')});db[_0x000e('0xfe')][_0x000e('0x11a')](db[_0x000e('0x88')],{'through':_0x000e('0x1e4'),'as':_0x000e('0x165')});db[_0x000e('0xfe')][_0x000e('0x11a')](db[_0x000e('0x88')],{'through':_0x000e('0x1e4'),'as':_0x000e('0x167')});db[_0x000e('0xfe')][_0x000e('0x11a')](db[_0x000e('0x13')],{'as':_0x000e('0x168'),'through':_0x000e('0x124'),'foreignKey':_0x000e('0x1e3')});db[_0x000e('0x1e2')][_0x000e('0x117')](db[_0x000e('0x13')],{'as':_0x000e('0x13')});db['WhatsappMessage']['belongsTo'](db[_0x000e('0x6e')],{'onDelete':_0x000e('0x108'),'as':'Contact'});db[_0x000e('0x1e2')][_0x000e('0x117')](db['WhatsappInteraction'],{'onDelete':_0x000e('0x108'),'as':_0x000e('0x16b'),'foreignKey':_0x000e('0x1e3')});db[_0x000e('0x1e2')][_0x000e('0x117')](db['WhatsappAccount'],{'as':_0x000e('0x163'),'foreignKey':_0x000e('0x1e1')});db[_0x000e('0x1e5')][_0x000e('0x117')](db['WhatsappAccount'],{});db['WhatsappQueueReport'][_0x000e('0x117')](db[_0x000e('0xf4')],{'as':'List','foreignKey':_0x000e('0x15f')});db[_0x000e('0x1e5')][_0x000e('0x117')](db[_0x000e('0x6e')],{'as':'Contact','foreignKey':'ContactId'});db[_0x000e('0x1e5')][_0x000e('0x117')](db[_0x000e('0xfe')],{});db[_0x000e('0x1e5')]['belongsTo'](db['WhatsappQueue'],{});db[_0x000e('0x1e5')][_0x000e('0x117')](db[_0x000e('0x1e2')],{});db[_0x000e('0x1e5')]['belongsTo'](db['User'],{});db[_0x000e('0x101')][_0x000e('0x117')](db[_0x000e('0x1e2')],{});db['WhatsappTransferReport'][_0x000e('0x117')](db[_0x000e('0xfe')],{});db['WhatsappTransferReport'][_0x000e('0x117')](db[_0x000e('0xfc')],{'foreignKey':_0x000e('0x1e6'),'as':_0x000e('0x1cc')});db[_0x000e('0x101')][_0x000e('0x117')](db[_0x000e('0xfc')],{'foreignKey':_0x000e('0x1e7'),'as':_0x000e('0x1d3')});db[_0x000e('0x101')][_0x000e('0x117')](db[_0x000e('0x103')],{'foreignKey':_0x000e('0x1e8'),'as':_0x000e('0x1d1')});db['WhatsappTransferReport'][_0x000e('0x117')](db['User'],{'foreignKey':_0x000e('0x1cd'),'as':_0x000e('0x1ce')});db['WhatsappTransferReport'][_0x000e('0x117')](db[_0x000e('0x13')],{'foreignKey':'ToUserId','as':_0x000e('0x1cf')});db[_0x000e('0x103')][_0x000e('0x11a')](db[_0x000e('0x13')],{'as':_0x000e('0x14b'),'through':'UserWhatsappQueue','foreignKey':_0x000e('0x1e9')});db[_0x000e('0x103')][_0x000e('0x11a')](db['Team'],{'through':_0x000e('0x1c6'),'as':_0x000e('0x14c')});module[_0x000e('0x1ea')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index d00d8c9..a791f46 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5394=['./api/smsInteraction','/api/sms/messages','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/interactions','/api/chat/messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/proactive_actions','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','/api/templates','/api/triggers','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./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/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowField','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/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/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','./api/campaign','/api/attachments','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','1.0.16','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','path','express-winston','./errors','./config/environment','api','./config/logger','auth','default','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','connection','remoteAddress','url','statusCode','user','name','role','device','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)','x-forwarded-for','other','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions'];(function(_0x328470,_0x215663){var _0x62c82b=function(_0x5daf7f){while(--_0x5daf7f){_0x328470['push'](_0x328470['shift']());}};_0x62c82b(++_0x215663);}(_0x5394,0xc5));var _0x4539=function(_0x3871d7,_0x3cfcc5){_0x3871d7=_0x3871d7-0x0;var _0x28ec09=_0x5394[_0x3871d7];return _0x28ec09;};'use strict';var path=require(_0x4539('0x0'));var express=require('express');var ewinston=require(_0x4539('0x1'));var util=require('util');var errors=require(_0x4539('0x2'));var config=require(_0x4539('0x3'));var logger=require('./config/logger')(_0x4539('0x4'));var authLogger=require(_0x4539('0x5'))(_0x4539('0x6'));exports[_0x4539('0x7')]=function(_0x5922eb){_0x5922eb[_0x4539('0x8')](ewinston[_0x4539('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x48fb99,_0x57379a){return util[_0x4539('0xa')](_0x4539('0xb'),_0x48fb99[_0x4539('0xc')],_0x48fb99[_0x4539('0xd')]['x-forwarded-for']?_0x48fb99[_0x4539('0xd')]['x-forwarded-for']:_0x48fb99[_0x4539('0xe')][_0x4539('0xf')]||_0x48fb99['ip'],_0x48fb99[_0x4539('0x10')],_0x57379a[_0x4539('0x11')],_0x57379a['responseTime'],_0x48fb99[_0x4539('0x12')]?_0x48fb99[_0x4539('0x12')]['id']:null,_0x48fb99[_0x4539('0x12')]?_0x48fb99[_0x4539('0x12')][_0x4539('0x13')]:null,_0x48fb99[_0x4539('0x12')]?_0x48fb99['user'][_0x4539('0x14')]:null);}}));_0x5922eb['use'](ewinston[_0x4539('0x9')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x4bdeaf,_0x5c315b){var _0x462885='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x4bdeaf['body']&&_0x4bdeaf['body'][_0x4539('0x15')]&&_0x4bdeaf[_0x4539('0x16')][_0x4539('0x17')]){_0x462885=_0x4539('0x18');}return util['format'](_0x462885,_0x4bdeaf['method'],_0x4bdeaf[_0x4539('0xd')][_0x4539('0x19')]?_0x4bdeaf[_0x4539('0xd')][_0x4539('0x19')]:_0x4bdeaf[_0x4539('0xe')][_0x4539('0xf')]||_0x4bdeaf['ip'],_0x4bdeaf[_0x4539('0x10')],_0x5c315b[_0x4539('0x11')],_0x5c315b['responseTime'],_0x4bdeaf['user']?_0x4bdeaf[_0x4539('0x12')]['id']:null,_0x4bdeaf['user']?_0x4bdeaf['user']['name']:null,_0x4bdeaf[_0x4539('0x12')]?_0x4bdeaf['user']['role']:null,_0x4bdeaf['body']&&_0x4bdeaf[_0x4539('0x16')][_0x4539('0x15')]?_0x4bdeaf[_0x4539('0x16')][_0x4539('0x15')]:_0x4539('0x1a'),_0x4bdeaf[_0x4539('0x16')]&&_0x4bdeaf[_0x4539('0x16')][_0x4539('0x17')]?_0x4bdeaf[_0x4539('0x16')][_0x4539('0x17')]:'',_0x4bdeaf['body']&&_0x4bdeaf['body']['agent_name']?_0x4bdeaf[_0x4539('0x16')]['agent_name']:'');},'ignoreRoute':function(_0x4ffd4d){var _0x508790=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x508790[_0x4539('0x1b')](_0x4ffd4d[_0x4539('0x10')]);}}));_0x5922eb[_0x4539('0x8')](_0x4539('0x1c'),require(_0x4539('0x1d')));_0x5922eb[_0x4539('0x8')](_0x4539('0x1e'),require(_0x4539('0x1f')));_0x5922eb[_0x4539('0x8')](_0x4539('0x20'),require(_0x4539('0x21')));_0x5922eb[_0x4539('0x8')]('/api/voice/extensions',require(_0x4539('0x22')));_0x5922eb[_0x4539('0x8')](_0x4539('0x23'),require('./api/voiceMusicOnHold'));_0x5922eb[_0x4539('0x8')]('/api/voice/queues',require(_0x4539('0x24')));_0x5922eb[_0x4539('0x8')](_0x4539('0x25'),require(_0x4539('0x26')));_0x5922eb[_0x4539('0x8')](_0x4539('0x27'),require(_0x4539('0x28')));_0x5922eb[_0x4539('0x8')](_0x4539('0x29'),require('./api/voiceMail'));_0x5922eb[_0x4539('0x8')](_0x4539('0x2a'),require(_0x4539('0x2b')));_0x5922eb[_0x4539('0x8')](_0x4539('0x2c'),require(_0x4539('0x2d')));_0x5922eb['use']('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x5922eb[_0x4539('0x8')](_0x4539('0x2e'),require(_0x4539('0x2f')));_0x5922eb[_0x4539('0x8')](_0x4539('0x30'),require(_0x4539('0x31')));_0x5922eb[_0x4539('0x8')](_0x4539('0x32'),require(_0x4539('0x33')));_0x5922eb[_0x4539('0x8')](_0x4539('0x34'),require('./api/trunk'));_0x5922eb[_0x4539('0x8')](_0x4539('0x35'),require('./api/voiceTransferReport'));_0x5922eb[_0x4539('0x8')](_0x4539('0x36'),require(_0x4539('0x37')));_0x5922eb[_0x4539('0x8')]('/api/mail/accounts',require(_0x4539('0x38')));_0x5922eb[_0x4539('0x8')](_0x4539('0x39'),require('./api/mailQueue'));_0x5922eb['use'](_0x4539('0x3a'),require(_0x4539('0x3b')));_0x5922eb[_0x4539('0x8')]('/api/mail/interactions',require(_0x4539('0x3c')));_0x5922eb['use'](_0x4539('0x3d'),require('./api/mailMessage'));_0x5922eb[_0x4539('0x8')]('/api/mail/applications',require(_0x4539('0x3e')));_0x5922eb[_0x4539('0x8')](_0x4539('0x3f'),require(_0x4539('0x40')));_0x5922eb[_0x4539('0x8')](_0x4539('0x41'),require(_0x4539('0x42')));_0x5922eb[_0x4539('0x8')]('/api/dashboards/items',require(_0x4539('0x43')));_0x5922eb[_0x4539('0x8')](_0x4539('0x44'),require(_0x4539('0x45')));_0x5922eb[_0x4539('0x8')](_0x4539('0x46'),require(_0x4539('0x47')));_0x5922eb[_0x4539('0x8')](_0x4539('0x48'),require('./api/faxInteraction'));_0x5922eb[_0x4539('0x8')]('/api/fax/messages',require(_0x4539('0x49')));_0x5922eb[_0x4539('0x8')](_0x4539('0x4a'),require(_0x4539('0x4b')));_0x5922eb[_0x4539('0x8')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x5922eb[_0x4539('0x8')]('/api/sms/accounts',require(_0x4539('0x4c')));_0x5922eb[_0x4539('0x8')](_0x4539('0x4d'),require(_0x4539('0x4e')));_0x5922eb[_0x4539('0x8')](_0x4539('0x4f'),require(_0x4539('0x50')));_0x5922eb[_0x4539('0x8')](_0x4539('0x51'),require('./api/smsMessage'));_0x5922eb[_0x4539('0x8')](_0x4539('0x52'),require('./api/smsQueue'));_0x5922eb['use'](_0x4539('0x53'),require(_0x4539('0x54')));_0x5922eb[_0x4539('0x8')](_0x4539('0x55'),require('./api/openchannelApplication'));_0x5922eb[_0x4539('0x8')](_0x4539('0x56'),require(_0x4539('0x57')));_0x5922eb[_0x4539('0x8')](_0x4539('0x58'),require('./api/openchannelMessage'));_0x5922eb['use'](_0x4539('0x59'),require(_0x4539('0x5a')));_0x5922eb[_0x4539('0x8')](_0x4539('0x5b'),require(_0x4539('0x5c')));_0x5922eb[_0x4539('0x8')](_0x4539('0x5d'),require('./api/openchannelQueueReport'));_0x5922eb[_0x4539('0x8')]('/api/chat/applications',require('./api/chatApplication'));_0x5922eb[_0x4539('0x8')](_0x4539('0x5e'),require('./api/chatInteraction'));_0x5922eb[_0x4539('0x8')](_0x4539('0x5f'),require('./api/chatMessage'));_0x5922eb[_0x4539('0x8')]('/api/chat/offline_messages',require(_0x4539('0x60')));_0x5922eb[_0x4539('0x8')](_0x4539('0x61'),require(_0x4539('0x62')));_0x5922eb[_0x4539('0x8')]('/api/chat/groups',require('./api/chatGroup'));_0x5922eb[_0x4539('0x8')](_0x4539('0x63'),require('./api/chatProactiveAction'));_0x5922eb[_0x4539('0x8')]('/api/cm/companies',require(_0x4539('0x64')));_0x5922eb['use'](_0x4539('0x65'),require(_0x4539('0x66')));_0x5922eb[_0x4539('0x8')](_0x4539('0x67'),require('./api/cmHopper'));_0x5922eb[_0x4539('0x8')](_0x4539('0x68'),require('./api/cmHopperBlack'));_0x5922eb[_0x4539('0x8')]('/api/cm/hopper_final',require(_0x4539('0x69')));_0x5922eb[_0x4539('0x8')](_0x4539('0x6a'),require(_0x4539('0x6b')));_0x5922eb['use'](_0x4539('0x6c'),require(_0x4539('0x6d')));_0x5922eb[_0x4539('0x8')]('/api/actions',require(_0x4539('0x6e')));_0x5922eb[_0x4539('0x8')]('/api/automations',require(_0x4539('0x6f')));_0x5922eb[_0x4539('0x8')](_0x4539('0x70'),require(_0x4539('0x71')));_0x5922eb[_0x4539('0x8')]('/api/dispositions',require(_0x4539('0x72')));_0x5922eb['use'](_0x4539('0x73'),require(_0x4539('0x74')));_0x5922eb[_0x4539('0x8')]('/api/intervals',require(_0x4539('0x75')));_0x5922eb[_0x4539('0x8')](_0x4539('0x76'),require(_0x4539('0x77')));_0x5922eb[_0x4539('0x8')]('/api/cdr',require(_0x4539('0x78')));_0x5922eb[_0x4539('0x8')](_0x4539('0x79'),require(_0x4539('0x7a')));_0x5922eb[_0x4539('0x8')](_0x4539('0x7b'),require(_0x4539('0x7c')));_0x5922eb['use'](_0x4539('0x7d'),require(_0x4539('0x7e')));_0x5922eb[_0x4539('0x8')]('/api/tags',require(_0x4539('0x7f')));_0x5922eb[_0x4539('0x8')](_0x4539('0x80'),require('./api/template'));_0x5922eb['use'](_0x4539('0x81'),require('./api/trigger'));_0x5922eb[_0x4539('0x8')]('/api/variables',require(_0x4539('0x82')));_0x5922eb[_0x4539('0x8')](_0x4539('0x83'),require(_0x4539('0x84')));_0x5922eb[_0x4539('0x8')](_0x4539('0x85'),require(_0x4539('0x86')));_0x5922eb[_0x4539('0x8')](_0x4539('0x87'),require(_0x4539('0x88')));_0x5922eb['use'](_0x4539('0x89'),require(_0x4539('0x8a')));_0x5922eb[_0x4539('0x8')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x5922eb[_0x4539('0x8')]('/api/analytics/metrics',require(_0x4539('0x8b')));_0x5922eb[_0x4539('0x8')](_0x4539('0x8c'),require(_0x4539('0x8d')));_0x5922eb[_0x4539('0x8')](_0x4539('0x8e'),require(_0x4539('0x8f')));_0x5922eb[_0x4539('0x8')]('/api/integrations/salesforce/accounts',require(_0x4539('0x90')));_0x5922eb[_0x4539('0x8')](_0x4539('0x91'),require('./api/intSalesforceConfiguration'));_0x5922eb['use']('/api/integrations/salesforce/fields',require(_0x4539('0x92')));_0x5922eb['use'](_0x4539('0x93'),require('./api/intSugarcrmAccount'));_0x5922eb[_0x4539('0x8')]('/api/integrations/sugarcrm/configurations',require(_0x4539('0x94')));_0x5922eb[_0x4539('0x8')](_0x4539('0x95'),require(_0x4539('0x96')));_0x5922eb['use']('/api/integrations/desk/accounts',require(_0x4539('0x97')));_0x5922eb[_0x4539('0x8')](_0x4539('0x98'),require(_0x4539('0x99')));_0x5922eb[_0x4539('0x8')](_0x4539('0x9a'),require(_0x4539('0x9b')));_0x5922eb[_0x4539('0x8')](_0x4539('0x9c'),require('./api/intZohoAccount'));_0x5922eb[_0x4539('0x8')](_0x4539('0x9d'),require(_0x4539('0x9e')));_0x5922eb[_0x4539('0x8')](_0x4539('0x9f'),require(_0x4539('0xa0')));_0x5922eb[_0x4539('0x8')]('/api/integrations/zendesk/accounts',require(_0x4539('0xa1')));_0x5922eb['use'](_0x4539('0xa2'),require('./api/intZendeskConfiguration'));_0x5922eb[_0x4539('0x8')]('/api/integrations/zendesk/fields',require(_0x4539('0xa3')));_0x5922eb[_0x4539('0x8')](_0x4539('0xa4'),require(_0x4539('0xa5')));_0x5922eb[_0x4539('0x8')](_0x4539('0xa6'),require(_0x4539('0xa7')));_0x5922eb['use'](_0x4539('0xa8'),require(_0x4539('0xa9')));_0x5922eb[_0x4539('0x8')](_0x4539('0xaa'),require(_0x4539('0xab')));_0x5922eb[_0x4539('0x8')](_0x4539('0xac'),require(_0x4539('0xad')));_0x5922eb[_0x4539('0x8')](_0x4539('0xae'),require(_0x4539('0xaf')));_0x5922eb[_0x4539('0x8')](_0x4539('0xb0'),require(_0x4539('0xb1')));_0x5922eb['use'](_0x4539('0xb2'),require('./api/intServicenowConfiguration'));_0x5922eb['use']('/api/integrations/servicenow/fields',require(_0x4539('0xb3')));_0x5922eb[_0x4539('0x8')]('/api/integrations/dynamics365/accounts',require(_0x4539('0xb4')));_0x5922eb[_0x4539('0x8')]('/api/integrations/dynamics365/configurations',require(_0x4539('0xb5')));_0x5922eb[_0x4539('0x8')](_0x4539('0xb6'),require('./api/intDynamics365Field'));_0x5922eb[_0x4539('0x8')](_0x4539('0xb7'),require(_0x4539('0xb8')));_0x5922eb[_0x4539('0x8')](_0x4539('0xb9'),require(_0x4539('0xba')));_0x5922eb[_0x4539('0x8')](_0x4539('0xbb'),require('./api/intFreshsalesField'));_0x5922eb[_0x4539('0x8')](_0x4539('0xbc'),require(_0x4539('0xbd')));_0x5922eb[_0x4539('0x8')](_0x4539('0xbe'),require(_0x4539('0xbf')));_0x5922eb['use'](_0x4539('0xc0'),require(_0x4539('0xc1')));_0x5922eb['use']('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x5922eb[_0x4539('0x8')]('/api/jscripty/questions/reports',require(_0x4539('0xc2')));_0x5922eb[_0x4539('0x8')](_0x4539('0xc3'),require('./api/jscriptySessionReport'));_0x5922eb['use'](_0x4539('0xc4'),require(_0x4539('0xc5')));_0x5922eb['use'](_0x4539('0xc6'),require(_0x4539('0xc7')));_0x5922eb[_0x4539('0x8')](_0x4539('0xc8'),require(_0x4539('0xc9')));_0x5922eb[_0x4539('0x8')](_0x4539('0xca'),require(_0x4539('0xcb')));_0x5922eb[_0x4539('0x8')](_0x4539('0xcc'),require(_0x4539('0xcd')));_0x5922eb[_0x4539('0x8')](_0x4539('0xce'),require(_0x4539('0xcf')));_0x5922eb[_0x4539('0x8')](_0x4539('0xd0'),require(_0x4539('0xd1')));_0x5922eb[_0x4539('0x8')]('/api/square/recordings',require(_0x4539('0xd2')));_0x5922eb['use'](_0x4539('0xd3'),require(_0x4539('0xd4')));_0x5922eb[_0x4539('0x8')](_0x4539('0xd5'),require(_0x4539('0xd6')));_0x5922eb[_0x4539('0x8')]('/api/license',require(_0x4539('0xd7')));_0x5922eb[_0x4539('0x8')](_0x4539('0xd8'),require(_0x4539('0xd9')));_0x5922eb[_0x4539('0x8')]('/api/migrations',require('./api/migration'));_0x5922eb['use'](_0x4539('0xda'),require('./api/attachment'));_0x5922eb[_0x4539('0x8')](_0x4539('0xdb'),require(_0x4539('0xdc')));_0x5922eb[_0x4539('0x8')]('/api/mail/reports/transfer',require(_0x4539('0xdd')));_0x5922eb[_0x4539('0x8')](_0x4539('0xde'),require(_0x4539('0xdf')));_0x5922eb['use'](_0x4539('0xe0'),require(_0x4539('0xe1')));_0x5922eb[_0x4539('0x8')](_0x4539('0xe2'),require(_0x4539('0xe3')));_0x5922eb[_0x4539('0x8')]('/api/sms/reports/transfer',require(_0x4539('0xe4')));_0x5922eb['use']('/api/cm/lists',require(_0x4539('0xe5')));_0x5922eb['use'](_0x4539('0xe6'),require('./api/voicePrefix'));_0x5922eb[_0x4539('0x8')]('/api/userProfiles',require(_0x4539('0xe7')));_0x5922eb[_0x4539('0x8')](_0x4539('0xe8'),require(_0x4539('0xe9')));_0x5922eb[_0x4539('0x8')](_0x4539('0xea'),require(_0x4539('0xeb')));_0x5922eb[_0x4539('0x8')](_0x4539('0xec'),require(_0x4539('0xed')));_0x5922eb[_0x4539('0x8')](_0x4539('0xee'),require(_0x4539('0xef')));_0x5922eb[_0x4539('0x8')]('/api/whatsapp/applications',require(_0x4539('0xf0')));_0x5922eb[_0x4539('0x8')]('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x5922eb[_0x4539('0x8')](_0x4539('0xf1'),require(_0x4539('0xf2')));_0x5922eb[_0x4539('0x8')]('/api/whatsapp/reports/queue',require(_0x4539('0xf3')));_0x5922eb[_0x4539('0x8')]('/api/whatsapp/reports/transfer',require(_0x4539('0xf4')));_0x5922eb['use'](_0x4539('0xf5'),require('./api/whatsappQueue'));_0x5922eb['use'](_0x4539('0xf6'),require(_0x4539('0xf7')));_0x5922eb[_0x4539('0x8')]('/api/auth/local',require(_0x4539('0xf8')));_0x5922eb[_0x4539('0x8')](_0x4539('0xf9'),require(_0x4539('0xfa')));_0x5922eb[_0x4539('0x8')](_0x4539('0xfb'),require(_0x4539('0xfc')));_0x5922eb[_0x4539('0x8')](_0x4539('0xfd'),require(_0x4539('0xfe')));_0x5922eb[_0x4539('0x8')]('/api/version',require(_0x4539('0xff')));_0x5922eb[_0x4539('0x8')](_0x4539('0x100'),require(_0x4539('0x101')));_0x5922eb[_0x4539('0x8')]('/api/pm2',require(_0x4539('0x102')));_0x5922eb[_0x4539('0x8')](_0x4539('0x103'),require(_0x4539('0x104')));_0x5922eb[_0x4539('0x8')](_0x4539('0x105'),express[_0x4539('0x106')](path[_0x4539('0x107')](config[_0x4539('0x108')],_0x4539('0x105'))));_0x5922eb[_0x4539('0x8')]('/www',express['static'](path[_0x4539('0x107')](config[_0x4539('0x108')],_0x4539('0x109'))));_0x5922eb[_0x4539('0x8')](_0x4539('0x10a'),express[_0x4539('0x106')](path[_0x4539('0x107')](config[_0x4539('0x108')],_0x4539('0x10a'))));_0x5922eb[_0x4539('0x8')](_0x4539('0x10b'),express[_0x4539('0x106')](path[_0x4539('0x107')](config[_0x4539('0x108')],_0x4539('0x10c'),_0x4539('0x10d'))));_0x5922eb[_0x4539('0x8')]('/plugins',express[_0x4539('0x106')](path[_0x4539('0x107')](config[_0x4539('0x108')],_0x4539('0x10e'))));_0x5922eb[_0x4539('0x10f')](_0x4539('0x110'))[_0x4539('0x111')](errors[0x194]);_0x5922eb['route']('/*')[_0x4539('0x111')](function(_0x21c0c9,_0x48ea75){_0x48ea75[_0x4539('0x112')](path['resolve'](_0x5922eb[_0x4539('0x111')](_0x4539('0x113'))+_0x4539('0x114')));});}; \ No newline at end of file +var _0xa366=['/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','./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/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','/api/settings','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/pm2','./api/pm2','/api/webbar','./api/webbar','static','join','root','/apidoc','/www','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','path','express-winston','util','./errors','./config/environment','./config/logger','auth','default','logger','format','headers','x-forwarded-for','connection','url','responseTime','user','name','role','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','remoteAddress','statusCode','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/recordings','/api/screen/recordings','./api/voiceMail','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./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/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','./api/cmContact','/api/cm/hopper','./api/cmHopperBlack','/api/cm/hopper_final'];(function(_0x5e6b72,_0x1c3770){var _0xf76b50=function(_0x4a888d){while(--_0x4a888d){_0x5e6b72['push'](_0x5e6b72['shift']());}};_0xf76b50(++_0x1c3770);}(_0xa366,0x1d4));var _0x6a36=function(_0x154eab,_0xefcfac){_0x154eab=_0x154eab-0x0;var _0x333582=_0xa366[_0x154eab];return _0x333582;};'use strict';var path=require(_0x6a36('0x0'));var express=require('express');var ewinston=require(_0x6a36('0x1'));var util=require(_0x6a36('0x2'));var errors=require(_0x6a36('0x3'));var config=require(_0x6a36('0x4'));var logger=require(_0x6a36('0x5'))('api');var authLogger=require(_0x6a36('0x5'))(_0x6a36('0x6'));exports[_0x6a36('0x7')]=function(_0x2bd49d){_0x2bd49d['use'](ewinston[_0x6a36('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x3468b4,_0x37597e){return util[_0x6a36('0x9')]('%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s',_0x3468b4['method'],_0x3468b4[_0x6a36('0xa')][_0x6a36('0xb')]?_0x3468b4[_0x6a36('0xa')][_0x6a36('0xb')]:_0x3468b4[_0x6a36('0xc')]['remoteAddress']||_0x3468b4['ip'],_0x3468b4[_0x6a36('0xd')],_0x37597e['statusCode'],_0x37597e[_0x6a36('0xe')],_0x3468b4[_0x6a36('0xf')]?_0x3468b4[_0x6a36('0xf')]['id']:null,_0x3468b4[_0x6a36('0xf')]?_0x3468b4[_0x6a36('0xf')][_0x6a36('0x10')]:null,_0x3468b4[_0x6a36('0xf')]?_0x3468b4[_0x6a36('0xf')][_0x6a36('0x11')]:null);}}));_0x2bd49d[_0x6a36('0x12')](ewinston[_0x6a36('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x2c9f1b,_0x323644){var _0x4e3b37=_0x6a36('0x13');if(_0x2c9f1b[_0x6a36('0x14')]&&_0x2c9f1b['body'][_0x6a36('0x15')]&&_0x2c9f1b['body'][_0x6a36('0x16')]){_0x4e3b37=_0x6a36('0x17');}return util[_0x6a36('0x9')](_0x4e3b37,_0x2c9f1b[_0x6a36('0x18')],_0x2c9f1b[_0x6a36('0xa')][_0x6a36('0xb')]?_0x2c9f1b['headers'][_0x6a36('0xb')]:_0x2c9f1b['connection'][_0x6a36('0x19')]||_0x2c9f1b['ip'],_0x2c9f1b['url'],_0x323644[_0x6a36('0x1a')],_0x323644[_0x6a36('0xe')],_0x2c9f1b[_0x6a36('0xf')]?_0x2c9f1b[_0x6a36('0xf')]['id']:null,_0x2c9f1b['user']?_0x2c9f1b[_0x6a36('0xf')][_0x6a36('0x10')]:null,_0x2c9f1b[_0x6a36('0xf')]?_0x2c9f1b[_0x6a36('0xf')]['role']:null,_0x2c9f1b[_0x6a36('0x14')]&&_0x2c9f1b[_0x6a36('0x14')][_0x6a36('0x15')]?_0x2c9f1b[_0x6a36('0x14')][_0x6a36('0x15')]:'other',_0x2c9f1b[_0x6a36('0x14')]&&_0x2c9f1b[_0x6a36('0x14')][_0x6a36('0x16')]?_0x2c9f1b['body']['agent_id']:'',_0x2c9f1b['body']&&_0x2c9f1b['body']['agent_name']?_0x2c9f1b[_0x6a36('0x14')][_0x6a36('0x1b')]:'');},'ignoreRoute':function(_0x47b49c){var _0x2d2f54=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2d2f54[_0x6a36('0x1c')](_0x47b49c[_0x6a36('0xd')]);}}));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x1d'),require(_0x6a36('0x1e')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x1f'),require(_0x6a36('0x20')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x21'),require('./api/voiceContext'));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x22'),require(_0x6a36('0x23')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x24'),require(_0x6a36('0x25')));_0x2bd49d[_0x6a36('0x12')]('/api/voice/queues',require('./api/voiceQueue'));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x26'),require('./api/voiceRecording'));_0x2bd49d['use'](_0x6a36('0x27'),require('./api/screenRecording'));_0x2bd49d[_0x6a36('0x12')]('/api/voice/mails',require(_0x6a36('0x28')));_0x2bd49d[_0x6a36('0x12')]('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x29'),require('./api/voiceCallReport'));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x2a'),require(_0x6a36('0x2b')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x2c'),require(_0x6a36('0x2d')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x2e'),require(_0x6a36('0x2f')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x30'),require('./api/memberReport'));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x31'),require(_0x6a36('0x32')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x33'),require('./api/voiceTransferReport'));_0x2bd49d['use'](_0x6a36('0x34'),require(_0x6a36('0x35')));_0x2bd49d['use'](_0x6a36('0x36'),require(_0x6a36('0x37')));_0x2bd49d['use'](_0x6a36('0x38'),require(_0x6a36('0x39')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x3a'),require(_0x6a36('0x3b')));_0x2bd49d[_0x6a36('0x12')]('/api/mail/interactions',require(_0x6a36('0x3c')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x3d'),require(_0x6a36('0x3e')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x3f'),require('./api/mailApplication'));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x40'),require(_0x6a36('0x41')));_0x2bd49d['use'](_0x6a36('0x42'),require(_0x6a36('0x43')));_0x2bd49d[_0x6a36('0x12')]('/api/dashboards/items',require(_0x6a36('0x44')));_0x2bd49d['use'](_0x6a36('0x45'),require('./api/faxAccount'));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x46'),require(_0x6a36('0x47')));_0x2bd49d['use']('/api/fax/interactions',require(_0x6a36('0x48')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x49'),require(_0x6a36('0x4a')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x4b'),require(_0x6a36('0x4c')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x4d'),require(_0x6a36('0x4e')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x4f'),require(_0x6a36('0x50')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x51'),require(_0x6a36('0x52')));_0x2bd49d[_0x6a36('0x12')]('/api/sms/interactions',require(_0x6a36('0x53')));_0x2bd49d['use'](_0x6a36('0x54'),require(_0x6a36('0x55')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x56'),require(_0x6a36('0x57')));_0x2bd49d['use'](_0x6a36('0x58'),require(_0x6a36('0x59')));_0x2bd49d['use'](_0x6a36('0x5a'),require(_0x6a36('0x5b')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x5c'),require(_0x6a36('0x5d')));_0x2bd49d['use'](_0x6a36('0x5e'),require(_0x6a36('0x5f')));_0x2bd49d['use']('/api/openchannel/queues',require('./api/openchannelQueue'));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x60'),require('./api/chatWebsite'));_0x2bd49d['use'](_0x6a36('0x61'),require(_0x6a36('0x62')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x63'),require(_0x6a36('0x64')));_0x2bd49d['use'](_0x6a36('0x65'),require('./api/chatInteraction'));_0x2bd49d['use'](_0x6a36('0x66'),require('./api/chatMessage'));_0x2bd49d[_0x6a36('0x12')]('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x2bd49d[_0x6a36('0x12')]('/api/chat/queues',require(_0x6a36('0x67')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x68'),require(_0x6a36('0x69')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x6a'),require(_0x6a36('0x6b')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x6c'),require(_0x6a36('0x6d')));_0x2bd49d[_0x6a36('0x12')]('/api/cm/contacts',require(_0x6a36('0x6e')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x6f'),require('./api/cmHopper'));_0x2bd49d[_0x6a36('0x12')]('/api/cm/hopper_black',require(_0x6a36('0x70')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x71'),require('./api/cmHopperFinal'));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x72'),require(_0x6a36('0x73')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x74'),require(_0x6a36('0x75')));_0x2bd49d['use']('/api/actions',require(_0x6a36('0x76')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x77'),require(_0x6a36('0x78')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x79'),require(_0x6a36('0x7a')));_0x2bd49d['use'](_0x6a36('0x7b'),require(_0x6a36('0x7c')));_0x2bd49d['use'](_0x6a36('0x7d'),require('./api/condition'));_0x2bd49d['use'](_0x6a36('0x7e'),require(_0x6a36('0x7f')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x80'),require(_0x6a36('0x81')));_0x2bd49d[_0x6a36('0x12')]('/api/cdr',require(_0x6a36('0x82')));_0x2bd49d[_0x6a36('0x12')]('/api/voiceQueuesLog',require(_0x6a36('0x83')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x84'),require('./api/schedule'));_0x2bd49d['use'](_0x6a36('0x85'),require(_0x6a36('0x86')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x87'),require(_0x6a36('0x88')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x89'),require(_0x6a36('0x8a')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x8b'),require('./api/trigger'));_0x2bd49d['use'](_0x6a36('0x8c'),require('./api/variable'));_0x2bd49d['use'](_0x6a36('0x8d'),require(_0x6a36('0x8e')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x8f'),require(_0x6a36('0x90')));_0x2bd49d[_0x6a36('0x12')]('/api/analytics/custom_reports',require(_0x6a36('0x91')));_0x2bd49d[_0x6a36('0x12')]('/api/analytics/default_reports',require(_0x6a36('0x92')));_0x2bd49d[_0x6a36('0x12')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x2bd49d['use'](_0x6a36('0x93'),require(_0x6a36('0x94')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x95'),require(_0x6a36('0x96')));_0x2bd49d['use'](_0x6a36('0x97'),require(_0x6a36('0x98')));_0x2bd49d['use']('/api/integrations/salesforce/accounts',require(_0x6a36('0x99')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x9a'),require('./api/intSalesforceConfiguration'));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x9b'),require(_0x6a36('0x9c')));_0x2bd49d[_0x6a36('0x12')]('/api/integrations/sugarcrm/accounts',require(_0x6a36('0x9d')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x9e'),require(_0x6a36('0x9f')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xa0'),require(_0x6a36('0xa1')));_0x2bd49d['use'](_0x6a36('0xa2'),require(_0x6a36('0xa3')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xa4'),require(_0x6a36('0xa5')));_0x2bd49d[_0x6a36('0x12')]('/api/integrations/desk/fields',require(_0x6a36('0xa6')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xa7'),require(_0x6a36('0xa8')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xa9'),require('./api/intZohoConfiguration'));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xaa'),require(_0x6a36('0xab')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xac'),require('./api/intZendeskAccount'));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xad'),require(_0x6a36('0xae')));_0x2bd49d[_0x6a36('0x12')]('/api/integrations/zendesk/fields',require(_0x6a36('0xaf')));_0x2bd49d[_0x6a36('0x12')]('/api/integrations/freshdesk/accounts',require(_0x6a36('0xb0')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xb1'),require(_0x6a36('0xb2')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xb3'),require(_0x6a36('0xb4')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xb5'),require(_0x6a36('0xb6')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xb7'),require(_0x6a36('0xb8')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xb9'),require(_0x6a36('0xba')));_0x2bd49d[_0x6a36('0x12')]('/api/integrations/servicenow/accounts',require(_0x6a36('0xbb')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xbc'),require(_0x6a36('0xbd')));_0x2bd49d[_0x6a36('0x12')]('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x2bd49d['use'](_0x6a36('0xbe'),require('./api/intDynamics365Account'));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xbf'),require('./api/intDynamics365Configuration'));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xc0'),require('./api/intDynamics365Field'));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xc1'),require(_0x6a36('0xc2')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xc3'),require(_0x6a36('0xc4')));_0x2bd49d['use'](_0x6a36('0xc5'),require(_0x6a36('0xc6')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xc7'),require(_0x6a36('0xc8')));_0x2bd49d[_0x6a36('0x12')]('/api/chat/reports/queue',require(_0x6a36('0xc9')));_0x2bd49d[_0x6a36('0x12')]('/api/chat/internal/messages',require(_0x6a36('0xca')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xcb'),require('./api/jscriptyAnswerReport'));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xcc'),require(_0x6a36('0xcd')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xce'),require('./api/jscriptySessionReport'));_0x2bd49d['use'](_0x6a36('0xcf'),require(_0x6a36('0xd0')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xd1'),require(_0x6a36('0xd2')));_0x2bd49d['use']('/api/square/details/reports',require(_0x6a36('0xd3')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xd4'),require('./api/jscriptyProject'));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xd5'),require('./api/setting'));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xd6'),require('./api/squareOdbc'));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xd7'),require(_0x6a36('0xd8')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xd9'),require(_0x6a36('0xda')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xdb'),require(_0x6a36('0xdc')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xdd'),require(_0x6a36('0xde')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xdf'),require(_0x6a36('0xe0')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xe1'),require(_0x6a36('0xe2')));_0x2bd49d[_0x6a36('0x12')]('/api/migrations',require(_0x6a36('0xe3')));_0x2bd49d['use'](_0x6a36('0xe4'),require(_0x6a36('0xe5')));_0x2bd49d['use'](_0x6a36('0xe6'),require(_0x6a36('0xe7')));_0x2bd49d[_0x6a36('0x12')]('/api/mail/reports/transfer',require(_0x6a36('0xe8')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xe9'),require(_0x6a36('0xea')));_0x2bd49d['use'](_0x6a36('0xeb'),require('./api/faxTransferReport'));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xec'),require(_0x6a36('0xed')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xee'),require('./api/smsTransferReport'));_0x2bd49d['use'](_0x6a36('0xef'),require(_0x6a36('0xf0')));_0x2bd49d['use'](_0x6a36('0xf1'),require('./api/voicePrefix'));_0x2bd49d['use']('/api/userProfiles',require(_0x6a36('0xf2')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xf3'),require(_0x6a36('0xf4')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xf5'),require(_0x6a36('0xf6')));_0x2bd49d['use'](_0x6a36('0xf7'),require(_0x6a36('0xf8')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xf9'),require(_0x6a36('0xfa')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0xfb'),require(_0x6a36('0xfc')));_0x2bd49d['use'](_0x6a36('0xfd'),require(_0x6a36('0xfe')));_0x2bd49d[_0x6a36('0x12')]('/api/whatsapp/messages',require(_0x6a36('0xff')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x100'),require(_0x6a36('0x101')));_0x2bd49d['use']('/api/whatsapp/reports/transfer',require(_0x6a36('0x102')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x103'),require(_0x6a36('0x104')));_0x2bd49d['use']('/api/cloudProviders',require(_0x6a36('0x105')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x106'),require(_0x6a36('0x107')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x108'),require(_0x6a36('0x109')));_0x2bd49d['use']('/api/jira',require(_0x6a36('0x10a')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x10b'),require(_0x6a36('0x10c')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x10d'),require(_0x6a36('0x10e')));_0x2bd49d['use']('/api/system',require('./api/system'));_0x2bd49d['use'](_0x6a36('0x10f'),require(_0x6a36('0x110')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x111'),require(_0x6a36('0x112')));_0x2bd49d['use']('/apidoc',express[_0x6a36('0x113')](path[_0x6a36('0x114')](config[_0x6a36('0x115')],_0x6a36('0x116'))));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x117'),express['static'](path[_0x6a36('0x114')](config[_0x6a36('0x115')],_0x6a36('0x117'))));_0x2bd49d['use'](_0x6a36('0x118'),express[_0x6a36('0x113')](path['join'](config[_0x6a36('0x115')],'/demo')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x119'),express[_0x6a36('0x113')](path[_0x6a36('0x114')](config[_0x6a36('0x115')],_0x6a36('0x11a'),'1.0.16')));_0x2bd49d[_0x6a36('0x12')](_0x6a36('0x11b'),express[_0x6a36('0x113')](path[_0x6a36('0x114')](config[_0x6a36('0x115')],_0x6a36('0x11c'))));_0x2bd49d[_0x6a36('0x11d')](_0x6a36('0x11e'))[_0x6a36('0x11f')](errors[0x194]);_0x2bd49d[_0x6a36('0x11d')]('/*')['get'](function(_0x2a6174,_0x3c7b43){_0x3c7b43[_0x6a36('0x120')](path[_0x6a36('0x121')](_0x2bd49d[_0x6a36('0x11f')]('appPath')+_0x6a36('0x122')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 3439b7d..217a2d7 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb2b=['../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','bluebird','lodash','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xdb2b,0x1bc));var _0xbdb2=function(_0x8c9741,_0x1362c8){_0x8c9741=_0x8c9741-0x0;var _0x580e3e=_0xdb2b[_0x8c9741];return _0x580e3e;};'use strict';var jayson=require(_0xbdb2('0x0'));var BPromise=require(_0xbdb2('0x1'));var _=require(_0xbdb2('0x2'));var config=require('../config/environment');exports[_0xbdb2('0x3')]=function(){return new BPromise(function(_0x1d05cd,_0x5cb95b){var _0x18fe99={};_0x18fe99=_['merge'](_0x18fe99,require(_0xbdb2('0x4')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x6')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require('../api/voiceQueue/voiceQueue.rpc'));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require('../api/voiceRecording/voiceRecording.rpc'));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x7')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x8')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x9')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0xa')));_0x18fe99=_['merge'](_0x18fe99,require(_0xbdb2('0xb')));_0x18fe99=_['merge'](_0x18fe99,require(_0xbdb2('0xc')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0xd')));_0x18fe99=_['merge'](_0x18fe99,require(_0xbdb2('0xe')));_0x18fe99=_['merge'](_0x18fe99,require(_0xbdb2('0xf')));_0x18fe99=_['merge'](_0x18fe99,require(_0xbdb2('0x10')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x11')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require('../api/mailInteraction/mailInteraction.rpc'));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x12')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x13')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x14')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x15')));_0x18fe99=_['merge'](_0x18fe99,require('../api/faxApplication/faxApplication.rpc'));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x16')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require('../api/faxMessage/faxMessage.rpc'));_0x18fe99=_['merge'](_0x18fe99,require(_0xbdb2('0x17')));_0x18fe99=_['merge'](_0x18fe99,require(_0xbdb2('0x18')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x19')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x1a')));_0x18fe99=_['merge'](_0x18fe99,require(_0xbdb2('0x1b')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x1c')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x1d')));_0x18fe99=_['merge'](_0x18fe99,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x1e')));_0x18fe99=_['merge'](_0x18fe99,require(_0xbdb2('0x1f')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x20')));_0x18fe99=_['merge'](_0x18fe99,require(_0xbdb2('0x21')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x22')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x23')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x24')));_0x18fe99=_['merge'](_0x18fe99,require(_0xbdb2('0x25')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x26')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x27')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x28')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x29')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x2a')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x2b')));_0x18fe99=_['merge'](_0x18fe99,require(_0xbdb2('0x2c')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x2d')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x2e')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require('../api/variable/variable.rpc'));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x2f')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x18fe99=_['merge'](_0x18fe99,require(_0xbdb2('0x30')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x18fe99=_['merge'](_0x18fe99,require(_0xbdb2('0x31')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x32')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x33')));_0x18fe99=_['merge'](_0x18fe99,require(_0xbdb2('0x34')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x35')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x36')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x37')));_0x18fe99=_['merge'](_0x18fe99,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x18fe99=_['merge'](_0x18fe99,require(_0xbdb2('0x38')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require('../api/squareProject/squareProject.rpc'));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require('../api/squareRecording/squareRecording.rpc'));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x39')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x3a')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require('../api/attachment/attachment.rpc'));_0x18fe99=_['merge'](_0x18fe99,require(_0xbdb2('0x3b')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require(_0xbdb2('0x3c')));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x18fe99=_[_0xbdb2('0x5')](_0x18fe99,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x18fe99=_['merge'](_0x18fe99,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x189ed2=jayson[_0xbdb2('0x3d')](_0x18fe99)[_0xbdb2('0x3e')]();var _0x43d938=config[_0xbdb2('0x3f')][_0xbdb2('0x40')]||config[_0xbdb2('0x40')]+0x1;var _0x698b6e=config[_0xbdb2('0x3f')]['ip']||_0xbdb2('0x41');_0x189ed2['on'](_0xbdb2('0x42'),function(_0x44ea8f){return _0x5cb95b(_0x44ea8f);});_0x189ed2[_0xbdb2('0x3')](_0x43d938,_0x698b6e,function(){console[_0xbdb2('0x43')](_0xbdb2('0x44'),_0x698b6e,_0x43d938);require(_0xbdb2('0x45'))[_0xbdb2('0x46')]();return _0x1d05cd('RPC\x20listening\x20on\x20'+_0x698b6e+':'+_0x43d938);});});}; \ No newline at end of file +var _0xabcd=['../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/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','rpc','port','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabcd,0x1d8));var _0xdabc=function(_0x25320e,_0x1f4ed3){_0x25320e=_0x25320e-0x0;var _0x44105d=_0xabcd[_0x25320e];return _0x44105d;};'use strict';var jayson=require(_0xdabc('0x0'));var BPromise=require(_0xdabc('0x1'));var _=require('lodash');var config=require(_0xdabc('0x2'));exports[_0xdabc('0x3')]=function(){return new BPromise(function(_0x4e5fcb,_0x3c0b71){var _0x26eb72={};_0x26eb72=_['merge'](_0x26eb72,require(_0xdabc('0x4')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x6')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require('../api/voiceQueue/voiceQueue.rpc'));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x7')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x8')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x9')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0xa')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0xb')));_0x26eb72=_['merge'](_0x26eb72,require('../api/memberReport/memberReport.rpc'));_0x26eb72=_['merge'](_0x26eb72,require(_0xdabc('0xc')));_0x26eb72=_['merge'](_0x26eb72,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0xd')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0xe')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require('../api/mailQueue/mailQueue.rpc'));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0xf')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x10')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x11')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x12')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require('../api/faxAccount/faxAccount.rpc'));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require('../api/faxApplication/faxApplication.rpc'));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x13')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x14')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x15')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x16')));_0x26eb72=_['merge'](_0x26eb72,require(_0xdabc('0x17')));_0x26eb72=_['merge'](_0x26eb72,require(_0xdabc('0x18')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require('../api/smsMessage/smsMessage.rpc'));_0x26eb72=_['merge'](_0x26eb72,require('../api/smsQueue/smsQueue.rpc'));_0x26eb72=_['merge'](_0x26eb72,require(_0xdabc('0x19')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x1a')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x1b')));_0x26eb72=_['merge'](_0x26eb72,require(_0xdabc('0x1c')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x1d')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x1e')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x1f')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require('../api/chatQueue/chatQueue.rpc'));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x20')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require('../api/cmHopper/cmHopper.rpc'));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x21')));_0x26eb72=_['merge'](_0x26eb72,require(_0xdabc('0x22')));_0x26eb72=_['merge'](_0x26eb72,require(_0xdabc('0x23')));_0x26eb72=_['merge'](_0x26eb72,require(_0xdabc('0x24')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x25')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x26')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x27')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x28')));_0x26eb72=_['merge'](_0x26eb72,require(_0xdabc('0x29')));_0x26eb72=_['merge'](_0x26eb72,require('../api/variable/variable.rpc'));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x2a')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x2b')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x2c')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x26eb72=_['merge'](_0x26eb72,require(_0xdabc('0x2d')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x2e')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x2f')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x30')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x31')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x32')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x33')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x34')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x35')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x36')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require('../api/campaign/campaign.rpc'));_0x26eb72=_['merge'](_0x26eb72,require(_0xdabc('0x37')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x38')));_0x26eb72=_['merge'](_0x26eb72,require(_0xdabc('0x39')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x3a')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x3b')));_0x26eb72=_['merge'](_0x26eb72,require(_0xdabc('0x3c')));_0x26eb72=_[_0xdabc('0x5')](_0x26eb72,require(_0xdabc('0x3d')));var _0x281369=jayson['server'](_0x26eb72)['http']();var _0x5e11d2=config[_0xdabc('0x3e')]['port']||config[_0xdabc('0x3f')]+0x1;var _0x6124f2=config[_0xdabc('0x3e')]['ip']||_0xdabc('0x40');_0x281369['on']('error',function(_0x362111){return _0x3c0b71(_0x362111);});_0x281369[_0xdabc('0x3')](_0x5e11d2,_0x6124f2,function(){console[_0xdabc('0x41')](_0xdabc('0x42'),_0x6124f2,_0x5e11d2);require(_0xdabc('0x43'))['default']();return _0x4e5fcb(_0xdabc('0x44')+_0x6124f2+':'+_0x5e11d2);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 8eb904a..f827145 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 _0xa9e0=['utf8','setTimeout','setEncoding','ready','line','toLowerCase','hangup','emit','520\x20End\x20of\x20proper','function','substring','replace','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','write','inherits','prototype','sendRequest','command','sync','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','label','exports','util','lodash','events','./error','call'];(function(_0x2bcda4,_0x946be){var _0x3b7bca=function(_0x5acf34){while(--_0x5acf34){_0x2bcda4['push'](_0x2bcda4['shift']());}};_0x3b7bca(++_0x946be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x0a9e('0x3'));function AGIChannel(_0x4ce2f1){var _0x333808=this,_0x432180=new AGIReply(),_0x2ab90b=![],_0x991246={};EventEmitter[_0x0a9e('0x4')](_0x333808);_0x4ce2f1['setEncoding'](_0x0a9e('0x5'));_0x4ce2f1[_0x0a9e('0x6')](0x8*0x3c*0x3c*0x3e8);_0x432180[_0x0a9e('0x7')]('utf8');_0x432180['on']('headers',function(_0xe42b77){for(var _0x56465b in _0xe42b77){_0x333808[_0x56465b]=_0xe42b77[_0x56465b];}_0x333808['emit'](_0x0a9e('0x8'));});_0x432180['on'](_0x0a9e('0x9'),function(_0x307b3e){if(_0x307b3e[_0x0a9e('0xa')]()==_0x0a9e('0xb')){_0x333808[_0x0a9e('0xc')]('hangup');return;}if(_0x307b3e['substring'](0x0,0xb)=='520-Invalid'){_0x2ab90b=!![];}if(_0x2ab90b){_0x991246['rx']+=_0x307b3e+'\x0a';if(_0x307b3e['search'](_0x0a9e('0xd'))!=-0x1){_0x2ab90b=![];}}else{_0x991246['rx']=_0x307b3e;}if(_0x2ab90b){return;}if(typeof _0x991246['cb']==_0x0a9e('0xe')){var _0xd5b662=_0x991246['rx'][_0x0a9e('0xf')](0x0,0x3),_0x26d672=null,_0x32d742=null;_0xd5b662=parseInt(_0xd5b662);if(isNaN(_0xd5b662)){_0x991246['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0xd5b662!=0xc8){_0x991246['cb'](null,{'code':_0xd5b662,'result':-0x1,'extra':'KO'});return;}_0x26d672=_0x991246['rx'][_0x0a9e('0xf')](0x4)[_0x0a9e('0x10')](_0x0a9e('0x11'),'');if(_0x26d672[_0x0a9e('0x12')]('\x20')!=-0x1){_0x26d672=_0x26d672[_0x0a9e('0x13')](0x0,_0x26d672[_0x0a9e('0x12')]('\x20'));}if(_['startsWith'](_0x26d672,'-1')){_0x26d672=parseInt(_0x26d672);}_0x32d742=_0x991246['rx'][_0x0a9e('0x14')]('\x20');if(_0x32d742['length']==0x3){_0x32d742=_0x32d742[0x2][_0x0a9e('0xf')](0x1,_0x32d742[0x2]['length']-0x1);}else if(_0x32d742[_0x0a9e('0x15')]>0x3){var _0x12066b=/\((.+)\)/;var _0x48f32d=_0x991246['rx'][_0x0a9e('0x16')](_0x12066b);if(_0x48f32d){_0x32d742=_0x48f32d[0x1];}else{_0x32d742=null;}}else{_0x32d742=null;}_0x991246['cb'](null,{'code':_0xd5b662,'result':_0x26d672,'extra':_0x32d742});}});_0x4ce2f1['on']('error',function(_0x459eb1){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x17'),new AGIError(_0x0a9e('0x18'),_0x459eb1[_0x0a9e('0x19')]));});_0x4ce2f1['on'](_0x0a9e('0x1a'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1a'),new AGIError(_0x0a9e('0x1b')));});_0x4ce2f1['on'](_0x0a9e('0x1c'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x4ce2f1[_0x0a9e('0x1d')]();});_0x4ce2f1[_0x0a9e('0x1e')](_0x432180);this['command']=function(_0x20f109,_0x5a09ef){var _0x20f109=_0x20f109||'',_0x5a09ef=typeof _0x5a09ef==_0x0a9e('0xe')?_0x5a09ef:new Function();_0x991246={'tx':_0x20f109,'rx':'','cb':_0x5a09ef};_0x4ce2f1[_0x0a9e('0x1f')](_0x20f109+'\x0a');},this[_0x0a9e('0x1a')]=function(){_0x4ce2f1['destroy']();};}util[_0x0a9e('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x22')]=function(_0x4d00e6){return this[_0x0a9e('0x23')][_0x0a9e('0x24')](this,_0x4d00e6);};AGIChannel[_0x0a9e('0x21')]['answer']=function(){return this['sendRequest'](_0x0a9e('0x25'));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x26')]=function(_0x33161b,_0x526cf3,_0x384319){_0x33161b=_0x33161b===undefined?'beep':_0x33161b;_0x526cf3=_0x526cf3===undefined?'5':_0x526cf3;_0x384319=_0x384319===undefined?'1':_0x384319;return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x27'),_0x33161b,_0x526cf3*0x3e8,_0x384319));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x28')]=function(_0x14433c){_0x14433c=_0x14433c||_0x0a9e('0x29');return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2b'),_0x14433c));};AGIChannel['prototype'][_0x0a9e('0x2c')]=function(_0x468813,_0x2b1f27){if(_[_0x0a9e('0x2d')](_0x2b1f27)){return this['sendRequest'](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27[_0x0a9e('0x2f')](',')));}return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x30')]=function(_0x1dbde2){return this['sendRequest'](util[_0x0a9e('0x2a')]('SET\x20CONTEXT\x20%s',_0x1dbde2));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x31')]=function(_0x1122db){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20EXTENSION\x20%s',_0x1122db));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x32')]=function(_0x40cb85){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x33'),_0x40cb85));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0xb')]=function(){return this['sendRequest'](_0x0a9e('0x34'));};AGIChannel['prototype'][_0x0a9e('0x35')]=function(_0x14b13f,_0x2b7e7f){var _0x3f3d41=_['isBoolean'](_0x2b7e7f)||_[_0x0a9e('0x36')](_0x2b7e7f)?_0x2b7e7f[_0x0a9e('0x37')]():_0x2b7e7f;return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x14b13f,_0x3f3d41?_0x3f3d41['toString']()[_0x0a9e('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x0a9e('0x38')]=function(_0x3d9717,_0x381c37){return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x39'),_0x3d9717,_0x381c37));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3a')]=function(_0x533942,_0x1dbf74){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x533942,_0x1dbf74));};AGIChannel['prototype'][_0x0a9e('0x3b')]=function(_0x40d766,_0x5adda1){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3c'),_0x40d766,_0x5adda1));};AGIChannel[_0x0a9e('0x21')]['continueAt']=function(_0x5a594b,_0x15e37d,_0x45b3d0){_0x15e37d=_0x15e37d||this['extension'];_0x45b3d0=_0x45b3d0||0x1;this[_0x0a9e('0x30')](_0x5a594b);this[_0x0a9e('0x31')](_0x15e37d);this[_0x0a9e('0x32')](_0x45b3d0);return this['noop'](util[_0x0a9e('0x2a')](_0x0a9e('0x3d'),_0x5a594b,_0x15e37d,_0x45b3d0));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3e')]=function(_0x13cb1f){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3f'),_0x13cb1f));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x40')]=function(_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x37f6cc,_0x4d04c8){_0x148007=_0x148007||'wav';_0x1a7bce=_0x1a7bce||'';_0x11ca30=_0x11ca30===undefined?-0x1:_0x11ca30==='-1'?-0x1:_0x11ca30*0x3e8;_0x37f6cc=_0x37f6cc===undefined?'':'s='+_0x37f6cc;_0x4d04c8=_0x4d04c8?_0x0a9e('0x41'):'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x42'),_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x4d04c8,_0x37f6cc));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x43')]=function(_0x10b040,_0x445e25){_0x445e25=_0x445e25||'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x44'),_0x10b040,_0x445e25));};AGIChannel[_0x0a9e('0x21')]['agi']=function(_0x117c99){return this[_0x0a9e('0x2c')](_0x0a9e('0x45'),_0x117c99);};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x46')]=function(_0xbe9d19){return this[_0x0a9e('0x2c')](_0x0a9e('0x47'),_0xbe9d19);};AGIChannel['prototype'][_0x0a9e('0x17')]=function(_0x48fd45,_0x473dc8){this[_0x0a9e('0x28')](util[_0x0a9e('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x48fd45['id'],_0x48fd45[_0x0a9e('0x48')],_0x473dc8));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x0a9e('0x49')]=AGIChannel; \ No newline at end of file +var _0xcb91=['GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','events','EventEmitter','./reply','./error','call','utf8','setTimeout','headers','line','toLowerCase','hangup','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','destroy','sendRequest','sync','prototype','answer','getData','beep','format'];(function(_0x46b22a,_0x5bf83a){var _0x44c2e8=function(_0x21b6fc){while(--_0x21b6fc){_0x46b22a['push'](_0x46b22a['shift']());}};_0x44c2e8(++_0x5bf83a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0xcb91[_0x3430aa];return _0x2ac5c;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x1cb9('0x0'))[_0x1cb9('0x1')];var AGIReply=require(_0x1cb9('0x2'));var AGIError=require(_0x1cb9('0x3'));function AGIChannel(_0x4c37e8){var _0x8c392f=this,_0x2c17b8=new AGIReply(),_0x545a34=![],_0x13d5fd={};EventEmitter[_0x1cb9('0x4')](_0x8c392f);_0x4c37e8['setEncoding'](_0x1cb9('0x5'));_0x4c37e8[_0x1cb9('0x6')](0x8*0x3c*0x3c*0x3e8);_0x2c17b8['setEncoding'](_0x1cb9('0x5'));_0x2c17b8['on'](_0x1cb9('0x7'),function(_0x59d1be){for(var _0x3ae0f1 in _0x59d1be){_0x8c392f[_0x3ae0f1]=_0x59d1be[_0x3ae0f1];}_0x8c392f['emit']('ready');});_0x2c17b8['on'](_0x1cb9('0x8'),function(_0x2fa15c){if(_0x2fa15c[_0x1cb9('0x9')]()==_0x1cb9('0xa')){_0x8c392f[_0x1cb9('0xb')]('hangup');return;}if(_0x2fa15c[_0x1cb9('0xc')](0x0,0xb)==_0x1cb9('0xd')){_0x545a34=!![];}if(_0x545a34){_0x13d5fd['rx']+=_0x2fa15c+'\x0a';if(_0x2fa15c[_0x1cb9('0xe')](_0x1cb9('0xf'))!=-0x1){_0x545a34=![];}}else{_0x13d5fd['rx']=_0x2fa15c;}if(_0x545a34){return;}if(typeof _0x13d5fd['cb']==_0x1cb9('0x10')){var _0x5445e1=_0x13d5fd['rx'][_0x1cb9('0xc')](0x0,0x3),_0x5e3c19=null,_0x59dec3=null;_0x5445e1=parseInt(_0x5445e1);if(isNaN(_0x5445e1)){_0x13d5fd['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1cb9('0x11')});return;}if(_0x5445e1!=0xc8){_0x13d5fd['cb'](null,{'code':_0x5445e1,'result':-0x1,'extra':'KO'});return;}_0x5e3c19=_0x13d5fd['rx'][_0x1cb9('0xc')](0x4)[_0x1cb9('0x12')]('result=','');if(_0x5e3c19[_0x1cb9('0x13')]('\x20')!=-0x1){_0x5e3c19=_0x5e3c19[_0x1cb9('0x14')](0x0,_0x5e3c19[_0x1cb9('0x13')]('\x20'));}if(_[_0x1cb9('0x15')](_0x5e3c19,'-1')){_0x5e3c19=parseInt(_0x5e3c19);}_0x59dec3=_0x13d5fd['rx'][_0x1cb9('0x16')]('\x20');if(_0x59dec3['length']==0x3){_0x59dec3=_0x59dec3[0x2]['substring'](0x1,_0x59dec3[0x2][_0x1cb9('0x17')]-0x1);}else if(_0x59dec3[_0x1cb9('0x17')]>0x3){var _0x3904b7=/\((.+)\)/;var _0x3f1376=_0x13d5fd['rx'][_0x1cb9('0x18')](_0x3904b7);if(_0x3f1376){_0x59dec3=_0x3f1376[0x1];}else{_0x59dec3=null;}}else{_0x59dec3=null;}_0x13d5fd['cb'](null,{'code':_0x5445e1,'result':_0x5e3c19,'extra':_0x59dec3});}});_0x4c37e8['on'](_0x1cb9('0x19'),function(_0x23d3a9){_0x8c392f['emit']('error',new AGIError(_0x1cb9('0x1a'),_0x23d3a9[_0x1cb9('0x1b')]));});_0x4c37e8['on'](_0x1cb9('0x1c'),function(){_0x8c392f[_0x1cb9('0xb')](_0x1cb9('0x1c'),new AGIError(_0x1cb9('0x1d')));});_0x4c37e8['on'](_0x1cb9('0x1e'),function(){_0x8c392f['emit']('timeout',new AGIError(_0x1cb9('0x1f')));_0x4c37e8['destroy']();});_0x4c37e8[_0x1cb9('0x20')](_0x2c17b8);this[_0x1cb9('0x21')]=function(_0x523b26,_0x599275){var _0x523b26=_0x523b26||'',_0x599275=typeof _0x599275==_0x1cb9('0x10')?_0x599275:new Function();_0x13d5fd={'tx':_0x523b26,'rx':'','cb':_0x599275};_0x4c37e8[_0x1cb9('0x22')](_0x523b26+'\x0a');},this[_0x1cb9('0x1c')]=function(){_0x4c37e8[_0x1cb9('0x23')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x1cb9('0x24')]=function(_0x557199){return this[_0x1cb9('0x21')][_0x1cb9('0x25')](this,_0x557199);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x27')]=function(){return this[_0x1cb9('0x24')]('ANSWER');};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x28')]=function(_0x4c8d76,_0xd6891c,_0x21effa){_0x4c8d76=_0x4c8d76===undefined?_0x1cb9('0x29'):_0x4c8d76;_0xd6891c=_0xd6891c===undefined?'5':_0xd6891c;_0x21effa=_0x21effa===undefined?'1':_0x21effa;return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x2b'),_0x4c8d76,_0xd6891c*0x3e8,_0x21effa));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x2c')]=function(_0x41e5c2){_0x41e5c2=_0x41e5c2||_0x1cb9('0x2d');return this['sendRequest'](util[_0x1cb9('0x2a')]('VERBOSE\x20\x22%s\x22',_0x41e5c2));};AGIChannel[_0x1cb9('0x26')]['exec']=function(_0x278327,_0x41011c){if(_[_0x1cb9('0x2e')](_0x41011c)){return this[_0x1cb9('0x24')](util['format'](_0x1cb9('0x2f'),_0x278327,_0x41011c['join'](',')));}return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x2f'),_0x278327,_0x41011c));};AGIChannel['prototype'][_0x1cb9('0x30')]=function(_0x5e84fd){return this[_0x1cb9('0x24')](util['format'](_0x1cb9('0x31'),_0x5e84fd));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x32')]=function(_0xae910){return this['sendRequest'](util[_0x1cb9('0x2a')](_0x1cb9('0x33'),_0xae910));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x34')]=function(_0xc6784c){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x35'),_0xc6784c));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0xa')]=function(){return this[_0x1cb9('0x24')](_0x1cb9('0x36'));};AGIChannel[_0x1cb9('0x26')]['setVariable']=function(_0x54c6e6,_0x299ff8){var _0x30f7e4=_[_0x1cb9('0x37')](_0x299ff8)||_[_0x1cb9('0x38')](_0x299ff8)?_0x299ff8[_0x1cb9('0x39')]():_0x299ff8;return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3a'),_0x54c6e6,_0x30f7e4?_0x30f7e4['toString']()[_0x1cb9('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3b')]=function(_0x5350f9,_0x2a5aac){return this['sendRequest'](util[_0x1cb9('0x2a')]('SAY\x20NUMBER\x20%s\x20%s',_0x5350f9,_0x2a5aac));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3c')]=function(_0x289b73,_0x2bcacd){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3d'),_0x289b73,_0x2bcacd));};AGIChannel['prototype']['sayPhonetic']=function(_0x4111b8,_0x1d2723){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3e'),_0x4111b8,_0x1d2723));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3f')]=function(_0x4a670c,_0xbcaa32,_0x47edad){_0xbcaa32=_0xbcaa32||this['extension'];_0x47edad=_0x47edad||0x1;this['setContext'](_0x4a670c);this[_0x1cb9('0x32')](_0xbcaa32);this[_0x1cb9('0x34')](_0x47edad);return this[_0x1cb9('0x2c')](util[_0x1cb9('0x2a')](_0x1cb9('0x40'),_0x4a670c,_0xbcaa32,_0x47edad));};AGIChannel['prototype'][_0x1cb9('0x41')]=function(_0x523866){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x42'),_0x523866));};AGIChannel['prototype'][_0x1cb9('0x43')]=function(_0x522283,_0xda1a44,_0xbc36fc,_0x51a898,_0x5839aa,_0x24c643){_0xda1a44=_0xda1a44||_0x1cb9('0x44');_0xbc36fc=_0xbc36fc||'';_0x51a898=_0x51a898===undefined?-0x1:_0x51a898==='-1'?-0x1:_0x51a898*0x3e8;_0x5839aa=_0x5839aa===undefined?'':'s='+_0x5839aa;_0x24c643=_0x24c643?_0x1cb9('0x45'):'';return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x522283,_0xda1a44,_0xbc36fc,_0x51a898,_0x24c643,_0x5839aa));};AGIChannel[_0x1cb9('0x26')]['streamFile']=function(_0x4c59e7,_0x495335){_0x495335=_0x495335||'';return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x46'),_0x4c59e7,_0x495335));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x47')]=function(_0x2a8b7f){return this[_0x1cb9('0x48')](_0x1cb9('0x49'),_0x2a8b7f);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x4a')]=function(_0x3ea88c){return this['exec'](_0x1cb9('0x4b'),_0x3ea88c);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x19')]=function(_0x55255c,_0x179e81){this[_0x1cb9('0x2c')](util[_0x1cb9('0x2a')](_0x1cb9('0x4c'),_0x55255c['id'],_0x55255c[_0x1cb9('0x4d')],_0x179e81));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 4ee3ed7..3e639c4 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 _0x7857=['E_AGI_UNDEFINED','push','format','message','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.'];(function(_0xe98641,_0x4ba011){var _0x57a156=function(_0x1b5367){while(--_0x1b5367){_0xe98641['push'](_0xe98641['shift']());}};_0x57a156(++_0x4ba011);}(_0x7857,0x1a9));var _0x7785=function(_0x509900,_0x16bd53){_0x509900=_0x509900-0x0;var _0x3c10bc=_0x7857[_0x509900];return _0x3c10bc;};'use strict';var util=require(_0x7785('0x0'));var error={'E_AGI_UNDEFINED':_0x7785('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x7785('0x2'),'E_AGI_SERVER_CLOSE':_0x7785('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x7785('0x4'),'E_AGI_SOCKET_ERROR':_0x7785('0x5'),'E_AGI_SOCKET_CLOSE':_0x7785('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x7785('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x7785('0x8'),'E_AGI_IVR_ENTRY':_0x7785('0x9')};function AGIError(_0x555024){var _0x555024=_0x555024||null,_0x12015f=_0x12015f||[],_0x27300b=0x1,_0x497757='';if(!error[_0x555024]){_0x555024=_0x7785('0xa');}_0x12015f[_0x7785('0xb')](error[_0x555024]);while(arguments[_0x27300b]){_0x12015f[_0x7785('0xb')](arguments[_0x27300b]);_0x27300b++;}_0x497757=util[_0x7785('0xc')]['apply'](util,_0x12015f);this[_0x7785('0xd')]=_0x497757;this['name']=_0x555024;}module[_0x7785('0xe')]=AGIError; \ No newline at end of file +var _0x6263=['Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','push','message','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x3e0763,_0x3d12be){var _0x351ca2=function(_0x9beae7){while(--_0x9beae7){_0x3e0763['push'](_0x3e0763['shift']());}};_0x351ca2(++_0x3d12be);}(_0x6263,0x19d));var _0x3626=function(_0x311f44,_0x1d7f5b){_0x311f44=_0x311f44-0x0;var _0x46f1e6=_0x6263[_0x311f44];return _0x46f1e6;};'use strict';var util=require(_0x3626('0x0'));var error={'E_AGI_UNDEFINED':_0x3626('0x1'),'E_AGI_ARGUMENT_PORT':_0x3626('0x2'),'E_AGI_SERVER_ERROR':_0x3626('0x3'),'E_AGI_SERVER_CLOSE':_0x3626('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x3626('0x5'),'E_AGI_SOCKET_ERROR':_0x3626('0x6'),'E_AGI_SOCKET_CLOSE':_0x3626('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x3626('0x8'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x3626('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x3866ca){var _0x3866ca=_0x3866ca||null,_0x4a6fd3=_0x4a6fd3||[],_0x313603=0x1,_0x15d8b6='';if(!error[_0x3866ca]){_0x3866ca='E_AGI_UNDEFINED';}_0x4a6fd3[_0x3626('0xa')](error[_0x3866ca]);while(arguments[_0x313603]){_0x4a6fd3[_0x3626('0xa')](arguments[_0x313603]);_0x313603++;}_0x15d8b6=util['format']['apply'](util,_0x4a6fd3);this[_0x3626('0xb')]=_0x15d8b6;this[_0x3626('0xc')]=_0x3866ca;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 523d378..5555698 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 _0xa45c=['invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','lodash','../../../config/logger','getdigits','vertices','numberOfEdges','edges','prototype','push','size','relations','getVertex','no\x20vertex\x20found','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','agicommand','target','default','menu'];(function(_0x2b03af,_0x1722ec){var _0x22e325=function(_0x21129b){while(--_0x21129b){_0x2b03af['push'](_0x2b03af['shift']());}};_0x22e325(++_0x1722ec);}(_0xa45c,0x6d));var _0xca45=function(_0x521403,_0x102c6c){_0x521403=_0x521403-0x0;var _0x19480a=_0xa45c[_0x521403];return _0x19480a;};'use strict';var _=require(_0xca45('0x0'));var logger=require(_0xca45('0x1'))('agi');var verticesWithRetry=['menu',_0xca45('0x2'),'getsecretdigits'];var Graph=function(){this[_0xca45('0x3')]={};this['edges']={};this[_0xca45('0x4')]=0x0;};Graph['prototype']['addVertex']=function(_0x33a162){this[_0xca45('0x3')][_0x33a162['id']]=_0x33a162;this[_0xca45('0x5')][_0x33a162['id']]=[];};Graph[_0xca45('0x6')]['addEdge']=function(_0x1a8b9c,_0x276897,_0x7ceab1){this[_0xca45('0x5')][_0x1a8b9c][_0xca45('0x7')]({'target':_0x276897,'condition':_0x7ceab1});this['numberOfEdges']+=0x1;};Graph[_0xca45('0x6')][_0xca45('0x8')]=function(){return _[_0xca45('0x8')](this[_0xca45('0x3')]);};Graph[_0xca45('0x6')][_0xca45('0x9')]=function(){return this[_0xca45('0x4')];};Graph['prototype'][_0xca45('0xa')]=function(_0x360ee9){return this[_0xca45('0x3')][_0x360ee9];};Graph[_0xca45('0x6')]['traverseBFS']=function(_0x3044b1,_0x711b03){if(!this[_0xca45('0x3')][_0x3044b1]){return logger['info'](_0xca45('0xb'));}var _0x569ba6=_0x711b03(this[_0xca45('0x3')][_0x3044b1]);if(!_0x569ba6){return logger[_0xca45('0xc')](_0xca45('0xd'));}if(this[_0xca45('0x5')][_0x3044b1][_0xca45('0xe')]===0x0){return logger[_0xca45('0xc')](_0xca45('0xf'));}for(var _0x570784=0x0,_0x571baa=[],_0x5b4e29=![];_0x570784\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','hangup','sync','production','SQUAREROOT','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','agicommand\x20not\x20found','toString','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','finally','./server','connection','xml2json','lodash','syncho','util','moment','../../config/logger','../../config/license/util','./rpc','./graph','agi','127.0.0.1','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\x20%s','message','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','root','agicommand','hasOwnProperty','retry','addVertex','mxCell','length','source','target','addEdge','value','getSquareProject','catch'];(function(_0x2d1c52,_0x123621){var _0xc15187=function(_0x46a6de){while(--_0x46a6de){_0x2d1c52['push'](_0x2d1c52['shift']());}};_0xc15187(++_0x123621);}(_0xf328,0x196));var _0x8f32=function(_0xcbe1e6,_0x2db60c){_0xcbe1e6=_0xcbe1e6-0x0;var _0x23f373=_0xf328[_0xcbe1e6];return _0x23f373;};'use strict';var parser=require(_0x8f32('0x0'));var _=require(_0x8f32('0x1'));var syncho=require(_0x8f32('0x2'));var util=require(_0x8f32('0x3'));var moment=require(_0x8f32('0x4'));var config=require('../../config/environment');var logger=require(_0x8f32('0x5'))('agi');var utilLicense=require(_0x8f32('0x6'));var rpc=require(_0x8f32('0x7'));var mailRpc=require('./mailRpc');var Graph=require(_0x8f32('0x8'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x8f32('0x9')]=_['defaults'](config['agi'],{'ip':_0x8f32('0xa'),'port':0x11dd});function connectionHandler(_0x5e846a){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x5e846a);agiHandler(_0x5e846a);}catch(_0x2af893){logger[_0x8f32('0xb')](_0x2af893[_0x8f32('0xc')]);}});});}function listeningHandler(){console[_0x8f32('0xd')](_0x8f32('0xe'),config['agi'][_0x8f32('0xf')]);logger[_0x8f32('0x10')](util[_0x8f32('0x11')](_0x8f32('0x12'),config[_0x8f32('0x9')]['ip'],config[_0x8f32('0x9')][_0x8f32('0xf')]));}function errorHandler(_0x3bd130){if(_0x3bd130&&_0x3bd130[_0x8f32('0x13')]&&_0x3bd130['message']){logger[_0x8f32('0xb')](util[_0x8f32('0x11')](_0x8f32('0x14'),_0x3bd130[_0x8f32('0x13')],_0x3bd130[_0x8f32('0x15')]));}else{logger[_0x8f32('0xb')](util[_0x8f32('0x11')]('[ERROR]\x20%s',_0x3bd130[_0x8f32('0xc')]));}}function closeHandler(){logger['info'](util['format'](_0x8f32('0x16'),this[_0x8f32('0x17')],this['calleridname'],this[_0x8f32('0x18')],this[_0x8f32('0x19')],this[_0x8f32('0x1a')]));try{createSquareReport(this);}catch(_0x310b30){logger[_0x8f32('0xb')](_0x310b30[_0x8f32('0xc')]);}}function timeoutHandler(){logger[_0x8f32('0x10')](util[_0x8f32('0x11')](_0x8f32('0x1b'),this['arg_1'],this[_0x8f32('0x1c')],this['callerid'],this['dnid'],this['uniqueid']));}function hangupHandler(){logger[_0x8f32('0x10')](util[_0x8f32('0x11')](_0x8f32('0x1d'),this[_0x8f32('0x17')],this[_0x8f32('0x1c')],this['callerid'],this['dnid'],this[_0x8f32('0x1a')]));this['evtHangup']=!![];}function getRoot(_0x121175){return parser[_0x8f32('0x1e')](_0x121175,{'object':!![]})['mxGraphModel'][_0x8f32('0x1f')];}function addVertex(_0x340fa8,_0x38e780,_0x46e78c){_0x38e780[_0x8f32('0x20')]=_0x46e78c;if(_0x38e780[_0x8f32('0x21')]('retry')){_0x38e780['maxRetry']=parseInt(_0x38e780[_0x8f32('0x22')],0xa);}_0x340fa8[_0x8f32('0x23')](_['omit'](_0x38e780,_0x8f32('0x24')));}function initGraph(_0x463d4d,_0x326229){var _0x20565b=new Graph();for(var _0x1a24c0 in _0x463d4d){if(_0x463d4d[_0x8f32('0x21')](_0x1a24c0)){if(_['isArray'](_0x463d4d[_0x1a24c0])){for(var _0x1c2c4b=0x0;_0x1c2c4b<_0x463d4d[_0x1a24c0][_0x8f32('0x25')];_0x1c2c4b+=0x1){addVertex(_0x20565b,_0x463d4d[_0x1a24c0][_0x1c2c4b],_0x1a24c0);}}else{addVertex(_0x20565b,_0x463d4d[_0x1a24c0],_0x1a24c0);}}}for(var _0x46dd1e=0x0;_0x46dd1e<_0x326229[_0x8f32('0x25')];_0x46dd1e+=0x1){if(_0x326229[_0x46dd1e][_0x8f32('0x26')]&&_0x326229[_0x46dd1e][_0x8f32('0x27')]){_0x20565b[_0x8f32('0x28')](_0x326229[_0x46dd1e][_0x8f32('0x26')],_0x326229[_0x46dd1e][_0x8f32('0x27')],_0x326229[_0x46dd1e][_0x8f32('0x29')]);}}return _0x20565b;}function getSquareProject(_0x49b62b,_0x217aaa){rpc[_0x8f32('0x2a')](_0x49b62b)['then'](function(_0x28c3ce){_0x217aaa(null,_0x28c3ce);})[_0x8f32('0x2b')](function(_0x4f8188){_0x217aaa(null,_0x4f8188);});}function createSquareReport(_0x44be17,_0x373ce4){rpc[_0x8f32('0x2c')](_0x44be17)[_0x8f32('0x2d')](function(_0x1e79b2){if(_0x373ce4){_0x373ce4(null,_0x1e79b2);}})[_0x8f32('0x2b')](function(_0x96bb17){if(_0x373ce4){_0x373ce4(null,_0x96bb17);}});}function setChannelVariables(_0xae393){for(var _0x33f007 in _0xae393){if(_0xae393['hasOwnProperty'](_0x33f007)){if(_0x33f007[_0x8f32('0x2e')](_0x8f32('0x2f'))===0x0){_0xae393[_0x33f007[_0x8f32('0x30')](0x4)]=_0xae393[_0x33f007];delete _0xae393[_0x33f007];}}}}function getLogFromObject(_0x58017f){return util[_0x8f32('0x31')](_0x58017f,{'showHidden':![],'depth':null});}function agiHandler(_0x364537){var _0x4c4fe9,_0xef44a6,_0x32d544,_0x5002b9,_0xa475d0;logger[_0x8f32('0x32')](_0x8f32('0x33'),JSON[_0x8f32('0x34')](_0x364537,null,0x2));logger[_0x8f32('0x10')](util[_0x8f32('0x11')](_0x8f32('0x35'),_0x364537[_0x8f32('0x17')],_0x364537[_0x8f32('0x1c')],_0x364537[_0x8f32('0x18')],_0x364537[_0x8f32('0x19')],_0x364537[_0x8f32('0x1a')]));_0x364537['on'](_0x8f32('0xb'),errorHandler);_0x364537['on'](_0x8f32('0x36'),closeHandler);_0x364537['on'](_0x8f32('0x37'),timeoutHandler);_0x364537[_0x8f32('0x38')]=![];_0x364537['on'](_0x8f32('0x39'),hangupHandler);var _0xc867b1=getSquareProject[_0x8f32('0x3a')](null,_0x364537[_0x8f32('0x17')]);if(_0xc867b1){if(_0xc867b1[_0x8f32('0x3b')]){_0x4c4fe9=getRoot(_0xc867b1[_0x8f32('0x3b')]);console[_0x8f32('0xd')](_0x8f32('0x3c'),_0x4c4fe9);if(_0x4c4fe9&&_0x4c4fe9[_0x8f32('0x3d')]){logger[_0x8f32('0x32')](_0x8f32('0x1f'),JSON[_0x8f32('0x34')](_0x4c4fe9,null,0x2));_0x364537[_0x8f32('0x3e')]=moment()[_0x8f32('0x11')](_0x8f32('0x3f'));_0xef44a6=initGraph(_[_0x8f32('0x40')](_0x4c4fe9,_0x8f32('0x24')),_0x4c4fe9[_0x8f32('0x24')]);_0x32d544=new Vertices(_0x364537,rpc,mailRpc);logger[_0x8f32('0x10')](util[_0x8f32('0x11')](_0x8f32('0x41'),_0x364537[_0x8f32('0x17')],_0x364537['calleridname'],_0x364537[_0x8f32('0x18')],_0x364537[_0x8f32('0x19')],_0x364537[_0x8f32('0x1a')]));_0xef44a6['traverseBFS'](_0x4c4fe9[_0x8f32('0x3d')]['id'],function(_0x2d83e1){try{_0x2d83e1=_0x32d544[_0x8f32('0x42')](_0x2d83e1);logger[_0x8f32('0x32')](_0x8f32('0x43'),JSON[_0x8f32('0x34')](_0x2d83e1,null,0x2));if(_0x2d83e1['agicommand']===_0x8f32('0x44')){logger[_0x8f32('0x10')](_0x8f32('0x45'));_0x364537[_0x8f32('0x46')]=_0x2d83e1['context']||_0x364537[_0x8f32('0x46')];_0x364537[_0x8f32('0x47')]=_0x2d83e1[_0x8f32('0x47')];_0x364537[_0x8f32('0x48')]=_0x2d83e1[_0x8f32('0x48')]?_0x2d83e1[_0x8f32('0x48')]-0x1:0x1;return null;}else if(_0x2d83e1&&_0x32d544[_0x2d83e1['agicommand']]){_0xa475d0=_0x32d544[_0x2d83e1[_0x8f32('0x20')]](_0x2d83e1);logger['info'](_0x8f32('0x49'),JSON['stringify'](_0xa475d0,null,0x2));if(_0xa475d0&&_0xa475d0[_0x8f32('0x4a')]===AGI_CODE_SUCCESS&&_0xa475d0[_0x8f32('0x4b')]!==AGI_RESULT_ERROR&&!_0x364537[_0x8f32('0x38')]){logger[_0x8f32('0x32')]('response',getLogFromObject(_0xa475d0));return _[_0x8f32('0x4c')](_0xa475d0['result'])?null:_0xa475d0[_0x8f32('0x4b')]['toString']();}else{logger[_0x8f32('0xb')]('response',getLogFromObject(_0xa475d0));return null;}}else{logger[_0x8f32('0xb')](_0x8f32('0x4d'));return null;}}catch(_0x4b6571){logger['error'](_0x4b6571[_0x8f32('0xc')]);return null;}});if(_0x4c4fe9['finally']){logger[_0x8f32('0x10')](util[_0x8f32('0x11')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x364537[_0x8f32('0x17')],_0x364537['calleridname'],_0x364537['callerid'],_0x364537[_0x8f32('0x19')],_0x364537[_0x8f32('0x1a')]));_0xef44a6['traverseBFS'](_0x4c4fe9['finally']['id'],function(_0x43c212){try{_0x43c212=_0x32d544[_0x8f32('0x42')](_0x43c212);logger[_0x8f32('0x32')](_0x8f32('0x43'),JSON[_0x8f32('0x34')](_0x43c212,null,0x2));if(_0x43c212&&_0x32d544[_0x43c212[_0x8f32('0x20')]]){_0xa475d0=_0x32d544[_0x43c212[_0x8f32('0x20')]](_0x43c212);if(_0xa475d0){logger['debug'](_0x8f32('0x49'),getLogFromObject(_0xa475d0));return _['isUndefined'](_0xa475d0[_0x8f32('0x4b')])?null:_0xa475d0[_0x8f32('0x4b')][_0x8f32('0x4e')]();}else{logger['error'](_0x8f32('0x49'),getLogFromObject(_0xa475d0));return null;}}else{logger[_0x8f32('0xb')](_0x8f32('0x4d'));return null;}}catch(_0x4cc12c){logger[_0x8f32('0xb')](_0x4cc12c['stack']);return null;}});}logger[_0x8f32('0x10')](util[_0x8f32('0x11')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x364537[_0x8f32('0x17')],_0x364537[_0x8f32('0x1c')],_0x364537['callerid'],_0x364537[_0x8f32('0x19')],_0x364537['uniqueid']));logger[_0x8f32('0x10')](util[_0x8f32('0x11')](_0x8f32('0x4f'),_0x364537[_0x8f32('0x46')],_0x364537[_0x8f32('0x47')],parseInt(_0x364537['priority'],0xa)+0x1));_0x364537[_0x8f32('0x50')](_0x364537[_0x8f32('0x46')],_0x364537[_0x8f32('0x47')],parseInt(_0x364537[_0x8f32('0x48')],0xa)+0x1);_0x364537[_0x8f32('0x36')]();}}else{logger[_0x8f32('0xb')](util['format'](_0x8f32('0x51'),_0x364537['arg_1']));_0x364537['continueAt'](_0x364537[_0x8f32('0x46')],_0x364537['extension'],parseInt(_0x364537['priority'],0xa)+0x1);_0x364537[_0x8f32('0x36')]();}}else{logger['error'](util[_0x8f32('0x11')]('Project\x20%s\x20not\x20found',_0x364537['arg_1']));_0x364537[_0x8f32('0x50')](_0x364537['context'],_0x364537['extension'],parseInt(_0x364537[_0x8f32('0x48')],0xa)+0x1);_0x364537['close']();}}function main(){var _0xbc292b;return utilLicense[_0x8f32('0x52')]()[_0x8f32('0x2d')](function(_0xe61006){if(_0xe61006){if(_0xe61006[_0x8f32('0x53')]){if(_0xe61006['callysquare']&&_0xe61006[_0x8f32('0x54')]>0x0){logger[_0x8f32('0x10')](util[_0x8f32('0x11')]('[LICENSE]\x20CHANNELS:\x20%s',_0xe61006['callysquare']));_0xbc292b=_0xe61006[_0x8f32('0x54')];}else{logger['info'](_0x8f32('0x55'));}}else{logger[_0x8f32('0x10')](_0x8f32('0x56'));_0xbc292b=-0x1;}}})['catch'](function(_0x58396d){logger[_0x8f32('0xb')]('[LICENSE]',_0x58396d['stack']);})[_0x8f32('0x57')](function(){var _0x429ce5=require(_0x8f32('0x58'))(config[_0x8f32('0x9')][_0x8f32('0xf')],config[_0x8f32('0x9')]['ip'],_0xbc292b);_0x429ce5['on'](_0x8f32('0xb'),errorHandler);_0x429ce5['on']('listening',listeningHandler);_0x429ce5['on'](_0x8f32('0x59'),connectionHandler);_0x429ce5['on'](_0x8f32('0x36'),closeHandler);});}main(); \ No newline at end of file +var _0x4681=['extension','priority','agicommand','response','code','result','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','isUndefined','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','connection','xml2json','lodash','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','message','[%s]\x20%s','[ERROR]\x20%s','stack','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','toJson','mxGraphModel','hasOwnProperty','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','then','createSquareReport','catch','indexOf','agi_','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','evtHangup','hangup','production','SQUAREROOT','start','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context'];(function(_0x152aa1,_0x307718){var _0x1bc01a=function(_0xd3211e){while(--_0xd3211e){_0x152aa1['push'](_0x152aa1['shift']());}};_0x1bc01a(++_0x307718);}(_0x4681,0xd5));var _0x1468=function(_0x40abcb,_0x2416f7){_0x40abcb=_0x40abcb-0x0;var _0x3ec8ea=_0x4681[_0x40abcb];return _0x3ec8ea;};'use strict';var parser=require(_0x1468('0x0'));var _=require(_0x1468('0x1'));var syncho=require('syncho');var util=require(_0x1468('0x2'));var moment=require(_0x1468('0x3'));var config=require(_0x1468('0x4'));var logger=require(_0x1468('0x5'))(_0x1468('0x6'));var utilLicense=require(_0x1468('0x7'));var rpc=require(_0x1468('0x8'));var mailRpc=require(_0x1468('0x9'));var Graph=require(_0x1468('0xa'));var Vertices=require(_0x1468('0xb'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x1468('0x6')]=_[_0x1468('0xc')](config['agi'],{'ip':_0x1468('0xd'),'port':0x11dd});function connectionHandler(_0x5826de){process[_0x1468('0xe')](function(){syncho(function(){try{setChannelVariables(_0x5826de);agiHandler(_0x5826de);}catch(_0x116ec8){logger[_0x1468('0xf')](_0x116ec8['stack']);}});});}function listeningHandler(){console[_0x1468('0x10')](_0x1468('0x11'),config[_0x1468('0x6')]['port']);logger['info'](util[_0x1468('0x12')](_0x1468('0x13'),config[_0x1468('0x6')]['ip'],config[_0x1468('0x6')][_0x1468('0x14')]));}function errorHandler(_0x2ca8ac){if(_0x2ca8ac&&_0x2ca8ac[_0x1468('0x15')]&&_0x2ca8ac[_0x1468('0x16')]){logger['error'](util[_0x1468('0x12')](_0x1468('0x17'),_0x2ca8ac[_0x1468('0x15')],_0x2ca8ac[_0x1468('0x16')]));}else{logger[_0x1468('0xf')](util[_0x1468('0x12')](_0x1468('0x18'),_0x2ca8ac[_0x1468('0x19')]));}}function closeHandler(){logger[_0x1468('0x1a')](util[_0x1468('0x12')](_0x1468('0x1b'),this['arg_1'],this['calleridname'],this[_0x1468('0x1c')],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0xb8eb77){logger[_0x1468('0xf')](_0xb8eb77[_0x1468('0x19')]);}}function timeoutHandler(){logger['info'](util[_0x1468('0x12')](_0x1468('0x1d'),this[_0x1468('0x1e')],this['calleridname'],this['callerid'],this[_0x1468('0x1f')],this[_0x1468('0x20')]));}function hangupHandler(){logger[_0x1468('0x1a')](util['format'](_0x1468('0x21'),this['arg_1'],this[_0x1468('0x22')],this[_0x1468('0x1c')],this[_0x1468('0x1f')],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x1140ab){return parser[_0x1468('0x23')](_0x1140ab,{'object':!![]})[_0x1468('0x24')]['root'];}function addVertex(_0x1faa9e,_0x6cd3eb,_0xa75707){_0x6cd3eb['agicommand']=_0xa75707;if(_0x6cd3eb[_0x1468('0x25')]('retry')){_0x6cd3eb[_0x1468('0x26')]=parseInt(_0x6cd3eb['retry'],0xa);}_0x1faa9e[_0x1468('0x27')](_[_0x1468('0x28')](_0x6cd3eb,_0x1468('0x29')));}function initGraph(_0x5234ba,_0xf64fd1){var _0xf6abeb=new Graph();for(var _0x58226f in _0x5234ba){if(_0x5234ba['hasOwnProperty'](_0x58226f)){if(_[_0x1468('0x2a')](_0x5234ba[_0x58226f])){for(var _0x338335=0x0;_0x338335<_0x5234ba[_0x58226f][_0x1468('0x2b')];_0x338335+=0x1){addVertex(_0xf6abeb,_0x5234ba[_0x58226f][_0x338335],_0x58226f);}}else{addVertex(_0xf6abeb,_0x5234ba[_0x58226f],_0x58226f);}}}for(var _0x18f679=0x0;_0x18f679<_0xf64fd1[_0x1468('0x2b')];_0x18f679+=0x1){if(_0xf64fd1[_0x18f679][_0x1468('0x2c')]&&_0xf64fd1[_0x18f679][_0x1468('0x2d')]){_0xf6abeb[_0x1468('0x2e')](_0xf64fd1[_0x18f679][_0x1468('0x2c')],_0xf64fd1[_0x18f679][_0x1468('0x2d')],_0xf64fd1[_0x18f679][_0x1468('0x2f')]);}}return _0xf6abeb;}function getSquareProject(_0x2b6b2d,_0x47fea1){rpc['getSquareProject'](_0x2b6b2d)[_0x1468('0x30')](function(_0x535cf3){_0x47fea1(null,_0x535cf3);})['catch'](function(_0x36c2dd){_0x47fea1(null,_0x36c2dd);});}function createSquareReport(_0x48b8ca,_0x235632){rpc[_0x1468('0x31')](_0x48b8ca)[_0x1468('0x30')](function(_0x1aa52d){if(_0x235632){_0x235632(null,_0x1aa52d);}})[_0x1468('0x32')](function(_0x3ed8d5){if(_0x235632){_0x235632(null,_0x3ed8d5);}});}function setChannelVariables(_0x196577){for(var _0x1d628a in _0x196577){if(_0x196577[_0x1468('0x25')](_0x1d628a)){if(_0x1d628a[_0x1468('0x33')](_0x1468('0x34'))===0x0){_0x196577[_0x1d628a['substring'](0x4)]=_0x196577[_0x1d628a];delete _0x196577[_0x1d628a];}}}}function getLogFromObject(_0x62de58){return util['inspect'](_0x62de58,{'showHidden':![],'depth':null});}function agiHandler(_0x4f1057){var _0xa9bdd2,_0x5eaa44,_0x2c0422,_0x4978e6,_0x58c7ab;logger[_0x1468('0x35')]('variables',JSON[_0x1468('0x36')](_0x4f1057,null,0x2));logger['info'](util[_0x1468('0x12')](_0x1468('0x37'),_0x4f1057[_0x1468('0x1e')],_0x4f1057[_0x1468('0x22')],_0x4f1057[_0x1468('0x1c')],_0x4f1057['dnid'],_0x4f1057[_0x1468('0x20')]));_0x4f1057['on'](_0x1468('0xf'),errorHandler);_0x4f1057['on']('close',closeHandler);_0x4f1057['on'](_0x1468('0x38'),timeoutHandler);_0x4f1057[_0x1468('0x39')]=![];_0x4f1057['on'](_0x1468('0x3a'),hangupHandler);var _0x4c6201=getSquareProject['sync'](null,_0x4f1057[_0x1468('0x1e')]);if(_0x4c6201){if(_0x4c6201[_0x1468('0x3b')]){_0xa9bdd2=getRoot(_0x4c6201[_0x1468('0x3b')]);console[_0x1468('0x10')](_0x1468('0x3c'),_0xa9bdd2);if(_0xa9bdd2&&_0xa9bdd2[_0x1468('0x3d')]){logger['debug'](_0x1468('0x3e'),JSON[_0x1468('0x36')](_0xa9bdd2,null,0x2));_0x4f1057[_0x1468('0x3f')]=moment()['format'](_0x1468('0x40'));_0x5eaa44=initGraph(_['omit'](_0xa9bdd2,_0x1468('0x29')),_0xa9bdd2[_0x1468('0x29')]);_0x2c0422=new Vertices(_0x4f1057,rpc,mailRpc);logger[_0x1468('0x1a')](util[_0x1468('0x12')](_0x1468('0x41'),_0x4f1057[_0x1468('0x1e')],_0x4f1057[_0x1468('0x22')],_0x4f1057[_0x1468('0x1c')],_0x4f1057[_0x1468('0x1f')],_0x4f1057[_0x1468('0x20')]));_0x5eaa44[_0x1468('0x42')](_0xa9bdd2[_0x1468('0x3d')]['id'],function(_0x23fc36){try{_0x23fc36=_0x2c0422[_0x1468('0x43')](_0x23fc36);logger['debug'](_0x1468('0x44'),JSON[_0x1468('0x36')](_0x23fc36,null,0x2));if(_0x23fc36['agicommand']===_0x1468('0x45')){logger[_0x1468('0x1a')](_0x1468('0x46'));_0x4f1057[_0x1468('0x47')]=_0x23fc36['context']||_0x4f1057[_0x1468('0x47')];_0x4f1057[_0x1468('0x48')]=_0x23fc36['extension'];_0x4f1057[_0x1468('0x49')]=_0x23fc36[_0x1468('0x49')]?_0x23fc36[_0x1468('0x49')]-0x1:0x1;return null;}else if(_0x23fc36&&_0x2c0422[_0x23fc36[_0x1468('0x4a')]]){_0x58c7ab=_0x2c0422[_0x23fc36[_0x1468('0x4a')]](_0x23fc36);logger[_0x1468('0x1a')](_0x1468('0x4b'),JSON[_0x1468('0x36')](_0x58c7ab,null,0x2));if(_0x58c7ab&&_0x58c7ab[_0x1468('0x4c')]===AGI_CODE_SUCCESS&&_0x58c7ab[_0x1468('0x4d')]!==AGI_RESULT_ERROR&&!_0x4f1057['evtHangup']){logger[_0x1468('0x35')]('response',getLogFromObject(_0x58c7ab));return _['isUndefined'](_0x58c7ab[_0x1468('0x4d')])?null:_0x58c7ab[_0x1468('0x4d')][_0x1468('0x4e')]();}else{logger[_0x1468('0xf')](_0x1468('0x4b'),getLogFromObject(_0x58c7ab));return null;}}else{logger[_0x1468('0xf')](_0x1468('0x4f'));return null;}}catch(_0x2ea951){logger[_0x1468('0xf')](_0x2ea951['stack']);return null;}});if(_0xa9bdd2['finally']){logger[_0x1468('0x1a')](util[_0x1468('0x12')](_0x1468('0x50'),_0x4f1057[_0x1468('0x1e')],_0x4f1057['calleridname'],_0x4f1057[_0x1468('0x1c')],_0x4f1057['dnid'],_0x4f1057[_0x1468('0x20')]));_0x5eaa44[_0x1468('0x42')](_0xa9bdd2[_0x1468('0x51')]['id'],function(_0x3b7e10){try{_0x3b7e10=_0x2c0422[_0x1468('0x43')](_0x3b7e10);logger[_0x1468('0x35')]('vertex',JSON[_0x1468('0x36')](_0x3b7e10,null,0x2));if(_0x3b7e10&&_0x2c0422[_0x3b7e10[_0x1468('0x4a')]]){_0x58c7ab=_0x2c0422[_0x3b7e10['agicommand']](_0x3b7e10);if(_0x58c7ab){logger[_0x1468('0x35')](_0x1468('0x4b'),getLogFromObject(_0x58c7ab));return _[_0x1468('0x52')](_0x58c7ab['result'])?null:_0x58c7ab[_0x1468('0x4d')][_0x1468('0x4e')]();}else{logger['error'](_0x1468('0x4b'),getLogFromObject(_0x58c7ab));return null;}}else{logger[_0x1468('0xf')](_0x1468('0x4f'));return null;}}catch(_0x3978d1){logger[_0x1468('0xf')](_0x3978d1[_0x1468('0x19')]);return null;}});}logger[_0x1468('0x1a')](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4f1057['arg_1'],_0x4f1057['calleridname'],_0x4f1057[_0x1468('0x1c')],_0x4f1057[_0x1468('0x1f')],_0x4f1057[_0x1468('0x20')]));logger['info'](util['format'](_0x1468('0x53'),_0x4f1057[_0x1468('0x47')],_0x4f1057['extension'],parseInt(_0x4f1057['priority'],0xa)+0x1));_0x4f1057[_0x1468('0x54')](_0x4f1057[_0x1468('0x47')],_0x4f1057[_0x1468('0x48')],parseInt(_0x4f1057['priority'],0xa)+0x1);_0x4f1057[_0x1468('0x55')]();}}else{logger[_0x1468('0xf')](util['format'](_0x1468('0x56'),_0x4f1057[_0x1468('0x1e')]));_0x4f1057[_0x1468('0x54')](_0x4f1057[_0x1468('0x47')],_0x4f1057['extension'],parseInt(_0x4f1057['priority'],0xa)+0x1);_0x4f1057[_0x1468('0x55')]();}}else{logger[_0x1468('0xf')](util[_0x1468('0x12')](_0x1468('0x57'),_0x4f1057[_0x1468('0x1e')]));_0x4f1057['continueAt'](_0x4f1057['context'],_0x4f1057[_0x1468('0x48')],parseInt(_0x4f1057[_0x1468('0x49')],0xa)+0x1);_0x4f1057[_0x1468('0x55')]();}}function main(){var _0x354ff3;return utilLicense['getLicense']()[_0x1468('0x30')](function(_0x3815d5){if(_0x3815d5){if(_0x3815d5['voice']){if(_0x3815d5[_0x1468('0x58')]&&_0x3815d5[_0x1468('0x58')]>0x0){logger[_0x1468('0x1a')](util[_0x1468('0x12')](_0x1468('0x59'),_0x3815d5[_0x1468('0x58')]));_0x354ff3=_0x3815d5[_0x1468('0x58')];}else{logger['info'](_0x1468('0x5a'));}}else{logger[_0x1468('0x1a')](_0x1468('0x5b'));_0x354ff3=-0x1;}}})['catch'](function(_0x10f22f){logger[_0x1468('0xf')](_0x1468('0x5c'),_0x10f22f[_0x1468('0x19')]);})[_0x1468('0x51')](function(){var _0x3ef2ef=require(_0x1468('0x5d'))(config['agi']['port'],config[_0x1468('0x6')]['ip'],_0x354ff3);_0x3ef2ef['on'](_0x1468('0xf'),errorHandler);_0x3ef2ef['on']('listening',listeningHandler);_0x3ef2ef['on'](_0x1468('0x5e'),connectionHandler);_0x3ef2ef['on'](_0x1468('0x55'),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 06c0ddb..e4ef3c1 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x170cf1,_0x48fb57){var _0x39e82=function(_0x4cafec){while(--_0x4cafec){_0x170cf1['push'](_0x170cf1['shift']());}};_0x39e82(++_0x48fb57);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x30aa6b,_0x537cf0){var _0xf0645f=function(_0x2911ea){while(--_0x2911ea){_0x30aa6b['push'](_0x30aa6b['shift']());}};_0xf0645f(++_0x537cf0);}(_0x34e8,0x12c));var _0x834e=function(_0x4a2ea4,_0x5015d6){_0x4a2ea4=_0x4a2ea4-0x0;var _0x1305d8=_0x34e8[_0x4a2ea4];return _0x1305d8;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index efb3b90..198a52b 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x3403d5,_0x3d99fc){var _0xf9df4f=function(_0x33d748){while(--_0x33d748){_0x3403d5['push'](_0x3403d5['shift']());}};_0xf9df4f(++_0x3d99fc);}(_0xb10b,0x12a));var _0xbb10=function(_0xca2488,_0x14de01){_0xca2488=_0xca2488-0x0;var _0xa77bb9=_0xb10b[_0xca2488];return _0xa77bb9;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file +var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x514c15,_0x486901){var _0x16283e=function(_0x53b7d0){while(--_0x53b7d0){_0x514c15['push'](_0x514c15['shift']());}};_0x16283e(++_0x486901);}(_0x5f2f,0x73));var _0xf5f2=function(_0x50a16a,_0x1fa1e4){_0x50a16a=_0x50a16a-0x0;var _0x122c73=_0x5f2f[_0x50a16a];return _0x122c73;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 34c0b53..5c1c27e 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 _0x59ce=['agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','jayson/promise','client','http','result','catch','getSquareProject','ShowSquareProject','getMailAccountById','MailServerOut','name','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','dsn','getUserById','GetContactByPhone','phone','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser'];(function(_0xc94434,_0x2502a5){var _0x35d16f=function(_0x3af9ed){while(--_0x3af9ed){_0xc94434['push'](_0xc94434['shift']());}};_0x35d16f(++_0x2502a5);}(_0x59ce,0x162));var _0xe59c=function(_0x5350a9,_0x260d2b){_0x5350a9=_0x5350a9-0x0;var _0x562584=_0x59ce[_0x5350a9];return _0x562584;};'use strict';var BPromise=require(_0xe59c('0x0'));var moment=require(_0xe59c('0x1'));var _=require(_0xe59c('0x2'));var util=require('util');var jayson=require(_0xe59c('0x3'));var client=jayson[_0xe59c('0x4')][_0xe59c('0x5')]({'port':0x2329});function request(_0xd4510,_0xd199dc){return new BPromise(function(_0x12902e,_0x4bbfd0){return client['request'](_0xd4510,_0xd199dc)['then'](function(_0x116aa9){if(_0x116aa9['error']){return _0x4bbfd0(_0x116aa9['error']['message']);}else{return _0x12902e(_0x116aa9[_0xe59c('0x6')]);}})[_0xe59c('0x7')](function(_0x2fc5b0){return _0x4bbfd0(_0x2fc5b0);});});}exports[_0xe59c('0x8')]=function(_0x3af107){return request(_0xe59c('0x9'),{'options':{'raw':![],'where':{'name':_0x3af107},'attributes':['production']}});};exports[_0xe59c('0xa')]=function(_0x4598fb){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x4598fb},'include':[{'model':_0xe59c('0xb'),'as':'Smtp'}],'attributes':['id',_0xe59c('0xc'),'email']}});};exports[_0xe59c('0xd')]=function(_0x2fb6a7){return request(_0xe59c('0x9'),{'options':{'where':{'id':_0x2fb6a7},'attributes':['name']}});};exports[_0xe59c('0xe')]=function(_0x2a8ed3){return request(_0xe59c('0xf'),{'options':{'where':{'id':_0x2a8ed3},'attributes':[_0xe59c('0xc')]}});};exports[_0xe59c('0x10')]=function(_0x3e8bf9){return request(_0xe59c('0x11'),{'options':{'where':{'id':_0x3e8bf9},'attributes':[_0xe59c('0xc')]}});};exports['getSquareOdbcById']=function(_0x2feabb){return request(_0xe59c('0x12'),{'options':{'where':{'id':_0x2feabb},'attributes':[_0xe59c('0x13')]}});};exports[_0xe59c('0x14')]=function(_0x563b27){return request('ShowUser',{'options':{'where':{'id':_0x563b27},'attributes':[_0xe59c('0xc')]}});};exports['getContactByPhone']=function(_0x469a49){return request(_0xe59c('0x15'),{'options':{'where':{'phone':_0x469a49[_0xe59c('0x16')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x5d4ae0){return request(_0xe59c('0x17'),{'options':{'where':{'id':_0x5d4ae0},'attributes':[_0xe59c('0xc')]}});};exports[_0xe59c('0x18')]=function(_0x46cb87){return request('ShowSound',{'options':{'where':{'id':_0x46cb87},'attributes':[_0xe59c('0x19')]}});};exports[_0xe59c('0x1a')]=function(_0x2696ab){return request(_0xe59c('0x1b'),{'options':{'raw':![],'where':{'id':_0x2696ab},'include':[{'model':_0xe59c('0x1c'),'as':_0xe59c('0x1d')}]}});};exports['getSmsAccountById']=function(_0x1eaeb1){return request(_0xe59c('0x1e'),{'options':{'where':{'id':_0x1eaeb1},'attributes':['id',_0xe59c('0xc')]}});};exports[_0xe59c('0x1f')]=function(_0x3e979c){return request(_0xe59c('0x20'),{'body':_0x3e979c});};exports[_0xe59c('0x21')]=function(_0x55f80d){return request(_0xe59c('0x22'),{'body':_0x55f80d});};exports[_0xe59c('0x23')]=function(_0x495be8){return request(_0xe59c('0x24'),{'body':_[_0xe59c('0x25')](_0x495be8,{'project_name':_0x495be8[_0xe59c('0x26')],'prev_project_name':_0x495be8[_0xe59c('0x27')]||'','is_subproject':_0x495be8[_0xe59c('0x27')]?!![]:![],'leaveAt':moment()[_0xe59c('0x28')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xe59c('0x29')]=function(_0x4b22ab){return request('CreateSquareRecording',{'body':_0x4b22ab});};exports[_0xe59c('0x2a')]=function(_0x37f205){return request(_0xe59c('0x2b'),{'body':_0x37f205});};exports['createCmContact']=function(_0x1da0fc){return request(_0xe59c('0x2c'),{'options':{'raw':![],'where':{'phone':_0x1da0fc[_0xe59c('0x16')],'ListId':_0x1da0fc[_0xe59c('0x2d')]}}})[_0xe59c('0x2e')](function(_0x585310){if(_0x585310){return _0x585310;}return request(_0xe59c('0x2f'),{'body':_0x1da0fc});});};exports[_0xe59c('0x30')]=function(_0x1fdc20){return request(_0xe59c('0x31'),{'options':{'where':{'id':_0x1fdc20},'attributes':[_0xe59c('0xc')]}});};exports[_0xe59c('0x32')]=function(_0x396950,_0x301e46){return request(_0xe59c('0x33'),{'body':{'interface':_0x301e46},'options':{'where':_0x396950}});};exports[_0xe59c('0x34')]=function(_0x162822,_0x4ae6e8,_0x18d994){return request(_0xe59c('0x35'),{'body':{'type':_0x4ae6e8,'uniqueid':_0x18d994},'options':{'where':_0x162822}});};exports[_0xe59c('0x36')]=function(_0x3282fb){return request(_0xe59c('0x37'),{'body':{},'options':{'where':_0x3282fb}});};exports[_0xe59c('0x38')]=function(_0x4bfa1e){return request(_0xe59c('0x39'),{'body':{},'options':{'where':_0x4bfa1e}});}; \ No newline at end of file +var _0x0053=['getContactByPhone','GetContactByPhone','phone','getSoundById','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser'];(function(_0x5b6c74,_0x7bce92){var _0x50718c=function(_0x9b106c){while(--_0x9b106c){_0x5b6c74['push'](_0x5b6c74['shift']());}};_0x50718c(++_0x7bce92);}(_0x0053,0x1b1));var _0x3005=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0053[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x3005('0x0'));var moment=require(_0x3005('0x1'));var _=require(_0x3005('0x2'));var util=require(_0x3005('0x3'));var jayson=require(_0x3005('0x4'));var client=jayson[_0x3005('0x5')][_0x3005('0x6')]({'port':0x2329});function request(_0x5e9fe5,_0x1b85da){return new BPromise(function(_0x27319b,_0x5429ef){return client[_0x3005('0x7')](_0x5e9fe5,_0x1b85da)[_0x3005('0x8')](function(_0x1e9904){if(_0x1e9904[_0x3005('0x9')]){return _0x5429ef(_0x1e9904[_0x3005('0x9')][_0x3005('0xa')]);}else{return _0x27319b(_0x1e9904[_0x3005('0xb')]);}})[_0x3005('0xc')](function(_0x27e40b){return _0x5429ef(_0x27e40b);});});}exports[_0x3005('0xd')]=function(_0x67f4b){return request(_0x3005('0xe'),{'options':{'raw':![],'where':{'name':_0x67f4b},'attributes':[_0x3005('0xf')]}});};exports[_0x3005('0x10')]=function(_0x1af0a9){return request(_0x3005('0x11'),{'options':{'raw':![],'where':{'id':_0x1af0a9},'include':[{'model':_0x3005('0x12'),'as':_0x3005('0x13')}],'attributes':['id',_0x3005('0x14'),'email']}});};exports[_0x3005('0x15')]=function(_0x31f2d5){return request('ShowSquareProject',{'options':{'where':{'id':_0x31f2d5},'attributes':[_0x3005('0x14')]}});};exports[_0x3005('0x16')]=function(_0x583fc3){return request(_0x3005('0x17'),{'options':{'where':{'id':_0x583fc3},'attributes':['name']}});};exports['getVariableById']=function(_0x40a0e8){return request(_0x3005('0x18'),{'options':{'where':{'id':_0x40a0e8},'attributes':[_0x3005('0x14')]}});};exports[_0x3005('0x19')]=function(_0x213d33){return request(_0x3005('0x1a'),{'options':{'where':{'id':_0x213d33},'attributes':[_0x3005('0x1b')]}});};exports['getUserById']=function(_0x4b1804){return request(_0x3005('0x1c'),{'options':{'where':{'id':_0x4b1804},'attributes':['name']}});};exports[_0x3005('0x1d')]=function(_0x622048){return request(_0x3005('0x1e'),{'options':{'where':{'phone':_0x622048[_0x3005('0x1f')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x5dfd93){return request('ShowTrunk',{'options':{'where':{'id':_0x5dfd93},'attributes':[_0x3005('0x14')]}});};exports[_0x3005('0x20')]=function(_0x411e9b){return request('ShowSound',{'options':{'where':{'id':_0x411e9b},'attributes':[_0x3005('0x21')]}});};exports[_0x3005('0x22')]=function(_0x54b790){return request(_0x3005('0x23'),{'options':{'raw':![],'where':{'id':_0x54b790},'include':[{'model':'Interval','as':_0x3005('0x24')}]}});};exports[_0x3005('0x25')]=function(_0x5879d6){return request(_0x3005('0x26'),{'options':{'where':{'id':_0x5879d6},'attributes':['id',_0x3005('0x14')]}});};exports[_0x3005('0x27')]=function(_0x46defc){return request(_0x3005('0x28'),{'body':_0x46defc});};exports[_0x3005('0x29')]=function(_0x49c5e8){return request(_0x3005('0x2a'),{'body':_0x49c5e8});};exports['createSquareReport']=function(_0x25b8e5){return request(_0x3005('0x2b'),{'body':_[_0x3005('0x2c')](_0x25b8e5,{'project_name':_0x25b8e5[_0x3005('0x2d')],'prev_project_name':_0x25b8e5[_0x3005('0x2e')]||'','is_subproject':_0x25b8e5['arg_2']?!![]:![],'leaveAt':moment()[_0x3005('0x2f')](_0x3005('0x30'))})});};exports[_0x3005('0x31')]=function(_0x205e50){return request(_0x3005('0x32'),{'body':_0x205e50});};exports[_0x3005('0x33')]=function(_0x377699){return request(_0x3005('0x34'),{'body':_0x377699});};exports[_0x3005('0x35')]=function(_0x41473a){return request(_0x3005('0x36'),{'options':{'raw':![],'where':{'phone':_0x41473a[_0x3005('0x1f')],'ListId':_0x41473a[_0x3005('0x37')]}}})['then'](function(_0x565085){if(_0x565085){return _0x565085;}return request(_0x3005('0x38'),{'body':_0x41473a});});};exports[_0x3005('0x39')]=function(_0x570d46){return request(_0x3005('0x3a'),{'options':{'where':{'id':_0x570d46},'attributes':[_0x3005('0x14')]}});};exports[_0x3005('0x3b')]=function(_0x1fb244,_0x35f3be){return request(_0x3005('0x3c'),{'body':{'interface':_0x35f3be},'options':{'where':_0x1fb244}});};exports[_0x3005('0x3d')]=function(_0x247924,_0x451d63,_0x34784c){return request(_0x3005('0x3e'),{'body':{'type':_0x451d63,'uniqueid':_0x34784c},'options':{'where':_0x247924}});};exports[_0x3005('0x3f')]=function(_0x393ce5){return request('UnpauseUser',{'body':{},'options':{'where':_0x393ce5}});};exports[_0x3005('0x40')]=function(_0x64ebf0){return request(_0x3005('0x41'),{'body':{},'options':{'where':_0x64ebf0}});}; \ 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 078d846..dc847d3 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 _0xd6d6=['exports','./polly','./lex'];(function(_0x1de8f9,_0x4b42ff){var _0x1a03dc=function(_0x42c883){while(--_0x42c883){_0x1de8f9['push'](_0x1de8f9['shift']());}};_0x1a03dc(++_0x4b42ff);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x1ef295,_0x3ed144){_0x1ef295=_0x1ef295-0x0;var _0x167ed9=_0xd6d6[_0x1ef295];return _0x167ed9;};var polly=require(_0x6d6d('0x0'));var lex=require(_0x6d6d('0x1'));module[_0x6d6d('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xb43b=['./polly','./lex'];(function(_0x705b98,_0x1c345b){var _0x47b72f=function(_0x44f02a){while(--_0x44f02a){_0x705b98['push'](_0x705b98['shift']());}};_0x47b72f(++_0x1c345b);}(_0xb43b,0x1b2));var _0xbb43=function(_0x31bb37,_0x529d9b){_0x31bb37=_0x31bb37-0x0;var _0x34facd=_0xb43b[_0x31bb37];return _0x34facd;};var polly=require(_0xbb43('0x0'));var lex=require(_0xbb43('0x1'));module['exports']={'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 55c9d6e..0fea6c8 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x16d2=['exports','./lib/api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x16d2,0x123));var _0x216d=function(_0x3a968e,_0x105c4d){_0x3a968e=_0x3a968e-0x0;var _0x9c978e=_0x16d2[_0x3a968e];return _0x9c978e;};'use strict';var lex=require(_0x216d('0x0'));module[_0x216d('0x1')]=function(_0x398c34,_0x371e93,_0x1688cc,_0x3a2589,_0x34cf5b,_0x239b49){return lex(_0x398c34,_0x371e93,_0x1688cc,_0x3a2589,_0x34cf5b,_0x239b49);}; \ No newline at end of file +var _0x68fc=['exports','./lib/api'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x68fc,0xa5));var _0xc68f=function(_0x56401a,_0x407085){_0x56401a=_0x56401a-0x0;var _0x17869e=_0x68fc[_0x56401a];return _0x17869e;};'use strict';var lex=require(_0xc68f('0x0'));module[_0xc68f('0x1')]=function(_0x324d44,_0x4de8c0,_0x49aa95,_0x26513f,_0x506fb5,_0xe70787){return lex(_0x324d44,_0x4de8c0,_0x49aa95,_0x26513f,_0x506fb5,_0xe70787);}; \ 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 e0351a4..1caffbd 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 _0xe14e=['slots','slot_','LexRuntime','$LATEST','bluebird','aws-sdk','postText'];(function(_0x152985,_0x256196){var _0x163470=function(_0x464ba4){while(--_0x464ba4){_0x152985['push'](_0x152985['shift']());}};_0x163470(++_0x256196);}(_0xe14e,0x1a1));var _0xee14=function(_0x40fee8,_0x122f8e){_0x40fee8=_0x40fee8-0x0;var _0x40ab1f=_0xe14e[_0x40fee8];return _0x40ab1f;};'use strict';var BPromise=require(_0xee14('0x0'));var AWS=require(_0xee14('0x1'));function lexResult(_0x3b536f,_0x1cb1b7){return new BPromise(function(_0x16c869,_0x8052aa){_0x3b536f[_0xee14('0x2')](_0x1cb1b7,function(_0x4b96ba,_0x30f4fe){if(_0x4b96ba){_0x8052aa(_0x4b96ba);}if(_0x30f4fe[_0xee14('0x3')]){for(const _0x4e75c7 in _0x30f4fe[_0xee14('0x3')]){if(_0x30f4fe[_0xee14('0x3')]['hasOwnProperty'](_0x4e75c7)){var _0x48ea11=_0x30f4fe[_0xee14('0x3')][_0x4e75c7];_0x30f4fe[_0xee14('0x4')+_0x4e75c7]=_0x48ea11;}}}_0x16c869(_0x30f4fe);});});}module['exports']=function(_0x1f45d4,_0x5a07b9,_0x930de4,_0x3f80ac,_0x33e761,_0x34bf24){var _0x50e4a0=new AWS[(_0xee14('0x5'))]({'accessKeyId':_0x5a07b9,'secretAccessKey':_0x930de4,'region':_0x3f80ac});var _0x31d080={'botAlias':_0xee14('0x6'),'botName':_0x34bf24,'inputText':_0x33e761,'userId':_0x1f45d4};return lexResult(_0x50e4a0,_0x31d080);}; \ No newline at end of file +var _0x0325=['slot_','exports','LexRuntime','$LATEST','aws-sdk','postText','slots'];(function(_0x39551a,_0x116007){var _0x4b0b62=function(_0x3d8a12){while(--_0x3d8a12){_0x39551a['push'](_0x39551a['shift']());}};_0x4b0b62(++_0x116007);}(_0x0325,0x1a8));var _0x5032=function(_0x47ff6d,_0x2ea51c){_0x47ff6d=_0x47ff6d-0x0;var _0x5e168f=_0x0325[_0x47ff6d];return _0x5e168f;};'use strict';var BPromise=require('bluebird');var AWS=require(_0x5032('0x0'));function lexResult(_0x5d9b36,_0x56c8d5){return new BPromise(function(_0x400d18,_0x301bce){_0x5d9b36[_0x5032('0x1')](_0x56c8d5,function(_0x39f2d0,_0x402cad){if(_0x39f2d0){_0x301bce(_0x39f2d0);}if(_0x402cad[_0x5032('0x2')]){for(const _0x5e9c8d in _0x402cad[_0x5032('0x2')]){if(_0x402cad[_0x5032('0x2')]['hasOwnProperty'](_0x5e9c8d)){var _0x2c6f35=_0x402cad[_0x5032('0x2')][_0x5e9c8d];_0x402cad[_0x5032('0x3')+_0x5e9c8d]=_0x2c6f35;}}}_0x400d18(_0x402cad);});});}module[_0x5032('0x4')]=function(_0x52d5c6,_0x420926,_0x3d4fa6,_0x510d36,_0x2bd613,_0x33b5c2){var _0x201831=new AWS[(_0x5032('0x5'))]({'accessKeyId':_0x420926,'secretAccessKey':_0x3d4fa6,'region':_0x510d36});var _0xcdde1f={'botAlias':_0x5032('0x6'),'botName':_0x33b5c2,'inputText':_0x2bd613,'userId':_0x52d5c6};return lexResult(_0x201831,_0xcdde1f);}; \ 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 52c0640..fc75bba 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 _0x2326=['exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2326,0xa0));var _0x6232=function(_0x40a98e,_0x5467e0){_0x40a98e=_0x40a98e-0x0;var _0x2fbb34=_0x2326[_0x40a98e];return _0x2fbb34;};'use strict';var polly=require('./lib/api');module[_0x6232('0x0')]=function(_0x2f9811,_0xc5fae1,_0xdda819,_0x521cf9,_0x1bb9d2,_0x5a6bdc,_0xa33df9){return polly(_0x2f9811,_0xc5fae1,_0xdda819,_0x521cf9,_0x1bb9d2,_0x5a6bdc,_0xa33df9);}; \ No newline at end of file +var _0xb4c1=['exports','./lib/api'];(function(_0x4fd489,_0x22abe4){var _0x132390=function(_0x5bc538){while(--_0x5bc538){_0x4fd489['push'](_0x4fd489['shift']());}};_0x132390(++_0x22abe4);}(_0xb4c1,0x115));var _0x1b4c=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xb4c1[_0x5d6456];return _0x4d66c1;};'use strict';var polly=require(_0x1b4c('0x0'));module[_0x1b4c('0x1')]=function(_0x30b895,_0x51fab1,_0x3b4952,_0xe9d90f,_0x8f27d5,_0x50a422,_0x1222fe){return polly(_0x30b895,_0x51fab1,_0x3b4952,_0xe9d90f,_0x8f27d5,_0x50a422,_0x1222fe);}; \ 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 31b1806..a74003e 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 _0x28b9=['writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','path','bluebird','aws-sdk','synthesizeSpeech'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x28b9,0x7e));var _0x928b=function(_0x63500b,_0x508aa1){_0x63500b=_0x63500b-0x0;var _0x492332=_0x28b9[_0x63500b];return _0x492332;};'use strict';var fs=require('fs');var path=require(_0x928b('0x0'));var BPromise=require(_0x928b('0x1'));var rs=require('randomstring');var AWS=require(_0x928b('0x2'));function pollyResult(_0x532c61,_0x101cf9,_0x2c0a17){return new BPromise(function(_0x26a5d3,_0x5ecc13){_0x532c61[_0x928b('0x3')](_0x101cf9,function(_0xa1bb3e,_0x1086c5){if(_0xa1bb3e){_0x5ecc13(_0xa1bb3e);}else if(_0x1086c5){if(_0x1086c5['AudioStream']instanceof Buffer){fs[_0x928b('0x4')](_0x2c0a17,_0x1086c5[_0x928b('0x5')],function(_0xbe3768){if(_0xbe3768){_0x5ecc13(_0xbe3768);}else{_0x26a5d3();}});}else{_0x5ecc13(new Error(_0x928b('0x6')));}}else{_0x5ecc13(new Error(_0x928b('0x7')));}});});}module[_0x928b('0x8')]=function(_0xf41820,_0x522090,_0x20964d,_0x160a97,_0x24f1ec,_0x59297d,_0x10f4b4){var _0x10d5bf=new AWS[(_0x928b('0x9'))]({'accessKeyId':_0xf41820,'secretAccessKey':_0x522090,'region':_0x20964d});var _0x448fb={'Text':_0x24f1ec,'TextType':_0x59297d||'text','OutputFormat':'mp3','VoiceId':_0x160a97};return pollyResult(_0x10d5bf,_0x448fb,_0x10f4b4);}; \ No newline at end of file +var _0x81e0=['text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly'];(function(_0x51ed62,_0x574379){var _0x34aee3=function(_0x2958bc){while(--_0x2958bc){_0x51ed62['push'](_0x51ed62['shift']());}};_0x34aee3(++_0x574379);}(_0x81e0,0x176));var _0x081e=function(_0x508c06,_0x1d3de7){_0x508c06=_0x508c06-0x0;var _0x16a897=_0x81e0[_0x508c06];return _0x16a897;};'use strict';var fs=require('fs');var path=require(_0x081e('0x0'));var BPromise=require(_0x081e('0x1'));var rs=require(_0x081e('0x2'));var AWS=require(_0x081e('0x3'));function pollyResult(_0x23622,_0x304b96,_0x37416b){return new BPromise(function(_0x4b0aab,_0x14ac20){_0x23622[_0x081e('0x4')](_0x304b96,function(_0x27e8c6,_0x55eafb){if(_0x27e8c6){_0x14ac20(_0x27e8c6);}else if(_0x55eafb){if(_0x55eafb['AudioStream']instanceof Buffer){fs[_0x081e('0x5')](_0x37416b,_0x55eafb['AudioStream'],function(_0x33008b){if(_0x33008b){_0x14ac20(_0x33008b);}else{_0x4b0aab();}});}else{_0x14ac20(new Error(_0x081e('0x6')));}}else{_0x14ac20(new Error(_0x081e('0x7')));}});});}module[_0x081e('0x8')]=function(_0x89f82d,_0x41148c,_0x46ab9f,_0x49b1fc,_0x44c786,_0x5733b7,_0x4a5c2f){var _0x160f11=new AWS[(_0x081e('0x9'))]({'accessKeyId':_0x89f82d,'secretAccessKey':_0x41148c,'region':_0x46ab9f});var _0x5be391={'Text':_0x44c786,'TextType':_0x5733b7||_0x081e('0xa'),'OutputFormat':_0x081e('0xb'),'VoiceId':_0x49b1fc};return pollyResult(_0x160f11,_0x5be391,_0x4a5c2f);}; \ 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 56d9031..68277aa 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 _0xcd09=['exports','./lib/api'];(function(_0x284506,_0x191316){var _0x1e9ee5=function(_0xe7eaa){while(--_0xe7eaa){_0x284506['push'](_0x284506['shift']());}};_0x1e9ee5(++_0x191316);}(_0xcd09,0xab));var _0x9cd0=function(_0x4a1e37,_0x2eef28){_0x4a1e37=_0x4a1e37-0x0;var _0xeb1f8b=_0xcd09[_0x4a1e37];return _0xeb1f8b;};'use strict';var asr=require(_0x9cd0('0x0'));module[_0x9cd0('0x1')]=function(_0x208210,_0x470e98,_0x141d02,_0xfadda7){return asr(_0x208210,_0x470e98,_0x141d02);}; \ No newline at end of file +var _0xf01b=['exports'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0xf01b,0x167));var _0xbf01=function(_0x44f067,_0x7c53ad){_0x44f067=_0x44f067-0x0;var _0x4236e4=_0xf01b[_0x44f067];return _0x4236e4;};'use strict';var asr=require('./lib/api');module[_0xbf01('0x0')]=function(_0xa651ea,_0x107303,_0x560e3d,_0x3c03e8){return asr(_0xa651ea,_0x107303,_0x560e3d);}; \ 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 6fab0f3..d59c6ea 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 _0x2153=['base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','exports','length','filepath\x20should\x20be\x20a\x20string','undefined','string','lang\x20should\x20be\x20a\x20string','readFileSync','toString'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x2153,0x6e));var _0x3215=function(_0x39a5d4,_0x3c72c2){_0x39a5d4=_0x39a5d4-0x0;var _0xb29a0c=_0x2153[_0x39a5d4];return _0xb29a0c;};'use strict';var url=require(_0x3215('0x0'));var BPromise=require(_0x3215('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x3215('0x2')]=function(_0x55f010,_0x59eeab,_0x18fc74){return new BPromise(function(_0x529336,_0x2f09dd){var _0x2a6c3e;if(typeof _0x55f010!=='string'||_0x55f010[_0x3215('0x3')]===0x0){return _0x2f09dd(_0x3215('0x4'));}if(typeof _0x59eeab!=='string'||_0x59eeab[_0x3215('0x3')]===0x0){return _0x2f09dd('key\x20should\x20be\x20a\x20string');}if(typeof _0x18fc74!==_0x3215('0x5')&&(typeof _0x18fc74!==_0x3215('0x6')||_0x18fc74[_0x3215('0x3')]===0x0)){return _0x2f09dd(_0x3215('0x7'));}try{_0x2a6c3e=fs[_0x3215('0x8')](_0x55f010)[_0x3215('0x9')](_0x3215('0xa'));}catch(_0x4312da){return _0x2f09dd(_0x4312da);}return _0x529336({'method':_0x3215('0xb'),'uri':host+_0x3215('0xc')+_0x59eeab,'body':{'config':{'encoding':_0x3215('0xd'),'sampleRateHertz':_0x3215('0xe'),'languageCode':_0x18fc74},'audio':{'content':_0x2a6c3e}},'json':!![]});});}; \ No newline at end of file +var _0x06fd=['string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','POST','/v1/speech:recognize?key=','url','bluebird','https://speech.googleapis.com'];(function(_0x5d1a07,_0x169a8d){var _0x458ece=function(_0x9467f4){while(--_0x9467f4){_0x5d1a07['push'](_0x5d1a07['shift']());}};_0x458ece(++_0x169a8d);}(_0x06fd,0xa8));var _0xd06f=function(_0x1a0600,_0x41feef){_0x1a0600=_0x1a0600-0x0;var _0x734670=_0x06fd[_0x1a0600];return _0x734670;};'use strict';var url=require(_0xd06f('0x0'));var BPromise=require(_0xd06f('0x1'));var fs=require('fs');var host=_0xd06f('0x2');module['exports']=function(_0x399ea2,_0x435dc0,_0x15481a){return new BPromise(function(_0x41ed31,_0x57658d){var _0x89db4;if(typeof _0x399ea2!==_0xd06f('0x3')||_0x399ea2[_0xd06f('0x4')]===0x0){return _0x57658d(_0xd06f('0x5'));}if(typeof _0x435dc0!==_0xd06f('0x3')||_0x435dc0[_0xd06f('0x4')]===0x0){return _0x57658d(_0xd06f('0x6'));}if(typeof _0x15481a!=='undefined'&&(typeof _0x15481a!==_0xd06f('0x3')||_0x15481a[_0xd06f('0x4')]===0x0)){return _0x57658d('lang\x20should\x20be\x20a\x20string');}try{_0x89db4=fs['readFileSync'](_0x399ea2)['toString']('base64');}catch(_0x355721){return _0x57658d(_0x355721);}return _0x41ed31({'method':_0xd06f('0x7'),'uri':host+_0xd06f('0x8')+_0x435dc0,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x15481a},'audio':{'content':_0x89db4}},'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 7cb48e2..329513f 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 _0xe742=['./asr'];(function(_0x1e81f6,_0x15e762){var _0xa05916=function(_0x319e21){while(--_0x319e21){_0x1e81f6['push'](_0x1e81f6['shift']());}};_0xa05916(++_0x15e762);}(_0xe742,0xa4));var _0x2e74=function(_0x220b24,_0x2e5d6c){_0x220b24=_0x220b24-0x0;var _0xbed38d=_0xe742[_0x220b24];return _0xbed38d;};var asr=require(_0x2e74('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x5a1b=['./asr','exports'];(function(_0x5b45cd,_0x2c84f4){var _0x49a830=function(_0x614c40){while(--_0x614c40){_0x5b45cd['push'](_0x5b45cd['shift']());}};_0x49a830(++_0x2c84f4);}(_0x5a1b,0xe6));var _0xb5a1=function(_0x5584e0,_0x561225){_0x5584e0=_0x5584e0-0x0;var _0x3bec24=_0x5a1b[_0x5584e0];return _0x3bec24;};var asr=require(_0xb5a1('0x0'));module[_0xb5a1('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 a57a49b..b00010e 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 _0x5baa=['speech','score','status','code','metadata','isFallbackIntent','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','model=%s','freeform=3','text','channelData','CustomAction','AudioFromTts','path','https','url','parse','randomstring','sox','request-promise','util','apiai-promise','md5','./google','./tilde','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','WHAT_EVER','get','statusCode','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','createWriteStream','finish','finish\x20download\x20file','unlink','error','download\x20error','pipe','end','https:','host','data','transcode','wav','error\x20convert','info','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','777','split','ssml','input','MP3','text:synthesize','POST','then','from','audioContent','base64','writeFile','chmodSync','resolve','.mp3','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','actionIncomplete','fulfillment'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x5baa,0x1b2));var _0xa5ba=function(_0x4eeda9,_0x28dc1d){_0x4eeda9=_0x4eeda9-0x0;var _0x3872b8=_0x5baa[_0x4eeda9];return _0x3872b8;};'use strict';var fs=require('fs');var path=require(_0xa5ba('0x0'));var http=require('http');var https=require(_0xa5ba('0x1'));var urlParse=require(_0xa5ba('0x2'))[_0xa5ba('0x3')];var BPromise=require('bluebird');var rs=require(_0xa5ba('0x4'));var sox=require(_0xa5ba('0x5'));var rp=require(_0xa5ba('0x6'));var util=require(_0xa5ba('0x7'));var querystring=require('querystring');var tts=require('google-tts-api');var apiai=require(_0xa5ba('0x8'));var md5=require(_0xa5ba('0x9'));var google=require(_0xa5ba('0xa'));var aws=require('./aws');var tilde=require(_0xa5ba('0xb'));var sestek=require(_0xa5ba('0xc'));var logger=require(_0xa5ba('0xd'))(_0xa5ba('0xe'));var ISPEECH_API=_0xa5ba('0xf');function downloadFile(_0x2f8da3,_0x580c3d){return new BPromise(function(_0x2a64d2,_0x39fb7c){var _0xde4ee5=urlParse(_0x2f8da3);var _0x21d3a1=_0xde4ee5[_0xa5ba('0x10')]==='https:'?https:http;var _0x54e8ac={'host':_0xde4ee5['host'],'path':_0xde4ee5[_0xa5ba('0x0')],'headers':{'user-agent':_0xa5ba('0x11')}};_0x21d3a1[_0xa5ba('0x12')](_0x54e8ac,function(_0x220def){if(_0x220def[_0xa5ba('0x13')]!==0xc8){logger['error']('request\x20to\x20'+_0x2f8da3+_0xa5ba('0x14')+_0x220def[_0xa5ba('0x13')]+'\x20('+_0x220def[_0xa5ba('0x15')]+')');_0x39fb7c(new Error(_0xa5ba('0x16')+_0x2f8da3+_0xa5ba('0x14')+_0x220def[_0xa5ba('0x13')]+'\x20('+_0x220def[_0xa5ba('0x15')]+')'));return;}var _0x587fc0=fs[_0xa5ba('0x17')](_0x580c3d);_0x587fc0['on'](_0xa5ba('0x18'),function(){logger['info'](_0xa5ba('0x19'));_0x587fc0['close'](_0x2a64d2);});_0x587fc0['on']('error',function(_0x54b7bb){fs[_0xa5ba('0x1a')](_0x580c3d);logger[_0xa5ba('0x1b')](_0xa5ba('0x1c'),_0x54b7bb);_0x39fb7c(_0x54b7bb);});_0x220def[_0xa5ba('0x1d')](_0x587fc0);})['on'](_0xa5ba('0x1b'),function(_0x1c9bd6){logger[_0xa5ba('0x1b')](_0x1c9bd6);_0x39fb7c(_0x1c9bd6);})[_0xa5ba('0x1e')]();});}function uploadFile(_0xfda229){return new BPromise(function(_0x24bdae,_0x589319){var _0x56c5df=urlParse(_0xfda229);var _0x243e6d=_0x56c5df[_0xa5ba('0x10')]===_0xa5ba('0x1f')?https:http;var _0x1c916b={'host':_0x56c5df[_0xa5ba('0x20')],'path':_0x56c5df[_0xa5ba('0x0')],'headers':{'user-agent':_0xa5ba('0x11')}};_0x243e6d['get'](_0x1c916b,function(_0x573653){if(_0x573653[_0xa5ba('0x13')]!==0xc8){_0x589319(new Error(_0xa5ba('0x16')+_0xfda229+_0xa5ba('0x14')+_0x573653[_0xa5ba('0x13')]+'\x20('+_0x573653['statusMessage']+')'));return;}var _0x545139='';_0x573653['on'](_0xa5ba('0x21'),function(_0x348b43){_0x545139+=_0x348b43;});_0x573653['on'](_0xa5ba('0x1e'),function(){_0x24bdae(_0x545139);});})['on']('error',function(_0x21d206){_0x589319(_0x21d206);})[_0xa5ba('0x1e')]();});}function convertFile(_0x992503,_0x11b904){return new BPromise(function(_0x19a15f,_0x8a8749){var _0x43376b=sox[_0xa5ba('0x22')](_0x992503,_0x11b904,{'sampleRate':0x1f40,'format':_0xa5ba('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x43376b['on'](_0xa5ba('0x1b'),function(_0x3686d9){logger[_0xa5ba('0x1b')](_0xa5ba('0x24'),_0x3686d9);_0x8a8749(_0x3686d9);});_0x43376b['on'](_0xa5ba('0x1e'),function(){logger[_0xa5ba('0x25')](_0xa5ba('0x26'));_0x19a15f();});_0x43376b[_0xa5ba('0x27')]();});}function base64Decode(_0x4bf3f9,_0x5958d5){var _0x4b6cbb=path['resolve'](__dirname,_0xa5ba('0x28'),rs[_0xa5ba('0x29')](0x4)+_0xa5ba('0x2a'));fs[_0xa5ba('0x2b')](_0x4b6cbb,_0x4bf3f9,'base64');return convertFile(_0x4b6cbb,_0x5958d5)['then'](function(){try{fs[_0xa5ba('0x1a')](_0x4b6cbb);fs['chmodSync'](_0x5958d5,_0xa5ba('0x2c'));}catch(_0x24174b){logger[_0xa5ba('0x1b')](_0x24174b);}return _0x5958d5[_0xa5ba('0x2d')]('.')[0x0];});}function base64Encode(_0x2d0895){var _0x872867=fs['readFileSync'](_0x2d0895);return new Buffer(_0x872867)['toString']('base64');}exports['googleCloudTTS']=function(_0x3ac144,_0x53e30a,_0x129e36,_0x495790,_0xad4b26,_0x1e8893){var _0x18946f,_0x22a6ae;var _0x343241='https://texttospeech.googleapis.com/v1/';var _0x2b3b1a='?key='+_0x3ac144;var _0x13bf4a={};if(_0x53e30a===_0xa5ba('0x2e')){_0x13bf4a[_0xa5ba('0x2f')]={'ssml':_0x129e36};}else{_0x13bf4a[_0xa5ba('0x2f')]={'text':_0x129e36};};_0x13bf4a['voice']={'languageCode':_0x495790,'ssmlGender':_0xad4b26};_0x13bf4a['audioConfig']={'audioEncoding':_0xa5ba('0x30'),'sampleRateHertz':0x1f40};var _0x5d3345={'url':_0x343241+_0xa5ba('0x31')+_0x2b3b1a,'method':_0xa5ba('0x32'),'json':!![],'body':_0x13bf4a};return rp(_0x5d3345)[_0xa5ba('0x33')](function(_0x22fb45){return new BPromise(function(_0x55744f,_0x1700c5){_0x18946f=path['resolve'](__dirname,_0xa5ba('0x28'),rs[_0xa5ba('0x29')](0x4)+'.mp3');var _0x50dc40=Buffer[_0xa5ba('0x34')](_0x22fb45[_0xa5ba('0x35')],_0xa5ba('0x36'));return fs[_0xa5ba('0x37')](_0x18946f,_0x50dc40,function(_0x2e712e){_0x1700c5(_0x2e712e);},function(_0x5c8276){fs[_0xa5ba('0x38')](_0x18946f,_0xa5ba('0x2c'));_0x55744f(_0x5c8276);});});})[_0xa5ba('0x33')](function(_0x54951a){_0x22a6ae=path[_0xa5ba('0x39')](__dirname,'tmp',rs[_0xa5ba('0x29')](0x4)+'.wav');return convertFile(_0x18946f,_0x22a6ae);})['then'](function(){try{fs['unlink'](_0x18946f);fs[_0xa5ba('0x38')](_0x22a6ae,_0xa5ba('0x2c'));}catch(_0x233d13){logger['error'](_0x233d13);}logger[_0xa5ba('0x25')]('googleCloudTTS\x20path',_0x22a6ae[_0xa5ba('0x2d')]('.')[0x0]);return _0x22a6ae[_0xa5ba('0x2d')]('.')[0x0];});};exports['googleTTS']=function(_0x385961,_0x1bac75){var _0x5cf185,_0x5c699c;return tts(_0x385961,_0x1bac75||'en',0x1)[_0xa5ba('0x33')](function(_0x531710){logger[_0xa5ba('0x25')](_0x531710);_0x5cf185=path[_0xa5ba('0x39')](__dirname,_0xa5ba('0x28'),rs[_0xa5ba('0x29')](0x4)+_0xa5ba('0x3a'));return downloadFile(_0x531710,_0x5cf185);})[_0xa5ba('0x33')](function(){_0x5c699c=path[_0xa5ba('0x39')](__dirname,_0xa5ba('0x28'),rs[_0xa5ba('0x29')](0x4)+'.wav');return convertFile(_0x5cf185,_0x5c699c);})[_0xa5ba('0x33')](function(){try{fs[_0xa5ba('0x1a')](_0x5cf185);fs[_0xa5ba('0x38')](_0x5c699c,_0xa5ba('0x2c'));}catch(_0x111cf5){logger[_0xa5ba('0x1b')](_0x111cf5);}logger[_0xa5ba('0x25')](_0xa5ba('0x3b'),_0x5c699c[_0xa5ba('0x2d')]('.')[0x0]);return _0x5c699c[_0xa5ba('0x2d')]('.')[0x0];});};exports['googleASR']=function(_0x23e6fe,_0x3fbf1d,_0x4e59a8){return google[_0xa5ba('0x3c')](_0x23e6fe,_0x3fbf1d,_0x4e59a8)[_0xa5ba('0x33')](function(_0x371cb1){logger[_0xa5ba('0x25')](_0x371cb1[_0xa5ba('0x3d')]);return rp(_0x371cb1);})[_0xa5ba('0x33')](function(_0x487ff7){var _0x518178='';var _0x4fe088=0x0;try{fs['unlink'](_0x23e6fe);}catch(_0x68481a){logger[_0xa5ba('0x1b')](_0x68481a);}if(_0x487ff7&&_0x487ff7[_0xa5ba('0x3e')]){_0x518178=_0x487ff7[_0xa5ba('0x3e')][_0xa5ba('0x3f')](function(_0x274eb7){return _0x274eb7&&_0x274eb7[_0xa5ba('0x40')][0x0]&&_0x274eb7['alternatives'][0x0][_0xa5ba('0x41')]?_0x274eb7[_0xa5ba('0x40')][0x0][_0xa5ba('0x41')]:'';})[_0xa5ba('0x42')]('\x0a');_0x4fe088=_0x487ff7['results']['map'](function(_0x4f1ad2){return _0x4f1ad2&&_0x4f1ad2['alternatives'][0x0]&&_0x4f1ad2[_0xa5ba('0x40')][0x0][_0xa5ba('0x43')]?_0x4f1ad2[_0xa5ba('0x40')][0x0][_0xa5ba('0x43')]:0x0;})['join']('\x0a');}logger['info'](_0xa5ba('0x44'),_0x518178);logger['info'](_0xa5ba('0x45'),_0x4fe088);return{'transcript':_0x518178,'confidence':_0x4fe088};})[_0xa5ba('0x46')](function(_0x20a6d0){logger[_0xa5ba('0x1b')](_0xa5ba('0x47'),_0x20a6d0[_0xa5ba('0x13')],_0x20a6d0[_0xa5ba('0x48')],_0x20a6d0['message']);});};exports[_0xa5ba('0x49')]=function(_0x5b4ea0,_0x1728e9,_0x22dc40,_0xeb00f0){var _0x48dac5=apiai(_0x1728e9,{'language':_0xeb00f0||'en'});return _0x48dac5[_0xa5ba('0x4a')](_0x22dc40,{'sessionId':md5(_0x5b4ea0)})[_0xa5ba('0x33')](function(_0x5733f4){logger[_0xa5ba('0x25')](JSON[_0xa5ba('0x4b')](_0x5733f4));return{'source':_0x5733f4[_0xa5ba('0x4c')][_0xa5ba('0x4d')],'resolvedQuery':_0x5733f4[_0xa5ba('0x4c')][_0xa5ba('0x4e')],'action':_0x5733f4[_0xa5ba('0x4c')]['action'],'actionIncomplete':_0x5733f4[_0xa5ba('0x4c')][_0xa5ba('0x4f')],'speech':_0x5733f4[_0xa5ba('0x4c')][_0xa5ba('0x50')][_0xa5ba('0x51')],'score':_0x5733f4['result'][_0xa5ba('0x52')],'statusCode':_0x5733f4[_0xa5ba('0x53')][_0xa5ba('0x54')],'endConversation':_0x5733f4['result'][_0xa5ba('0x55')]['endConversation']||![],'isFallbackIntent':_0x5733f4[_0xa5ba('0x4c')][_0xa5ba('0x55')][_0xa5ba('0x56')]};});};exports['tildeASR']=function(_0x266cb3,_0x8e49ab,_0x45b82f,_0x2e060b){return tilde[_0xa5ba('0x3c')](_0x266cb3,_0x8e49ab,_0x45b82f,_0x2e060b)['then'](function(_0x4b6728){try{fs[_0xa5ba('0x1a')](_0x266cb3);}catch(_0x194a86){logger['error'](_0x194a86);}logger[_0xa5ba('0x25')](_0xa5ba('0x57'),_0x4b6728[_0xa5ba('0x41')]);logger[_0xa5ba('0x25')](_0xa5ba('0x58'),_0x4b6728[_0xa5ba('0x43')]);return _0x4b6728;});};exports[_0xa5ba('0x59')]=function(_0x5babeb,_0x8069c9,_0x335ae3,_0x1b9a70,_0x7f4eab,_0x30038d){var _0x211da9=path['resolve'](__dirname,_0xa5ba('0x28'),rs['generate'](0x4)+_0xa5ba('0x3a'));var _0x3f7a0e;return aws[_0xa5ba('0x5a')](_0x5babeb,_0x8069c9,_0x335ae3,_0x1b9a70,_0x7f4eab,_0x30038d,_0x211da9)[_0xa5ba('0x33')](function(){_0x3f7a0e=path[_0xa5ba('0x39')](__dirname,'tmp',rs[_0xa5ba('0x29')](0x4)+_0xa5ba('0x2a'));return convertFile(_0x211da9,_0x3f7a0e);})[_0xa5ba('0x33')](function(){try{fs[_0xa5ba('0x1a')](_0x211da9);fs[_0xa5ba('0x38')](_0x3f7a0e,_0xa5ba('0x2c'));}catch(_0x2333a3){logger[_0xa5ba('0x1b')](_0x2333a3);}return _0x3f7a0e['split']('.')[0x0];});};exports[_0xa5ba('0x5b')]=function(_0x1709a0,_0x400be5,_0x556a8d,_0x1212e0,_0x36a851,_0x43c2ca){return aws[_0xa5ba('0x5c')](_0x1709a0,_0x400be5,_0x556a8d,_0x1212e0,_0x36a851,_0x43c2ca)[_0xa5ba('0x33')](function(_0x5da4d4){logger[_0xa5ba('0x25')](JSON[_0xa5ba('0x4b')](_0x5da4d4));return _0x5da4d4;});};exports[_0xa5ba('0x5d')]=function(_0x55c76d,_0x358a7f,_0x65ae9b,_0xf1c3c7){var _0x4150a0=util['format'](_0xa5ba('0x5e'),ISPEECH_API,_0x55c76d,encodeURIComponent(_0x358a7f),_0x65ae9b,_0xf1c3c7);var _0x1f6dac=path[_0xa5ba('0x39')](__dirname,'tmp',rs['generate'](0x4)+'.mp3');var _0x2180e8;return downloadFile(_0x4150a0,_0x1f6dac)['then'](function(){_0x2180e8=path[_0xa5ba('0x39')](__dirname,'tmp',rs[_0xa5ba('0x29')](0x4)+_0xa5ba('0x2a'));return convertFile(_0x1f6dac,_0x2180e8);})[_0xa5ba('0x33')](function(){try{fs[_0xa5ba('0x1a')](_0x1f6dac);fs[_0xa5ba('0x38')](_0x2180e8,'777');}catch(_0x352d6a){logger[_0xa5ba('0x1b')](_0x352d6a);}return _0x2180e8[_0xa5ba('0x2d')]('.')[0x0];});};exports[_0xa5ba('0x5f')]=function(_0x306ec4,_0x4547c8,_0x1db3ac,_0x3796ff){var _0x3457c0=util[_0xa5ba('0x60')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x4547c8,_0x1db3ac,base64Encode(_0x306ec4),_0x3796ff?util[_0xa5ba('0x60')](_0xa5ba('0x61'),encodeURIComponent(_0x3796ff)):_0xa5ba('0x62'));return uploadFile(_0x3457c0)[_0xa5ba('0x33')](function(_0x19fa8a){return querystring[_0xa5ba('0x3')](_0x19fa8a);});};exports['sestekNDA']=function(_0x45544a,_0x298942){return sestek['nda'](_0x45544a,_0x298942)['then'](function(_0x14b399){logger[_0xa5ba('0x25')](JSON[_0xa5ba('0x4b')](_0x14b399));var _0x5e28e6={'speech':_0x14b399[_0xa5ba('0x63')],'action':_0x14b399[_0xa5ba('0x64')]?_0x14b399[_0xa5ba('0x64')][_0xa5ba('0x65')]:undefined,'actiondata':_0x14b399[_0xa5ba('0x64')]?_0x14b399[_0xa5ba('0x64')]['CustomActionData']:undefined};if(_0x14b399['channelData']&&_0x14b399[_0xa5ba('0x64')][_0xa5ba('0x66')]){return base64Decode(_0x14b399[_0xa5ba('0x64')]['AudioFromTts']['Data'],path[_0xa5ba('0x39')](__dirname,'tmp',rs[_0xa5ba('0x29')](0x4)+_0xa5ba('0x2a')))[_0xa5ba('0x33')](function(_0x2bf5b1){_0x5e28e6['audiofile']=_0x2bf5b1;return _0x5e28e6;});}return _0x5e28e6;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x01ed=['statusMessage','createWriteStream','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','from','audioContent','writeFile','googleCloudTTS\x20path','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','action','status','code','metadata','isFallbackIntent','Tilde\x20ASR\x20confidence','awsPolly','.mp3','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','dirName','path','http','url','parse','bluebird','randomstring','request-promise','util','querystring','apiai-promise','md5','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20'];(function(_0x548e71,_0x27c13a){var _0x22b72f=function(_0x12f044){while(--_0x12f044){_0x548e71['push'](_0x548e71['shift']());}};_0x22b72f(++_0x27c13a);}(_0x01ed,0x179));var _0xd01e=function(_0x20f4ba,_0x4ddd29){_0x20f4ba=_0x20f4ba-0x0;var _0x2f6570=_0x01ed[_0x20f4ba];return _0x2f6570;};'use strict';var fs=require('fs');var path=require(_0xd01e('0x0'));var http=require(_0xd01e('0x1'));var https=require('https');var urlParse=require(_0xd01e('0x2'))[_0xd01e('0x3')];var BPromise=require(_0xd01e('0x4'));var rs=require(_0xd01e('0x5'));var sox=require('sox');var rp=require(_0xd01e('0x6'));var util=require(_0xd01e('0x7'));var querystring=require(_0xd01e('0x8'));var tts=require('google-tts-api');var apiai=require(_0xd01e('0x9'));var md5=require(_0xd01e('0xa'));var google=require(_0xd01e('0xb'));var aws=require('./aws');var tilde=require(_0xd01e('0xc'));var sestek=require('./sestek');var logger=require(_0xd01e('0xd'))(_0xd01e('0xe'));var ISPEECH_API=_0xd01e('0xf');function downloadFile(_0x3ede68,_0x5a1a48){return new BPromise(function(_0x484539,_0x2bb512){var _0x153d5e=urlParse(_0x3ede68);var _0x123e48=_0x153d5e[_0xd01e('0x10')]==='https:'?https:http;var _0xa6c3cb={'host':_0x153d5e[_0xd01e('0x11')],'path':_0x153d5e[_0xd01e('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0x123e48[_0xd01e('0x12')](_0xa6c3cb,function(_0x5bb311){if(_0x5bb311[_0xd01e('0x13')]!==0xc8){logger[_0xd01e('0x14')](_0xd01e('0x15')+_0x3ede68+_0xd01e('0x16')+_0x5bb311[_0xd01e('0x13')]+'\x20('+_0x5bb311['statusMessage']+')');_0x2bb512(new Error(_0xd01e('0x15')+_0x3ede68+'\x20failed,\x20status\x20code\x20=\x20'+_0x5bb311['statusCode']+'\x20('+_0x5bb311[_0xd01e('0x17')]+')'));return;}var _0x5f32e7=fs[_0xd01e('0x18')](_0x5a1a48);_0x5f32e7['on']('finish',function(){logger[_0xd01e('0x19')](_0xd01e('0x1a'));_0x5f32e7[_0xd01e('0x1b')](_0x484539);});_0x5f32e7['on'](_0xd01e('0x14'),function(_0x361cc0){fs[_0xd01e('0x1c')](_0x5a1a48);logger[_0xd01e('0x14')](_0xd01e('0x1d'),_0x361cc0);_0x2bb512(_0x361cc0);});_0x5bb311[_0xd01e('0x1e')](_0x5f32e7);})['on']('error',function(_0x2a5e55){logger[_0xd01e('0x14')](_0x2a5e55);_0x2bb512(_0x2a5e55);})[_0xd01e('0x1f')]();});}function uploadFile(_0x22f47c){return new BPromise(function(_0x584673,_0x2bd6f5){var _0x5d5272=urlParse(_0x22f47c);var _0xa38a95=_0x5d5272[_0xd01e('0x10')]==='https:'?https:http;var _0xc6d41d={'host':_0x5d5272[_0xd01e('0x11')],'path':_0x5d5272[_0xd01e('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0xa38a95['get'](_0xc6d41d,function(_0x5c7a33){if(_0x5c7a33[_0xd01e('0x13')]!==0xc8){_0x2bd6f5(new Error(_0xd01e('0x15')+_0x22f47c+_0xd01e('0x16')+_0x5c7a33['statusCode']+'\x20('+_0x5c7a33[_0xd01e('0x17')]+')'));return;}var _0x2d7b24='';_0x5c7a33['on'](_0xd01e('0x20'),function(_0x452d65){_0x2d7b24+=_0x452d65;});_0x5c7a33['on'](_0xd01e('0x1f'),function(){_0x584673(_0x2d7b24);});})['on'](_0xd01e('0x14'),function(_0x1fc363){_0x2bd6f5(_0x1fc363);})[_0xd01e('0x1f')]();});}function convertFile(_0x8400a5,_0x493cb3){return new BPromise(function(_0x20590e,_0x1e3b90){var _0x48da3c=sox[_0xd01e('0x21')](_0x8400a5,_0x493cb3,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x48da3c['on'](_0xd01e('0x14'),function(_0x12b8bd){logger[_0xd01e('0x14')](_0xd01e('0x22'),_0x12b8bd);_0x1e3b90(_0x12b8bd);});_0x48da3c['on']('end',function(){logger['info'](_0xd01e('0x23'));_0x20590e();});_0x48da3c[_0xd01e('0x24')]();});}function base64Decode(_0x5cea7b,_0x6ac8bf){var _0x2c8cc5=path[_0xd01e('0x25')](__dirname,_0xd01e('0x26'),rs[_0xd01e('0x27')](0x4)+_0xd01e('0x28'));fs['writeFileSync'](_0x2c8cc5,_0x5cea7b,_0xd01e('0x29'));return convertFile(_0x2c8cc5,_0x6ac8bf)[_0xd01e('0x2a')](function(){try{fs[_0xd01e('0x1c')](_0x2c8cc5);fs[_0xd01e('0x2b')](_0x6ac8bf,_0xd01e('0x2c'));}catch(_0x3d3319){logger[_0xd01e('0x14')](_0x3d3319);}return _0x6ac8bf[_0xd01e('0x2d')]('.')[0x0];});}function base64Encode(_0x338649){var _0x44da0d=fs[_0xd01e('0x2e')](_0x338649);return new Buffer(_0x44da0d)[_0xd01e('0x2f')](_0xd01e('0x29'));}exports[_0xd01e('0x30')]=function(_0x149741,_0x49f532,_0x346bb1,_0x19c786,_0x4518ac,_0x559ab5){var _0x4222ac,_0x24cbbe;var _0x27109a=_0xd01e('0x31');var _0x934d6e=_0xd01e('0x32')+_0x149741;var _0x242434={};if(_0x49f532==='ssml'){_0x242434[_0xd01e('0x33')]={'ssml':_0x346bb1};}else{_0x242434[_0xd01e('0x33')]={'text':_0x346bb1};};_0x242434[_0xd01e('0x34')]={'languageCode':_0x19c786,'ssmlGender':_0x4518ac};_0x242434[_0xd01e('0x35')]={'audioEncoding':_0xd01e('0x36'),'sampleRateHertz':0x1f40};var _0x13597a={'url':_0x27109a+'text:synthesize'+_0x934d6e,'method':'POST','json':!![],'body':_0x242434};return rp(_0x13597a)[_0xd01e('0x2a')](function(_0x232a41){return new BPromise(function(_0x33ef96,_0x3e189f){_0x4222ac=path['resolve'](__dirname,_0xd01e('0x26'),rs[_0xd01e('0x27')](0x4)+'.mp3');var _0x141045=Buffer[_0xd01e('0x37')](_0x232a41[_0xd01e('0x38')],_0xd01e('0x29'));return fs[_0xd01e('0x39')](_0x4222ac,_0x141045,function(_0x1dce26){_0x3e189f(_0x1dce26);},function(_0x1f18c9){fs[_0xd01e('0x2b')](_0x4222ac,_0xd01e('0x2c'));_0x33ef96(_0x1f18c9);});});})[_0xd01e('0x2a')](function(_0x203afa){_0x24cbbe=path[_0xd01e('0x25')](__dirname,_0xd01e('0x26'),rs['generate'](0x4)+_0xd01e('0x28'));return convertFile(_0x4222ac,_0x24cbbe);})['then'](function(){try{fs[_0xd01e('0x1c')](_0x4222ac);fs[_0xd01e('0x2b')](_0x24cbbe,_0xd01e('0x2c'));}catch(_0x1e24fe){logger['error'](_0x1e24fe);}logger[_0xd01e('0x19')](_0xd01e('0x3a'),_0x24cbbe[_0xd01e('0x2d')]('.')[0x0]);return _0x24cbbe[_0xd01e('0x2d')]('.')[0x0];});};exports['googleTTS']=function(_0x410db3,_0x286110){var _0x39cb96,_0x1a83e7;return tts(_0x410db3,_0x286110||'en',0x1)[_0xd01e('0x2a')](function(_0x1f4c0a){logger[_0xd01e('0x19')](_0x1f4c0a);_0x39cb96=path[_0xd01e('0x25')](__dirname,_0xd01e('0x26'),rs['generate'](0x4)+'.mp3');return downloadFile(_0x1f4c0a,_0x39cb96);})['then'](function(){_0x1a83e7=path[_0xd01e('0x25')](__dirname,_0xd01e('0x26'),rs['generate'](0x4)+_0xd01e('0x28'));return convertFile(_0x39cb96,_0x1a83e7);})['then'](function(){try{fs[_0xd01e('0x1c')](_0x39cb96);fs['chmodSync'](_0x1a83e7,_0xd01e('0x2c'));}catch(_0x264835){logger['error'](_0x264835);}logger[_0xd01e('0x19')](_0xd01e('0x3b'),_0x1a83e7[_0xd01e('0x2d')]('.')[0x0]);return _0x1a83e7[_0xd01e('0x2d')]('.')[0x0];});};exports[_0xd01e('0x3c')]=function(_0x54484e,_0x16d6d6,_0x265af2){return google[_0xd01e('0x3d')](_0x54484e,_0x16d6d6,_0x265af2)[_0xd01e('0x2a')](function(_0x292b1e){logger[_0xd01e('0x19')](_0x292b1e['uri']);return rp(_0x292b1e);})[_0xd01e('0x2a')](function(_0x2cddb3){var _0x3a1332='';var _0x3a80be=0x0;try{fs[_0xd01e('0x1c')](_0x54484e);}catch(_0x13af80){logger['error'](_0x13af80);}if(_0x2cddb3&&_0x2cddb3[_0xd01e('0x3e')]){_0x3a1332=_0x2cddb3[_0xd01e('0x3e')][_0xd01e('0x3f')](function(_0x122cf6){return _0x122cf6&&_0x122cf6[_0xd01e('0x40')][0x0]&&_0x122cf6['alternatives'][0x0][_0xd01e('0x41')]?_0x122cf6[_0xd01e('0x40')][0x0][_0xd01e('0x41')]:'';})['join']('\x0a');_0x3a80be=_0x2cddb3[_0xd01e('0x3e')][_0xd01e('0x3f')](function(_0x531b07){return _0x531b07&&_0x531b07[_0xd01e('0x40')][0x0]&&_0x531b07['alternatives'][0x0][_0xd01e('0x42')]?_0x531b07['alternatives'][0x0]['confidence']:0x0;})['join']('\x0a');}logger[_0xd01e('0x19')](_0xd01e('0x43'),_0x3a1332);logger[_0xd01e('0x19')](_0xd01e('0x44'),_0x3a80be);return{'transcript':_0x3a1332,'confidence':_0x3a80be};})[_0xd01e('0x45')](function(_0x6b2a3e){logger[_0xd01e('0x14')](_0xd01e('0x46'),_0x6b2a3e[_0xd01e('0x13')],_0x6b2a3e['name'],_0x6b2a3e[_0xd01e('0x47')]);});};exports[_0xd01e('0x48')]=function(_0x8aa044,_0x46cefc,_0x3f84e2,_0x49a078){var _0x3aebc5=apiai(_0x46cefc,{'language':_0x49a078||'en'});return _0x3aebc5[_0xd01e('0x49')](_0x3f84e2,{'sessionId':md5(_0x8aa044)})[_0xd01e('0x2a')](function(_0x2979a7){logger[_0xd01e('0x19')](JSON[_0xd01e('0x4a')](_0x2979a7));return{'source':_0x2979a7[_0xd01e('0x4b')][_0xd01e('0x4c')],'resolvedQuery':_0x2979a7[_0xd01e('0x4b')][_0xd01e('0x4d')],'action':_0x2979a7[_0xd01e('0x4b')][_0xd01e('0x4e')],'actionIncomplete':_0x2979a7[_0xd01e('0x4b')]['actionIncomplete'],'speech':_0x2979a7[_0xd01e('0x4b')]['fulfillment']['speech'],'score':_0x2979a7[_0xd01e('0x4b')]['score'],'statusCode':_0x2979a7[_0xd01e('0x4f')][_0xd01e('0x50')],'endConversation':_0x2979a7[_0xd01e('0x4b')][_0xd01e('0x51')]['endConversation']||![],'isFallbackIntent':_0x2979a7['result'][_0xd01e('0x51')][_0xd01e('0x52')]};});};exports['tildeASR']=function(_0x155ec9,_0x38814c,_0x14712a,_0x1c648b){return tilde[_0xd01e('0x3d')](_0x155ec9,_0x38814c,_0x14712a,_0x1c648b)[_0xd01e('0x2a')](function(_0x48dd27){try{fs[_0xd01e('0x1c')](_0x155ec9);}catch(_0x258a75){logger[_0xd01e('0x14')](_0x258a75);}logger[_0xd01e('0x19')]('Tilde\x20ASR\x20transcription',_0x48dd27[_0xd01e('0x41')]);logger[_0xd01e('0x19')](_0xd01e('0x53'),_0x48dd27['confidence']);return _0x48dd27;});};exports[_0xd01e('0x54')]=function(_0x352b21,_0x2c787a,_0x1074fc,_0x2f02bb,_0x2a4e00,_0x49198f){var _0x27f411=path[_0xd01e('0x25')](__dirname,_0xd01e('0x26'),rs[_0xd01e('0x27')](0x4)+_0xd01e('0x55'));var _0x42c0e4;return aws['polly'](_0x352b21,_0x2c787a,_0x1074fc,_0x2f02bb,_0x2a4e00,_0x49198f,_0x27f411)[_0xd01e('0x2a')](function(){_0x42c0e4=path[_0xd01e('0x25')](__dirname,_0xd01e('0x26'),rs['generate'](0x4)+_0xd01e('0x28'));return convertFile(_0x27f411,_0x42c0e4);})['then'](function(){try{fs['unlink'](_0x27f411);fs[_0xd01e('0x2b')](_0x42c0e4,_0xd01e('0x2c'));}catch(_0x9b98c4){logger['error'](_0x9b98c4);}return _0x42c0e4['split']('.')[0x0];});};exports['awsLex']=function(_0x280d04,_0x5beed6,_0x28248f,_0x5f0f75,_0x1bc6a5,_0x4702df){return aws[_0xd01e('0x56')](_0x280d04,_0x5beed6,_0x28248f,_0x5f0f75,_0x1bc6a5,_0x4702df)['then'](function(_0x177a94){logger['info'](JSON[_0xd01e('0x4a')](_0x177a94));return _0x177a94;});};exports[_0xd01e('0x57')]=function(_0x225d3d,_0x558ccd,_0x1d929b,_0x21b125){var _0x5357e4=util[_0xd01e('0x58')](_0xd01e('0x59'),ISPEECH_API,_0x225d3d,encodeURIComponent(_0x558ccd),_0x1d929b,_0x21b125);var _0x493658=path['resolve'](__dirname,_0xd01e('0x26'),rs[_0xd01e('0x27')](0x4)+'.mp3');var _0x48d2bb;return downloadFile(_0x5357e4,_0x493658)[_0xd01e('0x2a')](function(){_0x48d2bb=path[_0xd01e('0x25')](__dirname,_0xd01e('0x26'),rs[_0xd01e('0x27')](0x4)+'.wav');return convertFile(_0x493658,_0x48d2bb);})[_0xd01e('0x2a')](function(){try{fs[_0xd01e('0x1c')](_0x493658);fs[_0xd01e('0x2b')](_0x48d2bb,'777');}catch(_0x4fb355){logger['error'](_0x4fb355);}return _0x48d2bb[_0xd01e('0x2d')]('.')[0x0];});};exports['ispeechASR']=function(_0x1021b5,_0x3b74a1,_0x2ec6da,_0x1442c0){var _0x25472f=util[_0xd01e('0x58')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x3b74a1,_0x2ec6da,base64Encode(_0x1021b5),_0x1442c0?util[_0xd01e('0x58')]('model=%s',encodeURIComponent(_0x1442c0)):_0xd01e('0x5a'));return uploadFile(_0x25472f)['then'](function(_0x4dbce9){return querystring['parse'](_0x4dbce9);});};exports[_0xd01e('0x5b')]=function(_0x2d1985,_0x2a78cf){return sestek[_0xd01e('0x5c')](_0x2d1985,_0x2a78cf)['then'](function(_0x2d55fd){logger[_0xd01e('0x19')](JSON['stringify'](_0x2d55fd));var _0x1a52fb={'speech':_0x2d55fd[_0xd01e('0x5d')],'action':_0x2d55fd['channelData']?_0x2d55fd[_0xd01e('0x5e')][_0xd01e('0x5f')]:undefined,'actiondata':_0x2d55fd['channelData']?_0x2d55fd[_0xd01e('0x5e')][_0xd01e('0x60')]:undefined};if(_0x2d55fd['channelData']&&_0x2d55fd['channelData']['AudioFromTts']){return base64Decode(_0x2d55fd[_0xd01e('0x5e')][_0xd01e('0x61')][_0xd01e('0x62')],path['resolve'](__dirname,_0xd01e('0x26'),rs[_0xd01e('0x27')](0x4)+_0xd01e('0x28')))['then'](function(_0x175809){_0x1a52fb['audiofile']=_0x175809;return _0x1a52fb;});}return _0x1a52fb;});};exports[_0xd01e('0x63')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 3042b46..df0f78a 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 _0xf4f1=['exports'];(function(_0x555c5e,_0x120e1d){var _0x550669=function(_0x48d0c6){while(--_0x48d0c6){_0x555c5e['push'](_0x555c5e['shift']());}};_0x550669(++_0x120e1d);}(_0xf4f1,0x1a2));var _0x1f4f=function(_0x508a77,_0x610279){_0x508a77=_0x508a77-0x0;var _0x3d8fda=_0xf4f1[_0x508a77];return _0x3d8fda;};var nda=require('./nda');module[_0x1f4f('0x0')]={'nda':nda}; \ No newline at end of file +var _0xdd84=['./nda','exports'];(function(_0x3ae37b,_0x55be03){var _0x53a62b=function(_0x26ca28){while(--_0x26ca28){_0x3ae37b['push'](_0x3ae37b['shift']());}};_0x53a62b(++_0x55be03);}(_0xdd84,0x174));var _0x4dd8=function(_0x4d0fff,_0x33f88b){_0x4d0fff=_0x4d0fff-0x0;var _0x364cdd=_0xdd84[_0x4d0fff];return _0x364cdd;};var nda=require(_0x4dd8('0x0'));module[_0x4dd8('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 2fd9a84..364139a 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 _0x85af=['access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','custom_action_data','info','request-promise','agi','exports','POST','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','calleridname','dnid','extension','text','Bearer\x20'];(function(_0x426257,_0x1f0a84){var _0x1aedf3=function(_0xb44304){while(--_0xb44304){_0x426257['push'](_0x426257['shift']());}};_0x1aedf3(++_0x1f0a84);}(_0x85af,0x119));var _0xf85a=function(_0x2af2ec,_0xde4a27){_0x2af2ec=_0x2af2ec-0x0;var _0x17f012=_0x85af[_0x2af2ec];return _0x17f012;};'use strict';var rp=require(_0xf85a('0x0'));var url=require('url');var logger=require('../../../../../config/logger')(_0xf85a('0x1'));module[_0xf85a('0x2')]=function(_0xa4b22c,_0x5ef7a6){var _0xf0a6d2={'method':_0xf85a('0x3'),'uri':url['resolve'](_0x5ef7a6['ndauth_url'],'/token'),'form':{'grant_type':'password','username':_0x5ef7a6['username'],'password':_0x5ef7a6['password']},'json':!![]};return rp(_0xf0a6d2)['then'](function(_0x1dc0c0){var _0x416f29={'method':_0xf85a('0x3'),'uri':url[_0xf85a('0x4')](_0x5ef7a6[_0xf85a('0x5')],_0xf85a('0x6')),'body':{'type':_0x5ef7a6[_0xf85a('0x7')]||_0xf85a('0x8'),'channelId':_0xf85a('0x9'),'conversation':{'id':_0xa4b22c['uniqueid']},'from':{'id':_0xa4b22c[_0xf85a('0xa')],'name':_0xa4b22c[_0xf85a('0xb')]},'recipient':{'id':_0xa4b22c[_0xf85a('0xc')],'name':_0xa4b22c[_0xf85a('0xd')]},'text':_0x5ef7a6[_0xf85a('0xe')],'channelData':{}},'headers':{'Authorization':_0xf85a('0xf')+_0x1dc0c0[_0xf85a('0x10')]},'json':!![]};if(_0x5ef7a6[_0xf85a('0x11')]){_0x416f29[_0xf85a('0x12')][_0xf85a('0x13')][_0xf85a('0x14')]=_0x5ef7a6[_0xf85a('0x11')];}if(_0x5ef7a6[_0xf85a('0x15')]=='1'){_0x416f29[_0xf85a('0x12')]['channelData'][_0xf85a('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xf85a('0x17')};}if(_0x5ef7a6[_0xf85a('0x18')]){_0x416f29['body'][_0xf85a('0x13')]['CustomAction']=_0x5ef7a6[_0xf85a('0x18')];if(_0x5ef7a6[_0xf85a('0x19')]){_0x416f29['body'][_0xf85a('0x13')]['CustomActionData']=_0x5ef7a6[_0xf85a('0x19')];}}logger[_0xf85a('0x1a')](JSON['stringify'](_0x416f29));return rp(_0x416f29);});}; \ No newline at end of file +var _0x0227=['custom_action_data','CustomActionData','stringify','request-promise','url','../../../../../config/logger','agi','exports','ndauth_url','/token','password','username','then','resolve','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action'];(function(_0x1067a1,_0x9d96b3){var _0x4ee127=function(_0x42da7f){while(--_0x42da7f){_0x1067a1['push'](_0x1067a1['shift']());}};_0x4ee127(++_0x9d96b3);}(_0x0227,0x1b0));var _0x7022=function(_0x2b1d7c,_0x54c15c){_0x2b1d7c=_0x2b1d7c-0x0;var _0x7d77df=_0x0227[_0x2b1d7c];return _0x7d77df;};'use strict';var rp=require(_0x7022('0x0'));var url=require(_0x7022('0x1'));var logger=require(_0x7022('0x2'))(_0x7022('0x3'));module[_0x7022('0x4')]=function(_0x1e6f2f,_0x56660e){var _0x328625={'method':'POST','uri':url['resolve'](_0x56660e[_0x7022('0x5')],_0x7022('0x6')),'form':{'grant_type':_0x7022('0x7'),'username':_0x56660e[_0x7022('0x8')],'password':_0x56660e['password']},'json':!![]};return rp(_0x328625)[_0x7022('0x9')](function(_0x201d59){var _0x496ccb={'method':'POST','uri':url[_0x7022('0xa')](_0x56660e['ndassistant_url'],_0x7022('0xb')),'body':{'type':_0x56660e[_0x7022('0xc')]||_0x7022('0xd'),'channelId':_0x7022('0xe'),'conversation':{'id':_0x1e6f2f[_0x7022('0xf')]},'from':{'id':_0x1e6f2f[_0x7022('0x10')],'name':_0x1e6f2f[_0x7022('0x11')]},'recipient':{'id':_0x1e6f2f[_0x7022('0x12')],'name':_0x1e6f2f[_0x7022('0x13')]},'text':_0x56660e[_0x7022('0x14')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x201d59[_0x7022('0x15')]},'json':!![]};if(_0x56660e[_0x7022('0x16')]){_0x496ccb[_0x7022('0x17')][_0x7022('0x18')][_0x7022('0x19')]=_0x56660e[_0x7022('0x16')];}if(_0x56660e[_0x7022('0x1a')]=='1'){_0x496ccb[_0x7022('0x17')][_0x7022('0x18')][_0x7022('0x1b')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x7022('0x1c')};}if(_0x56660e[_0x7022('0x1d')]){_0x496ccb['body']['channelData']['CustomAction']=_0x56660e[_0x7022('0x1d')];if(_0x56660e[_0x7022('0x1e')]){_0x496ccb[_0x7022('0x17')][_0x7022('0x18')][_0x7022('0x1f')]=_0x56660e['custom_action_data'];}}logger['info'](JSON[_0x7022('0x20')](_0x496ccb));return rp(_0x496ccb);});}; \ 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 d9a76ea..3c7a591 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 _0xbb68=['./lib/api','exports'];(function(_0x204ed4,_0x150b9b){var _0x1df2a2=function(_0x2a8f6a){while(--_0x2a8f6a){_0x204ed4['push'](_0x204ed4['shift']());}};_0x1df2a2(++_0x150b9b);}(_0xbb68,0x1e4));var _0x8bb6=function(_0x2c52c0,_0x1661e7){_0x2c52c0=_0x2c52c0-0x0;var _0x495c10=_0xbb68[_0x2c52c0];return _0x495c10;};'use strict';var asr=require(_0x8bb6('0x0'));module[_0x8bb6('0x1')]=function(_0x4955ae,_0xbb0bb1,_0x13645b,_0x224a87){return asr(_0x4955ae,_0xbb0bb1,_0x13645b,_0x224a87);}; \ No newline at end of file +var _0x14f6=['exports','./lib/api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x14f6,0xc3));var _0x614f=function(_0x4c91aa,_0x448609){_0x4c91aa=_0x4c91aa-0x0;var _0x452f39=_0x14f6[_0x4c91aa];return _0x452f39;};'use strict';var asr=require(_0x614f('0x0'));module[_0x614f('0x1')]=function(_0x208514,_0x564e47,_0x313d97,_0x3d4366){return asr(_0x208514,_0x564e47,_0x313d97,_0x3d4366);}; \ 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 1a52839..ada40c7 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 _0xa7ae=['data','EOS','error','Tilde\x20ASR\x20send\x20error','parse','status','result','hypotheses','transcript','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','terminate','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','close','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','sha1','update','Open\x20Tilde\x20ASR\x20socket','unix','stringify','createReadStream'];(function(_0x470210,_0xc10d77){var _0x44361a=function(_0xf8155){while(--_0xf8155){_0x470210['push'](_0x470210['shift']());}};_0x44361a(++_0xc10d77);}(_0xa7ae,0xb0));var _0xea7a=function(_0x58f4de,_0x25c683){_0x58f4de=_0x58f4de-0x0;var _0xc9e1cd=_0xa7ae[_0x58f4de];return _0xc9e1cd;};'use strict';var BPromise=require(_0xea7a('0x0'));var _=require(_0xea7a('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xea7a('0x2'));var crypto=require(_0xea7a('0x3'));var logger=require(_0xea7a('0x4'))(_0xea7a('0x5'));module['exports']=function(_0x5d43e5,_0x3a4623,_0x247306,_0x519ec7){return new BPromise(function(_0xd40bf7,_0x37d367){logger[_0xea7a('0x6')]('Tilde\x20URI',_0x519ec7||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x436435=new WebSocket(_0x519ec7||_0xea7a('0x7'),{'perMessageDeflate':![]});var _0x4446af='';var _0x1b720c='0';var _0x8edaef='1';var _0x34a0f9='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x34b59f(_0x3b0929){var _0x2abcbc=crypto['createHash'](_0xea7a('0x8'));_0x2abcbc[_0xea7a('0x9')](_0x3b0929);return _0x2abcbc['digest']('hex');}function _0x4c9f7d(){try{logger[_0xea7a('0x6')](_0xea7a('0xa'));var _0x50ebda=moment()[_0xea7a('0xb')]();var _0x2a95d2=_0x34b59f(_0x50ebda+_0x3a4623+_0x247306);_0x436435['send'](JSON[_0xea7a('0xc')]({'appID':_0x3a4623,'timestamp':_0x50ebda,'appKey':_0x2a95d2}));var _0xa9e78=fs[_0xea7a('0xd')](_0x5d43e5);_0xa9e78['on'](_0xea7a('0xe'),function(_0x1c347a){_0x436435['send'](_0x1c347a);});_0xa9e78['on']('close',function(){_0x436435['send'](_0xea7a('0xf'));});}catch(_0x3864b6){logger[_0xea7a('0x10')](_0xea7a('0x11'),JSON[_0xea7a('0xc')](_0x3864b6));_0x436435['terminate']();}}function _0x5e1630(_0x38db79){try{if(_0x38db79){var _0x3b443f=JSON[_0xea7a('0x12')](_0x38db79);switch(_0x3b443f[_0xea7a('0x13')]){case 0x0:if(_0x3b443f['result']){if(_0x3b443f[_0xea7a('0x14')]['final']){logger['info']('Tilde\x20ASR\x20hypoteses',JSON[_0xea7a('0xc')](_0x3b443f[_0xea7a('0x14')][_0xea7a('0x15')]));_0x4446af=_0x3b443f[_0xea7a('0x14')][_0xea7a('0x15')][0x0][_0xea7a('0x16')];_0x1b720c=_0x3b443f[_0xea7a('0x14')][_0xea7a('0x15')][0x0][_0xea7a('0x17')];_0x8edaef='0';_0x34a0f9=_0xea7a('0x18');_0x436435['terminate']();}}break;case 0x1:logger[_0xea7a('0x6')](_0xea7a('0x19'));_0x8edaef='1';_0x34a0f9='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xea7a('0x6')](_0xea7a('0x1a'));_0x8edaef='2';_0x34a0f9=_0xea7a('0x1a');break;case 0x9:logger['info'](_0xea7a('0x1b'));_0x8edaef='9';_0x34a0f9=_0xea7a('0x1b');break;case 0xa:logger['info'](_0xea7a('0x1c'));_0x8edaef='10';_0x34a0f9=_0xea7a('0x1c');break;case 0xb:logger[_0xea7a('0x6')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x8edaef='11';_0x34a0f9=_0xea7a('0x1d');}}}catch(_0x99686d){logger[_0xea7a('0x10')](_0xea7a('0x1e'),JSON[_0xea7a('0xc')](_0x99686d));_0x436435[_0xea7a('0x1f')]();}}function _0x875fb1(){logger[_0xea7a('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0xd40bf7({'transcript':_0x4446af,'confidence':_0x1b720c,'status':_0x8edaef,'status_message':_0x34a0f9});}function _0x5e1e14(_0x260f0f){logger[_0xea7a('0x10')](_0xea7a('0x20'));if(!_[_0xea7a('0x21')](_0x260f0f)){logger[_0xea7a('0x10')](_[_0xea7a('0x22')](_0x260f0f)?JSON['stringify'](_0x260f0f):_0x260f0f);}}_0x436435['on'](_0xea7a('0x23'),_0x4c9f7d);_0x436435['on'](_0xea7a('0x24'),_0x5e1630);_0x436435['on'](_0xea7a('0x25'),_0x875fb1);_0x436435['on']('error',_0x5e1e14);});}; \ No newline at end of file +var _0x13b6=['hypotheses','transcript','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','hex','info','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','parse','status','result','final','Tilde\x20ASR\x20hypoteses'];(function(_0x2391cf,_0x24c684){var _0x5e82f2=function(_0x30c1a9){while(--_0x30c1a9){_0x2391cf['push'](_0x2391cf['shift']());}};_0x5e82f2(++_0x24c684);}(_0x13b6,0x189));var _0x613b=function(_0x4a16df,_0x557a6b){_0x4a16df=_0x4a16df-0x0;var _0x5c1239=_0x13b6[_0x4a16df];return _0x5c1239;};'use strict';var BPromise=require(_0x613b('0x0'));var _=require(_0x613b('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x613b('0x2'));var crypto=require(_0x613b('0x3'));var logger=require(_0x613b('0x4'))(_0x613b('0x5'));module[_0x613b('0x6')]=function(_0x547859,_0x53a067,_0x100efa,_0x5af040){return new BPromise(function(_0x76a373,_0xafe527){logger['info']('Tilde\x20URI',_0x5af040||_0x613b('0x7'));var _0x589225=new WebSocket(_0x5af040||_0x613b('0x7'),{'perMessageDeflate':![]});var _0x1f057f='';var _0x2e5099='0';var _0x18408d='1';var _0x4f355f=_0x613b('0x8');function _0x18ba9a(_0x1c3d26){var _0x29ea9d=crypto[_0x613b('0x9')]('sha1');_0x29ea9d[_0x613b('0xa')](_0x1c3d26);return _0x29ea9d[_0x613b('0xb')](_0x613b('0xc'));}function _0x5667d6(){try{logger[_0x613b('0xd')](_0x613b('0xe'));var _0x422845=moment()['unix']();var _0x3fa248=_0x18ba9a(_0x422845+_0x53a067+_0x100efa);_0x589225[_0x613b('0xf')](JSON[_0x613b('0x10')]({'appID':_0x53a067,'timestamp':_0x422845,'appKey':_0x3fa248}));var _0x19272c=fs[_0x613b('0x11')](_0x547859);_0x19272c['on'](_0x613b('0x12'),function(_0x5c4814){_0x589225[_0x613b('0xf')](_0x5c4814);});_0x19272c['on'](_0x613b('0x13'),function(){_0x589225[_0x613b('0xf')]('EOS');});}catch(_0x44bf35){logger[_0x613b('0x14')](_0x613b('0x15'),JSON[_0x613b('0x10')](_0x44bf35));_0x589225['terminate']();}}function _0x4bc2fd(_0x187cff){try{if(_0x187cff){var _0x1bcfff=JSON[_0x613b('0x16')](_0x187cff);switch(_0x1bcfff[_0x613b('0x17')]){case 0x0:if(_0x1bcfff[_0x613b('0x18')]){if(_0x1bcfff[_0x613b('0x18')][_0x613b('0x19')]){logger['info'](_0x613b('0x1a'),JSON['stringify'](_0x1bcfff[_0x613b('0x18')][_0x613b('0x1b')]));_0x1f057f=_0x1bcfff['result'][_0x613b('0x1b')][0x0][_0x613b('0x1c')];_0x2e5099=_0x1bcfff[_0x613b('0x18')][_0x613b('0x1b')][0x0][_0x613b('0x1d')];_0x18408d='0';_0x4f355f=_0x613b('0x1e');_0x589225[_0x613b('0x1f')]();}}break;case 0x1:logger[_0x613b('0xd')](_0x613b('0x8'));_0x18408d='1';_0x4f355f='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x613b('0xd')](_0x613b('0x20'));_0x18408d='2';_0x4f355f='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x613b('0xd')](_0x613b('0x21'));_0x18408d='9';_0x4f355f=_0x613b('0x21');break;case 0xa:logger[_0x613b('0xd')]('Authentication\x20failed.');_0x18408d='10';_0x4f355f=_0x613b('0x22');break;case 0xb:logger[_0x613b('0xd')](_0x613b('0x23'));_0x18408d='11';_0x4f355f=_0x613b('0x23');}}}catch(_0x1dc830){logger[_0x613b('0x14')](_0x613b('0x24'),JSON[_0x613b('0x10')](_0x1dc830));_0x589225[_0x613b('0x1f')]();}}function _0x4a1480(){logger[_0x613b('0xd')]('Close\x20Tilde\x20ASR\x20socket');_0x76a373({'transcript':_0x1f057f,'confidence':_0x2e5099,'status':_0x18408d,'status_message':_0x4f355f});}function _0x4e4176(_0x129387){logger[_0x613b('0x14')](_0x613b('0x25'));if(!_[_0x613b('0x26')](_0x129387)){logger[_0x613b('0x14')](_[_0x613b('0x27')](_0x129387)?JSON[_0x613b('0x10')](_0x129387):_0x129387);}}_0x589225['on'](_0x613b('0x28'),_0x5667d6);_0x589225['on'](_0x613b('0x29'),_0x4bc2fd);_0x589225['on'](_0x613b('0x13'),_0x4a1480);_0x589225['on'](_0x613b('0x14'),_0x4e4176);});}; \ 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 7c45a42..650b6a7 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 _0x3970=['./asr','exports'];(function(_0x4126b1,_0x467a88){var _0x3acefb=function(_0x10b923){while(--_0x10b923){_0x4126b1['push'](_0x4126b1['shift']());}};_0x3acefb(++_0x467a88);}(_0x3970,0x1d4));var _0x0397=function(_0x1c0f41,_0x26d95d){_0x1c0f41=_0x1c0f41-0x0;var _0x369a9f=_0x3970[_0x1c0f41];return _0x369a9f;};var asr=require(_0x0397('0x0'));module[_0x0397('0x1')]={'asr':asr}; \ No newline at end of file +var _0xb30e=['exports'];(function(_0x3a0b75,_0x4febbf){var _0x45505e=function(_0x3e806f){while(--_0x3e806f){_0x3a0b75['push'](_0x3a0b75['shift']());}};_0x45505e(++_0x4febbf);}(_0xb30e,0x17d));var _0xeb30=function(_0x2caf41,_0x5b398e){_0x2caf41=_0x2caf41-0x0;var _0x5ca4de=_0xb30e[_0x2caf41];return _0x5ca4de;};var asr=require('./asr');module[_0xeb30('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index dc17972..274153e 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 _0x2917=['events','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2917,0x142));var _0x7291=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x2917[_0x49ca18];return _0x145d54;};'use strict';var util=require(_0x7291('0x0'));var net=require(_0x7291('0x1'));var EventEmitter=require(_0x7291('0x2'))[_0x7291('0x3')];var AGIError=require(_0x7291('0x4'));var AGIChannel=require(_0x7291('0x5'));var AGIServer=function(_0x90e67,_0x535c15,_0x5d5d51){var _0x22afb9=this,_0x90e67=_0x90e67||0x11dd,_0x535c15=_0x535c15||_0x7291('0x6'),_0x6aac19=null,_0x1ee790=0x0;EventEmitter[_0x7291('0x7')](_0x22afb9);function _0x1f0fd8(){if(!_0x90e67){_0x22afb9[_0x7291('0x8')](_0x7291('0x9'),new AGIError(_0x7291('0xa')));return![];}_0x6aac19=net[_0x7291('0xb')]();_0x6aac19[_0x7291('0xc')](_0x90e67,_0x535c15);_0x6aac19['on'](_0x7291('0xd'),function(){_0x22afb9[_0x7291('0x8')]('listening');});_0x6aac19['on'](_0x7291('0xe'),function(_0x9e681a){_0x6aac19[_0x7291('0xf')](function(_0x463e52,_0x2beb53){if(_0x463e52){_0x22afb9[_0x7291('0x8')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x463e52));}else if(_0x5d5d51&&_0x5d5d51<0x0){_0x22afb9[_0x7291('0x8')](_0x7291('0x9'),new AGIError(_0x7291('0x10')));_0x9e681a[_0x7291('0x11')]();}else if(_0x5d5d51&&_0x5d5d51>0x0&&_0x5d5d51<_0x2beb53){_0x1ee790+=0x1;_0x22afb9[_0x7291('0x8')](_0x7291('0x9'),new AGIError(_0x7291('0x12'),_0x1ee790));_0x9e681a['destroy']();}else{var _0xa667c8=new AGIChannel(_0x9e681a);_0xa667c8['on'](_0x7291('0x13'),function(){_0x22afb9[_0x7291('0x8')]('connection',_0xa667c8);});}});});_0x6aac19['on']('error',function(_0x34808c){_0x22afb9[_0x7291('0x8')](_0x7291('0x9'),new AGIError(_0x7291('0x14'),_0x34808c[_0x7291('0x15')]));});_0x6aac19['on'](_0x7291('0x16'),function(){_0x22afb9['emit'](_0x7291('0x16'),new AGIError(_0x7291('0x17')));});}process[_0x7291('0x18')](function(){_0x1f0fd8();});};util[_0x7291('0x19')](AGIServer,EventEmitter);module[_0x7291('0x1a')]=function(_0x4f6fea,_0x365e3c,_0x52d5a7){return new AGIServer(_0x4f6fea,_0x365e3c,_0x52d5a7);}; \ No newline at end of file +var _0xd0bb=['getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','./error','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection'];(function(_0x34121c,_0x229400){var _0x461cfc=function(_0x564eed){while(--_0x564eed){_0x34121c['push'](_0x34121c['shift']());}};_0x461cfc(++_0x229400);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x3ea343,_0x168e7e){_0x3ea343=_0x3ea343-0x0;var _0x1ae8e5=_0xd0bb[_0x3ea343];return _0x1ae8e5;};'use strict';var util=require(_0xbd0b('0x0'));var net=require(_0xbd0b('0x1'));var EventEmitter=require(_0xbd0b('0x2'))['EventEmitter'];var AGIError=require(_0xbd0b('0x3'));var AGIChannel=require('./channel');var AGIServer=function(_0x39b03a,_0x1f6ec3,_0x53e6ce){var _0x432acf=this,_0x39b03a=_0x39b03a||0x11dd,_0x1f6ec3=_0x1f6ec3||_0xbd0b('0x4'),_0x1b2499=null,_0x158b5c=0x0;EventEmitter[_0xbd0b('0x5')](_0x432acf);function _0x5eb975(){if(!_0x39b03a){_0x432acf[_0xbd0b('0x6')](_0xbd0b('0x7'),new AGIError(_0xbd0b('0x8')));return![];}_0x1b2499=net[_0xbd0b('0x9')]();_0x1b2499[_0xbd0b('0xa')](_0x39b03a,_0x1f6ec3);_0x1b2499['on']('listening',function(){_0x432acf['emit'](_0xbd0b('0xb'));});_0x1b2499['on'](_0xbd0b('0xc'),function(_0x4a69ff){_0x1b2499[_0xbd0b('0xd')](function(_0x196beb,_0x526258){if(_0x196beb){_0x432acf[_0xbd0b('0x6')](_0xbd0b('0x7'),new AGIError(_0xbd0b('0xe'),_0x196beb));}else if(_0x53e6ce&&_0x53e6ce<0x0){_0x432acf[_0xbd0b('0x6')](_0xbd0b('0x7'),new AGIError(_0xbd0b('0xf')));_0x4a69ff[_0xbd0b('0x10')]();}else if(_0x53e6ce&&_0x53e6ce>0x0&&_0x53e6ce<_0x526258){_0x158b5c+=0x1;_0x432acf[_0xbd0b('0x6')](_0xbd0b('0x7'),new AGIError(_0xbd0b('0x11'),_0x158b5c));_0x4a69ff[_0xbd0b('0x10')]();}else{var _0x57077a=new AGIChannel(_0x4a69ff);_0x57077a['on'](_0xbd0b('0x12'),function(){_0x432acf['emit']('connection',_0x57077a);});}});});_0x1b2499['on'](_0xbd0b('0x7'),function(_0x4c0e52){_0x432acf[_0xbd0b('0x6')](_0xbd0b('0x7'),new AGIError(_0xbd0b('0xe'),_0x4c0e52['code']));});_0x1b2499['on']('close',function(){_0x432acf[_0xbd0b('0x6')](_0xbd0b('0x13'),new AGIError(_0xbd0b('0x14')));});}process[_0xbd0b('0x15')](function(){_0x5eb975();});};util[_0xbd0b('0x16')](AGIServer,EventEmitter);module[_0xbd0b('0x17')]=function(_0x5aeb79,_0x1d1292,_0x49499f){return new AGIServer(_0x5aeb79,_0x1d1292,_0x49499f);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 42255ab..49c1b22 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 _0x2064=['gotoiftime','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','agentLogin','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','getData','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','saydigits','sayDigits','digits','escape_digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','auth','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','exports','path','util','lodash','shelljs','odbc','moment','request-promise','../../config/logger','agi','../../config/environment/shared','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','getVoiceQueue','getVoiceQueueById','then','name','catch','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','priority','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','scheduledAt','callback','toString','callback_priority','has','dialTimezone','CALLERID(dialTimezone)','getContactByPhone','timezones','scheduledat','add','insertContact','utcOffset','getPauseById','agent','agentPause','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','PUT','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','stringify','body','statusCode','statusMessage','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','%s.%s','saveRestApiResult','split','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','no\x20grammar\x20configured','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','keys','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','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','no\x20password\x20configured','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','beep','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false'];(function(_0x104685,_0x3356b7){var _0x1637d0=function(_0x57c783){while(--_0x57c783){_0x104685['push'](_0x104685['shift']());}};_0x1637d0(++_0x3356b7);}(_0x2064,0x8f));var _0x4206=function(_0x30af1b,_0x4c9d2e){_0x30af1b=_0x30af1b-0x0;var _0x53b77b=_0x2064[_0x30af1b];return _0x53b77b;};'use strict';var fs=require('fs');var path=require(_0x4206('0x0'));var util=require(_0x4206('0x1'));var _=require(_0x4206('0x2'));var sh=require(_0x4206('0x3'));var odbc=require(_0x4206('0x4'))();var rs=require('randomstring');var moment=require(_0x4206('0x5'));var Mustache=require('mustache');var rp=require(_0x4206('0x6'));var logger=require(_0x4206('0x7'))(_0x4206('0x8'));var config=require('../../config/environment');var shared=require(_0x4206('0x9'));var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0x4206('0xa')];var verticesWithRetry=['menu',_0x4206('0xb'),_0x4206('0xc')];var AGIVertices=function(_0x4af453,_0x5c53bf,_0x14bad9){this[_0x4206('0xd')]=_0x4af453;this[_0x4206('0xe')]=_0x5c53bf;this[_0x4206('0xf')]=_0x14bad9;};AGIVertices[_0x4206('0x10')][_0x4206('0x11')]=function(_0x415935,_0x27dbaa){this['rpc'][_0x4206('0x12')](_0x415935)['then'](function(_0x29e2c3){_0x27dbaa(null,_0x29e2c3?_0x29e2c3['name']:![]);})['catch'](function(_0x23fb03){_0x27dbaa(_0x23fb03);});};AGIVertices[_0x4206('0x10')][_0x4206('0x13')]=function(_0x34196f,_0x1e63b4){this[_0x4206('0xe')][_0x4206('0x14')](_0x34196f)[_0x4206('0x15')](function(_0x294afb){_0x1e63b4(null,_0x294afb?_0x294afb[_0x4206('0x16')]:![]);})[_0x4206('0x17')](function(_0x13e004){_0x1e63b4(_0x13e004);});};AGIVertices[_0x4206('0x10')]['getSquareProject']=function(_0x9cafd6,_0x3d6c02){this['rpc'][_0x4206('0x18')](_0x9cafd6)['then'](function(_0x5b6a7b){_0x3d6c02(null,_0x5b6a7b?_0x5b6a7b['name']:![]);})[_0x4206('0x17')](function(_0x23b380){_0x3d6c02(_0x23b380);});};AGIVertices[_0x4206('0x10')][_0x4206('0x19')]=function(_0x285fab,_0xfc846e){this['rpc'][_0x4206('0x1a')](_0x285fab)[_0x4206('0x15')](function(_0x34b155){_0xfc846e(null,_0x34b155?_0x34b155[_0x4206('0x1b')]:![]);})['catch'](function(_0x2b24e2){_0xfc846e(_0x2b24e2);});};AGIVertices[_0x4206('0x10')][_0x4206('0x1c')]=function(_0x1c6a42,_0xcfb41){this[_0x4206('0xe')][_0x4206('0x1d')](_0x1c6a42)[_0x4206('0x15')](function(_0x355b2e){_0xcfb41(null,_0x355b2e?_0x355b2e[_0x4206('0x16')]:![]);})[_0x4206('0x17')](function(_0x2d802e){_0xcfb41(_0x2d802e);});};AGIVertices[_0x4206('0x10')][_0x4206('0x1e')]=function(_0x238cc4,_0x40f641){this[_0x4206('0xe')][_0x4206('0x1f')](_0x238cc4)[_0x4206('0x15')](function(_0x4d5f62){_0x40f641(null,_0x4d5f62?_0x4d5f62[_0x4206('0x16')]:![]);})[_0x4206('0x17')](function(_0x535aea){_0x40f641(_0x535aea);});};AGIVertices[_0x4206('0x10')][_0x4206('0x20')]=function(_0x17d5d0,_0x298417){var _0x482dfd=this;this[_0x4206('0xe')][_0x4206('0x21')](_0x17d5d0)[_0x4206('0x15')](function(_0x2a50ad){_0x298417(null,_0x2a50ad?_0x482dfd[_0x4206('0x22')](_0x2a50ad[_0x4206('0x23')]):![]);})['catch'](function(_0x42176b){_0x298417(_0x42176b);});};AGIVertices['prototype'][_0x4206('0x24')]=function(_0x3e82cb,_0x5baae6){this[_0x4206('0xe')][_0x4206('0x25')](_0x3e82cb)[_0x4206('0x15')](function(_0x410e23){_0x5baae6(null,_0x410e23?_0x410e23:![]);})[_0x4206('0x17')](function(_0x2c80ca){_0x5baae6(_0x2c80ca);});};AGIVertices['prototype']['sendMailMessage']=function(_0x1b16c7,_0x319032,_0x26a762){this['mailRpc'][_0x4206('0x26')](_0x1b16c7,_0x319032)[_0x4206('0x15')](function(){_0x26a762(null);})[_0x4206('0x17')](function(_0x21bac8){_0x26a762(_0x21bac8);});};AGIVertices[_0x4206('0x10')]['getIntervals']=function(_0x20823b,_0x1e2c8c){this[_0x4206('0xe')][_0x4206('0x27')](_0x20823b)[_0x4206('0x15')](function(_0x24b595){if(_0x24b595){if(_0x24b595[_0x4206('0x28')]){_0x1e2c8c(null,[_0x24b595[_0x4206('0x29')]]);}else{_0x1e2c8c(null,_[_0x4206('0x2a')](_0x24b595[_0x4206('0x2b')],'interval'));}}else{_0x1e2c8c(null,![]);}})[_0x4206('0x17')](function(_0x1933bb){_0x1e2c8c(_0x1933bb);});};AGIVertices['prototype'][_0x4206('0x22')]=function(_0x1257d3){return util[_0x4206('0x2c')](_0x4206('0x2d'),FILES_PATH,_0x1257d3);};AGIVertices[_0x4206('0x10')][_0x4206('0x2e')]=function(_0x43d3a8,_0x34ad2a,_0x3cdefe){odbc[_0x4206('0x2f')](_0x43d3a8,function(_0x58d26a){if(_0x58d26a){logger[_0x4206('0x30')](_0x4206('0x31'),_0x58d26a);_0x3cdefe(_0x58d26a);}else{logger[_0x4206('0x32')](_0x4206('0x33'));odbc[_0x4206('0x34')](_0x34ad2a,function(_0x41cb38,_0x3f1b0d){if(_0x41cb38){logger[_0x4206('0x32')]('Error\x20executing\x20query\x20%s',_0x34ad2a);_0x3cdefe(_0x41cb38);}else{logger['info'](_0x4206('0x35'),_0x34ad2a);odbc[_0x4206('0x36')](function(_0x3b70f0){if(_0x3b70f0){logger[_0x4206('0x30')](_0x4206('0x37'),_0x3b70f0);}_0x3cdefe(null,_0x3f1b0d);});}});}});};AGIVertices[_0x4206('0x10')]['getSmsAccount']=function(_0x117a77,_0xc060dc){this[_0x4206('0xe')][_0x4206('0x38')](_0x117a77)['then'](function(_0x3cbedc){_0xc060dc(null,_0x3cbedc?_0x3cbedc:![]);})[_0x4206('0x17')](function(_0x5efbd2){_0xc060dc(_0x5efbd2);});};AGIVertices[_0x4206('0x10')][_0x4206('0x39')]=function(_0x2e4e4b,_0x1d863d){this[_0x4206('0xe')][_0x4206('0x39')](_0x2e4e4b)['then'](function(_0x5d57f8){_0x1d863d(null,_0x5d57f8);})['catch'](function(_0x2afbea){_0x1d863d(_0x2afbea);});};AGIVertices[_0x4206('0x10')]['createSquareDetailsReport']=function(_0x3343b0,_0xa4e4cd,_0x2bea4e){this[_0x4206('0xe')][_0x4206('0x3a')]({'uniqueid':this['channel'][_0x4206('0x3b')],'node':_0x3343b0['label'],'application':_0x3343b0[_0x4206('0x3c')],'data':_0xa4e4cd||null,'project_name':this[_0x4206('0xd')][_0x4206('0x3d')],'callerid':this['channel']['callerid']})[_0x4206('0x15')](function(_0x3a433c){if(_0x2bea4e){_0x2bea4e(null,_0x3a433c);}})['catch'](function(_0xcfe951){if(_0x2bea4e){_0x2bea4e(_0xcfe951);}});};AGIVertices[_0x4206('0x10')][_0x4206('0x3e')]=function(_0x55c0d4,_0x44ddb8,_0x5d7db3,_0x5345d9){this[_0x4206('0xe')][_0x4206('0x3e')]({'uniqueid':this['channel']['uniqueid'],'callerid':this[_0x4206('0xd')][_0x4206('0x3f')],'calleridname':this[_0x4206('0xd')][_0x4206('0x40')],'context':this['channel'][_0x4206('0x41')],'extension':this[_0x4206('0xd')]['extension'],'priority':this['channel'][_0x4206('0x42')],'accountcode':this[_0x4206('0xd')]['accountcode'],'dnid':this[_0x4206('0xd')]['dnid'],'projectName':this['channel'][_0x4206('0x3d')],'saveName':_0x44ddb8,'filename':_0x55c0d4[_0x4206('0x43')]||_0x44ddb8,'savePath':_0x5d7db3})[_0x4206('0x15')](function(_0x1ff1c9){_0x5345d9(null,_0x1ff1c9);})[_0x4206('0x17')](function(_0x9ee738){_0x5345d9(_0x9ee738);});};AGIVertices[_0x4206('0x10')]['createSquareMessage']=function(_0x58bbec,_0x2e1408,_0x17a2ed){this['rpc'][_0x4206('0x44')]({'uniqueid':this[_0x4206('0xd')][_0x4206('0x3b')],'body':_0x58bbec,'direction':_0x2e1408})[_0x4206('0x15')](function(_0x49e6f0){if(_0x17a2ed){_0x17a2ed(null,_0x49e6f0);}})[_0x4206('0x17')](function(_0x479fcd){if(_0x17a2ed){_0x17a2ed(_0x479fcd);}});};AGIVertices[_0x4206('0x10')][_0x4206('0x45')]=function(_0x29e60b,_0x1e0a74){var _0x3d5bf5=this;var _0x529f9c=0x0;var _0x3eef5d={'firstName':_['isEmpty'](_0x29e60b[_0x4206('0x16')])||_[_0x4206('0x46')](_0x29e60b[_0x4206('0x16')])?_0x4206('0x47')+Math[_0x4206('0x48')]():_0x29e60b[_0x4206('0x16')],'lastName':_[_0x4206('0x49')](_0x29e60b[_0x4206('0x4a')])||_['isNil'](_0x29e60b[_0x4206('0x4a')])?null:_0x29e60b[_0x4206('0x4a')],'phone':_0x29e60b[_0x4206('0x4b')],'ListId':_0x29e60b['list_id'],'scheduledat':_0x29e60b[_0x4206('0x4c')],'callbackUniqueid':this[_0x4206('0xd')]['uniqueid'],'tags':_0x4206('0x4d'),'description':'Callback\x20scheduled\x20at\x20'+_0x29e60b['scheduledAt'][_0x4206('0x4e')](),'priority':_0x29e60b[_0x4206('0x4f')]};if(_[_0x4206('0x50')](_0x29e60b,_0x4206('0x51'))){if(!_['isNil'](_0x29e60b[_0x4206('0x51')])){var _0xfcce68=_0x29e60b[_0x4206('0x51')];if(_0x29e60b[_0x4206('0x51')]==_0x4206('0x52')){this['rpc'][_0x4206('0x53')]({'phone':_0x29e60b[_0x4206('0x4b')]})[_0x4206('0x15')](function(_0x7ad3f0){if(!_['isNil'](_0x7ad3f0)){var _0x5431bc=_0x7ad3f0['dialTimezone'];if(!_[_0x4206('0x46')](_0x5431bc)){var _0x407a19=shared[_0x4206('0x54')][_0x5431bc];if(!_['isNil'](_0x407a19)){var _0x22e773=-0x1*_0x407a19['utcOffset'];_0x3eef5d[_0x4206('0x55')]=moment(_0x29e60b[_0x4206('0x55')])[_0x4206('0x56')](_0x22e773,'minutes');_0x3d5bf5['insertContact'](_0x3eef5d,_0x29e60b,_0x1e0a74);}else{_0x3d5bf5[_0x4206('0x57')](_0x3eef5d,_0x29e60b,_0x1e0a74);}}else{_0x3d5bf5[_0x4206('0x57')](_0x3eef5d,_0x29e60b,_0x1e0a74);}}else{_0x3d5bf5[_0x4206('0x57')](_0x3eef5d,_0x29e60b,_0x1e0a74);}});}else{var _0x529f9c=shared['timezones'][_0xfcce68];if(!_['isNil'](_0x529f9c)){var _0x3c7cb5=-0x1*_0x529f9c[_0x4206('0x58')];_0x3eef5d[_0x4206('0x55')]=moment(_0x29e60b[_0x4206('0x55')])[_0x4206('0x56')](_0x3c7cb5,'minutes');_0x3d5bf5['insertContact'](_0x3eef5d,_0x29e60b,_0x1e0a74);}else{_0x3d5bf5[_0x4206('0x57')](_0x3eef5d,_0x29e60b,_0x1e0a74);}}}else{_0x3d5bf5[_0x4206('0x57')](_0x3eef5d,_0x29e60b,_0x1e0a74);}}else{_0x3d5bf5['insertContact'](_0x3eef5d,_0x29e60b,_0x1e0a74);}};AGIVertices[_0x4206('0x10')]['insertContact']=function(_0x6ce38e,_0x4c0ba6,_0x51d27f){this['rpc'][_0x4206('0x45')](_0x6ce38e)[_0x4206('0x15')](function(_0x4200e0){_0x51d27f(null,_0x4200e0);})[_0x4206('0x17')](function(_0x39d175){_0x51d27f(_0x39d175);});};AGIVertices['prototype']['getPause']=function(_0x570761,_0x2bda7f){this['rpc'][_0x4206('0x59')](_0x570761)[_0x4206('0x15')](function(_0x1dcc71){_0x2bda7f(null,_0x1dcc71?_0x1dcc71[_0x4206('0x16')]:![]);})[_0x4206('0x17')](function(_0x385892){_0x2bda7f(_0x385892);});};AGIVertices[_0x4206('0x10')]['agentPause']=function(_0x4e0253,_0x199434,_0x436c56){var _0x2001d1={'role':_0x4206('0x5a')};_0x2001d1[_0x4e0253]=this[_0x4206('0xd')][_0x4206('0x3f')];this[_0x4206('0xe')][_0x4206('0x5b')](_0x2001d1,_0x199434,this[_0x4206('0xd')][_0x4206('0x3b')])[_0x4206('0x15')](function(_0x2d5a82){_0x436c56(null,_[_0x4206('0x46')](_0x2d5a82)?![]:!![]);})[_0x4206('0x17')](function(_0x35476f){logger[_0x4206('0x30')](_0x35476f);_0x436c56(null,![]);});};AGIVertices[_0x4206('0x10')][_0x4206('0x5c')]=function(_0x461a2f,_0x28ea64){var _0x3146cd={'role':_0x4206('0x5a')};_0x3146cd[_0x461a2f]=this[_0x4206('0xd')][_0x4206('0x3f')];this[_0x4206('0xe')][_0x4206('0x5c')](_0x3146cd)['then'](function(_0x49a254){_0x28ea64(null,_[_0x4206('0x46')](_0x49a254)?![]:!![]);})[_0x4206('0x17')](function(_0x2108e9){logger[_0x4206('0x30')](_0x2108e9);_0x28ea64(null,![]);});};AGIVertices[_0x4206('0x10')][_0x4206('0x5d')]=function(_0xcf2aa9,_0x5e3f1e){var _0x2ca3d7={'role':'agent'};_0x2ca3d7[_0xcf2aa9]=this[_0x4206('0xd')][_0x4206('0x3f')];this[_0x4206('0xe')]['agentLogout'](_0x2ca3d7)[_0x4206('0x15')](function(_0x104239){_0x5e3f1e(null,_[_0x4206('0x46')](_0x104239)?![]:!![]);})['catch'](function(_0x3e8df9){logger['error'](_0x3e8df9);_0x5e3f1e(null,![]);});};AGIVertices[_0x4206('0x10')]['agentLogin']=function(_0x66d176,_0x1d757e){var _0x108863={'role':_0x4206('0x5a')};_0x108863[_0x66d176]=this['channel'][_0x4206('0x3f')];var _0x1b54e9=_0x66d176!=_0x4206('0x5e')?util['format'](_0x4206('0x5f'),_0x4206('0x60'),this[_0x4206('0xd')][_0x4206('0x3f')]):undefined;this[_0x4206('0xe')]['agentLogin'](_0x108863,_0x1b54e9)['then'](function(_0x33b2c3){_0x1d757e(null,_[_0x4206('0x46')](_0x33b2c3)?![]:!![]);})[_0x4206('0x17')](function(_0x3e927c){logger[_0x4206('0x30')](_0x3e927c);_0x1d757e(null,![]);});};AGIVertices[_0x4206('0x10')][_0x4206('0x61')]=function(_0x41f375,_0x2592d1){sh[_0x4206('0x62')](_[_0x4206('0x63')](_0x41f375),function(_0x102279,_0x274979){var _0x59aabc=_0x274979[_0x4206('0x64')](/(\r\n|\n|\r)/gm,'');_0x2592d1(null,_0x59aabc);});};AGIVertices['prototype'][_0x4206('0x65')]=function(_0x95815e,_0x19b7b3){scripts['googleCloudTTS'](_0x95815e[_0x4206('0x66')],_0x95815e[_0x4206('0x67')]||_0x4206('0x68'),_0x95815e['text'],_0x95815e[_0x4206('0x69')]||_0x4206('0x6a'),_0x95815e[_0x4206('0x6b')]||'MALE',_0x95815e[_0x4206('0x6c')]||_0x4206('0x6d'))[_0x4206('0x15')](function(_0x26062a){_0x19b7b3(null,_0x26062a);})[_0x4206('0x17')](function(_0x341bca){_0x19b7b3(_0x341bca);});};AGIVertices['prototype'][_0x4206('0x6e')]=function(_0x2770d4,_0x54210c){scripts['googleTTS'](_0x2770d4[_0x4206('0x68')],_0x2770d4[_0x4206('0x6f')]||'en',0x1)['then'](function(_0x43242d){_0x54210c(null,_0x43242d);})[_0x4206('0x17')](function(_0xbc6005){_0x54210c(_0xbc6005);});};AGIVertices[_0x4206('0x10')][_0x4206('0x70')]=function(_0x588d0c,_0x574768){var _0x41528f={'uri':_0x588d0c[_0x4206('0x71')],'method':_0x588d0c[_0x4206('0x72')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x588d0c[_0x4206('0x73')])===_0x4206('0x74')&&parseInt(_0x588d0c[_0x4206('0x73')])>=0x1?parseInt(_0x588d0c['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x4206('0x75')](['POST',_0x4206('0x76')],_0x41528f[_0x4206('0x72')][_0x4206('0x77')]())){try{_0x41528f['body']=_0x588d0c['rawBody']?JSON[_0x4206('0x78')](_0x588d0c[_0x4206('0xa')]):{};}catch(_0x51f853){logger[_0x4206('0x30')](_0x4206('0x79'),_0x51f853);}}try{_0x41528f[_0x4206('0x7a')]=_0x588d0c['rawHeaders']?JSON[_0x4206('0x78')](_0x588d0c[_0x4206('0x7b')]):{};}catch(_0x2467c0){logger[_0x4206('0x30')](_0x4206('0x7c'),_0x2467c0);}if(_0x588d0c[_0x4206('0x7d')]){try{var _0x4b2d8a=require(_0x588d0c[_0x4206('0x7d')])['sync'](this,_0x41528f);_0x41528f[_0x4206('0x7e')]=Mustache['render'](_0x588d0c[_0x4206('0x71')],_0x4b2d8a,{},['$$','$$']);if(_0x41528f['headers']){_0x41528f[_0x4206('0x7a')]=JSON['parse'](Mustache[_0x4206('0x7f')](JSON[_0x4206('0x80')](_0x41528f[_0x4206('0x7a')]),_0x4b2d8a,{},['$$','$$']));}if(_0x41528f[_0x4206('0x81')]){_0x41528f[_0x4206('0x81')]=JSON['parse'](Mustache[_0x4206('0x7f')](JSON[_0x4206('0x80')](_0x41528f[_0x4206('0x81')]),_0x4b2d8a,{},['$$','$$']));}}catch(_0x3fb8e5){logger[_0x4206('0x30')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3fb8e5);}}rp(_0x41528f)[_0x4206('0x15')](function(_0x471726){var _0x518e59={'statusCode':_0x471726[_0x4206('0x82')]||0xc8,'statusMessage':_0x471726[_0x4206('0x83')]||'OK','headers':_0x471726[_0x4206('0x7a')]||{},'body':_0x471726['body']||{}};_0x574768(null,_0x518e59);})[_0x4206('0x17')](function(_0x16be24){var _0x527141={'statusCode':_0x16be24['statusCode']||0x1f4,'statusMessage':_0x16be24['message']||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x16be24['options'][_0x4206('0x7a')]||{},'body':_0x16be24[_0x4206('0x84')][_0x4206('0x81')]||{}};_0x574768(null,_0x527141);});};AGIVertices['prototype'][_0x4206('0x85')]=function(_0x52a39c,_0x343ec5){scripts[_0x4206('0x85')](this['channel'][_0x4206('0x3b')],_0x52a39c[_0x4206('0x86')],_0x52a39c[_0x4206('0x68')],_0x52a39c[_0x4206('0x87')]||'en')[_0x4206('0x15')](function(_0x9b0110){_0x343ec5(null,_0x9b0110);})[_0x4206('0x17')](function(_0x17c9b7){_0x343ec5(_0x17c9b7);});};AGIVertices['prototype']['sestekNDA']=function(_0x1dc8bb,_0xc84ea3){scripts[_0x4206('0x88')](this[_0x4206('0xd')],_0x1dc8bb)[_0x4206('0x15')](function(_0x133d1c){_0xc84ea3(null,_0x133d1c);})[_0x4206('0x17')](function(_0x158d52){_0xc84ea3(_0x158d52);});};AGIVertices['prototype'][_0x4206('0x89')]=function(_0x4be7c3,_0x5502bb){scripts['ispeechTTS'](_0x4be7c3[_0x4206('0x86')],_0x4be7c3[_0x4206('0x68')],_0x4be7c3[_0x4206('0x8a')]||_0x4206('0x6a'),_0x4be7c3['speed'])['then'](function(_0x3eff8a){_0x5502bb(null,_0x3eff8a);})['catch'](function(_0xa3cf86){_0x5502bb(_0xa3cf86);});};AGIVertices[_0x4206('0x10')]['ispeechASR']=function(_0x5ace60,_0x3603d1,_0x17fe4f){scripts[_0x4206('0x8b')](_0x3603d1,_0x5ace60['key'],_0x5ace60[_0x4206('0x8c')]||_0x4206('0x6a'),this[_0x4206('0x8d')](_0x5ace60[_0x4206('0x8e')])?_0x5ace60[_0x4206('0x8e')]:undefined)[_0x4206('0x15')](function(_0x1d3c48){_0x17fe4f(null,_0x1d3c48);})[_0x4206('0x17')](function(_0x135bd2){_0x17fe4f(_0x135bd2);});};AGIVertices[_0x4206('0x10')][_0x4206('0x8f')]=function(_0x44439a,_0x522df4){scripts['awsPolly'](_0x44439a[_0x4206('0x90')],_0x44439a[_0x4206('0x91')],_0x44439a['aws_polly_region'],_0x44439a['aws_polly_voice']||_0x4206('0x92'),_0x44439a[_0x4206('0x68')],_0x44439a[_0x4206('0x93')]||_0x4206('0x68'))['then'](function(_0x366b0c){_0x522df4(null,_0x366b0c);})[_0x4206('0x17')](function(_0x3602ef){_0x522df4(_0x3602ef);});};AGIVertices[_0x4206('0x10')][_0x4206('0x94')]=function(_0xc35524,_0x4155ff){scripts[_0x4206('0x94')](this['channel']['uniqueid'],_0xc35524[_0x4206('0x90')],_0xc35524[_0x4206('0x91')],_0xc35524['aws_lex_region'],_0xc35524[_0x4206('0x68')],_0xc35524[_0x4206('0x95')])['then'](function(_0x214523){_0x4155ff(null,_0x214523);})['catch'](function(_0x6f5c24){_0x4155ff(_0x6f5c24);});};AGIVertices[_0x4206('0x10')][_0x4206('0x96')]=function(_0x2b2f77,_0x3e532c,_0x576808){scripts[_0x4206('0x96')](_0x3e532c,_0x2b2f77[_0x4206('0x86')],_0x2b2f77[_0x4206('0x97')]||_0x4206('0x6a'))[_0x4206('0x15')](function(_0x52b61f){_0x576808(null,_0x52b61f);})[_0x4206('0x17')](function(_0x422c46){_0x576808(_0x422c46);});};AGIVertices[_0x4206('0x10')]['tildeASR']=function(_0x80276f,_0x2095e9,_0x407dc1){scripts[_0x4206('0x98')](_0x2095e9,_0x80276f[_0x4206('0x99')],_0x80276f[_0x4206('0x9a')],_0x80276f[_0x4206('0x7e')])['then'](function(_0x3e3509){_0x407dc1(null,_0x3e3509);})[_0x4206('0x17')](function(_0x52034e){_0x407dc1(_0x52034e);});};AGIVertices[_0x4206('0x10')][_0x4206('0x9b')]=function(_0x365c34){var _0x284221=_[_0x4206('0x75')](verticesWithRetry,_0x365c34[_0x4206('0x3c')])?_0x365c34:_[_0x4206('0x9c')](_0x365c34);for(var _0x1a3886 in _0x284221){if(_0x284221[_0x4206('0x9d')](_0x1a3886)){if(_0x284221[_0x1a3886]&&_['isString'](_0x284221[_0x1a3886])){if(_[_0x4206('0x75')](recursiveMapAttributes,_0x1a3886)){_0x284221[_0x1a3886]=this[_0x4206('0x9e')](_0x284221[_0x1a3886]);}else{_0x284221[_0x1a3886]=this[_0x4206('0x9f')](_0x284221[_0x1a3886]);}}}}return _0x284221;};AGIVertices['prototype'][_0x4206('0xa0')]=function(_0x2caf66){for(var _0x1f1c9f in _0x2caf66){if(_0x2caf66['hasOwnProperty'](_0x1f1c9f)){if(_[_0x4206('0xa1')](_0x2caf66[_0x1f1c9f])){this[_0x4206('0xa0')](_0x2caf66[_0x1f1c9f]);}else if(_[_0x4206('0xa2')](_0x2caf66[_0x1f1c9f])){for(var _0x58de8a=0x0;_0x58de8a<_0x2caf66[_0x1f1c9f][_0x4206('0xa3')];_0x58de8a++){this[_0x4206('0xa0')](_0x2caf66[_0x1f1c9f][_0x58de8a]);}}else if(_[_0x4206('0xa4')](_0x2caf66[_0x1f1c9f])){_0x2caf66[_0x1f1c9f]=this[_0x4206('0x9f')](_0x2caf66[_0x1f1c9f]);}}}};AGIVertices[_0x4206('0x10')]['saveRestApiResult']=function(_0x410493,_0x34de9b){for(var _0x416494 in _0x410493){if(_0x410493[_0x4206('0x9d')](_0x416494)){if(_[_0x4206('0xa1')](_0x410493[_0x416494])){if(!_[_0x4206('0x49')](_0x410493[_0x416494])){this['saveRestApiResult'](_0x410493[_0x416494],util['format'](_0x4206('0xa5'),_0x34de9b,_0x416494));}}else if(_['isArray'](_0x410493[_0x416494])){for(var _0x5d28ef=0x0;_0x5d28ef<_0x410493[_0x416494][_0x4206('0xa3')];_0x5d28ef++){this[_0x4206('0xa6')](_0x410493[_0x416494][_0x5d28ef],util[_0x4206('0x2c')](_0x4206('0xa5'),_0x34de9b,_0x416494+'['+_0x5d28ef+']'));}}else{if(!_[_0x4206('0x46')](_0x410493[_0x416494])){this[_0x4206('0xd')]['setVariable'](util[_0x4206('0x2c')](_0x4206('0xa5'),_0x34de9b,_0x416494),_0x410493[_0x416494]);}}}}};AGIVertices[_0x4206('0x10')]['replaceObjectAllVariables']=function(_0x51f040){try{var _0x14534a=JSON[_0x4206('0x78')](_0x51f040);this[_0x4206('0xa0')](_0x14534a);return JSON[_0x4206('0x80')](_0x14534a);}catch(_0x182966){return this['replaceAllVariables'](_0x51f040);}};AGIVertices[_0x4206('0x10')][_0x4206('0x9f')]=function(_0x54547c){var _0x3c8edc=_0x54547c[_0x4206('0xa7')]('{');for(var _0x2c0a77=0x1;_0x2c0a77<_0x3c8edc[_0x4206('0xa3')];_0x2c0a77+=0x1){var _0x37ee40=_0x3c8edc[_0x2c0a77][_0x4206('0xa7')]('}');if(_0x37ee40[_0x4206('0xa3')]>0x1){_0x54547c=_0x54547c['replaceAll']('{'+_0x37ee40[0x0]+'}',this[_0x4206('0xd')][_0x4206('0x11')](_0x37ee40[0x0])[_0x4206('0xa8')]||_0x37ee40[0x0]);}}if(_0x3c8edc['length']===0x1){return _0x54547c['toString']();}return this['replaceAllVariables'](_0x54547c);};AGIVertices[_0x4206('0x10')][_0x4206('0xa9')]=function(_0x38167d,_0x21d7c3){var _0x48041f=this['channel'][_0x4206('0x11')](_0x38167d);if(_0x48041f[_0x4206('0xaa')]===-0x1){return _0x48041f;}logger['info'](util[_0x4206('0x2c')](_0x4206('0xab'),_0x21d7c3,_0x48041f[_0x4206('0xa8')]));return this['channel'][_0x4206('0xac')](_0x21d7c3,_0x48041f[_0x4206('0xa8')]);};AGIVertices[_0x4206('0x10')]['isConfigured']=function(_0x2c4691){return _0x2c4691&&_0x2c4691!=='0'&&_0x2c4691!=='-1'&&_0x2c4691!=='';};AGIVertices['prototype'][_0x4206('0xad')]=function(_0x42b43b){this['createSquareDetailsReport'][_0x4206('0xae')](this,_0x42b43b,'-');_0x42b43b[_0x4206('0xaf')]=_0x42b43b[_0x4206('0xad')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x4206('0x10')][_0x4206('0xb0')]=function(_0x202b44){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0xb1'),_0x202b44[_0x4206('0xb2')]));if(!this['isConfigured'](_0x202b44[_0x4206('0x68')])){return this[_0x4206('0xd')]['noop'](_0x4206('0xb3'));}var _0x3ec95b='\x22'+_0x202b44[_0x4206('0x68')]+'\x22';if(this[_0x4206('0x8d')](_0x202b44[_0x4206('0x84')])){_0x3ec95b+=','+_0x202b44[_0x4206('0x84')];}var _0x590f3a=this[_0x4206('0xd')][_0x4206('0x62')](_0x4206('0xb4'),_0x3ec95b);if(_0x590f3a['result']===-0x1){return _0x590f3a;}return this[_0x4206('0xd')][_0x4206('0xb5')](util[_0x4206('0x2c')](_0x4206('0xb6'),_0x3ec95b));};AGIVertices[_0x4206('0x10')]['mrcprecog']=function(_0xdcc4ea){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0xb7'),_0xdcc4ea[_0x4206('0xb2')]));if(!this[_0x4206('0x8d')](_0xdcc4ea[_0x4206('0xb8')])){return this[_0x4206('0xd')][_0x4206('0xb5')]('no\x20grammar\x20configured');}var _0x2ca2ce=_0xdcc4ea[_0x4206('0xb8')];if(this[_0x4206('0x8d')](_0xdcc4ea['options'])){_0x2ca2ce+=','+_0xdcc4ea[_0x4206('0x84')];}var _0x39af43=this[_0x4206('0xd')]['exec'](_0x4206('0xb9'),_0x2ca2ce);if(_0x39af43[_0x4206('0xaa')]===-0x1){return _0x39af43;}var _0x2ece00=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x4206('0xba'));if(_0x2ece00['result']===-0x1){return _0x2ece00;}var _0x40d907=this[_0x4206('0xa9')](_0x4206('0xbb'),_0x4206('0xbc'));if(_0x40d907[_0x4206('0xaa')]===-0x1){return _0x40d907;}var _0x44ddc3=this[_0x4206('0xa9')](_0x4206('0xbd'),_0x4206('0xbe'));if(_0x44ddc3[_0x4206('0xaa')]===-0x1){return _0x44ddc3;}return this[_0x4206('0xd')][_0x4206('0xb5')](util[_0x4206('0x2c')](_0x4206('0xbf'),_0x2ca2ce));};AGIVertices[_0x4206('0x10')]['agi']=function(_0x2dfe6d){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0xc0'),_0x2dfe6d['label']));return this[_0x4206('0xd')][_0x4206('0x8')]([_0x2dfe6d[_0x4206('0xc1')],_0x2dfe6d['args']]);};AGIVertices[_0x4206('0x10')]['answer']=function(_0x2f080d){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0xc2'),_0x2f080d[_0x4206('0xb2')]));if(this[_0x4206('0x8d')](_0x2f080d['timeout'])){logger['info'](util[_0x4206('0x2c')](_0x4206('0xc3'),_0x2f080d[_0x4206('0x73')]));var _0x13d31f=this['channel'][_0x4206('0xc4')](_0x2f080d[_0x4206('0x73')]);if(_0x13d31f['result']===-0x1){return _0x13d31f;}}return this['channel'][_0x4206('0xc5')]();};AGIVertices[_0x4206('0x10')]['callback']=function(_0x3839af){logger['info'](util[_0x4206('0x2c')](_0x4206('0xc6'),_0x3839af[_0x4206('0xb2')]));if(!this[_0x4206('0x8d')](_0x3839af[_0x4206('0xc7')])){return this[_0x4206('0xd')][_0x4206('0x30')](_0x3839af,'no\x20list\x20selected');}_0x3839af[_0x4206('0x4c')]=moment();if(this[_0x4206('0x8d')](_0x3839af[_0x4206('0xc8')])){_0x3839af[_0x4206('0x4c')]=moment()['add'](_0x3839af['delay'],_0x4206('0xc9'));}if(!this[_0x4206('0x8d')](_0x3839af[_0x4206('0x4f')])){_0x3839af[_0x4206('0x4f')]=0x2;}this[_0x4206('0x45')][_0x4206('0xae')](this,_0x3839af);return this[_0x4206('0xd')][_0x4206('0xb5')](util[_0x4206('0x2c')](_0x4206('0xca'),_0x3839af[_0x4206('0x4b')],_0x3839af[_0x4206('0xc7')],_0x3839af[_0x4206('0x4c')]));};AGIVertices[_0x4206('0x10')]['custom_app']=function(_0x5c71ee){logger[_0x4206('0x32')](util[_0x4206('0x2c')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x5c71ee[_0x4206('0xb2')]));var _0x32ba47=this[_0x4206('0xd')]['exec'](_0x5c71ee[_0x4206('0xcb')],_0x5c71ee['options']);if(_0x32ba47[_0x4206('0xaa')]===-0x1){return _0x32ba47;}return this['channel'][_0x4206('0xb5')](util[_0x4206('0x2c')](_0x4206('0xcc'),_0x5c71ee[_0x4206('0xcb')],_0x5c71ee[_0x4206('0x84')]));};AGIVertices[_0x4206('0x10')]['lumenvoxtts']=function(_0x2f83fb){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0xcd'),_0x2f83fb['label']));if(!this[_0x4206('0x8d')](_0x2f83fb[_0x4206('0x68')])){return this[_0x4206('0xd')][_0x4206('0xb5')](_0x4206('0xb3'));}var _0x406272='\x22'+_0x2f83fb['text']+'\x22';if(this[_0x4206('0x8d')](_0x2f83fb[_0x4206('0x84')])){_0x406272+=','+_0x2f83fb[_0x4206('0x84')];}var _0x107c13=this['channel'][_0x4206('0x62')]('MRCPSynth',_0x406272);if(_0x107c13[_0x4206('0xaa')]===-0x1){return _0x107c13;}return this[_0x4206('0xd')]['noop'](util[_0x4206('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x406272));};AGIVertices[_0x4206('0x10')]['sestektts']=function(_0x248cdd){logger['info'](util[_0x4206('0x2c')](_0x4206('0xce'),_0x248cdd[_0x4206('0xb2')]));if(!this[_0x4206('0x8d')](_0x248cdd[_0x4206('0x68')])){return this[_0x4206('0xd')][_0x4206('0xb5')](_0x4206('0xb3'));}var _0x21865a='\x22'+_0x248cdd[_0x4206('0x68')]+'\x22';if(this[_0x4206('0x8d')](_0x248cdd[_0x4206('0x84')])){_0x21865a+=','+_0x248cdd[_0x4206('0x84')];}var _0x4ee0a6=this[_0x4206('0xd')]['exec'](_0x4206('0xb4'),_0x21865a);if(_0x4ee0a6[_0x4206('0xaa')]===-0x1){return _0x4ee0a6;}return this[_0x4206('0xd')]['noop'](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x21865a));};AGIVertices[_0x4206('0x10')][_0x4206('0xcf')]=function(_0x58b6b4){logger['info'](util[_0x4206('0x2c')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x58b6b4[_0x4206('0xb2')]));if(!this[_0x4206('0x8d')](_0x58b6b4[_0x4206('0xb8')])){return this[_0x4206('0xd')]['noop'](_0x4206('0xd0'));}var _0x3820b6=_0x58b6b4['grammar'];if(this[_0x4206('0x8d')](_0x58b6b4[_0x4206('0x84')])){_0x3820b6+=','+_0x58b6b4['options'];}var _0x2c0f=this[_0x4206('0xd')][_0x4206('0x62')]('MRCPRecog',_0x3820b6);if(_0x2c0f[_0x4206('0xaa')]===-0x1){return _0x2c0f;}var _0x47c11e=this[_0x4206('0xa9')](_0x4206('0xd1'),_0x4206('0xd2'));if(_0x47c11e[_0x4206('0xaa')]===-0x1){return _0x47c11e;}var _0x4d1403=this[_0x4206('0xa9')](_0x4206('0xbb'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x4d1403[_0x4206('0xaa')]===-0x1){return _0x4d1403;}var _0x4215f6=this[_0x4206('0xa9')]('RECOG_INSTANCE()',_0x4206('0xd3'));if(_0x4215f6[_0x4206('0xaa')]===-0x1){return _0x4215f6;}return this['channel'][_0x4206('0xb5')](util[_0x4206('0x2c')](_0x4206('0xbf'),_0x3820b6));};AGIVertices['prototype']['sestekasr']=function(_0x2994d8){logger['info'](util[_0x4206('0x2c')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x2994d8['label']));if(!this[_0x4206('0x8d')](_0x2994d8['grammar'])){return this[_0x4206('0xd')][_0x4206('0xb5')](_0x4206('0xd0'));}var _0xe14855=_0x2994d8[_0x4206('0xb8')];if(this[_0x4206('0x8d')](_0x2994d8[_0x4206('0x84')])){_0xe14855+=','+_0x2994d8[_0x4206('0x84')];}var _0x508389=this[_0x4206('0xd')][_0x4206('0x62')](_0x4206('0xb9'),_0xe14855);if(_0x508389[_0x4206('0xaa')]===-0x1){return _0x508389;}var _0x24ae8c=this[_0x4206('0xa9')](_0x4206('0xd1'),_0x4206('0xd4'));if(_0x24ae8c[_0x4206('0xaa')]===-0x1){return _0x24ae8c;}var _0x124d24=this['getAndSetVariable'](_0x4206('0xbb'),_0x4206('0xd5'));if(_0x124d24[_0x4206('0xaa')]===-0x1){return _0x124d24;}var _0x1a4846=this[_0x4206('0xa9')](_0x4206('0xbd'),'SESTEK_ASR_INSTANCE');if(_0x1a4846[_0x4206('0xaa')]===-0x1){return _0x1a4846;}return this[_0x4206('0xd')][_0x4206('0xb5')](util[_0x4206('0x2c')]('Executed\x20command\x20MRCPRecog\x20%s',_0xe14855));};AGIVertices[_0x4206('0x10')][_0x4206('0xd6')]=function(_0x41703f){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0xd7'),_0x41703f[_0x4206('0xb2')]));if(!this[_0x4206('0x8d')](_0x41703f[_0x4206('0xd8')])){return this[_0x4206('0xd')][_0x4206('0x30')](_0x41703f,_0x4206('0xd9'));}var _0x72edd7=this[_0x4206('0x19')][_0x4206('0xae')](this,_0x41703f[_0x4206('0xd8')]);if(!_0x72edd7){return this['channel']['error'](_0x41703f,_0x4206('0xda'));}if(!this[_0x4206('0x8d')](_0x41703f[_0x4206('0x34')])){return this[_0x4206('0xd')][_0x4206('0x30')](_0x41703f,_0x4206('0xdb'));}var _0x2e16a3=_0x41703f['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x4206('0xd')][_0x4206('0xb5')](util['format'](_0x4206('0xdc'),_0x2e16a3));var _0x520cbb=this['getQueryOdbc'][_0x4206('0xae')](this,_0x72edd7,_0x2e16a3);this['createSquareDetailsReport']['sync'](this,_0x41703f,_0x2e16a3);if(!this[_0x4206('0x8d')](_0x41703f[_0x4206('0xdd')])){return this['channel'][_0x4206('0xb5')](_0x4206('0xde'));}var _0x5caef9=this['getVariable'][_0x4206('0xae')](this,_0x41703f[_0x4206('0xdd')]);if(!_0x5caef9){return this[_0x4206('0xd')][_0x4206('0x30')](_0x41703f,'no\x20variable\x20found');}var _0x53ca08=this;_0x520cbb['forEach'](function(_0xb0a899,_0x3427be){Object[_0x4206('0xdf')](_0xb0a899)['forEach'](function(_0x578ce1){_0x53ca08[_0x4206('0xd')][_0x4206('0xac')](util['format']('%s[%s][%s]',_0x5caef9,_0x3427be,_0x578ce1),_0xb0a899[_0x578ce1]);});});this[_0x4206('0xd')][_0x4206('0xac')](util[_0x4206('0x2c')]('%s_ROWS_COUNT',_0x5caef9),_0x520cbb[_0x4206('0xa3')]);return this['channel']['noop'](util['format'](_0x4206('0xe0'),_0x5caef9));};AGIVertices[_0x4206('0x10')][_0x4206('0xe1')]=function(_0x54b0f1){logger['debug'](util[_0x4206('0x2c')](_0x4206('0xe2'),_0x54b0f1[_0x4206('0xb2')]));if(!this[_0x4206('0x8d')](_0x54b0f1[_0x4206('0xe3')])){return this[_0x4206('0xd')][_0x4206('0x30')](_0x54b0f1,_0x4206('0xe4'));}var _0x3acc30=this[_0x4206('0x1c')]['sync'](this,_0x54b0f1[_0x4206('0xe3')]);if(!_0x3acc30){return this['channel']['error'](_0x54b0f1,_0x4206('0xe5'));}var _0xa7b30=this[_0x4206('0xd')]['exec']('DIAL',[util[_0x4206('0x2c')](_0x4206('0xe6'),_0x3acc30),_0x54b0f1[_0x4206('0x73')],_0x54b0f1[_0x4206('0xe7')],_0x54b0f1['url']]);if(_0xa7b30[_0x4206('0xaa')]===-0x1){return _0xa7b30;}return this['channel'][_0x4206('0xb5')](util['format'](_0x4206('0xe8'),_0x4206('0xe9')));};AGIVertices[_0x4206('0x10')][_0x4206('0xea')]=function(_0x27401d){logger['info'](util[_0x4206('0x2c')](_0x4206('0xeb'),_0x27401d[_0x4206('0xb2')]));if(!this[_0x4206('0x8d')](_0x27401d[_0x4206('0x86')])){return this[_0x4206('0xd')][_0x4206('0xb5')](_0x4206('0xec'));}if(!this['isConfigured'](_0x27401d['text'])){return this['channel']['noop'](_0x4206('0xb3'));}this[_0x4206('0xd')][_0x4206('0xed')]=!![];this['createSquareDetailsReport'](_0x27401d);this[_0x4206('0x44')](_0x27401d[_0x4206('0x68')],'in');this[_0x4206('0xd')][_0x4206('0xb5')](util[_0x4206('0x2c')](_0x4206('0xee'),_0x27401d[_0x4206('0x68')]));var _0xca3f20=this[_0x4206('0x85')][_0x4206('0xae')](this,_0x27401d);if(_0xca3f20){for(var _0x48efc5 in _0xca3f20){if(_0xca3f20[_0x4206('0x9d')](_0x48efc5)){this['channel'][_0x4206('0xac')](util[_0x4206('0x2c')](_0x4206('0xef'),_0x48efc5[_0x4206('0x77')]()),_0xca3f20[_0x48efc5]);}}this[_0x4206('0x44')](_0xca3f20[_0x4206('0xf0')],_0x4206('0xf1'));return this[_0x4206('0xd')][_0x4206('0xb5')](util['format'](_0x4206('0xf2'),_0xca3f20[_0x4206('0xf0')]));}return this[_0x4206('0xd')][_0x4206('0x30')](_0x27401d,_0x4206('0xf3'));};AGIVertices[_0x4206('0x10')][_0x4206('0xf4')]=function(_0x2688d4){logger['info'](util[_0x4206('0x2c')](_0x4206('0xf5'),_0x2688d4[_0x4206('0xb2')]));if(!this[_0x4206('0x8d')](_0x2688d4[_0x4206('0xf6')])){return this[_0x4206('0xd')]['noop'](_0x4206('0xf7'));}if(!this[_0x4206('0x8d')](_0x2688d4[_0x4206('0xf8')])){return this[_0x4206('0xd')][_0x4206('0xb5')](_0x4206('0xf9'));}if(!this[_0x4206('0x8d')](_0x2688d4[_0x4206('0xfa')])){return this['channel'][_0x4206('0xb5')](_0x4206('0xfb'));}if(!this[_0x4206('0x8d')](_0x2688d4['ndassistant_url'])){return this[_0x4206('0xd')][_0x4206('0xb5')](_0x4206('0xb3'));}this[_0x4206('0xd')]['bot']=!![];this['createSquareDetailsReport'](_0x2688d4);this[_0x4206('0x44')](_0x2688d4['text'],'in');this[_0x4206('0xd')][_0x4206('0xb5')](util[_0x4206('0x2c')]('Trying\x20SestekNDA:\x20%s',_0x2688d4[_0x4206('0x68')]));var _0x195fa=this['sestekNDA'][_0x4206('0xae')](this,_0x2688d4);if(_0x195fa){for(var _0x59feed in _0x195fa){if(_0x195fa[_0x4206('0x9d')](_0x59feed)){this[_0x4206('0xd')][_0x4206('0xac')](util['format'](_0x4206('0xfc'),_0x59feed[_0x4206('0x77')]()),_0x195fa[_0x59feed]);}}this['createSquareMessage'](_0x195fa[_0x4206('0xf0')],_0x4206('0xf1'));if(_0x195fa[_0x4206('0xfd')]){this[_0x4206('0xd')][_0x4206('0xb5')](util[_0x4206('0x2c')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x195fa[_0x4206('0xfd')]));var _0x328021=this[_0x4206('0xd')][_0x4206('0xfe')](_0x195fa[_0x4206('0xfd')]);try{fs[_0x4206('0xff')](_0x195fa[_0x4206('0xfd')]+_0x4206('0x100'));}catch(_0x7f388b){logger[_0x4206('0x30')](_0x7f388b);}return _0x328021;}else{return this['channel'][_0x4206('0xb5')](util[_0x4206('0x2c')](_0x4206('0x101'),_0x195fa[_0x4206('0xf0')]));}}return this[_0x4206('0xd')]['error'](_0x2688d4,_0x4206('0x102'));};AGIVertices[_0x4206('0x10')][_0x4206('0x103')]=function(_0x2787cd){logger[_0x4206('0x32')](util[_0x4206('0x2c')]('Enter\x20in\x20END\x20(%s)\x20block',_0x2787cd[_0x4206('0xb2')]));return this[_0x4206('0xd')]['noop'](_0x4206('0x103'));};AGIVertices[_0x4206('0x10')][_0x4206('0x104')]=function(_0x26fd4c){logger[_0x4206('0x32')](util['format'](_0x4206('0x105'),_0x26fd4c[_0x4206('0xb2')]));var _0x18d794='';if(_0x26fd4c['trunk_id']){if(!this['isConfigured'](_0x26fd4c[_0x4206('0x106')])){return this[_0x4206('0xd')][_0x4206('0x30')](_0x26fd4c,'no\x20trunk\x20selected');}else{var _0x334eed=parseInt(_0x26fd4c[_0x4206('0x106')],0xa);if(isNaN(_0x334eed)){_0x18d794=_0x26fd4c[_0x4206('0x106')];}else{_0x18d794=this[_0x4206('0x1e')][_0x4206('0xae')](this,_0x26fd4c[_0x4206('0x106')]);if(!_0x18d794){return this[_0x4206('0xd')][_0x4206('0x30')](_0x26fd4c,_0x4206('0x107'));}}}}else if(_0x26fd4c[_0x4206('0x108')]){_0x18d794=_0x26fd4c['trunk_name'];}else{return this[_0x4206('0xd')][_0x4206('0x30')](_0x26fd4c,_0x4206('0x109'));}var _0x35f5c0=this[_0x4206('0xd')][_0x4206('0x62')](_0x4206('0xe9'),[util[_0x4206('0x2c')](_0x4206('0x10a'),_0x18d794,_0x26fd4c[_0x4206('0x4b')]),_0x26fd4c[_0x4206('0x73')],_0x26fd4c['opts'],_0x26fd4c['url']]);if(_0x35f5c0[_0x4206('0xaa')]===-0x1){return _0x35f5c0;}return this['channel'][_0x4206('0xb5')](util[_0x4206('0x2c')](_0x4206('0xe8'),_0x4206('0xe9')));};AGIVertices[_0x4206('0x10')]['finally']=function(_0x593bb6){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x10b'),_0x593bb6[_0x4206('0xb2')]));return this['channel'][_0x4206('0xb5')]('finally');};AGIVertices[_0x4206('0x10')][_0x4206('0xb')]=function(_0x11e9e3){logger[_0x4206('0x32')](util['format'](_0x4206('0x10c'),_0x11e9e3[_0x4206('0xb2')]));if(_0x11e9e3[_0x4206('0xaf')]===0x0){return this['maxRetry'](_0x11e9e3);}_0x11e9e3[_0x4206('0xaf')]-=0x1;if(!this[_0x4206('0x8d')](_0x11e9e3[_0x4206('0x10d')])){return this['channel'][_0x4206('0x30')](_0x11e9e3,_0x4206('0x10e'));}var _0x8da1a9=this[_0x4206('0x20')][_0x4206('0xae')](this,_0x11e9e3[_0x4206('0x10d')]);if(!_0x8da1a9){return this['channel'][_0x4206('0x30')](_0x11e9e3,_0x4206('0x10f'));}if(!this[_0x4206('0x8d')](_0x11e9e3[_0x4206('0xdd')])){return this[_0x4206('0xd')][_0x4206('0x30')](_0x4206('0xde'));}var _0x30c8fb=this[_0x4206('0xd')]['getData'](_0x8da1a9,_0x11e9e3['response'],_0x11e9e3[_0x4206('0x110')]);var _0xa42ca0=_0x30c8fb[_0x4206('0xaa')]?_0x30c8fb[_0x4206('0xaa')][_0x4206('0x4e')]():'';logger['info'](_0x4206('0x111'),JSON['stringify'](_0x30c8fb));if(_0x30c8fb[_0x4206('0xaa')]===-0x1){this['createSquareDetailsReport'][_0x4206('0xae')](this,_0x11e9e3,_0xa42ca0);return _0x30c8fb;}else if(_0x30c8fb[_0x4206('0xa8')]===_0x4206('0x73')){_0x30c8fb[_0x4206('0xaa')]=_0xa42ca0[_0x4206('0xa3')]>=parseInt(_0x11e9e3[_0x4206('0x112')])?'x':'i';}else{_0x30c8fb['result']=_0xa42ca0['length']>=parseInt(_0x11e9e3[_0x4206('0x112')])&&_0xa42ca0['length']<=parseInt(_0x11e9e3[_0x4206('0x110')])?'x':'i';}var _0x3dc6eb=this[_0x4206('0x11')][_0x4206('0xae')](this,_0x11e9e3['variable_id']);if(!_0x3dc6eb){return this['channel']['error'](_0x11e9e3,_0x4206('0x113'));}this[_0x4206('0xd')][_0x4206('0xac')](_0x3dc6eb,_0xa42ca0);if(this[_0x4206('0x8d')](_0x11e9e3['hiddendigitsnum'])){var _0x29d3dd=parseInt(_0x11e9e3[_0x4206('0x114')],0xa);var _0x8bb822=rs[_0x4206('0x115')]({'charset':'*','length':_0x29d3dd});var _0x14a0bc=_0xa42ca0[_0x4206('0xa3')];if(_0x14a0bc>0x0){if(_0x14a0bc>_0x29d3dd){this[_0x4206('0x3a')][_0x4206('0xae')](this,_0x11e9e3,_0x11e9e3[_0x4206('0x116')]===_0x4206('0x117')?_0x8bb822+_0xa42ca0['substr'](_0x29d3dd):_0xa42ca0[_0x4206('0x118')](0x0,_0x14a0bc-_0x29d3dd)+_0x8bb822);}else{this[_0x4206('0x3a')][_0x4206('0xae')](this,_0x11e9e3,rs['generate']({'charset':'*','length':_0x14a0bc}));}}else{this[_0x4206('0x3a')][_0x4206('0xae')](this,_0x11e9e3,'');}}else{this[_0x4206('0x3a')][_0x4206('0xae')](this,_0x11e9e3,_0xa42ca0);}return _0x30c8fb;};AGIVertices[_0x4206('0x10')][_0x4206('0xc')]=function(_0x109c43){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x119'),_0x109c43[_0x4206('0xb2')]));return this[_0x4206('0xb')](_0x109c43);};AGIVertices[_0x4206('0x10')][_0x4206('0x11a')]=function(_0x318a38){logger['info'](util[_0x4206('0x2c')](_0x4206('0x11b'),_0x318a38['label']));this[_0x4206('0x3a')][_0x4206('0xae')](this,_0x318a38,_0x318a38[_0x4206('0x11c')]);return this['channel'][_0x4206('0xb5')](util['format'](_0x4206('0x11d'),_0x318a38[_0x4206('0x11c')]));};AGIVertices[_0x4206('0x10')][_0x4206('0x11e')]=function(_0x53c64b){logger['info'](util[_0x4206('0x2c')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x53c64b['label']));if(!this[_0x4206('0x8d')](_0x53c64b[_0x4206('0x90')])||!this[_0x4206('0x8d')](_0x53c64b[_0x4206('0x91')])){return this[_0x4206('0xd')][_0x4206('0xb5')](_0x4206('0x11f'));}if(!this[_0x4206('0x8d')](_0x53c64b[_0x4206('0x68')])){return this[_0x4206('0xd')][_0x4206('0xb5')](_0x4206('0xb3'));}this[_0x4206('0xd')][_0x4206('0xb5')](util[_0x4206('0x2c')]('Trying\x20aws\x20Polly\x20%s',_0x53c64b[_0x4206('0x68')]));var _0x3ddcbf=this[_0x4206('0x8f')][_0x4206('0xae')](this,_0x53c64b);if(_0x3ddcbf){this[_0x4206('0xd')][_0x4206('0xb5')](util[_0x4206('0x2c')](_0x4206('0x120'),_0x3ddcbf));var _0x2f8419=this['channel'][_0x4206('0xfe')](_0x3ddcbf);try{fs['unlink'](_0x3ddcbf+_0x4206('0x100'));}catch(_0x36180f){logger[_0x4206('0x30')](_0x36180f);}return _0x2f8419;}return this['channel'][_0x4206('0x30')](_0x53c64b,_0x4206('0x121'));};AGIVertices['prototype'][_0x4206('0x122')]=function(_0x53e2f8){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x123'),_0x53e2f8[_0x4206('0xb2')]));if(!this[_0x4206('0x8d')](_0x53e2f8[_0x4206('0x90')])||!this[_0x4206('0x8d')](_0x53e2f8[_0x4206('0x91')])){return this[_0x4206('0xd')][_0x4206('0xb5')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x4206('0x8d')](_0x53e2f8[_0x4206('0x95')])){return this['channel'][_0x4206('0xb5')](_0x4206('0x124'));}if(!this['isConfigured'](_0x53e2f8[_0x4206('0x68')])){return this[_0x4206('0xd')]['noop'](_0x4206('0xb3'));}this['channel'][_0x4206('0xed')]=!![];this[_0x4206('0x3a')](_0x53e2f8);this[_0x4206('0x44')](_0x53e2f8['text'],'in');this[_0x4206('0xd')][_0x4206('0xb5')](util[_0x4206('0x2c')](_0x4206('0x125'),_0x53e2f8[_0x4206('0x68')]));var _0x1ce198=this[_0x4206('0x94')]['sync'](this,_0x53e2f8);if(_0x1ce198){for(var _0x5a31e7 in _0x1ce198){if(_0x1ce198[_0x4206('0x9d')](_0x5a31e7)&&_[_0x4206('0xa4')](_0x1ce198[_0x5a31e7])){this[_0x4206('0xd')][_0x4206('0xac')](util[_0x4206('0x2c')](_0x4206('0x126'),_0x5a31e7[_0x4206('0x77')]()),_0x1ce198[_0x5a31e7]);}}if(_['isNil'](_0x1ce198[_0x4206('0x127')])){return this[_0x4206('0xd')][_0x4206('0xb5')](_0x4206('0x128'));}else{this[_0x4206('0x44')](_0x1ce198[_0x4206('0x127')],_0x4206('0xf1'));return this[_0x4206('0xd')][_0x4206('0xb5')](util[_0x4206('0x2c')](_0x4206('0x129'),_0x1ce198[_0x4206('0x127')]));}}return this[_0x4206('0xd')][_0x4206('0x30')](_0x53e2f8,_0x4206('0x12a'));};AGIVertices['prototype']['googleasr']=function(_0x3c21e0){logger[_0x4206('0x32')](util[_0x4206('0x2c')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x3c21e0['label'],_0x3c21e0['timeout']));if(!this[_0x4206('0x8d')](_0x3c21e0[_0x4206('0x86')])){return this[_0x4206('0xd')]['noop'](_0x4206('0xec'));}var _0x4d2fe1='wav';var _0x39e1c4=util['format'](_0x4206('0x12b'),FILES_PATH,rs['generate'](0x4));var _0x5738a5=util[_0x4206('0x2c')](_0x4206('0xa5'),_0x39e1c4,_0x4d2fe1);var _0x55fa01=!![];if(_0x3c21e0['beep']===_0x4206('0x12c')){_0x55fa01=![];}var _0x2e8708=this[_0x4206('0xd')][_0x4206('0x12d')](_0x39e1c4,_0x4d2fe1,_0x3c21e0[_0x4206('0x12e')],_0x3c21e0[_0x4206('0x73')],undefined,_0x55fa01);if(_0x2e8708[_0x4206('0xaa')]!==-0x1){this[_0x4206('0xd')][_0x4206('0xb5')](util[_0x4206('0x2c')](_0x4206('0x12f'),_0x5738a5));var _0x1061de=this[_0x4206('0x96')][_0x4206('0xae')](this,_0x3c21e0,_0x5738a5);if(_0x1061de){for(var _0x200180 in _0x1061de){if(_0x1061de[_0x4206('0x9d')](_0x200180)){this[_0x4206('0xd')][_0x4206('0xac')](util[_0x4206('0x2c')](_0x4206('0x130'),_0x200180[_0x4206('0x77')]()),_0x1061de[_0x200180]);}}return this[_0x4206('0xd')]['noop'](util[_0x4206('0x2c')](_0x4206('0x131'),JSON[_0x4206('0x80')](_0x1061de)));}}return _0x2e8708;};AGIVertices['prototype'][_0x4206('0x132')]=function(_0x234d9d){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x133'),_0x234d9d[_0x4206('0xb2')]));if(!this['isConfigured'](_0x234d9d[_0x4206('0x99')])){return this[_0x4206('0xd')][_0x4206('0xb5')](_0x4206('0x134'));}if(!this[_0x4206('0x8d')](_0x234d9d[_0x4206('0x9a')])){return this['channel'][_0x4206('0xb5')](_0x4206('0x135'));}var _0x38400a=_0x4206('0x136');var _0x57399b=util['format'](_0x4206('0x12b'),FILES_PATH,rs['generate'](0x4));var _0xd589ed=util[_0x4206('0x2c')](_0x4206('0xa5'),_0x57399b,_0x38400a);var _0x31b25e=!![];if(_0x234d9d[_0x4206('0x137')]===_0x4206('0x12c')){_0x31b25e=![];}var _0x469508=this['channel'][_0x4206('0x12d')](_0x57399b,_0x38400a,_0x234d9d[_0x4206('0x12e')],_0x234d9d[_0x4206('0x73')],undefined,_0x31b25e);if(_0x469508[_0x4206('0xaa')]!==-0x1){this['channel']['noop'](util[_0x4206('0x2c')]('tilde\x20%s\x20file\x20created',_0xd589ed));var _0x42aa83=this[_0x4206('0x98')][_0x4206('0xae')](this,_0x234d9d,_0xd589ed);if(_0x42aa83){for(var _0x52a353 in _0x42aa83){if(_0x42aa83[_0x4206('0x9d')](_0x52a353)){this['channel'][_0x4206('0xac')](util['format'](_0x4206('0x138'),_0x52a353[_0x4206('0x77')]()),_0x42aa83[_0x52a353]);}}return this[_0x4206('0xd')][_0x4206('0xb5')](util[_0x4206('0x2c')](_0x4206('0x139'),JSON[_0x4206('0x80')](_0x42aa83)));}}return _0x469508;};AGIVertices['prototype'][_0x4206('0x13a')]=function(_0x4f39e8){logger[_0x4206('0x32')](util[_0x4206('0x2c')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x4f39e8[_0x4206('0xb2')]));return this[_0x4206('0xd')][_0x4206('0x13b')](_0x4f39e8[_0x4206('0x41')],_0x4f39e8[_0x4206('0x13c')],_0x4f39e8[_0x4206('0x42')]);};AGIVertices[_0x4206('0x10')][_0x4206('0x13d')]=function(_0x48ef77){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x13e'),_0x48ef77['label']));if(!this['isConfigured'](_0x48ef77[_0x4206('0x13f')])){return this[_0x4206('0xd')][_0x4206('0x30')](_0x48ef77,_0x4206('0x140'));}try{var _0x571d3d=eval(_0x48ef77[_0x4206('0x13f')])?_0x4206('0x141'):'false';this[_0x4206('0xd')][_0x4206('0xb5')](util[_0x4206('0x2c')](_0x4206('0x142'),_0x48ef77[_0x4206('0x13f')],_0x571d3d));return{'code':0xc8,'result':_0x571d3d};}catch(_0x4930af){return{'code':0xc8,'result':_0x4206('0x143')};}};AGIVertices[_0x4206('0x10')][_0x4206('0x144')]=function(_0x387aa6){logger[_0x4206('0x32')](util[_0x4206('0x2c')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x387aa6[_0x4206('0xb2')]));if(!this[_0x4206('0x8d')](_0x387aa6[_0x4206('0x145')])){return this[_0x4206('0xd')][_0x4206('0x30')](_0x387aa6,_0x4206('0x146'));}var _0x1b6f72=this[_0x4206('0x147')][_0x4206('0xae')](this,_0x387aa6['interval_id']);if(!_0x1b6f72){return this[_0x4206('0xd')][_0x4206('0x30')](_0x387aa6,_0x4206('0x148'));}for(var _0x640682=0x0;_0x640682<_0x1b6f72['length'];_0x640682+=0x1){var _0x47ced1=this[_0x4206('0xd')][_0x4206('0x11')](util['format'](_0x4206('0x149'),_0x1b6f72[_0x640682]));if(_0x47ced1[_0x4206('0xaa')]===-0x1){return _0x47ced1;}logger['info'](util[_0x4206('0x2c')]('IFTIME\x20%s\x20%s',_0x1b6f72[_0x640682],_0x47ced1[_0x4206('0xa8')]));if(_0x47ced1[_0x4206('0xa8')]==='true'){logger['info'](util['format'](_0x4206('0x14a'),_0x1b6f72[_0x640682],_0x4206('0x141')));this['channel']['noop'](util[_0x4206('0x2c')](_0x4206('0x14a'),_0x1b6f72[_0x640682],'true'));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0x4206('0x2c')](_0x4206('0x14a'),_0x1b6f72[_0x640682],_0x4206('0x143')));this[_0x4206('0xd')]['noop'](util[_0x4206('0x2c')](_0x4206('0x14a'),_0x1b6f72[_0x640682],_0x4206('0x143')));}}return{'code':0xc8,'result':_0x4206('0x143')};};AGIVertices[_0x4206('0x10')]['hangup']=function(_0x5c2b99){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x14b'),_0x5c2b99[_0x4206('0xb2')]));return this[_0x4206('0xd')][_0x4206('0x14c')]();};AGIVertices[_0x4206('0x10')][_0x4206('0x14d')]=function(_0x43f02e){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x14e'),_0x43f02e[_0x4206('0xb2')]));if(!this[_0x4206('0x8d')](_0x43f02e[_0x4206('0x86')])){return this[_0x4206('0xd')][_0x4206('0xb5')](_0x4206('0xec'));}var _0x5aa2a9=_0x4206('0x136');var _0x4614c4=util[_0x4206('0x2c')](_0x4206('0x12b'),FILES_PATH,rs['generate'](0x4));var _0x8b19c8=util[_0x4206('0x2c')](_0x4206('0xa5'),_0x4614c4,_0x5aa2a9);var _0x19910a=!![];if(_0x43f02e[_0x4206('0x137')]==='NOBEEP'){_0x19910a=![];}var _0x24f63c=this[_0x4206('0xd')][_0x4206('0x12d')](_0x4614c4,_0x5aa2a9,_0x43f02e[_0x4206('0x12e')],_0x43f02e[_0x4206('0x73')],undefined,_0x19910a);if(_0x24f63c[_0x4206('0xaa')]!==-0x1){this[_0x4206('0xd')][_0x4206('0xb5')](util[_0x4206('0x2c')](_0x4206('0x14f'),_0x8b19c8));var _0x182aa9=this[_0x4206('0x8b')][_0x4206('0xae')](this,_0x43f02e,_0x8b19c8);if(_0x182aa9){for(var _0xcac88c in _0x182aa9){if(_0x182aa9[_0x4206('0x9d')](_0xcac88c)){this[_0x4206('0xd')][_0x4206('0xac')](util['format']('ISPEECH_ASR_%s',_0xcac88c['toUpperCase']()),_0x182aa9[_0xcac88c]);}}return this[_0x4206('0xd')][_0x4206('0xb5')](util[_0x4206('0x2c')](_0x4206('0x150'),JSON[_0x4206('0x80')](_0x182aa9)));}}return _0x24f63c;};AGIVertices[_0x4206('0x10')][_0x4206('0x151')]=function(_0x1087d5){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x152'),_0x1087d5['label']));if(!this[_0x4206('0x8d')](_0x1087d5[_0x4206('0x86')])){return this[_0x4206('0xd')][_0x4206('0xb5')](_0x4206('0xec'));}if(!this[_0x4206('0x8d')](_0x1087d5[_0x4206('0x68')])){return this[_0x4206('0xd')]['noop'](_0x4206('0xb3'));}this[_0x4206('0xd')][_0x4206('0xb5')](util['format'](_0x4206('0x153'),_0x1087d5[_0x4206('0x68')]));var _0x3c611d=this[_0x4206('0x89')]['sync'](this,_0x1087d5);if(_0x3c611d){this['channel'][_0x4206('0xb5')](util[_0x4206('0x2c')](_0x4206('0x14f'),_0x3c611d));var _0x4535eb=this[_0x4206('0xd')][_0x4206('0xfe')](_0x3c611d,_0x1087d5[_0x4206('0x12e')]);try{fs[_0x4206('0xff')](_0x3c611d+_0x4206('0x100'));}catch(_0x1496ac){logger[_0x4206('0x30')](_0x1496ac);}return _0x4535eb;}return this[_0x4206('0xd')][_0x4206('0x30')](_0x1087d5,_0x4206('0x154'));};AGIVertices['prototype']['login']=function(_0x3ad6e8){logger['info'](util[_0x4206('0x2c')](_0x4206('0x155'),_0x3ad6e8[_0x4206('0xb2')]));if(!this[_0x4206('0x8d')](_0x3ad6e8[_0x4206('0x156')])){return this[_0x4206('0xd')]['error'](_0x3ad6e8,_0x4206('0x157'));}logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x158'),this[_0x4206('0xd')][_0x4206('0x3f')],_0x3ad6e8[_0x4206('0x156')]));var _0x348cad=this[_0x4206('0x159')][_0x4206('0xae')](this,_0x3ad6e8[_0x4206('0x156')]);if(_0x348cad){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x15a'),this['channel'][_0x4206('0x3f')],_0x3ad6e8[_0x4206('0x156')]));this[_0x4206('0xd')][_0x4206('0xb5')](util[_0x4206('0x2c')](_0x4206('0x15a'),this[_0x4206('0xd')][_0x4206('0x3f')],_0x3ad6e8[_0x4206('0x156')]));return{'code':0xc8,'result':_0x4206('0x15b')};}else{logger[_0x4206('0x32')](util['format'](_0x4206('0x15c'),this[_0x4206('0xd')][_0x4206('0x3f')],_0x3ad6e8[_0x4206('0x156')]));this[_0x4206('0xd')][_0x4206('0xb5')](util[_0x4206('0x2c')](_0x4206('0x15c'),this['channel'][_0x4206('0x3f')],_0x3ad6e8[_0x4206('0x156')]));return{'code':0xc8,'result':_0x4206('0x15d')};}};AGIVertices[_0x4206('0x10')][_0x4206('0x15e')]=function(_0x274c2b){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x15f'),_0x274c2b[_0x4206('0xb2')]));if(!this[_0x4206('0x8d')](_0x274c2b['findBy'])){return this[_0x4206('0xd')][_0x4206('0x30')](_0x274c2b,_0x4206('0x157'));}logger[_0x4206('0x32')](util['format'](_0x4206('0x158'),this[_0x4206('0xd')][_0x4206('0x3f')],_0x274c2b[_0x4206('0x156')]));var _0x466f47=this[_0x4206('0x5d')]['sync'](this,_0x274c2b['findBy']);if(_0x466f47){logger[_0x4206('0x32')](util['format'](_0x4206('0x15a'),this[_0x4206('0xd')][_0x4206('0x3f')],_0x274c2b[_0x4206('0x156')]));this[_0x4206('0xd')]['noop'](util[_0x4206('0x2c')](_0x4206('0x15a'),this[_0x4206('0xd')]['callerid'],_0x274c2b['findBy']));return{'code':0xc8,'result':_0x4206('0x15b')};}else{logger[_0x4206('0x32')](util['format'](_0x4206('0x15c'),this[_0x4206('0xd')][_0x4206('0x3f')],_0x274c2b['findBy']));this['channel'][_0x4206('0xb5')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x4206('0x3f')],_0x274c2b[_0x4206('0x156')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x4206('0x10')][_0x4206('0x160')]=function(_0x4a905f){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x161'),_0x4a905f[_0x4206('0xb2')]));if(!this[_0x4206('0x8d')](_0x4a905f['operation'])){return this[_0x4206('0xd')][_0x4206('0x30')](_0x4a905f,'no\x20operation\x20configured');}this['channel'][_0x4206('0xb5')](util[_0x4206('0x2c')](_0x4206('0x162'),_0x4a905f['operation']));var _0x1b0572=eval(_0x4a905f[_0x4206('0x163')]);if(!this[_0x4206('0x8d')](_0x4a905f['variable_id'])){return this[_0x4206('0xd')][_0x4206('0xb5')](_0x4206('0xde'));}var _0xee1f88=this[_0x4206('0x11')]['sync'](this,_0x4a905f[_0x4206('0xdd')]);if(!_0xee1f88){return this['channel'][_0x4206('0x30')](_0x4a905f,_0x4206('0x113'));}if(_[_0x4206('0xa2')](_0x1b0572)){var _0x282c5b=this;_0x1b0572['forEach'](function(_0x185c68,_0x36ba98){_0x282c5b[_0x4206('0xd')][_0x4206('0xac')](util[_0x4206('0x2c')](_0x4206('0x164'),_0xee1f88,_0x36ba98),_0x185c68);});return this['channel']['noop'](util['format'](_0x4206('0x165'),_0xee1f88));}else{return this['channel'][_0x4206('0xac')](_0xee1f88,_0x1b0572);}};AGIVertices[_0x4206('0x10')]['menu']=function(_0x3c5460){logger[_0x4206('0x32')](util[_0x4206('0x2c')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x3c5460['label']));if(_0x3c5460[_0x4206('0xaf')]===0x0){return this[_0x4206('0xad')](_0x3c5460);}_0x3c5460['retry']-=0x1;if(!this[_0x4206('0x8d')](_0x3c5460[_0x4206('0x10d')])){return this['channel']['error'](_0x3c5460,_0x4206('0x10e'));}var _0x252759=this[_0x4206('0x20')][_0x4206('0xae')](this,_0x3c5460[_0x4206('0x10d')]);if(!_0x252759){return this[_0x4206('0xd')]['error'](_0x3c5460,_0x4206('0x10f'));}var _0x1be609=this['channel'][_0x4206('0x166')](_0x252759,_0x3c5460[_0x4206('0x167')],_0x3c5460[_0x4206('0x168')]);var _0x3f728c=_0x1be609[_0x4206('0xaa')];if(_0x1be609[_0x4206('0xaa')]===-0x1){this['createSquareDetailsReport'][_0x4206('0xae')](this,_0x3c5460,'-1');return _0x1be609;}else if(_0x1be609[_0x4206('0xa8')]===_0x4206('0x73')){_0x1be609[_0x4206('0xaa')]=_0x1be609[_0x4206('0xaa')][_0x4206('0xa3')]>0x0?_0x1be609[_0x4206('0xaa')]:'t';}else if(_[_0x4206('0x49')](_0x1be609[_0x4206('0xaa')])){_0x1be609[_0x4206('0xaa')]='#';_0x3f728c='#';}if(!this[_0x4206('0x8d')](_0x3c5460[_0x4206('0xdd')])){this[_0x4206('0xd')][_0x4206('0xb5')](_0x4206('0xde'));}else{var _0x1212de=this[_0x4206('0x11')][_0x4206('0xae')](this,_0x3c5460['variable_id']);if(!_0x1212de){return this[_0x4206('0xd')][_0x4206('0x30')](_0x3c5460,_0x4206('0x113'));}this[_0x4206('0xd')][_0x4206('0xac')](_0x1212de,_0x3f728c);}this[_0x4206('0x3a')][_0x4206('0xae')](this,_0x3c5460,_0x3f728c);return _0x1be609;};AGIVertices[_0x4206('0x10')][_0x4206('0xb5')]=function(_0x3d066e){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x169'),_0x3d066e[_0x4206('0xb2')]));return this[_0x4206('0xd')][_0x4206('0xb5')](_0x3d066e[_0x4206('0x16a')]||_0x3d066e[_0x4206('0xb2')]);};AGIVertices[_0x4206('0x10')][_0x4206('0x16b')]=function(_0x3075f7){logger[_0x4206('0x32')](util[_0x4206('0x2c')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x3075f7['label']));if(!this[_0x4206('0x8d')](_0x3075f7[_0x4206('0x156')])){return this['channel']['error'](_0x3075f7,_0x4206('0x157'));}logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x158'),this[_0x4206('0xd')][_0x4206('0x3f')],_0x3075f7[_0x4206('0x156')]));var _0x5a71bc=this['getPause'][_0x4206('0xae')](this,_0x3075f7[_0x4206('0x16c')]);var _0x34f1dd=this[_0x4206('0x5b')][_0x4206('0xae')](this,_0x3075f7[_0x4206('0x156')],_0x5a71bc);if(_0x34f1dd){logger['info'](util[_0x4206('0x2c')](_0x4206('0x15a'),this[_0x4206('0xd')]['callerid'],_0x3075f7[_0x4206('0x156')]));this[_0x4206('0xd')]['noop'](util[_0x4206('0x2c')](_0x4206('0x15a'),this[_0x4206('0xd')][_0x4206('0x3f')],_0x3075f7[_0x4206('0x156')]));return{'code':0xc8,'result':'success'};}else{logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x15c'),this[_0x4206('0xd')][_0x4206('0x3f')],_0x3075f7[_0x4206('0x156')]));this['channel'][_0x4206('0xb5')](util[_0x4206('0x2c')](_0x4206('0x15a'),this[_0x4206('0xd')][_0x4206('0x3f')],_0x3075f7['findBy']));return{'code':0xc8,'result':_0x4206('0x15d')};}};AGIVertices[_0x4206('0x10')]['playback']=function(_0x321b3b){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x16d'),_0x321b3b[_0x4206('0xb2')]));if(!this[_0x4206('0x8d')](_0x321b3b['file_id'])){return this['channel'][_0x4206('0x30')](_0x321b3b,_0x4206('0x10e'));}var _0x1780bc=this[_0x4206('0x20')][_0x4206('0xae')](this,_0x321b3b['file_id']);if(!_0x1780bc){return this[_0x4206('0xd')][_0x4206('0x30')](_0x321b3b,_0x4206('0x10f'));}var _0x4424fe=this['channel'][_0x4206('0x62')](_0x4206('0x16e'),[_0x1780bc,_0x321b3b[_0x4206('0xe7')]]);if(_0x4424fe[_0x4206('0xaa')]===-0x1){return _0x4424fe;}return this['channel'][_0x4206('0xb5')](util[_0x4206('0x2c')](_0x4206('0xcc'),'PLAYBACK',_0x1780bc));};AGIVertices[_0x4206('0x10')][_0x4206('0x16f')]=function(_0x5b5bfd){logger[_0x4206('0x32')](util['format'](_0x4206('0x170'),_0x5b5bfd[_0x4206('0xb2')]));if(!this['isConfigured'](_0x5b5bfd['queue_id'])){return this[_0x4206('0xd')][_0x4206('0x30')](_0x5b5bfd,_0x4206('0x171'));}var _0x4ce108='';var _0x989ee=parseInt(_0x5b5bfd[_0x4206('0x172')],0xa);if(isNaN(_0x989ee)){_0x4ce108=_0x5b5bfd[_0x4206('0x172')];}else{_0x4ce108=this[_0x4206('0x13')][_0x4206('0xae')](this,_0x5b5bfd['queue_id']);if(!_0x4ce108){return this[_0x4206('0xd')][_0x4206('0x30')](_0x5b5bfd,_0x4206('0x173'));}}var _0x6bddbc='';if(this[_0x4206('0x8d')](_0x5b5bfd[_0x4206('0x10d')])){var _0x71faf4=this['getSound'][_0x4206('0xae')](this,_0x5b5bfd[_0x4206('0x10d')]);if(_0x71faf4){_0x6bddbc=_0x71faf4;}}this[_0x4206('0x3a')]['sync'](this,_0x5b5bfd,_0x4ce108);if(_0x5b5bfd['opts'][_0x4206('0x174')]('x')<0x0){_0x5b5bfd[_0x4206('0xe7')]+='x';}if(_0x5b5bfd[_0x4206('0xe7')][_0x4206('0x174')]('X')<0x0){_0x5b5bfd[_0x4206('0xe7')]+='X';}this['channel']['setVariable'](_0x4206('0x175'),_0x4ce108?_0x4ce108['toLowerCase']():'');var _0x475990=this[_0x4206('0xd')][_0x4206('0x62')](_0x4206('0x176'),[_0x4ce108,_0x5b5bfd[_0x4206('0xe7')],_0x5b5bfd[_0x4206('0x71')],_0x6bddbc,_0x5b5bfd[_0x4206('0x73')],_0x5b5bfd[_0x4206('0x8')],_0x5b5bfd[_0x4206('0x177')],_0x5b5bfd[_0x4206('0x178')],'',_0x5b5bfd['position']]);if(_0x475990[_0x4206('0xaa')]===-0x1){return _0x475990;}return this['channel']['noop'](util['format'](_0x4206('0xcc'),_0x4206('0x176'),_0x4ce108));};AGIVertices['prototype']['record']=function(_0x5276ae){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x179'),_0x5276ae[_0x4206('0xb2')]));var _0x538c4c=_0x5276ae[_0x4206('0x17a')]||_0x4206('0x136');var _0x6004a6=util[_0x4206('0x2c')](_0x4206('0x17b'),this['channel'][_0x4206('0x3b')],rs[_0x4206('0x115')](0x5));var _0x49a6c4=util['format'](_0x4206('0x17c'),FILES_PATH,_0x6004a6,_0x538c4c);var _0x51b836=util[_0x4206('0x2c')](_0x4206('0x12b'),FILES_PATH,_0x6004a6);this[_0x4206('0x3e')][_0x4206('0xae')](this,_0x5276ae,_0x6004a6,_0x49a6c4);this[_0x4206('0xd')][_0x4206('0xac')](_0x4206('0x17d'),_0x6004a6);logger[_0x4206('0x32')](_0x4206('0x17e'),_0x51b836,_0x538c4c,_0x5276ae['escape_digits'],_0x5276ae['timeout']);return this[_0x4206('0xd')]['recordFile'](_0x51b836,_0x538c4c,_0x5276ae['escape_digits'],_0x5276ae['timeout'],undefined,!![]);};AGIVertices[_0x4206('0x10')]['restapi']=function(_0xa3a56a){logger[_0x4206('0x32')](util[_0x4206('0x2c')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0xa3a56a[_0x4206('0xb2')]));if(!this[_0x4206('0x8d')](_0xa3a56a['url'])){return this[_0x4206('0xd')][_0x4206('0xb5')](_0x4206('0x17f'));}var _0x5b5fff=this[_0x4206('0x70')][_0x4206('0xae')](this,_0xa3a56a);logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x180'),util['inspect'](_0x5b5fff,{'showHidden':![],'depth':null})));if(!this[_0x4206('0x8d')](_0xa3a56a[_0x4206('0xdd')])){return this[_0x4206('0xd')][_0x4206('0xb5')](_0x4206('0x181'));}var _0x183044=this[_0x4206('0x11')][_0x4206('0xae')](this,_0xa3a56a[_0x4206('0xdd')]);if(!_0x183044){return this[_0x4206('0xd')][_0x4206('0x30')](_0xa3a56a,_0x4206('0x113'));}this[_0x4206('0xd')]['setVariable'](util['format'](_0x4206('0x182'),_0x183044),_0x5b5fff[_0x4206('0x82')]?_0x5b5fff[_0x4206('0x82')]:_0x4206('0x183'));this[_0x4206('0xd')][_0x4206('0xac')](util[_0x4206('0x2c')]('%s_STATUS_MESSAGE',_0x183044),_0x5b5fff[_0x4206('0x83')]?_0x5b5fff[_0x4206('0x83')]:'OK');if(_0x5b5fff['body']){try{this[_0x4206('0xa6')](_0x5b5fff[_0x4206('0x81')],_0x183044);}catch(_0xc8a3d){logger[_0x4206('0x30')](util[_0x4206('0x2c')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x183044));}}return this[_0x4206('0xd')]['noop'](util['format'](_0x4206('0xe0'),_0x183044));};AGIVertices[_0x4206('0x10')][_0x4206('0x184')]=function(_0x3f5040){logger['info'](util[_0x4206('0x2c')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x3f5040[_0x4206('0xb2')]));return this['channel'][_0x4206('0x185')](_0x3f5040[_0x4206('0x186')][_0x4206('0x64')](/\s+/g,''),_0x3f5040[_0x4206('0x187')]);};AGIVertices[_0x4206('0x10')][_0x4206('0x188')]=function(_0x2ecf82){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x189'),_0x2ecf82[_0x4206('0xb2')]));return this[_0x4206('0xd')]['sayNumber'](_0x2ecf82[_0x4206('0x74')][_0x4206('0x64')](/\s+/g,''),_0x2ecf82[_0x4206('0x187')]);};AGIVertices[_0x4206('0x10')][_0x4206('0x18a')]=function(_0x5aa784){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x18b'),_0x5aa784['label']));return this[_0x4206('0xd')][_0x4206('0x18c')](_0x5aa784[_0x4206('0x68')],_0x5aa784['escape_digits']);};AGIVertices[_0x4206('0x10')]['sendMail']=function(_0x13b1b3){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x18d'),_0x13b1b3[_0x4206('0xb2')]));if(!this[_0x4206('0x8d')](_0x13b1b3[_0x4206('0x18e')])){return this[_0x4206('0xd')][_0x4206('0xb5')](_0x4206('0x18f'));}var _0x1929e1=this[_0x4206('0x24')][_0x4206('0xae')](this,_0x13b1b3[_0x4206('0x18e')]);if(!_0x1929e1||!_0x1929e1[_0x4206('0x190')]){return this[_0x4206('0xd')][_0x4206('0x30')](_0x13b1b3,_0x4206('0x191'));}var _0x5742e5={'from':util[_0x4206('0x2c')](_0x4206('0x192'),_0x1929e1[_0x4206('0x16')],_0x1929e1[_0x4206('0x193')]||_0x1929e1['Smtp'][_0x4206('0x194')]),'to':_0x13b1b3['to']||'','cc':_0x13b1b3['cc']||'','bcc':_0x13b1b3[_0x4206('0x195')]||'','subject':_0x13b1b3[_0x4206('0x196')],'html':_0x13b1b3[_0x4206('0x68')],'text':_0x13b1b3[_0x4206('0x68')]};var _0x3be493={'tls':{'rejectUnauthorized':![]}};if(_0x1929e1[_0x4206('0x190')][_0x4206('0x197')]){_0x3be493[_0x4206('0x197')]=_0x1929e1[_0x4206('0x190')][_0x4206('0x197')];}else{_0x3be493[_0x4206('0x198')]=_0x1929e1[_0x4206('0x190')]['host'];_0x3be493[_0x4206('0x199')]=_0x1929e1[_0x4206('0x190')][_0x4206('0x199')];_0x3be493[_0x4206('0x19a')]=_0x1929e1[_0x4206('0x190')][_0x4206('0x19a')];}if(_0x1929e1[_0x4206('0x190')][_0x4206('0x19b')]){_0x3be493[_0x4206('0x19c')]={'user':_0x1929e1['Smtp'][_0x4206('0x194')],'pass':_0x1929e1[_0x4206('0x190')]['pass']};}if(this[_0x4206('0x8d')](_0x13b1b3[_0x4206('0x19d')])){}logger['debug'](_0x4206('0x19e'),JSON['stringify'](_0x5742e5));this[_0x4206('0x3a')][_0x4206('0xae')](this,_0x13b1b3,_0x13b1b3[_0x4206('0x18e')]);this[_0x4206('0xd')][_0x4206('0xb5')](util[_0x4206('0x2c')](_0x4206('0x19f'),_0x1929e1[_0x4206('0x16')]));this['sendMailMessage'][_0x4206('0xae')](this,_0x3be493,_0x5742e5);return this['channel'][_0x4206('0xb5')](_0x4206('0x1a0'));};AGIVertices[_0x4206('0x10')][_0x4206('0x1a1')]=function(_0x387f54){logger['info'](util[_0x4206('0x2c')](_0x4206('0x1a2'),_0x387f54[_0x4206('0xb2')]));return this[_0x4206('0xd')]['noop'](_0x4206('0x1a3'));};AGIVertices[_0x4206('0x10')][_0x4206('0x1a4')]=function(_0x316e55){logger[_0x4206('0x32')](util[_0x4206('0x2c')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x316e55[_0x4206('0xb2')]));if(!this[_0x4206('0x8d')](_0x316e55[_0x4206('0x1a5')])){return this[_0x4206('0xd')][_0x4206('0xb5')](_0x4206('0x1a6'));}var _0x213b71=this[_0x4206('0x1a7')][_0x4206('0xae')](this,_0x316e55[_0x4206('0x1a5')]);if(!_0x213b71){return this[_0x4206('0xd')]['error'](_0x316e55,_0x4206('0x1a8'));}var _0x34cd6b={'body':_0x316e55[_0x4206('0x1a9')],'phone':_0x316e55['to']||'','SmsAccountId':_0x213b71['id']};logger['debug'](_0x4206('0x1aa'),JSON[_0x4206('0x80')](_0x34cd6b));this['createSquareDetailsReport'][_0x4206('0xae')](this,_0x316e55,_0x316e55[_0x4206('0x1a5')]);this[_0x4206('0xd')][_0x4206('0xb5')](util[_0x4206('0x2c')](_0x4206('0x1ab'),_0x213b71['name']));this['createSmsMessage']['sync'](this,_0x34cd6b);return this[_0x4206('0xd')][_0x4206('0xb5')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x4206('0x10')]['set']=function(_0x42ce36){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x1ac'),_0x42ce36[_0x4206('0xb2')]));if(!this[_0x4206('0x8d')](_0x42ce36[_0x4206('0xdd')])){return this[_0x4206('0xd')]['error'](_0x42ce36,_0x4206('0x1ad'));}var _0x447926=this[_0x4206('0x11')][_0x4206('0xae')](this,_0x42ce36['variable_id']);if(!_0x447926){return this[_0x4206('0xd')][_0x4206('0x30')](_0x42ce36,_0x4206('0x113'));}return this[_0x4206('0xd')][_0x4206('0xac')](_0x447926,_0x42ce36[_0x4206('0x1ae')]);};AGIVertices['prototype'][_0x4206('0x1af')]=function(_0x532fe2){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x1b0'),_0x532fe2['label']));this[_0x4206('0xd')][_0x4206('0xb5')](_0x4206('0x1b1'));if(_0x532fe2['answer']===_0x4206('0x1b2')){this[_0x4206('0xd')][_0x4206('0xb5')]('Answer');return this['channel']['answer']();}return this[_0x4206('0xd')][_0x4206('0xb5')]('Skipped\x20Answer');};AGIVertices[_0x4206('0x10')][_0x4206('0x1b3')]=function(_0x34531b){logger['info'](util[_0x4206('0x2c')](_0x4206('0x1b4'),_0x34531b[_0x4206('0xb2')]));if(!this[_0x4206('0x8d')](_0x34531b[_0x4206('0x1b5')])){return this['channel']['error'](_0x34531b,_0x4206('0x1b6'));}var _0x17c76d=this[_0x4206('0x1b7')][_0x4206('0xae')](this,_0x34531b[_0x4206('0x1b5')]);if(!this['isConfigured'](_0x17c76d)){return this[_0x4206('0xd')][_0x4206('0x30')](_0x34531b,util[_0x4206('0x2c')](_0x4206('0x1b8'),_0x34531b[_0x4206('0x1b5')]));}if(_0x17c76d===this[_0x4206('0xd')][_0x4206('0x3d')]){return this[_0x4206('0xd')][_0x4206('0x30')](_0x34531b,_0x4206('0x1b9'));}this[_0x4206('0x3a')]['sync'](this,_0x34531b,_0x17c76d);var _0x2ec947=this[_0x4206('0xd')]['exec'](_0x4206('0x1ba'),util[_0x4206('0x2c')](_0x4206('0x1bb'),config[_0x4206('0x8')][_0x4206('0x198')]||_0x4206('0x1bc'),_0x17c76d,this[_0x4206('0xd')][_0x4206('0x3d')]));if(_0x2ec947[_0x4206('0xaa')]===-0x1){return _0x2ec947;}return this[_0x4206('0xd')][_0x4206('0xb5')](util['format'](_0x4206('0xcc'),_0x4206('0x1ba'),_0x17c76d));};AGIVertices[_0x4206('0x10')]['system']=function(_0x544719){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x1bd'),_0x544719[_0x4206('0xb2')]));var _0x36fcd9=this['shellCommand'][_0x4206('0xae')](this,_0x544719[_0x4206('0xc1')]);this[_0x4206('0x3a')][_0x4206('0xae')](this,_0x544719,_0x544719[_0x4206('0xc1')]);if(this['isConfigured'](_0x544719[_0x4206('0xdd')])){var _0xecde71=this[_0x4206('0x11')][_0x4206('0xae')](this,_0x544719[_0x4206('0xdd')]);if(_0xecde71){this[_0x4206('0xd')]['setVariable'](_0xecde71,_0x36fcd9);return this[_0x4206('0xd')][_0x4206('0xb5')](util[_0x4206('0x2c')](_0x4206('0x1be'),_0x544719[_0x4206('0xc1')],_0xecde71));}}return this['channel'][_0x4206('0xb5')](util[_0x4206('0x2c')](_0x4206('0x1bf'),_0x544719['command']));};AGIVertices[_0x4206('0x10')][_0x4206('0x1c0')]=function(_0x3cd243){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x1c1'),_0x3cd243[_0x4206('0xb2')]));_0x3cd243[_0x4206('0x68')]=_0x3cd243[_0x4206('0x68')][_0x4206('0x64')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4206('0x8d')](_0x3cd243[_0x4206('0x66')])){return this[_0x4206('0xd')]['noop'](_0x4206('0x1c2'));}if(!this['isConfigured'](_0x3cd243[_0x4206('0x68')])){return this[_0x4206('0xd')][_0x4206('0xb5')](_0x4206('0xb3'));}this[_0x4206('0xd')][_0x4206('0xb5')](util[_0x4206('0x2c')](_0x4206('0x1c3'),_0x3cd243[_0x4206('0x68')]));var _0xf5062c=this[_0x4206('0x65')]['sync'](this,_0x3cd243);if(_0xf5062c){this[_0x4206('0xd')]['noop'](util[_0x4206('0x2c')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0xf5062c));var _0x269e8e=this[_0x4206('0xd')][_0x4206('0xfe')](_0xf5062c);try{fs[_0x4206('0xff')](_0xf5062c+_0x4206('0x100'));}catch(_0xa19e30){logger['error'](_0xa19e30);}return _0x269e8e;}return this[_0x4206('0xd')][_0x4206('0x30')](_0x3cd243,_0x4206('0x1c4'));};AGIVertices[_0x4206('0x10')][_0x4206('0x1c5')]=function(_0x2375e8){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x1c6'),_0x2375e8[_0x4206('0xb2')]));_0x2375e8[_0x4206('0x68')]=_0x2375e8['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4206('0x8d')](_0x2375e8[_0x4206('0x68')])){return this[_0x4206('0xd')][_0x4206('0xb5')](_0x4206('0xb3'));}this[_0x4206('0xd')]['noop'](util[_0x4206('0x2c')](_0x4206('0x1c7'),_0x2375e8[_0x4206('0x68')]));var _0x3029d2=this[_0x4206('0x6e')]['sync'](this,_0x2375e8);if(_0x3029d2){this[_0x4206('0xd')]['noop'](util[_0x4206('0x2c')](_0x4206('0x1c8'),_0x3029d2));var _0x48968b=this[_0x4206('0xd')][_0x4206('0xfe')](_0x3029d2);try{fs[_0x4206('0xff')](_0x3029d2+_0x4206('0x100'));}catch(_0x53fc58){logger[_0x4206('0x30')](_0x53fc58);}return _0x48968b;}return this[_0x4206('0xd')][_0x4206('0x30')](_0x2375e8,_0x4206('0x1c9'));};AGIVertices[_0x4206('0x10')]['unpause']=function(_0x2b3992){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x1ca'),_0x2b3992['label']));if(!this['isConfigured'](_0x2b3992[_0x4206('0x156')])){return this[_0x4206('0xd')][_0x4206('0x30')](_0x2b3992,_0x4206('0x157'));}logger[_0x4206('0x32')](util['format'](_0x4206('0x158'),this['channel'][_0x4206('0x3f')],_0x2b3992[_0x4206('0x156')]));var _0x205cf3=this['agentUnpause']['sync'](this,_0x2b3992[_0x4206('0x156')]);if(_0x205cf3){logger[_0x4206('0x32')](util['format'](_0x4206('0x15a'),this['channel'][_0x4206('0x3f')],_0x2b3992[_0x4206('0x156')]));this['channel']['noop'](util[_0x4206('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4206('0xd')]['callerid'],_0x2b3992[_0x4206('0x156')]));return{'code':0xc8,'result':_0x4206('0x15b')};}else{logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x15c'),this[_0x4206('0xd')][_0x4206('0x3f')],_0x2b3992[_0x4206('0x156')]));this[_0x4206('0xd')][_0x4206('0xb5')](util['format'](_0x4206('0x15c'),this[_0x4206('0xd')][_0x4206('0x3f')],_0x2b3992['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x4206('0x10')][_0x4206('0x1cb')]=function(_0x583d30){logger[_0x4206('0x32')](util['format'](_0x4206('0x1cc'),_0x583d30[_0x4206('0xb2')]));var _0xacd276=this[_0x4206('0xd')][_0x4206('0x62')](_0x4206('0x1cd'),[_0x583d30[_0x4206('0x1ce')],_0x583d30[_0x4206('0x84')]]);if(_0xacd276[_0x4206('0xaa')]===-0x1){return _0xacd276;}return this[_0x4206('0xd')][_0x4206('0xb5')](util[_0x4206('0x2c')]('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x583d30['mailbox']));};AGIVertices[_0x4206('0x10')][_0x4206('0x1cf')]=function(_0x1dea2b){logger[_0x4206('0x32')](util[_0x4206('0x2c')](_0x4206('0x1d0'),_0x1dea2b['label']));if(!this['isConfigured'](_0x1dea2b['variable_id'])){return this['channel'][_0x4206('0x30')](_0x1dea2b,'no\x20variable\x20selected');}var _0x386efe=this['getVariable'][_0x4206('0xae')](this,_0x1dea2b[_0x4206('0xdd')]);if(!_0x386efe){return this[_0x4206('0xd')][_0x4206('0x30')](_0x1dea2b,_0x4206('0x113'));}var _0x1196f8=this[_0x4206('0xd')][_0x4206('0x11')](_0x386efe);return{'code':0xc8,'result':_0x1196f8[_0x4206('0xa8')]?_0x1196f8[_0x4206('0xa8')]:'-'};};String[_0x4206('0x10')][_0x4206('0x1d1')]=function(_0xebf48,_0x369a0e){return this[_0x4206('0xa7')](_0xebf48)['join'](_0x369a0e);};module[_0x4206('0x1d2')]=AGIVertices; \ No newline at end of file +var _0xf3c3=['out','Dialogflow\x20Result\x20%s','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndassistant_url','Trying\x20SestekNDA:\x20%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','getTrunk','no\x20trunk\x20selected','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','retry','no\x20file\x20audio\x20selected','getData','maxdigit','toString','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','isString','AWS_LEX_%s','message','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','intKey','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','no\x20variable\x20found','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','response','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','gosub','QUEUE','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%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','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','subject','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sms_account_id','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','lodash','odbc','randomstring','moment','request-promise','../../config/environment/shared','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','interval','map','Intervals','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','context','extension','priority','arg_1','file','createSquareMessage','createCmContact','isNil','random','isEmpty','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','has','dialTimezone','CALLERID(dialTimezone)','getContactByPhone','timezones','scheduledat','add','insertContact','utcOffset','minutes','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','url','timeout','includes','PUT','method','body','headers','parse','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','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','sestekNDA','ispeechTTS','key','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','grammar','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','no\x20grammar\x20configured','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','toUpperCase','speech'];(function(_0x514100,_0x18e127){var _0x2e6699=function(_0x2a3b06){while(--_0x2a3b06){_0x514100['push'](_0x514100['shift']());}};_0x2e6699(++_0x18e127);}(_0xf3c3,0xd6));var _0x3f3c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3c3[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var _=require(_0x3f3c('0x0'));var sh=require('shelljs');var odbc=require(_0x3f3c('0x1'))();var rs=require(_0x3f3c('0x2'));var moment=require(_0x3f3c('0x3'));var Mustache=require('mustache');var rp=require(_0x3f3c('0x4'));var logger=require('../../config/logger')('agi');var config=require('../../config/environment');var shared=require(_0x3f3c('0x5'));var scripts=require('./scripts');var FILES_PATH=_0x3f3c('0x6');var recursiveMapAttributes=[_0x3f3c('0x7'),_0x3f3c('0x8')];var verticesWithRetry=['menu',_0x3f3c('0x9'),_0x3f3c('0xa')];var AGIVertices=function(_0x1c335a,_0x1cdccf,_0x2376c6){this[_0x3f3c('0xb')]=_0x1c335a;this[_0x3f3c('0xc')]=_0x1cdccf;this[_0x3f3c('0xd')]=_0x2376c6;};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0xf')]=function(_0x59b9e7,_0x5cbda0){this['rpc']['getVariableById'](_0x59b9e7)[_0x3f3c('0x10')](function(_0x37aace){_0x5cbda0(null,_0x37aace?_0x37aace[_0x3f3c('0x11')]:![]);})[_0x3f3c('0x12')](function(_0x258c2f){_0x5cbda0(_0x258c2f);});};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x13')]=function(_0x437365,_0xc170d4){this['rpc'][_0x3f3c('0x14')](_0x437365)[_0x3f3c('0x10')](function(_0x37eef7){_0xc170d4(null,_0x37eef7?_0x37eef7[_0x3f3c('0x11')]:![]);})['catch'](function(_0x15830f){_0xc170d4(_0x15830f);});};AGIVertices[_0x3f3c('0xe')]['getSquareProject']=function(_0x36f14e,_0x56b11b){this[_0x3f3c('0xc')][_0x3f3c('0x15')](_0x36f14e)[_0x3f3c('0x10')](function(_0xa21f3c){_0x56b11b(null,_0xa21f3c?_0xa21f3c['name']:![]);})[_0x3f3c('0x12')](function(_0x2ee559){_0x56b11b(_0x2ee559);});};AGIVertices['prototype'][_0x3f3c('0x16')]=function(_0x702c24,_0x4d959e){this[_0x3f3c('0xc')][_0x3f3c('0x17')](_0x702c24)[_0x3f3c('0x10')](function(_0x463dfb){_0x4d959e(null,_0x463dfb?_0x463dfb[_0x3f3c('0x18')]:![]);})[_0x3f3c('0x12')](function(_0x3063df){_0x4d959e(_0x3063df);});};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x19')]=function(_0x142dc9,_0x375cf1){this[_0x3f3c('0xc')][_0x3f3c('0x1a')](_0x142dc9)[_0x3f3c('0x10')](function(_0x53c165){_0x375cf1(null,_0x53c165?_0x53c165[_0x3f3c('0x11')]:![]);})[_0x3f3c('0x12')](function(_0x3986d7){_0x375cf1(_0x3986d7);});};AGIVertices['prototype']['getTrunk']=function(_0x14884d,_0x2ab46d){this[_0x3f3c('0xc')][_0x3f3c('0x1b')](_0x14884d)[_0x3f3c('0x10')](function(_0x120040){_0x2ab46d(null,_0x120040?_0x120040[_0x3f3c('0x11')]:![]);})[_0x3f3c('0x12')](function(_0x441f0a){_0x2ab46d(_0x441f0a);});};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x1c')]=function(_0x4e3753,_0x35fb43){var _0x21f94f=this;this[_0x3f3c('0xc')][_0x3f3c('0x1d')](_0x4e3753)[_0x3f3c('0x10')](function(_0x28e96d){_0x35fb43(null,_0x28e96d?_0x21f94f[_0x3f3c('0x1e')](_0x28e96d[_0x3f3c('0x1f')]):![]);})[_0x3f3c('0x12')](function(_0x2f585c){_0x35fb43(_0x2f585c);});};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x20')]=function(_0xf385f1,_0x531d61){this[_0x3f3c('0xc')][_0x3f3c('0x21')](_0xf385f1)[_0x3f3c('0x10')](function(_0x129992){_0x531d61(null,_0x129992?_0x129992:![]);})[_0x3f3c('0x12')](function(_0x3460db){_0x531d61(_0x3460db);});};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x22')]=function(_0xfef0b2,_0x39eb26,_0x1c3524){this[_0x3f3c('0xd')]['sendMailMessage'](_0xfef0b2,_0x39eb26)['then'](function(){_0x1c3524(null);})[_0x3f3c('0x12')](function(_0x1a04e7){_0x1c3524(_0x1a04e7);});};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x23')]=function(_0x3aea7b,_0x12e8c0){this[_0x3f3c('0xc')]['getIntervalById'](_0x3aea7b)['then'](function(_0x375c21){if(_0x375c21){if(_0x375c21['IntervalId']){_0x12e8c0(null,[_0x375c21[_0x3f3c('0x24')]]);}else{_0x12e8c0(null,_[_0x3f3c('0x25')](_0x375c21[_0x3f3c('0x26')],'interval'));}}else{_0x12e8c0(null,![]);}})['catch'](function(_0x315be1){_0x12e8c0(_0x315be1);});};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x1e')]=function(_0x520a9a){return util[_0x3f3c('0x27')](_0x3f3c('0x28'),FILES_PATH,_0x520a9a);};AGIVertices[_0x3f3c('0xe')]['getQueryOdbc']=function(_0xf03bc6,_0x41da48,_0x501262){odbc[_0x3f3c('0x29')](_0xf03bc6,function(_0x1acf79){if(_0x1acf79){logger[_0x3f3c('0x2a')](_0x3f3c('0x2b'),_0x1acf79);_0x501262(_0x1acf79);}else{logger[_0x3f3c('0x2c')](_0x3f3c('0x2d'));odbc['query'](_0x41da48,function(_0xd43b50,_0x3a95c6){if(_0xd43b50){logger['info'](_0x3f3c('0x2e'),_0x41da48);_0x501262(_0xd43b50);}else{logger[_0x3f3c('0x2c')](_0x3f3c('0x2f'),_0x41da48);odbc[_0x3f3c('0x30')](function(_0x1e5aa1){if(_0x1e5aa1){logger[_0x3f3c('0x2a')](_0x3f3c('0x31'),_0x1e5aa1);}_0x501262(null,_0x3a95c6);});}});}});};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x32')]=function(_0x474990,_0x2bf8f8){this['rpc'][_0x3f3c('0x33')](_0x474990)[_0x3f3c('0x10')](function(_0x21afea){_0x2bf8f8(null,_0x21afea?_0x21afea:![]);})[_0x3f3c('0x12')](function(_0x261518){_0x2bf8f8(_0x261518);});};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x34')]=function(_0x289a67,_0x5ea6f4){this[_0x3f3c('0xc')]['createSmsMessage'](_0x289a67)[_0x3f3c('0x10')](function(_0x4a092b){_0x5ea6f4(null,_0x4a092b);})['catch'](function(_0x1c2829){_0x5ea6f4(_0x1c2829);});};AGIVertices[_0x3f3c('0xe')]['createSquareDetailsReport']=function(_0x54f896,_0x28baab,_0x3a9330){this[_0x3f3c('0xc')][_0x3f3c('0x35')]({'uniqueid':this['channel'][_0x3f3c('0x36')],'node':_0x54f896[_0x3f3c('0x37')],'application':_0x54f896[_0x3f3c('0x38')],'data':_0x28baab||null,'project_name':this[_0x3f3c('0xb')]['arg_1'],'callerid':this[_0x3f3c('0xb')][_0x3f3c('0x39')]})['then'](function(_0x59bb4c){if(_0x3a9330){_0x3a9330(null,_0x59bb4c);}})['catch'](function(_0x5e8cc7){if(_0x3a9330){_0x3a9330(_0x5e8cc7);}});};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x3a')]=function(_0x4ed205,_0x6670e,_0x2f8dbb,_0x50e42b){this['rpc'][_0x3f3c('0x3a')]({'uniqueid':this[_0x3f3c('0xb')][_0x3f3c('0x36')],'callerid':this[_0x3f3c('0xb')]['callerid'],'calleridname':this[_0x3f3c('0xb')][_0x3f3c('0x3b')],'context':this[_0x3f3c('0xb')][_0x3f3c('0x3c')],'extension':this[_0x3f3c('0xb')][_0x3f3c('0x3d')],'priority':this[_0x3f3c('0xb')][_0x3f3c('0x3e')],'accountcode':this[_0x3f3c('0xb')]['accountcode'],'dnid':this['channel']['dnid'],'projectName':this[_0x3f3c('0xb')][_0x3f3c('0x3f')],'saveName':_0x6670e,'filename':_0x4ed205[_0x3f3c('0x40')]||_0x6670e,'savePath':_0x2f8dbb})[_0x3f3c('0x10')](function(_0x5e97fd){_0x50e42b(null,_0x5e97fd);})[_0x3f3c('0x12')](function(_0x465d8e){_0x50e42b(_0x465d8e);});};AGIVertices[_0x3f3c('0xe')]['createSquareMessage']=function(_0x5b3a7b,_0x1dd30d,_0x2c46af){this['rpc'][_0x3f3c('0x41')]({'uniqueid':this[_0x3f3c('0xb')][_0x3f3c('0x36')],'body':_0x5b3a7b,'direction':_0x1dd30d})['then'](function(_0x4907ad){if(_0x2c46af){_0x2c46af(null,_0x4907ad);}})[_0x3f3c('0x12')](function(_0x3dc3a8){if(_0x2c46af){_0x2c46af(_0x3dc3a8);}});};AGIVertices['prototype'][_0x3f3c('0x42')]=function(_0x47d0d6,_0x3fa89d){var _0x29327f=this;var _0xb633b4=0x0;var _0x1910a9={'firstName':_['isEmpty'](_0x47d0d6['name'])||_[_0x3f3c('0x43')](_0x47d0d6['name'])?'callback_'+Math[_0x3f3c('0x44')]():_0x47d0d6[_0x3f3c('0x11')],'lastName':_[_0x3f3c('0x45')](_0x47d0d6[_0x3f3c('0x46')])||_[_0x3f3c('0x43')](_0x47d0d6[_0x3f3c('0x46')])?null:_0x47d0d6[_0x3f3c('0x46')],'phone':_0x47d0d6[_0x3f3c('0x47')],'ListId':_0x47d0d6[_0x3f3c('0x48')],'scheduledat':_0x47d0d6[_0x3f3c('0x49')],'callbackUniqueid':this[_0x3f3c('0xb')][_0x3f3c('0x36')],'tags':_0x3f3c('0x4a'),'description':_0x3f3c('0x4b')+_0x47d0d6[_0x3f3c('0x49')]['toString'](),'priority':_0x47d0d6[_0x3f3c('0x4c')]};if(_[_0x3f3c('0x4d')](_0x47d0d6,_0x3f3c('0x4e'))){if(!_[_0x3f3c('0x43')](_0x47d0d6['dialTimezone'])){var _0xbb389=_0x47d0d6['dialTimezone'];if(_0x47d0d6['dialTimezone']==_0x3f3c('0x4f')){this[_0x3f3c('0xc')][_0x3f3c('0x50')]({'phone':_0x47d0d6[_0x3f3c('0x47')]})[_0x3f3c('0x10')](function(_0x51eab7){if(!_[_0x3f3c('0x43')](_0x51eab7)){var _0x184884=_0x51eab7[_0x3f3c('0x4e')];if(!_[_0x3f3c('0x43')](_0x184884)){var _0x4354a8=shared[_0x3f3c('0x51')][_0x184884];if(!_[_0x3f3c('0x43')](_0x4354a8)){var _0x2f5120=-0x1*_0x4354a8['utcOffset'];_0x1910a9[_0x3f3c('0x52')]=moment(_0x47d0d6['scheduledat'])[_0x3f3c('0x53')](_0x2f5120,'minutes');_0x29327f['insertContact'](_0x1910a9,_0x47d0d6,_0x3fa89d);}else{_0x29327f['insertContact'](_0x1910a9,_0x47d0d6,_0x3fa89d);}}else{_0x29327f[_0x3f3c('0x54')](_0x1910a9,_0x47d0d6,_0x3fa89d);}}else{_0x29327f[_0x3f3c('0x54')](_0x1910a9,_0x47d0d6,_0x3fa89d);}});}else{var _0xb633b4=shared['timezones'][_0xbb389];if(!_[_0x3f3c('0x43')](_0xb633b4)){var _0x13a39b=-0x1*_0xb633b4[_0x3f3c('0x55')];_0x1910a9['scheduledat']=moment(_0x47d0d6[_0x3f3c('0x52')])[_0x3f3c('0x53')](_0x13a39b,_0x3f3c('0x56'));_0x29327f[_0x3f3c('0x54')](_0x1910a9,_0x47d0d6,_0x3fa89d);}else{_0x29327f[_0x3f3c('0x54')](_0x1910a9,_0x47d0d6,_0x3fa89d);}}}else{_0x29327f[_0x3f3c('0x54')](_0x1910a9,_0x47d0d6,_0x3fa89d);}}else{_0x29327f['insertContact'](_0x1910a9,_0x47d0d6,_0x3fa89d);}};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x54')]=function(_0x3c7208,_0x39b863,_0x424f11){this[_0x3f3c('0xc')][_0x3f3c('0x42')](_0x3c7208)[_0x3f3c('0x10')](function(_0x2d329c){_0x424f11(null,_0x2d329c);})['catch'](function(_0x4a171d){_0x424f11(_0x4a171d);});};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x57')]=function(_0x336b06,_0xa77829){this['rpc'][_0x3f3c('0x58')](_0x336b06)['then'](function(_0x1ead7c){_0xa77829(null,_0x1ead7c?_0x1ead7c['name']:![]);})['catch'](function(_0x2f2b69){_0xa77829(_0x2f2b69);});};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x59')]=function(_0x1d1e18,_0x6868b1,_0x374fdc){var _0x11acea={'role':'agent'};_0x11acea[_0x1d1e18]=this['channel'][_0x3f3c('0x39')];this['rpc'][_0x3f3c('0x59')](_0x11acea,_0x6868b1,this[_0x3f3c('0xb')][_0x3f3c('0x36')])['then'](function(_0x1cfd5b){_0x374fdc(null,_[_0x3f3c('0x43')](_0x1cfd5b)?![]:!![]);})[_0x3f3c('0x12')](function(_0x54181d){logger[_0x3f3c('0x2a')](_0x54181d);_0x374fdc(null,![]);});};AGIVertices[_0x3f3c('0xe')]['agentUnpause']=function(_0x2ec9a2,_0x2014d5){var _0x246d91={'role':_0x3f3c('0x5a')};_0x246d91[_0x2ec9a2]=this['channel']['callerid'];this[_0x3f3c('0xc')][_0x3f3c('0x5b')](_0x246d91)['then'](function(_0x582073){_0x2014d5(null,_[_0x3f3c('0x43')](_0x582073)?![]:!![]);})[_0x3f3c('0x12')](function(_0x3114e6){logger[_0x3f3c('0x2a')](_0x3114e6);_0x2014d5(null,![]);});};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x5c')]=function(_0x577670,_0x3132e3){var _0x5157e3={'role':_0x3f3c('0x5a')};_0x5157e3[_0x577670]=this[_0x3f3c('0xb')]['callerid'];this[_0x3f3c('0xc')][_0x3f3c('0x5c')](_0x5157e3)[_0x3f3c('0x10')](function(_0x27c6b6){_0x3132e3(null,_[_0x3f3c('0x43')](_0x27c6b6)?![]:!![]);})[_0x3f3c('0x12')](function(_0x4b4655){logger['error'](_0x4b4655);_0x3132e3(null,![]);});};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x5d')]=function(_0x356c96,_0x4aa0ab){var _0x379652={'role':_0x3f3c('0x5a')};_0x379652[_0x356c96]=this[_0x3f3c('0xb')][_0x3f3c('0x39')];var _0x354c27=_0x356c96!=_0x3f3c('0x5e')?util[_0x3f3c('0x27')]('%s/%s@from-sip/n',_0x3f3c('0x5f'),this[_0x3f3c('0xb')]['callerid']):undefined;this[_0x3f3c('0xc')][_0x3f3c('0x5d')](_0x379652,_0x354c27)[_0x3f3c('0x10')](function(_0x213fcf){_0x4aa0ab(null,_['isNil'](_0x213fcf)?![]:!![]);})[_0x3f3c('0x12')](function(_0x5ad41d){logger[_0x3f3c('0x2a')](_0x5ad41d);_0x4aa0ab(null,![]);});};AGIVertices['prototype'][_0x3f3c('0x60')]=function(_0x55c0e5,_0x2114cc){sh[_0x3f3c('0x61')](_[_0x3f3c('0x62')](_0x55c0e5),function(_0x11d805,_0x280ad3){var _0x494747=_0x280ad3[_0x3f3c('0x63')](/(\r\n|\n|\r)/gm,'');_0x2114cc(null,_0x494747);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x3349f8,_0x3cffbe){scripts[_0x3f3c('0x64')](_0x3349f8[_0x3f3c('0x65')],_0x3349f8[_0x3f3c('0x66')]||_0x3f3c('0x67'),_0x3349f8['text'],_0x3349f8[_0x3f3c('0x68')]||_0x3f3c('0x69'),_0x3349f8[_0x3f3c('0x6a')]||_0x3f3c('0x6b'),_0x3349f8['audioEncoding']||_0x3f3c('0x6c'))[_0x3f3c('0x10')](function(_0x1cb0cf){_0x3cffbe(null,_0x1cb0cf);})['catch'](function(_0xb8d24){_0x3cffbe(_0xb8d24);});};AGIVertices[_0x3f3c('0xe')]['googleTTS']=function(_0x4228e2,_0x483e2d){scripts[_0x3f3c('0x6d')](_0x4228e2[_0x3f3c('0x67')],_0x4228e2[_0x3f3c('0x6e')]||'en',0x1)[_0x3f3c('0x10')](function(_0xf1f8a1){_0x483e2d(null,_0xf1f8a1);})['catch'](function(_0x280523){_0x483e2d(_0x280523);});};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x6f')]=function(_0x1d783d,_0xd6d923){var _0x16c2ac={'uri':_0x1d783d[_0x3f3c('0x70')],'method':_0x1d783d['method'],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1d783d['timeout'])==='number'&&parseInt(_0x1d783d['timeout'])>=0x1?parseInt(_0x1d783d[_0x3f3c('0x71')])*0x3e8:0x5*0x3e8};if(_[_0x3f3c('0x72')](['POST',_0x3f3c('0x73')],_0x16c2ac[_0x3f3c('0x74')]['toUpperCase']())){try{_0x16c2ac[_0x3f3c('0x75')]=_0x1d783d['rawBody']?JSON['parse'](_0x1d783d[_0x3f3c('0x8')]):{};}catch(_0x3d16e1){logger[_0x3f3c('0x2a')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3d16e1);}}try{_0x16c2ac[_0x3f3c('0x76')]=_0x1d783d[_0x3f3c('0x7')]?JSON[_0x3f3c('0x77')](_0x1d783d[_0x3f3c('0x7')]):{};}catch(_0x2382b3){logger[_0x3f3c('0x2a')](_0x3f3c('0x78'),_0x2382b3);}if(_0x1d783d[_0x3f3c('0x79')]){try{var _0x974505=require(_0x1d783d[_0x3f3c('0x79')])[_0x3f3c('0x7a')](this,_0x16c2ac);_0x16c2ac[_0x3f3c('0x7b')]=Mustache[_0x3f3c('0x7c')](_0x1d783d[_0x3f3c('0x70')],_0x974505,{},['$$','$$']);if(_0x16c2ac[_0x3f3c('0x76')]){_0x16c2ac['headers']=JSON[_0x3f3c('0x77')](Mustache[_0x3f3c('0x7c')](JSON[_0x3f3c('0x7d')](_0x16c2ac[_0x3f3c('0x76')]),_0x974505,{},['$$','$$']));}if(_0x16c2ac[_0x3f3c('0x75')]){_0x16c2ac[_0x3f3c('0x75')]=JSON[_0x3f3c('0x77')](Mustache['render'](JSON[_0x3f3c('0x7d')](_0x16c2ac[_0x3f3c('0x75')]),_0x974505,{},['$$','$$']));}}catch(_0x3f2d88){logger[_0x3f3c('0x2a')](_0x3f3c('0x7e'),_0x3f2d88);}}rp(_0x16c2ac)[_0x3f3c('0x10')](function(_0x2bafd1){var _0x4986e6={'statusCode':_0x2bafd1[_0x3f3c('0x7f')]||0xc8,'statusMessage':_0x2bafd1['statusMessage']||'OK','headers':_0x2bafd1['headers']||{},'body':_0x2bafd1[_0x3f3c('0x75')]||{}};_0xd6d923(null,_0x4986e6);})[_0x3f3c('0x12')](function(_0x29e32d){var _0x4ba324={'statusCode':_0x29e32d['statusCode']||0x1f4,'statusMessage':_0x29e32d['message']||_0x3f3c('0x80'),'headers':_0x29e32d[_0x3f3c('0x81')][_0x3f3c('0x76')]||{},'body':_0x29e32d[_0x3f3c('0x81')][_0x3f3c('0x75')]||{}};_0xd6d923(null,_0x4ba324);});};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x82')]=function(_0x2744be,_0x5e800f){scripts['googleDialogflow'](this[_0x3f3c('0xb')]['uniqueid'],_0x2744be['key'],_0x2744be[_0x3f3c('0x67')],_0x2744be['dialogflow_language']||'en')[_0x3f3c('0x10')](function(_0x37643b){_0x5e800f(null,_0x37643b);})[_0x3f3c('0x12')](function(_0xab973d){_0x5e800f(_0xab973d);});};AGIVertices['prototype'][_0x3f3c('0x83')]=function(_0xdaac0d,_0x560682){scripts[_0x3f3c('0x83')](this[_0x3f3c('0xb')],_0xdaac0d)[_0x3f3c('0x10')](function(_0x51e393){_0x560682(null,_0x51e393);})[_0x3f3c('0x12')](function(_0x52bacf){_0x560682(_0x52bacf);});};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x84')]=function(_0x5b99ff,_0x195f46){scripts['ispeechTTS'](_0x5b99ff[_0x3f3c('0x85')],_0x5b99ff[_0x3f3c('0x67')],_0x5b99ff['ispeech_tts_language']||'en-US',_0x5b99ff[_0x3f3c('0x86')])[_0x3f3c('0x10')](function(_0x3612e){_0x195f46(null,_0x3612e);})['catch'](function(_0x122a6c){_0x195f46(_0x122a6c);});};AGIVertices[_0x3f3c('0xe')]['ispeechASR']=function(_0x34c820,_0x71f1c4,_0x401738){scripts[_0x3f3c('0x87')](_0x71f1c4,_0x34c820[_0x3f3c('0x85')],_0x34c820['ispeech_asr_language']||'en-US',this[_0x3f3c('0x88')](_0x34c820[_0x3f3c('0x89')])?_0x34c820[_0x3f3c('0x89')]:undefined)[_0x3f3c('0x10')](function(_0x3e3fe4){_0x401738(null,_0x3e3fe4);})['catch'](function(_0x2d9a8b){_0x401738(_0x2d9a8b);});};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x8a')]=function(_0x2d48e6,_0x31c2c6){scripts[_0x3f3c('0x8a')](_0x2d48e6[_0x3f3c('0x8b')],_0x2d48e6[_0x3f3c('0x8c')],_0x2d48e6[_0x3f3c('0x8d')],_0x2d48e6['aws_polly_voice']||_0x3f3c('0x8e'),_0x2d48e6['text'],_0x2d48e6[_0x3f3c('0x8f')]||'text')[_0x3f3c('0x10')](function(_0x5805bc){_0x31c2c6(null,_0x5805bc);})[_0x3f3c('0x12')](function(_0x3ad9a7){_0x31c2c6(_0x3ad9a7);});};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x90')]=function(_0x17fdf6,_0x3ec742){scripts['awsLex'](this[_0x3f3c('0xb')][_0x3f3c('0x36')],_0x17fdf6[_0x3f3c('0x8b')],_0x17fdf6[_0x3f3c('0x8c')],_0x17fdf6[_0x3f3c('0x91')],_0x17fdf6['text'],_0x17fdf6[_0x3f3c('0x92')])[_0x3f3c('0x10')](function(_0x490377){_0x3ec742(null,_0x490377);})['catch'](function(_0x37f1f2){_0x3ec742(_0x37f1f2);});};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x93')]=function(_0x1632be,_0x32872f,_0x2743ea){scripts[_0x3f3c('0x93')](_0x32872f,_0x1632be[_0x3f3c('0x85')],_0x1632be[_0x3f3c('0x94')]||_0x3f3c('0x69'))[_0x3f3c('0x10')](function(_0x4d6e3e){_0x2743ea(null,_0x4d6e3e);})[_0x3f3c('0x12')](function(_0x14022e){_0x2743ea(_0x14022e);});};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x95')]=function(_0x5c3d4a,_0x428a39,_0x27327d){scripts[_0x3f3c('0x95')](_0x428a39,_0x5c3d4a[_0x3f3c('0x96')],_0x5c3d4a[_0x3f3c('0x97')],_0x5c3d4a[_0x3f3c('0x7b')])['then'](function(_0xb7a54c){_0x27327d(null,_0xb7a54c);})[_0x3f3c('0x12')](function(_0x1d039f){_0x27327d(_0x1d039f);});};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x98')]=function(_0x48375d){var _0x1939f3=_[_0x3f3c('0x72')](verticesWithRetry,_0x48375d['agicommand'])?_0x48375d:_[_0x3f3c('0x99')](_0x48375d);for(var _0x3ecf09 in _0x1939f3){if(_0x1939f3[_0x3f3c('0x9a')](_0x3ecf09)){if(_0x1939f3[_0x3ecf09]&&_['isString'](_0x1939f3[_0x3ecf09])){if(_[_0x3f3c('0x72')](recursiveMapAttributes,_0x3ecf09)){_0x1939f3[_0x3ecf09]=this[_0x3f3c('0x9b')](_0x1939f3[_0x3ecf09]);}else{_0x1939f3[_0x3ecf09]=this[_0x3f3c('0x9c')](_0x1939f3[_0x3ecf09]);}}}}return _0x1939f3;};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x9d')]=function(_0x5702dc){for(var _0x52ca82 in _0x5702dc){if(_0x5702dc[_0x3f3c('0x9a')](_0x52ca82)){if(_[_0x3f3c('0x9e')](_0x5702dc[_0x52ca82])){this[_0x3f3c('0x9d')](_0x5702dc[_0x52ca82]);}else if(_[_0x3f3c('0x9f')](_0x5702dc[_0x52ca82])){for(var _0x59750b=0x0;_0x59750b<_0x5702dc[_0x52ca82][_0x3f3c('0xa0')];_0x59750b++){this[_0x3f3c('0x9d')](_0x5702dc[_0x52ca82][_0x59750b]);}}else if(_['isString'](_0x5702dc[_0x52ca82])){_0x5702dc[_0x52ca82]=this[_0x3f3c('0x9c')](_0x5702dc[_0x52ca82]);}}}};AGIVertices[_0x3f3c('0xe')]['saveRestApiResult']=function(_0x221259,_0x1f588c){for(var _0x27e5ea in _0x221259){if(_0x221259['hasOwnProperty'](_0x27e5ea)){if(_[_0x3f3c('0x9e')](_0x221259[_0x27e5ea])){if(!_[_0x3f3c('0x45')](_0x221259[_0x27e5ea])){this[_0x3f3c('0xa1')](_0x221259[_0x27e5ea],util[_0x3f3c('0x27')](_0x3f3c('0xa2'),_0x1f588c,_0x27e5ea));}}else if(_['isArray'](_0x221259[_0x27e5ea])){for(var _0x277233=0x0;_0x277233<_0x221259[_0x27e5ea][_0x3f3c('0xa0')];_0x277233++){this[_0x3f3c('0xa1')](_0x221259[_0x27e5ea][_0x277233],util[_0x3f3c('0x27')](_0x3f3c('0xa2'),_0x1f588c,_0x27e5ea+'['+_0x277233+']'));}}else{if(!_[_0x3f3c('0x43')](_0x221259[_0x27e5ea])){this[_0x3f3c('0xb')][_0x3f3c('0xa3')](util[_0x3f3c('0x27')](_0x3f3c('0xa2'),_0x1f588c,_0x27e5ea),_0x221259[_0x27e5ea]);}}}}};AGIVertices['prototype'][_0x3f3c('0x9b')]=function(_0x222ab2){try{var _0x5c4c90=JSON[_0x3f3c('0x77')](_0x222ab2);this[_0x3f3c('0x9d')](_0x5c4c90);return JSON[_0x3f3c('0x7d')](_0x5c4c90);}catch(_0x1a732b){return this[_0x3f3c('0x9c')](_0x222ab2);}};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x9c')]=function(_0x427ef4){var _0x38726f=_0x427ef4[_0x3f3c('0xa4')]('{');for(var _0x17c3dd=0x1;_0x17c3dd<_0x38726f[_0x3f3c('0xa0')];_0x17c3dd+=0x1){var _0x567dba=_0x38726f[_0x17c3dd][_0x3f3c('0xa4')]('}');if(_0x567dba[_0x3f3c('0xa0')]>0x1){_0x427ef4=_0x427ef4[_0x3f3c('0xa5')]('{'+_0x567dba[0x0]+'}',this['channel'][_0x3f3c('0xf')](_0x567dba[0x0])[_0x3f3c('0xa6')]||_0x567dba[0x0]);}}if(_0x38726f[_0x3f3c('0xa0')]===0x1){return _0x427ef4['toString']();}return this[_0x3f3c('0x9c')](_0x427ef4);};AGIVertices[_0x3f3c('0xe')]['getAndSetVariable']=function(_0x12cfb5,_0x2869a3){var _0x2a081e=this['channel'][_0x3f3c('0xf')](_0x12cfb5);if(_0x2a081e[_0x3f3c('0xa7')]===-0x1){return _0x2a081e;}logger['info'](util[_0x3f3c('0x27')](_0x3f3c('0xa8'),_0x2869a3,_0x2a081e['extra']));return this[_0x3f3c('0xb')]['setVariable'](_0x2869a3,_0x2a081e[_0x3f3c('0xa6')]);};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x88')]=function(_0x5d57ea){return _0x5d57ea&&_0x5d57ea!=='0'&&_0x5d57ea!=='-1'&&_0x5d57ea!=='';};AGIVertices[_0x3f3c('0xe')]['maxRetry']=function(_0x163e9b){this[_0x3f3c('0x35')]['sync'](this,_0x163e9b,'-');_0x163e9b['retry']=_0x163e9b[_0x3f3c('0xa9')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x3f3c('0xe')]['mrcpsynth']=function(_0x3f0a54){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')](_0x3f3c('0xaa'),_0x3f0a54[_0x3f3c('0x37')]));if(!this[_0x3f3c('0x88')](_0x3f0a54['text'])){return this[_0x3f3c('0xb')][_0x3f3c('0xab')](_0x3f3c('0xac'));}var _0x5d6cff='\x22'+_0x3f0a54[_0x3f3c('0x67')]+'\x22';if(this[_0x3f3c('0x88')](_0x3f0a54[_0x3f3c('0x81')])){_0x5d6cff+=','+_0x3f0a54[_0x3f3c('0x81')];}var _0x42ca8e=this[_0x3f3c('0xb')]['exec'](_0x3f3c('0xad'),_0x5d6cff);if(_0x42ca8e[_0x3f3c('0xa7')]===-0x1){return _0x42ca8e;}return this['channel']['noop'](util[_0x3f3c('0x27')](_0x3f3c('0xae'),_0x5d6cff));};AGIVertices[_0x3f3c('0xe')]['mrcprecog']=function(_0x4f3627){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x4f3627[_0x3f3c('0x37')]));if(!this[_0x3f3c('0x88')](_0x4f3627['grammar'])){return this[_0x3f3c('0xb')][_0x3f3c('0xab')]('no\x20grammar\x20configured');}var _0x37bfb5=_0x4f3627[_0x3f3c('0xaf')];if(this[_0x3f3c('0x88')](_0x4f3627[_0x3f3c('0x81')])){_0x37bfb5+=','+_0x4f3627['options'];}var _0xc5b3ae=this[_0x3f3c('0xb')]['exec'](_0x3f3c('0xb0'),_0x37bfb5);if(_0xc5b3ae[_0x3f3c('0xa7')]===-0x1){return _0xc5b3ae;}var _0x37e73b=this[_0x3f3c('0xb1')](_0x3f3c('0xb2'),_0x3f3c('0xb3'));if(_0x37e73b['result']===-0x1){return _0x37e73b;}var _0x4dfdc8=this[_0x3f3c('0xb1')](_0x3f3c('0xb4'),_0x3f3c('0xb5'));if(_0x4dfdc8['result']===-0x1){return _0x4dfdc8;}var _0x4a4fb0=this[_0x3f3c('0xb1')](_0x3f3c('0xb6'),'MRCP_RECOG_INSTANCE');if(_0x4a4fb0[_0x3f3c('0xa7')]===-0x1){return _0x4a4fb0;}return this[_0x3f3c('0xb')][_0x3f3c('0xab')](util[_0x3f3c('0x27')](_0x3f3c('0xb7'),_0x37bfb5));};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0xb8')]=function(_0x3742ea){logger['info'](util[_0x3f3c('0x27')](_0x3f3c('0xb9'),_0x3742ea['label']));return this['channel'][_0x3f3c('0xb8')]([_0x3742ea[_0x3f3c('0xba')],_0x3742ea['args']]);};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0xbb')]=function(_0x5dc80e){logger['info'](util[_0x3f3c('0x27')](_0x3f3c('0xbc'),_0x5dc80e[_0x3f3c('0x37')]));if(this[_0x3f3c('0x88')](_0x5dc80e['timeout'])){logger[_0x3f3c('0x2c')](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0x5dc80e['timeout']));var _0x550bf4=this[_0x3f3c('0xb')]['wait'](_0x5dc80e[_0x3f3c('0x71')]);if(_0x550bf4['result']===-0x1){return _0x550bf4;}}return this[_0x3f3c('0xb')][_0x3f3c('0xbb')]();};AGIVertices[_0x3f3c('0xe')]['callback']=function(_0x1c1414){logger[_0x3f3c('0x2c')](util['format'](_0x3f3c('0xbd'),_0x1c1414[_0x3f3c('0x37')]));if(!this[_0x3f3c('0x88')](_0x1c1414[_0x3f3c('0x48')])){return this['channel'][_0x3f3c('0x2a')](_0x1c1414,_0x3f3c('0xbe'));}_0x1c1414[_0x3f3c('0x49')]=moment();if(this[_0x3f3c('0x88')](_0x1c1414[_0x3f3c('0xbf')])){_0x1c1414['scheduledAt']=moment()[_0x3f3c('0x53')](_0x1c1414['delay'],_0x3f3c('0x56'));}if(!this[_0x3f3c('0x88')](_0x1c1414['callback_priority'])){_0x1c1414[_0x3f3c('0x4c')]=0x2;}this[_0x3f3c('0x42')][_0x3f3c('0x7a')](this,_0x1c1414);return this[_0x3f3c('0xb')][_0x3f3c('0xab')](util['format']('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x1c1414['phone'],_0x1c1414['list_id'],_0x1c1414[_0x3f3c('0x49')]));};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0xc0')]=function(_0x4594e2){logger[_0x3f3c('0x2c')](util['format'](_0x3f3c('0xc1'),_0x4594e2[_0x3f3c('0x37')]));var _0x550bfb=this[_0x3f3c('0xb')][_0x3f3c('0x61')](_0x4594e2['application'],_0x4594e2[_0x3f3c('0x81')]);if(_0x550bfb[_0x3f3c('0xa7')]===-0x1){return _0x550bfb;}return this[_0x3f3c('0xb')][_0x3f3c('0xab')](util[_0x3f3c('0x27')](_0x3f3c('0xc2'),_0x4594e2[_0x3f3c('0xc3')],_0x4594e2[_0x3f3c('0x81')]));};AGIVertices['prototype'][_0x3f3c('0xc4')]=function(_0x51dc7c){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')](_0x3f3c('0xc5'),_0x51dc7c[_0x3f3c('0x37')]));if(!this[_0x3f3c('0x88')](_0x51dc7c[_0x3f3c('0x67')])){return this[_0x3f3c('0xb')][_0x3f3c('0xab')](_0x3f3c('0xac'));}var _0x2cc437='\x22'+_0x51dc7c[_0x3f3c('0x67')]+'\x22';if(this[_0x3f3c('0x88')](_0x51dc7c[_0x3f3c('0x81')])){_0x2cc437+=','+_0x51dc7c[_0x3f3c('0x81')];}var _0x5b9b06=this[_0x3f3c('0xb')]['exec'](_0x3f3c('0xad'),_0x2cc437);if(_0x5b9b06[_0x3f3c('0xa7')]===-0x1){return _0x5b9b06;}return this['channel'][_0x3f3c('0xab')](util[_0x3f3c('0x27')](_0x3f3c('0xae'),_0x2cc437));};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0xc6')]=function(_0x20eedc){logger[_0x3f3c('0x2c')](util['format'](_0x3f3c('0xc7'),_0x20eedc[_0x3f3c('0x37')]));if(!this[_0x3f3c('0x88')](_0x20eedc[_0x3f3c('0x67')])){return this[_0x3f3c('0xb')][_0x3f3c('0xab')]('no\x20text\x20configured');}var _0x102ca5='\x22'+_0x20eedc[_0x3f3c('0x67')]+'\x22';if(this[_0x3f3c('0x88')](_0x20eedc[_0x3f3c('0x81')])){_0x102ca5+=','+_0x20eedc[_0x3f3c('0x81')];}var _0xdd78bb=this[_0x3f3c('0xb')][_0x3f3c('0x61')]('MRCPSynth',_0x102ca5);if(_0xdd78bb[_0x3f3c('0xa7')]===-0x1){return _0xdd78bb;}return this[_0x3f3c('0xb')]['noop'](util['format'](_0x3f3c('0xae'),_0x102ca5));};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0xc8')]=function(_0xe35728){logger['info'](util[_0x3f3c('0x27')](_0x3f3c('0xc9'),_0xe35728['label']));if(!this[_0x3f3c('0x88')](_0xe35728[_0x3f3c('0xaf')])){return this[_0x3f3c('0xb')][_0x3f3c('0xab')]('no\x20grammar\x20configured');}var _0x22e7bd=_0xe35728[_0x3f3c('0xaf')];if(this[_0x3f3c('0x88')](_0xe35728[_0x3f3c('0x81')])){_0x22e7bd+=','+_0xe35728['options'];}var _0x3e4200=this['channel'][_0x3f3c('0x61')]('MRCPRecog',_0x22e7bd);if(_0x3e4200['result']===-0x1){return _0x3e4200;}var _0x2c50f8=this[_0x3f3c('0xb1')]('RECOG_CONFIDENCE()',_0x3f3c('0xca'));if(_0x2c50f8[_0x3f3c('0xa7')]===-0x1){return _0x2c50f8;}var _0x2e8e6c=this['getAndSetVariable'](_0x3f3c('0xb4'),_0x3f3c('0xcb'));if(_0x2e8e6c[_0x3f3c('0xa7')]===-0x1){return _0x2e8e6c;}var _0x331e5f=this[_0x3f3c('0xb1')](_0x3f3c('0xb6'),'LUMENVOX_ASR_INSTANCE');if(_0x331e5f[_0x3f3c('0xa7')]===-0x1){return _0x331e5f;}return this[_0x3f3c('0xb')][_0x3f3c('0xab')](util[_0x3f3c('0x27')](_0x3f3c('0xb7'),_0x22e7bd));};AGIVertices['prototype'][_0x3f3c('0xcc')]=function(_0x586587){logger['info'](util['format'](_0x3f3c('0xcd'),_0x586587[_0x3f3c('0x37')]));if(!this['isConfigured'](_0x586587['grammar'])){return this[_0x3f3c('0xb')][_0x3f3c('0xab')](_0x3f3c('0xce'));}var _0xb1c0b5=_0x586587['grammar'];if(this[_0x3f3c('0x88')](_0x586587[_0x3f3c('0x81')])){_0xb1c0b5+=','+_0x586587[_0x3f3c('0x81')];}var _0x330016=this[_0x3f3c('0xb')][_0x3f3c('0x61')](_0x3f3c('0xb0'),_0xb1c0b5);if(_0x330016[_0x3f3c('0xa7')]===-0x1){return _0x330016;}var _0x134e86=this[_0x3f3c('0xb1')](_0x3f3c('0xb2'),_0x3f3c('0xcf'));if(_0x134e86['result']===-0x1){return _0x134e86;}var _0x1b8398=this[_0x3f3c('0xb1')](_0x3f3c('0xb4'),'SESTEK_ASR_TRANSCRIPT');if(_0x1b8398[_0x3f3c('0xa7')]===-0x1){return _0x1b8398;}var _0x519972=this['getAndSetVariable'](_0x3f3c('0xb6'),_0x3f3c('0xd0'));if(_0x519972[_0x3f3c('0xa7')]===-0x1){return _0x519972;}return this[_0x3f3c('0xb')][_0x3f3c('0xab')](util[_0x3f3c('0x27')](_0x3f3c('0xb7'),_0xb1c0b5));};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0xd1')]=function(_0x1c1dc2){logger['info'](util[_0x3f3c('0x27')](_0x3f3c('0xd2'),_0x1c1dc2[_0x3f3c('0x37')]));if(!this[_0x3f3c('0x88')](_0x1c1dc2[_0x3f3c('0xd3')])){return this['channel'][_0x3f3c('0x2a')](_0x1c1dc2,_0x3f3c('0xd4'));}var _0x5a9c1b=this[_0x3f3c('0x16')]['sync'](this,_0x1c1dc2[_0x3f3c('0xd3')]);if(!_0x5a9c1b){return this[_0x3f3c('0xb')][_0x3f3c('0x2a')](_0x1c1dc2,_0x3f3c('0xd5'));}if(!this[_0x3f3c('0x88')](_0x1c1dc2[_0x3f3c('0xd6')])){return this[_0x3f3c('0xb')][_0x3f3c('0x2a')](_0x1c1dc2,'no\x20query\x20configured');}var _0x3b4d86=_0x1c1dc2[_0x3f3c('0xd6')][_0x3f3c('0x63')](/(\r\n|\n|\r)/gm,'\x20');this[_0x3f3c('0xb')][_0x3f3c('0xab')](util['format'](_0x3f3c('0xd7'),_0x3b4d86));var _0x254828=this[_0x3f3c('0xd8')][_0x3f3c('0x7a')](this,_0x5a9c1b,_0x3b4d86);this[_0x3f3c('0x35')][_0x3f3c('0x7a')](this,_0x1c1dc2,_0x3b4d86);if(!this[_0x3f3c('0x88')](_0x1c1dc2[_0x3f3c('0xd9')])){return this[_0x3f3c('0xb')]['noop'](_0x3f3c('0xda'));}var _0x2846ab=this['getVariable'][_0x3f3c('0x7a')](this,_0x1c1dc2['variable_id']);if(!_0x2846ab){return this['channel'][_0x3f3c('0x2a')](_0x1c1dc2,'no\x20variable\x20found');}var _0x45cc68=this;_0x254828[_0x3f3c('0xdb')](function(_0x5e4a7d,_0x310653){Object[_0x3f3c('0xdc')](_0x5e4a7d)['forEach'](function(_0x16072d){_0x45cc68[_0x3f3c('0xb')][_0x3f3c('0xa3')](util['format'](_0x3f3c('0xdd'),_0x2846ab,_0x310653,_0x16072d),_0x5e4a7d[_0x16072d]);});});this[_0x3f3c('0xb')][_0x3f3c('0xa3')](util[_0x3f3c('0x27')](_0x3f3c('0xde'),_0x2846ab),_0x254828[_0x3f3c('0xa0')]);return this[_0x3f3c('0xb')][_0x3f3c('0xab')](util[_0x3f3c('0x27')]('variable\x20%s\x20set',_0x2846ab));};AGIVertices[_0x3f3c('0xe')]['dial']=function(_0x163fc6){logger[_0x3f3c('0xdf')](util['format'](_0x3f3c('0xe0'),_0x163fc6[_0x3f3c('0x37')]));if(!this['isConfigured'](_0x163fc6[_0x3f3c('0xe1')])){return this[_0x3f3c('0xb')][_0x3f3c('0x2a')](_0x163fc6,_0x3f3c('0xe2'));}var _0x1954b2=this[_0x3f3c('0x19')][_0x3f3c('0x7a')](this,_0x163fc6[_0x3f3c('0xe1')]);if(!_0x1954b2){return this[_0x3f3c('0xb')]['error'](_0x163fc6,_0x3f3c('0xe3'));}var _0x12793f=this['channel'][_0x3f3c('0x61')](_0x3f3c('0xe4'),[util[_0x3f3c('0x27')](_0x3f3c('0xe5'),_0x1954b2),_0x163fc6['timeout'],_0x163fc6[_0x3f3c('0xe6')],_0x163fc6[_0x3f3c('0x70')]]);if(_0x12793f[_0x3f3c('0xa7')]===-0x1){return _0x12793f;}return this['channel']['noop'](util[_0x3f3c('0x27')]('Executed\x20command\x20%s',_0x3f3c('0xe4')));};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0xe7')]=function(_0x3ba12e){logger['info'](util[_0x3f3c('0x27')](_0x3f3c('0xe8'),_0x3ba12e['label']));if(!this[_0x3f3c('0x88')](_0x3ba12e[_0x3f3c('0x85')])){return this[_0x3f3c('0xb')][_0x3f3c('0xab')](_0x3f3c('0xe9'));}if(!this['isConfigured'](_0x3ba12e[_0x3f3c('0x67')])){return this[_0x3f3c('0xb')][_0x3f3c('0xab')](_0x3f3c('0xac'));}this[_0x3f3c('0xb')][_0x3f3c('0xea')]=!![];this[_0x3f3c('0x35')](_0x3ba12e);this[_0x3f3c('0x41')](_0x3ba12e[_0x3f3c('0x67')],'in');this[_0x3f3c('0xb')][_0x3f3c('0xab')](util[_0x3f3c('0x27')]('Trying\x20Dialogflow:\x20%s',_0x3ba12e[_0x3f3c('0x67')]));var _0x149b37=this['googleDialogflow']['sync'](this,_0x3ba12e);if(_0x149b37){for(var _0x39b462 in _0x149b37){if(_0x149b37[_0x3f3c('0x9a')](_0x39b462)){this['channel'][_0x3f3c('0xa3')](util[_0x3f3c('0x27')]('DIALOGFLOW_%s',_0x39b462[_0x3f3c('0xeb')]()),_0x149b37[_0x39b462]);}}this['createSquareMessage'](_0x149b37[_0x3f3c('0xec')],_0x3f3c('0xed'));return this[_0x3f3c('0xb')][_0x3f3c('0xab')](util[_0x3f3c('0x27')](_0x3f3c('0xee'),_0x149b37['speech']));}return this[_0x3f3c('0xb')][_0x3f3c('0x2a')](_0x3ba12e,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x3f3c('0xe')]['sesteknda']=function(_0x59ab13){logger['info'](util[_0x3f3c('0x27')](_0x3f3c('0xef'),_0x59ab13[_0x3f3c('0x37')]));if(!this[_0x3f3c('0x88')](_0x59ab13['ndauth_url'])){return this[_0x3f3c('0xb')][_0x3f3c('0xab')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x3f3c('0x88')](_0x59ab13['username'])){return this['channel'][_0x3f3c('0xab')]('no\x20username\x20configured');}if(!this[_0x3f3c('0x88')](_0x59ab13['password'])){return this['channel'][_0x3f3c('0xab')]('no\x20password\x20configured');}if(!this[_0x3f3c('0x88')](_0x59ab13[_0x3f3c('0xf0')])){return this['channel']['noop'](_0x3f3c('0xac'));}this['channel'][_0x3f3c('0xea')]=!![];this[_0x3f3c('0x35')](_0x59ab13);this[_0x3f3c('0x41')](_0x59ab13[_0x3f3c('0x67')],'in');this[_0x3f3c('0xb')][_0x3f3c('0xab')](util[_0x3f3c('0x27')](_0x3f3c('0xf1'),_0x59ab13[_0x3f3c('0x67')]));var _0x2b7196=this[_0x3f3c('0x83')]['sync'](this,_0x59ab13);if(_0x2b7196){for(var _0x3ae42e in _0x2b7196){if(_0x2b7196[_0x3f3c('0x9a')](_0x3ae42e)){this[_0x3f3c('0xb')][_0x3f3c('0xa3')](util[_0x3f3c('0x27')]('SESTEK_NDA_%s',_0x3ae42e[_0x3f3c('0xeb')]()),_0x2b7196[_0x3ae42e]);}}this['createSquareMessage'](_0x2b7196['speech'],_0x3f3c('0xed'));if(_0x2b7196['audiofile']){this[_0x3f3c('0xb')]['noop'](util['format'](_0x3f3c('0xf2'),_0x2b7196[_0x3f3c('0xf3')]));var _0x277c50=this[_0x3f3c('0xb')]['streamFile'](_0x2b7196[_0x3f3c('0xf3')]);try{fs[_0x3f3c('0xf4')](_0x2b7196[_0x3f3c('0xf3')]+_0x3f3c('0xf5'));}catch(_0xd2c455){logger['error'](_0xd2c455);}return _0x277c50;}else{return this['channel'][_0x3f3c('0xab')](util[_0x3f3c('0x27')](_0x3f3c('0xf6'),_0x2b7196[_0x3f3c('0xec')]));}}return this[_0x3f3c('0xb')]['error'](_0x59ab13,_0x3f3c('0xf7'));};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0xf8')]=function(_0x5eae74){logger[_0x3f3c('0x2c')](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x5eae74[_0x3f3c('0x37')]));return this[_0x3f3c('0xb')][_0x3f3c('0xab')](_0x3f3c('0xf8'));};AGIVertices['prototype'][_0x3f3c('0xf9')]=function(_0x57a4c1){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')](_0x3f3c('0xfa'),_0x57a4c1['label']));var _0x4b9c47='';if(_0x57a4c1[_0x3f3c('0xfb')]){if(!this[_0x3f3c('0x88')](_0x57a4c1['trunk_id'])){return this[_0x3f3c('0xb')][_0x3f3c('0x2a')](_0x57a4c1,'no\x20trunk\x20selected');}else{var _0x29c17d=parseInt(_0x57a4c1[_0x3f3c('0xfb')],0xa);if(isNaN(_0x29c17d)){_0x4b9c47=_0x57a4c1[_0x3f3c('0xfb')];}else{_0x4b9c47=this[_0x3f3c('0xfc')][_0x3f3c('0x7a')](this,_0x57a4c1['trunk_id']);if(!_0x4b9c47){return this['channel'][_0x3f3c('0x2a')](_0x57a4c1,'no\x20trunk\x20found');}}}}else if(_0x57a4c1['trunk_name']){_0x4b9c47=_0x57a4c1['trunk_name'];}else{return this[_0x3f3c('0xb')][_0x3f3c('0x2a')](_0x57a4c1,_0x3f3c('0xfd'));}var _0x138c33=this[_0x3f3c('0xb')]['exec']('DIAL',[util[_0x3f3c('0x27')](_0x3f3c('0xfe'),_0x4b9c47,_0x57a4c1['phone']),_0x57a4c1[_0x3f3c('0x71')],_0x57a4c1[_0x3f3c('0xe6')],_0x57a4c1[_0x3f3c('0x70')]]);if(_0x138c33[_0x3f3c('0xa7')]===-0x1){return _0x138c33;}return this['channel'][_0x3f3c('0xab')](util['format'](_0x3f3c('0xff'),_0x3f3c('0xe4')));};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x100')]=function(_0xb7650f){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')](_0x3f3c('0x101'),_0xb7650f[_0x3f3c('0x37')]));return this['channel'][_0x3f3c('0xab')]('finally');};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x9')]=function(_0x415568){logger[_0x3f3c('0x2c')](util['format']('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x415568[_0x3f3c('0x37')]));if(_0x415568[_0x3f3c('0x102')]===0x0){return this['maxRetry'](_0x415568);}_0x415568['retry']-=0x1;if(!this['isConfigured'](_0x415568['file_id'])){return this[_0x3f3c('0xb')][_0x3f3c('0x2a')](_0x415568,_0x3f3c('0x103'));}var _0x59a0a7=this[_0x3f3c('0x1c')][_0x3f3c('0x7a')](this,_0x415568['file_id']);if(!_0x59a0a7){return this[_0x3f3c('0xb')]['error'](_0x415568,'no\x20file\x20audio\x20found');}if(!this[_0x3f3c('0x88')](_0x415568[_0x3f3c('0xd9')])){return this[_0x3f3c('0xb')][_0x3f3c('0x2a')](_0x3f3c('0xda'));}var _0x73f7e4=this[_0x3f3c('0xb')][_0x3f3c('0x104')](_0x59a0a7,_0x415568['response'],_0x415568[_0x3f3c('0x105')]);var _0x14f5ce=_0x73f7e4[_0x3f3c('0xa7')]?_0x73f7e4[_0x3f3c('0xa7')][_0x3f3c('0x106')]():'';logger['info']('test',JSON[_0x3f3c('0x7d')](_0x73f7e4));if(_0x73f7e4[_0x3f3c('0xa7')]===-0x1){this[_0x3f3c('0x35')][_0x3f3c('0x7a')](this,_0x415568,_0x14f5ce);return _0x73f7e4;}else if(_0x73f7e4[_0x3f3c('0xa6')]===_0x3f3c('0x71')){_0x73f7e4[_0x3f3c('0xa7')]=_0x14f5ce[_0x3f3c('0xa0')]>=parseInt(_0x415568['mindigit'])?'x':'i';}else{_0x73f7e4[_0x3f3c('0xa7')]=_0x14f5ce[_0x3f3c('0xa0')]>=parseInt(_0x415568[_0x3f3c('0x107')])&&_0x14f5ce[_0x3f3c('0xa0')]<=parseInt(_0x415568[_0x3f3c('0x105')])?'x':'i';}var _0x25c342=this[_0x3f3c('0xf')][_0x3f3c('0x7a')](this,_0x415568[_0x3f3c('0xd9')]);if(!_0x25c342){return this['channel'][_0x3f3c('0x2a')](_0x415568,'no\x20variable\x20found');}this['channel'][_0x3f3c('0xa3')](_0x25c342,_0x14f5ce);if(this[_0x3f3c('0x88')](_0x415568[_0x3f3c('0x108')])){var _0x5a3403=parseInt(_0x415568[_0x3f3c('0x108')],0xa);var _0x3eab24=rs['generate']({'charset':'*','length':_0x5a3403});var _0x184851=_0x14f5ce[_0x3f3c('0xa0')];if(_0x184851>0x0){if(_0x184851>_0x5a3403){this[_0x3f3c('0x35')][_0x3f3c('0x7a')](this,_0x415568,_0x415568[_0x3f3c('0x109')]===_0x3f3c('0x10a')?_0x3eab24+_0x14f5ce['substr'](_0x5a3403):_0x14f5ce[_0x3f3c('0x10b')](0x0,_0x184851-_0x5a3403)+_0x3eab24);}else{this[_0x3f3c('0x35')][_0x3f3c('0x7a')](this,_0x415568,rs[_0x3f3c('0x10c')]({'charset':'*','length':_0x184851}));}}else{this[_0x3f3c('0x35')][_0x3f3c('0x7a')](this,_0x415568,'');}}else{this[_0x3f3c('0x35')]['sync'](this,_0x415568,_0x14f5ce);}return _0x73f7e4;};AGIVertices['prototype'][_0x3f3c('0xa')]=function(_0xedad49){logger[_0x3f3c('0x2c')](util['format'](_0x3f3c('0x10d'),_0xedad49['label']));return this[_0x3f3c('0x9')](_0xedad49);};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x10e')]=function(_0x3ff685){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x3ff685[_0x3f3c('0x37')]));this[_0x3f3c('0x35')][_0x3f3c('0x7a')](this,_0x3ff685,_0x3ff685[_0x3f3c('0x10f')]);return this[_0x3f3c('0xb')][_0x3f3c('0xab')](util[_0x3f3c('0x27')](_0x3f3c('0x110'),_0x3ff685[_0x3f3c('0x10f')]));};AGIVertices[_0x3f3c('0xe')]['awspolly']=function(_0x2ad8fc){logger[_0x3f3c('0x2c')](util['format'](_0x3f3c('0x111'),_0x2ad8fc[_0x3f3c('0x37')]));if(!this[_0x3f3c('0x88')](_0x2ad8fc['aws_access_key_id'])||!this[_0x3f3c('0x88')](_0x2ad8fc[_0x3f3c('0x8c')])){return this[_0x3f3c('0xb')]['noop'](_0x3f3c('0x112'));}if(!this[_0x3f3c('0x88')](_0x2ad8fc['text'])){return this['channel'][_0x3f3c('0xab')](_0x3f3c('0xac'));}this['channel'][_0x3f3c('0xab')](util[_0x3f3c('0x27')](_0x3f3c('0x113'),_0x2ad8fc[_0x3f3c('0x67')]));var _0x166cca=this['awsPolly'][_0x3f3c('0x7a')](this,_0x2ad8fc);if(_0x166cca){this[_0x3f3c('0xb')][_0x3f3c('0xab')](util[_0x3f3c('0x27')](_0x3f3c('0x114'),_0x166cca));var _0x24a1b9=this[_0x3f3c('0xb')][_0x3f3c('0x115')](_0x166cca);try{fs[_0x3f3c('0xf4')](_0x166cca+'.wav');}catch(_0x4be660){logger[_0x3f3c('0x2a')](_0x4be660);}return _0x24a1b9;}return this['channel'][_0x3f3c('0x2a')](_0x2ad8fc,_0x3f3c('0x116'));};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x117')]=function(_0x8d941e){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')](_0x3f3c('0x118'),_0x8d941e[_0x3f3c('0x37')]));if(!this['isConfigured'](_0x8d941e['aws_access_key_id'])||!this[_0x3f3c('0x88')](_0x8d941e['aws_secret_access_key'])){return this['channel'][_0x3f3c('0xab')](_0x3f3c('0x112'));}if(!this[_0x3f3c('0x88')](_0x8d941e[_0x3f3c('0x92')])){return this['channel'][_0x3f3c('0xab')](_0x3f3c('0x119'));}if(!this['isConfigured'](_0x8d941e['text'])){return this['channel'][_0x3f3c('0xab')]('no\x20text\x20configured');}this['channel'][_0x3f3c('0xea')]=!![];this[_0x3f3c('0x35')](_0x8d941e);this['createSquareMessage'](_0x8d941e[_0x3f3c('0x67')],'in');this[_0x3f3c('0xb')]['noop'](util['format'](_0x3f3c('0x11a'),_0x8d941e[_0x3f3c('0x67')]));var _0x2b7683=this[_0x3f3c('0x90')][_0x3f3c('0x7a')](this,_0x8d941e);if(_0x2b7683){for(var _0x2daf91 in _0x2b7683){if(_0x2b7683[_0x3f3c('0x9a')](_0x2daf91)&&_[_0x3f3c('0x11b')](_0x2b7683[_0x2daf91])){this[_0x3f3c('0xb')][_0x3f3c('0xa3')](util[_0x3f3c('0x27')](_0x3f3c('0x11c'),_0x2daf91[_0x3f3c('0xeb')]()),_0x2b7683[_0x2daf91]);}}if(_[_0x3f3c('0x43')](_0x2b7683['message'])){return this['channel'][_0x3f3c('0xab')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x2b7683[_0x3f3c('0x11d')],_0x3f3c('0xed'));return this[_0x3f3c('0xb')][_0x3f3c('0xab')](util[_0x3f3c('0x27')](_0x3f3c('0x11e'),_0x2b7683['message']));}}return this[_0x3f3c('0xb')][_0x3f3c('0x2a')](_0x8d941e,_0x3f3c('0x11f'));};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x120')]=function(_0x5cf082){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x5cf082[_0x3f3c('0x37')],_0x5cf082[_0x3f3c('0x71')]));if(!this['isConfigured'](_0x5cf082[_0x3f3c('0x85')])){return this[_0x3f3c('0xb')][_0x3f3c('0xab')]('no\x20key\x20configured');}var _0x2615cc=_0x3f3c('0x121');var _0x334590=util['format'](_0x3f3c('0x122'),FILES_PATH,rs[_0x3f3c('0x10c')](0x4));var _0x4c9578=util[_0x3f3c('0x27')](_0x3f3c('0xa2'),_0x334590,_0x2615cc);var _0x22682d=!![];if(_0x5cf082['beep']===_0x3f3c('0x123')){_0x22682d=![];}var _0x49de44=this['channel'][_0x3f3c('0x124')](_0x334590,_0x2615cc,_0x5cf082['intKey'],_0x5cf082[_0x3f3c('0x71')],undefined,_0x22682d);if(_0x49de44[_0x3f3c('0xa7')]!==-0x1){this[_0x3f3c('0xb')]['noop'](util[_0x3f3c('0x27')](_0x3f3c('0x125'),_0x4c9578));var _0x40f51f=this[_0x3f3c('0x93')][_0x3f3c('0x7a')](this,_0x5cf082,_0x4c9578);if(_0x40f51f){for(var _0x586c11 in _0x40f51f){if(_0x40f51f[_0x3f3c('0x9a')](_0x586c11)){this[_0x3f3c('0xb')]['setVariable'](util['format'](_0x3f3c('0x126'),_0x586c11[_0x3f3c('0xeb')]()),_0x40f51f[_0x586c11]);}}return this[_0x3f3c('0xb')][_0x3f3c('0xab')](util['format']('GoogleASR\x20Result\x20%s',JSON[_0x3f3c('0x7d')](_0x40f51f)));}}return _0x49de44;};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x127')]=function(_0x17a42d){logger[_0x3f3c('0x2c')](util['format'](_0x3f3c('0x128'),_0x17a42d[_0x3f3c('0x37')]));if(!this['isConfigured'](_0x17a42d['appid'])){return this[_0x3f3c('0xb')]['noop'](_0x3f3c('0x129'));}if(!this[_0x3f3c('0x88')](_0x17a42d['appsecret'])){return this[_0x3f3c('0xb')][_0x3f3c('0xab')](_0x3f3c('0x12a'));}var _0xda4a81=_0x3f3c('0x121');var _0xb7ca50=util[_0x3f3c('0x27')](_0x3f3c('0x122'),FILES_PATH,rs[_0x3f3c('0x10c')](0x4));var _0x589204=util[_0x3f3c('0x27')](_0x3f3c('0xa2'),_0xb7ca50,_0xda4a81);var _0x361e99=!![];if(_0x17a42d[_0x3f3c('0x12b')]===_0x3f3c('0x123')){_0x361e99=![];}var _0x446d42=this[_0x3f3c('0xb')]['recordFile'](_0xb7ca50,_0xda4a81,_0x17a42d['intKey'],_0x17a42d[_0x3f3c('0x71')],undefined,_0x361e99);if(_0x446d42['result']!==-0x1){this['channel'][_0x3f3c('0xab')](util[_0x3f3c('0x27')](_0x3f3c('0x12c'),_0x589204));var _0x345468=this[_0x3f3c('0x95')]['sync'](this,_0x17a42d,_0x589204);if(_0x345468){for(var _0x25bea6 in _0x345468){if(_0x345468['hasOwnProperty'](_0x25bea6)){this[_0x3f3c('0xb')]['setVariable'](util[_0x3f3c('0x27')](_0x3f3c('0x12d'),_0x25bea6[_0x3f3c('0xeb')]()),_0x345468[_0x25bea6]);}}return this[_0x3f3c('0xb')][_0x3f3c('0xab')](util['format']('TildeASR\x20Result\x20%s',JSON[_0x3f3c('0x7d')](_0x345468)));}}return _0x446d42;};AGIVertices['prototype'][_0x3f3c('0x12e')]=function(_0x441eba){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')](_0x3f3c('0x12f'),_0x441eba[_0x3f3c('0x37')]));return this[_0x3f3c('0xb')]['continueAt'](_0x441eba[_0x3f3c('0x3c')],_0x441eba[_0x3f3c('0x3d')],_0x441eba[_0x3f3c('0x3e')]);};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x130')]=function(_0x167a9f){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')](_0x3f3c('0x131'),_0x167a9f[_0x3f3c('0x37')]));if(!this[_0x3f3c('0x88')](_0x167a9f[_0x3f3c('0x132')])){return this[_0x3f3c('0xb')][_0x3f3c('0x2a')](_0x167a9f,_0x3f3c('0x133'));}try{var _0x1a089c=eval(_0x167a9f[_0x3f3c('0x132')])?_0x3f3c('0x134'):_0x3f3c('0x135');this['channel'][_0x3f3c('0xab')](util[_0x3f3c('0x27')](_0x3f3c('0x136'),_0x167a9f['condition'],_0x1a089c));return{'code':0xc8,'result':_0x1a089c};}catch(_0x2d4649){return{'code':0xc8,'result':_0x3f3c('0x135')};}};AGIVertices['prototype'][_0x3f3c('0x137')]=function(_0x18e521){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x18e521[_0x3f3c('0x37')]));if(!this['isConfigured'](_0x18e521['interval_id'])){return this[_0x3f3c('0xb')]['error'](_0x18e521,'no\x20interval\x20configured');}var _0x282377=this[_0x3f3c('0x23')][_0x3f3c('0x7a')](this,_0x18e521[_0x3f3c('0x138')]);if(!_0x282377){return this[_0x3f3c('0xb')]['error'](_0x18e521,'no\x20intervals\x20found');}for(var _0x32ea56=0x0;_0x32ea56<_0x282377[_0x3f3c('0xa0')];_0x32ea56+=0x1){var _0x24bff4=this['channel'][_0x3f3c('0xf')](util[_0x3f3c('0x27')](_0x3f3c('0x139'),_0x282377[_0x32ea56]));if(_0x24bff4['result']===-0x1){return _0x24bff4;}logger['info'](util[_0x3f3c('0x27')](_0x3f3c('0x13a'),_0x282377[_0x32ea56],_0x24bff4[_0x3f3c('0xa6')]));if(_0x24bff4['extra']===_0x3f3c('0x134')){logger[_0x3f3c('0x2c')](util['format'](_0x3f3c('0x13a'),_0x282377[_0x32ea56],_0x3f3c('0x134')));this[_0x3f3c('0xb')][_0x3f3c('0xab')](util['format'](_0x3f3c('0x13a'),_0x282377[_0x32ea56],_0x3f3c('0x134')));return{'code':0xc8,'result':_0x3f3c('0x134')};}else{logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')]('IFTIME\x20%s\x20%s',_0x282377[_0x32ea56],'false'));this['channel'][_0x3f3c('0xab')](util['format'](_0x3f3c('0x13a'),_0x282377[_0x32ea56],_0x3f3c('0x135')));}}return{'code':0xc8,'result':_0x3f3c('0x135')};};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x13b')]=function(_0x32d3af){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x32d3af['label']));return this[_0x3f3c('0xb')][_0x3f3c('0x13b')]();};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x13c')]=function(_0x1e0dcd){logger[_0x3f3c('0x2c')](util['format'](_0x3f3c('0x13d'),_0x1e0dcd[_0x3f3c('0x37')]));if(!this[_0x3f3c('0x88')](_0x1e0dcd[_0x3f3c('0x85')])){return this[_0x3f3c('0xb')]['noop']('no\x20key\x20configured');}var _0x1e6918='wav';var _0x457001=util[_0x3f3c('0x27')](_0x3f3c('0x122'),FILES_PATH,rs[_0x3f3c('0x10c')](0x4));var _0x4b8f66=util['format'](_0x3f3c('0xa2'),_0x457001,_0x1e6918);var _0x660b43=!![];if(_0x1e0dcd[_0x3f3c('0x12b')]===_0x3f3c('0x123')){_0x660b43=![];}var _0x4b2fda=this[_0x3f3c('0xb')][_0x3f3c('0x124')](_0x457001,_0x1e6918,_0x1e0dcd[_0x3f3c('0x13e')],_0x1e0dcd['timeout'],undefined,_0x660b43);if(_0x4b2fda[_0x3f3c('0xa7')]!==-0x1){this['channel'][_0x3f3c('0xab')](util['format'](_0x3f3c('0x13f'),_0x4b8f66));var _0x16e172=this[_0x3f3c('0x87')][_0x3f3c('0x7a')](this,_0x1e0dcd,_0x4b8f66);if(_0x16e172){for(var _0x53acf9 in _0x16e172){if(_0x16e172['hasOwnProperty'](_0x53acf9)){this[_0x3f3c('0xb')][_0x3f3c('0xa3')](util[_0x3f3c('0x27')](_0x3f3c('0x140'),_0x53acf9[_0x3f3c('0xeb')]()),_0x16e172[_0x53acf9]);}}return this[_0x3f3c('0xb')][_0x3f3c('0xab')](util[_0x3f3c('0x27')](_0x3f3c('0x141'),JSON[_0x3f3c('0x7d')](_0x16e172)));}}return _0x4b2fda;};AGIVertices[_0x3f3c('0xe')]['ispeechtts']=function(_0x25a2a6){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')](_0x3f3c('0x142'),_0x25a2a6[_0x3f3c('0x37')]));if(!this[_0x3f3c('0x88')](_0x25a2a6[_0x3f3c('0x85')])){return this[_0x3f3c('0xb')][_0x3f3c('0xab')](_0x3f3c('0xe9'));}if(!this[_0x3f3c('0x88')](_0x25a2a6[_0x3f3c('0x67')])){return this[_0x3f3c('0xb')][_0x3f3c('0xab')]('no\x20text\x20configured');}this[_0x3f3c('0xb')]['noop'](util['format'](_0x3f3c('0x143'),_0x25a2a6[_0x3f3c('0x67')]));var _0x26d106=this[_0x3f3c('0x84')][_0x3f3c('0x7a')](this,_0x25a2a6);if(_0x26d106){this[_0x3f3c('0xb')][_0x3f3c('0xab')](util[_0x3f3c('0x27')]('ispeech\x20%s\x20file\x20created',_0x26d106));var _0x41ceef=this['channel']['streamFile'](_0x26d106,_0x25a2a6[_0x3f3c('0x13e')]);try{fs[_0x3f3c('0xf4')](_0x26d106+_0x3f3c('0xf5'));}catch(_0x51869d){logger[_0x3f3c('0x2a')](_0x51869d);}return _0x41ceef;}return this[_0x3f3c('0xb')][_0x3f3c('0x2a')](_0x25a2a6,_0x3f3c('0x144'));};AGIVertices[_0x3f3c('0xe')]['login']=function(_0x249db1){logger[_0x3f3c('0x2c')](util['format'](_0x3f3c('0x145'),_0x249db1[_0x3f3c('0x37')]));if(!this['isConfigured'](_0x249db1[_0x3f3c('0x146')])){return this[_0x3f3c('0xb')][_0x3f3c('0x2a')](_0x249db1,'no\x20find\x20by\x20configured');}logger[_0x3f3c('0x2c')](util['format'](_0x3f3c('0x147'),this[_0x3f3c('0xb')][_0x3f3c('0x39')],_0x249db1[_0x3f3c('0x146')]));var _0x54a3f6=this[_0x3f3c('0x5d')][_0x3f3c('0x7a')](this,_0x249db1['findBy']);if(_0x54a3f6){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3f3c('0xb')][_0x3f3c('0x39')],_0x249db1[_0x3f3c('0x146')]));this[_0x3f3c('0xb')]['noop'](util[_0x3f3c('0x27')](_0x3f3c('0x148'),this[_0x3f3c('0xb')][_0x3f3c('0x39')],_0x249db1[_0x3f3c('0x146')]));return{'code':0xc8,'result':_0x3f3c('0x149')};}else{logger['info'](util['format'](_0x3f3c('0x14a'),this['channel'][_0x3f3c('0x39')],_0x249db1[_0x3f3c('0x146')]));this[_0x3f3c('0xb')][_0x3f3c('0xab')](util[_0x3f3c('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x3f3c('0x39')],_0x249db1[_0x3f3c('0x146')]));return{'code':0xc8,'result':_0x3f3c('0x14b')};}};AGIVertices['prototype'][_0x3f3c('0x14c')]=function(_0xe1ffac){logger['info'](util[_0x3f3c('0x27')](_0x3f3c('0x14d'),_0xe1ffac[_0x3f3c('0x37')]));if(!this[_0x3f3c('0x88')](_0xe1ffac[_0x3f3c('0x146')])){return this[_0x3f3c('0xb')][_0x3f3c('0x2a')](_0xe1ffac,_0x3f3c('0x14e'));}logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')](_0x3f3c('0x147'),this[_0x3f3c('0xb')][_0x3f3c('0x39')],_0xe1ffac['findBy']));var _0xda584d=this[_0x3f3c('0x5c')]['sync'](this,_0xe1ffac[_0x3f3c('0x146')]);if(_0xda584d){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3f3c('0xb')][_0x3f3c('0x39')],_0xe1ffac[_0x3f3c('0x146')]));this[_0x3f3c('0xb')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x3f3c('0xb')][_0x3f3c('0x39')],_0xe1ffac[_0x3f3c('0x146')]));return{'code':0xc8,'result':_0x3f3c('0x149')};}else{logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')](_0x3f3c('0x14a'),this[_0x3f3c('0xb')][_0x3f3c('0x39')],_0xe1ffac[_0x3f3c('0x146')]));this[_0x3f3c('0xb')][_0x3f3c('0xab')](util['format'](_0x3f3c('0x14a'),this[_0x3f3c('0xb')][_0x3f3c('0x39')],_0xe1ffac[_0x3f3c('0x146')]));return{'code':0xc8,'result':_0x3f3c('0x14b')};}};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x14f')]=function(_0x1e8f56){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')](_0x3f3c('0x150'),_0x1e8f56[_0x3f3c('0x37')]));if(!this['isConfigured'](_0x1e8f56['operation'])){return this[_0x3f3c('0xb')][_0x3f3c('0x2a')](_0x1e8f56,_0x3f3c('0x151'));}this[_0x3f3c('0xb')][_0x3f3c('0xab')](util[_0x3f3c('0x27')](_0x3f3c('0x152'),_0x1e8f56[_0x3f3c('0x153')]));var _0x419c12=eval(_0x1e8f56[_0x3f3c('0x153')]);if(!this[_0x3f3c('0x88')](_0x1e8f56['variable_id'])){return this['channel'][_0x3f3c('0xab')](_0x3f3c('0xda'));}var _0x34987c=this[_0x3f3c('0xf')][_0x3f3c('0x7a')](this,_0x1e8f56['variable_id']);if(!_0x34987c){return this[_0x3f3c('0xb')][_0x3f3c('0x2a')](_0x1e8f56,_0x3f3c('0x154'));}if(_['isArray'](_0x419c12)){var _0x1f2b9b=this;_0x419c12[_0x3f3c('0xdb')](function(_0xed8ff7,_0x401783){_0x1f2b9b[_0x3f3c('0xb')][_0x3f3c('0xa3')](util[_0x3f3c('0x27')](_0x3f3c('0x155'),_0x34987c,_0x401783),_0xed8ff7);});return this[_0x3f3c('0xb')][_0x3f3c('0xab')](util[_0x3f3c('0x27')](_0x3f3c('0x156'),_0x34987c));}else{return this[_0x3f3c('0xb')][_0x3f3c('0xa3')](_0x34987c,_0x419c12);}};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x157')]=function(_0x2501a8){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')](_0x3f3c('0x158'),_0x2501a8[_0x3f3c('0x37')]));if(_0x2501a8[_0x3f3c('0x102')]===0x0){return this['maxRetry'](_0x2501a8);}_0x2501a8[_0x3f3c('0x102')]-=0x1;if(!this[_0x3f3c('0x88')](_0x2501a8[_0x3f3c('0x159')])){return this[_0x3f3c('0xb')]['error'](_0x2501a8,_0x3f3c('0x103'));}var _0x405e8c=this[_0x3f3c('0x1c')][_0x3f3c('0x7a')](this,_0x2501a8[_0x3f3c('0x159')]);if(!_0x405e8c){return this[_0x3f3c('0xb')]['error'](_0x2501a8,_0x3f3c('0x15a'));}var _0x5ab5e7=this['channel'][_0x3f3c('0x104')](_0x405e8c,_0x2501a8[_0x3f3c('0x15b')],_0x2501a8['digit']);var _0xe9a254=_0x5ab5e7[_0x3f3c('0xa7')];if(_0x5ab5e7[_0x3f3c('0xa7')]===-0x1){this[_0x3f3c('0x35')][_0x3f3c('0x7a')](this,_0x2501a8,'-1');return _0x5ab5e7;}else if(_0x5ab5e7['extra']===_0x3f3c('0x71')){_0x5ab5e7['result']=_0x5ab5e7['result']['length']>0x0?_0x5ab5e7[_0x3f3c('0xa7')]:'t';}else if(_[_0x3f3c('0x45')](_0x5ab5e7[_0x3f3c('0xa7')])){_0x5ab5e7['result']='#';_0xe9a254='#';}if(!this[_0x3f3c('0x88')](_0x2501a8[_0x3f3c('0xd9')])){this['channel'][_0x3f3c('0xab')](_0x3f3c('0xda'));}else{var _0x3eda8f=this[_0x3f3c('0xf')][_0x3f3c('0x7a')](this,_0x2501a8[_0x3f3c('0xd9')]);if(!_0x3eda8f){return this[_0x3f3c('0xb')][_0x3f3c('0x2a')](_0x2501a8,'no\x20variable\x20found');}this[_0x3f3c('0xb')]['setVariable'](_0x3eda8f,_0xe9a254);}this[_0x3f3c('0x35')][_0x3f3c('0x7a')](this,_0x2501a8,_0xe9a254);return _0x5ab5e7;};AGIVertices[_0x3f3c('0xe')]['noop']=function(_0x40d2b0){logger[_0x3f3c('0x2c')](util['format'](_0x3f3c('0x15c'),_0x40d2b0[_0x3f3c('0x37')]));return this[_0x3f3c('0xb')]['noop'](_0x40d2b0[_0x3f3c('0x15d')]||_0x40d2b0['label']);};AGIVertices[_0x3f3c('0xe')]['pause']=function(_0x42fda0){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')](_0x3f3c('0x15e'),_0x42fda0[_0x3f3c('0x37')]));if(!this[_0x3f3c('0x88')](_0x42fda0[_0x3f3c('0x146')])){return this[_0x3f3c('0xb')]['error'](_0x42fda0,_0x3f3c('0x14e'));}logger[_0x3f3c('0x2c')](util['format'](_0x3f3c('0x147'),this[_0x3f3c('0xb')][_0x3f3c('0x39')],_0x42fda0['findBy']));var _0x2d67e7=this['getPause'][_0x3f3c('0x7a')](this,_0x42fda0[_0x3f3c('0x15f')]);var _0x5b2ee3=this[_0x3f3c('0x59')][_0x3f3c('0x7a')](this,_0x42fda0[_0x3f3c('0x146')],_0x2d67e7);if(_0x5b2ee3){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')](_0x3f3c('0x148'),this['channel']['callerid'],_0x42fda0['findBy']));this['channel'][_0x3f3c('0xab')](util[_0x3f3c('0x27')](_0x3f3c('0x148'),this[_0x3f3c('0xb')][_0x3f3c('0x39')],_0x42fda0[_0x3f3c('0x146')]));return{'code':0xc8,'result':_0x3f3c('0x149')};}else{logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x3f3c('0xb')][_0x3f3c('0x39')],_0x42fda0[_0x3f3c('0x146')]));this[_0x3f3c('0xb')][_0x3f3c('0xab')](util[_0x3f3c('0x27')](_0x3f3c('0x148'),this['channel'][_0x3f3c('0x39')],_0x42fda0[_0x3f3c('0x146')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x3f3c('0x160')]=function(_0x4c7c6e){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')](_0x3f3c('0x161'),_0x4c7c6e['label']));if(!this[_0x3f3c('0x88')](_0x4c7c6e[_0x3f3c('0x159')])){return this[_0x3f3c('0xb')]['error'](_0x4c7c6e,_0x3f3c('0x103'));}var _0x33061c=this[_0x3f3c('0x1c')][_0x3f3c('0x7a')](this,_0x4c7c6e[_0x3f3c('0x159')]);if(!_0x33061c){return this[_0x3f3c('0xb')][_0x3f3c('0x2a')](_0x4c7c6e,'no\x20file\x20audio\x20found');}var _0x579c90=this[_0x3f3c('0xb')][_0x3f3c('0x61')]('PLAYBACK',[_0x33061c,_0x4c7c6e[_0x3f3c('0xe6')]]);if(_0x579c90[_0x3f3c('0xa7')]===-0x1){return _0x579c90;}return this[_0x3f3c('0xb')]['noop'](util[_0x3f3c('0x27')](_0x3f3c('0xc2'),'PLAYBACK',_0x33061c));};AGIVertices['prototype']['queue']=function(_0x588a32){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')](_0x3f3c('0x162'),_0x588a32[_0x3f3c('0x37')]));if(!this[_0x3f3c('0x88')](_0x588a32[_0x3f3c('0x163')])){return this[_0x3f3c('0xb')][_0x3f3c('0x2a')](_0x588a32,_0x3f3c('0x164'));}var _0x3ccfaa='';var _0x59dc59=parseInt(_0x588a32['queue_id'],0xa);if(isNaN(_0x59dc59)){_0x3ccfaa=_0x588a32[_0x3f3c('0x163')];}else{_0x3ccfaa=this[_0x3f3c('0x13')]['sync'](this,_0x588a32[_0x3f3c('0x163')]);if(!_0x3ccfaa){return this[_0x3f3c('0xb')][_0x3f3c('0x2a')](_0x588a32,'no\x20queue\x20found');}}var _0x4f90d6='';if(this[_0x3f3c('0x88')](_0x588a32['file_id'])){var _0x1d553b=this['getSound'][_0x3f3c('0x7a')](this,_0x588a32['file_id']);if(_0x1d553b){_0x4f90d6=_0x1d553b;}}this[_0x3f3c('0x35')][_0x3f3c('0x7a')](this,_0x588a32,_0x3ccfaa);if(_0x588a32[_0x3f3c('0xe6')][_0x3f3c('0x165')]('x')<0x0){_0x588a32[_0x3f3c('0xe6')]+='x';}if(_0x588a32[_0x3f3c('0xe6')]['indexOf']('X')<0x0){_0x588a32['opts']+='X';}this[_0x3f3c('0xb')][_0x3f3c('0xa3')](_0x3f3c('0x166'),_0x3ccfaa?_0x3ccfaa['toLowerCase']():'');var _0x273e72=this[_0x3f3c('0xb')]['exec']('QUEUE',[_0x3ccfaa,_0x588a32['opts'],_0x588a32['url'],_0x4f90d6,_0x588a32[_0x3f3c('0x71')],_0x588a32[_0x3f3c('0xb8')],_0x588a32['macro'],_0x588a32[_0x3f3c('0x167')],'',_0x588a32['position']]);if(_0x273e72[_0x3f3c('0xa7')]===-0x1){return _0x273e72;}return this['channel'][_0x3f3c('0xab')](util[_0x3f3c('0x27')](_0x3f3c('0xc2'),_0x3f3c('0x168'),_0x3ccfaa));};AGIVertices[_0x3f3c('0xe')]['record']=function(_0xe79c0b){logger['info'](util[_0x3f3c('0x27')](_0x3f3c('0x169'),_0xe79c0b['label']));var _0x5d42f3=_0xe79c0b[_0x3f3c('0x16a')]||_0x3f3c('0x121');var _0x2ac224=util[_0x3f3c('0x27')]('%s_%s',this[_0x3f3c('0xb')]['uniqueid'],rs[_0x3f3c('0x10c')](0x5));var _0x5c9f97=util[_0x3f3c('0x27')](_0x3f3c('0x16b'),FILES_PATH,_0x2ac224,_0x5d42f3);var _0x252fc8=util[_0x3f3c('0x27')]('%s/recordings/%s',FILES_PATH,_0x2ac224);this[_0x3f3c('0x3a')][_0x3f3c('0x7a')](this,_0xe79c0b,_0x2ac224,_0x5c9f97);this[_0x3f3c('0xb')][_0x3f3c('0xa3')](_0x3f3c('0x16c'),_0x2ac224);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x252fc8,_0x5d42f3,_0xe79c0b[_0x3f3c('0x16d')],_0xe79c0b[_0x3f3c('0x71')]);return this[_0x3f3c('0xb')][_0x3f3c('0x124')](_0x252fc8,_0x5d42f3,_0xe79c0b[_0x3f3c('0x16d')],_0xe79c0b['timeout'],undefined,!![]);};AGIVertices[_0x3f3c('0xe')]['restapi']=function(_0x16c574){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')](_0x3f3c('0x16e'),_0x16c574['label']));if(!this[_0x3f3c('0x88')](_0x16c574[_0x3f3c('0x70')])){return this[_0x3f3c('0xb')][_0x3f3c('0xab')](_0x3f3c('0x16f'));}var _0x187e46=this[_0x3f3c('0x6f')][_0x3f3c('0x7a')](this,_0x16c574);logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')](_0x3f3c('0x170'),util[_0x3f3c('0x171')](_0x187e46,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x16c574['variable_id'])){return this[_0x3f3c('0xb')][_0x3f3c('0xab')](_0x3f3c('0x172'));}var _0x1879c4=this[_0x3f3c('0xf')]['sync'](this,_0x16c574[_0x3f3c('0xd9')]);if(!_0x1879c4){return this[_0x3f3c('0xb')][_0x3f3c('0x2a')](_0x16c574,_0x3f3c('0x154'));}this['channel'][_0x3f3c('0xa3')](util['format'](_0x3f3c('0x173'),_0x1879c4),_0x187e46[_0x3f3c('0x7f')]?_0x187e46[_0x3f3c('0x7f')]:_0x3f3c('0x174'));this[_0x3f3c('0xb')]['setVariable'](util['format']('%s_STATUS_MESSAGE',_0x1879c4),_0x187e46[_0x3f3c('0x175')]?_0x187e46[_0x3f3c('0x175')]:'OK');if(_0x187e46[_0x3f3c('0x75')]){try{this[_0x3f3c('0xa1')](_0x187e46[_0x3f3c('0x75')],_0x1879c4);}catch(_0x383b8b){logger[_0x3f3c('0x2a')](util[_0x3f3c('0x27')](_0x3f3c('0x176'),_0x1879c4));}}return this['channel']['noop'](util[_0x3f3c('0x27')]('variable\x20%s\x20set',_0x1879c4));};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x177')]=function(_0x2e8b96){logger['info'](util['format'](_0x3f3c('0x178'),_0x2e8b96[_0x3f3c('0x37')]));return this[_0x3f3c('0xb')][_0x3f3c('0x179')](_0x2e8b96[_0x3f3c('0x17a')][_0x3f3c('0x63')](/\s+/g,''),_0x2e8b96['escape_digits']);};AGIVertices['prototype']['saynumber']=function(_0x2f8e23){logger['info'](util[_0x3f3c('0x27')](_0x3f3c('0x17b'),_0x2f8e23[_0x3f3c('0x37')]));return this[_0x3f3c('0xb')][_0x3f3c('0x17c')](_0x2f8e23[_0x3f3c('0x17d')][_0x3f3c('0x63')](/\s+/g,''),_0x2f8e23['escape_digits']);};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x17e')]=function(_0x239072){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')](_0x3f3c('0x17f'),_0x239072[_0x3f3c('0x37')]));return this[_0x3f3c('0xb')][_0x3f3c('0x180')](_0x239072[_0x3f3c('0x67')],_0x239072[_0x3f3c('0x16d')]);};AGIVertices[_0x3f3c('0xe')]['sendMail']=function(_0x1aeabc){logger[_0x3f3c('0x2c')](util['format'](_0x3f3c('0x181'),_0x1aeabc[_0x3f3c('0x37')]));if(!this['isConfigured'](_0x1aeabc[_0x3f3c('0x182')])){return this[_0x3f3c('0xb')]['noop'](_0x3f3c('0x183'));}var _0x1c720b=this[_0x3f3c('0x20')]['sync'](this,_0x1aeabc[_0x3f3c('0x182')]);if(!_0x1c720b||!_0x1c720b[_0x3f3c('0x184')]){return this[_0x3f3c('0xb')][_0x3f3c('0x2a')](_0x1aeabc,_0x3f3c('0x185'));}var _0x31b221={'from':util[_0x3f3c('0x27')](_0x3f3c('0x186'),_0x1c720b[_0x3f3c('0x11')],_0x1c720b[_0x3f3c('0x187')]||_0x1c720b[_0x3f3c('0x184')][_0x3f3c('0x188')]),'to':_0x1aeabc['to']||'','cc':_0x1aeabc['cc']||'','bcc':_0x1aeabc['bcc']||'','subject':_0x1aeabc[_0x3f3c('0x189')],'html':_0x1aeabc[_0x3f3c('0x67')],'text':_0x1aeabc[_0x3f3c('0x67')]};var _0x449f6a={'tls':{'rejectUnauthorized':![]}};if(_0x1c720b[_0x3f3c('0x184')]['service']){_0x449f6a[_0x3f3c('0x18a')]=_0x1c720b[_0x3f3c('0x184')]['service'];}else{_0x449f6a[_0x3f3c('0x18b')]=_0x1c720b['Smtp'][_0x3f3c('0x18b')];_0x449f6a[_0x3f3c('0x18c')]=_0x1c720b[_0x3f3c('0x184')][_0x3f3c('0x18c')];_0x449f6a['secure']=_0x1c720b[_0x3f3c('0x184')][_0x3f3c('0x18d')];}if(_0x1c720b[_0x3f3c('0x184')][_0x3f3c('0x18e')]){_0x449f6a[_0x3f3c('0x18f')]={'user':_0x1c720b['Smtp'][_0x3f3c('0x188')],'pass':_0x1c720b[_0x3f3c('0x184')][_0x3f3c('0x190')]};}if(this[_0x3f3c('0x88')](_0x1aeabc[_0x3f3c('0x191')])){}logger[_0x3f3c('0xdf')](_0x3f3c('0x192'),JSON[_0x3f3c('0x7d')](_0x31b221));this[_0x3f3c('0x35')][_0x3f3c('0x7a')](this,_0x1aeabc,_0x1aeabc[_0x3f3c('0x182')]);this[_0x3f3c('0xb')][_0x3f3c('0xab')](util[_0x3f3c('0x27')](_0x3f3c('0x193'),_0x1c720b[_0x3f3c('0x11')]));this[_0x3f3c('0x22')]['sync'](this,_0x449f6a,_0x31b221);return this['channel'][_0x3f3c('0xab')](_0x3f3c('0x194'));};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x195')]=function(_0x340054){logger[_0x3f3c('0x2c')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x340054[_0x3f3c('0x37')]));return this['channel'][_0x3f3c('0xab')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x196')]=function(_0x339f61){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')](_0x3f3c('0x197'),_0x339f61['label']));if(!this[_0x3f3c('0x88')](_0x339f61['sms_account_id'])){return this[_0x3f3c('0xb')][_0x3f3c('0xab')](_0x3f3c('0x198'));}var _0x5321d5=this[_0x3f3c('0x32')][_0x3f3c('0x7a')](this,_0x339f61['sms_account_id']);if(!_0x5321d5){return this[_0x3f3c('0xb')]['error'](_0x339f61,_0x3f3c('0x199'));}var _0x47a1e0={'body':_0x339f61[_0x3f3c('0x19a')],'phone':_0x339f61['to']||'','SmsAccountId':_0x5321d5['id']};logger[_0x3f3c('0xdf')]('sendSMS\x20message',JSON[_0x3f3c('0x7d')](_0x47a1e0));this[_0x3f3c('0x35')][_0x3f3c('0x7a')](this,_0x339f61,_0x339f61[_0x3f3c('0x19b')]);this[_0x3f3c('0xb')]['noop'](util[_0x3f3c('0x27')](_0x3f3c('0x19c'),_0x5321d5['name']));this[_0x3f3c('0x34')][_0x3f3c('0x7a')](this,_0x47a1e0);return this[_0x3f3c('0xb')][_0x3f3c('0xab')](_0x3f3c('0x19d'));};AGIVertices['prototype'][_0x3f3c('0x19e')]=function(_0x1f5cbc){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')](_0x3f3c('0x19f'),_0x1f5cbc[_0x3f3c('0x37')]));if(!this[_0x3f3c('0x88')](_0x1f5cbc[_0x3f3c('0xd9')])){return this[_0x3f3c('0xb')][_0x3f3c('0x2a')](_0x1f5cbc,_0x3f3c('0x1a0'));}var _0x6ea3ed=this['getVariable'][_0x3f3c('0x7a')](this,_0x1f5cbc[_0x3f3c('0xd9')]);if(!_0x6ea3ed){return this[_0x3f3c('0xb')][_0x3f3c('0x2a')](_0x1f5cbc,_0x3f3c('0x154'));}return this[_0x3f3c('0xb')][_0x3f3c('0xa3')](_0x6ea3ed,_0x1f5cbc[_0x3f3c('0x1a1')]);};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x1a2')]=function(_0x50b90f){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')](_0x3f3c('0x1a3'),_0x50b90f[_0x3f3c('0x37')]));this[_0x3f3c('0xb')][_0x3f3c('0xab')]('START\x20CALLY\x20SQUARE');if(_0x50b90f[_0x3f3c('0xbb')]===_0x3f3c('0x1a4')){this['channel'][_0x3f3c('0xab')](_0x3f3c('0x1a5'));return this[_0x3f3c('0xb')][_0x3f3c('0xbb')]();}return this['channel'][_0x3f3c('0xab')](_0x3f3c('0x1a6'));};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x1a7')]=function(_0x206720){logger[_0x3f3c('0x2c')](util['format'](_0x3f3c('0x1a8'),_0x206720[_0x3f3c('0x37')]));if(!this['isConfigured'](_0x206720[_0x3f3c('0x1a9')])){return this['channel'][_0x3f3c('0x2a')](_0x206720,_0x3f3c('0x1aa'));}var _0x58977c=this[_0x3f3c('0x1ab')][_0x3f3c('0x7a')](this,_0x206720[_0x3f3c('0x1a9')]);if(!this[_0x3f3c('0x88')](_0x58977c)){return this['channel'][_0x3f3c('0x2a')](_0x206720,util[_0x3f3c('0x27')](_0x3f3c('0x1ac'),_0x206720['project_id']));}if(_0x58977c===this['channel']['arg_1']){return this[_0x3f3c('0xb')][_0x3f3c('0x2a')](_0x206720,_0x3f3c('0x1ad'));}this[_0x3f3c('0x35')][_0x3f3c('0x7a')](this,_0x206720,_0x58977c);var _0x4cde10=this['channel'][_0x3f3c('0x61')]('AGI',util[_0x3f3c('0x27')](_0x3f3c('0x1ae'),config[_0x3f3c('0xb8')]['host']||_0x3f3c('0x1af'),_0x58977c,this[_0x3f3c('0xb')][_0x3f3c('0x3f')]));if(_0x4cde10[_0x3f3c('0xa7')]===-0x1){return _0x4cde10;}return this['channel'][_0x3f3c('0xab')](util[_0x3f3c('0x27')](_0x3f3c('0xc2'),'AGI',_0x58977c));};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x1b0')]=function(_0x5dba6a){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')](_0x3f3c('0x1b1'),_0x5dba6a[_0x3f3c('0x37')]));var _0x2ab61d=this[_0x3f3c('0x60')][_0x3f3c('0x7a')](this,_0x5dba6a['command']);this['createSquareDetailsReport'][_0x3f3c('0x7a')](this,_0x5dba6a,_0x5dba6a[_0x3f3c('0xba')]);if(this[_0x3f3c('0x88')](_0x5dba6a[_0x3f3c('0xd9')])){var _0x2d7ac1=this['getVariable'][_0x3f3c('0x7a')](this,_0x5dba6a['variable_id']);if(_0x2d7ac1){this[_0x3f3c('0xb')][_0x3f3c('0xa3')](_0x2d7ac1,_0x2ab61d);return this['channel']['noop'](util['format'](_0x3f3c('0x1b2'),_0x5dba6a[_0x3f3c('0xba')],_0x2d7ac1));}}return this[_0x3f3c('0xb')][_0x3f3c('0xab')](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x5dba6a[_0x3f3c('0xba')]));};AGIVertices[_0x3f3c('0xe')]['google_cloud_tts']=function(_0x5a65fd){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')](_0x3f3c('0x1b3'),_0x5a65fd[_0x3f3c('0x37')]));_0x5a65fd[_0x3f3c('0x67')]=_0x5a65fd[_0x3f3c('0x67')][_0x3f3c('0x63')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x5a65fd['apiKey'])){return this[_0x3f3c('0xb')][_0x3f3c('0xab')](_0x3f3c('0x1b4'));}if(!this[_0x3f3c('0x88')](_0x5a65fd[_0x3f3c('0x67')])){return this[_0x3f3c('0xb')][_0x3f3c('0xab')](_0x3f3c('0xac'));}this[_0x3f3c('0xb')][_0x3f3c('0xab')](util[_0x3f3c('0x27')](_0x3f3c('0x1b5'),_0x5a65fd[_0x3f3c('0x67')]));var _0x5c4d73=this[_0x3f3c('0x64')][_0x3f3c('0x7a')](this,_0x5a65fd);if(_0x5c4d73){this[_0x3f3c('0xb')][_0x3f3c('0xab')](util[_0x3f3c('0x27')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x5c4d73));var _0x20f644=this['channel'][_0x3f3c('0x115')](_0x5c4d73);try{fs[_0x3f3c('0xf4')](_0x5c4d73+_0x3f3c('0xf5'));}catch(_0x3e3b00){logger[_0x3f3c('0x2a')](_0x3e3b00);}return _0x20f644;}return this[_0x3f3c('0xb')]['error'](_0x5a65fd,_0x3f3c('0x1b6'));};AGIVertices[_0x3f3c('0xe')]['tts']=function(_0x19f730){logger[_0x3f3c('0x2c')](util['format'](_0x3f3c('0x1b7'),_0x19f730[_0x3f3c('0x37')]));_0x19f730[_0x3f3c('0x67')]=_0x19f730[_0x3f3c('0x67')][_0x3f3c('0x63')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x3f3c('0x88')](_0x19f730[_0x3f3c('0x67')])){return this[_0x3f3c('0xb')][_0x3f3c('0xab')]('no\x20text\x20configured');}this[_0x3f3c('0xb')]['noop'](util[_0x3f3c('0x27')](_0x3f3c('0x1b8'),_0x19f730[_0x3f3c('0x67')]));var _0x46a597=this[_0x3f3c('0x6d')][_0x3f3c('0x7a')](this,_0x19f730);if(_0x46a597){this['channel'][_0x3f3c('0xab')](util[_0x3f3c('0x27')](_0x3f3c('0x1b9'),_0x46a597));var _0x56f5a1=this['channel']['streamFile'](_0x46a597);try{fs['unlink'](_0x46a597+'.wav');}catch(_0x7a03e3){logger[_0x3f3c('0x2a')](_0x7a03e3);}return _0x56f5a1;}return this[_0x3f3c('0xb')][_0x3f3c('0x2a')](_0x19f730,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x3f3c('0x1ba')]=function(_0x46233f){logger[_0x3f3c('0x2c')](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x46233f[_0x3f3c('0x37')]));if(!this[_0x3f3c('0x88')](_0x46233f[_0x3f3c('0x146')])){return this[_0x3f3c('0xb')]['error'](_0x46233f,_0x3f3c('0x14e'));}logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')](_0x3f3c('0x147'),this[_0x3f3c('0xb')][_0x3f3c('0x39')],_0x46233f[_0x3f3c('0x146')]));var _0x475d26=this[_0x3f3c('0x5b')][_0x3f3c('0x7a')](this,_0x46233f[_0x3f3c('0x146')]);if(_0x475d26){logger[_0x3f3c('0x2c')](util['format'](_0x3f3c('0x148'),this[_0x3f3c('0xb')][_0x3f3c('0x39')],_0x46233f[_0x3f3c('0x146')]));this['channel'][_0x3f3c('0xab')](util['format'](_0x3f3c('0x148'),this[_0x3f3c('0xb')][_0x3f3c('0x39')],_0x46233f['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x3f3c('0xb')]['callerid'],_0x46233f[_0x3f3c('0x146')]));this[_0x3f3c('0xb')][_0x3f3c('0xab')](util[_0x3f3c('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x3f3c('0xb')][_0x3f3c('0x39')],_0x46233f[_0x3f3c('0x146')]));return{'code':0xc8,'result':_0x3f3c('0x14b')};}};AGIVertices['prototype'][_0x3f3c('0x1bb')]=function(_0x7084e5){logger[_0x3f3c('0x2c')](util[_0x3f3c('0x27')](_0x3f3c('0x1bc'),_0x7084e5[_0x3f3c('0x37')]));var _0x3567f0=this[_0x3f3c('0xb')]['exec']('VOICEMAIL',[_0x7084e5[_0x3f3c('0x1bd')],_0x7084e5[_0x3f3c('0x81')]]);if(_0x3567f0[_0x3f3c('0xa7')]===-0x1){return _0x3567f0;}return this[_0x3f3c('0xb')][_0x3f3c('0xab')](util['format'](_0x3f3c('0xc2'),_0x3f3c('0x1be'),_0x7084e5[_0x3f3c('0x1bd')]));};AGIVertices[_0x3f3c('0xe')][_0x3f3c('0x1bf')]=function(_0x82b99b){logger['info'](util[_0x3f3c('0x27')](_0x3f3c('0x1c0'),_0x82b99b['label']));if(!this[_0x3f3c('0x88')](_0x82b99b[_0x3f3c('0xd9')])){return this[_0x3f3c('0xb')][_0x3f3c('0x2a')](_0x82b99b,_0x3f3c('0x1a0'));}var _0x307c37=this[_0x3f3c('0xf')]['sync'](this,_0x82b99b[_0x3f3c('0xd9')]);if(!_0x307c37){return this[_0x3f3c('0xb')][_0x3f3c('0x2a')](_0x82b99b,_0x3f3c('0x154'));}var _0x38608c=this[_0x3f3c('0xb')][_0x3f3c('0xf')](_0x307c37);return{'code':0xc8,'result':_0x38608c['extra']?_0x38608c[_0x3f3c('0xa6')]:'-'};};String['prototype'][_0x3f3c('0xa5')]=function(_0x56b460,_0x12b866){return this[_0x3f3c('0xa4')](_0x56b460)[_0x3f3c('0x1c1')](_0x12b866);};module[_0x3f3c('0x1c2')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 503d9d9..0e1f651 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 _0x81bd=['YYYY-MM-DD\x20HH:mm:ss','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','uniqueid','[TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','syncAgentConnect','hanguprequest','syncHangupRequest','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','channels','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','getAgent','then','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','format'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x81bd,0x7c));var _0xd81b=function(_0x1e06c4,_0x38a792){_0x1e06c4=_0x1e06c4-0x0;var _0x529a41=_0x81bd[_0x1e06c4];return _0x529a41;};'use strict';var util=require(_0xd81b('0x0'));var _=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var ami=require(_0xd81b('0x3'));var logger=require(_0xd81b('0x4'))(_0xd81b('0x5'));var RpcUser=require(_0xd81b('0x6'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x16e8de){this[_0xd81b('0x7')]=_0x16e8de[_0xd81b('0x7')];this['agents']=_0x16e8de[_0xd81b('0x8')];this[_0xd81b('0x9')]=_0x16e8de[_0xd81b('0x9')];this['channels']={};ami['on']('agentconnect',this[_0xd81b('0xa')]['bind'](this));ami['on'](_0xd81b('0xb'),this[_0xd81b('0xc')][_0xd81b('0xd')](this));ami['on'](_0xd81b('0xe'),this[_0xd81b('0xf')][_0xd81b('0xd')](this));ami['on'](_0xd81b('0x10'),this[_0xd81b('0x11')][_0xd81b('0xd')](this));ami['on'](_0xd81b('0x12'),this[_0xd81b('0x13')][_0xd81b('0xd')](this));ami['on'](_0xd81b('0x14'),this['syncBlindTransfer'][_0xd81b('0xd')](this));ami['on']('custom:agentConnectPreview',this[_0xd81b('0x15')][_0xd81b('0xd')](this));}function getDiff(_0x5f0b6b){var _0x35a053=moment()['milliseconds'](0x0);var _0x13dd00=moment(_0x5f0b6b)[_0xd81b('0x16')](0x0);return _0x35a053[_0xd81b('0x17')](_0x13dd00,_0xd81b('0x18'));}Acw[_0xd81b('0x19')]['startAcw']=function(_0x1c620d){try{var _0x27b7a0=this;var _0x5c2863=this[_0xd81b('0x1a')][_0x1c620d][_0xd81b('0x1b')];var _0x4657cf=this[_0xd81b('0x1a')][_0x1c620d][_0xd81b('0x1c')];var _0xc49b8d=this[_0xd81b('0x7')][_0x4657cf];var _0x3d4d34=![];var _0x1c34c5=_0xd81b('0x1d');if(_0xc49b8d[_0xd81b('0x1e')]){if(_0xc49b8d[_0xd81b('0x1f')][_0xd81b('0x20')]){_0x3d4d34=!![];_0x1c34c5=_0xc49b8d[_0xd81b('0x1f')][_0xd81b('0x20')];}}ami[_0xd81b('0x21')]({'action':'QueuePause','interface':_0x5c2863,'paused':!![],'reason':_0x1c34c5})['then'](function(_0xc16ad0){if(_0x27b7a0[_0xd81b('0x8')][_0x5c2863]){return RpcUser[_0xd81b('0x22')](_0x27b7a0['agents'][_0x5c2863]['id'])[_0xd81b('0x23')](function(_0x6571a6){if(_0x6571a6&&!_0x6571a6['voicePause']){logger[_0xd81b('0x24')](_0xd81b('0x25'),_0x1c620d,_0x5c2863,_0x4657cf);var _0x1670cd=_0x27b7a0[_0xd81b('0x1a')][_0x1c620d][_0xd81b('0x26')]&&_0x27b7a0[_0xd81b('0x1a')][_0x1c620d][_0xd81b('0x27')]?_0x27b7a0[_0xd81b('0x1a')][_0x1c620d][_0xd81b('0x27')]:_0x1c620d;return RpcUser[_0xd81b('0x28')](_0x27b7a0[_0xd81b('0x8')][_0x5c2863],_0x1c34c5,_0x1670cd)[_0xd81b('0x23')](function(_0x596389){if(!_0x3d4d34){_0x27b7a0[_0xd81b('0x9')][_0x5c2863]={};logger[_0xd81b('0x24')](_0xd81b('0x29'),_0x1c620d,_0x27b7a0[_0xd81b('0x7')][_0x4657cf][_0xd81b('0x2a')],_0x5c2863,_0x4657cf);_0x27b7a0[_0xd81b('0x9')][_0x5c2863][_0xd81b('0x2b')]=setTimeout(_0x27b7a0[_0xd81b('0x2c')][_0xd81b('0xd')](_0x27b7a0,_0x5c2863),_0x27b7a0['voiceQueues'][_0x4657cf][_0xd81b('0x2a')]*0x3e8);_0x27b7a0['timers'][_0x5c2863]['lastPauseAt']=moment()[_0xd81b('0x2d')](_0xd81b('0x2e'));_0x27b7a0['timers'][_0x5c2863]['uniqueid']=_0x1c620d;_0x27b7a0[_0xd81b('0x9')][_0x5c2863][_0xd81b('0x1c')]=_0x4657cf;_0x27b7a0[_0xd81b('0x9')][_0x5c2863][_0xd81b('0x2f')]=function(){var _0x1a1572=getDiff(_0x27b7a0[_0xd81b('0x9')][_0x5c2863]['lastPauseAt']);clearTimeout(_0x27b7a0[_0xd81b('0x9')][_0x5c2863][_0xd81b('0x2b')]);_0x27b7a0['timers'][_0x5c2863]['timer']=![];RpcVoiceAgentReport[_0xd81b('0x30')]({'acwtime':_0x1a1572},_0x27b7a0[_0xd81b('0x9')][_0x5c2863]['uniqueid'],_0x5c2863)['then'](function(_0x5317b2){logger[_0xd81b('0x24')](_0xd81b('0x31'),_0x1c620d,_0x1a1572,_0x5317b2);})[_0xd81b('0x32')](function(_0x1c4cf7){logger[_0xd81b('0x33')](_0xd81b('0x34'),_0x1c620d,_0x1c4cf7);});delete _0x27b7a0[_0xd81b('0x9')][_0x5c2863];};}});}else{logger['info'](_0xd81b('0x35'),_0x1c620d,_0x5c2863,_0x4657cf);}});}})['catch'](function(_0x34634a){logger[_0xd81b('0x33')](_0xd81b('0x29'),_0x1c620d,_0x27b7a0[_0xd81b('0x7')][_0x4657cf][_0xd81b('0x2a')],_0x5c2863,_0x4657cf);})[_0xd81b('0x36')](function(){delete _0x27b7a0[_0xd81b('0x1a')][_0x1c620d];});}catch(_0x2d23b9){logger[_0xd81b('0x33')](_0xd81b('0x37'),_0x2d23b9[_0xd81b('0x38')]);}};Acw[_0xd81b('0x19')][_0xd81b('0x2c')]=function(_0x57bc0c){try{var _0x49deb8=this;if(_0x49deb8[_0xd81b('0x9')][_0x57bc0c]){_0x49deb8[_0xd81b('0x9')][_0x57bc0c][_0xd81b('0x2b')]=![];var _0x59c066=_0x49deb8[_0xd81b('0x9')][_0x57bc0c][_0xd81b('0x39')];var _0x5a236a=_0x49deb8[_0xd81b('0x9')][_0x57bc0c][_0xd81b('0x1c')];var _0x512e39=_0x49deb8[_0xd81b('0x7')][_0x5a236a]['acwTimeout'];logger[_0xd81b('0x24')](_0xd81b('0x3a'),_0x57bc0c);RpcUser[_0xd81b('0x3b')](this[_0xd81b('0x8')][_0x57bc0c]);RpcVoiceAgentReport['update']({'acwtime':_0x512e39,'agentacw':!![]},_0x59c066,_0x57bc0c)[_0xd81b('0x23')](function(_0x3444d4){logger[_0xd81b('0x24')](_0xd81b('0x31'),_0x59c066,_0x512e39,_0x3444d4);})[_0xd81b('0x32')](function(_0x466e98){logger[_0xd81b('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x59c066,_0x466e98);});}else{logger[_0xd81b('0x33')](_0xd81b('0x3c'),_0x57bc0c);if(_0x49deb8[_0xd81b('0x9')]){logger['info'](_0xd81b('0x3d'),JSON[_0xd81b('0x3e')](_0x49deb8[_0xd81b('0x9')]));}}}catch(_0x1cd745){logger[_0xd81b('0x33')]('[ACW][STOP]\x20%s',_0x1cd745[_0xd81b('0x38')]);}};Acw[_0xd81b('0x19')][_0xd81b('0xa')]=function(_0x43ea38){try{if(this[_0xd81b('0x7')][_0x43ea38[_0xd81b('0x1c')]]&&(this[_0xd81b('0x7')][_0x43ea38[_0xd81b('0x1c')]][_0xd81b('0x5')]||this[_0xd81b('0x7')][_0x43ea38[_0xd81b('0x1c')]]['mandatoryDisposition'])){if(this[_0xd81b('0x8')][_0x43ea38[_0xd81b('0x1b')]]){this[_0xd81b('0x1a')][_0x43ea38[_0xd81b('0x39')]]={'queue':_0x43ea38[_0xd81b('0x1c')],'interface':_0x43ea38[_0xd81b('0x1b')],'destlinkedid':_0x43ea38[_0xd81b('0x27')]};}}}catch(_0x475bcf){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x475bcf[_0xd81b('0x38')]);}};Acw[_0xd81b('0x19')][_0xd81b('0x15')]=function(_0x222c5e){try{if(this[_0xd81b('0x7')][_0x222c5e[_0xd81b('0x1c')]]&&(this[_0xd81b('0x7')][_0x222c5e[_0xd81b('0x1c')]][_0xd81b('0x5')]||this[_0xd81b('0x7')][_0x222c5e[_0xd81b('0x1c')]][_0xd81b('0x1e')])){if(this['agents'][_0x222c5e[_0xd81b('0x1b')]]){this[_0xd81b('0x1a')][_0x222c5e[_0xd81b('0x39')]]={'queue':_0x222c5e[_0xd81b('0x1c')],'interface':_0x222c5e[_0xd81b('0x1b')]};}}}catch(_0x410ef3){logger[_0xd81b('0x33')](_0xd81b('0x3f'),_0x410ef3[_0xd81b('0x38')]);}};Acw['prototype'][_0xd81b('0xc')]=function(_0x2368dd){try{if(this[_0xd81b('0x1a')][_0x2368dd[_0xd81b('0x39')]]&&_['isUndefined'](this[_0xd81b('0x1a')][_0x2368dd[_0xd81b('0x39')]][_0xd81b('0x26')])){logger[_0xd81b('0x24')](_0xd81b('0x40'),_0x2368dd[_0xd81b('0x39')]);this[_0xd81b('0x41')](_0x2368dd[_0xd81b('0x39')]);}else if(this[_0xd81b('0x1a')][_0x2368dd['linkedid']]&&_['isUndefined'](this[_0xd81b('0x1a')][_0x2368dd[_0xd81b('0x42')]][_0xd81b('0x26')])){logger[_0xd81b('0x24')](_0xd81b('0x43'),_0x2368dd[_0xd81b('0x42')]);this[_0xd81b('0x41')](_0x2368dd[_0xd81b('0x42')]);}}catch(_0x4e039e){logger[_0xd81b('0x33')](_0xd81b('0x44'),_0x4e039e[_0xd81b('0x38')]);}};Acw[_0xd81b('0x19')][_0xd81b('0xf')]=function(_0x59b13b){try{if(this[_0xd81b('0x1a')][_0x59b13b[_0xd81b('0x39')]]&&this['channels'][_0x59b13b[_0xd81b('0x39')]][_0xd81b('0x26')]){logger[_0xd81b('0x24')](_0xd81b('0x45'),_0x59b13b[_0xd81b('0x39')]);this[_0xd81b('0x41')](_0x59b13b[_0xd81b('0x39')]);}else if(this[_0xd81b('0x1a')][_0x59b13b[_0xd81b('0x42')]]&&this[_0xd81b('0x1a')][_0x59b13b[_0xd81b('0x42')]]['attended']){logger[_0xd81b('0x24')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x59b13b[_0xd81b('0x42')]);this[_0xd81b('0x41')](_0x59b13b[_0xd81b('0x42')]);}}catch(_0x3c2a9f){logger[_0xd81b('0x33')](_0xd81b('0x46'),_0x3c2a9f['message']);}};Acw[_0xd81b('0x19')][_0xd81b('0x13')]=function(_0x51f5a1){try{if(!_['isNil'](this[_0xd81b('0x1a')][_0x51f5a1['transfereeuniqueid']])){this[_0xd81b('0x41')](_0x51f5a1['transfereeuniqueid']);if(this[_0xd81b('0x1a')][_0x51f5a1[_0xd81b('0x47')]]){this[_0xd81b('0x1a')][_0x51f5a1['secondtransfereruniqueid']][_0xd81b('0x26')]=!![];this[_0xd81b('0x1a')][_0x51f5a1['transfertargetuniqueid']]=this[_0xd81b('0x1a')][_0x51f5a1[_0xd81b('0x47')]];delete this['channels'][_0x51f5a1[_0xd81b('0x47')]];}}else if(!_['isNil'](this[_0xd81b('0x1a')][_0x51f5a1[_0xd81b('0x48')]])){this[_0xd81b('0x41')](_0x51f5a1[_0xd81b('0x48')]);if(this[_0xd81b('0x1a')][_0x51f5a1[_0xd81b('0x49')]]){this[_0xd81b('0x1a')][_0x51f5a1[_0xd81b('0x49')]][_0xd81b('0x26')]=!![];this[_0xd81b('0x1a')][_0x51f5a1['transfereeuniqueid']]=this[_0xd81b('0x1a')][_0x51f5a1[_0xd81b('0x49')]];delete this[_0xd81b('0x1a')][_0x51f5a1[_0xd81b('0x49')]];}}}catch(_0x1bdf37){logger[_0xd81b('0x33')](_0xd81b('0x4a'),_0x1bdf37['message']);}};Acw['prototype']['syncBlindTransfer']=function(_0x2afe84){try{if(this[_0xd81b('0x1a')][_0x2afe84[_0xd81b('0x4b')]]){logger[_0xd81b('0x24')](_0xd81b('0x4c'),JSON[_0xd81b('0x3e')](_0x2afe84[_0xd81b('0x4b')]));this['startAcw'](_0x2afe84[_0xd81b('0x4b')]);}else if(this[_0xd81b('0x1a')][_0x2afe84[_0xd81b('0x4d')]]){logger[_0xd81b('0x24')](_0xd81b('0x4e'),JSON[_0xd81b('0x3e')](_0x2afe84[_0xd81b('0x4d')]));this['startAcw'](_0x2afe84[_0xd81b('0x4d')]);}}catch(_0x15f003){logger[_0xd81b('0x33')](_0xd81b('0x4f'),_0x15f003[_0xd81b('0x38')]);}};Acw[_0xd81b('0x19')][_0xd81b('0x11')]=function(_0x19d4f0){try{if(this[_0xd81b('0x7')][_0x19d4f0[_0xd81b('0x1c')]]&&this[_0xd81b('0x7')][_0x19d4f0[_0xd81b('0x1c')]]['autopause']===_0xd81b('0x50')){if(this['agents'][_0x19d4f0[_0xd81b('0x1b')]]){logger[_0xd81b('0x24')](_0xd81b('0x51'),_0x19d4f0[_0xd81b('0x39')],_0x19d4f0[_0xd81b('0x1b')],_0x19d4f0[_0xd81b('0x1c')]);return RpcUser[_0xd81b('0x28')](this[_0xd81b('0x8')][_0x19d4f0[_0xd81b('0x1b')]],_0xd81b('0x52'),_0x19d4f0['uniqueid']);}}}catch(_0xfa2a13){logger[_0xd81b('0x33')](_0xd81b('0x53'),_0xfa2a13[_0xd81b('0x38')]);}};module[_0xd81b('0x54')]=Acw; \ No newline at end of file +var _0xf2ca=['[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','hanguprequest','bind','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','milliseconds','diff','seconds','prototype','startAcw','channels','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','queue','updateAcw','lastPauseAt','timer','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','uniqueid','[TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','message','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid'];(function(_0x2382b5,_0x447dcf){var _0x4d5019=function(_0x4fd421){while(--_0x4fd421){_0x2382b5['push'](_0x2382b5['shift']());}};_0x4d5019(++_0x447dcf);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x29733c,_0x2da30b){_0x29733c=_0x29733c-0x0;var _0x49e72f=_0xf2ca[_0x29733c];return _0x49e72f;};'use strict';var util=require(_0xaf2c('0x0'));var _=require(_0xaf2c('0x1'));var moment=require(_0xaf2c('0x2'));var ami=require('../ami');var logger=require(_0xaf2c('0x3'))(_0xaf2c('0x4'));var RpcUser=require(_0xaf2c('0x5'));var RpcVoiceAgentReport=require(_0xaf2c('0x6'));function Acw(_0x3a724c){this[_0xaf2c('0x7')]=_0x3a724c['voiceQueues'];this[_0xaf2c('0x8')]=_0x3a724c[_0xaf2c('0x8')];this[_0xaf2c('0x9')]=_0x3a724c[_0xaf2c('0x9')];this['channels']={};ami['on'](_0xaf2c('0xa'),this[_0xaf2c('0xb')]['bind'](this));ami['on'](_0xaf2c('0xc'),this['syncHangupRequest'][_0xaf2c('0xd')](this));ami['on']('hangup',this[_0xaf2c('0xe')][_0xaf2c('0xd')](this));ami['on'](_0xaf2c('0xf'),this[_0xaf2c('0x10')]['bind'](this));ami['on']('attendedtransfer',this[_0xaf2c('0x11')][_0xaf2c('0xd')](this));ami['on'](_0xaf2c('0x12'),this[_0xaf2c('0x13')][_0xaf2c('0xd')](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0xaf2c('0xd')](this));}function getDiff(_0x8eaf9b){var _0x935959=moment()[_0xaf2c('0x14')](0x0);var _0x293ca6=moment(_0x8eaf9b)[_0xaf2c('0x14')](0x0);return _0x935959[_0xaf2c('0x15')](_0x293ca6,_0xaf2c('0x16'));}Acw[_0xaf2c('0x17')][_0xaf2c('0x18')]=function(_0x6ac8e){try{var _0x2b4d13=this;var _0x26bf7b=this[_0xaf2c('0x19')][_0x6ac8e][_0xaf2c('0x1a')];var _0x54c34a=this[_0xaf2c('0x19')][_0x6ac8e]['queue'];var _0x278a28=this[_0xaf2c('0x7')][_0x54c34a];var _0x1d544a=![];var _0x578492=_0xaf2c('0x1b');if(_0x278a28[_0xaf2c('0x1c')]){if(_0x278a28[_0xaf2c('0x1d')][_0xaf2c('0x1e')]){_0x1d544a=!![];_0x578492=_0x278a28[_0xaf2c('0x1d')][_0xaf2c('0x1e')];}}ami['Action']({'action':_0xaf2c('0x1f'),'interface':_0x26bf7b,'paused':!![],'reason':_0x578492})[_0xaf2c('0x20')](function(_0x8ffe13){if(_0x2b4d13[_0xaf2c('0x8')][_0x26bf7b]){return RpcUser[_0xaf2c('0x21')](_0x2b4d13['agents'][_0x26bf7b]['id'])[_0xaf2c('0x20')](function(_0xbf6f62){if(_0xbf6f62&&!_0xbf6f62[_0xaf2c('0x22')]){logger['info']('[%s][START][AGENT:%s][QUEUE:%s]',_0x6ac8e,_0x26bf7b,_0x54c34a);var _0x29cbdf=_0x2b4d13[_0xaf2c('0x19')][_0x6ac8e][_0xaf2c('0x23')]&&_0x2b4d13[_0xaf2c('0x19')][_0x6ac8e]['destlinkedid']?_0x2b4d13[_0xaf2c('0x19')][_0x6ac8e][_0xaf2c('0x24')]:_0x6ac8e;return RpcUser[_0xaf2c('0x25')](_0x2b4d13[_0xaf2c('0x8')][_0x26bf7b],_0x578492,_0x29cbdf)[_0xaf2c('0x20')](function(_0xff396f){if(!_0x1d544a){_0x2b4d13[_0xaf2c('0x9')][_0x26bf7b]={};logger['info'](_0xaf2c('0x26'),_0x6ac8e,_0x2b4d13[_0xaf2c('0x7')][_0x54c34a][_0xaf2c('0x27')],_0x26bf7b,_0x54c34a);_0x2b4d13[_0xaf2c('0x9')][_0x26bf7b]['timer']=setTimeout(_0x2b4d13[_0xaf2c('0x28')]['bind'](_0x2b4d13,_0x26bf7b),_0x2b4d13[_0xaf2c('0x7')][_0x54c34a][_0xaf2c('0x27')]*0x3e8);_0x2b4d13[_0xaf2c('0x9')][_0x26bf7b]['lastPauseAt']=moment()[_0xaf2c('0x29')](_0xaf2c('0x2a'));_0x2b4d13[_0xaf2c('0x9')][_0x26bf7b]['uniqueid']=_0x6ac8e;_0x2b4d13[_0xaf2c('0x9')][_0x26bf7b][_0xaf2c('0x2b')]=_0x54c34a;_0x2b4d13[_0xaf2c('0x9')][_0x26bf7b][_0xaf2c('0x2c')]=function(){var _0x59d858=getDiff(_0x2b4d13[_0xaf2c('0x9')][_0x26bf7b][_0xaf2c('0x2d')]);clearTimeout(_0x2b4d13[_0xaf2c('0x9')][_0x26bf7b]['timer']);_0x2b4d13['timers'][_0x26bf7b][_0xaf2c('0x2e')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x59d858},_0x2b4d13[_0xaf2c('0x9')][_0x26bf7b]['uniqueid'],_0x26bf7b)[_0xaf2c('0x20')](function(_0x1e4de2){logger['info'](_0xaf2c('0x2f'),_0x6ac8e,_0x59d858,_0x1e4de2);})[_0xaf2c('0x30')](function(_0x54db57){logger[_0xaf2c('0x31')](_0xaf2c('0x32'),_0x6ac8e,_0x54db57);});delete _0x2b4d13[_0xaf2c('0x9')][_0x26bf7b];};}});}else{logger[_0xaf2c('0x33')](_0xaf2c('0x34'),_0x6ac8e,_0x26bf7b,_0x54c34a);}});}})[_0xaf2c('0x30')](function(_0x5b1a7c){logger[_0xaf2c('0x31')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x6ac8e,_0x2b4d13[_0xaf2c('0x7')][_0x54c34a]['acwTimeout'],_0x26bf7b,_0x54c34a);})[_0xaf2c('0x35')](function(){delete _0x2b4d13['channels'][_0x6ac8e];});}catch(_0x2f3d16){logger['error'](_0xaf2c('0x36'),_0x2f3d16['message']);}};Acw[_0xaf2c('0x17')][_0xaf2c('0x28')]=function(_0x1a6929){try{var _0x14ec58=this;if(_0x14ec58[_0xaf2c('0x9')][_0x1a6929]){_0x14ec58['timers'][_0x1a6929]['timer']=![];var _0x6f428d=_0x14ec58[_0xaf2c('0x9')][_0x1a6929][_0xaf2c('0x37')];var _0xa44813=_0x14ec58[_0xaf2c('0x9')][_0x1a6929][_0xaf2c('0x2b')];var _0x573db3=_0x14ec58[_0xaf2c('0x7')][_0xa44813][_0xaf2c('0x27')];logger['info'](_0xaf2c('0x38'),_0x1a6929);RpcUser[_0xaf2c('0x39')](this[_0xaf2c('0x8')][_0x1a6929]);RpcVoiceAgentReport[_0xaf2c('0x3a')]({'acwtime':_0x573db3,'agentacw':!![]},_0x6f428d,_0x1a6929)[_0xaf2c('0x20')](function(_0x1e8eaf){logger[_0xaf2c('0x33')](_0xaf2c('0x2f'),_0x6f428d,_0x573db3,_0x1e8eaf);})[_0xaf2c('0x30')](function(_0x106eb9){logger[_0xaf2c('0x31')](_0xaf2c('0x32'),_0x6f428d,_0x106eb9);});}else{logger[_0xaf2c('0x31')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x1a6929);if(_0x14ec58['timers']){logger['info'](_0xaf2c('0x3b'),JSON[_0xaf2c('0x3c')](_0x14ec58[_0xaf2c('0x9')]));}}}catch(_0x381502){logger[_0xaf2c('0x31')](_0xaf2c('0x3d'),_0x381502['message']);}};Acw[_0xaf2c('0x17')][_0xaf2c('0xb')]=function(_0xc59393){try{if(this['voiceQueues'][_0xc59393['queue']]&&(this[_0xaf2c('0x7')][_0xc59393['queue']][_0xaf2c('0x4')]||this[_0xaf2c('0x7')][_0xc59393[_0xaf2c('0x2b')]][_0xaf2c('0x1c')])){if(this['agents'][_0xc59393[_0xaf2c('0x1a')]]){this['channels'][_0xc59393[_0xaf2c('0x37')]]={'queue':_0xc59393[_0xaf2c('0x2b')],'interface':_0xc59393['interface'],'destlinkedid':_0xc59393[_0xaf2c('0x24')]};}}}catch(_0x4a2317){logger[_0xaf2c('0x31')](_0xaf2c('0x3e'),_0x4a2317[_0xaf2c('0x3f')]);}};Acw[_0xaf2c('0x17')][_0xaf2c('0x40')]=function(_0x98d9f3){try{if(this[_0xaf2c('0x7')][_0x98d9f3[_0xaf2c('0x2b')]]&&(this[_0xaf2c('0x7')][_0x98d9f3['queue']]['acw']||this[_0xaf2c('0x7')][_0x98d9f3['queue']]['mandatoryDisposition'])){if(this['agents'][_0x98d9f3[_0xaf2c('0x1a')]]){this[_0xaf2c('0x19')][_0x98d9f3[_0xaf2c('0x37')]]={'queue':_0x98d9f3[_0xaf2c('0x2b')],'interface':_0x98d9f3['interface']};}}}catch(_0x219ea3){logger['error'](_0xaf2c('0x41'),_0x219ea3['message']);}};Acw[_0xaf2c('0x17')][_0xaf2c('0x42')]=function(_0x2d01b7){try{if(this[_0xaf2c('0x19')][_0x2d01b7[_0xaf2c('0x37')]]&&_['isUndefined'](this[_0xaf2c('0x19')][_0x2d01b7[_0xaf2c('0x37')]]['attended'])){logger['info'](_0xaf2c('0x43'),_0x2d01b7['uniqueid']);this[_0xaf2c('0x18')](_0x2d01b7[_0xaf2c('0x37')]);}else if(this[_0xaf2c('0x19')][_0x2d01b7[_0xaf2c('0x44')]]&&_[_0xaf2c('0x45')](this[_0xaf2c('0x19')][_0x2d01b7[_0xaf2c('0x44')]][_0xaf2c('0x23')])){logger[_0xaf2c('0x33')](_0xaf2c('0x46'),_0x2d01b7[_0xaf2c('0x44')]);this['startAcw'](_0x2d01b7[_0xaf2c('0x44')]);}}catch(_0x57547e){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x57547e['message']);}};Acw[_0xaf2c('0x17')][_0xaf2c('0xe')]=function(_0x551061){try{if(this[_0xaf2c('0x19')][_0x551061[_0xaf2c('0x37')]]&&this[_0xaf2c('0x19')][_0x551061[_0xaf2c('0x37')]][_0xaf2c('0x23')]){logger[_0xaf2c('0x33')](_0xaf2c('0x47'),_0x551061['uniqueid']);this[_0xaf2c('0x18')](_0x551061[_0xaf2c('0x37')]);}else if(this['channels'][_0x551061[_0xaf2c('0x44')]]&&this[_0xaf2c('0x19')][_0x551061[_0xaf2c('0x44')]][_0xaf2c('0x23')]){logger[_0xaf2c('0x33')](_0xaf2c('0x48'),_0x551061[_0xaf2c('0x44')]);this[_0xaf2c('0x18')](_0x551061[_0xaf2c('0x44')]);}}catch(_0x300254){logger[_0xaf2c('0x31')](_0xaf2c('0x49'),_0x300254[_0xaf2c('0x3f')]);}};Acw[_0xaf2c('0x17')][_0xaf2c('0x11')]=function(_0x2d6677){try{if(!_[_0xaf2c('0x4a')](this[_0xaf2c('0x19')][_0x2d6677[_0xaf2c('0x4b')]])){this[_0xaf2c('0x18')](_0x2d6677['transfereeuniqueid']);if(this[_0xaf2c('0x19')][_0x2d6677[_0xaf2c('0x4c')]]){this[_0xaf2c('0x19')][_0x2d6677['secondtransfereruniqueid']][_0xaf2c('0x23')]=!![];this['channels'][_0x2d6677[_0xaf2c('0x4d')]]=this[_0xaf2c('0x19')][_0x2d6677[_0xaf2c('0x4c')]];delete this[_0xaf2c('0x19')][_0x2d6677[_0xaf2c('0x4c')]];}}else if(!_[_0xaf2c('0x4a')](this[_0xaf2c('0x19')][_0x2d6677[_0xaf2c('0x4d')]])){this[_0xaf2c('0x18')](_0x2d6677['transfertargetuniqueid']);if(this[_0xaf2c('0x19')][_0x2d6677[_0xaf2c('0x4e')]]){this[_0xaf2c('0x19')][_0x2d6677[_0xaf2c('0x4e')]][_0xaf2c('0x23')]=!![];this['channels'][_0x2d6677[_0xaf2c('0x4b')]]=this[_0xaf2c('0x19')][_0x2d6677['origtransfereruniqueid']];delete this[_0xaf2c('0x19')][_0x2d6677[_0xaf2c('0x4e')]];}}}catch(_0x4b7070){logger['error'](_0xaf2c('0x4f'),_0x4b7070[_0xaf2c('0x3f')]);}};Acw[_0xaf2c('0x17')][_0xaf2c('0x13')]=function(_0x4cc55a){try{if(this[_0xaf2c('0x19')][_0x4cc55a[_0xaf2c('0x50')]]){logger['info'](_0xaf2c('0x51'),JSON['stringify'](_0x4cc55a[_0xaf2c('0x50')]));this[_0xaf2c('0x18')](_0x4cc55a[_0xaf2c('0x50')]);}else if(this[_0xaf2c('0x19')][_0x4cc55a[_0xaf2c('0x52')]]){logger[_0xaf2c('0x33')](_0xaf2c('0x53'),JSON[_0xaf2c('0x3c')](_0x4cc55a[_0xaf2c('0x52')]));this[_0xaf2c('0x18')](_0x4cc55a['transfererlinkedid']);}}catch(_0x79d962){logger[_0xaf2c('0x31')](_0xaf2c('0x54'),_0x79d962[_0xaf2c('0x3f')]);}};Acw[_0xaf2c('0x17')]['syncAgentRingNoAnswer']=function(_0xbfb776){try{if(this[_0xaf2c('0x7')][_0xbfb776[_0xaf2c('0x2b')]]&&this[_0xaf2c('0x7')][_0xbfb776[_0xaf2c('0x2b')]]['autopause']==='all'){if(this[_0xaf2c('0x8')][_0xbfb776[_0xaf2c('0x1a')]]){logger['info'](_0xaf2c('0x55'),_0xbfb776[_0xaf2c('0x37')],_0xbfb776[_0xaf2c('0x1a')],_0xbfb776['queue']);return RpcUser[_0xaf2c('0x25')](this[_0xaf2c('0x8')][_0xbfb776[_0xaf2c('0x1a')]],_0xaf2c('0x56'),_0xbfb776['uniqueid']);}}}catch(_0x32d552){logger[_0xaf2c('0x31')](_0xaf2c('0x57'),_0x32d552[_0xaf2c('0x3f')]);}};module[_0xaf2c('0x58')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index ad8ada1..326ccc8 100644 --- a/server/services/ami/ami.js +++ b/server/services/ami/ami.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84d5=['Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','actionDeviceStateList','then','catch','log','exports','moment','util','../../config/logger','ami','../../config/environment','asterisk','port','password','keepConnected','Action','promisify','action','error','format'];(function(_0x3e432a,_0x345ec3){var _0x2a9693=function(_0x2c7873){while(--_0x2c7873){_0x3e432a['push'](_0x3e432a['shift']());}};_0x2a9693(++_0x345ec3);}(_0x84d5,0x103));var _0x584d=function(_0x9bc045,_0x566fdb){_0x9bc045=_0x9bc045-0x0;var _0x27a8e3=_0x84d5[_0x9bc045];return _0x27a8e3;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var moment=require(_0x584d('0x0'));var util=require(_0x584d('0x1'));var _=require('lodash');var logger=require(_0x584d('0x2'))(_0x584d('0x3'));var config=require(_0x584d('0x4'));var ami=new Manager(config[_0x584d('0x5')][_0x584d('0x6')],config['asterisk']['ip'],config[_0x584d('0x5')]['username'],config[_0x584d('0x5')][_0x584d('0x7')],!![]);ami[_0x584d('0x8')]();ami[_0x584d('0x9')]=BPromise[_0x584d('0xa')](ami[_0x584d('0xb')]);function error(_0x4e3a79){logger[_0x584d('0xc')](util[_0x584d('0xd')](_0x584d('0xe'),config['asterisk'][_0x584d('0xf')],config[_0x584d('0x5')]['ip'],config['asterisk'][_0x584d('0x6')],util[_0x584d('0x10')](_0x4e3a79,![],null)));}function close(){logger['error'](util[_0x584d('0xd')](_0x584d('0x11'),config[_0x584d('0x5')][_0x584d('0xf')],config['asterisk']['ip'],config[_0x584d('0x5')]['port']));}ami[_0x584d('0x12')]=function(){return function(){return ami['Action']({'action':_0x584d('0x13')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':_0x584d('0x14')});};};ami[_0x584d('0x15')]=function(){return function(){return ami[_0x584d('0x9')]({'action':_0x584d('0x16')});};};ami[_0x584d('0x17')]=function(){return function(){return ami[_0x584d('0x9')]({'action':_0x584d('0x18')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x584d('0x9')]({'action':'coreshowchannels'});};};function connect(_0x464042){logger[_0x584d('0x19')](util['format'](_0x584d('0x1a'),config[_0x584d('0x5')][_0x584d('0xf')],config[_0x584d('0x5')]['ip'],config[_0x584d('0x5')][_0x584d('0x6')]));ami[_0x584d('0x1b')](_0x584d('0xc'),error);ami[_0x584d('0x1b')](_0x584d('0x1c'),close);}ami['on'](_0x584d('0x1d'),connect);ami['on']('shutdown',function(_0x332a6f){logger['info'](util[_0x584d('0xd')](_0x584d('0x1e'),config[_0x584d('0x5')][_0x584d('0xf')],config[_0x584d('0x5')]['ip'],config[_0x584d('0x5')][_0x584d('0x6')],util[_0x584d('0x10')](_0x332a6f,![],null)));});ami['on'](_0x584d('0x1f'),function(_0x41b82d){logger['info'](util[_0x584d('0xd')](_0x584d('0x20'),config[_0x584d('0x5')]['username'],config[_0x584d('0x5')]['ip'],config['asterisk'][_0x584d('0x6')]));return BPromise[_0x584d('0x21')]()['then'](ami['actionSipShowRegistry']())['then'](ami[_0x584d('0x22')]())['then'](ami[_0x584d('0x15')]())[_0x584d('0x23')](ami[_0x584d('0x17')]())[_0x584d('0x23')](ami['actionCoreShowChannels']())[_0x584d('0x24')](function(_0x2cfeef){console[_0x584d('0x25')](_0x2cfeef);});});ami[_0x584d('0x1b')](_0x584d('0xc'),error);ami['once'](_0x584d('0x1c'),close);module[_0x584d('0x26')]=ami; \ No newline at end of file +var _0x418f=['coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','log','once','exports','bluebird','moment','util','lodash','ami','../../config/environment','asterisk','port','username','keepConnected','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionCoreShowChannels'];(function(_0x440ad2,_0x3d64d6){var _0x246ef2=function(_0x583230){while(--_0x583230){_0x440ad2['push'](_0x440ad2['shift']());}};_0x246ef2(++_0x3d64d6);}(_0x418f,0x199));var _0xf418=function(_0x291b93,_0x44b715){_0x291b93=_0x291b93-0x0;var _0x4183c8=_0x418f[_0x291b93];return _0x4183c8;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xf418('0x0'));var moment=require(_0xf418('0x1'));var util=require(_0xf418('0x2'));var _=require(_0xf418('0x3'));var logger=require('../../config/logger')(_0xf418('0x4'));var config=require(_0xf418('0x5'));var ami=new Manager(config[_0xf418('0x6')][_0xf418('0x7')],config[_0xf418('0x6')]['ip'],config[_0xf418('0x6')][_0xf418('0x8')],config[_0xf418('0x6')]['password'],!![]);ami[_0xf418('0x9')]();ami['Action']=BPromise[_0xf418('0xa')](ami[_0xf418('0xb')]);function error(_0x5596a8){logger['error'](util[_0xf418('0xc')](_0xf418('0xd'),config[_0xf418('0x6')]['username'],config[_0xf418('0x6')]['ip'],config[_0xf418('0x6')][_0xf418('0x7')],util['inspect'](_0x5596a8,![],null)));}function close(){logger[_0xf418('0xe')](util[_0xf418('0xc')](_0xf418('0xf'),config['asterisk']['username'],config[_0xf418('0x6')]['ip'],config[_0xf418('0x6')][_0xf418('0x7')]));}ami[_0xf418('0x10')]=function(){return function(){return ami[_0xf418('0x11')]({'action':'sipshowregistry'});};};ami[_0xf418('0x12')]=function(){return function(){return ami[_0xf418('0x11')]({'action':_0xf418('0x13')});};};ami[_0xf418('0x14')]=function(){return function(){return ami[_0xf418('0x11')]({'action':_0xf418('0x15')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0xf418('0x11')]({'action':'queuesummary'});};};ami[_0xf418('0x16')]=function(){return function(){return ami[_0xf418('0x11')]({'action':_0xf418('0x17')});};};function connect(_0xf05ac1){logger[_0xf418('0x18')](util['format'](_0xf418('0x19'),config[_0xf418('0x6')][_0xf418('0x8')],config[_0xf418('0x6')]['ip'],config[_0xf418('0x6')][_0xf418('0x7')]));ami['once'](_0xf418('0xe'),error);ami['once'](_0xf418('0x1a'),close);}ami['on'](_0xf418('0x1b'),connect);ami['on']('shutdown',function(_0x254b19){logger[_0xf418('0x18')](util[_0xf418('0xc')](_0xf418('0x1c'),config[_0xf418('0x6')]['username'],config['asterisk']['ip'],config['asterisk'][_0xf418('0x7')],util[_0xf418('0x1d')](_0x254b19,![],null)));});ami['on'](_0xf418('0x1e'),function(_0x18ed5b){logger[_0xf418('0x18')](util['format'](_0xf418('0x1f'),config['asterisk'][_0xf418('0x8')],config[_0xf418('0x6')]['ip'],config[_0xf418('0x6')][_0xf418('0x7')]));return BPromise['resolve']()[_0xf418('0x20')](ami[_0xf418('0x10')]())[_0xf418('0x20')](ami[_0xf418('0x12')]())['then'](ami['actionSipPeerStatus']())['then'](ami['actionQueueSummary']())['then'](ami[_0xf418('0x16')]())['catch'](function(_0x2fadaa){console[_0xf418('0x21')](_0x2fadaa);});});ami[_0xf418('0x22')]('error',error);ami['once'](_0xf418('0x1a'),close);module[_0xf418('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index c296b4f..ad424e5 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 _0xfb71=['../../config/logger','ami','client','http','Request','debug','rpc','memberReport','error','message','result','exports','jayson/promise','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb71,0x124));var _0x1fb7=function(_0x15866c,_0x174230){_0x15866c=_0x15866c-0x0;var _0x16cce2=_0xfb71[_0x15866c];return _0x16cce2;};'use strict';var jayson=require(_0x1fb7('0x0'));var BPromise=require(_0x1fb7('0x1'));var logger=require(_0x1fb7('0x2'))(_0x1fb7('0x3'));var client=jayson[_0x1fb7('0x4')][_0x1fb7('0x5')]({'port':0x2329});client[_0x1fb7('0x6')]=function(_0x443154,_0x2a64c0){return new BPromise(function(_0x15af80,_0x2b22c2){return client['request'](_0x443154,_0x2a64c0)['then'](function(_0x7d425){logger[_0x1fb7('0x7')](_0x1fb7('0x8'),_0x1fb7('0x9'),_0x443154,_0x2a64c0,_0x7d425);if(_0x7d425['error']){logger[_0x1fb7('0xa')](_0x1fb7('0x8'),'memberReport',_0x443154,_0x7d425[_0x1fb7('0xa')][_0x1fb7('0xb')],_0x2a64c0);return _0x2b22c2(_0x7d425[_0x1fb7('0xa')][_0x1fb7('0xb')]);}else{return _0x15af80(_0x7d425[_0x1fb7('0xc')]);}})['catch'](function(_0x2d859b){logger[_0x1fb7('0xa')](_0x1fb7('0x8'),_0x1fb7('0x9'),_0x443154,_0x2d859b,_0x2a64c0);return _0x2b22c2(_0x2d859b);});});};module[_0x1fb7('0xd')]=client; \ No newline at end of file +var _0x72ff=['http','request','then','debug','rpc','memberReport','message','error','result','catch','exports','jayson/promise','bluebird','../../config/logger','client'];(function(_0x191b1a,_0x48e0e6){var _0x283089=function(_0x4f6574){while(--_0x4f6574){_0x191b1a['push'](_0x191b1a['shift']());}};_0x283089(++_0x48e0e6);}(_0x72ff,0x1be));var _0xf72f=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x72ff[_0x1d9aa0];return _0x226868;};'use strict';var jayson=require(_0xf72f('0x0'));var BPromise=require(_0xf72f('0x1'));var logger=require(_0xf72f('0x2'))('ami');var client=jayson[_0xf72f('0x3')][_0xf72f('0x4')]({'port':0x2329});client['Request']=function(_0x4c9ea4,_0x4068ba){return new BPromise(function(_0x43574e,_0x1bde7d){return client[_0xf72f('0x5')](_0x4c9ea4,_0x4068ba)[_0xf72f('0x6')](function(_0x21f881){logger[_0xf72f('0x7')](_0xf72f('0x8'),_0xf72f('0x9'),_0x4c9ea4,_0x4068ba,_0x21f881);if(_0x21f881['error']){logger['error'](_0xf72f('0x8'),_0xf72f('0x9'),_0x4c9ea4,_0x21f881['error'][_0xf72f('0xa')],_0x4068ba);return _0x1bde7d(_0x21f881[_0xf72f('0xb')][_0xf72f('0xa')]);}else{return _0x43574e(_0x21f881[_0xf72f('0xc')]);}})[_0xf72f('0xd')](function(_0x2bec0b){logger[_0xf72f('0xb')](_0xf72f('0x8'),_0xf72f('0x9'),_0x4c9ea4,_0x2bec0b,_0x4068ba);return _0x1bde7d(_0x2bec0b);});});};module[_0xf72f('0xe')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index ae20f4f..fae23b4 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 _0x980c=['VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ContactId','ListId','UserId'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x980c,0x100));var _0xc980=function(_0x4b71a1,_0x2aabce){_0x4b71a1=_0x4b71a1-0x0;var _0x161af2=_0x980c[_0x4b71a1];return _0x161af2;};'use strict';var util=require(_0xc980('0x0'));var _=require(_0xc980('0x1'));var moment=require(_0xc980('0x2'));function checkNameSurname(_0x8f18bd,_0x2121b0,_0x4aaba){var _0x444b7f='';if(!_[_0xc980('0x3')](_0x2121b0)&&_0xc980('0x4')===typeof _0x2121b0){_0x444b7f+=_0x2121b0;}if(!_[_0xc980('0x3')](_0x4aaba)&&_0xc980('0x4')===typeof _0x4aaba){_0x444b7f+='\x20'+_0x4aaba;}if(_0x444b7f!==''){return _0x444b7f;}return _0x8f18bd;}function Action(_0x5793bf,_0x472ece,_0x311a54){this[_0xc980('0x5')]=_0x5793bf;this[_0xc980('0x6')]=_0x311a54||undefined;this[_0xc980('0x7')]=checkNameSurname(_0x472ece[_0xc980('0x8')][_0xc980('0x9')],_0x472ece['Contact']['firstName'],_0x472ece['Contact'][_0xc980('0xa')]);this['number']=_0x472ece[_0xc980('0x8')][_0xc980('0x9')];this[_0xc980('0xb')]=_0x5793bf['name'];this[_0xc980('0xc')]=_0x472ece[_0xc980('0xc')]||![];this[_0xc980('0xd')]=_0x5793bf['type'];this[_0xc980('0xe')]=_0x5793bf[_0xc980('0xe')]||0x3;this[_0xc980('0xf')]=_0x472ece[_0xc980('0xf')];this[_0xc980('0x10')]=_0x472ece[_0xc980('0x10')];this[_0xc980('0x11')]=_0x472ece[_0xc980('0x11')];this[_0xc980('0x12')]=_0x472ece[_0xc980('0x12')];this[_0xc980('0x13')]=_0x472ece[_0xc980('0x13')];this[_0xc980('0x14')]=_0x472ece['countdropretry'];this['countabandonedretry']=_0x472ece[_0xc980('0x15')];this['countmachineretry']=_0x472ece['countmachineretry'];this[_0xc980('0x16')]=_0x472ece[_0xc980('0x16')];this[_0xc980('0x17')]=_0x472ece[_0xc980('0x17')];this[_0xc980('0x18')]=_0x472ece[_0xc980('0x18')];this['UserId']=_0x472ece[_0xc980('0x19')];this[_0xc980('0x1a')]=_0x472ece[_0xc980('0x1a')];this['CampaignId']=_0x472ece[_0xc980('0x1b')];this[_0xc980('0x1c')]=_0x472ece['id'];this[_0xc980('0x1d')]=_0x472ece[_0xc980('0x8')][_0xc980('0x1e')]||'';this[_0xc980('0x1f')]=moment()['format'](_0xc980('0x20'));this[_0xc980('0x21')]=_0x472ece[_0xc980('0x21')];this[_0xc980('0x22')]=_0x472ece[_0xc980('0x22')];this[_0xc980('0x23')]=_0x472ece[_0xc980('0x23')];this['recallme']=_0x472ece['recallme'];this[_0xc980('0x24')]='';this[_0xc980('0x25')]='';}Action[_0xc980('0x26')][_0xc980('0x27')]=function(){return util[_0xc980('0x28')](_0xc980('0x29'),this['name'],this[_0xc980('0x5')][_0xc980('0x2a')]>0x0?this[_0xc980('0x2b')][_0xc980('0x2c')](this[_0xc980('0x5')][_0xc980('0x2a')]):this[_0xc980('0x2b')]);};Action[_0xc980('0x26')][_0xc980('0x2d')]=function(){return this[_0xc980('0xb')];};module[_0xc980('0x2e')]=Action; \ No newline at end of file +var _0x15ec=['callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','number','substring','getQueue','exports','lodash','moment','isNil','string','uniqueid','name','Contact','phone','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','firstName','starttime','format','callback'];(function(_0x22b96c,_0x55388f){var _0x5205de=function(_0x136552){while(--_0x136552){_0x22b96c['push'](_0x22b96c['shift']());}};_0x5205de(++_0x55388f);}(_0x15ec,0x16c));var _0xc15e=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x15ec[_0x5317b5];return _0x3b7ce2;};'use strict';var util=require('util');var _=require(_0xc15e('0x0'));var moment=require(_0xc15e('0x1'));function checkNameSurname(_0x272df9,_0x5365f9,_0x2924b7){var _0x4420c1='';if(!_[_0xc15e('0x2')](_0x5365f9)&&_0xc15e('0x3')===typeof _0x5365f9){_0x4420c1+=_0x5365f9;}if(!_[_0xc15e('0x2')](_0x2924b7)&&_0xc15e('0x3')===typeof _0x2924b7){_0x4420c1+='\x20'+_0x2924b7;}if(_0x4420c1!==''){return _0x4420c1;}return _0x272df9;}function Action(_0x18c3fc,_0x4e7b48,_0x46f5d3){this['voiceQueue']=_0x18c3fc;this[_0xc15e('0x4')]=_0x46f5d3||undefined;this[_0xc15e('0x5')]=checkNameSurname(_0x4e7b48[_0xc15e('0x6')][_0xc15e('0x7')],_0x4e7b48[_0xc15e('0x6')]['firstName'],_0x4e7b48[_0xc15e('0x6')][_0xc15e('0x8')]);this['number']=_0x4e7b48['Contact'][_0xc15e('0x7')];this[_0xc15e('0x9')]=_0x18c3fc[_0xc15e('0x5')];this['active']=_0x4e7b48[_0xc15e('0xa')]||![];this[_0xc15e('0xb')]=_0x18c3fc[_0xc15e('0xb')];this[_0xc15e('0xc')]=_0x18c3fc[_0xc15e('0xc')]||0x3;this[_0xc15e('0xd')]=_0x4e7b48[_0xc15e('0xd')];this[_0xc15e('0xe')]=_0x4e7b48['countbusyretry'];this['countcongestionretry']=_0x4e7b48[_0xc15e('0xf')];this['countnoanswerretry']=_0x4e7b48[_0xc15e('0x10')];this[_0xc15e('0x11')]=_0x4e7b48[_0xc15e('0x11')];this['countdropretry']=_0x4e7b48[_0xc15e('0x12')];this[_0xc15e('0x13')]=_0x4e7b48[_0xc15e('0x13')];this[_0xc15e('0x14')]=_0x4e7b48[_0xc15e('0x14')];this['countagentrejectretry']=_0x4e7b48[_0xc15e('0x15')];this[_0xc15e('0x16')]=_0x4e7b48[_0xc15e('0x16')];this['ListId']=_0x4e7b48[_0xc15e('0x17')];this[_0xc15e('0x18')]=_0x4e7b48['UserId'];this[_0xc15e('0x19')]=_0x4e7b48[_0xc15e('0x19')];this['CampaignId']=_0x4e7b48[_0xc15e('0x1a')];this[_0xc15e('0x1b')]=_0x4e7b48['id'];this['ContactFirstName']=_0x4e7b48[_0xc15e('0x6')][_0xc15e('0x1c')]||'';this[_0xc15e('0x1d')]=moment()[_0xc15e('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xc15e('0x1f')]=_0x4e7b48[_0xc15e('0x1f')];this[_0xc15e('0x20')]=_0x4e7b48[_0xc15e('0x20')];this[_0xc15e('0x21')]=_0x4e7b48[_0xc15e('0x21')];this[_0xc15e('0x22')]=_0x4e7b48['recallme'];this[_0xc15e('0x23')]='';this['originatecalleridname']='';}Action['prototype'][_0xc15e('0x24')]=function(){return util['format'](_0xc15e('0x25'),this[_0xc15e('0x5')],this[_0xc15e('0x26')][_0xc15e('0x27')]>0x0?this[_0xc15e('0x28')][_0xc15e('0x29')](this[_0xc15e('0x26')][_0xc15e('0x27')]):this[_0xc15e('0x28')]);};Action['prototype'][_0xc15e('0x2a')]=function(){return this['queue'];};module[_0xc15e('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 ac37fce..d9cfe82 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 _0xf70d=['milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','name','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','exports','util','moment'];(function(_0x2cf4b5,_0x372215){var _0x30bf63=function(_0x52aff3){while(--_0x52aff3){_0x2cf4b5['push'](_0x2cf4b5['shift']());}};_0x30bf63(++_0x372215);}(_0xf70d,0x11e));var _0xdf70=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xf70d[_0x409353];return _0x4f4b59;};'use strict';var util=require(_0xdf70('0x0'));var _=require('lodash');var moment=require(_0xdf70('0x1'));function getSeconds(_0x33d446,_0x3f204b){var _0x119d60=moment(_0x33d446)[_0xdf70('0x2')](0x0);var _0x77523=moment(_0x3f204b)[_0xdf70('0x2')](0x0);return _0x119d60[_0xdf70('0x3')](_0x77523,_0xdf70('0x4'));}function AdditionalPhone(_0x13c516){this[_0xdf70('0x5')]=_0x13c516[_0xdf70('0x5')];this['scheduledat']=_0x13c516[_0xdf70('0x6')]||undefined;this['type']=_0x13c516[_0xdf70('0x7')];this[_0xdf70('0x8')]=_0x13c516[_0xdf70('0x7')]==='outbound'?_0xdf70('0x9'):_0x13c516[_0xdf70('0x7')];this[_0xdf70('0xa')]=_0x13c516[_0xdf70('0xa')];this['countcongestionretry']=_0x13c516[_0xdf70('0xb')];this[_0xdf70('0xc')]=_0x13c516[_0xdf70('0xc')];this['countglobal']=_0x13c516[_0xdf70('0xa')]+_0x13c516[_0xdf70('0xb')]+_0x13c516[_0xdf70('0xc')]+_0x13c516[_0xdf70('0xd')]+_0x13c516[_0xdf70('0xe')]+_0x13c516[_0xdf70('0xf')]+_0x13c516['countmachineretry']+_0x13c516[_0xdf70('0x10')];this[_0xdf70('0xd')]=_0x13c516[_0xdf70('0xd')];this[_0xdf70('0xe')]=_0x13c516['countdropretry'];this[_0xdf70('0xf')]=_0x13c516[_0xdf70('0xf')];this[_0xdf70('0x11')]=_0x13c516[_0xdf70('0x11')];this[_0xdf70('0x10')]=_0x13c516[_0xdf70('0x10')];this[_0xdf70('0x9')]=_0x13c516[_0xdf70('0x9')];this[_0xdf70('0x12')]=_0x13c516[_0xdf70('0x13')];this[_0xdf70('0x14')]=_0x13c516['number'];this[_0xdf70('0x15')]=_0x13c516[_0xdf70('0x15')];this['responsetime']=_0x13c516['responsetime'];this['endtime']=_0x13c516[_0xdf70('0x16')];this[_0xdf70('0x17')]=getSeconds(_0x13c516[_0xdf70('0x16')],_0x13c516[_0xdf70('0x15')]);this[_0xdf70('0x18')]=0x0;this[_0xdf70('0x19')]=0x0;this[_0xdf70('0x1a')]=_0x13c516[_0xdf70('0x1a')];this['callbackuniqueid']=_0x13c516[_0xdf70('0x1b')];this[_0xdf70('0x1c')]=_0x13c516[_0xdf70('0x1c')];this[_0xdf70('0x1d')]=_0x13c516[_0xdf70('0x1d')];this[_0xdf70('0x1e')]=_0x13c516[_0xdf70('0x1e')];this['ListId']=_0x13c516[_0xdf70('0x1f')];this[_0xdf70('0x20')]=_0x13c516[_0xdf70('0x20')];this['VoiceQueueId']=_0x13c516['VoiceQueueId'];this['CampaignId']=_0x13c516[_0xdf70('0x21')];this[_0xdf70('0x22')]=_0x13c516[_0xdf70('0x22')]||'';this['originatecalleridname']=_0x13c516['originatecalleridname']||'';}module[_0xdf70('0x23')]=History; \ No newline at end of file +var _0x957c=['countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x53537e,_0x280c98){var _0x281091=function(_0x2d5e7b){while(--_0x2d5e7b){_0x53537e['push'](_0x53537e['shift']());}};_0x281091(++_0x280c98);}(_0x957c,0x1aa));var _0xc957=function(_0x43912d,_0x440302){_0x43912d=_0x43912d-0x0;var _0x3372d4=_0x957c[_0x43912d];return _0x3372d4;};'use strict';var util=require(_0xc957('0x0'));var _=require(_0xc957('0x1'));var moment=require(_0xc957('0x2'));function getSeconds(_0x26e8b2,_0x1e8599){var _0x3f9c73=moment(_0x26e8b2)[_0xc957('0x3')](0x0);var _0x4c38b9=moment(_0x1e8599)[_0xc957('0x3')](0x0);return _0x3f9c73['diff'](_0x4c38b9,'seconds');}function AdditionalPhone(_0x1fea03){this[_0xc957('0x4')]=_0x1fea03[_0xc957('0x4')];this[_0xc957('0x5')]=_0x1fea03[_0xc957('0x5')]||undefined;this[_0xc957('0x6')]=_0x1fea03[_0xc957('0x6')];this[_0xc957('0x7')]=_0x1fea03[_0xc957('0x6')]===_0xc957('0x8')?_0xc957('0x9'):_0x1fea03[_0xc957('0x6')];this[_0xc957('0xa')]=_0x1fea03[_0xc957('0xa')];this[_0xc957('0xb')]=_0x1fea03[_0xc957('0xb')];this['countnoanswerretry']=_0x1fea03[_0xc957('0xc')];this[_0xc957('0xd')]=_0x1fea03[_0xc957('0xa')]+_0x1fea03[_0xc957('0xb')]+_0x1fea03[_0xc957('0xc')]+_0x1fea03[_0xc957('0xe')]+_0x1fea03['countdropretry']+_0x1fea03[_0xc957('0xf')]+_0x1fea03[_0xc957('0x10')]+_0x1fea03[_0xc957('0x11')];this[_0xc957('0xe')]=_0x1fea03[_0xc957('0xe')];this[_0xc957('0x12')]=_0x1fea03[_0xc957('0x12')];this[_0xc957('0xf')]=_0x1fea03[_0xc957('0xf')];this['countmachineretry']=_0x1fea03[_0xc957('0x10')];this['countagentrejectretry']=_0x1fea03[_0xc957('0x11')];this[_0xc957('0x9')]=_0x1fea03['queue'];this[_0xc957('0x13')]=_0x1fea03[_0xc957('0x14')];this[_0xc957('0x15')]=_0x1fea03[_0xc957('0x16')];this[_0xc957('0x17')]=_0x1fea03['starttime'];this['responsetime']=_0x1fea03[_0xc957('0x18')];this[_0xc957('0x19')]=_0x1fea03[_0xc957('0x18')];this[_0xc957('0x1a')]=getSeconds(_0x1fea03[_0xc957('0x18')],_0x1fea03[_0xc957('0x17')]);this[_0xc957('0x1b')]=0x0;this[_0xc957('0x1c')]=0x0;this[_0xc957('0x1d')]=_0x1fea03[_0xc957('0x1d')];this[_0xc957('0x1e')]=_0x1fea03[_0xc957('0x1e')];this[_0xc957('0x1f')]=_0x1fea03['callbackat'];this[_0xc957('0x20')]=_0x1fea03[_0xc957('0x20')];this[_0xc957('0x21')]=_0x1fea03[_0xc957('0x21')];this[_0xc957('0x22')]=_0x1fea03[_0xc957('0x22')];this[_0xc957('0x23')]=_0x1fea03[_0xc957('0x23')];this[_0xc957('0x24')]=_0x1fea03['VoiceQueueId'];this['CampaignId']=_0x1fea03[_0xc957('0x25')];this[_0xc957('0x26')]=_0x1fea03[_0xc957('0x26')]||'';this[_0xc957('0x27')]=_0x1fea03[_0xc957('0x27')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 7daaa9a..56547b5 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 _0xb9fc=['calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','uniqueid','calleridname','name'];(function(_0xbdd93d,_0x1c0726){var _0x565767=function(_0x3c2251){while(--_0x3c2251){_0xbdd93d['push'](_0xbdd93d['shift']());}};_0x565767(++_0x1c0726);}(_0xb9fc,0xa0));var _0xcb9f=function(_0xfa2639,_0xf2eb32){_0xfa2639=_0xfa2639-0x0;var _0x507a78=_0xb9fc[_0xfa2639];return _0x507a78;};'use strict';var util=require(_0xcb9f('0x0'));var _=require('lodash');var moment=require(_0xcb9f('0x1'));function getSeconds(_0x2dbf5b,_0x2f0965){var _0x32e2ce=moment(_0x2dbf5b)[_0xcb9f('0x2')](0x0);var _0x5243b4=moment(_0x2f0965)['milliseconds'](0x0);return _0x32e2ce[_0xcb9f('0x3')](_0x5243b4,_0xcb9f('0x4'));}function AgentComplete(_0x109689,_0x2e2607){this[_0xcb9f('0x5')]=0x4;this[_0xcb9f('0x6')]=_0xcb9f('0x7');this[_0xcb9f('0x8')]=_0x109689[_0xcb9f('0x8')];this[_0xcb9f('0x9')]=_0x109689[_0xcb9f('0x9')];this[_0xcb9f('0xa')]=_0x109689[_0xcb9f('0x9')]===_0xcb9f('0xb')?'queue':_0x109689[_0xcb9f('0x9')];this[_0xcb9f('0xc')]=_0x109689[_0xcb9f('0xc')];this[_0xcb9f('0xd')]=_0x109689[_0xcb9f('0xd')];this['countnoanswerretry']=_0x109689[_0xcb9f('0xe')];this[_0xcb9f('0xf')]=_0x109689[_0xcb9f('0xc')]+_0x109689[_0xcb9f('0xd')]+_0x109689['countnoanswerretry']+_0x109689['countnosuchnumberretry']+_0x109689[_0xcb9f('0x10')]+_0x109689[_0xcb9f('0x11')]+_0x109689['countmachineretry']+_0x109689[_0xcb9f('0x12')];this[_0xcb9f('0x13')]=_0x109689[_0xcb9f('0x13')];this['countdropretry']=_0x109689[_0xcb9f('0x10')];this[_0xcb9f('0x11')]=_0x109689['countabandonedretry'];this[_0xcb9f('0x14')]=_0x109689[_0xcb9f('0x14')];this['countagentrejectretry']=_0x109689['countagentrejectretry'];this[_0xcb9f('0x15')]=_0x2e2607[_0xcb9f('0x15')];this[_0xcb9f('0x16')]=_0x109689[_0xcb9f('0x17')];this[_0xcb9f('0x18')]=_0x109689[_0xcb9f('0x19')];this[_0xcb9f('0x1a')]=_0x109689[_0xcb9f('0x1a')];this[_0xcb9f('0x1b')]=_0x109689[_0xcb9f('0x1b')];this[_0xcb9f('0x1c')]=_0x109689[_0xcb9f('0x1c')];this[_0xcb9f('0x1d')]=moment()[_0xcb9f('0x1e')](_0xcb9f('0x1f'));this['ringtime']=getSeconds(_0x109689[_0xcb9f('0x1b')],_0x109689[_0xcb9f('0x1a')]);this['holdtime']=getSeconds(_0x109689['answertime'],_0x109689[_0xcb9f('0x1b')]);this[_0xcb9f('0x20')]=getSeconds(this[_0xcb9f('0x1d')],_0x109689[_0xcb9f('0x1c')]);this[_0xcb9f('0x21')]=_0x2e2607[_0xcb9f('0x21')];this[_0xcb9f('0x22')]=_0x2e2607['membername'];this[_0xcb9f('0x23')]=_0x2e2607[_0xcb9f('0x23')];this[_0xcb9f('0x24')]=_0x109689[_0xcb9f('0x24')];this['callbackuniqueid']=_0x109689[_0xcb9f('0x25')];this[_0xcb9f('0x26')]=_0x109689['callbackat'];this[_0xcb9f('0x27')]=_0x109689[_0xcb9f('0x27')];this[_0xcb9f('0x28')]=_0x109689[_0xcb9f('0x28')];this[_0xcb9f('0x29')]=_0x109689['ListId'];this['UserId']=_0x109689['UserId'];this[_0xcb9f('0x2a')]=_0x109689['VoiceQueueId'];this[_0xcb9f('0x2b')]=_0x109689['CampaignId'];this[_0xcb9f('0x2c')]=_0x109689[_0xcb9f('0x2c')]||'';this[_0xcb9f('0x2d')]=_0x109689[_0xcb9f('0x2d')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0xc0c0=['format','ringtime','holdtime','talktime','endtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','diff','seconds','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','number','starttime','responsetime','answertime'];(function(_0x1fbc20,_0x18d9f9){var _0x3b8a69=function(_0x5cbd11){while(--_0x5cbd11){_0x1fbc20['push'](_0x1fbc20['shift']());}};_0x3b8a69(++_0x18d9f9);}(_0xc0c0,0x1eb));var _0x0c0c=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xc0c0[_0x35885a];return _0xe86249;};'use strict';var util=require(_0x0c0c('0x0'));var _=require(_0x0c0c('0x1'));var moment=require('moment');function getSeconds(_0x122acd,_0xd924e8){var _0xf3c967=moment(_0x122acd)[_0x0c0c('0x2')](0x0);var _0x45c506=moment(_0xd924e8)[_0x0c0c('0x2')](0x0);return _0xf3c967[_0x0c0c('0x3')](_0x45c506,_0x0c0c('0x4'));}function AgentComplete(_0x1dc704,_0x15efab){this['state']=0x4;this['statedesc']=_0x0c0c('0x5');this[_0x0c0c('0x6')]=_0x1dc704['scheduledat'];this[_0x0c0c('0x7')]=_0x1dc704[_0x0c0c('0x7')];this[_0x0c0c('0x8')]=_0x1dc704['type']===_0x0c0c('0x9')?'queue':_0x1dc704[_0x0c0c('0x7')];this[_0x0c0c('0xa')]=_0x1dc704[_0x0c0c('0xa')];this[_0x0c0c('0xb')]=_0x1dc704[_0x0c0c('0xb')];this[_0x0c0c('0xc')]=_0x1dc704['countnoanswerretry'];this[_0x0c0c('0xd')]=_0x1dc704[_0x0c0c('0xa')]+_0x1dc704[_0x0c0c('0xb')]+_0x1dc704[_0x0c0c('0xc')]+_0x1dc704[_0x0c0c('0xe')]+_0x1dc704[_0x0c0c('0xf')]+_0x1dc704[_0x0c0c('0x10')]+_0x1dc704[_0x0c0c('0x11')]+_0x1dc704[_0x0c0c('0x12')];this[_0x0c0c('0xe')]=_0x1dc704[_0x0c0c('0xe')];this['countdropretry']=_0x1dc704['countdropretry'];this['countabandonedretry']=_0x1dc704[_0x0c0c('0x10')];this[_0x0c0c('0x11')]=_0x1dc704[_0x0c0c('0x11')];this[_0x0c0c('0x12')]=_0x1dc704[_0x0c0c('0x12')];this['uniqueid']=_0x15efab[_0x0c0c('0x13')];this['calleridname']=_0x1dc704[_0x0c0c('0x14')];this['calleridnum']=_0x1dc704[_0x0c0c('0x15')];this[_0x0c0c('0x16')]=_0x1dc704['starttime'];this[_0x0c0c('0x17')]=_0x1dc704['responsetime'];this[_0x0c0c('0x18')]=_0x1dc704[_0x0c0c('0x18')];this['endtime']=moment()[_0x0c0c('0x19')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x0c0c('0x1a')]=getSeconds(_0x1dc704[_0x0c0c('0x17')],_0x1dc704[_0x0c0c('0x16')]);this[_0x0c0c('0x1b')]=getSeconds(_0x1dc704['answertime'],_0x1dc704[_0x0c0c('0x17')]);this[_0x0c0c('0x1c')]=getSeconds(this[_0x0c0c('0x1d')],_0x1dc704[_0x0c0c('0x18')]);this[_0x0c0c('0x1e')]=_0x15efab[_0x0c0c('0x1e')];this[_0x0c0c('0x1f')]=_0x15efab[_0x0c0c('0x1f')];this[_0x0c0c('0x20')]=_0x15efab[_0x0c0c('0x20')];this[_0x0c0c('0x21')]=_0x1dc704[_0x0c0c('0x21')];this[_0x0c0c('0x22')]=_0x1dc704[_0x0c0c('0x22')];this['callbackat']=_0x1dc704[_0x0c0c('0x23')];this[_0x0c0c('0x24')]=_0x1dc704[_0x0c0c('0x24')];this[_0x0c0c('0x25')]=_0x1dc704[_0x0c0c('0x25')];this[_0x0c0c('0x26')]=_0x1dc704[_0x0c0c('0x26')];this['UserId']=_0x1dc704[_0x0c0c('0x27')];this['VoiceQueueId']=_0x1dc704['VoiceQueueId'];this['CampaignId']=_0x1dc704[_0x0c0c('0x28')];this[_0x0c0c('0x29')]=_0x1dc704['originatecalleridnum']||'';this[_0x0c0c('0x2a')]=_0x1dc704[_0x0c0c('0x2a')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 6bf9dd0..aaabece 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 _0x16d5=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x37cc43,_0x4598ef){var _0x52843b=function(_0x482c8a){while(--_0x482c8a){_0x37cc43['push'](_0x37cc43['shift']());}};_0x52843b(++_0x4598ef);}(_0x16d5,0x151));var _0x516d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x16d5[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x516d('0x0'));var _=require(_0x516d('0x1'));var moment=require(_0x516d('0x2'));function getSeconds(_0x1c1276,_0x1eef5f){var _0x4b80d8=moment(_0x1c1276)[_0x516d('0x3')](0x0);var _0x278b7c=moment(_0x1eef5f)['milliseconds'](0x0);return _0x4b80d8[_0x516d('0x4')](_0x278b7c,_0x516d('0x5'));}function Final(_0x494458){this['uniqueid']=_0x494458[_0x516d('0x6')];this['scheduledat']=_0x494458['scheduledat'];this[_0x516d('0x7')]=_0x494458[_0x516d('0x7')];this[_0x516d('0x8')]=_0x494458[_0x516d('0x7')]===_0x516d('0x9')?'queue':_0x494458[_0x516d('0x7')];this['countbusyretry']=_0x494458[_0x516d('0xa')];this[_0x516d('0xb')]=_0x494458['countcongestionretry'];this[_0x516d('0xc')]=_0x494458[_0x516d('0xc')];this[_0x516d('0xd')]=_0x494458[_0x516d('0xa')]+_0x494458['countcongestionretry']+_0x494458[_0x516d('0xc')]+_0x494458[_0x516d('0xe')]+_0x494458[_0x516d('0xf')]+_0x494458[_0x516d('0x10')]+_0x494458[_0x516d('0x11')]+_0x494458[_0x516d('0x12')];this['countnosuchnumberretry']=_0x494458['countnosuchnumberretry'];this[_0x516d('0xf')]=_0x494458[_0x516d('0xf')];this[_0x516d('0x10')]=_0x494458[_0x516d('0x10')];this[_0x516d('0x11')]=_0x494458[_0x516d('0x11')];this[_0x516d('0x12')]=_0x494458['countagentrejectretry'];this[_0x516d('0x13')]=_0x494458[_0x516d('0x13')];this['calleridname']=_0x494458[_0x516d('0x14')];this[_0x516d('0x15')]=_0x494458['calleridnum'];this[_0x516d('0x16')]=_0x494458[_0x516d('0x16')];this['responsetime']=_0x494458[_0x516d('0x17')];this[_0x516d('0x18')]=_0x494458[_0x516d('0x17')];this[_0x516d('0x19')]=_0x494458[_0x516d('0x19')]||0x0;this[_0x516d('0x1a')]=_0x494458['holdtime']||0x0;this[_0x516d('0x1b')]=_0x494458[_0x516d('0x1b')]||0x0;this[_0x516d('0x1c')]=_0x494458['callback'];this[_0x516d('0x1d')]=_0x494458['callbackuniqueid'];this['callbackat']=_0x494458['callbackat'];this[_0x516d('0x1e')]=_0x494458[_0x516d('0x1e')];this[_0x516d('0x1f')]=_0x494458[_0x516d('0x1f')];this[_0x516d('0x20')]=_0x494458[_0x516d('0x20')];this[_0x516d('0x21')]=_0x494458[_0x516d('0x21')];this[_0x516d('0x22')]=_0x494458[_0x516d('0x22')];this[_0x516d('0x23')]=_0x494458['CampaignId'];this[_0x516d('0x24')]=_0x494458[_0x516d('0x24')]||'';this[_0x516d('0x25')]=_0x494458[_0x516d('0x25')]||'';}module[_0x516d('0x26')]=Final; \ No newline at end of file +var _0x6df2=['responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','seconds','uniqueid','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','queue','calleridname','calleridnum','starttime'];(function(_0x4264bf,_0x39db0f){var _0x515e5f=function(_0x130168){while(--_0x130168){_0x4264bf['push'](_0x4264bf['shift']());}};_0x515e5f(++_0x39db0f);}(_0x6df2,0x1cb));var _0x26df=function(_0x4c65f8,_0xc16b81){_0x4c65f8=_0x4c65f8-0x0;var _0x566b21=_0x6df2[_0x4c65f8];return _0x566b21;};'use strict';var util=require('util');var _=require(_0x26df('0x0'));var moment=require(_0x26df('0x1'));function getSeconds(_0x280ae8,_0x3cfd75){var _0x534b5c=moment(_0x280ae8)[_0x26df('0x2')](0x0);var _0x30d007=moment(_0x3cfd75)['milliseconds'](0x0);return _0x534b5c[_0x26df('0x3')](_0x30d007,_0x26df('0x4'));}function Final(_0xf12fcc){this[_0x26df('0x5')]=_0xf12fcc[_0x26df('0x5')];this['scheduledat']=_0xf12fcc['scheduledat'];this[_0x26df('0x6')]=_0xf12fcc['type'];this[_0x26df('0x7')]=_0xf12fcc[_0x26df('0x6')]===_0x26df('0x8')?'queue':_0xf12fcc[_0x26df('0x6')];this[_0x26df('0x9')]=_0xf12fcc[_0x26df('0x9')];this[_0x26df('0xa')]=_0xf12fcc[_0x26df('0xa')];this['countnoanswerretry']=_0xf12fcc[_0x26df('0xb')];this[_0x26df('0xc')]=_0xf12fcc[_0x26df('0x9')]+_0xf12fcc['countcongestionretry']+_0xf12fcc[_0x26df('0xb')]+_0xf12fcc['countnosuchnumberretry']+_0xf12fcc['countdropretry']+_0xf12fcc[_0x26df('0xd')]+_0xf12fcc[_0x26df('0xe')]+_0xf12fcc[_0x26df('0xf')];this['countnosuchnumberretry']=_0xf12fcc[_0x26df('0x10')];this['countdropretry']=_0xf12fcc[_0x26df('0x11')];this[_0x26df('0xd')]=_0xf12fcc['countabandonedretry'];this[_0x26df('0xe')]=_0xf12fcc[_0x26df('0xe')];this[_0x26df('0xf')]=_0xf12fcc[_0x26df('0xf')];this[_0x26df('0x12')]=_0xf12fcc[_0x26df('0x12')];this[_0x26df('0x13')]=_0xf12fcc[_0x26df('0x13')];this[_0x26df('0x14')]=_0xf12fcc[_0x26df('0x14')];this[_0x26df('0x15')]=_0xf12fcc[_0x26df('0x15')];this[_0x26df('0x16')]=_0xf12fcc[_0x26df('0x16')];this[_0x26df('0x17')]=_0xf12fcc['responsetime'];this[_0x26df('0x18')]=_0xf12fcc[_0x26df('0x18')]||0x0;this['holdtime']=_0xf12fcc[_0x26df('0x19')]||0x0;this[_0x26df('0x1a')]=_0xf12fcc['talktime']||0x0;this[_0x26df('0x1b')]=_0xf12fcc['callback'];this[_0x26df('0x1c')]=_0xf12fcc[_0x26df('0x1c')];this['callbackat']=_0xf12fcc['callbackat'];this[_0x26df('0x1d')]=_0xf12fcc[_0x26df('0x1d')];this[_0x26df('0x1e')]=_0xf12fcc[_0x26df('0x1e')];this['ListId']=_0xf12fcc[_0x26df('0x1f')];this[_0x26df('0x20')]=_0xf12fcc[_0x26df('0x20')];this[_0x26df('0x21')]=_0xf12fcc['VoiceQueueId'];this[_0x26df('0x22')]=_0xf12fcc['CampaignId'];this[_0x26df('0x23')]=_0xf12fcc[_0x26df('0x23')]||'';this['originatecalleridname']=_0xf12fcc[_0x26df('0x24')]||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 86f7da4..b362edb 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 _0x888e=['calleridnum','number','starttime','responsetime','endtime','format','ringtime','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','uniqueid','calleridname','name'];(function(_0xb8dcd7,_0x5d832b){var _0x121a74=function(_0x5af714){while(--_0x5af714){_0xb8dcd7['push'](_0xb8dcd7['shift']());}};_0x121a74(++_0x5d832b);}(_0x888e,0x97));var _0xe888=function(_0x1123ab,_0x57be3c){_0x1123ab=_0x1123ab-0x0;var _0x26ccbf=_0x888e[_0x1123ab];return _0x26ccbf;};'use strict';var util=require(_0xe888('0x0'));var _=require(_0xe888('0x1'));var moment=require('moment');function getSeconds(_0x28a433,_0x5cc2f8){var _0x3907b5=moment(_0x28a433)[_0xe888('0x2')](0x0);var _0x2a0c2d=moment(_0x5cc2f8)[_0xe888('0x2')](0x0);return _0x3907b5['diff'](_0x2a0c2d,_0xe888('0x3'));}function Hangup(_0x304885,_0x1a5585){this[_0xe888('0x4')]=0x4;this[_0xe888('0x5')]=_0xe888('0x6');this[_0xe888('0x7')]=_0x304885[_0xe888('0x7')];this[_0xe888('0x8')]=_0x304885[_0xe888('0x8')];this['campaigntype']=_0x304885[_0xe888('0x8')]==='outbound'?_0xe888('0x9'):_0x304885[_0xe888('0x8')];this[_0xe888('0xa')]=_0x304885[_0xe888('0xa')];this['countcongestionretry']=_0x304885[_0xe888('0xb')];this[_0xe888('0xc')]=_0x304885[_0xe888('0xc')];this['countglobal']=_0x304885[_0xe888('0xa')]+_0x304885[_0xe888('0xb')]+_0x304885[_0xe888('0xc')]+_0x304885[_0xe888('0xd')]+_0x304885['countdropretry']+_0x304885[_0xe888('0xe')]+_0x304885['countmachineretry']+_0x304885[_0xe888('0xf')];this[_0xe888('0xd')]=_0x304885['countnosuchnumberretry'];this[_0xe888('0x10')]=_0x304885[_0xe888('0x10')];this[_0xe888('0xe')]=_0x304885[_0xe888('0xe')];this[_0xe888('0x11')]=_0x304885['countmachineretry'];this['countagentrejectretry']=_0x304885['countagentrejectretry'];this[_0xe888('0x12')]=_0x1a5585['uniqueid'];this[_0xe888('0x13')]=_0x304885[_0xe888('0x14')];this[_0xe888('0x15')]=_0x304885[_0xe888('0x16')];this[_0xe888('0x17')]=_0x304885[_0xe888('0x17')];this[_0xe888('0x18')]=_0x304885[_0xe888('0x18')];this[_0xe888('0x19')]=moment()[_0xe888('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xe888('0x1b')]=getSeconds(_0x304885[_0xe888('0x18')],_0x304885[_0xe888('0x17')]);this[_0xe888('0x1c')]=0x0;this[_0xe888('0x1d')]=getSeconds(this[_0xe888('0x19')],_0x304885[_0xe888('0x18')]);this[_0xe888('0x9')]=_0x304885[_0xe888('0x9')];this[_0xe888('0x1e')]=_0xe888('0x1f');this[_0xe888('0x20')]=_0x1a5585[_0xe888('0x21')];this[_0xe888('0x22')]=_0x304885['callback'];this['callbackuniqueid']=_0x304885['callbackuniqueid'];this[_0xe888('0x23')]=_0x304885[_0xe888('0x23')];this['recallme']=_0x304885[_0xe888('0x24')];this['ContactId']=_0x304885[_0xe888('0x25')];this['ListId']=_0x304885[_0xe888('0x26')];this[_0xe888('0x27')]=_0x304885[_0xe888('0x27')];this[_0xe888('0x28')]=_0x304885['VoiceQueueId'];this[_0xe888('0x29')]=_0x304885['CampaignId'];}module[_0xe888('0x2a')]=Hangup; \ No newline at end of file +var _0x85e3=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','holdtime','talktime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type'];(function(_0x52c0ea,_0x357085){var _0x18b6e1=function(_0x32ab27){while(--_0x32ab27){_0x52c0ea['push'](_0x52c0ea['shift']());}};_0x18b6e1(++_0x357085);}(_0x85e3,0xa7));var _0x385e=function(_0x183a3c,_0xa4cc47){_0x183a3c=_0x183a3c-0x0;var _0x5c41d8=_0x85e3[_0x183a3c];return _0x5c41d8;};'use strict';var util=require(_0x385e('0x0'));var _=require('lodash');var moment=require(_0x385e('0x1'));function getSeconds(_0x1de638,_0x4a70a6){var _0x5083ea=moment(_0x1de638)[_0x385e('0x2')](0x0);var _0x13992d=moment(_0x4a70a6)[_0x385e('0x2')](0x0);return _0x5083ea[_0x385e('0x3')](_0x13992d,_0x385e('0x4'));}function Hangup(_0x4c5b96,_0x229940){this[_0x385e('0x5')]=0x4;this[_0x385e('0x6')]='Answer';this['scheduledat']=_0x4c5b96[_0x385e('0x7')];this[_0x385e('0x8')]=_0x4c5b96[_0x385e('0x8')];this[_0x385e('0x9')]=_0x4c5b96['type']===_0x385e('0xa')?_0x385e('0xb'):_0x4c5b96[_0x385e('0x8')];this[_0x385e('0xc')]=_0x4c5b96['countbusyretry'];this['countcongestionretry']=_0x4c5b96[_0x385e('0xd')];this['countnoanswerretry']=_0x4c5b96[_0x385e('0xe')];this[_0x385e('0xf')]=_0x4c5b96[_0x385e('0xc')]+_0x4c5b96[_0x385e('0xd')]+_0x4c5b96['countnoanswerretry']+_0x4c5b96['countnosuchnumberretry']+_0x4c5b96[_0x385e('0x10')]+_0x4c5b96[_0x385e('0x11')]+_0x4c5b96[_0x385e('0x12')]+_0x4c5b96['countagentrejectretry'];this[_0x385e('0x13')]=_0x4c5b96[_0x385e('0x13')];this[_0x385e('0x10')]=_0x4c5b96[_0x385e('0x10')];this[_0x385e('0x11')]=_0x4c5b96['countabandonedretry'];this['countmachineretry']=_0x4c5b96[_0x385e('0x12')];this[_0x385e('0x14')]=_0x4c5b96['countagentrejectretry'];this[_0x385e('0x15')]=_0x229940[_0x385e('0x15')];this[_0x385e('0x16')]=_0x4c5b96[_0x385e('0x17')];this[_0x385e('0x18')]=_0x4c5b96[_0x385e('0x19')];this[_0x385e('0x1a')]=_0x4c5b96[_0x385e('0x1a')];this['responsetime']=_0x4c5b96[_0x385e('0x1b')];this[_0x385e('0x1c')]=moment()[_0x385e('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=getSeconds(_0x4c5b96[_0x385e('0x1b')],_0x4c5b96[_0x385e('0x1a')]);this[_0x385e('0x1e')]=0x0;this[_0x385e('0x1f')]=getSeconds(this[_0x385e('0x1c')],_0x4c5b96[_0x385e('0x1b')]);this[_0x385e('0xb')]=_0x4c5b96['queue'];this[_0x385e('0x20')]=_0x385e('0x21');this['reason']=_0x229940[_0x385e('0x22')];this[_0x385e('0x23')]=_0x4c5b96[_0x385e('0x23')];this[_0x385e('0x24')]=_0x4c5b96[_0x385e('0x24')];this[_0x385e('0x25')]=_0x4c5b96['callbackat'];this[_0x385e('0x26')]=_0x4c5b96[_0x385e('0x26')];this[_0x385e('0x27')]=_0x4c5b96[_0x385e('0x27')];this[_0x385e('0x28')]=_0x4c5b96[_0x385e('0x28')];this[_0x385e('0x29')]=_0x4c5b96[_0x385e('0x29')];this[_0x385e('0x2a')]=_0x4c5b96[_0x385e('0x2a')];this[_0x385e('0x2b')]=_0x4c5b96[_0x385e('0x2b')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index a4dbbcd..e6f2b08 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 _0x80bf=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','calleridnum','number','starttime','endtime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x80bf,0x148));var _0xf80b=function(_0x4b3dbd,_0x2ce11e){_0x4b3dbd=_0x4b3dbd-0x0;var _0xa1d42c=_0x80bf[_0x4b3dbd];return _0xa1d42c;};'use strict';var util=require(_0xf80b('0x0'));var _=require(_0xf80b('0x1'));var moment=require('moment');function getSeconds(_0x3a92cf,_0x3534df){var _0x47fce7=moment(_0x3a92cf)[_0xf80b('0x2')](0x0);var _0x486f2f=moment(_0x3534df)[_0xf80b('0x2')](0x0);return _0x47fce7['diff'](_0x486f2f,_0xf80b('0x3'));}function History(_0x285862){this['uniqueid']=_0x285862['uniqueid'];this[_0xf80b('0x4')]=_0x285862['scheduledat']||undefined;this[_0xf80b('0x5')]=_0x285862[_0xf80b('0x5')];this[_0xf80b('0x6')]=_0x285862[_0xf80b('0x5')]===_0xf80b('0x7')?_0xf80b('0x8'):_0x285862[_0xf80b('0x5')];this[_0xf80b('0x9')]=_0x285862['countbusyretry'];this['countcongestionretry']=_0x285862[_0xf80b('0xa')];this[_0xf80b('0xb')]=_0x285862['countnoanswerretry'];this[_0xf80b('0xc')]=_0x285862[_0xf80b('0x9')]+_0x285862[_0xf80b('0xa')]+_0x285862[_0xf80b('0xb')]+_0x285862['countnosuchnumberretry']+_0x285862[_0xf80b('0xd')]+_0x285862[_0xf80b('0xe')]+_0x285862['countmachineretry']+_0x285862[_0xf80b('0xf')];this[_0xf80b('0x10')]=_0x285862['countnosuchnumberretry'];this[_0xf80b('0xd')]=_0x285862[_0xf80b('0xd')];this['countabandonedretry']=_0x285862[_0xf80b('0xe')];this[_0xf80b('0x11')]=_0x285862[_0xf80b('0x11')];this[_0xf80b('0xf')]=_0x285862[_0xf80b('0xf')];this[_0xf80b('0x8')]=_0x285862[_0xf80b('0x8')];this['calleridname']=_0x285862['name'];this[_0xf80b('0x12')]=_0x285862[_0xf80b('0x13')];this['starttime']=_0x285862[_0xf80b('0x14')];this['responsetime']=_0x285862['responsetime'];this[_0xf80b('0x15')]=_0x285862[_0xf80b('0x16')];this[_0xf80b('0x17')]=getSeconds(_0x285862[_0xf80b('0x16')],_0x285862[_0xf80b('0x14')]);this[_0xf80b('0x18')]=0x0;this[_0xf80b('0x19')]=0x0;this[_0xf80b('0x1a')]=_0x285862[_0xf80b('0x1a')];this[_0xf80b('0x1b')]=_0x285862[_0xf80b('0x1b')];this[_0xf80b('0x1c')]=_0x285862[_0xf80b('0x1c')];this['recallme']=_0x285862[_0xf80b('0x1d')];this['ContactId']=_0x285862['ContactId'];this[_0xf80b('0x1e')]=_0x285862[_0xf80b('0x1e')];this[_0xf80b('0x1f')]=_0x285862[_0xf80b('0x1f')];this[_0xf80b('0x20')]=_0x285862[_0xf80b('0x20')];this[_0xf80b('0x21')]=_0x285862[_0xf80b('0x21')];this[_0xf80b('0x22')]=_0x285862['originatecalleridnum']||'';this[_0xf80b('0x23')]=_0x285862[_0xf80b('0x23')]||'';}module['exports']=History; \ No newline at end of file +var _0xe700=['calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry'];(function(_0x99fe35,_0x1588ed){var _0x2a4c77=function(_0x434e24){while(--_0x434e24){_0x99fe35['push'](_0x99fe35['shift']());}};_0x2a4c77(++_0x1588ed);}(_0xe700,0xf7));var _0x0e70=function(_0x311287,_0x1f0bac){_0x311287=_0x311287-0x0;var _0x4ff4fe=_0xe700[_0x311287];return _0x4ff4fe;};'use strict';var util=require(_0x0e70('0x0'));var _=require(_0x0e70('0x1'));var moment=require(_0x0e70('0x2'));function getSeconds(_0x5c0365,_0x228c73){var _0x534ac5=moment(_0x5c0365)['milliseconds'](0x0);var _0xbbd7c8=moment(_0x228c73)[_0x0e70('0x3')](0x0);return _0x534ac5[_0x0e70('0x4')](_0xbbd7c8,'seconds');}function History(_0x311c1c){this[_0x0e70('0x5')]=_0x311c1c[_0x0e70('0x5')];this[_0x0e70('0x6')]=_0x311c1c[_0x0e70('0x6')]||undefined;this[_0x0e70('0x7')]=_0x311c1c[_0x0e70('0x7')];this[_0x0e70('0x8')]=_0x311c1c[_0x0e70('0x7')]===_0x0e70('0x9')?_0x0e70('0xa'):_0x311c1c[_0x0e70('0x7')];this[_0x0e70('0xb')]=_0x311c1c[_0x0e70('0xb')];this[_0x0e70('0xc')]=_0x311c1c[_0x0e70('0xc')];this['countnoanswerretry']=_0x311c1c['countnoanswerretry'];this[_0x0e70('0xd')]=_0x311c1c['countbusyretry']+_0x311c1c[_0x0e70('0xc')]+_0x311c1c['countnoanswerretry']+_0x311c1c[_0x0e70('0xe')]+_0x311c1c[_0x0e70('0xf')]+_0x311c1c['countabandonedretry']+_0x311c1c[_0x0e70('0x10')]+_0x311c1c[_0x0e70('0x11')];this['countnosuchnumberretry']=_0x311c1c[_0x0e70('0xe')];this[_0x0e70('0xf')]=_0x311c1c[_0x0e70('0xf')];this['countabandonedretry']=_0x311c1c[_0x0e70('0x12')];this[_0x0e70('0x10')]=_0x311c1c['countmachineretry'];this['countagentrejectretry']=_0x311c1c[_0x0e70('0x11')];this['queue']=_0x311c1c['queue'];this[_0x0e70('0x13')]=_0x311c1c[_0x0e70('0x14')];this[_0x0e70('0x15')]=_0x311c1c['number'];this[_0x0e70('0x16')]=_0x311c1c['starttime'];this[_0x0e70('0x17')]=_0x311c1c[_0x0e70('0x17')];this[_0x0e70('0x18')]=_0x311c1c[_0x0e70('0x17')];this[_0x0e70('0x19')]=getSeconds(_0x311c1c['responsetime'],_0x311c1c[_0x0e70('0x16')]);this[_0x0e70('0x1a')]=0x0;this['talktime']=0x0;this[_0x0e70('0x1b')]=_0x311c1c['callback'];this['callbackuniqueid']=_0x311c1c['callbackuniqueid'];this[_0x0e70('0x1c')]=_0x311c1c[_0x0e70('0x1c')];this[_0x0e70('0x1d')]=_0x311c1c[_0x0e70('0x1d')];this[_0x0e70('0x1e')]=_0x311c1c['ContactId'];this[_0x0e70('0x1f')]=_0x311c1c['ListId'];this[_0x0e70('0x20')]=_0x311c1c[_0x0e70('0x20')];this[_0x0e70('0x21')]=_0x311c1c[_0x0e70('0x21')];this['CampaignId']=_0x311c1c[_0x0e70('0x22')];this['originatecalleridnum']=_0x311c1c[_0x0e70('0x23')]||'';this['originatecalleridname']=_0x311c1c[_0x0e70('0x24')]||'';}module[_0x0e70('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 9c966e7..a9c0890 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 _0x6833=['[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','NoSuchNumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','dialBusyMaxRetry','reason\x205\x20busy','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','predictiveIntervalPauses','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','voicePause','log','Contact\x20updated','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','temp','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[getContactCampaign2]','dialLimitQueue','pTalking','not_inuse','reachable','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','RUNNING','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','Umin\x20=\x20','util','bluebird','md5','../../../config/logger','dialer','booked','predictive','syncQueueSummary','redis','defaults','localhost','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./action','./history','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','custom:queuesummary','hangup','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','outbound','strategy','answered','available','loggedIn','sumBillable','sumDuration','total','type','unmanaged','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','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\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\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','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','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','hasOwnProperty','originated','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','talking','waiting','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','starttime','clearZombieChannels','[uniqueid]','[actions]','enqueue','isNil','Action','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','pick','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','active','SIP/%s','status','unmonitored','saveInDb','uniqueid','variable','exten','value','HANGUP','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','minutes','YYYY-MM-DD\x20HH:mm:ss','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','Machine','amd','createStateFinal','dialMachineRetryFrequency','[rescheduleContact][Machine]','syncHangup','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','syncAgentComplete','reason','agent','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','dialQueueProject2','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','endtime','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','calleridname','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','push','idHopper','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','queueStatusComplete','preview','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncCampaigns','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','iftime\x20%s,%s','interval','content','indexOf','true','command','all','GLOBAL_INTERVAL_IS_OVERTIME','Global:\x20','Timezone:\x20','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','checkIsTrunkReachable','checkIfTime','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','phone','Contact','originate','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','xcally-motion-dialer','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','tags','updatedAt','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','substring','TrunkBackup','dialCutDigit','from-sip','OriginateError','[originate][error]','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency'];(function(_0x59e821,_0x86c723){var _0x5333f6=function(_0x5dc2c9){while(--_0x5dc2c9){_0x59e821['push'](_0x59e821['shift']());}};_0x5333f6(++_0x86c723);}(_0x6833,0x7e));var _0x3683=function(_0x191f72,_0x5b98c6){_0x191f72=_0x191f72-0x0;var _0x538636=_0x6833[_0x191f72];return _0x538636;};'use strict';var util=require(_0x3683('0x0'));var _=require('lodash');var BPromise=require(_0x3683('0x1'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var md5=require(_0x3683('0x2'));var Redis=require('ioredis');var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0x3683('0x3'))(_0x3683('0x4'));var loggerBooked=require(_0x3683('0x3'))(_0x3683('0x5'));var loggerPredictive=require(_0x3683('0x3'))(_0x3683('0x6'));var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require(_0x3683('0x3'))(_0x3683('0x7'));var ami=require('../ami');config[_0x3683('0x8')]=_[_0x3683('0x9')](config[_0x3683('0x8')],{'host':_0x3683('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require(_0x3683('0xb'));var cmHopperFinal=require(_0x3683('0xc'));var cmHopperHistory=require(_0x3683('0xd'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x3683('0xe'));var Action=require(_0x3683('0xf'));var History=require(_0x3683('0x10'));var Final=require('./final');var AgentComplete=require(_0x3683('0x11'));var QueueCallerAbandon=require(_0x3683('0x12'));var Hangup=require(_0x3683('0x13'));var ipAgi=process[_0x3683('0x14')][_0x3683('0x15')]||_0x3683('0x16');var strategy={'rrmemory':_0x3683('0x17'),'roundrobin':_0x3683('0x18')};var Sequence=function(){};Sequence[_0x3683('0x19')]['enqueue']=function(_0xb7e7c3){this[_0x3683('0x1a')]=this[_0x3683('0x1a')]?this['tail'][_0x3683('0x1b')](_0xb7e7c3):_0xb7e7c3();};function Dialer(_0x59796c,_0x3fb1ff){this[_0x3683('0x1c')]=new Sequence();this['preview']=_0x3fb1ff;this['voiceQueues']=_0x59796c[_0x3683('0x1d')];this[_0x3683('0x1e')]=_0x59796c[_0x3683('0x1e')];this[_0x3683('0x1f')]=_0x59796c['agents'];this[_0x3683('0x20')]=_0x59796c[_0x3683('0x20')];this[_0x3683('0x21')]=config['maxNumberOriginate']||0x2;this[_0x3683('0x22')]={};this[_0x3683('0x23')]={};this[_0x3683('0x24')]={};this[_0x3683('0x25')]={};this[_0x3683('0x26')]={};this['startPredictive']={};this['startProgressive']={};this[_0x3683('0x27')]={};this[_0x3683('0x28')]={};this[_0x3683('0x29')]={};ami['on'](_0x3683('0x2a'),this['syncAgentConnect'][_0x3683('0x2b')](this));ami['on'](_0x3683('0x2c'),this[_0x3683('0x2d')]['bind'](this));ami['on'](_0x3683('0x2e'),this[_0x3683('0x2f')][_0x3683('0x2b')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0x3683('0x2b')](this));ami['on'](_0x3683('0x30'),this['syncQueueSummary']['bind'](this));ami['on'](_0x3683('0x31'),this['syncHangup'][_0x3683('0x2b')](this));ami['on']('newexten',this[_0x3683('0x32')][_0x3683('0x2b')](this));ami['on'](_0x3683('0x33'),this[_0x3683('0x34')][_0x3683('0x2b')](this));ami['on'](_0x3683('0x35'),this[_0x3683('0x36')][_0x3683('0x2b')](this));ami['on'](_0x3683('0x37'),this[_0x3683('0x38')][_0x3683('0x2b')](this));this[_0x3683('0x39')]();this[_0x3683('0x3a')]();}function isNotNull(_0x44bb2c){return _0x44bb2c!==null&&!_[_0x3683('0x3b')](_0x44bb2c);}function checkIsLoggedIn(_0x17e633,_0x5df6cc){return function(){if(_0x5df6cc<=0x0){_0x17e633['message']=_0x3683('0x3c');throw _0x17e633[_0x3683('0x3d')]+_0x3683('0x3e');}};}function isActive(_0x232548){return _0x232548;}function checkIsActive(_0x5be46c,_0x56e931){return function(){if(!isActive(_0x56e931)){_0x5be46c[_0x3683('0x3f')]=_0x3683('0x40');throw _0x5be46c[_0x3683('0x3d')]+_0x3683('0x41');}};}function checkInterval(_0x34656d){return function(){if(!isNotNull(_0x34656d[_0x3683('0x42')])){_0x34656d['message']=_0x3683('0x43');throw _0x34656d[_0x3683('0x3d')]+_0x3683('0x44');}if(!isNotNull(_0x34656d[_0x3683('0x42')][_0x3683('0x45')])){_0x34656d['message']='INTERVAL_IS_NULL';throw _0x34656d[_0x3683('0x3d')]+_0x3683('0x44');}if(!isNotNull(_[_0x3683('0x46')](_0x34656d[_0x3683('0x42')][_0x3683('0x45')]))){_0x34656d['message']=_0x3683('0x43');throw _0x34656d[_0x3683('0x3d')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x353cb7,_0x325c6d,_0x55d26b){return{'action':_0x353cb7,'response':_0x325c6d,'message':_0x55d26b,'stack':_0x55d26b};}function myreject(_0x24745f){return function(_0x25520e){return _0x24745f(msgResponse(_0x3683('0x47'),_0x3683('0x48'),JSON[_0x3683('0x49')](_0x25520e)));};}function getSeconds(_0x315336,_0x5741af){var _0x5c682c=moment(_0x315336)[_0x3683('0x4a')](0x0);var _0x3503cc=moment(_0x5741af)[_0x3683('0x4a')](0x0);return _0x5c682c[_0x3683('0x4b')](_0x3503cc,_0x3683('0x4c'));}function emit(_0x133a81,_0x1f07e1,_0x5b7d04){io['to'](_0x133a81)[_0x3683('0x4d')](_0x1f07e1,_0x5b7d04);}function emitVoiceQueueSummary(_0x4d3a42){if(_0x4d3a42['type']===_0x3683('0x4e')){var _0x2e9e20={'id':_0x4d3a42['id'],'name':_0x4d3a42[_0x3683('0x3d')],'strategy':_0x4d3a42[_0x3683('0x4f')],'answered':_0x4d3a42[_0x3683('0x50')],'available':_0x4d3a42[_0x3683('0x51')],'loggedIn':_0x4d3a42[_0x3683('0x52')],'pTalking':_0x4d3a42['pTalking'],'sumBillable':_0x4d3a42[_0x3683('0x53')],'sumDuration':_0x4d3a42[_0x3683('0x54')],'sumHoldTime':_0x4d3a42['sumHoldTime']||0x0,'talking':_0x4d3a42['talking'],'total':_0x4d3a42[_0x3683('0x55')],'type':_0x4d3a42[_0x3683('0x56')],'unmanaged':_0x4d3a42[_0x3683('0x57')],'abandoned':_0x4d3a42['abandoned'],'waiting':_0x4d3a42['waiting'],'loggedInDb':_0x4d3a42[_0x3683('0x58')],'dialActive':_0x4d3a42[_0x3683('0x59')],'dialMethod':_0x4d3a42[_0x3683('0x5a')],'dialOriginateCallerIdName':_0x4d3a42['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x4d3a42[_0x3683('0x5b')],'dialOriginateTimeout':_0x4d3a42[_0x3683('0x5c')],'dialPrefix':_0x4d3a42['dialPrefix'],'outboundAnswerAgiCallsDay':_0x4d3a42[_0x3683('0x5d')],'outboundAnswerCallsDay':_0x4d3a42[_0x3683('0x5e')],'outboundBlacklistCallsDay':_0x4d3a42[_0x3683('0x5f')],'outboundBusyCallsDay':_0x4d3a42[_0x3683('0x60')],'outboundCongestionCallsDay':_0x4d3a42[_0x3683('0x61')],'outboundDropCallsDayACS':_0x4d3a42[_0x3683('0x62')],'outboundDropCallsDayCallersExit':_0x4d3a42[_0x3683('0x63')],'outboundDropCallsDayTimeout':_0x4d3a42['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x4d3a42[_0x3683('0x64')],'outboundNoSuchCallsDay':_0x4d3a42[_0x3683('0x65')],'outboundOriginateFailureCallsDay':_0x4d3a42[_0x3683('0x66')],'outboundReCallsDay':_0x4d3a42[_0x3683('0x67')],'outboundRejectCallsDay':_0x4d3a42[_0x3683('0x68')],'outboundUnknownCallsDay':_0x4d3a42[_0x3683('0x69')],'predictiveIntervalAnsweredCalls':_0x4d3a42[_0x3683('0x6a')],'predictiveIntervalAvgHoldtime':_0x4d3a42[_0x3683('0x6b')],'predictiveIntervalAvgTalktime':_0x4d3a42[_0x3683('0x6c')],'predictiveIntervalDroppedCallsCallersExit':_0x4d3a42['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x4d3a42[_0x3683('0x6d')],'predictiveIntervalErlangCalls':_0x4d3a42[_0x3683('0x6e')],'predictiveIntervalErlangCallsDroppedCalls':_0x4d3a42[_0x3683('0x6f')],'predictiveIntervalHitRate':_0x4d3a42[_0x3683('0x70')],'predictiveIntervalMultiplicativeFactor':_0x4d3a42[_0x3683('0x71')],'predictiveIntervalPauses':_0x4d3a42['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x4d3a42[_0x3683('0x72')],'predictiveIntervalTotalCalls':_0x4d3a42[_0x3683('0x73')],'message':_0x4d3a42['message'],'originated':_0x4d3a42['originated'],'erlangCalls':_0x4d3a42[_0x3683('0x74')],'erlangCallToSecond':_0x4d3a42[_0x3683('0x75')],'erlangAbandonmentRate':_0x4d3a42[_0x3683('0x76')],'erlangBusyFactor':_0x4d3a42[_0x3683('0x77')],'startPredictive':_0x4d3a42[_0x3683('0x78')],'startProgressive':_0x4d3a42[_0x3683('0x79')]};if(_0x4d3a42[_0x3683('0x7a')]){_0x2e9e20[_0x3683('0x7a')]={'id':_0x4d3a42[_0x3683('0x7a')]['id'],'name':_0x4d3a42[_0x3683('0x7a')][_0x3683('0x3d')],'active':_0x4d3a42[_0x3683('0x7a')]['active'],'callerid':_0x4d3a42['Trunk']['callerid']};}if(_0x4d3a42['Interval']){_0x2e9e20[_0x3683('0x42')]={'id':_0x4d3a42[_0x3683('0x42')]['id'],'name':_0x4d3a42[_0x3683('0x42')][_0x3683('0x3d')]};}var _0x546eae=md5(JSON[_0x3683('0x49')](_0x2e9e20));if(_0x4d3a42['md5']!==_0x546eae){_0x4d3a42[_0x3683('0x2')]=_0x546eae;emit(util[_0x3683('0x7b')](_0x3683('0x7c'),_0x2e9e20[_0x3683('0x3d')]),_0x3683('0x7d'),_0x2e9e20);}}}function emitCampaignSummary(_0x2f2cb0){if(_0x2f2cb0['type']===_0x3683('0x7e')){emit(util[_0x3683('0x7b')](_0x3683('0x7f'),_0x2f2cb0[_0x3683('0x3d')]),_0x3683('0x80'),_0x2f2cb0);}}function checkGetDataPredictive(_0x365d58){if(isNotNull(_0x365d58)){if(!_[_0x3683('0x46')](_0x365d58)){loggerPredictive[_0x3683('0x81')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x3683('0x81')](_0x3683('0x82'),_0x365d58[_0x3683('0x73')]);loggerPredictive['info'](_0x3683('0x83'),_0x365d58[_0x3683('0x6a')]);loggerPredictive[_0x3683('0x81')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x365d58[_0x3683('0x6d')]);loggerPredictive[_0x3683('0x81')](_0x3683('0x84'),_0x365d58[_0x3683('0x85')]);loggerPredictive[_0x3683('0x81')](_0x3683('0x86'),_0x365d58[_0x3683('0x6b')]);loggerPredictive[_0x3683('0x81')](_0x3683('0x87'),_0x365d58[_0x3683('0x6c')]);loggerPredictive[_0x3683('0x81')](_0x3683('0x88'));if(_0x365d58[_0x3683('0x73')]>0x0){if(!_[_0x3683('0x3b')](_0x365d58[_0x3683('0x6c')])&&_0x365d58['predictiveIntervalAvgTalktime']>0x0){return!![];}else{loggerPredictive[_0x3683('0x81')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}if(!_[_0x3683('0x3b')](_0x365d58[_0x3683('0x6b')])&&_0x365d58[_0x3683('0x6b')]>0x0){return!![];}else{loggerPredictive['info'](_0x3683('0x89'));}}else{loggerPredictive['info'](_0x3683('0x8a'));}}else{loggerPredictive[_0x3683('0x81')](_0x3683('0x8b'));}}else{loggerPredictive[_0x3683('0x81')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x54187d){return function(_0x207218){loggerPredictive[_0x3683('0x81')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x3683('0x81')](_0x3683('0x8c'),_0x207218[_0x3683('0x74')]);loggerPredictive[_0x3683('0x81')](_0x3683('0x8d'),_0x207218[_0x3683('0x75')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x207218[_0x3683('0x76')]);loggerPredictive[_0x3683('0x81')](_0x3683('0x8e'),_0x207218[_0x3683('0x77')]);loggerPredictive[_0x3683('0x81')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x207218[_0x3683('0x76')]);loggerPredictive[_0x3683('0x81')](_0x3683('0x88'));_[_0x3683('0x8f')](_0x54187d,_0x207218);};}function getDiff(_0x331b11){var _0x3a1d6e=moment()['milliseconds'](0x0);var _0x2e05fe=moment(_0x331b11)[_0x3683('0x4a')](0x0);return _0x3a1d6e['diff'](_0x2e05fe,_0x3683('0x4c'));}function ifInterval(_0x74f561,_0x320b38){if(_['isUndefined'](_0x320b38)){return![];}if(getDiff(_0x320b38)<_0x74f561*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x4879bc){if(isNotNull(_0x4879bc)){if(!_['isUndefined'](_0x4879bc['startProgressive'])){_0x4879bc['startProgressive']=undefined;loggerPredictive['info'](_0x4879bc[_0x3683('0x3d')],_0x3683('0x90'));}if(!_[_0x3683('0x3b')](_0x4879bc[_0x3683('0x78')])){_0x4879bc[_0x3683('0x78')]=undefined;loggerPredictive[_0x3683('0x81')](_0x4879bc[_0x3683('0x3d')],_0x3683('0x91'));}if(!_[_0x3683('0x3b')](_0x4879bc[_0x3683('0x92')])){clearInterval(_0x4879bc[_0x3683('0x92')]);_0x4879bc['handlePredictive']=undefined;loggerPredictive[_0x3683('0x81')](_0x4879bc[_0x3683('0x3d')],_0x3683('0x93'));}}}function erlangb(_0x578ce9,_0x8c5bf0){if(_0x8c5bf0===0x0){return 0x0;}var _0x538a77=0x1;for(var _0x3ae54b=0x1;_0x3ae54b<=_0x8c5bf0;_0x3ae54b+=0x1){_0x538a77=0x1+_0x538a77*_0x3ae54b/_0x578ce9;}return 0x1/_0x538a77;}function isVoiceQueueOutbound(_0x23faa7){return _0x23faa7===_0x3683('0x4e');}function isNotPreview(_0x50df93){return _0x50df93!=='preview';}function isCampaignIvr(_0x3528db){return _0x3528db===_0x3683('0x7e');}function getCallerId(_0x56f90c,_0x37045e,_0x1f4750){if(!_[_0x3683('0x3b')](_0x1f4750)&&'string'===typeof _0x1f4750&&!_[_0x3683('0x46')](_0x1f4750)){if(!_[_0x3683('0x3b')](_0x37045e)&&_0x3683('0x94')===typeof _0x37045e&&!_[_0x3683('0x46')](_0x37045e)){return util[_0x3683('0x7b')](_0x3683('0x95'),_0x37045e,_0x1f4750);}return util[_0x3683('0x7b')](_0x3683('0x95'),_0x1f4750,_0x1f4750);}if(!_['isUndefined'](_0x56f90c)&&_0x3683('0x94')===typeof _0x56f90c&&!_[_0x3683('0x46')](_0x56f90c)){return _0x56f90c;}return _0x3683('0x96');}function loggerCatchQueueSummary(_0x50daeb,_0x3b439e){return function(_0x2b05d8){freeVariablesPredictive(_0x3b439e);emitVoiceQueueSummary(_0x3b439e);emitCampaignSummary(_0x3b439e);loggerSyncQueueSummary[_0x3683('0x97')](_0x50daeb,util[_0x3683('0x98')](_0x2b05d8,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0xab0e8b,_0x5a1736){return function(_0x1dee4b){loggerPredictive[_0x3683('0x97')](_0x5a1736[_0x3683('0x3d')],_0xab0e8b);loggerPredictive[_0x3683('0x97')](_0x1dee4b[_0x3683('0x99')]);freeVariablesPredictive(_0x5a1736);};}function loggerCatch(_0x1f3a78){return function(_0x403d23){logger['error'](_0x1f3a78,util['inspect'](_0x403d23,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x15e016){return _0x15e016&&!_[_0x3683('0x3b')](_0x15e016)&&_0x15e016[_0x3683('0x9a')]>0x0;}function decremetOriginate(_0x7ac4b2){if(!_[_0x3683('0x3b')](_0x7ac4b2)&&_0x7ac4b2!==null){if(_0x7ac4b2[_0x3683('0x9b')]('originated')){if(_0x7ac4b2[_0x3683('0x9c')]>0x0){_0x7ac4b2['originated']-=0x1;}else{logger[_0x3683('0x97')](_0x3683('0x9d'));}}}else{logger[_0x3683('0x97')](_0x3683('0x9e'));}}function checkContactLowerLimitOriginate(_0x3f880e,_0x4d1a83,_0xb37754){if(_0x4d1a83>_0xb37754){for(var _0x4c5f56=0x0;_0x4c5f56<_0x4d1a83-_0xb37754;_0x4c5f56+=0x1){decremetOriginate(_0x3f880e);}}}function loggerGetContactDialer(_0x250512,_0x2b4c48,_0xfdc6c5){return function(_0x4e16dd){checkContactLowerLimitOriginate(_0x2b4c48,_0xfdc6c5,0x0);logger[_0x3683('0x97')](_0x250512,util[_0x3683('0x98')](_0x4e16dd,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2b7e36){return function(_0x5a8e13){if(isNotNull(_0x5a8e13)&&isNotNull(_0x5a8e13[0x0])){if(_0x5a8e13[0x0][_0x3683('0x9f')]>0x0){_0x2b7e36[_0x3683('0x3f')]=_0x3683('0xa0');logger[_0x3683('0x81')](_0x3683('0xa1')+_0x2b7e36['name'],_0x5a8e13[0x0][_0x3683('0x9f')],_0x3683('0xa2'));}else{_0x2b7e36[_0x3683('0x3f')]='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0x3683('0xa3')+_0x2b7e36[_0x3683('0x3d')]);}}};}function notSendMessagesQueue(_0x44c21a){if(_0x44c21a['sendMessageOneNotActive']){freeVariablesPredictive(_0x44c21a);if(_0x44c21a[_0x3683('0x9c')]===0x0&&_0x44c21a[_0x3683('0xa4')]===0x0&&_0x44c21a[_0x3683('0xa5')]===0x0&&(_0x44c21a['pTalking']||0x0)===0x0){_0x44c21a[_0x3683('0xa6')]=![];_0x44c21a[_0x3683('0x51')]=0x0;_0x44c21a[_0x3683('0x3f')]=_0x3683('0x40');loggerSyncQueueSummary[_0x3683('0x97')](_0x3683('0xa7'),_0x44c21a[_0x3683('0x3d')],_0x3683('0xa8'));}else{_0x44c21a[_0x3683('0x3f')]=_0x3683('0xa9');loggerSyncQueueSummary[_0x3683('0x97')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x44c21a[_0x3683('0x3d')],_0x3683('0xaa'));}emitVoiceQueueSummary(_0x44c21a);}}function notSendMessagesCampaign(_0x58710e){if(_0x58710e[_0x3683('0xa6')]){if(_0x58710e[_0x3683('0x9c')]===0x0){_0x58710e['sendMessageOneNotActive']=![];_0x58710e[_0x3683('0x3f')]=_0x3683('0x40');loggerSyncQueueSummary[_0x3683('0x97')](_0x3683('0xab'),_0x58710e[_0x3683('0x3d')],_0x3683('0xa8'));}else{_0x58710e[_0x3683('0x3f')]=_0x3683('0xa9');loggerSyncQueueSummary[_0x3683('0x97')](_0x3683('0xab'),_0x58710e[_0x3683('0x3d')],_0x3683('0xaa'));}emitCampaignSummary(_0x58710e);}}function createObjHistory(_0x34d5ab,_0x1c7ca9,_0x18feee,_0x2e5027,_0x4fc54f){_0x34d5ab[_0x3683('0x3f')]=_0x18feee;var _0x3a3980=new Action(_0x34d5ab,_0x1c7ca9);var _0x4855ce=new History(_0x3a3980);_0x4855ce[_0x3683('0xac')]=_0x2e5027;_0x4855ce[_0x3683('0xad')]=_0x4fc54f;_0x4855ce['endtime']=_0x3a3980[_0x3683('0xae')];return _0x4855ce;}Dialer[_0x3683('0x19')][_0x3683('0x3a')]=function(){var _0x110aaa=this;setInterval(function(){_0x110aaa[_0x3683('0xaf')](_0x110aaa[_0x3683('0x25')],_0x3683('0xb0'));_0x110aaa[_0x3683('0xaf')](_0x110aaa[_0x3683('0x23')],_0x3683('0xb1'));},0x32c8);};Dialer['prototype']['clearZombieChannels']=function(_0x180388,_0x3894ca){var _0xe2bccd=this;for(var _0x489306 in _0x180388){if(_0x180388[_0x3683('0x9b')](_0x489306)){this['sequence'][_0x3683('0xb2')](function(){if(!_[_0x3683('0xb3')](_0x180388[_0x489306])){return ami[_0x3683('0xb4')]({'action':'status','channel':_0x180388[_0x489306][_0x3683('0xb5')]})[_0x3683('0xb6')](function(_0x284a3e){if(_0x284a3e['message']===_0x3683('0xb7')){setTimeout(function(){if(_0x180388[_0x489306]&&_0x180388[_0x489306][_0x3683('0x56')]!=='ivr'){_0xe2bccd[_0x3683('0xb8')](_0xe2bccd[_0x3683('0x1d')][_0x180388[_0x489306][_0x3683('0xb9')]]);logger['error'](_0x3683('0xba'),_0x3894ca,_0x489306,_0x180388[_0x489306][_0x3683('0xb9')]);delete _0x180388[_0x489306];}if(_0x180388[_0x489306]&&_0x180388[_0x489306][_0x3683('0x56')]===_0x3683('0x7e')){_0xe2bccd['updateOriginated'](_0xe2bccd['campaigns'][_0x180388[_0x489306][_0x3683('0xb9')]]);logger['error'](_0x3683('0xbb'),_0x3894ca,_0x489306,_0x180388[_0x489306][_0x3683('0xb9')]);delete _0x180388[_0x489306];}},0x2328);}});}});}}};Dialer['prototype'][_0x3683('0xbc')]=function(_0x3787f2){return BPromise[_0x3683('0xbd')]()[_0x3683('0xbe')](cmHopper[_0x3683('0xbc')](_0x3787f2))[_0x3683('0xb6')](loggerCatch(_0x3683('0xbf')));};Dialer[_0x3683('0x19')][_0x3683('0xc0')]=function(_0x1ec9fb){return BPromise['resolve']()[_0x3683('0xbe')](cmHopperBlack[_0x3683('0xc0')](_0x1ec9fb))[_0x3683('0xb6')](loggerCatch(_0x3683('0xc1')));};Dialer['prototype'][_0x3683('0xc2')]=function(_0xa96fc2){return BPromise[_0x3683('0xbd')]()[_0x3683('0xbe')](cmHopperBlack['checkIsBlackListIvr'](_0xa96fc2))[_0x3683('0xb6')](loggerCatch(_0x3683('0xc3')));};Dialer[_0x3683('0x19')][_0x3683('0xc4')]=function(_0x2bef7b){return BPromise['resolve']()[_0x3683('0xbe')](cmHopperHistory[_0x3683('0xc5')](_0x2bef7b))[_0x3683('0xb6')](loggerCatch('[averageHandleTime]\x20'));};Dialer['prototype'][_0x3683('0xc6')]=function(_0x16dcf0){return BPromise[_0x3683('0xbd')]()[_0x3683('0xbe')](cmHopper[_0x3683('0xc6')](_0x16dcf0))[_0x3683('0xb6')](loggerCatch(_0x3683('0xc7')));};Dialer['prototype'][_0x3683('0xc8')]=function(_0x1a9ae8,_0x2120fc,_0x1f073f){return BPromise[_0x3683('0xbd')]()[_0x3683('0xbe')](cmHopper[_0x3683('0xc8')](_0x1a9ae8,_0x2120fc,_0x1f073f))[_0x3683('0xb6')](loggerCatch(_0x3683('0xc9')));};Dialer[_0x3683('0x19')]['getContactDialer']=function(_0x4de097,_0x59e457,_0x256336,_0x318a39){return BPromise[_0x3683('0xbd')]()[_0x3683('0xbe')](cmHopper[_0x3683('0xca')](_0x4de097,_0x59e457,_0x256336,_0x318a39))[_0x3683('0xb6')](loggerCatch(_0x3683('0xcb')));};Dialer[_0x3683('0x19')][_0x3683('0xcc')]=function(_0xcad7ac,_0x3f2c38,_0x3e8a4b){return BPromise['resolve']()[_0x3683('0xbe')](cmHopper['getContactDialerIvr'](_0xcad7ac,_0x3f2c38,_0x3e8a4b))['catch'](loggerCatch(_0x3683('0xcb')));};Dialer['prototype'][_0x3683('0xcd')]=function(_0x29b2bc){return BPromise[_0x3683('0xbd')]()[_0x3683('0xbe')](voiceQueueRt[_0x3683('0xcd')](_0x29b2bc))['catch'](loggerCatch(_0x3683('0xce')));};Dialer[_0x3683('0x19')][_0x3683('0xcf')]=function(_0x3d02bf){return BPromise[_0x3683('0xbd')]()[_0x3683('0xbe')](cmHopper[_0x3683('0xcf')](_0x3d02bf))[_0x3683('0xb6')](loggerCatch(_0x3683('0xd0')));};Dialer[_0x3683('0x19')][_0x3683('0xd1')]=function(_0x59c975){return BPromise['resolve']()[_0x3683('0xbe')](cmHopperHistory[_0x3683('0xd1')](_0x59c975))['catch'](loggerCatch(_0x3683('0xd2')));};Dialer[_0x3683('0x19')][_0x3683('0xb8')]=function(_0x29f2ad){if(!_['isUndefined'](_0x29f2ad)&&_0x29f2ad!==null){if(_0x29f2ad[_0x3683('0x9b')](_0x3683('0x9c'))){if(_0x29f2ad[_0x3683('0x9c')]>0x0){_0x29f2ad[_0x3683('0x9c')]-=0x1;}else{logger['error'](_0x3683('0xd3'));}}}else{logger[_0x3683('0x97')](_0x3683('0xd4'));}};Dialer[_0x3683('0x19')][_0x3683('0xd5')]=function(_0x40cfb5,_0xccb8b9){var _0x5c752f=this;return function(_0x34e6a1){_0x5c752f[_0x3683('0xb8')](_0xccb8b9);logger[_0x3683('0x97')](_0x40cfb5,util[_0x3683('0x98')](_0x34e6a1,{'showHidden':![],'depth':null}));};};Dialer[_0x3683('0x19')][_0x3683('0xd6')]=function(_0x3c2fe4,_0x170e44,_0x139860){var _0x3c9a95={'state':0x19,'statedesc':_0x3683('0xd7')};this[_0x3683('0xb8')](_0x170e44);this['saveInDb'](_['merge'](_0x3c9a95,_[_0x3683('0xd8')](_0x139860,[_0x3683('0xd9'),_0x3683('0xda'),'UserId',_0x3683('0xdb'),_0x3683('0xdc')])),_0x3683('0xdd'),_0x3683('0xde'));logger[_0x3683('0x97')](_0x3c2fe4);};Dialer[_0x3683('0x19')][_0x3683('0xdf')]=function(_0x10c217){return _0x10c217===_0x3683('0xe0');};Dialer['prototype']['isTrunkReachable']=function(_0x285ab9){return!_['isUndefined'](_0x285ab9)&&_0x285ab9&&!_[_0x3683('0x3b')](_0x285ab9[_0x3683('0x3d')])&&!_[_0x3683('0x3b')](_0x285ab9['active'])&&_0x285ab9[_0x3683('0xe1')]&&(this['trunks'][util[_0x3683('0x7b')](_0x3683('0xe2'),_0x285ab9[_0x3683('0x3d')])]['status']==='reachable'||this[_0x3683('0x20')][util['format']('SIP/%s',_0x285ab9['name'])][_0x3683('0xe3')]===_0x3683('0xe4'));};Dialer[_0x3683('0x19')][_0x3683('0xe5')]=function(_0x33e72f,_0x49dc9b,_0x9b478b){this['createHistory'](_0x33e72f)[_0x3683('0xb6')](loggerCatch(_0x49dc9b));this[_0x3683('0xcf')](_0x33e72f)[_0x3683('0xb6')](loggerCatch(_0x9b478b));};Dialer[_0x3683('0x19')]['syncVarSet']=function(_0x220c27){var _0x5d1795=this['uniqueId'][_0x220c27[_0x3683('0xe6')]];var _0x4f8952;if(!_[_0x3683('0xb3')](_0x220c27)&&!_[_0x3683('0xb3')](_0x220c27[_0x3683('0xe7')])&&!_[_0x3683('0xb3')](_0x220c27['variable']['amdstatus'])&&_0x220c27[_0x3683('0xe8')]==='xcally-motion-dialer'&&_0x5d1795){if(_0x5d1795[_0x3683('0x56')]!=='ivr'&&this[_0x3683('0x1d')][_0x5d1795[_0x3683('0xb9')]]['dialAMDActive']&&_0x220c27[_0x3683('0xe9')]===_0x3683('0xea')){delete this['uniqueId'][_0x220c27[_0x3683('0xe6')]];this[_0x3683('0xb8')](this[_0x3683('0x1d')][_0x5d1795[_0x3683('0xb9')]]);this[_0x3683('0x1d')][_0x5d1795[_0x3683('0xb9')]][_0x3683('0x5e')]+=0x1;this[_0x3683('0x1d')][_0x5d1795['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x4f8952=new Hangup(_0x5d1795,_0x220c27);_0x4f8952['state']=0x12;_0x4f8952[_0x3683('0xad')]='HangupInAMD';_0x4f8952[_0x3683('0xeb')]=_0x3683('0xec');this['saveInDb'](_0x4f8952,_0x3683('0xed'),_0x3683('0xee'));}if(_0x5d1795[_0x3683('0x56')]!==_0x3683('0x7e')&&this['voiceQueues'][_0x5d1795['queue']][_0x3683('0xef')]&&_0x220c27[_0x3683('0xe9')]==='MACHINE'){var _0x37bd11=this;return new BPromise(function(_0x3cea03,_0x52b14d){delete _0x37bd11[_0x3683('0x25')][_0x220c27[_0x3683('0xe6')]];_0x37bd11[_0x3683('0xb8')](_0x37bd11['voiceQueues'][_0x5d1795[_0x3683('0xb9')]]);_0x37bd11['voiceQueues'][_0x5d1795[_0x3683('0xb9')]][_0x3683('0x5e')]+=0x1;_0x37bd11['voiceQueues'][_0x5d1795['queue']][_0x3683('0x5d')]+=0x1;var _0x3cb7ab=_0x37bd11['voiceQueues'][_0x5d1795[_0x3683('0xb9')]];var _0x4ad20d=new Hangup(_0x5d1795,_0x220c27);_0x4ad20d['state']=0x13;_0x4ad20d[_0x3683('0xad')]='Machine';_0x4ad20d[_0x3683('0xeb')]=_0x3683('0xec');_0x4ad20d[_0x3683('0xf0')]+=0x1;_0x4ad20d[_0x3683('0xf1')]+=0x1;_0x4ad20d['amd']=!![];_0x37bd11[_0x3683('0xd1')](_0x4ad20d)[_0x3683('0xb6')](loggerCatch(_0x3683('0xf2')));if(_0x4ad20d[_0x3683('0xf3')]+_0x4ad20d[_0x3683('0xf4')]+_0x4ad20d[_0x3683('0xf5')]+_0x4ad20d[_0x3683('0xf6')]+_0x4ad20d[_0x3683('0xf7')]+_0x4ad20d[_0x3683('0xf8')]+_0x4ad20d[_0x3683('0xf0')]+_0x4ad20d[_0x3683('0xf9')]>=_0x3cb7ab[_0x3683('0xfa')]){_0x37bd11[_0x3683('0xfb')](_0x4ad20d,_0x3cea03,_0x52b14d,_0x3683('0xfc'));}else{if(_0x4ad20d[_0x3683('0xf0')]>=_0x3cb7ab[_0x3683('0xfd')]){_0x37bd11['createStateFinal'](_0x4ad20d,_0x3cea03,_0x52b14d,_0x3683('0xfe'));}else{_0x37bd11[_0x3683('0xc6')]({'active':![],'countmachineretry':_0x4ad20d[_0x3683('0xf0')],'scheduledat':moment()[_0x3683('0xff')](_0x3cb7ab['dialMachineRetryFrequency'],_0x3683('0x100'))[_0x3683('0x7b')](_0x3683('0x101')),'ContactId':_0x4ad20d['ContactId'],'ListId':_0x4ad20d[_0x3683('0xda')],'VoiceQueueId':_0x4ad20d[_0x3683('0xdb')]||undefined,'CampaignId':_0x4ad20d[_0x3683('0xdc')]||undefined})[_0x3683('0xb6')](loggerCatch('[rescheduleContact][Machine]'));_0x3cea03({'reschedule':0x1});}}});}if(_0x5d1795['type']===_0x3683('0x7e')&&this['campaigns'][_0x5d1795['queue']]['dialAMDActive']&&_0x220c27[_0x3683('0xe9')]===_0x3683('0xea')){delete this[_0x3683('0x25')][_0x220c27[_0x3683('0xe6')]];this['updateOriginated'](this['campaigns'][_0x5d1795['queue']]);_0x4f8952=new Hangup(_0x5d1795,_0x220c27);_0x4f8952[_0x3683('0xac')]=0x12;_0x4f8952[_0x3683('0xad')]=_0x3683('0x102');_0x4f8952['membername']=_0x3683('0xec');this[_0x3683('0xe5')](_0x4f8952,_0x3683('0x103'),_0x3683('0x104'));}if(_0x5d1795[_0x3683('0x56')]===_0x3683('0x7e')&&this[_0x3683('0x1e')][_0x5d1795[_0x3683('0xb9')]][_0x3683('0xef')]&&_0x220c27[_0x3683('0xe9')]===_0x3683('0x105')){var _0x37bd11=this;return new BPromise(function(_0x41da11,_0x3f97c7){delete _0x37bd11['uniqueId'][_0x220c27[_0x3683('0xe6')]];_0x37bd11[_0x3683('0xb8')](_0x37bd11[_0x3683('0x1e')][_0x5d1795['queue']]);_0x37bd11['campaigns'][_0x5d1795['queue']][_0x3683('0x5e')]+=0x1;_0x37bd11[_0x3683('0x1e')][_0x5d1795['queue']][_0x3683('0x5d')]+=0x1;var _0x529524=_0x37bd11[_0x3683('0x1e')][_0x5d1795[_0x3683('0xb9')]];var _0x173168=new Hangup(_0x5d1795,_0x220c27);_0x173168[_0x3683('0xac')]=0x13;_0x173168[_0x3683('0xad')]=_0x3683('0x106');_0x173168[_0x3683('0xeb')]=_0x3683('0xec');_0x173168[_0x3683('0xf0')]+=0x1;_0x173168[_0x3683('0xf1')]+=0x1;_0x173168[_0x3683('0x107')]=!![];_0x37bd11[_0x3683('0xd1')](_0x173168)['catch'](loggerCatch(_0x3683('0xf2')));if(_0x173168[_0x3683('0xf3')]+_0x173168[_0x3683('0xf4')]+_0x173168['countnoanswerretry']+_0x173168[_0x3683('0xf6')]+_0x173168['countdropretry']+_0x173168[_0x3683('0xf8')]+_0x173168[_0x3683('0xf0')]+_0x173168[_0x3683('0xf9')]>=_0x529524[_0x3683('0xfa')]){_0x37bd11[_0x3683('0xfb')](_0x173168,_0x41da11,_0x3f97c7,_0x3683('0xfc'));}else{if(_0x173168[_0x3683('0xf0')]>=_0x529524[_0x3683('0xfd')]){_0x37bd11[_0x3683('0x108')](_0x173168,_0x41da11,_0x3f97c7,'reason\x2019\x20machine....');}else{_0x37bd11['rescheduleContact']({'active':![],'countmachineretry':_0x173168[_0x3683('0xf0')],'scheduledat':moment()[_0x3683('0xff')](_0x529524[_0x3683('0x109')],'minutes')[_0x3683('0x7b')](_0x3683('0x101')),'ContactId':_0x173168['ContactId'],'ListId':_0x173168[_0x3683('0xda')],'VoiceQueueId':_0x173168[_0x3683('0xdb')]||undefined,'CampaignId':_0x173168[_0x3683('0xdc')]||undefined})['catch'](loggerCatch(_0x3683('0x10a')));_0x41da11({'reschedule':0x1});}}});}}};Dialer[_0x3683('0x19')][_0x3683('0x10b')]=function(_0x3be21b){var _0x5abf00=this['uniqueId'][_0x3be21b[_0x3683('0xe6')]];var _0x350f3f=this;var _0x41026d;if(_0x5abf00&&_0x5abf00['type']===_0x3683('0x7e')){delete this[_0x3683('0x25')][_0x3be21b[_0x3683('0xe6')]];this[_0x3683('0xb8')](this[_0x3683('0x1e')][_0x5abf00['queue']]);this[_0x3683('0x1e')][_0x5abf00[_0x3683('0xb9')]]['ivrAnswerCallsDay']+=0x1;_0x41026d=new Hangup(_0x5abf00,_0x3be21b);this[_0x3683('0xd1')](_0x41026d)[_0x3683('0xb6')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x3683('0xcf')](_0x41026d)['catch'](loggerCatch(_0x3683('0x10c')));}if(_0x5abf00&&_0x5abf00[_0x3683('0x56')]!=='ivr'&&isNotNull(this[_0x3683('0x1d')][_0x5abf00[_0x3683('0xb9')]][_0x3683('0x10d')])){delete this[_0x3683('0x25')][_0x3be21b[_0x3683('0xe6')]];this[_0x3683('0xb8')](this['voiceQueues'][_0x5abf00[_0x3683('0xb9')]]);this[_0x3683('0x1d')][_0x5abf00[_0x3683('0xb9')]][_0x3683('0x5e')]+=0x1;this[_0x3683('0x1d')][_0x5abf00[_0x3683('0xb9')]]['outboundAnswerAgiCallsDay']+=0x1;_0x41026d=new Hangup(_0x5abf00,_0x3be21b);_0x41026d[_0x3683('0xac')]=0x10;_0x41026d[_0x3683('0xad')]=_0x3683('0x10e');_0x41026d[_0x3683('0xeb')]=_0x3683('0x10f');this[_0x3683('0xd1')](_0x41026d)[_0x3683('0xb6')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x3683('0xcf')](_0x41026d)['catch'](loggerCatch(_0x3683('0x10c')));}if(_0x5abf00&&_0x5abf00[_0x3683('0x56')]!==_0x3683('0x7e')&&!isNotNull(this['voiceQueues'][_0x5abf00['queue']]['dialQueueProject'])){delete this[_0x3683('0x25')][_0x3be21b[_0x3683('0xe6')]];this['updateOriginated'](this[_0x3683('0x1d')][_0x5abf00[_0x3683('0xb9')]]);this[_0x3683('0x1d')][_0x5abf00[_0x3683('0xb9')]][_0x3683('0x69')]+=0x1;_0x41026d=new Hangup(_0x5abf00,_0x3be21b);_0x41026d[_0x3683('0xac')]=0xc;_0x41026d[_0x3683('0xad')]=_0x3be21b[_0x3683('0x110')];_0x41026d['membername']=_0x3683('0x111');this[_0x3683('0xd1')](_0x41026d)[_0x3683('0xb6')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x3683('0xcf')](_0x41026d)['catch'](loggerCatch(_0x3683('0x10c')));}};Dialer['prototype'][_0x3683('0x112')]=function(_0x160aaa){var _0x107919=this['uniqueId'][_0x160aaa[_0x3683('0xe6')]];var _0x395b85=this;if(this[_0x3683('0x1d')][_0x160aaa[_0x3683('0xb9')]]){if(_0x107919&&_0x107919['type']!=='ivr'){delete this[_0x3683('0x25')][_0x160aaa[_0x3683('0xe6')]];this[_0x3683('0x1d')][_0x160aaa[_0x3683('0xb9')]][_0x3683('0x5e')]+=0x1;var _0x1cff9b=new AgentComplete(_0x107919,_0x160aaa);if(_0x160aaa[_0x3683('0x113')]===_0x3683('0x114')){_0x1cff9b[_0x3683('0x115')]=this['voiceQueues'][_0x160aaa[_0x3683('0xb9')]]['dialQueueProject2']&&this[_0x3683('0x1d')][_0x160aaa['queue']][_0x3683('0x116')]?moment()[_0x3683('0x7b')](_0x3683('0x101')):undefined;}this[_0x3683('0xd1')](_0x1cff9b)[_0x3683('0xb6')](loggerCatch(_0x3683('0x117')));this['moveContactManagedDialer'](_0x1cff9b)[_0x3683('0xb6')](loggerCatch(_0x3683('0x118')));}}};Dialer[_0x3683('0x19')]['syncAgentConnect']=function(_0x2fceb0){if(this[_0x3683('0x1d')][_0x2fceb0[_0x3683('0xb9')]]){if(this[_0x3683('0x25')][_0x2fceb0['uniqueid']]&&this['uniqueId'][_0x2fceb0[_0x3683('0xe6')]][_0x3683('0x56')]!==_0x3683('0x7e')){this[_0x3683('0xb8')](this[_0x3683('0x1d')][_0x2fceb0[_0x3683('0xb9')]]);this[_0x3683('0x25')][_0x2fceb0[_0x3683('0xe6')]][_0x3683('0x119')]=moment()[_0x3683('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x3683('0x19')][_0x3683('0x11a')]=function(_0x458c38){this['createHistory'](_0x458c38)[_0x3683('0xb6')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x458c38)[_0x3683('0xb6')](loggerCatch(_0x3683('0x11b')));};Dialer[_0x3683('0x19')]['syncQueueCallerAbandon']=function(_0x39d9a3){var _0x17ae6c=this[_0x3683('0x25')][_0x39d9a3['uniqueid']];var _0x5b1ea4=this;if(this[_0x3683('0x1d')][_0x39d9a3[_0x3683('0xb9')]]){if(_0x17ae6c&&_0x17ae6c[_0x3683('0x56')]!==_0x3683('0x7e')){delete this[_0x3683('0x25')][_0x39d9a3[_0x3683('0xe6')]];this[_0x3683('0xb8')](this[_0x3683('0x1d')][_0x39d9a3[_0x3683('0xb9')]]);_0x17ae6c['droptime']=moment()[_0x3683('0x7b')](_0x3683('0x101'));var _0x45f9f2=new QueueCallerAbandon(_0x17ae6c,_0x39d9a3);if(getSeconds(_0x17ae6c['droptime'],_0x17ae6c[_0x3683('0x11c')])>=_0x17ae6c[_0x3683('0x11d')]){this[_0x3683('0x1d')][_0x39d9a3[_0x3683('0xb9')]][_0x3683('0x6d')]+=0x1;this[_0x3683('0x1d')][_0x39d9a3[_0x3683('0xb9')]][_0x3683('0x11e')]+=0x1;this[_0x3683('0x1d')][_0x39d9a3[_0x3683('0xb9')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x45f9f2[_0x3683('0xac')]=0xa;_0x45f9f2[_0x3683('0xad')]=_0x3683('0x11f');_0x45f9f2[_0x3683('0x120')]=_0x3683('0x121');_0x45f9f2[_0x3683('0x115')]=this[_0x3683('0x1d')][_0x39d9a3[_0x3683('0xb9')]][_0x3683('0x122')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x45f9f2[_0x3683('0xf7')]+=0x1;_0x45f9f2[_0x3683('0xf1')]+=0x1;if(_0x45f9f2[_0x3683('0xf7')]>=this[_0x3683('0x1d')][_0x39d9a3[_0x3683('0xb9')]][_0x3683('0x123')]){this['queueCallerAbandonCreateState'](_0x45f9f2);}else{this[_0x3683('0xc6')]({'active':![],'countdropretry':_0x45f9f2[_0x3683('0xf7')],'scheduledat':moment()['add'](this[_0x3683('0x1d')][_0x39d9a3['queue']][_0x3683('0x124')],_0x3683('0x100'))[_0x3683('0x7b')](_0x3683('0x101')),'ContactId':_0x17ae6c['ContactId'],'ListId':_0x17ae6c[_0x3683('0xda')],'VoiceQueueId':_0x17ae6c['VoiceQueueId']||undefined,'CampaignId':_0x17ae6c['CampaignId']||undefined})[_0x3683('0xb6')](loggerCatch(_0x3683('0x125')));var _0x241805=new History(_0x45f9f2);_0x241805[_0x3683('0xac')]=0xa;_0x241805[_0x3683('0xad')]='Drop';_0x241805[_0x3683('0xae')]=moment()[_0x3683('0x7b')](_0x3683('0x101'));_0x241805[_0x3683('0x126')]=_0x241805[_0x3683('0xae')];_0x241805['calleridname']=_0x45f9f2['calleridname'];_0x241805[_0x3683('0x127')]=_0x45f9f2[_0x3683('0x127')];this[_0x3683('0xd1')](_0x241805)['catch'](loggerCatch(_0x3683('0x128')));}}else{this['voiceQueues'][_0x39d9a3['queue']][_0x3683('0x85')]+=0x1;this[_0x3683('0x1d')][_0x39d9a3['queue']][_0x3683('0x63')]+=0x1;_0x45f9f2[_0x3683('0xac')]=0xb;_0x45f9f2[_0x3683('0xad')]=_0x3683('0x129');_0x45f9f2['dropreason']='CALLEREXIT';_0x45f9f2[_0x3683('0xf8')]+=0x1;_0x45f9f2[_0x3683('0xf1')]+=0x1;if(_0x45f9f2['countabandonedretry']>=this[_0x3683('0x1d')][_0x39d9a3[_0x3683('0xb9')]][_0x3683('0x12a')]){this['queueCallerAbandonCreateState'](_0x45f9f2);}else{this[_0x3683('0xc6')]({'active':![],'countabandonedretry':_0x45f9f2[_0x3683('0xf8')],'scheduledat':moment()[_0x3683('0xff')](this['voiceQueues'][_0x39d9a3[_0x3683('0xb9')]][_0x3683('0x12b')],'minutes')[_0x3683('0x7b')](_0x3683('0x101')),'ContactId':_0x17ae6c[_0x3683('0xd9')],'ListId':_0x17ae6c[_0x3683('0xda')],'VoiceQueueId':_0x17ae6c[_0x3683('0xdb')]||undefined,'CampaignId':_0x17ae6c[_0x3683('0xdc')]||undefined})[_0x3683('0xb6')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x241805=new History(_0x45f9f2);_0x241805[_0x3683('0xac')]=0xb;_0x241805[_0x3683('0xad')]=_0x3683('0x129');_0x241805[_0x3683('0xae')]=moment()[_0x3683('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');_0x241805['endtime']=_0x241805[_0x3683('0xae')];_0x241805[_0x3683('0x12c')]=_0x45f9f2[_0x3683('0x12c')];_0x241805['calleridnum']=_0x45f9f2['calleridnum'];this[_0x3683('0xd1')](_0x241805)[_0x3683('0xb6')](loggerCatch(_0x3683('0x12d')));}}}}};Dialer['prototype'][_0x3683('0x32')]=function(_0x4ae67e){if(this['actions'][_0x4ae67e[_0x3683('0xe6')]]){this[_0x3683('0x23')][_0x4ae67e['uniqueid']][_0x3683('0xb5')]=_0x4ae67e['channel'];}if(this[_0x3683('0x25')][_0x4ae67e[_0x3683('0xe6')]]){this[_0x3683('0x25')][_0x4ae67e['uniqueid']]['channel']=_0x4ae67e[_0x3683('0xb5')];}};Dialer['prototype'][_0x3683('0x36')]=function(_0x18239c){if(strategy[this[_0x3683('0x1d')][this[_0x3683('0x23')][_0x18239c['actionid']][_0x3683('0xb9')]][_0x3683('0x4f')]]===_0x3683('0x18')){if(this['actions'][_0x18239c[_0x3683('0x12e')]]&&_['isNil'](this[_0x3683('0x23')][_0x18239c[_0x3683('0x12e')]][_0x3683('0x12f')])&&_0x18239c[_0x3683('0xe3')]==='1'&&_0x18239c[_0x3683('0x130')]==='0'){if(this[_0x3683('0x1f')][_0x18239c[_0x3683('0x131')]]){if(!this[_0x3683('0x1f')][_0x18239c[_0x3683('0x131')]][_0x3683('0x12f')]){this['agents'][_0x18239c['stateinterface']][_0x3683('0x12f')]=!![];this[_0x3683('0x23')][_0x18239c[_0x3683('0x12e')]][_0x3683('0x12f')]=!![];this[_0x3683('0x23')][_0x18239c['actionid']][_0x3683('0x131')]=_0x18239c[_0x3683('0x131')];}}}}else if((strategy[this['voiceQueues'][this[_0x3683('0x23')][_0x18239c[_0x3683('0x12e')]]['queue']][_0x3683('0x4f')]]||_0x3683('0x17'))===_0x3683('0x17')){if(this[_0x3683('0x23')][_0x18239c[_0x3683('0x12e')]]){if(this[_0x3683('0x1f')][_0x18239c[_0x3683('0x131')]]){this[_0x3683('0x23')][_0x18239c[_0x3683('0x12e')]][_0x3683('0x131')]=_0x18239c[_0x3683('0x131')];if(_[_0x3683('0xb3')](this[_0x3683('0x28')][this['actions'][_0x18239c[_0x3683('0x12e')]][_0x3683('0xb9')]])){this[_0x3683('0x28')][this[_0x3683('0x23')][_0x18239c['actionid']]['queue']]=[];}this[_0x3683('0x28')][this[_0x3683('0x23')][_0x18239c['actionid']]['queue']][_0x3683('0x132')](_[_0x3683('0x8f')](_[_0x3683('0xd8')](this['actions'][_0x18239c[_0x3683('0x12e')]],[_0x3683('0x133'),_0x3683('0x131')]),{'status':_0x18239c[_0x3683('0xe3')],'paused':_0x18239c[_0x3683('0x130')]}));}}}};function unlockQueueStatus(_0x1a800d,_0x4b264e){setTimeout(function(){if(_['isUndefined'](_0x1a800d['queueStatusComplete'])){loggerBooked[_0x3683('0x97')](_0x3683('0x134'),_0x4b264e);}_0x1a800d['queueStatusComplete']=!![];loggerBooked[_0x3683('0x81')](_0x3683('0x135'),_0x4b264e,JSON[_0x3683('0x49')](_[_0x3683('0xd8')](_0x1a800d,[_0x3683('0x3d'),_0x3683('0x136')])));},0x1f3);}Dialer[_0x3683('0x19')][_0x3683('0x38')]=function(_0x109311){var _0xd32622=this;var _0x3cb56f=_0xd32622[_0x3683('0x1d')][_0xd32622[_0x3683('0x23')][_0x109311[_0x3683('0x12e')]][_0x3683('0xb9')]];if(strategy[this[_0x3683('0x1d')][this['actions'][_0x109311[_0x3683('0x12e')]][_0x3683('0xb9')]][_0x3683('0x4f')]]===_0x3683('0x18')){if(this[_0x3683('0x23')][_0x109311['actionid']]&&this[_0x3683('0x23')][_0x109311['actionid']][_0x3683('0x131')]){this[_0x3683('0x137')][_0x3683('0x138')](this[_0x3683('0x23')][_0x109311[_0x3683('0x12e')]][_0x3683('0x133')],this['actions'][_0x109311[_0x3683('0x12e')]]['stateinterface'])[_0x3683('0xb6')](function(_0x259d4f){logger[_0x3683('0x97')](_0x3683('0x139'),util[_0x3683('0x98')](_0x259d4f,{'showHidden':![],'depth':null}));})[_0x3683('0x1b')](function(){_0xd32622[_0x3683('0xb8')](_0xd32622[_0x3683('0x1d')][_0xd32622[_0x3683('0x23')][_0x109311[_0x3683('0x12e')]][_0x3683('0xb9')]]);_0xd32622[_0x3683('0x1f')][_0xd32622['actions'][_0x109311['actionid']][_0x3683('0x131')]][_0x3683('0x12f')]=![];delete _0xd32622[_0x3683('0x23')][_0x109311['actionid']];unlockQueueStatus(_0x3cb56f);});}else{this['updateOriginated'](this[_0x3683('0x1d')][this[_0x3683('0x23')][_0x109311[_0x3683('0x12e')]]['queue']]);this[_0x3683('0xc6')]({'active':![],'ContactId':this[_0x3683('0x23')][_0x109311[_0x3683('0x12e')]][_0x3683('0xd9')],'ListId':this[_0x3683('0x23')][_0x109311[_0x3683('0x12e')]][_0x3683('0xda')],'VoiceQueueId':this[_0x3683('0x23')][_0x109311['actionid']]['VoiceQueueId']||undefined,'CampaignId':this[_0x3683('0x23')][_0x109311[_0x3683('0x12e')]][_0x3683('0xdc')]||undefined})[_0x3683('0xb6')](loggerCatch(_0x3683('0x13a')));delete this['actions'][_0x109311[_0x3683('0x12e')]];unlockQueueStatus(_0x3cb56f);}}else if((strategy[this['voiceQueues'][this[_0x3683('0x23')][_0x109311['actionid']][_0x3683('0xb9')]][_0x3683('0x4f')]]||'rrmemory')===_0x3683('0x17')){var _0x1806fe;if(this[_0x3683('0x23')][_0x109311[_0x3683('0x12e')]]&&!_['isEmpty'](this[_0x3683('0x28')][this['actions'][_0x109311[_0x3683('0x12e')]][_0x3683('0xb9')]])){if(this['queueBookedRR'][_0xd32622[_0x3683('0x23')][_0x109311[_0x3683('0x12e')]][_0x3683('0xb9')]]){this[_0x3683('0x29')][_0xd32622[_0x3683('0x23')][_0x109311[_0x3683('0x12e')]][_0x3683('0xb9')]]=this[_0x3683('0x29')][this[_0x3683('0x23')][_0x109311['actionid']]['queue']]?this[_0x3683('0x29')][this[_0x3683('0x23')][_0x109311[_0x3683('0x12e')]][_0x3683('0xb9')]]:this['queueBooked'][this[_0x3683('0x23')][_0x109311['actionid']]['queue']]?this['queueBooked'][this[_0x3683('0x23')][_0x109311[_0x3683('0x12e')]][_0x3683('0xb9')]][_0x3683('0x13b')]||0x0:0x0;}this['queueBooked'][this[_0x3683('0x23')][_0x109311[_0x3683('0x12e')]][_0x3683('0xb9')]]['_rr']=this['queueBookedRR'][this[_0x3683('0x23')][_0x109311[_0x3683('0x12e')]][_0x3683('0xb9')]];for(var _0x5ef050=0x0;_0x5ef050=0x0?!![]:![];})['catch'](myreject(_0x22255d)));}}else{_0x135e50[_0x3683('0x132')](ami[_0x3683('0xb4')]({'action':_0x3683('0x155'),'command':util[_0x3683('0x7b')](_0x3683('0x150'),_0x5201a6,!_[_0x3683('0x3b')](config[_0x3683('0x14c')][_0x45d093])?_0x45d093:'')})['then'](function(_0x311b33){return _0x311b33[_0x3683('0x152')][_0x3683('0x153')](_0x3683('0x154'))>=0x0?!![]:![];})[_0x3683('0xb6')](myreject(_0x22255d)));}BPromise[_0x3683('0x156')](_0x135e50)[_0x3683('0xbe')](function(_0x5829ac){var _0x75fab7=_['some'](_0x5829ac);if(_0x75fab7){return _0x553f43(_0x75fab7);}else{_0x9fa6bf[_0x3683('0x3f')]=_0x21cec6?_0x3683('0x157'):'INTERVAL_IS_OVERTIME';return _0x22255d(msgResponse('[ifTime][promiseAll]',_0x3683('0x14a'),_0x3683('0x158')+_0x21cec6+'\x20'+_0x577daf+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x5201a6,{'showHidden':![],'depth':null})+_0x3683('0x159')+_0x45d093));}})[_0x3683('0xb6')](function(_0x342f89){return _0x22255d(msgResponse(_0x3683('0x148'),_0x3683('0x14a'),JSON[_0x3683('0x49')](_0x342f89)));});});};Dialer[_0x3683('0x19')]['checkDialMethod']=function(_0x3c3060){var _0x30fd06=this;return function(){switch(_0x3c3060[_0x3683('0x5a')]){case'progressive':freeVariablesPredictive(_0x3c3060);_0x30fd06[_0x3683('0x15a')](_0x3c3060,0x1);break;case _0x3683('0x15b'):freeVariablesPredictive(_0x3c3060);_0x30fd06[_0x3683('0x15a')](_0x3c3060,_0x3c3060[_0x3683('0x15c')]);break;case _0x3683('0x6'):_0x30fd06[_0x3683('0x6')](_0x3c3060);break;case _0x3683('0x5'):freeVariablesPredictive(_0x3c3060);_0x30fd06[_0x3683('0x15a')](_0x3c3060,0x1);break;default:freeVariablesPredictive(_0x3c3060);logger[_0x3683('0x97')](_0x3683('0x15d'),_0x3c3060[_0x3683('0x3d')],_0x3683('0x15e'));}};};Dialer[_0x3683('0x19')]['launchHandleIvr']=function(_0xc2cdc1){var _0x4be294=this;return function(){_0x4be294['handleIvr'](_0xc2cdc1);};};Dialer['prototype']['syncQueueSummary']=function(_0x359268){var _0x579a30=this;if(isNotPreview(_0x359268[_0x3683('0x5a')])){if(isVoiceQueueOutbound(_0x359268[_0x3683('0x56')])&&isActive(_0x359268[_0x3683('0x59')])){_0x359268[_0x3683('0xa6')]=!![];BPromise['resolve']()['then'](checkIsLoggedIn(_0x359268,_0x359268[_0x3683('0x52')]))[_0x3683('0xbe')](checkIsActive(_0x359268,_0x359268[_0x3683('0x59')]))[_0x3683('0xbe')](checkInterval(_0x359268))[_0x3683('0xbe')](_0x579a30[_0x3683('0x15f')](_0x359268))[_0x3683('0xbe')](_0x579a30[_0x3683('0x160')](_0x359268[_0x3683('0x161')],_0x359268[_0x3683('0x162')],_0x359268[_0x3683('0x3d')],_0x359268))[_0x3683('0xbe')](_0x579a30[_0x3683('0x149')](_0x359268[_0x3683('0x42')],_0x359268[_0x3683('0x162')],_0x359268[_0x3683('0x3d')],_0x359268))[_0x3683('0xbe')](_0x579a30[_0x3683('0x163')](_0x359268))[_0x3683('0xb6')](loggerCatchQueueSummary(_0x3683('0x164'),_0x359268));}else{notSendMessagesQueue(_0x359268);}}else{freeVariablesPredictive(_0x359268);}};Dialer[_0x3683('0x19')][_0x3683('0x144')]=function(){var _0x23e137=this;var _0x38c591;for(var _0x211450 in this[_0x3683('0x1e')]){if(this['campaigns'][_0x3683('0x9b')](_0x211450)){_0x38c591=this['campaigns'][_0x211450];if(isCampaignIvr(_0x38c591[_0x3683('0x56')])&&isActive(_0x38c591[_0x3683('0xe1')])){_0x38c591['sendMessageOneNotActive']=!![];BPromise[_0x3683('0xbd')]()[_0x3683('0xbe')](checkIsActive(_0x38c591,_0x38c591[_0x3683('0xe1')]))[_0x3683('0xbe')](checkInterval(_0x38c591))[_0x3683('0xbe')](_0x23e137[_0x3683('0x15f')](_0x38c591))[_0x3683('0xbe')](_0x23e137[_0x3683('0x160')](_0x38c591[_0x3683('0x161')],_0x38c591[_0x3683('0x162')],_0x38c591['name'],_0x38c591))[_0x3683('0xbe')](_0x23e137[_0x3683('0x149')](_0x38c591[_0x3683('0x42')],_0x38c591[_0x3683('0x162')],_0x38c591[_0x3683('0x3d')],_0x38c591))[_0x3683('0xbe')](_0x23e137[_0x3683('0x165')](_0x38c591))['catch'](loggerCatchQueueSummary(_0x3683('0x166'),_0x38c591));}else{notSendMessagesCampaign(_0x38c591);}}}};function getCallerIdRandom(_0x228ea8,_0x48a860){var _0x16103d,_0x2528c9,_0x412034;if(_0x48a860<=0x0){_0x48a860=0x1;}_0x16103d=new RegExp(_0x3683('0x167')+_0x48a860+'}$');_0x2528c9=Math[_0x3683('0x168')](0xa,_0x48a860-0x1);_0x412034=Math[_0x3683('0x168')](0xa,_0x48a860)-0x1;return util[_0x3683('0x7b')]('%s',_[_0x3683('0x169')](_0x228ea8,_0x16103d,_[_0x3683('0x16a')](_0x2528c9,_0x412034)));}function extractCalleridName(_0x824dd7){var _0x4f48ad=_0x824dd7[_0x3683('0x16b')](/"(.*?)"/);return _0x4f48ad?_0x4f48ad[0x1]:_0x824dd7;}function extractCalleridNumber(_0x4d6b62){var _0x100428=_0x4d6b62[_0x3683('0x16b')](/<(.*?)>/);return _0x100428?_0x100428[0x1]:_0x4d6b62;}Dialer['prototype'][_0x3683('0x16c')]=function(_0x22543d,_0xf0e24c){var _0x47797b=this;var _0x555525=uuid['v4']();this[_0x3683('0x23')][_0x555525]=new Action(_0x22543d,_0xf0e24c,_0x555525);return new BPromise(function(_0x283d56,_0x5d05bd){if(_['isUndefined'](_0x22543d)&&_0x3683('0x16d')!==typeof _0x22543d){return _0x5d05bd(msgResponse('originate',_0x3683('0x14a'),'voiceQueue\x20is\x20undefine'));}if(_[_0x3683('0x3b')](_0xf0e24c['Contact'][_0x3683('0x16e')])||_0xf0e24c[_0x3683('0x16f')]['phone']===null){return _0x5d05bd(msgResponse(_0x3683('0x170'),'Failure',_0x3683('0x171')));}var _0x5daf91={'XMD-CALLERID':_0x47797b['actions'][_0x555525]['getCaller'](),'XMD-AGI':_0x22543d[_0x3683('0x10d')]?util['format'](_0x3683('0x172'),ipAgi,_0x22543d[_0x3683('0x10d')]):'NONE','XMD-AGIAFTER':_0x22543d['dialQueueProject2']?util[_0x3683('0x7b')](_0x3683('0x172'),ipAgi,_0x22543d['dialQueueProject2']):_0x3683('0x173'),'XMD-QUEUE':_0x22543d[_0x3683('0x56')]===_0x3683('0x4e')?util[_0x3683('0x7b')](_0x3683('0x174'),_0x22543d[_0x3683('0x3d')],_0x22543d[_0x3683('0x175')]||'',_0x22543d[_0x3683('0x116')]?'c':'',_0x22543d[_0x3683('0x11d')]||0x3):_0x3683('0x173'),'XMD-CONTACTID':_0xf0e24c[_0x3683('0xd9')],'XMD-CDRTYPE':_0x3683('0x4'),'CALLERID(all)':_0x47797b[_0x3683('0x23')][_0x555525]['getCaller'](),'XMD-AMD':_0x22543d[_0x3683('0xef')]?_0x3683('0x176'):'NONE','XMD-DESTINATION':_0x3683('0x177')};if(_0x22543d['dialAMDActive']){_0x5daf91['XMD-AMDINITIALSILENCE']=_0x22543d[_0x3683('0x178')]||0x9c4;_0x5daf91['XMD-AMDGREETING']=_0x22543d['dialAMDGreeting']||0x5dc;_0x5daf91[_0x3683('0x179')]=_0x22543d[_0x3683('0x17a')]||0x320;_0x5daf91[_0x3683('0x17b')]=_0x22543d[_0x3683('0x17c')]||0x1388;_0x5daf91[_0x3683('0x17d')]=_0x22543d[_0x3683('0x17e')]||0x64;_0x5daf91['XMD-AMDBETWEENWORDSSILENCE']=_0x22543d['dialAMDBetweenWordsSilence']||0x32;_0x5daf91[_0x3683('0x17f')]=_0x22543d[_0x3683('0x180')]||0x3;_0x5daf91[_0x3683('0x181')]=_0x22543d['dialAMDSilenceThreshold']||0x100;_0x5daf91[_0x3683('0x182')]=_0x22543d['dialAMDMaximumWordLength']||0x1388;}if(_0x22543d[_0x3683('0x56')]===_0x3683('0x4e')){_0x5daf91[_0x3683('0x183')]=_0xf0e24c[_0x3683('0xdb')];}else{_0x5daf91['XMD-CAMPAIGNID']=_0xf0e24c[_0x3683('0xdc')];}for(var _0x5869dd in _0xf0e24c['Contact']){if(_0xf0e24c[_0x3683('0x16f')][_0x3683('0x9b')](_0x5869dd)){if(isNotNull(_0xf0e24c[_0x3683('0x16f')][_0x5869dd])&&_0x5869dd!=='id'&&_0x5869dd!==_0x3683('0x184')&&_0x5869dd!=='createdAt'&&_0x5869dd!==_0x3683('0x185')){_0x5daf91[util['format']('%s%s',_0x3683('0x186'),_[_0x3683('0x187')](_0x5869dd))]=_0xf0e24c[_0x3683('0x16f')][_0x5869dd];}}}var _0x24b5ef=_0x47797b[_0x3683('0x145')](_0x22543d[_0x3683('0x7a')])?getCallerId(_0x22543d[_0x3683('0x7a')]['callerid'],_0x22543d[_0x3683('0x188')],_0x22543d[_0x3683('0x189')]>0x0?getCallerIdRandom(_0x22543d['dialOriginateCallerIdNumber'],_0x22543d['dialRandomLastDigitCallerIdNumber']):_0x22543d[_0x3683('0x5b')]):getCallerId(_[_0x3683('0xb3')](_0x22543d['TrunkBackup'])?_0x22543d[_0x3683('0x7a')][_0x3683('0x18a')]:_0x22543d['TrunkBackup'][_0x3683('0x18a')],_0x22543d[_0x3683('0x188')],_0x22543d[_0x3683('0x189')]>0x0?getCallerIdRandom(_0x22543d[_0x3683('0x5b')],_0x22543d[_0x3683('0x189')]):_0x22543d['dialOriginateCallerIdNumber']);if(_0x24b5ef){_0x5daf91[_0x3683('0x18b')]=_0x47797b[_0x3683('0x23')][_0x555525][_0x3683('0x18c')]=extractCalleridName(_0x24b5ef);_0x5daf91[_0x3683('0x18d')]=_0x47797b[_0x3683('0x23')][_0x555525]['originatecalleridnum']=extractCalleridNumber(_0x24b5ef);}return ami[_0x3683('0xb4')]({'actionid':_0x555525,'action':'originate','channel':_0x47797b['isTrunkReachable'](_0x22543d[_0x3683('0x7a')])?util[_0x3683('0x7b')](_0x3683('0x18e'),_0x22543d[_0x3683('0x7a')][_0x3683('0x3d')],isNotNull(_0x22543d[_0x3683('0x18f')])?_0x22543d[_0x3683('0x18f')][_0x3683('0x190')]()||'':'',_0x22543d['dialCutDigit']>0x0?_0xf0e24c['Contact'][_0x3683('0x16e')][_0x3683('0x191')](_0x22543d['dialCutDigit']):_0xf0e24c['Contact'][_0x3683('0x16e')]):util[_0x3683('0x7b')](_0x3683('0x18e'),_[_0x3683('0xb3')](_0x22543d[_0x3683('0x192')])?_0x22543d[_0x3683('0x7a')][_0x3683('0x3d')]:_0x22543d[_0x3683('0x192')][_0x3683('0x3d')],isNotNull(_0x22543d[_0x3683('0x18f')])?_0x22543d[_0x3683('0x18f')][_0x3683('0x190')]()||'':'',_0x22543d[_0x3683('0x193')]>0x0?_0xf0e24c[_0x3683('0x16f')][_0x3683('0x16e')][_0x3683('0x191')](_0x22543d[_0x3683('0x193')]):_0xf0e24c[_0x3683('0x16f')][_0x3683('0x16e')]),'callerid':_0x24b5ef,'Exten':_0x3683('0x177'),'Context':_0x3683('0x194'),'Priority':'1','variable':_0x5daf91,'timeout':(_0x22543d[_0x3683('0x5c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x555525})[_0x3683('0xbe')](function(_0x2bdb9c){return _0x283d56(_0x2bdb9c);})[_0x3683('0xb6')](function(_0x16b041){_0x22543d[_0x3683('0x66')]+=0x1;var _0x37722d=new History(_0x47797b[_0x3683('0x23')][_0x555525]);logger['error'](util['format']('[originateError]:\x20%s',JSON[_0x3683('0x49')](_0x16b041)));_0x37722d[_0x3683('0xac')]=0xe;_0x37722d[_0x3683('0xad')]=_0x3683('0x195');_0x37722d[_0x3683('0xae')]=moment()[_0x3683('0x7b')](_0x3683('0x101'));_0x37722d[_0x3683('0x126')]=_0x37722d[_0x3683('0xae')];_0x47797b[_0x3683('0xd1')](_0x37722d)[_0x3683('0xb6')](loggerCatch('[originate][error]'));_0x47797b[_0x3683('0xcf')](_0x37722d)[_0x3683('0xb6')](loggerCatch(_0x3683('0x196')))[_0x3683('0x1b')](function(){delete _0x47797b[_0x3683('0x23')][_0x555525];return _0x5d05bd(msgResponse(_0x3683('0x170'),'Error','originate\x20action\x20Error'));});});});};Dialer[_0x3683('0x19')][_0x3683('0x2f')]=function(_0x1fe190){var _0x1777df=this[_0x3683('0x23')][_0x1fe190['actionid']];var _0x53ce55=this;if(_0x1777df){delete this[_0x3683('0x23')][_0x1fe190[_0x3683('0x12e')]];_0x1777df[_0x3683('0x11c')]=moment()[_0x3683('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');var _0x50794b=_0x1777df['type']===_0x3683('0x7e')?this[_0x3683('0x1e')][_0x1777df[_0x3683('0xb9')]]:this['voiceQueues'][_0x1777df[_0x3683('0x197')]()];if(!this[_0x3683('0xdf')](_0x1fe190[_0x3683('0x198')])){this['updateOriginated'](_0x50794b);return this[_0x3683('0x199')](_0x1777df,_0x50794b,_0x1fe190)[_0x3683('0xbe')](function(_0x4378ee){})[_0x3683('0xb6')](loggerCatch(_0x3683('0x19a')));}else{this[_0x3683('0x25')][_0x1fe190['uniqueid']]=_0x1777df;}}};Dialer[_0x3683('0x19')][_0x3683('0x19b')]=function(_0x31c28d,_0x1681cf,_0x26315b){var _0x3c2281=new History(_0x1681cf);if(_0x3c2281['countbusyretry']+_0x3c2281[_0x3683('0xf4')]+_0x3c2281[_0x3683('0xf5')]+_0x3c2281[_0x3683('0xf6')]+_0x3c2281['countdropretry']+_0x3c2281[_0x3683('0xf8')]+_0x3c2281[_0x3683('0xf0')]+_0x3c2281[_0x3683('0xf9')]>=_0x26315b[_0x3683('0xfa')]-0x1){return!![];}switch(_0x31c28d){case 0x3:if(_0x3c2281['countnoanswerretry']>=_0x26315b[_0x3683('0x19c')]-0x1){return!![];}else{this[_0x3683('0xc6')]({'active':![],'countnoanswerretry':_0x3c2281['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x3683('0xff')](_0x26315b[_0x3683('0x19d')],_0x3683('0x100'))[_0x3683('0x7b')](_0x3683('0x101')),'ContactId':_0x3c2281[_0x3683('0xd9')],'ListId':_0x3c2281['ListId'],'VoiceQueueId':_0x3c2281[_0x3683('0xdb')]||undefined,'CampaignId':_0x3c2281[_0x3683('0xdc')]||undefined})[_0x3683('0xb6')](loggerCatch(_0x3683('0x19e')));}break;case 0x5:if(_0x3c2281['countbusyretry']>=_0x26315b['dialBusyMaxRetry']-0x1){return!![];}else{this[_0x3683('0xc6')]({'active':![],'countbusyretry':_0x3c2281[_0x3683('0xf3')]+=0x1,'scheduledat':moment()[_0x3683('0xff')](_0x26315b[_0x3683('0x19f')],_0x3683('0x100'))[_0x3683('0x7b')](_0x3683('0x101')),'ContactId':_0x3c2281[_0x3683('0xd9')],'ListId':_0x3c2281[_0x3683('0xda')],'VoiceQueueId':_0x3c2281['VoiceQueueId']||undefined,'CampaignId':_0x3c2281[_0x3683('0xdc')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));}break;case 0x8:if(_0x3c2281[_0x3683('0xf4')]>=_0x26315b[_0x3683('0x1a0')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countcongestionretry':_0x3c2281[_0x3683('0xf4')]+=0x1,'scheduledat':moment()[_0x3683('0xff')](_0x26315b[_0x3683('0x1a1')],_0x3683('0x100'))[_0x3683('0x7b')](_0x3683('0x101')),'ContactId':_0x3c2281[_0x3683('0xd9')],'ListId':_0x3c2281[_0x3683('0xda')],'VoiceQueueId':_0x3c2281[_0x3683('0xdb')]||undefined,'CampaignId':_0x3c2281[_0x3683('0xdc')]||undefined})['catch'](loggerCatch(_0x3683('0x1a2')));}break;case 0x0:if(_0x3c2281['countnosuchnumberretry']>=_0x26315b[_0x3683('0x1a3')]-0x1){return!![];}else{this[_0x3683('0xc6')]({'active':![],'countnosuchnumberretry':_0x3c2281[_0x3683('0xf6')]+=0x1,'scheduledat':moment()[_0x3683('0xff')](_0x26315b[_0x3683('0x1a4')],_0x3683('0x100'))[_0x3683('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3c2281['ContactId'],'ListId':_0x3c2281['ListId'],'VoiceQueueId':_0x3c2281[_0x3683('0xdb')]||undefined,'CampaignId':_0x3c2281[_0x3683('0xdc')]||undefined})[_0x3683('0xb6')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x3c2281[_0x3683('0xf7')]>=_0x26315b[_0x3683('0x123')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countdropretry':_0x3c2281[_0x3683('0xf7')]+=0x1,'scheduledat':moment()['add'](_0x26315b[_0x3683('0x124')],_0x3683('0x100'))[_0x3683('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3c2281[_0x3683('0xd9')],'ListId':_0x3c2281['ListId'],'VoiceQueueId':_0x3c2281[_0x3683('0xdb')]||undefined,'CampaignId':_0x3c2281[_0x3683('0xdc')]||undefined})[_0x3683('0xb6')](loggerCatch(_0x3683('0x125')));}break;case 0xb:if(_0x3c2281[_0x3683('0xf8')]>=_0x26315b[_0x3683('0x12a')]-0x1){return!![];}else{this[_0x3683('0xc6')]({'active':![],'countabandonedretry':_0x3c2281[_0x3683('0xf8')]+=0x1,'scheduledat':moment()[_0x3683('0xff')](_0x26315b[_0x3683('0x12b')],_0x3683('0x100'))[_0x3683('0x7b')](_0x3683('0x101')),'ContactId':_0x3c2281[_0x3683('0xd9')],'ListId':_0x3c2281[_0x3683('0xda')],'VoiceQueueId':_0x3c2281[_0x3683('0xdb')]||undefined,'CampaignId':_0x3c2281['CampaignId']||undefined})[_0x3683('0xb6')](loggerCatch(_0x3683('0x1a5')));}break;case 0x13:if(_0x3c2281[_0x3683('0xf0')]>=_0x26315b[_0x3683('0xfd')]-0x1){return!![];}else{this[_0x3683('0xc6')]({'active':![],'countmachineretry':_0x3c2281['countmachineretry']+=0x1,'scheduledat':moment()[_0x3683('0xff')](_0x26315b['dialMachineRetryFrequency'],'minutes')[_0x3683('0x7b')](_0x3683('0x101')),'ContactId':_0x3c2281[_0x3683('0xd9')],'ListId':_0x3c2281['ListId'],'VoiceQueueId':_0x3c2281[_0x3683('0xdb')]||undefined,'CampaignId':_0x3c2281[_0x3683('0xdc')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));}break;case 0x14:if(_0x3c2281['countagentrejectretry']>=_0x26315b[_0x3683('0x1a6')]-0x1){return!![];}else{this[_0x3683('0xc6')]({'active':![],'countagentrejectretry':_0x3c2281[_0x3683('0xf9')]+=0x1,'scheduledat':moment()[_0x3683('0xff')](_0x26315b['dialAgentRejectRetryFrequency'],'minutes')[_0x3683('0x7b')](_0x3683('0x101')),'ContactId':_0x3c2281[_0x3683('0xd9')],'ListId':_0x3c2281['ListId'],'VoiceQueueId':_0x3c2281[_0x3683('0xdb')]||undefined,'CampaignId':_0x3c2281[_0x3683('0xdc')]||undefined})[_0x3683('0xb6')](loggerCatch(_0x3683('0x1a7')));}break;default:return!![];}};Dialer[_0x3683('0x19')][_0x3683('0x199')]=function(_0x171a00,_0x5506fa,_0x3ba82f){var _0x19b5cc=this;var _0x75f1ae=new History(_0x171a00);return new BPromise(function(_0x3069be,_0x51b428){if(_[_0x3683('0x3b')](_0x5506fa)&&_0x3683('0x16d')!==typeof _0x5506fa){return _0x51b428(msgResponse('[callProgressDetecting]',_0x3683('0x14a'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x3ba82f)&&'object'!==typeof _0x3ba82f){return _0x51b428(msgResponse(_0x3683('0x1a8'),_0x3683('0x14a'),'evt\x20is\x20undefine'));}switch(_0x3ba82f[_0x3683('0x113')]){case'0':_0x5506fa['outboundNoSuchCallsDay']+=0x1;_0x75f1ae[_0x3683('0xac')]=0x0;_0x75f1ae['statedesc']=_0x3683('0x1a9');_0x75f1ae[_0x3683('0xf6')]+=0x1;_0x75f1ae['countglobal']+=0x1;ami[_0x3683('0x4d')]('custom:agentnosuchnumber',ut[_0x3683('0x1aa')](_0x171a00,_0x3683('0x1ab')));_0x19b5cc['createHistory'](_0x75f1ae)[_0x3683('0xb6')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x19b5cc[_0x3683('0x19b')](0x0,_0x171a00,_0x5506fa)){if(_0x75f1ae['countnosuchnumberretry']>=_0x5506fa[_0x3683('0x1a3')]){_0x19b5cc[_0x3683('0x108')](_0x75f1ae,_0x3069be,_0x51b428,'reason\x200\x20no\x20such\x20number....');}else{_0x19b5cc['stateGlobal'](_0x75f1ae,_0x3069be,_0x51b428,_0x3683('0x1ac'));}}break;case'3':_0x5506fa[_0x3683('0x64')]+=0x1;_0x75f1ae['state']=0x3;_0x75f1ae[_0x3683('0xad')]=_0x3683('0x1ad');_0x75f1ae[_0x3683('0xf5')]+=0x1;_0x75f1ae[_0x3683('0xf1')]+=0x1;ami[_0x3683('0x4d')]('custom:agentnoanswer',ut[_0x3683('0x1aa')](_0x171a00,_0x3683('0x1ae')));_0x19b5cc['createHistory'](_0x75f1ae)[_0x3683('0xb6')](loggerCatch(_0x3683('0x1af')));if(_0x19b5cc[_0x3683('0x19b')](0x3,_0x171a00,_0x5506fa)){if(_0x75f1ae[_0x3683('0xf5')]>=_0x5506fa[_0x3683('0x19c')]){_0x19b5cc['createStateFinal'](_0x75f1ae,_0x3069be,_0x51b428,_0x3683('0x1b0'));}else{_0x19b5cc['stateGlobal'](_0x75f1ae,_0x3069be,_0x51b428,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x5506fa[_0x3683('0x60')]+=0x1;_0x75f1ae['state']=0x5;_0x75f1ae[_0x3683('0xad')]=_0x3683('0x1b1');_0x75f1ae[_0x3683('0xf3')]+=0x1;_0x75f1ae[_0x3683('0xf1')]+=0x1;ami[_0x3683('0x4d')](_0x3683('0x1b2'),ut[_0x3683('0x1aa')](_0x171a00,_0x3683('0x1b3')));_0x19b5cc[_0x3683('0xd1')](_0x75f1ae)[_0x3683('0xb6')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x19b5cc[_0x3683('0x19b')](0x5,_0x171a00,_0x5506fa)){if(_0x75f1ae[_0x3683('0xf3')]>=_0x5506fa[_0x3683('0x1b4')]){_0x19b5cc[_0x3683('0x108')](_0x75f1ae,_0x3069be,_0x51b428,'reason\x205\x20busy');}else{_0x19b5cc[_0x3683('0xfb')](_0x75f1ae,_0x3069be,_0x51b428,_0x3683('0x1b5'));}}break;case'8':_0x5506fa[_0x3683('0x61')]+=0x1;_0x75f1ae[_0x3683('0xac')]=0x8;_0x75f1ae[_0x3683('0xad')]=_0x3683('0x1b6');_0x75f1ae[_0x3683('0xf4')]+=0x1;_0x75f1ae[_0x3683('0xf1')]+=0x1;ami[_0x3683('0x4d')]('custom:agentcongestion',ut['buildObj'](_0x171a00,'congestion'));_0x19b5cc[_0x3683('0xd1')](_0x75f1ae)[_0x3683('0xb6')](loggerCatch(_0x3683('0x1b7')));if(_0x19b5cc['checkRetriveMax'](0x8,_0x171a00,_0x5506fa)){if(_0x75f1ae[_0x3683('0xf4')]>=_0x5506fa[_0x3683('0x1a0')]){_0x19b5cc[_0x3683('0x108')](_0x75f1ae,_0x3069be,_0x51b428,_0x3683('0x1b8'));}else{_0x19b5cc['stateGlobal'](_0x75f1ae,_0x3069be,_0x51b428,_0x3683('0x1b8'));}}break;case'11':_0x5506fa['outboundAbandonedCallsDay']+=0x1;_0x75f1ae['state']=0xb;_0x75f1ae[_0x3683('0xad')]='Abandoned';_0x75f1ae[_0x3683('0xf8')]+=0x1;_0x75f1ae['countglobal']+=0x1;_0x19b5cc[_0x3683('0xd1')](_0x75f1ae)['catch'](loggerCatch(_0x3683('0x12d')));if(_0x19b5cc['checkRetriveMax'](0xb,_0x171a00,_0x5506fa)){if(_0x75f1ae[_0x3683('0xf8')]>=_0x5506fa[_0x3683('0x12a')]){_0x19b5cc['createStateFinal'](_0x75f1ae,_0x3069be,_0x51b428,'reason\x2011\x20abandoned');}else{_0x19b5cc['stateGlobal'](_0x75f1ae,_0x3069be,_0x51b428,_0x3683('0x1b9'));}}break;case'20':_0x5506fa[_0x3683('0x68')]+=0x1;_0x75f1ae[_0x3683('0xac')]=0x14;_0x75f1ae[_0x3683('0xad')]=_0x3683('0x1ba');_0x75f1ae['countagentrejectretry']+=0x1;_0x75f1ae['countglobal']+=0x1;ami[_0x3683('0x4d')](_0x3683('0x1bb'),ut[_0x3683('0x1aa')](_0x171a00,_0x3683('0x1bc')));_0x19b5cc['createHistory'](_0x75f1ae)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x19b5cc['checkRetriveMax'](0x14,_0x171a00,_0x5506fa)){if(_0x75f1ae['countagentrejectretry']>=_0x5506fa[_0x3683('0x1a6')]){_0x19b5cc[_0x3683('0x108')](_0x75f1ae,_0x3069be,_0x51b428,_0x3683('0x1bd'));}else{_0x19b5cc['stateGlobal'](_0x75f1ae,_0x3069be,_0x51b428,_0x3683('0x1bd'));}}break;default:_0x5506fa[_0x3683('0x69')]+=0x1;_0x75f1ae[_0x3683('0xac')]=0xc;_0x75f1ae[_0x3683('0xad')]=_0x3ba82f[_0x3683('0x113')];_0x19b5cc[_0x3683('0xd1')](_0x75f1ae)[_0x3683('0xb6')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x19b5cc[_0x3683('0x19b')](_0x3ba82f['reason'],_0x171a00,_0x5506fa)){if(_0x75f1ae[_0x3683('0xf3')]+_0x75f1ae[_0x3683('0xf4')]+_0x75f1ae['countnoanswerretry']+_0x75f1ae[_0x3683('0xf6')]+_0x75f1ae[_0x3683('0xf7')]+_0x75f1ae[_0x3683('0xf8')]+_0x75f1ae[_0x3683('0xf0')]+_0x75f1ae[_0x3683('0xf9')]>=_0x5506fa[_0x3683('0xfa')]){_0x19b5cc[_0x3683('0xfb')](_0x75f1ae,_0x3069be,_0x51b428,_0x3ba82f[_0x3683('0x113')]);}else{_0x19b5cc[_0x3683('0x108')](_0x75f1ae,_0x3069be,_0x51b428,_0x3ba82f[_0x3683('0x113')]);}}}});};Dialer[_0x3683('0x19')][_0x3683('0xfb')]=function(_0x2edc07,_0x235204,_0x373f31,_0x5c16df){var _0x86544d=new Final(_0x2edc07);_0x86544d[_0x3683('0xac')]=0xf;_0x86544d[_0x3683('0xad')]=_0x3683('0x1be');this['createStateFinal'](_0x86544d,_0x235204,_0x373f31,_0x5c16df);};Dialer[_0x3683('0x19')][_0x3683('0x108')]=function(_0x32e8f4,_0x198284,_0x33a290,_0x48e72d){this[_0x3683('0xcf')](_0x32e8f4)[_0x3683('0xbe')](function(_0x518f93){return _0x198284(msgResponse('[callProgressDetecting]',_0x3683('0xe0'),_0x48e72d));})[_0x3683('0xb6')](function(_0x29e614){return _0x33a290(msgResponse(_0x3683('0x1bf'),_0x3683('0x14a'),_0x3683('0x1c0')));});};Dialer[_0x3683('0x19')]['predictive']=function(_0x157ec0){var _0x586ec7=this;var _0x11538e=_0x157ec0[_0x3683('0x1c1')]/0x64;var _0x3c273e=_0x157ec0[_0x3683('0x11e')]/(_0x157ec0['outboundDropCallsDayTimeout']+_0x157ec0['outboundAnswerCallsDay']);var _0x2449fb=Math[_0x3683('0x1c2')](_0x157ec0[_0x3683('0x72')]*(_0x157ec0[_0x3683('0x1c3')]/0x64));var _0x22c099=Math[_0x3683('0x1c2')](_0x157ec0[_0x3683('0x72')]*(_0x157ec0['predictiveIntervalMinThreshold']/0x64));var _0x29eff9=_0x157ec0[_0x3683('0x51')]+_0x157ec0[_0x3683('0xa4')];var _0x25c7c6=Math[_0x3683('0x1c4')](_0x157ec0[_0x3683('0x74')]*_0x157ec0[_0x3683('0x76')]*_0x157ec0[_0x3683('0x70')]*_0x157ec0[_0x3683('0x71')]);if(_['isUndefined'](_0x157ec0[_0x3683('0x79')])){if(!_[_0x3683('0x3b')](_0x157ec0['startPredictive'])){_0x157ec0[_0x3683('0x78')]=undefined;loggerPredictive[_0x3683('0x97')](_0x3683('0x1c5'),_0x3683('0x1c6'));}if(!_['isUndefined'](_0x157ec0[_0x3683('0x92')])){loggerPredictive[_0x3683('0x97')](_0x3683('0x1c5'),_0x3683('0x1c7'));clearInterval(_0x157ec0[_0x3683('0x92')]);_0x157ec0[_0x3683('0x92')]=undefined;}_0x157ec0[_0x3683('0x79')]=moment()[_0x3683('0x7b')](_0x3683('0x101'));loggerPredictive[_0x3683('0x81')](_0x157ec0[_0x3683('0x3d')],_0x3683('0x1c8'),_0x157ec0['startProgressive']);this[_0x3683('0x15a')](_0x157ec0,0x1);}else if(ifInterval(_0x157ec0[_0x3683('0x1c9')],_0x157ec0[_0x3683('0x79')])){this[_0x3683('0x15a')](_0x157ec0,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x157ec0[_0x3683('0x79')],_0x157ec0[_0x3683('0x3d')]);_0x157ec0['erlangCalls']=0x0;_0x157ec0[_0x3683('0x6f')]=0x0;}else if(_0x11538e<_0x3c273e&&_0x157ec0[_0x3683('0x1ca')]===_0x3683('0x1cb')){freeVariablesPredictive(_0x157ec0);loggerPredictive[_0x3683('0x81')](_0x3683('0x1cc'),_0x3683('0x1cd'),_0x3c273e,_0x3683('0x79'),_0x157ec0[_0x3683('0x3d')]);}else if(_0x25c7c6<_0x157ec0[_0x3683('0x6f')]&&_0x157ec0['dialPredictiveOptimization']===_0x3683('0x1cb')){freeVariablesPredictive(_0x157ec0);loggerPredictive[_0x3683('0x81')](_0x3683('0x1ce'),_0x3683('0x1cf'),_0x25c7c6,'Drop\x20in\x20this\x20interval',_0x157ec0[_0x3683('0x6f')],'startProgressive',_0x157ec0[_0x3683('0x3d')]);}else if(!ifInterval(_0x157ec0[_0x3683('0x1c9')],_0x157ec0['startProgressive'])&&_[_0x3683('0x3b')](_0x157ec0['startPredictive'])&&!_[_0x3683('0x3b')](_0x157ec0[_0x3683('0x79')])){_0x157ec0[_0x3683('0x78')]=moment()['format'](_0x3683('0x101'));loggerPredictive[_0x3683('0x81')](_0x157ec0[_0x3683('0x3d')],_0x3683('0x1d0'),_0x157ec0['startPredictive']);this[_0x3683('0xc4')](_0x157ec0[_0x3683('0x1c9')])[_0x3683('0xbe')](this[_0x3683('0x1d1')](_0x157ec0))[_0x3683('0xbe')](mergeDataErlangB(_0x157ec0))['then'](this[_0x3683('0x1d2')](_0x157ec0))[_0x3683('0xb6')](loggerCatchPredictive(_0x3683('0x1d3'),_0x157ec0));}else if(!ifInterval(_0x157ec0[_0x3683('0x1c9')],_0x157ec0['startPredictive'])){_0x157ec0['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x157ec0[_0x3683('0x78')]=moment()[_0x3683('0x7b')](_0x3683('0x101'));loggerPredictive[_0x3683('0x81')](_0x157ec0[_0x3683('0x3d')],_0x3683('0x1d4'),_0x157ec0[_0x3683('0x78')]);clearInterval(_0x157ec0[_0x3683('0x92')]);_0x157ec0[_0x3683('0x92')]=undefined;this[_0x3683('0xc4')](_0x157ec0[_0x3683('0x1c9')])[_0x3683('0xbe')](this[_0x3683('0x1d1')](_0x157ec0))[_0x3683('0xbe')](mergeDataErlangB(_0x157ec0))['then'](this[_0x3683('0x1d2')](_0x157ec0))[_0x3683('0xb6')](loggerCatchPredictive(_0x3683('0x1d5'),_0x157ec0));}else if(_0x157ec0[_0x3683('0x72')]&&_0x29eff9<_0x157ec0[_0x3683('0x72')]-_0x22c099){freeVariablesPredictive(_0x157ec0);loggerPredictive[_0x3683('0x81')](_0x157ec0[_0x3683('0x3d')],_0x3683('0x1d6'),_0x29eff9,')\x20are\x20less\x20than\x20threshold\x20(',_0x157ec0[_0x3683('0x72')],'-',_0x22c099,'=',_0x157ec0[_0x3683('0x72')]-_0x22c099,')');}else if(_0x157ec0[_0x3683('0x72')]&&_0x29eff9>_0x157ec0[_0x3683('0x72')]+_0x2449fb){freeVariablesPredictive(_0x157ec0);loggerPredictive[_0x3683('0x81')](_0x157ec0[_0x3683('0x3d')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x29eff9,')\x20are\x20more\x20than\x20threshold\x20(',_0x157ec0['predictiveIntervalAvailable'],'+',_0x2449fb,'=',_0x157ec0['predictiveIntervalAvailable']+_0x2449fb,')');}};Dialer['prototype']['getDataPredictive']=function(_0x485e2c){var _0x1f8a76=this;return function(_0x2f4fe3){return new BPromise(function(_0x1146c1,_0x254fcf){_[_0x3683('0x8f')](_0x485e2c,_0x2f4fe3[0x0]);if(checkGetDataPredictive(_0x2f4fe3[0x0])){var _0x583c65=_0x485e2c[_0x3683('0x72')]=_0x485e2c[_0x3683('0xa4')]+_0x485e2c[_0x3683('0x51')];var _0x1f4874=_0x485e2c[_0x3683('0x1c9')]*0x3c;var _0x1b0b63=_0x2f4fe3[0x0]['predictiveIntervalAvgTalktime']+_0x2f4fe3[0x0][_0x3683('0x6b')];var _0x35b2bb=(_0x2f4fe3[0x0][_0x3683('0x6a')]+_0x2f4fe3[0x0][_0x3683('0x6d')]+_0x2f4fe3[0x0][_0x3683('0x85')])/_0x2f4fe3[0x0]['predictiveIntervalTotalCalls'];_0x485e2c['predictiveIntervalHitRate']=_0x35b2bb>0x0?_0x35b2bb:0x1;switch(_0x485e2c[_0x3683('0x1ca')]){case _0x3683('0x1cb'):var _0x42dfb1=_0x485e2c[_0x3683('0x1c1')]/0x64;return _0x1f8a76[_0x3683('0x1d7')](_0x583c65,_0x1f4874,_0x1b0b63,_0x35b2bb,_0x42dfb1)[_0x3683('0xbe')](function(_0x14795d){return _0x1146c1(_0x14795d);});case _0x3683('0x1d8'):var _0x3f17db=_0x485e2c[_0x3683('0x1c1')]/0x64;return _0x1f8a76[_0x3683('0x1d9')](_0x583c65,_0x1f4874,_0x1b0b63,_0x35b2bb,_0x3f17db)[_0x3683('0xbe')](function(_0x1cc28c){return _0x1146c1(_0x1cc28c);});default:return _0x254fcf(msgResponse(_0x3683('0x1da'),_0x3683('0x14a'),_0x3683('0x1db')));}}else{return _0x254fcf(msgResponse(_0x3683('0x1da'),_0x3683('0x14a'),_0x3683('0x1dc')));}});};};Dialer[_0x3683('0x19')][_0x3683('0x1dd')]=function(_0x17a896){var _0xc81f38=this;return function(_0x2bf94b){return new BPromise(function(_0x1ca3c4,_0x1bc6f4){_['merge'](_0x17a896,_0x2bf94b[0x0]);if(checkGetDataPredictive(_0x2bf94b[0x0])){loggerPredictive[_0x3683('0x81')](JSON[_0x3683('0x49')](_0x2bf94b[0x0]));if(_0x17a896[_0x3683('0x1ca')]==='dropRate'){return _0xc81f38[_0x3683('0xcd')](_0x17a896['id'])[_0x3683('0xbe')](function(_0xaacc64){var _0x116ca1=_0x17a896[_0x3683('0x52')]-_0xaacc64[0x0][_0x3683('0x1de')];var _0x217594=_0x17a896['dialPredictiveInterval']*0x3c;var _0x4c3c63=_0x2bf94b[0x0][_0x3683('0x6c')]+_0x2bf94b[0x0]['predictiveIntervalAvgHoldtime'];var _0x2d2cae=(_0x2bf94b[0x0][_0x3683('0x6a')]+_0x2bf94b[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2bf94b[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2bf94b[0x0][_0x3683('0x73')];var _0x12e0d9=_0x17a896['dialPredictiveOptimizationPercentage']/0x64;_0x17a896['predictiveIntervalPauses']=_0xaacc64[0x0][_0x3683('0x1de')]||0x0;_0x17a896['predictiveIntervalHitRate']=_0x2d2cae>0x0?_0x2d2cae:0x1;return _0xc81f38[_0x3683('0x1d7')](_0x116ca1,_0x217594,_0x4c3c63,_0x2d2cae,_0x12e0d9);})['then'](function(_0x29311e){return _0x1ca3c4(_0x29311e);})[_0x3683('0xb6')](function(_0x4a4732){return _0x1bc6f4(msgResponse(_0x3683('0x1df'),_0x3683('0x14a'),JSON[_0x3683('0x49')](_0x4a4732)));});}if(_0x17a896[_0x3683('0x1ca')]===_0x3683('0x1d8')){return _0xc81f38[_0x3683('0xcd')](_0x17a896['id'])[_0x3683('0xbe')](function(_0x1b5ba7){var _0x5eff9c=_0x17a896[_0x3683('0x52')]-_0x1b5ba7[0x0]['outboundQueuePauses'];var _0x5761dd=_0x17a896[_0x3683('0x1c9')]*0x3c;var _0x1b1ffc=_0x2bf94b[0x0][_0x3683('0x6c')]+_0x2bf94b[0x0][_0x3683('0x6b')];var _0x2e86fd=(_0x2bf94b[0x0]['predictiveIntervalAnsweredCalls']+_0x2bf94b[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2bf94b[0x0][_0x3683('0x85')])/_0x2bf94b[0x0][_0x3683('0x73')];var _0xc0ee=_0x17a896[_0x3683('0x1c1')]/0x64;_0x17a896[_0x3683('0x1e0')]=_0x1b5ba7[0x0]['outboundQueuePauses']||0x0;_0x17a896[_0x3683('0x70')]=_0x2e86fd>0x0?_0x2e86fd:0x1;return _0xc81f38[_0x3683('0x1d9')](_0x5eff9c,_0x5761dd,_0x1b1ffc,_0x2e86fd,_0xc0ee);})[_0x3683('0xbe')](function(_0x1ab25b){return _0x1ca3c4(_0x1ab25b);})[_0x3683('0xb6')](function(_0x58085b){return _0x1bc6f4(msgResponse(_0x3683('0x1df'),'Failure',JSON[_0x3683('0x49')](_0x58085b)));});}}else{return _0x1bc6f4(msgResponse(_0x3683('0x1da'),_0x3683('0x14a'),_0x3683('0x1dc')));}});};};Dialer[_0x3683('0x19')][_0x3683('0x1d2')]=function(_0x445301){var _0x4b23a6=this;return function(){var _0x23868f=0x0;var _0x277bde=Math['floor'](_0x445301[_0x3683('0x75')]*0x3e8);if(_0x277bde>0x0){_0x277bde=_0x277bde<0x64?0x64:_0x277bde;loggerPredictive[_0x3683('0x81')](_0x445301[_0x3683('0x3d')],_0x3683('0x1e1'),_0x277bde,_0x3683('0x4a'));_0x445301[_0x3683('0x92')]=setInterval(function(){_0x4b23a6['handlePredictive'](_0x445301);loggerPredictiveCalls[_0x3683('0x81')](_0x3683('0x1e2'),_0x23868f+=0x1);},_0x277bde);}else{loggerPredictive['info'](_0x445301[_0x3683('0x3d')],_0x3683('0x1e3'));}};};Dialer[_0x3683('0x19')][_0x3683('0x1e4')]=function(_0x17d22e,_0x302afa){var _0xd0a48c=this;return function(_0x20bdf9){if(_['isEmpty'](_0x20bdf9)){if(_[_0x3683('0xb3')](_0x302afa[_0x3683('0x1e5')])||!_0x302afa['recallme']){if(_0x17d22e[_0x3683('0x5a')]===_0x3683('0x5')){_0x17d22e[_0x3683('0x136')]=_[_0x3683('0x3b')](_0x17d22e[_0x3683('0x136')])?!![]:_0x17d22e[_0x3683('0x136')];var _0x5d9c54=uuid['v4']();_0xd0a48c[_0x3683('0x23')][_0x5d9c54]=new Action(_0x17d22e,_0x302afa,_0x5d9c54);loggerBooked[_0x3683('0x81')](_0x3683('0x1e6'),_0x5d9c54,_0x3683('0x1e7'),JSON[_0x3683('0x49')](_0x17d22e[_0x3683('0x136')]),_0x3683('0x1e8'),_0x17d22e[_0x3683('0x3d')]);if(_0x17d22e[_0x3683('0x136')]){_0x17d22e[_0x3683('0x136')]=![];_0xd0a48c['queueBooked'][_0xd0a48c[_0x3683('0x23')][_0x5d9c54]['queue']]=[];ami[_0x3683('0xb4')]({'actionid':_0x5d9c54,'action':_0x3683('0x1e9'),'queue':_0x17d22e[_0x3683('0x3d')]})[_0x3683('0xb6')](function(_0x12cdc9){_0xd0a48c[_0x3683('0xb8')](_0x17d22e);_0xd0a48c[_0x3683('0xc6')]({'active':![],'ContactId':_0xd0a48c['actions'][_0x5d9c54][_0x3683('0xd9')],'ListId':_0xd0a48c[_0x3683('0x23')][_0x5d9c54][_0x3683('0xda')],'VoiceQueueId':_0xd0a48c[_0x3683('0x23')][_0x5d9c54][_0x3683('0xdb')]||undefined,'CampaignId':_0xd0a48c['actions'][_0x5d9c54][_0x3683('0xdc')]||undefined})['catch'](loggerCatch(_0x3683('0x1ea')));delete _0xd0a48c[_0x3683('0x23')][_0x5d9c54];});}else{loggerBooked[_0x3683('0x81')]('[booked][checkContactBlack][else]',JSON[_0x3683('0x49')](_0x17d22e[_0x3683('0x136')]),_0x3683('0x1e8'),_0x17d22e['name']);_0xd0a48c['updateOriginated'](_0x17d22e);_0xd0a48c[_0x3683('0xc6')]({'active':![],'ContactId':_0xd0a48c[_0x3683('0x23')][_0x5d9c54][_0x3683('0xd9')],'ListId':_0xd0a48c[_0x3683('0x23')][_0x5d9c54][_0x3683('0xda')],'VoiceQueueId':_0xd0a48c[_0x3683('0x23')][_0x5d9c54]['VoiceQueueId']||undefined,'CampaignId':_0xd0a48c[_0x3683('0x23')][_0x5d9c54]['CampaignId']||undefined})[_0x3683('0xb6')](loggerCatch(_0x3683('0x1ea')));delete _0xd0a48c[_0x3683('0x23')][_0x5d9c54];}}else{return _0xd0a48c['actionOriginate'](_0x17d22e,_0x302afa);}}else{if(getDiff(_0x302afa[_0x3683('0x1eb')])<_0x17d22e[_0x3683('0x1ec')]*0x3c){if(_0x302afa[_0x3683('0x1ed')]&&!_0x302afa[_0x3683('0x1ed')][_0x3683('0x1ee')]){_0xd0a48c[_0x3683('0x137')][_0x3683('0x138')](_0x302afa['id'])[_0x3683('0x1b')](function(){_0xd0a48c[_0x3683('0xb8')](_0x17d22e);});}else{_0xd0a48c[_0x3683('0xc8')]({'active':![]},_0x302afa['id'],0x1)[_0x3683('0x1b')](function(){console[_0x3683('0x1ef')](_0x3683('0x1f0'));_0xd0a48c[_0x3683('0xb8')](_0x17d22e);});}}else{_0x17d22e['outboundReCallsDay']+=0x1;_0xd0a48c['updateOriginated'](_0x17d22e);if(_0x17d22e[_0x3683('0x1f1')]){_0xd0a48c[_0x3683('0xc6')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x302afa[_0x3683('0xd9')],'ListId':_0x302afa['ListId'],'VoiceQueueId':_0x302afa['VoiceQueueId']||undefined,'CampaignId':_0x302afa[_0x3683('0xdc')]||undefined})[_0x3683('0xb6')](loggerCatch(_0x3683('0x1f2')));_0xd0a48c[_0x3683('0xd1')](createObjHistory(_0x17d22e,_0x302afa,_0x3683('0x1f3'),0x17,_0x3683('0x1f4')))[_0x3683('0xb6')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0xd0a48c[_0x3683('0xe5')](createObjHistory(_0x17d22e,_0x302afa,_0x3683('0x1f5'),0x16,_0x3683('0x1f6')),'[Originate][HistoryRecallClose][historyCatch]',_0x3683('0x1f7'));}}}}else{_0x17d22e[_0x3683('0x5f')]+=0x1;_0xd0a48c[_0x3683('0xe5')](createObjHistory(_0x17d22e,_0x302afa,'BLACKLIST',0xd,'Blacklist'),_0x3683('0x1f8'),_0x3683('0x1f9'));throw _0x3683('0x1fa');}};};Dialer[_0x3683('0x19')][_0x3683('0x1fb')]=function(_0x333ea9){var _0x1d803a=this;var _0x3f03d6=[];var _0x17a15b=_0x333ea9['limitCalls']-_0x333ea9[_0x3683('0x9c')]-_0x333ea9[_0x3683('0x1fc')];emitCampaignSummary(_0x333ea9);if(_0x17a15b>0x0){if(_0x17a15b>this['maxNumberOriginate']){_0x17a15b=this[_0x3683('0x21')];}_0x333ea9['temp']+=_0x17a15b;this[_0x3683('0xcc')](_0x333ea9['id'],_0x17a15b,_0x333ea9[_0x3683('0x1fd')])[_0x3683('0xbe')](function(_0x2c17e7){_0x333ea9['temp']-=_0x17a15b;_0x333ea9[_0x3683('0x1fc')]=_0x333ea9[_0x3683('0x1fc')]>0x0?_0x333ea9['temp']:0x0;if(!checkContactEmpty(_0x2c17e7)){_0x333ea9[_0x3683('0x3f')]=_0x3683('0x1fe');logger[_0x3683('0x81')](_0x3683('0x1ff')+_0x333ea9[_0x3683('0x3d')]);}else{_0x333ea9[_0x3683('0x9c')]+=_0x2c17e7[_0x3683('0x9a')];_0x333ea9[_0x3683('0x3f')]='RUNNING';for(var _0x375b8b=0x0;_0x375b8b<_0x2c17e7[_0x3683('0x9a')];_0x375b8b+=0x1){_0x333ea9[_0x3683('0x200')]+=0x1;if(_[_0x3683('0xb3')](_0x2c17e7[_0x375b8b])||_[_0x3683('0xb3')](_0x2c17e7[_0x375b8b]['Contact'])||_[_0x3683('0xb3')](_0x2c17e7[_0x375b8b][_0x3683('0x16f')][_0x3683('0x16e')])){_0x1d803a[_0x3683('0xd6')](_0x3683('0x201'),_0x333ea9,_0x2c17e7[_0x375b8b]);}else{_0x1d803a[_0x3683('0xc2')](_[_0x3683('0xd8')](_0x2c17e7[_0x375b8b],[_0x3683('0xdc'),_0x3683('0x202')]))[_0x3683('0xbe')](_0x1d803a[_0x3683('0x1e4')](_0x333ea9,_0x2c17e7[_0x375b8b]))[_0x3683('0xb6')](_0x1d803a[_0x3683('0xd5')]('[actionOriginateIvr]\x20',_0x333ea9));}}}})['catch'](loggerGetContactDialer(_0x3683('0x203'),_0x333ea9,_0x17a15b));}};Dialer[_0x3683('0x19')][_0x3683('0x15a')]=function(_0x1d13a3,_0x16f910){var _0x436746=this;var _0x5887b3=[];var _0x2e43a4=_0x16f910>=0x1?_0x16f910:0x1;var _0x2990f5=[];if(_0x1d13a3[_0x3683('0x5a')]===_0x3683('0x5')){_0x2e43a4=0x1;}var _0x310101=Math[_0x3683('0x1c4')](_0x1d13a3[_0x3683('0x51')]*_0x2e43a4)-_0x1d13a3[_0x3683('0x9c')]-_0x1d13a3[_0x3683('0x1fc')];emitVoiceQueueSummary(_0x1d13a3);if(_0x1d13a3[_0x3683('0x204')]>0x0){var _0x500b6c=_0x1d13a3[_0x3683('0x204')]-_0x1d13a3[_0x3683('0x9c')]-_0x1d13a3[_0x3683('0xa4')]-_0x1d13a3[_0x3683('0x1fc')]-_0x1d13a3[_0x3683('0x205')];if(_0x310101>_0x500b6c){_0x310101=_0x500b6c;}}if(_0x310101>0x0){if(_0x1d13a3[_0x3683('0x5a')]===_0x3683('0x5')){_0x310101=0x1;}if(_0x310101>this[_0x3683('0x21')]){_0x310101=this[_0x3683('0x21')];}_0x1d13a3[_0x3683('0x1fc')]+=_0x310101;for(var _0x304af3 in this[_0x3683('0x1f')]){if(this[_0x3683('0x1f')][_0x3683('0x9b')](_0x304af3)){if(this[_0x3683('0x1f')][_0x304af3]['state']===_0x3683('0x206')&&this[_0x3683('0x1f')][_0x304af3]['status']===_0x3683('0x207')){_0x5887b3[_0x3683('0x132')](this['agents'][_0x304af3]['id']);}}}this['getContactDialer'](_0x1d13a3['id'],_0x5887b3,_0x310101,_0x1d13a3[_0x3683('0x1fd')])[_0x3683('0xbe')](function(_0x4f98a0){_0x1d13a3['temp']-=_0x310101;_0x1d13a3[_0x3683('0x1fc')]=_0x1d13a3[_0x3683('0x1fc')]>0x0?_0x1d13a3[_0x3683('0x1fc')]:0x0;if(!checkContactEmpty(_0x4f98a0)){_0x436746['countReScheduled'](_0x1d13a3)['then'](sendMessageReschedule(_0x1d13a3))['catch'](loggerCatch(_0x3683('0xbf')));}else{_0x1d13a3['originated']+=_0x4f98a0[_0x3683('0x9a')];_0x1d13a3['message']=_0x1d13a3[_0x3683('0x5a')]===_0x3683('0x5')?_0x3683('0x176'):'RUNNING';for(var _0x50297b=0x0;_0x50297b<_0x4f98a0[_0x3683('0x9a')];_0x50297b+=0x1){if(_[_0x3683('0xb3')](_0x4f98a0[_0x50297b])||_[_0x3683('0xb3')](_0x4f98a0[_0x50297b][_0x3683('0x16f')])||_[_0x3683('0xb3')](_0x4f98a0[_0x50297b]['Contact'][_0x3683('0x16e')])){_0x436746['emptyContact'](_0x3683('0x201'),_0x1d13a3,_0x4f98a0[_0x50297b]);}else{_0x436746[_0x3683('0xc0')](_[_0x3683('0xd8')](_0x4f98a0[_0x50297b],[_0x3683('0xdb'),'Contact.phone']))[_0x3683('0xbe')](_0x436746['checkContactBlack'](_0x1d13a3,_0x4f98a0[_0x50297b]))[_0x3683('0xb6')](_0x436746[_0x3683('0xd5')](_0x3683('0x201'),_0x1d13a3));}}}})['catch'](loggerGetContactDialer(_0x3683('0x208'),_0x1d13a3,_0x310101));}};Dialer[_0x3683('0x19')][_0x3683('0x92')]=function(_0x47ad56){var _0x559788=this;if(_0x47ad56['dialLimitQueue']>0x0){var _0x1bb88a=_0x47ad56[_0x3683('0x204')]-_0x47ad56[_0x3683('0x9c')]-_0x47ad56[_0x3683('0xa4')];if(_0x1bb88a>0x0){this['tryOriginatePredictive'](_0x47ad56);}else{loggerPredictiveCalls['info'](_0x3683('0x209'));}}else{this[_0x3683('0x20a')](_0x47ad56);}};Dialer[_0x3683('0x19')][_0x3683('0x20a')]=function(_0x465940){var _0x11af49=this;var _0x312d50=[];_0x465940[_0x3683('0x9c')]+=0x1;for(var _0x3082be in this[_0x3683('0x1f')]){if(this['agents'][_0x3683('0x9b')](_0x3082be)){if(this[_0x3683('0x1f')][_0x3082be][_0x3683('0xac')]===_0x3683('0x206')&&this[_0x3683('0x1f')][_0x3082be][_0x3683('0xe3')]===_0x3683('0x207')){_0x312d50[_0x3683('0x132')](this[_0x3683('0x1f')][_0x3082be]['id']);}}}this[_0x3683('0xca')](_0x465940['id'],_0x312d50,0x1,_0x465940[_0x3683('0x1fd')])['then'](function(_0x41d475){if(!checkContactEmpty(_0x41d475)){checkContactLowerLimitOriginate(_0x465940,0x1,0x0);_0x11af49[_0x3683('0xbc')](_0x465940)[_0x3683('0xbe')](sendMessageReschedule(_0x465940))[_0x3683('0xb6')](loggerCatch(_0x3683('0xbf')));}else{_0x465940['message']=_0x3683('0x20b');if(_[_0x3683('0xb3')](_0x41d475[0x0])||_['isNil'](_0x41d475[0x0]['Contact'])||_['isNil'](_0x41d475[0x0][_0x3683('0x16f')]['phone'])){_0x11af49[_0x3683('0xd6')](_0x3683('0x201'),_0x465940,_0x41d475[0x0]);}else{_0x11af49['checkIsBlackList'](_[_0x3683('0xd8')](_0x41d475[0x0],['VoiceQueueId',_0x3683('0x202')]))[_0x3683('0xbe')](_0x11af49[_0x3683('0x1e4')](_0x465940,_0x41d475[0x0]))[_0x3683('0xb6')](_0x11af49[_0x3683('0xd5')](_0x3683('0x20c'),_0x465940));}}})['catch'](loggerGetContactDialer(_0x3683('0x20d'),_0x465940,0x1));emitVoiceQueueSummary(_0x465940);};Dialer[_0x3683('0x19')][_0x3683('0x1d7')]=function(_0x2735bf,_0x45c1b0,_0x5b0ad5,_0x52b636,_0x35d815,_0x137f2f){loggerPredictive[_0x3683('0x81')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x3683('0x81')](_0x3683('0x20e'),_0x2735bf);loggerPredictive[_0x3683('0x81')](_0x3683('0x20f'),_0x45c1b0);loggerPredictive['info'](_0x3683('0x210'),_0x5b0ad5);loggerPredictive['info']('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',_0x52b636);loggerPredictive[_0x3683('0x81')](_0x3683('0x211'),_0x35d815);loggerPredictive[_0x3683('0x81')](_0x3683('0x88'));return new BPromise(function(_0x4b5063,_0xcde425){if(_0x2735bf<=0x0||isNaN(_0x2735bf)){return _0xcde425(msgResponse(_0x3683('0x212'),'Error','m\x20=\x20'+_0x2735bf));}if(_0x5b0ad5<=0x0||isNaN(_0x5b0ad5)){return _0xcde425(msgResponse(_0x3683('0x212'),_0x3683('0x48'),_0x3683('0x213')+_0x5b0ad5));}if(_0x52b636<=0x0||isNaN(_0x52b636)){return _0xcde425(msgResponse(_0x3683('0x212'),_0x3683('0x48'),_0x3683('0x214')+_0x52b636));}if(_0x45c1b0<=0x0||isNaN(_0x45c1b0)){return _0xcde425(msgResponse(_0x3683('0x212'),_0x3683('0x48'),_0x3683('0x215')+_0x45c1b0));}if(_0x35d815<=0x0||isNaN(_0x35d815)){return _0xcde425(msgResponse(_0x3683('0x212'),'Error',_0x3683('0x216')+_0x35d815));}_0x137f2f=_0x137f2f||0x0;var _0x36b6e1=0x1/_0x5b0ad5;var _0x7fc56a=0x0;var _0x518660=0x0;var _0x456388=0x0;var _0x361619=0x0;for(var _0x4b544a=0x0;_0x456388<_0x35d815;_0x4b544a+=0x1){_0x518660=_0x4b544a/_0x45c1b0;_0x7fc56a=(_0x52b636*_0x518660+_0x137f2f)/_0x36b6e1;_0x456388=erlangb(_0x7fc56a,_0x2735bf);_0x361619=_0x7fc56a/_0x2735bf*(0x1-erlangb(_0x7fc56a,_0x2735bf));}return _0x4b5063({'erlangCalls':_0x4b544a,'erlangCallToSecond':_0x45c1b0/_0x4b544a,'erlangAbandonmentRate':_0x456388,'erlangBusyFactor':_0x361619});});};Dialer[_0x3683('0x19')][_0x3683('0x1d9')]=function(_0x29d955,_0x71c667,_0x3f6a1f,_0x71248f,_0xe7f46c,_0x4278b3){loggerPredictive['info'](_0x3683('0x217'));loggerPredictive[_0x3683('0x81')](_0x3683('0x20e'),_0x29d955);loggerPredictive['info'](_0x3683('0x20f'),_0x71c667);loggerPredictive[_0x3683('0x81')](_0x3683('0x210'),_0x3f6a1f);loggerPredictive[_0x3683('0x81')](_0x3683('0x218'),_0x71248f);loggerPredictive[_0x3683('0x81')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xe7f46c);loggerPredictive[_0x3683('0x81')](_0x3683('0x88'));return new BPromise(function(_0x30347b,_0x118cac){if(_0x29d955<=0x0||isNaN(_0x29d955)){return _0x118cac(msgResponse(_0x3683('0x219'),_0x3683('0x48'),_0x3683('0x21a')+_0x29d955));}if(_0x3f6a1f<=0x0||isNaN(_0x3f6a1f)){return _0x118cac(msgResponse(_0x3683('0x219'),_0x3683('0x48'),_0x3683('0x213')+_0x3f6a1f));}if(_0x71248f<=0x0||isNaN(_0x71248f)){return _0x118cac(msgResponse(_0x3683('0x219'),_0x3683('0x48'),_0x3683('0x214')+_0x71248f));}if(_0x71c667<=0x0||isNaN(_0x71c667)){return _0x118cac(msgResponse(_0x3683('0x219'),'Error',_0x3683('0x215')+_0x71c667));}if(_0xe7f46c<=0x0||isNaN(_0xe7f46c)){return _0x118cac(msgResponse(_0x3683('0x219'),_0x3683('0x48'),_0x3683('0x21b')+_0xe7f46c));}_0x4278b3=_0x4278b3||0x0;var _0x1c8b3b=0x1/_0x3f6a1f;var _0x2b7d41=0x0;var _0x3d4d23=0x0;var _0x5a414b=0x0;var _0x410b8f=0x0;for(var _0xa112e2=0x0;_0x410b8f<_0xe7f46c;_0xa112e2+=0x1){_0x3d4d23=_0xa112e2/_0x71c667;_0x2b7d41=(_0x71248f*_0x3d4d23+_0x4278b3)/_0x1c8b3b;_0x5a414b=erlangb(_0x2b7d41,_0x29d955);_0x410b8f=_0x2b7d41/_0x29d955*(0x1-erlangb(_0x2b7d41,_0x29d955));}return _0x30347b({'erlangCalls':_0xa112e2,'erlangCallToSecond':_0x71c667/_0xa112e2,'erlangAbandonmentRate':_0x5a414b,'erlangBusyFactor':_0x410b8f});});};module['exports']=Dialer; \ No newline at end of file +var _0x0a19=['[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','push','Action','command','interval','timezones','indexOf','true','iftime\x20%s,%s','content','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','power','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','loggedIn','checkIfTime','dialGlobalInterval','dialTimezone','[syncCampaigns]','\x5cw{0,','pow','match','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','dialOriginateCallerIdName','XMD-ORIGINATECALLERIDNAME','originatecalleridname','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','getQueue','isSuccess','response','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callProgressDetecting','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','emit','custom:agentnosuchnumber','buildObj','nosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','noanswer','reason\x203\x20ringing\x20no\x20answer','Busy','busy','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','dialAbandonedMaxRetry','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','abandonmentRate','agentBusyFactor','[getDataPredictive]','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','busyFactor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','Agent','log','Contact\x20updated','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','temp','getContactDialerIvr','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','[countReScheduled]\x20','[actionOriginate]\x20','checkIsBlackList','checkContactBlack','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[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','Amax:\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','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]','Ts\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuecallerabandon','syncQueueCallerAbandon','bind','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','Interval','\x20INTERVAL_IS_NULL','Intervals','[ifTime][Action]','stringify','milliseconds','seconds','type','outbound','strategy','answered','pTalking','sumBillable','talking','unmanaged','waiting','dialActive','dialMethod','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','Trunk','active','callerid','voice:queue:%s','voice_queue:save','ivr','format','campaign:ivr:%s','campaign:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','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---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','diff','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','is\x20not\x20active','IS_DISACTIVED','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','isNil','status','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','catch','[checkIsBlackList]\x20','checkIsBlackListIvr','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','CampaignId','[emptyContact][createHistory]','[emptyContact]','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','uniqueid','variable','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerCallsDay','HangupInAMD','membername','AMD','[syncHangupInAMD]','MACHINE','state','Machine','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','VoiceQueueId','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','YYYY-MM-DD\x20HH:mm:ss','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','reason','agent','dialAgiAfterHangupAgent','[syncAgentComplete]','syncAgentConnect','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','agiafterat','dialQueueProject2','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','channel','actionid','locked','stateinterface','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','preview','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]'];(function(_0x5848ab,_0x4f269e){var _0x268f29=function(_0x4f7f14){while(--_0x4f7f14){_0x5848ab['push'](_0x5848ab['shift']());}};_0x268f29(++_0x4f269e);}(_0x0a19,0xf2));var _0x90a1=function(_0xcd0918,_0x56bdf9){_0xcd0918=_0xcd0918-0x0;var _0x250704=_0x0a19[_0xcd0918];return _0x250704;};'use strict';var util=require(_0x90a1('0x0'));var _=require(_0x90a1('0x1'));var BPromise=require('bluebird');var uuid=require(_0x90a1('0x2'));var moment=require(_0x90a1('0x3'));var rr=require('rr');var md5=require(_0x90a1('0x4'));var Redis=require(_0x90a1('0x5'));var ut=require('../preview/util/util');var config=require(_0x90a1('0x6'));var logger=require(_0x90a1('0x7'))(_0x90a1('0x8'));var loggerBooked=require(_0x90a1('0x7'))(_0x90a1('0x9'));var loggerPredictive=require(_0x90a1('0x7'))(_0x90a1('0xa'));var loggerPredictiveCalls=require(_0x90a1('0x7'))(_0x90a1('0xb'));var loggerSyncQueueSummary=require(_0x90a1('0x7'))(_0x90a1('0xc'));var ami=require(_0x90a1('0xd'));config[_0x90a1('0xe')]=_[_0x90a1('0xf')](config[_0x90a1('0xe')],{'host':_0x90a1('0x10'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x90a1('0xe')]));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x90a1('0x11'));var cmHopperHistory=require(_0x90a1('0x12'));var cmHopperBlack=require(_0x90a1('0x13'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0x90a1('0x14'));var History=require(_0x90a1('0x15'));var Final=require(_0x90a1('0x16'));var AgentComplete=require(_0x90a1('0x17'));var QueueCallerAbandon=require(_0x90a1('0x18'));var Hangup=require(_0x90a1('0x19'));var ipAgi=process[_0x90a1('0x1a')][_0x90a1('0x1b')]||_0x90a1('0x1c');var strategy={'rrmemory':_0x90a1('0x1d'),'roundrobin':_0x90a1('0x1e')};var Sequence=function(){};Sequence[_0x90a1('0x1f')][_0x90a1('0x20')]=function(_0x8aeaf8){this['tail']=this[_0x90a1('0x21')]?this[_0x90a1('0x21')][_0x90a1('0x22')](_0x8aeaf8):_0x8aeaf8();};function Dialer(_0x50fd5f,_0x52ebdb){this[_0x90a1('0x23')]=new Sequence();this['preview']=_0x52ebdb;this['voiceQueues']=_0x50fd5f[_0x90a1('0x24')];this['campaigns']=_0x50fd5f[_0x90a1('0x25')];this[_0x90a1('0x26')]=_0x50fd5f[_0x90a1('0x26')];this['trunks']=_0x50fd5f[_0x90a1('0x27')];this[_0x90a1('0x28')]=config[_0x90a1('0x28')]||0x2;this[_0x90a1('0x29')]={};this[_0x90a1('0x2a')]={};this[_0x90a1('0x2b')]={};this[_0x90a1('0x2c')]={};this['optionPredictive']={};this[_0x90a1('0x2d')]={};this[_0x90a1('0x2e')]={};this[_0x90a1('0x2f')]={};this[_0x90a1('0x30')]={};this[_0x90a1('0x31')]={};ami['on']('agentconnect',this['syncAgentConnect']['bind'](this));ami['on'](_0x90a1('0x32'),this[_0x90a1('0x33')][_0x90a1('0x34')](this));ami['on']('originateresponse',this[_0x90a1('0x35')]['bind'](this));ami['on'](_0x90a1('0x36'),this[_0x90a1('0x37')][_0x90a1('0x34')](this));ami['on'](_0x90a1('0x38'),this[_0x90a1('0xc')][_0x90a1('0x34')](this));ami['on'](_0x90a1('0x39'),this[_0x90a1('0x3a')][_0x90a1('0x34')](this));ami['on'](_0x90a1('0x3b'),this[_0x90a1('0x3c')][_0x90a1('0x34')](this));ami['on'](_0x90a1('0x3d'),this[_0x90a1('0x3e')][_0x90a1('0x34')](this));ami['on']('queuemember',this[_0x90a1('0x3f')][_0x90a1('0x34')](this));ami['on'](_0x90a1('0x40'),this[_0x90a1('0x41')][_0x90a1('0x34')](this));this['loopCampaigns']();this[_0x90a1('0x42')]();}function isNotNull(_0x2223b0){return _0x2223b0!==null&&!_[_0x90a1('0x43')](_0x2223b0);}function checkIsLoggedIn(_0x365fe3,_0x21ad33){return function(){if(_0x21ad33<=0x0){_0x365fe3[_0x90a1('0x44')]=_0x90a1('0x45');throw _0x365fe3[_0x90a1('0x46')]+_0x90a1('0x47');}};}function isActive(_0x132b25){return _0x132b25;}function checkIsActive(_0x4315cb,_0x53f9d7){return function(){if(!isActive(_0x53f9d7)){_0x4315cb['message']=_0x90a1('0x48');throw _0x4315cb[_0x90a1('0x46')]+_0x90a1('0x49');}};}function checkInterval(_0x1289f0){return function(){if(!isNotNull(_0x1289f0['Interval'])){_0x1289f0[_0x90a1('0x44')]=_0x90a1('0x4a');throw _0x1289f0[_0x90a1('0x46')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x1289f0[_0x90a1('0x4b')]['Intervals'])){_0x1289f0[_0x90a1('0x44')]=_0x90a1('0x4a');throw _0x1289f0[_0x90a1('0x46')]+_0x90a1('0x4c');}if(!isNotNull(_['isEmpty'](_0x1289f0[_0x90a1('0x4b')][_0x90a1('0x4d')]))){_0x1289f0[_0x90a1('0x44')]=_0x90a1('0x4a');throw _0x1289f0[_0x90a1('0x46')]+_0x90a1('0x4c');}};}function msgResponse(_0x40964c,_0x397ef5,_0x3e0efb){return{'action':_0x40964c,'response':_0x397ef5,'message':_0x3e0efb,'stack':_0x3e0efb};}function myreject(_0x2a27fc){return function(_0x5d33e2){return _0x2a27fc(msgResponse(_0x90a1('0x4e'),'Error',JSON[_0x90a1('0x4f')](_0x5d33e2)));};}function getSeconds(_0x2ee901,_0x5d9750){var _0x5865e7=moment(_0x2ee901)[_0x90a1('0x50')](0x0);var _0x26248c=moment(_0x5d9750)[_0x90a1('0x50')](0x0);return _0x5865e7['diff'](_0x26248c,_0x90a1('0x51'));}function emit(_0x5c3053,_0x5bebdd,_0x4dcc34){io['to'](_0x5c3053)['emit'](_0x5bebdd,_0x4dcc34);}function emitVoiceQueueSummary(_0x3eca15){if(_0x3eca15[_0x90a1('0x52')]===_0x90a1('0x53')){var _0x20db97={'id':_0x3eca15['id'],'name':_0x3eca15['name'],'strategy':_0x3eca15[_0x90a1('0x54')],'answered':_0x3eca15[_0x90a1('0x55')],'available':_0x3eca15['available'],'loggedIn':_0x3eca15['loggedIn'],'pTalking':_0x3eca15[_0x90a1('0x56')],'sumBillable':_0x3eca15[_0x90a1('0x57')],'sumDuration':_0x3eca15['sumDuration'],'sumHoldTime':_0x3eca15['sumHoldTime']||0x0,'talking':_0x3eca15[_0x90a1('0x58')],'total':_0x3eca15['total'],'type':_0x3eca15[_0x90a1('0x52')],'unmanaged':_0x3eca15[_0x90a1('0x59')],'abandoned':_0x3eca15['abandoned'],'waiting':_0x3eca15[_0x90a1('0x5a')],'loggedInDb':_0x3eca15['loggedInDb'],'dialActive':_0x3eca15[_0x90a1('0x5b')],'dialMethod':_0x3eca15[_0x90a1('0x5c')],'dialOriginateCallerIdName':_0x3eca15['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x3eca15['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x3eca15[_0x90a1('0x5d')],'dialPrefix':_0x3eca15['dialPrefix'],'outboundAnswerAgiCallsDay':_0x3eca15[_0x90a1('0x5e')],'outboundAnswerCallsDay':_0x3eca15['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x3eca15[_0x90a1('0x5f')],'outboundBusyCallsDay':_0x3eca15[_0x90a1('0x60')],'outboundCongestionCallsDay':_0x3eca15[_0x90a1('0x61')],'outboundDropCallsDayACS':_0x3eca15['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x3eca15[_0x90a1('0x62')],'outboundDropCallsDayTimeout':_0x3eca15[_0x90a1('0x63')],'outboundNoAnswerCallsDay':_0x3eca15[_0x90a1('0x64')],'outboundNoSuchCallsDay':_0x3eca15['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x3eca15[_0x90a1('0x65')],'outboundReCallsDay':_0x3eca15[_0x90a1('0x66')],'outboundRejectCallsDay':_0x3eca15['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x3eca15[_0x90a1('0x67')],'predictiveIntervalAnsweredCalls':_0x3eca15['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x3eca15[_0x90a1('0x68')],'predictiveIntervalAvgTalktime':_0x3eca15[_0x90a1('0x69')],'predictiveIntervalDroppedCallsCallersExit':_0x3eca15[_0x90a1('0x6a')],'predictiveIntervalDroppedCallsTimeout':_0x3eca15['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x3eca15[_0x90a1('0x6b')],'predictiveIntervalErlangCallsDroppedCalls':_0x3eca15[_0x90a1('0x6c')],'predictiveIntervalHitRate':_0x3eca15[_0x90a1('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x3eca15['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x3eca15[_0x90a1('0x6e')],'predictiveIntervalAvailable':_0x3eca15[_0x90a1('0x6f')],'predictiveIntervalTotalCalls':_0x3eca15[_0x90a1('0x70')],'message':_0x3eca15['message'],'originated':_0x3eca15[_0x90a1('0x71')],'erlangCalls':_0x3eca15[_0x90a1('0x72')],'erlangCallToSecond':_0x3eca15['erlangCallToSecond'],'erlangAbandonmentRate':_0x3eca15[_0x90a1('0x73')],'erlangBusyFactor':_0x3eca15['erlangBusyFactor'],'startPredictive':_0x3eca15[_0x90a1('0x2d')],'startProgressive':_0x3eca15['startProgressive']};if(_0x3eca15[_0x90a1('0x74')]){_0x20db97['Trunk']={'id':_0x3eca15[_0x90a1('0x74')]['id'],'name':_0x3eca15[_0x90a1('0x74')][_0x90a1('0x46')],'active':_0x3eca15[_0x90a1('0x74')][_0x90a1('0x75')],'callerid':_0x3eca15[_0x90a1('0x74')][_0x90a1('0x76')]};}if(_0x3eca15['Interval']){_0x20db97[_0x90a1('0x4b')]={'id':_0x3eca15[_0x90a1('0x4b')]['id'],'name':_0x3eca15[_0x90a1('0x4b')]['name']};}var _0x179bf5=md5(JSON['stringify'](_0x20db97));if(_0x3eca15[_0x90a1('0x4')]!==_0x179bf5){_0x3eca15['md5']=_0x179bf5;emit(util['format'](_0x90a1('0x77'),_0x20db97[_0x90a1('0x46')]),_0x90a1('0x78'),_0x20db97);}}}function emitCampaignSummary(_0x2878ac){if(_0x2878ac[_0x90a1('0x52')]===_0x90a1('0x79')){emit(util[_0x90a1('0x7a')](_0x90a1('0x7b'),_0x2878ac[_0x90a1('0x46')]),_0x90a1('0x7c'),_0x2878ac);}}function checkGetDataPredictive(_0x369f2b){if(isNotNull(_0x369f2b)){if(!_[_0x90a1('0x7d')](_0x369f2b)){loggerPredictive[_0x90a1('0x7e')](_0x90a1('0x7f'));loggerPredictive[_0x90a1('0x7e')](_0x90a1('0x80'),_0x369f2b[_0x90a1('0x70')]);loggerPredictive[_0x90a1('0x7e')](_0x90a1('0x81'),_0x369f2b['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x90a1('0x82'),_0x369f2b[_0x90a1('0x83')]);loggerPredictive[_0x90a1('0x7e')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x369f2b['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info'](_0x90a1('0x84'),_0x369f2b['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x90a1('0x7e')](_0x90a1('0x85'),_0x369f2b['predictiveIntervalAvgTalktime']);loggerPredictive[_0x90a1('0x7e')](_0x90a1('0x86'));if(_0x369f2b[_0x90a1('0x70')]>0x0){if(!_[_0x90a1('0x43')](_0x369f2b['predictiveIntervalAvgTalktime'])&&_0x369f2b[_0x90a1('0x69')]>0x0){return!![];}else{loggerPredictive[_0x90a1('0x7e')](_0x90a1('0x87'));}if(!_[_0x90a1('0x43')](_0x369f2b[_0x90a1('0x68')])&&_0x369f2b[_0x90a1('0x68')]>0x0){return!![];}else{loggerPredictive['info'](_0x90a1('0x88'));}}else{loggerPredictive['info'](_0x90a1('0x89'));}}else{loggerPredictive[_0x90a1('0x7e')](_0x90a1('0x8a'));}}else{loggerPredictive[_0x90a1('0x7e')](_0x90a1('0x8a'));}return![];}function mergeDataErlangB(_0x388293){return function(_0x5939c4){loggerPredictive['info'](_0x90a1('0x8b'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5939c4[_0x90a1('0x72')]);loggerPredictive[_0x90a1('0x7e')](_0x90a1('0x8c'),_0x5939c4[_0x90a1('0x8d')]);loggerPredictive[_0x90a1('0x7e')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5939c4['erlangAbandonmentRate']);loggerPredictive[_0x90a1('0x7e')](_0x90a1('0x8e'),_0x5939c4['erlangBusyFactor']);loggerPredictive['info'](_0x90a1('0x8f'),_0x5939c4[_0x90a1('0x73')]);loggerPredictive[_0x90a1('0x7e')](_0x90a1('0x86'));_[_0x90a1('0x90')](_0x388293,_0x5939c4);};}function getDiff(_0x4ff77c){var _0x4be438=moment()[_0x90a1('0x50')](0x0);var _0x224d4a=moment(_0x4ff77c)['milliseconds'](0x0);return _0x4be438[_0x90a1('0x91')](_0x224d4a,_0x90a1('0x51'));}function ifInterval(_0x45ff12,_0x2a4137){if(_[_0x90a1('0x43')](_0x2a4137)){return![];}if(getDiff(_0x2a4137)<_0x45ff12*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x4fd883){if(isNotNull(_0x4fd883)){if(!_['isUndefined'](_0x4fd883[_0x90a1('0x2e')])){_0x4fd883[_0x90a1('0x2e')]=undefined;loggerPredictive[_0x90a1('0x7e')](_0x4fd883[_0x90a1('0x46')],'clearing\x20variable\x20start\x20progressive');}if(!_['isUndefined'](_0x4fd883[_0x90a1('0x2d')])){_0x4fd883[_0x90a1('0x2d')]=undefined;loggerPredictive['info'](_0x4fd883[_0x90a1('0x46')],_0x90a1('0x92'));}if(!_[_0x90a1('0x43')](_0x4fd883[_0x90a1('0x93')])){clearInterval(_0x4fd883[_0x90a1('0x93')]);_0x4fd883[_0x90a1('0x93')]=undefined;loggerPredictive[_0x90a1('0x7e')](_0x4fd883[_0x90a1('0x46')],_0x90a1('0x94'));}}}function erlangb(_0xcfa171,_0x46f01d){if(_0x46f01d===0x0){return 0x0;}var _0x1625f0=0x1;for(var _0x5d2c41=0x1;_0x5d2c41<=_0x46f01d;_0x5d2c41+=0x1){_0x1625f0=0x1+_0x1625f0*_0x5d2c41/_0xcfa171;}return 0x1/_0x1625f0;}function isVoiceQueueOutbound(_0x54654a){return _0x54654a===_0x90a1('0x53');}function isNotPreview(_0x53376e){return _0x53376e!=='preview';}function isCampaignIvr(_0x18ba4d){return _0x18ba4d===_0x90a1('0x79');}function getCallerId(_0x5d9317,_0x1ac6f9,_0x355d02){if(!_[_0x90a1('0x43')](_0x355d02)&&_0x90a1('0x95')===typeof _0x355d02&&!_[_0x90a1('0x7d')](_0x355d02)){if(!_[_0x90a1('0x43')](_0x1ac6f9)&&'string'===typeof _0x1ac6f9&&!_[_0x90a1('0x7d')](_0x1ac6f9)){return util[_0x90a1('0x7a')]('\x22%s\x22\x20<%s>',_0x1ac6f9,_0x355d02);}return util[_0x90a1('0x7a')](_0x90a1('0x96'),_0x355d02,_0x355d02);}if(!_['isUndefined'](_0x5d9317)&&'string'===typeof _0x5d9317&&!_[_0x90a1('0x7d')](_0x5d9317)){return _0x5d9317;}return _0x90a1('0x97');}function loggerCatchQueueSummary(_0x2af42b,_0x12fa78){return function(_0x1dc1fe){freeVariablesPredictive(_0x12fa78);emitVoiceQueueSummary(_0x12fa78);emitCampaignSummary(_0x12fa78);loggerSyncQueueSummary[_0x90a1('0x98')](_0x2af42b,util[_0x90a1('0x99')](_0x1dc1fe,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x19970a,_0x3404b5){return function(_0x1135f3){loggerPredictive[_0x90a1('0x98')](_0x3404b5[_0x90a1('0x46')],_0x19970a);loggerPredictive[_0x90a1('0x98')](_0x1135f3[_0x90a1('0x9a')]);freeVariablesPredictive(_0x3404b5);};}function loggerCatch(_0x3c9b73){return function(_0x594cb1){logger[_0x90a1('0x98')](_0x3c9b73,util['inspect'](_0x594cb1,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2b2c47){return _0x2b2c47&&!_[_0x90a1('0x43')](_0x2b2c47)&&_0x2b2c47['length']>0x0;}function decremetOriginate(_0x5479f9){if(!_['isUndefined'](_0x5479f9)&&_0x5479f9!==null){if(_0x5479f9[_0x90a1('0x9b')](_0x90a1('0x71'))){if(_0x5479f9['originated']>0x0){_0x5479f9[_0x90a1('0x71')]-=0x1;}else{logger['error'](_0x90a1('0x9c'));}}}else{logger[_0x90a1('0x98')](_0x90a1('0x9d'));}}function checkContactLowerLimitOriginate(_0x5433fa,_0x1f8519,_0x5b0e21){if(_0x1f8519>_0x5b0e21){for(var _0x372372=0x0;_0x372372<_0x1f8519-_0x5b0e21;_0x372372+=0x1){decremetOriginate(_0x5433fa);}}}function loggerGetContactDialer(_0x4a80c2,_0x429f24,_0x5c547a){return function(_0x34989f){checkContactLowerLimitOriginate(_0x429f24,_0x5c547a,0x0);logger[_0x90a1('0x98')](_0x4a80c2,util[_0x90a1('0x99')](_0x34989f,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x509081){return function(_0x204a6b){if(isNotNull(_0x204a6b)&&isNotNull(_0x204a6b[0x0])){if(_0x204a6b[0x0][_0x90a1('0x9e')]>0x0){_0x509081[_0x90a1('0x44')]=_0x90a1('0x9f');logger[_0x90a1('0x7e')](_0x90a1('0xa0')+_0x509081[_0x90a1('0x46')],_0x204a6b[0x0][_0x90a1('0x9e')],_0x90a1('0xa1'));}else{_0x509081[_0x90a1('0x44')]=_0x90a1('0xa2');logger[_0x90a1('0x7e')](_0x90a1('0xa3')+_0x509081['name']);}}};}function notSendMessagesQueue(_0x4ba0a5){if(_0x4ba0a5['sendMessageOneNotActive']){freeVariablesPredictive(_0x4ba0a5);if(_0x4ba0a5[_0x90a1('0x71')]===0x0&&_0x4ba0a5[_0x90a1('0x58')]===0x0&&_0x4ba0a5[_0x90a1('0x5a')]===0x0&&(_0x4ba0a5[_0x90a1('0x56')]||0x0)===0x0){_0x4ba0a5[_0x90a1('0xa4')]=![];_0x4ba0a5[_0x90a1('0xa5')]=0x0;_0x4ba0a5[_0x90a1('0x44')]=_0x90a1('0x48');loggerSyncQueueSummary[_0x90a1('0x98')](_0x90a1('0xa6'),_0x4ba0a5[_0x90a1('0x46')],'is\x20not\x20active');}else{_0x4ba0a5[_0x90a1('0x44')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x90a1('0x98')](_0x90a1('0xa6'),_0x4ba0a5[_0x90a1('0x46')],_0x90a1('0xa7'));}emitVoiceQueueSummary(_0x4ba0a5);}}function notSendMessagesCampaign(_0x5d2446){if(_0x5d2446[_0x90a1('0xa4')]){if(_0x5d2446[_0x90a1('0x71')]===0x0){_0x5d2446['sendMessageOneNotActive']=![];_0x5d2446[_0x90a1('0x44')]=_0x90a1('0x48');loggerSyncQueueSummary[_0x90a1('0x98')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x5d2446[_0x90a1('0x46')],_0x90a1('0xa8'));}else{_0x5d2446['message']=_0x90a1('0xa9');loggerSyncQueueSummary[_0x90a1('0x98')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x5d2446['name'],_0x90a1('0xa7'));}emitCampaignSummary(_0x5d2446);}}function createObjHistory(_0x4892ce,_0x41ae3c,_0x5dcb3e,_0xe31b99,_0x3fa9d4){_0x4892ce[_0x90a1('0x44')]=_0x5dcb3e;var _0x25f5e0=new Action(_0x4892ce,_0x41ae3c);var _0xc7390f=new History(_0x25f5e0);_0xc7390f['state']=_0xe31b99;_0xc7390f[_0x90a1('0xaa')]=_0x3fa9d4;_0xc7390f[_0x90a1('0xab')]=_0x25f5e0[_0x90a1('0xac')];return _0xc7390f;}Dialer[_0x90a1('0x1f')][_0x90a1('0x42')]=function(){var _0x1edb37=this;setInterval(function(){_0x1edb37[_0x90a1('0xad')](_0x1edb37[_0x90a1('0x2c')],_0x90a1('0xae'));_0x1edb37[_0x90a1('0xad')](_0x1edb37[_0x90a1('0x2a')],_0x90a1('0xaf'));},0x32c8);};Dialer[_0x90a1('0x1f')][_0x90a1('0xad')]=function(_0x4e4095,_0xf9938f){var _0x413aad=this;for(var _0x1c6b04 in _0x4e4095){if(_0x4e4095[_0x90a1('0x9b')](_0x1c6b04)){this[_0x90a1('0x23')]['enqueue'](function(){if(!_[_0x90a1('0xb0')](_0x4e4095[_0x1c6b04])){return ami['Action']({'action':_0x90a1('0xb1'),'channel':_0x4e4095[_0x1c6b04]['channel']})['catch'](function(_0x4d9d54){if(_0x4d9d54['message']===_0x90a1('0xb2')){setTimeout(function(){if(_0x4e4095[_0x1c6b04]&&_0x4e4095[_0x1c6b04][_0x90a1('0x52')]!==_0x90a1('0x79')){_0x413aad[_0x90a1('0xb3')](_0x413aad[_0x90a1('0x24')][_0x4e4095[_0x1c6b04][_0x90a1('0xb4')]]);logger['error'](_0x90a1('0xb5'),_0xf9938f,_0x1c6b04,_0x4e4095[_0x1c6b04][_0x90a1('0xb4')]);delete _0x4e4095[_0x1c6b04];}if(_0x4e4095[_0x1c6b04]&&_0x4e4095[_0x1c6b04][_0x90a1('0x52')]===_0x90a1('0x79')){_0x413aad['updateOriginated'](_0x413aad[_0x90a1('0x25')][_0x4e4095[_0x1c6b04][_0x90a1('0xb4')]]);logger[_0x90a1('0x98')](_0x90a1('0xb6'),_0xf9938f,_0x1c6b04,_0x4e4095[_0x1c6b04][_0x90a1('0xb4')]);delete _0x4e4095[_0x1c6b04];}},0x2328);}});}});}}};Dialer['prototype'][_0x90a1('0xb7')]=function(_0x4d258b){return BPromise[_0x90a1('0xb8')]()[_0x90a1('0xb9')](cmHopper[_0x90a1('0xb7')](_0x4d258b))['catch'](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype']['checkIsBlackList']=function(_0xbce4a8){return BPromise[_0x90a1('0xb8')]()['then'](cmHopperBlack['checkIsBlackList'](_0xbce4a8))[_0x90a1('0xba')](loggerCatch(_0x90a1('0xbb')));};Dialer[_0x90a1('0x1f')][_0x90a1('0xbc')]=function(_0x28aa99){return BPromise[_0x90a1('0xb8')]()[_0x90a1('0xb9')](cmHopperBlack[_0x90a1('0xbc')](_0x28aa99))[_0x90a1('0xba')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x90a1('0x1f')]['averageHandleTime']=function(_0x100cf2){return BPromise[_0x90a1('0xb8')]()['then'](cmHopperHistory[_0x90a1('0xbd')](_0x100cf2))[_0x90a1('0xba')](loggerCatch('[averageHandleTime]\x20'));};Dialer['prototype'][_0x90a1('0xbe')]=function(_0x54b23f){return BPromise[_0x90a1('0xb8')]()[_0x90a1('0xb9')](cmHopper[_0x90a1('0xbe')](_0x54b23f))[_0x90a1('0xba')](loggerCatch(_0x90a1('0xbf')));};Dialer[_0x90a1('0x1f')]['unlockContact']=function(_0x41ae58,_0x9a122,_0x1b81fb){return BPromise[_0x90a1('0xb8')]()[_0x90a1('0xb9')](cmHopper[_0x90a1('0xc0')](_0x41ae58,_0x9a122,_0x1b81fb))[_0x90a1('0xba')](loggerCatch(_0x90a1('0xc1')));};Dialer[_0x90a1('0x1f')][_0x90a1('0xc2')]=function(_0x2b6c10,_0x983991,_0x536997,_0x487861){return BPromise[_0x90a1('0xb8')]()[_0x90a1('0xb9')](cmHopper['getContactDialer'](_0x2b6c10,_0x983991,_0x536997,_0x487861))[_0x90a1('0xba')](loggerCatch(_0x90a1('0xc3')));};Dialer[_0x90a1('0x1f')]['getContactDialerIvr']=function(_0x456e3f,_0x2ea21a,_0x23e5aa){return BPromise[_0x90a1('0xb8')]()[_0x90a1('0xb9')](cmHopper['getContactDialerIvr'](_0x456e3f,_0x2ea21a,_0x23e5aa))[_0x90a1('0xba')](loggerCatch(_0x90a1('0xc3')));};Dialer[_0x90a1('0x1f')][_0x90a1('0xc4')]=function(_0x3aba3b){return BPromise[_0x90a1('0xb8')]()['then'](voiceQueueRt[_0x90a1('0xc4')](_0x3aba3b))[_0x90a1('0xba')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x90a1('0x1f')]['moveContactManagedDialer']=function(_0x1ac43a){return BPromise[_0x90a1('0xb8')]()[_0x90a1('0xb9')](cmHopper[_0x90a1('0xc5')](_0x1ac43a))[_0x90a1('0xba')](loggerCatch(_0x90a1('0xc6')));};Dialer[_0x90a1('0x1f')]['createHistory']=function(_0x483f02){return BPromise[_0x90a1('0xb8')]()['then'](cmHopperHistory[_0x90a1('0xc7')](_0x483f02))[_0x90a1('0xba')](loggerCatch('[createHistory]\x20'));};Dialer[_0x90a1('0x1f')]['updateOriginated']=function(_0xc0aea){if(!_[_0x90a1('0x43')](_0xc0aea)&&_0xc0aea!==null){if(_0xc0aea[_0x90a1('0x9b')](_0x90a1('0x71'))){if(_0xc0aea[_0x90a1('0x71')]>0x0){_0xc0aea['originated']-=0x1;}else{logger[_0x90a1('0x98')](_0x90a1('0xc8'));}}}else{logger[_0x90a1('0x98')](_0x90a1('0xc9'));}};Dialer[_0x90a1('0x1f')][_0x90a1('0xca')]=function(_0x4db049,_0x3de6d8){var _0x39909b=this;return function(_0x1964d8){_0x39909b[_0x90a1('0xb3')](_0x3de6d8);logger[_0x90a1('0x98')](_0x4db049,util[_0x90a1('0x99')](_0x1964d8,{'showHidden':![],'depth':null}));};};Dialer[_0x90a1('0x1f')][_0x90a1('0xcb')]=function(_0x4b893f,_0x125ce7,_0x303a79){var _0xcecf76={'state':0x19,'statedesc':_0x90a1('0xcc')};this[_0x90a1('0xb3')](_0x125ce7);this[_0x90a1('0xcd')](_['merge'](_0xcecf76,_[_0x90a1('0xce')](_0x303a79,[_0x90a1('0xcf'),_0x90a1('0xd0'),_0x90a1('0xd1'),'VoiceQueueId',_0x90a1('0xd2')])),_0x90a1('0xd3'),_0x90a1('0xd4'));logger[_0x90a1('0x98')](_0x4b893f);};Dialer[_0x90a1('0x1f')]['isSuccess']=function(_0xd24b44){return _0xd24b44===_0x90a1('0xd5');};Dialer[_0x90a1('0x1f')][_0x90a1('0xd6')]=function(_0x4f6eb4){return!_[_0x90a1('0x43')](_0x4f6eb4)&&_0x4f6eb4&&!_[_0x90a1('0x43')](_0x4f6eb4[_0x90a1('0x46')])&&!_[_0x90a1('0x43')](_0x4f6eb4['active'])&&_0x4f6eb4['active']&&(this['trunks'][util[_0x90a1('0x7a')](_0x90a1('0xd7'),_0x4f6eb4[_0x90a1('0x46')])]['status']===_0x90a1('0xd8')||this[_0x90a1('0x27')][util[_0x90a1('0x7a')](_0x90a1('0xd7'),_0x4f6eb4[_0x90a1('0x46')])][_0x90a1('0xb1')]===_0x90a1('0xd9'));};Dialer[_0x90a1('0x1f')]['saveInDb']=function(_0x3f7aec,_0x1f91d1,_0x4abf96){this[_0x90a1('0xc7')](_0x3f7aec)[_0x90a1('0xba')](loggerCatch(_0x1f91d1));this[_0x90a1('0xc5')](_0x3f7aec)[_0x90a1('0xba')](loggerCatch(_0x4abf96));};Dialer['prototype'][_0x90a1('0x3e')]=function(_0xce828b){var _0x361bb5=this['uniqueId'][_0xce828b[_0x90a1('0xda')]];var _0x4c90b5;if(!_[_0x90a1('0xb0')](_0xce828b)&&!_[_0x90a1('0xb0')](_0xce828b[_0x90a1('0xdb')])&&!_['isNil'](_0xce828b['variable']['amdstatus'])&&_0xce828b['exten']===_0x90a1('0xdc')&&_0x361bb5){if(_0x361bb5['type']!==_0x90a1('0x79')&&this[_0x90a1('0x24')][_0x361bb5[_0x90a1('0xb4')]][_0x90a1('0xdd')]&&_0xce828b[_0x90a1('0xde')]===_0x90a1('0xdf')){delete this['uniqueId'][_0xce828b[_0x90a1('0xda')]];this[_0x90a1('0xb3')](this[_0x90a1('0x24')][_0x361bb5[_0x90a1('0xb4')]]);this[_0x90a1('0x24')][_0x361bb5[_0x90a1('0xb4')]][_0x90a1('0xe0')]+=0x1;this['voiceQueues'][_0x361bb5['queue']][_0x90a1('0x5e')]+=0x1;_0x4c90b5=new Hangup(_0x361bb5,_0xce828b);_0x4c90b5['state']=0x12;_0x4c90b5['statedesc']=_0x90a1('0xe1');_0x4c90b5[_0x90a1('0xe2')]=_0x90a1('0xe3');this['saveInDb'](_0x4c90b5,'[syncHangupInAMD][createHistory]',_0x90a1('0xe4'));}if(_0x361bb5['type']!==_0x90a1('0x79')&&this[_0x90a1('0x24')][_0x361bb5[_0x90a1('0xb4')]]['dialAMDActive']&&_0xce828b['value']===_0x90a1('0xe5')){var _0x2b58ad=this;return new BPromise(function(_0x19caac,_0x49cc86){delete _0x2b58ad[_0x90a1('0x2c')][_0xce828b[_0x90a1('0xda')]];_0x2b58ad[_0x90a1('0xb3')](_0x2b58ad[_0x90a1('0x24')][_0x361bb5[_0x90a1('0xb4')]]);_0x2b58ad[_0x90a1('0x24')][_0x361bb5[_0x90a1('0xb4')]][_0x90a1('0xe0')]+=0x1;_0x2b58ad[_0x90a1('0x24')][_0x361bb5[_0x90a1('0xb4')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x57ba40=_0x2b58ad[_0x90a1('0x24')][_0x361bb5[_0x90a1('0xb4')]];var _0x498eb7=new Hangup(_0x361bb5,_0xce828b);_0x498eb7[_0x90a1('0xe6')]=0x13;_0x498eb7[_0x90a1('0xaa')]=_0x90a1('0xe7');_0x498eb7['membername']=_0x90a1('0xe3');_0x498eb7['countmachineretry']+=0x1;_0x498eb7[_0x90a1('0xe8')]+=0x1;_0x498eb7[_0x90a1('0xe9')]=!![];_0x2b58ad[_0x90a1('0xc7')](_0x498eb7)['catch'](loggerCatch(_0x90a1('0xea')));if(_0x498eb7[_0x90a1('0xeb')]+_0x498eb7[_0x90a1('0xec')]+_0x498eb7[_0x90a1('0xed')]+_0x498eb7[_0x90a1('0xee')]+_0x498eb7[_0x90a1('0xef')]+_0x498eb7[_0x90a1('0xf0')]+_0x498eb7[_0x90a1('0xf1')]+_0x498eb7[_0x90a1('0xf2')]>=_0x57ba40[_0x90a1('0xf3')]){_0x2b58ad[_0x90a1('0xf4')](_0x498eb7,_0x19caac,_0x49cc86,_0x90a1('0xf5'));}else{if(_0x498eb7[_0x90a1('0xf1')]>=_0x57ba40[_0x90a1('0xf6')]){_0x2b58ad[_0x90a1('0xf7')](_0x498eb7,_0x19caac,_0x49cc86,_0x90a1('0xf8'));}else{_0x2b58ad[_0x90a1('0xbe')]({'active':![],'countmachineretry':_0x498eb7[_0x90a1('0xf1')],'scheduledat':moment()[_0x90a1('0xf9')](_0x57ba40[_0x90a1('0xfa')],_0x90a1('0xfb'))[_0x90a1('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x498eb7['ContactId'],'ListId':_0x498eb7['ListId'],'VoiceQueueId':_0x498eb7[_0x90a1('0xfc')]||undefined,'CampaignId':_0x498eb7[_0x90a1('0xd2')]||undefined})[_0x90a1('0xba')](loggerCatch(_0x90a1('0xfd')));_0x19caac({'reschedule':0x1});}}});}if(_0x361bb5['type']===_0x90a1('0x79')&&this[_0x90a1('0x25')][_0x361bb5[_0x90a1('0xb4')]][_0x90a1('0xdd')]&&_0xce828b[_0x90a1('0xde')]===_0x90a1('0xdf')){delete this[_0x90a1('0x2c')][_0xce828b[_0x90a1('0xda')]];this[_0x90a1('0xb3')](this[_0x90a1('0x25')][_0x361bb5[_0x90a1('0xb4')]]);_0x4c90b5=new Hangup(_0x361bb5,_0xce828b);_0x4c90b5[_0x90a1('0xe6')]=0x12;_0x4c90b5[_0x90a1('0xaa')]=_0x90a1('0xe1');_0x4c90b5[_0x90a1('0xe2')]='AMD';this[_0x90a1('0xcd')](_0x4c90b5,'[syncHangupInAMDIvr][createHistory]',_0x90a1('0xfe'));}if(_0x361bb5[_0x90a1('0x52')]===_0x90a1('0x79')&&this[_0x90a1('0x25')][_0x361bb5[_0x90a1('0xb4')]][_0x90a1('0xdd')]&&_0xce828b[_0x90a1('0xde')]===_0x90a1('0xe5')){var _0x2b58ad=this;return new BPromise(function(_0x59c363,_0x385b6e){delete _0x2b58ad[_0x90a1('0x2c')][_0xce828b['uniqueid']];_0x2b58ad[_0x90a1('0xb3')](_0x2b58ad['campaigns'][_0x361bb5[_0x90a1('0xb4')]]);_0x2b58ad[_0x90a1('0x25')][_0x361bb5['queue']][_0x90a1('0xe0')]+=0x1;_0x2b58ad[_0x90a1('0x25')][_0x361bb5['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x521117=_0x2b58ad[_0x90a1('0x25')][_0x361bb5[_0x90a1('0xb4')]];var _0x4ca0d8=new Hangup(_0x361bb5,_0xce828b);_0x4ca0d8[_0x90a1('0xe6')]=0x13;_0x4ca0d8[_0x90a1('0xaa')]=_0x90a1('0xe7');_0x4ca0d8[_0x90a1('0xe2')]='AMD';_0x4ca0d8[_0x90a1('0xf1')]+=0x1;_0x4ca0d8['countglobal']+=0x1;_0x4ca0d8['amd']=!![];_0x2b58ad['createHistory'](_0x4ca0d8)[_0x90a1('0xba')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x4ca0d8[_0x90a1('0xeb')]+_0x4ca0d8['countcongestionretry']+_0x4ca0d8[_0x90a1('0xed')]+_0x4ca0d8[_0x90a1('0xee')]+_0x4ca0d8[_0x90a1('0xef')]+_0x4ca0d8['countabandonedretry']+_0x4ca0d8[_0x90a1('0xf1')]+_0x4ca0d8[_0x90a1('0xf2')]>=_0x521117['dialGlobalMaxRetry']){_0x2b58ad['stateGlobal'](_0x4ca0d8,_0x59c363,_0x385b6e,_0x90a1('0xf5'));}else{if(_0x4ca0d8[_0x90a1('0xf1')]>=_0x521117[_0x90a1('0xf6')]){_0x2b58ad[_0x90a1('0xf7')](_0x4ca0d8,_0x59c363,_0x385b6e,_0x90a1('0xf8'));}else{_0x2b58ad['rescheduleContact']({'active':![],'countmachineretry':_0x4ca0d8[_0x90a1('0xf1')],'scheduledat':moment()['add'](_0x521117[_0x90a1('0xfa')],'minutes')[_0x90a1('0x7a')](_0x90a1('0xff')),'ContactId':_0x4ca0d8['ContactId'],'ListId':_0x4ca0d8[_0x90a1('0xd0')],'VoiceQueueId':_0x4ca0d8[_0x90a1('0xfc')]||undefined,'CampaignId':_0x4ca0d8['CampaignId']||undefined})[_0x90a1('0xba')](loggerCatch(_0x90a1('0xfd')));_0x59c363({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x90a1('0x3a')]=function(_0x2ca0e2){var _0xc69f97=this[_0x90a1('0x2c')][_0x2ca0e2[_0x90a1('0xda')]];var _0x2ba21f=this;var _0x23675a;if(_0xc69f97&&_0xc69f97[_0x90a1('0x52')]===_0x90a1('0x79')){delete this['uniqueId'][_0x2ca0e2[_0x90a1('0xda')]];this[_0x90a1('0xb3')](this[_0x90a1('0x25')][_0xc69f97[_0x90a1('0xb4')]]);this[_0x90a1('0x25')][_0xc69f97['queue']]['ivrAnswerCallsDay']+=0x1;_0x23675a=new Hangup(_0xc69f97,_0x2ca0e2);this[_0x90a1('0xc7')](_0x23675a)[_0x90a1('0xba')](loggerCatch(_0x90a1('0x100')));this[_0x90a1('0xc5')](_0x23675a)['catch'](loggerCatch(_0x90a1('0x101')));}if(_0xc69f97&&_0xc69f97['type']!==_0x90a1('0x79')&&isNotNull(this['voiceQueues'][_0xc69f97['queue']][_0x90a1('0x102')])){delete this[_0x90a1('0x2c')][_0x2ca0e2['uniqueid']];this[_0x90a1('0xb3')](this[_0x90a1('0x24')][_0xc69f97[_0x90a1('0xb4')]]);this[_0x90a1('0x24')][_0xc69f97['queue']]['outboundAnswerCallsDay']+=0x1;this[_0x90a1('0x24')][_0xc69f97[_0x90a1('0xb4')]][_0x90a1('0x5e')]+=0x1;_0x23675a=new Hangup(_0xc69f97,_0x2ca0e2);_0x23675a['state']=0x10;_0x23675a['statedesc']=_0x90a1('0x103');_0x23675a[_0x90a1('0xe2')]=_0x90a1('0x104');this[_0x90a1('0xc7')](_0x23675a)[_0x90a1('0xba')](loggerCatch(_0x90a1('0x100')));this['moveContactManagedDialer'](_0x23675a)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0xc69f97&&_0xc69f97['type']!==_0x90a1('0x79')&&!isNotNull(this[_0x90a1('0x24')][_0xc69f97[_0x90a1('0xb4')]][_0x90a1('0x102')])){delete this[_0x90a1('0x2c')][_0x2ca0e2['uniqueid']];this[_0x90a1('0xb3')](this[_0x90a1('0x24')][_0xc69f97[_0x90a1('0xb4')]]);this['voiceQueues'][_0xc69f97[_0x90a1('0xb4')]][_0x90a1('0x67')]+=0x1;_0x23675a=new Hangup(_0xc69f97,_0x2ca0e2);_0x23675a[_0x90a1('0xe6')]=0xc;_0x23675a[_0x90a1('0xaa')]=_0x2ca0e2['cause-txt'];_0x23675a[_0x90a1('0xe2')]='Unknow';this[_0x90a1('0xc7')](_0x23675a)[_0x90a1('0xba')](loggerCatch(_0x90a1('0x100')));this[_0x90a1('0xc5')](_0x23675a)[_0x90a1('0xba')](loggerCatch(_0x90a1('0x101')));}};Dialer[_0x90a1('0x1f')][_0x90a1('0x37')]=function(_0x1430db){var _0x53923b=this[_0x90a1('0x2c')][_0x1430db['uniqueid']];var _0x4be4de=this;if(this[_0x90a1('0x24')][_0x1430db[_0x90a1('0xb4')]]){if(_0x53923b&&_0x53923b[_0x90a1('0x52')]!==_0x90a1('0x79')){delete this[_0x90a1('0x2c')][_0x1430db['uniqueid']];this[_0x90a1('0x24')][_0x1430db[_0x90a1('0xb4')]]['outboundAnswerCallsDay']+=0x1;var _0xf5b08b=new AgentComplete(_0x53923b,_0x1430db);if(_0x1430db[_0x90a1('0x105')]===_0x90a1('0x106')){_0xf5b08b['agiafterat']=this[_0x90a1('0x24')][_0x1430db['queue']]['dialQueueProject2']&&this[_0x90a1('0x24')][_0x1430db[_0x90a1('0xb4')]][_0x90a1('0x107')]?moment()['format'](_0x90a1('0xff')):undefined;}this[_0x90a1('0xc7')](_0xf5b08b)[_0x90a1('0xba')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x90a1('0xc5')](_0xf5b08b)[_0x90a1('0xba')](loggerCatch(_0x90a1('0x108')));}}};Dialer[_0x90a1('0x1f')][_0x90a1('0x109')]=function(_0x286878){if(this['voiceQueues'][_0x286878[_0x90a1('0xb4')]]){if(this[_0x90a1('0x2c')][_0x286878['uniqueid']]&&this[_0x90a1('0x2c')][_0x286878['uniqueid']][_0x90a1('0x52')]!==_0x90a1('0x79')){this[_0x90a1('0xb3')](this[_0x90a1('0x24')][_0x286878[_0x90a1('0xb4')]]);this[_0x90a1('0x2c')][_0x286878[_0x90a1('0xda')]][_0x90a1('0x10a')]=moment()[_0x90a1('0x7a')](_0x90a1('0xff'));}}};Dialer['prototype'][_0x90a1('0x10b')]=function(_0x1441c6){this['createHistory'](_0x1441c6)[_0x90a1('0xba')](loggerCatch(_0x90a1('0x10c')));this['moveContactManagedDialer'](_0x1441c6)[_0x90a1('0xba')](loggerCatch(_0x90a1('0x10d')));};Dialer[_0x90a1('0x1f')]['syncQueueCallerAbandon']=function(_0x490f13){var _0x4daf30=this['uniqueId'][_0x490f13['uniqueid']];var _0x4f36b8=this;if(this[_0x90a1('0x24')][_0x490f13['queue']]){if(_0x4daf30&&_0x4daf30[_0x90a1('0x52')]!==_0x90a1('0x79')){delete this[_0x90a1('0x2c')][_0x490f13[_0x90a1('0xda')]];this[_0x90a1('0xb3')](this[_0x90a1('0x24')][_0x490f13[_0x90a1('0xb4')]]);_0x4daf30[_0x90a1('0x10e')]=moment()[_0x90a1('0x7a')](_0x90a1('0xff'));var _0x1e9aaa=new QueueCallerAbandon(_0x4daf30,_0x490f13);if(getSeconds(_0x4daf30['droptime'],_0x4daf30[_0x90a1('0x10f')])>=_0x4daf30[_0x90a1('0x110')]){this[_0x90a1('0x24')][_0x490f13['queue']][_0x90a1('0x83')]+=0x1;this[_0x90a1('0x24')][_0x490f13[_0x90a1('0xb4')]][_0x90a1('0x63')]+=0x1;this['voiceQueues'][_0x490f13[_0x90a1('0xb4')]][_0x90a1('0x6c')]+=0x1;_0x1e9aaa[_0x90a1('0xe6')]=0xa;_0x1e9aaa['statedesc']=_0x90a1('0x111');_0x1e9aaa[_0x90a1('0x112')]='TIMEOUT';_0x1e9aaa[_0x90a1('0x113')]=this['voiceQueues'][_0x490f13['queue']][_0x90a1('0x114')]?moment()['format'](_0x90a1('0xff')):undefined;_0x1e9aaa[_0x90a1('0xef')]+=0x1;_0x1e9aaa['countglobal']+=0x1;if(_0x1e9aaa['countdropretry']>=this[_0x90a1('0x24')][_0x490f13[_0x90a1('0xb4')]]['dialDropMaxRetry']){this[_0x90a1('0x10b')](_0x1e9aaa);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x1e9aaa[_0x90a1('0xef')],'scheduledat':moment()[_0x90a1('0xf9')](this[_0x90a1('0x24')][_0x490f13[_0x90a1('0xb4')]][_0x90a1('0x115')],_0x90a1('0xfb'))['format'](_0x90a1('0xff')),'ContactId':_0x4daf30[_0x90a1('0xcf')],'ListId':_0x4daf30[_0x90a1('0xd0')],'VoiceQueueId':_0x4daf30[_0x90a1('0xfc')]||undefined,'CampaignId':_0x4daf30[_0x90a1('0xd2')]||undefined})[_0x90a1('0xba')](loggerCatch(_0x90a1('0x116')));var _0x5a946b=new History(_0x1e9aaa);_0x5a946b[_0x90a1('0xe6')]=0xa;_0x5a946b[_0x90a1('0xaa')]=_0x90a1('0x111');_0x5a946b[_0x90a1('0xac')]=moment()[_0x90a1('0x7a')](_0x90a1('0xff'));_0x5a946b['endtime']=_0x5a946b[_0x90a1('0xac')];_0x5a946b['calleridname']=_0x1e9aaa[_0x90a1('0x117')];_0x5a946b['calleridnum']=_0x1e9aaa[_0x90a1('0x118')];this[_0x90a1('0xc7')](_0x5a946b)[_0x90a1('0xba')](loggerCatch(_0x90a1('0x119')));}}else{this[_0x90a1('0x24')][_0x490f13[_0x90a1('0xb4')]][_0x90a1('0x6a')]+=0x1;this['voiceQueues'][_0x490f13[_0x90a1('0xb4')]][_0x90a1('0x62')]+=0x1;_0x1e9aaa[_0x90a1('0xe6')]=0xb;_0x1e9aaa[_0x90a1('0xaa')]=_0x90a1('0x11a');_0x1e9aaa[_0x90a1('0x112')]=_0x90a1('0x11b');_0x1e9aaa['countabandonedretry']+=0x1;_0x1e9aaa[_0x90a1('0xe8')]+=0x1;if(_0x1e9aaa['countabandonedretry']>=this[_0x90a1('0x24')][_0x490f13[_0x90a1('0xb4')]]['dialAbandonedMaxRetry']){this[_0x90a1('0x10b')](_0x1e9aaa);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x1e9aaa[_0x90a1('0xf0')],'scheduledat':moment()[_0x90a1('0xf9')](this[_0x90a1('0x24')][_0x490f13[_0x90a1('0xb4')]][_0x90a1('0x11c')],_0x90a1('0xfb'))[_0x90a1('0x7a')](_0x90a1('0xff')),'ContactId':_0x4daf30[_0x90a1('0xcf')],'ListId':_0x4daf30[_0x90a1('0xd0')],'VoiceQueueId':_0x4daf30['VoiceQueueId']||undefined,'CampaignId':_0x4daf30[_0x90a1('0xd2')]||undefined})[_0x90a1('0xba')](loggerCatch(_0x90a1('0x11d')));var _0x5a946b=new History(_0x1e9aaa);_0x5a946b[_0x90a1('0xe6')]=0xb;_0x5a946b[_0x90a1('0xaa')]=_0x90a1('0x11a');_0x5a946b[_0x90a1('0xac')]=moment()[_0x90a1('0x7a')](_0x90a1('0xff'));_0x5a946b[_0x90a1('0xab')]=_0x5a946b[_0x90a1('0xac')];_0x5a946b['calleridname']=_0x1e9aaa[_0x90a1('0x117')];_0x5a946b['calleridnum']=_0x1e9aaa['calleridnum'];this[_0x90a1('0xc7')](_0x5a946b)[_0x90a1('0xba')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x90a1('0x1f')][_0x90a1('0x3c')]=function(_0x1ae720){if(this[_0x90a1('0x2a')][_0x1ae720[_0x90a1('0xda')]]){this[_0x90a1('0x2a')][_0x1ae720['uniqueid']][_0x90a1('0x11e')]=_0x1ae720['channel'];}if(this[_0x90a1('0x2c')][_0x1ae720[_0x90a1('0xda')]]){this['uniqueId'][_0x1ae720['uniqueid']][_0x90a1('0x11e')]=_0x1ae720[_0x90a1('0x11e')];}};Dialer['prototype'][_0x90a1('0x3f')]=function(_0x3bc3ce){if(strategy[this[_0x90a1('0x24')][this[_0x90a1('0x2a')][_0x3bc3ce[_0x90a1('0x11f')]][_0x90a1('0xb4')]][_0x90a1('0x54')]]===_0x90a1('0x1e')){if(this['actions'][_0x3bc3ce[_0x90a1('0x11f')]]&&_[_0x90a1('0xb0')](this['actions'][_0x3bc3ce[_0x90a1('0x11f')]][_0x90a1('0x120')])&&_0x3bc3ce[_0x90a1('0xb1')]==='1'&&_0x3bc3ce['paused']==='0'){if(this[_0x90a1('0x26')][_0x3bc3ce['stateinterface']]){if(!this[_0x90a1('0x26')][_0x3bc3ce['stateinterface']][_0x90a1('0x120')]){this[_0x90a1('0x26')][_0x3bc3ce[_0x90a1('0x121')]][_0x90a1('0x120')]=!![];this['actions'][_0x3bc3ce[_0x90a1('0x11f')]][_0x90a1('0x120')]=!![];this[_0x90a1('0x2a')][_0x3bc3ce['actionid']][_0x90a1('0x121')]=_0x3bc3ce[_0x90a1('0x121')];}}}}else if((strategy[this[_0x90a1('0x24')][this[_0x90a1('0x2a')][_0x3bc3ce[_0x90a1('0x11f')]][_0x90a1('0xb4')]][_0x90a1('0x54')]]||_0x90a1('0x1d'))===_0x90a1('0x1d')){if(this[_0x90a1('0x2a')][_0x3bc3ce['actionid']]){if(this['agents'][_0x3bc3ce[_0x90a1('0x121')]]){this['actions'][_0x3bc3ce[_0x90a1('0x11f')]]['stateinterface']=_0x3bc3ce['stateinterface'];if(_[_0x90a1('0xb0')](this[_0x90a1('0x30')][this[_0x90a1('0x2a')][_0x3bc3ce[_0x90a1('0x11f')]]['queue']])){this['queueBooked'][this[_0x90a1('0x2a')][_0x3bc3ce['actionid']][_0x90a1('0xb4')]]=[];}this['queueBooked'][this[_0x90a1('0x2a')][_0x3bc3ce[_0x90a1('0x11f')]][_0x90a1('0xb4')]]['push'](_[_0x90a1('0x90')](_[_0x90a1('0xce')](this[_0x90a1('0x2a')][_0x3bc3ce[_0x90a1('0x11f')]],[_0x90a1('0x122'),_0x90a1('0x121')]),{'status':_0x3bc3ce[_0x90a1('0xb1')],'paused':_0x3bc3ce[_0x90a1('0x123')]}));}}}};function unlockQueueStatus(_0x255952,_0x3fe440){setTimeout(function(){if(_['isUndefined'](_0x255952[_0x90a1('0x124')])){loggerBooked[_0x90a1('0x98')](_0x90a1('0x125'),_0x3fe440);}_0x255952['queueStatusComplete']=!![];loggerBooked[_0x90a1('0x7e')](_0x90a1('0x126'),_0x3fe440,JSON[_0x90a1('0x4f')](_[_0x90a1('0xce')](_0x255952,[_0x90a1('0x46'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x90a1('0x1f')][_0x90a1('0x41')]=function(_0x1ef6fe){var _0x2acf93=this;var _0x30f657=_0x2acf93[_0x90a1('0x24')][_0x2acf93[_0x90a1('0x2a')][_0x1ef6fe[_0x90a1('0x11f')]][_0x90a1('0xb4')]];if(strategy[this[_0x90a1('0x24')][this['actions'][_0x1ef6fe[_0x90a1('0x11f')]][_0x90a1('0xb4')]]['strategy']]==='roundrobin'){if(this[_0x90a1('0x2a')][_0x1ef6fe[_0x90a1('0x11f')]]&&this[_0x90a1('0x2a')][_0x1ef6fe['actionid']][_0x90a1('0x121')]){this[_0x90a1('0x127')][_0x90a1('0x128')](this[_0x90a1('0x2a')][_0x1ef6fe[_0x90a1('0x11f')]][_0x90a1('0x122')],this[_0x90a1('0x2a')][_0x1ef6fe[_0x90a1('0x11f')]][_0x90a1('0x121')])[_0x90a1('0xba')](function(_0x21b3f5){logger[_0x90a1('0x98')](_0x90a1('0x129'),util[_0x90a1('0x99')](_0x21b3f5,{'showHidden':![],'depth':null}));})['finally'](function(){_0x2acf93[_0x90a1('0xb3')](_0x2acf93[_0x90a1('0x24')][_0x2acf93[_0x90a1('0x2a')][_0x1ef6fe[_0x90a1('0x11f')]]['queue']]);_0x2acf93[_0x90a1('0x26')][_0x2acf93[_0x90a1('0x2a')][_0x1ef6fe[_0x90a1('0x11f')]]['stateinterface']][_0x90a1('0x120')]=![];delete _0x2acf93['actions'][_0x1ef6fe[_0x90a1('0x11f')]];unlockQueueStatus(_0x30f657);});}else{this[_0x90a1('0xb3')](this['voiceQueues'][this[_0x90a1('0x2a')][_0x1ef6fe[_0x90a1('0x11f')]][_0x90a1('0xb4')]]);this[_0x90a1('0xbe')]({'active':![],'ContactId':this['actions'][_0x1ef6fe['actionid']][_0x90a1('0xcf')],'ListId':this[_0x90a1('0x2a')][_0x1ef6fe[_0x90a1('0x11f')]][_0x90a1('0xd0')],'VoiceQueueId':this[_0x90a1('0x2a')][_0x1ef6fe[_0x90a1('0x11f')]][_0x90a1('0xfc')]||undefined,'CampaignId':this[_0x90a1('0x2a')][_0x1ef6fe[_0x90a1('0x11f')]][_0x90a1('0xd2')]||undefined})[_0x90a1('0xba')](loggerCatch(_0x90a1('0x12a')));delete this['actions'][_0x1ef6fe[_0x90a1('0x11f')]];unlockQueueStatus(_0x30f657);}}else if((strategy[this['voiceQueues'][this['actions'][_0x1ef6fe[_0x90a1('0x11f')]][_0x90a1('0xb4')]][_0x90a1('0x54')]]||_0x90a1('0x1d'))===_0x90a1('0x1d')){var _0x75cc23;if(this[_0x90a1('0x2a')][_0x1ef6fe['actionid']]&&!_[_0x90a1('0x7d')](this['queueBooked'][this[_0x90a1('0x2a')][_0x1ef6fe['actionid']][_0x90a1('0xb4')]])){if(this[_0x90a1('0x31')][_0x2acf93['actions'][_0x1ef6fe['actionid']]['queue']]){this[_0x90a1('0x31')][_0x2acf93[_0x90a1('0x2a')][_0x1ef6fe[_0x90a1('0x11f')]]['queue']]=this[_0x90a1('0x31')][this[_0x90a1('0x2a')][_0x1ef6fe[_0x90a1('0x11f')]][_0x90a1('0xb4')]]?this[_0x90a1('0x31')][this[_0x90a1('0x2a')][_0x1ef6fe[_0x90a1('0x11f')]][_0x90a1('0xb4')]]:this[_0x90a1('0x30')][this[_0x90a1('0x2a')][_0x1ef6fe[_0x90a1('0x11f')]]['queue']]?this['queueBooked'][this[_0x90a1('0x2a')][_0x1ef6fe[_0x90a1('0x11f')]][_0x90a1('0xb4')]][_0x90a1('0x12b')]||0x0:0x0;}this[_0x90a1('0x30')][this[_0x90a1('0x2a')][_0x1ef6fe[_0x90a1('0x11f')]][_0x90a1('0xb4')]][_0x90a1('0x12b')]=this[_0x90a1('0x31')][this[_0x90a1('0x2a')][_0x1ef6fe['actionid']][_0x90a1('0xb4')]];for(var _0x2b919c=0x0;_0x2b919c=0x0?!![]:![];})[_0x90a1('0xba')](myreject(_0x5f0281)));}}else{_0x58f61b[_0x90a1('0x144')](ami['Action']({'action':_0x90a1('0x146'),'command':util['format'](_0x90a1('0x14b'),_0x392129,!_[_0x90a1('0x43')](config[_0x90a1('0x148')][_0x1e6220])?_0x1e6220:'')})[_0x90a1('0xb9')](function(_0x28dbb5){return _0x28dbb5[_0x90a1('0x14c')][_0x90a1('0x149')](_0x90a1('0x14a'))>=0x0?!![]:![];})[_0x90a1('0xba')](myreject(_0x5f0281)));}BPromise[_0x90a1('0x14d')](_0x58f61b)[_0x90a1('0xb9')](function(_0x2330f3){var _0xa1ee06=_[_0x90a1('0x14e')](_0x2330f3);if(_0xa1ee06){return _0x3825d4(_0xa1ee06);}else{_0x51c4c6[_0x90a1('0x44')]=_0x402a98?_0x90a1('0x14f'):_0x90a1('0x150');return _0x5f0281(msgResponse(_0x90a1('0x151'),'Failure',_0x90a1('0x152')+_0x402a98+'\x20'+_0x59962a+_0x90a1('0x153')+util['inspect'](_0x392129,{'showHidden':![],'depth':null})+_0x90a1('0x154')+_0x1e6220));}})[_0x90a1('0xba')](function(_0x53231f){return _0x5f0281(msgResponse(_0x90a1('0x13b'),'Failure',JSON['stringify'](_0x53231f)));});});};Dialer[_0x90a1('0x1f')][_0x90a1('0x155')]=function(_0x538aa7){var _0x5d4e08=this;return function(){switch(_0x538aa7[_0x90a1('0x5c')]){case _0x90a1('0x156'):freeVariablesPredictive(_0x538aa7);_0x5d4e08['handlePower'](_0x538aa7,0x1);break;case _0x90a1('0x157'):freeVariablesPredictive(_0x538aa7);_0x5d4e08[_0x90a1('0x158')](_0x538aa7,_0x538aa7[_0x90a1('0x159')]);break;case _0x90a1('0xa'):_0x5d4e08[_0x90a1('0xa')](_0x538aa7);break;case _0x90a1('0x9'):freeVariablesPredictive(_0x538aa7);_0x5d4e08[_0x90a1('0x158')](_0x538aa7,0x1);break;default:freeVariablesPredictive(_0x538aa7);logger[_0x90a1('0x98')](_0x90a1('0x15a'),_0x538aa7[_0x90a1('0x46')],_0x90a1('0x15b'));}};};Dialer[_0x90a1('0x1f')][_0x90a1('0x15c')]=function(_0x4658cd){var _0x436884=this;return function(){_0x436884[_0x90a1('0x15d')](_0x4658cd);};};Dialer[_0x90a1('0x1f')]['syncQueueSummary']=function(_0x3d3300){var _0xe58ab7=this;if(isNotPreview(_0x3d3300[_0x90a1('0x5c')])){if(isVoiceQueueOutbound(_0x3d3300[_0x90a1('0x52')])&&isActive(_0x3d3300[_0x90a1('0x5b')])){_0x3d3300[_0x90a1('0xa4')]=!![];BPromise['resolve']()[_0x90a1('0xb9')](checkIsLoggedIn(_0x3d3300,_0x3d3300[_0x90a1('0x15e')]))[_0x90a1('0xb9')](checkIsActive(_0x3d3300,_0x3d3300[_0x90a1('0x5b')]))[_0x90a1('0xb9')](checkInterval(_0x3d3300))[_0x90a1('0xb9')](_0xe58ab7[_0x90a1('0x138')](_0x3d3300))[_0x90a1('0xb9')](_0xe58ab7[_0x90a1('0x15f')](_0x3d3300[_0x90a1('0x160')],_0x3d3300[_0x90a1('0x161')],_0x3d3300[_0x90a1('0x46')],_0x3d3300))['then'](_0xe58ab7['checkIfTimeIntervals'](_0x3d3300[_0x90a1('0x4b')],_0x3d3300[_0x90a1('0x161')],_0x3d3300[_0x90a1('0x46')],_0x3d3300))[_0x90a1('0xb9')](_0xe58ab7[_0x90a1('0x155')](_0x3d3300))[_0x90a1('0xba')](loggerCatchQueueSummary('[syncQueueSummary]',_0x3d3300));}else{notSendMessagesQueue(_0x3d3300);}}else{freeVariablesPredictive(_0x3d3300);}};Dialer[_0x90a1('0x1f')][_0x90a1('0x137')]=function(){var _0xb91980=this;var _0x396361;for(var _0x24245d in this[_0x90a1('0x25')]){if(this[_0x90a1('0x25')]['hasOwnProperty'](_0x24245d)){_0x396361=this[_0x90a1('0x25')][_0x24245d];if(isCampaignIvr(_0x396361[_0x90a1('0x52')])&&isActive(_0x396361['active'])){_0x396361[_0x90a1('0xa4')]=!![];BPromise['resolve']()[_0x90a1('0xb9')](checkIsActive(_0x396361,_0x396361[_0x90a1('0x75')]))[_0x90a1('0xb9')](checkInterval(_0x396361))[_0x90a1('0xb9')](_0xb91980[_0x90a1('0x138')](_0x396361))[_0x90a1('0xb9')](_0xb91980[_0x90a1('0x15f')](_0x396361[_0x90a1('0x160')],_0x396361[_0x90a1('0x161')],_0x396361[_0x90a1('0x46')],_0x396361))[_0x90a1('0xb9')](_0xb91980[_0x90a1('0x13c')](_0x396361['Interval'],_0x396361[_0x90a1('0x161')],_0x396361['name'],_0x396361))[_0x90a1('0xb9')](_0xb91980[_0x90a1('0x15c')](_0x396361))[_0x90a1('0xba')](loggerCatchQueueSummary(_0x90a1('0x162'),_0x396361));}else{notSendMessagesCampaign(_0x396361);}}}};function getCallerIdRandom(_0x52d5eb,_0x5742a4){var _0x5551e1,_0x574449,_0x578c26;if(_0x5742a4<=0x0){_0x5742a4=0x1;}_0x5551e1=new RegExp(_0x90a1('0x163')+_0x5742a4+'}$');_0x574449=Math[_0x90a1('0x164')](0xa,_0x5742a4-0x1);_0x578c26=Math[_0x90a1('0x164')](0xa,_0x5742a4)-0x1;return util[_0x90a1('0x7a')]('%s',_['replace'](_0x52d5eb,_0x5551e1,_['random'](_0x574449,_0x578c26)));}function extractCalleridName(_0x2b52f6){var _0x12acc6=_0x2b52f6[_0x90a1('0x165')](/"(.*?)"/);return _0x12acc6?_0x12acc6[0x1]:_0x2b52f6;}function extractCalleridNumber(_0x3c0525){var _0x587cdb=_0x3c0525[_0x90a1('0x165')](/<(.*?)>/);return _0x587cdb?_0x587cdb[0x1]:_0x3c0525;}Dialer[_0x90a1('0x1f')]['actionOriginate']=function(_0x4f3884,_0x7997bc){var _0x3a950d=this;var _0x47ecd0=uuid['v4']();this[_0x90a1('0x2a')][_0x47ecd0]=new Action(_0x4f3884,_0x7997bc,_0x47ecd0);return new BPromise(function(_0x17a927,_0x1593c4){if(_[_0x90a1('0x43')](_0x4f3884)&&_0x90a1('0x166')!==typeof _0x4f3884){return _0x1593c4(msgResponse(_0x90a1('0x167'),_0x90a1('0x13d'),_0x90a1('0x168')));}if(_[_0x90a1('0x43')](_0x7997bc['Contact'][_0x90a1('0x169')])||_0x7997bc['Contact'][_0x90a1('0x169')]===null){return _0x1593c4(msgResponse(_0x90a1('0x167'),_0x90a1('0x13d'),_0x90a1('0x16a')));}var _0x2b34ed={'XMD-CALLERID':_0x3a950d[_0x90a1('0x2a')][_0x47ecd0][_0x90a1('0x16b')](),'XMD-AGI':_0x4f3884[_0x90a1('0x102')]?util[_0x90a1('0x7a')](_0x90a1('0x16c'),ipAgi,_0x4f3884['dialQueueProject']):_0x90a1('0x16d'),'XMD-AGIAFTER':_0x4f3884[_0x90a1('0x114')]?util[_0x90a1('0x7a')](_0x90a1('0x16c'),ipAgi,_0x4f3884[_0x90a1('0x114')]):'NONE','XMD-QUEUE':_0x4f3884[_0x90a1('0x52')]===_0x90a1('0x53')?util['format'](_0x90a1('0x16e'),_0x4f3884['name'],_0x4f3884['dialQueueOptions']||'',_0x4f3884[_0x90a1('0x107')]?'c':'',_0x4f3884['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x7997bc[_0x90a1('0xcf')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x3a950d['actions'][_0x47ecd0][_0x90a1('0x16b')](),'XMD-AMD':_0x4f3884[_0x90a1('0xdd')]?_0x90a1('0x16f'):_0x90a1('0x16d'),'XMD-DESTINATION':_0x90a1('0xdc')};if(_0x4f3884[_0x90a1('0xdd')]){_0x2b34ed[_0x90a1('0x170')]=_0x4f3884[_0x90a1('0x171')]||0x9c4;_0x2b34ed['XMD-AMDGREETING']=_0x4f3884[_0x90a1('0x172')]||0x5dc;_0x2b34ed[_0x90a1('0x173')]=_0x4f3884[_0x90a1('0x174')]||0x320;_0x2b34ed[_0x90a1('0x175')]=_0x4f3884['dialAMDTotalAnalysisTime']||0x1388;_0x2b34ed[_0x90a1('0x176')]=_0x4f3884['dialAMDMinWordLength']||0x64;_0x2b34ed[_0x90a1('0x177')]=_0x4f3884[_0x90a1('0x178')]||0x32;_0x2b34ed[_0x90a1('0x179')]=_0x4f3884[_0x90a1('0x17a')]||0x3;_0x2b34ed[_0x90a1('0x17b')]=_0x4f3884[_0x90a1('0x17c')]||0x100;_0x2b34ed[_0x90a1('0x17d')]=_0x4f3884[_0x90a1('0x17e')]||0x1388;}if(_0x4f3884[_0x90a1('0x52')]===_0x90a1('0x53')){_0x2b34ed[_0x90a1('0x17f')]=_0x7997bc[_0x90a1('0xfc')];}else{_0x2b34ed[_0x90a1('0x180')]=_0x7997bc['CampaignId'];}for(var _0x177bdf in _0x7997bc[_0x90a1('0x181')]){if(_0x7997bc['Contact'][_0x90a1('0x9b')](_0x177bdf)){if(isNotNull(_0x7997bc[_0x90a1('0x181')][_0x177bdf])&&_0x177bdf!=='id'&&_0x177bdf!==_0x90a1('0x182')&&_0x177bdf!=='createdAt'&&_0x177bdf!=='updatedAt'){_0x2b34ed[util[_0x90a1('0x7a')](_0x90a1('0x183'),'XMD-',_[_0x90a1('0x184')](_0x177bdf))]=_0x7997bc[_0x90a1('0x181')][_0x177bdf];}}}var _0x4acbae=_0x3a950d['isTrunkReachable'](_0x4f3884[_0x90a1('0x74')])?getCallerId(_0x4f3884[_0x90a1('0x74')]['callerid'],_0x4f3884['dialOriginateCallerIdName'],_0x4f3884[_0x90a1('0x185')]>0x0?getCallerIdRandom(_0x4f3884[_0x90a1('0x186')],_0x4f3884[_0x90a1('0x185')]):_0x4f3884[_0x90a1('0x186')]):getCallerId(_[_0x90a1('0xb0')](_0x4f3884[_0x90a1('0x187')])?_0x4f3884[_0x90a1('0x74')][_0x90a1('0x76')]:_0x4f3884[_0x90a1('0x187')][_0x90a1('0x76')],_0x4f3884[_0x90a1('0x188')],_0x4f3884[_0x90a1('0x185')]>0x0?getCallerIdRandom(_0x4f3884['dialOriginateCallerIdNumber'],_0x4f3884[_0x90a1('0x185')]):_0x4f3884[_0x90a1('0x186')]);if(_0x4acbae){_0x2b34ed[_0x90a1('0x189')]=_0x3a950d['actions'][_0x47ecd0][_0x90a1('0x18a')]=extractCalleridName(_0x4acbae);_0x2b34ed['XMD-ORIGINATECALLERIDNUM']=_0x3a950d[_0x90a1('0x2a')][_0x47ecd0]['originatecalleridnum']=extractCalleridNumber(_0x4acbae);}return ami[_0x90a1('0x145')]({'actionid':_0x47ecd0,'action':'originate','channel':_0x3a950d['isTrunkReachable'](_0x4f3884[_0x90a1('0x74')])?util[_0x90a1('0x7a')](_0x90a1('0x18b'),_0x4f3884[_0x90a1('0x74')]['name'],isNotNull(_0x4f3884[_0x90a1('0x18c')])?_0x4f3884[_0x90a1('0x18c')][_0x90a1('0x18d')]()||'':'',_0x4f3884['dialCutDigit']>0x0?_0x7997bc[_0x90a1('0x181')][_0x90a1('0x169')]['substring'](_0x4f3884[_0x90a1('0x18e')]):_0x7997bc['Contact'][_0x90a1('0x169')]):util[_0x90a1('0x7a')](_0x90a1('0x18b'),_[_0x90a1('0xb0')](_0x4f3884[_0x90a1('0x187')])?_0x4f3884['Trunk']['name']:_0x4f3884[_0x90a1('0x187')]['name'],isNotNull(_0x4f3884[_0x90a1('0x18c')])?_0x4f3884[_0x90a1('0x18c')][_0x90a1('0x18d')]()||'':'',_0x4f3884['dialCutDigit']>0x0?_0x7997bc[_0x90a1('0x181')][_0x90a1('0x169')][_0x90a1('0x18f')](_0x4f3884['dialCutDigit']):_0x7997bc[_0x90a1('0x181')][_0x90a1('0x169')]),'callerid':_0x4acbae,'Exten':_0x90a1('0xdc'),'Context':_0x90a1('0x190'),'Priority':'1','variable':_0x2b34ed,'timeout':(_0x4f3884[_0x90a1('0x5d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x47ecd0})[_0x90a1('0xb9')](function(_0x15a52a){return _0x17a927(_0x15a52a);})[_0x90a1('0xba')](function(_0x39a1cd){_0x4f3884[_0x90a1('0x65')]+=0x1;var _0x739a65=new History(_0x3a950d[_0x90a1('0x2a')][_0x47ecd0]);logger[_0x90a1('0x98')](util[_0x90a1('0x7a')](_0x90a1('0x191'),JSON[_0x90a1('0x4f')](_0x39a1cd)));_0x739a65[_0x90a1('0xe6')]=0xe;_0x739a65['statedesc']=_0x90a1('0x192');_0x739a65[_0x90a1('0xac')]=moment()[_0x90a1('0x7a')](_0x90a1('0xff'));_0x739a65[_0x90a1('0xab')]=_0x739a65[_0x90a1('0xac')];_0x3a950d['createHistory'](_0x739a65)[_0x90a1('0xba')](loggerCatch(_0x90a1('0x193')));_0x3a950d[_0x90a1('0xc5')](_0x739a65)[_0x90a1('0xba')](loggerCatch(_0x90a1('0x193')))[_0x90a1('0x22')](function(){delete _0x3a950d[_0x90a1('0x2a')][_0x47ecd0];return _0x1593c4(msgResponse(_0x90a1('0x167'),_0x90a1('0x194'),_0x90a1('0x195')));});});});};Dialer[_0x90a1('0x1f')]['syncOriginateResponse']=function(_0x588b23){var _0x3ae3e0=this[_0x90a1('0x2a')][_0x588b23[_0x90a1('0x11f')]];var _0xf59d81=this;if(_0x3ae3e0){delete this[_0x90a1('0x2a')][_0x588b23['actionid']];_0x3ae3e0[_0x90a1('0x10f')]=moment()[_0x90a1('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');var _0x384020=_0x3ae3e0[_0x90a1('0x52')]===_0x90a1('0x79')?this[_0x90a1('0x25')][_0x3ae3e0[_0x90a1('0xb4')]]:this['voiceQueues'][_0x3ae3e0[_0x90a1('0x196')]()];if(!this[_0x90a1('0x197')](_0x588b23[_0x90a1('0x198')])){this['updateOriginated'](_0x384020);return this['callProgressDetecting'](_0x3ae3e0,_0x384020,_0x588b23)[_0x90a1('0xb9')](function(_0x3caf8b){})[_0x90a1('0xba')](loggerCatch(_0x90a1('0x199')));}else{this[_0x90a1('0x2c')][_0x588b23[_0x90a1('0xda')]]=_0x3ae3e0;}}};Dialer['prototype'][_0x90a1('0x19a')]=function(_0x5d6a69,_0x17f9f0,_0x14877d){var _0x1954d5=new History(_0x17f9f0);if(_0x1954d5[_0x90a1('0xeb')]+_0x1954d5[_0x90a1('0xec')]+_0x1954d5[_0x90a1('0xed')]+_0x1954d5[_0x90a1('0xee')]+_0x1954d5[_0x90a1('0xef')]+_0x1954d5[_0x90a1('0xf0')]+_0x1954d5[_0x90a1('0xf1')]+_0x1954d5[_0x90a1('0xf2')]>=_0x14877d[_0x90a1('0xf3')]-0x1){return!![];}switch(_0x5d6a69){case 0x3:if(_0x1954d5['countnoanswerretry']>=_0x14877d[_0x90a1('0x19b')]-0x1){return!![];}else{this[_0x90a1('0xbe')]({'active':![],'countnoanswerretry':_0x1954d5['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x90a1('0xf9')](_0x14877d[_0x90a1('0x19c')],'minutes')[_0x90a1('0x7a')](_0x90a1('0xff')),'ContactId':_0x1954d5['ContactId'],'ListId':_0x1954d5[_0x90a1('0xd0')],'VoiceQueueId':_0x1954d5[_0x90a1('0xfc')]||undefined,'CampaignId':_0x1954d5[_0x90a1('0xd2')]||undefined})[_0x90a1('0xba')](loggerCatch(_0x90a1('0x19d')));}break;case 0x5:if(_0x1954d5[_0x90a1('0xeb')]>=_0x14877d[_0x90a1('0x19e')]-0x1){return!![];}else{this[_0x90a1('0xbe')]({'active':![],'countbusyretry':_0x1954d5[_0x90a1('0xeb')]+=0x1,'scheduledat':moment()[_0x90a1('0xf9')](_0x14877d[_0x90a1('0x19f')],_0x90a1('0xfb'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1954d5[_0x90a1('0xcf')],'ListId':_0x1954d5[_0x90a1('0xd0')],'VoiceQueueId':_0x1954d5[_0x90a1('0xfc')]||undefined,'CampaignId':_0x1954d5['CampaignId']||undefined})['catch'](loggerCatch(_0x90a1('0x1a0')));}break;case 0x8:if(_0x1954d5['countcongestionretry']>=_0x14877d[_0x90a1('0x1a1')]-0x1){return!![];}else{this[_0x90a1('0xbe')]({'active':![],'countcongestionretry':_0x1954d5['countcongestionretry']+=0x1,'scheduledat':moment()[_0x90a1('0xf9')](_0x14877d[_0x90a1('0x1a2')],_0x90a1('0xfb'))[_0x90a1('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1954d5[_0x90a1('0xcf')],'ListId':_0x1954d5['ListId'],'VoiceQueueId':_0x1954d5['VoiceQueueId']||undefined,'CampaignId':_0x1954d5['CampaignId']||undefined})[_0x90a1('0xba')](loggerCatch(_0x90a1('0x1a3')));}break;case 0x0:if(_0x1954d5[_0x90a1('0xee')]>=_0x14877d['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x90a1('0xbe')]({'active':![],'countnosuchnumberretry':_0x1954d5[_0x90a1('0xee')]+=0x1,'scheduledat':moment()['add'](_0x14877d['dialNoSuchNumberRetryFrequency'],'minutes')[_0x90a1('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1954d5[_0x90a1('0xcf')],'ListId':_0x1954d5[_0x90a1('0xd0')],'VoiceQueueId':_0x1954d5[_0x90a1('0xfc')]||undefined,'CampaignId':_0x1954d5['CampaignId']||undefined})[_0x90a1('0xba')](loggerCatch(_0x90a1('0x1a4')));}break;case 0xa:if(_0x1954d5[_0x90a1('0xef')]>=_0x14877d[_0x90a1('0x1a5')]-0x1){return!![];}else{this[_0x90a1('0xbe')]({'active':![],'countdropretry':_0x1954d5[_0x90a1('0xef')]+=0x1,'scheduledat':moment()[_0x90a1('0xf9')](_0x14877d[_0x90a1('0x115')],_0x90a1('0xfb'))[_0x90a1('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1954d5['ContactId'],'ListId':_0x1954d5[_0x90a1('0xd0')],'VoiceQueueId':_0x1954d5['VoiceQueueId']||undefined,'CampaignId':_0x1954d5[_0x90a1('0xd2')]||undefined})['catch'](loggerCatch(_0x90a1('0x116')));}break;case 0xb:if(_0x1954d5[_0x90a1('0xf0')]>=_0x14877d['dialAbandonedMaxRetry']-0x1){return!![];}else{this[_0x90a1('0xbe')]({'active':![],'countabandonedretry':_0x1954d5['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x14877d[_0x90a1('0x11c')],_0x90a1('0xfb'))[_0x90a1('0x7a')](_0x90a1('0xff')),'ContactId':_0x1954d5[_0x90a1('0xcf')],'ListId':_0x1954d5[_0x90a1('0xd0')],'VoiceQueueId':_0x1954d5[_0x90a1('0xfc')]||undefined,'CampaignId':_0x1954d5['CampaignId']||undefined})[_0x90a1('0xba')](loggerCatch(_0x90a1('0x11d')));}break;case 0x13:if(_0x1954d5[_0x90a1('0xf1')]>=_0x14877d['dialMachineMaxRetry']-0x1){return!![];}else{this[_0x90a1('0xbe')]({'active':![],'countmachineretry':_0x1954d5[_0x90a1('0xf1')]+=0x1,'scheduledat':moment()[_0x90a1('0xf9')](_0x14877d['dialMachineRetryFrequency'],'minutes')[_0x90a1('0x7a')](_0x90a1('0xff')),'ContactId':_0x1954d5[_0x90a1('0xcf')],'ListId':_0x1954d5[_0x90a1('0xd0')],'VoiceQueueId':_0x1954d5['VoiceQueueId']||undefined,'CampaignId':_0x1954d5[_0x90a1('0xd2')]||undefined})['catch'](loggerCatch(_0x90a1('0xfd')));}break;case 0x14:if(_0x1954d5[_0x90a1('0xf2')]>=_0x14877d[_0x90a1('0x1a6')]-0x1){return!![];}else{this[_0x90a1('0xbe')]({'active':![],'countagentrejectretry':_0x1954d5['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x90a1('0xf9')](_0x14877d[_0x90a1('0x1a7')],_0x90a1('0xfb'))['format'](_0x90a1('0xff')),'ContactId':_0x1954d5[_0x90a1('0xcf')],'ListId':_0x1954d5[_0x90a1('0xd0')],'VoiceQueueId':_0x1954d5[_0x90a1('0xfc')]||undefined,'CampaignId':_0x1954d5[_0x90a1('0xd2')]||undefined})[_0x90a1('0xba')](loggerCatch('[rescheduleContact][AgentReject]'));}break;default:return!![];}};Dialer[_0x90a1('0x1f')][_0x90a1('0x1a8')]=function(_0x5e3a44,_0x4f66fd,_0x329145){var _0x371619=this;var _0x10c1da=new History(_0x5e3a44);return new BPromise(function(_0x19d959,_0x2b0e8d){if(_['isUndefined'](_0x4f66fd)&&_0x90a1('0x166')!==typeof _0x4f66fd){return _0x2b0e8d(msgResponse('[callProgressDetecting]','Failure',_0x90a1('0x1a9')));}if(_['isUndefined'](_0x329145)&&_0x90a1('0x166')!==typeof _0x329145){return _0x2b0e8d(msgResponse(_0x90a1('0x1aa'),'Failure',_0x90a1('0x1ab')));}switch(_0x329145[_0x90a1('0x105')]){case'0':_0x4f66fd[_0x90a1('0x1ac')]+=0x1;_0x10c1da[_0x90a1('0xe6')]=0x0;_0x10c1da['statedesc']=_0x90a1('0x1ad');_0x10c1da[_0x90a1('0xee')]+=0x1;_0x10c1da['countglobal']+=0x1;ami[_0x90a1('0x1ae')](_0x90a1('0x1af'),ut[_0x90a1('0x1b0')](_0x5e3a44,_0x90a1('0x1b1')));_0x371619[_0x90a1('0xc7')](_0x10c1da)[_0x90a1('0xba')](loggerCatch(_0x90a1('0xea')));if(_0x371619[_0x90a1('0x19a')](0x0,_0x5e3a44,_0x4f66fd)){if(_0x10c1da['countnosuchnumberretry']>=_0x4f66fd[_0x90a1('0x1b2')]){_0x371619[_0x90a1('0xf7')](_0x10c1da,_0x19d959,_0x2b0e8d,_0x90a1('0x1b3'));}else{_0x371619['stateGlobal'](_0x10c1da,_0x19d959,_0x2b0e8d,_0x90a1('0x1b3'));}}break;case'3':_0x4f66fd[_0x90a1('0x64')]+=0x1;_0x10c1da['state']=0x3;_0x10c1da['statedesc']='NoAnswer';_0x10c1da[_0x90a1('0xed')]+=0x1;_0x10c1da[_0x90a1('0xe8')]+=0x1;ami[_0x90a1('0x1ae')](_0x90a1('0x1b4'),ut['buildObj'](_0x5e3a44,_0x90a1('0x1b5')));_0x371619[_0x90a1('0xc7')](_0x10c1da)[_0x90a1('0xba')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x371619['checkRetriveMax'](0x3,_0x5e3a44,_0x4f66fd)){if(_0x10c1da[_0x90a1('0xed')]>=_0x4f66fd[_0x90a1('0x19b')]){_0x371619[_0x90a1('0xf7')](_0x10c1da,_0x19d959,_0x2b0e8d,'reason\x203\x20ringing\x20no\x20answer');}else{_0x371619[_0x90a1('0xf4')](_0x10c1da,_0x19d959,_0x2b0e8d,_0x90a1('0x1b6'));}}break;case'5':_0x4f66fd[_0x90a1('0x60')]+=0x1;_0x10c1da[_0x90a1('0xe6')]=0x5;_0x10c1da[_0x90a1('0xaa')]=_0x90a1('0x1b7');_0x10c1da['countbusyretry']+=0x1;_0x10c1da['countglobal']+=0x1;ami[_0x90a1('0x1ae')]('custom:agentbusy',ut[_0x90a1('0x1b0')](_0x5e3a44,_0x90a1('0x1b8')));_0x371619[_0x90a1('0xc7')](_0x10c1da)[_0x90a1('0xba')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x371619[_0x90a1('0x19a')](0x5,_0x5e3a44,_0x4f66fd)){if(_0x10c1da[_0x90a1('0xeb')]>=_0x4f66fd[_0x90a1('0x19e')]){_0x371619[_0x90a1('0xf7')](_0x10c1da,_0x19d959,_0x2b0e8d,_0x90a1('0x1b9'));}else{_0x371619[_0x90a1('0xf4')](_0x10c1da,_0x19d959,_0x2b0e8d,'reason\x205\x20busy');}}break;case'8':_0x4f66fd['outboundCongestionCallsDay']+=0x1;_0x10c1da['state']=0x8;_0x10c1da[_0x90a1('0xaa')]=_0x90a1('0x1ba');_0x10c1da[_0x90a1('0xec')]+=0x1;_0x10c1da[_0x90a1('0xe8')]+=0x1;ami[_0x90a1('0x1ae')](_0x90a1('0x1bb'),ut[_0x90a1('0x1b0')](_0x5e3a44,_0x90a1('0x1bc')));_0x371619[_0x90a1('0xc7')](_0x10c1da)[_0x90a1('0xba')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x371619[_0x90a1('0x19a')](0x8,_0x5e3a44,_0x4f66fd)){if(_0x10c1da[_0x90a1('0xec')]>=_0x4f66fd['dialCongestionMaxRetry']){_0x371619[_0x90a1('0xf7')](_0x10c1da,_0x19d959,_0x2b0e8d,_0x90a1('0x1bd'));}else{_0x371619['stateGlobal'](_0x10c1da,_0x19d959,_0x2b0e8d,_0x90a1('0x1bd'));}}break;case'11':_0x4f66fd[_0x90a1('0x1be')]+=0x1;_0x10c1da[_0x90a1('0xe6')]=0xb;_0x10c1da[_0x90a1('0xaa')]=_0x90a1('0x11a');_0x10c1da[_0x90a1('0xf0')]+=0x1;_0x10c1da[_0x90a1('0xe8')]+=0x1;_0x371619[_0x90a1('0xc7')](_0x10c1da)['catch'](loggerCatch(_0x90a1('0x1bf')));if(_0x371619['checkRetriveMax'](0xb,_0x5e3a44,_0x4f66fd)){if(_0x10c1da[_0x90a1('0xf0')]>=_0x4f66fd[_0x90a1('0x1c0')]){_0x371619[_0x90a1('0xf7')](_0x10c1da,_0x19d959,_0x2b0e8d,_0x90a1('0x1c1'));}else{_0x371619[_0x90a1('0xf4')](_0x10c1da,_0x19d959,_0x2b0e8d,_0x90a1('0x1c1'));}}break;case'20':_0x4f66fd[_0x90a1('0x1c2')]+=0x1;_0x10c1da[_0x90a1('0xe6')]=0x14;_0x10c1da[_0x90a1('0xaa')]='AgentReject';_0x10c1da[_0x90a1('0xf2')]+=0x1;_0x10c1da['countglobal']+=0x1;ami[_0x90a1('0x1ae')](_0x90a1('0x1c3'),ut[_0x90a1('0x1b0')](_0x5e3a44,_0x90a1('0x1c4')));_0x371619[_0x90a1('0xc7')](_0x10c1da)[_0x90a1('0xba')](loggerCatch(_0x90a1('0x1c5')));if(_0x371619[_0x90a1('0x19a')](0x14,_0x5e3a44,_0x4f66fd)){if(_0x10c1da[_0x90a1('0xf2')]>=_0x4f66fd['dialAgentRejectMaxRetry']){_0x371619[_0x90a1('0xf7')](_0x10c1da,_0x19d959,_0x2b0e8d,_0x90a1('0x1c6'));}else{_0x371619['stateGlobal'](_0x10c1da,_0x19d959,_0x2b0e8d,'reason\x2020\x20agentreject');}}break;default:_0x4f66fd[_0x90a1('0x67')]+=0x1;_0x10c1da[_0x90a1('0xe6')]=0xc;_0x10c1da[_0x90a1('0xaa')]=_0x329145[_0x90a1('0x105')];_0x371619[_0x90a1('0xc7')](_0x10c1da)['catch'](loggerCatch(_0x90a1('0x1c7')));if(_0x371619['checkRetriveMax'](_0x329145[_0x90a1('0x105')],_0x5e3a44,_0x4f66fd)){if(_0x10c1da[_0x90a1('0xeb')]+_0x10c1da[_0x90a1('0xec')]+_0x10c1da[_0x90a1('0xed')]+_0x10c1da[_0x90a1('0xee')]+_0x10c1da[_0x90a1('0xef')]+_0x10c1da[_0x90a1('0xf0')]+_0x10c1da[_0x90a1('0xf1')]+_0x10c1da[_0x90a1('0xf2')]>=_0x4f66fd['dialGlobalMaxRetry']){_0x371619[_0x90a1('0xf4')](_0x10c1da,_0x19d959,_0x2b0e8d,_0x329145['reason']);}else{_0x371619[_0x90a1('0xf7')](_0x10c1da,_0x19d959,_0x2b0e8d,_0x329145[_0x90a1('0x105')]);}}}});};Dialer['prototype'][_0x90a1('0xf4')]=function(_0x5eab46,_0x111069,_0x12fa4b,_0x3df67f){var _0x238193=new Final(_0x5eab46);_0x238193[_0x90a1('0xe6')]=0xf;_0x238193['statedesc']=_0x90a1('0x1c8');this[_0x90a1('0xf7')](_0x238193,_0x111069,_0x12fa4b,_0x3df67f);};Dialer['prototype'][_0x90a1('0xf7')]=function(_0x16bf65,_0xba10a2,_0xd22913,_0x23042d){this[_0x90a1('0xc5')](_0x16bf65)[_0x90a1('0xb9')](function(_0x50aeaa){return _0xba10a2(msgResponse(_0x90a1('0x1aa'),'Success',_0x23042d));})[_0x90a1('0xba')](function(_0x10d97a){return _0xd22913(msgResponse(_0x90a1('0x1c9'),'Failure',_0x90a1('0x1ca')));});};Dialer[_0x90a1('0x1f')]['predictive']=function(_0x594fe9){var _0x197f2d=this;var _0x3216d6=_0x594fe9[_0x90a1('0x1cb')]/0x64;var _0x486a11=_0x594fe9[_0x90a1('0x63')]/(_0x594fe9[_0x90a1('0x63')]+_0x594fe9[_0x90a1('0xe0')]);var _0x135e0d=Math[_0x90a1('0x1cc')](_0x594fe9[_0x90a1('0x6f')]*(_0x594fe9[_0x90a1('0x1cd')]/0x64));var _0xdc0094=Math[_0x90a1('0x1cc')](_0x594fe9[_0x90a1('0x6f')]*(_0x594fe9[_0x90a1('0x1ce')]/0x64));var _0xf682c6=_0x594fe9['available']+_0x594fe9[_0x90a1('0x58')];var _0x22b0f5=Math[_0x90a1('0x1cf')](_0x594fe9[_0x90a1('0x72')]*_0x594fe9[_0x90a1('0x73')]*_0x594fe9[_0x90a1('0x6d')]*_0x594fe9[_0x90a1('0x1d0')]);if(_[_0x90a1('0x43')](_0x594fe9[_0x90a1('0x2e')])){if(!_[_0x90a1('0x43')](_0x594fe9[_0x90a1('0x2d')])){_0x594fe9[_0x90a1('0x2d')]=undefined;loggerPredictive[_0x90a1('0x98')]('[startMethodPredictive][StartProgressive]',_0x90a1('0x1d1'));}if(!_[_0x90a1('0x43')](_0x594fe9[_0x90a1('0x93')])){loggerPredictive['error'](_0x90a1('0x1d2'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x594fe9['handlePredictive']);_0x594fe9['handlePredictive']=undefined;}_0x594fe9['startProgressive']=moment()[_0x90a1('0x7a')](_0x90a1('0xff'));loggerPredictive[_0x90a1('0x7e')](_0x594fe9[_0x90a1('0x46')],_0x90a1('0x1d3'),_0x594fe9['startProgressive']);this[_0x90a1('0x158')](_0x594fe9,0x1);}else if(ifInterval(_0x594fe9[_0x90a1('0x1d4')],_0x594fe9[_0x90a1('0x2e')])){this['handlePower'](_0x594fe9,0x1);loggerPredictiveCalls[_0x90a1('0x7e')](_0x90a1('0x1d5'),_0x594fe9[_0x90a1('0x2e')],_0x594fe9[_0x90a1('0x46')]);_0x594fe9[_0x90a1('0x72')]=0x0;_0x594fe9[_0x90a1('0x6c')]=0x0;}else if(_0x3216d6<_0x486a11&&_0x594fe9[_0x90a1('0x1d6')]===_0x90a1('0x1d7')){freeVariablesPredictive(_0x594fe9);loggerPredictive[_0x90a1('0x7e')](_0x90a1('0x1d8'),_0x90a1('0x1d9'),_0x486a11,'startProgressive',_0x594fe9[_0x90a1('0x46')]);}else if(_0x22b0f5<_0x594fe9[_0x90a1('0x6c')]&&_0x594fe9[_0x90a1('0x1d6')]===_0x90a1('0x1d7')){freeVariablesPredictive(_0x594fe9);loggerPredictive[_0x90a1('0x7e')](_0x90a1('0x1da'),_0x90a1('0x1db'),_0x22b0f5,_0x90a1('0x1dc'),_0x594fe9[_0x90a1('0x6c')],_0x90a1('0x2e'),_0x594fe9['name']);}else if(!ifInterval(_0x594fe9[_0x90a1('0x1d4')],_0x594fe9[_0x90a1('0x2e')])&&_['isUndefined'](_0x594fe9[_0x90a1('0x2d')])&&!_[_0x90a1('0x43')](_0x594fe9['startProgressive'])){_0x594fe9['startPredictive']=moment()[_0x90a1('0x7a')](_0x90a1('0xff'));loggerPredictive['info'](_0x594fe9['name'],_0x90a1('0x1dd'),_0x594fe9[_0x90a1('0x2d')]);this[_0x90a1('0x1de')](_0x594fe9['dialPredictiveInterval'])[_0x90a1('0xb9')](this[_0x90a1('0x1df')](_0x594fe9))['then'](mergeDataErlangB(_0x594fe9))[_0x90a1('0xb9')](this[_0x90a1('0x1e0')](_0x594fe9))[_0x90a1('0xba')](loggerCatchPredictive(_0x90a1('0x1e1'),_0x594fe9));}else if(!ifInterval(_0x594fe9[_0x90a1('0x1d4')],_0x594fe9[_0x90a1('0x2d')])){_0x594fe9[_0x90a1('0x6c')]=0x0;_0x594fe9[_0x90a1('0x2d')]=moment()[_0x90a1('0x7a')](_0x90a1('0xff'));loggerPredictive['info'](_0x594fe9[_0x90a1('0x46')],_0x90a1('0x1e2'),_0x594fe9[_0x90a1('0x2d')]);clearInterval(_0x594fe9[_0x90a1('0x93')]);_0x594fe9[_0x90a1('0x93')]=undefined;this['averageHandleTime'](_0x594fe9[_0x90a1('0x1d4')])[_0x90a1('0xb9')](this[_0x90a1('0x1df')](_0x594fe9))[_0x90a1('0xb9')](mergeDataErlangB(_0x594fe9))[_0x90a1('0xb9')](this[_0x90a1('0x1e0')](_0x594fe9))[_0x90a1('0xba')](loggerCatchPredictive(_0x90a1('0x1e3'),_0x594fe9));}else if(_0x594fe9[_0x90a1('0x6f')]&&_0xf682c6<_0x594fe9[_0x90a1('0x6f')]-_0xdc0094){freeVariablesPredictive(_0x594fe9);loggerPredictive[_0x90a1('0x7e')](_0x594fe9[_0x90a1('0x46')],_0x90a1('0x1e4'),_0xf682c6,')\x20are\x20less\x20than\x20threshold\x20(',_0x594fe9[_0x90a1('0x6f')],'-',_0xdc0094,'=',_0x594fe9[_0x90a1('0x6f')]-_0xdc0094,')');}else if(_0x594fe9[_0x90a1('0x6f')]&&_0xf682c6>_0x594fe9[_0x90a1('0x6f')]+_0x135e0d){freeVariablesPredictive(_0x594fe9);loggerPredictive[_0x90a1('0x7e')](_0x594fe9['name'],_0x90a1('0x1e4'),_0xf682c6,_0x90a1('0x1e5'),_0x594fe9[_0x90a1('0x6f')],'+',_0x135e0d,'=',_0x594fe9[_0x90a1('0x6f')]+_0x135e0d,')');}};Dialer[_0x90a1('0x1f')][_0x90a1('0x1df')]=function(_0x5b00ec){var _0x101491=this;return function(_0x3a78a5){return new BPromise(function(_0x5afde8,_0x1a065a){_[_0x90a1('0x90')](_0x5b00ec,_0x3a78a5[0x0]);if(checkGetDataPredictive(_0x3a78a5[0x0])){var _0x30ba9b=_0x5b00ec['predictiveIntervalAvailable']=_0x5b00ec['talking']+_0x5b00ec['available'];var _0x2926ae=_0x5b00ec[_0x90a1('0x1d4')]*0x3c;var _0x27802d=_0x3a78a5[0x0][_0x90a1('0x69')]+_0x3a78a5[0x0]['predictiveIntervalAvgHoldtime'];var _0x485dc6=(_0x3a78a5[0x0][_0x90a1('0x1e6')]+_0x3a78a5[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x3a78a5[0x0][_0x90a1('0x6a')])/_0x3a78a5[0x0][_0x90a1('0x70')];_0x5b00ec[_0x90a1('0x6d')]=_0x485dc6>0x0?_0x485dc6:0x1;switch(_0x5b00ec[_0x90a1('0x1d6')]){case'dropRate':var _0x123445=_0x5b00ec[_0x90a1('0x1cb')]/0x64;return _0x101491[_0x90a1('0x1e7')](_0x30ba9b,_0x2926ae,_0x27802d,_0x485dc6,_0x123445)[_0x90a1('0xb9')](function(_0x3f58ef){return _0x5afde8(_0x3f58ef);});case _0x90a1('0x1e8'):var _0x36ef43=_0x5b00ec[_0x90a1('0x1cb')]/0x64;return _0x101491['busyFactor'](_0x30ba9b,_0x2926ae,_0x27802d,_0x485dc6,_0x36ef43)[_0x90a1('0xb9')](function(_0xb8afbf){return _0x5afde8(_0xb8afbf);});default:return _0x1a065a(msgResponse('[getDataPredictive]','Failure','Unknown\x20Predictive'));}}else{return _0x1a065a(msgResponse(_0x90a1('0x1e9'),'Failure','check\x20failure'));}});};};Dialer[_0x90a1('0x1f')][_0x90a1('0x1ea')]=function(_0x4949b3){var _0xf4f3e1=this;return function(_0x11bdf8){return new BPromise(function(_0x1a15de,_0x2bdb41){_['merge'](_0x4949b3,_0x11bdf8[0x0]);if(checkGetDataPredictive(_0x11bdf8[0x0])){loggerPredictive['info'](JSON[_0x90a1('0x4f')](_0x11bdf8[0x0]));if(_0x4949b3['dialPredictiveOptimization']===_0x90a1('0x1d7')){return _0xf4f3e1[_0x90a1('0xc4')](_0x4949b3['id'])[_0x90a1('0xb9')](function(_0x19e5c5){var _0x14a3e6=_0x4949b3[_0x90a1('0x15e')]-_0x19e5c5[0x0][_0x90a1('0x1eb')];var _0x4390f5=_0x4949b3[_0x90a1('0x1d4')]*0x3c;var _0x4463ab=_0x11bdf8[0x0]['predictiveIntervalAvgTalktime']+_0x11bdf8[0x0][_0x90a1('0x68')];var _0x5b762d=(_0x11bdf8[0x0][_0x90a1('0x1e6')]+_0x11bdf8[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x11bdf8[0x0][_0x90a1('0x6a')])/_0x11bdf8[0x0][_0x90a1('0x70')];var _0x45b35d=_0x4949b3[_0x90a1('0x1cb')]/0x64;_0x4949b3[_0x90a1('0x6e')]=_0x19e5c5[0x0][_0x90a1('0x1eb')]||0x0;_0x4949b3[_0x90a1('0x6d')]=_0x5b762d>0x0?_0x5b762d:0x1;return _0xf4f3e1['abandonmentRate'](_0x14a3e6,_0x4390f5,_0x4463ab,_0x5b762d,_0x45b35d);})['then'](function(_0x911741){return _0x1a15de(_0x911741);})[_0x90a1('0xba')](function(_0x578769){return _0x2bdb41(msgResponse(_0x90a1('0x1ec'),'Failure',JSON[_0x90a1('0x4f')](_0x578769)));});}if(_0x4949b3[_0x90a1('0x1d6')]===_0x90a1('0x1e8')){return _0xf4f3e1['getVoiceQueueRtPauses'](_0x4949b3['id'])[_0x90a1('0xb9')](function(_0x3bd0af){var _0x45447d=_0x4949b3[_0x90a1('0x15e')]-_0x3bd0af[0x0]['outboundQueuePauses'];var _0x2d86f5=_0x4949b3[_0x90a1('0x1d4')]*0x3c;var _0x24e976=_0x11bdf8[0x0][_0x90a1('0x69')]+_0x11bdf8[0x0][_0x90a1('0x68')];var _0x595b0b=(_0x11bdf8[0x0][_0x90a1('0x1e6')]+_0x11bdf8[0x0][_0x90a1('0x83')]+_0x11bdf8[0x0][_0x90a1('0x6a')])/_0x11bdf8[0x0][_0x90a1('0x70')];var _0x71f035=_0x4949b3['dialPredictiveOptimizationPercentage']/0x64;_0x4949b3[_0x90a1('0x6e')]=_0x3bd0af[0x0][_0x90a1('0x1eb')]||0x0;_0x4949b3['predictiveIntervalHitRate']=_0x595b0b>0x0?_0x595b0b:0x1;return _0xf4f3e1[_0x90a1('0x1ed')](_0x45447d,_0x2d86f5,_0x24e976,_0x595b0b,_0x71f035);})['then'](function(_0x5dc993){return _0x1a15de(_0x5dc993);})[_0x90a1('0xba')](function(_0xe30f55){return _0x2bdb41(msgResponse('[CatchErlangB]','Failure',JSON[_0x90a1('0x4f')](_0xe30f55)));});}}else{return _0x2bdb41(msgResponse(_0x90a1('0x1e9'),'Failure','check\x20failure'));}});};};Dialer[_0x90a1('0x1f')][_0x90a1('0x1e0')]=function(_0x3fd09d){var _0xe58df5=this;return function(){var _0x54aadd=0x0;var _0x1a1d88=Math[_0x90a1('0x1cf')](_0x3fd09d['erlangCallToSecond']*0x3e8);if(_0x1a1d88>0x0){_0x1a1d88=_0x1a1d88<0x64?0x64:_0x1a1d88;loggerPredictive[_0x90a1('0x7e')](_0x3fd09d[_0x90a1('0x46')],_0x90a1('0x1ee'),_0x1a1d88,_0x90a1('0x50'));_0x3fd09d['handlePredictive']=setInterval(function(){_0xe58df5[_0x90a1('0x93')](_0x3fd09d);loggerPredictiveCalls[_0x90a1('0x7e')](_0x90a1('0x1ef'),_0x54aadd+=0x1);},_0x1a1d88);}else{loggerPredictive[_0x90a1('0x7e')](_0x3fd09d['name'],_0x90a1('0x1f0'));}};};Dialer['prototype']['checkContactBlack']=function(_0x2e5225,_0x8d11fe){var _0x508f66=this;return function(_0x4e7b22){if(_[_0x90a1('0x7d')](_0x4e7b22)){if(_[_0x90a1('0xb0')](_0x8d11fe[_0x90a1('0xd1')])||!_0x8d11fe[_0x90a1('0x1f1')]){if(_0x2e5225[_0x90a1('0x5c')]===_0x90a1('0x9')){_0x2e5225[_0x90a1('0x124')]=_['isUndefined'](_0x2e5225[_0x90a1('0x124')])?!![]:_0x2e5225[_0x90a1('0x124')];var _0x4ce514=uuid['v4']();_0x508f66['actions'][_0x4ce514]=new Action(_0x2e5225,_0x8d11fe,_0x4ce514);loggerBooked[_0x90a1('0x7e')](_0x90a1('0x1f2'),_0x4ce514,'queueStatusComplete:\x20',JSON[_0x90a1('0x4f')](_0x2e5225[_0x90a1('0x124')]),_0x90a1('0x1f3'),_0x2e5225[_0x90a1('0x46')]);if(_0x2e5225[_0x90a1('0x124')]){_0x2e5225[_0x90a1('0x124')]=![];_0x508f66[_0x90a1('0x30')][_0x508f66[_0x90a1('0x2a')][_0x4ce514]['queue']]=[];ami[_0x90a1('0x145')]({'actionid':_0x4ce514,'action':_0x90a1('0x1f4'),'queue':_0x2e5225[_0x90a1('0x46')]})[_0x90a1('0xba')](function(_0x5b0b80){_0x508f66[_0x90a1('0xb3')](_0x2e5225);_0x508f66[_0x90a1('0xbe')]({'active':![],'ContactId':_0x508f66[_0x90a1('0x2a')][_0x4ce514][_0x90a1('0xcf')],'ListId':_0x508f66[_0x90a1('0x2a')][_0x4ce514]['ListId'],'VoiceQueueId':_0x508f66[_0x90a1('0x2a')][_0x4ce514][_0x90a1('0xfc')]||undefined,'CampaignId':_0x508f66[_0x90a1('0x2a')][_0x4ce514]['CampaignId']||undefined})[_0x90a1('0xba')](loggerCatch(_0x90a1('0x1f5')));delete _0x508f66[_0x90a1('0x2a')][_0x4ce514];});}else{loggerBooked['info'](_0x90a1('0x1f6'),JSON['stringify'](_0x2e5225['queueStatusComplete']),_0x90a1('0x1f3'),_0x2e5225[_0x90a1('0x46')]);_0x508f66[_0x90a1('0xb3')](_0x2e5225);_0x508f66['rescheduleContact']({'active':![],'ContactId':_0x508f66[_0x90a1('0x2a')][_0x4ce514][_0x90a1('0xcf')],'ListId':_0x508f66[_0x90a1('0x2a')][_0x4ce514][_0x90a1('0xd0')],'VoiceQueueId':_0x508f66[_0x90a1('0x2a')][_0x4ce514][_0x90a1('0xfc')]||undefined,'CampaignId':_0x508f66[_0x90a1('0x2a')][_0x4ce514]['CampaignId']||undefined})[_0x90a1('0xba')](loggerCatch(_0x90a1('0x1f5')));delete _0x508f66[_0x90a1('0x2a')][_0x4ce514];}}else{return _0x508f66[_0x90a1('0x1f7')](_0x2e5225,_0x8d11fe);}}else{if(getDiff(_0x8d11fe[_0x90a1('0x1f8')])<_0x2e5225['dialRecallMeTimeout']*0x3c){if(_0x8d11fe[_0x90a1('0x1f9')]&&!_0x8d11fe[_0x90a1('0x1f9')]['voicePause']){_0x508f66[_0x90a1('0x127')]['run'](_0x8d11fe['id'])[_0x90a1('0x22')](function(){_0x508f66['updateOriginated'](_0x2e5225);});}else{_0x508f66[_0x90a1('0xc0')]({'active':![]},_0x8d11fe['id'],0x1)[_0x90a1('0x22')](function(){console[_0x90a1('0x1fa')](_0x90a1('0x1fb'));_0x508f66['updateOriginated'](_0x2e5225);});}}else{_0x2e5225[_0x90a1('0x66')]+=0x1;_0x508f66[_0x90a1('0xb3')](_0x2e5225);if(_0x2e5225[_0x90a1('0x1fc')]){_0x508f66[_0x90a1('0xbe')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x8d11fe[_0x90a1('0xcf')],'ListId':_0x8d11fe[_0x90a1('0xd0')],'VoiceQueueId':_0x8d11fe[_0x90a1('0xfc')]||undefined,'CampaignId':_0x8d11fe[_0x90a1('0xd2')]||undefined})[_0x90a1('0xba')](loggerCatch(_0x90a1('0x1fd')));_0x508f66[_0x90a1('0xc7')](createObjHistory(_0x2e5225,_0x8d11fe,'RECALLINQUEUE',0x17,_0x90a1('0x1fe')))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x508f66[_0x90a1('0xcd')](createObjHistory(_0x2e5225,_0x8d11fe,'RECALLFAILEDTIMEOUT',0x16,_0x90a1('0x1ff')),_0x90a1('0x200'),'[Originate][HistoryRecallClose]');}}}}else{_0x2e5225[_0x90a1('0x5f')]+=0x1;_0x508f66[_0x90a1('0xcd')](createObjHistory(_0x2e5225,_0x8d11fe,'BLACKLIST',0xd,_0x90a1('0x201')),_0x90a1('0x202'),_0x90a1('0x203'));throw'inBlackList';}};};Dialer[_0x90a1('0x1f')]['handleIvr']=function(_0x3de63f){var _0x440775=this;var _0x7f591=[];var _0x4e7b3b=_0x3de63f[_0x90a1('0x204')]-_0x3de63f[_0x90a1('0x71')]-_0x3de63f['temp'];emitCampaignSummary(_0x3de63f);if(_0x4e7b3b>0x0){if(_0x4e7b3b>this[_0x90a1('0x28')]){_0x4e7b3b=this[_0x90a1('0x28')];}_0x3de63f[_0x90a1('0x205')]+=_0x4e7b3b;this[_0x90a1('0x206')](_0x3de63f['id'],_0x4e7b3b,_0x3de63f[_0x90a1('0x207')])[_0x90a1('0xb9')](function(_0x4c9e4e){_0x3de63f[_0x90a1('0x205')]-=_0x4e7b3b;_0x3de63f[_0x90a1('0x205')]=_0x3de63f[_0x90a1('0x205')]>0x0?_0x3de63f[_0x90a1('0x205')]:0x0;if(!checkContactEmpty(_0x4c9e4e)){_0x3de63f[_0x90a1('0x44')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x90a1('0x7e')]('[getContactCampaign2][Empty]'+_0x3de63f[_0x90a1('0x46')]);}else{_0x3de63f[_0x90a1('0x71')]+=_0x4c9e4e[_0x90a1('0x12c')];_0x3de63f[_0x90a1('0x44')]=_0x90a1('0x208');for(var _0x5045da=0x0;_0x5045da<_0x4c9e4e[_0x90a1('0x12c')];_0x5045da+=0x1){_0x3de63f[_0x90a1('0x209')]+=0x1;if(_[_0x90a1('0xb0')](_0x4c9e4e[_0x5045da])||_[_0x90a1('0xb0')](_0x4c9e4e[_0x5045da]['Contact'])||_[_0x90a1('0xb0')](_0x4c9e4e[_0x5045da][_0x90a1('0x181')][_0x90a1('0x169')])){_0x440775[_0x90a1('0xcb')]('[actionOriginate]\x20',_0x3de63f,_0x4c9e4e[_0x5045da]);}else{_0x440775[_0x90a1('0xbc')](_[_0x90a1('0xce')](_0x4c9e4e[_0x5045da],[_0x90a1('0xd2'),_0x90a1('0x20a')]))[_0x90a1('0xb9')](_0x440775['checkContactBlack'](_0x3de63f,_0x4c9e4e[_0x5045da]))[_0x90a1('0xba')](_0x440775[_0x90a1('0xca')](_0x90a1('0x20b'),_0x3de63f));}}}})[_0x90a1('0xba')](loggerGetContactDialer(_0x90a1('0x20c'),_0x3de63f,_0x4e7b3b));}};Dialer[_0x90a1('0x1f')]['handlePower']=function(_0x4bc29e,_0xff8ff){var _0x310d71=this;var _0x3f2c1d=[];var _0xe67bdf=_0xff8ff>=0x1?_0xff8ff:0x1;var _0x42c9a6=[];if(_0x4bc29e[_0x90a1('0x5c')]===_0x90a1('0x9')){_0xe67bdf=0x1;}var _0x56e388=Math[_0x90a1('0x1cf')](_0x4bc29e['available']*_0xe67bdf)-_0x4bc29e['originated']-_0x4bc29e[_0x90a1('0x205')];emitVoiceQueueSummary(_0x4bc29e);if(_0x4bc29e[_0x90a1('0x20d')]>0x0){var _0x3b6be2=_0x4bc29e['dialLimitQueue']-_0x4bc29e[_0x90a1('0x71')]-_0x4bc29e[_0x90a1('0x58')]-_0x4bc29e[_0x90a1('0x205')]-_0x4bc29e[_0x90a1('0x56')];if(_0x56e388>_0x3b6be2){_0x56e388=_0x3b6be2;}}if(_0x56e388>0x0){if(_0x4bc29e[_0x90a1('0x5c')]===_0x90a1('0x9')){_0x56e388=0x1;}if(_0x56e388>this['maxNumberOriginate']){_0x56e388=this[_0x90a1('0x28')];}_0x4bc29e['temp']+=_0x56e388;for(var _0x10e0f2 in this[_0x90a1('0x26')]){if(this[_0x90a1('0x26')]['hasOwnProperty'](_0x10e0f2)){if(this[_0x90a1('0x26')][_0x10e0f2]['state']==='not_inuse'&&this[_0x90a1('0x26')][_0x10e0f2][_0x90a1('0xb1')]===_0x90a1('0xd8')){_0x3f2c1d[_0x90a1('0x144')](this[_0x90a1('0x26')][_0x10e0f2]['id']);}}}this[_0x90a1('0xc2')](_0x4bc29e['id'],_0x3f2c1d,_0x56e388,_0x4bc29e[_0x90a1('0x207')])[_0x90a1('0xb9')](function(_0x44e2ba){_0x4bc29e[_0x90a1('0x205')]-=_0x56e388;_0x4bc29e[_0x90a1('0x205')]=_0x4bc29e[_0x90a1('0x205')]>0x0?_0x4bc29e[_0x90a1('0x205')]:0x0;if(!checkContactEmpty(_0x44e2ba)){_0x310d71[_0x90a1('0xb7')](_0x4bc29e)['then'](sendMessageReschedule(_0x4bc29e))[_0x90a1('0xba')](loggerCatch(_0x90a1('0x20e')));}else{_0x4bc29e[_0x90a1('0x71')]+=_0x44e2ba[_0x90a1('0x12c')];_0x4bc29e[_0x90a1('0x44')]=_0x4bc29e['dialMethod']==='booked'?_0x90a1('0x16f'):'RUNNING';for(var _0x19749f=0x0;_0x19749f<_0x44e2ba[_0x90a1('0x12c')];_0x19749f+=0x1){if(_[_0x90a1('0xb0')](_0x44e2ba[_0x19749f])||_[_0x90a1('0xb0')](_0x44e2ba[_0x19749f][_0x90a1('0x181')])||_[_0x90a1('0xb0')](_0x44e2ba[_0x19749f]['Contact'][_0x90a1('0x169')])){_0x310d71['emptyContact'](_0x90a1('0x20f'),_0x4bc29e,_0x44e2ba[_0x19749f]);}else{_0x310d71[_0x90a1('0x210')](_['pick'](_0x44e2ba[_0x19749f],[_0x90a1('0xfc'),_0x90a1('0x20a')]))['then'](_0x310d71[_0x90a1('0x211')](_0x4bc29e,_0x44e2ba[_0x19749f]))[_0x90a1('0xba')](_0x310d71['loggerHandler'](_0x90a1('0x20f'),_0x4bc29e));}}}})[_0x90a1('0xba')](loggerGetContactDialer('[getContactDialer2]',_0x4bc29e,_0x56e388));}};Dialer[_0x90a1('0x1f')][_0x90a1('0x93')]=function(_0x87128b){var _0x1cc77d=this;if(_0x87128b[_0x90a1('0x20d')]>0x0){var _0x368075=_0x87128b[_0x90a1('0x20d')]-_0x87128b[_0x90a1('0x71')]-_0x87128b[_0x90a1('0x58')];if(_0x368075>0x0){this[_0x90a1('0x212')](_0x87128b);}else{loggerPredictiveCalls[_0x90a1('0x7e')](_0x90a1('0x213'));}}else{this[_0x90a1('0x212')](_0x87128b);}};Dialer[_0x90a1('0x1f')]['tryOriginatePredictive']=function(_0x2f6ec5){var _0x2fd465=this;var _0x1c4a29=[];_0x2f6ec5[_0x90a1('0x71')]+=0x1;for(var _0x5e801b in this[_0x90a1('0x26')]){if(this['agents'][_0x90a1('0x9b')](_0x5e801b)){if(this[_0x90a1('0x26')][_0x5e801b][_0x90a1('0xe6')]===_0x90a1('0x214')&&this[_0x90a1('0x26')][_0x5e801b][_0x90a1('0xb1')]===_0x90a1('0xd8')){_0x1c4a29['push'](this['agents'][_0x5e801b]['id']);}}}this['getContactDialer'](_0x2f6ec5['id'],_0x1c4a29,0x1,_0x2f6ec5[_0x90a1('0x207')])[_0x90a1('0xb9')](function(_0x1b2133){if(!checkContactEmpty(_0x1b2133)){checkContactLowerLimitOriginate(_0x2f6ec5,0x1,0x0);_0x2fd465['countReScheduled'](_0x2f6ec5)[_0x90a1('0xb9')](sendMessageReschedule(_0x2f6ec5))[_0x90a1('0xba')](loggerCatch(_0x90a1('0x20e')));}else{_0x2f6ec5[_0x90a1('0x44')]=_0x90a1('0x208');if(_['isNil'](_0x1b2133[0x0])||_[_0x90a1('0xb0')](_0x1b2133[0x0]['Contact'])||_[_0x90a1('0xb0')](_0x1b2133[0x0][_0x90a1('0x181')][_0x90a1('0x169')])){_0x2fd465[_0x90a1('0xcb')]('[actionOriginate]\x20',_0x2f6ec5,_0x1b2133[0x0]);}else{_0x2fd465[_0x90a1('0x210')](_[_0x90a1('0xce')](_0x1b2133[0x0],[_0x90a1('0xfc'),'Contact.phone']))[_0x90a1('0xb9')](_0x2fd465[_0x90a1('0x211')](_0x2f6ec5,_0x1b2133[0x0]))[_0x90a1('0xba')](_0x2fd465[_0x90a1('0xca')](_0x90a1('0x215'),_0x2f6ec5));}}})[_0x90a1('0xba')](loggerGetContactDialer(_0x90a1('0x216'),_0x2f6ec5,0x1));emitVoiceQueueSummary(_0x2f6ec5);};Dialer[_0x90a1('0x1f')][_0x90a1('0x1e7')]=function(_0x292b9a,_0x1ac51b,_0x61d430,_0x2dec7e,_0x49c70a,_0x5b4e15){loggerPredictive['info'](_0x90a1('0x217'));loggerPredictive[_0x90a1('0x7e')](_0x90a1('0x218'),_0x292b9a);loggerPredictive[_0x90a1('0x7e')](_0x90a1('0x219'),_0x1ac51b);loggerPredictive[_0x90a1('0x7e')](_0x90a1('0x21a'),_0x61d430);loggerPredictive[_0x90a1('0x7e')](_0x90a1('0x21b'),_0x2dec7e);loggerPredictive[_0x90a1('0x7e')](_0x90a1('0x21c'),_0x49c70a);loggerPredictive[_0x90a1('0x7e')](_0x90a1('0x86'));return new BPromise(function(_0x4513b8,_0x20c238){if(_0x292b9a<=0x0||isNaN(_0x292b9a)){return _0x20c238(msgResponse(_0x90a1('0x21d'),_0x90a1('0x194'),'m\x20=\x20'+_0x292b9a));}if(_0x61d430<=0x0||isNaN(_0x61d430)){return _0x20c238(msgResponse(_0x90a1('0x21d'),_0x90a1('0x194'),'Ts\x20=\x20'+_0x61d430));}if(_0x2dec7e<=0x0||isNaN(_0x2dec7e)){return _0x20c238(msgResponse('[abandonmentRate]','Error',_0x90a1('0x21e')+_0x2dec7e));}if(_0x1ac51b<=0x0||isNaN(_0x1ac51b)){return _0x20c238(msgResponse('[abandonmentRate]',_0x90a1('0x194'),_0x90a1('0x21f')+_0x1ac51b));}if(_0x49c70a<=0x0||isNaN(_0x49c70a)){return _0x20c238(msgResponse(_0x90a1('0x21d'),'Error',_0x90a1('0x220')+_0x49c70a));}_0x5b4e15=_0x5b4e15||0x0;var _0x47b9fd=0x1/_0x61d430;var _0x3794f8=0x0;var _0x19cd79=0x0;var _0x3ea8e2=0x0;var _0x595ba7=0x0;for(var _0x116964=0x0;_0x3ea8e2<_0x49c70a;_0x116964+=0x1){_0x19cd79=_0x116964/_0x1ac51b;_0x3794f8=(_0x2dec7e*_0x19cd79+_0x5b4e15)/_0x47b9fd;_0x3ea8e2=erlangb(_0x3794f8,_0x292b9a);_0x595ba7=_0x3794f8/_0x292b9a*(0x1-erlangb(_0x3794f8,_0x292b9a));}return _0x4513b8({'erlangCalls':_0x116964,'erlangCallToSecond':_0x1ac51b/_0x116964,'erlangAbandonmentRate':_0x3ea8e2,'erlangBusyFactor':_0x595ba7});});};Dialer[_0x90a1('0x1f')][_0x90a1('0x1ed')]=function(_0x217dbb,_0x1229f3,_0x5510cf,_0x2e08c5,_0x3898d3,_0x537c75){loggerPredictive['info'](_0x90a1('0x221'));loggerPredictive[_0x90a1('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',_0x217dbb);loggerPredictive['info'](_0x90a1('0x219'),_0x1229f3);loggerPredictive['info'](_0x90a1('0x21a'),_0x5510cf);loggerPredictive[_0x90a1('0x7e')](_0x90a1('0x21b'),_0x2e08c5);loggerPredictive[_0x90a1('0x7e')](_0x90a1('0x222'),_0x3898d3);loggerPredictive[_0x90a1('0x7e')]('---------------------------');return new BPromise(function(_0x54bafd,_0x2bd6b4){if(_0x217dbb<=0x0||isNaN(_0x217dbb)){return _0x2bd6b4(msgResponse(_0x90a1('0x223'),_0x90a1('0x194'),'m\x20=\x20'+_0x217dbb));}if(_0x5510cf<=0x0||isNaN(_0x5510cf)){return _0x2bd6b4(msgResponse(_0x90a1('0x223'),_0x90a1('0x194'),_0x90a1('0x224')+_0x5510cf));}if(_0x2e08c5<=0x0||isNaN(_0x2e08c5)){return _0x2bd6b4(msgResponse(_0x90a1('0x223'),'Error',_0x90a1('0x21e')+_0x2e08c5));}if(_0x1229f3<=0x0||isNaN(_0x1229f3)){return _0x2bd6b4(msgResponse(_0x90a1('0x223'),_0x90a1('0x194'),_0x90a1('0x21f')+_0x1229f3));}if(_0x3898d3<=0x0||isNaN(_0x3898d3)){return _0x2bd6b4(msgResponse(_0x90a1('0x223'),_0x90a1('0x194'),_0x90a1('0x225')+_0x3898d3));}_0x537c75=_0x537c75||0x0;var _0x4a6ad4=0x1/_0x5510cf;var _0x354dd8=0x0;var _0x1f7bbf=0x0;var _0x3e3379=0x0;var _0x14a45a=0x0;for(var _0x58488a=0x0;_0x14a45a<_0x3898d3;_0x58488a+=0x1){_0x1f7bbf=_0x58488a/_0x1229f3;_0x354dd8=(_0x2e08c5*_0x1f7bbf+_0x537c75)/_0x4a6ad4;_0x3e3379=erlangb(_0x354dd8,_0x217dbb);_0x14a45a=_0x354dd8/_0x217dbb*(0x1-erlangb(_0x354dd8,_0x217dbb));}return _0x54bafd({'erlangCalls':_0x58488a,'erlangCallToSecond':_0x1229f3/_0x58488a,'erlangAbandonmentRate':_0x3e3379,'erlangBusyFactor':_0x14a45a});});};module[_0x90a1('0x226')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 674194d..31466ef 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 _0x901d=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x2301c1,_0x3c5a47){var _0x28f1eb=function(_0x6a6bb){while(--_0x6a6bb){_0x2301c1['push'](_0x2301c1['shift']());}};_0x28f1eb(++_0x3c5a47);}(_0x901d,0xb7));var _0xd901=function(_0x1f2b9a,_0x16f398){_0x1f2b9a=_0x1f2b9a-0x0;var _0x4d12a2=_0x901d[_0x1f2b9a];return _0x4d12a2;};'use strict';var util=require(_0xd901('0x0'));var _=require(_0xd901('0x1'));var moment=require('moment');function getSeconds(_0x51b4a7,_0x50e9df){var _0x182a6c=moment(_0x51b4a7)[_0xd901('0x2')](0x0);var _0xf51780=moment(_0x50e9df)[_0xd901('0x2')](0x0);return _0x182a6c[_0xd901('0x3')](_0xf51780,'seconds');}function QueueCallerAbandon(_0x1e5753,_0x332e38){this[_0xd901('0x4')]=_0x1e5753[_0xd901('0x4')];this[_0xd901('0x5')]=_0x1e5753[_0xd901('0x5')];this['campaigntype']=_0x1e5753[_0xd901('0x5')]===_0xd901('0x6')?_0xd901('0x7'):_0x1e5753[_0xd901('0x5')];this[_0xd901('0x8')]=_0x1e5753[_0xd901('0x8')];this[_0xd901('0x9')]=_0x1e5753[_0xd901('0x9')];this[_0xd901('0xa')]=_0x1e5753[_0xd901('0xa')];this[_0xd901('0xb')]=_0x1e5753[_0xd901('0x8')]+_0x1e5753['countcongestionretry']+_0x1e5753[_0xd901('0xa')]+_0x1e5753['countnosuchnumberretry']+_0x1e5753[_0xd901('0xc')]+_0x1e5753[_0xd901('0xd')]+_0x1e5753[_0xd901('0xe')]+_0x1e5753['countagentrejectretry'];this['countnosuchnumberretry']=_0x1e5753['countnosuchnumberretry'];this[_0xd901('0xc')]=_0x1e5753['countdropretry'];this['countabandonedretry']=_0x1e5753[_0xd901('0xd')];this['countmachineretry']=_0x1e5753[_0xd901('0xe')];this[_0xd901('0xf')]=_0x1e5753['countagentrejectretry'];this['uniqueid']=_0x332e38[_0xd901('0x10')];this[_0xd901('0x11')]=_0x1e5753['name'];this[_0xd901('0x12')]=_0x1e5753[_0xd901('0x13')];this[_0xd901('0x14')]=_0x1e5753[_0xd901('0x14')];this[_0xd901('0x15')]=_0x1e5753[_0xd901('0x15')];this[_0xd901('0x16')]=_0x1e5753[_0xd901('0x16')];this[_0xd901('0x17')]=this[_0xd901('0x16')];this[_0xd901('0x18')]=getSeconds(_0x1e5753[_0xd901('0x15')],_0x1e5753[_0xd901('0x14')]);this[_0xd901('0x19')]=getSeconds(this[_0xd901('0x16')],_0x1e5753[_0xd901('0x15')]);this['talktime']=0x0;this['queue']=_0x332e38[_0xd901('0x7')];this[_0xd901('0x1a')]=_0x332e38[_0xd901('0x1b')];this[_0xd901('0x1c')]=_0x332e38[_0xd901('0x1c')];this[_0xd901('0x1d')]=_0x1e5753['callback'];this[_0xd901('0x1e')]=_0x1e5753[_0xd901('0x1e')];this['callbackat']=_0x1e5753['callbackat'];this[_0xd901('0x1f')]=_0x1e5753[_0xd901('0x1f')];this[_0xd901('0x20')]=_0x1e5753[_0xd901('0x20')];this[_0xd901('0x21')]=_0x1e5753[_0xd901('0x21')];this['UserId']=_0x1e5753['UserId'];this[_0xd901('0x22')]=_0x1e5753['VoiceQueueId'];this[_0xd901('0x23')]=_0x1e5753[_0xd901('0x23')];this[_0xd901('0x24')]=_0x1e5753[_0xd901('0x24')]||'';this[_0xd901('0x25')]=_0x1e5753[_0xd901('0x25')]||'';}module[_0xd901('0x26')]=QueueCallerAbandon; \ No newline at end of file +var _0xcb3f=['countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','queue','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry'];(function(_0x2b49f2,_0x1d443b){var _0x52fa5c=function(_0x53a955){while(--_0x53a955){_0x2b49f2['push'](_0x2b49f2['shift']());}};_0x52fa5c(++_0x1d443b);}(_0xcb3f,0x1ba));var _0xfcb3=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xcb3f[_0x8c43de];return _0xa6591b;};'use strict';var util=require(_0xfcb3('0x0'));var _=require(_0xfcb3('0x1'));var moment=require(_0xfcb3('0x2'));function getSeconds(_0x52574e,_0x2fe328){var _0x5506fb=moment(_0x52574e)[_0xfcb3('0x3')](0x0);var _0x5aabee=moment(_0x2fe328)[_0xfcb3('0x3')](0x0);return _0x5506fb[_0xfcb3('0x4')](_0x5aabee,_0xfcb3('0x5'));}function QueueCallerAbandon(_0x52d263,_0x4bb325){this[_0xfcb3('0x6')]=_0x52d263[_0xfcb3('0x6')];this[_0xfcb3('0x7')]=_0x52d263[_0xfcb3('0x7')];this[_0xfcb3('0x8')]=_0x52d263[_0xfcb3('0x7')]===_0xfcb3('0x9')?'queue':_0x52d263[_0xfcb3('0x7')];this[_0xfcb3('0xa')]=_0x52d263[_0xfcb3('0xa')];this['countcongestionretry']=_0x52d263[_0xfcb3('0xb')];this['countnoanswerretry']=_0x52d263[_0xfcb3('0xc')];this[_0xfcb3('0xd')]=_0x52d263[_0xfcb3('0xa')]+_0x52d263[_0xfcb3('0xb')]+_0x52d263[_0xfcb3('0xc')]+_0x52d263[_0xfcb3('0xe')]+_0x52d263[_0xfcb3('0xf')]+_0x52d263['countabandonedretry']+_0x52d263[_0xfcb3('0x10')]+_0x52d263['countagentrejectretry'];this['countnosuchnumberretry']=_0x52d263[_0xfcb3('0xe')];this[_0xfcb3('0xf')]=_0x52d263[_0xfcb3('0xf')];this[_0xfcb3('0x11')]=_0x52d263['countabandonedretry'];this[_0xfcb3('0x10')]=_0x52d263[_0xfcb3('0x10')];this[_0xfcb3('0x12')]=_0x52d263[_0xfcb3('0x12')];this[_0xfcb3('0x13')]=_0x4bb325[_0xfcb3('0x13')];this[_0xfcb3('0x14')]=_0x52d263[_0xfcb3('0x15')];this[_0xfcb3('0x16')]=_0x52d263[_0xfcb3('0x17')];this[_0xfcb3('0x18')]=_0x52d263[_0xfcb3('0x18')];this[_0xfcb3('0x19')]=_0x52d263[_0xfcb3('0x19')];this[_0xfcb3('0x1a')]=_0x52d263[_0xfcb3('0x1a')];this[_0xfcb3('0x1b')]=this[_0xfcb3('0x1a')];this[_0xfcb3('0x1c')]=getSeconds(_0x52d263[_0xfcb3('0x19')],_0x52d263[_0xfcb3('0x18')]);this[_0xfcb3('0x1d')]=getSeconds(this[_0xfcb3('0x1a')],_0x52d263['responsetime']);this[_0xfcb3('0x1e')]=0x0;this[_0xfcb3('0x1f')]=_0x4bb325[_0xfcb3('0x1f')];this['membername']=_0x4bb325[_0xfcb3('0x20')];this[_0xfcb3('0x21')]=_0x4bb325[_0xfcb3('0x21')];this[_0xfcb3('0x22')]=_0x52d263[_0xfcb3('0x22')];this[_0xfcb3('0x23')]=_0x52d263['callbackuniqueid'];this[_0xfcb3('0x24')]=_0x52d263[_0xfcb3('0x24')];this[_0xfcb3('0x25')]=_0x52d263['recallme'];this[_0xfcb3('0x26')]=_0x52d263[_0xfcb3('0x26')];this[_0xfcb3('0x27')]=_0x52d263['ListId'];this[_0xfcb3('0x28')]=_0x52d263[_0xfcb3('0x28')];this[_0xfcb3('0x29')]=_0x52d263['VoiceQueueId'];this[_0xfcb3('0x2a')]=_0x52d263['CampaignId'];this[_0xfcb3('0x2b')]=_0x52d263['originatecalleridnum']||'';this['originatecalleridname']=_0x52d263[_0xfcb3('0x2c')]||'';}module[_0xfcb3('0x2d')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 581b5a4..aba3290 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 _0x6300=['uniqueid','format','%s/%s/%s','name','fax','localstationid','headerinfo','path','AttachmentId','exports','util','lodash','moment'];(function(_0x251e8c,_0x277c33){var _0x1e0c1d=function(_0x20b89c){while(--_0x20b89c){_0x251e8c['push'](_0x251e8c['shift']());}};_0x1e0c1d(++_0x277c33);}(_0x6300,0x19d));var _0x0630=function(_0x58e2be,_0x26516a){_0x58e2be=_0x58e2be-0x0;var _0x324e60=_0x6300[_0x58e2be];return _0x324e60;};'use strict';var util=require(_0x0630('0x0'));var _=require(_0x0630('0x1'));var moment=require(_0x0630('0x2'));function Action(_0x2a5220,_0x43337d,_0xeefe95){this[_0x0630('0x3')]=_0x2a5220||undefined;this['channel']=util[_0x0630('0x4')](_0x0630('0x5'),_0x43337d['tech'],_0x43337d['Trunk'][_0x0630('0x6')],_0xeefe95[_0x0630('0x7')]);this[_0x0630('0x8')]=_0x43337d[_0x0630('0x8')];this[_0x0630('0x9')]=_0x43337d[_0x0630('0x9')];this[_0x0630('0xa')]=_0xeefe95[_0x0630('0xa')];this[_0x0630('0xb')]=_0xeefe95[_0x0630('0xb')];}module[_0x0630('0xc')]=Action; \ No newline at end of file +var _0xa1a8=['uniqueid','channel','format','%s/%s/%s','name','fax','localstationid','headerinfo','path','AttachmentId','exports','util','moment'];(function(_0x3ddb4e,_0x5d9ecf){var _0x16202e=function(_0x505a25){while(--_0x505a25){_0x3ddb4e['push'](_0x3ddb4e['shift']());}};_0x16202e(++_0x5d9ecf);}(_0xa1a8,0x19e));var _0x8a1a=function(_0x4bcd0a,_0x571d66){_0x4bcd0a=_0x4bcd0a-0x0;var _0x33f945=_0xa1a8[_0x4bcd0a];return _0x33f945;};'use strict';var util=require(_0x8a1a('0x0'));var _=require('lodash');var moment=require(_0x8a1a('0x1'));function Action(_0x4e6fb1,_0x1ecbb7,_0x13cf14){this[_0x8a1a('0x2')]=_0x4e6fb1||undefined;this[_0x8a1a('0x3')]=util[_0x8a1a('0x4')](_0x8a1a('0x5'),_0x1ecbb7['tech'],_0x1ecbb7['Trunk'][_0x8a1a('0x6')],_0x13cf14[_0x8a1a('0x7')]);this[_0x8a1a('0x8')]=_0x1ecbb7[_0x8a1a('0x8')];this['headerinfo']=_0x1ecbb7[_0x8a1a('0x9')];this['path']=_0x13cf14[_0x8a1a('0xa')];this[_0x8a1a('0xb')]=_0x13cf14[_0x8a1a('0xb')];}module[_0x8a1a('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 59c9c4b..2f96c3f 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 _0xc925=['./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','notify','catch','error','stringify','\x20receiveFax\x20','merge','pick','reason','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','checkAfterSend','checkTrunk','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','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0xc925,0xe8));var _0x5c92=function(_0x522a6a,_0x43cf01){_0x522a6a=_0x522a6a-0x0;var _0x55e3df=_0xc925[_0x522a6a];return _0x55e3df;};'use strict';var util=require(_0x5c92('0x0'));var _=require(_0x5c92('0x1'));var BPromise=require(_0x5c92('0x2'));var uuid=require('uuid');var moment=require(_0x5c92('0x3'));var path=require(_0x5c92('0x4'));var tiff2pdf=require(_0x5c92('0x5'));var gs=require(_0x5c92('0x6'));var logger=require(_0x5c92('0x7'))(_0x5c92('0x8'));var ami=require(_0x5c92('0x9'));var rpcDb=require(_0x5c92('0xa'));var Channel=require(_0x5c92('0xb'));var ut=require(_0x5c92('0xc'));var Action=require(_0x5c92('0xd'));var faxAccount=require(_0x5c92('0xe'));var attachment=require(_0x5c92('0xf'));var faxMessage=require(_0x5c92('0x10'));function Fax(_0x188c08){this[_0x5c92('0x11')]={};this[_0x5c92('0x12')]=_0x188c08['faxAccounts'];this[_0x5c92('0x13')]=_0x188c08[_0x5c92('0x13')];this[_0x5c92('0x14')]={};ami['on'](_0x5c92('0x15'),this[_0x5c92('0x16')][_0x5c92('0x17')](this));ami['on'](_0x5c92('0x18'),this[_0x5c92('0x19')][_0x5c92('0x17')](this));ami['on']('newstate',this[_0x5c92('0x1a')][_0x5c92('0x17')](this));ami['on'](_0x5c92('0x1b'),this[_0x5c92('0x1c')]['bind'](this));ami['on'](_0x5c92('0x1d'),this[_0x5c92('0x1e')][_0x5c92('0x17')](this));ami['on']('receivefax',this['syncReceiveFax'][_0x5c92('0x17')](this));ami['on'](_0x5c92('0x1f'),this[_0x5c92('0x20')][_0x5c92('0x17')](this));ami['on'](_0x5c92('0x21'),this[_0x5c92('0x22')][_0x5c92('0x17')](this));}Fax[_0x5c92('0x23')]['syncNewchannel']=function(_0x5c8442){if(_0x5c8442[_0x5c92('0x24')]===_0x5c92('0x25')){for(var _0x250a47 in this['faxAccounts']){if(this[_0x5c92('0x12')][_0x5c92('0x26')](_0x250a47)){if(_0x5c8442[_0x5c92('0x27')]===this[_0x5c92('0x12')][_0x250a47][_0x5c92('0x28')]){this['channels'][_0x5c8442[_0x5c92('0x29')]]={};this[_0x5c92('0x11')][_0x5c8442['uniqueid']]['channel']=_0x5c8442[_0x5c92('0x2a')];this[_0x5c92('0x11')][_0x5c8442[_0x5c92('0x29')]]['id']=this[_0x5c92('0x12')][_0x250a47]['id'];this['channels'][_0x5c8442[_0x5c92('0x29')]][_0x5c92('0x2b')]=this[_0x5c92('0x12')][_0x250a47][_0x5c92('0x2b')];logger[_0x5c92('0x2c')](_0x5c8442['uniqueid'],_0x5c92('0x2d'));}}}}if(this[_0x5c92('0x14')][_0x5c8442[_0x5c92('0x29')]]){this['channels'][_0x5c8442[_0x5c92('0x29')]]={};this[_0x5c92('0x11')][_0x5c8442['uniqueid']][_0x5c92('0x2a')]=_0x5c8442[_0x5c92('0x2a')];logger[_0x5c92('0x2c')](_0x5c8442[_0x5c92('0x29')],_0x5c92('0x2d'));}};Fax['prototype'][_0x5c92('0x19')]=function(_0xbe2e13){if(this['channels'][_0xbe2e13[_0x5c92('0x29')]]){for(var _0xe28d42 in _0xbe2e13[_0x5c92('0x2e')]){if(_0xbe2e13[_0x5c92('0x2e')][_0x5c92('0x26')](_0xe28d42)){this[_0x5c92('0x11')][_0xbe2e13[_0x5c92('0x29')]][_0xe28d42]=_0xbe2e13[_0x5c92('0x2f')];}}}};Fax[_0x5c92('0x23')][_0x5c92('0x1a')]=function(_0x38aaf1){if(this[_0x5c92('0x11')][_0x38aaf1[_0x5c92('0x29')]]){this[_0x5c92('0x11')][_0x38aaf1[_0x5c92('0x29')]][_0x5c92('0x30')]=_0x38aaf1['channelstate'];this[_0x5c92('0x11')][_0x38aaf1['uniqueid']][_0x5c92('0x31')]=_0x38aaf1[_0x5c92('0x31')];}};Fax['prototype'][_0x5c92('0x1c')]=function(_0x3a0ba0){if(this[_0x5c92('0x11')][_0x3a0ba0['uniqueid']]){for(var _0x5062b1 in _0x3a0ba0[_0x5c92('0x2e')]){if(_0x3a0ba0[_0x5c92('0x2e')][_0x5c92('0x26')](_0x5062b1)){this[_0x5c92('0x11')][_0x3a0ba0[_0x5c92('0x29')]][_0x5062b1]=_0x3a0ba0[_0x5c92('0x2f')];}}}};Fax['prototype'][_0x5c92('0x1e')]=function(_0x114497){if(this['channels'][_0x114497['uniqueid']]){this[_0x5c92('0x11')][_0x114497[_0x5c92('0x29')]][_0x5c92('0x32')]=_0x114497[_0x5c92('0x32')];this[_0x5c92('0x11')][_0x114497[_0x5c92('0x29')]][_0x5c92('0x33')]=_0x114497['status'];this[_0x5c92('0x11')][_0x114497[_0x5c92('0x29')]]['localstationid']=_0x114497[_0x5c92('0x28')];this[_0x5c92('0x11')][_0x114497[_0x5c92('0x29')]]['filename']=_0x114497[_0x5c92('0x34')];logger[_0x5c92('0x2c')](_0x114497[_0x5c92('0x29')],_0x5c92('0x35'));}};Fax['prototype'][_0x5c92('0x36')]=function(_0x15f901){var _0x187ad0=this;if(this[_0x5c92('0x11')][_0x15f901['uniqueid']]){var _0x582bef=this[_0x5c92('0x11')][_0x15f901[_0x5c92('0x29')]]['id'];this[_0x5c92('0x11')][_0x15f901[_0x5c92('0x29')]][_0x5c92('0x37')]=_0x15f901['remotestationid'];this[_0x5c92('0x11')][_0x15f901[_0x5c92('0x29')]][_0x5c92('0x38')]=_0x15f901[_0x5c92('0x38')];this['channels'][_0x15f901['uniqueid']][_0x5c92('0x28')]=_0x15f901[_0x5c92('0x28')];this['channels'][_0x15f901['uniqueid']][_0x5c92('0x39')]=_0x15f901[_0x5c92('0x39')];this[_0x5c92('0x11')][_0x15f901[_0x5c92('0x29')]][_0x5c92('0x3a')]=_0x15f901[_0x5c92('0x3a')];this[_0x5c92('0x11')][_0x15f901[_0x5c92('0x29')]][_0x5c92('0x34')]=_0x15f901[_0x5c92('0x34')];this['channels'][_0x15f901['uniqueid']][_0x5c92('0x3b')]=_0x15f901[_0x5c92('0x3b')];if(this['channels'][_0x15f901[_0x5c92('0x29')]][_0x5c92('0x38')]>0x0){tiff2pdf(_0x15f901[_0x5c92('0x34')],_0x5c92('0x3c'),function(_0x858a57){logger[_0x5c92('0x2c')](_0x15f901[_0x5c92('0x29')],_0x5c92('0x3d'),_0x858a57[_0x5c92('0x3e')]);attachment[_0x5c92('0x3f')]({'name':path['parse'](_0x15f901[_0x5c92('0x34')])['name'],'basename':path[_0x5c92('0x40')](_0x15f901[_0x5c92('0x34')])[_0x5c92('0x2b')]+_0x5c92('0x41'),'type':'application/pdf'})[_0x5c92('0x42')](function(_0x4420b7){faxAccount[_0x5c92('0x43')](_0x582bef,{'from':_0x15f901[_0x5c92('0x3b')],'mapKey':_0x5c92('0x8'),'body':path['parse'](_0x15f901[_0x5c92('0x34')])[_0x5c92('0x2b')]+'.pdf','AttachmentId':_0x4420b7['id']})[_0x5c92('0x44')](function(_0x245575){logger[_0x5c92('0x45')](_0x15f901[_0x5c92('0x29')],'\x20notify\x20',JSON[_0x5c92('0x46')](_0x245575));});})['catch'](function(_0x4a35f7){logger[_0x5c92('0x45')](_0x15f901[_0x5c92('0x29')],_0x5c92('0x47'),JSON[_0x5c92('0x46')](_0x4a35f7));});});}logger[_0x5c92('0x2c')](_0x15f901[_0x5c92('0x29')],_0x5c92('0x47'));}};Fax['prototype'][_0x5c92('0x22')]=function(_0x3c8dcb){if(this['actions'][_0x3c8dcb[_0x5c92('0x29')]]){_[_0x5c92('0x48')](this[_0x5c92('0x11')][_0x3c8dcb['uniqueid']],_[_0x5c92('0x49')](_0x3c8dcb,['response',_0x5c92('0x4a')]));}};function updateStatus(_0x2314ec){if(_0x2314ec[_0x5c92('0x4b')]){faxMessage[_0x5c92('0x4c')](_0x2314ec[_0x5c92('0x4b')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x5c92('0x42')](function(_0x4aaf8e){ut[_0x5c92('0x4d')](_0x5c92('0x4e'),_0x4aaf8e);})[_0x5c92('0x44')](function(_0x580d7c){ut[_0x5c92('0x4d')](_0x5c92('0x4f'),_0x580d7c);});}else{ut[_0x5c92('0x4d')](_0x5c92('0x50'));}}Fax[_0x5c92('0x23')][_0x5c92('0x51')]=function(_0x23441e,_0x2c3c1f,_0x3b08be){var _0x54554c=this;var _0x4bec8f={};if(_0x2c3c1f){_0x4bec8f={'read':_0x2c3c1f};}else{_0x4bec8f={'failMessage':_0x3b08be};}if(this[_0x5c92('0x14')][_0x23441e]['AttachmentId']){faxMessage[_0x5c92('0x4c')](this[_0x5c92('0x14')][_0x23441e][_0x5c92('0x4b')],_0x4bec8f)[_0x5c92('0x42')](function(_0x8019da){ut[_0x5c92('0x4d')](_0x5c92('0x52'),_0x8019da);})[_0x5c92('0x44')](function(_0x4d88d0){ut[_0x5c92('0x4d')](_0x5c92('0x53'),_0x4d88d0);})[_0x5c92('0x54')](function(){delete _0x54554c[_0x5c92('0x11')][_0x23441e];delete _0x54554c['actions'][_0x23441e];});}else{ut[_0x5c92('0x4d')](_0x5c92('0x55'));delete this[_0x5c92('0x11')][_0x23441e];delete this[_0x5c92('0x14')][_0x23441e];}};Fax['prototype'][_0x5c92('0x20')]=function(_0x2f0f6a){var _0x164f94=this;if(this[_0x5c92('0x11')][_0x2f0f6a[_0x5c92('0x29')]]){if(this[_0x5c92('0x14')][_0x2f0f6a[_0x5c92('0x29')]]){this[_0x5c92('0x11')][_0x2f0f6a[_0x5c92('0x29')]]['id']=this[_0x5c92('0x14')][_0x2f0f6a[_0x5c92('0x29')]]['id'];this[_0x5c92('0x11')][_0x2f0f6a[_0x5c92('0x29')]][_0x5c92('0x2b')]=this['actions'][_0x2f0f6a[_0x5c92('0x29')]][_0x5c92('0x2b')];}logger['info'](_0x2f0f6a[_0x5c92('0x29')],this[_0x5c92('0x14')][_0x2f0f6a[_0x5c92('0x29')]]?'\x20hangup\x20sendFile\x20':_0x5c92('0x56'),JSON['stringify'](this[_0x5c92('0x11')][_0x2f0f6a['uniqueid']]));if(this[_0x5c92('0x14')][_0x2f0f6a[_0x5c92('0x29')]]){if(this[_0x5c92('0x11')][_0x2f0f6a[_0x5c92('0x29')]][_0x5c92('0x57')]>0x0&&this[_0x5c92('0x11')][_0x2f0f6a[_0x5c92('0x29')]][_0x5c92('0x1d')]===_0x5c92('0x58')){this[_0x5c92('0x51')](_0x2f0f6a[_0x5c92('0x29')],!![]);}else{this[_0x5c92('0x51')](_0x2f0f6a['uniqueid'],![],this['channels'][_0x2f0f6a[_0x5c92('0x29')]]['faxstatusstring']?_0x5c92('0x59')+this[_0x5c92('0x11')][_0x2f0f6a[_0x5c92('0x29')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax[_0x5c92('0x23')][_0x5c92('0x5a')]=function(_0x489d1f){var _0x1f58e9=this;return new BPromise(function(_0x20f1f9,_0x10a894){_0x1f58e9[_0x5c92('0x5b')](_0x489d1f,_0x1f58e9[_0x5c92('0x12')][_0x489d1f[_0x5c92('0x5c')]])['then'](function(_0x164a90){ut[_0x5c92('0x4d')](_0x5c92('0x5d'),_0x164a90);_0x20f1f9(ut[_0x5c92('0x3e')](_0x5c92('0x5e')));})['catch'](function(_0x24cdf6){ut[_0x5c92('0x4d')]('[Fax][execOriginate][failure]',_0x24cdf6);updateStatus(_0x489d1f);_0x10a894(ut[_0x5c92('0x3e')]('Fax\x20failed'));});});};Fax['prototype'][_0x5c92('0x5f')]=function(_0x4552ef){var _0x51d637=this;return new BPromise(function(_0x4600c8,_0x3abac2){var _0x21188b=_0x51d637[_0x5c92('0x60')](_0x51d637['faxAccounts'][_0x4552ef['FaxAccountId']][_0x5c92('0x61')],_0x4552ef);if(_0x21188b[_0x5c92('0x62')]){_0x4600c8(ut[_0x5c92('0x3e')](_0x5c92('0x63')));}else{_0x3abac2(ut['message'](_0x21188b[_0x5c92('0x3e')]));}});};function originate(_0x25c415,_0x19d536,_0x10dc7e){return new BPromise(function(_0x2ec48c,_0x16df5f){if(_0x10dc7e){var _0x47c484=util[_0x5c92('0x64')](_0x5c92('0x65'),path['parse'](_0x25c415[_0x5c92('0x4')])[_0x5c92('0x2b')],_0x25c415[_0x5c92('0x4')]);gs[_0x5c92('0x66')](_0x47c484)[_0x5c92('0x42')](function(){_0x25c415[_0x5c92('0x4')]=util[_0x5c92('0x64')](_0x5c92('0x67'),path[_0x5c92('0x40')](_0x25c415[_0x5c92('0x4')])[_0x5c92('0x68')],path['parse'](_0x25c415[_0x5c92('0x4')])[_0x5c92('0x2b')]);_0x19d536[_0x5c92('0x69')]=_0x25c415[_0x5c92('0x4')];ut[_0x5c92('0x4d')](_0x5c92('0x6a'),'');ami[_0x5c92('0x6b')](ut[_0x5c92('0x6c')](_0x25c415,_0x19d536))[_0x5c92('0x42')](function(_0x100820){_0x2ec48c(_0x100820);})[_0x5c92('0x44')](function(_0x5b1af9){_0x16df5f(_0x5b1af9);});})[_0x5c92('0x44')](function(_0x1b98e9){_0x16df5f(_0x1b98e9);});}else{ami['Action'](ut[_0x5c92('0x6c')](_0x25c415,_0x19d536))['then'](function(_0x45b35b){_0x2ec48c(_0x45b35b);})['catch'](function(_0x18675f){_0x16df5f(_0x18675f);});}});}Fax[_0x5c92('0x23')]['execOriginate']=function(_0x35a60e,_0x375778){var _0x41e1c3=this;return new BPromise(function(_0x592ce6,_0x22495f){var _0xb8b140=uuid['v4']();var _0x5cca44=ut['addVariables'](_0x35a60e,_0x375778);_0x41e1c3[_0x5c92('0x14')][_0xb8b140]=new Action(_0xb8b140,_0x375778,_0x35a60e);var _0x25f83f=_0x41e1c3[_0x5c92('0x14')][_0xb8b140];if(path[_0x5c92('0x40')](_0x35a60e[_0x5c92('0x4')])[_0x5c92('0x6d')]===_0x5c92('0x41')){originate(_0x25f83f,_0x5cca44,!![])[_0x5c92('0x42')](function(_0x17032f){_0x592ce6(_0x17032f);})['catch'](function(_0x53d3d7){_0x22495f(_0x53d3d7);});}else{originate(_0x25f83f,_0x5cca44,![])[_0x5c92('0x42')](function(_0x1a36e4){_0x592ce6(_0x1a36e4);})[_0x5c92('0x44')](function(_0x47ce6d){_0x22495f(_0x47ce6d);});}});};Fax['prototype']['isTrunkReachable']=function(_0x4dcb29){return!_['isNil'](_0x4dcb29)&&!_[_0x5c92('0x6e')](_0x4dcb29['name'])&&!_[_0x5c92('0x6e')](_0x4dcb29[_0x5c92('0x6f')])&&_0x4dcb29[_0x5c92('0x6f')]&&!_['isNil'](this[_0x5c92('0x13')][util[_0x5c92('0x64')](_0x5c92('0x70'),_0x4dcb29['name'])])&&!_[_0x5c92('0x6e')](this[_0x5c92('0x13')][util[_0x5c92('0x64')](_0x5c92('0x70'),_0x4dcb29[_0x5c92('0x2b')])][_0x5c92('0x33')])&&(this[_0x5c92('0x13')][util[_0x5c92('0x64')](_0x5c92('0x70'),_0x4dcb29[_0x5c92('0x2b')])][_0x5c92('0x33')]===_0x5c92('0x71')||this[_0x5c92('0x13')][util[_0x5c92('0x64')](_0x5c92('0x70'),_0x4dcb29[_0x5c92('0x2b')])][_0x5c92('0x33')]===_0x5c92('0x72'));};Fax[_0x5c92('0x23')][_0x5c92('0x60')]=function(_0x13e4e4,_0xd8e703){if(!this[_0x5c92('0x73')](_0x13e4e4)){ut[_0x5c92('0x4d')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x5c92('0x6e')](_0x13e4e4)?'':_0x13e4e4[_0x5c92('0x2b')]+_0x5c92('0x74'));return{'isValid':![],'message':_0x5c92('0x75')};}if(_[_0x5c92('0x6e')](_0xd8e703[_0x5c92('0x8')])){ut[_0x5c92('0x4d')](_0x5c92('0x76'),JSON['stringify'](_0xd8e703));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x5c92('0x6e')](_0xd8e703[_0x5c92('0x4')])){ut[_0x5c92('0x4d')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0xd8e703));return{'isValid':![],'message':_0x5c92('0x77')};}return{'isValid':!![],'message':_0x5c92('0x78')};};module[_0x5c92('0x79')]=Fax; \ No newline at end of file +var _0xb082=['channelstatedesc','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','response','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','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','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','lodash','bluebird','moment','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','syncVarSet','bind','newstate','syncNewState','syncNewExten','faxstatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate'];(function(_0x7a3243,_0x4b9d8d){var _0xc52b68=function(_0x361a83){while(--_0x361a83){_0x7a3243['push'](_0x7a3243['shift']());}};_0xc52b68(++_0x4b9d8d);}(_0xb082,0x1b0));var _0x2b08=function(_0x311e45,_0x485568){_0x311e45=_0x311e45-0x0;var _0x4cbc39=_0xb082[_0x311e45];return _0x4cbc39;};'use strict';var util=require('util');var _=require(_0x2b08('0x0'));var BPromise=require(_0x2b08('0x1'));var uuid=require('uuid');var moment=require(_0x2b08('0x2'));var path=require(_0x2b08('0x3'));var tiff2pdf=require(_0x2b08('0x4'));var gs=require('./util/gs');var logger=require(_0x2b08('0x5'))(_0x2b08('0x6'));var ami=require(_0x2b08('0x7'));var rpcDb=require(_0x2b08('0x8'));var Channel=require(_0x2b08('0x9'));var ut=require('./util/util');var Action=require(_0x2b08('0xa'));var faxAccount=require(_0x2b08('0xb'));var attachment=require(_0x2b08('0xc'));var faxMessage=require(_0x2b08('0xd'));function Fax(_0x1b72c8){this[_0x2b08('0xe')]={};this[_0x2b08('0xf')]=_0x1b72c8[_0x2b08('0xf')];this[_0x2b08('0x10')]=_0x1b72c8['trunks'];this[_0x2b08('0x11')]={};ami['on'](_0x2b08('0x12'),this[_0x2b08('0x13')]['bind'](this));ami['on']('varset',this[_0x2b08('0x14')][_0x2b08('0x15')](this));ami['on'](_0x2b08('0x16'),this[_0x2b08('0x17')][_0x2b08('0x15')](this));ami['on']('newexten',this[_0x2b08('0x18')]['bind'](this));ami['on'](_0x2b08('0x19'),this['syncFaxStatus']['bind'](this));ami['on'](_0x2b08('0x1a'),this[_0x2b08('0x1b')][_0x2b08('0x15')](this));ami['on'](_0x2b08('0x1c'),this[_0x2b08('0x1d')][_0x2b08('0x15')](this));ami['on'](_0x2b08('0x1e'),this['syncOriginateResponse']['bind'](this));}Fax[_0x2b08('0x1f')][_0x2b08('0x13')]=function(_0x46c839){if(_0x46c839['context']===_0x2b08('0x20')){for(var _0x39f5ab in this[_0x2b08('0xf')]){if(this[_0x2b08('0xf')][_0x2b08('0x21')](_0x39f5ab)){if(_0x46c839[_0x2b08('0x22')]===this['faxAccounts'][_0x39f5ab][_0x2b08('0x23')]){this[_0x2b08('0xe')][_0x46c839[_0x2b08('0x24')]]={};this[_0x2b08('0xe')][_0x46c839['uniqueid']][_0x2b08('0x25')]=_0x46c839[_0x2b08('0x25')];this['channels'][_0x46c839['uniqueid']]['id']=this[_0x2b08('0xf')][_0x39f5ab]['id'];this[_0x2b08('0xe')][_0x46c839[_0x2b08('0x24')]][_0x2b08('0x26')]=this['faxAccounts'][_0x39f5ab][_0x2b08('0x26')];logger[_0x2b08('0x27')](_0x46c839[_0x2b08('0x24')],'\x20syncNewchannel\x20');}}}}if(this[_0x2b08('0x11')][_0x46c839[_0x2b08('0x24')]]){this[_0x2b08('0xe')][_0x46c839['uniqueid']]={};this[_0x2b08('0xe')][_0x46c839[_0x2b08('0x24')]]['channel']=_0x46c839['channel'];logger[_0x2b08('0x27')](_0x46c839[_0x2b08('0x24')],_0x2b08('0x28'));}};Fax[_0x2b08('0x1f')]['syncVarSet']=function(_0x5f3f6c){if(this[_0x2b08('0xe')][_0x5f3f6c[_0x2b08('0x24')]]){for(var _0x40af94 in _0x5f3f6c['variable']){if(_0x5f3f6c[_0x2b08('0x29')][_0x2b08('0x21')](_0x40af94)){this[_0x2b08('0xe')][_0x5f3f6c[_0x2b08('0x24')]][_0x40af94]=_0x5f3f6c[_0x2b08('0x2a')];}}}};Fax[_0x2b08('0x1f')]['syncNewState']=function(_0x66956d){if(this[_0x2b08('0xe')][_0x66956d[_0x2b08('0x24')]]){this[_0x2b08('0xe')][_0x66956d[_0x2b08('0x24')]][_0x2b08('0x2b')]=_0x66956d['channelstate'];this[_0x2b08('0xe')][_0x66956d[_0x2b08('0x24')]][_0x2b08('0x2c')]=_0x66956d[_0x2b08('0x2c')];}};Fax[_0x2b08('0x1f')]['syncNewExten']=function(_0x19f436){if(this[_0x2b08('0xe')][_0x19f436['uniqueid']]){for(var _0x17286c in _0x19f436['variable']){if(_0x19f436[_0x2b08('0x29')]['hasOwnProperty'](_0x17286c)){this[_0x2b08('0xe')][_0x19f436['uniqueid']][_0x17286c]=_0x19f436['value'];}}}};Fax[_0x2b08('0x1f')][_0x2b08('0x2d')]=function(_0x580ae6){if(this[_0x2b08('0xe')][_0x580ae6[_0x2b08('0x24')]]){this[_0x2b08('0xe')][_0x580ae6[_0x2b08('0x24')]][_0x2b08('0x2e')]=_0x580ae6[_0x2b08('0x2e')];this[_0x2b08('0xe')][_0x580ae6[_0x2b08('0x24')]][_0x2b08('0x2f')]=_0x580ae6['status'];this['channels'][_0x580ae6[_0x2b08('0x24')]][_0x2b08('0x23')]=_0x580ae6[_0x2b08('0x23')];this['channels'][_0x580ae6[_0x2b08('0x24')]][_0x2b08('0x30')]=_0x580ae6[_0x2b08('0x30')];logger[_0x2b08('0x27')](_0x580ae6[_0x2b08('0x24')],_0x2b08('0x31'));}};Fax['prototype'][_0x2b08('0x1b')]=function(_0x140871){var _0xbc6f80=this;if(this[_0x2b08('0xe')][_0x140871['uniqueid']]){var _0x53b56c=this[_0x2b08('0xe')][_0x140871[_0x2b08('0x24')]]['id'];this['channels'][_0x140871['uniqueid']][_0x2b08('0x32')]=_0x140871[_0x2b08('0x32')];this[_0x2b08('0xe')][_0x140871['uniqueid']][_0x2b08('0x33')]=_0x140871[_0x2b08('0x33')];this[_0x2b08('0xe')][_0x140871[_0x2b08('0x24')]][_0x2b08('0x23')]=_0x140871['localstationid'];this[_0x2b08('0xe')][_0x140871[_0x2b08('0x24')]]['resolution']=_0x140871[_0x2b08('0x34')];this[_0x2b08('0xe')][_0x140871[_0x2b08('0x24')]][_0x2b08('0x35')]=_0x140871[_0x2b08('0x35')];this[_0x2b08('0xe')][_0x140871[_0x2b08('0x24')]]['filename']=_0x140871[_0x2b08('0x30')];this[_0x2b08('0xe')][_0x140871['uniqueid']][_0x2b08('0x36')]=_0x140871[_0x2b08('0x36')];if(this[_0x2b08('0xe')][_0x140871[_0x2b08('0x24')]]['pagestransferred']>0x0){tiff2pdf(_0x140871[_0x2b08('0x30')],_0x2b08('0x37'),function(_0x175e10){logger['info'](_0x140871[_0x2b08('0x24')],_0x2b08('0x38'),_0x175e10[_0x2b08('0x39')]);attachment[_0x2b08('0x3a')]({'name':path[_0x2b08('0x3b')](_0x140871['filename'])[_0x2b08('0x26')],'basename':path[_0x2b08('0x3b')](_0x140871['filename'])[_0x2b08('0x26')]+_0x2b08('0x3c'),'type':_0x2b08('0x3d')})[_0x2b08('0x3e')](function(_0xd2456){faxAccount[_0x2b08('0x3f')](_0x53b56c,{'from':_0x140871[_0x2b08('0x36')],'mapKey':_0x2b08('0x6'),'body':path[_0x2b08('0x3b')](_0x140871[_0x2b08('0x30')])['name']+_0x2b08('0x3c'),'AttachmentId':_0xd2456['id']})[_0x2b08('0x40')](function(_0x2acb2f){logger[_0x2b08('0x41')](_0x140871['uniqueid'],_0x2b08('0x42'),JSON[_0x2b08('0x43')](_0x2acb2f));});})['catch'](function(_0x4ce0dc){logger[_0x2b08('0x41')](_0x140871[_0x2b08('0x24')],_0x2b08('0x44'),JSON[_0x2b08('0x43')](_0x4ce0dc));});});}logger[_0x2b08('0x27')](_0x140871['uniqueid'],_0x2b08('0x44'));}};Fax[_0x2b08('0x1f')]['syncOriginateResponse']=function(_0xacef48){if(this['actions'][_0xacef48['uniqueid']]){_[_0x2b08('0x45')](this[_0x2b08('0xe')][_0xacef48['uniqueid']],_['pick'](_0xacef48,[_0x2b08('0x46'),_0x2b08('0x47')]));}};function updateStatus(_0xe728f0){if(_0xe728f0[_0x2b08('0x48')]){faxMessage['update'](_0xe728f0[_0x2b08('0x48')],{'failMessage':_0x2b08('0x49')})['then'](function(_0xd97d07){ut[_0x2b08('0x4a')](_0x2b08('0x4b'),_0xd97d07);})[_0x2b08('0x40')](function(_0x4c8659){ut[_0x2b08('0x4a')]('[Fax][Message][Error][NoUpdate1]',_0x4c8659);});}else{ut[_0x2b08('0x4a')](_0x2b08('0x4c'));}}Fax[_0x2b08('0x1f')][_0x2b08('0x4d')]=function(_0x387349,_0x1a3f09,_0x36f92c){var _0x2ab034=this;var _0x3245df={};if(_0x1a3f09){_0x3245df={'read':_0x1a3f09};}else{_0x3245df={'failMessage':_0x36f92c};}if(this[_0x2b08('0x11')][_0x387349]['AttachmentId']){faxMessage[_0x2b08('0x4e')](this[_0x2b08('0x11')][_0x387349][_0x2b08('0x48')],_0x3245df)[_0x2b08('0x3e')](function(_0x53493c){ut[_0x2b08('0x4a')](_0x2b08('0x4f'),_0x53493c);})[_0x2b08('0x40')](function(_0x32e23b){ut[_0x2b08('0x4a')](_0x2b08('0x50'),_0x32e23b);})[_0x2b08('0x51')](function(){delete _0x2ab034['channels'][_0x387349];delete _0x2ab034[_0x2b08('0x11')][_0x387349];});}else{ut[_0x2b08('0x4a')](_0x2b08('0x52'));delete this[_0x2b08('0xe')][_0x387349];delete this[_0x2b08('0x11')][_0x387349];}};Fax[_0x2b08('0x1f')][_0x2b08('0x1d')]=function(_0x1a0555){var _0x3bfc17=this;if(this[_0x2b08('0xe')][_0x1a0555[_0x2b08('0x24')]]){if(this[_0x2b08('0x11')][_0x1a0555[_0x2b08('0x24')]]){this[_0x2b08('0xe')][_0x1a0555[_0x2b08('0x24')]]['id']=this['actions'][_0x1a0555[_0x2b08('0x24')]]['id'];this[_0x2b08('0xe')][_0x1a0555[_0x2b08('0x24')]][_0x2b08('0x26')]=this['actions'][_0x1a0555[_0x2b08('0x24')]][_0x2b08('0x26')];}logger[_0x2b08('0x27')](_0x1a0555['uniqueid'],this[_0x2b08('0x11')][_0x1a0555[_0x2b08('0x24')]]?_0x2b08('0x53'):_0x2b08('0x54'),JSON[_0x2b08('0x43')](this[_0x2b08('0xe')][_0x1a0555[_0x2b08('0x24')]]));if(this[_0x2b08('0x11')][_0x1a0555['uniqueid']]){if(this[_0x2b08('0xe')][_0x1a0555[_0x2b08('0x24')]]['faxpages']>0x0&&this[_0x2b08('0xe')][_0x1a0555[_0x2b08('0x24')]][_0x2b08('0x19')]===_0x2b08('0x55')){this[_0x2b08('0x4d')](_0x1a0555['uniqueid'],!![]);}else{this[_0x2b08('0x4d')](_0x1a0555[_0x2b08('0x24')],![],this[_0x2b08('0xe')][_0x1a0555[_0x2b08('0x24')]]['faxstatusstring']?_0x2b08('0x56')+this[_0x2b08('0xe')][_0x1a0555['uniqueid']]['faxstatusstring']:_0x2b08('0x57'));}}}};Fax['prototype']['send']=function(_0x5d9d3e){var _0x347b6b=this;return new BPromise(function(_0x47c451,_0x57cc2b){_0x347b6b[_0x2b08('0x58')](_0x5d9d3e,_0x347b6b[_0x2b08('0xf')][_0x5d9d3e['FaxAccountId']])[_0x2b08('0x3e')](function(_0x4fd9e2){ut[_0x2b08('0x4a')](_0x2b08('0x59'),_0x4fd9e2);_0x47c451(ut[_0x2b08('0x39')](_0x2b08('0x5a')));})[_0x2b08('0x40')](function(_0x2a0603){ut['logger'](_0x2b08('0x5b'),_0x2a0603);updateStatus(_0x5d9d3e);_0x57cc2b(ut[_0x2b08('0x39')](_0x2b08('0x5c')));});});};Fax[_0x2b08('0x1f')]['checkAfterSend']=function(_0x315b5b){var _0x3d8ff5=this;return new BPromise(function(_0xc25251,_0x21131e){var _0x30a18f=_0x3d8ff5[_0x2b08('0x5d')](_0x3d8ff5['faxAccounts'][_0x315b5b['FaxAccountId']][_0x2b08('0x5e')],_0x315b5b);if(_0x30a18f[_0x2b08('0x5f')]){_0xc25251(ut[_0x2b08('0x39')](_0x2b08('0x60')));}else{_0x21131e(ut[_0x2b08('0x39')](_0x30a18f[_0x2b08('0x39')]));}});};function originate(_0x427b08,_0x4b5b99,_0x46e1e1){return new BPromise(function(_0x556e0c,_0x4c6c48){if(_0x46e1e1){var _0x5dade6=util[_0x2b08('0x61')](_0x2b08('0x62'),path['parse'](_0x427b08['path'])[_0x2b08('0x26')],_0x427b08['path']);gs[_0x2b08('0x63')](_0x5dade6)[_0x2b08('0x3e')](function(){_0x427b08[_0x2b08('0x3')]=util[_0x2b08('0x61')](_0x2b08('0x64'),path['parse'](_0x427b08[_0x2b08('0x3')])[_0x2b08('0x65')],path[_0x2b08('0x3b')](_0x427b08[_0x2b08('0x3')])[_0x2b08('0x26')]);_0x4b5b99['XMF-PATH']=_0x427b08[_0x2b08('0x3')];ut[_0x2b08('0x4a')](_0x2b08('0x66'),'');ami[_0x2b08('0x67')](ut[_0x2b08('0x68')](_0x427b08,_0x4b5b99))[_0x2b08('0x3e')](function(_0x30acaa){_0x556e0c(_0x30acaa);})[_0x2b08('0x40')](function(_0x34bc19){_0x4c6c48(_0x34bc19);});})['catch'](function(_0x41254e){_0x4c6c48(_0x41254e);});}else{ami[_0x2b08('0x67')](ut[_0x2b08('0x68')](_0x427b08,_0x4b5b99))['then'](function(_0x46cc4f){_0x556e0c(_0x46cc4f);})[_0x2b08('0x40')](function(_0x58a2fd){_0x4c6c48(_0x58a2fd);});}});}Fax[_0x2b08('0x1f')][_0x2b08('0x58')]=function(_0x4ef36b,_0x3fe175){var _0x3a2041=this;return new BPromise(function(_0x8289ac,_0x461dd6){var _0x3f06b9=uuid['v4']();var _0x34f00a=ut['addVariables'](_0x4ef36b,_0x3fe175);_0x3a2041['actions'][_0x3f06b9]=new Action(_0x3f06b9,_0x3fe175,_0x4ef36b);var _0x5e4e5d=_0x3a2041[_0x2b08('0x11')][_0x3f06b9];if(path[_0x2b08('0x3b')](_0x4ef36b[_0x2b08('0x3')])[_0x2b08('0x69')]===_0x2b08('0x3c')){originate(_0x5e4e5d,_0x34f00a,!![])[_0x2b08('0x3e')](function(_0xd6c272){_0x8289ac(_0xd6c272);})[_0x2b08('0x40')](function(_0x39fdbf){_0x461dd6(_0x39fdbf);});}else{originate(_0x5e4e5d,_0x34f00a,![])[_0x2b08('0x3e')](function(_0x30e349){_0x8289ac(_0x30e349);})[_0x2b08('0x40')](function(_0x5f09a3){_0x461dd6(_0x5f09a3);});}});};Fax[_0x2b08('0x1f')][_0x2b08('0x6a')]=function(_0x22d04e){return!_['isNil'](_0x22d04e)&&!_[_0x2b08('0x6b')](_0x22d04e['name'])&&!_['isNil'](_0x22d04e['active'])&&_0x22d04e[_0x2b08('0x6c')]&&!_[_0x2b08('0x6b')](this[_0x2b08('0x10')][util[_0x2b08('0x61')]('SIP/%s',_0x22d04e['name'])])&&!_[_0x2b08('0x6b')](this['trunks'][util[_0x2b08('0x61')](_0x2b08('0x6d'),_0x22d04e[_0x2b08('0x26')])]['status'])&&(this[_0x2b08('0x10')][util['format']('SIP/%s',_0x22d04e[_0x2b08('0x26')])]['status']===_0x2b08('0x6e')||this['trunks'][util[_0x2b08('0x61')](_0x2b08('0x6d'),_0x22d04e[_0x2b08('0x26')])]['status']===_0x2b08('0x6f'));};Fax[_0x2b08('0x1f')][_0x2b08('0x5d')]=function(_0x4e1a7c,_0x29ae5a){if(!this[_0x2b08('0x6a')](_0x4e1a7c)){ut[_0x2b08('0x4a')](_0x2b08('0x70'),_[_0x2b08('0x6b')](_0x4e1a7c)?'':_0x4e1a7c[_0x2b08('0x26')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x2b08('0x71')};}if(_[_0x2b08('0x6b')](_0x29ae5a[_0x2b08('0x6')])){ut[_0x2b08('0x4a')](_0x2b08('0x72'),JSON['stringify'](_0x29ae5a));return{'isValid':![],'message':_0x2b08('0x73')};}if(_['isNil'](_0x29ae5a[_0x2b08('0x3')])){ut[_0x2b08('0x4a')](_0x2b08('0x74'),JSON[_0x2b08('0x43')](_0x29ae5a));return{'isValid':![],'message':_0x2b08('0x75')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x2b08('0x76')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index b04a1ec..55300f1 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 _0xfd30=['resolve','catch','[Notify]\x20','util','bluebird','preview','lodash','../rpc/faxAccount','error','inspect','notify'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0xfd30,0x16e));var _0x0fd3=function(_0x3bcb0b,_0x255033){_0x3bcb0b=_0x3bcb0b-0x0;var _0x455caa=_0xfd30[_0x3bcb0b];return _0x455caa;};'use strict';var util=require(_0x0fd3('0x0'));var BPromise=require(_0x0fd3('0x1'));var logger=require('../../../config/logger')(_0x0fd3('0x2'));var _=require(_0x0fd3('0x3'));var faxAccount=require(_0x0fd3('0x4'));function loggerCatch(_0x1f0e5d){return function(_0x112002){logger[_0x0fd3('0x5')](_0x1f0e5d,util[_0x0fd3('0x6')](_0x112002,{'showHidden':![],'depth':null}));};}exports[_0x0fd3('0x7')]=function(_0x134243,_0x23dff4){return BPromise[_0x0fd3('0x8')]()['then'](faxAccount[_0x0fd3('0x7')](_0x134243,_0x23dff4))[_0x0fd3('0x9')](loggerCatch(_0x0fd3('0xa')));}; \ No newline at end of file +var _0x552b=['resolve','then','[Notify]\x20','util','../../../config/logger','lodash','../rpc/faxAccount','error','notify'];(function(_0xea9222,_0x52f420){var _0x1a9dc5=function(_0x484cf9){while(--_0x484cf9){_0xea9222['push'](_0xea9222['shift']());}};_0x1a9dc5(++_0x52f420);}(_0x552b,0xdb));var _0xb552=function(_0x587095,_0xfefab0){_0x587095=_0x587095-0x0;var _0x31b5dd=_0x552b[_0x587095];return _0x31b5dd;};'use strict';var util=require(_0xb552('0x0'));var BPromise=require('bluebird');var logger=require(_0xb552('0x1'))('preview');var _=require(_0xb552('0x2'));var faxAccount=require(_0xb552('0x3'));function loggerCatch(_0x1fcd5f){return function(_0x779067){logger[_0xb552('0x4')](_0x1fcd5f,util['inspect'](_0x779067,{'showHidden':![],'depth':null}));};}exports[_0xb552('0x5')]=function(_0x4f8008,_0x5f08d9){return BPromise[_0xb552('0x6')]()[_0xb552('0x7')](faxAccount[_0xb552('0x5')](_0x4f8008,_0x5f08d9))['catch'](loggerCatch(_0xb552('0x8')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 5a9244c..d24228f 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 _0x59dd=['exec','Exec\x20gs','info','\x20Error\x20:','util','../../../../config/logger','fax','child_process'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x59dd,0x16c));var _0xd59d=function(_0x54defc,_0x627178){_0x54defc=_0x54defc-0x0;var _0x1955d3=_0x59dd[_0x54defc];return _0x1955d3;};'use strict';var util=require(_0xd59d('0x0'));var logger=require(_0xd59d('0x1'))(_0xd59d('0x2'));var BPromise=require('bluebird');var exec=require(_0xd59d('0x3'))[_0xd59d('0x4')];exports['execute']=function(_0x166913){return new BPromise(function(_0x3b16aa,_0x484446){exec(_0x166913,function(_0x1d997c,_0x47c0c1,_0x1e195a){logger['info'](_0xd59d('0x5'),_0x47c0c1);if(_0x1d997c){logger[_0xd59d('0x6')](_0xd59d('0x5'),_0xd59d('0x7'),util['inspect'](_0x1d997c,{'showHidden':![],'depth':null}),_0x47c0c1,_0x1e195a);_0x484446(_0x1d997c);}_0x3b16aa(_0x47c0c1);});});}; \ No newline at end of file +var _0x2419=['info','\x20Error\x20:','inspect','util','fax','bluebird','child_process','execute','Exec\x20gs'];(function(_0x41c2ab,_0x2980c3){var _0x112bed=function(_0x1d8a34){while(--_0x1d8a34){_0x41c2ab['push'](_0x41c2ab['shift']());}};_0x112bed(++_0x2980c3);}(_0x2419,0x1a1));var _0x9241=function(_0x4963b2,_0x379b50){_0x4963b2=_0x4963b2-0x0;var _0x442301=_0x2419[_0x4963b2];return _0x442301;};'use strict';var util=require(_0x9241('0x0'));var logger=require('../../../../config/logger')(_0x9241('0x1'));var BPromise=require(_0x9241('0x2'));var exec=require(_0x9241('0x3'))['exec'];exports[_0x9241('0x4')]=function(_0x582947){return new BPromise(function(_0x3f4605,_0x44315c){exec(_0x582947,function(_0x3d000f,_0x4bcfe5,_0x36e329){logger['info'](_0x9241('0x5'),_0x4bcfe5);if(_0x3d000f){logger[_0x9241('0x6')]('Exec\x20gs',_0x9241('0x7'),util[_0x9241('0x8')](_0x3d000f,{'showHidden':![],'depth':null}),_0x4bcfe5,_0x36e329);_0x44315c(_0x3d000f);}_0x3f4605(_0x4bcfe5);});});}; \ 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 fa47c83..37582e2 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 _0x68fc=['from-sip','\x22%s\x22\x20<%s>','localstationid','util','lodash','moment','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax'];(function(_0xa2c0a3,_0x5bbac0){var _0x52c618=function(_0x20f7fd){while(--_0x20f7fd){_0xa2c0a3['push'](_0xa2c0a3['shift']());}};_0x52c618(++_0x5bbac0);}(_0x68fc,0xa5));var _0xc68f=function(_0x3279b2,_0x43cce9){_0x3279b2=_0x3279b2-0x0;var _0xfae8f2=_0x68fc[_0x3279b2];return _0xfae8f2;};'use strict';var util=require(_0xc68f('0x0'));var _=require(_0xc68f('0x1'));var moment=require(_0xc68f('0x2'));var logger=require('../../../../config/logger')('fax');exports[_0xc68f('0x3')]=function(_0x506fb5){return{'message':_0x506fb5};};exports[_0xc68f('0x4')]=function(_0x593648,_0x5899ea){logger[_0xc68f('0x5')](_0x593648,util[_0xc68f('0x6')](_0x5899ea,{'showHidden':![],'depth':null}));};exports[_0xc68f('0x7')]=function(_0x363cdf,_0x4fcce4){var _0x4a6f7d={'XMF-ECM':_0x4fcce4[_0xc68f('0x8')],'XMF-HEADERINFO':_0x4fcce4[_0xc68f('0x9')],'XMF-MINRATE':_0x4fcce4[_0xc68f('0xa')],'XMF-MAXRATE':_0x4fcce4[_0xc68f('0xb')],'XMF-MODEM':util[_0xc68f('0xc')](_0xc68f('0xd'),_0x4fcce4[_0xc68f('0xe')]),'XMF-GATEWAY':_0x4fcce4[_0xc68f('0xf')],'XMF-FAXDETECT':_0x4fcce4[_0xc68f('0x10')],'XMF-T38TIMEOUT':_0x4fcce4[_0xc68f('0x11')],'XMF-LOCALSTATIONID':_0x4fcce4['localstationid'],'XMF-PATH':_0x363cdf[_0xc68f('0x12')]};return _0x4a6f7d;};exports[_0xc68f('0x13')]=function(_0x1f2758,_0x1d4ae4){return{'actionid':_0x1f2758[_0xc68f('0x14')],'action':_0xc68f('0x15'),'channel':_0x1f2758[_0xc68f('0x16')],'Exten':_0xc68f('0x17'),'Context':_0xc68f('0x18'),'Priority':'1','callerid':util[_0xc68f('0xc')](_0xc68f('0x19'),_0x1f2758['headerinfo']?_0x1f2758[_0xc68f('0x9')]:'',_0x1f2758[_0xc68f('0x1a')]),'variable':_0x1d4ae4,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1f2758[_0xc68f('0x14')]};}; \ No newline at end of file +var _0x4ded=['inspect','ecm','headerinfo','minrate','format','faxdetect','t38timeout','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','localstationid','util','lodash','moment','../../../../config/logger','fax','message','logger','info'];(function(_0x4a71e2,_0x528375){var _0x4ed763=function(_0x3b246f){while(--_0x3b246f){_0x4a71e2['push'](_0x4a71e2['shift']());}};_0x4ed763(++_0x528375);}(_0x4ded,0x116));var _0xd4de=function(_0x110d6a,_0x3a374b){_0x110d6a=_0x110d6a-0x0;var _0x2540f6=_0x4ded[_0x110d6a];return _0x2540f6;};'use strict';var util=require(_0xd4de('0x0'));var _=require(_0xd4de('0x1'));var moment=require(_0xd4de('0x2'));var logger=require(_0xd4de('0x3'))(_0xd4de('0x4'));exports[_0xd4de('0x5')]=function(_0x1b2252){return{'message':_0x1b2252};};exports[_0xd4de('0x6')]=function(_0x20930f,_0x36d4dd){logger[_0xd4de('0x7')](_0x20930f,util[_0xd4de('0x8')](_0x36d4dd,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x23e5b9,_0x2433b8){var _0x15eb91={'XMF-ECM':_0x2433b8[_0xd4de('0x9')],'XMF-HEADERINFO':_0x2433b8[_0xd4de('0xa')],'XMF-MINRATE':_0x2433b8[_0xd4de('0xb')],'XMF-MAXRATE':_0x2433b8['maxrate'],'XMF-MODEM':util[_0xd4de('0xc')]('\x22%s\x22',_0x2433b8['modem']),'XMF-GATEWAY':_0x2433b8['gateway'],'XMF-FAXDETECT':_0x2433b8[_0xd4de('0xd')],'XMF-T38TIMEOUT':_0x2433b8[_0xd4de('0xe')],'XMF-LOCALSTATIONID':_0x2433b8['localstationid'],'XMF-PATH':_0x23e5b9['path']};return _0x15eb91;};exports['variablesAction']=function(_0x29e265,_0x49d931){return{'actionid':_0x29e265[_0xd4de('0xf')],'action':_0xd4de('0x10'),'channel':_0x29e265[_0xd4de('0x11')],'Exten':_0xd4de('0x12'),'Context':_0xd4de('0x13'),'Priority':'1','callerid':util[_0xd4de('0xc')](_0xd4de('0x14'),_0x29e265[_0xd4de('0xa')]?_0x29e265[_0xd4de('0xa')]:'',_0x29e265[_0xd4de('0x15')]),'variable':_0x49d931,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x29e265[_0xd4de('0xf')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 1fd5fc1..e0abbdd 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 _0x3072=['./report','./trigger','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','initVoiceQueueReports','initVoiceQueueHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','log','listen','sync','bluebird','util','./realtime'];(function(_0xa4f529,_0x36add4){var _0x3ce0df=function(_0x4ac770){while(--_0x4ac770){_0xa4f529['push'](_0xa4f529['shift']());}};_0x3ce0df(++_0x36add4);}(_0x3072,0x109));var _0x2307=function(_0xfaac52,_0x1fa8fc){_0xfaac52=_0xfaac52-0x0;var _0x4e1593=_0x3072[_0xfaac52];return _0x4e1593;};'use strict';var BPromise=require(_0x2307('0x0'));var util=require(_0x2307('0x1'));var moment=require('moment');var server=require('./server');var Realtime=require(_0x2307('0x2'));var Report=require(_0x2307('0x3'));var Acw=require('./acw');var Trigger=require(_0x2307('0x4'));var Dialer=require('./dialer');var Preview=require(_0x2307('0x5'));var Fax=require('./fax');var user=require(_0x2307('0x6'));var voiceQueue=require(_0x2307('0x7'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x2307('0x8'));var trunk=require(_0x2307('0x9'));var trigger=require('./rpc/trigger');var template=require(_0x2307('0xa'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x2307('0xb'));var voiceExtension=require(_0x2307('0xc'));var faxAccount=require(_0x2307('0xd'));var zendesk=require(_0x2307('0xe'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x2307('0xf'));var desk=require(_0x2307('0x10'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x2307('0x11'));var freshsales=require(_0x2307('0x12'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x2307('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()[_0x2307('0x14')](_0x2307('0x15'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x2307('0x14')](_0x2307('0x15'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x2307('0x16')](user[_0x2307('0x17')]())['then'](realtime[_0x2307('0x18')]())[_0x2307('0x16')](user[_0x2307('0x19')]())[_0x2307('0x16')](realtime[_0x2307('0x1a')]())[_0x2307('0x16')](trunk[_0x2307('0x1b')]())[_0x2307('0x16')](realtime['initTrunks']())[_0x2307('0x16')](voiceQueue[_0x2307('0x1c')]())[_0x2307('0x16')](realtime[_0x2307('0x1d')]())[_0x2307('0x16')](trigger[_0x2307('0x1e')]())[_0x2307('0x16')](realtime[_0x2307('0x1f')]())[_0x2307('0x16')](template[_0x2307('0x20')]())[_0x2307('0x16')](realtime[_0x2307('0x21')]())[_0x2307('0x16')](zendesk[_0x2307('0x22')]())[_0x2307('0x16')](realtime[_0x2307('0x23')]())[_0x2307('0x16')](salesforce[_0x2307('0x24')]())[_0x2307('0x16')](realtime[_0x2307('0x25')]())[_0x2307('0x16')](sugarcrm[_0x2307('0x26')]())[_0x2307('0x16')](realtime[_0x2307('0x27')]())['then'](freshdesk[_0x2307('0x28')]())[_0x2307('0x16')](realtime[_0x2307('0x29')]())[_0x2307('0x16')](desk[_0x2307('0x2a')]())['then'](realtime['initDeskAccounts']())[_0x2307('0x16')](zoho[_0x2307('0x2b')]())[_0x2307('0x16')](realtime[_0x2307('0x2c')]())[_0x2307('0x16')](vtiger[_0x2307('0x2d')]())[_0x2307('0x16')](realtime[_0x2307('0x2e')]())[_0x2307('0x16')](freshsales[_0x2307('0x2f')]())['then'](realtime[_0x2307('0x30')]())[_0x2307('0x16')](servicenow[_0x2307('0x31')]())[_0x2307('0x16')](realtime['initServicenowAccounts']())['then'](dynamics365[_0x2307('0x32')]())[_0x2307('0x16')](realtime[_0x2307('0x33')]())['then'](campaign[_0x2307('0x34')]())[_0x2307('0x16')](realtime[_0x2307('0x35')]())[_0x2307('0x16')](voiceExtension[_0x2307('0x36')]())[_0x2307('0x16')](realtime[_0x2307('0x37')]())[_0x2307('0x16')](faxAccount[_0x2307('0x38')]())['then'](realtime[_0x2307('0x39')]())[_0x2307('0x16')](function(){return realtime;});}function initParams(){return BPromise[_0x2307('0x3a')]()[_0x2307('0x16')](voiceQueueReport['getVoiceQueueReports']())[_0x2307('0x16')](realtime[_0x2307('0x3b')]())[_0x2307('0x16')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x2307('0x16')](realtime[_0x2307('0x3c')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0x2307('0x16')](realtime[_0x2307('0x3d')]())[_0x2307('0x16')](voiceCallReport['getVoiceCallReports']())[_0x2307('0x16')](realtime[_0x2307('0x3e')]())[_0x2307('0x16')](function(_0x5363bc){})[_0x2307('0x3f')](function(_0x210722){console[_0x2307('0x40')](_0x210722);});}function main(){return server[_0x2307('0x41')](realtime,preview,fax)[_0x2307('0x16')](function(_0x1dc187){return initRealtime();})[_0x2307('0x16')](function(){return initParams();})[_0x2307('0x16')](function(){report[_0x2307('0x42')]();setInterval(initRealtime,0x1388);})[_0x2307('0x3f')](function(_0xf633d1){console[_0x2307('0x40')](_0xf633d1);});}main(); \ No newline at end of file +var _0x35ae=['log','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./fax','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','get','hour','resolve','getAgents','then','getTelephones','initTelephones','getTrunks','getVoiceQueues','getTriggers','getTemplates','initTemplates','initZendeskAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','catch','listen','sync'];(function(_0x549278,_0x450754){var _0x1ea9a1=function(_0x2e559d){while(--_0x2e559d){_0x549278['push'](_0x549278['shift']());}};_0x1ea9a1(++_0x450754);}(_0x35ae,0x85));var _0xe35a=function(_0x47fac8,_0x4ba097){_0x47fac8=_0x47fac8-0x0;var _0x3ecc15=_0x35ae[_0x47fac8];return _0x3ecc15;};'use strict';var BPromise=require(_0xe35a('0x0'));var util=require(_0xe35a('0x1'));var moment=require(_0xe35a('0x2'));var server=require(_0xe35a('0x3'));var Realtime=require(_0xe35a('0x4'));var Report=require(_0xe35a('0x5'));var Acw=require(_0xe35a('0x6'));var Trigger=require(_0xe35a('0x7'));var Dialer=require(_0xe35a('0x8'));var Preview=require('./preview');var Fax=require(_0xe35a('0x9'));var user=require('./rpc/user');var voiceQueue=require(_0xe35a('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xe35a('0xb'));var trunk=require(_0xe35a('0xc'));var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require(_0xe35a('0xd'));var campaign=require(_0xe35a('0xe'));var voiceExtension=require(_0xe35a('0xf'));var faxAccount=require(_0xe35a('0x10'));var zendesk=require(_0xe35a('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xe35a('0x12'));var freshdesk=require(_0xe35a('0x13'));var desk=require(_0xe35a('0x14'));var zoho=require(_0xe35a('0x15'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xe35a('0x16'));var servicenow=require(_0xe35a('0x17'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xe35a('0x18')](_0xe35a('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xe35a('0x18')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xe35a('0x1a')]()['then'](user[_0xe35a('0x1b')]())[_0xe35a('0x1c')](realtime['initAgents']())['then'](user[_0xe35a('0x1d')]())['then'](realtime[_0xe35a('0x1e')]())[_0xe35a('0x1c')](trunk[_0xe35a('0x1f')]())['then'](realtime['initTrunks']())['then'](voiceQueue[_0xe35a('0x20')]())[_0xe35a('0x1c')](realtime['initVoiceQueues']())['then'](trigger[_0xe35a('0x21')]())['then'](realtime['initTriggers']())['then'](template[_0xe35a('0x22')]())[_0xe35a('0x1c')](realtime[_0xe35a('0x23')]())[_0xe35a('0x1c')](zendesk['getZendeskAccounts']())[_0xe35a('0x1c')](realtime[_0xe35a('0x24')]())[_0xe35a('0x1c')](salesforce['getSalesforceAccounts']())[_0xe35a('0x1c')](realtime['initSalesforceAccounts']())[_0xe35a('0x1c')](sugarcrm[_0xe35a('0x25')]())[_0xe35a('0x1c')](realtime[_0xe35a('0x26')]())['then'](freshdesk[_0xe35a('0x27')]())[_0xe35a('0x1c')](realtime[_0xe35a('0x28')]())[_0xe35a('0x1c')](desk[_0xe35a('0x29')]())[_0xe35a('0x1c')](realtime[_0xe35a('0x2a')]())[_0xe35a('0x1c')](zoho[_0xe35a('0x2b')]())['then'](realtime[_0xe35a('0x2c')]())[_0xe35a('0x1c')](vtiger[_0xe35a('0x2d')]())['then'](realtime[_0xe35a('0x2e')]())[_0xe35a('0x1c')](freshsales[_0xe35a('0x2f')]())['then'](realtime[_0xe35a('0x30')]())[_0xe35a('0x1c')](servicenow['getServicenowAccounts']())[_0xe35a('0x1c')](realtime[_0xe35a('0x31')]())['then'](dynamics365[_0xe35a('0x32')]())[_0xe35a('0x1c')](realtime['initDynamics365Accounts']())['then'](campaign[_0xe35a('0x33')]())['then'](realtime[_0xe35a('0x34')]())[_0xe35a('0x1c')](voiceExtension[_0xe35a('0x35')]())['then'](realtime[_0xe35a('0x36')]())['then'](faxAccount[_0xe35a('0x37')]())[_0xe35a('0x1c')](realtime[_0xe35a('0x38')]())[_0xe35a('0x1c')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0xe35a('0x1c')](voiceQueueReport[_0xe35a('0x39')]())['then'](realtime[_0xe35a('0x3a')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xe35a('0x1c')](realtime[_0xe35a('0x3b')]())[_0xe35a('0x1c')](cmHopperHistory[_0xe35a('0x3c')]())[_0xe35a('0x1c')](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0xe35a('0x3d')]())[_0xe35a('0x1c')](realtime['initVoiceCallReports']())[_0xe35a('0x1c')](function(_0x494246){})[_0xe35a('0x3e')](function(_0x34d894){console['log'](_0x34d894);});}function main(){return server[_0xe35a('0x3f')](realtime,preview,fax)['then'](function(_0x1bdd97){return initRealtime();})[_0xe35a('0x1c')](function(){return initParams();})[_0xe35a('0x1c')](function(){report[_0xe35a('0x40')]();setInterval(initRealtime,0x1388);})[_0xe35a('0x3e')](function(_0x18e7a9){console[_0xe35a('0x41')](_0x18e7a9);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 5d56b1a..4062355 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 _0xb966=['voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','md5','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','toNumber','stateTime','stringify','format','emit','user:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','name','email','accountcode','fullname','state','status','unknown','address','phone','mobile','interface','online','voiceStatus'];(function(_0x278dc9,_0x1d76c7){var _0x39dc09=function(_0xcc70af){while(--_0xcc70af){_0x278dc9['push'](_0x278dc9['shift']());}};_0x39dc09(++_0x1d76c7);}(_0xb966,0x19a));var _0x6b96=function(_0xeb3c97,_0x1b2ddb){_0xeb3c97=_0xeb3c97-0x0;var _0x41215b=_0xb966[_0xeb3c97];return _0x41215b;};'use strict';var _=require(_0x6b96('0x0'));var util=require(_0x6b96('0x1'));var moment=require('moment');var md5=require('md5');var Redis=require(_0x6b96('0x2'));var config=require(_0x6b96('0x3'));config[_0x6b96('0x4')]=_[_0x6b96('0x5')](config[_0x6b96('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6b96('0x4')]));function Agent(_0x1917c9){this['id']=_0x1917c9['id']||0x0;this[_0x6b96('0x6')]=_0x1917c9['name']||'';this['email']=_0x1917c9[_0x6b96('0x7')]||'';this[_0x6b96('0x8')]=_0x1917c9[_0x6b96('0x8')]||'';this['fullname']=_0x1917c9[_0x6b96('0x9')]||'';this[_0x6b96('0xa')]='unknown';this['stateTime']=0x0;this[_0x6b96('0xb')]=_0x6b96('0xc');this[_0x6b96('0xd')]='';this[_0x6b96('0xe')]='';this[_0x6b96('0xf')]='';this[_0x6b96('0x10')]='';this[_0x6b96('0x11')]=_0x1917c9[_0x6b96('0x11')]||![];this[_0x6b96('0x12')]=_0x6b96('0xc');this[_0x6b96('0x13')]=0x0;this[_0x6b96('0x14')]='';this[_0x6b96('0x15')]='';this[_0x6b96('0x16')]=![];this[_0x6b96('0x17')]=![];this[_0x6b96('0x18')]='';}Agent[_0x6b96('0x19')][_0x6b96('0x1a')]=function(_0x3107a1){var _0xe13fb8;if(_0x3107a1&&_0x3107a1['state']){_0xe13fb8=_0x3107a1['state'][_0x6b96('0x1b')]();switch(_0xe13fb8){case _0x6b96('0x1c'):_0xe13fb8=_0x6b96('0x1d');break;case _0x6b96('0x1e'):_0xe13fb8=_0x6b96('0x1f');break;}}if(_0xe13fb8&&this[_0x6b96('0x12')]!==_0xe13fb8||_0x3107a1['statePause']){this[_0x6b96('0x13')]=_[_0x6b96('0x20')](moment()['format']('x'));}if(_0xe13fb8){this[_0x6b96('0x12')]=_0xe13fb8;}var _0x40b75e={'id':this['id'],'name':this[_0x6b96('0x6')],'email':this[_0x6b96('0x7')],'accountcode':this[_0x6b96('0x8')],'fullname':this['fullname'],'state':this[_0x6b96('0xa')],'stateTime':this[_0x6b96('0x21')],'status':this[_0x6b96('0xb')],'address':this[_0x6b96('0xd')],'online':this[_0x6b96('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x6b96('0x13')],'voiceStatusCallerIdNumber':this[_0x6b96('0x14')],'voiceStatusQueue':this[_0x6b96('0x15')],'interface':this[_0x6b96('0x10')],'onhold':this[_0x6b96('0x16')]};var _0x5e4293=md5(JSON[_0x6b96('0x22')](_0x40b75e));if(this['md5']!==_0x5e4293){this['md5']=_0x5e4293;io['to'](util[_0x6b96('0x23')]('user:%s',_0x40b75e['name']))[_0x6b96('0x24')](_0x6b96('0x25'),_0x40b75e);}};module[_0x6b96('0x26')]=Agent; \ No newline at end of file +var _0x3d0d=['md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','idle','inuse','talking','toNumber','stringify','format','user:%s','emit','user:save','exports','lodash','util','moment'];(function(_0x21eccb,_0x300c64){var _0x57841c=function(_0x4e8855){while(--_0x4e8855){_0x21eccb['push'](_0x21eccb['shift']());}};_0x57841c(++_0x300c64);}(_0x3d0d,0xcf));var _0xd3d0=function(_0x376cd5,_0x13f003){_0x376cd5=_0x376cd5-0x0;var _0x18c967=_0x3d0d[_0x376cd5];return _0x18c967;};'use strict';var _=require(_0xd3d0('0x0'));var util=require(_0xd3d0('0x1'));var moment=require(_0xd3d0('0x2'));var md5=require(_0xd3d0('0x3'));var Redis=require(_0xd3d0('0x4'));var config=require(_0xd3d0('0x5'));config[_0xd3d0('0x6')]=_['defaults'](config['redis'],{'host':_0xd3d0('0x7'),'port':0x18eb});var io=require(_0xd3d0('0x8'))(new Redis(config[_0xd3d0('0x6')]));function Agent(_0x5303c2){this['id']=_0x5303c2['id']||0x0;this['name']=_0x5303c2[_0xd3d0('0x9')]||'';this[_0xd3d0('0xa')]=_0x5303c2[_0xd3d0('0xa')]||'';this[_0xd3d0('0xb')]=_0x5303c2['accountcode']||'';this[_0xd3d0('0xc')]=_0x5303c2['fullname']||'';this['state']=_0xd3d0('0xd');this[_0xd3d0('0xe')]=0x0;this[_0xd3d0('0xf')]=_0xd3d0('0xd');this[_0xd3d0('0x10')]='';this[_0xd3d0('0x11')]='';this[_0xd3d0('0x12')]='';this[_0xd3d0('0x13')]='';this[_0xd3d0('0x14')]=_0x5303c2[_0xd3d0('0x14')]||![];this[_0xd3d0('0x15')]=_0xd3d0('0xd');this[_0xd3d0('0x16')]=0x0;this[_0xd3d0('0x17')]='';this[_0xd3d0('0x18')]='';this[_0xd3d0('0x19')]=![];this[_0xd3d0('0x1a')]=![];this[_0xd3d0('0x3')]='';}Agent[_0xd3d0('0x1b')][_0xd3d0('0x1c')]=function(_0x5090f6){var _0x212e2d;if(_0x5090f6&&_0x5090f6[_0xd3d0('0x1d')]){_0x212e2d=_0x5090f6[_0xd3d0('0x1d')][_0xd3d0('0x1e')]();switch(_0x212e2d){case _0xd3d0('0x1f'):_0x212e2d=_0xd3d0('0x20');break;case _0xd3d0('0x21'):_0x212e2d=_0xd3d0('0x22');break;}}if(_0x212e2d&&this['voiceStatus']!==_0x212e2d||_0x5090f6['statePause']){this[_0xd3d0('0x16')]=_[_0xd3d0('0x23')](moment()['format']('x'));}if(_0x212e2d){this[_0xd3d0('0x15')]=_0x212e2d;}var _0x5b09d8={'id':this['id'],'name':this[_0xd3d0('0x9')],'email':this[_0xd3d0('0xa')],'accountcode':this[_0xd3d0('0xb')],'fullname':this['fullname'],'state':this[_0xd3d0('0x1d')],'stateTime':this[_0xd3d0('0xe')],'status':this[_0xd3d0('0xf')],'address':this[_0xd3d0('0x10')],'online':this[_0xd3d0('0x14')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0xd3d0('0x17')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0xd3d0('0x13')],'onhold':this[_0xd3d0('0x19')]};var _0x4c3f0a=md5(JSON[_0xd3d0('0x24')](_0x5b09d8));if(this['md5']!==_0x4c3f0a){this[_0xd3d0('0x3')]=_0x4c3f0a;io['to'](util[_0xd3d0('0x25')](_0xd3d0('0x26'),_0x5b09d8[_0xd3d0('0x9')]))[_0xd3d0('0x27')](_0xd3d0('0x28'),_0x5b09d8);}};module[_0xd3d0('0x29')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 1ad61d9..11c1db0 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 _0x799a=['Trunk','Interval','SquareProject','dialQueueProject','name','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup'];(function(_0x18a662,_0x49e08d){var _0xec6ae0=function(_0x25eb41){while(--_0x25eb41){_0x18a662['push'](_0x18a662['shift']());}};_0xec6ae0(++_0x49e08d);}(_0x799a,0x187));var _0xa799=function(_0x2b7836,_0x55385){_0x2b7836=_0x2b7836-0x0;var _0x11ac9f=_0x799a[_0x2b7836];return _0x11ac9f;};'use strict';function Campaign(_0x47a687){this['id']=_0x47a687['id']||0x0;this['name']=_0x47a687['name']||'';this[_0xa799('0x0')]=_0x47a687['type']||_0xa799('0x1');this['originated']=0x0;this[_0xa799('0x2')]=0x0;this[_0xa799('0x3')]=0x0;this[_0xa799('0x4')]=0x0;this[_0xa799('0x5')]='';this['sendMessageOneNotActive']=!![];this['active']=_0x47a687[_0xa799('0x6')];this[_0xa799('0x7')]=_0x47a687[_0xa799('0x7')];this[_0xa799('0x8')]=_0x47a687[_0xa799('0x8')]||null;this[_0xa799('0x9')]=_0x47a687[_0xa799('0x9')]?_0x47a687['dialGlobalInterval']:null;this[_0xa799('0xa')]=_0x47a687['dialOriginateCallerIdName'];this[_0xa799('0xb')]=_0x47a687['dialOriginateCallerIdNumber'];this[_0xa799('0xc')]=_0x47a687['dialOriginateTimeout']||0x1e;this[_0xa799('0xd')]=_0x47a687[_0xa799('0xd')];this['dialCongestionRetryFrequency']=_0x47a687[_0xa799('0xe')];this['dialBusyMaxRetry']=_0x47a687['dialBusyMaxRetry'];this[_0xa799('0xf')]=_0x47a687[_0xa799('0xf')];this[_0xa799('0x10')]=_0x47a687['dialNoAnswerMaxRetry'];this[_0xa799('0x11')]=_0x47a687[_0xa799('0x11')];this['dialGlobalMaxRetry']=_0x47a687['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x47a687[_0xa799('0x12')]||0x3;this[_0xa799('0x13')]=_0x47a687[_0xa799('0x13')]||0x96;this[_0xa799('0x14')]=_0x47a687[_0xa799('0x14')]||0x3;this[_0xa799('0x15')]=_0x47a687[_0xa799('0x15')]||0x96;this[_0xa799('0x16')]=_0x47a687[_0xa799('0x16')]||0x3;this[_0xa799('0x17')]=_0x47a687[_0xa799('0x17')]||0x96;this[_0xa799('0x18')]=_0x47a687[_0xa799('0x18')]||0x3;this[_0xa799('0x19')]=_0x47a687[_0xa799('0x19')]||0x96;this[_0xa799('0x1a')]=_0x47a687[_0xa799('0x1a')]||0x3;this[_0xa799('0x1b')]=_0x47a687[_0xa799('0x1b')]||0x96;this[_0xa799('0x1c')]=_0x47a687[_0xa799('0x1c')]||'DESC';this['dialPrefix']=_0x47a687['dialPrefix']||undefined;this[_0xa799('0x1d')]=_0x47a687['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x47a687[_0xa799('0x1e')]||undefined;this[_0xa799('0x1f')]=_0x47a687[_0xa799('0x1f')]?_0x47a687[_0xa799('0x1f')]:undefined;this[_0xa799('0x20')]=_0x47a687[_0xa799('0x20')]?_0x47a687[_0xa799('0x20')]:undefined;this[_0xa799('0x21')]=_0x47a687[_0xa799('0x21')]?_0x47a687['Interval']:undefined;this[_0xa799('0x22')]=_0x47a687[_0xa799('0x22')]?_0x47a687['SquareProject']:undefined;this[_0xa799('0x23')]=_0x47a687[_0xa799('0x22')]?_0x47a687[_0xa799('0x22')][_0xa799('0x24')]:undefined;this[_0xa799('0x25')]=_0x47a687['dialAMDActive']||![];this[_0xa799('0x26')]=_0x47a687['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x47a687['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x47a687[_0xa799('0x27')];this[_0xa799('0x28')]=_0x47a687[_0xa799('0x28')];this[_0xa799('0x29')]=_0x47a687[_0xa799('0x29')];this[_0xa799('0x2a')]=_0x47a687[_0xa799('0x2a')];this['dialAMDMaximumNumberOfWords']=_0x47a687[_0xa799('0x2b')];this[_0xa799('0x2c')]=_0x47a687[_0xa799('0x2c')];this[_0xa799('0x2d')]=_0x47a687['dialAMDMaximumWordLength'];}module[_0xa799('0x2e')]=Campaign; \ No newline at end of file +var _0x99a1=['TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','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'];(function(_0x44ae4f,_0x4eb8bf){var _0x46aaaf=function(_0x417dd1){while(--_0x417dd1){_0x44ae4f['push'](_0x44ae4f['shift']());}};_0x46aaaf(++_0x4eb8bf);}(_0x99a1,0x13b));var _0x199a=function(_0x45ac67,_0x4f4dee){_0x45ac67=_0x45ac67-0x0;var _0x5749f8=_0x99a1[_0x45ac67];return _0x5749f8;};'use strict';function Campaign(_0x2937bf){this['id']=_0x2937bf['id']||0x0;this[_0x199a('0x0')]=_0x2937bf[_0x199a('0x0')]||'';this['type']=_0x2937bf[_0x199a('0x1')]||'campaign';this['originated']=0x0;this[_0x199a('0x2')]=0x0;this[_0x199a('0x3')]=0x0;this[_0x199a('0x4')]=0x0;this[_0x199a('0x5')]='';this['sendMessageOneNotActive']=!![];this[_0x199a('0x6')]=_0x2937bf[_0x199a('0x6')];this[_0x199a('0x7')]=_0x2937bf[_0x199a('0x7')];this[_0x199a('0x8')]=_0x2937bf[_0x199a('0x8')]||null;this[_0x199a('0x9')]=_0x2937bf[_0x199a('0x9')]?_0x2937bf['dialGlobalInterval']:null;this[_0x199a('0xa')]=_0x2937bf[_0x199a('0xa')];this['dialOriginateCallerIdNumber']=_0x2937bf[_0x199a('0xb')];this[_0x199a('0xc')]=_0x2937bf['dialOriginateTimeout']||0x1e;this[_0x199a('0xd')]=_0x2937bf[_0x199a('0xd')];this[_0x199a('0xe')]=_0x2937bf[_0x199a('0xe')];this[_0x199a('0xf')]=_0x2937bf[_0x199a('0xf')];this[_0x199a('0x10')]=_0x2937bf['dialBusyRetryFrequency'];this[_0x199a('0x11')]=_0x2937bf['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x2937bf[_0x199a('0x12')];this['dialGlobalMaxRetry']=_0x2937bf[_0x199a('0x13')];this[_0x199a('0x14')]=_0x2937bf[_0x199a('0x14')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x2937bf[_0x199a('0x15')]||0x96;this['dialDropMaxRetry']=_0x2937bf[_0x199a('0x16')]||0x3;this[_0x199a('0x17')]=_0x2937bf[_0x199a('0x17')]||0x96;this[_0x199a('0x18')]=_0x2937bf[_0x199a('0x18')]||0x3;this[_0x199a('0x19')]=_0x2937bf[_0x199a('0x19')]||0x96;this[_0x199a('0x1a')]=_0x2937bf[_0x199a('0x1a')]||0x3;this[_0x199a('0x1b')]=_0x2937bf[_0x199a('0x1b')]||0x96;this[_0x199a('0x1c')]=_0x2937bf['dialAgentRejectMaxRetry']||0x3;this[_0x199a('0x1d')]=_0x2937bf[_0x199a('0x1d')]||0x96;this[_0x199a('0x1e')]=_0x2937bf[_0x199a('0x1e')]||_0x199a('0x1f');this[_0x199a('0x20')]=_0x2937bf[_0x199a('0x20')]||undefined;this[_0x199a('0x21')]=_0x2937bf[_0x199a('0x21')]||undefined;this['dialCutDigit']=_0x2937bf[_0x199a('0x22')]||undefined;this['TrunkBackup']=_0x2937bf[_0x199a('0x23')]?_0x2937bf[_0x199a('0x23')]:undefined;this['Trunk']=_0x2937bf[_0x199a('0x24')]?_0x2937bf[_0x199a('0x24')]:undefined;this[_0x199a('0x25')]=_0x2937bf['Interval']?_0x2937bf[_0x199a('0x25')]:undefined;this[_0x199a('0x26')]=_0x2937bf[_0x199a('0x26')]?_0x2937bf[_0x199a('0x26')]:undefined;this[_0x199a('0x27')]=_0x2937bf[_0x199a('0x26')]?_0x2937bf[_0x199a('0x26')][_0x199a('0x0')]:undefined;this[_0x199a('0x28')]=_0x2937bf[_0x199a('0x28')]||![];this['dialAMDInitialSilence']=_0x2937bf[_0x199a('0x29')];this[_0x199a('0x2a')]=_0x2937bf[_0x199a('0x2a')];this[_0x199a('0x2b')]=_0x2937bf['dialAMDAfterGreetingSilence'];this[_0x199a('0x2c')]=_0x2937bf[_0x199a('0x2c')];this[_0x199a('0x2d')]=_0x2937bf['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x2937bf[_0x199a('0x2e')];this['dialAMDMaximumNumberOfWords']=_0x2937bf['dialAMDMaximumNumberOfWords'];this[_0x199a('0x2f')]=_0x2937bf[_0x199a('0x2f')];this[_0x199a('0x30')]=_0x2937bf[_0x199a('0x30')];}module[_0x199a('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 e27f861..ea5069a 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 _0x223e=['type','disposition','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','exports','starttime','channel','destinationchannel','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','answered','answertime','unmanaged','abandoned','lastdata','duration','billableseconds','holdtime'];(function(_0x26db28,_0x30addf){var _0x482b0a=function(_0x4fadf6){while(--_0x4fadf6){_0x26db28['push'](_0x26db28['shift']());}};_0x482b0a(++_0x30addf);}(_0x223e,0x1b1));var _0xe223=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x223e[_0x3ab9ee];return _0x82ee88;};'use strict';function Channel(){this[_0xe223('0x0')]=null;this[_0xe223('0x1')]='';this[_0xe223('0x2')]='';this['calleridnum']=0x0;this[_0xe223('0x3')]='';this[_0xe223('0x4')]=undefined;this[_0xe223('0x5')]=undefined;this[_0xe223('0x6')]=0x0;this[_0xe223('0x7')]='';this[_0xe223('0x8')]=0x0;this['linkedid']=0x0;this['exten']=0x0;this[_0xe223('0x9')]=![];this[_0xe223('0xa')]=null;this['endtime']=null;this[_0xe223('0xb')]=![];this[_0xe223('0xc')]=![];this['lastapplication']='';this[_0xe223('0xd')]='';this[_0xe223('0xe')]=0x0;this[_0xe223('0xf')]=0x0;this[_0xe223('0x10')]=0x0;this[_0xe223('0x11')]=null;this['tag']=null;this[_0xe223('0x12')]=null;this['monitor']=![];this[_0xe223('0x13')]=null;this[_0xe223('0x14')]=null;this[_0xe223('0x15')]=[];this[_0xe223('0x16')]=undefined;this[_0xe223('0x17')]=undefined;this['mohtime']=0x0;}module[_0xe223('0x18')]=Channel; \ No newline at end of file +var _0xbf77=['accountcode','uniqueid','linkedid','exten','answertime','endtime','abandoned','lastapplication','lastdata','duration','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','mohtime','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename'];(function(_0x3f4315,_0xd6ec89){var _0x5842e3=function(_0x4b12f5){while(--_0x4b12f5){_0x3f4315['push'](_0x3f4315['shift']());}};_0x5842e3(++_0xd6ec89);}(_0xbf77,0xec));var _0x7bf7=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xbf77[_0x45d55e];return _0x29812a;};'use strict';function Channel(){this[_0x7bf7('0x0')]=null;this[_0x7bf7('0x1')]='';this[_0x7bf7('0x2')]='';this[_0x7bf7('0x3')]=0x0;this[_0x7bf7('0x4')]='';this[_0x7bf7('0x5')]=undefined;this[_0x7bf7('0x6')]=undefined;this[_0x7bf7('0x7')]=0x0;this['context']='';this[_0x7bf7('0x8')]=0x0;this[_0x7bf7('0x9')]=0x0;this[_0x7bf7('0xa')]=0x0;this['answered']=![];this[_0x7bf7('0xb')]=null;this[_0x7bf7('0xc')]=null;this['unmanaged']=![];this[_0x7bf7('0xd')]=![];this[_0x7bf7('0xe')]='';this[_0x7bf7('0xf')]='';this[_0x7bf7('0x10')]=0x0;this['billableseconds']=0x0;this[_0x7bf7('0x11')]=0x0;this[_0x7bf7('0x12')]=null;this[_0x7bf7('0x13')]=null;this[_0x7bf7('0x14')]=null;this[_0x7bf7('0x15')]=![];this[_0x7bf7('0x16')]=null;this[_0x7bf7('0x17')]=null;this[_0x7bf7('0x18')]=[];this[_0x7bf7('0x19')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x7bf7('0x1a')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 153af9d..9b7f2d4 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 _0x43fd=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x2f9f77,_0x3a721d){var _0x3445b2=function(_0x2cd4d2){while(--_0x2cd4d2){_0x2f9f77['push'](_0x2f9f77['shift']());}};_0x3445b2(++_0x3a721d);}(_0x43fd,0x1ec));var _0xd43f=function(_0x3f5ad1,_0x29d06c){_0x3f5ad1=_0x3f5ad1-0x0;var _0x13f01a=_0x43fd[_0x3f5ad1];return _0x13f01a;};'use strict';function DeskAccount(_0xa81b26){this['id']=_0xa81b26['id']||0x0;this[_0xd43f('0x0')]=_0xa81b26['name']||'';this['username']=_0xa81b26[_0xd43f('0x1')]||'';this[_0xd43f('0x2')]=_0xa81b26['remoteUri']||'';this[_0xd43f('0x3')]=_0xa81b26['authType']||'';this[_0xd43f('0x4')]=_0xa81b26[_0xd43f('0x4')]||'';this[_0xd43f('0x5')]=_0xa81b26[_0xd43f('0x5')]||'';this['consumerSecret']=_0xa81b26[_0xd43f('0x6')]||'';this[_0xd43f('0x7')]=_0xa81b26[_0xd43f('0x7')]||'';this[_0xd43f('0x8')]=_0xa81b26['tokenSecret']||'';this[_0xd43f('0x9')]=_0xa81b26[_0xd43f('0x9')]||'';this['serverUrl']=_0xa81b26[_0xd43f('0xa')]||'';this[_0xd43f('0xb')]=_0xa81b26[_0xd43f('0xb')]||{};}module[_0xd43f('0xc')]=DeskAccount; \ No newline at end of file +var _0x3edc=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username'];(function(_0x420f2a,_0x2cc58d){var _0x28f802=function(_0x3329cc){while(--_0x3329cc){_0x420f2a['push'](_0x420f2a['shift']());}};_0x28f802(++_0x2cc58d);}(_0x3edc,0x1ae));var _0xc3ed=function(_0x148d34,_0x4c14a7){_0x148d34=_0x148d34-0x0;var _0x9266b4=_0x3edc[_0x148d34];return _0x9266b4;};'use strict';function DeskAccount(_0x12aed1){this['id']=_0x12aed1['id']||0x0;this[_0xc3ed('0x0')]=_0x12aed1[_0xc3ed('0x0')]||'';this[_0xc3ed('0x1')]=_0x12aed1[_0xc3ed('0x1')]||'';this['remoteUri']=_0x12aed1[_0xc3ed('0x2')]||'';this['authType']=_0x12aed1[_0xc3ed('0x3')]||'';this[_0xc3ed('0x4')]=_0x12aed1[_0xc3ed('0x4')]||'';this[_0xc3ed('0x5')]=_0x12aed1[_0xc3ed('0x5')]||'';this['consumerSecret']=_0x12aed1[_0xc3ed('0x6')]||'';this[_0xc3ed('0x7')]=_0x12aed1[_0xc3ed('0x7')]||'';this[_0xc3ed('0x8')]=_0x12aed1[_0xc3ed('0x8')]||'';this[_0xc3ed('0x9')]=_0x12aed1['type']||'';this[_0xc3ed('0xa')]=_0x12aed1[_0xc3ed('0xa')]||'';this[_0xc3ed('0xb')]=_0x12aed1['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 4a8604a..be0b144 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 _0x17da=['serverUrl','Configurations','exports','name','username','password','remoteUri','clientId','clientSecret'];(function(_0x16aaab,_0x427186){var _0x486ccc=function(_0x310be5){while(--_0x310be5){_0x16aaab['push'](_0x16aaab['shift']());}};_0x486ccc(++_0x427186);}(_0x17da,0x108));var _0xa17d=function(_0x283e8e,_0x2f3c9e){_0x283e8e=_0x283e8e-0x0;var _0x2efc59=_0x17da[_0x283e8e];return _0x2efc59;};'use strict';function Dynamics365Account(_0x2cc2c7){this['id']=_0x2cc2c7['id']||0x0;this[_0xa17d('0x0')]=_0x2cc2c7[_0xa17d('0x0')]||'';this['username']=_0x2cc2c7[_0xa17d('0x1')]||'';this[_0xa17d('0x2')]=_0x2cc2c7[_0xa17d('0x2')]||'';this['remoteUri']=_0x2cc2c7[_0xa17d('0x3')]||'';this['tenantId']=_0x2cc2c7['tenantId']||'';this[_0xa17d('0x4')]=_0x2cc2c7['clientId']||'';this[_0xa17d('0x5')]=_0x2cc2c7[_0xa17d('0x5')]||{};this[_0xa17d('0x6')]=_0x2cc2c7[_0xa17d('0x6')]||'';this[_0xa17d('0x7')]=_0x2cc2c7[_0xa17d('0x7')]||{};}module[_0xa17d('0x8')]=Dynamics365Account; \ No newline at end of file +var _0xf802=['serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x7c0074,_0x1ffdcf){var _0x13e95b=function(_0x521212){while(--_0x521212){_0x7c0074['push'](_0x7c0074['shift']());}};_0x13e95b(++_0x1ffdcf);}(_0xf802,0x1ed));var _0x2f80=function(_0x2168af,_0x592462){_0x2168af=_0x2168af-0x0;var _0x7af4f5=_0xf802[_0x2168af];return _0x7af4f5;};'use strict';function Dynamics365Account(_0x54b596){this['id']=_0x54b596['id']||0x0;this[_0x2f80('0x0')]=_0x54b596[_0x2f80('0x0')]||'';this[_0x2f80('0x1')]=_0x54b596[_0x2f80('0x1')]||'';this[_0x2f80('0x2')]=_0x54b596[_0x2f80('0x2')]||'';this[_0x2f80('0x3')]=_0x54b596['remoteUri']||'';this[_0x2f80('0x4')]=_0x54b596[_0x2f80('0x4')]||'';this['clientId']=_0x54b596[_0x2f80('0x5')]||'';this[_0x2f80('0x6')]=_0x54b596[_0x2f80('0x6')]||{};this[_0x2f80('0x7')]=_0x54b596[_0x2f80('0x7')]||'';this[_0x2f80('0x8')]=_0x54b596[_0x2f80('0x8')]||{};}module[_0x2f80('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 30b2c2e..89db268 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 _0x7a35=['headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm'];(function(_0x29ee83,_0x927e0a){var _0x156bcd=function(_0x13c0a7){while(--_0x13c0a7){_0x29ee83['push'](_0x29ee83['shift']());}};_0x156bcd(++_0x927e0a);}(_0x7a35,0x1ea));var _0x57a3=function(_0x41382c,_0xc3ffd1){_0x41382c=_0x41382c-0x0;var _0x4da35b=_0x7a35[_0x41382c];return _0x4da35b;};'use strict';function FaxAccount(_0x474512){this['id']=_0x474512['id']||0x0;this['name']=_0x474512[_0x57a3('0x0')]||'';this['description']=_0x474512[_0x57a3('0x1')];this[_0x57a3('0x2')]=_0x474512['ecm'];this[_0x57a3('0x3')]=_0x474512[_0x57a3('0x3')];this[_0x57a3('0x4')]=_0x474512[_0x57a3('0x4')];this[_0x57a3('0x5')]=_0x474512[_0x57a3('0x5')]||0x960;this[_0x57a3('0x6')]=_0x474512[_0x57a3('0x6')]||0x3840;this[_0x57a3('0x7')]=_0x474512['modem']||_0x57a3('0x8');this['gateway']=_0x474512[_0x57a3('0x9')]||'no';this['faxdetect']=_0x474512[_0x57a3('0xa')]||'no';this['t38timeout']=_0x474512[_0x57a3('0xb')]||0x1388;this[_0x57a3('0xc')]=_0x474512[_0x57a3('0xc')]||'SIP';this['Trunk']=_0x474512[_0x57a3('0xd')]?_0x474512[_0x57a3('0xd')]:undefined;this[_0x57a3('0xe')]=_0x474512[_0x57a3('0xe')];this[_0x57a3('0xf')]=_0x474512['key'];}module[_0x57a3('0x10')]=FaxAccount; \ No newline at end of file +var _0xb0c8=['name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb0c8,0x168));var _0x8b0c=function(_0x57bf33,_0x3a5f79){_0x57bf33=_0x57bf33-0x0;var _0x584a20=_0xb0c8[_0x57bf33];return _0x584a20;};'use strict';function FaxAccount(_0x2fa495){this['id']=_0x2fa495['id']||0x0;this[_0x8b0c('0x0')]=_0x2fa495[_0x8b0c('0x0')]||'';this[_0x8b0c('0x1')]=_0x2fa495['description'];this['ecm']=_0x2fa495[_0x8b0c('0x2')];this[_0x8b0c('0x3')]=_0x2fa495[_0x8b0c('0x3')];this['localstationid']=_0x2fa495[_0x8b0c('0x4')];this[_0x8b0c('0x5')]=_0x2fa495['minrate']||0x960;this[_0x8b0c('0x6')]=_0x2fa495[_0x8b0c('0x6')]||0x3840;this[_0x8b0c('0x7')]=_0x2fa495[_0x8b0c('0x7')]||_0x8b0c('0x8');this[_0x8b0c('0x9')]=_0x2fa495[_0x8b0c('0x9')]||'no';this[_0x8b0c('0xa')]=_0x2fa495['faxdetect']||'no';this[_0x8b0c('0xb')]=_0x2fa495[_0x8b0c('0xb')]||0x1388;this[_0x8b0c('0xc')]=_0x2fa495[_0x8b0c('0xc')]||_0x8b0c('0xd');this[_0x8b0c('0xe')]=_0x2fa495[_0x8b0c('0xe')]?_0x2fa495['Trunk']:undefined;this[_0x8b0c('0xf')]=_0x2fa495[_0x8b0c('0xf')];this[_0x8b0c('0x10')]=_0x2fa495[_0x8b0c('0x10')];}module[_0x8b0c('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 d41aae9..efe5ec8 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 _0x4028=['token','remoteUri','serverUrl','Configurations','name','username'];(function(_0x1fcddb,_0x304947){var _0x5a6b79=function(_0x4e152e){while(--_0x4e152e){_0x1fcddb['push'](_0x1fcddb['shift']());}};_0x5a6b79(++_0x304947);}(_0x4028,0x15a));var _0x8402=function(_0x4adcfc,_0xd67fcf){_0x4adcfc=_0x4adcfc-0x0;var _0x1295eb=_0x4028[_0x4adcfc];return _0x1295eb;};'use strict';function FreshdeskAccount(_0x8cf9c){this['id']=_0x8cf9c['id']||0x0;this['name']=_0x8cf9c[_0x8402('0x0')]||'';this[_0x8402('0x1')]=_0x8cf9c[_0x8402('0x1')]||'';this['apiKey']=_0x8cf9c[_0x8402('0x2')]||'';this[_0x8402('0x3')]=_0x8cf9c[_0x8402('0x3')]||'';this[_0x8402('0x4')]=_0x8cf9c[_0x8402('0x4')]||'';this['Configurations']=_0x8cf9c[_0x8402('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x45c4=['exports','name','username','remoteUri','serverUrl','Configurations'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x45c4,0x91));var _0x445c=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x45c4[_0x1da527];return _0x40fc7c;};'use strict';function FreshdeskAccount(_0x54e514){this['id']=_0x54e514['id']||0x0;this[_0x445c('0x0')]=_0x54e514[_0x445c('0x0')]||'';this[_0x445c('0x1')]=_0x54e514[_0x445c('0x1')]||'';this['apiKey']=_0x54e514['token']||'';this[_0x445c('0x2')]=_0x54e514[_0x445c('0x2')]||'';this['serverUrl']=_0x54e514[_0x445c('0x3')]||'';this['Configurations']=_0x54e514[_0x445c('0x4')]||{};}module[_0x445c('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 3107666..cf1739d 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 _0xd4e1=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x5e489e,_0x1f4b49){var _0x1832fb=function(_0x1246d7){while(--_0x1246d7){_0x5e489e['push'](_0x5e489e['shift']());}};_0x1832fb(++_0x1f4b49);}(_0xd4e1,0xb5));var _0x1d4e=function(_0x59f41b,_0x16ac45){_0x59f41b=_0x59f41b-0x0;var _0x1da0e6=_0xd4e1[_0x59f41b];return _0x1da0e6;};'use strict';function FreshsalesAccount(_0x59c9c3){this['id']=_0x59c9c3['id']||0x0;this[_0x1d4e('0x0')]=_0x59c9c3[_0x1d4e('0x0')]||'';this['username']=_0x59c9c3[_0x1d4e('0x1')]||'';this[_0x1d4e('0x2')]=_0x59c9c3[_0x1d4e('0x3')]||'';this[_0x1d4e('0x4')]=_0x59c9c3['remoteUri']||'';this[_0x1d4e('0x5')]=_0x59c9c3[_0x1d4e('0x5')]||'';this[_0x1d4e('0x6')]=_0x59c9c3[_0x1d4e('0x6')]||{};}module[_0x1d4e('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x2ad5=['name','username','remoteUri','serverUrl','Configurations','exports'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x2ad5,0x1d4));var _0x52ad=function(_0x2cacd7,_0x12135a){_0x2cacd7=_0x2cacd7-0x0;var _0x1bbd9d=_0x2ad5[_0x2cacd7];return _0x1bbd9d;};'use strict';function FreshsalesAccount(_0x4a6981){this['id']=_0x4a6981['id']||0x0;this[_0x52ad('0x0')]=_0x4a6981['name']||'';this[_0x52ad('0x1')]=_0x4a6981[_0x52ad('0x1')]||'';this['apiKey']=_0x4a6981['token']||'';this[_0x52ad('0x2')]=_0x4a6981[_0x52ad('0x2')]||'';this[_0x52ad('0x3')]=_0x4a6981[_0x52ad('0x3')]||'';this[_0x52ad('0x4')]=_0x4a6981[_0x52ad('0x4')]||{};}module[_0x52ad('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 9eeb881..c9abc04 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 _0x179e=['type','inbound','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','exten','priority','holdtime','assigned','variables','exports'];(function(_0x244a39,_0x6bcb51){var _0x26ffdc=function(_0x60c512){while(--_0x60c512){_0x244a39['push'](_0x244a39['shift']());}};_0x26ffdc(++_0x6bcb51);}(_0x179e,0x168));var _0xe179=function(_0x40ad05,_0x18c3ae){_0x40ad05=_0x40ad05-0x0;var _0x5cc00f=_0x179e[_0x40ad05];return _0x5cc00f;};'use strict';function QueueReport(){this[_0xe179('0x0')]=_0xe179('0x1');this[_0xe179('0x2')]='';this['calleridnum']='';this['calleridname']='';this[_0xe179('0x3')]='';this[_0xe179('0x4')]=null;this[_0xe179('0x5')]=null;this[_0xe179('0x6')]=0x1;this[_0xe179('0x7')]=0x1;this[_0xe179('0x8')]=![];this[_0xe179('0x9')]=null;this[_0xe179('0xa')]=![];this['queuecallercompleteAt']=null;this[_0xe179('0xb')]=![];this[_0xe179('0xc')]=null;this[_0xe179('0xd')]=0x1;this[_0xe179('0xe')]='';this[_0xe179('0xf')]='';this[_0xe179('0x10')]='';this[_0xe179('0x11')]='';this['context']='';this[_0xe179('0x12')]='';this[_0xe179('0x13')]='';this[_0xe179('0x14')]=0x0;this[_0xe179('0x15')]=![];this['lastAssignedTo']='';this['mohtime']=0x0;this[_0xe179('0x16')]={};}module[_0xe179('0x17')]=QueueReport; \ No newline at end of file +var _0x1f06=['holdtime','assigned','lastAssignedTo','mohtime','variables','exports','type','uniqueid','calleridnum','calleridname','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','exten','priority'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1f06,0xde));var _0x61f0=function(_0x154273,_0x361b7d){_0x154273=_0x154273-0x0;var _0x50aafb=_0x1f06[_0x154273];return _0x50aafb;};'use strict';function QueueReport(){this[_0x61f0('0x0')]='inbound';this[_0x61f0('0x1')]='';this[_0x61f0('0x2')]='';this[_0x61f0('0x3')]='';this['queue']='';this['queuecallerjoinAt']=null;this[_0x61f0('0x4')]=null;this[_0x61f0('0x5')]=0x1;this[_0x61f0('0x6')]=0x1;this[_0x61f0('0x7')]=![];this[_0x61f0('0x8')]=null;this[_0x61f0('0x9')]=![];this['queuecallercompleteAt']=null;this[_0x61f0('0xa')]=![];this[_0x61f0('0xb')]=null;this[_0x61f0('0xc')]=0x1;this[_0x61f0('0xd')]='';this[_0x61f0('0xe')]='';this[_0x61f0('0xf')]='';this['accountcode']='';this['context']='';this[_0x61f0('0x10')]='';this[_0x61f0('0x11')]='';this[_0x61f0('0x12')]=0x0;this[_0x61f0('0x13')]=![];this[_0x61f0('0x14')]='';this[_0x61f0('0x15')]=0x0;this[_0x61f0('0x16')]={};}module[_0x61f0('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 09ea80a..59c200b 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 _0x452d=['integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','securityToken','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x452d,0x7d));var _0xd452=function(_0x17c7b6,_0x2384c2){_0x17c7b6=_0x17c7b6-0x0;var _0x27c064=_0x452d[_0x17c7b6];return _0x27c064;};'use strict';function SalesforceAccount(_0x3b9cd3){this['id']=_0x3b9cd3['id']||0x0;this[_0xd452('0x0')]=_0x3b9cd3[_0xd452('0x0')]||'';this['username']=_0x3b9cd3[_0xd452('0x1')]||'';this[_0xd452('0x2')]=_0x3b9cd3[_0xd452('0x2')]||'';this[_0xd452('0x3')]=_0x3b9cd3[_0xd452('0x3')]||'';this['clientId']=_0x3b9cd3[_0xd452('0x4')]||'';this['clientSecret']=_0x3b9cd3['clientSecret']||'';this[_0xd452('0x5')]=_0x3b9cd3[_0xd452('0x5')]||'';this[_0xd452('0x6')]=_0x3b9cd3['type']||_0xd452('0x7');this[_0xd452('0x8')]=_0x3b9cd3[_0xd452('0x8')]||'';this[_0xd452('0x9')]=_0x3b9cd3[_0xd452('0x9')]||{};}module[_0xd452('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xd52f=['type','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x2168bf,_0x3e93f4){var _0x3008bc=function(_0x35e598){while(--_0x35e598){_0x2168bf['push'](_0x2168bf['shift']());}};_0x3008bc(++_0x3e93f4);}(_0xd52f,0x7d));var _0xfd52=function(_0x5b5569,_0x3f28e5){_0x5b5569=_0x5b5569-0x0;var _0x3dae48=_0xd52f[_0x5b5569];return _0x3dae48;};'use strict';function SalesforceAccount(_0x269cab){this['id']=_0x269cab['id']||0x0;this[_0xfd52('0x0')]=_0x269cab[_0xfd52('0x0')]||'';this[_0xfd52('0x1')]=_0x269cab[_0xfd52('0x1')]||'';this[_0xfd52('0x2')]=_0x269cab[_0xfd52('0x2')]||'';this[_0xfd52('0x3')]=_0x269cab['password']||'';this['clientId']=_0x269cab[_0xfd52('0x4')]||'';this[_0xfd52('0x5')]=_0x269cab[_0xfd52('0x5')]||'';this[_0xfd52('0x6')]=_0x269cab[_0xfd52('0x6')]||'';this['type']=_0x269cab[_0xfd52('0x7')]||'integrationTab';this[_0xfd52('0x8')]=_0x269cab[_0xfd52('0x8')]||'';this['Configurations']=_0x269cab[_0xfd52('0x9')]||{};}module[_0xfd52('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 419c2e8..01819f8 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 _0x2374=['serverUrl','Configurations','exports','name','password','remoteUri'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2374,0x129));var _0x4237=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x2374[_0xfae23b];return _0x200640;};'use strict';function ServicenowAccount(_0xb5d1c6){this['id']=_0xb5d1c6['id']||0x0;this[_0x4237('0x0')]=_0xb5d1c6['name']||'';this['username']=_0xb5d1c6['username']||'';this['password']=_0xb5d1c6[_0x4237('0x1')]||'';this[_0x4237('0x2')]=_0xb5d1c6[_0x4237('0x2')]||'';this[_0x4237('0x3')]=_0xb5d1c6[_0x4237('0x3')]||'';this[_0x4237('0x4')]=_0xb5d1c6[_0x4237('0x4')]||{};}module[_0x4237('0x5')]=ServicenowAccount; \ No newline at end of file +var _0xefa4=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0xefa4,0x1d9));var _0x4efa=function(_0x1e2a32,_0x430072){_0x1e2a32=_0x1e2a32-0x0;var _0x1bf586=_0xefa4[_0x1e2a32];return _0x1bf586;};'use strict';function ServicenowAccount(_0x187dd4){this['id']=_0x187dd4['id']||0x0;this[_0x4efa('0x0')]=_0x187dd4[_0x4efa('0x0')]||'';this[_0x4efa('0x1')]=_0x187dd4[_0x4efa('0x1')]||'';this['password']=_0x187dd4[_0x4efa('0x2')]||'';this['remoteUri']=_0x187dd4[_0x4efa('0x3')]||'';this[_0x4efa('0x4')]=_0x187dd4['serverUrl']||'';this[_0x4efa('0x5')]=_0x187dd4[_0x4efa('0x5')]||{};}module[_0x4efa('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index f356f17..96a3bec 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 _0xc528=['password','remoteUri','serverUrl','exports','name'];(function(_0x1a784b,_0x546ccf){var _0xfe3c85=function(_0xf70c3e){while(--_0xf70c3e){_0x1a784b['push'](_0x1a784b['shift']());}};_0xfe3c85(++_0x546ccf);}(_0xc528,0x1a3));var _0x8c52=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc528[_0x321bb2];return _0x9c12ed;};'use strict';function SugarcrmAccount(_0x4b625b){this['id']=_0x4b625b['id']||0x0;this[_0x8c52('0x0')]=_0x4b625b[_0x8c52('0x0')]||'';this['username']=_0x4b625b['username']||'';this['password']=_0x4b625b[_0x8c52('0x1')]||'';this[_0x8c52('0x2')]=_0x4b625b[_0x8c52('0x2')]||'';this[_0x8c52('0x3')]=_0x4b625b[_0x8c52('0x3')]||'';this['Configurations']=_0x4b625b['Configurations']||{};}module[_0x8c52('0x4')]=SugarcrmAccount; \ No newline at end of file +var _0x8609=['password','serverUrl','Configurations','exports','name','username'];(function(_0x4c5a52,_0x59ef62){var _0x5b40f5=function(_0x4eb274){while(--_0x4eb274){_0x4c5a52['push'](_0x4c5a52['shift']());}};_0x5b40f5(++_0x59ef62);}(_0x8609,0x70));var _0x9860=function(_0x2c0bc1,_0x3e6629){_0x2c0bc1=_0x2c0bc1-0x0;var _0x30ca9b=_0x8609[_0x2c0bc1];return _0x30ca9b;};'use strict';function SugarcrmAccount(_0x5f276e){this['id']=_0x5f276e['id']||0x0;this[_0x9860('0x0')]=_0x5f276e['name']||'';this[_0x9860('0x1')]=_0x5f276e[_0x9860('0x1')]||'';this['password']=_0x5f276e[_0x9860('0x2')]||'';this['remoteUri']=_0x5f276e['remoteUri']||'';this[_0x9860('0x3')]=_0x5f276e[_0x9860('0x3')]||'';this[_0x9860('0x4')]=_0x5f276e['Configurations']||{};}module[_0x9860('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 64190a8..b685d65 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 _0x4a6d=['address','exports','name','accountcode','state','unknown','stateTime','status'];(function(_0xbbaca3,_0x5c175a){var _0x2b6630=function(_0x5de5e4){while(--_0x5de5e4){_0xbbaca3['push'](_0xbbaca3['shift']());}};_0x2b6630(++_0x5c175a);}(_0x4a6d,0xfa));var _0xd4a6=function(_0x500d5b,_0x2c05da){_0x500d5b=_0x500d5b-0x0;var _0x227b31=_0x4a6d[_0x500d5b];return _0x227b31;};'use strict';function Telephone(_0x5a036f){this['id']=_0x5a036f['id']||0x0;this[_0xd4a6('0x0')]=_0x5a036f['name']||'';this[_0xd4a6('0x1')]=_0x5a036f[_0xd4a6('0x1')]||'';this[_0xd4a6('0x2')]=_0xd4a6('0x3');this[_0xd4a6('0x4')]=0x0;this[_0xd4a6('0x5')]='unknown';this[_0xd4a6('0x6')]='';}module[_0xd4a6('0x7')]=Telephone; \ No newline at end of file +var _0x1220=['accountcode','state','unknown','stateTime','status','address','exports','name'];(function(_0x18fbd4,_0x5227c1){var _0x254dc7=function(_0x1a06fc){while(--_0x1a06fc){_0x18fbd4['push'](_0x18fbd4['shift']());}};_0x254dc7(++_0x5227c1);}(_0x1220,0xef));var _0x0122=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x1220[_0x209941];return _0x1e8729;};'use strict';function Telephone(_0x3052b6){this['id']=_0x3052b6['id']||0x0;this[_0x0122('0x0')]=_0x3052b6[_0x0122('0x0')]||'';this[_0x0122('0x1')]=_0x3052b6[_0x0122('0x1')]||'';this[_0x0122('0x2')]=_0x0122('0x3');this[_0x0122('0x4')]=0x0;this[_0x0122('0x5')]=_0x0122('0x3');this[_0x0122('0x6')]='';}module[_0x0122('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index fc4217c..34ce9d8 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 _0x83e0=['exports','name','html'];(function(_0x55dbd8,_0x2d8f59){var _0x5de922=function(_0xa58490){while(--_0xa58490){_0x55dbd8['push'](_0x55dbd8['shift']());}};_0x5de922(++_0x2d8f59);}(_0x83e0,0x1a2));var _0x083e=function(_0x87ea2e,_0x42ccc4){_0x87ea2e=_0x87ea2e-0x0;var _0x4e8b6f=_0x83e0[_0x87ea2e];return _0x4e8b6f;};'use strict';function template(_0x4851a2){this['id']=_0x4851a2['id']||0x0;this[_0x083e('0x0')]=_0x4851a2[_0x083e('0x0')]||'';this[_0x083e('0x1')]=_0x4851a2['html']||'';}module[_0x083e('0x2')]=template; \ No newline at end of file +var _0xb510=['html','name'];(function(_0x451975,_0x480521){var _0x12afc9=function(_0x5cf242){while(--_0x5cf242){_0x451975['push'](_0x451975['shift']());}};_0x12afc9(++_0x480521);}(_0xb510,0x173));var _0x0b51=function(_0x184396,_0x5ec84e){_0x184396=_0x184396-0x0;var _0x321b2a=_0xb510[_0x184396];return _0x321b2a;};'use strict';function template(_0x2e2176){this['id']=_0x2e2176['id']||0x0;this[_0x0b51('0x0')]=_0x2e2176[_0x0b51('0x0')]||'';this[_0x0b51('0x1')]=_0x2e2176[_0x0b51('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 104ad53..7017930 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 _0x4b84=['name','channel','status','AllConditions','Actions'];(function(_0x10aa92,_0x5e197f){var _0x453a17=function(_0x246e11){while(--_0x246e11){_0x10aa92['push'](_0x10aa92['shift']());}};_0x453a17(++_0x5e197f);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1e4f2f,_0x35edfa){_0x1e4f2f=_0x1e4f2f-0x0;var _0xccea89=_0x4b84[_0x1e4f2f];return _0xccea89;};'use strict';function Trigger(_0x90ff31){this['id']=_0x90ff31['id']||0x0;this[_0x44b8('0x0')]=_0x90ff31['name']||'';this['channel']=_0x90ff31[_0x44b8('0x1')]||'voice';this['status']=_0x90ff31[_0x44b8('0x2')]||![];this[_0x44b8('0x3')]=_0x90ff31[_0x44b8('0x3')]||[];this['AnyConditions']=_0x90ff31['AnyConditions']||[];this['Actions']=_0x90ff31[_0x44b8('0x4')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0xf3cd=['voice','status','AllConditions','AnyConditions','Actions','exports','name','channel'];(function(_0x3b1535,_0x29a55f){var _0xeaff70=function(_0x437200){while(--_0x437200){_0x3b1535['push'](_0x3b1535['shift']());}};_0xeaff70(++_0x29a55f);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x21090b,_0x39dd3b){_0x21090b=_0x21090b-0x0;var _0x3c68d7=_0xf3cd[_0x21090b];return _0x3c68d7;};'use strict';function Trigger(_0x13cb67){this['id']=_0x13cb67['id']||0x0;this[_0xdf3c('0x0')]=_0x13cb67[_0xdf3c('0x0')]||'';this[_0xdf3c('0x1')]=_0x13cb67[_0xdf3c('0x1')]||_0xdf3c('0x2');this['status']=_0x13cb67[_0xdf3c('0x3')]||![];this[_0xdf3c('0x4')]=_0x13cb67[_0xdf3c('0x4')]||[];this['AnyConditions']=_0x13cb67[_0xdf3c('0x5')]||[];this[_0xdf3c('0x6')]=_0x13cb67[_0xdf3c('0x6')]||[];}module[_0xdf3c('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 13bec13..4ccb084 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 _0x2b52=['state','unknown','registry','indexOf','host','refresh','stateRegistry','registrationtime','address','exports','active','name'];(function(_0x3c0b45,_0x2c45b6){var _0x402cdc=function(_0x23ff08){while(--_0x23ff08){_0x3c0b45['push'](_0x3c0b45['shift']());}};_0x402cdc(++_0x2c45b6);}(_0x2b52,0x12a));var _0x22b5=function(_0x271060,_0x3f86b1){_0x271060=_0x271060-0x0;var _0x40540b=_0x2b52[_0x271060];return _0x40540b;};'use strict';function Trunk(_0x55a356){this['id']=_0x55a356['id']||0x0;this[_0x22b5('0x0')]=_0x55a356['active']||![];this[_0x22b5('0x1')]=_0x55a356[_0x22b5('0x1')]||'';this[_0x22b5('0x2')]=_0x22b5('0x3');this['stateTime']=0x0;this['status']=_0x22b5('0x3');this[_0x22b5('0x4')]=_0x55a356[_0x22b5('0x4')]&&_0x55a356[_0x22b5('0x4')][_0x22b5('0x5')](':')?_0x55a356[_0x22b5('0x4')]['split'](':')[0x0]:'';this[_0x22b5('0x6')]='';this['port']='';this['domain']='';this['domainport']='';this[_0x22b5('0x7')]='';this[_0x22b5('0x8')]=_0x22b5('0x3');this[_0x22b5('0x9')]='';this[_0x22b5('0xa')]='';}module[_0x22b5('0xb')]=Trunk; \ No newline at end of file +var _0x60bc=['registrationtime','address','exports','active','name','unknown','stateTime','status','registry','indexOf','split','host','domain','domainport','stateRegistry'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x60bc,0xc6));var _0xc60b=function(_0xa43518,_0x2a4c6b){_0xa43518=_0xa43518-0x0;var _0x5e9b94=_0x60bc[_0xa43518];return _0x5e9b94;};'use strict';function Trunk(_0x24ad3c){this['id']=_0x24ad3c['id']||0x0;this[_0xc60b('0x0')]=_0x24ad3c[_0xc60b('0x0')]||![];this[_0xc60b('0x1')]=_0x24ad3c[_0xc60b('0x1')]||'';this['state']=_0xc60b('0x2');this[_0xc60b('0x3')]=0x0;this[_0xc60b('0x4')]='unknown';this['registry']=_0x24ad3c['registry']&&_0x24ad3c[_0xc60b('0x5')][_0xc60b('0x6')](':')?_0x24ad3c['registry'][_0xc60b('0x7')](':')[0x0]:'';this[_0xc60b('0x8')]='';this['port']='';this[_0xc60b('0x9')]='';this[_0xc60b('0xa')]='';this['refresh']='';this[_0xc60b('0xb')]='unknown';this[_0xc60b('0xc')]='';this[_0xc60b('0xd')]='';}module[_0xc60b('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 7bc152e..c9b5272 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 _0x84f6=['exten','recordingFormat','mandatoryDisposition'];(function(_0xc96f64,_0x348eab){var _0x7ed92c=function(_0x4e5749){while(--_0x4e5749){_0xc96f64['push'](_0xc96f64['shift']());}};_0x7ed92c(++_0x348eab);}(_0x84f6,0x81));var _0x684f=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x84f6[_0x465a0c];return _0x1e202e;};'use strict';function voiceExtension(_0x2b21c7){this['id']=_0x2b21c7['id']||0x0;this[_0x684f('0x0')]=_0x2b21c7[_0x684f('0x0')]||'';this[_0x684f('0x1')]=_0x2b21c7[_0x684f('0x1')]||'none';this[_0x684f('0x2')]=_0x2b21c7[_0x684f('0x2')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0xd5c3=['none','mandatoryDisposition','exten','recordingFormat'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd5c3,0xe6));var _0x3d5c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd5c3[_0x2641f9];return _0x585741;};'use strict';function voiceExtension(_0x549cb2){this['id']=_0x549cb2['id']||0x0;this[_0x3d5c('0x0')]=_0x549cb2[_0x3d5c('0x0')]||'';this[_0x3d5c('0x1')]=_0x549cb2[_0x3d5c('0x1')]||_0x3d5c('0x2');this[_0x3d5c('0x3')]=_0x549cb2[_0x3d5c('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 4817061..cfb89ed 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 _0x7049=['outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','invalid','unavailable','ringinuse','onhold','wav','wav49','rrmemory','roundrobin','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','message','originated','temp','dialTimezone','dialGlobalInterval','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayCallersExit'];(function(_0x1e9b35,_0x319423){var _0x29f8ba=function(_0x284023){while(--_0x284023){_0x1e9b35['push'](_0x1e9b35['shift']());}};_0x29f8ba(++_0x319423);}(_0x7049,0x174));var _0x9704=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x7049[_0x45f951];return _0x24756c;};'use strict';var statusDesc=[_0x9704('0x0'),'not_inuse','inuse','busy',_0x9704('0x1'),_0x9704('0x2'),'ringing',_0x9704('0x3'),_0x9704('0x4')];var monitorFormat={'wav':_0x9704('0x5'),'wav49':_0x9704('0x6'),'gsm':'gsm'};var strategy={'rrmemory':_0x9704('0x7'),'roundrobin':_0x9704('0x8')};function VoiceQueue(_0x5af12d){this['id']=_0x5af12d['id']||0x0;this['name']=_0x5af12d['name']||'';this['monitor_format']=_0x5af12d[_0x9704('0x9')]||'';this['type']=_0x5af12d[_0x9704('0xa')]||_0x9704('0xb');this[_0x9704('0xc')]=0x0;this['talking']=0x0;this[_0x9704('0xd')]=0x0;this[_0x9704('0xe')]=0x0;this[_0x9704('0xf')]=0x0;this[_0x9704('0x10')]=0x0;this[_0x9704('0x11')]=0x0;this[_0x9704('0x12')]=0x0;this['abandoned']=0x0;this[_0x9704('0x13')]=0x0;this[_0x9704('0x14')]=0x0;this['acw']=_0x5af12d[_0x9704('0x15')]||![];this[_0x9704('0x16')]=_0x5af12d[_0x9704('0x16')]||0xa;this[_0x9704('0x17')]=_0x5af12d['autopause']||'no';this['sendMessageOneNotActive']=!![];this[_0x9704('0x18')]='';this[_0x9704('0x19')]=0x0;this[_0x9704('0x1a')]=0x0;this['dialTimezone']=_0x5af12d[_0x9704('0x1b')]||null;this['dialGlobalInterval']=_0x5af12d[_0x9704('0x1c')]?_0x5af12d[_0x9704('0x1c')]:null;this['dialActive']=_0x5af12d['dialActive'];this[_0x9704('0x1d')]=_0x5af12d[_0x9704('0x1d')]||_0x9704('0x1e');this[_0x9704('0x1f')]=_0x5af12d['dialLimitChannel']||0x0;this[_0x9704('0x20')]=_0x5af12d[_0x9704('0x20')]||0x0;this['dialPowerLevel']=_0x5af12d[_0x9704('0x21')]||0x1;this[_0x9704('0x22')]=_0x5af12d[_0x9704('0x22')]||'dropRate';this[_0x9704('0x23')]=_0x5af12d[_0x9704('0x23')]||0.03;this[_0x9704('0x24')]=_0x5af12d[_0x9704('0x24')]||0x258;this[_0x9704('0x25')]=_0x5af12d['dialOriginateCallerIdName']||_0x9704('0x26');this[_0x9704('0x27')]=_0x5af12d[_0x9704('0x27')]||'anonymous';this['dialOriginateTimeout']=_0x5af12d[_0x9704('0x28')]||0x1e;this[_0x9704('0x29')]=_0x5af12d['dialQueueOptions']||_0x9704('0x2a');this[_0x9704('0x2b')]=_0x5af12d[_0x9704('0x2b')]||0x3;this['dialQueueProject']=_0x5af12d[_0x9704('0x2c')]||undefined;this[_0x9704('0x2d')]=_0x5af12d[_0x9704('0x2d')]||0x3;this['dialCongestionRetryFrequency']=_0x5af12d[_0x9704('0x2e')]||0x96;this['dialBusyMaxRetry']=_0x5af12d[_0x9704('0x2f')]||0x3;this[_0x9704('0x30')]=_0x5af12d['dialBusyRetryFrequency']||0x96;this[_0x9704('0x31')]=_0x5af12d[_0x9704('0x31')]||0x3;this[_0x9704('0x32')]=_0x5af12d[_0x9704('0x32')]||0x96;this[_0x9704('0x33')]=_0x5af12d[_0x9704('0x33')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x5af12d[_0x9704('0x34')]||0x96;this[_0x9704('0x35')]=_0x5af12d[_0x9704('0x35')]||0x3;this['dialDropRetryFrequency']=_0x5af12d[_0x9704('0x36')]||0x96;this[_0x9704('0x37')]=_0x5af12d[_0x9704('0x37')]||0x3;this[_0x9704('0x38')]=_0x5af12d[_0x9704('0x38')]||0x96;this[_0x9704('0x39')]=_0x5af12d[_0x9704('0x39')]||0x3;this[_0x9704('0x3a')]=_0x5af12d['dialMachineRetryFrequency']||0x96;this[_0x9704('0x3b')]=_0x5af12d[_0x9704('0x3b')]||0x3;this[_0x9704('0x3c')]=_0x5af12d[_0x9704('0x3c')]||0x96;this[_0x9704('0x3d')]=_0x5af12d[_0x9704('0x3d')]||0x4;this[_0x9704('0x3e')]=_0x5af12d[_0x9704('0x3e')]?_0x5af12d[_0x9704('0x3e')]:undefined;this[_0x9704('0x3f')]=_0x5af12d[_0x9704('0x3f')]?_0x5af12d[_0x9704('0x3f')]:undefined;this[_0x9704('0x40')]=_0x5af12d[_0x9704('0x40')]||undefined;this['Interval']=_0x5af12d[_0x9704('0x41')]?_0x5af12d[_0x9704('0x41')]:undefined;this[_0x9704('0x42')]=_0x5af12d['dialOrderByScheduledAt']||_0x9704('0x43');this[_0x9704('0x44')]=_0x5af12d[_0x9704('0x44')]||undefined;this[_0x9704('0x45')]=_0x5af12d[_0x9704('0x45')]||undefined;this[_0x9704('0x46')]=strategy[_0x5af12d[_0x9704('0x46')]]||_0x9704('0x7');this[_0x9704('0x47')]=!![];this['dialAMDActive']=_0x5af12d['dialAMDActive']||![];this[_0x9704('0x48')]=_0x5af12d['dialAMDInitialSilence'];this[_0x9704('0x49')]=_0x5af12d[_0x9704('0x49')];this[_0x9704('0x4a')]=_0x5af12d[_0x9704('0x4a')];this[_0x9704('0x4b')]=_0x5af12d[_0x9704('0x4b')];this[_0x9704('0x4c')]=_0x5af12d[_0x9704('0x4c')];this[_0x9704('0x4d')]=_0x5af12d[_0x9704('0x4d')];this[_0x9704('0x4e')]=_0x5af12d[_0x9704('0x4e')];this['dialAMDSilenceThreshold']=_0x5af12d[_0x9704('0x4f')];this['dialAMDMaximumWordLength']=_0x5af12d[_0x9704('0x50')];this[_0x9704('0x51')]=0x0;this['pTalking']=0x0;this[_0x9704('0x52')]=_0x5af12d[_0x9704('0x52')];this[_0x9704('0x53')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x9704('0x54')]=0x0;this[_0x9704('0x55')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x9704('0x56')]=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x9704('0x57')]=0x0;this[_0x9704('0x58')]=0x0;this[_0x9704('0x59')]=0x0;this[_0x9704('0x5a')]=0x0;this[_0x9704('0x5b')]=0x0;this[_0x9704('0x5c')]=undefined;this[_0x9704('0x5d')]=undefined;this[_0x9704('0x5e')]=undefined;this[_0x9704('0x5f')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x9704('0x60')]=0x0;this[_0x9704('0x61')]=0x0;this[_0x9704('0x62')]=0x0;this[_0x9704('0x63')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this[_0x9704('0x64')]=0x0;this[_0x9704('0x65')]=_0x5af12d['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x9704('0x66')]=_0x5af12d[_0x9704('0x67')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x9704('0x68')]=0x0;this[_0x9704('0x69')]=0x1;this[_0x9704('0x6a')]=0x0;this[_0x9704('0x6b')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x9704('0x6c')]=0x0;this['dialRecallMeTimeout']=_0x5af12d['dialRecallMeTimeout']||0x1e;this[_0x9704('0x6d')]=_0x5af12d['dialRecallInQueue']||![];this[_0x9704('0x6e')]=_0x5af12d[_0x9704('0x6e')]||undefined;this[_0x9704('0x6f')]=_0x5af12d[_0x9704('0x6f')]||![];this[_0x9704('0x70')]=_0x5af12d[_0x9704('0x70')]||![];this[_0x9704('0x9')]=monitorFormat[_0x5af12d[_0x9704('0x9')]]?monitorFormat[_0x5af12d[_0x9704('0x9')]]:undefined;this[_0x9704('0x71')]=_0x5af12d[_0x9704('0x71')]||![];this[_0x9704('0x72')]=_0x5af12d[_0x9704('0x72')]?_0x5af12d[_0x9704('0x72')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0x14ee=['dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveInterval','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency'];(function(_0x53fdce,_0x4a6581){var _0x3e78ff=function(_0x534844){while(--_0x534844){_0x53fdce['push'](_0x53fdce['shift']());}};_0x3e78ff(++_0x4a6581);}(_0x14ee,0x12f));var _0xe14e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14ee[_0x3dd15e];return _0x231fd0;};'use strict';var statusDesc=[_0xe14e('0x0'),_0xe14e('0x1'),_0xe14e('0x2'),_0xe14e('0x3'),_0xe14e('0x4'),_0xe14e('0x5'),_0xe14e('0x6'),_0xe14e('0x7'),_0xe14e('0x8')];var monitorFormat={'wav':_0xe14e('0x9'),'wav49':'wav49','gsm':_0xe14e('0xa')};var strategy={'rrmemory':_0xe14e('0xb'),'roundrobin':_0xe14e('0xc')};function VoiceQueue(_0x4b2105){this['id']=_0x4b2105['id']||0x0;this[_0xe14e('0xd')]=_0x4b2105[_0xe14e('0xd')]||'';this[_0xe14e('0xe')]=_0x4b2105['monitor_format']||'';this[_0xe14e('0xf')]=_0x4b2105[_0xe14e('0xf')]||_0xe14e('0x10');this['waiting']=0x0;this['talking']=0x0;this[_0xe14e('0x11')]=0x0;this[_0xe14e('0x12')]=0x0;this[_0xe14e('0x13')]=0x0;this[_0xe14e('0x14')]=0x0;this['sumBillable']=0x0;this[_0xe14e('0x15')]=0x0;this[_0xe14e('0x16')]=0x0;this[_0xe14e('0x17')]=0x0;this[_0xe14e('0x18')]=0x0;this[_0xe14e('0x19')]=_0x4b2105[_0xe14e('0x19')]||![];this['acwTimeout']=_0x4b2105[_0xe14e('0x1a')]||0xa;this['autopause']=_0x4b2105[_0xe14e('0x1b')]||'no';this['sendMessageOneNotActive']=!![];this[_0xe14e('0x1c')]='';this[_0xe14e('0x1d')]=0x0;this[_0xe14e('0x1e')]=0x0;this[_0xe14e('0x1f')]=_0x4b2105[_0xe14e('0x1f')]||null;this[_0xe14e('0x20')]=_0x4b2105[_0xe14e('0x20')]?_0x4b2105['dialGlobalInterval']:null;this[_0xe14e('0x21')]=_0x4b2105[_0xe14e('0x21')];this[_0xe14e('0x22')]=_0x4b2105[_0xe14e('0x22')]||'progressive';this['dialLimitChannel']=_0x4b2105[_0xe14e('0x23')]||0x0;this[_0xe14e('0x24')]=_0x4b2105[_0xe14e('0x24')]||0x0;this[_0xe14e('0x25')]=_0x4b2105[_0xe14e('0x25')]||0x1;this[_0xe14e('0x26')]=_0x4b2105[_0xe14e('0x26')]||_0xe14e('0x27');this['dialPredictiveOptimizationPercentage']=_0x4b2105['dialPredictiveOptimizationPercentage']||0.03;this[_0xe14e('0x28')]=_0x4b2105['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x4b2105['dialOriginateCallerIdName']||_0xe14e('0x29');this[_0xe14e('0x2a')]=_0x4b2105['dialOriginateCallerIdNumber']||'anonymous';this[_0xe14e('0x2b')]=_0x4b2105[_0xe14e('0x2b')]||0x1e;this[_0xe14e('0x2c')]=_0x4b2105['dialQueueOptions']||_0xe14e('0x2d');this['dialQueueTimeout']=_0x4b2105[_0xe14e('0x2e')]||0x3;this[_0xe14e('0x2f')]=_0x4b2105[_0xe14e('0x2f')]||undefined;this[_0xe14e('0x30')]=_0x4b2105[_0xe14e('0x30')]||0x3;this[_0xe14e('0x31')]=_0x4b2105['dialCongestionRetryFrequency']||0x96;this[_0xe14e('0x32')]=_0x4b2105['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x4b2105[_0xe14e('0x33')]||0x96;this[_0xe14e('0x34')]=_0x4b2105[_0xe14e('0x34')]||0x3;this['dialNoAnswerRetryFrequency']=_0x4b2105[_0xe14e('0x35')]||0x96;this[_0xe14e('0x36')]=_0x4b2105[_0xe14e('0x36')]||0x3;this[_0xe14e('0x37')]=_0x4b2105['dialNoSuchNumberRetryFrequency']||0x96;this[_0xe14e('0x38')]=_0x4b2105['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x4b2105[_0xe14e('0x39')]||0x96;this['dialAbandonedMaxRetry']=_0x4b2105['dialAbandonedMaxRetry']||0x3;this[_0xe14e('0x3a')]=_0x4b2105[_0xe14e('0x3a')]||0x96;this[_0xe14e('0x3b')]=_0x4b2105[_0xe14e('0x3b')]||0x3;this[_0xe14e('0x3c')]=_0x4b2105['dialMachineRetryFrequency']||0x96;this[_0xe14e('0x3d')]=_0x4b2105[_0xe14e('0x3d')]||0x3;this[_0xe14e('0x3e')]=_0x4b2105[_0xe14e('0x3e')]||0x96;this[_0xe14e('0x3f')]=_0x4b2105[_0xe14e('0x3f')]||0x4;this[_0xe14e('0x40')]=_0x4b2105['Trunk']?_0x4b2105[_0xe14e('0x40')]:undefined;this[_0xe14e('0x41')]=_0x4b2105['TrunkBackup']?_0x4b2105[_0xe14e('0x41')]:undefined;this[_0xe14e('0x42')]=_0x4b2105[_0xe14e('0x42')]||undefined;this[_0xe14e('0x43')]=_0x4b2105[_0xe14e('0x43')]?_0x4b2105[_0xe14e('0x43')]:undefined;this[_0xe14e('0x44')]=_0x4b2105['dialOrderByScheduledAt']||_0xe14e('0x45');this['dialRandomLastDigitCallerIdNumber']=_0x4b2105[_0xe14e('0x46')]||undefined;this[_0xe14e('0x47')]=_0x4b2105[_0xe14e('0x47')]||undefined;this[_0xe14e('0x48')]=strategy[_0x4b2105['strategy']]||_0xe14e('0xb');this[_0xe14e('0x49')]=!![];this['dialAMDActive']=_0x4b2105[_0xe14e('0x4a')]||![];this[_0xe14e('0x4b')]=_0x4b2105[_0xe14e('0x4b')];this[_0xe14e('0x4c')]=_0x4b2105[_0xe14e('0x4c')];this['dialAMDAfterGreetingSilence']=_0x4b2105[_0xe14e('0x4d')];this[_0xe14e('0x4e')]=_0x4b2105[_0xe14e('0x4e')];this[_0xe14e('0x4f')]=_0x4b2105['dialAMDMinWordLength'];this[_0xe14e('0x50')]=_0x4b2105[_0xe14e('0x50')];this[_0xe14e('0x51')]=_0x4b2105[_0xe14e('0x51')];this['dialAMDSilenceThreshold']=_0x4b2105[_0xe14e('0x52')];this[_0xe14e('0x53')]=_0x4b2105[_0xe14e('0x53')];this['outboundRejectCallsDay']=0x0;this[_0xe14e('0x54')]=0x0;this[_0xe14e('0x55')]=_0x4b2105[_0xe14e('0x55')];this[_0xe14e('0x56')]=0x0;this[_0xe14e('0x57')]=0x0;this[_0xe14e('0x58')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xe14e('0x59')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xe14e('0x5a')]=0x0;this[_0xe14e('0x5b')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xe14e('0x5c')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xe14e('0x5d')]=0x0;this[_0xe14e('0x5e')]=0x0;this[_0xe14e('0x5f')]=undefined;this[_0xe14e('0x60')]=undefined;this[_0xe14e('0x61')]=undefined;this[_0xe14e('0x62')]=1.05;this[_0xe14e('0x63')]=0x0;this[_0xe14e('0x64')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xe14e('0x65')]=0x0;this[_0xe14e('0x66')]=0x0;this[_0xe14e('0x67')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xe14e('0x68')]=_0x4b2105[_0xe14e('0x69')]||0x14;this[_0xe14e('0x6a')]=_0x4b2105['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xe14e('0x6b')]=0x0;this[_0xe14e('0x6c')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xe14e('0x6d')]=0x0;this[_0xe14e('0x6e')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xe14e('0x6f')]=0x0;this['dialRecallMeTimeout']=_0x4b2105['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x4b2105[_0xe14e('0x70')]||![];this[_0xe14e('0x71')]=_0x4b2105['dialQueueProject2']||undefined;this[_0xe14e('0x72')]=_0x4b2105[_0xe14e('0x72')]||![];this['dialAgiAfterHangupAgent']=_0x4b2105[_0xe14e('0x73')]||![];this[_0xe14e('0xe')]=monitorFormat[_0x4b2105[_0xe14e('0xe')]]?monitorFormat[_0x4b2105[_0xe14e('0xe')]]:undefined;this['mandatoryDisposition']=_0x4b2105[_0xe14e('0x74')]||![];this[_0xe14e('0x75')]=_0x4b2105[_0xe14e('0x75')]?_0x4b2105[_0xe14e('0x75')]:undefined;}module[_0xe14e('0x76')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 01987e8..0e1b75b 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 _0x68da=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x2a0976,_0x3e070a){var _0x172bc1=function(_0x1dd90f){while(--_0x1dd90f){_0x2a0976['push'](_0x2a0976['shift']());}};_0x172bc1(++_0x3e070a);}(_0x68da,0x8b));var _0xa68d=function(_0x5bc75a,_0x38ce5c){_0x5bc75a=_0x5bc75a-0x0;var _0x51abb3=_0x68da[_0x5bc75a];return _0x51abb3;};'use strict';function VtigerAccount(_0x4c4255){this['id']=_0x4c4255['id']||0x0;this[_0xa68d('0x0')]=_0x4c4255[_0xa68d('0x0')]||'';this[_0xa68d('0x1')]=_0x4c4255[_0xa68d('0x1')]||'';this[_0xa68d('0x2')]=_0x4c4255[_0xa68d('0x2')]||'';this[_0xa68d('0x3')]=_0x4c4255['remoteUri']||'';this[_0xa68d('0x4')]=_0x4c4255[_0xa68d('0x4')]||'';this[_0xa68d('0x5')]=_0x4c4255[_0xa68d('0x5')]||{};}module[_0xa68d('0x6')]=VtigerAccount; \ No newline at end of file +var _0x92bd=['serverUrl','Configurations','name','username','accessKey','remoteUri'];(function(_0x44029c,_0x426690){var _0x547fa1=function(_0x37b1f9){while(--_0x37b1f9){_0x44029c['push'](_0x44029c['shift']());}};_0x547fa1(++_0x426690);}(_0x92bd,0x68));var _0xd92b=function(_0x2fe651,_0x2936ae){_0x2fe651=_0x2fe651-0x0;var _0x30cfd6=_0x92bd[_0x2fe651];return _0x30cfd6;};'use strict';function VtigerAccount(_0x576e19){this['id']=_0x576e19['id']||0x0;this[_0xd92b('0x0')]=_0x576e19[_0xd92b('0x0')]||'';this[_0xd92b('0x1')]=_0x576e19[_0xd92b('0x1')]||'';this[_0xd92b('0x2')]=_0x576e19[_0xd92b('0x2')]||'';this[_0xd92b('0x3')]=_0x576e19[_0xd92b('0x3')]||'';this[_0xd92b('0x4')]=_0x576e19['serverUrl']||'';this[_0xd92b('0x5')]=_0x576e19[_0xd92b('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index ab37f3c..5ee2568 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 _0x2ef3=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x2b351d,_0x448855){var _0x219996=function(_0x258771){while(--_0x258771){_0x2b351d['push'](_0x2b351d['shift']());}};_0x219996(++_0x448855);}(_0x2ef3,0xba));var _0x32ef=function(_0x55066f,_0x320f9e){_0x55066f=_0x55066f-0x0;var _0x403b98=_0x2ef3[_0x55066f];return _0x403b98;};'use strict';function ZendeskAccount(_0x4d5ac8){this['id']=_0x4d5ac8['id']||0x0;this[_0x32ef('0x0')]=_0x4d5ac8[_0x32ef('0x0')]||'';this[_0x32ef('0x1')]=_0x4d5ac8[_0x32ef('0x1')]||'';this[_0x32ef('0x2')]=_0x4d5ac8['password']||'';this[_0x32ef('0x3')]=_0x4d5ac8[_0x32ef('0x3')]||'';this['remoteUri']=_0x4d5ac8[_0x32ef('0x4')]||'';this[_0x32ef('0x5')]=_0x4d5ac8['authType']||'';this['type']=_0x4d5ac8[_0x32ef('0x6')]||_0x32ef('0x7');this[_0x32ef('0x8')]=_0x4d5ac8[_0x32ef('0x8')]||'';this[_0x32ef('0x9')]=_0x4d5ac8[_0x32ef('0x9')]||{};}module[_0x32ef('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x7a54=['serverUrl','Configurations','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x19f5fc,_0x4c658a){var _0x315fa3=function(_0x2198b5){while(--_0x2198b5){_0x19f5fc['push'](_0x19f5fc['shift']());}};_0x315fa3(++_0x4c658a);}(_0x7a54,0x106));var _0x47a5=function(_0x5226ce,_0xe1e75d){_0x5226ce=_0x5226ce-0x0;var _0x283f17=_0x7a54[_0x5226ce];return _0x283f17;};'use strict';function ZendeskAccount(_0xe384a5){this['id']=_0xe384a5['id']||0x0;this[_0x47a5('0x0')]=_0xe384a5[_0x47a5('0x0')]||'';this['username']=_0xe384a5[_0x47a5('0x1')]||'';this[_0x47a5('0x2')]=_0xe384a5['password']||'';this[_0x47a5('0x3')]=_0xe384a5[_0x47a5('0x3')]||'';this[_0x47a5('0x4')]=_0xe384a5[_0x47a5('0x4')]||'';this[_0x47a5('0x5')]=_0xe384a5['authType']||'';this[_0x47a5('0x6')]=_0xe384a5['type']||_0x47a5('0x7');this[_0x47a5('0x8')]=_0xe384a5['serverUrl']||'';this[_0x47a5('0x9')]=_0xe384a5['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index ee41fba..2d42f2e 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 _0xd05a=['code','refreshToken','Configurations','name','zone','clientId','clientSecret','serverUrl'];(function(_0x3e2540,_0x327f8b){var _0x5b86ef=function(_0x54f797){while(--_0x54f797){_0x3e2540['push'](_0x3e2540['shift']());}};_0x5b86ef(++_0x327f8b);}(_0xd05a,0x143));var _0xad05=function(_0x332603,_0x34d8e6){_0x332603=_0x332603-0x0;var _0x74ee2=_0xd05a[_0x332603];return _0x74ee2;};'use strict';function ZohoAccount(_0x441c8e){this['id']=_0x441c8e['id']||0x0;this[_0xad05('0x0')]=_0x441c8e[_0xad05('0x0')]||'';this['description']=_0x441c8e['description']||'';this['host']=_0x441c8e['host']||'';this[_0xad05('0x1')]=_0x441c8e[_0xad05('0x1')]||'';this[_0xad05('0x2')]=_0x441c8e[_0xad05('0x2')]||'';this[_0xad05('0x3')]=_0x441c8e['clientSecret']||'';this['serverUrl']=_0x441c8e[_0xad05('0x4')]||'';this[_0xad05('0x5')]=_0x441c8e[_0xad05('0x5')]||'';this['refreshToken']=_0x441c8e[_0xad05('0x6')]||'';this[_0xad05('0x7')]=_0x441c8e[_0xad05('0x7')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x8c50=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8c50,0xcd));var _0x08c5=function(_0x368285,_0x508df0){_0x368285=_0x368285-0x0;var _0x2bce19=_0x8c50[_0x368285];return _0x2bce19;};'use strict';function ZohoAccount(_0x2436a9){this['id']=_0x2436a9['id']||0x0;this[_0x08c5('0x0')]=_0x2436a9[_0x08c5('0x0')]||'';this['description']=_0x2436a9[_0x08c5('0x1')]||'';this[_0x08c5('0x2')]=_0x2436a9[_0x08c5('0x2')]||'';this[_0x08c5('0x3')]=_0x2436a9[_0x08c5('0x3')]||'';this['clientId']=_0x2436a9[_0x08c5('0x4')]||'';this['clientSecret']=_0x2436a9['clientSecret']||'';this[_0x08c5('0x5')]=_0x2436a9[_0x08c5('0x5')]||'';this['code']=_0x2436a9[_0x08c5('0x6')]||'';this['refreshToken']=_0x2436a9[_0x08c5('0x7')]||'';this['Configurations']=_0x2436a9[_0x08c5('0x8')]||{};}module[_0x08c5('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 b924fe3..dc50fed 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 _0xcb55=['uniqueid','campaigntype','queue','dialAnswer','membername','Agent','name','channelAgent','SIP/%s','calleridname','phone','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','lodash','moment','isNil','string'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xcb55,0x7a));var _0x5cb5=function(_0x5b8f60,_0x288ac5){_0x5b8f60=_0x5b8f60-0x0;var _0x2ab68e=_0xcb55[_0x5b8f60];return _0x2ab68e;};'use strict';var util=require('util');var _=require(_0x5cb5('0x0'));var moment=require(_0x5cb5('0x1'));function checkNameSurname(_0x4e81f5,_0xdf05d2,_0x4c8f38){var _0x504e63='';if(!_[_0x5cb5('0x2')](_0xdf05d2)&&_0x5cb5('0x3')===typeof _0xdf05d2){_0x504e63+=_0xdf05d2;}if(!_['isNil'](_0x4c8f38)&&_0x5cb5('0x3')===typeof _0x4c8f38){_0x504e63+='\x20'+_0x4c8f38;}if(_0x504e63!==''){return _0x504e63;}return _0x4e81f5;}function Action(_0x53e8ed,_0x2a91a2,_0x8806fe,_0x773103,_0x4d971f){this[_0x5cb5('0x4')]=_0x8806fe||undefined;this['idContact']=_0x53e8ed['id'];this['queue']=_0x2a91a2['name'];this['type']=_0x2a91a2['type'];this[_0x5cb5('0x5')]=_0x5cb5('0x6');this[_0x5cb5('0x7')]=![];this[_0x5cb5('0x8')]=_[_0x5cb5('0x2')](_0x53e8ed[_0x5cb5('0x9')])?undefined:_0x53e8ed[_0x5cb5('0x9')][_0x5cb5('0xa')];this[_0x5cb5('0xb')]=this[_0x5cb5('0x8')]?util['format'](_0x5cb5('0xc'),this['membername']):_0x773103||undefined;this[_0x5cb5('0xd')]=checkNameSurname(_0x53e8ed['Contact'][_0x5cb5('0xe')],_0x53e8ed[_0x5cb5('0xf')][_0x5cb5('0x10')],_0x53e8ed[_0x5cb5('0xf')][_0x5cb5('0x11')]);this['active']=_0x53e8ed[_0x5cb5('0x12')]||![];this[_0x5cb5('0x13')]=_0x53e8ed[_0x5cb5('0xf')]['phone'];this[_0x5cb5('0x14')]=_0x53e8ed[_0x5cb5('0x14')];this[_0x5cb5('0x15')]=_0x53e8ed[_0x5cb5('0x15')]||0x0;this[_0x5cb5('0x16')]=_0x53e8ed[_0x5cb5('0x16')]||0x0;this['countnoanswerretry']=_0x53e8ed[_0x5cb5('0x17')]||0x0;this[_0x5cb5('0x18')]=(_0x53e8ed['countbusyretry']||0x0)+(_0x53e8ed[_0x5cb5('0x16')]||0x0)+(_0x53e8ed['countnoanswerretry']||0x0)+(_0x53e8ed['countnosuchnumberretry']||0x0)+(_0x53e8ed[_0x5cb5('0x19')]||0x0)+(_0x53e8ed[_0x5cb5('0x1a')]||0x0)+(_0x53e8ed[_0x5cb5('0x1b')]||0x0)+(_0x53e8ed[_0x5cb5('0x1c')]||0x0);this['countnosuchnumberretry']=_0x53e8ed[_0x5cb5('0x1d')]||0x0;this[_0x5cb5('0x19')]=_0x53e8ed[_0x5cb5('0x19')]||0x0;this[_0x5cb5('0x1a')]=_0x53e8ed[_0x5cb5('0x1a')]||0x0;this[_0x5cb5('0x1b')]=_0x53e8ed[_0x5cb5('0x1b')]||0x0;this[_0x5cb5('0x1c')]=_0x53e8ed[_0x5cb5('0x1c')]||0x0;this['callback']=_0x53e8ed[_0x5cb5('0x1e')];this[_0x5cb5('0x1f')]=_0x53e8ed['callbackuniqueid'];this['callbackat']=_0x53e8ed[_0x5cb5('0x20')];this['recallme']=_0x53e8ed['recallme'];this[_0x5cb5('0x21')]=_0x53e8ed[_0x5cb5('0x21')];this[_0x5cb5('0x22')]=_0x53e8ed[_0x5cb5('0x22')];this['UserId']=_['isNil'](_0x53e8ed[_0x5cb5('0x9')])?_0x53e8ed[_0x5cb5('0x23')]:_0x53e8ed[_0x5cb5('0x9')]['id'];this['VoiceQueueId']=_0x53e8ed[_0x5cb5('0x24')];this[_0x5cb5('0x25')]='';this[_0x5cb5('0x26')]='';}Action[_0x5cb5('0x27')][_0x5cb5('0x28')]=function(){return util['format'](_0x5cb5('0x29'),this[_0x5cb5('0xd')],this['number']);};module['exports']=Action; \ No newline at end of file +var _0x6ad1=['queue','type','campaigntype','channelAgent','membername','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','Agent','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','isNil','string','uniqueid','idContact'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0x6ad1,0x1f3));var _0x16ad=function(_0x39628b,_0x2784f7){_0x39628b=_0x39628b-0x0;var _0x8a62d6=_0x6ad1[_0x39628b];return _0x8a62d6;};'use strict';var util=require(_0x16ad('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x5ad8ba,_0x44343a,_0x9157dc){var _0x2534a4='';if(!_[_0x16ad('0x1')](_0x44343a)&&_0x16ad('0x2')===typeof _0x44343a){_0x2534a4+=_0x44343a;}if(!_[_0x16ad('0x1')](_0x9157dc)&&_0x16ad('0x2')===typeof _0x9157dc){_0x2534a4+='\x20'+_0x9157dc;}if(_0x2534a4!==''){return _0x2534a4;}return _0x5ad8ba;}function Action(_0x3d62c8,_0x54e3f7,_0x362272,_0x229710,_0x108136){this[_0x16ad('0x3')]=_0x362272||undefined;this[_0x16ad('0x4')]=_0x3d62c8['id'];this[_0x16ad('0x5')]=_0x54e3f7['name'];this[_0x16ad('0x6')]=_0x54e3f7['type'];this[_0x16ad('0x7')]=_0x16ad('0x5');this['dialAnswer']=![];this['membername']=_['isNil'](_0x3d62c8['Agent'])?undefined:_0x3d62c8['Agent']['name'];this[_0x16ad('0x8')]=this[_0x16ad('0x9')]?util[_0x16ad('0xa')](_0x16ad('0xb'),this[_0x16ad('0x9')]):_0x229710||undefined;this[_0x16ad('0xc')]=checkNameSurname(_0x3d62c8[_0x16ad('0xd')][_0x16ad('0xe')],_0x3d62c8[_0x16ad('0xd')][_0x16ad('0xf')],_0x3d62c8[_0x16ad('0xd')][_0x16ad('0x10')]);this[_0x16ad('0x11')]=_0x3d62c8['active']||![];this[_0x16ad('0x12')]=_0x3d62c8['Contact'][_0x16ad('0xe')];this[_0x16ad('0x13')]=_0x3d62c8['scheduledat'];this[_0x16ad('0x14')]=_0x3d62c8[_0x16ad('0x14')]||0x0;this[_0x16ad('0x15')]=_0x3d62c8[_0x16ad('0x15')]||0x0;this[_0x16ad('0x16')]=_0x3d62c8[_0x16ad('0x16')]||0x0;this['countglobal']=(_0x3d62c8[_0x16ad('0x14')]||0x0)+(_0x3d62c8[_0x16ad('0x15')]||0x0)+(_0x3d62c8['countnoanswerretry']||0x0)+(_0x3d62c8[_0x16ad('0x17')]||0x0)+(_0x3d62c8[_0x16ad('0x18')]||0x0)+(_0x3d62c8[_0x16ad('0x19')]||0x0)+(_0x3d62c8[_0x16ad('0x1a')]||0x0)+(_0x3d62c8[_0x16ad('0x1b')]||0x0);this[_0x16ad('0x17')]=_0x3d62c8[_0x16ad('0x17')]||0x0;this['countdropretry']=_0x3d62c8[_0x16ad('0x18')]||0x0;this[_0x16ad('0x19')]=_0x3d62c8[_0x16ad('0x19')]||0x0;this[_0x16ad('0x1a')]=_0x3d62c8[_0x16ad('0x1a')]||0x0;this['countagentrejectretry']=_0x3d62c8[_0x16ad('0x1b')]||0x0;this['callback']=_0x3d62c8[_0x16ad('0x1c')];this[_0x16ad('0x1d')]=_0x3d62c8['callbackuniqueid'];this[_0x16ad('0x1e')]=_0x3d62c8[_0x16ad('0x1e')];this['recallme']=_0x3d62c8[_0x16ad('0x1f')];this[_0x16ad('0x20')]=_0x3d62c8[_0x16ad('0x20')];this[_0x16ad('0x21')]=_0x3d62c8[_0x16ad('0x21')];this[_0x16ad('0x22')]=_['isNil'](_0x3d62c8[_0x16ad('0x23')])?_0x3d62c8[_0x16ad('0x22')]:_0x3d62c8[_0x16ad('0x23')]['id'];this['VoiceQueueId']=_0x3d62c8['VoiceQueueId'];this[_0x16ad('0x24')]='';this[_0x16ad('0x25')]='';}Action[_0x16ad('0x26')][_0x16ad('0x27')]=function(){return util[_0x16ad('0xa')](_0x16ad('0x28'),this[_0x16ad('0xc')],this['number']);};module[_0x16ad('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 5c2dc9e..29dd9a3 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 _0x4329=['socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','type','available','loggedIn','pTalking','sumBillable','sumDuration','talking','unmanaged','abandoned','waiting','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','name','active','callerid','Interval','md5','voice_queue:save','stringify','format','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','\x20is\x20not\x20active','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','loopCampaigns','syncCampaigns','hasOwnProperty','booked','outbound','setMessage','recallMe','clearZombieChannel','isNil','info','[clearZombieChannels][talking]','queue','dialAnswer','pick','UserId','VoiceQueueId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','Agent','run','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','answertime','\x20Queue','custom:agentconnect','connect','acw','buildAcw','custom:agentcomplete','total','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','uniqueid','BUSY','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','scheduledAt','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','countagentrejectretry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[default]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','AnswerAGI','[callProgressDetectingAgent][logCongestion]','[originated][decrement][callProgressDetectingAgent]','originated:\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','execCall','then','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','execRun','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','Action','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','clone','isFailure','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','pTalking:\x20','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','variable','keys','value','error','inspect','transfertargetlinkedid','transfererlinkedid','util','uuid','moment','../../../config/environment','preview','../ami','./rpcDb','./action','redis','defaults','localhost'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x4329,0x140));var _0x9432=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x4329[_0x110c3d];return _0x226d67;};'use strict';var util=require(_0x9432('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x9432('0x1'));var moment=require(_0x9432('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x9432('0x3'));var logger=require('../../../config/logger')(_0x9432('0x4'));var loggerAction=require('../../../config/logger')('actionPreview');var ami=require(_0x9432('0x5'));var rpcDb=require(_0x9432('0x6'));var Action=require(_0x9432('0x7'));var ut=require('./util/util');config[_0x9432('0x8')]=_[_0x9432('0x9')](config[_0x9432('0x8')],{'host':_0x9432('0xa'),'port':0x18eb});var io=require(_0x9432('0xb'))(new Redis(config[_0x9432('0x8')]));var Sequence=function(){};Sequence[_0x9432('0xc')][_0x9432('0xd')]=function(_0x1c6d51){this[_0x9432('0xe')]=this[_0x9432('0xe')]?this[_0x9432('0xe')][_0x9432('0xf')](_0x1c6d51):_0x1c6d51();};function Preview(_0x1642ce){this[_0x9432('0x10')]=new Sequence();this[_0x9432('0x11')]=_0x1642ce[_0x9432('0x12')];this[_0x9432('0x13')]=_0x1642ce[_0x9432('0x13')];this[_0x9432('0x14')]={};this[_0x9432('0x15')]=_0x1642ce[_0x9432('0x15')];this[_0x9432('0x16')]=0x0;ami['on'](_0x9432('0x17'),this[_0x9432('0x18')][_0x9432('0x19')](this));ami['on'](_0x9432('0x1a'),this[_0x9432('0x1b')][_0x9432('0x19')](this));ami['on'](_0x9432('0x1c'),this[_0x9432('0x1d')][_0x9432('0x19')](this));ami['on'](_0x9432('0x1e'),this[_0x9432('0x1f')][_0x9432('0x19')](this));ami['on'](_0x9432('0x20'),this[_0x9432('0x21')][_0x9432('0x19')](this));ami['on']('varset',this[_0x9432('0x22')][_0x9432('0x19')](this));ami['on']('attendedtransfer',this[_0x9432('0x23')]['bind'](this));ami['on'](_0x9432('0x24'),this[_0x9432('0x25')][_0x9432('0x19')](this));this['loopCampaigns'](this[_0x9432('0x11')]);}function emit(_0x2ceedd,_0x23ff2c,_0x3e2fe7){io['to'](_0x2ceedd)[_0x9432('0x26')](_0x23ff2c,_0x3e2fe7);}function emitCampaignPreview(_0x57149f){if(_0x57149f[_0x9432('0x27')]==='outbound'){var _0x3fbe38={'id':_0x57149f['id'],'name':_0x57149f['name'],'strategy':_0x57149f['strategy'],'answered':_0x57149f['answered'],'available':_0x57149f[_0x9432('0x28')],'loggedIn':_0x57149f[_0x9432('0x29')],'pTalking':_0x57149f[_0x9432('0x2a')],'sumBillable':_0x57149f[_0x9432('0x2b')],'sumDuration':_0x57149f[_0x9432('0x2c')],'sumHoldTime':_0x57149f['sumHoldTime']||0x0,'talking':_0x57149f[_0x9432('0x2d')],'total':_0x57149f['total'],'type':_0x57149f[_0x9432('0x27')],'unmanaged':_0x57149f[_0x9432('0x2e')],'abandoned':_0x57149f[_0x9432('0x2f')],'waiting':_0x57149f[_0x9432('0x30')],'loggedInDb':_0x57149f['loggedInDb'],'dialActive':_0x57149f['dialActive'],'dialMethod':_0x57149f[_0x9432('0x31')],'dialOriginateCallerIdName':_0x57149f['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x57149f[_0x9432('0x32')],'dialOriginateTimeout':_0x57149f[_0x9432('0x33')],'dialPrefix':_0x57149f[_0x9432('0x34')],'outboundAnswerAgiCallsDay':_0x57149f['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x57149f[_0x9432('0x35')],'outboundBlacklistCallsDay':_0x57149f[_0x9432('0x36')],'outboundBusyCallsDay':_0x57149f['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x57149f[_0x9432('0x37')],'outboundDropCallsDayACS':_0x57149f[_0x9432('0x38')],'outboundDropCallsDayCallersExit':_0x57149f[_0x9432('0x39')],'outboundDropCallsDayTimeout':_0x57149f[_0x9432('0x3a')],'outboundNoAnswerCallsDay':_0x57149f[_0x9432('0x3b')],'outboundNoSuchCallsDay':_0x57149f[_0x9432('0x3c')],'outboundOriginateFailureCallsDay':_0x57149f[_0x9432('0x3d')],'outboundReCallsDay':_0x57149f[_0x9432('0x3e')],'outboundRejectCallsDay':_0x57149f[_0x9432('0x3f')],'outboundUnknownCallsDay':_0x57149f[_0x9432('0x40')],'outboundAbandonedCallsDay':_0x57149f[_0x9432('0x41')],'predictiveIntervalAnsweredCalls':_0x57149f[_0x9432('0x42')],'predictiveIntervalAvgHoldtime':_0x57149f['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x57149f[_0x9432('0x43')],'predictiveIntervalDroppedCallsCallersExit':_0x57149f[_0x9432('0x44')],'predictiveIntervalDroppedCallsTimeout':_0x57149f[_0x9432('0x45')],'predictiveIntervalErlangCalls':_0x57149f['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x57149f['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x57149f[_0x9432('0x46')],'predictiveIntervalMultiplicativeFactor':_0x57149f[_0x9432('0x47')],'predictiveIntervalPauses':_0x57149f[_0x9432('0x48')],'predictiveIntervalAvailable':_0x57149f[_0x9432('0x49')],'predictiveIntervalTotalCalls':_0x57149f['predictiveIntervalTotalCalls'],'message':_0x57149f[_0x9432('0x4a')],'originated':_0x57149f[_0x9432('0x4b')],'erlangCalls':_0x57149f[_0x9432('0x4c')],'erlangCallToSecond':_0x57149f[_0x9432('0x4d')],'erlangAbandonmentRate':_0x57149f[_0x9432('0x4e')],'erlangBusyFactor':_0x57149f[_0x9432('0x4f')],'startPredictive':_0x57149f[_0x9432('0x50')],'startProgressive':_0x57149f['startProgressive']};if(_0x57149f[_0x9432('0x51')]){_0x3fbe38['Trunk']={'id':_0x57149f[_0x9432('0x51')]['id'],'name':_0x57149f[_0x9432('0x51')][_0x9432('0x52')],'active':_0x57149f[_0x9432('0x51')][_0x9432('0x53')],'callerid':_0x57149f[_0x9432('0x51')][_0x9432('0x54')]};}if(_0x57149f[_0x9432('0x55')]){_0x3fbe38[_0x9432('0x55')]={'id':_0x57149f[_0x9432('0x55')]['id'],'name':_0x57149f[_0x9432('0x55')][_0x9432('0x52')]};}var _0x34b769=md5(JSON['stringify'](_0x3fbe38));if(_0x57149f[_0x9432('0x56')]!==_0x34b769){_0x57149f[_0x9432('0x56')]=_0x34b769;emit(util['format']('voice:queue:%s',_0x3fbe38[_0x9432('0x52')]),_0x9432('0x57'),_0x3fbe38);}}}function emitVoiceQueueChannelRemove(_0x11b782){logger['info']('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x9432('0x58')](_0x11b782));emit(util[_0x9432('0x59')](_0x9432('0x5a'),_0x11b782[_0x9432('0x52')]),_0x9432('0x5b'),_0x11b782);}function notSendMessagesQueue(_0x24844f){if(_0x24844f[_0x9432('0x5c')]){if(_0x24844f[_0x9432('0x4b')]===0x0&&_0x24844f[_0x9432('0x2a')]===0x0){_0x24844f['sendMessageOneNotActive']=![];_0x24844f[_0x9432('0x28')]=0x0;_0x24844f[_0x9432('0x5d')]=0x0;_0x24844f['message']=_0x9432('0x5e');ut[_0x9432('0x5f')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x24844f[_0x9432('0x52')]+_0x9432('0x60'));}else{_0x24844f[_0x9432('0x4a')]=_0x9432('0x61');ut[_0x9432('0x5f')](_0x9432('0x62'),_0x24844f[_0x9432('0x52')]+'\x20is\x20disactive');}emitCampaignPreview(_0x24844f);}}Preview['prototype'][_0x9432('0x63')]=function(){var _0x486028=this;setInterval(function(){_0x486028[_0x9432('0x64')]();},0x7cf);};Preview[_0x9432('0xc')][_0x9432('0x64')]=function(){var _0x5513ec=this[_0x9432('0x11')];this[_0x9432('0x16')]+=0x1;for(var _0x2b4d08 in _0x5513ec){if(_0x5513ec[_0x9432('0x65')](_0x2b4d08)&&(_0x5513ec[_0x2b4d08][_0x9432('0x31')]==='preview'||_0x5513ec[_0x2b4d08][_0x9432('0x31')]===_0x9432('0x66'))&&_0x5513ec[_0x2b4d08]['type']===_0x9432('0x67')){if(this[_0x9432('0x16')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x5513ec[_0x9432('0x65')](_0x2b4d08)&&_0x5513ec[_0x2b4d08][_0x9432('0x31')]===_0x9432('0x4')&&_0x5513ec[_0x2b4d08][_0x9432('0x27')]===_0x9432('0x67')){if(_0x5513ec[_0x2b4d08]['dialActive']){this[_0x9432('0x68')](_0x5513ec[_0x2b4d08]);this[_0x9432('0x69')](_0x5513ec[_0x2b4d08]);}else{notSendMessagesQueue(_0x5513ec[_0x2b4d08]);}}}};Preview['prototype'][_0x9432('0x6a')]=function(_0x8cb5da){var _0x1ec72c=this;this[_0x9432('0x10')][_0x9432('0xd')](function(){if(!_[_0x9432('0x6b')](_0x1ec72c[_0x9432('0x14')][_0x8cb5da])){loggerAction[_0x9432('0x6c')](_0x9432('0x6d'),_0x8cb5da,'Queue',_0x1ec72c['actions'][_0x8cb5da][_0x9432('0x6e')],'originated:\x20',JSON[_0x9432('0x58')](_0x1ec72c['campaignsPreview'][_0x1ec72c[_0x9432('0x14')][_0x8cb5da]['queue']]['originated']),'pTalking:\x20',JSON[_0x9432('0x58')](_0x1ec72c[_0x9432('0x11')][_0x1ec72c[_0x9432('0x14')][_0x8cb5da]['queue']][_0x9432('0x2a')]),JSON[_0x9432('0x58')](_0x1ec72c['actions'][_0x8cb5da][_0x9432('0x6f')]),JSON[_0x9432('0x58')](_[_0x9432('0x70')](_0x1ec72c['actions'][_0x8cb5da],['contactId',_0x9432('0x71'),_0x9432('0x72'),'ListId'])));return ami['Action']({'action':_0x9432('0x73'),'channel':_0x1ec72c[_0x9432('0x14')][_0x8cb5da][_0x9432('0x74')]})[_0x9432('0x75')](function(_0x4420b7){if(_0x4420b7[_0x9432('0x4a')]===_0x9432('0x76')){setTimeout(function(){if(_0x1ec72c[_0x9432('0x14')][_0x8cb5da]){ut[_0x9432('0x77')](_0x1ec72c[_0x9432('0x11')][_0x1ec72c[_0x9432('0x14')][_0x8cb5da][_0x9432('0x6e')]],_0x9432('0x78'));if(_0x1ec72c[_0x9432('0x14')][_0x8cb5da][_0x9432('0x6f')]===!![]){ut[_0x9432('0x79')](_0x1ec72c[_0x9432('0x11')][_0x1ec72c[_0x9432('0x14')][_0x8cb5da][_0x9432('0x6e')]],_0x9432('0x78'));ut[_0x9432('0x7a')](_0x9432('0x7b')+_0x8cb5da,_0x1ec72c[_0x9432('0x14')][_0x8cb5da][_0x9432('0x6e')]);}ut[_0x9432('0x7a')]('[Dialer][checkChannel][Preview]'+_0x8cb5da,_0x1ec72c['actions'][_0x8cb5da]['queue']);delete _0x1ec72c[_0x9432('0x14')][_0x8cb5da];}},0x2328);}});}});};Preview[_0x9432('0xc')]['clearZombieChannels']=function(){var _0x3b8650=this;loggerAction[_0x9432('0x6c')](_0x9432('0x7c'),_['size'](this[_0x9432('0x14')]));for(var _0x230f15 in this[_0x9432('0x14')]){if(_0x3b8650['actions'][_0x9432('0x65')](_0x230f15)){_0x3b8650[_0x9432('0x6a')](_0x230f15);}}};Preview[_0x9432('0xc')][_0x9432('0x69')]=function(_0x27d651){var _0x1f2456=this;rpcDb[_0x9432('0x7d')](_0x27d651['id'],ut[_0x9432('0x7e')](this['agents']))['then'](function(_0x308a35){if(!_[_0x9432('0x6b')](_0x308a35)){for(var _0x37b79a=0x0;_0x37b79a<_0x308a35[_0x9432('0x7f')];_0x37b79a+=0x1){if(ut[_0x9432('0x80')](_0x308a35[_0x37b79a][_0x9432('0x81')])<_0x27d651['dialRecallMeTimeout']*0x3c){if(_0x308a35[_0x37b79a]['Agent']&&!_0x308a35[_0x37b79a][_0x9432('0x82')]['voicePause']){_0x1f2456[_0x9432('0x83')](_0x308a35[_0x37b79a]['id'])['then'](ut[_0x9432('0x84')]('[RecallMe]'))[_0x9432('0x75')](ut[_0x9432('0x84')]('[RecallMe]'));}else{rpcDb[_0x9432('0x85')](_0x308a35[_0x37b79a]['id']);}}else{var _0x50467d=new Action(_0x308a35[_0x37b79a],_0x27d651);_0x50467d[_0x9432('0x86')]=moment()[_0x9432('0x59')](_0x9432('0x87'));_0x27d651[_0x9432('0x3e')]+=0x1;ut['logCustomer'](_0x50467d,0x17,_0x9432('0x88'));if(_0x27d651['dialRecallInQueue']){rpcDb[_0x9432('0x89')](ut[_0x9432('0x8a')](_0x308a35[_0x37b79a]));rpcDb[_0x9432('0x8b')](_0x50467d,_0x9432('0x8c'));}else{ut[_0x9432('0x8d')](_0x50467d,0x16,_0x9432('0x8e'));rpcDb[_0x9432('0x8b')](_0x50467d,_0x9432('0x8f'));rpcDb[_0x9432('0x90')](_0x50467d,_0x9432('0x8f'));}}}}})['catch'](ut[_0x9432('0x84')]('[getContactRecallMe]'));};Preview['prototype'][_0x9432('0x68')]=function(_0x1de81d){_0x1de81d[_0x9432('0x5c')]=!![];if(ut[_0x9432('0x91')](_0x1de81d[_0x9432('0x29')])){_0x1de81d['message']=_0x9432('0x92');}else if(!ut[_0x9432('0x93')](_0x1de81d['dialActive'])){_0x1de81d[_0x9432('0x4a')]='NOT_ACTIVE';}else if(!this[_0x9432('0x94')](_0x1de81d[_0x9432('0x51')])){if(!this[_0x9432('0x94')](_0x1de81d[_0x9432('0x95')])){_0x1de81d[_0x9432('0x4a')]='TRUNK_IS_NOT_REACHABLE';}else{_0x1de81d[_0x9432('0x4a')]='ACTIVE';}}else{_0x1de81d[_0x9432('0x4a')]=_0x9432('0x96');}emitCampaignPreview(_0x1de81d);};Preview[_0x9432('0xc')]['callProgressDetectingCustomer']=function(_0xa28d06,_0xcef885,_0x58244f){var _0x5944f7=this;var _0x3a7865=this[_0x9432('0x14')][_0xcef885];var _0x23d9fa=this[_0x9432('0x11')][_0x3a7865['queue']];var _0x58196c;if(_0x23d9fa){switch(_0x58244f){case'1':_0x23d9fa['outboundNoSuchCallsDay']+=0x1;_0x3a7865[_0x9432('0x97')]+=0x1;_0x3a7865[_0x9432('0x98')]=ut[_0x9432('0x99')](_0x3a7865);ut[_0x9432('0x8d')](_0x3a7865,0x0,_0x9432('0x9a'));ami[_0x9432('0x26')](_0x9432('0x9b'),ut[_0x9432('0x9c')](_0x3a7865,_0x9432('0x9d')));rpcDb[_0x9432('0x8b')](_0x3a7865,_0x9432('0x9e'));if(ut[_0x9432('0x99')](_0x3a7865)>=_0x23d9fa[_0x9432('0x9f')]){_0x58196c=ut[_0x9432('0xa0')](_0x3a7865,0xf,_0x9432('0xa1'));rpcDb[_0x9432('0x90')](_0x58196c,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x3a7865[_0x9432('0x97')]>=_0x23d9fa[_0x9432('0xa2')]){rpcDb['createCustomerFinal'](_0x3a7865,_0x9432('0xa3'));}else{rpcDb[_0x9432('0xa4')](ut['scheduledAt'](_0x3a7865,_0x9432('0x97'),_0x23d9fa[_0x9432('0xa5')]),_0x3a7865[_0x9432('0xa6')],_0x3a7865[_0x9432('0xa7')]);}}delete this[_0x9432('0x14')][_0xa28d06[_0x9432('0xa8')]];break;case _0x9432('0xa9'):var _0xc05fa5=moment()[_0x9432('0x59')](_0x9432('0x87'));_0x3a7865['responsetime']=_0xc05fa5;_0x3a7865[_0x9432('0xaa')]=_0xc05fa5;_0x3a7865[_0x9432('0x6f')]=!![];_0x23d9fa[_0x9432('0x2a')]+=0x1;logger[_0x9432('0x6c')]('[syncHangup][talking][increment]',_0x3a7865['uniqueid'],_0x9432('0xab'),_0x23d9fa[_0x9432('0x52')],'pTalking:\x20',_0x23d9fa['pTalking']);ami[_0x9432('0x26')](_0x9432('0xac'),ut[_0x9432('0x9c')](_0x3a7865,_0x9432('0xad')));if(_0x23d9fa[_0x9432('0xae')]){ami['emit']('custom:agentConnectPreview',ut[_0x9432('0xaf')](_0x3a7865));}break;case'16':ami['emit'](_0x9432('0xb0'),ut['buildObj'](_0x3a7865,'complete'));emitVoiceQueueChannelRemove(ut[_0x9432('0x9c')](_0x3a7865,'complete'));_0x23d9fa['outboundAnswerCallsDay']+=0x1;_0x23d9fa[_0x9432('0xb1')]+=0x1;_0x23d9fa[_0x9432('0xb2')]+=0x1;ut[_0x9432('0x79')](_0x23d9fa,_0x9432('0xb3'));_0x3a7865[_0x9432('0x98')]=ut[_0x9432('0x99')](_0x3a7865);ut['logCustomer'](_0x3a7865,0x4,_0x9432('0xb4'));rpcDb[_0x9432('0x8b')](_0x3a7865,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x9432('0x90')](_0x3a7865,_0x9432('0xb5'));rpcDb['crateCustomerReportQueue'](_0x3a7865);_0x23d9fa[_0x9432('0x2c')]+=_0x3a7865[_0x9432('0xb6')];_0x23d9fa[_0x9432('0x2b')]+=_0x3a7865[_0x9432('0xb6')];logger['info'](_0x9432('0xb7'),_0x3a7865[_0x9432('0xb8')],'\x20Queue',_0x23d9fa['name'],'pTalking:\x20',_0x23d9fa[_0x9432('0x2a')]);delete this['actions'][_0xa28d06['linkedid']];break;case _0x9432('0xb9'):_0x23d9fa[_0x9432('0xba')]+=0x1;_0x3a7865['countbusyretry']+=0x1;_0x3a7865['countglobal']=ut[_0x9432('0x99')](_0x3a7865);ut[_0x9432('0x8d')](_0x3a7865,0x5,_0x9432('0xbb'));ami[_0x9432('0x26')](_0x9432('0xbc'),ut[_0x9432('0x9c')](_0x3a7865,_0x9432('0xbd')));rpcDb[_0x9432('0x8b')](_0x3a7865,_0x9432('0xbe'));if(ut['totalGlobal'](_0x3a7865)>=_0x23d9fa[_0x9432('0x9f')]){_0x58196c=ut[_0x9432('0xa0')](_0x3a7865,0xf,_0x9432('0xa1'));rpcDb[_0x9432('0x90')](_0x58196c,_0x9432('0xbf'));}else{if(_0x3a7865[_0x9432('0xc0')]>=_0x23d9fa[_0x9432('0xc1')]){rpcDb['createCustomerFinal'](_0x3a7865,_0x9432('0xbe'));}else{rpcDb[_0x9432('0xa4')](ut['scheduledAt'](_0x3a7865,_0x9432('0xc0'),_0x23d9fa[_0x9432('0xc2')]),_0x3a7865[_0x9432('0xa6')],_0x3a7865[_0x9432('0xa7')]);}}break;case _0x9432('0xc3'):_0x23d9fa[_0x9432('0x3b')]+=0x1;_0x3a7865[_0x9432('0xc4')]+=0x1;_0x3a7865[_0x9432('0x98')]=ut[_0x9432('0x99')](_0x3a7865);ut[_0x9432('0x8d')](_0x3a7865,0x3,'NoAnswer');ami[_0x9432('0x26')](_0x9432('0xc5'),ut['buildObj'](_0x3a7865,'noanswer'));rpcDb[_0x9432('0x8b')](_0x3a7865,_0x9432('0xc6'));if(ut[_0x9432('0x99')](_0x3a7865)>=_0x23d9fa[_0x9432('0x9f')]){_0x58196c=ut['cloneAction'](_0x3a7865,0xf,_0x9432('0xa1'));rpcDb[_0x9432('0x90')](_0x58196c,_0x9432('0xc7'));}else{if(_0x3a7865[_0x9432('0xc4')]>=_0x23d9fa[_0x9432('0xc8')]){rpcDb[_0x9432('0x90')](_0x3a7865,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x9432('0xa4')](ut[_0x9432('0xc9')](_0x3a7865,'countnoanswerretry',_0x23d9fa[_0x9432('0xca')]),_0x3a7865['unlockAgent'],_0x3a7865[_0x9432('0xa7')]);}}break;case'CONGESTION':_0x23d9fa[_0x9432('0x37')]+=0x1;_0x3a7865[_0x9432('0xcb')]+=0x1;_0x3a7865[_0x9432('0x98')]=ut['totalGlobal'](_0x3a7865);ut[_0x9432('0x8d')](_0x3a7865,0x8,_0x9432('0xcc'));ami[_0x9432('0x26')](_0x9432('0xcd'),ut['buildObj'](_0x3a7865,_0x9432('0xce')));rpcDb[_0x9432('0x8b')](_0x3a7865,_0x9432('0xcf'));if(ut[_0x9432('0x99')](_0x3a7865)>=_0x23d9fa['dialGlobalMaxRetry']){_0x58196c=ut['cloneAction'](_0x3a7865,0xf,_0x9432('0xa1'));rpcDb['createCustomerFinal'](_0x58196c,_0x9432('0xd0'));}else{if(_0x3a7865[_0x9432('0xcb')]>=_0x23d9fa[_0x9432('0xd1')]){rpcDb[_0x9432('0x90')](_0x3a7865,_0x9432('0xcf'));}else{rpcDb[_0x9432('0xa4')](ut[_0x9432('0xc9')](_0x3a7865,_0x9432('0xcb'),_0x23d9fa['dialBusyRetryFrequency']),_0x3a7865[_0x9432('0xa6')],_0x3a7865['activeContact']);}}break;case _0x9432('0xd2'):_0x23d9fa[_0x9432('0x3f')]+=0x1;_0x3a7865['countagentrejectretry']+=0x1;_0x3a7865[_0x9432('0x98')]=ut['totalGlobal'](_0x3a7865);ut[_0x9432('0x8d')](_0x3a7865,0x14,'AgentReject');ami['emit'](_0x9432('0xd3'),ut[_0x9432('0x9c')](_0x3a7865,_0x9432('0xd4')));rpcDb[_0x9432('0x8b')](_0x3a7865,_0x9432('0xd5'));if(ut[_0x9432('0x99')](_0x3a7865)>=_0x23d9fa[_0x9432('0x9f')]){_0x58196c=ut[_0x9432('0xa0')](_0x3a7865,0x14,_0x9432('0xd6'));rpcDb[_0x9432('0x90')](_0x58196c,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x3a7865[_0x9432('0xd7')]>=_0x23d9fa[_0x9432('0xd8')]){rpcDb['createCustomerFinal'](_0x3a7865,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut[_0x9432('0xc9')](_0x3a7865,_0x9432('0xd7'),_0x23d9fa[_0x9432('0xd9')]),_0x3a7865['unlockAgent'],_0x3a7865[_0x9432('0xa7')]);}}break;case _0x9432('0xda'):_0x23d9fa[_0x9432('0x41')]+=0x1;_0x3a7865['countabandonedretry']+=0x1;_0x3a7865[_0x9432('0x98')]=ut[_0x9432('0x99')](_0x3a7865);ut['logCustomer'](_0x3a7865,0xb,_0x9432('0xdb'));rpcDb['createCustomerHistory'](_0x3a7865,_0x9432('0xdc'));if(ut[_0x9432('0x99')](_0x3a7865)>=_0x23d9fa['dialGlobalMaxRetry']){_0x58196c=ut[_0x9432('0xa0')](_0x3a7865,0xf,_0x9432('0xa1'));rpcDb['createCustomerFinal'](_0x58196c,_0x9432('0xdc'));}else{if(_0x3a7865[_0x9432('0xdd')]>=_0x23d9fa[_0x9432('0xde')]){rpcDb['createCustomerFinal'](_0x3a7865,_0x9432('0xdc'));}else{rpcDb[_0x9432('0xa4')](ut[_0x9432('0xc9')](_0x3a7865,'countabandonedretry',_0x23d9fa[_0x9432('0xdf')]),_0x3a7865['unlockAgent'],_0x3a7865['activeContact']);}}break;default:if(_0x3a7865['dialAnswer']){ut['decrementTalkink'](_0x23d9fa,_0x9432('0xe0'));ut[_0x9432('0x7a')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x23d9fa[_0x9432('0x52')],_0xa28d06);}_0x23d9fa[_0x9432('0x40')]+=0x1;_0x3a7865[_0x9432('0x98')]=ut['totalGlobal'](_0x3a7865);ut[_0x9432('0x8d')](_0x3a7865,0xc,_0xa28d06[_0x9432('0xe1')]||_0xa28d06[_0x9432('0xe2')]);rpcDb['createCustomerHistory'](_0x3a7865,_0x9432('0xe3'));if(ut[_0x9432('0x99')](_0x3a7865)>=_0x23d9fa[_0x9432('0x9f')]){_0x58196c=ut['cloneAction'](_0x3a7865,0xf,_0x9432('0xa1'));rpcDb[_0x9432('0x90')](_0x58196c,_0x9432('0xe4'));}else{rpcDb[_0x9432('0x90')](_0x3a7865,_0x9432('0xe4'));}delete this[_0x9432('0x14')][_0xa28d06[_0x9432('0xa8')]];}if(!(_0x3a7865[_0x9432('0x6f')]&&_0x58244f==='16')){ut['updateOriginated'](_0x23d9fa,'[callProgressDetectingCustomer]');logger[_0x9432('0x6c')](_0x9432('0xe5'),_0x3a7865[_0x9432('0xb8')],'\x20Queue',_0x23d9fa[_0x9432('0x52')],'originated:\x20',_0x23d9fa[_0x9432('0x4b')]);}if(_0x58244f!=='ANSWER'){delete this['actions'][_0xa28d06[_0x9432('0xa8')]];delete this['actions'][_0xa28d06[_0x9432('0xe6')]];}}};Preview[_0x9432('0xc')]['callProgressDetectingAgent']=function(_0x5cc5b5,_0x4ca877,_0xb712bc){if(_[_0x9432('0xe7')](_0x4ca877)&&_0x9432('0xe8')!==typeof _0x4ca877){return;}if(_[_0x9432('0xe7')](_0xb712bc)&&_0x9432('0xe8')!==typeof _0xb712bc){return;}switch(_0xb712bc[_0x9432('0xe9')]){case'0':ut[_0x9432('0xea')](_0x5cc5b5,0x0,_0x9432('0x9a'));rpcDb[_0x9432('0xeb')](_0x5cc5b5,_0x9432('0xec'));break;case'3':ut[_0x9432('0xea')](_0x5cc5b5,0x3,_0x9432('0xed'));rpcDb[_0x9432('0xeb')](_0x5cc5b5,_0x9432('0xee'));break;case'5':ut[_0x9432('0xea')](_0x5cc5b5,0x5,_0x9432('0xbb'));rpcDb[_0x9432('0xeb')](_0x5cc5b5,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x5cc5b5,0x8,_0x9432('0xcc'));rpcDb[_0x9432('0xeb')](_0x5cc5b5,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x9432('0xea')](_0x5cc5b5,0x16,_0x9432('0xef'));rpcDb[_0x9432('0xeb')](_0x5cc5b5,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x9432('0xea')](_0x5cc5b5,0xc,_0xb712bc[_0x9432('0xe9')]);rpcDb[_0x9432('0xeb')](_0x5cc5b5,_0x9432('0xf0'));}ut[_0x9432('0x77')](_0x4ca877,'[callProgressDetectingAgent]');logger[_0x9432('0x6c')](_0x9432('0xf1'),_0x5cc5b5[_0x9432('0xb8')],_0x9432('0xab'),_0x4ca877[_0x9432('0x52')],_0x9432('0xf2'),_0x4ca877[_0x9432('0x4b')]);delete this[_0x9432('0x14')][_0x5cc5b5[_0x9432('0xb8')]];};Preview['prototype'][_0x9432('0xf3')]=function(_0x3177ad,_0x434397,_0x254970,_0x54d7a4,_0x140984){var _0x56b127=this;return new BPromise(function(_0xec9b56,_0x50998d){if(_[_0x9432('0x6b')](_0x434397)||_['isNil'](_0x434397[_0x9432('0xf4')])||_[_0x9432('0x6b')](_0x434397[_0x9432('0xf4')][_0x9432('0xf5')])||_[_0x9432('0x6b')](_0x434397['VoiceQueueId'])){_0x50998d(ut['message'](_0x9432('0xf6'),_0x54d7a4,_0x140984));return;}var _0x1c890a=uuid['v4']();var _0x21461c=_0x56b127[_0x9432('0x11')][_0x434397[_0x9432('0xf7')][_0x9432('0x52')]];var _0x5cddd8=_0x254970?_0x56b127[_0x9432('0x15')][_0x254970]['id']:undefined;_0x56b127[_0x9432('0x14')][_0x1c890a]=new Action(_0x434397,_0x21461c,_0x1c890a,_0x254970,_0x5cddd8);var _0x10e00b=_0x56b127[_0x9432('0x14')][_0x1c890a];_0x10e00b['unlockAgent']=_0x54d7a4;_0x10e00b[_0x9432('0xa7')]=_0x140984;_0x10e00b[_0x9432('0xf8')]=_0x254970;if(_[_0x9432('0xf9')](_0x3177ad)){_0x56b127[_0x9432('0xfa')](_0x10e00b,_0x21461c,_0x434397,_0x254970)[_0x9432('0xfb')](function(_0x5a4a79){logger[_0x9432('0x6c')]('[Preview][execCall][success]',_0x9432('0xfc')+_0x10e00b[_0x9432('0x6e')]+_0x9432('0xfd')+_0x10e00b[_0x9432('0xfe')],JSON['stringify'](_0x5a4a79));ami[_0x9432('0x26')](_0x9432('0xff'),ut[_0x9432('0x9c')](_0x10e00b,_0x9432('0x100')));_0xec9b56(ut['message'](_0x9432('0x101')));})[_0x9432('0x75')](function(_0x3f5ac3){ut['logger']('[Preview][execCall][failure]',_0x3f5ac3);_0x50998d(ut[_0x9432('0x4a')](_0x9432('0x102'),_0x54d7a4,_0x140984));});}else{_0x21461c[_0x9432('0x36')]+=0x1;ut[_0x9432('0x103')](_0x10e00b);rpcDb[_0x9432('0x104')](_0x10e00b,_0x9432('0x105'));delete _0x56b127[_0x9432('0x14')][_0x1c890a];_0x50998d(ut['message'](_0x9432('0x106'),_0x54d7a4,_0x140984));}});};Preview[_0x9432('0xc')][_0x9432('0x94')]=function(_0x5169dc){return!_['isNil'](_0x5169dc)&&!_['isNil'](_0x5169dc[_0x9432('0x52')])&&!_[_0x9432('0x6b')](_0x5169dc['active'])&&_0x5169dc['active']&&!_['isNil'](this[_0x9432('0x13')][util[_0x9432('0x59')](_0x9432('0x107'),_0x5169dc[_0x9432('0x52')])])&&!_[_0x9432('0x6b')](this[_0x9432('0x13')][util[_0x9432('0x59')](_0x9432('0x107'),_0x5169dc[_0x9432('0x52')])]['status'])&&(this[_0x9432('0x13')][util[_0x9432('0x59')](_0x9432('0x107'),_0x5169dc[_0x9432('0x52')])]['status']===_0x9432('0x108')||this[_0x9432('0x13')][util[_0x9432('0x59')]('SIP/%s',_0x5169dc[_0x9432('0x52')])]['status']==='unmonitored');};Preview[_0x9432('0xc')]['run']=function(_0x355e8a,_0x3a6d98){var _0xe89ede=this;return new BPromise(function(_0xbe0e43,_0x217b0c){_0xe89ede[_0x9432('0x109')](_0x355e8a,_0x3a6d98)[_0x9432('0xfb')](function(_0x56d9ea){_0xbe0e43(_['pick'](_0x56d9ea,[_0x9432('0x4a')]));})[_0x9432('0x75')](function(_0xcb85d1){if(_0xcb85d1['unlock']){rpcDb[_0x9432('0x10a')](_0x355e8a);}if(_0xcb85d1['active']){rpcDb[_0x9432('0x85')](_0x355e8a);}_0x217b0c(_[_0x9432('0x70')](_0xcb85d1,[_0x9432('0x4a')]));});});};Preview[_0x9432('0xc')][_0x9432('0x109')]=function(_0x40f590,_0x43519d){var _0x2d612c=this;return new BPromise(function(_0x4071f3,_0x5ac09b){var _0x79fabe,_0x1bf85d;rpcDb[_0x9432('0x10b')](_0x40f590)['then'](function(_0x4d9f94){if(!_[_0x9432('0x6b')](_0x4d9f94[0x0])){_0x1bf85d=_0x4d9f94[0x0][_0x9432('0x10c')]?![]:!![];_0x79fabe=_0x4d9f94[0x0][_0x9432('0x10c')]?!![]:![];_0x79fabe=_0x43519d?!![]:_0x79fabe;}var _0x2afeb3=_0x2d612c[_0x9432('0x10d')](_0x4d9f94);if(_0x2afeb3[_0x9432('0x10e')]){rpcDb[_0x9432('0x10f')](_[_0x9432('0x70')](_0x4d9f94[0x0],['VoiceQueueId','Contact.phone']))[_0x9432('0xfb')](function(_0x316d6b){_0x2d612c[_0x9432('0xf3')](_0x316d6b,_0x4d9f94[0x0],_0x43519d,_0x1bf85d,_0x79fabe)[_0x9432('0xfb')](function(_0x37b724){_0x4071f3(_0x37b724);})[_0x9432('0x75')](function(_0xb95063){_0x5ac09b(_0xb95063);});})[_0x9432('0x75')](function(_0x3b506b){ut['logger'](_0x9432('0x110'),_0x3b506b);_0x5ac09b(ut[_0x9432('0x4a')]('Call\x20unsuccessful',_0x1bf85d,_0x79fabe));});}else{_0x5ac09b(ut['message'](_0x2afeb3[_0x9432('0x4a')],_0x1bf85d,_0x79fabe));}})[_0x9432('0x75')](function(_0x2b3cf5){ut[_0x9432('0x5f')](_0x9432('0x111'),_0x2b3cf5);_0x5ac09b(ut[_0x9432('0x4a')](_0x9432('0x112'),![],!![]));});});};Preview[_0x9432('0xc')][_0x9432('0x10d')]=function(_0xe59539){if(_[_0x9432('0x6b')](_0xe59539)||_[_0x9432('0xf9')](_0xe59539)||!_[_0x9432('0x6b')](_0xe59539[0x0]['Agent'])&&_['isNil'](_0xe59539[0x0][_0x9432('0x82')]['name'])){ut[_0x9432('0x5f')](_0x9432('0x113'),_0xe59539);return{'isValid':![],'message':_0x9432('0x114')};}var _0xce8f5c=this[_0x9432('0x11')][_0xe59539[0x0][_0x9432('0xf7')][_0x9432('0x52')]];_0xce8f5c[_0x9432('0x4a')]=_0x9432('0x96');if(_[_0x9432('0x6b')](_0xce8f5c)){ut[_0x9432('0x5f')](_0x9432('0x115'),_0xce8f5c);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x9432('0x94')](_0xce8f5c[_0x9432('0x51')])){ut[_0x9432('0x5f')]('[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20'+_0xce8f5c[_0x9432('0x52')]+_0x9432('0x116'));if(!this['isTrunkReachable'](_0xce8f5c['TrunkBackup'])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0xce8f5c[_0x9432('0x52')]+_0x9432('0x117'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut['isActive'](_0xce8f5c['dialActive'])){ut[_0x9432('0x5f')](_0x9432('0x118'),_0xce8f5c[_0x9432('0x52')]+_0x9432('0x119'));return{'isValid':![],'message':_0x9432('0x11a')+_0xce8f5c[_0x9432('0x52')]+_0x9432('0x119')};}return{'isValid':!![],'message':_0x9432('0x11b')};};Preview[_0x9432('0xc')][_0x9432('0xfa')]=function(_0x309fdb,_0x41c4dc,_0x1504ef,_0x5f1ade){var _0x124b2f=this;return new BPromise(function(_0x4db9a3,_0x49c073){var _0x95f276=_0x309fdb[_0x9432('0xb8')];var _0x397310=_0x124b2f[_0x9432('0x94')](_0x41c4dc[_0x9432('0x51')])?util['format'](_0x9432('0x11c'),_0x41c4dc[_0x9432('0x51')][_0x9432('0x52')],_[_0x9432('0x6b')](_0x41c4dc['dialPrefix'])?'':_0x41c4dc[_0x9432('0x34')][_0x9432('0x11d')]()||'',_0x41c4dc[_0x9432('0x11e')]>0x0?_0x1504ef['Contact'][_0x9432('0xf5')][_0x9432('0x11f')](_0x41c4dc[_0x9432('0x11e')]):_0x1504ef['Contact'][_0x9432('0xf5')]):util[_0x9432('0x59')](_0x9432('0x11c'),_[_0x9432('0x6b')](_0x41c4dc['TrunkBackup'])?_0x41c4dc[_0x9432('0x51')][_0x9432('0x52')]:_0x41c4dc['TrunkBackup'][_0x9432('0x52')],_[_0x9432('0x6b')](_0x41c4dc['dialPrefix'])?'':_0x41c4dc[_0x9432('0x34')][_0x9432('0x11d')]()||'',_0x41c4dc['dialCutDigit']>0x0?_0x1504ef['Contact']['phone']['substring'](_0x41c4dc[_0x9432('0x11e')]):_0x1504ef[_0x9432('0xf4')][_0x9432('0xf5')]);var _0x1ae420=_0x124b2f[_0x9432('0x94')](_0x41c4dc[_0x9432('0x51')])?ut['getCallerId'](_0x41c4dc[_0x9432('0x51')][_0x9432('0x54')],_0x41c4dc[_0x9432('0x120')],_0x41c4dc[_0x9432('0x121')]>0x0?ut[_0x9432('0x122')](_0x41c4dc[_0x9432('0x32')],_0x41c4dc[_0x9432('0x121')]):_0x41c4dc[_0x9432('0x32')]):ut['getCallerId'](_[_0x9432('0x6b')](_0x41c4dc[_0x9432('0x95')])?_0x41c4dc[_0x9432('0x51')][_0x9432('0x54')]:_0x41c4dc[_0x9432('0x95')]['callerid'],_0x41c4dc[_0x9432('0x120')],_0x41c4dc[_0x9432('0x121')]>0x0?ut['getCallerIdRandom'](_0x41c4dc[_0x9432('0x32')],_0x41c4dc[_0x9432('0x121')]):_0x41c4dc[_0x9432('0x32')]);if(_0x1ae420){_0x309fdb[_0x9432('0x123')]=ut[_0x9432('0x124')](_0x1ae420);_0x309fdb[_0x9432('0x125')]=ut[_0x9432('0x126')](_0x1ae420);}var _0x2a5ceb=ut[_0x9432('0x127')](_0x41c4dc,_0x1504ef,_0x397310,_0x1ae420,_0x95f276,_0x309fdb);_[_0x9432('0x128')](_0x309fdb,ut[_0x9432('0x129')](_0x2a5ceb));_0x309fdb[_0x9432('0x86')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ami[_0x9432('0x12a')](ut[_0x9432('0x12b')](_0x309fdb,_0x41c4dc,_0x2a5ceb,_0x309fdb['activeContact'],_0x5f1ade))[_0x9432('0xfb')](function(_0x171a5a){_0x41c4dc['originated']+=0x1;logger[_0x9432('0x6c')](_0x9432('0x12c'),_0x95f276,_0x9432('0xab'),_0x41c4dc['name'],_0x9432('0xf2'),_0x41c4dc[_0x9432('0x4b')]);_0x4db9a3(_0x171a5a);})[_0x9432('0x75')](function(_0x12301a){ut[_0x9432('0xea')](_0x309fdb,0xe,_0x9432('0x12d'));rpcDb[_0x9432('0xeb')](_0x309fdb,_0x9432('0x12e'));_0x49c073(_0x12301a);});});};Preview[_0x9432('0xc')]['syncNewExten']=function(_0x1a382d){if(this[_0x9432('0x14')][_0x1a382d[_0x9432('0xa8')]]){this['actions'][_0x1a382d[_0x9432('0xa8')]]['channel']=_0x1a382d[_0x9432('0x74')];}};Preview['prototype'][_0x9432('0x18')]=function(_0x91d2d8){var _0x57204b=this;var _0x3f9bc7=this[_0x9432('0x14')][_0x91d2d8[_0x9432('0x12f')]];if(_0x3f9bc7){if(_0x3f9bc7[_0x9432('0xf8')]&&this[_0x9432('0x15')][_0x3f9bc7[_0x9432('0xf8')]]){ut['logLookAgent'](_0x3f9bc7,this[_0x9432('0x15')][_0x3f9bc7['lookAgent']][_0x9432('0x52')],this[_0x9432('0x15')][_0x3f9bc7[_0x9432('0xf8')]]['id']);}var _0x25d710=_[_0x9432('0x130')](_0x3f9bc7);_0x25d710['responsetime']=moment()[_0x9432('0x59')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3eae44=_0x57204b[_0x9432('0x11')][_0x3f9bc7[_0x9432('0x6e')]];if(ut[_0x9432('0x131')](_0x91d2d8[_0x9432('0x132')])){if(_0x3f9bc7[_0x9432('0xa6')]){rpcDb[_0x9432('0x10a')](_0x3f9bc7[_0x9432('0xfe')]);}if(_0x3f9bc7[_0x9432('0xa7')]){rpcDb[_0x9432('0x85')](_0x3f9bc7[_0x9432('0xfe')]);}ami[_0x9432('0x26')](_0x9432('0x133'),ut[_0x9432('0x9c')](_0x3f9bc7,_0x9432('0x134')));this[_0x9432('0x135')](_0x25d710,_0x3eae44,_0x91d2d8);}else{_0x3f9bc7[_0x9432('0x86')]=moment()[_0x9432('0x59')](_0x9432('0x87'));ut[_0x9432('0xea')](_0x25d710,0x4,_0x9432('0xb4'));rpcDb[_0x9432('0xeb')](_0x25d710,_0x9432('0x136'));}}};Preview[_0x9432('0xc')][_0x9432('0x1b')]=function(_0x39c9a5){var _0x52af5d=this;var _0x32adc1=this[_0x9432('0x14')][_0x39c9a5[_0x9432('0xa8')]];var _0x2d0c1a;if(_0x32adc1){_0x2d0c1a=this[_0x9432('0x11')][_0x32adc1[_0x9432('0x6e')]];logger[_0x9432('0x6c')](_0x9432('0x137'),_0x39c9a5['linkedid'],'\x20Queue',_0x2d0c1a[_0x9432('0x52')],_0x9432('0x138'),_0x2d0c1a[_0x9432('0x2a')]);}if(this['actions'][_0x39c9a5[_0x9432('0xa8')]]&&_0x39c9a5[_0x9432('0xa8')]!==_0x39c9a5[_0x9432('0xb8')]){if(_0x39c9a5[_0x9432('0x139')]==='16'&&this[_0x9432('0x14')][_0x39c9a5[_0x9432('0xa8')]][_0x9432('0x6f')]){this[_0x9432('0x13a')](_0x39c9a5,_0x39c9a5[_0x9432('0xa8')],_0x39c9a5[_0x9432('0x139')]);}else if(this[_0x9432('0x14')][_0x39c9a5[_0x9432('0xa8')]][_0x9432('0x6f')]){logger[_0x9432('0x6c')](_0x9432('0x13b'),_0x39c9a5[_0x9432('0xa8')],_0x39c9a5[_0x9432('0x139')],'\x20Queue',_0x2d0c1a[_0x9432('0x52')],_0x9432('0x138'),_0x2d0c1a[_0x9432('0x2a')]);this[_0x9432('0x13a')](_0x39c9a5,_0x39c9a5[_0x9432('0xa8')],_0x39c9a5[_0x9432('0x139')]);}}else if(_0x32adc1&&_[_0x9432('0x6b')](_0x32adc1[_0x9432('0x13c')])&&_0x2d0c1a[_0x9432('0x13d')]&&_0x39c9a5[_0x9432('0xa8')]===_0x39c9a5[_0x9432('0xb8')]&&_[_0x9432('0x6b')](_0x39c9a5[_0x9432('0xe9')])&&_0x39c9a5[_0x9432('0x139')]==='16'&&_0x39c9a5['channelstate']==='6'&&_[_0x9432('0xe7')](_0x32adc1[_0x9432('0x13e')])){if(_0x32adc1[_0x9432('0xa6')]){rpcDb[_0x9432('0x10a')](_0x32adc1[_0x9432('0xfe')]);}if(_0x32adc1[_0x9432('0xa7')]){rpcDb['disableContact'](_0x32adc1[_0x9432('0xfe')]);}_0x39c9a5['reason']='22';this[_0x9432('0x135')](_0x32adc1,_0x2d0c1a,_0x39c9a5);}else if(_0x32adc1&&_0x32adc1['transfer']){if(_0x39c9a5['cause']==='16'&&this[_0x9432('0x14')][_0x39c9a5['linkedid']]['dialAnswer']){logger[_0x9432('0x6c')](_0x9432('0x13f'),_0x39c9a5[_0x9432('0xa8')],_0x39c9a5[_0x9432('0x139')],_0x9432('0xab'),_0x2d0c1a[_0x9432('0x52')],'pTalking:\x20',_0x2d0c1a[_0x9432('0x2a')]);this['callProgressDetectingCustomer'](_0x39c9a5,_0x39c9a5[_0x9432('0xa8')],_0x39c9a5[_0x9432('0x139')]);}else if(this[_0x9432('0x14')][_0x39c9a5[_0x9432('0xa8')]]['dialAnswer']){logger[_0x9432('0x6c')](_0x9432('0x13b'),_0x39c9a5[_0x9432('0xa8')],_0x39c9a5[_0x9432('0x139')],_0x9432('0xab'),_0x2d0c1a[_0x9432('0x52')],'pTalking:\x20',_0x2d0c1a[_0x9432('0x2a')]);this[_0x9432('0x13a')](_0x39c9a5,_0x39c9a5[_0x9432('0xa8')],_0x39c9a5[_0x9432('0x139')]);}}};Preview[_0x9432('0xc')][_0x9432('0x1f')]=function(_0x4badf0){if(this[_0x9432('0x14')][_0x4badf0[_0x9432('0xe6')]]&&_0x4badf0['destlinkedid']!==_0x4badf0[_0x9432('0x140')]){this[_0x9432('0x13a')](_0x4badf0,_0x4badf0[_0x9432('0xe6')],_0x4badf0[_0x9432('0xe2')]);}};Preview[_0x9432('0xc')][_0x9432('0x1d')]=function(_0x3b0be4){if(this[_0x9432('0x14')][_0x3b0be4[_0x9432('0xa8')]]&&_0x3b0be4[_0x9432('0xa8')]!==_0x3b0be4['uniqueid']&&!this['actions'][_0x3b0be4[_0x9432('0xa8')]][_0x9432('0x6f')]){if(_0x3b0be4['cause']==='1'){this['callProgressDetectingCustomer'](_0x3b0be4,_0x3b0be4[_0x9432('0xa8')],_0x3b0be4[_0x9432('0x139')]);}}};Preview['prototype'][_0x9432('0x141')]=function(_0x581b1c,_0x2cf4b6,_0x5a47ec){if(this['actions'][_0x581b1c]){if(_[_0x9432('0x6b')](this[_0x9432('0x14')][_0x581b1c][_0x9432('0x142')])){this[_0x9432('0x14')][_0x581b1c][_0x9432('0x142')]={};}this[_0x9432('0x14')][_0x581b1c]['variables'][_0x2cf4b6]=_0x5a47ec;}};Preview['prototype'][_0x9432('0x22')]=function(_0xb4c493){try{if(!_['isNil'](_0xb4c493)){if(ut[_0x9432('0x143')](_['keys'](_0xb4c493[_0x9432('0x144')])[0x0])){this[_0x9432('0x141')](_0xb4c493[_0x9432('0xb8')],_[_0x9432('0x145')](_0xb4c493['variable'])[0x0],_0xb4c493[_0x9432('0x146')]);}}}catch(_0x2461de){logger[_0x9432('0x147')]('[syncVarSet][Preview]',util[_0x9432('0x148')](_0x2461de,{'showHidden':![],'depth':null}));}};Preview[_0x9432('0xc')][_0x9432('0x23')]=function(_0xcd5c05){if(_0xcd5c05){if(this[_0x9432('0x14')][_0xcd5c05['transfertargetlinkedid']]){this[_0x9432('0x14')][_0xcd5c05[_0x9432('0x149')]][_0x9432('0x13e')]=!![];}}};Preview[_0x9432('0xc')][_0x9432('0x25')]=function(_0x1d94d7){if(_0x1d94d7){if(this[_0x9432('0x14')][_0x1d94d7[_0x9432('0x14a')]]){this[_0x9432('0x14')][_0x1d94d7[_0x9432('0x14a')]][_0x9432('0x13e')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0xdb06=['Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','destlinkedid','callProgressDetectingAgent','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','Queue','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlockContact','disableContact','getContactPreview','recallme','validateContact','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','ACTIVE','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','execCall','SIP/%s/%s%s','dialCutDigit','substring','trim','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','lookAgent','isFailure','rejected','Answer','syncHangup','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncDialEnd','destuniqueid','dialstatus','addVariable','variables','keys','variable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','ioredis','../../../config/environment','../../../config/logger','actionPreview','./rpcDb','./action','./util/util','redis','socket.io-emitter','tail','sequence','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','originateresponse','hangup','bind','syncHangupRequest','dialend','newexten','syncNewExten','syncVarSet','syncAttendedTransfer','blindtransfer','loopCampaigns','type','name','strategy','answered','available','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','md5','format','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','sendMessageOneNotActive','originated','paused','logger','\x20is\x20not\x20active','IS_DISACTIVED','prototype','syncCampaigns','preview','booked','clearZombieChannels','outbound','setMessage','recallMe','clearZombieChannel','enqueue','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','pick','contactId','UserId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','hasOwnProperty','getContactRecallMe','then','isNil','getDiff','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','starttime','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','NOT_ACTIVE','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','NoSuchNumber','emit','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','dialNoSuchNumberRetryFrequency','activeContact','linkedid','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumBillable','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','[callProgressDetectingCustomer][logBusy]','dialBusyMaxRetry','scheduledAt','dialBusyRetryFrequency','unlockAgent','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','CONGESTION','countcongestionretry','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry'];(function(_0x112e2a,_0x364486){var _0x4f8af9=function(_0xa11c0d){while(--_0xa11c0d){_0x112e2a['push'](_0x112e2a['shift']());}};_0x4f8af9(++_0x364486);}(_0xdb06,0x73));var _0x6db0=function(_0x58453e,_0x4bf312){_0x58453e=_0x58453e-0x0;var _0x191100=_0xdb06[_0x58453e];return _0x191100;};'use strict';var util=require(_0x6db0('0x0'));var _=require(_0x6db0('0x1'));var BPromise=require(_0x6db0('0x2'));var uuid=require(_0x6db0('0x3'));var moment=require(_0x6db0('0x4'));var md5=require('md5');var Redis=require(_0x6db0('0x5'));var config=require(_0x6db0('0x6'));var logger=require('../../../config/logger')('preview');var loggerAction=require(_0x6db0('0x7'))(_0x6db0('0x8'));var ami=require('../ami');var rpcDb=require(_0x6db0('0x9'));var Action=require(_0x6db0('0xa'));var ut=require(_0x6db0('0xb'));config['redis']=_['defaults'](config[_0x6db0('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x6db0('0xd'))(new Redis(config[_0x6db0('0xc')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x1f5d8f){this['tail']=this['tail']?this[_0x6db0('0xe')]['finally'](_0x1f5d8f):_0x1f5d8f();};function Preview(_0x2ee433){this[_0x6db0('0xf')]=new Sequence();this[_0x6db0('0x10')]=_0x2ee433['voiceQueues'];this['trunks']=_0x2ee433[_0x6db0('0x11')];this[_0x6db0('0x12')]={};this['agents']=_0x2ee433[_0x6db0('0x13')];this[_0x6db0('0x14')]=0x0;ami['on'](_0x6db0('0x15'),this['syncOriginateResponse']['bind'](this));ami['on'](_0x6db0('0x16'),this['syncHangup'][_0x6db0('0x17')](this));ami['on']('hanguprequest',this[_0x6db0('0x18')]['bind'](this));ami['on'](_0x6db0('0x19'),this['syncDialEnd']['bind'](this));ami['on'](_0x6db0('0x1a'),this[_0x6db0('0x1b')][_0x6db0('0x17')](this));ami['on']('varset',this[_0x6db0('0x1c')][_0x6db0('0x17')](this));ami['on']('attendedtransfer',this[_0x6db0('0x1d')]['bind'](this));ami['on'](_0x6db0('0x1e'),this['syncBlindTransfer'][_0x6db0('0x17')](this));this[_0x6db0('0x1f')](this['campaignsPreview']);}function emit(_0x55e249,_0x295dc8,_0x460dd7){io['to'](_0x55e249)['emit'](_0x295dc8,_0x460dd7);}function emitCampaignPreview(_0x11ecb1){if(_0x11ecb1[_0x6db0('0x20')]==='outbound'){var _0x240fd7={'id':_0x11ecb1['id'],'name':_0x11ecb1[_0x6db0('0x21')],'strategy':_0x11ecb1[_0x6db0('0x22')],'answered':_0x11ecb1[_0x6db0('0x23')],'available':_0x11ecb1[_0x6db0('0x24')],'loggedIn':_0x11ecb1['loggedIn'],'pTalking':_0x11ecb1[_0x6db0('0x25')],'sumBillable':_0x11ecb1['sumBillable'],'sumDuration':_0x11ecb1[_0x6db0('0x26')],'sumHoldTime':_0x11ecb1[_0x6db0('0x27')]||0x0,'talking':_0x11ecb1[_0x6db0('0x28')],'total':_0x11ecb1[_0x6db0('0x29')],'type':_0x11ecb1['type'],'unmanaged':_0x11ecb1[_0x6db0('0x2a')],'abandoned':_0x11ecb1['abandoned'],'waiting':_0x11ecb1[_0x6db0('0x2b')],'loggedInDb':_0x11ecb1[_0x6db0('0x2c')],'dialActive':_0x11ecb1[_0x6db0('0x2d')],'dialMethod':_0x11ecb1[_0x6db0('0x2e')],'dialOriginateCallerIdName':_0x11ecb1[_0x6db0('0x2f')],'dialOriginateCallerIdNumber':_0x11ecb1['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x11ecb1[_0x6db0('0x30')],'dialPrefix':_0x11ecb1[_0x6db0('0x31')],'outboundAnswerAgiCallsDay':_0x11ecb1[_0x6db0('0x32')],'outboundAnswerCallsDay':_0x11ecb1['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x11ecb1['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x11ecb1[_0x6db0('0x33')],'outboundCongestionCallsDay':_0x11ecb1[_0x6db0('0x34')],'outboundDropCallsDayACS':_0x11ecb1['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x11ecb1[_0x6db0('0x35')],'outboundDropCallsDayTimeout':_0x11ecb1['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x11ecb1[_0x6db0('0x36')],'outboundNoSuchCallsDay':_0x11ecb1[_0x6db0('0x37')],'outboundOriginateFailureCallsDay':_0x11ecb1[_0x6db0('0x38')],'outboundReCallsDay':_0x11ecb1['outboundReCallsDay'],'outboundRejectCallsDay':_0x11ecb1[_0x6db0('0x39')],'outboundUnknownCallsDay':_0x11ecb1[_0x6db0('0x3a')],'outboundAbandonedCallsDay':_0x11ecb1[_0x6db0('0x3b')],'predictiveIntervalAnsweredCalls':_0x11ecb1['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x11ecb1['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x11ecb1[_0x6db0('0x3c')],'predictiveIntervalDroppedCallsCallersExit':_0x11ecb1[_0x6db0('0x3d')],'predictiveIntervalDroppedCallsTimeout':_0x11ecb1[_0x6db0('0x3e')],'predictiveIntervalErlangCalls':_0x11ecb1[_0x6db0('0x3f')],'predictiveIntervalErlangCallsDroppedCalls':_0x11ecb1[_0x6db0('0x40')],'predictiveIntervalHitRate':_0x11ecb1[_0x6db0('0x41')],'predictiveIntervalMultiplicativeFactor':_0x11ecb1[_0x6db0('0x42')],'predictiveIntervalPauses':_0x11ecb1[_0x6db0('0x43')],'predictiveIntervalAvailable':_0x11ecb1['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x11ecb1[_0x6db0('0x44')],'message':_0x11ecb1[_0x6db0('0x45')],'originated':_0x11ecb1['originated'],'erlangCalls':_0x11ecb1[_0x6db0('0x46')],'erlangCallToSecond':_0x11ecb1[_0x6db0('0x47')],'erlangAbandonmentRate':_0x11ecb1[_0x6db0('0x48')],'erlangBusyFactor':_0x11ecb1[_0x6db0('0x49')],'startPredictive':_0x11ecb1[_0x6db0('0x4a')],'startProgressive':_0x11ecb1[_0x6db0('0x4b')]};if(_0x11ecb1[_0x6db0('0x4c')]){_0x240fd7[_0x6db0('0x4c')]={'id':_0x11ecb1[_0x6db0('0x4c')]['id'],'name':_0x11ecb1[_0x6db0('0x4c')][_0x6db0('0x21')],'active':_0x11ecb1[_0x6db0('0x4c')][_0x6db0('0x4d')],'callerid':_0x11ecb1[_0x6db0('0x4c')][_0x6db0('0x4e')]};}if(_0x11ecb1['Interval']){_0x240fd7['Interval']={'id':_0x11ecb1[_0x6db0('0x4f')]['id'],'name':_0x11ecb1['Interval']['name']};}var _0x28ab79=md5(JSON[_0x6db0('0x50')](_0x240fd7));if(_0x11ecb1[_0x6db0('0x51')]!==_0x28ab79){_0x11ecb1['md5']=_0x28ab79;emit(util[_0x6db0('0x52')](_0x6db0('0x53'),_0x240fd7[_0x6db0('0x21')]),'voice_queue:save',_0x240fd7);}}}function emitVoiceQueueChannelRemove(_0x15bd12){logger[_0x6db0('0x54')](_0x6db0('0x55'),JSON[_0x6db0('0x50')](_0x15bd12));emit(util[_0x6db0('0x52')](_0x6db0('0x53'),_0x15bd12[_0x6db0('0x21')]),_0x6db0('0x56'),_0x15bd12);}function notSendMessagesQueue(_0x13bffe){if(_0x13bffe[_0x6db0('0x57')]){if(_0x13bffe[_0x6db0('0x58')]===0x0&&_0x13bffe[_0x6db0('0x25')]===0x0){_0x13bffe[_0x6db0('0x57')]=![];_0x13bffe['available']=0x0;_0x13bffe[_0x6db0('0x59')]=0x0;_0x13bffe[_0x6db0('0x45')]='NOT_ACTIVE';ut[_0x6db0('0x5a')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x13bffe[_0x6db0('0x21')]+_0x6db0('0x5b'));}else{_0x13bffe['message']=_0x6db0('0x5c');ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x13bffe['name']+'\x20is\x20disactive');}emitCampaignPreview(_0x13bffe);}}Preview[_0x6db0('0x5d')][_0x6db0('0x1f')]=function(){var _0x152adb=this;setInterval(function(){_0x152adb[_0x6db0('0x5e')]();},0x7cf);};Preview[_0x6db0('0x5d')]['syncCampaigns']=function(){var _0xc4e75d=this[_0x6db0('0x10')];this[_0x6db0('0x14')]+=0x1;for(var _0x563993 in _0xc4e75d){if(_0xc4e75d['hasOwnProperty'](_0x563993)&&(_0xc4e75d[_0x563993][_0x6db0('0x2e')]===_0x6db0('0x5f')||_0xc4e75d[_0x563993][_0x6db0('0x2e')]===_0x6db0('0x60'))&&_0xc4e75d[_0x563993]['type']==='outbound'){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this[_0x6db0('0x61')]();}}if(_0xc4e75d['hasOwnProperty'](_0x563993)&&_0xc4e75d[_0x563993][_0x6db0('0x2e')]===_0x6db0('0x5f')&&_0xc4e75d[_0x563993][_0x6db0('0x20')]===_0x6db0('0x62')){if(_0xc4e75d[_0x563993]['dialActive']){this[_0x6db0('0x63')](_0xc4e75d[_0x563993]);this[_0x6db0('0x64')](_0xc4e75d[_0x563993]);}else{notSendMessagesQueue(_0xc4e75d[_0x563993]);}}}};Preview[_0x6db0('0x5d')][_0x6db0('0x65')]=function(_0x2deeb2){var _0x2d2b3c=this;this[_0x6db0('0xf')][_0x6db0('0x66')](function(){if(!_['isNil'](_0x2d2b3c[_0x6db0('0x12')][_0x2deeb2])){loggerAction[_0x6db0('0x54')](_0x6db0('0x67'),_0x2deeb2,'Queue',_0x2d2b3c[_0x6db0('0x12')][_0x2deeb2][_0x6db0('0x68')],_0x6db0('0x69'),JSON['stringify'](_0x2d2b3c['campaignsPreview'][_0x2d2b3c[_0x6db0('0x12')][_0x2deeb2]['queue']][_0x6db0('0x58')]),_0x6db0('0x6a'),JSON[_0x6db0('0x50')](_0x2d2b3c[_0x6db0('0x10')][_0x2d2b3c['actions'][_0x2deeb2][_0x6db0('0x68')]]['pTalking']),JSON[_0x6db0('0x50')](_0x2d2b3c[_0x6db0('0x12')][_0x2deeb2]['dialAnswer']),JSON[_0x6db0('0x50')](_[_0x6db0('0x6b')](_0x2d2b3c[_0x6db0('0x12')][_0x2deeb2],[_0x6db0('0x6c'),_0x6db0('0x6d'),_0x6db0('0x6e'),_0x6db0('0x6f')])));return ami['Action']({'action':_0x6db0('0x70'),'channel':_0x2d2b3c[_0x6db0('0x12')][_0x2deeb2][_0x6db0('0x71')]})[_0x6db0('0x72')](function(_0x490cb9){if(_0x490cb9['message']===_0x6db0('0x73')){setTimeout(function(){if(_0x2d2b3c[_0x6db0('0x12')][_0x2deeb2]){ut[_0x6db0('0x74')](_0x2d2b3c[_0x6db0('0x10')][_0x2d2b3c['actions'][_0x2deeb2]['queue']],_0x6db0('0x75'));if(_0x2d2b3c[_0x6db0('0x12')][_0x2deeb2][_0x6db0('0x76')]===!![]){ut[_0x6db0('0x77')](_0x2d2b3c['campaignsPreview'][_0x2d2b3c[_0x6db0('0x12')][_0x2deeb2]['queue']],'[clearZombieChannel]');ut[_0x6db0('0x78')](_0x6db0('0x79')+_0x2deeb2,_0x2d2b3c['actions'][_0x2deeb2][_0x6db0('0x68')]);}ut[_0x6db0('0x78')](_0x6db0('0x7a')+_0x2deeb2,_0x2d2b3c['actions'][_0x2deeb2][_0x6db0('0x68')]);delete _0x2d2b3c['actions'][_0x2deeb2];}},0x2328);}});}});};Preview['prototype'][_0x6db0('0x61')]=function(){var _0x522e1d=this;loggerAction['info'](_0x6db0('0x7b'),_[_0x6db0('0x7c')](this[_0x6db0('0x12')]));for(var _0x125b31 in this[_0x6db0('0x12')]){if(_0x522e1d[_0x6db0('0x12')][_0x6db0('0x7d')](_0x125b31)){_0x522e1d[_0x6db0('0x65')](_0x125b31);}}};Preview['prototype'][_0x6db0('0x64')]=function(_0x3c071c){var _0x34bdd8=this;rpcDb[_0x6db0('0x7e')](_0x3c071c['id'],ut['agentReadyId'](this[_0x6db0('0x13')]))[_0x6db0('0x7f')](function(_0x205add){if(!_[_0x6db0('0x80')](_0x205add)){for(var _0x956683=0x0;_0x956683<_0x205add['length'];_0x956683+=0x1){if(ut[_0x6db0('0x81')](_0x205add[_0x956683]['scheduledat'])<_0x3c071c[_0x6db0('0x82')]*0x3c){if(_0x205add[_0x956683]['Agent']&&!_0x205add[_0x956683][_0x6db0('0x83')][_0x6db0('0x84')]){_0x34bdd8[_0x6db0('0x85')](_0x205add[_0x956683]['id'])[_0x6db0('0x7f')](ut[_0x6db0('0x86')](_0x6db0('0x87')))['catch'](ut[_0x6db0('0x86')](_0x6db0('0x87')));}else{rpcDb['disableContact'](_0x205add[_0x956683]['id']);}}else{var _0x1be614=new Action(_0x205add[_0x956683],_0x3c071c);_0x1be614[_0x6db0('0x88')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3c071c[_0x6db0('0x89')]+=0x1;ut[_0x6db0('0x8a')](_0x1be614,0x17,_0x6db0('0x8b'));if(_0x3c071c[_0x6db0('0x8c')]){rpcDb[_0x6db0('0x8d')](ut[_0x6db0('0x8e')](_0x205add[_0x956683]));rpcDb[_0x6db0('0x8f')](_0x1be614,_0x6db0('0x90'));}else{ut[_0x6db0('0x8a')](_0x1be614,0x16,_0x6db0('0x91'));rpcDb[_0x6db0('0x8f')](_0x1be614,_0x6db0('0x92'));rpcDb['createCustomerFinal'](_0x1be614,_0x6db0('0x92'));}}}}})[_0x6db0('0x72')](ut['logger2']('[getContactRecallMe]'));};Preview[_0x6db0('0x5d')][_0x6db0('0x63')]=function(_0xf273b8){_0xf273b8[_0x6db0('0x57')]=!![];if(ut[_0x6db0('0x93')](_0xf273b8['loggedIn'])){_0xf273b8[_0x6db0('0x45')]=_0x6db0('0x94');}else if(!ut[_0x6db0('0x95')](_0xf273b8[_0x6db0('0x2d')])){_0xf273b8[_0x6db0('0x45')]=_0x6db0('0x96');}else if(!this[_0x6db0('0x97')](_0xf273b8[_0x6db0('0x4c')])){if(!this['isTrunkReachable'](_0xf273b8['TrunkBackup'])){_0xf273b8[_0x6db0('0x45')]=_0x6db0('0x98');}else{_0xf273b8[_0x6db0('0x45')]='ACTIVE';}}else{_0xf273b8[_0x6db0('0x45')]='ACTIVE';}emitCampaignPreview(_0xf273b8);};Preview[_0x6db0('0x5d')][_0x6db0('0x99')]=function(_0x69ebe5,_0x3b87b9,_0x499abd){var _0x52c031=this;var _0x2841ad=this[_0x6db0('0x12')][_0x3b87b9];var _0x1dbe30=this['campaignsPreview'][_0x2841ad[_0x6db0('0x68')]];var _0x49f01f;if(_0x1dbe30){switch(_0x499abd){case'1':_0x1dbe30[_0x6db0('0x37')]+=0x1;_0x2841ad[_0x6db0('0x9a')]+=0x1;_0x2841ad[_0x6db0('0x9b')]=ut['totalGlobal'](_0x2841ad);ut['logCustomer'](_0x2841ad,0x0,_0x6db0('0x9c'));ami[_0x6db0('0x9d')](_0x6db0('0x9e'),ut[_0x6db0('0x9f')](_0x2841ad,_0x6db0('0xa0')));rpcDb[_0x6db0('0x8f')](_0x2841ad,_0x6db0('0xa1'));if(ut[_0x6db0('0xa2')](_0x2841ad)>=_0x1dbe30[_0x6db0('0xa3')]){_0x49f01f=ut[_0x6db0('0xa4')](_0x2841ad,0xf,_0x6db0('0xa5'));rpcDb[_0x6db0('0xa6')](_0x49f01f,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x2841ad[_0x6db0('0x9a')]>=_0x1dbe30[_0x6db0('0xa7')]){rpcDb[_0x6db0('0xa6')](_0x2841ad,_0x6db0('0xa8'));}else{rpcDb[_0x6db0('0xa9')](ut['scheduledAt'](_0x2841ad,_0x6db0('0x9a'),_0x1dbe30[_0x6db0('0xaa')]),_0x2841ad['unlockAgent'],_0x2841ad[_0x6db0('0xab')]);}}delete this['actions'][_0x69ebe5[_0x6db0('0xac')]];break;case _0x6db0('0xad'):var _0x860af7=moment()['format'](_0x6db0('0xae'));_0x2841ad[_0x6db0('0xaf')]=_0x860af7;_0x2841ad['answertime']=_0x860af7;_0x2841ad[_0x6db0('0x76')]=!![];_0x1dbe30[_0x6db0('0x25')]+=0x1;logger['info'](_0x6db0('0xb0'),_0x2841ad[_0x6db0('0xb1')],_0x6db0('0xb2'),_0x1dbe30[_0x6db0('0x21')],'pTalking:\x20',_0x1dbe30['pTalking']);ami['emit'](_0x6db0('0xb3'),ut[_0x6db0('0x9f')](_0x2841ad,_0x6db0('0xb4')));if(_0x1dbe30[_0x6db0('0xb5')]){ami['emit'](_0x6db0('0xb6'),ut[_0x6db0('0xb7')](_0x2841ad));}break;case'16':ami[_0x6db0('0x9d')](_0x6db0('0xb8'),ut['buildObj'](_0x2841ad,'complete'));emitVoiceQueueChannelRemove(ut[_0x6db0('0x9f')](_0x2841ad,'complete'));_0x1dbe30['outboundAnswerCallsDay']+=0x1;_0x1dbe30['total']+=0x1;_0x1dbe30['answered']+=0x1;ut[_0x6db0('0x77')](_0x1dbe30,_0x6db0('0xb9'));_0x2841ad[_0x6db0('0x9b')]=ut[_0x6db0('0xa2')](_0x2841ad);ut['logCustomer'](_0x2841ad,0x4,'Answer');rpcDb[_0x6db0('0x8f')](_0x2841ad,_0x6db0('0xba'));rpcDb['createCustomerFinal'](_0x2841ad,_0x6db0('0xbb'));rpcDb[_0x6db0('0xbc')](_0x2841ad);_0x1dbe30['sumDuration']+=_0x2841ad['talktime'];_0x1dbe30[_0x6db0('0xbd')]+=_0x2841ad[_0x6db0('0xbe')];logger[_0x6db0('0x54')](_0x6db0('0xbf'),_0x2841ad[_0x6db0('0xb1')],_0x6db0('0xb2'),_0x1dbe30[_0x6db0('0x21')],_0x6db0('0x6a'),_0x1dbe30[_0x6db0('0x25')]);delete this[_0x6db0('0x12')][_0x69ebe5[_0x6db0('0xac')]];break;case _0x6db0('0xc0'):_0x1dbe30[_0x6db0('0x33')]+=0x1;_0x2841ad[_0x6db0('0xc1')]+=0x1;_0x2841ad[_0x6db0('0x9b')]=ut[_0x6db0('0xa2')](_0x2841ad);ut[_0x6db0('0x8a')](_0x2841ad,0x5,_0x6db0('0xc2'));ami[_0x6db0('0x9d')]('custom:agentbusy',ut[_0x6db0('0x9f')](_0x2841ad,'busy'));rpcDb['createCustomerHistory'](_0x2841ad,_0x6db0('0xc3'));if(ut[_0x6db0('0xa2')](_0x2841ad)>=_0x1dbe30[_0x6db0('0xa3')]){_0x49f01f=ut['cloneAction'](_0x2841ad,0xf,_0x6db0('0xa5'));rpcDb['createCustomerFinal'](_0x49f01f,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x2841ad[_0x6db0('0xc1')]>=_0x1dbe30[_0x6db0('0xc4')]){rpcDb['createCustomerFinal'](_0x2841ad,_0x6db0('0xc3'));}else{rpcDb['rescheduleContact'](ut[_0x6db0('0xc5')](_0x2841ad,_0x6db0('0xc1'),_0x1dbe30[_0x6db0('0xc6')]),_0x2841ad[_0x6db0('0xc7')],_0x2841ad[_0x6db0('0xab')]);}}break;case _0x6db0('0xc8'):_0x1dbe30[_0x6db0('0x36')]+=0x1;_0x2841ad[_0x6db0('0xc9')]+=0x1;_0x2841ad[_0x6db0('0x9b')]=ut[_0x6db0('0xa2')](_0x2841ad);ut['logCustomer'](_0x2841ad,0x3,_0x6db0('0xca'));ami[_0x6db0('0x9d')](_0x6db0('0xcb'),ut[_0x6db0('0x9f')](_0x2841ad,_0x6db0('0xcc')));rpcDb['createCustomerHistory'](_0x2841ad,_0x6db0('0xcd'));if(ut['totalGlobal'](_0x2841ad)>=_0x1dbe30[_0x6db0('0xa3')]){_0x49f01f=ut[_0x6db0('0xa4')](_0x2841ad,0xf,_0x6db0('0xa5'));rpcDb[_0x6db0('0xa6')](_0x49f01f,_0x6db0('0xce'));}else{if(_0x2841ad[_0x6db0('0xc9')]>=_0x1dbe30['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x2841ad,_0x6db0('0xcd'));}else{rpcDb[_0x6db0('0xa9')](ut['scheduledAt'](_0x2841ad,_0x6db0('0xc9'),_0x1dbe30['dialNoAnswerRetryFrequency']),_0x2841ad[_0x6db0('0xc7')],_0x2841ad['activeContact']);}}break;case _0x6db0('0xcf'):_0x1dbe30[_0x6db0('0x34')]+=0x1;_0x2841ad[_0x6db0('0xd0')]+=0x1;_0x2841ad[_0x6db0('0x9b')]=ut['totalGlobal'](_0x2841ad);ut[_0x6db0('0x8a')](_0x2841ad,0x8,'Congestion');ami[_0x6db0('0x9d')](_0x6db0('0xd1'),ut[_0x6db0('0x9f')](_0x2841ad,_0x6db0('0xd2')));rpcDb[_0x6db0('0x8f')](_0x2841ad,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x6db0('0xa2')](_0x2841ad)>=_0x1dbe30[_0x6db0('0xa3')]){_0x49f01f=ut[_0x6db0('0xa4')](_0x2841ad,0xf,_0x6db0('0xa5'));rpcDb[_0x6db0('0xa6')](_0x49f01f,_0x6db0('0xd3'));}else{if(_0x2841ad['countcongestionretry']>=_0x1dbe30[_0x6db0('0xd4')]){rpcDb[_0x6db0('0xa6')](_0x2841ad,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x6db0('0xa9')](ut[_0x6db0('0xc5')](_0x2841ad,_0x6db0('0xd0'),_0x1dbe30['dialBusyRetryFrequency']),_0x2841ad[_0x6db0('0xc7')],_0x2841ad[_0x6db0('0xab')]);}}break;case'CANCEL':_0x1dbe30['outboundRejectCallsDay']+=0x1;_0x2841ad['countagentrejectretry']+=0x1;_0x2841ad[_0x6db0('0x9b')]=ut[_0x6db0('0xa2')](_0x2841ad);ut[_0x6db0('0x8a')](_0x2841ad,0x14,'AgentReject');ami[_0x6db0('0x9d')]('custom:agentreject',ut['buildObj'](_0x2841ad,_0x6db0('0xd5')));rpcDb[_0x6db0('0x8f')](_0x2841ad,_0x6db0('0xd6'));if(ut[_0x6db0('0xa2')](_0x2841ad)>=_0x1dbe30[_0x6db0('0xa3')]){_0x49f01f=ut[_0x6db0('0xa4')](_0x2841ad,0x14,_0x6db0('0xd7'));rpcDb['createCustomerFinal'](_0x49f01f,_0x6db0('0xd8'));}else{if(_0x2841ad[_0x6db0('0xd9')]>=_0x1dbe30[_0x6db0('0xda')]){rpcDb[_0x6db0('0xa6')](_0x2841ad,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut[_0x6db0('0xc5')](_0x2841ad,_0x6db0('0xd9'),_0x1dbe30[_0x6db0('0xdb')]),_0x2841ad[_0x6db0('0xc7')],_0x2841ad[_0x6db0('0xab')]);}}break;case _0x6db0('0xdc'):_0x1dbe30[_0x6db0('0x3b')]+=0x1;_0x2841ad[_0x6db0('0xdd')]+=0x1;_0x2841ad[_0x6db0('0x9b')]=ut[_0x6db0('0xa2')](_0x2841ad);ut['logCustomer'](_0x2841ad,0xb,_0x6db0('0xde'));rpcDb['createCustomerHistory'](_0x2841ad,_0x6db0('0xdf'));if(ut[_0x6db0('0xa2')](_0x2841ad)>=_0x1dbe30['dialGlobalMaxRetry']){_0x49f01f=ut[_0x6db0('0xa4')](_0x2841ad,0xf,_0x6db0('0xa5'));rpcDb['createCustomerFinal'](_0x49f01f,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x2841ad[_0x6db0('0xe0')]>=_0x1dbe30[_0x6db0('0xe1')]){rpcDb[_0x6db0('0xa6')](_0x2841ad,_0x6db0('0xdf'));}else{rpcDb[_0x6db0('0xa9')](ut[_0x6db0('0xc5')](_0x2841ad,_0x6db0('0xdd'),_0x1dbe30[_0x6db0('0xe2')]),_0x2841ad[_0x6db0('0xc7')],_0x2841ad[_0x6db0('0xab')]);}}break;default:if(_0x2841ad[_0x6db0('0x76')]){ut[_0x6db0('0x77')](_0x1dbe30,_0x6db0('0xe3'));ut[_0x6db0('0x78')](_0x6db0('0xe4')+_0x1dbe30[_0x6db0('0x21')],_0x69ebe5);}_0x1dbe30['outboundUnknownCallsDay']+=0x1;_0x2841ad['countglobal']=ut[_0x6db0('0xa2')](_0x2841ad);ut['logCustomer'](_0x2841ad,0xc,_0x69ebe5[_0x6db0('0xe5')]||_0x69ebe5['dialstatus']);rpcDb['createCustomerHistory'](_0x2841ad,_0x6db0('0xe6'));if(ut['totalGlobal'](_0x2841ad)>=_0x1dbe30[_0x6db0('0xa3')]){_0x49f01f=ut['cloneAction'](_0x2841ad,0xf,_0x6db0('0xa5'));rpcDb[_0x6db0('0xa6')](_0x49f01f,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x6db0('0xa6')](_0x2841ad,_0x6db0('0xe7'));}delete this['actions'][_0x69ebe5[_0x6db0('0xac')]];}if(!(_0x2841ad[_0x6db0('0x76')]&&_0x499abd==='16')){ut[_0x6db0('0x74')](_0x1dbe30,'[callProgressDetectingCustomer]');logger[_0x6db0('0x54')]('[originated][decrement][callProgressDetectingCustomer]',_0x2841ad[_0x6db0('0xb1')],_0x6db0('0xb2'),_0x1dbe30[_0x6db0('0x21')],_0x6db0('0x69'),_0x1dbe30[_0x6db0('0x58')]);}if(_0x499abd!=='ANSWER'){delete this[_0x6db0('0x12')][_0x69ebe5[_0x6db0('0xac')]];delete this[_0x6db0('0x12')][_0x69ebe5[_0x6db0('0xe8')]];}}};Preview['prototype'][_0x6db0('0xe9')]=function(_0xc6b310,_0xc5218,_0x2a1e19){if(_[_0x6db0('0xea')](_0xc5218)&&_0x6db0('0xeb')!==typeof _0xc5218){return;}if(_[_0x6db0('0xea')](_0x2a1e19)&&'object'!==typeof _0x2a1e19){return;}switch(_0x2a1e19['reason']){case'0':ut[_0x6db0('0xec')](_0xc6b310,0x0,_0x6db0('0x9c'));rpcDb[_0x6db0('0xed')](_0xc6b310,_0x6db0('0xee'));break;case'3':ut[_0x6db0('0xec')](_0xc6b310,0x3,_0x6db0('0xca'));rpcDb['createAgentHistory'](_0xc6b310,_0x6db0('0xef'));break;case'5':ut[_0x6db0('0xec')](_0xc6b310,0x5,_0x6db0('0xc2'));rpcDb[_0x6db0('0xed')](_0xc6b310,_0x6db0('0xf0'));break;case'8':ut[_0x6db0('0xec')](_0xc6b310,0x8,_0x6db0('0xf1'));rpcDb[_0x6db0('0xed')](_0xc6b310,_0x6db0('0xf2'));break;case'22':ut[_0x6db0('0xec')](_0xc6b310,0x16,_0x6db0('0xf3'));rpcDb['createAgentHistory'](_0xc6b310,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0xc6b310,0xc,_0x2a1e19[_0x6db0('0xf4')]);rpcDb[_0x6db0('0xed')](_0xc6b310,_0x6db0('0xf2'));}ut[_0x6db0('0x74')](_0xc5218,_0x6db0('0xf5'));logger[_0x6db0('0x54')](_0x6db0('0xf6'),_0xc6b310[_0x6db0('0xb1')],'\x20Queue',_0xc5218[_0x6db0('0x21')],_0x6db0('0x69'),_0xc5218[_0x6db0('0x58')]);delete this[_0x6db0('0x12')][_0xc6b310['uniqueid']];};Preview[_0x6db0('0x5d')][_0x6db0('0xf7')]=function(_0x3ae62b,_0x39eef1,_0x1de1a0,_0x2bba17,_0x3adeb9){var _0x521a86=this;return new BPromise(function(_0x1427bc,_0x3b30b9){if(_['isNil'](_0x39eef1)||_[_0x6db0('0x80')](_0x39eef1[_0x6db0('0xf8')])||_['isNil'](_0x39eef1[_0x6db0('0xf8')][_0x6db0('0xf9')])||_[_0x6db0('0x80')](_0x39eef1[_0x6db0('0x6e')])){_0x3b30b9(ut[_0x6db0('0x45')](_0x6db0('0xfa'),_0x2bba17,_0x3adeb9));return;}var _0x30f6db=uuid['v4']();var _0x50b3f9=_0x521a86[_0x6db0('0x10')][_0x39eef1[_0x6db0('0xfb')][_0x6db0('0x21')]];var _0x385cc6=_0x1de1a0?_0x521a86['agents'][_0x1de1a0]['id']:undefined;_0x521a86[_0x6db0('0x12')][_0x30f6db]=new Action(_0x39eef1,_0x50b3f9,_0x30f6db,_0x1de1a0,_0x385cc6);var _0x5eaf4d=_0x521a86['actions'][_0x30f6db];_0x5eaf4d[_0x6db0('0xc7')]=_0x2bba17;_0x5eaf4d[_0x6db0('0xab')]=_0x3adeb9;_0x5eaf4d['lookAgent']=_0x1de1a0;if(_[_0x6db0('0xfc')](_0x3ae62b)){_0x521a86['execCall'](_0x5eaf4d,_0x50b3f9,_0x39eef1,_0x1de1a0)[_0x6db0('0x7f')](function(_0x2e482e){logger['info'](_0x6db0('0xfd'),_0x6db0('0xfe')+_0x5eaf4d[_0x6db0('0x68')]+_0x6db0('0xff')+_0x5eaf4d[_0x6db0('0x100')],JSON['stringify'](_0x2e482e));ami[_0x6db0('0x9d')](_0x6db0('0x101'),ut[_0x6db0('0x9f')](_0x5eaf4d,_0x6db0('0x102')));_0x1427bc(ut[_0x6db0('0x45')](_0x6db0('0x103')));})['catch'](function(_0x3e64d6){ut['logger'](_0x6db0('0x104'),_0x3e64d6);_0x3b30b9(ut[_0x6db0('0x45')](_0x6db0('0x105'),_0x2bba17,_0x3adeb9));});}else{_0x50b3f9[_0x6db0('0x106')]+=0x1;ut['logBlacklist'](_0x5eaf4d);rpcDb[_0x6db0('0x107')](_0x5eaf4d,_0x6db0('0x108'));delete _0x521a86[_0x6db0('0x12')][_0x30f6db];_0x3b30b9(ut['message'](_0x6db0('0x109'),_0x2bba17,_0x3adeb9));}});};Preview['prototype'][_0x6db0('0x97')]=function(_0x3788c2){return!_[_0x6db0('0x80')](_0x3788c2)&&!_[_0x6db0('0x80')](_0x3788c2[_0x6db0('0x21')])&&!_[_0x6db0('0x80')](_0x3788c2['active'])&&_0x3788c2[_0x6db0('0x4d')]&&!_[_0x6db0('0x80')](this[_0x6db0('0x11')][util['format'](_0x6db0('0x10a'),_0x3788c2[_0x6db0('0x21')])])&&!_[_0x6db0('0x80')](this[_0x6db0('0x11')][util[_0x6db0('0x52')](_0x6db0('0x10a'),_0x3788c2[_0x6db0('0x21')])]['status'])&&(this['trunks'][util[_0x6db0('0x52')](_0x6db0('0x10a'),_0x3788c2[_0x6db0('0x21')])][_0x6db0('0x70')]===_0x6db0('0x10b')||this[_0x6db0('0x11')][util[_0x6db0('0x52')](_0x6db0('0x10a'),_0x3788c2['name'])][_0x6db0('0x70')]===_0x6db0('0x10c'));};Preview['prototype'][_0x6db0('0x85')]=function(_0x37fc62,_0x38ff85){var _0x3b2459=this;return new BPromise(function(_0x509b41,_0xa3942d){_0x3b2459[_0x6db0('0x10d')](_0x37fc62,_0x38ff85)[_0x6db0('0x7f')](function(_0x255ebf){_0x509b41(_[_0x6db0('0x6b')](_0x255ebf,[_0x6db0('0x45')]));})[_0x6db0('0x72')](function(_0x3eb068){if(_0x3eb068['unlock']){rpcDb[_0x6db0('0x10e')](_0x37fc62);}if(_0x3eb068[_0x6db0('0x4d')]){rpcDb[_0x6db0('0x10f')](_0x37fc62);}_0xa3942d(_['pick'](_0x3eb068,[_0x6db0('0x45')]));});});};Preview[_0x6db0('0x5d')][_0x6db0('0x10d')]=function(_0x1259ec,_0x38a82d){var _0x4d007d=this;return new BPromise(function(_0x15132e,_0x2c565c){var _0x17d05f,_0x5b2c56;rpcDb[_0x6db0('0x110')](_0x1259ec)[_0x6db0('0x7f')](function(_0x10567a){if(!_[_0x6db0('0x80')](_0x10567a[0x0])){_0x5b2c56=_0x10567a[0x0][_0x6db0('0x111')]?![]:!![];_0x17d05f=_0x10567a[0x0][_0x6db0('0x111')]?!![]:![];_0x17d05f=_0x38a82d?!![]:_0x17d05f;}var _0x363091=_0x4d007d[_0x6db0('0x112')](_0x10567a);if(_0x363091['isValid']){rpcDb[_0x6db0('0x113')](_[_0x6db0('0x6b')](_0x10567a[0x0],[_0x6db0('0x6e'),_0x6db0('0x114')]))['then'](function(_0x586fb3){_0x4d007d[_0x6db0('0xf7')](_0x586fb3,_0x10567a[0x0],_0x38a82d,_0x5b2c56,_0x17d05f)['then'](function(_0x2742ae){_0x15132e(_0x2742ae);})['catch'](function(_0x283172){_0x2c565c(_0x283172);});})[_0x6db0('0x72')](function(_0x28b911){ut[_0x6db0('0x5a')](_0x6db0('0x115'),_0x28b911);_0x2c565c(ut[_0x6db0('0x45')](_0x6db0('0x116'),_0x5b2c56,_0x17d05f));});}else{_0x2c565c(ut[_0x6db0('0x45')](_0x363091['message'],_0x5b2c56,_0x17d05f));}})[_0x6db0('0x72')](function(_0xdbce3){ut[_0x6db0('0x5a')](_0x6db0('0x117'),_0xdbce3);_0x2c565c(ut['message'](_0x6db0('0x116'),![],!![]));});});};Preview[_0x6db0('0x5d')][_0x6db0('0x112')]=function(_0x4c2cb6){if(_['isNil'](_0x4c2cb6)||_[_0x6db0('0xfc')](_0x4c2cb6)||!_['isNil'](_0x4c2cb6[0x0][_0x6db0('0x83')])&&_[_0x6db0('0x80')](_0x4c2cb6[0x0][_0x6db0('0x83')][_0x6db0('0x21')])){ut[_0x6db0('0x5a')](_0x6db0('0x118'),_0x4c2cb6);return{'isValid':![],'message':_0x6db0('0x119')};}var _0x279fd1=this[_0x6db0('0x10')][_0x4c2cb6[0x0][_0x6db0('0xfb')][_0x6db0('0x21')]];_0x279fd1[_0x6db0('0x45')]=_0x6db0('0x11a');if(_[_0x6db0('0x80')](_0x279fd1)){ut[_0x6db0('0x5a')](_0x6db0('0x11b'),_0x279fd1);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x6db0('0x97')](_0x279fd1[_0x6db0('0x4c')])){ut['logger'](_0x6db0('0x11c'),_0x6db0('0x11d')+_0x279fd1[_0x6db0('0x21')]+_0x6db0('0x11e'));if(!this[_0x6db0('0x97')](_0x279fd1[_0x6db0('0x11f')])){ut[_0x6db0('0x5a')](_0x6db0('0x11c'),_0x279fd1['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x6db0('0x120')};}}if(!ut[_0x6db0('0x95')](_0x279fd1[_0x6db0('0x2d')])){ut['logger'](_0x6db0('0x121'),_0x279fd1['name']+_0x6db0('0x122'));return{'isValid':![],'message':_0x6db0('0x11d')+_0x279fd1[_0x6db0('0x21')]+_0x6db0('0x122')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x6db0('0x5d')][_0x6db0('0x123')]=function(_0x43ecd5,_0x38f185,_0x3e501b,_0x4718e0){var _0x2a00fa=this;return new BPromise(function(_0x47849a,_0x368d50){var _0x1b45b4=_0x43ecd5[_0x6db0('0xb1')];var _0x1426d7=_0x2a00fa[_0x6db0('0x97')](_0x38f185[_0x6db0('0x4c')])?util[_0x6db0('0x52')](_0x6db0('0x124'),_0x38f185['Trunk'][_0x6db0('0x21')],_[_0x6db0('0x80')](_0x38f185[_0x6db0('0x31')])?'':_0x38f185[_0x6db0('0x31')]['trim']()||'',_0x38f185[_0x6db0('0x125')]>0x0?_0x3e501b[_0x6db0('0xf8')][_0x6db0('0xf9')][_0x6db0('0x126')](_0x38f185[_0x6db0('0x125')]):_0x3e501b[_0x6db0('0xf8')]['phone']):util[_0x6db0('0x52')](_0x6db0('0x124'),_[_0x6db0('0x80')](_0x38f185[_0x6db0('0x11f')])?_0x38f185[_0x6db0('0x4c')][_0x6db0('0x21')]:_0x38f185[_0x6db0('0x11f')][_0x6db0('0x21')],_['isNil'](_0x38f185[_0x6db0('0x31')])?'':_0x38f185[_0x6db0('0x31')][_0x6db0('0x127')]()||'',_0x38f185[_0x6db0('0x125')]>0x0?_0x3e501b[_0x6db0('0xf8')][_0x6db0('0xf9')][_0x6db0('0x126')](_0x38f185[_0x6db0('0x125')]):_0x3e501b['Contact'][_0x6db0('0xf9')]);var _0x7bc1ba=_0x2a00fa[_0x6db0('0x97')](_0x38f185['Trunk'])?ut[_0x6db0('0x128')](_0x38f185['Trunk'][_0x6db0('0x4e')],_0x38f185[_0x6db0('0x2f')],_0x38f185[_0x6db0('0x129')]>0x0?ut[_0x6db0('0x12a')](_0x38f185[_0x6db0('0x12b')],_0x38f185[_0x6db0('0x129')]):_0x38f185[_0x6db0('0x12b')]):ut['getCallerId'](_['isNil'](_0x38f185[_0x6db0('0x11f')])?_0x38f185[_0x6db0('0x4c')][_0x6db0('0x4e')]:_0x38f185[_0x6db0('0x11f')]['callerid'],_0x38f185[_0x6db0('0x2f')],_0x38f185[_0x6db0('0x129')]>0x0?ut[_0x6db0('0x12a')](_0x38f185[_0x6db0('0x12b')],_0x38f185[_0x6db0('0x129')]):_0x38f185['dialOriginateCallerIdNumber']);if(_0x7bc1ba){_0x43ecd5[_0x6db0('0x12c')]=ut['extractCalleridName'](_0x7bc1ba);_0x43ecd5[_0x6db0('0x12d')]=ut[_0x6db0('0x12e')](_0x7bc1ba);}var _0x143283=ut[_0x6db0('0x12f')](_0x38f185,_0x3e501b,_0x1426d7,_0x7bc1ba,_0x1b45b4,_0x43ecd5);_[_0x6db0('0x130')](_0x43ecd5,ut[_0x6db0('0x131')](_0x143283));_0x43ecd5[_0x6db0('0x88')]=moment()[_0x6db0('0x52')](_0x6db0('0xae'));ami['Action'](ut['variablesAction'](_0x43ecd5,_0x38f185,_0x143283,_0x43ecd5[_0x6db0('0xab')],_0x4718e0))['then'](function(_0x4873d2){_0x38f185[_0x6db0('0x58')]+=0x1;logger['info'](_0x6db0('0x132'),_0x1b45b4,_0x6db0('0xb2'),_0x38f185['name'],_0x6db0('0x69'),_0x38f185['originated']);_0x47849a(_0x4873d2);})[_0x6db0('0x72')](function(_0x1ab08f){ut[_0x6db0('0xec')](_0x43ecd5,0xe,_0x6db0('0x133'));rpcDb['createAgentHistory'](_0x43ecd5,_0x6db0('0x134'));_0x368d50(_0x1ab08f);});});};Preview[_0x6db0('0x5d')]['syncNewExten']=function(_0x11f6d3){if(this['actions'][_0x11f6d3['linkedid']]){this[_0x6db0('0x12')][_0x11f6d3[_0x6db0('0xac')]][_0x6db0('0x71')]=_0x11f6d3['channel'];}};Preview[_0x6db0('0x5d')][_0x6db0('0x135')]=function(_0x19cdfe){var _0x13606a=this;var _0x141bdb=this['actions'][_0x19cdfe['actionid']];if(_0x141bdb){if(_0x141bdb[_0x6db0('0x136')]&&this[_0x6db0('0x13')][_0x141bdb[_0x6db0('0x136')]]){ut['logLookAgent'](_0x141bdb,this[_0x6db0('0x13')][_0x141bdb[_0x6db0('0x136')]][_0x6db0('0x21')],this[_0x6db0('0x13')][_0x141bdb['lookAgent']]['id']);}var _0x3e1a66=_['clone'](_0x141bdb);_0x3e1a66['responsetime']=moment()[_0x6db0('0x52')](_0x6db0('0xae'));var _0x40c260=_0x13606a[_0x6db0('0x10')][_0x141bdb[_0x6db0('0x68')]];if(ut[_0x6db0('0x137')](_0x19cdfe['response'])){if(_0x141bdb[_0x6db0('0xc7')]){rpcDb[_0x6db0('0x10e')](_0x141bdb[_0x6db0('0x100')]);}if(_0x141bdb[_0x6db0('0xab')]){rpcDb[_0x6db0('0x10f')](_0x141bdb[_0x6db0('0x100')]);}ami[_0x6db0('0x9d')]('custom:agentringnoanswer',ut[_0x6db0('0x9f')](_0x141bdb,_0x6db0('0x138')));this[_0x6db0('0xe9')](_0x3e1a66,_0x40c260,_0x19cdfe);}else{_0x141bdb[_0x6db0('0x88')]=moment()['format'](_0x6db0('0xae'));ut[_0x6db0('0xec')](_0x3e1a66,0x4,_0x6db0('0x139'));rpcDb[_0x6db0('0xed')](_0x3e1a66,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x6db0('0x5d')][_0x6db0('0x13a')]=function(_0x2cf37a){var _0x53a2c9=this;var _0x371978=this[_0x6db0('0x12')][_0x2cf37a['linkedid']];var _0x3a665b;if(_0x371978){_0x3a665b=this[_0x6db0('0x10')][_0x371978[_0x6db0('0x68')]];logger[_0x6db0('0x54')](_0x6db0('0x13b'),_0x2cf37a[_0x6db0('0xac')],_0x6db0('0xb2'),_0x3a665b[_0x6db0('0x21')],'pTalking:\x20',_0x3a665b['pTalking']);}if(this['actions'][_0x2cf37a['linkedid']]&&_0x2cf37a[_0x6db0('0xac')]!==_0x2cf37a[_0x6db0('0xb1')]){if(_0x2cf37a['cause']==='16'&&this[_0x6db0('0x12')][_0x2cf37a['linkedid']][_0x6db0('0x76')]){this['callProgressDetectingCustomer'](_0x2cf37a,_0x2cf37a[_0x6db0('0xac')],_0x2cf37a[_0x6db0('0x13c')]);}else if(this[_0x6db0('0x12')][_0x2cf37a['linkedid']][_0x6db0('0x76')]){logger[_0x6db0('0x54')](_0x6db0('0x13d'),_0x2cf37a[_0x6db0('0xac')],_0x2cf37a[_0x6db0('0x13c')],'\x20Queue',_0x3a665b[_0x6db0('0x21')],_0x6db0('0x6a'),_0x3a665b[_0x6db0('0x25')]);this['callProgressDetectingCustomer'](_0x2cf37a,_0x2cf37a[_0x6db0('0xac')],_0x2cf37a[_0x6db0('0x13c')]);}}else if(_0x371978&&_[_0x6db0('0x80')](_0x371978[_0x6db0('0x13e')])&&_0x3a665b[_0x6db0('0x13f')]&&_0x2cf37a[_0x6db0('0xac')]===_0x2cf37a[_0x6db0('0xb1')]&&_[_0x6db0('0x80')](_0x2cf37a[_0x6db0('0xf4')])&&_0x2cf37a[_0x6db0('0x13c')]==='16'&&_0x2cf37a[_0x6db0('0x140')]==='6'&&_[_0x6db0('0xea')](_0x371978[_0x6db0('0x141')])){if(_0x371978[_0x6db0('0xc7')]){rpcDb[_0x6db0('0x10e')](_0x371978[_0x6db0('0x100')]);}if(_0x371978['activeContact']){rpcDb[_0x6db0('0x10f')](_0x371978[_0x6db0('0x100')]);}_0x2cf37a[_0x6db0('0xf4')]='22';this[_0x6db0('0xe9')](_0x371978,_0x3a665b,_0x2cf37a);}else if(_0x371978&&_0x371978['transfer']){if(_0x2cf37a['cause']==='16'&&this['actions'][_0x2cf37a[_0x6db0('0xac')]]['dialAnswer']){logger['info'](_0x6db0('0x142'),_0x2cf37a[_0x6db0('0xac')],_0x2cf37a[_0x6db0('0x13c')],'\x20Queue',_0x3a665b[_0x6db0('0x21')],_0x6db0('0x6a'),_0x3a665b[_0x6db0('0x25')]);this['callProgressDetectingCustomer'](_0x2cf37a,_0x2cf37a[_0x6db0('0xac')],_0x2cf37a[_0x6db0('0x13c')]);}else if(this[_0x6db0('0x12')][_0x2cf37a[_0x6db0('0xac')]][_0x6db0('0x76')]){logger[_0x6db0('0x54')](_0x6db0('0x13d'),_0x2cf37a[_0x6db0('0xac')],_0x2cf37a[_0x6db0('0x13c')],_0x6db0('0xb2'),_0x3a665b[_0x6db0('0x21')],_0x6db0('0x6a'),_0x3a665b[_0x6db0('0x25')]);this[_0x6db0('0x99')](_0x2cf37a,_0x2cf37a[_0x6db0('0xac')],_0x2cf37a[_0x6db0('0x13c')]);}}};Preview[_0x6db0('0x5d')][_0x6db0('0x143')]=function(_0x54bbfe){if(this[_0x6db0('0x12')][_0x54bbfe[_0x6db0('0xe8')]]&&_0x54bbfe[_0x6db0('0xe8')]!==_0x54bbfe[_0x6db0('0x144')]){this[_0x6db0('0x99')](_0x54bbfe,_0x54bbfe[_0x6db0('0xe8')],_0x54bbfe[_0x6db0('0x145')]);}};Preview[_0x6db0('0x5d')][_0x6db0('0x18')]=function(_0x14daa4){if(this[_0x6db0('0x12')][_0x14daa4['linkedid']]&&_0x14daa4[_0x6db0('0xac')]!==_0x14daa4['uniqueid']&&!this[_0x6db0('0x12')][_0x14daa4[_0x6db0('0xac')]][_0x6db0('0x76')]){if(_0x14daa4['cause']==='1'){this[_0x6db0('0x99')](_0x14daa4,_0x14daa4[_0x6db0('0xac')],_0x14daa4['cause']);}}};Preview[_0x6db0('0x5d')][_0x6db0('0x146')]=function(_0x363869,_0x2705e3,_0x140e72){if(this[_0x6db0('0x12')][_0x363869]){if(_['isNil'](this[_0x6db0('0x12')][_0x363869][_0x6db0('0x147')])){this[_0x6db0('0x12')][_0x363869]['variables']={};}this['actions'][_0x363869][_0x6db0('0x147')][_0x2705e3]=_0x140e72;}};Preview['prototype'][_0x6db0('0x1c')]=function(_0x96343f){try{if(!_[_0x6db0('0x80')](_0x96343f)){if(ut['filterKey'](_[_0x6db0('0x148')](_0x96343f[_0x6db0('0x149')])[0x0])){this[_0x6db0('0x146')](_0x96343f[_0x6db0('0xb1')],_[_0x6db0('0x148')](_0x96343f['variable'])[0x0],_0x96343f['value']);}}}catch(_0x3a2072){logger[_0x6db0('0x14a')](_0x6db0('0x14b'),util[_0x6db0('0x14c')](_0x3a2072,{'showHidden':![],'depth':null}));}};Preview[_0x6db0('0x5d')][_0x6db0('0x1d')]=function(_0x5e01b2){if(_0x5e01b2){if(this[_0x6db0('0x12')][_0x5e01b2[_0x6db0('0x14d')]]){this[_0x6db0('0x12')][_0x5e01b2[_0x6db0('0x14d')]][_0x6db0('0x141')]=!![];}}};Preview['prototype'][_0x6db0('0x14e')]=function(_0x570070){if(_0x570070){if(this[_0x6db0('0x12')][_0x570070[_0x6db0('0x14f')]]){this[_0x6db0('0x12')][_0x570070[_0x6db0('0x14f')]][_0x6db0('0x141')]=!![];}}};module[_0x6db0('0x150')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 4afa2d2..14a0602 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 _0xc978=['checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','context','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20'];(function(_0x4ada02,_0x206e9a){var _0x1449ae=function(_0x389ebb){while(--_0x389ebb){_0x4ada02['push'](_0x4ada02['shift']());}};_0x1449ae(++_0x206e9a);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x8c97('0x0'));var BPromise=require(_0x8c97('0x1'));var logger=require(_0x8c97('0x2'))(_0x8c97('0x3'));var _=require(_0x8c97('0x4'));var cmHopper=require(_0x8c97('0x5'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x8c97('0x6'));var cmHopperBlack=require(_0x8c97('0x7'));var voiceQueueRt=require(_0x8c97('0x8'));var agentReportPreview=require(_0x8c97('0x9'));var voiceQueueReport=require(_0x8c97('0xa'));function loggerCatch(_0x2a9434){return function(_0xabd146){logger['error'](_0x2a9434,util[_0x8c97('0xb')](_0xabd146,{'showHidden':![],'depth':null}));};}function create(_0x1b5864){return BPromise[_0x8c97('0xc')]()[_0x8c97('0xd')](cmHopperHistory[_0x8c97('0xe')](_0x1b5864))[_0x8c97('0xf')](loggerCatch(_0x8c97('0x10')));}function createAgent(_0x4f2d78){return BPromise[_0x8c97('0xc')]()[_0x8c97('0xd')](agentReportPreview[_0x8c97('0xe')](_0x4f2d78))[_0x8c97('0xf')](loggerCatch(_0x8c97('0x10')));}function moveContact(_0x949a83){return BPromise[_0x8c97('0xc')]()[_0x8c97('0xd')](cmHopper[_0x8c97('0x11')](_0x949a83,!![]))['catch'](loggerCatch(_0x8c97('0x12')));}exports[_0x8c97('0x13')]=function(_0x4ffa19){return BPromise[_0x8c97('0xc')]()[_0x8c97('0xd')](cmHopperBlack['checkIsBlackList'](_0x4ffa19))[_0x8c97('0xf')](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0x57902c){return BPromise[_0x8c97('0xc')]()[_0x8c97('0xd')](cmHopper[_0x8c97('0x14')](_0x57902c))[_0x8c97('0xf')](loggerCatch(_0x8c97('0x15')));};exports[_0x8c97('0xe')]=function(_0x1ea67f,_0xe3be1){create(_0x1ea67f)[_0x8c97('0xf')](loggerCatch(_0xe3be1));moveContact(_0x1ea67f)['catch'](loggerCatch(_0xe3be1));};exports[_0x8c97('0x16')]=function(_0x3f7ac7,_0x18cffa){createAgent(_0x3f7ac7)[_0x8c97('0xf')](loggerCatch(_0x18cffa));};exports[_0x8c97('0x17')]=function(_0x1445db,_0xb502e7){create(_0x1445db)[_0x8c97('0xf')](loggerCatch(_0xb502e7));};exports[_0x8c97('0x18')]=function(_0x18e6fc,_0x3bb0fa){moveContact(_0x18e6fc)[_0x8c97('0xf')](loggerCatch(_0x3bb0fa));};exports[_0x8c97('0x19')]=function(_0x16e3c4,_0x3ea5a3,_0x2b83a8){if(_0x3ea5a3){_0x16e3c4['UserId']=null;}if(_0x2b83a8){_0x16e3c4[_0x8c97('0x1a')]=![];}return BPromise[_0x8c97('0xc')]()[_0x8c97('0xd')](cmHopper['rescheduleContact'](_0x16e3c4))['catch'](loggerCatch(_0x8c97('0x1b')));};exports['countReScheduled']=function(_0x41d276){return BPromise[_0x8c97('0xc')]()[_0x8c97('0xd')](cmHopper[_0x8c97('0x1c')](_0x41d276))[_0x8c97('0xf')](loggerCatch(_0x8c97('0x1d')));};exports[_0x8c97('0x1e')]=function(_0x5132c5){return BPromise['resolve']()[_0x8c97('0xd')](cmHopper[_0x8c97('0x1e')]({'UserId':null},_0x5132c5,0x1))[_0x8c97('0xf')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x25ef83){return BPromise[_0x8c97('0xc')]()[_0x8c97('0xd')](cmHopper[_0x8c97('0x1e')]({'active':![]},_0x25ef83,0x1))[_0x8c97('0xf')](loggerCatch(_0x8c97('0x1f')));};exports['crateCustomerReportQueue']=function(_0x443dfd){var _0x509520={};_0x509520[_0x8c97('0x20')]=_0x443dfd['type'];_0x509520[_0x8c97('0x21')]=_0x443dfd[_0x8c97('0x21')];_0x509520['calleridnum']=_0x443dfd[_0x8c97('0x22')];_0x509520['calleridname']=_0x443dfd[_0x8c97('0x23')];_0x509520[_0x8c97('0x24')]=_0x443dfd[_0x8c97('0x24')];_0x509520[_0x8c97('0x25')]=_0x443dfd[_0x8c97('0x26')];_0x509520[_0x8c97('0x27')]=_0x443dfd['answertime'];_0x509520['queuecallercomplete']=0x1;_0x509520[_0x8c97('0x28')]=_0x443dfd[_0x8c97('0x29')];_0x509520[_0x8c97('0x2a')]=_0x443dfd['membername'];_0x509520[_0x8c97('0x2b')]='from-sip';_0x509520['exten']=_0x8c97('0x2c');_0x509520[_0x8c97('0x2d')]=0x0;_0x509520[_0x8c97('0x2e')]=0x1;_0x509520[_0x8c97('0x2f')]=_0x443dfd[_0x8c97('0x30')];_0x509520[_0x8c97('0x31')]='COMPLETED';return BPromise[_0x8c97('0xc')]()[_0x8c97('0xd')](voiceQueueReport[_0x8c97('0x32')](_0x509520))[_0x8c97('0xf')](loggerCatch(_0x8c97('0x33')));};exports[_0x8c97('0x34')]=function(_0x157c7b,_0x20c33c){return BPromise['resolve']()[_0x8c97('0xd')](cmHopper[_0x8c97('0x34')](_0x157c7b,_0x20c33c))[_0x8c97('0xf')](loggerCatch(_0x8c97('0x35')));};exports[_0x8c97('0x36')]=function(_0x1166f1){return BPromise['resolve']()[_0x8c97('0xd')](cmHopper[_0x8c97('0x19')](_0x1166f1,!![],!![]))[_0x8c97('0xf')](loggerCatch(_0x8c97('0x37')));}; \ No newline at end of file +var _0x6b8f=['queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','endtime','connectedlinename','membername','context','exten','xcally-motion-preview','holdtime','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','preview','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','[createHistory]\x20','resolve','then','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname'];(function(_0x225a6d,_0x3b1dfb){var _0x1725ec=function(_0x19a593){while(--_0x19a593){_0x225a6d['push'](_0x225a6d['shift']());}};_0x1725ec(++_0x3b1dfb);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x3d5137,_0x2aa113){_0x3d5137=_0x3d5137-0x0;var _0x19516d=_0x6b8f[_0x3d5137];return _0x19516d;};'use strict';var util=require('util');var BPromise=require(_0xf6b8('0x0'));var logger=require('../../../config/logger')(_0xf6b8('0x1'));var _=require('lodash');var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xf6b8('0x2'));var cmHopperHistory=require(_0xf6b8('0x3'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xf6b8('0x4'));var agentReportPreview=require(_0xf6b8('0x5'));var voiceQueueReport=require(_0xf6b8('0x6'));function loggerCatch(_0x549eac){return function(_0x2d035e){logger[_0xf6b8('0x7')](_0x549eac,util[_0xf6b8('0x8')](_0x2d035e,{'showHidden':![],'depth':null}));};}function create(_0x3c3430){return BPromise['resolve']()['then'](cmHopperHistory[_0xf6b8('0x9')](_0x3c3430))['catch'](loggerCatch(_0xf6b8('0xa')));}function createAgent(_0x7ac5fd){return BPromise[_0xf6b8('0xb')]()[_0xf6b8('0xc')](agentReportPreview[_0xf6b8('0x9')](_0x7ac5fd))[_0xf6b8('0xd')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x481679){return BPromise['resolve']()[_0xf6b8('0xc')](cmHopper[_0xf6b8('0xe')](_0x481679,!![]))[_0xf6b8('0xd')](loggerCatch(_0xf6b8('0xf')));}exports['checkIsBlackList']=function(_0x4e5235){return BPromise[_0xf6b8('0xb')]()[_0xf6b8('0xc')](cmHopperBlack['checkIsBlackList'](_0x4e5235))[_0xf6b8('0xd')](loggerCatch(_0xf6b8('0x10')));};exports[_0xf6b8('0x11')]=function(_0x59bfed){return BPromise[_0xf6b8('0xb')]()['then'](cmHopper[_0xf6b8('0x11')](_0x59bfed))[_0xf6b8('0xd')](loggerCatch(_0xf6b8('0x12')));};exports[_0xf6b8('0x9')]=function(_0x12f9a8,_0x567b58){create(_0x12f9a8)['catch'](loggerCatch(_0x567b58));moveContact(_0x12f9a8)[_0xf6b8('0xd')](loggerCatch(_0x567b58));};exports['createAgentHistory']=function(_0x3cf63c,_0x206a84){createAgent(_0x3cf63c)['catch'](loggerCatch(_0x206a84));};exports['createCustomerHistory']=function(_0x1d0ee9,_0x2e2b29){create(_0x1d0ee9)[_0xf6b8('0xd')](loggerCatch(_0x2e2b29));};exports[_0xf6b8('0x13')]=function(_0x4df5f4,_0x59f9df){moveContact(_0x4df5f4)['catch'](loggerCatch(_0x59f9df));};exports[_0xf6b8('0x14')]=function(_0x2a8195,_0x99d51,_0x56b48a){if(_0x99d51){_0x2a8195[_0xf6b8('0x15')]=null;}if(_0x56b48a){_0x2a8195[_0xf6b8('0x16')]=![];}return BPromise[_0xf6b8('0xb')]()[_0xf6b8('0xc')](cmHopper['rescheduleContact'](_0x2a8195))[_0xf6b8('0xd')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xf6b8('0x17')]=function(_0x2b5bd3){return BPromise[_0xf6b8('0xb')]()[_0xf6b8('0xc')](cmHopper[_0xf6b8('0x17')](_0x2b5bd3))[_0xf6b8('0xd')](loggerCatch('[countReScheduled]\x20'));};exports[_0xf6b8('0x18')]=function(_0x1ebfea){return BPromise['resolve']()[_0xf6b8('0xc')](cmHopper[_0xf6b8('0x18')]({'UserId':null},_0x1ebfea,0x1))[_0xf6b8('0xd')](loggerCatch(_0xf6b8('0x19')));};exports[_0xf6b8('0x1a')]=function(_0x573ad8){return BPromise['resolve']()[_0xf6b8('0xc')](cmHopper[_0xf6b8('0x18')]({'active':![]},_0x573ad8,0x1))['catch'](loggerCatch(_0xf6b8('0x1b')));};exports[_0xf6b8('0x1c')]=function(_0x888319){var _0x5a7f55={};_0x5a7f55[_0xf6b8('0x1d')]=_0x888319[_0xf6b8('0x1d')];_0x5a7f55['uniqueid']=_0x888319[_0xf6b8('0x1e')];_0x5a7f55[_0xf6b8('0x1f')]=_0x888319[_0xf6b8('0x1f')];_0x5a7f55[_0xf6b8('0x20')]=_0x888319['calleridname'];_0x5a7f55[_0xf6b8('0x21')]=_0x888319[_0xf6b8('0x21')];_0x5a7f55[_0xf6b8('0x22')]=_0x888319['answertime'];_0x5a7f55[_0xf6b8('0x23')]=_0x888319[_0xf6b8('0x24')];_0x5a7f55[_0xf6b8('0x25')]=0x1;_0x5a7f55['queuecallercompleteAt']=_0x888319[_0xf6b8('0x26')];_0x5a7f55[_0xf6b8('0x27')]=_0x888319[_0xf6b8('0x28')];_0x5a7f55[_0xf6b8('0x29')]='from-sip';_0x5a7f55[_0xf6b8('0x2a')]=_0xf6b8('0x2b');_0x5a7f55[_0xf6b8('0x2c')]=0x0;_0x5a7f55['assigned']=0x1;_0x5a7f55['lastAssignedTo']=_0x888319[_0xf6b8('0x28')];_0x5a7f55[_0xf6b8('0x2d')]=_0xf6b8('0x2e');return BPromise[_0xf6b8('0xb')]()[_0xf6b8('0xc')](voiceQueueReport[_0xf6b8('0x2f')](_0x5a7f55))[_0xf6b8('0xd')](loggerCatch(_0xf6b8('0x30')));};exports[_0xf6b8('0x31')]=function(_0x3b9493,_0x3a45e4){return BPromise[_0xf6b8('0xb')]()[_0xf6b8('0xc')](cmHopper[_0xf6b8('0x31')](_0x3b9493,_0x3a45e4))[_0xf6b8('0xd')](loggerCatch(_0xf6b8('0x32')));};exports[_0xf6b8('0x33')]=function(_0x132f2b){return BPromise['resolve']()['then'](cmHopper[_0xf6b8('0x14')](_0x132f2b,!![],!![]))[_0xf6b8('0xd')](loggerCatch(_0xf6b8('0x34')));}; \ 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 d7ff29e..05cad8c 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 _0xee2c=['active','scheduledat','minutes','ContactId','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','buildAcw','interface','agentReadyId','not_inuse','status','reachable','push','getDiff','createBody','CampaignId','idContact','type','campaigntype','dialAnswer','membername','countbusyretry','callbackuniqueid','UserId','xmd-voicequeueid','xmd-queue','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','match','extractCalleridNumber','util','moment','../../../../config/logger','preview','env','milliseconds','diff','seconds','error','inspect','logger','info','logger2','getCallerId','isUndefined','string','isEmpty','format','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','Contact','hasOwnProperty','tags','createdAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','endtime','state','responsetime','logLookAgent','logCustomer','ringtime','answertime','isFailure','Failure','variablesAction','calleridname','BOOKED','uniqueid','originate','channelAgent','\x22%s\x22\x20<%s>','xcally-motion-preview','from-sip','timeout','totalGlobal','countcongestionretry','countnosuchnumberretry','cloneAction','clone','scheduledAt'];(function(_0x4bb21c,_0x368fc7){var _0x2c154a=function(_0x2dd3fc){while(--_0x2dd3fc){_0x4bb21c['push'](_0x4bb21c['shift']());}};_0x2c154a(++_0x368fc7);}(_0xee2c,0x1c7));var _0xcee2=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xee2c[_0x45d3f0];return _0x314b79;};'use strict';var util=require(_0xcee2('0x0'));var _=require('lodash');var moment=require(_0xcee2('0x1'));var logger=require(_0xcee2('0x2'))(_0xcee2('0x3'));var ipAgi=process[_0xcee2('0x4')]['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0xc9b213,_0xb70cd1){var _0x49d04d=moment(_0xc9b213)[_0xcee2('0x5')](0x0);var _0x409944=moment(_0xb70cd1)[_0xcee2('0x5')](0x0);return _0x49d04d[_0xcee2('0x6')](_0x409944,_0xcee2('0x7'));}exports['loggerCatch']=function(_0x52a4ac){return function(_0xea6c3c){logger[_0xcee2('0x8')](_0x52a4ac,util[_0xcee2('0x9')](_0xea6c3c,{'showHidden':![],'depth':null}));};};exports[_0xcee2('0xa')]=function(_0x436ab6,_0x18286c){logger[_0xcee2('0xb')](_0x436ab6,util[_0xcee2('0x9')](_0x18286c,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0xca2c64,_0x214e78){logger[_0xcee2('0x8')](_0xca2c64,util[_0xcee2('0x9')](_0x214e78,{'showHidden':![],'depth':null}));};exports[_0xcee2('0xc')]=function(_0x4b97dd){return function(_0x25d11e){logger['info'](_0x4b97dd,util['inspect'](_0x25d11e,{'showHidden':![],'depth':null}));};};exports['message']=function(_0xfa663a,_0x34cc92,_0x2afc56){return{'message':_0xfa663a,'unlock':_0x34cc92,'active':_0x2afc56};};exports[_0xcee2('0xd')]=function(_0x54a718,_0x1cf4bb,_0x818e13){if(!_[_0xcee2('0xe')](_0x818e13)&&_0xcee2('0xf')===typeof _0x818e13&&!_[_0xcee2('0x10')](_0x818e13)){if(!_[_0xcee2('0xe')](_0x1cf4bb)&&_0xcee2('0xf')===typeof _0x1cf4bb&&!_[_0xcee2('0x10')](_0x1cf4bb)){return util[_0xcee2('0x11')]('\x22%s\x22\x20<%s>',_0x1cf4bb,_0x818e13);}return util[_0xcee2('0x11')]('\x22%s\x22\x20<%s>',_0x818e13,_0x818e13);}if(!_[_0xcee2('0xe')](_0x54a718)&&_0xcee2('0xf')===typeof _0x54a718&&!_[_0xcee2('0x10')](_0x54a718)){return _0x54a718;}return _0xcee2('0x12');};exports['isActive']=function(_0x245811){if(_[_0xcee2('0x13')](_0x245811)){return![];}return _0x245811;};exports[_0xcee2('0x14')]=function(_0x36af7f,_0x3395b1,_0x223f98,_0x42e222,_0x198500,_0x34f480){var _0x148023={'XMD-QUEUE':_0x3395b1[_0xcee2('0x15')]?_0x3395b1['Queue'][_0xcee2('0x16')]:'','XMD-CALLERID':_0x42e222,'XMD-CALLERID-PREVIEW':_0x34f480?util[_0xcee2('0x11')]('\x22%s\x22\x20<%s>',_0x34f480['calleridname'],_0x34f480[_0xcee2('0x17')]):_0x42e222,'XMD-DIALID':_0x198500,'XMD-CONTACTID':_0x3395b1['ContactId'],'XMD-CDRTYPE':_0xcee2('0x18'),'CALLERID(all)':_0x42e222,'XMD-VOICEQUEUEID':_0x3395b1[_0xcee2('0x19')],'XMD-DIALCHANNEL':_0x223f98,'XMD-DIALTIMEOUT':_0x36af7f[_0xcee2('0x1a')]||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0x36af7f[_0xcee2('0x1b')]?'g':'',_[_0xcee2('0x10')](_0x36af7f[_0xcee2('0x1c')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x36af7f[_0xcee2('0x1d')]||'','XMD-AGI':_0x36af7f['dialQueueProject']?util[_0xcee2('0x11')](_0xcee2('0x1e'),ipAgi,_0x36af7f[_0xcee2('0x1f')]):_0xcee2('0x20'),'XMD-AGIAFTER':_0x36af7f[_0xcee2('0x1b')]?util[_0xcee2('0x11')](_0xcee2('0x1e'),ipAgi,_0x36af7f[_0xcee2('0x1b')]):_0xcee2('0x20'),'XMD-ORIGINATECALLERIDNUM':_0x34f480?_0x34f480[_0xcee2('0x21')]:'','XMD-ORIGINATECALLERIDNAME':_0x34f480?_0x34f480[_0xcee2('0x22')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0xcee2('0x10')](_0x36af7f[_0xcee2('0x1c')])){_0x148023[util[_0xcee2('0x11')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x36af7f[_0xcee2('0x1c')];_0x148023[util[_0xcee2('0x11')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x198500;}if(_0x3395b1&&_0x3395b1[_0xcee2('0x23')]){for(var _0x25ead9 in _0x3395b1['Contact']){if(_0x3395b1['Contact'][_0xcee2('0x24')](_0x25ead9)){if(!_['isNil'](_0x3395b1['Contact'][_0x25ead9])&&_0x25ead9!=='id'&&_0x25ead9!==_0xcee2('0x25')&&_0x25ead9!==_0xcee2('0x26')&&_0x25ead9!=='updatedAt'){_0x148023[util[_0xcee2('0x11')](_0xcee2('0x27'),_0xcee2('0x28'),_[_0xcee2('0x29')](_0x25ead9))]=_0x3395b1[_0xcee2('0x23')][_0x25ead9];}}}}return _0x148023;};exports[_0xcee2('0x2a')]=function(_0x3f727d){var _0x1a67d6={};for(var _0x1713ef in _0x3f727d){if(_0x3f727d[_0xcee2('0x24')](_0x1713ef)){_0x1a67d6[util[_0xcee2('0x11')]('%s',_[_0xcee2('0x2b')](_0x1713ef))]=_0x3f727d[_0x1713ef];}}return{'variables':_0x1a67d6};};exports['updateOriginated']=function(_0x4775ba,_0x349a2f){if(!_['isNil'](_0x4775ba)){if(_0x4775ba[_0xcee2('0x24')](_0xcee2('0x2c'))){if(_0x4775ba['originated']>0x0){_0x4775ba[_0xcee2('0x2c')]-=0x1;}else{logger[_0xcee2('0x8')](_0xcee2('0x2d'),_0x349a2f);}}}else{logger['error'](_0xcee2('0x2e'),_0x349a2f);}};exports[_0xcee2('0x2f')]=function(_0x475153){var _0x46e0cb=moment()[_0xcee2('0x11')](_0xcee2('0x30'));_0x475153['state']=0xd;_0x475153[_0xcee2('0x31')]=_0xcee2('0x32');_0x475153[_0xcee2('0x33')]=_0x46e0cb;_0x475153['responsetime']=_0x46e0cb;_0x475153[_0xcee2('0x34')]=_0x46e0cb;};exports['logAgent']=function(_0x594eab,_0x42c307,_0x20e3ed){var _0x16ae5c=moment()[_0xcee2('0x11')](_0xcee2('0x30'));_0x594eab[_0xcee2('0x35')]=_0x42c307;_0x594eab['statedesc']=_0x20e3ed;_0x594eab['responsetime']=_0x16ae5c;_0x594eab['ringtime']=getSeconds(_0x594eab[_0xcee2('0x36')],_0x594eab['starttime']);};exports[_0xcee2('0x37')]=function(_0x157220,_0x5ad17c,_0x15e2ab){_0x157220['membername']=_0x5ad17c;_0x157220['UserId']=_0x15e2ab;};exports[_0xcee2('0x38')]=function(_0x46880b,_0x5be207,_0x480e54){var _0x208139=moment()[_0xcee2('0x11')](_0xcee2('0x30'));_0x46880b[_0xcee2('0x35')]=_0x5be207;_0x46880b[_0xcee2('0x31')]=_0x480e54;_0x46880b[_0xcee2('0x36')]=_0x46880b[_0xcee2('0x36')]?_0x46880b[_0xcee2('0x36')]:_0x208139;_0x46880b[_0xcee2('0x34')]=_0x46880b['endtime']?_0x46880b[_0xcee2('0x34')]:_0x208139;_0x46880b[_0xcee2('0x39')]=getSeconds(_0x46880b[_0xcee2('0x36')]||0x0,_0x46880b[_0xcee2('0x33')]||0x0);_0x46880b['talktime']=_0x46880b[_0xcee2('0x3a')]?getSeconds(_0x46880b[_0xcee2('0x34')],_0x46880b[_0xcee2('0x3a')]):0x0;};exports[_0xcee2('0x3b')]=function(_0x8746a6){return _0x8746a6===_0xcee2('0x3c');};exports[_0xcee2('0x3d')]=function(_0x3f6705,_0x441dc2,_0x560e4f,_0x2c0009,_0x2a3d98){var _0x1a6ff7=_0x2c0009?'RECALL':_0x3f6705[_0xcee2('0x3e')];_0x1a6ff7=_0x2a3d98?_0xcee2('0x3f'):_0x1a6ff7;return{'actionid':_0x3f6705[_0xcee2('0x40')],'action':_0xcee2('0x41'),'channel':_0x3f6705[_0xcee2('0x42')],'callerid':util[_0xcee2('0x11')](_0xcee2('0x43'),_0x1a6ff7,_0x3f6705[_0xcee2('0x17')]),'Exten':_0xcee2('0x44'),'Context':_0xcee2('0x45'),'Priority':'1','variable':_0x560e4f,'timeout':(_0x441dc2[_0xcee2('0x46')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3f6705[_0xcee2('0x40')]};};exports[_0xcee2('0x47')]=function(_0xa98bc1){return _0xa98bc1['countbusyretry']+_0xa98bc1[_0xcee2('0x48')]+_0xa98bc1['countnoanswerretry']+_0xa98bc1['countagentrejectretry']+_0xa98bc1[_0xcee2('0x49')];};exports[_0xcee2('0x4a')]=function(_0x1b0fd4){var _0x1f8b75=_[_0xcee2('0x4b')](_0x1b0fd4);_0x1f8b75['state']=0xf;_0x1f8b75[_0xcee2('0x31')]='Global';return _0x1f8b75;};exports[_0xcee2('0x4c')]=function(_0x209877,_0x465e9a,_0x3dc102){var _0x3bea82={};_0x3bea82[_0x465e9a]=_0x209877[_0x465e9a];_0x3bea82[_0xcee2('0x4d')]=![];_0x3bea82[_0xcee2('0x4e')]=moment()['add'](_0x3dc102,_0xcee2('0x4f'))[_0xcee2('0x11')](_0xcee2('0x30'));_0x3bea82[_0xcee2('0x50')]=_0x209877[_0xcee2('0x50')];_0x3bea82[_0xcee2('0x51')]=_0x209877[_0xcee2('0x51')];_0x3bea82[_0xcee2('0x19')]=_0x209877[_0xcee2('0x19')]||undefined;return _0x3bea82;};exports['decrementTalkink']=function(_0x5d05c8,_0xabc3d7){if(!_[_0xcee2('0x13')](_0x5d05c8)){if(_0x5d05c8['pTalking']>0x0){_0x5d05c8[_0xcee2('0x52')]-=0x1;}else{logger[_0xcee2('0x8')](_0xabc3d7,_0xcee2('0x53'));}}else{logger[_0xcee2('0x8')](_0xabc3d7,_0xcee2('0x54'));}};exports[_0xcee2('0x55')]=function(_0x2ce4bd){if(_0x2ce4bd<=0x0){return!![];}return![];};exports['buildObj']=function(_0x5a2b58,_0x48cd5a){_0x5a2b58[_0xcee2('0x56')]=_0x48cd5a;_0x5a2b58[_0xcee2('0x16')]=_0x5a2b58[_0xcee2('0x57')];_0x5a2b58['interface']=_0x5a2b58[_0xcee2('0x42')];return _0x5a2b58;};exports[_0xcee2('0x58')]=function(_0x2f24d2){var _0x5d701b={};_0x5d701b[_0xcee2('0x57')]=_0x2f24d2[_0xcee2('0x57')];_0x5d701b[_0xcee2('0x59')]=_0x2f24d2['channelAgent'];_0x5d701b[_0xcee2('0x40')]=_0x2f24d2[_0xcee2('0x40')];return _0x5d701b;};exports[_0xcee2('0x5a')]=function(_0x1c10c0){var _0x52f582=[];for(var _0x4f5052 in _0x1c10c0){if(_0x1c10c0['hasOwnProperty'](_0x4f5052)){if(!_[_0xcee2('0x13')](_0x1c10c0[_0x4f5052])&&_0x1c10c0[_0x4f5052][_0xcee2('0x35')]===_0xcee2('0x5b')&&_0x1c10c0[_0x4f5052][_0xcee2('0x5c')]===_0xcee2('0x5d')){_0x52f582[_0xcee2('0x5e')](_0x1c10c0[_0x4f5052]['id']);}}}return _0x52f582;};exports[_0xcee2('0x5f')]=function(_0x4c9a97){var _0x3ca032=moment()[_0xcee2('0x5')](0x0);var _0x3f4a06=moment(_0x4c9a97)['milliseconds'](0x0);return _0x3ca032[_0xcee2('0x6')](_0x3f4a06,_0xcee2('0x7'));};exports[_0xcee2('0x60')]=function(_0x1bb852){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1bb852[_0xcee2('0x50')],'ListId':_0x1bb852[_0xcee2('0x51')],'VoiceQueueId':_0x1bb852[_0xcee2('0x19')]||undefined,'CampaignId':_0x1bb852[_0xcee2('0x61')]||undefined};};exports['filterKey']=function(_0x32c7ee){if(_0x32c7ee===_0xcee2('0x40')||_0x32c7ee===_0xcee2('0x62')||_0x32c7ee===_0xcee2('0x57')||_0x32c7ee===_0xcee2('0x63')||_0x32c7ee===_0xcee2('0x64')||_0x32c7ee===_0xcee2('0x65')||_0x32c7ee===_0xcee2('0x66')||_0x32c7ee===_0xcee2('0x42')||_0x32c7ee===_0xcee2('0x3e')||_0x32c7ee==='active'||_0x32c7ee==='calleridnum'||_0x32c7ee===_0xcee2('0x4e')||_0x32c7ee===_0xcee2('0x67')||_0x32c7ee===_0xcee2('0x48')||_0x32c7ee==='countnoanswerretry'||_0x32c7ee==='countglobal'||_0x32c7ee==='callback'||_0x32c7ee===_0xcee2('0x68')||_0x32c7ee==='callbackat'||_0x32c7ee==='recallme'||_0x32c7ee===_0xcee2('0x50')||_0x32c7ee==='ListId'||_0x32c7ee===_0xcee2('0x69')||_0x32c7ee===_0xcee2('0x19')||_0x32c7ee==='sipcallid'||_0x32c7ee===_0xcee2('0x6a')||_0x32c7ee===_0xcee2('0x6b')||_0x32c7ee==='xmd-phone'||_0x32c7ee==='xmd-listid'||_0x32c7ee===_0xcee2('0x6c')||_0x32c7ee===_0xcee2('0x6d')||_0x32c7ee===_0xcee2('0x6e')||_0x32c7ee===_0xcee2('0x6f')||_0x32c7ee===_0xcee2('0x70')||_0x32c7ee==='xmd-contactid'||_0x32c7ee===_0xcee2('0x71')||_0x32c7ee===_0xcee2('0x72')||_0x32c7ee===_0xcee2('0x73')||_0x32c7ee===_0xcee2('0x74')||_0x32c7ee===_0xcee2('0x75')||_0x32c7ee===_0xcee2('0x76')||_0x32c7ee===_0xcee2('0x77')||_0x32c7ee===_0xcee2('0x78')||_0x32c7ee===_0xcee2('0x79')||_0x32c7ee===_0xcee2('0x7a')||_0x32c7ee===_0xcee2('0x7b')||_0x32c7ee===_0xcee2('0x7c')||_0x32c7ee==='rtpaudioqos'||_0x32c7ee===_0xcee2('0x76')||_0x32c7ee===_0xcee2('0x77')||_0x32c7ee===_0xcee2('0x78')||_0x32c7ee==='rtpaudioqosloss'||_0x32c7ee==='rtpaudioqoslossbridged'||_0x32c7ee===_0xcee2('0x7b')||_0x32c7ee===_0xcee2('0x7c')||_0x32c7ee===_0xcee2('0x7d')||_0x32c7ee===_0xcee2('0x7e')||_0x32c7ee==='state'||_0x32c7ee==='statedesc'){return![];}return!![];};exports[_0xcee2('0x7f')]=function(_0x458d75,_0x81f30a){var _0x3bdd96,_0xe75e6e,_0x5f5dc5;if(_0x81f30a<=0x0){_0x81f30a=0x1;}_0x3bdd96=new RegExp('\x5cw{0,'+_0x81f30a+'}$');_0xe75e6e=Math[_0xcee2('0x80')](0xa,_0x81f30a-0x1);_0x5f5dc5=Math[_0xcee2('0x80')](0xa,_0x81f30a)-0x1;return util[_0xcee2('0x11')]('%s',_[_0xcee2('0x81')](_0x458d75,_0x3bdd96,_[_0xcee2('0x82')](_0xe75e6e,_0x5f5dc5)));};exports['extractCalleridName']=function(_0x3796cf){var _0x546ad3=_0x3796cf[_0xcee2('0x83')](/"(.*?)"/);return _0x546ad3?_0x546ad3[0x1]:_0x3796cf;};exports[_0xcee2('0x84')]=function(_0x2c9497){var _0x3f11e2=_0x2c9497['match'](/<(.*?)>/);return _0x3f11e2?_0x3f11e2[0x1]:_0x2c9497;}; \ No newline at end of file +var _0x731b=['dialQueueProject','\x22agi://%s/square,%s\x22','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','XMD-','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','responsetime','endtime','logAgent','ringtime','starttime','logLookAgent','membername','UserId','logCustomer','statedesc','answertime','isFailure','Failure','variablesAction','RECALL','calleridname','BOOKED','uniqueid','originate','channelAgent','calleridnum','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','clone','Global','active','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','name','interface','buildAcw','queue','agentReadyId','not_inuse','status','getDiff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','callback','callbackuniqueid','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','format','\x22%s\x22\x20<%s>','isEmpty','\x22\x22\x20<>','isActive','isNil','Queue','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl'];(function(_0x57fa7e,_0xd0b5ce){var _0x320671=function(_0x3392cc){while(--_0x3392cc){_0x57fa7e['push'](_0x57fa7e['shift']());}};_0x320671(++_0xd0b5ce);}(_0x731b,0xf7));var _0xb731=function(_0x324cc4,_0x559b39){_0x324cc4=_0x324cc4-0x0;var _0x3ff315=_0x731b[_0x324cc4];return _0x3ff315;};'use strict';var util=require(_0xb731('0x0'));var _=require(_0xb731('0x1'));var moment=require('moment');var logger=require(_0xb731('0x2'))(_0xb731('0x3'));var ipAgi=process[_0xb731('0x4')][_0xb731('0x5')]||_0xb731('0x6');function getSeconds(_0x367672,_0x4fb2b7){var _0x25e03a=moment(_0x367672)[_0xb731('0x7')](0x0);var _0x40b673=moment(_0x4fb2b7)[_0xb731('0x7')](0x0);return _0x25e03a[_0xb731('0x8')](_0x40b673,_0xb731('0x9'));}exports[_0xb731('0xa')]=function(_0x58b83c){return function(_0x2ab04b){logger[_0xb731('0xb')](_0x58b83c,util[_0xb731('0xc')](_0x2ab04b,{'showHidden':![],'depth':null}));};};exports[_0xb731('0xd')]=function(_0x410999,_0x2f9d04){logger[_0xb731('0xe')](_0x410999,util[_0xb731('0xc')](_0x2f9d04,{'showHidden':![],'depth':null}));};exports[_0xb731('0xf')]=function(_0x2bb336,_0x131d88){logger[_0xb731('0xb')](_0x2bb336,util[_0xb731('0xc')](_0x131d88,{'showHidden':![],'depth':null}));};exports[_0xb731('0x10')]=function(_0xc002e7){return function(_0x5899e0){logger[_0xb731('0xe')](_0xc002e7,util['inspect'](_0x5899e0,{'showHidden':![],'depth':null}));};};exports[_0xb731('0x11')]=function(_0x1b670e,_0x31fba7,_0x5b668d){return{'message':_0x1b670e,'unlock':_0x31fba7,'active':_0x5b668d};};exports[_0xb731('0x12')]=function(_0x4b433a,_0x524c0d,_0x579641){if(!_[_0xb731('0x13')](_0x579641)&&_0xb731('0x14')===typeof _0x579641&&!_['isEmpty'](_0x579641)){if(!_[_0xb731('0x13')](_0x524c0d)&&_0xb731('0x14')===typeof _0x524c0d&&!_['isEmpty'](_0x524c0d)){return util[_0xb731('0x15')](_0xb731('0x16'),_0x524c0d,_0x579641);}return util[_0xb731('0x15')](_0xb731('0x16'),_0x579641,_0x579641);}if(!_[_0xb731('0x13')](_0x4b433a)&&_0xb731('0x14')===typeof _0x4b433a&&!_[_0xb731('0x17')](_0x4b433a)){return _0x4b433a;}return _0xb731('0x18');};exports[_0xb731('0x19')]=function(_0x48f4bc){if(_[_0xb731('0x1a')](_0x48f4bc)){return![];}return _0x48f4bc;};exports['addVariables']=function(_0x4b4cb4,_0x21870e,_0x537556,_0x396997,_0x1b47cb,_0x474f0c){var _0x36374e={'XMD-QUEUE':_0x21870e[_0xb731('0x1b')]?_0x21870e['Queue']['name']:'','XMD-CALLERID':_0x396997,'XMD-CALLERID-PREVIEW':_0x474f0c?util[_0xb731('0x15')](_0xb731('0x16'),_0x474f0c['calleridname'],_0x474f0c['calleridnum']):_0x396997,'XMD-DIALID':_0x1b47cb,'XMD-CONTACTID':_0x21870e[_0xb731('0x1c')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x396997,'XMD-VOICEQUEUEID':_0x21870e[_0xb731('0x1d')],'XMD-DIALCHANNEL':_0x537556,'XMD-DIALTIMEOUT':_0x4b4cb4[_0xb731('0x1e')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0xb731('0x1f'),_0x4b4cb4[_0xb731('0x20')]?'g':'',_[_0xb731('0x17')](_0x4b4cb4[_0xb731('0x21')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x4b4cb4[_0xb731('0x22')]||'','XMD-AGI':_0x4b4cb4[_0xb731('0x23')]?util[_0xb731('0x15')](_0xb731('0x24'),ipAgi,_0x4b4cb4[_0xb731('0x23')]):'NONE','XMD-AGIAFTER':_0x4b4cb4['dialQueueProject2']?util[_0xb731('0x15')](_0xb731('0x24'),ipAgi,_0x4b4cb4['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x474f0c?_0x474f0c[_0xb731('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x474f0c?_0x474f0c['originatecalleridname']:'','XMD-DESTINATION':_0xb731('0x26')};if(!_['isEmpty'](_0x4b4cb4[_0xb731('0x21')])){_0x36374e[util[_0xb731('0x15')]('%s',_0xb731('0x27'))]=_0x4b4cb4[_0xb731('0x21')];_0x36374e[util[_0xb731('0x15')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x1b47cb;}if(_0x21870e&&_0x21870e['Contact']){for(var _0x5edd1f in _0x21870e[_0xb731('0x28')]){if(_0x21870e[_0xb731('0x28')][_0xb731('0x29')](_0x5edd1f)){if(!_['isNil'](_0x21870e[_0xb731('0x28')][_0x5edd1f])&&_0x5edd1f!=='id'&&_0x5edd1f!=='tags'&&_0x5edd1f!==_0xb731('0x2a')&&_0x5edd1f!==_0xb731('0x2b')){_0x36374e[util['format'](_0xb731('0x2c'),_0xb731('0x2d'),_['toUpper'](_0x5edd1f))]=_0x21870e[_0xb731('0x28')][_0x5edd1f];}}}}return _0x36374e;};exports[_0xb731('0x2e')]=function(_0x3e1249){var _0x3a5054={};for(var _0xd47c2c in _0x3e1249){if(_0x3e1249[_0xb731('0x29')](_0xd47c2c)){_0x3a5054[util[_0xb731('0x15')]('%s',_['toLower'](_0xd47c2c))]=_0x3e1249[_0xd47c2c];}}return{'variables':_0x3a5054};};exports[_0xb731('0x2f')]=function(_0x1883e0,_0x215c64){if(!_[_0xb731('0x1a')](_0x1883e0)){if(_0x1883e0[_0xb731('0x29')](_0xb731('0x30'))){if(_0x1883e0[_0xb731('0x30')]>0x0){_0x1883e0[_0xb731('0x30')]-=0x1;}else{logger[_0xb731('0xb')](_0xb731('0x31'),_0x215c64);}}}else{logger[_0xb731('0xb')](_0xb731('0x32'),_0x215c64);}};exports[_0xb731('0x33')]=function(_0x3ccde2){var _0x6d1c8b=moment()[_0xb731('0x15')](_0xb731('0x34'));_0x3ccde2[_0xb731('0x35')]=0xd;_0x3ccde2['statedesc']=_0xb731('0x36');_0x3ccde2['starttime']=_0x6d1c8b;_0x3ccde2[_0xb731('0x37')]=_0x6d1c8b;_0x3ccde2[_0xb731('0x38')]=_0x6d1c8b;};exports[_0xb731('0x39')]=function(_0x576a37,_0x5a5e28,_0x293b06){var _0x296a56=moment()[_0xb731('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x576a37['state']=_0x5a5e28;_0x576a37['statedesc']=_0x293b06;_0x576a37[_0xb731('0x37')]=_0x296a56;_0x576a37[_0xb731('0x3a')]=getSeconds(_0x576a37[_0xb731('0x37')],_0x576a37[_0xb731('0x3b')]);};exports[_0xb731('0x3c')]=function(_0x186c72,_0x41a709,_0x321441){_0x186c72[_0xb731('0x3d')]=_0x41a709;_0x186c72[_0xb731('0x3e')]=_0x321441;};exports[_0xb731('0x3f')]=function(_0xed1e94,_0x1b7936,_0xf28c96){var _0x381496=moment()[_0xb731('0x15')](_0xb731('0x34'));_0xed1e94[_0xb731('0x35')]=_0x1b7936;_0xed1e94[_0xb731('0x40')]=_0xf28c96;_0xed1e94[_0xb731('0x37')]=_0xed1e94[_0xb731('0x37')]?_0xed1e94[_0xb731('0x37')]:_0x381496;_0xed1e94[_0xb731('0x38')]=_0xed1e94['endtime']?_0xed1e94[_0xb731('0x38')]:_0x381496;_0xed1e94[_0xb731('0x3a')]=getSeconds(_0xed1e94[_0xb731('0x37')]||0x0,_0xed1e94[_0xb731('0x3b')]||0x0);_0xed1e94['talktime']=_0xed1e94['answertime']?getSeconds(_0xed1e94[_0xb731('0x38')],_0xed1e94[_0xb731('0x41')]):0x0;};exports[_0xb731('0x42')]=function(_0x829f78){return _0x829f78===_0xb731('0x43');};exports[_0xb731('0x44')]=function(_0x411370,_0x573941,_0x3d4909,_0x3a4edf,_0x1eb1b1){var _0x4f80ff=_0x3a4edf?_0xb731('0x45'):_0x411370[_0xb731('0x46')];_0x4f80ff=_0x1eb1b1?_0xb731('0x47'):_0x4f80ff;return{'actionid':_0x411370[_0xb731('0x48')],'action':_0xb731('0x49'),'channel':_0x411370[_0xb731('0x4a')],'callerid':util[_0xb731('0x15')](_0xb731('0x16'),_0x4f80ff,_0x411370[_0xb731('0x4b')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x3d4909,'timeout':(_0x573941[_0xb731('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x411370[_0xb731('0x48')]};};exports[_0xb731('0x4d')]=function(_0x39aece){return _0x39aece[_0xb731('0x4e')]+_0x39aece[_0xb731('0x4f')]+_0x39aece[_0xb731('0x50')]+_0x39aece[_0xb731('0x51')]+_0x39aece['countnosuchnumberretry'];};exports['cloneAction']=function(_0x18fdd5){var _0x342635=_[_0xb731('0x52')](_0x18fdd5);_0x342635[_0xb731('0x35')]=0xf;_0x342635['statedesc']=_0xb731('0x53');return _0x342635;};exports['scheduledAt']=function(_0x301d34,_0x37ab96,_0x493f70){var _0x5673f9={};_0x5673f9[_0x37ab96]=_0x301d34[_0x37ab96];_0x5673f9[_0xb731('0x54')]=![];_0x5673f9['scheduledat']=moment()[_0xb731('0x55')](_0x493f70,_0xb731('0x56'))[_0xb731('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x5673f9[_0xb731('0x1c')]=_0x301d34[_0xb731('0x1c')];_0x5673f9[_0xb731('0x57')]=_0x301d34[_0xb731('0x57')];_0x5673f9[_0xb731('0x1d')]=_0x301d34['VoiceQueueId']||undefined;return _0x5673f9;};exports[_0xb731('0x58')]=function(_0x4cf35d,_0x560bfc){if(!_[_0xb731('0x1a')](_0x4cf35d)){if(_0x4cf35d[_0xb731('0x59')]>0x0){_0x4cf35d[_0xb731('0x59')]-=0x1;}else{logger[_0xb731('0xb')](_0x560bfc,_0xb731('0x5a'));}}else{logger[_0xb731('0xb')](_0x560bfc,_0xb731('0x5b'));}};exports['IsNotLoggedIn']=function(_0x433c63){if(_0x433c63<=0x0){return!![];}return![];};exports[_0xb731('0x5c')]=function(_0x1570b9,_0x4b63f8){_0x1570b9['lastevent']=_0x4b63f8;_0x1570b9[_0xb731('0x5d')]=_0x1570b9['queue'];_0x1570b9[_0xb731('0x5e')]=_0x1570b9[_0xb731('0x4a')];return _0x1570b9;};exports[_0xb731('0x5f')]=function(_0x1b82c1){var _0x58a4cc={};_0x58a4cc[_0xb731('0x60')]=_0x1b82c1['queue'];_0x58a4cc['interface']=_0x1b82c1[_0xb731('0x4a')];_0x58a4cc[_0xb731('0x48')]=_0x1b82c1[_0xb731('0x48')];return _0x58a4cc;};exports[_0xb731('0x61')]=function(_0x3d1538){var _0x198d6f=[];for(var _0x4c9f89 in _0x3d1538){if(_0x3d1538[_0xb731('0x29')](_0x4c9f89)){if(!_[_0xb731('0x1a')](_0x3d1538[_0x4c9f89])&&_0x3d1538[_0x4c9f89][_0xb731('0x35')]===_0xb731('0x62')&&_0x3d1538[_0x4c9f89][_0xb731('0x63')]==='reachable'){_0x198d6f['push'](_0x3d1538[_0x4c9f89]['id']);}}}return _0x198d6f;};exports[_0xb731('0x64')]=function(_0xa2f1c0){var _0xaab2f3=moment()[_0xb731('0x7')](0x0);var _0x14daea=moment(_0xa2f1c0)[_0xb731('0x7')](0x0);return _0xaab2f3['diff'](_0x14daea,_0xb731('0x9'));};exports[_0xb731('0x65')]=function(_0x21f044){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x21f044['ContactId'],'ListId':_0x21f044['ListId'],'VoiceQueueId':_0x21f044[_0xb731('0x1d')]||undefined,'CampaignId':_0x21f044[_0xb731('0x66')]||undefined};};exports[_0xb731('0x67')]=function(_0x120872){if(_0x120872===_0xb731('0x48')||_0x120872===_0xb731('0x68')||_0x120872==='queue'||_0x120872===_0xb731('0x69')||_0x120872===_0xb731('0x6a')||_0x120872===_0xb731('0x6b')||_0x120872===_0xb731('0x3d')||_0x120872===_0xb731('0x4a')||_0x120872===_0xb731('0x46')||_0x120872===_0xb731('0x54')||_0x120872==='calleridnum'||_0x120872==='scheduledat'||_0x120872==='countbusyretry'||_0x120872===_0xb731('0x4f')||_0x120872===_0xb731('0x50')||_0x120872==='countglobal'||_0x120872===_0xb731('0x6c')||_0x120872===_0xb731('0x6d')||_0x120872==='callbackat'||_0x120872===_0xb731('0x6e')||_0x120872===_0xb731('0x1c')||_0x120872==='ListId'||_0x120872===_0xb731('0x3e')||_0x120872===_0xb731('0x1d')||_0x120872==='sipcallid'||_0x120872===_0xb731('0x6f')||_0x120872===_0xb731('0x70')||_0x120872===_0xb731('0x71')||_0x120872==='xmd-listid'||_0x120872===_0xb731('0x72')||_0x120872===_0xb731('0x73')||_0x120872===_0xb731('0x74')||_0x120872===_0xb731('0x75')||_0x120872===_0xb731('0x76')||_0x120872==='xmd-contactid'||_0x120872===_0xb731('0x77')||_0x120872===_0xb731('0x78')||_0x120872===_0xb731('0x79')||_0x120872===_0xb731('0x7a')||_0x120872===_0xb731('0x7b')||_0x120872===_0xb731('0x7c')||_0x120872===_0xb731('0x7d')||_0x120872===_0xb731('0x7e')||_0x120872===_0xb731('0x7f')||_0x120872==='rtpaudioqoslossbridged'||_0x120872===_0xb731('0x80')||_0x120872===_0xb731('0x81')||_0x120872===_0xb731('0x7b')||_0x120872==='rtpaudioqosbridged'||_0x120872==='rtpaudioqosjitter'||_0x120872===_0xb731('0x7e')||_0x120872==='rtpaudioqosloss'||_0x120872===_0xb731('0x82')||_0x120872===_0xb731('0x80')||_0x120872===_0xb731('0x81')||_0x120872===_0xb731('0x83')||_0x120872===_0xb731('0x84')||_0x120872==='state'||_0x120872===_0xb731('0x40')){return![];}return!![];};exports[_0xb731('0x85')]=function(_0x1b6b62,_0x29f095){var _0x56af26,_0x556a1e,_0x657805;if(_0x29f095<=0x0){_0x29f095=0x1;}_0x56af26=new RegExp(_0xb731('0x86')+_0x29f095+'}$');_0x556a1e=Math[_0xb731('0x87')](0xa,_0x29f095-0x1);_0x657805=Math['pow'](0xa,_0x29f095)-0x1;return util[_0xb731('0x15')]('%s',_[_0xb731('0x88')](_0x1b6b62,_0x56af26,_[_0xb731('0x89')](_0x556a1e,_0x657805)));};exports[_0xb731('0x8a')]=function(_0x232700){var _0x583cc6=_0x232700[_0xb731('0x8b')](/"(.*?)"/);return _0x583cc6?_0x583cc6[0x1]:_0x232700;};exports[_0xb731('0x8c')]=function(_0x13e681){var _0x281938=_0x13e681[_0xb731('0x8b')](/<(.*?)>/);return _0x281938?_0x281938[0x1]:_0x13e681;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index bb45dc7..1dcb6bb 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x288bc5,_0x20dc74){var _0x4c04df=function(_0xe6ec74){while(--_0xe6ec74){_0x288bc5['push'](_0x288bc5['shift']());}};_0x4c04df(++_0x20dc74);}(_0x5f2f,0x73));var _0xf5f2=function(_0x286684,_0x59947e){_0x286684=_0x286684-0x0;var _0x5c2558=_0x5f2f[_0x286684];return _0x5c2558;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x168e3f,_0x4f71e8){var _0x11a4be=function(_0x2dc0ae){while(--_0x2dc0ae){_0x168e3f['push'](_0x168e3f['shift']());}};_0x11a4be(++_0x4f71e8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4c635a,_0x1153cb){_0x4c635a=_0x4c635a-0x0;var _0x481aa0=_0x5f2f[_0x4c635a];return _0x481aa0;};'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 8056510..799a808 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 _0x7184=['SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','exports','bluebird','util','moment','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','campaigns','templates','outbound','queueChannels','outboundChannels','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','hasOwnProperty','mapKeys','format','SIP/%s','name','interface','total','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','isEmpty','unmanaged','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isNil','isUndefined','initTelephones','initTrunks','initVoiceQueues','triggers','initZendeskAccounts','initSalesforceAccounts','freshdeskAccounts','initSugarcrmAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','answered','queuecallerleaveAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject'];(function(_0x5bf39c,_0x518ed5){var _0x249a26=function(_0x3256e0){while(--_0x3256e0){_0x5bf39c['push'](_0x5bf39c['shift']());}};_0x249a26(++_0x518ed5);}(_0x7184,0xd5));var _0x4718=function(_0xac21df,_0x4f3ba2){_0xac21df=_0xac21df-0x0;var _0x1faa60=_0x7184[_0xac21df];return _0x1faa60;};'use strict';var BPromise=require(_0x4718('0x0'));var util=require(_0x4718('0x1'));var _=require('lodash');var moment=require(_0x4718('0x2'));var Agent=require('../model/agent');var Telephone=require(_0x4718('0x3'));var Trunk=require(_0x4718('0x4'));var VoiceQueue=require(_0x4718('0x5'));var Trigger=require(_0x4718('0x6'));var Template=require(_0x4718('0x7'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x4718('0x8'));var ZendeskAccount=require(_0x4718('0x9'));var SalesforceAccount=require(_0x4718('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x4718('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x4718('0xc'));var VtigerAccount=require(_0x4718('0xd'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x4718('0xe'));var FreshsalesAccount=require(_0x4718('0xf'));var FaxAccount=require(_0x4718('0x10'));var Realtime=function(){this[_0x4718('0x11')]={};this[_0x4718('0x12')]={};this[_0x4718('0x13')]={};this[_0x4718('0x14')]={};this['triggers']={};this[_0x4718('0x15')]={};this[_0x4718('0x16')]={};this[_0x4718('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this[_0x4718('0x18')]={};this[_0x4718('0x19')]={};this['timers']={};this[_0x4718('0x1a')]={};this[_0x4718('0x1b')]={};this[_0x4718('0x1c')]={};this['freshdeskAccounts']={};this[_0x4718('0x1d')]={};this[_0x4718('0x1e')]={};this['vtigerAccounts']={};this[_0x4718('0x1f')]={};this[_0x4718('0x20')]={};this['freshsalesAccounts']={};this[_0x4718('0x21')]={};};function freeIsNotKey(_0x47e42c,_0x3516ff,_0x3c428c){var _0x3f25d5=_['mapKeys'](_0x47e42c,function(_0x136299,_0x2aaaaf){return _0x136299[_0x3c428c];});for(var _0x23385f in _0x3516ff){if(_0x3516ff[_0x4718('0x22')](_0x23385f)){if(!_0x3f25d5[_0x23385f]){delete _0x3516ff[_0x23385f];}}}}function freeIsNotKeySip(_0x3fb91d,_0x438edb){var _0x5174ce=_[_0x4718('0x23')](_0x3fb91d,function(_0x5ef5a0,_0x1ff8d0){return util[_0x4718('0x24')](_0x4718('0x25'),_0x5ef5a0[_0x4718('0x26')]);});for(var _0x31a83e in _0x438edb){if(_0x438edb[_0x4718('0x22')](_0x31a83e)){if(!_0x5174ce[_0x31a83e]){delete _0x438edb[_0x31a83e];}}}}function freeIsNotKeyAgent(_0xe50cb7,_0x3dd129){var _0x5d641=_[_0x4718('0x23')](_0xe50cb7,function(_0x172080,_0x26ab37){var _0x2ab57f=_['isNil'](_0x172080[_0x4718('0x27')])?util['format'](_0x4718('0x25'),_0x172080[_0x4718('0x26')]):_0x172080[_0x4718('0x27')];return _0x2ab57f;});for(var _0xafb8d1 in _0x3dd129){if(_0x3dd129[_0x4718('0x22')](_0xafb8d1)){if(!_0x5d641[_0xafb8d1]){delete _0x3dd129[_0xafb8d1];}}}}function clearVoiceCallReports(_0x276992){_0x276992[_0x4718('0x28')]=0x0;_0x276992['answered']=0x0;_0x276992[_0x4718('0x29')]=0x0;_0x276992[_0x4718('0x2a')]=0x0;_0x276992[_0x4718('0x2b')]=0x0;}function clearCampaigns(_0x1f9e54){if(!_['isEmpty'](_0x1f9e54)){for(var _0x47274d in _0x1f9e54){if(_0x1f9e54[_0x4718('0x22')](_0x47274d)){_0x1f9e54[_0x47274d][_0x4718('0x2c')]=0x0;_0x1f9e54[_0x47274d]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x4770f7){if(!_[_0x4718('0x2d')](_0x4770f7)){for(var _0x1f0852 in _0x4770f7){if(_0x4770f7['hasOwnProperty'](_0x1f0852)){_0x4770f7[_0x1f0852][_0x4718('0x28')]=0x0;_0x4770f7[_0x1f0852]['answered']=0x0;_0x4770f7[_0x1f0852][_0x4718('0x2e')]=0x0;_0x4770f7[_0x1f0852]['abandoned']=0x0;_0x4770f7[_0x1f0852][_0x4718('0x29')]=0x0;_0x4770f7[_0x1f0852]['sumDuration']=0x0;_0x4770f7[_0x1f0852]['sumBillable']=0x0;_0x4770f7[_0x1f0852]['outboundAnswerAgiCallsDay']=0x0;_0x4770f7[_0x1f0852][_0x4718('0x2f')]=0x0;_0x4770f7[_0x1f0852]['outboundBusyCallsDay']=0x0;_0x4770f7[_0x1f0852][_0x4718('0x30')]=0x0;_0x4770f7[_0x1f0852]['outboundNoSuchCallsDay']=0x0;_0x4770f7[_0x1f0852][_0x4718('0x31')]=0x0;_0x4770f7[_0x1f0852][_0x4718('0x32')]=0x0;_0x4770f7[_0x1f0852][_0x4718('0x33')]=0x0;_0x4770f7[_0x1f0852]['outboundBlacklistCallsDay']=0x0;_0x4770f7[_0x1f0852][_0x4718('0x34')]=0x0;_0x4770f7[_0x1f0852][_0x4718('0x35')]=0x0;_0x4770f7[_0x1f0852][_0x4718('0x36')]=0x0;_0x4770f7[_0x1f0852][_0x4718('0x37')]=0x0;_0x4770f7[_0x1f0852][_0x4718('0x38')]=0x0;_0x4770f7[_0x1f0852][_0x4718('0x39')]=!![];}}}}Realtime[_0x4718('0x3a')][_0x4718('0x3b')]=function(_0x41fe6c,_0x435cdb){for(var _0x56e21c in _0x435cdb){if(_0x41fe6c[_0x4718('0x22')](_0x56e21c)){_0x41fe6c[_0x56e21c]=_0x435cdb[_0x56e21c];}}};Realtime[_0x4718('0x3a')]['initAgents']=function(){var _0x266f2b=this;return function(_0x1ed330){if(_0x1ed330){freeIsNotKeyAgent(_0x1ed330,_0x266f2b[_0x4718('0x11')]);for(var _0x48154a=0x0,_0x59ba42={},_0x18eda0={};_0x48154a<_0x1ed330[_0x4718('0x3c')];_0x48154a+=0x1){_0x59ba42=_0x1ed330[_0x48154a];var _0x429d3c=_[_0x4718('0x3d')](_0x59ba42[_0x4718('0x27')])?util['format']('SIP/%s',_0x59ba42[_0x4718('0x26')]):_0x59ba42[_0x4718('0x27')];if(_[_0x4718('0x3e')](_0x266f2b[_0x4718('0x11')][_0x429d3c])){_0x266f2b[_0x4718('0x11')][_0x429d3c]=new Agent(_0x59ba42);}else{_0x266f2b[_0x4718('0x3b')](_0x266f2b[_0x4718('0x11')][_0x429d3c],_0x59ba42);}}}return _0x266f2b['agents'];};};Realtime['prototype'][_0x4718('0x3f')]=function(){var _0x10209a=this;return function(_0x3b1ed2){if(_0x3b1ed2){freeIsNotKeySip(_0x3b1ed2,_0x10209a[_0x4718('0x12')]);for(var _0x54bf8a=0x0,_0x46e2fc={},_0xa73f46={};_0x54bf8a<_0x3b1ed2[_0x4718('0x3c')];_0x54bf8a+=0x1){_0x46e2fc=_0x3b1ed2[_0x54bf8a];if(_[_0x4718('0x3e')](_0x10209a[_0x4718('0x12')][util[_0x4718('0x24')](_0x4718('0x25'),_0x46e2fc[_0x4718('0x26')])])){_0x10209a[_0x4718('0x12')][util[_0x4718('0x24')](_0x4718('0x25'),_0x46e2fc[_0x4718('0x26')])]=new Telephone(_0x46e2fc);}else{_0x10209a[_0x4718('0x3b')](_0x10209a[_0x4718('0x12')][util['format']('SIP/%s',_0x46e2fc[_0x4718('0x26')])],_0x46e2fc);}}}return _0x10209a[_0x4718('0x12')];};};Realtime[_0x4718('0x3a')][_0x4718('0x40')]=function(){var _0x4b451a=this;return function(_0x3af16b){if(_0x3af16b){freeIsNotKeySip(_0x3af16b,_0x4b451a['trunks']);for(var _0xa7a414=0x0,_0x919004={},_0x167658={};_0xa7a414<_0x3af16b[_0x4718('0x3c')];_0xa7a414+=0x1){_0x919004=_0x3af16b[_0xa7a414];if(_[_0x4718('0x3e')](_0x4b451a['trunks'][util[_0x4718('0x24')](_0x4718('0x25'),_0x919004[_0x4718('0x26')])])){_0x4b451a['trunks'][util['format'](_0x4718('0x25'),_0x919004['name'])]=new Trunk(_0x919004);}else{_0x4b451a[_0x4718('0x3b')](_0x4b451a['trunks'][util[_0x4718('0x24')]('SIP/%s',_0x919004['name'])],_0x919004);}}}return _0x4b451a[_0x4718('0x13')];};};Realtime[_0x4718('0x3a')][_0x4718('0x41')]=function(){var _0x53f441=this;return function(_0x1a936e){if(_0x1a936e){freeIsNotKey(_0x1a936e,_0x53f441['voiceQueues'],_0x4718('0x26'));for(var _0x2d6125=0x0,_0x91da47={},_0xaa910={};_0x2d6125<_0x1a936e['length'];_0x2d6125+=0x1){_0x91da47=_0x1a936e[_0x2d6125];if(_[_0x4718('0x3e')](_0x53f441[_0x4718('0x14')][_0x91da47['name']])){_0x53f441[_0x4718('0x14')][_0x91da47[_0x4718('0x26')]]=new VoiceQueue(_0x91da47);}else{_0x53f441[_0x4718('0x3b')](_0x53f441[_0x4718('0x14')][_0x91da47[_0x4718('0x26')]],_0x91da47);}}}return _0x53f441['voiceQueues'];};};Realtime[_0x4718('0x3a')]['initTriggers']=function(){var _0x1bde12=this;return function(_0x222d06){if(_0x222d06){freeIsNotKey(_0x222d06,_0x1bde12[_0x4718('0x42')],'id');for(var _0x25270c=0x0,_0x572ff1={},_0xf1d54d={};_0x25270c<_0x222d06[_0x4718('0x3c')];_0x25270c+=0x1){_0x572ff1=_0x222d06[_0x25270c];if(_[_0x4718('0x3e')](_0x1bde12['triggers'][_0x572ff1['id']])){_0x1bde12[_0x4718('0x42')][_0x572ff1['id']]=new Trigger(_0x572ff1);}else{_0x1bde12[_0x4718('0x3b')](_0x1bde12[_0x4718('0x42')][_0x572ff1['id']],_0x572ff1);}}}return _0x1bde12[_0x4718('0x42')];};};Realtime[_0x4718('0x3a')]['initTemplates']=function(){var _0x28c655=this;return function(_0x213526){if(_0x213526){freeIsNotKey(_0x213526,_0x28c655[_0x4718('0x16')],'id');for(var _0x4f0b62=0x0,_0x3d5a3a={},_0x515eb0={};_0x4f0b62<_0x213526[_0x4718('0x3c')];_0x4f0b62+=0x1){_0x3d5a3a=_0x213526[_0x4f0b62];if(_[_0x4718('0x3e')](_0x28c655[_0x4718('0x16')][_0x3d5a3a['id']])){_0x28c655[_0x4718('0x16')][_0x3d5a3a['id']]=new Template(_0x3d5a3a);}else{_0x28c655[_0x4718('0x3b')](_0x28c655[_0x4718('0x16')][_0x3d5a3a['id']],_0x3d5a3a);}}}return _0x28c655[_0x4718('0x16')];};};Realtime[_0x4718('0x3a')][_0x4718('0x43')]=function(){var _0x114549=this;return function(_0x35887c){if(_0x35887c){freeIsNotKey(_0x35887c,_0x114549['zendeskAccounts'],'id');for(var _0x4106a8=0x0,_0x306e89={},_0x1d3461={};_0x4106a8<_0x35887c[_0x4718('0x3c')];_0x4106a8+=0x1){_0x306e89=_0x35887c[_0x4106a8];if(_['isUndefined'](_0x114549[_0x4718('0x1a')][_0x306e89['id']])){_0x114549['zendeskAccounts'][_0x306e89['id']]=new ZendeskAccount(_0x306e89);}else{_0x114549[_0x4718('0x3b')](_0x114549[_0x4718('0x1a')][_0x306e89['id']],_0x306e89);}}}return _0x114549[_0x4718('0x1a')];};};Realtime[_0x4718('0x3a')][_0x4718('0x44')]=function(){var _0x5b7938=this;return function(_0x5d0964){if(_0x5d0964){freeIsNotKey(_0x5d0964,_0x5b7938[_0x4718('0x1b')],'id');for(var _0x36dadf=0x0,_0x1b4dd3={},_0x2a41ad={};_0x36dadf<_0x5d0964[_0x4718('0x3c')];_0x36dadf+=0x1){_0x1b4dd3=_0x5d0964[_0x36dadf];if(_[_0x4718('0x3e')](_0x5b7938['salesforceAccounts'][_0x1b4dd3['id']])){_0x5b7938['salesforceAccounts'][_0x1b4dd3['id']]=new SalesforceAccount(_0x1b4dd3);}else{_0x5b7938[_0x4718('0x3b')](_0x5b7938[_0x4718('0x1b')][_0x1b4dd3['id']],_0x1b4dd3);}}}return _0x5b7938[_0x4718('0x1b')];};};Realtime[_0x4718('0x3a')]['initFreshdeskAccounts']=function(){var _0x58c8e0=this;return function(_0x514be2){if(_0x514be2){freeIsNotKey(_0x514be2,_0x58c8e0[_0x4718('0x45')],'id');for(var _0x5491b8=0x0,_0x5cec6f={},_0x5f0ca7={};_0x5491b8<_0x514be2[_0x4718('0x3c')];_0x5491b8+=0x1){_0x5cec6f=_0x514be2[_0x5491b8];if(_[_0x4718('0x3e')](_0x58c8e0[_0x4718('0x45')][_0x5cec6f['id']])){_0x58c8e0[_0x4718('0x45')][_0x5cec6f['id']]=new FreshdeskAccount(_0x5cec6f);}else{_0x58c8e0[_0x4718('0x3b')](_0x58c8e0['freshdeskAccounts'][_0x5cec6f['id']],_0x5cec6f);}}}return _0x58c8e0[_0x4718('0x45')];};};Realtime['prototype']['initZohoAccounts']=function(){var _0x46c557=this;return function(_0x469953){if(_0x469953){freeIsNotKey(_0x469953,_0x46c557[_0x4718('0x1d')],'id');for(var _0x1ed0a5=0x0,_0x1e8ebc={},_0x2908fe={};_0x1ed0a5<_0x469953['length'];_0x1ed0a5+=0x1){_0x1e8ebc=_0x469953[_0x1ed0a5];if(_['isUndefined'](_0x46c557['zohoAccounts'][_0x1e8ebc['id']])){_0x46c557[_0x4718('0x1d')][_0x1e8ebc['id']]=new ZohoAccount(_0x1e8ebc);}else{_0x46c557['mergeFromDatabase'](_0x46c557['zohoAccounts'][_0x1e8ebc['id']],_0x1e8ebc);}}}return _0x46c557[_0x4718('0x1d')];};};Realtime[_0x4718('0x3a')]['initDeskAccounts']=function(){var _0x1a5153=this;return function(_0x433f99){if(_0x433f99){freeIsNotKey(_0x433f99,_0x1a5153['deskAccounts'],'id');for(var _0x27b2d3=0x0,_0x4feb0d={},_0x59cbed={};_0x27b2d3<_0x433f99[_0x4718('0x3c')];_0x27b2d3+=0x1){_0x4feb0d=_0x433f99[_0x27b2d3];if(_[_0x4718('0x3e')](_0x1a5153[_0x4718('0x1e')][_0x4feb0d['id']])){_0x1a5153[_0x4718('0x1e')][_0x4feb0d['id']]=new DeskAccount(_0x4feb0d);}else{_0x1a5153[_0x4718('0x3b')](_0x1a5153['deskAccounts'][_0x4feb0d['id']],_0x4feb0d);}}}return _0x1a5153[_0x4718('0x1e')];};};Realtime[_0x4718('0x3a')][_0x4718('0x46')]=function(){var _0x495a31=this;return function(_0x1df058){if(_0x1df058){freeIsNotKey(_0x1df058,_0x495a31[_0x4718('0x1c')],'id');for(var _0xe3c907=0x0,_0x4ee73b={},_0x2890e2={};_0xe3c907<_0x1df058[_0x4718('0x3c')];_0xe3c907+=0x1){_0x4ee73b=_0x1df058[_0xe3c907];if(_[_0x4718('0x3e')](_0x495a31[_0x4718('0x1c')][_0x4ee73b['id']])){_0x495a31[_0x4718('0x1c')][_0x4ee73b['id']]=new SugarcrmAccount(_0x4ee73b);}else{_0x495a31[_0x4718('0x3b')](_0x495a31['sugarcrmAccounts'][_0x4ee73b['id']],_0x4ee73b);}}}return _0x495a31[_0x4718('0x1c')];};};Realtime['prototype']['initVtigerAccounts']=function(){var _0x1c0026=this;return function(_0x12fc56){if(_0x12fc56){freeIsNotKey(_0x12fc56,_0x1c0026[_0x4718('0x47')],'id');for(var _0x57343a=0x0,_0x4563a2={},_0x1d1e37={};_0x57343a<_0x12fc56[_0x4718('0x3c')];_0x57343a+=0x1){_0x4563a2=_0x12fc56[_0x57343a];if(_[_0x4718('0x3e')](_0x1c0026['vtigerAccounts'][_0x4563a2['id']])){_0x1c0026[_0x4718('0x47')][_0x4563a2['id']]=new VtigerAccount(_0x4563a2);}else{_0x1c0026[_0x4718('0x3b')](_0x1c0026[_0x4718('0x47')][_0x4563a2['id']],_0x4563a2);}}}return _0x1c0026[_0x4718('0x47')];};};Realtime['prototype'][_0x4718('0x48')]=function(){var _0x514f6b=this;return function(_0x375871){if(_0x375871){freeIsNotKey(_0x375871,_0x514f6b['servicenowAccounts'],'id');for(var _0x5982c0=0x0,_0x17e04b={},_0x37c14d={};_0x5982c0<_0x375871[_0x4718('0x3c')];_0x5982c0+=0x1){_0x17e04b=_0x375871[_0x5982c0];if(_[_0x4718('0x3e')](_0x514f6b[_0x4718('0x1f')][_0x17e04b['id']])){_0x514f6b[_0x4718('0x1f')][_0x17e04b['id']]=new ServicenowAccount(_0x17e04b);}else{_0x514f6b[_0x4718('0x3b')](_0x514f6b[_0x4718('0x1f')][_0x17e04b['id']],_0x17e04b);}}}return _0x514f6b[_0x4718('0x1f')];};};Realtime[_0x4718('0x3a')][_0x4718('0x49')]=function(){var _0x1247d0=this;return function(_0x1bb935){if(_0x1bb935){freeIsNotKey(_0x1bb935,_0x1247d0['dynamics365Accounts'],'id');for(var _0x48c194=0x0,_0x235b42={},_0xc17e1={};_0x48c194<_0x1bb935['length'];_0x48c194+=0x1){_0x235b42=_0x1bb935[_0x48c194];if(_[_0x4718('0x3e')](_0x1247d0[_0x4718('0x20')][_0x235b42['id']])){_0x1247d0[_0x4718('0x20')][_0x235b42['id']]=new Dynamics365Account(_0x235b42);}else{_0x1247d0['mergeFromDatabase'](_0x1247d0['dynamics365Accounts'][_0x235b42['id']],_0x235b42);}}}return _0x1247d0[_0x4718('0x20')];};};Realtime[_0x4718('0x3a')][_0x4718('0x4a')]=function(){var _0x3ee3d9=this;return function(_0x54b142){if(_0x54b142){freeIsNotKey(_0x54b142,_0x3ee3d9['freshsalesAccounts'],'id');for(var _0x25cb2a=0x0,_0x4ccf51={},_0x36fc58={};_0x25cb2a<_0x54b142[_0x4718('0x3c')];_0x25cb2a+=0x1){_0x4ccf51=_0x54b142[_0x25cb2a];if(_[_0x4718('0x3e')](_0x3ee3d9['freshsalesAccounts'][_0x4ccf51['id']])){_0x3ee3d9[_0x4718('0x4b')][_0x4ccf51['id']]=new FreshsalesAccount(_0x4ccf51);}else{_0x3ee3d9[_0x4718('0x3b')](_0x3ee3d9['freshsalesAccounts'][_0x4ccf51['id']],_0x4ccf51);}}}return _0x3ee3d9[_0x4718('0x4b')];};};Realtime[_0x4718('0x3a')]['initVoiceQueueHopperHistory']=function(){var _0x56d583=this;return function(_0x2efa51){for(var _0x50a7a5=0x0;_0x50a7a5<_0x2efa51[_0x4718('0x3c')];_0x50a7a5+=0x1){_['merge'](_0x56d583['voiceQueues'][_0x2efa51[_0x50a7a5][_0x4718('0x26')]],_0x2efa51[_0x50a7a5]);}return _0x56d583['voiceQueues'];};};Realtime[_0x4718('0x3a')][_0x4718('0x4c')]=function(){var _0x31d63f=this;return function(_0x33ecde){clearVoiceQueues(_0x31d63f[_0x4718('0x14')]);if(_0x33ecde){_0x33ecde=_[_0x4718('0x4d')](_0x33ecde,_0x4718('0x4e'));for(var _0x6d7b9d in _0x33ecde){if(_0x33ecde[_0x4718('0x22')](_0x6d7b9d)){var _0x261b96={};for(var _0x1b683b=0x0;_0x1b683b<_0x33ecde[_0x6d7b9d][_0x4718('0x3c')];_0x1b683b+=0x1){var _0x26ab9f=_0x33ecde[_0x6d7b9d][_0x1b683b][_0x4718('0x4f')];if(_0x31d63f['voiceQueues'][_0x26ab9f]){if(_0x33ecde[_0x6d7b9d][_0x1b683b][_0x4718('0x50')]){_0x31d63f[_0x4718('0x14')][_0x26ab9f][_0x4718('0x2e')]+=0x1;}if(_0x33ecde[_0x6d7b9d][_0x1b683b][_0x4718('0x51')]){_0x31d63f[_0x4718('0x14')][_0x26ab9f][_0x4718('0x52')]+=0x1;}_0x31d63f['voiceQueues'][_0x26ab9f]['sumHoldTime']+=moment(_0x33ecde[_0x6d7b9d][_0x1b683b]['queuecallerleaveAt'])[_0x4718('0x53')](moment(_0x33ecde[_0x6d7b9d][_0x1b683b][_0x4718('0x54')]),_0x4718('0x55'))||0x0;if(_0x1b683b===_0x33ecde[_0x6d7b9d][_0x4718('0x3c')]-0x1){_0x31d63f[_0x4718('0x14')][_0x26ab9f]['sumDuration']+=moment(_0x33ecde[_0x6d7b9d][_0x1b683b][_0x4718('0x56')]||_0x33ecde[_0x6d7b9d][_0x1b683b][_0x4718('0x57')]||_0x33ecde[_0x6d7b9d][_0x1b683b][_0x4718('0x58')])[_0x4718('0x53')](moment(_0x33ecde[_0x6d7b9d][_0x1b683b]['queuecallerjoinAt']),_0x4718('0x55'))||0x0;_0x31d63f[_0x4718('0x14')][_0x26ab9f][_0x4718('0x28')]+=0x1;if(_0x33ecde[_0x6d7b9d][_0x1b683b][_0x4718('0x59')]){_0x31d63f[_0x4718('0x14')][_0x26ab9f][_0x4718('0x5a')]+=0x1;_0x31d63f[_0x4718('0x14')][_0x26ab9f]['sumBillable']+=moment(_0x33ecde[_0x6d7b9d][_0x1b683b][_0x4718('0x56')])[_0x4718('0x53')](moment(_0x33ecde[_0x6d7b9d][_0x1b683b][_0x4718('0x5b')]),_0x4718('0x55'))||0x0;}}else{_0x31d63f[_0x4718('0x14')][_0x26ab9f][_0x4718('0x2a')]+=_0x31d63f[_0x4718('0x14')][_0x26ab9f][_0x4718('0x29')]||0x0;}}}}}}return _0x31d63f[_0x4718('0x14')];};};Realtime['prototype'][_0x4718('0x5c')]=function(){var _0x10821=this;return function(_0x326f77){clearVoiceCallReports(_0x10821[_0x4718('0x17')]);if(_0x326f77){for(var _0x8f6e9=0x0;_0x8f6e9<_0x326f77[_0x4718('0x3c')];_0x8f6e9+=0x1){_0x10821[_0x4718('0x17')][_0x4718('0x28')]+=0x1;_0x10821[_0x4718('0x17')]['sumDuration']+=_0x326f77[_0x8f6e9][_0x4718('0x5d')];if(_0x326f77[_0x8f6e9][_0x4718('0x5e')]===_0x4718('0x5f')){_0x10821[_0x4718('0x17')][_0x4718('0x5a')]+=0x1;_0x10821[_0x4718('0x17')]['sumHoldTime']+=_0x326f77[_0x8f6e9]['duration']-_0x326f77[_0x8f6e9]['billableseconds']||0x0;_0x10821['outbound'][_0x4718('0x2b')]+=_0x326f77[_0x8f6e9][_0x4718('0x60')];}}}return _0x10821['outbound'];};};Realtime[_0x4718('0x3a')][_0x4718('0x61')]=function(){var _0x3bf25e=this;return function(_0x4ef21f){if(_0x4ef21f){freeIsNotKey(_0x4ef21f,_0x3bf25e[_0x4718('0x15')],_0x4718('0x26'));for(var _0xcf6595=0x0,_0x1baef8={};_0xcf6595<_0x4ef21f[_0x4718('0x3c')];_0xcf6595+=0x1){_0x1baef8=_0x4ef21f[_0xcf6595];if(_[_0x4718('0x3e')](_0x3bf25e[_0x4718('0x15')][_0x1baef8[_0x4718('0x26')]])){_0x3bf25e[_0x4718('0x15')][_0x1baef8['name']]=new Campaign(_0x1baef8);}else{_0x3bf25e['mergeFromDatabase'](_0x3bf25e[_0x4718('0x15')][_0x1baef8[_0x4718('0x26')]],_0x1baef8);_0x3bf25e[_0x4718('0x15')][_0x1baef8[_0x4718('0x26')]][_0x4718('0x62')]=_0x1baef8[_0x4718('0x63')]?_0x1baef8[_0x4718('0x63')][_0x4718('0x26')]:undefined;}}}return _0x3bf25e[_0x4718('0x15')];};};Realtime[_0x4718('0x3a')][_0x4718('0x64')]=function(){var _0x2ac6de=this;return function(_0x26335e){if(_0x26335e){freeIsNotKey(_0x26335e,_0x2ac6de[_0x4718('0x65')],'id');for(var _0x1e431f=0x0,_0x463bae={};_0x1e431f<_0x26335e[_0x4718('0x3c')];_0x1e431f+=0x1){_0x463bae=_0x26335e[_0x1e431f];if(_['isUndefined'](_0x2ac6de[_0x4718('0x65')][_0x463bae['id']])){_0x2ac6de[_0x4718('0x65')][_0x463bae['id']]=new VoiceExtension(_0x463bae);}else{_0x2ac6de[_0x4718('0x3b')](_0x2ac6de[_0x4718('0x65')][_0x463bae['id']],_0x463bae);}}}return _0x2ac6de[_0x4718('0x65')];};};Realtime['prototype'][_0x4718('0x66')]=function(){var _0x52176c=this;return function(_0x48444f){clearCampaigns(_0x52176c[_0x4718('0x15')]);for(var _0x388310=0x0;_0x388310<_0x48444f['length'];_0x388310+=0x1){_['merge'](_0x52176c[_0x4718('0x15')][_0x48444f[_0x388310]['name']],_0x48444f[_0x388310]);}return _0x52176c[_0x4718('0x15')];};};Realtime[_0x4718('0x3a')]['initFaxAccounts']=function(){var _0x22e133=this;return function(_0x1bf889){if(_0x1bf889){freeIsNotKey(_0x1bf889,_0x22e133[_0x4718('0x21')],'id');for(var _0x2b7429=0x0,_0x27a6a2={},_0x2774fb={};_0x2b7429<_0x1bf889[_0x4718('0x3c')];_0x2b7429+=0x1){_0x27a6a2=_0x1bf889[_0x2b7429];if(_[_0x4718('0x3e')](_0x22e133[_0x4718('0x21')][_0x27a6a2['id']])){_0x22e133[_0x4718('0x21')][_0x27a6a2['id']]=new FaxAccount(_0x27a6a2);}else{_0x22e133[_0x4718('0x3b')](_0x22e133[_0x4718('0x21')][_0x27a6a2['id']],_0x27a6a2);}}}return _0x22e133[_0x4718('0x21')];};};module[_0x4718('0x67')]=Realtime; \ No newline at end of file +var _0x2a5a=['queuecallerjoinAt','queuecallerexitAt','seconds','queuecallercomplete','queuecallercompleteAt','disposition','duration','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','bluebird','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','outbound','voiceExtensions','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','format','name','hasOwnProperty','SIP/%s','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','length','isNil','isUndefined','mergeFromDatabase','initTrunks','initVoiceQueues','initTriggers','initTemplates','templates','initZendeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','dynamics365Accounts','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff'];(function(_0x1c1888,_0x4853d0){var _0x286947=function(_0xcfb360){while(--_0xcfb360){_0x1c1888['push'](_0x1c1888['shift']());}};_0x286947(++_0x4853d0);}(_0x2a5a,0x198));var _0xa2a5=function(_0x56d115,_0x44b0ba){_0x56d115=_0x56d115-0x0;var _0x19b7a5=_0x2a5a[_0x56d115];return _0x19b7a5;};'use strict';var BPromise=require(_0xa2a5('0x0'));var util=require('util');var _=require('lodash');var moment=require('moment');var Agent=require(_0xa2a5('0x1'));var Telephone=require(_0xa2a5('0x2'));var Trunk=require(_0xa2a5('0x3'));var VoiceQueue=require(_0xa2a5('0x4'));var Trigger=require('../model/trigger');var Template=require(_0xa2a5('0x5'));var Campaign=require(_0xa2a5('0x6'));var VoiceExtension=require(_0xa2a5('0x7'));var ZendeskAccount=require(_0xa2a5('0x8'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xa2a5('0x9'));var ZohoAccount=require(_0xa2a5('0xa'));var DeskAccount=require(_0xa2a5('0xb'));var VtigerAccount=require(_0xa2a5('0xc'));var ServicenowAccount=require(_0xa2a5('0xd'));var Dynamics365Account=require(_0xa2a5('0xe'));var FreshsalesAccount=require(_0xa2a5('0xf'));var FaxAccount=require(_0xa2a5('0x10'));var Realtime=function(){this[_0xa2a5('0x11')]={};this[_0xa2a5('0x12')]={};this[_0xa2a5('0x13')]={};this[_0xa2a5('0x14')]={};this[_0xa2a5('0x15')]={};this['campaigns']={};this['templates']={};this[_0xa2a5('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xa2a5('0x17')]={};this['channels']={};this[_0xa2a5('0x18')]={};this[_0xa2a5('0x19')]={};this[_0xa2a5('0x1a')]={};this[_0xa2a5('0x1b')]={};this[_0xa2a5('0x1c')]={};this['sugarcrmAccounts']={};this[_0xa2a5('0x1d')]={};this[_0xa2a5('0x1e')]={};this[_0xa2a5('0x1f')]={};this[_0xa2a5('0x20')]={};this[_0xa2a5('0x21')]={};this['dynamics365Accounts']={};this[_0xa2a5('0x22')]={};this[_0xa2a5('0x23')]={};};function freeIsNotKey(_0x5a57cf,_0x171d63,_0x103e22){var _0x21655d=_[_0xa2a5('0x24')](_0x5a57cf,function(_0x4f3672,_0x446d75){return _0x4f3672[_0x103e22];});for(var _0x44d225 in _0x171d63){if(_0x171d63['hasOwnProperty'](_0x44d225)){if(!_0x21655d[_0x44d225]){delete _0x171d63[_0x44d225];}}}}function freeIsNotKeySip(_0x2a5af8,_0x130bae){var _0x433d06=_['mapKeys'](_0x2a5af8,function(_0x5893d7,_0x28fea3){return util[_0xa2a5('0x25')]('SIP/%s',_0x5893d7[_0xa2a5('0x26')]);});for(var _0x262c38 in _0x130bae){if(_0x130bae[_0xa2a5('0x27')](_0x262c38)){if(!_0x433d06[_0x262c38]){delete _0x130bae[_0x262c38];}}}}function freeIsNotKeyAgent(_0x24bfa9,_0x5267fe){var _0xf17cd9=_['mapKeys'](_0x24bfa9,function(_0x341001,_0x639be3){var _0x464882=_['isNil'](_0x341001['interface'])?util[_0xa2a5('0x25')](_0xa2a5('0x28'),_0x341001[_0xa2a5('0x26')]):_0x341001[_0xa2a5('0x29')];return _0x464882;});for(var _0x23d9bc in _0x5267fe){if(_0x5267fe[_0xa2a5('0x27')](_0x23d9bc)){if(!_0xf17cd9[_0x23d9bc]){delete _0x5267fe[_0x23d9bc];}}}}function clearVoiceCallReports(_0x53e760){_0x53e760[_0xa2a5('0x2a')]=0x0;_0x53e760[_0xa2a5('0x2b')]=0x0;_0x53e760[_0xa2a5('0x2c')]=0x0;_0x53e760[_0xa2a5('0x2d')]=0x0;_0x53e760[_0xa2a5('0x2e')]=0x0;}function clearCampaigns(_0x377992){if(!_[_0xa2a5('0x2f')](_0x377992)){for(var _0x4bf4fa in _0x377992){if(_0x377992[_0xa2a5('0x27')](_0x4bf4fa)){_0x377992[_0x4bf4fa]['ivrTotalCallsDays']=0x0;_0x377992[_0x4bf4fa][_0xa2a5('0x30')]=0x0;}}}}function clearVoiceQueues(_0x1422a2){if(!_['isEmpty'](_0x1422a2)){for(var _0x5e39f2 in _0x1422a2){if(_0x1422a2['hasOwnProperty'](_0x5e39f2)){_0x1422a2[_0x5e39f2][_0xa2a5('0x2a')]=0x0;_0x1422a2[_0x5e39f2][_0xa2a5('0x2b')]=0x0;_0x1422a2[_0x5e39f2][_0xa2a5('0x31')]=0x0;_0x1422a2[_0x5e39f2]['abandoned']=0x0;_0x1422a2[_0x5e39f2]['sumHoldTime']=0x0;_0x1422a2[_0x5e39f2]['sumDuration']=0x0;_0x1422a2[_0x5e39f2]['sumBillable']=0x0;_0x1422a2[_0x5e39f2][_0xa2a5('0x32')]=0x0;_0x1422a2[_0x5e39f2][_0xa2a5('0x33')]=0x0;_0x1422a2[_0x5e39f2][_0xa2a5('0x34')]=0x0;_0x1422a2[_0x5e39f2][_0xa2a5('0x35')]=0x0;_0x1422a2[_0x5e39f2][_0xa2a5('0x36')]=0x0;_0x1422a2[_0x5e39f2][_0xa2a5('0x37')]=0x0;_0x1422a2[_0x5e39f2][_0xa2a5('0x38')]=0x0;_0x1422a2[_0x5e39f2][_0xa2a5('0x39')]=0x0;_0x1422a2[_0x5e39f2][_0xa2a5('0x3a')]=0x0;_0x1422a2[_0x5e39f2]['outboundOriginateFailureCallsDay']=0x0;_0x1422a2[_0x5e39f2][_0xa2a5('0x3b')]=0x0;_0x1422a2[_0x5e39f2][_0xa2a5('0x3c')]=0x0;_0x1422a2[_0x5e39f2][_0xa2a5('0x32')]=0x0;_0x1422a2[_0x5e39f2][_0xa2a5('0x3d')]=0x0;_0x1422a2[_0x5e39f2][_0xa2a5('0x3e')]=!![];}}}}Realtime[_0xa2a5('0x3f')]['mergeFromDatabase']=function(_0x70fd0e,_0x27df00){for(var _0x41b221 in _0x27df00){if(_0x70fd0e[_0xa2a5('0x27')](_0x41b221)){_0x70fd0e[_0x41b221]=_0x27df00[_0x41b221];}}};Realtime[_0xa2a5('0x3f')]['initAgents']=function(){var _0x19ec55=this;return function(_0x1eba81){if(_0x1eba81){freeIsNotKeyAgent(_0x1eba81,_0x19ec55[_0xa2a5('0x11')]);for(var _0x58407d=0x0,_0x3f5984={},_0x397be1={};_0x58407d<_0x1eba81[_0xa2a5('0x40')];_0x58407d+=0x1){_0x3f5984=_0x1eba81[_0x58407d];var _0x228b33=_[_0xa2a5('0x41')](_0x3f5984[_0xa2a5('0x29')])?util[_0xa2a5('0x25')]('SIP/%s',_0x3f5984['name']):_0x3f5984[_0xa2a5('0x29')];if(_[_0xa2a5('0x42')](_0x19ec55[_0xa2a5('0x11')][_0x228b33])){_0x19ec55[_0xa2a5('0x11')][_0x228b33]=new Agent(_0x3f5984);}else{_0x19ec55[_0xa2a5('0x43')](_0x19ec55['agents'][_0x228b33],_0x3f5984);}}}return _0x19ec55['agents'];};};Realtime[_0xa2a5('0x3f')]['initTelephones']=function(){var _0x1035e1=this;return function(_0x2df4f1){if(_0x2df4f1){freeIsNotKeySip(_0x2df4f1,_0x1035e1[_0xa2a5('0x12')]);for(var _0x1acc81=0x0,_0x3e2643={},_0x569eaf={};_0x1acc81<_0x2df4f1[_0xa2a5('0x40')];_0x1acc81+=0x1){_0x3e2643=_0x2df4f1[_0x1acc81];if(_[_0xa2a5('0x42')](_0x1035e1['telephones'][util['format']('SIP/%s',_0x3e2643[_0xa2a5('0x26')])])){_0x1035e1['telephones'][util[_0xa2a5('0x25')]('SIP/%s',_0x3e2643[_0xa2a5('0x26')])]=new Telephone(_0x3e2643);}else{_0x1035e1[_0xa2a5('0x43')](_0x1035e1[_0xa2a5('0x12')][util[_0xa2a5('0x25')](_0xa2a5('0x28'),_0x3e2643[_0xa2a5('0x26')])],_0x3e2643);}}}return _0x1035e1[_0xa2a5('0x12')];};};Realtime['prototype'][_0xa2a5('0x44')]=function(){var _0xe5b9c2=this;return function(_0x4c7823){if(_0x4c7823){freeIsNotKeySip(_0x4c7823,_0xe5b9c2[_0xa2a5('0x13')]);for(var _0x43386d=0x0,_0x9dcf15={},_0x3418a7={};_0x43386d<_0x4c7823['length'];_0x43386d+=0x1){_0x9dcf15=_0x4c7823[_0x43386d];if(_[_0xa2a5('0x42')](_0xe5b9c2['trunks'][util[_0xa2a5('0x25')](_0xa2a5('0x28'),_0x9dcf15[_0xa2a5('0x26')])])){_0xe5b9c2['trunks'][util[_0xa2a5('0x25')]('SIP/%s',_0x9dcf15['name'])]=new Trunk(_0x9dcf15);}else{_0xe5b9c2['mergeFromDatabase'](_0xe5b9c2['trunks'][util['format'](_0xa2a5('0x28'),_0x9dcf15['name'])],_0x9dcf15);}}}return _0xe5b9c2[_0xa2a5('0x13')];};};Realtime[_0xa2a5('0x3f')][_0xa2a5('0x45')]=function(){var _0x55b8a8=this;return function(_0x44d88a){if(_0x44d88a){freeIsNotKey(_0x44d88a,_0x55b8a8['voiceQueues'],'name');for(var _0x229726=0x0,_0x57b13f={},_0x58d7d4={};_0x229726<_0x44d88a[_0xa2a5('0x40')];_0x229726+=0x1){_0x57b13f=_0x44d88a[_0x229726];if(_[_0xa2a5('0x42')](_0x55b8a8[_0xa2a5('0x14')][_0x57b13f['name']])){_0x55b8a8['voiceQueues'][_0x57b13f['name']]=new VoiceQueue(_0x57b13f);}else{_0x55b8a8[_0xa2a5('0x43')](_0x55b8a8[_0xa2a5('0x14')][_0x57b13f[_0xa2a5('0x26')]],_0x57b13f);}}}return _0x55b8a8['voiceQueues'];};};Realtime[_0xa2a5('0x3f')][_0xa2a5('0x46')]=function(){var _0x17e583=this;return function(_0x416797){if(_0x416797){freeIsNotKey(_0x416797,_0x17e583[_0xa2a5('0x15')],'id');for(var _0xeb6762=0x0,_0x30a606={},_0x494bc7={};_0xeb6762<_0x416797[_0xa2a5('0x40')];_0xeb6762+=0x1){_0x30a606=_0x416797[_0xeb6762];if(_[_0xa2a5('0x42')](_0x17e583[_0xa2a5('0x15')][_0x30a606['id']])){_0x17e583[_0xa2a5('0x15')][_0x30a606['id']]=new Trigger(_0x30a606);}else{_0x17e583[_0xa2a5('0x43')](_0x17e583[_0xa2a5('0x15')][_0x30a606['id']],_0x30a606);}}}return _0x17e583[_0xa2a5('0x15')];};};Realtime[_0xa2a5('0x3f')][_0xa2a5('0x47')]=function(){var _0x16e827=this;return function(_0x310170){if(_0x310170){freeIsNotKey(_0x310170,_0x16e827[_0xa2a5('0x48')],'id');for(var _0x1b39b2=0x0,_0x40e1d2={},_0x322b00={};_0x1b39b2<_0x310170['length'];_0x1b39b2+=0x1){_0x40e1d2=_0x310170[_0x1b39b2];if(_[_0xa2a5('0x42')](_0x16e827['templates'][_0x40e1d2['id']])){_0x16e827[_0xa2a5('0x48')][_0x40e1d2['id']]=new Template(_0x40e1d2);}else{_0x16e827[_0xa2a5('0x43')](_0x16e827[_0xa2a5('0x48')][_0x40e1d2['id']],_0x40e1d2);}}}return _0x16e827[_0xa2a5('0x48')];};};Realtime['prototype'][_0xa2a5('0x49')]=function(){var _0x47e5f5=this;return function(_0x4233a8){if(_0x4233a8){freeIsNotKey(_0x4233a8,_0x47e5f5[_0xa2a5('0x1b')],'id');for(var _0x1be372=0x0,_0x1edced={},_0x20367e={};_0x1be372<_0x4233a8[_0xa2a5('0x40')];_0x1be372+=0x1){_0x1edced=_0x4233a8[_0x1be372];if(_[_0xa2a5('0x42')](_0x47e5f5[_0xa2a5('0x1b')][_0x1edced['id']])){_0x47e5f5[_0xa2a5('0x1b')][_0x1edced['id']]=new ZendeskAccount(_0x1edced);}else{_0x47e5f5[_0xa2a5('0x43')](_0x47e5f5[_0xa2a5('0x1b')][_0x1edced['id']],_0x1edced);}}}return _0x47e5f5[_0xa2a5('0x1b')];};};Realtime[_0xa2a5('0x3f')]['initSalesforceAccounts']=function(){var _0x45e34f=this;return function(_0x2041c7){if(_0x2041c7){freeIsNotKey(_0x2041c7,_0x45e34f[_0xa2a5('0x1c')],'id');for(var _0x15207f=0x0,_0x261234={},_0x244643={};_0x15207f<_0x2041c7[_0xa2a5('0x40')];_0x15207f+=0x1){_0x261234=_0x2041c7[_0x15207f];if(_['isUndefined'](_0x45e34f[_0xa2a5('0x1c')][_0x261234['id']])){_0x45e34f[_0xa2a5('0x1c')][_0x261234['id']]=new SalesforceAccount(_0x261234);}else{_0x45e34f[_0xa2a5('0x43')](_0x45e34f['salesforceAccounts'][_0x261234['id']],_0x261234);}}}return _0x45e34f[_0xa2a5('0x1c')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x27e323=this;return function(_0x18d152){if(_0x18d152){freeIsNotKey(_0x18d152,_0x27e323[_0xa2a5('0x1d')],'id');for(var _0x52786b=0x0,_0x574098={},_0x47f0e0={};_0x52786b<_0x18d152['length'];_0x52786b+=0x1){_0x574098=_0x18d152[_0x52786b];if(_['isUndefined'](_0x27e323['freshdeskAccounts'][_0x574098['id']])){_0x27e323[_0xa2a5('0x1d')][_0x574098['id']]=new FreshdeskAccount(_0x574098);}else{_0x27e323[_0xa2a5('0x43')](_0x27e323[_0xa2a5('0x1d')][_0x574098['id']],_0x574098);}}}return _0x27e323['freshdeskAccounts'];};};Realtime[_0xa2a5('0x3f')]['initZohoAccounts']=function(){var _0x27e6eb=this;return function(_0x2b3b69){if(_0x2b3b69){freeIsNotKey(_0x2b3b69,_0x27e6eb[_0xa2a5('0x1e')],'id');for(var _0x2f13cb=0x0,_0x417ab5={},_0x5e8f13={};_0x2f13cb<_0x2b3b69['length'];_0x2f13cb+=0x1){_0x417ab5=_0x2b3b69[_0x2f13cb];if(_[_0xa2a5('0x42')](_0x27e6eb[_0xa2a5('0x1e')][_0x417ab5['id']])){_0x27e6eb[_0xa2a5('0x1e')][_0x417ab5['id']]=new ZohoAccount(_0x417ab5);}else{_0x27e6eb[_0xa2a5('0x43')](_0x27e6eb[_0xa2a5('0x1e')][_0x417ab5['id']],_0x417ab5);}}}return _0x27e6eb['zohoAccounts'];};};Realtime[_0xa2a5('0x3f')][_0xa2a5('0x4a')]=function(){var _0x34ad2a=this;return function(_0x1d68af){if(_0x1d68af){freeIsNotKey(_0x1d68af,_0x34ad2a[_0xa2a5('0x1f')],'id');for(var _0x3c94e8=0x0,_0x476ba3={},_0x3802cc={};_0x3c94e8<_0x1d68af[_0xa2a5('0x40')];_0x3c94e8+=0x1){_0x476ba3=_0x1d68af[_0x3c94e8];if(_[_0xa2a5('0x42')](_0x34ad2a[_0xa2a5('0x1f')][_0x476ba3['id']])){_0x34ad2a[_0xa2a5('0x1f')][_0x476ba3['id']]=new DeskAccount(_0x476ba3);}else{_0x34ad2a[_0xa2a5('0x43')](_0x34ad2a[_0xa2a5('0x1f')][_0x476ba3['id']],_0x476ba3);}}}return _0x34ad2a[_0xa2a5('0x1f')];};};Realtime['prototype'][_0xa2a5('0x4b')]=function(){var _0x37f50f=this;return function(_0x3de058){if(_0x3de058){freeIsNotKey(_0x3de058,_0x37f50f[_0xa2a5('0x4c')],'id');for(var _0x3ae64e=0x0,_0x3e82fa={},_0x3813fc={};_0x3ae64e<_0x3de058[_0xa2a5('0x40')];_0x3ae64e+=0x1){_0x3e82fa=_0x3de058[_0x3ae64e];if(_[_0xa2a5('0x42')](_0x37f50f['sugarcrmAccounts'][_0x3e82fa['id']])){_0x37f50f[_0xa2a5('0x4c')][_0x3e82fa['id']]=new SugarcrmAccount(_0x3e82fa);}else{_0x37f50f[_0xa2a5('0x43')](_0x37f50f[_0xa2a5('0x4c')][_0x3e82fa['id']],_0x3e82fa);}}}return _0x37f50f[_0xa2a5('0x4c')];};};Realtime[_0xa2a5('0x3f')][_0xa2a5('0x4d')]=function(){var _0x5774fd=this;return function(_0x17f30a){if(_0x17f30a){freeIsNotKey(_0x17f30a,_0x5774fd['vtigerAccounts'],'id');for(var _0x49628a=0x0,_0x4b9631={},_0xf8f9ae={};_0x49628a<_0x17f30a['length'];_0x49628a+=0x1){_0x4b9631=_0x17f30a[_0x49628a];if(_[_0xa2a5('0x42')](_0x5774fd['vtigerAccounts'][_0x4b9631['id']])){_0x5774fd['vtigerAccounts'][_0x4b9631['id']]=new VtigerAccount(_0x4b9631);}else{_0x5774fd['mergeFromDatabase'](_0x5774fd[_0xa2a5('0x20')][_0x4b9631['id']],_0x4b9631);}}}return _0x5774fd[_0xa2a5('0x20')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x1431c7=this;return function(_0x203293){if(_0x203293){freeIsNotKey(_0x203293,_0x1431c7[_0xa2a5('0x21')],'id');for(var _0x129118=0x0,_0x4ef3aa={},_0x1d4d13={};_0x129118<_0x203293['length'];_0x129118+=0x1){_0x4ef3aa=_0x203293[_0x129118];if(_[_0xa2a5('0x42')](_0x1431c7[_0xa2a5('0x21')][_0x4ef3aa['id']])){_0x1431c7['servicenowAccounts'][_0x4ef3aa['id']]=new ServicenowAccount(_0x4ef3aa);}else{_0x1431c7[_0xa2a5('0x43')](_0x1431c7[_0xa2a5('0x21')][_0x4ef3aa['id']],_0x4ef3aa);}}}return _0x1431c7[_0xa2a5('0x21')];};};Realtime[_0xa2a5('0x3f')]['initDynamics365Accounts']=function(){var _0x56132b=this;return function(_0x458fe3){if(_0x458fe3){freeIsNotKey(_0x458fe3,_0x56132b[_0xa2a5('0x4e')],'id');for(var _0x56f4c0=0x0,_0x5b47a4={},_0x3b8b0f={};_0x56f4c0<_0x458fe3['length'];_0x56f4c0+=0x1){_0x5b47a4=_0x458fe3[_0x56f4c0];if(_[_0xa2a5('0x42')](_0x56132b['dynamics365Accounts'][_0x5b47a4['id']])){_0x56132b[_0xa2a5('0x4e')][_0x5b47a4['id']]=new Dynamics365Account(_0x5b47a4);}else{_0x56132b[_0xa2a5('0x43')](_0x56132b[_0xa2a5('0x4e')][_0x5b47a4['id']],_0x5b47a4);}}}return _0x56132b[_0xa2a5('0x4e')];};};Realtime[_0xa2a5('0x3f')]['initFreshsalesAccounts']=function(){var _0x14a8ec=this;return function(_0x253464){if(_0x253464){freeIsNotKey(_0x253464,_0x14a8ec[_0xa2a5('0x22')],'id');for(var _0x2d55f9=0x0,_0x2190f6={},_0x472708={};_0x2d55f9<_0x253464[_0xa2a5('0x40')];_0x2d55f9+=0x1){_0x2190f6=_0x253464[_0x2d55f9];if(_[_0xa2a5('0x42')](_0x14a8ec['freshsalesAccounts'][_0x2190f6['id']])){_0x14a8ec['freshsalesAccounts'][_0x2190f6['id']]=new FreshsalesAccount(_0x2190f6);}else{_0x14a8ec[_0xa2a5('0x43')](_0x14a8ec['freshsalesAccounts'][_0x2190f6['id']],_0x2190f6);}}}return _0x14a8ec['freshsalesAccounts'];};};Realtime[_0xa2a5('0x3f')]['initVoiceQueueHopperHistory']=function(){var _0x2b7b54=this;return function(_0xb5ce57){for(var _0x379b03=0x0;_0x379b03<_0xb5ce57[_0xa2a5('0x40')];_0x379b03+=0x1){_['merge'](_0x2b7b54['voiceQueues'][_0xb5ce57[_0x379b03]['name']],_0xb5ce57[_0x379b03]);}return _0x2b7b54[_0xa2a5('0x14')];};};Realtime[_0xa2a5('0x3f')][_0xa2a5('0x4f')]=function(){var _0x56689b=this;return function(_0x46f857){clearVoiceQueues(_0x56689b[_0xa2a5('0x14')]);if(_0x46f857){_0x46f857=_[_0xa2a5('0x50')](_0x46f857,_0xa2a5('0x51'));for(var _0x51a75a in _0x46f857){if(_0x46f857[_0xa2a5('0x27')](_0x51a75a)){var _0x4b49f1={};for(var _0x5e1ae8=0x0;_0x5e1ae8<_0x46f857[_0x51a75a]['length'];_0x5e1ae8+=0x1){var _0x23d940=_0x46f857[_0x51a75a][_0x5e1ae8][_0xa2a5('0x52')];if(_0x56689b[_0xa2a5('0x14')][_0x23d940]){if(_0x46f857[_0x51a75a][_0x5e1ae8][_0xa2a5('0x53')]){_0x56689b[_0xa2a5('0x14')][_0x23d940][_0xa2a5('0x31')]+=0x1;}if(_0x46f857[_0x51a75a][_0x5e1ae8][_0xa2a5('0x54')]){_0x56689b[_0xa2a5('0x14')][_0x23d940]['abandoned']+=0x1;}_0x56689b['voiceQueues'][_0x23d940]['sumHoldTime']+=moment(_0x46f857[_0x51a75a][_0x5e1ae8][_0xa2a5('0x55')])[_0xa2a5('0x56')](moment(_0x46f857[_0x51a75a][_0x5e1ae8][_0xa2a5('0x57')]),'seconds')||0x0;if(_0x5e1ae8===_0x46f857[_0x51a75a][_0xa2a5('0x40')]-0x1){_0x56689b[_0xa2a5('0x14')][_0x23d940][_0xa2a5('0x2d')]+=moment(_0x46f857[_0x51a75a][_0x5e1ae8]['queuecallercompleteAt']||_0x46f857[_0x51a75a][_0x5e1ae8]['queuecallerabandonAt']||_0x46f857[_0x51a75a][_0x5e1ae8][_0xa2a5('0x58')])['diff'](moment(_0x46f857[_0x51a75a][_0x5e1ae8][_0xa2a5('0x57')]),_0xa2a5('0x59'))||0x0;_0x56689b['voiceQueues'][_0x23d940][_0xa2a5('0x2a')]+=0x1;if(_0x46f857[_0x51a75a][_0x5e1ae8][_0xa2a5('0x5a')]){_0x56689b[_0xa2a5('0x14')][_0x23d940][_0xa2a5('0x2b')]+=0x1;_0x56689b[_0xa2a5('0x14')][_0x23d940][_0xa2a5('0x2e')]+=moment(_0x46f857[_0x51a75a][_0x5e1ae8][_0xa2a5('0x5b')])[_0xa2a5('0x56')](moment(_0x46f857[_0x51a75a][_0x5e1ae8][_0xa2a5('0x55')]),_0xa2a5('0x59'))||0x0;}}else{_0x56689b[_0xa2a5('0x14')][_0x23d940][_0xa2a5('0x2d')]+=_0x56689b[_0xa2a5('0x14')][_0x23d940][_0xa2a5('0x2c')]||0x0;}}}}}}return _0x56689b[_0xa2a5('0x14')];};};Realtime[_0xa2a5('0x3f')]['initVoiceCallReports']=function(){var _0x59a7d6=this;return function(_0x237cc1){clearVoiceCallReports(_0x59a7d6[_0xa2a5('0x16')]);if(_0x237cc1){for(var _0x53663d=0x0;_0x53663d<_0x237cc1[_0xa2a5('0x40')];_0x53663d+=0x1){_0x59a7d6['outbound'][_0xa2a5('0x2a')]+=0x1;_0x59a7d6[_0xa2a5('0x16')][_0xa2a5('0x2d')]+=_0x237cc1[_0x53663d]['duration'];if(_0x237cc1[_0x53663d][_0xa2a5('0x5c')]==='ANSWERED'){_0x59a7d6['outbound'][_0xa2a5('0x2b')]+=0x1;_0x59a7d6[_0xa2a5('0x16')]['sumHoldTime']+=_0x237cc1[_0x53663d][_0xa2a5('0x5d')]-_0x237cc1[_0x53663d][_0xa2a5('0x5e')]||0x0;_0x59a7d6['outbound']['sumBillable']+=_0x237cc1[_0x53663d][_0xa2a5('0x5e')];}}}return _0x59a7d6['outbound'];};};Realtime['prototype']['initCampaigns']=function(){var _0x499253=this;return function(_0x37e864){if(_0x37e864){freeIsNotKey(_0x37e864,_0x499253[_0xa2a5('0x5f')],_0xa2a5('0x26'));for(var _0x98fc27=0x0,_0x1e2636={};_0x98fc27<_0x37e864['length'];_0x98fc27+=0x1){_0x1e2636=_0x37e864[_0x98fc27];if(_['isUndefined'](_0x499253[_0xa2a5('0x5f')][_0x1e2636[_0xa2a5('0x26')]])){_0x499253['campaigns'][_0x1e2636[_0xa2a5('0x26')]]=new Campaign(_0x1e2636);}else{_0x499253[_0xa2a5('0x43')](_0x499253[_0xa2a5('0x5f')][_0x1e2636['name']],_0x1e2636);_0x499253['campaigns'][_0x1e2636[_0xa2a5('0x26')]][_0xa2a5('0x60')]=_0x1e2636['SquareProject']?_0x1e2636[_0xa2a5('0x61')][_0xa2a5('0x26')]:undefined;}}}return _0x499253[_0xa2a5('0x5f')];};};Realtime[_0xa2a5('0x3f')][_0xa2a5('0x62')]=function(){var _0x157e26=this;return function(_0x19b5e5){if(_0x19b5e5){freeIsNotKey(_0x19b5e5,_0x157e26['voiceExtensions'],'id');for(var _0x293ace=0x0,_0x58e8c1={};_0x293ace<_0x19b5e5[_0xa2a5('0x40')];_0x293ace+=0x1){_0x58e8c1=_0x19b5e5[_0x293ace];if(_[_0xa2a5('0x42')](_0x157e26[_0xa2a5('0x17')][_0x58e8c1['id']])){_0x157e26[_0xa2a5('0x17')][_0x58e8c1['id']]=new VoiceExtension(_0x58e8c1);}else{_0x157e26[_0xa2a5('0x43')](_0x157e26[_0xa2a5('0x17')][_0x58e8c1['id']],_0x58e8c1);}}}return _0x157e26[_0xa2a5('0x17')];};};Realtime[_0xa2a5('0x3f')]['initCampaignHopperHistory']=function(){var _0x2b0824=this;return function(_0x32d27f){clearCampaigns(_0x2b0824[_0xa2a5('0x5f')]);for(var _0x1722cb=0x0;_0x1722cb<_0x32d27f[_0xa2a5('0x40')];_0x1722cb+=0x1){_['merge'](_0x2b0824['campaigns'][_0x32d27f[_0x1722cb][_0xa2a5('0x26')]],_0x32d27f[_0x1722cb]);}return _0x2b0824[_0xa2a5('0x5f')];};};Realtime[_0xa2a5('0x3f')]['initFaxAccounts']=function(){var _0x4bd19c=this;return function(_0x1075af){if(_0x1075af){freeIsNotKey(_0x1075af,_0x4bd19c[_0xa2a5('0x23')],'id');for(var _0x19e108=0x0,_0x344b51={},_0x15fa87={};_0x19e108<_0x1075af[_0xa2a5('0x40')];_0x19e108+=0x1){_0x344b51=_0x1075af[_0x19e108];if(_[_0xa2a5('0x42')](_0x4bd19c[_0xa2a5('0x23')][_0x344b51['id']])){_0x4bd19c[_0xa2a5('0x23')][_0x344b51['id']]=new FaxAccount(_0x344b51);}else{_0x4bd19c['mergeFromDatabase'](_0x4bd19c[_0xa2a5('0x23')][_0x344b51['id']],_0x344b51);}}}return _0x4bd19c[_0xa2a5('0x23')];};};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 5c0742c..1ed393e 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 _0x2b05=['voiceCallReport','bind','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','findAgent','accountcode','find','name','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','interface','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','destination','exten','dialer','queue','lastdata','context','from-voip-provider','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','callerid','disposition','ANSWERED','monitor','monitors','monitorFilename','filename','createdAt','calleridname','connectedlinename','membername','xcally-motion-dialer','isArray','startsWith','substring','indexOf','mobile','phone','isNil','attendedTransfer','exports','bluebird','lodash','moment','util','../../../config/environment','../../../config/logger','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport'];(function(_0x50e9f0,_0x347951){var _0x216357=function(_0x23db93){while(--_0x23db93){_0x50e9f0['push'](_0x50e9f0['shift']());}};_0x216357(++_0x347951);}(_0x2b05,0x90));var _0x52b0=function(_0x1fc1d4,_0x14b420){_0x1fc1d4=_0x1fc1d4-0x0;var _0x3564b0=_0x2b05[_0x1fc1d4];return _0x3564b0;};'use strict';var BPromise=require(_0x52b0('0x0'));var _=require(_0x52b0('0x1'));var moment=require(_0x52b0('0x2'));var util=require(_0x52b0('0x3'));var config=require(_0x52b0('0x4'));var logger=require(_0x52b0('0x5'))('ami');var ami=require(_0x52b0('0x6'));var RpcVoiceAgentReport=require(_0x52b0('0x7'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x52b0('0x8'));var RpcMemberReport=require(_0x52b0('0x9'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x52b0('0xa'));var RpcVoiceTransferReport=require(_0x52b0('0xb'));var VoiceQueueReport=require(_0x52b0('0xc'));var VoiceCallReport=require(_0x52b0('0xd'));var VoiceAgentReport=require(_0x52b0('0xe'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x52b0('0xf'));function Report(_0x2ecbfd){this['realtime']=_0x2ecbfd;this[_0x52b0('0x10')]=_0x2ecbfd[_0x52b0('0x10')];this[_0x52b0('0x11')]=_0x2ecbfd[_0x52b0('0x11')];}Report[_0x52b0('0x12')][_0x52b0('0x13')]=function(_0x4c2c94){var _0x39be70=new VoiceQueueReport(this[_0x52b0('0x14')]);var _0x494f10=new VoiceAgentReport(this['realtime']);var _0xff2382=new VoiceDialReport(this[_0x52b0('0x14')]);var _0x515b13=new VoiceCallReport(this[_0x52b0('0x14')]);var _0x1c56bb=new UserReport(this['realtime']);if(config['xdr']&&config[_0x52b0('0x15')][_0x52b0('0x16')]){ami['on'](_0x52b0('0x17'),this[_0x52b0('0x18')]['bind'](this));ami['on'](_0x52b0('0x19'),this[_0x52b0('0x1a')][_0x52b0('0x1b')](this));ami['on']('custom:voiceAgentReport',this[_0x52b0('0x1c')][_0x52b0('0x1b')](this));ami['on'](_0x52b0('0x1d'),this[_0x52b0('0x1e')][_0x52b0('0x1b')](this));ami['on'](_0x52b0('0x1f'),this[_0x52b0('0x20')]['bind'](this));ami['on'](_0x52b0('0x21'),this['attendedTransfer'][_0x52b0('0x1b')](this));}};Report['prototype'][_0x52b0('0x22')]=function(_0x55cdc1){var _0x56838a=undefined;_0x56838a=_['find'](this['agents'],function(_0x32a36c){return _0x32a36c[_0x52b0('0x23')]==_0x55cdc1||_0x32a36c['name']==_0x55cdc1;});if(_['isNil'](_0x56838a)){var _0x468146=_[_0x52b0('0x24')](this[_0x52b0('0x11')],function(_0xcb6bd){return _0xcb6bd[_0x52b0('0x23')]==_0x55cdc1||_0xcb6bd[_0x52b0('0x25')]==_0x55cdc1;});if(_0x468146){_0x56838a=_[_0x52b0('0x24')](this[_0x52b0('0x10')],function(_0x45321b){return _0x45321b['interface']==util['format'](_0x52b0('0x26'),_0x468146[_0x52b0('0x25')]);});}}return _0x56838a;};Report['prototype']['voiceQueueReport']=function(_0x362f5c){for(var _0x57229f=0x0;_0x57229f<_0x362f5c[_0x52b0('0x27')];_0x57229f+=0x1){var _0x535c10=this[_0x52b0('0x22')](_0x362f5c[_0x57229f][_0x52b0('0x28')]);if(_0x535c10){_0x362f5c[_0x57229f][_0x52b0('0x23')]=_0x535c10[_0x52b0('0x23')];_0x362f5c[_0x57229f][_0x52b0('0x29')]=!![];_0x362f5c[_0x57229f][_0x52b0('0x2a')]=_0x535c10[_0x52b0('0x25')];_0x362f5c[_0x57229f][_0x52b0('0x2b')]=_['isNil'](_0x535c10[_0x52b0('0x2b')])?util[_0x52b0('0x2c')](_0x52b0('0x26'),_0x535c10[_0x52b0('0x25')]):_0x535c10[_0x52b0('0x2b')];if(_0x362f5c[_0x57229f][_0x52b0('0x2d')]){_0x362f5c[_0x57229f][_0x52b0('0x2e')]=moment()[_0x52b0('0x2c')](_0x52b0('0x2f'));}if(_0x362f5c[_0x57229f]['queuecallerexit']){_0x362f5c[_0x57229f][_0x52b0('0x30')]=moment()[_0x52b0('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x52b0('0x18')](_0x362f5c[_0x57229f]);}RpcVoiceQueueReport[_0x52b0('0x31')](_0x362f5c[_0x57229f]);}};function extractCalleridNumber(_0xb1fb60){var _0x5af3d2=_0xb1fb60[_0x52b0('0x32')](/<(.*?)>/);return _0x5af3d2?_0x5af3d2[0x1]:_0xb1fb60;}Report[_0x52b0('0x12')][_0x52b0('0x1a')]=function(_0x5079ab){_0x5079ab[_0x52b0('0x33')]=_0x5079ab[_0x52b0('0x33')]||_0x5079ab[_0x52b0('0x34')];if(_0x5079ab['type']==_0x52b0('0x35')){_0x5079ab['lastapplication']=_0x52b0('0x36');_0x5079ab[_0x52b0('0x37')]=_0x5079ab[_0x52b0('0x36')];if(_0x5079ab[_0x52b0('0x38')]==_0x52b0('0x39')){_0x5079ab[_0x52b0('0x23')]='';_0x5079ab['destination']=extractCalleridNumber(_0x5079ab['callerid']);}else if(_0x5079ab[_0x52b0('0x38')]=='from-sip'){if(_0x5079ab['destination']==_0x52b0('0x3a')){_0x5079ab[_0x52b0('0x33')]=extractCalleridNumber(_0x5079ab[_0x52b0('0x3b')]);_0x5079ab[_0x52b0('0x3c')]=_0x5079ab[_0x52b0('0x3d')];_0x5079ab[_0x52b0('0x3e')]=[_0x5079ab['channel'],_0x5079ab[_0x52b0('0x3f')]=_0x5079ab['destinationchannel']][0x0];_0x5079ab[_0x52b0('0x40')]=_0x5079ab['calleridpreview'];}else{_0x5079ab[_0x52b0('0x33')]=_0x5079ab[_0x52b0('0x3c')];_0x5079ab[_0x52b0('0x3c')]=_0x5079ab[_0x52b0('0x3d')];if(_0x5079ab[_0x52b0('0x41')]==_0x52b0('0x42')){_0x5079ab['accountcode']=_0x5079ab['connectedlinenum'];}else{_0x5079ab[_0x52b0('0x23')]='';}}}}else{_0x5079ab[_0x52b0('0x40')]=util[_0x52b0('0x2c')]('\x22%s\x22\x20<%s>',_0x5079ab['calleridname'],_0x5079ab[_0x52b0('0x3c')]);}RpcVoiceCallReport[_0x52b0('0x31')](_0x5079ab);if(_0x5079ab[_0x52b0('0x43')]){for(var _0x264c72=0x0;_0x264c72<_0x5079ab[_0x52b0('0x44')][_0x52b0('0x27')];_0x264c72+=0x1){_0x5079ab[_0x52b0('0x45')]=_0x5079ab['monitors'][_0x264c72][_0x52b0('0x46')];_0x5079ab[_0x52b0('0x47')]=_0x5079ab['monitors'][_0x264c72]['createdAt'];if(_0x5079ab['exten']==_0x52b0('0x3a')){_0x5079ab[_0x52b0('0x3c')]=_0x5079ab[_0x52b0('0x28')];_0x5079ab[_0x52b0('0x48')]=_0x5079ab[_0x52b0('0x49')];_0x5079ab[_0x52b0('0x28')]=_0x5079ab[_0x52b0('0x23')];_0x5079ab[_0x52b0('0x49')]=_0x5079ab[_0x52b0('0x4a')];_0x5079ab[_0x52b0('0x34')]=_0x5079ab[_0x52b0('0x3d')];}else if(_0x5079ab[_0x52b0('0x34')]==_0x52b0('0x4b')){_0x5079ab[_0x52b0('0x3c')]=_0x5079ab[_0x52b0('0x33')];_0x5079ab[_0x52b0('0x34')]=_0x5079ab['originatecalleridnum'];}RpcVoiceRecording[_0x52b0('0x31')](_0x5079ab);}}};Report[_0x52b0('0x12')]['voiceAgentReport']=function(_0x542c0c){if(_[_0x52b0('0x4c')](_0x542c0c)){_0x542c0c['forEach'](function(_0x579a01){RpcVoiceAgentReport['create'](_0x579a01);});}else{RpcVoiceAgentReport['create'](_0x542c0c);}};Report[_0x52b0('0x12')]['voiceDialReport']=function(_0x4b5fac){RpcVoiceDialReport[_0x52b0('0x31')](_0x4b5fac);var _0x9d47a8=undefined;var _0x34eaca=_0x4b5fac[_0x52b0('0x3f')];if(_[_0x52b0('0x4d')](_0x34eaca,'Local')){var _0x4b2523=_0x34eaca[_0x52b0('0x4e')](_0x34eaca[_0x52b0('0x4f')]('/')+0x1,_0x34eaca[_0x52b0('0x4f')]('@'));_0x9d47a8=_['find'](this[_0x52b0('0x10')],function(_0x1183a7){return _0x1183a7[_0x52b0('0x50')]==_0x4b2523||_0x1183a7[_0x52b0('0x51')]==_0x4b2523||_0x1183a7[_0x52b0('0x23')]==_0x4b2523;});}else{var _0x4b2523=_0x34eaca['substring'](_0x34eaca[_0x52b0('0x4f')]('/')+0x1,_0x34eaca['lastIndexOf']('-'));_0x9d47a8=this[_0x52b0('0x22')](_0x4b2523);}if(_0x9d47a8){_0x4b5fac[_0x52b0('0x2b')]=_[_0x52b0('0x52')](_0x9d47a8[_0x52b0('0x2b')])?util[_0x52b0('0x2c')](_0x52b0('0x26'),_0x9d47a8[_0x52b0('0x25')]):_0x9d47a8['interface'];_0x4b5fac[_0x52b0('0x4a')]=_0x9d47a8['name'];_0x4b5fac[_0x52b0('0x23')]=_0x9d47a8[_0x52b0('0x23')];RpcMemberReport['voiceDialReport'](_0x4b5fac);}};Report[_0x52b0('0x12')][_0x52b0('0x20')]=function(_0x11a238){RpcVoiceTransferReport[_0x52b0('0x20')](_0x11a238);};Report['prototype']['attendedTransfer']=function(_0x2970fc){RpcVoiceTransferReport[_0x52b0('0x53')](_0x2970fc);};module[_0x52b0('0x54')]=Report; \ No newline at end of file +var _0x4223=['connectedlinenum','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','destination','exten','type','dialer','lastapplication','context','from-voip-provider','from-sip','xcally-motion-preview','calleridnum','originatecalleridnum','destinationchannel','channel','callerid','calleridpreview','disposition','ANSWERED','monitor','monitors','length','monitorFilename','createdAt','calleridname','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','Local','indexOf','lastIndexOf','exports','lodash','util','../../../config/environment','../../../config/logger','../ami','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','prototype','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s'];(function(_0x2ec650,_0x24b011){var _0xdb00de=function(_0x3244e6){while(--_0x3244e6){_0x2ec650['push'](_0x2ec650['shift']());}};_0xdb00de(++_0x24b011);}(_0x4223,0x10e));var _0x3422=function(_0x22d396,_0x16734c){_0x22d396=_0x22d396-0x0;var _0x45c7fd=_0x4223[_0x22d396];return _0x45c7fd;};'use strict';var BPromise=require('bluebird');var _=require(_0x3422('0x0'));var moment=require('moment');var util=require(_0x3422('0x1'));var config=require(_0x3422('0x2'));var logger=require(_0x3422('0x3'))('ami');var ami=require(_0x3422('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x3422('0x5'));var RpcMemberReport=require(_0x3422('0x6'));var RpcVoiceQueueReport=require(_0x3422('0x7'));var RpcVoiceRecording=require(_0x3422('0x8'));var RpcVoiceTransferReport=require(_0x3422('0x9'));var VoiceQueueReport=require(_0x3422('0xa'));var VoiceCallReport=require(_0x3422('0xb'));var VoiceAgentReport=require(_0x3422('0xc'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x3422('0xd'));function Report(_0x25487f){this[_0x3422('0xe')]=_0x25487f;this[_0x3422('0xf')]=_0x25487f[_0x3422('0xf')];this[_0x3422('0x10')]=_0x25487f[_0x3422('0x10')];}Report['prototype']['sync']=function(_0x2cebb0){var _0x26c1d4=new VoiceQueueReport(this[_0x3422('0xe')]);var _0x2bc04f=new VoiceAgentReport(this[_0x3422('0xe')]);var _0x31f3bc=new VoiceDialReport(this['realtime']);var _0x3771b2=new VoiceCallReport(this[_0x3422('0xe')]);var _0x14aa41=new UserReport(this[_0x3422('0xe')]);if(config['xdr']&&config[_0x3422('0x11')][_0x3422('0x12')]){ami['on']('custom:voiceQueueReport',this[_0x3422('0x13')][_0x3422('0x14')](this));ami['on'](_0x3422('0x15'),this[_0x3422('0x16')][_0x3422('0x14')](this));ami['on'](_0x3422('0x17'),this[_0x3422('0x18')][_0x3422('0x14')](this));ami['on']('custom:voiceDialReport',this[_0x3422('0x19')][_0x3422('0x14')](this));ami['on'](_0x3422('0x1a'),this[_0x3422('0x1b')]['bind'](this));ami['on']('attendedtransfer',this[_0x3422('0x1c')][_0x3422('0x14')](this));}};Report[_0x3422('0x1d')][_0x3422('0x1e')]=function(_0x5894ba){var _0x52a0ca=undefined;_0x52a0ca=_[_0x3422('0x1f')](this['agents'],function(_0x1031a2){return _0x1031a2[_0x3422('0x20')]==_0x5894ba||_0x1031a2[_0x3422('0x21')]==_0x5894ba;});if(_[_0x3422('0x22')](_0x52a0ca)){var _0x5d4dd5=_[_0x3422('0x1f')](this[_0x3422('0x10')],function(_0x277814){return _0x277814['accountcode']==_0x5894ba||_0x277814['name']==_0x5894ba;});if(_0x5d4dd5){_0x52a0ca=_['find'](this[_0x3422('0xf')],function(_0x2c7064){return _0x2c7064[_0x3422('0x23')]==util[_0x3422('0x24')](_0x3422('0x25'),_0x5d4dd5['name']);});}}return _0x52a0ca;};Report[_0x3422('0x1d')]['voiceQueueReport']=function(_0x2ee427){for(var _0x574cd2=0x0;_0x574cd2<_0x2ee427['length'];_0x574cd2+=0x1){var _0x13c616=this[_0x3422('0x1e')](_0x2ee427[_0x574cd2][_0x3422('0x26')]);if(_0x13c616){_0x2ee427[_0x574cd2]['accountcode']=_0x13c616['accountcode'];_0x2ee427[_0x574cd2]['assigned']=!![];_0x2ee427[_0x574cd2]['lastAssignedTo']=_0x13c616['name'];_0x2ee427[_0x574cd2]['interface']=_[_0x3422('0x22')](_0x13c616[_0x3422('0x23')])?util[_0x3422('0x24')](_0x3422('0x25'),_0x13c616[_0x3422('0x21')]):_0x13c616[_0x3422('0x23')];if(_0x2ee427[_0x574cd2][_0x3422('0x27')]){_0x2ee427[_0x574cd2][_0x3422('0x28')]=moment()[_0x3422('0x24')](_0x3422('0x29'));}if(_0x2ee427[_0x574cd2]['queuecallerexit']){_0x2ee427[_0x574cd2][_0x3422('0x2a')]=moment()['format'](_0x3422('0x29'));}RpcMemberReport[_0x3422('0x13')](_0x2ee427[_0x574cd2]);}RpcVoiceQueueReport[_0x3422('0x2b')](_0x2ee427[_0x574cd2]);}};function extractCalleridNumber(_0xbbd610){var _0x4ee563=_0xbbd610[_0x3422('0x2c')](/<(.*?)>/);return _0x4ee563?_0x4ee563[0x1]:_0xbbd610;}Report['prototype']['voiceCallReport']=function(_0xa846f8){_0xa846f8[_0x3422('0x2d')]=_0xa846f8[_0x3422('0x2d')]||_0xa846f8[_0x3422('0x2e')];if(_0xa846f8[_0x3422('0x2f')]==_0x3422('0x30')){_0xa846f8[_0x3422('0x31')]='queue';_0xa846f8['lastdata']=_0xa846f8['queue'];if(_0xa846f8[_0x3422('0x32')]==_0x3422('0x33')){_0xa846f8['accountcode']='';_0xa846f8[_0x3422('0x2d')]=extractCalleridNumber(_0xa846f8['callerid']);}else if(_0xa846f8[_0x3422('0x32')]==_0x3422('0x34')){if(_0xa846f8[_0x3422('0x2d')]==_0x3422('0x35')){_0xa846f8['destination']=extractCalleridNumber(_0xa846f8['calleridpreview']);_0xa846f8[_0x3422('0x36')]=_0xa846f8[_0x3422('0x37')];_0xa846f8[_0x3422('0x38')]=[_0xa846f8[_0x3422('0x39')],_0xa846f8[_0x3422('0x39')]=_0xa846f8['destinationchannel']][0x0];_0xa846f8[_0x3422('0x3a')]=_0xa846f8[_0x3422('0x3b')];}else{_0xa846f8[_0x3422('0x2d')]=_0xa846f8[_0x3422('0x36')];_0xa846f8[_0x3422('0x36')]=_0xa846f8[_0x3422('0x37')];if(_0xa846f8[_0x3422('0x3c')]==_0x3422('0x3d')){_0xa846f8[_0x3422('0x20')]=_0xa846f8[_0x3422('0x26')];}else{_0xa846f8['accountcode']='';}}}}else{_0xa846f8['callerid']=util[_0x3422('0x24')]('\x22%s\x22\x20<%s>',_0xa846f8['calleridname'],_0xa846f8[_0x3422('0x36')]);}RpcVoiceCallReport['create'](_0xa846f8);if(_0xa846f8[_0x3422('0x3e')]){for(var _0x267792=0x0;_0x267792<_0xa846f8[_0x3422('0x3f')][_0x3422('0x40')];_0x267792+=0x1){_0xa846f8[_0x3422('0x41')]=_0xa846f8[_0x3422('0x3f')][_0x267792]['filename'];_0xa846f8[_0x3422('0x42')]=_0xa846f8['monitors'][_0x267792][_0x3422('0x42')];if(_0xa846f8[_0x3422('0x2e')]=='xcally-motion-preview'){_0xa846f8[_0x3422('0x36')]=_0xa846f8[_0x3422('0x26')];_0xa846f8[_0x3422('0x43')]=_0xa846f8[_0x3422('0x44')];_0xa846f8[_0x3422('0x26')]=_0xa846f8['accountcode'];_0xa846f8[_0x3422('0x44')]=_0xa846f8[_0x3422('0x45')];_0xa846f8[_0x3422('0x2e')]=_0xa846f8[_0x3422('0x37')];}else if(_0xa846f8[_0x3422('0x2e')]==_0x3422('0x46')){_0xa846f8[_0x3422('0x36')]=_0xa846f8[_0x3422('0x2d')];_0xa846f8[_0x3422('0x2e')]=_0xa846f8[_0x3422('0x37')];}RpcVoiceRecording[_0x3422('0x2b')](_0xa846f8);}}};Report[_0x3422('0x1d')]['voiceAgentReport']=function(_0x1de53b){if(_[_0x3422('0x47')](_0x1de53b)){_0x1de53b[_0x3422('0x48')](function(_0x229c7c){RpcVoiceAgentReport[_0x3422('0x2b')](_0x229c7c);});}else{RpcVoiceAgentReport[_0x3422('0x2b')](_0x1de53b);}};Report[_0x3422('0x1d')][_0x3422('0x19')]=function(_0x1ebde3){RpcVoiceDialReport[_0x3422('0x2b')](_0x1ebde3);var _0x4ccfc6=undefined;var _0x3da55d=_0x1ebde3[_0x3422('0x39')];if(_['startsWith'](_0x3da55d,_0x3422('0x49'))){var _0x64633d=_0x3da55d['substring'](_0x3da55d['indexOf']('/')+0x1,_0x3da55d[_0x3422('0x4a')]('@'));_0x4ccfc6=_[_0x3422('0x1f')](this[_0x3422('0xf')],function(_0x5d7016){return _0x5d7016['mobile']==_0x64633d||_0x5d7016['phone']==_0x64633d||_0x5d7016['accountcode']==_0x64633d;});}else{var _0x64633d=_0x3da55d['substring'](_0x3da55d[_0x3422('0x4a')]('/')+0x1,_0x3da55d[_0x3422('0x4b')]('-'));_0x4ccfc6=this['findAgent'](_0x64633d);}if(_0x4ccfc6){_0x1ebde3[_0x3422('0x23')]=_[_0x3422('0x22')](_0x4ccfc6[_0x3422('0x23')])?util[_0x3422('0x24')](_0x3422('0x25'),_0x4ccfc6[_0x3422('0x21')]):_0x4ccfc6['interface'];_0x1ebde3[_0x3422('0x45')]=_0x4ccfc6[_0x3422('0x21')];_0x1ebde3[_0x3422('0x20')]=_0x4ccfc6[_0x3422('0x20')];RpcMemberReport[_0x3422('0x19')](_0x1ebde3);}};Report['prototype'][_0x3422('0x1b')]=function(_0x1cc63f){RpcVoiceTransferReport['blindTransfer'](_0x1cc63f);};Report[_0x3422('0x1d')]['attendedTransfer']=function(_0x31e32c){RpcVoiceTransferReport[_0x3422('0x1c')](_0x31e32c);};module[_0x3422('0x4c')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index c120117..d0c0df3 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 _0xa179=['syncPeerStatus','registered','peer','status','address','telephone:save','exports','lodash','moment','bluebird','../../../config/environment','../../../config/logger','ami','redis','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','error','inspect','prototype','loopSyncRealTimeShow','[loopSyncRealTimeShow]','isUndefined','emit','find','username','state','merge','omit','event','actionid','format','trunk:%s','name','[syncRegistry][UserReport]','isNotNull','device','toLowerCase','inuse','local','stateTime','toNumber','updateStatusRealtime','telephone:%s','trunk:save','startsWith','Queue','Local','substring','indexOf','mobile','phone','accountcode','[syncDeviceState][UserReport]'];(function(_0x35e162,_0x25d875){var _0x4d4566=function(_0x66ebe1){while(--_0x66ebe1){_0x35e162['push'](_0x35e162['shift']());}};_0x4d4566(++_0x25d875);}(_0xa179,0xd0));var _0x9a17=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa179[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9a17('0x0'));var moment=require(_0x9a17('0x1'));var BPromise=require(_0x9a17('0x2'));var util=require('util');var Redis=require('ioredis');var config=require(_0x9a17('0x3'));var logger=require(_0x9a17('0x4'))(_0x9a17('0x5'));var ami=require('../ami');config[_0x9a17('0x6')]=_['defaults'](config[_0x9a17('0x6')],{'host':_0x9a17('0x7'),'port':0x18eb});var io=require(_0x9a17('0x8'))(new Redis(config['redis']));function UserReport(_0x4910fa){this['trunks']=_0x4910fa[_0x9a17('0x9')];this['agents']=_0x4910fa[_0x9a17('0xa')];this[_0x9a17('0xb')]=_0x4910fa[_0x9a17('0xb')];ami['on']('registryentry',this[_0x9a17('0xc')][_0x9a17('0xd')](this));ami['on'](_0x9a17('0xe'),this[_0x9a17('0xc')][_0x9a17('0xd')](this));ami['on'](_0x9a17('0xf'),this[_0x9a17('0x10')][_0x9a17('0xd')](this));ami['on'](_0x9a17('0x11'),this['syncPeerStatus'][_0x9a17('0xd')](this));this['loopSyncRealTimeShow']();return BPromise[_0x9a17('0x12')]()[_0x9a17('0x13')](ami[_0x9a17('0x14')]())['then'](ami[_0x9a17('0x15')]())[_0x9a17('0x13')](ami['actionSipPeerStatus']())[_0x9a17('0x16')](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0x56786d){return function(_0x27d78e){logger[_0x9a17('0x17')](_0x56786d,util[_0x9a17('0x18')](_0x27d78e,{'showHidden':![],'depth':null}));};}UserReport[_0x9a17('0x19')][_0x9a17('0x1a')]=function(){setInterval(function(){BPromise[_0x9a17('0x12')]()['then'](ami[_0x9a17('0x14')]())[_0x9a17('0x13')](ami[_0x9a17('0x15')]())['then'](ami['actionSipPeerStatus']())[_0x9a17('0x16')](loggerCatch(_0x9a17('0x1b')));},0x32c8);};UserReport['prototype']['isNotNull']=function(_0x269d1f){return _0x269d1f!==null&&!_[_0x9a17('0x1c')](_0x269d1f);};UserReport[_0x9a17('0x19')][_0x9a17('0x1d')]=function(_0x3abfac,_0x59ec5a,_0x3c38c4){io['to'](_0x3abfac)['emit'](_0x59ec5a,_0x3c38c4);};UserReport[_0x9a17('0x19')]['syncRegistry']=function(_0x5ac0fc){try{if(this['isNotNull'](_0x5ac0fc)){var _0x288fa7=_[_0x9a17('0x1e')](this[_0x9a17('0x9')],{'registry':_0x5ac0fc[_0x9a17('0x1f')]});if(_0x288fa7){_0x5ac0fc['stateRegistry']=_0x5ac0fc[_0x9a17('0x20')];_[_0x9a17('0x21')](_0x288fa7,_[_0x9a17('0x22')](_0x5ac0fc,[_0x9a17('0x23'),_0x9a17('0x24'),_0x9a17('0x1f'),'state']));this[_0x9a17('0x1d')](util[_0x9a17('0x25')](_0x9a17('0x26'),_0x288fa7[_0x9a17('0x27')]),'trunk:save',_0x288fa7);}}}catch(_0x40527f){logger[_0x9a17('0x17')](_0x9a17('0x28'),util[_0x9a17('0x18')](_0x40527f,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x9a17('0x10')]=function(_0x58102d){try{if(this[_0x9a17('0x29')](_0x58102d)){if(this[_0x9a17('0xa')][_0x58102d['device']]){if(!this[_0x9a17('0xa')][_0x58102d[_0x9a17('0x2a')]]['local']||_0x58102d[_0x9a17('0x20')][_0x9a17('0x2b')]()==_0x9a17('0x2c')){this['agents'][_0x58102d[_0x9a17('0x2a')]][_0x9a17('0x2d')]=![];if(this[_0x9a17('0xa')][_0x58102d[_0x9a17('0x2a')]][_0x9a17('0x20')]!==_0x58102d['state'][_0x9a17('0x2b')]()){this[_0x9a17('0xa')][_0x58102d[_0x9a17('0x2a')]][_0x9a17('0x2e')]=_[_0x9a17('0x2f')](moment()[_0x9a17('0x25')]('x'));}this['agents'][_0x58102d[_0x9a17('0x2a')]][_0x9a17('0x20')]=_0x58102d[_0x9a17('0x20')][_0x9a17('0x2b')]();this[_0x9a17('0xa')][_0x58102d[_0x9a17('0x2a')]][_0x9a17('0x30')](_0x58102d);}}else if(this['telephones'][_0x58102d[_0x9a17('0x2a')]]){if(this['telephones'][_0x58102d[_0x9a17('0x2a')]][_0x9a17('0x20')]!==_0x58102d[_0x9a17('0x20')][_0x9a17('0x2b')]()){this['telephones'][_0x58102d[_0x9a17('0x2a')]][_0x9a17('0x2e')]=_[_0x9a17('0x2f')](moment()['format']('x'));}this['telephones'][_0x58102d[_0x9a17('0x2a')]][_0x9a17('0x20')]=_0x58102d[_0x9a17('0x20')][_0x9a17('0x2b')]();this[_0x9a17('0x1d')](util[_0x9a17('0x25')](_0x9a17('0x31'),this[_0x9a17('0xb')][_0x58102d['device']][_0x9a17('0x27')]),'telephone:save',this[_0x9a17('0xb')][_0x58102d[_0x9a17('0x2a')]]);}else if(this[_0x9a17('0x9')][_0x58102d['device']]){if(this[_0x9a17('0x9')][_0x58102d[_0x9a17('0x2a')]][_0x9a17('0x20')]!==_0x58102d[_0x9a17('0x20')][_0x9a17('0x2b')]()){this[_0x9a17('0x9')][_0x58102d[_0x9a17('0x2a')]][_0x9a17('0x2e')]=_[_0x9a17('0x2f')](moment()[_0x9a17('0x25')]('x'));}this[_0x9a17('0x9')][_0x58102d[_0x9a17('0x2a')]][_0x9a17('0x20')]=_0x58102d['state'][_0x9a17('0x2b')]();this[_0x9a17('0x1d')](util['format'](_0x9a17('0x26'),this[_0x9a17('0x9')][_0x58102d[_0x9a17('0x2a')]][_0x9a17('0x27')]),_0x9a17('0x32'),this[_0x9a17('0x9')][_0x58102d[_0x9a17('0x2a')]]);}else if(_[_0x9a17('0x33')](_0x58102d[_0x9a17('0x2a')],_0x9a17('0x34'))){}else if(_['startsWith'](_0x58102d[_0x9a17('0x2a')],_0x9a17('0x35'))){var _0x25c9f1=_0x58102d['device'];var _0x24505b=_0x25c9f1[_0x9a17('0x36')](_0x25c9f1[_0x9a17('0x37')]('/')+0x1,_0x25c9f1['indexOf']('@'));var _0x547875=_[_0x9a17('0x1e')](this[_0x9a17('0xa')],function(_0x349dd0){return _0x349dd0[_0x9a17('0x38')]==_0x24505b||_0x349dd0[_0x9a17('0x39')]==_0x24505b||_0x349dd0[_0x9a17('0x3a')]==_0x24505b;});if(_0x547875){if(_0x547875[_0x9a17('0x20')]!==_0x58102d[_0x9a17('0x20')][_0x9a17('0x2b')]()){_0x547875[_0x9a17('0x2e')]=_[_0x9a17('0x2f')](moment()['format']('x'));}_0x547875[_0x9a17('0x20')]=_0x58102d[_0x9a17('0x20')][_0x9a17('0x2b')]();_0x547875[_0x9a17('0x2d')]=!![];_0x547875[_0x9a17('0x30')](_0x58102d);}}else{}}}catch(_0x18e443){logger['error'](_0x9a17('0x3b'),util[_0x9a17('0x18')](_0x18e443,{'showHidden':![],'depth':null}));}};UserReport[_0x9a17('0x19')][_0x9a17('0x3c')]=function(_0x3132e9){try{if(this[_0x9a17('0x29')](_0x3132e9)&&this[_0x9a17('0x29')](_0x3132e9[_0x9a17('0x11')])){if(this['agents'][_0x3132e9['peer']]){if(!this[_0x9a17('0xa')][_0x3132e9['peer']]['local']||_0x3132e9['peerstatus'][_0x9a17('0x2b')]()==_0x9a17('0x3d')){this[_0x9a17('0xa')][_0x3132e9[_0x9a17('0x3e')]][_0x9a17('0x2d')]=![];this[_0x9a17('0xa')][_0x3132e9[_0x9a17('0x3e')]][_0x9a17('0x3f')]=_0x3132e9['peerstatus'][_0x9a17('0x2b')]();this[_0x9a17('0xa')][_0x3132e9['peer']][_0x9a17('0x40')]=_0x3132e9[_0x9a17('0x40')];this[_0x9a17('0xa')][_0x3132e9[_0x9a17('0x3e')]]['updateStatusRealtime'](_0x3132e9);}}else if(this[_0x9a17('0xb')][_0x3132e9[_0x9a17('0x3e')]]){this[_0x9a17('0xb')][_0x3132e9['peer']]['status']=_0x3132e9[_0x9a17('0x11')][_0x9a17('0x2b')]();this[_0x9a17('0xb')][_0x3132e9[_0x9a17('0x3e')]][_0x9a17('0x40')]=_0x3132e9[_0x9a17('0x40')];this[_0x9a17('0x1d')](util['format'](_0x9a17('0x31'),this['telephones'][_0x3132e9['peer']][_0x9a17('0x27')]),_0x9a17('0x41'),this[_0x9a17('0xb')][_0x3132e9['peer']]);}else if(this[_0x9a17('0x9')][_0x3132e9['peer']]){this[_0x9a17('0x9')][_0x3132e9['peer']]['status']=_0x3132e9[_0x9a17('0x11')][_0x9a17('0x2b')]();this[_0x9a17('0x9')][_0x3132e9[_0x9a17('0x3e')]][_0x9a17('0x40')]=_0x3132e9[_0x9a17('0x40')];this[_0x9a17('0x1d')](util[_0x9a17('0x25')](_0x9a17('0x26'),this['trunks'][_0x3132e9[_0x9a17('0x3e')]][_0x9a17('0x27')]),_0x9a17('0x32'),this[_0x9a17('0x9')][_0x3132e9[_0x9a17('0x3e')]]);}else{}}}catch(_0x1999cb){logger[_0x9a17('0x17')]('[syncPeerStatus][UserReport]',util['inspect'](_0x1999cb,{'showHidden':![],'depth':null}));}};module[_0x9a17('0x42')]=UserReport; \ No newline at end of file +var _0xed9a=['actionDeviceStateList','actionSipPeerStatus','catch','error','inspect','prototype','actionSipShowRegistry','[loopSyncRealTimeShow]','isNotNull','emit','stateRegistry','merge','omit','event','actionid','username','state','format','trunk:%s','name','trunk:save','device','toLowerCase','inuse','local','stateTime','toNumber','telephone:%s','telephone:save','startsWith','Queue','Local','substring','indexOf','find','phone','accountcode','[syncDeviceState][UserReport]','peer','registered','address','updateStatusRealtime','status','[syncPeerStatus][UserReport]','lodash','moment','bluebird','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','then'];(function(_0x154463,_0x639acd){var _0x1d692d=function(_0xd55258){while(--_0xd55258){_0x154463['push'](_0x154463['shift']());}};_0x1d692d(++_0x639acd);}(_0xed9a,0x140));var _0xaed9=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xed9a[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xaed9('0x0'));var moment=require(_0xaed9('0x1'));var BPromise=require(_0xaed9('0x2'));var util=require(_0xaed9('0x3'));var Redis=require(_0xaed9('0x4'));var config=require(_0xaed9('0x5'));var logger=require(_0xaed9('0x6'))(_0xaed9('0x7'));var ami=require(_0xaed9('0x8'));config[_0xaed9('0x9')]=_[_0xaed9('0xa')](config['redis'],{'host':_0xaed9('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xaed9('0x9')]));function UserReport(_0x4ae22e){this[_0xaed9('0xc')]=_0x4ae22e[_0xaed9('0xc')];this[_0xaed9('0xd')]=_0x4ae22e[_0xaed9('0xd')];this[_0xaed9('0xe')]=_0x4ae22e[_0xaed9('0xe')];ami['on'](_0xaed9('0xf'),this[_0xaed9('0x10')][_0xaed9('0x11')](this));ami['on'](_0xaed9('0x12'),this[_0xaed9('0x10')][_0xaed9('0x11')](this));ami['on'](_0xaed9('0x13'),this['syncDeviceState'][_0xaed9('0x11')](this));ami['on'](_0xaed9('0x14'),this[_0xaed9('0x15')][_0xaed9('0x11')](this));this[_0xaed9('0x16')]();return BPromise[_0xaed9('0x17')]()[_0xaed9('0x18')](ami['actionSipShowRegistry']())[_0xaed9('0x18')](ami[_0xaed9('0x19')]())[_0xaed9('0x18')](ami[_0xaed9('0x1a')]())[_0xaed9('0x1b')](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0xd84919){return function(_0x485aeb){logger[_0xaed9('0x1c')](_0xd84919,util[_0xaed9('0x1d')](_0x485aeb,{'showHidden':![],'depth':null}));};}UserReport[_0xaed9('0x1e')][_0xaed9('0x16')]=function(){setInterval(function(){BPromise[_0xaed9('0x17')]()['then'](ami[_0xaed9('0x1f')]())[_0xaed9('0x18')](ami[_0xaed9('0x19')]())[_0xaed9('0x18')](ami[_0xaed9('0x1a')]())[_0xaed9('0x1b')](loggerCatch(_0xaed9('0x20')));},0x32c8);};UserReport[_0xaed9('0x1e')][_0xaed9('0x21')]=function(_0x475da8){return _0x475da8!==null&&!_['isUndefined'](_0x475da8);};UserReport[_0xaed9('0x1e')][_0xaed9('0x22')]=function(_0x221cd9,_0x1cde08,_0x2d90a0){io['to'](_0x221cd9)[_0xaed9('0x22')](_0x1cde08,_0x2d90a0);};UserReport[_0xaed9('0x1e')][_0xaed9('0x10')]=function(_0x36356f){try{if(this[_0xaed9('0x21')](_0x36356f)){var _0x3c2a17=_['find'](this['trunks'],{'registry':_0x36356f['username']});if(_0x3c2a17){_0x36356f[_0xaed9('0x23')]=_0x36356f['state'];_[_0xaed9('0x24')](_0x3c2a17,_[_0xaed9('0x25')](_0x36356f,[_0xaed9('0x26'),_0xaed9('0x27'),_0xaed9('0x28'),_0xaed9('0x29')]));this[_0xaed9('0x22')](util[_0xaed9('0x2a')](_0xaed9('0x2b'),_0x3c2a17[_0xaed9('0x2c')]),_0xaed9('0x2d'),_0x3c2a17);}}}catch(_0x19279e){logger[_0xaed9('0x1c')]('[syncRegistry][UserReport]',util['inspect'](_0x19279e,{'showHidden':![],'depth':null}));}};UserReport[_0xaed9('0x1e')]['syncDeviceState']=function(_0x52dab8){try{if(this[_0xaed9('0x21')](_0x52dab8)){if(this[_0xaed9('0xd')][_0x52dab8[_0xaed9('0x2e')]]){if(!this[_0xaed9('0xd')][_0x52dab8[_0xaed9('0x2e')]]['local']||_0x52dab8[_0xaed9('0x29')][_0xaed9('0x2f')]()==_0xaed9('0x30')){this[_0xaed9('0xd')][_0x52dab8[_0xaed9('0x2e')]][_0xaed9('0x31')]=![];if(this['agents'][_0x52dab8[_0xaed9('0x2e')]]['state']!==_0x52dab8[_0xaed9('0x29')][_0xaed9('0x2f')]()){this[_0xaed9('0xd')][_0x52dab8[_0xaed9('0x2e')]][_0xaed9('0x32')]=_['toNumber'](moment()[_0xaed9('0x2a')]('x'));}this['agents'][_0x52dab8[_0xaed9('0x2e')]][_0xaed9('0x29')]=_0x52dab8[_0xaed9('0x29')][_0xaed9('0x2f')]();this['agents'][_0x52dab8['device']]['updateStatusRealtime'](_0x52dab8);}}else if(this[_0xaed9('0xe')][_0x52dab8[_0xaed9('0x2e')]]){if(this['telephones'][_0x52dab8['device']][_0xaed9('0x29')]!==_0x52dab8['state'][_0xaed9('0x2f')]()){this['telephones'][_0x52dab8[_0xaed9('0x2e')]]['stateTime']=_[_0xaed9('0x33')](moment()['format']('x'));}this[_0xaed9('0xe')][_0x52dab8[_0xaed9('0x2e')]][_0xaed9('0x29')]=_0x52dab8[_0xaed9('0x29')][_0xaed9('0x2f')]();this['emit'](util[_0xaed9('0x2a')](_0xaed9('0x34'),this[_0xaed9('0xe')][_0x52dab8[_0xaed9('0x2e')]][_0xaed9('0x2c')]),_0xaed9('0x35'),this[_0xaed9('0xe')][_0x52dab8[_0xaed9('0x2e')]]);}else if(this[_0xaed9('0xc')][_0x52dab8[_0xaed9('0x2e')]]){if(this[_0xaed9('0xc')][_0x52dab8[_0xaed9('0x2e')]][_0xaed9('0x29')]!==_0x52dab8['state'][_0xaed9('0x2f')]()){this[_0xaed9('0xc')][_0x52dab8[_0xaed9('0x2e')]]['stateTime']=_[_0xaed9('0x33')](moment()['format']('x'));}this['trunks'][_0x52dab8[_0xaed9('0x2e')]][_0xaed9('0x29')]=_0x52dab8[_0xaed9('0x29')][_0xaed9('0x2f')]();this[_0xaed9('0x22')](util[_0xaed9('0x2a')](_0xaed9('0x2b'),this[_0xaed9('0xc')][_0x52dab8['device']]['name']),_0xaed9('0x2d'),this[_0xaed9('0xc')][_0x52dab8[_0xaed9('0x2e')]]);}else if(_[_0xaed9('0x36')](_0x52dab8['device'],_0xaed9('0x37'))){}else if(_[_0xaed9('0x36')](_0x52dab8['device'],_0xaed9('0x38'))){var _0x36f3b1=_0x52dab8[_0xaed9('0x2e')];var _0xc1bedf=_0x36f3b1[_0xaed9('0x39')](_0x36f3b1[_0xaed9('0x3a')]('/')+0x1,_0x36f3b1[_0xaed9('0x3a')]('@'));var _0x493918=_[_0xaed9('0x3b')](this['agents'],function(_0x2132d8){return _0x2132d8['mobile']==_0xc1bedf||_0x2132d8[_0xaed9('0x3c')]==_0xc1bedf||_0x2132d8[_0xaed9('0x3d')]==_0xc1bedf;});if(_0x493918){if(_0x493918[_0xaed9('0x29')]!==_0x52dab8['state'][_0xaed9('0x2f')]()){_0x493918[_0xaed9('0x32')]=_[_0xaed9('0x33')](moment()[_0xaed9('0x2a')]('x'));}_0x493918[_0xaed9('0x29')]=_0x52dab8[_0xaed9('0x29')][_0xaed9('0x2f')]();_0x493918[_0xaed9('0x31')]=!![];_0x493918['updateStatusRealtime'](_0x52dab8);}}else{}}}catch(_0x109217){logger['error'](_0xaed9('0x3e'),util['inspect'](_0x109217,{'showHidden':![],'depth':null}));}};UserReport[_0xaed9('0x1e')]['syncPeerStatus']=function(_0x151d1d){try{if(this[_0xaed9('0x21')](_0x151d1d)&&this['isNotNull'](_0x151d1d['peerstatus'])){if(this[_0xaed9('0xd')][_0x151d1d[_0xaed9('0x3f')]]){if(!this[_0xaed9('0xd')][_0x151d1d[_0xaed9('0x3f')]][_0xaed9('0x31')]||_0x151d1d[_0xaed9('0x14')][_0xaed9('0x2f')]()==_0xaed9('0x40')){this[_0xaed9('0xd')][_0x151d1d[_0xaed9('0x3f')]][_0xaed9('0x31')]=![];this['agents'][_0x151d1d[_0xaed9('0x3f')]]['status']=_0x151d1d[_0xaed9('0x14')]['toLowerCase']();this[_0xaed9('0xd')][_0x151d1d[_0xaed9('0x3f')]][_0xaed9('0x41')]=_0x151d1d[_0xaed9('0x41')];this['agents'][_0x151d1d[_0xaed9('0x3f')]][_0xaed9('0x42')](_0x151d1d);}}else if(this[_0xaed9('0xe')][_0x151d1d[_0xaed9('0x3f')]]){this[_0xaed9('0xe')][_0x151d1d[_0xaed9('0x3f')]][_0xaed9('0x43')]=_0x151d1d['peerstatus'][_0xaed9('0x2f')]();this[_0xaed9('0xe')][_0x151d1d[_0xaed9('0x3f')]][_0xaed9('0x41')]=_0x151d1d['address'];this[_0xaed9('0x22')](util[_0xaed9('0x2a')](_0xaed9('0x34'),this[_0xaed9('0xe')][_0x151d1d['peer']]['name']),'telephone:save',this['telephones'][_0x151d1d[_0xaed9('0x3f')]]);}else if(this[_0xaed9('0xc')][_0x151d1d['peer']]){this['trunks'][_0x151d1d['peer']][_0xaed9('0x43')]=_0x151d1d[_0xaed9('0x14')][_0xaed9('0x2f')]();this['trunks'][_0x151d1d[_0xaed9('0x3f')]][_0xaed9('0x41')]=_0x151d1d[_0xaed9('0x41')];this[_0xaed9('0x22')](util['format'](_0xaed9('0x2b'),this['trunks'][_0x151d1d['peer']]['name']),'trunk:save',this[_0xaed9('0xc')][_0x151d1d[_0xaed9('0x3f')]]);}else{}}}catch(_0x4b8bb6){logger[_0xaed9('0x1c')](_0xaed9('0x44'),util[_0xaed9('0x1d')](_0x4b8bb6,{'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 f64a2ad..ce43b71 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 _0xc2d6=['rtpaudioqosrttbridged','sipcallid','bridgepeer','membercalls','memberdynamic','memberinterface','memberrealtime','includes','hasOwnProperty','transfer','custom:voiceAgentReport','values','transfereeuniqueid','diff','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','syncBlindTransfer','transfereruniqueid','seconds','[syncBlindTransfer][VoiceAgentReport]','channel','substring','lastIndexOf','[syncMusicOnHoldStart][VoiceAgentReport]','onhold','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','../../../config/logger','redis','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','emit','prototype','isNotNull','isUndefined','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','event','custom:agentcalled','user:%s','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','inspect','connect','holdtime','connectedlinenum','destchannelstate','destchannelstatedesc','destconnectedlinenum','custom:agentconnect','reason','answered_elsewhere','lastevent','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','agentringnoanswerAt','abandoned','custom:agentqueuecallerabandon','agentconnectAt','agentcompleteAt','complete','talktime','agent','agentacw','acwtime','interface','omit','user:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','variable','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt'];(function(_0x51b610,_0x396cdf){var _0x285073=function(_0x44be5f){while(--_0x44be5f){_0x51b610['push'](_0x51b610['shift']());}};_0x285073(++_0x396cdf);}(_0xc2d6,0x1eb));var _0x6c2d=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xc2d6[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x6c2d('0x0'));var moment=require(_0x6c2d('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x6c2d('0x2'))('ami');var ami=require('../ami');config[_0x6c2d('0x3')]=_['defaults'](config['redis'],{'host':_0x6c2d('0x4'),'port':0x18eb});var io=require(_0x6c2d('0x5'))(new Redis(config[_0x6c2d('0x3')]));function VoiceAgentReport(_0x9df9ba){this[_0x6c2d('0x6')]={};this[_0x6c2d('0x7')]=_0x9df9ba[_0x6c2d('0x7')];this[_0x6c2d('0x8')]=_0x9df9ba[_0x6c2d('0x8')];this[_0x6c2d('0x9')]={};ami['on'](_0x6c2d('0xa'),this[_0x6c2d('0xb')][_0x6c2d('0xc')](this));ami['on'](_0x6c2d('0xd'),this['syncAgentConnect']['bind'](this));ami['on'](_0x6c2d('0xe'),this[_0x6c2d('0xf')][_0x6c2d('0xc')](this));ami['on']('queuecallerabandon',this[_0x6c2d('0x10')][_0x6c2d('0xc')](this));ami['on'](_0x6c2d('0x11'),this[_0x6c2d('0x12')][_0x6c2d('0xc')](this));ami['on'](_0x6c2d('0x13'),this[_0x6c2d('0x14')][_0x6c2d('0xc')](this));ami['on'](_0x6c2d('0x15'),this[_0x6c2d('0x16')][_0x6c2d('0xc')](this));ami['on'](_0x6c2d('0x17'),this[_0x6c2d('0x18')][_0x6c2d('0xc')](this));ami['on']('musiconholdstop',this[_0x6c2d('0x19')][_0x6c2d('0xc')](this));ami['on'](_0x6c2d('0x1a'),this[_0x6c2d('0x1b')][_0x6c2d('0xc')](this));ami['on'](_0x6c2d('0x1c'),this['syncBlindTransfer']['bind'](this));}VoiceAgentReport['prototype'][_0x6c2d('0x1d')]=function(_0x38d029,_0x140e4f,_0xd3c5d2){io['to'](_0x38d029)[_0x6c2d('0x1d')](_0x140e4f,_0xd3c5d2);};VoiceAgentReport[_0x6c2d('0x1e')][_0x6c2d('0x1f')]=function(_0x2960f9){return _0x2960f9!==null&&!_[_0x6c2d('0x20')](_0x2960f9);};VoiceAgentReport[_0x6c2d('0x1e')][_0x6c2d('0xb')]=function(_0x565c90){try{if(this[_0x6c2d('0x1f')](_0x565c90)){if(_[_0x6c2d('0x20')](this['channels'][_0x565c90[_0x6c2d('0x21')]])){this[_0x6c2d('0x6')][_0x565c90[_0x6c2d('0x21')]]={};}if(_[_0x6c2d('0x20')](this[_0x6c2d('0x6')][_0x565c90['uniqueid']][_0x565c90['destuniqueid']])){this[_0x6c2d('0x6')][_0x565c90[_0x6c2d('0x21')]][_0x565c90[_0x6c2d('0x22')]]={'agentcalledAt':moment()[_0x6c2d('0x23')](_0x6c2d('0x24')),'lastevent':_0x6c2d('0x25'),'variables':this['variables'][_0x565c90[_0x6c2d('0x21')]],'type':this[_0x6c2d('0x7')][_0x565c90[_0x6c2d('0x26')]]?this[_0x6c2d('0x7')][_0x565c90[_0x6c2d('0x26')]][_0x6c2d('0x27')]||_0x6c2d('0x28'):_0x6c2d('0x28')};}_['merge'](this['channels'][_0x565c90[_0x6c2d('0x21')]][_0x565c90['destuniqueid']],_['omit'](_0x565c90,[_0x6c2d('0x29'),'privilege']));ami[_0x6c2d('0x1d')](_0x6c2d('0x2a'),this[_0x6c2d('0x6')][_0x565c90[_0x6c2d('0x21')]][_0x565c90['destuniqueid']]);this['emit'](util[_0x6c2d('0x23')](_0x6c2d('0x2b'),_0x565c90[_0x6c2d('0x2c')]),_0x6c2d('0x2d'),this[_0x6c2d('0x6')][_0x565c90[_0x6c2d('0x21')]][_0x565c90['destuniqueid']]);}}catch(_0x4f3b4f){logger[_0x6c2d('0x2e')](_0x6c2d('0x2f'),util[_0x6c2d('0x30')](_0x4f3b4f,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentConnect']=function(_0x3679ff){try{if(this[_0x6c2d('0x1f')](_0x3679ff)){if(this[_0x6c2d('0x6')][_0x3679ff['uniqueid']]){for(var _0x2e00d8 in this[_0x6c2d('0x6')][_0x3679ff[_0x6c2d('0x21')]]){if(this[_0x6c2d('0x6')][_0x3679ff[_0x6c2d('0x21')]]['hasOwnProperty'](_0x2e00d8)){if(_0x3679ff[_0x6c2d('0x22')]===_0x2e00d8){this['channels'][_0x3679ff[_0x6c2d('0x21')]][_0x2e00d8]['agentconnectAt']=moment()[_0x6c2d('0x23')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6c2d('0x6')][_0x3679ff['uniqueid']][_0x2e00d8]['lastevent']=_0x6c2d('0x31');this[_0x6c2d('0x6')][_0x3679ff[_0x6c2d('0x21')]][_0x2e00d8][_0x6c2d('0x32')]=_0x3679ff['holdtime'];this[_0x6c2d('0x6')][_0x3679ff['uniqueid']][_0x2e00d8][_0x6c2d('0x33')]=_0x3679ff[_0x6c2d('0x33')];this[_0x6c2d('0x6')][_0x3679ff[_0x6c2d('0x21')]][_0x2e00d8]['connectedlinename']=_0x3679ff['connectedlinename'];this[_0x6c2d('0x6')][_0x3679ff[_0x6c2d('0x21')]][_0x2e00d8][_0x6c2d('0x34')]=_0x3679ff[_0x6c2d('0x34')];this[_0x6c2d('0x6')][_0x3679ff['uniqueid']][_0x2e00d8][_0x6c2d('0x35')]=_0x3679ff[_0x6c2d('0x35')];_['merge'](this[_0x6c2d('0x8')][_0x3679ff['interface']],_['pick'](_0x3679ff,['queue',_0x6c2d('0x36')]));this[_0x6c2d('0x1d')](util[_0x6c2d('0x23')]('user:%s',_0x3679ff['membername']),'user:agentconnect',this[_0x6c2d('0x6')][_0x3679ff['uniqueid']][_0x3679ff[_0x6c2d('0x22')]]);ami['emit'](_0x6c2d('0x37'),this[_0x6c2d('0x6')][_0x3679ff['uniqueid']][_0x2e00d8]);}else if(!this[_0x6c2d('0x6')][_0x3679ff[_0x6c2d('0x21')]][_0x2e00d8]['agentringnoanswer']&&!this[_0x6c2d('0x6')][_0x3679ff[_0x6c2d('0x21')]][_0x2e00d8]['agentcomplete']){this['channels'][_0x3679ff[_0x6c2d('0x21')]][_0x2e00d8]['agentringnoanswer']=!![];this[_0x6c2d('0x6')][_0x3679ff[_0x6c2d('0x21')]][_0x2e00d8]['agentringnoanswerAt']=moment()[_0x6c2d('0x23')](_0x6c2d('0x24'));this['channels'][_0x3679ff[_0x6c2d('0x21')]][_0x2e00d8][_0x6c2d('0x38')]=_0x6c2d('0x39');this[_0x6c2d('0x6')][_0x3679ff[_0x6c2d('0x21')]][_0x2e00d8][_0x6c2d('0x3a')]=_0x6c2d('0x39');this['channels'][_0x3679ff[_0x6c2d('0x21')]][_0x2e00d8][_0x6c2d('0x3b')]=_0x3679ff['destuniqueid'];this[_0x6c2d('0x6')][_0x3679ff['uniqueid']][_0x2e00d8][_0x6c2d('0x3c')]=_0x3679ff[_0x6c2d('0x2c')];ami[_0x6c2d('0x1d')](_0x6c2d('0x3d'),this[_0x6c2d('0x6')][_0x3679ff['uniqueid']][_0x2e00d8]);}}}}}}catch(_0x38dff3){logger[_0x6c2d('0x2e')](_0x6c2d('0x3e'),util[_0x6c2d('0x30')](_0x38dff3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6c2d('0x1e')][_0x6c2d('0xf')]=function(_0x5c981a){try{if(this[_0x6c2d('0x1f')](_0x5c981a)){if(this[_0x6c2d('0x6')][_0x5c981a[_0x6c2d('0x21')]]&&this['channels'][_0x5c981a['uniqueid']][_0x5c981a['destuniqueid']]){this[_0x6c2d('0x6')][_0x5c981a[_0x6c2d('0x21')]][_0x5c981a[_0x6c2d('0x22')]][_0x6c2d('0xe')]=!![];this[_0x6c2d('0x6')][_0x5c981a['uniqueid']][_0x5c981a[_0x6c2d('0x22')]]['agentringnoanswerAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x6c2d('0x6')][_0x5c981a[_0x6c2d('0x21')]][_0x5c981a[_0x6c2d('0x22')]]['reason']='rejected';this[_0x6c2d('0x6')][_0x5c981a[_0x6c2d('0x21')]][_0x5c981a['destuniqueid']]['lastevent']=_0x6c2d('0x3f');ami[_0x6c2d('0x1d')](_0x6c2d('0x40'),this[_0x6c2d('0x6')][_0x5c981a[_0x6c2d('0x21')]][_0x5c981a['destuniqueid']]);}}}catch(_0x2fc5af){logger[_0x6c2d('0x2e')](_0x6c2d('0x41'),util[_0x6c2d('0x30')](_0x2fc5af,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncQueueCallerAbandon']=function(_0x267494){try{if(this[_0x6c2d('0x1f')](_0x267494)){if(this[_0x6c2d('0x6')][_0x267494['uniqueid']]){for(var _0x5af51d in this[_0x6c2d('0x6')][_0x267494[_0x6c2d('0x21')]]){if(this['channels'][_0x267494[_0x6c2d('0x21')]]['hasOwnProperty'](_0x5af51d)&&!this[_0x6c2d('0x6')][_0x267494[_0x6c2d('0x21')]][_0x5af51d][_0x6c2d('0xe')]&&!this['channels'][_0x267494[_0x6c2d('0x21')]][_0x5af51d][_0x6c2d('0x11')]){this[_0x6c2d('0x6')][_0x267494[_0x6c2d('0x21')]][_0x5af51d]['agentringnoanswer']=!![];this['channels'][_0x267494[_0x6c2d('0x21')]][_0x5af51d][_0x6c2d('0x42')]=moment()[_0x6c2d('0x23')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6c2d('0x6')][_0x267494['uniqueid']][_0x5af51d]['reason']=_0x6c2d('0x43');this[_0x6c2d('0x6')][_0x267494['uniqueid']][_0x5af51d]['lastevent']=_0x6c2d('0x43');ami[_0x6c2d('0x1d')](_0x6c2d('0x44'),this['channels'][_0x267494[_0x6c2d('0x21')]][_0x5af51d]);}}}}}catch(_0x3a11d5){logger[_0x6c2d('0x2e')]('[syncQueueCallerAbandon][VoiceAgentReport]',util[_0x6c2d('0x30')](_0x3a11d5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6c2d('0x1e')][_0x6c2d('0x12')]=function(_0x4f56d6){try{if(this['isNotNull'](_0x4f56d6)){if(this[_0x6c2d('0x6')][_0x4f56d6[_0x6c2d('0x21')]]){for(var _0x3e619a in this[_0x6c2d('0x6')][_0x4f56d6[_0x6c2d('0x21')]]){if(this['channels'][_0x4f56d6[_0x6c2d('0x21')]]['hasOwnProperty'](_0x3e619a)){if(this['channels'][_0x4f56d6[_0x6c2d('0x21')]][_0x3e619a][_0x6c2d('0x45')]&&!this[_0x6c2d('0x6')][_0x4f56d6[_0x6c2d('0x21')]][_0x3e619a]['agentcomplete']){this[_0x6c2d('0x6')][_0x4f56d6['uniqueid']][_0x3e619a]['agentcomplete']=!![];this[_0x6c2d('0x6')][_0x4f56d6['uniqueid']][_0x3e619a][_0x6c2d('0x46')]=moment()[_0x6c2d('0x23')](_0x6c2d('0x24'));this[_0x6c2d('0x6')][_0x4f56d6[_0x6c2d('0x21')]][_0x3e619a][_0x6c2d('0x3a')]=_0x6c2d('0x47');this[_0x6c2d('0x6')][_0x4f56d6[_0x6c2d('0x21')]][_0x3e619a][_0x6c2d('0x48')]=_0x4f56d6['talktime'];this[_0x6c2d('0x6')][_0x4f56d6['uniqueid']][_0x3e619a][_0x6c2d('0x38')]=_0x4f56d6[_0x6c2d('0x38')]=='transfer'?_0x6c2d('0x49'):_0x4f56d6[_0x6c2d('0x38')];if(this[_0x6c2d('0x7')][_0x4f56d6['queue']]&&this[_0x6c2d('0x7')][_0x4f56d6[_0x6c2d('0x26')]]['acw']){this['channels'][_0x4f56d6[_0x6c2d('0x21')]][_0x3e619a][_0x6c2d('0x4a')]=!![];this[_0x6c2d('0x6')][_0x4f56d6['uniqueid']][_0x3e619a][_0x6c2d('0x4b')]=this['voiceQueues'][_0x4f56d6[_0x6c2d('0x26')]]['acwTimeout'];}this[_0x6c2d('0x8')][_0x4f56d6[_0x6c2d('0x4c')]]=_[_0x6c2d('0x4d')](this[_0x6c2d('0x8')][_0x4f56d6[_0x6c2d('0x4c')]],['queue',_0x6c2d('0x36')]);this['emit'](util[_0x6c2d('0x23')]('user:%s',_0x4f56d6['membername']),_0x6c2d('0x4e'),this['channels'][_0x4f56d6[_0x6c2d('0x21')]][_0x3e619a]);ami[_0x6c2d('0x1d')]('custom:agentcomplete',this[_0x6c2d('0x6')][_0x4f56d6[_0x6c2d('0x21')]][_0x3e619a]);}}}}}}catch(_0x5de06b){logger[_0x6c2d('0x2e')](_0x6c2d('0x4f'),util[_0x6c2d('0x30')](_0x5de06b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6c2d('0x1e')]['syncVarSet']=function(_0x1eae95){try{if(this[_0x6c2d('0x1f')](_0x1eae95)){this[_0x6c2d('0x50')](_0x1eae95[_0x6c2d('0x21')],_['keys'](_0x1eae95[_0x6c2d('0x51')])[0x0],_0x1eae95['value']);if(this['channels'][_0x1eae95[_0x6c2d('0x21')]]){for(var _0x48c10d in this[_0x6c2d('0x6')][_0x1eae95[_0x6c2d('0x21')]]){if(this['channels'][_0x1eae95['uniqueid']]['hasOwnProperty'](_0x48c10d)){if(_[_0x6c2d('0x20')](this[_0x6c2d('0x6')][_0x1eae95[_0x6c2d('0x21')]][_0x48c10d]['variables'])){this['channels'][_0x1eae95['uniqueid']][_0x48c10d][_0x6c2d('0x9')]={};}this[_0x6c2d('0x6')][_0x1eae95['uniqueid']][_0x48c10d][_0x6c2d('0x9')]=this[_0x6c2d('0x9')][_0x1eae95[_0x6c2d('0x21')]];}}}}}catch(_0x5d01c0){logger[_0x6c2d('0x2e')](_0x6c2d('0x52'),util[_0x6c2d('0x30')](_0x5d01c0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x6c2d('0x50')]=function(_0x9a95a1,_0x173e16,_0x5430ea){var _0x4de132=[_0x6c2d('0x53'),_0x6c2d('0x54'),_0x6c2d('0x55'),'rtpaudioqosjitterbridged',_0x6c2d('0x56'),_0x6c2d('0x57'),_0x6c2d('0x58'),_0x6c2d('0x59'),_0x6c2d('0x5a'),'sipuri',_0x6c2d('0x5b'),'bridgepvtcallid',_0x6c2d('0x5c'),_0x6c2d('0x5d'),_0x6c2d('0x5e'),'memberlastcall','membername','memberpenalty',_0x6c2d('0x5f')];if(!_['isNil'](_0x173e16)&&!_[_0x6c2d('0x60')](_0x4de132,_0x173e16)){if(_[_0x6c2d('0x20')](this['variables'][_0x9a95a1])){this[_0x6c2d('0x9')][_0x9a95a1]={};}this[_0x6c2d('0x9')][_0x9a95a1][_0x173e16]=_0x5430ea;}};VoiceAgentReport['prototype'][_0x6c2d('0x16')]=function(_0x17d071){try{if(this['isNotNull'](_0x17d071)){if(this[_0x6c2d('0x6')][_0x17d071[_0x6c2d('0x21')]]){for(var _0x3dc1d2 in this['channels'][_0x17d071[_0x6c2d('0x21')]]){if(this[_0x6c2d('0x6')][_0x17d071['uniqueid']][_0x6c2d('0x61')](_0x3dc1d2)){if(this[_0x6c2d('0x6')][_0x17d071[_0x6c2d('0x21')]][_0x3dc1d2]['reason']==_0x6c2d('0x62')&&this['channels'][_0x17d071[_0x6c2d('0x21')]][_0x3dc1d2][_0x6c2d('0x11')]){this[_0x6c2d('0x6')][_0x17d071[_0x6c2d('0x21')]][_0x3dc1d2][_0x6c2d('0x46')]=moment()[_0x6c2d('0x23')](_0x6c2d('0x24'));}}}ami[_0x6c2d('0x1d')](_0x6c2d('0x63'),_[_0x6c2d('0x64')](this[_0x6c2d('0x6')][_0x17d071[_0x6c2d('0x21')]]));delete this[_0x6c2d('0x6')][_0x17d071[_0x6c2d('0x21')]];}if(this[_0x6c2d('0x9')][_0x17d071[_0x6c2d('0x21')]]){delete this[_0x6c2d('0x9')][_0x17d071[_0x6c2d('0x21')]];}}}catch(_0x18f395){logger[_0x6c2d('0x2e')]('[syncHangup][VoiceAgentReport]',util['inspect'](_0x18f395,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6c2d('0x1e')][_0x6c2d('0x1b')]=function(_0x3b99e8){try{if(this['isNotNull'](_0x3b99e8)){if(this[_0x6c2d('0x6')][_0x3b99e8[_0x6c2d('0x65')]]){for(var _0x339918 in this['channels'][_0x3b99e8[_0x6c2d('0x65')]]){if(this['channels'][_0x3b99e8[_0x6c2d('0x65')]][_0x6c2d('0x61')](_0x339918)){if(_0x3b99e8['origtransfereruniqueid']===_0x339918){var _0x3514e7=moment();this['channels'][_0x3b99e8['transfereeuniqueid']][_0x339918][_0x6c2d('0x11')]=!![];this['channels'][_0x3b99e8['transfereeuniqueid']][_0x339918]['agentcompleteAt']=moment()[_0x6c2d('0x23')](_0x6c2d('0x24'));this[_0x6c2d('0x6')][_0x3b99e8[_0x6c2d('0x65')]][_0x339918][_0x6c2d('0x38')]=_0x6c2d('0x62');this[_0x6c2d('0x6')][_0x3b99e8['transfereeuniqueid']][_0x339918][_0x6c2d('0x3a')]='complete';this[_0x6c2d('0x6')][_0x3b99e8[_0x6c2d('0x65')]][_0x339918][_0x6c2d('0x48')]=_0x3514e7[_0x6c2d('0x66')](this[_0x6c2d('0x6')][_0x3b99e8['transfereeuniqueid']][_0x339918]['agentconnectAt'],'seconds');}}}}if(this[_0x6c2d('0x6')][_0x3b99e8[_0x6c2d('0x67')]]){var _0x2543ba=this[_0x6c2d('0x6')][_0x3b99e8[_0x6c2d('0x67')]];this[_0x6c2d('0x6')][_0x3b99e8[_0x6c2d('0x67')]]=this[_0x6c2d('0x6')][_0x3b99e8[_0x6c2d('0x65')]];this[_0x6c2d('0x6')][_0x3b99e8['transfereeuniqueid']]=_0x2543ba;}}}catch(_0x4d298e){logger[_0x6c2d('0x2e')](_0x6c2d('0x68'),util['inspect'](_0x4d298e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6c2d('0x1e')][_0x6c2d('0x69')]=function(_0x7e6560){try{if(this[_0x6c2d('0x1f')](_0x7e6560)){if(this[_0x6c2d('0x6')][_0x7e6560['transfereeuniqueid']]){for(var _0x4bf65c in this[_0x6c2d('0x6')][_0x7e6560[_0x6c2d('0x65')]]){if(this[_0x6c2d('0x6')][_0x7e6560[_0x6c2d('0x65')]][_0x6c2d('0x61')](_0x4bf65c)){if(_0x7e6560[_0x6c2d('0x6a')]===_0x4bf65c){var _0x5596de=moment();this['channels'][_0x7e6560[_0x6c2d('0x65')]][_0x4bf65c][_0x6c2d('0x11')]=!![];this[_0x6c2d('0x6')][_0x7e6560['transfereeuniqueid']][_0x4bf65c][_0x6c2d('0x46')]=_0x5596de;this[_0x6c2d('0x6')][_0x7e6560[_0x6c2d('0x65')]][_0x4bf65c][_0x6c2d('0x38')]=_0x6c2d('0x62');this[_0x6c2d('0x6')][_0x7e6560[_0x6c2d('0x65')]][_0x4bf65c][_0x6c2d('0x3a')]=_0x6c2d('0x47');this['channels'][_0x7e6560[_0x6c2d('0x65')]][_0x4bf65c]['talktime']=_0x5596de[_0x6c2d('0x66')](this[_0x6c2d('0x6')][_0x7e6560[_0x6c2d('0x65')]][_0x4bf65c]['agentconnectAt'],_0x6c2d('0x6b'));}}}}}}catch(_0x487146){logger[_0x6c2d('0x2e')](_0x6c2d('0x6c'),util['inspect'](_0x487146,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x6c2d('0x18')]=function(_0x27a478){var _0x5123f2='';try{if(this['isNotNull'](_0x27a478)){if(_0x27a478[_0x6c2d('0x6d')]){_0x5123f2=_0x27a478['channel'][_0x6c2d('0x6e')](0x0,_0x27a478[_0x6c2d('0x6d')][_0x6c2d('0x6f')]('-'));if(this['agents'][_0x5123f2]){this[_0x6c2d('0x8')][_0x5123f2]['onhold']=!![];}}}}catch(_0xe72fa2){logger[_0x6c2d('0x2e')](_0x6c2d('0x70'),util[_0x6c2d('0x30')](_0xe72fa2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6c2d('0x1e')][_0x6c2d('0x19')]=function(_0x4a672e){var _0x24f9bf='';try{if(this[_0x6c2d('0x1f')](_0x4a672e)){if(_0x4a672e['channel']){_0x24f9bf=_0x4a672e[_0x6c2d('0x6d')][_0x6c2d('0x6e')](0x0,_0x4a672e[_0x6c2d('0x6d')][_0x6c2d('0x6f')]('-'));if(this['agents'][_0x24f9bf]){this['agents'][_0x24f9bf][_0x6c2d('0x71')]=![];}}}}catch(_0x437ef2){logger[_0x6c2d('0x2e')](_0x6c2d('0x72'),util[_0x6c2d('0x30')](_0x437ef2,{'showHidden':![],'depth':null}));}};module[_0x6c2d('0x73')]=VoiceAgentReport; \ No newline at end of file +var _0x0947=['hasOwnProperty','agentconnectAt','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','destconnectedlinenum','user:agentconnect','custom:agentconnect','agentringnoanswer','agentringnoanswerAt','YYYY-MM-DD\x20HH:mm:ss','reason','answered_elsewhere','answeredelsewheremembername','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','syncQueueCallerAbandon','abandoned','agentcompleteAt','complete','talktime','transfer','agent','acw','agentacw','acwtime','user:agentcomplete','variable','value','[syncVarSet][VoiceAgentReport]','addVariable','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','includes','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','syncBlindTransfer','transfereruniqueid','channel','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','syncMusicOnHoldStop','[syncMusicOnHoldStop][VoiceAgentReport]','lodash','ioredis','../../../config/logger','ami','../ami','redis','socket.io-emitter','voiceQueues','agents','variables','syncAgentCalled','bind','agentconnect','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','syncAgentComplete','syncVarSet','syncHangup','musiconholdstart','syncMusicOnHoldStart','syncAttendedTransfer','blindtransfer','emit','prototype','isUndefined','isNotNull','uniqueid','channels','destuniqueid','called','queue','type','inbound','merge','omit','format','user:%s','membername','error','[syncAgentCalled][VoiceAgentReport]','inspect'];(function(_0x5b937a,_0x39f066){var _0x13630f=function(_0x40e028){while(--_0x40e028){_0x5b937a['push'](_0x5b937a['shift']());}};_0x13630f(++_0x39f066);}(_0x0947,0x1ad));var _0x7094=function(_0x162679,_0x3c7657){_0x162679=_0x162679-0x0;var _0x2e9fee=_0x0947[_0x162679];return _0x2e9fee;};'use strict';var _=require(_0x7094('0x0'));var moment=require('moment');var util=require('util');var Redis=require(_0x7094('0x1'));var config=require('../../../config/environment');var logger=require(_0x7094('0x2'))(_0x7094('0x3'));var ami=require(_0x7094('0x4'));config[_0x7094('0x5')]=_['defaults'](config[_0x7094('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x7094('0x6'))(new Redis(config[_0x7094('0x5')]));function VoiceAgentReport(_0x16a2cf){this['channels']={};this[_0x7094('0x7')]=_0x16a2cf[_0x7094('0x7')];this[_0x7094('0x8')]=_0x16a2cf[_0x7094('0x8')];this[_0x7094('0x9')]={};ami['on']('agentcalled',this[_0x7094('0xa')][_0x7094('0xb')](this));ami['on'](_0x7094('0xc'),this[_0x7094('0xd')][_0x7094('0xb')](this));ami['on']('agentringnoanswer',this[_0x7094('0xe')][_0x7094('0xb')](this));ami['on'](_0x7094('0xf'),this['syncQueueCallerAbandon'][_0x7094('0xb')](this));ami['on'](_0x7094('0x10'),this[_0x7094('0x11')]['bind'](this));ami['on']('varset',this[_0x7094('0x12')][_0x7094('0xb')](this));ami['on']('hangup',this[_0x7094('0x13')][_0x7094('0xb')](this));ami['on'](_0x7094('0x14'),this[_0x7094('0x15')][_0x7094('0xb')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0x7094('0xb')](this));ami['on']('attendedtransfer',this[_0x7094('0x16')][_0x7094('0xb')](this));ami['on'](_0x7094('0x17'),this['syncBlindTransfer'][_0x7094('0xb')](this));}VoiceAgentReport['prototype'][_0x7094('0x18')]=function(_0x43dc79,_0x27f6f3,_0x408cce){io['to'](_0x43dc79)[_0x7094('0x18')](_0x27f6f3,_0x408cce);};VoiceAgentReport[_0x7094('0x19')]['isNotNull']=function(_0x1ffa1d){return _0x1ffa1d!==null&&!_[_0x7094('0x1a')](_0x1ffa1d);};VoiceAgentReport[_0x7094('0x19')]['syncAgentCalled']=function(_0x59a66c){try{if(this[_0x7094('0x1b')](_0x59a66c)){if(_[_0x7094('0x1a')](this['channels'][_0x59a66c[_0x7094('0x1c')]])){this[_0x7094('0x1d')][_0x59a66c['uniqueid']]={};}if(_[_0x7094('0x1a')](this[_0x7094('0x1d')][_0x59a66c[_0x7094('0x1c')]][_0x59a66c[_0x7094('0x1e')]])){this[_0x7094('0x1d')][_0x59a66c[_0x7094('0x1c')]][_0x59a66c[_0x7094('0x1e')]]={'agentcalledAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x7094('0x1f'),'variables':this['variables'][_0x59a66c[_0x7094('0x1c')]],'type':this[_0x7094('0x7')][_0x59a66c[_0x7094('0x20')]]?this['voiceQueues'][_0x59a66c[_0x7094('0x20')]][_0x7094('0x21')]||_0x7094('0x22'):_0x7094('0x22')};}_[_0x7094('0x23')](this['channels'][_0x59a66c['uniqueid']][_0x59a66c[_0x7094('0x1e')]],_[_0x7094('0x24')](_0x59a66c,['event','privilege']));ami[_0x7094('0x18')]('custom:agentcalled',this[_0x7094('0x1d')][_0x59a66c['uniqueid']][_0x59a66c['destuniqueid']]);this['emit'](util[_0x7094('0x25')](_0x7094('0x26'),_0x59a66c[_0x7094('0x27')]),'user:called',this[_0x7094('0x1d')][_0x59a66c[_0x7094('0x1c')]][_0x59a66c['destuniqueid']]);}}catch(_0x12e521){logger[_0x7094('0x28')](_0x7094('0x29'),util[_0x7094('0x2a')](_0x12e521,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7094('0x19')]['syncAgentConnect']=function(_0x13e8d5){try{if(this[_0x7094('0x1b')](_0x13e8d5)){if(this['channels'][_0x13e8d5['uniqueid']]){for(var _0x62082b in this[_0x7094('0x1d')][_0x13e8d5[_0x7094('0x1c')]]){if(this[_0x7094('0x1d')][_0x13e8d5['uniqueid']][_0x7094('0x2b')](_0x62082b)){if(_0x13e8d5[_0x7094('0x1e')]===_0x62082b){this['channels'][_0x13e8d5['uniqueid']][_0x62082b][_0x7094('0x2c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x7094('0x1d')][_0x13e8d5['uniqueid']][_0x62082b][_0x7094('0x2d')]=_0x7094('0x2e');this['channels'][_0x13e8d5[_0x7094('0x1c')]][_0x62082b][_0x7094('0x2f')]=_0x13e8d5['holdtime'];this[_0x7094('0x1d')][_0x13e8d5[_0x7094('0x1c')]][_0x62082b][_0x7094('0x30')]=_0x13e8d5[_0x7094('0x30')];this['channels'][_0x13e8d5[_0x7094('0x1c')]][_0x62082b][_0x7094('0x31')]=_0x13e8d5['connectedlinename'];this[_0x7094('0x1d')][_0x13e8d5['uniqueid']][_0x62082b][_0x7094('0x32')]=_0x13e8d5[_0x7094('0x32')];this['channels'][_0x13e8d5[_0x7094('0x1c')]][_0x62082b]['destchannelstatedesc']=_0x13e8d5[_0x7094('0x33')];_[_0x7094('0x23')](this['agents'][_0x13e8d5[_0x7094('0x34')]],_[_0x7094('0x35')](_0x13e8d5,[_0x7094('0x20'),_0x7094('0x36')]));this[_0x7094('0x18')](util['format'](_0x7094('0x26'),_0x13e8d5['membername']),_0x7094('0x37'),this['channels'][_0x13e8d5[_0x7094('0x1c')]][_0x13e8d5[_0x7094('0x1e')]]);ami[_0x7094('0x18')](_0x7094('0x38'),this[_0x7094('0x1d')][_0x13e8d5[_0x7094('0x1c')]][_0x62082b]);}else if(!this[_0x7094('0x1d')][_0x13e8d5[_0x7094('0x1c')]][_0x62082b][_0x7094('0x39')]&&!this[_0x7094('0x1d')][_0x13e8d5[_0x7094('0x1c')]][_0x62082b]['agentcomplete']){this[_0x7094('0x1d')][_0x13e8d5[_0x7094('0x1c')]][_0x62082b]['agentringnoanswer']=!![];this[_0x7094('0x1d')][_0x13e8d5[_0x7094('0x1c')]][_0x62082b][_0x7094('0x3a')]=moment()[_0x7094('0x25')](_0x7094('0x3b'));this[_0x7094('0x1d')][_0x13e8d5[_0x7094('0x1c')]][_0x62082b][_0x7094('0x3c')]=_0x7094('0x3d');this[_0x7094('0x1d')][_0x13e8d5[_0x7094('0x1c')]][_0x62082b][_0x7094('0x2d')]=_0x7094('0x3d');this[_0x7094('0x1d')][_0x13e8d5[_0x7094('0x1c')]][_0x62082b]['answeredelsewheredestinationuniqueid']=_0x13e8d5['destuniqueid'];this[_0x7094('0x1d')][_0x13e8d5['uniqueid']][_0x62082b][_0x7094('0x3e')]=_0x13e8d5[_0x7094('0x27')];ami[_0x7094('0x18')](_0x7094('0x3f'),this['channels'][_0x13e8d5[_0x7094('0x1c')]][_0x62082b]);}}}}}}catch(_0x32fde5){logger[_0x7094('0x28')](_0x7094('0x40'),util[_0x7094('0x2a')](_0x32fde5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7094('0x19')][_0x7094('0xe')]=function(_0xe2db6f){try{if(this['isNotNull'](_0xe2db6f)){if(this['channels'][_0xe2db6f[_0x7094('0x1c')]]&&this[_0x7094('0x1d')][_0xe2db6f['uniqueid']][_0xe2db6f[_0x7094('0x1e')]]){this[_0x7094('0x1d')][_0xe2db6f['uniqueid']][_0xe2db6f[_0x7094('0x1e')]][_0x7094('0x39')]=!![];this[_0x7094('0x1d')][_0xe2db6f[_0x7094('0x1c')]][_0xe2db6f['destuniqueid']]['agentringnoanswerAt']=moment()['format'](_0x7094('0x3b'));this[_0x7094('0x1d')][_0xe2db6f[_0x7094('0x1c')]][_0xe2db6f['destuniqueid']][_0x7094('0x3c')]=_0x7094('0x41');this['channels'][_0xe2db6f[_0x7094('0x1c')]][_0xe2db6f['destuniqueid']][_0x7094('0x2d')]='rejected';ami[_0x7094('0x18')](_0x7094('0x42'),this['channels'][_0xe2db6f[_0x7094('0x1c')]][_0xe2db6f[_0x7094('0x1e')]]);}}}catch(_0x804bca){logger['error'](_0x7094('0x43'),util[_0x7094('0x2a')](_0x804bca,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x7094('0x44')]=function(_0x8ebd68){try{if(this[_0x7094('0x1b')](_0x8ebd68)){if(this['channels'][_0x8ebd68[_0x7094('0x1c')]]){for(var _0x528e4d in this['channels'][_0x8ebd68[_0x7094('0x1c')]]){if(this[_0x7094('0x1d')][_0x8ebd68[_0x7094('0x1c')]][_0x7094('0x2b')](_0x528e4d)&&!this[_0x7094('0x1d')][_0x8ebd68['uniqueid']][_0x528e4d][_0x7094('0x39')]&&!this[_0x7094('0x1d')][_0x8ebd68[_0x7094('0x1c')]][_0x528e4d][_0x7094('0x10')]){this[_0x7094('0x1d')][_0x8ebd68[_0x7094('0x1c')]][_0x528e4d]['agentringnoanswer']=!![];this['channels'][_0x8ebd68['uniqueid']][_0x528e4d][_0x7094('0x3a')]=moment()[_0x7094('0x25')](_0x7094('0x3b'));this['channels'][_0x8ebd68[_0x7094('0x1c')]][_0x528e4d][_0x7094('0x3c')]=_0x7094('0x45');this[_0x7094('0x1d')][_0x8ebd68[_0x7094('0x1c')]][_0x528e4d][_0x7094('0x2d')]=_0x7094('0x45');ami[_0x7094('0x18')]('custom:agentqueuecallerabandon',this['channels'][_0x8ebd68['uniqueid']][_0x528e4d]);}}}}}catch(_0x5543fd){logger[_0x7094('0x28')]('[syncQueueCallerAbandon][VoiceAgentReport]',util[_0x7094('0x2a')](_0x5543fd,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7094('0x19')]['syncAgentComplete']=function(_0x1fde0c){try{if(this['isNotNull'](_0x1fde0c)){if(this['channels'][_0x1fde0c['uniqueid']]){for(var _0x1effbf in this[_0x7094('0x1d')][_0x1fde0c['uniqueid']]){if(this[_0x7094('0x1d')][_0x1fde0c[_0x7094('0x1c')]][_0x7094('0x2b')](_0x1effbf)){if(this[_0x7094('0x1d')][_0x1fde0c[_0x7094('0x1c')]][_0x1effbf][_0x7094('0x2c')]&&!this[_0x7094('0x1d')][_0x1fde0c[_0x7094('0x1c')]][_0x1effbf][_0x7094('0x10')]){this['channels'][_0x1fde0c[_0x7094('0x1c')]][_0x1effbf]['agentcomplete']=!![];this[_0x7094('0x1d')][_0x1fde0c[_0x7094('0x1c')]][_0x1effbf][_0x7094('0x46')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x1fde0c['uniqueid']][_0x1effbf][_0x7094('0x2d')]=_0x7094('0x47');this[_0x7094('0x1d')][_0x1fde0c[_0x7094('0x1c')]][_0x1effbf][_0x7094('0x48')]=_0x1fde0c['talktime'];this[_0x7094('0x1d')][_0x1fde0c[_0x7094('0x1c')]][_0x1effbf][_0x7094('0x3c')]=_0x1fde0c[_0x7094('0x3c')]==_0x7094('0x49')?_0x7094('0x4a'):_0x1fde0c[_0x7094('0x3c')];if(this['voiceQueues'][_0x1fde0c[_0x7094('0x20')]]&&this[_0x7094('0x7')][_0x1fde0c[_0x7094('0x20')]][_0x7094('0x4b')]){this[_0x7094('0x1d')][_0x1fde0c[_0x7094('0x1c')]][_0x1effbf][_0x7094('0x4c')]=!![];this[_0x7094('0x1d')][_0x1fde0c['uniqueid']][_0x1effbf][_0x7094('0x4d')]=this[_0x7094('0x7')][_0x1fde0c[_0x7094('0x20')]]['acwTimeout'];}this[_0x7094('0x8')][_0x1fde0c[_0x7094('0x34')]]=_['omit'](this['agents'][_0x1fde0c['interface']],['queue',_0x7094('0x36')]);this[_0x7094('0x18')](util[_0x7094('0x25')](_0x7094('0x26'),_0x1fde0c[_0x7094('0x27')]),_0x7094('0x4e'),this[_0x7094('0x1d')][_0x1fde0c['uniqueid']][_0x1effbf]);ami[_0x7094('0x18')]('custom:agentcomplete',this[_0x7094('0x1d')][_0x1fde0c['uniqueid']][_0x1effbf]);}}}}}}catch(_0x4cc859){logger[_0x7094('0x28')]('[syncAgentComplete][VoiceAgentReport]',util[_0x7094('0x2a')](_0x4cc859,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x7094('0x12')]=function(_0x32ac4c){try{if(this[_0x7094('0x1b')](_0x32ac4c)){this['addVariable'](_0x32ac4c[_0x7094('0x1c')],_['keys'](_0x32ac4c[_0x7094('0x4f')])[0x0],_0x32ac4c[_0x7094('0x50')]);if(this['channels'][_0x32ac4c[_0x7094('0x1c')]]){for(var _0x7976c5 in this[_0x7094('0x1d')][_0x32ac4c[_0x7094('0x1c')]]){if(this['channels'][_0x32ac4c[_0x7094('0x1c')]]['hasOwnProperty'](_0x7976c5)){if(_[_0x7094('0x1a')](this[_0x7094('0x1d')][_0x32ac4c[_0x7094('0x1c')]][_0x7976c5][_0x7094('0x9')])){this['channels'][_0x32ac4c[_0x7094('0x1c')]][_0x7976c5][_0x7094('0x9')]={};}this['channels'][_0x32ac4c[_0x7094('0x1c')]][_0x7976c5]['variables']=this[_0x7094('0x9')][_0x32ac4c[_0x7094('0x1c')]];}}}}}catch(_0x16c651){logger['error'](_0x7094('0x51'),util['inspect'](_0x16c651,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7094('0x19')][_0x7094('0x52')]=function(_0x5335c6,_0x32f2cf,_0x550760){var _0x3e1f50=[_0x7094('0x53'),'rtpaudioqosbridged',_0x7094('0x54'),_0x7094('0x55'),_0x7094('0x56'),_0x7094('0x57'),_0x7094('0x58'),_0x7094('0x59'),_0x7094('0x5a'),_0x7094('0x5b'),_0x7094('0x5c'),_0x7094('0x5d'),_0x7094('0x5e'),_0x7094('0x5f'),_0x7094('0x60'),_0x7094('0x61'),_0x7094('0x27'),_0x7094('0x62'),'memberrealtime'];if(!_[_0x7094('0x63')](_0x32f2cf)&&!_[_0x7094('0x64')](_0x3e1f50,_0x32f2cf)){if(_[_0x7094('0x1a')](this['variables'][_0x5335c6])){this[_0x7094('0x9')][_0x5335c6]={};}this['variables'][_0x5335c6][_0x32f2cf]=_0x550760;}};VoiceAgentReport['prototype'][_0x7094('0x13')]=function(_0x550e1a){try{if(this[_0x7094('0x1b')](_0x550e1a)){if(this[_0x7094('0x1d')][_0x550e1a[_0x7094('0x1c')]]){for(var _0x1e8636 in this[_0x7094('0x1d')][_0x550e1a[_0x7094('0x1c')]]){if(this[_0x7094('0x1d')][_0x550e1a[_0x7094('0x1c')]][_0x7094('0x2b')](_0x1e8636)){if(this[_0x7094('0x1d')][_0x550e1a['uniqueid']][_0x1e8636][_0x7094('0x3c')]=='transfer'&&this['channels'][_0x550e1a[_0x7094('0x1c')]][_0x1e8636][_0x7094('0x10')]){this[_0x7094('0x1d')][_0x550e1a[_0x7094('0x1c')]][_0x1e8636]['agentcompleteAt']=moment()['format'](_0x7094('0x3b'));}}}ami[_0x7094('0x18')](_0x7094('0x65'),_[_0x7094('0x66')](this[_0x7094('0x1d')][_0x550e1a['uniqueid']]));delete this[_0x7094('0x1d')][_0x550e1a[_0x7094('0x1c')]];}if(this['variables'][_0x550e1a['uniqueid']]){delete this[_0x7094('0x9')][_0x550e1a[_0x7094('0x1c')]];}}}catch(_0x2dd4c5){logger[_0x7094('0x28')](_0x7094('0x67'),util[_0x7094('0x2a')](_0x2dd4c5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7094('0x19')]['syncAttendedTransfer']=function(_0x3b77c1){try{if(this['isNotNull'](_0x3b77c1)){if(this[_0x7094('0x1d')][_0x3b77c1['transfereeuniqueid']]){for(var _0x4312ac in this[_0x7094('0x1d')][_0x3b77c1[_0x7094('0x68')]]){if(this[_0x7094('0x1d')][_0x3b77c1['transfereeuniqueid']]['hasOwnProperty'](_0x4312ac)){if(_0x3b77c1[_0x7094('0x69')]===_0x4312ac){var _0x586138=moment();this[_0x7094('0x1d')][_0x3b77c1[_0x7094('0x68')]][_0x4312ac][_0x7094('0x10')]=!![];this[_0x7094('0x1d')][_0x3b77c1['transfereeuniqueid']][_0x4312ac][_0x7094('0x46')]=moment()[_0x7094('0x25')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7094('0x1d')][_0x3b77c1['transfereeuniqueid']][_0x4312ac][_0x7094('0x3c')]=_0x7094('0x49');this['channels'][_0x3b77c1[_0x7094('0x68')]][_0x4312ac][_0x7094('0x2d')]=_0x7094('0x47');this['channels'][_0x3b77c1[_0x7094('0x68')]][_0x4312ac][_0x7094('0x48')]=_0x586138[_0x7094('0x6a')](this['channels'][_0x3b77c1['transfereeuniqueid']][_0x4312ac]['agentconnectAt'],_0x7094('0x6b'));}}}}if(this['channels'][_0x3b77c1[_0x7094('0x6c')]]){var _0x2ce8b6=this[_0x7094('0x1d')][_0x3b77c1[_0x7094('0x6c')]];this['channels'][_0x3b77c1['secondtransfereruniqueid']]=this[_0x7094('0x1d')][_0x3b77c1[_0x7094('0x68')]];this[_0x7094('0x1d')][_0x3b77c1['transfereeuniqueid']]=_0x2ce8b6;}}}catch(_0x38cc0d){logger[_0x7094('0x28')](_0x7094('0x6d'),util[_0x7094('0x2a')](_0x38cc0d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x7094('0x6e')]=function(_0xfb0424){try{if(this['isNotNull'](_0xfb0424)){if(this[_0x7094('0x1d')][_0xfb0424[_0x7094('0x68')]]){for(var _0x491314 in this[_0x7094('0x1d')][_0xfb0424[_0x7094('0x68')]]){if(this['channels'][_0xfb0424[_0x7094('0x68')]][_0x7094('0x2b')](_0x491314)){if(_0xfb0424[_0x7094('0x6f')]===_0x491314){var _0x2460ee=moment();this[_0x7094('0x1d')][_0xfb0424[_0x7094('0x68')]][_0x491314][_0x7094('0x10')]=!![];this[_0x7094('0x1d')][_0xfb0424[_0x7094('0x68')]][_0x491314][_0x7094('0x46')]=_0x2460ee;this[_0x7094('0x1d')][_0xfb0424[_0x7094('0x68')]][_0x491314][_0x7094('0x3c')]=_0x7094('0x49');this[_0x7094('0x1d')][_0xfb0424[_0x7094('0x68')]][_0x491314][_0x7094('0x2d')]=_0x7094('0x47');this[_0x7094('0x1d')][_0xfb0424[_0x7094('0x68')]][_0x491314][_0x7094('0x48')]=_0x2460ee[_0x7094('0x6a')](this[_0x7094('0x1d')][_0xfb0424[_0x7094('0x68')]][_0x491314][_0x7094('0x2c')],_0x7094('0x6b'));}}}}}}catch(_0x595087){logger[_0x7094('0x28')]('[syncBlindTransfer][VoiceAgentReport]',util[_0x7094('0x2a')](_0x595087,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7094('0x19')][_0x7094('0x15')]=function(_0x328b39){var _0x4fc57a='';try{if(this[_0x7094('0x1b')](_0x328b39)){if(_0x328b39[_0x7094('0x70')]){_0x4fc57a=_0x328b39[_0x7094('0x70')]['substring'](0x0,_0x328b39[_0x7094('0x70')][_0x7094('0x71')]('-'));if(this[_0x7094('0x8')][_0x4fc57a]){this[_0x7094('0x8')][_0x4fc57a][_0x7094('0x72')]=!![];}}}}catch(_0x161431){logger[_0x7094('0x28')](_0x7094('0x73'),util[_0x7094('0x2a')](_0x161431,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x7094('0x74')]=function(_0x2cb97d){var _0xaf67a7='';try{if(this[_0x7094('0x1b')](_0x2cb97d)){if(_0x2cb97d[_0x7094('0x70')]){_0xaf67a7=_0x2cb97d['channel']['substring'](0x0,_0x2cb97d[_0x7094('0x70')][_0x7094('0x71')]('-'));if(this['agents'][_0xaf67a7]){this[_0x7094('0x8')][_0xaf67a7]['onhold']=![];}}}}catch(_0x41bb31){logger['error'](_0x7094('0x75'),util[_0x7094('0x2a')](_0x41bb31,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index aef39a3..f5435a3 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 _0x59cf=['split','destconnectedlinenum','exten','format','user:%s','name','user:agentconnect','[syncNewChannel][VoiceCallReport]','inspect','application','toLowerCase','applicationdata','appdata','duration','subtract','seconds','merge','includes','lastdata','startsWith','cdr(','match','[syncNewExten][VoiceCallReport]','syncNewState','channelstate','answered','diff','calleridnum','connectedlinenum','connectedlinename','calleridname','destinationchannel','membername','UserId','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','isNil','push','variable','mixmonitor_filename','value','xmd-callerid','callerid','xmd-cdrtype','xmd-queue','xmd-destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcalluniqueid','parse','sipcallid','sipcalllinkedid','[syncVarSet][VoiceCallReport]','answertime','holdtime','billableseconds','context','omit','user:agentcomplete','accountcode','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfercalleridnum','origtransferercalleridnum','transfereeuniqueid','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transferconnectedlinenum','extension','BlindTransfer','[syncBlindTransfer][VoiceCallReport]','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','syncMusicOnHoldStop','[syncMusicOnHoldStop][VoiceCallReport]','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','not_inuse','invalid','unavailable','ringing','ringinuse','onhold','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','resolve','actionCoreShowChannels','catch','log','prototype','isNotNull','isUndefined','emit','linkedid','uniqueid','pick','keys','error','[syncNewCallerId][VoiceCallReport]','channel','OutgoingSpoolFailed','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','from-sip'];(function(_0x2f2dd0,_0x242127){var _0x3c48d1=function(_0x4516b1){while(--_0x4516b1){_0x2f2dd0['push'](_0x2f2dd0['shift']());}};_0x3c48d1(++_0x242127);}(_0x59cf,0xf7));var _0xf59c=function(_0x1cc961,_0x2c42ee){_0x1cc961=_0x1cc961-0x0;var _0x471d86=_0x59cf[_0x1cc961];return _0x471d86;};'use strict';var BPromise=require(_0xf59c('0x0'));var _=require(_0xf59c('0x1'));var moment=require(_0xf59c('0x2'));var util=require(_0xf59c('0x3'));var path=require(_0xf59c('0x4'));var Redis=require(_0xf59c('0x5'));var config=require(_0xf59c('0x6'));var logger=require(_0xf59c('0x7'))(_0xf59c('0x8'));var ami=require(_0xf59c('0x9'));var Channel=require(_0xf59c('0xa'));var statusDesc=[_0xf59c('0xb'),_0xf59c('0xc'),'inuse','busy',_0xf59c('0xd'),_0xf59c('0xe'),_0xf59c('0xf'),_0xf59c('0x10'),_0xf59c('0x11')];var applications=[_0xf59c('0x12'),_0xf59c('0x13'),_0xf59c('0x14'),_0xf59c('0x15'),_0xf59c('0x16'),_0xf59c('0x17')];var dispositions=[_0xf59c('0x18'),_0xf59c('0x19'),_0xf59c('0x19'),_0xf59c('0x18'),_0xf59c('0x18'),_0xf59c('0x18'),_0xf59c('0x1a'),_0xf59c('0x1b'),_0xf59c('0x19'),_0xf59c('0x19'),_0xf59c('0x19')];var actions={};config[_0xf59c('0x1c')]=_[_0xf59c('0x1d')](config[_0xf59c('0x1c')],{'host':'localhost','port':0x18eb});var io=require(_0xf59c('0x1e'))(new Redis(config[_0xf59c('0x1c')]));function VoiceCallReport(_0x3c6a9d){this['channels']=_0x3c6a9d[_0xf59c('0x1f')];this[_0xf59c('0x20')]=_0x3c6a9d[_0xf59c('0x20')];ami['on'](_0xf59c('0x21'),this[_0xf59c('0x22')][_0xf59c('0x23')](this));ami['on'](_0xf59c('0x24'),this[_0xf59c('0x22')]['bind'](this));ami['on'](_0xf59c('0x25'),this[_0xf59c('0x26')][_0xf59c('0x23')](this));ami['on']('newstate',this['syncNewState'][_0xf59c('0x23')](this));ami['on'](_0xf59c('0x27'),this[_0xf59c('0x28')][_0xf59c('0x23')](this));ami['on'](_0xf59c('0x29'),this[_0xf59c('0x2a')][_0xf59c('0x23')](this));ami['on'](_0xf59c('0x2b'),this[_0xf59c('0x2c')]['bind'](this));ami['on'](_0xf59c('0x2d'),this[_0xf59c('0x2e')][_0xf59c('0x23')](this));ami['on'](_0xf59c('0x2f'),this[_0xf59c('0x30')][_0xf59c('0x23')](this));ami['on'](_0xf59c('0x31'),this[_0xf59c('0x32')][_0xf59c('0x23')](this));ami['on'](_0xf59c('0x33'),this['syncMusicOnHoldStop'][_0xf59c('0x23')](this));return BPromise[_0xf59c('0x34')]()['then'](ami[_0xf59c('0x35')]())[_0xf59c('0x36')](function(_0xf95f80){console[_0xf59c('0x37')](_0xf95f80);});}VoiceCallReport[_0xf59c('0x38')][_0xf59c('0x39')]=function(_0x3c0521){return _0x3c0521!==null&&!_[_0xf59c('0x3a')](_0x3c0521);};VoiceCallReport[_0xf59c('0x38')]['emit']=function(_0x9d4a0a,_0x514906,_0x2c3108){io['to'](_0x9d4a0a)[_0xf59c('0x3b')](_0x514906,_0x2c3108);};VoiceCallReport[_0xf59c('0x38')][_0xf59c('0x2c')]=function(_0x1aa41b){try{if(this[_0xf59c('0x39')](_0x1aa41b)){if(_0x1aa41b['uniqueid']===_0x1aa41b[_0xf59c('0x3c')]){if(!_[_0xf59c('0x3a')](this[_0xf59c('0x1f')][_0x1aa41b[_0xf59c('0x3d')]])){_['merge'](this[_0xf59c('0x1f')][_0x1aa41b[_0xf59c('0x3d')]],_[_0xf59c('0x3e')](_0x1aa41b,_[_0xf59c('0x3f')](this[_0xf59c('0x1f')][_0x1aa41b[_0xf59c('0x3d')]])));}}}}catch(_0x57a2ae){logger[_0xf59c('0x40')](_0xf59c('0x41'),util['inspect'](_0x57a2ae,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf59c('0x38')][_0xf59c('0x26')]=function(_0x548db5){try{if(this[_0xf59c('0x39')](_0x548db5)){if(_0x548db5[_0xf59c('0x3d')]===_0x548db5[_0xf59c('0x3c')]&&_0x548db5[_0xf59c('0x42')]!=_0xf59c('0x43')){if(_[_0xf59c('0x3a')](this['channels'][_0x548db5[_0xf59c('0x3d')]])){this[_0xf59c('0x1f')][_0x548db5[_0xf59c('0x3d')]]=new Channel();this[_0xf59c('0x1f')][_0x548db5[_0xf59c('0x3d')]][_0xf59c('0x44')]=moment()['format'](_0xf59c('0x45'));this[_0xf59c('0x1f')][_0x548db5[_0xf59c('0x3d')]][_0xf59c('0x46')]=dispositions[_[_0xf59c('0x47')](_0x548db5['channelstate'])];_['merge'](this[_0xf59c('0x1f')][_0x548db5['uniqueid']],_['pick'](_0x548db5,_[_0xf59c('0x3f')](this[_0xf59c('0x1f')][_0x548db5['uniqueid']])));if(_0x548db5['context']===_0xf59c('0x48')){if(this['agents'][_0x548db5[_0xf59c('0x42')][_0xf59c('0x49')]('-')[0x0]]){this[_0xf59c('0x20')][_0x548db5[_0xf59c('0x42')][_0xf59c('0x49')]('-')[0x0]][_0xf59c('0x4a')]=_0x548db5[_0xf59c('0x4b')];this[_0xf59c('0x3b')](util[_0xf59c('0x4c')](_0xf59c('0x4d'),this[_0xf59c('0x20')][_0x548db5[_0xf59c('0x42')][_0xf59c('0x49')]('-')[0x0]][_0xf59c('0x4e')]),_0xf59c('0x4f'),{'destaccountcode':this['agents'][_0x548db5[_0xf59c('0x42')][_0xf59c('0x49')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x548db5[_0xf59c('0x4b')]});}}}}}}catch(_0x6dc502){logger[_0xf59c('0x40')](_0xf59c('0x50'),util[_0xf59c('0x51')](_0x6dc502,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf59c('0x38')][_0xf59c('0x22')]=function(_0x523e7f){try{if(this['isNotNull'](_0x523e7f)){if(_0x523e7f[_0xf59c('0x3d')]===_0x523e7f[_0xf59c('0x3c')]&&_0x523e7f[_0xf59c('0x4b')]!='h'&&_0x523e7f[_0xf59c('0x42')]!=_0xf59c('0x43')){_0x523e7f[_0xf59c('0x52')]=_0x523e7f[_0xf59c('0x52')][_0xf59c('0x53')]();_0x523e7f[_0xf59c('0x54')]=(_0x523e7f[_0xf59c('0x55')]||_0x523e7f[_0xf59c('0x54')])[_0xf59c('0x53')]();if(_['isUndefined'](this[_0xf59c('0x1f')][_0x523e7f[_0xf59c('0x3d')]])){this['channels'][_0x523e7f[_0xf59c('0x3d')]]=new Channel();this[_0xf59c('0x1f')][_0x523e7f[_0xf59c('0x3d')]][_0xf59c('0x44')]=_0x523e7f[_0xf59c('0x56')]?moment()[_0xf59c('0x57')](moment[_0xf59c('0x56')](_0x523e7f[_0xf59c('0x56')])[_0xf59c('0x58')](),_0xf59c('0x58'))[_0xf59c('0x4c')](_0xf59c('0x45')):moment()['format'](_0xf59c('0x45'));this[_0xf59c('0x1f')][_0x523e7f[_0xf59c('0x3d')]][_0xf59c('0x46')]=_0xf59c('0x18');}_[_0xf59c('0x59')](this[_0xf59c('0x1f')][_0x523e7f[_0xf59c('0x3d')]],_['pick'](_0x523e7f,_['keys'](this['channels'][_0x523e7f[_0xf59c('0x3d')]])));if(_[_0xf59c('0x5a')](applications,_0x523e7f[_0xf59c('0x52')])){this[_0xf59c('0x1f')][_0x523e7f[_0xf59c('0x3d')]]['lastapplication']=_0x523e7f[_0xf59c('0x52')];this['channels'][_0x523e7f[_0xf59c('0x3d')]][_0xf59c('0x5b')]=_0x523e7f[_0xf59c('0x54')];if(_0x523e7f[_0xf59c('0x52')]===_0xf59c('0x12')&&_[_0xf59c('0x5c')](_0x523e7f[_0xf59c('0x54')],_0xf59c('0x5d'))){var _0x3d4ce7=_0x523e7f[_0xf59c('0x54')][_0xf59c('0x49')]('=');var _0x4f84fe=_0x3d4ce7[0x0][_0xf59c('0x5e')](/cdr\((.*)\)/);if(_0x4f84fe){this[_0xf59c('0x1f')][_0x523e7f['uniqueid']][_0x4f84fe[0x1]]=_0x3d4ce7[0x1];}}else if(_0x523e7f[_0xf59c('0x52')]===_0xf59c('0x13')){this[_0xf59c('0x1f')][_0x523e7f[_0xf59c('0x3d')]]['queue']=_0x523e7f['applicationdata'][_0xf59c('0x49')](',')[0x0];}}}}}catch(_0x27e186){logger['error'](_0xf59c('0x5f'),util[_0xf59c('0x51')](_0x27e186,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf59c('0x60')]=function(_0x755735){try{if(this[_0xf59c('0x39')](_0x755735)){if(_0x755735[_0xf59c('0x3d')]!==_0x755735[_0xf59c('0x3c')]){if(this[_0xf59c('0x1f')][_0x755735[_0xf59c('0x3c')]]){if(_0x755735[_0xf59c('0x61')]==='6'){if(!this[_0xf59c('0x1f')][_0x755735[_0xf59c('0x3c')]][_0xf59c('0x62')]){var _0x406e79=moment();this[_0xf59c('0x1f')][_0x755735[_0xf59c('0x3c')]][_0xf59c('0x62')]=!![];this['channels'][_0x755735[_0xf59c('0x3c')]]['answertime']=_0x406e79[_0xf59c('0x4c')](_0xf59c('0x45'));if(this[_0xf59c('0x1f')][_0x755735['linkedid']][_0xf59c('0x44')]){this[_0xf59c('0x1f')][_0x755735[_0xf59c('0x3c')]]['holdtime']=_0x406e79[_0xf59c('0x63')](this[_0xf59c('0x1f')][_0x755735[_0xf59c('0x3c')]][_0xf59c('0x44')],'seconds');}}this[_0xf59c('0x1f')][_0x755735[_0xf59c('0x3c')]][_0xf59c('0x3c')]=_0x755735['uniqueid'];if(_0x755735[_0xf59c('0x64')]!=='xcally-motion-preview'){this['channels'][_0x755735['linkedid']][_0xf59c('0x65')]=_0x755735[_0xf59c('0x64')];}this[_0xf59c('0x1f')][_0x755735[_0xf59c('0x3c')]][_0xf59c('0x66')]=_0x755735[_0xf59c('0x67')];this[_0xf59c('0x1f')][_0x755735[_0xf59c('0x3c')]][_0xf59c('0x68')]=_0x755735[_0xf59c('0x42')];this['channels'][_0x755735[_0xf59c('0x3c')]][_0xf59c('0x46')]=dispositions[_[_0xf59c('0x47')](_0x755735[_0xf59c('0x61')])];if(this['agents'][_0x755735['channel']['split']('-')[0x0]]){this[_0xf59c('0x1f')][_0x755735[_0xf59c('0x3c')]]['UserId']=this['agents'][_0x755735[_0xf59c('0x42')][_0xf59c('0x49')]('-')[0x0]]['id'];this[_0xf59c('0x1f')][_0x755735[_0xf59c('0x3c')]][_0xf59c('0x69')]=this[_0xf59c('0x20')][_0x755735[_0xf59c('0x42')]['split']('-')[0x0]]['name'];}}}}else{if(this['channels'][_0x755735[_0xf59c('0x3d')]]){if(_0x755735['channelstate']==='6'){if(this[_0xf59c('0x20')][_0x755735[_0xf59c('0x42')][_0xf59c('0x49')]('-')[0x0]]){this[_0xf59c('0x1f')][_0x755735[_0xf59c('0x3d')]][_0xf59c('0x6a')]=this[_0xf59c('0x20')][_0x755735['channel']['split']('-')[0x0]]['id'];this[_0xf59c('0x1f')][_0x755735['uniqueid']][_0xf59c('0x69')]=this[_0xf59c('0x20')][_0x755735[_0xf59c('0x42')]['split']('-')[0x0]]['name'];}}}}}}catch(_0x27886a){logger[_0xf59c('0x40')](_0xf59c('0x6b'),util[_0xf59c('0x51')](_0x27886a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf59c('0x38')][_0xf59c('0x6c')]=function(_0x232c15,_0x49d9b7){if(this[_0xf59c('0x1f')][_0x232c15]){this['channels'][_0x232c15][_0xf59c('0x6d')]=!![];if(_[_0xf59c('0x6e')](_0x49d9b7,_0xf59c('0x6f'))){_0x49d9b7=_0x49d9b7[_0xf59c('0x70')]('.wav49',_0xf59c('0x71'));}this[_0xf59c('0x1f')][_0x232c15][_0xf59c('0x72')]=_0x49d9b7;var _0x299ff3=_[_0xf59c('0x73')](this['channels'][_0x232c15][_0xf59c('0x74')],{'filename':_0x49d9b7});if(_[_0xf59c('0x75')](_0x299ff3)){this['channels'][_0x232c15]['monitors'][_0xf59c('0x76')]({'filename':_0x49d9b7,'createdAt':moment()['format'](_0xf59c('0x45')),'mixmonitorid':'','status':'rec'});}}};VoiceCallReport[_0xf59c('0x38')][_0xf59c('0x28')]=function(_0x51b586){try{if(this[_0xf59c('0x39')](_0x51b586)){if(this[_0xf59c('0x1f')][_0x51b586[_0xf59c('0x3d')]]&&_0x51b586[_0xf59c('0x42')]!='OutgoingSpoolFailed'){if(this[_0xf59c('0x39')](_0x51b586[_0xf59c('0x77')])){if(this[_0xf59c('0x39')](_0x51b586['variable'][_0xf59c('0x78')])){this['syncMixMonitorFilename'](_0x51b586[_0xf59c('0x3d')],_0x51b586['value']);}else if(this[_0xf59c('0x39')](_0x51b586[_0xf59c('0x77')]['xmd-phone'])){this[_0xf59c('0x1f')][_0x51b586[_0xf59c('0x3d')]][_0xf59c('0x64')]=_0x51b586[_0xf59c('0x79')];}else if(this['isNotNull'](_0x51b586[_0xf59c('0x77')][_0xf59c('0x7a')])){this['channels'][_0x51b586[_0xf59c('0x3d')]][_0xf59c('0x7b')]=_0x51b586['value'];}else if(this['isNotNull'](_0x51b586[_0xf59c('0x77')][_0xf59c('0x7c')])){this['channels'][_0x51b586[_0xf59c('0x3d')]]['type']=_0x51b586[_0xf59c('0x79')];}else if(this[_0xf59c('0x39')](_0x51b586[_0xf59c('0x77')][_0xf59c('0x7d')])){this[_0xf59c('0x1f')][_0x51b586[_0xf59c('0x3d')]][_0xf59c('0x13')]=_0x51b586[_0xf59c('0x79')][_0xf59c('0x49')](',')[0x0];}else if(this[_0xf59c('0x39')](_0x51b586[_0xf59c('0x77')]['xmd-originatecalleridnum'])){this[_0xf59c('0x1f')][_0x51b586[_0xf59c('0x3d')]]['originatecalleridnum']=_0x51b586[_0xf59c('0x79')];}else if(this[_0xf59c('0x39')](_0x51b586[_0xf59c('0x77')][_0xf59c('0x7e')])){this['channels'][_0x51b586[_0xf59c('0x3d')]]['destination']=_0x51b586[_0xf59c('0x79')];}else if(this['isNotNull'](_0x51b586[_0xf59c('0x77')][_0xf59c('0x7f')])){this[_0xf59c('0x1f')][_0x51b586['uniqueid']][_0xf59c('0x80')]=_0x51b586[_0xf59c('0x79')];}else if(this[_0xf59c('0x39')](_0x51b586[_0xf59c('0x77')][_0xf59c('0x81')])){this[_0xf59c('0x1f')][_0x51b586[_0xf59c('0x3d')]][_0xf59c('0x13')]=_0x51b586[_0xf59c('0x79')];}else if(this[_0xf59c('0x39')](_0x51b586[_0xf59c('0x77')]['sipcallid'])){this['channels'][_0x51b586[_0xf59c('0x3d')]][_0xf59c('0x82')]=_0x51b586[_0xf59c('0x79')];}}}else if(this[_0xf59c('0x39')](_0x51b586[_0xf59c('0x77')]['mixmonitor_filename'])){if(_0x51b586[_0xf59c('0x79')]){var _0x5d8d2d=path[_0xf59c('0x83')](_0x51b586[_0xf59c('0x79')])[_0xf59c('0x4e')];this[_0xf59c('0x6c')](_0x5d8d2d,_0x51b586['value']);}}else if(this[_0xf59c('0x1f')][_0x51b586['linkedid']]){if(this[_0xf59c('0x39')](_0x51b586[_0xf59c('0x77')])){if(this[_0xf59c('0x39')](_0x51b586[_0xf59c('0x77')][_0xf59c('0x84')])){this['channels'][_0x51b586[_0xf59c('0x3c')]][_0xf59c('0x85')]=_0x51b586[_0xf59c('0x79')];}}}}}catch(_0x2bb28e){logger['error'](_0xf59c('0x86'),util[_0xf59c('0x51')](_0x2bb28e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf59c('0x38')][_0xf59c('0x2a')]=function(_0x252cb4){try{if(this[_0xf59c('0x39')](_0x252cb4)){if(this['channels'][_0x252cb4[_0xf59c('0x3d')]]){var _0x39df53=moment();this[_0xf59c('0x1f')][_0x252cb4['uniqueid']]['endtime']=_0x39df53[_0xf59c('0x4c')](_0xf59c('0x45'));this[_0xf59c('0x1f')][_0x252cb4[_0xf59c('0x3d')]][_0xf59c('0x56')]=_0x39df53[_0xf59c('0x63')](this[_0xf59c('0x1f')][_0x252cb4[_0xf59c('0x3d')]][_0xf59c('0x44')],_0xf59c('0x58'));if(this[_0xf59c('0x1f')][_0x252cb4[_0xf59c('0x3d')]][_0xf59c('0x62')]){this[_0xf59c('0x1f')][_0x252cb4[_0xf59c('0x3d')]]['billableseconds']=_0x39df53[_0xf59c('0x63')](this[_0xf59c('0x1f')][_0x252cb4['uniqueid']][_0xf59c('0x87')],'seconds');this['channels'][_0x252cb4[_0xf59c('0x3d')]][_0xf59c('0x88')]=this['channels'][_0x252cb4[_0xf59c('0x3d')]][_0xf59c('0x56')]-this[_0xf59c('0x1f')][_0x252cb4['uniqueid']][_0xf59c('0x89')];}if(_0x252cb4[_0xf59c('0x8a')]==='from-sip'){if(this[_0xf59c('0x20')][_0x252cb4[_0xf59c('0x42')]['split']('-')[0x0]]){this[_0xf59c('0x20')][_0x252cb4[_0xf59c('0x42')][_0xf59c('0x49')]('-')[0x0]]=_[_0xf59c('0x8b')](this[_0xf59c('0x20')][_0x252cb4[_0xf59c('0x42')][_0xf59c('0x49')]('-')[0x0]],['destconnectedlinenum']);this[_0xf59c('0x3b')](util['format'](_0xf59c('0x4d'),this[_0xf59c('0x20')][_0x252cb4['channel']['split']('-')[0x0]][_0xf59c('0x4e')]),_0xf59c('0x8c'),{'destaccountcode':this['agents'][_0x252cb4['channel']['split']('-')[0x0]][_0xf59c('0x8d')]});}}ami['emit'](_0xf59c('0x8e'),this[_0xf59c('0x1f')][_0x252cb4[_0xf59c('0x3d')]]);delete this['channels'][_0x252cb4['uniqueid']];}}}catch(_0x56212e){logger[_0xf59c('0x40')](_0xf59c('0x8f'),util[_0xf59c('0x51')](_0x56212e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf59c('0x38')][_0xf59c('0x2e')]=function(_0x28d79b){try{if(this['isNotNull'](_0x28d79b)){if(this[_0xf59c('0x1f')][_0x28d79b['transfereeuniqueid']]){this['channels'][_0x28d79b['transfereeuniqueid']][_0xf59c('0x90')]=_0x28d79b[_0xf59c('0x91')];this['channels'][_0x28d79b[_0xf59c('0x92')]]['transferconnectedlinenum']=_0x28d79b[_0xf59c('0x93')];if(this[_0xf59c('0x1f')][_0x28d79b['secondtransfereruniqueid']]){var _0x41889e=this[_0xf59c('0x1f')][_0x28d79b[_0xf59c('0x94')]];this[_0xf59c('0x1f')][_0x28d79b[_0xf59c('0x94')]]=this['channels'][_0x28d79b[_0xf59c('0x92')]];this[_0xf59c('0x1f')][_0x28d79b[_0xf59c('0x92')]]=_0x41889e;}}else if(this[_0xf59c('0x1f')][_0x28d79b[_0xf59c('0x95')]]){this[_0xf59c('0x1f')][_0x28d79b[_0xf59c('0x95')]][_0xf59c('0x90')]=_0x28d79b[_0xf59c('0x91')];this[_0xf59c('0x1f')][_0x28d79b[_0xf59c('0x95')]]['transferconnectedlinenum']=_0x28d79b[_0xf59c('0x93')];if(this['channels'][_0x28d79b['origtransfereruniqueid']]){var _0x41889e=this[_0xf59c('0x1f')][_0x28d79b[_0xf59c('0x96')]];this[_0xf59c('0x1f')][_0x28d79b[_0xf59c('0x96')]]=this['channels'][_0x28d79b[_0xf59c('0x95')]];this[_0xf59c('0x1f')][_0x28d79b['transfertargetuniqueid']]=_0x41889e;}}}}catch(_0x2d7bbe){logger[_0xf59c('0x40')](_0xf59c('0x97'),util[_0xf59c('0x51')](_0x2d7bbe,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf59c('0x38')][_0xf59c('0x30')]=function(_0x2fbe51){try{if(this[_0xf59c('0x39')](_0x2fbe51)){if(this[_0xf59c('0x1f')][_0x2fbe51[_0xf59c('0x92')]]){this['channels'][_0x2fbe51[_0xf59c('0x92')]][_0xf59c('0x90')]=_0x2fbe51['transfereecalleridnum'];this[_0xf59c('0x1f')][_0x2fbe51[_0xf59c('0x92')]][_0xf59c('0x98')]=_0x2fbe51[_0xf59c('0x99')];this[_0xf59c('0x2a')]({'event':_0xf59c('0x9a'),'uniqueid':_0x2fbe51[_0xf59c('0x92')],'context':_0x2fbe51[_0xf59c('0x8a')],'channel':_0x2fbe51['transfererchannel']});}}}catch(_0x7a4537){logger[_0xf59c('0x40')](_0xf59c('0x9b'),util['inspect'](_0x7a4537,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf59c('0x38')]['syncMusicOnHoldStart']=function(_0x3adf97){try{if(this[_0xf59c('0x39')](_0x3adf97)){if(this[_0xf59c('0x1f')][_0x3adf97['uniqueid']]){if(!_[_0xf59c('0x75')](this[_0xf59c('0x1f')][_0x3adf97[_0xf59c('0x3d')]][_0xf59c('0x87')])){this['channels'][_0x3adf97[_0xf59c('0x3d')]][_0xf59c('0x9c')]=moment()[_0xf59c('0x4c')](_0xf59c('0x45'));}}}}catch(_0x43ef6){logger[_0xf59c('0x40')](_0xf59c('0x9d'),util[_0xf59c('0x51')](_0x43ef6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf59c('0x38')][_0xf59c('0x9e')]=function(_0x41d874){try{if(this['isNotNull'](_0x41d874)){if(this[_0xf59c('0x1f')][_0x41d874['uniqueid']]){if(!_[_0xf59c('0x75')](this[_0xf59c('0x1f')][_0x41d874[_0xf59c('0x3d')]][_0xf59c('0x9c')])){this[_0xf59c('0x1f')][_0x41d874[_0xf59c('0x3d')]]['mohtime']+=moment()['milliseconds'](0x0)['diff'](this[_0xf59c('0x1f')][_0x41d874[_0xf59c('0x3d')]]['mohstarttime'],_0xf59c('0x58'));delete this[_0xf59c('0x1f')][_0x41d874[_0xf59c('0x3d')]]['mohstarttime'];}}}}catch(_0x389c41){logger[_0xf59c('0x40')](_0xf59c('0x9f'),util[_0xf59c('0x51')](_0x389c41,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file +var _0x58c0=['context','omit','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','BlindTransfer','[syncBlindTransfer][VoiceCallReport]','mohstarttime','[syncMusicOnHoldStop][VoiceCallReport]','exports','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','../ami','../model/channel','unknown','not_inuse','inuse','busy','unavailable','ringing','ringinuse','set','queue','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','newchannel','syncNewChannel','bind','newstate','syncNewState','varset','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','resolve','actionCoreShowChannels','catch','log','prototype','isNotNull','isUndefined','emit','linkedid','uniqueid','merge','pick','keys','[syncNewCallerId][VoiceCallReport]','channel','OutgoingSpoolFailed','starttime','format','disposition','toNumber','channelstate','from-sip','split','destconnectedlinenum','exten','user:%s','accountcode','error','[syncNewChannel][VoiceCallReport]','application','toLowerCase','applicationdata','appdata','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','lastdata','startsWith','cdr(','match','[syncNewExten][VoiceCallReport]','inspect','answered','answertime','diff','xcally-motion-preview','connectedlinenum','calleridnum','connectedlinename','calleridname','destinationchannel','UserId','membername','name','syncMixMonitorFilename','monitor','.wav49','monitorFilename','find','monitors','isNil','push','rec','variable','mixmonitor_filename','value','xmd-phone','xmd-callerid','callerid','xmd-cdrtype','type','xmd-originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','sipcalluniqueid','parse','sipcalllinkedid','syncHangup','endtime','billableseconds'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x58c0,0x1de));var _0x058c=function(_0x506d2f,_0x5ab76e){_0x506d2f=_0x506d2f-0x0;var _0x101255=_0x58c0[_0x506d2f];return _0x101255;};'use strict';var BPromise=require('bluebird');var _=require(_0x058c('0x0'));var moment=require(_0x058c('0x1'));var util=require(_0x058c('0x2'));var path=require(_0x058c('0x3'));var Redis=require(_0x058c('0x4'));var config=require(_0x058c('0x5'));var logger=require(_0x058c('0x6'))('ami');var ami=require(_0x058c('0x7'));var Channel=require(_0x058c('0x8'));var statusDesc=[_0x058c('0x9'),_0x058c('0xa'),_0x058c('0xb'),_0x058c('0xc'),'invalid',_0x058c('0xd'),_0x058c('0xe'),_0x058c('0xf'),'onhold'];var applications=[_0x058c('0x10'),_0x058c('0x11'),'agi',_0x058c('0x12'),_0x058c('0x13'),_0x058c('0x14')];var dispositions=[_0x058c('0x15'),_0x058c('0x16'),'FAILED',_0x058c('0x15'),_0x058c('0x15'),_0x058c('0x15'),_0x058c('0x17'),_0x058c('0x18'),_0x058c('0x16'),'FAILED','FAILED'];var actions={};config[_0x058c('0x19')]=_[_0x058c('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x058c('0x1b'))(new Redis(config['redis']));function VoiceCallReport(_0x2d0b64){this[_0x058c('0x1c')]=_0x2d0b64[_0x058c('0x1c')];this['agents']=_0x2d0b64[_0x058c('0x1d')];ami['on'](_0x058c('0x1e'),this[_0x058c('0x1f')]['bind'](this));ami['on']('newexten',this[_0x058c('0x1f')]['bind'](this));ami['on'](_0x058c('0x20'),this[_0x058c('0x21')][_0x058c('0x22')](this));ami['on'](_0x058c('0x23'),this[_0x058c('0x24')][_0x058c('0x22')](this));ami['on'](_0x058c('0x25'),this['syncVarSet']['bind'](this));ami['on']('hangup',this['syncHangup'][_0x058c('0x22')](this));ami['on'](_0x058c('0x26'),this[_0x058c('0x27')]['bind'](this));ami['on'](_0x058c('0x28'),this[_0x058c('0x29')][_0x058c('0x22')](this));ami['on'](_0x058c('0x2a'),this[_0x058c('0x2b')][_0x058c('0x22')](this));ami['on'](_0x058c('0x2c'),this[_0x058c('0x2d')][_0x058c('0x22')](this));ami['on'](_0x058c('0x2e'),this[_0x058c('0x2f')][_0x058c('0x22')](this));return BPromise[_0x058c('0x30')]()['then'](ami[_0x058c('0x31')]())[_0x058c('0x32')](function(_0x12d726){console[_0x058c('0x33')](_0x12d726);});}VoiceCallReport[_0x058c('0x34')][_0x058c('0x35')]=function(_0x5706e1){return _0x5706e1!==null&&!_[_0x058c('0x36')](_0x5706e1);};VoiceCallReport['prototype']['emit']=function(_0x187b73,_0x5d84c8,_0x5d2737){io['to'](_0x187b73)[_0x058c('0x37')](_0x5d84c8,_0x5d2737);};VoiceCallReport[_0x058c('0x34')][_0x058c('0x27')]=function(_0x3ba9ca){try{if(this[_0x058c('0x35')](_0x3ba9ca)){if(_0x3ba9ca['uniqueid']===_0x3ba9ca[_0x058c('0x38')]){if(!_[_0x058c('0x36')](this['channels'][_0x3ba9ca[_0x058c('0x39')]])){_[_0x058c('0x3a')](this[_0x058c('0x1c')][_0x3ba9ca[_0x058c('0x39')]],_[_0x058c('0x3b')](_0x3ba9ca,_[_0x058c('0x3c')](this[_0x058c('0x1c')][_0x3ba9ca['uniqueid']])));}}}}catch(_0x2bb1ed){logger['error'](_0x058c('0x3d'),util['inspect'](_0x2bb1ed,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x058c('0x34')][_0x058c('0x21')]=function(_0x3025ce){try{if(this['isNotNull'](_0x3025ce)){if(_0x3025ce['uniqueid']===_0x3025ce[_0x058c('0x38')]&&_0x3025ce[_0x058c('0x3e')]!=_0x058c('0x3f')){if(_['isUndefined'](this[_0x058c('0x1c')][_0x3025ce[_0x058c('0x39')]])){this['channels'][_0x3025ce['uniqueid']]=new Channel();this[_0x058c('0x1c')][_0x3025ce[_0x058c('0x39')]][_0x058c('0x40')]=moment()[_0x058c('0x41')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x058c('0x1c')][_0x3025ce[_0x058c('0x39')]][_0x058c('0x42')]=dispositions[_[_0x058c('0x43')](_0x3025ce[_0x058c('0x44')])];_[_0x058c('0x3a')](this[_0x058c('0x1c')][_0x3025ce['uniqueid']],_[_0x058c('0x3b')](_0x3025ce,_[_0x058c('0x3c')](this[_0x058c('0x1c')][_0x3025ce[_0x058c('0x39')]])));if(_0x3025ce['context']===_0x058c('0x45')){if(this[_0x058c('0x1d')][_0x3025ce[_0x058c('0x3e')][_0x058c('0x46')]('-')[0x0]]){this[_0x058c('0x1d')][_0x3025ce[_0x058c('0x3e')][_0x058c('0x46')]('-')[0x0]][_0x058c('0x47')]=_0x3025ce[_0x058c('0x48')];this[_0x058c('0x37')](util[_0x058c('0x41')](_0x058c('0x49'),this[_0x058c('0x1d')][_0x3025ce[_0x058c('0x3e')]['split']('-')[0x0]]['name']),'user:agentconnect',{'destaccountcode':this[_0x058c('0x1d')][_0x3025ce[_0x058c('0x3e')]['split']('-')[0x0]][_0x058c('0x4a')],'destconnectedlinenum':_0x3025ce['exten']});}}}}}}catch(_0x5265d1){logger[_0x058c('0x4b')](_0x058c('0x4c'),util['inspect'](_0x5265d1,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x058c('0x1f')]=function(_0x52742b){try{if(this[_0x058c('0x35')](_0x52742b)){if(_0x52742b[_0x058c('0x39')]===_0x52742b[_0x058c('0x38')]&&_0x52742b['exten']!='h'&&_0x52742b[_0x058c('0x3e')]!=_0x058c('0x3f')){_0x52742b['application']=_0x52742b[_0x058c('0x4d')][_0x058c('0x4e')]();_0x52742b[_0x058c('0x4f')]=(_0x52742b[_0x058c('0x50')]||_0x52742b[_0x058c('0x4f')])['toLowerCase']();if(_[_0x058c('0x36')](this[_0x058c('0x1c')][_0x52742b[_0x058c('0x39')]])){this[_0x058c('0x1c')][_0x52742b[_0x058c('0x39')]]=new Channel();this[_0x058c('0x1c')][_0x52742b[_0x058c('0x39')]][_0x058c('0x40')]=_0x52742b['duration']?moment()['subtract'](moment[_0x058c('0x51')](_0x52742b[_0x058c('0x51')])['seconds'](),_0x058c('0x52'))[_0x058c('0x41')](_0x058c('0x53')):moment()[_0x058c('0x41')](_0x058c('0x53'));this[_0x058c('0x1c')][_0x52742b[_0x058c('0x39')]]['disposition']=_0x058c('0x15');}_['merge'](this[_0x058c('0x1c')][_0x52742b[_0x058c('0x39')]],_[_0x058c('0x3b')](_0x52742b,_[_0x058c('0x3c')](this[_0x058c('0x1c')][_0x52742b[_0x058c('0x39')]])));if(_[_0x058c('0x54')](applications,_0x52742b[_0x058c('0x4d')])){this['channels'][_0x52742b[_0x058c('0x39')]][_0x058c('0x55')]=_0x52742b[_0x058c('0x4d')];this[_0x058c('0x1c')][_0x52742b[_0x058c('0x39')]][_0x058c('0x56')]=_0x52742b[_0x058c('0x4f')];if(_0x52742b[_0x058c('0x4d')]==='set'&&_[_0x058c('0x57')](_0x52742b[_0x058c('0x4f')],_0x058c('0x58'))){var _0x5a5791=_0x52742b[_0x058c('0x4f')]['split']('=');var _0x35e8a=_0x5a5791[0x0][_0x058c('0x59')](/cdr\((.*)\)/);if(_0x35e8a){this[_0x058c('0x1c')][_0x52742b['uniqueid']][_0x35e8a[0x1]]=_0x5a5791[0x1];}}else if(_0x52742b[_0x058c('0x4d')]===_0x058c('0x11')){this[_0x058c('0x1c')][_0x52742b[_0x058c('0x39')]][_0x058c('0x11')]=_0x52742b['applicationdata']['split'](',')[0x0];}}}}}catch(_0x2bf84c){logger[_0x058c('0x4b')](_0x058c('0x5a'),util[_0x058c('0x5b')](_0x2bf84c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x058c('0x34')][_0x058c('0x24')]=function(_0x412bb4){try{if(this[_0x058c('0x35')](_0x412bb4)){if(_0x412bb4[_0x058c('0x39')]!==_0x412bb4[_0x058c('0x38')]){if(this[_0x058c('0x1c')][_0x412bb4[_0x058c('0x38')]]){if(_0x412bb4[_0x058c('0x44')]==='6'){if(!this[_0x058c('0x1c')][_0x412bb4[_0x058c('0x38')]][_0x058c('0x5c')]){var _0x32585b=moment();this['channels'][_0x412bb4[_0x058c('0x38')]][_0x058c('0x5c')]=!![];this[_0x058c('0x1c')][_0x412bb4[_0x058c('0x38')]][_0x058c('0x5d')]=_0x32585b[_0x058c('0x41')](_0x058c('0x53'));if(this['channels'][_0x412bb4[_0x058c('0x38')]][_0x058c('0x40')]){this[_0x058c('0x1c')][_0x412bb4[_0x058c('0x38')]]['holdtime']=_0x32585b[_0x058c('0x5e')](this[_0x058c('0x1c')][_0x412bb4['linkedid']][_0x058c('0x40')],'seconds');}}this[_0x058c('0x1c')][_0x412bb4['linkedid']][_0x058c('0x38')]=_0x412bb4[_0x058c('0x39')];if(_0x412bb4['calleridnum']!==_0x058c('0x5f')){this[_0x058c('0x1c')][_0x412bb4['linkedid']][_0x058c('0x60')]=_0x412bb4[_0x058c('0x61')];}this[_0x058c('0x1c')][_0x412bb4['linkedid']][_0x058c('0x62')]=_0x412bb4[_0x058c('0x63')];this[_0x058c('0x1c')][_0x412bb4[_0x058c('0x38')]][_0x058c('0x64')]=_0x412bb4[_0x058c('0x3e')];this[_0x058c('0x1c')][_0x412bb4[_0x058c('0x38')]][_0x058c('0x42')]=dispositions[_[_0x058c('0x43')](_0x412bb4['channelstate'])];if(this[_0x058c('0x1d')][_0x412bb4[_0x058c('0x3e')][_0x058c('0x46')]('-')[0x0]]){this[_0x058c('0x1c')][_0x412bb4[_0x058c('0x38')]][_0x058c('0x65')]=this['agents'][_0x412bb4[_0x058c('0x3e')][_0x058c('0x46')]('-')[0x0]]['id'];this[_0x058c('0x1c')][_0x412bb4[_0x058c('0x38')]][_0x058c('0x66')]=this[_0x058c('0x1d')][_0x412bb4['channel'][_0x058c('0x46')]('-')[0x0]]['name'];}}}}else{if(this['channels'][_0x412bb4[_0x058c('0x39')]]){if(_0x412bb4[_0x058c('0x44')]==='6'){if(this[_0x058c('0x1d')][_0x412bb4['channel'][_0x058c('0x46')]('-')[0x0]]){this['channels'][_0x412bb4['uniqueid']][_0x058c('0x65')]=this['agents'][_0x412bb4['channel'][_0x058c('0x46')]('-')[0x0]]['id'];this['channels'][_0x412bb4['uniqueid']][_0x058c('0x66')]=this[_0x058c('0x1d')][_0x412bb4[_0x058c('0x3e')][_0x058c('0x46')]('-')[0x0]][_0x058c('0x67')];}}}}}}catch(_0x38d4d1){logger[_0x058c('0x4b')]('[syncNewState][VoiceCallReport]',util['inspect'](_0x38d4d1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x058c('0x34')][_0x058c('0x68')]=function(_0x17e8f9,_0x11b1a8){if(this['channels'][_0x17e8f9]){this[_0x058c('0x1c')][_0x17e8f9][_0x058c('0x69')]=!![];if(_['endsWith'](_0x11b1a8,_0x058c('0x6a'))){_0x11b1a8=_0x11b1a8['replace']('.wav49','.WAV');}this['channels'][_0x17e8f9][_0x058c('0x6b')]=_0x11b1a8;var _0x5d7354=_[_0x058c('0x6c')](this['channels'][_0x17e8f9][_0x058c('0x6d')],{'filename':_0x11b1a8});if(_[_0x058c('0x6e')](_0x5d7354)){this[_0x058c('0x1c')][_0x17e8f9][_0x058c('0x6d')][_0x058c('0x6f')]({'filename':_0x11b1a8,'createdAt':moment()[_0x058c('0x41')](_0x058c('0x53')),'mixmonitorid':'','status':_0x058c('0x70')});}}};VoiceCallReport[_0x058c('0x34')]['syncVarSet']=function(_0xa12d85){try{if(this[_0x058c('0x35')](_0xa12d85)){if(this[_0x058c('0x1c')][_0xa12d85[_0x058c('0x39')]]&&_0xa12d85[_0x058c('0x3e')]!=_0x058c('0x3f')){if(this[_0x058c('0x35')](_0xa12d85[_0x058c('0x71')])){if(this[_0x058c('0x35')](_0xa12d85['variable'][_0x058c('0x72')])){this[_0x058c('0x68')](_0xa12d85['uniqueid'],_0xa12d85[_0x058c('0x73')]);}else if(this[_0x058c('0x35')](_0xa12d85[_0x058c('0x71')][_0x058c('0x74')])){this[_0x058c('0x1c')][_0xa12d85[_0x058c('0x39')]]['calleridnum']=_0xa12d85[_0x058c('0x73')];}else if(this[_0x058c('0x35')](_0xa12d85[_0x058c('0x71')][_0x058c('0x75')])){this[_0x058c('0x1c')][_0xa12d85['uniqueid']][_0x058c('0x76')]=_0xa12d85[_0x058c('0x73')];}else if(this[_0x058c('0x35')](_0xa12d85['variable'][_0x058c('0x77')])){this[_0x058c('0x1c')][_0xa12d85[_0x058c('0x39')]][_0x058c('0x78')]=_0xa12d85['value'];}else if(this[_0x058c('0x35')](_0xa12d85[_0x058c('0x71')]['xmd-queue'])){this['channels'][_0xa12d85[_0x058c('0x39')]][_0x058c('0x11')]=_0xa12d85[_0x058c('0x73')][_0x058c('0x46')](',')[0x0];}else if(this[_0x058c('0x35')](_0xa12d85[_0x058c('0x71')][_0x058c('0x79')])){this['channels'][_0xa12d85['uniqueid']]['originatecalleridnum']=_0xa12d85['value'];}else if(this[_0x058c('0x35')](_0xa12d85[_0x058c('0x71')][_0x058c('0x7a')])){this[_0x058c('0x1c')][_0xa12d85['uniqueid']][_0x058c('0x7b')]=_0xa12d85[_0x058c('0x73')];}else if(this[_0x058c('0x35')](_0xa12d85[_0x058c('0x71')][_0x058c('0x7c')])){this[_0x058c('0x1c')][_0xa12d85[_0x058c('0x39')]][_0x058c('0x7d')]=_0xa12d85[_0x058c('0x73')];}else if(this[_0x058c('0x35')](_0xa12d85[_0x058c('0x71')][_0x058c('0x7e')])){this[_0x058c('0x1c')][_0xa12d85['uniqueid']][_0x058c('0x11')]=_0xa12d85[_0x058c('0x73')];}else if(this[_0x058c('0x35')](_0xa12d85[_0x058c('0x71')][_0x058c('0x7f')])){this['channels'][_0xa12d85['uniqueid']][_0x058c('0x80')]=_0xa12d85[_0x058c('0x73')];}}}else if(this['isNotNull'](_0xa12d85[_0x058c('0x71')][_0x058c('0x72')])){if(_0xa12d85[_0x058c('0x73')]){var _0x4f6dfa=path[_0x058c('0x81')](_0xa12d85[_0x058c('0x73')])['name'];this['syncMixMonitorFilename'](_0x4f6dfa,_0xa12d85[_0x058c('0x73')]);}}else if(this[_0x058c('0x1c')][_0xa12d85[_0x058c('0x38')]]){if(this[_0x058c('0x35')](_0xa12d85[_0x058c('0x71')])){if(this[_0x058c('0x35')](_0xa12d85[_0x058c('0x71')][_0x058c('0x7f')])){this[_0x058c('0x1c')][_0xa12d85[_0x058c('0x38')]][_0x058c('0x82')]=_0xa12d85[_0x058c('0x73')];}}}}}catch(_0x51c9d8){logger[_0x058c('0x4b')]('[syncVarSet][VoiceCallReport]',util[_0x058c('0x5b')](_0x51c9d8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x058c('0x34')][_0x058c('0x83')]=function(_0x554a28){try{if(this[_0x058c('0x35')](_0x554a28)){if(this[_0x058c('0x1c')][_0x554a28[_0x058c('0x39')]]){var _0x5cfd65=moment();this[_0x058c('0x1c')][_0x554a28[_0x058c('0x39')]][_0x058c('0x84')]=_0x5cfd65[_0x058c('0x41')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x554a28[_0x058c('0x39')]][_0x058c('0x51')]=_0x5cfd65[_0x058c('0x5e')](this[_0x058c('0x1c')][_0x554a28[_0x058c('0x39')]]['starttime'],_0x058c('0x52'));if(this[_0x058c('0x1c')][_0x554a28['uniqueid']]['answered']){this[_0x058c('0x1c')][_0x554a28[_0x058c('0x39')]][_0x058c('0x85')]=_0x5cfd65[_0x058c('0x5e')](this[_0x058c('0x1c')][_0x554a28['uniqueid']]['answertime'],'seconds');this[_0x058c('0x1c')][_0x554a28[_0x058c('0x39')]]['holdtime']=this['channels'][_0x554a28[_0x058c('0x39')]]['duration']-this[_0x058c('0x1c')][_0x554a28[_0x058c('0x39')]][_0x058c('0x85')];}if(_0x554a28[_0x058c('0x86')]===_0x058c('0x45')){if(this['agents'][_0x554a28[_0x058c('0x3e')][_0x058c('0x46')]('-')[0x0]]){this[_0x058c('0x1d')][_0x554a28[_0x058c('0x3e')][_0x058c('0x46')]('-')[0x0]]=_[_0x058c('0x87')](this[_0x058c('0x1d')][_0x554a28[_0x058c('0x3e')][_0x058c('0x46')]('-')[0x0]],['destconnectedlinenum']);this[_0x058c('0x37')](util[_0x058c('0x41')]('user:%s',this['agents'][_0x554a28[_0x058c('0x3e')][_0x058c('0x46')]('-')[0x0]][_0x058c('0x67')]),_0x058c('0x88'),{'destaccountcode':this[_0x058c('0x1d')][_0x554a28[_0x058c('0x3e')][_0x058c('0x46')]('-')[0x0]][_0x058c('0x4a')]});}}ami[_0x058c('0x37')](_0x058c('0x89'),this[_0x058c('0x1c')][_0x554a28[_0x058c('0x39')]]);delete this[_0x058c('0x1c')][_0x554a28[_0x058c('0x39')]];}}}catch(_0x2e4abe){logger[_0x058c('0x4b')](_0x058c('0x8a'),util[_0x058c('0x5b')](_0x2e4abe,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x058c('0x34')][_0x058c('0x29')]=function(_0x84c96a){try{if(this[_0x058c('0x35')](_0x84c96a)){if(this['channels'][_0x84c96a[_0x058c('0x8b')]]){this['channels'][_0x84c96a[_0x058c('0x8b')]]['transfercalleridnum']=_0x84c96a[_0x058c('0x8c')];this[_0x058c('0x1c')][_0x84c96a[_0x058c('0x8b')]][_0x058c('0x8d')]=_0x84c96a[_0x058c('0x8e')];if(this[_0x058c('0x1c')][_0x84c96a['secondtransfereruniqueid']]){var _0x26d970=this[_0x058c('0x1c')][_0x84c96a[_0x058c('0x8f')]];this[_0x058c('0x1c')][_0x84c96a['secondtransfereruniqueid']]=this[_0x058c('0x1c')][_0x84c96a[_0x058c('0x8b')]];this[_0x058c('0x1c')][_0x84c96a[_0x058c('0x8b')]]=_0x26d970;}}else if(this['channels'][_0x84c96a[_0x058c('0x90')]]){this[_0x058c('0x1c')][_0x84c96a['transfertargetuniqueid']][_0x058c('0x91')]=_0x84c96a[_0x058c('0x8c')];this[_0x058c('0x1c')][_0x84c96a[_0x058c('0x90')]][_0x058c('0x8d')]=_0x84c96a[_0x058c('0x8e')];if(this[_0x058c('0x1c')][_0x84c96a['origtransfereruniqueid']]){var _0x26d970=this[_0x058c('0x1c')][_0x84c96a[_0x058c('0x92')]];this['channels'][_0x84c96a[_0x058c('0x92')]]=this[_0x058c('0x1c')][_0x84c96a['transfertargetuniqueid']];this['channels'][_0x84c96a[_0x058c('0x90')]]=_0x26d970;}}}}catch(_0x30673e){logger[_0x058c('0x4b')](_0x058c('0x93'),util[_0x058c('0x5b')](_0x30673e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x058c('0x34')][_0x058c('0x2b')]=function(_0x428dce){try{if(this['isNotNull'](_0x428dce)){if(this['channels'][_0x428dce[_0x058c('0x8b')]]){this['channels'][_0x428dce[_0x058c('0x8b')]]['transfercalleridnum']=_0x428dce['transfereecalleridnum'];this[_0x058c('0x1c')][_0x428dce[_0x058c('0x8b')]]['transferconnectedlinenum']=_0x428dce['extension'];this[_0x058c('0x83')]({'event':_0x058c('0x94'),'uniqueid':_0x428dce[_0x058c('0x8b')],'context':_0x428dce[_0x058c('0x86')],'channel':_0x428dce['transfererchannel']});}}}catch(_0xe561ef){logger[_0x058c('0x4b')](_0x058c('0x95'),util['inspect'](_0xe561ef,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x058c('0x34')][_0x058c('0x2d')]=function(_0x5aae36){try{if(this[_0x058c('0x35')](_0x5aae36)){if(this[_0x058c('0x1c')][_0x5aae36[_0x058c('0x39')]]){if(!_[_0x058c('0x6e')](this['channels'][_0x5aae36[_0x058c('0x39')]]['answertime'])){this[_0x058c('0x1c')][_0x5aae36[_0x058c('0x39')]][_0x058c('0x96')]=moment()[_0x058c('0x41')](_0x058c('0x53'));}}}}catch(_0x4f0852){logger[_0x058c('0x4b')]('[syncMusicOnHoldStart][VoiceCallReport]',util[_0x058c('0x5b')](_0x4f0852,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x058c('0x34')][_0x058c('0x2f')]=function(_0x1e640f){try{if(this[_0x058c('0x35')](_0x1e640f)){if(this[_0x058c('0x1c')][_0x1e640f[_0x058c('0x39')]]){if(!_[_0x058c('0x6e')](this[_0x058c('0x1c')][_0x1e640f[_0x058c('0x39')]][_0x058c('0x96')])){this[_0x058c('0x1c')][_0x1e640f[_0x058c('0x39')]]['mohtime']+=moment()['milliseconds'](0x0)['diff'](this[_0x058c('0x1c')][_0x1e640f[_0x058c('0x39')]][_0x058c('0x96')],_0x058c('0x52'));delete this[_0x058c('0x1c')][_0x1e640f['uniqueid']][_0x058c('0x96')];}}}}catch(_0x5ee70d){logger[_0x058c('0x4b')](_0x058c('0x97'),util[_0x058c('0x5b')](_0x5ee70d,{'showHidden':![],'depth':null}));}};module[_0x058c('0x98')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 285bf5d..63f7947 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 _0x31af=['variable','value','outboundrouteid','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','membername','memberpenalty','memberrealtime','isNil','isUndefined','duration','endtime','diff','starttime','seconds','complete','answertime','answered','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','custom:voiceDialReport','custom:dialend','voice_outbound:save','info','stringify','[syncHangup][VoiceDialReport]','exports','lodash','moment','util','../../../config/logger','../ami','redis','defaults','socket.io-emitter','channels','outbound','variables','dialbegin','bind','dialend','syncDialEnd','varset','hangup','syncHangup','isNotNull','prototype','emit','syncDialBegin','uniqueid','merge','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','privilege','voice_outbound_channel:save','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename','format','lastevent','connect','custom:dialconnect','voice:outbound','[syncDialEnd][VoiceDialReport]','syncVarSet','addVariable','keys'];(function(_0x24a833,_0x488360){var _0x5478be=function(_0x11795e){while(--_0x11795e){_0x24a833['push'](_0x24a833['shift']());}};_0x5478be(++_0x488360);}(_0x31af,0xde));var _0xf31a=function(_0x35f497,_0x3657f8){_0x35f497=_0x35f497-0x0;var _0xaf22ed=_0x31af[_0x35f497];return _0xaf22ed;};'use strict';var _=require(_0xf31a('0x0'));var moment=require(_0xf31a('0x1'));var util=require(_0xf31a('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xf31a('0x3'))('ami');var ami=require(_0xf31a('0x4'));config[_0xf31a('0x5')]=_[_0xf31a('0x6')](config[_0xf31a('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xf31a('0x7'))(new Redis(config[_0xf31a('0x5')]));function VoiceDialReport(_0x405926){this[_0xf31a('0x8')]=_0x405926['outboundChannels'];this[_0xf31a('0x9')]=_0x405926[_0xf31a('0x9')];this[_0xf31a('0xa')]={};ami['on'](_0xf31a('0xb'),this['syncDialBegin'][_0xf31a('0xc')](this));ami['on'](_0xf31a('0xd'),this[_0xf31a('0xe')][_0xf31a('0xc')](this));ami['on'](_0xf31a('0xf'),this['syncVarSet'][_0xf31a('0xc')](this));ami['on'](_0xf31a('0x10'),this[_0xf31a('0x11')][_0xf31a('0xc')](this));}VoiceDialReport['prototype'][_0xf31a('0x12')]=function(_0x26b85e){return _0x26b85e!==null&&!_['isUndefined'](_0x26b85e);};VoiceDialReport[_0xf31a('0x13')][_0xf31a('0x14')]=function(_0x46bdd3,_0x18d266,_0x451107){io['to'](_0x46bdd3)[_0xf31a('0x14')](_0x18d266,_0x451107);};VoiceDialReport[_0xf31a('0x13')][_0xf31a('0x15')]=function(_0x3f7c35){try{if(this[_0xf31a('0x12')](_0x3f7c35)){if(this[_0xf31a('0x8')][_0x3f7c35[_0xf31a('0x16')]]){_[_0xf31a('0x17')](this[_0xf31a('0x8')][_0x3f7c35[_0xf31a('0x16')]],{'starttime':moment()['format'](_0xf31a('0x18')),'lastevent':_0xf31a('0x19'),'interface':_0x3f7c35[_0xf31a('0x1a')][_0xf31a('0x1b')](0x0,_0x3f7c35['channel'][_0xf31a('0x1c')]('-')),'membername':_0x3f7c35[_0xf31a('0x1a')][_0xf31a('0x1b')](_0x3f7c35[_0xf31a('0x1a')][_0xf31a('0x1c')]('/')+0x1,_0x3f7c35['channel'][_0xf31a('0x1c')]('-'))},_[_0xf31a('0x1d')](_0x3f7c35,['event',_0xf31a('0x1e')]));this[_0xf31a('0x14')]('voice:outbound',_0xf31a('0x1f'),this[_0xf31a('0x8')][_0x3f7c35['uniqueid']]);ami['emit']('custom:dialbegin',this[_0xf31a('0x8')][_0x3f7c35[_0xf31a('0x16')]]);}}}catch(_0x5c23db){logger[_0xf31a('0x20')](_0xf31a('0x21'),util[_0xf31a('0x22')](_0x5c23db,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xf31a('0x13')]['syncDialEnd']=function(_0x5d8083){try{if(this[_0xf31a('0x12')](_0x5d8083)){if(this[_0xf31a('0x8')][_0x5d8083['uniqueid']]){this['channels'][_0x5d8083['uniqueid']]['dialstatus']=_0x5d8083[_0xf31a('0x23')];if(_0x5d8083[_0xf31a('0x23')]===_0xf31a('0x24')){this['channels'][_0x5d8083[_0xf31a('0x16')]][_0xf31a('0x25')]=_0x5d8083[_0xf31a('0x25')];this[_0xf31a('0x8')][_0x5d8083[_0xf31a('0x16')]]['connectedlinename']=_0x5d8083[_0xf31a('0x26')];this[_0xf31a('0x8')][_0x5d8083['uniqueid']]['answertime']=moment()[_0xf31a('0x27')](_0xf31a('0x18'));this['channels'][_0x5d8083[_0xf31a('0x16')]][_0xf31a('0x28')]=_0xf31a('0x29');ami['emit'](_0xf31a('0x2a'),this[_0xf31a('0x8')][_0x5d8083[_0xf31a('0x16')]]);}this[_0xf31a('0x14')](_0xf31a('0x2b'),_0xf31a('0x1f'),this['channels'][_0x5d8083[_0xf31a('0x16')]]);}}}catch(_0xa80955){logger[_0xf31a('0x20')](_0xf31a('0x2c'),util[_0xf31a('0x22')](_0xa80955,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xf31a('0x13')][_0xf31a('0x2d')]=function(_0x34808e){try{if(this[_0xf31a('0x12')](_0x34808e)){this[_0xf31a('0x2e')](_0x34808e[_0xf31a('0x16')],_[_0xf31a('0x2f')](_0x34808e[_0xf31a('0x30')])[0x0],_0x34808e[_0xf31a('0x31')]);if(this[_0xf31a('0x12')](_0x34808e[_0xf31a('0x30')])&&this[_0xf31a('0x12')](_0x34808e[_0xf31a('0x30')][_0xf31a('0x32')])){if(_['isUndefined'](this[_0xf31a('0x8')][_0x34808e[_0xf31a('0x16')]])){this[_0xf31a('0x8')][_0x34808e[_0xf31a('0x16')]]={'routeId':_0x34808e[_0xf31a('0x31')],'variables':this['variables'][_0x34808e[_0xf31a('0x16')]]};this[_0xf31a('0x14')](_0xf31a('0x2b'),'voice_outbound_channel:save',this[_0xf31a('0x8')][_0x34808e[_0xf31a('0x16')]]);}}}}catch(_0xe141dd){logger[_0xf31a('0x20')](_0xf31a('0x33'),util['inspect'](_0xe141dd,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xf31a('0x13')]['addVariable']=function(_0x44321d,_0x129409,_0x4bb705){var _0x35d5b6=[_0xf31a('0x34'),_0xf31a('0x35'),'rtpaudioqosjitter',_0xf31a('0x36'),_0xf31a('0x37'),_0xf31a('0x38'),_0xf31a('0x39'),_0xf31a('0x3a'),_0xf31a('0x3b'),_0xf31a('0x3c'),_0xf31a('0x3d'),_0xf31a('0x3e'),'membercalls',_0xf31a('0x3f'),_0xf31a('0x40'),'memberlastcall',_0xf31a('0x41'),_0xf31a('0x42'),_0xf31a('0x43')];if(!_[_0xf31a('0x44')](_0x129409)&&!_['includes'](_0x35d5b6,_0x129409)){if(_[_0xf31a('0x45')](this[_0xf31a('0xa')][_0x44321d])){this[_0xf31a('0xa')][_0x44321d]={};}this[_0xf31a('0xa')][_0x44321d][_0x129409]=_0x4bb705;}};VoiceDialReport['prototype'][_0xf31a('0x11')]=function(_0x58163c){try{if(this[_0xf31a('0x12')](_0x58163c)){if(this[_0xf31a('0x8')][_0x58163c[_0xf31a('0x16')]]){this['channels'][_0x58163c[_0xf31a('0x16')]]['endtime']=moment()[_0xf31a('0x27')](_0xf31a('0x18'));this[_0xf31a('0x8')][_0x58163c[_0xf31a('0x16')]][_0xf31a('0x46')]=moment(this[_0xf31a('0x8')][_0x58163c[_0xf31a('0x16')]][_0xf31a('0x47')])[_0xf31a('0x48')](this['channels'][_0x58163c[_0xf31a('0x16')]][_0xf31a('0x49')],_0xf31a('0x4a'));this[_0xf31a('0x8')][_0x58163c[_0xf31a('0x16')]][_0xf31a('0x28')]=_0xf31a('0x4b');this['outbound']['total']+=0x1;if(this[_0xf31a('0x8')][_0x58163c[_0xf31a('0x16')]][_0xf31a('0x4c')]){this[_0xf31a('0x9')][_0xf31a('0x4d')]+=0x1;this[_0xf31a('0x8')][_0x58163c['uniqueid']][_0xf31a('0x4e')]=moment(this[_0xf31a('0x8')][_0x58163c[_0xf31a('0x16')]][_0xf31a('0x4c')])[_0xf31a('0x48')](this[_0xf31a('0x8')][_0x58163c['uniqueid']][_0xf31a('0x49')],_0xf31a('0x4a'));this[_0xf31a('0x8')][_0x58163c[_0xf31a('0x16')]][_0xf31a('0x4f')]=moment(this[_0xf31a('0x8')][_0x58163c[_0xf31a('0x16')]][_0xf31a('0x47')])[_0xf31a('0x48')](this[_0xf31a('0x8')][_0x58163c['uniqueid']][_0xf31a('0x4c')],'seconds');this[_0xf31a('0x9')][_0xf31a('0x50')]+=this[_0xf31a('0x8')][_0x58163c[_0xf31a('0x16')]][_0xf31a('0x4e')]||0x0;this[_0xf31a('0x9')][_0xf31a('0x51')]+=this[_0xf31a('0x8')][_0x58163c['uniqueid']][_0xf31a('0x4f')];}this[_0xf31a('0x9')][_0xf31a('0x52')]+=this[_0xf31a('0x8')][_0x58163c[_0xf31a('0x16')]][_0xf31a('0x46')];ami['emit'](_0xf31a('0x53'),this[_0xf31a('0x8')][_0x58163c[_0xf31a('0x16')]]);ami[_0xf31a('0x14')](_0xf31a('0x54'),this[_0xf31a('0x8')][_0x58163c[_0xf31a('0x16')]]);this[_0xf31a('0x14')](_0xf31a('0x2b'),_0xf31a('0x55'),this[_0xf31a('0x9')]);logger[_0xf31a('0x56')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0xf31a('0x57')](this[_0xf31a('0x8')][_0x58163c[_0xf31a('0x16')]]));this['emit'](_0xf31a('0x2b'),'voice_outbound_channel:remove',this[_0xf31a('0x8')][_0x58163c[_0xf31a('0x16')]]);delete this[_0xf31a('0x8')][_0x58163c[_0xf31a('0x16')]];}if(this['variables'][_0x58163c[_0xf31a('0x16')]]){delete this[_0xf31a('0xa')][_0x58163c[_0xf31a('0x16')]];}}}catch(_0x33f81b){logger[_0xf31a('0x20')](_0xf31a('0x58'),util['inspect'](_0x33f81b,{'showHidden':![],'depth':null}));}};module[_0xf31a('0x59')]=VoiceDialReport; \ No newline at end of file +var _0x27e3=['[syncHangup][VoiceDialReport]','moment','util','ioredis','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','variables','dialbegin','bind','dialend','syncDialEnd','syncVarSet','hangup','syncHangup','prototype','isUndefined','emit','syncDialBegin','isNotNull','uniqueid','merge','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','omit','event','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','dialstatus','connectedlinenum','connectedlinename','answertime','format','lastevent','connect','inspect','addVariable','keys','variable','outboundrouteid','value','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','membername','memberrealtime','includes','endtime','duration','diff','starttime','seconds','complete','outbound','total','answered','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','custom:voiceDialReport','custom:dialend','voice_outbound:save','info','stringify'];(function(_0x51f543,_0x43c97d){var _0x1e189d=function(_0x1ecfaa){while(--_0x1ecfaa){_0x51f543['push'](_0x51f543['shift']());}};_0x1e189d(++_0x43c97d);}(_0x27e3,0x15d));var _0x327e=function(_0x504823,_0x503a0c){_0x504823=_0x504823-0x0;var _0x56eb15=_0x27e3[_0x504823];return _0x56eb15;};'use strict';var _=require('lodash');var moment=require(_0x327e('0x0'));var util=require(_0x327e('0x1'));var Redis=require(_0x327e('0x2'));var config=require(_0x327e('0x3'));var logger=require('../../../config/logger')(_0x327e('0x4'));var ami=require(_0x327e('0x5'));config[_0x327e('0x6')]=_[_0x327e('0x7')](config[_0x327e('0x6')],{'host':_0x327e('0x8'),'port':0x18eb});var io=require(_0x327e('0x9'))(new Redis(config[_0x327e('0x6')]));function VoiceDialReport(_0x2d72d2){this[_0x327e('0xa')]=_0x2d72d2['outboundChannels'];this['outbound']=_0x2d72d2['outbound'];this[_0x327e('0xb')]={};ami['on'](_0x327e('0xc'),this['syncDialBegin'][_0x327e('0xd')](this));ami['on'](_0x327e('0xe'),this[_0x327e('0xf')][_0x327e('0xd')](this));ami['on']('varset',this[_0x327e('0x10')][_0x327e('0xd')](this));ami['on'](_0x327e('0x11'),this[_0x327e('0x12')][_0x327e('0xd')](this));}VoiceDialReport[_0x327e('0x13')]['isNotNull']=function(_0x347aab){return _0x347aab!==null&&!_[_0x327e('0x14')](_0x347aab);};VoiceDialReport[_0x327e('0x13')][_0x327e('0x15')]=function(_0x2829f5,_0x57adbe,_0x1bd431){io['to'](_0x2829f5)['emit'](_0x57adbe,_0x1bd431);};VoiceDialReport[_0x327e('0x13')][_0x327e('0x16')]=function(_0x1bb083){try{if(this[_0x327e('0x17')](_0x1bb083)){if(this[_0x327e('0xa')][_0x1bb083[_0x327e('0x18')]]){_[_0x327e('0x19')](this['channels'][_0x1bb083[_0x327e('0x18')]],{'starttime':moment()['format'](_0x327e('0x1a')),'lastevent':'called','interface':_0x1bb083[_0x327e('0x1b')][_0x327e('0x1c')](0x0,_0x1bb083[_0x327e('0x1b')][_0x327e('0x1d')]('-')),'membername':_0x1bb083[_0x327e('0x1b')][_0x327e('0x1c')](_0x1bb083[_0x327e('0x1b')]['lastIndexOf']('/')+0x1,_0x1bb083[_0x327e('0x1b')][_0x327e('0x1d')]('-'))},_[_0x327e('0x1e')](_0x1bb083,[_0x327e('0x1f'),'privilege']));this[_0x327e('0x15')](_0x327e('0x20'),_0x327e('0x21'),this[_0x327e('0xa')][_0x1bb083[_0x327e('0x18')]]);ami[_0x327e('0x15')](_0x327e('0x22'),this[_0x327e('0xa')][_0x1bb083['uniqueid']]);}}}catch(_0x5d67c0){logger[_0x327e('0x23')](_0x327e('0x24'),util['inspect'](_0x5d67c0,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x327e('0x13')][_0x327e('0xf')]=function(_0x38ec61){try{if(this[_0x327e('0x17')](_0x38ec61)){if(this[_0x327e('0xa')][_0x38ec61[_0x327e('0x18')]]){this[_0x327e('0xa')][_0x38ec61[_0x327e('0x18')]][_0x327e('0x25')]=_0x38ec61['dialstatus'];if(_0x38ec61[_0x327e('0x25')]==='ANSWER'){this[_0x327e('0xa')][_0x38ec61[_0x327e('0x18')]][_0x327e('0x26')]=_0x38ec61[_0x327e('0x26')];this[_0x327e('0xa')][_0x38ec61[_0x327e('0x18')]][_0x327e('0x27')]=_0x38ec61[_0x327e('0x27')];this[_0x327e('0xa')][_0x38ec61[_0x327e('0x18')]][_0x327e('0x28')]=moment()[_0x327e('0x29')](_0x327e('0x1a'));this[_0x327e('0xa')][_0x38ec61['uniqueid']][_0x327e('0x2a')]=_0x327e('0x2b');ami[_0x327e('0x15')]('custom:dialconnect',this[_0x327e('0xa')][_0x38ec61[_0x327e('0x18')]]);}this[_0x327e('0x15')](_0x327e('0x20'),_0x327e('0x21'),this[_0x327e('0xa')][_0x38ec61[_0x327e('0x18')]]);}}}catch(_0x2b6c42){logger[_0x327e('0x23')]('[syncDialEnd][VoiceDialReport]',util[_0x327e('0x2c')](_0x2b6c42,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x327e('0x13')][_0x327e('0x10')]=function(_0x5677d3){try{if(this[_0x327e('0x17')](_0x5677d3)){this[_0x327e('0x2d')](_0x5677d3[_0x327e('0x18')],_[_0x327e('0x2e')](_0x5677d3['variable'])[0x0],_0x5677d3['value']);if(this[_0x327e('0x17')](_0x5677d3[_0x327e('0x2f')])&&this[_0x327e('0x17')](_0x5677d3['variable'][_0x327e('0x30')])){if(_['isUndefined'](this[_0x327e('0xa')][_0x5677d3[_0x327e('0x18')]])){this[_0x327e('0xa')][_0x5677d3[_0x327e('0x18')]]={'routeId':_0x5677d3[_0x327e('0x31')],'variables':this[_0x327e('0xb')][_0x5677d3[_0x327e('0x18')]]};this[_0x327e('0x15')](_0x327e('0x20'),_0x327e('0x21'),this[_0x327e('0xa')][_0x5677d3[_0x327e('0x18')]]);}}}}catch(_0x547b48){logger[_0x327e('0x23')](_0x327e('0x32'),util[_0x327e('0x2c')](_0x547b48,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x327e('0x13')][_0x327e('0x2d')]=function(_0x1717ff,_0x484ad8,_0x7e4742){var _0x436356=[_0x327e('0x33'),_0x327e('0x34'),_0x327e('0x35'),_0x327e('0x36'),_0x327e('0x37'),_0x327e('0x38'),'rtpaudioqosrtt',_0x327e('0x39'),_0x327e('0x3a'),_0x327e('0x3b'),_0x327e('0x3c'),_0x327e('0x3d'),'membercalls',_0x327e('0x3e'),_0x327e('0x3f'),'memberlastcall',_0x327e('0x40'),'memberpenalty',_0x327e('0x41')];if(!_['isNil'](_0x484ad8)&&!_[_0x327e('0x42')](_0x436356,_0x484ad8)){if(_[_0x327e('0x14')](this[_0x327e('0xb')][_0x1717ff])){this[_0x327e('0xb')][_0x1717ff]={};}this[_0x327e('0xb')][_0x1717ff][_0x484ad8]=_0x7e4742;}};VoiceDialReport[_0x327e('0x13')]['syncHangup']=function(_0x2675f3){try{if(this[_0x327e('0x17')](_0x2675f3)){if(this[_0x327e('0xa')][_0x2675f3['uniqueid']]){this[_0x327e('0xa')][_0x2675f3['uniqueid']][_0x327e('0x43')]=moment()['format'](_0x327e('0x1a'));this[_0x327e('0xa')][_0x2675f3['uniqueid']][_0x327e('0x44')]=moment(this['channels'][_0x2675f3[_0x327e('0x18')]][_0x327e('0x43')])[_0x327e('0x45')](this[_0x327e('0xa')][_0x2675f3[_0x327e('0x18')]][_0x327e('0x46')],_0x327e('0x47'));this[_0x327e('0xa')][_0x2675f3[_0x327e('0x18')]]['lastevent']=_0x327e('0x48');this[_0x327e('0x49')][_0x327e('0x4a')]+=0x1;if(this[_0x327e('0xa')][_0x2675f3[_0x327e('0x18')]][_0x327e('0x28')]){this['outbound'][_0x327e('0x4b')]+=0x1;this[_0x327e('0xa')][_0x2675f3['uniqueid']][_0x327e('0x4c')]=moment(this['channels'][_0x2675f3[_0x327e('0x18')]][_0x327e('0x28')])[_0x327e('0x45')](this[_0x327e('0xa')][_0x2675f3[_0x327e('0x18')]][_0x327e('0x46')],'seconds');this[_0x327e('0xa')][_0x2675f3[_0x327e('0x18')]][_0x327e('0x4d')]=moment(this[_0x327e('0xa')][_0x2675f3[_0x327e('0x18')]]['endtime'])['diff'](this[_0x327e('0xa')][_0x2675f3['uniqueid']][_0x327e('0x28')],'seconds');this[_0x327e('0x49')][_0x327e('0x4e')]+=this[_0x327e('0xa')][_0x2675f3[_0x327e('0x18')]][_0x327e('0x4c')]||0x0;this[_0x327e('0x49')][_0x327e('0x4f')]+=this['channels'][_0x2675f3[_0x327e('0x18')]][_0x327e('0x4d')];}this[_0x327e('0x49')][_0x327e('0x50')]+=this[_0x327e('0xa')][_0x2675f3[_0x327e('0x18')]]['duration'];ami[_0x327e('0x15')](_0x327e('0x51'),this['channels'][_0x2675f3['uniqueid']]);ami[_0x327e('0x15')](_0x327e('0x52'),this[_0x327e('0xa')][_0x2675f3[_0x327e('0x18')]]);this[_0x327e('0x15')]('voice:outbound',_0x327e('0x53'),this[_0x327e('0x49')]);logger[_0x327e('0x54')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x327e('0x55')](this[_0x327e('0xa')][_0x2675f3[_0x327e('0x18')]]));this[_0x327e('0x15')](_0x327e('0x20'),'voice_outbound_channel:remove',this[_0x327e('0xa')][_0x2675f3[_0x327e('0x18')]]);delete this[_0x327e('0xa')][_0x2675f3[_0x327e('0x18')]];}if(this['variables'][_0x2675f3[_0x327e('0x18')]]){delete this[_0x327e('0xb')][_0x2675f3[_0x327e('0x18')]];}}}catch(_0x4f9b88){logger[_0x327e('0x23')](_0x327e('0x56'),util['inspect'](_0x4f9b88,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index b4ef2f0..1bcbdc7 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 _0x04c3=['FORWARD','transferexten','destexten','COMPLETEDBY','toUpperCase','[syncAgentComplete][VoiceQueueReport]','syncVarSet','addVariable','variable','CONTINUE','TIMEOUT','lastevent','timeout','custom:timeout','value','queueposition','EXITWITHKEY','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','length','queuecallerleaveAt','milliseconds','answered','diff','custom:queuecallerunmanaged','custom:queuecallerabandon','custom:voiceQueueReport','transfereeuniqueid','transferuniqueid','ATTENDEDTRANSFER','secondtransfereruniqueid','switch','transfertargetuniqueid','ATTENDED','origtransfereruniqueid','[syncAttendedTransfer][VoiceQueueReport]','BLINDTRANSFER','BLIND','extension','BlindTransfer','context','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','[syncMusicOnHoldStart][VoiceQueueReport]','mohstarttime','mohtime','[syncMusicOnHoldStop][VoiceQueueReport]','exports','moment','bluebird','util','md5','../../../config/environment','../../../config/logger','../model/queueReport','defaults','redis','localhost','prototype','enqueue','tail','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','agentconnect','hangup','syncHangup','fullybooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','blindtransfer','syncBlindTransfer','loopQueueSummary','isEmpty','hasOwnProperty','originated','pTalking','waiting','queueStatusComplete','unlockRR','isNil','Action','channel','catch','message','No\x20such\x20channel','error','[voiceQueueReport][checkQueueReport]','[voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','inspect','emit','emitVoiceQueueChannelSave','format','voice:queue:%s','name','voice_queue_channel:save','stringify','inbound','strategy','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','Trunk','active','callerid','Interval','voice_queue:save','isNotNull','loopQueueShow','clearZombieChannels','queues','[queues]','then','[queuesummary]','syncQueueSummary','queue','countBy','callers','toNumber','loggedin','available','emitVoiceQueueSummary','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','uniqueid','type','YYYY-MM-DD\x20HH:mm:ss','position','count','merge','pick','keys','push','[syncQueueCallerJoin][VoiceQueueReport]','syncQueueCallerAbandon','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','lastAssignedTo','[syncQueueCallerAbandon][VoiceQueueReport]','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','syncAgentConnect','COMPLETEDBYAGENT','[syncAgentConnect][VoiceQueueReport]','syncAgentComplete','assigned','membername','queuecallerexit','transfer','reason','COMPLETED','startsWith','local/','linkedid','queuecallerexitAt','queuecallerjoinAt','add','seconds','FORWARDTRANSFER','transfertype'];(function(_0x152ef7,_0x221f4c){var _0x33b535=function(_0x4d9ab7){while(--_0x4d9ab7){_0x152ef7['push'](_0x152ef7['shift']());}};_0x33b535(++_0x221f4c);}(_0x04c3,0x1d6));var _0x304c=function(_0x3d71d8,_0x15d0b4){_0x3d71d8=_0x3d71d8-0x0;var _0x480319=_0x04c3[_0x3d71d8];return _0x480319;};'use strict';var _=require('lodash');var moment=require(_0x304c('0x0'));var BPromise=require(_0x304c('0x1'));var util=require(_0x304c('0x2'));var md5=require(_0x304c('0x3'));var Redis=require('ioredis');var config=require(_0x304c('0x4'));var logger=require(_0x304c('0x5'))('ami');var ami=require('../ami');var QueueReport=require(_0x304c('0x6'));config['redis']=_[_0x304c('0x7')](config[_0x304c('0x8')],{'host':_0x304c('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x304c('0x8')]));var Sequence=function(){};Sequence[_0x304c('0xa')][_0x304c('0xb')]=function(_0x1a6c72){this[_0x304c('0xc')]=this[_0x304c('0xc')]?this[_0x304c('0xc')]['finally'](_0x1a6c72):_0x1a6c72();};function VoiceQueueReport(_0x7f5e3e){this[_0x304c('0xd')]=new Sequence();this[_0x304c('0xe')]={};this[_0x304c('0xf')]=_0x7f5e3e['agents'];this[_0x304c('0x10')]=_0x7f5e3e[_0x304c('0x11')];this[_0x304c('0x12')]=_0x7f5e3e[_0x304c('0x12')];this[_0x304c('0x13')]=!![];this[_0x304c('0x14')]=_0x7f5e3e['campaigns'];this[_0x304c('0x15')]={};ami['on'](_0x304c('0x16'),this['syncQueueSummary'][_0x304c('0x17')](this));ami['on'](_0x304c('0x18'),this[_0x304c('0x19')][_0x304c('0x17')](this));ami['on'](_0x304c('0x1a'),this[_0x304c('0x1b')][_0x304c('0x17')](this));ami['on'](_0x304c('0x1c'),this['syncQueueCallerAbandon'][_0x304c('0x17')](this));ami['on'](_0x304c('0x1d'),this[_0x304c('0x1e')][_0x304c('0x17')](this));ami['on'](_0x304c('0x1f'),this['syncAgentComplete'][_0x304c('0x17')](this));ami['on'](_0x304c('0x20'),this['syncAgentConnect'][_0x304c('0x17')](this));ami['on']('varset',this['syncVarSet'][_0x304c('0x17')](this));ami['on'](_0x304c('0x21'),this[_0x304c('0x22')][_0x304c('0x17')](this));ami['on'](_0x304c('0x23'),this['syncFullyBooted'][_0x304c('0x17')](this));ami['on'](_0x304c('0x24'),this[_0x304c('0x25')][_0x304c('0x17')](this));ami['on'](_0x304c('0x26'),this[_0x304c('0x27')][_0x304c('0x17')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0x304c('0x28'),this[_0x304c('0x29')][_0x304c('0x17')](this));this[_0x304c('0x2a')]();this['loopQueueShow']();}function isNotNull(_0x4be71d){return _0x4be71d!==null&&!_['isUndefined'](_0x4be71d);}function clearChannels(_0x293ca7){if(!_[_0x304c('0x2b')](_0x293ca7)){for(var _0x1cb7ce in _0x293ca7){if(_0x293ca7[_0x304c('0x2c')](_0x1cb7ce)){delete _0x293ca7[_0x1cb7ce];}}}}function clearCampaigns(_0x5c2c72){if(!_[_0x304c('0x2b')](_0x5c2c72)){for(var _0x1d2c9f in _0x5c2c72){if(_0x5c2c72['hasOwnProperty'](_0x1d2c9f)){_0x5c2c72[_0x1d2c9f][_0x304c('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x5897a0){if(!_['isEmpty'](_0x5897a0)){for(var _0x2d0056 in _0x5897a0){if(_0x5897a0[_0x304c('0x2c')](_0x2d0056)){_0x5897a0[_0x2d0056][_0x304c('0x2d')]=0x0;_0x5897a0[_0x2d0056]['talking']=0x0;_0x5897a0[_0x2d0056][_0x304c('0x2e')]=0x0;_0x5897a0[_0x2d0056][_0x304c('0x2f')]=0x0;_0x5897a0[_0x2d0056][_0x304c('0x30')]=!![];}}}}function clearAgentBooked(_0x4cd611){if(!_['isEmpty'](_0x4cd611)){for(var _0x5cb2de in _0x4cd611){if(_0x4cd611['hasOwnProperty'](_0x5cb2de)){_0x4cd611[_0x5cb2de][_0x304c('0x31')]=!![];}}}}VoiceQueueReport['prototype']['clearZombieChannels']=function(){var _0x39c6d1=this;for(var _0x376436 in this['channels']){if(this[_0x304c('0x10')][_0x304c('0x2c')](_0x376436)&&!this['channels'][_0x376436]['switch']){this[_0x304c('0xd')][_0x304c('0xb')](function(){if(!_[_0x304c('0x32')](_0x39c6d1[_0x304c('0x10')][_0x376436])){return ami[_0x304c('0x33')]({'action':'status','channel':_0x39c6d1['channels'][_0x376436][_0x304c('0x34')]})[_0x304c('0x35')](function(_0x29b811){if(_0x29b811[_0x304c('0x36')]===_0x304c('0x37')){setTimeout(function(){if(_0x39c6d1[_0x304c('0x10')][_0x376436]){delete _0x39c6d1[_0x304c('0x10')][_0x376436];logger[_0x304c('0x38')]('[voiceQueueReport][checkChannel]',_0x376436);}if(_0x39c6d1[_0x304c('0xe')][_0x376436]){delete _0x39c6d1[_0x304c('0xe')][_0x376436];logger[_0x304c('0x38')](_0x304c('0x39'),_0x376436);}if(_0x39c6d1['variables'][_0x376436]){delete _0x39c6d1['variables'][_0x376436];logger[_0x304c('0x38')](_0x304c('0x3a'),_0x376436);}},0x1f40);}});}});}}};VoiceQueueReport['prototype']['syncFullyBooted']=function(){logger[_0x304c('0x38')](_0x304c('0x3b'));clearChannels(this[_0x304c('0x10')]);this[_0x304c('0x3c')](this[_0x304c('0xe')]);clearAgentBooked(this[_0x304c('0xf')]);clearVoiceQueues(this[_0x304c('0x12')]);clearCampaigns(this[_0x304c('0x14')]);};VoiceQueueReport[_0x304c('0xa')][_0x304c('0x3c')]=function(_0x5478c2){var _0x2c74c9=this;if(!_[_0x304c('0x2b')](_0x5478c2)){for(var _0x79259b in _0x5478c2){if(_0x5478c2['hasOwnProperty'](_0x79259b)){_0x2c74c9[_0x304c('0x3d')](_0x5478c2[_0x79259b]);delete _0x5478c2[_0x79259b];}}}};function loggerCatch(_0x26b926){return function(_0x410990){logger[_0x304c('0x38')](_0x26b926,util[_0x304c('0x3e')](_0x410990,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0x304c('0xa')][_0x304c('0x3f')]=function(_0x5df962,_0x2f9ef5,_0x4e0c02){io['to'](_0x5df962)[_0x304c('0x3f')](_0x2f9ef5,_0x4e0c02);};VoiceQueueReport[_0x304c('0xa')][_0x304c('0x40')]=function(_0x40f13e){this[_0x304c('0x3f')](util[_0x304c('0x41')](_0x304c('0x42'),_0x40f13e[_0x304c('0x43')]),_0x304c('0x44'),_0x40f13e);};VoiceQueueReport[_0x304c('0xa')][_0x304c('0x3d')]=function(_0x1c3362){logger['info']('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x304c('0x45')](_0x1c3362));this[_0x304c('0x3f')](util[_0x304c('0x41')](_0x304c('0x42'),_0x1c3362[_0x304c('0x43')]),'voice_queue_channel:remove',_0x1c3362);};VoiceQueueReport[_0x304c('0xa')]['emitVoiceQueueSummary']=function(_0x58b920){if(_0x58b920['type']===_0x304c('0x46')){var _0xfa398f={'id':_0x58b920['id'],'name':_0x58b920[_0x304c('0x43')],'strategy':_0x58b920[_0x304c('0x47')],'answered':_0x58b920['answered'],'available':_0x58b920['available'],'loggedIn':_0x58b920[_0x304c('0x48')],'pTalking':_0x58b920[_0x304c('0x2e')],'sumBillable':_0x58b920[_0x304c('0x49')],'sumDuration':_0x58b920[_0x304c('0x4a')],'sumHoldTime':_0x58b920[_0x304c('0x4b')]||0x0,'talking':_0x58b920[_0x304c('0x4c')],'total':_0x58b920[_0x304c('0x4d')],'type':_0x58b920['type'],'unmanaged':_0x58b920[_0x304c('0x4e')],'abandoned':_0x58b920[_0x304c('0x4f')],'waiting':_0x58b920['waiting']};if(_0x58b920[_0x304c('0x50')]){_0xfa398f[_0x304c('0x50')]={'id':_0x58b920[_0x304c('0x50')]['id'],'name':_0x58b920[_0x304c('0x50')][_0x304c('0x43')],'active':_0x58b920['Trunk'][_0x304c('0x51')],'callerid':_0x58b920[_0x304c('0x50')][_0x304c('0x52')]};}if(_0x58b920[_0x304c('0x53')]){_0xfa398f[_0x304c('0x53')]={'id':_0x58b920['Interval']['id'],'name':_0x58b920[_0x304c('0x53')][_0x304c('0x43')]};}var _0x8df3c0=md5(JSON['stringify'](_0xfa398f));if(_0x58b920['md5']!==_0x8df3c0){_0x58b920[_0x304c('0x3')]=_0x8df3c0;this['emit'](util[_0x304c('0x41')](_0x304c('0x42'),_0xfa398f[_0x304c('0x43')]),_0x304c('0x54'),_0xfa398f);}}};VoiceQueueReport['prototype'][_0x304c('0x55')]=function(_0x32a043){return _0x32a043!==null&&!_['isUndefined'](_0x32a043);};VoiceQueueReport[_0x304c('0xa')][_0x304c('0x56')]=function(){var _0x429bab=this;setInterval(function(){_0x429bab[_0x304c('0x57')]();ami[_0x304c('0x33')]({'action':_0x304c('0x58')})[_0x304c('0x35')](loggerCatch(_0x304c('0x59')));},0x2710);};VoiceQueueReport[_0x304c('0xa')][_0x304c('0x2a')]=function(){var _0x13b2d3=this;setInterval(function(){if(_0x13b2d3[_0x304c('0x13')]){return ami[_0x304c('0x33')]({'action':_0x304c('0x16')})[_0x304c('0x5a')](function(_0x574ecc){_0x13b2d3[_0x304c('0x13')]=![];})['catch'](loggerCatch(_0x304c('0x5b')));}},0x3e8);};VoiceQueueReport[_0x304c('0xa')][_0x304c('0x5c')]=function(_0x241d21){try{if(this[_0x304c('0x55')](_0x241d21)&&this[_0x304c('0x55')](_0x241d21[_0x304c('0x5d')])){if(this[_0x304c('0x12')][_0x241d21[_0x304c('0x5d')]]){var _0x361763=_[_0x304c('0x5e')](this[_0x304c('0x10')],_0x304c('0x5d'))[_0x241d21[_0x304c('0x5d')]]||0x0;var _0x321639=_0x361763-_0x241d21[_0x304c('0x5f')];if(this[_0x304c('0x12')][_0x241d21[_0x304c('0x5d')]][_0x304c('0x2f')]!==_[_0x304c('0x60')](_0x241d21['callers'])||this[_0x304c('0x12')][_0x241d21[_0x304c('0x5d')]]['loggedIn']!==_[_0x304c('0x60')](_0x241d21[_0x304c('0x61')])||this[_0x304c('0x12')][_0x241d21[_0x304c('0x5d')]][_0x304c('0x62')]!==_[_0x304c('0x60')](_0x241d21[_0x304c('0x62')])||this['voiceQueues'][_0x241d21[_0x304c('0x5d')]][_0x304c('0x4c')]!==_0x321639){this[_0x304c('0x12')][_0x241d21['queue']][_0x304c('0x2f')]=_[_0x304c('0x60')](_0x241d21['callers']);this[_0x304c('0x12')][_0x241d21[_0x304c('0x5d')]][_0x304c('0x48')]=_['toNumber'](_0x241d21[_0x304c('0x61')]);this['voiceQueues'][_0x241d21[_0x304c('0x5d')]][_0x304c('0x62')]=_[_0x304c('0x60')](_0x241d21[_0x304c('0x62')]);this[_0x304c('0x12')][_0x241d21[_0x304c('0x5d')]][_0x304c('0x4c')]=_0x321639>0x0?_0x321639:0x0;this[_0x304c('0x12')][_0x241d21[_0x304c('0x5d')]][_0x304c('0x4c')]=this[_0x304c('0x12')][_0x241d21['queue']][_0x304c('0x4c')]>_[_0x304c('0x60')](_0x241d21['loggedin'])?_[_0x304c('0x60')](_0x241d21['loggedin']):this[_0x304c('0x12')][_0x241d21[_0x304c('0x5d')]][_0x304c('0x4c')];this[_0x304c('0x63')](this['voiceQueues'][_0x241d21[_0x304c('0x5d')]]);}ami[_0x304c('0x3f')](_0x304c('0x64'),this[_0x304c('0x12')][_0x241d21[_0x304c('0x5d')]]);}}}catch(_0x3db201){logger[_0x304c('0x38')](_0x304c('0x65'),util['inspect'](_0x3db201,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x8afd0b){this[_0x304c('0x13')]=!![];};VoiceQueueReport[_0x304c('0xa')]['syncNewExten']=function(_0x3051d2){};VoiceQueueReport[_0x304c('0xa')]['syncQueueCallerJoin']=function(_0x4ac0bf){try{if(this[_0x304c('0x55')](_0x4ac0bf)){if(_['isUndefined'](this[_0x304c('0xe')][_0x4ac0bf[_0x304c('0x66')]])){this[_0x304c('0xe')][_0x4ac0bf[_0x304c('0x66')]]=[];this[_0x304c('0x10')][_0x4ac0bf[_0x304c('0x66')]]={};}var _0x547135=new QueueReport();_0x547135['name']=_0x4ac0bf[_0x304c('0x5d')];_0x547135[_0x304c('0x67')]=this['voiceQueues'][_0x547135[_0x304c('0x43')]]&&this[_0x304c('0x12')][_0x547135[_0x304c('0x43')]][_0x304c('0x67')]?this[_0x304c('0x12')][_0x547135[_0x304c('0x43')]][_0x304c('0x67')]||_0x304c('0x46'):_0x304c('0x46');_0x547135['queue']=_0x4ac0bf[_0x304c('0x5d')];_0x547135['queuecallerjoinAt']=moment()['format'](_0x304c('0x68'));_0x547135[_0x304c('0x69')]=_0x4ac0bf['position'];_0x547135[_0x304c('0x6a')]=_0x4ac0bf['count'];_[_0x304c('0x6b')](_0x547135,_[_0x304c('0x6c')](_0x4ac0bf,_[_0x304c('0x6d')](_0x547135)));this[_0x304c('0xe')][_0x4ac0bf[_0x304c('0x66')]][_0x304c('0x6e')](_0x547135);this[_0x304c('0x10')][_0x4ac0bf[_0x304c('0x66')]]=_0x547135;this[_0x304c('0x40')](_0x547135);}}catch(_0x358c04){logger[_0x304c('0x38')](_0x304c('0x6f'),util['inspect'](_0x358c04,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x304c('0xa')][_0x304c('0x70')]=function(_0x192fa4){try{if(this[_0x304c('0x55')](_0x192fa4)){if(this[_0x304c('0xe')][_0x192fa4[_0x304c('0x66')]]){var _0x1ca5cc=_[_0x304c('0x71')](this['queueReports'][_0x192fa4['uniqueid']]);_0x1ca5cc[_0x304c('0x72')]=![];_0x1ca5cc[_0x304c('0x73')]=null;_0x1ca5cc['holdtime']=_0x192fa4[_0x304c('0x74')];_0x1ca5cc[_0x304c('0x75')]=_0x192fa4[_0x304c('0x75')];_0x1ca5cc[_0x304c('0x1c')]=!![];_0x1ca5cc[_0x304c('0x76')]=moment()['format'](_0x304c('0x68'));_0x1ca5cc[_0x304c('0x77')]=_0x304c('0x78');_0x1ca5cc[_0x304c('0x79')]=null;this[_0x304c('0x10')][_0x192fa4['uniqueid']]=_0x1ca5cc;this[_0x304c('0x3d')](_0x1ca5cc);}}}catch(_0x5254d7){logger[_0x304c('0x38')](_0x304c('0x7a'),util[_0x304c('0x3e')](_0x5254d7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x304c('0xa')]['syncQueueCallerLeave']=function(_0x404c89){try{if(this['isNotNull'](_0x404c89)){if(this['queueReports'][_0x404c89[_0x304c('0x66')]]){var _0x3ac027=_['last'](this['queueReports'][_0x404c89[_0x304c('0x66')]]);_0x3ac027['queuecallerleaveAt']=moment()[_0x304c('0x41')]('YYYY-MM-DD\x20HH:mm:ss');_0x3ac027[_0x304c('0x7b')]=_0x404c89[_0x304c('0x7b')];_0x3ac027[_0x304c('0x7c')]=_0x404c89['connectedlinename'];this[_0x304c('0x10')][_0x404c89[_0x304c('0x66')]]=_0x3ac027;this[_0x304c('0x40')](_0x3ac027);}}}catch(_0x2cc3a1){logger[_0x304c('0x38')](_0x304c('0x7d'),util[_0x304c('0x3e')](_0x2cc3a1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x304c('0xa')][_0x304c('0x7e')]=function(_0x241e18){try{if(this[_0x304c('0x55')](_0x241e18)){if(this[_0x304c('0xe')][_0x241e18[_0x304c('0x66')]]){var _0x34e321=_[_0x304c('0x71')](this[_0x304c('0xe')][_0x241e18[_0x304c('0x66')]]);_0x34e321[_0x304c('0x72')]=!![];_0x34e321[_0x304c('0x77')]=_0x304c('0x7f');}}}catch(_0x5420ec){logger['error'](_0x304c('0x80'),util[_0x304c('0x3e')](_0x5420ec,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x304c('0xa')][_0x304c('0x81')]=function(_0x42898e){try{if(this[_0x304c('0x55')](_0x42898e)){if(this[_0x304c('0xe')][_0x42898e['uniqueid']]){var _0x4e4c31=_['last'](this['queueReports'][_0x42898e[_0x304c('0x66')]]);_0x4e4c31[_0x304c('0x1c')]=![];_0x4e4c31['queuecallerabandonAt']=null;_0x4e4c31[_0x304c('0x82')]=!![];_0x4e4c31[_0x304c('0x79')]=_0x42898e[_0x304c('0x83')];_0x4e4c31[_0x304c('0x74')]=_0x42898e[_0x304c('0x74')];_0x4e4c31[_0x304c('0x72')]=!![];_0x4e4c31[_0x304c('0x84')]=![];_0x4e4c31['queuecallerexitAt']=null;if(!_0x4e4c31[_0x304c('0x85')]){if(_0x42898e[_0x304c('0x86')]==_0x304c('0x85')){_0x4e4c31['queuecallerexitreason']=_0x304c('0x87');}else{if(_[_0x304c('0x88')](_0x42898e[_0x304c('0x34')]['toLowerCase'](),_0x304c('0x89'))){if(this[_0x304c('0xe')][_0x42898e[_0x304c('0x8a')]]){var _0x4c6468=_[_0x304c('0x71')](this[_0x304c('0xe')][_0x42898e['linkedid']]);_0x4c6468[_0x304c('0x72')]=![];_0x4c6468[_0x304c('0x84')]=!![];_0x4c6468[_0x304c('0x8b')]=moment(_0x4e4c31[_0x304c('0x8c')])[_0x304c('0x8d')](_0x42898e[_0x304c('0x74')],_0x304c('0x8e'))['format'](_0x304c('0x68'));_0x4c6468[_0x304c('0x77')]=_0x304c('0x8f');_0x4c6468[_0x304c('0x85')]=!![];_0x4c6468[_0x304c('0x90')]=_0x304c('0x91');_0x4c6468[_0x304c('0x92')]=_0x42898e[_0x304c('0x93')];_0x4c6468['transferuniqueid']=_0x42898e[_0x304c('0x66')];var _0x1f61b2=this[_0x304c('0xe')][_0x42898e[_0x304c('0x8a')]];this['queueReports'][_0x42898e[_0x304c('0x8a')]]=this[_0x304c('0xe')][_0x42898e[_0x304c('0x66')]];this[_0x304c('0xe')][_0x42898e[_0x304c('0x66')]]=_0x1f61b2;}}else{_0x4e4c31[_0x304c('0x77')]=_0x304c('0x94')+_0x42898e[_0x304c('0x86')][_0x304c('0x95')]();}}}this[_0x304c('0x10')][_0x42898e['uniqueid']]=_0x4e4c31;this[_0x304c('0x3d')](_0x4e4c31);}}}catch(_0x4dcf69){logger[_0x304c('0x38')](_0x304c('0x96'),util[_0x304c('0x3e')](_0x4dcf69,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x304c('0xa')][_0x304c('0x97')]=function(_0x22486b){try{if(this[_0x304c('0x55')](_0x22486b)){this[_0x304c('0x98')](_0x22486b[_0x304c('0x66')],_['keys'](_0x22486b[_0x304c('0x99')])[0x0],_0x22486b['value']);if(this[_0x304c('0xe')][_0x22486b[_0x304c('0x66')]]){var _0x1c527b=_[_0x304c('0x71')](this['queueReports'][_0x22486b[_0x304c('0x66')]]);if(_0x1c527b){if(this[_0x304c('0x55')](_0x22486b['variable'])&&this[_0x304c('0x55')](_0x22486b[_0x304c('0x99')]['queuestatus'])){switch(_0x22486b['value']){case _0x304c('0x9a'):_0x1c527b[_0x304c('0x84')]=![];_0x1c527b[_0x304c('0x8b')]=null;break;case _0x304c('0x9b'):_0x1c527b[_0x304c('0x9c')]=_0x304c('0x9d');ami['emit'](_0x304c('0x9e'),_0x1c527b);break;default:_0x1c527b[_0x304c('0x84')]=!![];_0x1c527b[_0x304c('0x8b')]=moment()['format'](_0x304c('0x68'));_0x1c527b['queuecallerleaveAt']=moment()[_0x304c('0x41')](_0x304c('0x68'));}_0x1c527b['queuecallerabandon']=![];_0x1c527b[_0x304c('0x76')]=null;_0x1c527b[_0x304c('0x77')]=_0x22486b[_0x304c('0x9f')];this[_0x304c('0x10')][_0x22486b[_0x304c('0x66')]]=_0x1c527b;this[_0x304c('0x3d')](_0x1c527b);}else if(this[_0x304c('0x55')](_0x22486b[_0x304c('0x99')])&&this['isNotNull'](_0x22486b[_0x304c('0x99')][_0x304c('0xa0')])){if(!_0x1c527b[_0x304c('0x1c')]){_0x1c527b['queuecallerexit']=!![];_0x1c527b['queuecallerexitAt']=moment()['format'](_0x304c('0x68'));_0x1c527b['queuecallerexitreason']=_0x304c('0xa1');_0x1c527b['queuecallerleaveAt']=moment()[_0x304c('0x41')](_0x304c('0x68'));this[_0x304c('0x10')][_0x22486b[_0x304c('0x66')]]=_0x1c527b;}}_0x1c527b[_0x304c('0x15')]=this[_0x304c('0x15')][_0x22486b['uniqueid']];}}}}catch(_0x366bc3){logger['error']('[syncVarSet][VoiceQueueReport]',util[_0x304c('0x3e')](_0x366bc3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x304c('0xa')]['addVariable']=function(_0x2860d3,_0x448f00,_0x6f4d0a){var _0x280f34=[_0x304c('0xa2'),'rtpaudioqosbridged',_0x304c('0xa3'),_0x304c('0xa4'),_0x304c('0xa5'),_0x304c('0xa6'),'rtpaudioqosrtt',_0x304c('0xa7'),_0x304c('0xa8'),_0x304c('0xa9'),'bridgepeer',_0x304c('0xaa'),_0x304c('0xab'),_0x304c('0xac'),_0x304c('0xad'),_0x304c('0xae'),_0x304c('0x83'),'memberpenalty',_0x304c('0xaf')];if(!_[_0x304c('0x32')](_0x448f00)&&!_['includes'](_0x280f34,_0x448f00)){if(_['isUndefined'](this[_0x304c('0x15')][_0x2860d3])){this['variables'][_0x2860d3]={};}this[_0x304c('0x15')][_0x2860d3][_0x448f00]=_0x6f4d0a;}};VoiceQueueReport[_0x304c('0xa')]['syncHangup']=function(_0x319f76){try{if(this[_0x304c('0x55')](_0x319f76)){if(this[_0x304c('0xe')][_0x319f76[_0x304c('0x66')]]){for(var _0x2e4b37=0x0,_0x3e501c={};_0x2e4b370x0?_0x11f50a:0x0;this[_0x0544('0x11')][_0x79df2a[_0x0544('0x64')]]['talking']=this[_0x0544('0x11')][_0x79df2a[_0x0544('0x64')]][_0x0544('0x30')]>_[_0x0544('0x66')](_0x79df2a[_0x0544('0x67')])?_[_0x0544('0x66')](_0x79df2a['loggedin']):this[_0x0544('0x11')][_0x79df2a[_0x0544('0x64')]][_0x0544('0x30')];this[_0x0544('0x69')](this[_0x0544('0x11')][_0x79df2a[_0x0544('0x64')]]);}ami[_0x0544('0x45')](_0x0544('0x6a'),this['voiceQueues'][_0x79df2a['queue']]);}}}catch(_0x3a2af1){logger[_0x0544('0x3d')](_0x0544('0x6b'),util[_0x0544('0x44')](_0x3a2af1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0544('0x34')][_0x0544('0x18')]=function(_0x73c41){this['flagQueueSummary']=!![];};VoiceQueueReport[_0x0544('0x34')]['syncNewExten']=function(_0x598533){};VoiceQueueReport[_0x0544('0x34')][_0x0544('0x1a')]=function(_0x1742b3){try{if(this['isNotNull'](_0x1742b3)){if(_[_0x0544('0x5e')](this[_0x0544('0xe')][_0x1742b3['uniqueid']])){this[_0x0544('0xe')][_0x1742b3[_0x0544('0x6c')]]=[];this[_0x0544('0x35')][_0x1742b3['uniqueid']]={};}var _0x19347c=new QueueReport();_0x19347c['name']=_0x1742b3[_0x0544('0x64')];_0x19347c[_0x0544('0x4c')]=this[_0x0544('0x11')][_0x19347c[_0x0544('0x48')]]&&this[_0x0544('0x11')][_0x19347c[_0x0544('0x48')]][_0x0544('0x4c')]?this[_0x0544('0x11')][_0x19347c['name']][_0x0544('0x4c')]||_0x0544('0x4d'):_0x0544('0x4d');_0x19347c[_0x0544('0x64')]=_0x1742b3[_0x0544('0x64')];_0x19347c[_0x0544('0x6d')]=moment()['format'](_0x0544('0x6e'));_0x19347c[_0x0544('0x6f')]=_0x1742b3[_0x0544('0x6f')];_0x19347c[_0x0544('0x70')]=_0x1742b3['count'];_[_0x0544('0x71')](_0x19347c,_[_0x0544('0x72')](_0x1742b3,_[_0x0544('0x73')](_0x19347c)));this[_0x0544('0xe')][_0x1742b3[_0x0544('0x6c')]]['push'](_0x19347c);this[_0x0544('0x35')][_0x1742b3[_0x0544('0x6c')]]=_0x19347c;this['emitVoiceQueueChannelSave'](_0x19347c);}}catch(_0x591c8d){logger[_0x0544('0x3d')]('[syncQueueCallerJoin][VoiceQueueReport]',util[_0x0544('0x44')](_0x591c8d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0544('0x34')][_0x0544('0x1c')]=function(_0x4e2b11){try{if(this[_0x0544('0x5d')](_0x4e2b11)){if(this['queueReports'][_0x4e2b11[_0x0544('0x6c')]]){var _0x4709e5=_[_0x0544('0x74')](this['queueReports'][_0x4e2b11[_0x0544('0x6c')]]);_0x4709e5[_0x0544('0x75')]=![];_0x4709e5[_0x0544('0x76')]=null;_0x4709e5['holdtime']=_0x4e2b11[_0x0544('0x77')];_0x4709e5[_0x0544('0x78')]=_0x4e2b11[_0x0544('0x78')];_0x4709e5['queuecallerabandon']=!![];_0x4709e5[_0x0544('0x79')]=moment()[_0x0544('0x46')](_0x0544('0x6e'));_0x4709e5[_0x0544('0x7a')]=_0x0544('0x7b');_0x4709e5[_0x0544('0x7c')]=null;this[_0x0544('0x35')][_0x4e2b11[_0x0544('0x6c')]]=_0x4709e5;this[_0x0544('0x43')](_0x4709e5);}}}catch(_0x93694){logger[_0x0544('0x3d')](_0x0544('0x7d'),util['inspect'](_0x93694,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0544('0x34')][_0x0544('0x1e')]=function(_0x2fbafb){try{if(this[_0x0544('0x5d')](_0x2fbafb)){if(this['queueReports'][_0x2fbafb[_0x0544('0x6c')]]){var _0x18dcb4=_[_0x0544('0x74')](this[_0x0544('0xe')][_0x2fbafb[_0x0544('0x6c')]]);_0x18dcb4['queuecallerleaveAt']=moment()['format'](_0x0544('0x6e'));_0x18dcb4[_0x0544('0x7e')]=_0x2fbafb[_0x0544('0x7e')];_0x18dcb4[_0x0544('0x7f')]=_0x2fbafb['connectedlinename'];this[_0x0544('0x35')][_0x2fbafb[_0x0544('0x6c')]]=_0x18dcb4;this['emitVoiceQueueChannelSave'](_0x18dcb4);}}}catch(_0xdcdf58){logger['error'](_0x0544('0x80'),util[_0x0544('0x44')](_0xdcdf58,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0544('0x34')][_0x0544('0x20')]=function(_0x46b90f){try{if(this['isNotNull'](_0x46b90f)){if(this[_0x0544('0xe')][_0x46b90f[_0x0544('0x6c')]]){var _0x2e5eb1=_[_0x0544('0x74')](this['queueReports'][_0x46b90f['uniqueid']]);_0x2e5eb1[_0x0544('0x75')]=!![];_0x2e5eb1['queuecallerexitreason']=_0x0544('0x81');}}}catch(_0x2b29a8){logger['error'](_0x0544('0x82'),util[_0x0544('0x44')](_0x2b29a8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0544('0x34')]['syncAgentComplete']=function(_0x1e6517){try{if(this[_0x0544('0x5d')](_0x1e6517)){if(this[_0x0544('0xe')][_0x1e6517['uniqueid']]){var _0xe8d7ed=_['last'](this[_0x0544('0xe')][_0x1e6517['uniqueid']]);_0xe8d7ed[_0x0544('0x1b')]=![];_0xe8d7ed[_0x0544('0x79')]=null;_0xe8d7ed[_0x0544('0x83')]=!![];_0xe8d7ed[_0x0544('0x7c')]=_0x1e6517[_0x0544('0x84')];_0xe8d7ed[_0x0544('0x77')]=_0x1e6517[_0x0544('0x77')];_0xe8d7ed[_0x0544('0x75')]=!![];_0xe8d7ed['queuecallerexit']=![];_0xe8d7ed[_0x0544('0x85')]=null;if(!_0xe8d7ed[_0x0544('0x86')]){if(_0x1e6517['reason']==_0x0544('0x86')){_0xe8d7ed['queuecallerexitreason']='COMPLETED';}else{if(_['startsWith'](_0x1e6517[_0x0544('0x39')][_0x0544('0x87')](),_0x0544('0x88'))){if(this[_0x0544('0xe')][_0x1e6517[_0x0544('0x89')]]){var _0x3128b3=_[_0x0544('0x74')](this['queueReports'][_0x1e6517[_0x0544('0x89')]]);_0x3128b3[_0x0544('0x75')]=![];_0x3128b3[_0x0544('0x8a')]=!![];_0x3128b3[_0x0544('0x85')]=moment(_0xe8d7ed['queuecallerjoinAt'])[_0x0544('0x8b')](_0x1e6517['holdtime'],_0x0544('0x8c'))[_0x0544('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x3128b3[_0x0544('0x7a')]=_0x0544('0x8d');_0x3128b3['transfer']=!![];_0x3128b3['transfertype']=_0x0544('0x8e');_0x3128b3[_0x0544('0x8f')]=_0x1e6517[_0x0544('0x90')];_0x3128b3['transferuniqueid']=_0x1e6517[_0x0544('0x6c')];var _0x2f60cc=this[_0x0544('0xe')][_0x1e6517[_0x0544('0x89')]];this[_0x0544('0xe')][_0x1e6517[_0x0544('0x89')]]=this['queueReports'][_0x1e6517['uniqueid']];this[_0x0544('0xe')][_0x1e6517[_0x0544('0x6c')]]=_0x2f60cc;}}else{_0xe8d7ed[_0x0544('0x7a')]=_0x0544('0x91')+_0x1e6517[_0x0544('0x92')][_0x0544('0x93')]();}}}this[_0x0544('0x35')][_0x1e6517[_0x0544('0x6c')]]=_0xe8d7ed;this[_0x0544('0x43')](_0xe8d7ed);}}}catch(_0x45b5d7){logger[_0x0544('0x3d')](_0x0544('0x94'),util['inspect'](_0x45b5d7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0544('0x34')][_0x0544('0x22')]=function(_0x2c26c1){try{if(this[_0x0544('0x5d')](_0x2c26c1)){this[_0x0544('0x95')](_0x2c26c1[_0x0544('0x6c')],_[_0x0544('0x73')](_0x2c26c1[_0x0544('0x96')])[0x0],_0x2c26c1['value']);if(this[_0x0544('0xe')][_0x2c26c1[_0x0544('0x6c')]]){var _0x52fc30=_[_0x0544('0x74')](this[_0x0544('0xe')][_0x2c26c1[_0x0544('0x6c')]]);if(_0x52fc30){if(this[_0x0544('0x5d')](_0x2c26c1[_0x0544('0x96')])&&this[_0x0544('0x5d')](_0x2c26c1[_0x0544('0x96')][_0x0544('0x97')])){switch(_0x2c26c1['value']){case _0x0544('0x98'):_0x52fc30[_0x0544('0x8a')]=![];_0x52fc30[_0x0544('0x85')]=null;break;case _0x0544('0x99'):_0x52fc30['lastevent']=_0x0544('0x9a');ami['emit'](_0x0544('0x9b'),_0x52fc30);break;default:_0x52fc30[_0x0544('0x8a')]=!![];_0x52fc30[_0x0544('0x85')]=moment()[_0x0544('0x46')](_0x0544('0x6e'));_0x52fc30[_0x0544('0x9c')]=moment()[_0x0544('0x46')]('YYYY-MM-DD\x20HH:mm:ss');}_0x52fc30[_0x0544('0x1b')]=![];_0x52fc30[_0x0544('0x79')]=null;_0x52fc30[_0x0544('0x7a')]=_0x2c26c1[_0x0544('0x9d')];this[_0x0544('0x35')][_0x2c26c1['uniqueid']]=_0x52fc30;this[_0x0544('0x43')](_0x52fc30);}else if(this[_0x0544('0x5d')](_0x2c26c1[_0x0544('0x96')])&&this['isNotNull'](_0x2c26c1[_0x0544('0x96')][_0x0544('0x9e')])){if(!_0x52fc30[_0x0544('0x1b')]){_0x52fc30['queuecallerexit']=!![];_0x52fc30[_0x0544('0x85')]=moment()['format'](_0x0544('0x6e'));_0x52fc30[_0x0544('0x7a')]=_0x0544('0x9f');_0x52fc30[_0x0544('0x9c')]=moment()[_0x0544('0x46')](_0x0544('0x6e'));this[_0x0544('0x35')][_0x2c26c1[_0x0544('0x6c')]]=_0x52fc30;}}_0x52fc30[_0x0544('0x14')]=this[_0x0544('0x14')][_0x2c26c1[_0x0544('0x6c')]];}}}}catch(_0x600dca){logger[_0x0544('0x3d')](_0x0544('0xa0'),util[_0x0544('0x44')](_0x600dca,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0544('0x34')][_0x0544('0x95')]=function(_0x39049f,_0x21f0e1,_0x1b55dc){var _0x187d6d=['rtpaudioqos',_0x0544('0xa1'),_0x0544('0xa2'),_0x0544('0xa3'),_0x0544('0xa4'),_0x0544('0xa5'),_0x0544('0xa6'),_0x0544('0xa7'),_0x0544('0xa8'),_0x0544('0xa9'),_0x0544('0xaa'),'bridgepvtcallid',_0x0544('0xab'),_0x0544('0xac'),_0x0544('0xad'),_0x0544('0xae'),_0x0544('0x84'),'memberpenalty',_0x0544('0xaf')];if(!_[_0x0544('0x37')](_0x21f0e1)&&!_[_0x0544('0xb0')](_0x187d6d,_0x21f0e1)){if(_[_0x0544('0x5e')](this[_0x0544('0x14')][_0x39049f])){this['variables'][_0x39049f]={};}this['variables'][_0x39049f][_0x21f0e1]=_0x1b55dc;}};VoiceQueueReport[_0x0544('0x34')][_0x0544('0x24')]=function(_0x3e39ef){try{if(this[_0x0544('0x5d')](_0x3e39ef)){if(this[_0x0544('0xe')][_0x3e39ef['uniqueid']]){for(var _0xb3b82e=0x0,_0x7c4c56={};_0xb3b82e=0x0?moment(_0x5d8079[_0x858f('0x18')])['diff'](_0x5d8079[_0x858f('0x19')],_0x858f('0xe')):null,'data1':'outbound','data2':_0x5d8079['accountcode'],'data3':_0x5d8079[_0x858f('0x11')],'data4':_0x5d8079[_0x858f('0x1a')]||null,'role':_0x858f('0x12'),'internal':_0x5d8079[_0x858f('0x13')]?_[_0x858f('0x1b')](_0x5d8079[_0x858f('0x13')]):undefined,'uniqueid':_0x5d8079['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0xc6bc=['lodash','util','../client','voiceQueueReport','queuecallerexitAt','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','agent','accountcode','uniqueid','voiceDialReport','Request','membername','starttime','endtime','dialstring','toNumber'];(function(_0x52f9e0,_0x19bef6){var _0x284efb=function(_0x173aef){while(--_0x173aef){_0x52f9e0['push'](_0x52f9e0['shift']());}};_0x284efb(++_0x19bef6);}(_0xc6bc,0x1c2));var _0xcc6b=function(_0x44baf6,_0x1ec6f9){_0x44baf6=_0x44baf6-0x0;var _0x3b5c15=_0xc6bc[_0x44baf6];return _0x3b5c15;};'use strict';var moment=require('moment');var _=require(_0xcc6b('0x0'));var util=require(_0xcc6b('0x1'));var client=require(_0xcc6b('0x2'));exports[_0xcc6b('0x3')]=function(_0x3401d0){var _0x20544c=_0x3401d0['queuecallercompleteAt']||_0x3401d0[_0xcc6b('0x4')];return client['Request'](_0xcc6b('0x5'),{'body':{'channel':_0xcc6b('0x6'),'membername':_0x3401d0[_0xcc6b('0x7')],'interface':_[_0xcc6b('0x8')](_0x3401d0[_0xcc6b('0x9')])?util[_0xcc6b('0xa')](_0xcc6b('0xb'),_0x3401d0['lastAssignedTo']):_0x3401d0['interface'],'type':_0xcc6b('0xc'),'enterAt':_0x3401d0[_0xcc6b('0xd')],'exitAt':_0x20544c,'duration':moment(_0x20544c)[_0xcc6b('0xe')](_0x3401d0[_0xcc6b('0xd')],_0xcc6b('0xf')),'data1':_0xcc6b('0x10'),'data2':_0x3401d0[_0xcc6b('0x11')],'data3':_0x3401d0[_0xcc6b('0x12')],'data4':null,'data5':_0x3401d0[_0xcc6b('0x13')],'role':_0xcc6b('0x14'),'internal':_0x3401d0[_0xcc6b('0x15')]?_['toNumber'](_0x3401d0[_0xcc6b('0x15')]):undefined,'uniqueid':_0x3401d0[_0xcc6b('0x16')]},'log':_0xcc6b('0x5')});};exports[_0xcc6b('0x17')]=function(_0x4f4874){return client[_0xcc6b('0x18')]('CreateMemberReport',{'body':{'channel':_0xcc6b('0x6'),'membername':_0x4f4874[_0xcc6b('0x19')],'interface':_0x4f4874[_0xcc6b('0x9')],'type':_0xcc6b('0xc'),'enterAt':_0x4f4874[_0xcc6b('0x1a')],'exitAt':_0x4f4874[_0xcc6b('0x1b')],'duration':moment(_0x4f4874[_0xcc6b('0x1b')])[_0xcc6b('0xe')](_0x4f4874[_0xcc6b('0x1a')],_0xcc6b('0xf'))>=0x0?moment(_0x4f4874['endtime'])['diff'](_0x4f4874['starttime'],_0xcc6b('0xf')):null,'data1':'outbound','data2':_0x4f4874[_0xcc6b('0x15')],'data3':_0x4f4874[_0xcc6b('0x12')],'data4':_0x4f4874[_0xcc6b('0x1c')]||null,'role':_0xcc6b('0x14'),'internal':_0x4f4874[_0xcc6b('0x15')]?_[_0xcc6b('0x1d')](_0x4f4874[_0xcc6b('0x15')]):undefined,'uniqueid':_0x4f4874[_0xcc6b('0x16')]},'log':_0xcc6b('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index d31675c..3bd4480 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 _0x9861=['Request','GetTemplate','name','html','../client'];(function(_0x5af490,_0x4a31d6){var _0xbfa6cf=function(_0x5ed3a3){while(--_0x5ed3a3){_0x5af490['push'](_0x5af490['shift']());}};_0xbfa6cf(++_0x4a31d6);}(_0x9861,0x176));var _0x1986=function(_0x39203d,_0x8af254){_0x39203d=_0x39203d-0x0;var _0x2accbf=_0x9861[_0x39203d];return _0x2accbf;};'use strict';var client=require(_0x1986('0x0'));exports['getTemplates']=function(_0x5071b2){return function(_0x3989f2){return client[_0x1986('0x1')](_0x1986('0x2'),{'options':{'raw':!![],'attributes':['id',_0x1986('0x3'),_0x1986('0x4')]},'log':_0x1986('0x2')});};}; \ No newline at end of file +var _0xbdb7=['name','html','../client','getTemplates','Request','GetTemplate'];(function(_0x3b6219,_0x4586a1){var _0x69707c=function(_0x4af7bd){while(--_0x4af7bd){_0x3b6219['push'](_0x3b6219['shift']());}};_0x69707c(++_0x4586a1);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x257280,_0x2921df){_0x257280=_0x257280-0x0;var _0xc4550e=_0xbdb7[_0x257280];return _0xc4550e;};'use strict';var client=require(_0x7bdb('0x0'));exports[_0x7bdb('0x1')]=function(_0x44467d){return function(_0x2a2c1c){return client[_0x7bdb('0x2')](_0x7bdb('0x3'),{'options':{'raw':!![],'attributes':['id',_0x7bdb('0x4'),_0x7bdb('0x5')]},'log':_0x7bdb('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index be1b5b8..95c6eb2 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 _0x752c=['getTriggers','Request','GetTrigger','name','status','Condition','AllConditions','field','operator','value','Action','Actions','action','data1','data2','data3','data4','data5','data6','data7','../client'];(function(_0x34b360,_0x4906ea){var _0x356583=function(_0x9c7144){while(--_0x9c7144){_0x34b360['push'](_0x34b360['shift']());}};_0x356583(++_0x4906ea);}(_0x752c,0x18e));var _0xc752=function(_0x3feac7,_0x30064f){_0x3feac7=_0x3feac7-0x0;var _0x5304bd=_0x752c[_0x3feac7];return _0x5304bd;};'use strict';var client=require(_0xc752('0x0'));exports[_0xc752('0x1')]=function(_0x7724c8){return function(_0x549271){return client[_0xc752('0x2')](_0xc752('0x3'),{'options':{'raw':![],'attributes':['id',_0xc752('0x4'),'channel',_0xc752('0x5')],'include':[{'model':_0xc752('0x6'),'as':_0xc752('0x7'),'attributes':['id',_0xc752('0x8'),_0xc752('0x9'),_0xc752('0xa')]},{'model':'Condition','as':'AnyConditions','attributes':['id',_0xc752('0x8'),'operator',_0xc752('0xa')]},{'model':_0xc752('0xb'),'as':_0xc752('0xc'),'attributes':['id',_0xc752('0xd'),_0xc752('0xe'),_0xc752('0xf'),_0xc752('0x10'),_0xc752('0x11'),_0xc752('0x12'),_0xc752('0x13'),_0xc752('0x14')]}]},'log':_0xc752('0x3')});};}; \ No newline at end of file +var _0x2797=['action','data3','data4','data5','data6','../client','getTriggers','Request','GetTrigger','channel','status','Condition','field','operator','AnyConditions','Action'];(function(_0x3153ce,_0x26d5f2){var _0x373b87=function(_0xcd1592){while(--_0xcd1592){_0x3153ce['push'](_0x3153ce['shift']());}};_0x373b87(++_0x26d5f2);}(_0x2797,0x1d5));var _0x7279=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x2797[_0x297fd3];return _0x2af381;};'use strict';var client=require(_0x7279('0x0'));exports[_0x7279('0x1')]=function(_0x41273d){return function(_0x588674){return client[_0x7279('0x2')](_0x7279('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x7279('0x4'),_0x7279('0x5')],'include':[{'model':_0x7279('0x6'),'as':'AllConditions','attributes':['id',_0x7279('0x7'),_0x7279('0x8'),'value']},{'model':_0x7279('0x6'),'as':_0x7279('0x9'),'attributes':['id',_0x7279('0x7'),'operator','value']},{'model':_0x7279('0xa'),'as':'Actions','attributes':['id',_0x7279('0xb'),'data1','data2',_0x7279('0xc'),_0x7279('0xd'),_0x7279('0xe'),_0x7279('0xf'),'data7']}]},'log':_0x7279('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 5435e22..c097fce 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 _0x3587=['name','../client','getTrunks','Request','GetTrunk'];(function(_0xa990b7,_0x26c527){var _0x52c99c=function(_0xf94328){while(--_0xf94328){_0xa990b7['push'](_0xa990b7['shift']());}};_0x52c99c(++_0x26c527);}(_0x3587,0x1b9));var _0x7358=function(_0x56ee1a,_0x35ee62){_0x56ee1a=_0x56ee1a-0x0;var _0x308355=_0x3587[_0x56ee1a];return _0x308355;};'use strict';var client=require(_0x7358('0x0'));exports[_0x7358('0x1')]=function(_0x5052dd){return function(_0x374a3c){return client[_0x7358('0x2')](_0x7358('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x7358('0x4'),'registry']},'log':_0x7358('0x3')});};}; \ No newline at end of file +var _0x7f3c=['name','registry','getTrunks','Request','GetTrunk'];(function(_0x5d547f,_0x50a029){var _0x66efe3=function(_0x53d84f){while(--_0x53d84f){_0x5d547f['push'](_0x5d547f['shift']());}};_0x66efe3(++_0x50a029);}(_0x7f3c,0x6b));var _0xc7f3=function(_0x57e00e,_0x36e79a){_0x57e00e=_0x57e00e-0x0;var _0x415e60=_0x7f3c[_0x57e00e];return _0x415e60;};'use strict';var client=require('../client');exports[_0xc7f3('0x0')]=function(_0x2b4932){return function(_0xa36d08){return client[_0xc7f3('0x1')](_0xc7f3('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xc7f3('0x3'),_0xc7f3('0x4')]},'log':_0xc7f3('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index ddce2df..9152fc4 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 _0x0fb1=['mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','fullname','lastLoginAt','getAgent','../client','getAgents','Request','GetUser','agent','name','email','accountcode','online','pauseType','lastPauseAt','voicePause','phone'];(function(_0x53208e,_0x4a1eb8){var _0xa97d9b=function(_0xefd3c1){while(--_0xefd3c1){_0x53208e['push'](_0x53208e['shift']());}};_0xa97d9b(++_0x4a1eb8);}(_0x0fb1,0x111));var _0x10fb=function(_0x19363c,_0x1597b1){_0x19363c=_0x19363c-0x0;var _0x334663=_0x0fb1[_0x19363c];return _0x334663;};'use strict';var client=require(_0x10fb('0x0'));exports[_0x10fb('0x1')]=function(){return function(){return client[_0x10fb('0x2')](_0x10fb('0x3'),{'options':{'raw':![],'where':{'role':_0x10fb('0x4')},'attributes':['id',_0x10fb('0x5'),_0x10fb('0x6'),_0x10fb('0x7'),'fullname',_0x10fb('0x8'),'lastLoginAt',_0x10fb('0x9'),_0x10fb('0xa'),_0x10fb('0xb'),_0x10fb('0xc'),_0x10fb('0xd'),_0x10fb('0xe')]},'log':_0x10fb('0x1')});};};exports[_0x10fb('0xf')]=function(){return function(){return client['Request'](_0x10fb('0x3'),{'options':{'raw':!![],'where':{'role':_0x10fb('0x10')},'attributes':['id','name',_0x10fb('0x7'),_0x10fb('0x11')]},'log':_0x10fb('0xf')});};};exports[_0x10fb('0x12')]=function(_0x41e421,_0x2cccf1,_0x331bfb){return client[_0x10fb('0x2')](_0x10fb('0x13'),{'body':{'type':_0x2cccf1,'uniqueid':_0x331bfb},'options':{'where':{'id':_0x41e421['id']}},'log':_0x10fb('0x12')});};exports[_0x10fb('0x14')]=function(_0x5a9ffa){return client[_0x10fb('0x2')](_0x10fb('0x15'),{'body':{},'options':{'where':{'id':_0x5a9ffa['id']}},'log':_0x10fb('0x12')});};exports['getAgent']=function(_0x5e2030){return client[_0x10fb('0x2')](_0x10fb('0x16'),{'options':{'raw':![],'where':{'role':_0x10fb('0x4'),'id':_0x5e2030},'attributes':['id',_0x10fb('0x5'),'email','accountcode',_0x10fb('0x17'),'online',_0x10fb('0x18'),_0x10fb('0x9'),_0x10fb('0xa'),_0x10fb('0xb'),_0x10fb('0xe')]},'log':_0x10fb('0x19')});}; \ No newline at end of file +var _0x36ec=['UnpauseUser','savePause','getAgent','ShowUser','../client','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','telephone','getTelephones','PauseUser','saveUnpause'];(function(_0x1536a8,_0x59e8aa){var _0x25b0f7=function(_0x22ef08){while(--_0x22ef08){_0x1536a8['push'](_0x1536a8['shift']());}};_0x25b0f7(++_0x59e8aa);}(_0x36ec,0xfe));var _0xc36e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36ec[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xc36e('0x0'));exports[_0xc36e('0x1')]=function(){return function(){return client[_0xc36e('0x2')](_0xc36e('0x3'),{'options':{'raw':![],'where':{'role':_0xc36e('0x4')},'attributes':['id',_0xc36e('0x5'),_0xc36e('0x6'),_0xc36e('0x7'),_0xc36e('0x8'),_0xc36e('0x9'),_0xc36e('0xa'),_0xc36e('0xb'),_0xc36e('0xc'),_0xc36e('0xd'),_0xc36e('0xe'),_0xc36e('0xf'),_0xc36e('0x10')]},'log':_0xc36e('0x1')});};};exports['getTelephones']=function(){return function(){return client['Request'](_0xc36e('0x3'),{'options':{'raw':!![],'where':{'role':_0xc36e('0x11')},'attributes':['id',_0xc36e('0x5'),_0xc36e('0x7'),'internal']},'log':_0xc36e('0x12')});};};exports['savePause']=function(_0x414556,_0x52c112,_0x13b089){return client[_0xc36e('0x2')](_0xc36e('0x13'),{'body':{'type':_0x52c112,'uniqueid':_0x13b089},'options':{'where':{'id':_0x414556['id']}},'log':'savePause'});};exports[_0xc36e('0x14')]=function(_0x5c7529){return client[_0xc36e('0x2')](_0xc36e('0x15'),{'body':{},'options':{'where':{'id':_0x5c7529['id']}},'log':_0xc36e('0x16')});};exports[_0xc36e('0x17')]=function(_0x4ce73b){return client['Request'](_0xc36e('0x18'),{'options':{'raw':![],'where':{'role':_0xc36e('0x4'),'id':_0x4ce73b},'attributes':['id',_0xc36e('0x5'),_0xc36e('0x6'),_0xc36e('0x7'),'fullname',_0xc36e('0x9'),'lastLoginAt',_0xc36e('0xb'),_0xc36e('0xc'),_0xc36e('0xd'),_0xc36e('0x10')]},'log':_0xc36e('0x17')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 1a0a305..23f2b20 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 _0x24ab=['UpdateVoiceAgentReport','../client','CreateVoiceAgentReport','update','Request'];(function(_0x57ebed,_0xfac0ac){var _0x3a0874=function(_0x271491){while(--_0x271491){_0x57ebed['push'](_0x57ebed['shift']());}};_0x3a0874(++_0xfac0ac);}(_0x24ab,0x13c));var _0xb24a=function(_0x55b89e,_0x385c49){_0x55b89e=_0x55b89e-0x0;var _0xad64f0=_0x24ab[_0x55b89e];return _0xad64f0;};'use strict';var client=require(_0xb24a('0x0'));exports['create']=function(_0x38a79c){return client['Request'](_0xb24a('0x1'),{'body':_0x38a79c,'log':'CreateVoiceAgentReport'});};exports[_0xb24a('0x2')]=function(_0x39d53b,_0x9479ff,_0x28c773){return client[_0xb24a('0x3')](_0xb24a('0x4'),{'body':_0x39d53b,'options':{'where':{'uniqueid':_0x9479ff,'interface':_0x28c773,'agentcomplete':!![]}},'log':_0xb24a('0x4')});}; \ No newline at end of file +var _0x4c6d=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x5ebf5e,_0x3f9b67){var _0x41ac10=function(_0x1d0cca){while(--_0x1d0cca){_0x5ebf5e['push'](_0x5ebf5e['shift']());}};_0x41ac10(++_0x3f9b67);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x465c4f,_0x18a72e){_0x465c4f=_0x465c4f-0x0;var _0x4d3933=_0x4c6d[_0x465c4f];return _0x4d3933;};'use strict';var client=require(_0xd4c6('0x0'));exports[_0xd4c6('0x1')]=function(_0x300800){return client[_0xd4c6('0x2')](_0xd4c6('0x3'),{'body':_0x300800,'log':'CreateVoiceAgentReport'});};exports[_0xd4c6('0x4')]=function(_0x60355c,_0x306766,_0x4b2d75){return client[_0xd4c6('0x2')](_0xd4c6('0x5'),{'body':_0x60355c,'options':{'where':{'uniqueid':_0x306766,'interface':_0x4b2d75,'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 c400e42..4c84737 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 _0x6e14=['lodash','../client','create','Request','merge','calleridnum','context','callerid','DOCUMENTATION','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','util'];(function(_0x51ef40,_0x48a870){var _0x3ff060=function(_0x25e0a2){while(--_0x25e0a2){_0x51ef40['push'](_0x51ef40['shift']());}};_0x3ff060(++_0x48a870);}(_0x6e14,0xdb));var _0x46e1=function(_0x59d015,_0x3531ce){_0x59d015=_0x59d015-0x0;var _0xa0511=_0x6e14[_0x59d015];return _0xa0511;};'use strict';var moment=require('moment');var util=require(_0x46e1('0x0'));var _=require(_0x46e1('0x1'));var client=require(_0x46e1('0x2'));exports[_0x46e1('0x3')]=function(_0x8bc0c7){return client[_0x46e1('0x4')]('CreateVoiceCallReport',{'body':_[_0x46e1('0x5')](_0x8bc0c7,{'source':_0x8bc0c7[_0x46e1('0x6')],'destinationcontext':_0x8bc0c7[_0x46e1('0x7')],'callerid':_0x8bc0c7[_0x46e1('0x8')],'amaflags':_0x46e1('0x9')}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0x46e1('0xa'),{'options':{'where':{'type':[_0x46e1('0xb')],'createdAt':{'$between':[moment()[_0x46e1('0xc')](_0x46e1('0xd'))[_0x46e1('0xe')](_0x46e1('0xf')),moment()[_0x46e1('0x10')](_0x46e1('0xd'))['format'](_0x46e1('0xf'))]}},'attributes':[_0x46e1('0x11'),_0x46e1('0x12'),_0x46e1('0x13'),_0x46e1('0x14')]},'log':_0x46e1('0x15')});};}; \ No newline at end of file +var _0xb4ad=['context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','startOf','day','format','endOf','type','disposition','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum'];(function(_0x4ae5c4,_0x3eb0f7){var _0x2ff7bc=function(_0x253bdf){while(--_0x253bdf){_0x4ae5c4['push'](_0x4ae5c4['shift']());}};_0x2ff7bc(++_0x3eb0f7);}(_0xb4ad,0x1c5));var _0xdb4a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb4ad[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0xdb4a('0x0'));var util=require(_0xdb4a('0x1'));var _=require(_0xdb4a('0x2'));var client=require(_0xdb4a('0x3'));exports[_0xdb4a('0x4')]=function(_0xef057b){return client[_0xdb4a('0x5')](_0xdb4a('0x6'),{'body':_[_0xdb4a('0x7')](_0xef057b,{'source':_0xef057b[_0xdb4a('0x8')],'destinationcontext':_0xef057b[_0xdb4a('0x9')],'callerid':_0xef057b['callerid'],'amaflags':_0xdb4a('0xa')}),'log':_0xdb4a('0x6')});};exports[_0xdb4a('0xb')]=function(){return function(){return client[_0xdb4a('0x5')](_0xdb4a('0xc'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xdb4a('0xd')](_0xdb4a('0xe'))[_0xdb4a('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xdb4a('0x10')]('day')[_0xdb4a('0xf')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xdb4a('0x11'),_0xdb4a('0x12'),'duration',_0xdb4a('0x13')]},'log':_0xdb4a('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 84784b9..ffb0ea1 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 _0x678c=['Request','CreateVoiceDialReport','../client'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x678c,0xce));var _0xc678=function(_0x877e1e,_0x46f5ba){_0x877e1e=_0x877e1e-0x0;var _0x2457c0=_0x678c[_0x877e1e];return _0x2457c0;};'use strict';var client=require(_0xc678('0x0'));exports['create']=function(_0x1e1dab){return client[_0xc678('0x1')]('CreateVoiceDialReport',{'body':_0x1e1dab,'log':_0xc678('0x2')});}; \ No newline at end of file +var _0xd979=['CreateVoiceDialReport','../client','create','Request'];(function(_0xbaeba7,_0x578dfa){var _0x4b42e7=function(_0x23bd26){while(--_0x23bd26){_0xbaeba7['push'](_0xbaeba7['shift']());}};_0x4b42e7(++_0x578dfa);}(_0xd979,0x79));var _0x9d97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd979[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x9d97('0x0'));exports[_0x9d97('0x1')]=function(_0x41ce60){return client[_0x9d97('0x2')](_0x9d97('0x3'),{'body':_0x41ce60,'log':_0x9d97('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index bba5367..88ee373 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 _0x1516=['recordingFormat','../client','getVoiceExtensions','Request','exten'];(function(_0x49c057,_0xc808ed){var _0xd8f0e6=function(_0x5b9042){while(--_0x5b9042){_0x49c057['push'](_0x49c057['shift']());}};_0xd8f0e6(++_0xc808ed);}(_0x1516,0xb0));var _0x6151=function(_0x11cf3b,_0x4de592){_0x11cf3b=_0x11cf3b-0x0;var _0xfc200b=_0x1516[_0x11cf3b];return _0xfc200b;};'use strict';var client=require(_0x6151('0x0'));exports[_0x6151('0x1')]=function(){return function(){return client[_0x6151('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x6151('0x3'),_0x6151('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x6151('0x1')});};}; \ No newline at end of file +var _0x8dd1=['exten','../client','getVoiceExtensions','Request'];(function(_0xad8f28,_0x45a17f){var _0x388afe=function(_0x52fb31){while(--_0x52fb31){_0xad8f28['push'](_0xad8f28['shift']());}};_0x388afe(++_0x45a17f);}(_0x8dd1,0x1e5));var _0x18dd=function(_0x2ff816,_0x570630){_0x2ff816=_0x2ff816-0x0;var _0x4fe7b0=_0x8dd1[_0x2ff816];return _0x4fe7b0;};'use strict';var client=require(_0x18dd('0x0'));exports[_0x18dd('0x1')]=function(){return function(){return client[_0x18dd('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x18dd('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x18dd('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 5f039f7..9f446be 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 _0x7755=['dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','Pause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','name','autopause','monitor_format','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold'];(function(_0x5c950e,_0x5cfc84){var _0x2d6432=function(_0x445ff9){while(--_0x445ff9){_0x5c950e['push'](_0x5c950e['shift']());}};_0x2d6432(++_0x5cfc84);}(_0x7755,0x1e2));var _0x5775=function(_0x236607,_0x37f8e9){_0x236607=_0x236607-0x0;var _0x1a4b1e=_0x7755[_0x236607];return _0x1a4b1e;};'use strict';var client=require('../client');exports[_0x5775('0x0')]=function(){return function(){return client[_0x5775('0x1')](_0x5775('0x2'),{'options':{'raw':![],'attributes':['id',_0x5775('0x3'),'acw','acwTimeout',_0x5775('0x4'),_0x5775('0x5'),'type','dialActive','dialMethod',_0x5775('0x6'),_0x5775('0x7'),_0x5775('0x8'),_0x5775('0x9'),_0x5775('0xa'),_0x5775('0xb'),_0x5775('0xc'),'dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions',_0x5775('0xd'),'dialQueueProject',_0x5775('0xe'),_0x5775('0xf'),_0x5775('0x10'),_0x5775('0x11'),_0x5775('0x12'),_0x5775('0x13'),_0x5775('0x14'),_0x5775('0x15'),_0x5775('0x16'),_0x5775('0x17'),'dialCheckDuplicateType',_0x5775('0x18'),'dialAMDInitialSilence',_0x5775('0x19'),'dialAMDAfterGreetingSilence',_0x5775('0x1a'),_0x5775('0x1b'),_0x5775('0x1c'),_0x5775('0x1d'),_0x5775('0x1e'),_0x5775('0x1f'),_0x5775('0x20'),_0x5775('0x21'),'dialRecallInQueue',_0x5775('0x22'),_0x5775('0x23'),_0x5775('0x24'),_0x5775('0x25'),_0x5775('0x5'),_0x5775('0x26'),_0x5775('0x27'),_0x5775('0x28'),'dialNoSuchNumberMaxRetry',_0x5775('0x29'),_0x5775('0x2a'),_0x5775('0x2b'),'dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry',_0x5775('0x2c'),_0x5775('0x2d'),_0x5775('0x2e'),_0x5775('0x2f'),_0x5775('0x30'),_0x5775('0x31')],'include':[{'model':_0x5775('0x32'),'as':_0x5775('0x32'),'attributes':['id',_0x5775('0x3'),_0x5775('0x33'),'active']},{'model':_0x5775('0x34'),'as':'mandatoryDispositionPause','attributes':['id',_0x5775('0x3')]},{'model':'Trunk','as':_0x5775('0x35'),'attributes':['id','name',_0x5775('0x33'),'active']},{'model':_0x5775('0x36'),'as':_0x5775('0x36'),'attributes':['id',_0x5775('0x3')],'include':[{'model':_0x5775('0x36'),'as':_0x5775('0x37'),'attributes':['id',_0x5775('0x3'),_0x5775('0x38')]}]}]},'log':_0x5775('0x0')});};}; \ No newline at end of file +var _0x237e=['interval','getVoiceQueues','name','acw','acwTimeout','monitor_format','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialPredictiveIntervalMaxThreshold','Trunk','active','Pause','callerid','Interval'];(function(_0x321c87,_0xa96728){var _0x21cd4b=function(_0x1ec531){while(--_0x1ec531){_0x321c87['push'](_0x321c87['shift']());}};_0x21cd4b(++_0xa96728);}(_0x237e,0x70));var _0xe237=function(_0x2ebb8a,_0x2dc33f){_0x2ebb8a=_0x2ebb8a-0x0;var _0x469a07=_0x237e[_0x2ebb8a];return _0x469a07;};'use strict';var client=require('../client');exports['getVoiceQueues']=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xe237('0x0'),_0xe237('0x1'),_0xe237('0x2'),'autopause',_0xe237('0x3'),'type',_0xe237('0x4'),_0xe237('0x5'),_0xe237('0x6'),'dialLimitQueue',_0xe237('0x7'),_0xe237('0x8'),'dialPredictiveOptimizationPercentage',_0xe237('0x9'),_0xe237('0xa'),'dialOriginateCallerIdNumber',_0xe237('0xb'),'dialQueueOptions',_0xe237('0xc'),_0xe237('0xd'),_0xe237('0xe'),_0xe237('0xf'),_0xe237('0x10'),_0xe237('0x11'),'dialNoAnswerMaxRetry',_0xe237('0x12'),_0xe237('0x13'),_0xe237('0x14'),_0xe237('0x15'),_0xe237('0x16'),'dialCheckDuplicateType',_0xe237('0x17'),_0xe237('0x18'),_0xe237('0x19'),_0xe237('0x1a'),'dialAMDTotalAnalysisTime','dialAMDMinWordLength',_0xe237('0x1b'),_0xe237('0x1c'),_0xe237('0x1d'),_0xe237('0x1e'),_0xe237('0x1f'),_0xe237('0x20'),_0xe237('0x21'),'dialOrderByScheduledAt',_0xe237('0x22'),_0xe237('0x23'),_0xe237('0x24'),_0xe237('0x3'),'strategy',_0xe237('0x25'),_0xe237('0x26'),_0xe237('0x27'),_0xe237('0x28'),_0xe237('0x29'),_0xe237('0x2a'),_0xe237('0x2b'),'dialAbandonedRetryFrequency',_0xe237('0x2c'),_0xe237('0x2d'),_0xe237('0x2e'),'dialAgentRejectRetryFrequency','mandatoryDisposition',_0xe237('0x2f'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':'Trunk','as':_0xe237('0x30'),'attributes':['id','name','callerid',_0xe237('0x31')]},{'model':_0xe237('0x32'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':'Trunk','as':'TrunkBackup','attributes':['id','name',_0xe237('0x33'),_0xe237('0x31')]},{'model':_0xe237('0x34'),'as':'Interval','attributes':['id',_0xe237('0x0')],'include':[{'model':_0xe237('0x34'),'as':'Intervals','attributes':['id',_0xe237('0x0'),_0xe237('0x35')]}]}]},'log':_0xe237('0x36')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index dfaaf05..d8bff97 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 _0xd73b=['queue','queuecallerjoinAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','create','CreateVoiceQueueReport','getVoiceQueueReports','Request','GetVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid'];(function(_0x5eb1c6,_0x1989ef){var _0x584208=function(_0x46261a){while(--_0x46261a){_0x5eb1c6['push'](_0x5eb1c6['shift']());}};_0x584208(++_0x1989ef);}(_0xd73b,0x183));var _0xbd73=function(_0x26042e,_0x4338d7){_0x26042e=_0x26042e-0x0;var _0x16e92f=_0xd73b[_0x26042e];return _0x16e92f;};'use strict';var moment=require(_0xbd73('0x0'));var _=require(_0xbd73('0x1'));var client=require('../client');exports[_0xbd73('0x2')]=function(_0x54e94a){return client['Request'](_0xbd73('0x3'),{'body':_0x54e94a,'log':_0xbd73('0x3')});};exports[_0xbd73('0x4')]=function(){return function(){return client[_0xbd73('0x5')](_0xbd73('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xbd73('0x7')](_0xbd73('0x8'))[_0xbd73('0x9')](_0xbd73('0xa')),moment()[_0xbd73('0xb')](_0xbd73('0x8'))['format'](_0xbd73('0xa'))]}},'attributes':[_0xbd73('0xc'),_0xbd73('0xd'),_0xbd73('0xe'),'queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt',_0xbd73('0xf'),_0xbd73('0x10'),_0xbd73('0x11'),_0xbd73('0x12')]},'log':_0xbd73('0x13')});};}; \ No newline at end of file +var _0x79df=['queuecallerleaveAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','day','format','endOf','uniqueid','queue','queuecallerjoinAt'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x79df,0xee));var _0xf79d=function(_0x212670,_0x30ef88){_0x212670=_0x212670-0x0;var _0x3c917b=_0x79df[_0x212670];return _0x3c917b;};'use strict';var moment=require(_0xf79d('0x0'));var _=require(_0xf79d('0x1'));var client=require('../client');exports[_0xf79d('0x2')]=function(_0x1bc91a){return client[_0xf79d('0x3')]('CreateVoiceQueueReport',{'body':_0x1bc91a,'log':_0xf79d('0x4')});};exports[_0xf79d('0x5')]=function(){return function(){return client[_0xf79d('0x3')](_0xf79d('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xf79d('0x7')](_0xf79d('0x8'))[_0xf79d('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xf79d('0xa')](_0xf79d('0x8'))[_0xf79d('0x9')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xf79d('0xb'),_0xf79d('0xc'),_0xf79d('0xd'),_0xf79d('0xe'),_0xf79d('0xf'),'queuecallercompleteAt',_0xf79d('0x10'),_0xf79d('0x11'),_0xf79d('0x12'),_0xf79d('0x13')]},'log':_0xf79d('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index a5c1be8..529d0fe 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 _0xb39a=['../client','getVoiceQueueRtPauses'];(function(_0x9c5775,_0x5d3504){var _0x5094f7=function(_0x2b3e04){while(--_0x2b3e04){_0x9c5775['push'](_0x9c5775['shift']());}};_0x5094f7(++_0x5d3504);}(_0xb39a,0xb2));var _0xab39=function(_0x4070e5,_0x3cba2c){_0x4070e5=_0x4070e5-0x0;var _0x421852=_0xb39a[_0x4070e5];return _0x421852;};'use strict';var client=require(_0xab39('0x0'));exports[_0xab39('0x1')]=function(_0x543881){return function(){return client['Request']('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x543881,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x50ad=['../client','getVoiceQueueRtPauses','Request'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x50ad,0x195));var _0xd50a=function(_0x28258a,_0x22f398){_0x28258a=_0x28258a-0x0;var _0x4e968e=_0x50ad[_0x28258a];return _0x4e968e;};'use strict';var client=require(_0xd50a('0x0'));exports[_0xd50a('0x1')]=function(_0x5d6dfc){return function(){return client[_0xd50a('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x5d6dfc,'paused':!![]},'raw':!![]},'log':_0xd50a('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 53513b4..ba86102 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 _0x9776=['merge','../client','create','Request','CreateVoiceRecording'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9776,0x97));var _0x6977=function(_0x564421,_0x1a9a56){_0x564421=_0x564421-0x0;var _0x434711=_0x9776[_0x564421];return _0x434711;};'use strict';var _=require('lodash');var client=require(_0x6977('0x0'));exports[_0x6977('0x1')]=function(_0x371d52){return client[_0x6977('0x2')](_0x6977('0x3'),{'body':_[_0x6977('0x4')](_0x371d52,{'value':_0x371d52['monitorFilename']}),'log':_0x6977('0x3')});}; \ No newline at end of file +var _0xd302=['merge','monitorFilename','../client','create','Request','CreateVoiceRecording'];(function(_0x466341,_0x3964d3){var _0x21c7ec=function(_0x177bb7){while(--_0x177bb7){_0x466341['push'](_0x466341['shift']());}};_0x21c7ec(++_0x3964d3);}(_0xd302,0x176));var _0x2d30=function(_0x19903a,_0x460db0){_0x19903a=_0x19903a-0x0;var _0x5491de=_0xd302[_0x19903a];return _0x5491de;};'use strict';var _=require('lodash');var client=require(_0x2d30('0x0'));exports[_0x2d30('0x1')]=function(_0xced0d2){return client[_0x2d30('0x2')](_0x2d30('0x3'),{'body':_[_0x2d30('0x4')](_0xced0d2,{'value':_0xced0d2[_0x2d30('0x5')]}),'log':_0x2d30('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index d7e6f4c..d580f8b 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 _0x8455=['transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','isexternal','origtransferercontext','attended','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','context','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel'];(function(_0x39c92e,_0x717993){var _0x21763d=function(_0x5421d1){while(--_0x5421d1){_0x39c92e['push'](_0x39c92e['shift']());}};_0x21763d(++_0x717993);}(_0x8455,0x1c3));var _0x5845=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8455[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x5845('0x0')]=function(_0x2aaec0){return client[_0x5845('0x1')](_0x5845('0x2'),{'body':{'result':_0x2aaec0[_0x5845('0x3')],'transfererchannel':_0x2aaec0[_0x5845('0x4')],'transferercalleridnum':_0x2aaec0[_0x5845('0x5')],'transferercalleridname':_0x2aaec0['transferercalleridname'],'transfererconnectedlinenum':_0x2aaec0[_0x5845('0x6')],'transfererconnectedlinename':_0x2aaec0[_0x5845('0x7')],'transfereraccountcode':_0x2aaec0[_0x5845('0x8')],'transferercontext':_0x2aaec0[_0x5845('0x9')],'transfererexten':_0x2aaec0[_0x5845('0xa')],'transfererlinkedid':_0x2aaec0[_0x5845('0xb')],'transfereechannel':_0x2aaec0[_0x5845('0xc')],'transfereecalleridnum':_0x2aaec0[_0x5845('0xd')],'transfereecalleridname':_0x2aaec0[_0x5845('0xe')],'transfereeconnectedlinenum':_0x2aaec0[_0x5845('0xf')],'transfereeconnectedlinename':_0x2aaec0[_0x5845('0x10')],'transfereeaccountcode':_0x2aaec0['transfereeaccountcode'],'transfereecontext':_0x2aaec0[_0x5845('0x11')],'transfereeexten':_0x2aaec0[_0x5845('0x12')],'transfereelinkedid':_0x2aaec0[_0x5845('0x13')],'isexternal':_0x2aaec0['isexternal'],'context':_0x2aaec0[_0x5845('0x14')],'extension':_0x2aaec0['extension'],'type':'blind'},'log':_0x5845('0x2')});};exports[_0x5845('0x15')]=function(_0x59d746){return client[_0x5845('0x1')](_0x5845('0x2'),{'body':{'result':_0x59d746[_0x5845('0x3')],'transfererchannel':_0x59d746[_0x5845('0x16')],'transferercalleridnum':_0x59d746[_0x5845('0x17')],'transferercalleridname':_0x59d746['origtransferercalleridname'],'transfererconnectedlinenum':_0x59d746[_0x5845('0x18')],'transfererconnectedlinename':_0x59d746[_0x5845('0x19')],'transfereraccountcode':_0x59d746[_0x5845('0x1a')],'transferercontext':_0x59d746[_0x5845('0x1b')],'transfererexten':_0x59d746[_0x5845('0x1c')],'transfererlinkedid':_0x59d746['origtransfererlinkedid'],'transfereechannel':_0x59d746[_0x5845('0x1d')],'transfereecalleridnum':_0x59d746[_0x5845('0x1e')],'transfereecalleridname':_0x59d746[_0x5845('0x1f')],'transfereeconnectedlinenum':_0x59d746['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x59d746[_0x5845('0x20')],'transfereeaccountcode':_0x59d746[_0x5845('0x21')],'transfereecontext':_0x59d746['transfertargetcontext'],'transfereeexten':_0x59d746['transfertargetexten'],'transfereelinkedid':_0x59d746['transfertargetlinkedid'],'isexternal':_0x59d746[_0x5845('0x22')],'context':_0x59d746[_0x5845('0x23')],'extension':_0x59d746['origtransfererexten'],'type':_0x5845('0x24')},'log':_0x5845('0x2')});}; \ No newline at end of file +var _0xe94e=['origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','origtransferercontext','../client','blindTransfer','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','blind','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename'];(function(_0x5ce7e0,_0x1ee5f0){var _0x29eec6=function(_0x321fe4){while(--_0x321fe4){_0x5ce7e0['push'](_0x5ce7e0['shift']());}};_0x29eec6(++_0x1ee5f0);}(_0xe94e,0x1eb));var _0xee94=function(_0x31728b,_0x5c77a8){_0x31728b=_0x31728b-0x0;var _0x33192b=_0xe94e[_0x31728b];return _0x33192b;};'use strict';var client=require(_0xee94('0x0'));exports[_0xee94('0x1')]=function(_0x2621cc){return client[_0xee94('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x2621cc[_0xee94('0x3')],'transfererchannel':_0x2621cc[_0xee94('0x4')],'transferercalleridnum':_0x2621cc[_0xee94('0x5')],'transferercalleridname':_0x2621cc[_0xee94('0x6')],'transfererconnectedlinenum':_0x2621cc[_0xee94('0x7')],'transfererconnectedlinename':_0x2621cc[_0xee94('0x8')],'transfereraccountcode':_0x2621cc['transfereraccountcode'],'transferercontext':_0x2621cc[_0xee94('0x9')],'transfererexten':_0x2621cc[_0xee94('0xa')],'transfererlinkedid':_0x2621cc['transfererlinkedid'],'transfereechannel':_0x2621cc[_0xee94('0xb')],'transfereecalleridnum':_0x2621cc[_0xee94('0xc')],'transfereecalleridname':_0x2621cc[_0xee94('0xd')],'transfereeconnectedlinenum':_0x2621cc[_0xee94('0xe')],'transfereeconnectedlinename':_0x2621cc[_0xee94('0xf')],'transfereeaccountcode':_0x2621cc[_0xee94('0x10')],'transfereecontext':_0x2621cc[_0xee94('0x11')],'transfereeexten':_0x2621cc[_0xee94('0x12')],'transfereelinkedid':_0x2621cc['transfereelinkedid'],'isexternal':_0x2621cc[_0xee94('0x13')],'context':_0x2621cc[_0xee94('0x14')],'extension':_0x2621cc[_0xee94('0x15')],'type':_0xee94('0x16')},'log':_0xee94('0x17')});};exports['attendedTransfer']=function(_0x2d01d0){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x2d01d0[_0xee94('0x3')],'transfererchannel':_0x2d01d0[_0xee94('0x18')],'transferercalleridnum':_0x2d01d0[_0xee94('0x19')],'transferercalleridname':_0x2d01d0[_0xee94('0x1a')],'transfererconnectedlinenum':_0x2d01d0[_0xee94('0x1b')],'transfererconnectedlinename':_0x2d01d0[_0xee94('0x1c')],'transfereraccountcode':_0x2d01d0[_0xee94('0x1d')],'transferercontext':_0x2d01d0[_0xee94('0x1e')],'transfererexten':_0x2d01d0[_0xee94('0x1f')],'transfererlinkedid':_0x2d01d0['origtransfererlinkedid'],'transfereechannel':_0x2d01d0[_0xee94('0x20')],'transfereecalleridnum':_0x2d01d0[_0xee94('0x21')],'transfereecalleridname':_0x2d01d0[_0xee94('0x22')],'transfereeconnectedlinenum':_0x2d01d0[_0xee94('0x23')],'transfereeconnectedlinename':_0x2d01d0[_0xee94('0x24')],'transfereeaccountcode':_0x2d01d0['transfertargetaccountcode'],'transfereecontext':_0x2d01d0['transfertargetcontext'],'transfereeexten':_0x2d01d0[_0xee94('0x25')],'transfereelinkedid':_0x2d01d0[_0xee94('0x26')],'isexternal':_0x2d01d0[_0xee94('0x13')],'context':_0x2d01d0[_0xee94('0x27')],'extension':_0x2d01d0['origtransfererexten'],'type':'attended'},'log':_0xee94('0x17')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index eafd70b..1cc6029 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 _0x1ae3=['message','catch','ami\x20disconnected','pick','command','Command','content','voiceQueues','hasOwnProperty','name','answered','available','sumBillable','sumDuration','talking','type','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','push','length','isConnected','voicechannel','map','find','channels','channel','%s.%s','filename','uniqueid','wav','MixMonitor','monitors','isNil','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','status','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','values','telephones','trunks','outboundChannels','outbound','run','event','Event\x20name\x20mandatory','emit','custom:','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','jayson/promise','validate','bluebird','moment','../../../config/environment','../ami','listen','format','%s/%s','SIP','timers','timer','updateAcw','agents','QueuePause','error','asterisk','username','join','keys','module','Action','then'];(function(_0x192add,_0x4490e4){var _0x1b9d9d=function(_0x55084d){while(--_0x55084d){_0x192add['push'](_0x192add['shift']());}};_0x1b9d9d(++_0x4490e4);}(_0x1ae3,0x16c));var _0x31ae=function(_0x216816,_0x56e87a){_0x216816=_0x216816-0x0;var _0x4e1886=_0x1ae3[_0x216816];return _0x4e1886;};'use strict';var _=require('lodash');var util=require('util');var jayson=require(_0x31ae('0x0'));var schema=require(_0x31ae('0x1'));var BPromise=require(_0x31ae('0x2'));var moment=require(_0x31ae('0x3'));var config=require(_0x31ae('0x4'));var properties=require('../properties');var ami=require(_0x31ae('0x5'));exports[_0x31ae('0x6')]=function(_0x19a976,_0x3b9502,_0x4e5b87){return new BPromise(function(_0x5cc4bb,_0x18eb56){var _0xdd8645={'QueuePause':function(_0x2629e2){return new Promise(function(_0x152dc2,_0x169183){var _0x3ecfa0=util[_0x31ae('0x7')](_0x31ae('0x8'),_0x31ae('0x9'),_0x2629e2['name']);if(_0x19a976[_0x31ae('0xa')]&&_0x19a976[_0x31ae('0xa')][_0x3ecfa0]&&_0x19a976['timers'][_0x3ecfa0][_0x31ae('0xb')]){_0x19a976['timers'][_0x3ecfa0][_0x31ae('0xc')]();}if(_0x19a976[_0x31ae('0xd')][_0x3ecfa0]){_0x19a976[_0x31ae('0xd')][_0x3ecfa0]['updateStatusRealtime']({'statePause':_0x2629e2['pause']?!![]:![]});}_0x152dc2({'code':0xc8,'message':_0x31ae('0xe')});});},'Reload':function(_0x26ab55){var _0x4eb406=this;return new Promise(function(_0x394cee,_0x342c52){if(ami['isConnected']()==![]){return _0x342c52(_0x4eb406[_0x31ae('0xf')](0x1f4,[config[_0x31ae('0x10')]['ip'],config[_0x31ae('0x10')][_0x31ae('0x11')],'ami\x20disconnected'][_0x31ae('0x12')]('\x20')));}_0x26ab55=_['pick'](_0x26ab55,_[_0x31ae('0x13')](properties[_0x31ae('0x14')]));_0x26ab55['action']='Reload';return ami[_0x31ae('0x15')](_0x26ab55)[_0x31ae('0x16')](function(_0x4ba174){_0x394cee({'code':0xc8,'message':_0x4ba174[_0x31ae('0x17')]});})[_0x31ae('0x18')](function(_0x22d6b2){_0x342c52(_0x4eb406[_0x31ae('0xf')](0x1f5,_0x22d6b2[_0x31ae('0x17')]));});});},'Command':function(_0x4cc653){var _0x415848=this;return new Promise(function(_0x1eb0cf,_0x468442){if(ami['isConnected']()==![]){return _0x468442(_0x415848[_0x31ae('0xf')](0x1f4,[config[_0x31ae('0x10')]['ip'],config[_0x31ae('0x10')]['username'],_0x31ae('0x19')][_0x31ae('0x12')]('\x20')));}_0x4cc653=_[_0x31ae('0x1a')](_0x4cc653,_0x31ae('0x1b'));_0x4cc653['action']=_0x31ae('0x1c');return ami[_0x31ae('0x15')](_0x4cc653)['then'](function(_0x1f67e1){_0x1eb0cf({'code':0xc8,'message':_0x1f67e1[_0x31ae('0x1d')]});})[_0x31ae('0x18')](function(_0x1ca236){_0x468442(_0x415848[_0x31ae('0xf')](0x1f5,_0x1ca236[_0x31ae('0x17')]));});});},'VoiceQueues':function(_0x267069){return new Promise(function(_0x5f0266,_0x17c663){var _0x3160aa=[];for(var _0x22516c in _0x19a976[_0x31ae('0x1e')]){if(_0x19a976[_0x31ae('0x1e')][_0x31ae('0x1f')](_0x22516c)){var _0x520d21=_0x19a976[_0x31ae('0x1e')][_0x22516c];var _0x3bbe9e={'id':_0x520d21['id'],'name':_0x520d21[_0x31ae('0x20')],'strategy':_0x520d21['strategy'],'answered':_0x520d21[_0x31ae('0x21')],'available':_0x520d21[_0x31ae('0x22')],'loggedIn':_0x520d21['loggedIn'],'pTalking':_0x520d21['pTalking'],'sumBillable':_0x520d21[_0x31ae('0x23')],'sumDuration':_0x520d21[_0x31ae('0x24')],'sumHoldTime':_0x520d21['sumHoldTime']||0x0,'talking':_0x520d21[_0x31ae('0x25')],'total':_0x520d21['total'],'type':_0x520d21[_0x31ae('0x26')],'unmanaged':_0x520d21['unmanaged'],'abandoned':_0x520d21[_0x31ae('0x27')],'waiting':_0x520d21[_0x31ae('0x28')],'loggedInDb':_0x520d21[_0x31ae('0x29')]};if(_0x520d21['type']==='outbound'){_0x3bbe9e[_0x31ae('0x2a')]=_0x520d21[_0x31ae('0x2a')];_0x3bbe9e[_0x31ae('0x2b')]=_0x520d21[_0x31ae('0x2b')];_0x3bbe9e[_0x31ae('0x2c')]=_0x520d21[_0x31ae('0x2c')];_0x3bbe9e['dialOriginateCallerIdNumber']=_0x520d21['dialOriginateCallerIdNumber'];_0x3bbe9e[_0x31ae('0x2d')]=_0x520d21['dialOriginateTimeout'];_0x3bbe9e[_0x31ae('0x2e')]=_0x520d21[_0x31ae('0x2e')];_0x3bbe9e[_0x31ae('0x2f')]=_0x520d21[_0x31ae('0x2f')];_0x3bbe9e[_0x31ae('0x30')]=_0x520d21['outboundAnswerCallsDay'];_0x3bbe9e[_0x31ae('0x31')]=_0x520d21['outboundBlacklistCallsDay'];_0x3bbe9e[_0x31ae('0x32')]=_0x520d21[_0x31ae('0x32')];_0x3bbe9e['outboundCongestionCallsDay']=_0x520d21['outboundCongestionCallsDay'];_0x3bbe9e[_0x31ae('0x33')]=_0x520d21[_0x31ae('0x33')];_0x3bbe9e[_0x31ae('0x34')]=_0x520d21[_0x31ae('0x34')];_0x3bbe9e[_0x31ae('0x35')]=_0x520d21['outboundDropCallsDayTimeout'];_0x3bbe9e['outboundNoAnswerCallsDay']=_0x520d21[_0x31ae('0x36')];_0x3bbe9e['outboundNoSuchCallsDay']=_0x520d21['outboundNoSuchCallsDay'];_0x3bbe9e[_0x31ae('0x37')]=_0x520d21[_0x31ae('0x37')];_0x3bbe9e[_0x31ae('0x38')]=_0x520d21['outboundReCallsDay'];_0x3bbe9e[_0x31ae('0x39')]=_0x520d21[_0x31ae('0x39')];_0x3bbe9e[_0x31ae('0x3a')]=_0x520d21['outboundUnknownCallsDay'];_0x3bbe9e[_0x31ae('0x3b')]=_0x520d21['predictiveIntervalAnsweredCalls'];_0x3bbe9e[_0x31ae('0x3c')]=_0x520d21['predictiveIntervalAvgHoldtime'];_0x3bbe9e['predictiveIntervalAvgTalktime']=_0x520d21[_0x31ae('0x3d')];_0x3bbe9e[_0x31ae('0x3e')]=_0x520d21[_0x31ae('0x3e')];_0x3bbe9e[_0x31ae('0x3f')]=_0x520d21[_0x31ae('0x3f')];_0x3bbe9e['predictiveIntervalErlangCalls']=_0x520d21['predictiveIntervalErlangCalls'];_0x3bbe9e['predictiveIntervalErlangCallsDroppedCalls']=_0x520d21['predictiveIntervalErlangCallsDroppedCalls'];_0x3bbe9e[_0x31ae('0x40')]=_0x520d21[_0x31ae('0x40')];_0x3bbe9e[_0x31ae('0x41')]=_0x520d21[_0x31ae('0x41')];_0x3bbe9e[_0x31ae('0x42')]=_0x520d21[_0x31ae('0x42')];_0x3bbe9e[_0x31ae('0x43')]=_0x520d21[_0x31ae('0x43')];_0x3bbe9e[_0x31ae('0x44')]=_0x520d21['predictiveIntervalTotalCalls'];_0x3bbe9e['message']=_0x520d21['message'];_0x3bbe9e[_0x31ae('0x45')]=_0x520d21['originated'];_0x3bbe9e[_0x31ae('0x46')]=_0x520d21[_0x31ae('0x46')];_0x3bbe9e[_0x31ae('0x47')]=_0x520d21[_0x31ae('0x47')];_0x3bbe9e[_0x31ae('0x48')]=_0x520d21[_0x31ae('0x48')];_0x3bbe9e[_0x31ae('0x49')]=_0x520d21[_0x31ae('0x49')];_0x3bbe9e[_0x31ae('0x4a')]=_0x520d21[_0x31ae('0x4a')];_0x3bbe9e['startProgressive']=_0x520d21['startProgressive'];}if(_0x520d21['Trunk']){_0x3bbe9e['Trunk']={'id':_0x520d21[_0x31ae('0x4b')]['id'],'name':_0x520d21['Trunk'][_0x31ae('0x20')],'active':_0x520d21[_0x31ae('0x4b')][_0x31ae('0x4c')],'callerid':_0x520d21[_0x31ae('0x4b')][_0x31ae('0x4d')]};}if(_0x520d21[_0x31ae('0x4e')]){_0x3bbe9e[_0x31ae('0x4e')]={'id':_0x520d21[_0x31ae('0x4e')]['id'],'name':_0x520d21[_0x31ae('0x4e')][_0x31ae('0x20')]};}_0x3160aa[_0x31ae('0x4f')](_0x3bbe9e);}}_0x5f0266({'count':_0x3160aa[_0x31ae('0x50')],'rows':_0x3160aa});});},'VoiceChannels':function(_0x569abe){return new Promise(function(_0x189f85,_0x48361f){var _0xfdf2b5=_['values'](_0x19a976['channels']);_0x189f85({'count':_0xfdf2b5['length'],'rows':_0xfdf2b5});});},'VoiceChannelMixMonitor':function(_0x6d02ee){var _0x26df37=this;return new Promise(function(_0x3d0848,_0x4ad031){if(ami[_0x31ae('0x51')]()==![]){return _0x4ad031(_0x26df37[_0x31ae('0xf')](0x1f4,[config[_0x31ae('0x10')]['ip'],config[_0x31ae('0x10')][_0x31ae('0x11')],'ami\x20disconnected'][_0x31ae('0x12')]('\x20')));}var _0x5a406d=schema(properties[_0x31ae('0x52')])[_0x31ae('0x1')](_0x6d02ee);if(_0x5a406d[_0x31ae('0x50')]>0x0){return _0x4ad031(_0x26df37[_0x31ae('0xf')](0x1f4,_[_0x31ae('0x53')](_0x5a406d,_0x31ae('0x17'))[_0x31ae('0x12')](',\x20')));}var _0x2b7a54=_[_0x31ae('0x54')](_0x19a976[_0x31ae('0x55')],{'uniqueid':_0x6d02ee['uniqueid']});if(_0x2b7a54&&_0x2b7a54[_0x31ae('0x56')]){var _0x402428=util[_0x31ae('0x7')](_0x31ae('0x57'),_0x6d02ee[_0x31ae('0x58')]||_0x6d02ee[_0x31ae('0x59')],_0x6d02ee['format']||_0x31ae('0x5a'));return ami['Action']({'action':_0x31ae('0x5b'),'channel':_0x2b7a54[_0x31ae('0x56')],'file':_0x402428,'options':'ai(mixmonitorid)'})[_0x31ae('0x16')](function(_0x1bbece){var _0x1b719c=_[_0x31ae('0x54')](_0x2b7a54[_0x31ae('0x5c')],{'filename':'/var/spool/asterisk/monitor/'+_0x402428['toLowerCase']()});if(_[_0x31ae('0x5d')](_0x1b719c)){_0x2b7a54['monitors'][_0x31ae('0x4f')]({'filename':'/var/spool/asterisk/monitor/'+_0x402428[_0x31ae('0x5e')](),'createdAt':moment()[_0x31ae('0x7')](_0x31ae('0x5f')),'mixmonitorid':_0x1bbece[_0x31ae('0x60')],'status':_0x31ae('0x61')});}else{_0x1b719c[_0x31ae('0x60')]=_0x1bbece[_0x31ae('0x60')];_0x1b719c['status']=_0x31ae('0x61');}_0x3d0848({'code':0xc8,'message':[_0x6d02ee[_0x31ae('0x59')],_0x31ae('0x62'),_0x1bbece[_0x31ae('0x60')]][_0x31ae('0x12')]('\x20'),'mixmonitorid':_0x1bbece[_0x31ae('0x60')]});})[_0x31ae('0x18')](function(_0x242e49){_0x4ad031(_0x26df37['error'](0x1f5,[_0x6d02ee[_0x31ae('0x59')],_0x242e49[_0x31ae('0x17')]['toLowerCase']()][_0x31ae('0x12')]('\x20')));});}else{return _0x4ad031(_0x26df37[_0x31ae('0xf')](0x1f5,_0x31ae('0x63')));}});},'VoiceChannelStopMixMonitor':function(_0x553a9a){var _0x50c3d5=this;return new Promise(function(_0x460576,_0x8fafa4){if(ami[_0x31ae('0x51')]()==![]){return _0x8fafa4(_0x50c3d5[_0x31ae('0xf')](0x1f4,[config[_0x31ae('0x10')]['ip'],config[_0x31ae('0x10')]['username'],'ami\x20disconnected'][_0x31ae('0x12')]('\x20')));}var _0xd780f3=schema(properties[_0x31ae('0x52')])[_0x31ae('0x1')](_0x553a9a);if(_0xd780f3[_0x31ae('0x50')]>0x0){return _0x8fafa4(_0x50c3d5[_0x31ae('0xf')](0x1f4,_[_0x31ae('0x53')](_0xd780f3,_0x31ae('0x17'))[_0x31ae('0x12')](',\x20')));}var _0x1cb85b=_['find'](_0x19a976[_0x31ae('0x55')],{'uniqueid':_0x553a9a[_0x31ae('0x59')]});if(_0x1cb85b){return BPromise[_0x31ae('0x64')]()[_0x31ae('0x16')](function(){if(_0x1cb85b[_0x31ae('0x56')]){return ami[_0x31ae('0x15')]({'action':_0x31ae('0x65'),'channel':_0x1cb85b[_0x31ae('0x56')],'mixmonitorid':_0x553a9a[_0x31ae('0x60')]})['catch'](function(_0x179b64){});}})[_0x31ae('0x16')](function(){if(_0x1cb85b[_0x31ae('0x66')]){return ami[_0x31ae('0x15')]({'action':_0x31ae('0x65'),'channel':_0x1cb85b[_0x31ae('0x66')],'mixmonitorid':_0x553a9a[_0x31ae('0x60')]})['catch'](function(_0x26aeda){});}})[_0x31ae('0x16')](function(_0x4cfc9e){var _0x4f7296=_[_0x31ae('0x54')](_0x1cb85b[_0x31ae('0x5c')],{'mixmonitorid':_0x553a9a[_0x31ae('0x60')]});if(_0x4f7296){_0x4f7296[_0x31ae('0x67')]='stop';}})['then'](function(){var _0x2391a0=util['format'](_0x31ae('0x57'),_0x553a9a['filename']||_0x553a9a[_0x31ae('0x59')],_0x553a9a['format']||_0x31ae('0x5a'));var _0x2ce42e=_['find'](_0x1cb85b[_0x31ae('0x5c')],{'filename':'/var/spool/asterisk/monitor/'+_0x2391a0[_0x31ae('0x5e')]()});if(_0x2ce42e){_0x2ce42e[_0x31ae('0x67')]=_0x31ae('0x68');}})[_0x31ae('0x16')](function(){_0x460576({'code':0xc8,'message':[_0x553a9a[_0x31ae('0x59')],_0x31ae('0x69')][_0x31ae('0x12')]('\x20')});})[_0x31ae('0x18')](function(_0x4e9c34){_0x8fafa4(_0x50c3d5[_0x31ae('0xf')](0x1f5,[_0x553a9a[_0x31ae('0x59')],_0x4e9c34[_0x31ae('0x17')][_0x31ae('0x5e')]()][_0x31ae('0x12')]('\x20')));});}else{return _0x8fafa4(_0x50c3d5[_0x31ae('0xf')](0x1f5,_0x31ae('0x63')));}});},'VoiceQueuesChannels':function(_0x482609){return new Promise(function(_0x2e3c7b,_0x25a109){var _0x3a8d47=_['values'](_0x19a976[_0x31ae('0x6a')]);_0x2e3c7b({'count':_0x3a8d47[_0x31ae('0x50')],'rows':_0x3a8d47});});},'VoiceQueuesChannel':function(_0x5cdfc9){var _0x1b78be=this;return new Promise(function(_0x497bb7,_0x238507){var _0x159e56=schema(properties[_0x31ae('0x6b')])[_0x31ae('0x1')](_0x5cdfc9);if(_0x159e56['length']>0x0){return _0x238507(_0x1b78be[_0x31ae('0xf')](0x1f4,_[_0x31ae('0x53')](_0x159e56,'message')[_0x31ae('0x12')](',\x20')));}var _0x43b212=_[_0x31ae('0x54')](_0x19a976['queueChannels'],{'uniqueid':_0x5cdfc9[_0x31ae('0x59')]});if(_0x43b212){_0x497bb7(_0x43b212);}else{return _0x238507(_0x1b78be[_0x31ae('0xf')](0x1f5,_0x31ae('0x63')));}});},'VoiceQueuesChannelHangup':function(_0x523fec){var _0x29c98e=this;return new Promise(function(_0x502ffc,_0xac2351){if(ami[_0x31ae('0x51')]()==![]){return _0xac2351(_0x29c98e[_0x31ae('0xf')](0x1f4,[config[_0x31ae('0x10')]['ip'],config['asterisk'][_0x31ae('0x11')],_0x31ae('0x19')][_0x31ae('0x12')]('\x20')));}var _0x3b5596=schema(properties[_0x31ae('0x6c')])[_0x31ae('0x1')](_0x523fec);if(_0x3b5596[_0x31ae('0x50')]>0x0){return _0xac2351(_0x29c98e[_0x31ae('0xf')](0x1f4,_['map'](_0x3b5596,_0x31ae('0x17'))['join'](',\x20')));}var _0x433b36=_['find'](_0x19a976[_0x31ae('0x6a')],{'uniqueid':_0x523fec[_0x31ae('0x59')]});if(_0x433b36&&_0x433b36[_0x31ae('0x56')]){return ami[_0x31ae('0x15')]({'action':_0x31ae('0x6d'),'channel':_0x433b36[_0x31ae('0x56')]})[_0x31ae('0x16')](function(_0x39a032){_0x502ffc({'code':0xc8,'message':[_0x523fec[_0x31ae('0x59')],_0x39a032[_0x31ae('0x17')][_0x31ae('0x5e')]()][_0x31ae('0x12')]('\x20')});})[_0x31ae('0x18')](function(_0x4c4f96){_0xac2351(_0x29c98e[_0x31ae('0xf')](0x1f5,[_0x523fec[_0x31ae('0x59')],_0x4c4f96[_0x31ae('0x17')][_0x31ae('0x5e')]()][_0x31ae('0x12')]('\x20')));});}else{return _0xac2351(_0x29c98e['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x4f5655){var _0x46b506=this;return new Promise(function(_0x17b9de,_0x564e3e){if(ami[_0x31ae('0x51')]()==![]){return _0x564e3e(_0x46b506['error'](0x1f4,[config['asterisk']['ip'],config[_0x31ae('0x10')]['username'],_0x31ae('0x19')][_0x31ae('0x12')]('\x20')));}var _0x1d66a5=schema(properties[_0x31ae('0x6e')])[_0x31ae('0x1')](_0x4f5655);if(_0x1d66a5[_0x31ae('0x50')]>0x0){return _0x564e3e(_0x46b506[_0x31ae('0xf')](0x1f4,_[_0x31ae('0x53')](_0x1d66a5,_0x31ae('0x17'))['join'](',\x20')));}var _0x55c499=_['find'](_0x19a976[_0x31ae('0x6a')],{'uniqueid':_0x4f5655[_0x31ae('0x59')]});if(_0x55c499&&_0x55c499['channel']){return ami['Action']({'action':_0x31ae('0x6f'),'channel':_0x55c499[_0x31ae('0x56')],'exten':_0x4f5655[_0x31ae('0x70')],'context':_0x4f5655[_0x31ae('0x71')]||_0x55c499['context'],'priority':0x1})['then'](function(_0x180f52){_0x17b9de({'code':0xc8,'message':[_0x4f5655[_0x31ae('0x59')],_0x180f52[_0x31ae('0x17')][_0x31ae('0x5e')]()]['join']('\x20')});})[_0x31ae('0x18')](function(_0x2066b5){_0x564e3e(_0x46b506[_0x31ae('0xf')](0x1f5,[_0x4f5655[_0x31ae('0x59')],_0x2066b5[_0x31ae('0x17')][_0x31ae('0x5e')]()][_0x31ae('0x12')]('\x20')));});}else{return _0x564e3e(_0x46b506['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x5c9c42){return new Promise(function(_0x4348d3,_0xbc9541){var _0x22c4f6=_['values'](_0x19a976[_0x31ae('0xd')]);_0x4348d3({'count':_0x22c4f6['length'],'rows':_0x22c4f6});});},'Telephones':function(_0x27646a){return new Promise(function(_0x1b3fc4,_0x9bcc4c){var _0x103e6a=_[_0x31ae('0x72')](_0x19a976[_0x31ae('0x73')]);_0x1b3fc4({'count':_0x103e6a['length'],'rows':_0x103e6a});});},'Trunks':function(_0x18372c){return new Promise(function(_0xe207bb,_0x3a251a){var _0x5f29f0=_['values'](_0x19a976[_0x31ae('0x74')]);_0xe207bb({'count':_0x5f29f0[_0x31ae('0x50')],'rows':_0x5f29f0});});},'OutboundChannels':function(_0x247632){return new Promise(function(_0x5a8abf,_0x2e06e4){var _0x2a6996=_['values'](_0x19a976[_0x31ae('0x75')]);_0x5a8abf({'count':_0x2a6996[_0x31ae('0x50')],'rows':_0x2a6996});});},'Outbound':function(_0x2ae517){return new Promise(function(_0x14093b,_0x50d34c){_0x14093b(_0x19a976[_0x31ae('0x76')]);});},'Campaigns':function(_0x208aca){return new Promise(function(_0x4765a5,_0x3ed67c){var _0x5c2ae3=_[_0x31ae('0x72')](_0x19a976['campaigns']);_0x4765a5({'count':_0x5c2ae3[_0x31ae('0x50')],'rows':_0x5c2ae3});});},'VoiceQueuesPreview':function(_0x25fe3b){var _0xe9fc20=this;return new Promise(function(_0x170312,_0xe5d355){_0x3b9502[_0x31ae('0x77')](_0x25fe3b['id'])['then'](function(_0x3568dc){_0x170312({'code':0xc8,'message':_0x3568dc['message']});})[_0x31ae('0x18')](function(_0x192f18){_0xe5d355(_0xe9fc20[_0x31ae('0xf')](0x1f4,_0x192f18[_0x31ae('0x17')]));});});},'EventManager':function(_0x249b01){var _0x58e698=this;return new Promise(function(_0x164afc,_0x271a6f){if(!_0x249b01[_0x31ae('0x78')]){return _0x271a6f(_0x58e698[_0x31ae('0xf')](0x1f4,_0x31ae('0x79')));}ami[_0x31ae('0x7a')](_0x31ae('0x7b')+_0x249b01['event'],_0x249b01[_0x31ae('0x17')]);_0x164afc({'code':0xc8,'message':_0x249b01});});},'FaxAccounts':function(_0x38fb9f){return new Promise(function(_0xe90630,_0x1ed244){var _0x18cc98=_['values'](_0x19a976['faxAccounts']);_0xe90630({'count':_0x18cc98[_0x31ae('0x50')],'rows':_0x18cc98});});},'SendFax':function(_0x533e94){var _0x42b65f=this;return new Promise(function(_0xf1a584,_0x16df98){_0x4e5b87['send'](_0x533e94)['then'](function(_0x3367c6){_0xf1a584({'code':0xc8,'message':_0x3367c6[_0x31ae('0x17')]});})[_0x31ae('0x18')](function(_0x24734e){_0x16df98(_0x42b65f['error'](0x1f4,_0x24734e[_0x31ae('0x17')]));});});},'CheckAfterSend':function(_0x4528ed){var _0x4e1de4=this;return new Promise(function(_0x30c1d5,_0x937532){_0x4e5b87['checkAfterSend'](_0x4528ed)[_0x31ae('0x16')](function(_0x16a857){_0x30c1d5({'code':0xc8,'message':_0x16a857[_0x31ae('0x17')]});})[_0x31ae('0x18')](function(_0x5204ba){_0x937532(_0x4e1de4[_0x31ae('0xf')](0x1f4,_0x5204ba['message']));});});}};var _0x51790a=jayson[_0x31ae('0x7c')](_0xdd8645)[_0x31ae('0x7d')]();_0x51790a['on'](_0x31ae('0xf'),function(_0x2250e){return _0x18eb56(_0x2250e);});_0x51790a['listen'](0x232a,_0x31ae('0x7e'),function(){console[_0x31ae('0x7f')](_0x31ae('0x80'),0x232a);return _0x5cc4bb('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0xbb5b=['timer','pause','isConnected','asterisk','ami\x20disconnected','join','keys','module','action','Reload','Action','message','error','username','pick','content','catch','voiceQueues','name','strategy','answered','loggedIn','pTalking','sumBillable','total','type','unmanaged','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','Interval','length','voicechannel','map','find','channels','uniqueid','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','then','monitors','/var/spool/asterisk/monitor/','toLowerCase','push','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','resolve','channel','StopMixMonitor','destinationchannel','Channel\x20doesn\x27t\x20exist','values','voicequeuechannelhangup','queueChannels','voicequeuechannelredirect','Redirect','context','trunks','outbound','campaigns','run','event','Event\x20name\x20mandatory','emit','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','listen','format','SIP','timers'];(function(_0x4aabd5,_0xf3d242){var _0x1f8f57=function(_0x516e0e){while(--_0x516e0e){_0x4aabd5['push'](_0x4aabd5['shift']());}};_0x1f8f57(++_0xf3d242);}(_0xbb5b,0xf2));var _0xbbb5=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xbb5b[_0x47aa64];return _0x549c7a;};'use strict';var _=require('lodash');var util=require('util');var jayson=require(_0xbbb5('0x0'));var schema=require(_0xbbb5('0x1'));var BPromise=require(_0xbbb5('0x2'));var moment=require(_0xbbb5('0x3'));var config=require(_0xbbb5('0x4'));var properties=require(_0xbbb5('0x5'));var ami=require('../ami');exports[_0xbbb5('0x6')]=function(_0x31b12f,_0x4a0ce7,_0x470e92){return new BPromise(function(_0x4225cc,_0x23a648){var _0x3126a4={'QueuePause':function(_0x5eb2cc){return new Promise(function(_0x1ea6d2,_0x4b9265){var _0x51962e=util[_0xbbb5('0x7')]('%s/%s',_0xbbb5('0x8'),_0x5eb2cc['name']);if(_0x31b12f[_0xbbb5('0x9')]&&_0x31b12f[_0xbbb5('0x9')][_0x51962e]&&_0x31b12f['timers'][_0x51962e][_0xbbb5('0xa')]){_0x31b12f[_0xbbb5('0x9')][_0x51962e]['updateAcw']();}if(_0x31b12f['agents'][_0x51962e]){_0x31b12f['agents'][_0x51962e]['updateStatusRealtime']({'statePause':_0x5eb2cc[_0xbbb5('0xb')]?!![]:![]});}_0x1ea6d2({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x4f0339){var _0x1aa818=this;return new Promise(function(_0x192d3b,_0x3774a2){if(ami[_0xbbb5('0xc')]()==![]){return _0x3774a2(_0x1aa818['error'](0x1f4,[config[_0xbbb5('0xd')]['ip'],config[_0xbbb5('0xd')]['username'],_0xbbb5('0xe')][_0xbbb5('0xf')]('\x20')));}_0x4f0339=_['pick'](_0x4f0339,_[_0xbbb5('0x10')](properties[_0xbbb5('0x11')]));_0x4f0339[_0xbbb5('0x12')]=_0xbbb5('0x13');return ami[_0xbbb5('0x14')](_0x4f0339)['then'](function(_0x108bc1){_0x192d3b({'code':0xc8,'message':_0x108bc1[_0xbbb5('0x15')]});})['catch'](function(_0x1f5628){_0x3774a2(_0x1aa818[_0xbbb5('0x16')](0x1f5,_0x1f5628[_0xbbb5('0x15')]));});});},'Command':function(_0x49ff81){var _0x13c5e6=this;return new Promise(function(_0x2df81e,_0x5034cc){if(ami['isConnected']()==![]){return _0x5034cc(_0x13c5e6[_0xbbb5('0x16')](0x1f4,[config[_0xbbb5('0xd')]['ip'],config[_0xbbb5('0xd')][_0xbbb5('0x17')],_0xbbb5('0xe')][_0xbbb5('0xf')]('\x20')));}_0x49ff81=_[_0xbbb5('0x18')](_0x49ff81,'command');_0x49ff81[_0xbbb5('0x12')]='Command';return ami[_0xbbb5('0x14')](_0x49ff81)['then'](function(_0x2dc54b){_0x2df81e({'code':0xc8,'message':_0x2dc54b[_0xbbb5('0x19')]});})[_0xbbb5('0x1a')](function(_0x2a6c6d){_0x5034cc(_0x13c5e6['error'](0x1f5,_0x2a6c6d['message']));});});},'VoiceQueues':function(_0x5c9ff3){return new Promise(function(_0x3b2855,_0x4653e9){var _0x2e1f6a=[];for(var _0xd5c1c6 in _0x31b12f[_0xbbb5('0x1b')]){if(_0x31b12f[_0xbbb5('0x1b')]['hasOwnProperty'](_0xd5c1c6)){var _0x2bf145=_0x31b12f[_0xbbb5('0x1b')][_0xd5c1c6];var _0x56d38f={'id':_0x2bf145['id'],'name':_0x2bf145[_0xbbb5('0x1c')],'strategy':_0x2bf145[_0xbbb5('0x1d')],'answered':_0x2bf145[_0xbbb5('0x1e')],'available':_0x2bf145['available'],'loggedIn':_0x2bf145[_0xbbb5('0x1f')],'pTalking':_0x2bf145[_0xbbb5('0x20')],'sumBillable':_0x2bf145[_0xbbb5('0x21')],'sumDuration':_0x2bf145['sumDuration'],'sumHoldTime':_0x2bf145['sumHoldTime']||0x0,'talking':_0x2bf145['talking'],'total':_0x2bf145[_0xbbb5('0x22')],'type':_0x2bf145[_0xbbb5('0x23')],'unmanaged':_0x2bf145[_0xbbb5('0x24')],'abandoned':_0x2bf145['abandoned'],'waiting':_0x2bf145['waiting'],'loggedInDb':_0x2bf145[_0xbbb5('0x25')]};if(_0x2bf145[_0xbbb5('0x23')]==='outbound'){_0x56d38f[_0xbbb5('0x26')]=_0x2bf145[_0xbbb5('0x26')];_0x56d38f[_0xbbb5('0x27')]=_0x2bf145[_0xbbb5('0x27')];_0x56d38f[_0xbbb5('0x28')]=_0x2bf145['dialOriginateCallerIdName'];_0x56d38f[_0xbbb5('0x29')]=_0x2bf145['dialOriginateCallerIdNumber'];_0x56d38f[_0xbbb5('0x2a')]=_0x2bf145['dialOriginateTimeout'];_0x56d38f[_0xbbb5('0x2b')]=_0x2bf145['dialPrefix'];_0x56d38f[_0xbbb5('0x2c')]=_0x2bf145[_0xbbb5('0x2c')];_0x56d38f[_0xbbb5('0x2d')]=_0x2bf145[_0xbbb5('0x2d')];_0x56d38f[_0xbbb5('0x2e')]=_0x2bf145[_0xbbb5('0x2e')];_0x56d38f['outboundBusyCallsDay']=_0x2bf145[_0xbbb5('0x2f')];_0x56d38f[_0xbbb5('0x30')]=_0x2bf145[_0xbbb5('0x30')];_0x56d38f[_0xbbb5('0x31')]=_0x2bf145['outboundDropCallsDayACS'];_0x56d38f[_0xbbb5('0x32')]=_0x2bf145[_0xbbb5('0x32')];_0x56d38f['outboundDropCallsDayTimeout']=_0x2bf145['outboundDropCallsDayTimeout'];_0x56d38f[_0xbbb5('0x33')]=_0x2bf145[_0xbbb5('0x33')];_0x56d38f[_0xbbb5('0x34')]=_0x2bf145[_0xbbb5('0x34')];_0x56d38f[_0xbbb5('0x35')]=_0x2bf145['outboundOriginateFailureCallsDay'];_0x56d38f['outboundReCallsDay']=_0x2bf145['outboundReCallsDay'];_0x56d38f[_0xbbb5('0x36')]=_0x2bf145[_0xbbb5('0x36')];_0x56d38f['outboundUnknownCallsDay']=_0x2bf145[_0xbbb5('0x37')];_0x56d38f[_0xbbb5('0x38')]=_0x2bf145[_0xbbb5('0x38')];_0x56d38f[_0xbbb5('0x39')]=_0x2bf145[_0xbbb5('0x39')];_0x56d38f[_0xbbb5('0x3a')]=_0x2bf145[_0xbbb5('0x3a')];_0x56d38f[_0xbbb5('0x3b')]=_0x2bf145[_0xbbb5('0x3b')];_0x56d38f[_0xbbb5('0x3c')]=_0x2bf145[_0xbbb5('0x3c')];_0x56d38f[_0xbbb5('0x3d')]=_0x2bf145[_0xbbb5('0x3d')];_0x56d38f['predictiveIntervalErlangCallsDroppedCalls']=_0x2bf145[_0xbbb5('0x3e')];_0x56d38f[_0xbbb5('0x3f')]=_0x2bf145[_0xbbb5('0x3f')];_0x56d38f[_0xbbb5('0x40')]=_0x2bf145[_0xbbb5('0x40')];_0x56d38f[_0xbbb5('0x41')]=_0x2bf145[_0xbbb5('0x41')];_0x56d38f[_0xbbb5('0x42')]=_0x2bf145[_0xbbb5('0x42')];_0x56d38f[_0xbbb5('0x43')]=_0x2bf145[_0xbbb5('0x43')];_0x56d38f[_0xbbb5('0x15')]=_0x2bf145[_0xbbb5('0x15')];_0x56d38f[_0xbbb5('0x44')]=_0x2bf145[_0xbbb5('0x44')];_0x56d38f[_0xbbb5('0x45')]=_0x2bf145[_0xbbb5('0x45')];_0x56d38f[_0xbbb5('0x46')]=_0x2bf145['erlangCallToSecond'];_0x56d38f[_0xbbb5('0x47')]=_0x2bf145[_0xbbb5('0x47')];_0x56d38f[_0xbbb5('0x48')]=_0x2bf145[_0xbbb5('0x48')];_0x56d38f['startPredictive']=_0x2bf145['startPredictive'];_0x56d38f['startProgressive']=_0x2bf145[_0xbbb5('0x49')];}if(_0x2bf145[_0xbbb5('0x4a')]){_0x56d38f[_0xbbb5('0x4a')]={'id':_0x2bf145[_0xbbb5('0x4a')]['id'],'name':_0x2bf145[_0xbbb5('0x4a')][_0xbbb5('0x1c')],'active':_0x2bf145[_0xbbb5('0x4a')][_0xbbb5('0x4b')],'callerid':_0x2bf145[_0xbbb5('0x4a')][_0xbbb5('0x4c')]};}if(_0x2bf145['Interval']){_0x56d38f[_0xbbb5('0x4d')]={'id':_0x2bf145[_0xbbb5('0x4d')]['id'],'name':_0x2bf145[_0xbbb5('0x4d')][_0xbbb5('0x1c')]};}_0x2e1f6a['push'](_0x56d38f);}}_0x3b2855({'count':_0x2e1f6a[_0xbbb5('0x4e')],'rows':_0x2e1f6a});});},'VoiceChannels':function(_0x46ad3f){return new Promise(function(_0xce5f7e,_0x884bd0){var _0x326953=_['values'](_0x31b12f['channels']);_0xce5f7e({'count':_0x326953[_0xbbb5('0x4e')],'rows':_0x326953});});},'VoiceChannelMixMonitor':function(_0x24daee){var _0x49d2a6=this;return new Promise(function(_0xfe7155,_0x2efe55){if(ami[_0xbbb5('0xc')]()==![]){return _0x2efe55(_0x49d2a6[_0xbbb5('0x16')](0x1f4,[config[_0xbbb5('0xd')]['ip'],config[_0xbbb5('0xd')][_0xbbb5('0x17')],'ami\x20disconnected'][_0xbbb5('0xf')]('\x20')));}var _0x3be018=schema(properties[_0xbbb5('0x4f')])[_0xbbb5('0x1')](_0x24daee);if(_0x3be018[_0xbbb5('0x4e')]>0x0){return _0x2efe55(_0x49d2a6[_0xbbb5('0x16')](0x1f4,_[_0xbbb5('0x50')](_0x3be018,_0xbbb5('0x15'))[_0xbbb5('0xf')](',\x20')));}var _0x5d833d=_[_0xbbb5('0x51')](_0x31b12f[_0xbbb5('0x52')],{'uniqueid':_0x24daee[_0xbbb5('0x53')]});if(_0x5d833d&&_0x5d833d['channel']){var _0x2763ac=util[_0xbbb5('0x7')](_0xbbb5('0x54'),_0x24daee[_0xbbb5('0x55')]||_0x24daee['uniqueid'],_0x24daee[_0xbbb5('0x7')]||_0xbbb5('0x56'));return ami[_0xbbb5('0x14')]({'action':_0xbbb5('0x57'),'channel':_0x5d833d['channel'],'file':_0x2763ac,'options':_0xbbb5('0x58')})[_0xbbb5('0x59')](function(_0x49f717){var _0x489c70=_[_0xbbb5('0x51')](_0x5d833d[_0xbbb5('0x5a')],{'filename':_0xbbb5('0x5b')+_0x2763ac[_0xbbb5('0x5c')]()});if(_['isNil'](_0x489c70)){_0x5d833d[_0xbbb5('0x5a')][_0xbbb5('0x5d')]({'filename':_0xbbb5('0x5b')+_0x2763ac[_0xbbb5('0x5c')](),'createdAt':moment()[_0xbbb5('0x7')](_0xbbb5('0x5e')),'mixmonitorid':_0x49f717['mixmonitorid'],'status':_0xbbb5('0x5f')});}else{_0x489c70['mixmonitorid']=_0x49f717[_0xbbb5('0x60')];_0x489c70[_0xbbb5('0x61')]=_0xbbb5('0x5f');}_0xfe7155({'code':0xc8,'message':[_0x24daee[_0xbbb5('0x53')],_0xbbb5('0x62'),_0x49f717[_0xbbb5('0x60')]]['join']('\x20'),'mixmonitorid':_0x49f717['mixmonitorid']});})['catch'](function(_0x589613){_0x2efe55(_0x49d2a6[_0xbbb5('0x16')](0x1f5,[_0x24daee[_0xbbb5('0x53')],_0x589613[_0xbbb5('0x15')][_0xbbb5('0x5c')]()][_0xbbb5('0xf')]('\x20')));});}else{return _0x2efe55(_0x49d2a6[_0xbbb5('0x16')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x4a5052){var _0x252a3c=this;return new Promise(function(_0xf93ac6,_0x1a3d0d){if(ami[_0xbbb5('0xc')]()==![]){return _0x1a3d0d(_0x252a3c['error'](0x1f4,[config[_0xbbb5('0xd')]['ip'],config[_0xbbb5('0xd')]['username'],_0xbbb5('0xe')]['join']('\x20')));}var _0x36f14c=schema(properties['voicechannel'])[_0xbbb5('0x1')](_0x4a5052);if(_0x36f14c[_0xbbb5('0x4e')]>0x0){return _0x1a3d0d(_0x252a3c[_0xbbb5('0x16')](0x1f4,_[_0xbbb5('0x50')](_0x36f14c,_0xbbb5('0x15'))[_0xbbb5('0xf')](',\x20')));}var _0x2efa93=_['find'](_0x31b12f[_0xbbb5('0x52')],{'uniqueid':_0x4a5052[_0xbbb5('0x53')]});if(_0x2efa93){return BPromise[_0xbbb5('0x63')]()[_0xbbb5('0x59')](function(){if(_0x2efa93[_0xbbb5('0x64')]){return ami['Action']({'action':_0xbbb5('0x65'),'channel':_0x2efa93[_0xbbb5('0x64')],'mixmonitorid':_0x4a5052['mixmonitorid']})[_0xbbb5('0x1a')](function(_0xb2386a){});}})[_0xbbb5('0x59')](function(){if(_0x2efa93['destinationchannel']){return ami['Action']({'action':_0xbbb5('0x65'),'channel':_0x2efa93[_0xbbb5('0x66')],'mixmonitorid':_0x4a5052[_0xbbb5('0x60')]})[_0xbbb5('0x1a')](function(_0x12abe6){});}})['then'](function(_0x300e15){var _0x3db3a6=_[_0xbbb5('0x51')](_0x2efa93['monitors'],{'mixmonitorid':_0x4a5052[_0xbbb5('0x60')]});if(_0x3db3a6){_0x3db3a6['status']='stop';}})[_0xbbb5('0x59')](function(){var _0x4d00d1=util[_0xbbb5('0x7')]('%s.%s',_0x4a5052[_0xbbb5('0x55')]||_0x4a5052['uniqueid'],_0x4a5052[_0xbbb5('0x7')]||'wav');var _0x3b510a=_[_0xbbb5('0x51')](_0x2efa93[_0xbbb5('0x5a')],{'filename':_0xbbb5('0x5b')+_0x4d00d1['toLowerCase']()});if(_0x3b510a){_0x3b510a[_0xbbb5('0x61')]='stop';}})[_0xbbb5('0x59')](function(){_0xf93ac6({'code':0xc8,'message':[_0x4a5052[_0xbbb5('0x53')],'StopMixMonitor\x20Success'][_0xbbb5('0xf')]('\x20')});})['catch'](function(_0x1abaa6){_0x1a3d0d(_0x252a3c[_0xbbb5('0x16')](0x1f5,[_0x4a5052[_0xbbb5('0x53')],_0x1abaa6[_0xbbb5('0x15')][_0xbbb5('0x5c')]()][_0xbbb5('0xf')]('\x20')));});}else{return _0x1a3d0d(_0x252a3c['error'](0x1f5,_0xbbb5('0x67')));}});},'VoiceQueuesChannels':function(_0x4a1bc0){return new Promise(function(_0x5cdfd0,_0x3050ea){var _0x9ca2ed=_[_0xbbb5('0x68')](_0x31b12f['queueChannels']);_0x5cdfd0({'count':_0x9ca2ed[_0xbbb5('0x4e')],'rows':_0x9ca2ed});});},'VoiceQueuesChannel':function(_0xcae239){var _0x1436ed=this;return new Promise(function(_0x5dd8e1,_0x229faa){var _0x422480=schema(properties['voicequeuechannel'])[_0xbbb5('0x1')](_0xcae239);if(_0x422480[_0xbbb5('0x4e')]>0x0){return _0x229faa(_0x1436ed[_0xbbb5('0x16')](0x1f4,_[_0xbbb5('0x50')](_0x422480,_0xbbb5('0x15'))['join'](',\x20')));}var _0x1afbac=_[_0xbbb5('0x51')](_0x31b12f['queueChannels'],{'uniqueid':_0xcae239[_0xbbb5('0x53')]});if(_0x1afbac){_0x5dd8e1(_0x1afbac);}else{return _0x229faa(_0x1436ed[_0xbbb5('0x16')](0x1f5,_0xbbb5('0x67')));}});},'VoiceQueuesChannelHangup':function(_0x470257){var _0x2ebbe2=this;return new Promise(function(_0x5e1466,_0xb8fdbb){if(ami[_0xbbb5('0xc')]()==![]){return _0xb8fdbb(_0x2ebbe2[_0xbbb5('0x16')](0x1f4,[config[_0xbbb5('0xd')]['ip'],config[_0xbbb5('0xd')]['username'],_0xbbb5('0xe')]['join']('\x20')));}var _0x4b10a0=schema(properties[_0xbbb5('0x69')])[_0xbbb5('0x1')](_0x470257);if(_0x4b10a0[_0xbbb5('0x4e')]>0x0){return _0xb8fdbb(_0x2ebbe2[_0xbbb5('0x16')](0x1f4,_['map'](_0x4b10a0,_0xbbb5('0x15'))['join'](',\x20')));}var _0x4e2057=_[_0xbbb5('0x51')](_0x31b12f[_0xbbb5('0x6a')],{'uniqueid':_0x470257[_0xbbb5('0x53')]});if(_0x4e2057&&_0x4e2057[_0xbbb5('0x64')]){return ami[_0xbbb5('0x14')]({'action':'Hangup','channel':_0x4e2057[_0xbbb5('0x64')]})[_0xbbb5('0x59')](function(_0x110b38){_0x5e1466({'code':0xc8,'message':[_0x470257['uniqueid'],_0x110b38['message'][_0xbbb5('0x5c')]()][_0xbbb5('0xf')]('\x20')});})[_0xbbb5('0x1a')](function(_0x2d4027){_0xb8fdbb(_0x2ebbe2['error'](0x1f5,[_0x470257[_0xbbb5('0x53')],_0x2d4027[_0xbbb5('0x15')]['toLowerCase']()][_0xbbb5('0xf')]('\x20')));});}else{return _0xb8fdbb(_0x2ebbe2[_0xbbb5('0x16')](0x1f5,_0xbbb5('0x67')));}});},'VoiceQueuesChannelRedirect':function(_0x32bd48){var _0x3af4d9=this;return new Promise(function(_0x1b78cb,_0x57dbbe){if(ami[_0xbbb5('0xc')]()==![]){return _0x57dbbe(_0x3af4d9[_0xbbb5('0x16')](0x1f4,[config[_0xbbb5('0xd')]['ip'],config[_0xbbb5('0xd')][_0xbbb5('0x17')],_0xbbb5('0xe')][_0xbbb5('0xf')]('\x20')));}var _0x13b6a3=schema(properties[_0xbbb5('0x6b')])[_0xbbb5('0x1')](_0x32bd48);if(_0x13b6a3[_0xbbb5('0x4e')]>0x0){return _0x57dbbe(_0x3af4d9[_0xbbb5('0x16')](0x1f4,_[_0xbbb5('0x50')](_0x13b6a3,'message')[_0xbbb5('0xf')](',\x20')));}var _0x2c1848=_[_0xbbb5('0x51')](_0x31b12f['queueChannels'],{'uniqueid':_0x32bd48['uniqueid']});if(_0x2c1848&&_0x2c1848[_0xbbb5('0x64')]){return ami[_0xbbb5('0x14')]({'action':_0xbbb5('0x6c'),'channel':_0x2c1848['channel'],'exten':_0x32bd48['exten'],'context':_0x32bd48[_0xbbb5('0x6d')]||_0x2c1848[_0xbbb5('0x6d')],'priority':0x1})[_0xbbb5('0x59')](function(_0x58b2ae){_0x1b78cb({'code':0xc8,'message':[_0x32bd48['uniqueid'],_0x58b2ae[_0xbbb5('0x15')]['toLowerCase']()]['join']('\x20')});})[_0xbbb5('0x1a')](function(_0x4f6343){_0x57dbbe(_0x3af4d9['error'](0x1f5,[_0x32bd48[_0xbbb5('0x53')],_0x4f6343[_0xbbb5('0x15')][_0xbbb5('0x5c')]()][_0xbbb5('0xf')]('\x20')));});}else{return _0x57dbbe(_0x3af4d9[_0xbbb5('0x16')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x51ff5c){return new Promise(function(_0x346b5b,_0x56155b){var _0x52546d=_[_0xbbb5('0x68')](_0x31b12f['agents']);_0x346b5b({'count':_0x52546d[_0xbbb5('0x4e')],'rows':_0x52546d});});},'Telephones':function(_0x4d95d6){return new Promise(function(_0x2dc6a6,_0x2e59fc){var _0xafae7c=_[_0xbbb5('0x68')](_0x31b12f['telephones']);_0x2dc6a6({'count':_0xafae7c[_0xbbb5('0x4e')],'rows':_0xafae7c});});},'Trunks':function(_0x5b2bcd){return new Promise(function(_0x499dfb,_0x318ea0){var _0x3db0b3=_[_0xbbb5('0x68')](_0x31b12f[_0xbbb5('0x6e')]);_0x499dfb({'count':_0x3db0b3[_0xbbb5('0x4e')],'rows':_0x3db0b3});});},'OutboundChannels':function(_0x4ddc58){return new Promise(function(_0x54a6a1,_0x2bb257){var _0x5c65bd=_[_0xbbb5('0x68')](_0x31b12f['outboundChannels']);_0x54a6a1({'count':_0x5c65bd[_0xbbb5('0x4e')],'rows':_0x5c65bd});});},'Outbound':function(_0x2db019){return new Promise(function(_0x2db7df,_0x2cc958){_0x2db7df(_0x31b12f[_0xbbb5('0x6f')]);});},'Campaigns':function(_0xc36c57){return new Promise(function(_0x223b4d,_0x40cd98){var _0x4ceb34=_[_0xbbb5('0x68')](_0x31b12f[_0xbbb5('0x70')]);_0x223b4d({'count':_0x4ceb34[_0xbbb5('0x4e')],'rows':_0x4ceb34});});},'VoiceQueuesPreview':function(_0x30c55f){var _0x3cb438=this;return new Promise(function(_0x24a3f2,_0x537a99){_0x4a0ce7[_0xbbb5('0x71')](_0x30c55f['id'])[_0xbbb5('0x59')](function(_0x3bd2b4){_0x24a3f2({'code':0xc8,'message':_0x3bd2b4[_0xbbb5('0x15')]});})['catch'](function(_0x5e5ba9){_0x537a99(_0x3cb438[_0xbbb5('0x16')](0x1f4,_0x5e5ba9[_0xbbb5('0x15')]));});});},'EventManager':function(_0x186fe0){var _0x560e5e=this;return new Promise(function(_0x21a981,_0x23e114){if(!_0x186fe0[_0xbbb5('0x72')]){return _0x23e114(_0x560e5e[_0xbbb5('0x16')](0x1f4,_0xbbb5('0x73')));}ami[_0xbbb5('0x74')]('custom:'+_0x186fe0[_0xbbb5('0x72')],_0x186fe0[_0xbbb5('0x15')]);_0x21a981({'code':0xc8,'message':_0x186fe0});});},'FaxAccounts':function(_0x488f69){return new Promise(function(_0x4d5035,_0x46646b){var _0x478a57=_['values'](_0x31b12f[_0xbbb5('0x75')]);_0x4d5035({'count':_0x478a57[_0xbbb5('0x4e')],'rows':_0x478a57});});},'SendFax':function(_0x1745a8){var _0x4906e7=this;return new Promise(function(_0x1f5c91,_0x22a700){_0x470e92[_0xbbb5('0x76')](_0x1745a8)[_0xbbb5('0x59')](function(_0x52c43d){_0x1f5c91({'code':0xc8,'message':_0x52c43d[_0xbbb5('0x15')]});})[_0xbbb5('0x1a')](function(_0x5cba11){_0x22a700(_0x4906e7[_0xbbb5('0x16')](0x1f4,_0x5cba11[_0xbbb5('0x15')]));});});},'CheckAfterSend':function(_0x3cb8d9){var _0x4f77c0=this;return new Promise(function(_0x1112a1,_0x455824){_0x470e92[_0xbbb5('0x77')](_0x3cb8d9)[_0xbbb5('0x59')](function(_0x392fe0){_0x1112a1({'code':0xc8,'message':_0x392fe0[_0xbbb5('0x15')]});})['catch'](function(_0x17fe76){_0x455824(_0x4f77c0[_0xbbb5('0x16')](0x1f4,_0x17fe76[_0xbbb5('0x15')]));});});}};var _0x2e02ce=jayson[_0xbbb5('0x78')](_0x3126a4)[_0xbbb5('0x79')]();_0x2e02ce['on'](_0xbbb5('0x16'),function(_0x15febb){return _0x23a648(_0x15febb);});_0x2e02ce[_0xbbb5('0x6')](0x232a,_0xbbb5('0x7a'),function(){console[_0xbbb5('0x7b')](_0xbbb5('0x7c'),0x232a);return _0x4225cc(_0xbbb5('0x7d')+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 d97ca17..fcdadb2 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 _0x9c30=['routeId','firstName','calleridname','uniqueid','destcalleridname','','destcalleridnum','phone','resolve','then','showContact','omit','[%s][%s]\x20Contact\x20found:%s','xmd-contactid2','format','user:%s','name','trigger:%s','action','toLowerCase','merge','[%s][%s]\x20Contact\x20not\x20found','createContact','catch','bluebird','lodash','ioredis','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','localhost','socket.io-emitter','redis','info','[%s][%s]','stringify','emit','exec','autoCreate','data2','data1','calleridnum','isNil'];(function(_0x3b0cea,_0xb40f2a){var _0x433186=function(_0x54b71f){while(--_0x54b71f){_0x3b0cea['push'](_0x3b0cea['shift']());}};_0x433186(++_0xb40f2a);}(_0x9c30,0x11a));var _0x09c3=function(_0xdaf0f,_0x8d9e81){_0xdaf0f=_0xdaf0f-0x0;var _0x5dea42=_0x9c30[_0xdaf0f];return _0x5dea42;};'use strict';var BPromise=require(_0x09c3('0x0'));var util=require('util');var _=require(_0x09c3('0x1'));var Redis=require(_0x09c3('0x2'));var config=require(_0x09c3('0x3'));var logger=require(_0x09c3('0x4'))('trigger');var cmContactRpc=require(_0x09c3('0x5'));config['redis']=_['defaults'](config['redis'],{'host':_0x09c3('0x6'),'port':0x18eb});var io=require(_0x09c3('0x7'))(new Redis(config[_0x09c3('0x8')]));function emit(_0x1b8916,_0x27358b,_0x4a39b7,_0x4aff86){logger[_0x09c3('0x9')](_0x09c3('0xa'),_0x1b8916,'',_0x27358b,_0x4a39b7,JSON[_0x09c3('0xb')](_0x4aff86));io['to'](_0x27358b)[_0x09c3('0xc')](_0x4a39b7,_0x4aff86);}exports[_0x09c3('0xd')]=function(_0x25dffd,_0x4acf0f,_0x844e70){_0x844e70[_0x09c3('0xe')]=0x0;if(_0x4acf0f[_0x09c3('0xf')]&&parseInt(_0x4acf0f['data2'],0xa)){var _0x1afb76={'ListId':parseInt(_0x4acf0f[_0x09c3('0x10')],0xa),'phone':_0x844e70[_0x09c3('0x11')]};if(_[_0x09c3('0x12')](_0x844e70[_0x09c3('0x13')])){_0x1afb76[_0x09c3('0x14')]=_0x844e70[_0x09c3('0x15')]&&_0x844e70[_0x09c3('0x15')]!==''?_0x844e70[_0x09c3('0x15')]:_0x844e70[_0x09c3('0x11')]||_0x844e70[_0x09c3('0x16')];}else{_0x1afb76['firstName']=_0x844e70[_0x09c3('0x17')]&&_0x844e70[_0x09c3('0x17')]!==_0x09c3('0x18')?_0x844e70[_0x09c3('0x17')]:_0x844e70[_0x09c3('0x19')]||_0x844e70[_0x09c3('0x16')];_0x1afb76[_0x09c3('0x1a')]=_0x844e70['destcalleridname']&&_0x844e70[_0x09c3('0x17')]!==_0x09c3('0x18')?_0x844e70[_0x09c3('0x17')]:_0x844e70[_0x09c3('0x19')]||_0x844e70[_0x09c3('0x16')];}BPromise[_0x09c3('0x1b')]()[_0x09c3('0x1c')](cmContactRpc[_0x09c3('0x1d')]({'where':_[_0x09c3('0x1e')](_0x1afb76,[_0x09c3('0x14')])}))[_0x09c3('0x1c')](function(_0x456b20){if(_0x456b20){logger[_0x09c3('0x9')](_0x09c3('0x1f'),_0x844e70[_0x09c3('0x16')],'',_0x456b20['id']);if(_0x25dffd){_0x844e70[_0x09c3('0x20')]=_0x456b20['id'];emit(_0x844e70[_0x09c3('0x16')],util[_0x09c3('0x21')](_0x09c3('0x22'),_0x25dffd[_0x09c3('0x23')]),util[_0x09c3('0x21')](_0x09c3('0x24'),_0x4acf0f[_0x09c3('0x25')][_0x09c3('0x26')]()),_[_0x09c3('0x27')](_0x844e70,{'ListId':parseInt(_0x4acf0f[_0x09c3('0x10')],0xa)}));}return;}else{logger[_0x09c3('0x9')](_0x09c3('0x28'),_0x844e70[_0x09c3('0x16')],'');return BPromise[_0x09c3('0x1b')]()[_0x09c3('0x1c')](cmContactRpc[_0x09c3('0x29')](_0x1afb76));}})[_0x09c3('0x1c')](function(_0x509798){if(_0x509798){logger[_0x09c3('0x9')]('[%s][%s]\x20Contact\x20created:%s',_0x844e70[_0x09c3('0x16')],'',_0x509798['id']);if(_0x25dffd){_0x844e70[_0x09c3('0x20')]=_0x509798['id'];emit(_0x844e70[_0x09c3('0x16')],util[_0x09c3('0x21')](_0x09c3('0x22'),_0x25dffd[_0x09c3('0x23')]),util[_0x09c3('0x21')](_0x09c3('0x24'),_0x4acf0f[_0x09c3('0x25')][_0x09c3('0x26')]()),_[_0x09c3('0x27')](_0x844e70,{'ListId':parseInt(_0x4acf0f[_0x09c3('0x10')],0xa)}));}}})[_0x09c3('0x2a')](function(_0xbaba46){logger['error']('[%s][%s]\x20Error\x20creating\x20contact',_0x844e70[_0x09c3('0x16')],'',JSON[_0x09c3('0xb')](_0xbaba46));});}else{if(_0x25dffd){logger[_0x09c3('0x9')]('[%s][%s]\x20Autocreate\x20disabled',_0x844e70['uniqueid'],'');emit(_0x844e70[_0x09c3('0x16')],util[_0x09c3('0x21')]('user:%s',_0x25dffd[_0x09c3('0x23')]),util[_0x09c3('0x21')](_0x09c3('0x24'),_0x4acf0f[_0x09c3('0x25')]['toLowerCase']()),_[_0x09c3('0x27')]({'ListId':parseInt(_0x4acf0f['data1'],0xa)},_0x844e70));}}}; \ No newline at end of file +var _0x3862=['omit','[%s][%s]\x20Contact\x20found:%s','xmd-contactid2','format','user:%s','trigger:%s','action','toLowerCase','merge','data1','createContact','catch','[%s][%s]\x20Error\x20creating\x20contact','stringify','[%s][%s]\x20Autocreate\x20disabled','name','bluebird','util','lodash','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[%s][%s]','exec','autoCreate','data2','calleridnum','isNil','calleridname','','firstName','destcalleridname','uniqueid','phone','then','showContact'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0x3862,0x112));var _0x2386=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x3862[_0x3ea913];return _0x2b4f28;};'use strict';var BPromise=require(_0x2386('0x0'));var util=require(_0x2386('0x1'));var _=require(_0x2386('0x2'));var Redis=require(_0x2386('0x3'));var config=require(_0x2386('0x4'));var logger=require(_0x2386('0x5'))(_0x2386('0x6'));var cmContactRpc=require(_0x2386('0x7'));config[_0x2386('0x8')]=_[_0x2386('0x9')](config[_0x2386('0x8')],{'host':_0x2386('0xa'),'port':0x18eb});var io=require(_0x2386('0xb'))(new Redis(config[_0x2386('0x8')]));function emit(_0x1dac0c,_0x29ba64,_0x2d2c80,_0x5f5c52){logger[_0x2386('0xc')](_0x2386('0xd'),_0x1dac0c,'',_0x29ba64,_0x2d2c80,JSON['stringify'](_0x5f5c52));io['to'](_0x29ba64)['emit'](_0x2d2c80,_0x5f5c52);}exports[_0x2386('0xe')]=function(_0x8c536e,_0x2080b6,_0x56f1d1){_0x56f1d1[_0x2386('0xf')]=0x0;if(_0x2080b6['data2']&&parseInt(_0x2080b6[_0x2386('0x10')],0xa)){var _0x5f0def={'ListId':parseInt(_0x2080b6['data1'],0xa),'phone':_0x56f1d1[_0x2386('0x11')]};if(_[_0x2386('0x12')](_0x56f1d1['routeId'])){_0x5f0def['firstName']=_0x56f1d1[_0x2386('0x13')]&&_0x56f1d1[_0x2386('0x13')]!==_0x2386('0x14')?_0x56f1d1[_0x2386('0x13')]:_0x56f1d1['calleridnum']||_0x56f1d1['uniqueid'];}else{_0x5f0def[_0x2386('0x15')]=_0x56f1d1[_0x2386('0x16')]&&_0x56f1d1[_0x2386('0x16')]!==_0x2386('0x14')?_0x56f1d1[_0x2386('0x16')]:_0x56f1d1['destcalleridnum']||_0x56f1d1[_0x2386('0x17')];_0x5f0def[_0x2386('0x18')]=_0x56f1d1[_0x2386('0x16')]&&_0x56f1d1['destcalleridname']!==_0x2386('0x14')?_0x56f1d1[_0x2386('0x16')]:_0x56f1d1['destcalleridnum']||_0x56f1d1['uniqueid'];}BPromise['resolve']()[_0x2386('0x19')](cmContactRpc[_0x2386('0x1a')]({'where':_[_0x2386('0x1b')](_0x5f0def,[_0x2386('0x15')])}))[_0x2386('0x19')](function(_0x27f7db){if(_0x27f7db){logger['info'](_0x2386('0x1c'),_0x56f1d1[_0x2386('0x17')],'',_0x27f7db['id']);if(_0x8c536e){_0x56f1d1[_0x2386('0x1d')]=_0x27f7db['id'];emit(_0x56f1d1['uniqueid'],util[_0x2386('0x1e')](_0x2386('0x1f'),_0x8c536e['name']),util[_0x2386('0x1e')](_0x2386('0x20'),_0x2080b6[_0x2386('0x21')][_0x2386('0x22')]()),_[_0x2386('0x23')](_0x56f1d1,{'ListId':parseInt(_0x2080b6[_0x2386('0x24')],0xa)}));}return;}else{logger[_0x2386('0xc')]('[%s][%s]\x20Contact\x20not\x20found',_0x56f1d1[_0x2386('0x17')],'');return BPromise['resolve']()[_0x2386('0x19')](cmContactRpc[_0x2386('0x25')](_0x5f0def));}})[_0x2386('0x19')](function(_0x74627d){if(_0x74627d){logger[_0x2386('0xc')]('[%s][%s]\x20Contact\x20created:%s',_0x56f1d1[_0x2386('0x17')],'',_0x74627d['id']);if(_0x8c536e){_0x56f1d1[_0x2386('0x1d')]=_0x74627d['id'];emit(_0x56f1d1[_0x2386('0x17')],util[_0x2386('0x1e')](_0x2386('0x1f'),_0x8c536e['name']),util[_0x2386('0x1e')](_0x2386('0x20'),_0x2080b6[_0x2386('0x21')][_0x2386('0x22')]()),_[_0x2386('0x23')](_0x56f1d1,{'ListId':parseInt(_0x2080b6['data1'],0xa)}));}}})[_0x2386('0x26')](function(_0xcafc6e){logger['error'](_0x2386('0x27'),_0x56f1d1[_0x2386('0x17')],'',JSON[_0x2386('0x28')](_0xcafc6e));});}else{if(_0x8c536e){logger[_0x2386('0xc')](_0x2386('0x29'),_0x56f1d1['uniqueid'],'');emit(_0x56f1d1[_0x2386('0x17')],util[_0x2386('0x1e')](_0x2386('0x1f'),_0x8c536e[_0x2386('0x2a')]),util[_0x2386('0x1e')](_0x2386('0x20'),_0x2080b6[_0x2386('0x21')][_0x2386('0x22')]()),_['merge']({'ListId':parseInt(_0x2080b6['data1'],0xa)},_0x56f1d1));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 636485c..d0ddc48 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 _0x79d2=['location','uriLocation','data4','windowWidth','data5','800','windowHeight','data6','winapp','winArguments','render','format','user:%s','name','trigger:%s:%s','merge','trigger:%s','exec','integration','queue','routeId','urlforward','script','buildUri','parse','query','search','replace','AllConditions','every','AnyConditions','checkConditions','channel','field','account','ChatWebsiteId','operator','value','AccountId','upperFirst','event','membername','lastevent','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','redis','defaults','localhost','popup','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','accounts','servicenowAccounts','syncCustomEvent','custom:agentconnect','custom:agentringnoanswer','bind','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','clone','interface','hasOwnProperty','status','checkTrigger','variables','length','Actions','action','toLowerCase','contactmanager','data1','html','data2','template\x20not\x20found','uri','isNil','data3'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x79d2,0x118));var _0x279d=function(_0x92713a,_0x68f8b0){_0x92713a=_0x92713a-0x0;var _0x1893e1=_0x79d2[_0x92713a];return _0x1893e1;};'use strict';var util=require(_0x279d('0x0'));var _=require(_0x279d('0x1'));var url=require(_0x279d('0x2'));var Mustache=require(_0x279d('0x3'));var Redis=require(_0x279d('0x4'));var urlforward=require(_0x279d('0x5'));var integration=require(_0x279d('0x6'));var cmContact=require(_0x279d('0x7'));var script=require(_0x279d('0x8'));var cmContactRpc=require('../rpc/cmContact');var config=require(_0x279d('0x9'));var logger=require(_0x279d('0xa'))(_0x279d('0xb'));var ami=require('../ami');config[_0x279d('0xc')]=_[_0x279d('0xd')](config[_0x279d('0xc')],{'host':_0x279d('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var operators={'equals':function(_0x27e831,_0x163d2e){return _0x27e831==_0x163d2e;},'not_equals':function(_0x48f922,_0x1a6538){return _0x48f922!=_0x1a6538;}};var barAndWebActions=[_0x279d('0xf'),_0x279d('0x2'),'winapp'];function Trigger(_0x250bf7){this[_0x279d('0x10')]=_0x250bf7[_0x279d('0x10')];this[_0x279d('0x11')]=_0x250bf7[_0x279d('0x11')];this[_0x279d('0x12')]=_0x250bf7[_0x279d('0x12')];this[_0x279d('0x13')]=_0x250bf7[_0x279d('0x13')];this[_0x279d('0x14')]=_0x250bf7[_0x279d('0x14')];this[_0x279d('0x15')]=_0x250bf7[_0x279d('0x15')];this[_0x279d('0x16')]=_0x250bf7[_0x279d('0x16')];this['salesforceAccounts']=_0x250bf7[_0x279d('0x17')];this[_0x279d('0x18')]=_0x250bf7['sugarcrmAccounts'];this['zohoAccounts']=_0x250bf7[_0x279d('0x19')];this['deskAccounts']=_0x250bf7[_0x279d('0x1a')];this['vtigerAccounts']=_0x250bf7[_0x279d('0x1b')];this['servicenowAccounts']=_0x250bf7['servicenowAccounts'];this['dynamics365Accounts']=_0x250bf7[_0x279d('0x1c')];this['freshsalesAccounts']=_0x250bf7[_0x279d('0x1d')];this[_0x279d('0x1e')]={'zendesk':this[_0x279d('0x15')],'salesforce':this[_0x279d('0x17')],'freshdesk':this[_0x279d('0x16')],'sugarcrm':this[_0x279d('0x18')],'zoho':this['zohoAccounts'],'desk':this[_0x279d('0x1a')],'vtiger':this[_0x279d('0x1b')],'dynamics365':this['dynamics365Accounts'],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x279d('0x1f')]};ami['on']('custom:agentcalled',this[_0x279d('0x20')]['bind'](this));ami['on'](_0x279d('0x21'),this[_0x279d('0x20')]['bind'](this));ami['on'](_0x279d('0x22'),this['syncCustomEvent'][_0x279d('0x23')](this));ami['on'](_0x279d('0x24'),this[_0x279d('0x20')][_0x279d('0x23')](this));ami['on'](_0x279d('0x25'),this[_0x279d('0x20')][_0x279d('0x23')](this));ami['on'](_0x279d('0x26'),this['syncCustomEvent'][_0x279d('0x23')](this));ami['on'](_0x279d('0x27'),this['syncCustomEvent'][_0x279d('0x23')](this));ami['on'](_0x279d('0x28'),this['syncCustomEvent'][_0x279d('0x23')](this));ami['on'](_0x279d('0x29'),this['syncCustomEvent'][_0x279d('0x23')](this));ami['on'](_0x279d('0x2a'),this[_0x279d('0x20')]['bind'](this));ami['on'](_0x279d('0x2b'),this[_0x279d('0x20')]['bind'](this));ami['on'](_0x279d('0x2c'),this[_0x279d('0x2d')][_0x279d('0x23')](this));ami['on'](_0x279d('0x2e'),this[_0x279d('0x2d')][_0x279d('0x23')](this));ami['on'](_0x279d('0x2f'),this['syncAgentDial'][_0x279d('0x23')](this));ami['on']('custom:newinteraction',this[_0x279d('0x20')][_0x279d('0x23')](this));ami['on'](_0x279d('0x30'),this['syncCustomEvent'][_0x279d('0x23')](this));ami['on'](_0x279d('0x31'),this[_0x279d('0x20')][_0x279d('0x23')](this));ami['on'](_0x279d('0x32'),this['syncCustomEvent']['bind'](this));ami['on'](_0x279d('0x33'),this['syncCustomEvent'][_0x279d('0x23')](this));ami['on'](_0x279d('0x34'),this[_0x279d('0x20')][_0x279d('0x23')](this));}Trigger[_0x279d('0x35')][_0x279d('0x36')]=function(_0x2ee1ee,_0x264728,_0x402038){logger[_0x279d('0x37')](_0x2ee1ee,_0x264728,JSON['stringify'](_0x402038));io['to'](_0x2ee1ee)['emit'](_0x264728,_0x402038);};Trigger[_0x279d('0x35')]['syncCustomEvent']=function(_0x4d9f81){var _0x5ba72f=_[_0x279d('0x38')](_0x4d9f81);this['checkTriggers'](_0x5ba72f);};Trigger[_0x279d('0x35')][_0x279d('0x2d')]=function(_0x46d279){if(this[_0x279d('0x11')][_0x46d279[_0x279d('0x39')]]){this[_0x279d('0x20')](_0x46d279);}};Trigger[_0x279d('0x35')]['checkTriggers']=function(_0x1d3017){var _0x3fe49c;for(var _0x44652b in this[_0x279d('0x10')]){if(this[_0x279d('0x10')][_0x279d('0x3a')](_0x44652b)){if(this['triggers'][_0x44652b][_0x279d('0x3b')]){_0x3fe49c=this[_0x279d('0x3c')](this['triggers'][_0x44652b],_0x1d3017);if(_0x3fe49c){_['merge'](_0x1d3017,_0x1d3017[_0x279d('0x3d')]);for(var _0x4ee651=0x0,_0xac2cbf,_0x4e8422,_0x18b7d2;_0x4ee6510x0){_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(_0x3fb9dd,_0x174fff){var _0x20136a=function(_0x480081){while(--_0x480081){_0x3fb9dd['push'](_0x3fb9dd['shift']());}};_0x20136a(++_0x174fff);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 d50f3c8..13b2424 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 _0x9e3f=['isdisabled',']\x20Agent\x20found\x20','systemuserid','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','userId','toLowerCase','outbound','calleridnum','POST','contacts','/systemusers(','odata-entityid','lastIndexOf','enduserId','contacts?$select=telephone1','destcalleridnum','telephone1',']\x20Enduser\x20created!','type','string','nameField','customField','substring','indexOf','content','ticketType','incident','incidents','Subjects','Descriptions','/contacts(','phonecall','phonecalls','assign','getString','queue','callDirection','headers','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','stripTrailingSlash','serverUrl','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','util','./util','md5','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','clientId','remoteUri','username','password','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','Bearer\x20','4.0','value','isNil','email','userEmail'];(function(_0x532a13,_0x6e605){var _0xb2f2a0=function(_0x3188cb){while(--_0x3188cb){_0x532a13['push'](_0x532a13['shift']());}};_0xb2f2a0(++_0x6e605);}(_0x9e3f,0x1bd));var _0xf9e3=function(_0x3ae721,_0x5cde85){_0x3ae721=_0x3ae721-0x0;var _0x488cb0=_0x9e3f[_0x3ae721];return _0x488cb0;};'use strict';var _=require('lodash');var BPromise=require(_0xf9e3('0x0'));var rp=require(_0xf9e3('0x1'));var util=require(_0xf9e3('0x2'));var intUtil=require(_0xf9e3('0x3'));var md5=require(_0xf9e3('0x4'));var Redis=require('ioredis');var logger=require(_0xf9e3('0x5'))(_0xf9e3('0x6'));var config=require(_0xf9e3('0x7'));config['redis']=_[_0xf9e3('0x8')](config[_0xf9e3('0x9')],{'host':_0xf9e3('0xa'),'port':0x18eb});var io=require(_0xf9e3('0xb'))(new Redis(config[_0xf9e3('0x9')]));function getAuthToken(_0xc5eb95,_0x2c1dcf,_0x36aa25){var _0x51c41e={'method':'POST','uri':_0x2c1dcf,'form':{'client_id':_0xc5eb95[_0xf9e3('0xc')],'resource':_0xc5eb95[_0xf9e3('0xd')],'username':_0xc5eb95[_0xf9e3('0xe')],'password':_0xc5eb95[_0xf9e3('0xf')],'grant_type':'password','client_secret':_0xc5eb95['clientSecret']},'json':!![]};return rp(_0x51c41e)[_0xf9e3('0x10')](function(_0x3a75ee){return _0x3a75ee[_0xf9e3('0x11')];})[_0xf9e3('0x12')](function(_0x23d342){logger[_0xf9e3('0x13')]('['+[_0x36aa25[_0xf9e3('0x14')]()]+_0xf9e3('0x15'));return _0x23d342[_0xf9e3('0x16')];});}function getUser(_0x5300bb,_0x4243c8,_0x4c4c7f,_0x5c6d2a,_0x47a345,_0x352e3a){return new BPromise(function(_0xc2e18b,_0x46a79e){return getAuthToken(_0x4243c8,_0x5c6d2a,_0x352e3a)['then'](function(_0x568cd6){var _0x26568d={'method':_0xf9e3('0x17'),'uri':_0x47a345+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xf9e3('0x18')+_0x568cd6,'OData-Version':_0xf9e3('0x19')},'json':!![]};return rp(_0x26568d);})[_0xf9e3('0x10')](function(_0x4421d3){var _0x584d09=_0x4421d3[_0xf9e3('0x1a')];var _0x116492=![];var _0x411105=null;if(!_[_0xf9e3('0x1b')](_0x4c4c7f)){if(intUtil['validateEmail'](_0x4c4c7f[_0xf9e3('0x1c')])){_0x5300bb[_0xf9e3('0x1d')]=_0x4c4c7f[_0xf9e3('0x1c')];for(_0x411105=0x0;_0x411105<_0x584d09['length'];_0x411105++){if(_0x584d09[_0x411105]['internalemailaddress']===_0x4c4c7f[_0xf9e3('0x1c')]&&!_0x584d09[_0x411105][_0xf9e3('0x1e')]){_0x116492=!![];logger['info']('['+[_0x352e3a[_0xf9e3('0x14')]()]+_0xf9e3('0x1f')+_0x584d09[_0x411105][_0xf9e3('0x20')]+'!');_0x5300bb['userId']=_0x584d09[_0x411105]['systemuserid'];}}}}if(!_0x116492){logger[_0xf9e3('0x21')]('['+[_0x352e3a['toUpperCase']()]+_0xf9e3('0x22'));_0x5300bb[_0xf9e3('0x1d')]=_0x4243c8['username'];for(_0x411105=0x0;_0x411105<_0x584d09[_0xf9e3('0x23')];_0x411105++){if(_0x584d09[_0x411105]['internalemailaddress']===_0x4243c8[_0xf9e3('0xe')]){_0x5300bb[_0xf9e3('0x24')]=_0x584d09[_0x411105][_0xf9e3('0x20')];}}}_0xc2e18b(_0x5300bb);})[_0xf9e3('0x12')](function(_0x5e297a){_0x46a79e(_0x5e297a[_0xf9e3('0x16')]);});});}function createEndUser(_0x2104ec,_0x22ac0d,_0x15f4a5,_0x70279c,_0x1b1781,_0x3fddc5){return new BPromise(function(_0x5cc3ab,_0x32bf17){return getAuthToken(_0x22ac0d,_0x15f4a5,_0x3fddc5)[_0xf9e3('0x10')](function(_0x4d0ccd){var _0xfa87e4=_0x3fddc5[_0xf9e3('0x25')]()===_0xf9e3('0x26')?_0x1b1781['destcalleridnum']:_0x1b1781[_0xf9e3('0x27')];var _0x204994={'method':_0xf9e3('0x28'),'uri':_0x70279c+_0xf9e3('0x29'),'body':{'telephone1':_0xfa87e4,'fullname':_0xfa87e4,'firstname':_0xfa87e4,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xf9e3('0x2a')+_0x2104ec[_0xf9e3('0x24')]+')'},'headers':{'Authorization':_0xf9e3('0x18')+_0x4d0ccd,'OData-Version':_0xf9e3('0x19')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x204994);})[_0xf9e3('0x10')](function(_0x339bb1){var _0x13cc83=_0x339bb1['headers'][_0xf9e3('0x2b')];var _0x3f5a9a=_0x13cc83['substring'](_0x13cc83[_0xf9e3('0x2c')]('(')+0x1,_0x13cc83['lastIndexOf'](')'));_0x2104ec[_0xf9e3('0x2d')]=_0x3f5a9a;_0x5cc3ab(_0x2104ec);})[_0xf9e3('0x12')](function(_0x49027c){_0x32bf17(_0x49027c[_0xf9e3('0x16')]);});});}function getEndUser(_0x3a8c35,_0x59dad3,_0x3f7efb,_0x1e5849,_0x30bd9e,_0x587023){return new BPromise(function(_0x406b20,_0x3ae7ff){return getAuthToken(_0x59dad3,_0x3f7efb,_0x587023)[_0xf9e3('0x10')](function(_0x129d4d){var _0x14dad0={'method':'GET','uri':_0x1e5849+_0xf9e3('0x2e'),'headers':{'Authorization':_0xf9e3('0x18')+_0x129d4d,'If-None-Match':null,'OData-Version':_0xf9e3('0x19')},'json':!![]};return rp(_0x14dad0);})[_0xf9e3('0x10')](function(_0x110a23){var _0x58c07e=null;if(_0x110a23){var _0x1f9e9d=_0x110a23['value'];var _0x128dc8=![];for(_0x58c07e=0x0;_0x58c07e<_0x1f9e9d[_0xf9e3('0x23')];_0x58c07e++){var _0x549994=_0x587023[_0xf9e3('0x25')]()===_0xf9e3('0x26')?_0x30bd9e[_0xf9e3('0x2f')]:_0x30bd9e[_0xf9e3('0x27')];if(_0x1f9e9d[_0x58c07e][_0xf9e3('0x30')]===_0x549994){_0x128dc8=!![];_0x3a8c35[_0xf9e3('0x2d')]=_0x1f9e9d[_0x58c07e]['contactid'];}}if(_0x128dc8){_0x406b20(_0x3a8c35);}else{return createEndUser(_0x3a8c35,_0x59dad3,_0x3f7efb,_0x1e5849,_0x30bd9e,_0x587023)[_0xf9e3('0x10')](function(_0x5a558d){logger['info']('['+[_0x587023['toUpperCase']()]+_0xf9e3('0x31'),_0x5a558d[_0xf9e3('0x2d')]);_0x406b20(_0x5a558d);});}}else{return createEndUser(_0x3a8c35,_0x59dad3,_0x3f7efb,_0x1e5849,_0x30bd9e,_0x587023)[_0xf9e3('0x10')](function(_0x3af495){logger[_0xf9e3('0x21')]('['+[_0x587023[_0xf9e3('0x14')]()]+']\x20Enduser\x20Created!',_0x3af495[_0xf9e3('0x2d')]);_0x406b20(_0x3af495);});}});});}function getCustomFields(_0x3acf59,_0x3f6b73,_0x318021){var _0x16f0a4={};if(_0x3acf59[_0xf9e3('0x23')]>0x0){_['forEach'](_0x3acf59,function(_0x41b87d){if(_0x41b87d[_0xf9e3('0x32')]===_0xf9e3('0x33')&&_0x41b87d[_0xf9e3('0x34')]&&!_0x41b87d[_0xf9e3('0x35')]){var _0x2bf7ad=_0x41b87d['idField'][_0xf9e3('0x25')]();var _0x40d0df=_0x2bf7ad['substring'](0x0,_0x2bf7ad['indexOf']('_'));var _0x230d7d=_0x2bf7ad[_0xf9e3('0x36')](_0x2bf7ad[_0xf9e3('0x37')]('_')+0x1);if(_0x40d0df===_0x318021){_0x16f0a4[_0x230d7d]=_0x41b87d[_0xf9e3('0x38')];}}});}return _0x16f0a4;}function getTicket(_0x52a05a,_0x3897f1,_0x54d4ae,_0x193e73,_0x60a6f4,_0xed20e,_0x330bfa){return new BPromise(function(_0x33c165,_0x4e7bbe){var _0x18ba08;return getAuthToken(_0x3897f1,_0x54d4ae,_0x330bfa)[_0xf9e3('0x10')](function(_0x332ece){if(_0xed20e[_0xf9e3('0x39')]===_0xf9e3('0x3a')){_0x18ba08={'method':'POST','uri':_0x193e73+_0xf9e3('0x3b'),'body':Object['assign']({},{'title':intUtil['getString'](_0xed20e[_0xf9e3('0x3c')],_0x60a6f4,'\x20'),'description':intUtil['getString'](_0xed20e[_0xf9e3('0x3d')],_0x60a6f4,'\x0a'),'customerid_contact@odata.bind':_0xf9e3('0x3e')+_0x52a05a[_0xf9e3('0x2d')]+')','ownerid@odata.bind':_0xf9e3('0x2a')+_0x52a05a[_0xf9e3('0x24')]+')','caseorigincode':'1'},getCustomFields(_0xed20e['Fields'],_0x60a6f4,_0xed20e[_0xf9e3('0x39')])),'headers':{'Authorization':_0xf9e3('0x18')+_0x332ece,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0xed20e[_0xf9e3('0x39')]===_0xf9e3('0x3f')){_0x18ba08={'method':'POST','uri':_0x193e73+_0xf9e3('0x40'),'body':Object[_0xf9e3('0x41')]({},{'subject':intUtil['getString'](_0xed20e[_0xf9e3('0x3c')],_0x60a6f4,'\x20'),'phonenumber':String(_0x60a6f4[_0xf9e3('0x27')]),'description':intUtil[_0xf9e3('0x42')](_0xed20e[_0xf9e3('0x3d')],_0x60a6f4,'\x0a'),'regardingobjectid_contact@odata.bind':_0xf9e3('0x3e')+_0x52a05a[_0xf9e3('0x2d')]+')','ownerid@odata.bind':_0xf9e3('0x2a')+_0x52a05a[_0xf9e3('0x24')]+')','directioncode':_0x52a05a['callDirection']===_0xf9e3('0x43')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xf9e3('0x2a')+_0x52a05a[_0xf9e3('0x24')]+')','participationtypemask':_0x52a05a['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x52a05a[_0xf9e3('0x2d')]+')','participationtypemask':_0x52a05a[_0xf9e3('0x44')]==='queue'?0x1:0x2}]},getCustomFields(_0xed20e['Fields'],_0x60a6f4,_0xed20e[_0xf9e3('0x39')])),'headers':{'Authorization':_0xf9e3('0x18')+_0x332ece,'OData-Version':_0xf9e3('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x18ba08);})[_0xf9e3('0x10')](function(_0x4acaa4){var _0x25dfa6=_0x4acaa4[_0xf9e3('0x45')][_0xf9e3('0x2b')];var _0x53f36b=_0x25dfa6[_0xf9e3('0x36')](_0x25dfa6[_0xf9e3('0x2c')]('(')+0x1,_0x25dfa6[_0xf9e3('0x2c')](')'));_0x52a05a['ticketId']=_0x53f36b;_0x33c165(_0x52a05a);})[_0xf9e3('0x12')](function(_0x2b2683){_0x4e7bbe(_0x2b2683['message']);});});}function emit(_0x3243cd,_0x224e66,_0x4e26f3,_0x4f995b){var _0x1fa7c5={'uri':util['format'](_0xf9e3('0x46'),_0x3243cd,_0x4e26f3,_0x4f995b)};io['to'](util[_0xf9e3('0x47')](_0xf9e3('0x48'),_0x224e66))['emit']('trigger:browser:url',_0x1fa7c5);}exports['cs']=function(_0x167b31,_0x1cf137,_0x5d1eb0,_0x150184,_0x32ec5f,_0x52547b,_0x2fa20a,_0x55cfc6){var _0x2b69ee={};_0x52547b['remoteUri']=intUtil[_0xf9e3('0x49')](_0x52547b[_0xf9e3('0xd')]);_0x52547b[_0xf9e3('0x4a')]=intUtil[_0xf9e3('0x49')](_0x52547b[_0xf9e3('0x4a')]);_0x2b69ee[_0xf9e3('0x44')]=_0x55cfc6==='queue'||_0x55cfc6===_0xf9e3('0x4b')?_0xf9e3('0x43'):_0xf9e3('0x26');var _0x8e7de=util[_0xf9e3('0x47')]('%s/api/data/v9.0/',_0x52547b['remoteUri']);var _0x130a2a=util[_0xf9e3('0x47')](_0xf9e3('0x4c'),_0x52547b[_0xf9e3('0x4d')]);var _0x269fc3=util['format'](_0xf9e3('0x4e'),_0x52547b[_0xf9e3('0x4a')],_0x1cf137['uniqueid'],md5(_0x1cf137[_0xf9e3('0x4f')]));if(_0x32ec5f&&_0x32ec5f[_0xf9e3('0x50')]){logger[_0xf9e3('0x21')](_0xf9e3('0x51'),_0xf9e3('0x52'));_0x1cf137[_0xf9e3('0x53')]=_0x269fc3;}else if(_0x2fa20a&&_0x2fa20a[_0xf9e3('0x54')]&&_0x2fa20a[_0xf9e3('0x54')]!=='none'){logger['info'](_0xf9e3('0x55'),'Recording\x20is\x20enabled!');_0x1cf137[_0xf9e3('0x53')]=_0x269fc3;}else{_0x1cf137[_0xf9e3('0x53')]='';}return getUser(_0x2b69ee,_0x52547b,_0x150184,_0x130a2a,_0x8e7de,_0x55cfc6)[_0xf9e3('0x10')](function(_0x5275ba){logger[_0xf9e3('0x21')]('['+_0x55cfc6[_0xf9e3('0x14')]()+_0xf9e3('0x56'),_0x5275ba['userId']);logger[_0xf9e3('0x21')]('['+_0x55cfc6[_0xf9e3('0x14')]()+_0xf9e3('0x57'),_0x5275ba['userEmail']);return getEndUser(_0x5275ba,_0x52547b,_0x130a2a,_0x8e7de,_0x1cf137,_0x55cfc6);})[_0xf9e3('0x10')](function(_0x466826){logger['info']('['+_0x55cfc6[_0xf9e3('0x14')]()+_0xf9e3('0x58'),_0x466826[_0xf9e3('0x2d')]);logger[_0xf9e3('0x21')]('['+_0x55cfc6[_0xf9e3('0x14')]()+_0xf9e3('0x59'),_0x1cf137[_0xf9e3('0x27')]);return getTicket(_0x466826,_0x52547b,_0x130a2a,_0x8e7de,_0x1cf137,_0x5d1eb0,_0x55cfc6);})['then'](function(_0x497b2e){logger['info'](util['format']('['+_0x55cfc6['toUpperCase']()+_0xf9e3('0x5a'),_0x5d1eb0[_0xf9e3('0x39')],_0x497b2e['ticketId']));logger[_0xf9e3('0x21')](util['format']('['+_0x55cfc6['toUpperCase']()+_0xf9e3('0x5b'),_0x55cfc6));if(_0x55cfc6!==_0xf9e3('0x4b')){logger[_0xf9e3('0x21')]('['+_0x55cfc6[_0xf9e3('0x14')]()+']',_0xf9e3('0x5c'));emit(_0x52547b[_0xf9e3('0xd')],_0x150184['name'],_0x5d1eb0[_0xf9e3('0x39')],_0x497b2e['ticketId']);}})[_0xf9e3('0x12')](function(_0x3c7f0b){logger['error']('['+_0x55cfc6[_0xf9e3('0x14')]()+_0xf9e3('0x5d'),util[_0xf9e3('0x5e')](_0x3c7f0b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5873=['util','./util','md5','ioredis','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','destcalleridnum','calleridnum','headers','odata-entityid','substring','lastIndexOf','enduserId','GET','contacts?$select=telephone1','outbound','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','type','string','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','Subjects','getString','Descriptions','/contacts(','/systemusers(','Fields','phonecall','phonecalls','callDirection','queue','format','user:%s','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','tenantId','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','ticketId',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird'];(function(_0x5d0fba,_0x27b4d4){var _0x5df007=function(_0x30496a){while(--_0x30496a){_0x5d0fba['push'](_0x5d0fba['shift']());}};_0x5df007(++_0x27b4d4);}(_0x5873,0x127));var _0x3587=function(_0x25dde7,_0x37a474){_0x25dde7=_0x25dde7-0x0;var _0x4911c3=_0x5873[_0x25dde7];return _0x4911c3;};'use strict';var _=require(_0x3587('0x0'));var BPromise=require(_0x3587('0x1'));var rp=require('request-promise');var util=require(_0x3587('0x2'));var intUtil=require(_0x3587('0x3'));var md5=require(_0x3587('0x4'));var Redis=require(_0x3587('0x5'));var logger=require(_0x3587('0x6'))('dynamics365');var config=require('../../../../config/environment');config['redis']=_[_0x3587('0x7')](config[_0x3587('0x8')],{'host':_0x3587('0x9'),'port':0x18eb});var io=require(_0x3587('0xa'))(new Redis(config[_0x3587('0x8')]));function getAuthToken(_0x13b59c,_0x513cf4,_0x4388a0){var _0x1a8f6f={'method':_0x3587('0xb'),'uri':_0x513cf4,'form':{'client_id':_0x13b59c[_0x3587('0xc')],'resource':_0x13b59c[_0x3587('0xd')],'username':_0x13b59c[_0x3587('0xe')],'password':_0x13b59c[_0x3587('0xf')],'grant_type':_0x3587('0xf'),'client_secret':_0x13b59c[_0x3587('0x10')]},'json':!![]};return rp(_0x1a8f6f)[_0x3587('0x11')](function(_0x462fae){return _0x462fae[_0x3587('0x12')];})[_0x3587('0x13')](function(_0x52c86b){logger[_0x3587('0x14')]('['+[_0x4388a0[_0x3587('0x15')]()]+_0x3587('0x16'));return _0x52c86b[_0x3587('0x17')];});}function getUser(_0x2b9a31,_0x110c13,_0x3340f3,_0x4d25f1,_0x832789,_0x4bbf4c){return new BPromise(function(_0x351c20,_0x4af267){return getAuthToken(_0x110c13,_0x4d25f1,_0x4bbf4c)['then'](function(_0xd0eb7d){var _0x221fd1={'method':'GET','uri':_0x832789+_0x3587('0x18'),'headers':{'Authorization':_0x3587('0x19')+_0xd0eb7d,'OData-Version':_0x3587('0x1a')},'json':!![]};return rp(_0x221fd1);})['then'](function(_0xac6e54){var _0x2b5221=_0xac6e54[_0x3587('0x1b')];var _0x5577ba=![];var _0x3608ee=null;if(!_[_0x3587('0x1c')](_0x3340f3)){if(intUtil[_0x3587('0x1d')](_0x3340f3[_0x3587('0x1e')])){_0x2b9a31[_0x3587('0x1f')]=_0x3340f3[_0x3587('0x1e')];for(_0x3608ee=0x0;_0x3608ee<_0x2b5221[_0x3587('0x20')];_0x3608ee++){if(_0x2b5221[_0x3608ee][_0x3587('0x21')]===_0x3340f3[_0x3587('0x1e')]&&!_0x2b5221[_0x3608ee][_0x3587('0x22')]){_0x5577ba=!![];logger[_0x3587('0x23')]('['+[_0x4bbf4c[_0x3587('0x15')]()]+']\x20Agent\x20found\x20'+_0x2b5221[_0x3608ee][_0x3587('0x24')]+'!');_0x2b9a31[_0x3587('0x25')]=_0x2b5221[_0x3608ee][_0x3587('0x24')];}}}}if(!_0x5577ba){logger[_0x3587('0x23')]('['+[_0x4bbf4c['toUpperCase']()]+_0x3587('0x26'));_0x2b9a31[_0x3587('0x1f')]=_0x110c13[_0x3587('0xe')];for(_0x3608ee=0x0;_0x3608ee<_0x2b5221[_0x3587('0x20')];_0x3608ee++){if(_0x2b5221[_0x3608ee][_0x3587('0x21')]===_0x110c13[_0x3587('0xe')]){_0x2b9a31[_0x3587('0x25')]=_0x2b5221[_0x3608ee][_0x3587('0x24')];}}}_0x351c20(_0x2b9a31);})['catch'](function(_0x2a6f07){_0x4af267(_0x2a6f07['message']);});});}function createEndUser(_0x495780,_0x148041,_0x1a4f89,_0x4ec8ff,_0x40bfcf,_0x4a2c17){return new BPromise(function(_0x53da73,_0xff8b2e){return getAuthToken(_0x148041,_0x1a4f89,_0x4a2c17)[_0x3587('0x11')](function(_0x24f81e){var _0x3eab96=_0x4a2c17[_0x3587('0x27')]()==='outbound'?_0x40bfcf[_0x3587('0x28')]:_0x40bfcf[_0x3587('0x29')];var _0x4202f8={'method':_0x3587('0xb'),'uri':_0x4ec8ff+'contacts','body':{'telephone1':_0x3eab96,'fullname':_0x3eab96,'firstname':_0x3eab96,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x495780[_0x3587('0x25')]+')'},'headers':{'Authorization':_0x3587('0x19')+_0x24f81e,'OData-Version':_0x3587('0x1a')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x4202f8);})['then'](function(_0x1f5156){var _0x98d4a0=_0x1f5156[_0x3587('0x2a')][_0x3587('0x2b')];var _0x43d167=_0x98d4a0[_0x3587('0x2c')](_0x98d4a0['lastIndexOf']('(')+0x1,_0x98d4a0[_0x3587('0x2d')](')'));_0x495780[_0x3587('0x2e')]=_0x43d167;_0x53da73(_0x495780);})[_0x3587('0x13')](function(_0x2fc6c0){_0xff8b2e(_0x2fc6c0[_0x3587('0x17')]);});});}function getEndUser(_0x4b0ccb,_0x5e3381,_0x4a9fea,_0xc6965c,_0x5d5d0b,_0x33392a){return new BPromise(function(_0xfc941a,_0x1bc46e){return getAuthToken(_0x5e3381,_0x4a9fea,_0x33392a)[_0x3587('0x11')](function(_0x580bc0){var _0x2c963c={'method':_0x3587('0x2f'),'uri':_0xc6965c+_0x3587('0x30'),'headers':{'Authorization':_0x3587('0x19')+_0x580bc0,'If-None-Match':null,'OData-Version':_0x3587('0x1a')},'json':!![]};return rp(_0x2c963c);})[_0x3587('0x11')](function(_0x218c5a){var _0x5a56a1=null;if(_0x218c5a){var _0x3a4f16=_0x218c5a[_0x3587('0x1b')];var _0x238e60=![];for(_0x5a56a1=0x0;_0x5a56a1<_0x3a4f16['length'];_0x5a56a1++){var _0x4e3a4d=_0x33392a[_0x3587('0x27')]()===_0x3587('0x31')?_0x5d5d0b[_0x3587('0x28')]:_0x5d5d0b[_0x3587('0x29')];if(_0x3a4f16[_0x5a56a1][_0x3587('0x32')]===_0x4e3a4d){_0x238e60=!![];_0x4b0ccb[_0x3587('0x2e')]=_0x3a4f16[_0x5a56a1][_0x3587('0x33')];}}if(_0x238e60){_0xfc941a(_0x4b0ccb);}else{return createEndUser(_0x4b0ccb,_0x5e3381,_0x4a9fea,_0xc6965c,_0x5d5d0b,_0x33392a)[_0x3587('0x11')](function(_0x166055){logger['info']('['+[_0x33392a[_0x3587('0x15')]()]+_0x3587('0x34'),_0x166055[_0x3587('0x2e')]);_0xfc941a(_0x166055);});}}else{return createEndUser(_0x4b0ccb,_0x5e3381,_0x4a9fea,_0xc6965c,_0x5d5d0b,_0x33392a)[_0x3587('0x11')](function(_0x5f2faf){logger[_0x3587('0x23')]('['+[_0x33392a[_0x3587('0x15')]()]+_0x3587('0x35'),_0x5f2faf['enduserId']);_0xfc941a(_0x5f2faf);});}});});}function getCustomFields(_0x481f64,_0x1b2796,_0x417d4d){var _0x26c08b={};if(_0x481f64[_0x3587('0x20')]>0x0){_['forEach'](_0x481f64,function(_0x3d336a){if(_0x3d336a[_0x3587('0x36')]===_0x3587('0x37')&&_0x3d336a[_0x3587('0x38')]&&!_0x3d336a[_0x3587('0x39')]){var _0x1ada26=_0x3d336a[_0x3587('0x3a')][_0x3587('0x27')]();var _0x57817c=_0x1ada26[_0x3587('0x2c')](0x0,_0x1ada26['indexOf']('_'));var _0xe7b2bf=_0x1ada26[_0x3587('0x2c')](_0x1ada26[_0x3587('0x3b')]('_')+0x1);if(_0x57817c===_0x417d4d){_0x26c08b[_0xe7b2bf]=_0x3d336a[_0x3587('0x3c')];}}});}return _0x26c08b;}function getTicket(_0x25b54a,_0x4e0d41,_0x4d212b,_0x2258d8,_0x14eff8,_0x306cb9,_0x527aaa){return new BPromise(function(_0x10f999,_0x4bf4b4){var _0x113148;return getAuthToken(_0x4e0d41,_0x4d212b,_0x527aaa)[_0x3587('0x11')](function(_0x192cf3){if(_0x306cb9[_0x3587('0x3d')]===_0x3587('0x3e')){_0x113148={'method':_0x3587('0xb'),'uri':_0x2258d8+_0x3587('0x3f'),'body':Object[_0x3587('0x40')]({},{'title':intUtil['getString'](_0x306cb9[_0x3587('0x41')],_0x14eff8,'\x20'),'description':intUtil[_0x3587('0x42')](_0x306cb9[_0x3587('0x43')],_0x14eff8,'\x0a'),'customerid_contact@odata.bind':_0x3587('0x44')+_0x25b54a['enduserId']+')','ownerid@odata.bind':_0x3587('0x45')+_0x25b54a[_0x3587('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x306cb9[_0x3587('0x46')],_0x14eff8,_0x306cb9[_0x3587('0x3d')])),'headers':{'Authorization':_0x3587('0x19')+_0x192cf3,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x306cb9[_0x3587('0x3d')]===_0x3587('0x47')){_0x113148={'method':_0x3587('0xb'),'uri':_0x2258d8+_0x3587('0x48'),'body':Object[_0x3587('0x40')]({},{'subject':intUtil[_0x3587('0x42')](_0x306cb9[_0x3587('0x41')],_0x14eff8,'\x20'),'phonenumber':String(_0x14eff8['calleridnum']),'description':intUtil[_0x3587('0x42')](_0x306cb9[_0x3587('0x43')],_0x14eff8,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3587('0x44')+_0x25b54a[_0x3587('0x2e')]+')','ownerid@odata.bind':_0x3587('0x45')+_0x25b54a[_0x3587('0x25')]+')','directioncode':_0x25b54a[_0x3587('0x49')]===_0x3587('0x4a')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x3587('0x45')+_0x25b54a['userId']+')','participationtypemask':_0x25b54a[_0x3587('0x49')]===_0x3587('0x4a')?0x2:0x1},{'partyid_contact@odata.bind':_0x3587('0x44')+_0x25b54a['enduserId']+')','participationtypemask':_0x25b54a['callDirection']==='queue'?0x1:0x2}]},getCustomFields(_0x306cb9['Fields'],_0x14eff8,_0x306cb9[_0x3587('0x3d')])),'headers':{'Authorization':'Bearer\x20'+_0x192cf3,'OData-Version':_0x3587('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x113148);})[_0x3587('0x11')](function(_0x5bf735){var _0x4ad297=_0x5bf735[_0x3587('0x2a')][_0x3587('0x2b')];var _0x5f1e2b=_0x4ad297[_0x3587('0x2c')](_0x4ad297[_0x3587('0x2d')]('(')+0x1,_0x4ad297[_0x3587('0x2d')](')'));_0x25b54a['ticketId']=_0x5f1e2b;_0x10f999(_0x25b54a);})[_0x3587('0x13')](function(_0x57f7e3){_0x4bf4b4(_0x57f7e3['message']);});});}function emit(_0x52e3e2,_0x57e984,_0x470684,_0xde6735){var _0x4dd1f3={'uri':util[_0x3587('0x4b')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x52e3e2,_0x470684,_0xde6735)};io['to'](util[_0x3587('0x4b')](_0x3587('0x4c'),_0x57e984))['emit']('trigger:browser:url',_0x4dd1f3);}exports['cs']=function(_0x56d3dd,_0x5ea5f4,_0x155415,_0x19e347,_0x12d220,_0x5cbd7e,_0x16807e,_0x29da69){var _0x370a07={};_0x5cbd7e[_0x3587('0xd')]=intUtil['stripTrailingSlash'](_0x5cbd7e[_0x3587('0xd')]);_0x5cbd7e['serverUrl']=intUtil[_0x3587('0x4d')](_0x5cbd7e[_0x3587('0x4e')]);_0x370a07['callDirection']=_0x29da69===_0x3587('0x4a')||_0x29da69===_0x3587('0x4f')?'queue':_0x3587('0x31');var _0xb2f480=util[_0x3587('0x4b')](_0x3587('0x50'),_0x5cbd7e[_0x3587('0xd')]);var _0x2222bd=util[_0x3587('0x4b')]('https://login.microsoftonline.com/%s/oauth2/token',_0x5cbd7e[_0x3587('0x51')]);var _0x3d7f24=util[_0x3587('0x4b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5cbd7e[_0x3587('0x4e')],_0x5ea5f4[_0x3587('0x52')],md5(_0x5ea5f4['uniqueid']));if(_0x12d220&&_0x12d220[_0x3587('0x53')]){logger[_0x3587('0x23')]('[QUEUE]',_0x3587('0x54'));_0x5ea5f4['recordingURL']=_0x3d7f24;}else if(_0x16807e&&_0x16807e[_0x3587('0x55')]&&_0x16807e[_0x3587('0x55')]!=='none'){logger[_0x3587('0x23')](_0x3587('0x56'),_0x3587('0x54'));_0x5ea5f4['recordingURL']=_0x3d7f24;}else{_0x5ea5f4[_0x3587('0x57')]='';}return getUser(_0x370a07,_0x5cbd7e,_0x19e347,_0x2222bd,_0xb2f480,_0x29da69)[_0x3587('0x11')](function(_0x268e01){logger['info']('['+_0x29da69[_0x3587('0x15')]()+_0x3587('0x58'),_0x268e01[_0x3587('0x25')]);logger[_0x3587('0x23')]('['+_0x29da69[_0x3587('0x15')]()+_0x3587('0x59'),_0x268e01['userEmail']);return getEndUser(_0x268e01,_0x5cbd7e,_0x2222bd,_0xb2f480,_0x5ea5f4,_0x29da69);})[_0x3587('0x11')](function(_0x50dd70){logger['info']('['+_0x29da69[_0x3587('0x15')]()+_0x3587('0x5a'),_0x50dd70[_0x3587('0x2e')]);logger[_0x3587('0x23')]('['+_0x29da69[_0x3587('0x15')]()+_0x3587('0x5b'),_0x5ea5f4['calleridnum']);return getTicket(_0x50dd70,_0x5cbd7e,_0x2222bd,_0xb2f480,_0x5ea5f4,_0x155415,_0x29da69);})[_0x3587('0x11')](function(_0x12c525){logger[_0x3587('0x23')](util[_0x3587('0x4b')]('['+_0x29da69[_0x3587('0x15')]()+_0x3587('0x5c'),_0x155415['ticketType'],_0x12c525['ticketId']));logger[_0x3587('0x23')](util[_0x3587('0x4b')]('['+_0x29da69[_0x3587('0x15')]()+_0x3587('0x5d'),_0x29da69));if(_0x29da69!==_0x3587('0x4f')){logger[_0x3587('0x23')]('['+_0x29da69['toUpperCase']()+']',_0x3587('0x5e'));emit(_0x5cbd7e['remoteUri'],_0x19e347[_0x3587('0x5f')],_0x155415[_0x3587('0x3d')],_0x12c525[_0x3587('0x60')]);}})[_0x3587('0x13')](function(_0x38e8ca){logger[_0x3587('0x14')]('['+_0x29da69['toUpperCase']()+_0x3587('0x61'),util[_0x3587('0x62')](_0x38e8ca,{'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 83f38a3..0dc3f5b 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 _0x0524=['find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','type','string','nameField','content','idField','customField','push','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridnum','The\x20Ticket\x20ID\x20is:','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','then','length','Agent\x20found!','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\x20found!'];(function(_0x5b8a68,_0x53e48d){var _0x50b7a5=function(_0x1db8d1){while(--_0x1db8d1){_0x5b8a68['push'](_0x5b8a68['shift']());}};_0x50b7a5(++_0x53e48d);}(_0x0524,0xf3));var _0x4052=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x0524[_0x1abb09];return _0xea1c07;};'use strict';var _=require(_0x4052('0x0'));var rp=require(_0x4052('0x1'));var md5=require(_0x4052('0x2'));var util=require(_0x4052('0x3'));var Redis=require(_0x4052('0x4'));var intUtil=require(_0x4052('0x5'));var config=require(_0x4052('0x6'));var logger=require(_0x4052('0x7'))(_0x4052('0x8'));config[_0x4052('0x9')]=_['defaults'](config[_0x4052('0x9')],{'host':_0x4052('0xa'),'port':0x18eb});var io=require(_0x4052('0xb'))(new Redis(config[_0x4052('0x9')]));var headers={'Content-Type':'application/json','Accept':_0x4052('0xc')};function emit(_0x2a1e14,_0x198c1d,_0x1b4a97){io['to'](_0x2a1e14)[_0x4052('0xd')](_0x198c1d,_0x1b4a97);}function getTicket(_0x2cb83b,_0x4cce17,_0x3579fd,_0x985797,_0x5d7275){logger['info'](_0x4052('0xe'));var _0x39e243=_[_0x4052('0xf')]({'responder_id':_0x4cce17['id'],'requester_id':_0x3579fd['id'],'name':util[_0x4052('0x10')](_0x4052('0x11'),_0x5d7275[_0x4052('0x12')]),'phone':_0x5d7275[_0x4052('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x985797[_0x4052('0x14')],_0x5d7275,'\x20'),'description':intUtil['getString'](_0x985797[_0x4052('0x15')],_0x5d7275,_0x4052('0x16')),'tags':getTags(_0x985797[_0x4052('0x17')],_0x4052('0x18'))},getCustomFields(_0x985797[_0x4052('0x19')],_0x5d7275));_0x39e243[_0x4052('0x1a')]=_[_0x4052('0x1b')](_[_0x4052('0x1c')](_0x39e243['custom_fields'],'id'),_0x4052('0x1d'));return request({'uri':util[_0x4052('0x10')](_0x4052('0x1e'),_0x2cb83b['remoteUri']),'method':'POST','body':_0x39e243})['then'](function(_0x246c83){logger[_0x4052('0x1f')](_0x4052('0x20'));return _0x246c83;});}function getUser(_0x452c71,_0x5ec14d){if(intUtil[_0x4052('0x21')](_0x5ec14d)){return request({'uri':util[_0x4052('0x10')](_0x4052('0x22'),_0x452c71[_0x4052('0x23')]),'qs':{'email':_0x5ec14d}})[_0x4052('0x24')](function(_0x2e9ebf){if(_0x2e9ebf[_0x4052('0x25')]){logger[_0x4052('0x1f')](_0x4052('0x26'));return _['find'](_0x2e9ebf,function(_0xe21cc1){return _0xe21cc1[_0x4052('0x27')][_0x4052('0x28')]===_0x5ec14d;});}else{logger[_0x4052('0x1f')](_0x4052('0x29'));return request({'uri':util[_0x4052('0x10')](_0x4052('0x2a'),_0x452c71[_0x4052('0x23')])})[_0x4052('0x24')](function(_0xcffaec){logger['info']('Admin\x20account\x20selected.');return _0xcffaec;});}});}else{logger[_0x4052('0x1f')](_0x4052('0x2b'));return request({'uri':util[_0x4052('0x10')](_0x4052('0x2a'),_0x452c71[_0x4052('0x23')])})['then'](function(_0x4c9f8b){logger[_0x4052('0x1f')](_0x4052('0x2c'));return _0x4c9f8b;});}}function getEndUser(_0x5036cf,_0x2311b1,_0x4941ee){logger['info'](_0x4052('0x2d'),_0x4941ee);return request({'uri':util['format'](_0x4052('0x2e'),_0x5036cf[_0x4052('0x23')]),'qs':{'phone':_0x4941ee}})[_0x4052('0x24')](function(_0xce7590){if(_0xce7590[_0x4052('0x25')]){logger['info'](_0x4052('0x2f'));return _[_0x4052('0x30')](_0xce7590,{'phone':_0x4941ee});}else{logger[_0x4052('0x1f')](_0x4052('0x31'));return request({'uri':util[_0x4052('0x10')](_0x4052('0x2e'),_0x5036cf[_0x4052('0x23')]),'method':_0x4052('0x32'),'body':{'name':_0x2311b1,'phone':_0x4941ee}})[_0x4052('0x24')](function(_0x1fb282){logger[_0x4052('0x1f')](_0x4052('0x33'));return _0x1fb282;});}});}function getAuth(_0x385bab){return util[_0x4052('0x10')](_0x4052('0x34'),new Buffer(_0x385bab[_0x4052('0x35')]+':X')[_0x4052('0x36')](_0x4052('0x37')));}function request(_0x321a38){logger[_0x4052('0x38')](_0x4052('0x39'),JSON[_0x4052('0x3a')](_0x321a38));return rp(_['defaults'](_0x321a38,{'method':_0x4052('0x3b'),'headers':headers,'json':!![]}));}function getTags(_0x37e64f,_0x28c5b3){var _0x17e76c=[];if(_0x37e64f&&_0x37e64f[_0x4052('0x25')]>0x0){_0x17e76c=_[_0x4052('0x3c')](_0x37e64f,_0x28c5b3);}return _0x17e76c;}function getCustomFields(_0x46ce52,_0x2e3202){var _0x3b3dd7=[];var _0x2b482f={'custom_fields':[]};if(_0x46ce52[_0x4052('0x25')]>0x0){_[_0x4052('0x3d')](_0x46ce52,function(_0x51fc31){if(_0x51fc31[_0x4052('0x3e')]===_0x4052('0x3f')&&_0x51fc31[_0x4052('0x40')]&&!_0x51fc31['customField']){_0x2b482f[_0x51fc31[_0x4052('0x40')]['toLowerCase']()]=_0x51fc31[_0x4052('0x41')][_0x4052('0x36')]();}else if(_0x51fc31[_0x4052('0x3e')]===_0x4052('0x3f')&&_0x51fc31[_0x4052('0x42')]&&_0x51fc31[_0x4052('0x43')]){_0x2b482f[_0x4052('0x1a')][_0x4052('0x44')]({'id':_0x51fc31[_0x4052('0x42')],'value':_0x51fc31[_0x4052('0x41')][_0x4052('0x36')]()});}else if(_0x51fc31[_0x4052('0x3e')]==='variable'&&_0x51fc31[_0x4052('0x45')]&&_0x51fc31[_0x4052('0x42')]&&_0x51fc31[_0x4052('0x43')]){_0x2e3202[_0x51fc31[_0x4052('0x45')]]&&_0x2b482f['custom_fields']['push']({'id':_0x51fc31[_0x4052('0x42')],'value':_0x2e3202[_0x51fc31[_0x4052('0x45')]]['toString']()});}else if(_0x51fc31[_0x4052('0x3e')]===_0x4052('0x46')&&_0x51fc31[_0x4052('0x47')]&&_0x51fc31[_0x4052('0x47')][_0x4052('0x18')]&&_0x51fc31[_0x4052('0x42')]&&_0x51fc31[_0x4052('0x43')]){_0x2e3202[_0x51fc31[_0x4052('0x47')][_0x4052('0x18')][_0x4052('0x48')]()]&&_0x2b482f[_0x4052('0x1a')][_0x4052('0x44')]({'id':_0x51fc31['idField'],'value':_0x2e3202[_0x51fc31[_0x4052('0x47')][_0x4052('0x18')][_0x4052('0x48')]()]['toString']()});}});}return _0x2b482f;}exports[_0x4052('0x49')]=function(_0x4c78e6,_0x4d5db8,_0x3b56a3,_0x2a44f8,_0x762071,_0x58c481){var _0xc0916d,_0xdf7161;_0x58c481[_0x4052('0x23')]=intUtil[_0x4052('0x4a')](_0x58c481[_0x4052('0x23')]);_0x58c481[_0x4052('0x4b')]=intUtil['stripTrailingSlash'](_0x58c481[_0x4052('0x4b')]);if(_0x762071&&_0x762071['monitor_format']){logger[_0x4052('0x1f')](_0x4052('0x4c'),_0x4052('0x4d'));_0x4d5db8['recordingURL']=util['format'](_0x4052('0x4e'),_0x58c481[_0x4052('0x4b')],_0x4d5db8[_0x4052('0x4f')],md5(_0x4d5db8[_0x4052('0x4f')]));}else{_0x4d5db8[_0x4052('0x50')]='';}headers[_0x4052('0x51')]=getAuth(_0x58c481);return getUser(_0x58c481,_0x2a44f8[_0x4052('0x28')])['then'](function(_0x45c7b8){_0xc0916d=_0x45c7b8;logger[_0x4052('0x1f')]('The\x20User\x20ID\x20is:',_0xc0916d['id']);return getEndUser(_0x58c481,_0x4d5db8['calleridname'],_0x4d5db8['calleridnum']);})[_0x4052('0x24')](function(_0x4f7185){_0xdf7161=_0x4f7185;logger[_0x4052('0x1f')](_0x4052('0x52'),_0xdf7161['id']);return getTicket(_0x58c481,_0xc0916d,_0xdf7161,_0x3b56a3,_0x4d5db8);})[_0x4052('0x24')](function(_0x1afc87){if(_0x1afc87&&_0x1afc87['id']){logger[_0x4052('0x1f')](_0x4052('0x20'));logger[_0x4052('0x1f')]('The\x20Ticket\x20ID\x20is:',_0x1afc87['id']);logger[_0x4052('0x1f')](_0x4052('0x4c'),_0x4052('0x53'));emit(util[_0x4052('0x10')](_0x4052('0x54'),_0x2a44f8[_0x4052('0x18')]),_0x4052('0x55'),{'uri':util[_0x4052('0x10')](_0x4052('0x56'),_0x58c481['remoteUri'],_0x1afc87['id'])});}})[_0x4052('0x57')](function(_0x2d24c7){logger[_0x4052('0x58')](_0x4052('0x4c'),JSON['stringify'](_0x2d24c7));});};exports[_0x4052('0x59')]=function(_0x16b9c4,_0x252111,_0x19e3e7,_0x51a41b,_0x7da0ee,_0x5e23ce,_0x182b49){var _0x480977,_0x32e3f4;_0x5e23ce[_0x4052('0x23')]=intUtil[_0x4052('0x4a')](_0x5e23ce['remoteUri']);_0x5e23ce[_0x4052('0x4b')]=intUtil['stripTrailingSlash'](_0x5e23ce[_0x4052('0x4b')]);if(_0x182b49&&_0x182b49[_0x4052('0x5a')]&&_0x182b49['recordingFormat']!=='none'){logger['info'](_0x4052('0x5b'),_0x4052('0x4d'));_0x252111[_0x4052('0x50')]=util['format'](_0x4052('0x4e'),_0x5e23ce[_0x4052('0x4b')],_0x252111[_0x4052('0x4f')],md5(_0x252111[_0x4052('0x4f')]));}headers[_0x4052('0x51')]=getAuth(_0x5e23ce);return getUser(_0x5e23ce,_0x51a41b[_0x4052('0x28')])[_0x4052('0x24')](function(_0x4ced66){_0x480977=_0x4ced66;logger[_0x4052('0x1f')](_0x4052('0x5c'),_0x480977['id']);return getEndUser(_0x5e23ce,_0x252111['destcalleridname'],_0x252111[_0x4052('0x5d')]);})[_0x4052('0x24')](function(_0x2e841d){_0x32e3f4=_0x2e841d;logger[_0x4052('0x1f')](_0x4052('0x52'),_0x32e3f4['id']);return getTicket(_0x5e23ce,_0x480977,_0x32e3f4,_0x19e3e7,_0x252111);})[_0x4052('0x24')](function(_0x5b447c){if(_0x5b447c&&_0x5b447c['id']){logger[_0x4052('0x1f')](_0x4052('0x20'));logger['info'](_0x4052('0x5e'),_0x5b447c['id']);logger['info'](_0x4052('0x5b'),_0x4052('0x53'));emit(util[_0x4052('0x10')](_0x4052('0x54'),_0x51a41b['name']),_0x4052('0x55'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x5e23ce['remoteUri'],_0x5b447c['id'])});}})['catch'](function(_0x412000){logger[_0x4052('0x58')]('[OUTBOUND]',JSON[_0x4052('0x3a')](_0x412000));});};exports['unmanaged']=function(_0x274f75,_0x5ad255,_0x3a7f4f,_0x4e47d0,_0x4ef871,_0x1f3b40){var _0xf77600,_0x3c8388;_0x1f3b40[_0x4052('0x23')]=intUtil[_0x4052('0x4a')](_0x1f3b40[_0x4052('0x23')]);_0x1f3b40['serverUrl']=intUtil[_0x4052('0x4a')](_0x1f3b40['serverUrl']);if(_0x4ef871&&_0x4ef871['monitor_format']){logger[_0x4052('0x1f')]('['+_0x5ad255[_0x4052('0x5f')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x5ad255[_0x4052('0x50')]=util[_0x4052('0x10')](_0x4052('0x4e'),_0x1f3b40[_0x4052('0x4b')],_0x5ad255[_0x4052('0x4f')],md5(_0x5ad255[_0x4052('0x4f')]));}else{_0x5ad255[_0x4052('0x50')]='';}headers[_0x4052('0x51')]=getAuth(_0x1f3b40);return getUser(_0x1f3b40,'')['then'](function(_0x550b3e){_0xf77600=_0x550b3e;logger[_0x4052('0x1f')](_0x4052('0x5c'),_0xf77600['id']);return getEndUser(_0x1f3b40,_0x5ad255['calleridname'],_0x5ad255[_0x4052('0x13')]);})[_0x4052('0x24')](function(_0x274f99){_0x3c8388=_0x274f99;logger[_0x4052('0x1f')](_0x4052('0x52'),_0x3c8388['id']);return getTicket(_0x1f3b40,_0xf77600,_0x3c8388,_0x3a7f4f,_0x5ad255);})[_0x4052('0x24')](function(_0x4435ca){if(_0x4435ca){logger[_0x4052('0x1f')]('Ticket\x20created!');logger[_0x4052('0x1f')](_0x4052('0x5e'),_0x4435ca['id']);}})['catch'](function(_0x20f23e){logger['error']('['+_0x5ad255[_0x4052('0x5f')][_0x4052('0x60')]()+']',JSON[_0x4052('0x3a')](_0x20f23e));});}; \ No newline at end of file +var _0xdee9=['Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','getString','Descriptions','
','name','Fields','custom_fields','keyBy','remoteUri','POST','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','length','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','base64','[HTTP]','stringify','defaults','GET','map','type','string','nameField','customField','toLowerCase','content','toString','idField','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridnum','[OUTBOUND]','trigger:browser:url','unmanaged','lastevent','toUpperCase','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info'];(function(_0x50fd8d,_0x4b0f88){var _0x2f6d49=function(_0x313671){while(--_0x313671){_0x50fd8d['push'](_0x50fd8d['shift']());}};_0x2f6d49(++_0x4b0f88);}(_0xdee9,0x1aa));var _0x9dee=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0xdee9[_0x75f869];return _0x10af8b;};'use strict';var _=require(_0x9dee('0x0'));var rp=require('request-promise');var md5=require(_0x9dee('0x1'));var util=require(_0x9dee('0x2'));var Redis=require(_0x9dee('0x3'));var intUtil=require(_0x9dee('0x4'));var config=require(_0x9dee('0x5'));var logger=require(_0x9dee('0x6'))(_0x9dee('0x7'));config['redis']=_['defaults'](config[_0x9dee('0x8')],{'host':_0x9dee('0x9'),'port':0x18eb});var io=require(_0x9dee('0xa'))(new Redis(config['redis']));var headers={'Content-Type':_0x9dee('0xb'),'Accept':'application/json'};function emit(_0x1b876a,_0x5a3664,_0x2f06e6){io['to'](_0x1b876a)[_0x9dee('0xc')](_0x5a3664,_0x2f06e6);}function getTicket(_0x71e60a,_0x4e808a,_0x17dc95,_0x3ffb08,_0x5befb7){logger[_0x9dee('0xd')](_0x9dee('0xe'));var _0x5a7d57=_[_0x9dee('0xf')]({'responder_id':_0x4e808a['id'],'requester_id':_0x17dc95['id'],'name':util[_0x9dee('0x10')](_0x9dee('0x11'),_0x5befb7[_0x9dee('0x12')]),'phone':_0x5befb7['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x9dee('0x13')](_0x3ffb08['Subjects'],_0x5befb7,'\x20'),'description':intUtil['getString'](_0x3ffb08[_0x9dee('0x14')],_0x5befb7,_0x9dee('0x15')),'tags':getTags(_0x3ffb08['Tags'],_0x9dee('0x16'))},getCustomFields(_0x3ffb08[_0x9dee('0x17')],_0x5befb7));_0x5a7d57[_0x9dee('0x18')]=_['mapValues'](_[_0x9dee('0x19')](_0x5a7d57[_0x9dee('0x18')],'id'),'value');return request({'uri':util[_0x9dee('0x10')]('%s/api/v2/tickets',_0x71e60a[_0x9dee('0x1a')]),'method':_0x9dee('0x1b'),'body':_0x5a7d57})['then'](function(_0x22a03d){logger[_0x9dee('0xd')](_0x9dee('0x1c'));return _0x22a03d;});}function getUser(_0x5d5580,_0x14851e){if(intUtil[_0x9dee('0x1d')](_0x14851e)){return request({'uri':util[_0x9dee('0x10')](_0x9dee('0x1e'),_0x5d5580['remoteUri']),'qs':{'email':_0x14851e}})[_0x9dee('0x1f')](function(_0x5a455f){if(_0x5a455f[_0x9dee('0x20')]){logger[_0x9dee('0xd')]('Agent\x20found!');return _[_0x9dee('0x21')](_0x5a455f,function(_0x252eb1){return _0x252eb1['contact']['email']===_0x14851e;});}else{logger['info'](_0x9dee('0x22'));return request({'uri':util[_0x9dee('0x10')](_0x9dee('0x23'),_0x5d5580[_0x9dee('0x1a')])})[_0x9dee('0x1f')](function(_0x3c3d5a){logger[_0x9dee('0xd')]('Admin\x20account\x20selected.');return _0x3c3d5a;});}});}else{logger[_0x9dee('0xd')](_0x9dee('0x24'));return request({'uri':util[_0x9dee('0x10')](_0x9dee('0x23'),_0x5d5580[_0x9dee('0x1a')])})[_0x9dee('0x1f')](function(_0x11855){logger['info'](_0x9dee('0x25'));return _0x11855;});}}function getEndUser(_0x41b326,_0x359a60,_0x5c0ca5){logger[_0x9dee('0xd')]('Searching\x20enduser\x20with\x20phone',_0x5c0ca5);return request({'uri':util[_0x9dee('0x10')](_0x9dee('0x26'),_0x41b326[_0x9dee('0x1a')]),'qs':{'phone':_0x5c0ca5}})[_0x9dee('0x1f')](function(_0x36f6fb){if(_0x36f6fb[_0x9dee('0x20')]){logger[_0x9dee('0xd')](_0x9dee('0x27'));return _['find'](_0x36f6fb,{'phone':_0x5c0ca5});}else{logger[_0x9dee('0xd')](_0x9dee('0x28'));return request({'uri':util['format'](_0x9dee('0x26'),_0x41b326[_0x9dee('0x1a')]),'method':_0x9dee('0x1b'),'body':{'name':_0x359a60,'phone':_0x5c0ca5}})[_0x9dee('0x1f')](function(_0x499859){logger[_0x9dee('0xd')]('Enduser\x20created.');return _0x499859;});}});}function getAuth(_0xe43c8e){return util[_0x9dee('0x10')]('Basic\x20%s',new Buffer(_0xe43c8e['apiKey']+':X')['toString'](_0x9dee('0x29')));}function request(_0xe0df6d){logger['debug'](_0x9dee('0x2a'),JSON[_0x9dee('0x2b')](_0xe0df6d));return rp(_[_0x9dee('0x2c')](_0xe0df6d,{'method':_0x9dee('0x2d'),'headers':headers,'json':!![]}));}function getTags(_0x1e80be,_0x4bd0f2){var _0x5cf075=[];if(_0x1e80be&&_0x1e80be['length']>0x0){_0x5cf075=_[_0x9dee('0x2e')](_0x1e80be,_0x4bd0f2);}return _0x5cf075;}function getCustomFields(_0x3cca6d,_0x42bf5e){var _0x1f17dc=[];var _0x26fdf3={'custom_fields':[]};if(_0x3cca6d['length']>0x0){_['forEach'](_0x3cca6d,function(_0x5d3fc6){if(_0x5d3fc6[_0x9dee('0x2f')]===_0x9dee('0x30')&&_0x5d3fc6[_0x9dee('0x31')]&&!_0x5d3fc6[_0x9dee('0x32')]){_0x26fdf3[_0x5d3fc6['nameField'][_0x9dee('0x33')]()]=_0x5d3fc6[_0x9dee('0x34')][_0x9dee('0x35')]();}else if(_0x5d3fc6['type']===_0x9dee('0x30')&&_0x5d3fc6[_0x9dee('0x36')]&&_0x5d3fc6[_0x9dee('0x32')]){_0x26fdf3[_0x9dee('0x18')][_0x9dee('0x37')]({'id':_0x5d3fc6[_0x9dee('0x36')],'value':_0x5d3fc6['content'][_0x9dee('0x35')]()});}else if(_0x5d3fc6['type']===_0x9dee('0x38')&&_0x5d3fc6[_0x9dee('0x39')]&&_0x5d3fc6[_0x9dee('0x36')]&&_0x5d3fc6[_0x9dee('0x32')]){_0x42bf5e[_0x5d3fc6['variableName']]&&_0x26fdf3[_0x9dee('0x18')]['push']({'id':_0x5d3fc6[_0x9dee('0x36')],'value':_0x42bf5e[_0x5d3fc6[_0x9dee('0x39')]][_0x9dee('0x35')]()});}else if(_0x5d3fc6[_0x9dee('0x2f')]==='customVariable'&&_0x5d3fc6['Variable']&&_0x5d3fc6[_0x9dee('0x3a')]['name']&&_0x5d3fc6['idField']&&_0x5d3fc6['customField']){_0x42bf5e[_0x5d3fc6[_0x9dee('0x3a')][_0x9dee('0x16')][_0x9dee('0x33')]()]&&_0x26fdf3[_0x9dee('0x18')]['push']({'id':_0x5d3fc6[_0x9dee('0x36')],'value':_0x42bf5e[_0x5d3fc6[_0x9dee('0x3a')][_0x9dee('0x16')][_0x9dee('0x33')]()][_0x9dee('0x35')]()});}});}return _0x26fdf3;}exports[_0x9dee('0x3b')]=function(_0x29314f,_0x273124,_0x51e990,_0x1674ba,_0x44baa7,_0x4740ba){var _0x5df972,_0x538f79;_0x4740ba[_0x9dee('0x1a')]=intUtil[_0x9dee('0x3c')](_0x4740ba[_0x9dee('0x1a')]);_0x4740ba[_0x9dee('0x3d')]=intUtil[_0x9dee('0x3c')](_0x4740ba[_0x9dee('0x3d')]);if(_0x44baa7&&_0x44baa7[_0x9dee('0x3e')]){logger[_0x9dee('0xd')](_0x9dee('0x3f'),'Recording\x20is\x20enabled!');_0x273124[_0x9dee('0x40')]=util['format'](_0x9dee('0x41'),_0x4740ba[_0x9dee('0x3d')],_0x273124[_0x9dee('0x42')],md5(_0x273124['uniqueid']));}else{_0x273124[_0x9dee('0x40')]='';}headers[_0x9dee('0x43')]=getAuth(_0x4740ba);return getUser(_0x4740ba,_0x1674ba[_0x9dee('0x44')])['then'](function(_0x5e9291){_0x5df972=_0x5e9291;logger[_0x9dee('0xd')](_0x9dee('0x45'),_0x5df972['id']);return getEndUser(_0x4740ba,_0x273124[_0x9dee('0x12')],_0x273124[_0x9dee('0x46')]);})['then'](function(_0x56803f){_0x538f79=_0x56803f;logger['info'](_0x9dee('0x47'),_0x538f79['id']);return getTicket(_0x4740ba,_0x5df972,_0x538f79,_0x51e990,_0x273124);})[_0x9dee('0x1f')](function(_0x1b8445){if(_0x1b8445&&_0x1b8445['id']){logger['info'](_0x9dee('0x1c'));logger[_0x9dee('0xd')](_0x9dee('0x48'),_0x1b8445['id']);logger['info'](_0x9dee('0x3f'),_0x9dee('0x49'));emit(util['format'](_0x9dee('0x4a'),_0x1674ba[_0x9dee('0x16')]),'trigger:browser:url',{'uri':util[_0x9dee('0x10')](_0x9dee('0x4b'),_0x4740ba[_0x9dee('0x1a')],_0x1b8445['id'])});}})[_0x9dee('0x4c')](function(_0x307c0e){logger[_0x9dee('0x4d')](_0x9dee('0x3f'),JSON[_0x9dee('0x2b')](_0x307c0e));});};exports[_0x9dee('0x4e')]=function(_0x2a5967,_0x4ef79b,_0xf57509,_0x53f5c7,_0x27334d,_0x3782a6,_0xe9a322){var _0x4e724f,_0x564870;_0x3782a6[_0x9dee('0x1a')]=intUtil[_0x9dee('0x3c')](_0x3782a6[_0x9dee('0x1a')]);_0x3782a6[_0x9dee('0x3d')]=intUtil[_0x9dee('0x3c')](_0x3782a6[_0x9dee('0x3d')]);if(_0xe9a322&&_0xe9a322[_0x9dee('0x4f')]&&_0xe9a322[_0x9dee('0x4f')]!==_0x9dee('0x50')){logger[_0x9dee('0xd')]('[OUTBOUND]',_0x9dee('0x51'));_0x4ef79b[_0x9dee('0x40')]=util[_0x9dee('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3782a6[_0x9dee('0x3d')],_0x4ef79b[_0x9dee('0x42')],md5(_0x4ef79b[_0x9dee('0x42')]));}headers[_0x9dee('0x43')]=getAuth(_0x3782a6);return getUser(_0x3782a6,_0x53f5c7[_0x9dee('0x44')])[_0x9dee('0x1f')](function(_0x58ca8f){_0x4e724f=_0x58ca8f;logger[_0x9dee('0xd')](_0x9dee('0x45'),_0x4e724f['id']);return getEndUser(_0x3782a6,_0x4ef79b['destcalleridname'],_0x4ef79b[_0x9dee('0x52')]);})[_0x9dee('0x1f')](function(_0xa6d4df){_0x564870=_0xa6d4df;logger[_0x9dee('0xd')](_0x9dee('0x47'),_0x564870['id']);return getTicket(_0x3782a6,_0x4e724f,_0x564870,_0xf57509,_0x4ef79b);})[_0x9dee('0x1f')](function(_0x1e21a7){if(_0x1e21a7&&_0x1e21a7['id']){logger['info']('Ticket\x20created!');logger['info'](_0x9dee('0x48'),_0x1e21a7['id']);logger['info'](_0x9dee('0x53'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9dee('0x10')](_0x9dee('0x4a'),_0x53f5c7[_0x9dee('0x16')]),_0x9dee('0x54'),{'uri':util[_0x9dee('0x10')](_0x9dee('0x4b'),_0x3782a6['remoteUri'],_0x1e21a7['id'])});}})[_0x9dee('0x4c')](function(_0x3b4d71){logger[_0x9dee('0x4d')](_0x9dee('0x53'),JSON[_0x9dee('0x2b')](_0x3b4d71));});};exports[_0x9dee('0x55')]=function(_0x39445a,_0x378eec,_0x2dcef1,_0x5a06f9,_0x13e64a,_0x53cfb2){var _0x1e1f0a,_0x506f18;_0x53cfb2[_0x9dee('0x1a')]=intUtil[_0x9dee('0x3c')](_0x53cfb2[_0x9dee('0x1a')]);_0x53cfb2['serverUrl']=intUtil[_0x9dee('0x3c')](_0x53cfb2[_0x9dee('0x3d')]);if(_0x13e64a&&_0x13e64a[_0x9dee('0x3e')]){logger['info']('['+_0x378eec[_0x9dee('0x56')][_0x9dee('0x57')]()+']',_0x9dee('0x51'));_0x378eec[_0x9dee('0x40')]=util['format'](_0x9dee('0x41'),_0x53cfb2[_0x9dee('0x3d')],_0x378eec[_0x9dee('0x42')],md5(_0x378eec[_0x9dee('0x42')]));}else{_0x378eec['recordingURL']='';}headers['Authorization']=getAuth(_0x53cfb2);return getUser(_0x53cfb2,'')[_0x9dee('0x1f')](function(_0xee9cf1){_0x1e1f0a=_0xee9cf1;logger['info'](_0x9dee('0x45'),_0x1e1f0a['id']);return getEndUser(_0x53cfb2,_0x378eec[_0x9dee('0x12')],_0x378eec['calleridnum']);})[_0x9dee('0x1f')](function(_0x412365){_0x506f18=_0x412365;logger[_0x9dee('0xd')]('The\x20Enduser\x20ID\x20is:',_0x506f18['id']);return getTicket(_0x53cfb2,_0x1e1f0a,_0x506f18,_0x2dcef1,_0x378eec);})['then'](function(_0x2c8d09){if(_0x2c8d09){logger[_0x9dee('0xd')]('Ticket\x20created!');logger[_0x9dee('0xd')](_0x9dee('0x48'),_0x2c8d09['id']);}})[_0x9dee('0x4c')](function(_0x422013){logger[_0x9dee('0x4d')]('['+_0x378eec[_0x9dee('0x56')][_0x9dee('0x57')]()+']',JSON['stringify'](_0x422013));});}; \ 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 6024607..3743208 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 _0x513f=['find','work_number','mobile_number','endUserId','Contact\x20found:','Contact\x20created:','POST','/api/contacts','format','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','ticketId','/contacts/','user:%s','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','queue','unmanaged','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','inspect','lodash','request-promise','md5','util','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','headers','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','info','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','/api/selector/owners','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','email','userId','User\x20found:','userEmail','error','message','/api/contacts/filters','Getting\x20contacts\x20filter','filters','forEach','name','All\x20Contacts','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contactNumber','contacts'];(function(_0x5d2d01,_0x2b2941){var _0x3ddbfb=function(_0x14f3d6){while(--_0x14f3d6){_0x5d2d01['push'](_0x5d2d01['shift']());}};_0x3ddbfb(++_0x2b2941);}(_0x513f,0x85));var _0xf513=function(_0xf9c85b,_0x59c5c4){_0xf9c85b=_0xf9c85b-0x0;var _0x4231de=_0x513f[_0xf9c85b];return _0x4231de;};'use strict';var _=require(_0xf513('0x0'));var rp=require(_0xf513('0x1'));var md5=require(_0xf513('0x2'));var util=require(_0xf513('0x3'));var moment=require('moment');var Promise=require(_0xf513('0x4'));var Redis=require(_0xf513('0x5'));var intUtil=require('./util');var config=require(_0xf513('0x6'));var logger=require(_0xf513('0x7'))(_0xf513('0x8'));config[_0xf513('0x9')]=_[_0xf513('0xa')](config[_0xf513('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xf513('0xb'))(new Redis(config[_0xf513('0x9')]));function getAdminId(_0x59533d,_0x1dc11d,_0x32eb68,_0x2eed6b){return new Promise(function(_0x994565,_0x58e3e9){var _0x3f3b7c=![];var _0x2431cd={'method':_0xf513('0xc'),'uri':_0x2eed6b+'/api/selector/owners','json':!![]};_0x2431cd[_0xf513('0xd')]=_0x32eb68;logger['info'](_0xf513('0xe'));return rp(_0x2431cd)[_0xf513('0xf')](function(_0x5af835){if(_0x5af835){var _0x1c5cea=_0x5af835[_0xf513('0x10')];var _0x47d464=null;for(_0x47d464=0x0;_0x47d464<_0x1c5cea[_0xf513('0x11')];_0x47d464++){if(_0x1c5cea[_0x47d464]['email']===_0x59533d[_0xf513('0x12')]){_0x59533d[_0xf513('0x13')]=_0x1c5cea[_0x47d464]['id'];_0x3f3b7c=!![];}}if(_0x3f3b7c){logger[_0xf513('0x14')]('Admin\x20found:',_0x59533d[_0xf513('0x13')]);_0x994565(_0x59533d);}else{_0x58e3e9({'statusCode':0x194,'message':_0xf513('0x15')});}}else{_0x58e3e9({'statusCode':0x194,'message':_0xf513('0x15')});}})[_0xf513('0x16')](function(_0x2da2ca){logger['error']('['+[_0x1dc11d[_0xf513('0x17')]()]+']',_0x2da2ca['message']);_0x58e3e9(_0x2da2ca);});});}function getUser(_0x1d04d1,_0x7903c3,_0x2be5fc){return function(_0x440d89){return new Promise(function(_0xde365f,_0x30849a){var _0xaf5445={'method':_0xf513('0xc'),'uri':_0x2be5fc+_0xf513('0x18'),'json':!![]};_0xaf5445[_0xf513('0xd')]=_0x7903c3;logger[_0xf513('0x14')](_0xf513('0x19'));return rp(_0xaf5445)['then'](function(_0x5dc508){if(_0x5dc508){var _0x309f8e=_0x5dc508[_0xf513('0x10')];var _0x331aa9=![];var _0x33bfc2=null;if(_0x440d89['agentEmail']!==null){logger[_0xf513('0x14')](_0xf513('0x1a'),_0x440d89[_0xf513('0x1b')]);_0x440d89['userEmail']=_0x440d89['agentEmail'];for(_0x33bfc2=0x0;_0x33bfc2<_0x309f8e[_0xf513('0x11')];_0x33bfc2++){if(_0x309f8e[_0x33bfc2][_0xf513('0x1c')]===_0x440d89[_0xf513('0x1b')]){_0x331aa9=!![];_0x440d89[_0xf513('0x1d')]=_0x309f8e[_0x33bfc2]['id'];logger['info'](_0xf513('0x1e'),_0x440d89[_0xf513('0x1d')]);}}}if(!_0x331aa9){logger[_0xf513('0x14')]('Admin\x20selected');_0x440d89[_0xf513('0x1f')]=_0x440d89['adminEmail'];_0x440d89[_0xf513('0x1d')]=_0x440d89[_0xf513('0x13')];_0x331aa9=!![];}if(_0x331aa9){_0xde365f(_0x440d89);}else{_0x30849a({'statusCode':0x194,'message':_0xf513('0x15')});}}else{_0x30849a({'statusCode':0x194,'message':_0xf513('0x15')});}})[_0xf513('0x16')](function(_0x2d6364){logger[_0xf513('0x20')]('['+[_0x1d04d1[_0xf513('0x17')]()]+']',_0x2d6364[_0xf513('0x21')]);_0x30849a(_0x2d6364);});});};}function getEndUser(_0x4138cd,_0x47aa3a,_0x186c40){return function(_0x20e8e2){return new Promise(function(_0x2c884c,_0x48d078){var _0x589c00=0x0;var _0x56a6ee={'method':_0xf513('0xc'),'uri':_0x186c40+_0xf513('0x22'),'json':!![]};_0x56a6ee[_0xf513('0xd')]=_0x47aa3a;logger[_0xf513('0x14')](_0xf513('0x23'));return rp(_0x56a6ee)['then'](function(_0x599059){_0x599059[_0xf513('0x24')][_0xf513('0x25')](function(_0xa914ed){if(_0xa914ed[_0xf513('0x26')]===_0xf513('0x27')){_0x589c00=_0xa914ed['id'];}});})[_0xf513('0xf')](function(){logger['info'](_0xf513('0x28'));var _0x1e0e5c={'method':_0xf513('0xc'),'uri':_0x186c40+_0xf513('0x29')+_0x589c00,'json':!![]};_0x1e0e5c[_0xf513('0xd')]=_0x47aa3a;return rp(_0x1e0e5c);})[_0xf513('0xf')](function(_0x20987e){logger['info'](_0xf513('0x2a'),_0x20e8e2[_0xf513('0x2b')]);if(_0x20987e[_0xf513('0x2c')]['length']>0x0){var _0x225622=_[_0xf513('0x2d')](_0x20987e['contacts'],function(_0x560406){if(_0x560406[_0xf513('0x2e')]===_0x20e8e2['contactNumber']||_0x560406[_0xf513('0x2f')]===_0x20e8e2[_0xf513('0x2b')]){return _0x560406;}});if(_0x225622){_0x20e8e2[_0xf513('0x30')]=_0x225622['id'];logger[_0xf513('0x14')](_0xf513('0x31'),_0x20e8e2[_0xf513('0x30')]);_0x2c884c(_0x20e8e2);}else{return createEndUser(_0x20e8e2,_0x4138cd,_0x47aa3a,_0x186c40)[_0xf513('0xf')](function(_0x59565c){logger[_0xf513('0x14')](_0xf513('0x32'),_0x20e8e2['endUserId']);_0x2c884c(_0x59565c);});}}else{return createEndUser(_0x20e8e2,_0x4138cd,_0x47aa3a,_0x186c40)[_0xf513('0xf')](function(_0x7306f4){logger['info'](_0xf513('0x32'),_0x20e8e2[_0xf513('0x30')]);_0x2c884c(_0x7306f4);});}})['catch'](function(_0x4db7cf){throw new Error(_0x4db7cf[_0xf513('0x21')]);});});};}function createEndUser(_0x2cfab7,_0x2d7a7a,_0x6d4f39,_0x51b935){return new Promise(function(_0x1be18e,_0x215f5f){var _0xf3cd29=moment();var _0xf3af1e={'method':_0xf513('0x33'),'uri':_0x51b935+_0xf513('0x34'),'body':{'contact':{'last_name':_0x2cfab7[_0xf513('0x2b')],'work_number':_0x2cfab7[_0xf513('0x2b')],'mobile_number':_0x2cfab7[_0xf513('0x2b')],'owner_id':_0x2cfab7[_0xf513('0x1d')],'created_at':_0xf3cd29[_0xf513('0x35')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0xf3af1e[_0xf513('0xd')]=_0x6d4f39;logger[_0xf513('0x14')](_0xf513('0x36'));return rp(_0xf3af1e)['then'](function(_0x152e0f){_0x2cfab7[_0xf513('0x30')]=_0x152e0f[_0xf513('0x37')]['id'];_0x1be18e(_0x2cfab7);})[_0xf513('0x16')](function(_0x2e5e1e){logger['error']('['+[_0x2d7a7a[_0xf513('0x17')]()]+']',_0x2e5e1e['message']);_0x215f5f(_0x2e5e1e['message']);});});}function getTicket(_0x123468,_0x4f2721,_0x18b892,_0x422f83,_0x1c02b6){return function(_0x3283d9){logger[_0xf513('0x14')](_0xf513('0x38'));return new Promise(function(_0x1da969,_0x135897){var _0x5c2bf0=moment();var _0x5108cc={'method':_0xf513('0x33'),'uri':_0x18b892+_0xf513('0x39'),'body':{'title':intUtil['getString'](_0x422f83['Subjects'],_0x1c02b6,'\x20'),'description':intUtil[_0xf513('0x3a')](_0x422f83[_0xf513('0x3b')],_0x1c02b6,'\x0a'),'owner_id':_0x3283d9[_0xf513('0x1d')],'creater_id':_0x3283d9['adminId'],'targetable_id':_0x3283d9[_0xf513('0x30')],'targetable_type':_0xf513('0x3c'),'created_at':_0x5c2bf0[_0xf513('0x35')](_0xf513('0x3d')),'due_date':_0x5c2bf0['add'](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x5108cc['headers']=_0x4f2721;return rp(_0x5108cc)[_0xf513('0xf')](function(_0x246d27){_0x3283d9[_0xf513('0x3e')]=_0x246d27['task']['id'];logger[_0xf513('0x14')]('Task\x20created:',_0x3283d9['ticketId']);_0x1da969(_0x3283d9);})[_0xf513('0x16')](function(_0x2e133a){logger[_0xf513('0x20')]('['+[_0x123468['toUpperCase']()]+']',_0x2e133a[_0xf513('0x21')]);_0x135897(_0x2e133a['message']);});});};}function emit(_0x83030a,_0x2a9656,_0x3e5860){var _0x5d3321={'uri':_0x83030a+_0xf513('0x3f')+_0x3e5860};io['to'](util[_0xf513('0x35')](_0xf513('0x40'),_0x2a9656))['emit']('trigger:browser:url',_0x5d3321);}exports['cs']=function(_0x559be1,_0x349b9e,_0x4a4644,_0x19867d,_0x228b7d,_0x31f59d,_0x1089c9,_0x15c81d){var _0x29f874={};var _0x4d91ab={'Authorization':_0xf513('0x41')+_0x31f59d[_0xf513('0x42')]};_0x31f59d['remoteUri']=intUtil[_0xf513('0x43')](_0x31f59d[_0xf513('0x44')]);_0x31f59d[_0xf513('0x45')]=intUtil[_0xf513('0x43')](_0x31f59d['serverUrl']);var _0x137104=_0x31f59d[_0xf513('0x44')];_0x29f874[_0xf513('0x12')]=_0x31f59d[_0xf513('0x46')];_0x29f874[_0xf513('0x2b')]=_0x15c81d[_0xf513('0x47')]()===_0xf513('0x48')?_0x349b9e[_0xf513('0x49')]:_0x349b9e[_0xf513('0x4a')];_0x29f874['callDirection']=_0x15c81d===_0xf513('0x4b')||_0x15c81d===_0xf513('0x4c')?_0xf513('0x4b'):_0xf513('0x48');if(_0x19867d){_0x29f874[_0xf513('0x1b')]=_0x19867d['email'];}var _0x1ad047=util[_0xf513('0x35')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x31f59d[_0xf513('0x45')],_0x349b9e[_0xf513('0x4d')],md5(_0x349b9e['uniqueid']));if(_0x228b7d&&_0x228b7d[_0xf513('0x4e')]){logger[_0xf513('0x14')](_0xf513('0x4f'),_0xf513('0x50'));_0x349b9e[_0xf513('0x51')]=_0x1ad047;}else if(_0x1089c9&&_0x1089c9[_0xf513('0x52')]&&_0x1089c9['recordingFormat']!==_0xf513('0x53')){logger[_0xf513('0x14')](_0xf513('0x54'),_0xf513('0x50'));_0x349b9e[_0xf513('0x51')]=_0x1ad047;}else{_0x349b9e[_0xf513('0x51')]='';}return getAdminId(_0x29f874,_0x15c81d,_0x4d91ab,_0x137104)[_0xf513('0xf')](getUser(_0x15c81d,_0x4d91ab,_0x137104))[_0xf513('0xf')](getEndUser(_0x15c81d,_0x4d91ab,_0x137104))[_0xf513('0xf')](getTicket(_0x15c81d,_0x4d91ab,_0x137104,_0x4a4644,_0x349b9e))[_0xf513('0xf')](function(_0x20fbe8){logger[_0xf513('0x14')](util['format'](_0xf513('0x55'),_0x20fbe8[_0xf513('0x3e')]));if(_0x15c81d!=='unmanaged'){logger[_0xf513('0x14')]('['+[_0x15c81d[_0xf513('0x17')]()]+']',_0xf513('0x56'));emit(_0x137104,_0x19867d[_0xf513('0x26')],_0x20fbe8[_0xf513('0x30')]);}})[_0xf513('0x16')](function(_0x59b628){logger['error']('['+[_0x15c81d[_0xf513('0x17')]()]+_0xf513('0x57'),util[_0xf513('0x58')](_0x59b628,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x3fe1=['adminEmail','/api/contacts/filters','Getting\x20contacts\x20filter','filters','name','All\x20Contacts','Getting\x20contact\x20list','/api/contacts/view/','contactNumber','contacts','find','work_number','mobile_number','endUserId','Contact\x20found:','Contact\x20created:','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','Subjects','getString','Contact','format','ticketId','Task\x20created:','/contacts/','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','outbound','destcalleridnum','calleridnum','unmanaged','queue','%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','inspect','lodash','request-promise','md5','util','bluebird','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','email','adminId','info','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','userId','User\x20found:','Admin\x20selected'];(function(_0x420282,_0x1f941f){var _0x535480=function(_0x18cddc){while(--_0x18cddc){_0x420282['push'](_0x420282['shift']());}};_0x535480(++_0x1f941f);}(_0x3fe1,0x19b));var _0x13fe=function(_0x297220,_0x49bec5){_0x297220=_0x297220-0x0;var _0x532a3e=_0x3fe1[_0x297220];return _0x532a3e;};'use strict';var _=require(_0x13fe('0x0'));var rp=require(_0x13fe('0x1'));var md5=require(_0x13fe('0x2'));var util=require(_0x13fe('0x3'));var moment=require('moment');var Promise=require(_0x13fe('0x4'));var Redis=require('ioredis');var intUtil=require(_0x13fe('0x5'));var config=require(_0x13fe('0x6'));var logger=require(_0x13fe('0x7'))(_0x13fe('0x8'));config[_0x13fe('0x9')]=_[_0x13fe('0xa')](config[_0x13fe('0x9')],{'host':_0x13fe('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0x7d2df6,_0x5e4f87,_0x175969,_0x4b6275){return new Promise(function(_0x1d0353,_0x26952b){var _0x579b59=![];var _0x766d64={'method':_0x13fe('0xc'),'uri':_0x4b6275+_0x13fe('0xd'),'json':!![]};_0x766d64[_0x13fe('0xe')]=_0x175969;logger['info'](_0x13fe('0xf'));return rp(_0x766d64)[_0x13fe('0x10')](function(_0x435dc3){if(_0x435dc3){var _0x332059=_0x435dc3[_0x13fe('0x11')];var _0x584b68=null;for(_0x584b68=0x0;_0x584b68<_0x332059['length'];_0x584b68++){if(_0x332059[_0x584b68][_0x13fe('0x12')]===_0x7d2df6['adminEmail']){_0x7d2df6[_0x13fe('0x13')]=_0x332059[_0x584b68]['id'];_0x579b59=!![];}}if(_0x579b59){logger[_0x13fe('0x14')]('Admin\x20found:',_0x7d2df6[_0x13fe('0x13')]);_0x1d0353(_0x7d2df6);}else{_0x26952b({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x26952b({'statusCode':0x194,'message':_0x13fe('0x15')});}})[_0x13fe('0x16')](function(_0x3206ac){logger[_0x13fe('0x17')]('['+[_0x5e4f87[_0x13fe('0x18')]()]+']',_0x3206ac[_0x13fe('0x19')]);_0x26952b(_0x3206ac);});});}function getUser(_0x5be4a6,_0x4310ec,_0x240694){return function(_0x36299b){return new Promise(function(_0x17dd31,_0x4cb818){var _0x4097f6={'method':_0x13fe('0xc'),'uri':_0x240694+_0x13fe('0xd'),'json':!![]};_0x4097f6[_0x13fe('0xe')]=_0x4310ec;logger['info'](_0x13fe('0x1a'));return rp(_0x4097f6)[_0x13fe('0x10')](function(_0xd39abd){if(_0xd39abd){var _0x3e664f=_0xd39abd[_0x13fe('0x11')];var _0x2dd8d0=![];var _0x421989=null;if(_0x36299b[_0x13fe('0x1b')]!==null){logger[_0x13fe('0x14')](_0x13fe('0x1c'),_0x36299b['agentEmail']);_0x36299b[_0x13fe('0x1d')]=_0x36299b['agentEmail'];for(_0x421989=0x0;_0x421989<_0x3e664f[_0x13fe('0x1e')];_0x421989++){if(_0x3e664f[_0x421989][_0x13fe('0x12')]===_0x36299b[_0x13fe('0x1b')]){_0x2dd8d0=!![];_0x36299b[_0x13fe('0x1f')]=_0x3e664f[_0x421989]['id'];logger[_0x13fe('0x14')](_0x13fe('0x20'),_0x36299b[_0x13fe('0x1f')]);}}}if(!_0x2dd8d0){logger[_0x13fe('0x14')](_0x13fe('0x21'));_0x36299b[_0x13fe('0x1d')]=_0x36299b[_0x13fe('0x22')];_0x36299b[_0x13fe('0x1f')]=_0x36299b[_0x13fe('0x13')];_0x2dd8d0=!![];}if(_0x2dd8d0){_0x17dd31(_0x36299b);}else{_0x4cb818({'statusCode':0x194,'message':_0x13fe('0x15')});}}else{_0x4cb818({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x13fe('0x16')](function(_0x294053){logger['error']('['+[_0x5be4a6[_0x13fe('0x18')]()]+']',_0x294053[_0x13fe('0x19')]);_0x4cb818(_0x294053);});});};}function getEndUser(_0x3e4921,_0x534d84,_0x150192){return function(_0x39678c){return new Promise(function(_0x4b30db,_0x250831){var _0x5c95d3=0x0;var _0x2f2a08={'method':_0x13fe('0xc'),'uri':_0x150192+_0x13fe('0x23'),'json':!![]};_0x2f2a08[_0x13fe('0xe')]=_0x534d84;logger['info'](_0x13fe('0x24'));return rp(_0x2f2a08)[_0x13fe('0x10')](function(_0xd05c59){_0xd05c59[_0x13fe('0x25')]['forEach'](function(_0x5141a0){if(_0x5141a0[_0x13fe('0x26')]===_0x13fe('0x27')){_0x5c95d3=_0x5141a0['id'];}});})[_0x13fe('0x10')](function(){logger[_0x13fe('0x14')](_0x13fe('0x28'));var _0x23b1b7={'method':'GET','uri':_0x150192+_0x13fe('0x29')+_0x5c95d3,'json':!![]};_0x23b1b7[_0x13fe('0xe')]=_0x534d84;return rp(_0x23b1b7);})[_0x13fe('0x10')](function(_0xf1f9eb){logger['info']('Searching\x20contact\x20with\x20phone',_0x39678c[_0x13fe('0x2a')]);if(_0xf1f9eb[_0x13fe('0x2b')]['length']>0x0){var _0x1c61f9=_[_0x13fe('0x2c')](_0xf1f9eb[_0x13fe('0x2b')],function(_0x52106a){if(_0x52106a[_0x13fe('0x2d')]===_0x39678c['contactNumber']||_0x52106a[_0x13fe('0x2e')]===_0x39678c[_0x13fe('0x2a')]){return _0x52106a;}});if(_0x1c61f9){_0x39678c[_0x13fe('0x2f')]=_0x1c61f9['id'];logger[_0x13fe('0x14')](_0x13fe('0x30'),_0x39678c[_0x13fe('0x2f')]);_0x4b30db(_0x39678c);}else{return createEndUser(_0x39678c,_0x3e4921,_0x534d84,_0x150192)['then'](function(_0x33461a){logger[_0x13fe('0x14')](_0x13fe('0x31'),_0x39678c[_0x13fe('0x2f')]);_0x4b30db(_0x33461a);});}}else{return createEndUser(_0x39678c,_0x3e4921,_0x534d84,_0x150192)['then'](function(_0x237436){logger[_0x13fe('0x14')]('Contact\x20created:',_0x39678c['endUserId']);_0x4b30db(_0x237436);});}})[_0x13fe('0x16')](function(_0x140cd7){throw new Error(_0x140cd7[_0x13fe('0x19')]);});});};}function createEndUser(_0xb0501d,_0x3add65,_0x4e2429,_0x4aa07d){return new Promise(function(_0x460b63,_0x3ba2ec){var _0x2bca61=moment();var _0x366b2c={'method':'POST','uri':_0x4aa07d+'/api/contacts','body':{'contact':{'last_name':_0xb0501d['contactNumber'],'work_number':_0xb0501d['contactNumber'],'mobile_number':_0xb0501d[_0x13fe('0x2a')],'owner_id':_0xb0501d['userId'],'created_at':_0x2bca61['format'](_0x13fe('0x32'))}},'json':!![]};_0x366b2c[_0x13fe('0xe')]=_0x4e2429;logger[_0x13fe('0x14')](_0x13fe('0x33'));return rp(_0x366b2c)[_0x13fe('0x10')](function(_0x35742f){_0xb0501d[_0x13fe('0x2f')]=_0x35742f[_0x13fe('0x34')]['id'];_0x460b63(_0xb0501d);})[_0x13fe('0x16')](function(_0x212350){logger['error']('['+[_0x3add65[_0x13fe('0x18')]()]+']',_0x212350[_0x13fe('0x19')]);_0x3ba2ec(_0x212350['message']);});});}function getTicket(_0x3aa98c,_0x272e45,_0x1a9bd5,_0x3a2752,_0x226d9e){return function(_0x3dfd85){logger['info'](_0x13fe('0x35'));return new Promise(function(_0x3ade46,_0x498ce8){var _0x443873=moment();var _0x4e29ae={'method':_0x13fe('0x36'),'uri':_0x1a9bd5+_0x13fe('0x37'),'body':{'title':intUtil['getString'](_0x3a2752[_0x13fe('0x38')],_0x226d9e,'\x20'),'description':intUtil[_0x13fe('0x39')](_0x3a2752['Descriptions'],_0x226d9e,'\x0a'),'owner_id':_0x3dfd85[_0x13fe('0x1f')],'creater_id':_0x3dfd85['adminId'],'targetable_id':_0x3dfd85[_0x13fe('0x2f')],'targetable_type':_0x13fe('0x3a'),'created_at':_0x443873[_0x13fe('0x3b')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x443873['add'](0x1e,'m')[_0x13fe('0x3b')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x4e29ae[_0x13fe('0xe')]=_0x272e45;return rp(_0x4e29ae)['then'](function(_0x7c48e0){_0x3dfd85[_0x13fe('0x3c')]=_0x7c48e0['task']['id'];logger[_0x13fe('0x14')](_0x13fe('0x3d'),_0x3dfd85[_0x13fe('0x3c')]);_0x3ade46(_0x3dfd85);})[_0x13fe('0x16')](function(_0x57dc82){logger[_0x13fe('0x17')]('['+[_0x3aa98c[_0x13fe('0x18')]()]+']',_0x57dc82[_0x13fe('0x19')]);_0x498ce8(_0x57dc82[_0x13fe('0x19')]);});});};}function emit(_0x1162aa,_0x45d526,_0x49aba9){var _0x2b1522={'uri':_0x1162aa+_0x13fe('0x3e')+_0x49aba9};io['to'](util['format']('user:%s',_0x45d526))['emit'](_0x13fe('0x3f'),_0x2b1522);}exports['cs']=function(_0x113c9a,_0x57da28,_0x391794,_0x4acbe6,_0x157711,_0x264d72,_0x54e3c4,_0x31218a){var _0x2b2e78={};var _0x1e8a2c={'Authorization':_0x13fe('0x40')+_0x264d72[_0x13fe('0x41')]};_0x264d72[_0x13fe('0x42')]=intUtil['stripTrailingSlash'](_0x264d72[_0x13fe('0x42')]);_0x264d72[_0x13fe('0x43')]=intUtil[_0x13fe('0x44')](_0x264d72[_0x13fe('0x43')]);var _0x6b4855=_0x264d72[_0x13fe('0x42')];_0x2b2e78[_0x13fe('0x22')]=_0x264d72[_0x13fe('0x45')];_0x2b2e78[_0x13fe('0x2a')]=_0x31218a[_0x13fe('0x46')]()===_0x13fe('0x47')?_0x57da28[_0x13fe('0x48')]:_0x57da28[_0x13fe('0x49')];_0x2b2e78['callDirection']=_0x31218a==='queue'||_0x31218a===_0x13fe('0x4a')?_0x13fe('0x4b'):'outbound';if(_0x4acbe6){_0x2b2e78[_0x13fe('0x1b')]=_0x4acbe6['email'];}var _0x34a1bc=util['format'](_0x13fe('0x4c'),_0x264d72['serverUrl'],_0x57da28[_0x13fe('0x4d')],md5(_0x57da28[_0x13fe('0x4d')]));if(_0x157711&&_0x157711[_0x13fe('0x4e')]){logger[_0x13fe('0x14')](_0x13fe('0x4f'),_0x13fe('0x50'));_0x57da28[_0x13fe('0x51')]=_0x34a1bc;}else if(_0x54e3c4&&_0x54e3c4[_0x13fe('0x52')]&&_0x54e3c4['recordingFormat']!==_0x13fe('0x53')){logger[_0x13fe('0x14')](_0x13fe('0x54'),_0x13fe('0x50'));_0x57da28[_0x13fe('0x51')]=_0x34a1bc;}else{_0x57da28[_0x13fe('0x51')]='';}return getAdminId(_0x2b2e78,_0x31218a,_0x1e8a2c,_0x6b4855)[_0x13fe('0x10')](getUser(_0x31218a,_0x1e8a2c,_0x6b4855))[_0x13fe('0x10')](getEndUser(_0x31218a,_0x1e8a2c,_0x6b4855))[_0x13fe('0x10')](getTicket(_0x31218a,_0x1e8a2c,_0x6b4855,_0x391794,_0x57da28))[_0x13fe('0x10')](function(_0x3ebafb){logger[_0x13fe('0x14')](util[_0x13fe('0x3b')](_0x13fe('0x55'),_0x3ebafb[_0x13fe('0x3c')]));if(_0x31218a!==_0x13fe('0x4a')){logger[_0x13fe('0x14')]('['+[_0x31218a['toUpperCase']()]+']',_0x13fe('0x56'));emit(_0x6b4855,_0x4acbe6['name'],_0x3ebafb[_0x13fe('0x2f')]);}})[_0x13fe('0x16')](function(_0x17f3a4){logger[_0x13fe('0x17')]('['+[_0x31218a[_0x13fe('0x18')]()]+_0x13fe('0x57'),util[_0x13fe('0x58')](_0x17f3a4,{'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 60c8aab..dace9ec 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 _0xda2d=['../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','error','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','freshsales','servicenow','includes','data1','toLowerCase','data2','find','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','dynamics365','unknown\x20integration'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xda2d,0x102));var _0xdda2=function(_0x5258b7,_0x200e32){_0x5258b7=_0x5258b7-0x0;var _0x4d373c=_0xda2d[_0x5258b7];return _0x4d373c;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var zendesk=require(_0xdda2('0x1'));var salesforce=require(_0xdda2('0x2'));var sugarcrm=require(_0xdda2('0x3'));var freshdesk=require(_0xdda2('0x4'));var zoho=require('./zoho');var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0xdda2('0x5'));var dynamics365=require(_0xdda2('0x6'));var freshsales=require(_0xdda2('0x7'));var integrations=[_0xdda2('0x8'),_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xb'),_0xdda2('0xc'),_0xdda2('0xd'),_0xdda2('0xe'),'dynamics365',_0xdda2('0xf'),_0xdda2('0x10')];exports['exec']=function(_0x1c11b2,_0x2f3454,_0x42d990,_0x346119,_0x171123,_0x30ca9a){if(_0x42d990){if(_[_0xdda2('0x11')](integrations,_0x1c11b2[_0xdda2('0x12')]['toLowerCase']())){try{var _0x4f8d71=null;var _0x56d25d='';var _0xa6446b=_0x42d990[_0x1c11b2[_0xdda2('0x12')][_0xdda2('0x13')]()];if(_0xa6446b){var _0x1503a7=_0xa6446b[_0x1c11b2[_0xdda2('0x14')]];if(_0x1503a7){var _0x475222=_[_0xdda2('0x15')](_0x1503a7['Configurations'],{'id':parseInt(_0x1c11b2[_0xdda2('0x16')],0xa)});if(_0x475222){if(_0x346119){if(_0x171123&&_0x2f3454['queue']){_0x56d25d=_0xdda2('0x17');}else if(_0x2f3454[_0xdda2('0x18')]){_0x56d25d=_0xdda2('0x19');}else{console[_0xdda2('0x1a')](_0xdda2('0x1b'),_0x2f3454);}}else{_0x56d25d='unmanaged';}switch(_0x1c11b2['data1'][_0xdda2('0x13')]()){case'zendesk':zendesk[_0x56d25d](_0x1c11b2,_0x2f3454,_0x475222,_0x346119,_0x171123,_0x1503a7,_0x30ca9a);break;case _0xdda2('0x9'):salesforce[_0x56d25d](_0x1c11b2,_0x2f3454,_0x475222,_0x346119,_0x171123,_0x1503a7,_0x30ca9a);break;case _0xdda2('0xa'):sugarcrm[_0x56d25d](_0x1c11b2,_0x2f3454,_0x475222,_0x346119,_0x171123,_0x1503a7,_0x30ca9a);break;case _0xdda2('0xb'):freshdesk[_0x56d25d](_0x1c11b2,_0x2f3454,_0x475222,_0x346119,_0x171123,_0x1503a7,_0x30ca9a);break;case _0xdda2('0xc'):zoho[_0x56d25d](_0x1c11b2,_0x2f3454,_0x475222,_0x346119,_0x171123,_0x1503a7,_0x30ca9a);break;case _0xdda2('0xd'):desk[_0x56d25d](_0x1c11b2,_0x2f3454,_0x475222,_0x346119,_0x171123,_0x1503a7,_0x30ca9a);break;case _0xdda2('0xe'):vtiger[_0x56d25d](_0x1c11b2,_0x2f3454,_0x475222,_0x346119,_0x171123,_0x1503a7,_0x30ca9a);break;case _0xdda2('0xf'):freshsales['cs'](_0x1c11b2,_0x2f3454,_0x475222,_0x346119,_0x171123,_0x1503a7,_0x30ca9a,_0x56d25d);break;case _0xdda2('0x10'):servicenow['cs'](_0x1c11b2,_0x2f3454,_0x475222,_0x346119,_0x171123,_0x1503a7,_0x30ca9a,_0x56d25d);break;case _0xdda2('0x1c'):dynamics365['cs'](_0x1c11b2,_0x2f3454,_0x475222,_0x346119,_0x171123,_0x1503a7,_0x30ca9a,_0x56d25d);break;default:console[_0xdda2('0x1a')](_0xdda2('0x1d'));}}else{_0x4f8d71=require(_0xdda2('0x1e'))(_0x1c11b2['data1'][_0xdda2('0x13')]());_0x4f8d71['error'](_0xdda2('0x1f'),util[_0xdda2('0x20')](_0xdda2('0x21'),_0x1c11b2['data1'][_0xdda2('0x13')](),_0x1c11b2['data3']));}}else{_0x4f8d71=require(_0xdda2('0x1e'))(_0x1c11b2[_0xdda2('0x12')]['toLowerCase']());_0x4f8d71[_0xdda2('0x22')](_0xdda2('0x1f'),util[_0xdda2('0x20')](_0xdda2('0x23'),_0x1c11b2[_0xdda2('0x12')]['toLowerCase'](),_0x1c11b2[_0xdda2('0x14')]));}}else{}}catch(_0x4be5ea){console[_0xdda2('0x22')](_0x4be5ea);}}}}; \ No newline at end of file +var _0x5c3c=['freshdesk','zoho','dynamics365','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','data3','[EXEC]','lodash','util','./zendesk','./salesforce','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','desk','vtiger','freshsales','servicenow','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound','log','sugarcrm'];(function(_0x5206cb,_0x2f0cbf){var _0x292bb8=function(_0x448001){while(--_0x448001){_0x5206cb['push'](_0x5206cb['shift']());}};_0x292bb8(++_0x2f0cbf);}(_0x5c3c,0x132));var _0xc5c3=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x5c3c[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var zendesk=require(_0xc5c3('0x2'));var salesforce=require(_0xc5c3('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xc5c3('0x4'));var zoho=require(_0xc5c3('0x5'));var desk=require(_0xc5c3('0x6'));var vtiger=require(_0xc5c3('0x7'));var servicenow=require(_0xc5c3('0x8'));var dynamics365=require(_0xc5c3('0x9'));var freshsales=require(_0xc5c3('0xa'));var integrations=[_0xc5c3('0xb'),_0xc5c3('0xc'),'sugarcrm','freshdesk','zoho',_0xc5c3('0xd'),_0xc5c3('0xe'),'dynamics365',_0xc5c3('0xf'),_0xc5c3('0x10')];exports['exec']=function(_0x14140f,_0x2a1d19,_0x4e329f,_0x1f2e34,_0x105e43,_0x3b27e8){if(_0x4e329f){if(_['includes'](integrations,_0x14140f[_0xc5c3('0x11')][_0xc5c3('0x12')]())){try{var _0x532065=null;var _0x2b56e6='';var _0x44d2b9=_0x4e329f[_0x14140f[_0xc5c3('0x11')]['toLowerCase']()];if(_0x44d2b9){var _0x2042a0=_0x44d2b9[_0x14140f[_0xc5c3('0x13')]];if(_0x2042a0){var _0x1488ab=_[_0xc5c3('0x14')](_0x2042a0[_0xc5c3('0x15')],{'id':parseInt(_0x14140f['data3'],0xa)});if(_0x1488ab){if(_0x1f2e34){if(_0x105e43&&_0x2a1d19['queue']){_0x2b56e6=_0xc5c3('0x16');}else if(_0x2a1d19[_0xc5c3('0x17')]){_0x2b56e6=_0xc5c3('0x18');}else{console[_0xc5c3('0x19')]('EVENT\x20UNKNOWN',_0x2a1d19);}}else{_0x2b56e6='unmanaged';}switch(_0x14140f[_0xc5c3('0x11')]['toLowerCase']()){case _0xc5c3('0xb'):zendesk[_0x2b56e6](_0x14140f,_0x2a1d19,_0x1488ab,_0x1f2e34,_0x105e43,_0x2042a0,_0x3b27e8);break;case _0xc5c3('0xc'):salesforce[_0x2b56e6](_0x14140f,_0x2a1d19,_0x1488ab,_0x1f2e34,_0x105e43,_0x2042a0,_0x3b27e8);break;case _0xc5c3('0x1a'):sugarcrm[_0x2b56e6](_0x14140f,_0x2a1d19,_0x1488ab,_0x1f2e34,_0x105e43,_0x2042a0,_0x3b27e8);break;case _0xc5c3('0x1b'):freshdesk[_0x2b56e6](_0x14140f,_0x2a1d19,_0x1488ab,_0x1f2e34,_0x105e43,_0x2042a0,_0x3b27e8);break;case _0xc5c3('0x1c'):zoho[_0x2b56e6](_0x14140f,_0x2a1d19,_0x1488ab,_0x1f2e34,_0x105e43,_0x2042a0,_0x3b27e8);break;case'desk':desk[_0x2b56e6](_0x14140f,_0x2a1d19,_0x1488ab,_0x1f2e34,_0x105e43,_0x2042a0,_0x3b27e8);break;case _0xc5c3('0xe'):vtiger[_0x2b56e6](_0x14140f,_0x2a1d19,_0x1488ab,_0x1f2e34,_0x105e43,_0x2042a0,_0x3b27e8);break;case _0xc5c3('0xf'):freshsales['cs'](_0x14140f,_0x2a1d19,_0x1488ab,_0x1f2e34,_0x105e43,_0x2042a0,_0x3b27e8,_0x2b56e6);break;case _0xc5c3('0x10'):servicenow['cs'](_0x14140f,_0x2a1d19,_0x1488ab,_0x1f2e34,_0x105e43,_0x2042a0,_0x3b27e8,_0x2b56e6);break;case _0xc5c3('0x1d'):dynamics365['cs'](_0x14140f,_0x2a1d19,_0x1488ab,_0x1f2e34,_0x105e43,_0x2042a0,_0x3b27e8,_0x2b56e6);break;default:console['log'](_0xc5c3('0x1e'));}}else{_0x532065=require(_0xc5c3('0x1f'))(_0x14140f[_0xc5c3('0x11')][_0xc5c3('0x12')]());_0x532065[_0xc5c3('0x20')]('[EXEC]',util[_0xc5c3('0x21')](_0xc5c3('0x22'),_0x14140f[_0xc5c3('0x11')][_0xc5c3('0x12')](),_0x14140f[_0xc5c3('0x23')]));}}else{_0x532065=require(_0xc5c3('0x1f'))(_0x14140f[_0xc5c3('0x11')]['toLowerCase']());_0x532065['error'](_0xc5c3('0x24'),util[_0xc5c3('0x21')]('%s\x20account\x20#%s\x20not\x20found',_0x14140f['data1'][_0xc5c3('0x12')](),_0x14140f[_0xc5c3('0x13')]));}}else{}}catch(_0x38a3df){console['error'](_0x38a3df);}}}}; \ 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 191f8a2..12fcdb9 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 _0x8efb=['redis','localhost','socket.io-emitter','ticketType','assign','utc','Subjects','getString','Case','ContactId','sobject','isNil','User','execute','then','length','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','identity','resolve','Task','Contact','find','Lead','lead','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','contact','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','create','type','variableName','idField','Variable','name','toLowerCase','toString','password','concat','remoteUri','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','instanceUrl','error','catch','outbound','recordingFormat','[OUTBOUND]','uniqueid','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','stringify','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','defaults'];(function(_0x451d04,_0x999e7d){var _0x32c6fe=function(_0x2be910){while(--_0x2be910){_0x451d04['push'](_0x451d04['shift']());}};_0x32c6fe(++_0x999e7d);}(_0x8efb,0x1e8));var _0xb8ef=function(_0x18f784,_0x2a538f){_0x18f784=_0x18f784-0x0;var _0x4cd072=_0x8efb[_0x18f784];return _0x4cd072;};'use strict';var _=require(_0xb8ef('0x0'));var rp=require(_0xb8ef('0x1'));var moment=require(_0xb8ef('0x2'));var BPromise=require('bluebird');var md5=require(_0xb8ef('0x3'));var jsforce=require(_0xb8ef('0x4'));var util=require(_0xb8ef('0x5'));var Redis=require(_0xb8ef('0x6'));var intUtil=require(_0xb8ef('0x7'));var config=require(_0xb8ef('0x8'));var logger=require(_0xb8ef('0x9'))(_0xb8ef('0xa'));config['redis']=_[_0xb8ef('0xb')](config[_0xb8ef('0xc')],{'host':_0xb8ef('0xd'),'port':0x18eb});var io=require(_0xb8ef('0xe'))(new Redis(config[_0xb8ef('0xc')]));function emit(_0x44a6cb,_0xf00c4f,_0x593745){io['to'](_0x44a6cb)['emit'](_0xf00c4f,_0x593745);}function getTicket(_0x4c06ac,_0x313a16,_0x423174,_0x590016,_0x1074a1,_0x2b69b8,_0x4751cf,_0x15cfd3){var _0x21ac3b={};if(_0x590016[_0xb8ef('0xf')]==='Task'){_0x21ac3b=Object[_0xb8ef('0x10')]({},{'OwnerId':_0x313a16['id'],'ActivityDate':moment[_0xb8ef('0x11')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x590016[_0xb8ef('0x12')],_0x1074a1,'\x20'),'Description':intUtil[_0xb8ef('0x13')](_0x590016['Descriptions'],_0x1074a1,'\x0a')},getCustomFields(_0x2b69b8,_0x1074a1));if(_0x423174){_0x21ac3b['WhoId']=_0x423174['id'];}}else if(_0x590016[_0xb8ef('0xf')]===_0xb8ef('0x14')){_0x21ac3b=Object['assign']({},{'OwnerId':_0x313a16['id'],'Subject':intUtil[_0xb8ef('0x13')](_0x590016[_0xb8ef('0x12')],_0x1074a1,'\x20'),'Description':intUtil[_0xb8ef('0x13')](_0x590016['Descriptions'],_0x1074a1,'\x0a')},getCustomFields(_0x2b69b8,_0x1074a1));if(_0x423174){_0x21ac3b[_0xb8ef('0x15')]=_0x423174['id'];}}return _0x4751cf[_0xb8ef('0x16')](_0x590016['ticketType'])['create'](_0x21ac3b);}function getUser(_0x311502,_0x2ef4f3,_0x4b68f9){if(!_[_0xb8ef('0x17')](_0x2ef4f3)&&intUtil['validateEmail'](_0x2ef4f3)){var _0x5d2121={'Email':_0x2ef4f3};var _0x389d80={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4b68f9[_0xb8ef('0x16')](_0xb8ef('0x18'))['find'](_0x5d2121,_0x389d80)[_0xb8ef('0x19')]()[_0xb8ef('0x1a')](function(_0x350530){if(_0x350530[_0xb8ef('0x1b')]){var _0xc9edf2=_['find'](_0x350530,function(_0x69815b){return _0x69815b['Email']===_0x2ef4f3;});if(_0xc9edf2){logger['info']('Agent\x20%s\x20found.',_0x2ef4f3);return BPromise['resolve']({'id':_0xc9edf2['Id'],'name':_0xc9edf2[_0xb8ef('0x1c')]});}}else{logger[_0xb8ef('0x1d')](_0xb8ef('0x1e'),_0x2ef4f3);return _0x4b68f9['identity']()[_0xb8ef('0x1a')](function(_0x100f2c){return BPromise['resolve']({'id':_0x100f2c[_0xb8ef('0x1f')],'name':_0x100f2c[_0xb8ef('0x20')]});});}});}else{logger[_0xb8ef('0x1d')](_0xb8ef('0x1e'),_0x2ef4f3);return _0x4b68f9[_0xb8ef('0x21')]()[_0xb8ef('0x1a')](function(_0x3f5f3c){return BPromise['resolve']({'id':_0x3f5f3c['user_id'],'name':_0x3f5f3c['display_name']});});}}function getEndUser(_0x54f62e,_0x209707,_0x48ea90,_0x5143ee,_0x46a210){var _0x3fb803={'Phone':_0x5143ee};var _0x8ae446={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xb8ef('0x22')]()[_0xb8ef('0x1a')](function(){if(_0x209707[_0xb8ef('0xf')]===_0xb8ef('0x23')){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x5143ee,_0x209707['moduleSearch']);switch(_0x209707['moduleSearch']){case'contact_lead':return _0x46a210[_0xb8ef('0x16')](_0xb8ef('0x24'))[_0xb8ef('0x25')](_0x3fb803,_0x8ae446)[_0xb8ef('0x19')]()['then'](function(_0x4e5d5d){if(_0x4e5d5d&&_0x4e5d5d[_0xb8ef('0x1b')]){return _0x4e5d5d;}else{return _0x46a210['sobject'](_0xb8ef('0x26'))['find'](_0x3fb803,_0x8ae446);}});case'contact':return _0x46a210[_0xb8ef('0x16')](_0xb8ef('0x24'))[_0xb8ef('0x25')](_0x3fb803,_0x8ae446)[_0xb8ef('0x19')]();case _0xb8ef('0x27'):return _0x46a210[_0xb8ef('0x16')](_0xb8ef('0x26'))['find'](_0x3fb803,_0x8ae446);default:return null;}}else if(_0x209707[_0xb8ef('0xf')]==='Case'){logger['info'](_0xb8ef('0x28'),_0x5143ee,_0xb8ef('0x29'));return _0x46a210['sobject']('Contact')[_0xb8ef('0x25')](_0x3fb803,_0x8ae446)[_0xb8ef('0x19')]();}})[_0xb8ef('0x1a')](function(_0x3396a0){if(_0x3396a0&&_0x3396a0['length']){var _0xcef791=_[_0xb8ef('0x25')](_0x3396a0,function(_0x3d19a1){return _0x3d19a1[_0xb8ef('0x2a')]===_0x5143ee;});if(_0xcef791){return BPromise[_0xb8ef('0x22')]({'id':_0xcef791['Id'],'name':_0xcef791[_0xb8ef('0x1c')],'phone':_0xcef791[_0xb8ef('0x2a')]});}}})['then'](function(_0x3444e6){if(_0x3444e6){logger[_0xb8ef('0x1d')](_0xb8ef('0x2b'),_0x5143ee);return BPromise[_0xb8ef('0x22')](_0x3444e6);}else{logger['info'](_0xb8ef('0x2c'),_0x5143ee);var _0x45ce01={'LastName':_0x48ea90!==_0xb8ef('0x2d')?_0x48ea90:util[_0xb8ef('0x2e')]('Caller\x20-\x20%s',_0x5143ee),'Phone':_0x5143ee};if(_0x209707[_0xb8ef('0x2f')]){if(_0x209707['moduleCreate']==='contact'){logger['info'](_0xb8ef('0x30'),_0x5143ee,_0x209707['moduleCreate']);}else if(_0x209707[_0xb8ef('0x2f')]===_0xb8ef('0x27')&&_0x209707['ticketType']===_0xb8ef('0x23')){logger[_0xb8ef('0x1d')](_0xb8ef('0x30'),_0x5143ee,_0x209707[_0xb8ef('0x2f')]);_0x45ce01[_0xb8ef('0x31')]=_0xb8ef('0x32');}else{return null;}}return _0x46a210['sobject'](_[_0xb8ef('0x33')](_0x209707[_0xb8ef('0x2f')]))[_0xb8ef('0x34')](_0x45ce01);}});}function getCustomFields(_0x4ff861,_0x54798b){var _0x48f33b={};if(_0x4ff861[_0xb8ef('0x1b')]>0x0){_['forEach'](_0x4ff861,function(_0x3e595b){if(_0x3e595b['type']==='string'&&_0x3e595b['idField']){_0x48f33b[_0x3e595b['idField']]=_0x3e595b['content']['toString']();}else if(_0x3e595b[_0xb8ef('0x35')]==='variable'&&_0x3e595b[_0xb8ef('0x36')]&&_0x3e595b[_0xb8ef('0x37')]){_0x54798b[_0x3e595b[_0xb8ef('0x36')]]&&(_0x48f33b[_0x3e595b[_0xb8ef('0x37')]]=_0x54798b[_0x3e595b[_0xb8ef('0x36')]]['toString']());}else if(_0x3e595b[_0xb8ef('0x35')]==='customVariable'&&_0x3e595b[_0xb8ef('0x38')]&&_0x3e595b[_0xb8ef('0x38')][_0xb8ef('0x39')]&&_0x3e595b['idField']){_0x54798b[_0x3e595b[_0xb8ef('0x38')][_0xb8ef('0x39')][_0xb8ef('0x3a')]()]&&(_0x48f33b[_0x3e595b[_0xb8ef('0x37')]]=_0x54798b[_0x3e595b['Variable'][_0xb8ef('0x39')][_0xb8ef('0x3a')]()][_0xb8ef('0x3b')]());}});}return _0x48f33b;}function getConnection(_0x163314){var _0x5e6da4=_0x163314[_0xb8ef('0x3c')][_0xb8ef('0x3d')](_0x163314['securityToken']);var _0x5b281a=new jsforce['Connection']({'oauth2':{'loginUrl':_0x163314[_0xb8ef('0x3e')]||'https://login.salesforce.com','clientId':_0x163314['clientId'],'clientSecret':_0x163314['clientSecret']}});return _0x5b281a['login'](_0x163314[_0xb8ef('0x3f')],_0x5e6da4)[_0xb8ef('0x1a')](function(){logger[_0xb8ef('0x1d')](_0xb8ef('0x40'));return _0x5b281a;});}exports[_0xb8ef('0x41')]=function(_0x2b6086,_0x1522be,_0x1a4a1f,_0x82cdab,_0x351669,_0x155e95){var _0x2a5408,_0x53871d,_0x12d92a,_0x161462;_0x155e95[_0xb8ef('0x42')]=intUtil[_0xb8ef('0x43')](_0x155e95['serverUrl']);_0x155e95['remoteUri']=intUtil[_0xb8ef('0x43')](_0x155e95['remoteUri']);if(_0x351669&&_0x351669[_0xb8ef('0x44')]){logger['info'](_0xb8ef('0x45'),_0xb8ef('0x46'));_0x1522be[_0xb8ef('0x47')]=util[_0xb8ef('0x2e')](_0xb8ef('0x48'),_0x155e95[_0xb8ef('0x42')],_0x1522be['uniqueid'],md5(_0x1522be['uniqueid']));}else{_0x1522be[_0xb8ef('0x47')]='';}return getConnection(_0x155e95)['then'](function(_0x47af9c){_0x161462=_0x47af9c;return getUser(_0x155e95,_0x82cdab[_0xb8ef('0x49')],_0x161462);})[_0xb8ef('0x1a')](function(_0x1c6d3a){_0x2a5408=_0x1c6d3a;return getEndUser(_0x155e95,_0x1a4a1f,_0x1522be[_0xb8ef('0x4a')],_0x1522be[_0xb8ef('0x4b')],_0x161462);})[_0xb8ef('0x1a')](function(_0x4a8a17){_0x53871d=_0x4a8a17;return getTicket(_0x155e95,_0x2a5408,_0x53871d,_0x1a4a1f,_0x1522be,_0x1a4a1f[_0xb8ef('0x4c')],_0x161462,_0xb8ef('0x41'));})[_0xb8ef('0x1a')](function(_0x113285){_0x12d92a=_0x113285;logger[_0xb8ef('0x1d')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x12d92a['id']);logger[_0xb8ef('0x1d')](_0xb8ef('0x4d'),_0x12d92a['id'],_0x82cdab[_0xb8ef('0x39')],_0x155e95['type']);switch(_0x155e95[_0xb8ef('0x35')]){case _0xb8ef('0x4e'):emit(util['format']('user:%s',_0x82cdab[_0xb8ef('0x39')]),_0xb8ef('0x4f'),{'recordId':_0x12d92a['id']});break;case _0xb8ef('0x50'):emit(util[_0xb8ef('0x2e')](_0xb8ef('0x51'),_0x82cdab[_0xb8ef('0x39')]),_0xb8ef('0x52'),{'uri':util[_0xb8ef('0x2e')]('%s/%s/e',_0x161462[_0xb8ef('0x53')],_0x12d92a['id'])});break;default:logger[_0xb8ef('0x54')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xb8ef('0x55')](function(_0x4c0c0a){logger[_0xb8ef('0x54')](_0xb8ef('0x45'),JSON['stringify'](_0x4c0c0a));});};exports[_0xb8ef('0x56')]=function(_0x4d228a,_0x53e621,_0x45c41a,_0x32e89a,_0x4ba5ae,_0x1a01d8,_0x193737){var _0x2c9a89,_0x77863e,_0x294446,_0x14fe21;_0x1a01d8['serverUrl']=intUtil['stripTrailingSlash'](_0x1a01d8['serverUrl']);_0x1a01d8[_0xb8ef('0x3e')]=intUtil[_0xb8ef('0x43')](_0x1a01d8['remoteUri']);if(_0x193737&&_0x193737[_0xb8ef('0x57')]&&_0x193737['recordingFormat']!=='none'){logger[_0xb8ef('0x1d')](_0xb8ef('0x58'),'Recording\x20is\x20enabled!');_0x53e621[_0xb8ef('0x47')]=util['format'](_0xb8ef('0x48'),_0x1a01d8['serverUrl'],_0x53e621['uniqueid'],md5(_0x53e621[_0xb8ef('0x59')]));}return getConnection(_0x1a01d8)[_0xb8ef('0x1a')](function(_0x58c1f1){_0x14fe21=_0x58c1f1;return getUser(_0x1a01d8,_0x32e89a['email'],_0x14fe21);})[_0xb8ef('0x1a')](function(_0x5842cc){_0x2c9a89=_0x5842cc;return getEndUser(_0x1a01d8,_0x45c41a,_0x53e621['destcalleridname'],_0x53e621[_0xb8ef('0x5a')],_0x14fe21);})[_0xb8ef('0x1a')](function(_0x13b82b){_0x77863e=_0x13b82b;return getTicket(_0x1a01d8,_0x2c9a89,_0x77863e,_0x45c41a,_0x53e621,_0x45c41a['Fields'],_0x14fe21,_0xb8ef('0x56'));})[_0xb8ef('0x1a')](function(_0x592e40){_0x294446=_0x592e40;logger[_0xb8ef('0x1d')](_0xb8ef('0x5b'),_0x294446['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x294446['id'],_0x32e89a[_0xb8ef('0x39')],_0x1a01d8[_0xb8ef('0x35')]);switch(_0x1a01d8[_0xb8ef('0x35')]){case'integrationTab':emit(util[_0xb8ef('0x2e')]('user:%s',_0x32e89a[_0xb8ef('0x39')]),_0xb8ef('0x4f'),{'recordId':_0x294446['id']});break;case _0xb8ef('0x50'):emit(util[_0xb8ef('0x2e')](_0xb8ef('0x51'),_0x32e89a[_0xb8ef('0x39')]),'trigger:browser:url',{'uri':util[_0xb8ef('0x2e')](_0xb8ef('0x5c'),_0x14fe21[_0xb8ef('0x53')],_0x294446['id'])});break;default:logger[_0xb8ef('0x54')](_0xb8ef('0x58'),_0xb8ef('0x5d'));}})[_0xb8ef('0x55')](function(_0x19e9f9){logger[_0xb8ef('0x54')](_0xb8ef('0x58'),JSON[_0xb8ef('0x5e')](_0x19e9f9));});};exports[_0xb8ef('0x5f')]=function(_0x7764d4,_0x2599f,_0x287b09,_0x80548a,_0x186538,_0x1021ec){var _0x3e284b,_0x3f55d8,_0x50ae4d,_0x3658dd;_0x1021ec[_0xb8ef('0x42')]=intUtil[_0xb8ef('0x43')](_0x1021ec[_0xb8ef('0x42')]);_0x1021ec[_0xb8ef('0x3e')]=intUtil[_0xb8ef('0x43')](_0x1021ec[_0xb8ef('0x3e')]);if(_0x186538&&_0x186538['monitor_format']){logger[_0xb8ef('0x1d')]('['+_0x2599f[_0xb8ef('0x60')][_0xb8ef('0x61')]()+']',_0xb8ef('0x46'));_0x2599f[_0xb8ef('0x47')]=util[_0xb8ef('0x2e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1021ec['serverUrl'],_0x2599f[_0xb8ef('0x59')],md5(_0x2599f[_0xb8ef('0x59')]));}else{_0x2599f[_0xb8ef('0x47')]='';}return getConnection(_0x1021ec)['then'](function(_0x41a221){_0x3658dd=_0x41a221;if(!_[_0xb8ef('0x17')](_0x80548a)){return getUser(_0x1021ec,_0x80548a[_0xb8ef('0x39')],_0x3658dd);}else{return getUser(_0x1021ec,null,_0x3658dd);}})[_0xb8ef('0x1a')](function(_0x1b0571){_0x3e284b=_0x1b0571;return getEndUser(_0x1021ec,_0x287b09,_0x2599f[_0xb8ef('0x4a')],_0x2599f[_0xb8ef('0x4b')],_0x3658dd);})['then'](function(_0x5cdbf1){_0x3f55d8=_0x5cdbf1;return getTicket(_0x1021ec,_0x3e284b,_0x3f55d8,_0x287b09,_0x2599f,_0x287b09['Fields'],_0x3658dd);})[_0xb8ef('0x1a')](function(_0xa3b596){_0x50ae4d=_0xa3b596;logger[_0xb8ef('0x1d')]('['+_0x2599f[_0xb8ef('0x60')]['toUpperCase']()+_0xb8ef('0x62'),_0x50ae4d['id']);logger[_0xb8ef('0x1d')]('['+_0x2599f[_0xb8ef('0x60')][_0xb8ef('0x61')]()+_0xb8ef('0x63'),_0x1021ec[_0xb8ef('0x35')]);})['catch'](function(_0x389b51){logger[_0xb8ef('0x54')]('['+_0x2599f['lastevent'][_0xb8ef('0x61')]()+']',JSON[_0xb8ef('0x5e')](_0x389b51));});}; \ No newline at end of file +var _0x0d0b=['destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','trigger:browser:url','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','stringify','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','emit','ticketType','Task','assign','utc','getString','Descriptions','WhoId','Case','ContactId','create','isNil','sobject','User','find','then','Email','resolve','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','execute','Lead','contact','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','length','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','forEach','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','calleridname','calleridnum','[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','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname'];(function(_0x311037,_0x50198f){var _0x1c6b75=function(_0x566d01){while(--_0x566d01){_0x311037['push'](_0x311037['shift']());}};_0x1c6b75(++_0x50198f);}(_0x0d0b,0x79));var _0xb0d0=function(_0x306c86,_0x2eff92){_0x306c86=_0x306c86-0x0;var _0x4f9148=_0x0d0b[_0x306c86];return _0x4f9148;};'use strict';var _=require(_0xb0d0('0x0'));var rp=require(_0xb0d0('0x1'));var moment=require(_0xb0d0('0x2'));var BPromise=require(_0xb0d0('0x3'));var md5=require(_0xb0d0('0x4'));var jsforce=require(_0xb0d0('0x5'));var util=require(_0xb0d0('0x6'));var Redis=require('ioredis');var intUtil=require(_0xb0d0('0x7'));var config=require(_0xb0d0('0x8'));var logger=require(_0xb0d0('0x9'))(_0xb0d0('0xa'));config['redis']=_['defaults'](config[_0xb0d0('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x56f0f9,_0xbb4d3c,_0x1e278a){io['to'](_0x56f0f9)[_0xb0d0('0xc')](_0xbb4d3c,_0x1e278a);}function getTicket(_0x1ec465,_0x130bcc,_0x3364df,_0x10a0c3,_0x29ed9f,_0x1f5eb2,_0x49c902,_0x5e1fa1){var _0x3e2089={};if(_0x10a0c3[_0xb0d0('0xd')]===_0xb0d0('0xe')){_0x3e2089=Object[_0xb0d0('0xf')]({},{'OwnerId':_0x130bcc['id'],'ActivityDate':moment[_0xb0d0('0x10')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xb0d0('0x11')](_0x10a0c3['Subjects'],_0x29ed9f,'\x20'),'Description':intUtil['getString'](_0x10a0c3[_0xb0d0('0x12')],_0x29ed9f,'\x0a')},getCustomFields(_0x1f5eb2,_0x29ed9f));if(_0x3364df){_0x3e2089[_0xb0d0('0x13')]=_0x3364df['id'];}}else if(_0x10a0c3['ticketType']===_0xb0d0('0x14')){_0x3e2089=Object[_0xb0d0('0xf')]({},{'OwnerId':_0x130bcc['id'],'Subject':intUtil[_0xb0d0('0x11')](_0x10a0c3['Subjects'],_0x29ed9f,'\x20'),'Description':intUtil['getString'](_0x10a0c3['Descriptions'],_0x29ed9f,'\x0a')},getCustomFields(_0x1f5eb2,_0x29ed9f));if(_0x3364df){_0x3e2089[_0xb0d0('0x15')]=_0x3364df['id'];}}return _0x49c902['sobject'](_0x10a0c3[_0xb0d0('0xd')])[_0xb0d0('0x16')](_0x3e2089);}function getUser(_0x3f3b83,_0x5a0516,_0x518552){if(!_[_0xb0d0('0x17')](_0x5a0516)&&intUtil['validateEmail'](_0x5a0516)){var _0x4b8468={'Email':_0x5a0516};var _0xbeae7={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x518552[_0xb0d0('0x18')](_0xb0d0('0x19'))[_0xb0d0('0x1a')](_0x4b8468,_0xbeae7)['execute']()[_0xb0d0('0x1b')](function(_0x11da49){if(_0x11da49['length']){var _0x2ac2d3=_['find'](_0x11da49,function(_0x1edb16){return _0x1edb16[_0xb0d0('0x1c')]===_0x5a0516;});if(_0x2ac2d3){logger['info']('Agent\x20%s\x20found.',_0x5a0516);return BPromise[_0xb0d0('0x1d')]({'id':_0x2ac2d3['Id'],'name':_0x2ac2d3[_0xb0d0('0x1e')]});}}else{logger[_0xb0d0('0x1f')](_0xb0d0('0x20'),_0x5a0516);return _0x518552[_0xb0d0('0x21')]()[_0xb0d0('0x1b')](function(_0x14aab6){return BPromise[_0xb0d0('0x1d')]({'id':_0x14aab6[_0xb0d0('0x22')],'name':_0x14aab6[_0xb0d0('0x23')]});});}});}else{logger[_0xb0d0('0x1f')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x5a0516);return _0x518552[_0xb0d0('0x21')]()[_0xb0d0('0x1b')](function(_0x2a2c71){return BPromise[_0xb0d0('0x1d')]({'id':_0x2a2c71[_0xb0d0('0x22')],'name':_0x2a2c71[_0xb0d0('0x23')]});});}}function getEndUser(_0xfeed51,_0x2b9004,_0x5eaffa,_0x3dfea5,_0x52e698){var _0x14b4c0={'Phone':_0x3dfea5};var _0x3cd1bb={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xb0d0('0x1d')]()[_0xb0d0('0x1b')](function(){if(_0x2b9004['ticketType']===_0xb0d0('0xe')){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x3dfea5,_0x2b9004[_0xb0d0('0x24')]);switch(_0x2b9004[_0xb0d0('0x24')]){case'contact_lead':return _0x52e698[_0xb0d0('0x18')]('Contact')['find'](_0x14b4c0,_0x3cd1bb)[_0xb0d0('0x25')]()[_0xb0d0('0x1b')](function(_0x5ccf23){if(_0x5ccf23&&_0x5ccf23['length']){return _0x5ccf23;}else{return _0x52e698['sobject'](_0xb0d0('0x26'))['find'](_0x14b4c0,_0x3cd1bb);}});case _0xb0d0('0x27'):return _0x52e698[_0xb0d0('0x18')]('Contact')[_0xb0d0('0x1a')](_0x14b4c0,_0x3cd1bb)[_0xb0d0('0x25')]();case'lead':return _0x52e698[_0xb0d0('0x18')](_0xb0d0('0x26'))[_0xb0d0('0x1a')](_0x14b4c0,_0x3cd1bb);default:return null;}}else if(_0x2b9004[_0xb0d0('0xd')]===_0xb0d0('0x14')){logger[_0xb0d0('0x1f')](_0xb0d0('0x28'),_0x3dfea5,'contact');return _0x52e698[_0xb0d0('0x18')]('Contact')['find'](_0x14b4c0,_0x3cd1bb)['execute']();}})[_0xb0d0('0x1b')](function(_0x2de27b){if(_0x2de27b&&_0x2de27b[_0xb0d0('0x29')]){var _0x554429=_['find'](_0x2de27b,function(_0x29e0e8){return _0x29e0e8[_0xb0d0('0x2a')]===_0x3dfea5;});if(_0x554429){return BPromise[_0xb0d0('0x1d')]({'id':_0x554429['Id'],'name':_0x554429[_0xb0d0('0x1e')],'phone':_0x554429[_0xb0d0('0x2a')]});}}})['then'](function(_0x498c8d){if(_0x498c8d){logger[_0xb0d0('0x1f')](_0xb0d0('0x2b'),_0x3dfea5);return BPromise['resolve'](_0x498c8d);}else{logger[_0xb0d0('0x1f')](_0xb0d0('0x2c'),_0x3dfea5);var _0x38cc92={'LastName':_0x5eaffa!==''?_0x5eaffa:util[_0xb0d0('0x2d')](_0xb0d0('0x2e'),_0x3dfea5),'Phone':_0x3dfea5};if(_0x2b9004[_0xb0d0('0x2f')]){if(_0x2b9004[_0xb0d0('0x2f')]===_0xb0d0('0x27')){logger[_0xb0d0('0x1f')](_0xb0d0('0x30'),_0x3dfea5,_0x2b9004['moduleCreate']);}else if(_0x2b9004['moduleCreate']==='lead'&&_0x2b9004[_0xb0d0('0xd')]===_0xb0d0('0xe')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3dfea5,_0x2b9004[_0xb0d0('0x2f')]);_0x38cc92[_0xb0d0('0x31')]=_0xb0d0('0x32');}else{return null;}}return _0x52e698[_0xb0d0('0x18')](_[_0xb0d0('0x33')](_0x2b9004[_0xb0d0('0x2f')]))[_0xb0d0('0x16')](_0x38cc92);}});}function getCustomFields(_0x350293,_0x38714d){var _0x4f6e68={};if(_0x350293[_0xb0d0('0x29')]>0x0){_[_0xb0d0('0x34')](_0x350293,function(_0x3e3178){if(_0x3e3178[_0xb0d0('0x35')]==='string'&&_0x3e3178[_0xb0d0('0x36')]){_0x4f6e68[_0x3e3178['idField']]=_0x3e3178[_0xb0d0('0x37')]['toString']();}else if(_0x3e3178[_0xb0d0('0x35')]===_0xb0d0('0x38')&&_0x3e3178[_0xb0d0('0x39')]&&_0x3e3178[_0xb0d0('0x36')]){_0x38714d[_0x3e3178[_0xb0d0('0x39')]]&&(_0x4f6e68[_0x3e3178[_0xb0d0('0x36')]]=_0x38714d[_0x3e3178[_0xb0d0('0x39')]][_0xb0d0('0x3a')]());}else if(_0x3e3178[_0xb0d0('0x35')]===_0xb0d0('0x3b')&&_0x3e3178[_0xb0d0('0x3c')]&&_0x3e3178[_0xb0d0('0x3c')][_0xb0d0('0x3d')]&&_0x3e3178['idField']){_0x38714d[_0x3e3178[_0xb0d0('0x3c')][_0xb0d0('0x3d')][_0xb0d0('0x3e')]()]&&(_0x4f6e68[_0x3e3178[_0xb0d0('0x36')]]=_0x38714d[_0x3e3178[_0xb0d0('0x3c')][_0xb0d0('0x3d')][_0xb0d0('0x3e')]()][_0xb0d0('0x3a')]());}});}return _0x4f6e68;}function getConnection(_0x2e13a5){var _0xb4d6d6=_0x2e13a5[_0xb0d0('0x3f')][_0xb0d0('0x40')](_0x2e13a5[_0xb0d0('0x41')]);var _0x6f9cd9=new jsforce[(_0xb0d0('0x42'))]({'oauth2':{'loginUrl':_0x2e13a5[_0xb0d0('0x43')]||'https://login.salesforce.com','clientId':_0x2e13a5['clientId'],'clientSecret':_0x2e13a5[_0xb0d0('0x44')]}});return _0x6f9cd9[_0xb0d0('0x45')](_0x2e13a5[_0xb0d0('0x46')],_0xb4d6d6)[_0xb0d0('0x1b')](function(){logger['info'](_0xb0d0('0x47'));return _0x6f9cd9;});}exports[_0xb0d0('0x48')]=function(_0x38f3f6,_0x1f86d6,_0x324711,_0x53714c,_0x2578c2,_0x4617c6){var _0x3eaf05,_0x14f59f,_0x4922df,_0x4e3505;_0x4617c6[_0xb0d0('0x49')]=intUtil[_0xb0d0('0x4a')](_0x4617c6[_0xb0d0('0x49')]);_0x4617c6[_0xb0d0('0x43')]=intUtil['stripTrailingSlash'](_0x4617c6[_0xb0d0('0x43')]);if(_0x2578c2&&_0x2578c2['monitor_format']){logger[_0xb0d0('0x1f')](_0xb0d0('0x4b'),_0xb0d0('0x4c'));_0x1f86d6[_0xb0d0('0x4d')]=util[_0xb0d0('0x2d')](_0xb0d0('0x4e'),_0x4617c6[_0xb0d0('0x49')],_0x1f86d6['uniqueid'],md5(_0x1f86d6['uniqueid']));}else{_0x1f86d6[_0xb0d0('0x4d')]='';}return getConnection(_0x4617c6)[_0xb0d0('0x1b')](function(_0x43fd29){_0x4e3505=_0x43fd29;return getUser(_0x4617c6,_0x53714c[_0xb0d0('0x4f')],_0x4e3505);})['then'](function(_0x871855){_0x3eaf05=_0x871855;return getEndUser(_0x4617c6,_0x324711,_0x1f86d6[_0xb0d0('0x50')],_0x1f86d6[_0xb0d0('0x51')],_0x4e3505);})[_0xb0d0('0x1b')](function(_0x3cb9d0){_0x14f59f=_0x3cb9d0;return getTicket(_0x4617c6,_0x3eaf05,_0x14f59f,_0x324711,_0x1f86d6,_0x324711['Fields'],_0x4e3505,'queue');})['then'](function(_0x3b80cc){_0x4922df=_0x3b80cc;logger[_0xb0d0('0x1f')](_0xb0d0('0x52'),_0x4922df['id']);logger[_0xb0d0('0x1f')](_0xb0d0('0x53'),_0x4922df['id'],_0x53714c[_0xb0d0('0x3d')],_0x4617c6[_0xb0d0('0x35')]);switch(_0x4617c6[_0xb0d0('0x35')]){case _0xb0d0('0x54'):emit(util['format'](_0xb0d0('0x55'),_0x53714c[_0xb0d0('0x3d')]),_0xb0d0('0x56'),{'recordId':_0x4922df['id']});break;case _0xb0d0('0x57'):emit(util['format'](_0xb0d0('0x55'),_0x53714c['name']),'trigger:browser:url',{'uri':util[_0xb0d0('0x2d')](_0xb0d0('0x58'),_0x4e3505['instanceUrl'],_0x4922df['id'])});break;default:logger[_0xb0d0('0x59')](_0xb0d0('0x5a'));}})[_0xb0d0('0x5b')](function(_0x2ddedd){logger[_0xb0d0('0x59')](_0xb0d0('0x4b'),JSON['stringify'](_0x2ddedd));});};exports['outbound']=function(_0x54a189,_0x65ace5,_0x23c706,_0x39b7de,_0x9b309b,_0x5c5c23,_0x5f0328){var _0x21d7b7,_0x2a3943,_0x37fa7f,_0x5f3923;_0x5c5c23[_0xb0d0('0x49')]=intUtil[_0xb0d0('0x4a')](_0x5c5c23[_0xb0d0('0x49')]);_0x5c5c23[_0xb0d0('0x43')]=intUtil[_0xb0d0('0x4a')](_0x5c5c23['remoteUri']);if(_0x5f0328&&_0x5f0328['recordingFormat']&&_0x5f0328[_0xb0d0('0x5c')]!==_0xb0d0('0x5d')){logger['info'](_0xb0d0('0x5e'),_0xb0d0('0x4c'));_0x65ace5[_0xb0d0('0x4d')]=util[_0xb0d0('0x2d')](_0xb0d0('0x4e'),_0x5c5c23[_0xb0d0('0x49')],_0x65ace5[_0xb0d0('0x5f')],md5(_0x65ace5[_0xb0d0('0x5f')]));}return getConnection(_0x5c5c23)[_0xb0d0('0x1b')](function(_0x5b622b){_0x5f3923=_0x5b622b;return getUser(_0x5c5c23,_0x39b7de[_0xb0d0('0x4f')],_0x5f3923);})['then'](function(_0x5b4425){_0x21d7b7=_0x5b4425;return getEndUser(_0x5c5c23,_0x23c706,_0x65ace5[_0xb0d0('0x60')],_0x65ace5[_0xb0d0('0x61')],_0x5f3923);})[_0xb0d0('0x1b')](function(_0x5a06f1){_0x2a3943=_0x5a06f1;return getTicket(_0x5c5c23,_0x21d7b7,_0x2a3943,_0x23c706,_0x65ace5,_0x23c706['Fields'],_0x5f3923,_0xb0d0('0x62'));})[_0xb0d0('0x1b')](function(_0x570941){_0x37fa7f=_0x570941;logger[_0xb0d0('0x1f')](_0xb0d0('0x63'),_0x37fa7f['id']);logger[_0xb0d0('0x1f')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x37fa7f['id'],_0x39b7de[_0xb0d0('0x3d')],_0x5c5c23[_0xb0d0('0x35')]);switch(_0x5c5c23[_0xb0d0('0x35')]){case _0xb0d0('0x54'):emit(util[_0xb0d0('0x2d')]('user:%s',_0x39b7de[_0xb0d0('0x3d')]),_0xb0d0('0x56'),{'recordId':_0x37fa7f['id']});break;case _0xb0d0('0x57'):emit(util['format'](_0xb0d0('0x55'),_0x39b7de[_0xb0d0('0x3d')]),_0xb0d0('0x64'),{'uri':util[_0xb0d0('0x2d')](_0xb0d0('0x58'),_0x5f3923[_0xb0d0('0x65')],_0x37fa7f['id'])});break;default:logger[_0xb0d0('0x59')](_0xb0d0('0x5e'),_0xb0d0('0x66'));}})[_0xb0d0('0x5b')](function(_0x5037ec){logger[_0xb0d0('0x59')]('[OUTBOUND]',JSON[_0xb0d0('0x67')](_0x5037ec));});};exports[_0xb0d0('0x68')]=function(_0x283ad3,_0x15754c,_0xf4b45b,_0x1c55c4,_0x565187,_0x4670ef){var _0x256554,_0x2aa0e1,_0xaf5e12,_0x4b8c51;_0x4670ef[_0xb0d0('0x49')]=intUtil[_0xb0d0('0x4a')](_0x4670ef['serverUrl']);_0x4670ef[_0xb0d0('0x43')]=intUtil[_0xb0d0('0x4a')](_0x4670ef[_0xb0d0('0x43')]);if(_0x565187&&_0x565187['monitor_format']){logger['info']('['+_0x15754c['lastevent']['toUpperCase']()+']',_0xb0d0('0x4c'));_0x15754c['recordingURL']=util[_0xb0d0('0x2d')](_0xb0d0('0x4e'),_0x4670ef[_0xb0d0('0x49')],_0x15754c[_0xb0d0('0x5f')],md5(_0x15754c[_0xb0d0('0x5f')]));}else{_0x15754c[_0xb0d0('0x4d')]='';}return getConnection(_0x4670ef)['then'](function(_0x525ec7){_0x4b8c51=_0x525ec7;if(!_[_0xb0d0('0x17')](_0x1c55c4)){return getUser(_0x4670ef,_0x1c55c4[_0xb0d0('0x3d')],_0x4b8c51);}else{return getUser(_0x4670ef,null,_0x4b8c51);}})[_0xb0d0('0x1b')](function(_0x4e17e5){_0x256554=_0x4e17e5;return getEndUser(_0x4670ef,_0xf4b45b,_0x15754c['calleridname'],_0x15754c['calleridnum'],_0x4b8c51);})[_0xb0d0('0x1b')](function(_0x185934){_0x2aa0e1=_0x185934;return getTicket(_0x4670ef,_0x256554,_0x2aa0e1,_0xf4b45b,_0x15754c,_0xf4b45b['Fields'],_0x4b8c51);})[_0xb0d0('0x1b')](function(_0x261c80){_0xaf5e12=_0x261c80;logger[_0xb0d0('0x1f')]('['+_0x15754c[_0xb0d0('0x69')][_0xb0d0('0x6a')]()+_0xb0d0('0x6b'),_0xaf5e12['id']);logger[_0xb0d0('0x1f')]('['+_0x15754c[_0xb0d0('0x69')][_0xb0d0('0x6a')]()+_0xb0d0('0x6c'),_0x4670ef[_0xb0d0('0x35')]);})['catch'](function(_0x331d7b){logger[_0xb0d0('0x59')]('['+_0x15754c[_0xb0d0('0x69')][_0xb0d0('0x6a')]()+']',JSON['stringify'](_0x331d7b));});}; \ 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 56e4870..3a7ab44 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 _0x1261=['recordingURL','The\x20ticket\x20ID\x20is:\x20%s','format','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','GET','],\x20getUser\x20rp\x20obj','then','length','active','true','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','string','nameField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','customField','name',']\x20getTicket\x20input\x20crm','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','?sysparm_query=name%3D','label_entry','Incident\x20-\x20',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','user:%s','emit','username','password','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','userEmail','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none'];(function(_0x3367b7,_0x1e0234){var _0x52bb97=function(_0x2155f2){while(--_0x2155f2){_0x3367b7['push'](_0x3367b7['shift']());}};_0x52bb97(++_0x1e0234);}(_0x1261,0x144));var _0x1126=function(_0x5dc755,_0x3254d0){_0x5dc755=_0x5dc755-0x0;var _0x24ce81=_0x1261[_0x5dc755];return _0x24ce81;};'use strict';var _=require('lodash');var Promise=require(_0x1126('0x0'));var rp=require(_0x1126('0x1'));var util=require(_0x1126('0x2'));var md5=require(_0x1126('0x3'));var Redis=require(_0x1126('0x4'));var intUtil=require(_0x1126('0x5'));var config=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));config[_0x1126('0x9')]=_['defaults'](config['redis'],{'host':_0x1126('0xa'),'port':0x18eb});var io=require(_0x1126('0xb'))(new Redis(config['redis']));function getAdminUser(_0x17e5f0,_0x28772d,_0x245be9,_0x3abb0b,_0x2d9033,_0x59cfa1){return new Promise(function(_0x3f09ac,_0x18dbe6){var _0x167ef1={'method':'GET','uri':_0x3abb0b+_0x1126('0xc')+'&'+_0x2d9033+'&'+_0x59cfa1,'auth':_0x28772d,'json':!![]};return rp(_0x167ef1)['then'](function(_0x52ef15){if(_0x52ef15[_0x1126('0xd')]['length']>0x0){_0x245be9[_0x1126('0xe')]=_0x52ef15[_0x1126('0xd')][0x0][_0x1126('0xf')];}logger[_0x1126('0x10')]('['+[_0x17e5f0[_0x1126('0x11')]()]+_0x1126('0x12'),_0x245be9);_0x3f09ac(_0x245be9);})[_0x1126('0x13')](function(_0x2048ad){logger[_0x1126('0x14')]('['+[_0x17e5f0['toUpperCase']()]+']',_0x2048ad['message']);_0x18dbe6(_0x2048ad[_0x1126('0x15')]);});});}function getUser(_0x154e20,_0x279455,_0x4be0c6,_0x45149c,_0x4794a7){return function(_0x35fe9f){logger[_0x1126('0x10')]('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x35fe9f);return new Promise(function(_0x245cd7,_0x1695f6){if(intUtil['validateEmail'](_0x35fe9f['userEmail'])){var _0x22ae0b={'method':_0x1126('0x16'),'uri':_0x4be0c6+'sys_user?sysparm_query=email%3D'+_0x35fe9f['userEmail']+'&'+_0x45149c+'&'+_0x4794a7,'auth':_0x279455,'json':!![]};logger[_0x1126('0x10')]('['+[_0x154e20['toUpperCase']()]+_0x1126('0x17'),_0x22ae0b);return rp(_0x22ae0b)[_0x1126('0x18')](function(_0x2f70ac){logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20entity',_0x2f70ac);if(_0x2f70ac['result'][_0x1126('0x19')]>0x0&&String(_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0x1a')])===_0x1126('0x1b')){_0x35fe9f['userId']=_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0xf')];}else{_0x35fe9f['userId']=_0x35fe9f[_0x1126('0xe')];_0x35fe9f['userEmail']=_0x35fe9f['adminEmail'];}logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1c'),_0x35fe9f);_0x245cd7(_0x35fe9f);})[_0x1126('0x13')](function(_0x34bcf1){logger[_0x1126('0x14')]('['+[_0x154e20[_0x1126('0x11')]()]+']',_0x34bcf1[_0x1126('0x15')]);_0x1695f6(_0x34bcf1[_0x1126('0x15')]);});}else{logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1d'));_0x35fe9f[_0x1126('0x1e')]=_0x35fe9f['adminId'];_0x35fe9f['userEmail']=_0x35fe9f[_0x1126('0x1f')];_0x245cd7(_0x35fe9f);}});};}function createEndUser(_0x39bf0e,_0x55e195,_0x2fb797,_0x23d2bc,_0x4a334a){logger[_0x1126('0x10')]('['+[_0x39bf0e['toUpperCase']()]+_0x1126('0x20'),_0x2fb797);return new Promise(function(_0x4bd50b,_0x771bb8){var _0x583ce6={'method':_0x1126('0x21'),'uri':_0x23d2bc+'sys_user?'+_0x4a334a,'body':{'user_name':_0x2fb797['endUserNumber'],'roles':'user','first_name':_0x2fb797[_0x1126('0x22')],'active':_0x1126('0x1b'),'date_format':_0x1126('0x23'),'phone':_0x2fb797['endUserNumber']},'auth':_0x55e195,'json':!![]};return rp(_0x583ce6)[_0x1126('0x18')](function(_0x226afb){logger['info']('['+[_0x39bf0e[_0x1126('0x11')]()]+_0x1126('0x24'),_0x226afb[_0x1126('0xd')]);_0x2fb797[_0x1126('0x25')]=_0x226afb['result']['sys_id'];_0x4bd50b(_0x2fb797);})[_0x1126('0x13')](function(_0x19e6e4){logger[_0x1126('0x14')]('['+[_0x39bf0e[_0x1126('0x11')]()]+']',_0x19e6e4['message']);_0x771bb8(_0x19e6e4[_0x1126('0x15')]);});});}function getEndUser(_0x6f4312,_0x313ebe,_0x22436c,_0x3b0f79,_0x5df232){return function(_0x2a0dfe){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x26'),_0x2a0dfe);return new Promise(function(_0x5c019d,_0x4ca51c){var _0x22827a={'method':_0x1126('0x16'),'uri':_0x22436c+'sys_user?sysparm_query=phone%3D'+_0x2a0dfe[_0x1126('0x22')]+'&'+_0x3b0f79+'&'+_0x5df232,'auth':_0x313ebe,'json':!![]};return rp(_0x22827a)[_0x1126('0x18')](function(_0x11b0f6){if(_0x11b0f6['result']['length']>0x0){_0x2a0dfe[_0x1126('0x25')]=_0x11b0f6[_0x1126('0xd')][0x0][_0x1126('0xf')];logger[_0x1126('0x10')]('['+[_0x6f4312['toUpperCase']()]+_0x1126('0x27'),_0x2a0dfe);_0x5c019d(_0x2a0dfe);}else{return createEndUser(_0x6f4312,_0x313ebe,_0x2a0dfe,_0x22436c,_0x3b0f79)['then'](function(_0x8abfe3){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x28'),_0x8abfe3);_0x5c019d(_0x8abfe3);});}})[_0x1126('0x13')](function(_0x5746f6){logger[_0x1126('0x14')]('['+[_0x6f4312[_0x1126('0x11')]()]+']',_0x5746f6[_0x1126('0x15')]);_0x4ca51c(_0x5746f6[_0x1126('0x15')]);});});};}function getCustomFields(_0x3469a2,_0x3442b8){var _0x3052f9={};if(_0x3469a2['length']>0x0){_[_0x1126('0x29')](_0x3469a2,function(_0x154c28){if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x2c')]&&!_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x154c28[_0x1126('0x2e')][_0x1126('0x2f')]();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField']['toLowerCase']()]=_0x154c28[_0x1126('0x2e')]['toString']();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x31')&&_0x154c28[_0x1126('0x32')]&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x3442b8[_0x154c28[_0x1126('0x32')]][_0x1126('0x2f')]();}else if(_0x154c28['type']===_0x1126('0x33')&&_0x154c28['Variable']&&_0x154c28[_0x1126('0x34')]['name']&&_0x154c28[_0x1126('0x30')]&&_0x154c28[_0x1126('0x35')]){_0x3052f9[_0x154c28[_0x1126('0x30')]['toLowerCase']()]=_0x3442b8[_0x154c28[_0x1126('0x34')][_0x1126('0x36')][_0x1126('0x2d')]()]['toString']();}});}return _0x3052f9;}function getTicket(_0x58ff3a,_0x4dd7f5,_0x6e78cf,_0x520b62,_0x1e197e,_0x507568){return function(_0x2f45b9){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x37'),_0x2f45b9);return new Promise(function(_0xede3d8,_0x56732f){var _0x198173=_0x58ff3a[_0x1126('0x2d')]()==='outbound'?_0x2f45b9[_0x1126('0x1e')]:_0x2f45b9[_0x1126('0x25')];var _0x575f79={'method':_0x1126('0x21'),'uri':_0x6e78cf+_0x1126('0x38')+'?'+_0x507568,'body':Object['assign']({},{'active':_0x1126('0x1b'),'caller_id':_0x198173,'assigned_to':_0x2f45b9[_0x1126('0x1e')],'short_description':intUtil[_0x1126('0x39')](_0x520b62['Subjects'],_0x1e197e,'\x20'),'description':intUtil[_0x1126('0x39')](_0x520b62[_0x1126('0x3a')],_0x1e197e,'\x0a')},getCustomFields(_0x520b62[_0x1126('0x3b')],_0x1e197e)),'auth':_0x4dd7f5,'json':!![]};return rp(_0x575f79)[_0x1126('0x18')](function(_0x224456){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3c'),_0x224456['result']);_0x2f45b9[_0x1126('0x3d')]=_0x224456['result'][_0x1126('0xf')];_0x2f45b9[_0x1126('0x3e')]=_0x224456['result']['number'];logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3f'),_0x2f45b9);_0xede3d8(_0x2f45b9);})['catch'](function(_0x3cb44c){logger[_0x1126('0x14')]('['+[_0x58ff3a[_0x1126('0x11')]()]+']',_0x3cb44c[_0x1126('0x15')]);_0x56732f(_0x3cb44c['message']);});});};}function createRemoteTag(_0x30d1b3,_0x46551f,_0x5c36b9,_0x4bcc08){return new Promise(function(_0x4abb4d,_0x526b07){var _0x386c10={'method':_0x1126('0x21'),'uri':_0x5c36b9+'label'+'?'+_0x4bcc08,'body':{'short_description':_0x30d1b3,'global':!![],'active':!![],'name':_0x30d1b3},'auth':_0x46551f,'json':!![]};return rp(_0x386c10)[_0x1126('0x18')](function(_0x1c7a2b){var _0x38093e=_0x1c7a2b[_0x1126('0xd')][_0x1126('0xf')];_0x4abb4d(_0x38093e);});});}function getRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414,_0x322016){return new Promise(function(_0x476aca,_0xcc9499){var _0x36b61={'method':_0x1126('0x16'),'uri':_0x267592+'label'+_0x1126('0x40')+_0x4e4d49+'&'+_0x5d6414,'auth':_0x41cbb6,'json':!![]};return rp(_0x36b61)['then'](function(_0x868b2c){if(_0x868b2c[_0x1126('0xd')][_0x1126('0x19')]>0x0){var _0x590bc2=_0x868b2c[_0x1126('0xd')][0x0][_0x1126('0xf')];_0x476aca(_0x590bc2);}else{return createRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414)['then'](function(_0x30812d){_0x476aca(_0x30812d);});}});});}function assignTagToIncident(_0x25038f,_0x9bad53,_0x5a5340,_0x2fe6dc,_0x3377db){return new Promise(function(_0x22ab18,_0x308ee4){var _0x128c94={'method':_0x1126('0x21'),'uri':_0x5a5340+_0x1126('0x41')+'?'+_0x3377db,'body':{'label':_0x25038f,'table':_0x1126('0x38'),'id_type':'Incident','table_key':_0x2fe6dc[_0x1126('0x3d')],'title':_0x1126('0x42')+_0x2fe6dc[_0x1126('0x3e')],'id_display':_0x2fe6dc[_0x1126('0x3e')]},'auth':_0x9bad53,'json':!![]};return rp(_0x128c94)[_0x1126('0x18')](function(_0x4f5772){_0x22ab18();})[_0x1126('0x13')](function(){_0x22ab18();});});}function manageTags(_0x315386,_0x5e0ea1,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91,_0x478806){return new Promise(function(_0x3062d6,_0x21d4ef){var _0x375b76=[];_0x5e0ea1['forEach'](function(_0x13394f){_0x375b76['push'](getRemoteTag(_0x13394f,_0x3767e4,_0x5246aa,_0x10ff91,_0x478806));});return Promise['all'](_0x375b76)[_0x1126('0x18')](function(_0x40185f){if(_0x40185f[_0x1126('0x19')]){logger[_0x1126('0x10')]('['+[_0x315386[_0x1126('0x11')]()]+_0x1126('0x43'),_0x40185f);var _0x1a0e26=[];_0x40185f['forEach'](function(_0x191307){_0x1a0e26[_0x1126('0x44')](assignTagToIncident(_0x191307,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91));});return Promise[_0x1126('0x45')](_0x1a0e26)[_0x1126('0x18')](function(){_0x3062d6();})[_0x1126('0x13')](function(){_0x3062d6();});}else{_0x3062d6();}});});}function getTags(_0x3cd788,_0x5a0804,_0x5b17d6,_0x16a343,_0x3921c2,_0x4bf2b3){return function(_0x5ee130){return new Promise(function(_0x5e9260,_0x51a28d){var _0x964a2=[];var _0x37b1ab=_0x16a343[_0x1126('0x46')];if(_0x37b1ab&&_0x37b1ab['length']>0x0){_0x964a2=_[_0x1126('0x47')](_0x37b1ab,_0x1126('0x36'));}if(_0x964a2[_0x1126('0x19')]>0x0){return manageTags(_0x3cd788,_0x964a2,_0x5a0804,_0x5b17d6,_0x5ee130,_0x3921c2,_0x4bf2b3)[_0x1126('0x18')](function(){_0x5e9260(_0x5ee130);});}else{_0x5e9260(_0x5ee130);}});};}function emit(_0x22d403,_0x3f007b,_0x131056){var _0x49a0a3=_0x1126('0x48')+_0x1126('0x49')+_0x1126('0x4a')+_0x1126('0x4b');var _0x288b9b={'uri':_0x22d403+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x131056+_0x49a0a3};io['to'](util['format'](_0x1126('0x4c'),_0x3f007b))[_0x1126('0x4d')]('trigger:browser:url',_0x288b9b);}exports['cs']=function(_0x3bf25d,_0x1fb2f0,_0x366675,_0x6a41c0,_0x2828d4,_0x30d240,_0x41ce78,_0x247f12){var _0xd20fbe={};var _0x3d5e15={'user':_0x30d240[_0x1126('0x4e')],'pass':_0x30d240[_0x1126('0x4f')]};var _0x3dad39='sysparm_limit=1';var _0x111f49=_0x1126('0x50');_0x30d240[_0x1126('0x51')]=intUtil['stripTrailingSlash'](_0x30d240['remoteUri']);_0x30d240[_0x1126('0x52')]=intUtil[_0x1126('0x53')](_0x30d240[_0x1126('0x52')]);var _0x3bfeb8=util['format']('%s/api/now/table/',_0x30d240['remoteUri']);_0xd20fbe[_0x1126('0x54')]=!_[_0x1126('0x55')](_0x6a41c0)?_0x6a41c0[_0x1126('0x56')]:null;_0xd20fbe[_0x1126('0x1f')]=_0x30d240['email'];_0xd20fbe[_0x1126('0x22')]=_0x247f12['toLowerCase']()===_0x1126('0x57')?_0x1fb2f0[_0x1126('0x58')]:_0x1fb2f0[_0x1126('0x59')];_0xd20fbe[_0x1126('0x5a')]=_0x247f12===_0x1126('0x5b')||_0x247f12===_0x1126('0x5c')?_0x1126('0x5b'):'outbound';var _0xfd2d9=util['format'](_0x1126('0x5d'),_0x30d240[_0x1126('0x52')],_0x1fb2f0['uniqueid'],md5(_0x1fb2f0[_0x1126('0x5e')]));if(_0x2828d4&&_0x2828d4[_0x1126('0x5f')]){logger['info'](_0x1126('0x60'),_0x1126('0x61'));_0x1fb2f0['recordingURL']=_0xfd2d9;}else if(_0x41ce78&&_0x41ce78['recordingFormat']&&_0x41ce78[_0x1126('0x62')]!==_0x1126('0x63')){logger[_0x1126('0x10')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1fb2f0['recordingURL']=_0xfd2d9;}else{_0x1fb2f0[_0x1126('0x64')]='';}return getAdminUser(_0x247f12,_0x3d5e15,_0xd20fbe,_0x3bfeb8,_0x111f49,_0x3dad39)['then'](getUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))['then'](getEndUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))[_0x1126('0x18')](getTicket(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x366675,_0x1fb2f0,_0x111f49))['then'](function(_0x1f320e){logger[_0x1126('0x10')](util['format'](_0x1126('0x65'),_0x1f320e[_0x1126('0x3d')]));logger[_0x1126('0x10')](util[_0x1126('0x66')](_0x1126('0x67'),_0x247f12));if(_0x247f12!=='unmanaged'){logger[_0x1126('0x10')]('['+[_0x247f12[_0x1126('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x30d240[_0x1126('0x51')],_0x6a41c0[_0x1126('0x36')],_0x1f320e[_0x1126('0x3d')]);}})[_0x1126('0x13')](function(_0x2598a7){logger[_0x1126('0x14')]('['+[_0x247f12[_0x1126('0x11')]()]+_0x1126('0x68'),util[_0x1126('0x69')](_0x2598a7,{'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(_0x37d4dd,_0x297bca){var _0xf37b53=function(_0x10b99a){while(--_0x10b99a){_0x37d4dd['push'](_0x37d4dd['shift']());}};_0xf37b53(++_0x297bca);}(_0x326f,0xd1));var _0xf326=function(_0x169092,_0x599e01){_0x169092=_0x169092-0x0;var _0x1bb6f6=_0x326f[_0x169092];return _0x1bb6f6;};'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 1fe85ab..7c10955 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 _0xabce=['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','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','outbound','recordingFormat','none','destcalleridnum','Outbound','[OUTBOUND]','trigger:browser:url','error','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','description','toISOString','slice','replace','duration_minutes','parent_id','parent_name','direction','length','forEach','variableName','push','idField','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','entry_list','name_value_list','value','Agent\x20found!','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','set_entry','','Caller\x20-\x20%s','first_name','debug','[HTTP]','merge','map','string','nameField','customField','toLowerCase','content','custom_fields','type','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:'];(function(_0x52ea08,_0x15d935){var _0x28d546=function(_0x4a3aa7){while(--_0x4a3aa7){_0x52ea08['push'](_0x52ea08['shift']());}};_0x28d546(++_0x15d935);}(_0xabce,0x103));var _0xeabc=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xabce[_0x2b7764];return _0x848dcb;};'use strict';var _=require(_0xeabc('0x0'));var rp=require(_0xeabc('0x1'));var BPromise=require(_0xeabc('0x2'));var md5=require(_0xeabc('0x3'));var util=require(_0xeabc('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));config['redis']=_['defaults'](config[_0xeabc('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xeabc('0x9'))(new Redis(config['redis']));var def={'method':_0xeabc('0xa'),'json':!![]};function emit(_0x9417af,_0x8434c5,_0x5d59d5){io['to'](_0x9417af)[_0xeabc('0xb')](_0x8434c5,_0x5d59d5);}function getTicket(_0x341f16,_0x2f73e9,_0x1b4d1b,_0x4301e4,_0x283cdf,_0x111aaf,_0x28292c,_0xdb5022){logger[_0xeabc('0xc')](_0xeabc('0xd'));var _0x1c7eb0=new Date();var _0x435ea7=[{'name':_0xeabc('0xe'),'value':intUtil[_0xeabc('0xf')](_0x4301e4[_0xeabc('0x10')],_0x283cdf,'\x20')},{'name':'assigned_user_id','value':_0x2f73e9['id']},{'name':_0xeabc('0x11'),'value':_0x2f73e9['id']},{'name':_0xeabc('0x12'),'value':intUtil[_0xeabc('0xf')](_0x4301e4['Descriptions'],_0x283cdf,'\x0a')},{'name':'date_start','value':_0x1c7eb0[_0xeabc('0x13')]()[_0xeabc('0x14')](0x0,0x13)[_0xeabc('0x15')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xeabc('0x16'),'value':'15'},{'name':_0xeabc('0x17'),'value':_0x1b4d1b['id']},{'name':'parent_type','value':'Contacts'},{'name':_0xeabc('0x18'),'value':_0x1b4d1b['name']},{'name':_0xeabc('0x19'),'value':_0xdb5022}];if(_0x111aaf[_0xeabc('0x1a')]){_[_0xeabc('0x1b')](_0x111aaf,function(_0x16f08b){if(_0x283cdf[_0x16f08b[_0xeabc('0x1c')]]){_0x435ea7[_0xeabc('0x1d')]({'name':_0x16f08b[_0xeabc('0x1e')],'value':_0x283cdf[_0x16f08b[_0xeabc('0x1c')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xeabc('0x1f'),'response_type':'JSON','rest_data':JSON[_0xeabc('0x20')]({'session':_0x28292c['id'],'module_name':_0xeabc('0x21'),'name_value_list':_0x435ea7})}});}function getAuth(_0x502947){return util[_0xeabc('0x22')](_0xeabc('0x23'),new Buffer(_0x502947[_0xeabc('0x24')]+':X')[_0xeabc('0x25')](_0xeabc('0x26')));}function getServerInfo(_0x4e99a4){return request({'form':{'method':_0xeabc('0x27'),'input_type':_0xeabc('0x1f'),'response_type':_0xeabc('0x1f'),'rest_data':JSON['stringify']({'session':_0x4e99a4['id']})}});}function getUser(_0x457f27,_0x3854d2,_0x214953){if(!_[_0xeabc('0x28')](_0x3854d2)){logger['info'](_0xeabc('0x29'),_0x3854d2);return request({'form':{'method':'get_entry_list','input_type':_0xeabc('0x1f'),'response_type':'JSON','rest_data':JSON[_0xeabc('0x20')]({'session':_0x214953['id'],'module_name':_0xeabc('0x2a'),'query':util[_0xeabc('0x22')](_0xeabc('0x2b'),_0x3854d2),'order_by':'','offset':'0','select_fields':['id',_0xeabc('0xe'),_0xeabc('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xeabc('0x2d')](function(_0x4c2693){if(_0x4c2693['entry_list'][_0xeabc('0x1a')]){var _0x5bf8f2=_[_0xeabc('0x2e')](_0x4c2693[_0xeabc('0x2f')],function(_0x48fb52){return _0x48fb52[_0xeabc('0x30')][_0xeabc('0x2c')][_0xeabc('0x31')]===_0x3854d2;});if(_0x5bf8f2){logger[_0xeabc('0xc')](_0xeabc('0x32'));return BPromise[_0xeabc('0x33')]({'id':_0x5bf8f2[_0xeabc('0x30')]['id'][_0xeabc('0x31')],'name':_0x5bf8f2[_0xeabc('0x30')]['name'][_0xeabc('0x31')]});}}logger['info'](_0xeabc('0x34'));return BPromise[_0xeabc('0x33')]({'id':_0x214953[_0xeabc('0x30')][_0xeabc('0x35')][_0xeabc('0x31')],'name':_0x214953[_0xeabc('0x30')][_0xeabc('0x2c')]['value']});});}else{logger[_0xeabc('0xc')](_0xeabc('0x36'));return BPromise[_0xeabc('0x33')]({'id':_0x214953['name_value_list'][_0xeabc('0x35')][_0xeabc('0x31')],'name':_0x214953[_0xeabc('0x30')]['user_name'][_0xeabc('0x31')]});}}function getEndUser(_0x36cc2f,_0x1f910d,_0x521091,_0xf98c7c){logger[_0xeabc('0xc')]('Searching\x20enduser\x20with\x20phone',_0x521091);return request({'form':{'method':'get_entry_list','input_type':_0xeabc('0x1f'),'response_type':_0xeabc('0x1f'),'rest_data':JSON['stringify']({'session':_0xf98c7c['id'],'module_name':_0xeabc('0x37'),'query':util[_0xeabc('0x22')](_0xeabc('0x38'),_0x521091),'order_by':'','offset':'0','select_fields':['id',_0xeabc('0xe'),_0xeabc('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x353e48){if(_0x353e48['entry_list'][_0xeabc('0x1a')]){var _0x2bda29=_[_0xeabc('0x2e')](_0x353e48['entry_list'],function(_0x532999){return _0x532999[_0xeabc('0x30')]['phone_home'][_0xeabc('0x31')]===_0x521091;});if(_0x2bda29){logger['info']('Enduser\x20found!');return BPromise['resolve']({'id':_0x2bda29['name_value_list']['id'][_0xeabc('0x31')],'name':_0x2bda29['name_value_list'][_0xeabc('0xe')][_0xeabc('0x31')],'phone':_0x2bda29['name_value_list'][_0xeabc('0x39')]['value']});}}else{logger[_0xeabc('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xeabc('0x3a'),'input_type':_0xeabc('0x1f'),'response_type':_0xeabc('0x1f'),'rest_data':JSON['stringify']({'session':_0xf98c7c['id'],'module_name':'Contacts','name_value_list':[{'name':'first_name','value':_0x1f910d!==_0xeabc('0x3b')?_0x1f910d:util[_0xeabc('0x22')](_0xeabc('0x3c'),_0x521091)},{'name':'phone_home','value':_0x521091}]})}})['then'](function(_0x5cd62e){logger[_0xeabc('0xc')]('Enduser\x20created.');return BPromise[_0xeabc('0x33')]({'id':_0x5cd62e['id'],'name':_0x5cd62e['entry_list'][_0xeabc('0x3d')]['value'],'phone':_0x5cd62e['entry_list']['phone_home'][_0xeabc('0x31')]});});}});}function request(_0x37c926){logger[_0xeabc('0x3e')](_0xeabc('0x3f'),JSON['stringify'](_0x37c926));return rp(_[_0xeabc('0x40')](def,_0x37c926));}function getTags(_0x555d26,_0x7d5add){var _0x1a4bbe=[];if(_0x555d26&&_0x555d26[_0xeabc('0x1a')]>0x0){_0x1a4bbe=_[_0xeabc('0x41')](_0x555d26,_0x7d5add);}return _0x1a4bbe;}function getCustomFields(_0xc849c9,_0x48b988){var _0x482971=[];var _0x12ad6b={'custom_fields':[]};if(_0xc849c9['length']>0x0){_[_0xeabc('0x1b')](_0xc849c9,function(_0x2cdf59){if(_0x2cdf59['type']===_0xeabc('0x42')&&_0x2cdf59[_0xeabc('0x43')]&&!_0x2cdf59[_0xeabc('0x44')]){_0x12ad6b[_0x2cdf59[_0xeabc('0x43')][_0xeabc('0x45')]()]=_0x2cdf59[_0xeabc('0x46')][_0xeabc('0x25')]();}else if(_0x2cdf59['type']===_0xeabc('0x42')&&_0x2cdf59[_0xeabc('0x1e')]&&_0x2cdf59[_0xeabc('0x44')]){_0x12ad6b[_0xeabc('0x47')][_0xeabc('0x1d')]({'id':_0x2cdf59[_0xeabc('0x1e')],'value':_0x2cdf59[_0xeabc('0x46')][_0xeabc('0x25')]()});}else if(_0x2cdf59[_0xeabc('0x48')]===_0xeabc('0x49')&&_0x2cdf59['variableName']&&_0x2cdf59[_0xeabc('0x1e')]&&_0x2cdf59[_0xeabc('0x44')]){_0x48b988[_0x2cdf59[_0xeabc('0x1c')]]&&_0x12ad6b[_0xeabc('0x47')][_0xeabc('0x1d')]({'id':_0x2cdf59[_0xeabc('0x1e')],'value':_0x48b988[_0x2cdf59[_0xeabc('0x1c')]]['toString']()});}else if(_0x2cdf59[_0xeabc('0x48')]===_0xeabc('0x4a')&&_0x2cdf59[_0xeabc('0x4b')]&&_0x2cdf59[_0xeabc('0x4b')][_0xeabc('0xe')]&&_0x2cdf59['idField']&&_0x2cdf59[_0xeabc('0x44')]){_0x48b988[_0x2cdf59[_0xeabc('0x4b')][_0xeabc('0xe')][_0xeabc('0x45')]()]&&_0x12ad6b['custom_fields'][_0xeabc('0x1d')]({'id':_0x2cdf59[_0xeabc('0x1e')],'value':_0x48b988[_0x2cdf59['Variable'][_0xeabc('0xe')]['toLowerCase']()][_0xeabc('0x25')]()});}});}return _0x12ad6b;}function getConnection(_0x4f3cbc){return request({'method':_0xeabc('0xa'),'form':{'method':_0xeabc('0x4c'),'input_type':_0xeabc('0x1f'),'response_type':_0xeabc('0x1f'),'rest_data':JSON[_0xeabc('0x20')]({'user_auth':{'user_name':_0x4f3cbc[_0xeabc('0x4d')],'password':_0x4f3cbc[_0xeabc('0x4e')],'encryption':_0xeabc('0x4f')},'application':_0xeabc('0x50')})}})[_0xeabc('0x2d')](function(_0x48a13f){var _0x180a14=_0x48a13f;if(_0x180a14['id']){def[_0xeabc('0x51')]=_0x180a14['id'];return BPromise[_0xeabc('0x33')](_0x180a14);}else{throw new Error(util[_0xeabc('0x22')]('Account\x20%d\x20is\x20not\x20valid',_0x4f3cbc['id']));}});}function setRelationship(_0x1cef45,_0x392913,_0x10d56f,_0x21f972){return request({'form':{'method':'set_relationship','input_type':_0xeabc('0x1f'),'response_type':_0xeabc('0x1f'),'rest_data':JSON[_0xeabc('0x20')]({'session':_0x1cef45['id'],'module_name':_0xeabc('0x21'),'module_id':_0x10d56f['id'],'link_field_name':_0x21f972,'related_ids':[_0x392913['id']]})}});}exports[_0xeabc('0x52')]=function(_0x3b5e94,_0x14c322,_0x3ff38c,_0x17acf8,_0x58ab08,_0x4546c4){var _0x4cdb05,_0x5e09fc,_0x5e630a,_0x2d2d3b;_0x4546c4[_0xeabc('0x53')]=intUtil[_0xeabc('0x54')](_0x4546c4[_0xeabc('0x53')]);_0x4546c4[_0xeabc('0x55')]=intUtil[_0xeabc('0x54')](_0x4546c4['serverUrl']);def[_0xeabc('0x56')]=util[_0xeabc('0x22')](_0xeabc('0x57'),_0x4546c4[_0xeabc('0x53')]);if(_0x58ab08&&_0x58ab08[_0xeabc('0x58')]){logger[_0xeabc('0xc')](_0xeabc('0x59'),_0xeabc('0x5a'));_0x14c322['recordingURL']=util['format'](_0xeabc('0x5b'),_0x4546c4[_0xeabc('0x55')],_0x14c322[_0xeabc('0x5c')],md5(_0x14c322['uniqueid']));}else{_0x14c322[_0xeabc('0x5d')]='';}return getConnection(_0x4546c4)['then'](function(_0x5206eb){_0x2d2d3b=_0x5206eb;return getUser(_0x4546c4,_0x17acf8[_0xeabc('0xe')],_0x2d2d3b);})[_0xeabc('0x2d')](function(_0x13f04f){_0x4cdb05=_0x13f04f;logger[_0xeabc('0xc')](_0xeabc('0x5e'),_0x4cdb05['id']);return getEndUser(_0x4546c4,_0x14c322[_0xeabc('0x5f')],_0x14c322['calleridnum'],_0x2d2d3b);})[_0xeabc('0x2d')](function(_0x800880){_0x5e09fc=_0x800880;logger[_0xeabc('0xc')](_0xeabc('0x60'),_0x5e09fc['id']);return getTicket(_0x4546c4,_0x4cdb05,_0x5e09fc,_0x3ff38c,_0x14c322,_0x3ff38c[_0xeabc('0x61')],_0x2d2d3b,_0xeabc('0x62'));})['then'](function(_0xf3b0f3){_0x5e630a=_0xf3b0f3;logger[_0xeabc('0xc')](_0xeabc('0x63'));logger[_0xeabc('0xc')](_0xeabc('0x64'),_0x5e630a['id']);return setRelationship(_0x2d2d3b,_0x4cdb05,_0x5e630a,_0xeabc('0x65'));})[_0xeabc('0x2d')](function(){return setRelationship(_0x2d2d3b,_0x5e09fc,_0x5e630a,_0xeabc('0x66'));})[_0xeabc('0x2d')](function(){return getServerInfo(_0x2d2d3b);})['then'](function(_0xf74c56){var _0x590439=parseInt(_0xf74c56[_0xeabc('0x67')][_0xeabc('0x68')](0x0));var _0x3fea99=util[_0xeabc('0x22')](_0xeabc('0x69'),_0x4546c4[_0xeabc('0x53')],_0x5e630a['id']);if(_0x590439>0x6){_0x3fea99=util[_0xeabc('0x22')](_0xeabc('0x6a'),_0x4546c4[_0xeabc('0x53')],_0x5e630a['id']);}logger[_0xeabc('0xc')]('[QUEUE]',_0xeabc('0x6b'));emit(util[_0xeabc('0x22')](_0xeabc('0x6c'),_0x17acf8[_0xeabc('0xe')]),'trigger:browser:url',{'uri':_0x3fea99});})[_0xeabc('0x6d')](function(_0x49f059){logger['error'](_0xeabc('0x59'),JSON[_0xeabc('0x20')](_0x49f059));});};exports[_0xeabc('0x6e')]=function(_0x1c91e4,_0x4b7730,_0x51a0c7,_0x2e712e,_0x4ce3f4,_0x529b27,_0x44c0a6){var _0x4f1a4f,_0x4afc8e,_0xa44f2d,_0x1c84b5;_0x529b27['remoteUri']=intUtil['stripTrailingSlash'](_0x529b27[_0xeabc('0x53')]);_0x529b27['serverUrl']=intUtil[_0xeabc('0x54')](_0x529b27[_0xeabc('0x55')]);def['uri']=util['format'](_0xeabc('0x57'),_0x529b27[_0xeabc('0x53')]);if(_0x44c0a6&&_0x44c0a6[_0xeabc('0x6f')]&&_0x44c0a6[_0xeabc('0x6f')]!==_0xeabc('0x70')){logger['info']('[OUTBOUND]',_0xeabc('0x5a'));_0x4b7730['recordingURL']=util[_0xeabc('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x529b27[_0xeabc('0x55')],_0x4b7730['uniqueid'],md5(_0x4b7730[_0xeabc('0x5c')]));}return getConnection(_0x529b27)['then'](function(_0x449c29){_0x1c84b5=_0x449c29;return getUser(_0x529b27,_0x2e712e[_0xeabc('0xe')],_0x1c84b5);})[_0xeabc('0x2d')](function(_0x36cc41){_0x4f1a4f=_0x36cc41;logger['info'](_0xeabc('0x5e'),_0x4f1a4f['id']);return getEndUser(_0x529b27,_0x4b7730['destcalleridname'],_0x4b7730[_0xeabc('0x71')],_0x1c84b5);})[_0xeabc('0x2d')](function(_0x26d024){_0x4afc8e=_0x26d024;logger[_0xeabc('0xc')](_0xeabc('0x60'),_0x4afc8e['id']);return getTicket(_0x529b27,_0x4f1a4f,_0x4afc8e,_0x51a0c7,_0x4b7730,_0x51a0c7['Fields'],_0x1c84b5,_0xeabc('0x72'));})[_0xeabc('0x2d')](function(_0x4b9614){_0xa44f2d=_0x4b9614;logger[_0xeabc('0xc')]('Ticket\x20created!');logger[_0xeabc('0xc')](_0xeabc('0x64'),_0xa44f2d['id']);return setRelationship(_0x1c84b5,_0x4f1a4f,_0xa44f2d,_0xeabc('0x65'));})[_0xeabc('0x2d')](function(){return setRelationship(_0x1c84b5,_0x4afc8e,_0xa44f2d,'contacts');})[_0xeabc('0x2d')](function(){return getServerInfo(_0x1c84b5);})[_0xeabc('0x2d')](function(_0x287f88){var _0x460520=parseInt(_0x287f88['version']['charAt'](0x0));var _0x30e9eb=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x529b27[_0xeabc('0x53')],_0xa44f2d['id']);if(_0x460520>0x6){_0x30e9eb=util[_0xeabc('0x22')](_0xeabc('0x6a'),_0x529b27['remoteUri'],_0xa44f2d['id']);}logger[_0xeabc('0xc')](_0xeabc('0x73'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xeabc('0x22')](_0xeabc('0x6c'),_0x2e712e[_0xeabc('0xe')]),_0xeabc('0x74'),{'uri':_0x30e9eb});})[_0xeabc('0x6d')](function(_0x4bf9d8){logger[_0xeabc('0x75')]('[OUTBOUND]',JSON['stringify'](_0x4bf9d8));});};exports['unmanaged']=function(_0x953553,_0x1c8a51,_0x1b6e9e,_0x4424ce,_0x33fa74,_0x51368f){var _0x39f961,_0x47fd82,_0x1795fe,_0x2f95c7;_0x51368f['remoteUri']=intUtil[_0xeabc('0x54')](_0x51368f['remoteUri']);_0x51368f['serverUrl']=intUtil[_0xeabc('0x54')](_0x51368f[_0xeabc('0x55')]);def[_0xeabc('0x56')]=util[_0xeabc('0x22')](_0xeabc('0x57'),_0x51368f['remoteUri']);if(_0x33fa74&&_0x33fa74[_0xeabc('0x58')]){logger[_0xeabc('0xc')]('['+_0x1c8a51[_0xeabc('0x76')][_0xeabc('0x77')]()+']',_0xeabc('0x5a'));_0x1c8a51[_0xeabc('0x5d')]=util[_0xeabc('0x22')](_0xeabc('0x5b'),_0x51368f[_0xeabc('0x55')],_0x1c8a51[_0xeabc('0x5c')],md5(_0x1c8a51['uniqueid']));}else{_0x1c8a51[_0xeabc('0x5d')]='';}return getConnection(_0x51368f)[_0xeabc('0x2d')](function(_0xba29f){_0x2f95c7=_0xba29f;if(!_['isNil'](_0x4424ce)){return getUser(_0x51368f,_0x4424ce['name'],_0x2f95c7);}else{return getUser(_0x51368f,null,_0x2f95c7);}})[_0xeabc('0x2d')](function(_0x273ca5){_0x39f961=_0x273ca5;logger[_0xeabc('0xc')](_0xeabc('0x5e'),_0x39f961['id']);return getEndUser(_0x51368f,_0x1c8a51[_0xeabc('0x5f')],_0x1c8a51['calleridnum'],_0x2f95c7);})[_0xeabc('0x2d')](function(_0x538190){_0x47fd82=_0x538190;logger['info'](_0xeabc('0x60'),_0x47fd82['id']);return getTicket(_0x51368f,_0x39f961,_0x47fd82,_0x1b6e9e,_0x1c8a51,_0x1b6e9e[_0xeabc('0x61')],_0x2f95c7,'Inbound');})[_0xeabc('0x2d')](function(_0x45c9c7){_0x1795fe=_0x45c9c7;logger[_0xeabc('0xc')](_0xeabc('0x63'));logger[_0xeabc('0xc')](_0xeabc('0x64'),_0x1795fe['id']);return setRelationship(_0x2f95c7,_0x39f961,_0x1795fe,_0xeabc('0x65'));})[_0xeabc('0x2d')](function(){return setRelationship(_0x2f95c7,_0x47fd82,_0x1795fe,_0xeabc('0x66'));})[_0xeabc('0x2d')](function(){return getServerInfo(_0x2f95c7);})[_0xeabc('0x6d')](function(_0x485c13){logger[_0xeabc('0x75')]('['+_0x1c8a51['lastevent'][_0xeabc('0x77')]()+']',JSON[_0xeabc('0x20')](_0x485c13));});}; \ No newline at end of file +var _0xbd18=['Variable','POST','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','user:%s','trigger:browser:url','catch','error','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridnum','Ticket\x20created!','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','Inbound','users','toUpperCase','lodash','request-promise','bluebird','util','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','info','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','get_entry_list','Employees','user_name','entry_list','name_value_list','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','find','Enduser\x20found!','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','length','map','forEach','customField','nameField','toLowerCase','content','custom_fields','type','variable','customVariable'];(function(_0x252939,_0x519f38){var _0x288070=function(_0x4458d3){while(--_0x4458d3){_0x252939['push'](_0x252939['shift']());}};_0x288070(++_0x519f38);}(_0xbd18,0x195));var _0x8bd1=function(_0x26de38,_0x59169e){_0x26de38=_0x26de38-0x0;var _0x567408=_0xbd18[_0x26de38];return _0x567408;};'use strict';var _=require(_0x8bd1('0x0'));var rp=require(_0x8bd1('0x1'));var BPromise=require(_0x8bd1('0x2'));var md5=require('md5');var util=require(_0x8bd1('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x8bd1('0x4'))(_0x8bd1('0x5'));config['redis']=_['defaults'](config[_0x8bd1('0x6')],{'host':_0x8bd1('0x7'),'port':0x18eb});var io=require(_0x8bd1('0x8'))(new Redis(config[_0x8bd1('0x6')]));var def={'method':'POST','json':!![]};function emit(_0x13d571,_0x2bfac3,_0x32cd73){io['to'](_0x13d571)['emit'](_0x2bfac3,_0x32cd73);}function getTicket(_0x31cdc4,_0x2671b7,_0x9610e1,_0x5baf5f,_0x5c36df,_0x434cf1,_0x4ae0b9,_0xc299be){logger[_0x8bd1('0x9')]('Creating\x20new\x20ticket...');var _0x12159b=new Date();var _0x50c6ac=[{'name':_0x8bd1('0xa'),'value':intUtil[_0x8bd1('0xb')](_0x5baf5f[_0x8bd1('0xc')],_0x5c36df,'\x20')},{'name':_0x8bd1('0xd'),'value':_0x2671b7['id']},{'name':_0x8bd1('0xe'),'value':_0x2671b7['id']},{'name':_0x8bd1('0xf'),'value':intUtil[_0x8bd1('0xb')](_0x5baf5f[_0x8bd1('0x10')],_0x5c36df,'\x0a')},{'name':_0x8bd1('0x11'),'value':_0x12159b['toISOString']()[_0x8bd1('0x12')](0x0,0x13)[_0x8bd1('0x13')]('T','\x20')},{'name':_0x8bd1('0x14'),'value':'0'},{'name':_0x8bd1('0x15'),'value':'15'},{'name':_0x8bd1('0x16'),'value':_0x9610e1['id']},{'name':_0x8bd1('0x17'),'value':'Contacts'},{'name':_0x8bd1('0x18'),'value':_0x9610e1[_0x8bd1('0xa')]},{'name':_0x8bd1('0x19'),'value':_0xc299be}];if(_0x434cf1['length']){_['forEach'](_0x434cf1,function(_0x1a8119){if(_0x5c36df[_0x1a8119[_0x8bd1('0x1a')]]){_0x50c6ac[_0x8bd1('0x1b')]({'name':_0x1a8119[_0x8bd1('0x1c')],'value':_0x5c36df[_0x1a8119[_0x8bd1('0x1a')]]});}});}return request({'form':{'method':_0x8bd1('0x1d'),'input_type':_0x8bd1('0x1e'),'response_type':_0x8bd1('0x1e'),'rest_data':JSON[_0x8bd1('0x1f')]({'session':_0x4ae0b9['id'],'module_name':_0x8bd1('0x20'),'name_value_list':_0x50c6ac})}});}function getAuth(_0x58d428){return util[_0x8bd1('0x21')](_0x8bd1('0x22'),new Buffer(_0x58d428[_0x8bd1('0x23')]+':X')[_0x8bd1('0x24')](_0x8bd1('0x25')));}function getServerInfo(_0x3d51fb){return request({'form':{'method':_0x8bd1('0x26'),'input_type':_0x8bd1('0x1e'),'response_type':_0x8bd1('0x1e'),'rest_data':JSON[_0x8bd1('0x1f')]({'session':_0x3d51fb['id']})}});}function getUser(_0x22dd62,_0x19fb04,_0x59f54e){if(!_[_0x8bd1('0x27')](_0x19fb04)){logger[_0x8bd1('0x9')]('Getting\x20agent\x20with\x20name',_0x19fb04);return request({'form':{'method':_0x8bd1('0x28'),'input_type':_0x8bd1('0x1e'),'response_type':'JSON','rest_data':JSON[_0x8bd1('0x1f')]({'session':_0x59f54e['id'],'module_name':_0x8bd1('0x29'),'query':util[_0x8bd1('0x21')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x19fb04),'order_by':'','offset':'0','select_fields':['id',_0x8bd1('0xa'),_0x8bd1('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x5dfd09){if(_0x5dfd09[_0x8bd1('0x2b')]['length']){var _0x5ca8e5=_['find'](_0x5dfd09['entry_list'],function(_0x46e8bd){return _0x46e8bd[_0x8bd1('0x2c')][_0x8bd1('0x2a')][_0x8bd1('0x2d')]===_0x19fb04;});if(_0x5ca8e5){logger[_0x8bd1('0x9')](_0x8bd1('0x2e'));return BPromise['resolve']({'id':_0x5ca8e5[_0x8bd1('0x2c')]['id'][_0x8bd1('0x2d')],'name':_0x5ca8e5[_0x8bd1('0x2c')][_0x8bd1('0xa')][_0x8bd1('0x2d')]});}}logger[_0x8bd1('0x9')](_0x8bd1('0x2f'));return BPromise[_0x8bd1('0x30')]({'id':_0x59f54e['name_value_list'][_0x8bd1('0x31')][_0x8bd1('0x2d')],'name':_0x59f54e['name_value_list'][_0x8bd1('0x2a')][_0x8bd1('0x2d')]});});}else{logger[_0x8bd1('0x9')](_0x8bd1('0x32'));return BPromise[_0x8bd1('0x30')]({'id':_0x59f54e['name_value_list'][_0x8bd1('0x31')]['value'],'name':_0x59f54e['name_value_list'][_0x8bd1('0x2a')][_0x8bd1('0x2d')]});}}function getEndUser(_0x4bfafa,_0x4d20d8,_0x4a880e,_0x556406){logger[_0x8bd1('0x9')](_0x8bd1('0x33'),_0x4a880e);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x8bd1('0x1e'),'rest_data':JSON[_0x8bd1('0x1f')]({'session':_0x556406['id'],'module_name':_0x8bd1('0x34'),'query':util[_0x8bd1('0x21')](_0x8bd1('0x35'),_0x4a880e),'order_by':'','offset':'0','select_fields':['id',_0x8bd1('0xa'),_0x8bd1('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x8bd1('0x37')](function(_0x43d995){if(_0x43d995['entry_list']['length']){var _0x26a977=_[_0x8bd1('0x38')](_0x43d995[_0x8bd1('0x2b')],function(_0x37a850){return _0x37a850[_0x8bd1('0x2c')][_0x8bd1('0x36')][_0x8bd1('0x2d')]===_0x4a880e;});if(_0x26a977){logger[_0x8bd1('0x9')](_0x8bd1('0x39'));return BPromise['resolve']({'id':_0x26a977[_0x8bd1('0x2c')]['id'][_0x8bd1('0x2d')],'name':_0x26a977[_0x8bd1('0x2c')][_0x8bd1('0xa')]['value'],'phone':_0x26a977['name_value_list'][_0x8bd1('0x36')][_0x8bd1('0x2d')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x8bd1('0x1d'),'input_type':_0x8bd1('0x1e'),'response_type':_0x8bd1('0x1e'),'rest_data':JSON['stringify']({'session':_0x556406['id'],'module_name':_0x8bd1('0x34'),'name_value_list':[{'name':_0x8bd1('0x3a'),'value':_0x4d20d8!==''?_0x4d20d8:util[_0x8bd1('0x21')](_0x8bd1('0x3b'),_0x4a880e)},{'name':_0x8bd1('0x36'),'value':_0x4a880e}]})}})[_0x8bd1('0x37')](function(_0x1d9e98){logger['info'](_0x8bd1('0x3c'));return BPromise[_0x8bd1('0x30')]({'id':_0x1d9e98['id'],'name':_0x1d9e98[_0x8bd1('0x2b')]['first_name'][_0x8bd1('0x2d')],'phone':_0x1d9e98[_0x8bd1('0x2b')][_0x8bd1('0x36')][_0x8bd1('0x2d')]});});}});}function request(_0x3d6628){logger[_0x8bd1('0x3d')](_0x8bd1('0x3e'),JSON['stringify'](_0x3d6628));return rp(_[_0x8bd1('0x3f')](def,_0x3d6628));}function getTags(_0x137f56,_0x3bf214){var _0x5ce94b=[];if(_0x137f56&&_0x137f56[_0x8bd1('0x40')]>0x0){_0x5ce94b=_[_0x8bd1('0x41')](_0x137f56,_0x3bf214);}return _0x5ce94b;}function getCustomFields(_0x128775,_0x5b9861){var _0x425e14=[];var _0x33b6a7={'custom_fields':[]};if(_0x128775[_0x8bd1('0x40')]>0x0){_[_0x8bd1('0x42')](_0x128775,function(_0x3128f7){if(_0x3128f7['type']==='string'&&_0x3128f7['nameField']&&!_0x3128f7[_0x8bd1('0x43')]){_0x33b6a7[_0x3128f7[_0x8bd1('0x44')][_0x8bd1('0x45')]()]=_0x3128f7[_0x8bd1('0x46')][_0x8bd1('0x24')]();}else if(_0x3128f7['type']==='string'&&_0x3128f7[_0x8bd1('0x1c')]&&_0x3128f7[_0x8bd1('0x43')]){_0x33b6a7[_0x8bd1('0x47')][_0x8bd1('0x1b')]({'id':_0x3128f7[_0x8bd1('0x1c')],'value':_0x3128f7[_0x8bd1('0x46')][_0x8bd1('0x24')]()});}else if(_0x3128f7[_0x8bd1('0x48')]===_0x8bd1('0x49')&&_0x3128f7[_0x8bd1('0x1a')]&&_0x3128f7[_0x8bd1('0x1c')]&&_0x3128f7[_0x8bd1('0x43')]){_0x5b9861[_0x3128f7[_0x8bd1('0x1a')]]&&_0x33b6a7[_0x8bd1('0x47')]['push']({'id':_0x3128f7[_0x8bd1('0x1c')],'value':_0x5b9861[_0x3128f7['variableName']][_0x8bd1('0x24')]()});}else if(_0x3128f7[_0x8bd1('0x48')]===_0x8bd1('0x4a')&&_0x3128f7[_0x8bd1('0x4b')]&&_0x3128f7['Variable'][_0x8bd1('0xa')]&&_0x3128f7['idField']&&_0x3128f7[_0x8bd1('0x43')]){_0x5b9861[_0x3128f7[_0x8bd1('0x4b')][_0x8bd1('0xa')][_0x8bd1('0x45')]()]&&_0x33b6a7[_0x8bd1('0x47')]['push']({'id':_0x3128f7['idField'],'value':_0x5b9861[_0x3128f7[_0x8bd1('0x4b')][_0x8bd1('0xa')][_0x8bd1('0x45')]()]['toString']()});}});}return _0x33b6a7;}function getConnection(_0x41bf1f){return request({'method':_0x8bd1('0x4c'),'form':{'method':_0x8bd1('0x4d'),'input_type':_0x8bd1('0x1e'),'response_type':_0x8bd1('0x1e'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x41bf1f[_0x8bd1('0x4e')],'password':_0x41bf1f[_0x8bd1('0x4f')],'encryption':'PLAIN'},'application':_0x8bd1('0x50')})}})[_0x8bd1('0x37')](function(_0x48bcfb){var _0x38625f=_0x48bcfb;if(_0x38625f['id']){def[_0x8bd1('0x51')]=_0x38625f['id'];return BPromise[_0x8bd1('0x30')](_0x38625f);}else{throw new Error(util[_0x8bd1('0x21')](_0x8bd1('0x52'),_0x41bf1f['id']));}});}function setRelationship(_0x2884e5,_0x52d3c2,_0x43a67e,_0x537480){return request({'form':{'method':'set_relationship','input_type':_0x8bd1('0x1e'),'response_type':_0x8bd1('0x1e'),'rest_data':JSON[_0x8bd1('0x1f')]({'session':_0x2884e5['id'],'module_name':_0x8bd1('0x20'),'module_id':_0x43a67e['id'],'link_field_name':_0x537480,'related_ids':[_0x52d3c2['id']]})}});}exports['queue']=function(_0x3bbb82,_0x576fbf,_0x1e92e1,_0xb89a03,_0x29c869,_0x2e7dd0){var _0x3c187e,_0x3e2dcd,_0x5af039,_0x21e391;_0x2e7dd0[_0x8bd1('0x53')]=intUtil['stripTrailingSlash'](_0x2e7dd0[_0x8bd1('0x53')]);_0x2e7dd0['serverUrl']=intUtil['stripTrailingSlash'](_0x2e7dd0[_0x8bd1('0x54')]);def[_0x8bd1('0x55')]=util['format'](_0x8bd1('0x56'),_0x2e7dd0['remoteUri']);if(_0x29c869&&_0x29c869[_0x8bd1('0x57')]){logger[_0x8bd1('0x9')](_0x8bd1('0x58'),_0x8bd1('0x59'));_0x576fbf[_0x8bd1('0x5a')]=util[_0x8bd1('0x21')](_0x8bd1('0x5b'),_0x2e7dd0[_0x8bd1('0x54')],_0x576fbf[_0x8bd1('0x5c')],md5(_0x576fbf['uniqueid']));}else{_0x576fbf[_0x8bd1('0x5a')]='';}return getConnection(_0x2e7dd0)[_0x8bd1('0x37')](function(_0x427b5b){_0x21e391=_0x427b5b;return getUser(_0x2e7dd0,_0xb89a03[_0x8bd1('0xa')],_0x21e391);})['then'](function(_0x396cda){_0x3c187e=_0x396cda;logger['info'](_0x8bd1('0x5d'),_0x3c187e['id']);return getEndUser(_0x2e7dd0,_0x576fbf[_0x8bd1('0x5e')],_0x576fbf[_0x8bd1('0x5f')],_0x21e391);})[_0x8bd1('0x37')](function(_0x1d557a){_0x3e2dcd=_0x1d557a;logger[_0x8bd1('0x9')](_0x8bd1('0x60'),_0x3e2dcd['id']);return getTicket(_0x2e7dd0,_0x3c187e,_0x3e2dcd,_0x1e92e1,_0x576fbf,_0x1e92e1[_0x8bd1('0x61')],_0x21e391,'Inbound');})['then'](function(_0x43a66f){_0x5af039=_0x43a66f;logger[_0x8bd1('0x9')]('Ticket\x20created!');logger[_0x8bd1('0x9')](_0x8bd1('0x62'),_0x5af039['id']);return setRelationship(_0x21e391,_0x3c187e,_0x5af039,'users');})[_0x8bd1('0x37')](function(){return setRelationship(_0x21e391,_0x3e2dcd,_0x5af039,_0x8bd1('0x63'));})[_0x8bd1('0x37')](function(){return getServerInfo(_0x21e391);})['then'](function(_0x48cdae){var _0x397829=parseInt(_0x48cdae[_0x8bd1('0x64')][_0x8bd1('0x65')](0x0));var _0x3a00ad=util[_0x8bd1('0x21')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x2e7dd0['remoteUri'],_0x5af039['id']);if(_0x397829>0x6){_0x3a00ad=util[_0x8bd1('0x21')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x2e7dd0[_0x8bd1('0x53')],_0x5af039['id']);}logger[_0x8bd1('0x9')](_0x8bd1('0x58'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x8bd1('0x21')](_0x8bd1('0x66'),_0xb89a03[_0x8bd1('0xa')]),_0x8bd1('0x67'),{'uri':_0x3a00ad});})[_0x8bd1('0x68')](function(_0x1ad2ac){logger[_0x8bd1('0x69')](_0x8bd1('0x58'),JSON[_0x8bd1('0x1f')](_0x1ad2ac));});};exports[_0x8bd1('0x6a')]=function(_0x419f3e,_0x4dbaac,_0x4e62e4,_0x45f6d6,_0x2c4123,_0x3ead9b,_0xda3d67){var _0x1f64fc,_0x220a00,_0x447927,_0x1f85b4;_0x3ead9b[_0x8bd1('0x53')]=intUtil['stripTrailingSlash'](_0x3ead9b[_0x8bd1('0x53')]);_0x3ead9b[_0x8bd1('0x54')]=intUtil[_0x8bd1('0x6b')](_0x3ead9b[_0x8bd1('0x54')]);def[_0x8bd1('0x55')]=util[_0x8bd1('0x21')](_0x8bd1('0x56'),_0x3ead9b[_0x8bd1('0x53')]);if(_0xda3d67&&_0xda3d67[_0x8bd1('0x6c')]&&_0xda3d67[_0x8bd1('0x6c')]!==_0x8bd1('0x6d')){logger[_0x8bd1('0x9')](_0x8bd1('0x6e'),_0x8bd1('0x59'));_0x4dbaac[_0x8bd1('0x5a')]=util[_0x8bd1('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ead9b['serverUrl'],_0x4dbaac[_0x8bd1('0x5c')],md5(_0x4dbaac['uniqueid']));}return getConnection(_0x3ead9b)[_0x8bd1('0x37')](function(_0x8093a0){_0x1f85b4=_0x8093a0;return getUser(_0x3ead9b,_0x45f6d6[_0x8bd1('0xa')],_0x1f85b4);})[_0x8bd1('0x37')](function(_0x9c8f33){_0x1f64fc=_0x9c8f33;logger[_0x8bd1('0x9')](_0x8bd1('0x5d'),_0x1f64fc['id']);return getEndUser(_0x3ead9b,_0x4dbaac['destcalleridname'],_0x4dbaac[_0x8bd1('0x6f')],_0x1f85b4);})[_0x8bd1('0x37')](function(_0x13520e){_0x220a00=_0x13520e;logger['info'](_0x8bd1('0x60'),_0x220a00['id']);return getTicket(_0x3ead9b,_0x1f64fc,_0x220a00,_0x4e62e4,_0x4dbaac,_0x4e62e4[_0x8bd1('0x61')],_0x1f85b4,'Outbound');})['then'](function(_0xe6c676){_0x447927=_0xe6c676;logger[_0x8bd1('0x9')](_0x8bd1('0x70'));logger[_0x8bd1('0x9')](_0x8bd1('0x62'),_0x447927['id']);return setRelationship(_0x1f85b4,_0x1f64fc,_0x447927,'users');})[_0x8bd1('0x37')](function(){return setRelationship(_0x1f85b4,_0x220a00,_0x447927,_0x8bd1('0x63'));})['then'](function(){return getServerInfo(_0x1f85b4);})['then'](function(_0x3c9de3){var _0x3d484b=parseInt(_0x3c9de3['version'][_0x8bd1('0x65')](0x0));var _0x21e783=util[_0x8bd1('0x21')](_0x8bd1('0x71'),_0x3ead9b['remoteUri'],_0x447927['id']);if(_0x3d484b>0x6){_0x21e783=util[_0x8bd1('0x21')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x3ead9b[_0x8bd1('0x53')],_0x447927['id']);}logger[_0x8bd1('0x9')](_0x8bd1('0x6e'),_0x8bd1('0x72'));emit(util['format']('user:%s',_0x45f6d6[_0x8bd1('0xa')]),_0x8bd1('0x67'),{'uri':_0x21e783});})[_0x8bd1('0x68')](function(_0x546508){logger[_0x8bd1('0x69')](_0x8bd1('0x6e'),JSON[_0x8bd1('0x1f')](_0x546508));});};exports[_0x8bd1('0x73')]=function(_0x33f065,_0x46de99,_0x2de4f2,_0x2f9e21,_0x27fb0b,_0x5d02a6){var _0x28bb02,_0x17abda,_0x518abf,_0x528c8e;_0x5d02a6[_0x8bd1('0x53')]=intUtil[_0x8bd1('0x6b')](_0x5d02a6[_0x8bd1('0x53')]);_0x5d02a6['serverUrl']=intUtil[_0x8bd1('0x6b')](_0x5d02a6['serverUrl']);def[_0x8bd1('0x55')]=util[_0x8bd1('0x21')]('%s/service/v4_1/rest.php',_0x5d02a6[_0x8bd1('0x53')]);if(_0x27fb0b&&_0x27fb0b[_0x8bd1('0x57')]){logger[_0x8bd1('0x9')]('['+_0x46de99[_0x8bd1('0x74')]['toUpperCase']()+']',_0x8bd1('0x59'));_0x46de99[_0x8bd1('0x5a')]=util['format'](_0x8bd1('0x5b'),_0x5d02a6[_0x8bd1('0x54')],_0x46de99['uniqueid'],md5(_0x46de99[_0x8bd1('0x5c')]));}else{_0x46de99[_0x8bd1('0x5a')]='';}return getConnection(_0x5d02a6)['then'](function(_0x781f1f){_0x528c8e=_0x781f1f;if(!_[_0x8bd1('0x27')](_0x2f9e21)){return getUser(_0x5d02a6,_0x2f9e21[_0x8bd1('0xa')],_0x528c8e);}else{return getUser(_0x5d02a6,null,_0x528c8e);}})[_0x8bd1('0x37')](function(_0x4e4c89){_0x28bb02=_0x4e4c89;logger['info'](_0x8bd1('0x5d'),_0x28bb02['id']);return getEndUser(_0x5d02a6,_0x46de99['calleridname'],_0x46de99[_0x8bd1('0x5f')],_0x528c8e);})[_0x8bd1('0x37')](function(_0x312fb0){_0x17abda=_0x312fb0;logger['info'](_0x8bd1('0x60'),_0x17abda['id']);return getTicket(_0x5d02a6,_0x28bb02,_0x17abda,_0x2de4f2,_0x46de99,_0x2de4f2[_0x8bd1('0x61')],_0x528c8e,_0x8bd1('0x75'));})[_0x8bd1('0x37')](function(_0x1e755d){_0x518abf=_0x1e755d;logger['info']('Ticket\x20created!');logger[_0x8bd1('0x9')](_0x8bd1('0x62'),_0x518abf['id']);return setRelationship(_0x528c8e,_0x28bb02,_0x518abf,_0x8bd1('0x76'));})[_0x8bd1('0x37')](function(){return setRelationship(_0x528c8e,_0x17abda,_0x518abf,_0x8bd1('0x63'));})[_0x8bd1('0x37')](function(){return getServerInfo(_0x528c8e);})['catch'](function(_0x1982da){logger[_0x8bd1('0x69')]('['+_0x46de99[_0x8bd1('0x74')][_0x8bd1('0x77')]()+']',JSON[_0x8bd1('0x1f')](_0x1982da));});}; \ 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 d44dedd..17c1962 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 _0xd05f=['length','sortBy','type','string','content','variable','variableName','push','toString','customVariable','Variable','name','toLowerCase','keyValue','key','format','%s:\x20%s','keyContent','keyType','stripTrailingSlash','substring','lastIndexOf','isNil','test','getString'];(function(_0x5a76fa,_0x627952){var _0x3d0053=function(_0x9db16b){while(--_0x9db16b){_0x5a76fa['push'](_0x5a76fa['shift']());}};_0x3d0053(++_0x627952);}(_0xd05f,0x1da));var _0xfd05=function(_0x3c9176,_0x1bc4de){_0x3c9176=_0x3c9176-0x0;var _0x4ffbdf=_0xd05f[_0x3c9176];return _0x4ffbdf;};'use strict';var _=require('lodash');var util=require('util');exports[_0xfd05('0x0')]=function(_0x838994,_0x162853,_0x1dec34){var _0x197edc=[];if(_0x838994[_0xfd05('0x1')]>0x0){var _0x196494=_[_0xfd05('0x2')](_0x838994,['id']);for(var _0x159799=0x0;_0x159799<_0x196494[_0xfd05('0x1')];_0x159799++){var _0x45a896=_0x196494[_0x159799];if(_0x45a896[_0xfd05('0x3')]===_0xfd05('0x4')){_0x197edc['push'](_0x45a896[_0xfd05('0x5')]);}else if(_0x45a896[_0xfd05('0x3')]===_0xfd05('0x6')&&_0x45a896[_0xfd05('0x7')]){_0x162853[_0x45a896['variableName']]&&_0x197edc[_0xfd05('0x8')](_0x162853[_0x45a896[_0xfd05('0x7')]][_0xfd05('0x9')]());}else if(_0x45a896[_0xfd05('0x3')]===_0xfd05('0xa')&&_0x45a896[_0xfd05('0xb')]&&_0x45a896[_0xfd05('0xb')][_0xfd05('0xc')]){_0x162853[_0x45a896[_0xfd05('0xb')][_0xfd05('0xc')][_0xfd05('0xd')]()]&&_0x197edc[_0xfd05('0x8')](_0x162853[_0x45a896[_0xfd05('0xb')]['name']['toLowerCase']()][_0xfd05('0x9')]());}else if(_0x45a896[_0xfd05('0x3')]===_0xfd05('0xe')){if(_0x45a896['keyType']===_0xfd05('0x4')&&_0x45a896[_0xfd05('0xf')]){_0x197edc[_0xfd05('0x8')](util[_0xfd05('0x10')](_0xfd05('0x11'),_0x45a896[_0xfd05('0xf')],_0x45a896[_0xfd05('0x12')]));}else if(_0x45a896[_0xfd05('0x13')]===_0xfd05('0x6')&&_0x45a896[_0xfd05('0x7')]&&_0x45a896[_0xfd05('0xf')]){_0x162853[_0x45a896[_0xfd05('0x7')]]&&_0x197edc[_0xfd05('0x8')](util[_0xfd05('0x10')]('%s:\x20%s',_0x45a896[_0xfd05('0xf')],_0x162853[_0x45a896[_0xfd05('0x7')]]));}else if(_0x45a896[_0xfd05('0x13')]==='customVariable'&&_0x45a896[_0xfd05('0xb')]&&_0x45a896['Variable']['name']&&_0x45a896[_0xfd05('0xf')]){_0x162853[_0x45a896[_0xfd05('0xb')][_0xfd05('0xc')]['toLowerCase']()]&&_0x197edc['push'](util['format'](_0xfd05('0x11'),_0x45a896[_0xfd05('0xf')],_0x162853[_0x45a896[_0xfd05('0xb')][_0xfd05('0xc')][_0xfd05('0xd')]()]));}}}}return _0x197edc['join'](_0x1dec34);};exports[_0xfd05('0x14')]=function(_0x1fb26){var _0x34d2b3=_0x1fb26['slice'](-0x1);if(_0x34d2b3==='/'){_0x1fb26=_0x1fb26[_0xfd05('0x15')](0x0,_0x1fb26[_0xfd05('0x16')](_0x34d2b3));}return _0x1fb26;};exports['validateEmail']=function(_0x3dcf40){if(!_[_0xfd05('0x17')](_0x3dcf40)&&_0x3dcf40!==''){var _0x13e9b8=/^(([^<>()\[\]\\.,;:\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 _0x13e9b8[_0xfd05('0x18')](String(_0x3dcf40)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x5c05=['test','lodash','util','getString','sortBy','type','string','content','variable','variableName','push','toString','customVariable','Variable','name','toLowerCase','keyValue','key','keyContent','%s:\x20%s','keyType','format','stripTrailingSlash','slice','lastIndexOf','validateEmail'];(function(_0xc288df,_0x4ab756){var _0x146cc0=function(_0x247955){while(--_0x247955){_0xc288df['push'](_0xc288df['shift']());}};_0x146cc0(++_0x4ab756);}(_0x5c05,0x1d5));var _0x55c0=function(_0xde786f,_0x412a32){_0xde786f=_0xde786f-0x0;var _0x240fd1=_0x5c05[_0xde786f];return _0x240fd1;};'use strict';var _=require(_0x55c0('0x0'));var util=require(_0x55c0('0x1'));exports[_0x55c0('0x2')]=function(_0x53a0e8,_0x2d32e3,_0x5d9f0b){var _0x3dec48=[];if(_0x53a0e8['length']>0x0){var _0x85eb9e=_[_0x55c0('0x3')](_0x53a0e8,['id']);for(var _0x430170=0x0;_0x430170<_0x85eb9e['length'];_0x430170++){var _0x7c79bd=_0x85eb9e[_0x430170];if(_0x7c79bd[_0x55c0('0x4')]===_0x55c0('0x5')){_0x3dec48['push'](_0x7c79bd[_0x55c0('0x6')]);}else if(_0x7c79bd[_0x55c0('0x4')]===_0x55c0('0x7')&&_0x7c79bd[_0x55c0('0x8')]){_0x2d32e3[_0x7c79bd['variableName']]&&_0x3dec48[_0x55c0('0x9')](_0x2d32e3[_0x7c79bd[_0x55c0('0x8')]][_0x55c0('0xa')]());}else if(_0x7c79bd[_0x55c0('0x4')]===_0x55c0('0xb')&&_0x7c79bd[_0x55c0('0xc')]&&_0x7c79bd[_0x55c0('0xc')]['name']){_0x2d32e3[_0x7c79bd[_0x55c0('0xc')][_0x55c0('0xd')][_0x55c0('0xe')]()]&&_0x3dec48[_0x55c0('0x9')](_0x2d32e3[_0x7c79bd['Variable'][_0x55c0('0xd')][_0x55c0('0xe')]()][_0x55c0('0xa')]());}else if(_0x7c79bd[_0x55c0('0x4')]===_0x55c0('0xf')){if(_0x7c79bd['keyType']===_0x55c0('0x5')&&_0x7c79bd[_0x55c0('0x10')]){_0x3dec48[_0x55c0('0x9')](util['format']('%s:\x20%s',_0x7c79bd[_0x55c0('0x10')],_0x7c79bd[_0x55c0('0x11')]));}else if(_0x7c79bd['keyType']===_0x55c0('0x7')&&_0x7c79bd[_0x55c0('0x8')]&&_0x7c79bd[_0x55c0('0x10')]){_0x2d32e3[_0x7c79bd[_0x55c0('0x8')]]&&_0x3dec48[_0x55c0('0x9')](util['format'](_0x55c0('0x12'),_0x7c79bd[_0x55c0('0x10')],_0x2d32e3[_0x7c79bd[_0x55c0('0x8')]]));}else if(_0x7c79bd[_0x55c0('0x13')]==='customVariable'&&_0x7c79bd[_0x55c0('0xc')]&&_0x7c79bd[_0x55c0('0xc')][_0x55c0('0xd')]&&_0x7c79bd[_0x55c0('0x10')]){_0x2d32e3[_0x7c79bd[_0x55c0('0xc')][_0x55c0('0xd')][_0x55c0('0xe')]()]&&_0x3dec48['push'](util[_0x55c0('0x14')](_0x55c0('0x12'),_0x7c79bd[_0x55c0('0x10')],_0x2d32e3[_0x7c79bd[_0x55c0('0xc')]['name'][_0x55c0('0xe')]()]));}}}}return _0x3dec48['join'](_0x5d9f0b);};exports[_0x55c0('0x15')]=function(_0x317833){var _0x222774=_0x317833[_0x55c0('0x16')](-0x1);if(_0x222774==='/'){_0x317833=_0x317833['substring'](0x0,_0x317833[_0x55c0('0x17')](_0x222774));}return _0x317833;};exports[_0x55c0('0x18')]=function(_0x5e2fa4){if(!_['isNil'](_0x5e2fa4)&&_0x5e2fa4!==''){var _0x383692=/^(([^<>()\[\]\\.,;:\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 _0x383692[_0x55c0('0x19')](String(_0x5e2fa4)['toLowerCase']());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index f670a0a..3a6a6ec 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 _0x5084=['Open','getString','Subjects','Descriptions','POST','%s/webservice.php','remoteUri','create','sessionName','HelpDesk','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','stringify','error','catch','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','format','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','then','Agent\x20found!','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','phone','getchallenge','login','token','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','split','[OUTBOUND]','lastevent','toUpperCase','calleridname','Fields','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','socket.io-emitter','emit','length','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','info','merge','Normal'];(function(_0x1b5c54,_0x11d5cc){var _0x18529b=function(_0x1810bb){while(--_0x1810bb){_0x1b5c54['push'](_0x1b5c54['shift']());}};_0x18529b(++_0x11d5cc);}(_0x5084,0x17f));var _0x4508=function(_0x44b9cc,_0x33014a){_0x44b9cc=_0x44b9cc-0x0;var _0x2dc906=_0x5084[_0x44b9cc];return _0x2dc906;};'use strict';var _=require(_0x4508('0x0'));var rp=require(_0x4508('0x1'));var BPromise=require(_0x4508('0x2'));var md5=require(_0x4508('0x3'));var util=require(_0x4508('0x4'));var Redis=require(_0x4508('0x5'));var intUtil=require(_0x4508('0x6'));var config=require(_0x4508('0x7'));var logger=require(_0x4508('0x8'))(_0x4508('0x9'));config[_0x4508('0xa')]=_[_0x4508('0xb')](config[_0x4508('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x4508('0xc'))(new Redis(config[_0x4508('0xa')]));function emit(_0x20a1d3,_0x567176,_0x27a5fc){io['to'](_0x20a1d3)[_0x4508('0xd')](_0x567176,_0x27a5fc);}function getCustomFields(_0x3643ec,_0x310869){var _0x13bbdb={};if(_0x3643ec[_0x4508('0xe')]>0x0){_[_0x4508('0xf')](_0x3643ec,function(_0x4a085a){if(_0x4a085a[_0x4508('0x10')]===_0x4508('0x11')&&_0x4a085a[_0x4508('0x12')]){_0x13bbdb[_0x4a085a['idField']]=_0x4a085a[_0x4508('0x13')][_0x4508('0x14')]();}else if(_0x4a085a[_0x4508('0x10')]===_0x4508('0x15')&&_0x4a085a[_0x4508('0x16')]&&_0x4a085a[_0x4508('0x12')]&&_0x310869[_0x4a085a[_0x4508('0x16')]]){_0x13bbdb[_0x4a085a['idField']]=_0x310869[_0x4a085a[_0x4508('0x16')]]['toString']();}else if(_0x4a085a[_0x4508('0x10')]===_0x4508('0x17')&&_0x4a085a['Variable']&&_0x4a085a[_0x4508('0x18')]['name']&&_0x4a085a[_0x4508('0x12')]&&_0x310869[_0x4a085a[_0x4508('0x18')][_0x4508('0x19')]['toLowerCase']()]){_0x13bbdb[_0x4a085a[_0x4508('0x12')]]=_0x310869[_0x4a085a[_0x4508('0x18')][_0x4508('0x19')]['toLowerCase']()][_0x4508('0x14')]();}});}return _0x13bbdb;}function createTicket(_0x16a690,_0xd53ab6,_0x1232bb,_0x52b5f3,_0x241084,_0x233215,_0x15e26d){logger[_0x4508('0x1a')]('Creating\x20new\x20ticket...');var _0x36a7fd=_[_0x4508('0x1b')]({'parent_id':'','assigned_user_id':_0xd53ab6['id'],'ticketpriorities':_0x4508('0x1c'),'ticketstatus':_0x4508('0x1d'),'ticket_title':intUtil[_0x4508('0x1e')](_0x52b5f3[_0x4508('0x1f')],_0x241084,'\x20'),'description':intUtil[_0x4508('0x1e')](_0x52b5f3[_0x4508('0x20')],_0x241084,'\x0a'),'contact_id':_0x1232bb['id']},getCustomFields(_0x233215,_0x241084));var _0x4948f5={'method':_0x4508('0x21'),'uri':util['format'](_0x4508('0x22'),_0x16a690[_0x4508('0x23')]),'form':{'operation':_0x4508('0x24'),'username':_0x16a690['username'],'sessionName':_0x15e26d[_0x4508('0x25')],'elementType':_0x4508('0x26'),'element':JSON['stringify'](_0x36a7fd)},'json':!![]};return request(_0x4948f5)['then'](function(_0x2cfd6d){if(_0x2cfd6d[_0x4508('0x27')]){return BPromise[_0x4508('0x28')]({'id':_0x2cfd6d[_0x4508('0x29')]['id']});}else{throw new Error(util['format'](_0x4508('0x2a'),JSON[_0x4508('0x2b')](_0x2cfd6d[_0x4508('0x2c')])));}})[_0x4508('0x2d')](function(_0x145d90){var _0x50e985=_0x145d90['statusCode']||0x1f4;logger[_0x4508('0x2c')](_0x4508('0x2e'),_0x4508('0x2f'),_0x50e985,JSON[_0x4508('0x2b')](_0x145d90));});}function getUser(_0x103ff4,_0x472b73,_0x4f5f86){if(intUtil[_0x4508('0x30')](_0x472b73)){logger['info'](_0x4508('0x31'),_0x472b73);return request({'method':_0x4508('0x32'),'uri':util[_0x4508('0x33')](_0x4508('0x22'),_0x103ff4['remoteUri']),'qs':{'operation':_0x4508('0x34'),'username':_0x103ff4[_0x4508('0x35')],'sessionName':_0x4f5f86[_0x4508('0x25')],'query':util[_0x4508('0x33')](_0x4508('0x36'),_0x472b73)},'json':!![]})[_0x4508('0x37')](function(_0x44a4b1){if(_0x44a4b1['success']&&_0x44a4b1[_0x4508('0x29')][_0x4508('0xe')]){logger[_0x4508('0x1a')](_0x4508('0x38'));return BPromise['resolve']({'id':_0x44a4b1[_0x4508('0x29')][0x0]['id'],'email':_0x44a4b1[_0x4508('0x29')][0x0][_0x4508('0x39')],'name':_0x44a4b1[_0x4508('0x29')][0x0][_0x4508('0x3a')]+'\x20'+_0x44a4b1['result']['last_name']});}else{logger[_0x4508('0x1a')](_0x4508('0x3b'));return BPromise['resolve']({'id':_0x4f5f86[_0x4508('0x3c')],'email':_0x103ff4[_0x4508('0x35')],'name':_0x4508('0x3d')});}})['catch'](function(_0x3e21eb){var _0x1f9593=_0x3e21eb[_0x4508('0x3e')]||0x1f4;logger[_0x4508('0x2c')](_0x4508('0x2e'),_0x4508('0x3f'),_0x1f9593,JSON[_0x4508('0x2b')](_0x3e21eb));});}else{logger['info'](_0x4508('0x3b'));return BPromise[_0x4508('0x28')]({'id':_0x4f5f86[_0x4508('0x3c')],'email':_0x103ff4[_0x4508('0x35')],'name':_0x4508('0x3d')})['catch'](function(_0x5c37b1){var _0x42fadb=_0x5c37b1['statusCode']||0x1f4;logger[_0x4508('0x2c')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x4508('0x3f'),_0x42fadb,JSON[_0x4508('0x2b')](_0x5c37b1));});}}function getEndUser(_0x3dae4b,_0x95599c,_0x5862a2,_0x4963cc){logger['info'](_0x4508('0x40'),_0x5862a2);return request({'method':_0x4508('0x32'),'uri':util[_0x4508('0x33')](_0x4508('0x22'),_0x3dae4b['remoteUri']),'qs':{'operation':_0x4508('0x34'),'username':_0x3dae4b[_0x4508('0x35')],'sessionName':_0x4963cc[_0x4508('0x25')],'query':util[_0x4508('0x33')](_0x4508('0x41'),_0x5862a2,_0x5862a2,_0x5862a2,_0x5862a2,_0x5862a2)},'json':!![]})[_0x4508('0x37')](function(_0x58511c){if(_0x58511c['success']&&_0x58511c[_0x4508('0x29')][_0x4508('0xe')]){logger[_0x4508('0x1a')](_0x4508('0x42'));return BPromise[_0x4508('0x28')]({'id':_0x58511c[_0x4508('0x29')][0x0]['id'],'name':_0x58511c[_0x4508('0x29')][0x0][_0x4508('0x43')]+'\x20'+_0x58511c['result'][0x0][_0x4508('0x44')],'phone':_0x5862a2});}else{logger['info'](_0x4508('0x45'));return request({'method':_0x4508('0x21'),'uri':util[_0x4508('0x33')]('%s/webservice.php',_0x3dae4b[_0x4508('0x23')]),'form':{'operation':_0x4508('0x24'),'sessionName':_0x4963cc[_0x4508('0x25')],'elementType':'Contacts','element':JSON[_0x4508('0x2b')]({'lastname':_0x95599c,'phone':_0x5862a2,'assigned_user_id':'\x20'})},'json':!![]})[_0x4508('0x37')](function(_0x560d77){logger[_0x4508('0x1a')](_0x4508('0x46'));return BPromise['resolve']({'id':_0x560d77[_0x4508('0x29')]['id'],'name':_0x560d77[_0x4508('0x29')]['lastname'],'phone':_0x560d77[_0x4508('0x29')][_0x4508('0x47')]});})[_0x4508('0x2d')](function(_0x3376c8){var _0x41f1c7=_0x3376c8[_0x4508('0x3e')]||0x1f4;logger[_0x4508('0x2c')](_0x4508('0x2e'),'getEndUser',_0x41f1c7,JSON[_0x4508('0x2b')](_0x3376c8));});}});}function getConnection(_0x447a54){var _0x3433d1=_0x447a54[_0x4508('0x35')];var _0x507089=_0x447a54['accessKey'];return request({'method':_0x4508('0x32'),'uri':util[_0x4508('0x33')](_0x4508('0x22'),_0x447a54['remoteUri']),'qs':{'operation':_0x4508('0x48'),'username':_0x3433d1},'json':!![]})[_0x4508('0x37')](function(_0x5d6f32){if(_0x5d6f32[_0x4508('0x27')]){return request({'method':_0x4508('0x21'),'uri':util[_0x4508('0x33')](_0x4508('0x22'),_0x447a54[_0x4508('0x23')]),'form':{'operation':_0x4508('0x49'),'username':_0x3433d1,'accessKey':md5(_0x5d6f32[_0x4508('0x29')][_0x4508('0x4a')]+_0x507089)},'json':!![]});}})[_0x4508('0x37')](function(_0x31b3cc){if(_0x31b3cc[_0x4508('0x27')]){return BPromise[_0x4508('0x28')](_0x31b3cc[_0x4508('0x29')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x447a54['id']));}})[_0x4508('0x2d')](function(_0x47cc0a){var _0x5b203c=_0x47cc0a['statusCode']||0x1f4;logger[_0x4508('0x2c')](_0x4508('0x2e'),_0x4508('0x4b'),_0x5b203c,JSON[_0x4508('0x2b')](_0x47cc0a));});}function request(_0x359bd8){logger[_0x4508('0x1a')](_0x4508('0x4c'),JSON[_0x4508('0x2b')](_0x359bd8));return rp(_0x359bd8);}exports[_0x4508('0x4d')]=function(_0x142c8c,_0x1fc97e,_0x907d29,_0x4c1030,_0x40b022,_0x12e1c0){var _0x82c7fa,_0x412791,_0x1b39c5,_0x27ec4e;_0x12e1c0[_0x4508('0x23')]=intUtil[_0x4508('0x4e')](_0x12e1c0[_0x4508('0x23')]);if(_0x40b022&&_0x40b022['monitor_format']){logger['info'](_0x4508('0x4f'),_0x4508('0x50'));_0x1fc97e['recordingURL']=util['format'](_0x4508('0x51'),_0x12e1c0[_0x4508('0x52')],_0x1fc97e[_0x4508('0x53')],md5(_0x1fc97e[_0x4508('0x53')]));}else{_0x1fc97e[_0x4508('0x54')]='';}return getConnection(_0x12e1c0)[_0x4508('0x37')](function(_0x85add9){_0x27ec4e=_0x85add9;return getUser(_0x12e1c0,_0x4c1030[_0x4508('0x55')],_0x27ec4e);})[_0x4508('0x37')](function(_0x3741a6){_0x82c7fa=_0x3741a6;logger[_0x4508('0x1a')](_0x4508('0x56'),_0x82c7fa['id']);return getEndUser(_0x12e1c0,_0x1fc97e['calleridname'],_0x1fc97e[_0x4508('0x57')],_0x27ec4e);})[_0x4508('0x37')](function(_0x454f40){_0x412791=_0x454f40;logger[_0x4508('0x1a')](_0x4508('0x58'),_0x412791['id']);return createTicket(_0x12e1c0,_0x82c7fa,_0x412791,_0x907d29,_0x1fc97e,_0x907d29['Fields'],_0x27ec4e);})[_0x4508('0x37')](function(_0x44b072){_0x1b39c5=_0x44b072;logger[_0x4508('0x1a')](_0x4508('0x59'));logger[_0x4508('0x1a')](_0x4508('0x5a'),_0x1b39c5['id']);var _0x333b0a=util[_0x4508('0x33')](_0x4508('0x5b'),_0x12e1c0['remoteUri'],_['split'](_0x1b39c5['id'],'x')[0x1]);logger['info'](_0x4508('0x4f'),_0x4508('0x5c'));emit(util[_0x4508('0x33')](_0x4508('0x5d'),_0x4c1030[_0x4508('0x19')]),_0x4508('0x5e'),{'uri':_0x333b0a});})['catch'](function(_0x354ca2){logger[_0x4508('0x2c')](_0x4508('0x4f'),JSON[_0x4508('0x2b')](_0x354ca2));});};exports[_0x4508('0x5f')]=function(_0x24a31d,_0x261586,_0x5d0e16,_0x370c89,_0x5a9d50,_0x1ed39d,_0x30651b){var _0x10c44c,_0x14d285,_0x106246,_0x36e09e;_0x1ed39d['remoteUri']=intUtil[_0x4508('0x4e')](_0x1ed39d[_0x4508('0x23')]);_0x1ed39d[_0x4508('0x52')]=intUtil[_0x4508('0x4e')](_0x1ed39d['serverUrl']);if(_0x30651b&&_0x30651b[_0x4508('0x60')]&&_0x30651b['recordingFormat']!=='none'){logger[_0x4508('0x1a')]('[OUTBOUND]',_0x4508('0x50'));_0x261586['recordingURL']=util['format'](_0x4508('0x51'),_0x1ed39d[_0x4508('0x52')],_0x261586[_0x4508('0x53')],md5(_0x261586[_0x4508('0x53')]));}return getConnection(_0x1ed39d)[_0x4508('0x37')](function(_0x3bf2d0){_0x36e09e=_0x3bf2d0;return getUser(_0x1ed39d,_0x370c89['email'],_0x36e09e);})[_0x4508('0x37')](function(_0x53d03b){_0x10c44c=_0x53d03b;logger[_0x4508('0x1a')](_0x4508('0x56'),_0x10c44c['id']);return getEndUser(_0x1ed39d,_0x261586['destcalleridname'],_0x261586['destcalleridnum'],_0x36e09e);})[_0x4508('0x37')](function(_0x29405c){_0x14d285=_0x29405c;logger[_0x4508('0x1a')](_0x4508('0x58'),_0x14d285['id']);return createTicket(_0x1ed39d,_0x10c44c,_0x14d285,_0x5d0e16,_0x261586,_0x5d0e16['Fields'],_0x36e09e);})[_0x4508('0x37')](function(_0x196a64){_0x106246=_0x196a64;logger[_0x4508('0x1a')](_0x4508('0x59'));logger[_0x4508('0x1a')](_0x4508('0x5a'),_0x106246['id']);var _0x436873=util[_0x4508('0x33')](_0x4508('0x5b'),_0x1ed39d[_0x4508('0x23')],_[_0x4508('0x61')](_0x106246['id'],'x')[0x1]);logger[_0x4508('0x1a')](_0x4508('0x62'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x4508('0x33')](_0x4508('0x5d'),_0x370c89[_0x4508('0x19')]),_0x4508('0x5e'),{'uri':_0x436873});})[_0x4508('0x2d')](function(_0x10cedc){logger['error'](_0x4508('0x62'),JSON[_0x4508('0x2b')](_0x10cedc));});};exports['unmanaged']=function(_0x2d8d52,_0x9e3582,_0x71885b,_0x217350,_0x567f31,_0x59310b){var _0x439507,_0x103946,_0x595b0a,_0x577b1c;_0x59310b['remoteUri']=intUtil[_0x4508('0x4e')](_0x59310b[_0x4508('0x23')]);_0x59310b[_0x4508('0x52')]=intUtil[_0x4508('0x4e')](_0x59310b[_0x4508('0x52')]);if(_0x567f31&&_0x567f31['monitor_format']){logger[_0x4508('0x1a')]('['+_0x9e3582[_0x4508('0x63')][_0x4508('0x64')]()+']','Recording\x20is\x20enabled!');_0x9e3582[_0x4508('0x54')]=util['format'](_0x4508('0x51'),_0x59310b['serverUrl'],_0x9e3582['uniqueid'],md5(_0x9e3582[_0x4508('0x53')]));}else{_0x9e3582[_0x4508('0x54')]='';}return getConnection(_0x59310b)[_0x4508('0x37')](function(_0x399fab){_0x577b1c=_0x399fab;return getUser(_0x59310b,'',_0x577b1c);})['then'](function(_0x398394){_0x439507=_0x398394;logger['info'](_0x4508('0x56'),_0x439507['id']);return getEndUser(_0x59310b,_0x9e3582[_0x4508('0x65')],_0x9e3582[_0x4508('0x57')],_0x577b1c);})[_0x4508('0x37')](function(_0xb70ebe){_0x103946=_0xb70ebe;logger[_0x4508('0x1a')]('The\x20Enduser\x20ID\x20is:',_0x103946['id']);return createTicket(_0x59310b,_0x439507,_0x103946,_0x71885b,_0x9e3582,_0x71885b[_0x4508('0x66')],_0x577b1c);})[_0x4508('0x37')](function(_0xb47f53){_0x595b0a=_0xb47f53;logger[_0x4508('0x1a')](_0x4508('0x59'));logger[_0x4508('0x1a')](_0x4508('0x5a'),_0x595b0a['id']);})['catch'](function(_0x8ddac4){logger['error']('['+_0x9e3582['lastevent']['toUpperCase']()+']',JSON[_0x4508('0x2b')](_0x8ddac4));});}; \ No newline at end of file +var _0xcf9c=['getEndUser','accessKey','getchallenge','login','token','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','split','user:%s','trigger:browser:url','recordingFormat','destcalleridname','destcalleridnum','Fields','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[OUTBOUND]','toUpperCase','The\x20User\x20ID\x20is:','lastevent','lodash','request-promise','bluebird','md5','util','./util','../../../../config/environment','vTiger','redis','defaults','localhost','socket.io-emitter','emit','forEach','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','merge','Normal','Open','getString','Subjects','Descriptions','POST','format','%s/webservice.php','remoteUri','username','sessionName','stringify','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','length','Agent\x20found!','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','[vTiger],\x20%s,\x20%s,\x20%s','query','Enduser\x20found!','firstname','lastname','create','Contacts','phone'];(function(_0xb61433,_0x31d758){var _0x123400=function(_0x14b3db){while(--_0x14b3db){_0xb61433['push'](_0xb61433['shift']());}};_0x123400(++_0x31d758);}(_0xcf9c,0x13a));var _0xccf9=function(_0x4039c7,_0x346ce4){_0x4039c7=_0x4039c7-0x0;var _0x576f16=_0xcf9c[_0x4039c7];return _0x576f16;};'use strict';var _=require(_0xccf9('0x0'));var rp=require(_0xccf9('0x1'));var BPromise=require(_0xccf9('0x2'));var md5=require(_0xccf9('0x3'));var util=require(_0xccf9('0x4'));var Redis=require('ioredis');var intUtil=require(_0xccf9('0x5'));var config=require(_0xccf9('0x6'));var logger=require('../../../../config/logger')(_0xccf9('0x7'));config[_0xccf9('0x8')]=_[_0xccf9('0x9')](config[_0xccf9('0x8')],{'host':_0xccf9('0xa'),'port':0x18eb});var io=require(_0xccf9('0xb'))(new Redis(config['redis']));function emit(_0xa5cb2f,_0xebef88,_0x388b4f){io['to'](_0xa5cb2f)[_0xccf9('0xc')](_0xebef88,_0x388b4f);}function getCustomFields(_0x92768c,_0x2f3045){var _0x3330d0={};if(_0x92768c['length']>0x0){_[_0xccf9('0xd')](_0x92768c,function(_0x38952e){if(_0x38952e[_0xccf9('0xe')]==='string'&&_0x38952e[_0xccf9('0xf')]){_0x3330d0[_0x38952e[_0xccf9('0xf')]]=_0x38952e[_0xccf9('0x10')]['toString']();}else if(_0x38952e[_0xccf9('0xe')]===_0xccf9('0x11')&&_0x38952e[_0xccf9('0x12')]&&_0x38952e['idField']&&_0x2f3045[_0x38952e[_0xccf9('0x12')]]){_0x3330d0[_0x38952e['idField']]=_0x2f3045[_0x38952e[_0xccf9('0x12')]][_0xccf9('0x13')]();}else if(_0x38952e[_0xccf9('0xe')]===_0xccf9('0x14')&&_0x38952e['Variable']&&_0x38952e[_0xccf9('0x15')]['name']&&_0x38952e['idField']&&_0x2f3045[_0x38952e['Variable'][_0xccf9('0x16')]['toLowerCase']()]){_0x3330d0[_0x38952e[_0xccf9('0xf')]]=_0x2f3045[_0x38952e[_0xccf9('0x15')][_0xccf9('0x16')][_0xccf9('0x17')]()]['toString']();}});}return _0x3330d0;}function createTicket(_0x4c0083,_0x33011e,_0x282166,_0x435652,_0x3aff75,_0x442e0f,_0x3765c6){logger[_0xccf9('0x18')]('Creating\x20new\x20ticket...');var _0x48525e=_[_0xccf9('0x19')]({'parent_id':'','assigned_user_id':_0x33011e['id'],'ticketpriorities':_0xccf9('0x1a'),'ticketstatus':_0xccf9('0x1b'),'ticket_title':intUtil[_0xccf9('0x1c')](_0x435652[_0xccf9('0x1d')],_0x3aff75,'\x20'),'description':intUtil[_0xccf9('0x1c')](_0x435652[_0xccf9('0x1e')],_0x3aff75,'\x0a'),'contact_id':_0x282166['id']},getCustomFields(_0x442e0f,_0x3aff75));var _0x23ae56={'method':_0xccf9('0x1f'),'uri':util[_0xccf9('0x20')](_0xccf9('0x21'),_0x4c0083[_0xccf9('0x22')]),'form':{'operation':'create','username':_0x4c0083[_0xccf9('0x23')],'sessionName':_0x3765c6[_0xccf9('0x24')],'elementType':'HelpDesk','element':JSON[_0xccf9('0x25')](_0x48525e)},'json':!![]};return request(_0x23ae56)[_0xccf9('0x26')](function(_0x123907){if(_0x123907[_0xccf9('0x27')]){return BPromise[_0xccf9('0x28')]({'id':_0x123907[_0xccf9('0x29')]['id']});}else{throw new Error(util[_0xccf9('0x20')](_0xccf9('0x2a'),JSON[_0xccf9('0x25')](_0x123907[_0xccf9('0x2b')])));}})[_0xccf9('0x2c')](function(_0x48a547){var _0x473534=_0x48a547[_0xccf9('0x2d')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x473534,JSON['stringify'](_0x48a547));});}function getUser(_0x452d14,_0x31836d,_0x1fd15a){if(intUtil['validateEmail'](_0x31836d)){logger['info'](_0xccf9('0x2e'),_0x31836d);return request({'method':_0xccf9('0x2f'),'uri':util['format']('%s/webservice.php',_0x452d14[_0xccf9('0x22')]),'qs':{'operation':'query','username':_0x452d14[_0xccf9('0x23')],'sessionName':_0x1fd15a['sessionName'],'query':util[_0xccf9('0x20')](_0xccf9('0x30'),_0x31836d)},'json':!![]})[_0xccf9('0x26')](function(_0x40cd1b){if(_0x40cd1b[_0xccf9('0x27')]&&_0x40cd1b['result'][_0xccf9('0x31')]){logger[_0xccf9('0x18')](_0xccf9('0x32'));return BPromise[_0xccf9('0x28')]({'id':_0x40cd1b['result'][0x0]['id'],'email':_0x40cd1b[_0xccf9('0x29')][0x0]['email1'],'name':_0x40cd1b[_0xccf9('0x29')][0x0][_0xccf9('0x33')]+'\x20'+_0x40cd1b[_0xccf9('0x29')]['last_name']});}else{logger['info'](_0xccf9('0x34'));return BPromise[_0xccf9('0x28')]({'id':_0x1fd15a['userId'],'email':_0x452d14[_0xccf9('0x23')],'name':_0xccf9('0x35')});}})[_0xccf9('0x2c')](function(_0x1035ad){var _0x7ee4b0=_0x1035ad[_0xccf9('0x2d')]||0x1f4;logger['error'](_0xccf9('0x36'),'getUser',_0x7ee4b0,JSON['stringify'](_0x1035ad));});}else{logger[_0xccf9('0x18')](_0xccf9('0x34'));return BPromise[_0xccf9('0x28')]({'id':_0x1fd15a['userId'],'email':_0x452d14[_0xccf9('0x23')],'name':_0xccf9('0x35')})[_0xccf9('0x2c')](function(_0x56cd6a){var _0x153833=_0x56cd6a[_0xccf9('0x2d')]||0x1f4;logger[_0xccf9('0x2b')](_0xccf9('0x36'),'getUser',_0x153833,JSON[_0xccf9('0x25')](_0x56cd6a));});}}function getEndUser(_0x26b4eb,_0x3bb8b6,_0x3f59e4,_0x41b8f2){logger['info']('Searching\x20end\x20user\x20with\x20phone',_0x3f59e4);return request({'method':_0xccf9('0x2f'),'uri':util['format'](_0xccf9('0x21'),_0x26b4eb['remoteUri']),'qs':{'operation':_0xccf9('0x37'),'username':_0x26b4eb[_0xccf9('0x23')],'sessionName':_0x41b8f2['sessionName'],'query':util[_0xccf9('0x20')]('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;',_0x3f59e4,_0x3f59e4,_0x3f59e4,_0x3f59e4,_0x3f59e4)},'json':!![]})[_0xccf9('0x26')](function(_0x2165d1){if(_0x2165d1['success']&&_0x2165d1['result'][_0xccf9('0x31')]){logger[_0xccf9('0x18')](_0xccf9('0x38'));return BPromise['resolve']({'id':_0x2165d1[_0xccf9('0x29')][0x0]['id'],'name':_0x2165d1[_0xccf9('0x29')][0x0][_0xccf9('0x39')]+'\x20'+_0x2165d1['result'][0x0][_0xccf9('0x3a')],'phone':_0x3f59e4});}else{logger[_0xccf9('0x18')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0xccf9('0x1f'),'uri':util[_0xccf9('0x20')](_0xccf9('0x21'),_0x26b4eb['remoteUri']),'form':{'operation':_0xccf9('0x3b'),'sessionName':_0x41b8f2[_0xccf9('0x24')],'elementType':_0xccf9('0x3c'),'element':JSON[_0xccf9('0x25')]({'lastname':_0x3bb8b6,'phone':_0x3f59e4,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x5a35f9){logger[_0xccf9('0x18')]('Enduser\x20created.');return BPromise[_0xccf9('0x28')]({'id':_0x5a35f9[_0xccf9('0x29')]['id'],'name':_0x5a35f9[_0xccf9('0x29')][_0xccf9('0x3a')],'phone':_0x5a35f9[_0xccf9('0x29')][_0xccf9('0x3d')]});})[_0xccf9('0x2c')](function(_0x49cd9c){var _0x236c98=_0x49cd9c[_0xccf9('0x2d')]||0x1f4;logger[_0xccf9('0x2b')](_0xccf9('0x36'),_0xccf9('0x3e'),_0x236c98,JSON[_0xccf9('0x25')](_0x49cd9c));});}});}function getConnection(_0x25dd86){var _0x1f7ed9=_0x25dd86[_0xccf9('0x23')];var _0x268d14=_0x25dd86[_0xccf9('0x3f')];return request({'method':'GET','uri':util[_0xccf9('0x20')](_0xccf9('0x21'),_0x25dd86['remoteUri']),'qs':{'operation':_0xccf9('0x40'),'username':_0x1f7ed9},'json':!![]})['then'](function(_0x292477){if(_0x292477[_0xccf9('0x27')]){return request({'method':_0xccf9('0x1f'),'uri':util['format'](_0xccf9('0x21'),_0x25dd86['remoteUri']),'form':{'operation':_0xccf9('0x41'),'username':_0x1f7ed9,'accessKey':md5(_0x292477[_0xccf9('0x29')][_0xccf9('0x42')]+_0x268d14)},'json':!![]});}})[_0xccf9('0x26')](function(_0xb84b96){if(_0xb84b96[_0xccf9('0x27')]){return BPromise[_0xccf9('0x28')](_0xb84b96['result']);}else{throw new Error(util[_0xccf9('0x20')]('Account\x20%d\x20is\x20not\x20valid',_0x25dd86['id']));}})['catch'](function(_0x53427f){var _0x3ba5f0=_0x53427f[_0xccf9('0x2d')]||0x1f4;logger[_0xccf9('0x2b')]('[vTiger],\x20%s,\x20%s,\x20%s','getConnection',_0x3ba5f0,JSON[_0xccf9('0x25')](_0x53427f));});}function request(_0xad4578){logger[_0xccf9('0x18')]('[HTTP]',JSON[_0xccf9('0x25')](_0xad4578));return rp(_0xad4578);}exports[_0xccf9('0x43')]=function(_0x4721dd,_0x464e14,_0x588c9e,_0x2fefa1,_0x4e4f15,_0x362175){var _0x2cb42b,_0x377703,_0x221ecb,_0x264a31;_0x362175[_0xccf9('0x22')]=intUtil[_0xccf9('0x44')](_0x362175[_0xccf9('0x22')]);if(_0x4e4f15&&_0x4e4f15[_0xccf9('0x45')]){logger['info'](_0xccf9('0x46'),_0xccf9('0x47'));_0x464e14[_0xccf9('0x48')]=util[_0xccf9('0x20')](_0xccf9('0x49'),_0x362175[_0xccf9('0x4a')],_0x464e14[_0xccf9('0x4b')],md5(_0x464e14[_0xccf9('0x4b')]));}else{_0x464e14[_0xccf9('0x48')]='';}return getConnection(_0x362175)['then'](function(_0x4972a2){_0x264a31=_0x4972a2;return getUser(_0x362175,_0x2fefa1[_0xccf9('0x4c')],_0x264a31);})[_0xccf9('0x26')](function(_0x5e4526){_0x2cb42b=_0x5e4526;logger[_0xccf9('0x18')]('The\x20User\x20ID\x20is:',_0x2cb42b['id']);return getEndUser(_0x362175,_0x464e14[_0xccf9('0x4d')],_0x464e14[_0xccf9('0x4e')],_0x264a31);})[_0xccf9('0x26')](function(_0x29510c){_0x377703=_0x29510c;logger['info'](_0xccf9('0x4f'),_0x377703['id']);return createTicket(_0x362175,_0x2cb42b,_0x377703,_0x588c9e,_0x464e14,_0x588c9e['Fields'],_0x264a31);})[_0xccf9('0x26')](function(_0xde0dd0){_0x221ecb=_0xde0dd0;logger[_0xccf9('0x18')](_0xccf9('0x50'));logger[_0xccf9('0x18')](_0xccf9('0x51'),_0x221ecb['id']);var _0x30a5ac=util[_0xccf9('0x20')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x362175[_0xccf9('0x22')],_[_0xccf9('0x52')](_0x221ecb['id'],'x')[0x1]);logger[_0xccf9('0x18')](_0xccf9('0x46'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xccf9('0x53'),_0x2fefa1[_0xccf9('0x16')]),_0xccf9('0x54'),{'uri':_0x30a5ac});})[_0xccf9('0x2c')](function(_0x81d4c8){logger[_0xccf9('0x2b')](_0xccf9('0x46'),JSON[_0xccf9('0x25')](_0x81d4c8));});};exports['outbound']=function(_0x199979,_0x162d81,_0x38e3ef,_0x43c739,_0x21db10,_0x311190,_0x3c7318){var _0x36a179,_0x109e83,_0x2c2922,_0x1a9231;_0x311190[_0xccf9('0x22')]=intUtil[_0xccf9('0x44')](_0x311190[_0xccf9('0x22')]);_0x311190[_0xccf9('0x4a')]=intUtil[_0xccf9('0x44')](_0x311190[_0xccf9('0x4a')]);if(_0x3c7318&&_0x3c7318[_0xccf9('0x55')]&&_0x3c7318[_0xccf9('0x55')]!=='none'){logger['info']('[OUTBOUND]',_0xccf9('0x47'));_0x162d81[_0xccf9('0x48')]=util[_0xccf9('0x20')](_0xccf9('0x49'),_0x311190[_0xccf9('0x4a')],_0x162d81['uniqueid'],md5(_0x162d81['uniqueid']));}return getConnection(_0x311190)[_0xccf9('0x26')](function(_0x2b93f9){_0x1a9231=_0x2b93f9;return getUser(_0x311190,_0x43c739['email'],_0x1a9231);})[_0xccf9('0x26')](function(_0x33354b){_0x36a179=_0x33354b;logger[_0xccf9('0x18')]('The\x20User\x20ID\x20is:',_0x36a179['id']);return getEndUser(_0x311190,_0x162d81[_0xccf9('0x56')],_0x162d81[_0xccf9('0x57')],_0x1a9231);})[_0xccf9('0x26')](function(_0x32ed68){_0x109e83=_0x32ed68;logger[_0xccf9('0x18')](_0xccf9('0x4f'),_0x109e83['id']);return createTicket(_0x311190,_0x36a179,_0x109e83,_0x38e3ef,_0x162d81,_0x38e3ef[_0xccf9('0x58')],_0x1a9231);})[_0xccf9('0x26')](function(_0x4c437e){_0x2c2922=_0x4c437e;logger['info'](_0xccf9('0x50'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x2c2922['id']);var _0x5da812=util[_0xccf9('0x20')](_0xccf9('0x59'),_0x311190['remoteUri'],_['split'](_0x2c2922['id'],'x')[0x1]);logger[_0xccf9('0x18')](_0xccf9('0x5a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xccf9('0x20')](_0xccf9('0x53'),_0x43c739[_0xccf9('0x16')]),'trigger:browser:url',{'uri':_0x5da812});})[_0xccf9('0x2c')](function(_0xf307b0){logger[_0xccf9('0x2b')](_0xccf9('0x5a'),JSON[_0xccf9('0x25')](_0xf307b0));});};exports['unmanaged']=function(_0x3d18ba,_0x215f56,_0x3859d8,_0x23090d,_0x2c1cf0,_0x552628){var _0x3e6655,_0x5f2cd7,_0x59e34a,_0x236fe4;_0x552628[_0xccf9('0x22')]=intUtil[_0xccf9('0x44')](_0x552628[_0xccf9('0x22')]);_0x552628[_0xccf9('0x4a')]=intUtil[_0xccf9('0x44')](_0x552628['serverUrl']);if(_0x2c1cf0&&_0x2c1cf0['monitor_format']){logger[_0xccf9('0x18')]('['+_0x215f56['lastevent'][_0xccf9('0x5b')]()+']',_0xccf9('0x47'));_0x215f56['recordingURL']=util[_0xccf9('0x20')](_0xccf9('0x49'),_0x552628[_0xccf9('0x4a')],_0x215f56['uniqueid'],md5(_0x215f56[_0xccf9('0x4b')]));}else{_0x215f56[_0xccf9('0x48')]='';}return getConnection(_0x552628)[_0xccf9('0x26')](function(_0x575835){_0x236fe4=_0x575835;return getUser(_0x552628,'',_0x236fe4);})[_0xccf9('0x26')](function(_0x30092b){_0x3e6655=_0x30092b;logger[_0xccf9('0x18')](_0xccf9('0x5c'),_0x3e6655['id']);return getEndUser(_0x552628,_0x215f56[_0xccf9('0x4d')],_0x215f56[_0xccf9('0x4e')],_0x236fe4);})[_0xccf9('0x26')](function(_0x3d197d){_0x5f2cd7=_0x3d197d;logger[_0xccf9('0x18')](_0xccf9('0x4f'),_0x5f2cd7['id']);return createTicket(_0x552628,_0x3e6655,_0x5f2cd7,_0x3859d8,_0x215f56,_0x3859d8[_0xccf9('0x58')],_0x236fe4);})[_0xccf9('0x26')](function(_0x3d0834){_0x59e34a=_0x3d0834;logger['info'](_0xccf9('0x50'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x59e34a['id']);})[_0xccf9('0x2c')](function(_0x1eb712){logger[_0xccf9('0x2b')]('['+_0x215f56[_0xccf9('0x5d')][_0xccf9('0x5b')]()+']',JSON[_0xccf9('0x25')](_0x1eb712));});}; \ 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 c5d9cdb..fae715f 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 _0xb903=['stringify','GET','map','forEach','type','string','nameField','customField','toLowerCase','toString','idField','custom_fields','push','content','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','POST','newTab','user:%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','The\x20Ticket\x20ID\x20is:','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','merge','Tags','name','getString','Descriptions','Fields','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','format','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','results','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','password','%s:%s','authType','token','%s/token:%s','Basic\x20%s','debug','[HTTP]'];(function(_0x24618a,_0x2cd0f4){var _0x2e3d64=function(_0x28c59c){while(--_0x28c59c){_0x24618a['push'](_0x24618a['shift']());}};_0x2e3d64(++_0x2cd0f4);}(_0xb903,0x185));var _0x3b90=function(_0x57ca96,_0x553f7b){_0x57ca96=_0x57ca96-0x0;var _0x45ef70=_0xb903[_0x57ca96];return _0x45ef70;};'use strict';var _=require(_0x3b90('0x0'));var rp=require(_0x3b90('0x1'));var md5=require(_0x3b90('0x2'));var util=require(_0x3b90('0x3'));var Redis=require('ioredis');var intUtil=require(_0x3b90('0x4'));var config=require(_0x3b90('0x5'));var logger=require(_0x3b90('0x6'))(_0x3b90('0x7'));config[_0x3b90('0x8')]=_[_0x3b90('0x9')](config[_0x3b90('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x3b90('0xa'))(new Redis(config['redis']));function emit(_0x55792c,_0x153283,_0x2e4c06){io['to'](_0x55792c)[_0x3b90('0xb')](_0x153283,_0x2e4c06);}var headers={'Content-Type':_0x3b90('0xc'),'Accept':'application/json'};function getTicket(_0x5cda1d,_0x52401e,_0x51f916,_0x56261b,_0x55db3f){logger[_0x3b90('0xd')](_0x3b90('0xe'));return request({'uri':util['format'](_0x3b90('0xf'),_0x5cda1d[_0x3b90('0x10')]),'method':'POST','body':{'ticket':_[_0x3b90('0x11')]({'requester_id':_0x51f916['id'],'submitter_id':_0x52401e?_0x52401e['id']:undefined,'assignee_id':_0x52401e?_0x52401e['id']:undefined,'tags':getTags(_0x56261b[_0x3b90('0x12')],_0x3b90('0x13')),'subject':intUtil['getString'](_0x56261b['Subjects'],_0x55db3f,'\x20'),'description':intUtil[_0x3b90('0x14')](_0x56261b['Descriptions'],_0x55db3f,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x56261b[_0x3b90('0x15')],_0x55db3f,'\x0a')}},getCustomFields(_0x56261b[_0x3b90('0x16')],_0x55db3f))}})['then'](function(_0x51fb66){logger[_0x3b90('0xd')](_0x3b90('0x17'));return _0x51fb66[_0x3b90('0x18')];});}function getUser(_0x1af265,_0x1efe01){if(intUtil['validateEmail'](_0x1efe01)){logger['info'](_0x3b90('0x19'),_0x1efe01);return request({'uri':util[_0x3b90('0x1a')]('%s/search.json',_0x1af265[_0x3b90('0x10')]),'qs':{'query':util[_0x3b90('0x1a')](_0x3b90('0x1b'),_0x1efe01)}})[_0x3b90('0x1c')](function(_0x4f388b){if(_0x4f388b[_0x3b90('0x1d')]){logger['info'](_0x3b90('0x1e'));return _[_0x3b90('0x1f')](_0x4f388b['results'],{'email':_0x1efe01,'role':_0x3b90('0x20')});}else{logger[_0x3b90('0xd')](_0x3b90('0x21'));return request({'uri':util[_0x3b90('0x1a')](_0x3b90('0x22'),_0x1af265[_0x3b90('0x10')])})[_0x3b90('0x1c')](function(_0x2f4270){logger[_0x3b90('0xd')](_0x3b90('0x23'));return _0x2f4270['user'];});}});}else{logger[_0x3b90('0xd')](_0x3b90('0x21'));return request({'uri':util[_0x3b90('0x1a')](_0x3b90('0x22'),_0x1af265[_0x3b90('0x10')])})[_0x3b90('0x1c')](function(_0x58fa12){logger['info'](_0x3b90('0x23'));return _0x58fa12[_0x3b90('0x24')];});}}function getEndUser(_0x103324,_0x2ffa1a,_0x583523){logger[_0x3b90('0xd')](_0x3b90('0x25'),_0x583523);return request({'uri':util[_0x3b90('0x1a')]('%s/search.json',_0x103324[_0x3b90('0x10')]),'qs':{'query':util[_0x3b90('0x1a')](_0x3b90('0x26'),_0x583523)}})[_0x3b90('0x1c')](function(_0x153d7c){var _0x7adf75;if(_0x153d7c['results'][_0x3b90('0x27')]){_0x153d7c['results']=_[_0x3b90('0x28')](_0x153d7c[_0x3b90('0x29')],{'suspended':![],'role':_0x3b90('0x2a')});if(_0x153d7c[_0x3b90('0x29')][_0x3b90('0x27')]){_0x7adf75=_[_0x3b90('0x2b')](_0x153d7c[_0x3b90('0x29')]);}}if(_0x7adf75){logger[_0x3b90('0xd')]('Enduser\x20found!');return _0x7adf75;}else{logger['info'](_0x3b90('0x2c'));return request({'uri':util[_0x3b90('0x1a')](_0x3b90('0x2d'),_0x103324[_0x3b90('0x10')]),'method':'POST','body':{'user':{'role':'end-user','name':util[_0x3b90('0x1a')](_0x3b90('0x2e'),_0x2ffa1a||_0x583523),'phone':_0x583523}}})[_0x3b90('0x1c')](function(_0x4f3ab5){logger[_0x3b90('0xd')]('Enduser\x20created.');return _0x4f3ab5['user'];});}});}function getAuth(_0x208f3e){var _0x3fbc03;if(_0x208f3e['authType']===_0x3b90('0x2f')){_0x3fbc03=util[_0x3b90('0x1a')](_0x3b90('0x30'),_0x208f3e['username'],_0x208f3e['password']);}else if(_0x208f3e[_0x3b90('0x31')]===_0x3b90('0x32')){_0x3fbc03=util[_0x3b90('0x1a')](_0x3b90('0x33'),_0x208f3e['username'],_0x208f3e['token']);}return util[_0x3b90('0x1a')](_0x3b90('0x34'),new Buffer(_0x3fbc03)['toString']('base64'));}function request(_0x201712){logger[_0x3b90('0x35')](_0x3b90('0x36'),JSON[_0x3b90('0x37')](_0x201712));return rp(_['defaults'](_0x201712,{'method':_0x3b90('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x583842,_0x19533a){var _0x43bae5=[];if(_0x583842&&_0x583842[_0x3b90('0x27')]>0x0){_0x43bae5=_[_0x3b90('0x39')](_0x583842,_0x19533a);}return _0x43bae5;}function getCustomFields(_0x2cbae8,_0x3bf148){var _0x96f7f3=[];var _0x534bea={'custom_fields':[]};if(_0x2cbae8[_0x3b90('0x27')]>0x0){_[_0x3b90('0x3a')](_0x2cbae8,function(_0x2fd30c){if(_0x2fd30c[_0x3b90('0x3b')]===_0x3b90('0x3c')&&_0x2fd30c[_0x3b90('0x3d')]&&!_0x2fd30c[_0x3b90('0x3e')]){_0x534bea[_0x2fd30c[_0x3b90('0x3d')][_0x3b90('0x3f')]()]=_0x2fd30c['content'][_0x3b90('0x40')]();}else if(_0x2fd30c[_0x3b90('0x3b')]===_0x3b90('0x3c')&&_0x2fd30c[_0x3b90('0x41')]&&_0x2fd30c[_0x3b90('0x3e')]){_0x534bea[_0x3b90('0x42')][_0x3b90('0x43')]({'id':_0x2fd30c[_0x3b90('0x41')],'value':_0x2fd30c[_0x3b90('0x44')][_0x3b90('0x40')]()});}else if(_0x2fd30c[_0x3b90('0x3b')]===_0x3b90('0x45')&&_0x2fd30c[_0x3b90('0x46')]&&_0x2fd30c[_0x3b90('0x41')]&&_0x2fd30c[_0x3b90('0x3e')]){_0x3bf148[_0x2fd30c[_0x3b90('0x46')]]&&_0x534bea[_0x3b90('0x42')][_0x3b90('0x43')]({'id':_0x2fd30c[_0x3b90('0x41')],'value':_0x3bf148[_0x2fd30c[_0x3b90('0x46')]][_0x3b90('0x40')]()});}else if(_0x2fd30c['type']===_0x3b90('0x47')&&_0x2fd30c[_0x3b90('0x48')]&&_0x2fd30c[_0x3b90('0x48')][_0x3b90('0x13')]&&_0x2fd30c['idField']&&_0x2fd30c[_0x3b90('0x3e')]){_0x3bf148[_0x2fd30c['Variable']['name'][_0x3b90('0x3f')]()]&&_0x534bea[_0x3b90('0x42')]['push']({'id':_0x2fd30c[_0x3b90('0x41')],'value':_0x3bf148[_0x2fd30c[_0x3b90('0x48')][_0x3b90('0x13')][_0x3b90('0x3f')]()][_0x3b90('0x40')]()});}});}return _0x534bea;}exports[_0x3b90('0x49')]=function(_0x28a344,_0x443eec,_0x28882e,_0x59b693,_0x3f71b0,_0x2e8a90){var _0x4df41c,_0x1e9a21;_0x2e8a90[_0x3b90('0x10')]=intUtil[_0x3b90('0x4a')](_0x2e8a90[_0x3b90('0x10')]);_0x2e8a90[_0x3b90('0x4b')]=intUtil['stripTrailingSlash'](_0x2e8a90['serverUrl']);if(_0x3f71b0&&_0x3f71b0[_0x3b90('0x4c')]){logger['info'](_0x3b90('0x4d'),_0x3b90('0x4e'));_0x443eec[_0x3b90('0x4f')]=util[_0x3b90('0x1a')](_0x3b90('0x50'),_0x2e8a90['serverUrl'],_0x443eec['uniqueid'],md5(_0x443eec[_0x3b90('0x51')]));}else{_0x443eec[_0x3b90('0x4f')]='';}headers[_0x3b90('0x52')]=getAuth(_0x2e8a90);return getUser(_0x2e8a90,_0x59b693['email'])[_0x3b90('0x1c')](function(_0x291279){_0x4df41c=_0x291279;logger[_0x3b90('0xd')](_0x3b90('0x53'),_0x4df41c['id']);return getEndUser(_0x2e8a90,_0x443eec[_0x3b90('0x54')],_0x443eec[_0x3b90('0x55')]);})[_0x3b90('0x1c')](function(_0x13b364){_0x1e9a21=_0x13b364;logger[_0x3b90('0xd')]('The\x20Enduser\x20ID\x20is:',_0x1e9a21['id']);return getTicket(_0x2e8a90,_0x4df41c,_0x1e9a21,_0x28882e,_0x443eec);})[_0x3b90('0x1c')](function(_0x407784){if(_0x407784){logger[_0x3b90('0xd')]('The\x20Ticket\x20ID\x20is:',_0x407784['id']);switch(_0x2e8a90[_0x3b90('0x3b')]){case'integrationTab':logger[_0x3b90('0xd')](_0x3b90('0x4d'),_0x3b90('0x56'));return request({'uri':util['format'](_0x3b90('0x57'),_0x2e8a90[_0x3b90('0x10')],_0x4df41c['id'],_0x407784['id']),'method':'POST'});case'newTab':logger[_0x3b90('0xd')](_0x3b90('0x4d'),_0x3b90('0x58'));emit(util[_0x3b90('0x1a')]('user:%s',_0x59b693['name']),_0x3b90('0x59'),{'uri':util[_0x3b90('0x1a')](_0x3b90('0x5a'),_0x2e8a90[_0x3b90('0x10')],_0x407784['id'])});break;default:logger[_0x3b90('0x5b')](_0x3b90('0x4d'),_0x3b90('0x5c'));}}})[_0x3b90('0x5d')](function(_0x30f446){logger['error'](_0x3b90('0x5e'),util[_0x3b90('0x5f')](_0x30f446,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x1d211a,_0x26b15f,_0x4d512e,_0x3677d1,_0x16c30f,_0x115232,_0x1bada9){var _0x451fae,_0x2b3cd5;_0x115232[_0x3b90('0x10')]=intUtil['stripTrailingSlash'](_0x115232[_0x3b90('0x10')]);_0x115232[_0x3b90('0x4b')]=intUtil[_0x3b90('0x4a')](_0x115232[_0x3b90('0x4b')]);if(_0x1bada9&&_0x1bada9[_0x3b90('0x60')]&&_0x1bada9[_0x3b90('0x60')]!==_0x3b90('0x61')){logger[_0x3b90('0xd')](_0x3b90('0x62'),_0x3b90('0x4e'));_0x26b15f[_0x3b90('0x4f')]=util[_0x3b90('0x1a')](_0x3b90('0x50'),_0x115232[_0x3b90('0x4b')],_0x26b15f[_0x3b90('0x51')],md5(_0x26b15f['uniqueid']));}headers[_0x3b90('0x52')]=getAuth(_0x115232);return getUser(_0x115232,_0x3677d1['email'])[_0x3b90('0x1c')](function(_0x290550){_0x451fae=_0x290550;logger[_0x3b90('0xd')](_0x3b90('0x53'),_0x451fae['id']);return getEndUser(_0x115232,_0x26b15f[_0x3b90('0x63')],_0x26b15f[_0x3b90('0x64')]);})['then'](function(_0x35af6e){_0x2b3cd5=_0x35af6e;logger[_0x3b90('0xd')](_0x3b90('0x65'),_0x2b3cd5['id']);return getTicket(_0x115232,_0x451fae,_0x2b3cd5,_0x4d512e,_0x26b15f);})[_0x3b90('0x1c')](function(_0x3d41c8){if(_0x3d41c8){logger[_0x3b90('0xd')]('The\x20Ticket\x20ID\x20is:',_0x3d41c8['id']);switch(_0x115232[_0x3b90('0x3b')]){case _0x3b90('0x66'):logger[_0x3b90('0xd')]('[OUTBOUND]',_0x3b90('0x56'));return request({'uri':util[_0x3b90('0x1a')](_0x3b90('0x57'),_0x115232[_0x3b90('0x10')],_0x451fae['id'],_0x3d41c8['id']),'method':_0x3b90('0x67')});case _0x3b90('0x68'):logger[_0x3b90('0xd')](_0x3b90('0x62'),_0x3b90('0x58'));emit(util['format'](_0x3b90('0x69'),_0x3677d1['name']),'trigger:browser:url',{'uri':util[_0x3b90('0x1a')](_0x3b90('0x5a'),_0x115232['remoteUri'],_0x3d41c8['id'])});break;default:logger[_0x3b90('0x5b')](_0x3b90('0x62'),_0x3b90('0x5c'));}}})[_0x3b90('0x5d')](function(_0x39133d){logger[_0x3b90('0x5b')](_0x3b90('0x6a'),util['inspect'](_0x39133d,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x3e5532,_0x5e5efa,_0x2bdd3d,_0x5ad9d6,_0x1a6d33,_0x5e44ae){var _0x532e98,_0x5d00b6;_0x5e44ae[_0x3b90('0x10')]=intUtil[_0x3b90('0x4a')](_0x5e44ae[_0x3b90('0x10')]);_0x5e44ae[_0x3b90('0x4b')]=intUtil[_0x3b90('0x4a')](_0x5e44ae[_0x3b90('0x4b')]);if(_0x1a6d33&&_0x1a6d33[_0x3b90('0x4c')]){logger['info']('['+_0x5e5efa['lastevent']['toUpperCase']()+']',_0x3b90('0x4e'));_0x5e5efa[_0x3b90('0x4f')]=util['format'](_0x3b90('0x50'),_0x5e44ae[_0x3b90('0x4b')],_0x5e5efa[_0x3b90('0x51')],md5(_0x5e5efa[_0x3b90('0x51')]));}else{_0x5e5efa[_0x3b90('0x4f')]='';}headers[_0x3b90('0x52')]=getAuth(_0x5e44ae);return getUser(_0x5e44ae)[_0x3b90('0x1c')](function(_0x89933c){_0x532e98=_0x89933c;logger[_0x3b90('0xd')]('The\x20User\x20ID\x20is:',_0x532e98['id']);return getEndUser(_0x5e44ae,_0x5e5efa[_0x3b90('0x54')],_0x5e5efa['calleridnum']);})[_0x3b90('0x1c')](function(_0x2ddd93){_0x5d00b6=_0x2ddd93;logger['info']('The\x20Enduser\x20ID\x20is:',_0x5d00b6['id']);return getTicket(_0x5e44ae,_0x532e98,_0x5d00b6,_0x2bdd3d,_0x5e5efa);})[_0x3b90('0x1c')](function(_0x4337f0){if(_0x4337f0){logger[_0x3b90('0xd')](_0x3b90('0x6b'),_0x4337f0['id']);}})[_0x3b90('0x5d')](function(_0x42e14f){logger['error']('['+_0x5e5efa[_0x3b90('0x6c')][_0x3b90('0x6d')]()+']'+_0x3b90('0x6e'),util['inspect'](_0x42e14f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2f68=['custom_fields','push','idField','variableName','customVariable','Variable','name','toLowerCase','queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','error','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','../../../../config/environment','zendesk','redis','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','string','customField','nameField','content','type'];(function(_0x41bae9,_0x3414f1){var _0x1100f8=function(_0xb7b61b){while(--_0xb7b61b){_0x41bae9['push'](_0x41bae9['shift']());}};_0x1100f8(++_0x3414f1);}(_0x2f68,0x9a));var _0x82f6=function(_0x125fa2,_0x310744){_0x125fa2=_0x125fa2-0x0;var _0x36d485=_0x2f68[_0x125fa2];return _0x36d485;};'use strict';var _=require('lodash');var rp=require(_0x82f6('0x0'));var md5=require(_0x82f6('0x1'));var util=require(_0x82f6('0x2'));var Redis=require(_0x82f6('0x3'));var intUtil=require('./util');var config=require(_0x82f6('0x4'));var logger=require('../../../../config/logger')(_0x82f6('0x5'));config[_0x82f6('0x6')]=_['defaults'](config[_0x82f6('0x6')],{'host':_0x82f6('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x1bc0be,_0x5660bf,_0x5daa3c){io['to'](_0x1bc0be)[_0x82f6('0x8')](_0x5660bf,_0x5daa3c);}var headers={'Content-Type':_0x82f6('0x9'),'Accept':_0x82f6('0x9')};function getTicket(_0x5ee0e5,_0x27db58,_0x432289,_0x4e7c12,_0x1cf88e){logger[_0x82f6('0xa')](_0x82f6('0xb'));return request({'uri':util[_0x82f6('0xc')](_0x82f6('0xd'),_0x5ee0e5[_0x82f6('0xe')]),'method':'POST','body':{'ticket':_[_0x82f6('0xf')]({'requester_id':_0x432289['id'],'submitter_id':_0x27db58?_0x27db58['id']:undefined,'assignee_id':_0x27db58?_0x27db58['id']:undefined,'tags':getTags(_0x4e7c12[_0x82f6('0x10')],'name'),'subject':intUtil[_0x82f6('0x11')](_0x4e7c12[_0x82f6('0x12')],_0x1cf88e,'\x20'),'description':intUtil[_0x82f6('0x11')](_0x4e7c12[_0x82f6('0x13')],_0x1cf88e,'\x0a'),'comment':{'public':![],'body':intUtil[_0x82f6('0x11')](_0x4e7c12[_0x82f6('0x13')],_0x1cf88e,'\x0a')}},getCustomFields(_0x4e7c12[_0x82f6('0x14')],_0x1cf88e))}})[_0x82f6('0x15')](function(_0x1e7cbc){logger['info'](_0x82f6('0x16'));return _0x1e7cbc['ticket'];});}function getUser(_0x249222,_0x1d0263){if(intUtil[_0x82f6('0x17')](_0x1d0263)){logger[_0x82f6('0xa')](_0x82f6('0x18'),_0x1d0263);return request({'uri':util[_0x82f6('0xc')](_0x82f6('0x19'),_0x249222[_0x82f6('0xe')]),'qs':{'query':util[_0x82f6('0xc')](_0x82f6('0x1a'),_0x1d0263)}})[_0x82f6('0x15')](function(_0x1d9091){if(_0x1d9091[_0x82f6('0x1b')]){logger[_0x82f6('0xa')](_0x82f6('0x1c'));return _['find'](_0x1d9091[_0x82f6('0x1d')],{'email':_0x1d0263,'role':_0x82f6('0x1e')});}else{logger['info'](_0x82f6('0x1f'));return request({'uri':util[_0x82f6('0xc')](_0x82f6('0x20'),_0x249222[_0x82f6('0xe')])})['then'](function(_0xdc4dea){logger['info'](_0x82f6('0x21'));return _0xdc4dea[_0x82f6('0x22')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x82f6('0xc')](_0x82f6('0x20'),_0x249222['remoteUri'])})['then'](function(_0x9f2272){logger[_0x82f6('0xa')]('Admin\x20account\x20selected.');return _0x9f2272[_0x82f6('0x22')];});}}function getEndUser(_0x304e83,_0x5037f8,_0x57ac0d){logger[_0x82f6('0xa')]('Searching\x20enduser\x20with\x20phone',_0x57ac0d);return request({'uri':util[_0x82f6('0xc')](_0x82f6('0x19'),_0x304e83['remoteUri']),'qs':{'query':util[_0x82f6('0xc')](_0x82f6('0x23'),_0x57ac0d)}})[_0x82f6('0x15')](function(_0x1125a0){var _0x4f9fa4;if(_0x1125a0[_0x82f6('0x1d')][_0x82f6('0x24')]){_0x1125a0[_0x82f6('0x1d')]=_[_0x82f6('0x25')](_0x1125a0[_0x82f6('0x1d')],{'suspended':![],'role':_0x82f6('0x26')});if(_0x1125a0[_0x82f6('0x1d')][_0x82f6('0x24')]){_0x4f9fa4=_[_0x82f6('0x27')](_0x1125a0[_0x82f6('0x1d')]);}}if(_0x4f9fa4){logger[_0x82f6('0xa')](_0x82f6('0x28'));return _0x4f9fa4;}else{logger[_0x82f6('0xa')](_0x82f6('0x29'));return request({'uri':util['format'](_0x82f6('0x2a'),_0x304e83[_0x82f6('0xe')]),'method':_0x82f6('0x2b'),'body':{'user':{'role':'end-user','name':util[_0x82f6('0xc')](_0x82f6('0x2c'),_0x5037f8||_0x57ac0d),'phone':_0x57ac0d}}})[_0x82f6('0x15')](function(_0x3da5a9){logger[_0x82f6('0xa')](_0x82f6('0x2d'));return _0x3da5a9[_0x82f6('0x22')];});}});}function getAuth(_0x299c36){var _0x4756ee;if(_0x299c36[_0x82f6('0x2e')]===_0x82f6('0x2f')){_0x4756ee=util[_0x82f6('0xc')](_0x82f6('0x30'),_0x299c36[_0x82f6('0x31')],_0x299c36['password']);}else if(_0x299c36[_0x82f6('0x2e')]===_0x82f6('0x32')){_0x4756ee=util[_0x82f6('0xc')](_0x82f6('0x33'),_0x299c36[_0x82f6('0x31')],_0x299c36[_0x82f6('0x32')]);}return util[_0x82f6('0xc')](_0x82f6('0x34'),new Buffer(_0x4756ee)[_0x82f6('0x35')](_0x82f6('0x36')));}function request(_0x458041){logger[_0x82f6('0x37')](_0x82f6('0x38'),JSON[_0x82f6('0x39')](_0x458041));return rp(_['defaults'](_0x458041,{'method':_0x82f6('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x4e8391,_0x4dd445){var _0x321fdc=[];if(_0x4e8391&&_0x4e8391[_0x82f6('0x24')]>0x0){_0x321fdc=_['map'](_0x4e8391,_0x4dd445);}return _0x321fdc;}function getCustomFields(_0x249cae,_0x3a3ccb){var _0xb7146b=[];var _0x56e5f1={'custom_fields':[]};if(_0x249cae[_0x82f6('0x24')]>0x0){_['forEach'](_0x249cae,function(_0x2be8cf){if(_0x2be8cf['type']===_0x82f6('0x3b')&&_0x2be8cf['nameField']&&!_0x2be8cf[_0x82f6('0x3c')]){_0x56e5f1[_0x2be8cf[_0x82f6('0x3d')]['toLowerCase']()]=_0x2be8cf[_0x82f6('0x3e')][_0x82f6('0x35')]();}else if(_0x2be8cf[_0x82f6('0x3f')]===_0x82f6('0x3b')&&_0x2be8cf['idField']&&_0x2be8cf[_0x82f6('0x3c')]){_0x56e5f1[_0x82f6('0x40')][_0x82f6('0x41')]({'id':_0x2be8cf[_0x82f6('0x42')],'value':_0x2be8cf['content'][_0x82f6('0x35')]()});}else if(_0x2be8cf[_0x82f6('0x3f')]==='variable'&&_0x2be8cf[_0x82f6('0x43')]&&_0x2be8cf[_0x82f6('0x42')]&&_0x2be8cf[_0x82f6('0x3c')]){_0x3a3ccb[_0x2be8cf[_0x82f6('0x43')]]&&_0x56e5f1[_0x82f6('0x40')]['push']({'id':_0x2be8cf[_0x82f6('0x42')],'value':_0x3a3ccb[_0x2be8cf['variableName']][_0x82f6('0x35')]()});}else if(_0x2be8cf[_0x82f6('0x3f')]===_0x82f6('0x44')&&_0x2be8cf[_0x82f6('0x45')]&&_0x2be8cf[_0x82f6('0x45')][_0x82f6('0x46')]&&_0x2be8cf[_0x82f6('0x42')]&&_0x2be8cf['customField']){_0x3a3ccb[_0x2be8cf[_0x82f6('0x45')][_0x82f6('0x46')][_0x82f6('0x47')]()]&&_0x56e5f1[_0x82f6('0x40')]['push']({'id':_0x2be8cf[_0x82f6('0x42')],'value':_0x3a3ccb[_0x2be8cf['Variable'][_0x82f6('0x46')][_0x82f6('0x47')]()][_0x82f6('0x35')]()});}});}return _0x56e5f1;}exports[_0x82f6('0x48')]=function(_0x36c0a5,_0xa8b529,_0x538aef,_0x1fd32f,_0x143536,_0x14a3c4){var _0x4c82b4,_0x10ae6e;_0x14a3c4[_0x82f6('0xe')]=intUtil[_0x82f6('0x49')](_0x14a3c4[_0x82f6('0xe')]);_0x14a3c4['serverUrl']=intUtil[_0x82f6('0x49')](_0x14a3c4[_0x82f6('0x4a')]);if(_0x143536&&_0x143536['monitor_format']){logger[_0x82f6('0xa')]('[QUEUE]',_0x82f6('0x4b'));_0xa8b529['recordingURL']=util[_0x82f6('0xc')](_0x82f6('0x4c'),_0x14a3c4[_0x82f6('0x4a')],_0xa8b529[_0x82f6('0x4d')],md5(_0xa8b529[_0x82f6('0x4d')]));}else{_0xa8b529[_0x82f6('0x4e')]='';}headers['Authorization']=getAuth(_0x14a3c4);return getUser(_0x14a3c4,_0x1fd32f[_0x82f6('0x4f')])[_0x82f6('0x15')](function(_0x4dabbc){_0x4c82b4=_0x4dabbc;logger['info'](_0x82f6('0x50'),_0x4c82b4['id']);return getEndUser(_0x14a3c4,_0xa8b529[_0x82f6('0x51')],_0xa8b529[_0x82f6('0x52')]);})['then'](function(_0x1f7abc){_0x10ae6e=_0x1f7abc;logger[_0x82f6('0xa')](_0x82f6('0x53'),_0x10ae6e['id']);return getTicket(_0x14a3c4,_0x4c82b4,_0x10ae6e,_0x538aef,_0xa8b529);})[_0x82f6('0x15')](function(_0x4e9e13){if(_0x4e9e13){logger['info'](_0x82f6('0x54'),_0x4e9e13['id']);switch(_0x14a3c4[_0x82f6('0x3f')]){case _0x82f6('0x55'):logger['info'](_0x82f6('0x56'),_0x82f6('0x57'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x14a3c4['remoteUri'],_0x4c82b4['id'],_0x4e9e13['id']),'method':_0x82f6('0x2b')});case'newTab':logger[_0x82f6('0xa')]('[QUEUE]',_0x82f6('0x58'));emit(util['format'](_0x82f6('0x59'),_0x1fd32f['name']),_0x82f6('0x5a'),{'uri':util[_0x82f6('0xc')](_0x82f6('0x5b'),_0x14a3c4[_0x82f6('0xe')],_0x4e9e13['id'])});break;default:logger[_0x82f6('0x5c')](_0x82f6('0x56'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x82f6('0x5d')](function(_0x1c8304){logger[_0x82f6('0x5c')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x1c8304,{'showHidden':!![],'depth':null}));});};exports[_0x82f6('0x5e')]=function(_0x81e595,_0x39ebce,_0x6932b1,_0x49a204,_0x2c1c0e,_0x355823,_0x3f620a){var _0x5d1a00,_0x5435bc;_0x355823['remoteUri']=intUtil[_0x82f6('0x49')](_0x355823[_0x82f6('0xe')]);_0x355823[_0x82f6('0x4a')]=intUtil[_0x82f6('0x49')](_0x355823[_0x82f6('0x4a')]);if(_0x3f620a&&_0x3f620a[_0x82f6('0x5f')]&&_0x3f620a[_0x82f6('0x5f')]!==_0x82f6('0x60')){logger['info'](_0x82f6('0x61'),_0x82f6('0x4b'));_0x39ebce[_0x82f6('0x4e')]=util[_0x82f6('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x355823['serverUrl'],_0x39ebce[_0x82f6('0x4d')],md5(_0x39ebce[_0x82f6('0x4d')]));}headers['Authorization']=getAuth(_0x355823);return getUser(_0x355823,_0x49a204[_0x82f6('0x4f')])[_0x82f6('0x15')](function(_0x404d09){_0x5d1a00=_0x404d09;logger['info'](_0x82f6('0x50'),_0x5d1a00['id']);return getEndUser(_0x355823,_0x39ebce[_0x82f6('0x62')],_0x39ebce[_0x82f6('0x63')]);})[_0x82f6('0x15')](function(_0x169aa3){_0x5435bc=_0x169aa3;logger[_0x82f6('0xa')]('The\x20Enduser\x20ID\x20is:',_0x5435bc['id']);return getTicket(_0x355823,_0x5d1a00,_0x5435bc,_0x6932b1,_0x39ebce);})[_0x82f6('0x15')](function(_0x149784){if(_0x149784){logger[_0x82f6('0xa')](_0x82f6('0x54'),_0x149784['id']);switch(_0x355823[_0x82f6('0x3f')]){case'integrationTab':logger[_0x82f6('0xa')](_0x82f6('0x61'),_0x82f6('0x57'));return request({'uri':util[_0x82f6('0xc')](_0x82f6('0x64'),_0x355823[_0x82f6('0xe')],_0x5d1a00['id'],_0x149784['id']),'method':_0x82f6('0x2b')});case _0x82f6('0x65'):logger['info'](_0x82f6('0x61'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x82f6('0xc')](_0x82f6('0x59'),_0x49a204['name']),_0x82f6('0x5a'),{'uri':util[_0x82f6('0xc')](_0x82f6('0x5b'),_0x355823['remoteUri'],_0x149784['id'])});break;default:logger['error'](_0x82f6('0x61'),_0x82f6('0x66'));}}})['catch'](function(_0x4fdbdf){logger[_0x82f6('0x5c')](_0x82f6('0x67'),util[_0x82f6('0x68')](_0x4fdbdf,{'showHidden':!![],'depth':null}));});};exports[_0x82f6('0x69')]=function(_0x4589e1,_0x11581c,_0xc1d784,_0x1a0f31,_0x2d0d7c,_0x353508){var _0x385902,_0x41354f;_0x353508['remoteUri']=intUtil[_0x82f6('0x49')](_0x353508[_0x82f6('0xe')]);_0x353508[_0x82f6('0x4a')]=intUtil[_0x82f6('0x49')](_0x353508[_0x82f6('0x4a')]);if(_0x2d0d7c&&_0x2d0d7c['monitor_format']){logger[_0x82f6('0xa')]('['+_0x11581c[_0x82f6('0x6a')][_0x82f6('0x6b')]()+']','Recording\x20is\x20enabled!');_0x11581c[_0x82f6('0x4e')]=util[_0x82f6('0xc')](_0x82f6('0x4c'),_0x353508[_0x82f6('0x4a')],_0x11581c[_0x82f6('0x4d')],md5(_0x11581c[_0x82f6('0x4d')]));}else{_0x11581c[_0x82f6('0x4e')]='';}headers['Authorization']=getAuth(_0x353508);return getUser(_0x353508)[_0x82f6('0x15')](function(_0x5d3d27){_0x385902=_0x5d3d27;logger[_0x82f6('0xa')](_0x82f6('0x50'),_0x385902['id']);return getEndUser(_0x353508,_0x11581c[_0x82f6('0x51')],_0x11581c[_0x82f6('0x52')]);})[_0x82f6('0x15')](function(_0x341fde){_0x41354f=_0x341fde;logger[_0x82f6('0xa')](_0x82f6('0x53'),_0x41354f['id']);return getTicket(_0x353508,_0x385902,_0x41354f,_0xc1d784,_0x11581c);})[_0x82f6('0x15')](function(_0x5ed4b6){if(_0x5ed4b6){logger[_0x82f6('0xa')](_0x82f6('0x54'),_0x5ed4b6['id']);}})[_0x82f6('0x5d')](function(_0x453fd9){logger[_0x82f6('0x5c')]('['+_0x11581c[_0x82f6('0x6a')]['toUpperCase']()+']'+_0x82f6('0x6c'),util[_0x82f6('0x68')](_0x453fd9,{'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 7dada35..4f11546 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 _0x60a5=['name','toLowerCase','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','refreshToken','clientId','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','info','Using\x20the\x20admin\x20account!','profile','Administrator','user','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','CREATE\x20ERROR','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','Contacts','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','called','Call_Result','Called','complete','Answered','rejected','Rejected','abandoned','timeout','Timeout','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','log','queue','stripTrailingSlash','host','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridnum','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','/crm/EntityInfo.do?module=Calls&id=','catch','unmanaged','lastevent','toUpperCase','The\x20Call\x20ID\x20is:','lodash','util','ioredis','bluebird','../../../../config/environment','zoho','redis','defaults','emit','[HTTP]','length','forEach','type','string','idField','content','toString','variable','variableName','Variable'];(function(_0x21ac47,_0x725076){var _0x899829=function(_0x3c9b65){while(--_0x3c9b65){_0x21ac47['push'](_0x21ac47['shift']());}};_0x899829(++_0x725076);}(_0x60a5,0x83));var _0x560a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x60a5[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x560a('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x560a('0x1'));var intUtil=require('./util');var moment=require('moment');var Redis=require(_0x560a('0x2'));var BPromise=require(_0x560a('0x3'));var config=require(_0x560a('0x4'));var logger=require('../../../../config/logger')(_0x560a('0x5'));config[_0x560a('0x6')]=_[_0x560a('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x3ac39e,_0x1891ea,_0x33ddbd){io['to'](_0x3ac39e)[_0x560a('0x8')](_0x1891ea,_0x33ddbd);}function request(_0x52c52e){logger['debug'](_0x560a('0x9'),JSON['stringify'](_0x52c52e));return rp(_0x52c52e);}function getCustomFields(_0x2e3b88,_0x13c6a3){var _0x4f7df3={};if(_0x2e3b88[_0x560a('0xa')]>0x0){_[_0x560a('0xb')](_0x2e3b88,function(_0x35b589){if(_0x35b589[_0x560a('0xc')]===_0x560a('0xd')&&_0x35b589[_0x560a('0xe')]){_0x4f7df3[_0x35b589[_0x560a('0xe')]]=_0x35b589[_0x560a('0xf')][_0x560a('0x10')]();}else if(_0x35b589['type']===_0x560a('0x11')&&_0x35b589[_0x560a('0x12')]&&_0x35b589[_0x560a('0xe')]&&_0x13c6a3[_0x35b589['variableName']]){_0x4f7df3[_0x35b589[_0x560a('0xe')]]=_0x13c6a3[_0x35b589[_0x560a('0x12')]][_0x560a('0x10')]();}else if(_0x35b589[_0x560a('0xc')]==='customVariable'&&_0x35b589[_0x560a('0x13')]&&_0x35b589[_0x560a('0x13')][_0x560a('0x14')]&&_0x35b589[_0x560a('0xe')]&&_0x13c6a3[_0x35b589['Variable']['name'][_0x560a('0x15')]()]){_0x4f7df3[_0x35b589[_0x560a('0xe')]]=_0x13c6a3[_0x35b589[_0x560a('0x13')][_0x560a('0x14')]['toLowerCase']()][_0x560a('0x10')]();}});}return _0x4f7df3;}function getName(_0x44dc4b){if(_0x44dc4b[_0x560a('0x16')]('\x20')>0x0){var _0x2b484f=_0x44dc4b[_0x560a('0x17')](/ (.+)/);if(_0x2b484f[0x1]){return _0x2b484f;}}return[_0x44dc4b,_0x44dc4b];}var accountsTokens={};function getAccessToken(_0x4807f2){return new Promise(function(_0x32ff83,_0x155c2b){if(!_[_0x560a('0x18')](accountsTokens[_0x4807f2['id']])&&!_[_0x560a('0x18')](accountsTokens[_0x4807f2['id']][_0x560a('0x19')])){if(moment()[_0x560a('0x1a')](accountsTokens[_0x4807f2['id']][_0x560a('0x1b')])){_0x32ff83(accountsTokens[_0x4807f2['id']]['access_token']);}}var _0x292a5a;switch(_0x4807f2[_0x560a('0x1c')]){case'US':_0x292a5a=_0x560a('0x1d');break;case'AU':_0x292a5a=_0x560a('0x1e');break;case'EU':_0x292a5a=_0x560a('0x1f');break;case'IN':_0x292a5a=_0x560a('0x20');break;case'CN':_0x292a5a=_0x560a('0x21');break;default:_0x292a5a=_0x560a('0x1f');break;}var _0x4c2d8a={'method':'POST','uri':_0x292a5a+'/oauth/v2/token','qs':{'refresh_token':_0x4807f2[_0x560a('0x22')],'client_id':_0x4807f2[_0x560a('0x23')],'client_secret':_0x4807f2['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x4c2d8a)[_0x560a('0x24')](function(_0x4f718e){accountsTokens[_0x4807f2['id']]={'access_token':_0x4f718e[_0x560a('0x19')],'expires_in':moment()[_0x560a('0x25')](_0x4f718e['expires_in'],_0x560a('0x26'))};_0x32ff83(_0x4f718e[_0x560a('0x19')]);})['catch'](function(_0x1ddcf6){logger[_0x560a('0x27')](_0x560a('0x28'),_0x1ddcf6[_0x560a('0x29')]);_0x155c2b(_0x1ddcf6);});});}function getUser(_0x40a668,_0x4a21cf,_0x46ee1f,_0x3c4af2){logger['info'](_0x560a('0x2a'));return request({'method':_0x560a('0x2b'),'uri':util[_0x560a('0x2c')](_0x560a('0x2d'),_0x4a21cf),'qs':{'type':_0x560a('0x2e')},'headers':{'Authorization':_0x560a('0x2f')+_0x40a668},'json':!![]})[_0x560a('0x24')](function(_0x54817a){if(_0x54817a[_0x560a('0x30')]){var _0x339dc6=-0x1;if(_['isArrayLikeObject'](_0x54817a['users'])){if(!_[_0x560a('0x18')](_0x3c4af2)){_0x339dc6=_[_0x560a('0x31')](_0x54817a[_0x560a('0x30')],function(_0x546f45){return _0x546f45['email']===_0x3c4af2;});}if(_0x339dc6>=0x0){logger['info']('Agent\x20found!');}else{logger[_0x560a('0x32')](_0x560a('0x33'));_0x339dc6=_[_0x560a('0x31')](_0x54817a[_0x560a('0x30')],function(_0x32a9cc){return _0x32a9cc[_0x560a('0x34')][_0x560a('0x14')]===_0x560a('0x35');});}return _0x54817a[_0x560a('0x30')][_0x339dc6];}else{if(_0x54817a[_0x560a('0x36')]['profile'][_0x560a('0x14')]===_0x560a('0x35')){logger[_0x560a('0x32')](_0x560a('0x33'));user=_0x54817a[_0x560a('0x36')];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0x560a('0x37')](_0x54817a));throw new Error(_0x560a('0x38')+JSON[_0x560a('0x37')](_0x54817a));}}}else{logger[_0x560a('0x27')](_0x560a('0x39'),JSON['stringify'](_0x54817a));throw new Error(_0x560a('0x38')+JSON[_0x560a('0x37')](_0x54817a));}})['catch'](function(_0x3b5e48){console[_0x560a('0x27')](_0x3b5e48);});}function getZohoUser(_0x207951,_0x384f39){return new BPromise(function(_0x47eff6,_0xc85f59){request(_0x207951)['then'](function(_0x12bcf4){var _0x3ff796=null;if(_0x12bcf4){_0x3ff796=_0x12bcf4[_0x560a('0x3a')][0x0];_0x3ff796[_0x560a('0x3b')]=_0x384f39;}_0x47eff6(_0x3ff796);})['catch'](function(_0x2a32ad){_0xc85f59(_0x2a32ad);});});}function createEndUser(_0x513e00,_0x40e1e2,_0x9c58bd,_0x2e7405,_0x21b999,_0x329f01){var _0x9c58bd=getName(_0x9c58bd);return request({'method':_0x560a('0x3c'),'uri':_0x560a('0x3d')+_0x40e1e2+_0x560a('0x3e')+_[_0x560a('0x3f')](_0x329f01[_0x560a('0x40')])+'s','body':{'data':[{'Last_Name':_0x9c58bd[0x1],'First_Name':_0x9c58bd[0x0],'Phone':_0x2e7405,'Owner':{'name':!_[_0x560a('0x18')](_0x21b999[_0x560a('0x41')]['name'])?_0x21b999[_0x560a('0x41')][_0x560a('0x14')]:!_[_0x560a('0x18')](_0x21b999[_0x560a('0x42')])?_0x21b999['first_name']+'\x20'+_0x21b999[_0x560a('0x43')]:_0x21b999['last_name'],'id':_0x21b999['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x513e00},'json':!![]})[_0x560a('0x24')](function(_0x335244){if(_0x335244&&_0x335244[_0x560a('0x3a')][0x0][_0x560a('0x44')]===_0x560a('0x45')){var _0xdb29b6=_0x335244['data'][0x0][_0x560a('0x46')];_0xdb29b6[_0x560a('0x3b')]=_['startCase'](_0x329f01['moduleCreate'])+'s';return _0xdb29b6;}logger['error'](_0x560a('0x39'),JSON[_0x560a('0x37')](data));throw new Error(_0x560a('0x47')+JSON['stringify'](data));})['catch'](function(_0x24752d){console['log'](_0x560a('0x48'),_0x24752d);});}function getEndUser(_0x21872a,_0x107340,_0x4a968f,_0x3ff955,_0x1991e4,_0x386e93,_0x4cfd92){var _0x105cfb={'method':_0x560a('0x2b'),'uri':'','headers':{'Authorization':_0x560a('0x2f')+_0x21872a},'json':!![]};switch(_0x4cfd92['moduleSearch']){case'contact_lead':_0x105cfb[_0x560a('0x49')]='https://www.zohoapis.'+_0x107340+_0x560a('0x4a')+_0x1991e4+'))';return getZohoUser(_0x105cfb,'Contacts')[_0x560a('0x24')](function(_0x35d803){if(_0x35d803)return _0x35d803;_0x105cfb[_0x560a('0x49')]=_0x560a('0x3d')+_0x107340+_0x560a('0x4b')+_0x1991e4+'))';return getZohoUser(_0x105cfb,_0x560a('0x4c'))[_0x560a('0x24')](function(_0x23caa2){if(_0x23caa2)return _0x23caa2;if(_0x4cfd92['moduleCreate']!=_0x560a('0x4d')){return createEndUser(_0x21872a,_0x107340,_0x3ff955,_0x1991e4,_0x386e93,_0x4cfd92);}else{return{};}});});break;case'contact':_0x105cfb['uri']=_0x560a('0x3d')+_0x107340+_0x560a('0x4a')+_0x1991e4+'))';return getZohoUser(_0x105cfb,_0x560a('0x4e'))[_0x560a('0x24')](function(_0x4d68e9){if(_0x4d68e9)return _0x4d68e9;if(_0x4cfd92[_0x560a('0x40')]!=_0x560a('0x4d')){return createEndUser(_0x21872a,_0x107340,_0x3ff955,_0x1991e4,_0x386e93,_0x4cfd92);}else{return{};}});break;case'lead':_0x105cfb[_0x560a('0x49')]=_0x560a('0x3d')+_0x107340+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1991e4+'))';return getZohoUser(_0x105cfb,_0x560a('0x4c'))[_0x560a('0x24')](function(_0x1199e7){if(_0x1199e7)return _0x1199e7;if(_0x4cfd92[_0x560a('0x40')]!='nothing'){return createEndUser(_0x21872a,_0x107340,_0x3ff955,_0x1991e4,_0x386e93,_0x4cfd92);}else{return{};}});break;}}function getCall(_0x38dae1,_0x2f85a7,_0x2f7878,_0x34be8b,_0x5b6740,_0x2e9bff,_0x20c529,_0x269c16){logger[_0x560a('0x32')](_0x560a('0x4f'));var _0x1281c5={};_0x1281c5[_0x560a('0x50')]={'name':!_[_0x560a('0x18')](_0x34be8b['role'][_0x560a('0x14')])&&!_[_0x560a('0x18')](_0x34be8b[_0x560a('0x34')][_0x560a('0x14')])&&_0x34be8b['profile'][_0x560a('0x14')]==='administrator'?_0x34be8b[_0x560a('0x41')]['name']:!_[_0x560a('0x18')](_0x34be8b['first_name'])?_0x34be8b[_0x560a('0x42')]+'\x20'+_0x34be8b[_0x560a('0x43')]:_0x34be8b[_0x560a('0x43')],'id':_0x34be8b['id']};_0x1281c5[_0x560a('0x51')]=intUtil[_0x560a('0x52')](_0x2e9bff[_0x560a('0x53')],_0x20c529,'\x20');_0x1281c5['Description']=intUtil['getString'](_0x2e9bff[_0x560a('0x54')],_0x20c529,'\x0a');if(_0x5b6740[_0x560a('0x3b')]===_0x560a('0x4e')){_0x1281c5[_0x560a('0x55')]={'name':!_[_0x560a('0x18')](_0x5b6740[_0x560a('0x56')])?_0x5b6740[_0x560a('0x56')]:!_[_0x560a('0x18')](_0x5b6740[_0x560a('0x57')])?_0x5b6740['First_Name']+'\x20'+_0x5b6740[_0x560a('0x58')]:_0x5b6740[_0x560a('0x58')],'id':_0x5b6740['id']};}if(_0x5b6740['enduserType']===_0x560a('0x4c')){_0x1281c5[_0x560a('0x59')]={'name':!_[_0x560a('0x18')](_0x5b6740['Full_Name'])?_0x5b6740[_0x560a('0x56')]:!_['isNil'](_0x5b6740[_0x560a('0x57')])?_0x5b6740[_0x560a('0x57')]+'\x20'+_0x5b6740[_0x560a('0x58')]:_0x5b6740['Last_Name'],'id':_0x5b6740['id']};_0x1281c5[_0x560a('0x5a')]=_[_0x560a('0x3f')](_0x5b6740[_0x560a('0x3b')]);}if(_0x20c529[_0x560a('0x5b')]){_0x1281c5['Call_Duration']=moment[_0x560a('0x5c')](parseInt(_0x20c529[_0x560a('0x5b')])*0x3e8)[_0x560a('0x2c')]('mm:ss');}else if(_0x20c529[_0x560a('0x5d')]&&_0x20c529['endtime']){_0x1281c5['Call_Duration']=moment['utc'](moment(_0x20c529[_0x560a('0x5e')],_0x560a('0x5f'))[_0x560a('0x60')](moment(_0x20c529[_0x560a('0x61')],_0x560a('0x5f'))))[_0x560a('0x2c')](_0x560a('0x62'));}switch(_0x20c529['lastevent']){case _0x560a('0x63'):_0x1281c5[_0x560a('0x64')]=_0x560a('0x65');break;case _0x560a('0x66'):case'connect':_0x1281c5[_0x560a('0x64')]=_0x560a('0x67');break;case _0x560a('0x68'):_0x1281c5[_0x560a('0x64')]=_0x560a('0x69');break;case _0x560a('0x6a'):_0x1281c5[_0x560a('0x64')]='Abandoned';break;case _0x560a('0x6b'):_0x1281c5['Call_Result']=_0x560a('0x6c');default:}_0x1281c5['Call_Start_Time']=(_0x269c16===_0x560a('0x6d')?moment(_0x20c529[_0x560a('0x61')])[_0x560a('0x2c')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x20c529[_0x560a('0x6e')])[_0x560a('0x2c')](_0x560a('0x5f')))||moment()[_0x560a('0x2c')]('YYYY-MM-DDTHH:mm:ss');_0x1281c5[_0x560a('0x6f')]=_0x269c16||_0x560a('0x70');_0x1281c5=_[_0x560a('0x71')](_0x1281c5,getCustomFields(_0x2e9bff[_0x560a('0x72')],_0x20c529));return request({'method':_0x560a('0x3c'),'uri':'https://www.zohoapis.'+_0x2f85a7+_0x560a('0x73'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x38dae1},'body':{'data':[_0x1281c5]},'json':!![]})[_0x560a('0x24')](function(_0x9cf833){if(_0x9cf833&&_0x9cf833[_0x560a('0x3a')][0x0]['code']===_0x560a('0x45')){logger[_0x560a('0x32')](_0x560a('0x74'));return{'id':_0x9cf833[_0x560a('0x3a')][0x0]['details']['id']};}})['catch'](function(_0x52facf){logger['info'](_0x560a('0x75'),_0x52facf[_0x560a('0x29')]);console[_0x560a('0x76')]('err',_0x52facf);});}exports[_0x560a('0x77')]=function(_0x457266,_0x34f8c5,_0x1ac52d,_0x2b4027,_0x22a2db,_0x14809e){var _0x2dc167,_0x1aa4b7,_0x28e722;_0x14809e['host']=intUtil[_0x560a('0x78')](_0x14809e[_0x560a('0x79')]);_0x14809e[_0x560a('0x7a')]=intUtil[_0x560a('0x78')](_0x14809e[_0x560a('0x7a')]);if(_0x22a2db&&_0x22a2db[_0x560a('0x7b')]){logger['info']('[QUEUE]',_0x560a('0x7c'));_0x34f8c5[_0x560a('0x7d')]=_0x14809e['serverUrl']+_0x560a('0x7e')+_0x34f8c5[_0x560a('0x7f')]+_0x560a('0x80')+md5(_0x34f8c5[_0x560a('0x7f')]);}else{_0x34f8c5['recordingURL']='';}var _0x361fac=_0x14809e[_0x560a('0x79')]===_0x560a('0x81')?'eu':_0x560a('0x82');return getAccessToken(_0x14809e)[_0x560a('0x24')](function(_0x59dfef){_0x28e722=_0x59dfef;return getUser(_0x28e722,_0x361fac,_0x14809e,_0x2b4027[_0x560a('0x83')]);})[_0x560a('0x24')](function(_0x4103d3){_0x2dc167=_0x4103d3;logger[_0x560a('0x32')](_0x560a('0x84'),_0x2dc167['id']);return getEndUser(_0x28e722,_0x361fac,_0x14809e,_0x34f8c5['calleridname'],_0x34f8c5[_0x560a('0x85')],_0x2dc167,_0x1ac52d);})[_0x560a('0x24')](function(_0x1e9d4b){_0x1aa4b7=_0x1e9d4b;return getCall(_0x28e722,_0x361fac,_0x14809e,_0x2dc167,_0x1aa4b7,_0x1ac52d,_0x34f8c5,_0x560a('0x70'));})[_0x560a('0x24')](function(_0x13e65e){if(_0x13e65e){logger['info']('The\x20Call\x20ID\x20is:',_0x13e65e['id']);logger[_0x560a('0x32')](_0x560a('0x86'),_0x560a('0x87'));emit(util[_0x560a('0x2c')](_0x560a('0x88'),_0x2b4027[_0x560a('0x14')]),_0x560a('0x89'),{'uri':_0x560a('0x8a')+_0x14809e[_0x560a('0x79')]+'/crm/EntityInfo.do?module=Calls&id='+_0x13e65e['id']});}})['catch'](function(_0x402606){logger[_0x560a('0x27')](_0x560a('0x86'),JSON['stringify'](_0x402606));});};exports[_0x560a('0x6d')]=function(_0x506ba7,_0x2444fa,_0x1b4693,_0x3ba45a,_0x3c7c45,_0x36af8b,_0x198a85){var _0x16d150,_0x29f194,_0x42ef64;_0x36af8b[_0x560a('0x79')]=intUtil['stripTrailingSlash'](_0x36af8b['host']);_0x36af8b['serverUrl']=intUtil[_0x560a('0x78')](_0x36af8b['serverUrl']);if(_0x198a85&&_0x198a85['recordingFormat']&&_0x198a85[_0x560a('0x8b')]!==_0x560a('0x8c')){logger[_0x560a('0x32')](_0x560a('0x8d'),'Recording\x20is\x20enabled!');_0x2444fa[_0x560a('0x7d')]=_0x36af8b[_0x560a('0x7a')]+_0x560a('0x7e')+_0x2444fa[_0x560a('0x7f')]+_0x560a('0x80')+md5(_0x2444fa['uniqueid']);}var _0x48d38e=_0x36af8b[_0x560a('0x79')]===_0x560a('0x81')?'eu':'com';return getAccessToken(_0x36af8b)[_0x560a('0x24')](function(_0x5f433e){_0x42ef64=_0x5f433e;return getUser(_0x42ef64,_0x48d38e,_0x36af8b,_0x3ba45a[_0x560a('0x83')]);})[_0x560a('0x24')](function(_0x178adf){_0x16d150=_0x178adf;logger[_0x560a('0x32')](_0x560a('0x84'),_0x16d150['id']);return getEndUser(_0x42ef64,_0x48d38e,_0x36af8b,_0x2444fa[_0x560a('0x8e')],_0x2444fa[_0x560a('0x8f')],_0x16d150,_0x1b4693);})[_0x560a('0x24')](function(_0x4b8c6d){_0x29f194=_0x4b8c6d;return getCall(_0x42ef64,_0x48d38e,_0x36af8b,_0x16d150,_0x29f194,_0x1b4693,_0x2444fa,_0x560a('0x90'));})[_0x560a('0x24')](function(_0xb9f04){if(_0xb9f04){logger['info']('The\x20Call\x20ID\x20is:',_0xb9f04['id']);logger[_0x560a('0x32')](_0x560a('0x8d'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x3ba45a[_0x560a('0x14')]),_0x560a('0x89'),{'uri':_0x560a('0x8a')+_0x36af8b[_0x560a('0x79')]+_0x560a('0x91')+_0xb9f04['id']});}})[_0x560a('0x92')](function(_0x31c4e9){logger[_0x560a('0x27')]('[OUTBOUND]',JSON[_0x560a('0x37')](_0x31c4e9));});};exports[_0x560a('0x93')]=function(_0x44dc90,_0x33c9cf,_0x27718a,_0x339b1f,_0x52adf2,_0x233421){var _0x30b9dc,_0x5406e3,_0x838382;_0x233421['host']=intUtil[_0x560a('0x78')](_0x233421[_0x560a('0x79')]);_0x233421[_0x560a('0x7a')]=intUtil['stripTrailingSlash'](_0x233421[_0x560a('0x7a')]);if(_0x52adf2&&_0x52adf2[_0x560a('0x7b')]){logger[_0x560a('0x32')]('['+_0x33c9cf[_0x560a('0x94')][_0x560a('0x95')]()+']',_0x560a('0x7c'));_0x33c9cf[_0x560a('0x7d')]=_0x233421[_0x560a('0x7a')]+_0x560a('0x7e')+_0x33c9cf[_0x560a('0x7f')]+_0x560a('0x80')+md5(_0x33c9cf[_0x560a('0x7f')]);}else{_0x33c9cf['recordingURL']='';}var _0x6dabbc=_0x233421[_0x560a('0x79')]==='zoho.eu'?'eu':_0x560a('0x82');return getAccessToken(_0x233421)[_0x560a('0x24')](function(_0x217c2a){_0x838382=_0x217c2a;return getUser(_0x838382,_0x6dabbc,_0x233421);})[_0x560a('0x24')](function(_0x124846){_0x30b9dc=_0x124846;logger['info'](_0x560a('0x84'),_0x30b9dc['id']);return getEndUser(_0x838382,_0x6dabbc,_0x233421,_0x33c9cf['calleridname'],_0x33c9cf['calleridnum'],_0x30b9dc,_0x27718a);})[_0x560a('0x24')](function(_0x10047b){_0x5406e3=_0x10047b;return getCall(_0x838382,_0x6dabbc,_0x233421,_0x30b9dc,_0x5406e3,_0x27718a,_0x33c9cf,_0x560a('0x70'));})[_0x560a('0x24')](function(_0x2ca8f6){if(_0x2ca8f6){logger[_0x560a('0x32')](_0x560a('0x96'),_0x2ca8f6['id']);}})['catch'](function(_0x9f1871){logger[_0x560a('0x27')]('['+_0x33c9cf['lastevent'][_0x560a('0x95')]()+']',JSON[_0x560a('0x37')](_0x9f1871));});}; \ No newline at end of file +var _0x9a86=['host','serverUrl','monitor_format','[QUEUE]','/api/voice/recordings/','uniqueid','recordingURL','zoho.eu','com','email','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','stripTrailingSlash','recordingFormat','Recording\x20is\x20enabled!','/downloads?type=uniqueid&token=','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','unmanaged','toUpperCase','lastevent','lodash','request-promise','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','format','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','Agent\x20found!','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','last_name','SUCCESS','details','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','nothing','Leads','Creating\x20new\x20call...','administrator','first_name','Subject','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','Called','complete','connect','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','Call_Type','merge','Fields','Call\x20created!','err','queue'];(function(_0x27585f,_0x3c0721){var _0x556baa=function(_0x383f84){while(--_0x383f84){_0x27585f['push'](_0x27585f['shift']());}};_0x556baa(++_0x3c0721);}(_0x9a86,0x1ed));var _0x69a8=function(_0x29d623,_0x1a5c9c){_0x29d623=_0x29d623-0x0;var _0x242e59=_0x9a86[_0x29d623];return _0x242e59;};'use strict';var _=require(_0x69a8('0x0'));var rp=require(_0x69a8('0x1'));var md5=require('md5');var util=require(_0x69a8('0x2'));var intUtil=require(_0x69a8('0x3'));var moment=require(_0x69a8('0x4'));var Redis=require(_0x69a8('0x5'));var BPromise=require(_0x69a8('0x6'));var config=require(_0x69a8('0x7'));var logger=require(_0x69a8('0x8'))(_0x69a8('0x9'));config[_0x69a8('0xa')]=_[_0x69a8('0xb')](config[_0x69a8('0xa')],{'host':_0x69a8('0xc'),'port':0x18eb});var io=require(_0x69a8('0xd'))(new Redis(config[_0x69a8('0xa')]));function emit(_0x1909fc,_0x1c826b,_0x54248e){io['to'](_0x1909fc)[_0x69a8('0xe')](_0x1c826b,_0x54248e);}function request(_0xaf3ed6){logger['debug'](_0x69a8('0xf'),JSON[_0x69a8('0x10')](_0xaf3ed6));return rp(_0xaf3ed6);}function getCustomFields(_0x4f512d,_0x55f63c){var _0x43c11e={};if(_0x4f512d[_0x69a8('0x11')]>0x0){_[_0x69a8('0x12')](_0x4f512d,function(_0x3b8f57){if(_0x3b8f57['type']==='string'&&_0x3b8f57[_0x69a8('0x13')]){_0x43c11e[_0x3b8f57['idField']]=_0x3b8f57[_0x69a8('0x14')][_0x69a8('0x15')]();}else if(_0x3b8f57[_0x69a8('0x16')]===_0x69a8('0x17')&&_0x3b8f57[_0x69a8('0x18')]&&_0x3b8f57['idField']&&_0x55f63c[_0x3b8f57[_0x69a8('0x18')]]){_0x43c11e[_0x3b8f57['idField']]=_0x55f63c[_0x3b8f57[_0x69a8('0x18')]][_0x69a8('0x15')]();}else if(_0x3b8f57['type']===_0x69a8('0x19')&&_0x3b8f57[_0x69a8('0x1a')]&&_0x3b8f57[_0x69a8('0x1a')][_0x69a8('0x1b')]&&_0x3b8f57[_0x69a8('0x13')]&&_0x55f63c[_0x3b8f57[_0x69a8('0x1a')][_0x69a8('0x1b')][_0x69a8('0x1c')]()]){_0x43c11e[_0x3b8f57[_0x69a8('0x13')]]=_0x55f63c[_0x3b8f57[_0x69a8('0x1a')][_0x69a8('0x1b')]['toLowerCase']()][_0x69a8('0x15')]();}});}return _0x43c11e;}function getName(_0x18ce82){if(_0x18ce82[_0x69a8('0x1d')]('\x20')>0x0){var _0x4a769a=_0x18ce82[_0x69a8('0x1e')](/ (.+)/);if(_0x4a769a[0x1]){return _0x4a769a;}}return[_0x18ce82,_0x18ce82];}var accountsTokens={};function getAccessToken(_0x50c251){return new Promise(function(_0x31be94,_0x2db796){if(!_[_0x69a8('0x1f')](accountsTokens[_0x50c251['id']])&&!_[_0x69a8('0x1f')](accountsTokens[_0x50c251['id']][_0x69a8('0x20')])){if(moment()[_0x69a8('0x21')](accountsTokens[_0x50c251['id']][_0x69a8('0x22')])){_0x31be94(accountsTokens[_0x50c251['id']][_0x69a8('0x20')]);}}var _0x363fc0;switch(_0x50c251[_0x69a8('0x23')]){case'US':_0x363fc0=_0x69a8('0x24');break;case'AU':_0x363fc0=_0x69a8('0x25');break;case'EU':_0x363fc0=_0x69a8('0x26');break;case'IN':_0x363fc0='https://accounts.zoho.in';break;case'CN':_0x363fc0='https://accounts.zoho.com.cn';break;default:_0x363fc0=_0x69a8('0x26');break;}var _0x55e45a={'method':_0x69a8('0x27'),'uri':_0x363fc0+_0x69a8('0x28'),'qs':{'refresh_token':_0x50c251[_0x69a8('0x29')],'client_id':_0x50c251[_0x69a8('0x2a')],'client_secret':_0x50c251[_0x69a8('0x2b')],'grant_type':_0x69a8('0x2c')},'json':!![]};return rp(_0x55e45a)[_0x69a8('0x2d')](function(_0x6066d1){accountsTokens[_0x50c251['id']]={'access_token':_0x6066d1[_0x69a8('0x20')],'expires_in':moment()[_0x69a8('0x2e')](_0x6066d1[_0x69a8('0x22')],_0x69a8('0x2f'))};_0x31be94(_0x6066d1[_0x69a8('0x20')]);})[_0x69a8('0x30')](function(_0x2244c7){logger[_0x69a8('0x31')](_0x69a8('0x32'),_0x2244c7[_0x69a8('0x33')]);_0x2db796(_0x2244c7);});});}function getUser(_0x3242ef,_0x18f29d,_0x2f8126,_0x5a6673){logger[_0x69a8('0x34')](_0x69a8('0x35'));return request({'method':'GET','uri':util[_0x69a8('0x36')]('https://www.zohoapis.%s/crm/v2/users',_0x18f29d),'qs':{'type':_0x69a8('0x37')},'headers':{'Authorization':_0x69a8('0x38')+_0x3242ef},'json':!![]})['then'](function(_0x51a25e){if(_0x51a25e[_0x69a8('0x39')]){var _0x2dbdb0=-0x1;if(_['isArrayLikeObject'](_0x51a25e[_0x69a8('0x39')])){if(!_['isNil'](_0x5a6673)){_0x2dbdb0=_[_0x69a8('0x3a')](_0x51a25e[_0x69a8('0x39')],function(_0x5b1cbc){return _0x5b1cbc['email']===_0x5a6673;});}if(_0x2dbdb0>=0x0){logger[_0x69a8('0x34')](_0x69a8('0x3b'));}else{logger[_0x69a8('0x34')]('Using\x20the\x20admin\x20account!');_0x2dbdb0=_[_0x69a8('0x3a')](_0x51a25e['users'],function(_0x131fd9){return _0x131fd9[_0x69a8('0x3c')][_0x69a8('0x1b')]===_0x69a8('0x3d');});}return _0x51a25e['users'][_0x2dbdb0];}else{if(_0x51a25e[_0x69a8('0x3e')][_0x69a8('0x3c')][_0x69a8('0x1b')]===_0x69a8('0x3d')){logger[_0x69a8('0x34')]('Using\x20the\x20admin\x20account!');user=_0x51a25e['user'];return user;}else{logger[_0x69a8('0x31')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x51a25e));throw new Error(_0x69a8('0x3f')+JSON['stringify'](_0x51a25e));}}}else{logger[_0x69a8('0x31')]('The\x20failing\x20result\x20is',JSON[_0x69a8('0x10')](_0x51a25e));throw new Error(_0x69a8('0x3f')+JSON[_0x69a8('0x10')](_0x51a25e));}})[_0x69a8('0x30')](function(_0x451310){console[_0x69a8('0x31')](_0x451310);});}function getZohoUser(_0x5b448d,_0x18f657){return new BPromise(function(_0x136225,_0x31bb6b){request(_0x5b448d)[_0x69a8('0x2d')](function(_0x16744d){var _0x46059a=null;if(_0x16744d){_0x46059a=_0x16744d[_0x69a8('0x40')][0x0];_0x46059a[_0x69a8('0x41')]=_0x18f657;}_0x136225(_0x46059a);})[_0x69a8('0x30')](function(_0x12558e){_0x31bb6b(_0x12558e);});});}function createEndUser(_0x5a80a8,_0x2b30e5,_0xb853c0,_0x34c2f5,_0x3d0d64,_0x54204c){var _0xb853c0=getName(_0xb853c0);return request({'method':'POST','uri':_0x69a8('0x42')+_0x2b30e5+'/crm/v2/'+_[_0x69a8('0x43')](_0x54204c[_0x69a8('0x44')])+'s','body':{'data':[{'Last_Name':_0xb853c0[0x1],'First_Name':_0xb853c0[0x0],'Phone':_0x34c2f5,'Owner':{'name':!_[_0x69a8('0x1f')](_0x3d0d64[_0x69a8('0x45')][_0x69a8('0x1b')])?_0x3d0d64[_0x69a8('0x45')][_0x69a8('0x1b')]:!_[_0x69a8('0x1f')](_0x3d0d64['first_name'])?_0x3d0d64['first_name']+'\x20'+_0x3d0d64[_0x69a8('0x46')]:_0x3d0d64[_0x69a8('0x46')],'id':_0x3d0d64['id']}}]},'headers':{'Authorization':_0x69a8('0x38')+_0x5a80a8},'json':!![]})['then'](function(_0x29936b){if(_0x29936b&&_0x29936b[_0x69a8('0x40')][0x0]['code']===_0x69a8('0x47')){var _0x5c3d07=_0x29936b[_0x69a8('0x40')][0x0][_0x69a8('0x48')];_0x5c3d07[_0x69a8('0x41')]=_[_0x69a8('0x43')](_0x54204c[_0x69a8('0x44')])+'s';return _0x5c3d07;}logger[_0x69a8('0x31')]('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error('Error:\x20'+JSON['stringify'](data));})[_0x69a8('0x30')](function(_0x1b9b71){console[_0x69a8('0x49')](_0x69a8('0x4a'),_0x1b9b71);});}function getEndUser(_0x55298a,_0x2480ca,_0x5580d2,_0x34c461,_0x3c831e,_0x13e3d3,_0x13741d){var _0x295ccd={'method':_0x69a8('0x4b'),'uri':'','headers':{'Authorization':_0x69a8('0x38')+_0x55298a},'json':!![]};switch(_0x13741d[_0x69a8('0x4c')]){case _0x69a8('0x4d'):_0x295ccd[_0x69a8('0x4e')]=_0x69a8('0x42')+_0x2480ca+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x3c831e+'))';return getZohoUser(_0x295ccd,_0x69a8('0x4f'))[_0x69a8('0x2d')](function(_0x27a5a5){if(_0x27a5a5)return _0x27a5a5;_0x295ccd['uri']=_0x69a8('0x42')+_0x2480ca+_0x69a8('0x50')+_0x3c831e+'))';return getZohoUser(_0x295ccd,'Leads')[_0x69a8('0x2d')](function(_0x331b78){if(_0x331b78)return _0x331b78;if(_0x13741d[_0x69a8('0x44')]!='nothing'){return createEndUser(_0x55298a,_0x2480ca,_0x34c461,_0x3c831e,_0x13e3d3,_0x13741d);}else{return{};}});});break;case _0x69a8('0x51'):_0x295ccd[_0x69a8('0x4e')]=_0x69a8('0x42')+_0x2480ca+_0x69a8('0x52')+_0x3c831e+'))';return getZohoUser(_0x295ccd,'Contacts')['then'](function(_0x231213){if(_0x231213)return _0x231213;if(_0x13741d['moduleCreate']!=_0x69a8('0x53')){return createEndUser(_0x55298a,_0x2480ca,_0x34c461,_0x3c831e,_0x13e3d3,_0x13741d);}else{return{};}});break;case'lead':_0x295ccd['uri']=_0x69a8('0x42')+_0x2480ca+_0x69a8('0x50')+_0x3c831e+'))';return getZohoUser(_0x295ccd,_0x69a8('0x54'))[_0x69a8('0x2d')](function(_0x5a8940){if(_0x5a8940)return _0x5a8940;if(_0x13741d[_0x69a8('0x44')]!=_0x69a8('0x53')){return createEndUser(_0x55298a,_0x2480ca,_0x34c461,_0x3c831e,_0x13e3d3,_0x13741d);}else{return{};}});break;}}function getCall(_0x36dd79,_0x25683d,_0x3a2c82,_0x4fb1f3,_0x270320,_0x419822,_0x813e19,_0x5aed1a){logger[_0x69a8('0x34')](_0x69a8('0x55'));var _0x22a284={};_0x22a284['Owner']={'name':!_[_0x69a8('0x1f')](_0x4fb1f3[_0x69a8('0x45')][_0x69a8('0x1b')])&&!_[_0x69a8('0x1f')](_0x4fb1f3['profile'][_0x69a8('0x1b')])&&_0x4fb1f3[_0x69a8('0x3c')][_0x69a8('0x1b')]===_0x69a8('0x56')?_0x4fb1f3[_0x69a8('0x45')][_0x69a8('0x1b')]:!_[_0x69a8('0x1f')](_0x4fb1f3[_0x69a8('0x57')])?_0x4fb1f3['first_name']+'\x20'+_0x4fb1f3['last_name']:_0x4fb1f3[_0x69a8('0x46')],'id':_0x4fb1f3['id']};_0x22a284[_0x69a8('0x58')]=intUtil[_0x69a8('0x59')](_0x419822[_0x69a8('0x5a')],_0x813e19,'\x20');_0x22a284[_0x69a8('0x5b')]=intUtil['getString'](_0x419822['Descriptions'],_0x813e19,'\x0a');if(_0x270320['enduserType']===_0x69a8('0x4f')){_0x22a284[_0x69a8('0x5c')]={'name':!_[_0x69a8('0x1f')](_0x270320[_0x69a8('0x5d')])?_0x270320[_0x69a8('0x5d')]:!_['isNil'](_0x270320['First_Name'])?_0x270320[_0x69a8('0x5e')]+'\x20'+_0x270320[_0x69a8('0x5f')]:_0x270320[_0x69a8('0x5f')],'id':_0x270320['id']};}if(_0x270320[_0x69a8('0x41')]==='Leads'){_0x22a284[_0x69a8('0x60')]={'name':!_[_0x69a8('0x1f')](_0x270320[_0x69a8('0x5d')])?_0x270320['Full_Name']:!_[_0x69a8('0x1f')](_0x270320[_0x69a8('0x5e')])?_0x270320[_0x69a8('0x5e')]+'\x20'+_0x270320[_0x69a8('0x5f')]:_0x270320[_0x69a8('0x5f')],'id':_0x270320['id']};_0x22a284[_0x69a8('0x61')]=_['startCase'](_0x270320[_0x69a8('0x41')]);}if(_0x813e19[_0x69a8('0x62')]){_0x22a284[_0x69a8('0x63')]=moment[_0x69a8('0x64')](parseInt(_0x813e19[_0x69a8('0x62')])*0x3e8)[_0x69a8('0x36')](_0x69a8('0x65'));}else if(_0x813e19[_0x69a8('0x66')]&&_0x813e19[_0x69a8('0x67')]){_0x22a284[_0x69a8('0x63')]=moment[_0x69a8('0x64')](moment(_0x813e19[_0x69a8('0x67')],_0x69a8('0x68'))[_0x69a8('0x69')](moment(_0x813e19[_0x69a8('0x6a')],_0x69a8('0x68'))))['format'](_0x69a8('0x65'));}switch(_0x813e19['lastevent']){case _0x69a8('0x6b'):_0x22a284[_0x69a8('0x6c')]=_0x69a8('0x6d');break;case _0x69a8('0x6e'):case _0x69a8('0x6f'):_0x22a284[_0x69a8('0x6c')]='Answered';break;case'rejected':_0x22a284['Call_Result']=_0x69a8('0x70');break;case _0x69a8('0x71'):_0x22a284[_0x69a8('0x6c')]=_0x69a8('0x72');break;case'timeout':_0x22a284[_0x69a8('0x6c')]=_0x69a8('0x73');default:}_0x22a284[_0x69a8('0x74')]=(_0x5aed1a==='outbound'?moment(_0x813e19['starttime'])[_0x69a8('0x36')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x813e19['agentcalledAt'])[_0x69a8('0x36')](_0x69a8('0x68')))||moment()[_0x69a8('0x36')](_0x69a8('0x68'));_0x22a284[_0x69a8('0x75')]=_0x5aed1a||'Inbound';_0x22a284=_[_0x69a8('0x76')](_0x22a284,getCustomFields(_0x419822[_0x69a8('0x77')],_0x813e19));return request({'method':_0x69a8('0x27'),'uri':_0x69a8('0x42')+_0x25683d+'/crm/v2/Calls','headers':{'Authorization':_0x69a8('0x38')+_0x36dd79},'body':{'data':[_0x22a284]},'json':!![]})[_0x69a8('0x2d')](function(_0x4862c6){if(_0x4862c6&&_0x4862c6[_0x69a8('0x40')][0x0]['code']===_0x69a8('0x47')){logger[_0x69a8('0x34')](_0x69a8('0x78'));return{'id':_0x4862c6['data'][0x0][_0x69a8('0x48')]['id']};}})[_0x69a8('0x30')](function(_0x44b7f3){logger[_0x69a8('0x34')](_0x69a8('0x79'),_0x44b7f3['stack']);console[_0x69a8('0x49')]('err',_0x44b7f3);});}exports[_0x69a8('0x7a')]=function(_0x46362b,_0x4d1d4f,_0xe5023,_0x237dab,_0x49026e,_0x386baf){var _0x135270,_0x3705ae,_0x28aab;_0x386baf[_0x69a8('0x7b')]=intUtil['stripTrailingSlash'](_0x386baf[_0x69a8('0x7b')]);_0x386baf[_0x69a8('0x7c')]=intUtil['stripTrailingSlash'](_0x386baf[_0x69a8('0x7c')]);if(_0x49026e&&_0x49026e[_0x69a8('0x7d')]){logger[_0x69a8('0x34')](_0x69a8('0x7e'),'Recording\x20is\x20enabled!');_0x4d1d4f['recordingURL']=_0x386baf[_0x69a8('0x7c')]+_0x69a8('0x7f')+_0x4d1d4f['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x4d1d4f[_0x69a8('0x80')]);}else{_0x4d1d4f[_0x69a8('0x81')]='';}var _0x58088a=_0x386baf['host']===_0x69a8('0x82')?'eu':_0x69a8('0x83');return getAccessToken(_0x386baf)[_0x69a8('0x2d')](function(_0x1e0268){_0x28aab=_0x1e0268;return getUser(_0x28aab,_0x58088a,_0x386baf,_0x237dab[_0x69a8('0x84')]);})['then'](function(_0x378e08){_0x135270=_0x378e08;logger[_0x69a8('0x34')]('The\x20User\x20ID\x20is:',_0x135270['id']);return getEndUser(_0x28aab,_0x58088a,_0x386baf,_0x4d1d4f[_0x69a8('0x85')],_0x4d1d4f[_0x69a8('0x86')],_0x135270,_0xe5023);})[_0x69a8('0x2d')](function(_0x5c6f20){_0x3705ae=_0x5c6f20;return getCall(_0x28aab,_0x58088a,_0x386baf,_0x135270,_0x3705ae,_0xe5023,_0x4d1d4f,_0x69a8('0x87'));})['then'](function(_0x5d8609){if(_0x5d8609){logger[_0x69a8('0x34')](_0x69a8('0x88'),_0x5d8609['id']);logger[_0x69a8('0x34')](_0x69a8('0x7e'),_0x69a8('0x89'));emit(util[_0x69a8('0x36')](_0x69a8('0x8a'),_0x237dab[_0x69a8('0x1b')]),_0x69a8('0x8b'),{'uri':_0x69a8('0x8c')+_0x386baf['host']+_0x69a8('0x8d')+_0x5d8609['id']});}})['catch'](function(_0x45d779){logger[_0x69a8('0x31')](_0x69a8('0x7e'),JSON[_0x69a8('0x10')](_0x45d779));});};exports['outbound']=function(_0x394130,_0x2baf82,_0x47854f,_0x421d24,_0x1fdffe,_0x106d5c,_0x228771){var _0x2b56fe,_0x347d79,_0x111d46;_0x106d5c[_0x69a8('0x7b')]=intUtil[_0x69a8('0x8e')](_0x106d5c[_0x69a8('0x7b')]);_0x106d5c[_0x69a8('0x7c')]=intUtil['stripTrailingSlash'](_0x106d5c[_0x69a8('0x7c')]);if(_0x228771&&_0x228771[_0x69a8('0x8f')]&&_0x228771['recordingFormat']!=='none'){logger[_0x69a8('0x34')]('[OUTBOUND]',_0x69a8('0x90'));_0x2baf82[_0x69a8('0x81')]=_0x106d5c[_0x69a8('0x7c')]+'/api/voice/recordings/'+_0x2baf82[_0x69a8('0x80')]+_0x69a8('0x91')+md5(_0x2baf82[_0x69a8('0x80')]);}var _0x1993c9=_0x106d5c['host']==='zoho.eu'?'eu':_0x69a8('0x83');return getAccessToken(_0x106d5c)['then'](function(_0x936ff6){_0x111d46=_0x936ff6;return getUser(_0x111d46,_0x1993c9,_0x106d5c,_0x421d24[_0x69a8('0x84')]);})['then'](function(_0x255a59){_0x2b56fe=_0x255a59;logger[_0x69a8('0x34')](_0x69a8('0x92'),_0x2b56fe['id']);return getEndUser(_0x111d46,_0x1993c9,_0x106d5c,_0x2baf82[_0x69a8('0x93')],_0x2baf82[_0x69a8('0x94')],_0x2b56fe,_0x47854f);})['then'](function(_0x196a0d){_0x347d79=_0x196a0d;return getCall(_0x111d46,_0x1993c9,_0x106d5c,_0x2b56fe,_0x347d79,_0x47854f,_0x2baf82,_0x69a8('0x95'));})[_0x69a8('0x2d')](function(_0x50e2ac){if(_0x50e2ac){logger[_0x69a8('0x34')](_0x69a8('0x88'),_0x50e2ac['id']);logger[_0x69a8('0x34')](_0x69a8('0x96'),_0x69a8('0x89'));emit(util[_0x69a8('0x36')]('user:%s',_0x421d24[_0x69a8('0x1b')]),_0x69a8('0x8b'),{'uri':_0x69a8('0x8c')+_0x106d5c[_0x69a8('0x7b')]+'/crm/EntityInfo.do?module=Calls&id='+_0x50e2ac['id']});}})['catch'](function(_0x271cfe){logger[_0x69a8('0x31')](_0x69a8('0x96'),JSON[_0x69a8('0x10')](_0x271cfe));});};exports[_0x69a8('0x97')]=function(_0x5888a3,_0x36d5a6,_0x384893,_0x238c82,_0x3d9efc,_0x1507a8){var _0x546a8f,_0x2c9b10,_0x258d51;_0x1507a8[_0x69a8('0x7b')]=intUtil[_0x69a8('0x8e')](_0x1507a8['host']);_0x1507a8['serverUrl']=intUtil[_0x69a8('0x8e')](_0x1507a8[_0x69a8('0x7c')]);if(_0x3d9efc&&_0x3d9efc['monitor_format']){logger[_0x69a8('0x34')]('['+_0x36d5a6['lastevent'][_0x69a8('0x98')]()+']',_0x69a8('0x90'));_0x36d5a6['recordingURL']=_0x1507a8['serverUrl']+_0x69a8('0x7f')+_0x36d5a6[_0x69a8('0x80')]+_0x69a8('0x91')+md5(_0x36d5a6[_0x69a8('0x80')]);}else{_0x36d5a6[_0x69a8('0x81')]='';}var _0x369459=_0x1507a8[_0x69a8('0x7b')]===_0x69a8('0x82')?'eu':_0x69a8('0x83');return getAccessToken(_0x1507a8)[_0x69a8('0x2d')](function(_0x1880fa){_0x258d51=_0x1880fa;return getUser(_0x258d51,_0x369459,_0x1507a8);})[_0x69a8('0x2d')](function(_0x3f4208){_0x546a8f=_0x3f4208;logger[_0x69a8('0x34')]('The\x20User\x20ID\x20is:',_0x546a8f['id']);return getEndUser(_0x258d51,_0x369459,_0x1507a8,_0x36d5a6[_0x69a8('0x85')],_0x36d5a6[_0x69a8('0x86')],_0x546a8f,_0x384893);})[_0x69a8('0x2d')](function(_0x3b0d29){_0x2c9b10=_0x3b0d29;return getCall(_0x258d51,_0x369459,_0x1507a8,_0x546a8f,_0x2c9b10,_0x384893,_0x36d5a6,_0x69a8('0x87'));})[_0x69a8('0x2d')](function(_0x35f82c){if(_0x35f82c){logger[_0x69a8('0x34')]('The\x20Call\x20ID\x20is:',_0x35f82c['id']);}})[_0x69a8('0x30')](function(_0x15d006){logger[_0x69a8('0x31')]('['+_0x36d5a6[_0x69a8('0x99')][_0x69a8('0x98')]()+']',JSON[_0x69a8('0x10')](_0x15d006));});}; \ 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 43e934e..5b3353a 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(_0x4fc63c,_0x40bf8b){var _0x2cbc65=function(_0x3dcf7a){while(--_0x3dcf7a){_0x4fc63c['push'](_0x4fc63c['shift']());}};_0x2cbc65(++_0x40bf8b);}(_0x7a54,0x106));var _0x47a5=function(_0xf7ff07,_0x31f003){_0xf7ff07=_0xf7ff07-0x0;var _0x567ac3=_0x7a54[_0xf7ff07];return _0x567ac3;};'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(_0x2542ff,_0xa7b965){var _0x38bf56=function(_0xddfc49){while(--_0xddfc49){_0x2542ff['push'](_0x2542ff['shift']());}};_0x38bf56(++_0xa7b965);}(_0x7a54,0x106));var _0x47a5=function(_0x247681,_0x3caa9c){_0x247681=_0x247681-0x0;var _0x243616=_0x7a54[_0x247681];return _0x243616;};'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 cc7c734..22914f8 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 _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(_0x18dd56,_0x5117d1){var _0x20a366=function(_0x33e7d9){while(--_0x33e7d9){_0x18dd56['push'](_0x18dd56['shift']());}};_0x20a366(++_0x5117d1);}(_0x7a54,0x106));var _0x47a5=function(_0x4f9d2b,_0x28120e){_0x4f9d2b=_0x4f9d2b-0x0;var _0x2ce399=_0x7a54[_0x4f9d2b];return _0x2ce399;};'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 +var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x3fd3ab,_0x53f90c){var _0x1d366c=function(_0x467ba3){while(--_0x467ba3){_0x3fd3ab['push'](_0x3fd3ab['shift']());}};_0x1d366c(++_0x53f90c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x9bef43,_0x22812d){_0x9bef43=_0x9bef43-0x0;var _0x68828d=_0x5f2f[_0x9bef43];return _0x68828d;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index cd2fc53..c21d9ed 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 _0x79d3=['catch','routing','exports','jayson/promise','../../config/logger','client','http','request','then','rpc','error','result'];(function(_0x278795,_0x384807){var _0x4b4fc5=function(_0x1747c1){while(--_0x1747c1){_0x278795['push'](_0x278795['shift']());}};_0x4b4fc5(++_0x384807);}(_0x79d3,0x15f));var _0x379d=function(_0x5bd948,_0x478409){_0x5bd948=_0x5bd948-0x0;var _0x52771a=_0x79d3[_0x5bd948];return _0x52771a;};'use strict';var jayson=require(_0x379d('0x0'));var BPromise=require('bluebird');var logger=require(_0x379d('0x1'))('routing');var client=jayson[_0x379d('0x2')][_0x379d('0x3')]({'port':0x2329});client['Request']=function(_0xde90b8,_0x2be235){return new BPromise(function(_0x30d8ba,_0x3888e0){return client[_0x379d('0x4')](_0xde90b8,_0x2be235)[_0x379d('0x5')](function(_0x2a1b43){logger['debug'](_0x379d('0x6'),'routing',_0xde90b8,_0x2be235,_0x2a1b43);if(_0x2a1b43[_0x379d('0x7')]){logger[_0x379d('0x7')](_0x379d('0x6'),'routing',_0xde90b8,_0x2a1b43[_0x379d('0x7')]['message'],_0x2be235);return _0x3888e0(_0x2a1b43['error']['message']);}else{return _0x30d8ba(_0x2a1b43[_0x379d('0x8')]);}})[_0x379d('0x9')](function(_0x7fb511){logger['error'](_0x379d('0x6'),_0x379d('0xa'),_0xde90b8,_0x7fb511,_0x2be235);return _0x3888e0(_0x7fb511);});});};module[_0x379d('0xb')]=client; \ No newline at end of file +var _0xdbf7=['rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','then','debug'];(function(_0x3dbce5,_0x5f24b0){var _0x31f7e8=function(_0x568d60){while(--_0x568d60){_0x3dbce5['push'](_0x3dbce5['shift']());}};_0x31f7e8(++_0x5f24b0);}(_0xdbf7,0x8d));var _0x7dbf=function(_0x5ac757,_0x70e2ca){_0x5ac757=_0x5ac757-0x0;var _0x29a05b=_0xdbf7[_0x5ac757];return _0x29a05b;};'use strict';var jayson=require(_0x7dbf('0x0'));var BPromise=require(_0x7dbf('0x1'));var logger=require(_0x7dbf('0x2'))(_0x7dbf('0x3'));var client=jayson[_0x7dbf('0x4')][_0x7dbf('0x5')]({'port':0x2329});client[_0x7dbf('0x6')]=function(_0x7b931c,_0x4e243e){return new BPromise(function(_0x11294f,_0x5cdcfc){return client['request'](_0x7b931c,_0x4e243e)[_0x7dbf('0x7')](function(_0x47730f){logger[_0x7dbf('0x8')](_0x7dbf('0x9'),_0x7dbf('0x3'),_0x7b931c,_0x4e243e,_0x47730f);if(_0x47730f[_0x7dbf('0xa')]){logger[_0x7dbf('0xa')](_0x7dbf('0x9'),_0x7dbf('0x3'),_0x7b931c,_0x47730f[_0x7dbf('0xa')][_0x7dbf('0xb')],_0x4e243e);return _0x5cdcfc(_0x47730f[_0x7dbf('0xa')][_0x7dbf('0xb')]);}else{return _0x11294f(_0x47730f[_0x7dbf('0xc')]);}})[_0x7dbf('0xd')](function(_0x4f1088){logger[_0x7dbf('0xa')](_0x7dbf('0x9'),_0x7dbf('0x3'),_0x7b931c,_0x4f1088,_0x4e243e);return _0x5cdcfc(_0x4f1088);});});};module[_0x7dbf('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 55fc9a1..8d6dd22 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 _0xa647=['then','getMailAccounts','initMailAccounts','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','resolve'];(function(_0x3c379e,_0x406745){var _0x401fc4=function(_0x46b511){while(--_0x46b511){_0x3c379e['push'](_0x3c379e['shift']());}};_0x401fc4(++_0x406745);}(_0xa647,0x81));var _0x7a64=function(_0x56ab54,_0x1b02c6){_0x56ab54=_0x56ab54-0x0;var _0x2a0b51=_0xa647[_0x56ab54];return _0x2a0b51;};'use strict';var BPromise=require(_0x7a64('0x0'));var server=require(_0x7a64('0x1'));var Realtime=require(_0x7a64('0x2'));var EmailChannel=require(_0x7a64('0x3'));var mailAccount=require(_0x7a64('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x7a64('0x5'))['db'];function initRealtime(){return BPromise[_0x7a64('0x6')]()[_0x7a64('0x7')](mailAccount[_0x7a64('0x8')]())[_0x7a64('0x7')](realtime[_0x7a64('0x9')]())[_0x7a64('0x7')](function(){email['refresh'](realtime[_0x7a64('0xa')]);return realtime;});}function main(){return server[_0x7a64('0xb')](realtime,email)['then'](function(_0x438197){return initRealtime();})[_0x7a64('0x7')](function(_0x13ea76){return db[_0x7a64('0xc')][_0x7a64('0xd')]({'attributes':['id',_0x7a64('0xe')],'raw':!![]});})[_0x7a64('0x7')](function(_0x8eb19b){return setInterval(initRealtime,_0x8eb19b[_0x7a64('0xe')]*0x3e8);})[_0x7a64('0xf')](function(_0x406494){console[_0x7a64('0x10')](_0x406494);});}main(); \ No newline at end of file +var _0x7d9f=['loginMailFrequency','catch','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','resolve','then','getMailAccounts','initMailAccounts','mailAccounts','listen','Setting'];(function(_0x321fc8,_0x2c4f94){var _0x160f7e=function(_0x117f0f){while(--_0x117f0f){_0x321fc8['push'](_0x321fc8['shift']());}};_0x160f7e(++_0x2c4f94);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x14a34a,_0x424129){_0x14a34a=_0x14a34a-0x0;var _0x4d921e=_0x7d9f[_0x14a34a];return _0x4d921e;};'use strict';var BPromise=require(_0xf7d9('0x0'));var server=require(_0xf7d9('0x1'));var Realtime=require(_0xf7d9('0x2'));var EmailChannel=require(_0xf7d9('0x3'));var mailAccount=require(_0xf7d9('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise[_0xf7d9('0x5')]()[_0xf7d9('0x6')](mailAccount[_0xf7d9('0x7')]())[_0xf7d9('0x6')](realtime[_0xf7d9('0x8')]())['then'](function(){email['refresh'](realtime[_0xf7d9('0x9')]);return realtime;});}function main(){return server[_0xf7d9('0xa')](realtime,email)['then'](function(_0x21c654){return initRealtime();})[_0xf7d9('0x6')](function(_0x5e4087){return db[_0xf7d9('0xb')]['findOne']({'attributes':['id',_0xf7d9('0xc')],'raw':!![]});})[_0xf7d9('0x6')](function(_0x5d2735){return setInterval(initRealtime,_0x5d2735['loginMailFrequency']*0x3e8);})[_0xf7d9('0xd')](function(_0x90a7f9){console[_0xf7d9('0xe')](_0x90a7f9);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 6b1af78..99d78e2 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 _0xa59d=['mailAccount:update','refresh','hasOwnProperty','box','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','messageStatus','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verify','then','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','name','active','Imap','status','total','isNil','stringify','emit'];(function(_0x26fb5e,_0x5a8cca){var _0x255321=function(_0x128173){while(--_0x128173){_0x26fb5e['push'](_0x26fb5e['shift']());}};_0x255321(++_0x5a8cca);}(_0xa59d,0x181));var _0xda59=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa59d[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xda59('0x0'));var moment=require(_0xda59('0x1'));var BPromise=require(_0xda59('0x2'));var md5=require(_0xda59('0x3'));var Redis=require(_0xda59('0x4'));var config=require(_0xda59('0x5'));var logger=require(_0xda59('0x6'))(_0xda59('0x7'));config[_0xda59('0x8')]=_[_0xda59('0x9')](config[_0xda59('0x8')],{'host':_0xda59('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require(_0xda59('0xb'));var EmailSmtp=require(_0xda59('0xc'));var mailAccount=require(_0xda59('0xd'));var md5Accounts={};function EmailChannel(_0x78f5f1){logger[_0xda59('0xe')](_0xda59('0xf'));this[_0xda59('0x10')]=_0x78f5f1['mailAccounts'];this[_0xda59('0x11')]={};this[_0xda59('0x12')]=new EmailSmtp();}EmailChannel[_0xda59('0x13')]['emit']=function(_0x3ceea9){var _0x2397e2=this[_0xda59('0x10')][_0x3ceea9];var _0x932d58={'id':_0x2397e2['id'],'name':_0x2397e2[_0xda59('0x14')],'key':_0x2397e2['key'],'active':_0x2397e2[_0xda59('0x15')],'Imap':{'status':_0x2397e2[_0xda59('0x16')][_0xda59('0x17')],'messageStatus':_0x2397e2['Imap']['messageStatus'],'total':_0x2397e2[_0xda59('0x16')][_0xda59('0x18')]}};if(_[_0xda59('0x19')](md5Accounts[_0x3ceea9])){md5Accounts[_0x3ceea9]={};}var _0x2b0a99=md5(JSON[_0xda59('0x1a')](_0x932d58));if(md5Accounts[_0x3ceea9]['md5']!==_0x2b0a99){md5Accounts[_0x3ceea9][_0xda59('0x3')]=_0x2b0a99;io[_0xda59('0x1b')](_0xda59('0x1c'),_0x932d58);}};EmailChannel['prototype'][_0xda59('0x1d')]=function(_0x46e6d6){for(var _0x4e4eeb in _0x46e6d6){if(_0x46e6d6[_0xda59('0x1e')](_0x4e4eeb)){if(_0x46e6d6[_0x4e4eeb]['Imap']&&_0x46e6d6[_0x4e4eeb][_0xda59('0x15')]){var _0x5602d5=_0x46e6d6[_0x4e4eeb][_0xda59('0x16')];if(!this['imapAccounts'][_0xda59('0x1e')](_0x5602d5['id'])){this[_0xda59('0x11')][_0x5602d5['id']]=new EmailImap(_0x5602d5,_0x46e6d6[_0x4e4eeb][_0xda59('0x7')]);this[_0xda59('0x11')][_0x5602d5['id']]['on'](_0xda59('0x1f'),this['handleImapBox'][_0xda59('0x20')](this,_0x4e4eeb));this[_0xda59('0x11')][_0x5602d5['id']]['on']('email',this[_0xda59('0x21')]['bind'](this,_0x4e4eeb));this[_0xda59('0x11')][_0x5602d5['id']]['on'](_0xda59('0x22'),this[_0xda59('0x23')]['bind'](this,_0x4e4eeb));this[_0xda59('0x11')][_0x5602d5['id']]['on'](_0xda59('0x24'),this[_0xda59('0x25')][_0xda59('0x20')](this,_0x4e4eeb));}}else{if(_['isNil'](this[_0xda59('0x10')][_0x4e4eeb][_0xda59('0x16')])){this[_0xda59('0x10')][_0x4e4eeb][_0xda59('0x16')]={};}this[_0xda59('0x10')][_0x4e4eeb][_0xda59('0x16')][_0xda59('0x17')]=_0xda59('0x26');this[_0xda59('0x10')][_0x4e4eeb][_0xda59('0x16')][_0xda59('0x27')]='';this[_0xda59('0x1b')](_0x4e4eeb);}}}};EmailChannel['prototype'][_0xda59('0x28')]=function(_0x1a6dfb,_0x5b7204){if(this[_0xda59('0x10')][_0x1a6dfb]){this[_0xda59('0x10')][_0x1a6dfb]['Imap'][_0xda59('0x17')]=_0xda59('0x29');this['mailAccounts'][_0x1a6dfb][_0xda59('0x16')][_0xda59('0x27')]=_0x5b7204[_0xda59('0x14')];if(_0x5b7204[_0xda59('0x2a')]){this[_0xda59('0x10')][_0x1a6dfb]['Imap'][_0xda59('0x18')]=_0x5b7204[_0xda59('0x2a')][_0xda59('0x18')];}return this[_0xda59('0x1b')](_0x1a6dfb);}};EmailChannel[_0xda59('0x13')][_0xda59('0x21')]=function(_0x52dc43,_0x20075a){logger[_0xda59('0xe')](_0xda59('0x2b'),_0x20075a[_0xda59('0x2c')],_0x20075a[_0xda59('0x2d')],_0x20075a[_0xda59('0x2e')],_0x52dc43);if(this[_0xda59('0x10')][_0x52dc43]){return mailAccount[_0xda59('0x2f')](_0x52dc43,_0x20075a)['then'](function(_0x54a40d){if(_0x54a40d){logger[_0xda59('0xe')]('Mail\x20accepted\x20from\x20routing');}})[_0xda59('0x30')](function(_0x16e67f){logger[_0xda59('0x24')](_0xda59('0x31'),JSON[_0xda59('0x1a')](_0x16e67f));});}};EmailChannel[_0xda59('0x13')][_0xda59('0x23')]=function(_0x236b2c){if(this[_0xda59('0x10')][_0x236b2c]&&this['mailAccounts'][_0x236b2c][_0xda59('0x16')]){if(this[_0xda59('0x11')][this[_0xda59('0x10')][_0x236b2c][_0xda59('0x16')]['id']]){delete this[_0xda59('0x11')][this[_0xda59('0x10')][_0x236b2c][_0xda59('0x16')]['id']];}this[_0xda59('0x10')][_0x236b2c][_0xda59('0x16')][_0xda59('0x32')]=moment();this[_0xda59('0x1b')](_0x236b2c);}};EmailChannel['prototype'][_0xda59('0x25')]=function(_0x4c72ef,_0x16244d){if(this[_0xda59('0x10')][_0x4c72ef]){this[_0xda59('0x10')][_0x4c72ef][_0xda59('0x16')][_0xda59('0x17')]=_0xda59('0x24');this[_0xda59('0x10')][_0x4c72ef][_0xda59('0x16')][_0xda59('0x27')]=_0x16244d;return this[_0xda59('0x1b')](_0x4c72ef);}};EmailChannel[_0xda59('0x13')][_0xda59('0x33')]=function(_0x197df6,_0x586f3b){return this[_0xda59('0x12')][_0xda59('0x34')](_0x197df6,_0x586f3b);};EmailChannel['prototype'][_0xda59('0x35')]=function(_0x146908){var _0x151f3a=this;if(this['mailAccounts'][_0x146908['id']]){if(_[_0xda59('0x19')](this[_0xda59('0x10')][_0x146908['id']][_0xda59('0x36')])){this[_0xda59('0x10')][_0x146908['id']]['Smtp']={};}this[_0xda59('0x10')][_0x146908['id']][_0xda59('0x36')][_0xda59('0x32')]=moment();return new BPromise(function(_0x22392b,_0x5d048f){return _0x151f3a[_0xda59('0x12')][_0xda59('0x37')](_0x146908)[_0xda59('0x38')](function(_0x3b826e){_0x151f3a[_0xda59('0x10')][_0x146908['id']]['Smtp'][_0xda59('0x17')]=_0xda59('0x39');_0x151f3a[_0xda59('0x10')][_0x146908['id']][_0xda59('0x36')][_0xda59('0x27')]='';_0x151f3a['emit'](_0x146908['id']);_0x22392b(_0x3b826e);})[_0xda59('0x30')](function(_0x196ca9){_0x151f3a[_0xda59('0x10')][_0x146908['id']][_0xda59('0x36')][_0xda59('0x17')]=_0xda59('0x24');_0x151f3a[_0xda59('0x10')][_0x146908['id']]['Smtp'][_0xda59('0x27')]=_0x196ca9;_0x151f3a[_0xda59('0x1b')](_0x146908['id']);_0x5d048f(_0x196ca9);});});}return this[_0xda59('0x12')][_0xda59('0x37')](_0x146908);};module[_0xda59('0x3a')]=EmailChannel; \ No newline at end of file +var _0x6154=['handleImapError','disabled','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','smtp','send','Smtp','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','socket.io-emitter','redis','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','prototype','emit','name','status','Imap','messageStatus','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','active','imapAccounts','handleImapBox','bind','handleImapEmail','end','handleImapEnd'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x6154,0xed));var _0x4615=function(_0x2703be,_0x50d8ae){_0x2703be=_0x2703be-0x0;var _0x5efcd7=_0x6154[_0x2703be];return _0x5efcd7;};'use strict';var _=require(_0x4615('0x0'));var moment=require(_0x4615('0x1'));var BPromise=require(_0x4615('0x2'));var md5=require(_0x4615('0x3'));var Redis=require(_0x4615('0x4'));var config=require(_0x4615('0x5'));var logger=require(_0x4615('0x6'))(_0x4615('0x7'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x4615('0x8'))(new Redis(config[_0x4615('0x9')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x4615('0xa'));var mailAccount=require(_0x4615('0xb'));var md5Accounts={};function EmailChannel(_0x4f51b9){logger[_0x4615('0xc')](_0x4615('0xd'));this[_0x4615('0xe')]=_0x4f51b9[_0x4615('0xe')];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel[_0x4615('0xf')][_0x4615('0x10')]=function(_0x3c76c2){var _0x436094=this[_0x4615('0xe')][_0x3c76c2];var _0xcba6a5={'id':_0x436094['id'],'name':_0x436094[_0x4615('0x11')],'key':_0x436094['key'],'active':_0x436094['active'],'Imap':{'status':_0x436094['Imap'][_0x4615('0x12')],'messageStatus':_0x436094[_0x4615('0x13')][_0x4615('0x14')],'total':_0x436094[_0x4615('0x13')]['total']}};if(_[_0x4615('0x15')](md5Accounts[_0x3c76c2])){md5Accounts[_0x3c76c2]={};}var _0x26a6e2=md5(JSON[_0x4615('0x16')](_0xcba6a5));if(md5Accounts[_0x3c76c2][_0x4615('0x3')]!==_0x26a6e2){md5Accounts[_0x3c76c2]['md5']=_0x26a6e2;io[_0x4615('0x10')](_0x4615('0x17'),_0xcba6a5);}};EmailChannel[_0x4615('0xf')][_0x4615('0x18')]=function(_0x1b9d3f){for(var _0x56d74a in _0x1b9d3f){if(_0x1b9d3f[_0x4615('0x19')](_0x56d74a)){if(_0x1b9d3f[_0x56d74a][_0x4615('0x13')]&&_0x1b9d3f[_0x56d74a][_0x4615('0x1a')]){var _0x5135c2=_0x1b9d3f[_0x56d74a][_0x4615('0x13')];if(!this[_0x4615('0x1b')]['hasOwnProperty'](_0x5135c2['id'])){this['imapAccounts'][_0x5135c2['id']]=new EmailImap(_0x5135c2,_0x1b9d3f[_0x56d74a][_0x4615('0x7')]);this[_0x4615('0x1b')][_0x5135c2['id']]['on']('box',this[_0x4615('0x1c')][_0x4615('0x1d')](this,_0x56d74a));this[_0x4615('0x1b')][_0x5135c2['id']]['on']('email',this[_0x4615('0x1e')][_0x4615('0x1d')](this,_0x56d74a));this[_0x4615('0x1b')][_0x5135c2['id']]['on'](_0x4615('0x1f'),this[_0x4615('0x20')][_0x4615('0x1d')](this,_0x56d74a));this[_0x4615('0x1b')][_0x5135c2['id']]['on']('error',this[_0x4615('0x21')][_0x4615('0x1d')](this,_0x56d74a));}}else{if(_[_0x4615('0x15')](this['mailAccounts'][_0x56d74a][_0x4615('0x13')])){this[_0x4615('0xe')][_0x56d74a][_0x4615('0x13')]={};}this[_0x4615('0xe')][_0x56d74a][_0x4615('0x13')][_0x4615('0x12')]=_0x4615('0x22');this['mailAccounts'][_0x56d74a][_0x4615('0x13')][_0x4615('0x14')]='';this[_0x4615('0x10')](_0x56d74a);}}}};EmailChannel['prototype'][_0x4615('0x1c')]=function(_0x268f16,_0x5c5caa){if(this[_0x4615('0xe')][_0x268f16]){this[_0x4615('0xe')][_0x268f16]['Imap'][_0x4615('0x12')]=_0x4615('0x23');this[_0x4615('0xe')][_0x268f16][_0x4615('0x13')]['messageStatus']=_0x5c5caa['name'];if(_0x5c5caa[_0x4615('0x24')]){this['mailAccounts'][_0x268f16][_0x4615('0x13')][_0x4615('0x25')]=_0x5c5caa['messages'][_0x4615('0x25')];}return this['emit'](_0x268f16);}};EmailChannel[_0x4615('0xf')]['handleImapEmail']=function(_0x9b47fd,_0x1e7501){logger[_0x4615('0xc')](_0x4615('0x26'),_0x1e7501['firstName'],_0x1e7501[_0x4615('0x27')],_0x1e7501[_0x4615('0x28')],_0x9b47fd);if(this[_0x4615('0xe')][_0x9b47fd]){return mailAccount[_0x4615('0x29')](_0x9b47fd,_0x1e7501)[_0x4615('0x2a')](function(_0x1ff73b){if(_0x1ff73b){logger[_0x4615('0xc')](_0x4615('0x2b'));}})[_0x4615('0x2c')](function(_0xe00cc3){logger[_0x4615('0x2d')](_0x4615('0x2e'),JSON[_0x4615('0x16')](_0xe00cc3));});}};EmailChannel[_0x4615('0xf')]['handleImapEnd']=function(_0x5991c9){if(this[_0x4615('0xe')][_0x5991c9]&&this[_0x4615('0xe')][_0x5991c9][_0x4615('0x13')]){if(this[_0x4615('0x1b')][this[_0x4615('0xe')][_0x5991c9][_0x4615('0x13')]['id']]){delete this['imapAccounts'][this['mailAccounts'][_0x5991c9][_0x4615('0x13')]['id']];}this[_0x4615('0xe')][_0x5991c9][_0x4615('0x13')][_0x4615('0x2f')]=moment();this[_0x4615('0x10')](_0x5991c9);}};EmailChannel['prototype'][_0x4615('0x21')]=function(_0x107450,_0x8421c9){if(this['mailAccounts'][_0x107450]){this[_0x4615('0xe')][_0x107450][_0x4615('0x13')][_0x4615('0x12')]=_0x4615('0x2d');this[_0x4615('0xe')][_0x107450][_0x4615('0x13')]['messageStatus']=_0x8421c9;return this['emit'](_0x107450);}};EmailChannel['prototype'][_0x4615('0x30')]=function(_0x378a84,_0x337041){return this[_0x4615('0x31')][_0x4615('0x32')](_0x378a84,_0x337041);};EmailChannel['prototype']['verifySmtp']=function(_0xc617ef){var _0x315cd2=this;if(this[_0x4615('0xe')][_0xc617ef['id']]){if(_[_0x4615('0x15')](this[_0x4615('0xe')][_0xc617ef['id']]['Smtp'])){this[_0x4615('0xe')][_0xc617ef['id']]['Smtp']={};}this[_0x4615('0xe')][_0xc617ef['id']][_0x4615('0x33')][_0x4615('0x2f')]=moment();return new BPromise(function(_0x571616,_0x3d69b4){return _0x315cd2['smtp']['verify'](_0xc617ef)[_0x4615('0x2a')](function(_0x31392a){_0x315cd2[_0x4615('0xe')][_0xc617ef['id']][_0x4615('0x33')][_0x4615('0x12')]=_0x4615('0x34');_0x315cd2[_0x4615('0xe')][_0xc617ef['id']][_0x4615('0x33')][_0x4615('0x14')]='';_0x315cd2['emit'](_0xc617ef['id']);_0x571616(_0x31392a);})[_0x4615('0x2c')](function(_0x4da8e1){_0x315cd2[_0x4615('0xe')][_0xc617ef['id']][_0x4615('0x33')][_0x4615('0x12')]=_0x4615('0x2d');_0x315cd2[_0x4615('0xe')][_0xc617ef['id']][_0x4615('0x33')]['messageStatus']=_0x4da8e1;_0x315cd2[_0x4615('0x10')](_0xc617ef['id']);_0x3d69b4(_0x4da8e1);});});}return this[_0x4615('0x31')]['verify'](_0xc617ef);};module[_0x4615('0x35')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index cb3fdbb..369be8d 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 _0x7c7b=['inherits','prototype','getAccount','connTimeout','authTimeout','service','authentication','user','password','host','port','tls','autotls','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','fetch','handleFetchEnd','handleCloseBox','handleMessageBody','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','email','handleFetchError','closeBox','textCode','hasOwnProperty','upperFirst','exports','path','util','lodash','randomstring','mailparser','simpleParser','iconv','events','EventEmitter','./utils','../../../config/logger','mailbox','INBOX','account','imap','once','ready','handleReady','end','handleEnd','bind','error','handleError','connect'];(function(_0x470256,_0x47173e){var _0x4d859e=function(_0x302e66){while(--_0x302e66){_0x470256['push'](_0x470256['shift']());}};_0x4d859e(++_0x47173e);}(_0x7c7b,0xa2));var _0xb7c7=function(_0x1f74db,_0x46d348){_0x1f74db=_0x1f74db-0x0;var _0x4763c5=_0x7c7b[_0x1f74db];return _0x4763c5;};'use strict';var fs=require('fs');var path=require(_0xb7c7('0x0'));var util=require(_0xb7c7('0x1'));var Imap=require('imap');var _=require(_0xb7c7('0x2'));var rs=require(_0xb7c7('0x3'));var simpleParser=require(_0xb7c7('0x4'))[_0xb7c7('0x5')];var Iconv=require(_0xb7c7('0x6'))['Iconv'];var EventEmitter=require(_0xb7c7('0x7'))[_0xb7c7('0x8')];var utils=require(_0xb7c7('0x9'));var logger=require(_0xb7c7('0xa'))('email');function EmailImap(_0x1d37c0,_0x42cc85){this[_0xb7c7('0xb')]=_0xb7c7('0xc');this[_0xb7c7('0xd')]=this['getAccount'](_0x1d37c0,_0x42cc85);this[_0xb7c7('0xe')]=new Imap(this[_0xb7c7('0xd')]);this[_0xb7c7('0xe')][_0xb7c7('0xf')](_0xb7c7('0x10'),this[_0xb7c7('0x11')]['bind'](this));this[_0xb7c7('0xe')][_0xb7c7('0xf')](_0xb7c7('0x12'),this[_0xb7c7('0x13')][_0xb7c7('0x14')](this));this['imap']['on'](_0xb7c7('0x15'),this[_0xb7c7('0x16')][_0xb7c7('0x14')](this));this[_0xb7c7('0xe')][_0xb7c7('0x17')]();}util[_0xb7c7('0x18')](EmailImap,EventEmitter);EmailImap[_0xb7c7('0x19')][_0xb7c7('0x1a')]=function(_0x471a08,_0x4b5c62){var _0x1b90ea={'connTimeout':_0x471a08[_0xb7c7('0x1b')]?_0x471a08[_0xb7c7('0x1b')]*0x3e8:0x2710,'authTimeout':_0x471a08[_0xb7c7('0x1c')]?_0x471a08[_0xb7c7('0x1c')]*0x3e8:0x1388};if(_['isNil'](_0x471a08[_0xb7c7('0x1d')])){if(_0x471a08[_0xb7c7('0x1e')]){_0x1b90ea[_0xb7c7('0x1f')]=_0x471a08[_0xb7c7('0x1f')];_0x1b90ea[_0xb7c7('0x20')]=_0x471a08[_0xb7c7('0x20')];}_0x1b90ea[_0xb7c7('0x21')]=_0x471a08['host'];_0x1b90ea[_0xb7c7('0x22')]=_0x471a08[_0xb7c7('0x22')]||0x3e1;if(_0x471a08['tls']){_0x1b90ea[_0xb7c7('0x23')]=!![];}else{_0x1b90ea['tls']=![];_0x1b90ea[_0xb7c7('0x24')]='required';}}else{_0x1b90ea['user']=_0x471a08[_0xb7c7('0x1f')];_0x1b90ea[_0xb7c7('0x20')]=_0x471a08[_0xb7c7('0x20')];_0x1b90ea['host']=utils[_0xb7c7('0x25')](_0x471a08[_0xb7c7('0x1d')]);_0x1b90ea[_0xb7c7('0x22')]=0x3e1;_0x1b90ea[_0xb7c7('0x23')]=!![];}_0x1b90ea['email']=_0x4b5c62||_0x471a08[_0xb7c7('0x1f')]||_0xb7c7('0x26');return _0x1b90ea;};EmailImap[_0xb7c7('0x19')]['handleReady']=function(){this[_0xb7c7('0xe')][_0xb7c7('0x27')](this[_0xb7c7('0xb')],![],this[_0xb7c7('0x28')][_0xb7c7('0x14')](this));};EmailImap[_0xb7c7('0x19')][_0xb7c7('0x28')]=function(_0xc038a4,_0x506237){if(_0xc038a4){this[_0xb7c7('0x16')](_0xc038a4,!![]);}else{this[_0xb7c7('0x29')](_0xb7c7('0x2a'),_0x506237);this[_0xb7c7('0x2b')]();}};EmailImap[_0xb7c7('0x19')]['handleCloseBox']=function(_0x30db9e){if(_0x30db9e){this['handleError'](_0x30db9e,!![]);}else{this['imap'][_0xb7c7('0x12')]();}};EmailImap[_0xb7c7('0x19')][_0xb7c7('0x2b')]=function(){this[_0xb7c7('0xe')][_0xb7c7('0x2c')]([_0xb7c7('0x2d')],this[_0xb7c7('0x2e')][_0xb7c7('0x14')](this));};EmailImap[_0xb7c7('0x19')][_0xb7c7('0x2e')]=function(_0x4c403f,_0x2c202d){if(_0x4c403f){this[_0xb7c7('0x16')](_0x4c403f,!![]);}else{if(_0x2c202d['length']){try{var _0x5126b1=this[_0xb7c7('0xe')][_0xb7c7('0x2f')](_0x2c202d,{'bodies':'','markSeen':!![]});_0x5126b1['on']('message',this['handleFetchMessage']['bind'](this));_0x5126b1[_0xb7c7('0xf')]('error',this['handleFetchError'][_0xb7c7('0x14')](this));_0x5126b1['once'](_0xb7c7('0x12'),this[_0xb7c7('0x30')]['bind'](this));}catch(_0x5b5794){logger[_0xb7c7('0x15')](_0x5b5794);}}else{this[_0xb7c7('0xe')]['closeBox'](!![],this[_0xb7c7('0x31')][_0xb7c7('0x14')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x294e0d,_0x47c063){_0x294e0d['on']('body',this[_0xb7c7('0x32')]['bind'](this));_0x294e0d[_0xb7c7('0xf')]('attributes',this[_0xb7c7('0x33')][_0xb7c7('0x14')](this));_0x294e0d[_0xb7c7('0xf')](_0xb7c7('0x12'),this['handleMessageEnd'][_0xb7c7('0x14')](this));};EmailImap[_0xb7c7('0x19')][_0xb7c7('0x32')]=function(_0x41f83e,_0x4ff594){simpleParser(_0x41f83e,{'Iconv':Iconv},this[_0xb7c7('0x34')]['bind'](this));};EmailImap[_0xb7c7('0x19')][_0xb7c7('0x33')]=function(_0x4e0012){};EmailImap[_0xb7c7('0x19')][_0xb7c7('0x35')]=function(){};EmailImap[_0xb7c7('0x19')][_0xb7c7('0x34')]=function(_0x2ad633,_0x160a09){if(_0x2ad633){logger['error'](_0x2ad633);}else{var _0x471593=this;utils[_0xb7c7('0x36')](this['account'],_0x160a09,function(_0x5c6f42){_0x471593['emit'](_0xb7c7('0x37'),_0x5c6f42);});}};EmailImap[_0xb7c7('0x19')][_0xb7c7('0x30')]=function(){this['imap']['closeBox'](!![],this['handleCloseBox'][_0xb7c7('0x14')](this));};EmailImap['prototype'][_0xb7c7('0x38')]=function(_0x5a6e12){this[_0xb7c7('0x16')](_0x5a6e12);this[_0xb7c7('0xe')][_0xb7c7('0x39')](!![],this[_0xb7c7('0x31')][_0xb7c7('0x14')](this));};EmailImap['prototype']['handleEnd']=function(){this['emit'](_0xb7c7('0x12'));};EmailImap[_0xb7c7('0x19')][_0xb7c7('0x16')]=function(_0x76887b,_0x4c852e){logger['error'](_0xb7c7('0x16'),this[_0xb7c7('0xd')]['email'],JSON['stringify'](_0x76887b));var _0x198b50='';if(_0x76887b){if(_0x76887b[_0xb7c7('0x3a')]){_0x198b50=_0x76887b[_0xb7c7('0x3a')];}else{for(var _0x34b7d4 in _0x76887b){if(_0x76887b[_0xb7c7('0x3b')](_0x34b7d4)){_0x198b50+=_[_0xb7c7('0x3c')](_0x34b7d4)+':\x20'+_0x76887b[_0x34b7d4]+'\x0a';}}}}if(_0x4c852e){this[_0xb7c7('0xe')][_0xb7c7('0x12')]();}else{this[_0xb7c7('0x29')]('error',_0x198b50);this[_0xb7c7('0x29')](_0xb7c7('0x12'));}};module[_0xb7c7('0x3d')]=EmailImap; \ No newline at end of file +var _0x68b8=['emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','message','error','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','parser','stringify','hasOwnProperty','upperFirst','path','util','imap','randomstring','simpleParser','iconv','EventEmitter','./utils','email','mailbox','account','getAccount','ready','handleReady','bind','once','end','handleError','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','port','tls','autotls','host','getHost','anonymous@xcally.com','openBox','handleOpenBox'];(function(_0x507746,_0x10d781){var _0x3cd705=function(_0x4384e5){while(--_0x4384e5){_0x507746['push'](_0x507746['shift']());}};_0x3cd705(++_0x10d781);}(_0x68b8,0x1df));var _0x868b=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0x68b8[_0xf79bae];return _0x5d2cb7;};'use strict';var fs=require('fs');var path=require(_0x868b('0x0'));var util=require(_0x868b('0x1'));var Imap=require(_0x868b('0x2'));var _=require('lodash');var rs=require(_0x868b('0x3'));var simpleParser=require('mailparser')[_0x868b('0x4')];var Iconv=require(_0x868b('0x5'))['Iconv'];var EventEmitter=require('events')[_0x868b('0x6')];var utils=require(_0x868b('0x7'));var logger=require('../../../config/logger')(_0x868b('0x8'));function EmailImap(_0x408a44,_0x44dca4){this[_0x868b('0x9')]='INBOX';this[_0x868b('0xa')]=this[_0x868b('0xb')](_0x408a44,_0x44dca4);this['imap']=new Imap(this['account']);this[_0x868b('0x2')]['once'](_0x868b('0xc'),this[_0x868b('0xd')][_0x868b('0xe')](this));this[_0x868b('0x2')][_0x868b('0xf')](_0x868b('0x10'),this['handleEnd'][_0x868b('0xe')](this));this[_0x868b('0x2')]['on']('error',this[_0x868b('0x11')][_0x868b('0xe')](this));this['imap']['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x868b('0x12')][_0x868b('0xb')]=function(_0x28cd47,_0x315081){var _0x42c491={'connTimeout':_0x28cd47[_0x868b('0x13')]?_0x28cd47[_0x868b('0x13')]*0x3e8:0x2710,'authTimeout':_0x28cd47['authTimeout']?_0x28cd47[_0x868b('0x14')]*0x3e8:0x1388};if(_[_0x868b('0x15')](_0x28cd47[_0x868b('0x16')])){if(_0x28cd47[_0x868b('0x17')]){_0x42c491[_0x868b('0x18')]=_0x28cd47[_0x868b('0x18')];_0x42c491['password']=_0x28cd47[_0x868b('0x19')];}_0x42c491['host']=_0x28cd47['host'];_0x42c491['port']=_0x28cd47[_0x868b('0x1a')]||0x3e1;if(_0x28cd47['tls']){_0x42c491[_0x868b('0x1b')]=!![];}else{_0x42c491[_0x868b('0x1b')]=![];_0x42c491[_0x868b('0x1c')]='required';}}else{_0x42c491[_0x868b('0x18')]=_0x28cd47['user'];_0x42c491[_0x868b('0x19')]=_0x28cd47[_0x868b('0x19')];_0x42c491[_0x868b('0x1d')]=utils[_0x868b('0x1e')](_0x28cd47['service']);_0x42c491['port']=0x3e1;_0x42c491['tls']=!![];}_0x42c491[_0x868b('0x8')]=_0x315081||_0x28cd47[_0x868b('0x18')]||_0x868b('0x1f');return _0x42c491;};EmailImap[_0x868b('0x12')]['handleReady']=function(){this[_0x868b('0x2')][_0x868b('0x20')](this[_0x868b('0x9')],![],this[_0x868b('0x21')]['bind'](this));};EmailImap[_0x868b('0x12')][_0x868b('0x21')]=function(_0x3f75da,_0x519e58){if(_0x3f75da){this[_0x868b('0x11')](_0x3f75da,!![]);}else{this[_0x868b('0x22')](_0x868b('0x23'),_0x519e58);this[_0x868b('0x24')]();}};EmailImap[_0x868b('0x12')][_0x868b('0x25')]=function(_0x302040){if(_0x302040){this[_0x868b('0x11')](_0x302040,!![]);}else{this[_0x868b('0x2')][_0x868b('0x10')]();}};EmailImap[_0x868b('0x12')]['readUnseen']=function(){this[_0x868b('0x2')][_0x868b('0x26')]([_0x868b('0x27')],this[_0x868b('0x28')][_0x868b('0xe')](this));};EmailImap[_0x868b('0x12')]['handleReadUnseen']=function(_0x55d0c4,_0x3cf3a3){if(_0x55d0c4){this[_0x868b('0x11')](_0x55d0c4,!![]);}else{if(_0x3cf3a3['length']){try{var _0x3924f6=this[_0x868b('0x2')][_0x868b('0x29')](_0x3cf3a3,{'bodies':'','markSeen':!![]});_0x3924f6['on'](_0x868b('0x2a'),this['handleFetchMessage'][_0x868b('0xe')](this));_0x3924f6[_0x868b('0xf')](_0x868b('0x2b'),this[_0x868b('0x2c')][_0x868b('0xe')](this));_0x3924f6[_0x868b('0xf')]('end',this[_0x868b('0x2d')][_0x868b('0xe')](this));}catch(_0x11042e){logger[_0x868b('0x2b')](_0x11042e);}}else{this[_0x868b('0x2')][_0x868b('0x2e')](!![],this[_0x868b('0x25')][_0x868b('0xe')](this));}}};EmailImap[_0x868b('0x12')][_0x868b('0x2f')]=function(_0x45304a,_0x330a85){_0x45304a['on'](_0x868b('0x30'),this[_0x868b('0x31')][_0x868b('0xe')](this));_0x45304a[_0x868b('0xf')](_0x868b('0x32'),this['handleMessageAttributes']['bind'](this));_0x45304a[_0x868b('0xf')](_0x868b('0x10'),this[_0x868b('0x33')][_0x868b('0xe')](this));};EmailImap[_0x868b('0x12')][_0x868b('0x31')]=function(_0x58eb66,_0x176046){simpleParser(_0x58eb66,{'Iconv':Iconv},this[_0x868b('0x34')][_0x868b('0xe')](this));};EmailImap[_0x868b('0x12')]['handleMessageAttributes']=function(_0x2c2291){};EmailImap[_0x868b('0x12')][_0x868b('0x33')]=function(){};EmailImap[_0x868b('0x12')]['handleSimpleParser']=function(_0x212a0a,_0x1d9595){if(_0x212a0a){logger['error'](_0x212a0a);}else{var _0x45473b=this;utils[_0x868b('0x35')](this[_0x868b('0xa')],_0x1d9595,function(_0xc31b0e){_0x45473b[_0x868b('0x22')](_0x868b('0x8'),_0xc31b0e);});}};EmailImap[_0x868b('0x12')][_0x868b('0x2d')]=function(){this['imap'][_0x868b('0x2e')](!![],this[_0x868b('0x25')]['bind'](this));};EmailImap[_0x868b('0x12')][_0x868b('0x2c')]=function(_0x2772b7){this[_0x868b('0x11')](_0x2772b7);this[_0x868b('0x2')]['closeBox'](!![],this[_0x868b('0x25')][_0x868b('0xe')](this));};EmailImap[_0x868b('0x12')]['handleEnd']=function(){this[_0x868b('0x22')](_0x868b('0x10'));};EmailImap[_0x868b('0x12')][_0x868b('0x11')]=function(_0x14c5f7,_0x59bb49){logger['error'](_0x868b('0x11'),this[_0x868b('0xa')][_0x868b('0x8')],JSON[_0x868b('0x36')](_0x14c5f7));var _0x1253b7='';if(_0x14c5f7){if(_0x14c5f7['textCode']){_0x1253b7=_0x14c5f7['textCode'];}else{for(var _0x41657e in _0x14c5f7){if(_0x14c5f7[_0x868b('0x37')](_0x41657e)){_0x1253b7+=_[_0x868b('0x38')](_0x41657e)+':\x20'+_0x14c5f7[_0x41657e]+'\x0a';}}}}if(_0x59bb49){this[_0x868b('0x2')][_0x868b('0x10')]();}else{this[_0x868b('0x22')](_0x868b('0x2b'),_0x1253b7);this[_0x868b('0x22')](_0x868b('0x10'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 7b31a11..aaa806b 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 _0x86e7=['verify','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','toString'];(function(_0x5a0876,_0x1e363e){var _0x55969f=function(_0x3e12ce){while(--_0x3e12ce){_0x5a0876['push'](_0x5a0876['shift']());}};_0x55969f(++_0x1e363e);}(_0x86e7,0x1e1));var _0x786e=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x86e7[_0x3511d3];return _0x5d6321;};'use strict';var nodemailer=require(_0x786e('0x0'));var BPromise=require(_0x786e('0x1'));var inlineBase64=require(_0x786e('0x2'));function EmailSmtp(){}EmailSmtp[_0x786e('0x3')][_0x786e('0x4')]=function(_0xb709e1,_0x26dea8){return new BPromise(function(_0x2efee9,_0x430d43){var _0x16a9e5=nodemailer[_0x786e('0x5')](_0xb709e1);_0x16a9e5[_0x786e('0x6')](_0x786e('0x7'),inlineBase64());_0x16a9e5['sendMail'](_0x26dea8,function(_0x4656e0,_0x84b76c){if(_0x4656e0){_0x430d43(_0x4656e0[_0x786e('0x8')]());}else{_0x2efee9(_0x84b76c);}});});};EmailSmtp['prototype'][_0x786e('0x9')]=function(_0x1431c9){return new BPromise(function(_0x4550f2,_0x3a05c2){var _0x51aa86=nodemailer['createTransport'](_0x1431c9);_0x51aa86['verify'](function(_0xc5e0e9,_0x233a5f){if(_0xc5e0e9){_0x3a05c2(_0xc5e0e9[_0x786e('0x8')]());}else{if(_0x233a5f){_0x4550f2(_0x233a5f);}else{_0x3a05c2('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x7dd7=['send','createTransport','use','compile','sendMail','toString','prototype','verify','nodemailer','bluebird','nodemailer-plugin-inline-base64'];(function(_0x30cfa3,_0x12044d){var _0x344cff=function(_0x34beea){while(--_0x34beea){_0x30cfa3['push'](_0x30cfa3['shift']());}};_0x344cff(++_0x12044d);}(_0x7dd7,0x13c));var _0x77dd=function(_0x277af0,_0x1f0361){_0x277af0=_0x277af0-0x0;var _0x43bd7c=_0x7dd7[_0x277af0];return _0x43bd7c;};'use strict';var nodemailer=require(_0x77dd('0x0'));var BPromise=require(_0x77dd('0x1'));var inlineBase64=require(_0x77dd('0x2'));function EmailSmtp(){}EmailSmtp['prototype'][_0x77dd('0x3')]=function(_0x1faf6,_0x313aa8){return new BPromise(function(_0x2ea1eb,_0x19ffd6){var _0x52c823=nodemailer[_0x77dd('0x4')](_0x1faf6);_0x52c823[_0x77dd('0x5')](_0x77dd('0x6'),inlineBase64());_0x52c823[_0x77dd('0x7')](_0x313aa8,function(_0x4a6a91,_0x1703ad){if(_0x4a6a91){_0x19ffd6(_0x4a6a91[_0x77dd('0x8')]());}else{_0x2ea1eb(_0x1703ad);}});});};EmailSmtp[_0x77dd('0x9')][_0x77dd('0xa')]=function(_0x4fec25){return new BPromise(function(_0x200435,_0x214a3c){var _0x5ce6e9=nodemailer[_0x77dd('0x4')](_0x4fec25);_0x5ce6e9[_0x77dd('0xa')](function(_0x695b50,_0x56753f){if(_0x695b50){_0x214a3c(_0x695b50[_0x77dd('0x8')]());}else{if(_0x56753f){_0x200435(_0x56753f);}else{_0x214a3c('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index a5336ec..59e75d1 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 _0xbfc4=['name','split','length','slice','join','pop','isEmpty','generate','@xcally.com','test','html','replace','body','textAsHtml','Empty\x20message

','Attachments','push','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','outlook365','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','../../../config/environment','head','value','address','anonymous'];(function(_0x532685,_0x1a38c2){var _0x21426a=function(_0xa48343){while(--_0xa48343){_0x532685['push'](_0x532685['shift']());}};_0x21426a(++_0x1a38c2);}(_0xbfc4,0x77));var _0x4bfc=function(_0x41baca,_0x52574e){_0x41baca=_0x41baca-0x0;var _0x21aa2f=_0xbfc4[_0x41baca];return _0x21aa2f;};'use strict';var _=require(_0x4bfc('0x0'));var moment=require(_0x4bfc('0x1'));var random=require(_0x4bfc('0x2'));var fs=require('fs');var path=require(_0x4bfc('0x3'));var util=require(_0x4bfc('0x4'));var tnef=require(_0x4bfc('0x5'));var logger=require('../../../config/logger')('email');var config=require(_0x4bfc('0x6'));function getAddress(_0x957871){var _0x1e71b7=_[_0x4bfc('0x7')](_0x957871[_0x4bfc('0x8')]);return _0x1e71b7&&_0x1e71b7[_0x4bfc('0x9')]?_0x1e71b7[_0x4bfc('0x9')]:_0x4bfc('0xa')+random['generate'](0x6)+'@xcally.com';}function getFirstName(_0x28a0c9){var _0xe73ce1=_[_0x4bfc('0x7')](_0x28a0c9['value']);if(_0xe73ce1&&_0xe73ce1[_0x4bfc('0xb')]){var _0x1f80f2=_0xe73ce1[_0x4bfc('0xb')][_0x4bfc('0xc')](/\s+/);return _0x1f80f2[_0x4bfc('0xd')]?_0x1f80f2[_0x4bfc('0xe')](0x0,-0x1)[_0x4bfc('0xf')]('\x20'):_0xe73ce1[_0x4bfc('0xb')];}return'Anonymous';}function getLastName(_0x540a1e){var _0x1a6fdf=_[_0x4bfc('0x7')](_0x540a1e[_0x4bfc('0x8')]);if(_0x1a6fdf&&_0x1a6fdf['name']){var _0x36ff14=_0x1a6fdf['name'][_0x4bfc('0xc')](/\s+/);return _0x36ff14[_0x4bfc('0xd')]>0x1?_0x36ff14[_0x4bfc('0x10')]():'';}return'';}function getMails(_0x12d588,_0x52bac9){var _0x3139f5='';for(var _0x4bc3b0=0x0;_0x4bc3b0<_0x52bac9[_0x4bfc('0x8')]['length'];_0x4bc3b0+=0x1){if(_0x52bac9['value'][_0x4bc3b0][_0x4bfc('0x9')]!==_0x12d588){if(!_[_0x4bfc('0x11')](_0x3139f5)){_0x3139f5+=',';}_0x3139f5+=_0x52bac9[_0x4bfc('0x8')][_0x4bc3b0][_0x4bfc('0xb')]||_0x52bac9[_0x4bfc('0x8')][_0x4bc3b0][_0x4bfc('0x9')]||'';_0x3139f5+='\x20<';_0x3139f5+=_0x52bac9['value'][_0x4bc3b0][_0x4bfc('0x9')]?_0x52bac9[_0x4bfc('0x8')][_0x4bc3b0]['address']:_0x4bfc('0xa')+random[_0x4bfc('0x12')](0x6)+_0x4bfc('0x13');_0x3139f5+='>';}}return _0x3139f5;}function parseEmail(_0x55b1be,_0x5d4379,_0x31ff96){if(_0x5d4379['html']){var _0x370ae3=/)<[^<]*)*<\/script>/gi;while(_0x370ae3[_0x4bfc('0x14')](_0x5d4379[_0x4bfc('0x15')])){_0x5d4379[_0x4bfc('0x15')]=_0x5d4379[_0x4bfc('0x15')][_0x4bfc('0x16')](_0x370ae3,'');}_0x31ff96[_0x4bfc('0x17')]=_0x5d4379[_0x4bfc('0x15')];}else{_0x31ff96[_0x4bfc('0x17')]=_0x5d4379[_0x4bfc('0x18')];}if(_0x31ff96[_0x4bfc('0x17')]){_0x31ff96['body']=_0x31ff96[_0x4bfc('0x17')][_0x4bfc('0x16')](/Empty\x20message

','getHost','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook365','lodash','moment','path','node-tnef','email','../../../config/environment','head','address','anonymous','generate','@xcally.com','name','split','length','slice','join','Anonymous','value','isEmpty','html','test','replace','body','textAsHtml','0x1?_0x4c4339['pop']():'';}return'';}function getMails(_0x2729b3,_0x273e70){var _0x2bc7c2='';for(var _0x4a0e1a=0x0;_0x4a0e1a<_0x273e70[_0x3f13('0x11')]['length'];_0x4a0e1a+=0x1){if(_0x273e70[_0x3f13('0x11')][_0x4a0e1a]['address']!==_0x2729b3){if(!_[_0x3f13('0x12')](_0x2bc7c2)){_0x2bc7c2+=',';}_0x2bc7c2+=_0x273e70[_0x3f13('0x11')][_0x4a0e1a][_0x3f13('0xb')]||_0x273e70[_0x3f13('0x11')][_0x4a0e1a][_0x3f13('0x7')]||'';_0x2bc7c2+='\x20<';_0x2bc7c2+=_0x273e70[_0x3f13('0x11')][_0x4a0e1a]['address']?_0x273e70['value'][_0x4a0e1a][_0x3f13('0x7')]:_0x3f13('0x8')+random[_0x3f13('0x9')](0x6)+_0x3f13('0xa');_0x2bc7c2+='>';}}return _0x2bc7c2;}function parseEmail(_0x5771ca,_0x118f27,_0x4d2e99){if(_0x118f27[_0x3f13('0x13')]){var _0x236548=/)<[^<]*)*<\/script>/gi;while(_0x236548[_0x3f13('0x14')](_0x118f27[_0x3f13('0x13')])){_0x118f27[_0x3f13('0x13')]=_0x118f27[_0x3f13('0x13')][_0x3f13('0x15')](_0x236548,'');}_0x4d2e99[_0x3f13('0x16')]=_0x118f27['html'];}else{_0x4d2e99[_0x3f13('0x16')]=_0x118f27[_0x3f13('0x17')];}if(_0x4d2e99[_0x3f13('0x16')]){_0x4d2e99[_0x3f13('0x16')]=_0x4d2e99['body'][_0x3f13('0x15')](/Empty\x20message

';if(_0x222be8[_0x3f13('0x33')]){for(var _0x1b061a=0x0;_0x1b061a<_0x222be8[_0x3f13('0x33')][_0x3f13('0xd')];_0x1b061a++){var _0x134ace=_0x222be8['Attachments'][_0x1b061a];_0x57c1df[_0x3f13('0x1a')][_0x3f13('0x1e')][_0x3f13('0x26')]({'filename':_0x134ace[_0x3f13('0x34')],'content':new Buffer(_0x134ace[_0x3f13('0x35')])});}}}_0x310d56(parseEmail(_0x2ecea1,_0x94a108,_0x57c1df));});}else{_0x94a108[_0x3f13('0x13')]=_0x3f13('0x36');_0x310d56(parseEmail(_0x2ecea1,_0x94a108,_0x57c1df));}}else{_0x310d56(parseEmail(_0x2ecea1,_0x94a108,_0x57c1df));}};exports[_0x3f13('0x37')]=function(_0x5cadce){switch(_0x5cadce){case'gmail':return _0x3f13('0x38');case _0x3f13('0x39'):return'imap.mail.yahoo.com';case _0x3f13('0x3a'):return _0x3f13('0x3b');case _0x3f13('0x3c'):return'outlook.office365.com';}return'127.0.0.1';}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 428a356..e9dfcb7 100644 --- a/server/services/email/model/mailAccount.js +++ b/server/services/email/model/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe062=['key','SERV','active','Imap','Smtp','lodash','Service'];(function(_0x3cd141,_0x22bd12){var _0x2897a1=function(_0x37be3c){while(--_0x37be3c){_0x3cd141['push'](_0x3cd141['shift']());}};_0x2897a1(++_0x22bd12);}(_0xe062,0x8a));var _0x2e06=function(_0x41a96b,_0x46e121){_0x41a96b=_0x41a96b-0x0;var _0x5e92d4=_0xe062[_0x41a96b];return _0x5e92d4;};'use strict';var _=require(_0x2e06('0x0'));function MailAccount(_0x310d94){this['id']=_0x310d94['id']||0x0;this['name']=_0x310d94['name']||_0x2e06('0x1');this['key']=_0x310d94[_0x2e06('0x2')]||_0x2e06('0x3');this[_0x2e06('0x4')]=_0x310d94[_0x2e06('0x4')]||![];this[_0x2e06('0x5')]=_0x310d94['Imap']||[];this[_0x2e06('0x6')]=_0x310d94[_0x2e06('0x6')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x22c8=['active','Imap','Smtp','lodash','name','key','SERV'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x22c8,0x1a7));var _0x822c=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0x22c8[_0x23b655];return _0x364b32;};'use strict';var _=require(_0x822c('0x0'));function MailAccount(_0x59343e){this['id']=_0x59343e['id']||0x0;this[_0x822c('0x1')]=_0x59343e['name']||'Service';this[_0x822c('0x2')]=_0x59343e[_0x822c('0x2')]||_0x822c('0x3');this[_0x822c('0x4')]=_0x59343e[_0x822c('0x4')]||![];this[_0x822c('0x5')]=_0x59343e[_0x822c('0x5')]||[];this[_0x822c('0x6')]=_0x59343e[_0x822c('0x6')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index f9f6d6d..fc1f70e 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1826=['exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','initMailAccounts','length','isUndefined','merge'];(function(_0x2a7b50,_0x545d55){var _0x4224c9=function(_0x2b96f6){while(--_0x2b96f6){_0x2a7b50['push'](_0x2a7b50['shift']());}};_0x4224c9(++_0x545d55);}(_0x1826,0x1da));var _0x6182=function(_0xe24fc0,_0x444ff6){_0xe24fc0=_0xe24fc0-0x0;var _0x185c6b=_0x1826[_0xe24fc0];return _0x185c6b;};'use strict';var _=require(_0x6182('0x0'));var MailAccount=require(_0x6182('0x1'));var Realtime=function(){this[_0x6182('0x2')]={};};function freeIsNotKey(_0x4b9b6f,_0x456ed3,_0x5ad6b2){var _0x3051d0=_[_0x6182('0x3')](_0x4b9b6f,function(_0x205040,_0x508439){return _0x205040[_0x5ad6b2];});for(var _0xd0f62d in _0x456ed3){if(_0x456ed3[_0x6182('0x4')](_0xd0f62d)){if(!_0x3051d0[_0xd0f62d]){delete _0x456ed3[_0xd0f62d];}}}}Realtime[_0x6182('0x5')]['mergeFromDatabase']=function(_0x241bd7,_0x249764){for(var _0x297f9f in _0x249764){if(_0x241bd7['hasOwnProperty'](_0x297f9f)){_0x241bd7[_0x297f9f]=_0x249764[_0x297f9f];}}};Realtime[_0x6182('0x5')][_0x6182('0x6')]=function(){var _0x5e7de5=this;return function(_0x430085){if(_0x430085){freeIsNotKey(_0x430085,_0x5e7de5[_0x6182('0x2')],'id');for(var _0x32dea4=0x0,_0x13f71f={},_0x38726f={};_0x32dea4<_0x430085[_0x6182('0x7')];_0x32dea4+=0x1){_0x13f71f=_0x430085[_0x32dea4];if(_[_0x6182('0x8')](_0x5e7de5[_0x6182('0x2')][_0x13f71f['id']])){_0x5e7de5['mailAccounts'][_0x13f71f['id']]=new MailAccount(_0x13f71f);}else{_[_0x6182('0x9')](_0x5e7de5['mailAccounts'][_0x13f71f['id']],_0x13f71f);}}}return _0x5e7de5[_0x6182('0x2')];};};module[_0x6182('0xa')]=Realtime; \ No newline at end of file +var _0xf2ea=['mergeFromDatabase','initMailAccounts','mailAccounts','isUndefined','merge','exports','lodash','mapKeys','hasOwnProperty','prototype'];(function(_0xf1af27,_0x598bb1){var _0x46b274=function(_0x1dba43){while(--_0x1dba43){_0xf1af27['push'](_0xf1af27['shift']());}};_0x46b274(++_0x598bb1);}(_0xf2ea,0xce));var _0xaf2e=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xf2ea[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xaf2e('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x1d9de8,_0x255834,_0x29b6f9){var _0x3c0fb6=_[_0xaf2e('0x1')](_0x1d9de8,function(_0x16342e,_0xe53c3d){return _0x16342e[_0x29b6f9];});for(var _0x56f9d3 in _0x255834){if(_0x255834[_0xaf2e('0x2')](_0x56f9d3)){if(!_0x3c0fb6[_0x56f9d3]){delete _0x255834[_0x56f9d3];}}}}Realtime[_0xaf2e('0x3')][_0xaf2e('0x4')]=function(_0x3027f0,_0x4b1cc0){for(var _0x2f7f6b in _0x4b1cc0){if(_0x3027f0[_0xaf2e('0x2')](_0x2f7f6b)){_0x3027f0[_0x2f7f6b]=_0x4b1cc0[_0x2f7f6b];}}};Realtime[_0xaf2e('0x3')][_0xaf2e('0x5')]=function(){var _0x296bc4=this;return function(_0x2fd5d6){if(_0x2fd5d6){freeIsNotKey(_0x2fd5d6,_0x296bc4[_0xaf2e('0x6')],'id');for(var _0x335772=0x0,_0x517d36={},_0x48033c={};_0x335772<_0x2fd5d6['length'];_0x335772+=0x1){_0x517d36=_0x2fd5d6[_0x335772];if(_[_0xaf2e('0x7')](_0x296bc4[_0xaf2e('0x6')][_0x517d36['id']])){_0x296bc4[_0xaf2e('0x6')][_0x517d36['id']]=new MailAccount(_0x517d36);}else{_[_0xaf2e('0x8')](_0x296bc4[_0xaf2e('0x6')][_0x517d36['id']],_0x517d36);}}}return _0x296bc4[_0xaf2e('0x6')];};};module[_0xaf2e('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 9642384..2139998 100644 --- a/server/services/email/rpc/mailAccount.js +++ b/server/services/email/rpc/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa630=['TemplateId','MailServerIn','Imap','Smtp','getMailAccount','notify','Request','NotifyMailAccount','../client','getMailAccounts','name','email','key','ListId'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xa630,0xbe));var _0x0a63=function(_0x3e3691,_0x4bcae0){_0x3e3691=_0x3e3691-0x0;var _0x111500=_0xa630[_0x3e3691];return _0x111500;};'use strict';var client=require(_0x0a63('0x0'));exports[_0x0a63('0x1')]=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0x0a63('0x2'),'service',_0x0a63('0x3'),'active',_0x0a63('0x4'),_0x0a63('0x5'),_0x0a63('0x6')],'raw':![],'include':[{'model':_0x0a63('0x7'),'as':_0x0a63('0x8')},{'model':'MailServerOut','as':_0x0a63('0x9')}]},'log':_0x0a63('0xa')});};};exports[_0x0a63('0xb')]=function(_0x41d21d,_0x12a7df){return client[_0x0a63('0xc')]('NotifyMailAccount',{'account':{'id':_0x41d21d},'body':_0x12a7df,'log':_0x0a63('0xd')});}; \ No newline at end of file +var _0x3079=['email','active','TemplateId','MailServerIn','Imap','MailServerOut','Smtp','NotifyMailAccount','getMailAccounts','Request','GetMailAccount','name'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3079,0x110));var _0x9307=function(_0x29a957,_0x2f59d6){_0x29a957=_0x29a957-0x0;var _0x4064e8=_0x3079[_0x29a957];return _0x4064e8;};'use strict';var client=require('../client');exports[_0x9307('0x0')]=function(){return function(){return client[_0x9307('0x1')](_0x9307('0x2'),{'options':{'attributes':['id',_0x9307('0x3'),'service',_0x9307('0x4'),_0x9307('0x5'),'key','ListId',_0x9307('0x6')],'raw':![],'include':[{'model':_0x9307('0x7'),'as':_0x9307('0x8')},{'model':_0x9307('0x9'),'as':_0x9307('0xa')}]},'log':'getMailAccount'});};};exports['notify']=function(_0x3120da,_0x4ca523){return client[_0x9307('0x1')](_0x9307('0xb'),{'account':{'id':_0x3120da},'body':_0x4ca523,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 5cc5c21..4e3bd31 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaacc=['email','listen','sendMail','message','catch','verifySmtp','account','then','error','values','mailAccounts','length','Imap','password','Smtp','server','http','stringify','127.0.0.1','log','RPC\x20listening\x20on\x20port:','jayson/promise','lodash'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xaacc,0x1b3));var _0xcaac=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xaacc[_0x9cd4c3];return _0x4c9025;};'use strict';var jayson=require(_0xcaac('0x0'));var BPromise=require('bluebird');var _=require(_0xcaac('0x1'));var logger=require('../../../config/logger')(_0xcaac('0x2'));exports[_0xcaac('0x3')]=function(_0x408a5d,_0x5b26fa){return new BPromise(function(_0x3ed184,_0x729101){var _0x1dce0a={'SendMail':function(_0x4003bc){var _0x151766=this;return new Promise(function(_0x386998,_0x3e9504){_0x5b26fa[_0xcaac('0x4')](_0x4003bc['account'],_0x4003bc[_0xcaac('0x5')])['then'](function(_0xec5de2){_0x386998({'code':0xc8,'message':_0xec5de2});})[_0xcaac('0x6')](function(_0x19d7fe){_0x3e9504(_0x151766['error'](0x1f4,_0x19d7fe));});});},'VerifySmtp':function(_0x456530){var _0x238b39=this;return new Promise(function(_0x57eab6,_0x353448){_0x5b26fa[_0xcaac('0x7')](_0x456530[_0xcaac('0x8')])[_0xcaac('0x9')](function(_0xe8649c){_0x57eab6({'code':0xc8,'message':'Verified'});})['catch'](function(_0x196393){_0x353448(_0x238b39[_0xcaac('0xa')](0x1f4,_0x196393));});});},'MailAccounts':function(_0x518ff7){return new Promise(function(_0x5a5042,_0x5bb26b){var _0x50a883=_[_0xcaac('0xb')](_0x408a5d[_0xcaac('0xc')]);for(var _0x49ae9d=0x0;_0x49ae9d<_0x50a883[_0xcaac('0xd')];_0x49ae9d+=0x1){if(_0x50a883[_0x49ae9d]['Imap']&&_0x50a883[_0x49ae9d][_0xcaac('0xe')][_0xcaac('0xf')]){delete _0x50a883[_0x49ae9d]['Imap'][_0xcaac('0xf')];}if(_0x50a883[_0x49ae9d]['Smtp']&&_0x50a883[_0x49ae9d][_0xcaac('0x10')]['pass']){delete _0x50a883[_0x49ae9d][_0xcaac('0x10')]['pass'];}}_0x5a5042({'count':_0x50a883['length'],'rows':_0x50a883});});}};var _0x5697b9=jayson[_0xcaac('0x11')](_0x1dce0a)[_0xcaac('0x12')]();_0x5697b9['on'](_0xcaac('0xa'),function(_0x6c74d){logger[_0xcaac('0xa')](JSON[_0xcaac('0x13')](_0x6c74d));return _0x729101(_0x6c74d);});_0x5697b9['listen'](0x232b,_0xcaac('0x14'),function(){console[_0xcaac('0x15')]('Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232b);return _0x3ed184(_0xcaac('0x16')+0x232b);});});}; \ No newline at end of file +var _0x662d=['then','catch','error','verifySmtp','Verified','length','Imap','password','Smtp','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','bluebird','lodash','../../../config/logger','email','listen','sendMail','message'];(function(_0x36524f,_0x1e3ec7){var _0x159a25=function(_0x586970){while(--_0x586970){_0x36524f['push'](_0x36524f['shift']());}};_0x159a25(++_0x1e3ec7);}(_0x662d,0x1c7));var _0xd662=function(_0x443f54,_0x5bc153){_0x443f54=_0x443f54-0x0;var _0x157c4a=_0x662d[_0x443f54];return _0x157c4a;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xd662('0x0'));var _=require(_0xd662('0x1'));var logger=require(_0xd662('0x2'))(_0xd662('0x3'));exports[_0xd662('0x4')]=function(_0x4b79bc,_0x29febc){return new BPromise(function(_0x3cd6d7,_0x4d332d){var _0x44e109={'SendMail':function(_0x4bdecd){var _0x5c01d8=this;return new Promise(function(_0x4ba63c,_0x46431a){_0x29febc[_0xd662('0x5')](_0x4bdecd['account'],_0x4bdecd[_0xd662('0x6')])[_0xd662('0x7')](function(_0x103df4){_0x4ba63c({'code':0xc8,'message':_0x103df4});})[_0xd662('0x8')](function(_0x501d2f){_0x46431a(_0x5c01d8[_0xd662('0x9')](0x1f4,_0x501d2f));});});},'VerifySmtp':function(_0x1674ed){var _0x28068d=this;return new Promise(function(_0x136fa4,_0x321bd1){_0x29febc[_0xd662('0xa')](_0x1674ed['account'])[_0xd662('0x7')](function(_0x112def){_0x136fa4({'code':0xc8,'message':_0xd662('0xb')});})[_0xd662('0x8')](function(_0xd04596){_0x321bd1(_0x28068d['error'](0x1f4,_0xd04596));});});},'MailAccounts':function(_0x10f9b9){return new Promise(function(_0x274a78,_0x30f1ad){var _0x5e63b8=_['values'](_0x4b79bc['mailAccounts']);for(var _0x2e7163=0x0;_0x2e7163<_0x5e63b8[_0xd662('0xc')];_0x2e7163+=0x1){if(_0x5e63b8[_0x2e7163][_0xd662('0xd')]&&_0x5e63b8[_0x2e7163][_0xd662('0xd')][_0xd662('0xe')]){delete _0x5e63b8[_0x2e7163][_0xd662('0xd')]['password'];}if(_0x5e63b8[_0x2e7163][_0xd662('0xf')]&&_0x5e63b8[_0x2e7163][_0xd662('0xf')]['pass']){delete _0x5e63b8[_0x2e7163]['Smtp']['pass'];}}_0x274a78({'count':_0x5e63b8[_0xd662('0xc')],'rows':_0x5e63b8});});}};var _0x4be5ad=jayson[_0xd662('0x10')](_0x44e109)[_0xd662('0x11')]();_0x4be5ad['on'](_0xd662('0x9'),function(_0x2cdb13){logger['error'](JSON[_0xd662('0x12')](_0x2cdb13));return _0x4d332d(_0x2cdb13);});_0x4be5ad['listen'](0x232b,_0xd662('0x13'),function(){console[_0xd662('0x14')](_0xd662('0x15'),0x232b);return _0x3cd6d7('RPC\x20listening\x20on\x20port:'+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index 17ec1f9..1a8878e 100644 --- a/server/services/express/index.js +++ b/server/services/express/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad8b=['localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','listening','exports','lodash','http','express','sticky-session','ioredis','timeout','port','socket.io','websocket','polling','redis','defaults'];(function(_0x4f8dd8,_0x2c6ef6){var _0x558147=function(_0x27d819){while(--_0x27d819){_0x4f8dd8['push'](_0x4f8dd8['shift']());}};_0x558147(++_0x2c6ef6);}(_0xad8b,0xa4));var _0xbad8=function(_0x9c6c1c,_0x21ead9){_0x9c6c1c=_0x9c6c1c-0x0;var _0x594c42=_0xad8b[_0x9c6c1c];return _0x594c42;};'use strict';var _=require(_0xbad8('0x0'));var http=require(_0xbad8('0x1'));var express=require(_0xbad8('0x2'));var sticky=require(_0xbad8('0x3'));var Redis=require(_0xbad8('0x4'));var config=require('../../config/environment');var app=express();var server=http['createServer'](app);server[_0xbad8('0x5')]=0xdbba0;if(sticky['listen'](server,config[_0xbad8('0x6')])){var socketio=require(_0xbad8('0x7'))(server,{'transports':[_0xbad8('0x8'),_0xbad8('0x9')]});config[_0xbad8('0xa')]=_[_0xbad8('0xb')](config[_0xbad8('0xa')],{'host':_0xbad8('0xc'),'port':0x18eb});socketio[_0xbad8('0xd')](require(_0xbad8('0xe'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xbad8('0xa')])}));require(_0xbad8('0xf'))[_0xbad8('0x10')]();require(_0xbad8('0x11'))[_0xbad8('0x10')](socketio);require(_0xbad8('0x12'))[_0xbad8('0x10')](app);require(_0xbad8('0x13'))[_0xbad8('0x10')](app);}else{server['once'](_0xbad8('0x14'),function(){console['log']('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xbad8('0x6')]);});}exports=module[_0xbad8('0x15')]=app; \ No newline at end of file +var _0x9d88=['express','sticky-session','ioredis','createServer','timeout','listen','port','socket.io','polling','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','log','Express\x20server\x20listening\x20on\x20port\x20%d!'];(function(_0x307877,_0x45d602){var _0x3ea112=function(_0x159e0f){while(--_0x159e0f){_0x307877['push'](_0x307877['shift']());}};_0x3ea112(++_0x45d602);}(_0x9d88,0x1a4));var _0x89d8=function(_0x55aaaa,_0xc94ec4){_0x55aaaa=_0x55aaaa-0x0;var _0x4bb465=_0x9d88[_0x55aaaa];return _0x4bb465;};'use strict';var _=require('lodash');var http=require('http');var express=require(_0x89d8('0x0'));var sticky=require(_0x89d8('0x1'));var Redis=require(_0x89d8('0x2'));var config=require('../../config/environment');var app=express();var server=http[_0x89d8('0x3')](app);server[_0x89d8('0x4')]=0xdbba0;if(sticky[_0x89d8('0x5')](server,config[_0x89d8('0x6')])){var socketio=require(_0x89d8('0x7'))(server,{'transports':['websocket',_0x89d8('0x8')]});config['redis']=_['defaults'](config[_0x89d8('0x9')],{'host':_0x89d8('0xa'),'port':0x18eb});socketio[_0x89d8('0xb')](require(_0x89d8('0xc'))({'pubClient':new Redis(config[_0x89d8('0x9')]),'subClient':new Redis(config[_0x89d8('0x9')])}));require(_0x89d8('0xd'))[_0x89d8('0xe')]();require(_0x89d8('0xf'))[_0x89d8('0xe')](socketio);require(_0x89d8('0x10'))[_0x89d8('0xe')](app);require(_0x89d8('0x11'))[_0x89d8('0xe')](app);}else{server['once']('listening',function(){console[_0x89d8('0x12')](_0x89d8('0x13'),config[_0x89d8('0x6')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 18c8dee..608e809 100644 --- a/server/services/routing/client.js +++ b/server/services/routing/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ccb=['client','http','Request','request','debug','rpc','error','message','result','catch','jayson/promise','bluebird','routing'];(function(_0x447f33,_0x489af1){var _0x4e0bc7=function(_0x460d11){while(--_0x460d11){_0x447f33['push'](_0x447f33['shift']());}};_0x4e0bc7(++_0x489af1);}(_0x8ccb,0x1c4));var _0xb8cc=function(_0x1809c5,_0x46cabc){_0x1809c5=_0x1809c5-0x0;var _0x5254a4=_0x8ccb[_0x1809c5];return _0x5254a4;};'use strict';var jayson=require(_0xb8cc('0x0'));var BPromise=require(_0xb8cc('0x1'));var logger=require('../../config/logger')(_0xb8cc('0x2'));var client=jayson[_0xb8cc('0x3')][_0xb8cc('0x4')]({'port':0x2329});client[_0xb8cc('0x5')]=function(_0x5ede44,_0x4e1ed7){return new BPromise(function(_0x115fdc,_0x3672bc){return client[_0xb8cc('0x6')](_0x5ede44,_0x4e1ed7)['then'](function(_0x46ac6e){logger[_0xb8cc('0x7')](_0xb8cc('0x8'),'routing',_0x5ede44,_0x4e1ed7,_0x46ac6e);if(_0x46ac6e[_0xb8cc('0x9')]){logger[_0xb8cc('0x9')](_0xb8cc('0x8'),'routing',_0x5ede44,_0x46ac6e[_0xb8cc('0x9')][_0xb8cc('0xa')],_0x4e1ed7);return _0x3672bc(_0x46ac6e['error']['message']);}else{return _0x115fdc(_0x46ac6e[_0xb8cc('0xb')]);}})[_0xb8cc('0xc')](function(_0x57522f){logger['error'](_0xb8cc('0x8'),_0xb8cc('0x2'),_0x5ede44,_0x57522f,_0x4e1ed7);return _0x3672bc(_0x57522f);});});};module['exports']=client; \ No newline at end of file +var _0xeddd=['debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','http','request','then'];(function(_0x5ec5a4,_0x2da9ee){var _0x1fdb8b=function(_0x5d80d1){while(--_0x5d80d1){_0x5ec5a4['push'](_0x5ec5a4['shift']());}};_0x1fdb8b(++_0x2da9ee);}(_0xeddd,0x69));var _0xdedd=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xeddd[_0x35885a];return _0xe86249;};'use strict';var jayson=require(_0xdedd('0x0'));var BPromise=require(_0xdedd('0x1'));var logger=require(_0xdedd('0x2'))(_0xdedd('0x3'));var client=jayson['client'][_0xdedd('0x4')]({'port':0x2329});client['Request']=function(_0x10de65,_0xd2ff49){return new BPromise(function(_0x56e22a,_0x37b819){return client[_0xdedd('0x5')](_0x10de65,_0xd2ff49)[_0xdedd('0x6')](function(_0x3e6b5a){logger[_0xdedd('0x7')](_0xdedd('0x8'),_0xdedd('0x3'),_0x10de65,_0xd2ff49,_0x3e6b5a);if(_0x3e6b5a[_0xdedd('0x9')]){logger[_0xdedd('0x9')](_0xdedd('0x8'),_0xdedd('0x3'),_0x10de65,_0x3e6b5a[_0xdedd('0x9')]['message'],_0xd2ff49);return _0x37b819(_0x3e6b5a[_0xdedd('0x9')][_0xdedd('0xa')]);}else{return _0x56e22a(_0x3e6b5a[_0xdedd('0xb')]);}})[_0xdedd('0xc')](function(_0x5db016){logger[_0xdedd('0x9')](_0xdedd('0x8'),_0xdedd('0x3'),_0x10de65,_0x5db016,_0xd2ff49);return _0x37b819(_0x5db016);});});};module[_0xdedd('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 2815de3..8d68024 100644 --- a/server/services/routing/index.js +++ b/server/services/routing/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa57e=['initWhatsappQueues','listen','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','initAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues'];(function(_0x9880a0,_0x2bfd2c){var _0x42437b=function(_0x391ad4){while(--_0x391ad4){_0x9880a0['push'](_0x9880a0['shift']());}};_0x42437b(++_0x2bfd2c);}(_0xa57e,0xb8));var _0xea57=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa57e[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0xea57('0x0'));var server=require(_0xea57('0x1'));var Realtime=require(_0xea57('0x2'));var user=require(_0xea57('0x3'));var interval=require(_0xea57('0x4'));var openchannelQueue=require(_0xea57('0x5'));var chatQueue=require(_0xea57('0x6'));var smsQueue=require(_0xea57('0x7'));var mailQueue=require(_0xea57('0x8'));var faxQueue=require(_0xea57('0x9'));var whatsappQueue=require(_0xea57('0xa'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xea57('0xb')]()[_0xea57('0xc')](user['getAgents']())[_0xea57('0xc')](realtime[_0xea57('0xd')]())[_0xea57('0xc')](interval[_0xea57('0xe')]())[_0xea57('0xc')](realtime['initIntervals']())[_0xea57('0xc')](openchannelQueue[_0xea57('0xf')]())['then'](realtime[_0xea57('0x10')]())[_0xea57('0xc')](chatQueue[_0xea57('0x11')]())[_0xea57('0xc')](realtime[_0xea57('0x12')]())[_0xea57('0xc')](smsQueue[_0xea57('0x13')]())[_0xea57('0xc')](realtime['initSmsQueues']())['then'](mailQueue['getMailQueues']())['then'](realtime[_0xea57('0x14')]())[_0xea57('0xc')](faxQueue[_0xea57('0x15')]())[_0xea57('0xc')](realtime[_0xea57('0x16')]())[_0xea57('0xc')](whatsappQueue[_0xea57('0x17')]())[_0xea57('0xc')](realtime[_0xea57('0x18')]())[_0xea57('0xc')](function(){return realtime;});}function main(){return server[_0xea57('0x19')](realtime)['then'](function(_0x560538){return initRealtime();})[_0xea57('0xc')](function(_0x314080){return setInterval(initRealtime,0x1388);})['catch'](function(_0x5c9e20){console['log'](_0x5c9e20);});}main(); \ No newline at end of file +var _0xc20d=['initIntervals','getOpenchannelQueues','getSmsQueues','initSmsQueues','getMailQueues','getFaxQueues','initWhatsappQueues','catch','log','bluebird','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','resolve','then','getAgents','initAgents'];(function(_0x7babd9,_0x1d1f5e){var _0x394174=function(_0x40e52a){while(--_0x40e52a){_0x7babd9['push'](_0x7babd9['shift']());}};_0x394174(++_0x1d1f5e);}(_0xc20d,0x100));var _0xdc20=function(_0x2ff238,_0x1811d2){_0x2ff238=_0x2ff238-0x0;var _0x204a56=_0xc20d[_0x2ff238];return _0x204a56;};'use strict';var BPromise=require(_0xdc20('0x0'));var server=require('./server');var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require(_0xdc20('0x1'));var openchannelQueue=require(_0xdc20('0x2'));var chatQueue=require(_0xdc20('0x3'));var smsQueue=require(_0xdc20('0x4'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xdc20('0x5'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xdc20('0x6')]()[_0xdc20('0x7')](user[_0xdc20('0x8')]())[_0xdc20('0x7')](realtime[_0xdc20('0x9')]())[_0xdc20('0x7')](interval['getIntervals']())['then'](realtime[_0xdc20('0xa')]())[_0xdc20('0x7')](openchannelQueue[_0xdc20('0xb')]())[_0xdc20('0x7')](realtime['initOpenchannelQueues']())['then'](chatQueue['getChatQueues']())['then'](realtime['initChatQueues']())[_0xdc20('0x7')](smsQueue[_0xdc20('0xc')]())['then'](realtime[_0xdc20('0xd')]())['then'](mailQueue[_0xdc20('0xe')]())[_0xdc20('0x7')](realtime['initMailQueues']())[_0xdc20('0x7')](faxQueue[_0xdc20('0xf')]())[_0xdc20('0x7')](realtime['initFaxQueues']())[_0xdc20('0x7')](whatsappQueue['getWhatsappQueues']())['then'](realtime[_0xdc20('0x10')]())[_0xdc20('0x7')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xdc20('0x7')](function(_0x5c91f1){return initRealtime();})[_0xdc20('0x7')](function(_0x38be97){return setInterval(initRealtime,0x1388);})[_0xdc20('0x11')](function(_0x338ba1){console[_0xdc20('0x12')](_0x338ba1);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index f4aca7f..3d09570 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x134e=['exports','lodash','util','events','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','call','nextTick','next','restart','length','condition','matchPath','findRules','matches','prioritize','priority','toJSON','map','toString','fromJSON','isString','object'];(function(_0x5696d6,_0x595027){var _0x1efc45=function(_0x1a16e8){while(--_0x1a16e8){_0x5696d6['push'](_0x5696d6['shift']());}};_0x1efc45(++_0x595027);}(_0x134e,0x1e5));var _0xe134=function(_0x18c6d5,_0x49beca){_0x18c6d5=_0x18c6d5-0x0;var _0x47b85a=_0x134e[_0x18c6d5];return _0x47b85a;};'use strict';var _=require(_0xe134('0x0'));var util=require(_0xe134('0x1'));var EventEmitter=require(_0xe134('0x2'))[_0xe134('0x3')];function RuleEngine(_0x2166b0,_0x316d35){this[_0xe134('0x4')]();if(!_[_0xe134('0x5')](_0x2166b0)){this[_0xe134('0x6')](_0x2166b0);}if(_0x316d35){this[_0xe134('0x7')]=_0x316d35[_0xe134('0x7')];}return this;}util[_0xe134('0x8')](RuleEngine,EventEmitter);RuleEngine[_0xe134('0x9')][_0xe134('0x4')]=function(_0x1c35be){this[_0xe134('0xa')]=[];this[_0xe134('0xb')]=[];};RuleEngine['prototype'][_0xe134('0x6')]=function(_0x34e98f){if(Array[_0xe134('0xc')](_0x34e98f)){this[_0xe134('0xa')]=this[_0xe134('0xa')][_0xe134('0xd')](_0x34e98f);}else if(_0x34e98f!==null&&_['isObject'](_0x34e98f)){this[_0xe134('0xa')][_0xe134('0xe')](_0x34e98f);}this[_0xe134('0xf')]();};RuleEngine['prototype'][_0xe134('0xf')]=function(){this[_0xe134('0xb')]=this[_0xe134('0xa')][_0xe134('0x10')](function(_0x394c67){if(_[_0xe134('0x5')](_0x394c67['on'])){_0x394c67['on']=!![];}if(_0x394c67['on']===!![]){return _0x394c67;}});this[_0xe134('0xb')]=_[_0xe134('0x11')](this[_0xe134('0xb')],['p'],[_0xe134('0x12')]);};RuleEngine['prototype'][_0xe134('0x13')]=function(_0x170db4,_0x3fb7ec){var _0x2b2199=![];_0x170db4[_0xe134('0x14')]=!![];var _0x349ceb=_[_0xe134('0x15')](_0x170db4);var _0x1bfa22=_[_0xe134('0x15')](_0x170db4);var _0x27561f=this[_0xe134('0xb')];var _0x2c1722=[];var _0x17df19=this[_0xe134('0x7')];(function FnRuleLoop(_0x4bdcc2){var _0x19dbbe={'rules':function(){return _0x27561f;},'rule':function(){return _0x27561f[_0x4bdcc2];},'when':function(_0x36d029){if(_0x36d029){var _0x2590a8=_0x27561f[_0x4bdcc2][_0xe134('0x16')];_0x2590a8[_0xe134('0x17')]=_0x27561f[_0x4bdcc2]['id']||_0x27561f[_0x4bdcc2][_0xe134('0x18')]||_0xe134('0x19')+_0x4bdcc2;process['nextTick'](function(){_0x2c1722[_0xe134('0xe')](_0x2590a8['ruleRef']);_0x2590a8[_0xe134('0x1a')](_0x349ceb,_0x19dbbe);});}else{process[_0xe134('0x1b')](function(){_0x19dbbe[_0xe134('0x1c')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x2b2199=!![];return FnRuleLoop(0x0);},'next':function(_0x70b03e){if(!_0x17df19&&!_['isEqual'](_0x1bfa22,_0x349ceb)){_0x1bfa22=_[_0xe134('0x15')](_0x349ceb);process['nextTick'](function(){_0x19dbbe[_0xe134('0x1d')]();});}else{process['nextTick'](function(){if(_['isNil'](_0x70b03e)){return FnRuleLoop(_0x4bdcc2+0x1);}else{return FnRuleLoop(_0x70b03e);}});}}};if(_0x4bdcc2<_0x27561f[_0xe134('0x1e')]&&_0x2b2199===![]){var _0x764bcd=_0x27561f[_0x4bdcc2][_0xe134('0x1f')];_0x764bcd[_0xe134('0x1a')](_0x349ceb,_0x19dbbe);}else{process[_0xe134('0x1b')](function(){_0x349ceb[_0xe134('0x20')]=_0x2c1722;return _0x3fb7ec?_0x3fb7ec(_0x349ceb):_['noop']();});}}(0x0));};RuleEngine[_0xe134('0x9')][_0xe134('0x21')]=function(_0x30765b){if(_['isNil'](_0x30765b)){return this[_0xe134('0xa')];}else{var _0x15bacc=_[_0xe134('0x22')](_0x30765b);return _[_0xe134('0x10')](this[_0xe134('0xa')],_0x15bacc);}};RuleEngine[_0xe134('0x9')]['turn']=function(_0x43ac81,_0x3a1f26){var _0xdba25e=_0x43ac81==='on'||_0x43ac81==='ON'?!![]:![];var _0x25a8d8=this[_0xe134('0x21')](_0x3a1f26);for(var _0x676935=0x0,_0x249727=_0x25a8d8[_0xe134('0x1e')];_0x676935<_0x249727;_0x676935+=0x1){_0x25a8d8[_0x676935]['on']=_0xdba25e;}this['sync']();};RuleEngine[_0xe134('0x9')][_0xe134('0x23')]=function(_0x514c35,_0x4b9630){_0x514c35=parseInt(_0x514c35,0xa);var _0x39ddfb=this[_0xe134('0x21')](_0x4b9630);for(var _0x5343d3=0x0,_0x477584=_0x39ddfb[_0xe134('0x1e')];_0x5343d3<_0x477584;_0x5343d3+=0x1){_0x39ddfb[_0x5343d3][_0xe134('0x24')]=_0x514c35;}this[_0xe134('0xf')]();};RuleEngine[_0xe134('0x9')][_0xe134('0x25')]=function(){var _0x448bfb=this[_0xe134('0xa')];if(_0x448bfb instanceof Array){_0x448bfb=_0x448bfb[_0xe134('0x26')](function(_0x2c0428){_0x2c0428[_0xe134('0x1f')]=_0x2c0428['condition'][_0xe134('0x27')]();_0x2c0428[_0xe134('0x16')]=_0x2c0428[_0xe134('0x16')][_0xe134('0x27')]();return _0x2c0428;});}else if(!_[_0xe134('0x5')](_0x448bfb)){_0x448bfb[_0xe134('0x1f')]=_0x448bfb[_0xe134('0x1f')][_0xe134('0x27')]();_0x448bfb[_0xe134('0x16')]=_0x448bfb[_0xe134('0x16')]['toString']();}return _0x448bfb;};RuleEngine[_0xe134('0x9')][_0xe134('0x28')]=function(_0x970a55){this[_0xe134('0x4')]();if(_[_0xe134('0x29')](_0x970a55)){_0x970a55=JSON['parse'](_0x970a55);}if(_0x970a55 instanceof Array){_0x970a55=_0x970a55[_0xe134('0x26')](function(_0x5d6782){_0x5d6782[_0xe134('0x1f')]=eval('('+_0x5d6782[_0xe134('0x1f')]+')');_0x5d6782['consequence']=eval('('+_0x5d6782[_0xe134('0x16')]+')');return _0x5d6782;});}else if(_0x970a55!==null&&typeof _0x970a55==_0xe134('0x2a')){_0x970a55[_0xe134('0x1f')]=eval('('+_0x970a55[_0xe134('0x1f')]+')');_0x970a55[_0xe134('0x16')]=eval('('+_0x970a55[_0xe134('0x16')]+')');}this['register'](_0x970a55);};module[_0xe134('0x2b')]=RuleEngine; \ No newline at end of file +var _0xbba1=['map','toString','consequence','fromJSON','isString','object','lodash','util','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','isArray','concat','isObject','push','sync','filter','execute','result','clone','index_','nextTick','ruleRef','call','isEqual','length','condition','noop','findRules','matches','turn','prioritize','priority'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbba1,0xa2));var _0x1bba=function(_0x59cfcb,_0xf9a1d8){_0x59cfcb=_0x59cfcb-0x0;var _0x3a2e75=_0xbba1[_0x59cfcb];return _0x3a2e75;};'use strict';var _=require(_0x1bba('0x0'));var util=require(_0x1bba('0x1'));var EventEmitter=require('events')[_0x1bba('0x2')];function RuleEngine(_0x23d130,_0x1c489e){this[_0x1bba('0x3')]();if(!_[_0x1bba('0x4')](_0x23d130)){this[_0x1bba('0x5')](_0x23d130);}if(_0x1c489e){this[_0x1bba('0x6')]=_0x1c489e[_0x1bba('0x6')];}return this;}util[_0x1bba('0x7')](RuleEngine,EventEmitter);RuleEngine[_0x1bba('0x8')][_0x1bba('0x3')]=function(_0x511462){this[_0x1bba('0x9')]=[];this[_0x1bba('0xa')]=[];};RuleEngine[_0x1bba('0x8')][_0x1bba('0x5')]=function(_0x36b713){if(Array[_0x1bba('0xb')](_0x36b713)){this['rules']=this['rules'][_0x1bba('0xc')](_0x36b713);}else if(_0x36b713!==null&&_[_0x1bba('0xd')](_0x36b713)){this[_0x1bba('0x9')][_0x1bba('0xe')](_0x36b713);}this[_0x1bba('0xf')]();};RuleEngine[_0x1bba('0x8')]['sync']=function(){this[_0x1bba('0xa')]=this[_0x1bba('0x9')][_0x1bba('0x10')](function(_0x3a2d0f){if(_[_0x1bba('0x4')](_0x3a2d0f['on'])){_0x3a2d0f['on']=!![];}if(_0x3a2d0f['on']===!![]){return _0x3a2d0f;}});this['activeRules']=_['orderBy'](this[_0x1bba('0xa')],['p'],['asc']);};RuleEngine[_0x1bba('0x8')][_0x1bba('0x11')]=function(_0x3a39d8,_0x29f4d5){var _0x2ca0b8=![];_0x3a39d8[_0x1bba('0x12')]=!![];var _0x2fe442=_[_0x1bba('0x13')](_0x3a39d8);var _0x3cfb62=_['clone'](_0x3a39d8);var _0x2ffe37=this[_0x1bba('0xa')];var _0x421d91=[];var _0x9b251d=this['ignoreFactChanges'];(function FnRuleLoop(_0x445c93){var _0x3474b0={'rules':function(){return _0x2ffe37;},'rule':function(){return _0x2ffe37[_0x445c93];},'when':function(_0x2d843d){if(_0x2d843d){var _0x5ea7e5=_0x2ffe37[_0x445c93]['consequence'];_0x5ea7e5['ruleRef']=_0x2ffe37[_0x445c93]['id']||_0x2ffe37[_0x445c93]['name']||_0x1bba('0x14')+_0x445c93;process[_0x1bba('0x15')](function(){_0x421d91['push'](_0x5ea7e5[_0x1bba('0x16')]);_0x5ea7e5[_0x1bba('0x17')](_0x2fe442,_0x3474b0);});}else{process['nextTick'](function(){_0x3474b0['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x2ca0b8=!![];return FnRuleLoop(0x0);},'next':function(_0x2f995a){if(!_0x9b251d&&!_[_0x1bba('0x18')](_0x3cfb62,_0x2fe442)){_0x3cfb62=_[_0x1bba('0x13')](_0x2fe442);process[_0x1bba('0x15')](function(){_0x3474b0['restart']();});}else{process[_0x1bba('0x15')](function(){if(_['isNil'](_0x2f995a)){return FnRuleLoop(_0x445c93+0x1);}else{return FnRuleLoop(_0x2f995a);}});}}};if(_0x445c93<_0x2ffe37[_0x1bba('0x19')]&&_0x2ca0b8===![]){var _0x46fd17=_0x2ffe37[_0x445c93][_0x1bba('0x1a')];_0x46fd17[_0x1bba('0x17')](_0x2fe442,_0x3474b0);}else{process[_0x1bba('0x15')](function(){_0x2fe442['matchPath']=_0x421d91;return _0x29f4d5?_0x29f4d5(_0x2fe442):_[_0x1bba('0x1b')]();});}}(0x0));};RuleEngine[_0x1bba('0x8')][_0x1bba('0x1c')]=function(_0x1a00d9){if(_[_0x1bba('0x4')](_0x1a00d9)){return this[_0x1bba('0x9')];}else{var _0x5cf8ce=_[_0x1bba('0x1d')](_0x1a00d9);return _['filter'](this['rules'],_0x5cf8ce);}};RuleEngine[_0x1bba('0x8')][_0x1bba('0x1e')]=function(_0x5877e6,_0x5059a5){var _0x4bdd40=_0x5877e6==='on'||_0x5877e6==='ON'?!![]:![];var _0x347eef=this[_0x1bba('0x1c')](_0x5059a5);for(var _0x4e2580=0x0,_0x13c373=_0x347eef['length'];_0x4e2580<_0x13c373;_0x4e2580+=0x1){_0x347eef[_0x4e2580]['on']=_0x4bdd40;}this[_0x1bba('0xf')]();};RuleEngine['prototype'][_0x1bba('0x1f')]=function(_0x49cf77,_0x5382fb){_0x49cf77=parseInt(_0x49cf77,0xa);var _0x298206=this[_0x1bba('0x1c')](_0x5382fb);for(var _0x480bc1=0x0,_0x418246=_0x298206[_0x1bba('0x19')];_0x480bc1<_0x418246;_0x480bc1+=0x1){_0x298206[_0x480bc1][_0x1bba('0x20')]=_0x49cf77;}this['sync']();};RuleEngine[_0x1bba('0x8')]['toJSON']=function(){var _0x1a6b4f=this[_0x1bba('0x9')];if(_0x1a6b4f instanceof Array){_0x1a6b4f=_0x1a6b4f[_0x1bba('0x21')](function(_0x3e9394){_0x3e9394[_0x1bba('0x1a')]=_0x3e9394[_0x1bba('0x1a')][_0x1bba('0x22')]();_0x3e9394[_0x1bba('0x23')]=_0x3e9394[_0x1bba('0x23')][_0x1bba('0x22')]();return _0x3e9394;});}else if(!_[_0x1bba('0x4')](_0x1a6b4f)){_0x1a6b4f[_0x1bba('0x1a')]=_0x1a6b4f[_0x1bba('0x1a')][_0x1bba('0x22')]();_0x1a6b4f[_0x1bba('0x23')]=_0x1a6b4f['consequence']['toString']();}return _0x1a6b4f;};RuleEngine['prototype'][_0x1bba('0x24')]=function(_0x478bc1){this[_0x1bba('0x3')]();if(_[_0x1bba('0x25')](_0x478bc1)){_0x478bc1=JSON['parse'](_0x478bc1);}if(_0x478bc1 instanceof Array){_0x478bc1=_0x478bc1['map'](function(_0xdf4c28){_0xdf4c28[_0x1bba('0x1a')]=eval('('+_0xdf4c28[_0x1bba('0x1a')]+')');_0xdf4c28[_0x1bba('0x23')]=eval('('+_0xdf4c28[_0x1bba('0x23')]+')');return _0xdf4c28;});}else if(_0x478bc1!==null&&typeof _0x478bc1==_0x1bba('0x26')){_0x478bc1[_0x1bba('0x1a')]=eval('('+_0x478bc1[_0x1bba('0x1a')]+')');_0x478bc1[_0x1bba('0x23')]=eval('('+_0x478bc1[_0x1bba('0x23')]+')');}this[_0x1bba('0x5')](_0x478bc1);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 7205f69..8756be3 100644 --- a/server/services/routing/mailRpc/index.js +++ b/server/services/routing/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x19e764,_0x50f102){var _0x10e56f=function(_0x1c09f3){while(--_0x1c09f3){_0x19e764['push'](_0x19e764['shift']());}};_0x10e56f(++_0x50f102);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x64a51,_0x22b255){var _0x322a82=function(_0x272dc5){while(--_0x272dc5){_0x64a51['push'](_0x64a51['shift']());}};_0x322a82(++_0x22b255);}(_0x34e8,0x12c));var _0x834e=function(_0x15723c,_0x5079af){_0x15723c=_0x15723c-0x0;var _0x3a8a75=_0x34e8[_0x15723c];return _0x3a8a75;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 3fd8f62..2f12e94 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e22=['mail','chat','openchannel','fax','whatsapp','getChannelStatus','toNumber','format','Status','mailStatus','faxStatusTime','smsCurrentCapacity','whatsappStatus','busyQueue','stringify','emit','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','updateRealtime','CurrentCapacity','Capacity','maxcapacity','working'];(function(_0x2605b2,_0x463e51){var _0x47a047=function(_0x22dabf){while(--_0x22dabf){_0x2605b2['push'](_0x2605b2['shift']());}};_0x47a047(++_0x463e51);}(_0x7e22,0x1d8));var _0x27e2=function(_0x33f933,_0x12d7c3){_0x33f933=_0x33f933-0x0;var _0xf24bb8=_0x7e22[_0x33f933];return _0xf24bb8;};'use strict';var _=require(_0x27e2('0x0'));var moment=require('moment');var md5=require(_0x27e2('0x1'));var Redis=require(_0x27e2('0x2'));var config=require(_0x27e2('0x3'));config[_0x27e2('0x4')]=_[_0x27e2('0x5')](config[_0x27e2('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x27e2('0x6'))(new Redis(config['redis']));function Agent(_0x3b7d1e){this['id']=_0x3b7d1e['id']||0x0;this[_0x27e2('0x7')]=_0x3b7d1e[_0x27e2('0x7')]||'';this[_0x27e2('0x8')]=_0x3b7d1e['online']||!![];this[_0x27e2('0x9')]=_0x3b7d1e[_0x27e2('0x9')]||![];this[_0x27e2('0xa')]=_0x3b7d1e[_0x27e2('0xa')]||![];this[_0x27e2('0xb')]=_0x3b7d1e[_0x27e2('0xb')]||![];this[_0x27e2('0xc')]=_0x3b7d1e[_0x27e2('0xc')]||![];this['smsPause']=_0x3b7d1e[_0x27e2('0xd')]||![];this[_0x27e2('0xe')]=_0x3b7d1e['openchannelPause']||![];this[_0x27e2('0xf')]=_0x27e2('0x10');this[_0x27e2('0x11')]=0x0;this[_0x27e2('0x12')]=_0x3b7d1e['chatCapacity']||0x0;this[_0x27e2('0x13')]=0x0;this['mailStatus']=_0x27e2('0x10');this[_0x27e2('0x14')]=0x0;this[_0x27e2('0x15')]=_0x3b7d1e[_0x27e2('0x15')]||0x0;this[_0x27e2('0x16')]=0x0;this['faxStatus']=_0x27e2('0x10');this['faxStatusTime']=0x0;this[_0x27e2('0x17')]=_0x3b7d1e[_0x27e2('0x17')]||0x0;this[_0x27e2('0x18')]=0x0;this[_0x27e2('0x19')]=_0x27e2('0x10');this[_0x27e2('0x1a')]=0x0;this[_0x27e2('0x1b')]=_0x3b7d1e[_0x27e2('0x1b')]||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']=_0x27e2('0x10');this[_0x27e2('0x1c')]=0x0;this['whatsappCapacity']=_0x3b7d1e[_0x27e2('0x1d')]||0x0;this[_0x27e2('0x1e')]=0x0;this[_0x27e2('0x1f')]=_0x27e2('0x10');this[_0x27e2('0x20')]=0x0;this['openchannelCapacity']=_0x3b7d1e[_0x27e2('0x21')]||0x0;this[_0x27e2('0x22')]=0x0;this[_0x27e2('0x23')]=![];this['busyQueue']=undefined;this[_0x27e2('0x1')]='';this[_0x27e2('0x24')]();}Agent['prototype']['getChannelStatus']=function(_0x227eab){if(this[_0x227eab+_0x27e2('0x25')]>0x0){if(this[_0x227eab+_0x27e2('0x26')]>0x0&&this[_0x227eab+_0x27e2('0x25')]>=this[_0x227eab+_0x27e2('0x26')]){return _0x27e2('0x27');}else{return _0x27e2('0x28');}}else{return'idle';}};Agent['prototype'][_0x27e2('0x24')]=function(){var _0x1f1b14=[_0x27e2('0x29'),_0x27e2('0x2a'),_0x27e2('0x2b'),_0x27e2('0x2c'),'sms',_0x27e2('0x2d')];for(var _0x30b0a9=0x0;_0x30b0a9<_0x1f1b14['length'];_0x30b0a9+=0x1){var _0x212e9a=this[_0x27e2('0x2e')](_0x1f1b14[_0x30b0a9]);if(this[_0x1f1b14[_0x30b0a9]+'Status']!==_0x212e9a){this[_0x1f1b14[_0x30b0a9]+'StatusTime']=_[_0x27e2('0x2f')](moment()[_0x27e2('0x30')]('x'));}this[_0x1f1b14[_0x30b0a9]+_0x27e2('0x31')]=_0x212e9a;}var _0x46ca56={'id':this['id'],'name':this[_0x27e2('0x7')],'online':this[_0x27e2('0x8')],'voicePause':this[_0x27e2('0x9')],'chatPause':this[_0x27e2('0xa')],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this[_0x27e2('0xc')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x27e2('0xf')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x27e2('0x12')],'chatCurrentCapacity':this[_0x27e2('0x13')],'mailStatus':this[_0x27e2('0x32')],'mailStatusTime':this[_0x27e2('0x14')],'mailCapacity':this[_0x27e2('0x15')],'mailCurrentCapacity':this[_0x27e2('0x16')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x27e2('0x33')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x27e2('0x19')],'smsStatusTime':this[_0x27e2('0x1a')],'smsCapacity':this[_0x27e2('0x1b')],'smsCurrentCapacity':this[_0x27e2('0x34')],'whatsappStatus':this[_0x27e2('0x35')],'whatsappStatusTime':this[_0x27e2('0x1c')],'whatsappCapacity':this[_0x27e2('0x1d')],'whatsappCurrentCapacity':this[_0x27e2('0x1e')],'openchannelStatus':this[_0x27e2('0x1f')],'openchannelStatusTime':this[_0x27e2('0x20')],'openchannelCapacity':this[_0x27e2('0x21')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x27e2('0x36')]};var _0x576678=md5(JSON[_0x27e2('0x37')](_0x46ca56));if(this['md5']!==_0x576678){this[_0x27e2('0x1')]=_0x576678;io[_0x27e2('0x38')]('user:save',_0x46ca56);}};module['exports']=Agent; \ No newline at end of file +var _0xae8e=['fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','smsStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','Capacity','CurrentCapacity','idle','mail','chat','openchannel'];(function(_0x1d45c1,_0x28cc4c){var _0x4b1545=function(_0x134b9b){while(--_0x134b9b){_0x1d45c1['push'](_0x1d45c1['shift']());}};_0x4b1545(++_0x28cc4c);}(_0xae8e,0xc3));var _0xeae8=function(_0x2e4348,_0x5f1e1e){_0x2e4348=_0x2e4348-0x0;var _0x10a210=_0xae8e[_0x2e4348];return _0x10a210;};'use strict';var _=require(_0xeae8('0x0'));var moment=require(_0xeae8('0x1'));var md5=require(_0xeae8('0x2'));var Redis=require(_0xeae8('0x3'));var config=require(_0xeae8('0x4'));config[_0xeae8('0x5')]=_[_0xeae8('0x6')](config[_0xeae8('0x5')],{'host':_0xeae8('0x7'),'port':0x18eb});var io=require(_0xeae8('0x8'))(new Redis(config[_0xeae8('0x5')]));function Agent(_0x27545b){this['id']=_0x27545b['id']||0x0;this[_0xeae8('0x9')]=_0x27545b[_0xeae8('0x9')]||'';this[_0xeae8('0xa')]=_0x27545b[_0xeae8('0xa')]||!![];this[_0xeae8('0xb')]=_0x27545b[_0xeae8('0xb')]||![];this[_0xeae8('0xc')]=_0x27545b[_0xeae8('0xc')]||![];this[_0xeae8('0xd')]=_0x27545b[_0xeae8('0xd')]||![];this[_0xeae8('0xe')]=_0x27545b[_0xeae8('0xe')]||![];this[_0xeae8('0xf')]=_0x27545b[_0xeae8('0xf')]||![];this[_0xeae8('0x10')]=_0x27545b[_0xeae8('0x10')]||![];this[_0xeae8('0x11')]=_0xeae8('0x12');this[_0xeae8('0x13')]=0x0;this['chatCapacity']=_0x27545b[_0xeae8('0x14')]||0x0;this[_0xeae8('0x15')]=0x0;this[_0xeae8('0x16')]=_0xeae8('0x12');this[_0xeae8('0x17')]=0x0;this[_0xeae8('0x18')]=_0x27545b['mailCapacity']||0x0;this[_0xeae8('0x19')]=0x0;this[_0xeae8('0x1a')]=_0xeae8('0x12');this[_0xeae8('0x1b')]=0x0;this[_0xeae8('0x1c')]=_0x27545b[_0xeae8('0x1c')]||0x0;this[_0xeae8('0x1d')]=0x0;this['smsStatus']=_0xeae8('0x12');this[_0xeae8('0x1e')]=0x0;this[_0xeae8('0x1f')]=_0x27545b[_0xeae8('0x1f')]||0x0;this[_0xeae8('0x20')]=0x0;this[_0xeae8('0x21')]=_0xeae8('0x12');this['whatsappStatusTime']=0x0;this['whatsappCapacity']=_0x27545b['whatsappCapacity']||0x0;this[_0xeae8('0x22')]=0x0;this['openchannelStatus']='unknown';this[_0xeae8('0x23')]=0x0;this[_0xeae8('0x24')]=_0x27545b[_0xeae8('0x24')]||0x0;this[_0xeae8('0x25')]=0x0;this[_0xeae8('0x26')]=![];this[_0xeae8('0x27')]=undefined;this[_0xeae8('0x2')]='';this[_0xeae8('0x28')]();}Agent[_0xeae8('0x29')][_0xeae8('0x2a')]=function(_0x12424c){if(this[_0x12424c+'CurrentCapacity']>0x0){if(this[_0x12424c+_0xeae8('0x2b')]>0x0&&this[_0x12424c+_0xeae8('0x2c')]>=this[_0x12424c+_0xeae8('0x2b')]){return'maxcapacity';}else{return'working';}}else{return _0xeae8('0x2d');}};Agent[_0xeae8('0x29')][_0xeae8('0x28')]=function(){var _0x447956=[_0xeae8('0x2e'),_0xeae8('0x2f'),_0xeae8('0x30'),_0xeae8('0x31'),_0xeae8('0x32'),_0xeae8('0x33')];for(var _0x2c0f38=0x0;_0x2c0f38<_0x447956[_0xeae8('0x34')];_0x2c0f38+=0x1){var _0x509c77=this[_0xeae8('0x2a')](_0x447956[_0x2c0f38]);if(this[_0x447956[_0x2c0f38]+_0xeae8('0x35')]!==_0x509c77){this[_0x447956[_0x2c0f38]+_0xeae8('0x36')]=_[_0xeae8('0x37')](moment()[_0xeae8('0x38')]('x'));}this[_0x447956[_0x2c0f38]+_0xeae8('0x35')]=_0x509c77;}var _0x1388a7={'id':this['id'],'name':this['name'],'online':this[_0xeae8('0xa')],'voicePause':this['voicePause'],'chatPause':this[_0xeae8('0xc')],'mailPause':this[_0xeae8('0xd')],'smsPause':this[_0xeae8('0xf')],'faxPause':this[_0xeae8('0xe')],'openchannelPause':this[_0xeae8('0x10')],'chatStatus':this[_0xeae8('0x11')],'chatStatusTime':this[_0xeae8('0x13')],'chatCapacity':this[_0xeae8('0x14')],'chatCurrentCapacity':this[_0xeae8('0x15')],'mailStatus':this[_0xeae8('0x16')],'mailStatusTime':this[_0xeae8('0x17')],'mailCapacity':this[_0xeae8('0x18')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xeae8('0x1a')],'faxStatusTime':this[_0xeae8('0x1b')],'faxCapacity':this[_0xeae8('0x1c')],'faxCurrentCapacity':this[_0xeae8('0x1d')],'smsStatus':this[_0xeae8('0x39')],'smsStatusTime':this[_0xeae8('0x1e')],'smsCapacity':this[_0xeae8('0x1f')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xeae8('0x21')],'whatsappStatusTime':this[_0xeae8('0x3a')],'whatsappCapacity':this[_0xeae8('0x3b')],'whatsappCurrentCapacity':this[_0xeae8('0x22')],'openchannelStatus':this[_0xeae8('0x3c')],'openchannelStatusTime':this[_0xeae8('0x23')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xeae8('0x25')],'busy':this['busy'],'busyQueue':this[_0xeae8('0x27')]};var _0x4c38c0=md5(JSON['stringify'](_0x1388a7));if(this[_0xeae8('0x2')]!==_0x4c38c0){this[_0xeae8('0x2')]=_0x4c38c0;io['emit']('user:save',_0x1388a7);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index ef82afa..fa10004 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 _0x735b=['mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','length','online','chatPause','paused','available','name','stringify','format','chat:queue:%s','lodash','md5','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents'];(function(_0x395efb,_0x476dae){var _0x3766dd=function(_0x3a1b82){while(--_0x3a1b82){_0x395efb['push'](_0x395efb['shift']());}};_0x3766dd(++_0x476dae);}(_0x735b,0x12e));var _0xb735=function(_0x305f04,_0x2d8bae){_0x305f04=_0x305f04-0x0;var _0x4d3d0b=_0x735b[_0x305f04];return _0x4d3d0b;};'use strict';var _=require(_0xb735('0x0'));var md5=require(_0xb735('0x1'));var util=require('util');var Redis=require(_0xb735('0x2'));var config=require(_0xb735('0x3'));config[_0xb735('0x4')]=_['defaults'](config[_0xb735('0x4')],{'host':_0xb735('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb735('0x4')]));function ChatQueue(_0x5f4ab5){this['id']=_0x5f4ab5['id']||0x0;this['name']=_0x5f4ab5['name']||'';this[_0xb735('0x6')]=_0x5f4ab5[_0xb735('0x6')]||0xa;this[_0xb735('0x7')]=_0x5f4ab5[_0xb735('0x7')]||_0xb735('0x8');this['Agents']=_0x5f4ab5[_0xb735('0x9')];this[_0xb735('0xa')]={};this[_0xb735('0xb')]=0x0;this[_0xb735('0x1')]='';this[_0xb735('0xc')]();this[_0xb735('0xd')]();}ChatQueue[_0xb735('0xe')][_0xb735('0xc')]=function(){var _0x5b4d2e=this[_0xb735('0xa')]['_rr'];this[_0xb735('0xa')]=_['map'](this[_0xb735('0x9')],'id');this[_0xb735('0xa')][_0xb735('0xf')]=_0x5b4d2e;};ChatQueue[_0xb735('0xe')][_0xb735('0xd')]=function(){this[_0xb735('0x10')]=0x0;this['paused']=0x0;for(var _0x192f29=0x0;_0x192f29=0x0?this['available']:0x0;var _0x2022fa={'id':this['id'],'available':this[_0xb735('0x15')],'loggedIn':this[_0xb735('0x10')],'name':this[_0xb735('0x16')],'paused':this['paused'],'waiting':this[_0xb735('0xb')]};var _0x427ab2=md5(JSON[_0xb735('0x17')](_0x2022fa));if(this[_0xb735('0x1')]!==_0x427ab2){this[_0xb735('0x1')]=_0x427ab2;io['to'](util[_0xb735('0x18')](_0xb735('0x19'),_0x2022fa[_0xb735('0x16')]))['emit']('chat_queue:save',_0x2022fa);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x4578=['waiting','updateRouting','updateRealtime','prototype','_rr','map','paused','online','loggedIn','available','stringify','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x4578,0x126));var _0x8457=function(_0x2ea8c0,_0x211329){_0x2ea8c0=_0x2ea8c0-0x0;var _0x541f8d=_0x4578[_0x2ea8c0];return _0x541f8d;};'use strict';var _=require(_0x8457('0x0'));var md5=require(_0x8457('0x1'));var util=require(_0x8457('0x2'));var Redis=require(_0x8457('0x3'));var config=require(_0x8457('0x4'));config['redis']=_[_0x8457('0x5')](config[_0x8457('0x6')],{'host':_0x8457('0x7'),'port':0x18eb});var io=require(_0x8457('0x8'))(new Redis(config[_0x8457('0x6')]));function ChatQueue(_0x235ff6){this['id']=_0x235ff6['id']||0x0;this[_0x8457('0x9')]=_0x235ff6[_0x8457('0x9')]||'';this[_0x8457('0xa')]=_0x235ff6[_0x8457('0xa')]||0xa;this['strategy']=_0x235ff6[_0x8457('0xb')]||'beepall';this[_0x8457('0xc')]=_0x235ff6[_0x8457('0xc')];this[_0x8457('0xd')]={};this[_0x8457('0xe')]=0x0;this[_0x8457('0x1')]='';this[_0x8457('0xf')]();this[_0x8457('0x10')]();}ChatQueue[_0x8457('0x11')][_0x8457('0xf')]=function(){var _0xf07b8d=this[_0x8457('0xd')][_0x8457('0x12')];this['mapAgentsId']=_[_0x8457('0x13')](this[_0x8457('0xc')],'id');this[_0x8457('0xd')][_0x8457('0x12')]=_0xf07b8d;};ChatQueue[_0x8457('0x11')][_0x8457('0x10')]=function(){this['loggedIn']=0x0;this[_0x8457('0x14')]=0x0;for(var _0x1a6766=0x0;_0x1a6766=0x0?this[_0x8457('0x17')]:0x0;var _0x136970={'id':this['id'],'available':this[_0x8457('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x8457('0x9')],'paused':this[_0x8457('0x14')],'waiting':this['waiting']};var _0x2ef060=md5(JSON[_0x8457('0x18')](_0x136970));if(this[_0x8457('0x1')]!==_0x2ef060){this['md5']=_0x2ef060;io['to'](util['format']('chat:queue:%s',_0x136970['name']))[_0x8457('0x19')](_0x8457('0x1a'),_0x136970);}};module[_0x8457('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 49cd9bc..c6048d8 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(_0x464d83,_0x17252b){var _0x218af3=function(_0x217b0b){while(--_0x217b0b){_0x464d83['push'](_0x464d83['shift']());}};_0x218af3(++_0x17252b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0x192506,_0x46e516){var _0x5f05e4=function(_0x437149){while(--_0x437149){_0x192506['push'](_0x192506['shift']());}};_0x5f05e4(++_0x46e516);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 29abc3e..3740092 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 _0x22f0=['exports','name','Intervals'];(function(_0xf10840,_0xad3916){var _0x1fdf7e=function(_0x463be3){while(--_0x463be3){_0xf10840['push'](_0xf10840['shift']());}};_0x1fdf7e(++_0xad3916);}(_0x22f0,0xd9));var _0x022f=function(_0x538967,_0x464c86){_0x538967=_0x538967-0x0;var _0x30bc9b=_0x22f0[_0x538967];return _0x30bc9b;};'use strict';function Interval(_0x8bbb86){this['id']=_0x8bbb86['id']||0x0;this['name']=_0x8bbb86[_0x022f('0x0')]||'';this[_0x022f('0x1')]=_0x8bbb86['Intervals']||{};}module[_0x022f('0x2')]=Interval; \ No newline at end of file +var _0xab54=['exports','name','Intervals'];(function(_0x27cd3a,_0x1b2cfe){var _0x22ba1d=function(_0x177f80){while(--_0x177f80){_0x27cd3a['push'](_0x27cd3a['shift']());}};_0x22ba1d(++_0x1b2cfe);}(_0xab54,0x115));var _0x4ab5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xab54[_0x14add3];return _0x4a174f;};'use strict';function Interval(_0x12bbf2){this['id']=_0x12bbf2['id']||0x0;this[_0x4ab5('0x0')]=_0x12bbf2[_0x4ab5('0x0')]||'';this[_0x4ab5('0x1')]=_0x12bbf2[_0x4ab5('0x1')]||{};}module[_0x4ab5('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 75b419f..243473a 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 _0xb2e6=['ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','length','online','mailPause','available','stringify','format','mail:queue:%s','emit','lodash','md5'];(function(_0x61aed4,_0x1d7894){var _0x10e5e3=function(_0x558c0b){while(--_0x558c0b){_0x61aed4['push'](_0x61aed4['shift']());}};_0x10e5e3(++_0x1d7894);}(_0xb2e6,0x1da));var _0x6b2e=function(_0x461ca5,_0x42954b){_0x461ca5=_0x461ca5-0x0;var _0xd9b668=_0xb2e6[_0x461ca5];return _0xd9b668;};'use strict';var _=require(_0x6b2e('0x0'));var md5=require(_0x6b2e('0x1'));var util=require('util');var Redis=require(_0x6b2e('0x2'));var config=require(_0x6b2e('0x3'));config[_0x6b2e('0x4')]=_[_0x6b2e('0x5')](config[_0x6b2e('0x4')],{'host':_0x6b2e('0x6'),'port':0x18eb});var io=require(_0x6b2e('0x7'))(new Redis(config[_0x6b2e('0x4')]));function MailQueue(_0x38e8ca){this['id']=_0x38e8ca['id']||0x0;this[_0x6b2e('0x8')]=_0x38e8ca[_0x6b2e('0x8')]||'';this[_0x6b2e('0x9')]=_0x38e8ca[_0x6b2e('0x9')]||0xa;this[_0x6b2e('0xa')]=_0x38e8ca[_0x6b2e('0xa')]||'beepall';this['Agents']=_0x38e8ca[_0x6b2e('0xb')];this[_0x6b2e('0xc')]={};this[_0x6b2e('0xd')]=0x0;this[_0x6b2e('0x1')]='';this[_0x6b2e('0xe')]();this['updateRealtime']();}MailQueue[_0x6b2e('0xf')][_0x6b2e('0xe')]=function(){var _0x43c0f2=this['mapAgentsId'][_0x6b2e('0x10')];this[_0x6b2e('0xc')]=_['map'](this[_0x6b2e('0xb')],'id');this['mapAgentsId'][_0x6b2e('0x10')]=_0x43c0f2;};MailQueue[_0x6b2e('0xf')][_0x6b2e('0x11')]=function(){this[_0x6b2e('0x12')]=0x0;this[_0x6b2e('0x13')]=0x0;for(var _0x40cdf1=0x0;_0x40cdf1=0x0?this[_0x6b2e('0x17')]:0x0;var _0xa77917={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x6b2e('0x8')],'paused':this[_0x6b2e('0x13')],'waiting':this[_0x6b2e('0xd')]};var _0xb19bfb=md5(JSON[_0x6b2e('0x18')](_0xa77917));if(this[_0x6b2e('0x1')]!==_0xb19bfb){this[_0x6b2e('0x1')]=_0xb19bfb;io['to'](util[_0x6b2e('0x19')](_0x6b2e('0x1a'),_0xa77917[_0x6b2e('0x8')]))[_0x6b2e('0x1b')]('mail_queue:save',_0xa77917);}};module['exports']=MailQueue; \ No newline at end of file +var _0x2630=['updateRouting','updateRealtime','_rr','loggedIn','paused','length','online','available','stringify','format','mail:queue:%s','mail_queue:save','exports','lodash','md5','util','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x17ab43,_0x1d6bff){var _0x40189e=function(_0x2b7d2a){while(--_0x2b7d2a){_0x17ab43['push'](_0x17ab43['shift']());}};_0x40189e(++_0x1d6bff);}(_0x2630,0x79));var _0x0263=function(_0x48d052,_0x542bcf){_0x48d052=_0x48d052-0x0;var _0x4795f4=_0x2630[_0x48d052];return _0x4795f4;};'use strict';var _=require(_0x0263('0x0'));var md5=require(_0x0263('0x1'));var util=require(_0x0263('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0263('0x3')]=_[_0x0263('0x4')](config[_0x0263('0x3')],{'host':_0x0263('0x5'),'port':0x18eb});var io=require(_0x0263('0x6'))(new Redis(config[_0x0263('0x3')]));function MailQueue(_0x5502b4){this['id']=_0x5502b4['id']||0x0;this[_0x0263('0x7')]=_0x5502b4[_0x0263('0x7')]||'';this['timeout']=_0x5502b4[_0x0263('0x8')]||0xa;this[_0x0263('0x9')]=_0x5502b4[_0x0263('0x9')]||_0x0263('0xa');this[_0x0263('0xb')]=_0x5502b4['Agents'];this[_0x0263('0xc')]={};this[_0x0263('0xd')]=0x0;this[_0x0263('0x1')]='';this[_0x0263('0xe')]();this[_0x0263('0xf')]();}MailQueue['prototype'][_0x0263('0xe')]=function(){var _0x545588=this[_0x0263('0xc')][_0x0263('0x10')];this[_0x0263('0xc')]=_['map'](this[_0x0263('0xb')],'id');this['mapAgentsId'][_0x0263('0x10')]=_0x545588;};MailQueue['prototype'][_0x0263('0xf')]=function(){this[_0x0263('0x11')]=0x0;this[_0x0263('0x12')]=0x0;for(var _0x42efd5=0x0;_0x42efd5=0x0?this['available']:0x0;var _0x22cd32={'id':this['id'],'available':this['available'],'loggedIn':this[_0x0263('0x11')],'name':this['name'],'paused':this[_0x0263('0x12')],'waiting':this['waiting']};var _0x5dbd50=md5(JSON[_0x0263('0x16')](_0x22cd32));if(this[_0x0263('0x1')]!==_0x5dbd50){this[_0x0263('0x1')]=_0x5dbd50;io['to'](util[_0x0263('0x17')](_0x0263('0x18'),_0x22cd32[_0x0263('0x7')]))['emit'](_0x0263('0x19'),_0x22cd32);}};module[_0x0263('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index be26e17..658ce7c 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 _0x9a63=['online','openchannelPause','paused','available','stringify','openchannel:queue:%s','emit','openchannel_queue:save','lodash','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','length'];(function(_0x2b1677,_0x3491d1){var _0x1be690=function(_0x547b27){while(--_0x547b27){_0x2b1677['push'](_0x2b1677['shift']());}};_0x1be690(++_0x3491d1);}(_0x9a63,0x164));var _0x39a6=function(_0x2b91c5,_0x3b6db5){_0x2b91c5=_0x2b91c5-0x0;var _0xbd5531=_0x9a63[_0x2b91c5];return _0xbd5531;};'use strict';var _=require(_0x39a6('0x0'));var md5=require('md5');var util=require(_0x39a6('0x1'));var Redis=require(_0x39a6('0x2'));var config=require(_0x39a6('0x3'));config[_0x39a6('0x4')]=_[_0x39a6('0x5')](config[_0x39a6('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x39a6('0x6'))(new Redis(config[_0x39a6('0x4')]));function OpenchannelQueue(_0x41e1f0){this['id']=_0x41e1f0['id']||0x0;this[_0x39a6('0x7')]=_0x41e1f0['name']||'';this[_0x39a6('0x8')]=_0x41e1f0[_0x39a6('0x8')]||0xa;this[_0x39a6('0x9')]=_0x41e1f0['strategy']||'beepall';this[_0x39a6('0xa')]=_0x41e1f0[_0x39a6('0xa')];this[_0x39a6('0xb')]={};this[_0x39a6('0xc')]=0x0;this[_0x39a6('0xd')]='';this[_0x39a6('0xe')]();this[_0x39a6('0xf')]();}OpenchannelQueue['prototype'][_0x39a6('0xe')]=function(){var _0x4e9c09=this[_0x39a6('0xb')]['_rr'];this[_0x39a6('0xb')]=_[_0x39a6('0x10')](this[_0x39a6('0xa')],'id');this[_0x39a6('0xb')][_0x39a6('0x11')]=_0x4e9c09;};OpenchannelQueue[_0x39a6('0x12')][_0x39a6('0xf')]=function(){this[_0x39a6('0x13')]=0x0;this['paused']=0x0;for(var _0x39d6d7=0x0;_0x39d6d7=0x0?this['available']:0x0;var _0x39243e={'id':this['id'],'available':this[_0x39a6('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x39a6('0x7')],'paused':this[_0x39a6('0x17')],'waiting':this[_0x39a6('0xc')]};var _0x141b93=md5(JSON[_0x39a6('0x19')](_0x39243e));if(this['md5']!==_0x141b93){this['md5']=_0x141b93;io['to'](util['format'](_0x39a6('0x1a'),_0x39243e[_0x39a6('0x7')]))[_0x39a6('0x1b')](_0x39a6('0x1c'),_0x39243e);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x4188=['online','openchannelPause','available','format','openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length'];(function(_0x146cb9,_0x349d0b){var _0x2dbc9a=function(_0x2917ac){while(--_0x2917ac){_0x146cb9['push'](_0x146cb9['shift']());}};_0x2dbc9a(++_0x349d0b);}(_0x4188,0x19b));var _0x8418=function(_0x20ea4f,_0x1ccbbb){_0x20ea4f=_0x20ea4f-0x0;var _0x402cdd=_0x4188[_0x20ea4f];return _0x402cdd;};'use strict';var _=require(_0x8418('0x0'));var md5=require(_0x8418('0x1'));var util=require(_0x8418('0x2'));var Redis=require(_0x8418('0x3'));var config=require(_0x8418('0x4'));config[_0x8418('0x5')]=_[_0x8418('0x6')](config[_0x8418('0x5')],{'host':_0x8418('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8418('0x5')]));function OpenchannelQueue(_0xe58dbe){this['id']=_0xe58dbe['id']||0x0;this[_0x8418('0x8')]=_0xe58dbe[_0x8418('0x8')]||'';this['timeout']=_0xe58dbe[_0x8418('0x9')]||0xa;this[_0x8418('0xa')]=_0xe58dbe[_0x8418('0xa')]||_0x8418('0xb');this[_0x8418('0xc')]=_0xe58dbe['Agents'];this[_0x8418('0xd')]={};this[_0x8418('0xe')]=0x0;this[_0x8418('0x1')]='';this['updateRouting']();this[_0x8418('0xf')]();}OpenchannelQueue[_0x8418('0x10')][_0x8418('0x11')]=function(){var _0x53e022=this[_0x8418('0xd')][_0x8418('0x12')];this[_0x8418('0xd')]=_[_0x8418('0x13')](this[_0x8418('0xc')],'id');this[_0x8418('0xd')][_0x8418('0x12')]=_0x53e022;};OpenchannelQueue[_0x8418('0x10')]['updateRealtime']=function(){this[_0x8418('0x14')]=0x0;this[_0x8418('0x15')]=0x0;for(var _0xcc1f2a=0x0;_0xcc1f2a=0x0?this['available']:0x0;var _0x458926={'id':this['id'],'available':this[_0x8418('0x19')],'loggedIn':this[_0x8418('0x14')],'name':this[_0x8418('0x8')],'paused':this['paused'],'waiting':this[_0x8418('0xe')]};var _0x55a244=md5(JSON['stringify'](_0x458926));if(this[_0x8418('0x1')]!==_0x55a244){this[_0x8418('0x1')]=_0x55a244;io['to'](util[_0x8418('0x1a')](_0x8418('0x1b'),_0x458926[_0x8418('0x8')]))[_0x8418('0x1c')](_0x8418('0x1d'),_0x458926);}};module[_0x8418('0x1e')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 40f4c1b..6a3f75d 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 _0xbaf0=['online','paused','available','format','sms:queue:%s','emit','sms_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','length'];(function(_0xac0de1,_0x12d3d9){var _0x1c1995=function(_0x3f96e8){while(--_0x3f96e8){_0xac0de1['push'](_0xac0de1['shift']());}};_0x1c1995(++_0x12d3d9);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var md5=require(_0x0baf('0x0'));var util=require(_0x0baf('0x1'));var Redis=require(_0x0baf('0x2'));var config=require(_0x0baf('0x3'));config[_0x0baf('0x4')]=_[_0x0baf('0x5')](config['redis'],{'host':_0x0baf('0x6'),'port':0x18eb});var io=require(_0x0baf('0x7'))(new Redis(config[_0x0baf('0x4')]));function SmsQueue(_0x39b8f3){this['id']=_0x39b8f3['id']||0x0;this[_0x0baf('0x8')]=_0x39b8f3[_0x0baf('0x8')]||'';this[_0x0baf('0x9')]=_0x39b8f3[_0x0baf('0x9')]||0xa;this[_0x0baf('0xa')]=_0x39b8f3['strategy']||_0x0baf('0xb');this['Agents']=_0x39b8f3[_0x0baf('0xc')];this[_0x0baf('0xd')]={};this[_0x0baf('0xe')]=0x0;this[_0x0baf('0x0')]='';this[_0x0baf('0xf')]();this[_0x0baf('0x10')]();}SmsQueue[_0x0baf('0x11')][_0x0baf('0xf')]=function(){var _0x1fc6b2=this[_0x0baf('0xd')][_0x0baf('0x12')];this['mapAgentsId']=_['map'](this[_0x0baf('0xc')],'id');this[_0x0baf('0xd')][_0x0baf('0x12')]=_0x1fc6b2;};SmsQueue[_0x0baf('0x11')]['updateRealtime']=function(){this[_0x0baf('0x13')]=0x0;this['paused']=0x0;for(var _0x1c76a8=0x0;_0x1c76a8=0x0?this['available']:0x0;var _0x63c820={'id':this['id'],'available':this[_0x0baf('0x17')],'loggedIn':this[_0x0baf('0x13')],'name':this[_0x0baf('0x8')],'paused':this[_0x0baf('0x16')],'waiting':this[_0x0baf('0xe')]};var _0x4ff793=md5(JSON['stringify'](_0x63c820));if(this[_0x0baf('0x0')]!==_0x4ff793){this[_0x0baf('0x0')]=_0x4ff793;io['to'](util[_0x0baf('0x18')](_0x0baf('0x19'),_0x63c820[_0x0baf('0x8')]))[_0x0baf('0x1a')](_0x0baf('0x1b'),_0x63c820);}};module[_0x0baf('0x1c')]=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(_0x1988f4,_0x4aad14){var _0x5d5a75=function(_0x3c3240){while(--_0x3c3240){_0x1988f4['push'](_0x1988f4['shift']());}};_0x5d5a75(++_0x4aad14);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'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 b9ffd42..22010c1 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 _0x0f73=['../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','paused','length','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util'];(function(_0x207114,_0x25902e){var _0x14d3b4=function(_0x4f8fe3){while(--_0x4f8fe3){_0x207114['push'](_0x207114['shift']());}};_0x14d3b4(++_0x25902e);}(_0x0f73,0x135));var _0x30f7=function(_0x17bf02,_0xb7217f){_0x17bf02=_0x17bf02-0x0;var _0x40e075=_0x0f73[_0x17bf02];return _0x40e075;};'use strict';var _=require(_0x30f7('0x0'));var md5=require(_0x30f7('0x1'));var util=require(_0x30f7('0x2'));var Redis=require('ioredis');var config=require(_0x30f7('0x3'));config[_0x30f7('0x4')]=_[_0x30f7('0x5')](config['redis'],{'host':_0x30f7('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x30f7('0x4')]));function WhatsappQueue(_0x37f63c){this['id']=_0x37f63c['id']||0x0;this['name']=_0x37f63c[_0x30f7('0x7')]||'';this[_0x30f7('0x8')]=_0x37f63c[_0x30f7('0x8')]||0xa;this['strategy']=_0x37f63c[_0x30f7('0x9')]||'beepall';this['Agents']=_0x37f63c[_0x30f7('0xa')];this[_0x30f7('0xb')]={};this[_0x30f7('0xc')]=0x0;this['md5']='';this[_0x30f7('0xd')]();this[_0x30f7('0xe')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0xd93a0e=this[_0x30f7('0xb')][_0x30f7('0xf')];this['mapAgentsId']=_[_0x30f7('0x10')](this[_0x30f7('0xa')],'id');this[_0x30f7('0xb')]['_rr']=_0xd93a0e;};WhatsappQueue[_0x30f7('0x11')][_0x30f7('0xe')]=function(){this['loggedIn']=0x0;this[_0x30f7('0x12')]=0x0;for(var _0x2963e9=0x0;_0x2963e9=0x0?this[_0x30f7('0x14')]:0x0;var _0xefad28={'id':this['id'],'available':this[_0x30f7('0x14')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x30f7('0x12')],'waiting':this[_0x30f7('0xc')]};var _0x4f628a=md5(JSON['stringify'](_0xefad28));if(this['md5']!==_0x4f628a){this[_0x30f7('0x1')]=_0x4f628a;io['to'](util[_0x30f7('0x15')](_0x30f7('0x16'),_0xefad28[_0x30f7('0x7')]))[_0x30f7('0x17')](_0x30f7('0x18'),_0xefad28);}};module[_0x30f7('0x19')]=WhatsappQueue; \ No newline at end of file +var _0x3123=['timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','loggedIn','paused','length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','defaults','redis','localhost','socket.io-emitter','name'];(function(_0x280ae7,_0x456fb1){var _0x418b9e=function(_0x4d730d){while(--_0x4d730d){_0x280ae7['push'](_0x280ae7['shift']());}};_0x418b9e(++_0x456fb1);}(_0x3123,0xb7));var _0x3312=function(_0x116773,_0x2e5b1e){_0x116773=_0x116773-0x0;var _0x3bf660=_0x3123[_0x116773];return _0x3bf660;};'use strict';var _=require(_0x3312('0x0'));var md5=require(_0x3312('0x1'));var util=require(_0x3312('0x2'));var Redis=require(_0x3312('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x3312('0x4')](config[_0x3312('0x5')],{'host':_0x3312('0x6'),'port':0x18eb});var io=require(_0x3312('0x7'))(new Redis(config[_0x3312('0x5')]));function WhatsappQueue(_0x4b87ce){this['id']=_0x4b87ce['id']||0x0;this[_0x3312('0x8')]=_0x4b87ce['name']||'';this[_0x3312('0x9')]=_0x4b87ce[_0x3312('0x9')]||0xa;this[_0x3312('0xa')]=_0x4b87ce[_0x3312('0xa')]||_0x3312('0xb');this['Agents']=_0x4b87ce[_0x3312('0xc')];this['mapAgentsId']={};this[_0x3312('0xd')]=0x0;this[_0x3312('0x1')]='';this[_0x3312('0xe')]();this[_0x3312('0xf')]();}WhatsappQueue[_0x3312('0x10')][_0x3312('0xe')]=function(){var _0x4e4d89=this['mapAgentsId'][_0x3312('0x11')];this[_0x3312('0x12')]=_[_0x3312('0x13')](this[_0x3312('0xc')],'id');this[_0x3312('0x12')][_0x3312('0x11')]=_0x4e4d89;};WhatsappQueue[_0x3312('0x10')][_0x3312('0xf')]=function(){this[_0x3312('0x14')]=0x0;this[_0x3312('0x15')]=0x0;for(var _0x3abb58=0x0;_0x3abb58=0x0?this[_0x3312('0x19')]:0x0;var _0x296fa5={'id':this['id'],'available':this['available'],'loggedIn':this[_0x3312('0x14')],'name':this[_0x3312('0x8')],'paused':this['paused'],'waiting':this[_0x3312('0xd')]};var _0x49672f=md5(JSON[_0x3312('0x1a')](_0x296fa5));if(this[_0x3312('0x1')]!==_0x49672f){this['md5']=_0x49672f;io['to'](util[_0x3312('0x1b')](_0x3312('0x1c'),_0x296fa5['name']))[_0x3312('0x1d')](_0x3312('0x1e'),_0x296fa5);}};module[_0x3312('0x1f')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 8c9a992..566853a 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 _0xa41a=['../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','agents','intervals','smsQueues','mailQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','openchannelQueues','initChatQueues','chatQueues','initSmsQueues','updateRouting','updateRealtime','initFaxQueues','faxQueues','bluebird','util','moment','../model/agent'];(function(_0x1dc3fe,_0x4bf30c){var _0x3507e5=function(_0x22d3cf){while(--_0x22d3cf){_0x1dc3fe['push'](_0x1dc3fe['shift']());}};_0x3507e5(++_0x4bf30c);}(_0xa41a,0x6b));var _0xaa41=function(_0x4191ee,_0x3fc07d){_0x4191ee=_0x4191ee-0x0;var _0x1037e1=_0xa41a[_0x4191ee];return _0x1037e1;};'use strict';var BPromise=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var _=require('lodash');var moment=require(_0xaa41('0x2'));var Agent=require(_0xaa41('0x3'));var Interval=require(_0xaa41('0x4'));var OpenchannelQueue=require(_0xaa41('0x5'));var ChatQueue=require(_0xaa41('0x6'));var SmsQueue=require(_0xaa41('0x7'));var MailQueue=require(_0xaa41('0x8'));var FaxQueue=require(_0xaa41('0x9'));var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this[_0xaa41('0xa')]={};this[_0xaa41('0xb')]={};this['openchannelQueues']={};this['chatQueues']={};this[_0xaa41('0xc')]={};this[_0xaa41('0xd')]={};this['faxQueues']={};this[_0xaa41('0xe')]={};this[_0xaa41('0xf')]={};this[_0xaa41('0x10')]={};this[_0xaa41('0x11')]={};this[_0xaa41('0x12')]={};this[_0xaa41('0x13')]={};this[_0xaa41('0x14')]={};};function freeIsNotKey(_0x423a19,_0x1c291e,_0x5c9fc7){var _0x1d3aac=_[_0xaa41('0x15')](_0x423a19,function(_0x524cab,_0x54827c){return _0x524cab[_0x5c9fc7];});for(var _0x1d0a54 in _0x1c291e){if(_0x1c291e['hasOwnProperty'](_0x1d0a54)){if(!_0x1d3aac[_0x1d0a54]){delete _0x1c291e[_0x1d0a54];}}}}Realtime[_0xaa41('0x16')][_0xaa41('0x17')]=function(_0x2f64bc,_0x889d44){for(var _0x6f9ade in _0x889d44){if(_0x2f64bc['hasOwnProperty'](_0x6f9ade)){_0x2f64bc[_0x6f9ade]=_0x889d44[_0x6f9ade];}}};Realtime[_0xaa41('0x16')][_0xaa41('0x18')]=function(){var _0x1934e9=this;return function(_0x1ef7d9){if(_0x1ef7d9){freeIsNotKey(_0x1ef7d9,_0x1934e9[_0xaa41('0xa')],'id');for(var _0x2005ae=0x0,_0x1e1e02={},_0x550ad5={};_0x2005ae<_0x1ef7d9[_0xaa41('0x19')];_0x2005ae+=0x1){_0x1e1e02=_0x1ef7d9[_0x2005ae];if(_[_0xaa41('0x1a')](_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']])){_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']]=new Agent(_0x1e1e02);}else{_0x1934e9[_0xaa41('0x17')](_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']],_0x1e1e02);}}}return _0x1934e9[_0xaa41('0xa')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1b')]=function(){var _0x4fe1a4=this;return function(_0x5cd936){if(_0x5cd936){freeIsNotKey(_0x5cd936,_0x4fe1a4[_0xaa41('0xb')],'id');for(var _0x22de55=0x0,_0x35c753={},_0x54c488={};_0x22de55<_0x5cd936[_0xaa41('0x19')];_0x22de55+=0x1){_0x35c753=_0x5cd936[_0x22de55];if(_[_0xaa41('0x1a')](_0x4fe1a4['intervals'][_0x35c753['id']])){_0x4fe1a4['intervals'][_0x35c753['id']]=new Interval(_0x35c753);}else{_0x4fe1a4[_0xaa41('0x17')](_0x4fe1a4['intervals'][_0x35c753['id']],_0x35c753);}}}return _0x4fe1a4[_0xaa41('0xb')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1c')]=function(){var _0x1f27f3=this;return function(_0x1d623c){if(_0x1d623c){freeIsNotKey(_0x1d623c,_0x1f27f3['openchannelQueues'],'id');for(var _0x43c430=0x0,_0x43a85c={},_0x448a21={};_0x43c430<_0x1d623c[_0xaa41('0x19')];_0x43c430+=0x1){_0x43a85c=_0x1d623c[_0x43c430];if(_[_0xaa41('0x1a')](_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']])){_0x1f27f3['openchannelQueues'][_0x43a85c['id']]=new OpenchannelQueue(_0x43a85c);}else{_0x1f27f3['mergeFromDatabase'](_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']],_0x43a85c);}_0x1f27f3['openchannelQueues'][_0x43a85c['id']]['updateRouting']();_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']]['updateRealtime']();}}return _0x1f27f3['openchannelQueues'];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1e')]=function(){var _0x392214=this;return function(_0x632fd2){if(_0x632fd2){freeIsNotKey(_0x632fd2,_0x392214[_0xaa41('0x1f')],'id');for(var _0xa7269f=0x0,_0x57ef96={},_0x30a174={};_0xa7269f<_0x632fd2[_0xaa41('0x19')];_0xa7269f+=0x1){_0x57ef96=_0x632fd2[_0xa7269f];if(_[_0xaa41('0x1a')](_0x392214[_0xaa41('0x1f')][_0x57ef96['id']])){_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]=new ChatQueue(_0x57ef96);}else{_0x392214[_0xaa41('0x17')](_0x392214[_0xaa41('0x1f')][_0x57ef96['id']],_0x57ef96);}_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]['updateRouting']();_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]['updateRealtime']();}}return _0x392214['chatQueues'];};};Realtime[_0xaa41('0x16')][_0xaa41('0x20')]=function(){var _0x534a85=this;return function(_0x392b5d){if(_0x392b5d){freeIsNotKey(_0x392b5d,_0x534a85[_0xaa41('0xc')],'id');for(var _0x4e3b44=0x0,_0x5022fb={},_0x5c25fb={};_0x4e3b44<_0x392b5d[_0xaa41('0x19')];_0x4e3b44+=0x1){_0x5022fb=_0x392b5d[_0x4e3b44];if(_[_0xaa41('0x1a')](_0x534a85[_0xaa41('0xc')][_0x5022fb['id']])){_0x534a85[_0xaa41('0xc')][_0x5022fb['id']]=new SmsQueue(_0x5022fb);}else{_0x534a85['mergeFromDatabase'](_0x534a85[_0xaa41('0xc')][_0x5022fb['id']],_0x5022fb);}_0x534a85[_0xaa41('0xc')][_0x5022fb['id']][_0xaa41('0x21')]();_0x534a85['smsQueues'][_0x5022fb['id']][_0xaa41('0x22')]();}}return _0x534a85[_0xaa41('0xc')];};};Realtime[_0xaa41('0x16')]['initMailQueues']=function(){var _0x252c62=this;return function(_0x374117){if(_0x374117){freeIsNotKey(_0x374117,_0x252c62['mailQueues'],'id');for(var _0x23eb50=0x0,_0x13b6d4={},_0x2298ed={};_0x23eb50<_0x374117['length'];_0x23eb50+=0x1){_0x13b6d4=_0x374117[_0x23eb50];if(_[_0xaa41('0x1a')](_0x252c62['mailQueues'][_0x13b6d4['id']])){_0x252c62[_0xaa41('0xd')][_0x13b6d4['id']]=new MailQueue(_0x13b6d4);}else{_0x252c62[_0xaa41('0x17')](_0x252c62[_0xaa41('0xd')][_0x13b6d4['id']],_0x13b6d4);}_0x252c62['mailQueues'][_0x13b6d4['id']]['updateRouting']();_0x252c62['mailQueues'][_0x13b6d4['id']][_0xaa41('0x22')]();}}return _0x252c62[_0xaa41('0xd')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x23')]=function(){var _0x4fbb92=this;return function(_0x53a2e4){if(_0x53a2e4){freeIsNotKey(_0x53a2e4,_0x4fbb92[_0xaa41('0x24')],'id');for(var _0x5673c=0x0,_0x951e52={},_0x4e8d2e={};_0x5673c<_0x53a2e4[_0xaa41('0x19')];_0x5673c+=0x1){_0x951e52=_0x53a2e4[_0x5673c];if(_[_0xaa41('0x1a')](_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']])){_0x4fbb92['faxQueues'][_0x951e52['id']]=new FaxQueue(_0x951e52);}else{_0x4fbb92[_0xaa41('0x17')](_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']],_0x951e52);}_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']][_0xaa41('0x21')]();_0x4fbb92['faxQueues'][_0x951e52['id']]['updateRealtime']();}}return _0x4fbb92[_0xaa41('0x24')];};};Realtime[_0xaa41('0x16')]['initWhatsappQueues']=function(){var _0x4101ab=this;return function(_0x563687){if(_0x563687){freeIsNotKey(_0x563687,_0x4101ab[_0xaa41('0xe')],'id');for(var _0x25f2df=0x0,_0x1a2d11={},_0x466eee={};_0x25f2df<_0x563687[_0xaa41('0x19')];_0x25f2df+=0x1){_0x1a2d11=_0x563687[_0x25f2df];if(_[_0xaa41('0x1a')](_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']])){_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']]=new WhatsappQueue(_0x1a2d11);}else{_0x4101ab['mergeFromDatabase'](_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']],_0x1a2d11);}_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']][_0xaa41('0x21')]();_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']][_0xaa41('0x22')]();}}return _0x4101ab[_0xaa41('0xe')];};};module['exports']=Realtime; \ No newline at end of file +var _0x008c=['faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','mergeFromDatabase','updateRealtime','chatQueues','updateRouting','initSmsQueues','initMailQueues','mailQueues','initFaxQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','smsQueues'];(function(_0x573b2f,_0x406d51){var _0x2811a1=function(_0x356cb){while(--_0x356cb){_0x573b2f['push'](_0x573b2f['shift']());}};_0x2811a1(++_0x406d51);}(_0x008c,0x188));var _0xc008=function(_0x5c2d75,_0x4035fc){_0x5c2d75=_0x5c2d75-0x0;var _0x48f399=_0x008c[_0x5c2d75];return _0x48f399;};'use strict';var BPromise=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var _=require(_0xc008('0x2'));var moment=require(_0xc008('0x3'));var Agent=require(_0xc008('0x4'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xc008('0x5'));var ChatQueue=require(_0xc008('0x6'));var SmsQueue=require(_0xc008('0x7'));var MailQueue=require(_0xc008('0x8'));var FaxQueue=require(_0xc008('0x9'));var WhatsappQueue=require(_0xc008('0xa'));var Realtime=function(){this[_0xc008('0xb')]={};this[_0xc008('0xc')]={};this[_0xc008('0xd')]={};this['chatQueues']={};this[_0xc008('0xe')]={};this['mailQueues']={};this[_0xc008('0xf')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0xc008('0x10')]={};this[_0xc008('0x11')]={};this['smsQueuesWaitingInteractions']={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x1eacfa,_0xc881aa,_0x5b2004){var _0xae2dab=_[_0xc008('0x12')](_0x1eacfa,function(_0x2ea200,_0x2a5b4e){return _0x2ea200[_0x5b2004];});for(var _0x9ffa93 in _0xc881aa){if(_0xc881aa[_0xc008('0x13')](_0x9ffa93)){if(!_0xae2dab[_0x9ffa93]){delete _0xc881aa[_0x9ffa93];}}}}Realtime[_0xc008('0x14')]['mergeFromDatabase']=function(_0x560e28,_0x33f44c){for(var _0x50c1ab in _0x33f44c){if(_0x560e28[_0xc008('0x13')](_0x50c1ab)){_0x560e28[_0x50c1ab]=_0x33f44c[_0x50c1ab];}}};Realtime[_0xc008('0x14')][_0xc008('0x15')]=function(){var _0x339ffc=this;return function(_0x3f0ecf){if(_0x3f0ecf){freeIsNotKey(_0x3f0ecf,_0x339ffc['agents'],'id');for(var _0x5e894e=0x0,_0x4bd0f4={},_0x11ef38={};_0x5e894e<_0x3f0ecf[_0xc008('0x16')];_0x5e894e+=0x1){_0x4bd0f4=_0x3f0ecf[_0x5e894e];if(_[_0xc008('0x17')](_0x339ffc[_0xc008('0xb')][_0x4bd0f4['id']])){_0x339ffc['agents'][_0x4bd0f4['id']]=new Agent(_0x4bd0f4);}else{_0x339ffc['mergeFromDatabase'](_0x339ffc['agents'][_0x4bd0f4['id']],_0x4bd0f4);}}}return _0x339ffc['agents'];};};Realtime[_0xc008('0x14')][_0xc008('0x18')]=function(){var _0x501137=this;return function(_0x813397){if(_0x813397){freeIsNotKey(_0x813397,_0x501137['intervals'],'id');for(var _0x4bd611=0x0,_0x543e5d={},_0x50261c={};_0x4bd611<_0x813397[_0xc008('0x16')];_0x4bd611+=0x1){_0x543e5d=_0x813397[_0x4bd611];if(_['isUndefined'](_0x501137['intervals'][_0x543e5d['id']])){_0x501137['intervals'][_0x543e5d['id']]=new Interval(_0x543e5d);}else{_0x501137['mergeFromDatabase'](_0x501137['intervals'][_0x543e5d['id']],_0x543e5d);}}}return _0x501137[_0xc008('0xc')];};};Realtime[_0xc008('0x14')][_0xc008('0x19')]=function(){var _0x415af3=this;return function(_0x11cc75){if(_0x11cc75){freeIsNotKey(_0x11cc75,_0x415af3[_0xc008('0xd')],'id');for(var _0x4f43e2=0x0,_0x459fd9={},_0x5c85f2={};_0x4f43e2<_0x11cc75['length'];_0x4f43e2+=0x1){_0x459fd9=_0x11cc75[_0x4f43e2];if(_[_0xc008('0x17')](_0x415af3[_0xc008('0xd')][_0x459fd9['id']])){_0x415af3[_0xc008('0xd')][_0x459fd9['id']]=new OpenchannelQueue(_0x459fd9);}else{_0x415af3[_0xc008('0x1a')](_0x415af3['openchannelQueues'][_0x459fd9['id']],_0x459fd9);}_0x415af3['openchannelQueues'][_0x459fd9['id']]['updateRouting']();_0x415af3[_0xc008('0xd')][_0x459fd9['id']][_0xc008('0x1b')]();}}return _0x415af3[_0xc008('0xd')];};};Realtime[_0xc008('0x14')]['initChatQueues']=function(){var _0x5e2aca=this;return function(_0x4fce9c){if(_0x4fce9c){freeIsNotKey(_0x4fce9c,_0x5e2aca['chatQueues'],'id');for(var _0x4caaf4=0x0,_0x3865c0={},_0x29ba43={};_0x4caaf4<_0x4fce9c[_0xc008('0x16')];_0x4caaf4+=0x1){_0x3865c0=_0x4fce9c[_0x4caaf4];if(_['isUndefined'](_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']])){_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']]=new ChatQueue(_0x3865c0);}else{_0x5e2aca[_0xc008('0x1a')](_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']],_0x3865c0);}_0x5e2aca['chatQueues'][_0x3865c0['id']][_0xc008('0x1d')]();_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']]['updateRealtime']();}}return _0x5e2aca['chatQueues'];};};Realtime['prototype'][_0xc008('0x1e')]=function(){var _0x267abd=this;return function(_0xf831f2){if(_0xf831f2){freeIsNotKey(_0xf831f2,_0x267abd[_0xc008('0xe')],'id');for(var _0x1de04b=0x0,_0xceebc3={},_0x294f97={};_0x1de04b<_0xf831f2[_0xc008('0x16')];_0x1de04b+=0x1){_0xceebc3=_0xf831f2[_0x1de04b];if(_[_0xc008('0x17')](_0x267abd[_0xc008('0xe')][_0xceebc3['id']])){_0x267abd[_0xc008('0xe')][_0xceebc3['id']]=new SmsQueue(_0xceebc3);}else{_0x267abd[_0xc008('0x1a')](_0x267abd['smsQueues'][_0xceebc3['id']],_0xceebc3);}_0x267abd[_0xc008('0xe')][_0xceebc3['id']][_0xc008('0x1d')]();_0x267abd['smsQueues'][_0xceebc3['id']][_0xc008('0x1b')]();}}return _0x267abd[_0xc008('0xe')];};};Realtime[_0xc008('0x14')][_0xc008('0x1f')]=function(){var _0xd0e05a=this;return function(_0x3cd878){if(_0x3cd878){freeIsNotKey(_0x3cd878,_0xd0e05a[_0xc008('0x20')],'id');for(var _0x470e79=0x0,_0x29d4b3={},_0x4f14d2={};_0x470e79<_0x3cd878[_0xc008('0x16')];_0x470e79+=0x1){_0x29d4b3=_0x3cd878[_0x470e79];if(_[_0xc008('0x17')](_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']])){_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']]=new MailQueue(_0x29d4b3);}else{_0xd0e05a[_0xc008('0x1a')](_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']],_0x29d4b3);}_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']]['updateRouting']();_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']][_0xc008('0x1b')]();}}return _0xd0e05a['mailQueues'];};};Realtime[_0xc008('0x14')][_0xc008('0x21')]=function(){var _0x5e38d5=this;return function(_0x263473){if(_0x263473){freeIsNotKey(_0x263473,_0x5e38d5[_0xc008('0xf')],'id');for(var _0x280e9b=0x0,_0x55ff48={},_0x53b353={};_0x280e9b<_0x263473['length'];_0x280e9b+=0x1){_0x55ff48=_0x263473[_0x280e9b];if(_[_0xc008('0x17')](_0x5e38d5['faxQueues'][_0x55ff48['id']])){_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']]=new FaxQueue(_0x55ff48);}else{_0x5e38d5[_0xc008('0x1a')](_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']],_0x55ff48);}_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']][_0xc008('0x1d')]();_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']][_0xc008('0x1b')]();}}return _0x5e38d5[_0xc008('0xf')];};};Realtime[_0xc008('0x14')][_0xc008('0x22')]=function(){var _0x3ebb83=this;return function(_0xdfca2e){if(_0xdfca2e){freeIsNotKey(_0xdfca2e,_0x3ebb83[_0xc008('0x23')],'id');for(var _0x2bf3fd=0x0,_0x4cace5={},_0x3238b4={};_0x2bf3fd<_0xdfca2e[_0xc008('0x16')];_0x2bf3fd+=0x1){_0x4cace5=_0xdfca2e[_0x2bf3fd];if(_[_0xc008('0x17')](_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']])){_0x3ebb83['whatsappQueues'][_0x4cace5['id']]=new WhatsappQueue(_0x4cace5);}else{_0x3ebb83[_0xc008('0x1a')](_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']],_0x4cace5);}_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']][_0xc008('0x1d')]();_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']]['updateRealtime']();}}return _0x3ebb83[_0xc008('0x23')];};};module[_0xc008('0x24')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 6e9ea8e..30bcb7d 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 _0xc188=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x426c84,_0x1fe02a){var _0x155dd9=function(_0x2f04c6){while(--_0x2f04c6){_0x426c84['push'](_0x426c84['shift']());}};_0x155dd9(++_0x1fe02a);}(_0xc188,0x11a));var _0x8c18=function(_0x38e739,_0x3c2565){_0x38e739=_0x38e739-0x0;var _0x20fec9=_0xc188[_0x38e739];return _0x20fec9;};'use strict';var client=require(_0x8c18('0x0'));exports[_0x8c18('0x1')]=function(_0x2662e2,_0x2d1383){return client[_0x8c18('0x2')](_0x8c18('0x3'),{'body':_0x2d1383,'options':{'where':{'id':_0x2662e2}},'log':_0x8c18('0x4')});};exports[_0x8c18('0x5')]=function(_0x50868c,_0x1c2e44){return client[_0x8c18('0x2')](_0x8c18('0x6'),{'body':_0x1c2e44,'options':{'where':{'id':_0x50868c}},'log':_0x8c18('0x7')});}; \ No newline at end of file +var _0x1e5e=['addTags','addTagsToChatInteraction','update','Request'];(function(_0x26fd72,_0x5acd0d){var _0x488f26=function(_0x1b40fe){while(--_0x1b40fe){_0x26fd72['push'](_0x26fd72['shift']());}};_0x488f26(++_0x5acd0d);}(_0x1e5e,0xd2));var _0xe1e5=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x1e5e[_0x2235bf];return _0x4c3a64;};'use strict';var client=require('../client');exports[_0xe1e5('0x0')]=function(_0x664fb,_0x48ba7c){return client[_0xe1e5('0x1')]('UpdateChatInteraction',{'body':_0x48ba7c,'options':{'where':{'id':_0x664fb}},'log':'updateChatInteraction'});};exports[_0xe1e5('0x2')]=function(_0x4a21b0,_0x574cea){return client[_0xe1e5('0x1')]('AddTagsToChatInteraction',{'body':_0x574cea,'options':{'where':{'id':_0x4a21b0}},'log':_0xe1e5('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index fc59632..ba75815 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 _0x59ad=['create','Request','CreateChatMessage','createChatMessage'];(function(_0x5d1231,_0x476a7f){var _0x3f69b7=function(_0x3f4a49){while(--_0x3f4a49){_0x5d1231['push'](_0x5d1231['shift']());}};_0x3f69b7(++_0x476a7f);}(_0x59ad,0xd8));var _0xd59a=function(_0x4246bd,_0xdab764){_0x4246bd=_0x4246bd-0x0;var _0x20e0b7=_0x59ad[_0x4246bd];return _0x20e0b7;};'use strict';var client=require('../client');exports[_0xd59a('0x0')]=function(_0x129fbd){return client[_0xd59a('0x1')](_0xd59a('0x2'),{'body':_0x129fbd,'log':_0xd59a('0x3')});}; \ No newline at end of file +var _0x8a86=['createChatMessage','create','Request'];(function(_0x4c4863,_0x39ea81){var _0xd60839=function(_0x3a7e39){while(--_0x3a7e39){_0x4c4863['push'](_0x4c4863['shift']());}};_0xd60839(++_0x39ea81);}(_0x8a86,0x82));var _0x68a8=function(_0x3abe85,_0x319ed1){_0x3abe85=_0x3abe85-0x0;var _0x396508=_0x8a86[_0x3abe85];return _0x396508;};'use strict';var client=require('../client');exports[_0x68a8('0x0')]=function(_0x1b79de){return client[_0x68a8('0x1')]('CreateChatMessage',{'body':_0x1b79de,'log':_0x68a8('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index ed950ed..e837566 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 _0x4e0b=['chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout','strategy','User','Agents','online'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4e0b,0x9b));var _0xb4e0=function(_0x297f78,_0x1cb820){_0x297f78=_0x297f78-0x0;var _0x17250b=_0x4e0b[_0x297f78];return _0x17250b;};'use strict';var client=require(_0xb4e0('0x0'));exports[_0xb4e0('0x1')]=function(){return function(){return client[_0xb4e0('0x2')](_0xb4e0('0x3'),{'options':{'raw':![],'attributes':['id',_0xb4e0('0x4'),_0xb4e0('0x5'),_0xb4e0('0x6')],'include':[{'model':_0xb4e0('0x7'),'as':_0xb4e0('0x8'),'attributes':['id','name',_0xb4e0('0x9'),_0xb4e0('0xa')]}]},'log':_0xb4e0('0x1')});};}; \ No newline at end of file +var _0xa877=['name','timeout','strategy','User','Agents','chatPause','../client','getChatQueues','Request','GetChatQueue'];(function(_0x2acac9,_0xf96f59){var _0x2cc999=function(_0x12f604){while(--_0x12f604){_0x2acac9['push'](_0x2acac9['shift']());}};_0x2cc999(++_0xf96f59);}(_0xa877,0xe2));var _0x7a87=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xa877[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0x7a87('0x0'));exports[_0x7a87('0x1')]=function(){return function(){return client[_0x7a87('0x2')](_0x7a87('0x3'),{'options':{'raw':![],'attributes':['id',_0x7a87('0x4'),_0x7a87('0x5'),_0x7a87('0x6')],'include':[{'model':_0x7a87('0x7'),'as':_0x7a87('0x8'),'attributes':['id',_0x7a87('0x4'),'online',_0x7a87('0x9')]}]},'log':_0x7a87('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 34d2488..052e057 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 _0x12c9=['UpdateChatQueueReport','../client','create','Request','CreateChatQueueReport','update'];(function(_0x1c6751,_0x15d707){var _0xafa8c3=function(_0x24c120){while(--_0x24c120){_0x1c6751['push'](_0x1c6751['shift']());}};_0xafa8c3(++_0x15d707);}(_0x12c9,0x1c9));var _0x912c=function(_0x5890d6,_0x5648fe){_0x5890d6=_0x5890d6-0x0;var _0x54bdc6=_0x12c9[_0x5890d6];return _0x54bdc6;};'use strict';var client=require(_0x912c('0x0'));exports[_0x912c('0x1')]=function(_0x7a27c0){return client[_0x912c('0x2')](_0x912c('0x3'),{'body':_0x7a27c0,'log':'CreateChatQueueReport'});};exports[_0x912c('0x4')]=function(_0xcb7adc,_0x2c8059){return client[_0x912c('0x2')](_0x912c('0x5'),{'body':_0x2c8059,'options':{'where':{'uniqueid':_0xcb7adc},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x4bd1=['create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x26076a,_0xc485d8){var _0x4d1d0c=function(_0x1f2c52){while(--_0x1f2c52){_0x26076a['push'](_0x26076a['shift']());}};_0x4d1d0c(++_0xc485d8);}(_0x4bd1,0x90));var _0x14bd=function(_0x46a3ff,_0x470b9a){_0x46a3ff=_0x46a3ff-0x0;var _0x404bc2=_0x4bd1[_0x46a3ff];return _0x404bc2;};'use strict';var client=require('../client');exports[_0x14bd('0x0')]=function(_0x5ef5c7){return client[_0x14bd('0x1')](_0x14bd('0x2'),{'body':_0x5ef5c7,'log':'CreateChatQueueReport'});};exports[_0x14bd('0x3')]=function(_0x45948d,_0x51fcdb){return client[_0x14bd('0x1')](_0x14bd('0x4'),{'body':_0x51fcdb,'options':{'where':{'uniqueid':_0x45948d},'order':[['id',_0x14bd('0x5')]],'limit':0x1},'log':_0x14bd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index e96bc58..66a9f68 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 _0x5b7f=['../client','update','UpdateFaxInteraction','Request','AddTagsToFaxInteraction'];(function(_0x3ec485,_0x37cb44){var _0xa70abf=function(_0x21f249){while(--_0x21f249){_0x3ec485['push'](_0x3ec485['shift']());}};_0xa70abf(++_0x37cb44);}(_0x5b7f,0x181));var _0xf5b7=function(_0x57c52d,_0x3f4818){_0x57c52d=_0x57c52d-0x0;var _0x2c771f=_0x5b7f[_0x57c52d];return _0x2c771f;};'use strict';var client=require(_0xf5b7('0x0'));exports[_0xf5b7('0x1')]=function(_0x191fc9,_0x19678b){return client['Request'](_0xf5b7('0x2'),{'body':_0x19678b,'options':{'where':{'id':_0x191fc9}},'log':'updateFaxInteraction'});};exports['addTags']=function(_0x3cea42,_0x3f9a45){return client[_0xf5b7('0x3')](_0xf5b7('0x4'),{'body':_0x3f9a45,'options':{'where':{'id':_0x3cea42}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9764=['updateFaxInteraction','addTags','addTagsToFaxInteraction','../client','update','Request'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9764,0x1d7));var _0x4976=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9764[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x4976('0x0'));exports[_0x4976('0x1')]=function(_0x5571c2,_0xc3b867){return client[_0x4976('0x2')]('UpdateFaxInteraction',{'body':_0xc3b867,'options':{'where':{'id':_0x5571c2}},'log':_0x4976('0x3')});};exports[_0x4976('0x4')]=function(_0x4e05ac,_0x5eb49b){return client[_0x4976('0x2')]('AddTagsToFaxInteraction',{'body':_0x5eb49b,'options':{'where':{'id':_0x4e05ac}},'log':_0x4976('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index ab2a145..01332de 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 _0x271f=['Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x25b9a1,_0x3e141b){var _0x2dff67=function(_0x1d5279){while(--_0x1d5279){_0x25b9a1['push'](_0x25b9a1['shift']());}};_0x2dff67(++_0x3e141b);}(_0x271f,0xb3));var _0xf271=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x271f[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xf271('0x0'));exports['create']=function(_0xfc0087){return client[_0xf271('0x1')](_0xf271('0x2'),{'body':_0xfc0087,'log':_0xf271('0x3')});}; \ No newline at end of file +var _0x2a43=['../client','create','createFaxMessage'];(function(_0x4c7b5e,_0x4efbba){var _0x3f7e02=function(_0x1abf28){while(--_0x1abf28){_0x4c7b5e['push'](_0x4c7b5e['shift']());}};_0x3f7e02(++_0x4efbba);}(_0x2a43,0x96));var _0x32a4=function(_0x2ec50f,_0x5526b0){_0x2ec50f=_0x2ec50f-0x0;var _0x5323f5=_0x2a43[_0x2ec50f];return _0x5323f5;};'use strict';var client=require(_0x32a4('0x0'));exports[_0x32a4('0x1')]=function(_0x27bd2a){return client['Request']('CreateFaxMessage',{'body':_0x27bd2a,'log':_0x32a4('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index d5fa63a..b1cec39 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 _0xa414=['timeout','strategy','Agents','name','online','faxPause','getFaxQueues','Request','GetFaxQueue'];(function(_0x37efe0,_0x263b2f){var _0x47f700=function(_0x326978){while(--_0x326978){_0x37efe0['push'](_0x37efe0['shift']());}};_0x47f700(++_0x263b2f);}(_0xa414,0xde));var _0x4a41=function(_0x4ab1c6,_0x5e4ab4){_0x4ab1c6=_0x4ab1c6-0x0;var _0x455ea1=_0xa414[_0x4ab1c6];return _0x455ea1;};'use strict';var client=require('../client');exports[_0x4a41('0x0')]=function(){return function(){return client[_0x4a41('0x1')](_0x4a41('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x4a41('0x3'),_0x4a41('0x4')],'include':[{'model':'User','as':_0x4a41('0x5'),'attributes':['id',_0x4a41('0x6'),_0x4a41('0x7'),_0x4a41('0x8')]}]},'log':_0x4a41('0x0')});};}; \ No newline at end of file +var _0x0420=['online','faxPause','getFaxQueues','../client','Request','GetFaxQueue','name','timeout','strategy','User'];(function(_0x5a427c,_0x1c7b6f){var _0xc17e0d=function(_0x3b82a7){while(--_0x3b82a7){_0x5a427c['push'](_0x5a427c['shift']());}};_0xc17e0d(++_0x1c7b6f);}(_0x0420,0x1cf));var _0x0042=function(_0x2f90d0,_0x1d9ec1){_0x2f90d0=_0x2f90d0-0x0;var _0x25ed4b=_0x0420[_0x2f90d0];return _0x25ed4b;};'use strict';var client=require(_0x0042('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x0042('0x1')](_0x0042('0x2'),{'options':{'raw':![],'attributes':['id',_0x0042('0x3'),_0x0042('0x4'),_0x0042('0x5')],'include':[{'model':_0x0042('0x6'),'as':'Agents','attributes':['id',_0x0042('0x3'),_0x0042('0x7'),_0x0042('0x8')]}]},'log':_0x0042('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index f0418e1..248e5d2 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 _0x2157=['update','UpdateFaxQueueReport','DESC','../client','create','Request'];(function(_0x140e60,_0x1b27f1){var _0x18cded=function(_0x3aad4c){while(--_0x3aad4c){_0x140e60['push'](_0x140e60['shift']());}};_0x18cded(++_0x1b27f1);}(_0x2157,0x13b));var _0x7215=function(_0x1f5070,_0x5f0518){_0x1f5070=_0x1f5070-0x0;var _0x457c78=_0x2157[_0x1f5070];return _0x457c78;};'use strict';var client=require(_0x7215('0x0'));exports[_0x7215('0x1')]=function(_0x173d73){return client[_0x7215('0x2')]('CreateFaxQueueReport',{'body':_0x173d73,'log':'CreateFaxQueueReport'});};exports[_0x7215('0x3')]=function(_0x379e3d,_0x53f98b){return client[_0x7215('0x2')](_0x7215('0x4'),{'body':_0x53f98b,'options':{'where':{'uniqueid':_0x379e3d},'order':[['id',_0x7215('0x5')]],'limit':0x1},'log':_0x7215('0x4')});}; \ No newline at end of file +var _0x31f0=['update','Request','UpdateFaxQueueReport','../client','CreateFaxQueueReport'];(function(_0x103ac2,_0x474cb2){var _0x102fdb=function(_0x296650){while(--_0x296650){_0x103ac2['push'](_0x103ac2['shift']());}};_0x102fdb(++_0x474cb2);}(_0x31f0,0xb7));var _0x031f=function(_0x129e1e,_0x4367e6){_0x129e1e=_0x129e1e-0x0;var _0x3d3188=_0x31f0[_0x129e1e];return _0x3d3188;};'use strict';var client=require(_0x031f('0x0'));exports['create']=function(_0xc4ca54){return client['Request'](_0x031f('0x1'),{'body':_0xc4ca54,'log':_0x031f('0x1')});};exports[_0x031f('0x2')]=function(_0xf20620,_0x526a45){return client[_0x031f('0x3')](_0x031f('0x4'),{'body':_0x526a45,'options':{'where':{'uniqueid':_0xf20620},'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 a6b82e5..3dfa423 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 _0xb10b=['name','Intervals','interval','getIntervals','../client','Request','GetInterval'];(function(_0x3598bb,_0x24befa){var _0x13c837=function(_0x3de578){while(--_0x3de578){_0x3598bb['push'](_0x3598bb['shift']());}};_0x13c837(++_0x24befa);}(_0xb10b,0x12a));var _0xbb10=function(_0x52711f,_0x4cf48b){_0x52711f=_0x52711f-0x0;var _0x736442=_0xb10b[_0x52711f];return _0x736442;};'use strict';var client=require(_0xbb10('0x0'));exports['getIntervals']=function(){return function(){return client[_0xbb10('0x1')](_0xbb10('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xbb10('0x3')],'include':[{'model':'Interval','as':_0xbb10('0x4'),'attributes':['id',_0xbb10('0x3'),_0xbb10('0x5')]}]},'log':_0xbb10('0x6')});};}; \ No newline at end of file +var _0xa45c=['getIntervals','name','Intervals','interval','../client'];(function(_0x4fe506,_0x4cae2c){var _0xd46913=function(_0x391996){while(--_0x391996){_0x4fe506['push'](_0x4fe506['shift']());}};_0xd46913(++_0x4cae2c);}(_0xa45c,0x6d));var _0xca45=function(_0x10cec7,_0x471f01){_0x10cec7=_0x10cec7-0x0;var _0x56dac5=_0xa45c[_0x10cec7];return _0x56dac5;};'use strict';var client=require(_0xca45('0x0'));exports[_0xca45('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xca45('0x2')],'include':[{'model':'Interval','as':_0xca45('0x3'),'attributes':['id','name',_0xca45('0x4')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index ea8aa4d..5c2b6f6 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 _0x1274=['addTags','Request','AddTagsToMailInteraction','../client','update','UpdateMailInteraction','updateMailInteraction'];(function(_0x4fb377,_0x3210e3){var _0x592919=function(_0x5b61b5){while(--_0x5b61b5){_0x4fb377['push'](_0x4fb377['shift']());}};_0x592919(++_0x3210e3);}(_0x1274,0x18b));var _0x4127=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1274[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x4127('0x0'));exports[_0x4127('0x1')]=function(_0x32d1b2,_0x3f870d){return client['Request'](_0x4127('0x2'),{'body':_0x3f870d,'options':{'where':{'id':_0x32d1b2}},'log':_0x4127('0x3')});};exports[_0x4127('0x4')]=function(_0xa9f7dd,_0x1379cc){return client[_0x4127('0x5')](_0x4127('0x6'),{'body':_0x1379cc,'options':{'where':{'id':_0xa9f7dd}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x3a3a=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x27d167,_0x419140){var _0x49d849=function(_0xbac614){while(--_0xbac614){_0x27d167['push'](_0x27d167['shift']());}};_0x49d849(++_0x419140);}(_0x3a3a,0x9d));var _0xa3a3=function(_0x555835,_0x2ccc0b){_0x555835=_0x555835-0x0;var _0x577fe7=_0x3a3a[_0x555835];return _0x577fe7;};'use strict';var client=require(_0xa3a3('0x0'));exports['update']=function(_0x36a18e,_0x1fd4f7){return client[_0xa3a3('0x1')](_0xa3a3('0x2'),{'body':_0x1fd4f7,'options':{'where':{'id':_0x36a18e}},'log':_0xa3a3('0x3')});};exports[_0xa3a3('0x4')]=function(_0x20c044,_0xcc191c){return client[_0xa3a3('0x1')](_0xa3a3('0x5'),{'body':_0xcc191c,'options':{'where':{'id':_0x20c044}},'log':_0xa3a3('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 8252e69..d1e2172 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 _0x5068=['Request','CreateMailMessage','createMailMessage','../client','create'];(function(_0xfc70e6,_0xb4c897){var _0x5a0405=function(_0x501e6c){while(--_0x501e6c){_0xfc70e6['push'](_0xfc70e6['shift']());}};_0x5a0405(++_0xb4c897);}(_0x5068,0x1c0));var _0x8506=function(_0x4244fd,_0x16f4d9){_0x4244fd=_0x4244fd-0x0;var _0x1dd479=_0x5068[_0x4244fd];return _0x1dd479;};'use strict';var client=require(_0x8506('0x0'));exports[_0x8506('0x1')]=function(_0x429cf6){return client[_0x8506('0x2')](_0x8506('0x3'),{'body':_0x429cf6,'log':_0x8506('0x4')});}; \ No newline at end of file +var _0xefa3=['createMailMessage','create','Request','CreateMailMessage'];(function(_0x560448,_0x2c1082){var _0x550276=function(_0x37e949){while(--_0x37e949){_0x560448['push'](_0x560448['shift']());}};_0x550276(++_0x2c1082);}(_0xefa3,0x145));var _0x3efa=function(_0x4af01e,_0x543f5c){_0x4af01e=_0x4af01e-0x0;var _0x178c11=_0xefa3[_0x4af01e];return _0x178c11;};'use strict';var client=require('../client');exports[_0x3efa('0x0')]=function(_0x575c3b){return client[_0x3efa('0x1')](_0x3efa('0x2'),{'body':_0x575c3b,'log':_0x3efa('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index b026b67..2ebdc17 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 _0xa038=['online','mailPause','../client','getMailQueues','Request','GetMailQueue','name','strategy','User','Agents'];(function(_0x13d467,_0xbf18af){var _0x2d7438=function(_0x1dd54b){while(--_0x1dd54b){_0x13d467['push'](_0x13d467['shift']());}};_0x2d7438(++_0xbf18af);}(_0xa038,0x142));var _0x8a03=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0xa038[_0x725b8e];return _0x43ac45;};'use strict';var client=require(_0x8a03('0x0'));exports[_0x8a03('0x1')]=function(){return function(){return client[_0x8a03('0x2')](_0x8a03('0x3'),{'options':{'raw':![],'attributes':['id',_0x8a03('0x4'),'timeout',_0x8a03('0x5')],'include':[{'model':_0x8a03('0x6'),'as':_0x8a03('0x7'),'attributes':['id',_0x8a03('0x4'),_0x8a03('0x8'),_0x8a03('0x9')]}]},'log':_0x8a03('0x1')});};}; \ No newline at end of file +var _0x2784=['../client','getMailQueues','Request','strategy','Agents','name','online','mailPause'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2784,0x1e8));var _0x4278=function(_0x23ca3d,_0x534497){_0x23ca3d=_0x23ca3d-0x0;var _0x1aa13f=_0x2784[_0x23ca3d];return _0x1aa13f;};'use strict';var client=require(_0x4278('0x0'));exports[_0x4278('0x1')]=function(){return function(){return client[_0x4278('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0x4278('0x3')],'include':[{'model':'User','as':_0x4278('0x4'),'attributes':['id',_0x4278('0x5'),_0x4278('0x6'),_0x4278('0x7')]}]},'log':_0x4278('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 31607b7..7d912b0 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 _0x2dc2=['update','UpdateMailQueueReport','DESC','create','Request','CreateMailQueueReport'];(function(_0x22fff0,_0x1c5a2e){var _0x573c17=function(_0x193882){while(--_0x193882){_0x22fff0['push'](_0x22fff0['shift']());}};_0x573c17(++_0x1c5a2e);}(_0x2dc2,0x17d));var _0x22dc=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x2dc2[_0x220dbb];return _0x2b77de;};'use strict';var client=require('../client');exports[_0x22dc('0x0')]=function(_0x3ff2e4){return client[_0x22dc('0x1')](_0x22dc('0x2'),{'body':_0x3ff2e4,'log':'CreateMailQueueReport'});};exports[_0x22dc('0x3')]=function(_0xb4eff8,_0x2d3e47){return client['Request'](_0x22dc('0x4'),{'body':_0x2d3e47,'options':{'where':{'uniqueid':_0xb4eff8},'order':[['id',_0x22dc('0x5')]],'limit':0x1},'log':_0x22dc('0x4')});}; \ No newline at end of file +var _0x0707=['UpdateMailQueueReport','DESC','../client','CreateMailQueueReport','Request'];(function(_0x5e4b35,_0x4d0efd){var _0x220bde=function(_0xa4f167){while(--_0xa4f167){_0x5e4b35['push'](_0x5e4b35['shift']());}};_0x220bde(++_0x4d0efd);}(_0x0707,0xcf));var _0x7070=function(_0x3346fd,_0x1f54b4){_0x3346fd=_0x3346fd-0x0;var _0x11ecfb=_0x0707[_0x3346fd];return _0x11ecfb;};'use strict';var client=require(_0x7070('0x0'));exports['create']=function(_0x53c498){return client['Request'](_0x7070('0x1'),{'body':_0x53c498,'log':_0x7070('0x1')});};exports['update']=function(_0x4c3fa1,_0xc04a2){return client[_0x7070('0x2')](_0x7070('0x3'),{'body':_0xc04a2,'options':{'where':{'uniqueid':_0x4c3fa1},'order':[['id',_0x7070('0x4')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index d7ebff2..9734f97 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 _0xc240=['Request','UpdateOpenchannelInteraction','addTagsToChatInteraction','update'];(function(_0x2c1e7a,_0x155f86){var _0xcacb4f=function(_0x2b2eb3){while(--_0x2b2eb3){_0x2c1e7a['push'](_0x2c1e7a['shift']());}};_0xcacb4f(++_0x155f86);}(_0xc240,0x11f));var _0x0c24=function(_0x338229,_0x5880ab){_0x338229=_0x338229-0x0;var _0x38af9e=_0xc240[_0x338229];return _0x38af9e;};'use strict';var client=require('../client');exports[_0x0c24('0x0')]=function(_0x12d122,_0x1e03e7){return client[_0x0c24('0x1')](_0x0c24('0x2'),{'body':_0x1e03e7,'options':{'where':{'id':_0x12d122}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x3701d5,_0x18a1f3){return client[_0x0c24('0x1')]('AddTagsToOpenchannelInteraction',{'body':_0x18a1f3,'options':{'where':{'id':_0x3701d5}},'log':_0x0c24('0x3')});}; \ No newline at end of file +var _0x16e7=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTagsToChatInteraction','../client','update'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x16e7,0x17e));var _0x716e=function(_0x40a43b,_0x90656){_0x40a43b=_0x40a43b-0x0;var _0x19dd12=_0x16e7[_0x40a43b];return _0x19dd12;};'use strict';var client=require(_0x716e('0x0'));exports[_0x716e('0x1')]=function(_0x92e2a5,_0x409617){return client[_0x716e('0x2')](_0x716e('0x3'),{'body':_0x409617,'options':{'where':{'id':_0x92e2a5}},'log':_0x716e('0x4')});};exports['addTags']=function(_0x3c3178,_0x9188e3){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0x9188e3,'options':{'where':{'id':_0x3c3178}},'log':_0x716e('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 19d4e2e..c3467dd 100644 --- a/server/services/routing/rpc/openchannelMessage.js +++ b/server/services/routing/rpc/openchannelMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['createOpenchannelMessage','../client','create'];(function(_0x4aea3a,_0x3839f9){var _0x5a349e=function(_0x4d77c6){while(--_0x4d77c6){_0x4aea3a['push'](_0x4aea3a['shift']());}};_0x5a349e(++_0x3839f9);}(_0x70e0,0x17b));var _0x070e=function(_0xd9e8b5,_0x2940f2){_0xd9e8b5=_0xd9e8b5-0x0;var _0x45e8d6=_0x70e0[_0xd9e8b5];return _0x45e8d6;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateOpenchannelMessage',{'body':_0x198c2e,'log':_0x070e('0x2')});}; \ No newline at end of file +var _0xe5b3=['Request','CreateOpenchannelMessage','createOpenchannelMessage','create'];(function(_0x3e1829,_0xc8ccda){var _0x129345=function(_0x2357c0){while(--_0x2357c0){_0x3e1829['push'](_0x3e1829['shift']());}};_0x129345(++_0xc8ccda);}(_0xe5b3,0x133));var _0x3e5b=function(_0x476a0b,_0x23de02){_0x476a0b=_0x476a0b-0x0;var _0x5bc7e3=_0xe5b3[_0x476a0b];return _0x5bc7e3;};'use strict';var client=require('../client');exports[_0x3e5b('0x0')]=function(_0xba44a0){return client[_0x3e5b('0x1')](_0x3e5b('0x2'),{'body':_0xba44a0,'log':_0x3e5b('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 6dd79d3..faf0a34 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 _0xd608=['Request','GetOpenchannelQueue','timeout','strategy','User','name','online','openchannelPause','getOpenchannelQueues'];(function(_0x360e97,_0x2c8e2b){var _0x350314=function(_0x6d00bc){while(--_0x6d00bc){_0x360e97['push'](_0x360e97['shift']());}};_0x350314(++_0x2c8e2b);}(_0xd608,0x13b));var _0x8d60=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd608[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client[_0x8d60('0x0')](_0x8d60('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x8d60('0x2'),_0x8d60('0x3')],'include':[{'model':_0x8d60('0x4'),'as':'Agents','attributes':['id',_0x8d60('0x5'),_0x8d60('0x6'),_0x8d60('0x7')]}]},'log':_0x8d60('0x8')});};}; \ No newline at end of file +var _0xddf8=['../client','getOpenchannelQueues','Request','name','timeout','strategy','online','openchannelPause'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xddf8,0x1c8));var _0x8ddf=function(_0x846e4d,_0x237f32){_0x846e4d=_0x846e4d-0x0;var _0x59a2c8=_0xddf8[_0x846e4d];return _0x59a2c8;};'use strict';var client=require(_0x8ddf('0x0'));exports[_0x8ddf('0x1')]=function(){return function(){return client[_0x8ddf('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x8ddf('0x3'),_0x8ddf('0x4'),_0x8ddf('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x8ddf('0x3'),_0x8ddf('0x6'),_0x8ddf('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 15296a1..ae4d0b7 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 _0x0338=['CreateOpenchannelQueueReport','update','DESC','../client','Request'];(function(_0x52067c,_0x22fa88){var _0x574b04=function(_0x454ba8){while(--_0x454ba8){_0x52067c['push'](_0x52067c['shift']());}};_0x574b04(++_0x22fa88);}(_0x0338,0xcb));var _0x8033=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x0338[_0x513aa5];return _0x1a1a7c;};'use strict';var client=require(_0x8033('0x0'));exports['create']=function(_0x5f56df){return client[_0x8033('0x1')]('CreateOpenchannelQueueReport',{'body':_0x5f56df,'log':_0x8033('0x2')});};exports[_0x8033('0x3')]=function(_0x56307e,_0x57d95e){return client[_0x8033('0x1')]('UpdateOpenchannelQueueReport',{'body':_0x57d95e,'options':{'where':{'uniqueid':_0x56307e},'order':[['id',_0x8033('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0xf197=['Request','update','DESC','../client'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xf197,0x11b));var _0x7f19=function(_0xdab637,_0x204dd6){_0xdab637=_0xdab637-0x0;var _0x4161cc=_0xf197[_0xdab637];return _0x4161cc;};'use strict';var client=require(_0x7f19('0x0'));exports['create']=function(_0x3ee45e){return client[_0x7f19('0x1')]('CreateOpenchannelQueueReport',{'body':_0x3ee45e,'log':'CreateOpenchannelQueueReport'});};exports[_0x7f19('0x2')]=function(_0x199f61,_0x24e881){return client[_0x7f19('0x1')]('UpdateOpenchannelQueueReport',{'body':_0x24e881,'options':{'where':{'uniqueid':_0x199f61},'order':[['id',_0x7f19('0x3')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index ee49059..5b33df6 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 _0x8ff4=['../client','Request','UpdateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x8ff4,0x1b3));var _0x48ff=function(_0x340c09,_0xc08941){_0x340c09=_0x340c09-0x0;var _0x1cc1b6=_0x8ff4[_0x340c09];return _0x1cc1b6;};'use strict';var client=require(_0x48ff('0x0'));exports['update']=function(_0x1851d,_0x3f700a){return client[_0x48ff('0x1')](_0x48ff('0x2'),{'body':_0x3f700a,'options':{'where':{'id':_0x1851d}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x189e03,_0x460a26){return client['Request'](_0x48ff('0x3'),{'body':_0x460a26,'options':{'where':{'id':_0x189e03}},'log':_0x48ff('0x4')});}; \ No newline at end of file +var _0x27f9=['../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','addTagsToSmsInteraction'];(function(_0x31f64d,_0x2a1914){var _0x509ff2=function(_0x23824d){while(--_0x23824d){_0x31f64d['push'](_0x31f64d['shift']());}};_0x509ff2(++_0x2a1914);}(_0x27f9,0x1e3));var _0x927f=function(_0x18a9f2,_0x493d4a){_0x18a9f2=_0x18a9f2-0x0;var _0x180085=_0x27f9[_0x18a9f2];return _0x180085;};'use strict';var client=require(_0x927f('0x0'));exports[_0x927f('0x1')]=function(_0x2e693c,_0x49ed67){return client[_0x927f('0x2')](_0x927f('0x3'),{'body':_0x49ed67,'options':{'where':{'id':_0x2e693c}},'log':_0x927f('0x4')});};exports[_0x927f('0x5')]=function(_0x45e273,_0xa1b6e8){return client[_0x927f('0x2')]('AddTagsToSmsInteraction',{'body':_0xa1b6e8,'options':{'where':{'id':_0x45e273}},'log':_0x927f('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 4fce1f6..e87c77e 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 _0x49c3=['createSmsMessage','../client','create','CreateSmsMessage'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x49c3,0xb1));var _0x349c=function(_0x373653,_0x475406){_0x373653=_0x373653-0x0;var _0x322a31=_0x49c3[_0x373653];return _0x322a31;};'use strict';var client=require(_0x349c('0x0'));exports[_0x349c('0x1')]=function(_0x115d49){return client['Request'](_0x349c('0x2'),{'body':_0x115d49,'log':_0x349c('0x3')});}; \ No newline at end of file +var _0x1766=['../client','create','CreateSmsMessage','createSmsMessage'];(function(_0x1633e9,_0x50a939){var _0x549ace=function(_0x15a157){while(--_0x15a157){_0x1633e9['push'](_0x1633e9['shift']());}};_0x549ace(++_0x50a939);}(_0x1766,0xcc));var _0x6176=function(_0x36b598,_0x238485){_0x36b598=_0x36b598-0x0;var _0x23c454=_0x1766[_0x36b598];return _0x23c454;};'use strict';var client=require(_0x6176('0x0'));exports[_0x6176('0x1')]=function(_0x44f20e){return client['Request'](_0x6176('0x2'),{'body':_0x44f20e,'log':_0x6176('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 3d6d296..1cc0ac3 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 _0xe862=['name','strategy','User','Agents','online','getSmsQueues','Request','GetSmsQueue'];(function(_0x590146,_0x35d961){var _0x1e4598=function(_0x26dac){while(--_0x26dac){_0x590146['push'](_0x590146['shift']());}};_0x1e4598(++_0x35d961);}(_0xe862,0x76));var _0x2e86=function(_0x4ca9cd,_0x4f9d6d){_0x4ca9cd=_0x4ca9cd-0x0;var _0x1cc56b=_0xe862[_0x4ca9cd];return _0x1cc56b;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x2e86('0x0')](_0x2e86('0x1'),{'options':{'raw':![],'attributes':['id',_0x2e86('0x2'),'timeout',_0x2e86('0x3')],'include':[{'model':_0x2e86('0x4'),'as':_0x2e86('0x5'),'attributes':['id',_0x2e86('0x2'),_0x2e86('0x6'),'smsPause']}]},'log':_0x2e86('0x7')});};}; \ No newline at end of file +var _0x529d=['strategy','User','Agents','online','smsPause','../client','getSmsQueues','GetSmsQueue','name','timeout'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x529d,0x177));var _0xd529=function(_0x42c754,_0x38b952){_0x42c754=_0x42c754-0x0;var _0x2d164e=_0x529d[_0x42c754];return _0x2d164e;};'use strict';var client=require(_0xd529('0x0'));exports[_0xd529('0x1')]=function(){return function(){return client['Request'](_0xd529('0x2'),{'options':{'raw':![],'attributes':['id',_0xd529('0x3'),_0xd529('0x4'),_0xd529('0x5')],'include':[{'model':_0xd529('0x6'),'as':_0xd529('0x7'),'attributes':['id','name',_0xd529('0x8'),_0xd529('0x9')]}]},'log':_0xd529('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 93d3062..8ee1bec 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 _0xa936=['CreateSmsQueueReport','update','UpdateSmsQueueReport','Request'];(function(_0x53bcbb,_0x1efe34){var _0x245ff7=function(_0x5e32f0){while(--_0x5e32f0){_0x53bcbb['push'](_0x53bcbb['shift']());}};_0x245ff7(++_0x1efe34);}(_0xa936,0x107));var _0x6a93=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xa936[_0x2aea9e];return _0x430b92;};'use strict';var client=require('../client');exports['create']=function(_0x162268){return client[_0x6a93('0x0')](_0x6a93('0x1'),{'body':_0x162268,'log':'CreateSmsQueueReport'});};exports[_0x6a93('0x2')]=function(_0x16099e,_0x30f326){return client['Request'](_0x6a93('0x3'),{'body':_0x30f326,'options':{'where':{'uniqueid':_0x16099e},'order':[['id','DESC']],'limit':0x1},'log':_0x6a93('0x3')});}; \ No newline at end of file +var _0x7d8a=['create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','../client'];(function(_0x112487,_0x425d75){var _0x41c830=function(_0x39ca33){while(--_0x39ca33){_0x112487['push'](_0x112487['shift']());}};_0x41c830(++_0x425d75);}(_0x7d8a,0xbf));var _0xa7d8=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x7d8a[_0x20589d];return _0x422de9;};'use strict';var client=require(_0xa7d8('0x0'));exports[_0xa7d8('0x1')]=function(_0xc6e383){return client['Request'](_0xa7d8('0x2'),{'body':_0xc6e383,'log':'CreateSmsQueueReport'});};exports[_0xa7d8('0x3')]=function(_0x269a18,_0x2d81c0){return client[_0xa7d8('0x4')](_0xa7d8('0x5'),{'body':_0x2d81c0,'options':{'where':{'uniqueid':_0x269a18},'order':[['id','DESC']],'limit':0x1},'log':_0xa7d8('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index bc1c009..8a69325 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 _0x60a5=['name','pauseType','lastPauseAt','chatPause','faxPause','smsPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','whatsappCapacity','openchannelCapacity','../client','getAgents','GetUser'];(function(_0x2ba6d1,_0x4ccd2b){var _0x5d912e=function(_0x5e10a7){while(--_0x5e10a7){_0x2ba6d1['push'](_0x2ba6d1['shift']());}};_0x5d912e(++_0x4ccd2b);}(_0x60a5,0x13d));var _0x560a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x60a5[_0x501510];return _0x1e6ee5;};'use strict';var client=require(_0x560a('0x0'));exports[_0x560a('0x1')]=function(){return function(){return client['Request'](_0x560a('0x2'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x560a('0x3'),'online',_0x560a('0x4'),_0x560a('0x5'),'voicePause',_0x560a('0x6'),'mailPause',_0x560a('0x7'),_0x560a('0x8'),_0x560a('0x9'),_0x560a('0xa'),_0x560a('0xb'),_0x560a('0xc'),_0x560a('0xd'),'smsCapacity',_0x560a('0xe'),_0x560a('0xf')]},'log':'getAgents'});};}; \ No newline at end of file +var _0x502d=['Request','GetUser','agent','online','pauseType','voicePause','mailPause','faxPause','smsPause','whatsappPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','../client','getAgents'];(function(_0x434339,_0x2abf5e){var _0x507ca6=function(_0x23770a){while(--_0x23770a){_0x434339['push'](_0x434339['shift']());}};_0x507ca6(++_0x2abf5e);}(_0x502d,0x1ae));var _0xd502=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x502d[_0x432fca];return _0x3adba4;};'use strict';var client=require(_0xd502('0x0'));exports[_0xd502('0x1')]=function(){return function(){return client[_0xd502('0x2')](_0xd502('0x3'),{'options':{'raw':!![],'where':{'role':_0xd502('0x4')},'attributes':['id','name',_0xd502('0x5'),_0xd502('0x6'),'lastPauseAt',_0xd502('0x7'),'chatPause',_0xd502('0x8'),_0xd502('0x9'),_0xd502('0xa'),_0xd502('0xb'),'openchannelPause',_0xd502('0xc'),_0xd502('0xd'),_0xd502('0xe'),_0xd502('0xf'),_0xd502('0x10'),_0xd502('0x11')]},'log':_0xd502('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index ad37929..c4a27c7 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 _0xe06f=['update','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','Request','../client'];(function(_0x16cab9,_0xe5e36d){var _0x4841c8=function(_0x3283a7){while(--_0x3283a7){_0x16cab9['push'](_0x16cab9['shift']());}};_0x4841c8(++_0xe5e36d);}(_0xe06f,0x65));var _0xfe06=function(_0x26e90c,_0x447c47){_0x26e90c=_0x26e90c-0x0;var _0x2f7f10=_0xe06f[_0x26e90c];return _0x2f7f10;};'use strict';var client=require(_0xfe06('0x0'));exports[_0xfe06('0x1')]=function(_0x53e2c9,_0x2ba5f3){return client['Request'](_0xfe06('0x2'),{'body':_0x2ba5f3,'options':{'where':{'id':_0x53e2c9}},'log':_0xfe06('0x3')});};exports[_0xfe06('0x4')]=function(_0x1f0dec,_0x3a07cc){return client[_0xfe06('0x5')]('AddTagsToWhatsappInteraction',{'body':_0x3a07cc,'options':{'where':{'id':_0x1f0dec}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x98d3=['update','UpdateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x32d945,_0x11c5eb){var _0x2d4b03=function(_0x14d383){while(--_0x14d383){_0x32d945['push'](_0x32d945['shift']());}};_0x2d4b03(++_0x11c5eb);}(_0x98d3,0x173));var _0x398d=function(_0x11a1fe,_0x394764){_0x11a1fe=_0x11a1fe-0x0;var _0x45bf5a=_0x98d3[_0x11a1fe];return _0x45bf5a;};'use strict';var client=require(_0x398d('0x0'));exports[_0x398d('0x1')]=function(_0x58c1f9,_0x35bbe1){return client['Request'](_0x398d('0x2'),{'body':_0x35bbe1,'options':{'where':{'id':_0x58c1f9}},'log':'updateWhatsappInteraction'});};exports[_0x398d('0x3')]=function(_0x41f57c,_0x4f7a58){return client['Request'](_0x398d('0x4'),{'body':_0x4f7a58,'options':{'where':{'id':_0x41f57c}},'log':_0x398d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 0f5f41c..440a205 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 _0x3767=['CreateWhatsappMessage'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x3767,0xa2));var _0x7376=function(_0x38edcf,_0x299af1){_0x38edcf=_0x38edcf-0x0;var _0x4054e3=_0x3767[_0x38edcf];return _0x4054e3;};'use strict';var client=require('../client');exports['create']=function(_0x36e5de){return client['Request'](_0x7376('0x0'),{'body':_0x36e5de,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x9a49=['../client','create','CreateWhatsappMessage'];(function(_0x36fc61,_0x22a31e){var _0x1d6a98=function(_0x1bfd31){while(--_0x1bfd31){_0x36fc61['push'](_0x36fc61['shift']());}};_0x1d6a98(++_0x22a31e);}(_0x9a49,0x6f));var _0x99a4=function(_0x2d5982,_0x5ae85c){_0x2d5982=_0x2d5982-0x0;var _0x544743=_0x9a49[_0x2d5982];return _0x544743;};'use strict';var client=require(_0x99a4('0x0'));exports[_0x99a4('0x1')]=function(_0x2f343b){return client['Request'](_0x99a4('0x2'),{'body':_0x2f343b,'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 69194e9..bc5fa91 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 _0xdb94=['strategy','User','online','../client','getWhatsappQueues','Request','GetWhatsappQueue','name'];(function(_0x2c3a8f,_0x374e56){var _0x189412=function(_0x560055){while(--_0x560055){_0x2c3a8f['push'](_0x2c3a8f['shift']());}};_0x189412(++_0x374e56);}(_0xdb94,0xab));var _0x4db9=function(_0x43c4ec,_0x17db71){_0x43c4ec=_0x43c4ec-0x0;var _0x5e212a=_0xdb94[_0x43c4ec];return _0x5e212a;};'use strict';var client=require(_0x4db9('0x0'));exports[_0x4db9('0x1')]=function(){return function(){return client[_0x4db9('0x2')](_0x4db9('0x3'),{'options':{'raw':![],'attributes':['id',_0x4db9('0x4'),'timeout',_0x4db9('0x5')],'include':[{'model':_0x4db9('0x6'),'as':'Agents','attributes':['id','name',_0x4db9('0x7'),'whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x02ce=['strategy','User','Agents','online','whatsappPause','../client','getWhatsappQueues','Request','name'];(function(_0x47568e,_0x35d1a7){var _0x4e34a9=function(_0x359fc6){while(--_0x359fc6){_0x47568e['push'](_0x47568e['shift']());}};_0x4e34a9(++_0x35d1a7);}(_0x02ce,0x1ac));var _0xe02c=function(_0x2e838a,_0x613b08){_0x2e838a=_0x2e838a-0x0;var _0x5a57f2=_0x02ce[_0x2e838a];return _0x5a57f2;};'use strict';var client=require(_0xe02c('0x0'));exports[_0xe02c('0x1')]=function(){return function(){return client[_0xe02c('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xe02c('0x3'),'timeout',_0xe02c('0x4')],'include':[{'model':_0xe02c('0x5'),'as':_0xe02c('0x6'),'attributes':['id',_0xe02c('0x3'),_0xe02c('0x7'),_0xe02c('0x8')]}]},'log':_0xe02c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 5acc0b5..92a40d8 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 _0x9c12=['create','Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','../client'];(function(_0x239ce8,_0x191cb8){var _0x37963f=function(_0x1e9f2a){while(--_0x1e9f2a){_0x239ce8['push'](_0x239ce8['shift']());}};_0x37963f(++_0x191cb8);}(_0x9c12,0x10d));var _0x29c1=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x9c12[_0xc8a931];return _0x28bd27;};'use strict';var client=require(_0x29c1('0x0'));exports[_0x29c1('0x1')]=function(_0x331c7d){return client[_0x29c1('0x2')](_0x29c1('0x3'),{'body':_0x331c7d,'log':_0x29c1('0x3')});};exports['update']=function(_0x2c4424,_0x2d02b){return client[_0x29c1('0x2')]('UpdateWhatsappQueueReport',{'body':_0x2d02b,'options':{'where':{'uniqueid':_0x2c4424},'order':[['id','DESC']],'limit':0x1},'log':_0x29c1('0x4')});}; \ No newline at end of file +var _0xa3f0=['update','Request','UpdateWhatsappQueueReport','DESC','../client','CreateWhatsappQueueReport'];(function(_0x508acd,_0x852c77){var _0x4e8524=function(_0x10ea09){while(--_0x10ea09){_0x508acd['push'](_0x508acd['shift']());}};_0x4e8524(++_0x852c77);}(_0xa3f0,0x178));var _0x0a3f=function(_0x41b8f9,_0x2e5a01){_0x41b8f9=_0x41b8f9-0x0;var _0x5145d1=_0xa3f0[_0x41b8f9];return _0x5145d1;};'use strict';var client=require(_0x0a3f('0x0'));exports['create']=function(_0x856a69){return client['Request'](_0x0a3f('0x1'),{'body':_0x856a69,'log':'CreateWhatsappQueueReport'});};exports[_0x0a3f('0x2')]=function(_0x41d5eb,_0xdf62b){return client[_0x0a3f('0x3')](_0x0a3f('0x4'),{'body':_0xdf62b,'options':{'where':{'uniqueid':_0x41d5eb},'order':[['id',_0x0a3f('0x5')]],'limit':0x1},'log':_0x0a3f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 7d219ae..92d7891 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 _0xe7d5=['[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','util','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','createQueue','atimeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe7d5,0x16c));var _0x5e7d=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xe7d5[_0xefd519];return _0x4bb882;};'use strict';var schema=require('validate');var _=require(_0x5e7d('0x0'));var util=require(_0x5e7d('0x1'));var seqqueue=require('seq-queue');var logger=require(_0x5e7d('0x2'))(_0x5e7d('0x3'));var strategy=require(_0x5e7d('0x4'));var queue=schema({'name':{'type':_0x5e7d('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x5e7d('0x6'),'message':_0x5e7d('0x7')}});function writeLog(_0x13f4c8,_0x383e9b,_0x1cc878){return logger[_0x5e7d('0x8')](util[_0x5e7d('0x9')](_0x5e7d('0xa'),_0x13f4c8,_0x383e9b[_0x5e7d('0xb')],_0x1cc878));}function handleFindAgent(_0x5a81a1){return function(_0x350b82){return _0x350b82[_0x5e7d('0xb')][_0x5e7d('0xc')]()===_0x5a81a1[_0x5e7d('0xc')]();};}exports[_0x5e7d('0xd')]=function(_0x408850,_0x4627f0,_0x2ad93e,_0x58911e){return function(_0x3ed947){try{var _0xcba293={'name':_0x4627f0[0x0],'timeout':_0x4627f0[0x1]};var _0x134fc8=queue['validate'](_0xcba293,{'typecast':!![]});if(_0x134fc8['length']){logger['error'](_0x5e7d('0xe'),_0x408850,_[_0x5e7d('0xf')](_0x134fc8,_0x5e7d('0x10'))[_0x5e7d('0x11')](',\x20'));_0x3ed947[_0x5e7d('0x12')]();}else{var _0x5cbb10=_[_0x5e7d('0x13')](_0x2ad93e[_0x5e7d('0x14')],handleFindAgent(_0xcba293['name']));if(_0x5cbb10){var _0xe267f2=(_0xcba293['timeout']||0xa)*0x3e8;var _0x3eb1c4,_0x8d338f;var _0x223d72=seqqueue[_0x5e7d('0x15')](_0xe267f2);_0x223d72['id']=_0x408850;_0x223d72[_0x5e7d('0x16')]=_0xe267f2;_0x223d72[_0x5e7d('0x17')]=_0x58911e[_0x5e7d('0x17')];writeLog(_0x408850,_0x5cbb10,util['format']('START:%s',_0xe267f2));_0x2ad93e[_0x5e7d('0x18')][_0x408850]['on'](_0x5e7d('0x19'),function(){logger[_0x5e7d('0x8')](_0x5e7d('0x1a'),_0x408850);clearTimeout(_0x8d338f);_0x8d338f=undefined;_0x223d72['close']();if(_0x2ad93e[_0x5e7d('0x18')][_0x408850]){delete _0x2ad93e[_0x5e7d('0x18')][_0x408850];}_0x3ed947['stop']();});_0x2ad93e['rules'][_0x408850]['on'](_0x5e7d('0x1b'),function(){if(_0x2ad93e[_0x5e7d('0x18')][_0x408850]){delete _0x2ad93e['rules'][_0x408850];}});_0x8d338f=setTimeout(function(){logger[_0x5e7d('0x8')](_0x5e7d('0x1c'),_0x408850);clearTimeout(_0x8d338f);_0x223d72['close']();_0x3ed947[_0x5e7d('0x1d')]();},_0xe267f2);strategy[_0x5e7d('0x1e')](_0x223d72,_0x5cbb10,_0x2ad93e,_0x58911e);}else{logger[_0x5e7d('0x1f')](_0x5e7d('0x20'),_0x408850,_0xcba293[_0x5e7d('0xb')]);_0x3ed947['stop']();}}}catch(_0x11481a){console[_0x5e7d('0x21')](_0x11481a);logger[_0x5e7d('0x1f')](_0x5e7d('0x22'),_0x408850,_0x11481a[_0x5e7d('0x23')]);_0x3ed947[_0x5e7d('0x12')]();}};}; \ No newline at end of file +var _0x9719=['info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map','message','join','find','timeout','atimeout','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','rules','complete','[%s][AGENT]\x20ROUTING\x20END','close','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stop','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number'];(function(_0x3f3f40,_0x4c71f4){var _0x403b7a=function(_0x509014){while(--_0x509014){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x403b7a(++_0x4c71f4);}(_0x9719,0x1ee));var _0x9971=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9719[_0x57b54c];return _0x59cc19;};'use strict';var schema=require(_0x9971('0x0'));var _=require(_0x9971('0x1'));var util=require(_0x9971('0x2'));var seqqueue=require(_0x9971('0x3'));var logger=require(_0x9971('0x4'))(_0x9971('0x5'));var strategy=require(_0x9971('0x6'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x9971('0x7')},'timeout':{'type':_0x9971('0x8'),'message':_0x9971('0x9')}});function writeLog(_0x398584,_0x8004cd,_0x380eeb){return logger[_0x9971('0xa')](util['format'](_0x9971('0xb'),_0x398584,_0x8004cd['name'],_0x380eeb));}function handleFindAgent(_0x74176f){return function(_0x3898c0){return _0x3898c0[_0x9971('0xc')][_0x9971('0xd')]()===_0x74176f[_0x9971('0xd')]();};}exports['consequence']=function(_0x1748f7,_0x14e5f3,_0x1fe748,_0x4c2fdc){return function(_0x5eaba5){try{var _0x1d6db0={'name':_0x14e5f3[0x0],'timeout':_0x14e5f3[0x1]};var _0x3c08db=queue[_0x9971('0x0')](_0x1d6db0,{'typecast':!![]});if(_0x3c08db[_0x9971('0xe')]){logger[_0x9971('0xf')](_0x9971('0x10'),_0x1748f7,_[_0x9971('0x11')](_0x3c08db,_0x9971('0x12'))[_0x9971('0x13')](',\x20'));_0x5eaba5['stop']();}else{var _0x4250de=_[_0x9971('0x14')](_0x1fe748['agents'],handleFindAgent(_0x1d6db0[_0x9971('0xc')]));if(_0x4250de){var _0x386be0=(_0x1d6db0[_0x9971('0x15')]||0xa)*0x3e8;var _0xb99b00,_0x33ce08;var _0x296331=seqqueue['createQueue'](_0x386be0);_0x296331['id']=_0x1748f7;_0x296331[_0x9971('0x16')]=_0x386be0;_0x296331['channel']=_0x4c2fdc[_0x9971('0x17')];writeLog(_0x1748f7,_0x4250de,util['format'](_0x9971('0x18'),_0x386be0));_0x1fe748['rules'][_0x1748f7]['on'](_0x9971('0x19'),function(){logger[_0x9971('0xa')](_0x9971('0x1a'),_0x1748f7);clearTimeout(_0x33ce08);_0x33ce08=undefined;_0x296331['close']();if(_0x1fe748[_0x9971('0x1b')][_0x1748f7]){delete _0x1fe748[_0x9971('0x1b')][_0x1748f7];}_0x5eaba5['stop']();});_0x1fe748['rules'][_0x1748f7]['on'](_0x9971('0x1c'),function(){if(_0x1fe748[_0x9971('0x1b')][_0x1748f7]){delete _0x1fe748[_0x9971('0x1b')][_0x1748f7];}});_0x33ce08=setTimeout(function(){logger[_0x9971('0xa')](_0x9971('0x1d'),_0x1748f7);clearTimeout(_0x33ce08);_0x296331[_0x9971('0x1e')]();_0x5eaba5['next']();},_0x386be0);strategy['agent'](_0x296331,_0x4250de,_0x1fe748,_0x4c2fdc);}else{logger[_0x9971('0xf')](_0x9971('0x1f'),_0x1748f7,_0x1d6db0[_0x9971('0xc')]);_0x5eaba5[_0x9971('0x20')]();}}}catch(_0x21f765){console[_0x9971('0x21')](_0x21f765);logger[_0x9971('0xf')](_0x9971('0x22'),_0x1748f7,_0x21f765[_0x9971('0x23')]);_0x5eaba5[_0x9971('0x20')]();}};}; \ 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 74a9e42..8835d00 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 _0x1261=['error','amazonlex','Message','then','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','next','contact','YYYY-MM-DD\x20HH:mm:ss','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','getMustacheRender','create','catch','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','postText'];(function(_0x5467ab,_0x3b3fe8){var _0x2fcdd7=function(_0x31868d){while(--_0x31868d){_0x5467ab['push'](_0x5467ab['shift']());}};_0x2fcdd7(++_0x3b3fe8);}(_0x1261,0x144));var _0x1126=function(_0x403115,_0x2d6d03){_0x403115=_0x403115-0x0;var _0x596ef3=_0x1261[_0x403115];return _0x596ef3;};'use strict';var _=require('lodash');var moment=require(_0x1126('0x0'));var AWS=require(_0x1126('0x1'));var utils=require(_0x1126('0x2'));var logger=require(_0x1126('0x3'))(_0x1126('0x4'));var rpc={'chatMessage':require(_0x1126('0x5')),'openchannelMessage':require(_0x1126('0x6')),'mailMessage':require(_0x1126('0x7')),'smsMessage':require(_0x1126('0x8')),'faxMessage':require(_0x1126('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x40ba58,_0x907180){return function(_0x4f239c){try{if(!_[_0x1126('0xa')](this[_0x1126('0xb')][_0x1126('0xc')])){logger[_0x1126('0xd')](_0x1126('0xe'),_0x40ba58,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4f239c[_0x1126('0xf')]();}var _0x18dbe6={'ContactId':this[_0x1126('0x10')]['id'],'sentAt':moment()['format'](_0x1126('0x11')),'direction':'out'};var _0x52ef15=this[_0x1126('0x12')];if(_0x52ef15==='chat'){_0x18dbe6[_0x1126('0x13')]=this[_0x1126('0x14')]['id'];}else{_0x18dbe6[_[_0x1126('0x15')](_0x52ef15)+_0x1126('0x16')]=this[_0x1126('0x14')]['id'];}_0x18dbe6[_[_0x1126('0x15')](_0x52ef15)+_0x1126('0x17')]=this[_0x1126('0xb')]['id'];if(this[_0x1126('0xb')]['created']){var _0x5de9a7=_0x907180[0x4];if(!_[_0x1126('0x18')](_0x5de9a7)){_0x18dbe6[_0x1126('0x19')]=utils[_0x1126('0x1a')](_0x5de9a7,this);return rpc[_0x52ef15+'Message'][_0x1126('0x1b')](_0x18dbe6)['then'](function(_0x35fe9f){logger[_0x1126('0xd')](_0x1126('0xe'),_0x40ba58,_0x18dbe6['body']);})[_0x1126('0x1c')](function(_0x1695f6){logger['error']('[%s][AMAZONLEX]\x20%s',_0x40ba58,JSON[_0x1126('0x1d')](_0x1695f6));})[_0x1126('0x1e')](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x40ba58);_0x4f239c[_0x1126('0x1f')]();});}else{logger['info'](_0x1126('0x20'),_0x40ba58);_0x4f239c[_0x1126('0x1f')]();}}else{var _0x2f70ac=this;var _0x54400a=new AWS[(_0x1126('0x21'))]({'accessKeyId':_0x907180[0x0],'secretAccessKey':_0x907180[0x1],'region':_0x907180[0x2]});var _0x49d209={'botAlias':'$LATEST','botName':_0x907180[0x3],'inputText':this[_0x1126('0x22')][_0x1126('0x19')],'userId':this[_0x1126('0x12')]+':'+this[_0x1126('0xb')]['id']['toString']()};_0x54400a[_0x1126('0x23')](_0x49d209,function(_0x477e6a,_0x48a08d){if(_0x477e6a){logger[_0x1126('0x24')]('[%s][AMAZONLEX]\x20%s',_0x40ba58,_0x477e6a['message']);_0x4f239c['next']();}else if(_0x48a08d&&_0x48a08d[_0x1126('0x22')]){_0x2f70ac[_0x1126('0x19')][_0x1126('0x25')]=_0x48a08d;_0x18dbe6[_0x1126('0x19')]=_0x48a08d[_0x1126('0x22')];return rpc[_0x52ef15+_0x1126('0x26')][_0x1126('0x1b')](_0x18dbe6)[_0x1126('0x27')](function(_0x589725){logger[_0x1126('0xd')](_0x1126('0xe'),_0x40ba58,_0x18dbe6[_0x1126('0x19')]);if(_0x48a08d['dialogState']=='Failed'){_0x4f239c[_0x1126('0xf')]();}else{_0x4f239c[_0x1126('0x1f')]();}})['catch'](function(_0x2fb797){logger[_0x1126('0x24')]('[%s][AMAZONLEX]\x20%s',_0x40ba58,JSON[_0x1126('0x1d')](_0x2fb797));_0x4f239c['next']();});}else{_0x4f239c[_0x1126('0xf')]();}});}}catch(_0x4bd50b){logger[_0x1126('0x24')]('[%s][AMAZONLEX]\x20%s',_0x40ba58,JSON[_0x1126('0x1d')](_0x4bd50b));_0x4f239c['stop']();}};}; \ No newline at end of file +var _0xe2fe=['info','[%s][AMAZONLEX]\x20%s','next','account','upperFirst','AccountId','InteractionId','isEmpty','getMustacheRender','Message','create','then','catch','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','body','channel','toString','postText','error','amazonlex','Failed','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','interaction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0xee2f('0x1'));var logger=require('../../../../config/logger')(_0xee2f('0x2'));var rpc={'chatMessage':require(_0xee2f('0x3')),'openchannelMessage':require(_0xee2f('0x4')),'mailMessage':require(_0xee2f('0x5')),'smsMessage':require(_0xee2f('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xee2f('0x7'))};exports[_0xee2f('0x8')]=function(_0x49926b,_0x1533a0){return function(_0x2e1c8c){try{if(!_['isNil'](this[_0xee2f('0x9')]['UserId'])){logger[_0xee2f('0xa')](_0xee2f('0xb'),_0x49926b,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2e1c8c[_0xee2f('0xc')]();}var _0x43f451={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};var _0x2b8fb1=this['channel'];if(_0x2b8fb1==='chat'){_0x43f451['ChatWebsiteId']=this[_0xee2f('0xd')]['id'];}else{_0x43f451[_[_0xee2f('0xe')](_0x2b8fb1)+_0xee2f('0xf')]=this[_0xee2f('0xd')]['id'];}_0x43f451[_[_0xee2f('0xe')](_0x2b8fb1)+_0xee2f('0x10')]=this['interaction']['id'];if(this[_0xee2f('0x9')]['created']){var _0x36db10=_0x1533a0[0x4];if(!_[_0xee2f('0x11')](_0x36db10)){_0x43f451['body']=utils[_0xee2f('0x12')](_0x36db10,this);return rpc[_0x2b8fb1+_0xee2f('0x13')][_0xee2f('0x14')](_0x43f451)[_0xee2f('0x15')](function(_0x390c2c){logger['info'](_0xee2f('0xb'),_0x49926b,_0x43f451['body']);})[_0xee2f('0x16')](function(_0x3359ff){logger['error']('[%s][AMAZONLEX]\x20%s',_0x49926b,JSON[_0xee2f('0x17')](_0x3359ff));})['finally'](function(){logger[_0xee2f('0xa')](_0xee2f('0x18'),_0x49926b);_0x2e1c8c[_0xee2f('0x19')]();});}else{logger['info'](_0xee2f('0x1a'),_0x49926b);_0x2e1c8c[_0xee2f('0x19')]();}}else{var _0x4db2cc=this;var _0x21fdf4=new AWS[(_0xee2f('0x1b'))]({'accessKeyId':_0x1533a0[0x0],'secretAccessKey':_0x1533a0[0x1],'region':_0x1533a0[0x2]});var _0x5d36d4={'botAlias':'$LATEST','botName':_0x1533a0[0x3],'inputText':this[_0xee2f('0x1c')][_0xee2f('0x1d')],'userId':this[_0xee2f('0x1e')]+':'+this[_0xee2f('0x9')]['id'][_0xee2f('0x1f')]()};_0x21fdf4[_0xee2f('0x20')](_0x5d36d4,function(_0x39a39c,_0x4d68d3){if(_0x39a39c){logger[_0xee2f('0x21')](_0xee2f('0xb'),_0x49926b,_0x39a39c[_0xee2f('0x1c')]);_0x2e1c8c[_0xee2f('0xc')]();}else if(_0x4d68d3&&_0x4d68d3[_0xee2f('0x1c')]){_0x4db2cc[_0xee2f('0x1d')][_0xee2f('0x22')]=_0x4d68d3;_0x43f451[_0xee2f('0x1d')]=_0x4d68d3[_0xee2f('0x1c')];return rpc[_0x2b8fb1+_0xee2f('0x13')][_0xee2f('0x14')](_0x43f451)[_0xee2f('0x15')](function(_0x1c8454){logger[_0xee2f('0xa')]('[%s][AMAZONLEX]\x20%s',_0x49926b,_0x43f451['body']);if(_0x4d68d3['dialogState']==_0xee2f('0x23')){_0x2e1c8c[_0xee2f('0xc')]();}else{_0x2e1c8c[_0xee2f('0x19')]();}})[_0xee2f('0x16')](function(_0x892a4e){logger[_0xee2f('0x21')]('[%s][AMAZONLEX]\x20%s',_0x49926b,JSON[_0xee2f('0x17')](_0x892a4e));_0x2e1c8c['next']();});}else{_0x2e1c8c[_0xee2f('0xc')]();}});}}catch(_0x180429){logger[_0xee2f('0x21')](_0xee2f('0xb'),_0x49926b,JSON[_0xee2f('0x17')](_0x180429));_0x2e1c8c['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index d18f39c..0e88821 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 _0x04d0=['Autoreply\x20already\x20sent','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','read','subject','startsWith','Re:','ChatWebsiteId','account','upperFirst','channel','AccountId','Message','Smtp','service','host','port','secure','authentication','user','pass','inReplyTo','messageId','html','replace','body','','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','[%s][AUTOREPLY]\x20%s','stringify','catch','error','finally','stop','lodash','moment','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','created','info'];(function(_0x8b68c2,_0x5af07f){var _0x596626=function(_0x4e00c6){while(--_0x4e00c6){_0x8b68c2['push'](_0x8b68c2['shift']());}};_0x596626(++_0x5af07f);}(_0x04d0,0x1bc));var _0x004d=function(_0x4e4f69,_0x234662){_0x4e4f69=_0x4e4f69-0x0;var _0x24459e=_0x04d0[_0x4e4f69];return _0x24459e;};'use strict';var _=require(_0x004d('0x0'));var moment=require(_0x004d('0x1'));var utils=require('./utils');var logger=require(_0x004d('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x004d('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x004d('0x4')),'faxMessage':require(_0x004d('0x5')),'whatsappMessage':require(_0x004d('0x6'))};var mailRpc=require('../../mailRpc');exports[_0x004d('0x7')]=function(_0x2a0c23,_0x35fafb){return function(_0x5706df){try{if(_0x35fafb[0x0]==='1'&&(_[_0x004d('0x8')](this[_0x004d('0x9')]['created'])||!this[_0x004d('0x9')][_0x004d('0xa')])){logger[_0x004d('0xb')]('[%s][AUTOREPLY]\x20%s',_0x2a0c23,_0x004d('0xc'));return _0x5706df[_0x004d('0xd')]();}var _0x46bc28=this['channel'];var _0x1b6d59={'body':utils['getMustacheRender'](_0x35fafb[0x1],this),'ContactId':this[_0x004d('0xe')]['id'],'sentAt':moment()[_0x004d('0xf')](_0x004d('0x10')),'direction':_0x004d('0x11')};if(this[_0x004d('0x12')]){_0x1b6d59['to']=this['message'][_0x004d('0x13')]||'';_0x1b6d59['cc']=this[_0x004d('0x12')]['cc']||'';_0x1b6d59[_0x004d('0x13')]=this[_0x004d('0x12')]['to']||'';_0x1b6d59[_0x004d('0x14')]=this[_0x004d('0x12')][_0x004d('0x14')]||'';_0x1b6d59[_0x004d('0x15')]=!![];if(this[_0x004d('0x12')][_0x004d('0x16')]){_0x1b6d59[_0x004d('0x16')]='';_0x1b6d59[_0x004d('0x16')]+=_[_0x004d('0x17')](this[_0x004d('0x12')][_0x004d('0x16')],_0x004d('0x18'))?'':'Re:\x20';_0x1b6d59['subject']+=this['message']['subject'];}}if(this['channel']==='chat'){_0x1b6d59[_0x004d('0x19')]=this[_0x004d('0x1a')]['id'];}else{_0x1b6d59[_[_0x004d('0x1b')](this[_0x004d('0x1c')])+_0x004d('0x1d')]=this[_0x004d('0x1a')]['id'];}_0x1b6d59[_[_0x004d('0x1b')](this[_0x004d('0x1c')])+'InteractionId']=this[_0x004d('0x9')]['id'];if(rpc[this['channel']+_0x004d('0x1e')]){if(this[_0x004d('0x1c')]==='mail'){var _0x2eb282={'tls':{'rejectUnauthorized':![]}};if(this[_0x004d('0x1a')][_0x004d('0x1f')]['service']){_0x2eb282[_0x004d('0x20')]=this[_0x004d('0x1a')]['Smtp']['service'];}else{_0x2eb282[_0x004d('0x21')]=this[_0x004d('0x1a')]['Smtp'][_0x004d('0x21')];_0x2eb282[_0x004d('0x22')]=this['account'][_0x004d('0x1f')][_0x004d('0x22')];_0x2eb282[_0x004d('0x23')]=this[_0x004d('0x1a')][_0x004d('0x1f')][_0x004d('0x23')];}if(this['account'][_0x004d('0x1f')][_0x004d('0x24')]){_0x2eb282['auth']={'user':this[_0x004d('0x1a')][_0x004d('0x1f')][_0x004d('0x25')],'pass':this[_0x004d('0x1a')][_0x004d('0x1f')][_0x004d('0x26')]};}_0x1b6d59[_0x004d('0x27')]=this[_0x004d('0x12')][_0x004d('0x28')];_0x1b6d59[_0x004d('0x29')]=''+_[_0x004d('0x2a')](_0x1b6d59[_0x004d('0x2b')],_0x004d('0x2c'),_0x004d('0x2d'))+_0x004d('0x2e');return mailRpc[_0x004d('0x2f')](_0x2eb282,_0x1b6d59)[_0x004d('0x30')](function(_0x1ebd38){logger['info'](_0x004d('0x31'),_0x2a0c23);_0x1b6d59['messageId']=_0x1ebd38[_0x004d('0x12')]['messageId'];return rpc[_0x46bc28+_0x004d('0x1e')][_0x004d('0x32')](_0x1b6d59);})[_0x004d('0x30')](function(_0x1dd1c2){logger['info'](_0x004d('0x33'),_0x2a0c23,JSON[_0x004d('0x34')](_0x1dd1c2));})[_0x004d('0x35')](function(_0x458452){logger[_0x004d('0x36')]('[RPC][%s][AUTOREPLY]\x20%s',_0x2a0c23,JSON[_0x004d('0x34')](_0x458452));})['finally'](function(){_0x5706df[_0x004d('0xd')]();});}else{return rpc[this['channel']+_0x004d('0x1e')][_0x004d('0x32')](_0x1b6d59)[_0x004d('0x30')](function(_0x5c18b4){logger[_0x004d('0xb')]('[%s][AUTOREPLY]\x20%s',_0x2a0c23,_0x1b6d59[_0x004d('0x2b')]);})[_0x004d('0x35')](function(_0x140126){logger[_0x004d('0x36')]('[%s][AUTOREPLY]\x20%s',_0x2a0c23,JSON['stringify'](_0x140126));})[_0x004d('0x37')](function(){_0x5706df['next']();});}}}catch(_0x2fd358){logger[_0x004d('0x36')]('[%s][AUTOREPLY]\x20%s',_0x2a0c23,JSON[_0x004d('0x34')](_0x2fd358));_0x5706df[_0x004d('0x38')]();}};}; \ No newline at end of file +var _0x6afb=['routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../mailRpc','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','channel','format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','read','subject','startsWith','chat','ChatWebsiteId','upperFirst','InteractionId','Message','mail','account','Smtp','service','port','secure','user','pass','inReplyTo','','replace','body','';return mailRpc[_0xb6af('0x2b')](_0x1a5d08,_0x5b18f0)[_0xb6af('0x2c')](function(_0x45ee01){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x4750b0);_0x5b18f0[_0xb6af('0x2d')]=_0x45ee01[_0xb6af('0x12')]['messageId'];return rpc[_0x45058e+_0xb6af('0x1c')][_0xb6af('0x2e')](_0x5b18f0);})['then'](function(_0x472849){logger[_0xb6af('0x2f')]('[%s][AUTOREPLY]\x20%s',_0x4750b0,JSON[_0xb6af('0x30')](_0x472849));})[_0xb6af('0x31')](function(_0x287e07){logger[_0xb6af('0x32')](_0xb6af('0x33'),_0x4750b0,JSON[_0xb6af('0x30')](_0x287e07));})[_0xb6af('0x34')](function(){_0x335e7c[_0xb6af('0x35')]();});}else{return rpc[this[_0xb6af('0xe')]+'Message'][_0xb6af('0x2e')](_0x5b18f0)['then'](function(_0x16e403){logger['info'](_0xb6af('0xc'),_0x4750b0,_0x5b18f0['body']);})[_0xb6af('0x31')](function(_0x2c1945){logger['error'](_0xb6af('0xc'),_0x4750b0,JSON[_0xb6af('0x30')](_0x2c1945));})['finally'](function(){_0x335e7c[_0xb6af('0x35')]();});}}}catch(_0x2166f4){logger[_0xb6af('0x32')]('[%s][AUTOREPLY]\x20%s',_0x4750b0,JSON[_0xb6af('0x30')](_0x2166f4));_0x335e7c[_0xb6af('0x36')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 042420c..e499a67 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 _0x095b=['format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s'];(function(_0x4d5389,_0x49a915){var _0x58e9da=function(_0x2c2a58){while(--_0x2c2a58){_0x4d5389['push'](_0x4d5389['shift']());}};_0x58e9da(++_0x49a915);}(_0x095b,0x6e));var _0xb095=function(_0xb9f710,_0x5070c7){_0xb9f710=_0xb9f710-0x0;var _0x23c4c7=_0x095b[_0xb9f710];return _0x23c4c7;};'use strict';var moment=require(_0xb095('0x0'));var logger=require('../../../../config/logger')(_0xb095('0x1'));var rpc={'chatInteraction':require(_0xb095('0x2')),'openchannelInteraction':require(_0xb095('0x3')),'smsInteraction':require(_0xb095('0x4')),'mailInteraction':require(_0xb095('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xb095('0x6'))};exports[_0xb095('0x7')]=function(_0x12979f,_0x2f5412,_0x10a03d,_0x3e4cc9){return function(_0x24deed){try{logger[_0xb095('0x8')](_0xb095('0x9'),_0x12979f,_0x2f5412[0x0]);var _0x47a5eb={'closed':0x1,'closedAt':moment()[_0xb095('0xa')](_0xb095('0xb')),'closeReason':_0xb095('0xc'),'disposition':_0x2f5412[0x0]};if(rpc[_0x3e4cc9[_0xb095('0xd')]+_0xb095('0xe')]){rpc[_0x3e4cc9[_0xb095('0xd')]+'Interaction']['update'](_0x3e4cc9[_0xb095('0xf')]['id'],_0x47a5eb)[_0xb095('0x10')](function(_0x52f0c5){logger[_0xb095('0x8')](_0xb095('0x11'),_0x12979f,_0x3e4cc9['interaction']['id']);})[_0xb095('0x12')](function(_0x5e0fb3){logger[_0xb095('0x13')](_0xb095('0x14'),_0x12979f,JSON[_0xb095('0x15')](_0x5e0fb3));})[_0xb095('0x16')](function(){_0x24deed[_0xb095('0x17')]();});}}catch(_0x394df0){logger[_0xb095('0x13')]('[%s][CLOSE]\x20%s',_0x12979f,JSON[_0xb095('0x15')](_0x394df0));_0x24deed[_0xb095('0x17')]();}};}; \ No newline at end of file +var _0x647c=['catch','error','[%s][CLOSE]\x20%s','stringify','finally','moment','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then'];(function(_0x1144df,_0x1dcde2){var _0x347735=function(_0x4cbde2){while(--_0x4cbde2){_0x1144df['push'](_0x1144df['shift']());}};_0x347735(++_0x1dcde2);}(_0x647c,0x1d3));var _0xc647=function(_0xfd9b19,_0x21d75f){_0xfd9b19=_0xfd9b19-0x0;var _0x514918=_0x647c[_0xfd9b19];return _0x514918;};'use strict';var moment=require(_0xc647('0x0'));var logger=require('../../../../config/logger')(_0xc647('0x1'));var rpc={'chatInteraction':require(_0xc647('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xc647('0x3')),'mailInteraction':require(_0xc647('0x4')),'faxInteraction':require(_0xc647('0x5')),'whatsappInteraction':require(_0xc647('0x6'))};exports[_0xc647('0x7')]=function(_0x535407,_0x10f33d,_0x202fea,_0x19bfae){return function(_0x22bcc1){try{logger[_0xc647('0x8')](_0xc647('0x9'),_0x535407,_0x10f33d[0x0]);var _0x59158c={'closed':0x1,'closedAt':moment()['format'](_0xc647('0xa')),'closeReason':_0xc647('0xb'),'disposition':_0x10f33d[0x0]};if(rpc[_0x19bfae[_0xc647('0xc')]+'Interaction']){rpc[_0x19bfae[_0xc647('0xc')]+_0xc647('0xd')][_0xc647('0xe')](_0x19bfae[_0xc647('0xf')]['id'],_0x59158c)[_0xc647('0x10')](function(_0x24c959){logger[_0xc647('0x8')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x535407,_0x19bfae[_0xc647('0xf')]['id']);})[_0xc647('0x11')](function(_0x333ed0){logger[_0xc647('0x12')](_0xc647('0x13'),_0x535407,JSON[_0xc647('0x14')](_0x333ed0));})[_0xc647('0x15')](function(){_0x22bcc1['stop']();});}}catch(_0x4d3dc3){logger[_0xc647('0x12')]('[%s][CLOSE]\x20%s',_0x535407,JSON[_0xc647('0x14')](_0x4d3dc3));_0x22bcc1['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 5f9d4b1..4652176 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 _0x27d0=['body','getMustacheRender','create','then','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','Message','endConversation','catch','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','info','[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','account','upperFirst','AccountId','InteractionId','interaction','created'];(function(_0x1bb058,_0x36f9fa){var _0x493b9e=function(_0xa7ecd0){while(--_0xa7ecd0){_0x1bb058['push'](_0x1bb058['shift']());}};_0x493b9e(++_0x36f9fa);}(_0x27d0,0x9f));var _0x027d=function(_0x427cd9,_0x1680e0){_0x427cd9=_0x427cd9-0x0;var _0x40f890=_0x27d0[_0x427cd9];return _0x40f890;};'use strict';var _=require(_0x027d('0x0'));var moment=require(_0x027d('0x1'));var apiai=require(_0x027d('0x2'));var md5=require(_0x027d('0x3'));var utils=require(_0x027d('0x4'));var logger=require(_0x027d('0x5'))(_0x027d('0x6'));var rpc={'chatMessage':require(_0x027d('0x7')),'openchannelMessage':require(_0x027d('0x8')),'mailMessage':require(_0x027d('0x9')),'smsMessage':require(_0x027d('0xa')),'faxMessage':require(_0x027d('0xb')),'whatsappMessage':require(_0x027d('0xc'))};exports['consequence']=function(_0x33dd70,_0x2c2ffb){return function(_0x4e957b){try{if(!_[_0x027d('0xd')](this['interaction']['UserId'])){logger[_0x027d('0xe')](_0x027d('0xf'),_0x33dd70,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4e957b[_0x027d('0x10')]();}var _0x168497={'ContactId':this[_0x027d('0x11')]['id'],'sentAt':moment()[_0x027d('0x12')](_0x027d('0x13')),'direction':_0x027d('0x14')};var _0x31fa54=this[_0x027d('0x15')];if(_0x31fa54===_0x027d('0x16')){_0x168497['ChatWebsiteId']=this[_0x027d('0x17')]['id'];}else{_0x168497[_[_0x027d('0x18')](_0x31fa54)+_0x027d('0x19')]=this[_0x027d('0x17')]['id'];}_0x168497[_[_0x027d('0x18')](_0x31fa54)+_0x027d('0x1a')]=this['interaction']['id'];if(this[_0x027d('0x1b')][_0x027d('0x1c')]){var _0x93610e=_0x2c2ffb[0x2];if(!_['isEmpty'](_0x93610e)){_0x168497[_0x027d('0x1d')]=utils[_0x027d('0x1e')](_0x93610e,this);return rpc[_0x31fa54+'Message'][_0x027d('0x1f')](_0x168497)[_0x027d('0x20')](function(_0x3bd4f0){logger[_0x027d('0xe')](_0x027d('0xf'),_0x33dd70,_0x168497[_0x027d('0x1d')]);})['catch'](function(_0x26bb5f){logger[_0x027d('0x21')](_0x027d('0xf'),_0x33dd70,JSON[_0x027d('0x22')](_0x26bb5f));})[_0x027d('0x23')](function(){logger['info'](_0x027d('0x24'),_0x33dd70);_0x4e957b[_0x027d('0x25')]();});}else{logger[_0x027d('0xe')](_0x027d('0x26'),_0x33dd70);_0x4e957b[_0x027d('0x25')]();}}else{var _0x46ebbf=this;var _0x5e5484=apiai(_0x2c2ffb[0x0],{'language':_0x2c2ffb[0x1]||'en'});return _0x5e5484[_0x027d('0x27')](this[_0x027d('0x28')][_0x027d('0x1d')],{'sessionId':md5(this['interaction']['id'])})[_0x027d('0x20')](function(_0x87fb7d){_0x46ebbf[_0x027d('0x1d')][_0x027d('0x29')]=_0x87fb7d;_0x168497['body']=_0x87fb7d[_0x027d('0x2a')][_0x027d('0x2b')]['speech'];return rpc[_0x31fa54+_0x027d('0x2c')][_0x027d('0x1f')](_0x168497)[_0x027d('0x20')](function(_0x4a2d6a){logger[_0x027d('0xe')](_0x027d('0xf'),_0x33dd70,_0x168497[_0x027d('0x1d')]);if(_0x87fb7d[_0x027d('0x2a')]['metadata'][_0x027d('0x2d')]){_0x4e957b[_0x027d('0x10')]();}else{_0x4e957b[_0x027d('0x25')]();}})[_0x027d('0x2e')](function(_0x16197a){logger['error'](_0x027d('0xf'),_0x33dd70,JSON[_0x027d('0x22')](_0x16197a));_0x4e957b['next']();});})[_0x027d('0x2e')](function(_0x1fc408){logger[_0x027d('0x21')](_0x027d('0xf'),_0x33dd70,_0x1fc408[_0x027d('0x28')]);_0x4e957b[_0x027d('0x10')]();});}}catch(_0x5c850c){logger[_0x027d('0x21')](_0x027d('0xf'),_0x33dd70,JSON[_0x027d('0x22')](_0x5c850c));_0x4e957b[_0x027d('0x25')]();}};}; \ No newline at end of file +var _0xac1d=['../../rpc/whatsappMessage','isNil','interaction','info','[%s][DIALOGFLOW]\x20%s','next','format','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','speech','metadata','endConversation','error','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage'];(function(_0x3e4c4c,_0x344e6b){var _0x1d63ba=function(_0x5a21dd){while(--_0x5a21dd){_0x3e4c4c['push'](_0x3e4c4c['shift']());}};_0x1d63ba(++_0x344e6b);}(_0xac1d,0x1c1));var _0xdac1=function(_0x484ee3,_0x1ac008){_0x484ee3=_0x484ee3-0x0;var _0x2bde09=_0xac1d[_0x484ee3];return _0x2bde09;};'use strict';var _=require(_0xdac1('0x0'));var moment=require(_0xdac1('0x1'));var apiai=require(_0xdac1('0x2'));var md5=require(_0xdac1('0x3'));var utils=require(_0xdac1('0x4'));var logger=require(_0xdac1('0x5'))(_0xdac1('0x6'));var rpc={'chatMessage':require(_0xdac1('0x7')),'openchannelMessage':require(_0xdac1('0x8')),'mailMessage':require(_0xdac1('0x9')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xdac1('0xa')),'whatsappMessage':require(_0xdac1('0xb'))};exports['consequence']=function(_0x13b522,_0x1e4a9f){return function(_0x1aecc6){try{if(!_[_0xdac1('0xc')](this[_0xdac1('0xd')]['UserId'])){logger[_0xdac1('0xe')](_0xdac1('0xf'),_0x13b522,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x1aecc6[_0xdac1('0x10')]();}var _0x3caa74={'ContactId':this['contact']['id'],'sentAt':moment()[_0xdac1('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};var _0x2924ee=this['channel'];if(_0x2924ee===_0xdac1('0x12')){_0x3caa74[_0xdac1('0x13')]=this['account']['id'];}else{_0x3caa74[_[_0xdac1('0x14')](_0x2924ee)+_0xdac1('0x15')]=this[_0xdac1('0x16')]['id'];}_0x3caa74[_['upperFirst'](_0x2924ee)+_0xdac1('0x17')]=this[_0xdac1('0xd')]['id'];if(this[_0xdac1('0xd')][_0xdac1('0x18')]){var _0x214e82=_0x1e4a9f[0x2];if(!_[_0xdac1('0x19')](_0x214e82)){_0x3caa74[_0xdac1('0x1a')]=utils[_0xdac1('0x1b')](_0x214e82,this);return rpc[_0x2924ee+_0xdac1('0x1c')][_0xdac1('0x1d')](_0x3caa74)[_0xdac1('0x1e')](function(_0x4a81d0){logger['info'](_0xdac1('0xf'),_0x13b522,_0x3caa74[_0xdac1('0x1a')]);})[_0xdac1('0x1f')](function(_0x5f2b14){logger['error'](_0xdac1('0xf'),_0x13b522,JSON[_0xdac1('0x20')](_0x5f2b14));})[_0xdac1('0x21')](function(){logger['info'](_0xdac1('0x22'),_0x13b522);_0x1aecc6[_0xdac1('0x23')]();});}else{logger['info'](_0xdac1('0x24'),_0x13b522);_0x1aecc6[_0xdac1('0x23')]();}}else{var _0x51c3d4=this;var _0x290c80=apiai(_0x1e4a9f[0x0],{'language':_0x1e4a9f[0x1]||'en'});return _0x290c80[_0xdac1('0x25')](this[_0xdac1('0x26')][_0xdac1('0x1a')],{'sessionId':md5(this['interaction']['id'])})[_0xdac1('0x1e')](function(_0x3f2d6){_0x51c3d4['body'][_0xdac1('0x27')]=_0x3f2d6;_0x3caa74[_0xdac1('0x1a')]=_0x3f2d6[_0xdac1('0x28')][_0xdac1('0x29')][_0xdac1('0x2a')];return rpc[_0x2924ee+_0xdac1('0x1c')][_0xdac1('0x1d')](_0x3caa74)[_0xdac1('0x1e')](function(_0x8acb8a){logger['info'](_0xdac1('0xf'),_0x13b522,_0x3caa74[_0xdac1('0x1a')]);if(_0x3f2d6[_0xdac1('0x28')][_0xdac1('0x2b')][_0xdac1('0x2c')]){_0x1aecc6['next']();}else{_0x1aecc6[_0xdac1('0x23')]();}})[_0xdac1('0x1f')](function(_0x517385){logger[_0xdac1('0x2d')]('[%s][DIALOGFLOW]\x20%s',_0x13b522,JSON[_0xdac1('0x20')](_0x517385));_0x1aecc6[_0xdac1('0x10')]();});})[_0xdac1('0x1f')](function(_0x1e6e87){logger[_0xdac1('0x2d')](_0xdac1('0xf'),_0x13b522,_0x1e6e87[_0xdac1('0x26')]);_0x1aecc6[_0xdac1('0x10')]();});}}catch(_0x472007){logger['error'](_0xdac1('0xf'),_0x13b522,JSON[_0xdac1('0x20')](_0x472007));_0x1aecc6[_0xdac1('0x23')]();}};}; \ 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 fafe952..2b2375a 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 _0xf3db=['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','validate','lodash','html-to-text','./utils','../../../../config/logger','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','getMustacheRender','replace','length','error','map','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s'];(function(_0xb2b3ae,_0x5f186d){var _0x2e18a3=function(_0x1743ce){while(--_0x1743ce){_0xb2b3ae['push'](_0xb2b3ae['shift']());}};_0x2e18a3(++_0x5f186d);}(_0xf3db,0x1aa));var _0xbf3d=function(_0xef9dc2,_0x28714f){_0xef9dc2=_0xef9dc2-0x0;var _0x1b1166=_0xf3db[_0xef9dc2];return _0x1b1166;};'use strict';var schema=require(_0xbf3d('0x0'));var _=require(_0xbf3d('0x1'));var htmlToText=require(_0xbf3d('0x2'));var utils=require(_0xbf3d('0x3'));var logger=require(_0xbf3d('0x4'))('routing');var gotoif=schema({'condition':{'type':_0xbf3d('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0xbf3d('0x6'),'message':_0xbf3d('0x7')},'priorityFalse':{'type':'number','message':_0xbf3d('0x8')}});exports['consequence']=function(_0x43c926,_0x18107c){return function(_0xaf9f44){try{var _0x24707d={'condition':htmlToText['fromString'](utils[_0xbf3d('0x9')](_0x18107c[0x0],this),{'wordwrap':![]})[_0xbf3d('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x18107c[0x1],'priorityFalse':_0x18107c[0x2]};var _0x9ceca5=gotoif[_0xbf3d('0x0')](_0x24707d,{'typecast':!![]});if(_0x9ceca5[_0xbf3d('0xb')]){logger[_0xbf3d('0xc')]('[%s][GOTOIF]\x20%s',_0x43c926,_[_0xbf3d('0xd')](_0x9ceca5,_0xbf3d('0xe'))[_0xbf3d('0xf')](',\x20'));_0xaf9f44[_0xbf3d('0x10')]();}else{try{var _0x46253d=eval('('+_0x24707d[_0xbf3d('0x11')]+')');var _0x389e53=_0x46253d?_0x24707d[_0xbf3d('0x12')]:_0x24707d[_0xbf3d('0x13')];logger[_0xbf3d('0x14')](_0xbf3d('0x15'),_0x43c926,_0x24707d[_0xbf3d('0x11')],_0x46253d,_0x389e53||_0xbf3d('0x16'));if(_0x389e53){var _0x5b6d02=_[_0xbf3d('0x17')](_0xaf9f44[_0xbf3d('0x18')](),{'p':_0x389e53});if(_0x5b6d02>=0x0){logger[_0xbf3d('0x14')](_0xbf3d('0x19'),_0x43c926,_0x389e53||_0xbf3d('0x16'),_0x5b6d02);_0xaf9f44[_0xbf3d('0x16')](_0x5b6d02);}else{logger['info'](_0xbf3d('0x1a'),_0x43c926,_0x389e53||_0xbf3d('0x16'));_0xaf9f44[_0xbf3d('0x10')]();}}else{_0xaf9f44[_0xbf3d('0x16')]();}}catch(_0x4006ce){logger[_0xbf3d('0xc')](_0xbf3d('0x1b'),_0x43c926,_0x4006ce[_0xbf3d('0xe')]);_0xaf9f44[_0xbf3d('0x10')]();}}}catch(_0x20a858){logger['error']('[%s][GOTOIF]\x20%s',_0x43c926,JSON['stringify'](_0x20a858));_0xaf9f44[_0xbf3d('0x10')]();}};}; \ No newline at end of file +var _0x313e=['map','message','join','stop','condition','priorityTrue','priorityFalse','info','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','html-to-text','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','consequence','fromString','getMustacheRender','replace','validate','length','error','[%s][GOTOIF]\x20%s'];(function(_0x1874c4,_0x5080b7){var _0x247357=function(_0x2480df){while(--_0x2480df){_0x1874c4['push'](_0x1874c4['shift']());}};_0x247357(++_0x5080b7);}(_0x313e,0x12b));var _0xe313=function(_0x2aa48b,_0x5a4446){_0x2aa48b=_0x2aa48b-0x0;var _0x48caf8=_0x313e[_0x2aa48b];return _0x48caf8;};'use strict';var schema=require('validate');var _=require('lodash');var htmlToText=require(_0xe313('0x0'));var utils=require('./utils');var logger=require(_0xe313('0x1'))(_0xe313('0x2'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0xe313('0x3')},'priorityTrue':{'type':'number','message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xe313('0x4'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xe313('0x5')]=function(_0x5695cd,_0x240a70){return function(_0x574a2f){try{var _0x106c47={'condition':htmlToText[_0xe313('0x6')](utils[_0xe313('0x7')](_0x240a70[0x0],this),{'wordwrap':![]})[_0xe313('0x8')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x240a70[0x1],'priorityFalse':_0x240a70[0x2]};var _0x350bf1=gotoif[_0xe313('0x9')](_0x106c47,{'typecast':!![]});if(_0x350bf1[_0xe313('0xa')]){logger[_0xe313('0xb')](_0xe313('0xc'),_0x5695cd,_[_0xe313('0xd')](_0x350bf1,_0xe313('0xe'))[_0xe313('0xf')](',\x20'));_0x574a2f[_0xe313('0x10')]();}else{try{var _0x28bd45=eval('('+_0x106c47[_0xe313('0x11')]+')');var _0x40f999=_0x28bd45?_0x106c47[_0xe313('0x12')]:_0x106c47[_0xe313('0x13')];logger[_0xe313('0x14')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x5695cd,_0x106c47['condition'],_0x28bd45,_0x40f999||_0xe313('0x15'));if(_0x40f999){var _0x3413a6=_['findIndex'](_0x574a2f[_0xe313('0x16')](),{'p':_0x40f999});if(_0x3413a6>=0x0){logger[_0xe313('0x14')](_0xe313('0x17'),_0x5695cd,_0x40f999||_0xe313('0x15'),_0x3413a6);_0x574a2f['next'](_0x3413a6);}else{logger[_0xe313('0x14')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x5695cd,_0x40f999||_0xe313('0x15'));_0x574a2f[_0xe313('0x10')]();}}else{_0x574a2f[_0xe313('0x15')]();}}catch(_0x585da8){logger[_0xe313('0xb')](_0xe313('0x18'),_0x5695cd,_0x585da8['message']);_0x574a2f[_0xe313('0x10')]();}}}catch(_0x5eb6ec){logger[_0xe313('0xb')](_0xe313('0xc'),_0x5695cd,JSON[_0xe313('0x19')](_0x5eb6ec));_0x574a2f['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 4c73756..afb9cb1 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 _0xeeb1=['info','next','error','stringify','validate','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','[%s][GOTOP]\x20%s','map','message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules'];(function(_0x2bbc07,_0x1e2168){var _0x6879e4=function(_0x290fa1){while(--_0x290fa1){_0x2bbc07['push'](_0x2bbc07['shift']());}};_0x6879e4(++_0x1e2168);}(_0xeeb1,0x100));var _0x1eeb=function(_0x4a9fb7,_0x4cbfd7){_0x4a9fb7=_0x4a9fb7-0x0;var _0x40b90e=_0xeeb1[_0x4a9fb7];return _0x40b90e;};'use strict';var schema=require(_0x1eeb('0x0'));var _=require(_0x1eeb('0x1'));var logger=require(_0x1eeb('0x2'))('routing');var gotop=schema({'priority':{'type':_0x1eeb('0x3'),'required':!![],'message':_0x1eeb('0x4')}});exports['consequence']=function(_0x4ac46e,_0x3700ef){return function(_0x1609ae){try{var _0x129a18={'priority':_0x3700ef[0x0]};var _0x31288d=gotop['validate'](_0x129a18,{'typecast':!![]});if(_0x31288d['length']){logger['error'](_0x1eeb('0x5'),_0x4ac46e,_[_0x1eeb('0x6')](_0x31288d,_0x1eeb('0x7'))[_0x1eeb('0x8')](',\x20'));_0x1609ae[_0x1eeb('0x9')]();}else{logger['info'](_0x1eeb('0xa'),_0x4ac46e,_0x129a18[_0x1eeb('0xb')]);if(_0x129a18['priority']){var _0x362e54=_[_0x1eeb('0xc')](_0x1609ae[_0x1eeb('0xd')](),{'p':_0x129a18['priority']});if(_0x362e54>=0x0){logger[_0x1eeb('0xe')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x4ac46e,_0x129a18[_0x1eeb('0xb')]||'next',_0x362e54);_0x1609ae[_0x1eeb('0xf')](_0x362e54);}else{logger[_0x1eeb('0xe')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x4ac46e,_0x129a18['priority']||_0x1eeb('0xf'));_0x1609ae[_0x1eeb('0x9')]();}}else{_0x1609ae[_0x1eeb('0xf')]();}}}catch(_0x4e070f){logger[_0x1eeb('0x10')](_0x1eeb('0x5'),_0x4ac46e,JSON[_0x1eeb('0x11')](_0x4e070f));_0x1609ae[_0x1eeb('0x9')]();}};}; \ No newline at end of file +var _0x44af=['../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next','stringify','validate','lodash'];(function(_0x5384ae,_0x32e603){var _0x4bcf2d=function(_0x5c8e1b){while(--_0x5c8e1b){_0x5384ae['push'](_0x5384ae['shift']());}};_0x4bcf2d(++_0x32e603);}(_0x44af,0x96));var _0xf44a=function(_0x4d7df6,_0x3f6139){_0x4d7df6=_0x4d7df6-0x0;var _0x4c0d29=_0x44af[_0x4d7df6];return _0x4c0d29;};'use strict';var schema=require(_0xf44a('0x0'));var _=require(_0xf44a('0x1'));var logger=require(_0xf44a('0x2'))(_0xf44a('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xf44a('0x4')}});exports['consequence']=function(_0x3084ff,_0xfcab17){return function(_0x34046f){try{var _0x11c93e={'priority':_0xfcab17[0x0]};var _0x3fe6ad=gotop[_0xf44a('0x0')](_0x11c93e,{'typecast':!![]});if(_0x3fe6ad[_0xf44a('0x5')]){logger[_0xf44a('0x6')](_0xf44a('0x7'),_0x3084ff,_[_0xf44a('0x8')](_0x3fe6ad,'message')[_0xf44a('0x9')](',\x20'));_0x34046f[_0xf44a('0xa')]();}else{logger[_0xf44a('0xb')](_0xf44a('0xc'),_0x3084ff,_0x11c93e['priority']);if(_0x11c93e[_0xf44a('0xd')]){var _0x1aabcf=_['findIndex'](_0x34046f[_0xf44a('0xe')](),{'p':_0x11c93e[_0xf44a('0xd')]});if(_0x1aabcf>=0x0){logger[_0xf44a('0xb')](_0xf44a('0xf'),_0x3084ff,_0x11c93e[_0xf44a('0xd')]||'next',_0x1aabcf);_0x34046f['next'](_0x1aabcf);}else{logger[_0xf44a('0xb')](_0xf44a('0x10'),_0x3084ff,_0x11c93e[_0xf44a('0xd')]||'next');_0x34046f[_0xf44a('0xa')]();}}else{_0x34046f[_0xf44a('0x11')]();}}}catch(_0x4278c4){logger['error'](_0xf44a('0x7'),_0x3084ff,JSON[_0xf44a('0x12')](_0x4278c4));_0x34046f[_0xf44a('0xa')]();}};}; \ 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 92fc994..3ccd4a9 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 _0x793e=['[%s][MESSAGE]\x20%s','next','catch','stop','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','channel','create','then','info'];(function(_0x2a9e6f,_0x216211){var _0x1159d1=function(_0x86dcc0){while(--_0x86dcc0){_0x2a9e6f['push'](_0x2a9e6f['shift']());}};_0x1159d1(++_0x216211);}(_0x793e,0xfe));var _0xe793=function(_0x1bbb03,_0x18c084){_0x1bbb03=_0x1bbb03-0x0;var _0x1ae659=_0x793e[_0x1bbb03];return _0x1ae659;};'use strict';var _=require(_0xe793('0x0'));var utils=require('./utils');var logger=require(_0xe793('0x1'))(_0xe793('0x2'));var rpc={'chatMessage':require(_0xe793('0x3')),'openchannelMessage':require(_0xe793('0x4')),'mailMessage':require(_0xe793('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xe793('0x6'))};exports[_0xe793('0x7')]=function(_0x260c34,_0x28eb44){return function(_0x4ec63d){try{var _0x58c72e={'body':utils[_0xe793('0x8')](_0x28eb44[0x0],this),'ContactId':this[_0xe793('0x9')]['id']};if(this['channel']===_0xe793('0xa')){_0x58c72e[_0xe793('0xb')]=this[_0xe793('0xc')]['id'];}else{_0x58c72e[_[_0xe793('0xd')](this['channel'])+_0xe793('0xe')]=this[_0xe793('0xc')]['id'];}_0x58c72e[_['upperFirst'](this['channel'])+_0xe793('0xf')]=this[_0xe793('0x10')]['id'];if(rpc[this[_0xe793('0x11')]+'Message']){return rpc[this[_0xe793('0x11')]+'Message'][_0xe793('0x12')](_0x58c72e)[_0xe793('0x13')](function(_0x30d327){logger[_0xe793('0x14')](_0xe793('0x15'),_0x260c34,_0x58c72e['body']);_0x4ec63d[_0xe793('0x16')]();})[_0xe793('0x17')](function(_0x88b8ce){logger['error']('[%s][MESSAGE]\x20%s',_0x260c34,JSON['stringify'](_0x88b8ce));_0x4ec63d['stop']();});}}catch(_0x39f3e7){logger['error'](_0xe793('0x15'),_0x260c34,JSON['stringify'](_0x39f3e7));_0x4ec63d[_0xe793('0x18')]();}};}; \ No newline at end of file +var _0x65c3=['ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','info','body','next','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','getMustacheRender','contact','channel','chat'];(function(_0x237922,_0x29fad3){var _0xecb9c0=function(_0x24c6e0){while(--_0x24c6e0){_0x237922['push'](_0x237922['shift']());}};_0xecb9c0(++_0x29fad3);}(_0x65c3,0x7b));var _0x365c=function(_0x394273,_0x3a1868){_0x394273=_0x394273-0x0;var _0x4f2a57=_0x65c3[_0x394273];return _0x4f2a57;};'use strict';var _=require(_0x365c('0x0'));var utils=require(_0x365c('0x1'));var logger=require('../../../../config/logger')(_0x365c('0x2'));var rpc={'chatMessage':require(_0x365c('0x3')),'openchannelMessage':require(_0x365c('0x4')),'mailMessage':require(_0x365c('0x5')),'smsMessage':require(_0x365c('0x6')),'faxMessage':require(_0x365c('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x3cbd9a,_0x12930e){return function(_0x5f2799){try{var _0x5b70ef={'body':utils[_0x365c('0x8')](_0x12930e[0x0],this),'ContactId':this[_0x365c('0x9')]['id']};if(this[_0x365c('0xa')]===_0x365c('0xb')){_0x5b70ef[_0x365c('0xc')]=this[_0x365c('0xd')]['id'];}else{_0x5b70ef[_[_0x365c('0xe')](this[_0x365c('0xa')])+_0x365c('0xf')]=this[_0x365c('0xd')]['id'];}_0x5b70ef[_[_0x365c('0xe')](this[_0x365c('0xa')])+_0x365c('0x10')]=this[_0x365c('0x11')]['id'];if(rpc[this[_0x365c('0xa')]+'Message']){return rpc[this[_0x365c('0xa')]+_0x365c('0x12')]['create'](_0x5b70ef)['then'](function(_0x47c897){logger[_0x365c('0x13')]('[%s][MESSAGE]\x20%s',_0x3cbd9a,_0x5b70ef[_0x365c('0x14')]);_0x5f2799[_0x365c('0x15')]();})[_0x365c('0x16')](function(_0x13be65){logger[_0x365c('0x17')](_0x365c('0x18'),_0x3cbd9a,JSON[_0x365c('0x19')](_0x13be65));_0x5f2799['stop']();});}}catch(_0x5571ee){logger[_0x365c('0x17')]('[%s][MESSAGE]\x20%s',_0x3cbd9a,JSON[_0x365c('0x19')](_0x5571ee));_0x5f2799[_0x365c('0x1a')]();}};}; \ 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 1acffcb..41a4773 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 _0xfd39=['[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger','routing','info'];(function(_0x27604f,_0x5ae336){var _0x40d189=function(_0xebacde){while(--_0xebacde){_0x27604f['push'](_0x27604f['shift']());}};_0x40d189(++_0x5ae336);}(_0xfd39,0xec));var _0x9fd3=function(_0x2b955e,_0x2c289c){_0x2b955e=_0x2b955e-0x0;var _0x551669=_0xfd39[_0x2b955e];return _0x551669;};'use strict';var utils=require(_0x9fd3('0x0'));var logger=require(_0x9fd3('0x1'))(_0x9fd3('0x2'));exports['consequence']=function(_0x3221ec,_0xf53f95){return function(_0x25ff67){try{logger[_0x9fd3('0x3')](_0x9fd3('0x4'),_0x3221ec,utils[_0x9fd3('0x5')](_0xf53f95[0x0],this));_0x25ff67[_0x9fd3('0x6')]();}catch(_0x5c744e){logger[_0x9fd3('0x7')](_0x9fd3('0x4'),_0x3221ec,JSON[_0x9fd3('0x8')](_0x5c744e));_0x25ff67[_0x9fd3('0x9')]();}};}; \ No newline at end of file +var _0x5eb1=['consequence','[%s][NOOP]\x20%s','getMustacheRender','next','stringify','../../../../config/logger','routing'];(function(_0x4adace,_0x1ee566){var _0x5e0496=function(_0x2dcf1f){while(--_0x2dcf1f){_0x4adace['push'](_0x4adace['shift']());}};_0x5e0496(++_0x1ee566);}(_0x5eb1,0x7c));var _0x15eb=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x5eb1[_0x487b0c];return _0x1adbdc;};'use strict';var utils=require('./utils');var logger=require(_0x15eb('0x0'))(_0x15eb('0x1'));exports[_0x15eb('0x2')]=function(_0x3ef699,_0x2b9937){return function(_0x1c2f32){try{logger['info'](_0x15eb('0x3'),_0x3ef699,utils[_0x15eb('0x4')](_0x2b9937[0x0],this));_0x1c2f32[_0x15eb('0x5')]();}catch(_0x46b053){logger['error'](_0x15eb('0x3'),_0x3ef699,JSON[_0x15eb('0x6')](_0x46b053));_0x1c2f32['stop']();}};}; \ 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 cfbd997..92eee50 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(_0x75658c,_0x55af78){var _0x1b6108=function(_0x142797){while(--_0x142797){_0x75658c['push'](_0x75658c['shift']());}};_0x1b6108(++_0x55af78);}(_0x34e8,0x12c));var _0x834e=function(_0x2ab1ca,_0x13fd26){_0x2ab1ca=_0x2ab1ca-0x0;var _0x31be35=_0x34e8[_0x2ab1ca];return _0x31be35;};'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(_0x53e325,_0x1bf6bf){var _0x569a94=function(_0x48dd1f){while(--_0x48dd1f){_0x53e325['push'](_0x53e325['shift']());}};_0x569a94(++_0x1bf6bf);}(_0xedd9,0xfc));var _0x9edd=function(_0xc538e,_0x3eb245){_0xc538e=_0xc538e-0x0;var _0x439257=_0xedd9[_0xc538e];return _0x439257;};'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 0ba1d9a..b2266d8 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 _0x06c4=['timeout','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','notificationId','writeLog','RINGING','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','exports','lodash','./util','routing','squeue','agent','realtime','push','handleRun','bind','handleTimeout'];(function(_0x4e804c,_0x5a93c2){var _0x598bc4=function(_0x488c2f){while(--_0x488c2f){_0x4e804c['push'](_0x4e804c['shift']());}};_0x598bc4(++_0x5a93c2);}(_0x06c4,0x122));var _0x406c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x06c4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x406c('0x0'));var uuid=require('uuid');var util=require(_0x406c('0x1'));var logger=require('../../../../../config/logger')(_0x406c('0x2'));var Agent=function(_0x462ef1,_0xc52481,_0x2b88a0,_0x44db61){this['notificationId']=uuid['v4']();this[_0x406c('0x3')]=_0x462ef1;this[_0x406c('0x4')]=_0xc52481;this[_0x406c('0x5')]=_0x2b88a0;this['routing']=_0x44db61;this[_0x406c('0x3')][_0x406c('0x6')](this[_0x406c('0x7')][_0x406c('0x8')](this),this[_0x406c('0x9')]['bind'](this));this[_0x406c('0x3')]['on'](_0x406c('0xa'),this[_0x406c('0x9')][_0x406c('0x8')](this));this[_0x406c('0x3')]['on']('drained',this[_0x406c('0xb')][_0x406c('0x8')](this));};Agent[_0x406c('0xc')][_0x406c('0x6')]=function(){this[_0x406c('0x3')][_0x406c('0x6')](this[_0x406c('0x7')]['bind'](this),this[_0x406c('0x9')][_0x406c('0x8')](this));};Agent[_0x406c('0xc')]['handleDrained']=function(){this[_0x406c('0x9')](!![]);};Agent[_0x406c('0xc')][_0x406c('0x7')]=function(_0xecd600){logger[_0x406c('0xd')](_0x406c('0xe'),this['squeue']['id'],this[_0x406c('0x4')]['id']);if(_[_0x406c('0xf')](this[_0x406c('0x5')][_0x406c('0x10')][this[_0x406c('0x4')]['id']])){logger[_0x406c('0xd')](_0x406c('0x11'),this[_0x406c('0x3')]['id'],this[_0x406c('0x4')]['id']);setTimeout(this[_0x406c('0x6')][_0x406c('0x8')](this),0x3e8);}else{if(this[_0x406c('0x2')][_0x406c('0x12')]||util[_0x406c('0x13')](this[_0x406c('0x3')]['id'],this[_0x406c('0x5')][_0x406c('0x10')][this[_0x406c('0x4')]['id']],this['squeue'][_0x406c('0x14')],![])){this[_0x406c('0x5')]['agents'][this[_0x406c('0x4')]['id']][_0x406c('0x15')]=!![];this['realtime'][_0x406c('0x10')][this['agent']['id']][_0x406c('0x16')]=undefined;util['showNotification'](this[_0x406c('0x17')],this['squeue']['id'],this['realtime'][_0x406c('0x10')][this[_0x406c('0x4')]['id']],null,this[_0x406c('0x2')]);util[_0x406c('0x18')](this[_0x406c('0x3')]['id'],this['realtime'][_0x406c('0x10')][this[_0x406c('0x4')]['id']],_0x406c('0x19')+(this[_0x406c('0x2')][_0x406c('0x12')]?':FORCED':''));}else{logger[_0x406c('0xd')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x406c('0x3')]['id'],this[_0x406c('0x4')]['id']);setTimeout(this[_0x406c('0x6')][_0x406c('0x8')](this),0x3e8);}}};Agent[_0x406c('0xc')][_0x406c('0x9')]=function(_0x524848){if(_[_0x406c('0xf')](this[_0x406c('0x5')][_0x406c('0x10')][this[_0x406c('0x4')]['id']])){return logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x406c('0x3')]['id'],this['agent']['id']);}else{logger[_0x406c('0xd')](_0x406c('0x1a'),this[_0x406c('0x3')]['id'],this[_0x406c('0x4')]['id']);util[_0x406c('0x1b')](this['notificationId'],this[_0x406c('0x3')]['id'],this['realtime']['agents'][this[_0x406c('0x4')]['id']],null,this[_0x406c('0x2')]);this['realtime']['agents'][this[_0x406c('0x4')]['id']][_0x406c('0x15')]=![];this['realtime'][_0x406c('0x10')][this[_0x406c('0x4')]['id']][_0x406c('0x16')]=undefined;util['writeLog'](this[_0x406c('0x3')]['id'],this[_0x406c('0x5')][_0x406c('0x10')][this['agent']['id']],_0x524848?_0x406c('0x1c'):'TIMEOUT');}if(!_0x524848){setTimeout(this[_0x406c('0x6')]['bind'](this),0x3e8);}};function agent(_0x4f23c0,_0x385aa5,_0x1ef9a3,_0x32a00f){return new Agent(_0x4f23c0,_0x385aa5,_0x1ef9a3,_0x32a00f);}module[_0x406c('0x1d')]=agent; \ No newline at end of file +var _0x08f6=['[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','STOP','TIMEOUT','exports','lodash','routing','squeue','agent','realtime','push','bind','handleTimeout','timeout','drained','handleRun','prototype','handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','agents'];(function(_0x2e24b9,_0x30471d){var _0x204c3d=function(_0x5acb99){while(--_0x5acb99){_0x2e24b9['push'](_0x2e24b9['shift']());}};_0x204c3d(++_0x30471d);}(_0x08f6,0x110));var _0x608f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x08f6[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x608f('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require('../../../../../config/logger')(_0x608f('0x1'));var Agent=function(_0x2c239b,_0x2734be,_0x4d0fc7,_0x1f6f91){this['notificationId']=uuid['v4']();this[_0x608f('0x2')]=_0x2c239b;this[_0x608f('0x3')]=_0x2734be;this[_0x608f('0x4')]=_0x4d0fc7;this[_0x608f('0x1')]=_0x1f6f91;this['squeue'][_0x608f('0x5')](this['handleRun'][_0x608f('0x6')](this),this[_0x608f('0x7')][_0x608f('0x6')](this));this[_0x608f('0x2')]['on'](_0x608f('0x8'),this[_0x608f('0x7')][_0x608f('0x6')](this));this['squeue']['on'](_0x608f('0x9'),this['handleDrained'][_0x608f('0x6')](this));};Agent['prototype']['push']=function(){this[_0x608f('0x2')][_0x608f('0x5')](this[_0x608f('0xa')][_0x608f('0x6')](this),this['handleTimeout'][_0x608f('0x6')](this));};Agent[_0x608f('0xb')][_0x608f('0xc')]=function(){this[_0x608f('0x7')](!![]);};Agent['prototype'][_0x608f('0xa')]=function(_0x3cb5a3){logger[_0x608f('0xd')](_0x608f('0xe'),this['squeue']['id'],this[_0x608f('0x3')]['id']);if(_['isNil'](this[_0x608f('0x4')][_0x608f('0xf')][this[_0x608f('0x3')]['id']])){logger[_0x608f('0xd')](_0x608f('0x10'),this['squeue']['id'],this[_0x608f('0x3')]['id']);setTimeout(this[_0x608f('0x5')][_0x608f('0x6')](this),0x3e8);}else{if(this[_0x608f('0x1')][_0x608f('0x11')]||util[_0x608f('0x12')](this[_0x608f('0x2')]['id'],this[_0x608f('0x4')][_0x608f('0xf')][this[_0x608f('0x3')]['id']],this['squeue'][_0x608f('0x13')],![])){this[_0x608f('0x4')][_0x608f('0xf')][this[_0x608f('0x3')]['id']][_0x608f('0x14')]=!![];this[_0x608f('0x4')]['agents'][this[_0x608f('0x3')]['id']][_0x608f('0x15')]=undefined;util[_0x608f('0x16')](this[_0x608f('0x17')],this[_0x608f('0x2')]['id'],this[_0x608f('0x4')][_0x608f('0xf')][this['agent']['id']],null,this[_0x608f('0x1')]);util[_0x608f('0x18')](this[_0x608f('0x2')]['id'],this[_0x608f('0x4')][_0x608f('0xf')][this[_0x608f('0x3')]['id']],_0x608f('0x19')+(this[_0x608f('0x1')][_0x608f('0x11')]?_0x608f('0x1a'):''));}else{logger['info'](_0x608f('0x1b'),this[_0x608f('0x2')]['id'],this[_0x608f('0x3')]['id']);setTimeout(this['push'][_0x608f('0x6')](this),0x3e8);}}};Agent[_0x608f('0xb')][_0x608f('0x7')]=function(_0x32f511){if(_['isNil'](this[_0x608f('0x4')]['agents'][this[_0x608f('0x3')]['id']])){return logger[_0x608f('0xd')](_0x608f('0x10'),this[_0x608f('0x2')]['id'],this['agent']['id']);}else{logger[_0x608f('0xd')]('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this['agent']['id']);util[_0x608f('0x1c')](this[_0x608f('0x17')],this[_0x608f('0x2')]['id'],this['realtime'][_0x608f('0xf')][this[_0x608f('0x3')]['id']],null,this[_0x608f('0x1')]);this[_0x608f('0x4')][_0x608f('0xf')][this[_0x608f('0x3')]['id']][_0x608f('0x14')]=![];this[_0x608f('0x4')][_0x608f('0xf')][this[_0x608f('0x3')]['id']][_0x608f('0x15')]=undefined;util[_0x608f('0x18')](this['squeue']['id'],this[_0x608f('0x4')][_0x608f('0xf')][this[_0x608f('0x3')]['id']],_0x32f511?_0x608f('0x1d'):_0x608f('0x1e'));}if(!_0x32f511){setTimeout(this['push'][_0x608f('0x6')](this),0x3e8);}};function agent(_0x45e5c5,_0x1aa943,_0x13f42e,_0x4b757d){return new Agent(_0x45e5c5,_0x1aa943,_0x13f42e,_0x4b757d);}module[_0x608f('0x1f')]=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 c5e5924..2bcd49c 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 _0xee6e=['isNil','agents','info','isAgentAvailable','channel','writeLog','RINGING','busy','busyQueue','name','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','STOP','exports','lodash','uuid','./util','routing','notificationId','realtime','squeue','push','handleRun','bind','handleTimeout','timeout','handleDrained','prototype','queue','Agents','length'];(function(_0xde8fa2,_0x4fa3f8){var _0x38bb8e=function(_0x898f88){while(--_0x898f88){_0xde8fa2['push'](_0xde8fa2['shift']());}};_0x38bb8e(++_0x4fa3f8);}(_0xee6e,0xaf));var _0xeee6=function(_0x4ab03e,_0x1ebd79){_0x4ab03e=_0x4ab03e-0x0;var _0x176c2e=_0xee6e[_0x4ab03e];return _0x176c2e;};'use strict';var _=require(_0xeee6('0x0'));var uuid=require(_0xeee6('0x1'));var util=require(_0xeee6('0x2'));var logger=require('../../../../../config/logger')(_0xeee6('0x3'));var Beepall=function(_0x1c0c89,_0x560e47,_0x59df55,_0x5b8f4a){this[_0xeee6('0x4')]=uuid['v4']();this['squeue']=_0x1c0c89;this['queue']=_0x560e47;this[_0xeee6('0x5')]=_0x59df55;this[_0xeee6('0x3')]=_0x5b8f4a;this[_0xeee6('0x6')][_0xeee6('0x7')](this[_0xeee6('0x8')][_0xeee6('0x9')](this),this[_0xeee6('0xa')][_0xeee6('0x9')](this));this['squeue']['on'](_0xeee6('0xb'),this[_0xeee6('0xa')][_0xeee6('0x9')](this));this[_0xeee6('0x6')]['on']('drained',this[_0xeee6('0xc')][_0xeee6('0x9')](this));};Beepall[_0xeee6('0xd')][_0xeee6('0x7')]=function(){this[_0xeee6('0x6')][_0xeee6('0x7')](this['handleRun'][_0xeee6('0x9')](this),this[_0xeee6('0xa')][_0xeee6('0x9')](this));};Beepall[_0xeee6('0xd')][_0xeee6('0xc')]=function(_0x2d56cf){this['handleTimeout'](!![]);};Beepall['prototype'][_0xeee6('0x8')]=function(_0x5956a8){var _0x5e692b=!![];if(!_['isNil'](this[_0xeee6('0xe')])&&!_['isNil'](this[_0xeee6('0xe')][_0xeee6('0xf')])&&this['queue']['Agents'][_0xeee6('0x10')]>0x0){for(var _0x1155d5=0x0,_0x4ef240;_0x1155d50x0){for(var _0x2c731c=0x0,_0xb42c99;_0x2c731c0x0&&_0x31a704[_0x500473+_0x738e('0x23')]>=_0x31a704[_0x500473+_0x738e('0x24')]){writeLog(_0x17ac1e,_0x31a704,_0x500473['toUpperCase']()+_0x738e('0x25'));return![];}}return!![];};exports[_0x738e('0x26')]=function(_0x3b4a25,_0x471af6,_0x17b36a,_0x37c2dc,_0x2e3a94){return sendNotification(!![],_0x3b4a25,_0x471af6,_0x17b36a,_0x37c2dc,_0x2e3a94);};exports[_0x738e('0x27')]=function(_0x1dd816,_0x129fcb,_0x187475,_0xcb715f,_0x222fa5){return sendNotification(![],_0x1dd816,_0x129fcb,_0x187475,_0xcb715f,_0x222fa5);};exports[_0x738e('0x28')]=writeLog; \ No newline at end of file +var _0xb11e=['CurrentCapacity','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','lodash','util','../utils','mustache','ioredis','routing','redis','defaults','socket.io-emitter','format','user:%s','name','emit','user:save','split','\x20interaction','account','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','save','remove','isAgentAvailable','busy','BUSY','online','Pause','Capacity','hasOwnProperty'];(function(_0x113575,_0x1da20b){var _0x8c9e67=function(_0x2e2779){while(--_0x2e2779){_0x113575['push'](_0x113575['shift']());}};_0x8c9e67(++_0x1da20b);}(_0xb11e,0x7d));var _0xeb11=function(_0x21970c,_0x1488bc){_0x21970c=_0x21970c-0x0;var _0x1e8ec9=_0xb11e[_0x21970c];return _0x1e8ec9;};'use strict';var _=require(_0xeb11('0x0'));var util=require(_0xeb11('0x1'));var utils=require(_0xeb11('0x2'));var Mustache=require(_0xeb11('0x3'));var Redis=require(_0xeb11('0x4'));var config=require('../../../../../config/environment');var logger=require('../../../../../config/logger')(_0xeb11('0x5'));config[_0xeb11('0x6')]=_[_0xeb11('0x7')](config[_0xeb11('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xeb11('0x8'))(new Redis(config['redis']));function emit(_0x53b7a1,_0x203d78,_0x4994a2){io['to'](_0x53b7a1)['emit'](_0x203d78,_0x4994a2);}function sendNotification(_0xfa9ff7,_0x216209,_0xb2b1c3,_0x4841d3,_0x35ce4c,_0x2e3052){io['to'](util[_0xeb11('0x9')](_0xeb11('0xa'),_0x4841d3[_0xeb11('0xb')]))[_0xeb11('0xc')](_0xeb11('0xd'),_0x4841d3);var _0x5041d2=_0x2e3052||{};var _0x492308=_0xb2b1c3[_0xeb11('0xe')]('.');var _0x3f020f={'uniqueid':_0x216209,'channel':_0x492308[0x0],'id':_0x492308[0x1],'title':_0x492308[0x0]+_0xeb11('0xf'),'interactionId':_0x492308[0x2],'queue':_0x35ce4c?_0x35ce4c['name']:null,'sound':_0x5041d2[_0xeb11('0x10')]['notificationSound'],'shake':_0x5041d2[_0xeb11('0x10')]['notificationShake']};try{if(!_0x5041d2['body']){_0x5041d2[_0xeb11('0x11')]={};}if(_0x35ce4c){_0x5041d2[_0xeb11('0x11')][_0xeb11('0x12')]=_0x35ce4c;}else if(_0x5041d2[_0xeb11('0x11')]['queue']){delete _0x5041d2['body'][_0xeb11('0x12')];}_0x3f020f[_0xeb11('0x13')]=utils[_0xeb11('0x14')](_0x5041d2['account'][_0xeb11('0x15')],_0x5041d2);}catch(_0x5152f4){_0x3f020f[_0xeb11('0x13')]=_0xeb11('0x16');logger[_0xeb11('0x17')](util['format'](_0xeb11('0x18'),_0x216209,_0x5152f4[_0xeb11('0x19')]));}io['to'](util['format']('user:%s',_0x4841d3[_0xeb11('0xb')]))[_0xeb11('0xc')](util['format']('notification:%s',_0xfa9ff7?_0xeb11('0x1a'):_0xeb11('0x1b')),_0x3f020f);}function writeLog(_0x4dfe03,_0x505c22,_0x17af28){return logger['info'](util['format']('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x4dfe03,_0x505c22[_0xeb11('0xb')],_0x17af28));}exports[_0xeb11('0x1c')]=function(_0x4a0850,_0x1738b6,_0x40a4cb,_0x53e48d){if(_0x1738b6[_0xeb11('0x1d')]){writeLog(_0x4a0850,_0x1738b6,_0xeb11('0x1e'));return![];}if(!_0x1738b6[_0xeb11('0x1f')]){writeLog(_0x4a0850,_0x1738b6,'OFFLINE');return![];}if(_0x1738b6[_0x40a4cb+_0xeb11('0x20')]){writeLog(_0x4a0850,_0x1738b6,'PAUSE');return![];}if(_0x53e48d&&_0x1738b6['hasOwnProperty'](_0x40a4cb+_0xeb11('0x21'))&&_0x1738b6[_0xeb11('0x22')](_0x40a4cb+_0xeb11('0x23'))){if(_0x1738b6[_0x40a4cb+'Capacity']>0x0&&_0x1738b6[_0x40a4cb+'CurrentCapacity']>=_0x1738b6[_0x40a4cb+_0xeb11('0x21')]){writeLog(_0x4a0850,_0x1738b6,_0x40a4cb['toUpperCase']()+_0xeb11('0x24'));return![];}}return!![];};exports[_0xeb11('0x25')]=function(_0x377abf,_0x34c525,_0x289121,_0x4a0501,_0x1d9bf7){return sendNotification(!![],_0x377abf,_0x34c525,_0x289121,_0x4a0501,_0x1d9bf7);};exports[_0xeb11('0x26')]=function(_0x4ee70a,_0x104561,_0x4bb5b8,_0xa18410,_0x3ed491){return sendNotification(![],_0x4ee70a,_0x104561,_0x4bb5b8,_0xa18410,_0x3ed491);};exports[_0xeb11('0x27')]=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 85d0063..929d47c 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 _0x6d40=['validate','shelljs','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','stringify'];(function(_0x318410,_0x451962){var _0x2898a3=function(_0x58e572){while(--_0x58e572){_0x318410['push'](_0x318410['shift']());}};_0x2898a3(++_0x451962);}(_0x6d40,0x168));var _0x06d4=function(_0x5055d8,_0x510147){_0x5055d8=_0x5055d8-0x0;var _0x303546=_0x6d40[_0x5055d8];return _0x303546;};'use strict';var schema=require(_0x06d4('0x0'));var sh=require(_0x06d4('0x1'));var _=require('lodash');var utils=require('./utils');var logger=require(_0x06d4('0x2'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0x06d4('0x3')}});exports['consequence']=function(_0x187310,_0x3b0ec3){return function(_0x53cf8b){try{var _0x4a4dde={'command':_0x3b0ec3[0x0]};var _0x407a35=system[_0x06d4('0x0')](_0x4a4dde,{'typecast':!![]});if(_0x407a35[_0x06d4('0x4')]){logger['error'](_0x06d4('0x5'),_0x187310,_[_0x06d4('0x6')](_0x407a35,_0x06d4('0x7'))[_0x06d4('0x8')](',\x20'));logger[_0x06d4('0x9')](_0x06d4('0xa'),_0x187310);_0x53cf8b[_0x06d4('0xb')]();}else{var _0x43f6ad=this;var _0x25e4c0=utils[_0x06d4('0xc')](_0x3b0ec3[0x0],this);logger[_0x06d4('0x9')](_0x06d4('0xd'),_0x187310,_0x25e4c0);sh['exec'](_[_0x06d4('0xe')](_0x25e4c0),function(_0x4801d5,_0x3af061){logger[_0x06d4('0x9')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x187310,_0x4801d5);if(_0x4801d5==0x0){var _0x47920c=_0x3af061[_0x06d4('0xf')](/(\r\n|\n|\r)/gm,'');if(_[_0x06d4('0x10')](_0x3b0ec3[0x1])||_[_0x06d4('0x11')](_0x3b0ec3[0x1])){logger['info'](_0x06d4('0x12'),_0x187310);_0x43f6ad[_0x06d4('0x13')][_0x3b0ec3[0x1]]=_0x47920c;}else{logger[_0x06d4('0x9')](_0x06d4('0x14'),_0x187310,_0x3b0ec3[0x1],_0x47920c);_0x43f6ad['body'][_0x3b0ec3[0x1]]=_0x47920c;}}_0x53cf8b[_0x06d4('0xb')]();});}}catch(_0x2b660a){logger[_0x06d4('0x15')](_0x06d4('0x5'),_0x187310,_[_0x06d4('0x16')](_0x2b660a)?JSON[_0x06d4('0x17')](_0x2b660a):_0x2b660a);logger['info'](_0x06d4('0xa'),_0x187310);_0x53cf8b[_0x06d4('0xb')]();}};}; \ No newline at end of file +var _0xfe9b=['[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','lodash','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil'];(function(_0x18a54e,_0x5621b8){var _0x32315b=function(_0x5a60ee){while(--_0x5a60ee){_0x18a54e['push'](_0x18a54e['shift']());}};_0x32315b(++_0x5621b8);}(_0xfe9b,0x1d0));var _0xbfe9=function(_0x3bd05f,_0x70ff9c){_0x3bd05f=_0x3bd05f-0x0;var _0x25fcde=_0xfe9b[_0x3bd05f];return _0x25fcde;};'use strict';var schema=require(_0xbfe9('0x0'));var sh=require(_0xbfe9('0x1'));var _=require(_0xbfe9('0x2'));var utils=require('./utils');var logger=require(_0xbfe9('0x3'))(_0xbfe9('0x4'));var system=schema({'command':{'type':_0xbfe9('0x5'),'required':!![],'message':_0xbfe9('0x6')}});exports[_0xbfe9('0x7')]=function(_0x46034d,_0xeb6a8c){return function(_0x45681b){try{var _0x11f42d={'command':_0xeb6a8c[0x0]};var _0x21c81f=system[_0xbfe9('0x0')](_0x11f42d,{'typecast':!![]});if(_0x21c81f[_0xbfe9('0x8')]){logger[_0xbfe9('0x9')](_0xbfe9('0xa'),_0x46034d,_['map'](_0x21c81f,_0xbfe9('0xb'))[_0xbfe9('0xc')](',\x20'));logger[_0xbfe9('0xd')](_0xbfe9('0xe'),_0x46034d);_0x45681b[_0xbfe9('0xf')]();}else{var _0x2fa674=this;var _0x19e60f=utils['getMustacheRender'](_0xeb6a8c[0x0],this);logger[_0xbfe9('0xd')](_0xbfe9('0x10'),_0x46034d,_0x19e60f);sh[_0xbfe9('0x11')](_[_0xbfe9('0x12')](_0x19e60f),function(_0x13fae5,_0x4c419e){logger[_0xbfe9('0xd')](_0xbfe9('0x13'),_0x46034d,_0x13fae5);if(_0x13fae5==0x0){var _0x1db340=_0x4c419e[_0xbfe9('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0xbfe9('0x15')](_0xeb6a8c[0x1])||_['isEmpty'](_0xeb6a8c[0x1])){logger['info'](_0xbfe9('0x16'),_0x46034d);_0x2fa674[_0xbfe9('0x17')][_0xeb6a8c[0x1]]=_0x1db340;}else{logger[_0xbfe9('0xd')](_0xbfe9('0x18'),_0x46034d,_0xeb6a8c[0x1],_0x1db340);_0x2fa674['body'][_0xeb6a8c[0x1]]=_0x1db340;}}_0x45681b[_0xbfe9('0xf')]();});}}catch(_0x19c346){logger[_0xbfe9('0x9')](_0xbfe9('0xa'),_0x46034d,_[_0xbfe9('0x19')](_0x19c346)?JSON[_0xbfe9('0x1a')](_0x19c346):_0x19c346);logger[_0xbfe9('0xd')](_0xbfe9('0xe'),_0x46034d);_0x45681b[_0xbfe9('0xf')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 06ce667..2e5e241 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 _0xda30=['TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','map','message','join','info','next','channel','addTags','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','[%s][TAG]\x20%s','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number'];(function(_0x1ec849,_0x2d1189){var _0x32f9d6=function(_0x15f867){while(--_0x15f867){_0x1ec849['push'](_0x1ec849['shift']());}};_0x32f9d6(++_0x2d1189);}(_0xda30,0x164));var _0x0da3=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xda30[_0x24259d];return _0x5a701;};'use strict';var schema=require('validate');var _=require(_0x0da3('0x0'));var rpc={'chatInteraction':require(_0x0da3('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x0da3('0x2')),'mailInteraction':require(_0x0da3('0x3')),'faxInteraction':require(_0x0da3('0x4')),'whatsappInteraction':require(_0x0da3('0x5'))};var logger=require('../../../../config/logger')(_0x0da3('0x6'));var tag=schema({'tag':{'type':_0x0da3('0x7'),'required':!![],'message':_0x0da3('0x8')}});exports['consequence']=function(_0x145767,_0x1c5ab1,_0x46bd98,_0x311500){return function(_0x423248){try{var _0x12f9c9={'tag':_0x1c5ab1[0x0]};var _0x3f2189=tag['validate'](_0x12f9c9,{'typecast':!![]});if(_0x3f2189[_0x0da3('0x9')]){logger[_0x0da3('0xa')]('[%s][TAG]\x20%s',_0x145767,_[_0x0da3('0xb')](_0x3f2189,_0x0da3('0xc'))[_0x0da3('0xd')](',\x20'));logger[_0x0da3('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x145767);_0x423248[_0x0da3('0xf')]();}else{var _0x3d1017={'ids':[_0x1c5ab1[0x0]]};if(rpc[_0x311500[_0x0da3('0x10')]+'Interaction']){rpc[_0x311500['channel']+'Interaction'][_0x0da3('0x11')](_0x311500['interaction']['id'],_0x3d1017)['then'](function(_0x408782){logger[_0x0da3('0xe')](_0x0da3('0x12'),_0x145767,_0x1c5ab1[0x1],_0x311500['channel'],_0x311500[_0x0da3('0x13')]['id']);})[_0x0da3('0x14')](function(_0x488d63){logger[_0x0da3('0xa')](_0x0da3('0x15'),_0x145767,JSON[_0x0da3('0x16')](_0x488d63));logger[_0x0da3('0xe')](_0x0da3('0x17'),_0x145767);})[_0x0da3('0x18')](function(){_0x423248['next']();});}}}catch(_0x310989){logger[_0x0da3('0xa')](_0x0da3('0x15'),_0x145767,_[_0x0da3('0x19')](_0x310989)?JSON[_0x0da3('0x16')](_0x310989):_0x310989);logger[_0x0da3('0xe')](_0x0da3('0x17'),_0x145767);_0x423248['next']();}};}; \ No newline at end of file +var _0xf911=['../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][TAG]\x20%s','map','message','join','info','channel','Interaction','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','next','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction'];(function(_0x137f88,_0x418ae3){var _0x1869e7=function(_0x164cfa){while(--_0x164cfa){_0x137f88['push'](_0x137f88['shift']());}};_0x1869e7(++_0x418ae3);}(_0xf911,0x140));var _0x1f91=function(_0x22bea1,_0x39476f){_0x22bea1=_0x22bea1-0x0;var _0x4cc8f9=_0xf911[_0x22bea1];return _0x4cc8f9;};'use strict';var schema=require(_0x1f91('0x0'));var _=require(_0x1f91('0x1'));var rpc={'chatInteraction':require(_0x1f91('0x2')),'openchannelInteraction':require(_0x1f91('0x3')),'smsInteraction':require(_0x1f91('0x4')),'mailInteraction':require(_0x1f91('0x5')),'faxInteraction':require(_0x1f91('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x1f91('0x7'))(_0x1f91('0x8'));var tag=schema({'tag':{'type':_0x1f91('0x9'),'required':!![],'message':_0x1f91('0xa')}});exports['consequence']=function(_0x5d165a,_0x4042fa,_0x11d0db,_0x3f6354){return function(_0x164cc0){try{var _0x31eb9b={'tag':_0x4042fa[0x0]};var _0xf8eb7f=tag[_0x1f91('0x0')](_0x31eb9b,{'typecast':!![]});if(_0xf8eb7f['length']){logger[_0x1f91('0xb')](_0x1f91('0xc'),_0x5d165a,_[_0x1f91('0xd')](_0xf8eb7f,_0x1f91('0xe'))[_0x1f91('0xf')](',\x20'));logger[_0x1f91('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5d165a);_0x164cc0['next']();}else{var _0x2b9c0f={'ids':[_0x4042fa[0x0]]};if(rpc[_0x3f6354[_0x1f91('0x11')]+_0x1f91('0x12')]){rpc[_0x3f6354[_0x1f91('0x11')]+_0x1f91('0x12')]['addTags'](_0x3f6354[_0x1f91('0x13')]['id'],_0x2b9c0f)['then'](function(_0x5e9669){logger['info'](_0x1f91('0x14'),_0x5d165a,_0x4042fa[0x1],_0x3f6354[_0x1f91('0x11')],_0x3f6354['interaction']['id']);})['catch'](function(_0x1982c4){logger[_0x1f91('0xb')]('[%s][TAG]\x20%s',_0x5d165a,JSON[_0x1f91('0x15')](_0x1982c4));logger[_0x1f91('0x10')](_0x1f91('0x16'),_0x5d165a);})[_0x1f91('0x17')](function(){_0x164cc0[_0x1f91('0x18')]();});}}}catch(_0x490828){logger[_0x1f91('0xb')]('[%s][TAG]\x20%s',_0x5d165a,_['isObject'](_0x490828)?JSON[_0x1f91('0x15')](_0x490828):_0x490828);logger[_0x1f91('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5d165a);_0x164cc0[_0x1f91('0x18')]();}};}; \ 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 88514ac..f03e5e9 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 _0xd52a=['body','contact','message','account','lodash','render'];(function(_0x3598bb,_0x24befa){var _0x13c837=function(_0x3de578){while(--_0x3de578){_0x3598bb['push'](_0x3598bb['shift']());}};_0x13c837(++_0x24befa);}(_0xd52a,0xca));var _0xad52=function(_0x43c8ee,_0xe98237){_0x43c8ee=_0x43c8ee-0x0;var _0x2eac54=_0xd52a[_0x43c8ee];return _0x2eac54;};'use strict';var Mustache=require('mustache');var _=require(_0xad52('0x0'));module['exports']={'getMustacheRender':function(_0x14c488,_0x7b9789){return Mustache[_0xad52('0x1')](_0x14c488,_['merge'](_0x7b9789[_0xad52('0x2')],{'contact':_0x7b9789[_0xad52('0x3')],'message':_0x7b9789[_0xad52('0x4')],'account':_0x7b9789[_0xad52('0x5')],'interaction':_0x7b9789['interaction'],'list':_0x7b9789['list']}))||'';}}; \ No newline at end of file +var _0xc252=['mustache','lodash','exports','render','merge','body','account','list'];(function(_0x42f232,_0x3c8ec4){var _0x4e4722=function(_0x45aaa3){while(--_0x45aaa3){_0x42f232['push'](_0x42f232['shift']());}};_0x4e4722(++_0x3c8ec4);}(_0xc252,0x118));var _0x2c25=function(_0x3c991c,_0x15dedf){_0x3c991c=_0x3c991c-0x0;var _0x369bbc=_0xc252[_0x3c991c];return _0x369bbc;};'use strict';var Mustache=require(_0x2c25('0x0'));var _=require(_0x2c25('0x1'));module[_0x2c25('0x2')]={'getMustacheRender':function(_0x2755dd,_0x8c4cec){return Mustache[_0x2c25('0x3')](_0x2755dd,_[_0x2c25('0x4')](_0x8c4cec[_0x2c25('0x5')],{'contact':_0x8c4cec['contact'],'message':_0x8c4cec['message'],'account':_0x8c4cec[_0x2c25('0x6')],'interaction':_0x8c4cec['interaction'],'list':_0x8c4cec[_0x2c25('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 4bf4519..7b7c495 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 _0x02ed=['condition','intervals','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','emit','No\x20applications\x20to\x20execute','stack','end','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agents','agent','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','path','jayson/promise','bluebird','../../../config/environment','../../../config/logger','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','IntervalId','isNil','map','Intervals','interval','listen','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','amazonlex','tag','TagId','./interval'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x02ed,0x1ea));var _0xd02e=function(_0x23724f,_0x19e182){_0x23724f=_0x23724f-0x0;var _0x17c793=_0x02ed[_0x23724f];return _0x17c793;};'use strict';var _=require(_0xd02e('0x0'));var util=require('util');var path=require(_0xd02e('0x1'));var fs=require('fs');var jayson=require(_0xd02e('0x2'));var BPromise=require(_0xd02e('0x3'));var uuid=require('uuid');var config=require(_0xd02e('0x4'));var logger=require(_0xd02e('0x5'))('routing');var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xd02e('0x6')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xd02e('0x7')),'whatsappQueueReport':require(_0xd02e('0x8'))};var RuleEngine=require(_0xd02e('0x9'));function getId(_0x5f2dab,_0x229220,_0x54be7c){return util['format'](_0xd02e('0xa'),_0x5f2dab,_0x229220||0x0,_0x54be7c||0x0);}function getIntervals(_0x534f17,_0x208494){var _0x52cc78=[];if(!_['isNil'](_0x208494[_0xd02e('0xb')])&&!_[_0xd02e('0xc')](_0x534f17[_0x208494[_0xd02e('0xb')]])&&!_[_0xd02e('0xc')](_0x534f17[_0x208494[_0xd02e('0xb')]]['Intervals'])){_0x52cc78=_[_0xd02e('0xd')](_0x534f17[_0x208494['IntervalId']][_0xd02e('0xe')],_0xd02e('0xf'));}else if(!_[_0xd02e('0xc')](_0x208494[_0xd02e('0xf')])){_0x52cc78=[_0x208494[_0xd02e('0xf')]];}return _0x52cc78;}exports[_0xd02e('0x10')]=function(_0x2f1c46){_0x2f1c46['rules']={};return new BPromise(function(_0xd99721,_0x459ec3){var _0x323c54={'Start':function(_0x10eb7e){var _0x4c598d=this;return new Promise(function(_0x36003f,_0x13e511){if(_0x10eb7e){try{var _0x3d0fd7=[];var _0x2ce452=getId(_0x10eb7e[_0xd02e('0x11')],_0x10eb7e[_0xd02e('0x12')]?_0x10eb7e['message']['id']:0x0,_0x10eb7e[_0xd02e('0x13')]?_0x10eb7e['interaction']['id']:0x0);if(_0x10eb7e[_0xd02e('0x14')]&&_[_0xd02e('0x15')](_0x10eb7e['applications'])&&_0x10eb7e[_0xd02e('0x14')]['length']){for(var _0x2f3a92=0x0;_0x2f3a92<_0x10eb7e[_0xd02e('0x14')][_0xd02e('0x16')];_0x2f3a92+=0x1){var _0x3d8ec1=_0x10eb7e[_0xd02e('0x14')][_0x2f3a92];if(fs[_0xd02e('0x17')](path[_0xd02e('0x18')](__dirname,_0xd02e('0x14'),_0x3d8ec1[_0xd02e('0x19')]+_0xd02e('0x1a')))){var _0x4bc607=[];switch(_0x3d8ec1['app'][_0xd02e('0x1b')]()){case _0xd02e('0x1c'):var _0x83c509=_0x3d8ec1[_0xd02e('0x1d')][_0xd02e('0x1e')](',');_0x4bc607[_0xd02e('0x1f')](_0x83c509[0x0]);_0x4bc607[_0xd02e('0x1f')](_0x83c509[_0xd02e('0x20')](0x1,_0x83c509[_0xd02e('0x16')])[_0xd02e('0x18')](','));break;case _0xd02e('0x21'):var _0x3d644d=_0x3d8ec1[_0xd02e('0x1d')][_0xd02e('0x1e')](',');_0x4bc607[_0xd02e('0x1f')](_0x3d644d[0x0]);_0x4bc607[_0xd02e('0x1f')](_0x3d644d[0x1]);_0x4bc607[_0xd02e('0x1f')](_0x3d644d[_0xd02e('0x20')](0x2,_0x3d644d['length'])[_0xd02e('0x18')](','));break;case _0xd02e('0x22'):var _0x59ce57=_0x3d8ec1['appdata'][_0xd02e('0x1e')](',');_0x4bc607['push'](_0x59ce57[0x0]);_0x4bc607[_0xd02e('0x1f')](_0x59ce57[0x1]);_0x4bc607[_0xd02e('0x1f')](_0x59ce57[0x2]);_0x4bc607[_0xd02e('0x1f')](_0x59ce57[0x3]);_0x4bc607[_0xd02e('0x1f')](_0x59ce57[_0xd02e('0x20')](0x4,_0x59ce57[_0xd02e('0x16')])[_0xd02e('0x18')](','));break;case'message':_0x4bc607[_0xd02e('0x1f')](_0x3d8ec1[_0xd02e('0x1d')]);break;case _0xd02e('0x23'):_0x4bc607[_0xd02e('0x1f')](_0x3d8ec1[_0xd02e('0x24')]);_0x4bc607[_0xd02e('0x1f')](_0x3d8ec1[_0xd02e('0x1d')]);break;default:_0x4bc607=_[_0xd02e('0xc')](_0x3d8ec1['appdata'])?[]:_0x3d8ec1[_0xd02e('0x1d')][_0xd02e('0x1e')](',');}var _0x2fc138={'id':util['format']('%s:%s:%s',_0x2ce452,_0x3d8ec1['id'],_0x3d8ec1['app']),'condition':require(_0xd02e('0x25'))[_0xd02e('0x26')](_0x2ce452,getIntervals(_0x2f1c46[_0xd02e('0x27')],_0x3d8ec1),_0x2f1c46),'consequence':require('./applications/'+_0x3d8ec1['app'])[_0xd02e('0x28')](_0x2ce452,_0x4bc607,_0x2f1c46,_0x10eb7e),'p':_0x3d8ec1[_0xd02e('0x29')]||0x0};logger[_0xd02e('0x2a')](_0xd02e('0x2b'),_0x2fc138['id'],_0xd02e('0x2c'),getIntervals(_0x2f1c46['intervals'],_0x3d8ec1)[_0xd02e('0x18')](_0xd02e('0x2d')));_0x3d0fd7['push'](_0x2fc138);}else{logger[_0xd02e('0x2e')](_0xd02e('0x2f'),path[_0xd02e('0x18')](__dirname,_0xd02e('0x14'),_0x3d8ec1[_0xd02e('0x19')]+'.js'));}}_0x2f1c46[_0xd02e('0x30')][_0x2ce452]=new RuleEngine(_0x3d0fd7);_0x2f1c46['rules'][_0x2ce452][_0xd02e('0x31')](_0x10eb7e,function(_0x5ddbe1){logger['info'](_0xd02e('0x32'),JSON['stringify'](_0x5ddbe1['matchPath']));if(_0x2f1c46['rules'][_0x2ce452]){_0x2f1c46['rules'][_0x2ce452][_0xd02e('0x33')]('complete');}});return _0x36003f({'code':0xc8,'message':_0x10eb7e});}else{logger[_0xd02e('0x2a')](_0xd02e('0x34'));return _0x36003f({'code':0xc8,'message':_0x10eb7e});}}catch(_0x1c29cf){logger[_0xd02e('0x2e')](_0x1c29cf[_0xd02e('0x35')]);return _0x13e511(_0x4c598d[_0xd02e('0x2e')](0x1f4,_0x1c29cf));}}return _0x13e511('routing\x20is\x20empty');});},'AcceptMessage':function(_0x4f8e7a){var _0x48b439=this;return new Promise(function(_0x2a0f1c,_0x3a5e79){if(_0x4f8e7a['message']&&_0x4f8e7a[_0xd02e('0x12')]['id']){try{var _0x44d131=getId(_0x4f8e7a[_0xd02e('0x11')],_0x4f8e7a['message']?_0x4f8e7a[_0xd02e('0x12')]['id']:0x0,_0x4f8e7a[_0xd02e('0x13')]?_0x4f8e7a[_0xd02e('0x13')]['id']:0x0);if(_0x2f1c46[_0xd02e('0x30')][_0x44d131]){_0x2f1c46['rules'][_0x44d131]['emit'](_0xd02e('0x36'));if(rpc[_0x4f8e7a['channel']+'QueueReport']){rpc[_0x4f8e7a[_0xd02e('0x11')]+'QueueReport'][_0xd02e('0x37')](_0x44d131,{'UserId':_0x4f8e7a[_0xd02e('0x12')][_0xd02e('0x38')]})[_0xd02e('0x39')](function(_0x4f5a76){logger[_0xd02e('0x2e')](_0xd02e('0x3a'));});}}return _0x2a0f1c({'code':0xc8,'message':_0x4f8e7a});}catch(_0x45a741){logger[_0xd02e('0x2e')](_0x45a741[_0xd02e('0x35')]);return _0x3a5e79(_0x48b439[_0xd02e('0x2e')](0x1f4,_0x45a741));}}logger[_0xd02e('0x2e')]('message\x20is\x20empty');return _0x3a5e79(_0x48b439['error'](0x1f4,_0xd02e('0x3b')));});},'RejectMessage':function(_0x290115){var _0x2040c8=this;return new Promise(function(_0x4286d6,_0x3dda19){if(_0x290115['agent']&&_0x290115['agent']['id']){try{if(_0x2f1c46[_0xd02e('0x3c')][_0x290115[_0xd02e('0x3d')]['id']]){_0x2f1c46[_0xd02e('0x3c')][_0x290115[_0xd02e('0x3d')]['id']]['busy']=![];_0x2f1c46['agents'][_0x290115[_0xd02e('0x3d')]['id']]['busyQueue']=undefined;}return _0x4286d6({'code':0xc8,'message':_0x290115});}catch(_0x8bc5e6){logger[_0xd02e('0x2e')](_0x8bc5e6['stack']);return _0x3dda19(_0x2040c8[_0xd02e('0x2e')](0x1f4,_0x8bc5e6));}}logger[_0xd02e('0x2e')](_0xd02e('0x3b'));return _0x3dda19(_0x2040c8[_0xd02e('0x2e')](0x1f4,_0xd02e('0x3b')));});},'AbandonInteraction':function(_0xd38c33){var _0xbb02e2=this;return new Promise(function(_0x3b45dd,_0x5739c4){if(_0xd38c33['channel']&&_0xd38c33['interaction']&&_0xd38c33[_0xd02e('0x13')]['id']){try{var _0x178b06=getId(_0xd38c33[_0xd02e('0x11')],_0xd38c33[_0xd02e('0x12')]?_0xd38c33[_0xd02e('0x12')]['id']:0x0,_0xd38c33[_0xd02e('0x13')]?_0xd38c33[_0xd02e('0x13')]['id']:0x0);if(_0x2f1c46[_0xd02e('0x30')][_0x178b06]){_0x2f1c46[_0xd02e('0x30')][_0x178b06]['emit'](_0xd02e('0x36'));}return _0x3b45dd({'code':0xc8,'message':_0xd38c33});}catch(_0x1f1585){logger[_0xd02e('0x2e')](_0x1f1585['stack']);return _0x5739c4(_0xbb02e2['error'](0x1f4,_0x1f1585));}}logger[_0xd02e('0x2e')](_0xd02e('0x3b'));return _0x5739c4(_0xbb02e2[_0xd02e('0x2e')](0x1f4,_0xd02e('0x3b')));});},'AgentCapacity':function(_0x4e33e0){var _0x2307ef=this;return new Promise(function(_0x3036c5,_0x37def6){if(_0x2f1c46[_0xd02e('0x3c')][_0xd02e('0x3e')](_0x4e33e0['id'])){for(var _0x31197a in _0x4e33e0['capacity']){if(_0x4e33e0[_0xd02e('0x3f')][_0xd02e('0x3e')](_0x31197a)){if(_0x2f1c46[_0xd02e('0x3c')][_0x4e33e0['id']][_0xd02e('0x3e')](_0x31197a+_0xd02e('0x40'))){_0x2f1c46[_0xd02e('0x3c')][_0x4e33e0['id']][_0x31197a+_0xd02e('0x40')]=parseInt(_0x4e33e0['capacity'][_0x31197a],0xa);}}}_0x2f1c46['agents'][_0x4e33e0['id']][_0xd02e('0x41')]();return _0x3036c5({'code':0xc8,'message':_0x2f1c46[_0xd02e('0x3c')][_0x4e33e0['id']]});}else{return _0x37def6(_0x2307ef[_0xd02e('0x2e')](0x1f4,_0xd02e('0x42')));}});},'Agents':function(_0x33719d){return new Promise(function(_0xff6ac1,_0x29e465){var _0xe38c47=_[_0xd02e('0x43')](_0x2f1c46[_0xd02e('0x3c')]);_0xff6ac1({'count':_0xe38c47[_0xd02e('0x16')],'rows':_0xe38c47});});},'ChatQueues':function(_0xd04a74){return new Promise(function(_0x910faf,_0x5710d1){var _0x233ea2=[];for(var _0x14087f in _0x2f1c46[_0xd02e('0x44')]){if(_0x2f1c46[_0xd02e('0x44')][_0xd02e('0x3e')](_0x14087f)){var _0x10a0e4=_0x2f1c46[_0xd02e('0x44')][_0x14087f];var _0x5a6957={'id':_0x10a0e4['id'],'available':_0x10a0e4[_0xd02e('0x45')],'loggedIn':_0x10a0e4[_0xd02e('0x46')],'name':_0x10a0e4[_0xd02e('0x47')],'paused':_0x10a0e4[_0xd02e('0x48')],'waiting':_0x10a0e4['waiting']};_0x233ea2[_0xd02e('0x1f')](_0x5a6957);}}_0x910faf({'count':_0x233ea2['length'],'rows':_0x233ea2});});},'MailQueues':function(_0x57f3){return new Promise(function(_0x3dedc5,_0x40db2e){var _0x17ab70=[];for(var _0x18fcd7 in _0x2f1c46['mailQueues']){if(_0x2f1c46[_0xd02e('0x49')]['hasOwnProperty'](_0x18fcd7)){var _0x76c9ae=_0x2f1c46[_0xd02e('0x49')][_0x18fcd7];var _0x4ec961={'id':_0x76c9ae['id'],'available':_0x76c9ae[_0xd02e('0x45')],'loggedIn':_0x76c9ae['loggedIn'],'name':_0x76c9ae['name'],'paused':_0x76c9ae['paused'],'waiting':_0x76c9ae[_0xd02e('0x4a')]};_0x17ab70['push'](_0x4ec961);}}_0x3dedc5({'count':_0x17ab70[_0xd02e('0x16')],'rows':_0x17ab70});});},'OpenchannelQueues':function(_0x6eaf78){return new Promise(function(_0x414ad3,_0x50ba04){var _0x31a686=[];for(var _0xa3cfbf in _0x2f1c46[_0xd02e('0x4b')]){if(_0x2f1c46[_0xd02e('0x4b')][_0xd02e('0x3e')](_0xa3cfbf)){var _0x41c41e=_0x2f1c46['openchannelQueues'][_0xa3cfbf];var _0x23dcbd={'id':_0x41c41e['id'],'available':_0x41c41e[_0xd02e('0x45')],'loggedIn':_0x41c41e[_0xd02e('0x46')],'name':_0x41c41e['name'],'paused':_0x41c41e[_0xd02e('0x48')],'waiting':_0x41c41e['waiting']};_0x31a686['push'](_0x23dcbd);}}_0x414ad3({'count':_0x31a686[_0xd02e('0x16')],'rows':_0x31a686});});},'SmsQueues':function(_0x489bab){return new Promise(function(_0x5702c4,_0x381b63){var _0x5d15c5=[];for(var _0x2ef4fb in _0x2f1c46[_0xd02e('0x4c')]){if(_0x2f1c46['smsQueues']['hasOwnProperty'](_0x2ef4fb)){var _0x5cdfa1=_0x2f1c46[_0xd02e('0x4c')][_0x2ef4fb];var _0x4688c={'id':_0x5cdfa1['id'],'available':_0x5cdfa1[_0xd02e('0x45')],'loggedIn':_0x5cdfa1['loggedIn'],'name':_0x5cdfa1[_0xd02e('0x47')],'paused':_0x5cdfa1['paused'],'waiting':_0x5cdfa1['waiting']};_0x5d15c5[_0xd02e('0x1f')](_0x4688c);}}_0x5702c4({'count':_0x5d15c5[_0xd02e('0x16')],'rows':_0x5d15c5});});},'FaxQueues':function(_0x24d11b){return new Promise(function(_0x4a6db2,_0x3da292){var _0x1ac67a=[];for(var _0xccf833 in _0x2f1c46[_0xd02e('0x4d')]){if(_0x2f1c46[_0xd02e('0x4d')][_0xd02e('0x3e')](_0xccf833)){var _0x1932e6=_0x2f1c46['faxQueues'][_0xccf833];var _0x3959a8={'id':_0x1932e6['id'],'available':_0x1932e6[_0xd02e('0x45')],'loggedIn':_0x1932e6[_0xd02e('0x46')],'name':_0x1932e6['name'],'paused':_0x1932e6[_0xd02e('0x48')],'waiting':_0x1932e6[_0xd02e('0x4a')]};_0x1ac67a[_0xd02e('0x1f')](_0x3959a8);}}_0x4a6db2({'count':_0x1ac67a['length'],'rows':_0x1ac67a});});},'WhatsappQueues':function(_0x53b8f1){return new Promise(function(_0x2634dd,_0x48d082){var _0x1c1928=[];for(var _0x4cfa5e in _0x2f1c46[_0xd02e('0x4e')]){if(_0x2f1c46[_0xd02e('0x4e')][_0xd02e('0x3e')](_0x4cfa5e)){var _0x36210a=_0x2f1c46[_0xd02e('0x4e')][_0x4cfa5e];var _0x30a941={'id':_0x36210a['id'],'available':_0x36210a['available'],'loggedIn':_0x36210a[_0xd02e('0x46')],'name':_0x36210a['name'],'paused':_0x36210a['paused'],'waiting':_0x36210a[_0xd02e('0x4a')]};_0x1c1928[_0xd02e('0x1f')](_0x30a941);}}_0x2634dd({'count':_0x1c1928[_0xd02e('0x16')],'rows':_0x1c1928});});},'ChatQueuesWaitingInteractions':function(_0x30bf5f){return new Promise(function(_0x17f418,_0x1882b9){var _0x496e83=_[_0xd02e('0x43')](_0x2f1c46[_0xd02e('0x4f')]);_0x17f418({'count':_0x496e83[_0xd02e('0x16')],'rows':_0x496e83});});},'MailQueuesWaitingInteractions':function(_0x1f527c){return new Promise(function(_0x40eeb4,_0x1b0ce0){var _0x428448=_[_0xd02e('0x43')](_0x2f1c46['mailQueuesWaitingInteractions']);_0x40eeb4({'count':_0x428448[_0xd02e('0x16')],'rows':_0x428448});});},'OpenchannelQueuesWaitingInteractions':function(_0x3a9f5a){return new Promise(function(_0x663240,_0x91a6e5){var _0x1ad387=_[_0xd02e('0x43')](_0x2f1c46[_0xd02e('0x50')]);_0x663240({'count':_0x1ad387['length'],'rows':_0x1ad387});});},'SmsQueuesWaitingInteractions':function(_0x2a9940){return new Promise(function(_0x23c4dd,_0x2f38a2){var _0x114fb9=_['values'](_0x2f1c46[_0xd02e('0x51')]);_0x23c4dd({'count':_0x114fb9[_0xd02e('0x16')],'rows':_0x114fb9});});},'FaxQueuesWaitingInteractions':function(_0xdffeb8){return new Promise(function(_0x4026d7,_0x208fe4){var _0x350e3d=_[_0xd02e('0x43')](_0x2f1c46['faxQueuesWaitingInteractions']);_0x4026d7({'count':_0x350e3d[_0xd02e('0x16')],'rows':_0x350e3d});});},'WhatsappQueuesWaitingInteractions':function(_0x29b552){return new Promise(function(_0x1d4b1f,_0x4fc6a4){var _0x2ae3f4=_[_0xd02e('0x43')](_0x2f1c46[_0xd02e('0x52')]);_0x1d4b1f({'count':_0x2ae3f4['length'],'rows':_0x2ae3f4});});}};var _0x186fec=jayson[_0xd02e('0x53')](_0x323c54)[_0xd02e('0x54')]();_0x186fec['on'](_0xd02e('0x2e'),function(_0x2f0e59){logger['error'](JSON['stringify'](_0x2f0e59));return _0x459ec3(_0x2f0e59);});_0x186fec['listen'](0x232c,_0xd02e('0x55'),function(){console[_0xd02e('0x56')](_0xd02e('0x57'),0x232c);return _0xd99721('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x366a=['waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','bluebird','uuid','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','applications','isArray','length','join','app','.js','toLowerCase','push','slice','dialogflow','appdata','split','tag','%s:%s:%s','./interval','condition','intervals','./applications/','info','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','stringify','matchPath','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','emit','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','values','chatQueues','loggedIn','name','paused'];(function(_0x2faeb9,_0x5aaa9b){var _0x41e536=function(_0x3f9caf){while(--_0x3f9caf){_0x2faeb9['push'](_0x2faeb9['shift']());}};_0x41e536(++_0x5aaa9b);}(_0x366a,0xbe));var _0xa366=function(_0x44fef1,_0x132cf4){_0x44fef1=_0x44fef1-0x0;var _0x3c3a04=_0x366a[_0x44fef1];return _0x3c3a04;};'use strict';var _=require('lodash');var util=require(_0xa366('0x0'));var path=require(_0xa366('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xa366('0x2'));var uuid=require(_0xa366('0x3'));var config=require('../../../config/environment');var logger=require(_0xa366('0x4'))(_0xa366('0x5'));var rpc={'openchannelQueueReport':require(_0xa366('0x6')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xa366('0x7')),'smsQueueReport':require(_0xa366('0x8')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xa366('0x9'))};var RuleEngine=require(_0xa366('0xa'));function getId(_0x3d9a7c,_0xee2ba,_0x3fe06c){return util[_0xa366('0xb')](_0xa366('0xc'),_0x3d9a7c,_0xee2ba||0x0,_0x3fe06c||0x0);}function getIntervals(_0x25ce4a,_0x4c652f){var _0xcec61b=[];if(!_[_0xa366('0xd')](_0x4c652f['IntervalId'])&&!_[_0xa366('0xd')](_0x25ce4a[_0x4c652f[_0xa366('0xe')]])&&!_[_0xa366('0xd')](_0x25ce4a[_0x4c652f[_0xa366('0xe')]][_0xa366('0xf')])){_0xcec61b=_[_0xa366('0x10')](_0x25ce4a[_0x4c652f[_0xa366('0xe')]]['Intervals'],_0xa366('0x11'));}else if(!_[_0xa366('0xd')](_0x4c652f[_0xa366('0x11')])){_0xcec61b=[_0x4c652f[_0xa366('0x11')]];}return _0xcec61b;}exports[_0xa366('0x12')]=function(_0x38584a){_0x38584a['rules']={};return new BPromise(function(_0x34d743,_0x231f1e){var _0x3ba66b={'Start':function(_0x2479fa){var _0x2eb2c8=this;return new Promise(function(_0x53bc15,_0x454db9){if(_0x2479fa){try{var _0x2e21f5=[];var _0x4db7ab=getId(_0x2479fa[_0xa366('0x13')],_0x2479fa[_0xa366('0x14')]?_0x2479fa[_0xa366('0x14')]['id']:0x0,_0x2479fa['interaction']?_0x2479fa[_0xa366('0x15')]['id']:0x0);if(_0x2479fa[_0xa366('0x16')]&&_[_0xa366('0x17')](_0x2479fa[_0xa366('0x16')])&&_0x2479fa['applications'][_0xa366('0x18')]){for(var _0x17cd6c=0x0;_0x17cd6c<_0x2479fa['applications']['length'];_0x17cd6c+=0x1){var _0xcbe081=_0x2479fa[_0xa366('0x16')][_0x17cd6c];if(fs['existsSync'](path[_0xa366('0x19')](__dirname,'applications',_0xcbe081[_0xa366('0x1a')]+_0xa366('0x1b')))){var _0x392207=[];switch(_0xcbe081[_0xa366('0x1a')][_0xa366('0x1c')]()){case'autoreply':var _0x47b0e1=_0xcbe081['appdata']['split'](',');_0x392207[_0xa366('0x1d')](_0x47b0e1[0x0]);_0x392207[_0xa366('0x1d')](_0x47b0e1[_0xa366('0x1e')](0x1,_0x47b0e1[_0xa366('0x18')])[_0xa366('0x19')](','));break;case _0xa366('0x1f'):var _0x3df428=_0xcbe081[_0xa366('0x20')][_0xa366('0x21')](',');_0x392207[_0xa366('0x1d')](_0x3df428[0x0]);_0x392207[_0xa366('0x1d')](_0x3df428[0x1]);_0x392207[_0xa366('0x1d')](_0x3df428[_0xa366('0x1e')](0x2,_0x3df428[_0xa366('0x18')])['join'](','));break;case'amazonlex':var _0x4ab268=_0xcbe081[_0xa366('0x20')]['split'](',');_0x392207[_0xa366('0x1d')](_0x4ab268[0x0]);_0x392207[_0xa366('0x1d')](_0x4ab268[0x1]);_0x392207['push'](_0x4ab268[0x2]);_0x392207[_0xa366('0x1d')](_0x4ab268[0x3]);_0x392207[_0xa366('0x1d')](_0x4ab268['slice'](0x4,_0x4ab268[_0xa366('0x18')])['join'](','));break;case'message':_0x392207['push'](_0xcbe081[_0xa366('0x20')]);break;case _0xa366('0x22'):_0x392207[_0xa366('0x1d')](_0xcbe081['TagId']);_0x392207[_0xa366('0x1d')](_0xcbe081[_0xa366('0x20')]);break;default:_0x392207=_['isNil'](_0xcbe081[_0xa366('0x20')])?[]:_0xcbe081['appdata'][_0xa366('0x21')](',');}var _0x59e645={'id':util[_0xa366('0xb')](_0xa366('0x23'),_0x4db7ab,_0xcbe081['id'],_0xcbe081['app']),'condition':require(_0xa366('0x24'))[_0xa366('0x25')](_0x4db7ab,getIntervals(_0x38584a[_0xa366('0x26')],_0xcbe081),_0x38584a),'consequence':require(_0xa366('0x27')+_0xcbe081['app'])['consequence'](_0x4db7ab,_0x392207,_0x38584a,_0x2479fa),'p':_0xcbe081['priority']||0x0};logger[_0xa366('0x28')](_0xa366('0x29'),_0x59e645['id'],'on\x20interval',getIntervals(_0x38584a[_0xa366('0x26')],_0xcbe081)[_0xa366('0x19')](_0xa366('0x2a')));_0x2e21f5[_0xa366('0x1d')](_0x59e645);}else{logger[_0xa366('0x2b')](_0xa366('0x2c'),path[_0xa366('0x19')](__dirname,_0xa366('0x16'),_0xcbe081[_0xa366('0x1a')]+_0xa366('0x1b')));}}_0x38584a[_0xa366('0x2d')][_0x4db7ab]=new RuleEngine(_0x2e21f5);_0x38584a['rules'][_0x4db7ab][_0xa366('0x2e')](_0x2479fa,function(_0x41d58f){logger[_0xa366('0x28')]('Applications\x20executed',JSON[_0xa366('0x2f')](_0x41d58f[_0xa366('0x30')]));if(_0x38584a[_0xa366('0x2d')][_0x4db7ab]){_0x38584a[_0xa366('0x2d')][_0x4db7ab]['emit'](_0xa366('0x31'));}});return _0x53bc15({'code':0xc8,'message':_0x2479fa});}else{logger['info'](_0xa366('0x32'));return _0x53bc15({'code':0xc8,'message':_0x2479fa});}}catch(_0x4b12c2){logger['error'](_0x4b12c2[_0xa366('0x33')]);return _0x454db9(_0x2eb2c8['error'](0x1f4,_0x4b12c2));}}return _0x454db9(_0xa366('0x34'));});},'AcceptMessage':function(_0x4107c9){var _0x4cd1ad=this;return new Promise(function(_0x3fa600,_0x1a6a96){if(_0x4107c9['message']&&_0x4107c9[_0xa366('0x14')]['id']){try{var _0x2510e0=getId(_0x4107c9[_0xa366('0x13')],_0x4107c9[_0xa366('0x14')]?_0x4107c9[_0xa366('0x14')]['id']:0x0,_0x4107c9['interaction']?_0x4107c9[_0xa366('0x15')]['id']:0x0);if(_0x38584a[_0xa366('0x2d')][_0x2510e0]){_0x38584a[_0xa366('0x2d')][_0x2510e0][_0xa366('0x35')](_0xa366('0x36'));if(rpc[_0x4107c9[_0xa366('0x13')]+_0xa366('0x37')]){rpc[_0x4107c9[_0xa366('0x13')]+_0xa366('0x37')][_0xa366('0x38')](_0x2510e0,{'UserId':_0x4107c9[_0xa366('0x14')]['UserId']})[_0xa366('0x39')](function(_0x47f692){logger[_0xa366('0x2b')](_0xa366('0x3a'));});}}return _0x3fa600({'code':0xc8,'message':_0x4107c9});}catch(_0x1af31f){logger[_0xa366('0x2b')](_0x1af31f[_0xa366('0x33')]);return _0x1a6a96(_0x4cd1ad[_0xa366('0x2b')](0x1f4,_0x1af31f));}}logger[_0xa366('0x2b')](_0xa366('0x3b'));return _0x1a6a96(_0x4cd1ad['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x512959){var _0x527612=this;return new Promise(function(_0x3bdd24,_0x40b306){if(_0x512959[_0xa366('0x3c')]&&_0x512959[_0xa366('0x3c')]['id']){try{if(_0x38584a[_0xa366('0x3d')][_0x512959['agent']['id']]){_0x38584a[_0xa366('0x3d')][_0x512959[_0xa366('0x3c')]['id']][_0xa366('0x3e')]=![];_0x38584a['agents'][_0x512959[_0xa366('0x3c')]['id']][_0xa366('0x3f')]=undefined;}return _0x3bdd24({'code':0xc8,'message':_0x512959});}catch(_0x2680f2){logger[_0xa366('0x2b')](_0x2680f2[_0xa366('0x33')]);return _0x40b306(_0x527612[_0xa366('0x2b')](0x1f4,_0x2680f2));}}logger['error'](_0xa366('0x3b'));return _0x40b306(_0x527612[_0xa366('0x2b')](0x1f4,_0xa366('0x3b')));});},'AbandonInteraction':function(_0x38d1f1){var _0x4c0a70=this;return new Promise(function(_0xc25742,_0x17de30){if(_0x38d1f1['channel']&&_0x38d1f1[_0xa366('0x15')]&&_0x38d1f1[_0xa366('0x15')]['id']){try{var _0x3fc0e9=getId(_0x38d1f1['channel'],_0x38d1f1[_0xa366('0x14')]?_0x38d1f1['message']['id']:0x0,_0x38d1f1['interaction']?_0x38d1f1[_0xa366('0x15')]['id']:0x0);if(_0x38584a[_0xa366('0x2d')][_0x3fc0e9]){_0x38584a[_0xa366('0x2d')][_0x3fc0e9][_0xa366('0x35')](_0xa366('0x36'));}return _0xc25742({'code':0xc8,'message':_0x38d1f1});}catch(_0x81a44c){logger[_0xa366('0x2b')](_0x81a44c['stack']);return _0x17de30(_0x4c0a70[_0xa366('0x2b')](0x1f4,_0x81a44c));}}logger[_0xa366('0x2b')](_0xa366('0x3b'));return _0x17de30(_0x4c0a70[_0xa366('0x2b')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x3b3b9b){var _0x50cbcf=this;return new Promise(function(_0x231be3,_0x44a523){if(_0x38584a[_0xa366('0x3d')][_0xa366('0x40')](_0x3b3b9b['id'])){for(var _0x230a69 in _0x3b3b9b['capacity']){if(_0x3b3b9b[_0xa366('0x41')]['hasOwnProperty'](_0x230a69)){if(_0x38584a[_0xa366('0x3d')][_0x3b3b9b['id']][_0xa366('0x40')](_0x230a69+'CurrentCapacity')){_0x38584a[_0xa366('0x3d')][_0x3b3b9b['id']][_0x230a69+'CurrentCapacity']=parseInt(_0x3b3b9b[_0xa366('0x41')][_0x230a69],0xa);}}}_0x38584a[_0xa366('0x3d')][_0x3b3b9b['id']]['updateRealtime']();return _0x231be3({'code':0xc8,'message':_0x38584a[_0xa366('0x3d')][_0x3b3b9b['id']]});}else{return _0x44a523(_0x50cbcf[_0xa366('0x2b')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x184c00){return new Promise(function(_0x36cee7,_0x4faeed){var _0x110739=_[_0xa366('0x42')](_0x38584a['agents']);_0x36cee7({'count':_0x110739[_0xa366('0x18')],'rows':_0x110739});});},'ChatQueues':function(_0x5c7fe5){return new Promise(function(_0x5764a6,_0x2ab200){var _0x17923b=[];for(var _0x111d38 in _0x38584a[_0xa366('0x43')]){if(_0x38584a[_0xa366('0x43')][_0xa366('0x40')](_0x111d38)){var _0x12b591=_0x38584a[_0xa366('0x43')][_0x111d38];var _0x129a53={'id':_0x12b591['id'],'available':_0x12b591['available'],'loggedIn':_0x12b591[_0xa366('0x44')],'name':_0x12b591[_0xa366('0x45')],'paused':_0x12b591[_0xa366('0x46')],'waiting':_0x12b591[_0xa366('0x47')]};_0x17923b[_0xa366('0x1d')](_0x129a53);}}_0x5764a6({'count':_0x17923b['length'],'rows':_0x17923b});});},'MailQueues':function(_0x3ba105){return new Promise(function(_0x5194a7,_0x33ddf6){var _0x513171=[];for(var _0x2ac36b in _0x38584a[_0xa366('0x48')]){if(_0x38584a[_0xa366('0x48')][_0xa366('0x40')](_0x2ac36b)){var _0x5c23e1=_0x38584a[_0xa366('0x48')][_0x2ac36b];var _0x21d038={'id':_0x5c23e1['id'],'available':_0x5c23e1[_0xa366('0x49')],'loggedIn':_0x5c23e1[_0xa366('0x44')],'name':_0x5c23e1[_0xa366('0x45')],'paused':_0x5c23e1['paused'],'waiting':_0x5c23e1[_0xa366('0x47')]};_0x513171['push'](_0x21d038);}}_0x5194a7({'count':_0x513171[_0xa366('0x18')],'rows':_0x513171});});},'OpenchannelQueues':function(_0x2e5bfc){return new Promise(function(_0x430bf3,_0x454c9a){var _0x5793ea=[];for(var _0x5aa51b in _0x38584a['openchannelQueues']){if(_0x38584a['openchannelQueues'][_0xa366('0x40')](_0x5aa51b)){var _0x5760ba=_0x38584a[_0xa366('0x4a')][_0x5aa51b];var _0x306a37={'id':_0x5760ba['id'],'available':_0x5760ba[_0xa366('0x49')],'loggedIn':_0x5760ba[_0xa366('0x44')],'name':_0x5760ba['name'],'paused':_0x5760ba[_0xa366('0x46')],'waiting':_0x5760ba[_0xa366('0x47')]};_0x5793ea[_0xa366('0x1d')](_0x306a37);}}_0x430bf3({'count':_0x5793ea[_0xa366('0x18')],'rows':_0x5793ea});});},'SmsQueues':function(_0x1f3003){return new Promise(function(_0x22cbf3,_0x5a438a){var _0x579920=[];for(var _0x944842 in _0x38584a['smsQueues']){if(_0x38584a[_0xa366('0x4b')][_0xa366('0x40')](_0x944842)){var _0x5bbc7d=_0x38584a['smsQueues'][_0x944842];var _0x165c55={'id':_0x5bbc7d['id'],'available':_0x5bbc7d['available'],'loggedIn':_0x5bbc7d['loggedIn'],'name':_0x5bbc7d[_0xa366('0x45')],'paused':_0x5bbc7d['paused'],'waiting':_0x5bbc7d[_0xa366('0x47')]};_0x579920[_0xa366('0x1d')](_0x165c55);}}_0x22cbf3({'count':_0x579920[_0xa366('0x18')],'rows':_0x579920});});},'FaxQueues':function(_0x1a1b15){return new Promise(function(_0xdc3918,_0x55012a){var _0x2102c1=[];for(var _0x584196 in _0x38584a[_0xa366('0x4c')]){if(_0x38584a[_0xa366('0x4c')][_0xa366('0x40')](_0x584196)){var _0x3ce76b=_0x38584a['faxQueues'][_0x584196];var _0x2a359b={'id':_0x3ce76b['id'],'available':_0x3ce76b['available'],'loggedIn':_0x3ce76b['loggedIn'],'name':_0x3ce76b[_0xa366('0x45')],'paused':_0x3ce76b[_0xa366('0x46')],'waiting':_0x3ce76b[_0xa366('0x47')]};_0x2102c1['push'](_0x2a359b);}}_0xdc3918({'count':_0x2102c1[_0xa366('0x18')],'rows':_0x2102c1});});},'WhatsappQueues':function(_0x18e924){return new Promise(function(_0x1dbf5d,_0x1e881d){var _0x624b93=[];for(var _0x1c3af2 in _0x38584a[_0xa366('0x4d')]){if(_0x38584a[_0xa366('0x4d')]['hasOwnProperty'](_0x1c3af2)){var _0x4d3728=_0x38584a[_0xa366('0x4d')][_0x1c3af2];var _0x25ee3d={'id':_0x4d3728['id'],'available':_0x4d3728['available'],'loggedIn':_0x4d3728[_0xa366('0x44')],'name':_0x4d3728['name'],'paused':_0x4d3728[_0xa366('0x46')],'waiting':_0x4d3728[_0xa366('0x47')]};_0x624b93[_0xa366('0x1d')](_0x25ee3d);}}_0x1dbf5d({'count':_0x624b93[_0xa366('0x18')],'rows':_0x624b93});});},'ChatQueuesWaitingInteractions':function(_0x397d77){return new Promise(function(_0xfde85f,_0x452208){var _0x465d1a=_[_0xa366('0x42')](_0x38584a[_0xa366('0x4e')]);_0xfde85f({'count':_0x465d1a[_0xa366('0x18')],'rows':_0x465d1a});});},'MailQueuesWaitingInteractions':function(_0x86bf0a){return new Promise(function(_0x5baddf,_0x524038){var _0xf57bdc=_[_0xa366('0x42')](_0x38584a[_0xa366('0x4f')]);_0x5baddf({'count':_0xf57bdc[_0xa366('0x18')],'rows':_0xf57bdc});});},'OpenchannelQueuesWaitingInteractions':function(_0x581ac1){return new Promise(function(_0x42c6bb,_0x29c219){var _0xb4b2c3=_[_0xa366('0x42')](_0x38584a[_0xa366('0x50')]);_0x42c6bb({'count':_0xb4b2c3['length'],'rows':_0xb4b2c3});});},'SmsQueuesWaitingInteractions':function(_0x5490eb){return new Promise(function(_0x4070d3,_0x4dcf4f){var _0x5f1b9e=_[_0xa366('0x42')](_0x38584a[_0xa366('0x51')]);_0x4070d3({'count':_0x5f1b9e[_0xa366('0x18')],'rows':_0x5f1b9e});});},'FaxQueuesWaitingInteractions':function(_0x250ade){return new Promise(function(_0x152077,_0x5c485b){var _0x50a55e=_['values'](_0x38584a[_0xa366('0x52')]);_0x152077({'count':_0x50a55e[_0xa366('0x18')],'rows':_0x50a55e});});},'WhatsappQueuesWaitingInteractions':function(_0x175f65){return new Promise(function(_0x3bc2cc,_0x35f055){var _0x4df28b=_[_0xa366('0x42')](_0x38584a[_0xa366('0x53')]);_0x3bc2cc({'count':_0x4df28b['length'],'rows':_0x4df28b});});}};var _0x285308=jayson[_0xa366('0x54')](_0x3ba66b)['http']();_0x285308['on']('error',function(_0x4507c0){logger['error'](JSON[_0xa366('0x2f')](_0x4507c0));return _0x231f1e(_0x4507c0);});_0x285308[_0xa366('0x12')](0x232c,'127.0.0.1',function(){console['log'](_0xa366('0x55'),0x232c);return _0x34d743(_0xa366('0x56')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 25d3aac..11e04bf 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 _0xde6e=['../../../config/logger','routing','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','[%s][INTERVAL]\x20%s','some','join','\x20|\x20','when','log','[%s][INTERVAL]\x20%s\x20%s','stop','util','bluebird','lodash'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xde6e,0x174));var _0xede6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xde6e[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xede6('0x0'));var BPromise=require(_0xede6('0x1'));var jayson=require('jayson/promise');var _=require(_0xede6('0x2'));var logger=require(_0xede6('0x3'))(_0xede6('0x4'));var client=jayson['client']['http']({'port':0x232a});function request(_0x390c80,_0x4fe3c2){return new BPromise(function(_0x5b080f,_0xd7afd1){return client['request'](_0x390c80,_0x4fe3c2)[_0xede6('0x5')](function(_0x550a06){if(_0x550a06[_0xede6('0x6')]){return _0xd7afd1(_0x550a06[_0xede6('0x6')][_0xede6('0x7')]);}else{return _0x5b080f(_0x550a06[_0xede6('0x8')]);}})[_0xede6('0x9')](function(_0x50e920){return _0xd7afd1(_0x50e920);});});}exports[_0xede6('0xa')]=function(_0x4b8fee,_0x1baf4f,_0x24353d){return function(_0x4bffd7){if(_0x24353d[_0xede6('0xb')]&&!_0x24353d[_0xede6('0xb')][_0x4b8fee]){logger[_0xede6('0xc')](_0xede6('0xd'),_0x4b8fee);return _0x4bffd7['stop']();}var _0x44c5a2=[];for(var _0x6431c4=0x0;_0x6431c4<_0x1baf4f[_0xede6('0xe')];_0x6431c4+=0x1){_0x44c5a2[_0xede6('0xf')](request(_0xede6('0x10'),{'command':util['format']('iftime\x20%s',_0x1baf4f[_0x6431c4])})['then'](function(_0xd89306){return _0xd89306&&_0xd89306[_0xede6('0x7')]&&_0xd89306[_0xede6('0x7')]['indexOf']('true')>=0x0?!![]:![];})['catch'](function(_0x3a61c5){logger['error'](_0xede6('0x11'),_0x4b8fee,_0x1baf4f[_0x6431c4]);}));}BPromise['all'](_0x44c5a2)[_0xede6('0x5')](function(_0x34d354){var _0x4b156b=_[_0xede6('0x12')](_0x34d354);logger[_0xede6('0xc')]('[%s][INTERVAL]\x20%s\x20%s',_0x4b8fee,_0x1baf4f[_0xede6('0x13')](_0xede6('0x14')),_0x4b156b);_0x4bffd7[_0xede6('0x15')](_0x4b156b);})['catch'](function(_0xa1e56a){console[_0xede6('0x16')](_0xa1e56a);logger['error'](_0xede6('0x17'),_0x4b8fee,_0x1baf4f[_0xede6('0x13')](_0xede6('0x14')),_0xa1e56a['stack']);_0x4bffd7[_0xede6('0x18')]();});};}; \ No newline at end of file +var _0x1f1f=['format','iftime\x20%s','indexOf','true','all','some','join','when','log','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','request','then','error','message','result','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0x1f1f,0x16c));var _0xf1f1=function(_0x2e4cbf,_0x8763d3){_0x2e4cbf=_0x2e4cbf-0x0;var _0x52840f=_0x1f1f[_0x2e4cbf];return _0x52840f;};'use strict';var util=require(_0xf1f1('0x0'));var BPromise=require(_0xf1f1('0x1'));var jayson=require(_0xf1f1('0x2'));var _=require(_0xf1f1('0x3'));var logger=require(_0xf1f1('0x4'))(_0xf1f1('0x5'));var client=jayson[_0xf1f1('0x6')]['http']({'port':0x232a});function request(_0x4be86b,_0x3c35de){return new BPromise(function(_0x21babc,_0x594ab3){return client[_0xf1f1('0x7')](_0x4be86b,_0x3c35de)[_0xf1f1('0x8')](function(_0x55546c){if(_0x55546c[_0xf1f1('0x9')]){return _0x594ab3(_0x55546c[_0xf1f1('0x9')][_0xf1f1('0xa')]);}else{return _0x21babc(_0x55546c[_0xf1f1('0xb')]);}})[_0xf1f1('0xc')](function(_0x36d2ff){return _0x594ab3(_0x36d2ff);});});}exports['condition']=function(_0x10cd90,_0x325555,_0x47b09a){return function(_0x228dfc){if(_0x47b09a[_0xf1f1('0xd')]&&!_0x47b09a[_0xf1f1('0xd')][_0x10cd90]){logger[_0xf1f1('0xe')](_0xf1f1('0xf'),_0x10cd90);return _0x228dfc[_0xf1f1('0x10')]();}var _0xae1a88=[];for(var _0x5900f6=0x0;_0x5900f6<_0x325555[_0xf1f1('0x11')];_0x5900f6+=0x1){_0xae1a88[_0xf1f1('0x12')](request(_0xf1f1('0x13'),{'command':util[_0xf1f1('0x14')](_0xf1f1('0x15'),_0x325555[_0x5900f6])})[_0xf1f1('0x8')](function(_0x165900){return _0x165900&&_0x165900['message']&&_0x165900[_0xf1f1('0xa')][_0xf1f1('0x16')](_0xf1f1('0x17'))>=0x0?!![]:![];})['catch'](function(_0x2d750f){logger[_0xf1f1('0x9')]('[%s][INTERVAL]\x20%s',_0x10cd90,_0x325555[_0x5900f6]);}));}BPromise[_0xf1f1('0x18')](_0xae1a88)[_0xf1f1('0x8')](function(_0x3f407d){var _0x171fea=_[_0xf1f1('0x19')](_0x3f407d);logger[_0xf1f1('0xe')]('[%s][INTERVAL]\x20%s\x20%s',_0x10cd90,_0x325555[_0xf1f1('0x1a')]('\x20|\x20'),_0x171fea);_0x228dfc[_0xf1f1('0x1b')](_0x171fea);})[_0xf1f1('0xc')](function(_0x4ecc1f){console[_0xf1f1('0x1c')](_0x4ecc1f);logger[_0xf1f1('0x9')](_0xf1f1('0x1d'),_0x10cd90,_0x325555[_0xf1f1('0x1a')](_0xf1f1('0x1e')),_0x4ecc1f[_0xf1f1('0x1f')]);_0x228dfc[_0xf1f1('0x10')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 468026c..3ed30a5 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 _0x8ccd=['agent','util','./utils','info','format','uniqueid','channel','queue','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','connectedlinename','error','agentringnoanswer','isNil','agentringnoanswerAt','now','timeout','reason','holdtime','ringtime','talktime','push','stack','queuecallerabandon','includes','abandoned','agentconnectAt','connect','answered_elsewhere','membername','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','cause','rejected','indexOf'];(function(_0x119d88,_0x12168f){var _0x305737=function(_0x31b511){while(--_0x31b511){_0x119d88['push'](_0x119d88['shift']());}};_0x305737(++_0x12168f);}(_0x8ccd,0x93));var _0xd8cc=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x8ccd[_0x4b7b62];return _0x2280df;};'use strict';var _=require('lodash');var util=require(_0xd8cc('0x0'));var utils=require(_0xd8cc('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x466d87,_0x538c63){utils[_0xd8cc('0x2')](util[_0xd8cc('0x3')]('AGENT|%s|%s|%s|%s|%s|%s|%s|%s',_0x466d87[_0xd8cc('0x4')],_0x466d87[_0xd8cc('0x5')],_0x466d87[_0xd8cc('0x6')],_0x466d87['membername'],_0x466d87[_0xd8cc('0x7')],_0x466d87[_0xd8cc('0x8')],_0x466d87[_0xd8cc('0x9')],_0x466d87[_0xd8cc('0xa')]));if(_0x466d87[_0xd8cc('0x6')]){utils[_0xd8cc('0xb')](_0x466d87[_0xd8cc('0x6')])[_0xd8cc('0xc')](function(_0x3f97aa){if(_0x3f97aa){_0x466d87[_0xd8cc('0xd')]=_0x3f97aa['type'];_0x466d87[_0xd8cc('0xe')]=_0x466d87[_0xd8cc('0xf')]?_0x3f97aa[_0xd8cc('0x10')]:![];_0x466d87[_0xd8cc('0x11')]=_0x466d87[_0xd8cc('0xe')]?_0x3f97aa[_0xd8cc('0x12')]:0x0;}utils[_0xd8cc('0x13')](_0xd8cc('0x14'),_0x466d87);});}else{utils['request'](_0xd8cc('0x14'),_0x466d87);}if(_0x538c63){delete transfers[_0x466d87['uniqueid']];}else{delete agents[_0x466d87[_0xd8cc('0x15')]];}}exports[_0xd8cc('0x16')]=function(_0x427ae4){try{agents[_0x427ae4['destuniqueid']]=_0x427ae4;agents[_0x427ae4[_0xd8cc('0x15')]][_0xd8cc('0x17')]=utils['now']();agents[_0x427ae4[_0xd8cc('0x15')]]['lastevent']='called';agents[_0x427ae4[_0xd8cc('0x15')]]['connectedlinenum']=null;agents[_0x427ae4[_0xd8cc('0x15')]][_0xd8cc('0x18')]=null;}catch(_0x3612f9){utils[_0xd8cc('0x19')](_0x3612f9['stack']);}};exports[_0xd8cc('0x1a')]=function(_0x3a0eda){try{if(!_[_0xd8cc('0x1b')](agents[_0x3a0eda['destuniqueid']])){agents[_0x3a0eda[_0xd8cc('0x15')]][_0xd8cc('0x1a')]=!![];agents[_0x3a0eda[_0xd8cc('0x15')]][_0xd8cc('0x1c')]=utils[_0xd8cc('0x1d')]();agents[_0x3a0eda[_0xd8cc('0x15')]]['lastevent']=_0xd8cc('0x1e');agents[_0x3a0eda[_0xd8cc('0x15')]][_0xd8cc('0x1f')]=_0xd8cc('0x1e');agents[_0x3a0eda['destuniqueid']][_0xd8cc('0x20')]=_0x3a0eda[_0xd8cc('0x21')]?parseInt(_0x3a0eda[_0xd8cc('0x21')])/0x3e8:0x0;agents[_0x3a0eda['destuniqueid']][_0xd8cc('0x22')]=0x0;unanswered[_0xd8cc('0x23')](_0x3a0eda[_0xd8cc('0x15')]);}}catch(_0x39011e){utils[_0xd8cc('0x19')](_0x39011e[_0xd8cc('0x24')]);}};exports[_0xd8cc('0x25')]=function(_0x2700a5){try{_['forIn'](agents,function(_0x117b25,_0x298000){if(_0x117b25[_0xd8cc('0x4')]==_0x2700a5[_0xd8cc('0x4')]&&!_[_0xd8cc('0x26')](unanswered,_0x117b25[_0xd8cc('0x15')])){_0x117b25[_0xd8cc('0x1a')]=!![];_0x117b25['agentringnoanswerAt']=utils[_0xd8cc('0x1d')]();_0x117b25[_0xd8cc('0xa')]=_0xd8cc('0x27');_0x117b25[_0xd8cc('0x1f')]=_0xd8cc('0x27');_0x117b25[_0xd8cc('0x20')]=_0x2700a5[_0xd8cc('0x20')];_0x117b25[_0xd8cc('0x22')]=0x0;writeDB(_0x117b25);}});}catch(_0x467b07){utils[_0xd8cc('0x19')](_0x467b07['stack']);}};exports['agentconnect']=function(_0x55f584){try{if(agents[_0x55f584['destuniqueid']]){agents[_0x55f584[_0xd8cc('0x15')]][_0xd8cc('0x28')]=utils['now']();agents[_0x55f584[_0xd8cc('0x15')]][_0xd8cc('0x9')]=_0x55f584[_0xd8cc('0x9')];agents[_0x55f584['destuniqueid']][_0xd8cc('0x18')]=_0x55f584[_0xd8cc('0x18')];agents[_0x55f584[_0xd8cc('0x15')]][_0xd8cc('0x20')]=_0x55f584[_0xd8cc('0x21')];agents[_0x55f584[_0xd8cc('0x15')]][_0xd8cc('0xa')]=_0xd8cc('0x29');_['forIn'](agents,function(_0x494f62,_0x1bd332){if(_0x494f62[_0xd8cc('0x15')]!=_0x55f584[_0xd8cc('0x15')]&&_0x494f62[_0xd8cc('0x4')]==_0x55f584[_0xd8cc('0x4')]){_0x494f62[_0xd8cc('0x22')]=0x0;_0x494f62['holdtime']=_0x55f584['ringtime'];_0x494f62[_0xd8cc('0x1a')]=!![];_0x494f62[_0xd8cc('0x1c')]=utils['now']();_0x494f62[_0xd8cc('0xa')]='answered_elsewhere';_0x494f62['reason']=_0xd8cc('0x2a');_0x494f62['answeredelsewheredestinationuniqueid']=_0x55f584[_0xd8cc('0x15')];_0x494f62['answeredelsewheremembername']=_0x55f584[_0xd8cc('0x2b')];writeDB(_0x494f62);}});}}catch(_0x4d6729){utils[_0xd8cc('0x19')](_0x4d6729[_0xd8cc('0x24')]);}};exports['agentcomplete']=function(_0x2acab9){try{if(!_['isNil'](agents[_0x2acab9[_0xd8cc('0x15')]])){agents[_0x2acab9['destuniqueid']][_0xd8cc('0xf')]=!![];agents[_0x2acab9['destuniqueid']][_0xd8cc('0x2c')]=utils[_0xd8cc('0x1d')]();agents[_0x2acab9[_0xd8cc('0x15')]][_0xd8cc('0x22')]=utils[_0xd8cc('0x2d')](agents[_0x2acab9['destuniqueid']][_0xd8cc('0x2c')],agents[_0x2acab9[_0xd8cc('0x15')]][_0xd8cc('0x28')]);agents[_0x2acab9[_0xd8cc('0x15')]][_0xd8cc('0x1f')]=_0x2acab9[_0xd8cc('0x1f')];agents[_0x2acab9[_0xd8cc('0x15')]]['lastevent']=_0xd8cc('0x2e');writeDB(agents[_0x2acab9[_0xd8cc('0x15')]]);}}catch(_0x10d135){utils['error'](_0x10d135[_0xd8cc('0x24')]);}};exports[_0xd8cc('0x2f')]=function(_0x1964c6){try{if(!_['isNil'](agents[_0x1964c6[_0xd8cc('0x30')]])){agents[_0x1964c6['transfereruniqueid']][_0xd8cc('0x31')]=!![];agents[_0x1964c6['transfereruniqueid']][_0xd8cc('0x32')]=_0xd8cc('0x33');agents[_0x1964c6[_0xd8cc('0x30')]][_0xd8cc('0x34')]=_0x1964c6[_0xd8cc('0x35')];agents[_0x1964c6[_0xd8cc('0x30')]][_0xd8cc('0x36')]=agents[_0x1964c6['transfereruniqueid']][_0xd8cc('0x4')];}}catch(_0x33d468){utils['error'](_0x33d468[_0xd8cc('0x24')]);}};exports[_0xd8cc('0x37')]=function(_0x3426c4){try{if(_0x3426c4[_0xd8cc('0x38')]==_0x3426c4[_0xd8cc('0x39')]){if(!_[_0xd8cc('0x1b')](agents[_0x3426c4[_0xd8cc('0x3a')]])){agents[_0x3426c4['secondtransfereruniqueid']]['transfer']=!![];agents[_0x3426c4[_0xd8cc('0x3a')]][_0xd8cc('0x32')]=_0xd8cc('0x3b');agents[_0x3426c4[_0xd8cc('0x3a')]][_0xd8cc('0x34')]=_0x3426c4[_0xd8cc('0x3c')];agents[_0x3426c4[_0xd8cc('0x3a')]][_0xd8cc('0x36')]=_0x3426c4[_0xd8cc('0x38')];}if(_0x3426c4[_0xd8cc('0x3d')]&&agents[_0x3426c4['transfereeuniqueid']]){agents[_0x3426c4[_0xd8cc('0x3d')]][_0xd8cc('0x3e')]=0x1;transfers[_0x3426c4['transfereeuniqueid']]=_[_0xd8cc('0x3f')](agents[_0x3426c4[_0xd8cc('0x3d')]]);transfers[_0x3426c4['transfereeuniqueid']][_0xd8cc('0x8')]=agents[_0x3426c4['secondtransfereruniqueid']][_0xd8cc('0x8')];transfers[_0x3426c4[_0xd8cc('0x3d')]][_0xd8cc('0x40')]=agents[_0x3426c4[_0xd8cc('0x3a')]][_0xd8cc('0x40')];transfers[_0x3426c4['transfereeuniqueid']]['agentcalledAt']=utils[_0xd8cc('0x1d')]();transfers[_0x3426c4[_0xd8cc('0x3d')]][_0xd8cc('0x28')]=utils['now']();transfers[_0x3426c4[_0xd8cc('0x3d')]]['holdtime']=0x0;transfers[_0x3426c4[_0xd8cc('0x3d')]][_0xd8cc('0x3e')]=0x2;}}else if(_0x3426c4[_0xd8cc('0x3a')]==_0x3426c4[_0xd8cc('0x41')]){if(!_['isNil'](agents[_0x3426c4[_0xd8cc('0x38')]])){agents[_0x3426c4[_0xd8cc('0x38')]][_0xd8cc('0x31')]=!![];agents[_0x3426c4[_0xd8cc('0x38')]][_0xd8cc('0x32')]=_0xd8cc('0x3b');agents[_0x3426c4[_0xd8cc('0x38')]]['transferexten']=_0x3426c4[_0xd8cc('0x42')];agents[_0x3426c4[_0xd8cc('0x38')]][_0xd8cc('0x36')]=_0x3426c4['secondtransfereruniqueid'];}if(_0x3426c4[_0xd8cc('0x43')]&&agents[_0x3426c4[_0xd8cc('0x43')]]){agents[_0x3426c4[_0xd8cc('0x43')]][_0xd8cc('0x3e')]=0x1;transfers[_0x3426c4[_0xd8cc('0x43')]]=_[_0xd8cc('0x3f')](agents[_0x3426c4[_0xd8cc('0x43')]]);transfers[_0x3426c4[_0xd8cc('0x43')]][_0xd8cc('0x8')]=agents[_0x3426c4[_0xd8cc('0x38')]][_0xd8cc('0x8')];transfers[_0x3426c4['transfertargetuniqueid']]['calleridname']=agents[_0x3426c4[_0xd8cc('0x38')]][_0xd8cc('0x40')];transfers[_0x3426c4[_0xd8cc('0x43')]][_0xd8cc('0x17')]=utils['now']();transfers[_0x3426c4[_0xd8cc('0x43')]][_0xd8cc('0x28')]=utils[_0xd8cc('0x1d')]();transfers[_0x3426c4[_0xd8cc('0x43')]][_0xd8cc('0x20')]=0x0;transfers[_0x3426c4[_0xd8cc('0x43')]][_0xd8cc('0x3e')]=0x2;}}}catch(_0x444701){utils[_0xd8cc('0x19')](_0x444701[_0xd8cc('0x24')]);}};exports[_0xd8cc('0x44')]=function(_0xe5102b){try{if(agents[_0xe5102b[_0xd8cc('0x4')]]&&agents[_0xe5102b['uniqueid']][_0xd8cc('0x1f')]===_0xd8cc('0x1e')){if(_0xe5102b[_0xd8cc('0x45')]==='21'){agents[_0xe5102b[_0xd8cc('0x4')]]['reason']=_0xd8cc('0x46');agents[_0xe5102b[_0xd8cc('0x4')]][_0xd8cc('0xa')]='rejected';}writeDB(agents[_0xe5102b[_0xd8cc('0x4')]]);var _0x596a0f=unanswered[_0xd8cc('0x47')](_0xe5102b[_0xd8cc('0x4')]);if(_0x596a0f>-0x1)unanswered['splice'](_0x596a0f,0x1);}if(transfers[_0xe5102b[_0xd8cc('0x4')]]){transfers[_0xe5102b[_0xd8cc('0x4')]][_0xd8cc('0xf')]=!![];transfers[_0xe5102b[_0xd8cc('0x4')]][_0xd8cc('0x2c')]=utils[_0xd8cc('0x1d')]();transfers[_0xe5102b[_0xd8cc('0x4')]][_0xd8cc('0x22')]=utils[_0xd8cc('0x2d')](transfers[_0xe5102b[_0xd8cc('0x4')]][_0xd8cc('0x2c')],transfers[_0xe5102b[_0xd8cc('0x4')]][_0xd8cc('0x28')]);transfers[_0xe5102b[_0xd8cc('0x4')]][_0xd8cc('0x1f')]=_0xd8cc('0x48');transfers[_0xe5102b[_0xd8cc('0x4')]][_0xd8cc('0xa')]=_0xd8cc('0x2e');writeDB(transfers[_0xe5102b[_0xd8cc('0x4')]],!![]);}if(agents[_0xe5102b[_0xd8cc('0x4')]]&&agents[_0xe5102b['uniqueid']]['agentconnectAt']){agents[_0xe5102b['uniqueid']][_0xd8cc('0xf')]=!![];agents[_0xe5102b[_0xd8cc('0x4')]][_0xd8cc('0x2c')]=utils['now']();agents[_0xe5102b[_0xd8cc('0x4')]]['talktime']=utils[_0xd8cc('0x2d')](agents[_0xe5102b['uniqueid']][_0xd8cc('0x2c')],agents[_0xe5102b[_0xd8cc('0x4')]][_0xd8cc('0x28')]);agents[_0xe5102b['uniqueid']][_0xd8cc('0x1f')]=agents[_0xe5102b[_0xd8cc('0x4')]]['transfer']?'transfer':'agent';agents[_0xe5102b[_0xd8cc('0x4')]][_0xd8cc('0xa')]='complete';writeDB(agents[_0xe5102b[_0xd8cc('0x4')]]);}}catch(_0x521dc1){utils[_0xd8cc('0x19')](_0x521dc1[_0xd8cc('0x24')]);}}; \ No newline at end of file +var _0x4db9=['info','format','uniqueid','queue','interface','calleridnum','lastevent','then','type','agentacw','agentcomplete','acw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalledAt','connectedlinenum','connectedlinename','error','stack','isNil','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','queuecallerabandon','forIn','includes','agentringnoanswer','now','abandoned','agentconnectAt','answered_elsewhere','answeredelsewheremembername','membername','agentcompleteAt','diffTime','blindtransfer','transfereruniqueid','transfer','transfertype','blind','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid','cause','rejected','indexOf','splice','agent','complete','lodash','util','./utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4db9,0x1d9));var _0x94db=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0x4db9[_0x1602ef];return _0x5870ee;};'use strict';var _=require(_0x94db('0x0'));var util=require(_0x94db('0x1'));var utils=require(_0x94db('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x45ed49,_0x58f4c1){utils[_0x94db('0x3')](util[_0x94db('0x4')]('AGENT|%s|%s|%s|%s|%s|%s|%s|%s',_0x45ed49[_0x94db('0x5')],_0x45ed49['channel'],_0x45ed49[_0x94db('0x6')],_0x45ed49['membername'],_0x45ed49[_0x94db('0x7')],_0x45ed49[_0x94db('0x8')],_0x45ed49['connectedlinenum'],_0x45ed49[_0x94db('0x9')]));if(_0x45ed49['queue']){utils['getVoiceQueueByName'](_0x45ed49[_0x94db('0x6')])[_0x94db('0xa')](function(_0x338976){if(_0x338976){_0x45ed49[_0x94db('0xb')]=_0x338976['type'];_0x45ed49[_0x94db('0xc')]=_0x45ed49[_0x94db('0xd')]?_0x338976[_0x94db('0xe')]:![];_0x45ed49['acwtime']=_0x45ed49['agentacw']?_0x338976[_0x94db('0xf')]:0x0;}utils[_0x94db('0x10')](_0x94db('0x11'),_0x45ed49);});}else{utils[_0x94db('0x10')]('CreateVoiceAgentReport',_0x45ed49);}if(_0x58f4c1){delete transfers[_0x45ed49[_0x94db('0x5')]];}else{delete agents[_0x45ed49[_0x94db('0x12')]];}}exports['agentcalled']=function(_0xb123db){try{agents[_0xb123db[_0x94db('0x12')]]=_0xb123db;agents[_0xb123db[_0x94db('0x12')]][_0x94db('0x13')]=utils['now']();agents[_0xb123db[_0x94db('0x12')]][_0x94db('0x9')]='called';agents[_0xb123db[_0x94db('0x12')]][_0x94db('0x14')]=null;agents[_0xb123db[_0x94db('0x12')]][_0x94db('0x15')]=null;}catch(_0x39c22a){utils[_0x94db('0x16')](_0x39c22a[_0x94db('0x17')]);}};exports['agentringnoanswer']=function(_0x4e9788){try{if(!_[_0x94db('0x18')](agents[_0x4e9788[_0x94db('0x12')]])){agents[_0x4e9788['destuniqueid']]['agentringnoanswer']=!![];agents[_0x4e9788['destuniqueid']][_0x94db('0x19')]=utils['now']();agents[_0x4e9788[_0x94db('0x12')]]['lastevent']=_0x94db('0x1a');agents[_0x4e9788[_0x94db('0x12')]][_0x94db('0x1b')]='timeout';agents[_0x4e9788[_0x94db('0x12')]][_0x94db('0x1c')]=_0x4e9788[_0x94db('0x1d')]?parseInt(_0x4e9788[_0x94db('0x1d')])/0x3e8:0x0;agents[_0x4e9788[_0x94db('0x12')]][_0x94db('0x1e')]=0x0;unanswered['push'](_0x4e9788['destuniqueid']);}}catch(_0x4b1538){utils[_0x94db('0x16')](_0x4b1538['stack']);}};exports[_0x94db('0x1f')]=function(_0xc6ed43){try{_[_0x94db('0x20')](agents,function(_0x3461d0,_0xbe085f){if(_0x3461d0[_0x94db('0x5')]==_0xc6ed43['uniqueid']&&!_[_0x94db('0x21')](unanswered,_0x3461d0[_0x94db('0x12')])){_0x3461d0[_0x94db('0x22')]=!![];_0x3461d0[_0x94db('0x19')]=utils[_0x94db('0x23')]();_0x3461d0[_0x94db('0x9')]=_0x94db('0x24');_0x3461d0[_0x94db('0x1b')]=_0x94db('0x24');_0x3461d0[_0x94db('0x1c')]=_0xc6ed43[_0x94db('0x1c')];_0x3461d0[_0x94db('0x1e')]=0x0;writeDB(_0x3461d0);}});}catch(_0x1bdccd){utils[_0x94db('0x16')](_0x1bdccd['stack']);}};exports['agentconnect']=function(_0x25aa63){try{if(agents[_0x25aa63[_0x94db('0x12')]]){agents[_0x25aa63[_0x94db('0x12')]][_0x94db('0x25')]=utils[_0x94db('0x23')]();agents[_0x25aa63[_0x94db('0x12')]][_0x94db('0x14')]=_0x25aa63[_0x94db('0x14')];agents[_0x25aa63[_0x94db('0x12')]][_0x94db('0x15')]=_0x25aa63[_0x94db('0x15')];agents[_0x25aa63[_0x94db('0x12')]][_0x94db('0x1c')]=_0x25aa63[_0x94db('0x1d')];agents[_0x25aa63['destuniqueid']]['lastevent']='connect';_[_0x94db('0x20')](agents,function(_0x20da98,_0x2b7dc1){if(_0x20da98[_0x94db('0x12')]!=_0x25aa63[_0x94db('0x12')]&&_0x20da98[_0x94db('0x5')]==_0x25aa63[_0x94db('0x5')]){_0x20da98[_0x94db('0x1e')]=0x0;_0x20da98[_0x94db('0x1c')]=_0x25aa63[_0x94db('0x1d')];_0x20da98['agentringnoanswer']=!![];_0x20da98[_0x94db('0x19')]=utils[_0x94db('0x23')]();_0x20da98['lastevent']=_0x94db('0x26');_0x20da98[_0x94db('0x1b')]=_0x94db('0x26');_0x20da98['answeredelsewheredestinationuniqueid']=_0x25aa63['destuniqueid'];_0x20da98[_0x94db('0x27')]=_0x25aa63[_0x94db('0x28')];writeDB(_0x20da98);}});}}catch(_0x1a0cf3){utils[_0x94db('0x16')](_0x1a0cf3[_0x94db('0x17')]);}};exports['agentcomplete']=function(_0x509faf){try{if(!_[_0x94db('0x18')](agents[_0x509faf[_0x94db('0x12')]])){agents[_0x509faf[_0x94db('0x12')]][_0x94db('0xd')]=!![];agents[_0x509faf[_0x94db('0x12')]][_0x94db('0x29')]=utils['now']();agents[_0x509faf[_0x94db('0x12')]][_0x94db('0x1e')]=utils[_0x94db('0x2a')](agents[_0x509faf[_0x94db('0x12')]][_0x94db('0x29')],agents[_0x509faf['destuniqueid']][_0x94db('0x25')]);agents[_0x509faf[_0x94db('0x12')]]['reason']=_0x509faf[_0x94db('0x1b')];agents[_0x509faf['destuniqueid']][_0x94db('0x9')]='complete';writeDB(agents[_0x509faf[_0x94db('0x12')]]);}}catch(_0x4b2178){utils[_0x94db('0x16')](_0x4b2178[_0x94db('0x17')]);}};exports[_0x94db('0x2b')]=function(_0x4165bc){try{if(!_[_0x94db('0x18')](agents[_0x4165bc[_0x94db('0x2c')]])){agents[_0x4165bc['transfereruniqueid']][_0x94db('0x2d')]=!![];agents[_0x4165bc[_0x94db('0x2c')]][_0x94db('0x2e')]=_0x94db('0x2f');agents[_0x4165bc[_0x94db('0x2c')]]['transferexten']=_0x4165bc['extension'];agents[_0x4165bc[_0x94db('0x2c')]][_0x94db('0x30')]=agents[_0x4165bc[_0x94db('0x2c')]][_0x94db('0x5')];}}catch(_0x1a5eea){utils[_0x94db('0x16')](_0x1a5eea[_0x94db('0x17')]);}};exports[_0x94db('0x31')]=function(_0x39ebf6){try{if(_0x39ebf6[_0x94db('0x32')]==_0x39ebf6[_0x94db('0x33')]){if(!_[_0x94db('0x18')](agents[_0x39ebf6[_0x94db('0x34')]])){agents[_0x39ebf6['secondtransfereruniqueid']]['transfer']=!![];agents[_0x39ebf6[_0x94db('0x34')]][_0x94db('0x2e')]='ATTENDED';agents[_0x39ebf6[_0x94db('0x34')]]['transferexten']=_0x39ebf6[_0x94db('0x35')];agents[_0x39ebf6[_0x94db('0x34')]][_0x94db('0x30')]=_0x39ebf6[_0x94db('0x32')];}if(_0x39ebf6[_0x94db('0x36')]&&agents[_0x39ebf6[_0x94db('0x36')]]){agents[_0x39ebf6[_0x94db('0x36')]][_0x94db('0x37')]=0x1;transfers[_0x39ebf6[_0x94db('0x36')]]=_[_0x94db('0x38')](agents[_0x39ebf6[_0x94db('0x36')]]);transfers[_0x39ebf6[_0x94db('0x36')]]['calleridnum']=agents[_0x39ebf6['secondtransfereruniqueid']][_0x94db('0x8')];transfers[_0x39ebf6[_0x94db('0x36')]][_0x94db('0x39')]=agents[_0x39ebf6[_0x94db('0x34')]][_0x94db('0x39')];transfers[_0x39ebf6[_0x94db('0x36')]][_0x94db('0x13')]=utils[_0x94db('0x23')]();transfers[_0x39ebf6[_0x94db('0x36')]][_0x94db('0x25')]=utils[_0x94db('0x23')]();transfers[_0x39ebf6[_0x94db('0x36')]][_0x94db('0x1c')]=0x0;transfers[_0x39ebf6[_0x94db('0x36')]]['agententerreason']=0x2;}}else if(_0x39ebf6[_0x94db('0x34')]==_0x39ebf6[_0x94db('0x3a')]){if(!_[_0x94db('0x18')](agents[_0x39ebf6['origtransfereruniqueid']])){agents[_0x39ebf6[_0x94db('0x32')]][_0x94db('0x2d')]=!![];agents[_0x39ebf6[_0x94db('0x32')]][_0x94db('0x2e')]=_0x94db('0x3b');agents[_0x39ebf6['origtransfereruniqueid']]['transferexten']=_0x39ebf6[_0x94db('0x3c')];agents[_0x39ebf6[_0x94db('0x32')]][_0x94db('0x30')]=_0x39ebf6['secondtransfereruniqueid'];}if(_0x39ebf6['transfertargetuniqueid']&&agents[_0x39ebf6[_0x94db('0x3d')]]){agents[_0x39ebf6['transfertargetuniqueid']][_0x94db('0x37')]=0x1;transfers[_0x39ebf6['transfertargetuniqueid']]=_[_0x94db('0x38')](agents[_0x39ebf6['transfertargetuniqueid']]);transfers[_0x39ebf6[_0x94db('0x3d')]][_0x94db('0x8')]=agents[_0x39ebf6[_0x94db('0x32')]][_0x94db('0x8')];transfers[_0x39ebf6['transfertargetuniqueid']]['calleridname']=agents[_0x39ebf6['origtransfereruniqueid']][_0x94db('0x39')];transfers[_0x39ebf6[_0x94db('0x3d')]][_0x94db('0x13')]=utils[_0x94db('0x23')]();transfers[_0x39ebf6[_0x94db('0x3d')]][_0x94db('0x25')]=utils[_0x94db('0x23')]();transfers[_0x39ebf6[_0x94db('0x3d')]][_0x94db('0x1c')]=0x0;transfers[_0x39ebf6[_0x94db('0x3d')]][_0x94db('0x37')]=0x2;}}}catch(_0x453351){utils[_0x94db('0x16')](_0x453351['stack']);}};exports['hangup']=function(_0x594e41){try{if(agents[_0x594e41['uniqueid']]&&agents[_0x594e41[_0x94db('0x5')]][_0x94db('0x1b')]===_0x94db('0x1a')){if(_0x594e41[_0x94db('0x3e')]==='21'){agents[_0x594e41[_0x94db('0x5')]][_0x94db('0x1b')]=_0x94db('0x3f');agents[_0x594e41[_0x94db('0x5')]][_0x94db('0x9')]=_0x94db('0x3f');}writeDB(agents[_0x594e41[_0x94db('0x5')]]);var _0x1cd56b=unanswered[_0x94db('0x40')](_0x594e41[_0x94db('0x5')]);if(_0x1cd56b>-0x1)unanswered[_0x94db('0x41')](_0x1cd56b,0x1);}if(transfers[_0x594e41[_0x94db('0x5')]]){transfers[_0x594e41[_0x94db('0x5')]][_0x94db('0xd')]=!![];transfers[_0x594e41[_0x94db('0x5')]][_0x94db('0x29')]=utils[_0x94db('0x23')]();transfers[_0x594e41[_0x94db('0x5')]][_0x94db('0x1e')]=utils['diffTime'](transfers[_0x594e41['uniqueid']]['agentcompleteAt'],transfers[_0x594e41[_0x94db('0x5')]][_0x94db('0x25')]);transfers[_0x594e41['uniqueid']][_0x94db('0x1b')]=_0x94db('0x42');transfers[_0x594e41[_0x94db('0x5')]]['lastevent']=_0x94db('0x43');writeDB(transfers[_0x594e41[_0x94db('0x5')]],!![]);}if(agents[_0x594e41['uniqueid']]&&agents[_0x594e41[_0x94db('0x5')]]['agentconnectAt']){agents[_0x594e41['uniqueid']][_0x94db('0xd')]=!![];agents[_0x594e41[_0x94db('0x5')]][_0x94db('0x29')]=utils[_0x94db('0x23')]();agents[_0x594e41[_0x94db('0x5')]][_0x94db('0x1e')]=utils[_0x94db('0x2a')](agents[_0x594e41['uniqueid']][_0x94db('0x29')],agents[_0x594e41['uniqueid']][_0x94db('0x25')]);agents[_0x594e41[_0x94db('0x5')]][_0x94db('0x1b')]=agents[_0x594e41['uniqueid']][_0x94db('0x2d')]?_0x94db('0x2d'):_0x94db('0x42');agents[_0x594e41[_0x94db('0x5')]][_0x94db('0x9')]='complete';writeDB(agents[_0x594e41[_0x94db('0x5')]]);}}catch(_0x20f256){utils[_0x94db('0x16')](_0x20f256[_0x94db('0x17')]);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 9aeb6a8..a44c9ed 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 _0x7759=['split','lastIndexOf','includes','hangup','noop','execif','gotoif','lodash','./utils','NO\x20ANSWER','FAILED','ANSWERED','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','accountcode','source','destination','callerid','disposition','UserId','request','CreateVoiceCallReport','newchannel','linkedid','OutgoingSpoolFailed','calleridnum','exten','context','now','DOCUMENTATION','error','stack','newstate','isNil','systemanswertime','channelstate','transfer','destinationchannel','toNumber','calleridname','endtime','duration','starttime','billableseconds','answertime','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstartAt','musiconholdstop','diffTime','xmd-originatecalleridnum','value','variable','\x22\x20<','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','lastdata','queue','ContactId','xmd-cdrtype','type','outboundrouteid','routeid','sipcallid','application','toLowerCase','set','startsWith','appdata','cdr'];(function(_0x3f09a9,_0x2a1758){var _0x854a6d=function(_0x3eff89){while(--_0x3eff89){_0x3f09a9['push'](_0x3f09a9['shift']());}};_0x854a6d(++_0x2a1758);}(_0x7759,0x143));var _0x9775=function(_0x3ca801,_0x75d023){_0x3ca801=_0x3ca801-0x0;var _0x1f12ed=_0x7759[_0x3ca801];return _0x1f12ed;};'use strict';var _=require(_0x9775('0x0'));var util=require('util');var utils=require(_0x9775('0x1'));var dispositions=[_0x9775('0x2'),_0x9775('0x3'),_0x9775('0x3'),_0x9775('0x2'),_0x9775('0x2'),_0x9775('0x2'),_0x9775('0x4'),'BUSY','FAILED',_0x9775('0x3'),'FAILED'];var channels={};function writeDB(_0x249a09){utils['info'](util['format'](_0x9775('0x5'),_0x249a09[_0x9775('0x6')],_0x249a09[_0x9775('0x7')],_0x249a09['type'],_0x249a09[_0x9775('0x8')],_0x249a09[_0x9775('0x9')],_0x249a09[_0x9775('0xa')],_0x249a09[_0x9775('0xb')],_0x249a09[_0x9775('0xc')]));if(_0x249a09['accountcode']){utils['getUserByInternal'](_0x249a09[_0x9775('0x8')])['then'](function(_0x9e548){if(_0x9e548){_0x249a09[_0x9775('0xd')]=_0x9e548['id'];}utils[_0x9775('0xe')](_0x9775('0xf'),_0x249a09);});}else{utils[_0x9775('0xe')](_0x9775('0xf'),_0x249a09);}if(channels[_0x249a09[_0x9775('0x6')]]){delete channels[_0x249a09[_0x9775('0x6')]];}}exports[_0x9775('0x10')]=function(_0x5ce116){try{if(_0x5ce116[_0x9775('0x6')]==_0x5ce116[_0x9775('0x11')]&&_0x5ce116[_0x9775('0x7')]!=_0x9775('0x12')){channels[_0x5ce116[_0x9775('0x6')]]={'uniqueid':_0x5ce116[_0x9775('0x6')],'accountcode':_0x5ce116[_0x9775('0x8')],'source':_0x5ce116[_0x9775('0x13')],'destination':_0x5ce116[_0x9775('0x14')],'destinationcontext':_0x5ce116[_0x9775('0x15')],'channel':_0x5ce116['channel'],'starttime':utils[_0x9775('0x16')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9775('0x2'),'amaflags':_0x9775('0x17')};}}catch(_0x4b8025){utils[_0x9775('0x18')](_0x4b8025[_0x9775('0x19')]);}};exports[_0x9775('0x1a')]=function(_0x3c0949){try{if(!_[_0x9775('0x1b')](channels[_0x3c0949['uniqueid']])&&_0x3c0949['channelstate']==0x6){if(_['isNil'](channels[_0x3c0949[_0x9775('0x6')]][_0x9775('0x1c')])){channels[_0x3c0949[_0x9775('0x6')]][_0x9775('0x1c')]=utils[_0x9775('0x16')]();}}else if(!_[_0x9775('0x1b')](channels[_0x3c0949[_0x9775('0x11')]])&&_0x3c0949[_0x9775('0x1d')]==0x6&&_0x3c0949[_0x9775('0x15')]!=_0x9775('0x1e')){channels[_0x3c0949[_0x9775('0x11')]][_0x9775('0x8')]=_0x3c0949[_0x9775('0x8')];channels[_0x3c0949['linkedid']][_0x9775('0x1f')]=_0x3c0949[_0x9775('0x7')];if(_['isNil'](channels[_0x3c0949['linkedid']]['answertime'])){channels[_0x3c0949[_0x9775('0x11')]]['answertime']=utils[_0x9775('0x16')]();}channels[_0x3c0949[_0x9775('0x11')]][_0x9775('0xc')]=dispositions[_[_0x9775('0x20')](_0x3c0949[_0x9775('0x1d')])]||'ANSWERED';}}catch(_0x24c894){utils[_0x9775('0x18')](_0x24c894[_0x9775('0x19')]);}};exports['hangup']=function(_0x1e34b6){try{if(!_[_0x9775('0x1b')](channels[_0x1e34b6[_0x9775('0x6')]])){if(_['isNil'](channels[_0x1e34b6[_0x9775('0x6')]][_0x9775('0xb')])){channels[_0x1e34b6['uniqueid']][_0x9775('0xb')]=_0x1e34b6[_0x9775('0x21')]+'\x20<'+_0x1e34b6[_0x9775('0x13')]+'>';}channels[_0x1e34b6['uniqueid']][_0x9775('0x22')]=utils[_0x9775('0x16')]();channels[_0x1e34b6[_0x9775('0x6')]][_0x9775('0x23')]=utils['diffTime'](channels[_0x1e34b6['uniqueid']][_0x9775('0x22')],channels[_0x1e34b6[_0x9775('0x6')]][_0x9775('0x24')]);channels[_0x1e34b6['uniqueid']][_0x9775('0x25')]=channels[_0x1e34b6[_0x9775('0x6')]]['answertime']?utils['diffTime'](channels[_0x1e34b6[_0x9775('0x6')]]['endtime'],channels[_0x1e34b6[_0x9775('0x6')]][_0x9775('0x26')]):0x0;writeDB(channels[_0x1e34b6['uniqueid']]);}}catch(_0x28803f){utils[_0x9775('0x18')](_0x28803f['stack']);}};exports[_0x9775('0x27')]=function(_0x364e69){try{if(!_['isNil'](channels[_0x364e69[_0x9775('0x28')]])){if(channels[_0x364e69[_0x9775('0x28')]][_0x9775('0x7')]==_0x364e69[_0x9775('0x29')]){channels[_0x364e69[_0x9775('0x28')]][_0x9775('0x1f')]=_0x364e69[_0x9775('0x2a')];channels[_0x364e69[_0x9775('0x28')]][_0x9775('0x2b')]=_0x9775('0x2c');}else if(channels[_0x364e69[_0x9775('0x28')]][_0x9775('0x7')]=_0x364e69[_0x9775('0x2d')]){channels[_0x364e69[_0x9775('0x28')]][_0x9775('0x1f')]=_0x364e69[_0x9775('0x2e')];channels[_0x364e69[_0x9775('0x28')]]['userfield']=_0x9775('0x2c');}}}catch(_0x2b35b0){utils[_0x9775('0x18')](_0x2b35b0[_0x9775('0x19')]);}};exports['musiconholdstart']=function(_0x10cf7f){try{if(!_['isNil'](channels[_0x10cf7f[_0x9775('0x6')]])){channels[_0x10cf7f['uniqueid']][_0x9775('0x2f')]=utils[_0x9775('0x16')]();}}catch(_0x338e33){utils['error'](_0x338e33[_0x9775('0x19')]);}};exports[_0x9775('0x30')]=function(_0x2fc9cd){try{if(!_[_0x9775('0x1b')](channels[_0x2fc9cd[_0x9775('0x6')]])){if(!_['isNil'](channels[_0x2fc9cd[_0x9775('0x6')]]['musiconholdstartAt'])){channels[_0x2fc9cd[_0x9775('0x6')]]['mohtime']+=utils[_0x9775('0x31')](utils[_0x9775('0x16')](),channels[_0x2fc9cd[_0x9775('0x6')]][_0x9775('0x2f')]);delete channels[_0x2fc9cd[_0x9775('0x6')]][_0x9775('0x2f')];}}}catch(_0x92dcff){utils[_0x9775('0x18')](_0x92dcff[_0x9775('0x19')]);}};exports['varset']=function(_0x28e798){try{if(!_['isNil'](channels[_0x28e798[_0x9775('0x6')]])){if(!_[_0x9775('0x1b')](_0x28e798['variable'][_0x9775('0x32')])){channels[_0x28e798['uniqueid']][_0x9775('0x9')]=_0x28e798[_0x9775('0x33')];}if(!_[_0x9775('0x1b')](_0x28e798[_0x9775('0x34')]['xmd-phone'])){channels[_0x28e798[_0x9775('0x6')]]['destination']=_0x28e798['value'];channels[_0x28e798[_0x9775('0x6')]][_0x9775('0xb')]='\x22'+_0x28e798['value']+_0x9775('0x35')+_0x28e798[_0x9775('0x33')]+'>';}if(!_['isNil'](_0x28e798['variable'][_0x9775('0x36')])||!_[_0x9775('0x1b')](_0x28e798[_0x9775('0x34')]['xmd-callerid'])){channels[_0x28e798[_0x9775('0x6')]][_0x9775('0xb')]=_0x28e798[_0x9775('0x33')];}if(!_['isNil'](_0x28e798[_0x9775('0x34')][_0x9775('0x37')])||!_[_0x9775('0x1b')](_0x28e798['variable'][_0x9775('0x38')])){channels[_0x28e798[_0x9775('0x6')]][_0x9775('0x39')]='Queue';channels[_0x28e798[_0x9775('0x6')]][_0x9775('0x3a')]=_0x28e798[_0x9775('0x33')];channels[_0x28e798[_0x9775('0x6')]][_0x9775('0x3b')]=!![];}if(!_[_0x9775('0x1b')](_0x28e798['variable']['xmd-contactid'])){channels[_0x28e798[_0x9775('0x6')]][_0x9775('0x3c')]=_0x28e798[_0x9775('0x33')];}if(!_[_0x9775('0x1b')](_0x28e798[_0x9775('0x34')][_0x9775('0x3d')])){channels[_0x28e798[_0x9775('0x6')]][_0x9775('0x3e')]=_0x28e798[_0x9775('0x33')];}if(!_[_0x9775('0x1b')](_0x28e798[_0x9775('0x34')][_0x9775('0x3f')])){channels[_0x28e798['uniqueid']][_0x9775('0x40')]=_0x28e798[_0x9775('0x33')];}if(!_['isNil'](_0x28e798['variable'][_0x9775('0x41')])){channels[_0x28e798['uniqueid']][_0x9775('0x41')]=_0x28e798[_0x9775('0x33')];}}}catch(_0x1e06d1){utils[_0x9775('0x18')](_0x1e06d1[_0x9775('0x19')]);}};exports['newexten']=function(_0x5dfdf5){try{if(!_[_0x9775('0x1b')](channels[_0x5dfdf5[_0x9775('0x6')]])){if(_0x5dfdf5[_0x9775('0x42')][_0x9775('0x43')]()==_0x9775('0x44')&&_[_0x9775('0x45')](_0x5dfdf5[_0x9775('0x46')][_0x9775('0x43')](),_0x9775('0x47'))){var _0x559d85=_0x5dfdf5[_0x9775('0x46')][_0x9775('0x48')]('=');var _0x29e045=_0x559d85[0x0]['substring'](_0x559d85[0x0][_0x9775('0x49')]('(')+0x1,_0x559d85[0x0][_0x9775('0x49')](')'));var _0x438680=_0x559d85[0x1];channels[_0x5dfdf5['uniqueid']][_0x29e045]=_0x438680;}if(!_[_0x9775('0x4a')]([_0x9775('0x4b'),_0x9775('0x4c'),_0x9775('0x4d'),'set',_0x9775('0x4e')],_0x5dfdf5[_0x9775('0x42')][_0x9775('0x43')]())){channels[_0x5dfdf5[_0x9775('0x6')]]['lastapplication']=_0x5dfdf5[_0x9775('0x42')];channels[_0x5dfdf5[_0x9775('0x6')]]['lastdata']=_0x5dfdf5[_0x9775('0x46')];}}}catch(_0x57146b){utils[_0x9775('0x18')](_0x57146b[_0x9775('0x19')]);}}; \ No newline at end of file +var _0xee5b=['error','stack','newstate','isNil','systemanswertime','linkedid','destinationchannel','answertime','disposition','toNumber','hangup','callerid','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','transfereechannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstartAt','musiconholdstop','mohtime','variable','source','value','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','xmd-contactid','ContactId','xmd-cdrtype','outboundrouteid','routeid','sipcallid','application','set','startsWith','appdata','toLowerCase','cdr','split','substring','lastIndexOf','includes','gotoif','lodash','util','FAILED','NO\x20ANSWER','ANSWERED','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','type','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','OutgoingSpoolFailed','calleridnum','exten','context','now','DOCUMENTATION'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xee5b,0x121));var _0xbee5=function(_0xd903dd,_0x37d7ba){_0xd903dd=_0xd903dd-0x0;var _0x37f47b=_0xee5b[_0xd903dd];return _0x37f47b;};'use strict';var _=require(_0xbee5('0x0'));var util=require(_0xbee5('0x1'));var utils=require('./utils');var dispositions=['NO\x20ANSWER','FAILED',_0xbee5('0x2'),_0xbee5('0x3'),_0xbee5('0x3'),_0xbee5('0x3'),_0xbee5('0x4'),'BUSY','FAILED',_0xbee5('0x2'),_0xbee5('0x2')];var channels={};function writeDB(_0x51c1cd){utils[_0xbee5('0x5')](util[_0xbee5('0x6')](_0xbee5('0x7'),_0x51c1cd[_0xbee5('0x8')],_0x51c1cd[_0xbee5('0x9')],_0x51c1cd[_0xbee5('0xa')],_0x51c1cd[_0xbee5('0xb')],_0x51c1cd['source'],_0x51c1cd['destination'],_0x51c1cd['callerid'],_0x51c1cd['disposition']));if(_0x51c1cd[_0xbee5('0xb')]){utils[_0xbee5('0xc')](_0x51c1cd[_0xbee5('0xb')])[_0xbee5('0xd')](function(_0x1c6da1){if(_0x1c6da1){_0x51c1cd[_0xbee5('0xe')]=_0x1c6da1['id'];}utils[_0xbee5('0xf')](_0xbee5('0x10'),_0x51c1cd);});}else{utils[_0xbee5('0xf')](_0xbee5('0x10'),_0x51c1cd);}if(channels[_0x51c1cd[_0xbee5('0x8')]]){delete channels[_0x51c1cd[_0xbee5('0x8')]];}}exports['newchannel']=function(_0x2ed4dc){try{if(_0x2ed4dc['uniqueid']==_0x2ed4dc['linkedid']&&_0x2ed4dc[_0xbee5('0x9')]!=_0xbee5('0x11')){channels[_0x2ed4dc[_0xbee5('0x8')]]={'uniqueid':_0x2ed4dc[_0xbee5('0x8')],'accountcode':_0x2ed4dc['accountcode'],'source':_0x2ed4dc[_0xbee5('0x12')],'destination':_0x2ed4dc[_0xbee5('0x13')],'destinationcontext':_0x2ed4dc[_0xbee5('0x14')],'channel':_0x2ed4dc[_0xbee5('0x9')],'starttime':utils[_0xbee5('0x15')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xbee5('0x3'),'amaflags':_0xbee5('0x16')};}}catch(_0x640758){utils[_0xbee5('0x17')](_0x640758[_0xbee5('0x18')]);}};exports[_0xbee5('0x19')]=function(_0x3c4e9e){try{if(!_[_0xbee5('0x1a')](channels[_0x3c4e9e[_0xbee5('0x8')]])&&_0x3c4e9e['channelstate']==0x6){if(_['isNil'](channels[_0x3c4e9e[_0xbee5('0x8')]]['systemanswertime'])){channels[_0x3c4e9e[_0xbee5('0x8')]][_0xbee5('0x1b')]=utils[_0xbee5('0x15')]();}}else if(!_['isNil'](channels[_0x3c4e9e[_0xbee5('0x1c')]])&&_0x3c4e9e['channelstate']==0x6&&_0x3c4e9e[_0xbee5('0x14')]!='transfer'){channels[_0x3c4e9e[_0xbee5('0x1c')]][_0xbee5('0xb')]=_0x3c4e9e['accountcode'];channels[_0x3c4e9e[_0xbee5('0x1c')]][_0xbee5('0x1d')]=_0x3c4e9e[_0xbee5('0x9')];if(_[_0xbee5('0x1a')](channels[_0x3c4e9e[_0xbee5('0x1c')]][_0xbee5('0x1e')])){channels[_0x3c4e9e[_0xbee5('0x1c')]][_0xbee5('0x1e')]=utils[_0xbee5('0x15')]();}channels[_0x3c4e9e['linkedid']][_0xbee5('0x1f')]=dispositions[_[_0xbee5('0x20')](_0x3c4e9e['channelstate'])]||_0xbee5('0x4');}}catch(_0x1ea00d){utils[_0xbee5('0x17')](_0x1ea00d['stack']);}};exports[_0xbee5('0x21')]=function(_0x48ba87){try{if(!_[_0xbee5('0x1a')](channels[_0x48ba87[_0xbee5('0x8')]])){if(_['isNil'](channels[_0x48ba87[_0xbee5('0x8')]][_0xbee5('0x22')])){channels[_0x48ba87[_0xbee5('0x8')]][_0xbee5('0x22')]=_0x48ba87['calleridname']+'\x20<'+_0x48ba87[_0xbee5('0x12')]+'>';}channels[_0x48ba87[_0xbee5('0x8')]][_0xbee5('0x23')]=utils[_0xbee5('0x15')]();channels[_0x48ba87[_0xbee5('0x8')]][_0xbee5('0x24')]=utils[_0xbee5('0x25')](channels[_0x48ba87[_0xbee5('0x8')]][_0xbee5('0x23')],channels[_0x48ba87['uniqueid']][_0xbee5('0x26')]);channels[_0x48ba87[_0xbee5('0x8')]][_0xbee5('0x27')]=channels[_0x48ba87['uniqueid']][_0xbee5('0x1e')]?utils['diffTime'](channels[_0x48ba87[_0xbee5('0x8')]]['endtime'],channels[_0x48ba87[_0xbee5('0x8')]][_0xbee5('0x1e')]):0x0;writeDB(channels[_0x48ba87[_0xbee5('0x8')]]);}}catch(_0x5414d4){utils[_0xbee5('0x17')](_0x5414d4[_0xbee5('0x18')]);}};exports[_0xbee5('0x28')]=function(_0x5dac49){try{if(!_['isNil'](channels[_0x5dac49[_0xbee5('0x29')]])){if(channels[_0x5dac49[_0xbee5('0x29')]][_0xbee5('0x9')]==_0x5dac49[_0xbee5('0x2a')]){channels[_0x5dac49[_0xbee5('0x29')]][_0xbee5('0x1d')]=_0x5dac49['secondtransfererchannel'];channels[_0x5dac49[_0xbee5('0x29')]][_0xbee5('0x2b')]=_0xbee5('0x2c');}else if(channels[_0x5dac49[_0xbee5('0x29')]][_0xbee5('0x9')]=_0x5dac49[_0xbee5('0x2d')]){channels[_0x5dac49[_0xbee5('0x29')]][_0xbee5('0x1d')]=_0x5dac49[_0xbee5('0x2e')];channels[_0x5dac49[_0xbee5('0x29')]]['userfield']=_0xbee5('0x2c');}}}catch(_0x36ee55){utils['error'](_0x36ee55['stack']);}};exports['musiconholdstart']=function(_0x599b0d){try{if(!_['isNil'](channels[_0x599b0d[_0xbee5('0x8')]])){channels[_0x599b0d[_0xbee5('0x8')]][_0xbee5('0x2f')]=utils[_0xbee5('0x15')]();}}catch(_0x18827f){utils[_0xbee5('0x17')](_0x18827f[_0xbee5('0x18')]);}};exports[_0xbee5('0x30')]=function(_0x494991){try{if(!_[_0xbee5('0x1a')](channels[_0x494991[_0xbee5('0x8')]])){if(!_['isNil'](channels[_0x494991[_0xbee5('0x8')]]['musiconholdstartAt'])){channels[_0x494991[_0xbee5('0x8')]][_0xbee5('0x31')]+=utils[_0xbee5('0x25')](utils[_0xbee5('0x15')](),channels[_0x494991[_0xbee5('0x8')]][_0xbee5('0x2f')]);delete channels[_0x494991[_0xbee5('0x8')]][_0xbee5('0x2f')];}}}catch(_0x5cbb1d){utils['error'](_0x5cbb1d[_0xbee5('0x18')]);}};exports['varset']=function(_0xd69d7){try{if(!_['isNil'](channels[_0xd69d7['uniqueid']])){if(!_['isNil'](_0xd69d7[_0xbee5('0x32')]['xmd-originatecalleridnum'])){channels[_0xd69d7[_0xbee5('0x8')]][_0xbee5('0x33')]=_0xd69d7[_0xbee5('0x34')];}if(!_[_0xbee5('0x1a')](_0xd69d7['variable'][_0xbee5('0x35')])){channels[_0xd69d7['uniqueid']][_0xbee5('0x36')]=_0xd69d7[_0xbee5('0x34')];channels[_0xd69d7[_0xbee5('0x8')]][_0xbee5('0x22')]='\x22'+_0xd69d7[_0xbee5('0x34')]+_0xbee5('0x37')+_0xd69d7[_0xbee5('0x34')]+'>';}if(!_[_0xbee5('0x1a')](_0xd69d7['variable'][_0xbee5('0x38')])||!_['isNil'](_0xd69d7[_0xbee5('0x32')]['xmd-callerid'])){channels[_0xd69d7[_0xbee5('0x8')]]['callerid']=_0xd69d7[_0xbee5('0x34')];}if(!_[_0xbee5('0x1a')](_0xd69d7[_0xbee5('0x32')][_0xbee5('0x39')])||!_[_0xbee5('0x1a')](_0xd69d7['variable'][_0xbee5('0x3a')])){channels[_0xd69d7['uniqueid']][_0xbee5('0x3b')]=_0xbee5('0x3c');channels[_0xd69d7[_0xbee5('0x8')]]['lastdata']=_0xd69d7[_0xbee5('0x34')];channels[_0xd69d7['uniqueid']]['queue']=!![];}if(!_['isNil'](_0xd69d7[_0xbee5('0x32')][_0xbee5('0x3d')])){channels[_0xd69d7[_0xbee5('0x8')]][_0xbee5('0x3e')]=_0xd69d7['value'];}if(!_[_0xbee5('0x1a')](_0xd69d7['variable'][_0xbee5('0x3f')])){channels[_0xd69d7['uniqueid']]['type']=_0xd69d7[_0xbee5('0x34')];}if(!_['isNil'](_0xd69d7[_0xbee5('0x32')][_0xbee5('0x40')])){channels[_0xd69d7[_0xbee5('0x8')]][_0xbee5('0x41')]=_0xd69d7[_0xbee5('0x34')];}if(!_[_0xbee5('0x1a')](_0xd69d7[_0xbee5('0x32')]['sipcallid'])){channels[_0xd69d7['uniqueid']][_0xbee5('0x42')]=_0xd69d7[_0xbee5('0x34')];}}}catch(_0x5e1ae1){utils['error'](_0x5e1ae1[_0xbee5('0x18')]);}};exports['newexten']=function(_0x783aa5){try{if(!_[_0xbee5('0x1a')](channels[_0x783aa5[_0xbee5('0x8')]])){if(_0x783aa5[_0xbee5('0x43')]['toLowerCase']()==_0xbee5('0x44')&&_[_0xbee5('0x45')](_0x783aa5[_0xbee5('0x46')][_0xbee5('0x47')](),_0xbee5('0x48'))){var _0x459191=_0x783aa5[_0xbee5('0x46')][_0xbee5('0x49')]('=');var _0x4634d5=_0x459191[0x0][_0xbee5('0x4a')](_0x459191[0x0][_0xbee5('0x4b')]('(')+0x1,_0x459191[0x0]['lastIndexOf'](')'));var _0xd4d40e=_0x459191[0x1];channels[_0x783aa5[_0xbee5('0x8')]][_0x4634d5]=_0xd4d40e;}if(!_[_0xbee5('0x4c')](['hangup','noop','execif',_0xbee5('0x44'),_0xbee5('0x4d')],_0x783aa5[_0xbee5('0x43')]['toLowerCase']())){channels[_0x783aa5['uniqueid']][_0xbee5('0x3b')]=_0x783aa5['application'];channels[_0x783aa5['uniqueid']]['lastdata']=_0x783aa5['appdata'];}}}catch(_0x3ac449){utils[_0xbee5('0x17')](_0x3ac449[_0xbee5('0x18')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 77c39fc..73c22ed 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 _0xd8fb=['./utils','lodash','connect','info','SHUTDOWN','fullybooted','FULLYBOOTED','error','managerevent'];(function(_0xaba486,_0x13affa){var _0xcaa535=function(_0x2bfc98){while(--_0x2bfc98){_0xaba486['push'](_0xaba486['shift']());}};_0xcaa535(++_0x13affa);}(_0xd8fb,0x99));var _0xbd8f=function(_0x12527c,_0x2b28a6){_0x12527c=_0x12527c-0x0;var _0x27dc09=_0xd8fb[_0x12527c];return _0x27dc09;};'use strict';var utils=require(_0xbd8f('0x0'));var _=require(_0xbd8f('0x1'));exports[_0xbd8f('0x2')]=function(){utils[_0xbd8f('0x3')]('CONNECTED');};exports['shutdown']=function(){utils['info'](_0xbd8f('0x4'));};exports[_0xbd8f('0x5')]=function(){utils['info'](_0xbd8f('0x6'));};exports[_0xbd8f('0x7')]=function(_0x5543b2){utils[_0xbd8f('0x7')](_0x5543b2);};exports['close']=function(){utils[_0xbd8f('0x3')]('CLOSE');};exports[_0xbd8f('0x8')]=function(_0x403edc){}; \ No newline at end of file +var _0xc1c6=['CONNECTED','info','SHUTDOWN','fullybooted','error','CLOSE','managerevent','./utils','lodash','connect'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x4df773,_0x4e412e){_0x4df773=_0x4df773-0x0;var _0x1b8759=_0xc1c6[_0x4df773];return _0x1b8759;};'use strict';var utils=require(_0x6c1c('0x0'));var _=require(_0x6c1c('0x1'));exports[_0x6c1c('0x2')]=function(){utils['info'](_0x6c1c('0x3'));};exports['shutdown']=function(){utils[_0x6c1c('0x4')](_0x6c1c('0x5'));};exports[_0x6c1c('0x6')]=function(){utils['info']('FULLYBOOTED');};exports[_0x6c1c('0x7')]=function(_0x524a6b){utils[_0x6c1c('0x7')](_0x524a6b);};exports['close']=function(){utils[_0x6c1c('0x4')](_0x6c1c('0x8'));};exports[_0x6c1c('0x9')]=function(_0x2cec58){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 1f96c07..c48bd6f 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 _0x81a4=['endtime','holdtime','answertime','starttime','billableseconds','util','./utils','info','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','dialstring','calleridnum','dialstatus','request','newexten','application','startsWith','appdata','error','stack','isNil','variable','value','dialbegin','now','lastevent','called','dialend','ANSWER','assign','hangup','complete','duration','diffTime'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x81a4,0x125));var _0x481a=function(_0x577519,_0x346daf){_0x577519=_0x577519-0x0;var _0x5b12f7=_0x81a4[_0x577519];return _0x5b12f7;};'use strict';var _=require('lodash');var util=require(_0x481a('0x0'));var utils=require(_0x481a('0x1'));var dials={};function writeDB(_0x16d588){utils[_0x481a('0x2')](util[_0x481a('0x3')](_0x481a('0x4'),_0x16d588[_0x481a('0x5')],_0x16d588[_0x481a('0x6')],_0x16d588[_0x481a('0x7')],_0x16d588[_0x481a('0x8')],_0x16d588['connectedlinenum'],_0x16d588[_0x481a('0x9')]));utils[_0x481a('0xa')]('CreateVoiceDialReport',_0x16d588);delete dials[_0x16d588[_0x481a('0x5')]];}exports[_0x481a('0xb')]=function(_0x37d8e2){try{if(_0x37d8e2[_0x481a('0xc')]['toLowerCase']()=='set'&&_[_0x481a('0xd')](_0x37d8e2[_0x481a('0xe')]['toLowerCase'](),'cdr(routeid)')){var _0x468e63=_0x37d8e2[_0x481a('0xe')]['split']('=');dials[_0x37d8e2[_0x481a('0x5')]]={'routeId':_0x468e63[0x1]};}}catch(_0x96066){utils[_0x481a('0xf')](_0x96066[_0x481a('0x10')]);}};exports['varset']=function(_0x1b3a94){try{if(!_[_0x481a('0x11')](_0x1b3a94[_0x481a('0x12')]['outboundrouteid'])){dials[_0x1b3a94[_0x481a('0x5')]]={'routeId':_0x1b3a94[_0x481a('0x13')]};}}catch(_0x2f837f){utils[_0x481a('0xf')](_0x2f837f['stack']);}};exports[_0x481a('0x14')]=function(_0x24e577){try{if(!_[_0x481a('0x11')](dials[_0x24e577[_0x481a('0x5')]])){dials[_0x24e577[_0x481a('0x5')]]=_['assign'](dials[_0x24e577[_0x481a('0x5')]],_0x24e577);dials[_0x24e577[_0x481a('0x5')]]['starttime']=utils[_0x481a('0x15')]();dials[_0x24e577['uniqueid']][_0x481a('0x16')]=_0x481a('0x17');}}catch(_0x56f848){utils[_0x481a('0xf')](_0x56f848[_0x481a('0x10')]);}};exports[_0x481a('0x18')]=function(_0x144e6d){try{if(!_[_0x481a('0x11')](dials[_0x144e6d[_0x481a('0x5')]])){dials[_0x144e6d[_0x481a('0x5')]]['dialstatus']=_0x144e6d[_0x481a('0x9')];if(_0x144e6d[_0x481a('0x9')]==_0x481a('0x19')){dials[_0x144e6d['uniqueid']]=_[_0x481a('0x1a')](dials[_0x144e6d[_0x481a('0x5')]],_0x144e6d);dials[_0x144e6d[_0x481a('0x5')]]['answertime']=utils[_0x481a('0x15')]();dials[_0x144e6d['uniqueid']][_0x481a('0x16')]='connect';}}}catch(_0x3397b7){utils[_0x481a('0xf')](_0x3397b7[_0x481a('0x10')]);}};exports[_0x481a('0x1b')]=function(_0x12010f){try{if(!_[_0x481a('0x11')](dials[_0x12010f['uniqueid']])){dials[_0x12010f[_0x481a('0x5')]]=_['assign'](dials[_0x12010f[_0x481a('0x5')]],{'endtime':utils[_0x481a('0x15')](),'lastevent':_0x481a('0x1c')});dials[_0x12010f[_0x481a('0x5')]][_0x481a('0x1d')]=utils[_0x481a('0x1e')](dials[_0x12010f[_0x481a('0x5')]][_0x481a('0x1f')],dials[_0x12010f[_0x481a('0x5')]]['starttime']);dials[_0x12010f[_0x481a('0x5')]][_0x481a('0x20')]=utils['diffTime'](dials[_0x12010f['uniqueid']][_0x481a('0x21')]||dials[_0x12010f[_0x481a('0x5')]]['endtime'],dials[_0x12010f[_0x481a('0x5')]][_0x481a('0x22')]);dials[_0x12010f['uniqueid']][_0x481a('0x23')]=dials[_0x12010f['uniqueid']][_0x481a('0x21')]?utils[_0x481a('0x1e')](dials[_0x12010f['uniqueid']]['endtime'],dials[_0x12010f['uniqueid']][_0x481a('0x21')]):0x0;writeDB(dials[_0x12010f[_0x481a('0x5')]]);}}catch(_0x191350){utils[_0x481a('0xf')](_0x191350[_0x481a('0x10')]);}}; \ No newline at end of file +var _0x4937=['answertime','now','lastevent','connect','hangup','assign','complete','duration','endtime','holdtime','diffTime','billableseconds','lodash','util','./utils','format','DIAL|%s|%s|%s|%s|%s|%s','channel','dialstring','calleridnum','dialstatus','uniqueid','application','toLowerCase','startsWith','cdr(routeid)','appdata','split','error','stack','varset','isNil','outboundrouteid','value','dialbegin','starttime','dialend'];(function(_0x44787c,_0x5b612d){var _0xf50a8f=function(_0x3d2cb6){while(--_0x3d2cb6){_0x44787c['push'](_0x44787c['shift']());}};_0xf50a8f(++_0x5b612d);}(_0x4937,0x1c8));var _0x7493=function(_0x231d4b,_0x58eeb4){_0x231d4b=_0x231d4b-0x0;var _0x36d45c=_0x4937[_0x231d4b];return _0x36d45c;};'use strict';var _=require(_0x7493('0x0'));var util=require(_0x7493('0x1'));var utils=require(_0x7493('0x2'));var dials={};function writeDB(_0x6fcfeb){utils['info'](util[_0x7493('0x3')](_0x7493('0x4'),_0x6fcfeb['uniqueid'],_0x6fcfeb[_0x7493('0x5')],_0x6fcfeb[_0x7493('0x6')],_0x6fcfeb[_0x7493('0x7')],_0x6fcfeb['connectedlinenum'],_0x6fcfeb[_0x7493('0x8')]));utils['request']('CreateVoiceDialReport',_0x6fcfeb);delete dials[_0x6fcfeb[_0x7493('0x9')]];}exports['newexten']=function(_0xda40e5){try{if(_0xda40e5[_0x7493('0xa')][_0x7493('0xb')]()=='set'&&_[_0x7493('0xc')](_0xda40e5['appdata']['toLowerCase'](),_0x7493('0xd'))){var _0x290e4b=_0xda40e5[_0x7493('0xe')][_0x7493('0xf')]('=');dials[_0xda40e5[_0x7493('0x9')]]={'routeId':_0x290e4b[0x1]};}}catch(_0x4b1a7f){utils[_0x7493('0x10')](_0x4b1a7f[_0x7493('0x11')]);}};exports[_0x7493('0x12')]=function(_0x21bcc8){try{if(!_[_0x7493('0x13')](_0x21bcc8['variable'][_0x7493('0x14')])){dials[_0x21bcc8['uniqueid']]={'routeId':_0x21bcc8[_0x7493('0x15')]};}}catch(_0x5ccd3b){utils[_0x7493('0x10')](_0x5ccd3b[_0x7493('0x11')]);}};exports[_0x7493('0x16')]=function(_0xcb93d0){try{if(!_[_0x7493('0x13')](dials[_0xcb93d0[_0x7493('0x9')]])){dials[_0xcb93d0['uniqueid']]=_['assign'](dials[_0xcb93d0[_0x7493('0x9')]],_0xcb93d0);dials[_0xcb93d0[_0x7493('0x9')]][_0x7493('0x17')]=utils['now']();dials[_0xcb93d0[_0x7493('0x9')]]['lastevent']='called';}}catch(_0x42e563){utils[_0x7493('0x10')](_0x42e563[_0x7493('0x11')]);}};exports[_0x7493('0x18')]=function(_0x11b619){try{if(!_[_0x7493('0x13')](dials[_0x11b619[_0x7493('0x9')]])){dials[_0x11b619[_0x7493('0x9')]]['dialstatus']=_0x11b619[_0x7493('0x8')];if(_0x11b619[_0x7493('0x8')]=='ANSWER'){dials[_0x11b619[_0x7493('0x9')]]=_['assign'](dials[_0x11b619[_0x7493('0x9')]],_0x11b619);dials[_0x11b619[_0x7493('0x9')]][_0x7493('0x19')]=utils[_0x7493('0x1a')]();dials[_0x11b619[_0x7493('0x9')]][_0x7493('0x1b')]=_0x7493('0x1c');}}}catch(_0x4dc224){utils['error'](_0x4dc224[_0x7493('0x11')]);}};exports[_0x7493('0x1d')]=function(_0x3287f4){try{if(!_['isNil'](dials[_0x3287f4['uniqueid']])){dials[_0x3287f4[_0x7493('0x9')]]=_[_0x7493('0x1e')](dials[_0x3287f4['uniqueid']],{'endtime':utils[_0x7493('0x1a')](),'lastevent':_0x7493('0x1f')});dials[_0x3287f4[_0x7493('0x9')]][_0x7493('0x20')]=utils['diffTime'](dials[_0x3287f4[_0x7493('0x9')]][_0x7493('0x21')],dials[_0x3287f4[_0x7493('0x9')]][_0x7493('0x17')]);dials[_0x3287f4[_0x7493('0x9')]][_0x7493('0x22')]=utils[_0x7493('0x23')](dials[_0x3287f4[_0x7493('0x9')]][_0x7493('0x19')]||dials[_0x3287f4[_0x7493('0x9')]][_0x7493('0x21')],dials[_0x3287f4[_0x7493('0x9')]][_0x7493('0x17')]);dials[_0x3287f4[_0x7493('0x9')]][_0x7493('0x24')]=dials[_0x3287f4[_0x7493('0x9')]][_0x7493('0x19')]?utils[_0x7493('0x23')](dials[_0x3287f4[_0x7493('0x9')]][_0x7493('0x21')],dials[_0x3287f4[_0x7493('0x9')]]['answertime']):0x0;writeDB(dials[_0x3287f4[_0x7493('0x9')]]);}}catch(_0xa95c8f){utils[_0x7493('0x10')](_0xa95c8f[_0x7493('0x11')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 2a9451b..11b6e3e 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 _0xef47=['asterisk-manager','../../config/environment','asterisk','port','username','keepConnected','xdr','disabled','info','./agents.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend'];(function(_0x58745b,_0x2770e0){var _0x12914c=function(_0x45592d){while(--_0x45592d){_0x58745b['push'](_0x58745b['shift']());}};_0x12914c(++_0x2770e0);}(_0xef47,0x1e0));var _0x7ef4=function(_0x4ed02e,_0x23dd8a){_0x4ed02e=_0x4ed02e-0x0;var _0x1d9108=_0xef47[_0x4ed02e];return _0x1d9108;};var AsteriskManager=require(_0x7ef4('0x0'));var config=require(_0x7ef4('0x1'));var utils=require('./utils');var ami=new AsteriskManager(config[_0x7ef4('0x2')][_0x7ef4('0x3')],config[_0x7ef4('0x2')]['ip'],config['asterisk'][_0x7ef4('0x4')],config[_0x7ef4('0x2')]['password'],!![]);ami[_0x7ef4('0x5')]();if(config['xdr']&&config[_0x7ef4('0x6')][_0x7ef4('0x7')]){utils[_0x7ef4('0x8')]('XDR\x20DISABLED');}else{var agents=require(_0x7ef4('0x9'));var calls=require('./calls.controller');var queues=require(_0x7ef4('0xa'));var recordings=require('./recordings.controller');var members=require(_0x7ef4('0xb'));var dials=require(_0x7ef4('0xc'));var transfers=require(_0x7ef4('0xd'));var core=require('./core.controller');ami['on'](_0x7ef4('0xe'),core[_0x7ef4('0xe')]);ami['on'](_0x7ef4('0xf'),core['shutdown']);ami['on'](_0x7ef4('0x10'),core['fullybooted']);ami['on'](_0x7ef4('0x11'),core[_0x7ef4('0x11')]);ami['on'](_0x7ef4('0x12'),core[_0x7ef4('0x12')]);ami['on']('managerevent',core[_0x7ef4('0x13')]);ami['on'](_0x7ef4('0x14'),function(_0x229227){try{members[_0x7ef4('0x14')](_0x229227);}catch(_0x167f24){utils['error'](_0x167f24);}});ami['on']('agentcalled',function(_0x3d7d4b){try{agents[_0x7ef4('0x15')](_0x3d7d4b);}catch(_0x39a7dd){utils[_0x7ef4('0x11')](_0x39a7dd);}});ami['on'](_0x7ef4('0x16'),function(_0x4b3343){try{agents[_0x7ef4('0x16')](_0x4b3343);}catch(_0x48c58d){utils['error'](_0x48c58d);}});ami['on']('agentconnect',function(_0x2de385){try{agents['agentconnect'](_0x2de385);queues[_0x7ef4('0x17')](_0x2de385);}catch(_0x23fae9){utils['error'](_0x23fae9);}});ami['on']('agentcomplete',function(_0x302f4b){try{agents['agentcomplete'](_0x302f4b);queues[_0x7ef4('0x18')](_0x302f4b);members[_0x7ef4('0x18')](_0x302f4b);}catch(_0x162e21){utils['error'](_0x162e21);}});ami['on'](_0x7ef4('0x19'),function(_0x1bd53f){try{agents[_0x7ef4('0x19')](_0x1bd53f);queues['queuecallerabandon'](_0x1bd53f);}catch(_0x43da4f){utils['error'](_0x43da4f);}});ami['on']('queuecallerjoin',function(_0x14dabe){try{queues[_0x7ef4('0x1a')](_0x14dabe);recordings[_0x7ef4('0x1a')](_0x14dabe);}catch(_0xd914b8){utils['error'](_0xd914b8);}});ami['on'](_0x7ef4('0x1b'),function(_0x104d08){try{queues[_0x7ef4('0x1b')](_0x104d08);}catch(_0x527775){utils['error'](_0x527775);}});ami['on'](_0x7ef4('0x1c'),function(_0x38703a){try{queues['musiconholdstart'](_0x38703a);calls[_0x7ef4('0x1c')](_0x38703a);}catch(_0x1b1381){utils[_0x7ef4('0x11')](_0x1b1381);}});ami['on'](_0x7ef4('0x1d'),function(_0x387e71){try{queues[_0x7ef4('0x1d')](_0x387e71);calls[_0x7ef4('0x1d')](_0x387e71);}catch(_0x3d24e8){utils['error'](_0x3d24e8);}});ami['on'](_0x7ef4('0x1e'),function(_0x4a6f54){try{calls['newstate'](_0x4a6f54);recordings[_0x7ef4('0x1e')](_0x4a6f54);}catch(_0xe9050c){utils[_0x7ef4('0x11')](_0xe9050c);}});ami['on']('hangup',function(_0x4a9530){try{calls[_0x7ef4('0x1f')](_0x4a9530);recordings[_0x7ef4('0x1f')](_0x4a9530);dials[_0x7ef4('0x1f')](_0x4a9530);agents[_0x7ef4('0x1f')](_0x4a9530);queues[_0x7ef4('0x1f')](_0x4a9530);}catch(_0x11d39e){utils[_0x7ef4('0x11')](_0x11d39e);}});ami['on'](_0x7ef4('0x20'),function(_0xc8e5dc){try{members[_0x7ef4('0x20')](_0xc8e5dc);}catch(_0x463d71){utils[_0x7ef4('0x11')](_0x463d71);}});ami['on'](_0x7ef4('0x21'),function(_0x631c3){try{queues[_0x7ef4('0x21')](_0x631c3);agents[_0x7ef4('0x21')](_0x631c3);transfers['blindtransfer'](_0x631c3);}catch(_0x56f9c5){utils[_0x7ef4('0x11')](_0x56f9c5);}});ami['on']('attendedtransfer',function(_0xd556){try{queues['attendedtransfer'](_0xd556);transfers['attendedtransfer'](_0xd556);agents[_0x7ef4('0x22')](_0xd556);calls['attendedtransfer'](_0xd556);}catch(_0x4fce8c){utils['error'](_0x4fce8c);}});ami['on'](_0x7ef4('0x23'),function(_0x5e99d4){try{queues['varset'](_0x5e99d4);recordings[_0x7ef4('0x23')](_0x5e99d4);calls[_0x7ef4('0x23')](_0x5e99d4);dials[_0x7ef4('0x23')](_0x5e99d4);}catch(_0x69c584){utils[_0x7ef4('0x11')](_0x69c584);}});ami['on'](_0x7ef4('0x24'),function(_0x552f13){try{calls[_0x7ef4('0x24')](_0x552f13);recordings[_0x7ef4('0x24')](_0x552f13);dials[_0x7ef4('0x24')](_0x552f13);}catch(_0x6b8488){utils[_0x7ef4('0x11')](_0x6b8488);}});ami['on'](_0x7ef4('0x25'),function(_0x249f1a){try{calls[_0x7ef4('0x25')](_0x249f1a);recordings[_0x7ef4('0x25')](_0x249f1a);}catch(_0x38045b){utils['error'](_0x38045b);}});ami['on'](_0x7ef4('0x26'),function(_0x196caf){try{dials[_0x7ef4('0x26')](_0x196caf);}catch(_0x5eb689){utils['error'](_0x5eb689);}});ami['on'](_0x7ef4('0x27'),function(_0xd620b2){try{dials['dialend'](_0xd620b2);}catch(_0x1d87e5){utils[_0x7ef4('0x11')](_0x1d87e5);}});} \ No newline at end of file +var _0x08b9=['agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','./utils','port','asterisk','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./calls.controller','./core.controller','connect','shutdown','fullybooted','error','devicestatechange','agentcalled'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x08b9,0x168));var _0x908b=function(_0x2f68e9,_0x1b5d98){_0x2f68e9=_0x2f68e9-0x0;var _0x17ca4f=_0x08b9[_0x2f68e9];return _0x17ca4f;};var AsteriskManager=require(_0x908b('0x0'));var config=require(_0x908b('0x1'));var utils=require(_0x908b('0x2'));var ami=new AsteriskManager(config['asterisk'][_0x908b('0x3')],config[_0x908b('0x4')]['ip'],config['asterisk'][_0x908b('0x5')],config[_0x908b('0x4')][_0x908b('0x6')],!![]);ami[_0x908b('0x7')]();if(config[_0x908b('0x8')]&&config[_0x908b('0x8')][_0x908b('0x9')]){utils[_0x908b('0xa')](_0x908b('0xb'));}else{var agents=require('./agents.controller');var calls=require(_0x908b('0xc'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require('./transfers.controller');var core=require(_0x908b('0xd'));ami['on'](_0x908b('0xe'),core[_0x908b('0xe')]);ami['on'](_0x908b('0xf'),core['shutdown']);ami['on']('fullybooted',core[_0x908b('0x10')]);ami['on']('error',core[_0x908b('0x11')]);ami['on']('close',core['close']);ami['on']('managerevent',core['managerevent']);ami['on'](_0x908b('0x12'),function(_0x35efeb){try{members['devicestatechange'](_0x35efeb);}catch(_0x1561ca){utils[_0x908b('0x11')](_0x1561ca);}});ami['on']('agentcalled',function(_0x52d724){try{agents[_0x908b('0x13')](_0x52d724);}catch(_0x3460ec){utils[_0x908b('0x11')](_0x3460ec);}});ami['on'](_0x908b('0x14'),function(_0x232f5b){try{agents[_0x908b('0x14')](_0x232f5b);}catch(_0x187b10){utils[_0x908b('0x11')](_0x187b10);}});ami['on'](_0x908b('0x15'),function(_0x42d613){try{agents[_0x908b('0x15')](_0x42d613);queues[_0x908b('0x15')](_0x42d613);}catch(_0x47c340){utils[_0x908b('0x11')](_0x47c340);}});ami['on'](_0x908b('0x16'),function(_0x4c60cb){try{agents['agentcomplete'](_0x4c60cb);queues['agentcomplete'](_0x4c60cb);members['agentcomplete'](_0x4c60cb);}catch(_0x570470){utils[_0x908b('0x11')](_0x570470);}});ami['on'](_0x908b('0x17'),function(_0x21a493){try{agents[_0x908b('0x17')](_0x21a493);queues[_0x908b('0x17')](_0x21a493);}catch(_0x556b95){utils['error'](_0x556b95);}});ami['on']('queuecallerjoin',function(_0x3bde60){try{queues[_0x908b('0x18')](_0x3bde60);recordings[_0x908b('0x18')](_0x3bde60);}catch(_0x4fa183){utils[_0x908b('0x11')](_0x4fa183);}});ami['on'](_0x908b('0x19'),function(_0xba0610){try{queues[_0x908b('0x19')](_0xba0610);}catch(_0x501607){utils[_0x908b('0x11')](_0x501607);}});ami['on']('musiconholdstart',function(_0x43aa4a){try{queues[_0x908b('0x1a')](_0x43aa4a);calls[_0x908b('0x1a')](_0x43aa4a);}catch(_0x517b0a){utils['error'](_0x517b0a);}});ami['on'](_0x908b('0x1b'),function(_0x1fe6f6){try{queues[_0x908b('0x1b')](_0x1fe6f6);calls[_0x908b('0x1b')](_0x1fe6f6);}catch(_0x22a7b8){utils[_0x908b('0x11')](_0x22a7b8);}});ami['on'](_0x908b('0x1c'),function(_0x3de90e){try{calls[_0x908b('0x1c')](_0x3de90e);recordings[_0x908b('0x1c')](_0x3de90e);}catch(_0x2c6940){utils[_0x908b('0x11')](_0x2c6940);}});ami['on'](_0x908b('0x1d'),function(_0x3c4ef8){try{calls['hangup'](_0x3c4ef8);recordings[_0x908b('0x1d')](_0x3c4ef8);dials[_0x908b('0x1d')](_0x3c4ef8);agents[_0x908b('0x1d')](_0x3c4ef8);queues[_0x908b('0x1d')](_0x3c4ef8);}catch(_0x297573){utils[_0x908b('0x11')](_0x297573);}});ami['on'](_0x908b('0x1e'),function(_0x5427b1){try{members['cdr'](_0x5427b1);}catch(_0x278dae){utils[_0x908b('0x11')](_0x278dae);}});ami['on'](_0x908b('0x1f'),function(_0x165171){try{queues[_0x908b('0x1f')](_0x165171);agents[_0x908b('0x1f')](_0x165171);transfers[_0x908b('0x1f')](_0x165171);}catch(_0x1f0bde){utils[_0x908b('0x11')](_0x1f0bde);}});ami['on'](_0x908b('0x20'),function(_0x353eb7){try{queues[_0x908b('0x20')](_0x353eb7);transfers[_0x908b('0x20')](_0x353eb7);agents[_0x908b('0x20')](_0x353eb7);calls[_0x908b('0x20')](_0x353eb7);}catch(_0x20c05a){utils[_0x908b('0x11')](_0x20c05a);}});ami['on']('varset',function(_0x501541){try{queues['varset'](_0x501541);recordings['varset'](_0x501541);calls[_0x908b('0x21')](_0x501541);dials[_0x908b('0x21')](_0x501541);}catch(_0x11368a){utils[_0x908b('0x11')](_0x11368a);}});ami['on'](_0x908b('0x22'),function(_0x3079be){try{calls[_0x908b('0x22')](_0x3079be);recordings[_0x908b('0x22')](_0x3079be);dials[_0x908b('0x22')](_0x3079be);}catch(_0x5f54fa){utils['error'](_0x5f54fa);}});ami['on'](_0x908b('0x23'),function(_0xc463a8){try{calls[_0x908b('0x23')](_0xc463a8);recordings[_0x908b('0x23')](_0xc463a8);}catch(_0x353482){utils[_0x908b('0x11')](_0x353482);}});ami['on'](_0x908b('0x24'),function(_0x56de32){try{dials['dialbegin'](_0x56de32);}catch(_0x4dcb9b){utils[_0x908b('0x11')](_0x4dcb9b);}});ami['on']('dialend',function(_0x114729){try{dials[_0x908b('0x25')](_0x114729);}catch(_0x2f41c2){utils[_0x908b('0x11')](_0x2f41c2);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 544d384..a2ec473 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 _0xe3cc=['devicestatechange','state','INUSE','BUSY','device','voice','TALKING','now','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','assign','queue','cdr','channel','data1','data3','destinationchannel','source','destination','util','Local/_attended@transfer','info','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','data2','membername','type','getUserByInterface','name','internal','request','CreateMemberReport','split','then','error','some'];(function(_0x4b9290,_0x548f3c){var _0x2a585a=function(_0x19500f){while(--_0x19500f){_0x4b9290['push'](_0x4b9290['shift']());}};_0x2a585a(++_0x548f3c);}(_0xe3cc,0x19b));var _0xce3c=function(_0x1eae41,_0x3c1151){_0x1eae41=_0x1eae41-0x0;var _0x588453=_0xe3cc[_0x1eae41];return _0x588453;};'use strict';var _=require('lodash');var util=require(_0xce3c('0x0'));var utils=require('./utils');var members={};var exclude=[_0xce3c('0x1'),'Queue:'];function writeDB(_0x14656b){utils[_0xce3c('0x2')](util[_0xce3c('0x3')](_0xce3c('0x4'),_0x14656b[_0xce3c('0x5')],_0x14656b[_0xce3c('0x6')],_0x14656b['channel'],_0x14656b[_0xce3c('0x7')],_0x14656b[_0xce3c('0x8')],_0x14656b[_0xce3c('0x9')]));if(_0x14656b[_0xce3c('0x6')]){utils[_0xce3c('0xa')](_0x14656b[_0xce3c('0x6')])['then'](function(_0x1459dc){if(_0x1459dc){_0x14656b[_0xce3c('0x8')]=_0x1459dc[_0xce3c('0xb')];_0x14656b[_0xce3c('0xc')]=_0x1459dc[_0xce3c('0xc')];utils[_0xce3c('0xd')](_0xce3c('0xe'),_0x14656b);}else{utils['getUserByName'](_0x14656b[_0xce3c('0x6')][_0xce3c('0xf')]('/')[0x1])[_0xce3c('0x10')](function(_0x1532d0){if(_0x1532d0){_0x14656b['membername']=_0x1532d0['name'];_0x14656b[_0xce3c('0xc')]=_0x1532d0[_0xce3c('0xc')];utils[_0xce3c('0xd')](_0xce3c('0xe'),_0x14656b);}});}})['catch'](function(_0x57a97f){utils[_0xce3c('0x11')](_0x57a97f);});}delete members[_0x14656b['interface']];}function startsWith(_0x44741f,_0x5eef49){return _[_0xce3c('0x12')](_0x44741f,function(_0x184b41){return _['startsWith'](_0x5eef49,_0x184b41);});}exports[_0xce3c('0x13')]=function(_0x399f89){switch(_0x399f89[_0xce3c('0x14')]){case _0xce3c('0x15'):case _0xce3c('0x16'):if(!startsWith(exclude,_0x399f89[_0xce3c('0x17')])){members[_0x399f89[_0xce3c('0x17')]]={'channel':_0xce3c('0x18'),'interface':_0x399f89[_0xce3c('0x17')],'type':_0xce3c('0x19'),'enterAt':utils[_0xce3c('0x1a')](),'role':'agent'};}break;case _0xce3c('0x1b'):if(!_[_0xce3c('0x1c')](members[_0x399f89[_0xce3c('0x17')]])){members[_0x399f89[_0xce3c('0x17')]][_0xce3c('0x1d')]=utils['now']();members[_0x399f89[_0xce3c('0x17')]][_0xce3c('0x1e')]=utils[_0xce3c('0x1f')](members[_0x399f89[_0xce3c('0x17')]]['exitAt'],members[_0x399f89[_0xce3c('0x17')]][_0xce3c('0x20')]);if(members[_0x399f89[_0xce3c('0x17')]]['uniqueid']){writeDB(members[_0x399f89[_0xce3c('0x17')]]);}}default:break;}};exports[_0xce3c('0x21')]=function(_0x5a1a3d){if(!_[_0xce3c('0x1c')](members[_0x5a1a3d['interface']])){members[_0x5a1a3d[_0xce3c('0x6')]]=_[_0xce3c('0x22')](members[_0x5a1a3d[_0xce3c('0x6')]],{'data4':_0x5a1a3d[_0xce3c('0x23')],'uniqueid':_0x5a1a3d[_0xce3c('0x5')]});}};exports[_0xce3c('0x24')]=function(_0x241818){if(_0x241818['channel']){var _0x326584=_0x241818[_0xce3c('0x25')]['split']('-')[0x0];if(!_[_0xce3c('0x1c')](members[_0x326584])){members[_0x326584]=_[_0xce3c('0x22')](members[_0x326584],{'data1':members[_0x326584][_0xce3c('0x26')]||_0x241818[_0xce3c('0x9')],'data2':members[_0x326584]['data2']||_0x241818['source'],'data3':members[_0x326584][_0xce3c('0x27')]||_0x241818['destination'],'uniqueid':members[_0x326584][_0xce3c('0x5')]||_0x241818[_0xce3c('0x5')]});if(members[_0x326584][_0xce3c('0x1d')]){writeDB(members[_0x326584]);}}}if(_0x241818[_0xce3c('0x28')]){var _0x203f29=_0x241818[_0xce3c('0x28')][_0xce3c('0xf')]('-')[0x0];if(!_[_0xce3c('0x1c')](members[_0x203f29])){members[_0x203f29]=_[_0xce3c('0x22')](members[_0x203f29],{'data1':members[_0x203f29]['data1']||_0x241818[_0xce3c('0x9')],'data2':members[_0x203f29][_0xce3c('0x7')]||_0x241818[_0xce3c('0x29')],'data3':members[_0x203f29][_0xce3c('0x27')]||_0x241818[_0xce3c('0x2a')],'uniqueid':members[_0x203f29][_0xce3c('0x5')]||_0x241818['uniqueid']});if(members[_0x203f29][_0xce3c('0x1d')]){writeDB(members[_0x203f29]);}}}}; \ No newline at end of file +var _0xec14=['Local/_attended@transfer','Queue:','info','format','MEMBER|%s|%s|%s|%s|%s|%s','interface','membername','type','getUserByInterface','then','name','internal','CreateMemberReport','split','catch','error','some','startsWith','devicestatechange','state','INUSE','BUSY','device','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','enterAt','uniqueid','agentcomplete','assign','queue','cdr','channel','data2','source','destinationchannel','data1','data3','destination','lodash','util','./utils'];(function(_0x323419,_0x2a6172){var _0x4c0be7=function(_0x5ae2df){while(--_0x5ae2df){_0x323419['push'](_0x323419['shift']());}};_0x4c0be7(++_0x2a6172);}(_0xec14,0x1d3));var _0x4ec1=function(_0x32b993,_0x1c5989){_0x32b993=_0x32b993-0x0;var _0x482780=_0xec14[_0x32b993];return _0x482780;};'use strict';var _=require(_0x4ec1('0x0'));var util=require(_0x4ec1('0x1'));var utils=require(_0x4ec1('0x2'));var members={};var exclude=[_0x4ec1('0x3'),_0x4ec1('0x4')];function writeDB(_0x2016ee){utils[_0x4ec1('0x5')](util[_0x4ec1('0x6')](_0x4ec1('0x7'),_0x2016ee['uniqueid'],_0x2016ee[_0x4ec1('0x8')],_0x2016ee['channel'],_0x2016ee['data2'],_0x2016ee[_0x4ec1('0x9')],_0x2016ee[_0x4ec1('0xa')]));if(_0x2016ee[_0x4ec1('0x8')]){utils[_0x4ec1('0xb')](_0x2016ee['interface'])[_0x4ec1('0xc')](function(_0x436255){if(_0x436255){_0x2016ee[_0x4ec1('0x9')]=_0x436255[_0x4ec1('0xd')];_0x2016ee[_0x4ec1('0xe')]=_0x436255[_0x4ec1('0xe')];utils['request'](_0x4ec1('0xf'),_0x2016ee);}else{utils['getUserByName'](_0x2016ee[_0x4ec1('0x8')][_0x4ec1('0x10')]('/')[0x1])[_0x4ec1('0xc')](function(_0x5945f0){if(_0x5945f0){_0x2016ee[_0x4ec1('0x9')]=_0x5945f0[_0x4ec1('0xd')];_0x2016ee[_0x4ec1('0xe')]=_0x5945f0[_0x4ec1('0xe')];utils['request']('CreateMemberReport',_0x2016ee);}});}})[_0x4ec1('0x11')](function(_0xb9c50e){utils[_0x4ec1('0x12')](_0xb9c50e);});}delete members[_0x2016ee[_0x4ec1('0x8')]];}function startsWith(_0x1878cc,_0x2647ee){return _[_0x4ec1('0x13')](_0x1878cc,function(_0x506553){return _[_0x4ec1('0x14')](_0x2647ee,_0x506553);});}exports[_0x4ec1('0x15')]=function(_0x29bd53){switch(_0x29bd53[_0x4ec1('0x16')]){case _0x4ec1('0x17'):case _0x4ec1('0x18'):if(!startsWith(exclude,_0x29bd53[_0x4ec1('0x19')])){members[_0x29bd53['device']]={'channel':_0x4ec1('0x1a'),'interface':_0x29bd53[_0x4ec1('0x19')],'type':_0x4ec1('0x1b'),'enterAt':utils[_0x4ec1('0x1c')](),'role':_0x4ec1('0x1d')};}break;case _0x4ec1('0x1e'):if(!_[_0x4ec1('0x1f')](members[_0x29bd53[_0x4ec1('0x19')]])){members[_0x29bd53['device']][_0x4ec1('0x20')]=utils[_0x4ec1('0x1c')]();members[_0x29bd53[_0x4ec1('0x19')]][_0x4ec1('0x21')]=utils['diffTime'](members[_0x29bd53['device']][_0x4ec1('0x20')],members[_0x29bd53[_0x4ec1('0x19')]][_0x4ec1('0x22')]);if(members[_0x29bd53[_0x4ec1('0x19')]][_0x4ec1('0x23')]){writeDB(members[_0x29bd53['device']]);}}default:break;}};exports[_0x4ec1('0x24')]=function(_0xe3a06f){if(!_[_0x4ec1('0x1f')](members[_0xe3a06f[_0x4ec1('0x8')]])){members[_0xe3a06f[_0x4ec1('0x8')]]=_[_0x4ec1('0x25')](members[_0xe3a06f[_0x4ec1('0x8')]],{'data4':_0xe3a06f[_0x4ec1('0x26')],'uniqueid':_0xe3a06f[_0x4ec1('0x23')]});}};exports[_0x4ec1('0x27')]=function(_0x1701d8){if(_0x1701d8[_0x4ec1('0x28')]){var _0x5bb3b4=_0x1701d8[_0x4ec1('0x28')][_0x4ec1('0x10')]('-')[0x0];if(!_[_0x4ec1('0x1f')](members[_0x5bb3b4])){members[_0x5bb3b4]=_[_0x4ec1('0x25')](members[_0x5bb3b4],{'data1':members[_0x5bb3b4]['data1']||_0x1701d8['type'],'data2':members[_0x5bb3b4][_0x4ec1('0x29')]||_0x1701d8[_0x4ec1('0x2a')],'data3':members[_0x5bb3b4]['data3']||_0x1701d8['destination'],'uniqueid':members[_0x5bb3b4]['uniqueid']||_0x1701d8['uniqueid']});if(members[_0x5bb3b4][_0x4ec1('0x20')]){writeDB(members[_0x5bb3b4]);}}}if(_0x1701d8[_0x4ec1('0x2b')]){var _0x4af80c=_0x1701d8[_0x4ec1('0x2b')][_0x4ec1('0x10')]('-')[0x0];if(!_[_0x4ec1('0x1f')](members[_0x4af80c])){members[_0x4af80c]=_[_0x4ec1('0x25')](members[_0x4af80c],{'data1':members[_0x4af80c][_0x4ec1('0x2c')]||_0x1701d8['type'],'data2':members[_0x4af80c]['data2']||_0x1701d8['source'],'data3':members[_0x4af80c][_0x4ec1('0x2d')]||_0x1701d8[_0x4ec1('0x2e')],'uniqueid':members[_0x4af80c][_0x4ec1('0x23')]||_0x1701d8[_0x4ec1('0x23')]});if(members[_0x4af80c]['exitAt']){writeDB(members[_0x4af80c]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 052492c..f6d02c5 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 _0xcd45=['secondtransfererlinkedid','ATTENDED','origtransfererexten','transferuniqueid','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','calleridname','secondtransfereruniqueid','transfertargetlinkedid','holdtime','mohtime','error','stack','musiconholdstart','musiconholdstartAt','musiconholdstop','lodash','util','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','assign','now','hangup','isNil','queuecallercomplete','queuecallercompleteAt','queuecallerenterreason','varset','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','queueposition','queuecallerabandon','EXITWITHKEY','ABANDONED','queuecallerleave','queuecallerleaveAt','diffTime','queuecallerjoinAt','position','connectedlinenum','connectedlinename','agentconnect','assigned','destaccountcode','agentcomplete','membername','reason','transfer','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid'];(function(_0x99c621,_0x48b1c9){var _0x5d0f13=function(_0x1a3382){while(--_0x1a3382){_0x99c621['push'](_0x99c621['shift']());}};_0x5d0f13(++_0x48b1c9);}(_0xcd45,0x1a3));var _0x5cd4=function(_0x5d9f9a,_0x338fa2){_0x5d9f9a=_0x5d9f9a-0x0;var _0x322888=_0xcd45[_0x5d9f9a];return _0x322888;};'use strict';var _=require(_0x5cd4('0x0'));var util=require(_0x5cd4('0x1'));var utils=require(_0x5cd4('0x2'));var queues={};function writeDB(_0x528972){utils[_0x5cd4('0x3')](util[_0x5cd4('0x4')](_0x5cd4('0x5'),_0x528972[_0x5cd4('0x6')],_0x528972['channel'],_0x528972['queue'],_0x528972[_0x5cd4('0x7')],_0x528972[_0x5cd4('0x8')],_0x528972[_0x5cd4('0x9')],_0x528972[_0x5cd4('0xa')]));if(_0x528972[_0x5cd4('0xb')]){utils[_0x5cd4('0xc')](_0x528972[_0x5cd4('0xb')])[_0x5cd4('0xd')](function(_0x35bf39){if(_0x35bf39){_0x528972[_0x5cd4('0xe')]=_0x35bf39[_0x5cd4('0xe')];}utils[_0x5cd4('0xf')](_0x5cd4('0x10'),_0x528972);});}else{utils['request'](_0x5cd4('0x10'),_0x528972);}if(_0x528972[_0x5cd4('0x11')]){delete queues[_0x528972[_0x5cd4('0x11')]];}else{delete queues[_0x528972[_0x5cd4('0x6')]];}}exports[_0x5cd4('0x12')]=function(_0x54ae2d){queues[_0x54ae2d[_0x5cd4('0x6')]]=_[_0x5cd4('0x13')](_0x54ae2d,{'originalposition':_0x54ae2d['position'],'queuecallerjoinAt':utils[_0x5cd4('0x14')](),'mohtime':0x0});};exports[_0x5cd4('0x15')]=function(_0x556709){if(!_[_0x5cd4('0x16')](queues[_0x556709[_0x5cd4('0x6')]])){if(queues[_0x556709[_0x5cd4('0x6')]]['queuecallerleaveAt']){if(!queues[_0x556709[_0x5cd4('0x6')]]['queuecallerabandon']&&!queues[_0x556709['uniqueid']]['queuecallerexit']){queues[_0x556709[_0x5cd4('0x6')]][_0x5cd4('0x17')]=!![];queues[_0x556709[_0x5cd4('0x6')]][_0x5cd4('0x18')]=utils['now']();queues[_0x556709['uniqueid']][_0x5cd4('0xa')]='COMPLETEDBYAGENT';}writeDB(queues[_0x556709[_0x5cd4('0x6')]]);}else{if(queues[_0x556709[_0x5cd4('0x6')]]['transfereduniqueid']){queues[queues[_0x556709['uniqueid']]['transfereduniqueid']]=queues[_0x556709[_0x5cd4('0x6')]];queues[queues[_0x556709['uniqueid']][_0x5cd4('0x11')]][_0x5cd4('0x19')]=0x2;delete queues[_0x556709['uniqueid']];}}}};exports[_0x5cd4('0x1a')]=function(_0x2fbea3){if(!_['isNil'](_0x2fbea3[_0x5cd4('0x1b')][_0x5cd4('0x1c')])&&_0x2fbea3[_0x5cd4('0x1d')][_0x5cd4('0x1e')]()!==_0x5cd4('0x1f')){if(!_[_0x5cd4('0x16')](queues[_0x2fbea3[_0x5cd4('0x6')]])){queues[_0x2fbea3['uniqueid']]['queuecallerabandon']=![];queues[_0x2fbea3[_0x5cd4('0x6')]][_0x5cd4('0x20')]=null;queues[_0x2fbea3['uniqueid']][_0x5cd4('0x21')]=!![];queues[_0x2fbea3['uniqueid']][_0x5cd4('0x22')]=utils[_0x5cd4('0x14')]();queues[_0x2fbea3[_0x5cd4('0x6')]][_0x5cd4('0xa')]=_0x2fbea3[_0x5cd4('0x1d')][_0x5cd4('0x1e')]();writeDB(queues[_0x2fbea3[_0x5cd4('0x6')]]);}}else if(!_['isNil'](_0x2fbea3[_0x5cd4('0x1b')][_0x5cd4('0x23')])){if(!_[_0x5cd4('0x16')](queues[_0x2fbea3[_0x5cd4('0x6')]])&&!queues[_0x2fbea3[_0x5cd4('0x6')]][_0x5cd4('0x24')]){queues[_0x2fbea3[_0x5cd4('0x6')]][_0x5cd4('0x24')]=![];queues[_0x2fbea3[_0x5cd4('0x6')]][_0x5cd4('0x20')]=null;queues[_0x2fbea3[_0x5cd4('0x6')]][_0x5cd4('0x21')]=!![];queues[_0x2fbea3[_0x5cd4('0x6')]]['queuecallerexitAt']=utils['now']();queues[_0x2fbea3[_0x5cd4('0x6')]]['queuecallerexitreason']=_0x5cd4('0x25');}}};exports[_0x5cd4('0x24')]=function(_0x3f51c9){if(!_[_0x5cd4('0x16')](queues[_0x3f51c9[_0x5cd4('0x6')]])){queues[_0x3f51c9[_0x5cd4('0x6')]]['queuecallerexit']=![];queues[_0x3f51c9[_0x5cd4('0x6')]][_0x5cd4('0x22')]=null;queues[_0x3f51c9[_0x5cd4('0x6')]]['queuecallerabandon']=!![];queues[_0x3f51c9[_0x5cd4('0x6')]][_0x5cd4('0x20')]=utils[_0x5cd4('0x14')]();queues[_0x3f51c9[_0x5cd4('0x6')]][_0x5cd4('0xa')]=_0x5cd4('0x26');}};exports['queuecallerleave']=function(_0x42a21a){if(!_[_0x5cd4('0x16')](queues[_0x42a21a[_0x5cd4('0x6')]])){queues[_0x42a21a[_0x5cd4('0x6')]][_0x5cd4('0x27')]=!![];queues[_0x42a21a[_0x5cd4('0x6')]][_0x5cd4('0x28')]=utils[_0x5cd4('0x14')]();queues[_0x42a21a[_0x5cd4('0x6')]]['holdtime']=utils[_0x5cd4('0x29')](queues[_0x42a21a['uniqueid']]['queuecallerleaveAt'],queues[_0x42a21a[_0x5cd4('0x6')]][_0x5cd4('0x2a')]);queues[_0x42a21a[_0x5cd4('0x6')]][_0x5cd4('0x2b')]=_0x42a21a[_0x5cd4('0x2b')];queues[_0x42a21a['uniqueid']]['count']=_0x42a21a['count'];queues[_0x42a21a['uniqueid']]['connectedlinenum']=_0x42a21a[_0x5cd4('0x2c')];queues[_0x42a21a[_0x5cd4('0x6')]][_0x5cd4('0x2d')]=_0x42a21a[_0x5cd4('0x2d')];}};exports[_0x5cd4('0x2e')]=function(_0x187a13){if(!_[_0x5cd4('0x16')](queues[_0x187a13[_0x5cd4('0x6')]])){queues[_0x187a13[_0x5cd4('0x6')]][_0x5cd4('0x24')]=![];queues[_0x187a13[_0x5cd4('0x6')]][_0x5cd4('0x24')]=![];queues[_0x187a13['uniqueid']]['queuecallerabandonAt']=null;queues[_0x187a13[_0x5cd4('0x6')]]['queuecallerexit']=![];queues[_0x187a13[_0x5cd4('0x6')]][_0x5cd4('0xa')]=null;queues[_0x187a13[_0x5cd4('0x6')]]['queuecallerexitAt']=null;queues[_0x187a13[_0x5cd4('0x6')]][_0x5cd4('0x2f')]=!![];queues[_0x187a13['uniqueid']][_0x5cd4('0x9')]=_0x187a13[_0x5cd4('0x30')];queues[_0x187a13[_0x5cd4('0x6')]][_0x5cd4('0x7')]=_0x187a13['membername'];}};exports[_0x5cd4('0x31')]=function(_0x3eb7f8){if(!_[_0x5cd4('0x16')](queues[_0x3eb7f8[_0x5cd4('0x6')]])){if(queues[_0x3eb7f8[_0x5cd4('0x6')]][_0x5cd4('0x28')]){queues[_0x3eb7f8[_0x5cd4('0x6')]][_0x5cd4('0x24')]=![];queues[_0x3eb7f8['uniqueid']]['queuecallerabandon']=![];queues[_0x3eb7f8[_0x5cd4('0x6')]]['queuecallerabandonAt']=null;queues[_0x3eb7f8[_0x5cd4('0x6')]][_0x5cd4('0x21')]=![];queues[_0x3eb7f8[_0x5cd4('0x6')]]['queuecallerexitAt']=null;queues[_0x3eb7f8['uniqueid']][_0x5cd4('0x2f')]=!![];queues[_0x3eb7f8[_0x5cd4('0x6')]][_0x5cd4('0x7')]=_0x3eb7f8[_0x5cd4('0x32')];queues[_0x3eb7f8['uniqueid']]['queuecallercomplete']=!![];queues[_0x3eb7f8[_0x5cd4('0x6')]][_0x5cd4('0x18')]=utils[_0x5cd4('0x14')]();if(_0x3eb7f8[_0x5cd4('0x33')]==_0x5cd4('0x34')){if(!queues[_0x3eb7f8[_0x5cd4('0x6')]][_0x5cd4('0x34')]){queues[_0x3eb7f8[_0x5cd4('0x6')]][_0x5cd4('0xa')]='TRANSFER';}}else{queues[_0x3eb7f8[_0x5cd4('0x6')]][_0x5cd4('0xa')]='COMPLETEDBY'+_0x3eb7f8['reason'][_0x5cd4('0x1e')]();}writeDB(queues[_0x3eb7f8['uniqueid']]);}}};exports[_0x5cd4('0x35')]=function(_0x2e32cd){if(!_['isNil'](queues[_0x2e32cd['transfereeuniqueid']])){queues[_0x2e32cd[_0x5cd4('0x36')]][_0x5cd4('0x34')]=!![];queues[_0x2e32cd[_0x5cd4('0x36')]][_0x5cd4('0x37')]=_0x5cd4('0x38');queues[_0x2e32cd[_0x5cd4('0x36')]][_0x5cd4('0x39')]=_0x2e32cd['extension'];queues[_0x2e32cd[_0x5cd4('0x36')]]['transferuniqueid']=_0x2e32cd['transfereeuniqueid'];queues[_0x2e32cd[_0x5cd4('0x36')]][_0x5cd4('0xa')]=_0x5cd4('0x3a');}};exports[_0x5cd4('0x3b')]=function(_0xba48b9){try{if(_0xba48b9[_0x5cd4('0x3c')]==_0xba48b9['origtransfererlinkedid']){if(!_['isNil'](queues[_0xba48b9['secondtransfererlinkedid']])){queues[_0xba48b9[_0x5cd4('0x3d')]][_0x5cd4('0x34')]=!![];queues[_0xba48b9[_0x5cd4('0x3d')]][_0x5cd4('0x37')]=_0x5cd4('0x3e');queues[_0xba48b9['secondtransfererlinkedid']][_0x5cd4('0x39')]=_0xba48b9[_0x5cd4('0x3f')];queues[_0xba48b9[_0x5cd4('0x3d')]][_0x5cd4('0x40')]=_0xba48b9['origtransfereruniqueid'];queues[_0xba48b9[_0x5cd4('0x3d')]][_0x5cd4('0xa')]=_0x5cd4('0x41');}if(!_['isNil'](queues[_0xba48b9[_0x5cd4('0x42')]])){if(_0xba48b9[_0x5cd4('0x43')]&&queues[_0xba48b9[_0x5cd4('0x43')]]){queues[_0xba48b9[_0x5cd4('0x43')]][_0x5cd4('0x19')]=0x1;queues[_0xba48b9[_0x5cd4('0x36')]]=_[_0x5cd4('0x44')](queues[_0xba48b9[_0x5cd4('0x43')]]);queues[_0xba48b9[_0x5cd4('0x36')]]['transfereduniqueid']=_0xba48b9[_0x5cd4('0x45')];queues[_0xba48b9[_0x5cd4('0x36')]][_0x5cd4('0x19')]=0x2;queues[_0xba48b9[_0x5cd4('0x36')]]['calleridnum']=queues[_0xba48b9[_0x5cd4('0x3d')]][_0x5cd4('0x8')];queues[_0xba48b9[_0x5cd4('0x36')]][_0x5cd4('0x46')]=queues[_0xba48b9[_0x5cd4('0x3d')]][_0x5cd4('0x46')];queues[_0xba48b9[_0x5cd4('0x36')]][_0x5cd4('0x2a')]=utils[_0x5cd4('0x14')]();queues[_0xba48b9[_0x5cd4('0x36')]]['queuecallerleaveAt']=utils['now']();queues[_0xba48b9[_0x5cd4('0x36')]]['holdtime']=0x0;queues[_0xba48b9['transfereeuniqueid']]['mohtime']=0x0;}else{queues[_0xba48b9[_0x5cd4('0x42')]][_0x5cd4('0x11')]=_0xba48b9[_0x5cd4('0x3d')];}}}else if(_0xba48b9[_0x5cd4('0x47')]==_0xba48b9[_0x5cd4('0x3d')]){if(!_[_0x5cd4('0x16')](queues[_0xba48b9[_0x5cd4('0x42')]])){queues[_0xba48b9['origtransfererlinkedid']]['transfer']=!![];queues[_0xba48b9['origtransfererlinkedid']][_0x5cd4('0x37')]=_0x5cd4('0x3e');queues[_0xba48b9['origtransfererlinkedid']][_0x5cd4('0x39')]=_0xba48b9['secondtransfererexten'];queues[_0xba48b9[_0x5cd4('0x42')]][_0x5cd4('0x40')]=_0xba48b9['secondtransfereruniqueid'];queues[_0xba48b9[_0x5cd4('0x42')]][_0x5cd4('0xa')]=_0x5cd4('0x41');}if(!_[_0x5cd4('0x16')](queues[_0xba48b9[_0x5cd4('0x3d')]])){if(_0xba48b9['transfertargetlinkedid']&&queues[_0xba48b9['transfertargetlinkedid']]){queues[_0xba48b9[_0x5cd4('0x48')]][_0x5cd4('0x19')]=0x1;queues[_0xba48b9[_0x5cd4('0x45')]]=_[_0x5cd4('0x44')](queues[_0xba48b9[_0x5cd4('0x48')]]);queues[_0xba48b9[_0x5cd4('0x45')]][_0x5cd4('0x11')]=_0xba48b9[_0x5cd4('0x45')];queues[_0xba48b9[_0x5cd4('0x45')]][_0x5cd4('0x19')]=0x2;queues[_0xba48b9[_0x5cd4('0x45')]][_0x5cd4('0x8')]=queues[_0xba48b9[_0x5cd4('0x42')]][_0x5cd4('0x8')];queues[_0xba48b9[_0x5cd4('0x45')]][_0x5cd4('0x46')]=queues[_0xba48b9[_0x5cd4('0x42')]][_0x5cd4('0x46')];queues[_0xba48b9[_0x5cd4('0x45')]][_0x5cd4('0x2a')]=utils[_0x5cd4('0x14')]();queues[_0xba48b9[_0x5cd4('0x45')]][_0x5cd4('0x28')]=utils['now']();queues[_0xba48b9[_0x5cd4('0x45')]][_0x5cd4('0x49')]=0x0;queues[_0xba48b9[_0x5cd4('0x45')]][_0x5cd4('0x4a')]=0x0;}else{queues[_0xba48b9[_0x5cd4('0x3d')]][_0x5cd4('0x11')]=_0xba48b9[_0x5cd4('0x42')];}}}}catch(_0x57e5c0){utils[_0x5cd4('0x4b')](_0x57e5c0[_0x5cd4('0x4c')]);}};exports[_0x5cd4('0x4d')]=function(_0x515271){if(!_[_0x5cd4('0x16')](queues[_0x515271[_0x5cd4('0x6')]])){queues[_0x515271[_0x5cd4('0x6')]][_0x5cd4('0x4e')]=utils['now']();}};exports[_0x5cd4('0x4f')]=function(_0x180623){if(!_['isNil'](queues[_0x180623['uniqueid']])){if(!_[_0x5cd4('0x16')](queues[_0x180623[_0x5cd4('0x6')]][_0x5cd4('0x4e')])){queues[_0x180623[_0x5cd4('0x6')]]['mohtime']+=utils[_0x5cd4('0x29')](utils[_0x5cd4('0x14')](),queues[_0x180623[_0x5cd4('0x6')]][_0x5cd4('0x4e')]);delete queues[_0x180623[_0x5cd4('0x6')]]['musiconholdstartAt'];}}}; \ No newline at end of file +var _0xd82c=['queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queueposition','queuecallerexitAt','ABANDONED','queuecallerleave','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','assigned','destaccountcode','membername','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','BLIND','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','ATTENDED','transferexten','origtransfererexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','mohtime','error','stack','musiconholdstart','musiconholdstartAt','lodash','util','./utils','info','format','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','assign','position','now','hangup','queuecallerabandon','queuecallerexit'];(function(_0x1dcf95,_0x89462e){var _0x34035e=function(_0xda0870){while(--_0xda0870){_0x1dcf95['push'](_0x1dcf95['shift']());}};_0x34035e(++_0x89462e);}(_0xd82c,0x181));var _0xcd82=function(_0x4175e9,_0x5bc644){_0x4175e9=_0x4175e9-0x0;var _0x5db974=_0xd82c[_0x4175e9];return _0x5db974;};'use strict';var _=require(_0xcd82('0x0'));var util=require(_0xcd82('0x1'));var utils=require(_0xcd82('0x2'));var queues={};function writeDB(_0x493f3a){utils[_0xcd82('0x3')](util[_0xcd82('0x4')]('QUEUE|%s|%s|%s|%s|%s|%s|%s',_0x493f3a[_0xcd82('0x5')],_0x493f3a[_0xcd82('0x6')],_0x493f3a['queue'],_0x493f3a[_0xcd82('0x7')],_0x493f3a[_0xcd82('0x8')],_0x493f3a[_0xcd82('0x9')],_0x493f3a[_0xcd82('0xa')]));if(_0x493f3a[_0xcd82('0xb')]){utils[_0xcd82('0xc')](_0x493f3a[_0xcd82('0xb')])[_0xcd82('0xd')](function(_0xcd2794){if(_0xcd2794){_0x493f3a[_0xcd82('0xe')]=_0xcd2794[_0xcd82('0xe')];}utils[_0xcd82('0xf')](_0xcd82('0x10'),_0x493f3a);});}else{utils['request'](_0xcd82('0x10'),_0x493f3a);}if(_0x493f3a[_0xcd82('0x11')]){delete queues[_0x493f3a[_0xcd82('0x11')]];}else{delete queues[_0x493f3a[_0xcd82('0x5')]];}}exports[_0xcd82('0x12')]=function(_0x28830e){queues[_0x28830e['uniqueid']]=_[_0xcd82('0x13')](_0x28830e,{'originalposition':_0x28830e[_0xcd82('0x14')],'queuecallerjoinAt':utils[_0xcd82('0x15')](),'mohtime':0x0});};exports[_0xcd82('0x16')]=function(_0x4c3264){if(!_['isNil'](queues[_0x4c3264[_0xcd82('0x5')]])){if(queues[_0x4c3264[_0xcd82('0x5')]]['queuecallerleaveAt']){if(!queues[_0x4c3264[_0xcd82('0x5')]][_0xcd82('0x17')]&&!queues[_0x4c3264[_0xcd82('0x5')]][_0xcd82('0x18')]){queues[_0x4c3264[_0xcd82('0x5')]][_0xcd82('0x19')]=!![];queues[_0x4c3264['uniqueid']][_0xcd82('0x1a')]=utils['now']();queues[_0x4c3264[_0xcd82('0x5')]][_0xcd82('0xa')]=_0xcd82('0x1b');}writeDB(queues[_0x4c3264[_0xcd82('0x5')]]);}else{if(queues[_0x4c3264[_0xcd82('0x5')]][_0xcd82('0x11')]){queues[queues[_0x4c3264[_0xcd82('0x5')]]['transfereduniqueid']]=queues[_0x4c3264['uniqueid']];queues[queues[_0x4c3264[_0xcd82('0x5')]]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x4c3264[_0xcd82('0x5')]];}}}};exports['varset']=function(_0x70b86f){if(!_[_0xcd82('0x1c')](_0x70b86f[_0xcd82('0x1d')][_0xcd82('0x1e')])&&_0x70b86f[_0xcd82('0x1f')][_0xcd82('0x20')]()!==_0xcd82('0x21')){if(!_[_0xcd82('0x1c')](queues[_0x70b86f[_0xcd82('0x5')]])){queues[_0x70b86f['uniqueid']][_0xcd82('0x17')]=![];queues[_0x70b86f[_0xcd82('0x5')]][_0xcd82('0x22')]=null;queues[_0x70b86f['uniqueid']][_0xcd82('0x18')]=!![];queues[_0x70b86f['uniqueid']]['queuecallerexitAt']=utils[_0xcd82('0x15')]();queues[_0x70b86f[_0xcd82('0x5')]]['queuecallerexitreason']=_0x70b86f[_0xcd82('0x1f')][_0xcd82('0x20')]();writeDB(queues[_0x70b86f[_0xcd82('0x5')]]);}}else if(!_['isNil'](_0x70b86f[_0xcd82('0x1d')][_0xcd82('0x23')])){if(!_[_0xcd82('0x1c')](queues[_0x70b86f[_0xcd82('0x5')]])&&!queues[_0x70b86f[_0xcd82('0x5')]][_0xcd82('0x17')]){queues[_0x70b86f[_0xcd82('0x5')]][_0xcd82('0x17')]=![];queues[_0x70b86f[_0xcd82('0x5')]][_0xcd82('0x22')]=null;queues[_0x70b86f[_0xcd82('0x5')]][_0xcd82('0x18')]=!![];queues[_0x70b86f[_0xcd82('0x5')]][_0xcd82('0x24')]=utils['now']();queues[_0x70b86f['uniqueid']][_0xcd82('0xa')]='EXITWITHKEY';}}};exports[_0xcd82('0x17')]=function(_0x4a61bc){if(!_[_0xcd82('0x1c')](queues[_0x4a61bc['uniqueid']])){queues[_0x4a61bc[_0xcd82('0x5')]][_0xcd82('0x18')]=![];queues[_0x4a61bc['uniqueid']][_0xcd82('0x24')]=null;queues[_0x4a61bc[_0xcd82('0x5')]][_0xcd82('0x17')]=!![];queues[_0x4a61bc[_0xcd82('0x5')]][_0xcd82('0x22')]=utils[_0xcd82('0x15')]();queues[_0x4a61bc[_0xcd82('0x5')]][_0xcd82('0xa')]=_0xcd82('0x25');}};exports[_0xcd82('0x26')]=function(_0x3ed56a){if(!_['isNil'](queues[_0x3ed56a[_0xcd82('0x5')]])){queues[_0x3ed56a[_0xcd82('0x5')]][_0xcd82('0x26')]=!![];queues[_0x3ed56a['uniqueid']][_0xcd82('0x27')]=utils[_0xcd82('0x15')]();queues[_0x3ed56a[_0xcd82('0x5')]][_0xcd82('0x28')]=utils[_0xcd82('0x29')](queues[_0x3ed56a['uniqueid']]['queuecallerleaveAt'],queues[_0x3ed56a[_0xcd82('0x5')]][_0xcd82('0x2a')]);queues[_0x3ed56a['uniqueid']][_0xcd82('0x14')]=_0x3ed56a['position'];queues[_0x3ed56a[_0xcd82('0x5')]]['count']=_0x3ed56a[_0xcd82('0x2b')];queues[_0x3ed56a['uniqueid']]['connectedlinenum']=_0x3ed56a[_0xcd82('0x2c')];queues[_0x3ed56a[_0xcd82('0x5')]]['connectedlinename']=_0x3ed56a[_0xcd82('0x2d')];}};exports[_0xcd82('0x2e')]=function(_0x24329f){if(!_['isNil'](queues[_0x24329f[_0xcd82('0x5')]])){queues[_0x24329f[_0xcd82('0x5')]][_0xcd82('0x17')]=![];queues[_0x24329f['uniqueid']][_0xcd82('0x17')]=![];queues[_0x24329f['uniqueid']][_0xcd82('0x22')]=null;queues[_0x24329f[_0xcd82('0x5')]][_0xcd82('0x18')]=![];queues[_0x24329f['uniqueid']][_0xcd82('0xa')]=null;queues[_0x24329f[_0xcd82('0x5')]][_0xcd82('0x24')]=null;queues[_0x24329f['uniqueid']][_0xcd82('0x2f')]=!![];queues[_0x24329f[_0xcd82('0x5')]]['accountcode']=_0x24329f[_0xcd82('0x30')];queues[_0x24329f['uniqueid']][_0xcd82('0x7')]=_0x24329f[_0xcd82('0x31')];}};exports['agentcomplete']=function(_0x234282){if(!_['isNil'](queues[_0x234282[_0xcd82('0x5')]])){if(queues[_0x234282[_0xcd82('0x5')]][_0xcd82('0x27')]){queues[_0x234282[_0xcd82('0x5')]][_0xcd82('0x17')]=![];queues[_0x234282['uniqueid']]['queuecallerabandon']=![];queues[_0x234282[_0xcd82('0x5')]]['queuecallerabandonAt']=null;queues[_0x234282['uniqueid']][_0xcd82('0x18')]=![];queues[_0x234282[_0xcd82('0x5')]]['queuecallerexitAt']=null;queues[_0x234282[_0xcd82('0x5')]][_0xcd82('0x2f')]=!![];queues[_0x234282[_0xcd82('0x5')]][_0xcd82('0x7')]=_0x234282[_0xcd82('0x31')];queues[_0x234282['uniqueid']][_0xcd82('0x19')]=!![];queues[_0x234282['uniqueid']][_0xcd82('0x1a')]=utils[_0xcd82('0x15')]();if(_0x234282[_0xcd82('0x32')]==_0xcd82('0x33')){if(!queues[_0x234282[_0xcd82('0x5')]][_0xcd82('0x33')]){queues[_0x234282[_0xcd82('0x5')]][_0xcd82('0xa')]=_0xcd82('0x34');}}else{queues[_0x234282[_0xcd82('0x5')]][_0xcd82('0xa')]=_0xcd82('0x35')+_0x234282['reason'][_0xcd82('0x20')]();}writeDB(queues[_0x234282['uniqueid']]);}}};exports[_0xcd82('0x36')]=function(_0x574949){if(!_['isNil'](queues[_0x574949[_0xcd82('0x37')]])){queues[_0x574949[_0xcd82('0x37')]][_0xcd82('0x33')]=!![];queues[_0x574949[_0xcd82('0x37')]][_0xcd82('0x38')]=_0xcd82('0x39');queues[_0x574949[_0xcd82('0x37')]]['transferexten']=_0x574949[_0xcd82('0x3a')];queues[_0x574949['transfereeuniqueid']][_0xcd82('0x3b')]=_0x574949[_0xcd82('0x37')];queues[_0x574949[_0xcd82('0x37')]]['queuecallerexitreason']=_0xcd82('0x3c');}};exports[_0xcd82('0x3d')]=function(_0x471b1b){try{if(_0x471b1b[_0xcd82('0x3e')]==_0x471b1b['origtransfererlinkedid']){if(!_[_0xcd82('0x1c')](queues[_0x471b1b['secondtransfererlinkedid']])){queues[_0x471b1b[_0xcd82('0x3f')]]['transfer']=!![];queues[_0x471b1b[_0xcd82('0x3f')]][_0xcd82('0x38')]=_0xcd82('0x40');queues[_0x471b1b['secondtransfererlinkedid']][_0xcd82('0x41')]=_0x471b1b[_0xcd82('0x42')];queues[_0x471b1b[_0xcd82('0x3f')]][_0xcd82('0x3b')]=_0x471b1b['origtransfereruniqueid'];queues[_0x471b1b['secondtransfererlinkedid']]['queuecallerexitreason']=_0xcd82('0x43');}if(!_['isNil'](queues[_0x471b1b[_0xcd82('0x44')]])){if(_0x471b1b['transfereelinkedid']&&queues[_0x471b1b[_0xcd82('0x45')]]){queues[_0x471b1b[_0xcd82('0x45')]][_0xcd82('0x46')]=0x1;queues[_0x471b1b[_0xcd82('0x37')]]=_[_0xcd82('0x47')](queues[_0x471b1b['transfereelinkedid']]);queues[_0x471b1b[_0xcd82('0x37')]][_0xcd82('0x11')]=_0x471b1b[_0xcd82('0x48')];queues[_0x471b1b[_0xcd82('0x37')]][_0xcd82('0x46')]=0x2;queues[_0x471b1b[_0xcd82('0x37')]][_0xcd82('0x8')]=queues[_0x471b1b[_0xcd82('0x3f')]][_0xcd82('0x8')];queues[_0x471b1b['transfereeuniqueid']][_0xcd82('0x49')]=queues[_0x471b1b[_0xcd82('0x3f')]][_0xcd82('0x49')];queues[_0x471b1b['transfereeuniqueid']][_0xcd82('0x2a')]=utils[_0xcd82('0x15')]();queues[_0x471b1b[_0xcd82('0x37')]][_0xcd82('0x27')]=utils[_0xcd82('0x15')]();queues[_0x471b1b[_0xcd82('0x37')]][_0xcd82('0x28')]=0x0;queues[_0x471b1b[_0xcd82('0x37')]]['mohtime']=0x0;}else{queues[_0x471b1b[_0xcd82('0x44')]][_0xcd82('0x11')]=_0x471b1b[_0xcd82('0x3f')];}}}else if(_0x471b1b[_0xcd82('0x4a')]==_0x471b1b[_0xcd82('0x3f')]){if(!_[_0xcd82('0x1c')](queues[_0x471b1b[_0xcd82('0x44')]])){queues[_0x471b1b[_0xcd82('0x44')]][_0xcd82('0x33')]=!![];queues[_0x471b1b['origtransfererlinkedid']][_0xcd82('0x38')]='ATTENDED';queues[_0x471b1b['origtransfererlinkedid']][_0xcd82('0x41')]=_0x471b1b[_0xcd82('0x4b')];queues[_0x471b1b[_0xcd82('0x44')]][_0xcd82('0x3b')]=_0x471b1b[_0xcd82('0x4a')];queues[_0x471b1b[_0xcd82('0x44')]][_0xcd82('0xa')]=_0xcd82('0x43');}if(!_['isNil'](queues[_0x471b1b[_0xcd82('0x3f')]])){if(_0x471b1b['transfertargetlinkedid']&&queues[_0x471b1b[_0xcd82('0x4c')]]){queues[_0x471b1b[_0xcd82('0x4c')]]['queuecallerenterreason']=0x1;queues[_0x471b1b[_0xcd82('0x48')]]=_[_0xcd82('0x47')](queues[_0x471b1b[_0xcd82('0x4c')]]);queues[_0x471b1b[_0xcd82('0x48')]][_0xcd82('0x11')]=_0x471b1b['transfertargetuniqueid'];queues[_0x471b1b[_0xcd82('0x48')]]['queuecallerenterreason']=0x2;queues[_0x471b1b[_0xcd82('0x48')]][_0xcd82('0x8')]=queues[_0x471b1b[_0xcd82('0x44')]][_0xcd82('0x8')];queues[_0x471b1b[_0xcd82('0x48')]]['calleridname']=queues[_0x471b1b[_0xcd82('0x44')]]['calleridname'];queues[_0x471b1b[_0xcd82('0x48')]][_0xcd82('0x2a')]=utils[_0xcd82('0x15')]();queues[_0x471b1b[_0xcd82('0x48')]][_0xcd82('0x27')]=utils[_0xcd82('0x15')]();queues[_0x471b1b[_0xcd82('0x48')]]['holdtime']=0x0;queues[_0x471b1b['transfertargetuniqueid']][_0xcd82('0x4d')]=0x0;}else{queues[_0x471b1b[_0xcd82('0x3f')]][_0xcd82('0x11')]=_0x471b1b[_0xcd82('0x44')];}}}}catch(_0xfe1d8c){utils[_0xcd82('0x4e')](_0xfe1d8c[_0xcd82('0x4f')]);}};exports[_0xcd82('0x50')]=function(_0x1c843f){if(!_[_0xcd82('0x1c')](queues[_0x1c843f[_0xcd82('0x5')]])){queues[_0x1c843f[_0xcd82('0x5')]]['musiconholdstartAt']=utils['now']();}};exports['musiconholdstop']=function(_0x86946d){if(!_[_0xcd82('0x1c')](queues[_0x86946d[_0xcd82('0x5')]])){if(!_[_0xcd82('0x1c')](queues[_0x86946d[_0xcd82('0x5')]][_0xcd82('0x51')])){queues[_0x86946d['uniqueid']][_0xcd82('0x4d')]+=utils[_0xcd82('0x29')](utils[_0xcd82('0x15')](),queues[_0x86946d[_0xcd82('0x5')]][_0xcd82('0x51')]);delete queues[_0x86946d[_0xcd82('0x5')]][_0xcd82('0x51')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 4327d20..273b38e 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 _0x008c=['then','membername','name','UserId','request','CreateVoiceRecording','newchannel','uniqueid','error','newstate','isNil','channelstate','linkedid','transfer','stack','variable','mixmonitor_filename','value','replace','.WAV','monitors','hangup','calleridnum','calleridname','connectedlinename','connectedlinenum','forEach','clone','newexten','application','toLowerCase','set','startsWith','cdr','appdata','split','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','debug','accountcode'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x008c,0x188));var _0xc008=function(_0x541ea6,_0x51cab6){_0x541ea6=_0x541ea6-0x0;var _0x3c3e84=_0x008c[_0x541ea6];return _0x3c3e84;};'use strict';var _=require(_0xc008('0x0'));var utils=require(_0xc008('0x1'));var recordings={};function writeDB(_0x15aadc){utils[_0xc008('0x2')](_0x15aadc);if(_0x15aadc[_0xc008('0x3')]){utils['getUserByInternal'](_0x15aadc[_0xc008('0x3')])[_0xc008('0x4')](function(_0x10b33c){if(_0x10b33c){_0x15aadc[_0xc008('0x5')]=_0x10b33c[_0xc008('0x6')];_0x15aadc[_0xc008('0x7')]=_0x10b33c['id'];}utils[_0xc008('0x8')](_0xc008('0x9'),_0x15aadc);});}else{utils[_0xc008('0x8')]('CreateVoiceRecording',_0x15aadc);}}exports[_0xc008('0xa')]=function(_0x5aa09b){try{if(_0x5aa09b[_0xc008('0xb')]==_0x5aa09b['linkedid']){recordings[_0x5aa09b['uniqueid']]={'uniqueid':_0x5aa09b[_0xc008('0xb')],'accountcode':_0x5aa09b[_0xc008('0x3')],'exten':_0x5aa09b['exten'],'context':_0x5aa09b['context'],'channel':_0x5aa09b['channel'],'monitors':[]};}}catch(_0x1eacfa){utils[_0xc008('0xc')](_0x1eacfa['stack']);}};exports[_0xc008('0xd')]=function(_0x332fd4){try{if(!_[_0xc008('0xe')](recordings[_0x332fd4[_0xc008('0xb')]])&&_0x332fd4[_0xc008('0xf')]==0x6){}else if(!_[_0xc008('0xe')](recordings[_0x332fd4[_0xc008('0x10')]])&&_0x332fd4['channelstate']==0x6&&_0x332fd4['context']!=_0xc008('0x11')){recordings[_0x332fd4['linkedid']][_0xc008('0x3')]=_0x332fd4[_0xc008('0x3')];}}catch(_0x2073ef){utils[_0xc008('0xc')](_0x2073ef[_0xc008('0x12')]);}};exports['varset']=function(_0x5e894e){try{if(!_['isNil'](_0x5e894e[_0xc008('0x13')])&&!_[_0xc008('0xe')](_0x5e894e[_0xc008('0x13')][_0xc008('0x14')])){if(_['endsWith'](_0x5e894e['value'],'.wav49')){_0x5e894e['value']=_0x5e894e[_0xc008('0x15')][_0xc008('0x16')]('.wav49',_0xc008('0x17'));}if(recordings[_0x5e894e['linkedid']]){var _0x4bd611=_['find'](recordings[_0x5e894e['linkedid']][_0xc008('0x18')],{'value':_0x5e894e['value']});if(_['isNil'](_0x4bd611)){recordings[_0x5e894e['linkedid']]['monitors']['push']({'value':_0x5e894e[_0xc008('0x15')]});}}}}catch(_0x4777a6){utils[_0xc008('0xc')](_0x4777a6[_0xc008('0x12')]);}};exports[_0xc008('0x19')]=function(_0x110128){try{if(!_['isNil'](recordings[_0x110128[_0xc008('0xb')]])){recordings[_0x110128['uniqueid']]['calleridnum']=_0x110128[_0xc008('0x1a')];recordings[_0x110128[_0xc008('0xb')]][_0xc008('0x1b')]=_0x110128[_0xc008('0x1b')];recordings[_0x110128['uniqueid']]['connectedlinenum']=_0x110128['connectedlinenum'];recordings[_0x110128[_0xc008('0xb')]][_0xc008('0x1c')]=_0x110128[_0xc008('0x1c')];if(recordings[_0x110128[_0xc008('0xb')]]['type']=='outbound'&&recordings[_0x110128['uniqueid']]['accountcode']){recordings[_0x110128['uniqueid']][_0xc008('0x1d')]=recordings[_0x110128[_0xc008('0xb')]][_0xc008('0x3')];recordings[_0x110128['uniqueid']][_0xc008('0x1c')]='';}recordings[_0x110128[_0xc008('0xb')]][_0xc008('0x18')][_0xc008('0x1e')](_0x4c5dec=>{var _0xcdb32b=_[_0xc008('0x1f')](recordings[_0x110128['uniqueid']]);_0xcdb32b['value']=_0x4c5dec['value'];writeDB(_0xcdb32b);});delete recordings[_0x110128[_0xc008('0xb')]];}}catch(_0x267abd){utils[_0xc008('0xc')](_0x267abd[_0xc008('0x12')]);}};exports[_0xc008('0x20')]=function(_0xceebc3){try{if(!_[_0xc008('0xe')](recordings[_0xceebc3[_0xc008('0xb')]])){if(_0xceebc3[_0xc008('0x21')][_0xc008('0x22')]()==_0xc008('0x23')&&_[_0xc008('0x24')](_0xceebc3['appdata'][_0xc008('0x22')](),_0xc008('0x25'))){var _0x499754=_0xceebc3[_0xc008('0x26')][_0xc008('0x27')]('=');var _0x383be7=_0x499754[0x0][_0xc008('0x28')](_0x499754[0x0][_0xc008('0x29')]('(')+0x1,_0x499754[0x0][_0xc008('0x29')](')'));var _0x7cfbc5=_0x499754[0x1];recordings[_0xceebc3[_0xc008('0xb')]][_0x383be7]=_0x7cfbc5;}}}catch(_0x29d4b3){utils['error'](_0x29d4b3[_0xc008('0x12')]);}};exports[_0xc008('0x2a')]=function(_0x459df4){try{if(!_[_0xc008('0xe')](recordings[_0x459df4[_0xc008('0xb')]])){recordings[_0x459df4[_0xc008('0xb')]][_0xc008('0x2b')]=_0x459df4['queue'];}}catch(_0x35f360){utils[_0xc008('0xc')](_0x35f360['stack']);}}; \ No newline at end of file +var _0x9c44=['getUserByInternal','then','name','request','CreateVoiceRecording','newchannel','uniqueid','linkedid','context','channel','error','stack','isNil','transfer','variable','endsWith','value','replace','.wav49','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','toLowerCase','set','startsWith','appdata','split','substring','lastIndexOf','queuecallerjoin','queue','debug','accountcode'];(function(_0x325570,_0xc48d90){var _0x2ecc45=function(_0x573211){while(--_0x573211){_0x325570['push'](_0x325570['shift']());}};_0x2ecc45(++_0xc48d90);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'use strict';var _=require('lodash');var utils=require('./utils');var recordings={};function writeDB(_0x1ffbbf){utils[_0x49c4('0x0')](_0x1ffbbf);if(_0x1ffbbf[_0x49c4('0x1')]){utils[_0x49c4('0x2')](_0x1ffbbf[_0x49c4('0x1')])[_0x49c4('0x3')](function(_0x4e0313){if(_0x4e0313){_0x1ffbbf['membername']=_0x4e0313[_0x49c4('0x4')];_0x1ffbbf['UserId']=_0x4e0313['id'];}utils[_0x49c4('0x5')](_0x49c4('0x6'),_0x1ffbbf);});}else{utils[_0x49c4('0x5')](_0x49c4('0x6'),_0x1ffbbf);}}exports[_0x49c4('0x7')]=function(_0x511d53){try{if(_0x511d53[_0x49c4('0x8')]==_0x511d53[_0x49c4('0x9')]){recordings[_0x511d53[_0x49c4('0x8')]]={'uniqueid':_0x511d53[_0x49c4('0x8')],'accountcode':_0x511d53['accountcode'],'exten':_0x511d53['exten'],'context':_0x511d53[_0x49c4('0xa')],'channel':_0x511d53[_0x49c4('0xb')],'monitors':[]};}}catch(_0x58cad7){utils[_0x49c4('0xc')](_0x58cad7[_0x49c4('0xd')]);}};exports['newstate']=function(_0x536d42){try{if(!_[_0x49c4('0xe')](recordings[_0x536d42[_0x49c4('0x8')]])&&_0x536d42['channelstate']==0x6){}else if(!_[_0x49c4('0xe')](recordings[_0x536d42[_0x49c4('0x9')]])&&_0x536d42['channelstate']==0x6&&_0x536d42[_0x49c4('0xa')]!=_0x49c4('0xf')){recordings[_0x536d42[_0x49c4('0x9')]][_0x49c4('0x1')]=_0x536d42[_0x49c4('0x1')];}}catch(_0x18211c){utils[_0x49c4('0xc')](_0x18211c[_0x49c4('0xd')]);}};exports['varset']=function(_0x3acd06){try{if(!_[_0x49c4('0xe')](_0x3acd06[_0x49c4('0x10')])&&!_[_0x49c4('0xe')](_0x3acd06[_0x49c4('0x10')]['mixmonitor_filename'])){if(_[_0x49c4('0x11')](_0x3acd06[_0x49c4('0x12')],'.wav49')){_0x3acd06['value']=_0x3acd06[_0x49c4('0x12')][_0x49c4('0x13')](_0x49c4('0x14'),'.WAV');}if(recordings[_0x3acd06[_0x49c4('0x9')]]){var _0x50b151=_[_0x49c4('0x15')](recordings[_0x3acd06[_0x49c4('0x9')]][_0x49c4('0x16')],{'value':_0x3acd06[_0x49c4('0x12')]});if(_[_0x49c4('0xe')](_0x50b151)){recordings[_0x3acd06[_0x49c4('0x9')]][_0x49c4('0x16')][_0x49c4('0x17')]({'value':_0x3acd06[_0x49c4('0x12')]});}}}}catch(_0x578447){utils['error'](_0x578447['stack']);}};exports[_0x49c4('0x18')]=function(_0x4f0b62){try{if(!_['isNil'](recordings[_0x4f0b62[_0x49c4('0x8')]])){recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x19')]=_0x4f0b62[_0x49c4('0x19')];recordings[_0x4f0b62['uniqueid']]['calleridname']=_0x4f0b62[_0x49c4('0x1a')];recordings[_0x4f0b62[_0x49c4('0x8')]]['connectedlinenum']=_0x4f0b62[_0x49c4('0x1b')];recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x1c')]=_0x4f0b62[_0x49c4('0x1c')];if(recordings[_0x4f0b62['uniqueid']]['type']==_0x49c4('0x1d')&&recordings[_0x4f0b62['uniqueid']][_0x49c4('0x1')]){recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x1b')]=recordings[_0x4f0b62[_0x49c4('0x8')]]['accountcode'];recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x1c')]='';}recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x16')][_0x49c4('0x1e')](_0x29f835=>{var _0x26ba17=_[_0x49c4('0x1f')](recordings[_0x4f0b62[_0x49c4('0x8')]]);_0x26ba17[_0x49c4('0x12')]=_0x29f835[_0x49c4('0x12')];writeDB(_0x26ba17);});delete recordings[_0x4f0b62['uniqueid']];}}catch(_0x4f4495){utils['error'](_0x4f4495[_0x49c4('0xd')]);}};exports[_0x49c4('0x20')]=function(_0x1eb035){try{if(!_[_0x49c4('0xe')](recordings[_0x1eb035[_0x49c4('0x8')]])){if(_0x1eb035['application'][_0x49c4('0x21')]()==_0x49c4('0x22')&&_[_0x49c4('0x23')](_0x1eb035[_0x49c4('0x24')]['toLowerCase'](),'cdr')){var _0xce57ef=_0x1eb035[_0x49c4('0x24')][_0x49c4('0x25')]('=');var _0x13b3b4=_0xce57ef[0x0][_0x49c4('0x26')](_0xce57ef[0x0]['lastIndexOf']('(')+0x1,_0xce57ef[0x0][_0x49c4('0x27')](')'));var _0x84c621=_0xce57ef[0x1];recordings[_0x1eb035[_0x49c4('0x8')]][_0x13b3b4]=_0x84c621;}}}catch(_0x512d02){utils['error'](_0x512d02[_0x49c4('0xd')]);}};exports[_0x49c4('0x28')]=function(_0x3bec0a){try{if(!_[_0x49c4('0xe')](recordings[_0x3bec0a[_0x49c4('0x8')]])){recordings[_0x3bec0a[_0x49c4('0x8')]][_0x49c4('0x29')]=_0x3bec0a[_0x49c4('0x29')];}}catch(_0x3209cd){utils['error'](_0x3209cd[_0x49c4('0xd')]);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 50fa47a..a50f706 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 _0x6a1d=['CreateVoiceTransferReport','blindtransfer','blind','error','attendedtransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid','origtransferercontext','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','lodash','util','./utils','info','format','TRANSFER|%s','type'];(function(_0x4dbaa6,_0x1861e2){var _0x4e9889=function(_0xeb11e6){while(--_0xeb11e6){_0x4dbaa6['push'](_0x4dbaa6['shift']());}};_0x4e9889(++_0x1861e2);}(_0x6a1d,0xe1));var _0xd6a1=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x6a1d[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0xd6a1('0x0'));var util=require(_0xd6a1('0x1'));var utils=require(_0xd6a1('0x2'));function writeDB(_0x5c5ac3){utils[_0xd6a1('0x3')](util[_0xd6a1('0x4')](_0xd6a1('0x5'),_0x5c5ac3[_0xd6a1('0x6')]));utils['request'](_0xd6a1('0x7'),_0x5c5ac3);}exports[_0xd6a1('0x8')]=function(_0x429bb8){try{_0x429bb8['type']=_0xd6a1('0x9');writeDB(_0x429bb8);}catch(_0x19efd9){utils[_0xd6a1('0xa')](_0x19efd9['stack']);}};exports[_0xd6a1('0xb')]=function(_0x24002c){try{_0x24002c=_['assign'](_0x24002c,{'transfererchannel':_0x24002c[_0xd6a1('0xc')],'transferercalleridnum':_0x24002c[_0xd6a1('0xd')],'transferercalleridname':_0x24002c[_0xd6a1('0xe')],'transfererconnectedlinenum':_0x24002c[_0xd6a1('0xf')],'transfererconnectedlinename':_0x24002c[_0xd6a1('0x10')],'transfereraccountcode':_0x24002c['origtransfereraccountcode'],'transferercontext':_0x24002c[_0xd6a1('0x11')],'transfererexten':_0x24002c['secondtransfererexten'],'transfererlinkedid':_0x24002c[_0xd6a1('0x12')],'context':_0x24002c[_0xd6a1('0x13')],'extension':_0x24002c['origtransfererexten'],'type':_0xd6a1('0x14')});if(_[_0xd6a1('0x15')](_0x24002c[_0xd6a1('0x16')])){_0x24002c=_['assign'](_0x24002c,{'transfereechannel':_0x24002c[_0xd6a1('0x17')],'transfereecalleridnum':_0x24002c[_0xd6a1('0x18')],'transfereecalleridname':_0x24002c[_0xd6a1('0x19')],'transfereeconnectedlinenum':_0x24002c[_0xd6a1('0x1a')],'transfereeconnectedlinename':_0x24002c['transfertargetconnectedlinename'],'transfereeaccountcode':_0x24002c[_0xd6a1('0x1b')],'transfereecontext':_0x24002c[_0xd6a1('0x1c')],'transfereeexten':_0x24002c['transfertargetexten'],'transfereelinkedid':_0x24002c['transfertargetlinkedid']});}writeDB(_0x24002c);}catch(_0x2f7fac){utils['error'](_0x2f7fac['stack']);}}; \ No newline at end of file +var _0x51f8=['transfertargetlinkedid','error','stack','lodash','util','./utils','info','TRANSFER|%s','type','CreateVoiceTransferReport','blindtransfer','blind','attendedtransfer','assign','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetexten'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x51f8,0x15f));var _0x851f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x51f8[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x851f('0x0'));var util=require(_0x851f('0x1'));var utils=require(_0x851f('0x2'));function writeDB(_0x59e701){utils[_0x851f('0x3')](util['format'](_0x851f('0x4'),_0x59e701[_0x851f('0x5')]));utils['request'](_0x851f('0x6'),_0x59e701);}exports[_0x851f('0x7')]=function(_0x2799dc){try{_0x2799dc[_0x851f('0x5')]=_0x851f('0x8');writeDB(_0x2799dc);}catch(_0x45a20a){utils['error'](_0x45a20a['stack']);}};exports[_0x851f('0x9')]=function(_0x54fe9e){try{_0x54fe9e=_[_0x851f('0xa')](_0x54fe9e,{'transfererchannel':_0x54fe9e['origtransfererchannel'],'transferercalleridnum':_0x54fe9e['origtransferercalleridnum'],'transferercalleridname':_0x54fe9e[_0x851f('0xb')],'transfererconnectedlinenum':_0x54fe9e[_0x851f('0xc')],'transfererconnectedlinename':_0x54fe9e[_0x851f('0xd')],'transfereraccountcode':_0x54fe9e[_0x851f('0xe')],'transferercontext':_0x54fe9e[_0x851f('0xf')],'transfererexten':_0x54fe9e[_0x851f('0x10')],'transfererlinkedid':_0x54fe9e['origtransfererlinkedid'],'context':_0x54fe9e['origtransferercontext'],'extension':_0x54fe9e[_0x851f('0x11')],'type':_0x851f('0x12')});if(_[_0x851f('0x13')](_0x54fe9e[_0x851f('0x14')])){_0x54fe9e=_['assign'](_0x54fe9e,{'transfereechannel':_0x54fe9e[_0x851f('0x15')],'transfereecalleridnum':_0x54fe9e['transfertargetcalleridnum'],'transfereecalleridname':_0x54fe9e[_0x851f('0x16')],'transfereeconnectedlinenum':_0x54fe9e[_0x851f('0x17')],'transfereeconnectedlinename':_0x54fe9e['transfertargetconnectedlinename'],'transfereeaccountcode':_0x54fe9e[_0x851f('0x18')],'transfereecontext':_0x54fe9e['transfertargetcontext'],'transfereeexten':_0x54fe9e[_0x851f('0x19')],'transfereelinkedid':_0x54fe9e[_0x851f('0x1a')]});}writeDB(_0x54fe9e);}catch(_0x21afeb){utils[_0x851f('0x1b')](_0x21afeb[_0x851f('0x1c')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 9d03e41..b62595a 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 _0x7b36=['diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','client','http','../../config/logger','xdr','info','debug','error','then','stringify','request','GetUser','internal','name','interface','GETUSER|','result','length','FOUND','getUserByInternal','stack','getUserByInterface','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','GETVOICEQUEUEBYNAME|','NOTFOUND','catch','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime'];(function(_0xc7496f,_0x198920){var _0x16a05a=function(_0x5489d7){while(--_0x5489d7){_0xc7496f['push'](_0xc7496f['shift']());}};_0x16a05a(++_0x198920);}(_0x7b36,0x86));var _0x67b3=function(_0x29bed9,_0xe4b800){_0x29bed9=_0x29bed9-0x0;var _0x1c6fd7=_0x7b36[_0x29bed9];return _0x1c6fd7;};'use strict';var jayson=require(_0x67b3('0x0'));var moment=require(_0x67b3('0x1'));var BPromise=require('bluebird');var client=jayson[_0x67b3('0x2')][_0x67b3('0x3')]({'port':0x2329});var logger=require(_0x67b3('0x4'))(_0x67b3('0x5'));exports[_0x67b3('0x6')]=function(_0x553a01){logger['info'](_0x553a01);};exports[_0x67b3('0x7')]=function(_0x23f1f0){logger[_0x67b3('0x7')](JSON['stringify'](_0x23f1f0));};exports[_0x67b3('0x8')]=function(_0x5a85e1){logger[_0x67b3('0x8')](_0x5a85e1['stack']);};exports['request']=function(_0x16c733,_0x1aba7d){return client['request'](_0x16c733,{'body':_0x1aba7d})[_0x67b3('0x9')](function(_0x298225){logger[_0x67b3('0x7')](JSON[_0x67b3('0xa')](_0x298225));})['catch'](function(_0x5e2d56){logger[_0x67b3('0x8')](_0x5e2d56['stack']);});};function getUser(_0x1b27d6){return client[_0x67b3('0xb')](_0x67b3('0xc'),{'options':{'raw':!![],'attributes':['id',_0x67b3('0xd'),_0x67b3('0xe'),_0x67b3('0xf')],'where':_0x1b27d6,'limit':0x1}})[_0x67b3('0x9')](function(_0x6fdde){logger[_0x67b3('0x6')](_0x67b3('0x10')+JSON[_0x67b3('0xa')](_0x1b27d6)+'|'+(_0x6fdde[_0x67b3('0x11')][_0x67b3('0x12')]?_0x67b3('0x13'):'NOTFOUND'));return _0x6fdde[_0x67b3('0x11')]['length']?_0x6fdde[_0x67b3('0x11')][0x0]:null;});}exports[_0x67b3('0x14')]=function(_0x5f0a8e){return new BPromise(function(_0x5482d7,_0x35b222){if(_0x5f0a8e){return getUser({'internal':_0x5f0a8e})[_0x67b3('0x9')](function(_0x5b9164){return _0x5482d7(_0x5b9164);})['catch'](function(_0x3e4eb8){logger['error'](_0x3e4eb8[_0x67b3('0x15')]);return _0x5482d7(null);});}else{return _0x5482d7(null);}});};exports[_0x67b3('0x16')]=function(_0x2ff46a){return new BPromise(function(_0x5726cb,_0x5ce207){if(_0x2ff46a){return getUser({'interface':_0x2ff46a})[_0x67b3('0x9')](function(_0x2a5072){return _0x5726cb(_0x2a5072);})['catch'](function(_0x5a2a92){logger['error'](_0x5a2a92[_0x67b3('0x15')]);return _0x5726cb(null);});}else{return _0x5726cb(null);}});};exports['getUserByName']=function(_0x12e5a7){return new BPromise(function(_0x368199,_0xf16bb){if(_0x12e5a7){return getUser({'name':_0x12e5a7})[_0x67b3('0x9')](function(_0xbe28ad){return _0x368199(_0xbe28ad);})['catch'](function(_0x1428ae){logger[_0x67b3('0x8')](_0x1428ae[_0x67b3('0x15')]);return _0x368199(null);});}else{return _0x368199(null);}});};exports[_0x67b3('0x17')]=function(_0x2892ba){return new BPromise(function(_0x26b908,_0x5579a9){if(_0x2892ba){return client[_0x67b3('0xb')](_0x67b3('0x18'),{'options':{'raw':!![],'attributes':['id','name',_0x67b3('0x19'),_0x67b3('0x1a'),_0x67b3('0x1b')],'where':{'name':_0x2892ba},'limit':0x1}})['then'](function(_0x1eacad){logger['info'](_0x67b3('0x1c')+_0x2892ba+'|'+(_0x1eacad[_0x67b3('0x11')][_0x67b3('0x12')]?_0x67b3('0x13'):_0x67b3('0x1d')));return _0x26b908(_0x1eacad['result'][_0x67b3('0x12')]?_0x1eacad[_0x67b3('0x11')][0x0]:null);})[_0x67b3('0x1e')](function(_0x13cb89){logger[_0x67b3('0x8')](_0x13cb89[_0x67b3('0x15')]);return _0x26b908(null);});}else{return _0x26b908(null);}});};exports[_0x67b3('0x1f')]=function(_0x3f16c4,_0x421b9d){return moment(_0x3f16c4)['add'](_0x421b9d,_0x67b3('0x20'))[_0x67b3('0x21')](_0x67b3('0x22'));};exports[_0x67b3('0x23')]=function(_0x44b4ea,_0x33fad5){return moment(_0x44b4ea)[_0x67b3('0x24')](_0x33fad5,'seconds')[_0x67b3('0x21')](_0x67b3('0x22'));};exports[_0x67b3('0x25')]=function(_0x53e772,_0x2a0308){return moment(_0x53e772)[_0x67b3('0x26')](moment(_0x2a0308),_0x67b3('0x20'));};exports[_0x67b3('0x27')]=function(_0x482a97,_0x5f25f5){return parseInt(_0x482a97,0xa)+parseInt(_0x5f25f5,0xa);};exports[_0x67b3('0x28')]=function(){return moment()['format'](_0x67b3('0x22'));};exports[_0x67b3('0x29')]=function(_0x1ece54,_0x4a1008){if(_0x4a1008){return moment(_0x1ece54)[_0x67b3('0x29')](_0x4a1008);}else{return!![];}};exports[_0x67b3('0x2a')]=function(_0x45c879,_0x30bafa){if(_0x30bafa){return moment(_0x45c879)['isBefore'](_0x30bafa);}else if(_0x45c879){return!![];}else{return![];}}; \ No newline at end of file +var _0xf31b=['diff','sumTime','isAfter','isBefore','jayson/promise','bluebird','client','../../config/logger','xdr','info','debug','error','stack','request','stringify','catch','GetUser','internal','name','then','GETUSER|','length','FOUND','NOTFOUND','result','getUserByInternal','getUserByName','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','GETVOICEQUEUEBYNAME|','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xf31b,0xa8));var _0xbf31=function(_0x3e38a4,_0x390634){_0x3e38a4=_0x3e38a4-0x0;var _0xe3af0a=_0xf31b[_0x3e38a4];return _0xe3af0a;};'use strict';var jayson=require(_0xbf31('0x0'));var moment=require('moment');var BPromise=require(_0xbf31('0x1'));var client=jayson[_0xbf31('0x2')]['http']({'port':0x2329});var logger=require(_0xbf31('0x3'))(_0xbf31('0x4'));exports['info']=function(_0x234f9c){logger[_0xbf31('0x5')](_0x234f9c);};exports[_0xbf31('0x6')]=function(_0xd9ff63){logger[_0xbf31('0x6')](JSON['stringify'](_0xd9ff63));};exports[_0xbf31('0x7')]=function(_0x146277){logger[_0xbf31('0x7')](_0x146277[_0xbf31('0x8')]);};exports[_0xbf31('0x9')]=function(_0x412d85,_0x2cbb2d){return client[_0xbf31('0x9')](_0x412d85,{'body':_0x2cbb2d})['then'](function(_0x3b9c65){logger['debug'](JSON[_0xbf31('0xa')](_0x3b9c65));})[_0xbf31('0xb')](function(_0x5b0c5d){logger[_0xbf31('0x7')](_0x5b0c5d['stack']);});};function getUser(_0x36f503){return client[_0xbf31('0x9')](_0xbf31('0xc'),{'options':{'raw':!![],'attributes':['id',_0xbf31('0xd'),_0xbf31('0xe'),'interface'],'where':_0x36f503,'limit':0x1}})[_0xbf31('0xf')](function(_0x5d3668){logger[_0xbf31('0x5')](_0xbf31('0x10')+JSON[_0xbf31('0xa')](_0x36f503)+'|'+(_0x5d3668['result'][_0xbf31('0x11')]?_0xbf31('0x12'):_0xbf31('0x13')));return _0x5d3668[_0xbf31('0x14')][_0xbf31('0x11')]?_0x5d3668[_0xbf31('0x14')][0x0]:null;});}exports[_0xbf31('0x15')]=function(_0x33d071){return new BPromise(function(_0x10ab69,_0x21eaa2){if(_0x33d071){return getUser({'internal':_0x33d071})[_0xbf31('0xf')](function(_0x27f664){return _0x10ab69(_0x27f664);})[_0xbf31('0xb')](function(_0x388752){logger['error'](_0x388752[_0xbf31('0x8')]);return _0x10ab69(null);});}else{return _0x10ab69(null);}});};exports['getUserByInterface']=function(_0x69a86e){return new BPromise(function(_0x5591d8,_0x23250d){if(_0x69a86e){return getUser({'interface':_0x69a86e})['then'](function(_0x44b19a){return _0x5591d8(_0x44b19a);})['catch'](function(_0x5bd1ef){logger['error'](_0x5bd1ef[_0xbf31('0x8')]);return _0x5591d8(null);});}else{return _0x5591d8(null);}});};exports[_0xbf31('0x16')]=function(_0x4ec82b){return new BPromise(function(_0x32ea91,_0x556a80){if(_0x4ec82b){return getUser({'name':_0x4ec82b})[_0xbf31('0xf')](function(_0x3115e1){return _0x32ea91(_0x3115e1);})[_0xbf31('0xb')](function(_0x281568){logger[_0xbf31('0x7')](_0x281568[_0xbf31('0x8')]);return _0x32ea91(null);});}else{return _0x32ea91(null);}});};exports[_0xbf31('0x17')]=function(_0x5cb502){return new BPromise(function(_0x3d2f2e,_0x243679){if(_0x5cb502){return client['request'](_0xbf31('0x18'),{'options':{'raw':!![],'attributes':['id','name',_0xbf31('0x19'),_0xbf31('0x1a'),_0xbf31('0x1b')],'where':{'name':_0x5cb502},'limit':0x1}})[_0xbf31('0xf')](function(_0x467fbb){logger[_0xbf31('0x5')](_0xbf31('0x1c')+_0x5cb502+'|'+(_0x467fbb['result'][_0xbf31('0x11')]?_0xbf31('0x12'):_0xbf31('0x13')));return _0x3d2f2e(_0x467fbb[_0xbf31('0x14')][_0xbf31('0x11')]?_0x467fbb['result'][0x0]:null);})[_0xbf31('0xb')](function(_0x10057b){logger[_0xbf31('0x7')](_0x10057b[_0xbf31('0x8')]);return _0x3d2f2e(null);});}else{return _0x3d2f2e(null);}});};exports[_0xbf31('0x1d')]=function(_0x54d3d8,_0xfa09c9){return moment(_0x54d3d8)[_0xbf31('0x1e')](_0xfa09c9,_0xbf31('0x1f'))[_0xbf31('0x20')](_0xbf31('0x21'));};exports[_0xbf31('0x22')]=function(_0x5bb325,_0x3613be){return moment(_0x5bb325)[_0xbf31('0x23')](_0x3613be,_0xbf31('0x1f'))[_0xbf31('0x20')](_0xbf31('0x21'));};exports[_0xbf31('0x24')]=function(_0x52303,_0x1e04a9){return moment(_0x52303)[_0xbf31('0x25')](moment(_0x1e04a9),_0xbf31('0x1f'));};exports[_0xbf31('0x26')]=function(_0x15aa78,_0x13ab45){return parseInt(_0x15aa78,0xa)+parseInt(_0x13ab45,0xa);};exports['now']=function(){return moment()[_0xbf31('0x20')](_0xbf31('0x21'));};exports['isAfter']=function(_0x2687dd,_0x3796fd){if(_0x3796fd){return moment(_0x2687dd)[_0xbf31('0x27')](_0x3796fd);}else{return!![];}};exports[_0xbf31('0x28')]=function(_0x48c871,_0x417bdd){if(_0x417bdd){return moment(_0x48c871)['isBefore'](_0x417bdd);}else if(_0x48c871){return!![];}else{return![];}}; \ No newline at end of file